summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormanojgudi2013-10-07 14:26:59 +0530
committermanojgudi2013-10-07 14:26:59 +0530
commit6bc92d66be9975d618ac4cd104e7f5ff6e8605f2 (patch)
tree3a77657667b4ef037f712ee68a5ec86c86cba5c5
parent452defdb4a78e9e826740ddf4b9673e926c568a4 (diff)
parente9576e44ef8f0ad67d8cd8a4e025a0f8da0727f8 (diff)
downloadgnuradio-6bc92d66be9975d618ac4cd104e7f5ff6e8605f2.tar.gz
gnuradio-6bc92d66be9975d618ac4cd104e7f5ff6e8605f2.tar.bz2
gnuradio-6bc92d66be9975d618ac4cd104e7f5ff6e8605f2.zip
merge from gr36_ni branch
-rw-r--r--.gitattributes9
-rw-r--r--.gitignore3
-rw-r--r--AUTHORS17
-rw-r--r--CMakeLists.txt275
-rw-r--r--COPYING674
-rw-r--r--README146
-rw-r--r--README-win32-mingw-short.txt92
-rw-r--r--README.building-boost48
-rw-r--r--README.hacking320
-rw-r--r--cmake/Modules/CMakeMacroLibtoolFile.cmake62
-rw-r--r--cmake/Modules/CMakeParseArgumentsCopy.cmake138
-rw-r--r--cmake/Modules/FindALSA.cmake36
-rw-r--r--cmake/Modules/FindCppUnit.cmake36
-rw-r--r--cmake/Modules/FindFFTW3f.cmake41
-rw-r--r--cmake/Modules/FindGSL.cmake146
-rw-r--r--cmake/Modules/FindGit.cmake46
-rw-r--r--cmake/Modules/FindJack.cmake82
-rw-r--r--cmake/Modules/FindOSS.cmake46
-rw-r--r--cmake/Modules/FindPortaudio.cmake35
-rw-r--r--cmake/Modules/FindQwt.cmake32
-rw-r--r--cmake/Modules/FindSphinx.cmake37
-rw-r--r--cmake/Modules/FindUHD.cmake28
-rw-r--r--cmake/Modules/FindUSB.cmake28
-rw-r--r--cmake/Modules/GrBoost.cmake99
-rw-r--r--cmake/Modules/GrComponent.cmake115
-rw-r--r--cmake/Modules/GrMiscUtils.cmake280
-rw-r--r--cmake/Modules/GrPackage.cmake177
-rw-r--r--cmake/Modules/GrPlatform.cmake54
-rw-r--r--cmake/Modules/GrPython.cmake234
-rw-r--r--cmake/Modules/GrSetupQt4.cmake156
-rw-r--r--cmake/Modules/GrSwig.cmake236
-rw-r--r--cmake/Modules/GrTest.cmake137
-rw-r--r--cmake/Modules/GrVersion.cmake76
-rw-r--r--cmake/Modules/LibFindMacros.cmake99
-rw-r--r--cmake/Packaging/Fedora-15.cmake12
-rw-r--r--cmake/Packaging/Fedora-16.cmake12
-rw-r--r--cmake/Packaging/Fedora-17.cmake12
-rw-r--r--cmake/Packaging/Fedora-18.cmake12
-rw-r--r--cmake/Packaging/Ubuntu-10.04.cmake12
-rw-r--r--cmake/Packaging/Ubuntu-10.10.cmake12
-rw-r--r--cmake/Packaging/Ubuntu-11.04.cmake13
-rw-r--r--cmake/Packaging/Ubuntu-11.10.cmake12
-rw-r--r--cmake/Packaging/Ubuntu-12.04.cmake12
-rw-r--r--cmake/Packaging/Ubuntu-12.10.cmake12
-rw-r--r--cmake/Packaging/Ubuntu-13.04.cmake12
-rwxr-xr-xcmake/Packaging/post_install.in4
-rwxr-xr-xcmake/Packaging/post_uninstall.in3
-rwxr-xr-xcmake/Packaging/postinst.in6
-rwxr-xr-xcmake/Packaging/postrm.in5
-rwxr-xr-xcmake/Packaging/pre_install.in1
-rwxr-xr-xcmake/Packaging/pre_uninstall.in3
-rwxr-xr-xcmake/Packaging/preinst.in5
-rwxr-xr-xcmake/Packaging/prerm.in5
-rw-r--r--cmake/Toolchains/arm_cortex_a8_native.cmake8
-rw-r--r--cmake/cmake_uninstall.cmake.in32
-rw-r--r--cmake/msvc/config.h58
-rw-r--r--cmake/msvc/inttypes.h301
-rw-r--r--cmake/msvc/stdint.h251
-rw-r--r--cmake/msvc/sys/time.h69
-rw-r--r--cmake/msvc/unistd.h10
-rw-r--r--docs/CMakeLists.txt74
-rw-r--r--docs/ChangeLog24
-rw-r--r--docs/doxygen/CMakeLists.txt52
-rw-r--r--docs/doxygen/Doxyfile.in1548
-rw-r--r--docs/doxygen/Doxyfile.swig_doc.in1497
-rw-r--r--docs/doxygen/README.doxyxml26
-rw-r--r--docs/doxygen/doxyxml/__init__.py82
-rw-r--r--docs/doxygen/doxyxml/base.py219
-rw-r--r--docs/doxygen/doxyxml/doxyindex.py289
-rw-r--r--docs/doxygen/doxyxml/example/Doxyfile1534
-rw-r--r--docs/doxygen/doxyxml/example/aadvark.cc50
-rw-r--r--docs/doxygen/doxyxml/example/aadvark.h44
-rw-r--r--docs/doxygen/doxyxml/example/xml/aadvark_8cc.xml88
-rw-r--r--docs/doxygen/doxyxml/example/xml/aadvark_8h.xml72
-rw-r--r--docs/doxygen/doxyxml/example/xml/classAadvark.xml86
-rw-r--r--docs/doxygen/doxyxml/example/xml/combine.xslt15
-rw-r--r--docs/doxygen/doxyxml/example/xml/compound.xsd814
-rw-r--r--docs/doxygen/doxyxml/example/xml/index.xml17
-rw-r--r--docs/doxygen/doxyxml/example/xml/index.xsd66
-rw-r--r--docs/doxygen/doxyxml/generated/__init__.py7
-rw-r--r--docs/doxygen/doxyxml/generated/compound.py503
-rw-r--r--docs/doxygen/doxyxml/generated/compoundsuper.py8342
-rw-r--r--docs/doxygen/doxyxml/generated/index.py77
-rw-r--r--docs/doxygen/doxyxml/generated/indexsuper.py523
-rw-r--r--docs/doxygen/doxyxml/text.py56
-rw-r--r--docs/doxygen/images/gnuradio-logo.pngbin0 -> 5223 bytes
-rwxr-xr-xdocs/doxygen/other/doxypy.py414
-rw-r--r--docs/doxygen/other/extra_pages.dox326
-rw-r--r--docs/doxygen/other/group_defs.dox68
-rw-r--r--docs/doxygen/other/main_page.dox405
-rw-r--r--docs/doxygen/other/metadata.dox330
-rw-r--r--docs/doxygen/other/msg_passing.dox269
-rw-r--r--docs/doxygen/other/pfb_intro.dox96
-rw-r--r--docs/doxygen/other/pmt.dox348
-rwxr-xr-xdocs/doxygen/other/shared_ptr_docstub.h24
-rw-r--r--docs/doxygen/other/thread_affinity.dox65
-rw-r--r--docs/doxygen/other/tv-channel-frequencies79
-rw-r--r--docs/doxygen/other/vector_docstub.h16
-rw-r--r--docs/doxygen/swig_doc.py326
-rw-r--r--docs/exploring-gnuradio/Makefile30
-rw-r--r--docs/exploring-gnuradio/ddc.eps3105
-rw-r--r--docs/exploring-gnuradio/ddc.pngbin0 -> 42199 bytes
-rwxr-xr-xdocs/exploring-gnuradio/dial_tone.py43
-rw-r--r--docs/exploring-gnuradio/dial_tone_example.xml28
-rw-r--r--docs/exploring-gnuradio/exploring-gnuradio.xml460
-rwxr-xr-xdocs/exploring-gnuradio/fm_demod.py150
-rw-r--r--docs/exploring-gnuradio/fm_demod_example.xml123
-rw-r--r--docs/exploring-gnuradio/swr-block-diagram.eps2399
-rw-r--r--docs/exploring-gnuradio/swr-block-diagram.pngbin0 -> 24686 bytes
-rw-r--r--docs/exploring-gnuradio/usrp-block-diagram.eps2785
-rw-r--r--docs/exploring-gnuradio/usrp-block-diagram.pngbin0 -> 35729 bytes
-rw-r--r--docs/sphinx/CMakeLists.txt35
-rw-r--r--docs/sphinx/README72
-rw-r--r--docs/sphinx/gnuradio_sphinx.py208
-rw-r--r--docs/sphinx/hieroglyph/LICENSE.txt26
-rw-r--r--docs/sphinx/hieroglyph/README.txt10
-rw-r--r--docs/sphinx/hieroglyph/__init__.py6
-rw-r--r--docs/sphinx/hieroglyph/errors.py10
-rw-r--r--docs/sphinx/hieroglyph/hieroglyph.py404
-rw-r--r--docs/sphinx/hieroglyph/nodes.py267
-rw-r--r--docs/sphinx/hieroglyph/test/__init__.py2
-rw-r--r--docs/sphinx/hieroglyph/test/test_comments.py586
-rw-r--r--docs/sphinx/hieroglyph/test/test_hierglyph.py264
-rw-r--r--docs/sphinx/hieroglyph/test/test_nodes.py386
-rw-r--r--docs/sphinx/hieroglyph/version.py3
-rw-r--r--docs/sphinx/run_sphinx_build.sh.in7
-rw-r--r--docs/sphinx/source/atsc/blks.rst20
-rw-r--r--docs/sphinx/source/atsc/index.rst62
-rw-r--r--docs/sphinx/source/audio/index.rst7
-rw-r--r--docs/sphinx/source/blks2/blks.rst31
-rw-r--r--docs/sphinx/source/blks2/index.rst47
-rw-r--r--docs/sphinx/source/blks2/utilities.rst4
-rw-r--r--docs/sphinx/source/conf.py.in217
-rw-r--r--docs/sphinx/source/digital/blocks.rst51
-rw-r--r--docs/sphinx/source/digital/constellations.rst13
-rw-r--r--docs/sphinx/source/digital/index.rst133
-rw-r--r--docs/sphinx/source/digital/ofdm.rst14
-rw-r--r--docs/sphinx/source/digital/pkt_utils.rst18
-rw-r--r--docs/sphinx/source/digital/utilities.rst12
-rw-r--r--docs/sphinx/source/eng_notation/index.rst8
-rw-r--r--docs/sphinx/source/eng_option/index.rst6
-rw-r--r--docs/sphinx/source/fft.rst8
-rw-r--r--docs/sphinx/source/gr/coding_blk.rst11
-rw-r--r--docs/sphinx/source/gr/converter_blk.rst32
-rw-r--r--docs/sphinx/source/gr/demodulation_blk.rst4
-rw-r--r--docs/sphinx/source/gr/dft_blk.rst6
-rw-r--r--docs/sphinx/source/gr/filter_blk.rst46
-rw-r--r--docs/sphinx/source/gr/filter_design.rst7
-rw-r--r--docs/sphinx/source/gr/index.rst380
-rw-r--r--docs/sphinx/source/gr/internal.rst7
-rw-r--r--docs/sphinx/source/gr/level_blk.rst26
-rw-r--r--docs/sphinx/source/gr/math_blk.rst59
-rw-r--r--docs/sphinx/source/gr/misc.rst12
-rw-r--r--docs/sphinx/source/gr/misc_blk.rst12
-rw-r--r--docs/sphinx/source/gr/modulation_blk.rst6
-rw-r--r--docs/sphinx/source/gr/sink_blk.rst25
-rw-r--r--docs/sphinx/source/gr/slicedice_blk.rst14
-rw-r--r--docs/sphinx/source/gr/source_blk.rst26
-rw-r--r--docs/sphinx/source/gr/sync_blk.rst9
-rw-r--r--docs/sphinx/source/gr/top_block.rst7
-rw-r--r--docs/sphinx/source/gr_unittest/index.rst7
-rw-r--r--docs/sphinx/source/index.rst133
-rw-r--r--docs/sphinx/source/noaa.rst8
-rw-r--r--docs/sphinx/source/optfir/detail.rst14
-rw-r--r--docs/sphinx/source/optfir/index.rst19
-rw-r--r--docs/sphinx/source/pager/blks.rst9
-rw-r--r--docs/sphinx/source/pager/index.rst23
-rw-r--r--docs/sphinx/source/plot_data.rst6
-rw-r--r--docs/sphinx/source/pyqt_filter.rst6
-rw-r--r--docs/sphinx/source/pyqt_plot.rst6
-rw-r--r--docs/sphinx/source/qtgui/index.rst9
-rw-r--r--docs/sphinx/source/trellis/blks.rst62
-rw-r--r--docs/sphinx/source/trellis/index.rst90
-rw-r--r--docs/sphinx/source/trellis/objs.rst5
-rw-r--r--docs/sphinx/source/uhd.rst18
-rw-r--r--docs/sphinx/source/video_sdl.rst7
-rw-r--r--docs/sphinx/source/vocoder/blks.rst19
-rw-r--r--docs/sphinx/source/vocoder/index.rst26
-rw-r--r--docs/sphinx/source/wavelet.rst8
-rw-r--r--docs/sphinx/source/window/detail.rst20
-rw-r--r--docs/sphinx/source/window/index.rst25
-rw-r--r--docs/sphinx/source/wxgui/blks.rst13
-rw-r--r--docs/sphinx/source/wxgui/index.rst18
-rw-r--r--dtools/README25
-rwxr-xr-xdtools/bin/check-imports4
-rwxr-xr-xdtools/bin/check-tarball-h-files25
-rwxr-xr-xdtools/bin/fix-copyright-years65
-rwxr-xr-xdtools/bin/install-tbb88
-rwxr-xr-xdtools/bin/make-upload16
-rwxr-xr-xdtools/bin/remove-whitespace3
-rwxr-xr-xdtools/bin/update_fsf_address134
-rw-r--r--gnuradio-core/CMakeLists.txt145
-rw-r--r--gnuradio-core/gnuradio-core.conf14
-rw-r--r--gnuradio-core/gnuradio-core.pc.in12
-rw-r--r--gnuradio-core/src/examples/CMakeLists.txt25
-rw-r--r--gnuradio-core/src/examples/mp-sched/CMakeLists.txt36
-rw-r--r--gnuradio-core/src/examples/mp-sched/README2
-rwxr-xr-xgnuradio-core/src/examples/mp-sched/affinity_set.py70
-rw-r--r--gnuradio-core/src/examples/mp-sched/perf-data/core-duo.dat65
-rw-r--r--gnuradio-core/src/examples/mp-sched/perf-data/core2-duo.dat65
-rw-r--r--gnuradio-core/src/examples/mp-sched/perf-data/dual-quad-core-2.33-clovertown.dat257
-rw-r--r--gnuradio-core/src/examples/mp-sched/perf-data/dual-quad-core-3.00-penryn.dat257
-rw-r--r--gnuradio-core/src/examples/mp-sched/perf-data/js21-altivec.dat65
-rw-r--r--gnuradio-core/src/examples/mp-sched/perf-data/js21.dat65
-rw-r--r--gnuradio-core/src/examples/mp-sched/perf-data/ps3-altivec.dat65
-rw-r--r--gnuradio-core/src/examples/mp-sched/perf-data/ps3.dat65
-rw-r--r--gnuradio-core/src/examples/mp-sched/perf-data/qs21-altivec.dat65
-rw-r--r--gnuradio-core/src/examples/mp-sched/perf-data/qs21.dat65
-rwxr-xr-xgnuradio-core/src/examples/mp-sched/plot_flops.py98
-rwxr-xr-xgnuradio-core/src/examples/mp-sched/run_synthetic.py101
-rwxr-xr-xgnuradio-core/src/examples/mp-sched/synthetic.py118
-rwxr-xr-xgnuradio-core/src/examples/mp-sched/wfm_rcv_pll_to_wav.py127
-rw-r--r--gnuradio-core/src/examples/msg_passing/CMakeLists.txt27
-rw-r--r--gnuradio-core/src/examples/msg_passing/hier/test_msg_hier.grc287
-rw-r--r--gnuradio-core/src/examples/msg_passing/hier/test_msg_hier_topblock.grc185
-rw-r--r--gnuradio-core/src/examples/msg_passing/strobe.grc266
-rw-r--r--gnuradio-core/src/examples/network/CMakeLists.txt30
-rwxr-xr-xgnuradio-core/src/examples/network/audio_sink.py72
-rwxr-xr-xgnuradio-core/src/examples/network/audio_source.py69
-rwxr-xr-xgnuradio-core/src/examples/network/dial_tone_sink.py65
-rwxr-xr-xgnuradio-core/src/examples/network/dial_tone_source.py70
-rwxr-xr-xgnuradio-core/src/examples/network/vector_sink.py64
-rwxr-xr-xgnuradio-core/src/examples/network/vector_source.py60
-rw-r--r--gnuradio-core/src/examples/pfb/CMakeLists.txt41
-rwxr-xr-xgnuradio-core/src/examples/pfb/channelize.py191
-rwxr-xr-xgnuradio-core/src/examples/pfb/chirp_channelize.py203
-rwxr-xr-xgnuradio-core/src/examples/pfb/decimate.py178
-rwxr-xr-xgnuradio-core/src/examples/pfb/fmtest.py225
-rwxr-xr-xgnuradio-core/src/examples/pfb/interpolate.py233
-rwxr-xr-xgnuradio-core/src/examples/pfb/reconstruction.py131
-rwxr-xr-xgnuradio-core/src/examples/pfb/resampler.py127
-rw-r--r--gnuradio-core/src/examples/pfb/resampler_demo.grc598
-rwxr-xr-xgnuradio-core/src/examples/pfb/synth_filter.py83
-rwxr-xr-xgnuradio-core/src/examples/pfb/synth_to_chan.py117
-rw-r--r--gnuradio-core/src/examples/tags/CMakeLists.txt28
-rwxr-xr-xgnuradio-core/src/examples/tags/test_file_tags.py55
-rwxr-xr-xgnuradio-core/src/examples/tags/uhd_burst_detector.py116
-rw-r--r--gnuradio-core/src/examples/volk_benchmark/CMakeLists.txt35
-rw-r--r--gnuradio-core/src/examples/volk_benchmark/README252
-rwxr-xr-xgnuradio-core/src/examples/volk_benchmark/volk_math.py151
-rwxr-xr-xgnuradio-core/src/examples/volk_benchmark/volk_plot.py169
-rw-r--r--gnuradio-core/src/examples/volk_benchmark/volk_test_funcs.py171
-rwxr-xr-xgnuradio-core/src/examples/volk_benchmark/volk_types.py182
-rw-r--r--gnuradio-core/src/gen_interpolator_taps/Makefile.am.obsolete39
-rw-r--r--gnuradio-core/src/gen_interpolator_taps/README47
-rw-r--r--gnuradio-core/src/gen_interpolator_taps/gen_interpolator_taps.c186
-rw-r--r--gnuradio-core/src/gen_interpolator_taps/objective_fct.c124
-rw-r--r--gnuradio-core/src/gen_interpolator_taps/praxis.f1705
-rw-r--r--gnuradio-core/src/gen_interpolator_taps/praxis.txt176
-rw-r--r--gnuradio-core/src/gen_interpolator_taps/simpson.c76
-rw-r--r--gnuradio-core/src/gen_interpolator_taps/simpson.h3
-rw-r--r--gnuradio-core/src/lib/CMakeLists.txt106
-rw-r--r--gnuradio-core/src/lib/ConfigChecks.cmake212
-rw-r--r--gnuradio-core/src/lib/bug_work_around_6.cc3
-rw-r--r--gnuradio-core/src/lib/filter/3dnow_float_dotprod_really_simple.S99
-rw-r--r--gnuradio-core/src/lib/filter/3dnow_float_dotprod_simple.S106
-rw-r--r--gnuradio-core/src/lib/filter/CMakeLists.txt357
-rw-r--r--gnuradio-core/src/lib/filter/Makefile.gen124
-rw-r--r--gnuradio-core/src/lib/filter/README28
-rw-r--r--gnuradio-core/src/lib/filter/assembly.h67
-rw-r--r--gnuradio-core/src/lib/filter/ccomplex_dotprod_3dnow.S220
-rw-r--r--gnuradio-core/src/lib/filter/ccomplex_dotprod_3dnow64.S217
-rw-r--r--gnuradio-core/src/lib/filter/ccomplex_dotprod_3dnowext.S195
-rw-r--r--gnuradio-core/src/lib/filter/ccomplex_dotprod_3dnowext64.S192
-rw-r--r--gnuradio-core/src/lib/filter/ccomplex_dotprod_generic.cc58
-rw-r--r--gnuradio-core/src/lib/filter/ccomplex_dotprod_generic.h34
-rw-r--r--gnuradio-core/src/lib/filter/ccomplex_dotprod_sse.S198
-rw-r--r--gnuradio-core/src/lib/filter/ccomplex_dotprod_sse64.S195
-rw-r--r--gnuradio-core/src/lib/filter/ccomplex_dotprod_x86.h46
-rw-r--r--gnuradio-core/src/lib/filter/complex_dotprod_3dnow.S192
-rw-r--r--gnuradio-core/src/lib/filter/complex_dotprod_3dnow64.S187
-rw-r--r--gnuradio-core/src/lib/filter/complex_dotprod_3dnowext.S171
-rw-r--r--gnuradio-core/src/lib/filter/complex_dotprod_3dnowext64.S168
-rw-r--r--gnuradio-core/src/lib/filter/complex_dotprod_generic.cc54
-rw-r--r--gnuradio-core/src/lib/filter/complex_dotprod_generic.h34
-rw-r--r--gnuradio-core/src/lib/filter/complex_dotprod_sse.S206
-rw-r--r--gnuradio-core/src/lib/filter/complex_dotprod_sse64.S202
-rw-r--r--gnuradio-core/src/lib/filter/complex_dotprod_x86.h46
-rw-r--r--gnuradio-core/src/lib/filter/dotprod_ccf_armv7_a.c90
-rw-r--r--gnuradio-core/src/lib/filter/dotprod_ccf_armv7_a.h47
-rw-r--r--gnuradio-core/src/lib/filter/dotprod_fff_altivec.c162
-rw-r--r--gnuradio-core/src/lib/filter/dotprod_fff_altivec.h50
-rw-r--r--gnuradio-core/src/lib/filter/dotprod_fff_armv7_a.c87
-rw-r--r--gnuradio-core/src/lib/filter/dotprod_fff_armv7_a.h50
-rw-r--r--gnuradio-core/src/lib/filter/fcomplex_dotprod_3dnow.S176
-rw-r--r--gnuradio-core/src/lib/filter/fcomplex_dotprod_3dnow64.S170
-rw-r--r--gnuradio-core/src/lib/filter/fcomplex_dotprod_sse.S188
-rw-r--r--gnuradio-core/src/lib/filter/fcomplex_dotprod_sse64.S183
-rw-r--r--gnuradio-core/src/lib/filter/fcomplex_dotprod_x86.h42
-rw-r--r--gnuradio-core/src/lib/filter/filter.i70
-rw-r--r--gnuradio-core/src/lib/filter/float_dotprod_3dnow.S152
-rw-r--r--gnuradio-core/src/lib/filter/float_dotprod_3dnow64.S149
-rw-r--r--gnuradio-core/src/lib/filter/float_dotprod_generic.c49
-rw-r--r--gnuradio-core/src/lib/filter/float_dotprod_generic.h41
-rw-r--r--gnuradio-core/src/lib/filter/float_dotprod_sse.S171
-rw-r--r--gnuradio-core/src/lib/filter/float_dotprod_sse64.S165
-rw-r--r--gnuradio-core/src/lib/filter/float_dotprod_x86.h44
-rw-r--r--gnuradio-core/src/lib/filter/gcc_x86_cpuid.h178
-rwxr-xr-xgnuradio-core/src/lib/filter/generate_all.py48
-rwxr-xr-xgnuradio-core/src/lib/filter/generate_gr_fir_XXX.py75
-rwxr-xr-xgnuradio-core/src/lib/filter/generate_gr_fir_filter_XXX.py49
-rwxr-xr-xgnuradio-core/src/lib/filter/generate_gr_fir_sysconfig.py133
-rwxr-xr-xgnuradio-core/src/lib/filter/generate_gr_fir_sysconfig_generic.py186
-rwxr-xr-xgnuradio-core/src/lib/filter/generate_gr_fir_util.py190
-rwxr-xr-xgnuradio-core/src/lib/filter/generate_gr_freq_xlating_fir_filter_XXX.py53
-rw-r--r--gnuradio-core/src/lib/filter/generate_gr_interp_fir_filter_XXX.py48
-rw-r--r--gnuradio-core/src/lib/filter/generate_gr_rational_resampler_base_XXX.py48
-rwxr-xr-xgnuradio-core/src/lib/filter/generate_gri_fir_filter_with_buffer_XXX.py64
-rw-r--r--gnuradio-core/src/lib/filter/generate_utils.py31
-rw-r--r--gnuradio-core/src/lib/filter/gr_adaptive_fir_ccc.cc88
-rw-r--r--gnuradio-core/src/lib/filter/gr_adaptive_fir_ccc.h62
-rw-r--r--gnuradio-core/src/lib/filter/gr_adaptive_fir_ccc.i31
-rw-r--r--gnuradio-core/src/lib/filter/gr_adaptive_fir_ccf.cc81
-rw-r--r--gnuradio-core/src/lib/filter/gr_adaptive_fir_ccf.h59
-rw-r--r--gnuradio-core/src/lib/filter/gr_adaptive_fir_ccf.i30
-rw-r--r--gnuradio-core/src/lib/filter/gr_altivec.c38
-rw-r--r--gnuradio-core/src/lib/filter/gr_altivec.h76
-rw-r--r--gnuradio-core/src/lib/filter/gr_cpu.h42
-rw-r--r--gnuradio-core/src/lib/filter/gr_cpu_armv7_a.cc65
-rw-r--r--gnuradio-core/src/lib/filter/gr_cpu_powerpc.cc65
-rw-r--r--gnuradio-core/src/lib/filter/gr_cpu_x86.cc119
-rw-r--r--gnuradio-core/src/lib/filter/gr_dc_blocker_cc.cc138
-rw-r--r--gnuradio-core/src/lib/filter/gr_dc_blocker_cc.h111
-rw-r--r--gnuradio-core/src/lib/filter/gr_dc_blocker_cc.i34
-rw-r--r--gnuradio-core/src/lib/filter/gr_dc_blocker_ff.cc138
-rw-r--r--gnuradio-core/src/lib/filter/gr_dc_blocker_ff.h112
-rw-r--r--gnuradio-core/src/lib/filter/gr_dc_blocker_ff.i34
-rw-r--r--gnuradio-core/src/lib/filter/gr_fft_filter_ccc.cc132
-rw-r--r--gnuradio-core/src/lib/filter/gr_fft_filter_ccc.h90
-rw-r--r--gnuradio-core/src/lib/filter/gr_fft_filter_ccc.i46
-rw-r--r--gnuradio-core/src/lib/filter/gr_fft_filter_fff.cc123
-rw-r--r--gnuradio-core/src/lib/filter/gr_fft_filter_fff.h88
-rw-r--r--gnuradio-core/src/lib/filter/gr_fft_filter_fff.i45
-rw-r--r--gnuradio-core/src/lib/filter/gr_filter_delay_fc.cc80
-rw-r--r--gnuradio-core/src/lib/filter/gr_filter_delay_fc.h73
-rw-r--r--gnuradio-core/src/lib/filter/gr_filter_delay_fc.i34
-rw-r--r--gnuradio-core/src/lib/filter/gr_fir_XXX.cc.t30
-rw-r--r--gnuradio-core/src/lib/filter/gr_fir_XXX.h.t124
-rw-r--r--gnuradio-core/src/lib/filter/gr_fir_XXX_generic.cc.t103
-rw-r--r--gnuradio-core/src/lib/filter/gr_fir_XXX_generic.h.t78
-rw-r--r--gnuradio-core/src/lib/filter/gr_fir_ccc_simd.cc142
-rw-r--r--gnuradio-core/src/lib/filter/gr_fir_ccc_simd.h65
-rw-r--r--gnuradio-core/src/lib/filter/gr_fir_ccc_x86.cc77
-rw-r--r--gnuradio-core/src/lib/filter/gr_fir_ccc_x86.h56
-rw-r--r--gnuradio-core/src/lib/filter/gr_fir_ccf_armv7_a.cc91
-rw-r--r--gnuradio-core/src/lib/filter/gr_fir_ccf_armv7_a.h45
-rw-r--r--gnuradio-core/src/lib/filter/gr_fir_ccf_simd.cc141
-rw-r--r--gnuradio-core/src/lib/filter/gr_fir_ccf_simd.h66
-rw-r--r--gnuradio-core/src/lib/filter/gr_fir_ccf_x86.cc60
-rw-r--r--gnuradio-core/src/lib/filter/gr_fir_ccf_x86.h51
-rw-r--r--gnuradio-core/src/lib/filter/gr_fir_fcc_simd.cc139
-rw-r--r--gnuradio-core/src/lib/filter/gr_fir_fcc_simd.h66
-rw-r--r--gnuradio-core/src/lib/filter/gr_fir_fcc_x86.cc60
-rw-r--r--gnuradio-core/src/lib/filter/gr_fir_fcc_x86.h51
-rw-r--r--gnuradio-core/src/lib/filter/gr_fir_fff_altivec.cc84
-rw-r--r--gnuradio-core/src/lib/filter/gr_fir_fff_altivec.h46
-rw-r--r--gnuradio-core/src/lib/filter/gr_fir_fff_armv7_a.cc86
-rw-r--r--gnuradio-core/src/lib/filter/gr_fir_fff_armv7_a.h46
-rw-r--r--gnuradio-core/src/lib/filter/gr_fir_fff_simd.cc134
-rw-r--r--gnuradio-core/src/lib/filter/gr_fir_fff_simd.h64
-rw-r--r--gnuradio-core/src/lib/filter/gr_fir_fff_x86.cc60
-rw-r--r--gnuradio-core/src/lib/filter/gr_fir_fff_x86.h49
-rw-r--r--gnuradio-core/src/lib/filter/gr_fir_filter_XXX.cc.t94
-rw-r--r--gnuradio-core/src/lib/filter/gr_fir_filter_XXX.h.t69
-rw-r--r--gnuradio-core/src/lib/filter/gr_fir_filter_XXX.i.t42
-rw-r--r--gnuradio-core/src/lib/filter/gr_fir_fsf_simd.cc133
-rw-r--r--gnuradio-core/src/lib/filter/gr_fir_fsf_simd.h64
-rw-r--r--gnuradio-core/src/lib/filter/gr_fir_fsf_x86.cc60
-rw-r--r--gnuradio-core/src/lib/filter/gr_fir_fsf_x86.h51
-rw-r--r--gnuradio-core/src/lib/filter/gr_fir_scc_simd.cc140
-rw-r--r--gnuradio-core/src/lib/filter/gr_fir_scc_simd.h65
-rw-r--r--gnuradio-core/src/lib/filter/gr_fir_scc_x86.cc77
-rw-r--r--gnuradio-core/src/lib/filter/gr_fir_scc_x86.h59
-rw-r--r--gnuradio-core/src/lib/filter/gr_fir_sysconfig_armv7_a.cc337
-rw-r--r--gnuradio-core/src/lib/filter/gr_fir_sysconfig_armv7_a.h47
-rw-r--r--gnuradio-core/src/lib/filter/gr_fir_sysconfig_powerpc.cc340
-rw-r--r--gnuradio-core/src/lib/filter/gr_fir_sysconfig_powerpc.h47
-rw-r--r--gnuradio-core/src/lib/filter/gr_fir_sysconfig_x86.cc553
-rw-r--r--gnuradio-core/src/lib/filter/gr_fir_sysconfig_x86.h47
-rw-r--r--gnuradio-core/src/lib/filter/gr_fractional_interpolator_cc.cc93
-rw-r--r--gnuradio-core/src/lib/filter/gr_fractional_interpolator_cc.h68
-rw-r--r--gnuradio-core/src/lib/filter/gr_fractional_interpolator_cc.i37
-rw-r--r--gnuradio-core/src/lib/filter/gr_fractional_interpolator_ff.cc93
-rw-r--r--gnuradio-core/src/lib/filter/gr_fractional_interpolator_ff.h68
-rw-r--r--gnuradio-core/src/lib/filter/gr_fractional_interpolator_ff.i37
-rw-r--r--gnuradio-core/src/lib/filter/gr_freq_xlating_fir_filter_XXX.cc.t123
-rw-r--r--gnuradio-core/src/lib/filter/gr_freq_xlating_fir_filter_XXX.h.t101
-rw-r--r--gnuradio-core/src/lib/filter/gr_freq_xlating_fir_filter_XXX.i.t47
-rw-r--r--gnuradio-core/src/lib/filter/gr_goertzel_fc.cc76
-rw-r--r--gnuradio-core/src/lib/filter/gr_goertzel_fc.h61
-rw-r--r--gnuradio-core/src/lib/filter/gr_goertzel_fc.i35
-rw-r--r--gnuradio-core/src/lib/filter/gr_hilbert_fc.cc67
-rw-r--r--gnuradio-core/src/lib/filter/gr_hilbert_fc.h69
-rw-r--r--gnuradio-core/src/lib/filter/gr_hilbert_fc.i34
-rw-r--r--gnuradio-core/src/lib/filter/gr_iir_filter_ffd.cc82
-rw-r--r--gnuradio-core/src/lib/filter/gr_iir_filter_ffd.h99
-rw-r--r--gnuradio-core/src/lib/filter/gr_iir_filter_ffd.i40
-rw-r--r--gnuradio-core/src/lib/filter/gr_interp_fir_filter_XXX.cc.t146
-rw-r--r--gnuradio-core/src/lib/filter/gr_interp_fir_filter_XXX.h.t70
-rw-r--r--gnuradio-core/src/lib/filter/gr_interp_fir_filter_XXX.i.t41
-rw-r--r--gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.cc210
-rw-r--r--gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.h178
-rw-r--r--gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.i42
-rw-r--r--gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_fff.cc210
-rw-r--r--gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_fff.h178
-rw-r--r--gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_fff.i42
-rw-r--r--gnuradio-core/src/lib/filter/gr_pfb_channelizer_ccf.cc240
-rw-r--r--gnuradio-core/src/lib/filter/gr_pfb_channelizer_ccf.h226
-rw-r--r--gnuradio-core/src/lib/filter/gr_pfb_channelizer_ccf.i45
-rw-r--r--gnuradio-core/src/lib/filter/gr_pfb_clock_sync_ccf.cc441
-rw-r--r--gnuradio-core/src/lib/filter/gr_pfb_clock_sync_ccf.h375
-rw-r--r--gnuradio-core/src/lib/filter/gr_pfb_clock_sync_ccf.i67
-rw-r--r--gnuradio-core/src/lib/filter/gr_pfb_clock_sync_fff.cc288
-rw-r--r--gnuradio-core/src/lib/filter/gr_pfb_clock_sync_fff.h266
-rw-r--r--gnuradio-core/src/lib/filter/gr_pfb_clock_sync_fff.i54
-rw-r--r--gnuradio-core/src/lib/filter/gr_pfb_decimator_ccf.cc176
-rw-r--r--gnuradio-core/src/lib/filter/gr_pfb_decimator_ccf.h150
-rw-r--r--gnuradio-core/src/lib/filter/gr_pfb_decimator_ccf.i41
-rw-r--r--gnuradio-core/src/lib/filter/gr_pfb_interpolator_ccf.cc143
-rw-r--r--gnuradio-core/src/lib/filter/gr_pfb_interpolator_ccf.h131
-rw-r--r--gnuradio-core/src/lib/filter/gr_pfb_interpolator_ccf.i39
-rw-r--r--gnuradio-core/src/lib/filter/gr_pfb_synthesizer_ccf.cc287
-rw-r--r--gnuradio-core/src/lib/filter/gr_pfb_synthesizer_ccf.h147
-rw-r--r--gnuradio-core/src/lib/filter/gr_pfb_synthesizer_ccf.i44
-rw-r--r--gnuradio-core/src/lib/filter/gr_rational_resampler_base_XXX.cc.t172
-rw-r--r--gnuradio-core/src/lib/filter/gr_rational_resampler_base_XXX.h.t88
-rw-r--r--gnuradio-core/src/lib/filter/gr_rational_resampler_base_XXX.i.t42
-rw-r--r--gnuradio-core/src/lib/filter/gr_rotator.h54
-rw-r--r--gnuradio-core/src/lib/filter/gr_sincos.c83
-rw-r--r--gnuradio-core/src/lib/filter/gr_sincos.h41
-rw-r--r--gnuradio-core/src/lib/filter/gr_single_pole_iir.h191
-rw-r--r--gnuradio-core/src/lib/filter/gr_single_pole_iir_filter_cc.cc81
-rw-r--r--gnuradio-core/src/lib/filter/gr_single_pole_iir_filter_cc.h88
-rw-r--r--gnuradio-core/src/lib/filter/gr_single_pole_iir_filter_cc.i34
-rw-r--r--gnuradio-core/src/lib/filter/gr_single_pole_iir_filter_ff.cc81
-rw-r--r--gnuradio-core/src/lib/filter/gr_single_pole_iir_filter_ff.h87
-rw-r--r--gnuradio-core/src/lib/filter/gr_single_pole_iir_filter_ff.i34
-rw-r--r--gnuradio-core/src/lib/filter/gr_vec_types.h54
-rw-r--r--gnuradio-core/src/lib/filter/gri_fft_filter_ccc_generic.cc184
-rw-r--r--gnuradio-core/src/lib/filter/gri_fft_filter_ccc_generic.h96
-rw-r--r--gnuradio-core/src/lib/filter/gri_fft_filter_ccc_sse.cc186
-rw-r--r--gnuradio-core/src/lib/filter/gri_fft_filter_ccc_sse.h83
-rw-r--r--gnuradio-core/src/lib/filter/gri_fft_filter_fff_generic.cc175
-rw-r--r--gnuradio-core/src/lib/filter/gri_fft_filter_fff_generic.h94
-rw-r--r--gnuradio-core/src/lib/filter/gri_fft_filter_fff_sse.cc184
-rw-r--r--gnuradio-core/src/lib/filter/gri_fft_filter_fff_sse.h82
-rw-r--r--gnuradio-core/src/lib/filter/gri_fir_filter_with_buffer_XXX.cc.t121
-rw-r--r--gnuradio-core/src/lib/filter/gri_fir_filter_with_buffer_XXX.h.t132
-rw-r--r--gnuradio-core/src/lib/filter/gri_goertzel.cc75
-rw-r--r--gnuradio-core/src/lib/filter/gri_goertzel.h57
-rw-r--r--gnuradio-core/src/lib/filter/gri_iir.h177
-rw-r--r--gnuradio-core/src/lib/filter/gri_mmse_fir_interpolator.cc71
-rw-r--r--gnuradio-core/src/lib/filter/gri_mmse_fir_interpolator.h71
-rw-r--r--gnuradio-core/src/lib/filter/gri_mmse_fir_interpolator_cc.cc71
-rw-r--r--gnuradio-core/src/lib/filter/gri_mmse_fir_interpolator_cc.h74
-rw-r--r--gnuradio-core/src/lib/filter/interpolator_taps.h141
-rw-r--r--gnuradio-core/src/lib/filter/qa_ccomplex_dotprod_x86.cc341
-rw-r--r--gnuradio-core/src/lib/filter/qa_ccomplex_dotprod_x86.h74
-rw-r--r--gnuradio-core/src/lib/filter/qa_complex_dotprod_x86.cc347
-rw-r--r--gnuradio-core/src/lib/filter/qa_complex_dotprod_x86.h74
-rw-r--r--gnuradio-core/src/lib/filter/qa_dotprod.h30
-rw-r--r--gnuradio-core/src/lib/filter/qa_dotprod_armv7_a.cc32
-rw-r--r--gnuradio-core/src/lib/filter/qa_dotprod_generic.cc32
-rw-r--r--gnuradio-core/src/lib/filter/qa_dotprod_powerpc.cc32
-rw-r--r--gnuradio-core/src/lib/filter/qa_dotprod_x86.cc37
-rw-r--r--gnuradio-core/src/lib/filter/qa_filter.cc68
-rw-r--r--gnuradio-core/src/lib/filter/qa_filter.h38
-rw-r--r--gnuradio-core/src/lib/filter/qa_float_dotprod_x86.cc270
-rw-r--r--gnuradio-core/src/lib/filter/qa_float_dotprod_x86.h69
-rw-r--r--gnuradio-core/src/lib/filter/qa_gr_fir_ccc.cc184
-rw-r--r--gnuradio-core/src/lib/filter/qa_gr_fir_ccc.h40
-rw-r--r--gnuradio-core/src/lib/filter/qa_gr_fir_ccf.cc184
-rw-r--r--gnuradio-core/src/lib/filter/qa_gr_fir_ccf.h43
-rw-r--r--gnuradio-core/src/lib/filter/qa_gr_fir_fcc.cc181
-rw-r--r--gnuradio-core/src/lib/filter/qa_gr_fir_fcc.h40
-rw-r--r--gnuradio-core/src/lib/filter/qa_gr_fir_fff.cc226
-rw-r--r--gnuradio-core/src/lib/filter/qa_gr_fir_fff.h43
-rw-r--r--gnuradio-core/src/lib/filter/qa_gr_fir_scc.cc179
-rw-r--r--gnuradio-core/src/lib/filter/qa_gr_fir_scc.h40
-rw-r--r--gnuradio-core/src/lib/filter/qa_gr_rotator.cc75
-rw-r--r--gnuradio-core/src/lib/filter/qa_gr_rotator.h39
-rw-r--r--gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccc.cc161
-rw-r--r--gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccc.h46
-rw-r--r--gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccf.cc167
-rw-r--r--gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccf.h46
-rw-r--r--gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fcc.cc168
-rw-r--r--gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fcc.h46
-rw-r--r--gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fff.cc156
-rw-r--r--gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fff.h46
-rw-r--r--gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fsf.cc147
-rw-r--r--gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fsf.h46
-rw-r--r--gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_scc.cc167
-rw-r--r--gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_scc.h46
-rw-r--r--gnuradio-core/src/lib/filter/qa_gri_mmse_fir_interpolator.cc66
-rw-r--r--gnuradio-core/src/lib/filter/qa_gri_mmse_fir_interpolator.h40
-rw-r--r--gnuradio-core/src/lib/filter/qa_gri_mmse_fir_interpolator_cc.cc124
-rw-r--r--gnuradio-core/src/lib/filter/qa_gri_mmse_fir_interpolator_cc.h42
-rw-r--r--gnuradio-core/src/lib/filter/short_dotprod_generic.c49
-rw-r--r--gnuradio-core/src/lib/filter/short_dotprod_generic.h41
-rw-r--r--gnuradio-core/src/lib/filter/short_dotprod_mmx.S117
-rw-r--r--gnuradio-core/src/lib/filter/short_dotprod_mmx64.S105
-rw-r--r--gnuradio-core/src/lib/filter/short_dotprod_x86.h44
-rw-r--r--gnuradio-core/src/lib/filter/sse_debug.c62
-rw-r--r--gnuradio-core/src/lib/filter/sse_debug.h48
-rw-r--r--gnuradio-core/src/lib/filter/sysconfig_armv7_a.cc39
-rw-r--r--gnuradio-core/src/lib/filter/sysconfig_generic.cc35
-rw-r--r--gnuradio-core/src/lib/filter/sysconfig_powerpc.cc38
-rw-r--r--gnuradio-core/src/lib/filter/sysconfig_x86.cc38
-rw-r--r--gnuradio-core/src/lib/general/CMakeLists.txt312
-rw-r--r--gnuradio-core/src/lib/general/README98
-rw-r--r--gnuradio-core/src/lib/general/atsc_rrc1x.dat57
-rw-r--r--gnuradio-core/src/lib/general/atsc_rrc20.dat101
-rw-r--r--gnuradio-core/src/lib/general/atsc_rrc2x.dat102
-rw-r--r--gnuradio-core/src/lib/general/complex_vec_test.cc82
-rw-r--r--gnuradio-core/src/lib/general/complex_vec_test.h28
-rw-r--r--gnuradio-core/src/lib/general/complex_vec_test.i25
-rwxr-xr-xgnuradio-core/src/lib/general/gen_sine_table.py77
-rw-r--r--gnuradio-core/src/lib/general/general.i273
-rw-r--r--gnuradio-core/src/lib/general/general_generated.i166
-rw-r--r--gnuradio-core/src/lib/general/gr_add_ff.cc66
-rw-r--r--gnuradio-core/src/lib/general/gr_add_ff.h56
-rw-r--r--gnuradio-core/src/lib/general/gr_add_ff.i32
-rw-r--r--gnuradio-core/src/lib/general/gr_additive_scrambler_bb.cc65
-rw-r--r--gnuradio-core/src/lib/general/gr_additive_scrambler_bb.h68
-rw-r--r--gnuradio-core/src/lib/general/gr_additive_scrambler_bb.i31
-rw-r--r--gnuradio-core/src/lib/general/gr_agc2_cc.cc56
-rw-r--r--gnuradio-core/src/lib/general/gr_agc2_cc.h56
-rw-r--r--gnuradio-core/src/lib/general/gr_agc2_cc.i35
-rw-r--r--gnuradio-core/src/lib/general/gr_agc2_ff.cc57
-rw-r--r--gnuradio-core/src/lib/general/gr_agc2_ff.h54
-rw-r--r--gnuradio-core/src/lib/general/gr_agc2_ff.i35
-rw-r--r--gnuradio-core/src/lib/general/gr_agc_cc.cc56
-rw-r--r--gnuradio-core/src/lib/general/gr_agc_cc.h55
-rw-r--r--gnuradio-core/src/lib/general/gr_agc_cc.i35
-rw-r--r--gnuradio-core/src/lib/general/gr_agc_ff.cc54
-rw-r--r--gnuradio-core/src/lib/general/gr_agc_ff.h55
-rw-r--r--gnuradio-core/src/lib/general/gr_agc_ff.i34
-rw-r--r--gnuradio-core/src/lib/general/gr_align_on_samplenumbers_ss.cc464
-rw-r--r--gnuradio-core/src/lib/general/gr_align_on_samplenumbers_ss.h92
-rw-r--r--gnuradio-core/src/lib/general/gr_align_on_samplenumbers_ss.i34
-rw-r--r--gnuradio-core/src/lib/general/gr_annotator_1to1.cc107
-rw-r--r--gnuradio-core/src/lib/general/gr_annotator_1to1.h75
-rw-r--r--gnuradio-core/src/lib/general/gr_annotator_1to1.i25
-rw-r--r--gnuradio-core/src/lib/general/gr_annotator_alltoall.cc110
-rw-r--r--gnuradio-core/src/lib/general/gr_annotator_alltoall.h76
-rw-r--r--gnuradio-core/src/lib/general/gr_annotator_alltoall.i25
-rw-r--r--gnuradio-core/src/lib/general/gr_annotator_raw.cc106
-rw-r--r--gnuradio-core/src/lib/general/gr_annotator_raw.h69
-rw-r--r--gnuradio-core/src/lib/general/gr_annotator_raw.i26
-rw-r--r--gnuradio-core/src/lib/general/gr_bin_statistics_f.cc174
-rw-r--r--gnuradio-core/src/lib/general/gr_bin_statistics_f.h100
-rw-r--r--gnuradio-core/src/lib/general/gr_bin_statistics_f.i47
-rw-r--r--gnuradio-core/src/lib/general/gr_block_gateway.cc184
-rw-r--r--gnuradio-core/src/lib/general/gr_block_gateway.h264
-rw-r--r--gnuradio-core/src/lib/general/gr_block_gateway.i46
-rw-r--r--gnuradio-core/src/lib/general/gr_burst_tagger.cc109
-rw-r--r--gnuradio-core/src/lib/general/gr_burst_tagger.h64
-rw-r--r--gnuradio-core/src/lib/general/gr_burst_tagger.i35
-rw-r--r--gnuradio-core/src/lib/general/gr_bytes_to_syms.cc74
-rw-r--r--gnuradio-core/src/lib/general/gr_bytes_to_syms.h61
-rw-r--r--gnuradio-core/src/lib/general/gr_bytes_to_syms.i30
-rw-r--r--gnuradio-core/src/lib/general/gr_char_to_float.cc72
-rw-r--r--gnuradio-core/src/lib/general/gr_char_to_float.h70
-rw-r--r--gnuradio-core/src/lib/general/gr_char_to_float.i33
-rw-r--r--gnuradio-core/src/lib/general/gr_char_to_short.cc64
-rw-r--r--gnuradio-core/src/lib/general/gr_char_to_short.h58
-rw-r--r--gnuradio-core/src/lib/general/gr_char_to_short.i30
-rw-r--r--gnuradio-core/src/lib/general/gr_check_counting_s.cc190
-rw-r--r--gnuradio-core/src/lib/general/gr_check_counting_s.h89
-rw-r--r--gnuradio-core/src/lib/general/gr_check_counting_s.i31
-rw-r--r--gnuradio-core/src/lib/general/gr_check_lfsr_32k_s.cc169
-rw-r--r--gnuradio-core/src/lib/general/gr_check_lfsr_32k_s.h103
-rw-r--r--gnuradio-core/src/lib/general/gr_check_lfsr_32k_s.i36
-rw-r--r--gnuradio-core/src/lib/general/gr_circular_file.cc203
-rw-r--r--gnuradio-core/src/lib/general/gr_circular_file.h60
-rw-r--r--gnuradio-core/src/lib/general/gr_complex_to_interleaved_short.cc62
-rw-r--r--gnuradio-core/src/lib/general/gr_complex_to_interleaved_short.h52
-rw-r--r--gnuradio-core/src/lib/general/gr_complex_to_interleaved_short.i30
-rw-r--r--gnuradio-core/src/lib/general/gr_complex_to_xxx.cc280
-rw-r--r--gnuradio-core/src/lib/general/gr_complex_to_xxx.h160
-rw-r--r--gnuradio-core/src/lib/general/gr_complex_to_xxx.i64
-rw-r--r--gnuradio-core/src/lib/general/gr_conjugate_cc.cc65
-rw-r--r--gnuradio-core/src/lib/general/gr_conjugate_cc.h52
-rw-r--r--gnuradio-core/src/lib/general/gr_conjugate_cc.i33
-rw-r--r--gnuradio-core/src/lib/general/gr_constants.cc.in57
-rw-r--r--gnuradio-core/src/lib/general/gr_constants.h53
-rw-r--r--gnuradio-core/src/lib/general/gr_constants.i13
-rw-r--r--gnuradio-core/src/lib/general/gr_copy.cc71
-rw-r--r--gnuradio-core/src/lib/general/gr_copy.h63
-rw-r--r--gnuradio-core/src/lib/general/gr_copy.i36
-rw-r--r--gnuradio-core/src/lib/general/gr_core_api.h33
-rw-r--r--gnuradio-core/src/lib/general/gr_correlate_access_code_tag_bb.cc129
-rw-r--r--gnuradio-core/src/lib/general/gr_correlate_access_code_tag_bb.h87
-rw-r--r--gnuradio-core/src/lib/general/gr_correlate_access_code_tag_bb.i60
-rw-r--r--gnuradio-core/src/lib/general/gr_count_bits.cc93
-rw-r--r--gnuradio-core/src/lib/general/gr_count_bits.h33
-rw-r--r--gnuradio-core/src/lib/general/gr_cpfsk_bc.cc78
-rw-r--r--gnuradio-core/src/lib/general/gr_cpfsk_bc.h64
-rw-r--r--gnuradio-core/src/lib/general/gr_cpfsk_bc.i34
-rw-r--r--gnuradio-core/src/lib/general/gr_cpm.cc218
-rw-r--r--gnuradio-core/src/lib/general/gr_cpm.h81
-rw-r--r--gnuradio-core/src/lib/general/gr_cpm.i40
-rw-r--r--gnuradio-core/src/lib/general/gr_ctcss_squelch_ff.cc112
-rw-r--r--gnuradio-core/src/lib/general/gr_ctcss_squelch_ff.h68
-rw-r--r--gnuradio-core/src/lib/general/gr_ctcss_squelch_ff.i39
-rw-r--r--gnuradio-core/src/lib/general/gr_decode_ccsds_27_fb.cc86
-rw-r--r--gnuradio-core/src/lib/general/gr_decode_ccsds_27_fb.h78
-rw-r--r--gnuradio-core/src/lib/general/gr_decode_ccsds_27_fb.i31
-rw-r--r--gnuradio-core/src/lib/general/gr_deinterleave.cc78
-rw-r--r--gnuradio-core/src/lib/general/gr_deinterleave.h57
-rw-r--r--gnuradio-core/src/lib/general/gr_deinterleave.i30
-rw-r--r--gnuradio-core/src/lib/general/gr_delay.cc129
-rw-r--r--gnuradio-core/src/lib/general/gr_delay.h61
-rw-r--r--gnuradio-core/src/lib/general/gr_delay.i35
-rw-r--r--gnuradio-core/src/lib/general/gr_descrambler_bb.cc56
-rw-r--r--gnuradio-core/src/lib/general/gr_descrambler_bb.h60
-rw-r--r--gnuradio-core/src/lib/general/gr_descrambler_bb.i31
-rw-r--r--gnuradio-core/src/lib/general/gr_diff_decoder_bb.cc61
-rw-r--r--gnuradio-core/src/lib/general/gr_diff_decoder_bb.h53
-rw-r--r--gnuradio-core/src/lib/general/gr_diff_decoder_bb.i31
-rw-r--r--gnuradio-core/src/lib/general/gr_diff_encoder_bb.cc62
-rw-r--r--gnuradio-core/src/lib/general/gr_diff_encoder_bb.h54
-rw-r--r--gnuradio-core/src/lib/general/gr_diff_encoder_bb.i31
-rw-r--r--gnuradio-core/src/lib/general/gr_diff_phasor_cc.cc61
-rw-r--r--gnuradio-core/src/lib/general/gr_diff_phasor_cc.h53
-rw-r--r--gnuradio-core/src/lib/general/gr_diff_phasor_cc.i34
-rw-r--r--gnuradio-core/src/lib/general/gr_dpll_bb.cc84
-rw-r--r--gnuradio-core/src/lib/general/gr_dpll_bb.h58
-rw-r--r--gnuradio-core/src/lib/general/gr_dpll_bb.i31
-rw-r--r--gnuradio-core/src/lib/general/gr_encode_ccsds_27_bb.cc62
-rw-r--r--gnuradio-core/src/lib/general/gr_encode_ccsds_27_bb.h64
-rw-r--r--gnuradio-core/src/lib/general/gr_encode_ccsds_27_bb.i31
-rw-r--r--gnuradio-core/src/lib/general/gr_endian_swap.cc101
-rw-r--r--gnuradio-core/src/lib/general/gr_endian_swap.h57
-rw-r--r--gnuradio-core/src/lib/general/gr_endian_swap.i31
-rw-r--r--gnuradio-core/src/lib/general/gr_expj.h38
-rw-r--r--gnuradio-core/src/lib/general/gr_fake_channel_coder_pp.cc113
-rw-r--r--gnuradio-core/src/lib/general/gr_fake_channel_coder_pp.h91
-rw-r--r--gnuradio-core/src/lib/general/gr_fake_channel_coder_pp.i53
-rw-r--r--gnuradio-core/src/lib/general/gr_fast_atan2f.cc199
-rw-r--r--gnuradio-core/src/lib/general/gr_feedforward_agc_cc.cc91
-rw-r--r--gnuradio-core/src/lib/general/gr_feedforward_agc_cc.h57
-rw-r--r--gnuradio-core/src/lib/general/gr_feedforward_agc_cc.i34
-rw-r--r--gnuradio-core/src/lib/general/gr_feval.cc132
-rw-r--r--gnuradio-core/src/lib/general/gr_feval.h177
-rw-r--r--gnuradio-core/src/lib/general/gr_feval.i233
-rw-r--r--gnuradio-core/src/lib/general/gr_fft_vcc.cc80
-rw-r--r--gnuradio-core/src/lib/general/gr_fft_vcc.h68
-rw-r--r--gnuradio-core/src/lib/general/gr_fft_vcc.i41
-rw-r--r--gnuradio-core/src/lib/general/gr_fft_vcc_fftw.cc130
-rw-r--r--gnuradio-core/src/lib/general/gr_fft_vcc_fftw.h67
-rw-r--r--gnuradio-core/src/lib/general/gr_fft_vfc.cc135
-rw-r--r--gnuradio-core/src/lib/general/gr_fft_vfc.h72
-rw-r--r--gnuradio-core/src/lib/general/gr_fft_vfc.i42
-rw-r--r--gnuradio-core/src/lib/general/gr_firdes.cc840
-rw-r--r--gnuradio-core/src/lib/general/gr_firdes.h373
-rw-r--r--gnuradio-core/src/lib/general/gr_firdes.i360
-rw-r--r--gnuradio-core/src/lib/general/gr_float_to_char.cc79
-rw-r--r--gnuradio-core/src/lib/general/gr_float_to_char.h70
-rw-r--r--gnuradio-core/src/lib/general/gr_float_to_char.i33
-rw-r--r--gnuradio-core/src/lib/general/gr_float_to_complex.cc72
-rw-r--r--gnuradio-core/src/lib/general/gr_float_to_complex.h55
-rw-r--r--gnuradio-core/src/lib/general/gr_float_to_complex.i30
-rw-r--r--gnuradio-core/src/lib/general/gr_float_to_int.cc89
-rw-r--r--gnuradio-core/src/lib/general/gr_float_to_int.h70
-rw-r--r--gnuradio-core/src/lib/general/gr_float_to_int.i33
-rw-r--r--gnuradio-core/src/lib/general/gr_float_to_short.cc79
-rw-r--r--gnuradio-core/src/lib/general/gr_float_to_short.h69
-rw-r--r--gnuradio-core/src/lib/general/gr_float_to_short.i33
-rw-r--r--gnuradio-core/src/lib/general/gr_float_to_uchar.cc58
-rw-r--r--gnuradio-core/src/lib/general/gr_float_to_uchar.h52
-rw-r--r--gnuradio-core/src/lib/general/gr_float_to_uchar.i30
-rw-r--r--gnuradio-core/src/lib/general/gr_fmdet_cf.cc105
-rw-r--r--gnuradio-core/src/lib/general/gr_fmdet_cf.h63
-rw-r--r--gnuradio-core/src/lib/general/gr_fmdet_cf.i31
-rw-r--r--gnuradio-core/src/lib/general/gr_framer_sink_1.cc190
-rw-r--r--gnuradio-core/src/lib/general/gr_framer_sink_1.h107
-rw-r--r--gnuradio-core/src/lib/general/gr_framer_sink_1.i35
-rw-r--r--gnuradio-core/src/lib/general/gr_frequency_modulator_fc.cc71
-rw-r--r--gnuradio-core/src/lib/general/gr_frequency_modulator_fc.h59
-rw-r--r--gnuradio-core/src/lib/general/gr_frequency_modulator_fc.i34
-rw-r--r--gnuradio-core/src/lib/general/gr_fxpt.cc35
-rw-r--r--gnuradio-core/src/lib/general/gr_fxpt.h104
-rw-r--r--gnuradio-core/src/lib/general/gr_fxpt_nco.h153
-rw-r--r--gnuradio-core/src/lib/general/gr_fxpt_vco.h73
-rw-r--r--gnuradio-core/src/lib/general/gr_glfsr_source_b.cc84
-rw-r--r--gnuradio-core/src/lib/general/gr_glfsr_source_b.h66
-rw-r--r--gnuradio-core/src/lib/general/gr_glfsr_source_b.i37
-rw-r--r--gnuradio-core/src/lib/general/gr_glfsr_source_f.cc84
-rw-r--r--gnuradio-core/src/lib/general/gr_glfsr_source_f.h66
-rw-r--r--gnuradio-core/src/lib/general/gr_glfsr_source_f.i37
-rw-r--r--gnuradio-core/src/lib/general/gr_head.cc61
-rw-r--r--gnuradio-core/src/lib/general/gr_head.h61
-rw-r--r--gnuradio-core/src/lib/general/gr_head.i33
-rw-r--r--gnuradio-core/src/lib/general/gr_int_to_float.cc67
-rw-r--r--gnuradio-core/src/lib/general/gr_int_to_float.h70
-rw-r--r--gnuradio-core/src/lib/general/gr_int_to_float.i32
-rw-r--r--gnuradio-core/src/lib/general/gr_interleave.cc77
-rw-r--r--gnuradio-core/src/lib/general/gr_interleave.h57
-rw-r--r--gnuradio-core/src/lib/general/gr_interleave.i30
-rw-r--r--gnuradio-core/src/lib/general/gr_interleaved_short_to_complex.cc59
-rw-r--r--gnuradio-core/src/lib/general/gr_interleaved_short_to_complex.h52
-rw-r--r--gnuradio-core/src/lib/general/gr_interleaved_short_to_complex.i30
-rw-r--r--gnuradio-core/src/lib/general/gr_iqcomp_cc.cc62
-rw-r--r--gnuradio-core/src/lib/general/gr_iqcomp_cc.h55
-rw-r--r--gnuradio-core/src/lib/general/gr_iqcomp_cc.i36
-rw-r--r--gnuradio-core/src/lib/general/gr_keep_m_in_n.cc98
-rw-r--r--gnuradio-core/src/lib/general/gr_keep_m_in_n.h67
-rw-r--r--gnuradio-core/src/lib/general/gr_keep_m_in_n.i35
-rw-r--r--gnuradio-core/src/lib/general/gr_keep_one_in_n.cc105
-rw-r--r--gnuradio-core/src/lib/general/gr_keep_one_in_n.h62
-rw-r--r--gnuradio-core/src/lib/general/gr_keep_one_in_n.i35
-rw-r--r--gnuradio-core/src/lib/general/gr_kludge_copy.cc64
-rw-r--r--gnuradio-core/src/lib/general/gr_kludge_copy.h56
-rw-r--r--gnuradio-core/src/lib/general/gr_kludge_copy.i31
-rw-r--r--gnuradio-core/src/lib/general/gr_lfsr_32k_source_s.cc70
-rw-r--r--gnuradio-core/src/lib/general/gr_lfsr_32k_source_s.h61
-rw-r--r--gnuradio-core/src/lib/general/gr_lfsr_32k_source_s.i31
-rw-r--r--gnuradio-core/src/lib/general/gr_log2_const.h47
-rw-r--r--gnuradio-core/src/lib/general/gr_map_bb.cc61
-rw-r--r--gnuradio-core/src/lib/general/gr_map_bb.h52
-rw-r--r--gnuradio-core/src/lib/general/gr_map_bb.i32
-rw-r--r--gnuradio-core/src/lib/general/gr_math.h209
-rw-r--r--gnuradio-core/src/lib/general/gr_message_strobe.cc75
-rw-r--r--gnuradio-core/src/lib/general/gr_message_strobe.h62
-rw-r--r--gnuradio-core/src/lib/general/gr_message_strobe.i30
-rw-r--r--gnuradio-core/src/lib/general/gr_misc.cc65
-rw-r--r--gnuradio-core/src/lib/general/gr_misc.h39
-rw-r--r--gnuradio-core/src/lib/general/gr_multiply_cc.cc69
-rw-r--r--gnuradio-core/src/lib/general/gr_multiply_cc.h56
-rw-r--r--gnuradio-core/src/lib/general/gr_multiply_cc.i32
-rw-r--r--gnuradio-core/src/lib/general/gr_multiply_conjugate_cc.cc69
-rw-r--r--gnuradio-core/src/lib/general/gr_multiply_conjugate_cc.h57
-rw-r--r--gnuradio-core/src/lib/general/gr_multiply_conjugate_cc.i32
-rw-r--r--gnuradio-core/src/lib/general/gr_multiply_const_cc.cc80
-rw-r--r--gnuradio-core/src/lib/general/gr_multiply_const_cc.h60
-rw-r--r--gnuradio-core/src/lib/general/gr_multiply_const_cc.i33
-rw-r--r--gnuradio-core/src/lib/general/gr_multiply_const_ff.cc80
-rw-r--r--gnuradio-core/src/lib/general/gr_multiply_const_ff.h60
-rw-r--r--gnuradio-core/src/lib/general/gr_multiply_const_ff.i33
-rw-r--r--gnuradio-core/src/lib/general/gr_multiply_ff.cc69
-rw-r--r--gnuradio-core/src/lib/general/gr_multiply_ff.h56
-rw-r--r--gnuradio-core/src/lib/general/gr_multiply_ff.i32
-rw-r--r--gnuradio-core/src/lib/general/gr_nco.h198
-rw-r--r--gnuradio-core/src/lib/general/gr_nlog10_ff.cc64
-rw-r--r--gnuradio-core/src/lib/general/gr_nlog10_ff.h56
-rw-r--r--gnuradio-core/src/lib/general/gr_nlog10_ff.i33
-rw-r--r--gnuradio-core/src/lib/general/gr_nop.cc66
-rw-r--r--gnuradio-core/src/lib/general/gr_nop.h61
-rw-r--r--gnuradio-core/src/lib/general/gr_nop.i31
-rw-r--r--gnuradio-core/src/lib/general/gr_null_sink.cc49
-rw-r--r--gnuradio-core/src/lib/general/gr_null_sink.h53
-rw-r--r--gnuradio-core/src/lib/general/gr_null_sink.i31
-rw-r--r--gnuradio-core/src/lib/general/gr_null_source.cc52
-rw-r--r--gnuradio-core/src/lib/general/gr_null_source.h52
-rw-r--r--gnuradio-core/src/lib/general/gr_null_source.i31
-rw-r--r--gnuradio-core/src/lib/general/gr_ofdm_bpsk_demapper.cc97
-rw-r--r--gnuradio-core/src/lib/general/gr_ofdm_bpsk_demapper.h69
-rw-r--r--gnuradio-core/src/lib/general/gr_ofdm_bpsk_demapper.i40
-rw-r--r--gnuradio-core/src/lib/general/gr_ofdm_frame_sink2.cc374
-rw-r--r--gnuradio-core/src/lib/general/gr_ofdm_frame_sink2.h121
-rw-r--r--gnuradio-core/src/lib/general/gr_ofdm_frame_sink2.i39
-rw-r--r--gnuradio-core/src/lib/general/gr_pa_2x2_phase_combiner.cc74
-rw-r--r--gnuradio-core/src/lib/general/gr_pa_2x2_phase_combiner.h63
-rw-r--r--gnuradio-core/src/lib/general/gr_pa_2x2_phase_combiner.i34
-rw-r--r--gnuradio-core/src/lib/general/gr_pack_k_bits_bb.cc69
-rw-r--r--gnuradio-core/src/lib/general/gr_pack_k_bits_bb.h56
-rw-r--r--gnuradio-core/src/lib/general/gr_pack_k_bits_bb.i34
-rw-r--r--gnuradio-core/src/lib/general/gr_packet_sink.cc207
-rw-r--r--gnuradio-core/src/lib/general/gr_packet_sink.h112
-rw-r--r--gnuradio-core/src/lib/general/gr_packet_sink.i41
-rw-r--r--gnuradio-core/src/lib/general/gr_peak_detector2_fb.cc107
-rw-r--r--gnuradio-core/src/lib/general/gr_peak_detector2_fb.h109
-rw-r--r--gnuradio-core/src/lib/general/gr_peak_detector2_fb.i45
-rw-r--r--gnuradio-core/src/lib/general/gr_phase_modulator_fc.cc62
-rw-r--r--gnuradio-core/src/lib/general/gr_phase_modulator_fc.h56
-rw-r--r--gnuradio-core/src/lib/general/gr_phase_modulator_fc.i31
-rw-r--r--gnuradio-core/src/lib/general/gr_pll_carriertracking_cc.cc120
-rw-r--r--gnuradio-core/src/lib/general/gr_pll_carriertracking_cc.h74
-rw-r--r--gnuradio-core/src/lib/general/gr_pll_carriertracking_cc.i39
-rw-r--r--gnuradio-core/src/lib/general/gr_pll_freqdet_cf.cc90
-rw-r--r--gnuradio-core/src/lib/general/gr_pll_freqdet_cf.h67
-rw-r--r--gnuradio-core/src/lib/general/gr_pll_freqdet_cf.i33
-rw-r--r--gnuradio-core/src/lib/general/gr_pll_refout_cc.cc93
-rw-r--r--gnuradio-core/src/lib/general/gr_pll_refout_cc.h65
-rw-r--r--gnuradio-core/src/lib/general/gr_pll_refout_cc.i32
-rw-r--r--gnuradio-core/src/lib/general/gr_pn_correlator_cc.cc77
-rw-r--r--gnuradio-core/src/lib/general/gr_pn_correlator_cc.h62
-rw-r--r--gnuradio-core/src/lib/general/gr_pn_correlator_cc.i32
-rw-r--r--gnuradio-core/src/lib/general/gr_prefs.cc229
-rw-r--r--gnuradio-core/src/lib/general/gr_prefs.h94
-rw-r--r--gnuradio-core/src/lib/general/gr_prefs.i69
-rw-r--r--gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_c.cc84
-rw-r--r--gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_c.h75
-rw-r--r--gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_c.i36
-rw-r--r--gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_cf.cc86
-rw-r--r--gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_cf.h77
-rw-r--r--gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_cf.i36
-rw-r--r--gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_f.cc84
-rw-r--r--gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_f.h75
-rw-r--r--gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_f.i36
-rw-r--r--gnuradio-core/src/lib/general/gr_probe_density_b.cc68
-rw-r--r--gnuradio-core/src/lib/general/gr_probe_density_b.h73
-rw-r--r--gnuradio-core/src/lib/general/gr_probe_density_b.i36
-rw-r--r--gnuradio-core/src/lib/general/gr_pwr_squelch_cc.cc55
-rw-r--r--gnuradio-core/src/lib/general/gr_pwr_squelch_cc.h63
-rw-r--r--gnuradio-core/src/lib/general/gr_pwr_squelch_cc.i42
-rw-r--r--gnuradio-core/src/lib/general/gr_pwr_squelch_ff.cc55
-rw-r--r--gnuradio-core/src/lib/general/gr_pwr_squelch_ff.h63
-rw-r--r--gnuradio-core/src/lib/general/gr_pwr_squelch_ff.i42
-rw-r--r--gnuradio-core/src/lib/general/gr_quadrature_demod_cf.cc62
-rw-r--r--gnuradio-core/src/lib/general/gr_quadrature_demod_cf.h56
-rw-r--r--gnuradio-core/src/lib/general/gr_quadrature_demod_cf.i34
-rw-r--r--gnuradio-core/src/lib/general/gr_rail_ff.cc62
-rw-r--r--gnuradio-core/src/lib/general/gr_rail_ff.h57
-rw-r--r--gnuradio-core/src/lib/general/gr_rail_ff.i30
-rw-r--r--gnuradio-core/src/lib/general/gr_random.cc183
-rw-r--r--gnuradio-core/src/lib/general/gr_random.h65
-rw-r--r--gnuradio-core/src/lib/general/gr_random_pdu.cc84
-rw-r--r--gnuradio-core/src/lib/general/gr_random_pdu.h64
-rw-r--r--gnuradio-core/src/lib/general/gr_random_pdu.i30
-rw-r--r--gnuradio-core/src/lib/general/gr_regenerate_bb.cc90
-rw-r--r--gnuradio-core/src/lib/general/gr_regenerate_bb.h76
-rw-r--r--gnuradio-core/src/lib/general/gr_regenerate_bb.i38
-rw-r--r--gnuradio-core/src/lib/general/gr_remez.cc1033
-rw-r--r--gnuradio-core/src/lib/general/gr_remez.h65
-rw-r--r--gnuradio-core/src/lib/general/gr_remez.i32
-rw-r--r--gnuradio-core/src/lib/general/gr_repeat.cc69
-rw-r--r--gnuradio-core/src/lib/general/gr_repeat.h57
-rw-r--r--gnuradio-core/src/lib/general/gr_repeat.i11
-rw-r--r--gnuradio-core/src/lib/general/gr_reverse.cc60
-rw-r--r--gnuradio-core/src/lib/general/gr_reverse.h34
-rw-r--r--gnuradio-core/src/lib/general/gr_rms_cf.cc71
-rw-r--r--gnuradio-core/src/lib/general/gr_rms_cf.h61
-rw-r--r--gnuradio-core/src/lib/general/gr_rms_cf.i33
-rw-r--r--gnuradio-core/src/lib/general/gr_rms_ff.cc71
-rw-r--r--gnuradio-core/src/lib/general/gr_rms_ff.h61
-rw-r--r--gnuradio-core/src/lib/general/gr_rms_ff.i33
-rw-r--r--gnuradio-core/src/lib/general/gr_scrambler_bb.cc56
-rw-r--r--gnuradio-core/src/lib/general/gr_scrambler_bb.h60
-rw-r--r--gnuradio-core/src/lib/general/gr_scrambler_bb.i31
-rw-r--r--gnuradio-core/src/lib/general/gr_short_to_char.cc67
-rw-r--r--gnuradio-core/src/lib/general/gr_short_to_char.h58
-rw-r--r--gnuradio-core/src/lib/general/gr_short_to_char.i31
-rw-r--r--gnuradio-core/src/lib/general/gr_short_to_float.cc78
-rw-r--r--gnuradio-core/src/lib/general/gr_short_to_float.h70
-rw-r--r--gnuradio-core/src/lib/general/gr_short_to_float.i33
-rw-r--r--gnuradio-core/src/lib/general/gr_simple_correlator.cc237
-rw-r--r--gnuradio-core/src/lib/general/gr_simple_correlator.h111
-rw-r--r--gnuradio-core/src/lib/general/gr_simple_correlator.i31
-rw-r--r--gnuradio-core/src/lib/general/gr_simple_framer.cc101
-rw-r--r--gnuradio-core/src/lib/general/gr_simple_framer.h59
-rw-r--r--gnuradio-core/src/lib/general/gr_simple_framer.i31
-rw-r--r--gnuradio-core/src/lib/general/gr_simple_framer_sync.h51
-rw-r--r--gnuradio-core/src/lib/general/gr_simple_squelch_cc.cc99
-rw-r--r--gnuradio-core/src/lib/general/gr_simple_squelch_cc.h67
-rw-r--r--gnuradio-core/src/lib/general/gr_simple_squelch_cc.i37
-rw-r--r--gnuradio-core/src/lib/general/gr_skiphead.cc83
-rw-r--r--gnuradio-core/src/lib/general/gr_skiphead.h60
-rw-r--r--gnuradio-core/src/lib/general/gr_skiphead.i30
-rw-r--r--gnuradio-core/src/lib/general/gr_squelch_base_cc.cc93
-rw-r--r--gnuradio-core/src/lib/general/gr_squelch_base_cc.h59
-rw-r--r--gnuradio-core/src/lib/general/gr_squelch_base_cc.i40
-rw-r--r--gnuradio-core/src/lib/general/gr_squelch_base_ff.cc93
-rw-r--r--gnuradio-core/src/lib/general/gr_squelch_base_ff.h59
-rw-r--r--gnuradio-core/src/lib/general/gr_squelch_base_ff.i40
-rw-r--r--gnuradio-core/src/lib/general/gr_stream_mux.cc124
-rw-r--r--gnuradio-core/src/lib/general/gr_stream_mux.h93
-rw-r--r--gnuradio-core/src/lib/general/gr_stream_mux.i42
-rw-r--r--gnuradio-core/src/lib/general/gr_stream_to_streams.cc66
-rw-r--r--gnuradio-core/src/lib/general/gr_stream_to_streams.h56
-rw-r--r--gnuradio-core/src/lib/general/gr_stream_to_streams.i34
-rw-r--r--gnuradio-core/src/lib/general/gr_stream_to_vector.cc58
-rw-r--r--gnuradio-core/src/lib/general/gr_stream_to_vector.h55
-rw-r--r--gnuradio-core/src/lib/general/gr_stream_to_vector.i34
-rw-r--r--gnuradio-core/src/lib/general/gr_streams_to_stream.cc68
-rw-r--r--gnuradio-core/src/lib/general/gr_streams_to_stream.h56
-rw-r--r--gnuradio-core/src/lib/general/gr_streams_to_stream.i34
-rw-r--r--gnuradio-core/src/lib/general/gr_streams_to_vector.cc64
-rw-r--r--gnuradio-core/src/lib/general/gr_streams_to_vector.h54
-rw-r--r--gnuradio-core/src/lib/general/gr_streams_to_vector.i34
-rw-r--r--gnuradio-core/src/lib/general/gr_stretch_ff.cc74
-rw-r--r--gnuradio-core/src/lib/general/gr_stretch_ff.h60
-rw-r--r--gnuradio-core/src/lib/general/gr_stretch_ff.i31
-rw-r--r--gnuradio-core/src/lib/general/gr_tag_debug.cc104
-rw-r--r--gnuradio-core/src/lib/general/gr_tag_debug.h85
-rw-r--r--gnuradio-core/src/lib/general/gr_tag_debug.i35
-rw-r--r--gnuradio-core/src/lib/general/gr_test.cc177
-rw-r--r--gnuradio-core/src/lib/general/gr_test.h195
-rw-r--r--gnuradio-core/src/lib/general/gr_test.i64
-rw-r--r--gnuradio-core/src/lib/general/gr_test_types.h46
-rw-r--r--gnuradio-core/src/lib/general/gr_threshold_ff.cc67
-rw-r--r--gnuradio-core/src/lib/general/gr_threshold_ff.h59
-rw-r--r--gnuradio-core/src/lib/general/gr_threshold_ff.i39
-rw-r--r--gnuradio-core/src/lib/general/gr_throttle.cc89
-rw-r--r--gnuradio-core/src/lib/general/gr_throttle.h50
-rw-r--r--gnuradio-core/src/lib/general/gr_throttle.i29
-rw-r--r--gnuradio-core/src/lib/general/gr_transcendental.cc153
-rw-r--r--gnuradio-core/src/lib/general/gr_transcendental.h49
-rw-r--r--gnuradio-core/src/lib/general/gr_transcendental.i33
-rw-r--r--gnuradio-core/src/lib/general/gr_uchar_to_float.cc55
-rw-r--r--gnuradio-core/src/lib/general/gr_uchar_to_float.h52
-rw-r--r--gnuradio-core/src/lib/general/gr_uchar_to_float.i30
-rw-r--r--gnuradio-core/src/lib/general/gr_unpack_k_bits_bb.cc70
-rw-r--r--gnuradio-core/src/lib/general/gr_unpack_k_bits_bb.h56
-rw-r--r--gnuradio-core/src/lib/general/gr_unpack_k_bits_bb.i34
-rw-r--r--gnuradio-core/src/lib/general/gr_vco.h94
-rw-r--r--gnuradio-core/src/lib/general/gr_vco_f.cc58
-rw-r--r--gnuradio-core/src/lib/general/gr_vco_f.h75
-rw-r--r--gnuradio-core/src/lib/general/gr_vco_f.i38
-rw-r--r--gnuradio-core/src/lib/general/gr_vector_map.cc117
-rw-r--r--gnuradio-core/src/lib/general/gr_vector_map.h83
-rw-r--r--gnuradio-core/src/lib/general/gr_vector_map.i28
-rw-r--r--gnuradio-core/src/lib/general/gr_vector_to_stream.cc58
-rw-r--r--gnuradio-core/src/lib/general/gr_vector_to_stream.h54
-rw-r--r--gnuradio-core/src/lib/general/gr_vector_to_stream.i34
-rw-r--r--gnuradio-core/src/lib/general/gr_vector_to_streams.cc64
-rw-r--r--gnuradio-core/src/lib/general/gr_vector_to_streams.h54
-rw-r--r--gnuradio-core/src/lib/general/gr_vector_to_streams.i34
-rw-r--r--gnuradio-core/src/lib/general/gri_add_const_ss.h36
-rw-r--r--gnuradio-core/src/lib/general/gri_add_const_ss_generic.cc49
-rw-r--r--gnuradio-core/src/lib/general/gri_agc2_cc.h91
-rw-r--r--gnuradio-core/src/lib/general/gri_agc2_cc.i47
-rw-r--r--gnuradio-core/src/lib/general/gri_agc2_ff.h90
-rw-r--r--gnuradio-core/src/lib/general/gri_agc2_ff.i47
-rw-r--r--gnuradio-core/src/lib/general/gri_agc_cc.h75
-rw-r--r--gnuradio-core/src/lib/general/gri_agc_cc.i41
-rw-r--r--gnuradio-core/src/lib/general/gri_agc_ff.h72
-rw-r--r--gnuradio-core/src/lib/general/gri_agc_ff.i36
-rw-r--r--gnuradio-core/src/lib/general/gri_char_to_float.cc40
-rw-r--r--gnuradio-core/src/lib/general/gri_char_to_float.h34
-rw-r--r--gnuradio-core/src/lib/general/gri_control_loop.cc210
-rw-r--r--gnuradio-core/src/lib/general/gri_control_loop.h230
-rw-r--r--gnuradio-core/src/lib/general/gri_control_loop.i57
-rw-r--r--gnuradio-core/src/lib/general/gri_debugger_hook.cc29
-rw-r--r--gnuradio-core/src/lib/general/gri_debugger_hook.h30
-rw-r--r--gnuradio-core/src/lib/general/gri_fft.cc330
-rw-r--r--gnuradio-core/src/lib/general/gri_fft.h185
-rw-r--r--gnuradio-core/src/lib/general/gri_float_to_char.cc46
-rw-r--r--gnuradio-core/src/lib/general/gri_float_to_char.h33
-rw-r--r--gnuradio-core/src/lib/general/gri_float_to_int.cc47
-rw-r--r--gnuradio-core/src/lib/general/gri_float_to_int.h33
-rw-r--r--gnuradio-core/src/lib/general/gri_float_to_short.cc46
-rw-r--r--gnuradio-core/src/lib/general/gri_float_to_short.h33
-rw-r--r--gnuradio-core/src/lib/general/gri_float_to_uchar.cc46
-rw-r--r--gnuradio-core/src/lib/general/gri_float_to_uchar.h33
-rw-r--r--gnuradio-core/src/lib/general/gri_glfsr.cc67
-rw-r--r--gnuradio-core/src/lib/general/gri_glfsr.h57
-rw-r--r--gnuradio-core/src/lib/general/gri_int_to_float.cc37
-rw-r--r--gnuradio-core/src/lib/general/gri_int_to_float.h34
-rw-r--r--gnuradio-core/src/lib/general/gri_interleaved_short_to_complex.cc39
-rw-r--r--gnuradio-core/src/lib/general/gri_interleaved_short_to_complex.h38
-rw-r--r--gnuradio-core/src/lib/general/gri_lfsr.h152
-rw-r--r--gnuradio-core/src/lib/general/gri_lfsr_15_1_0.h60
-rw-r--r--gnuradio-core/src/lib/general/gri_lfsr_32k.h80
-rw-r--r--gnuradio-core/src/lib/general/gri_short_to_float.cc40
-rw-r--r--gnuradio-core/src/lib/general/gri_short_to_float.h34
-rw-r--r--gnuradio-core/src/lib/general/gri_uchar_to_float.cc40
-rw-r--r--gnuradio-core/src/lib/general/gri_uchar_to_float.h34
-rw-r--r--gnuradio-core/src/lib/general/malloc16.c46
-rw-r--r--gnuradio-core/src/lib/general/malloc16.h37
-rw-r--r--gnuradio-core/src/lib/general/qa_general.cc53
-rw-r--r--gnuradio-core/src/lib/general/qa_general.h38
-rw-r--r--gnuradio-core/src/lib/general/qa_gr_circular_file.cc72
-rw-r--r--gnuradio-core/src/lib/general/qa_gr_circular_file.h40
-rw-r--r--gnuradio-core/src/lib/general/qa_gr_cpm.cc140
-rw-r--r--gnuradio-core/src/lib/general/qa_gr_cpm.h49
-rw-r--r--gnuradio-core/src/lib/general/qa_gr_firdes.cc618
-rw-r--r--gnuradio-core/src/lib/general/qa_gr_firdes.h52
-rw-r--r--gnuradio-core/src/lib/general/qa_gr_fxpt.cc103
-rw-r--r--gnuradio-core/src/lib/general/qa_gr_fxpt.h48
-rw-r--r--gnuradio-core/src/lib/general/qa_gr_fxpt_nco.cc119
-rw-r--r--gnuradio-core/src/lib/general/qa_gr_fxpt_nco.h48
-rw-r--r--gnuradio-core/src/lib/general/qa_gr_fxpt_vco.cc110
-rw-r--r--gnuradio-core/src/lib/general/qa_gr_fxpt_vco.h48
-rw-r--r--gnuradio-core/src/lib/general/qa_gr_math.cc105
-rw-r--r--gnuradio-core/src/lib/general/qa_gr_math.h42
-rw-r--r--gnuradio-core/src/lib/general/qa_gri_lfsr.cc142
-rw-r--r--gnuradio-core/src/lib/general/qa_gri_lfsr.h42
-rw-r--r--gnuradio-core/src/lib/general/random.h38
-rw-r--r--gnuradio-core/src/lib/general/sine_table.h1025
-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
-rw-r--r--gnuradio-core/src/lib/gnuradio-config-info.cc72
-rw-r--r--gnuradio-core/src/lib/hier/CMakeLists.txt42
-rw-r--r--gnuradio-core/src/lib/hier/gr_channel_model.cc126
-rw-r--r--gnuradio-core/src/lib/hier/gr_channel_model.h79
-rw-r--r--gnuradio-core/src/lib/hier/gr_channel_model.i50
-rw-r--r--gnuradio-core/src/lib/hier/hier.i32
-rw-r--r--gnuradio-core/src/lib/io/CMakeLists.txt118
-rw-r--r--gnuradio-core/src/lib/io/gr_file_descriptor_sink.cc87
-rw-r--r--gnuradio-core/src/lib/io/gr_file_descriptor_sink.h59
-rw-r--r--gnuradio-core/src/lib/io/gr_file_descriptor_sink.i35
-rw-r--r--gnuradio-core/src/lib/io/gr_file_descriptor_source.cc151
-rw-r--r--gnuradio-core/src/lib/io/gr_file_descriptor_source.h68
-rw-r--r--gnuradio-core/src/lib/io/gr_file_descriptor_source.i35
-rw-r--r--gnuradio-core/src/lib/io/gr_file_sink.cc84
-rw-r--r--gnuradio-core/src/lib/io/gr_file_sink.h58
-rw-r--r--gnuradio-core/src/lib/io/gr_file_sink.i45
-rw-r--r--gnuradio-core/src/lib/io/gr_file_sink_base.cc125
-rw-r--r--gnuradio-core/src/lib/io/gr_file_sink_base.h75
-rw-r--r--gnuradio-core/src/lib/io/gr_file_sink_base.i51
-rw-r--r--gnuradio-core/src/lib/io/gr_file_source.cc192
-rw-r--r--gnuradio-core/src/lib/io/gr_file_source.h107
-rw-r--r--gnuradio-core/src/lib/io/gr_file_source.i45
-rw-r--r--gnuradio-core/src/lib/io/gr_histo_sink.i39
-rw-r--r--gnuradio-core/src/lib/io/gr_histo_sink_f.cc165
-rw-r--r--gnuradio-core/src/lib/io/gr_histo_sink_f.h71
-rw-r--r--gnuradio-core/src/lib/io/gr_message_burst_source.cc144
-rw-r--r--gnuradio-core/src/lib/io/gr_message_burst_source.h71
-rw-r--r--gnuradio-core/src/lib/io/gr_message_burst_source.i38
-rw-r--r--gnuradio-core/src/lib/io/gr_message_debug.cc120
-rw-r--r--gnuradio-core/src/lib/io/gr_message_debug.h114
-rw-r--r--gnuradio-core/src/lib/io/gr_message_debug.i30
-rw-r--r--gnuradio-core/src/lib/io/gr_message_sink.cc79
-rw-r--r--gnuradio-core/src/lib/io/gr_message_sink.h63
-rw-r--r--gnuradio-core/src/lib/io/gr_message_sink.i36
-rw-r--r--gnuradio-core/src/lib/io/gr_message_source.cc120
-rw-r--r--gnuradio-core/src/lib/io/gr_message_source.h69
-rw-r--r--gnuradio-core/src/lib/io/gr_message_source.i38
-rw-r--r--gnuradio-core/src/lib/io/gr_oscope_guts.cc437
-rw-r--r--gnuradio-core/src/lib/io/gr_oscope_guts.h123
-rw-r--r--gnuradio-core/src/lib/io/gr_oscope_sink.i77
-rw-r--r--gnuradio-core/src/lib/io/gr_oscope_sink_f.cc78
-rw-r--r--gnuradio-core/src/lib/io/gr_oscope_sink_f.h63
-rw-r--r--gnuradio-core/src/lib/io/gr_oscope_sink_x.cc156
-rw-r--r--gnuradio-core/src/lib/io/gr_oscope_sink_x.h77
-rw-r--r--gnuradio-core/src/lib/io/gr_pdu.cc79
-rw-r--r--gnuradio-core/src/lib/io/gr_pdu.h39
-rw-r--r--gnuradio-core/src/lib/io/gr_pdu.i30
-rw-r--r--gnuradio-core/src/lib/io/gr_pdu_to_tagged_stream.cc132
-rw-r--r--gnuradio-core/src/lib/io/gr_pdu_to_tagged_stream.h63
-rw-r--r--gnuradio-core/src/lib/io/gr_pdu_to_tagged_stream.i31
-rw-r--r--gnuradio-core/src/lib/io/gr_socket_pdu.cc157
-rw-r--r--gnuradio-core/src/lib/io/gr_socket_pdu.h203
-rw-r--r--gnuradio-core/src/lib/io/gr_socket_pdu.i33
-rw-r--r--gnuradio-core/src/lib/io/gr_stream_pdu_base.cc123
-rw-r--r--gnuradio-core/src/lib/io/gr_stream_pdu_base.h59
-rw-r--r--gnuradio-core/src/lib/io/gr_tagged_file_sink.cc216
-rw-r--r--gnuradio-core/src/lib/io/gr_tagged_file_sink.h72
-rw-r--r--gnuradio-core/src/lib/io/gr_tagged_file_sink.i35
-rw-r--r--gnuradio-core/src/lib/io/gr_tagged_stream_to_pdu.cc137
-rw-r--r--gnuradio-core/src/lib/io/gr_tagged_stream_to_pdu.h76
-rw-r--r--gnuradio-core/src/lib/io/gr_tagged_stream_to_pdu.i31
-rw-r--r--gnuradio-core/src/lib/io/gr_trigger_mode.h38
-rw-r--r--gnuradio-core/src/lib/io/gr_tuntap_pdu.cc145
-rw-r--r--gnuradio-core/src/lib/io/gr_tuntap_pdu.h74
-rw-r--r--gnuradio-core/src/lib/io/gr_tuntap_pdu.i30
-rw-r--r--gnuradio-core/src/lib/io/gr_udp_sink.cc304
-rw-r--r--gnuradio-core/src/lib/io/gr_udp_sink.h112
-rw-r--r--gnuradio-core/src/lib/io/gr_udp_sink.i46
-rw-r--r--gnuradio-core/src/lib/io/gr_udp_source.cc374
-rw-r--r--gnuradio-core/src/lib/io/gr_udp_source.h110
-rw-r--r--gnuradio-core/src/lib/io/gr_udp_source.i41
-rw-r--r--gnuradio-core/src/lib/io/gr_wavfile_sink.cc280
-rw-r--r--gnuradio-core/src/lib/io/gr_wavfile_sink.h138
-rw-r--r--gnuradio-core/src/lib/io/gr_wavfile_sink.i47
-rw-r--r--gnuradio-core/src/lib/io/gr_wavfile_source.cc171
-rw-r--r--gnuradio-core/src/lib/io/gr_wavfile_source.h95
-rw-r--r--gnuradio-core/src/lib/io/gr_wavfile_source.i42
-rw-r--r--gnuradio-core/src/lib/io/gri_wavfile.cc251
-rw-r--r--gnuradio-core/src/lib/io/gri_wavfile.h96
-rw-r--r--gnuradio-core/src/lib/io/i2c.cc28
-rw-r--r--gnuradio-core/src/lib/io/i2c.h49
-rw-r--r--gnuradio-core/src/lib/io/i2c_bbio.cc29
-rw-r--r--gnuradio-core/src/lib/io/i2c_bbio.h51
-rw-r--r--gnuradio-core/src/lib/io/i2c_bbio_pp.cc87
-rw-r--r--gnuradio-core/src/lib/io/i2c_bbio_pp.h57
-rw-r--r--gnuradio-core/src/lib/io/i2c_bitbang.cc144
-rw-r--r--gnuradio-core/src/lib/io/i2c_bitbang.h65
-rw-r--r--gnuradio-core/src/lib/io/io.i83
-rw-r--r--gnuradio-core/src/lib/io/microtune_4702.cc183
-rw-r--r--gnuradio-core/src/lib/io/microtune_4702.h71
-rw-r--r--gnuradio-core/src/lib/io/microtune_4702_eval_board.cc88
-rw-r--r--gnuradio-core/src/lib/io/microtune_4702_eval_board.h49
-rw-r--r--gnuradio-core/src/lib/io/microtune_4702_eval_board.i36
-rw-r--r--gnuradio-core/src/lib/io/microtune_4937.cc146
-rw-r--r--gnuradio-core/src/lib/io/microtune_4937.h68
-rw-r--r--gnuradio-core/src/lib/io/microtune_4937_eval_board.cc97
-rw-r--r--gnuradio-core/src/lib/io/microtune_4937_eval_board.h50
-rw-r--r--gnuradio-core/src/lib/io/microtune_4937_eval_board.i36
-rw-r--r--gnuradio-core/src/lib/io/microtune_eval_board.i95
-rw-r--r--gnuradio-core/src/lib/io/microtune_eval_board_defs.h71
-rw-r--r--gnuradio-core/src/lib/io/microtune_xxxx.cc41
-rw-r--r--gnuradio-core/src/lib/io/microtune_xxxx.h66
-rw-r--r--gnuradio-core/src/lib/io/microtune_xxxx_eval_board.cc144
-rw-r--r--gnuradio-core/src/lib/io/microtune_xxxx_eval_board.h98
-rw-r--r--gnuradio-core/src/lib/io/microtune_xxxx_eval_board.i58
-rw-r--r--gnuradio-core/src/lib/io/ppio.cc39
-rw-r--r--gnuradio-core/src/lib/io/ppio.h63
-rw-r--r--gnuradio-core/src/lib/io/ppio.i48
-rw-r--r--gnuradio-core/src/lib/io/ppio_ppdev.cc321
-rw-r--r--gnuradio-core/src/lib/io/ppio_ppdev.h62
-rw-r--r--gnuradio-core/src/lib/io/sdr_1000.cc65
-rw-r--r--gnuradio-core/src/lib/io/sdr_1000.h53
-rw-r--r--gnuradio-core/src/lib/io/sdr_1000.i36
-rw-r--r--gnuradio-core/src/lib/missing/CMakeLists.txt32
-rw-r--r--gnuradio-core/src/lib/missing/bug_work_around_8.cc3
-rw-r--r--gnuradio-core/src/lib/missing/getopt.c733
-rw-r--r--gnuradio-core/src/lib/missing/getopt.h129
-rw-r--r--gnuradio-core/src/lib/missing/gettimeofday.c50
-rw-r--r--gnuradio-core/src/lib/missing/posix_memalign.cc114
-rw-r--r--gnuradio-core/src/lib/missing/posix_memalign.h42
-rw-r--r--gnuradio-core/src/lib/missing/usleep.c67
-rw-r--r--gnuradio-core/src/lib/reed-solomon/CMakeLists.txt62
-rw-r--r--gnuradio-core/src/lib/reed-solomon/Makefile.in.karn99
-rw-r--r--gnuradio-core/src/lib/reed-solomon/README5
-rw-r--r--gnuradio-core/src/lib/reed-solomon/README.karn22
-rw-r--r--gnuradio-core/src/lib/reed-solomon/ccsds.h1
-rw-r--r--gnuradio-core/src/lib/reed-solomon/char.h57
-rw-r--r--gnuradio-core/src/lib/reed-solomon/decode_rs.c270
-rw-r--r--gnuradio-core/src/lib/reed-solomon/decode_rs_ccsds.c27
-rw-r--r--gnuradio-core/src/lib/reed-solomon/encode_rs.c47
-rw-r--r--gnuradio-core/src/lib/reed-solomon/encode_rs_ccsds.c24
-rw-r--r--gnuradio-core/src/lib/reed-solomon/exercise.c134
-rw-r--r--gnuradio-core/src/lib/reed-solomon/fixed.h40
-rw-r--r--gnuradio-core/src/lib/reed-solomon/gen_ccsds.c34
-rw-r--r--gnuradio-core/src/lib/reed-solomon/gen_ccsds_tal.c50
-rw-r--r--gnuradio-core/src/lib/reed-solomon/init_rs.c129
-rw-r--r--gnuradio-core/src/lib/reed-solomon/int.h55
-rw-r--r--gnuradio-core/src/lib/reed-solomon/rs.3170
-rw-r--r--gnuradio-core/src/lib/reed-solomon/rs.h31
-rw-r--r--gnuradio-core/src/lib/reed-solomon/rstest.c117
-rw-r--r--gnuradio-core/src/lib/runtime/CMakeLists.txt187
-rw-r--r--gnuradio-core/src/lib/runtime/gr_basic_block.cc227
-rw-r--r--gnuradio-core/src/lib/runtime/gr_basic_block.h299
-rw-r--r--gnuradio-core/src/lib/runtime/gr_basic_block.i62
-rw-r--r--gnuradio-core/src/lib/runtime/gr_block.cc459
-rw-r--r--gnuradio-core/src/lib/runtime/gr_block.h437
-rw-r--r--gnuradio-core/src/lib/runtime/gr_block.i93
-rw-r--r--gnuradio-core/src/lib/runtime/gr_block_detail.cc414
-rw-r--r--gnuradio-core/src/lib/runtime/gr_block_detail.h235
-rw-r--r--gnuradio-core/src/lib/runtime/gr_block_detail.i66
-rw-r--r--gnuradio-core/src/lib/runtime/gr_block_executor.cc487
-rw-r--r--gnuradio-core/src/lib/runtime/gr_block_executor.h78
-rw-r--r--gnuradio-core/src/lib/runtime/gr_block_registry.cc76
-rw-r--r--gnuradio-core/src/lib/runtime/gr_block_registry.h43
-rw-r--r--gnuradio-core/src/lib/runtime/gr_buffer.cc347
-rw-r--r--gnuradio-core/src/lib/runtime/gr_buffer.h309
-rw-r--r--gnuradio-core/src/lib/runtime/gr_buffer.i63
-rw-r--r--gnuradio-core/src/lib/runtime/gr_complex.h46
-rw-r--r--gnuradio-core/src/lib/runtime/gr_dispatcher.cc193
-rw-r--r--gnuradio-core/src/lib/runtime/gr_dispatcher.h69
-rw-r--r--gnuradio-core/src/lib/runtime/gr_dispatcher.i55
-rw-r--r--gnuradio-core/src/lib/runtime/gr_error_handler.cc244
-rw-r--r--gnuradio-core/src/lib/runtime/gr_error_handler.h117
-rw-r--r--gnuradio-core/src/lib/runtime/gr_error_handler.i69
-rw-r--r--gnuradio-core/src/lib/runtime/gr_flat_flowgraph.cc403
-rw-r--r--gnuradio-core/src/lib/runtime/gr_flat_flowgraph.h80
-rw-r--r--gnuradio-core/src/lib/runtime/gr_flowgraph.cc515
-rw-r--r--gnuradio-core/src/lib/runtime/gr_flowgraph.h251
-rw-r--r--gnuradio-core/src/lib/runtime/gr_hier_block2.cc77
-rw-r--r--gnuradio-core/src/lib/runtime/gr_hier_block2.h71
-rw-r--r--gnuradio-core/src/lib/runtime/gr_hier_block2.i88
-rw-r--r--gnuradio-core/src/lib/runtime/gr_hier_block2_detail.cc615
-rw-r--r--gnuradio-core/src/lib/runtime/gr_hier_block2_detail.h74
-rw-r--r--gnuradio-core/src/lib/runtime/gr_io_signature.cc112
-rw-r--r--gnuradio-core/src/lib/runtime/gr_io_signature.h117
-rw-r--r--gnuradio-core/src/lib/runtime/gr_io_signature.i73
-rw-r--r--gnuradio-core/src/lib/runtime/gr_local_sighandler.cc187
-rw-r--r--gnuradio-core/src/lib/runtime/gr_local_sighandler.h65
-rw-r--r--gnuradio-core/src/lib/runtime/gr_message.cc78
-rw-r--r--gnuradio-core/src/lib/runtime/gr_message.h91
-rw-r--r--gnuradio-core/src/lib/runtime/gr_message.i65
-rw-r--r--gnuradio-core/src/lib/runtime/gr_msg_accepter.cc59
-rw-r--r--gnuradio-core/src/lib/runtime/gr_msg_accepter.h43
-rw-r--r--gnuradio-core/src/lib/runtime/gr_msg_handler.cc30
-rw-r--r--gnuradio-core/src/lib/runtime/gr_msg_handler.h43
-rw-r--r--gnuradio-core/src/lib/runtime/gr_msg_handler.i32
-rw-r--r--gnuradio-core/src/lib/runtime/gr_msg_queue.cc125
-rw-r--r--gnuradio-core/src/lib/runtime/gr_msg_queue.h92
-rw-r--r--gnuradio-core/src/lib/runtime/gr_msg_queue.i107
-rw-r--r--gnuradio-core/src/lib/runtime/gr_pagesize.cc56
-rw-r--r--gnuradio-core/src/lib/runtime/gr_pagesize.h34
-rw-r--r--gnuradio-core/src/lib/runtime/gr_preferences.cc108
-rw-r--r--gnuradio-core/src/lib/runtime/gr_preferences.h34
-rw-r--r--gnuradio-core/src/lib/runtime/gr_realtime.cc32
-rw-r--r--gnuradio-core/src/lib/runtime/gr_realtime.h37
-rw-r--r--gnuradio-core/src/lib/runtime/gr_realtime.i44
-rw-r--r--gnuradio-core/src/lib/runtime/gr_runtime_types.h56
-rw-r--r--gnuradio-core/src/lib/runtime/gr_scheduler.cc33
-rw-r--r--gnuradio-core/src/lib/runtime/gr_scheduler.h65
-rw-r--r--gnuradio-core/src/lib/runtime/gr_scheduler_sts.cc87
-rw-r--r--gnuradio-core/src/lib/runtime/gr_scheduler_sts.h63
-rw-r--r--gnuradio-core/src/lib/runtime/gr_scheduler_tpb.cc103
-rw-r--r--gnuradio-core/src/lib/runtime/gr_scheduler_tpb.h61
-rw-r--r--gnuradio-core/src/lib/runtime/gr_select_handler.cc36
-rw-r--r--gnuradio-core/src/lib/runtime/gr_select_handler.h85
-rw-r--r--gnuradio-core/src/lib/runtime/gr_single_threaded_scheduler.cc364
-rw-r--r--gnuradio-core/src/lib/runtime/gr_single_threaded_scheduler.h62
-rw-r--r--gnuradio-core/src/lib/runtime/gr_single_threaded_scheduler.i54
-rw-r--r--gnuradio-core/src/lib/runtime/gr_sptr_magic.cc72
-rw-r--r--gnuradio-core/src/lib/runtime/gr_sptr_magic.h52
-rw-r--r--gnuradio-core/src/lib/runtime/gr_sync_block.cc55
-rw-r--r--gnuradio-core/src/lib/runtime/gr_sync_block.h74
-rw-r--r--gnuradio-core/src/lib/runtime/gr_sync_block.i29
-rw-r--r--gnuradio-core/src/lib/runtime/gr_sync_decimator.cc48
-rw-r--r--gnuradio-core/src/lib/runtime/gr_sync_decimator.h43
-rw-r--r--gnuradio-core/src/lib/runtime/gr_sync_decimator.i31
-rw-r--r--gnuradio-core/src/lib/runtime/gr_sync_interpolator.cc48
-rw-r--r--gnuradio-core/src/lib/runtime/gr_sync_interpolator.h43
-rw-r--r--gnuradio-core/src/lib/runtime/gr_sync_interpolator.i31
-rw-r--r--gnuradio-core/src/lib/runtime/gr_sys_paths.cc55
-rw-r--r--gnuradio-core/src/lib/runtime/gr_sys_paths.h33
-rw-r--r--gnuradio-core/src/lib/runtime/gr_tags.h55
-rw-r--r--gnuradio-core/src/lib/runtime/gr_tags.i32
-rw-r--r--gnuradio-core/src/lib/runtime/gr_timer.h84
-rw-r--r--gnuradio-core/src/lib/runtime/gr_top_block.cc95
-rw-r--r--gnuradio-core/src/lib/runtime/gr_top_block.h67
-rw-r--r--gnuradio-core/src/lib/runtime/gr_top_block.i73
-rw-r--r--gnuradio-core/src/lib/runtime/gr_top_block_impl.cc195
-rw-r--r--gnuradio-core/src/lib/runtime/gr_top_block_impl.h85
-rw-r--r--gnuradio-core/src/lib/runtime/gr_tpb_detail.cc70
-rw-r--r--gnuradio-core/src/lib/runtime/gr_tpb_detail.h89
-rw-r--r--gnuradio-core/src/lib/runtime/gr_tpb_thread_body.cc151
-rw-r--r--gnuradio-core/src/lib/runtime/gr_tpb_thread_body.h46
-rw-r--r--gnuradio-core/src/lib/runtime/gr_types.h56
-rw-r--r--gnuradio-core/src/lib/runtime/gr_unittests.h43
-rw-r--r--gnuradio-core/src/lib/runtime/gr_vmcircbuf.cc295
-rw-r--r--gnuradio-core/src/lib/runtime/gr_vmcircbuf.h122
-rw-r--r--gnuradio-core/src/lib/runtime/gr_vmcircbuf_createfilemapping.cc204
-rw-r--r--gnuradio-core/src/lib/runtime/gr_vmcircbuf_createfilemapping.h76
-rw-r--r--gnuradio-core/src/lib/runtime/gr_vmcircbuf_mmap_shm_open.cc205
-rw-r--r--gnuradio-core/src/lib/runtime/gr_vmcircbuf_mmap_shm_open.h67
-rw-r--r--gnuradio-core/src/lib/runtime/gr_vmcircbuf_mmap_tmpfile.cc197
-rw-r--r--gnuradio-core/src/lib/runtime/gr_vmcircbuf_mmap_tmpfile.h67
-rw-r--r--gnuradio-core/src/lib/runtime/gr_vmcircbuf_sysv_shm.cc194
-rw-r--r--gnuradio-core/src/lib/runtime/gr_vmcircbuf_sysv_shm.h67
-rw-r--r--gnuradio-core/src/lib/runtime/pmx_helper.hpp268
-rw-r--r--gnuradio-core/src/lib/runtime/qa_block_tags.cc450
-rw-r--r--gnuradio-core/src/lib/runtime/qa_block_tags.h52
-rw-r--r--gnuradio-core/src/lib/runtime/qa_gr_block.cc88
-rw-r--r--gnuradio-core/src/lib/runtime/qa_gr_block.h48
-rw-r--r--gnuradio-core/src/lib/runtime/qa_gr_buffer.cc307
-rw-r--r--gnuradio-core/src/lib/runtime/qa_gr_buffer.h53
-rw-r--r--gnuradio-core/src/lib/runtime/qa_gr_flowgraph.cc245
-rw-r--r--gnuradio-core/src/lib/runtime/qa_gr_flowgraph.h75
-rw-r--r--gnuradio-core/src/lib/runtime/qa_gr_hier_block2.cc57
-rw-r--r--gnuradio-core/src/lib/runtime/qa_gr_hier_block2.h42
-rw-r--r--gnuradio-core/src/lib/runtime/qa_gr_hier_block2_derived.cc87
-rw-r--r--gnuradio-core/src/lib/runtime/qa_gr_hier_block2_derived.h41
-rw-r--r--gnuradio-core/src/lib/runtime/qa_gr_io_signature.cc64
-rw-r--r--gnuradio-core/src/lib/runtime/qa_gr_io_signature.h46
-rw-r--r--gnuradio-core/src/lib/runtime/qa_gr_top_block.cc285
-rw-r--r--gnuradio-core/src/lib/runtime/qa_gr_top_block.h66
-rw-r--r--gnuradio-core/src/lib/runtime/qa_gr_vmcircbuf.cc40
-rw-r--r--gnuradio-core/src/lib/runtime/qa_gr_vmcircbuf.h39
-rw-r--r--gnuradio-core/src/lib/runtime/qa_runtime.cc61
-rw-r--r--gnuradio-core/src/lib/runtime/qa_runtime.h38
-rw-r--r--gnuradio-core/src/lib/runtime/qa_set_msg_handler.cc81
-rw-r--r--gnuradio-core/src/lib/runtime/qa_set_msg_handler.h43
-rw-r--r--gnuradio-core/src/lib/runtime/runtime.i123
-rw-r--r--gnuradio-core/src/lib/runtime/test_shared_block_ptr.cc53
-rw-r--r--gnuradio-core/src/lib/swig/CMakeLists.txt88
-rwxr-xr-xgnuradio-core/src/lib/swig/gen-swig-bug-fix111
-rw-r--r--gnuradio-core/src/lib/swig/gnuradio.i91
-rw-r--r--gnuradio-core/src/lib/swig/gnuradio_core.py28
-rw-r--r--gnuradio-core/src/lib/swig/gnuradio_core_filter.i32
-rw-r--r--gnuradio-core/src/lib/swig/gnuradio_core_general.i54
-rw-r--r--gnuradio-core/src/lib/swig/gnuradio_core_gengen.i32
-rw-r--r--gnuradio-core/src/lib/swig/gnuradio_core_hier.i32
-rw-r--r--gnuradio-core/src/lib/swig/gnuradio_core_io.i32
-rw-r--r--gnuradio-core/src/lib/swig/gnuradio_core_runtime.i34
-rw-r--r--gnuradio-core/src/lib/swig/gnuradio_swig_bug_workaround.h45
-rw-r--r--gnuradio-core/src/lib/swig/gr_shared_ptr.i43
-rw-r--r--gnuradio-core/src/lib/swig/gr_swig_block_magic.i50
-rw-r--r--gnuradio-core/src/lib/viterbi/CMakeLists.txt63
-rw-r--r--gnuradio-core/src/lib/viterbi/decode.cc88
-rw-r--r--gnuradio-core/src/lib/viterbi/encode.cc54
-rw-r--r--gnuradio-core/src/lib/viterbi/metrics.c126
-rw-r--r--gnuradio-core/src/lib/viterbi/tab.c57
-rw-r--r--gnuradio-core/src/lib/viterbi/viterbi.c355
-rw-r--r--gnuradio-core/src/lib/viterbi/viterbi.h53
-rwxr-xr-xgnuradio-core/src/python/bin/microtune.py42
-rw-r--r--gnuradio-core/src/python/build_utils.py226
-rw-r--r--gnuradio-core/src/python/build_utils_codes.py52
-rw-r--r--gnuradio-core/src/python/gnuradio/CMakeLists.txt38
-rw-r--r--gnuradio-core/src/python/gnuradio/__init__.py1
-rw-r--r--gnuradio-core/src/python/gnuradio/blks2/CMakeLists.txt26
-rw-r--r--gnuradio-core/src/python/gnuradio/blks2/__init__.py37
-rw-r--r--gnuradio-core/src/python/gnuradio/blks2impl/CMakeLists.txt45
-rw-r--r--gnuradio-core/src/python/gnuradio/blks2impl/__init__.py1
-rw-r--r--gnuradio-core/src/python/gnuradio/blks2impl/am_demod.py75
-rw-r--r--gnuradio-core/src/python/gnuradio/blks2impl/channel_model.py26
-rw-r--r--gnuradio-core/src/python/gnuradio/blks2impl/digital_voice.py.real102
-rw-r--r--gnuradio-core/src/python/gnuradio/blks2impl/filterbank.py169
-rw-r--r--gnuradio-core/src/python/gnuradio/blks2impl/fm_demod.py111
-rw-r--r--gnuradio-core/src/python/gnuradio/blks2impl/fm_emph.py151
-rw-r--r--gnuradio-core/src/python/gnuradio/blks2impl/logpwrfft.py155
-rw-r--r--gnuradio-core/src/python/gnuradio/blks2impl/nbfm_rx.py88
-rw-r--r--gnuradio-core/src/python/gnuradio/blks2impl/nbfm_tx.py92
-rw-r--r--gnuradio-core/src/python/gnuradio/blks2impl/pfb_arb_resampler.py128
-rw-r--r--gnuradio-core/src/python/gnuradio/blks2impl/pfb_channelizer.py73
-rw-r--r--gnuradio-core/src/python/gnuradio/blks2impl/pfb_decimator.py69
-rw-r--r--gnuradio-core/src/python/gnuradio/blks2impl/pfb_interpolator.py70
-rw-r--r--gnuradio-core/src/python/gnuradio/blks2impl/rational_resampler.py131
-rw-r--r--gnuradio-core/src/python/gnuradio/blks2impl/standard_squelch.py76
-rw-r--r--gnuradio-core/src/python/gnuradio/blks2impl/stream_to_vector_decimator.py93
-rw-r--r--gnuradio-core/src/python/gnuradio/blks2impl/wfm_rcv.py69
-rwxr-xr-xgnuradio-core/src/python/gnuradio/blks2impl/wfm_rcv_fmdet.py216
-rw-r--r--gnuradio-core/src/python/gnuradio/blks2impl/wfm_rcv_pll.py190
-rw-r--r--gnuradio-core/src/python/gnuradio/blks2impl/wfm_tx.py79
-rw-r--r--gnuradio-core/src/python/gnuradio/eng_notation.py71
-rw-r--r--gnuradio-core/src/python/gnuradio/eng_option.py62
-rw-r--r--gnuradio-core/src/python/gnuradio/gr/CMakeLists.txt49
-rw-r--r--gnuradio-core/src/python/gnuradio/gr/__init__.py116
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/benchmark_filters.py75
-rw-r--r--gnuradio-core/src/python/gnuradio/gr/exceptions.py27
-rw-r--r--gnuradio-core/src/python/gnuradio/gr/gateway.py246
-rw-r--r--gnuradio-core/src/python/gnuradio/gr/gr_threading.py35
-rw-r--r--gnuradio-core/src/python/gnuradio/gr/gr_threading_23.py724
-rw-r--r--gnuradio-core/src/python/gnuradio/gr/gr_threading_24.py793
-rw-r--r--gnuradio-core/src/python/gnuradio/gr/hier_block2.py129
-rw-r--r--gnuradio-core/src/python/gnuradio/gr/prefs.py127
-rw-r--r--gnuradio-core/src/python/gnuradio/gr/pubsub.py153
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_add_and_friends.py163
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_add_v_and_friends.py353
-rw-r--r--gnuradio-core/src/python/gnuradio/gr/qa_affinity.py49
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_agc.py433
-rw-r--r--gnuradio-core/src/python/gnuradio/gr/qa_argmax.py77
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_bin_statistics.py230
-rw-r--r--gnuradio-core/src/python/gnuradio/gr/qa_block_gateway.py235
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_boolean_operators.py162
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_complex_to_xxx.py142
-rw-r--r--gnuradio-core/src/python/gnuradio/gr/qa_conjugate.py53
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_copy.py58
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_dc_blocker.py108
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_delay.py65
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_diff_encoder.py86
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_diff_phasor_cc.py50
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_ecc_ccsds_27.py50
-rw-r--r--gnuradio-core/src/python/gnuradio/gr/qa_endian_swap.py66
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_feval.py110
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_fft.py212
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_fft_filter.py383
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_filter_delay_fc.py317
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_float_to_char.py82
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_float_to_int.py85
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_float_to_short.py86
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_float_to_uchar.py64
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_fractional_interpolator.py38
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_frequency_modulator.py56
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_fsk_stuff.py75
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_glfsr_source.py94
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_goertzel.py64
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_head.py47
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_hier_block2.py369
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_hilbert.py116
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_iir.py159
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_int_to_float.py69
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_integrate.py75
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_interleave.py81
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_interp_fir_filter.py54
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_keep_m_in_n.py58
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_kludge_copy.py91
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_kludged_imports.py43
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_max.py70
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_message.py131
-rw-r--r--gnuradio-core/src/python/gnuradio/gr/qa_multiply_conjugate.py57
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_mute.py89
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_nlog10.py47
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_noise.py51
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_pack_k_bits.py67
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_packed_to_unpacked.py405
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_pdu.py109
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_pipe_fittings.py143
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_pll_carriertracking.py156
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_pll_freqdet.py160
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_pll_refout.py156
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_pn_correlator_cc.py50
-rw-r--r--gnuradio-core/src/python/gnuradio/gr/qa_probe_signal.py67
-rw-r--r--gnuradio-core/src/python/gnuradio/gr/qa_python_message_passing.py123
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_rational_resampler.py298
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_regenerate.py90
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_repeat.py48
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_scrambler.py64
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_short_to_char.py69
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_short_to_float.py70
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_sig_source.py157
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_single_pole_iir.py72
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_single_pole_iir_cc.py72
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_skiphead.py102
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_stream_mux.py168
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_tag_debug.py43
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_tag_utils.py55
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_udp_sink_source.py99
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_unpack_k_bits.py57
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_vector_insert.py58
-rw-r--r--gnuradio-core/src/python/gnuradio/gr/qa_vector_map.py105
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_vector_sink_source.py65
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_wavefile.py69
-rw-r--r--gnuradio-core/src/python/gnuradio/gr/tag_utils.py54
-rw-r--r--gnuradio-core/src/python/gnuradio/gr/test_16bit_1chunk.wavbin0 -> 52 bytes
-rw-r--r--gnuradio-core/src/python/gnuradio/gr/top_block.py165
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr_unittest.py167
-rw-r--r--gnuradio-core/src/python/gnuradio/gr_xmlrunner.py387
-rw-r--r--gnuradio-core/src/python/gnuradio/gru/CMakeLists.txt26
-rw-r--r--gnuradio-core/src/python/gnuradio/gru/__init__.py37
-rw-r--r--gnuradio-core/src/python/gnuradio/gruimpl/CMakeLists.txt38
-rw-r--r--gnuradio-core/src/python/gnuradio/gruimpl/__init__.py1
-rw-r--r--gnuradio-core/src/python/gnuradio/gruimpl/daemon.py102
-rw-r--r--gnuradio-core/src/python/gnuradio/gruimpl/freqz.py344
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gruimpl/gnuplot_freqz.py82
-rw-r--r--gnuradio-core/src/python/gnuradio/gruimpl/hexint.py44
-rw-r--r--gnuradio-core/src/python/gnuradio/gruimpl/listmisc.py29
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gruimpl/lmx2306.py186
-rw-r--r--gnuradio-core/src/python/gnuradio/gruimpl/mathmisc.py33
-rw-r--r--gnuradio-core/src/python/gnuradio/gruimpl/msgq_runner.py82
-rw-r--r--gnuradio-core/src/python/gnuradio/gruimpl/os_read_exactly.py36
-rw-r--r--gnuradio-core/src/python/gnuradio/gruimpl/sdr_1000.py84
-rw-r--r--gnuradio-core/src/python/gnuradio/gruimpl/seq_with_cursor.py77
-rw-r--r--gnuradio-core/src/python/gnuradio/gruimpl/socket_stuff.py56
-rw-r--r--gnuradio-core/src/python/gnuradio/optfir.py341
-rw-r--r--gnuradio-core/src/python/gnuradio/window.py180
-rw-r--r--gnuradio-core/src/tests/CMakeLists.txt72
-rwxr-xr-xgnuradio-core/src/tests/benchmark_dotprod46
-rw-r--r--gnuradio-core/src/tests/benchmark_dotprod_ccc.cc151
-rw-r--r--gnuradio-core/src/tests/benchmark_dotprod_ccf.cc153
-rw-r--r--gnuradio-core/src/tests/benchmark_dotprod_fcc.cc152
-rw-r--r--gnuradio-core/src/tests/benchmark_dotprod_fff.cc148
-rw-r--r--gnuradio-core/src/tests/benchmark_dotprod_fsf.cc151
-rw-r--r--gnuradio-core/src/tests/benchmark_dotprod_scc.cc151
-rw-r--r--gnuradio-core/src/tests/benchmark_nco.cc220
-rw-r--r--gnuradio-core/src/tests/benchmark_vco.cc167
-rw-r--r--gnuradio-core/src/tests/nco_results48
-rw-r--r--gnuradio-core/src/tests/test_all.cc50
-rw-r--r--gnuradio-core/src/tests/test_atsc.cc42
-rwxr-xr-xgnuradio-core/src/tests/test_buffers.py136
-rw-r--r--gnuradio-core/src/tests/test_filter.cc42
-rw-r--r--gnuradio-core/src/tests/test_general.cc42
-rw-r--r--gnuradio-core/src/tests/test_runtime.cc42
-rw-r--r--gnuradio-core/src/tests/test_vmcircbuf.cc44
-rw-r--r--gnuradio-core/src/utils/cic_comp_taps.m45
-rw-r--r--gnuradio-core/src/utils/cool.m50
-rw-r--r--gnuradio-core/src/utils/db_width.m35
-rw-r--r--gnuradio-core/src/utils/filter_tools.m42
-rw-r--r--gnuradio-core/src/utils/is_complex.m24
-rw-r--r--gnuradio-core/src/utils/lp_to_bp.m27
-rw-r--r--gnuradio-core/src/utils/partition-cascaded-decimating-filters.scm67
-rw-r--r--gnuradio-core/src/utils/permute.scm27
-rw-r--r--gnuradio-core/src/utils/plot_cic_decimator_response.m44
-rw-r--r--gnuradio-core/src/utils/plot_freq_response.m36
-rw-r--r--gnuradio-core/src/utils/plot_freq_response_db.m39
-rw-r--r--gnuradio-core/src/utils/plot_freq_response_phase.m38
-rw-r--r--gnuradio-core/src/utils/plotfft.m40
-rw-r--r--gnuradio-core/src/utils/plotfftavgk.m61
-rw-r--r--gnuradio-core/src/utils/plotfftavgk_db.m73
-rw-r--r--gnuradio-core/src/utils/plotfftk.m41
-rw-r--r--gnuradio-core/src/utils/plotfftk_db.m43
-rw-r--r--gnuradio-core/src/utils/put_markers.m32
-rw-r--r--gnuradio-core/src/utils/rainbow.m53
-rw-r--r--gnuradio-core/src/utils/read_char_binary.m45
-rw-r--r--gnuradio-core/src/utils/read_complex_binary.m48
-rw-r--r--gnuradio-core/src/utils/read_cshort_binary.m46
-rw-r--r--gnuradio-core/src/utils/read_float_binary.m45
-rw-r--r--gnuradio-core/src/utils/read_int_binary.m46
-rw-r--r--gnuradio-core/src/utils/read_short_binary.m45
-rw-r--r--gnuradio-core/src/utils/read_xambi.m46
-rw-r--r--gnuradio-core/src/utils/runsum.m9
-rw-r--r--gnuradio-core/src/utils/single_pole_iir.m25
-rw-r--r--gnuradio-core/src/utils/split_vect.m15
-rw-r--r--gnuradio-core/src/utils/write_float_binary.m40
-rw-r--r--gnuradio-core/src/utils/write_short_binary.m40
-rw-r--r--gr-blocks/CMakeLists.txt105
-rw-r--r--gr-blocks/doc/CMakeLists.txt23
-rw-r--r--gr-blocks/doc/README.blocks12
-rw-r--r--gr-blocks/doc/blocks.dox23
-rw-r--r--gr-blocks/examples/CMakeLists.txt20
-rw-r--r--gr-blocks/examples/metadata/CMakeLists.txt30
-rw-r--r--gr-blocks/examples/metadata/file_metadata_sink.grc951
-rw-r--r--gr-blocks/examples/metadata/file_metadata_source.grc350
-rw-r--r--gr-blocks/examples/metadata/file_metadata_vector_sink.grc219
-rw-r--r--gr-blocks/examples/metadata/file_metadata_vector_source.grc338
-rw-r--r--gr-blocks/gnuradio-blocks.pc.in11
-rw-r--r--gr-blocks/grc/CMakeLists.txt22
-rw-r--r--gr-blocks/grc/blocks_add_const_vxx.xml67
-rw-r--r--gr-blocks/grc/blocks_add_xx.xml63
-rw-r--r--gr-blocks/grc/blocks_and_const_xx.xml48
-rw-r--r--gr-blocks/grc/blocks_and_xx.xml48
-rw-r--r--gr-blocks/grc/blocks_block_tree.xml111
-rw-r--r--gr-blocks/grc/blocks_char_to_float.xml35
-rw-r--r--gr-blocks/grc/blocks_char_to_short.xml28
-rw-r--r--gr-blocks/grc/blocks_complex_to_arg.xml29
-rw-r--r--gr-blocks/grc/blocks_complex_to_float.xml36
-rw-r--r--gr-blocks/grc/blocks_complex_to_imag.xml29
-rw-r--r--gr-blocks/grc/blocks_complex_to_interleaved_short.xml20
-rw-r--r--gr-blocks/grc/blocks_complex_to_mag.xml29
-rw-r--r--gr-blocks/grc/blocks_complex_to_mag_squared.xml29
-rw-r--r--gr-blocks/grc/blocks_complex_to_real.xml30
-rw-r--r--gr-blocks/grc/blocks_conjugate_cc.xml20
-rw-r--r--gr-blocks/grc/blocks_deinterleave.xml67
-rw-r--r--gr-blocks/grc/blocks_delay.xml75
-rw-r--r--gr-blocks/grc/blocks_divide_XX.xml63
-rw-r--r--gr-blocks/grc/blocks_file_meta_sink.xml124
-rw-r--r--gr-blocks/grc/blocks_file_meta_source.xml94
-rw-r--r--gr-blocks/grc/blocks_file_source.xml75
-rw-r--r--gr-blocks/grc/blocks_float_to_char.xml35
-rw-r--r--gr-blocks/grc/blocks_float_to_complex.xml36
-rw-r--r--gr-blocks/grc/blocks_float_to_int.xml35
-rw-r--r--gr-blocks/grc/blocks_float_to_short.xml35
-rw-r--r--gr-blocks/grc/blocks_float_uchar.xml20
-rw-r--r--gr-blocks/grc/blocks_int_to_float.xml35
-rw-r--r--gr-blocks/grc/blocks_integrate_xx.xml50
-rw-r--r--gr-blocks/grc/blocks_interleave.xml67
-rw-r--r--gr-blocks/grc/blocks_interleaved_short_to_complex.xml20
-rw-r--r--gr-blocks/grc/blocks_keep_m_in_n.xml76
-rw-r--r--gr-blocks/grc/blocks_keep_one_in_n.xml67
-rw-r--r--gr-blocks/grc/blocks_multiply_conjugate_cc.xml35
-rw-r--r--gr-blocks/grc/blocks_multiply_const_vxx.xml67
-rw-r--r--gr-blocks/grc/blocks_multiply_xx.xml63
-rw-r--r--gr-blocks/grc/blocks_nlog10_ff.xml42
-rw-r--r--gr-blocks/grc/blocks_not_xx.xml40
-rw-r--r--gr-blocks/grc/blocks_or_xx.xml48
-rw-r--r--gr-blocks/grc/blocks_packed_to_unpacked_xx.xml68
-rw-r--r--gr-blocks/grc/blocks_patterned_interleaver.xml66
-rw-r--r--gr-blocks/grc/blocks_peak_detector2_fb.xml41
-rw-r--r--gr-blocks/grc/blocks_regenerate_bb.xml32
-rw-r--r--gr-blocks/grc/blocks_repeat.xml64
-rw-r--r--gr-blocks/grc/blocks_rms_xx.xml42
-rw-r--r--gr-blocks/grc/blocks_short_to_char.xml28
-rw-r--r--gr-blocks/grc/blocks_short_to_float.xml35
-rw-r--r--gr-blocks/grc/blocks_stream_mux.xml75
-rw-r--r--gr-blocks/grc/blocks_stream_to_streams.xml67
-rw-r--r--gr-blocks/grc/blocks_stream_to_vector.xml66
-rw-r--r--gr-blocks/grc/blocks_streams_to_stream.xml67
-rw-r--r--gr-blocks/grc/blocks_streams_to_vector.xml67
-rw-r--r--gr-blocks/grc/blocks_stretch_ff.xml34
-rw-r--r--gr-blocks/grc/blocks_sub_xx.xml63
-rw-r--r--gr-blocks/grc/blocks_threshold_ff.xml40
-rw-r--r--gr-blocks/grc/blocks_throttle.xml67
-rw-r--r--gr-blocks/grc/blocks_transcendental.xml41
-rw-r--r--gr-blocks/grc/blocks_uchar_to_float.xml20
-rw-r--r--gr-blocks/grc/blocks_unpacked_to_packed_xx.xml68
-rw-r--r--gr-blocks/grc/blocks_vector_to_stream.xml66
-rw-r--r--gr-blocks/grc/blocks_vector_to_streams.xml67
-rw-r--r--gr-blocks/grc/blocks_xor_xx.xml48
-rw-r--r--gr-blocks/include/blocks/CMakeLists.txt150
-rw-r--r--gr-blocks/include/blocks/add_XX.h.t53
-rw-r--r--gr-blocks/include/blocks/add_const_XX.h.t65
-rw-r--r--gr-blocks/include/blocks/add_const_vXX.h.t66
-rw-r--r--gr-blocks/include/blocks/add_ff.h50
-rw-r--r--gr-blocks/include/blocks/and_XX.h.t53
-rw-r--r--gr-blocks/include/blocks/and_const_XX.h.t68
-rw-r--r--gr-blocks/include/blocks/api.h33
-rw-r--r--gr-blocks/include/blocks/char_to_float.h62
-rw-r--r--gr-blocks/include/blocks/char_to_short.h51
-rw-r--r--gr-blocks/include/blocks/complex_to_arg.h50
-rw-r--r--gr-blocks/include/blocks/complex_to_float.h50
-rw-r--r--gr-blocks/include/blocks/complex_to_imag.h50
-rw-r--r--gr-blocks/include/blocks/complex_to_interleaved_short.h49
-rw-r--r--gr-blocks/include/blocks/complex_to_mag.h50
-rw-r--r--gr-blocks/include/blocks/complex_to_mag_squared.h50
-rw-r--r--gr-blocks/include/blocks/complex_to_real.h50
-rw-r--r--gr-blocks/include/blocks/conjugate_cc.h49
-rw-r--r--gr-blocks/include/blocks/count_bits.h46
-rw-r--r--gr-blocks/include/blocks/deinterleave.h50
-rw-r--r--gr-blocks/include/blocks/delay.h57
-rw-r--r--gr-blocks/include/blocks/divide_XX.h.t53
-rw-r--r--gr-blocks/include/blocks/file_meta_sink.h111
-rw-r--r--gr-blocks/include/blocks/file_meta_source.h81
-rw-r--r--gr-blocks/include/blocks/file_source.h85
-rw-r--r--gr-blocks/include/blocks/float_to_char.h62
-rw-r--r--gr-blocks/include/blocks/float_to_complex.h50
-rw-r--r--gr-blocks/include/blocks/float_to_int.h62
-rw-r--r--gr-blocks/include/blocks/float_to_short.h62
-rw-r--r--gr-blocks/include/blocks/float_to_uchar.h49
-rw-r--r--gr-blocks/include/blocks/int_to_float.h62
-rw-r--r--gr-blocks/include/blocks/integrate_XX.h.t51
-rw-r--r--gr-blocks/include/blocks/interleave.h50
-rw-r--r--gr-blocks/include/blocks/interleaved_short_to_complex.h49
-rw-r--r--gr-blocks/include/blocks/keep_m_in_n.h53
-rw-r--r--gr-blocks/include/blocks/keep_one_in_n.h51
-rw-r--r--gr-blocks/include/blocks/log2_const.h53
-rw-r--r--gr-blocks/include/blocks/multiply_XX.h.t53
-rw-r--r--gr-blocks/include/blocks/multiply_cc.h50
-rw-r--r--gr-blocks/include/blocks/multiply_conjugate_cc.h50
-rw-r--r--gr-blocks/include/blocks/multiply_const_XX.h.t66
-rw-r--r--gr-blocks/include/blocks/multiply_const_cc.h67
-rw-r--r--gr-blocks/include/blocks/multiply_const_ff.h67
-rw-r--r--gr-blocks/include/blocks/multiply_const_vXX.h.t66
-rw-r--r--gr-blocks/include/blocks/multiply_ff.h50
-rw-r--r--gr-blocks/include/blocks/nlog10_ff.h55
-rw-r--r--gr-blocks/include/blocks/not_XX.h.t53
-rw-r--r--gr-blocks/include/blocks/or_XX.h.t53
-rw-r--r--gr-blocks/include/blocks/packed_to_unpacked_XX.h.t73
-rw-r--r--gr-blocks/include/blocks/patterned_interleaver.h23
-rw-r--r--gr-blocks/include/blocks/peak_detector2_fb.h91
-rw-r--r--gr-blocks/include/blocks/regenerate_bb.h80
-rw-r--r--gr-blocks/include/blocks/repeat.h51
-rw-r--r--gr-blocks/include/blocks/rms_cf.h54
-rw-r--r--gr-blocks/include/blocks/rms_ff.h53
-rw-r--r--gr-blocks/include/blocks/short_to_char.h51
-rw-r--r--gr-blocks/include/blocks/short_to_float.h62
-rw-r--r--gr-blocks/include/blocks/stream_mux.h69
-rw-r--r--gr-blocks/include/blocks/stream_to_streams.h52
-rw-r--r--gr-blocks/include/blocks/stream_to_vector.h49
-rw-r--r--gr-blocks/include/blocks/streams_to_stream.h52
-rw-r--r--gr-blocks/include/blocks/streams_to_vector.h49
-rw-r--r--gr-blocks/include/blocks/stretch_ff.h59
-rw-r--r--gr-blocks/include/blocks/sub_XX.h.t53
-rw-r--r--gr-blocks/include/blocks/threshold_ff.h66
-rw-r--r--gr-blocks/include/blocks/throttle.h62
-rw-r--r--gr-blocks/include/blocks/transcendental.h56
-rw-r--r--gr-blocks/include/blocks/uchar_to_float.h49
-rw-r--r--gr-blocks/include/blocks/unpacked_to_packed_XX.h.t72
-rw-r--r--gr-blocks/include/blocks/vector_to_stream.h49
-rw-r--r--gr-blocks/include/blocks/vector_to_streams.h49
-rw-r--r--gr-blocks/include/blocks/xor_XX.h.t53
-rw-r--r--gr-blocks/lib/CMakeLists.txt201
-rw-r--r--gr-blocks/lib/ConfigChecks.cmake91
-rw-r--r--gr-blocks/lib/add_XX_impl.cc.t69
-rw-r--r--gr-blocks/lib/add_XX_impl.h.t48
-rw-r--r--gr-blocks/lib/add_const_XX_impl.cc.t77
-rw-r--r--gr-blocks/lib/add_const_XX_impl.h.t51
-rw-r--r--gr-blocks/lib/add_const_vXX_impl.cc.t66
-rw-r--r--gr-blocks/lib/add_const_vXX_impl.h.t51
-rw-r--r--gr-blocks/lib/add_ff_impl.cc71
-rw-r--r--gr-blocks/lib/add_ff_impl.h47
-rw-r--r--gr-blocks/lib/and_XX_impl.cc.t69
-rw-r--r--gr-blocks/lib/and_XX_impl.h.t48
-rw-r--r--gr-blocks/lib/and_const_XX_impl.cc.t77
-rw-r--r--gr-blocks/lib/and_const_XX_impl.h.t51
-rw-r--r--gr-blocks/lib/char_to_float_impl.cc65
-rw-r--r--gr-blocks/lib/char_to_float_impl.h51
-rw-r--r--gr-blocks/lib/char_to_short_impl.cc69
-rw-r--r--gr-blocks/lib/char_to_short_impl.h47
-rw-r--r--gr-blocks/lib/complex_to_arg_impl.cc70
-rw-r--r--gr-blocks/lib/complex_to_arg_impl.h47
-rw-r--r--gr-blocks/lib/complex_to_float_impl.cc94
-rw-r--r--gr-blocks/lib/complex_to_float_impl.h47
-rw-r--r--gr-blocks/lib/complex_to_imag_impl.cc72
-rw-r--r--gr-blocks/lib/complex_to_imag_impl.h47
-rw-r--r--gr-blocks/lib/complex_to_interleaved_short_impl.cc63
-rw-r--r--gr-blocks/lib/complex_to_interleaved_short_impl.h45
-rw-r--r--gr-blocks/lib/complex_to_mag_impl.cc66
-rw-r--r--gr-blocks/lib/complex_to_mag_impl.h47
-rw-r--r--gr-blocks/lib/complex_to_mag_squared_impl.cc70
-rw-r--r--gr-blocks/lib/complex_to_mag_squared_impl.h47
-rw-r--r--gr-blocks/lib/complex_to_real_impl.cc72
-rw-r--r--gr-blocks/lib/complex_to_real_impl.h47
-rw-r--r--gr-blocks/lib/conjugate_cc_impl.cc68
-rw-r--r--gr-blocks/lib/conjugate_cc_impl.h44
-rw-r--r--gr-blocks/lib/count_bits.cc78
-rw-r--r--gr-blocks/lib/deinterleave_impl.cc76
-rw-r--r--gr-blocks/lib/deinterleave_impl.h49
-rw-r--r--gr-blocks/lib/delay_impl.cc141
-rw-r--r--gr-blocks/lib/delay_impl.h58
-rw-r--r--gr-blocks/lib/divide_XX_impl.cc.t69
-rw-r--r--gr-blocks/lib/divide_XX_impl.h.t48
-rw-r--r--gr-blocks/lib/file_meta_sink_impl.cc467
-rw-r--r--gr-blocks/lib/file_meta_sink_impl.h96
-rw-r--r--gr-blocks/lib/file_meta_source_impl.cc444
-rw-r--r--gr-blocks/lib/file_meta_source_impl.h89
-rw-r--r--gr-blocks/lib/file_source_impl.cc189
-rw-r--r--gr-blocks/lib/file_source_impl.h60
-rw-r--r--gr-blocks/lib/float_array_to_int.cc46
-rw-r--r--gr-blocks/lib/float_array_to_int.h33
-rw-r--r--gr-blocks/lib/float_array_to_uchar.cc45
-rw-r--r--gr-blocks/lib/float_array_to_uchar.h33
-rw-r--r--gr-blocks/lib/float_to_char_impl.cc69
-rw-r--r--gr-blocks/lib/float_to_char_impl.h51
-rw-r--r--gr-blocks/lib/float_to_complex_impl.cc78
-rw-r--r--gr-blocks/lib/float_to_complex_impl.h47
-rw-r--r--gr-blocks/lib/float_to_int_impl.cc83
-rw-r--r--gr-blocks/lib/float_to_int_impl.h51
-rw-r--r--gr-blocks/lib/float_to_short_impl.cc69
-rw-r--r--gr-blocks/lib/float_to_short_impl.h51
-rw-r--r--gr-blocks/lib/float_to_uchar_impl.cc60
-rw-r--r--gr-blocks/lib/float_to_uchar_impl.h45
-rw-r--r--gr-blocks/lib/int_to_float_impl.cc68
-rw-r--r--gr-blocks/lib/int_to_float_impl.h51
-rw-r--r--gr-blocks/lib/integrate_XX_impl.cc.t68
-rw-r--r--gr-blocks/lib/integrate_XX_impl.h.t49
-rw-r--r--gr-blocks/lib/interleave_impl.cc76
-rw-r--r--gr-blocks/lib/interleave_impl.h49
-rw-r--r--gr-blocks/lib/interleaved_short_array_to_complex.cc39
-rw-r--r--gr-blocks/lib/interleaved_short_array_to_complex.h36
-rw-r--r--gr-blocks/lib/interleaved_short_to_complex_impl.cc61
-rw-r--r--gr-blocks/lib/interleaved_short_to_complex_impl.h45
-rw-r--r--gr-blocks/lib/keep_m_in_n_impl.cc87
-rw-r--r--gr-blocks/lib/keep_m_in_n_impl.h58
-rw-r--r--gr-blocks/lib/keep_one_in_n_impl.cc109
-rw-r--r--gr-blocks/lib/keep_one_in_n_impl.h53
-rw-r--r--gr-blocks/lib/multiply_XX_impl.cc.t69
-rw-r--r--gr-blocks/lib/multiply_XX_impl.h.t47
-rw-r--r--gr-blocks/lib/multiply_cc_impl.cc71
-rw-r--r--gr-blocks/lib/multiply_cc_impl.h47
-rw-r--r--gr-blocks/lib/multiply_conjugate_cc_impl.cc71
-rw-r--r--gr-blocks/lib/multiply_conjugate_cc_impl.h47
-rw-r--r--gr-blocks/lib/multiply_const_XX_impl.cc.t77
-rw-r--r--gr-blocks/lib/multiply_const_XX_impl.h.t51
-rw-r--r--gr-blocks/lib/multiply_const_cc_impl.cc72
-rw-r--r--gr-blocks/lib/multiply_const_cc_impl.h52
-rw-r--r--gr-blocks/lib/multiply_const_ff_impl.cc72
-rw-r--r--gr-blocks/lib/multiply_const_ff_impl.h52
-rw-r--r--gr-blocks/lib/multiply_const_vXX_impl.cc.t66
-rw-r--r--gr-blocks/lib/multiply_const_vXX_impl.h.t51
-rw-r--r--gr-blocks/lib/multiply_ff_impl.cc71
-rw-r--r--gr-blocks/lib/multiply_ff_impl.h47
-rw-r--r--gr-blocks/lib/nlog10_ff_impl.cc64
-rw-r--r--gr-blocks/lib/nlog10_ff_impl.h49
-rw-r--r--gr-blocks/lib/not_XX_impl.cc.t65
-rw-r--r--gr-blocks/lib/not_XX_impl.h.t48
-rw-r--r--gr-blocks/lib/or_XX_impl.cc.t69
-rw-r--r--gr-blocks/lib/or_XX_impl.h.t48
-rw-r--r--gr-blocks/lib/packed_to_unpacked_XX_impl.cc.t147
-rw-r--r--gr-blocks/lib/packed_to_unpacked_XX_impl.h.t59
-rw-r--r--gr-blocks/lib/patterned_interleaver_impl.cc87
-rw-r--r--gr-blocks/lib/patterned_interleaver_impl.h61
-rw-r--r--gr-blocks/lib/peak_detector2_fb_impl.cc118
-rw-r--r--gr-blocks/lib/peak_detector2_fb_impl.h64
-rw-r--r--gr-blocks/lib/regenerate_bb_impl.cc103
-rw-r--r--gr-blocks/lib/regenerate_bb_impl.h57
-rw-r--r--gr-blocks/lib/repeat_impl.cc69
-rw-r--r--gr-blocks/lib/repeat_impl.h47
-rw-r--r--gr-blocks/lib/rms_cf_impl.cc77
-rw-r--r--gr-blocks/lib/rms_cf_impl.h56
-rw-r--r--gr-blocks/lib/rms_ff_impl.cc77
-rw-r--r--gr-blocks/lib/rms_ff_impl.h55
-rw-r--r--gr-blocks/lib/short_to_char_impl.cc69
-rw-r--r--gr-blocks/lib/short_to_char_impl.h47
-rw-r--r--gr-blocks/lib/short_to_float_impl.cc68
-rw-r--r--gr-blocks/lib/short_to_float_impl.h51
-rw-r--r--gr-blocks/lib/stream_mux_impl.cc126
-rw-r--r--gr-blocks/lib/stream_mux_impl.h55
-rw-r--r--gr-blocks/lib/stream_to_streams_impl.cc70
-rw-r--r--gr-blocks/lib/stream_to_streams_impl.h44
-rw-r--r--gr-blocks/lib/stream_to_vector_impl.cc62
-rw-r--r--gr-blocks/lib/stream_to_vector_impl.h44
-rw-r--r--gr-blocks/lib/streams_to_stream_impl.cc72
-rw-r--r--gr-blocks/lib/streams_to_stream_impl.h44
-rw-r--r--gr-blocks/lib/streams_to_vector_impl.cc68
-rw-r--r--gr-blocks/lib/streams_to_vector_impl.h44
-rw-r--r--gr-blocks/lib/stretch_ff_impl.cc84
-rw-r--r--gr-blocks/lib/stretch_ff_impl.h53
-rw-r--r--gr-blocks/lib/sub_XX_impl.cc.t69
-rw-r--r--gr-blocks/lib/sub_XX_impl.h.t48
-rw-r--r--gr-blocks/lib/threshold_ff_impl.cc78
-rw-r--r--gr-blocks/lib/threshold_ff_impl.h57
-rw-r--r--gr-blocks/lib/throttle_impl.cc97
-rw-r--r--gr-blocks/lib/throttle_impl.h55
-rw-r--r--gr-blocks/lib/transcendental_impl.cc150
-rw-r--r--gr-blocks/lib/transcendental_impl.h51
-rw-r--r--gr-blocks/lib/uchar_array_to_float.cc40
-rw-r--r--gr-blocks/lib/uchar_array_to_float.h34
-rw-r--r--gr-blocks/lib/uchar_to_float_impl.cc60
-rw-r--r--gr-blocks/lib/uchar_to_float_impl.h45
-rw-r--r--gr-blocks/lib/unpacked_to_packed_XX_impl.cc.t143
-rw-r--r--gr-blocks/lib/unpacked_to_packed_XX_impl.h.t59
-rw-r--r--gr-blocks/lib/vector_to_stream_impl.cc62
-rw-r--r--gr-blocks/lib/vector_to_stream_impl.h44
-rw-r--r--gr-blocks/lib/vector_to_streams_impl.cc68
-rw-r--r--gr-blocks/lib/vector_to_streams_impl.h44
-rw-r--r--gr-blocks/lib/xor_XX_impl.cc.t69
-rw-r--r--gr-blocks/lib/xor_XX_impl.h.t48
-rw-r--r--gr-blocks/python/CMakeLists.txt48
-rw-r--r--gr-blocks/python/__init__.py37
-rw-r--r--gr-blocks/python/parse_file_metadata.py193
-rwxr-xr-xgr-blocks/python/qa_add_mult_div_sub.py212
-rwxr-xr-xgr-blocks/python/qa_add_mult_v.py360
-rwxr-xr-xgr-blocks/python/qa_boolean_operators.py195
-rw-r--r--gr-blocks/python/qa_conjugate.py54
-rwxr-xr-xgr-blocks/python/qa_delay.py65
-rw-r--r--gr-blocks/python/qa_file_metadata.py202
-rwxr-xr-xgr-blocks/python/qa_integrate.py76
-rwxr-xr-xgr-blocks/python/qa_interleave.py82
-rwxr-xr-xgr-blocks/python/qa_keep_m_in_n.py59
-rwxr-xr-xgr-blocks/python/qa_keep_one_in_n.py46
-rw-r--r--gr-blocks/python/qa_multiply_conjugate.py58
-rwxr-xr-xgr-blocks/python/qa_nlog10.py48
-rwxr-xr-xgr-blocks/python/qa_packed_to_unpacked.py344
-rwxr-xr-xgr-blocks/python/qa_patterned_interleaver.py56
-rw-r--r--gr-blocks/python/qa_peak_detector2.py58
-rwxr-xr-xgr-blocks/python/qa_pipe_fittings.py138
-rwxr-xr-xgr-blocks/python/qa_regenerate.py90
-rwxr-xr-xgr-blocks/python/qa_repeat.py49
-rw-r--r--gr-blocks/python/qa_rms.py83
-rwxr-xr-xgr-blocks/python/qa_stream_mux.py169
-rwxr-xr-xgr-blocks/python/qa_stretch.py67
-rw-r--r--gr-blocks/python/qa_threshold.py54
-rwxr-xr-xgr-blocks/python/qa_throttle.py39
-rw-r--r--gr-blocks/python/qa_transcendental.py90
-rwxr-xr-xgr-blocks/python/qa_type_conversions.py316
-rw-r--r--gr-blocks/swig/CMakeLists.txt53
-rw-r--r--gr-blocks/swig/blocks_swig.i347
-rw-r--r--gr-comedi/CMakeLists.txt104
-rw-r--r--gr-comedi/README3
-rw-r--r--gr-comedi/gnuradio-comedi.pc.in11
-rw-r--r--gr-comedi/src/CMakeLists.txt117
-rw-r--r--gr-comedi/src/comedi.i74
-rw-r--r--gr-comedi/src/comedi_sink_s.cc233
-rw-r--r--gr-comedi/src/comedi_sink_s.h89
-rw-r--r--gr-comedi/src/comedi_source_s.cc229
-rw-r--r--gr-comedi/src/comedi_source_s.h90
-rw-r--r--gr-comedi/src/gri_comedi.cc30
-rw-r--r--gr-comedi/src/gri_comedi.h28
-rwxr-xr-xgr-comedi/src/qa_comedi.py40
-rw-r--r--gr-fft/CMakeLists.txt111
-rw-r--r--gr-fft/doc/CMakeLists.txt23
-rw-r--r--gr-fft/doc/README.fft13
-rw-r--r--gr-fft/doc/fft.dox29
-rw-r--r--gr-fft/gnuradio-fft.pc.in11
-rw-r--r--gr-fft/grc/CMakeLists.txt26
-rw-r--r--gr-fft/grc/fft_block_tree.xml36
-rw-r--r--gr-fft/grc/fft_vxx.xml88
-rw-r--r--gr-fft/grc/goertzel_fc.xml37
-rw-r--r--gr-fft/include/fft/CMakeLists.txt33
-rw-r--r--gr-fft/include/fft/api.h33
-rw-r--r--gr-fft/include/fft/fft.h195
-rw-r--r--gr-fft/include/fft/fft_vcc.h57
-rw-r--r--gr-fft/include/fft/fft_vfc.h57
-rw-r--r--gr-fft/include/fft/goertzel.h64
-rw-r--r--gr-fft/include/fft/goertzel_fc.h57
-rw-r--r--gr-fft/lib/CMakeLists.txt60
-rw-r--r--gr-fft/lib/fft.cc338
-rw-r--r--gr-fft/lib/fft_vcc_fftw.cc147
-rw-r--r--gr-fft/lib/fft_vcc_fftw.h60
-rw-r--r--gr-fft/lib/fft_vfc_fftw.cc124
-rw-r--r--gr-fft/lib/fft_vfc_fftw.h59
-rw-r--r--gr-fft/lib/goertzel.cc84
-rw-r--r--gr-fft/lib/goertzel_fc_impl.cc85
-rw-r--r--gr-fft/lib/goertzel_fc_impl.h60
-rw-r--r--gr-fft/python/CMakeLists.txt47
-rw-r--r--gr-fft/python/__init__.py28
-rwxr-xr-xgr-fft/python/qa_fft.py213
-rwxr-xr-xgr-fft/python/qa_goertzel.py65
-rw-r--r--gr-fft/swig/CMakeLists.txt53
-rw-r--r--gr-fft/swig/fft_swig.i42
-rw-r--r--gr-filter/CMakeLists.txt113
-rw-r--r--gr-filter/doc/CMakeLists.txt23
-rw-r--r--gr-filter/doc/README.filter13
-rw-r--r--gr-filter/doc/filter.dox27
-rw-r--r--gr-filter/examples/CMakeLists.txt45
-rwxr-xr-xgr-filter/examples/channelize.py195
-rwxr-xr-xgr-filter/examples/chirp_channelize.py205
-rwxr-xr-xgr-filter/examples/decimate.py181
-rwxr-xr-xgr-filter/examples/fft_filter_ccc.py98
-rwxr-xr-xgr-filter/examples/fir_filter_ccc.py92
-rwxr-xr-xgr-filter/examples/fir_filter_fff.py92
-rwxr-xr-xgr-filter/examples/fmtest.py226
-rwxr-xr-xgr-filter/examples/interpolate.py240
-rwxr-xr-xgr-filter/examples/reconstruction.py164
-rwxr-xr-xgr-filter/examples/resampler.py128
-rw-r--r--gr-filter/examples/resampler_demo.grc630
-rwxr-xr-xgr-filter/examples/synth_filter.py85
-rwxr-xr-xgr-filter/examples/synth_to_chan.py118
-rw-r--r--gr-filter/gnuradio-filter.pc.in11
-rw-r--r--gr-filter/grc/CMakeLists.txt41
-rw-r--r--gr-filter/grc/channel_model.xml61
-rw-r--r--gr-filter/grc/dc_blocker_xx.xml51
-rw-r--r--gr-filter/grc/fft_filter_xxx.xml59
-rw-r--r--gr-filter/grc/filter_block_tree.xml51
-rw-r--r--gr-filter/grc/filter_delay_fc.xml31
-rw-r--r--gr-filter/grc/fir_filter_xxx.xml80
-rw-r--r--gr-filter/grc/fractional_interpolator_xx.xml46
-rw-r--r--gr-filter/grc/freq_xlating_fir_filter_xxx.xml93
-rw-r--r--gr-filter/grc/hilbert_fc.xml26
-rw-r--r--gr-filter/grc/iir_filter_ffd.xml31
-rw-r--r--gr-filter/grc/interp_fir_filter_xxx.xml80
-rw-r--r--gr-filter/grc/pfb_arb_resampler.xml65
-rw-r--r--gr-filter/grc/pfb_channelizer.xml62
-rw-r--r--gr-filter/grc/pfb_decimator.xml43
-rw-r--r--gr-filter/grc/pfb_interpolator.xml36
-rw-r--r--gr-filter/grc/pfb_synthesizer.xml57
-rw-r--r--gr-filter/grc/rational_resampler_base_xxx.xml86
-rw-r--r--gr-filter/grc/single_pole_iir_filter_xx.xml51
-rw-r--r--gr-filter/include/filter/CMakeLists.txt116
-rw-r--r--gr-filter/include/filter/adaptive_fir_ccc.h85
-rw-r--r--gr-filter/include/filter/adaptive_fir_ccf.h81
-rw-r--r--gr-filter/include/filter/api.h33
-rw-r--r--gr-filter/include/filter/channel_model.h87
-rw-r--r--gr-filter/include/filter/dc_blocker_cc.h76
-rw-r--r--gr-filter/include/filter/dc_blocker_ff.h76
-rw-r--r--gr-filter/include/filter/fft_filter.h171
-rw-r--r--gr-filter/include/filter/fft_filter_ccc.h86
-rw-r--r--gr-filter/include/filter/fft_filter_fff.h86
-rw-r--r--gr-filter/include/filter/filter_delay_fc.h65
-rw-r--r--gr-filter/include/filter/fir_filter.h222
-rw-r--r--gr-filter/include/filter/fir_filter_XXX.h.t82
-rw-r--r--gr-filter/include/filter/fir_filter_with_buffer.h326
-rw-r--r--gr-filter/include/filter/firdes.h378
-rw-r--r--gr-filter/include/filter/fractional_interpolator_cc.h60
-rw-r--r--gr-filter/include/filter/fractional_interpolator_ff.h60
-rw-r--r--gr-filter/include/filter/freq_xlating_fir_filter_XXX.h.t90
-rw-r--r--gr-filter/include/filter/hilbert_fc.h53
-rw-r--r--gr-filter/include/filter/iir_filter.h183
-rw-r--r--gr-filter/include/filter/iir_filter_ffd.h82
-rw-r--r--gr-filter/include/filter/interp_fir_filter_XXX.h.t81
-rw-r--r--gr-filter/include/filter/interpolator_taps.h140
-rw-r--r--gr-filter/include/filter/mmse_fir_interpolator_cc.h79
-rw-r--r--gr-filter/include/filter/mmse_fir_interpolator_ff.h76
-rw-r--r--gr-filter/include/filter/pfb_arb_resampler_ccf.h151
-rw-r--r--gr-filter/include/filter/pfb_arb_resampler_fff.h152
-rw-r--r--gr-filter/include/filter/pfb_channelizer_ccf.h204
-rw-r--r--gr-filter/include/filter/pfb_decimator_ccf.h131
-rw-r--r--gr-filter/include/filter/pfb_interpolator_ccf.h118
-rw-r--r--gr-filter/include/filter/pfb_synthesizer_ccf.h107
-rw-r--r--gr-filter/include/filter/pm_remez.h72
-rw-r--r--gr-filter/include/filter/polyphase_filterbank.h148
-rw-r--r--gr-filter/include/filter/rational_resampler_base_XXX.h.t61
-rw-r--r--gr-filter/include/filter/single_pole_iir.h200
-rw-r--r--gr-filter/include/filter/single_pole_iir_filter_cc.h78
-rw-r--r--gr-filter/include/filter/single_pole_iir_filter_ff.h78
-rw-r--r--gr-filter/lib/CMakeLists.txt184
-rw-r--r--gr-filter/lib/adaptive_fir_ccc_impl.cc106
-rw-r--r--gr-filter/lib/adaptive_fir_ccc_impl.h61
-rw-r--r--gr-filter/lib/adaptive_fir_ccf_impl.cc106
-rw-r--r--gr-filter/lib/adaptive_fir_ccf_impl.h61
-rw-r--r--gr-filter/lib/channel_model_impl.cc135
-rw-r--r--gr-filter/lib/channel_model_impl.h74
-rw-r--r--gr-filter/lib/dc_blocker_cc_impl.cc144
-rw-r--r--gr-filter/lib/dc_blocker_cc_impl.h76
-rw-r--r--gr-filter/lib/dc_blocker_ff_impl.cc142
-rw-r--r--gr-filter/lib/dc_blocker_ff_impl.h76
-rw-r--r--gr-filter/lib/fft_filter.cc316
-rw-r--r--gr-filter/lib/fft_filter_ccc_impl.cc118
-rw-r--r--gr-filter/lib/fft_filter_ccc_impl.h61
-rw-r--r--gr-filter/lib/fft_filter_fff_impl.cc119
-rw-r--r--gr-filter/lib/fft_filter_fff_impl.h61
-rw-r--r--gr-filter/lib/filter_delay_fc_impl.cc112
-rw-r--r--gr-filter/lib/filter_delay_fc_impl.h56
-rw-r--r--gr-filter/lib/fir_filter.cc667
-rw-r--r--gr-filter/lib/fir_filter_XXX_impl.cc.t107
-rw-r--r--gr-filter/lib/fir_filter_XXX_impl.h.t56
-rw-r--r--gr-filter/lib/fir_filter_with_buffer.cc496
-rw-r--r--gr-filter/lib/firdes.cc855
-rw-r--r--gr-filter/lib/fractional_interpolator_cc_impl.cc125
-rw-r--r--gr-filter/lib/fractional_interpolator_cc_impl.h61
-rw-r--r--gr-filter/lib/fractional_interpolator_ff_impl.cc125
-rw-r--r--gr-filter/lib/fractional_interpolator_ff_impl.h61
-rw-r--r--gr-filter/lib/freq_xlating_fir_filter_XXX_impl.cc.t143
-rw-r--r--gr-filter/lib/freq_xlating_fir_filter_XXX_impl.h.t71
-rw-r--r--gr-filter/lib/hilbert_fc_impl.cc76
-rw-r--r--gr-filter/lib/hilbert_fc_impl.h52
-rw-r--r--gr-filter/lib/iir_filter_ffd_impl.cc85
-rw-r--r--gr-filter/lib/iir_filter_ffd_impl.h56
-rw-r--r--gr-filter/lib/interp_fir_filter_XXX_impl.cc.t155
-rw-r--r--gr-filter/lib/interp_fir_filter_XXX_impl.h.t62
-rw-r--r--gr-filter/lib/mmse_fir_interpolator_cc.cc77
-rw-r--r--gr-filter/lib/mmse_fir_interpolator_ff.cc77
-rw-r--r--gr-filter/lib/pfb_arb_resampler_ccf_impl.cc258
-rw-r--r--gr-filter/lib/pfb_arb_resampler_ccf_impl.h89
-rw-r--r--gr-filter/lib/pfb_arb_resampler_fff_impl.cc258
-rw-r--r--gr-filter/lib/pfb_arb_resampler_fff_impl.h88
-rw-r--r--gr-filter/lib/pfb_channelizer_ccf_impl.cc191
-rw-r--r--gr-filter/lib/pfb_channelizer_ccf_impl.h69
-rw-r--r--gr-filter/lib/pfb_decimator_ccf_impl.cc137
-rw-r--r--gr-filter/lib/pfb_decimator_ccf_impl.h65
-rw-r--r--gr-filter/lib/pfb_interpolator_ccf_impl.cc107
-rw-r--r--gr-filter/lib/pfb_interpolator_ccf_impl.h61
-rw-r--r--gr-filter/lib/pfb_synthesizer_ccf_impl.cc289
-rw-r--r--gr-filter/lib/pfb_synthesizer_ccf_impl.h85
-rw-r--r--gr-filter/lib/pm_remez.cc834
-rw-r--r--gr-filter/lib/polyphase_filterbank.cc114
-rw-r--r--gr-filter/lib/qa_filter.cc47
-rw-r--r--gr-filter/lib/qa_filter.h38
-rw-r--r--gr-filter/lib/qa_fir_filter_with_buffer.cc406
-rw-r--r--gr-filter/lib/qa_fir_filter_with_buffer.h94
-rw-r--r--gr-filter/lib/qa_firdes.cc621
-rw-r--r--gr-filter/lib/qa_firdes.h56
-rw-r--r--gr-filter/lib/qa_mmse_fir_interpolator_cc.cc126
-rw-r--r--gr-filter/lib/qa_mmse_fir_interpolator_cc.h48
-rw-r--r--gr-filter/lib/qa_mmse_fir_interpolator_ff.cc71
-rw-r--r--gr-filter/lib/qa_mmse_fir_interpolator_ff.h45
-rw-r--r--gr-filter/lib/rational_resampler_base_XXX_impl.cc.t174
-rw-r--r--gr-filter/lib/rational_resampler_base_XXX_impl.h.t72
-rw-r--r--gr-filter/lib/single_pole_iir_filter_cc_impl.cc89
-rw-r--r--gr-filter/lib/single_pole_iir_filter_cc_impl.h55
-rw-r--r--gr-filter/lib/single_pole_iir_filter_ff_impl.cc87
-rw-r--r--gr-filter/lib/single_pole_iir_filter_ff_impl.h54
-rw-r--r--gr-filter/lib/test_gr_filter.cc43
-rw-r--r--gr-filter/python/CMakeLists.txt50
-rw-r--r--gr-filter/python/__init__.py30
-rw-r--r--gr-filter/python/optfir.py339
-rw-r--r--gr-filter/python/pfb.py271
-rwxr-xr-xgr-filter/python/qa_adaptive_fir_filter.py159
-rwxr-xr-xgr-filter/python/qa_channel_model.py60
-rwxr-xr-xgr-filter/python/qa_dc_blocker.py109
-rwxr-xr-xgr-filter/python/qa_fft_filter.py380
-rwxr-xr-xgr-filter/python/qa_filter_delay_fc.py318
-rwxr-xr-xgr-filter/python/qa_fir_filter.py318
-rwxr-xr-xgr-filter/python/qa_firdes.py202
-rwxr-xr-xgr-filter/python/qa_fractional_interpolator.py89
-rwxr-xr-xgr-filter/python/qa_freq_xlating_fir_filter.py445
-rwxr-xr-xgr-filter/python/qa_hilbert.py117
-rwxr-xr-xgr-filter/python/qa_iir_filter.py157
-rwxr-xr-xgr-filter/python/qa_interp_fir_filter.py60
-rwxr-xr-xgr-filter/python/qa_pfb_arb_resampler.py95
-rwxr-xr-xgr-filter/python/qa_pfb_channelizer.py104
-rwxr-xr-xgr-filter/python/qa_pfb_decimator.py125
-rwxr-xr-xgr-filter/python/qa_pfb_interpolator.py71
-rwxr-xr-xgr-filter/python/qa_pfb_synthesizer.py87
-rwxr-xr-xgr-filter/python/qa_pm_remez.py188
-rwxr-xr-xgr-filter/python/qa_rational_resampler.py257
-rwxr-xr-xgr-filter/python/qa_single_pole_iir.py114
-rw-r--r--gr-filter/python/rational_resampler.py129
-rw-r--r--gr-filter/swig/CMakeLists.txt55
-rw-r--r--gr-filter/swig/filter_swig.i169
-rw-r--r--gr-howto-write-a-block/CMakeLists.txt138
-rw-r--r--gr-howto-write-a-block/apps/CMakeLists.txt26
-rw-r--r--gr-howto-write-a-block/apps/howto_square.grc325
-rwxr-xr-xgr-howto-write-a-block/apps/howto_square.py77
-rw-r--r--gr-howto-write-a-block/cmake/Modules/CMakeParseArgumentsCopy.cmake138
-rw-r--r--gr-howto-write-a-block/cmake/Modules/FindGnuradioCore.cmake26
-rw-r--r--gr-howto-write-a-block/cmake/Modules/FindGruel.cmake26
-rw-r--r--gr-howto-write-a-block/cmake/Modules/GrMiscUtils.cmake210
-rw-r--r--gr-howto-write-a-block/cmake/Modules/GrPlatform.cmake46
-rw-r--r--gr-howto-write-a-block/cmake/Modules/GrPython.cmake227
-rw-r--r--gr-howto-write-a-block/cmake/Modules/GrSwig.cmake229
-rw-r--r--gr-howto-write-a-block/cmake/Modules/GrTest.cmake133
-rw-r--r--gr-howto-write-a-block/cmake/cmake_uninstall.cmake.in32
-rw-r--r--gr-howto-write-a-block/docs/CMakeLists.txt35
-rw-r--r--gr-howto-write-a-block/docs/doxygen/CMakeLists.txt52
-rw-r--r--gr-howto-write-a-block/docs/doxygen/Doxyfile.in1492
-rw-r--r--gr-howto-write-a-block/docs/doxygen/Doxyfile.swig_doc.in1497
-rw-r--r--gr-howto-write-a-block/docs/doxygen/doxyxml/__init__.py82
-rw-r--r--gr-howto-write-a-block/docs/doxygen/doxyxml/base.py219
-rw-r--r--gr-howto-write-a-block/docs/doxygen/doxyxml/doxyindex.py288
-rw-r--r--gr-howto-write-a-block/docs/doxygen/doxyxml/example/Doxyfile1534
-rw-r--r--gr-howto-write-a-block/docs/doxygen/doxyxml/example/aadvark.cc50
-rw-r--r--gr-howto-write-a-block/docs/doxygen/doxyxml/example/aadvark.h44
-rw-r--r--gr-howto-write-a-block/docs/doxygen/doxyxml/example/xml/aadvark_8cc.xml88
-rw-r--r--gr-howto-write-a-block/docs/doxygen/doxyxml/example/xml/aadvark_8h.xml72
-rw-r--r--gr-howto-write-a-block/docs/doxygen/doxyxml/example/xml/classAadvark.xml86
-rw-r--r--gr-howto-write-a-block/docs/doxygen/doxyxml/example/xml/combine.xslt15
-rw-r--r--gr-howto-write-a-block/docs/doxygen/doxyxml/example/xml/compound.xsd814
-rw-r--r--gr-howto-write-a-block/docs/doxygen/doxyxml/example/xml/index.xml17
-rw-r--r--gr-howto-write-a-block/docs/doxygen/doxyxml/example/xml/index.xsd66
-rw-r--r--gr-howto-write-a-block/docs/doxygen/doxyxml/generated/__init__.py7
-rw-r--r--gr-howto-write-a-block/docs/doxygen/doxyxml/generated/compound.py503
-rw-r--r--gr-howto-write-a-block/docs/doxygen/doxyxml/generated/compoundsuper.py8342
-rw-r--r--gr-howto-write-a-block/docs/doxygen/doxyxml/generated/index.py77
-rw-r--r--gr-howto-write-a-block/docs/doxygen/doxyxml/generated/indexsuper.py523
-rw-r--r--gr-howto-write-a-block/docs/doxygen/doxyxml/text.py56
-rw-r--r--gr-howto-write-a-block/docs/doxygen/other/group_defs.dox7
-rw-r--r--gr-howto-write-a-block/docs/doxygen/other/main_page.dox10
-rw-r--r--gr-howto-write-a-block/docs/doxygen/swig_doc.py326
-rw-r--r--gr-howto-write-a-block/grc/CMakeLists.txt24
-rw-r--r--gr-howto-write-a-block/grc/howto_square2_ff.xml18
-rw-r--r--gr-howto-write-a-block/grc/howto_square_ff.xml18
-rw-r--r--gr-howto-write-a-block/include/CMakeLists.txt28
-rw-r--r--gr-howto-write-a-block/include/howto_api.h33
-rw-r--r--gr-howto-write-a-block/include/howto_square2_ff.h78
-rw-r--r--gr-howto-write-a-block/include/howto_square_ff.h82
-rw-r--r--gr-howto-write-a-block/lib/CMakeLists.txt54
-rw-r--r--gr-howto-write-a-block/lib/howto_square2_ff.cc92
-rw-r--r--gr-howto-write-a-block/lib/howto_square_ff.cc98
-rw-r--r--gr-howto-write-a-block/lib/qa_howto_square2_ff.cc32
-rw-r--r--gr-howto-write-a-block/lib/qa_howto_square_ff.cc32
-rw-r--r--gr-howto-write-a-block/python/CMakeLists.txt45
-rw-r--r--gr-howto-write-a-block/python/__init__.py31
-rwxr-xr-xgr-howto-write-a-block/python/qa_howto.py72
-rw-r--r--gr-howto-write-a-block/python/square3_ff.py47
-rw-r--r--gr-howto-write-a-block/swig/CMakeLists.txt63
-rw-r--r--gr-howto-write-a-block/swig/howto_swig.i20
-rw-r--r--gr-qtgui/CMakeLists.txt131
-rw-r--r--gr-qtgui/apps/grc_qt_example.grc441
-rwxr-xr-xgr-qtgui/apps/qt_digital.py308
-rw-r--r--gr-qtgui/apps/qt_digital_window.py161
-rw-r--r--gr-qtgui/apps/qt_digital_window.ui342
-rwxr-xr-xgr-qtgui/apps/uhd_display.py317
-rw-r--r--gr-qtgui/apps/usrp_display_qtgui.py191
-rw-r--r--gr-qtgui/apps/usrp_display_qtgui.ui375
-rw-r--r--gr-qtgui/doc/CMakeLists.txt23
-rw-r--r--gr-qtgui/doc/README.qtgui12
-rw-r--r--gr-qtgui/doc/qtgui.dox77
-rw-r--r--gr-qtgui/examples/CMakeLists.txt29
-rwxr-xr-xgr-qtgui/examples/pyqt_example_c.py176
-rwxr-xr-xgr-qtgui/examples/pyqt_example_f.py178
-rwxr-xr-xgr-qtgui/examples/pyqt_time_c.py189
-rwxr-xr-xgr-qtgui/examples/pyqt_time_f.py189
-rw-r--r--gr-qtgui/gnuradio-qtgui.pc.in11
-rw-r--r--gr-qtgui/grc/CMakeLists.txt22
-rw-r--r--gr-qtgui/grc/qtgui_check_box.xml83
-rw-r--r--gr-qtgui/grc/qtgui_chooser.xml251
-rw-r--r--gr-qtgui/grc/qtgui_entry.xml68
-rw-r--r--gr-qtgui/grc/qtgui_label.xml66
-rw-r--r--gr-qtgui/grc/qtgui_range.xml211
-rw-r--r--gr-qtgui/grc/qtgui_sink_x.xml153
-rw-r--r--gr-qtgui/grc/qtgui_tab_widget.xml84
-rw-r--r--gr-qtgui/grc/qtgui_time_sink_x.xml78
-rw-r--r--gr-qtgui/include/CMakeLists.txt32
-rw-r--r--gr-qtgui/include/gr_qtgui_api.h33
-rw-r--r--gr-qtgui/include/qtgui_sink_c.h128
-rw-r--r--gr-qtgui/include/qtgui_sink_f.h125
-rw-r--r--gr-qtgui/include/qtgui_time_sink_c.h101
-rw-r--r--gr-qtgui/include/qtgui_time_sink_f.h99
-rw-r--r--gr-qtgui/include/qtgui_util.h57
-rw-r--r--gr-qtgui/lib/CMakeLists.txt112
-rw-r--r--gr-qtgui/lib/ConstellationDisplayPlot.cc255
-rw-r--r--gr-qtgui/lib/ConstellationDisplayPlot.h101
-rw-r--r--gr-qtgui/lib/FrequencyDisplayPlot.cc560
-rw-r--r--gr-qtgui/lib/FrequencyDisplayPlot.h139
-rw-r--r--gr-qtgui/lib/SpectrumGUIClass.cc478
-rw-r--r--gr-qtgui/lib/SpectrumGUIClass.h130
-rw-r--r--gr-qtgui/lib/TimeDomainDisplayPlot.cc345
-rw-r--r--gr-qtgui/lib/TimeDomainDisplayPlot.h102
-rw-r--r--gr-qtgui/lib/WaterfallDisplayPlot.cc695
-rw-r--r--gr-qtgui/lib/WaterfallDisplayPlot.h127
-rw-r--r--gr-qtgui/lib/plot_waterfall.cc310
-rw-r--r--gr-qtgui/lib/plot_waterfall.h67
-rw-r--r--gr-qtgui/lib/qtgui_sink_c.cc310
-rw-r--r--gr-qtgui/lib/qtgui_sink_f.cc294
-rw-r--r--gr-qtgui/lib/qtgui_time_sink_c.cc192
-rw-r--r--gr-qtgui/lib/qtgui_time_sink_f.cc190
-rw-r--r--gr-qtgui/lib/qtgui_util.cc103
-rw-r--r--gr-qtgui/lib/spectrumUpdateEvents.cc223
-rw-r--r--gr-qtgui/lib/spectrumUpdateEvents.h115
-rw-r--r--gr-qtgui/lib/spectrumdisplayform.cc754
-rw-r--r--gr-qtgui/lib/spectrumdisplayform.h139
-rw-r--r--gr-qtgui/lib/spectrumdisplayform.ui756
-rw-r--r--gr-qtgui/lib/timedisplayform.cc177
-rw-r--r--gr-qtgui/lib/timedisplayform.h85
-rw-r--r--gr-qtgui/lib/waterfallGlobalData.cc230
-rw-r--r--gr-qtgui/lib/waterfallGlobalData.h59
-rw-r--r--gr-qtgui/python/CMakeLists.txt46
-rw-r--r--gr-qtgui/python/__init__.py30
-rwxr-xr-xgr-qtgui/python/qa_qtgui.py48
-rw-r--r--gr-qtgui/swig/CMakeLists.txt57
-rw-r--r--gr-qtgui/swig/__init__.py24
-rw-r--r--gr-qtgui/swig/qtgui_sink_c.i66
-rw-r--r--gr-qtgui/swig/qtgui_sink_f.i66
-rw-r--r--gr-qtgui/swig/qtgui_swig.i38
-rw-r--r--gr-qtgui/swig/qtgui_time_sink_c.i56
-rw-r--r--gr-qtgui/swig/qtgui_time_sink_f.i56
-rw-r--r--gr-scigen/CMakeLists.txt55
-rw-r--r--gr-scigen/doc/CMakeLists.txt23
-rw-r--r--gr-scigen/doc/README.scigen13
-rw-r--r--gr-scigen/doc/scigen.dox29
-rw-r--r--gr-scigen/grc/CMakeLists.txt24
-rw-r--r--gr-scigen/grc/scigen.xml82
-rw-r--r--gr-scigen/python/CMakeLists.txt46
-rw-r--r--gr-scigen/python/__init__.py52
-rw-r--r--gr-scigen/python/generic.py66
-rwxr-xr-xgr-scigen/python/qa_scigen.py58
-rw-r--r--gr-scigen/python/scigen.py1
-rw-r--r--gr-utils/CMakeLists.txt54
-rw-r--r--gr-utils/src/python/CMakeLists.txt59
-rw-r--r--gr-utils/src/python/README.plot97
-rwxr-xr-xgr-utils/src/python/gr_filter_design874
-rwxr-xr-xgr-utils/src/python/gr_modtool43
-rwxr-xr-xgr-utils/src/python/gr_plot_char58
-rwxr-xr-xgr-utils/src/python/gr_plot_const250
-rw-r--r--gr-utils/src/python/gr_plot_fft42
-rwxr-xr-xgr-utils/src/python/gr_plot_fft_c46
-rwxr-xr-xgr-utils/src/python/gr_plot_fft_f46
-rwxr-xr-xgr-utils/src/python/gr_plot_float58
-rwxr-xr-xgr-utils/src/python/gr_plot_int58
-rwxr-xr-xgr-utils/src/python/gr_plot_iq178
-rw-r--r--gr-utils/src/python/gr_plot_psd42
-rwxr-xr-xgr-utils/src/python/gr_plot_psd_c47
-rwxr-xr-xgr-utils/src/python/gr_plot_psd_f47
-rwxr-xr-xgr-utils/src/python/gr_plot_qt729
-rwxr-xr-xgr-utils/src/python/gr_plot_short58
-rw-r--r--gr-utils/src/python/gr_read_file_metadata87
-rwxr-xr-xgr-utils/src/python/grcc66
-rw-r--r--gr-utils/src/python/modtool/CMakeLists.txt62
-rw-r--r--gr-utils/src/python/modtool/README.modtool19
-rw-r--r--gr-utils/src/python/modtool/__init__.py35
-rw-r--r--gr-utils/src/python/modtool/cmakefile_editor.py113
-rw-r--r--gr-utils/src/python/modtool/code_generator.py53
-rw-r--r--gr-utils/src/python/modtool/gr-newmod/CMakeLists.txt145
-rw-r--r--gr-utils/src/python/modtool/gr-newmod/apps/CMakeLists.txt25
-rw-r--r--gr-utils/src/python/modtool/gr-newmod/cmake/Modules/CMakeParseArgumentsCopy.cmake138
-rw-r--r--gr-utils/src/python/modtool/gr-newmod/cmake/Modules/FindCppUnit.cmake36
-rw-r--r--gr-utils/src/python/modtool/gr-newmod/cmake/Modules/FindGnuradioCore.cmake26
-rw-r--r--gr-utils/src/python/modtool/gr-newmod/cmake/Modules/FindGruel.cmake26
-rw-r--r--gr-utils/src/python/modtool/gr-newmod/cmake/Modules/GrMiscUtils.cmake210
-rw-r--r--gr-utils/src/python/modtool/gr-newmod/cmake/Modules/GrPlatform.cmake46
-rw-r--r--gr-utils/src/python/modtool/gr-newmod/cmake/Modules/GrPython.cmake227
-rw-r--r--gr-utils/src/python/modtool/gr-newmod/cmake/Modules/GrSwig.cmake229
-rw-r--r--gr-utils/src/python/modtool/gr-newmod/cmake/Modules/GrTest.cmake133
-rw-r--r--gr-utils/src/python/modtool/gr-newmod/cmake/cmake_uninstall.cmake.in32
-rw-r--r--gr-utils/src/python/modtool/gr-newmod/docs/CMakeLists.txt35
-rw-r--r--gr-utils/src/python/modtool/gr-newmod/docs/README.howto11
-rw-r--r--gr-utils/src/python/modtool/gr-newmod/docs/doxygen/CMakeLists.txt52
-rw-r--r--gr-utils/src/python/modtool/gr-newmod/docs/doxygen/Doxyfile.in1504
-rw-r--r--gr-utils/src/python/modtool/gr-newmod/docs/doxygen/Doxyfile.swig_doc.in1514
-rw-r--r--gr-utils/src/python/modtool/gr-newmod/docs/doxygen/doxyxml/__init__.py82
-rw-r--r--gr-utils/src/python/modtool/gr-newmod/docs/doxygen/doxyxml/base.py219
-rw-r--r--gr-utils/src/python/modtool/gr-newmod/docs/doxygen/doxyxml/doxyindex.py237
-rw-r--r--gr-utils/src/python/modtool/gr-newmod/docs/doxygen/doxyxml/generated/__init__.py7
-rw-r--r--gr-utils/src/python/modtool/gr-newmod/docs/doxygen/doxyxml/generated/compound.py503
-rw-r--r--gr-utils/src/python/modtool/gr-newmod/docs/doxygen/doxyxml/generated/compoundsuper.py8342
-rw-r--r--gr-utils/src/python/modtool/gr-newmod/docs/doxygen/doxyxml/generated/index.py77
-rw-r--r--gr-utils/src/python/modtool/gr-newmod/docs/doxygen/doxyxml/generated/indexsuper.py523
-rw-r--r--gr-utils/src/python/modtool/gr-newmod/docs/doxygen/doxyxml/text.py56
-rw-r--r--gr-utils/src/python/modtool/gr-newmod/docs/doxygen/other/group_defs.dox7
-rw-r--r--gr-utils/src/python/modtool/gr-newmod/docs/doxygen/other/main_page.dox10
-rw-r--r--gr-utils/src/python/modtool/gr-newmod/docs/doxygen/swig_doc.py255
-rw-r--r--gr-utils/src/python/modtool/gr-newmod/grc/CMakeLists.txt22
-rw-r--r--gr-utils/src/python/modtool/gr-newmod/include/howto/CMakeLists.txt26
-rw-r--r--gr-utils/src/python/modtool/gr-newmod/include/howto/api.h33
-rw-r--r--gr-utils/src/python/modtool/gr-newmod/lib/CMakeLists.txt66
-rw-r--r--gr-utils/src/python/modtool/gr-newmod/lib/qa_howto.cc36
-rw-r--r--gr-utils/src/python/modtool/gr-newmod/lib/qa_howto.h38
-rw-r--r--gr-utils/src/python/modtool/gr-newmod/lib/test_howto.cc43
-rw-r--r--gr-utils/src/python/modtool/gr-newmod/python/CMakeLists.txt43
-rw-r--r--gr-utils/src/python/modtool/gr-newmod/python/__init__.py54
-rw-r--r--gr-utils/src/python/modtool/gr-newmod/swig/CMakeLists.txt61
-rw-r--r--gr-utils/src/python/modtool/gr-newmod/swig/howto_swig.i13
-rw-r--r--gr-utils/src/python/modtool/grc_xml_generator.py104
-rw-r--r--gr-utils/src/python/modtool/modtool.conf.in6
-rw-r--r--gr-utils/src/python/modtool/modtool_add.py310
-rw-r--r--gr-utils/src/python/modtool/modtool_base.py176
-rw-r--r--gr-utils/src/python/modtool/modtool_disable.py148
-rw-r--r--gr-utils/src/python/modtool/modtool_help.py66
-rw-r--r--gr-utils/src/python/modtool/modtool_info.py156
-rw-r--r--gr-utils/src/python/modtool/modtool_makexml.py158
-rw-r--r--gr-utils/src/python/modtool/modtool_newmod.py102
-rw-r--r--gr-utils/src/python/modtool/modtool_rm.py159
-rw-r--r--gr-utils/src/python/modtool/parser_cc_block.py225
-rw-r--r--gr-utils/src/python/modtool/templates.py718
-rw-r--r--gr-utils/src/python/modtool/util_functions.py141
-rw-r--r--gr-utils/src/python/plot_data.py165
-rwxr-xr-xgr-utils/src/python/plot_fft_base.py249
-rwxr-xr-xgr-utils/src/python/plot_psd_base.py292
-rw-r--r--gr-utils/src/python/pyqt_filter.py435
-rw-r--r--gr-utils/src/python/pyqt_filter.ui687
-rw-r--r--gr-utils/src/python/pyqt_plot.py211
-rw-r--r--gr-utils/src/python/pyqt_plot.ui399
-rw-r--r--gr-wxgui/CMakeLists.txt89
-rw-r--r--gr-wxgui/README1
-rw-r--r--gr-wxgui/README.gl29
-rw-r--r--gr-wxgui/gr-wxgui.conf13
-rw-r--r--gr-wxgui/gr-wxgui.pc.in11
-rw-r--r--gr-wxgui/grc/CMakeLists.txt36
-rw-r--r--gr-wxgui/grc/__init__.py22
-rw-r--r--gr-wxgui/grc/notebook.xml70
-rw-r--r--gr-wxgui/grc/panel.py49
-rw-r--r--gr-wxgui/grc/top_block_gui.py78
-rw-r--r--gr-wxgui/grc/variable_check_box.xml85
-rw-r--r--gr-wxgui/grc/variable_chooser.xml123
-rw-r--r--gr-wxgui/grc/variable_slider.xml139
-rw-r--r--gr-wxgui/grc/variable_static_text.xml98
-rw-r--r--gr-wxgui/grc/variable_text_box.xml102
-rw-r--r--gr-wxgui/grc/wxgui_constellationsink2.xml140
-rw-r--r--gr-wxgui/grc/wxgui_fftsink2.xml245
-rw-r--r--gr-wxgui/grc/wxgui_histosink2.xml78
-rw-r--r--gr-wxgui/grc/wxgui_numbersink2.xml193
-rw-r--r--gr-wxgui/grc/wxgui_scopesink2.xml187
-rw-r--r--gr-wxgui/grc/wxgui_termsink.xml56
-rw-r--r--gr-wxgui/grc/wxgui_waterfallsink2.xml202
-rw-r--r--gr-wxgui/src/python/CMakeLists.txt88
-rw-r--r--gr-wxgui/src/python/__init__.py25
-rw-r--r--gr-wxgui/src/python/common.py252
-rw-r--r--gr-wxgui/src/python/const_window.py207
-rw-r--r--gr-wxgui/src/python/constants.py76
-rw-r--r--gr-wxgui/src/python/constsink_gl.py140
-rw-r--r--gr-wxgui/src/python/fft_window.py408
-rw-r--r--gr-wxgui/src/python/fftsink2.py41
-rw-r--r--gr-wxgui/src/python/fftsink_gl.py201
-rw-r--r--gr-wxgui/src/python/fftsink_nongl.py647
-rw-r--r--gr-wxgui/src/python/form.py391
-rw-r--r--gr-wxgui/src/python/forms/__init__.py103
-rw-r--r--gr-wxgui/src/python/forms/converters.py154
-rw-r--r--gr-wxgui/src/python/forms/forms.py653
-rw-r--r--gr-wxgui/src/python/gui.py135
-rw-r--r--gr-wxgui/src/python/histo_window.py164
-rw-r--r--gr-wxgui/src/python/histosink_gl.py110
-rw-r--r--gr-wxgui/src/python/number_window.py213
-rw-r--r--gr-wxgui/src/python/numbersink2.py171
-rw-r--r--gr-wxgui/src/python/plot.py1834
-rw-r--r--gr-wxgui/src/python/plotter/__init__.py24
-rw-r--r--gr-wxgui/src/python/plotter/bar_plotter.py144
-rw-r--r--gr-wxgui/src/python/plotter/channel_plotter.py236
-rw-r--r--gr-wxgui/src/python/plotter/common.py133
-rw-r--r--gr-wxgui/src/python/plotter/gltext.py503
-rw-r--r--gr-wxgui/src/python/plotter/grid_plotter_base.py419
-rw-r--r--gr-wxgui/src/python/plotter/plotter_base.py214
-rw-r--r--gr-wxgui/src/python/plotter/waterfall_plotter.py278
-rw-r--r--gr-wxgui/src/python/powermate.py448
-rw-r--r--gr-wxgui/src/python/pubsub.py153
-rw-r--r--gr-wxgui/src/python/scope_window.py686
-rw-r--r--gr-wxgui/src/python/scopesink2.py41
-rw-r--r--gr-wxgui/src/python/scopesink_gl.py233
-rw-r--r--gr-wxgui/src/python/scopesink_nongl.py651
-rw-r--r--gr-wxgui/src/python/slider.py49
-rw-r--r--gr-wxgui/src/python/stdgui2.py100
-rw-r--r--gr-wxgui/src/python/termsink.py77
-rw-r--r--gr-wxgui/src/python/waterfall_window.py324
-rw-r--r--gr-wxgui/src/python/waterfallsink2.py41
-rw-r--r--gr-wxgui/src/python/waterfallsink_gl.py173
-rw-r--r--gr-wxgui/src/python/waterfallsink_nongl.py431
-rw-r--r--grc/CMakeLists.txt128
-rw-r--r--grc/__init__.py0
-rw-r--r--grc/base/Block.py253
-rw-r--r--grc/base/CMakeLists.txt42
-rw-r--r--grc/base/Connection.py97
-rw-r--r--grc/base/Constants.py25
-rw-r--r--grc/base/Element.py89
-rw-r--r--grc/base/FlowGraph.py219
-rw-r--r--grc/base/Param.py181
-rw-r--r--grc/base/ParseXML.py102
-rw-r--r--grc/base/Platform.py178
-rw-r--r--grc/base/Port.py83
-rw-r--r--grc/base/__init__.py20
-rw-r--r--grc/base/block_tree.dtd26
-rw-r--r--grc/base/flow_graph.dtd36
-rw-r--r--grc/base/odict.py93
-rw-r--r--grc/blocks/CMakeLists.txt22
-rw-r--r--grc/blocks/band_pass_filter.xml166
-rw-r--r--grc/blocks/band_reject_filter.xml132
-rw-r--r--grc/blocks/blks2_am_demod_cf.xml47
-rw-r--r--grc/blocks/blks2_analysis_filterbank.xml32
-rw-r--r--grc/blocks/blks2_error_rate.xml69
-rw-r--r--grc/blocks/blks2_fm_deemph.xml31
-rw-r--r--grc/blocks/blks2_fm_demod_cf.xml68
-rw-r--r--grc/blocks/blks2_fm_preemph.xml31
-rw-r--r--grc/blocks/blks2_logpwrfft_x.xml90
-rw-r--r--grc/blocks/blks2_nbfm_rx.xml48
-rw-r--r--grc/blocks/blks2_nbfm_tx.xml48
-rw-r--r--grc/blocks/blks2_packet_decoder.xml75
-rw-r--r--grc/blocks/blks2_packet_encoder.xml110
-rw-r--r--grc/blocks/blks2_pfb_arb_resampler.xml45
-rw-r--r--grc/blocks/blks2_pfb_channelizer.xml62
-rw-r--r--grc/blocks/blks2_rational_resampler_xxx.xml88
-rw-r--r--grc/blocks/blks2_selector.xml97
-rw-r--r--grc/blocks/blks2_standard_squelch.xml32
-rw-r--r--grc/blocks/blks2_stream_to_vector_decimator.xml77
-rw-r--r--grc/blocks/blks2_synthesis_filterbank.xml32
-rw-r--r--grc/blocks/blks2_tcp_sink.xml89
-rw-r--r--grc/blocks/blks2_tcp_source.xml89
-rw-r--r--grc/blocks/blks2_valve.xml72
-rw-r--r--grc/blocks/blks2_wfm_rcv.xml33
-rw-r--r--grc/blocks/blks2_wfm_rcv_pll.xml37
-rw-r--r--grc/blocks/blks2_wfm_tx.xml48
-rw-r--r--grc/blocks/block_tree.xml283
-rw-r--r--grc/blocks/const_source_x.xml52
-rw-r--r--grc/blocks/gr_add_const_vxx.xml67
-rw-r--r--grc/blocks/gr_add_xx.xml63
-rw-r--r--grc/blocks/gr_additive_scrambler_bb.xml44
-rw-r--r--grc/blocks/gr_agc2_xx.xml70
-rw-r--r--grc/blocks/gr_agc_xx.xml59
-rw-r--r--grc/blocks/gr_and_const_xx.xml48
-rw-r--r--grc/blocks/gr_and_xx.xml48
-rw-r--r--grc/blocks/gr_argmax_xx.xml61
-rw-r--r--grc/blocks/gr_burst_tagger.xml87
-rw-r--r--grc/blocks/gr_channel_model.xml61
-rw-r--r--grc/blocks/gr_char_to_float.xml35
-rw-r--r--grc/blocks/gr_char_to_short.xml28
-rw-r--r--grc/blocks/gr_chunks_to_symbols.xml77
-rw-r--r--grc/blocks/gr_complex_to_arg.xml29
-rw-r--r--grc/blocks/gr_complex_to_float.xml36
-rw-r--r--grc/blocks/gr_complex_to_imag.xml29
-rw-r--r--grc/blocks/gr_complex_to_interleaved_short.xml20
-rw-r--r--grc/blocks/gr_complex_to_mag.xml29
-rw-r--r--grc/blocks/gr_complex_to_mag_squared.xml29
-rw-r--r--grc/blocks/gr_complex_to_real.xml29
-rw-r--r--grc/blocks/gr_conjugate_cc.xml20
-rw-r--r--grc/blocks/gr_copy.xml75
-rw-r--r--grc/blocks/gr_cpfsk_bc.xml37
-rw-r--r--grc/blocks/gr_ctcss_squelch_ff.xml79
-rw-r--r--grc/blocks/gr_dc_blocker.xml51
-rw-r--r--grc/blocks/gr_decode_ccsds_27_fb.xml20
-rw-r--r--grc/blocks/gr_deinterleave.xml67
-rw-r--r--grc/blocks/gr_delay.xml75
-rw-r--r--grc/blocks/gr_descrambler_bb.xml38
-rw-r--r--grc/blocks/gr_diff_decoder_bb.xml25
-rw-r--r--grc/blocks/gr_diff_encoder_bb.xml25
-rw-r--r--grc/blocks/gr_diff_phasor_cc.xml20
-rw-r--r--grc/blocks/gr_divide_xx.xml63
-rw-r--r--grc/blocks/gr_dpll_bb.xml30
-rw-r--r--grc/blocks/gr_encode_ccsds_27_bb.xml20
-rw-r--r--grc/blocks/gr_endian_swap.xml41
-rw-r--r--grc/blocks/gr_feedforward_agc_cc.xml32
-rw-r--r--grc/blocks/gr_fft_filter_xxx.xml59
-rw-r--r--grc/blocks/gr_fft_vxx.xml88
-rw-r--r--grc/blocks/gr_file_sink.xml78
-rw-r--r--grc/blocks/gr_file_source.xml75
-rw-r--r--grc/blocks/gr_filter_delay_fc.xml31
-rw-r--r--grc/blocks/gr_fir_filter_xxx.xml80
-rw-r--r--grc/blocks/gr_float_to_char.xml35
-rw-r--r--grc/blocks/gr_float_to_complex.xml36
-rw-r--r--grc/blocks/gr_float_to_int.xml35
-rw-r--r--grc/blocks/gr_float_to_short.xml35
-rw-r--r--grc/blocks/gr_float_to_uchar.xml20
-rw-r--r--grc/blocks/gr_fractional_interpolator_xx.xml46
-rw-r--r--grc/blocks/gr_freq_xlating_fir_filter_xxx.xml93
-rw-r--r--grc/blocks/gr_frequency_modulator_fc.xml26
-rw-r--r--grc/blocks/gr_glfsr_source_x.xml59
-rw-r--r--grc/blocks/gr_goertzel_fc.xml37
-rw-r--r--grc/blocks/gr_head.xml65
-rw-r--r--grc/blocks/gr_hilbert_fc.xml26
-rw-r--r--grc/blocks/gr_iir_filter_ffd.xml31
-rw-r--r--grc/blocks/gr_int_to_float.xml35
-rw-r--r--grc/blocks/gr_integrate_xx.xml50
-rw-r--r--grc/blocks/gr_interleave.xml67
-rw-r--r--grc/blocks/gr_interleaved_short_to_complex.xml20
-rw-r--r--grc/blocks/gr_interp_fir_filter_xxx.xml80
-rw-r--r--grc/blocks/gr_iqcomp_cc.xml25
-rw-r--r--grc/blocks/gr_keep_m_in_n.xml76
-rw-r--r--grc/blocks/gr_keep_one_in_n.xml67
-rw-r--r--grc/blocks/gr_kludge_copy.xml68
-rw-r--r--grc/blocks/gr_map_bb.xml25
-rw-r--r--grc/blocks/gr_max_xx.xml58
-rw-r--r--grc/blocks/gr_message_burst_source.xml58
-rw-r--r--grc/blocks/gr_message_debug.xml27
-rw-r--r--grc/blocks/gr_message_sink.xml72
-rw-r--r--grc/blocks/gr_message_source.xml58
-rw-r--r--grc/blocks/gr_message_strobe.xml35
-rw-r--r--grc/blocks/gr_moving_average_xx.xml68
-rw-r--r--grc/blocks/gr_mpsk_sync_cc.xml69
-rw-r--r--grc/blocks/gr_multiply_const_vxx.xml67
-rw-r--r--grc/blocks/gr_multiply_xx.xml63
-rw-r--r--grc/blocks/gr_mute_xx.xml61
-rw-r--r--grc/blocks/gr_nlog10_ff.xml42
-rw-r--r--grc/blocks/gr_noise_source_x.xml77
-rw-r--r--grc/blocks/gr_nop.xml68
-rw-r--r--grc/blocks/gr_not_xx.xml40
-rw-r--r--grc/blocks/gr_null_sink.xml54
-rw-r--r--grc/blocks/gr_null_source.xml54
-rw-r--r--grc/blocks/gr_or_xx.xml48
-rw-r--r--grc/blocks/gr_pack_k_bits_bb.xml30
-rw-r--r--grc/blocks/gr_packed_to_unpacked_xx.xml68
-rw-r--r--grc/blocks/gr_pdu_to_tagged_stream.xml40
-rw-r--r--grc/blocks/gr_peak_detector2_fb.xml38
-rw-r--r--grc/blocks/gr_peak_detector_xb.xml64
-rw-r--r--grc/blocks/gr_pfb_clock_sync.xml100
-rw-r--r--grc/blocks/gr_pfb_synthesizer.xml57
-rw-r--r--grc/blocks/gr_phase_modulator_fc.xml25
-rw-r--r--grc/blocks/gr_pll_carriertracking_cc.xml36
-rw-r--r--grc/blocks/gr_pll_freqdet_cf.xml36
-rw-r--r--grc/blocks/gr_pll_refout_cc.xml36
-rw-r--r--grc/blocks/gr_pn_correlator_cc.xml35
-rw-r--r--grc/blocks/gr_probe_avg_mag_sqrd_x.xml50
-rw-r--r--grc/blocks/gr_probe_density_b.xml34
-rw-r--r--grc/blocks/gr_probe_signal_f.xml21
-rw-r--r--grc/blocks/gr_pwr_squelch_xx.xml65
-rw-r--r--grc/blocks/gr_quadrature_demod_cf.xml26
-rw-r--r--grc/blocks/gr_random_pdu.xml35
-rw-r--r--grc/blocks/gr_rational_resampler_base_xxx.xml86
-rw-r--r--grc/blocks/gr_repeat.xml64
-rw-r--r--grc/blocks/gr_rms_xx.xml41
-rw-r--r--grc/blocks/gr_sample_and_hold_xx.xml49
-rw-r--r--grc/blocks/gr_scrambler_bb.xml38
-rw-r--r--grc/blocks/gr_short_to_char.xml28
-rw-r--r--grc/blocks/gr_short_to_float.xml35
-rw-r--r--grc/blocks/gr_sig_source_x.xml104
-rw-r--r--grc/blocks/gr_simple_correlator.xml25
-rw-r--r--grc/blocks/gr_simple_framer.xml25
-rw-r--r--grc/blocks/gr_simple_squelch_cc.xml32
-rw-r--r--grc/blocks/gr_single_pole_iir_filter_xx.xml51
-rw-r--r--grc/blocks/gr_skiphead.xml65
-rw-r--r--grc/blocks/gr_socket_pdu.xml62
-rw-r--r--grc/blocks/gr_stream_mux.xml75
-rw-r--r--grc/blocks/gr_stream_to_streams.xml67
-rw-r--r--grc/blocks/gr_stream_to_vector.xml66
-rw-r--r--grc/blocks/gr_streams_to_stream.xml67
-rw-r--r--grc/blocks/gr_streams_to_vector.xml67
-rw-r--r--grc/blocks/gr_sub_xx.xml63
-rw-r--r--grc/blocks/gr_tag_debug.xml82
-rw-r--r--grc/blocks/gr_tagged_stream_to_pdu.xml40
-rw-r--r--grc/blocks/gr_threshold_ff.xml40
-rw-r--r--grc/blocks/gr_throttle.xml67
-rw-r--r--grc/blocks/gr_transcendental.xml41
-rw-r--r--grc/blocks/gr_tuntap_pdu.xml34
-rw-r--r--grc/blocks/gr_uchar_to_float.xml20
-rw-r--r--grc/blocks/gr_udp_sink.xml77
-rw-r--r--grc/blocks/gr_udp_source.xml85
-rw-r--r--grc/blocks/gr_unpack_k_bits_bb.xml25
-rw-r--r--grc/blocks/gr_unpacked_to_packed_xx.xml68
-rw-r--r--grc/blocks/gr_vco_f.xml35
-rw-r--r--grc/blocks/gr_vector_insert_x.xml80
-rw-r--r--grc/blocks/gr_vector_sink_x.xml54
-rw-r--r--grc/blocks/gr_vector_source_x.xml79
-rw-r--r--grc/blocks/gr_vector_to_stream.xml66
-rw-r--r--grc/blocks/gr_vector_to_streams.xml67
-rw-r--r--grc/blocks/gr_wavfile_sink.xml43
-rw-r--r--grc/blocks/gr_wavfile_source.xml44
-rw-r--r--grc/blocks/gr_xor_xx.xml48
-rw-r--r--grc/blocks/high_pass_filter.xml127
-rw-r--r--grc/blocks/import.xml26
-rw-r--r--grc/blocks/low_pass_filter.xml127
-rw-r--r--grc/blocks/note.xml17
-rw-r--r--grc/blocks/options.xml190
-rw-r--r--grc/blocks/pad_sink.xml91
-rw-r--r--grc/blocks/pad_source.xml91
-rw-r--r--grc/blocks/parameter.xml99
-rw-r--r--grc/blocks/random_source_x.xml75
-rw-r--r--grc/blocks/root_raised_cosine_filter.xml101
-rw-r--r--grc/blocks/variable.xml23
-rw-r--r--grc/blocks/variable_config.xml88
-rw-r--r--grc/blocks/variable_function_probe.xml70
-rw-r--r--grc/blocks/virtual_sink.xml21
-rw-r--r--grc/blocks/virtual_source.xml21
-rw-r--r--grc/blocks/xmlrpc_client.xml42
-rw-r--r--grc/blocks/xmlrpc_server.xml39
-rw-r--r--grc/cpp/README5
-rw-r--r--grc/examples/CMakeLists.txt37
-rw-r--r--grc/examples/simple/variable_config.grc329
-rw-r--r--grc/examples/xmlrpc/readme.txt18
-rw-r--r--grc/examples/xmlrpc/xmlrpc_client.grc312
-rw-r--r--grc/examples/xmlrpc/xmlrpc_client_script.py23
-rw-r--r--grc/examples/xmlrpc/xmlrpc_server.grc384
-rw-r--r--grc/freedesktop/CMakeLists.txt47
-rw-r--r--grc/freedesktop/README20
-rw-r--r--grc/freedesktop/gnuradio-grc.desktop8
-rw-r--r--grc/freedesktop/gnuradio-grc.xml8
-rw-r--r--grc/freedesktop/grc-icon-128.pngbin0 -> 3570 bytes
-rw-r--r--grc/freedesktop/grc-icon-256.pngbin0 -> 7843 bytes
-rw-r--r--grc/freedesktop/grc-icon-256.svg216
-rw-r--r--grc/freedesktop/grc-icon-32.pngbin0 -> 1060 bytes
-rw-r--r--grc/freedesktop/grc-icon-48.pngbin0 -> 1691 bytes
-rw-r--r--grc/freedesktop/grc-icon-64.pngbin0 -> 1893 bytes
-rw-r--r--grc/freedesktop/grc_setup_freedesktop.in75
-rw-r--r--grc/grc.conf.in7
-rw-r--r--grc/grc_gnuradio/CMakeLists.txt35
-rw-r--r--grc/grc_gnuradio/README11
-rw-r--r--grc/grc_gnuradio/__init__.py1
-rw-r--r--grc/grc_gnuradio/blks2/__init__.py26
-rw-r--r--grc/grc_gnuradio/blks2/error_rate.py137
-rw-r--r--grc/grc_gnuradio/blks2/packet.py242
-rw-r--r--grc/grc_gnuradio/blks2/selector.py128
-rw-r--r--grc/grc_gnuradio/blks2/tcp.py66
-rw-r--r--grc/gui/ActionHandler.py530
-rw-r--r--grc/gui/Actions.py291
-rw-r--r--grc/gui/Bars.py143
-rw-r--r--grc/gui/Block.py201
-rw-r--r--grc/gui/BlockTreeWindow.py201
-rw-r--r--grc/gui/CMakeLists.txt48
-rw-r--r--grc/gui/Colors.py40
-rw-r--r--grc/gui/Connection.py143
-rw-r--r--grc/gui/Constants.py83
-rw-r--r--grc/gui/Dialogs.py118
-rw-r--r--grc/gui/DrawingArea.py133
-rw-r--r--grc/gui/Element.py228
-rw-r--r--grc/gui/FileDialogs.py175
-rw-r--r--grc/gui/FlowGraph.py524
-rw-r--r--grc/gui/MainWindow.py327
-rw-r--r--grc/gui/Messages.py104
-rw-r--r--grc/gui/NotebookPage.py187
-rw-r--r--grc/gui/Param.py189
-rw-r--r--grc/gui/Platform.py23
-rw-r--r--grc/gui/Port.py190
-rw-r--r--grc/gui/Preferences.py86
-rw-r--r--grc/gui/PropsDialog.py170
-rw-r--r--grc/gui/StateCache.py92
-rw-r--r--grc/gui/Utils.py90
-rw-r--r--grc/gui/__init__.py1
-rw-r--r--grc/python/Block.py180
-rw-r--r--grc/python/CMakeLists.txt44
-rw-r--r--grc/python/Connection.py46
-rw-r--r--grc/python/Constants.py95
-rw-r--r--grc/python/FlowGraph.py163
-rw-r--r--grc/python/Generator.py152
-rw-r--r--grc/python/Param.py458
-rw-r--r--grc/python/Platform.py70
-rw-r--r--grc/python/Port.py217
-rw-r--r--grc/python/__init__.py1
-rw-r--r--grc/python/block.dtd57
-rw-r--r--grc/python/convert_hier.py98
-rw-r--r--grc/python/default_flow_graph.grc43
-rw-r--r--grc/python/expr_utils.py153
-rw-r--r--grc/python/extract_docs.py66
-rw-r--r--grc/python/flow_graph.tmpl311
-rw-r--r--grc/scripts/CMakeLists.txt25
-rwxr-xr-xgrc/scripts/gnuradio-companion72
-rw-r--r--grc/todo.txt74
-rw-r--r--gruel/CMakeLists.txt104
-rw-r--r--gruel/README29
-rw-r--r--gruel/gruel.pc.in11
-rw-r--r--gruel/src/include/gruel/CMakeLists.txt39
-rw-r--r--gruel/src/include/gruel/api.h33
-rw-r--r--gruel/src/include/gruel/attributes.h74
-rw-r--r--gruel/src/include/gruel/high_res_timer.h124
-rw-r--r--gruel/src/include/gruel/msg_accepter.h53
-rw-r--r--gruel/src/include/gruel/msg_accepter_msgq.h50
-rw-r--r--gruel/src/include/gruel/msg_passing.h116
-rw-r--r--gruel/src/include/gruel/msg_queue.h91
-rw-r--r--gruel/src/include/gruel/pmt.h864
-rw-r--r--gruel/src/include/gruel/pmt_pool.h73
-rw-r--r--gruel/src/include/gruel/pmt_sugar.h171
-rw-r--r--gruel/src/include/gruel/realtime.h96
-rw-r--r--gruel/src/include/gruel/sys_pri.h42
-rw-r--r--gruel/src/include/gruel/thread.h139
-rw-r--r--gruel/src/include/gruel/thread_body_wrapper.h69
-rw-r--r--gruel/src/include/gruel/thread_group.h45
-rw-r--r--gruel/src/lib/CMakeLists.txt110
-rw-r--r--gruel/src/lib/msg/CMakeLists.txt28
-rw-r--r--gruel/src/lib/msg/msg_accepter.cc36
-rw-r--r--gruel/src/lib/msg/msg_accepter_msgq.cc48
-rw-r--r--gruel/src/lib/msg/msg_queue.cc103
-rw-r--r--gruel/src/lib/pmt/CMakeLists.txt89
-rw-r--r--gruel/src/lib/pmt/gen-serial-tags.py53
-rwxr-xr-xgruel/src/lib/pmt/generate_unv.py190
-rw-r--r--gruel/src/lib/pmt/pmt-serial-tags.scm77
-rw-r--r--gruel/src/lib/pmt/pmt.cc1428
-rw-r--r--gruel/src/lib/pmt/pmt_int.h247
-rw-r--r--gruel/src/lib/pmt/pmt_io.cc168
-rw-r--r--gruel/src/lib/pmt/pmt_pool.cc112
-rw-r--r--gruel/src/lib/pmt/pmt_serialize.cc830
-rw-r--r--gruel/src/lib/pmt/qa_pmt.cc40
-rw-r--r--gruel/src/lib/pmt/qa_pmt.h37
-rw-r--r--gruel/src/lib/pmt/qa_pmt_prims.cc603
-rw-r--r--gruel/src/lib/pmt/qa_pmt_prims.h77
-rw-r--r--gruel/src/lib/pmt/unv_qa_template.cc.t35
-rw-r--r--gruel/src/lib/pmt/unv_template.cc.t141
-rw-r--r--gruel/src/lib/pmt/unv_template.h.t23
-rw-r--r--gruel/src/lib/realtime.cc178
-rw-r--r--gruel/src/lib/sys_pri.cc61
-rw-r--r--gruel/src/lib/test_gruel.cc52
-rw-r--r--gruel/src/lib/thread.cc226
-rw-r--r--gruel/src/lib/thread_body_wrapper.cc85
-rw-r--r--gruel/src/lib/thread_group.cc99
-rw-r--r--gruel/src/python/CMakeLists.txt53
-rw-r--r--gruel/src/python/__init__.py29
-rw-r--r--gruel/src/python/pmt/__init__.py31
-rw-r--r--gruel/src/python/pmt/pmt_to_python.py97
-rwxr-xr-xgruel/src/python/qa_pmt.py102
-rwxr-xr-xgruel/src/python/qa_pmt_to_python.py34
-rw-r--r--gruel/src/swig/CMakeLists.txt52
-rw-r--r--gruel/src/swig/__init__.py0
-rw-r--r--gruel/src/swig/gr_intrusive_ptr.i104
-rw-r--r--gruel/src/swig/gruel_common.i66
-rw-r--r--gruel/src/swig/pmt_swig.i792
-rw-r--r--volk/CMakeLists.txt138
-rw-r--r--volk/apps/CMakeLists.txt49
-rw-r--r--volk/apps/volk_profile.cc138
-rw-r--r--volk/cmake/FindORC.cmake36
-rw-r--r--volk/cmake/GrBoost.cmake97
-rw-r--r--volk/cmake/GrPython.cmake233
-rw-r--r--volk/cmake/msvc/config.h58
-rw-r--r--volk/cmake/msvc/inttypes.h301
-rw-r--r--volk/cmake/msvc/stdbool.h45
-rw-r--r--volk/cmake/msvc/stdint.h251
-rw-r--r--volk/gen/archs.xml184
-rw-r--r--volk/gen/machines.xml55
-rw-r--r--volk/gen/volk_arch_defs.py85
-rw-r--r--volk/gen/volk_compile_utils.py58
-rw-r--r--volk/gen/volk_kernel_defs.py209
-rw-r--r--volk/gen/volk_machine_defs.py74
-rw-r--r--volk/gen/volk_tmpl_utils.py74
-rw-r--r--volk/include/volk/volk_16i_32fc_dot_prod_32fc_a.h122
-rw-r--r--volk/include/volk/volk_16i_branch_4_state_8_a.h194
-rw-r--r--volk/include/volk/volk_16i_convert_8i_a.h69
-rw-r--r--volk/include/volk/volk_16i_convert_8i_u.h71
-rw-r--r--volk/include/volk/volk_16i_max_star_16i_a.h108
-rw-r--r--volk/include/volk/volk_16i_max_star_horizontal_16i_a.h130
-rw-r--r--volk/include/volk/volk_16i_permute_and_scalar_add_a.h139
-rw-r--r--volk/include/volk/volk_16i_s32f_convert_32f_a.h119
-rw-r--r--volk/include/volk/volk_16i_s32f_convert_32f_u.h122
-rw-r--r--volk/include/volk/volk_16i_x4_quad_max_star_16i_a.h191
-rw-r--r--volk/include/volk/volk_16i_x5_add_quad_16i_x4_a.h136
-rw-r--r--volk/include/volk/volk_16ic_deinterleave_16i_x2_a.h158
-rw-r--r--volk/include/volk/volk_16ic_deinterleave_real_16i_a.h120
-rw-r--r--volk/include/volk/volk_16ic_deinterleave_real_8i_a.h94
-rw-r--r--volk/include/volk/volk_16ic_magnitude_16i_a.h191
-rw-r--r--volk/include/volk/volk_16ic_s32f_deinterleave_32f_x2_a.h109
-rw-r--r--volk/include/volk/volk_16ic_s32f_deinterleave_real_32f_a.h126
-rw-r--r--volk/include/volk/volk_16ic_s32f_magnitude_32f_a.h180
-rw-r--r--volk/include/volk/volk_16u_byteswap_a.h77
-rw-r--r--volk/include/volk/volk_16u_byteswap_u.h63
-rw-r--r--volk/include/volk/volk_32f_accumulator_s32f_a.h68
-rw-r--r--volk/include/volk/volk_32f_convert_64f_a.h70
-rw-r--r--volk/include/volk/volk_32f_convert_64f_u.h70
-rw-r--r--volk/include/volk/volk_32f_index_max_16u_a.h149
-rw-r--r--volk/include/volk/volk_32f_s32f_32f_fm_detect_32f_a.h120
-rw-r--r--volk/include/volk/volk_32f_s32f_calc_spectral_noise_floor_32f_a.h168
-rw-r--r--volk/include/volk/volk_32f_s32f_convert_16i_a.h150
-rw-r--r--volk/include/volk/volk_32f_s32f_convert_16i_u.h152
-rw-r--r--volk/include/volk/volk_32f_s32f_convert_32i_a.h189
-rw-r--r--volk/include/volk/volk_32f_s32f_convert_32i_u.h142
-rw-r--r--volk/include/volk/volk_32f_s32f_convert_8i_a.h155
-rw-r--r--volk/include/volk/volk_32f_s32f_convert_8i_u.h157
-rw-r--r--volk/include/volk/volk_32f_s32f_multiply_32f_a.h119
-rw-r--r--volk/include/volk/volk_32f_s32f_multiply_32f_u.h102
-rw-r--r--volk/include/volk/volk_32f_s32f_normalize_a.h81
-rw-r--r--volk/include/volk/volk_32f_s32f_power_32f_a.h144
-rw-r--r--volk/include/volk/volk_32f_s32f_stddev_32f_a.h145
-rw-r--r--volk/include/volk/volk_32f_sqrt_32f_a.h77
-rw-r--r--volk/include/volk/volk_32f_stddev_and_mean_32f_x2_a.h170
-rw-r--r--volk/include/volk/volk_32f_x2_add_32f_a.h81
-rw-r--r--volk/include/volk/volk_32f_x2_add_32f_u.h66
-rw-r--r--volk/include/volk/volk_32f_x2_divide_32f_a.h82
-rw-r--r--volk/include/volk/volk_32f_x2_dot_prod_16i_a.h98
-rw-r--r--volk/include/volk/volk_32f_x2_dot_prod_32f_a.h290
-rw-r--r--volk/include/volk/volk_32f_x2_dot_prod_32f_u.h290
-rw-r--r--volk/include/volk/volk_32f_x2_interleave_32fc_a.h75
-rw-r--r--volk/include/volk/volk_32f_x2_max_32f_a.h85
-rw-r--r--volk/include/volk/volk_32f_x2_min_32f_a.h85
-rw-r--r--volk/include/volk/volk_32f_x2_multiply_32f_a.h120
-rw-r--r--volk/include/volk/volk_32f_x2_multiply_32f_u.h106
-rw-r--r--volk/include/volk/volk_32f_x2_s32f_interleave_16ic_a.h156
-rw-r--r--volk/include/volk/volk_32f_x2_subtract_32f_a.h81
-rw-r--r--volk/include/volk/volk_32f_x3_sum_of_poly_32f_a.h151
-rw-r--r--volk/include/volk/volk_32fc_32f_dot_prod_32fc_a.h111
-rw-r--r--volk/include/volk/volk_32fc_32f_multiply_32fc_a.h95
-rw-r--r--volk/include/volk/volk_32fc_conjugate_32fc_a.h64
-rw-r--r--volk/include/volk/volk_32fc_conjugate_32fc_u.h64
-rw-r--r--volk/include/volk/volk_32fc_deinterleave_32f_x2_a.h75
-rw-r--r--volk/include/volk/volk_32fc_deinterleave_64f_x2_a.h78
-rw-r--r--volk/include/volk/volk_32fc_deinterleave_imag_32f_a.h68
-rw-r--r--volk/include/volk/volk_32fc_deinterleave_real_32f_a.h68
-rw-r--r--volk/include/volk/volk_32fc_deinterleave_real_64f_a.h66
-rw-r--r--volk/include/volk/volk_32fc_index_max_16u_a.h215
-rw-r--r--volk/include/volk/volk_32fc_magnitude_32f_a.h132
-rw-r--r--volk/include/volk/volk_32fc_magnitude_32f_u.h118
-rw-r--r--volk/include/volk/volk_32fc_magnitude_squared_32f_a.h114
-rw-r--r--volk/include/volk/volk_32fc_magnitude_squared_32f_u.h114
-rw-r--r--volk/include/volk/volk_32fc_s32f_atan2_32f_a.h158
-rw-r--r--volk/include/volk/volk_32fc_s32f_deinterleave_real_16i_a.h81
-rw-r--r--volk/include/volk/volk_32fc_s32f_magnitude_16i_a.h159
-rw-r--r--volk/include/volk/volk_32fc_s32f_power_32fc_a.h111
-rw-r--r--volk/include/volk/volk_32fc_s32f_power_spectrum_32f_a.h126
-rw-r--r--volk/include/volk/volk_32fc_s32f_x2_power_spectral_density_32f_a.h134
-rw-r--r--volk/include/volk/volk_32fc_s32fc_multiply_32fc_a.h91
-rw-r--r--volk/include/volk/volk_32fc_s32fc_multiply_32fc_u.h87
-rw-r--r--volk/include/volk/volk_32fc_s32fc_rotatorpuppet_32fc_a.h74
-rw-r--r--volk/include/volk/volk_32fc_s32fc_x2_rotator_32fc_a.h257
-rw-r--r--volk/include/volk/volk_32fc_x2_conjugate_dot_prod_32fc_a.h345
-rw-r--r--volk/include/volk/volk_32fc_x2_conjugate_dot_prod_32fc_u.h145
-rw-r--r--volk/include/volk/volk_32fc_x2_dot_prod_32fc_a.h440
-rw-r--r--volk/include/volk/volk_32fc_x2_dot_prod_32fc_u.h116
-rw-r--r--volk/include/volk/volk_32fc_x2_multiply_32fc_a.h93
-rw-r--r--volk/include/volk/volk_32fc_x2_multiply_32fc_u.h77
-rw-r--r--volk/include/volk/volk_32fc_x2_multiply_conjugate_32fc_a.h81
-rw-r--r--volk/include/volk/volk_32fc_x2_multiply_conjugate_32fc_u.h81
-rw-r--r--volk/include/volk/volk_32fc_x2_s32f_square_dist_scalar_mult_32f_a.h126
-rw-r--r--volk/include/volk/volk_32fc_x2_square_dist_32f_a.h112
-rw-r--r--volk/include/volk/volk_32i_s32f_convert_32f_a.h73
-rw-r--r--volk/include/volk/volk_32i_s32f_convert_32f_u.h75
-rw-r--r--volk/include/volk/volk_32i_x2_and_32i_a.h81
-rw-r--r--volk/include/volk/volk_32i_x2_or_32i_a.h81
-rw-r--r--volk/include/volk/volk_32u_byteswap_a.h77
-rw-r--r--volk/include/volk/volk_32u_byteswap_u.h77
-rw-r--r--volk/include/volk/volk_32u_popcnt_a.h36
-rw-r--r--volk/include/volk/volk_64f_convert_32f_a.h67
-rw-r--r--volk/include/volk/volk_64f_convert_32f_u.h67
-rw-r--r--volk/include/volk/volk_64f_x2_max_64f_a.h71
-rw-r--r--volk/include/volk/volk_64f_x2_min_64f_a.h71
-rw-r--r--volk/include/volk/volk_64u_byteswap_a.h88
-rw-r--r--volk/include/volk/volk_64u_byteswap_u.h88
-rw-r--r--volk/include/volk/volk_64u_popcnt_a.h52
-rw-r--r--volk/include/volk/volk_8i_convert_16i_a.h83
-rw-r--r--volk/include/volk/volk_8i_convert_16i_u.h73
-rw-r--r--volk/include/volk/volk_8i_s32f_convert_32f_a.h106
-rw-r--r--volk/include/volk/volk_8i_s32f_convert_32f_u.h94
-rw-r--r--volk/include/volk/volk_8ic_deinterleave_16i_x2_a.h77
-rw-r--r--volk/include/volk/volk_8ic_deinterleave_real_16i_a.h66
-rw-r--r--volk/include/volk/volk_8ic_deinterleave_real_8i_a.h67
-rw-r--r--volk/include/volk/volk_8ic_s32f_deinterleave_32f_x2_a.h165
-rw-r--r--volk/include/volk/volk_8ic_s32f_deinterleave_real_32f_a.h134
-rw-r--r--volk/include/volk/volk_8ic_x2_multiply_conjugate_16ic_a.h101
-rw-r--r--volk/include/volk/volk_8ic_x2_s32f_multiply_conjugate_32fc_a.h122
-rw-r--r--volk/include/volk/volk_common.h96
-rw-r--r--volk/include/volk/volk_complex.h86
-rw-r--r--volk/include/volk/volk_prefs.h28
-rw-r--r--volk/kernels/README.txt67
-rw-r--r--volk/kernels/volk/volk_16i_32fc_dot_prod_32fc.h122
-rw-r--r--volk/kernels/volk/volk_16i_branch_4_state_8.h194
-rw-r--r--volk/kernels/volk/volk_16i_convert_8i.h140
-rw-r--r--volk/kernels/volk/volk_16i_max_star_16i.h110
-rw-r--r--volk/kernels/volk/volk_16i_max_star_horizontal_16i.h134
-rw-r--r--volk/kernels/volk/volk_16i_permute_and_scalar_add.h142
-rw-r--r--volk/kernels/volk/volk_16i_s32f_convert_32f.h241
-rw-r--r--volk/kernels/volk/volk_16i_x4_quad_max_star_16i.h192
-rw-r--r--volk/kernels/volk/volk_16i_x5_add_quad_16i_x4.h140
-rw-r--r--volk/kernels/volk/volk_16ic_deinterleave_16i_x2.h158
-rw-r--r--volk/kernels/volk/volk_16ic_deinterleave_real_16i.h120
-rw-r--r--volk/kernels/volk/volk_16ic_deinterleave_real_8i.h94
-rw-r--r--volk/kernels/volk/volk_16ic_magnitude_16i.h191
-rw-r--r--volk/kernels/volk/volk_16ic_s32f_deinterleave_32f_x2.h109
-rw-r--r--volk/kernels/volk/volk_16ic_s32f_deinterleave_real_32f.h126
-rw-r--r--volk/kernels/volk/volk_16ic_s32f_magnitude_32f.h180
-rw-r--r--volk/kernels/volk/volk_16u_byteswap.h140
-rw-r--r--volk/kernels/volk/volk_32f_accumulator_s32f.h68
-rw-r--r--volk/kernels/volk/volk_32f_convert_64f.h140
-rw-r--r--volk/kernels/volk/volk_32f_index_max_16u.h149
-rw-r--r--volk/kernels/volk/volk_32f_s32f_32f_fm_detect_32f.h120
-rw-r--r--volk/kernels/volk/volk_32f_s32f_calc_spectral_noise_floor_32f.h168
-rw-r--r--volk/kernels/volk/volk_32f_s32f_convert_16i.h302
-rw-r--r--volk/kernels/volk/volk_32f_s32f_convert_32i.h331
-rw-r--r--volk/kernels/volk/volk_32f_s32f_convert_8i.h312
-rw-r--r--volk/kernels/volk/volk_32f_s32f_multiply_32f.h221
-rw-r--r--volk/kernels/volk/volk_32f_s32f_normalize.h81
-rw-r--r--volk/kernels/volk/volk_32f_s32f_power_32f.h144
-rw-r--r--volk/kernels/volk/volk_32f_s32f_stddev_32f.h145
-rw-r--r--volk/kernels/volk/volk_32f_sqrt_32f.h77
-rw-r--r--volk/kernels/volk/volk_32f_stddev_and_mean_32f_x2.h170
-rw-r--r--volk/kernels/volk/volk_32f_x2_add_32f.h147
-rw-r--r--volk/kernels/volk/volk_32f_x2_divide_32f.h82
-rw-r--r--volk/kernels/volk/volk_32f_x2_dot_prod_16i.h98
-rw-r--r--volk/kernels/volk/volk_32f_x2_dot_prod_32f.h580
-rw-r--r--volk/kernels/volk/volk_32f_x2_interleave_32fc.h75
-rw-r--r--volk/kernels/volk/volk_32f_x2_max_32f.h85
-rw-r--r--volk/kernels/volk/volk_32f_x2_min_32f.h85
-rw-r--r--volk/kernels/volk/volk_32f_x2_multiply_32f.h226
-rw-r--r--volk/kernels/volk/volk_32f_x2_s32f_interleave_16ic.h156
-rw-r--r--volk/kernels/volk/volk_32f_x2_subtract_32f.h81
-rw-r--r--volk/kernels/volk/volk_32f_x3_sum_of_poly_32f.h152
-rw-r--r--volk/kernels/volk/volk_32fc_32f_dot_prod_32fc.h111
-rw-r--r--volk/kernels/volk/volk_32fc_32f_multiply_32fc.h95
-rw-r--r--volk/kernels/volk/volk_32fc_conjugate_32fc.h128
-rw-r--r--volk/kernels/volk/volk_32fc_deinterleave_32f_x2.h75
-rw-r--r--volk/kernels/volk/volk_32fc_deinterleave_64f_x2.h156
-rw-r--r--volk/kernels/volk/volk_32fc_deinterleave_imag_32f.h68
-rw-r--r--volk/kernels/volk/volk_32fc_deinterleave_real_32f.h68
-rw-r--r--volk/kernels/volk/volk_32fc_deinterleave_real_64f.h66
-rw-r--r--volk/kernels/volk/volk_32fc_index_max_16u.h218
-rw-r--r--volk/kernels/volk/volk_32fc_magnitude_32f.h250
-rw-r--r--volk/kernels/volk/volk_32fc_magnitude_squared_32f.h228
-rw-r--r--volk/kernels/volk/volk_32fc_s32f_atan2_32f.h158
-rw-r--r--volk/kernels/volk/volk_32fc_s32f_deinterleave_real_16i.h81
-rw-r--r--volk/kernels/volk/volk_32fc_s32f_magnitude_16i.h159
-rw-r--r--volk/kernels/volk/volk_32fc_s32f_power_32fc.h111
-rw-r--r--volk/kernels/volk/volk_32fc_s32f_power_spectrum_32f.h126
-rw-r--r--volk/kernels/volk/volk_32fc_s32f_x2_power_spectral_density_32f.h134
-rw-r--r--volk/kernels/volk/volk_32fc_s32fc_multiply_32fc.h178
-rw-r--r--volk/kernels/volk/volk_32fc_s32fc_rotatorpuppet_32fc.h74
-rw-r--r--volk/kernels/volk/volk_32fc_s32fc_x2_rotator_32fc.h257
-rw-r--r--volk/kernels/volk/volk_32fc_x2_conjugate_dot_prod_32fc.h500
-rw-r--r--volk/kernels/volk/volk_32fc_x2_dot_prod_32fc.h562
-rw-r--r--volk/kernels/volk/volk_32fc_x2_multiply_32fc.h170
-rw-r--r--volk/kernels/volk/volk_32fc_x2_multiply_conjugate_32fc.h162
-rw-r--r--volk/kernels/volk/volk_32fc_x2_s32f_square_dist_scalar_mult_32f.h130
-rw-r--r--volk/kernels/volk/volk_32fc_x2_square_dist_32f.h116
-rw-r--r--volk/kernels/volk/volk_32i_s32f_convert_32f.h148
-rw-r--r--volk/kernels/volk/volk_32i_x2_and_32i.h81
-rw-r--r--volk/kernels/volk/volk_32i_x2_or_32i.h81
-rw-r--r--volk/kernels/volk/volk_32u_byteswap.h154
-rw-r--r--volk/kernels/volk/volk_32u_popcnt.h36
-rw-r--r--volk/kernels/volk/volk_64f_convert_32f.h134
-rw-r--r--volk/kernels/volk/volk_64f_x2_max_64f.h71
-rw-r--r--volk/kernels/volk/volk_64f_x2_min_64f.h71
-rw-r--r--volk/kernels/volk/volk_64u_byteswap.h176
-rw-r--r--volk/kernels/volk/volk_64u_popcnt.h52
-rw-r--r--volk/kernels/volk/volk_8i_convert_16i.h156
-rw-r--r--volk/kernels/volk/volk_8i_s32f_convert_32f.h200
-rw-r--r--volk/kernels/volk/volk_8ic_deinterleave_16i_x2.h77
-rw-r--r--volk/kernels/volk/volk_8ic_deinterleave_real_16i.h66
-rw-r--r--volk/kernels/volk/volk_8ic_deinterleave_real_8i.h67
-rw-r--r--volk/kernels/volk/volk_8ic_s32f_deinterleave_32f_x2.h165
-rw-r--r--volk/kernels/volk/volk_8ic_s32f_deinterleave_real_32f.h134
-rw-r--r--volk/kernels/volk/volk_8ic_x2_multiply_conjugate_16ic.h101
-rw-r--r--volk/kernels/volk/volk_8ic_x2_s32f_multiply_conjugate_32fc.h122
-rw-r--r--volk/lib/CMakeLists.txt352
-rw-r--r--volk/lib/gcc_x86_cpuid.h188
-rw-r--r--volk/lib/qa_16s_add_quad_aligned16.cc89
-rw-r--r--volk/lib/qa_16s_add_quad_aligned16.h18
-rw-r--r--volk/lib/qa_16s_branch_4_state_8_aligned16.cc106
-rw-r--r--volk/lib/qa_16s_branch_4_state_8_aligned16.h18
-rw-r--r--volk/lib/qa_16s_permute_and_scalar_add_aligned16.cc78
-rw-r--r--volk/lib/qa_16s_permute_and_scalar_add_aligned16.h18
-rw-r--r--volk/lib/qa_16s_quad_max_star_aligned16.cc60
-rw-r--r--volk/lib/qa_16s_quad_max_star_aligned16.h18
-rw-r--r--volk/lib/qa_32f_fm_detect_aligned16.cc61
-rw-r--r--volk/lib/qa_32f_fm_detect_aligned16.h18
-rw-r--r--volk/lib/qa_32f_index_max_aligned16.cc103
-rw-r--r--volk/lib/qa_32f_index_max_aligned16.h18
-rw-r--r--volk/lib/qa_32fc_index_max_aligned16.cc89
-rw-r--r--volk/lib/qa_32fc_index_max_aligned16.h18
-rw-r--r--volk/lib/qa_32fc_power_spectral_density_32f_aligned16.cc64
-rw-r--r--volk/lib/qa_32fc_power_spectral_density_32f_aligned16.h18
-rw-r--r--volk/lib/qa_32fc_x2_conjugate_dot_prod_32fc_u.cc138
-rw-r--r--volk/lib/qa_32fc_x2_conjugate_dot_prod_32fc_u.h18
-rw-r--r--volk/lib/qa_32u_popcnt_aligned16.cc62
-rw-r--r--volk/lib/qa_32u_popcnt_aligned16.h18
-rw-r--r--volk/lib/qa_64u_popcnt_aligned16.cc62
-rw-r--r--volk/lib/qa_64u_popcnt_aligned16.h18
-rw-r--r--volk/lib/qa_utils.cc477
-rw-r--r--volk/lib/qa_utils.h41
-rw-r--r--volk/lib/testqa.cc90
-rw-r--r--volk/lib/volk_prefs.c50
-rw-r--r--volk/lib/volk_rank_archs.c112
-rw-r--r--volk/lib/volk_rank_archs.h50
-rw-r--r--volk/orc/volk_16i_s32f_deinterleave_32f_x2_a_orc_impl.orc12
-rw-r--r--volk/orc/volk_16ic_deinterleave_16i_x2_a_orc_impl.orc5
-rw-r--r--volk/orc/volk_16ic_deinterleave_real_8i_a_orc_impl.orc6
-rw-r--r--volk/orc/volk_16ic_magnitude_16i_a_orc_impl.orc23
-rw-r--r--volk/orc/volk_16sc_magnitude_32f_aligned16_orc_impl.orc25
-rw-r--r--volk/orc/volk_16u_byteswap_a_orc_impl.orc3
-rw-r--r--volk/orc/volk_32f_s32f_multiply_32f_a_orc_impl.orc5
-rw-r--r--volk/orc/volk_32f_s32f_normalize_a_orc_impl.orc5
-rw-r--r--volk/orc/volk_32f_sqrt_32f_a_orc_impl.orc4
-rw-r--r--volk/orc/volk_32f_x2_add_32f_a_orc_impl.orc5
-rw-r--r--volk/orc/volk_32f_x2_divide_32f_a_orc_impl.orc5
-rw-r--r--volk/orc/volk_32f_x2_dot_prod_32f_a_orc_impl.orc6
-rw-r--r--volk/orc/volk_32f_x2_max_32f_a_orc_impl.orc5
-rw-r--r--volk/orc/volk_32f_x2_min_32f_a_orc_impl.orc5
-rw-r--r--volk/orc/volk_32f_x2_multiply_32f_a_orc_impl.orc5
-rw-r--r--volk/orc/volk_32f_x2_subtract_32f_a_orc_impl.orc5
-rw-r--r--volk/orc/volk_32fc_32f_multiply_32fc_a_orc_impl.orc7
-rw-r--r--volk/orc/volk_32fc_magnitude_32f_a_orc_impl.orc13
-rw-r--r--volk/orc/volk_32fc_s32f_magnitude_16i_a_orc_impl.orc23
-rw-r--r--volk/orc/volk_32fc_s32fc_multiply_32fc_a_orc_impl.orc18
-rw-r--r--volk/orc/volk_32fc_x2_multiply_32fc_a_orc_impl.orc18
-rw-r--r--volk/orc/volk_32i_x2_and_32i_a_orc_impl.orc5
-rw-r--r--volk/orc/volk_32i_x2_or_32i_a_orc_impl.orc5
-rw-r--r--volk/orc/volk_8i_convert_16i_a_orc_impl.orc6
-rw-r--r--volk/orc/volk_8i_s32f_convert_32f_a_orc_impl.orc11
-rw-r--r--volk/spu_lib/gc_spu_macs.h380
-rw-r--r--volk/spu_lib/spu_16s_cmpgt_unaligned.c160
-rw-r--r--volk/spu_lib/spu_16s_vector_subtract_unaligned.c178
-rw-r--r--volk/spu_lib/spu_16s_vector_sum_unaligned.c178
-rw-r--r--volk/spu_lib/spu_32fc_pointwise_multiply_unaligned.c222
-rw-r--r--volk/spu_lib/spu_memcpy_unaligned.c290
-rw-r--r--volk/spu_lib/spu_memset_unaligned.S185
-rw-r--r--volk/tmpl/volk.tmpl.c169
-rw-r--r--volk/tmpl/volk.tmpl.h87
-rw-r--r--volk/tmpl/volk_config_fixed.tmpl.h29
-rw-r--r--volk/tmpl/volk_cpu.tmpl.c184
-rw-r--r--volk/tmpl/volk_cpu.tmpl.h42
-rw-r--r--volk/tmpl/volk_machine_xxx.tmpl.c79
-rw-r--r--volk/tmpl/volk_machines.tmpl.c34
-rw-r--r--volk/tmpl/volk_machines.tmpl.h55
-rw-r--r--volk/tmpl/volk_typedefs.tmpl.h32
-rw-r--r--volk/volk.pc.in14
3007 files changed, 347030 insertions, 1 deletions
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 000000000..49a0e1424
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,9 @@
+#
+# The following turn off LF->CRLF conversion for some files on Windows.
+# these conversions cause syntax errors on MinGW/MSYS. They should not
+# have any effect on non-Windows systems or on Cygwin. Any files that
+# required svn:eof-style=lf under subversion should be included here.
+#
+*.m4 -crlf
+*.ac -crlf
+*.scm -crlf
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 000000000..6300279f2
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,3 @@
+*~
+*.pyc
+*.pyo
diff --git a/AUTHORS b/AUTHORS
new file mode 100644
index 000000000..7338f6140
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1,17 @@
+Eric Blossom <eb@comsec.com> Most of the guts
+Matt Ettus <matt@ettus.com> ongoing code, ideas, bugfixes, the USRP
+John Gilmore <gnu@toad.com> ideas, bug fixes, financial support
+Stephane Fillod <f8cfe@free.fr> SIMD speed ups, lots of other good stuff
+Chuck Swiger <cswiger@widomaker.com> hf stuff, enthusiasm ;)
+Ramakrishnan Muthukrishnan <vu3rdd@gmail.com> Debian packages, Misc. stuff
+Martin Dudok van Heel <nldudok1@olifantasia.com> lots of stuff
+Bob McGwier N4HY <rwmcgwier@gmail.com> wisdom, code, bugfixes.
+Krzysztof Kamieniecki <krys@kamieniecki.com> bugfixes
+Andrew Thomas Beck <Andrew.Beck@postgrads.unisa.edu.au> bugfixes
+Joshua Lackey <jl@noether.uoregon.edu> Original GMSK implementation.
+Johnathan Corgan <jcorgan@corganenterprises.com> Build system, ongoing stuff, release manager
+Bdale Garbee <bdale@gag.com> Debian release packages
+Tom Rondeau <trondeau@vt.edu> Mostly digital waveforms and a little bit of trouble
+Nate Goergen (UMD Student)
+Josh Blum <josh@joshknows.com> OpenGL versions of graphical sinks,
+ The GNU Radio Companion (grc)
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 000000000..be47aab34
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,275 @@
+# Copyright 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.
+
+########################################################################
+if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
+ message(FATAL_ERROR "Prevented in-tree build. This is bad practice.")
+endif(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
+
+########################################################################
+# Project setup
+########################################################################
+cmake_minimum_required(VERSION 2.6)
+project(gnuradio CXX C)
+enable_testing()
+
+#select the release build type by default to get optimization flags
+if(NOT CMAKE_BUILD_TYPE)
+ set(CMAKE_BUILD_TYPE "Release")
+ message(STATUS "Build type not specified: defaulting to release.")
+endif(NOT CMAKE_BUILD_TYPE)
+set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "")
+
+list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules)
+
+# Set the version information here
+set(VERSION_INFO_MAJOR_VERSION 3)
+set(VERSION_INFO_API_COMPAT 6)
+set(VERSION_INFO_MINOR_VERSION 4)
+set(VERSION_INFO_MAINT_VERSION 2)
+include(GrVersion) #setup version info
+
+# Append -O2 optimization flag for Debug builds
+SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O2")
+SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O2")
+
+########################################################################
+# Environment setup
+########################################################################
+IF(NOT DEFINED BOOST_ROOT)
+ SET(BOOST_ROOT ${CMAKE_INSTALL_PREFIX})
+ENDIF()
+
+########################################################################
+# Import executables from a native build (for cross compiling)
+# http://www.vtk.org/Wiki/CMake_Cross_Compiling#Using_executables_in_the_build_created_during_the_build
+########################################################################
+if(IMPORT_EXECUTABLES)
+ include(${IMPORT_EXECUTABLES})
+endif(IMPORT_EXECUTABLES)
+
+#set file that the native build will fill with exports
+set(EXPORT_FILE ${CMAKE_BINARY_DIR}/ImportExecutables.cmake)
+file(WRITE ${EXPORT_FILE}) #blank the file (subdirs will append)
+
+########################################################################
+# Compiler specific setup
+########################################################################
+include(GrMiscUtils) #compiler flag check
+
+if(CMAKE_COMPILER_IS_GNUCXX AND NOT WIN32)
+ #http://gcc.gnu.org/wiki/Visibility
+ GR_ADD_CXX_COMPILER_FLAG_IF_AVAILABLE(-fvisibility=hidden HAVE_VISIBILITY_HIDDEN)
+endif()
+
+if(CMAKE_COMPILER_IS_GNUCXX)
+ GR_ADD_CXX_COMPILER_FLAG_IF_AVAILABLE(-Wsign-compare HAVE_WARN_SIGN_COMPARE)
+ GR_ADD_CXX_COMPILER_FLAG_IF_AVAILABLE(-Wall HAVE_WARN_ALL)
+ GR_ADD_CXX_COMPILER_FLAG_IF_AVAILABLE(-Wno-uninitialized HAVE_WARN_NO_UNINITIALIZED)
+endif(CMAKE_COMPILER_IS_GNUCXX)
+
+if(MSVC)
+ include_directories(${CMAKE_SOURCE_DIR}/cmake/msvc) #missing headers
+ add_definitions(-D_WIN32_WINNT=0x0501) #minimum version required is windows xp
+ add_definitions(-DNOMINMAX) #disables stupidity and enables std::min and std::max
+ add_definitions( #stop all kinds of compatibility warnings
+ -D_SCL_SECURE_NO_WARNINGS
+ -D_CRT_SECURE_NO_WARNINGS
+ -D_CRT_SECURE_NO_DEPRECATE
+ -D_CRT_NONSTDC_NO_DEPRECATE
+ )
+ add_definitions(-DHAVE_CONFIG_H)
+ add_definitions(/MP) #build with multiple processors
+endif(MSVC)
+
+########################################################################
+# Install directories
+########################################################################
+include(GrPlatform) #define LIB_SUFFIX
+set(GR_RUNTIME_DIR bin)
+set(GR_LIBRARY_DIR lib${LIB_SUFFIX})
+set(GR_INCLUDE_DIR include)
+set(GR_DATA_DIR share)
+set(GR_PKG_DATA_DIR ${GR_DATA_DIR}/${CMAKE_PROJECT_NAME})
+set(GR_DOC_DIR ${GR_DATA_DIR}/doc)
+set(GR_PKG_DOC_DIR ${GR_DOC_DIR}/${CMAKE_PROJECT_NAME}-${DOCVER})
+set(GR_CONF_DIR etc)
+set(GR_PKG_CONF_DIR ${GR_CONF_DIR}/${CMAKE_PROJECT_NAME}/conf.d)
+set(GR_LIBEXEC_DIR libexec)
+set(GR_PKG_LIBEXEC_DIR ${GR_LIBEXEC_DIR}/${CMAKE_PROJECT_NAME})
+set(GRC_BLOCKS_DIR ${GR_PKG_DATA_DIR}/grc/blocks)
+set(SYSCONFDIR "${CMAKE_INSTALL_PREFIX}/${GR_CONF_DIR}" CACHE PATH "System configuration directory")
+set(GR_PREFSDIR ${SYSCONFDIR}/${CMAKE_PROJECT_NAME}/conf.d)
+
+OPTION(ENABLE_PERFORMANCE_COUNTERS "Enable block performance counters" OFF)
+if(ENABLE_PERFORMANCE_COUNTERS)
+ message(STATUS "ADDING PERF COUNTERS")
+ add_definitions(-DGR_PERFORMANCE_COUNTERS)
+else(ENABLE_PERFORMANCE_COUNTERS)
+ message(STATUS "NO PERF COUNTERS")
+endif(ENABLE_PERFORMANCE_COUNTERS)
+
+########################################################################
+# Variables replaced when configuring the package config files
+########################################################################
+file(TO_NATIVE_PATH "${CMAKE_INSTALL_PREFIX}" prefix)
+file(TO_NATIVE_PATH "\${prefix}" exec_prefix)
+file(TO_NATIVE_PATH "\${exec_prefix}/${GR_LIBRARY_DIR}" libdir)
+file(TO_NATIVE_PATH "\${prefix}/${GR_INCLUDE_DIR}" includedir)
+file(TO_NATIVE_PATH "${SYSCONFDIR}" SYSCONFDIR)
+file(TO_NATIVE_PATH "${GR_PREFSDIR}" GR_PREFSDIR)
+
+########################################################################
+# Create uninstall target
+########################################################################
+configure_file(
+ ${CMAKE_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in
+ ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake
+@ONLY)
+
+add_custom_target(uninstall
+ ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake
+)
+
+########################################################################
+# Enable python component
+########################################################################
+find_package(PythonLibs)
+find_package(SWIG)
+
+if(SWIG_FOUND)
+ message(STATUS "Minimum SWIG version required is 1.3.31")
+ set(SWIG_VERSION_CHECK FALSE)
+ if("${SWIG_VERSION}" VERSION_GREATER "1.3.30")
+ set(SWIG_VERSION_CHECK TRUE)
+ endif()
+endif(SWIG_FOUND)
+
+include(GrComponent)
+GR_REGISTER_COMPONENT("python-support" ENABLE_PYTHON
+ PYTHONLIBS_FOUND
+ SWIG_FOUND
+ SWIG_VERSION_CHECK
+)
+
+find_package(CppUnit)
+GR_REGISTER_COMPONENT("testing-support" ENABLE_TESTING
+ CPPUNIT_FOUND
+)
+
+########################################################################
+# Add optional dlls specified in DLL_PATHS
+########################################################################
+foreach(path ${DLL_PATHS})
+ file(GLOB _dlls "${path}/*.dll")
+ list(APPEND ALL_DLL_FILES ${_dlls})
+endforeach(path)
+if(DEFINED ALL_DLL_FILES)
+ include(GrPackage)
+ CPACK_COMPONENT("extra_dlls"
+ DISPLAY_NAME "Extra DLLs"
+ DESCRIPTION "Extra DLLs for runtime dependency requirements"
+ )
+ message(STATUS "")
+ message(STATUS "Including the following dlls into the install:")
+ foreach(_dll ${ALL_DLL_FILES})
+ message(STATUS " ${_dll}")
+ endforeach(_dll)
+ install(FILES ${ALL_DLL_FILES} DESTINATION ${GR_RUNTIME_DIR} COMPONENT "extra_dlls")
+endif()
+
+########################################################################
+# Setup volk as a subproject
+########################################################################
+include(GrComponent)
+GR_REGISTER_COMPONENT("volk" ENABLE_VOLK)
+
+set(VOLK_INCLUDE_DIRS
+ ${CMAKE_CURRENT_SOURCE_DIR}/volk/include
+ ${CMAKE_CURRENT_BINARY_DIR}/volk/include
+)
+
+if(ENABLE_VOLK)
+
+include(GrPackage)
+CPACK_SET(CPACK_COMPONENT_GROUP_VOLK_DESCRIPTION "Vector optimized library of kernels")
+
+CPACK_COMPONENT("volk_runtime"
+ GROUP "Volk"
+ DISPLAY_NAME "Runtime"
+ DESCRIPTION "Dynamic link libraries"
+)
+
+CPACK_COMPONENT("volk_devel"
+ GROUP "Volk"
+ DISPLAY_NAME "Development"
+ DESCRIPTION "C++ headers, package config, import libraries"
+)
+
+
+add_subdirectory(volk)
+endif(ENABLE_VOLK)
+
+########################################################################
+# Distribute the README file
+########################################################################
+install(
+ FILES README README.hacking
+ DESTINATION ${GR_PKG_DOC_DIR}
+ COMPONENT "docs"
+)
+
+########################################################################
+# The following dependency libraries are needed by all gr modules:
+########################################################################
+list(APPEND GR_TEST_TARGET_DEPS volk gruel gnuradio-core)
+list(APPEND GR_TEST_PYTHON_DIRS
+ ${CMAKE_SOURCE_DIR}/gruel/src/python
+ ${CMAKE_BINARY_DIR}/gruel/src/swig
+ ${CMAKE_BINARY_DIR}/gnuradio-core/src/python
+ ${CMAKE_BINARY_DIR}/gnuradio-core/src/lib/swig
+)
+
+########################################################################
+# Add subdirectories (in order of deps)
+########################################################################
+add_subdirectory(docs)
+add_subdirectory(gruel)
+add_subdirectory(gnuradio-core)
+add_subdirectory(grc)
+
+add_subdirectory(gr-fft)
+add_subdirectory(gr-filter)
+add_subdirectory(gr-comedi)
+add_subdirectory(gr-qtgui)
+add_subdirectory(gr-utils)
+add_subdirectory(gr-wxgui)
+add_subdirectory(gr-blocks)
+add_subdirectory(gr-scigen)
+
+#finalize cpack after subdirs processed
+include(GrPackage)
+CPACK_FINALIZE()
+
+########################################################################
+# Print summary
+########################################################################
+GR_PRINT_COMPONENT_SUMMARY()
+message(STATUS "Using install prefix: ${CMAKE_INSTALL_PREFIX}")
+message(STATUS "Building for version: ${VERSION} / ${LIBVER}")
diff --git a/COPYING b/COPYING
new file mode 100644
index 000000000..94a9ed024
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,674 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program 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 of the License, or
+ (at your option) any later version.
+
+ This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ <program> Copyright (C) <year> <name of author>
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<http://www.gnu.org/licenses/>.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+<http://www.gnu.org/philosophy/why-not-lgpl.html>.
diff --git a/README b/README
index fc972d873..d8d7e0ebc 100644
--- a/README
+++ b/README
@@ -1 +1,145 @@
-This is not the branch you are looking for
+#
+# Copyright 2001-2007,2009,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.
+#
+
+Welcome to GNU Radio!
+
+
+Please see http://gnuradio.org for the wiki, bug tracking,
+and source code viewer.
+
+If you've got questions about GNU Radio, please subscribe to the
+discuss-gnuradio mailing list and post your questions there.
+http://gnuradio.org/redmine/projects/gnuradio/wiki/MailingLists
+
+There is also a "Build Guide" in the wiki that contains OS specific
+recommendations:
+http://gnuradio.org/redmine/projects/gnuradio/wiki/BuildGuide
+
+
+The bleeding edge code can be found in our git repository at
+http://gnuradio.org/git/gnuradio.git/. To checkout the latest, use
+this command:
+
+ $ git clone git://gnuradio.org/gnuradio
+
+For information about using Git, please see:
+http://gnuradio.org/redmine/projects/gnuradio/wiki/DevelopingWithGit
+
+
+How to Build GNU Radio:
+
+For more complete instructions, see the "Building GNU Radio" page in
+the GNU Radio manual (can be built or found online at
+http://gnuradio.org/doc/doxygen/page_build.html).
+
+See these steps fow a quick build guide.
+
+ (1) Ensure that you've satisfied the external dependencies. These
+ dependencies are listed in the manual's build page and are not
+ presented here to reduce duplication errors.
+
+ On systems using pkgsrc (e.g. NetBSD and Dragonfly), build
+ meta-packages/gnuradio, which will build a previous release and
+ force installation of the dependencies. Then pkg_delete the
+ gnuradio package, which will leave the dependencies. (This
+ should also work on OSX.)
+
+ See the wiki at http://gnuradio.org for details.
+
+
+ (2) Building from cmake:
+
+ $ mkdir $(builddir)
+ $ cd $(builddir)
+ $ cmake [OPTIONS] $(srcdir)
+ $ make
+ $ make test
+ $ sudo make install
+
+
+That's it!
+
+Options:
+Useful options include setting the install prefix and the build type:
+
+ -DCMAKE_INSTALL_PREFIX=<directory to install to>
+ -DCMAKE_BUILD_TYPE="<type>"
+
+Currently, GNU Radio has a "Debug" type that builds with '-g -O2'
+useful for debugging the software and a "Release" type that builds
+with '-O3', which is the default.
+
+
+-------------------------------------------------------------------------------
+
+ KNOWN INCOMPATIBILITIES
+
+
+ GNU Radio triggers bugs in g++ 3.3 for X86. DO NOT USE GCC 3.3 on
+ the X86 platform. g++ 3.2, 3.4, and the 4.* series are known to work well.
+
+-------------------------------------------------------------------------------
+
+-------------------------------------------------------------------------------
+
+ NOTES
+
+-------------------------------------------------------------------------------
+
+To run the examples you may need to set PYTHONPATH. Note that the
+prefix and python version number in the path needs to match your
+installed version of python.
+
+ $ export PYTHONPATH=/usr/local/lib/python2.7/dist-packages
+
+You may want to add this to your shell init file (~/.bash_profile if
+you use bash).
+
+
+Another handy trick if for example your fftw includes and libs are
+installed in, say ~/local/include and ~/local/lib, instead of
+/usr/local is this:
+
+ $ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/local/lib
+ $ make CPPFLAGS="-I$HOME/local/include"
+
+
+Sometimes the prerequisites are installed in a location which is not
+included in the default compiler and linker search paths. This
+happens with pkgsrc and NetBSD. To build, tell configure to use these
+locations:
+
+ LDFLAGS="-L/usr/pkg/lib -R/usr/pkg/lib" CPPFLAGS="-I/usr/pkg/include" ./configure --prefix=/usr/gnuradio
+
+
+-------------------------------------------------------------------------------
+
+ Legal Matters
+
+-------------------------------------------------------------------------------
+
+Some files have been changed many times throughout the
+years. Copyright notices at the tops of these files list which years
+changes have been made. For some files, changes have occurred in many
+consecutive years. These files may often have the format of a year
+range (e.g., "2006 - 2011"), which indicates that these files have had
+copyrightable changes made during each year in the range, inclusive.
+
diff --git a/README-win32-mingw-short.txt b/README-win32-mingw-short.txt
new file mode 100644
index 000000000..0e82a705d
--- /dev/null
+++ b/README-win32-mingw-short.txt
@@ -0,0 +1,92 @@
+Building and using gnuradio on windows (win32) using mingw
+
+Required tools and libraries
+
+MingW and Msys
+Download the latest stable version from the mingw site oand follow their installation instructions)
+
+Python for windows version 2.4 (or higher)
+You do not need to build this yourself.
+You can just install the windows executable which you can find on the python site.
+I am not sure if it will work if you have speces in your python pathname.
+I recommend installing it in C:\Python24 or D:\Python24
+
+Libtool
+If you are building from cvs you need a recent libtool
+msys comes with libtool, but the version distributed with current mingw doesn't work with gnuradio.
+download, build and install a recent libtool
+
+cppunit
+Build and install cppunit
+
+boost
+build and install boost (maybe you can get away with only unpacking the source, we only use the boost header files)
+If you build boost, you first have to download jam (boost jam) for win32. (Do not use build and use the cygwin version)
+
+build environment:
+You need to have the following files on your PATH:
+python.exe python24.dll libcppunit-1-10-2.dll libfftw3f-3.dll fftwf-wisdom.exe cppunit-config
+If you have cygwin installed Make sure that NO cygwin executables are on your path.
+
+needed on PATH:
+/usr/local/bin
+/mingw/bin
+/bin
+/c/Python24/ python.exe
+/c/Python24/libs python24.dll
+/c/Python24/DLLs
+/usr/local/bin or /mingw/bin or /my/special/installed/lib/folder/bin
+ libcppunit-1-10-2.dll
+ libfftw3f-3.dll
+ fftw-wisdom-to-conf
+ fftwf-wisdom.exe
+ cppunit-config
+/c/WINNT/system32
+/c/WINNT
+
+
+I made a little script set_clean_path.sh to set my path for building gnuradio where I just discard the original PATH (to get rid of the cygwin executables on my default path) and just include what is needed:
+
+#!/bin/sh
+export PATH=".:/usr/local/bin:/mingw/bin:/bin:/c/Python24:/c/Python24/DLLs:/c/Python24/libs:/my/special/installed/lib/folder/bin:/c/WINNT/system32:/c/WINNT:/c/WINNT/System32/Wbem:.
+
+You need to source this script to set the PATH.
+. ./set_clean_path.sh
+(notice the extra dot and space in the beginning of the line, this means source this file. Sourcing means execute it and remember all environment variables set in this script)
+
+If you are building from cvs it is recommended that you edit bootstrap to your needs and use it
+If you built a recent libtool and didn't overwrite the original libtool
+(because you installed the new version in /usr/local) then you have to tell aclocal to use the more recent libtool m4 macros.
+You can do this by appending -I /usr/local/share/aclocal to the aclocal commandline
+I also changed the aclocal and automake invocations to use the most recent version in my bootstrap script
+Here follows the bootstrap script I use
+
+#!/bin/sh
+rm -fr config.cache autom4te*.cache
+
+aclocal-1.8 -I config -I /usr/local/share/aclocal
+autoconf
+autoheader
+libtoolize --automake
+automake-1.8 --add-missing
+
+If you run this script it will convert a clean cvs checkout to a version which you can configure, build and install
+
+So now you can configure gnuradio.
+On win32 /mingw you need to give it a few parameters
+You need to tell it where cppunit is installed
+where boost include files are to be found
+where the pkg-config of libfftw is to be found
+to use a generic cpu (no 3Dnow,SSE,MMX) (This option will not be needed anymore soon)
+If you have boost installed in C:\boost_1_32_0 and cppunit and fftw in /usr/local then you would need the following configur commandline
+$ ./configure --with-md-cpu=generic --with-cppunit-prefix=/usr/local --with-boost-include-dir=/c/boost_1_32_0/include/boost-1_32 PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
+
+If everything went well you cannow do
+make
+make install
+
+Now you have a working gnuradio-core
+Now you can go on building and installing gr-audio-windows and windows and wxgui
+remember that all gnuradio and python dlls need to be on your path to use gnuradio
+The gnuradio dlls are installed at
+/c/Python24/Lib/site-packages:/c/Python24/Lib/site-packages/gnuradio:/c/Python24/Lib/site-packages/gnuradio/gr
diff --git a/README.building-boost b/README.building-boost
new file mode 100644
index 000000000..a281e8bd7
--- /dev/null
+++ b/README.building-boost
@@ -0,0 +1,48 @@
+Most distributions have the required version of Boost (1.35) ready for
+installation using their standard package installation tools (apt-get,
+yum, etc.).
+
+If running a distribution that requires boost 1.35 (or later) be built
+from scratch, these instructions explain how to do so, and in a way
+that allows it to peacefully coexist with earlier versions of boost.
+
+Download the latest version of boost from boost.sourceforge.net.
+(boost_1_49_0.tar.bz2 was the latest when this was written). Different
+Boost versions often have different installations. If these
+instructions don't work, check the website www.boost.org for more
+help.
+
+unpack it somewhere
+cd into the resulting directory
+
+$ cd boost_1_49_0
+
+# Pick a prefix to install it into. I used /opt/boost_1_49_0
+
+$ BOOST_PREFIX=/opt/boost_1_49_0
+
+$ ./bootstrap.sh
+$ sudo ./b2 --prefix=$BOOST_PREFIX --with-thread --with-date_time --with-program_options --with-filesystem --with-system --layout=versioned threading=multi variant=release install
+
+# Done! That was easy!
+
+Note that you don't have to specify each library, which will then
+build all Boost libraries and projects. By specifying only those
+required will just save compilation time.
+
+
+----------------------------------------------------------------------
+
+
+Installing GNU Radio with new Boost libraries.
+
+Tell cmake to look for the Boost libraries and header files in the new location with the folloing command:
+
+$ cd <build directory>
+$ cmake -DBOOST_ROOT=$BOOST_PREFIX -DBoost_INCLUDE_DIR=$BOOST_PREFIX/include/boost-1_49/ -DBoost_LIBRARY_DIRS=$BOOST_PREFIX/lib <path to gnuradio source tree>
+$ make
+$ make test
+$ sudo make install
+
+See README for more installation details.
+
diff --git a/README.hacking b/README.hacking
new file mode 100644
index 000000000..58b269887
--- /dev/null
+++ b/README.hacking
@@ -0,0 +1,320 @@
+# -*- Outline -*-
+#
+# Copyright 2004,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.
+#
+
+Random notes on coding conventions, some explanations about why things
+aren't done differently, etc, etc,
+
+
+* Boost 1.35
+
+Until boost 1.35 or later is common in distributions, you'll need to
+build boost from source yourself. See README.building-boost.
+
+Also, when running make distcheck you'll need to provide the
+DISTCHECK_CONFIGURE_FLAGS. E.g.,
+
+ $ make distcheck DISTCHECK_CONFIGURE_FLAGS=--with-boost=/opt/boost_1_36_0
+
+
+* C++ and Python
+
+GNU Radio is now a hybrid system. Some parts of the system are built
+in C++ and some of it in Python. In general, prefer Python to C++.
+Signal processing primitives are still built in C++ for performance.
+
+
+* C++ namespaces
+
+In the cleanup process, I considered putting everything in the
+gnuradio namespace and dropping the Gr|gr prefix. In fact, I think
+it's probably the right idea, but when I tested it out, I ran into
+problems with SWIG's handling of namespaces. Bottom line, SWIG
+(1.3.21) got confused and generated bad code when I started playing
+around with namespaces in a not particularly convoluted way. I saw
+problems using the boost::shared_ptr template in combination with
+classes defined in the gnuradio namespace. It wasn't pretty...
+
+
+* Naming conventions
+
+Death to CamelCaseNames! We've returned to a kinder, gentler era.
+We're now using the "STL style" naming convention with a couple of
+modifications since we're not using namespaces.
+
+With the exception of macros and other constant values, all
+identifiers shall be lower case with words_separated_like_this.
+
+Macros and constant values (e.g., enumerated values,
+static const int FOO = 23) shall be in UPPER_CASE.
+
+
+** Global names
+
+All globally visible names (types, functions, variables, consts, etc)
+shall begin with a "package prefix", followed by an '_'. The bulk of
+the code in GNU Radio logically belongs to the "gr" package, hence
+names look like gr_open_file (...).
+
+Large coherent bodies of code may use other package prefixes, but
+let's try to keep them to a well thought out list. See the list
+below.
+
+*** Package prefixes
+
+These are the current package prefixes:
+
+ gr_ Almost everything
+
+ gri_ Implementation primitives. Sometimes we
+ have both a gr_<foo> and a gri_<foo>. In that case,
+ gr_<foo> would be derived from gr_block and gri_<foo>
+ would be the low level guts of the function.
+
+ atsc_ Code related to the Advanced Television
+ Standards Committee HDTV implementation
+
+ qa_ Quality Assurance. Test code.
+
+
+** Class data members (instance variables)
+
+All class data members shall begin with d_<foo>.
+
+The big win is when you're staring at a block of code it's obvious
+which of the things being assigned to persist outside of the block.
+This also keeps you from having to be creative with parameter names
+for methods and constructors. You just use the same name as the
+instance variable, without the d_.
+
+class gr_wonderfulness {
+ std::string d_name;
+ double d_wonderfulness_factor;
+
+public:
+ gr_wonderfulness (std::string name, double wonderfulness_factor)
+ : d_name (name), d_wonderfulness_factor (wonderfulness_factor)
+ {
+ ...
+ }
+ ...
+};
+
+
+** Class static data members (class variables)
+
+All class static data members shall begin with s_<foo>.
+
+
+** File names
+
+Each significant class shall be contained in it's own file. The
+declaration of class gr_foo shall be in gr_foo.h, the definition in
+gr_foo.cc.
+
+
+
+* Storage management
+
+Strongly consider using the boost smart pointer templates, scoped_ptr
+and shared_ptr. scoped_ptr should be used for locals that contain
+pointers to objects that we need to delete when we exit the current
+scope. shared_ptr implements transparent reference counting and is a
+major win. You never have to worry about calling delete. The right
+thing happens.
+
+See http://www.boost.org/libs/smart_ptr/smart_ptr.htm
+
+
+* Unit tests
+
+Build unit tests for everything non-trivial and run them after every
+change. Check out Extreme Programming:
+http://c2.com/cgi/wiki?ExtremeProgrammingRoadmap
+
+Unit tests should also be written for all examples. This should kill
+off the bit rot we've been plagued with.
+
+** C++ unit tests
+
+For C++ we're using the cppunit framework. cppunit has its bad
+smells, but it's mostly workable. http://cppunit.sf.net
+
+Currently each directory <dirname> contains files qa_<dirname>.{h,cc}
+that bring together all the qa_<foo> test suites in the directory.
+We ought to be able to automate this without too much trouble.
+
+The directory gnuradio-core/src/tests contains programs that run
+the tests. test_all runs all of the registered C++ unit tests.
+
+As far as I can tell, the cppunit TestFactoryRegistry maybe able to be
+tricked into doing what we want. As is, I don't think it's enough by
+itself, since there's nothing dragging the qa* files out of the
+library and into the program. I haven't tested out this idea.
+
+** Python unit tests
+
+We use the standard unittest package for unit testing of Python code.
+
+
+* Subversion line ending styles
+
+All text files in the tree should have the subversion property
+'svn:eol-style' set to 'native', with the following exceptions:
+
+config/*.m4
+configure.ac
+gr-howto-write-a-block/config/*.m4
+gr-howto-write-a-block/configure.ac
+
+The easiest way to ensure this is to add or edit the following lines in
+your svn client configuration file (~/.subversion/config):
+
+enable-auto-props=yes
+
+[auto-props]
+*.c = svn:eol-style=native
+*.cc = svn:eol-style=native
+*.i = svn:eol-style=native
+*.h = svn:eol-style=native
+*.am = svn:eol-style=native
+*.py = svn:eol-style=native
+*.ac = svn:eol-style=LF
+*.m4 = svn:eol-style=LF
+
+* Misc tips
+
+ccache, a compiler cache, can really speed up your builds.
+See http://ccache.samba.org/
+
+Be sure to create links for gcc and g++
+
+
+* Standard command line options
+
+When writing programs that are executable from the command line,
+please follow these guidelines for command line argument names (short
+and long) and types of the arguments. We list them below using the
+Python optparse syntax. In general, the default value should be coded
+into the help string using the "... [default=%default]" syntax.
+
+** Mandatory options by gr_block
+
+*** Audio source
+
+Any program using an audio source shall include:
+
+ add_option("-I", "--audio-input", type="string", default="",
+ help="pcm input device name. E.g., hw:0,0 or /dev/dsp")
+
+The default must be "". This allows an audio module-dependent default
+to be specified in the user preferences file.
+
+
+*** Audio sink
+
+ add_option("-O", "--audio-output", type="string", default="",
+ help="pcm output device name. E.g., hw:0,0 or /dev/dsp")
+
+The default must be "". This allows an audio module-dependent default
+to be specified in the user preferences file.
+
+
+** Standard options names by parameter
+
+Whenever you want an integer, use the "intx" type. This allows the
+user to input decimal, hex or octal numbers. E.g., 10, 012, 0xa.
+
+Whenever you want a float, use the "eng_float" type. This allows the
+user to input numbers with SI suffixes. E.g, 10000, 10k, 10M, 10m, 92.1M
+
+If your program allows the user to specify values for any of the
+following parameters, please use these options to specify them:
+
+
+To specify a frequency (typically an RF center frequency) use:
+
+ add_option("-f", "--freq", type="eng_float", default=<your-default-here>,
+ help="set frequency to FREQ [default=%default]")
+
+
+To specify a decimation factor use:
+
+ add_option("-d", "--decim", type="intx", default=<your-default-here>,
+ help="set decimation rate to DECIM [default=%default]")
+
+
+To specify an interpolation factor use:
+
+ add_option("-i", "--interp", type="intx", default=<your-default-here>,
+ help="set interpolation rate to INTERP [default=%default]")
+
+
+To specify a gain setting use:
+
+ add_option("-g", "--gain", type="eng_float", default=<your-default-here>,
+ help="set gain in dB [default=%default]")
+
+
+If your application specifies both a tx and an rx gain, use:
+
+ add_option("", "--rx-gain", type="eng_float", default=<your-default-here>,
+ help="set receive gain in dB [default=%default]")
+
+ add_option("", "--tx-gain", type="eng_float", default=<your-default-here>,
+ help="set transmit gain in dB [default=%default]")
+
+
+To specify the number of channels of something use:
+
+ add_option("-n", "--nchannels", type="intx", default=1,
+ help="specify number of channels [default=%default]")
+
+
+To specify an output filename use:
+
+ add_option("-o", "--output-filename", type="string", default=<your-default-here>,
+ help="specify output-filename [default=%default]")
+
+
+To specify a rate use:
+
+ add_option("-r", "--bit-rate", type="eng_float", default=<your-default-here>,
+ help="specify bit-rate [default=%default]")
+ or
+
+ add_option("-r", "--sample-rate", type="eng_float", default=<your-default-here>,
+ help="specify sample-rate [default=%default]")
+
+
+If your application has a verbose option, use:
+
+ add_option('-v', '--verbose', action="store_true", default=False,
+ help="verbose output")
+
+
+If your application allows the user to specify the "fast USB" options, use:
+
+ add_option("", "--fusb-block-size", type="intx", default=0,
+ help="specify fast usb block size [default=%default]")
+
+ add_option("", "--fusb-nblocks", type="intx", default=0,
+ help="specify number of fast usb blocks [default=%default]")
diff --git a/cmake/Modules/CMakeMacroLibtoolFile.cmake b/cmake/Modules/CMakeMacroLibtoolFile.cmake
new file mode 100644
index 000000000..2ec791207
--- /dev/null
+++ b/cmake/Modules/CMakeMacroLibtoolFile.cmake
@@ -0,0 +1,62 @@
+#http://www.vtk.org/Wiki/CMakeMacroLibtoolFile
+#This macro creates a libtool .la file for shared libraries or plugins. The first parameter is the target name of the library, the second parameter is the directory where it will be installed to. E.g. for a KDE 3.x module named "kfoo" the usage would be as follows:
+
+#The macro GET_TARGET_PROPERTY_WITH_DEFAULT is helpful to handle properties with default values.
+
+#ADD_LIBRARY(foo SHARED kfoo1.cpp kfoo2.cpp)
+#CREATE_LIBTOOL_FILE(foo /lib/kde3)
+
+if(DEFINED __INCLUDED_CREATE_LIBTOOL_FILE)
+ return()
+endif()
+set(__INCLUDED_CREATE_LIBTOOL_FILE TRUE)
+
+ MACRO(GET_TARGET_PROPERTY_WITH_DEFAULT _variable _target _property _default_value)
+ GET_TARGET_PROPERTY (${_variable} ${_target} ${_property})
+ IF (${_variable} MATCHES NOTFOUND)
+ SET (${_variable} ${_default_value})
+ ENDIF (${_variable} MATCHES NOTFOUND)
+ ENDMACRO (GET_TARGET_PROPERTY_WITH_DEFAULT)
+
+ MACRO(CREATE_LIBTOOL_FILE _target _install_DIR)
+ GET_TARGET_PROPERTY(_target_location ${_target} LOCATION)
+ GET_TARGET_PROPERTY_WITH_DEFAULT(_target_static_lib ${_target} STATIC_LIB "")
+ GET_TARGET_PROPERTY_WITH_DEFAULT(_target_dependency_libs ${_target} LT_DEPENDENCY_LIBS "")
+ GET_TARGET_PROPERTY_WITH_DEFAULT(_target_current ${_target} LT_VERSION_CURRENT 0)
+ GET_TARGET_PROPERTY_WITH_DEFAULT(_target_age ${_target} LT_VERSION_AGE 0)
+ GET_TARGET_PROPERTY_WITH_DEFAULT(_target_revision ${_target} LT_VERSION_REVISION 0)
+ GET_TARGET_PROPERTY_WITH_DEFAULT(_target_installed ${_target} LT_INSTALLED yes)
+ GET_TARGET_PROPERTY_WITH_DEFAULT(_target_shouldnotlink ${_target} LT_SHOULDNOTLINK yes)
+ GET_TARGET_PROPERTY_WITH_DEFAULT(_target_dlopen ${_target} LT_DLOPEN "")
+ GET_TARGET_PROPERTY_WITH_DEFAULT(_target_dlpreopen ${_target} LT_DLPREOPEN "")
+ GET_FILENAME_COMPONENT(_laname ${_target_location} NAME_WE)
+ GET_FILENAME_COMPONENT(_soname ${_target_location} NAME)
+ SET(_laname ${CMAKE_CURRENT_BINARY_DIR}/${_laname}.la)
+ FILE(WRITE ${_laname} "# ${_laname} - a libtool library file\n")
+ FILE(WRITE ${_laname} "# Generated by CMake ${CMAKE_VERSION} (like GNU libtool)\n")
+ FILE(WRITE ${_laname} "\n# Please DO NOT delete this file!\n# It is necessary for linking the library with libtool.\n\n" )
+ FILE(APPEND ${_laname} "# The name that we can dlopen(3).\n")
+ FILE(APPEND ${_laname} "dlname='${_soname}'\n\n")
+ FILE(APPEND ${_laname} "# Names of this library.\n")
+ FILE(APPEND ${_laname} "library_names='${_soname}.${_target_current}.${_target_age}.${_target_revision} ${_soname}.${_target_current} ${_soname}'\n\n")
+ FILE(APPEND ${_laname} "# The name of the static archive.\n")
+ FILE(APPEND ${_laname} "old_library='${_target_static_lib}'\n\n")
+ FILE(APPEND ${_laname} "# Libraries that this one depends upon.\n")
+ FILE(APPEND ${_laname} "dependency_libs='${_target_dependency_libs}'\n\n")
+ FILE(APPEND ${_laname} "# Names of additional weak libraries provided by this library\n")
+ FILE(APPEND ${_laname} "weak_library_names=\n\n")
+ FILE(APPEND ${_laname} "# Version information for ${_laname}.\n")
+ FILE(APPEND ${_laname} "current=${_target_current}\n")
+ FILE(APPEND ${_laname} "age=${_target_age}\n")
+ FILE(APPEND ${_laname} "revision=${_target_revision}\n\n")
+ FILE(APPEND ${_laname} "# Is this an already installed library?\n")
+ FILE(APPEND ${_laname} "installed=${_target_installed}\n\n")
+ FILE(APPEND ${_laname} "# Should we warn about portability when linking against -modules?\n")
+ FILE(APPEND ${_laname} "shouldnotlink=${_target_shouldnotlink}\n\n")
+ FILE(APPEND ${_laname} "# Files to dlopen/dlpreopen\n")
+ FILE(APPEND ${_laname} "dlopen='${_target_dlopen}'\n")
+ FILE(APPEND ${_laname} "dlpreopen='${_target_dlpreopen}'\n\n")
+ FILE(APPEND ${_laname} "# Directory that this library needs to be installed in:\n")
+ FILE(APPEND ${_laname} "libdir='${CMAKE_INSTALL_PREFIX}${_install_DIR}'\n")
+ INSTALL( FILES ${_laname} DESTINATION ${CMAKE_INSTALL_PREFIX}${_install_DIR})
+ ENDMACRO(CREATE_LIBTOOL_FILE)
diff --git a/cmake/Modules/CMakeParseArgumentsCopy.cmake b/cmake/Modules/CMakeParseArgumentsCopy.cmake
new file mode 100644
index 000000000..7ce4c49ae
--- /dev/null
+++ b/cmake/Modules/CMakeParseArgumentsCopy.cmake
@@ -0,0 +1,138 @@
+# CMAKE_PARSE_ARGUMENTS(<prefix> <options> <one_value_keywords> <multi_value_keywords> args...)
+#
+# CMAKE_PARSE_ARGUMENTS() is intended to be used in macros or functions for
+# parsing the arguments given to that macro or function.
+# It processes the arguments and defines a set of variables which hold the
+# values of the respective options.
+#
+# The <options> argument contains all options for the respective macro,
+# i.e. keywords which can be used when calling the macro without any value
+# following, like e.g. the OPTIONAL keyword of the install() command.
+#
+# The <one_value_keywords> argument contains all keywords for this macro
+# which are followed by one value, like e.g. DESTINATION keyword of the
+# install() command.
+#
+# The <multi_value_keywords> argument contains all keywords for this macro
+# which can be followed by more than one value, like e.g. the TARGETS or
+# FILES keywords of the install() command.
+#
+# When done, CMAKE_PARSE_ARGUMENTS() will have defined for each of the
+# keywords listed in <options>, <one_value_keywords> and
+# <multi_value_keywords> a variable composed of the given <prefix>
+# followed by "_" and the name of the respective keyword.
+# These variables will then hold the respective value from the argument list.
+# For the <options> keywords this will be TRUE or FALSE.
+#
+# All remaining arguments are collected in a variable
+# <prefix>_UNPARSED_ARGUMENTS, this can be checked afterwards to see whether
+# your macro was called with unrecognized parameters.
+#
+# As an example here a my_install() macro, which takes similar arguments as the
+# real install() command:
+#
+# function(MY_INSTALL)
+# set(options OPTIONAL FAST)
+# set(oneValueArgs DESTINATION RENAME)
+# set(multiValueArgs TARGETS CONFIGURATIONS)
+# cmake_parse_arguments(MY_INSTALL "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
+# ...
+#
+# Assume my_install() has been called like this:
+# my_install(TARGETS foo bar DESTINATION bin OPTIONAL blub)
+#
+# After the cmake_parse_arguments() call the macro will have set the following
+# variables:
+# MY_INSTALL_OPTIONAL = TRUE
+# MY_INSTALL_FAST = FALSE (this option was not used when calling my_install()
+# MY_INSTALL_DESTINATION = "bin"
+# MY_INSTALL_RENAME = "" (was not used)
+# MY_INSTALL_TARGETS = "foo;bar"
+# MY_INSTALL_CONFIGURATIONS = "" (was not used)
+# MY_INSTALL_UNPARSED_ARGUMENTS = "blub" (no value expected after "OPTIONAL"
+#
+# You can the continue and process these variables.
+#
+# Keywords terminate lists of values, e.g. if directly after a one_value_keyword
+# another recognized keyword follows, this is interpreted as the beginning of
+# the new option.
+# E.g. my_install(TARGETS foo DESTINATION OPTIONAL) would result in
+# MY_INSTALL_DESTINATION set to "OPTIONAL", but MY_INSTALL_DESTINATION would
+# be empty and MY_INSTALL_OPTIONAL would be set to TRUE therefor.
+
+#=============================================================================
+# Copyright 2010 Alexander Neundorf <neundorf@kde.org>
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+
+if(__CMAKE_PARSE_ARGUMENTS_INCLUDED)
+ return()
+endif()
+set(__CMAKE_PARSE_ARGUMENTS_INCLUDED TRUE)
+
+
+function(CMAKE_PARSE_ARGUMENTS prefix _optionNames _singleArgNames _multiArgNames)
+ # first set all result variables to empty/FALSE
+ foreach(arg_name ${_singleArgNames} ${_multiArgNames})
+ set(${prefix}_${arg_name})
+ endforeach(arg_name)
+
+ foreach(option ${_optionNames})
+ set(${prefix}_${option} FALSE)
+ endforeach(option)
+
+ set(${prefix}_UNPARSED_ARGUMENTS)
+
+ set(insideValues FALSE)
+ set(currentArgName)
+
+ # now iterate over all arguments and fill the result variables
+ foreach(currentArg ${ARGN})
+ list(FIND _optionNames "${currentArg}" optionIndex) # ... then this marks the end of the arguments belonging to this keyword
+ list(FIND _singleArgNames "${currentArg}" singleArgIndex) # ... then this marks the end of the arguments belonging to this keyword
+ list(FIND _multiArgNames "${currentArg}" multiArgIndex) # ... then this marks the end of the arguments belonging to this keyword
+
+ if(${optionIndex} EQUAL -1 AND ${singleArgIndex} EQUAL -1 AND ${multiArgIndex} EQUAL -1)
+ if(insideValues)
+ if("${insideValues}" STREQUAL "SINGLE")
+ set(${prefix}_${currentArgName} ${currentArg})
+ set(insideValues FALSE)
+ elseif("${insideValues}" STREQUAL "MULTI")
+ list(APPEND ${prefix}_${currentArgName} ${currentArg})
+ endif()
+ else(insideValues)
+ list(APPEND ${prefix}_UNPARSED_ARGUMENTS ${currentArg})
+ endif(insideValues)
+ else()
+ if(NOT ${optionIndex} EQUAL -1)
+ set(${prefix}_${currentArg} TRUE)
+ set(insideValues FALSE)
+ elseif(NOT ${singleArgIndex} EQUAL -1)
+ set(currentArgName ${currentArg})
+ set(${prefix}_${currentArgName})
+ set(insideValues "SINGLE")
+ elseif(NOT ${multiArgIndex} EQUAL -1)
+ set(currentArgName ${currentArg})
+ set(${prefix}_${currentArgName})
+ set(insideValues "MULTI")
+ endif()
+ endif()
+
+ endforeach(currentArg)
+
+ # propagate the result variables to the caller:
+ foreach(arg_name ${_singleArgNames} ${_multiArgNames} ${_optionNames})
+ set(${prefix}_${arg_name} ${${prefix}_${arg_name}} PARENT_SCOPE)
+ endforeach(arg_name)
+ set(${prefix}_UNPARSED_ARGUMENTS ${${prefix}_UNPARSED_ARGUMENTS} PARENT_SCOPE)
+
+endfunction(CMAKE_PARSE_ARGUMENTS _options _singleArgs _multiArgs)
diff --git a/cmake/Modules/FindALSA.cmake b/cmake/Modules/FindALSA.cmake
new file mode 100644
index 000000000..e3e6624ff
--- /dev/null
+++ b/cmake/Modules/FindALSA.cmake
@@ -0,0 +1,36 @@
+# - Try to find ALSA
+# Once done, this will define
+#
+# ALSA_FOUND - system has ALSA (GL and GLU)
+# ALSA_INCLUDE_DIRS - the ALSA include directories
+# ALSA_LIBRARIES - link these to use ALSA
+# ALSA_GL_LIBRARY - only GL
+# ALSA_GLU_LIBRARY - only GLU
+#
+# See documentation on how to write CMake scripts at
+# http://www.cmake.org/Wiki/CMake:How_To_Find_Libraries
+
+include(LibFindMacros)
+
+libfind_pkg_check_modules(ALSA_PKGCONF alsa)
+
+find_path(ALSA_INCLUDE_DIR
+ NAMES alsa/version.h
+ PATHS ${ALSA_PKGCONF_INCLUDE_DIRS}
+)
+
+find_library(ALSA_LIBRARY
+ NAMES asound
+ PATHS ${ALSA_PKGCONF_LIBRARY_DIRS}
+)
+
+# Extract the version number
+IF(ALSA_INCLUDE_DIR)
+file(READ "${ALSA_INCLUDE_DIR}/alsa/version.h" _ALSA_VERSION_H_CONTENTS)
+string(REGEX REPLACE ".*#define SND_LIB_VERSION_STR[ \t]*\"([^\n]*)\".*" "\\1" ALSA_VERSION "${_ALSA_VERSION_H_CONTENTS}")
+ENDIF(ALSA_INCLUDE_DIR)
+
+set(ALSA_PROCESS_INCLUDES ALSA_INCLUDE_DIR)
+set(ALSA_PROCESS_LIBS ALSA_LIBRARY)
+libfind_process(ALSA)
+
diff --git a/cmake/Modules/FindCppUnit.cmake b/cmake/Modules/FindCppUnit.cmake
new file mode 100644
index 000000000..9af308f84
--- /dev/null
+++ b/cmake/Modules/FindCppUnit.cmake
@@ -0,0 +1,36 @@
+# http://www.cmake.org/pipermail/cmake/2006-October/011446.html
+# Modified to use pkg config and use standard var names
+
+#
+# Find the CppUnit includes and library
+#
+# This module defines
+# CPPUNIT_INCLUDE_DIR, where to find tiff.h, etc.
+# CPPUNIT_LIBRARIES, the libraries to link against to use CppUnit.
+# CPPUNIT_FOUND, If false, do not try to use CppUnit.
+
+INCLUDE(FindPkgConfig)
+PKG_CHECK_MODULES(PC_CPPUNIT "cppunit")
+
+FIND_PATH(CPPUNIT_INCLUDE_DIRS
+ NAMES cppunit/TestCase.h
+ HINTS ${PC_CPPUNIT_INCLUDE_DIR}
+ PATHS
+ /usr/local/include
+ /usr/include
+)
+
+FIND_LIBRARY(CPPUNIT_LIBRARIES
+ NAMES cppunit
+ HINTS ${PC_CPPUNIT_LIBDIR}
+ PATHS
+ ${CPPUNIT_INCLUDE_DIRS}/../lib
+ /usr/local/lib
+ /usr/lib
+)
+
+LIST(APPEND CPPUNIT_LIBRARIES ${CMAKE_DL_LIBS})
+
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(CPPUNIT DEFAULT_MSG CPPUNIT_LIBRARIES CPPUNIT_INCLUDE_DIRS)
+MARK_AS_ADVANCED(CPPUNIT_LIBRARIES CPPUNIT_INCLUDE_DIRS)
diff --git a/cmake/Modules/FindFFTW3f.cmake b/cmake/Modules/FindFFTW3f.cmake
new file mode 100644
index 000000000..0ee7e46fe
--- /dev/null
+++ b/cmake/Modules/FindFFTW3f.cmake
@@ -0,0 +1,41 @@
+# http://tim.klingt.org/code/projects/supernova/repository/revisions/d336dd6f400e381bcfd720e96139656de0c53b6a/entry/cmake_modules/FindFFTW3f.cmake
+# Modified to use pkg config and use standard var names
+
+# Find single-precision (float) version of FFTW3
+
+INCLUDE(FindPkgConfig)
+PKG_CHECK_MODULES(PC_FFTW3F "fftw3f >= 3.0")
+
+FIND_PATH(
+ FFTW3F_INCLUDE_DIRS
+ NAMES fftw3.h
+ HINTS $ENV{FFTW3_DIR}/include
+ ${PC_FFTW3F_INCLUDE_DIR}
+ PATHS /usr/local/include
+ /usr/include
+)
+
+FIND_LIBRARY(
+ FFTW3F_LIBRARIES
+ NAMES fftw3f libfftw3f
+ HINTS $ENV{FFTW3_DIR}/lib
+ ${PC_FFTW3F_LIBDIR}
+ PATHS /usr/local/lib
+ /usr/lib
+ /usr/lib64
+)
+
+FIND_LIBRARY(
+ FFTW3F_THREADS_LIBRARIES
+ NAMES fftw3f_threads libfftw3f_threads
+ HINTS $ENV{FFTW3_DIR}/lib
+ ${PC_FFTW3F_LIBDIR}
+ PATHS /usr/local/lib
+ /usr/lib
+ /usr/lib64
+)
+
+
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(FFTW3F DEFAULT_MSG FFTW3F_LIBRARIES FFTW3F_INCLUDE_DIRS)
+MARK_AS_ADVANCED(FFTW3F_LIBRARIES FFTW3F_INCLUDE_DIRS FFTW3F_THREADS_LIBRARIES) \ No newline at end of file
diff --git a/cmake/Modules/FindGSL.cmake b/cmake/Modules/FindGSL.cmake
new file mode 100644
index 000000000..6d7155284
--- /dev/null
+++ b/cmake/Modules/FindGSL.cmake
@@ -0,0 +1,146 @@
+# Try to find gnu scientific library GSL
+# See
+# http://www.gnu.org/software/gsl/ and
+# http://gnuwin32.sourceforge.net/packages/gsl.htm
+#
+# Based on a script of Felix Woelk and Jan Woetzel
+# (www.mip.informatik.uni-kiel.de)
+#
+# It defines the following variables:
+# GSL_FOUND - system has GSL lib
+# GSL_INCLUDE_DIRS - where to find headers
+# GSL_LIBRARIES - full path to the libraries
+# GSL_LIBRARY_DIRS, the directory where the PLplot library is found.
+
+# CMAKE_GSL_CXX_FLAGS = Unix compiler flags for GSL, essentially "`gsl-config --cxxflags`"
+# GSL_LINK_DIRECTORIES = link directories, useful for rpath on Unix
+# GSL_EXE_LINKER_FLAGS = rpath on Unix
+
+INCLUDE(FindPkgConfig)
+PKG_CHECK_MODULES(GSL "gsl >= 1.10")
+IF(NOT GSL_FOUND)
+
+set( GSL_FOUND OFF )
+set( GSL_CBLAS_FOUND OFF )
+
+# Windows, but not for Cygwin and MSys where gsl-config is available
+if( WIN32 AND NOT CYGWIN AND NOT MSYS )
+ # look for headers
+ find_path( GSL_INCLUDE_DIRS
+ NAMES gsl/gsl_cdf.h gsl/gsl_randist.h
+ )
+ if( GSL_INCLUDE_DIRS )
+ # look for gsl library
+ find_library( GSL_LIBRARY
+ NAMES gsl
+ )
+ if( GSL_LIBRARY )
+ set( GSL_INCLUDE_DIRS ${GSL_INCLUDE_DIR} )
+ get_filename_component( GSL_LIBRARY_DIRS ${GSL_LIBRARY} PATH )
+ set( GSL_FOUND ON )
+ endif( GSL_LIBRARY )
+
+ # look for gsl cblas library
+ find_library( GSL_CBLAS_LIBRARY
+ NAMES gslcblas
+ )
+ if( GSL_CBLAS_LIBRARY )
+ set( GSL_CBLAS_FOUND ON )
+ endif( GSL_CBLAS_LIBRARY )
+
+ set( GSL_LIBRARIES ${GSL_LIBRARY} ${GSL_CBLAS_LIBRARY} )
+ endif( GSL_INCLUDE_DIRS )
+
+ mark_as_advanced(
+ GSL_INCLUDE_DIRS
+ GSL_LIBRARIES
+ GSL_CBLAS_LIBRARIES
+ )
+else( WIN32 AND NOT CYGWIN AND NOT MSYS )
+ if( UNIX OR MSYS )
+ find_program( GSL_CONFIG_EXECUTABLE gsl-config
+ /usr/bin/
+ /usr/local/bin
+ )
+
+ if( GSL_CONFIG_EXECUTABLE )
+ set( GSL_FOUND ON )
+
+ # run the gsl-config program to get cxxflags
+ execute_process(
+ COMMAND sh "${GSL_CONFIG_EXECUTABLE}" --cflags
+ OUTPUT_VARIABLE GSL_CFLAGS
+ RESULT_VARIABLE RET
+ ERROR_QUIET
+ )
+ if( RET EQUAL 0 )
+ string( STRIP "${GSL_CFLAGS}" GSL_CFLAGS )
+ separate_arguments( GSL_CFLAGS )
+
+ # parse definitions from cflags; drop -D* from CFLAGS
+ string( REGEX MATCHALL "-D[^;]+"
+ GSL_DEFINITIONS "${GSL_CFLAGS}" )
+ string( REGEX REPLACE "-D[^;]+;" ""
+ GSL_CFLAGS "${GSL_CFLAGS}" )
+
+ # parse include dirs from cflags; drop -I prefix
+ string( REGEX MATCHALL "-I[^;]+"
+ GSL_INCLUDE_DIRS "${GSL_CFLAGS}" )
+ string( REPLACE "-I" ""
+ GSL_INCLUDE_DIRS "${GSL_INCLUDE_DIRS}")
+ string( REGEX REPLACE "-I[^;]+;" ""
+ GSL_CFLAGS "${GSL_CFLAGS}")
+
+ message("GSL_DEFINITIONS=${GSL_DEFINITIONS}")
+ message("GSL_INCLUDE_DIRS=${GSL_INCLUDE_DIRS}")
+ message("GSL_CFLAGS=${GSL_CFLAGS}")
+ else( RET EQUAL 0 )
+ set( GSL_FOUND FALSE )
+ endif( RET EQUAL 0 )
+
+ # run the gsl-config program to get the libs
+ execute_process(
+ COMMAND sh "${GSL_CONFIG_EXECUTABLE}" --libs
+ OUTPUT_VARIABLE GSL_LIBRARIES
+ RESULT_VARIABLE RET
+ ERROR_QUIET
+ )
+ if( RET EQUAL 0 )
+ string(STRIP "${GSL_LIBRARIES}" GSL_LIBRARIES )
+ separate_arguments( GSL_LIBRARIES )
+
+ # extract linkdirs (-L) for rpath (i.e., LINK_DIRECTORIES)
+ string( REGEX MATCHALL "-L[^;]+"
+ GSL_LIBRARY_DIRS "${GSL_LIBRARIES}" )
+ string( REPLACE "-L" ""
+ GSL_LIBRARY_DIRS "${GSL_LIBRARY_DIRS}" )
+ else( RET EQUAL 0 )
+ set( GSL_FOUND FALSE )
+ endif( RET EQUAL 0 )
+
+ MARK_AS_ADVANCED(
+ GSL_CFLAGS
+ )
+ message( STATUS "Using GSL from ${GSL_PREFIX}" )
+ else( GSL_CONFIG_EXECUTABLE )
+ message( STATUS "FindGSL: gsl-config not found.")
+ endif( GSL_CONFIG_EXECUTABLE )
+ endif( UNIX OR MSYS )
+endif( WIN32 AND NOT CYGWIN AND NOT MSYS )
+
+if( GSL_FOUND )
+ if( NOT GSL_FIND_QUIETLY )
+ message( STATUS "FindGSL: Found both GSL headers and library" )
+ endif( NOT GSL_FIND_QUIETLY )
+else( GSL_FOUND )
+ if( GSL_FIND_REQUIRED )
+ message( FATAL_ERROR "FindGSL: Could not find GSL headers or library" )
+ endif( GSL_FIND_REQUIRED )
+endif( GSL_FOUND )
+
+#needed for gsl windows port but safe to always define
+LIST(APPEND GSL_DEFINITIONS "-DGSL_DLL")
+
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(GSL DEFAULT_MSG GSL_LIBRARIES GSL_INCLUDE_DIRS)
+ENDIF(NOT GSL_FOUND)
diff --git a/cmake/Modules/FindGit.cmake b/cmake/Modules/FindGit.cmake
new file mode 100644
index 000000000..2d8214287
--- /dev/null
+++ b/cmake/Modules/FindGit.cmake
@@ -0,0 +1,46 @@
+# The module defines the following variables:
+# GIT_EXECUTABLE - path to git command line client
+# GIT_FOUND - true if the command line client was found
+# Example usage:
+# find_package(Git)
+# if(GIT_FOUND)
+# message("git found: ${GIT_EXECUTABLE}")
+# endif()
+
+#=============================================================================
+# Copyright 2010 Kitware, Inc.
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distributed this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+# Look for 'git' or 'eg' (easy git)
+#
+set(git_names git eg)
+
+# Prefer .cmd variants on Windows unless running in a Makefile
+# in the MSYS shell.
+#
+if(WIN32)
+ if(NOT CMAKE_GENERATOR MATCHES "MSYS")
+ set(git_names git.cmd git eg.cmd eg)
+ endif()
+endif()
+
+find_program(GIT_EXECUTABLE
+ NAMES ${git_names}
+ DOC "git command line client"
+ )
+mark_as_advanced(GIT_EXECUTABLE)
+
+# Handle the QUIETLY and REQUIRED arguments and set GIT_FOUND to TRUE if
+# all listed variables are TRUE
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Git DEFAULT_MSG GIT_EXECUTABLE)
diff --git a/cmake/Modules/FindJack.cmake b/cmake/Modules/FindJack.cmake
new file mode 100644
index 000000000..4bdfe0a7e
--- /dev/null
+++ b/cmake/Modules/FindJack.cmake
@@ -0,0 +1,82 @@
+# - Try to find jack-2.6
+# Once done this will define
+#
+# JACK_FOUND - system has jack
+# JACK_INCLUDE_DIRS - the jack include directory
+# JACK_LIBRARIES - Link these to use jack
+# JACK_DEFINITIONS - Compiler switches required for using jack
+#
+# Copyright (c) 2008 Andreas Schneider <mail@cynapses.org>
+# Modified for other libraries by Lasse Kärkkäinen <tronic>
+#
+# Redistribution and use is allowed according to the terms of the New
+# BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+#
+
+if (JACK_LIBRARIES AND JACK_INCLUDE_DIRS)
+ # in cache already
+ set(JACK_FOUND TRUE)
+else (JACK_LIBRARIES AND JACK_INCLUDE_DIRS)
+ # use pkg-config to get the directories and then use these values
+ # in the FIND_PATH() and FIND_LIBRARY() calls
+ if (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
+ include(UsePkgConfig)
+ pkgconfig(jack _JACK_INCLUDEDIR _JACK_LIBDIR _JACK_LDFLAGS _JACK_CFLAGS)
+ else (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
+ find_package(PkgConfig)
+ if (PKG_CONFIG_FOUND)
+ pkg_check_modules(_JACK jack)
+ endif (PKG_CONFIG_FOUND)
+ endif (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
+ find_path(JACK_INCLUDE_DIR
+ NAMES
+ jack/jack.h
+ PATHS
+ ${_JACK_INCLUDEDIR}
+ /usr/include
+ /usr/local/include
+ /opt/local/include
+ /sw/include
+ )
+
+ find_library(JACK_LIBRARY
+ NAMES
+ jack
+ PATHS
+ ${_JACK_LIBDIR}
+ /usr/lib
+ /usr/local/lib
+ /opt/local/lib
+ /sw/lib
+ )
+
+ if (JACK_LIBRARY AND JACK_INCLUDE_DIR)
+ set(JACK_FOUND TRUE)
+
+ set(JACK_INCLUDE_DIRS
+ ${JACK_INCLUDE_DIR}
+ )
+
+ set(JACK_LIBRARIES
+ ${JACK_LIBRARIES}
+ ${JACK_LIBRARY}
+ )
+
+ endif (JACK_LIBRARY AND JACK_INCLUDE_DIR)
+
+ if (JACK_FOUND)
+ if (NOT JACK_FIND_QUIETLY)
+ message(STATUS "Found jack: ${JACK_LIBRARY}")
+ endif (NOT JACK_FIND_QUIETLY)
+ else (JACK_FOUND)
+ if (JACK_FIND_REQUIRED)
+ message(FATAL_ERROR "Could not find JACK")
+ endif (JACK_FIND_REQUIRED)
+ endif (JACK_FOUND)
+
+ # show the JACK_INCLUDE_DIRS and JACK_LIBRARIES variables only in the advanced view
+ mark_as_advanced(JACK_INCLUDE_DIRS JACK_LIBRARIES)
+
+endif (JACK_LIBRARIES AND JACK_INCLUDE_DIRS)
+
diff --git a/cmake/Modules/FindOSS.cmake b/cmake/Modules/FindOSS.cmake
new file mode 100644
index 000000000..4c886de5f
--- /dev/null
+++ b/cmake/Modules/FindOSS.cmake
@@ -0,0 +1,46 @@
+# - Find Oss
+# Find Oss headers and libraries.
+#
+# OSS_INCLUDE_DIR - where to find soundcard.h, etc.
+# OSS_FOUND - True if Oss found.
+
+
+FIND_PATH(LINUX_OSS_INCLUDE_DIR "linux/soundcard.h"
+ "/usr/include" "/usr/local/include"
+)
+
+FIND_PATH(SYS_OSS_INCLUDE_DIR "sys/soundcard.h"
+ "/usr/include" "/usr/local/include"
+)
+
+FIND_PATH(MACHINE_OSS_INCLUDE_DIR "machine/soundcard.h"
+ "/usr/include" "/usr/local/include"
+)
+
+SET(OSS_FOUND FALSE)
+
+IF(LINUX_OSS_INCLUDE_DIR)
+ SET(OSS_FOUND TRUE)
+ SET(OSS_INCLUDE_DIR ${LINUX_OSS_INCLUDE_DIR})
+ SET(HAVE_LINUX_SOUNDCARD_H 1)
+ENDIF()
+
+IF(SYS_OSS_INCLUDE_DIR)
+ SET(OSS_FOUND TRUE)
+ SET(OSS_INCLUDE_DIR ${SYS_OSS_INCLUDE_DIR})
+ SET(HAVE_SYS_SOUNDCARD_H 1)
+ENDIF()
+
+IF(MACHINE_OSS_INCLUDE_DIR)
+ SET(OSS_FOUND TRUE)
+ SET(OSS_INCLUDE_DIR ${MACHINE_OSS_INCLUDE_DIR})
+ SET(HAVE_MACHINE_SOUNDCARD_H 1)
+ENDIF()
+
+MARK_AS_ADVANCED (
+ OSS_FOUND
+ OSS_INCLUDE_DIR
+ LINUX_OSS_INCLUDE_DIR
+ SYS_OSS_INCLUDE_DIR
+ MACHINE_OSS_INCLUDE_DIR
+)
diff --git a/cmake/Modules/FindPortaudio.cmake b/cmake/Modules/FindPortaudio.cmake
new file mode 100644
index 000000000..61e4ae23a
--- /dev/null
+++ b/cmake/Modules/FindPortaudio.cmake
@@ -0,0 +1,35 @@
+# - Try to find Portaudio
+# Once done this will define
+#
+# PORTAUDIO_FOUND - system has Portaudio
+# PORTAUDIO_INCLUDE_DIRS - the Portaudio include directory
+# PORTAUDIO_LIBRARIES - Link these to use Portaudio
+
+include(FindPkgConfig)
+pkg_check_modules(PC_PORTAUDIO portaudio)
+
+find_path(PORTAUDIO_INCLUDE_DIRS
+ NAMES
+ portaudio.h
+ PATHS
+ /usr/local/include
+ /usr/include
+ HINTS
+ ${PC_PORTAUDIO_INCLUDE_DIR}
+)
+
+find_library(PORTAUDIO_LIBRARIES
+ NAMES
+ portaudio
+ PATHS
+ /usr/local/lib
+ /usr/lib
+ /usr/lib64
+ HINTS
+ ${PC_PORTAUDIO_LIBDIR}
+)
+
+mark_as_advanced(PORTAUDIO_INCLUDE_DIRS PORTAUDIO_LIBRARIES)
+
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(PORTAUDIO DEFAULT_MSG PORTAUDIO_INCLUDE_DIRS PORTAUDIO_LIBRARIES)
diff --git a/cmake/Modules/FindQwt.cmake b/cmake/Modules/FindQwt.cmake
new file mode 100644
index 000000000..db5ca6d27
--- /dev/null
+++ b/cmake/Modules/FindQwt.cmake
@@ -0,0 +1,32 @@
+# - try to find Qwt libraries and include files
+# QWT_INCLUDE_DIR where to find qwt_plot.h, etc.
+# QWT_LIBRARIES libraries to link against
+# QWT_FOUND If false, do not try to use Qwt
+
+find_path (QWT_INCLUDE_DIRS
+ NAMES qwt_plot.h
+ PATHS
+ /usr/local/include/qwt-qt4
+ /usr/local/include/qwt
+ /usr/include/qwt-qt4
+ /usr/include/qwt
+ /opt/local/include/qwt
+ /opt/local/lib/qwt.framework/Headers
+ /sw/include/qwt
+)
+
+find_library (QWT_LIBRARIES
+ NAMES qwt-qt4 qwt
+ PATHS
+ /usr/local/lib
+ /usr/lib
+ /opt/local/lib
+ /opt/local/lib/qwt.framework
+ /sw/lib
+)
+
+# handle the QUIETLY and REQUIRED arguments and set QWT_FOUND to TRUE if
+# all listed variables are TRUE
+include ( FindPackageHandleStandardArgs )
+find_package_handle_standard_args( Qwt DEFAULT_MSG QWT_LIBRARIES QWT_INCLUDE_DIRS )
+MARK_AS_ADVANCED(QWT_LIBRARIES QWT_INCLUDE_DIRS)
diff --git a/cmake/Modules/FindSphinx.cmake b/cmake/Modules/FindSphinx.cmake
new file mode 100644
index 000000000..da12ee93d
--- /dev/null
+++ b/cmake/Modules/FindSphinx.cmake
@@ -0,0 +1,37 @@
+# - This module looks for Sphinx
+# Find the Sphinx documentation generator
+#
+# This modules defines
+# SPHINX_EXECUTABLE
+# SPHINX_FOUND
+
+#=============================================================================
+# Copyright 2002-2009 Kitware, Inc.
+# Copyright 2009-2011 Peter Colberg
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file COPYING-CMAKE-SCRIPTS for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+find_program(SPHINX_EXECUTABLE NAMES sphinx-build
+ HINTS
+ $ENV{SPHINX_DIR}
+ PATH_SUFFIXES bin
+ DOC "Sphinx documentation generator"
+)
+
+include(FindPackageHandleStandardArgs)
+
+find_package_handle_standard_args(Sphinx DEFAULT_MSG
+ SPHINX_EXECUTABLE
+)
+
+mark_as_advanced(
+ SPHINX_EXECUTABLE
+)
diff --git a/cmake/Modules/FindUHD.cmake b/cmake/Modules/FindUHD.cmake
new file mode 100644
index 000000000..b4d12b6d7
--- /dev/null
+++ b/cmake/Modules/FindUHD.cmake
@@ -0,0 +1,28 @@
+########################################################################
+# Find the library for the USRP Hardware Driver
+########################################################################
+
+INCLUDE(FindPkgConfig)
+PKG_CHECK_MODULES(PC_UHD uhd)
+
+FIND_PATH(
+ UHD_INCLUDE_DIRS
+ NAMES uhd/config.hpp
+ HINTS $ENV{UHD_DIR}/include
+ ${PC_UHD_INCLUDEDIR}
+ PATHS /usr/local/include
+ /usr/include
+)
+
+FIND_LIBRARY(
+ UHD_LIBRARIES
+ NAMES uhd
+ HINTS $ENV{UHD_DIR}/lib
+ ${PC_UHD_LIBDIR}
+ PATHS /usr/local/lib
+ /usr/lib
+)
+
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(UHD DEFAULT_MSG UHD_LIBRARIES UHD_INCLUDE_DIRS)
+MARK_AS_ADVANCED(UHD_LIBRARIES UHD_INCLUDE_DIRS)
diff --git a/cmake/Modules/FindUSB.cmake b/cmake/Modules/FindUSB.cmake
new file mode 100644
index 000000000..97f3db675
--- /dev/null
+++ b/cmake/Modules/FindUSB.cmake
@@ -0,0 +1,28 @@
+if(NOT LIBUSB_FOUND)
+ pkg_check_modules (LIBUSB_PKG libusb-1.0)
+ find_path(LIBUSB_INCLUDE_DIR NAMES libusb.h
+ PATHS
+ ${LIBUSB_PKG_INCLUDE_DIRS}
+ /usr/include/libusb-1.0
+ /usr/include
+ /usr/local/include
+ )
+
+ find_library(LIBUSB_LIBRARIES NAMES usb-1.0
+ PATHS
+ ${LIBUSB_PKG_LIBRARY_DIRS}
+ /usr/lib
+ /usr/local/lib
+ )
+
+if(LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARIES)
+ set(LIBUSB_FOUND TRUE CACHE INTERNAL "libusb-1.0 found")
+ message(STATUS "Found libusb-1.0: ${LIBUSB_INCLUDE_DIR}, ${LIBUSB_LIBRARIES}")
+else(LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARIES)
+ set(LIBUSB_FOUND FALSE CACHE INTERNAL "libusb-1.0 found")
+ message(STATUS "libusb-1.0 not found.")
+endif(LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARIES)
+
+mark_as_advanced(LIBUSB_INCLUDE_DIR LIBUSB_LIBRARIES)
+
+endif(NOT LIBUSB_FOUND)
diff --git a/cmake/Modules/GrBoost.cmake b/cmake/Modules/GrBoost.cmake
new file mode 100644
index 000000000..d2e91a6f1
--- /dev/null
+++ b/cmake/Modules/GrBoost.cmake
@@ -0,0 +1,99 @@
+# 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.
+
+if(DEFINED __INCLUDED_GR_BOOST_CMAKE)
+ return()
+endif()
+set(__INCLUDED_GR_BOOST_CMAKE TRUE)
+
+########################################################################
+# Setup Boost and handle some system specific things
+########################################################################
+
+set(BOOST_REQUIRED_COMPONENTS
+ date_time
+ program_options
+ filesystem
+ system
+ thread
+)
+
+if(UNIX AND NOT BOOST_ROOT AND EXISTS "/usr/lib64")
+ list(APPEND BOOST_LIBRARYDIR "/usr/lib64") #fedora 64-bit fix
+endif(UNIX AND NOT BOOST_ROOT AND EXISTS "/usr/lib64")
+
+if(MSVC)
+ set(BOOST_REQUIRED_COMPONENTS ${BOOST_REQUIRED_COMPONENTS} chrono)
+
+ if (NOT DEFINED BOOST_ALL_DYN_LINK)
+ set(BOOST_ALL_DYN_LINK TRUE)
+ endif()
+ set(BOOST_ALL_DYN_LINK "${BOOST_ALL_DYN_LINK}" CACHE BOOL "boost enable dynamic linking")
+ if(BOOST_ALL_DYN_LINK)
+ add_definitions(-DBOOST_ALL_DYN_LINK) #setup boost auto-linking in msvc
+ else(BOOST_ALL_DYN_LINK)
+ unset(BOOST_REQUIRED_COMPONENTS) #empty components list for static link
+ endif(BOOST_ALL_DYN_LINK)
+endif(MSVC)
+
+find_package(Boost "1.35" COMPONENTS ${BOOST_REQUIRED_COMPONENTS})
+
+# This does not allow us to disable specific versions. It is used
+# internally by cmake to know the formation newer versions. As newer
+# Boost version beyond what is shown here are produced, we must extend
+# this list. To disable Boost versions, see below.
+set(Boost_ADDITIONAL_VERSIONS
+ "1.35.0" "1.35" "1.36.0" "1.36" "1.37.0" "1.37" "1.38.0" "1.38" "1.39.0" "1.39"
+ "1.40.0" "1.40" "1.41.0" "1.41" "1.42.0" "1.42" "1.43.0" "1.43" "1.44.0" "1.44"
+ "1.45.0" "1.45" "1.46.0" "1.46" "1.47.0" "1.47" "1.48.0" "1.48" "1.49.0" "1.49"
+ "1.50.0" "1.50" "1.51.0" "1.51" "1.52.0" "1.52" "1.53.0" "1.53" "1.54.0" "1.54"
+ "1.55.0" "1.55" "1.56.0" "1.56" "1.57.0" "1.57" "1.58.0" "1.58" "1.59.0" "1.59"
+ "1.60.0" "1.60" "1.61.0" "1.61" "1.62.0" "1.62" "1.63.0" "1.63" "1.64.0" "1.64"
+ "1.65.0" "1.65" "1.66.0" "1.66" "1.67.0" "1.67" "1.68.0" "1.68" "1.69.0" "1.69"
+)
+
+# Boost 1.52 disabled, see https://svn.boost.org/trac/boost/ticket/7669
+# Similar problems with Boost 1.46 and 1.47.
+
+OPTION(ENABLE_BAD_BOOST "Enable known bad versions of Boost" OFF)
+if(ENABLE_BAD_BOOST)
+ MESSAGE(STATUS "Enabling use of known bad versions of Boost.")
+endif(ENABLE_BAD_BOOST)
+
+# For any unsuitable Boost version, add the version number below in
+# the following format: XXYYZZ
+# Where:
+# XX is the major version ('10' for version 1)
+# YY is the minor version number ('46' for 1.46)
+# ZZ is the patcher version number (typically just '00')
+set(Boost_NOGO_VERSIONS
+ 104600 104601 104700 105200
+ )
+
+foreach(ver ${Boost_NOGO_VERSIONS})
+ if(${Boost_VERSION} EQUAL ${ver})
+ if(NOT ENABLE_BAD_BOOST)
+ MESSAGE(STATUS "WARNING: Found a known bad version of Boost (v${Boost_VERSION}). Disabling.")
+ set(Boost_FOUND FALSE)
+ else(NOT ENABLE_BAD_BOOST)
+ MESSAGE(STATUS "WARNING: Found a known bad version of Boost (v${Boost_VERSION}). Continuing anyway.")
+ set(Boost_FOUND TRUE)
+ endif(NOT ENABLE_BAD_BOOST)
+ endif(${Boost_VERSION} EQUAL ${ver})
+endforeach(ver)
diff --git a/cmake/Modules/GrComponent.cmake b/cmake/Modules/GrComponent.cmake
new file mode 100644
index 000000000..f802cdcb4
--- /dev/null
+++ b/cmake/Modules/GrComponent.cmake
@@ -0,0 +1,115 @@
+# 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.
+
+if(DEFINED __INCLUDED_GR_COMPONENT_CMAKE)
+ return()
+endif()
+set(__INCLUDED_GR_COMPONENT_CMAKE TRUE)
+
+set(_gr_enabled_components "" CACHE INTERNAL "" FORCE)
+set(_gr_disabled_components "" CACHE INTERNAL "" FORCE)
+
+if(NOT DEFINED ENABLE_DEFAULT)
+ set(ENABLE_DEFAULT ON)
+ message(STATUS "")
+ message(STATUS "The build system will automatically enable all components.")
+ message(STATUS "Use -DENABLE_DEFAULT=OFF to disable components by default.")
+endif()
+
+########################################################################
+# Register a component into the system
+# - name: canonical component name
+# - var: variable for enabled status
+# - argn: list of dependencies
+########################################################################
+function(GR_REGISTER_COMPONENT name var)
+ include(CMakeDependentOption)
+ message(STATUS "")
+ message(STATUS "Configuring ${name} support...")
+ foreach(dep ${ARGN})
+ message(STATUS " Dependency ${dep} = ${${dep}}")
+ endforeach(dep)
+
+ #if the user set the var to force, we note this
+ if("${${var}}" STREQUAL "FORCE")
+ set(${var} ON)
+ set(var_force TRUE)
+ else()
+ set(var_force FALSE)
+ endif()
+
+ #rewrite the dependency list so that deps that are also components use the cached version
+ unset(comp_deps)
+ foreach(dep ${ARGN})
+ list(FIND _gr_enabled_components ${dep} dep_enb_index)
+ list(FIND _gr_disabled_components ${dep} dep_dis_index)
+ if (${dep_enb_index} EQUAL -1 AND ${dep_dis_index} EQUAL -1)
+ list(APPEND comp_deps ${dep})
+ else()
+ list(APPEND comp_deps ${dep}_cached) #is a component, use cached version
+ endif()
+ endforeach(dep)
+
+ #setup the dependent option for this component
+ CMAKE_DEPENDENT_OPTION(${var} "enable ${name} support" ${ENABLE_DEFAULT} "${comp_deps}" OFF)
+ set(${var} "${${var}}" PARENT_SCOPE)
+ set(${var}_cached "${${var}}" CACHE INTERNAL "" FORCE)
+
+ #force was specified, but the dependencies were not met
+ if(NOT ${var} AND var_force)
+ message(FATAL_ERROR "user force-enabled ${name} but configuration checked failed")
+ endif()
+
+ #append the component into one of the lists
+ if(${var})
+ message(STATUS " Enabling ${name} support.")
+ list(APPEND _gr_enabled_components ${name})
+ else(${var})
+ message(STATUS " Disabling ${name} support.")
+ list(APPEND _gr_disabled_components ${name})
+ endif(${var})
+ message(STATUS " Override with -D${var}=ON/OFF")
+
+ #make components lists into global variables
+ set(_gr_enabled_components ${_gr_enabled_components} CACHE INTERNAL "" FORCE)
+ set(_gr_disabled_components ${_gr_disabled_components} CACHE INTERNAL "" FORCE)
+endfunction(GR_REGISTER_COMPONENT)
+
+########################################################################
+# Print the registered component summary
+########################################################################
+function(GR_PRINT_COMPONENT_SUMMARY)
+ message(STATUS "")
+ message(STATUS "######################################################")
+ message(STATUS "# Gnuradio enabled components ")
+ message(STATUS "######################################################")
+ foreach(comp ${_gr_enabled_components})
+ message(STATUS " * ${comp}")
+ endforeach(comp)
+
+ message(STATUS "")
+ message(STATUS "######################################################")
+ message(STATUS "# Gnuradio disabled components ")
+ message(STATUS "######################################################")
+ foreach(comp ${_gr_disabled_components})
+ message(STATUS " * ${comp}")
+ endforeach(comp)
+
+ message(STATUS "")
+endfunction(GR_PRINT_COMPONENT_SUMMARY)
diff --git a/cmake/Modules/GrMiscUtils.cmake b/cmake/Modules/GrMiscUtils.cmake
new file mode 100644
index 000000000..b9ab38fc6
--- /dev/null
+++ b/cmake/Modules/GrMiscUtils.cmake
@@ -0,0 +1,280 @@
+# 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.
+
+if(DEFINED __INCLUDED_GR_MISC_UTILS_CMAKE)
+ return()
+endif()
+set(__INCLUDED_GR_MISC_UTILS_CMAKE TRUE)
+
+########################################################################
+# Set global variable macro.
+# Used for subdirectories to export settings.
+# Example: include and library paths.
+########################################################################
+function(GR_SET_GLOBAL var)
+ set(${var} ${ARGN} CACHE INTERNAL "" FORCE)
+endfunction(GR_SET_GLOBAL)
+
+########################################################################
+# Set the pre-processor definition if the condition is true.
+# - def the pre-processor definition to set and condition name
+########################################################################
+function(GR_ADD_COND_DEF def)
+ if(${def})
+ add_definitions(-D${def})
+ endif(${def})
+endfunction(GR_ADD_COND_DEF)
+
+########################################################################
+# Check for a header and conditionally set a compile define.
+# - hdr the relative path to the header file
+# - def the pre-processor definition to set
+########################################################################
+function(GR_CHECK_HDR_N_DEF hdr def)
+ include(CheckIncludeFileCXX)
+ CHECK_INCLUDE_FILE_CXX(${hdr} ${def})
+ GR_ADD_COND_DEF(${def})
+endfunction(GR_CHECK_HDR_N_DEF)
+
+########################################################################
+# Include subdirectory macro.
+# Sets the CMake directory variables,
+# includes the subdirectory CMakeLists.txt,
+# resets the CMake directory variables.
+#
+# This macro includes subdirectories rather than adding them
+# so that the subdirectory can affect variables in the level above.
+# This provides a work-around for the lack of convenience libraries.
+# This way a subdirectory can append to the list of library sources.
+########################################################################
+macro(GR_INCLUDE_SUBDIRECTORY subdir)
+ #insert the current directories on the front of the list
+ list(INSERT _cmake_source_dirs 0 ${CMAKE_CURRENT_SOURCE_DIR})
+ list(INSERT _cmake_binary_dirs 0 ${CMAKE_CURRENT_BINARY_DIR})
+
+ #set the current directories to the names of the subdirs
+ set(CMAKE_CURRENT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/${subdir})
+ set(CMAKE_CURRENT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/${subdir})
+
+ #include the subdirectory CMakeLists to run it
+ file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
+ include(${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt)
+
+ #reset the value of the current directories
+ list(GET _cmake_source_dirs 0 CMAKE_CURRENT_SOURCE_DIR)
+ list(GET _cmake_binary_dirs 0 CMAKE_CURRENT_BINARY_DIR)
+
+ #pop the subdir names of the front of the list
+ list(REMOVE_AT _cmake_source_dirs 0)
+ list(REMOVE_AT _cmake_binary_dirs 0)
+endmacro(GR_INCLUDE_SUBDIRECTORY)
+
+########################################################################
+# Check if a compiler flag works and conditionally set a compile define.
+# - flag the compiler flag to check for
+# - have the variable to set with result
+########################################################################
+macro(GR_ADD_CXX_COMPILER_FLAG_IF_AVAILABLE flag have)
+ include(CheckCXXCompilerFlag)
+ CHECK_CXX_COMPILER_FLAG(${flag} ${have})
+ if(${have})
+ add_definitions(${flag})
+ endif(${have})
+endmacro(GR_ADD_CXX_COMPILER_FLAG_IF_AVAILABLE)
+
+########################################################################
+# Generates the .la libtool file
+# This appears to generate libtool files that cannot be used by auto*.
+# Usage GR_LIBTOOL(TARGET [target] DESTINATION [dest])
+# Notice: there is not COMPONENT option, these will not get distributed.
+########################################################################
+function(GR_LIBTOOL)
+ if(NOT DEFINED GENERATE_LIBTOOL)
+ set(GENERATE_LIBTOOL OFF) #disabled by default
+ endif()
+
+ if(GENERATE_LIBTOOL)
+ include(CMakeParseArgumentsCopy)
+ CMAKE_PARSE_ARGUMENTS(GR_LIBTOOL "" "TARGET;DESTINATION" "" ${ARGN})
+
+ find_program(LIBTOOL libtool)
+ if(LIBTOOL)
+ include(CMakeMacroLibtoolFile)
+ CREATE_LIBTOOL_FILE(${GR_LIBTOOL_TARGET} /${GR_LIBTOOL_DESTINATION})
+ endif(LIBTOOL)
+ endif(GENERATE_LIBTOOL)
+
+endfunction(GR_LIBTOOL)
+
+########################################################################
+# Do standard things to the library target
+# - set target properties
+# - make install rules
+# Also handle gnuradio custom naming conventions w/ extras mode.
+########################################################################
+function(GR_LIBRARY_FOO target)
+
+ target_link_libraries(${target} ${GR_MOAR_LIBRARIES})
+
+ #parse the arguments for component names
+ include(CMakeParseArgumentsCopy)
+ CMAKE_PARSE_ARGUMENTS(GR_LIBRARY "" "RUNTIME_COMPONENT;DEVEL_COMPONENT" "" ${ARGN})
+
+ #set additional target properties
+ set_target_properties(${target} PROPERTIES SOVERSION ${LIBVER})
+
+ #install the generated files like so...
+ install(TARGETS ${target}
+ LIBRARY DESTINATION ${GR_LIBRARY_DIR} COMPONENT ${GR_LIBRARY_RUNTIME_COMPONENT} # .so/.dylib file
+ ARCHIVE DESTINATION ${GR_LIBRARY_DIR} COMPONENT ${GR_LIBRARY_DEVEL_COMPONENT} # .lib file
+ RUNTIME DESTINATION ${GR_RUNTIME_DIR} COMPONENT ${GR_LIBRARY_RUNTIME_COMPONENT} # .dll file
+ )
+
+ #extras mode enabled automatically on linux
+ if(NOT DEFINED LIBRARY_EXTRAS)
+ set(LIBRARY_EXTRAS ${LINUX})
+ endif()
+
+ #special extras mode to enable alternative naming conventions
+ if(LIBRARY_EXTRAS)
+
+ #create .la file before changing props
+ GR_LIBTOOL(TARGET ${target} DESTINATION ${GR_LIBRARY_DIR})
+
+ #give the library a special name with ultra-zero soversion
+ set_target_properties(${target} PROPERTIES OUTPUT_NAME ${target}-${LIBVER} SOVERSION "0.0.0")
+ set(target_name lib${target}-${LIBVER}.so.0.0.0)
+
+ #custom command to generate symlinks
+ add_custom_command(
+ TARGET ${target}
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E create_symlink ${target_name} ${CMAKE_CURRENT_BINARY_DIR}/lib${target}.so
+ COMMAND ${CMAKE_COMMAND} -E create_symlink ${target_name} ${CMAKE_CURRENT_BINARY_DIR}/lib${target}-${LIBVER}.so.0
+ COMMAND ${CMAKE_COMMAND} -E touch ${target_name} #so the symlinks point to something valid so cmake 2.6 will install
+ )
+
+ #and install the extra symlinks
+ install(
+ FILES
+ ${CMAKE_CURRENT_BINARY_DIR}/lib${target}.so
+ ${CMAKE_CURRENT_BINARY_DIR}/lib${target}-${LIBVER}.so.0
+ DESTINATION ${GR_LIBRARY_DIR} COMPONENT ${GR_LIBRARY_RUNTIME_COMPONENT}
+ )
+
+ endif(LIBRARY_EXTRAS)
+endfunction(GR_LIBRARY_FOO)
+
+########################################################################
+# Create a dummy custom command that depends on other targets.
+# Usage:
+# GR_GEN_TARGET_DEPS(unique_name target_deps <target1> <target2> ...)
+# ADD_CUSTOM_COMMAND(<the usual args> ${target_deps})
+#
+# Custom command cant depend on targets, but can depend on executables,
+# and executables can depend on targets. So this is the process:
+########################################################################
+function(GR_GEN_TARGET_DEPS name var)
+ file(
+ WRITE ${CMAKE_CURRENT_BINARY_DIR}/${name}.cpp.in
+ "int main(void){return 0;}\n"
+ )
+ execute_process(
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different
+ ${CMAKE_CURRENT_BINARY_DIR}/${name}.cpp.in
+ ${CMAKE_CURRENT_BINARY_DIR}/${name}.cpp
+ )
+ add_executable(${name} ${CMAKE_CURRENT_BINARY_DIR}/${name}.cpp)
+ if(ARGN)
+ add_dependencies(${name} ${ARGN})
+ endif(ARGN)
+
+ if(CMAKE_CROSSCOMPILING)
+ set(${var} "DEPENDS;${name}" PARENT_SCOPE) #cant call command when cross
+ else()
+ set(${var} "DEPENDS;${name};COMMAND;${name}" PARENT_SCOPE)
+ endif()
+endfunction(GR_GEN_TARGET_DEPS)
+
+
+########################################################################
+# Run GRCC to compile .grc files into .py files.
+#
+# Usage: GRCC(filename, directory)
+# - filenames: List of file name of .grc file
+# - directory: directory of built .py file - usually in
+# ${CMAKE_CURRENT_BINARY_DIR}
+# - Sets PYFILES: output converted GRC file names to Python files.
+########################################################################
+function(GRCC)
+ # Extract directory from list of args, remove it for the list of filenames.
+ list(GET ARGV -1 directory)
+ list(REMOVE_AT ARGV -1)
+ set(filenames ${ARGV})
+ file(MAKE_DIRECTORY ${directory})
+
+ SET(GRCC_COMMAND ${CMAKE_SOURCE_DIR}/gr-utils/src/python/grcc)
+
+ # GRCC uses some stuff in grc and gnuradio-core, so we force
+ # the known paths here
+ list(APPEND PYTHONPATHS
+ ${CMAKE_SOURCE_DIR}
+ ${CMAKE_SOURCE_DIR}/gnuradio-core/src/python
+ ${CMAKE_SOURCE_DIR}/gnuradio-core/src/lib/swig
+ ${CMAKE_BINARY_DIR}/gnuradio-core/src/lib/swig
+ )
+
+ if(WIN32)
+ #SWIG generates the python library files into a subdirectory.
+ #Therefore, we must append this subdirectory into PYTHONPATH.
+ #Only do this for the python directories matching the following:
+ foreach(pydir ${PYTHONPATHS})
+ get_filename_component(name ${pydir} NAME)
+ if(name MATCHES "^(swig|lib|src)$")
+ list(APPEND PYTHONPATHS ${pydir}/${CMAKE_BUILD_TYPE})
+ endif()
+ endforeach(pydir)
+ endif(WIN32)
+
+ file(TO_NATIVE_PATH "${PYTHONPATHS}" pypath)
+
+ if(UNIX)
+ list(APPEND pypath "$PYTHONPATH")
+ string(REPLACE ";" ":" pypath "${pypath}")
+ set(ENV{PYTHONPATH} ${pypath})
+ endif(UNIX)
+
+ if(WIN32)
+ list(APPEND pypath "%PYTHONPATH%")
+ string(REPLACE ";" "\\;" pypath "${pypath}")
+ #list(APPEND environs "PYTHONPATH=${pypath}")
+ set(ENV{PYTHONPATH} ${pypath})
+ endif(WIN32)
+
+ foreach(f ${filenames})
+ execute_process(
+ COMMAND ${GRCC_COMMAND} -d ${directory} ${f}
+ )
+ string(REPLACE ".grc" ".py" pyfile "${f}")
+ string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_BINARY_DIR}" pyfile "${pyfile}")
+ list(APPEND pyfiles ${pyfile})
+ endforeach(f)
+
+ set(PYFILES ${pyfiles} PARENT_SCOPE)
+endfunction(GRCC)
diff --git a/cmake/Modules/GrPackage.cmake b/cmake/Modules/GrPackage.cmake
new file mode 100644
index 000000000..d1b0b3320
--- /dev/null
+++ b/cmake/Modules/GrPackage.cmake
@@ -0,0 +1,177 @@
+# Copyright 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.
+
+if(DEFINED __INCLUDED_GR_PACKAGE_CMAKE)
+ return()
+endif()
+set(__INCLUDED_GR_PACKAGE_CMAKE TRUE)
+
+include(GrVersion) #sets version information
+include(GrPlatform) #sets platform information
+
+#set the cpack generator based on the platform type
+if(CPACK_GENERATOR)
+ #already set by user
+elseif(APPLE)
+ set(CPACK_GENERATOR PackageMaker)
+elseif(WIN32)
+ set(CPACK_GENERATOR NSIS)
+elseif(DEBIAN)
+ set(CPACK_GENERATOR DEB)
+elseif(REDHAT)
+ set(CPACK_GENERATOR RPM)
+else()
+ set(CPACK_GENERATOR TGZ)
+endif()
+
+########################################################################
+# CPACK_SET - set a global variable and record the variable name
+########################################################################
+function(CPACK_SET var)
+ set(${var} ${ARGN} CACHE INTERNAL "")
+ list(APPEND _cpack_vars ${var})
+ list(REMOVE_DUPLICATES _cpack_vars)
+ set(_cpack_vars ${_cpack_vars} CACHE INTERNAL "")
+endfunction(CPACK_SET)
+
+########################################################################
+# CPACK_FINALIZE - include cpack and the unset all the cpack variables
+########################################################################
+function(CPACK_FINALIZE)
+
+ #set the package depends for monolithic package
+ foreach(comp ${CPACK_COMPONENTS_ALL})
+ string(TOUPPER "PACKAGE_DEPENDS_${comp}" package_depends_var)
+ list(APPEND PACKAGE_DEPENDS_ALL ${${package_depends_var}})
+ endforeach(comp)
+ string(REPLACE ";" ", " CPACK_DEBIAN_PACKAGE_DEPENDS "${PACKAGE_DEPENDS_ALL}")
+ string(REPLACE ";" ", " CPACK_RPM_PACKAGE_REQUIRES "${PACKAGE_DEPENDS_ALL}")
+
+ include(CPack) #finalize the cpack settings configured throughout the build system
+ foreach(var ${_cpack_vars})
+ unset(${var} CACHE)
+ endforeach(var)
+ unset(_cpack_vars CACHE)
+endfunction(CPACK_FINALIZE)
+
+########################################################################
+# CPACK_COMPONENT - convenience function to create a cpack component
+#
+# Usage: CPACK_COMPONENT(
+# name
+# [GROUP group]
+# [DISPLAY_NAME display_name]
+# [DESCRIPTION description]
+# [DEPENDS depends]
+# )
+########################################################################
+function(CPACK_COMPONENT name)
+ include(CMakeParseArgumentsCopy)
+ set(_options GROUP DISPLAY_NAME DESCRIPTION DEPENDS)
+ CMAKE_PARSE_ARGUMENTS(CPACK_COMPONENT "" "${_options}" "" ${ARGN})
+
+ string(TOUPPER "${name}" name_upper)
+ foreach(_option ${_options})
+ if(CPACK_COMPONENT_${_option})
+ CPACK_SET(CPACK_COMPONENT_${name_upper}_${_option} "${CPACK_COMPONENT_${_option}}")
+ endif()
+ endforeach(_option)
+
+ CPACK_SET(CPACK_COMPONENTS_ALL "${CPACK_COMPONENTS_ALL};${name}")
+
+endfunction(CPACK_COMPONENT)
+
+########################################################################
+# Setup CPack
+########################################################################
+set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "GNU Radio - The GNU Software Radio")
+set(CPACK_PACKAGE_VENDOR "Free Software Foundation, Inc.")
+set(CPACK_PACKAGE_CONTACT "Discuss GNURadio <discuss-gnuradio@gnu.org>")
+string(REPLACE "v" "" CPACK_PACKAGE_VERSION ${VERSION})
+set(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR}/README)
+set(CPACK_RESOURCE_FILE_README ${CMAKE_SOURCE_DIR}/README)
+set(CPACK_RESOURCE_FILE_WELCOME ${CMAKE_SOURCE_DIR}/README)
+
+find_program(LSB_RELEASE_EXECUTABLE lsb_release)
+
+if((DEBIAN OR REDHAT) AND LSB_RELEASE_EXECUTABLE)
+
+ #extract system information by executing the commands
+ execute_process(
+ COMMAND ${LSB_RELEASE_EXECUTABLE} --short --id
+ OUTPUT_VARIABLE LSB_ID OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+ execute_process(
+ COMMAND ${LSB_RELEASE_EXECUTABLE} --short --release
+ OUTPUT_VARIABLE LSB_RELEASE OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+
+ #set a more sensible package name for this system
+ SET(CPACK_PACKAGE_FILE_NAME "gnuradio_${CPACK_PACKAGE_VERSION}_${LSB_ID}-${LSB_RELEASE}-${CMAKE_SYSTEM_PROCESSOR}")
+
+ #now try to include the component based dependencies
+ set(package_deps_file "${CMAKE_SOURCE_DIR}/cmake/Packaging/${LSB_ID}-${LSB_RELEASE}.cmake")
+ if (EXISTS ${package_deps_file})
+ include(${package_deps_file})
+ endif()
+
+endif()
+
+if(${CPACK_GENERATOR} STREQUAL NSIS)
+
+ ENABLE_LANGUAGE(C)
+
+ include(CheckTypeSize)
+ check_type_size("void*[8]" BIT_WIDTH BUILTIN_TYPES_ONLY)
+ SET(CPACK_PACKAGE_FILE_NAME "gnuradio_${CPACK_PACKAGE_VERSION}_Win${BIT_WIDTH}")
+
+ set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CMAKE_PROJECT_NAME}")
+endif()
+
+########################################################################
+# DEB package specific
+########################################################################
+foreach(filename preinst postinst prerm postrm)
+ list(APPEND CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA ${CMAKE_BINARY_DIR}/Packaging/${filename})
+ file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/Packaging)
+ configure_file(
+ ${CMAKE_SOURCE_DIR}/cmake/Packaging/${filename}.in
+ ${CMAKE_BINARY_DIR}/Packaging/${filename}
+ @ONLY)
+endforeach(filename)
+
+########################################################################
+# RPM package specific
+########################################################################
+foreach(filename post_install post_uninstall pre_install pre_uninstall)
+ string(TOUPPER ${filename} filename_upper)
+ list(APPEND CPACK_RPM_${filename_upper}_SCRIPT_FILE ${CMAKE_BINARY_DIR}/Packaging/${filename})
+ file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/Packaging)
+ configure_file(
+ ${CMAKE_SOURCE_DIR}/cmake/Packaging/${filename}.in
+ ${CMAKE_BINARY_DIR}/Packaging/${filename}
+ @ONLY)
+endforeach(filename)
+
+########################################################################
+# NSIS package specific
+########################################################################
+set(CPACK_NSIS_MODIFY_PATH ON)
+
+set(HLKM_ENV "\\\"SYSTEM\\\\CurrentControlSet\\\\Control\\\\Session Manager\\\\Environment\\\"")
diff --git a/cmake/Modules/GrPlatform.cmake b/cmake/Modules/GrPlatform.cmake
new file mode 100644
index 000000000..5b7e886f8
--- /dev/null
+++ b/cmake/Modules/GrPlatform.cmake
@@ -0,0 +1,54 @@
+# Copyright 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.
+
+if(DEFINED __INCLUDED_GR_PLATFORM_CMAKE)
+ return()
+endif()
+set(__INCLUDED_GR_PLATFORM_CMAKE TRUE)
+
+########################################################################
+# Setup additional defines for OS types
+########################################################################
+if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
+ set(LINUX TRUE)
+endif()
+
+if(LINUX AND EXISTS "/etc/debian_version")
+ set(DEBIAN TRUE)
+endif()
+
+if(LINUX AND EXISTS "/etc/redhat-release")
+ set(REDHAT TRUE)
+endif()
+
+if(LINUX AND EXISTS "/etc/slackware-version")
+ set(SLACKWARE TRUE)
+endif()
+
+########################################################################
+# when the library suffix should be 64 (applies to redhat linux family)
+########################################################################
+if (REDHAT OR SLACKWARE)
+ set(LIB64_CONVENTION TRUE)
+endif()
+
+if(NOT DEFINED LIB_SUFFIX AND LIB64_CONVENTION AND CMAKE_SYSTEM_PROCESSOR MATCHES "64$")
+ set(LIB_SUFFIX 64)
+endif()
+set(LIB_SUFFIX ${LIB_SUFFIX} CACHE STRING "lib directory suffix")
diff --git a/cmake/Modules/GrPython.cmake b/cmake/Modules/GrPython.cmake
new file mode 100644
index 000000000..791114e05
--- /dev/null
+++ b/cmake/Modules/GrPython.cmake
@@ -0,0 +1,234 @@
+# 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.
+
+if(DEFINED __INCLUDED_GR_PYTHON_CMAKE)
+ return()
+endif()
+set(__INCLUDED_GR_PYTHON_CMAKE TRUE)
+
+########################################################################
+# Setup the python interpreter:
+# This allows the user to specify a specific interpreter,
+# or finds the interpreter via the built-in cmake module.
+########################################################################
+#this allows the user to override PYTHON_EXECUTABLE
+if(PYTHON_EXECUTABLE)
+
+ set(PYTHONINTERP_FOUND TRUE)
+
+#otherwise if not set, try to automatically find it
+else(PYTHON_EXECUTABLE)
+
+ #use the built-in find script
+ find_package(PythonInterp)
+
+ #and if that fails use the find program routine
+ if(NOT PYTHONINTERP_FOUND)
+ find_program(PYTHON_EXECUTABLE NAMES python python2.7 python2.6 python2.5)
+ if(PYTHON_EXECUTABLE)
+ set(PYTHONINTERP_FOUND TRUE)
+ endif(PYTHON_EXECUTABLE)
+ endif(NOT PYTHONINTERP_FOUND)
+
+endif(PYTHON_EXECUTABLE)
+
+#make the path to the executable appear in the cmake gui
+set(PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE} CACHE FILEPATH "python interpreter")
+
+#make sure we can use -B with python (introduced in 2.6)
+if(PYTHON_EXECUTABLE)
+ execute_process(
+ COMMAND ${PYTHON_EXECUTABLE} -B -c ""
+ OUTPUT_QUIET ERROR_QUIET
+ RESULT_VARIABLE PYTHON_HAS_DASH_B_RESULT
+ )
+ if(PYTHON_HAS_DASH_B_RESULT EQUAL 0)
+ set(PYTHON_DASH_B "-B")
+ endif()
+endif(PYTHON_EXECUTABLE)
+
+########################################################################
+# Check for the existence of a python module:
+# - desc a string description of the check
+# - mod the name of the module to import
+# - cmd an additional command to run
+# - have the result variable to set
+########################################################################
+macro(GR_PYTHON_CHECK_MODULE desc mod cmd have)
+ message(STATUS "")
+ message(STATUS "Python checking for ${desc}")
+ execute_process(
+ COMMAND ${PYTHON_EXECUTABLE} -c "
+#########################################
+try:
+ import ${mod}
+ assert ${cmd}
+except ImportError, AssertionError: exit(-1)
+except: pass
+#########################################"
+ RESULT_VARIABLE ${have}
+ )
+ if(${have} EQUAL 0)
+ message(STATUS "Python checking for ${desc} - found")
+ set(${have} TRUE)
+ else(${have} EQUAL 0)
+ message(STATUS "Python checking for ${desc} - not found")
+ set(${have} FALSE)
+ endif(${have} EQUAL 0)
+endmacro(GR_PYTHON_CHECK_MODULE)
+
+########################################################################
+# Sets the python installation directory GR_PYTHON_DIR
+########################################################################
+if(NOT DEFINED GR_PYTHON_DIR)
+execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "
+from distutils import sysconfig
+print sysconfig.get_python_lib(plat_specific=True, prefix='')
+" OUTPUT_VARIABLE GR_PYTHON_DIR OUTPUT_STRIP_TRAILING_WHITESPACE
+)
+endif()
+file(TO_CMAKE_PATH ${GR_PYTHON_DIR} GR_PYTHON_DIR)
+
+########################################################################
+# Create an always-built target with a unique name
+# Usage: GR_UNIQUE_TARGET(<description> <dependencies list>)
+########################################################################
+function(GR_UNIQUE_TARGET desc)
+ file(RELATIVE_PATH reldir ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR})
+ execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import re, hashlib
+unique = hashlib.md5('${reldir}${ARGN}').hexdigest()[:5]
+print(re.sub('\\W', '_', '${desc} ${reldir} ' + unique))"
+ OUTPUT_VARIABLE _target OUTPUT_STRIP_TRAILING_WHITESPACE)
+ add_custom_target(${_target} ALL DEPENDS ${ARGN})
+endfunction(GR_UNIQUE_TARGET)
+
+########################################################################
+# Install python sources (also builds and installs byte-compiled python)
+########################################################################
+function(GR_PYTHON_INSTALL)
+ include(CMakeParseArgumentsCopy)
+ CMAKE_PARSE_ARGUMENTS(GR_PYTHON_INSTALL "" "DESTINATION;COMPONENT" "FILES;PROGRAMS" ${ARGN})
+
+ ####################################################################
+ if(GR_PYTHON_INSTALL_FILES)
+ ####################################################################
+ install(${ARGN}) #installs regular python files
+
+ #create a list of all generated files
+ unset(pysrcfiles)
+ unset(pycfiles)
+ unset(pyofiles)
+ foreach(pyfile ${GR_PYTHON_INSTALL_FILES})
+ get_filename_component(pyfile ${pyfile} ABSOLUTE)
+ list(APPEND pysrcfiles ${pyfile})
+
+ #determine if this file is in the source or binary directory
+ file(RELATIVE_PATH source_rel_path ${CMAKE_CURRENT_SOURCE_DIR} ${pyfile})
+ string(LENGTH "${source_rel_path}" source_rel_path_len)
+ file(RELATIVE_PATH binary_rel_path ${CMAKE_CURRENT_BINARY_DIR} ${pyfile})
+ string(LENGTH "${binary_rel_path}" binary_rel_path_len)
+
+ #and set the generated path appropriately
+ if(${source_rel_path_len} GREATER ${binary_rel_path_len})
+ set(pygenfile ${CMAKE_CURRENT_BINARY_DIR}/${binary_rel_path})
+ else()
+ set(pygenfile ${CMAKE_CURRENT_BINARY_DIR}/${source_rel_path})
+ endif()
+ list(APPEND pycfiles ${pygenfile}c)
+ list(APPEND pyofiles ${pygenfile}o)
+
+ #ensure generation path exists
+ get_filename_component(pygen_path ${pygenfile} PATH)
+ file(MAKE_DIRECTORY ${pygen_path})
+
+ endforeach(pyfile)
+
+ #the command to generate the pyc files
+ add_custom_command(
+ DEPENDS ${pysrcfiles} OUTPUT ${pycfiles}
+ COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_BINARY_DIR}/python_compile_helper.py ${pysrcfiles} ${pycfiles}
+ )
+
+ #the command to generate the pyo files
+ add_custom_command(
+ DEPENDS ${pysrcfiles} OUTPUT ${pyofiles}
+ COMMAND ${PYTHON_EXECUTABLE} -O ${CMAKE_BINARY_DIR}/python_compile_helper.py ${pysrcfiles} ${pyofiles}
+ )
+
+ #create install rule and add generated files to target list
+ set(python_install_gen_targets ${pycfiles} ${pyofiles})
+ install(FILES ${python_install_gen_targets}
+ DESTINATION ${GR_PYTHON_INSTALL_DESTINATION}
+ COMPONENT ${GR_PYTHON_INSTALL_COMPONENT}
+ )
+
+
+ ####################################################################
+ elseif(GR_PYTHON_INSTALL_PROGRAMS)
+ ####################################################################
+ file(TO_NATIVE_PATH ${PYTHON_EXECUTABLE} pyexe_native)
+
+ if (CMAKE_CROSSCOMPILING)
+ set(pyexe_native /usr/bin/env python)
+ endif()
+
+ foreach(pyfile ${GR_PYTHON_INSTALL_PROGRAMS})
+ get_filename_component(pyfile_name ${pyfile} NAME)
+ get_filename_component(pyfile ${pyfile} ABSOLUTE)
+ string(REPLACE "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" pyexefile "${pyfile}.exe")
+ list(APPEND python_install_gen_targets ${pyexefile})
+
+ get_filename_component(pyexefile_path ${pyexefile} PATH)
+ file(MAKE_DIRECTORY ${pyexefile_path})
+
+ add_custom_command(
+ OUTPUT ${pyexefile} DEPENDS ${pyfile}
+ COMMAND ${PYTHON_EXECUTABLE} -c
+ \"open('${pyexefile}', 'w').write('\#!${pyexe_native}\\n'+open('${pyfile}').read())\"
+ COMMENT "Shebangin ${pyfile_name}"
+ )
+
+ #on windows, python files need an extension to execute
+ get_filename_component(pyfile_ext ${pyfile} EXT)
+ if(WIN32 AND NOT pyfile_ext)
+ set(pyfile_name "${pyfile_name}.py")
+ endif()
+
+ install(PROGRAMS ${pyexefile} RENAME ${pyfile_name}
+ DESTINATION ${GR_PYTHON_INSTALL_DESTINATION}
+ COMPONENT ${GR_PYTHON_INSTALL_COMPONENT}
+ )
+ endforeach(pyfile)
+
+ endif()
+
+ GR_UNIQUE_TARGET("pygen" ${python_install_gen_targets})
+
+endfunction(GR_PYTHON_INSTALL)
+
+########################################################################
+# Write the python helper script that generates byte code files
+########################################################################
+file(WRITE ${CMAKE_BINARY_DIR}/python_compile_helper.py "
+import sys, py_compile
+files = sys.argv[1:]
+srcs, gens = files[:len(files)/2], files[len(files)/2:]
+for src, gen in zip(srcs, gens):
+ py_compile.compile(file=src, cfile=gen, doraise=True)
+")
diff --git a/cmake/Modules/GrSetupQt4.cmake b/cmake/Modules/GrSetupQt4.cmake
new file mode 100644
index 000000000..2fa4d9bab
--- /dev/null
+++ b/cmake/Modules/GrSetupQt4.cmake
@@ -0,0 +1,156 @@
+# Copyright 2013 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.
+
+if(DEFINED __INCLUDED_GR_USEQT4_CMAKE)
+ return()
+endif()
+set(__INCLUDED_GR_USEQT4_CMAKE TRUE)
+
+# This file is derived from the default "UseQt4" file provided by
+# CMake. This version sets the variables "QT_INCLUDE_DIRS",
+# "QT_LIBRARIES", and "QT_LIBRARIES_PLUGINS" depending on those
+# requested during the "find_package(Qt4 ...)" function call, but
+# without actually adding them to the include or library search
+# directories ("include_directories" or "link_directories"). The
+# adding in is done by the CMakeLists.txt build scripts in the using
+# project.
+
+# Copyright from the original file, as required by the license.
+################################################################
+# CMake - Cross Platform Makefile Generator
+# Copyright 2000-2011 Kitware, Inc., Insight Software Consortium
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# * Neither the names of Kitware, Inc., the Insight Software Consortium,
+# nor the names of their contributors may be used to endorse or promote
+# products derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+################################################################
+
+ADD_DEFINITIONS(${QT_DEFINITIONS})
+SET_PROPERTY(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_DEBUG QT_DEBUG)
+SET_PROPERTY(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_RELEASE QT_NO_DEBUG)
+SET_PROPERTY(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_RELWITHDEBINFO QT_NO_DEBUG)
+SET_PROPERTY(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_MINSIZEREL QT_NO_DEBUG)
+IF(NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)
+ SET_PROPERTY(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS QT_NO_DEBUG)
+ENDIF()
+
+SET(QT_INCLUDE_DIRS ${QT_INCLUDE_DIR})
+SET(QT_LIBRARIES "")
+SET(QT_LIBRARIES_PLUGINS "")
+
+IF (QT_USE_QTMAIN)
+ IF (Q_WS_WIN)
+ SET(QT_LIBRARIES ${QT_LIBRARIES} ${QT_QTMAIN_LIBRARY})
+ ENDIF (Q_WS_WIN)
+ENDIF (QT_USE_QTMAIN)
+
+IF(QT_DONT_USE_QTGUI)
+ SET(QT_USE_QTGUI 0)
+ELSE(QT_DONT_USE_QTGUI)
+ SET(QT_USE_QTGUI 1)
+ENDIF(QT_DONT_USE_QTGUI)
+
+IF(QT_DONT_USE_QTCORE)
+ SET(QT_USE_QTCORE 0)
+ELSE(QT_DONT_USE_QTCORE)
+ SET(QT_USE_QTCORE 1)
+ENDIF(QT_DONT_USE_QTCORE)
+
+IF (QT_USE_QT3SUPPORT)
+ ADD_DEFINITIONS(-DQT3_SUPPORT)
+ENDIF (QT_USE_QT3SUPPORT)
+
+# list dependent modules, so dependent libraries are added
+SET(QT_QT3SUPPORT_MODULE_DEPENDS QTGUI QTSQL QTXML QTNETWORK QTCORE)
+SET(QT_QTSVG_MODULE_DEPENDS QTGUI QTXML QTCORE)
+SET(QT_QTUITOOLS_MODULE_DEPENDS QTGUI QTXML QTCORE)
+SET(QT_QTHELP_MODULE_DEPENDS QTGUI QTSQL QTXML QTNETWORK QTCORE)
+IF(QT_QTDBUS_FOUND)
+ SET(QT_PHONON_MODULE_DEPENDS QTGUI QTDBUS QTCORE)
+ELSE(QT_QTDBUS_FOUND)
+ SET(QT_PHONON_MODULE_DEPENDS QTGUI QTCORE)
+ENDIF(QT_QTDBUS_FOUND)
+SET(QT_QTDBUS_MODULE_DEPENDS QTXML QTCORE)
+SET(QT_QTXMLPATTERNS_MODULE_DEPENDS QTNETWORK QTCORE)
+SET(QT_QAXCONTAINER_MODULE_DEPENDS QTGUI QTCORE)
+SET(QT_QAXSERVER_MODULE_DEPENDS QTGUI QTCORE)
+SET(QT_QTSCRIPTTOOLS_MODULE_DEPENDS QTGUI QTCORE)
+SET(QT_QTWEBKIT_MODULE_DEPENDS QTXMLPATTERNS QTGUI QTCORE)
+SET(QT_QTDECLARATIVE_MODULE_DEPENDS QTSCRIPT QTSVG QTSQL QTXMLPATTERNS QTGUI QTCORE)
+SET(QT_QTMULTIMEDIA_MODULE_DEPENDS QTGUI QTCORE)
+SET(QT_QTOPENGL_MODULE_DEPENDS QTGUI QTCORE)
+SET(QT_QTSCRIPT_MODULE_DEPENDS QTCORE)
+SET(QT_QTGUI_MODULE_DEPENDS QTCORE)
+SET(QT_QTTEST_MODULE_DEPENDS QTCORE)
+SET(QT_QTXML_MODULE_DEPENDS QTCORE)
+SET(QT_QTSQL_MODULE_DEPENDS QTCORE)
+SET(QT_QTNETWORK_MODULE_DEPENDS QTCORE)
+
+# Qt modules (in order of dependence)
+FOREACH(module QT3SUPPORT QTOPENGL QTASSISTANT QTDESIGNER QTMOTIF QTNSPLUGIN
+ QAXSERVER QAXCONTAINER QTDECLARATIVE QTSCRIPT QTSVG QTUITOOLS QTHELP
+ QTWEBKIT PHONON QTSCRIPTTOOLS QTMULTIMEDIA QTXMLPATTERNS QTGUI QTTEST
+ QTDBUS QTXML QTSQL QTNETWORK QTCORE)
+
+ IF (QT_USE_${module} OR QT_USE_${module}_DEPENDS)
+ IF (QT_${module}_FOUND)
+ IF(QT_USE_${module})
+ STRING(REPLACE "QT" "" qt_module_def "${module}")
+ ADD_DEFINITIONS(-DQT_${qt_module_def}_LIB)
+ SET(QT_INCLUDE_DIRS ${QT_INCLUDE_DIRS} ${QT_${module}_INCLUDE_DIR})
+ ENDIF(QT_USE_${module})
+ SET(QT_LIBRARIES ${QT_LIBRARIES} ${QT_${module}_LIBRARY})
+ SET(QT_LIBRARIES_PLUGINS ${QT_LIBRARIES_PLUGINS} ${QT_${module}_PLUGINS})
+ IF(QT_IS_STATIC)
+ SET(QT_LIBRARIES ${QT_LIBRARIES} ${QT_${module}_LIB_DEPENDENCIES})
+ ENDIF(QT_IS_STATIC)
+ FOREACH(depend_module ${QT_${module}_MODULE_DEPENDS})
+ SET(QT_USE_${depend_module}_DEPENDS 1)
+ ENDFOREACH(depend_module ${QT_${module}_MODULE_DEPENDS})
+ ELSE (QT_${module}_FOUND)
+ MESSAGE("Qt ${module} library not found.")
+ ENDIF (QT_${module}_FOUND)
+ ENDIF (QT_USE_${module} OR QT_USE_${module}_DEPENDS)
+
+ENDFOREACH(module)
diff --git a/cmake/Modules/GrSwig.cmake b/cmake/Modules/GrSwig.cmake
new file mode 100644
index 000000000..505fe104c
--- /dev/null
+++ b/cmake/Modules/GrSwig.cmake
@@ -0,0 +1,236 @@
+# 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.
+
+if(DEFINED __INCLUDED_GR_SWIG_CMAKE)
+ return()
+endif()
+set(__INCLUDED_GR_SWIG_CMAKE TRUE)
+
+include(GrPython)
+
+########################################################################
+# Builds a swig documentation file to be generated into python docstrings
+# Usage: GR_SWIG_MAKE_DOCS(output_file input_path input_path....)
+#
+# Set the following variable to specify extra dependent targets:
+# - GR_SWIG_DOCS_SOURCE_DEPS
+# - GR_SWIG_DOCS_TARGET_DEPS
+########################################################################
+function(GR_SWIG_MAKE_DOCS output_file)
+ if(ENABLE_DOXYGEN)
+
+ #setup the input files variable list, quote formated
+ set(input_files)
+ unset(INPUT_PATHS)
+ foreach(input_path ${ARGN})
+ if (IS_DIRECTORY ${input_path}) #when input path is a directory
+ file(GLOB input_path_h_files ${input_path}/*.h)
+ else() #otherwise its just a file, no glob
+ set(input_path_h_files ${input_path})
+ endif()
+ list(APPEND input_files ${input_path_h_files})
+ set(INPUT_PATHS "${INPUT_PATHS} \"${input_path}\"")
+ endforeach(input_path)
+
+ #determine the output directory
+ get_filename_component(name ${output_file} NAME_WE)
+ get_filename_component(OUTPUT_DIRECTORY ${output_file} PATH)
+ set(OUTPUT_DIRECTORY ${OUTPUT_DIRECTORY}/${name}_swig_docs)
+ make_directory(${OUTPUT_DIRECTORY})
+
+ #generate the Doxyfile used by doxygen
+ configure_file(
+ ${CMAKE_SOURCE_DIR}/docs/doxygen/Doxyfile.swig_doc.in
+ ${OUTPUT_DIRECTORY}/Doxyfile
+ @ONLY)
+
+ #Create a dummy custom command that depends on other targets
+ include(GrMiscUtils)
+ GR_GEN_TARGET_DEPS(_${name}_tag tag_deps ${GR_SWIG_DOCS_TARGET_DEPS})
+
+ #call doxygen on the Doxyfile + input headers
+ add_custom_command(
+ OUTPUT ${OUTPUT_DIRECTORY}/xml/index.xml
+ DEPENDS ${input_files} ${GR_SWIG_DOCS_SOURCE_DEPS} ${tag_deps}
+ COMMAND ${DOXYGEN_EXECUTABLE} ${OUTPUT_DIRECTORY}/Doxyfile
+ COMMENT "Generating doxygen xml for ${name} docs"
+ )
+
+ #call the swig_doc script on the xml files
+ add_custom_command(
+ OUTPUT ${output_file}
+ DEPENDS ${input_files} ${stamp-file} ${OUTPUT_DIRECTORY}/xml/index.xml
+ COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B}
+ ${CMAKE_SOURCE_DIR}/docs/doxygen/swig_doc.py
+ ${OUTPUT_DIRECTORY}/xml
+ ${output_file}
+ COMMENT "Generating python docstrings for ${name}"
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/docs/doxygen
+ )
+
+ else(ENABLE_DOXYGEN)
+ file(WRITE ${output_file} "\n") #no doxygen -> empty file
+ endif(ENABLE_DOXYGEN)
+endfunction(GR_SWIG_MAKE_DOCS)
+
+########################################################################
+# Build a swig target for the common gnuradio use case. Usage:
+# GR_SWIG_MAKE(target ifile ifile ifile...)
+#
+# Set the following variables before calling:
+# - GR_SWIG_FLAGS
+# - GR_SWIG_INCLUDE_DIRS
+# - GR_SWIG_LIBRARIES
+# - GR_SWIG_SOURCE_DEPS
+# - GR_SWIG_TARGET_DEPS
+# - GR_SWIG_DOC_FILE
+# - GR_SWIG_DOC_DIRS
+########################################################################
+macro(GR_SWIG_MAKE name)
+ set(ifiles ${ARGN})
+
+ list(APPEND GR_SWIG_LIBRARIES ${GR_MOAR_LIBRARIES})
+
+ #do swig doc generation if specified
+ if (GR_SWIG_DOC_FILE)
+ set(GR_SWIG_DOCS_SOURCE_DEPS ${GR_SWIG_SOURCE_DEPS})
+ set(GR_SWIG_DOCS_TARGET_DEPS ${GR_SWIG_TARGET_DEPS})
+ GR_SWIG_MAKE_DOCS(${GR_SWIG_DOC_FILE} ${GR_SWIG_DOC_DIRS})
+ add_custom_target(${name}_swig_doc DEPENDS ${GR_SWIG_DOC_FILE})
+ list(APPEND GR_SWIG_TARGET_DEPS ${name}_swig_doc)
+ endif()
+
+ #append additional include directories
+ find_package(PythonLibs)
+ list(APPEND GR_SWIG_INCLUDE_DIRS ${PYTHON_INCLUDE_PATH}) #deprecated name (now dirs)
+ list(APPEND GR_SWIG_INCLUDE_DIRS ${PYTHON_INCLUDE_DIRS})
+ list(APPEND GR_SWIG_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR})
+ list(APPEND GR_SWIG_INCLUDE_DIRS ${CMAKE_CURRENT_BINARY_DIR})
+
+ #determine include dependencies for swig file
+ execute_process(
+ COMMAND ${PYTHON_EXECUTABLE}
+ ${CMAKE_BINARY_DIR}/get_swig_deps.py
+ "${ifiles}" "${GR_SWIG_INCLUDE_DIRS}"
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ OUTPUT_VARIABLE SWIG_MODULE_${name}_EXTRA_DEPS
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+ )
+
+ #Create a dummy custom command that depends on other targets
+ include(GrMiscUtils)
+ GR_GEN_TARGET_DEPS(_${name}_swig_tag tag_deps ${GR_SWIG_TARGET_DEPS})
+ set(tag_file ${CMAKE_CURRENT_BINARY_DIR}/${name}.tag)
+ add_custom_command(
+ OUTPUT ${tag_file}
+ DEPENDS ${GR_SWIG_SOURCE_DEPS} ${tag_deps}
+ COMMAND ${CMAKE_COMMAND} -E touch ${tag_file}
+ )
+
+ #append the specified include directories
+ include_directories(${GR_SWIG_INCLUDE_DIRS})
+ list(APPEND SWIG_MODULE_${name}_EXTRA_DEPS ${tag_file})
+
+ #setup the swig flags with flags and include directories
+ set(CMAKE_SWIG_FLAGS -fvirtual -modern -keyword -w511 -module ${name} ${GR_SWIG_FLAGS})
+ foreach(dir ${GR_SWIG_INCLUDE_DIRS})
+ list(APPEND CMAKE_SWIG_FLAGS "-I${dir}")
+ endforeach(dir)
+
+ #set the C++ property on the swig .i file so it builds
+ set_source_files_properties(${ifiles} PROPERTIES CPLUSPLUS ON)
+
+ #setup the actual swig library target to be built
+ include(UseSWIG)
+ SWIG_ADD_MODULE(${name} python ${ifiles})
+ SWIG_LINK_LIBRARIES(${name} ${PYTHON_LIBRARIES} ${GR_SWIG_LIBRARIES})
+
+endmacro(GR_SWIG_MAKE)
+
+########################################################################
+# Install swig targets generated by GR_SWIG_MAKE. Usage:
+# GR_SWIG_INSTALL(
+# TARGETS target target target...
+# [DESTINATION destination]
+# [COMPONENT component]
+# )
+########################################################################
+macro(GR_SWIG_INSTALL)
+
+ include(CMakeParseArgumentsCopy)
+ CMAKE_PARSE_ARGUMENTS(GR_SWIG_INSTALL "" "DESTINATION;COMPONENT" "TARGETS" ${ARGN})
+
+ foreach(name ${GR_SWIG_INSTALL_TARGETS})
+ install(TARGETS ${SWIG_MODULE_${name}_REAL_NAME}
+ DESTINATION ${GR_SWIG_INSTALL_DESTINATION}
+ COMPONENT ${GR_SWIG_INSTALL_COMPONENT}
+ )
+
+ include(GrPython)
+ GR_PYTHON_INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${name}.py
+ DESTINATION ${GR_SWIG_INSTALL_DESTINATION}
+ COMPONENT ${GR_SWIG_INSTALL_COMPONENT}
+ )
+
+ GR_LIBTOOL(
+ TARGET ${SWIG_MODULE_${name}_REAL_NAME}
+ DESTINATION ${GR_SWIG_INSTALL_DESTINATION}
+ )
+
+ endforeach(name)
+
+endmacro(GR_SWIG_INSTALL)
+
+########################################################################
+# Generate a python file that can determine swig dependencies.
+# Used by the make macro above to determine extra dependencies.
+# When you build C++, CMake figures out the header dependencies.
+# This code essentially performs that logic for swig includes.
+########################################################################
+file(WRITE ${CMAKE_BINARY_DIR}/get_swig_deps.py "
+
+import os, sys, re
+
+i_include_matcher = re.compile('%(include|import)\\s*[<|\"](.*)[>|\"]')
+h_include_matcher = re.compile('#(include)\\s*[<|\"](.*)[>|\"]')
+include_dirs = sys.argv[2].split(';')
+
+def get_swig_incs(file_path):
+ if file_path.endswith('.i'): matcher = i_include_matcher
+ else: matcher = h_include_matcher
+ file_contents = open(file_path, 'r').read()
+ return matcher.findall(file_contents, re.MULTILINE)
+
+def get_swig_deps(file_path, level):
+ deps = [file_path]
+ if level == 0: return deps
+ for keyword, inc_file in get_swig_incs(file_path):
+ for inc_dir in include_dirs:
+ inc_path = os.path.join(inc_dir, inc_file)
+ if not os.path.exists(inc_path): continue
+ deps.extend(get_swig_deps(inc_path, level-1))
+ break #found, we dont search in lower prio inc dirs
+ return deps
+
+if __name__ == '__main__':
+ ifiles = sys.argv[1].split(';')
+ deps = sum([get_swig_deps(ifile, 3) for ifile in ifiles], [])
+ #sys.stderr.write(';'.join(set(deps)) + '\\n\\n')
+ print(';'.join(set(deps)))
+")
diff --git a/cmake/Modules/GrTest.cmake b/cmake/Modules/GrTest.cmake
new file mode 100644
index 000000000..4723cca58
--- /dev/null
+++ b/cmake/Modules/GrTest.cmake
@@ -0,0 +1,137 @@
+# 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.
+
+if(DEFINED __INCLUDED_GR_TEST_CMAKE)
+ return()
+endif()
+set(__INCLUDED_GR_TEST_CMAKE TRUE)
+
+########################################################################
+# Add a unit test and setup the environment for a unit test.
+# Takes the same arguments as the ADD_TEST function.
+#
+# Before calling set the following variables:
+# GR_TEST_TARGET_DEPS - built targets for the library path
+# GR_TEST_LIBRARY_DIRS - directories for the library path
+# GR_TEST_PYTHON_DIRS - directories for the python path
+########################################################################
+function(GR_ADD_TEST test_name)
+
+ #Ensure that the build exe also appears in the PATH.
+ list(APPEND GR_TEST_TARGET_DEPS ${ARGN})
+
+ #In the land of windows, all libraries must be in the PATH.
+ #Since the dependent libraries are not yet installed,
+ #we must manually set them in the PATH to run tests.
+ #The following appends the path of a target dependency.
+ foreach(target ${GR_TEST_TARGET_DEPS})
+ get_target_property(location ${target} LOCATION)
+ if(location)
+ get_filename_component(path ${location} PATH)
+ string(REGEX REPLACE "\\$\\(.*\\)" ${CMAKE_BUILD_TYPE} path ${path})
+ list(APPEND GR_TEST_LIBRARY_DIRS ${path})
+ endif(location)
+ endforeach(target)
+
+ if(WIN32)
+ #SWIG generates the python library files into a subdirectory.
+ #Therefore, we must append this subdirectory into PYTHONPATH.
+ #Only do this for the python directories matching the following:
+ foreach(pydir ${GR_TEST_PYTHON_DIRS})
+ get_filename_component(name ${pydir} NAME)
+ if(name MATCHES "^(swig|lib|src)$")
+ list(APPEND GR_TEST_PYTHON_DIRS ${pydir}/${CMAKE_BUILD_TYPE})
+ endif()
+ endforeach(pydir)
+ endif(WIN32)
+
+ file(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR} srcdir)
+ file(TO_NATIVE_PATH "${GR_TEST_LIBRARY_DIRS}" libpath) #ok to use on dir list?
+ file(TO_NATIVE_PATH "${GR_TEST_PYTHON_DIRS}" pypath) #ok to use on dir list?
+
+ set(environs "GR_DONT_LOAD_PREFS=1" "srcdir=${srcdir}")
+
+ #http://www.cmake.org/pipermail/cmake/2009-May/029464.html
+ #Replaced this add test + set environs code with the shell script generation.
+ #Its nicer to be able to manually run the shell script to diagnose problems.
+ #ADD_TEST(${ARGV})
+ #SET_TESTS_PROPERTIES(${test_name} PROPERTIES ENVIRONMENT "${environs}")
+
+ if(UNIX)
+ set(LD_PATH_VAR "LD_LIBRARY_PATH")
+ if(APPLE)
+ set(LD_PATH_VAR "DYLD_LIBRARY_PATH")
+ endif()
+
+ set(binpath "${CMAKE_CURRENT_BINARY_DIR}:$PATH")
+ list(APPEND libpath "$${LD_PATH_VAR}")
+ list(APPEND pypath "$PYTHONPATH")
+
+ #replace list separator with the path separator
+ string(REPLACE ";" ":" libpath "${libpath}")
+ string(REPLACE ";" ":" pypath "${pypath}")
+ list(APPEND environs "PATH=${binpath}" "${LD_PATH_VAR}=${libpath}" "PYTHONPATH=${pypath}")
+
+ #generate a bat file that sets the environment and runs the test
+ find_program(SHELL sh)
+ set(sh_file ${CMAKE_CURRENT_BINARY_DIR}/${test_name}_test.sh)
+ file(WRITE ${sh_file} "#!${SHELL}\n")
+ #each line sets an environment variable
+ foreach(environ ${environs})
+ file(APPEND ${sh_file} "export ${environ}\n")
+ endforeach(environ)
+ #load the command to run with its arguments
+ foreach(arg ${ARGN})
+ file(APPEND ${sh_file} "${arg} ")
+ endforeach(arg)
+ file(APPEND ${sh_file} "\n")
+
+ #make the shell file executable
+ execute_process(COMMAND chmod +x ${sh_file})
+
+ add_test(${test_name} ${SHELL} ${sh_file})
+
+ endif(UNIX)
+
+ if(WIN32)
+ list(APPEND libpath ${DLL_PATHS} "%PATH%")
+ list(APPEND pypath "%PYTHONPATH%")
+
+ #replace list separator with the path separator (escaped)
+ string(REPLACE ";" "\\;" libpath "${libpath}")
+ string(REPLACE ";" "\\;" pypath "${pypath}")
+ list(APPEND environs "PATH=${libpath}" "PYTHONPATH=${pypath}")
+
+ #generate a bat file that sets the environment and runs the test
+ set(bat_file ${CMAKE_CURRENT_BINARY_DIR}/${test_name}_test.bat)
+ file(WRITE ${bat_file} "@echo off\n")
+ #each line sets an environment variable
+ foreach(environ ${environs})
+ file(APPEND ${bat_file} "SET ${environ}\n")
+ endforeach(environ)
+ #load the command to run with its arguments
+ foreach(arg ${ARGN})
+ file(APPEND ${bat_file} "${arg} ")
+ endforeach(arg)
+ file(APPEND ${bat_file} "\n")
+
+ add_test(${test_name} ${bat_file})
+ endif(WIN32)
+
+endfunction(GR_ADD_TEST)
diff --git a/cmake/Modules/GrVersion.cmake b/cmake/Modules/GrVersion.cmake
new file mode 100644
index 000000000..9199a702b
--- /dev/null
+++ b/cmake/Modules/GrVersion.cmake
@@ -0,0 +1,76 @@
+# Copyright 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.
+
+if(DEFINED __INCLUDED_GR_VERSION_CMAKE)
+ return()
+endif()
+set(__INCLUDED_GR_VERSION_CMAKE TRUE)
+
+#eventually, replace version.sh and fill in the variables below
+set(MAJOR_VERSION ${VERSION_INFO_MAJOR_VERSION})
+set(API_COMPAT ${VERSION_INFO_API_COMPAT})
+set(MINOR_VERSION ${VERSION_INFO_MINOR_VERSION})
+set(MAINT_VERSION ${VERSION_INFO_MAINT_VERSION})
+
+########################################################################
+# Extract the version string from git describe.
+########################################################################
+find_package(Git)
+
+if(GIT_FOUND AND EXISTS ${CMAKE_SOURCE_DIR}/.git)
+ message(STATUS "Extracting version information from git describe...")
+ execute_process(
+ COMMAND ${GIT_EXECUTABLE} describe --always --abbrev=8 --long
+ OUTPUT_VARIABLE GIT_DESCRIBE OUTPUT_STRIP_TRAILING_WHITESPACE
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
+ )
+else()
+ set(GIT_DESCRIBE "v${MAJOR_VERSION}.${API_COMPAT}.x-xxx-xunknown")
+endif()
+
+########################################################################
+# Use the logic below to set the version constants
+########################################################################
+if("${MINOR_VERSION}" STREQUAL "git")
+ # VERSION: 3.3git-xxx-gxxxxxxxx
+ # DOCVER: 3.3git
+ # LIBVER: 3.3git
+ set(VERSION "${GIT_DESCRIBE}")
+ set(DOCVER "${MAJOR_VERSION}.${API_COMPAT}${MINOR_VERSION}")
+ set(LIBVER "${MAJOR_VERSION}.${API_COMPAT}${MINOR_VERSION}")
+elseif("${MAINT_VERSION}" STREQUAL "git")
+ # VERSION: 3.3.1git-xxx-gxxxxxxxx
+ # DOCVER: 3.3.1git
+ # LIBVER: 3.3.1git
+ set(VERSION "${GIT_DESCRIBE}")
+ set(DOCVER "${MAJOR_VERSION}.${API_COMPAT}.${MINOR_VERSION}${MAINT_VERSION}")
+ set(LIBVER "${MAJOR_VERSION}.${API_COMPAT}.${MINOR_VERSION}${MAINT_VERSION}")
+else()
+ # This is a numbered release.
+ # VERSION: 3.3.1{.x}
+ # DOCVER: 3.3.1{.x}
+ # LIBVER: 3.3.1{.x}
+ if("${MAINT_VERSION}" STREQUAL "0")
+ set(VERSION "${MAJOR_VERSION}.${API_COMPAT}.${MINOR_VERSION}")
+ else()
+ set(VERSION "${MAJOR_VERSION}.${API_COMPAT}.${MINOR_VERSION}.${MAINT_VERSION}")
+ endif()
+ set(DOCVER "${VERSION}")
+ set(LIBVER "${VERSION}")
+endif()
diff --git a/cmake/Modules/LibFindMacros.cmake b/cmake/Modules/LibFindMacros.cmake
new file mode 100644
index 000000000..69975c51b
--- /dev/null
+++ b/cmake/Modules/LibFindMacros.cmake
@@ -0,0 +1,99 @@
+# Works the same as find_package, but forwards the "REQUIRED" and "QUIET" arguments
+# used for the current package. For this to work, the first parameter must be the
+# prefix of the current package, then the prefix of the new package etc, which are
+# passed to find_package.
+macro (libfind_package PREFIX)
+ set (LIBFIND_PACKAGE_ARGS ${ARGN})
+ if (${PREFIX}_FIND_QUIETLY)
+ set (LIBFIND_PACKAGE_ARGS ${LIBFIND_PACKAGE_ARGS} QUIET)
+ endif (${PREFIX}_FIND_QUIETLY)
+ if (${PREFIX}_FIND_REQUIRED)
+ set (LIBFIND_PACKAGE_ARGS ${LIBFIND_PACKAGE_ARGS} REQUIRED)
+ endif (${PREFIX}_FIND_REQUIRED)
+ find_package(${LIBFIND_PACKAGE_ARGS})
+endmacro (libfind_package)
+
+# CMake developers made the UsePkgConfig system deprecated in the same release (2.6)
+# where they added pkg_check_modules. Consequently I need to support both in my scripts
+# to avoid those deprecated warnings. Here's a helper that does just that.
+# Works identically to pkg_check_modules, except that no checks are needed prior to use.
+macro (libfind_pkg_check_modules PREFIX PKGNAME)
+ if (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
+ include(UsePkgConfig)
+ pkgconfig(${PKGNAME} ${PREFIX}_INCLUDE_DIRS ${PREFIX}_LIBRARY_DIRS ${PREFIX}_LDFLAGS ${PREFIX}_CFLAGS)
+ else (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
+ find_package(PkgConfig)
+ if (PKG_CONFIG_FOUND)
+ pkg_check_modules(${PREFIX} ${PKGNAME})
+ endif (PKG_CONFIG_FOUND)
+ endif (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
+endmacro (libfind_pkg_check_modules)
+
+# Do the final processing once the paths have been detected.
+# If include dirs are needed, ${PREFIX}_PROCESS_INCLUDES should be set to contain
+# all the variables, each of which contain one include directory.
+# Ditto for ${PREFIX}_PROCESS_LIBS and library files.
+# Will set ${PREFIX}_FOUND, ${PREFIX}_INCLUDE_DIRS and ${PREFIX}_LIBRARIES.
+# Also handles errors in case library detection was required, etc.
+macro (libfind_process PREFIX)
+ # Skip processing if already processed during this run
+ if (NOT ${PREFIX}_FOUND)
+ # Start with the assumption that the library was found
+ set (${PREFIX}_FOUND TRUE)
+
+ # Process all includes and set _FOUND to false if any are missing
+ foreach (i ${${PREFIX}_PROCESS_INCLUDES})
+ if (${i})
+ set (${PREFIX}_INCLUDE_DIRS ${${PREFIX}_INCLUDE_DIRS} ${${i}})
+ mark_as_advanced(${i})
+ else (${i})
+ set (${PREFIX}_FOUND FALSE)
+ endif (${i})
+ endforeach (i)
+
+ # Process all libraries and set _FOUND to false if any are missing
+ foreach (i ${${PREFIX}_PROCESS_LIBS})
+ if (${i})
+ set (${PREFIX}_LIBRARIES ${${PREFIX}_LIBRARIES} ${${i}})
+ mark_as_advanced(${i})
+ else (${i})
+ set (${PREFIX}_FOUND FALSE)
+ endif (${i})
+ endforeach (i)
+
+ # Print message and/or exit on fatal error
+ if (${PREFIX}_FOUND)
+ if (NOT ${PREFIX}_FIND_QUIETLY)
+ message (STATUS "Found ${PREFIX} ${${PREFIX}_VERSION}")
+ endif (NOT ${PREFIX}_FIND_QUIETLY)
+ else (${PREFIX}_FOUND)
+ if (${PREFIX}_FIND_REQUIRED)
+ foreach (i ${${PREFIX}_PROCESS_INCLUDES} ${${PREFIX}_PROCESS_LIBS})
+ message("${i}=${${i}}")
+ endforeach (i)
+ message (FATAL_ERROR "Required library ${PREFIX} NOT FOUND.\nInstall the library (dev version) and try again. If the library is already installed, use ccmake to set the missing variables manually.")
+ endif (${PREFIX}_FIND_REQUIRED)
+ endif (${PREFIX}_FOUND)
+ endif (NOT ${PREFIX}_FOUND)
+endmacro (libfind_process)
+
+macro(libfind_library PREFIX basename)
+ set(TMP "")
+ if(MSVC80)
+ set(TMP -vc80)
+ endif(MSVC80)
+ if(MSVC90)
+ set(TMP -vc90)
+ endif(MSVC90)
+ set(${PREFIX}_LIBNAMES ${basename}${TMP})
+ if(${ARGC} GREATER 2)
+ set(${PREFIX}_LIBNAMES ${basename}${TMP}-${ARGV2})
+ string(REGEX REPLACE "\\." "_" TMP ${${PREFIX}_LIBNAMES})
+ set(${PREFIX}_LIBNAMES ${${PREFIX}_LIBNAMES} ${TMP})
+ endif(${ARGC} GREATER 2)
+ find_library(${PREFIX}_LIBRARY
+ NAMES ${${PREFIX}_LIBNAMES}
+ PATHS ${${PREFIX}_PKGCONF_LIBRARY_DIRS}
+ )
+endmacro(libfind_library)
+
diff --git a/cmake/Packaging/Fedora-15.cmake b/cmake/Packaging/Fedora-15.cmake
new file mode 100644
index 000000000..2e9e78ee1
--- /dev/null
+++ b/cmake/Packaging/Fedora-15.cmake
@@ -0,0 +1,12 @@
+SET(PACKAGE_DEPENDS_GRUEL_RUNTIME "boost-python" "glibc")
+SET(PACKAGE_DEPENDS_GRUEL_PYTHON "python")
+SET(PACKAGE_DEPENDS_CORE_RUNTIME "fftw-libs")
+SET(PACKAGE_DEPENDS_QTGUI_RUNTIME "qt" "qwt")
+SET(PACKAGE_DEPENDS_QTGUI_PYTHON "PyQt4" "PyQwt")
+SET(PACKAGE_DEPENDS_GRC "python" "numpy" "gtk2" "python-lxml" "python-cheetah")
+SET(PACKAGE_DEPENDS_WXGUI "wxGTK" "python" "numpy")
+SET(PACKAGE_DEPENDS_VIDEO_SDL_RUNTIME "SDL")
+SET(PACKAGE_DEPENDS_UHD_RUNTIME "uhd")
+SET(PACKAGE_DEPENDS_AUDIO_RUNTIME "pulseaudio" "alsa-lib" "jack-audio-connection-kit")
+SET(PACKAGE_DEPENDS_WAVELET_RUNTIME "gsl")
+SET(PACKAGE_DEPENDS_WAVELET_PYTHON "python" "numpy")
diff --git a/cmake/Packaging/Fedora-16.cmake b/cmake/Packaging/Fedora-16.cmake
new file mode 100644
index 000000000..2e9e78ee1
--- /dev/null
+++ b/cmake/Packaging/Fedora-16.cmake
@@ -0,0 +1,12 @@
+SET(PACKAGE_DEPENDS_GRUEL_RUNTIME "boost-python" "glibc")
+SET(PACKAGE_DEPENDS_GRUEL_PYTHON "python")
+SET(PACKAGE_DEPENDS_CORE_RUNTIME "fftw-libs")
+SET(PACKAGE_DEPENDS_QTGUI_RUNTIME "qt" "qwt")
+SET(PACKAGE_DEPENDS_QTGUI_PYTHON "PyQt4" "PyQwt")
+SET(PACKAGE_DEPENDS_GRC "python" "numpy" "gtk2" "python-lxml" "python-cheetah")
+SET(PACKAGE_DEPENDS_WXGUI "wxGTK" "python" "numpy")
+SET(PACKAGE_DEPENDS_VIDEO_SDL_RUNTIME "SDL")
+SET(PACKAGE_DEPENDS_UHD_RUNTIME "uhd")
+SET(PACKAGE_DEPENDS_AUDIO_RUNTIME "pulseaudio" "alsa-lib" "jack-audio-connection-kit")
+SET(PACKAGE_DEPENDS_WAVELET_RUNTIME "gsl")
+SET(PACKAGE_DEPENDS_WAVELET_PYTHON "python" "numpy")
diff --git a/cmake/Packaging/Fedora-17.cmake b/cmake/Packaging/Fedora-17.cmake
new file mode 100644
index 000000000..13573ebac
--- /dev/null
+++ b/cmake/Packaging/Fedora-17.cmake
@@ -0,0 +1,12 @@
+SET(PACKAGE_DEPENDS_GRUEL_RUNTIME "boost-python" "glibc")
+SET(PACKAGE_DEPENDS_GRUEL_PYTHON "python")
+SET(PACKAGE_DEPENDS_CORE_RUNTIME "fftw-libs")
+SET(PACKAGE_DEPENDS_QTGUI_RUNTIME "qt" "qwt")
+SET(PACKAGE_DEPENDS_QTGUI_PYTHON "PyQt4" "PyQwt")
+SET(PACKAGE_DEPENDS_GRC "python" "numpy" "gtk2" "python-lxml" "python-cheetah")
+SET(PACKAGE_DEPENDS_WXGUI "wxGTK" "python" "numpy" "PyOpenGL")
+SET(PACKAGE_DEPENDS_VIDEO_SDL_RUNTIME "SDL")
+SET(PACKAGE_DEPENDS_UHD_RUNTIME "uhd")
+SET(PACKAGE_DEPENDS_AUDIO_RUNTIME "pulseaudio" "alsa-lib" "jack-audio-connection-kit")
+SET(PACKAGE_DEPENDS_WAVELET_RUNTIME "gsl")
+SET(PACKAGE_DEPENDS_WAVELET_PYTHON "python" "numpy")
diff --git a/cmake/Packaging/Fedora-18.cmake b/cmake/Packaging/Fedora-18.cmake
new file mode 100644
index 000000000..13573ebac
--- /dev/null
+++ b/cmake/Packaging/Fedora-18.cmake
@@ -0,0 +1,12 @@
+SET(PACKAGE_DEPENDS_GRUEL_RUNTIME "boost-python" "glibc")
+SET(PACKAGE_DEPENDS_GRUEL_PYTHON "python")
+SET(PACKAGE_DEPENDS_CORE_RUNTIME "fftw-libs")
+SET(PACKAGE_DEPENDS_QTGUI_RUNTIME "qt" "qwt")
+SET(PACKAGE_DEPENDS_QTGUI_PYTHON "PyQt4" "PyQwt")
+SET(PACKAGE_DEPENDS_GRC "python" "numpy" "gtk2" "python-lxml" "python-cheetah")
+SET(PACKAGE_DEPENDS_WXGUI "wxGTK" "python" "numpy" "PyOpenGL")
+SET(PACKAGE_DEPENDS_VIDEO_SDL_RUNTIME "SDL")
+SET(PACKAGE_DEPENDS_UHD_RUNTIME "uhd")
+SET(PACKAGE_DEPENDS_AUDIO_RUNTIME "pulseaudio" "alsa-lib" "jack-audio-connection-kit")
+SET(PACKAGE_DEPENDS_WAVELET_RUNTIME "gsl")
+SET(PACKAGE_DEPENDS_WAVELET_PYTHON "python" "numpy")
diff --git a/cmake/Packaging/Ubuntu-10.04.cmake b/cmake/Packaging/Ubuntu-10.04.cmake
new file mode 100644
index 000000000..3320073c6
--- /dev/null
+++ b/cmake/Packaging/Ubuntu-10.04.cmake
@@ -0,0 +1,12 @@
+SET(PACKAGE_DEPENDS_GRUEL_RUNTIME "libboost-all-dev" "libc6")
+SET(PACKAGE_DEPENDS_GRUEL_PYTHON "python")
+SET(PACKAGE_DEPENDS_CORE_RUNTIME "libfftw3-3")
+SET(PACKAGE_DEPENDS_QTGUI_RUNTIME "libqtcore4" "libqwt5-qt4")
+SET(PACKAGE_DEPENDS_QTGUI_PYTHON "python-qt4" "python-qwt5-qt4")
+SET(PACKAGE_DEPENDS_GRC "python" "python-numpy" "python-gtk2" "python-lxml" "python-cheetah")
+SET(PACKAGE_DEPENDS_WXGUI "python-wxgtk2.8" "python" "python-numpy")
+SET(PACKAGE_DEPENDS_VIDEO_SDL_RUNTIME "libsdl1.2debian")
+SET(PACKAGE_DEPENDS_UHD_RUNTIME "uhd")
+SET(PACKAGE_DEPENDS_AUDIO_RUNTIME "libpulse0" "alsa-base" "libjack0")
+SET(PACKAGE_DEPENDS_WAVELET_RUNTIME "libgsl0ldbl")
+SET(PACKAGE_DEPENDS_WAVELET_PYTHON "python" "python-numpy")
diff --git a/cmake/Packaging/Ubuntu-10.10.cmake b/cmake/Packaging/Ubuntu-10.10.cmake
new file mode 100644
index 000000000..3320073c6
--- /dev/null
+++ b/cmake/Packaging/Ubuntu-10.10.cmake
@@ -0,0 +1,12 @@
+SET(PACKAGE_DEPENDS_GRUEL_RUNTIME "libboost-all-dev" "libc6")
+SET(PACKAGE_DEPENDS_GRUEL_PYTHON "python")
+SET(PACKAGE_DEPENDS_CORE_RUNTIME "libfftw3-3")
+SET(PACKAGE_DEPENDS_QTGUI_RUNTIME "libqtcore4" "libqwt5-qt4")
+SET(PACKAGE_DEPENDS_QTGUI_PYTHON "python-qt4" "python-qwt5-qt4")
+SET(PACKAGE_DEPENDS_GRC "python" "python-numpy" "python-gtk2" "python-lxml" "python-cheetah")
+SET(PACKAGE_DEPENDS_WXGUI "python-wxgtk2.8" "python" "python-numpy")
+SET(PACKAGE_DEPENDS_VIDEO_SDL_RUNTIME "libsdl1.2debian")
+SET(PACKAGE_DEPENDS_UHD_RUNTIME "uhd")
+SET(PACKAGE_DEPENDS_AUDIO_RUNTIME "libpulse0" "alsa-base" "libjack0")
+SET(PACKAGE_DEPENDS_WAVELET_RUNTIME "libgsl0ldbl")
+SET(PACKAGE_DEPENDS_WAVELET_PYTHON "python" "python-numpy")
diff --git a/cmake/Packaging/Ubuntu-11.04.cmake b/cmake/Packaging/Ubuntu-11.04.cmake
new file mode 100644
index 000000000..c166bcf42
--- /dev/null
+++ b/cmake/Packaging/Ubuntu-11.04.cmake
@@ -0,0 +1,13 @@
+#set the debian package dependencies (parsed by our deb component maker)
+SET(PACKAGE_DEPENDS_GRUEL_RUNTIME "libboost-all-dev" "libc6")
+SET(PACKAGE_DEPENDS_GRUEL_PYTHON "python")
+SET(PACKAGE_DEPENDS_CORE_RUNTIME "libfftw3-3")
+SET(PACKAGE_DEPENDS_QTGUI_RUNTIME "libqtcore4" "libqwt5-qt4")
+SET(PACKAGE_DEPENDS_QTGUI_PYTHON "python-qt4" "python-qwt5-qt4")
+SET(PACKAGE_DEPENDS_GRC "python" "python-numpy" "python-gtk2" "python-lxml" "python-cheetah")
+SET(PACKAGE_DEPENDS_WXGUI "python-wxgtk2.8")
+SET(PACKAGE_DEPENDS_VIDEO_SDL_RUNTIME "libsdl1.2debian")
+SET(PACKAGE_DEPENDS_UHD_RUNTIME "uhd")
+SET(PACKAGE_DEPENDS_AUDIO_RUNTIME "libpulse0" "alsa-base" "libjack0")
+SET(PACKAGE_DEPENDS_WAVELET_RUNTIME "libgsl0ldbl")
+SET(PACKAGE_DEPENDS_WAVELET_PYTHON "python" "python-numpy")
diff --git a/cmake/Packaging/Ubuntu-11.10.cmake b/cmake/Packaging/Ubuntu-11.10.cmake
new file mode 100644
index 000000000..702ce574f
--- /dev/null
+++ b/cmake/Packaging/Ubuntu-11.10.cmake
@@ -0,0 +1,12 @@
+SET(PACKAGE_DEPENDS_GRUEL_RUNTIME "libboost-all-dev" "libc6")
+SET(PACKAGE_DEPENDS_GRUEL_PYTHON "python" "python-numpy")
+SET(PACKAGE_DEPENDS_CORE_RUNTIME "libfftw3-3")
+SET(PACKAGE_DEPENDS_QTGUI_RUNTIME "libqtcore4" "libqwt6")
+SET(PACKAGE_DEPENDS_QTGUI_PYTHON "python-qt4" "python-qwt5-qt4")
+SET(PACKAGE_DEPENDS_GRC "python" "python-numpy" "python-gtk2" "python-lxml" "python-cheetah")
+SET(PACKAGE_DEPENDS_WXGUI "python-wxgtk2.8")
+SET(PACKAGE_DEPENDS_VIDEO_SDL_RUNTIME "libsdl1.2debian")
+SET(PACKAGE_DEPENDS_UHD_RUNTIME "uhd")
+SET(PACKAGE_DEPENDS_AUDIO_RUNTIME "libpulse0" "alsa-base" "libjack0")
+SET(PACKAGE_DEPENDS_WAVELET_RUNTIME "libgsl0ldbl")
+SET(PACKAGE_DEPENDS_WAVELET_PYTHON "python" "python-numpy")
diff --git a/cmake/Packaging/Ubuntu-12.04.cmake b/cmake/Packaging/Ubuntu-12.04.cmake
new file mode 100644
index 000000000..40f748fdf
--- /dev/null
+++ b/cmake/Packaging/Ubuntu-12.04.cmake
@@ -0,0 +1,12 @@
+SET(PACKAGE_DEPENDS_GRUEL_RUNTIME "libboost-all-dev" "libc6")
+SET(PACKAGE_DEPENDS_GRUEL_PYTHON "python" "python-numpy")
+SET(PACKAGE_DEPENDS_CORE_RUNTIME "libfftw3-3")
+SET(PACKAGE_DEPENDS_QTGUI_RUNTIME "libqtcore4" "libqwt6")
+SET(PACKAGE_DEPENDS_QTGUI_PYTHON "python-qt4" "python-qwt5-qt4")
+SET(PACKAGE_DEPENDS_GRC "python" "python-numpy" "python-gtk2" "python-lxml" "python-cheetah")
+SET(PACKAGE_DEPENDS_WXGUI "python-wxgtk2.8" "python-opengl")
+SET(PACKAGE_DEPENDS_VIDEO_SDL_RUNTIME "libsdl1.2debian")
+SET(PACKAGE_DEPENDS_UHD_RUNTIME "uhd")
+SET(PACKAGE_DEPENDS_AUDIO_RUNTIME "libpulse0" "alsa-base" "libjack0")
+SET(PACKAGE_DEPENDS_WAVELET_RUNTIME "libgsl0ldbl")
+SET(PACKAGE_DEPENDS_WAVELET_PYTHON "python" "python-numpy")
diff --git a/cmake/Packaging/Ubuntu-12.10.cmake b/cmake/Packaging/Ubuntu-12.10.cmake
new file mode 100644
index 000000000..40f748fdf
--- /dev/null
+++ b/cmake/Packaging/Ubuntu-12.10.cmake
@@ -0,0 +1,12 @@
+SET(PACKAGE_DEPENDS_GRUEL_RUNTIME "libboost-all-dev" "libc6")
+SET(PACKAGE_DEPENDS_GRUEL_PYTHON "python" "python-numpy")
+SET(PACKAGE_DEPENDS_CORE_RUNTIME "libfftw3-3")
+SET(PACKAGE_DEPENDS_QTGUI_RUNTIME "libqtcore4" "libqwt6")
+SET(PACKAGE_DEPENDS_QTGUI_PYTHON "python-qt4" "python-qwt5-qt4")
+SET(PACKAGE_DEPENDS_GRC "python" "python-numpy" "python-gtk2" "python-lxml" "python-cheetah")
+SET(PACKAGE_DEPENDS_WXGUI "python-wxgtk2.8" "python-opengl")
+SET(PACKAGE_DEPENDS_VIDEO_SDL_RUNTIME "libsdl1.2debian")
+SET(PACKAGE_DEPENDS_UHD_RUNTIME "uhd")
+SET(PACKAGE_DEPENDS_AUDIO_RUNTIME "libpulse0" "alsa-base" "libjack0")
+SET(PACKAGE_DEPENDS_WAVELET_RUNTIME "libgsl0ldbl")
+SET(PACKAGE_DEPENDS_WAVELET_PYTHON "python" "python-numpy")
diff --git a/cmake/Packaging/Ubuntu-13.04.cmake b/cmake/Packaging/Ubuntu-13.04.cmake
new file mode 100644
index 000000000..40f748fdf
--- /dev/null
+++ b/cmake/Packaging/Ubuntu-13.04.cmake
@@ -0,0 +1,12 @@
+SET(PACKAGE_DEPENDS_GRUEL_RUNTIME "libboost-all-dev" "libc6")
+SET(PACKAGE_DEPENDS_GRUEL_PYTHON "python" "python-numpy")
+SET(PACKAGE_DEPENDS_CORE_RUNTIME "libfftw3-3")
+SET(PACKAGE_DEPENDS_QTGUI_RUNTIME "libqtcore4" "libqwt6")
+SET(PACKAGE_DEPENDS_QTGUI_PYTHON "python-qt4" "python-qwt5-qt4")
+SET(PACKAGE_DEPENDS_GRC "python" "python-numpy" "python-gtk2" "python-lxml" "python-cheetah")
+SET(PACKAGE_DEPENDS_WXGUI "python-wxgtk2.8" "python-opengl")
+SET(PACKAGE_DEPENDS_VIDEO_SDL_RUNTIME "libsdl1.2debian")
+SET(PACKAGE_DEPENDS_UHD_RUNTIME "uhd")
+SET(PACKAGE_DEPENDS_AUDIO_RUNTIME "libpulse0" "alsa-base" "libjack0")
+SET(PACKAGE_DEPENDS_WAVELET_RUNTIME "libgsl0ldbl")
+SET(PACKAGE_DEPENDS_WAVELET_PYTHON "python" "python-numpy")
diff --git a/cmake/Packaging/post_install.in b/cmake/Packaging/post_install.in
new file mode 100755
index 000000000..e7245f032
--- /dev/null
+++ b/cmake/Packaging/post_install.in
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+@CMAKE_INSTALL_PREFIX@/libexec/gnuradio/grc_setup_freedesktop install
+ldconfig
diff --git a/cmake/Packaging/post_uninstall.in b/cmake/Packaging/post_uninstall.in
new file mode 100755
index 000000000..2d1871b1d
--- /dev/null
+++ b/cmake/Packaging/post_uninstall.in
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+ldconfig
diff --git a/cmake/Packaging/postinst.in b/cmake/Packaging/postinst.in
new file mode 100755
index 000000000..7fef2accf
--- /dev/null
+++ b/cmake/Packaging/postinst.in
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+if [ "$1" = "configure" ]; then
+ @CMAKE_INSTALL_PREFIX@/libexec/gnuradio/grc_setup_freedesktop install
+ ldconfig
+fi
diff --git a/cmake/Packaging/postrm.in b/cmake/Packaging/postrm.in
new file mode 100755
index 000000000..b780602a7
--- /dev/null
+++ b/cmake/Packaging/postrm.in
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+if [ "$1" = "remove" ]; then
+ ldconfig
+fi
diff --git a/cmake/Packaging/pre_install.in b/cmake/Packaging/pre_install.in
new file mode 100755
index 000000000..1a2485251
--- /dev/null
+++ b/cmake/Packaging/pre_install.in
@@ -0,0 +1 @@
+#!/bin/sh
diff --git a/cmake/Packaging/pre_uninstall.in b/cmake/Packaging/pre_uninstall.in
new file mode 100755
index 000000000..c5e085e89
--- /dev/null
+++ b/cmake/Packaging/pre_uninstall.in
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+@CMAKE_INSTALL_PREFIX@/libexec/gnuradio/grc_setup_freedesktop uninstall
diff --git a/cmake/Packaging/preinst.in b/cmake/Packaging/preinst.in
new file mode 100755
index 000000000..cb7ee1bc4
--- /dev/null
+++ b/cmake/Packaging/preinst.in
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+if [ "$1" = "install" ]; then
+ echo
+fi
diff --git a/cmake/Packaging/prerm.in b/cmake/Packaging/prerm.in
new file mode 100755
index 000000000..d09887850
--- /dev/null
+++ b/cmake/Packaging/prerm.in
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+if [ "$1" = "remove" ]; then
+ @CMAKE_INSTALL_PREFIX@/libexec/gnuradio/grc_setup_freedesktop uninstall
+fi
diff --git a/cmake/Toolchains/arm_cortex_a8_native.cmake b/cmake/Toolchains/arm_cortex_a8_native.cmake
new file mode 100644
index 000000000..8e60eaab1
--- /dev/null
+++ b/cmake/Toolchains/arm_cortex_a8_native.cmake
@@ -0,0 +1,8 @@
+########################################################################
+# Toolchain file for building native on a ARM Cortex A8 w/ NEON
+# Usage: cmake -DCMAKE_TOOLCHAIN_FILE=<this file> <source directory>
+########################################################################
+set(CMAKE_CXX_COMPILER g++)
+set(CMAKE_C_COMPILER gcc)
+set(CMAKE_CXX_FLAGS "-march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp" CACHE STRING "" FORCE)
+set(CMAKE_C_FLAGS ${CMAKE_CXX_FLAGS} CACHE STRING "" FORCE) #same flags for C sources
diff --git a/cmake/cmake_uninstall.cmake.in b/cmake/cmake_uninstall.cmake.in
new file mode 100644
index 000000000..9ae1ae4bd
--- /dev/null
+++ b/cmake/cmake_uninstall.cmake.in
@@ -0,0 +1,32 @@
+# http://www.vtk.org/Wiki/CMake_FAQ#Can_I_do_.22make_uninstall.22_with_CMake.3F
+
+IF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
+ MESSAGE(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"")
+ENDIF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
+
+FILE(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
+STRING(REGEX REPLACE "\n" ";" files "${files}")
+FOREACH(file ${files})
+ MESSAGE(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"")
+ IF(EXISTS "$ENV{DESTDIR}${file}")
+ EXEC_PROGRAM(
+ "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
+ OUTPUT_VARIABLE rm_out
+ RETURN_VALUE rm_retval
+ )
+ IF(NOT "${rm_retval}" STREQUAL 0)
+ MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"")
+ ENDIF(NOT "${rm_retval}" STREQUAL 0)
+ ELSEIF(IS_SYMLINK "$ENV{DESTDIR}${file}")
+ EXEC_PROGRAM(
+ "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
+ OUTPUT_VARIABLE rm_out
+ RETURN_VALUE rm_retval
+ )
+ IF(NOT "${rm_retval}" STREQUAL 0)
+ MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"")
+ ENDIF(NOT "${rm_retval}" STREQUAL 0)
+ ELSE(EXISTS "$ENV{DESTDIR}${file}")
+ MESSAGE(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.")
+ ENDIF(EXISTS "$ENV{DESTDIR}${file}")
+ENDFOREACH(file)
diff --git a/cmake/msvc/config.h b/cmake/msvc/config.h
new file mode 100644
index 000000000..43792c783
--- /dev/null
+++ b/cmake/msvc/config.h
@@ -0,0 +1,58 @@
+#ifndef _MSC_VER // [
+#error "Use this header only with Microsoft Visual C++ compilers!"
+#endif // _MSC_VER ]
+
+#ifndef _MSC_CONFIG_H_ // [
+#define _MSC_CONFIG_H_
+
+////////////////////////////////////////////////////////////////////////
+// enable inline functions for C code
+////////////////////////////////////////////////////////////////////////
+#ifndef __cplusplus
+# define inline __inline
+#endif
+
+////////////////////////////////////////////////////////////////////////
+// signed size_t
+////////////////////////////////////////////////////////////////////////
+#include <stddef.h>
+typedef ptrdiff_t ssize_t;
+
+////////////////////////////////////////////////////////////////////////
+// rint functions
+////////////////////////////////////////////////////////////////////////
+#include <math.h>
+static inline long lrint(double x){return (long)(x > 0.0 ? x + 0.5 : x - 0.5);}
+static inline long lrintf(float x){return (long)(x > 0.0f ? x + 0.5f : x - 0.5f);}
+static inline long long llrint(double x){return (long long)(x > 0.0 ? x + 0.5 : x - 0.5);}
+static inline long long llrintf(float x){return (long long)(x > 0.0f ? x + 0.5f : x - 0.5f);}
+static inline double rint(double x){return (x > 0.0)? floor(x + 0.5) : ceil(x - 0.5);}
+static inline float rintf(float x){return (x > 0.0f)? floorf(x + 0.5f) : ceilf(x - 0.5f);}
+
+////////////////////////////////////////////////////////////////////////
+// math constants
+////////////////////////////////////////////////////////////////////////
+#define INFINITY HUGE_VAL
+
+# define M_E 2.7182818284590452354 /* e */
+# define M_LOG2E 1.4426950408889634074 /* log_2 e */
+# define M_LOG10E 0.43429448190325182765 /* log_10 e */
+# define M_LN2 0.69314718055994530942 /* log_e 2 */
+# define M_LN10 2.30258509299404568402 /* log_e 10 */
+# define M_PI 3.14159265358979323846 /* pi */
+# define M_PI_2 1.57079632679489661923 /* pi/2 */
+# define M_PI_4 0.78539816339744830962 /* pi/4 */
+# define M_1_PI 0.31830988618379067154 /* 1/pi */
+# define M_2_PI 0.63661977236758134308 /* 2/pi */
+# define M_2_SQRTPI 1.12837916709551257390 /* 2/sqrt(pi) */
+# define M_SQRT2 1.41421356237309504880 /* sqrt(2) */
+# define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */
+
+////////////////////////////////////////////////////////////////////////
+// random and srandom
+////////////////////////////////////////////////////////////////////////
+#include <stdlib.h>
+static inline long int random (void) { return rand(); }
+static inline void srandom (unsigned int seed) { srand(seed); }
+
+#endif // _MSC_CONFIG_H_ ]
diff --git a/cmake/msvc/inttypes.h b/cmake/msvc/inttypes.h
new file mode 100644
index 000000000..0a1b60fc1
--- /dev/null
+++ b/cmake/msvc/inttypes.h
@@ -0,0 +1,301 @@
+// ISO C9x compliant inttypes.h for Microsoft Visual Studio
+// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124
+//
+// Copyright (c) 2006 Alexander Chemeris
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+//
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+//
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// 3. The name of the author may be used to endorse or promote products
+// derived from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _MSC_VER // [
+#error "Use this header only with Microsoft Visual C++ compilers!"
+#endif // _MSC_VER ]
+
+#ifndef _MSC_INTTYPES_H_ // [
+#define _MSC_INTTYPES_H_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif
+
+#include <stdint.h>
+
+// 7.8 Format conversion of integer types
+
+typedef struct {
+ intmax_t quot;
+ intmax_t rem;
+} imaxdiv_t;
+
+// 7.8.1 Macros for format specifiers
+
+// The fprintf macros for signed integers are:
+#define PRId8 "d"
+#define PRIi8 "i"
+#define PRIdLEAST8 "d"
+#define PRIiLEAST8 "i"
+#define PRIdFAST8 "d"
+#define PRIiFAST8 "i"
+
+#define PRId16 "hd"
+#define PRIi16 "hi"
+#define PRIdLEAST16 "hd"
+#define PRIiLEAST16 "hi"
+#define PRIdFAST16 "hd"
+#define PRIiFAST16 "hi"
+
+#define PRId32 "I32d"
+#define PRIi32 "I32i"
+#define PRIdLEAST32 "I32d"
+#define PRIiLEAST32 "I32i"
+#define PRIdFAST32 "I32d"
+#define PRIiFAST32 "I32i"
+
+#define PRId64 "I64d"
+#define PRIi64 "I64i"
+#define PRIdLEAST64 "I64d"
+#define PRIiLEAST64 "I64i"
+#define PRIdFAST64 "I64d"
+#define PRIiFAST64 "I64i"
+
+#define PRIdMAX "I64d"
+#define PRIiMAX "I64i"
+
+#define PRIdPTR "Id"
+#define PRIiPTR "Ii"
+
+// The fprintf macros for unsigned integers are:
+#define PRIo8 "o"
+#define PRIu8 "u"
+#define PRIx8 "x"
+#define PRIX8 "X"
+#define PRIoLEAST8 "o"
+#define PRIuLEAST8 "u"
+#define PRIxLEAST8 "x"
+#define PRIXLEAST8 "X"
+#define PRIoFAST8 "o"
+#define PRIuFAST8 "u"
+#define PRIxFAST8 "x"
+#define PRIXFAST8 "X"
+
+#define PRIo16 "ho"
+#define PRIu16 "hu"
+#define PRIx16 "hx"
+#define PRIX16 "hX"
+#define PRIoLEAST16 "ho"
+#define PRIuLEAST16 "hu"
+#define PRIxLEAST16 "hx"
+#define PRIXLEAST16 "hX"
+#define PRIoFAST16 "ho"
+#define PRIuFAST16 "hu"
+#define PRIxFAST16 "hx"
+#define PRIXFAST16 "hX"
+
+#define PRIo32 "I32o"
+#define PRIu32 "I32u"
+#define PRIx32 "I32x"
+#define PRIX32 "I32X"
+#define PRIoLEAST32 "I32o"
+#define PRIuLEAST32 "I32u"
+#define PRIxLEAST32 "I32x"
+#define PRIXLEAST32 "I32X"
+#define PRIoFAST32 "I32o"
+#define PRIuFAST32 "I32u"
+#define PRIxFAST32 "I32x"
+#define PRIXFAST32 "I32X"
+
+#define PRIo64 "I64o"
+#define PRIu64 "I64u"
+#define PRIx64 "I64x"
+#define PRIX64 "I64X"
+#define PRIoLEAST64 "I64o"
+#define PRIuLEAST64 "I64u"
+#define PRIxLEAST64 "I64x"
+#define PRIXLEAST64 "I64X"
+#define PRIoFAST64 "I64o"
+#define PRIuFAST64 "I64u"
+#define PRIxFAST64 "I64x"
+#define PRIXFAST64 "I64X"
+
+#define PRIoMAX "I64o"
+#define PRIuMAX "I64u"
+#define PRIxMAX "I64x"
+#define PRIXMAX "I64X"
+
+#define PRIoPTR "Io"
+#define PRIuPTR "Iu"
+#define PRIxPTR "Ix"
+#define PRIXPTR "IX"
+
+// The fscanf macros for signed integers are:
+#define SCNd8 "d"
+#define SCNi8 "i"
+#define SCNdLEAST8 "d"
+#define SCNiLEAST8 "i"
+#define SCNdFAST8 "d"
+#define SCNiFAST8 "i"
+
+#define SCNd16 "hd"
+#define SCNi16 "hi"
+#define SCNdLEAST16 "hd"
+#define SCNiLEAST16 "hi"
+#define SCNdFAST16 "hd"
+#define SCNiFAST16 "hi"
+
+#define SCNd32 "ld"
+#define SCNi32 "li"
+#define SCNdLEAST32 "ld"
+#define SCNiLEAST32 "li"
+#define SCNdFAST32 "ld"
+#define SCNiFAST32 "li"
+
+#define SCNd64 "I64d"
+#define SCNi64 "I64i"
+#define SCNdLEAST64 "I64d"
+#define SCNiLEAST64 "I64i"
+#define SCNdFAST64 "I64d"
+#define SCNiFAST64 "I64i"
+
+#define SCNdMAX "I64d"
+#define SCNiMAX "I64i"
+
+#ifdef _WIN64 // [
+# define SCNdPTR "I64d"
+# define SCNiPTR "I64i"
+#else // _WIN64 ][
+# define SCNdPTR "ld"
+# define SCNiPTR "li"
+#endif // _WIN64 ]
+
+// The fscanf macros for unsigned integers are:
+#define SCNo8 "o"
+#define SCNu8 "u"
+#define SCNx8 "x"
+#define SCNX8 "X"
+#define SCNoLEAST8 "o"
+#define SCNuLEAST8 "u"
+#define SCNxLEAST8 "x"
+#define SCNXLEAST8 "X"
+#define SCNoFAST8 "o"
+#define SCNuFAST8 "u"
+#define SCNxFAST8 "x"
+#define SCNXFAST8 "X"
+
+#define SCNo16 "ho"
+#define SCNu16 "hu"
+#define SCNx16 "hx"
+#define SCNX16 "hX"
+#define SCNoLEAST16 "ho"
+#define SCNuLEAST16 "hu"
+#define SCNxLEAST16 "hx"
+#define SCNXLEAST16 "hX"
+#define SCNoFAST16 "ho"
+#define SCNuFAST16 "hu"
+#define SCNxFAST16 "hx"
+#define SCNXFAST16 "hX"
+
+#define SCNo32 "lo"
+#define SCNu32 "lu"
+#define SCNx32 "lx"
+#define SCNX32 "lX"
+#define SCNoLEAST32 "lo"
+#define SCNuLEAST32 "lu"
+#define SCNxLEAST32 "lx"
+#define SCNXLEAST32 "lX"
+#define SCNoFAST32 "lo"
+#define SCNuFAST32 "lu"
+#define SCNxFAST32 "lx"
+#define SCNXFAST32 "lX"
+
+#define SCNo64 "I64o"
+#define SCNu64 "I64u"
+#define SCNx64 "I64x"
+#define SCNX64 "I64X"
+#define SCNoLEAST64 "I64o"
+#define SCNuLEAST64 "I64u"
+#define SCNxLEAST64 "I64x"
+#define SCNXLEAST64 "I64X"
+#define SCNoFAST64 "I64o"
+#define SCNuFAST64 "I64u"
+#define SCNxFAST64 "I64x"
+#define SCNXFAST64 "I64X"
+
+#define SCNoMAX "I64o"
+#define SCNuMAX "I64u"
+#define SCNxMAX "I64x"
+#define SCNXMAX "I64X"
+
+#ifdef _WIN64 // [
+# define SCNoPTR "I64o"
+# define SCNuPTR "I64u"
+# define SCNxPTR "I64x"
+# define SCNXPTR "I64X"
+#else // _WIN64 ][
+# define SCNoPTR "lo"
+# define SCNuPTR "lu"
+# define SCNxPTR "lx"
+# define SCNXPTR "lX"
+#endif // _WIN64 ]
+
+// 7.8.2 Functions for greatest-width integer types
+
+// 7.8.2.1 The imaxabs function
+#define imaxabs _abs64
+
+// 7.8.2.2 The imaxdiv function
+
+// This is modified version of div() function from Microsoft's div.c found
+// in %MSVC.NET%\crt\src\div.c
+#ifdef STATIC_IMAXDIV // [
+static
+#else // STATIC_IMAXDIV ][
+_inline
+#endif // STATIC_IMAXDIV ]
+imaxdiv_t __cdecl imaxdiv(intmax_t numer, intmax_t denom)
+{
+ imaxdiv_t result;
+
+ result.quot = numer / denom;
+ result.rem = numer % denom;
+
+ if (numer < 0 && result.rem > 0) {
+ // did division wrong; must fix up
+ ++result.quot;
+ result.rem -= denom;
+ }
+
+ return result;
+}
+
+// 7.8.2.3 The strtoimax and strtoumax functions
+#define strtoimax _strtoi64
+#define strtoumax _strtoui64
+
+// 7.8.2.4 The wcstoimax and wcstoumax functions
+#define wcstoimax _wcstoi64
+#define wcstoumax _wcstoui64
+
+
+#endif // _MSC_INTTYPES_H_ ]
diff --git a/cmake/msvc/stdint.h b/cmake/msvc/stdint.h
new file mode 100644
index 000000000..108bc8982
--- /dev/null
+++ b/cmake/msvc/stdint.h
@@ -0,0 +1,251 @@
+// ISO C9x compliant stdint.h for Microsoft Visual Studio
+// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124
+//
+// Copyright (c) 2006-2008 Alexander Chemeris
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+//
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+//
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// 3. The name of the author may be used to endorse or promote products
+// derived from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _MSC_VER // [
+#error "Use this header only with Microsoft Visual C++ compilers!"
+#endif // _MSC_VER ]
+
+#ifndef _MSC_STDINT_H_ // [
+#define _MSC_STDINT_H_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif
+
+#include <limits.h>
+
+// For Visual Studio 6 in C++ mode and for many Visual Studio versions when
+// compiling for ARM we should wrap <wchar.h> include with 'extern "C++" {}'
+// or compiler give many errors like this:
+// error C2733: second C linkage of overloaded function 'wmemchr' not allowed
+#ifdef __cplusplus
+extern "C" {
+#endif
+# include <wchar.h>
+#ifdef __cplusplus
+}
+#endif
+
+// Define _W64 macros to mark types changing their size, like intptr_t.
+#ifndef _W64
+# if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300
+# define _W64 __w64
+# else
+# define _W64
+# endif
+#endif
+
+
+// 7.18.1 Integer types
+
+// 7.18.1.1 Exact-width integer types
+
+// Visual Studio 6 and Embedded Visual C++ 4 doesn't
+// realize that, e.g. char has the same size as __int8
+// so we give up on __intX for them.
+#if (_MSC_VER < 1300)
+ typedef signed char int8_t;
+ typedef signed short int16_t;
+ typedef signed int int32_t;
+ typedef unsigned char uint8_t;
+ typedef unsigned short uint16_t;
+ typedef unsigned int uint32_t;
+#else
+ typedef signed __int8 int8_t;
+ typedef signed __int16 int16_t;
+ typedef signed __int32 int32_t;
+ typedef unsigned __int8 uint8_t;
+ typedef unsigned __int16 uint16_t;
+ typedef unsigned __int32 uint32_t;
+#endif
+typedef signed __int64 int64_t;
+typedef unsigned __int64 uint64_t;
+
+
+// 7.18.1.2 Minimum-width integer types
+typedef int8_t int_least8_t;
+typedef int16_t int_least16_t;
+typedef int32_t int_least32_t;
+typedef int64_t int_least64_t;
+typedef uint8_t uint_least8_t;
+typedef uint16_t uint_least16_t;
+typedef uint32_t uint_least32_t;
+typedef uint64_t uint_least64_t;
+
+// 7.18.1.3 Fastest minimum-width integer types
+typedef int8_t int_fast8_t;
+typedef int16_t int_fast16_t;
+typedef int32_t int_fast32_t;
+typedef int64_t int_fast64_t;
+typedef uint8_t uint_fast8_t;
+typedef uint16_t uint_fast16_t;
+typedef uint32_t uint_fast32_t;
+typedef uint64_t uint_fast64_t;
+
+// 7.18.1.4 Integer types capable of holding object pointers
+#ifdef _WIN64 // [
+ typedef signed __int64 intptr_t;
+ typedef unsigned __int64 uintptr_t;
+#else // _WIN64 ][
+ typedef _W64 signed int intptr_t;
+ typedef _W64 unsigned int uintptr_t;
+#endif // _WIN64 ]
+
+// 7.18.1.5 Greatest-width integer types
+typedef int64_t intmax_t;
+typedef uint64_t uintmax_t;
+
+
+// 7.18.2 Limits of specified-width integer types
+
+#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) // [ See footnote 220 at page 257 and footnote 221 at page 259
+
+// 7.18.2.1 Limits of exact-width integer types
+#define INT8_MIN ((int8_t)_I8_MIN)
+#define INT8_MAX _I8_MAX
+#define INT16_MIN ((int16_t)_I16_MIN)
+#define INT16_MAX _I16_MAX
+#define INT32_MIN ((int32_t)_I32_MIN)
+#define INT32_MAX _I32_MAX
+#define INT64_MIN ((int64_t)_I64_MIN)
+#define INT64_MAX _I64_MAX
+#define UINT8_MAX _UI8_MAX
+#define UINT16_MAX _UI16_MAX
+#define UINT32_MAX _UI32_MAX
+#define UINT64_MAX _UI64_MAX
+
+// 7.18.2.2 Limits of minimum-width integer types
+#define INT_LEAST8_MIN INT8_MIN
+#define INT_LEAST8_MAX INT8_MAX
+#define INT_LEAST16_MIN INT16_MIN
+#define INT_LEAST16_MAX INT16_MAX
+#define INT_LEAST32_MIN INT32_MIN
+#define INT_LEAST32_MAX INT32_MAX
+#define INT_LEAST64_MIN INT64_MIN
+#define INT_LEAST64_MAX INT64_MAX
+#define UINT_LEAST8_MAX UINT8_MAX
+#define UINT_LEAST16_MAX UINT16_MAX
+#define UINT_LEAST32_MAX UINT32_MAX
+#define UINT_LEAST64_MAX UINT64_MAX
+
+// 7.18.2.3 Limits of fastest minimum-width integer types
+#define INT_FAST8_MIN INT8_MIN
+#define INT_FAST8_MAX INT8_MAX
+#define INT_FAST16_MIN INT16_MIN
+#define INT_FAST16_MAX INT16_MAX
+#define INT_FAST32_MIN INT32_MIN
+#define INT_FAST32_MAX INT32_MAX
+#define INT_FAST64_MIN INT64_MIN
+#define INT_FAST64_MAX INT64_MAX
+#define UINT_FAST8_MAX UINT8_MAX
+#define UINT_FAST16_MAX UINT16_MAX
+#define UINT_FAST32_MAX UINT32_MAX
+#define UINT_FAST64_MAX UINT64_MAX
+
+// 7.18.2.4 Limits of integer types capable of holding object pointers
+#ifdef _WIN64 // [
+# define INTPTR_MIN INT64_MIN
+# define INTPTR_MAX INT64_MAX
+# define UINTPTR_MAX UINT64_MAX
+#else // _WIN64 ][
+# define INTPTR_MIN INT32_MIN
+# define INTPTR_MAX INT32_MAX
+# define UINTPTR_MAX UINT32_MAX
+#endif // _WIN64 ]
+
+// 7.18.2.5 Limits of greatest-width integer types
+#define INTMAX_MIN INT64_MIN
+#define INTMAX_MAX INT64_MAX
+#define UINTMAX_MAX UINT64_MAX
+
+// 7.18.3 Limits of other integer types
+
+#ifdef _WIN64 // [
+# define PTRDIFF_MIN _I64_MIN
+# define PTRDIFF_MAX _I64_MAX
+#else // _WIN64 ][
+# define PTRDIFF_MIN _I32_MIN
+# define PTRDIFF_MAX _I32_MAX
+#endif // _WIN64 ]
+
+#define SIG_ATOMIC_MIN INT_MIN
+#define SIG_ATOMIC_MAX INT_MAX
+
+#ifndef SIZE_MAX // [
+# ifdef _WIN64 // [
+# define SIZE_MAX _UI64_MAX
+# else // _WIN64 ][
+# define SIZE_MAX _UI32_MAX
+# endif // _WIN64 ]
+#endif // SIZE_MAX ]
+
+// WCHAR_MIN and WCHAR_MAX are also defined in <wchar.h>
+#ifndef WCHAR_MIN // [
+# define WCHAR_MIN 0
+#endif // WCHAR_MIN ]
+#ifndef WCHAR_MAX // [
+# define WCHAR_MAX _UI16_MAX
+#endif // WCHAR_MAX ]
+
+#define WINT_MIN 0
+#define WINT_MAX _UI16_MAX
+
+#endif // __STDC_LIMIT_MACROS ]
+
+
+// 7.18.4 Limits of other integer types
+
+#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) // [ See footnote 224 at page 260
+
+// 7.18.4.1 Macros for minimum-width integer constants
+
+#define INT8_C(val) val##i8
+#define INT16_C(val) val##i16
+#define INT32_C(val) val##i32
+#define INT64_C(val) val##i64
+
+#define UINT8_C(val) val##ui8
+#define UINT16_C(val) val##ui16
+#define UINT32_C(val) val##ui32
+#define UINT64_C(val) val##ui64
+
+// 7.18.4.2 Macros for greatest-width integer constants
+#ifndef INTMAX_C
+#define INTMAX_C INT64_C
+#endif
+#ifndef UINTMAX_C
+#define UINTMAX_C UINT64_C
+#endif
+
+#endif // __STDC_CONSTANT_MACROS ]
+
+
+#endif // _MSC_STDINT_H_ ]
diff --git a/cmake/msvc/sys/time.h b/cmake/msvc/sys/time.h
new file mode 100644
index 000000000..8800ed5cb
--- /dev/null
+++ b/cmake/msvc/sys/time.h
@@ -0,0 +1,69 @@
+#ifndef _MSC_VER // [
+#error "Use this header only with Microsoft Visual C++ compilers!"
+#endif // _MSC_VER ]
+
+#ifndef _MSC_SYS_TIME_H_
+#define _MSC_SYS_TIME_H_
+
+//http://social.msdn.microsoft.com/Forums/en/vcgeneral/thread/430449b3-f6dd-4e18-84de-eebd26a8d668
+#include < time.h >
+#include <windows.h> //I've ommited this line.
+#if defined(_MSC_VER) || defined(_MSC_EXTENSIONS)
+ #define DELTA_EPOCH_IN_MICROSECS 11644473600000000Ui64
+#else
+ #define DELTA_EPOCH_IN_MICROSECS 11644473600000000ULL
+#endif
+
+struct timespec {
+
+time_t tv_sec; /* Seconds since 00:00:00 GMT, */
+
+/* 1 January 1970 */
+
+long tv_nsec; /* Additional nanoseconds since */
+
+/* tv_sec */
+
+};
+
+struct timezone
+{
+ int tz_minuteswest; /* minutes W of Greenwich */
+ int tz_dsttime; /* type of dst correction */
+};
+
+static inline int gettimeofday(struct timeval *tv, struct timezone *tz)
+{
+ FILETIME ft;
+ unsigned __int64 tmpres = 0;
+ static int tzflag;
+
+ if (NULL != tv)
+ {
+ GetSystemTimeAsFileTime(&ft);
+
+ tmpres |= ft.dwHighDateTime;
+ tmpres <<= 32;
+ tmpres |= ft.dwLowDateTime;
+
+ /*converting file time to unix epoch*/
+ tmpres -= DELTA_EPOCH_IN_MICROSECS;
+ tv->tv_sec = (long)(tmpres / 1000000UL);
+ tv->tv_usec = (long)(tmpres % 1000000UL);
+ }
+
+ if (NULL != tz)
+ {
+ if (!tzflag)
+ {
+ _tzset();
+ tzflag++;
+ }
+ tz->tz_minuteswest = _timezone / 60;
+ tz->tz_dsttime = _daylight;
+ }
+
+ return 0;
+}
+
+#endif //_MSC_SYS_TIME_H_
diff --git a/cmake/msvc/unistd.h b/cmake/msvc/unistd.h
new file mode 100644
index 000000000..de412e42a
--- /dev/null
+++ b/cmake/msvc/unistd.h
@@ -0,0 +1,10 @@
+#ifndef _MSC_VER // [
+#error "Use this header only with Microsoft Visual C++ compilers!"
+#endif // _MSC_VER ]
+
+#ifndef _MSC_UNISTD_H_ // [
+#define _MSC_UNISTD_H_
+
+#include <process.h>
+
+#endif // _MSC_UNISTD_H_ ]
diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt
new file mode 100644
index 000000000..24bf2405e
--- /dev/null
+++ b/docs/CMakeLists.txt
@@ -0,0 +1,74 @@
+# Copyright 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.
+
+########################################################################
+# Setup dependencies
+########################################################################
+find_package(Doxygen)
+find_package(Sphinx)
+
+########################################################################
+# Register component
+########################################################################
+include(GrComponent)
+GR_REGISTER_COMPONENT("doxygen" ENABLE_DOXYGEN DOXYGEN_FOUND)
+GR_REGISTER_COMPONENT("sphinx" ENABLE_SPHINX SPHINX_FOUND)
+
+########################################################################
+# Begin conditional configuration
+########################################################################
+if(ENABLE_DOXYGEN)
+
+########################################################################
+# Setup CPack components
+########################################################################
+include(GrPackage)
+CPACK_COMPONENT("docs"
+ DISPLAY_NAME "Documentation"
+ DESCRIPTION "Doxygen generated documentation"
+)
+
+########################################################################
+# Add subdirectories
+########################################################################
+add_subdirectory(doxygen)
+
+endif(ENABLE_DOXYGEN)
+
+
+########################################################################
+# Begin conditional configuration
+########################################################################
+if(ENABLE_SPHINX)
+
+########################################################################
+# Setup CPack components
+########################################################################
+include(GrPackage)
+CPACK_COMPONENT("docs"
+ DISPLAY_NAME "Documentation"
+ DESCRIPTION "Sphinx generated documentation"
+)
+
+########################################################################
+# Add subdirectories
+########################################################################
+add_subdirectory(sphinx)
+
+endif(ENABLE_SPHINX)
diff --git a/docs/ChangeLog b/docs/ChangeLog
new file mode 100644
index 000000000..9f0eb2118
--- /dev/null
+++ b/docs/ChangeLog
@@ -0,0 +1,24 @@
+2004-11-29 Eric Blossom <eb@comsec.com>
+
+ * exploring-gnuradio/exploring-gnuradio.xml: new. revision 1.1
+
+#
+# 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.
+#
diff --git a/docs/doxygen/CMakeLists.txt b/docs/doxygen/CMakeLists.txt
new file mode 100644
index 000000000..f328bd7a2
--- /dev/null
+++ b/docs/doxygen/CMakeLists.txt
@@ -0,0 +1,52 @@
+# Copyright 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.
+
+########################################################################
+# Create the doxygen configuration file
+########################################################################
+file(TO_NATIVE_PATH ${CMAKE_SOURCE_DIR} top_srcdir)
+file(TO_NATIVE_PATH ${CMAKE_BINARY_DIR} top_builddir)
+file(TO_NATIVE_PATH ${CMAKE_SOURCE_DIR} abs_top_srcdir)
+file(TO_NATIVE_PATH ${CMAKE_BINARY_DIR} abs_top_builddir)
+
+set(HAVE_DOT ${DOXYGEN_DOT_FOUND})
+set(enable_html_docs YES)
+set(enable_latex_docs NO)
+set(enable_xml_docs YES)
+
+configure_file(
+ ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in
+ ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
+@ONLY)
+
+set(BUILT_DIRS ${CMAKE_CURRENT_BINARY_DIR}/xml ${CMAKE_CURRENT_BINARY_DIR}/html)
+
+########################################################################
+# Make and install doxygen docs
+########################################################################
+add_custom_command(
+ OUTPUT ${BUILT_DIRS}
+ COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ COMMENT "Generating documentation with doxygen"
+)
+
+add_custom_target(doxygen_target ALL DEPENDS ${BUILT_DIRS})
+
+install(DIRECTORY ${BUILT_DIRS} DESTINATION ${GR_PKG_DOC_DIR} COMPONENT "docs")
diff --git a/docs/doxygen/Doxyfile.in b/docs/doxygen/Doxyfile.in
new file mode 100644
index 000000000..536661996
--- /dev/null
+++ b/docs/doxygen/Doxyfile.in
@@ -0,0 +1,1548 @@
+# Doxyfile 1.5.7.1
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project
+#
+# All text after a hash (#) is considered a comment and will be ignored
+# The format is:
+# TAG = value [value, ...]
+# For lists items can also be appended using:
+# TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (" ")
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+# This tag specifies the encoding used for all characters in the config file
+# that follow. The default is UTF-8 which is also the encoding used for all
+# text before the first occurrence of this tag. Doxygen uses libiconv (or the
+# iconv built into libc) for the transcoding. See
+# http://www.gnu.org/software/libiconv for the list of possible encodings.
+
+DOXYFILE_ENCODING = UTF-8
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
+# by quotes) that should identify the project.
+
+PROJECT_NAME = "GNU Radio @VERSION@ C++ API"
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number.
+# This could be handy for archiving the generated documentation or
+# if some version control system is used.
+
+PROJECT_NUMBER =
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
+# base path where the generated documentation will be put.
+# If a relative path is entered, it will be relative to the location
+# where doxygen was started. If left blank the current directory will be used.
+
+OUTPUT_DIRECTORY =
+
+# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
+# 4096 sub-directories (in 2 levels) under the output directory of each output
+# format and will distribute the generated files over these directories.
+# Enabling this option can be useful when feeding doxygen a huge amount of
+# source files, where putting all generated files in the same directory would
+# otherwise cause performance problems for the file system.
+
+CREATE_SUBDIRS = NO
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all
+# documentation generated by doxygen is written. Doxygen will use this
+# information to generate all constant output in the proper language.
+# The default language is English, other supported languages are:
+# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional,
+# Croatian, Czech, Danish, Dutch, Farsi, Finnish, French, German, Greek,
+# Hungarian, Italian, Japanese, Japanese-en (Japanese with English messages),
+# Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, Polish,
+# Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak, Slovene,
+# Spanish, Swedish, and Ukrainian.
+
+OUTPUT_LANGUAGE = English
+
+# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
+# include brief member descriptions after the members that are listed in
+# the file and class documentation (similar to JavaDoc).
+# Set to NO to disable this.
+
+BRIEF_MEMBER_DESC = YES
+
+# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
+# the brief description of a member or function before the detailed description.
+# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
+# brief descriptions will be completely suppressed.
+
+REPEAT_BRIEF = YES
+
+# This tag implements a quasi-intelligent brief description abbreviator
+# that is used to form the text in various listings. Each string
+# in this list, if found as the leading text of the brief description, will be
+# stripped from the text and the result after processing the whole list, is
+# used as the annotated text. Otherwise, the brief description is used as-is.
+# If left blank, the following values are used ("$name" is automatically
+# replaced with the name of the entity): "The $name class" "The $name widget"
+# "The $name file" "is" "provides" "specifies" "contains"
+# "represents" "a" "an" "the"
+
+ABBREVIATE_BRIEF =
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
+# Doxygen will generate a detailed section even if there is only a brief
+# description.
+
+ALWAYS_DETAILED_SEC = YES
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
+# inherited members of a class in the documentation of that class as if those
+# members were ordinary class members. Constructors, destructors and assignment
+# operators of the base classes will not be shown.
+
+INLINE_INHERITED_MEMB = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
+# path before files name in the file list and in the header files. If set
+# to NO the shortest path that makes the file name unique will be used.
+
+FULL_PATH_NAMES = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
+# can be used to strip a user-defined part of the path. Stripping is
+# only done if one of the specified strings matches the left-hand part of
+# the path. The tag can be used to show relative paths in the file list.
+# If left blank the directory from which doxygen is run is used as the
+# path to strip.
+
+STRIP_FROM_PATH =
+
+# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
+# the path mentioned in the documentation of a class, which tells
+# the reader which header file to include in order to use a class.
+# If left blank only the name of the header file containing the class
+# definition is used. Otherwise one should specify the include paths that
+# are normally passed to the compiler using the -I flag.
+
+STRIP_FROM_INC_PATH =
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
+# (but less readable) file names. This can be useful is your file systems
+# doesn't support long names like on DOS, Mac, or CD-ROM.
+
+SHORT_NAMES = NO
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
+# will interpret the first line (until the first dot) of a JavaDoc-style
+# comment as the brief description. If set to NO, the JavaDoc
+# comments will behave just like regular Qt-style comments
+# (thus requiring an explicit @brief command for a brief description.)
+
+JAVADOC_AUTOBRIEF = NO
+
+# If the QT_AUTOBRIEF tag is set to YES then Doxygen will
+# interpret the first line (until the first dot) of a Qt-style
+# comment as the brief description. If set to NO, the comments
+# will behave just like regular Qt-style comments (thus requiring
+# an explicit \brief command for a brief description.)
+
+QT_AUTOBRIEF = NO
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
+# treat a multi-line C++ special comment block (i.e. a block of //! or ///
+# comments) as a brief description. This used to be the default behaviour.
+# The new default is to treat a multi-line C++ comment block as a detailed
+# description. Set this tag to YES if you prefer the old behaviour instead.
+
+MULTILINE_CPP_IS_BRIEF = YES
+
+# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
+# member inherits the documentation from any documented member that it
+# re-implements.
+
+INHERIT_DOCS = YES
+
+# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce
+# a new page for each member. If set to NO, the documentation of a member will
+# be part of the file/class/namespace that contains it.
+
+SEPARATE_MEMBER_PAGES = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab.
+# Doxygen uses this value to replace tabs by spaces in code fragments.
+
+TAB_SIZE = 8
+
+# This tag can be used to specify a number of aliases that acts
+# as commands in the documentation. An alias has the form "name=value".
+# For example adding "sideeffect=\par Side Effects:\n" will allow you to
+# put the command \sideeffect (or @sideeffect) in the documentation, which
+# will result in a user-defined paragraph with heading "Side Effects:".
+# You can put \n's in the value part of an alias to insert newlines.
+
+ALIASES =
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
+# sources only. Doxygen will then generate output that is more tailored for C.
+# For instance, some of the names that are used will be different. The list
+# of all members will be omitted, etc.
+
+OPTIMIZE_OUTPUT_FOR_C = NO
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java
+# sources only. Doxygen will then generate output that is more tailored for
+# Java. For instance, namespaces will be presented as packages, qualified
+# scopes will look different, etc.
+
+OPTIMIZE_OUTPUT_JAVA = NO
+
+# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
+# sources only. Doxygen will then generate output that is more tailored for
+# Fortran.
+
+OPTIMIZE_FOR_FORTRAN = NO
+
+# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
+# sources. Doxygen will then generate output that is tailored for
+# VHDL.
+
+OPTIMIZE_OUTPUT_VHDL = NO
+
+# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
+# to include (a tag file for) the STL sources as input, then you should
+# set this tag to YES in order to let doxygen match functions declarations and
+# definitions whose arguments contain STL classes (e.g. func(std::string); v.s.
+# func(std::string) {}). This also make the inheritance and collaboration
+# diagrams that involve STL classes more complete and accurate.
+
+BUILTIN_STL_SUPPORT = YES
+
+# If you use Microsoft's C++/CLI language, you should set this option to YES to
+# enable parsing support.
+
+CPP_CLI_SUPPORT = NO
+
+# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only.
+# Doxygen will parse them like normal C++ but will assume all classes use public
+# instead of private inheritance when no explicit protection keyword is present.
+
+SIP_SUPPORT = NO
+
+# For Microsoft's IDL there are propget and propput attributes to indicate getter
+# and setter methods for a property. Setting this option to YES (the default)
+# will make doxygen to replace the get and set methods by a property in the
+# documentation. This will only work if the methods are indeed getting or
+# setting a simple type. If this is not the case, or you want to show the
+# methods anyway, you should set this option to NO.
+
+IDL_PROPERTY_SUPPORT = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
+# tag is set to YES, then doxygen will reuse the documentation of the first
+# member in the group (if any) for the other members of the group. By default
+# all members of a group must be documented explicitly.
+
+DISTRIBUTE_GROUP_DOC = NO
+
+# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
+# the same type (for instance a group of public functions) to be put as a
+# subgroup of that type (e.g. under the Public Functions section). Set it to
+# NO to prevent subgrouping. Alternatively, this can be done per class using
+# the \nosubgrouping command.
+
+SUBGROUPING = YES
+
+# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum
+# is documented as struct, union, or enum with the name of the typedef. So
+# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
+# with name TypeT. When disabled the typedef will appear as a member of a file,
+# namespace, or class. And the struct will be named TypeS. This can typically
+# be useful for C code in case the coding convention dictates that all compound
+# types are typedef'ed and only the typedef is referenced, never the tag name.
+
+TYPEDEF_HIDES_STRUCT = NO
+
+# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to
+# determine which symbols to keep in memory and which to flush to disk.
+# When the cache is full, less often used symbols will be written to disk.
+# For small to medium size projects (<1000 input files) the default value is
+# probably good enough. For larger projects a too small cache size can cause
+# doxygen to be busy swapping symbols to and from disk most of the time
+# causing a significant performance penality.
+# If the system has enough physical memory increasing the cache will improve the
+# performance by keeping more symbols in memory. Note that the value works on
+# a logarithmic scale so increasing the size by one will rougly double the
+# memory usage. The cache size is given by this formula:
+# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0,
+# corresponding to a cache size of 2^16 = 65536 symbols
+
+SYMBOL_CACHE_SIZE = 4
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
+# documentation are documented, even if no documentation was available.
+# Private class members and static file members will be hidden unless
+# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
+
+EXTRACT_ALL = YES
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
+# will be included in the documentation.
+
+EXTRACT_PRIVATE = NO
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file
+# will be included in the documentation.
+
+EXTRACT_STATIC = YES
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
+# defined locally in source files will be included in the documentation.
+# If set to NO only classes defined in header files are included.
+
+EXTRACT_LOCAL_CLASSES = YES
+
+# This flag is only useful for Objective-C code. When set to YES local
+# methods, which are defined in the implementation section but not in
+# the interface are included in the documentation.
+# If set to NO (the default) only methods in the interface are included.
+
+EXTRACT_LOCAL_METHODS = NO
+
+# If this flag is set to YES, the members of anonymous namespaces will be
+# extracted and appear in the documentation as a namespace called
+# 'anonymous_namespace{file}', where file will be replaced with the base
+# name of the file that contains the anonymous namespace. By default
+# anonymous namespace are hidden.
+
+EXTRACT_ANON_NSPACES = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
+# undocumented members of documented classes, files or namespaces.
+# If set to NO (the default) these members will be included in the
+# various overviews, but no documentation section is generated.
+# This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_MEMBERS = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
+# undocumented classes that are normally visible in the class hierarchy.
+# If set to NO (the default) these classes will be included in the various
+# overviews. This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_CLASSES = NO
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
+# friend (class|struct|union) declarations.
+# If set to NO (the default) these declarations will be included in the
+# documentation.
+
+HIDE_FRIEND_COMPOUNDS = NO
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
+# documentation blocks found inside the body of a function.
+# If set to NO (the default) these blocks will be appended to the
+# function's detailed documentation block.
+
+HIDE_IN_BODY_DOCS = NO
+
+# The INTERNAL_DOCS tag determines if documentation
+# that is typed after a \internal command is included. If the tag is set
+# to NO (the default) then the documentation will be excluded.
+# Set it to YES to include the internal documentation.
+
+INTERNAL_DOCS = NO
+
+# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
+# file names in lower-case letters. If set to YES upper-case letters are also
+# allowed. This is useful if you have classes or files whose names only differ
+# in case and if your file system supports case sensitive file names. Windows
+# and Mac users are advised to set this option to NO.
+
+CASE_SENSE_NAMES = YES
+
+# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
+# will show members with their full class and namespace scopes in the
+# documentation. If set to YES the scope will be hidden.
+
+HIDE_SCOPE_NAMES = NO
+
+# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
+# will put a list of the files that are included by a file in the documentation
+# of that file.
+
+SHOW_INCLUDE_FILES = YES
+
+# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
+# is inserted in the documentation for inline members.
+
+INLINE_INFO = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
+# will sort the (detailed) documentation of file and class members
+# alphabetically by member name. If set to NO the members will appear in
+# declaration order.
+
+SORT_MEMBER_DOCS = YES
+
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
+# brief documentation of file, namespace and class members alphabetically
+# by member name. If set to NO (the default) the members will appear in
+# declaration order.
+
+SORT_BRIEF_DOCS = NO
+
+# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the
+# hierarchy of group names into alphabetical order. If set to NO (the default)
+# the group names will appear in their defined order.
+
+SORT_GROUP_NAMES = NO
+
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
+# sorted by fully-qualified names, including namespaces. If set to
+# NO (the default), the class list will be sorted only by class name,
+# not including the namespace part.
+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
+# Note: This option applies only to the class list, not to the
+# alphabetical list.
+
+SORT_BY_SCOPE_NAME = NO
+
+# The GENERATE_TODOLIST tag can be used to enable (YES) or
+# disable (NO) the todo list. This list is created by putting \todo
+# commands in the documentation.
+
+GENERATE_TODOLIST = NO
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or
+# disable (NO) the test list. This list is created by putting \test
+# commands in the documentation.
+
+GENERATE_TESTLIST = NO
+
+# The GENERATE_BUGLIST tag can be used to enable (YES) or
+# disable (NO) the bug list. This list is created by putting \bug
+# commands in the documentation.
+
+GENERATE_BUGLIST = NO
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
+# disable (NO) the deprecated list. This list is created by putting
+# \deprecated commands in the documentation.
+
+GENERATE_DEPRECATEDLIST= NO
+
+# The ENABLED_SECTIONS tag can be used to enable conditional
+# documentation sections, marked by \if sectionname ... \endif.
+
+ENABLED_SECTIONS =
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
+# the initial value of a variable or define consists of for it to appear in
+# the documentation. If the initializer consists of more lines than specified
+# here it will be hidden. Use a value of 0 to hide initializers completely.
+# The appearance of the initializer of individual variables and defines in the
+# documentation can be controlled using \showinitializer or \hideinitializer
+# command in the documentation regardless of this setting.
+
+MAX_INITIALIZER_LINES = 30
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
+# at the bottom of the documentation of classes and structs. If set to YES the
+# list will mention the files that were used to generate the documentation.
+
+SHOW_USED_FILES = YES
+
+# Set the SHOW_FILES tag to NO to disable the generation of the Files page.
+# This will remove the Files entry from the Quick Index and from the
+# Folder Tree View (if specified). The default is YES.
+
+SHOW_FILES = YES
+
+# Set the SHOW_NAMESPACES tag to NO to disable the generation of the
+# Namespaces page. This will remove the Namespaces entry from the Quick Index
+# and from the Folder Tree View (if specified). The default is YES.
+
+SHOW_NAMESPACES = YES
+
+# The FILE_VERSION_FILTER tag can be used to specify a program or script that
+# doxygen should invoke to get the current version for each file (typically from
+# the version control system). Doxygen will invoke the program by executing (via
+# popen()) the command <command> <input-file>, where <command> is the value of
+# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file
+# provided by doxygen. Whatever the program writes to standard output
+# is used as the file version. See the manual for examples.
+
+FILE_VERSION_FILTER =
+
+# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed by
+# doxygen. The layout file controls the global structure of the generated output files
+# in an output format independent way. The create the layout file that represents
+# doxygen's defaults, run doxygen with the -l option. You can optionally specify a
+# file name after the option, if omitted DoxygenLayout.xml will be used as the name
+# of the layout file.
+
+LAYOUT_FILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated
+# by doxygen. Possible values are YES and NO. If left blank NO is used.
+
+QUIET = YES
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are
+# generated by doxygen. Possible values are YES and NO. If left blank
+# NO is used.
+
+WARNINGS = YES
+
+# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
+# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
+# automatically be disabled.
+
+WARN_IF_UNDOCUMENTED = YES
+
+# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
+# potential errors in the documentation, such as not documenting some
+# parameters in a documented function, or documenting parameters that
+# don't exist or using markup commands wrongly.
+
+WARN_IF_DOC_ERROR = YES
+
+# This WARN_NO_PARAMDOC option can be abled to get warnings for
+# functions that are documented, but have no documentation for their parameters
+# or return value. If set to NO (the default) doxygen will only warn about
+# wrong or incomplete parameter documentation, but not about the absence of
+# documentation.
+
+WARN_NO_PARAMDOC = NO
+
+# The WARN_FORMAT tag determines the format of the warning messages that
+# doxygen can produce. The string should contain the $file, $line, and $text
+# tags, which will be replaced by the file and line number from which the
+# warning originated and the warning text. Optionally the format may contain
+# $version, which will be replaced by the version of the file (if it could
+# be obtained via FILE_VERSION_FILTER)
+
+WARN_FORMAT = "$file:$line: $text "
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning
+# and error messages should be written. If left blank the output is written
+# to stderr.
+
+WARN_LOGFILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag can be used to specify the files and/or directories that contain
+# documented source files. You may enter file names like "myfile.cpp" or
+# directories like "/usr/src/myproject". Separate the files or directories
+# with spaces.
+
+INPUT = @top_srcdir@ @top_builddir@
+
+# This tag can be used to specify the character encoding of the source files
+# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
+# also the default input encoding. Doxygen uses libiconv (or the iconv built
+# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for
+# the list of possible encodings.
+
+INPUT_ENCODING = UTF-8
+
+# If the value of the INPUT tag contains directories, you can use the
+# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank the following patterns are tested:
+# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx
+# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90
+
+FILE_PATTERNS = *.h \
+ *.dox
+
+# The RECURSIVE tag can be used to turn specify whether or not subdirectories
+# should be searched for input files as well. Possible values are YES and NO.
+# If left blank NO is used.
+
+RECURSIVE = YES
+
+# The EXCLUDE tag can be used to specify files and/or directories that should
+# excluded from the INPUT source files. This way you can easily exclude a
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+
+EXCLUDE = @abs_top_builddir@/docs/doxygen/html \
+ @abs_top_builddir@/docs/doxygen/xml \
+ @abs_top_builddir@/docs/doxygen/other/doxypy.py \
+ @abs_top_builddir@/dtools \
+ @abs_top_builddir@/gnuradio-core/src/lib/bug_work_around_6.cc \
+ @abs_top_builddir@/gnuradio-core/src/lib/filter/assembly.h \
+ @abs_top_builddir@/gnuradio-core/src/lib/filter/generate_all.py \
+ @abs_top_builddir@/gnuradio-core/src/lib/filter/generate_gr_fir_XXX.py \
+ @abs_top_builddir@/gnuradio-core/src/lib/filter/generate_gr_fir_filter_XXX.py \
+ @abs_top_builddir@/gnuradio-core/src/lib/filter/generate_gr_fir_sysconfig.py \
+ @abs_top_builddir@/gnuradio-core/src/lib/filter/generate_gr_fir_sysconfig_generic.py \
+ @abs_top_builddir@/gnuradio-core/src/lib/filter/generate_gr_fir_util.py \
+ @abs_top_builddir@/gnuradio-core/src/lib/filter/generate_gr_freq_xlating_fir_filter_XXX.py \
+ @abs_top_builddir@/gnuradio-core/src/lib/filter/generate_gr_interp_fir_filter_XXX.py \
+ @abs_top_builddir@/gnuradio-core/src/lib/filter/generate_gr_rational_resampler_base_XXX.py \
+ @abs_top_builddir@/gnuradio-core/src/lib/filter/generate_utils.py \
+ @abs_top_builddir@/gnuradio-core/src/lib/filter/gr_altivec.h \
+ @abs_top_builddir@/gnuradio-core/src/lib/filter/sse_debug.h \
+ @abs_top_builddir@/gnuradio-core/src/lib/gengen/generate_all.py \
+ @abs_top_builddir@/gnuradio-core/src/lib/gengen/generate_common.py \
+ @abs_top_builddir@/gnuradio-core/src/lib/missing/bug_work_around_8.cc \
+ @abs_top_builddir@/gnuradio-core/src/lib/missing/getopt.h \
+ @abs_top_builddir@/gnuradio-core/src/lib/runtime/gr_error_handler.cc \
+ @abs_top_builddir@/gnuradio-core/src/lib/swig \
+ @abs_top_builddir@/gnuradio-core/src/python/bin \
+ @abs_top_builddir@/gnuradio-core/src/python/build_utils.py \
+ @abs_top_builddir@/gnuradio-core/src/python/build_utils_codes.py \
+ @abs_top_builddir@/gnuradio-core/src/python/gnuradio/gr/gr_threading.py \
+ @abs_top_builddir@/gnuradio-core/src/python/gnuradio/gr/gr_threading_23.py \
+ @abs_top_builddir@/gnuradio-core/src/python/gnuradio/gr/gr_threading_24.py \
+ @abs_top_builddir@/gnuradio-core/src/tests \
+ @abs_top_builddir@/gnuradio-core/src/utils \
+ @abs_top_builddir@/gnuradio-examples/python/apps/hf_radio/output.py \
+ @abs_top_builddir@/gnuradio-examples/python/apps/hf_radio/ui.py \
+ @abs_top_builddir@/gr-atsc/src/lib/atsc.cc \
+ @abs_top_builddir@/gr-atsc/src/lib/atsc.py \
+ @abs_top_builddir@/gr-atsc/src/lib/gen_encoder.py \
+ @abs_top_builddir@/gr-atsc/src/python \
+ @abs_top_builddir@/gr-atsc/src/python \
+ @abs_top_builddir@/gr-audio-alsa/src/audio-alsa.py \
+ @abs_top_builddir@/gr-audio-oss/src/audio_oss.py \
+ @abs_top_builddir@/gr-audio-osx/src/test_audio_loop.py \
+ @abs_top_builddir@/gr-gsm-fr-vocoder/src/lib/gsm \
+ @abs_top_builddir@/gr-gsm-fr-vocoder/src/lib/gsm_full_rate.py \
+ @abs_top_builddir@/gr-gsm-fr-vocoder/src/python/encdec.py \
+ @abs_top_builddir@/gr-howto-write-a-block \
+ @abs_top_builddir@/gr-pager/src/pager_swig.py \
+ @abs_top_builddir@/gr-trellis/doc \
+ @abs_top_builddir@/gr-trellis/src/lib/generate_all.py \
+ @abs_top_builddir@/gr-trellis/src/lib/generate_trellis.py \
+ @abs_top_builddir@/gr-trellis/src/lib/trellis.py \
+ @abs_top_builddir@/gr-video-sdl/src/video_sdl.py \
+ @abs_top_builddir@/gr-wxgui/src/python \
+ @abs_top_builddir@/grc \
+ @abs_top_builddir@/_CPack_Packages \
+ @abs_top_srcdir@/cmake \
+ @abs_top_srcdir@/gr-qtgui/lib \
+ @abs_top_srcdir@/gr-howto-write-a-block \
+ @abs_top_srcdir@/gr-utils/src/python/modtool/gr-newmod
+
+# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
+# directories that are symbolic links (a Unix filesystem feature) are excluded
+# from the input.
+
+EXCLUDE_SYMLINKS = NO
+
+# If the value of the INPUT tag contains directories, you can use the
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
+# certain files from those directories. Note that the wildcards are matched
+# against the file with absolute path, so to exclude all test directories
+# for example use the pattern */test/*
+
+EXCLUDE_PATTERNS = */.deps/* \
+ */.libs/* \
+ */.svn/* \
+ */CVS/* \
+ */__init__.py \
+ */gr-atsc/src/lib/Gr* \
+ */moc_*.cc \
+ */qa_*.cc \
+ */qa_*.h \
+ */qa_*.py
+
+# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
+# (namespaces, classes, functions, etc.) that should be excluded from the
+# output. The symbol name can be a fully qualified name, a word, or if the
+# wildcard * is used, a substring. Examples: ANamespace, AClass,
+# AClass::ANamespace, ANamespace::*Test
+
+EXCLUDE_SYMBOLS = ad9862 \
+ numpy \
+ *swig* \
+ *Swig* \
+ *my_top_block* \
+ *my_graph* \
+ *app_top_block* \
+ *am_rx_graph* \
+ *_queue_watcher_thread* \
+ *parse* \
+ *MyFrame* \
+ *MyApp* \
+ *PyObject* \
+ *wfm_rx_block* \
+ *_sptr* \
+ *debug* \
+ *wfm_rx_sca_block* \
+ *tv_rx_block* \
+ *wxapt_rx_block* \
+ *example_signal*
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or
+# directories that contain example code fragments that are included (see
+# the \include command).
+
+EXAMPLE_PATH = @abs_top_srcdir@
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank all files are included.
+
+EXAMPLE_PATTERNS =
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
+# searched for input files to be used with the \include or \dontinclude
+# commands irrespective of the value of the RECURSIVE tag.
+# Possible values are YES and NO. If left blank NO is used.
+
+EXAMPLE_RECURSIVE = NO
+
+# The IMAGE_PATH tag can be used to specify one or more files or
+# directories that contain image that are included in the documentation (see
+# the \image command).
+
+IMAGE_PATH = @abs_top_srcdir@/docs/doxygen/images/
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should
+# invoke to filter for each input file. Doxygen will invoke the filter program
+# by executing (via popen()) the command <filter> <input-file>, where <filter>
+# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
+# input file. Doxygen will then use the output that the filter program writes
+# to standard output. If FILTER_PATTERNS is specified, this tag will be
+# ignored.
+
+INPUT_FILTER =
+
+# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
+# basis. Doxygen will compare the file name with each pattern and apply the
+# filter if there is a match. The filters are a list of the form:
+# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
+# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER
+# is applied to all files.
+
+FILTER_PATTERNS = *.py=@top_srcdir@/gnuradio-core/doc/other/doxypy.py
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
+# INPUT_FILTER) will be used to filter the input files when producing source
+# files to browse (i.e. when SOURCE_BROWSER is set to YES).
+
+FILTER_SOURCE_FILES = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will
+# be generated. Documented entities will be cross-referenced with these sources.
+# Note: To get rid of all source code in the generated output, make sure also
+# VERBATIM_HEADERS is set to NO.
+
+SOURCE_BROWSER = NO
+
+# Setting the INLINE_SOURCES tag to YES will include the body
+# of functions and classes directly in the documentation.
+
+INLINE_SOURCES = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
+# doxygen to hide any special comment blocks from generated source code
+# fragments. Normal C and C++ comments will always remain visible.
+
+STRIP_CODE_COMMENTS = NO
+
+# If the REFERENCED_BY_RELATION tag is set to YES
+# then for each documented function all documented
+# functions referencing it will be listed.
+
+REFERENCED_BY_RELATION = YES
+
+# If the REFERENCES_RELATION tag is set to YES
+# then for each documented function all documented entities
+# called/used by that function will be listed.
+
+REFERENCES_RELATION = YES
+
+# If the REFERENCES_LINK_SOURCE tag is set to YES (the default)
+# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
+# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
+# link to the source code. Otherwise they will link to the documentstion.
+
+REFERENCES_LINK_SOURCE = YES
+
+# If the USE_HTAGS tag is set to YES then the references to source code
+# will point to the HTML generated by the htags(1) tool instead of doxygen
+# built-in source browser. The htags tool is part of GNU's global source
+# tagging system (see http://www.gnu.org/software/global/global.html). You
+# will need version 4.8.6 or higher.
+
+USE_HTAGS = NO
+
+# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
+# will generate a verbatim copy of the header file for each class for
+# which an include is specified. Set to NO to disable this.
+
+VERBATIM_HEADERS = YES
+
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
+# of all compounds will be generated. Enable this if the project
+# contains a lot of classes, structs, unions or interfaces.
+
+ALPHABETICAL_INDEX = YES
+
+# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
+# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
+# in which this list will be split (can be a number in the range [1..20])
+
+COLS_IN_ALPHA_INDEX = 5
+
+# In case all classes in a project start with a common prefix, all
+# classes will be put under the same header in the alphabetical index.
+# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
+# should be ignored while generating the index headers.
+
+IGNORE_PREFIX =
+
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
+# generate HTML output.
+
+GENERATE_HTML = @enable_html_docs@
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `html' will be used as the default path.
+
+HTML_OUTPUT = html
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
+# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
+# doxygen will generate files with .html extension.
+
+HTML_FILE_EXTENSION = .html
+
+# The HTML_HEADER tag can be used to specify a personal HTML header for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard header.
+
+HTML_HEADER =
+
+# The HTML_FOOTER tag can be used to specify a personal HTML footer for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard footer.
+
+HTML_FOOTER =
+
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
+# style sheet that is used by each HTML page. It can be used to
+# fine-tune the look of the HTML output. If the tag is left blank doxygen
+# will generate a default style sheet. Note that doxygen will try to copy
+# the style sheet file to the HTML output directory, so don't put your own
+# stylesheet in the HTML output directory as well, or it will be erased!
+
+HTML_STYLESHEET =
+
+# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
+# documentation will contain sections that can be hidden and shown after the
+# page has loaded. For this to work a browser that supports
+# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox
+# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
+
+HTML_DYNAMIC_SECTIONS = NO
+
+# If the GENERATE_DOCSET tag is set to YES, additional index files
+# will be generated that can be used as input for Apple's Xcode 3
+# integrated development environment, introduced with OSX 10.5 (Leopard).
+# To create a documentation set, doxygen will generate a Makefile in the
+# HTML output directory. Running make will produce the docset in that
+# directory and running "make install" will install the docset in
+# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find
+# it at startup.
+# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html for more information.
+
+GENERATE_DOCSET = NO
+
+# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the
+# feed. A documentation feed provides an umbrella under which multiple
+# documentation sets from a single provider (such as a company or product suite)
+# can be grouped.
+
+DOCSET_FEEDNAME = "Doxygen generated docs"
+
+# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that
+# should uniquely identify the documentation set bundle. This should be a
+# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen
+# will append .docset to the name.
+
+DOCSET_BUNDLE_ID = org.doxygen.Project
+
+# If the GENERATE_HTMLHELP tag is set to YES, additional index files
+# will be generated that can be used as input for tools like the
+# Microsoft HTML help workshop to generate a compiled HTML help file (.chm)
+# of the generated HTML documentation.
+
+GENERATE_HTMLHELP = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
+# be used to specify the file name of the resulting .chm file. You
+# can add a path in front of the file if the result should not be
+# written to the html output directory.
+
+CHM_FILE =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
+# be used to specify the location (absolute path including file name) of
+# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
+# the HTML help compiler on the generated index.hhp.
+
+HHC_LOCATION =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
+# controls if a separate .chi index file is generated (YES) or that
+# it should be included in the master .chm file (NO).
+
+GENERATE_CHI = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING
+# is used to encode HtmlHelp index (hhk), content (hhc) and project file
+# content.
+
+CHM_INDEX_ENCODING =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
+# controls whether a binary table of contents is generated (YES) or a
+# normal table of contents (NO) in the .chm file.
+
+BINARY_TOC = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members
+# to the contents of the HTML help documentation and to the tree view.
+
+TOC_EXPAND = YES
+
+# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and QHP_VIRTUAL_FOLDER
+# are set, an additional index file will be generated that can be used as input for
+# Qt's qhelpgenerator to generate a Qt Compressed Help (.qch) of the generated
+# HTML documentation.
+
+GENERATE_QHP = NO
+
+# If the QHG_LOCATION tag is specified, the QCH_FILE tag can
+# be used to specify the file name of the resulting .qch file.
+# The path specified is relative to the HTML output folder.
+
+QCH_FILE =
+
+# The QHP_NAMESPACE tag specifies the namespace to use when generating
+# Qt Help Project output. For more information please see
+# <a href="http://doc.trolltech.com/qthelpproject.html#namespace">Qt Help Project / Namespace</a>.
+
+QHP_NAMESPACE = org.doxygen.Project
+
+# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating
+# Qt Help Project output. For more information please see
+# <a href="http://doc.trolltech.com/qthelpproject.html#virtual-folders">Qt Help Project / Virtual Folders</a>.
+
+QHP_VIRTUAL_FOLDER = doc
+
+# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can
+# be used to specify the location of Qt's qhelpgenerator.
+# If non-empty doxygen will try to run qhelpgenerator on the generated
+# .qhp file .
+
+QHG_LOCATION =
+
+# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
+# top of each HTML page. The value NO (the default) enables the index and
+# the value YES disables it.
+
+DISABLE_INDEX = YES
+
+# This tag can be used to set the number of enum values (range [1..20])
+# that doxygen will group on one line in the generated HTML documentation.
+
+ENUM_VALUES_PER_LINE = 4
+
+# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
+# structure should be generated to display hierarchical information.
+# If the tag value is set to FRAME, a side panel will be generated
+# containing a tree-like index structure (just like the one that
+# is generated for HTML Help). For this to work a browser that supports
+# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+,
+# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are
+# probably better off using the HTML help feature. Other possible values
+# for this tag are: HIERARCHIES, which will generate the Groups, Directories,
+# and Class Hierarchy pages using a tree view instead of an ordered list;
+# ALL, which combines the behavior of FRAME and HIERARCHIES; and NONE, which
+# disables this behavior completely. For backwards compatibility with previous
+# releases of Doxygen, the values YES and NO are equivalent to FRAME and NONE
+# respectively.
+
+GENERATE_TREEVIEW = YES
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
+# used to set the initial width (in pixels) of the frame in which the tree
+# is shown.
+
+TREEVIEW_WIDTH = 180
+
+# Use this tag to change the font size of Latex formulas included
+# as images in the HTML documentation. The default is 10. Note that
+# when you change the font size after a successful doxygen run you need
+# to manually remove any form_*.png images from the HTML output directory
+# to force them to be regenerated.
+
+FORMULA_FONTSIZE = 10
+
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
+# generate Latex output.
+
+GENERATE_LATEX = @enable_latex_docs@
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `latex' will be used as the default path.
+
+LATEX_OUTPUT = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
+# invoked. If left blank `latex' will be used as the default command name.
+
+LATEX_CMD_NAME = latex
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
+# generate index for LaTeX. If left blank `makeindex' will be used as the
+# default command name.
+
+MAKEINDEX_CMD_NAME = makeindex
+
+# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
+# LaTeX documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_LATEX = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used
+# by the printer. Possible values are: a4, a4wide, letter, legal and
+# executive. If left blank a4wide will be used.
+
+PAPER_TYPE = letter
+
+# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
+# packages that should be included in the LaTeX output.
+
+EXTRA_PACKAGES =
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
+# the generated latex document. The header should contain everything until
+# the first chapter. If it is left blank doxygen will generate a
+# standard header. Notice: only use this tag if you know what you are doing!
+
+LATEX_HEADER =
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
+# is prepared for conversion to pdf (using ps2pdf). The pdf file will
+# contain links (just like the HTML output) instead of page references
+# This makes the output suitable for online browsing using a pdf viewer.
+
+PDF_HYPERLINKS = YES
+
+# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
+# plain latex in the generated Makefile. Set this option to YES to get a
+# higher quality PDF documentation.
+
+USE_PDFLATEX = NO
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
+# command to the generated LaTeX files. This will instruct LaTeX to keep
+# running if errors occur, instead of asking the user for help.
+# This option is also used when generating formulas in HTML.
+
+LATEX_BATCHMODE = NO
+
+# If LATEX_HIDE_INDICES is set to YES then doxygen will not
+# include the index chapters (such as File Index, Compound Index, etc.)
+# in the output.
+
+LATEX_HIDE_INDICES = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
+# The RTF output is optimized for Word 97 and may not look very pretty with
+# other RTF readers or editors.
+
+GENERATE_RTF = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `rtf' will be used as the default path.
+
+RTF_OUTPUT = rtf
+
+# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
+# RTF documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_RTF = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
+# will contain hyperlink fields. The RTF file will
+# contain links (just like the HTML output) instead of page references.
+# This makes the output suitable for online browsing using WORD or other
+# programs which support those fields.
+# Note: wordpad (write) and others do not support links.
+
+RTF_HYPERLINKS = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's
+# config file, i.e. a series of assignments. You only have to provide
+# replacements, missing definitions are set to their default value.
+
+RTF_STYLESHEET_FILE =
+
+# Set optional variables used in the generation of an rtf document.
+# Syntax is similar to doxygen's config file.
+
+RTF_EXTENSIONS_FILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
+# generate man pages
+
+GENERATE_MAN = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `man' will be used as the default path.
+
+MAN_OUTPUT = man
+
+# The MAN_EXTENSION tag determines the extension that is added to
+# the generated man pages (default is the subroutine's section .3)
+
+MAN_EXTENSION = .3
+
+# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
+# then it will generate one additional man file for each entity
+# documented in the real man page(s). These additional files
+# only source the real man page, but without them the man command
+# would be unable to find the correct page. The default is NO.
+
+MAN_LINKS = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES Doxygen will
+# generate an XML file that captures the structure of
+# the code including all documentation.
+
+GENERATE_XML = @enable_xml_docs@
+
+# The XML_OUTPUT tag is used to specify where the XML pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `xml' will be used as the default path.
+
+XML_OUTPUT = xml
+
+# The XML_SCHEMA tag can be used to specify an XML schema,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_SCHEMA =
+
+# The XML_DTD tag can be used to specify an XML DTD,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_DTD =
+
+# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
+# dump the program listings (including syntax highlighting
+# and cross-referencing information) to the XML output. Note that
+# enabling this will significantly increase the size of the XML output.
+
+XML_PROGRAMLISTING = NO
+
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
+# generate an AutoGen Definitions (see autogen.sf.net) file
+# that captures the structure of the code including all
+# documentation. Note that this feature is still experimental
+# and incomplete at the moment.
+
+GENERATE_AUTOGEN_DEF = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_PERLMOD tag is set to YES Doxygen will
+# generate a Perl module file that captures the structure of
+# the code including all documentation. Note that this
+# feature is still experimental and incomplete at the
+# moment.
+
+GENERATE_PERLMOD = NO
+
+# If the PERLMOD_LATEX tag is set to YES Doxygen will generate
+# the necessary Makefile rules, Perl scripts and LaTeX code to be able
+# to generate PDF and DVI output from the Perl module output.
+
+PERLMOD_LATEX = NO
+
+# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
+# nicely formatted so it can be parsed by a human reader. This is useful
+# if you want to understand what is going on. On the other hand, if this
+# tag is set to NO the size of the Perl module output will be much smaller
+# and Perl will parse it just the same.
+
+PERLMOD_PRETTY = YES
+
+# The names of the make variables in the generated doxyrules.make file
+# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
+# This is useful so different doxyrules.make files included by the same
+# Makefile don't overwrite each other's variables.
+
+PERLMOD_MAKEVAR_PREFIX =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
+# evaluate all C-preprocessor directives found in the sources and include
+# files.
+
+ENABLE_PREPROCESSING = YES
+
+# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
+# names in the source code. If set to NO (the default) only conditional
+# compilation will be performed. Macro expansion can be done in a controlled
+# way by setting EXPAND_ONLY_PREDEF to YES.
+
+MACRO_EXPANSION = NO
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
+# then the macro expansion is limited to the macros specified with the
+# PREDEFINED and EXPAND_AS_DEFINED tags.
+
+EXPAND_ONLY_PREDEF = NO
+
+# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
+# in the INCLUDE_PATH (see below) will be search if a #include is found.
+
+SEARCH_INCLUDES = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that
+# contain include files that are not input files but should be processed by
+# the preprocessor.
+
+INCLUDE_PATH = @abs_top_builddir@/gruel/src/lib/pmt/
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
+# patterns (like *.h and *.hpp) to filter out the header-files in the
+# directories. If left blank, the patterns specified with FILE_PATTERNS will
+# be used.
+
+INCLUDE_FILE_PATTERNS =
+
+# The PREDEFINED tag can be used to specify one or more macro names that
+# are defined before the preprocessor is started (similar to the -D option of
+# gcc). The argument of the tag is a list of macros of the form: name
+# or name=definition (no spaces). If the definition and the = are
+# omitted =1 is assumed. To prevent a macro definition from being
+# undefined via #undef or recursively expanded use the := operator
+# instead of the = operator.
+
+PREDEFINED =
+
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
+# this tag can be used to specify a list of macro names that should be expanded.
+# The macro definition that is found in the sources will be used.
+# Use the PREDEFINED tag if you want to use a different macro definition.
+
+EXPAND_AS_DEFINED =
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
+# doxygen's preprocessor will remove all function-like macros that are alone
+# on a line, have an all uppercase name, and do not end with a semicolon. Such
+# function macros are typically used for boiler-plate code, and will confuse
+# the parser if not removed.
+
+SKIP_FUNCTION_MACROS = YES
+
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references
+#---------------------------------------------------------------------------
+
+# The TAGFILES option can be used to specify one or more tagfiles.
+# Optionally an initial location of the external documentation
+# can be added for each tagfile. The format of a tag file without
+# this location is as follows:
+# TAGFILES = file1 file2 ...
+# Adding location for the tag files is done as follows:
+# TAGFILES = file1=loc1 "file2 = loc2" ...
+# where "loc1" and "loc2" can be relative or absolute paths or
+# URLs. If a location is present for each tag, the installdox tool
+# does not have to be run to correct the links.
+# Note that each tag file must have a unique name
+# (where the name does NOT include the path)
+# If a tag file is not located in the directory in which doxygen
+# is run, you must also specify the path to the tagfile here.
+
+TAGFILES =
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create
+# a tag file that is based on the input files it reads.
+
+GENERATE_TAGFILE =
+
+# If the ALLEXTERNALS tag is set to YES all external classes will be listed
+# in the class index. If set to NO only the inherited external classes
+# will be listed.
+
+ALLEXTERNALS = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
+# in the modules index. If set to NO, only the current project's groups will
+# be listed.
+
+EXTERNAL_GROUPS = YES
+
+# The PERL_PATH should be the absolute path and name of the perl script
+# interpreter (i.e. the result of `which perl').
+
+PERL_PATH = /usr/bin/perl
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
+# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base
+# or super classes. Setting the tag to NO turns the diagrams off. Note that
+# this option is superseded by the HAVE_DOT option below. This is only a
+# fallback. It is recommended to install and use dot, since it yields more
+# powerful graphs.
+
+CLASS_DIAGRAMS = YES
+
+# You can define message sequence charts within doxygen comments using the \msc
+# command. Doxygen will then run the mscgen tool (see
+# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the
+# documentation. The MSCGEN_PATH tag allows you to specify the directory where
+# the mscgen tool resides. If left empty the tool is assumed to be found in the
+# default search path.
+
+MSCGEN_PATH =
+
+# If set to YES, the inheritance and collaboration graphs will hide
+# inheritance and usage relations if the target is undocumented
+# or is not a class.
+
+HIDE_UNDOC_RELATIONS = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
+# available from the path. This tool is part of Graphviz, a graph visualization
+# toolkit from AT&T and Lucent Bell Labs. The other options in this section
+# have no effect if this option is set to NO (the default)
+
+HAVE_DOT = @HAVE_DOT@
+
+# By default doxygen will write a font called FreeSans.ttf to the output
+# directory and reference it in all dot files that doxygen generates. This
+# font does not include all possible unicode characters however, so when you need
+# these (or just want a differently looking font) you can specify the font name
+# using DOT_FONTNAME. You need need to make sure dot is able to find the font,
+# which can be done by putting it in a standard location or by setting the
+# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory
+# containing the font.
+
+DOT_FONTNAME = FreeSans
+
+# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs.
+# The default size is 10pt.
+
+DOT_FONTSIZE = 10
+
+# By default doxygen will tell dot to use the output directory to look for the
+# FreeSans.ttf font (which doxygen will put there itself). If you specify a
+# different font using DOT_FONTNAME you can set the path where dot
+# can find it using this tag.
+
+DOT_FONTPATH =
+
+# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect inheritance relations. Setting this tag to YES will force the
+# the CLASS_DIAGRAMS tag to NO.
+
+CLASS_GRAPH = YES
+
+# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect implementation dependencies (inheritance, containment, and
+# class references variables) of the class with other documented classes.
+
+COLLABORATION_GRAPH = NO
+
+# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for groups, showing the direct groups dependencies
+
+GROUP_GRAPHS = YES
+
+# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
+# collaboration diagrams in a style similar to the OMG's Unified Modeling
+# Language.
+
+UML_LOOK = NO
+
+# If set to YES, the inheritance and collaboration graphs will show the
+# relations between templates and their instances.
+
+TEMPLATE_RELATIONS = NO
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
+# tags are set to YES then doxygen will generate a graph for each documented
+# file showing the direct and indirect include dependencies of the file with
+# other documented files.
+
+INCLUDE_GRAPH = YES
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
+# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
+# documented header file showing the documented files that directly or
+# indirectly include this file.
+
+INCLUDED_BY_GRAPH = YES
+
+# If the CALL_GRAPH and HAVE_DOT options are set to YES then
+# doxygen will generate a call dependency graph for every global function
+# or class method. Note that enabling this option will significantly increase
+# the time of a run. So in most cases it will be better to enable call graphs
+# for selected functions only using the \callgraph command.
+
+CALL_GRAPH = NO
+
+# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then
+# doxygen will generate a caller dependency graph for every global function
+# or class method. Note that enabling this option will significantly increase
+# the time of a run. So in most cases it will be better to enable caller
+# graphs for selected functions only using the \callergraph command.
+
+CALLER_GRAPH = NO
+
+# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
+# will graphical hierarchy of all classes instead of a textual one.
+
+GRAPHICAL_HIERARCHY = YES
+
+# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES
+# then doxygen will show the dependencies a directory has on other directories
+# in a graphical way. The dependency relations are determined by the #include
+# relations between the files in the directories.
+
+DIRECTORY_GRAPH = YES
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
+# generated by dot. Possible values are png, jpg, or gif
+# If left blank png will be used.
+
+DOT_IMAGE_FORMAT = png
+
+# The tag DOT_PATH can be used to specify the path where the dot tool can be
+# found. If left blank, it is assumed the dot tool can be found in the path.
+
+DOT_PATH =
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that
+# contain dot files that are included in the documentation (see the
+# \dotfile command).
+
+DOTFILE_DIRS =
+
+# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of
+# nodes that will be shown in the graph. If the number of nodes in a graph
+# becomes larger than this value, doxygen will truncate the graph, which is
+# visualized by representing a node as a red box. Note that doxygen if the
+# number of direct children of the root node in a graph is already larger than
+# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note
+# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
+
+DOT_GRAPH_MAX_NODES = 50
+
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
+# graphs generated by dot. A depth value of 3 means that only nodes reachable
+# from the root by following a path via at most 3 edges will be shown. Nodes
+# that lay further from the root node will be omitted. Note that setting this
+# option to 1 or 2 may greatly reduce the computation time needed for large
+# code bases. Also note that the size of a graph can be further restricted by
+# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
+
+MAX_DOT_GRAPH_DEPTH = 0
+
+# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
+# background. This is disabled by default, because dot on Windows does not
+# seem to support this out of the box. Warning: Depending on the platform used,
+# enabling this option may lead to badly anti-aliased labels on the edges of
+# a graph (i.e. they become hard to read).
+
+DOT_TRANSPARENT = NO
+
+# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
+# files in one run (i.e. multiple -o and -T options on the command line). This
+# makes dot run faster, but since only newer versions of dot (>1.8.10)
+# support this, this feature is disabled by default.
+
+DOT_MULTI_TARGETS = YES
+
+# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
+# generate a legend page explaining the meaning of the various boxes and
+# arrows in the dot generated graphs.
+
+GENERATE_LEGEND = YES
+
+# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
+# remove the intermediate dot files that are used to generate
+# the various graphs.
+
+DOT_CLEANUP = YES
+
+#---------------------------------------------------------------------------
+# Configuration::additions related to the search engine
+#---------------------------------------------------------------------------
+
+# The SEARCHENGINE tag specifies whether or not a search engine should be
+# used. If set to NO the values of all tags below this one will be ignored.
+
+SEARCHENGINE = NO
diff --git a/docs/doxygen/Doxyfile.swig_doc.in b/docs/doxygen/Doxyfile.swig_doc.in
new file mode 100644
index 000000000..8f6182ca8
--- /dev/null
+++ b/docs/doxygen/Doxyfile.swig_doc.in
@@ -0,0 +1,1497 @@
+# Doxyfile 1.6.1
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project
+#
+# All text after a hash (#) is considered a comment and will be ignored
+# The format is:
+# TAG = value [value, ...]
+# For lists items can also be appended using:
+# TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (" ")
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+# This tag specifies the encoding used for all characters in the config file
+# that follow. The default is UTF-8 which is also the encoding used for all
+# text before the first occurrence of this tag. Doxygen uses libiconv (or the
+# iconv built into libc) for the transcoding. See
+# http://www.gnu.org/software/libiconv for the list of possible encodings.
+
+DOXYFILE_ENCODING = UTF-8
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
+# by quotes) that should identify the project.
+
+PROJECT_NAME = @CPACK_PACKAGE_NAME@
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number.
+# This could be handy for archiving the generated documentation or
+# if some version control system is used.
+
+PROJECT_NUMBER = @CPACK_PACKAGE_VERSION@
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
+# base path where the generated documentation will be put.
+# If a relative path is entered, it will be relative to the location
+# where doxygen was started. If left blank the current directory will be used.
+
+OUTPUT_DIRECTORY = @OUTPUT_DIRECTORY@
+
+# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
+# 4096 sub-directories (in 2 levels) under the output directory of each output
+# format and will distribute the generated files over these directories.
+# Enabling this option can be useful when feeding doxygen a huge amount of
+# source files, where putting all generated files in the same directory would
+# otherwise cause performance problems for the file system.
+
+CREATE_SUBDIRS = NO
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all
+# documentation generated by doxygen is written. Doxygen will use this
+# information to generate all constant output in the proper language.
+# The default language is English, other supported languages are:
+# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional,
+# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German,
+# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English
+# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian,
+# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak,
+# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese.
+
+OUTPUT_LANGUAGE = English
+
+# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
+# include brief member descriptions after the members that are listed in
+# the file and class documentation (similar to JavaDoc).
+# Set to NO to disable this.
+
+BRIEF_MEMBER_DESC = YES
+
+# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
+# the brief description of a member or function before the detailed description.
+# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
+# brief descriptions will be completely suppressed.
+
+REPEAT_BRIEF = YES
+
+# This tag implements a quasi-intelligent brief description abbreviator
+# that is used to form the text in various listings. Each string
+# in this list, if found as the leading text of the brief description, will be
+# stripped from the text and the result after processing the whole list, is
+# used as the annotated text. Otherwise, the brief description is used as-is.
+# If left blank, the following values are used ("$name" is automatically
+# replaced with the name of the entity): "The $name class" "The $name widget"
+# "The $name file" "is" "provides" "specifies" "contains"
+# "represents" "a" "an" "the"
+
+ABBREVIATE_BRIEF =
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
+# Doxygen will generate a detailed section even if there is only a brief
+# description.
+
+ALWAYS_DETAILED_SEC = NO
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
+# inherited members of a class in the documentation of that class as if those
+# members were ordinary class members. Constructors, destructors and assignment
+# operators of the base classes will not be shown.
+
+INLINE_INHERITED_MEMB = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
+# path before files name in the file list and in the header files. If set
+# to NO the shortest path that makes the file name unique will be used.
+
+FULL_PATH_NAMES = YES
+
+# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
+# can be used to strip a user-defined part of the path. Stripping is
+# only done if one of the specified strings matches the left-hand part of
+# the path. The tag can be used to show relative paths in the file list.
+# If left blank the directory from which doxygen is run is used as the
+# path to strip.
+
+STRIP_FROM_PATH =
+
+# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
+# the path mentioned in the documentation of a class, which tells
+# the reader which header file to include in order to use a class.
+# If left blank only the name of the header file containing the class
+# definition is used. Otherwise one should specify the include paths that
+# are normally passed to the compiler using the -I flag.
+
+STRIP_FROM_INC_PATH =
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
+# (but less readable) file names. This can be useful is your file systems
+# doesn't support long names like on DOS, Mac, or CD-ROM.
+
+SHORT_NAMES = NO
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
+# will interpret the first line (until the first dot) of a JavaDoc-style
+# comment as the brief description. If set to NO, the JavaDoc
+# comments will behave just like regular Qt-style comments
+# (thus requiring an explicit @brief command for a brief description.)
+
+JAVADOC_AUTOBRIEF = NO
+
+# If the QT_AUTOBRIEF tag is set to YES then Doxygen will
+# interpret the first line (until the first dot) of a Qt-style
+# comment as the brief description. If set to NO, the comments
+# will behave just like regular Qt-style comments (thus requiring
+# an explicit \brief command for a brief description.)
+
+QT_AUTOBRIEF = NO
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
+# treat a multi-line C++ special comment block (i.e. a block of //! or ///
+# comments) as a brief description. This used to be the default behaviour.
+# The new default is to treat a multi-line C++ comment block as a detailed
+# description. Set this tag to YES if you prefer the old behaviour instead.
+
+MULTILINE_CPP_IS_BRIEF = NO
+
+# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
+# member inherits the documentation from any documented member that it
+# re-implements.
+
+INHERIT_DOCS = YES
+
+# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce
+# a new page for each member. If set to NO, the documentation of a member will
+# be part of the file/class/namespace that contains it.
+
+SEPARATE_MEMBER_PAGES = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab.
+# Doxygen uses this value to replace tabs by spaces in code fragments.
+
+TAB_SIZE = 8
+
+# This tag can be used to specify a number of aliases that acts
+# as commands in the documentation. An alias has the form "name=value".
+# For example adding "sideeffect=\par Side Effects:\n" will allow you to
+# put the command \sideeffect (or @sideeffect) in the documentation, which
+# will result in a user-defined paragraph with heading "Side Effects:".
+# You can put \n's in the value part of an alias to insert newlines.
+
+ALIASES =
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
+# sources only. Doxygen will then generate output that is more tailored for C.
+# For instance, some of the names that are used will be different. The list
+# of all members will be omitted, etc.
+
+OPTIMIZE_OUTPUT_FOR_C = NO
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java
+# sources only. Doxygen will then generate output that is more tailored for
+# Java. For instance, namespaces will be presented as packages, qualified
+# scopes will look different, etc.
+
+OPTIMIZE_OUTPUT_JAVA = NO
+
+# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
+# sources only. Doxygen will then generate output that is more tailored for
+# Fortran.
+
+OPTIMIZE_FOR_FORTRAN = NO
+
+# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
+# sources. Doxygen will then generate output that is tailored for
+# VHDL.
+
+OPTIMIZE_OUTPUT_VHDL = NO
+
+# Doxygen selects the parser to use depending on the extension of the files it parses.
+# With this tag you can assign which parser to use for a given extension.
+# Doxygen has a built-in mapping, but you can override or extend it using this tag.
+# The format is ext=language, where ext is a file extension, and language is one of
+# the parsers supported by doxygen: IDL, Java, Javascript, C#, C, C++, D, PHP,
+# Objective-C, Python, Fortran, VHDL, C, C++. For instance to make doxygen treat
+# .inc files as Fortran files (default is PHP), and .f files as C (default is Fortran),
+# use: inc=Fortran f=C. Note that for custom extensions you also need to set FILE_PATTERNS otherwise the files are not read by doxygen.
+
+EXTENSION_MAPPING =
+
+# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
+# to include (a tag file for) the STL sources as input, then you should
+# set this tag to YES in order to let doxygen match functions declarations and
+# definitions whose arguments contain STL classes (e.g. func(std::string); v.s.
+# func(std::string) {}). This also make the inheritance and collaboration
+# diagrams that involve STL classes more complete and accurate.
+
+BUILTIN_STL_SUPPORT = YES
+
+# If you use Microsoft's C++/CLI language, you should set this option to YES to
+# enable parsing support.
+
+CPP_CLI_SUPPORT = NO
+
+# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only.
+# Doxygen will parse them like normal C++ but will assume all classes use public
+# instead of private inheritance when no explicit protection keyword is present.
+
+SIP_SUPPORT = NO
+
+# For Microsoft's IDL there are propget and propput attributes to indicate getter
+# and setter methods for a property. Setting this option to YES (the default)
+# will make doxygen to replace the get and set methods by a property in the
+# documentation. This will only work if the methods are indeed getting or
+# setting a simple type. If this is not the case, or you want to show the
+# methods anyway, you should set this option to NO.
+
+IDL_PROPERTY_SUPPORT = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
+# tag is set to YES, then doxygen will reuse the documentation of the first
+# member in the group (if any) for the other members of the group. By default
+# all members of a group must be documented explicitly.
+
+DISTRIBUTE_GROUP_DOC = NO
+
+# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
+# the same type (for instance a group of public functions) to be put as a
+# subgroup of that type (e.g. under the Public Functions section). Set it to
+# NO to prevent subgrouping. Alternatively, this can be done per class using
+# the \nosubgrouping command.
+
+SUBGROUPING = YES
+
+# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum
+# is documented as struct, union, or enum with the name of the typedef. So
+# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
+# with name TypeT. When disabled the typedef will appear as a member of a file,
+# namespace, or class. And the struct will be named TypeS. This can typically
+# be useful for C code in case the coding convention dictates that all compound
+# types are typedef'ed and only the typedef is referenced, never the tag name.
+
+TYPEDEF_HIDES_STRUCT = NO
+
+# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to
+# determine which symbols to keep in memory and which to flush to disk.
+# When the cache is full, less often used symbols will be written to disk.
+# For small to medium size projects (<1000 input files) the default value is
+# probably good enough. For larger projects a too small cache size can cause
+# doxygen to be busy swapping symbols to and from disk most of the time
+# causing a significant performance penality.
+# If the system has enough physical memory increasing the cache will improve the
+# performance by keeping more symbols in memory. Note that the value works on
+# a logarithmic scale so increasing the size by one will rougly double the
+# memory usage. The cache size is given by this formula:
+# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0,
+# corresponding to a cache size of 2^16 = 65536 symbols
+
+SYMBOL_CACHE_SIZE = 0
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
+# documentation are documented, even if no documentation was available.
+# Private class members and static file members will be hidden unless
+# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
+
+EXTRACT_ALL = YES
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
+# will be included in the documentation.
+
+EXTRACT_PRIVATE = NO
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file
+# will be included in the documentation.
+
+EXTRACT_STATIC = NO
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
+# defined locally in source files will be included in the documentation.
+# If set to NO only classes defined in header files are included.
+
+EXTRACT_LOCAL_CLASSES = YES
+
+# This flag is only useful for Objective-C code. When set to YES local
+# methods, which are defined in the implementation section but not in
+# the interface are included in the documentation.
+# If set to NO (the default) only methods in the interface are included.
+
+EXTRACT_LOCAL_METHODS = NO
+
+# If this flag is set to YES, the members of anonymous namespaces will be
+# extracted and appear in the documentation as a namespace called
+# 'anonymous_namespace{file}', where file will be replaced with the base
+# name of the file that contains the anonymous namespace. By default
+# anonymous namespace are hidden.
+
+EXTRACT_ANON_NSPACES = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
+# undocumented members of documented classes, files or namespaces.
+# If set to NO (the default) these members will be included in the
+# various overviews, but no documentation section is generated.
+# This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_MEMBERS = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
+# undocumented classes that are normally visible in the class hierarchy.
+# If set to NO (the default) these classes will be included in the various
+# overviews. This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_CLASSES = NO
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
+# friend (class|struct|union) declarations.
+# If set to NO (the default) these declarations will be included in the
+# documentation.
+
+HIDE_FRIEND_COMPOUNDS = NO
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
+# documentation blocks found inside the body of a function.
+# If set to NO (the default) these blocks will be appended to the
+# function's detailed documentation block.
+
+HIDE_IN_BODY_DOCS = NO
+
+# The INTERNAL_DOCS tag determines if documentation
+# that is typed after a \internal command is included. If the tag is set
+# to NO (the default) then the documentation will be excluded.
+# Set it to YES to include the internal documentation.
+
+INTERNAL_DOCS = NO
+
+# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
+# file names in lower-case letters. If set to YES upper-case letters are also
+# allowed. This is useful if you have classes or files whose names only differ
+# in case and if your file system supports case sensitive file names. Windows
+# and Mac users are advised to set this option to NO.
+
+CASE_SENSE_NAMES = YES
+
+# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
+# will show members with their full class and namespace scopes in the
+# documentation. If set to YES the scope will be hidden.
+
+HIDE_SCOPE_NAMES = NO
+
+# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
+# will put a list of the files that are included by a file in the documentation
+# of that file.
+
+SHOW_INCLUDE_FILES = YES
+
+# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
+# is inserted in the documentation for inline members.
+
+INLINE_INFO = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
+# will sort the (detailed) documentation of file and class members
+# alphabetically by member name. If set to NO the members will appear in
+# declaration order.
+
+SORT_MEMBER_DOCS = YES
+
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
+# brief documentation of file, namespace and class members alphabetically
+# by member name. If set to NO (the default) the members will appear in
+# declaration order.
+
+SORT_BRIEF_DOCS = NO
+
+# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the (brief and detailed) documentation of class members so that constructors and destructors are listed first. If set to NO (the default) the constructors will appear in the respective orders defined by SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO.
+
+SORT_MEMBERS_CTORS_1ST = NO
+
+# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the
+# hierarchy of group names into alphabetical order. If set to NO (the default)
+# the group names will appear in their defined order.
+
+SORT_GROUP_NAMES = NO
+
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
+# sorted by fully-qualified names, including namespaces. If set to
+# NO (the default), the class list will be sorted only by class name,
+# not including the namespace part.
+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
+# Note: This option applies only to the class list, not to the
+# alphabetical list.
+
+SORT_BY_SCOPE_NAME = NO
+
+# The GENERATE_TODOLIST tag can be used to enable (YES) or
+# disable (NO) the todo list. This list is created by putting \todo
+# commands in the documentation.
+
+GENERATE_TODOLIST = YES
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or
+# disable (NO) the test list. This list is created by putting \test
+# commands in the documentation.
+
+GENERATE_TESTLIST = YES
+
+# The GENERATE_BUGLIST tag can be used to enable (YES) or
+# disable (NO) the bug list. This list is created by putting \bug
+# commands in the documentation.
+
+GENERATE_BUGLIST = YES
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
+# disable (NO) the deprecated list. This list is created by putting
+# \deprecated commands in the documentation.
+
+GENERATE_DEPRECATEDLIST= YES
+
+# The ENABLED_SECTIONS tag can be used to enable conditional
+# documentation sections, marked by \if sectionname ... \endif.
+
+ENABLED_SECTIONS =
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
+# the initial value of a variable or define consists of for it to appear in
+# the documentation. If the initializer consists of more lines than specified
+# here it will be hidden. Use a value of 0 to hide initializers completely.
+# The appearance of the initializer of individual variables and defines in the
+# documentation can be controlled using \showinitializer or \hideinitializer
+# command in the documentation regardless of this setting.
+
+MAX_INITIALIZER_LINES = 30
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
+# at the bottom of the documentation of classes and structs. If set to YES the
+# list will mention the files that were used to generate the documentation.
+
+SHOW_USED_FILES = YES
+
+# Set the SHOW_FILES tag to NO to disable the generation of the Files page.
+# This will remove the Files entry from the Quick Index and from the
+# Folder Tree View (if specified). The default is YES.
+
+SHOW_FILES = YES
+
+# Set the SHOW_NAMESPACES tag to NO to disable the generation of the
+# Namespaces page.
+# This will remove the Namespaces entry from the Quick Index
+# and from the Folder Tree View (if specified). The default is YES.
+
+SHOW_NAMESPACES = YES
+
+# The FILE_VERSION_FILTER tag can be used to specify a program or script that
+# doxygen should invoke to get the current version for each file (typically from
+# the version control system). Doxygen will invoke the program by executing (via
+# popen()) the command <command> <input-file>, where <command> is the value of
+# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file
+# provided by doxygen. Whatever the program writes to standard output
+# is used as the file version. See the manual for examples.
+
+FILE_VERSION_FILTER =
+
+# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed by
+# doxygen. The layout file controls the global structure of the generated output files
+# in an output format independent way. The create the layout file that represents
+# doxygen's defaults, run doxygen with the -l option. You can optionally specify a
+# file name after the option, if omitted DoxygenLayout.xml will be used as the name
+# of the layout file.
+
+LAYOUT_FILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated
+# by doxygen. Possible values are YES and NO. If left blank NO is used.
+
+QUIET = YES
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are
+# generated by doxygen. Possible values are YES and NO. If left blank
+# NO is used.
+
+WARNINGS = YES
+
+# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
+# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
+# automatically be disabled.
+
+WARN_IF_UNDOCUMENTED = YES
+
+# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
+# potential errors in the documentation, such as not documenting some
+# parameters in a documented function, or documenting parameters that
+# don't exist or using markup commands wrongly.
+
+WARN_IF_DOC_ERROR = YES
+
+# This WARN_NO_PARAMDOC option can be abled to get warnings for
+# functions that are documented, but have no documentation for their parameters
+# or return value. If set to NO (the default) doxygen will only warn about
+# wrong or incomplete parameter documentation, but not about the absence of
+# documentation.
+
+WARN_NO_PARAMDOC = NO
+
+# The WARN_FORMAT tag determines the format of the warning messages that
+# doxygen can produce. The string should contain the $file, $line, and $text
+# tags, which will be replaced by the file and line number from which the
+# warning originated and the warning text. Optionally the format may contain
+# $version, which will be replaced by the version of the file (if it could
+# be obtained via FILE_VERSION_FILTER)
+
+WARN_FORMAT = "$file:$line: $text"
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning
+# and error messages should be written. If left blank the output is written
+# to stderr.
+
+WARN_LOGFILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag can be used to specify the files and/or directories that contain
+# documented source files. You may enter file names like "myfile.cpp" or
+# directories like "/usr/src/myproject". Separate the files or directories
+# with spaces.
+
+INPUT = @INPUT_PATHS@
+
+# This tag can be used to specify the character encoding of the source files
+# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
+# also the default input encoding. Doxygen uses libiconv (or the iconv built
+# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for
+# the list of possible encodings.
+
+INPUT_ENCODING = UTF-8
+
+# If the value of the INPUT tag contains directories, you can use the
+# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank the following patterns are tested:
+# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx
+# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90
+
+FILE_PATTERNS = *.h
+
+# The RECURSIVE tag can be used to turn specify whether or not subdirectories
+# should be searched for input files as well. Possible values are YES and NO.
+# If left blank NO is used.
+
+RECURSIVE = YES
+
+# The EXCLUDE tag can be used to specify files and/or directories that should
+# excluded from the INPUT source files. This way you can easily exclude a
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+
+EXCLUDE = @CMAKE_SOURCE_DIR@/gr-qtgui/lib
+
+# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
+# directories that are symbolic links (a Unix filesystem feature) are excluded
+# from the input.
+
+EXCLUDE_SYMLINKS = NO
+
+# If the value of the INPUT tag contains directories, you can use the
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
+# certain files from those directories. Note that the wildcards are matched
+# against the file with absolute path, so to exclude all test directories
+# for example use the pattern */test/*
+
+EXCLUDE_PATTERNS =
+
+# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
+# (namespaces, classes, functions, etc.) that should be excluded from the
+# output. The symbol name can be a fully qualified name, a word, or if the
+# wildcard * is used, a substring. Examples: ANamespace, AClass,
+# AClass::ANamespace, ANamespace::*Test
+
+EXCLUDE_SYMBOLS =
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or
+# directories that contain example code fragments that are included (see
+# the \include command).
+
+EXAMPLE_PATH =
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank all files are included.
+
+EXAMPLE_PATTERNS =
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
+# searched for input files to be used with the \include or \dontinclude
+# commands irrespective of the value of the RECURSIVE tag.
+# Possible values are YES and NO. If left blank NO is used.
+
+EXAMPLE_RECURSIVE = NO
+
+# The IMAGE_PATH tag can be used to specify one or more files or
+# directories that contain image that are included in the documentation (see
+# the \image command).
+
+IMAGE_PATH =
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should
+# invoke to filter for each input file. Doxygen will invoke the filter program
+# by executing (via popen()) the command <filter> <input-file>, where <filter>
+# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
+# input file. Doxygen will then use the output that the filter program writes
+# to standard output.
+# If FILTER_PATTERNS is specified, this tag will be
+# ignored.
+
+INPUT_FILTER =
+
+# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
+# basis.
+# Doxygen will compare the file name with each pattern and apply the
+# filter if there is a match.
+# The filters are a list of the form:
+# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
+# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER
+# is applied to all files.
+
+FILTER_PATTERNS =
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
+# INPUT_FILTER) will be used to filter the input files when producing source
+# files to browse (i.e. when SOURCE_BROWSER is set to YES).
+
+FILTER_SOURCE_FILES = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will
+# be generated. Documented entities will be cross-referenced with these sources.
+# Note: To get rid of all source code in the generated output, make sure also
+# VERBATIM_HEADERS is set to NO.
+
+SOURCE_BROWSER = NO
+
+# Setting the INLINE_SOURCES tag to YES will include the body
+# of functions and classes directly in the documentation.
+
+INLINE_SOURCES = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
+# doxygen to hide any special comment blocks from generated source code
+# fragments. Normal C and C++ comments will always remain visible.
+
+STRIP_CODE_COMMENTS = YES
+
+# If the REFERENCED_BY_RELATION tag is set to YES
+# then for each documented function all documented
+# functions referencing it will be listed.
+
+REFERENCED_BY_RELATION = NO
+
+# If the REFERENCES_RELATION tag is set to YES
+# then for each documented function all documented entities
+# called/used by that function will be listed.
+
+REFERENCES_RELATION = NO
+
+# If the REFERENCES_LINK_SOURCE tag is set to YES (the default)
+# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
+# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
+# link to the source code.
+# Otherwise they will link to the documentation.
+
+REFERENCES_LINK_SOURCE = YES
+
+# If the USE_HTAGS tag is set to YES then the references to source code
+# will point to the HTML generated by the htags(1) tool instead of doxygen
+# built-in source browser. The htags tool is part of GNU's global source
+# tagging system (see http://www.gnu.org/software/global/global.html). You
+# will need version 4.8.6 or higher.
+
+USE_HTAGS = NO
+
+# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
+# will generate a verbatim copy of the header file for each class for
+# which an include is specified. Set to NO to disable this.
+
+VERBATIM_HEADERS = YES
+
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
+# of all compounds will be generated. Enable this if the project
+# contains a lot of classes, structs, unions or interfaces.
+
+ALPHABETICAL_INDEX = NO
+
+# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
+# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
+# in which this list will be split (can be a number in the range [1..20])
+
+COLS_IN_ALPHA_INDEX = 5
+
+# In case all classes in a project start with a common prefix, all
+# classes will be put under the same header in the alphabetical index.
+# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
+# should be ignored while generating the index headers.
+
+IGNORE_PREFIX =
+
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
+# generate HTML output.
+
+GENERATE_HTML = NO
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `html' will be used as the default path.
+
+HTML_OUTPUT = html
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
+# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
+# doxygen will generate files with .html extension.
+
+HTML_FILE_EXTENSION = .html
+
+# The HTML_HEADER tag can be used to specify a personal HTML header for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard header.
+
+HTML_HEADER =
+
+# The HTML_FOOTER tag can be used to specify a personal HTML footer for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard footer.
+
+HTML_FOOTER =
+
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
+# style sheet that is used by each HTML page. It can be used to
+# fine-tune the look of the HTML output. If the tag is left blank doxygen
+# will generate a default style sheet. Note that doxygen will try to copy
+# the style sheet file to the HTML output directory, so don't put your own
+# stylesheet in the HTML output directory as well, or it will be erased!
+
+HTML_STYLESHEET =
+
+# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
+# documentation will contain sections that can be hidden and shown after the
+# page has loaded. For this to work a browser that supports
+# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox
+# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
+
+HTML_DYNAMIC_SECTIONS = NO
+
+# If the GENERATE_DOCSET tag is set to YES, additional index files
+# will be generated that can be used as input for Apple's Xcode 3
+# integrated development environment, introduced with OSX 10.5 (Leopard).
+# To create a documentation set, doxygen will generate a Makefile in the
+# HTML output directory. Running make will produce the docset in that
+# directory and running "make install" will install the docset in
+# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find
+# it at startup.
+# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html for more information.
+
+GENERATE_DOCSET = NO
+
+# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the
+# feed. A documentation feed provides an umbrella under which multiple
+# documentation sets from a single provider (such as a company or product suite)
+# can be grouped.
+
+DOCSET_FEEDNAME = "Doxygen generated docs"
+
+# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that
+# should uniquely identify the documentation set bundle. This should be a
+# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen
+# will append .docset to the name.
+
+DOCSET_BUNDLE_ID = org.doxygen.Project
+
+# If the GENERATE_HTMLHELP tag is set to YES, additional index files
+# will be generated that can be used as input for tools like the
+# Microsoft HTML help workshop to generate a compiled HTML help file (.chm)
+# of the generated HTML documentation.
+
+GENERATE_HTMLHELP = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
+# be used to specify the file name of the resulting .chm file. You
+# can add a path in front of the file if the result should not be
+# written to the html output directory.
+
+CHM_FILE =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
+# be used to specify the location (absolute path including file name) of
+# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
+# the HTML help compiler on the generated index.hhp.
+
+HHC_LOCATION =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
+# controls if a separate .chi index file is generated (YES) or that
+# it should be included in the master .chm file (NO).
+
+GENERATE_CHI = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING
+# is used to encode HtmlHelp index (hhk), content (hhc) and project file
+# content.
+
+CHM_INDEX_ENCODING =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
+# controls whether a binary table of contents is generated (YES) or a
+# normal table of contents (NO) in the .chm file.
+
+BINARY_TOC = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members
+# to the contents of the HTML help documentation and to the tree view.
+
+TOC_EXPAND = NO
+
+# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and QHP_VIRTUAL_FOLDER
+# are set, an additional index file will be generated that can be used as input for
+# Qt's qhelpgenerator to generate a Qt Compressed Help (.qch) of the generated
+# HTML documentation.
+
+GENERATE_QHP = NO
+
+# If the QHG_LOCATION tag is specified, the QCH_FILE tag can
+# be used to specify the file name of the resulting .qch file.
+# The path specified is relative to the HTML output folder.
+
+QCH_FILE =
+
+# The QHP_NAMESPACE tag specifies the namespace to use when generating
+# Qt Help Project output. For more information please see
+# http://doc.trolltech.com/qthelpproject.html#namespace
+
+QHP_NAMESPACE =
+
+# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating
+# Qt Help Project output. For more information please see
+# http://doc.trolltech.com/qthelpproject.html#virtual-folders
+
+QHP_VIRTUAL_FOLDER = doc
+
+# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to add.
+# For more information please see
+# http://doc.trolltech.com/qthelpproject.html#custom-filters
+
+QHP_CUST_FILTER_NAME =
+
+# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the custom filter to add.For more information please see
+# <a href="http://doc.trolltech.com/qthelpproject.html#custom-filters">Qt Help Project / Custom Filters</a>.
+
+QHP_CUST_FILTER_ATTRS =
+
+# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this project's
+# filter section matches.
+# <a href="http://doc.trolltech.com/qthelpproject.html#filter-attributes">Qt Help Project / Filter Attributes</a>.
+
+QHP_SECT_FILTER_ATTRS =
+
+# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can
+# be used to specify the location of Qt's qhelpgenerator.
+# If non-empty doxygen will try to run qhelpgenerator on the generated
+# .qhp file.
+
+QHG_LOCATION =
+
+# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
+# top of each HTML page. The value NO (the default) enables the index and
+# the value YES disables it.
+
+DISABLE_INDEX = NO
+
+# This tag can be used to set the number of enum values (range [1..20])
+# that doxygen will group on one line in the generated HTML documentation.
+
+ENUM_VALUES_PER_LINE = 4
+
+# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
+# structure should be generated to display hierarchical information.
+# If the tag value is set to YES, a side panel will be generated
+# containing a tree-like index structure (just like the one that
+# is generated for HTML Help). For this to work a browser that supports
+# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser).
+# Windows users are probably better off using the HTML help feature.
+
+GENERATE_TREEVIEW = NO
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
+# used to set the initial width (in pixels) of the frame in which the tree
+# is shown.
+
+TREEVIEW_WIDTH = 250
+
+# Use this tag to change the font size of Latex formulas included
+# as images in the HTML documentation. The default is 10. Note that
+# when you change the font size after a successful doxygen run you need
+# to manually remove any form_*.png images from the HTML output directory
+# to force them to be regenerated.
+
+FORMULA_FONTSIZE = 10
+
+# When the SEARCHENGINE tag is enable doxygen will generate a search box for the HTML output. The underlying search engine uses javascript
+# and DHTML and should work on any modern browser. Note that when using HTML help (GENERATE_HTMLHELP) or Qt help (GENERATE_QHP)
+# there is already a search function so this one should typically
+# be disabled.
+
+SEARCHENGINE = YES
+
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
+# generate Latex output.
+
+GENERATE_LATEX = NO
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `latex' will be used as the default path.
+
+LATEX_OUTPUT = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
+# invoked. If left blank `latex' will be used as the default command name.
+
+LATEX_CMD_NAME = latex
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
+# generate index for LaTeX. If left blank `makeindex' will be used as the
+# default command name.
+
+MAKEINDEX_CMD_NAME = makeindex
+
+# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
+# LaTeX documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_LATEX = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used
+# by the printer. Possible values are: a4, a4wide, letter, legal and
+# executive. If left blank a4wide will be used.
+
+PAPER_TYPE = a4wide
+
+# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
+# packages that should be included in the LaTeX output.
+
+EXTRA_PACKAGES =
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
+# the generated latex document. The header should contain everything until
+# the first chapter. If it is left blank doxygen will generate a
+# standard header. Notice: only use this tag if you know what you are doing!
+
+LATEX_HEADER =
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
+# is prepared for conversion to pdf (using ps2pdf). The pdf file will
+# contain links (just like the HTML output) instead of page references
+# This makes the output suitable for online browsing using a pdf viewer.
+
+PDF_HYPERLINKS = YES
+
+# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
+# plain latex in the generated Makefile. Set this option to YES to get a
+# higher quality PDF documentation.
+
+USE_PDFLATEX = YES
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
+# command to the generated LaTeX files. This will instruct LaTeX to keep
+# running if errors occur, instead of asking the user for help.
+# This option is also used when generating formulas in HTML.
+
+LATEX_BATCHMODE = NO
+
+# If LATEX_HIDE_INDICES is set to YES then doxygen will not
+# include the index chapters (such as File Index, Compound Index, etc.)
+# in the output.
+
+LATEX_HIDE_INDICES = NO
+
+# If LATEX_SOURCE_CODE is set to YES then doxygen will include source code with syntax highlighting in the LaTeX output. Note that which sources are shown also depends on other settings such as SOURCE_BROWSER.
+
+LATEX_SOURCE_CODE = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
+# The RTF output is optimized for Word 97 and may not look very pretty with
+# other RTF readers or editors.
+
+GENERATE_RTF = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `rtf' will be used as the default path.
+
+RTF_OUTPUT = rtf
+
+# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
+# RTF documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_RTF = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
+# will contain hyperlink fields. The RTF file will
+# contain links (just like the HTML output) instead of page references.
+# This makes the output suitable for online browsing using WORD or other
+# programs which support those fields.
+# Note: wordpad (write) and others do not support links.
+
+RTF_HYPERLINKS = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's
+# config file, i.e. a series of assignments. You only have to provide
+# replacements, missing definitions are set to their default value.
+
+RTF_STYLESHEET_FILE =
+
+# Set optional variables used in the generation of an rtf document.
+# Syntax is similar to doxygen's config file.
+
+RTF_EXTENSIONS_FILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
+# generate man pages
+
+GENERATE_MAN = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `man' will be used as the default path.
+
+MAN_OUTPUT = man
+
+# The MAN_EXTENSION tag determines the extension that is added to
+# the generated man pages (default is the subroutine's section .3)
+
+MAN_EXTENSION = .3
+
+# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
+# then it will generate one additional man file for each entity
+# documented in the real man page(s). These additional files
+# only source the real man page, but without them the man command
+# would be unable to find the correct page. The default is NO.
+
+MAN_LINKS = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES Doxygen will
+# generate an XML file that captures the structure of
+# the code including all documentation.
+
+GENERATE_XML = YES
+
+# The XML_OUTPUT tag is used to specify where the XML pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `xml' will be used as the default path.
+
+XML_OUTPUT = xml
+
+# The XML_SCHEMA tag can be used to specify an XML schema,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_SCHEMA =
+
+# The XML_DTD tag can be used to specify an XML DTD,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_DTD =
+
+# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
+# dump the program listings (including syntax highlighting
+# and cross-referencing information) to the XML output. Note that
+# enabling this will significantly increase the size of the XML output.
+
+XML_PROGRAMLISTING = YES
+
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
+# generate an AutoGen Definitions (see autogen.sf.net) file
+# that captures the structure of the code including all
+# documentation. Note that this feature is still experimental
+# and incomplete at the moment.
+
+GENERATE_AUTOGEN_DEF = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_PERLMOD tag is set to YES Doxygen will
+# generate a Perl module file that captures the structure of
+# the code including all documentation. Note that this
+# feature is still experimental and incomplete at the
+# moment.
+
+GENERATE_PERLMOD = NO
+
+# If the PERLMOD_LATEX tag is set to YES Doxygen will generate
+# the necessary Makefile rules, Perl scripts and LaTeX code to be able
+# to generate PDF and DVI output from the Perl module output.
+
+PERLMOD_LATEX = NO
+
+# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
+# nicely formatted so it can be parsed by a human reader.
+# This is useful
+# if you want to understand what is going on.
+# On the other hand, if this
+# tag is set to NO the size of the Perl module output will be much smaller
+# and Perl will parse it just the same.
+
+PERLMOD_PRETTY = YES
+
+# The names of the make variables in the generated doxyrules.make file
+# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
+# This is useful so different doxyrules.make files included by the same
+# Makefile don't overwrite each other's variables.
+
+PERLMOD_MAKEVAR_PREFIX =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
+# evaluate all C-preprocessor directives found in the sources and include
+# files.
+
+ENABLE_PREPROCESSING = YES
+
+# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
+# names in the source code. If set to NO (the default) only conditional
+# compilation will be performed. Macro expansion can be done in a controlled
+# way by setting EXPAND_ONLY_PREDEF to YES.
+
+MACRO_EXPANSION = YES
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
+# then the macro expansion is limited to the macros specified with the
+# PREDEFINED and EXPAND_AS_DEFINED tags.
+
+EXPAND_ONLY_PREDEF = NO
+
+# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
+# in the INCLUDE_PATH (see below) will be search if a #include is found.
+
+SEARCH_INCLUDES = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that
+# contain include files that are not input files but should be processed by
+# the preprocessor.
+
+INCLUDE_PATH =
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
+# patterns (like *.h and *.hpp) to filter out the header-files in the
+# directories. If left blank, the patterns specified with FILE_PATTERNS will
+# be used.
+
+INCLUDE_FILE_PATTERNS =
+
+# The PREDEFINED tag can be used to specify one or more macro names that
+# are defined before the preprocessor is started (similar to the -D option of
+# gcc). The argument of the tag is a list of macros of the form: name
+# or name=definition (no spaces). If the definition and the = are
+# omitted =1 is assumed. To prevent a macro definition from being
+# undefined via #undef or recursively expanded use the := operator
+# instead of the = operator.
+
+PREDEFINED =
+
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
+# this tag can be used to specify a list of macro names that should be expanded.
+# The macro definition that is found in the sources will be used.
+# Use the PREDEFINED tag if you want to use a different macro definition.
+
+EXPAND_AS_DEFINED =
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
+# doxygen's preprocessor will remove all function-like macros that are alone
+# on a line, have an all uppercase name, and do not end with a semicolon. Such
+# function macros are typically used for boiler-plate code, and will confuse
+# the parser if not removed.
+
+SKIP_FUNCTION_MACROS = YES
+
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references
+#---------------------------------------------------------------------------
+
+# The TAGFILES option can be used to specify one or more tagfiles.
+# Optionally an initial location of the external documentation
+# can be added for each tagfile. The format of a tag file without
+# this location is as follows:
+#
+# TAGFILES = file1 file2 ...
+# Adding location for the tag files is done as follows:
+#
+# TAGFILES = file1=loc1 "file2 = loc2" ...
+# where "loc1" and "loc2" can be relative or absolute paths or
+# URLs. If a location is present for each tag, the installdox tool
+# does not have to be run to correct the links.
+# Note that each tag file must have a unique name
+# (where the name does NOT include the path)
+# If a tag file is not located in the directory in which doxygen
+# is run, you must also specify the path to the tagfile here.
+
+TAGFILES =
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create
+# a tag file that is based on the input files it reads.
+
+GENERATE_TAGFILE =
+
+# If the ALLEXTERNALS tag is set to YES all external classes will be listed
+# in the class index. If set to NO only the inherited external classes
+# will be listed.
+
+ALLEXTERNALS = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
+# in the modules index. If set to NO, only the current project's groups will
+# be listed.
+
+EXTERNAL_GROUPS = YES
+
+# The PERL_PATH should be the absolute path and name of the perl script
+# interpreter (i.e. the result of `which perl').
+
+PERL_PATH = /usr/bin/perl
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
+# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base
+# or super classes. Setting the tag to NO turns the diagrams off. Note that
+# this option is superseded by the HAVE_DOT option below. This is only a
+# fallback. It is recommended to install and use dot, since it yields more
+# powerful graphs.
+
+CLASS_DIAGRAMS = YES
+
+# You can define message sequence charts within doxygen comments using the \msc
+# command. Doxygen will then run the mscgen tool (see
+# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the
+# documentation. The MSCGEN_PATH tag allows you to specify the directory where
+# the mscgen tool resides. If left empty the tool is assumed to be found in the
+# default search path.
+
+MSCGEN_PATH =
+
+# If set to YES, the inheritance and collaboration graphs will hide
+# inheritance and usage relations if the target is undocumented
+# or is not a class.
+
+HIDE_UNDOC_RELATIONS = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
+# available from the path. This tool is part of Graphviz, a graph visualization
+# toolkit from AT&T and Lucent Bell Labs. The other options in this section
+# have no effect if this option is set to NO (the default)
+
+HAVE_DOT = NO
+
+# By default doxygen will write a font called FreeSans.ttf to the output
+# directory and reference it in all dot files that doxygen generates. This
+# font does not include all possible unicode characters however, so when you need
+# these (or just want a differently looking font) you can specify the font name
+# using DOT_FONTNAME. You need need to make sure dot is able to find the font,
+# which can be done by putting it in a standard location or by setting the
+# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory
+# containing the font.
+
+DOT_FONTNAME = FreeSans
+
+# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs.
+# The default size is 10pt.
+
+DOT_FONTSIZE = 10
+
+# By default doxygen will tell dot to use the output directory to look for the
+# FreeSans.ttf font (which doxygen will put there itself). If you specify a
+# different font using DOT_FONTNAME you can set the path where dot
+# can find it using this tag.
+
+DOT_FONTPATH =
+
+# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect inheritance relations. Setting this tag to YES will force the
+# the CLASS_DIAGRAMS tag to NO.
+
+CLASS_GRAPH = YES
+
+# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect implementation dependencies (inheritance, containment, and
+# class references variables) of the class with other documented classes.
+
+COLLABORATION_GRAPH = YES
+
+# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for groups, showing the direct groups dependencies
+
+GROUP_GRAPHS = YES
+
+# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
+# collaboration diagrams in a style similar to the OMG's Unified Modeling
+# Language.
+
+UML_LOOK = NO
+
+# If set to YES, the inheritance and collaboration graphs will show the
+# relations between templates and their instances.
+
+TEMPLATE_RELATIONS = NO
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
+# tags are set to YES then doxygen will generate a graph for each documented
+# file showing the direct and indirect include dependencies of the file with
+# other documented files.
+
+INCLUDE_GRAPH = YES
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
+# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
+# documented header file showing the documented files that directly or
+# indirectly include this file.
+
+INCLUDED_BY_GRAPH = YES
+
+# If the CALL_GRAPH and HAVE_DOT options are set to YES then
+# doxygen will generate a call dependency graph for every global function
+# or class method. Note that enabling this option will significantly increase
+# the time of a run. So in most cases it will be better to enable call graphs
+# for selected functions only using the \callgraph command.
+
+CALL_GRAPH = NO
+
+# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then
+# doxygen will generate a caller dependency graph for every global function
+# or class method. Note that enabling this option will significantly increase
+# the time of a run. So in most cases it will be better to enable caller
+# graphs for selected functions only using the \callergraph command.
+
+CALLER_GRAPH = NO
+
+# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
+# will graphical hierarchy of all classes instead of a textual one.
+
+GRAPHICAL_HIERARCHY = YES
+
+# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES
+# then doxygen will show the dependencies a directory has on other directories
+# in a graphical way. The dependency relations are determined by the #include
+# relations between the files in the directories.
+
+DIRECTORY_GRAPH = YES
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
+# generated by dot. Possible values are png, jpg, or gif
+# If left blank png will be used.
+
+DOT_IMAGE_FORMAT = png
+
+# The tag DOT_PATH can be used to specify the path where the dot tool can be
+# found. If left blank, it is assumed the dot tool can be found in the path.
+
+DOT_PATH =
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that
+# contain dot files that are included in the documentation (see the
+# \dotfile command).
+
+DOTFILE_DIRS =
+
+# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of
+# nodes that will be shown in the graph. If the number of nodes in a graph
+# becomes larger than this value, doxygen will truncate the graph, which is
+# visualized by representing a node as a red box. Note that doxygen if the
+# number of direct children of the root node in a graph is already larger than
+# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note
+# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
+
+DOT_GRAPH_MAX_NODES = 50
+
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
+# graphs generated by dot. A depth value of 3 means that only nodes reachable
+# from the root by following a path via at most 3 edges will be shown. Nodes
+# that lay further from the root node will be omitted. Note that setting this
+# option to 1 or 2 may greatly reduce the computation time needed for large
+# code bases. Also note that the size of a graph can be further restricted by
+# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
+
+MAX_DOT_GRAPH_DEPTH = 0
+
+# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
+# background. This is disabled by default, because dot on Windows does not
+# seem to support this out of the box. Warning: Depending on the platform used,
+# enabling this option may lead to badly anti-aliased labels on the edges of
+# a graph (i.e. they become hard to read).
+
+DOT_TRANSPARENT = NO
+
+# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
+# files in one run (i.e. multiple -o and -T options on the command line). This
+# makes dot run faster, but since only newer versions of dot (>1.8.10)
+# support this, this feature is disabled by default.
+
+DOT_MULTI_TARGETS = YES
+
+# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
+# generate a legend page explaining the meaning of the various boxes and
+# arrows in the dot generated graphs.
+
+GENERATE_LEGEND = YES
+
+# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
+# remove the intermediate dot files that are used to generate
+# the various graphs.
+
+DOT_CLEANUP = YES
diff --git a/docs/doxygen/README.doxyxml b/docs/doxygen/README.doxyxml
new file mode 100644
index 000000000..fef71e106
--- /dev/null
+++ b/docs/doxygen/README.doxyxml
@@ -0,0 +1,26 @@
+The process of updating and exporting the Doxygen document strings
+into Python consists of a few steps.
+
+1. Make sure the 'docs' component will be built, which requires
+Doxygen.
+
+2. Build the project like normal, which will run Doxygen and store the
+ XML files into $(top_builddir).
+
+3. In $(top_srcdir)/docs/doxygen, run the command:
+
+ $ python swig_doc.py \
+ $(top_builddir)/docstrings/docs/doxygen/xml \
+ $(top_srcdir)/gnuradio-core/src/lib/swig/swig_doc.i
+
+ This uses the XML output of Doxygen to to rebuild a SWIG file that
+ contains all of the current Doxygen markups.
+
+4. Rebuild the GNU Radio libraries. Since gnuradio.i is included in
+ all of the GNU Radio components, and gnuradio.i includes
+ swig_doc.i, when the libraries are rebuilt, they will now include
+ the documentation strings in Python.
+
+5. Install GNU Radio. Now, when you run help() in Python on a GNU
+ Radio block, you will get the full documentation.
+
diff --git a/docs/doxygen/doxyxml/__init__.py b/docs/doxygen/doxyxml/__init__.py
new file mode 100644
index 000000000..5cd0b3c6c
--- /dev/null
+++ b/docs/doxygen/doxyxml/__init__.py
@@ -0,0 +1,82 @@
+#
+# Copyright 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.
+#
+"""
+Python interface to contents of doxygen xml documentation.
+
+Example use:
+See the contents of the example folder for the C++ and
+doxygen-generated xml used in this example.
+
+>>> # Parse the doxygen docs.
+>>> import os
+>>> this_dir = os.path.dirname(globals()['__file__'])
+>>> xml_path = this_dir + "/example/xml/"
+>>> di = DoxyIndex(xml_path)
+
+Get a list of all top-level objects.
+
+>>> print([mem.name() for mem in di.members()])
+[u'Aadvark', u'aadvarky_enough', u'main']
+
+Get all functions.
+
+>>> print([mem.name() for mem in di.in_category(DoxyFunction)])
+[u'aadvarky_enough', u'main']
+
+Check if an object is present.
+
+>>> di.has_member(u'Aadvark')
+True
+>>> di.has_member(u'Fish')
+False
+
+Get an item by name and check its properties.
+
+>>> aad = di.get_member(u'Aadvark')
+>>> print(aad.brief_description)
+Models the mammal Aadvark.
+>>> print(aad.detailed_description)
+Sadly the model is incomplete and cannot capture all aspects of an aadvark yet.
+<BLANKLINE>
+This line is uninformative and is only to test line breaks in the comments.
+>>> [mem.name() for mem in aad.members()]
+[u'aadvarkness', u'print', u'Aadvark', u'get_aadvarkness']
+>>> aad.get_member(u'print').brief_description
+u'Outputs the vital aadvark statistics.'
+
+"""
+
+from doxyindex import DoxyIndex, DoxyFunction, DoxyParam, DoxyClass, DoxyFile, DoxyNamespace, DoxyGroup, DoxyFriend, DoxyOther
+
+def _test():
+ import os
+ this_dir = os.path.dirname(globals()['__file__'])
+ xml_path = this_dir + "/example/xml/"
+ di = DoxyIndex(xml_path)
+ # Get the Aadvark class
+ aad = di.get_member('Aadvark')
+ aad.brief_description
+ import doctest
+ return doctest.testmod()
+
+if __name__ == "__main__":
+ _test()
+
diff --git a/docs/doxygen/doxyxml/base.py b/docs/doxygen/doxyxml/base.py
new file mode 100644
index 000000000..e8f026ab9
--- /dev/null
+++ b/docs/doxygen/doxyxml/base.py
@@ -0,0 +1,219 @@
+#
+# Copyright 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.
+#
+"""
+A base class is created.
+
+Classes based upon this are used to make more user-friendly interfaces
+to the doxygen xml docs than the generated classes provide.
+"""
+
+import os
+import pdb
+
+from xml.parsers.expat import ExpatError
+
+from generated import compound
+
+
+class Base(object):
+
+ class Duplicate(StandardError):
+ pass
+
+ class NoSuchMember(StandardError):
+ pass
+
+ class ParsingError(StandardError):
+ pass
+
+ def __init__(self, parse_data, top=None):
+ self._parsed = False
+ self._error = False
+ self._parse_data = parse_data
+ self._members = []
+ self._dict_members = {}
+ self._in_category = {}
+ self._data = {}
+ if top is not None:
+ self._xml_path = top._xml_path
+ # Set up holder of references
+ else:
+ top = self
+ self._refs = {}
+ self._xml_path = parse_data
+ self.top = top
+
+ @classmethod
+ def from_refid(cls, refid, top=None):
+ """ Instantiate class from a refid rather than parsing object. """
+ # First check to see if its already been instantiated.
+ if top is not None and refid in top._refs:
+ return top._refs[refid]
+ # Otherwise create a new instance and set refid.
+ inst = cls(None, top=top)
+ inst.refid = refid
+ inst.add_ref(inst)
+ return inst
+
+ @classmethod
+ def from_parse_data(cls, parse_data, top=None):
+ refid = getattr(parse_data, 'refid', None)
+ if refid is not None and top is not None and refid in top._refs:
+ return top._refs[refid]
+ inst = cls(parse_data, top=top)
+ if refid is not None:
+ inst.refid = refid
+ inst.add_ref(inst)
+ return inst
+
+ def add_ref(self, obj):
+ if hasattr(obj, 'refid'):
+ self.top._refs[obj.refid] = obj
+
+ mem_classes = []
+
+ def get_cls(self, mem):
+ for cls in self.mem_classes:
+ if cls.can_parse(mem):
+ return cls
+ raise StandardError(("Did not find a class for object '%s'." \
+ % (mem.get_name())))
+
+ def convert_mem(self, mem):
+ try:
+ cls = self.get_cls(mem)
+ converted = cls.from_parse_data(mem, self.top)
+ if converted is None:
+ raise StandardError('No class matched this object.')
+ self.add_ref(converted)
+ return converted
+ except StandardError, e:
+ print e
+
+ @classmethod
+ def includes(cls, inst):
+ return isinstance(inst, cls)
+
+ @classmethod
+ def can_parse(cls, obj):
+ return False
+
+ def _parse(self):
+ self._parsed = True
+
+ def _get_dict_members(self, cat=None):
+ """
+ For given category a dictionary is returned mapping member names to
+ members of that category. For names that are duplicated the name is
+ mapped to None.
+ """
+ self.confirm_no_error()
+ if cat not in self._dict_members:
+ new_dict = {}
+ for mem in self.in_category(cat):
+ if mem.name() not in new_dict:
+ new_dict[mem.name()] = mem
+ else:
+ new_dict[mem.name()] = self.Duplicate
+ self._dict_members[cat] = new_dict
+ return self._dict_members[cat]
+
+ def in_category(self, cat):
+ self.confirm_no_error()
+ if cat is None:
+ return self._members
+ if cat not in self._in_category:
+ self._in_category[cat] = [mem for mem in self._members
+ if cat.includes(mem)]
+ return self._in_category[cat]
+
+ def get_member(self, name, cat=None):
+ self.confirm_no_error()
+ # Check if it's in a namespace or class.
+ bits = name.split('::')
+ first = bits[0]
+ rest = '::'.join(bits[1:])
+ member = self._get_dict_members(cat).get(first, self.NoSuchMember)
+ # Raise any errors that are returned.
+ if member in set([self.NoSuchMember, self.Duplicate]):
+ raise member()
+ if rest:
+ return member.get_member(rest, cat=cat)
+ return member
+
+ def has_member(self, name, cat=None):
+ try:
+ mem = self.get_member(name, cat=cat)
+ return True
+ except self.NoSuchMember:
+ return False
+
+ def data(self):
+ self.confirm_no_error()
+ return self._data
+
+ def members(self):
+ self.confirm_no_error()
+ return self._members
+
+ def process_memberdefs(self):
+ mdtss = []
+ for sec in self._retrieved_data.compounddef.sectiondef:
+ mdtss += sec.memberdef
+ # At the moment we lose all information associated with sections.
+ # Sometimes a memberdef is in several sectiondef.
+ # We make sure we don't get duplicates here.
+ uniques = set([])
+ for mem in mdtss:
+ converted = self.convert_mem(mem)
+ pair = (mem.name, mem.__class__)
+ if pair not in uniques:
+ uniques.add(pair)
+ self._members.append(converted)
+
+ def retrieve_data(self):
+ filename = os.path.join(self._xml_path, self.refid + '.xml')
+ try:
+ self._retrieved_data = compound.parse(filename)
+ except ExpatError:
+ print('Error in xml in file %s' % filename)
+ self._error = True
+ self._retrieved_data = None
+
+ def check_parsed(self):
+ if not self._parsed:
+ self._parse()
+
+ def confirm_no_error(self):
+ self.check_parsed()
+ if self._error:
+ raise self.ParsingError()
+
+ def error(self):
+ self.check_parsed()
+ return self._error
+
+ def name(self):
+ # first see if we can do it without processing.
+ if self._parse_data is not None:
+ return self._parse_data.name
+ self.check_parsed()
+ return self._retrieved_data.compounddef.name
diff --git a/docs/doxygen/doxyxml/doxyindex.py b/docs/doxygen/doxyxml/doxyindex.py
new file mode 100644
index 000000000..8c5502a61
--- /dev/null
+++ b/docs/doxygen/doxyxml/doxyindex.py
@@ -0,0 +1,289 @@
+#
+# Copyright 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.
+#
+"""
+Classes providing more user-friendly interfaces to the doxygen xml
+docs than the generated classes provide.
+"""
+
+import os
+
+from generated import index
+from base import Base
+from text import description
+
+class DoxyIndex(Base):
+ """
+ Parses a doxygen xml directory.
+ """
+
+ __module__ = "gnuradio.utils.doxyxml"
+
+ def _parse(self):
+ if self._parsed:
+ return
+ super(DoxyIndex, self)._parse()
+ self._root = index.parse(os.path.join(self._xml_path, 'index.xml'))
+ for mem in self._root.compound:
+ converted = self.convert_mem(mem)
+ # For files we want the contents to be accessible directly
+ # from the parent rather than having to go through the file
+ # object.
+ if self.get_cls(mem) == DoxyFile:
+ if mem.name.endswith('.h'):
+ self._members += converted.members()
+ self._members.append(converted)
+ else:
+ self._members.append(converted)
+
+
+def generate_swig_doc_i(self):
+ """
+ %feature("docstring") gr_make_align_on_samplenumbers_ss::align_state "
+ Wraps the C++: gr_align_on_samplenumbers_ss::align_state";
+ """
+ pass
+
+
+class DoxyCompMem(Base):
+
+
+ kind = None
+
+ def __init__(self, *args, **kwargs):
+ super(DoxyCompMem, self).__init__(*args, **kwargs)
+
+ @classmethod
+ def can_parse(cls, obj):
+ return obj.kind == cls.kind
+
+ def set_descriptions(self, parse_data):
+ bd = description(getattr(parse_data, 'briefdescription', None))
+ dd = description(getattr(parse_data, 'detaileddescription', None))
+ self._data['brief_description'] = bd
+ self._data['detailed_description'] = dd
+
+ def set_parameters(self, data):
+ vs = [ddc.value for ddc in data.detaileddescription.content_]
+ pls = []
+ for v in vs:
+ if hasattr(v, 'parameterlist'):
+ pls += v.parameterlist
+ pis = []
+ for pl in pls:
+ pis += pl.parameteritem
+ dpis = []
+ for pi in pis:
+ dpi = DoxyParameterItem(pi)
+ dpi._parse()
+ dpis.append(dpi)
+ self._data['params'] = dpis
+
+
+class DoxyCompound(DoxyCompMem):
+ pass
+
+class DoxyMember(DoxyCompMem):
+ pass
+
+class DoxyFunction(DoxyMember):
+
+ __module__ = "gnuradio.utils.doxyxml"
+
+ kind = 'function'
+
+ def _parse(self):
+ if self._parsed:
+ return
+ super(DoxyFunction, self)._parse()
+ self.set_descriptions(self._parse_data)
+ self.set_parameters(self._parse_data)
+ if not self._data['params']:
+ # If the params weren't set by a comment then just grab the names.
+ self._data['params'] = []
+ prms = self._parse_data.param
+ for prm in prms:
+ self._data['params'].append(DoxyParam(prm))
+
+ brief_description = property(lambda self: self.data()['brief_description'])
+ detailed_description = property(lambda self: self.data()['detailed_description'])
+ params = property(lambda self: self.data()['params'])
+
+Base.mem_classes.append(DoxyFunction)
+
+
+class DoxyParam(DoxyMember):
+
+ __module__ = "gnuradio.utils.doxyxml"
+
+ def _parse(self):
+ if self._parsed:
+ return
+ super(DoxyParam, self)._parse()
+ self.set_descriptions(self._parse_data)
+ self._data['declname'] = self._parse_data.declname
+
+ @property
+ def description(self):
+ descriptions = []
+ if self.brief_description:
+ descriptions.append(self.brief_description)
+ if self.detailed_description:
+ descriptions.append(self.detailed_description)
+ return '\n\n'.join(descriptions)
+
+ brief_description = property(lambda self: self.data()['brief_description'])
+ detailed_description = property(lambda self: self.data()['detailed_description'])
+ name = property(lambda self: self.data()['declname'])
+
+class DoxyParameterItem(DoxyMember):
+ """A different representation of a parameter in Doxygen."""
+
+ def _parse(self):
+ if self._parsed:
+ return
+ super(DoxyParameterItem, self)._parse()
+ names = []
+ for nl in self._parse_data.parameternamelist:
+ for pn in nl.parametername:
+ names.append(description(pn))
+ # Just take first name
+ self._data['name'] = names[0]
+ # Get description
+ pd = description(self._parse_data.get_parameterdescription())
+ self._data['description'] = pd
+
+ description = property(lambda self: self.data()['description'])
+ name = property(lambda self: self.data()['name'])
+
+
+class DoxyClass(DoxyCompound):
+
+ __module__ = "gnuradio.utils.doxyxml"
+
+ kind = 'class'
+
+ def _parse(self):
+ if self._parsed:
+ return
+ super(DoxyClass, self)._parse()
+ self.retrieve_data()
+ if self._error:
+ return
+ self.set_descriptions(self._retrieved_data.compounddef)
+ self.set_parameters(self._retrieved_data.compounddef)
+ # Sectiondef.kind tells about whether private or public.
+ # We just ignore this for now.
+ self.process_memberdefs()
+
+ brief_description = property(lambda self: self.data()['brief_description'])
+ detailed_description = property(lambda self: self.data()['detailed_description'])
+ params = property(lambda self: self.data()['params'])
+
+Base.mem_classes.append(DoxyClass)
+
+
+class DoxyFile(DoxyCompound):
+
+ __module__ = "gnuradio.utils.doxyxml"
+
+ kind = 'file'
+
+ def _parse(self):
+ if self._parsed:
+ return
+ super(DoxyFile, self)._parse()
+ self.retrieve_data()
+ self.set_descriptions(self._retrieved_data.compounddef)
+ if self._error:
+ return
+ self.process_memberdefs()
+
+ brief_description = property(lambda self: self.data()['brief_description'])
+ detailed_description = property(lambda self: self.data()['detailed_description'])
+
+Base.mem_classes.append(DoxyFile)
+
+
+class DoxyNamespace(DoxyCompound):
+
+ __module__ = "gnuradio.utils.doxyxml"
+
+ kind = 'namespace'
+
+Base.mem_classes.append(DoxyNamespace)
+
+
+class DoxyGroup(DoxyCompound):
+
+ __module__ = "gnuradio.utils.doxyxml"
+
+ kind = 'group'
+
+ def _parse(self):
+ if self._parsed:
+ return
+ super(DoxyGroup, self)._parse()
+ self.retrieve_data()
+ if self._error:
+ return
+ cdef = self._retrieved_data.compounddef
+ self._data['title'] = description(cdef.title)
+ # Process inner groups
+ grps = cdef.innergroup
+ for grp in grps:
+ converted = DoxyGroup.from_refid(grp.refid, top=self.top)
+ self._members.append(converted)
+ # Process inner classes
+ klasses = cdef.innerclass
+ for kls in klasses:
+ converted = DoxyClass.from_refid(kls.refid, top=self.top)
+ self._members.append(converted)
+ # Process normal members
+ self.process_memberdefs()
+
+ title = property(lambda self: self.data()['title'])
+
+
+Base.mem_classes.append(DoxyGroup)
+
+
+class DoxyFriend(DoxyMember):
+
+ __module__ = "gnuradio.utils.doxyxml"
+
+ kind = 'friend'
+
+Base.mem_classes.append(DoxyFriend)
+
+
+class DoxyOther(Base):
+
+ __module__ = "gnuradio.utils.doxyxml"
+
+ kinds = set(['variable', 'struct', 'union', 'define', 'typedef', 'enum',
+ 'dir', 'page', 'signal', 'slot', 'property'])
+
+ @classmethod
+ def can_parse(cls, obj):
+ return obj.kind in cls.kinds
+
+Base.mem_classes.append(DoxyOther)
+
diff --git a/docs/doxygen/doxyxml/example/Doxyfile b/docs/doxygen/doxyxml/example/Doxyfile
new file mode 100644
index 000000000..dd2e5c77e
--- /dev/null
+++ b/docs/doxygen/doxyxml/example/Doxyfile
@@ -0,0 +1,1534 @@
+# Doxyfile 1.6.3
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project
+#
+# All text after a hash (#) is considered a comment and will be ignored
+# The format is:
+# TAG = value [value, ...]
+# For lists items can also be appended using:
+# TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (" ")
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+# This tag specifies the encoding used for all characters in the config file
+# that follow. The default is UTF-8 which is also the encoding used for all
+# text before the first occurrence of this tag. Doxygen uses libiconv (or the
+# iconv built into libc) for the transcoding. See
+# http://www.gnu.org/software/libiconv for the list of possible encodings.
+
+DOXYFILE_ENCODING = UTF-8
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
+# by quotes) that should identify the project.
+
+PROJECT_NAME =
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number.
+# This could be handy for archiving the generated documentation or
+# if some version control system is used.
+
+PROJECT_NUMBER =
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
+# base path where the generated documentation will be put.
+# If a relative path is entered, it will be relative to the location
+# where doxygen was started. If left blank the current directory will be used.
+
+OUTPUT_DIRECTORY =
+
+# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
+# 4096 sub-directories (in 2 levels) under the output directory of each output
+# format and will distribute the generated files over these directories.
+# Enabling this option can be useful when feeding doxygen a huge amount of
+# source files, where putting all generated files in the same directory would
+# otherwise cause performance problems for the file system.
+
+CREATE_SUBDIRS = NO
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all
+# documentation generated by doxygen is written. Doxygen will use this
+# information to generate all constant output in the proper language.
+# The default language is English, other supported languages are:
+# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional,
+# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German,
+# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English
+# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian,
+# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak,
+# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese.
+
+OUTPUT_LANGUAGE = English
+
+# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
+# include brief member descriptions after the members that are listed in
+# the file and class documentation (similar to JavaDoc).
+# Set to NO to disable this.
+
+BRIEF_MEMBER_DESC = YES
+
+# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
+# the brief description of a member or function before the detailed description.
+# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
+# brief descriptions will be completely suppressed.
+
+REPEAT_BRIEF = YES
+
+# This tag implements a quasi-intelligent brief description abbreviator
+# that is used to form the text in various listings. Each string
+# in this list, if found as the leading text of the brief description, will be
+# stripped from the text and the result after processing the whole list, is
+# used as the annotated text. Otherwise, the brief description is used as-is.
+# If left blank, the following values are used ("$name" is automatically
+# replaced with the name of the entity): "The $name class" "The $name widget"
+# "The $name file" "is" "provides" "specifies" "contains"
+# "represents" "a" "an" "the"
+
+ABBREVIATE_BRIEF =
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
+# Doxygen will generate a detailed section even if there is only a brief
+# description.
+
+ALWAYS_DETAILED_SEC = NO
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
+# inherited members of a class in the documentation of that class as if those
+# members were ordinary class members. Constructors, destructors and assignment
+# operators of the base classes will not be shown.
+
+INLINE_INHERITED_MEMB = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
+# path before files name in the file list and in the header files. If set
+# to NO the shortest path that makes the file name unique will be used.
+
+FULL_PATH_NAMES = YES
+
+# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
+# can be used to strip a user-defined part of the path. Stripping is
+# only done if one of the specified strings matches the left-hand part of
+# the path. The tag can be used to show relative paths in the file list.
+# If left blank the directory from which doxygen is run is used as the
+# path to strip.
+
+STRIP_FROM_PATH =
+
+# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
+# the path mentioned in the documentation of a class, which tells
+# the reader which header file to include in order to use a class.
+# If left blank only the name of the header file containing the class
+# definition is used. Otherwise one should specify the include paths that
+# are normally passed to the compiler using the -I flag.
+
+STRIP_FROM_INC_PATH =
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
+# (but less readable) file names. This can be useful is your file systems
+# doesn't support long names like on DOS, Mac, or CD-ROM.
+
+SHORT_NAMES = NO
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
+# will interpret the first line (until the first dot) of a JavaDoc-style
+# comment as the brief description. If set to NO, the JavaDoc
+# comments will behave just like regular Qt-style comments
+# (thus requiring an explicit @brief command for a brief description.)
+
+JAVADOC_AUTOBRIEF = NO
+
+# If the QT_AUTOBRIEF tag is set to YES then Doxygen will
+# interpret the first line (until the first dot) of a Qt-style
+# comment as the brief description. If set to NO, the comments
+# will behave just like regular Qt-style comments (thus requiring
+# an explicit \brief command for a brief description.)
+
+QT_AUTOBRIEF = NO
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
+# treat a multi-line C++ special comment block (i.e. a block of //! or ///
+# comments) as a brief description. This used to be the default behaviour.
+# The new default is to treat a multi-line C++ comment block as a detailed
+# description. Set this tag to YES if you prefer the old behaviour instead.
+
+MULTILINE_CPP_IS_BRIEF = NO
+
+# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
+# member inherits the documentation from any documented member that it
+# re-implements.
+
+INHERIT_DOCS = YES
+
+# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce
+# a new page for each member. If set to NO, the documentation of a member will
+# be part of the file/class/namespace that contains it.
+
+SEPARATE_MEMBER_PAGES = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab.
+# Doxygen uses this value to replace tabs by spaces in code fragments.
+
+TAB_SIZE = 8
+
+# This tag can be used to specify a number of aliases that acts
+# as commands in the documentation. An alias has the form "name=value".
+# For example adding "sideeffect=\par Side Effects:\n" will allow you to
+# put the command \sideeffect (or @sideeffect) in the documentation, which
+# will result in a user-defined paragraph with heading "Side Effects:".
+# You can put \n's in the value part of an alias to insert newlines.
+
+ALIASES =
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
+# sources only. Doxygen will then generate output that is more tailored for C.
+# For instance, some of the names that are used will be different. The list
+# of all members will be omitted, etc.
+
+OPTIMIZE_OUTPUT_FOR_C = NO
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java
+# sources only. Doxygen will then generate output that is more tailored for
+# Java. For instance, namespaces will be presented as packages, qualified
+# scopes will look different, etc.
+
+OPTIMIZE_OUTPUT_JAVA = NO
+
+# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
+# sources only. Doxygen will then generate output that is more tailored for
+# Fortran.
+
+OPTIMIZE_FOR_FORTRAN = NO
+
+# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
+# sources. Doxygen will then generate output that is tailored for
+# VHDL.
+
+OPTIMIZE_OUTPUT_VHDL = NO
+
+# Doxygen selects the parser to use depending on the extension of the files it parses.
+# With this tag you can assign which parser to use for a given extension.
+# Doxygen has a built-in mapping, but you can override or extend it using this tag.
+# The format is ext=language, where ext is a file extension, and language is one of
+# the parsers supported by doxygen: IDL, Java, Javascript, C#, C, C++, D, PHP,
+# Objective-C, Python, Fortran, VHDL, C, C++. For instance to make doxygen treat
+# .inc files as Fortran files (default is PHP), and .f files as C (default is Fortran),
+# use: inc=Fortran f=C. Note that for custom extensions you also need to set FILE_PATTERNS otherwise the files are not read by doxygen.
+
+EXTENSION_MAPPING =
+
+# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
+# to include (a tag file for) the STL sources as input, then you should
+# set this tag to YES in order to let doxygen match functions declarations and
+# definitions whose arguments contain STL classes (e.g. func(std::string); v.s.
+# func(std::string) {}). This also make the inheritance and collaboration
+# diagrams that involve STL classes more complete and accurate.
+
+BUILTIN_STL_SUPPORT = NO
+
+# If you use Microsoft's C++/CLI language, you should set this option to YES to
+# enable parsing support.
+
+CPP_CLI_SUPPORT = NO
+
+# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only.
+# Doxygen will parse them like normal C++ but will assume all classes use public
+# instead of private inheritance when no explicit protection keyword is present.
+
+SIP_SUPPORT = NO
+
+# For Microsoft's IDL there are propget and propput attributes to indicate getter
+# and setter methods for a property. Setting this option to YES (the default)
+# will make doxygen to replace the get and set methods by a property in the
+# documentation. This will only work if the methods are indeed getting or
+# setting a simple type. If this is not the case, or you want to show the
+# methods anyway, you should set this option to NO.
+
+IDL_PROPERTY_SUPPORT = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
+# tag is set to YES, then doxygen will reuse the documentation of the first
+# member in the group (if any) for the other members of the group. By default
+# all members of a group must be documented explicitly.
+
+DISTRIBUTE_GROUP_DOC = NO
+
+# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
+# the same type (for instance a group of public functions) to be put as a
+# subgroup of that type (e.g. under the Public Functions section). Set it to
+# NO to prevent subgrouping. Alternatively, this can be done per class using
+# the \nosubgrouping command.
+
+SUBGROUPING = YES
+
+# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum
+# is documented as struct, union, or enum with the name of the typedef. So
+# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
+# with name TypeT. When disabled the typedef will appear as a member of a file,
+# namespace, or class. And the struct will be named TypeS. This can typically
+# be useful for C code in case the coding convention dictates that all compound
+# types are typedef'ed and only the typedef is referenced, never the tag name.
+
+TYPEDEF_HIDES_STRUCT = NO
+
+# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to
+# determine which symbols to keep in memory and which to flush to disk.
+# When the cache is full, less often used symbols will be written to disk.
+# For small to medium size projects (<1000 input files) the default value is
+# probably good enough. For larger projects a too small cache size can cause
+# doxygen to be busy swapping symbols to and from disk most of the time
+# causing a significant performance penality.
+# If the system has enough physical memory increasing the cache will improve the
+# performance by keeping more symbols in memory. Note that the value works on
+# a logarithmic scale so increasing the size by one will rougly double the
+# memory usage. The cache size is given by this formula:
+# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0,
+# corresponding to a cache size of 2^16 = 65536 symbols
+
+SYMBOL_CACHE_SIZE = 0
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
+# documentation are documented, even if no documentation was available.
+# Private class members and static file members will be hidden unless
+# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
+
+EXTRACT_ALL = NO
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
+# will be included in the documentation.
+
+EXTRACT_PRIVATE = NO
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file
+# will be included in the documentation.
+
+EXTRACT_STATIC = NO
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
+# defined locally in source files will be included in the documentation.
+# If set to NO only classes defined in header files are included.
+
+EXTRACT_LOCAL_CLASSES = YES
+
+# This flag is only useful for Objective-C code. When set to YES local
+# methods, which are defined in the implementation section but not in
+# the interface are included in the documentation.
+# If set to NO (the default) only methods in the interface are included.
+
+EXTRACT_LOCAL_METHODS = NO
+
+# If this flag is set to YES, the members of anonymous namespaces will be
+# extracted and appear in the documentation as a namespace called
+# 'anonymous_namespace{file}', where file will be replaced with the base
+# name of the file that contains the anonymous namespace. By default
+# anonymous namespace are hidden.
+
+EXTRACT_ANON_NSPACES = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
+# undocumented members of documented classes, files or namespaces.
+# If set to NO (the default) these members will be included in the
+# various overviews, but no documentation section is generated.
+# This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_MEMBERS = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
+# undocumented classes that are normally visible in the class hierarchy.
+# If set to NO (the default) these classes will be included in the various
+# overviews. This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_CLASSES = NO
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
+# friend (class|struct|union) declarations.
+# If set to NO (the default) these declarations will be included in the
+# documentation.
+
+HIDE_FRIEND_COMPOUNDS = NO
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
+# documentation blocks found inside the body of a function.
+# If set to NO (the default) these blocks will be appended to the
+# function's detailed documentation block.
+
+HIDE_IN_BODY_DOCS = NO
+
+# The INTERNAL_DOCS tag determines if documentation
+# that is typed after a \internal command is included. If the tag is set
+# to NO (the default) then the documentation will be excluded.
+# Set it to YES to include the internal documentation.
+
+INTERNAL_DOCS = NO
+
+# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
+# file names in lower-case letters. If set to YES upper-case letters are also
+# allowed. This is useful if you have classes or files whose names only differ
+# in case and if your file system supports case sensitive file names. Windows
+# and Mac users are advised to set this option to NO.
+
+CASE_SENSE_NAMES = YES
+
+# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
+# will show members with their full class and namespace scopes in the
+# documentation. If set to YES the scope will be hidden.
+
+HIDE_SCOPE_NAMES = NO
+
+# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
+# will put a list of the files that are included by a file in the documentation
+# of that file.
+
+SHOW_INCLUDE_FILES = YES
+
+# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen
+# will list include files with double quotes in the documentation
+# rather than with sharp brackets.
+
+FORCE_LOCAL_INCLUDES = NO
+
+# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
+# is inserted in the documentation for inline members.
+
+INLINE_INFO = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
+# will sort the (detailed) documentation of file and class members
+# alphabetically by member name. If set to NO the members will appear in
+# declaration order.
+
+SORT_MEMBER_DOCS = YES
+
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
+# brief documentation of file, namespace and class members alphabetically
+# by member name. If set to NO (the default) the members will appear in
+# declaration order.
+
+SORT_BRIEF_DOCS = NO
+
+# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the (brief and detailed) documentation of class members so that constructors and destructors are listed first. If set to NO (the default) the constructors will appear in the respective orders defined by SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO.
+
+SORT_MEMBERS_CTORS_1ST = NO
+
+# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the
+# hierarchy of group names into alphabetical order. If set to NO (the default)
+# the group names will appear in their defined order.
+
+SORT_GROUP_NAMES = NO
+
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
+# sorted by fully-qualified names, including namespaces. If set to
+# NO (the default), the class list will be sorted only by class name,
+# not including the namespace part.
+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
+# Note: This option applies only to the class list, not to the
+# alphabetical list.
+
+SORT_BY_SCOPE_NAME = NO
+
+# The GENERATE_TODOLIST tag can be used to enable (YES) or
+# disable (NO) the todo list. This list is created by putting \todo
+# commands in the documentation.
+
+GENERATE_TODOLIST = YES
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or
+# disable (NO) the test list. This list is created by putting \test
+# commands in the documentation.
+
+GENERATE_TESTLIST = YES
+
+# The GENERATE_BUGLIST tag can be used to enable (YES) or
+# disable (NO) the bug list. This list is created by putting \bug
+# commands in the documentation.
+
+GENERATE_BUGLIST = YES
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
+# disable (NO) the deprecated list. This list is created by putting
+# \deprecated commands in the documentation.
+
+GENERATE_DEPRECATEDLIST= YES
+
+# The ENABLED_SECTIONS tag can be used to enable conditional
+# documentation sections, marked by \if sectionname ... \endif.
+
+ENABLED_SECTIONS =
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
+# the initial value of a variable or define consists of for it to appear in
+# the documentation. If the initializer consists of more lines than specified
+# here it will be hidden. Use a value of 0 to hide initializers completely.
+# The appearance of the initializer of individual variables and defines in the
+# documentation can be controlled using \showinitializer or \hideinitializer
+# command in the documentation regardless of this setting.
+
+MAX_INITIALIZER_LINES = 30
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
+# at the bottom of the documentation of classes and structs. If set to YES the
+# list will mention the files that were used to generate the documentation.
+
+SHOW_USED_FILES = YES
+
+# Set the SHOW_FILES tag to NO to disable the generation of the Files page.
+# This will remove the Files entry from the Quick Index and from the
+# Folder Tree View (if specified). The default is YES.
+
+SHOW_FILES = YES
+
+# Set the SHOW_NAMESPACES tag to NO to disable the generation of the
+# Namespaces page.
+# This will remove the Namespaces entry from the Quick Index
+# and from the Folder Tree View (if specified). The default is YES.
+
+SHOW_NAMESPACES = YES
+
+# The FILE_VERSION_FILTER tag can be used to specify a program or script that
+# doxygen should invoke to get the current version for each file (typically from
+# the version control system). Doxygen will invoke the program by executing (via
+# popen()) the command <command> <input-file>, where <command> is the value of
+# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file
+# provided by doxygen. Whatever the program writes to standard output
+# is used as the file version. See the manual for examples.
+
+FILE_VERSION_FILTER =
+
+# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed by
+# doxygen. The layout file controls the global structure of the generated output files
+# in an output format independent way. The create the layout file that represents
+# doxygen's defaults, run doxygen with the -l option. You can optionally specify a
+# file name after the option, if omitted DoxygenLayout.xml will be used as the name
+# of the layout file.
+
+LAYOUT_FILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated
+# by doxygen. Possible values are YES and NO. If left blank NO is used.
+
+QUIET = NO
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are
+# generated by doxygen. Possible values are YES and NO. If left blank
+# NO is used.
+
+WARNINGS = YES
+
+# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
+# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
+# automatically be disabled.
+
+WARN_IF_UNDOCUMENTED = YES
+
+# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
+# potential errors in the documentation, such as not documenting some
+# parameters in a documented function, or documenting parameters that
+# don't exist or using markup commands wrongly.
+
+WARN_IF_DOC_ERROR = YES
+
+# This WARN_NO_PARAMDOC option can be abled to get warnings for
+# functions that are documented, but have no documentation for their parameters
+# or return value. If set to NO (the default) doxygen will only warn about
+# wrong or incomplete parameter documentation, but not about the absence of
+# documentation.
+
+WARN_NO_PARAMDOC = NO
+
+# The WARN_FORMAT tag determines the format of the warning messages that
+# doxygen can produce. The string should contain the $file, $line, and $text
+# tags, which will be replaced by the file and line number from which the
+# warning originated and the warning text. Optionally the format may contain
+# $version, which will be replaced by the version of the file (if it could
+# be obtained via FILE_VERSION_FILTER)
+
+WARN_FORMAT = "$file:$line: $text"
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning
+# and error messages should be written. If left blank the output is written
+# to stderr.
+
+WARN_LOGFILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag can be used to specify the files and/or directories that contain
+# documented source files. You may enter file names like "myfile.cpp" or
+# directories like "/usr/src/myproject". Separate the files or directories
+# with spaces.
+
+INPUT =
+
+# This tag can be used to specify the character encoding of the source files
+# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
+# also the default input encoding. Doxygen uses libiconv (or the iconv built
+# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for
+# the list of possible encodings.
+
+INPUT_ENCODING = UTF-8
+
+# If the value of the INPUT tag contains directories, you can use the
+# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank the following patterns are tested:
+# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx
+# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90
+
+FILE_PATTERNS =
+
+# The RECURSIVE tag can be used to turn specify whether or not subdirectories
+# should be searched for input files as well. Possible values are YES and NO.
+# If left blank NO is used.
+
+RECURSIVE = NO
+
+# The EXCLUDE tag can be used to specify files and/or directories that should
+# excluded from the INPUT source files. This way you can easily exclude a
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+
+EXCLUDE =
+
+# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
+# directories that are symbolic links (a Unix filesystem feature) are excluded
+# from the input.
+
+EXCLUDE_SYMLINKS = NO
+
+# If the value of the INPUT tag contains directories, you can use the
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
+# certain files from those directories. Note that the wildcards are matched
+# against the file with absolute path, so to exclude all test directories
+# for example use the pattern */test/*
+
+EXCLUDE_PATTERNS =
+
+# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
+# (namespaces, classes, functions, etc.) that should be excluded from the
+# output. The symbol name can be a fully qualified name, a word, or if the
+# wildcard * is used, a substring. Examples: ANamespace, AClass,
+# AClass::ANamespace, ANamespace::*Test
+
+EXCLUDE_SYMBOLS =
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or
+# directories that contain example code fragments that are included (see
+# the \include command).
+
+EXAMPLE_PATH =
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank all files are included.
+
+EXAMPLE_PATTERNS =
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
+# searched for input files to be used with the \include or \dontinclude
+# commands irrespective of the value of the RECURSIVE tag.
+# Possible values are YES and NO. If left blank NO is used.
+
+EXAMPLE_RECURSIVE = NO
+
+# The IMAGE_PATH tag can be used to specify one or more files or
+# directories that contain image that are included in the documentation (see
+# the \image command).
+
+IMAGE_PATH =
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should
+# invoke to filter for each input file. Doxygen will invoke the filter program
+# by executing (via popen()) the command <filter> <input-file>, where <filter>
+# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
+# input file. Doxygen will then use the output that the filter program writes
+# to standard output.
+# If FILTER_PATTERNS is specified, this tag will be
+# ignored.
+
+INPUT_FILTER =
+
+# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
+# basis.
+# Doxygen will compare the file name with each pattern and apply the
+# filter if there is a match.
+# The filters are a list of the form:
+# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
+# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER
+# is applied to all files.
+
+FILTER_PATTERNS =
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
+# INPUT_FILTER) will be used to filter the input files when producing source
+# files to browse (i.e. when SOURCE_BROWSER is set to YES).
+
+FILTER_SOURCE_FILES = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will
+# be generated. Documented entities will be cross-referenced with these sources.
+# Note: To get rid of all source code in the generated output, make sure also
+# VERBATIM_HEADERS is set to NO.
+
+SOURCE_BROWSER = NO
+
+# Setting the INLINE_SOURCES tag to YES will include the body
+# of functions and classes directly in the documentation.
+
+INLINE_SOURCES = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
+# doxygen to hide any special comment blocks from generated source code
+# fragments. Normal C and C++ comments will always remain visible.
+
+STRIP_CODE_COMMENTS = YES
+
+# If the REFERENCED_BY_RELATION tag is set to YES
+# then for each documented function all documented
+# functions referencing it will be listed.
+
+REFERENCED_BY_RELATION = NO
+
+# If the REFERENCES_RELATION tag is set to YES
+# then for each documented function all documented entities
+# called/used by that function will be listed.
+
+REFERENCES_RELATION = NO
+
+# If the REFERENCES_LINK_SOURCE tag is set to YES (the default)
+# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
+# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
+# link to the source code.
+# Otherwise they will link to the documentation.
+
+REFERENCES_LINK_SOURCE = YES
+
+# If the USE_HTAGS tag is set to YES then the references to source code
+# will point to the HTML generated by the htags(1) tool instead of doxygen
+# built-in source browser. The htags tool is part of GNU's global source
+# tagging system (see http://www.gnu.org/software/global/global.html). You
+# will need version 4.8.6 or higher.
+
+USE_HTAGS = NO
+
+# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
+# will generate a verbatim copy of the header file for each class for
+# which an include is specified. Set to NO to disable this.
+
+VERBATIM_HEADERS = YES
+
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
+# of all compounds will be generated. Enable this if the project
+# contains a lot of classes, structs, unions or interfaces.
+
+ALPHABETICAL_INDEX = NO
+
+# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
+# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
+# in which this list will be split (can be a number in the range [1..20])
+
+COLS_IN_ALPHA_INDEX = 5
+
+# In case all classes in a project start with a common prefix, all
+# classes will be put under the same header in the alphabetical index.
+# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
+# should be ignored while generating the index headers.
+
+IGNORE_PREFIX =
+
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
+# generate HTML output.
+
+GENERATE_HTML = YES
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `html' will be used as the default path.
+
+HTML_OUTPUT = html
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
+# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
+# doxygen will generate files with .html extension.
+
+HTML_FILE_EXTENSION = .html
+
+# The HTML_HEADER tag can be used to specify a personal HTML header for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard header.
+
+HTML_HEADER =
+
+# The HTML_FOOTER tag can be used to specify a personal HTML footer for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard footer.
+
+HTML_FOOTER =
+
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
+# style sheet that is used by each HTML page. It can be used to
+# fine-tune the look of the HTML output. If the tag is left blank doxygen
+# will generate a default style sheet. Note that doxygen will try to copy
+# the style sheet file to the HTML output directory, so don't put your own
+# stylesheet in the HTML output directory as well, or it will be erased!
+
+HTML_STYLESHEET =
+
+# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
+# page will contain the date and time when the page was generated. Setting
+# this to NO can help when comparing the output of multiple runs.
+
+HTML_TIMESTAMP = YES
+
+# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
+# documentation will contain sections that can be hidden and shown after the
+# page has loaded. For this to work a browser that supports
+# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox
+# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
+
+HTML_DYNAMIC_SECTIONS = NO
+
+# If the GENERATE_DOCSET tag is set to YES, additional index files
+# will be generated that can be used as input for Apple's Xcode 3
+# integrated development environment, introduced with OSX 10.5 (Leopard).
+# To create a documentation set, doxygen will generate a Makefile in the
+# HTML output directory. Running make will produce the docset in that
+# directory and running "make install" will install the docset in
+# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find
+# it at startup.
+# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html for more information.
+
+GENERATE_DOCSET = NO
+
+# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the
+# feed. A documentation feed provides an umbrella under which multiple
+# documentation sets from a single provider (such as a company or product suite)
+# can be grouped.
+
+DOCSET_FEEDNAME = "Doxygen generated docs"
+
+# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that
+# should uniquely identify the documentation set bundle. This should be a
+# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen
+# will append .docset to the name.
+
+DOCSET_BUNDLE_ID = org.doxygen.Project
+
+# If the GENERATE_HTMLHELP tag is set to YES, additional index files
+# will be generated that can be used as input for tools like the
+# Microsoft HTML help workshop to generate a compiled HTML help file (.chm)
+# of the generated HTML documentation.
+
+GENERATE_HTMLHELP = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
+# be used to specify the file name of the resulting .chm file. You
+# can add a path in front of the file if the result should not be
+# written to the html output directory.
+
+CHM_FILE =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
+# be used to specify the location (absolute path including file name) of
+# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
+# the HTML help compiler on the generated index.hhp.
+
+HHC_LOCATION =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
+# controls if a separate .chi index file is generated (YES) or that
+# it should be included in the master .chm file (NO).
+
+GENERATE_CHI = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING
+# is used to encode HtmlHelp index (hhk), content (hhc) and project file
+# content.
+
+CHM_INDEX_ENCODING =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
+# controls whether a binary table of contents is generated (YES) or a
+# normal table of contents (NO) in the .chm file.
+
+BINARY_TOC = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members
+# to the contents of the HTML help documentation and to the tree view.
+
+TOC_EXPAND = NO
+
+# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and QHP_VIRTUAL_FOLDER
+# are set, an additional index file will be generated that can be used as input for
+# Qt's qhelpgenerator to generate a Qt Compressed Help (.qch) of the generated
+# HTML documentation.
+
+GENERATE_QHP = NO
+
+# If the QHG_LOCATION tag is specified, the QCH_FILE tag can
+# be used to specify the file name of the resulting .qch file.
+# The path specified is relative to the HTML output folder.
+
+QCH_FILE =
+
+# The QHP_NAMESPACE tag specifies the namespace to use when generating
+# Qt Help Project output. For more information please see
+# http://doc.trolltech.com/qthelpproject.html#namespace
+
+QHP_NAMESPACE = org.doxygen.Project
+
+# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating
+# Qt Help Project output. For more information please see
+# http://doc.trolltech.com/qthelpproject.html#virtual-folders
+
+QHP_VIRTUAL_FOLDER = doc
+
+# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to add.
+# For more information please see
+# http://doc.trolltech.com/qthelpproject.html#custom-filters
+
+QHP_CUST_FILTER_NAME =
+
+# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the custom filter to add.For more information please see
+# <a href="http://doc.trolltech.com/qthelpproject.html#custom-filters">Qt Help Project / Custom Filters</a>.
+
+QHP_CUST_FILTER_ATTRS =
+
+# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this project's
+# filter section matches.
+# <a href="http://doc.trolltech.com/qthelpproject.html#filter-attributes">Qt Help Project / Filter Attributes</a>.
+
+QHP_SECT_FILTER_ATTRS =
+
+# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can
+# be used to specify the location of Qt's qhelpgenerator.
+# If non-empty doxygen will try to run qhelpgenerator on the generated
+# .qhp file.
+
+QHG_LOCATION =
+
+# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files
+# will be generated, which together with the HTML files, form an Eclipse help
+# plugin. To install this plugin and make it available under the help contents
+# menu in Eclipse, the contents of the directory containing the HTML and XML
+# files needs to be copied into the plugins directory of eclipse. The name of
+# the directory within the plugins directory should be the same as
+# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before the help appears.
+
+GENERATE_ECLIPSEHELP = NO
+
+# A unique identifier for the eclipse help plugin. When installing the plugin
+# the directory name containing the HTML and XML files should also have
+# this name.
+
+ECLIPSE_DOC_ID = org.doxygen.Project
+
+# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
+# top of each HTML page. The value NO (the default) enables the index and
+# the value YES disables it.
+
+DISABLE_INDEX = NO
+
+# This tag can be used to set the number of enum values (range [1..20])
+# that doxygen will group on one line in the generated HTML documentation.
+
+ENUM_VALUES_PER_LINE = 4
+
+# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
+# structure should be generated to display hierarchical information.
+# If the tag value is set to YES, a side panel will be generated
+# containing a tree-like index structure (just like the one that
+# is generated for HTML Help). For this to work a browser that supports
+# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser).
+# Windows users are probably better off using the HTML help feature.
+
+GENERATE_TREEVIEW = NO
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
+# used to set the initial width (in pixels) of the frame in which the tree
+# is shown.
+
+TREEVIEW_WIDTH = 250
+
+# Use this tag to change the font size of Latex formulas included
+# as images in the HTML documentation. The default is 10. Note that
+# when you change the font size after a successful doxygen run you need
+# to manually remove any form_*.png images from the HTML output directory
+# to force them to be regenerated.
+
+FORMULA_FONTSIZE = 10
+
+# When the SEARCHENGINE tag is enabled doxygen will generate a search box for the HTML output. The underlying search engine uses javascript
+# and DHTML and should work on any modern browser. Note that when using HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) there is already a search function so this one should
+# typically be disabled. For large projects the javascript based search engine
+# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution.
+
+SEARCHENGINE = YES
+
+# When the SERVER_BASED_SEARCH tag is enabled the search engine will be implemented using a PHP enabled web server instead of at the web client using Javascript. Doxygen will generate the search PHP script and index
+# file to put on the web server. The advantage of the server based approach is that it scales better to large projects and allows full text search. The disadvances is that it is more difficult to setup
+# and does not have live searching capabilities.
+
+SERVER_BASED_SEARCH = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
+# generate Latex output.
+
+GENERATE_LATEX = YES
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `latex' will be used as the default path.
+
+LATEX_OUTPUT = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
+# invoked. If left blank `latex' will be used as the default command name.
+# Note that when enabling USE_PDFLATEX this option is only used for
+# generating bitmaps for formulas in the HTML output, but not in the
+# Makefile that is written to the output directory.
+
+LATEX_CMD_NAME = latex
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
+# generate index for LaTeX. If left blank `makeindex' will be used as the
+# default command name.
+
+MAKEINDEX_CMD_NAME = makeindex
+
+# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
+# LaTeX documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_LATEX = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used
+# by the printer. Possible values are: a4, a4wide, letter, legal and
+# executive. If left blank a4wide will be used.
+
+PAPER_TYPE = a4wide
+
+# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
+# packages that should be included in the LaTeX output.
+
+EXTRA_PACKAGES =
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
+# the generated latex document. The header should contain everything until
+# the first chapter. If it is left blank doxygen will generate a
+# standard header. Notice: only use this tag if you know what you are doing!
+
+LATEX_HEADER =
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
+# is prepared for conversion to pdf (using ps2pdf). The pdf file will
+# contain links (just like the HTML output) instead of page references
+# This makes the output suitable for online browsing using a pdf viewer.
+
+PDF_HYPERLINKS = YES
+
+# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
+# plain latex in the generated Makefile. Set this option to YES to get a
+# higher quality PDF documentation.
+
+USE_PDFLATEX = YES
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
+# command to the generated LaTeX files. This will instruct LaTeX to keep
+# running if errors occur, instead of asking the user for help.
+# This option is also used when generating formulas in HTML.
+
+LATEX_BATCHMODE = NO
+
+# If LATEX_HIDE_INDICES is set to YES then doxygen will not
+# include the index chapters (such as File Index, Compound Index, etc.)
+# in the output.
+
+LATEX_HIDE_INDICES = NO
+
+# If LATEX_SOURCE_CODE is set to YES then doxygen will include source code with syntax highlighting in the LaTeX output. Note that which sources are shown also depends on other settings such as SOURCE_BROWSER.
+
+LATEX_SOURCE_CODE = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
+# The RTF output is optimized for Word 97 and may not look very pretty with
+# other RTF readers or editors.
+
+GENERATE_RTF = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `rtf' will be used as the default path.
+
+RTF_OUTPUT = rtf
+
+# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
+# RTF documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_RTF = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
+# will contain hyperlink fields. The RTF file will
+# contain links (just like the HTML output) instead of page references.
+# This makes the output suitable for online browsing using WORD or other
+# programs which support those fields.
+# Note: wordpad (write) and others do not support links.
+
+RTF_HYPERLINKS = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's
+# config file, i.e. a series of assignments. You only have to provide
+# replacements, missing definitions are set to their default value.
+
+RTF_STYLESHEET_FILE =
+
+# Set optional variables used in the generation of an rtf document.
+# Syntax is similar to doxygen's config file.
+
+RTF_EXTENSIONS_FILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
+# generate man pages
+
+GENERATE_MAN = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `man' will be used as the default path.
+
+MAN_OUTPUT = man
+
+# The MAN_EXTENSION tag determines the extension that is added to
+# the generated man pages (default is the subroutine's section .3)
+
+MAN_EXTENSION = .3
+
+# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
+# then it will generate one additional man file for each entity
+# documented in the real man page(s). These additional files
+# only source the real man page, but without them the man command
+# would be unable to find the correct page. The default is NO.
+
+MAN_LINKS = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES Doxygen will
+# generate an XML file that captures the structure of
+# the code including all documentation.
+
+GENERATE_XML = YES
+
+# The XML_OUTPUT tag is used to specify where the XML pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `xml' will be used as the default path.
+
+XML_OUTPUT = xml
+
+# The XML_SCHEMA tag can be used to specify an XML schema,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_SCHEMA =
+
+# The XML_DTD tag can be used to specify an XML DTD,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_DTD =
+
+# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
+# dump the program listings (including syntax highlighting
+# and cross-referencing information) to the XML output. Note that
+# enabling this will significantly increase the size of the XML output.
+
+XML_PROGRAMLISTING = YES
+
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
+# generate an AutoGen Definitions (see autogen.sf.net) file
+# that captures the structure of the code including all
+# documentation. Note that this feature is still experimental
+# and incomplete at the moment.
+
+GENERATE_AUTOGEN_DEF = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_PERLMOD tag is set to YES Doxygen will
+# generate a Perl module file that captures the structure of
+# the code including all documentation. Note that this
+# feature is still experimental and incomplete at the
+# moment.
+
+GENERATE_PERLMOD = NO
+
+# If the PERLMOD_LATEX tag is set to YES Doxygen will generate
+# the necessary Makefile rules, Perl scripts and LaTeX code to be able
+# to generate PDF and DVI output from the Perl module output.
+
+PERLMOD_LATEX = NO
+
+# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
+# nicely formatted so it can be parsed by a human reader.
+# This is useful
+# if you want to understand what is going on.
+# On the other hand, if this
+# tag is set to NO the size of the Perl module output will be much smaller
+# and Perl will parse it just the same.
+
+PERLMOD_PRETTY = YES
+
+# The names of the make variables in the generated doxyrules.make file
+# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
+# This is useful so different doxyrules.make files included by the same
+# Makefile don't overwrite each other's variables.
+
+PERLMOD_MAKEVAR_PREFIX =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
+# evaluate all C-preprocessor directives found in the sources and include
+# files.
+
+ENABLE_PREPROCESSING = YES
+
+# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
+# names in the source code. If set to NO (the default) only conditional
+# compilation will be performed. Macro expansion can be done in a controlled
+# way by setting EXPAND_ONLY_PREDEF to YES.
+
+MACRO_EXPANSION = NO
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
+# then the macro expansion is limited to the macros specified with the
+# PREDEFINED and EXPAND_AS_DEFINED tags.
+
+EXPAND_ONLY_PREDEF = NO
+
+# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
+# in the INCLUDE_PATH (see below) will be search if a #include is found.
+
+SEARCH_INCLUDES = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that
+# contain include files that are not input files but should be processed by
+# the preprocessor.
+
+INCLUDE_PATH =
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
+# patterns (like *.h and *.hpp) to filter out the header-files in the
+# directories. If left blank, the patterns specified with FILE_PATTERNS will
+# be used.
+
+INCLUDE_FILE_PATTERNS =
+
+# The PREDEFINED tag can be used to specify one or more macro names that
+# are defined before the preprocessor is started (similar to the -D option of
+# gcc). The argument of the tag is a list of macros of the form: name
+# or name=definition (no spaces). If the definition and the = are
+# omitted =1 is assumed. To prevent a macro definition from being
+# undefined via #undef or recursively expanded use the := operator
+# instead of the = operator.
+
+PREDEFINED =
+
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
+# this tag can be used to specify a list of macro names that should be expanded.
+# The macro definition that is found in the sources will be used.
+# Use the PREDEFINED tag if you want to use a different macro definition.
+
+EXPAND_AS_DEFINED =
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
+# doxygen's preprocessor will remove all function-like macros that are alone
+# on a line, have an all uppercase name, and do not end with a semicolon. Such
+# function macros are typically used for boiler-plate code, and will confuse
+# the parser if not removed.
+
+SKIP_FUNCTION_MACROS = YES
+
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references
+#---------------------------------------------------------------------------
+
+# The TAGFILES option can be used to specify one or more tagfiles.
+# Optionally an initial location of the external documentation
+# can be added for each tagfile. The format of a tag file without
+# this location is as follows:
+#
+# TAGFILES = file1 file2 ...
+# Adding location for the tag files is done as follows:
+#
+# TAGFILES = file1=loc1 "file2 = loc2" ...
+# where "loc1" and "loc2" can be relative or absolute paths or
+# URLs. If a location is present for each tag, the installdox tool
+# does not have to be run to correct the links.
+# Note that each tag file must have a unique name
+# (where the name does NOT include the path)
+# If a tag file is not located in the directory in which doxygen
+# is run, you must also specify the path to the tagfile here.
+
+TAGFILES =
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create
+# a tag file that is based on the input files it reads.
+
+GENERATE_TAGFILE =
+
+# If the ALLEXTERNALS tag is set to YES all external classes will be listed
+# in the class index. If set to NO only the inherited external classes
+# will be listed.
+
+ALLEXTERNALS = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
+# in the modules index. If set to NO, only the current project's groups will
+# be listed.
+
+EXTERNAL_GROUPS = YES
+
+# The PERL_PATH should be the absolute path and name of the perl script
+# interpreter (i.e. the result of `which perl').
+
+PERL_PATH = /usr/bin/perl
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
+# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base
+# or super classes. Setting the tag to NO turns the diagrams off. Note that
+# this option is superseded by the HAVE_DOT option below. This is only a
+# fallback. It is recommended to install and use dot, since it yields more
+# powerful graphs.
+
+CLASS_DIAGRAMS = YES
+
+# You can define message sequence charts within doxygen comments using the \msc
+# command. Doxygen will then run the mscgen tool (see
+# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the
+# documentation. The MSCGEN_PATH tag allows you to specify the directory where
+# the mscgen tool resides. If left empty the tool is assumed to be found in the
+# default search path.
+
+MSCGEN_PATH =
+
+# If set to YES, the inheritance and collaboration graphs will hide
+# inheritance and usage relations if the target is undocumented
+# or is not a class.
+
+HIDE_UNDOC_RELATIONS = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
+# available from the path. This tool is part of Graphviz, a graph visualization
+# toolkit from AT&T and Lucent Bell Labs. The other options in this section
+# have no effect if this option is set to NO (the default)
+
+HAVE_DOT = NO
+
+# By default doxygen will write a font called FreeSans.ttf to the output
+# directory and reference it in all dot files that doxygen generates. This
+# font does not include all possible unicode characters however, so when you need
+# these (or just want a differently looking font) you can specify the font name
+# using DOT_FONTNAME. You need need to make sure dot is able to find the font,
+# which can be done by putting it in a standard location or by setting the
+# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory
+# containing the font.
+
+DOT_FONTNAME = FreeSans
+
+# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs.
+# The default size is 10pt.
+
+DOT_FONTSIZE = 10
+
+# By default doxygen will tell dot to use the output directory to look for the
+# FreeSans.ttf font (which doxygen will put there itself). If you specify a
+# different font using DOT_FONTNAME you can set the path where dot
+# can find it using this tag.
+
+DOT_FONTPATH =
+
+# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect inheritance relations. Setting this tag to YES will force the
+# the CLASS_DIAGRAMS tag to NO.
+
+CLASS_GRAPH = YES
+
+# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect implementation dependencies (inheritance, containment, and
+# class references variables) of the class with other documented classes.
+
+COLLABORATION_GRAPH = YES
+
+# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for groups, showing the direct groups dependencies
+
+GROUP_GRAPHS = YES
+
+# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
+# collaboration diagrams in a style similar to the OMG's Unified Modeling
+# Language.
+
+UML_LOOK = NO
+
+# If set to YES, the inheritance and collaboration graphs will show the
+# relations between templates and their instances.
+
+TEMPLATE_RELATIONS = NO
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
+# tags are set to YES then doxygen will generate a graph for each documented
+# file showing the direct and indirect include dependencies of the file with
+# other documented files.
+
+INCLUDE_GRAPH = YES
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
+# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
+# documented header file showing the documented files that directly or
+# indirectly include this file.
+
+INCLUDED_BY_GRAPH = YES
+
+# If the CALL_GRAPH and HAVE_DOT options are set to YES then
+# doxygen will generate a call dependency graph for every global function
+# or class method. Note that enabling this option will significantly increase
+# the time of a run. So in most cases it will be better to enable call graphs
+# for selected functions only using the \callgraph command.
+
+CALL_GRAPH = NO
+
+# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then
+# doxygen will generate a caller dependency graph for every global function
+# or class method. Note that enabling this option will significantly increase
+# the time of a run. So in most cases it will be better to enable caller
+# graphs for selected functions only using the \callergraph command.
+
+CALLER_GRAPH = NO
+
+# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
+# will graphical hierarchy of all classes instead of a textual one.
+
+GRAPHICAL_HIERARCHY = YES
+
+# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES
+# then doxygen will show the dependencies a directory has on other directories
+# in a graphical way. The dependency relations are determined by the #include
+# relations between the files in the directories.
+
+DIRECTORY_GRAPH = YES
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
+# generated by dot. Possible values are png, jpg, or gif
+# If left blank png will be used.
+
+DOT_IMAGE_FORMAT = png
+
+# The tag DOT_PATH can be used to specify the path where the dot tool can be
+# found. If left blank, it is assumed the dot tool can be found in the path.
+
+DOT_PATH =
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that
+# contain dot files that are included in the documentation (see the
+# \dotfile command).
+
+DOTFILE_DIRS =
+
+# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of
+# nodes that will be shown in the graph. If the number of nodes in a graph
+# becomes larger than this value, doxygen will truncate the graph, which is
+# visualized by representing a node as a red box. Note that doxygen if the
+# number of direct children of the root node in a graph is already larger than
+# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note
+# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
+
+DOT_GRAPH_MAX_NODES = 50
+
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
+# graphs generated by dot. A depth value of 3 means that only nodes reachable
+# from the root by following a path via at most 3 edges will be shown. Nodes
+# that lay further from the root node will be omitted. Note that setting this
+# option to 1 or 2 may greatly reduce the computation time needed for large
+# code bases. Also note that the size of a graph can be further restricted by
+# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
+
+MAX_DOT_GRAPH_DEPTH = 0
+
+# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
+# background. This is disabled by default, because dot on Windows does not
+# seem to support this out of the box. Warning: Depending on the platform used,
+# enabling this option may lead to badly anti-aliased labels on the edges of
+# a graph (i.e. they become hard to read).
+
+DOT_TRANSPARENT = NO
+
+# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
+# files in one run (i.e. multiple -o and -T options on the command line). This
+# makes dot run faster, but since only newer versions of dot (>1.8.10)
+# support this, this feature is disabled by default.
+
+DOT_MULTI_TARGETS = YES
+
+# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
+# generate a legend page explaining the meaning of the various boxes and
+# arrows in the dot generated graphs.
+
+GENERATE_LEGEND = YES
+
+# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
+# remove the intermediate dot files that are used to generate
+# the various graphs.
+
+DOT_CLEANUP = YES
diff --git a/docs/doxygen/doxyxml/example/aadvark.cc b/docs/doxygen/doxyxml/example/aadvark.cc
new file mode 100644
index 000000000..f91c1ba56
--- /dev/null
+++ b/docs/doxygen/doxyxml/example/aadvark.cc
@@ -0,0 +1,50 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+#include <iostream>
+#include "aadvark.h"
+
+void Aadvark::print() {
+ std::cout << "aadvark is " << aadvarkness << "/10 aadvarky" << std::endl;
+}
+
+Aadvark::Aadvark(int aaness): aadvarkness(aaness) {}
+
+bool aadvarky_enough(Aadvark aad) {
+ if (aad.get_aadvarkness() > 6)
+ return true;
+ else
+ return false;
+}
+
+int Aadvark::get_aadvarkness() {
+ return aadvarkness;
+}
+
+int main() {
+ Aadvark arold = Aadvark(6);
+ arold.print();
+ if (aadvarky_enough(arold))
+ std::cout << "He is aadvarky enough" << std::endl;
+ else
+ std::cout << "He is not aadvarky enough" << std::endl;
+}
+
diff --git a/docs/doxygen/doxyxml/example/aadvark.h b/docs/doxygen/doxyxml/example/aadvark.h
new file mode 100644
index 000000000..d3c17445e
--- /dev/null
+++ b/docs/doxygen/doxyxml/example/aadvark.h
@@ -0,0 +1,44 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+#include <iostream>
+
+/*!
+ * \brief Models the mammal Aadvark.
+ *
+ * Sadly the model is incomplete and cannot capture all aspects of an aadvark yet.
+ *
+ * This line is uninformative and is only to test line breaks in the comments.
+ */
+class Aadvark {
+public:
+ //! \brief Outputs the vital aadvark statistics.
+ void print();
+ //! \param aaness The aadvarkness of an aadvark is a measure of how aadvarky it is.
+ Aadvark(int aaness);
+ int get_aadvarkness();
+private:
+ int aadvarkness;
+};
+
+bool aadvarky_enough(Aadvark aad);
+
+int main();
diff --git a/docs/doxygen/doxyxml/example/xml/aadvark_8cc.xml b/docs/doxygen/doxyxml/example/xml/aadvark_8cc.xml
new file mode 100644
index 000000000..f031e01ac
--- /dev/null
+++ b/docs/doxygen/doxyxml/example/xml/aadvark_8cc.xml
@@ -0,0 +1,88 @@
+<?xml version='1.0' encoding='UTF-8' standalone='no'?>
+<doxygen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="compound.xsd" version="1.6.3">
+ <compounddef id="aadvark_8cc" kind="file">
+ <compoundname>aadvark.cc</compoundname>
+ <includes local="no">iostream</includes>
+ <includes refid="aadvark_8cc" local="yes">aadvark.h</includes>
+ <includedby refid="aadvark_8cc" local="yes">aadvark.cc</includedby>
+ <incdepgraph>
+ <node id="0">
+ <label>aadvark.cc</label>
+ <link refid="aadvark.cc"/>
+ <childnode refid="1" relation="include">
+ </childnode>
+ </node>
+ <node id="1">
+ <label>iostream</label>
+ </node>
+ </incdepgraph>
+ <sectiondef kind="func">
+ <memberdef kind="function" id="aadvark_8cc_1acb52858524210ec6dddc3e16d1e52946" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
+ <type>bool</type>
+ <definition>bool aadvarky_enough</definition>
+ <argsstring>(Aadvark aad)</argsstring>
+ <name>aadvarky_enough</name>
+ <param>
+ <type><ref refid="classAadvark" kindref="compound">Aadvark</ref></type>
+ <declname>aad</declname>
+ </param>
+ <briefdescription>
+ </briefdescription>
+ <detaileddescription>
+ </detaileddescription>
+ <inbodydescription>
+ </inbodydescription>
+ <location file="/home/ben/gnuradio/gnuradio-core/src/python/gnuradio/utils/doxyxml/example/aadvark.cc" line="10" bodyfile="/home/ben/gnuradio/gnuradio-core/src/python/gnuradio/utils/doxyxml/example/aadvark.cc" bodystart="10" bodyend="15"/>
+ </memberdef>
+ <memberdef kind="function" id="aadvark_8cc_1ae66f6b31b5ad750f1fe042a706a4e3d4" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
+ <type>int</type>
+ <definition>int main</definition>
+ <argsstring>()</argsstring>
+ <name>main</name>
+ <briefdescription>
+ </briefdescription>
+ <detaileddescription>
+ </detaileddescription>
+ <inbodydescription>
+ </inbodydescription>
+ <location file="/home/ben/gnuradio/gnuradio-core/src/python/gnuradio/utils/doxyxml/example/aadvark.cc" line="21" bodyfile="/home/ben/gnuradio/gnuradio-core/src/python/gnuradio/utils/doxyxml/example/aadvark.cc" bodystart="21" bodyend="28"/>
+ </memberdef>
+ </sectiondef>
+ <briefdescription>
+ </briefdescription>
+ <detaileddescription>
+ </detaileddescription>
+ <programlisting>
+<codeline lineno="1"><highlight class="preprocessor">#include<sp/>&lt;iostream&gt;</highlight><highlight class="normal"></highlight></codeline>
+<codeline lineno="2"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;aadvark.h&quot;</highlight><highlight class="normal"></highlight></codeline>
+<codeline lineno="3"><highlight class="normal"></highlight></codeline>
+<codeline lineno="4"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="classAadvark_1abd061aa5f998002e72080a34f512a059" kindref="member" tooltip="Outputs the vital aadvark statistics.">Aadvark::print</ref>()<sp/>{</highlight></codeline>
+<codeline lineno="5"><highlight class="normal"><sp/><sp/>std::cout<sp/>&lt;&lt;<sp/></highlight><highlight class="stringliteral">&quot;aadvark<sp/>is<sp/>&quot;</highlight><highlight class="normal"><sp/>&lt;&lt;<sp/>aadvarkness<sp/>&lt;&lt;<sp/></highlight><highlight class="stringliteral">&quot;/10<sp/>aadvarky&quot;</highlight><highlight class="normal"><sp/>&lt;&lt;<sp/>std::endl;</highlight></codeline>
+<codeline lineno="6"><highlight class="normal">}</highlight></codeline>
+<codeline lineno="7"><highlight class="normal"></highlight></codeline>
+<codeline lineno="8"><highlight class="normal"><ref refid="classAadvark_1adf1a4b97a641411a74a04ab312484462" kindref="member">Aadvark::Aadvark</ref>(</highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>aaness):<sp/>aadvarkness(aaness)<sp/>{}</highlight></codeline>
+<codeline lineno="9"><highlight class="normal"></highlight></codeline>
+<codeline lineno="10"><highlight class="normal"></highlight><highlight class="keywordtype">bool</highlight><highlight class="normal"><sp/>aadvarky_enough(<ref refid="classAadvark" kindref="compound" tooltip="Models the mammal Aadvark.">Aadvark</ref><sp/>aad)<sp/>{</highlight></codeline>
+<codeline lineno="11"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(aad.get_aadvarkness()<sp/>&gt;<sp/>6)</highlight></codeline>
+<codeline lineno="12"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">true</highlight><highlight class="normal">;</highlight></codeline>
+<codeline lineno="13"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline>
+<codeline lineno="14"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">false</highlight><highlight class="normal">;</highlight></codeline>
+<codeline lineno="15"><highlight class="normal">}</highlight></codeline>
+<codeline lineno="16"><highlight class="normal"></highlight></codeline>
+<codeline lineno="17"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>Aadvark::get_aadvarkness()<sp/>{</highlight></codeline>
+<codeline lineno="18"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>aadvarkness;</highlight></codeline>
+<codeline lineno="19"><highlight class="normal">}</highlight></codeline>
+<codeline lineno="20"><highlight class="normal"></highlight></codeline>
+<codeline lineno="21"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>main()<sp/>{</highlight></codeline>
+<codeline lineno="22"><highlight class="normal"><sp/><sp/><ref refid="classAadvark" kindref="compound" tooltip="Models the mammal Aadvark.">Aadvark</ref><sp/>arold<sp/>=<sp/><ref refid="classAadvark" kindref="compound" tooltip="Models the mammal Aadvark.">Aadvark</ref>(6);</highlight></codeline>
+<codeline lineno="23"><highlight class="normal"><sp/><sp/>arold.<ref refid="classAadvark_1abd061aa5f998002e72080a34f512a059" kindref="member" tooltip="Outputs the vital aadvark statistics.">print</ref>();</highlight></codeline>
+<codeline lineno="24"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(aadvarky_enough(arold))</highlight></codeline>
+<codeline lineno="25"><highlight class="normal"><sp/><sp/><sp/><sp/>std::cout<sp/>&lt;&lt;<sp/></highlight><highlight class="stringliteral">&quot;He<sp/>is<sp/>aadvarky<sp/>enough&quot;</highlight><highlight class="normal"><sp/>&lt;&lt;<sp/>std::endl;</highlight></codeline>
+<codeline lineno="26"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline>
+<codeline lineno="27"><highlight class="normal"><sp/><sp/><sp/><sp/>std::cout<sp/>&lt;&lt;<sp/></highlight><highlight class="stringliteral">&quot;He<sp/>is<sp/>not<sp/>aadvarky<sp/>enough&quot;</highlight><highlight class="normal"><sp/>&lt;&lt;<sp/>std::endl;</highlight></codeline>
+<codeline lineno="28"><highlight class="normal">}</highlight></codeline>
+<codeline lineno="29"><highlight class="normal"></highlight></codeline>
+ </programlisting>
+ <location file="/home/ben/gnuradio/gnuradio-core/src/python/gnuradio/utils/doxyxml/example/aadvark.cc"/>
+ </compounddef>
+</doxygen>
diff --git a/docs/doxygen/doxyxml/example/xml/aadvark_8h.xml b/docs/doxygen/doxyxml/example/xml/aadvark_8h.xml
new file mode 100644
index 000000000..a1854b685
--- /dev/null
+++ b/docs/doxygen/doxyxml/example/xml/aadvark_8h.xml
@@ -0,0 +1,72 @@
+<?xml version='1.0' encoding='UTF-8' standalone='no'?>
+<doxygen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="compound.xsd" version="1.6.3">
+ <compounddef id="aadvark_8h" kind="file">
+ <compoundname>aadvark.h</compoundname>
+ <includes local="no">iostream</includes>
+ <incdepgraph>
+ <node id="3">
+ <label>aadvark.h</label>
+ <link refid="aadvark.h"/>
+ <childnode refid="4" relation="include">
+ </childnode>
+ </node>
+ <node id="4">
+ <label>iostream</label>
+ </node>
+ </incdepgraph>
+ <innerclass refid="classAadvark" prot="public">Aadvark</innerclass>
+ <sectiondef kind="func">
+ <memberdef kind="function" id="aadvark_8h_1acb52858524210ec6dddc3e16d1e52946" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
+ <type>bool</type>
+ <definition>bool aadvarky_enough</definition>
+ <argsstring>(Aadvark aad)</argsstring>
+ <name>aadvarky_enough</name>
+ <param>
+ <type><ref refid="classAadvark" kindref="compound">Aadvark</ref></type>
+ <declname>aad</declname>
+ </param>
+ <briefdescription>
+ </briefdescription>
+ <detaileddescription>
+ </detaileddescription>
+ <inbodydescription>
+ </inbodydescription>
+ <location file="/home/ben/gnuradio/gnuradio-core/src/python/gnuradio/utils/doxyxml/example/aadvark.h" line="21" bodyfile="/home/ben/gnuradio/gnuradio-core/src/python/gnuradio/utils/doxyxml/example/aadvark.cc" bodystart="10" bodyend="15"/>
+ </memberdef>
+ <memberdef kind="function" id="aadvark_8h_1ae66f6b31b5ad750f1fe042a706a4e3d4" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
+ <type>int</type>
+ <definition>int main</definition>
+ <argsstring>()</argsstring>
+ <name>main</name>
+ <briefdescription>
+ </briefdescription>
+ <detaileddescription>
+ </detaileddescription>
+ <inbodydescription>
+ </inbodydescription>
+ <location file="/home/ben/gnuradio/gnuradio-core/src/python/gnuradio/utils/doxyxml/example/aadvark.h" line="23" bodyfile="/home/ben/gnuradio/gnuradio-core/src/python/gnuradio/utils/doxyxml/example/aadvark.cc" bodystart="21" bodyend="28"/>
+ </memberdef>
+ </sectiondef>
+ <briefdescription>
+ </briefdescription>
+ <detaileddescription>
+ </detaileddescription>
+ <programlisting>
+<codeline lineno="1"><highlight class="preprocessor">#include<sp/>&lt;iostream&gt;</highlight><highlight class="normal"></highlight></codeline>
+<codeline lineno="2"><highlight class="normal"></highlight></codeline>
+<codeline lineno="10" refid="classAadvark" refkind="compound"><highlight class="keyword">class<sp/></highlight><highlight class="normal"><ref refid="classAadvark" kindref="compound" tooltip="Models the mammal Aadvark.">Aadvark</ref><sp/>{</highlight></codeline>
+<codeline lineno="11"><highlight class="normal"></highlight><highlight class="keyword">public</highlight><highlight class="normal">:</highlight></codeline>
+<codeline lineno="13"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="classAadvark_1abd061aa5f998002e72080a34f512a059" kindref="member" tooltip="Outputs the vital aadvark statistics.">print</ref>();</highlight></codeline>
+<codeline lineno="15"><highlight class="normal"><sp/><sp/><ref refid="classAadvark_1adf1a4b97a641411a74a04ab312484462" kindref="member">Aadvark</ref>(</highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>aaness);</highlight></codeline>
+<codeline lineno="16"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>get_aadvarkness();</highlight></codeline>
+<codeline lineno="17"><highlight class="normal"></highlight><highlight class="keyword">private</highlight><highlight class="normal">:</highlight></codeline>
+<codeline lineno="18"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>aadvarkness;</highlight></codeline>
+<codeline lineno="19"><highlight class="normal">};</highlight></codeline>
+<codeline lineno="20"><highlight class="normal"></highlight></codeline>
+<codeline lineno="21"><highlight class="normal"></highlight><highlight class="keywordtype">bool</highlight><highlight class="normal"><sp/>aadvarky_enough(<ref refid="classAadvark" kindref="compound" tooltip="Models the mammal Aadvark.">Aadvark</ref><sp/>aad);</highlight></codeline>
+<codeline lineno="22"><highlight class="normal"></highlight></codeline>
+<codeline lineno="23"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>main();</highlight></codeline>
+ </programlisting>
+ <location file="/home/ben/gnuradio/gnuradio-core/src/python/gnuradio/utils/doxyxml/example/aadvark.h"/>
+ </compounddef>
+</doxygen>
diff --git a/docs/doxygen/doxyxml/example/xml/classAadvark.xml b/docs/doxygen/doxyxml/example/xml/classAadvark.xml
new file mode 100644
index 000000000..54fe8b32c
--- /dev/null
+++ b/docs/doxygen/doxyxml/example/xml/classAadvark.xml
@@ -0,0 +1,86 @@
+<?xml version='1.0' encoding='UTF-8' standalone='no'?>
+<doxygen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="compound.xsd" version="1.6.3">
+ <compounddef id="classAadvark" kind="class" prot="public">
+ <compoundname>Aadvark</compoundname>
+ <includes refid="aadvark_8h" local="no">aadvark.h</includes>
+ <sectiondef kind="private-attrib">
+ <memberdef kind="variable" id="classAadvark_1ab79eb58d7bb9d5ddfa5d6f783836cab9" prot="private" static="no" mutable="no">
+ <type>int</type>
+ <definition>int Aadvark::aadvarkness</definition>
+ <argsstring></argsstring>
+ <name>aadvarkness</name>
+ <briefdescription>
+ </briefdescription>
+ <detaileddescription>
+ </detaileddescription>
+ <inbodydescription>
+ </inbodydescription>
+ <location file="/home/ben/gnuradio/gnuradio-core/src/python/gnuradio/utils/doxyxml/example/aadvark.h" line="18" bodyfile="/home/ben/gnuradio/gnuradio-core/src/python/gnuradio/utils/doxyxml/example/aadvark.h" bodystart="18" bodyend="-1"/>
+ </memberdef>
+ </sectiondef>
+ <sectiondef kind="public-func">
+ <memberdef kind="function" id="classAadvark_1abd061aa5f998002e72080a34f512a059" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
+ <type>void</type>
+ <definition>void Aadvark::print</definition>
+ <argsstring>()</argsstring>
+ <name>print</name>
+ <briefdescription>
+<para>Outputs the vital aadvark statistics. </para> </briefdescription>
+ <detaileddescription>
+ </detaileddescription>
+ <inbodydescription>
+ </inbodydescription>
+ <location file="/home/ben/gnuradio/gnuradio-core/src/python/gnuradio/utils/doxyxml/example/aadvark.h" line="13" bodyfile="/home/ben/gnuradio/gnuradio-core/src/python/gnuradio/utils/doxyxml/example/aadvark.cc" bodystart="4" bodyend="6"/>
+ </memberdef>
+ <memberdef kind="function" id="classAadvark_1adf1a4b97a641411a74a04ab312484462" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
+ <type></type>
+ <definition>Aadvark::Aadvark</definition>
+ <argsstring>(int aaness)</argsstring>
+ <name>Aadvark</name>
+ <param>
+ <type>int</type>
+ <declname>aaness</declname>
+ </param>
+ <briefdescription>
+ </briefdescription>
+ <detaileddescription>
+<para><parameterlist kind="param"><parameteritem>
+<parameternamelist>
+<parametername>aaness</parametername>
+</parameternamelist>
+<parameterdescription>
+<para>The aadvarkness of an aadvark is a measure of how aadvarky it is. </para></parameterdescription>
+</parameteritem>
+</parameterlist>
+</para> </detaileddescription>
+ <inbodydescription>
+ </inbodydescription>
+ <location file="/home/ben/gnuradio/gnuradio-core/src/python/gnuradio/utils/doxyxml/example/aadvark.h" line="15" bodyfile="/home/ben/gnuradio/gnuradio-core/src/python/gnuradio/utils/doxyxml/example/aadvark.cc" bodystart="8" bodyend="8"/>
+ </memberdef>
+ <memberdef kind="function" id="classAadvark_1affd2ada0a85807efcbe26615a848f53e" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
+ <type>int</type>
+ <definition>int Aadvark::get_aadvarkness</definition>
+ <argsstring>()</argsstring>
+ <name>get_aadvarkness</name>
+ <briefdescription>
+ </briefdescription>
+ <detaileddescription>
+ </detaileddescription>
+ <inbodydescription>
+ </inbodydescription>
+ <location file="/home/ben/gnuradio/gnuradio-core/src/python/gnuradio/utils/doxyxml/example/aadvark.h" line="16" bodyfile="/home/ben/gnuradio/gnuradio-core/src/python/gnuradio/utils/doxyxml/example/aadvark.cc" bodystart="17" bodyend="19"/>
+ </memberdef>
+ </sectiondef>
+ <briefdescription>
+<para>Models the mammal <ref refid="classAadvark" kindref="compound">Aadvark</ref>. </para> </briefdescription>
+ <detaileddescription>
+<para>Sadly the model is incomplete and cannot capture all aspects of an aadvark yet.</para><para>This line is uninformative and is only to test line breaks in the comments. </para> </detaileddescription>
+ <location file="/home/ben/gnuradio/gnuradio-core/src/python/gnuradio/utils/doxyxml/example/aadvark.h" line="10" bodyfile="/home/ben/gnuradio/gnuradio-core/src/python/gnuradio/utils/doxyxml/example/aadvark.h" bodystart="10" bodyend="19"/>
+ <listofallmembers>
+ <member refid="classAadvark_1adf1a4b97a641411a74a04ab312484462" prot="public" virt="non-virtual"><scope>Aadvark</scope><name>Aadvark</name></member>
+ <member refid="classAadvark_1ab79eb58d7bb9d5ddfa5d6f783836cab9" prot="private" virt="non-virtual"><scope>Aadvark</scope><name>aadvarkness</name></member>
+ <member refid="classAadvark_1affd2ada0a85807efcbe26615a848f53e" prot="public" virt="non-virtual"><scope>Aadvark</scope><name>get_aadvarkness</name></member>
+ <member refid="classAadvark_1abd061aa5f998002e72080a34f512a059" prot="public" virt="non-virtual"><scope>Aadvark</scope><name>print</name></member>
+ </listofallmembers>
+ </compounddef>
+</doxygen>
diff --git a/docs/doxygen/doxyxml/example/xml/combine.xslt b/docs/doxygen/doxyxml/example/xml/combine.xslt
new file mode 100644
index 000000000..6de203a2b
--- /dev/null
+++ b/docs/doxygen/doxyxml/example/xml/combine.xslt
@@ -0,0 +1,15 @@
+<!-- XSLT script to combine the generated output into a single file.
+ If you have xsltproc you could use:
+ xsltproc combine.xslt index.xml >all.xml
+-->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+ <xsl:output method="xml" version="1.0" indent="yes" standalone="yes" />
+ <xsl:template match="/">
+ <doxygen version="{doxygenindex/@version}">
+ <!-- Load all doxgen generated xml files -->
+ <xsl:for-each select="doxygenindex/compound">
+ <xsl:copy-of select="document( concat( @refid, '.xml' ) )/doxygen/*" />
+ </xsl:for-each>
+ </doxygen>
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/docs/doxygen/doxyxml/example/xml/compound.xsd b/docs/doxygen/doxyxml/example/xml/compound.xsd
new file mode 100644
index 000000000..5bb567052
--- /dev/null
+++ b/docs/doxygen/doxyxml/example/xml/compound.xsd
@@ -0,0 +1,814 @@
+<?xml version='1.0' encoding='utf-8' ?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <xsd:element name="doxygen" type="DoxygenType"/>
+
+ <!-- Complex types -->
+
+ <xsd:complexType name="DoxygenType">
+ <xsd:sequence maxOccurs="unbounded">
+ <xsd:element name="compounddef" type="compounddefType" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="version" type="DoxVersionNumber" use="required" />
+ </xsd:complexType>
+
+ <xsd:complexType name="compounddefType">
+ <xsd:sequence>
+ <xsd:element name="compoundname" type="xsd:string"/>
+ <xsd:element name="title" type="xsd:string" minOccurs="0" />
+ <xsd:element name="basecompoundref" type="compoundRefType" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element name="derivedcompoundref" type="compoundRefType" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element name="includes" type="incType" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element name="includedby" type="incType" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element name="incdepgraph" type="graphType" minOccurs="0" />
+ <xsd:element name="invincdepgraph" type="graphType" minOccurs="0" />
+ <xsd:element name="innerdir" type="refType" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element name="innerfile" type="refType" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element name="innerclass" type="refType" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element name="innernamespace" type="refType" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element name="innerpage" type="refType" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element name="innergroup" type="refType" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element name="templateparamlist" type="templateparamlistType" minOccurs="0" />
+ <xsd:element name="sectiondef" type="sectiondefType" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element name="briefdescription" type="descriptionType" minOccurs="0" />
+ <xsd:element name="detaileddescription" type="descriptionType" minOccurs="0" />
+ <xsd:element name="inheritancegraph" type="graphType" minOccurs="0" />
+ <xsd:element name="collaborationgraph" type="graphType" minOccurs="0" />
+ <xsd:element name="programlisting" type="listingType" minOccurs="0" />
+ <xsd:element name="location" type="locationType" minOccurs="0" />
+ <xsd:element name="listofallmembers" type="listofallmembersType" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:string" />
+ <xsd:attribute name="kind" type="DoxCompoundKind" />
+ <xsd:attribute name="prot" type="DoxProtectionKind" />
+ </xsd:complexType>
+
+ <xsd:complexType name="listofallmembersType">
+ <xsd:sequence>
+ <xsd:element name="member" type="memberRefType" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="memberRefType">
+ <xsd:sequence>
+ <xsd:element name="scope" />
+ <xsd:element name="name" />
+ </xsd:sequence>
+ <xsd:attribute name="refid" type="xsd:string" />
+ <xsd:attribute name="prot" type="DoxProtectionKind" />
+ <xsd:attribute name="virt" type="DoxVirtualKind" />
+ <xsd:attribute name="ambiguityscope" type="xsd:string" />
+ </xsd:complexType>
+
+ <xsd:complexType name="compoundRefType" mixed="true">
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string">
+ <xsd:attribute name="refid" type="xsd:string" use="optional" />
+ <xsd:attribute name="prot" type="DoxProtectionKind" />
+ <xsd:attribute name="virt" type="DoxVirtualKind" />
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+ <xsd:complexType name="reimplementType" mixed="true">
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string">
+ <xsd:attribute name="refid" type="xsd:string" />
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+ <xsd:complexType name="incType" mixed="true">
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string">
+ <xsd:attribute name="refid" type="xsd:string" />
+ <xsd:attribute name="local" type="DoxBool" />
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+ <xsd:complexType name="refType" mixed="true">
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string">
+ <xsd:attribute name="refid" type="xsd:string" />
+ <xsd:attribute name="prot" type="DoxProtectionKind" use="optional"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+ <xsd:complexType name="refTextType" mixed="true">
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string">
+ <xsd:attribute name="refid" type="xsd:string" />
+ <xsd:attribute name="kindref" type="DoxRefKind" />
+ <xsd:attribute name="external" type="xsd:string" use="optional"/>
+ <xsd:attribute name="tooltip" type="xsd:string" use="optional"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+ <xsd:complexType name="sectiondefType">
+ <xsd:sequence>
+ <xsd:element name="header" type="xsd:string" minOccurs="0" />
+ <xsd:element name="description" type="descriptionType" minOccurs="0" />
+ <xsd:element name="memberdef" type="memberdefType" maxOccurs="unbounded" />
+ </xsd:sequence>
+ <xsd:attribute name="kind" type="DoxSectionKind" />
+ </xsd:complexType>
+
+ <xsd:complexType name="memberdefType">
+ <xsd:sequence>
+ <xsd:element name="templateparamlist" type="templateparamlistType" minOccurs="0" />
+ <xsd:element name="type" type="linkedTextType" minOccurs="0" />
+ <xsd:element name="definition" minOccurs="0" />
+ <xsd:element name="argsstring" minOccurs="0" />
+ <xsd:element name="name" />
+ <xsd:element name="read" minOccurs="0" />
+ <xsd:element name="write" minOccurs="0" />
+ <xsd:element name="bitfield" minOccurs="0" />
+ <xsd:element name="reimplements" type="reimplementType" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element name="reimplementedby" type="reimplementType" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element name="param" type="paramType" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element name="enumvalue" type="enumvalueType" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element name="initializer" type="linkedTextType" minOccurs="0" />
+ <xsd:element name="exceptions" type="linkedTextType" minOccurs="0" />
+ <xsd:element name="briefdescription" type="descriptionType" minOccurs="0" />
+ <xsd:element name="detaileddescription" type="descriptionType" minOccurs="0" />
+ <xsd:element name="inbodydescription" type="descriptionType" minOccurs="0" />
+ <xsd:element name="location" type="locationType" />
+ <xsd:element name="references" type="referenceType" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element name="referencedby" type="referenceType" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ <xsd:attribute name="kind" type="DoxMemberKind" />
+ <xsd:attribute name="id" type="xsd:string" />
+ <xsd:attribute name="prot" type="DoxProtectionKind" />
+ <xsd:attribute name="static" type="DoxBool" />
+ <xsd:attribute name="const" type="DoxBool" />
+ <xsd:attribute name="explicit" type="DoxBool" />
+ <xsd:attribute name="inline" type="DoxBool" />
+ <xsd:attribute name="virt" type="DoxVirtualKind" />
+ <xsd:attribute name="volatile" type="DoxBool" />
+ <xsd:attribute name="mutable" type="DoxBool" />
+ <!-- Qt property -->
+ <xsd:attribute name="readable" type="DoxBool" use="optional"/>
+ <xsd:attribute name="writable" type="DoxBool" use="optional"/>
+ <!-- C++/CLI variable -->
+ <xsd:attribute name="initonly" type="DoxBool" use="optional"/>
+ <!-- C++/CLI and C# property -->
+ <xsd:attribute name="settable" type="DoxBool" use="optional"/>
+ <xsd:attribute name="gettable" type="DoxBool" use="optional"/>
+ <!-- C++/CLI function -->
+ <xsd:attribute name="final" type="DoxBool" use="optional"/>
+ <xsd:attribute name="sealed" type="DoxBool" use="optional"/>
+ <xsd:attribute name="new" type="DoxBool" use="optional"/>
+ <!-- C++/CLI event -->
+ <xsd:attribute name="add" type="DoxBool" use="optional"/>
+ <xsd:attribute name="remove" type="DoxBool" use="optional"/>
+ <xsd:attribute name="raise" type="DoxBool" use="optional"/>
+ <!-- Objective-C 2.0 protocol method -->
+ <xsd:attribute name="optional" type="DoxBool" use="optional"/>
+ <xsd:attribute name="required" type="DoxBool" use="optional"/>
+ <!-- Objective-C 2.0 property accessor -->
+ <xsd:attribute name="accessor" type="DoxAccessor" use="optional"/>
+ </xsd:complexType>
+
+ <xsd:complexType name="descriptionType" mixed="true">
+ <xsd:sequence>
+ <xsd:element name="title" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="para" type="docParaType" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element name="sect1" type="docSect1Type" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element name="internal" type="docInternalType" minOccurs="0" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="enumvalueType" mixed="true">
+ <xsd:sequence>
+ <xsd:element name="name" />
+ <xsd:element name="initializer" type="linkedTextType" minOccurs="0" />
+ <xsd:element name="briefdescription" type="descriptionType" minOccurs="0" />
+ <xsd:element name="detaileddescription" type="descriptionType" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:string" />
+ <xsd:attribute name="prot" type="DoxProtectionKind" />
+ </xsd:complexType>
+
+ <xsd:complexType name="templateparamlistType">
+ <xsd:sequence>
+ <xsd:element name="param" type="paramType" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="paramType">
+ <xsd:sequence>
+ <xsd:element name="type" type="linkedTextType" minOccurs="0" />
+ <xsd:element name="declname" minOccurs="0" />
+ <xsd:element name="defname" minOccurs="0" />
+ <xsd:element name="array" minOccurs="0" />
+ <xsd:element name="defval" type="linkedTextType" minOccurs="0" />
+ <xsd:element name="briefdescription" type="descriptionType" minOccurs="0" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="linkedTextType" mixed="true">
+ <xsd:sequence>
+ <xsd:element name="ref" type="refTextType" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="graphType">
+ <xsd:sequence>
+ <xsd:element name="node" type="nodeType" maxOccurs="unbounded" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="nodeType">
+ <xsd:sequence>
+ <xsd:element name="label" />
+ <xsd:element name="link" type="linkType" minOccurs="0" />
+ <xsd:element name="childnode" type="childnodeType" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:string" />
+ </xsd:complexType>
+
+ <xsd:complexType name="childnodeType">
+ <xsd:sequence>
+ <xsd:element name="edgelabel" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="refid" type="xsd:string" />
+ <xsd:attribute name="relation" type="DoxGraphRelation" />
+ </xsd:complexType>
+
+ <xsd:complexType name="linkType">
+ <xsd:attribute name="refid" type="xsd:string" />
+ <xsd:attribute name="external" type="xsd:string" use="optional"/>
+ </xsd:complexType>
+
+ <xsd:complexType name="listingType">
+ <xsd:sequence>
+ <xsd:element name="codeline" type="codelineType" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="codelineType">
+ <xsd:sequence>
+ <xsd:element name="highlight" type="highlightType" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ <xsd:attribute name="lineno" type="xsd:integer" />
+ <xsd:attribute name="refid" type="xsd:string" />
+ <xsd:attribute name="refkind" type="DoxRefKind" />
+ <xsd:attribute name="external" type="DoxBool" />
+ </xsd:complexType>
+
+ <xsd:complexType name="highlightType" mixed="true">
+ <xsd:choice minOccurs="0" maxOccurs="unbounded">
+ <xsd:element name="sp" />
+ <xsd:element name="ref" type="refTextType" />
+ </xsd:choice>
+ <xsd:attribute name="class" type="DoxHighlightClass" />
+ </xsd:complexType>
+
+ <xsd:complexType name="referenceType" mixed="true">
+ <xsd:attribute name="refid" type="xsd:string" />
+ <xsd:attribute name="compoundref" type="xsd:string" use="optional" />
+ <xsd:attribute name="startline" type="xsd:integer" />
+ <xsd:attribute name="endline" type="xsd:integer" />
+ </xsd:complexType>
+
+ <xsd:complexType name="locationType">
+ <xsd:attribute name="file" type="xsd:string" />
+ <xsd:attribute name="line" type="xsd:integer" />
+ <xsd:attribute name="bodyfile" type="xsd:string" />
+ <xsd:attribute name="bodystart" type="xsd:integer" />
+ <xsd:attribute name="bodyend" type="xsd:integer" />
+ </xsd:complexType>
+
+ <xsd:complexType name="docSect1Type" mixed="true">
+ <xsd:sequence>
+ <xsd:element name="title" type="xsd:string" />
+ <xsd:element name="para" type="docParaType" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element name="sect2" type="docSect2Type" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element name="internal" type="docInternalS1Type" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:string" />
+ </xsd:complexType>
+
+ <xsd:complexType name="docSect2Type" mixed="true">
+ <xsd:sequence>
+ <xsd:element name="title" type="xsd:string" />
+ <xsd:element name="para" type="docParaType" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element name="sect3" type="docSect3Type" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element name="internal" type="docInternalS2Type" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:string" />
+ </xsd:complexType>
+
+ <xsd:complexType name="docSect3Type" mixed="true">
+ <xsd:sequence>
+ <xsd:element name="title" type="xsd:string" />
+ <xsd:element name="para" type="docParaType" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element name="sect4" type="docSect4Type" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element name="internal" type="docInternalS3Type" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:string" />
+ </xsd:complexType>
+
+ <xsd:complexType name="docSect4Type" mixed="true">
+ <xsd:sequence>
+ <xsd:element name="title" type="xsd:string" />
+ <xsd:element name="para" type="docParaType" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element name="internal" type="docInternalS4Type" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:string" />
+ </xsd:complexType>
+
+ <xsd:complexType name="docInternalType" mixed="true">
+ <xsd:sequence>
+ <xsd:element name="para" type="docParaType" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element name="sect1" type="docSect1Type" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="docInternalS1Type" mixed="true">
+ <xsd:sequence>
+ <xsd:element name="para" type="docParaType" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element name="sect2" type="docSect2Type" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="docInternalS2Type" mixed="true">
+ <xsd:sequence>
+ <xsd:element name="para" type="docParaType" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element name="sect3" type="docSect3Type" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="docInternalS3Type" mixed="true">
+ <xsd:sequence>
+ <xsd:element name="para" type="docParaType" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element name="sect3" type="docSect4Type" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="docInternalS4Type" mixed="true">
+ <xsd:sequence>
+ <xsd:element name="para" type="docParaType" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:group name="docTitleCmdGroup">
+ <xsd:choice>
+ <xsd:element name="ulink" type="docURLLink" />
+ <xsd:element name="bold" type="docMarkupType" />
+ <xsd:element name="emphasis" type="docMarkupType" />
+ <xsd:element name="computeroutput" type="docMarkupType" />
+ <xsd:element name="subscript" type="docMarkupType" />
+ <xsd:element name="superscript" type="docMarkupType" />
+ <xsd:element name="center" type="docMarkupType" />
+ <xsd:element name="small" type="docMarkupType" />
+ <xsd:element name="htmlonly" type="xsd:string" />
+ <xsd:element name="latexonly" type="xsd:string" />
+ <xsd:element name="dot" type="xsd:string" />
+ <xsd:element name="anchor" type="docAnchorType" />
+ <xsd:element name="formula" type="docFormulaType" />
+ <xsd:element name="ref" type="docRefTextType" />
+ <xsd:element name="copy" type="docEmptyType" />
+ <xsd:element name="trademark" type="docEmptyType" />
+ <xsd:element name="registered" type="docEmptyType" />
+ <xsd:element name="lsquo" type="docEmptyType" />
+ <xsd:element name="rsquo" type="docEmptyType" />
+ <xsd:element name="ldquo" type="docEmptyType" />
+ <xsd:element name="rdquo" type="docEmptyType" />
+ <xsd:element name="ndash" type="docEmptyType" />
+ <xsd:element name="mdash" type="docEmptyType" />
+ <xsd:element name="umlaut" type="docCharType" />
+ <xsd:element name="acute" type="docCharType" />
+ <xsd:element name="grave" type="docCharType" />
+ <xsd:element name="circ" type="docCharType" />
+ <xsd:element name="slash" type="docCharType" />
+ <xsd:element name="tilde" type="docCharType" />
+ <xsd:element name="cedil" type="docCharType" />
+ <xsd:element name="ring" type="docCharType" />
+ <xsd:element name="szlig" type="docEmptyType" />
+ <xsd:element name="nonbreakablespace" type="docEmptyType" />
+ </xsd:choice>
+ </xsd:group>
+
+ <xsd:complexType name="docTitleType" mixed="true">
+ <xsd:group ref="docTitleCmdGroup" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:complexType>
+
+ <xsd:group name="docCmdGroup">
+ <xsd:choice>
+ <xsd:group ref="docTitleCmdGroup"/>
+ <xsd:element name="linebreak" type="docEmptyType" />
+ <xsd:element name="hruler" type="docEmptyType" />
+ <xsd:element name="preformatted" type="docMarkupType" />
+ <xsd:element name="programlisting" type="listingType" />
+ <xsd:element name="verbatim" type="xsd:string" />
+ <xsd:element name="indexentry" type="docIndexEntryType" />
+ <xsd:element name="orderedlist" type="docListType" />
+ <xsd:element name="itemizedlist" type="docListType" />
+ <xsd:element name="simplesect" type="docSimpleSectType" />
+ <xsd:element name="title" type="docTitleType" />
+ <xsd:element name="variablelist" type="docVariableListType" />
+ <xsd:element name="table" type="docTableType" />
+ <xsd:element name="heading" type="docHeadingType" />
+ <xsd:element name="image" type="docImageType" />
+ <xsd:element name="dotfile" type="docDotFileType" />
+ <xsd:element name="toclist" type="docTocListType" />
+ <xsd:element name="language" type="docLanguageType" />
+ <xsd:element name="parameterlist" type="docParamListType" />
+ <xsd:element name="xrefsect" type="docXRefSectType" />
+ <xsd:element name="copydoc" type="docCopyType" />
+ </xsd:choice>
+ </xsd:group>
+
+ <xsd:complexType name="docParaType" mixed="true">
+ <xsd:group ref="docCmdGroup" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:complexType>
+
+ <xsd:complexType name="docMarkupType" mixed="true">
+ <xsd:group ref="docCmdGroup" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:complexType>
+
+ <xsd:complexType name="docURLLink" mixed="true">
+ <xsd:group ref="docTitleCmdGroup" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:attribute name="url" type="xsd:string" />
+ </xsd:complexType>
+
+ <xsd:complexType name="docAnchorType" mixed="true">
+ <xsd:attribute name="id" type="xsd:string" />
+ </xsd:complexType>
+
+ <xsd:complexType name="docFormulaType" mixed="true">
+ <xsd:attribute name="id" type="xsd:string" />
+ </xsd:complexType>
+
+ <xsd:complexType name="docIndexEntryType">
+ <xsd:sequence>
+ <xsd:element name="primaryie" type="xsd:string" />
+ <xsd:element name="secondaryie" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="docListType">
+ <xsd:sequence>
+ <xsd:element name="listitem" type="docListItemType" maxOccurs="unbounded" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="docListItemType">
+ <xsd:sequence>
+ <xsd:element name="para" type="docParaType" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="docSimpleSectType">
+ <xsd:sequence>
+ <xsd:element name="title" type="docTitleType" minOccurs="0" />
+ <xsd:sequence minOccurs="0" maxOccurs="unbounded">
+ <xsd:element name="para" type="docParaType" minOccurs="1" maxOccurs="unbounded" />
+ <xsd:element name="simplesectsep" type="docEmptyType" minOccurs="0"/>
+ </xsd:sequence>
+ </xsd:sequence>
+ <xsd:attribute name="kind" type="DoxSimpleSectKind" />
+ </xsd:complexType>
+
+ <xsd:complexType name="docVarListEntryType">
+ <xsd:sequence>
+ <xsd:element name="term" type="docTitleType" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:group name="docVariableListGroup">
+ <xsd:sequence>
+ <xsd:element name="varlistentry" type="docVarListEntryType" />
+ <xsd:element name="listitem" type="docListItemType" />
+ </xsd:sequence>
+ </xsd:group>
+
+ <xsd:complexType name="docVariableListType">
+ <xsd:sequence>
+ <xsd:group ref="docVariableListGroup" maxOccurs="unbounded" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="docRefTextType" mixed="true">
+ <xsd:group ref="docTitleCmdGroup" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:attribute name="refid" type="xsd:string" />
+ <xsd:attribute name="kindref" type="DoxRefKind" />
+ <xsd:attribute name="external" type="xsd:string" />
+ </xsd:complexType>
+
+ <xsd:complexType name="docTableType">
+ <xsd:sequence>
+ <xsd:element name="row" type="docRowType" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element name="caption" type="docCaptionType" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="rows" type="xsd:integer" />
+ <xsd:attribute name="cols" type="xsd:integer" />
+ </xsd:complexType>
+
+ <xsd:complexType name="docRowType">
+ <xsd:sequence>
+ <xsd:element name="entry" type="docEntryType" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="docEntryType">
+ <xsd:sequence>
+ <xsd:element name="para" type="docParaType" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ <xsd:attribute name="thead" type="DoxBool" />
+ </xsd:complexType>
+
+ <xsd:complexType name="docCaptionType" mixed="true">
+ <xsd:group ref="docTitleCmdGroup" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:complexType>
+
+ <xsd:complexType name="docHeadingType" mixed="true">
+ <xsd:group ref="docTitleCmdGroup" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:attribute name="level" type="xsd:integer" /> <!-- todo: range 1-6 -->
+ </xsd:complexType>
+
+ <xsd:complexType name="docImageType" mixed="true">
+ <xsd:group ref="docTitleCmdGroup" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:attribute name="type" type="DoxImageKind" />
+ <xsd:attribute name="name" type="xsd:string" />
+ <xsd:attribute name="width" type="xsd:string" />
+ <xsd:attribute name="height" type="xsd:string" />
+ </xsd:complexType>
+
+ <xsd:complexType name="docDotFileType" mixed="true">
+ <xsd:group ref="docTitleCmdGroup" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+
+ <xsd:complexType name="docTocItemType" mixed="true">
+ <xsd:group ref="docTitleCmdGroup" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:attribute name="id" type="xsd:string" />
+ </xsd:complexType>
+
+ <xsd:complexType name="docTocListType">
+ <xsd:sequence>
+ <xsd:element name="tocitem" type="docTocItemType" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="docLanguageType">
+ <xsd:sequence>
+ <xsd:element name="para" type="docParaType" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ <xsd:attribute name="langid" type="xsd:string" />
+ </xsd:complexType>
+
+ <xsd:complexType name="docParamListType">
+ <xsd:sequence>
+ <xsd:element name="parameteritem" type="docParamListItem" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ <xsd:attribute name="kind" type="DoxParamListKind" />
+ </xsd:complexType>
+
+ <xsd:complexType name="docParamListItem">
+ <xsd:sequence>
+ <xsd:element name="parameternamelist" type="docParamNameList" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element name="parameterdescription" type="descriptionType" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="docParamNameList">
+ <xsd:sequence>
+ <xsd:element name="parametername" type="docParamName" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="docParamName" mixed="true">
+ <xsd:sequence>
+ <xsd:element name="ref" type="refTextType" minOccurs="0" maxOccurs="1" />
+ </xsd:sequence>
+ <xsd:attribute name="direction" type="DoxParamDir" use="optional" />
+ </xsd:complexType>
+
+ <xsd:complexType name="docXRefSectType">
+ <xsd:sequence>
+ <xsd:element name="xreftitle" type="xsd:string" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element name="xrefdescription" type="descriptionType" />
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:string" />
+ </xsd:complexType>
+
+ <xsd:complexType name="docCopyType">
+ <xsd:sequence>
+ <xsd:element name="para" type="docParaType" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element name="sect1" type="docSect1Type" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element name="internal" type="docInternalType" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="link" type="xsd:string" />
+ </xsd:complexType>
+
+ <xsd:complexType name="docCharType">
+ <xsd:attribute name="char" type="DoxCharRange"/>
+ </xsd:complexType>
+
+ <xsd:complexType name="docEmptyType"/>
+
+ <!-- Simple types -->
+
+ <xsd:simpleType name="DoxBool">
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="yes" />
+ <xsd:enumeration value="no" />
+ </xsd:restriction>
+ </xsd:simpleType>
+
+ <xsd:simpleType name="DoxGraphRelation">
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="include" />
+ <xsd:enumeration value="usage" />
+ <xsd:enumeration value="template-instance" />
+ <xsd:enumeration value="public-inheritance" />
+ <xsd:enumeration value="protected-inheritance" />
+ <xsd:enumeration value="private-inheritance" />
+ </xsd:restriction>
+ </xsd:simpleType>
+
+ <xsd:simpleType name="DoxRefKind">
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="compound" />
+ <xsd:enumeration value="member" />
+ </xsd:restriction>
+ </xsd:simpleType>
+
+ <xsd:simpleType name="DoxMemberKind">
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="define" />
+ <xsd:enumeration value="property" />
+ <xsd:enumeration value="event" />
+ <xsd:enumeration value="variable" />
+ <xsd:enumeration value="typedef" />
+ <xsd:enumeration value="enum" />
+ <xsd:enumeration value="function" />
+ <xsd:enumeration value="signal" />
+ <xsd:enumeration value="prototype" />
+ <xsd:enumeration value="friend" />
+ <xsd:enumeration value="dcop" />
+ <xsd:enumeration value="slot" />
+ </xsd:restriction>
+ </xsd:simpleType>
+
+ <xsd:simpleType name="DoxProtectionKind">
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="public" />
+ <xsd:enumeration value="protected" />
+ <xsd:enumeration value="private" />
+ <xsd:enumeration value="package" />
+ </xsd:restriction>
+ </xsd:simpleType>
+
+ <xsd:simpleType name="DoxVirtualKind">
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="non-virtual" />
+ <xsd:enumeration value="virtual" />
+ <xsd:enumeration value="pure-virtual" />
+ </xsd:restriction>
+ </xsd:simpleType>
+
+ <xsd:simpleType name="DoxCompoundKind">
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="class" />
+ <xsd:enumeration value="struct" />
+ <xsd:enumeration value="union" />
+ <xsd:enumeration value="interface" />
+ <xsd:enumeration value="protocol" />
+ <xsd:enumeration value="category" />
+ <xsd:enumeration value="exception" />
+ <xsd:enumeration value="file" />
+ <xsd:enumeration value="namespace" />
+ <xsd:enumeration value="group" />
+ <xsd:enumeration value="page" />
+ <xsd:enumeration value="example" />
+ <xsd:enumeration value="dir" />
+ </xsd:restriction>
+ </xsd:simpleType>
+
+ <xsd:simpleType name="DoxSectionKind">
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="user-defined" />
+ <xsd:enumeration value="public-type" />
+ <xsd:enumeration value="public-func" />
+ <xsd:enumeration value="public-attrib" />
+ <xsd:enumeration value="public-slot" />
+ <xsd:enumeration value="signal" />
+ <xsd:enumeration value="dcop-func" />
+ <xsd:enumeration value="property" />
+ <xsd:enumeration value="event" />
+ <xsd:enumeration value="public-static-func" />
+ <xsd:enumeration value="public-static-attrib" />
+ <xsd:enumeration value="protected-type" />
+ <xsd:enumeration value="protected-func" />
+ <xsd:enumeration value="protected-attrib" />
+ <xsd:enumeration value="protected-slot" />
+ <xsd:enumeration value="protected-static-func" />
+ <xsd:enumeration value="protected-static-attrib" />
+ <xsd:enumeration value="package-type" />
+ <xsd:enumeration value="package-func" />
+ <xsd:enumeration value="package-attrib" />
+ <xsd:enumeration value="package-static-func" />
+ <xsd:enumeration value="package-static-attrib" />
+ <xsd:enumeration value="private-type" />
+ <xsd:enumeration value="private-func" />
+ <xsd:enumeration value="private-attrib" />
+ <xsd:enumeration value="private-slot" />
+ <xsd:enumeration value="private-static-func" />
+ <xsd:enumeration value="private-static-attrib" />
+ <xsd:enumeration value="friend" />
+ <xsd:enumeration value="related" />
+ <xsd:enumeration value="define" />
+ <xsd:enumeration value="prototype" />
+ <xsd:enumeration value="typedef" />
+ <xsd:enumeration value="enum" />
+ <xsd:enumeration value="func" />
+ <xsd:enumeration value="var" />
+ </xsd:restriction>
+ </xsd:simpleType>
+
+ <xsd:simpleType name="DoxHighlightClass">
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="comment" />
+ <xsd:enumeration value="normal" />
+ <xsd:enumeration value="preprocessor" />
+ <xsd:enumeration value="keyword" />
+ <xsd:enumeration value="keywordtype" />
+ <xsd:enumeration value="keywordflow" />
+ <xsd:enumeration value="stringliteral" />
+ <xsd:enumeration value="charliteral" />
+ </xsd:restriction>
+ </xsd:simpleType>
+
+ <xsd:simpleType name="DoxSimpleSectKind">
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="see" />
+ <xsd:enumeration value="return" />
+ <xsd:enumeration value="author" />
+ <xsd:enumeration value="authors" />
+ <xsd:enumeration value="version" />
+ <xsd:enumeration value="since" />
+ <xsd:enumeration value="date" />
+ <xsd:enumeration value="note" />
+ <xsd:enumeration value="warning" />
+ <xsd:enumeration value="pre" />
+ <xsd:enumeration value="post" />
+ <xsd:enumeration value="invariant" />
+ <xsd:enumeration value="remark" />
+ <xsd:enumeration value="attention" />
+ <xsd:enumeration value="par" />
+ <xsd:enumeration value="rcs" />
+ </xsd:restriction>
+ </xsd:simpleType>
+
+ <xsd:simpleType name="DoxVersionNumber">
+ <xsd:restriction base="xsd:string">
+ <xsd:pattern value="\d+\.\d+.*" />
+ </xsd:restriction>
+ </xsd:simpleType>
+
+ <xsd:simpleType name="DoxImageKind">
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="html" />
+ <xsd:enumeration value="latex" />
+ <xsd:enumeration value="rtf" />
+ </xsd:restriction>
+ </xsd:simpleType>
+
+ <xsd:simpleType name="DoxParamListKind">
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="param" />
+ <xsd:enumeration value="retval" />
+ <xsd:enumeration value="exception" />
+ <xsd:enumeration value="templateparam" />
+ </xsd:restriction>
+ </xsd:simpleType>
+
+ <xsd:simpleType name="DoxCharRange">
+ <xsd:restriction base="xsd:string">
+ <xsd:pattern value="[aeiouncAEIOUNC]" />
+ </xsd:restriction>
+ </xsd:simpleType>
+
+ <xsd:simpleType name="DoxParamDir">
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="in"/>
+ <xsd:enumeration value="out"/>
+ <xsd:enumeration value="inout"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+
+ <xsd:simpleType name="DoxAccessor">
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="retain"/>
+ <xsd:enumeration value="copy"/>
+ <xsd:enumeration value="assign"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+
+</xsd:schema>
+
diff --git a/docs/doxygen/doxyxml/example/xml/index.xml b/docs/doxygen/doxyxml/example/xml/index.xml
new file mode 100644
index 000000000..13fd53f90
--- /dev/null
+++ b/docs/doxygen/doxyxml/example/xml/index.xml
@@ -0,0 +1,17 @@
+<?xml version='1.0' encoding='UTF-8' standalone='no'?>
+<doxygenindex xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="index.xsd" version="1.6.3">
+ <compound refid="classAadvark" kind="class"><name>Aadvark</name>
+ <member refid="classAadvark_1ab79eb58d7bb9d5ddfa5d6f783836cab9" kind="variable"><name>aadvarkness</name></member>
+ <member refid="classAadvark_1abd061aa5f998002e72080a34f512a059" kind="function"><name>print</name></member>
+ <member refid="classAadvark_1adf1a4b97a641411a74a04ab312484462" kind="function"><name>Aadvark</name></member>
+ <member refid="classAadvark_1affd2ada0a85807efcbe26615a848f53e" kind="function"><name>get_aadvarkness</name></member>
+ </compound>
+ <compound refid="aadvark_8cc" kind="file"><name>aadvark.cc</name>
+ <member refid="aadvark_8cc_1acb52858524210ec6dddc3e16d1e52946" kind="function"><name>aadvarky_enough</name></member>
+ <member refid="aadvark_8cc_1ae66f6b31b5ad750f1fe042a706a4e3d4" kind="function"><name>main</name></member>
+ </compound>
+ <compound refid="aadvark_8h" kind="file"><name>aadvark.h</name>
+ <member refid="aadvark_8h_1acb52858524210ec6dddc3e16d1e52946" kind="function"><name>aadvarky_enough</name></member>
+ <member refid="aadvark_8h_1ae66f6b31b5ad750f1fe042a706a4e3d4" kind="function"><name>main</name></member>
+ </compound>
+</doxygenindex>
diff --git a/docs/doxygen/doxyxml/example/xml/index.xsd b/docs/doxygen/doxyxml/example/xml/index.xsd
new file mode 100644
index 000000000..bfe960c0f
--- /dev/null
+++ b/docs/doxygen/doxyxml/example/xml/index.xsd
@@ -0,0 +1,66 @@
+<?xml version='1.0' encoding='utf-8' ?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <xsd:element name="doxygenindex" type="DoxygenType"/>
+
+ <xsd:complexType name="DoxygenType">
+ <xsd:sequence>
+ <xsd:element name="compound" type="CompoundType" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="version" type="xsd:string" use="required"/>
+ </xsd:complexType>
+
+ <xsd:complexType name="CompoundType">
+ <xsd:sequence>
+ <xsd:element name="name" type="xsd:string"/>
+ <xsd:element name="member" type="MemberType" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="refid" type="xsd:string" use="required"/>
+ <xsd:attribute name="kind" type="CompoundKind" use="required"/>
+ </xsd:complexType>
+
+ <xsd:complexType name="MemberType">
+ <xsd:sequence>
+ <xsd:element name="name" type="xsd:string"/>
+ </xsd:sequence>
+ <xsd:attribute name="refid" type="xsd:string" use="required"/>
+ <xsd:attribute name="kind" type="MemberKind" use="required"/>
+ </xsd:complexType>
+
+ <xsd:simpleType name="CompoundKind">
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="class"/>
+ <xsd:enumeration value="struct"/>
+ <xsd:enumeration value="union"/>
+ <xsd:enumeration value="interface"/>
+ <xsd:enumeration value="protocol"/>
+ <xsd:enumeration value="category"/>
+ <xsd:enumeration value="exception"/>
+ <xsd:enumeration value="file"/>
+ <xsd:enumeration value="namespace"/>
+ <xsd:enumeration value="group"/>
+ <xsd:enumeration value="page"/>
+ <xsd:enumeration value="example"/>
+ <xsd:enumeration value="dir"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+
+ <xsd:simpleType name="MemberKind">
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="define"/>
+ <xsd:enumeration value="property"/>
+ <xsd:enumeration value="event"/>
+ <xsd:enumeration value="variable"/>
+ <xsd:enumeration value="typedef"/>
+ <xsd:enumeration value="enum"/>
+ <xsd:enumeration value="enumvalue"/>
+ <xsd:enumeration value="function"/>
+ <xsd:enumeration value="signal"/>
+ <xsd:enumeration value="prototype"/>
+ <xsd:enumeration value="friend"/>
+ <xsd:enumeration value="dcop"/>
+ <xsd:enumeration value="slot"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+
+</xsd:schema>
+
diff --git a/docs/doxygen/doxyxml/generated/__init__.py b/docs/doxygen/doxyxml/generated/__init__.py
new file mode 100644
index 000000000..39823979f
--- /dev/null
+++ b/docs/doxygen/doxyxml/generated/__init__.py
@@ -0,0 +1,7 @@
+"""
+Contains generated files produced by generateDS.py.
+
+These do the real work of parsing the doxygen xml files but the
+resultant classes are not very friendly to navigate so the rest of the
+doxyxml module processes them further.
+"""
diff --git a/docs/doxygen/doxyxml/generated/compound.py b/docs/doxygen/doxyxml/generated/compound.py
new file mode 100644
index 000000000..1522ac23f
--- /dev/null
+++ b/docs/doxygen/doxyxml/generated/compound.py
@@ -0,0 +1,503 @@
+#!/usr/bin/env python
+
+"""
+Generated Mon Feb 9 19:08:05 2009 by generateDS.py.
+"""
+
+from string import lower as str_lower
+from xml.dom import minidom
+from xml.dom import Node
+
+import sys
+
+import compoundsuper as supermod
+from compoundsuper import MixedContainer
+
+
+class DoxygenTypeSub(supermod.DoxygenType):
+ def __init__(self, version=None, compounddef=None):
+ supermod.DoxygenType.__init__(self, version, compounddef)
+
+ def find(self, details):
+
+ return self.compounddef.find(details)
+
+supermod.DoxygenType.subclass = DoxygenTypeSub
+# end class DoxygenTypeSub
+
+
+class compounddefTypeSub(supermod.compounddefType):
+ def __init__(self, kind=None, prot=None, id=None, compoundname='', title='', basecompoundref=None, derivedcompoundref=None, includes=None, includedby=None, incdepgraph=None, invincdepgraph=None, innerdir=None, innerfile=None, innerclass=None, innernamespace=None, innerpage=None, innergroup=None, templateparamlist=None, sectiondef=None, briefdescription=None, detaileddescription=None, inheritancegraph=None, collaborationgraph=None, programlisting=None, location=None, listofallmembers=None):
+ supermod.compounddefType.__init__(self, kind, prot, id, compoundname, title, basecompoundref, derivedcompoundref, includes, includedby, incdepgraph, invincdepgraph, innerdir, innerfile, innerclass, innernamespace, innerpage, innergroup, templateparamlist, sectiondef, briefdescription, detaileddescription, inheritancegraph, collaborationgraph, programlisting, location, listofallmembers)
+
+ def find(self, details):
+
+ if self.id == details.refid:
+ return self
+
+ for sectiondef in self.sectiondef:
+ result = sectiondef.find(details)
+ if result:
+ return result
+
+
+supermod.compounddefType.subclass = compounddefTypeSub
+# end class compounddefTypeSub
+
+
+class listofallmembersTypeSub(supermod.listofallmembersType):
+ def __init__(self, member=None):
+ supermod.listofallmembersType.__init__(self, member)
+supermod.listofallmembersType.subclass = listofallmembersTypeSub
+# end class listofallmembersTypeSub
+
+
+class memberRefTypeSub(supermod.memberRefType):
+ def __init__(self, virt=None, prot=None, refid=None, ambiguityscope=None, scope='', name=''):
+ supermod.memberRefType.__init__(self, virt, prot, refid, ambiguityscope, scope, name)
+supermod.memberRefType.subclass = memberRefTypeSub
+# end class memberRefTypeSub
+
+
+class compoundRefTypeSub(supermod.compoundRefType):
+ def __init__(self, virt=None, prot=None, refid=None, valueOf_='', mixedclass_=None, content_=None):
+ supermod.compoundRefType.__init__(self, mixedclass_, content_)
+supermod.compoundRefType.subclass = compoundRefTypeSub
+# end class compoundRefTypeSub
+
+
+class reimplementTypeSub(supermod.reimplementType):
+ def __init__(self, refid=None, valueOf_='', mixedclass_=None, content_=None):
+ supermod.reimplementType.__init__(self, mixedclass_, content_)
+supermod.reimplementType.subclass = reimplementTypeSub
+# end class reimplementTypeSub
+
+
+class incTypeSub(supermod.incType):
+ def __init__(self, local=None, refid=None, valueOf_='', mixedclass_=None, content_=None):
+ supermod.incType.__init__(self, mixedclass_, content_)
+supermod.incType.subclass = incTypeSub
+# end class incTypeSub
+
+
+class refTypeSub(supermod.refType):
+ def __init__(self, prot=None, refid=None, valueOf_='', mixedclass_=None, content_=None):
+ supermod.refType.__init__(self, mixedclass_, content_)
+supermod.refType.subclass = refTypeSub
+# end class refTypeSub
+
+
+
+class refTextTypeSub(supermod.refTextType):
+ def __init__(self, refid=None, kindref=None, external=None, valueOf_='', mixedclass_=None, content_=None):
+ supermod.refTextType.__init__(self, mixedclass_, content_)
+
+supermod.refTextType.subclass = refTextTypeSub
+# end class refTextTypeSub
+
+class sectiondefTypeSub(supermod.sectiondefType):
+
+
+ def __init__(self, kind=None, header='', description=None, memberdef=None):
+ supermod.sectiondefType.__init__(self, kind, header, description, memberdef)
+
+ def find(self, details):
+
+ for memberdef in self.memberdef:
+ if memberdef.id == details.refid:
+ return memberdef
+
+ return None
+
+
+supermod.sectiondefType.subclass = sectiondefTypeSub
+# end class sectiondefTypeSub
+
+
+class memberdefTypeSub(supermod.memberdefType):
+ def __init__(self, initonly=None, kind=None, volatile=None, const=None, raise_=None, virt=None, readable=None, prot=None, explicit=None, new=None, final=None, writable=None, add=None, static=None, remove=None, sealed=None, mutable=None, gettable=None, inline=None, settable=None, id=None, templateparamlist=None, type_=None, definition='', argsstring='', name='', read='', write='', bitfield='', reimplements=None, reimplementedby=None, param=None, enumvalue=None, initializer=None, exceptions=None, briefdescription=None, detaileddescription=None, inbodydescription=None, location=None, references=None, referencedby=None):
+ supermod.memberdefType.__init__(self, initonly, kind, volatile, const, raise_, virt, readable, prot, explicit, new, final, writable, add, static, remove, sealed, mutable, gettable, inline, settable, id, templateparamlist, type_, definition, argsstring, name, read, write, bitfield, reimplements, reimplementedby, param, enumvalue, initializer, exceptions, briefdescription, detaileddescription, inbodydescription, location, references, referencedby)
+supermod.memberdefType.subclass = memberdefTypeSub
+# end class memberdefTypeSub
+
+
+class descriptionTypeSub(supermod.descriptionType):
+ def __init__(self, title='', para=None, sect1=None, internal=None, mixedclass_=None, content_=None):
+ supermod.descriptionType.__init__(self, mixedclass_, content_)
+supermod.descriptionType.subclass = descriptionTypeSub
+# end class descriptionTypeSub
+
+
+class enumvalueTypeSub(supermod.enumvalueType):
+ def __init__(self, prot=None, id=None, name='', initializer=None, briefdescription=None, detaileddescription=None, mixedclass_=None, content_=None):
+ supermod.enumvalueType.__init__(self, mixedclass_, content_)
+supermod.enumvalueType.subclass = enumvalueTypeSub
+# end class enumvalueTypeSub
+
+
+class templateparamlistTypeSub(supermod.templateparamlistType):
+ def __init__(self, param=None):
+ supermod.templateparamlistType.__init__(self, param)
+supermod.templateparamlistType.subclass = templateparamlistTypeSub
+# end class templateparamlistTypeSub
+
+
+class paramTypeSub(supermod.paramType):
+ def __init__(self, type_=None, declname='', defname='', array='', defval=None, briefdescription=None):
+ supermod.paramType.__init__(self, type_, declname, defname, array, defval, briefdescription)
+supermod.paramType.subclass = paramTypeSub
+# end class paramTypeSub
+
+
+class linkedTextTypeSub(supermod.linkedTextType):
+ def __init__(self, ref=None, mixedclass_=None, content_=None):
+ supermod.linkedTextType.__init__(self, mixedclass_, content_)
+supermod.linkedTextType.subclass = linkedTextTypeSub
+# end class linkedTextTypeSub
+
+
+class graphTypeSub(supermod.graphType):
+ def __init__(self, node=None):
+ supermod.graphType.__init__(self, node)
+supermod.graphType.subclass = graphTypeSub
+# end class graphTypeSub
+
+
+class nodeTypeSub(supermod.nodeType):
+ def __init__(self, id=None, label='', link=None, childnode=None):
+ supermod.nodeType.__init__(self, id, label, link, childnode)
+supermod.nodeType.subclass = nodeTypeSub
+# end class nodeTypeSub
+
+
+class childnodeTypeSub(supermod.childnodeType):
+ def __init__(self, relation=None, refid=None, edgelabel=None):
+ supermod.childnodeType.__init__(self, relation, refid, edgelabel)
+supermod.childnodeType.subclass = childnodeTypeSub
+# end class childnodeTypeSub
+
+
+class linkTypeSub(supermod.linkType):
+ def __init__(self, refid=None, external=None, valueOf_=''):
+ supermod.linkType.__init__(self, refid, external)
+supermod.linkType.subclass = linkTypeSub
+# end class linkTypeSub
+
+
+class listingTypeSub(supermod.listingType):
+ def __init__(self, codeline=None):
+ supermod.listingType.__init__(self, codeline)
+supermod.listingType.subclass = listingTypeSub
+# end class listingTypeSub
+
+
+class codelineTypeSub(supermod.codelineType):
+ def __init__(self, external=None, lineno=None, refkind=None, refid=None, highlight=None):
+ supermod.codelineType.__init__(self, external, lineno, refkind, refid, highlight)
+supermod.codelineType.subclass = codelineTypeSub
+# end class codelineTypeSub
+
+
+class highlightTypeSub(supermod.highlightType):
+ def __init__(self, class_=None, sp=None, ref=None, mixedclass_=None, content_=None):
+ supermod.highlightType.__init__(self, mixedclass_, content_)
+supermod.highlightType.subclass = highlightTypeSub
+# end class highlightTypeSub
+
+
+class referenceTypeSub(supermod.referenceType):
+ def __init__(self, endline=None, startline=None, refid=None, compoundref=None, valueOf_='', mixedclass_=None, content_=None):
+ supermod.referenceType.__init__(self, mixedclass_, content_)
+supermod.referenceType.subclass = referenceTypeSub
+# end class referenceTypeSub
+
+
+class locationTypeSub(supermod.locationType):
+ def __init__(self, bodystart=None, line=None, bodyend=None, bodyfile=None, file=None, valueOf_=''):
+ supermod.locationType.__init__(self, bodystart, line, bodyend, bodyfile, file)
+supermod.locationType.subclass = locationTypeSub
+# end class locationTypeSub
+
+
+class docSect1TypeSub(supermod.docSect1Type):
+ def __init__(self, id=None, title='', para=None, sect2=None, internal=None, mixedclass_=None, content_=None):
+ supermod.docSect1Type.__init__(self, mixedclass_, content_)
+supermod.docSect1Type.subclass = docSect1TypeSub
+# end class docSect1TypeSub
+
+
+class docSect2TypeSub(supermod.docSect2Type):
+ def __init__(self, id=None, title='', para=None, sect3=None, internal=None, mixedclass_=None, content_=None):
+ supermod.docSect2Type.__init__(self, mixedclass_, content_)
+supermod.docSect2Type.subclass = docSect2TypeSub
+# end class docSect2TypeSub
+
+
+class docSect3TypeSub(supermod.docSect3Type):
+ def __init__(self, id=None, title='', para=None, sect4=None, internal=None, mixedclass_=None, content_=None):
+ supermod.docSect3Type.__init__(self, mixedclass_, content_)
+supermod.docSect3Type.subclass = docSect3TypeSub
+# end class docSect3TypeSub
+
+
+class docSect4TypeSub(supermod.docSect4Type):
+ def __init__(self, id=None, title='', para=None, internal=None, mixedclass_=None, content_=None):
+ supermod.docSect4Type.__init__(self, mixedclass_, content_)
+supermod.docSect4Type.subclass = docSect4TypeSub
+# end class docSect4TypeSub
+
+
+class docInternalTypeSub(supermod.docInternalType):
+ def __init__(self, para=None, sect1=None, mixedclass_=None, content_=None):
+ supermod.docInternalType.__init__(self, mixedclass_, content_)
+supermod.docInternalType.subclass = docInternalTypeSub
+# end class docInternalTypeSub
+
+
+class docInternalS1TypeSub(supermod.docInternalS1Type):
+ def __init__(self, para=None, sect2=None, mixedclass_=None, content_=None):
+ supermod.docInternalS1Type.__init__(self, mixedclass_, content_)
+supermod.docInternalS1Type.subclass = docInternalS1TypeSub
+# end class docInternalS1TypeSub
+
+
+class docInternalS2TypeSub(supermod.docInternalS2Type):
+ def __init__(self, para=None, sect3=None, mixedclass_=None, content_=None):
+ supermod.docInternalS2Type.__init__(self, mixedclass_, content_)
+supermod.docInternalS2Type.subclass = docInternalS2TypeSub
+# end class docInternalS2TypeSub
+
+
+class docInternalS3TypeSub(supermod.docInternalS3Type):
+ def __init__(self, para=None, sect3=None, mixedclass_=None, content_=None):
+ supermod.docInternalS3Type.__init__(self, mixedclass_, content_)
+supermod.docInternalS3Type.subclass = docInternalS3TypeSub
+# end class docInternalS3TypeSub
+
+
+class docInternalS4TypeSub(supermod.docInternalS4Type):
+ def __init__(self, para=None, mixedclass_=None, content_=None):
+ supermod.docInternalS4Type.__init__(self, mixedclass_, content_)
+supermod.docInternalS4Type.subclass = docInternalS4TypeSub
+# end class docInternalS4TypeSub
+
+
+class docURLLinkSub(supermod.docURLLink):
+ def __init__(self, url=None, valueOf_='', mixedclass_=None, content_=None):
+ supermod.docURLLink.__init__(self, mixedclass_, content_)
+supermod.docURLLink.subclass = docURLLinkSub
+# end class docURLLinkSub
+
+
+class docAnchorTypeSub(supermod.docAnchorType):
+ def __init__(self, id=None, valueOf_='', mixedclass_=None, content_=None):
+ supermod.docAnchorType.__init__(self, mixedclass_, content_)
+supermod.docAnchorType.subclass = docAnchorTypeSub
+# end class docAnchorTypeSub
+
+
+class docFormulaTypeSub(supermod.docFormulaType):
+ def __init__(self, id=None, valueOf_='', mixedclass_=None, content_=None):
+ supermod.docFormulaType.__init__(self, mixedclass_, content_)
+supermod.docFormulaType.subclass = docFormulaTypeSub
+# end class docFormulaTypeSub
+
+
+class docIndexEntryTypeSub(supermod.docIndexEntryType):
+ def __init__(self, primaryie='', secondaryie=''):
+ supermod.docIndexEntryType.__init__(self, primaryie, secondaryie)
+supermod.docIndexEntryType.subclass = docIndexEntryTypeSub
+# end class docIndexEntryTypeSub
+
+
+class docListTypeSub(supermod.docListType):
+ def __init__(self, listitem=None):
+ supermod.docListType.__init__(self, listitem)
+supermod.docListType.subclass = docListTypeSub
+# end class docListTypeSub
+
+
+class docListItemTypeSub(supermod.docListItemType):
+ def __init__(self, para=None):
+ supermod.docListItemType.__init__(self, para)
+supermod.docListItemType.subclass = docListItemTypeSub
+# end class docListItemTypeSub
+
+
+class docSimpleSectTypeSub(supermod.docSimpleSectType):
+ def __init__(self, kind=None, title=None, para=None):
+ supermod.docSimpleSectType.__init__(self, kind, title, para)
+supermod.docSimpleSectType.subclass = docSimpleSectTypeSub
+# end class docSimpleSectTypeSub
+
+
+class docVarListEntryTypeSub(supermod.docVarListEntryType):
+ def __init__(self, term=None):
+ supermod.docVarListEntryType.__init__(self, term)
+supermod.docVarListEntryType.subclass = docVarListEntryTypeSub
+# end class docVarListEntryTypeSub
+
+
+class docRefTextTypeSub(supermod.docRefTextType):
+ def __init__(self, refid=None, kindref=None, external=None, valueOf_='', mixedclass_=None, content_=None):
+ supermod.docRefTextType.__init__(self, mixedclass_, content_)
+supermod.docRefTextType.subclass = docRefTextTypeSub
+# end class docRefTextTypeSub
+
+
+class docTableTypeSub(supermod.docTableType):
+ def __init__(self, rows=None, cols=None, row=None, caption=None):
+ supermod.docTableType.__init__(self, rows, cols, row, caption)
+supermod.docTableType.subclass = docTableTypeSub
+# end class docTableTypeSub
+
+
+class docRowTypeSub(supermod.docRowType):
+ def __init__(self, entry=None):
+ supermod.docRowType.__init__(self, entry)
+supermod.docRowType.subclass = docRowTypeSub
+# end class docRowTypeSub
+
+
+class docEntryTypeSub(supermod.docEntryType):
+ def __init__(self, thead=None, para=None):
+ supermod.docEntryType.__init__(self, thead, para)
+supermod.docEntryType.subclass = docEntryTypeSub
+# end class docEntryTypeSub
+
+
+class docHeadingTypeSub(supermod.docHeadingType):
+ def __init__(self, level=None, valueOf_='', mixedclass_=None, content_=None):
+ supermod.docHeadingType.__init__(self, mixedclass_, content_)
+supermod.docHeadingType.subclass = docHeadingTypeSub
+# end class docHeadingTypeSub
+
+
+class docImageTypeSub(supermod.docImageType):
+ def __init__(self, width=None, type_=None, name=None, height=None, valueOf_='', mixedclass_=None, content_=None):
+ supermod.docImageType.__init__(self, mixedclass_, content_)
+supermod.docImageType.subclass = docImageTypeSub
+# end class docImageTypeSub
+
+
+class docDotFileTypeSub(supermod.docDotFileType):
+ def __init__(self, name=None, valueOf_='', mixedclass_=None, content_=None):
+ supermod.docDotFileType.__init__(self, mixedclass_, content_)
+supermod.docDotFileType.subclass = docDotFileTypeSub
+# end class docDotFileTypeSub
+
+
+class docTocItemTypeSub(supermod.docTocItemType):
+ def __init__(self, id=None, valueOf_='', mixedclass_=None, content_=None):
+ supermod.docTocItemType.__init__(self, mixedclass_, content_)
+supermod.docTocItemType.subclass = docTocItemTypeSub
+# end class docTocItemTypeSub
+
+
+class docTocListTypeSub(supermod.docTocListType):
+ def __init__(self, tocitem=None):
+ supermod.docTocListType.__init__(self, tocitem)
+supermod.docTocListType.subclass = docTocListTypeSub
+# end class docTocListTypeSub
+
+
+class docLanguageTypeSub(supermod.docLanguageType):
+ def __init__(self, langid=None, para=None):
+ supermod.docLanguageType.__init__(self, langid, para)
+supermod.docLanguageType.subclass = docLanguageTypeSub
+# end class docLanguageTypeSub
+
+
+class docParamListTypeSub(supermod.docParamListType):
+ def __init__(self, kind=None, parameteritem=None):
+ supermod.docParamListType.__init__(self, kind, parameteritem)
+supermod.docParamListType.subclass = docParamListTypeSub
+# end class docParamListTypeSub
+
+
+class docParamListItemSub(supermod.docParamListItem):
+ def __init__(self, parameternamelist=None, parameterdescription=None):
+ supermod.docParamListItem.__init__(self, parameternamelist, parameterdescription)
+supermod.docParamListItem.subclass = docParamListItemSub
+# end class docParamListItemSub
+
+
+class docParamNameListSub(supermod.docParamNameList):
+ def __init__(self, parametername=None):
+ supermod.docParamNameList.__init__(self, parametername)
+supermod.docParamNameList.subclass = docParamNameListSub
+# end class docParamNameListSub
+
+
+class docParamNameSub(supermod.docParamName):
+ def __init__(self, direction=None, ref=None, mixedclass_=None, content_=None):
+ supermod.docParamName.__init__(self, mixedclass_, content_)
+supermod.docParamName.subclass = docParamNameSub
+# end class docParamNameSub
+
+
+class docXRefSectTypeSub(supermod.docXRefSectType):
+ def __init__(self, id=None, xreftitle=None, xrefdescription=None):
+ supermod.docXRefSectType.__init__(self, id, xreftitle, xrefdescription)
+supermod.docXRefSectType.subclass = docXRefSectTypeSub
+# end class docXRefSectTypeSub
+
+
+class docCopyTypeSub(supermod.docCopyType):
+ def __init__(self, link=None, para=None, sect1=None, internal=None):
+ supermod.docCopyType.__init__(self, link, para, sect1, internal)
+supermod.docCopyType.subclass = docCopyTypeSub
+# end class docCopyTypeSub
+
+
+class docCharTypeSub(supermod.docCharType):
+ def __init__(self, char=None, valueOf_=''):
+ supermod.docCharType.__init__(self, char)
+supermod.docCharType.subclass = docCharTypeSub
+# end class docCharTypeSub
+
+class docParaTypeSub(supermod.docParaType):
+ def __init__(self, char=None, valueOf_=''):
+ supermod.docParaType.__init__(self, char)
+
+ self.parameterlist = []
+ self.simplesects = []
+ self.content = []
+
+ def buildChildren(self, child_, nodeName_):
+ supermod.docParaType.buildChildren(self, child_, nodeName_)
+
+ if child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == "ref":
+ obj_ = supermod.docRefTextType.factory()
+ obj_.build(child_)
+ self.content.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'parameterlist':
+ obj_ = supermod.docParamListType.factory()
+ obj_.build(child_)
+ self.parameterlist.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'simplesect':
+ obj_ = supermod.docSimpleSectType.factory()
+ obj_.build(child_)
+ self.simplesects.append(obj_)
+
+
+supermod.docParaType.subclass = docParaTypeSub
+# end class docParaTypeSub
+
+
+
+def parse(inFilename):
+ doc = minidom.parse(inFilename)
+ rootNode = doc.documentElement
+ rootObj = supermod.DoxygenType.factory()
+ rootObj.build(rootNode)
+ return rootObj
+
+
diff --git a/docs/doxygen/doxyxml/generated/compoundsuper.py b/docs/doxygen/doxyxml/generated/compoundsuper.py
new file mode 100644
index 000000000..6255dda16
--- /dev/null
+++ b/docs/doxygen/doxyxml/generated/compoundsuper.py
@@ -0,0 +1,8342 @@
+#!/usr/bin/env python
+
+#
+# Generated Thu Jun 11 18:44:25 2009 by generateDS.py.
+#
+
+import sys
+import getopt
+from string import lower as str_lower
+from xml.dom import minidom
+from xml.dom import Node
+
+#
+# User methods
+#
+# Calls to the methods in these classes are generated by generateDS.py.
+# You can replace these methods by re-implementing the following class
+# in a module named generatedssuper.py.
+
+try:
+ from generatedssuper import GeneratedsSuper
+except ImportError, exp:
+
+ class GeneratedsSuper:
+ def format_string(self, input_data, input_name=''):
+ return input_data
+ def format_integer(self, input_data, input_name=''):
+ return '%d' % input_data
+ def format_float(self, input_data, input_name=''):
+ return '%f' % input_data
+ def format_double(self, input_data, input_name=''):
+ return '%e' % input_data
+ def format_boolean(self, input_data, input_name=''):
+ return '%s' % input_data
+
+
+#
+# If you have installed IPython you can uncomment and use the following.
+# IPython is available from http://ipython.scipy.org/.
+#
+
+## from IPython.Shell import IPShellEmbed
+## args = ''
+## ipshell = IPShellEmbed(args,
+## banner = 'Dropping into IPython',
+## exit_msg = 'Leaving Interpreter, back to program.')
+
+# Then use the following line where and when you want to drop into the
+# IPython shell:
+# ipshell('<some message> -- Entering ipshell.\nHit Ctrl-D to exit')
+
+#
+# Globals
+#
+
+ExternalEncoding = 'ascii'
+
+#
+# Support/utility functions.
+#
+
+def showIndent(outfile, level):
+ for idx in range(level):
+ outfile.write(' ')
+
+def quote_xml(inStr):
+ s1 = (isinstance(inStr, basestring) and inStr or
+ '%s' % inStr)
+ s1 = s1.replace('&', '&amp;')
+ s1 = s1.replace('<', '&lt;')
+ s1 = s1.replace('>', '&gt;')
+ return s1
+
+def quote_attrib(inStr):
+ s1 = (isinstance(inStr, basestring) and inStr or
+ '%s' % inStr)
+ s1 = s1.replace('&', '&amp;')
+ s1 = s1.replace('<', '&lt;')
+ s1 = s1.replace('>', '&gt;')
+ if '"' in s1:
+ if "'" in s1:
+ s1 = '"%s"' % s1.replace('"', "&quot;")
+ else:
+ s1 = "'%s'" % s1
+ else:
+ s1 = '"%s"' % s1
+ return s1
+
+def quote_python(inStr):
+ s1 = inStr
+ if s1.find("'") == -1:
+ if s1.find('\n') == -1:
+ return "'%s'" % s1
+ else:
+ return "'''%s'''" % s1
+ else:
+ if s1.find('"') != -1:
+ s1 = s1.replace('"', '\\"')
+ if s1.find('\n') == -1:
+ return '"%s"' % s1
+ else:
+ return '"""%s"""' % s1
+
+
+class MixedContainer:
+ # Constants for category:
+ CategoryNone = 0
+ CategoryText = 1
+ CategorySimple = 2
+ CategoryComplex = 3
+ # Constants for content_type:
+ TypeNone = 0
+ TypeText = 1
+ TypeString = 2
+ TypeInteger = 3
+ TypeFloat = 4
+ TypeDecimal = 5
+ TypeDouble = 6
+ TypeBoolean = 7
+ def __init__(self, category, content_type, name, value):
+ self.category = category
+ self.content_type = content_type
+ self.name = name
+ self.value = value
+ def getCategory(self):
+ return self.category
+ def getContenttype(self, content_type):
+ return self.content_type
+ def getValue(self):
+ return self.value
+ def getName(self):
+ return self.name
+ def export(self, outfile, level, name, namespace):
+ if self.category == MixedContainer.CategoryText:
+ outfile.write(self.value)
+ elif self.category == MixedContainer.CategorySimple:
+ self.exportSimple(outfile, level, name)
+ else: # category == MixedContainer.CategoryComplex
+ self.value.export(outfile, level, namespace,name)
+ def exportSimple(self, outfile, level, name):
+ if self.content_type == MixedContainer.TypeString:
+ outfile.write('<%s>%s</%s>' % (self.name, self.value, self.name))
+ elif self.content_type == MixedContainer.TypeInteger or \
+ self.content_type == MixedContainer.TypeBoolean:
+ outfile.write('<%s>%d</%s>' % (self.name, self.value, self.name))
+ elif self.content_type == MixedContainer.TypeFloat or \
+ self.content_type == MixedContainer.TypeDecimal:
+ outfile.write('<%s>%f</%s>' % (self.name, self.value, self.name))
+ elif self.content_type == MixedContainer.TypeDouble:
+ outfile.write('<%s>%g</%s>' % (self.name, self.value, self.name))
+ def exportLiteral(self, outfile, level, name):
+ if self.category == MixedContainer.CategoryText:
+ showIndent(outfile, level)
+ outfile.write('MixedContainer(%d, %d, "%s", "%s"),\n' % \
+ (self.category, self.content_type, self.name, self.value))
+ elif self.category == MixedContainer.CategorySimple:
+ showIndent(outfile, level)
+ outfile.write('MixedContainer(%d, %d, "%s", "%s"),\n' % \
+ (self.category, self.content_type, self.name, self.value))
+ else: # category == MixedContainer.CategoryComplex
+ showIndent(outfile, level)
+ outfile.write('MixedContainer(%d, %d, "%s",\n' % \
+ (self.category, self.content_type, self.name,))
+ self.value.exportLiteral(outfile, level + 1)
+ showIndent(outfile, level)
+ outfile.write(')\n')
+
+
+class _MemberSpec(object):
+ def __init__(self, name='', data_type='', container=0):
+ self.name = name
+ self.data_type = data_type
+ self.container = container
+ def set_name(self, name): self.name = name
+ def get_name(self): return self.name
+ def set_data_type(self, data_type): self.data_type = data_type
+ def get_data_type(self): return self.data_type
+ def set_container(self, container): self.container = container
+ def get_container(self): return self.container
+
+
+#
+# Data representation classes.
+#
+
+class DoxygenType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, version=None, compounddef=None):
+ self.version = version
+ self.compounddef = compounddef
+ def factory(*args_, **kwargs_):
+ if DoxygenType.subclass:
+ return DoxygenType.subclass(*args_, **kwargs_)
+ else:
+ return DoxygenType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_compounddef(self): return self.compounddef
+ def set_compounddef(self, compounddef): self.compounddef = compounddef
+ def get_version(self): return self.version
+ def set_version(self, version): self.version = version
+ def export(self, outfile, level, namespace_='', name_='DoxygenType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='DoxygenType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='DoxygenType'):
+ outfile.write(' version=%s' % (quote_attrib(self.version), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='DoxygenType'):
+ if self.compounddef:
+ self.compounddef.export(outfile, level, namespace_, name_='compounddef')
+ def hasContent_(self):
+ if (
+ self.compounddef is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='DoxygenType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.version is not None:
+ showIndent(outfile, level)
+ outfile.write('version = "%s",\n' % (self.version,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ if self.compounddef:
+ showIndent(outfile, level)
+ outfile.write('compounddef=model_.compounddefType(\n')
+ self.compounddef.exportLiteral(outfile, level, name_='compounddef')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('version'):
+ self.version = attrs.get('version').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'compounddef':
+ obj_ = compounddefType.factory()
+ obj_.build(child_)
+ self.set_compounddef(obj_)
+# end class DoxygenType
+
+
+class compounddefType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, kind=None, prot=None, id=None, compoundname=None, title=None, basecompoundref=None, derivedcompoundref=None, includes=None, includedby=None, incdepgraph=None, invincdepgraph=None, innerdir=None, innerfile=None, innerclass=None, innernamespace=None, innerpage=None, innergroup=None, templateparamlist=None, sectiondef=None, briefdescription=None, detaileddescription=None, inheritancegraph=None, collaborationgraph=None, programlisting=None, location=None, listofallmembers=None):
+ self.kind = kind
+ self.prot = prot
+ self.id = id
+ self.compoundname = compoundname
+ self.title = title
+ if basecompoundref is None:
+ self.basecompoundref = []
+ else:
+ self.basecompoundref = basecompoundref
+ if derivedcompoundref is None:
+ self.derivedcompoundref = []
+ else:
+ self.derivedcompoundref = derivedcompoundref
+ if includes is None:
+ self.includes = []
+ else:
+ self.includes = includes
+ if includedby is None:
+ self.includedby = []
+ else:
+ self.includedby = includedby
+ self.incdepgraph = incdepgraph
+ self.invincdepgraph = invincdepgraph
+ if innerdir is None:
+ self.innerdir = []
+ else:
+ self.innerdir = innerdir
+ if innerfile is None:
+ self.innerfile = []
+ else:
+ self.innerfile = innerfile
+ if innerclass is None:
+ self.innerclass = []
+ else:
+ self.innerclass = innerclass
+ if innernamespace is None:
+ self.innernamespace = []
+ else:
+ self.innernamespace = innernamespace
+ if innerpage is None:
+ self.innerpage = []
+ else:
+ self.innerpage = innerpage
+ if innergroup is None:
+ self.innergroup = []
+ else:
+ self.innergroup = innergroup
+ self.templateparamlist = templateparamlist
+ if sectiondef is None:
+ self.sectiondef = []
+ else:
+ self.sectiondef = sectiondef
+ self.briefdescription = briefdescription
+ self.detaileddescription = detaileddescription
+ self.inheritancegraph = inheritancegraph
+ self.collaborationgraph = collaborationgraph
+ self.programlisting = programlisting
+ self.location = location
+ self.listofallmembers = listofallmembers
+ def factory(*args_, **kwargs_):
+ if compounddefType.subclass:
+ return compounddefType.subclass(*args_, **kwargs_)
+ else:
+ return compounddefType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_compoundname(self): return self.compoundname
+ def set_compoundname(self, compoundname): self.compoundname = compoundname
+ def get_title(self): return self.title
+ def set_title(self, title): self.title = title
+ def get_basecompoundref(self): return self.basecompoundref
+ def set_basecompoundref(self, basecompoundref): self.basecompoundref = basecompoundref
+ def add_basecompoundref(self, value): self.basecompoundref.append(value)
+ def insert_basecompoundref(self, index, value): self.basecompoundref[index] = value
+ def get_derivedcompoundref(self): return self.derivedcompoundref
+ def set_derivedcompoundref(self, derivedcompoundref): self.derivedcompoundref = derivedcompoundref
+ def add_derivedcompoundref(self, value): self.derivedcompoundref.append(value)
+ def insert_derivedcompoundref(self, index, value): self.derivedcompoundref[index] = value
+ def get_includes(self): return self.includes
+ def set_includes(self, includes): self.includes = includes
+ def add_includes(self, value): self.includes.append(value)
+ def insert_includes(self, index, value): self.includes[index] = value
+ def get_includedby(self): return self.includedby
+ def set_includedby(self, includedby): self.includedby = includedby
+ def add_includedby(self, value): self.includedby.append(value)
+ def insert_includedby(self, index, value): self.includedby[index] = value
+ def get_incdepgraph(self): return self.incdepgraph
+ def set_incdepgraph(self, incdepgraph): self.incdepgraph = incdepgraph
+ def get_invincdepgraph(self): return self.invincdepgraph
+ def set_invincdepgraph(self, invincdepgraph): self.invincdepgraph = invincdepgraph
+ def get_innerdir(self): return self.innerdir
+ def set_innerdir(self, innerdir): self.innerdir = innerdir
+ def add_innerdir(self, value): self.innerdir.append(value)
+ def insert_innerdir(self, index, value): self.innerdir[index] = value
+ def get_innerfile(self): return self.innerfile
+ def set_innerfile(self, innerfile): self.innerfile = innerfile
+ def add_innerfile(self, value): self.innerfile.append(value)
+ def insert_innerfile(self, index, value): self.innerfile[index] = value
+ def get_innerclass(self): return self.innerclass
+ def set_innerclass(self, innerclass): self.innerclass = innerclass
+ def add_innerclass(self, value): self.innerclass.append(value)
+ def insert_innerclass(self, index, value): self.innerclass[index] = value
+ def get_innernamespace(self): return self.innernamespace
+ def set_innernamespace(self, innernamespace): self.innernamespace = innernamespace
+ def add_innernamespace(self, value): self.innernamespace.append(value)
+ def insert_innernamespace(self, index, value): self.innernamespace[index] = value
+ def get_innerpage(self): return self.innerpage
+ def set_innerpage(self, innerpage): self.innerpage = innerpage
+ def add_innerpage(self, value): self.innerpage.append(value)
+ def insert_innerpage(self, index, value): self.innerpage[index] = value
+ def get_innergroup(self): return self.innergroup
+ def set_innergroup(self, innergroup): self.innergroup = innergroup
+ def add_innergroup(self, value): self.innergroup.append(value)
+ def insert_innergroup(self, index, value): self.innergroup[index] = value
+ def get_templateparamlist(self): return self.templateparamlist
+ def set_templateparamlist(self, templateparamlist): self.templateparamlist = templateparamlist
+ def get_sectiondef(self): return self.sectiondef
+ def set_sectiondef(self, sectiondef): self.sectiondef = sectiondef
+ def add_sectiondef(self, value): self.sectiondef.append(value)
+ def insert_sectiondef(self, index, value): self.sectiondef[index] = value
+ def get_briefdescription(self): return self.briefdescription
+ def set_briefdescription(self, briefdescription): self.briefdescription = briefdescription
+ def get_detaileddescription(self): return self.detaileddescription
+ def set_detaileddescription(self, detaileddescription): self.detaileddescription = detaileddescription
+ def get_inheritancegraph(self): return self.inheritancegraph
+ def set_inheritancegraph(self, inheritancegraph): self.inheritancegraph = inheritancegraph
+ def get_collaborationgraph(self): return self.collaborationgraph
+ def set_collaborationgraph(self, collaborationgraph): self.collaborationgraph = collaborationgraph
+ def get_programlisting(self): return self.programlisting
+ def set_programlisting(self, programlisting): self.programlisting = programlisting
+ def get_location(self): return self.location
+ def set_location(self, location): self.location = location
+ def get_listofallmembers(self): return self.listofallmembers
+ def set_listofallmembers(self, listofallmembers): self.listofallmembers = listofallmembers
+ def get_kind(self): return self.kind
+ def set_kind(self, kind): self.kind = kind
+ def get_prot(self): return self.prot
+ def set_prot(self, prot): self.prot = prot
+ def get_id(self): return self.id
+ def set_id(self, id): self.id = id
+ def export(self, outfile, level, namespace_='', name_='compounddefType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='compounddefType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='compounddefType'):
+ if self.kind is not None:
+ outfile.write(' kind=%s' % (quote_attrib(self.kind), ))
+ if self.prot is not None:
+ outfile.write(' prot=%s' % (quote_attrib(self.prot), ))
+ if self.id is not None:
+ outfile.write(' id=%s' % (self.format_string(quote_attrib(self.id).encode(ExternalEncoding), input_name='id'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='compounddefType'):
+ if self.compoundname is not None:
+ showIndent(outfile, level)
+ outfile.write('<%scompoundname>%s</%scompoundname>\n' % (namespace_, self.format_string(quote_xml(self.compoundname).encode(ExternalEncoding), input_name='compoundname'), namespace_))
+ if self.title is not None:
+ showIndent(outfile, level)
+ outfile.write('<%stitle>%s</%stitle>\n' % (namespace_, self.format_string(quote_xml(self.title).encode(ExternalEncoding), input_name='title'), namespace_))
+ for basecompoundref_ in self.basecompoundref:
+ basecompoundref_.export(outfile, level, namespace_, name_='basecompoundref')
+ for derivedcompoundref_ in self.derivedcompoundref:
+ derivedcompoundref_.export(outfile, level, namespace_, name_='derivedcompoundref')
+ for includes_ in self.includes:
+ includes_.export(outfile, level, namespace_, name_='includes')
+ for includedby_ in self.includedby:
+ includedby_.export(outfile, level, namespace_, name_='includedby')
+ if self.incdepgraph:
+ self.incdepgraph.export(outfile, level, namespace_, name_='incdepgraph')
+ if self.invincdepgraph:
+ self.invincdepgraph.export(outfile, level, namespace_, name_='invincdepgraph')
+ for innerdir_ in self.innerdir:
+ innerdir_.export(outfile, level, namespace_, name_='innerdir')
+ for innerfile_ in self.innerfile:
+ innerfile_.export(outfile, level, namespace_, name_='innerfile')
+ for innerclass_ in self.innerclass:
+ innerclass_.export(outfile, level, namespace_, name_='innerclass')
+ for innernamespace_ in self.innernamespace:
+ innernamespace_.export(outfile, level, namespace_, name_='innernamespace')
+ for innerpage_ in self.innerpage:
+ innerpage_.export(outfile, level, namespace_, name_='innerpage')
+ for innergroup_ in self.innergroup:
+ innergroup_.export(outfile, level, namespace_, name_='innergroup')
+ if self.templateparamlist:
+ self.templateparamlist.export(outfile, level, namespace_, name_='templateparamlist')
+ for sectiondef_ in self.sectiondef:
+ sectiondef_.export(outfile, level, namespace_, name_='sectiondef')
+ if self.briefdescription:
+ self.briefdescription.export(outfile, level, namespace_, name_='briefdescription')
+ if self.detaileddescription:
+ self.detaileddescription.export(outfile, level, namespace_, name_='detaileddescription')
+ if self.inheritancegraph:
+ self.inheritancegraph.export(outfile, level, namespace_, name_='inheritancegraph')
+ if self.collaborationgraph:
+ self.collaborationgraph.export(outfile, level, namespace_, name_='collaborationgraph')
+ if self.programlisting:
+ self.programlisting.export(outfile, level, namespace_, name_='programlisting')
+ if self.location:
+ self.location.export(outfile, level, namespace_, name_='location')
+ if self.listofallmembers:
+ self.listofallmembers.export(outfile, level, namespace_, name_='listofallmembers')
+ def hasContent_(self):
+ if (
+ self.compoundname is not None or
+ self.title is not None or
+ self.basecompoundref is not None or
+ self.derivedcompoundref is not None or
+ self.includes is not None or
+ self.includedby is not None or
+ self.incdepgraph is not None or
+ self.invincdepgraph is not None or
+ self.innerdir is not None or
+ self.innerfile is not None or
+ self.innerclass is not None or
+ self.innernamespace is not None or
+ self.innerpage is not None or
+ self.innergroup is not None or
+ self.templateparamlist is not None or
+ self.sectiondef is not None or
+ self.briefdescription is not None or
+ self.detaileddescription is not None or
+ self.inheritancegraph is not None or
+ self.collaborationgraph is not None or
+ self.programlisting is not None or
+ self.location is not None or
+ self.listofallmembers is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='compounddefType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.kind is not None:
+ showIndent(outfile, level)
+ outfile.write('kind = "%s",\n' % (self.kind,))
+ if self.prot is not None:
+ showIndent(outfile, level)
+ outfile.write('prot = "%s",\n' % (self.prot,))
+ if self.id is not None:
+ showIndent(outfile, level)
+ outfile.write('id = %s,\n' % (self.id,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('compoundname=%s,\n' % quote_python(self.compoundname).encode(ExternalEncoding))
+ if self.title:
+ showIndent(outfile, level)
+ outfile.write('title=model_.xsd_string(\n')
+ self.title.exportLiteral(outfile, level, name_='title')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ showIndent(outfile, level)
+ outfile.write('basecompoundref=[\n')
+ level += 1
+ for basecompoundref in self.basecompoundref:
+ showIndent(outfile, level)
+ outfile.write('model_.basecompoundref(\n')
+ basecompoundref.exportLiteral(outfile, level, name_='basecompoundref')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('derivedcompoundref=[\n')
+ level += 1
+ for derivedcompoundref in self.derivedcompoundref:
+ showIndent(outfile, level)
+ outfile.write('model_.derivedcompoundref(\n')
+ derivedcompoundref.exportLiteral(outfile, level, name_='derivedcompoundref')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('includes=[\n')
+ level += 1
+ for includes in self.includes:
+ showIndent(outfile, level)
+ outfile.write('model_.includes(\n')
+ includes.exportLiteral(outfile, level, name_='includes')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('includedby=[\n')
+ level += 1
+ for includedby in self.includedby:
+ showIndent(outfile, level)
+ outfile.write('model_.includedby(\n')
+ includedby.exportLiteral(outfile, level, name_='includedby')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ if self.incdepgraph:
+ showIndent(outfile, level)
+ outfile.write('incdepgraph=model_.graphType(\n')
+ self.incdepgraph.exportLiteral(outfile, level, name_='incdepgraph')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ if self.invincdepgraph:
+ showIndent(outfile, level)
+ outfile.write('invincdepgraph=model_.graphType(\n')
+ self.invincdepgraph.exportLiteral(outfile, level, name_='invincdepgraph')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ showIndent(outfile, level)
+ outfile.write('innerdir=[\n')
+ level += 1
+ for innerdir in self.innerdir:
+ showIndent(outfile, level)
+ outfile.write('model_.innerdir(\n')
+ innerdir.exportLiteral(outfile, level, name_='innerdir')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('innerfile=[\n')
+ level += 1
+ for innerfile in self.innerfile:
+ showIndent(outfile, level)
+ outfile.write('model_.innerfile(\n')
+ innerfile.exportLiteral(outfile, level, name_='innerfile')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('innerclass=[\n')
+ level += 1
+ for innerclass in self.innerclass:
+ showIndent(outfile, level)
+ outfile.write('model_.innerclass(\n')
+ innerclass.exportLiteral(outfile, level, name_='innerclass')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('innernamespace=[\n')
+ level += 1
+ for innernamespace in self.innernamespace:
+ showIndent(outfile, level)
+ outfile.write('model_.innernamespace(\n')
+ innernamespace.exportLiteral(outfile, level, name_='innernamespace')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('innerpage=[\n')
+ level += 1
+ for innerpage in self.innerpage:
+ showIndent(outfile, level)
+ outfile.write('model_.innerpage(\n')
+ innerpage.exportLiteral(outfile, level, name_='innerpage')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('innergroup=[\n')
+ level += 1
+ for innergroup in self.innergroup:
+ showIndent(outfile, level)
+ outfile.write('model_.innergroup(\n')
+ innergroup.exportLiteral(outfile, level, name_='innergroup')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ if self.templateparamlist:
+ showIndent(outfile, level)
+ outfile.write('templateparamlist=model_.templateparamlistType(\n')
+ self.templateparamlist.exportLiteral(outfile, level, name_='templateparamlist')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ showIndent(outfile, level)
+ outfile.write('sectiondef=[\n')
+ level += 1
+ for sectiondef in self.sectiondef:
+ showIndent(outfile, level)
+ outfile.write('model_.sectiondef(\n')
+ sectiondef.exportLiteral(outfile, level, name_='sectiondef')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ if self.briefdescription:
+ showIndent(outfile, level)
+ outfile.write('briefdescription=model_.descriptionType(\n')
+ self.briefdescription.exportLiteral(outfile, level, name_='briefdescription')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ if self.detaileddescription:
+ showIndent(outfile, level)
+ outfile.write('detaileddescription=model_.descriptionType(\n')
+ self.detaileddescription.exportLiteral(outfile, level, name_='detaileddescription')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ if self.inheritancegraph:
+ showIndent(outfile, level)
+ outfile.write('inheritancegraph=model_.graphType(\n')
+ self.inheritancegraph.exportLiteral(outfile, level, name_='inheritancegraph')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ if self.collaborationgraph:
+ showIndent(outfile, level)
+ outfile.write('collaborationgraph=model_.graphType(\n')
+ self.collaborationgraph.exportLiteral(outfile, level, name_='collaborationgraph')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ if self.programlisting:
+ showIndent(outfile, level)
+ outfile.write('programlisting=model_.listingType(\n')
+ self.programlisting.exportLiteral(outfile, level, name_='programlisting')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ if self.location:
+ showIndent(outfile, level)
+ outfile.write('location=model_.locationType(\n')
+ self.location.exportLiteral(outfile, level, name_='location')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ if self.listofallmembers:
+ showIndent(outfile, level)
+ outfile.write('listofallmembers=model_.listofallmembersType(\n')
+ self.listofallmembers.exportLiteral(outfile, level, name_='listofallmembers')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('kind'):
+ self.kind = attrs.get('kind').value
+ if attrs.get('prot'):
+ self.prot = attrs.get('prot').value
+ if attrs.get('id'):
+ self.id = attrs.get('id').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'compoundname':
+ compoundname_ = ''
+ for text__content_ in child_.childNodes:
+ compoundname_ += text__content_.nodeValue
+ self.compoundname = compoundname_
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'title':
+ obj_ = docTitleType.factory()
+ obj_.build(child_)
+ self.set_title(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'basecompoundref':
+ obj_ = compoundRefType.factory()
+ obj_.build(child_)
+ self.basecompoundref.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'derivedcompoundref':
+ obj_ = compoundRefType.factory()
+ obj_.build(child_)
+ self.derivedcompoundref.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'includes':
+ obj_ = incType.factory()
+ obj_.build(child_)
+ self.includes.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'includedby':
+ obj_ = incType.factory()
+ obj_.build(child_)
+ self.includedby.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'incdepgraph':
+ obj_ = graphType.factory()
+ obj_.build(child_)
+ self.set_incdepgraph(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'invincdepgraph':
+ obj_ = graphType.factory()
+ obj_.build(child_)
+ self.set_invincdepgraph(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'innerdir':
+ obj_ = refType.factory()
+ obj_.build(child_)
+ self.innerdir.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'innerfile':
+ obj_ = refType.factory()
+ obj_.build(child_)
+ self.innerfile.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'innerclass':
+ obj_ = refType.factory()
+ obj_.build(child_)
+ self.innerclass.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'innernamespace':
+ obj_ = refType.factory()
+ obj_.build(child_)
+ self.innernamespace.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'innerpage':
+ obj_ = refType.factory()
+ obj_.build(child_)
+ self.innerpage.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'innergroup':
+ obj_ = refType.factory()
+ obj_.build(child_)
+ self.innergroup.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'templateparamlist':
+ obj_ = templateparamlistType.factory()
+ obj_.build(child_)
+ self.set_templateparamlist(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'sectiondef':
+ obj_ = sectiondefType.factory()
+ obj_.build(child_)
+ self.sectiondef.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'briefdescription':
+ obj_ = descriptionType.factory()
+ obj_.build(child_)
+ self.set_briefdescription(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'detaileddescription':
+ obj_ = descriptionType.factory()
+ obj_.build(child_)
+ self.set_detaileddescription(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'inheritancegraph':
+ obj_ = graphType.factory()
+ obj_.build(child_)
+ self.set_inheritancegraph(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'collaborationgraph':
+ obj_ = graphType.factory()
+ obj_.build(child_)
+ self.set_collaborationgraph(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'programlisting':
+ obj_ = listingType.factory()
+ obj_.build(child_)
+ self.set_programlisting(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'location':
+ obj_ = locationType.factory()
+ obj_.build(child_)
+ self.set_location(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'listofallmembers':
+ obj_ = listofallmembersType.factory()
+ obj_.build(child_)
+ self.set_listofallmembers(obj_)
+# end class compounddefType
+
+
+class listofallmembersType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, member=None):
+ if member is None:
+ self.member = []
+ else:
+ self.member = member
+ def factory(*args_, **kwargs_):
+ if listofallmembersType.subclass:
+ return listofallmembersType.subclass(*args_, **kwargs_)
+ else:
+ return listofallmembersType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_member(self): return self.member
+ def set_member(self, member): self.member = member
+ def add_member(self, value): self.member.append(value)
+ def insert_member(self, index, value): self.member[index] = value
+ def export(self, outfile, level, namespace_='', name_='listofallmembersType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='listofallmembersType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='listofallmembersType'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='listofallmembersType'):
+ for member_ in self.member:
+ member_.export(outfile, level, namespace_, name_='member')
+ def hasContent_(self):
+ if (
+ self.member is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='listofallmembersType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('member=[\n')
+ level += 1
+ for member in self.member:
+ showIndent(outfile, level)
+ outfile.write('model_.member(\n')
+ member.exportLiteral(outfile, level, name_='member')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'member':
+ obj_ = memberRefType.factory()
+ obj_.build(child_)
+ self.member.append(obj_)
+# end class listofallmembersType
+
+
+class memberRefType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, virt=None, prot=None, refid=None, ambiguityscope=None, scope=None, name=None):
+ self.virt = virt
+ self.prot = prot
+ self.refid = refid
+ self.ambiguityscope = ambiguityscope
+ self.scope = scope
+ self.name = name
+ def factory(*args_, **kwargs_):
+ if memberRefType.subclass:
+ return memberRefType.subclass(*args_, **kwargs_)
+ else:
+ return memberRefType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_scope(self): return self.scope
+ def set_scope(self, scope): self.scope = scope
+ def get_name(self): return self.name
+ def set_name(self, name): self.name = name
+ def get_virt(self): return self.virt
+ def set_virt(self, virt): self.virt = virt
+ def get_prot(self): return self.prot
+ def set_prot(self, prot): self.prot = prot
+ def get_refid(self): return self.refid
+ def set_refid(self, refid): self.refid = refid
+ def get_ambiguityscope(self): return self.ambiguityscope
+ def set_ambiguityscope(self, ambiguityscope): self.ambiguityscope = ambiguityscope
+ def export(self, outfile, level, namespace_='', name_='memberRefType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='memberRefType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='memberRefType'):
+ if self.virt is not None:
+ outfile.write(' virt=%s' % (quote_attrib(self.virt), ))
+ if self.prot is not None:
+ outfile.write(' prot=%s' % (quote_attrib(self.prot), ))
+ if self.refid is not None:
+ outfile.write(' refid=%s' % (self.format_string(quote_attrib(self.refid).encode(ExternalEncoding), input_name='refid'), ))
+ if self.ambiguityscope is not None:
+ outfile.write(' ambiguityscope=%s' % (self.format_string(quote_attrib(self.ambiguityscope).encode(ExternalEncoding), input_name='ambiguityscope'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='memberRefType'):
+ if self.scope is not None:
+ showIndent(outfile, level)
+ outfile.write('<%sscope>%s</%sscope>\n' % (namespace_, self.format_string(quote_xml(self.scope).encode(ExternalEncoding), input_name='scope'), namespace_))
+ if self.name is not None:
+ showIndent(outfile, level)
+ outfile.write('<%sname>%s</%sname>\n' % (namespace_, self.format_string(quote_xml(self.name).encode(ExternalEncoding), input_name='name'), namespace_))
+ def hasContent_(self):
+ if (
+ self.scope is not None or
+ self.name is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='memberRefType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.virt is not None:
+ showIndent(outfile, level)
+ outfile.write('virt = "%s",\n' % (self.virt,))
+ if self.prot is not None:
+ showIndent(outfile, level)
+ outfile.write('prot = "%s",\n' % (self.prot,))
+ if self.refid is not None:
+ showIndent(outfile, level)
+ outfile.write('refid = %s,\n' % (self.refid,))
+ if self.ambiguityscope is not None:
+ showIndent(outfile, level)
+ outfile.write('ambiguityscope = %s,\n' % (self.ambiguityscope,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('scope=%s,\n' % quote_python(self.scope).encode(ExternalEncoding))
+ showIndent(outfile, level)
+ outfile.write('name=%s,\n' % quote_python(self.name).encode(ExternalEncoding))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('virt'):
+ self.virt = attrs.get('virt').value
+ if attrs.get('prot'):
+ self.prot = attrs.get('prot').value
+ if attrs.get('refid'):
+ self.refid = attrs.get('refid').value
+ if attrs.get('ambiguityscope'):
+ self.ambiguityscope = attrs.get('ambiguityscope').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'scope':
+ scope_ = ''
+ for text__content_ in child_.childNodes:
+ scope_ += text__content_.nodeValue
+ self.scope = scope_
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'name':
+ name_ = ''
+ for text__content_ in child_.childNodes:
+ name_ += text__content_.nodeValue
+ self.name = name_
+# end class memberRefType
+
+
+class scope(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, valueOf_=''):
+ self.valueOf_ = valueOf_
+ def factory(*args_, **kwargs_):
+ if scope.subclass:
+ return scope.subclass(*args_, **kwargs_)
+ else:
+ return scope(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='scope', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='scope')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='scope'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='scope'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='scope'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class scope
+
+
+class name(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, valueOf_=''):
+ self.valueOf_ = valueOf_
+ def factory(*args_, **kwargs_):
+ if name.subclass:
+ return name.subclass(*args_, **kwargs_)
+ else:
+ return name(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='name', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='name')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='name'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='name'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='name'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class name
+
+
+class compoundRefType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, virt=None, prot=None, refid=None, valueOf_='', mixedclass_=None, content_=None):
+ self.virt = virt
+ self.prot = prot
+ self.refid = refid
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if compoundRefType.subclass:
+ return compoundRefType.subclass(*args_, **kwargs_)
+ else:
+ return compoundRefType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_virt(self): return self.virt
+ def set_virt(self, virt): self.virt = virt
+ def get_prot(self): return self.prot
+ def set_prot(self, prot): self.prot = prot
+ def get_refid(self): return self.refid
+ def set_refid(self, refid): self.refid = refid
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='compoundRefType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='compoundRefType')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='compoundRefType'):
+ if self.virt is not None:
+ outfile.write(' virt=%s' % (quote_attrib(self.virt), ))
+ if self.prot is not None:
+ outfile.write(' prot=%s' % (quote_attrib(self.prot), ))
+ if self.refid is not None:
+ outfile.write(' refid=%s' % (self.format_string(quote_attrib(self.refid).encode(ExternalEncoding), input_name='refid'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='compoundRefType'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='compoundRefType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.virt is not None:
+ showIndent(outfile, level)
+ outfile.write('virt = "%s",\n' % (self.virt,))
+ if self.prot is not None:
+ showIndent(outfile, level)
+ outfile.write('prot = "%s",\n' % (self.prot,))
+ if self.refid is not None:
+ showIndent(outfile, level)
+ outfile.write('refid = %s,\n' % (self.refid,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('virt'):
+ self.virt = attrs.get('virt').value
+ if attrs.get('prot'):
+ self.prot = attrs.get('prot').value
+ if attrs.get('refid'):
+ self.refid = attrs.get('refid').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class compoundRefType
+
+
+class reimplementType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, refid=None, valueOf_='', mixedclass_=None, content_=None):
+ self.refid = refid
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if reimplementType.subclass:
+ return reimplementType.subclass(*args_, **kwargs_)
+ else:
+ return reimplementType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_refid(self): return self.refid
+ def set_refid(self, refid): self.refid = refid
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='reimplementType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='reimplementType')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='reimplementType'):
+ if self.refid is not None:
+ outfile.write(' refid=%s' % (self.format_string(quote_attrib(self.refid).encode(ExternalEncoding), input_name='refid'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='reimplementType'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='reimplementType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.refid is not None:
+ showIndent(outfile, level)
+ outfile.write('refid = %s,\n' % (self.refid,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('refid'):
+ self.refid = attrs.get('refid').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class reimplementType
+
+
+class incType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, local=None, refid=None, valueOf_='', mixedclass_=None, content_=None):
+ self.local = local
+ self.refid = refid
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if incType.subclass:
+ return incType.subclass(*args_, **kwargs_)
+ else:
+ return incType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_local(self): return self.local
+ def set_local(self, local): self.local = local
+ def get_refid(self): return self.refid
+ def set_refid(self, refid): self.refid = refid
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='incType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='incType')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='incType'):
+ if self.local is not None:
+ outfile.write(' local=%s' % (quote_attrib(self.local), ))
+ if self.refid is not None:
+ outfile.write(' refid=%s' % (self.format_string(quote_attrib(self.refid).encode(ExternalEncoding), input_name='refid'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='incType'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='incType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.local is not None:
+ showIndent(outfile, level)
+ outfile.write('local = "%s",\n' % (self.local,))
+ if self.refid is not None:
+ showIndent(outfile, level)
+ outfile.write('refid = %s,\n' % (self.refid,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('local'):
+ self.local = attrs.get('local').value
+ if attrs.get('refid'):
+ self.refid = attrs.get('refid').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class incType
+
+
+class refType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, prot=None, refid=None, valueOf_='', mixedclass_=None, content_=None):
+ self.prot = prot
+ self.refid = refid
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if refType.subclass:
+ return refType.subclass(*args_, **kwargs_)
+ else:
+ return refType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_prot(self): return self.prot
+ def set_prot(self, prot): self.prot = prot
+ def get_refid(self): return self.refid
+ def set_refid(self, refid): self.refid = refid
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='refType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='refType')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='refType'):
+ if self.prot is not None:
+ outfile.write(' prot=%s' % (quote_attrib(self.prot), ))
+ if self.refid is not None:
+ outfile.write(' refid=%s' % (self.format_string(quote_attrib(self.refid).encode(ExternalEncoding), input_name='refid'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='refType'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='refType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.prot is not None:
+ showIndent(outfile, level)
+ outfile.write('prot = "%s",\n' % (self.prot,))
+ if self.refid is not None:
+ showIndent(outfile, level)
+ outfile.write('refid = %s,\n' % (self.refid,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('prot'):
+ self.prot = attrs.get('prot').value
+ if attrs.get('refid'):
+ self.refid = attrs.get('refid').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class refType
+
+
+class refTextType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, refid=None, kindref=None, external=None, valueOf_='', mixedclass_=None, content_=None):
+ self.refid = refid
+ self.kindref = kindref
+ self.external = external
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if refTextType.subclass:
+ return refTextType.subclass(*args_, **kwargs_)
+ else:
+ return refTextType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_refid(self): return self.refid
+ def set_refid(self, refid): self.refid = refid
+ def get_kindref(self): return self.kindref
+ def set_kindref(self, kindref): self.kindref = kindref
+ def get_external(self): return self.external
+ def set_external(self, external): self.external = external
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='refTextType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='refTextType')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='refTextType'):
+ if self.refid is not None:
+ outfile.write(' refid=%s' % (self.format_string(quote_attrib(self.refid).encode(ExternalEncoding), input_name='refid'), ))
+ if self.kindref is not None:
+ outfile.write(' kindref=%s' % (quote_attrib(self.kindref), ))
+ if self.external is not None:
+ outfile.write(' external=%s' % (self.format_string(quote_attrib(self.external).encode(ExternalEncoding), input_name='external'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='refTextType'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='refTextType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.refid is not None:
+ showIndent(outfile, level)
+ outfile.write('refid = %s,\n' % (self.refid,))
+ if self.kindref is not None:
+ showIndent(outfile, level)
+ outfile.write('kindref = "%s",\n' % (self.kindref,))
+ if self.external is not None:
+ showIndent(outfile, level)
+ outfile.write('external = %s,\n' % (self.external,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('refid'):
+ self.refid = attrs.get('refid').value
+ if attrs.get('kindref'):
+ self.kindref = attrs.get('kindref').value
+ if attrs.get('external'):
+ self.external = attrs.get('external').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class refTextType
+
+
+class sectiondefType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, kind=None, header=None, description=None, memberdef=None):
+ self.kind = kind
+ self.header = header
+ self.description = description
+ if memberdef is None:
+ self.memberdef = []
+ else:
+ self.memberdef = memberdef
+ def factory(*args_, **kwargs_):
+ if sectiondefType.subclass:
+ return sectiondefType.subclass(*args_, **kwargs_)
+ else:
+ return sectiondefType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_header(self): return self.header
+ def set_header(self, header): self.header = header
+ def get_description(self): return self.description
+ def set_description(self, description): self.description = description
+ def get_memberdef(self): return self.memberdef
+ def set_memberdef(self, memberdef): self.memberdef = memberdef
+ def add_memberdef(self, value): self.memberdef.append(value)
+ def insert_memberdef(self, index, value): self.memberdef[index] = value
+ def get_kind(self): return self.kind
+ def set_kind(self, kind): self.kind = kind
+ def export(self, outfile, level, namespace_='', name_='sectiondefType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='sectiondefType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='sectiondefType'):
+ if self.kind is not None:
+ outfile.write(' kind=%s' % (quote_attrib(self.kind), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='sectiondefType'):
+ if self.header is not None:
+ showIndent(outfile, level)
+ outfile.write('<%sheader>%s</%sheader>\n' % (namespace_, self.format_string(quote_xml(self.header).encode(ExternalEncoding), input_name='header'), namespace_))
+ if self.description:
+ self.description.export(outfile, level, namespace_, name_='description')
+ for memberdef_ in self.memberdef:
+ memberdef_.export(outfile, level, namespace_, name_='memberdef')
+ def hasContent_(self):
+ if (
+ self.header is not None or
+ self.description is not None or
+ self.memberdef is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='sectiondefType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.kind is not None:
+ showIndent(outfile, level)
+ outfile.write('kind = "%s",\n' % (self.kind,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('header=%s,\n' % quote_python(self.header).encode(ExternalEncoding))
+ if self.description:
+ showIndent(outfile, level)
+ outfile.write('description=model_.descriptionType(\n')
+ self.description.exportLiteral(outfile, level, name_='description')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ showIndent(outfile, level)
+ outfile.write('memberdef=[\n')
+ level += 1
+ for memberdef in self.memberdef:
+ showIndent(outfile, level)
+ outfile.write('model_.memberdef(\n')
+ memberdef.exportLiteral(outfile, level, name_='memberdef')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('kind'):
+ self.kind = attrs.get('kind').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'header':
+ header_ = ''
+ for text__content_ in child_.childNodes:
+ header_ += text__content_.nodeValue
+ self.header = header_
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'description':
+ obj_ = descriptionType.factory()
+ obj_.build(child_)
+ self.set_description(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'memberdef':
+ obj_ = memberdefType.factory()
+ obj_.build(child_)
+ self.memberdef.append(obj_)
+# end class sectiondefType
+
+
+class memberdefType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, initonly=None, kind=None, volatile=None, const=None, raisexx=None, virt=None, readable=None, prot=None, explicit=None, new=None, final=None, writable=None, add=None, static=None, remove=None, sealed=None, mutable=None, gettable=None, inline=None, settable=None, id=None, templateparamlist=None, type_=None, definition=None, argsstring=None, name=None, read=None, write=None, bitfield=None, reimplements=None, reimplementedby=None, param=None, enumvalue=None, initializer=None, exceptions=None, briefdescription=None, detaileddescription=None, inbodydescription=None, location=None, references=None, referencedby=None):
+ self.initonly = initonly
+ self.kind = kind
+ self.volatile = volatile
+ self.const = const
+ self.raisexx = raisexx
+ self.virt = virt
+ self.readable = readable
+ self.prot = prot
+ self.explicit = explicit
+ self.new = new
+ self.final = final
+ self.writable = writable
+ self.add = add
+ self.static = static
+ self.remove = remove
+ self.sealed = sealed
+ self.mutable = mutable
+ self.gettable = gettable
+ self.inline = inline
+ self.settable = settable
+ self.id = id
+ self.templateparamlist = templateparamlist
+ self.type_ = type_
+ self.definition = definition
+ self.argsstring = argsstring
+ self.name = name
+ self.read = read
+ self.write = write
+ self.bitfield = bitfield
+ if reimplements is None:
+ self.reimplements = []
+ else:
+ self.reimplements = reimplements
+ if reimplementedby is None:
+ self.reimplementedby = []
+ else:
+ self.reimplementedby = reimplementedby
+ if param is None:
+ self.param = []
+ else:
+ self.param = param
+ if enumvalue is None:
+ self.enumvalue = []
+ else:
+ self.enumvalue = enumvalue
+ self.initializer = initializer
+ self.exceptions = exceptions
+ self.briefdescription = briefdescription
+ self.detaileddescription = detaileddescription
+ self.inbodydescription = inbodydescription
+ self.location = location
+ if references is None:
+ self.references = []
+ else:
+ self.references = references
+ if referencedby is None:
+ self.referencedby = []
+ else:
+ self.referencedby = referencedby
+ def factory(*args_, **kwargs_):
+ if memberdefType.subclass:
+ return memberdefType.subclass(*args_, **kwargs_)
+ else:
+ return memberdefType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_templateparamlist(self): return self.templateparamlist
+ def set_templateparamlist(self, templateparamlist): self.templateparamlist = templateparamlist
+ def get_type(self): return self.type_
+ def set_type(self, type_): self.type_ = type_
+ def get_definition(self): return self.definition
+ def set_definition(self, definition): self.definition = definition
+ def get_argsstring(self): return self.argsstring
+ def set_argsstring(self, argsstring): self.argsstring = argsstring
+ def get_name(self): return self.name
+ def set_name(self, name): self.name = name
+ def get_read(self): return self.read
+ def set_read(self, read): self.read = read
+ def get_write(self): return self.write
+ def set_write(self, write): self.write = write
+ def get_bitfield(self): return self.bitfield
+ def set_bitfield(self, bitfield): self.bitfield = bitfield
+ def get_reimplements(self): return self.reimplements
+ def set_reimplements(self, reimplements): self.reimplements = reimplements
+ def add_reimplements(self, value): self.reimplements.append(value)
+ def insert_reimplements(self, index, value): self.reimplements[index] = value
+ def get_reimplementedby(self): return self.reimplementedby
+ def set_reimplementedby(self, reimplementedby): self.reimplementedby = reimplementedby
+ def add_reimplementedby(self, value): self.reimplementedby.append(value)
+ def insert_reimplementedby(self, index, value): self.reimplementedby[index] = value
+ def get_param(self): return self.param
+ def set_param(self, param): self.param = param
+ def add_param(self, value): self.param.append(value)
+ def insert_param(self, index, value): self.param[index] = value
+ def get_enumvalue(self): return self.enumvalue
+ def set_enumvalue(self, enumvalue): self.enumvalue = enumvalue
+ def add_enumvalue(self, value): self.enumvalue.append(value)
+ def insert_enumvalue(self, index, value): self.enumvalue[index] = value
+ def get_initializer(self): return self.initializer
+ def set_initializer(self, initializer): self.initializer = initializer
+ def get_exceptions(self): return self.exceptions
+ def set_exceptions(self, exceptions): self.exceptions = exceptions
+ def get_briefdescription(self): return self.briefdescription
+ def set_briefdescription(self, briefdescription): self.briefdescription = briefdescription
+ def get_detaileddescription(self): return self.detaileddescription
+ def set_detaileddescription(self, detaileddescription): self.detaileddescription = detaileddescription
+ def get_inbodydescription(self): return self.inbodydescription
+ def set_inbodydescription(self, inbodydescription): self.inbodydescription = inbodydescription
+ def get_location(self): return self.location
+ def set_location(self, location): self.location = location
+ def get_references(self): return self.references
+ def set_references(self, references): self.references = references
+ def add_references(self, value): self.references.append(value)
+ def insert_references(self, index, value): self.references[index] = value
+ def get_referencedby(self): return self.referencedby
+ def set_referencedby(self, referencedby): self.referencedby = referencedby
+ def add_referencedby(self, value): self.referencedby.append(value)
+ def insert_referencedby(self, index, value): self.referencedby[index] = value
+ def get_initonly(self): return self.initonly
+ def set_initonly(self, initonly): self.initonly = initonly
+ def get_kind(self): return self.kind
+ def set_kind(self, kind): self.kind = kind
+ def get_volatile(self): return self.volatile
+ def set_volatile(self, volatile): self.volatile = volatile
+ def get_const(self): return self.const
+ def set_const(self, const): self.const = const
+ def get_raise(self): return self.raisexx
+ def set_raise(self, raisexx): self.raisexx = raisexx
+ def get_virt(self): return self.virt
+ def set_virt(self, virt): self.virt = virt
+ def get_readable(self): return self.readable
+ def set_readable(self, readable): self.readable = readable
+ def get_prot(self): return self.prot
+ def set_prot(self, prot): self.prot = prot
+ def get_explicit(self): return self.explicit
+ def set_explicit(self, explicit): self.explicit = explicit
+ def get_new(self): return self.new
+ def set_new(self, new): self.new = new
+ def get_final(self): return self.final
+ def set_final(self, final): self.final = final
+ def get_writable(self): return self.writable
+ def set_writable(self, writable): self.writable = writable
+ def get_add(self): return self.add
+ def set_add(self, add): self.add = add
+ def get_static(self): return self.static
+ def set_static(self, static): self.static = static
+ def get_remove(self): return self.remove
+ def set_remove(self, remove): self.remove = remove
+ def get_sealed(self): return self.sealed
+ def set_sealed(self, sealed): self.sealed = sealed
+ def get_mutable(self): return self.mutable
+ def set_mutable(self, mutable): self.mutable = mutable
+ def get_gettable(self): return self.gettable
+ def set_gettable(self, gettable): self.gettable = gettable
+ def get_inline(self): return self.inline
+ def set_inline(self, inline): self.inline = inline
+ def get_settable(self): return self.settable
+ def set_settable(self, settable): self.settable = settable
+ def get_id(self): return self.id
+ def set_id(self, id): self.id = id
+ def export(self, outfile, level, namespace_='', name_='memberdefType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='memberdefType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='memberdefType'):
+ if self.initonly is not None:
+ outfile.write(' initonly=%s' % (quote_attrib(self.initonly), ))
+ if self.kind is not None:
+ outfile.write(' kind=%s' % (quote_attrib(self.kind), ))
+ if self.volatile is not None:
+ outfile.write(' volatile=%s' % (quote_attrib(self.volatile), ))
+ if self.const is not None:
+ outfile.write(' const=%s' % (quote_attrib(self.const), ))
+ if self.raisexx is not None:
+ outfile.write(' raise=%s' % (quote_attrib(self.raisexx), ))
+ if self.virt is not None:
+ outfile.write(' virt=%s' % (quote_attrib(self.virt), ))
+ if self.readable is not None:
+ outfile.write(' readable=%s' % (quote_attrib(self.readable), ))
+ if self.prot is not None:
+ outfile.write(' prot=%s' % (quote_attrib(self.prot), ))
+ if self.explicit is not None:
+ outfile.write(' explicit=%s' % (quote_attrib(self.explicit), ))
+ if self.new is not None:
+ outfile.write(' new=%s' % (quote_attrib(self.new), ))
+ if self.final is not None:
+ outfile.write(' final=%s' % (quote_attrib(self.final), ))
+ if self.writable is not None:
+ outfile.write(' writable=%s' % (quote_attrib(self.writable), ))
+ if self.add is not None:
+ outfile.write(' add=%s' % (quote_attrib(self.add), ))
+ if self.static is not None:
+ outfile.write(' static=%s' % (quote_attrib(self.static), ))
+ if self.remove is not None:
+ outfile.write(' remove=%s' % (quote_attrib(self.remove), ))
+ if self.sealed is not None:
+ outfile.write(' sealed=%s' % (quote_attrib(self.sealed), ))
+ if self.mutable is not None:
+ outfile.write(' mutable=%s' % (quote_attrib(self.mutable), ))
+ if self.gettable is not None:
+ outfile.write(' gettable=%s' % (quote_attrib(self.gettable), ))
+ if self.inline is not None:
+ outfile.write(' inline=%s' % (quote_attrib(self.inline), ))
+ if self.settable is not None:
+ outfile.write(' settable=%s' % (quote_attrib(self.settable), ))
+ if self.id is not None:
+ outfile.write(' id=%s' % (self.format_string(quote_attrib(self.id).encode(ExternalEncoding), input_name='id'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='memberdefType'):
+ if self.templateparamlist:
+ self.templateparamlist.export(outfile, level, namespace_, name_='templateparamlist')
+ if self.type_:
+ self.type_.export(outfile, level, namespace_, name_='type')
+ if self.definition is not None:
+ showIndent(outfile, level)
+ outfile.write('<%sdefinition>%s</%sdefinition>\n' % (namespace_, self.format_string(quote_xml(self.definition).encode(ExternalEncoding), input_name='definition'), namespace_))
+ if self.argsstring is not None:
+ showIndent(outfile, level)
+ outfile.write('<%sargsstring>%s</%sargsstring>\n' % (namespace_, self.format_string(quote_xml(self.argsstring).encode(ExternalEncoding), input_name='argsstring'), namespace_))
+ if self.name is not None:
+ showIndent(outfile, level)
+ outfile.write('<%sname>%s</%sname>\n' % (namespace_, self.format_string(quote_xml(self.name).encode(ExternalEncoding), input_name='name'), namespace_))
+ if self.read is not None:
+ showIndent(outfile, level)
+ outfile.write('<%sread>%s</%sread>\n' % (namespace_, self.format_string(quote_xml(self.read).encode(ExternalEncoding), input_name='read'), namespace_))
+ if self.write is not None:
+ showIndent(outfile, level)
+ outfile.write('<%swrite>%s</%swrite>\n' % (namespace_, self.format_string(quote_xml(self.write).encode(ExternalEncoding), input_name='write'), namespace_))
+ if self.bitfield is not None:
+ showIndent(outfile, level)
+ outfile.write('<%sbitfield>%s</%sbitfield>\n' % (namespace_, self.format_string(quote_xml(self.bitfield).encode(ExternalEncoding), input_name='bitfield'), namespace_))
+ for reimplements_ in self.reimplements:
+ reimplements_.export(outfile, level, namespace_, name_='reimplements')
+ for reimplementedby_ in self.reimplementedby:
+ reimplementedby_.export(outfile, level, namespace_, name_='reimplementedby')
+ for param_ in self.param:
+ param_.export(outfile, level, namespace_, name_='param')
+ for enumvalue_ in self.enumvalue:
+ enumvalue_.export(outfile, level, namespace_, name_='enumvalue')
+ if self.initializer:
+ self.initializer.export(outfile, level, namespace_, name_='initializer')
+ if self.exceptions:
+ self.exceptions.export(outfile, level, namespace_, name_='exceptions')
+ if self.briefdescription:
+ self.briefdescription.export(outfile, level, namespace_, name_='briefdescription')
+ if self.detaileddescription:
+ self.detaileddescription.export(outfile, level, namespace_, name_='detaileddescription')
+ if self.inbodydescription:
+ self.inbodydescription.export(outfile, level, namespace_, name_='inbodydescription')
+ if self.location:
+ self.location.export(outfile, level, namespace_, name_='location', )
+ for references_ in self.references:
+ references_.export(outfile, level, namespace_, name_='references')
+ for referencedby_ in self.referencedby:
+ referencedby_.export(outfile, level, namespace_, name_='referencedby')
+ def hasContent_(self):
+ if (
+ self.templateparamlist is not None or
+ self.type_ is not None or
+ self.definition is not None or
+ self.argsstring is not None or
+ self.name is not None or
+ self.read is not None or
+ self.write is not None or
+ self.bitfield is not None or
+ self.reimplements is not None or
+ self.reimplementedby is not None or
+ self.param is not None or
+ self.enumvalue is not None or
+ self.initializer is not None or
+ self.exceptions is not None or
+ self.briefdescription is not None or
+ self.detaileddescription is not None or
+ self.inbodydescription is not None or
+ self.location is not None or
+ self.references is not None or
+ self.referencedby is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='memberdefType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.initonly is not None:
+ showIndent(outfile, level)
+ outfile.write('initonly = "%s",\n' % (self.initonly,))
+ if self.kind is not None:
+ showIndent(outfile, level)
+ outfile.write('kind = "%s",\n' % (self.kind,))
+ if self.volatile is not None:
+ showIndent(outfile, level)
+ outfile.write('volatile = "%s",\n' % (self.volatile,))
+ if self.const is not None:
+ showIndent(outfile, level)
+ outfile.write('const = "%s",\n' % (self.const,))
+ if self.raisexx is not None:
+ showIndent(outfile, level)
+ outfile.write('raisexx = "%s",\n' % (self.raisexx,))
+ if self.virt is not None:
+ showIndent(outfile, level)
+ outfile.write('virt = "%s",\n' % (self.virt,))
+ if self.readable is not None:
+ showIndent(outfile, level)
+ outfile.write('readable = "%s",\n' % (self.readable,))
+ if self.prot is not None:
+ showIndent(outfile, level)
+ outfile.write('prot = "%s",\n' % (self.prot,))
+ if self.explicit is not None:
+ showIndent(outfile, level)
+ outfile.write('explicit = "%s",\n' % (self.explicit,))
+ if self.new is not None:
+ showIndent(outfile, level)
+ outfile.write('new = "%s",\n' % (self.new,))
+ if self.final is not None:
+ showIndent(outfile, level)
+ outfile.write('final = "%s",\n' % (self.final,))
+ if self.writable is not None:
+ showIndent(outfile, level)
+ outfile.write('writable = "%s",\n' % (self.writable,))
+ if self.add is not None:
+ showIndent(outfile, level)
+ outfile.write('add = "%s",\n' % (self.add,))
+ if self.static is not None:
+ showIndent(outfile, level)
+ outfile.write('static = "%s",\n' % (self.static,))
+ if self.remove is not None:
+ showIndent(outfile, level)
+ outfile.write('remove = "%s",\n' % (self.remove,))
+ if self.sealed is not None:
+ showIndent(outfile, level)
+ outfile.write('sealed = "%s",\n' % (self.sealed,))
+ if self.mutable is not None:
+ showIndent(outfile, level)
+ outfile.write('mutable = "%s",\n' % (self.mutable,))
+ if self.gettable is not None:
+ showIndent(outfile, level)
+ outfile.write('gettable = "%s",\n' % (self.gettable,))
+ if self.inline is not None:
+ showIndent(outfile, level)
+ outfile.write('inline = "%s",\n' % (self.inline,))
+ if self.settable is not None:
+ showIndent(outfile, level)
+ outfile.write('settable = "%s",\n' % (self.settable,))
+ if self.id is not None:
+ showIndent(outfile, level)
+ outfile.write('id = %s,\n' % (self.id,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ if self.templateparamlist:
+ showIndent(outfile, level)
+ outfile.write('templateparamlist=model_.templateparamlistType(\n')
+ self.templateparamlist.exportLiteral(outfile, level, name_='templateparamlist')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ if self.type_:
+ showIndent(outfile, level)
+ outfile.write('type_=model_.linkedTextType(\n')
+ self.type_.exportLiteral(outfile, level, name_='type')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ showIndent(outfile, level)
+ outfile.write('definition=%s,\n' % quote_python(self.definition).encode(ExternalEncoding))
+ showIndent(outfile, level)
+ outfile.write('argsstring=%s,\n' % quote_python(self.argsstring).encode(ExternalEncoding))
+ showIndent(outfile, level)
+ outfile.write('name=%s,\n' % quote_python(self.name).encode(ExternalEncoding))
+ showIndent(outfile, level)
+ outfile.write('read=%s,\n' % quote_python(self.read).encode(ExternalEncoding))
+ showIndent(outfile, level)
+ outfile.write('write=%s,\n' % quote_python(self.write).encode(ExternalEncoding))
+ showIndent(outfile, level)
+ outfile.write('bitfield=%s,\n' % quote_python(self.bitfield).encode(ExternalEncoding))
+ showIndent(outfile, level)
+ outfile.write('reimplements=[\n')
+ level += 1
+ for reimplements in self.reimplements:
+ showIndent(outfile, level)
+ outfile.write('model_.reimplements(\n')
+ reimplements.exportLiteral(outfile, level, name_='reimplements')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('reimplementedby=[\n')
+ level += 1
+ for reimplementedby in self.reimplementedby:
+ showIndent(outfile, level)
+ outfile.write('model_.reimplementedby(\n')
+ reimplementedby.exportLiteral(outfile, level, name_='reimplementedby')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('param=[\n')
+ level += 1
+ for param in self.param:
+ showIndent(outfile, level)
+ outfile.write('model_.param(\n')
+ param.exportLiteral(outfile, level, name_='param')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('enumvalue=[\n')
+ level += 1
+ for enumvalue in self.enumvalue:
+ showIndent(outfile, level)
+ outfile.write('model_.enumvalue(\n')
+ enumvalue.exportLiteral(outfile, level, name_='enumvalue')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ if self.initializer:
+ showIndent(outfile, level)
+ outfile.write('initializer=model_.linkedTextType(\n')
+ self.initializer.exportLiteral(outfile, level, name_='initializer')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ if self.exceptions:
+ showIndent(outfile, level)
+ outfile.write('exceptions=model_.linkedTextType(\n')
+ self.exceptions.exportLiteral(outfile, level, name_='exceptions')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ if self.briefdescription:
+ showIndent(outfile, level)
+ outfile.write('briefdescription=model_.descriptionType(\n')
+ self.briefdescription.exportLiteral(outfile, level, name_='briefdescription')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ if self.detaileddescription:
+ showIndent(outfile, level)
+ outfile.write('detaileddescription=model_.descriptionType(\n')
+ self.detaileddescription.exportLiteral(outfile, level, name_='detaileddescription')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ if self.inbodydescription:
+ showIndent(outfile, level)
+ outfile.write('inbodydescription=model_.descriptionType(\n')
+ self.inbodydescription.exportLiteral(outfile, level, name_='inbodydescription')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ if self.location:
+ showIndent(outfile, level)
+ outfile.write('location=model_.locationType(\n')
+ self.location.exportLiteral(outfile, level, name_='location')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ showIndent(outfile, level)
+ outfile.write('references=[\n')
+ level += 1
+ for references in self.references:
+ showIndent(outfile, level)
+ outfile.write('model_.references(\n')
+ references.exportLiteral(outfile, level, name_='references')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('referencedby=[\n')
+ level += 1
+ for referencedby in self.referencedby:
+ showIndent(outfile, level)
+ outfile.write('model_.referencedby(\n')
+ referencedby.exportLiteral(outfile, level, name_='referencedby')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('initonly'):
+ self.initonly = attrs.get('initonly').value
+ if attrs.get('kind'):
+ self.kind = attrs.get('kind').value
+ if attrs.get('volatile'):
+ self.volatile = attrs.get('volatile').value
+ if attrs.get('const'):
+ self.const = attrs.get('const').value
+ if attrs.get('raise'):
+ self.raisexx = attrs.get('raise').value
+ if attrs.get('virt'):
+ self.virt = attrs.get('virt').value
+ if attrs.get('readable'):
+ self.readable = attrs.get('readable').value
+ if attrs.get('prot'):
+ self.prot = attrs.get('prot').value
+ if attrs.get('explicit'):
+ self.explicit = attrs.get('explicit').value
+ if attrs.get('new'):
+ self.new = attrs.get('new').value
+ if attrs.get('final'):
+ self.final = attrs.get('final').value
+ if attrs.get('writable'):
+ self.writable = attrs.get('writable').value
+ if attrs.get('add'):
+ self.add = attrs.get('add').value
+ if attrs.get('static'):
+ self.static = attrs.get('static').value
+ if attrs.get('remove'):
+ self.remove = attrs.get('remove').value
+ if attrs.get('sealed'):
+ self.sealed = attrs.get('sealed').value
+ if attrs.get('mutable'):
+ self.mutable = attrs.get('mutable').value
+ if attrs.get('gettable'):
+ self.gettable = attrs.get('gettable').value
+ if attrs.get('inline'):
+ self.inline = attrs.get('inline').value
+ if attrs.get('settable'):
+ self.settable = attrs.get('settable').value
+ if attrs.get('id'):
+ self.id = attrs.get('id').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'templateparamlist':
+ obj_ = templateparamlistType.factory()
+ obj_.build(child_)
+ self.set_templateparamlist(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'type':
+ obj_ = linkedTextType.factory()
+ obj_.build(child_)
+ self.set_type(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'definition':
+ definition_ = ''
+ for text__content_ in child_.childNodes:
+ definition_ += text__content_.nodeValue
+ self.definition = definition_
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'argsstring':
+ argsstring_ = ''
+ for text__content_ in child_.childNodes:
+ argsstring_ += text__content_.nodeValue
+ self.argsstring = argsstring_
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'name':
+ name_ = ''
+ for text__content_ in child_.childNodes:
+ name_ += text__content_.nodeValue
+ self.name = name_
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'read':
+ read_ = ''
+ for text__content_ in child_.childNodes:
+ read_ += text__content_.nodeValue
+ self.read = read_
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'write':
+ write_ = ''
+ for text__content_ in child_.childNodes:
+ write_ += text__content_.nodeValue
+ self.write = write_
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'bitfield':
+ bitfield_ = ''
+ for text__content_ in child_.childNodes:
+ bitfield_ += text__content_.nodeValue
+ self.bitfield = bitfield_
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'reimplements':
+ obj_ = reimplementType.factory()
+ obj_.build(child_)
+ self.reimplements.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'reimplementedby':
+ obj_ = reimplementType.factory()
+ obj_.build(child_)
+ self.reimplementedby.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'param':
+ obj_ = paramType.factory()
+ obj_.build(child_)
+ self.param.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'enumvalue':
+ obj_ = enumvalueType.factory()
+ obj_.build(child_)
+ self.enumvalue.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'initializer':
+ obj_ = linkedTextType.factory()
+ obj_.build(child_)
+ self.set_initializer(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'exceptions':
+ obj_ = linkedTextType.factory()
+ obj_.build(child_)
+ self.set_exceptions(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'briefdescription':
+ obj_ = descriptionType.factory()
+ obj_.build(child_)
+ self.set_briefdescription(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'detaileddescription':
+ obj_ = descriptionType.factory()
+ obj_.build(child_)
+ self.set_detaileddescription(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'inbodydescription':
+ obj_ = descriptionType.factory()
+ obj_.build(child_)
+ self.set_inbodydescription(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'location':
+ obj_ = locationType.factory()
+ obj_.build(child_)
+ self.set_location(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'references':
+ obj_ = referenceType.factory()
+ obj_.build(child_)
+ self.references.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'referencedby':
+ obj_ = referenceType.factory()
+ obj_.build(child_)
+ self.referencedby.append(obj_)
+# end class memberdefType
+
+
+class definition(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, valueOf_=''):
+ self.valueOf_ = valueOf_
+ def factory(*args_, **kwargs_):
+ if definition.subclass:
+ return definition.subclass(*args_, **kwargs_)
+ else:
+ return definition(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='definition', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='definition')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='definition'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='definition'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='definition'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class definition
+
+
+class argsstring(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, valueOf_=''):
+ self.valueOf_ = valueOf_
+ def factory(*args_, **kwargs_):
+ if argsstring.subclass:
+ return argsstring.subclass(*args_, **kwargs_)
+ else:
+ return argsstring(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='argsstring', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='argsstring')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='argsstring'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='argsstring'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='argsstring'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class argsstring
+
+
+class read(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, valueOf_=''):
+ self.valueOf_ = valueOf_
+ def factory(*args_, **kwargs_):
+ if read.subclass:
+ return read.subclass(*args_, **kwargs_)
+ else:
+ return read(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='read', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='read')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='read'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='read'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='read'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class read
+
+
+class write(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, valueOf_=''):
+ self.valueOf_ = valueOf_
+ def factory(*args_, **kwargs_):
+ if write.subclass:
+ return write.subclass(*args_, **kwargs_)
+ else:
+ return write(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='write', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='write')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='write'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='write'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='write'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class write
+
+
+class bitfield(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, valueOf_=''):
+ self.valueOf_ = valueOf_
+ def factory(*args_, **kwargs_):
+ if bitfield.subclass:
+ return bitfield.subclass(*args_, **kwargs_)
+ else:
+ return bitfield(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='bitfield', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='bitfield')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='bitfield'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='bitfield'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='bitfield'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class bitfield
+
+
+class descriptionType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, title=None, para=None, sect1=None, internal=None, mixedclass_=None, content_=None):
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if descriptionType.subclass:
+ return descriptionType.subclass(*args_, **kwargs_)
+ else:
+ return descriptionType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_title(self): return self.title
+ def set_title(self, title): self.title = title
+ def get_para(self): return self.para
+ def set_para(self, para): self.para = para
+ def add_para(self, value): self.para.append(value)
+ def insert_para(self, index, value): self.para[index] = value
+ def get_sect1(self): return self.sect1
+ def set_sect1(self, sect1): self.sect1 = sect1
+ def add_sect1(self, value): self.sect1.append(value)
+ def insert_sect1(self, index, value): self.sect1[index] = value
+ def get_internal(self): return self.internal
+ def set_internal(self, internal): self.internal = internal
+ def export(self, outfile, level, namespace_='', name_='descriptionType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='descriptionType')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='descriptionType'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='descriptionType'):
+ for item_ in self.content_:
+ item_.export(outfile, level, item_.name, namespace_)
+ def hasContent_(self):
+ if (
+ self.title is not None or
+ self.para is not None or
+ self.sect1 is not None or
+ self.internal is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='descriptionType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'title':
+ childobj_ = docTitleType.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'title', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'para':
+ childobj_ = docParaType.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'para', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'sect1':
+ childobj_ = docSect1Type.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'sect1', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'internal':
+ childobj_ = docInternalType.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'internal', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+# end class descriptionType
+
+
+class enumvalueType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, prot=None, id=None, name=None, initializer=None, briefdescription=None, detaileddescription=None, mixedclass_=None, content_=None):
+ self.prot = prot
+ self.id = id
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if enumvalueType.subclass:
+ return enumvalueType.subclass(*args_, **kwargs_)
+ else:
+ return enumvalueType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_name(self): return self.name
+ def set_name(self, name): self.name = name
+ def get_initializer(self): return self.initializer
+ def set_initializer(self, initializer): self.initializer = initializer
+ def get_briefdescription(self): return self.briefdescription
+ def set_briefdescription(self, briefdescription): self.briefdescription = briefdescription
+ def get_detaileddescription(self): return self.detaileddescription
+ def set_detaileddescription(self, detaileddescription): self.detaileddescription = detaileddescription
+ def get_prot(self): return self.prot
+ def set_prot(self, prot): self.prot = prot
+ def get_id(self): return self.id
+ def set_id(self, id): self.id = id
+ def export(self, outfile, level, namespace_='', name_='enumvalueType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='enumvalueType')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='enumvalueType'):
+ if self.prot is not None:
+ outfile.write(' prot=%s' % (quote_attrib(self.prot), ))
+ if self.id is not None:
+ outfile.write(' id=%s' % (self.format_string(quote_attrib(self.id).encode(ExternalEncoding), input_name='id'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='enumvalueType'):
+ for item_ in self.content_:
+ item_.export(outfile, level, item_.name, namespace_)
+ def hasContent_(self):
+ if (
+ self.name is not None or
+ self.initializer is not None or
+ self.briefdescription is not None or
+ self.detaileddescription is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='enumvalueType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.prot is not None:
+ showIndent(outfile, level)
+ outfile.write('prot = "%s",\n' % (self.prot,))
+ if self.id is not None:
+ showIndent(outfile, level)
+ outfile.write('id = %s,\n' % (self.id,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('prot'):
+ self.prot = attrs.get('prot').value
+ if attrs.get('id'):
+ self.id = attrs.get('id').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'name':
+ value_ = []
+ for text_ in child_.childNodes:
+ value_.append(text_.nodeValue)
+ valuestr_ = ''.join(value_)
+ obj_ = self.mixedclass_(MixedContainer.CategorySimple,
+ MixedContainer.TypeString, 'name', valuestr_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'initializer':
+ childobj_ = linkedTextType.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'initializer', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'briefdescription':
+ childobj_ = descriptionType.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'briefdescription', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'detaileddescription':
+ childobj_ = descriptionType.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'detaileddescription', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+# end class enumvalueType
+
+
+class templateparamlistType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, param=None):
+ if param is None:
+ self.param = []
+ else:
+ self.param = param
+ def factory(*args_, **kwargs_):
+ if templateparamlistType.subclass:
+ return templateparamlistType.subclass(*args_, **kwargs_)
+ else:
+ return templateparamlistType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_param(self): return self.param
+ def set_param(self, param): self.param = param
+ def add_param(self, value): self.param.append(value)
+ def insert_param(self, index, value): self.param[index] = value
+ def export(self, outfile, level, namespace_='', name_='templateparamlistType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='templateparamlistType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='templateparamlistType'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='templateparamlistType'):
+ for param_ in self.param:
+ param_.export(outfile, level, namespace_, name_='param')
+ def hasContent_(self):
+ if (
+ self.param is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='templateparamlistType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('param=[\n')
+ level += 1
+ for param in self.param:
+ showIndent(outfile, level)
+ outfile.write('model_.param(\n')
+ param.exportLiteral(outfile, level, name_='param')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'param':
+ obj_ = paramType.factory()
+ obj_.build(child_)
+ self.param.append(obj_)
+# end class templateparamlistType
+
+
+class paramType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, type_=None, declname=None, defname=None, array=None, defval=None, briefdescription=None):
+ self.type_ = type_
+ self.declname = declname
+ self.defname = defname
+ self.array = array
+ self.defval = defval
+ self.briefdescription = briefdescription
+ def factory(*args_, **kwargs_):
+ if paramType.subclass:
+ return paramType.subclass(*args_, **kwargs_)
+ else:
+ return paramType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_type(self): return self.type_
+ def set_type(self, type_): self.type_ = type_
+ def get_declname(self): return self.declname
+ def set_declname(self, declname): self.declname = declname
+ def get_defname(self): return self.defname
+ def set_defname(self, defname): self.defname = defname
+ def get_array(self): return self.array
+ def set_array(self, array): self.array = array
+ def get_defval(self): return self.defval
+ def set_defval(self, defval): self.defval = defval
+ def get_briefdescription(self): return self.briefdescription
+ def set_briefdescription(self, briefdescription): self.briefdescription = briefdescription
+ def export(self, outfile, level, namespace_='', name_='paramType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='paramType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='paramType'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='paramType'):
+ if self.type_:
+ self.type_.export(outfile, level, namespace_, name_='type')
+ if self.declname is not None:
+ showIndent(outfile, level)
+ outfile.write('<%sdeclname>%s</%sdeclname>\n' % (namespace_, self.format_string(quote_xml(self.declname).encode(ExternalEncoding), input_name='declname'), namespace_))
+ if self.defname is not None:
+ showIndent(outfile, level)
+ outfile.write('<%sdefname>%s</%sdefname>\n' % (namespace_, self.format_string(quote_xml(self.defname).encode(ExternalEncoding), input_name='defname'), namespace_))
+ if self.array is not None:
+ showIndent(outfile, level)
+ outfile.write('<%sarray>%s</%sarray>\n' % (namespace_, self.format_string(quote_xml(self.array).encode(ExternalEncoding), input_name='array'), namespace_))
+ if self.defval:
+ self.defval.export(outfile, level, namespace_, name_='defval')
+ if self.briefdescription:
+ self.briefdescription.export(outfile, level, namespace_, name_='briefdescription')
+ def hasContent_(self):
+ if (
+ self.type_ is not None or
+ self.declname is not None or
+ self.defname is not None or
+ self.array is not None or
+ self.defval is not None or
+ self.briefdescription is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='paramType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ if self.type_:
+ showIndent(outfile, level)
+ outfile.write('type_=model_.linkedTextType(\n')
+ self.type_.exportLiteral(outfile, level, name_='type')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ showIndent(outfile, level)
+ outfile.write('declname=%s,\n' % quote_python(self.declname).encode(ExternalEncoding))
+ showIndent(outfile, level)
+ outfile.write('defname=%s,\n' % quote_python(self.defname).encode(ExternalEncoding))
+ showIndent(outfile, level)
+ outfile.write('array=%s,\n' % quote_python(self.array).encode(ExternalEncoding))
+ if self.defval:
+ showIndent(outfile, level)
+ outfile.write('defval=model_.linkedTextType(\n')
+ self.defval.exportLiteral(outfile, level, name_='defval')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ if self.briefdescription:
+ showIndent(outfile, level)
+ outfile.write('briefdescription=model_.descriptionType(\n')
+ self.briefdescription.exportLiteral(outfile, level, name_='briefdescription')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'type':
+ obj_ = linkedTextType.factory()
+ obj_.build(child_)
+ self.set_type(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'declname':
+ declname_ = ''
+ for text__content_ in child_.childNodes:
+ declname_ += text__content_.nodeValue
+ self.declname = declname_
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'defname':
+ defname_ = ''
+ for text__content_ in child_.childNodes:
+ defname_ += text__content_.nodeValue
+ self.defname = defname_
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'array':
+ array_ = ''
+ for text__content_ in child_.childNodes:
+ array_ += text__content_.nodeValue
+ self.array = array_
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'defval':
+ obj_ = linkedTextType.factory()
+ obj_.build(child_)
+ self.set_defval(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'briefdescription':
+ obj_ = descriptionType.factory()
+ obj_.build(child_)
+ self.set_briefdescription(obj_)
+# end class paramType
+
+
+class declname(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, valueOf_=''):
+ self.valueOf_ = valueOf_
+ def factory(*args_, **kwargs_):
+ if declname.subclass:
+ return declname.subclass(*args_, **kwargs_)
+ else:
+ return declname(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='declname', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='declname')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='declname'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='declname'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='declname'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class declname
+
+
+class defname(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, valueOf_=''):
+ self.valueOf_ = valueOf_
+ def factory(*args_, **kwargs_):
+ if defname.subclass:
+ return defname.subclass(*args_, **kwargs_)
+ else:
+ return defname(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='defname', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='defname')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='defname'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='defname'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='defname'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class defname
+
+
+class array(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, valueOf_=''):
+ self.valueOf_ = valueOf_
+ def factory(*args_, **kwargs_):
+ if array.subclass:
+ return array.subclass(*args_, **kwargs_)
+ else:
+ return array(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='array', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='array')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='array'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='array'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='array'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class array
+
+
+class linkedTextType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, ref=None, mixedclass_=None, content_=None):
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if linkedTextType.subclass:
+ return linkedTextType.subclass(*args_, **kwargs_)
+ else:
+ return linkedTextType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_ref(self): return self.ref
+ def set_ref(self, ref): self.ref = ref
+ def add_ref(self, value): self.ref.append(value)
+ def insert_ref(self, index, value): self.ref[index] = value
+ def export(self, outfile, level, namespace_='', name_='linkedTextType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='linkedTextType')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='linkedTextType'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='linkedTextType'):
+ for item_ in self.content_:
+ item_.export(outfile, level, item_.name, namespace_)
+ def hasContent_(self):
+ if (
+ self.ref is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='linkedTextType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'ref':
+ childobj_ = docRefTextType.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'ref', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+# end class linkedTextType
+
+
+class graphType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, node=None):
+ if node is None:
+ self.node = []
+ else:
+ self.node = node
+ def factory(*args_, **kwargs_):
+ if graphType.subclass:
+ return graphType.subclass(*args_, **kwargs_)
+ else:
+ return graphType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_node(self): return self.node
+ def set_node(self, node): self.node = node
+ def add_node(self, value): self.node.append(value)
+ def insert_node(self, index, value): self.node[index] = value
+ def export(self, outfile, level, namespace_='', name_='graphType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='graphType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='graphType'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='graphType'):
+ for node_ in self.node:
+ node_.export(outfile, level, namespace_, name_='node')
+ def hasContent_(self):
+ if (
+ self.node is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='graphType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('node=[\n')
+ level += 1
+ for node in self.node:
+ showIndent(outfile, level)
+ outfile.write('model_.node(\n')
+ node.exportLiteral(outfile, level, name_='node')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'node':
+ obj_ = nodeType.factory()
+ obj_.build(child_)
+ self.node.append(obj_)
+# end class graphType
+
+
+class nodeType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, id=None, label=None, link=None, childnode=None):
+ self.id = id
+ self.label = label
+ self.link = link
+ if childnode is None:
+ self.childnode = []
+ else:
+ self.childnode = childnode
+ def factory(*args_, **kwargs_):
+ if nodeType.subclass:
+ return nodeType.subclass(*args_, **kwargs_)
+ else:
+ return nodeType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_label(self): return self.label
+ def set_label(self, label): self.label = label
+ def get_link(self): return self.link
+ def set_link(self, link): self.link = link
+ def get_childnode(self): return self.childnode
+ def set_childnode(self, childnode): self.childnode = childnode
+ def add_childnode(self, value): self.childnode.append(value)
+ def insert_childnode(self, index, value): self.childnode[index] = value
+ def get_id(self): return self.id
+ def set_id(self, id): self.id = id
+ def export(self, outfile, level, namespace_='', name_='nodeType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='nodeType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='nodeType'):
+ if self.id is not None:
+ outfile.write(' id=%s' % (self.format_string(quote_attrib(self.id).encode(ExternalEncoding), input_name='id'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='nodeType'):
+ if self.label is not None:
+ showIndent(outfile, level)
+ outfile.write('<%slabel>%s</%slabel>\n' % (namespace_, self.format_string(quote_xml(self.label).encode(ExternalEncoding), input_name='label'), namespace_))
+ if self.link:
+ self.link.export(outfile, level, namespace_, name_='link')
+ for childnode_ in self.childnode:
+ childnode_.export(outfile, level, namespace_, name_='childnode')
+ def hasContent_(self):
+ if (
+ self.label is not None or
+ self.link is not None or
+ self.childnode is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='nodeType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.id is not None:
+ showIndent(outfile, level)
+ outfile.write('id = %s,\n' % (self.id,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('label=%s,\n' % quote_python(self.label).encode(ExternalEncoding))
+ if self.link:
+ showIndent(outfile, level)
+ outfile.write('link=model_.linkType(\n')
+ self.link.exportLiteral(outfile, level, name_='link')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ showIndent(outfile, level)
+ outfile.write('childnode=[\n')
+ level += 1
+ for childnode in self.childnode:
+ showIndent(outfile, level)
+ outfile.write('model_.childnode(\n')
+ childnode.exportLiteral(outfile, level, name_='childnode')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('id'):
+ self.id = attrs.get('id').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'label':
+ label_ = ''
+ for text__content_ in child_.childNodes:
+ label_ += text__content_.nodeValue
+ self.label = label_
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'link':
+ obj_ = linkType.factory()
+ obj_.build(child_)
+ self.set_link(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'childnode':
+ obj_ = childnodeType.factory()
+ obj_.build(child_)
+ self.childnode.append(obj_)
+# end class nodeType
+
+
+class label(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, valueOf_=''):
+ self.valueOf_ = valueOf_
+ def factory(*args_, **kwargs_):
+ if label.subclass:
+ return label.subclass(*args_, **kwargs_)
+ else:
+ return label(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='label', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='label')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='label'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='label'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='label'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class label
+
+
+class childnodeType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, relation=None, refid=None, edgelabel=None):
+ self.relation = relation
+ self.refid = refid
+ if edgelabel is None:
+ self.edgelabel = []
+ else:
+ self.edgelabel = edgelabel
+ def factory(*args_, **kwargs_):
+ if childnodeType.subclass:
+ return childnodeType.subclass(*args_, **kwargs_)
+ else:
+ return childnodeType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_edgelabel(self): return self.edgelabel
+ def set_edgelabel(self, edgelabel): self.edgelabel = edgelabel
+ def add_edgelabel(self, value): self.edgelabel.append(value)
+ def insert_edgelabel(self, index, value): self.edgelabel[index] = value
+ def get_relation(self): return self.relation
+ def set_relation(self, relation): self.relation = relation
+ def get_refid(self): return self.refid
+ def set_refid(self, refid): self.refid = refid
+ def export(self, outfile, level, namespace_='', name_='childnodeType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='childnodeType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='childnodeType'):
+ if self.relation is not None:
+ outfile.write(' relation=%s' % (quote_attrib(self.relation), ))
+ if self.refid is not None:
+ outfile.write(' refid=%s' % (self.format_string(quote_attrib(self.refid).encode(ExternalEncoding), input_name='refid'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='childnodeType'):
+ for edgelabel_ in self.edgelabel:
+ showIndent(outfile, level)
+ outfile.write('<%sedgelabel>%s</%sedgelabel>\n' % (namespace_, self.format_string(quote_xml(edgelabel_).encode(ExternalEncoding), input_name='edgelabel'), namespace_))
+ def hasContent_(self):
+ if (
+ self.edgelabel is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='childnodeType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.relation is not None:
+ showIndent(outfile, level)
+ outfile.write('relation = "%s",\n' % (self.relation,))
+ if self.refid is not None:
+ showIndent(outfile, level)
+ outfile.write('refid = %s,\n' % (self.refid,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('edgelabel=[\n')
+ level += 1
+ for edgelabel in self.edgelabel:
+ showIndent(outfile, level)
+ outfile.write('%s,\n' % quote_python(edgelabel).encode(ExternalEncoding))
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('relation'):
+ self.relation = attrs.get('relation').value
+ if attrs.get('refid'):
+ self.refid = attrs.get('refid').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'edgelabel':
+ edgelabel_ = ''
+ for text__content_ in child_.childNodes:
+ edgelabel_ += text__content_.nodeValue
+ self.edgelabel.append(edgelabel_)
+# end class childnodeType
+
+
+class edgelabel(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, valueOf_=''):
+ self.valueOf_ = valueOf_
+ def factory(*args_, **kwargs_):
+ if edgelabel.subclass:
+ return edgelabel.subclass(*args_, **kwargs_)
+ else:
+ return edgelabel(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='edgelabel', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='edgelabel')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='edgelabel'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='edgelabel'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='edgelabel'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class edgelabel
+
+
+class linkType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, refid=None, external=None, valueOf_=''):
+ self.refid = refid
+ self.external = external
+ self.valueOf_ = valueOf_
+ def factory(*args_, **kwargs_):
+ if linkType.subclass:
+ return linkType.subclass(*args_, **kwargs_)
+ else:
+ return linkType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_refid(self): return self.refid
+ def set_refid(self, refid): self.refid = refid
+ def get_external(self): return self.external
+ def set_external(self, external): self.external = external
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='linkType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='linkType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='linkType'):
+ if self.refid is not None:
+ outfile.write(' refid=%s' % (self.format_string(quote_attrib(self.refid).encode(ExternalEncoding), input_name='refid'), ))
+ if self.external is not None:
+ outfile.write(' external=%s' % (self.format_string(quote_attrib(self.external).encode(ExternalEncoding), input_name='external'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='linkType'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='linkType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.refid is not None:
+ showIndent(outfile, level)
+ outfile.write('refid = %s,\n' % (self.refid,))
+ if self.external is not None:
+ showIndent(outfile, level)
+ outfile.write('external = %s,\n' % (self.external,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('refid'):
+ self.refid = attrs.get('refid').value
+ if attrs.get('external'):
+ self.external = attrs.get('external').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class linkType
+
+
+class listingType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, codeline=None):
+ if codeline is None:
+ self.codeline = []
+ else:
+ self.codeline = codeline
+ def factory(*args_, **kwargs_):
+ if listingType.subclass:
+ return listingType.subclass(*args_, **kwargs_)
+ else:
+ return listingType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_codeline(self): return self.codeline
+ def set_codeline(self, codeline): self.codeline = codeline
+ def add_codeline(self, value): self.codeline.append(value)
+ def insert_codeline(self, index, value): self.codeline[index] = value
+ def export(self, outfile, level, namespace_='', name_='listingType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='listingType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='listingType'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='listingType'):
+ for codeline_ in self.codeline:
+ codeline_.export(outfile, level, namespace_, name_='codeline')
+ def hasContent_(self):
+ if (
+ self.codeline is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='listingType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('codeline=[\n')
+ level += 1
+ for codeline in self.codeline:
+ showIndent(outfile, level)
+ outfile.write('model_.codeline(\n')
+ codeline.exportLiteral(outfile, level, name_='codeline')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'codeline':
+ obj_ = codelineType.factory()
+ obj_.build(child_)
+ self.codeline.append(obj_)
+# end class listingType
+
+
+class codelineType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, external=None, lineno=None, refkind=None, refid=None, highlight=None):
+ self.external = external
+ self.lineno = lineno
+ self.refkind = refkind
+ self.refid = refid
+ if highlight is None:
+ self.highlight = []
+ else:
+ self.highlight = highlight
+ def factory(*args_, **kwargs_):
+ if codelineType.subclass:
+ return codelineType.subclass(*args_, **kwargs_)
+ else:
+ return codelineType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_highlight(self): return self.highlight
+ def set_highlight(self, highlight): self.highlight = highlight
+ def add_highlight(self, value): self.highlight.append(value)
+ def insert_highlight(self, index, value): self.highlight[index] = value
+ def get_external(self): return self.external
+ def set_external(self, external): self.external = external
+ def get_lineno(self): return self.lineno
+ def set_lineno(self, lineno): self.lineno = lineno
+ def get_refkind(self): return self.refkind
+ def set_refkind(self, refkind): self.refkind = refkind
+ def get_refid(self): return self.refid
+ def set_refid(self, refid): self.refid = refid
+ def export(self, outfile, level, namespace_='', name_='codelineType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='codelineType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='codelineType'):
+ if self.external is not None:
+ outfile.write(' external=%s' % (quote_attrib(self.external), ))
+ if self.lineno is not None:
+ outfile.write(' lineno="%s"' % self.format_integer(self.lineno, input_name='lineno'))
+ if self.refkind is not None:
+ outfile.write(' refkind=%s' % (quote_attrib(self.refkind), ))
+ if self.refid is not None:
+ outfile.write(' refid=%s' % (self.format_string(quote_attrib(self.refid).encode(ExternalEncoding), input_name='refid'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='codelineType'):
+ for highlight_ in self.highlight:
+ highlight_.export(outfile, level, namespace_, name_='highlight')
+ def hasContent_(self):
+ if (
+ self.highlight is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='codelineType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.external is not None:
+ showIndent(outfile, level)
+ outfile.write('external = "%s",\n' % (self.external,))
+ if self.lineno is not None:
+ showIndent(outfile, level)
+ outfile.write('lineno = %s,\n' % (self.lineno,))
+ if self.refkind is not None:
+ showIndent(outfile, level)
+ outfile.write('refkind = "%s",\n' % (self.refkind,))
+ if self.refid is not None:
+ showIndent(outfile, level)
+ outfile.write('refid = %s,\n' % (self.refid,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('highlight=[\n')
+ level += 1
+ for highlight in self.highlight:
+ showIndent(outfile, level)
+ outfile.write('model_.highlight(\n')
+ highlight.exportLiteral(outfile, level, name_='highlight')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('external'):
+ self.external = attrs.get('external').value
+ if attrs.get('lineno'):
+ try:
+ self.lineno = int(attrs.get('lineno').value)
+ except ValueError, exp:
+ raise ValueError('Bad integer attribute (lineno): %s' % exp)
+ if attrs.get('refkind'):
+ self.refkind = attrs.get('refkind').value
+ if attrs.get('refid'):
+ self.refid = attrs.get('refid').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'highlight':
+ obj_ = highlightType.factory()
+ obj_.build(child_)
+ self.highlight.append(obj_)
+# end class codelineType
+
+
+class highlightType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, classxx=None, sp=None, ref=None, mixedclass_=None, content_=None):
+ self.classxx = classxx
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if highlightType.subclass:
+ return highlightType.subclass(*args_, **kwargs_)
+ else:
+ return highlightType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_sp(self): return self.sp
+ def set_sp(self, sp): self.sp = sp
+ def add_sp(self, value): self.sp.append(value)
+ def insert_sp(self, index, value): self.sp[index] = value
+ def get_ref(self): return self.ref
+ def set_ref(self, ref): self.ref = ref
+ def add_ref(self, value): self.ref.append(value)
+ def insert_ref(self, index, value): self.ref[index] = value
+ def get_class(self): return self.classxx
+ def set_class(self, classxx): self.classxx = classxx
+ def export(self, outfile, level, namespace_='', name_='highlightType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='highlightType')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='highlightType'):
+ if self.classxx is not None:
+ outfile.write(' class=%s' % (quote_attrib(self.classxx), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='highlightType'):
+ for item_ in self.content_:
+ item_.export(outfile, level, item_.name, namespace_)
+ def hasContent_(self):
+ if (
+ self.sp is not None or
+ self.ref is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='highlightType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.classxx is not None:
+ showIndent(outfile, level)
+ outfile.write('classxx = "%s",\n' % (self.classxx,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('class'):
+ self.classxx = attrs.get('class').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'sp':
+ value_ = []
+ for text_ in child_.childNodes:
+ value_.append(text_.nodeValue)
+ valuestr_ = ''.join(value_)
+ obj_ = self.mixedclass_(MixedContainer.CategorySimple,
+ MixedContainer.TypeString, 'sp', valuestr_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'ref':
+ childobj_ = docRefTextType.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'ref', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+# end class highlightType
+
+
+class sp(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, valueOf_=''):
+ self.valueOf_ = valueOf_
+ def factory(*args_, **kwargs_):
+ if sp.subclass:
+ return sp.subclass(*args_, **kwargs_)
+ else:
+ return sp(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='sp', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='sp')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='sp'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='sp'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='sp'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class sp
+
+
+class referenceType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, endline=None, startline=None, refid=None, compoundref=None, valueOf_='', mixedclass_=None, content_=None):
+ self.endline = endline
+ self.startline = startline
+ self.refid = refid
+ self.compoundref = compoundref
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if referenceType.subclass:
+ return referenceType.subclass(*args_, **kwargs_)
+ else:
+ return referenceType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_endline(self): return self.endline
+ def set_endline(self, endline): self.endline = endline
+ def get_startline(self): return self.startline
+ def set_startline(self, startline): self.startline = startline
+ def get_refid(self): return self.refid
+ def set_refid(self, refid): self.refid = refid
+ def get_compoundref(self): return self.compoundref
+ def set_compoundref(self, compoundref): self.compoundref = compoundref
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='referenceType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='referenceType')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='referenceType'):
+ if self.endline is not None:
+ outfile.write(' endline="%s"' % self.format_integer(self.endline, input_name='endline'))
+ if self.startline is not None:
+ outfile.write(' startline="%s"' % self.format_integer(self.startline, input_name='startline'))
+ if self.refid is not None:
+ outfile.write(' refid=%s' % (self.format_string(quote_attrib(self.refid).encode(ExternalEncoding), input_name='refid'), ))
+ if self.compoundref is not None:
+ outfile.write(' compoundref=%s' % (self.format_string(quote_attrib(self.compoundref).encode(ExternalEncoding), input_name='compoundref'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='referenceType'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='referenceType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.endline is not None:
+ showIndent(outfile, level)
+ outfile.write('endline = %s,\n' % (self.endline,))
+ if self.startline is not None:
+ showIndent(outfile, level)
+ outfile.write('startline = %s,\n' % (self.startline,))
+ if self.refid is not None:
+ showIndent(outfile, level)
+ outfile.write('refid = %s,\n' % (self.refid,))
+ if self.compoundref is not None:
+ showIndent(outfile, level)
+ outfile.write('compoundref = %s,\n' % (self.compoundref,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('endline'):
+ try:
+ self.endline = int(attrs.get('endline').value)
+ except ValueError, exp:
+ raise ValueError('Bad integer attribute (endline): %s' % exp)
+ if attrs.get('startline'):
+ try:
+ self.startline = int(attrs.get('startline').value)
+ except ValueError, exp:
+ raise ValueError('Bad integer attribute (startline): %s' % exp)
+ if attrs.get('refid'):
+ self.refid = attrs.get('refid').value
+ if attrs.get('compoundref'):
+ self.compoundref = attrs.get('compoundref').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class referenceType
+
+
+class locationType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, bodystart=None, line=None, bodyend=None, bodyfile=None, file=None, valueOf_=''):
+ self.bodystart = bodystart
+ self.line = line
+ self.bodyend = bodyend
+ self.bodyfile = bodyfile
+ self.file = file
+ self.valueOf_ = valueOf_
+ def factory(*args_, **kwargs_):
+ if locationType.subclass:
+ return locationType.subclass(*args_, **kwargs_)
+ else:
+ return locationType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_bodystart(self): return self.bodystart
+ def set_bodystart(self, bodystart): self.bodystart = bodystart
+ def get_line(self): return self.line
+ def set_line(self, line): self.line = line
+ def get_bodyend(self): return self.bodyend
+ def set_bodyend(self, bodyend): self.bodyend = bodyend
+ def get_bodyfile(self): return self.bodyfile
+ def set_bodyfile(self, bodyfile): self.bodyfile = bodyfile
+ def get_file(self): return self.file
+ def set_file(self, file): self.file = file
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='locationType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='locationType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='locationType'):
+ if self.bodystart is not None:
+ outfile.write(' bodystart="%s"' % self.format_integer(self.bodystart, input_name='bodystart'))
+ if self.line is not None:
+ outfile.write(' line="%s"' % self.format_integer(self.line, input_name='line'))
+ if self.bodyend is not None:
+ outfile.write(' bodyend="%s"' % self.format_integer(self.bodyend, input_name='bodyend'))
+ if self.bodyfile is not None:
+ outfile.write(' bodyfile=%s' % (self.format_string(quote_attrib(self.bodyfile).encode(ExternalEncoding), input_name='bodyfile'), ))
+ if self.file is not None:
+ outfile.write(' file=%s' % (self.format_string(quote_attrib(self.file).encode(ExternalEncoding), input_name='file'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='locationType'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='locationType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.bodystart is not None:
+ showIndent(outfile, level)
+ outfile.write('bodystart = %s,\n' % (self.bodystart,))
+ if self.line is not None:
+ showIndent(outfile, level)
+ outfile.write('line = %s,\n' % (self.line,))
+ if self.bodyend is not None:
+ showIndent(outfile, level)
+ outfile.write('bodyend = %s,\n' % (self.bodyend,))
+ if self.bodyfile is not None:
+ showIndent(outfile, level)
+ outfile.write('bodyfile = %s,\n' % (self.bodyfile,))
+ if self.file is not None:
+ showIndent(outfile, level)
+ outfile.write('file = %s,\n' % (self.file,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('bodystart'):
+ try:
+ self.bodystart = int(attrs.get('bodystart').value)
+ except ValueError, exp:
+ raise ValueError('Bad integer attribute (bodystart): %s' % exp)
+ if attrs.get('line'):
+ try:
+ self.line = int(attrs.get('line').value)
+ except ValueError, exp:
+ raise ValueError('Bad integer attribute (line): %s' % exp)
+ if attrs.get('bodyend'):
+ try:
+ self.bodyend = int(attrs.get('bodyend').value)
+ except ValueError, exp:
+ raise ValueError('Bad integer attribute (bodyend): %s' % exp)
+ if attrs.get('bodyfile'):
+ self.bodyfile = attrs.get('bodyfile').value
+ if attrs.get('file'):
+ self.file = attrs.get('file').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class locationType
+
+
+class docSect1Type(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, id=None, title=None, para=None, sect2=None, internal=None, mixedclass_=None, content_=None):
+ self.id = id
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if docSect1Type.subclass:
+ return docSect1Type.subclass(*args_, **kwargs_)
+ else:
+ return docSect1Type(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_title(self): return self.title
+ def set_title(self, title): self.title = title
+ def get_para(self): return self.para
+ def set_para(self, para): self.para = para
+ def add_para(self, value): self.para.append(value)
+ def insert_para(self, index, value): self.para[index] = value
+ def get_sect2(self): return self.sect2
+ def set_sect2(self, sect2): self.sect2 = sect2
+ def add_sect2(self, value): self.sect2.append(value)
+ def insert_sect2(self, index, value): self.sect2[index] = value
+ def get_internal(self): return self.internal
+ def set_internal(self, internal): self.internal = internal
+ def get_id(self): return self.id
+ def set_id(self, id): self.id = id
+ def export(self, outfile, level, namespace_='', name_='docSect1Type', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docSect1Type')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='docSect1Type'):
+ if self.id is not None:
+ outfile.write(' id=%s' % (self.format_string(quote_attrib(self.id).encode(ExternalEncoding), input_name='id'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='docSect1Type'):
+ for item_ in self.content_:
+ item_.export(outfile, level, item_.name, namespace_)
+ def hasContent_(self):
+ if (
+ self.title is not None or
+ self.para is not None or
+ self.sect2 is not None or
+ self.internal is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docSect1Type'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.id is not None:
+ showIndent(outfile, level)
+ outfile.write('id = %s,\n' % (self.id,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('id'):
+ self.id = attrs.get('id').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'title':
+ childobj_ = docTitleType.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'title', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'para':
+ childobj_ = docParaType.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'para', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'sect2':
+ childobj_ = docSect2Type.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'sect2', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'internal':
+ childobj_ = docInternalS1Type.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'internal', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+# end class docSect1Type
+
+
+class docSect2Type(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, id=None, title=None, para=None, sect3=None, internal=None, mixedclass_=None, content_=None):
+ self.id = id
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if docSect2Type.subclass:
+ return docSect2Type.subclass(*args_, **kwargs_)
+ else:
+ return docSect2Type(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_title(self): return self.title
+ def set_title(self, title): self.title = title
+ def get_para(self): return self.para
+ def set_para(self, para): self.para = para
+ def add_para(self, value): self.para.append(value)
+ def insert_para(self, index, value): self.para[index] = value
+ def get_sect3(self): return self.sect3
+ def set_sect3(self, sect3): self.sect3 = sect3
+ def add_sect3(self, value): self.sect3.append(value)
+ def insert_sect3(self, index, value): self.sect3[index] = value
+ def get_internal(self): return self.internal
+ def set_internal(self, internal): self.internal = internal
+ def get_id(self): return self.id
+ def set_id(self, id): self.id = id
+ def export(self, outfile, level, namespace_='', name_='docSect2Type', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docSect2Type')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='docSect2Type'):
+ if self.id is not None:
+ outfile.write(' id=%s' % (self.format_string(quote_attrib(self.id).encode(ExternalEncoding), input_name='id'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='docSect2Type'):
+ for item_ in self.content_:
+ item_.export(outfile, level, item_.name, namespace_)
+ def hasContent_(self):
+ if (
+ self.title is not None or
+ self.para is not None or
+ self.sect3 is not None or
+ self.internal is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docSect2Type'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.id is not None:
+ showIndent(outfile, level)
+ outfile.write('id = %s,\n' % (self.id,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('id'):
+ self.id = attrs.get('id').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'title':
+ childobj_ = docTitleType.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'title', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'para':
+ childobj_ = docParaType.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'para', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'sect3':
+ childobj_ = docSect3Type.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'sect3', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'internal':
+ childobj_ = docInternalS2Type.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'internal', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+# end class docSect2Type
+
+
+class docSect3Type(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, id=None, title=None, para=None, sect4=None, internal=None, mixedclass_=None, content_=None):
+ self.id = id
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if docSect3Type.subclass:
+ return docSect3Type.subclass(*args_, **kwargs_)
+ else:
+ return docSect3Type(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_title(self): return self.title
+ def set_title(self, title): self.title = title
+ def get_para(self): return self.para
+ def set_para(self, para): self.para = para
+ def add_para(self, value): self.para.append(value)
+ def insert_para(self, index, value): self.para[index] = value
+ def get_sect4(self): return self.sect4
+ def set_sect4(self, sect4): self.sect4 = sect4
+ def add_sect4(self, value): self.sect4.append(value)
+ def insert_sect4(self, index, value): self.sect4[index] = value
+ def get_internal(self): return self.internal
+ def set_internal(self, internal): self.internal = internal
+ def get_id(self): return self.id
+ def set_id(self, id): self.id = id
+ def export(self, outfile, level, namespace_='', name_='docSect3Type', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docSect3Type')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='docSect3Type'):
+ if self.id is not None:
+ outfile.write(' id=%s' % (self.format_string(quote_attrib(self.id).encode(ExternalEncoding), input_name='id'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='docSect3Type'):
+ for item_ in self.content_:
+ item_.export(outfile, level, item_.name, namespace_)
+ def hasContent_(self):
+ if (
+ self.title is not None or
+ self.para is not None or
+ self.sect4 is not None or
+ self.internal is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docSect3Type'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.id is not None:
+ showIndent(outfile, level)
+ outfile.write('id = %s,\n' % (self.id,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('id'):
+ self.id = attrs.get('id').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'title':
+ childobj_ = docTitleType.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'title', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'para':
+ childobj_ = docParaType.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'para', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'sect4':
+ childobj_ = docSect4Type.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'sect4', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'internal':
+ childobj_ = docInternalS3Type.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'internal', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+# end class docSect3Type
+
+
+class docSect4Type(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, id=None, title=None, para=None, internal=None, mixedclass_=None, content_=None):
+ self.id = id
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if docSect4Type.subclass:
+ return docSect4Type.subclass(*args_, **kwargs_)
+ else:
+ return docSect4Type(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_title(self): return self.title
+ def set_title(self, title): self.title = title
+ def get_para(self): return self.para
+ def set_para(self, para): self.para = para
+ def add_para(self, value): self.para.append(value)
+ def insert_para(self, index, value): self.para[index] = value
+ def get_internal(self): return self.internal
+ def set_internal(self, internal): self.internal = internal
+ def get_id(self): return self.id
+ def set_id(self, id): self.id = id
+ def export(self, outfile, level, namespace_='', name_='docSect4Type', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docSect4Type')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='docSect4Type'):
+ if self.id is not None:
+ outfile.write(' id=%s' % (self.format_string(quote_attrib(self.id).encode(ExternalEncoding), input_name='id'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='docSect4Type'):
+ for item_ in self.content_:
+ item_.export(outfile, level, item_.name, namespace_)
+ def hasContent_(self):
+ if (
+ self.title is not None or
+ self.para is not None or
+ self.internal is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docSect4Type'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.id is not None:
+ showIndent(outfile, level)
+ outfile.write('id = %s,\n' % (self.id,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('id'):
+ self.id = attrs.get('id').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'title':
+ childobj_ = docTitleType.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'title', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'para':
+ childobj_ = docParaType.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'para', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'internal':
+ childobj_ = docInternalS4Type.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'internal', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+# end class docSect4Type
+
+
+class docInternalType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, para=None, sect1=None, mixedclass_=None, content_=None):
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if docInternalType.subclass:
+ return docInternalType.subclass(*args_, **kwargs_)
+ else:
+ return docInternalType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_para(self): return self.para
+ def set_para(self, para): self.para = para
+ def add_para(self, value): self.para.append(value)
+ def insert_para(self, index, value): self.para[index] = value
+ def get_sect1(self): return self.sect1
+ def set_sect1(self, sect1): self.sect1 = sect1
+ def add_sect1(self, value): self.sect1.append(value)
+ def insert_sect1(self, index, value): self.sect1[index] = value
+ def export(self, outfile, level, namespace_='', name_='docInternalType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docInternalType')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='docInternalType'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='docInternalType'):
+ for item_ in self.content_:
+ item_.export(outfile, level, item_.name, namespace_)
+ def hasContent_(self):
+ if (
+ self.para is not None or
+ self.sect1 is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docInternalType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'para':
+ childobj_ = docParaType.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'para', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'sect1':
+ childobj_ = docSect1Type.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'sect1', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+# end class docInternalType
+
+
+class docInternalS1Type(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, para=None, sect2=None, mixedclass_=None, content_=None):
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if docInternalS1Type.subclass:
+ return docInternalS1Type.subclass(*args_, **kwargs_)
+ else:
+ return docInternalS1Type(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_para(self): return self.para
+ def set_para(self, para): self.para = para
+ def add_para(self, value): self.para.append(value)
+ def insert_para(self, index, value): self.para[index] = value
+ def get_sect2(self): return self.sect2
+ def set_sect2(self, sect2): self.sect2 = sect2
+ def add_sect2(self, value): self.sect2.append(value)
+ def insert_sect2(self, index, value): self.sect2[index] = value
+ def export(self, outfile, level, namespace_='', name_='docInternalS1Type', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docInternalS1Type')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='docInternalS1Type'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='docInternalS1Type'):
+ for item_ in self.content_:
+ item_.export(outfile, level, item_.name, namespace_)
+ def hasContent_(self):
+ if (
+ self.para is not None or
+ self.sect2 is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docInternalS1Type'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'para':
+ childobj_ = docParaType.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'para', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'sect2':
+ childobj_ = docSect2Type.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'sect2', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+# end class docInternalS1Type
+
+
+class docInternalS2Type(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, para=None, sect3=None, mixedclass_=None, content_=None):
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if docInternalS2Type.subclass:
+ return docInternalS2Type.subclass(*args_, **kwargs_)
+ else:
+ return docInternalS2Type(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_para(self): return self.para
+ def set_para(self, para): self.para = para
+ def add_para(self, value): self.para.append(value)
+ def insert_para(self, index, value): self.para[index] = value
+ def get_sect3(self): return self.sect3
+ def set_sect3(self, sect3): self.sect3 = sect3
+ def add_sect3(self, value): self.sect3.append(value)
+ def insert_sect3(self, index, value): self.sect3[index] = value
+ def export(self, outfile, level, namespace_='', name_='docInternalS2Type', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docInternalS2Type')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='docInternalS2Type'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='docInternalS2Type'):
+ for item_ in self.content_:
+ item_.export(outfile, level, item_.name, namespace_)
+ def hasContent_(self):
+ if (
+ self.para is not None or
+ self.sect3 is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docInternalS2Type'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'para':
+ childobj_ = docParaType.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'para', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'sect3':
+ childobj_ = docSect3Type.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'sect3', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+# end class docInternalS2Type
+
+
+class docInternalS3Type(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, para=None, sect3=None, mixedclass_=None, content_=None):
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if docInternalS3Type.subclass:
+ return docInternalS3Type.subclass(*args_, **kwargs_)
+ else:
+ return docInternalS3Type(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_para(self): return self.para
+ def set_para(self, para): self.para = para
+ def add_para(self, value): self.para.append(value)
+ def insert_para(self, index, value): self.para[index] = value
+ def get_sect3(self): return self.sect3
+ def set_sect3(self, sect3): self.sect3 = sect3
+ def add_sect3(self, value): self.sect3.append(value)
+ def insert_sect3(self, index, value): self.sect3[index] = value
+ def export(self, outfile, level, namespace_='', name_='docInternalS3Type', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docInternalS3Type')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='docInternalS3Type'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='docInternalS3Type'):
+ for item_ in self.content_:
+ item_.export(outfile, level, item_.name, namespace_)
+ def hasContent_(self):
+ if (
+ self.para is not None or
+ self.sect3 is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docInternalS3Type'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'para':
+ childobj_ = docParaType.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'para', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'sect3':
+ childobj_ = docSect4Type.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'sect3', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+# end class docInternalS3Type
+
+
+class docInternalS4Type(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, para=None, mixedclass_=None, content_=None):
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if docInternalS4Type.subclass:
+ return docInternalS4Type.subclass(*args_, **kwargs_)
+ else:
+ return docInternalS4Type(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_para(self): return self.para
+ def set_para(self, para): self.para = para
+ def add_para(self, value): self.para.append(value)
+ def insert_para(self, index, value): self.para[index] = value
+ def export(self, outfile, level, namespace_='', name_='docInternalS4Type', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docInternalS4Type')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='docInternalS4Type'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='docInternalS4Type'):
+ for item_ in self.content_:
+ item_.export(outfile, level, item_.name, namespace_)
+ def hasContent_(self):
+ if (
+ self.para is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docInternalS4Type'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'para':
+ childobj_ = docParaType.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'para', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+# end class docInternalS4Type
+
+
+class docTitleType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, valueOf_='', mixedclass_=None, content_=None):
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if docTitleType.subclass:
+ return docTitleType.subclass(*args_, **kwargs_)
+ else:
+ return docTitleType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='docTitleType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docTitleType')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='docTitleType'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='docTitleType'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docTitleType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class docTitleType
+
+
+class docParaType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, valueOf_='', mixedclass_=None, content_=None):
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if docParaType.subclass:
+ return docParaType.subclass(*args_, **kwargs_)
+ else:
+ return docParaType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='docParaType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docParaType')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='docParaType'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='docParaType'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docParaType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class docParaType
+
+
+class docMarkupType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, valueOf_='', mixedclass_=None, content_=None):
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if docMarkupType.subclass:
+ return docMarkupType.subclass(*args_, **kwargs_)
+ else:
+ return docMarkupType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='docMarkupType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docMarkupType')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='docMarkupType'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='docMarkupType'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docMarkupType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class docMarkupType
+
+
+class docURLLink(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, url=None, valueOf_='', mixedclass_=None, content_=None):
+ self.url = url
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if docURLLink.subclass:
+ return docURLLink.subclass(*args_, **kwargs_)
+ else:
+ return docURLLink(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_url(self): return self.url
+ def set_url(self, url): self.url = url
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='docURLLink', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docURLLink')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='docURLLink'):
+ if self.url is not None:
+ outfile.write(' url=%s' % (self.format_string(quote_attrib(self.url).encode(ExternalEncoding), input_name='url'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='docURLLink'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docURLLink'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.url is not None:
+ showIndent(outfile, level)
+ outfile.write('url = %s,\n' % (self.url,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('url'):
+ self.url = attrs.get('url').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class docURLLink
+
+
+class docAnchorType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, id=None, valueOf_='', mixedclass_=None, content_=None):
+ self.id = id
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if docAnchorType.subclass:
+ return docAnchorType.subclass(*args_, **kwargs_)
+ else:
+ return docAnchorType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_id(self): return self.id
+ def set_id(self, id): self.id = id
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='docAnchorType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docAnchorType')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='docAnchorType'):
+ if self.id is not None:
+ outfile.write(' id=%s' % (self.format_string(quote_attrib(self.id).encode(ExternalEncoding), input_name='id'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='docAnchorType'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docAnchorType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.id is not None:
+ showIndent(outfile, level)
+ outfile.write('id = %s,\n' % (self.id,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('id'):
+ self.id = attrs.get('id').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class docAnchorType
+
+
+class docFormulaType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, id=None, valueOf_='', mixedclass_=None, content_=None):
+ self.id = id
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if docFormulaType.subclass:
+ return docFormulaType.subclass(*args_, **kwargs_)
+ else:
+ return docFormulaType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_id(self): return self.id
+ def set_id(self, id): self.id = id
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='docFormulaType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docFormulaType')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='docFormulaType'):
+ if self.id is not None:
+ outfile.write(' id=%s' % (self.format_string(quote_attrib(self.id).encode(ExternalEncoding), input_name='id'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='docFormulaType'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docFormulaType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.id is not None:
+ showIndent(outfile, level)
+ outfile.write('id = %s,\n' % (self.id,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('id'):
+ self.id = attrs.get('id').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class docFormulaType
+
+
+class docIndexEntryType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, primaryie=None, secondaryie=None):
+ self.primaryie = primaryie
+ self.secondaryie = secondaryie
+ def factory(*args_, **kwargs_):
+ if docIndexEntryType.subclass:
+ return docIndexEntryType.subclass(*args_, **kwargs_)
+ else:
+ return docIndexEntryType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_primaryie(self): return self.primaryie
+ def set_primaryie(self, primaryie): self.primaryie = primaryie
+ def get_secondaryie(self): return self.secondaryie
+ def set_secondaryie(self, secondaryie): self.secondaryie = secondaryie
+ def export(self, outfile, level, namespace_='', name_='docIndexEntryType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docIndexEntryType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='docIndexEntryType'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='docIndexEntryType'):
+ if self.primaryie is not None:
+ showIndent(outfile, level)
+ outfile.write('<%sprimaryie>%s</%sprimaryie>\n' % (namespace_, self.format_string(quote_xml(self.primaryie).encode(ExternalEncoding), input_name='primaryie'), namespace_))
+ if self.secondaryie is not None:
+ showIndent(outfile, level)
+ outfile.write('<%ssecondaryie>%s</%ssecondaryie>\n' % (namespace_, self.format_string(quote_xml(self.secondaryie).encode(ExternalEncoding), input_name='secondaryie'), namespace_))
+ def hasContent_(self):
+ if (
+ self.primaryie is not None or
+ self.secondaryie is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docIndexEntryType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('primaryie=%s,\n' % quote_python(self.primaryie).encode(ExternalEncoding))
+ showIndent(outfile, level)
+ outfile.write('secondaryie=%s,\n' % quote_python(self.secondaryie).encode(ExternalEncoding))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'primaryie':
+ primaryie_ = ''
+ for text__content_ in child_.childNodes:
+ primaryie_ += text__content_.nodeValue
+ self.primaryie = primaryie_
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'secondaryie':
+ secondaryie_ = ''
+ for text__content_ in child_.childNodes:
+ secondaryie_ += text__content_.nodeValue
+ self.secondaryie = secondaryie_
+# end class docIndexEntryType
+
+
+class docListType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, listitem=None):
+ if listitem is None:
+ self.listitem = []
+ else:
+ self.listitem = listitem
+ def factory(*args_, **kwargs_):
+ if docListType.subclass:
+ return docListType.subclass(*args_, **kwargs_)
+ else:
+ return docListType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_listitem(self): return self.listitem
+ def set_listitem(self, listitem): self.listitem = listitem
+ def add_listitem(self, value): self.listitem.append(value)
+ def insert_listitem(self, index, value): self.listitem[index] = value
+ def export(self, outfile, level, namespace_='', name_='docListType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docListType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='docListType'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='docListType'):
+ for listitem_ in self.listitem:
+ listitem_.export(outfile, level, namespace_, name_='listitem')
+ def hasContent_(self):
+ if (
+ self.listitem is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docListType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('listitem=[\n')
+ level += 1
+ for listitem in self.listitem:
+ showIndent(outfile, level)
+ outfile.write('model_.listitem(\n')
+ listitem.exportLiteral(outfile, level, name_='listitem')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'listitem':
+ obj_ = docListItemType.factory()
+ obj_.build(child_)
+ self.listitem.append(obj_)
+# end class docListType
+
+
+class docListItemType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, para=None):
+ if para is None:
+ self.para = []
+ else:
+ self.para = para
+ def factory(*args_, **kwargs_):
+ if docListItemType.subclass:
+ return docListItemType.subclass(*args_, **kwargs_)
+ else:
+ return docListItemType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_para(self): return self.para
+ def set_para(self, para): self.para = para
+ def add_para(self, value): self.para.append(value)
+ def insert_para(self, index, value): self.para[index] = value
+ def export(self, outfile, level, namespace_='', name_='docListItemType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docListItemType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='docListItemType'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='docListItemType'):
+ for para_ in self.para:
+ para_.export(outfile, level, namespace_, name_='para')
+ def hasContent_(self):
+ if (
+ self.para is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docListItemType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('para=[\n')
+ level += 1
+ for para in self.para:
+ showIndent(outfile, level)
+ outfile.write('model_.para(\n')
+ para.exportLiteral(outfile, level, name_='para')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'para':
+ obj_ = docParaType.factory()
+ obj_.build(child_)
+ self.para.append(obj_)
+# end class docListItemType
+
+
+class docSimpleSectType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, kind=None, title=None, para=None):
+ self.kind = kind
+ self.title = title
+ if para is None:
+ self.para = []
+ else:
+ self.para = para
+ def factory(*args_, **kwargs_):
+ if docSimpleSectType.subclass:
+ return docSimpleSectType.subclass(*args_, **kwargs_)
+ else:
+ return docSimpleSectType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_title(self): return self.title
+ def set_title(self, title): self.title = title
+ def get_para(self): return self.para
+ def set_para(self, para): self.para = para
+ def add_para(self, value): self.para.append(value)
+ def insert_para(self, index, value): self.para[index] = value
+ def get_kind(self): return self.kind
+ def set_kind(self, kind): self.kind = kind
+ def export(self, outfile, level, namespace_='', name_='docSimpleSectType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docSimpleSectType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='docSimpleSectType'):
+ if self.kind is not None:
+ outfile.write(' kind=%s' % (quote_attrib(self.kind), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='docSimpleSectType'):
+ if self.title:
+ self.title.export(outfile, level, namespace_, name_='title')
+ for para_ in self.para:
+ para_.export(outfile, level, namespace_, name_='para')
+ def hasContent_(self):
+ if (
+ self.title is not None or
+ self.para is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docSimpleSectType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.kind is not None:
+ showIndent(outfile, level)
+ outfile.write('kind = "%s",\n' % (self.kind,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ if self.title:
+ showIndent(outfile, level)
+ outfile.write('title=model_.docTitleType(\n')
+ self.title.exportLiteral(outfile, level, name_='title')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ showIndent(outfile, level)
+ outfile.write('para=[\n')
+ level += 1
+ for para in self.para:
+ showIndent(outfile, level)
+ outfile.write('model_.para(\n')
+ para.exportLiteral(outfile, level, name_='para')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('kind'):
+ self.kind = attrs.get('kind').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'title':
+ obj_ = docTitleType.factory()
+ obj_.build(child_)
+ self.set_title(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'para':
+ obj_ = docParaType.factory()
+ obj_.build(child_)
+ self.para.append(obj_)
+# end class docSimpleSectType
+
+
+class docVarListEntryType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, term=None):
+ self.term = term
+ def factory(*args_, **kwargs_):
+ if docVarListEntryType.subclass:
+ return docVarListEntryType.subclass(*args_, **kwargs_)
+ else:
+ return docVarListEntryType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_term(self): return self.term
+ def set_term(self, term): self.term = term
+ def export(self, outfile, level, namespace_='', name_='docVarListEntryType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docVarListEntryType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='docVarListEntryType'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='docVarListEntryType'):
+ if self.term:
+ self.term.export(outfile, level, namespace_, name_='term', )
+ def hasContent_(self):
+ if (
+ self.term is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docVarListEntryType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ if self.term:
+ showIndent(outfile, level)
+ outfile.write('term=model_.docTitleType(\n')
+ self.term.exportLiteral(outfile, level, name_='term')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'term':
+ obj_ = docTitleType.factory()
+ obj_.build(child_)
+ self.set_term(obj_)
+# end class docVarListEntryType
+
+
+class docVariableListType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, valueOf_=''):
+ self.valueOf_ = valueOf_
+ def factory(*args_, **kwargs_):
+ if docVariableListType.subclass:
+ return docVariableListType.subclass(*args_, **kwargs_)
+ else:
+ return docVariableListType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='docVariableListType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docVariableListType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='docVariableListType'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='docVariableListType'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docVariableListType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class docVariableListType
+
+
+class docRefTextType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, refid=None, kindref=None, external=None, valueOf_='', mixedclass_=None, content_=None):
+ self.refid = refid
+ self.kindref = kindref
+ self.external = external
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if docRefTextType.subclass:
+ return docRefTextType.subclass(*args_, **kwargs_)
+ else:
+ return docRefTextType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_refid(self): return self.refid
+ def set_refid(self, refid): self.refid = refid
+ def get_kindref(self): return self.kindref
+ def set_kindref(self, kindref): self.kindref = kindref
+ def get_external(self): return self.external
+ def set_external(self, external): self.external = external
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='docRefTextType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docRefTextType')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='docRefTextType'):
+ if self.refid is not None:
+ outfile.write(' refid=%s' % (self.format_string(quote_attrib(self.refid).encode(ExternalEncoding), input_name='refid'), ))
+ if self.kindref is not None:
+ outfile.write(' kindref=%s' % (quote_attrib(self.kindref), ))
+ if self.external is not None:
+ outfile.write(' external=%s' % (self.format_string(quote_attrib(self.external).encode(ExternalEncoding), input_name='external'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='docRefTextType'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docRefTextType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.refid is not None:
+ showIndent(outfile, level)
+ outfile.write('refid = %s,\n' % (self.refid,))
+ if self.kindref is not None:
+ showIndent(outfile, level)
+ outfile.write('kindref = "%s",\n' % (self.kindref,))
+ if self.external is not None:
+ showIndent(outfile, level)
+ outfile.write('external = %s,\n' % (self.external,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('refid'):
+ self.refid = attrs.get('refid').value
+ if attrs.get('kindref'):
+ self.kindref = attrs.get('kindref').value
+ if attrs.get('external'):
+ self.external = attrs.get('external').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class docRefTextType
+
+
+class docTableType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, rows=None, cols=None, row=None, caption=None):
+ self.rows = rows
+ self.cols = cols
+ if row is None:
+ self.row = []
+ else:
+ self.row = row
+ self.caption = caption
+ def factory(*args_, **kwargs_):
+ if docTableType.subclass:
+ return docTableType.subclass(*args_, **kwargs_)
+ else:
+ return docTableType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_row(self): return self.row
+ def set_row(self, row): self.row = row
+ def add_row(self, value): self.row.append(value)
+ def insert_row(self, index, value): self.row[index] = value
+ def get_caption(self): return self.caption
+ def set_caption(self, caption): self.caption = caption
+ def get_rows(self): return self.rows
+ def set_rows(self, rows): self.rows = rows
+ def get_cols(self): return self.cols
+ def set_cols(self, cols): self.cols = cols
+ def export(self, outfile, level, namespace_='', name_='docTableType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docTableType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='docTableType'):
+ if self.rows is not None:
+ outfile.write(' rows="%s"' % self.format_integer(self.rows, input_name='rows'))
+ if self.cols is not None:
+ outfile.write(' cols="%s"' % self.format_integer(self.cols, input_name='cols'))
+ def exportChildren(self, outfile, level, namespace_='', name_='docTableType'):
+ for row_ in self.row:
+ row_.export(outfile, level, namespace_, name_='row')
+ if self.caption:
+ self.caption.export(outfile, level, namespace_, name_='caption')
+ def hasContent_(self):
+ if (
+ self.row is not None or
+ self.caption is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docTableType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.rows is not None:
+ showIndent(outfile, level)
+ outfile.write('rows = %s,\n' % (self.rows,))
+ if self.cols is not None:
+ showIndent(outfile, level)
+ outfile.write('cols = %s,\n' % (self.cols,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('row=[\n')
+ level += 1
+ for row in self.row:
+ showIndent(outfile, level)
+ outfile.write('model_.row(\n')
+ row.exportLiteral(outfile, level, name_='row')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ if self.caption:
+ showIndent(outfile, level)
+ outfile.write('caption=model_.docCaptionType(\n')
+ self.caption.exportLiteral(outfile, level, name_='caption')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('rows'):
+ try:
+ self.rows = int(attrs.get('rows').value)
+ except ValueError, exp:
+ raise ValueError('Bad integer attribute (rows): %s' % exp)
+ if attrs.get('cols'):
+ try:
+ self.cols = int(attrs.get('cols').value)
+ except ValueError, exp:
+ raise ValueError('Bad integer attribute (cols): %s' % exp)
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'row':
+ obj_ = docRowType.factory()
+ obj_.build(child_)
+ self.row.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'caption':
+ obj_ = docCaptionType.factory()
+ obj_.build(child_)
+ self.set_caption(obj_)
+# end class docTableType
+
+
+class docRowType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, entry=None):
+ if entry is None:
+ self.entry = []
+ else:
+ self.entry = entry
+ def factory(*args_, **kwargs_):
+ if docRowType.subclass:
+ return docRowType.subclass(*args_, **kwargs_)
+ else:
+ return docRowType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_entry(self): return self.entry
+ def set_entry(self, entry): self.entry = entry
+ def add_entry(self, value): self.entry.append(value)
+ def insert_entry(self, index, value): self.entry[index] = value
+ def export(self, outfile, level, namespace_='', name_='docRowType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docRowType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='docRowType'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='docRowType'):
+ for entry_ in self.entry:
+ entry_.export(outfile, level, namespace_, name_='entry')
+ def hasContent_(self):
+ if (
+ self.entry is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docRowType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('entry=[\n')
+ level += 1
+ for entry in self.entry:
+ showIndent(outfile, level)
+ outfile.write('model_.entry(\n')
+ entry.exportLiteral(outfile, level, name_='entry')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'entry':
+ obj_ = docEntryType.factory()
+ obj_.build(child_)
+ self.entry.append(obj_)
+# end class docRowType
+
+
+class docEntryType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, thead=None, para=None):
+ self.thead = thead
+ if para is None:
+ self.para = []
+ else:
+ self.para = para
+ def factory(*args_, **kwargs_):
+ if docEntryType.subclass:
+ return docEntryType.subclass(*args_, **kwargs_)
+ else:
+ return docEntryType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_para(self): return self.para
+ def set_para(self, para): self.para = para
+ def add_para(self, value): self.para.append(value)
+ def insert_para(self, index, value): self.para[index] = value
+ def get_thead(self): return self.thead
+ def set_thead(self, thead): self.thead = thead
+ def export(self, outfile, level, namespace_='', name_='docEntryType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docEntryType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='docEntryType'):
+ if self.thead is not None:
+ outfile.write(' thead=%s' % (quote_attrib(self.thead), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='docEntryType'):
+ for para_ in self.para:
+ para_.export(outfile, level, namespace_, name_='para')
+ def hasContent_(self):
+ if (
+ self.para is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docEntryType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.thead is not None:
+ showIndent(outfile, level)
+ outfile.write('thead = "%s",\n' % (self.thead,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('para=[\n')
+ level += 1
+ for para in self.para:
+ showIndent(outfile, level)
+ outfile.write('model_.para(\n')
+ para.exportLiteral(outfile, level, name_='para')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('thead'):
+ self.thead = attrs.get('thead').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'para':
+ obj_ = docParaType.factory()
+ obj_.build(child_)
+ self.para.append(obj_)
+# end class docEntryType
+
+
+class docCaptionType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, valueOf_='', mixedclass_=None, content_=None):
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if docCaptionType.subclass:
+ return docCaptionType.subclass(*args_, **kwargs_)
+ else:
+ return docCaptionType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='docCaptionType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docCaptionType')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='docCaptionType'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='docCaptionType'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docCaptionType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class docCaptionType
+
+
+class docHeadingType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, level=None, valueOf_='', mixedclass_=None, content_=None):
+ self.level = level
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if docHeadingType.subclass:
+ return docHeadingType.subclass(*args_, **kwargs_)
+ else:
+ return docHeadingType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_level(self): return self.level
+ def set_level(self, level): self.level = level
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='docHeadingType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docHeadingType')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='docHeadingType'):
+ if self.level is not None:
+ outfile.write(' level="%s"' % self.format_integer(self.level, input_name='level'))
+ def exportChildren(self, outfile, level, namespace_='', name_='docHeadingType'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docHeadingType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.level is not None:
+ showIndent(outfile, level)
+ outfile.write('level = %s,\n' % (self.level,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('level'):
+ try:
+ self.level = int(attrs.get('level').value)
+ except ValueError, exp:
+ raise ValueError('Bad integer attribute (level): %s' % exp)
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class docHeadingType
+
+
+class docImageType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, width=None, type_=None, name=None, height=None, valueOf_='', mixedclass_=None, content_=None):
+ self.width = width
+ self.type_ = type_
+ self.name = name
+ self.height = height
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if docImageType.subclass:
+ return docImageType.subclass(*args_, **kwargs_)
+ else:
+ return docImageType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_width(self): return self.width
+ def set_width(self, width): self.width = width
+ def get_type(self): return self.type_
+ def set_type(self, type_): self.type_ = type_
+ def get_name(self): return self.name
+ def set_name(self, name): self.name = name
+ def get_height(self): return self.height
+ def set_height(self, height): self.height = height
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='docImageType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docImageType')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='docImageType'):
+ if self.width is not None:
+ outfile.write(' width=%s' % (self.format_string(quote_attrib(self.width).encode(ExternalEncoding), input_name='width'), ))
+ if self.type_ is not None:
+ outfile.write(' type=%s' % (quote_attrib(self.type_), ))
+ if self.name is not None:
+ outfile.write(' name=%s' % (self.format_string(quote_attrib(self.name).encode(ExternalEncoding), input_name='name'), ))
+ if self.height is not None:
+ outfile.write(' height=%s' % (self.format_string(quote_attrib(self.height).encode(ExternalEncoding), input_name='height'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='docImageType'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docImageType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.width is not None:
+ showIndent(outfile, level)
+ outfile.write('width = %s,\n' % (self.width,))
+ if self.type_ is not None:
+ showIndent(outfile, level)
+ outfile.write('type_ = "%s",\n' % (self.type_,))
+ if self.name is not None:
+ showIndent(outfile, level)
+ outfile.write('name = %s,\n' % (self.name,))
+ if self.height is not None:
+ showIndent(outfile, level)
+ outfile.write('height = %s,\n' % (self.height,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('width'):
+ self.width = attrs.get('width').value
+ if attrs.get('type'):
+ self.type_ = attrs.get('type').value
+ if attrs.get('name'):
+ self.name = attrs.get('name').value
+ if attrs.get('height'):
+ self.height = attrs.get('height').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class docImageType
+
+
+class docDotFileType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, name=None, valueOf_='', mixedclass_=None, content_=None):
+ self.name = name
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if docDotFileType.subclass:
+ return docDotFileType.subclass(*args_, **kwargs_)
+ else:
+ return docDotFileType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_name(self): return self.name
+ def set_name(self, name): self.name = name
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='docDotFileType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docDotFileType')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='docDotFileType'):
+ if self.name is not None:
+ outfile.write(' name=%s' % (self.format_string(quote_attrib(self.name).encode(ExternalEncoding), input_name='name'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='docDotFileType'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docDotFileType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.name is not None:
+ showIndent(outfile, level)
+ outfile.write('name = %s,\n' % (self.name,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('name'):
+ self.name = attrs.get('name').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class docDotFileType
+
+
+class docTocItemType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, id=None, valueOf_='', mixedclass_=None, content_=None):
+ self.id = id
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if docTocItemType.subclass:
+ return docTocItemType.subclass(*args_, **kwargs_)
+ else:
+ return docTocItemType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_id(self): return self.id
+ def set_id(self, id): self.id = id
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='docTocItemType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docTocItemType')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='docTocItemType'):
+ if self.id is not None:
+ outfile.write(' id=%s' % (self.format_string(quote_attrib(self.id).encode(ExternalEncoding), input_name='id'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='docTocItemType'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docTocItemType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.id is not None:
+ showIndent(outfile, level)
+ outfile.write('id = %s,\n' % (self.id,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('id'):
+ self.id = attrs.get('id').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class docTocItemType
+
+
+class docTocListType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, tocitem=None):
+ if tocitem is None:
+ self.tocitem = []
+ else:
+ self.tocitem = tocitem
+ def factory(*args_, **kwargs_):
+ if docTocListType.subclass:
+ return docTocListType.subclass(*args_, **kwargs_)
+ else:
+ return docTocListType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_tocitem(self): return self.tocitem
+ def set_tocitem(self, tocitem): self.tocitem = tocitem
+ def add_tocitem(self, value): self.tocitem.append(value)
+ def insert_tocitem(self, index, value): self.tocitem[index] = value
+ def export(self, outfile, level, namespace_='', name_='docTocListType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docTocListType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='docTocListType'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='docTocListType'):
+ for tocitem_ in self.tocitem:
+ tocitem_.export(outfile, level, namespace_, name_='tocitem')
+ def hasContent_(self):
+ if (
+ self.tocitem is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docTocListType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('tocitem=[\n')
+ level += 1
+ for tocitem in self.tocitem:
+ showIndent(outfile, level)
+ outfile.write('model_.tocitem(\n')
+ tocitem.exportLiteral(outfile, level, name_='tocitem')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'tocitem':
+ obj_ = docTocItemType.factory()
+ obj_.build(child_)
+ self.tocitem.append(obj_)
+# end class docTocListType
+
+
+class docLanguageType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, langid=None, para=None):
+ self.langid = langid
+ if para is None:
+ self.para = []
+ else:
+ self.para = para
+ def factory(*args_, **kwargs_):
+ if docLanguageType.subclass:
+ return docLanguageType.subclass(*args_, **kwargs_)
+ else:
+ return docLanguageType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_para(self): return self.para
+ def set_para(self, para): self.para = para
+ def add_para(self, value): self.para.append(value)
+ def insert_para(self, index, value): self.para[index] = value
+ def get_langid(self): return self.langid
+ def set_langid(self, langid): self.langid = langid
+ def export(self, outfile, level, namespace_='', name_='docLanguageType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docLanguageType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='docLanguageType'):
+ if self.langid is not None:
+ outfile.write(' langid=%s' % (self.format_string(quote_attrib(self.langid).encode(ExternalEncoding), input_name='langid'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='docLanguageType'):
+ for para_ in self.para:
+ para_.export(outfile, level, namespace_, name_='para')
+ def hasContent_(self):
+ if (
+ self.para is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docLanguageType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.langid is not None:
+ showIndent(outfile, level)
+ outfile.write('langid = %s,\n' % (self.langid,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('para=[\n')
+ level += 1
+ for para in self.para:
+ showIndent(outfile, level)
+ outfile.write('model_.para(\n')
+ para.exportLiteral(outfile, level, name_='para')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('langid'):
+ self.langid = attrs.get('langid').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'para':
+ obj_ = docParaType.factory()
+ obj_.build(child_)
+ self.para.append(obj_)
+# end class docLanguageType
+
+
+class docParamListType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, kind=None, parameteritem=None):
+ self.kind = kind
+ if parameteritem is None:
+ self.parameteritem = []
+ else:
+ self.parameteritem = parameteritem
+ def factory(*args_, **kwargs_):
+ if docParamListType.subclass:
+ return docParamListType.subclass(*args_, **kwargs_)
+ else:
+ return docParamListType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_parameteritem(self): return self.parameteritem
+ def set_parameteritem(self, parameteritem): self.parameteritem = parameteritem
+ def add_parameteritem(self, value): self.parameteritem.append(value)
+ def insert_parameteritem(self, index, value): self.parameteritem[index] = value
+ def get_kind(self): return self.kind
+ def set_kind(self, kind): self.kind = kind
+ def export(self, outfile, level, namespace_='', name_='docParamListType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docParamListType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='docParamListType'):
+ if self.kind is not None:
+ outfile.write(' kind=%s' % (quote_attrib(self.kind), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='docParamListType'):
+ for parameteritem_ in self.parameteritem:
+ parameteritem_.export(outfile, level, namespace_, name_='parameteritem')
+ def hasContent_(self):
+ if (
+ self.parameteritem is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docParamListType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.kind is not None:
+ showIndent(outfile, level)
+ outfile.write('kind = "%s",\n' % (self.kind,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('parameteritem=[\n')
+ level += 1
+ for parameteritem in self.parameteritem:
+ showIndent(outfile, level)
+ outfile.write('model_.parameteritem(\n')
+ parameteritem.exportLiteral(outfile, level, name_='parameteritem')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('kind'):
+ self.kind = attrs.get('kind').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'parameteritem':
+ obj_ = docParamListItem.factory()
+ obj_.build(child_)
+ self.parameteritem.append(obj_)
+# end class docParamListType
+
+
+class docParamListItem(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, parameternamelist=None, parameterdescription=None):
+ if parameternamelist is None:
+ self.parameternamelist = []
+ else:
+ self.parameternamelist = parameternamelist
+ self.parameterdescription = parameterdescription
+ def factory(*args_, **kwargs_):
+ if docParamListItem.subclass:
+ return docParamListItem.subclass(*args_, **kwargs_)
+ else:
+ return docParamListItem(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_parameternamelist(self): return self.parameternamelist
+ def set_parameternamelist(self, parameternamelist): self.parameternamelist = parameternamelist
+ def add_parameternamelist(self, value): self.parameternamelist.append(value)
+ def insert_parameternamelist(self, index, value): self.parameternamelist[index] = value
+ def get_parameterdescription(self): return self.parameterdescription
+ def set_parameterdescription(self, parameterdescription): self.parameterdescription = parameterdescription
+ def export(self, outfile, level, namespace_='', name_='docParamListItem', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docParamListItem')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='docParamListItem'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='docParamListItem'):
+ for parameternamelist_ in self.parameternamelist:
+ parameternamelist_.export(outfile, level, namespace_, name_='parameternamelist')
+ if self.parameterdescription:
+ self.parameterdescription.export(outfile, level, namespace_, name_='parameterdescription', )
+ def hasContent_(self):
+ if (
+ self.parameternamelist is not None or
+ self.parameterdescription is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docParamListItem'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('parameternamelist=[\n')
+ level += 1
+ for parameternamelist in self.parameternamelist:
+ showIndent(outfile, level)
+ outfile.write('model_.parameternamelist(\n')
+ parameternamelist.exportLiteral(outfile, level, name_='parameternamelist')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ if self.parameterdescription:
+ showIndent(outfile, level)
+ outfile.write('parameterdescription=model_.descriptionType(\n')
+ self.parameterdescription.exportLiteral(outfile, level, name_='parameterdescription')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'parameternamelist':
+ obj_ = docParamNameList.factory()
+ obj_.build(child_)
+ self.parameternamelist.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'parameterdescription':
+ obj_ = descriptionType.factory()
+ obj_.build(child_)
+ self.set_parameterdescription(obj_)
+# end class docParamListItem
+
+
+class docParamNameList(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, parametername=None):
+ if parametername is None:
+ self.parametername = []
+ else:
+ self.parametername = parametername
+ def factory(*args_, **kwargs_):
+ if docParamNameList.subclass:
+ return docParamNameList.subclass(*args_, **kwargs_)
+ else:
+ return docParamNameList(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_parametername(self): return self.parametername
+ def set_parametername(self, parametername): self.parametername = parametername
+ def add_parametername(self, value): self.parametername.append(value)
+ def insert_parametername(self, index, value): self.parametername[index] = value
+ def export(self, outfile, level, namespace_='', name_='docParamNameList', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docParamNameList')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='docParamNameList'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='docParamNameList'):
+ for parametername_ in self.parametername:
+ parametername_.export(outfile, level, namespace_, name_='parametername')
+ def hasContent_(self):
+ if (
+ self.parametername is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docParamNameList'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('parametername=[\n')
+ level += 1
+ for parametername in self.parametername:
+ showIndent(outfile, level)
+ outfile.write('model_.parametername(\n')
+ parametername.exportLiteral(outfile, level, name_='parametername')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'parametername':
+ obj_ = docParamName.factory()
+ obj_.build(child_)
+ self.parametername.append(obj_)
+# end class docParamNameList
+
+
+class docParamName(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, direction=None, ref=None, mixedclass_=None, content_=None):
+ self.direction = direction
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if docParamName.subclass:
+ return docParamName.subclass(*args_, **kwargs_)
+ else:
+ return docParamName(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_ref(self): return self.ref
+ def set_ref(self, ref): self.ref = ref
+ def get_direction(self): return self.direction
+ def set_direction(self, direction): self.direction = direction
+ def export(self, outfile, level, namespace_='', name_='docParamName', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docParamName')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='docParamName'):
+ if self.direction is not None:
+ outfile.write(' direction=%s' % (quote_attrib(self.direction), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='docParamName'):
+ for item_ in self.content_:
+ item_.export(outfile, level, item_.name, namespace_)
+ def hasContent_(self):
+ if (
+ self.ref is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docParamName'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.direction is not None:
+ showIndent(outfile, level)
+ outfile.write('direction = "%s",\n' % (self.direction,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('direction'):
+ self.direction = attrs.get('direction').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'ref':
+ childobj_ = docRefTextType.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'ref', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+# end class docParamName
+
+
+class docXRefSectType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, id=None, xreftitle=None, xrefdescription=None):
+ self.id = id
+ if xreftitle is None:
+ self.xreftitle = []
+ else:
+ self.xreftitle = xreftitle
+ self.xrefdescription = xrefdescription
+ def factory(*args_, **kwargs_):
+ if docXRefSectType.subclass:
+ return docXRefSectType.subclass(*args_, **kwargs_)
+ else:
+ return docXRefSectType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_xreftitle(self): return self.xreftitle
+ def set_xreftitle(self, xreftitle): self.xreftitle = xreftitle
+ def add_xreftitle(self, value): self.xreftitle.append(value)
+ def insert_xreftitle(self, index, value): self.xreftitle[index] = value
+ def get_xrefdescription(self): return self.xrefdescription
+ def set_xrefdescription(self, xrefdescription): self.xrefdescription = xrefdescription
+ def get_id(self): return self.id
+ def set_id(self, id): self.id = id
+ def export(self, outfile, level, namespace_='', name_='docXRefSectType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docXRefSectType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='docXRefSectType'):
+ if self.id is not None:
+ outfile.write(' id=%s' % (self.format_string(quote_attrib(self.id).encode(ExternalEncoding), input_name='id'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='docXRefSectType'):
+ for xreftitle_ in self.xreftitle:
+ showIndent(outfile, level)
+ outfile.write('<%sxreftitle>%s</%sxreftitle>\n' % (namespace_, self.format_string(quote_xml(xreftitle_).encode(ExternalEncoding), input_name='xreftitle'), namespace_))
+ if self.xrefdescription:
+ self.xrefdescription.export(outfile, level, namespace_, name_='xrefdescription', )
+ def hasContent_(self):
+ if (
+ self.xreftitle is not None or
+ self.xrefdescription is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docXRefSectType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.id is not None:
+ showIndent(outfile, level)
+ outfile.write('id = %s,\n' % (self.id,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('xreftitle=[\n')
+ level += 1
+ for xreftitle in self.xreftitle:
+ showIndent(outfile, level)
+ outfile.write('%s,\n' % quote_python(xreftitle).encode(ExternalEncoding))
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ if self.xrefdescription:
+ showIndent(outfile, level)
+ outfile.write('xrefdescription=model_.descriptionType(\n')
+ self.xrefdescription.exportLiteral(outfile, level, name_='xrefdescription')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('id'):
+ self.id = attrs.get('id').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'xreftitle':
+ xreftitle_ = ''
+ for text__content_ in child_.childNodes:
+ xreftitle_ += text__content_.nodeValue
+ self.xreftitle.append(xreftitle_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'xrefdescription':
+ obj_ = descriptionType.factory()
+ obj_.build(child_)
+ self.set_xrefdescription(obj_)
+# end class docXRefSectType
+
+
+class docCopyType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, link=None, para=None, sect1=None, internal=None):
+ self.link = link
+ if para is None:
+ self.para = []
+ else:
+ self.para = para
+ if sect1 is None:
+ self.sect1 = []
+ else:
+ self.sect1 = sect1
+ self.internal = internal
+ def factory(*args_, **kwargs_):
+ if docCopyType.subclass:
+ return docCopyType.subclass(*args_, **kwargs_)
+ else:
+ return docCopyType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_para(self): return self.para
+ def set_para(self, para): self.para = para
+ def add_para(self, value): self.para.append(value)
+ def insert_para(self, index, value): self.para[index] = value
+ def get_sect1(self): return self.sect1
+ def set_sect1(self, sect1): self.sect1 = sect1
+ def add_sect1(self, value): self.sect1.append(value)
+ def insert_sect1(self, index, value): self.sect1[index] = value
+ def get_internal(self): return self.internal
+ def set_internal(self, internal): self.internal = internal
+ def get_link(self): return self.link
+ def set_link(self, link): self.link = link
+ def export(self, outfile, level, namespace_='', name_='docCopyType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docCopyType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='docCopyType'):
+ if self.link is not None:
+ outfile.write(' link=%s' % (self.format_string(quote_attrib(self.link).encode(ExternalEncoding), input_name='link'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='docCopyType'):
+ for para_ in self.para:
+ para_.export(outfile, level, namespace_, name_='para')
+ for sect1_ in self.sect1:
+ sect1_.export(outfile, level, namespace_, name_='sect1')
+ if self.internal:
+ self.internal.export(outfile, level, namespace_, name_='internal')
+ def hasContent_(self):
+ if (
+ self.para is not None or
+ self.sect1 is not None or
+ self.internal is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docCopyType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.link is not None:
+ showIndent(outfile, level)
+ outfile.write('link = %s,\n' % (self.link,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('para=[\n')
+ level += 1
+ for para in self.para:
+ showIndent(outfile, level)
+ outfile.write('model_.para(\n')
+ para.exportLiteral(outfile, level, name_='para')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('sect1=[\n')
+ level += 1
+ for sect1 in self.sect1:
+ showIndent(outfile, level)
+ outfile.write('model_.sect1(\n')
+ sect1.exportLiteral(outfile, level, name_='sect1')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ if self.internal:
+ showIndent(outfile, level)
+ outfile.write('internal=model_.docInternalType(\n')
+ self.internal.exportLiteral(outfile, level, name_='internal')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('link'):
+ self.link = attrs.get('link').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'para':
+ obj_ = docParaType.factory()
+ obj_.build(child_)
+ self.para.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'sect1':
+ obj_ = docSect1Type.factory()
+ obj_.build(child_)
+ self.sect1.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'internal':
+ obj_ = docInternalType.factory()
+ obj_.build(child_)
+ self.set_internal(obj_)
+# end class docCopyType
+
+
+class docCharType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, char=None, valueOf_=''):
+ self.char = char
+ self.valueOf_ = valueOf_
+ def factory(*args_, **kwargs_):
+ if docCharType.subclass:
+ return docCharType.subclass(*args_, **kwargs_)
+ else:
+ return docCharType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_char(self): return self.char
+ def set_char(self, char): self.char = char
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='docCharType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docCharType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='docCharType'):
+ if self.char is not None:
+ outfile.write(' char=%s' % (quote_attrib(self.char), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='docCharType'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docCharType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.char is not None:
+ showIndent(outfile, level)
+ outfile.write('char = "%s",\n' % (self.char,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('char'):
+ self.char = attrs.get('char').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class docCharType
+
+
+class docEmptyType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, valueOf_=''):
+ self.valueOf_ = valueOf_
+ def factory(*args_, **kwargs_):
+ if docEmptyType.subclass:
+ return docEmptyType.subclass(*args_, **kwargs_)
+ else:
+ return docEmptyType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='docEmptyType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docEmptyType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='docEmptyType'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='docEmptyType'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docEmptyType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class docEmptyType
+
+
+USAGE_TEXT = """
+Usage: python <Parser>.py [ -s ] <in_xml_file>
+Options:
+ -s Use the SAX parser, not the minidom parser.
+"""
+
+def usage():
+ print USAGE_TEXT
+ sys.exit(1)
+
+
+def parse(inFileName):
+ doc = minidom.parse(inFileName)
+ rootNode = doc.documentElement
+ rootObj = DoxygenType.factory()
+ rootObj.build(rootNode)
+ # Enable Python to collect the space used by the DOM.
+ doc = None
+ sys.stdout.write('<?xml version="1.0" ?>\n')
+ rootObj.export(sys.stdout, 0, name_="doxygen",
+ namespacedef_='')
+ return rootObj
+
+
+def parseString(inString):
+ doc = minidom.parseString(inString)
+ rootNode = doc.documentElement
+ rootObj = DoxygenType.factory()
+ rootObj.build(rootNode)
+ # Enable Python to collect the space used by the DOM.
+ doc = None
+ sys.stdout.write('<?xml version="1.0" ?>\n')
+ rootObj.export(sys.stdout, 0, name_="doxygen",
+ namespacedef_='')
+ return rootObj
+
+
+def parseLiteral(inFileName):
+ doc = minidom.parse(inFileName)
+ rootNode = doc.documentElement
+ rootObj = DoxygenType.factory()
+ rootObj.build(rootNode)
+ # Enable Python to collect the space used by the DOM.
+ doc = None
+ sys.stdout.write('from compound import *\n\n')
+ sys.stdout.write('rootObj = doxygen(\n')
+ rootObj.exportLiteral(sys.stdout, 0, name_="doxygen")
+ sys.stdout.write(')\n')
+ return rootObj
+
+
+def main():
+ args = sys.argv[1:]
+ if len(args) == 1:
+ parse(args[0])
+ else:
+ usage()
+
+
+if __name__ == '__main__':
+ main()
+ #import pdb
+ #pdb.run('main()')
+
diff --git a/docs/doxygen/doxyxml/generated/index.py b/docs/doxygen/doxyxml/generated/index.py
new file mode 100644
index 000000000..7a70e14a1
--- /dev/null
+++ b/docs/doxygen/doxyxml/generated/index.py
@@ -0,0 +1,77 @@
+#!/usr/bin/env python
+
+"""
+Generated Mon Feb 9 19:08:05 2009 by generateDS.py.
+"""
+
+from xml.dom import minidom
+
+import os
+import sys
+import compound
+
+import indexsuper as supermod
+
+class DoxygenTypeSub(supermod.DoxygenType):
+ def __init__(self, version=None, compound=None):
+ supermod.DoxygenType.__init__(self, version, compound)
+
+ def find_compounds_and_members(self, details):
+ """
+ Returns a list of all compounds and their members which match details
+ """
+
+ results = []
+ for compound in self.compound:
+ members = compound.find_members(details)
+ if members:
+ results.append([compound, members])
+ else:
+ if details.match(compound):
+ results.append([compound, []])
+
+ return results
+
+supermod.DoxygenType.subclass = DoxygenTypeSub
+# end class DoxygenTypeSub
+
+
+class CompoundTypeSub(supermod.CompoundType):
+ def __init__(self, kind=None, refid=None, name='', member=None):
+ supermod.CompoundType.__init__(self, kind, refid, name, member)
+
+ def find_members(self, details):
+ """
+ Returns a list of all members which match details
+ """
+
+ results = []
+
+ for member in self.member:
+ if details.match(member):
+ results.append(member)
+
+ return results
+
+supermod.CompoundType.subclass = CompoundTypeSub
+# end class CompoundTypeSub
+
+
+class MemberTypeSub(supermod.MemberType):
+
+ def __init__(self, kind=None, refid=None, name=''):
+ supermod.MemberType.__init__(self, kind, refid, name)
+
+supermod.MemberType.subclass = MemberTypeSub
+# end class MemberTypeSub
+
+
+def parse(inFilename):
+
+ doc = minidom.parse(inFilename)
+ rootNode = doc.documentElement
+ rootObj = supermod.DoxygenType.factory()
+ rootObj.build(rootNode)
+
+ return rootObj
+
diff --git a/docs/doxygen/doxyxml/generated/indexsuper.py b/docs/doxygen/doxyxml/generated/indexsuper.py
new file mode 100644
index 000000000..a99153019
--- /dev/null
+++ b/docs/doxygen/doxyxml/generated/indexsuper.py
@@ -0,0 +1,523 @@
+#!/usr/bin/env python
+
+#
+# Generated Thu Jun 11 18:43:54 2009 by generateDS.py.
+#
+
+import sys
+import getopt
+from string import lower as str_lower
+from xml.dom import minidom
+from xml.dom import Node
+
+#
+# User methods
+#
+# Calls to the methods in these classes are generated by generateDS.py.
+# You can replace these methods by re-implementing the following class
+# in a module named generatedssuper.py.
+
+try:
+ from generatedssuper import GeneratedsSuper
+except ImportError, exp:
+
+ class GeneratedsSuper:
+ def format_string(self, input_data, input_name=''):
+ return input_data
+ def format_integer(self, input_data, input_name=''):
+ return '%d' % input_data
+ def format_float(self, input_data, input_name=''):
+ return '%f' % input_data
+ def format_double(self, input_data, input_name=''):
+ return '%e' % input_data
+ def format_boolean(self, input_data, input_name=''):
+ return '%s' % input_data
+
+
+#
+# If you have installed IPython you can uncomment and use the following.
+# IPython is available from http://ipython.scipy.org/.
+#
+
+## from IPython.Shell import IPShellEmbed
+## args = ''
+## ipshell = IPShellEmbed(args,
+## banner = 'Dropping into IPython',
+## exit_msg = 'Leaving Interpreter, back to program.')
+
+# Then use the following line where and when you want to drop into the
+# IPython shell:
+# ipshell('<some message> -- Entering ipshell.\nHit Ctrl-D to exit')
+
+#
+# Globals
+#
+
+ExternalEncoding = 'ascii'
+
+#
+# Support/utility functions.
+#
+
+def showIndent(outfile, level):
+ for idx in range(level):
+ outfile.write(' ')
+
+def quote_xml(inStr):
+ s1 = (isinstance(inStr, basestring) and inStr or
+ '%s' % inStr)
+ s1 = s1.replace('&', '&amp;')
+ s1 = s1.replace('<', '&lt;')
+ s1 = s1.replace('>', '&gt;')
+ return s1
+
+def quote_attrib(inStr):
+ s1 = (isinstance(inStr, basestring) and inStr or
+ '%s' % inStr)
+ s1 = s1.replace('&', '&amp;')
+ s1 = s1.replace('<', '&lt;')
+ s1 = s1.replace('>', '&gt;')
+ if '"' in s1:
+ if "'" in s1:
+ s1 = '"%s"' % s1.replace('"', "&quot;")
+ else:
+ s1 = "'%s'" % s1
+ else:
+ s1 = '"%s"' % s1
+ return s1
+
+def quote_python(inStr):
+ s1 = inStr
+ if s1.find("'") == -1:
+ if s1.find('\n') == -1:
+ return "'%s'" % s1
+ else:
+ return "'''%s'''" % s1
+ else:
+ if s1.find('"') != -1:
+ s1 = s1.replace('"', '\\"')
+ if s1.find('\n') == -1:
+ return '"%s"' % s1
+ else:
+ return '"""%s"""' % s1
+
+
+class MixedContainer:
+ # Constants for category:
+ CategoryNone = 0
+ CategoryText = 1
+ CategorySimple = 2
+ CategoryComplex = 3
+ # Constants for content_type:
+ TypeNone = 0
+ TypeText = 1
+ TypeString = 2
+ TypeInteger = 3
+ TypeFloat = 4
+ TypeDecimal = 5
+ TypeDouble = 6
+ TypeBoolean = 7
+ def __init__(self, category, content_type, name, value):
+ self.category = category
+ self.content_type = content_type
+ self.name = name
+ self.value = value
+ def getCategory(self):
+ return self.category
+ def getContenttype(self, content_type):
+ return self.content_type
+ def getValue(self):
+ return self.value
+ def getName(self):
+ return self.name
+ def export(self, outfile, level, name, namespace):
+ if self.category == MixedContainer.CategoryText:
+ outfile.write(self.value)
+ elif self.category == MixedContainer.CategorySimple:
+ self.exportSimple(outfile, level, name)
+ else: # category == MixedContainer.CategoryComplex
+ self.value.export(outfile, level, namespace,name)
+ def exportSimple(self, outfile, level, name):
+ if self.content_type == MixedContainer.TypeString:
+ outfile.write('<%s>%s</%s>' % (self.name, self.value, self.name))
+ elif self.content_type == MixedContainer.TypeInteger or \
+ self.content_type == MixedContainer.TypeBoolean:
+ outfile.write('<%s>%d</%s>' % (self.name, self.value, self.name))
+ elif self.content_type == MixedContainer.TypeFloat or \
+ self.content_type == MixedContainer.TypeDecimal:
+ outfile.write('<%s>%f</%s>' % (self.name, self.value, self.name))
+ elif self.content_type == MixedContainer.TypeDouble:
+ outfile.write('<%s>%g</%s>' % (self.name, self.value, self.name))
+ def exportLiteral(self, outfile, level, name):
+ if self.category == MixedContainer.CategoryText:
+ showIndent(outfile, level)
+ outfile.write('MixedContainer(%d, %d, "%s", "%s"),\n' % \
+ (self.category, self.content_type, self.name, self.value))
+ elif self.category == MixedContainer.CategorySimple:
+ showIndent(outfile, level)
+ outfile.write('MixedContainer(%d, %d, "%s", "%s"),\n' % \
+ (self.category, self.content_type, self.name, self.value))
+ else: # category == MixedContainer.CategoryComplex
+ showIndent(outfile, level)
+ outfile.write('MixedContainer(%d, %d, "%s",\n' % \
+ (self.category, self.content_type, self.name,))
+ self.value.exportLiteral(outfile, level + 1)
+ showIndent(outfile, level)
+ outfile.write(')\n')
+
+
+class _MemberSpec(object):
+ def __init__(self, name='', data_type='', container=0):
+ self.name = name
+ self.data_type = data_type
+ self.container = container
+ def set_name(self, name): self.name = name
+ def get_name(self): return self.name
+ def set_data_type(self, data_type): self.data_type = data_type
+ def get_data_type(self): return self.data_type
+ def set_container(self, container): self.container = container
+ def get_container(self): return self.container
+
+
+#
+# Data representation classes.
+#
+
+class DoxygenType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, version=None, compound=None):
+ self.version = version
+ if compound is None:
+ self.compound = []
+ else:
+ self.compound = compound
+ def factory(*args_, **kwargs_):
+ if DoxygenType.subclass:
+ return DoxygenType.subclass(*args_, **kwargs_)
+ else:
+ return DoxygenType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_compound(self): return self.compound
+ def set_compound(self, compound): self.compound = compound
+ def add_compound(self, value): self.compound.append(value)
+ def insert_compound(self, index, value): self.compound[index] = value
+ def get_version(self): return self.version
+ def set_version(self, version): self.version = version
+ def export(self, outfile, level, namespace_='', name_='DoxygenType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='DoxygenType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='DoxygenType'):
+ outfile.write(' version=%s' % (self.format_string(quote_attrib(self.version).encode(ExternalEncoding), input_name='version'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='DoxygenType'):
+ for compound_ in self.compound:
+ compound_.export(outfile, level, namespace_, name_='compound')
+ def hasContent_(self):
+ if (
+ self.compound is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='DoxygenType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.version is not None:
+ showIndent(outfile, level)
+ outfile.write('version = %s,\n' % (self.version,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('compound=[\n')
+ level += 1
+ for compound in self.compound:
+ showIndent(outfile, level)
+ outfile.write('model_.compound(\n')
+ compound.exportLiteral(outfile, level, name_='compound')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('version'):
+ self.version = attrs.get('version').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'compound':
+ obj_ = CompoundType.factory()
+ obj_.build(child_)
+ self.compound.append(obj_)
+# end class DoxygenType
+
+
+class CompoundType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, kind=None, refid=None, name=None, member=None):
+ self.kind = kind
+ self.refid = refid
+ self.name = name
+ if member is None:
+ self.member = []
+ else:
+ self.member = member
+ def factory(*args_, **kwargs_):
+ if CompoundType.subclass:
+ return CompoundType.subclass(*args_, **kwargs_)
+ else:
+ return CompoundType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_name(self): return self.name
+ def set_name(self, name): self.name = name
+ def get_member(self): return self.member
+ def set_member(self, member): self.member = member
+ def add_member(self, value): self.member.append(value)
+ def insert_member(self, index, value): self.member[index] = value
+ def get_kind(self): return self.kind
+ def set_kind(self, kind): self.kind = kind
+ def get_refid(self): return self.refid
+ def set_refid(self, refid): self.refid = refid
+ def export(self, outfile, level, namespace_='', name_='CompoundType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='CompoundType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='CompoundType'):
+ outfile.write(' kind=%s' % (quote_attrib(self.kind), ))
+ outfile.write(' refid=%s' % (self.format_string(quote_attrib(self.refid).encode(ExternalEncoding), input_name='refid'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='CompoundType'):
+ if self.name is not None:
+ showIndent(outfile, level)
+ outfile.write('<%sname>%s</%sname>\n' % (namespace_, self.format_string(quote_xml(self.name).encode(ExternalEncoding), input_name='name'), namespace_))
+ for member_ in self.member:
+ member_.export(outfile, level, namespace_, name_='member')
+ def hasContent_(self):
+ if (
+ self.name is not None or
+ self.member is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='CompoundType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.kind is not None:
+ showIndent(outfile, level)
+ outfile.write('kind = "%s",\n' % (self.kind,))
+ if self.refid is not None:
+ showIndent(outfile, level)
+ outfile.write('refid = %s,\n' % (self.refid,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('name=%s,\n' % quote_python(self.name).encode(ExternalEncoding))
+ showIndent(outfile, level)
+ outfile.write('member=[\n')
+ level += 1
+ for member in self.member:
+ showIndent(outfile, level)
+ outfile.write('model_.member(\n')
+ member.exportLiteral(outfile, level, name_='member')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('kind'):
+ self.kind = attrs.get('kind').value
+ if attrs.get('refid'):
+ self.refid = attrs.get('refid').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'name':
+ name_ = ''
+ for text__content_ in child_.childNodes:
+ name_ += text__content_.nodeValue
+ self.name = name_
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'member':
+ obj_ = MemberType.factory()
+ obj_.build(child_)
+ self.member.append(obj_)
+# end class CompoundType
+
+
+class MemberType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, kind=None, refid=None, name=None):
+ self.kind = kind
+ self.refid = refid
+ self.name = name
+ def factory(*args_, **kwargs_):
+ if MemberType.subclass:
+ return MemberType.subclass(*args_, **kwargs_)
+ else:
+ return MemberType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_name(self): return self.name
+ def set_name(self, name): self.name = name
+ def get_kind(self): return self.kind
+ def set_kind(self, kind): self.kind = kind
+ def get_refid(self): return self.refid
+ def set_refid(self, refid): self.refid = refid
+ def export(self, outfile, level, namespace_='', name_='MemberType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='MemberType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='MemberType'):
+ outfile.write(' kind=%s' % (quote_attrib(self.kind), ))
+ outfile.write(' refid=%s' % (self.format_string(quote_attrib(self.refid).encode(ExternalEncoding), input_name='refid'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='MemberType'):
+ if self.name is not None:
+ showIndent(outfile, level)
+ outfile.write('<%sname>%s</%sname>\n' % (namespace_, self.format_string(quote_xml(self.name).encode(ExternalEncoding), input_name='name'), namespace_))
+ def hasContent_(self):
+ if (
+ self.name is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='MemberType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.kind is not None:
+ showIndent(outfile, level)
+ outfile.write('kind = "%s",\n' % (self.kind,))
+ if self.refid is not None:
+ showIndent(outfile, level)
+ outfile.write('refid = %s,\n' % (self.refid,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('name=%s,\n' % quote_python(self.name).encode(ExternalEncoding))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('kind'):
+ self.kind = attrs.get('kind').value
+ if attrs.get('refid'):
+ self.refid = attrs.get('refid').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'name':
+ name_ = ''
+ for text__content_ in child_.childNodes:
+ name_ += text__content_.nodeValue
+ self.name = name_
+# end class MemberType
+
+
+USAGE_TEXT = """
+Usage: python <Parser>.py [ -s ] <in_xml_file>
+Options:
+ -s Use the SAX parser, not the minidom parser.
+"""
+
+def usage():
+ print USAGE_TEXT
+ sys.exit(1)
+
+
+def parse(inFileName):
+ doc = minidom.parse(inFileName)
+ rootNode = doc.documentElement
+ rootObj = DoxygenType.factory()
+ rootObj.build(rootNode)
+ # Enable Python to collect the space used by the DOM.
+ doc = None
+ sys.stdout.write('<?xml version="1.0" ?>\n')
+ rootObj.export(sys.stdout, 0, name_="doxygenindex",
+ namespacedef_='')
+ return rootObj
+
+
+def parseString(inString):
+ doc = minidom.parseString(inString)
+ rootNode = doc.documentElement
+ rootObj = DoxygenType.factory()
+ rootObj.build(rootNode)
+ # Enable Python to collect the space used by the DOM.
+ doc = None
+ sys.stdout.write('<?xml version="1.0" ?>\n')
+ rootObj.export(sys.stdout, 0, name_="doxygenindex",
+ namespacedef_='')
+ return rootObj
+
+
+def parseLiteral(inFileName):
+ doc = minidom.parse(inFileName)
+ rootNode = doc.documentElement
+ rootObj = DoxygenType.factory()
+ rootObj.build(rootNode)
+ # Enable Python to collect the space used by the DOM.
+ doc = None
+ sys.stdout.write('from index import *\n\n')
+ sys.stdout.write('rootObj = doxygenindex(\n')
+ rootObj.exportLiteral(sys.stdout, 0, name_="doxygenindex")
+ sys.stdout.write(')\n')
+ return rootObj
+
+
+def main():
+ args = sys.argv[1:]
+ if len(args) == 1:
+ parse(args[0])
+ else:
+ usage()
+
+
+
+
+if __name__ == '__main__':
+ main()
+ #import pdb
+ #pdb.run('main()')
+
diff --git a/docs/doxygen/doxyxml/text.py b/docs/doxygen/doxyxml/text.py
new file mode 100644
index 000000000..629edd180
--- /dev/null
+++ b/docs/doxygen/doxyxml/text.py
@@ -0,0 +1,56 @@
+#
+# Copyright 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.
+#
+"""
+Utilities for extracting text from generated classes.
+"""
+
+def is_string(txt):
+ if isinstance(txt, str):
+ return True
+ try:
+ if isinstance(txt, unicode):
+ return True
+ except NameError:
+ pass
+ return False
+
+def description(obj):
+ if obj is None:
+ return None
+ return description_bit(obj).strip()
+
+def description_bit(obj):
+ if hasattr(obj, 'content'):
+ contents = [description_bit(item) for item in obj.content]
+ result = ''.join(contents)
+ elif hasattr(obj, 'content_'):
+ contents = [description_bit(item) for item in obj.content_]
+ result = ''.join(contents)
+ elif hasattr(obj, 'value'):
+ result = description_bit(obj.value)
+ elif is_string(obj):
+ return obj
+ else:
+ raise StandardError('Expecting a string or something with content, content_ or value attribute')
+ # If this bit is a paragraph then add one some line breaks.
+ if hasattr(obj, 'name') and obj.name == 'para':
+ result += "\n\n"
+ return result
diff --git a/docs/doxygen/images/gnuradio-logo.png b/docs/doxygen/images/gnuradio-logo.png
new file mode 100644
index 000000000..ec4db23fc
--- /dev/null
+++ b/docs/doxygen/images/gnuradio-logo.png
Binary files differ
diff --git a/docs/doxygen/other/doxypy.py b/docs/doxygen/other/doxypy.py
new file mode 100755
index 000000000..15d3e0824
--- /dev/null
+++ b/docs/doxygen/other/doxypy.py
@@ -0,0 +1,414 @@
+#!/usr/bin/env python
+
+__applicationName__ = "doxypy"
+__blurb__ = """
+doxypy is an input filter for Doxygen. It preprocesses python
+files so that docstrings of classes and functions are reformatted
+into Doxygen-conform documentation blocks.
+"""
+
+__doc__ = __blurb__ + \
+"""
+In order to make Doxygen preprocess files through doxypy, simply
+add the following lines to your Doxyfile:
+ FILTER_SOURCE_FILES = YES
+ INPUT_FILTER = "python /path/to/doxypy.py"
+"""
+
+__version__ = "0.4.1"
+__date__ = "5th December 2008"
+__website__ = "http://code.foosel.org/doxypy"
+
+__author__ = (
+ "Philippe 'demod' Neumann (doxypy at demod dot org)",
+ "Gina 'foosel' Haeussge (gina at foosel dot net)"
+)
+
+__licenseName__ = "GPL v2"
+__license__ = """This program 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 2 of the License, or
+(at your option) any later version.
+
+This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
+"""
+
+import sys
+import re
+
+from optparse import OptionParser, OptionGroup
+
+class FSM(object):
+ """Implements a finite state machine.
+
+ Transitions are given as 4-tuples, consisting of an origin state, a target
+ state, a condition for the transition (given as a reference to a function
+ which gets called with a given piece of input) and a pointer to a function
+ to be called upon the execution of the given transition.
+ """
+
+ """
+ @var transitions holds the transitions
+ @var current_state holds the current state
+ @var current_input holds the current input
+ @var current_transition hold the currently active transition
+ """
+
+ def __init__(self, start_state=None, transitions=[]):
+ self.transitions = transitions
+ self.current_state = start_state
+ self.current_input = None
+ self.current_transition = None
+
+ def setStartState(self, state):
+ self.current_state = state
+
+ def addTransition(self, from_state, to_state, condition, callback):
+ self.transitions.append([from_state, to_state, condition, callback])
+
+ def makeTransition(self, input):
+ """ Makes a transition based on the given input.
+
+ @param input input to parse by the FSM
+ """
+ for transition in self.transitions:
+ [from_state, to_state, condition, callback] = transition
+ if from_state == self.current_state:
+ match = condition(input)
+ if match:
+ self.current_state = to_state
+ self.current_input = input
+ self.current_transition = transition
+ if options.debug:
+ print >>sys.stderr, "# FSM: executing (%s -> %s) for line '%s'" % (from_state, to_state, input)
+ callback(match)
+ return
+
+class Doxypy(object):
+ def __init__(self):
+ string_prefixes = "[uU]?[rR]?"
+
+ self.start_single_comment_re = re.compile("^\s*%s(''')" % string_prefixes)
+ self.end_single_comment_re = re.compile("(''')\s*$")
+
+ self.start_double_comment_re = re.compile("^\s*%s(\"\"\")" % string_prefixes)
+ self.end_double_comment_re = re.compile("(\"\"\")\s*$")
+
+ self.single_comment_re = re.compile("^\s*%s(''').*(''')\s*$" % string_prefixes)
+ self.double_comment_re = re.compile("^\s*%s(\"\"\").*(\"\"\")\s*$" % string_prefixes)
+
+ self.defclass_re = re.compile("^(\s*)(def .+:|class .+:)")
+ self.empty_re = re.compile("^\s*$")
+ self.hashline_re = re.compile("^\s*#.*$")
+ self.importline_re = re.compile("^\s*(import |from .+ import)")
+
+ self.multiline_defclass_start_re = re.compile("^(\s*)(def|class)(\s.*)?$")
+ self.multiline_defclass_end_re = re.compile(":\s*$")
+
+ ## Transition list format
+ # ["FROM", "TO", condition, action]
+ transitions = [
+ ### FILEHEAD
+
+ # single line comments
+ ["FILEHEAD", "FILEHEAD", self.single_comment_re.search, self.appendCommentLine],
+ ["FILEHEAD", "FILEHEAD", self.double_comment_re.search, self.appendCommentLine],
+
+ # multiline comments
+ ["FILEHEAD", "FILEHEAD_COMMENT_SINGLE", self.start_single_comment_re.search, self.appendCommentLine],
+ ["FILEHEAD_COMMENT_SINGLE", "FILEHEAD", self.end_single_comment_re.search, self.appendCommentLine],
+ ["FILEHEAD_COMMENT_SINGLE", "FILEHEAD_COMMENT_SINGLE", self.catchall, self.appendCommentLine],
+ ["FILEHEAD", "FILEHEAD_COMMENT_DOUBLE", self.start_double_comment_re.search, self.appendCommentLine],
+ ["FILEHEAD_COMMENT_DOUBLE", "FILEHEAD", self.end_double_comment_re.search, self.appendCommentLine],
+ ["FILEHEAD_COMMENT_DOUBLE", "FILEHEAD_COMMENT_DOUBLE", self.catchall, self.appendCommentLine],
+
+ # other lines
+ ["FILEHEAD", "FILEHEAD", self.empty_re.search, self.appendFileheadLine],
+ ["FILEHEAD", "FILEHEAD", self.hashline_re.search, self.appendFileheadLine],
+ ["FILEHEAD", "FILEHEAD", self.importline_re.search, self.appendFileheadLine],
+ ["FILEHEAD", "DEFCLASS", self.defclass_re.search, self.resetCommentSearch],
+ ["FILEHEAD", "DEFCLASS_MULTI", self.multiline_defclass_start_re.search, self.resetCommentSearch],
+ ["FILEHEAD", "DEFCLASS_BODY", self.catchall, self.appendFileheadLine],
+
+ ### DEFCLASS
+
+ # single line comments
+ ["DEFCLASS", "DEFCLASS_BODY", self.single_comment_re.search, self.appendCommentLine],
+ ["DEFCLASS", "DEFCLASS_BODY", self.double_comment_re.search, self.appendCommentLine],
+
+ # multiline comments
+ ["DEFCLASS", "COMMENT_SINGLE", self.start_single_comment_re.search, self.appendCommentLine],
+ ["COMMENT_SINGLE", "DEFCLASS_BODY", self.end_single_comment_re.search, self.appendCommentLine],
+ ["COMMENT_SINGLE", "COMMENT_SINGLE", self.catchall, self.appendCommentLine],
+ ["DEFCLASS", "COMMENT_DOUBLE", self.start_double_comment_re.search, self.appendCommentLine],
+ ["COMMENT_DOUBLE", "DEFCLASS_BODY", self.end_double_comment_re.search, self.appendCommentLine],
+ ["COMMENT_DOUBLE", "COMMENT_DOUBLE", self.catchall, self.appendCommentLine],
+
+ # other lines
+ ["DEFCLASS", "DEFCLASS", self.empty_re.search, self.appendDefclassLine],
+ ["DEFCLASS", "DEFCLASS", self.defclass_re.search, self.resetCommentSearch],
+ ["DEFCLASS", "DEFCLASS_MULTI", self.multiline_defclass_start_re.search, self.resetCommentSearch],
+ ["DEFCLASS", "DEFCLASS_BODY", self.catchall, self.stopCommentSearch],
+
+ ### DEFCLASS_BODY
+
+ ["DEFCLASS_BODY", "DEFCLASS", self.defclass_re.search, self.startCommentSearch],
+ ["DEFCLASS_BODY", "DEFCLASS_MULTI", self.multiline_defclass_start_re.search, self.startCommentSearch],
+ ["DEFCLASS_BODY", "DEFCLASS_BODY", self.catchall, self.appendNormalLine],
+
+ ### DEFCLASS_MULTI
+ ["DEFCLASS_MULTI", "DEFCLASS", self.multiline_defclass_end_re.search, self.appendDefclassLine],
+ ["DEFCLASS_MULTI", "DEFCLASS_MULTI", self.catchall, self.appendDefclassLine],
+ ]
+
+ self.fsm = FSM("FILEHEAD", transitions)
+ self.outstream = sys.stdout
+
+ self.output = []
+ self.comment = []
+ self.filehead = []
+ self.defclass = []
+ self.indent = ""
+
+ def __closeComment(self):
+ """Appends any open comment block and triggering block to the output."""
+
+ if options.autobrief:
+ if len(self.comment) == 1 \
+ or (len(self.comment) > 2 and self.comment[1].strip() == ''):
+ self.comment[0] = self.__docstringSummaryToBrief(self.comment[0])
+
+ if self.comment:
+ block = self.makeCommentBlock()
+ self.output.extend(block)
+
+ if self.defclass:
+ self.output.extend(self.defclass)
+
+ def __docstringSummaryToBrief(self, line):
+ """Adds \\brief to the docstrings summary line.
+
+ A \\brief is prepended, provided no other doxygen command is at the
+ start of the line.
+ """
+ stripped = line.strip()
+ if stripped and not stripped[0] in ('@', '\\'):
+ return "\\brief " + line
+ else:
+ return line
+
+ def __flushBuffer(self):
+ """Flushes the current outputbuffer to the outstream."""
+ if self.output:
+ try:
+ if options.debug:
+ print >>sys.stderr, "# OUTPUT: ", self.output
+ print >>self.outstream, "\n".join(self.output)
+ self.outstream.flush()
+ except IOError:
+ # Fix for FS#33. Catches "broken pipe" when doxygen closes
+ # stdout prematurely upon usage of INPUT_FILTER, INLINE_SOURCES
+ # and FILTER_SOURCE_FILES.
+ pass
+ self.output = []
+
+ def catchall(self, input):
+ """The catchall-condition, always returns true."""
+ return True
+
+ def resetCommentSearch(self, match):
+ """Restarts a new comment search for a different triggering line.
+
+ Closes the current commentblock and starts a new comment search.
+ """
+ if options.debug:
+ print >>sys.stderr, "# CALLBACK: resetCommentSearch"
+ self.__closeComment()
+ self.startCommentSearch(match)
+
+ def startCommentSearch(self, match):
+ """Starts a new comment search.
+
+ Saves the triggering line, resets the current comment and saves
+ the current indentation.
+ """
+ if options.debug:
+ print >>sys.stderr, "# CALLBACK: startCommentSearch"
+ self.defclass = [self.fsm.current_input]
+ self.comment = []
+ self.indent = match.group(1)
+
+ def stopCommentSearch(self, match):
+ """Stops a comment search.
+
+ Closes the current commentblock, resets the triggering line and
+ appends the current line to the output.
+ """
+ if options.debug:
+ print >>sys.stderr, "# CALLBACK: stopCommentSearch"
+ self.__closeComment()
+
+ self.defclass = []
+ self.output.append(self.fsm.current_input)
+
+ def appendFileheadLine(self, match):
+ """Appends a line in the FILEHEAD state.
+
+ Closes the open comment block, resets it and appends the current line.
+ """
+ if options.debug:
+ print >>sys.stderr, "# CALLBACK: appendFileheadLine"
+ self.__closeComment()
+ self.comment = []
+ self.output.append(self.fsm.current_input)
+
+ def appendCommentLine(self, match):
+ """Appends a comment line.
+
+ The comment delimiter is removed from multiline start and ends as
+ well as singleline comments.
+ """
+ if options.debug:
+ print >>sys.stderr, "# CALLBACK: appendCommentLine"
+ (from_state, to_state, condition, callback) = self.fsm.current_transition
+
+ # single line comment
+ if (from_state == "DEFCLASS" and to_state == "DEFCLASS_BODY") \
+ or (from_state == "FILEHEAD" and to_state == "FILEHEAD"):
+ # remove comment delimiter from begin and end of the line
+ activeCommentDelim = match.group(1)
+ line = self.fsm.current_input
+ self.comment.append(line[line.find(activeCommentDelim)+len(activeCommentDelim):line.rfind(activeCommentDelim)])
+
+ if (to_state == "DEFCLASS_BODY"):
+ self.__closeComment()
+ self.defclass = []
+ # multiline start
+ elif from_state == "DEFCLASS" or from_state == "FILEHEAD":
+ # remove comment delimiter from begin of the line
+ activeCommentDelim = match.group(1)
+ line = self.fsm.current_input
+ self.comment.append(line[line.find(activeCommentDelim)+len(activeCommentDelim):])
+ # multiline end
+ elif to_state == "DEFCLASS_BODY" or to_state == "FILEHEAD":
+ # remove comment delimiter from end of the line
+ activeCommentDelim = match.group(1)
+ line = self.fsm.current_input
+ self.comment.append(line[0:line.rfind(activeCommentDelim)])
+ if (to_state == "DEFCLASS_BODY"):
+ self.__closeComment()
+ self.defclass = []
+ # in multiline comment
+ else:
+ # just append the comment line
+ self.comment.append(self.fsm.current_input)
+
+ def appendNormalLine(self, match):
+ """Appends a line to the output."""
+ if options.debug:
+ print >>sys.stderr, "# CALLBACK: appendNormalLine"
+ self.output.append(self.fsm.current_input)
+
+ def appendDefclassLine(self, match):
+ """Appends a line to the triggering block."""
+ if options.debug:
+ print >>sys.stderr, "# CALLBACK: appendDefclassLine"
+ self.defclass.append(self.fsm.current_input)
+
+ def makeCommentBlock(self):
+ """Indents the current comment block with respect to the current
+ indentation level.
+
+ @returns a list of indented comment lines
+ """
+ doxyStart = "##"
+ commentLines = self.comment
+
+ commentLines = map(lambda x: "%s# %s" % (self.indent, x), commentLines)
+ l = [self.indent + doxyStart]
+ l.extend(commentLines)
+
+ return l
+
+ def parse(self, input):
+ """Parses a python file given as input string and returns the doxygen-
+ compatible representation.
+
+ @param input the python code to parse
+ @returns the modified python code
+ """
+ lines = input.split("\n")
+
+ for line in lines:
+ self.fsm.makeTransition(line)
+
+ if self.fsm.current_state == "DEFCLASS":
+ self.__closeComment()
+
+ return "\n".join(self.output)
+
+ def parseFile(self, filename):
+ """Parses a python file given as input string and returns the doxygen-
+ compatible representation.
+
+ @param input the python code to parse
+ @returns the modified python code
+ """
+ f = open(filename, 'r')
+
+ for line in f:
+ self.parseLine(line.rstrip('\r\n'))
+ if self.fsm.current_state == "DEFCLASS":
+ self.__closeComment()
+ self.__flushBuffer()
+ f.close()
+
+ def parseLine(self, line):
+ """Parse one line of python and flush the resulting output to the
+ outstream.
+
+ @param line the python code line to parse
+ """
+ self.fsm.makeTransition(line)
+ self.__flushBuffer()
+
+def optParse():
+ """Parses commandline options."""
+ parser = OptionParser(prog=__applicationName__, version="%prog " + __version__)
+
+ parser.set_usage("%prog [options] filename")
+ parser.add_option("--autobrief",
+ action="store_true", dest="autobrief",
+ help="use the docstring summary line as \\brief description"
+ )
+ parser.add_option("--debug",
+ action="store_true", dest="debug",
+ help="enable debug output on stderr"
+ )
+
+ ## parse options
+ global options
+ (options, filename) = parser.parse_args()
+
+ if not filename:
+ print >>sys.stderr, "No filename given."
+ sys.exit(-1)
+
+ return filename[0]
+
+def main():
+ """Starts the parser on the file given by the filename as the first
+ argument on the commandline.
+ """
+ filename = optParse()
+ fsm = Doxypy()
+ fsm.parseFile(filename)
+
+if __name__ == "__main__":
+ main()
diff --git a/docs/doxygen/other/extra_pages.dox b/docs/doxygen/other/extra_pages.dox
new file mode 100644
index 000000000..d40c692e0
--- /dev/null
+++ b/docs/doxygen/other/extra_pages.dox
@@ -0,0 +1,326 @@
+/*! \page build_guide Build Instructions and Information
+
+\section dependencies Dependencies
+
+The list of GNU Radio dependencies and the minimum required versions,
+if any, to build the various GNU Radio components.
+
+Most of these components do not need to be individually compiled or
+installed. Instead, rely on your operating system's package manager or
+binary installation process (the <b>apt-get</b> system in Debian and
+Ubuntu, <b>yum</b> in RedHat and Fedora, etc.). GNU Radio tries to keep an
+up-to-date build guide for the majority of the supported operating
+systems on gnuradio.org
+(http://gnuradio.org/redmine/projects/gnuradio/wiki/BuildGuide).
+
+Not all dependencies are required for all components, and not all
+components are required for a given installation. The list of required
+components is determined by what the user requires from GNU Radio. If,
+for example, you do not use any Comedi-based hardware, do not worry
+about building gr-comedi.
+
+Before trying to build these from source, please try your system's
+installation tool (apt-get, pkg_install, YaST, yum, urpmi, etc.)
+first. Most recent systems have these packages available.
+
+\subsection dep_global Global Dependencies
+\li git http://code.google.com/p/msysgit
+\li cmake (>= 2.6) http://www.cmake.org/cmake/resources/software.html
+\li boost (>= 1.35) http://www.boostpro.com/download
+\li cppunit (>= 1.9.14) http://gaiacrtn.free.fr/cppunit/index.html
+\li fftw3f (>= 3.0) http://www.fftw.org/install/windows.html
+
+\subsection dep_python Python Wrappers
+\li python (>= 2.5) http://www.python.org/download/
+\li swig (>= 1.3.31) http://www.swig.org/download.html
+\li numpy (>= 1.1.0) http://sourceforge.net/projects/numpy/files/NumPy/
+
+\subsection dep_docs docs: Building the documentation
+\li doxygen (>= 1.5) http://www.stack.nl/~dimitri/doxygen/download.html
+
+\subsection dep_grc grc: The GNU Radio Companion
+\li Cheetah (>= 2.0) http://www.cheetahtemplate.org/
+\li pygtk (>= 2.10) http://www.pygtk.org/downloads.html
+
+\subsection dep_wavelet gr-wavelet: Collection of wavelet blocks
+\li gsl (>= 1.10) http://gnuwin32.sourceforge.net/packages/gsl.htm
+
+\subsection dep_gr_qtgui gr-qtgui: The QT-based Graphical User Interface
+\li qt (>= 4.4) http://qt.nokia.com/downloads/
+\li qwt (>= 5.2) http://sourceforge.net/projects/qwt/
+\li pyqt (>= 4.4) http://www.riverbankcomputing.co.uk/software/pyqt/download
+\li pyqwt (>= 5.2) http://pyqwt.sourceforge.net/download.html
+
+\subsection dep_gr_wxgui gr-wxgui: The WX-based Graphical User Interface
+\li wxpython (>= 2.8) http://www.wxpython.org/
+\li python-lxml (>= 1.3.6) http://lxml.de/
+
+\subsection dep_gr_audio gr-audio: Audio Subsystems (system/OS dependent)
+\li audio-alsa (>= 0.9) http://www.alsa-project.org
+\li audio-jack (>= 0.8) http://jackaudio.org/
+\li portaduio (>= 19) http://www.portaudio.com/
+\li audio-oss (>= 1.0) http://www.opensound.com/oss.html
+\li audio-osx
+\li audio-windows
+
+It is not necessary to satisfy all of these dependencies; just the
+one(s) that are right for your system. On Linux, don't expect
+audio-osx and audio-windows to be either satisfied or built.
+
+\subsection dep_uhd uhd: The Ettus USRP Hardware Driver Interface
+\li uhd (>= 3.0.0) http://code.ettus.com/redmine/ettus/projects/uhd/wiki
+
+\subsection dep_shd shd: The Symplex Hardware Driver Interface
+\li shd (>= 3.0.0)
+
+\subsection dep_gr_video_sdl gr-video-sdl: PAL and NTSC display
+\li SDL (>= 1.2.0) http://www.libsdl.org/download-1.2.php
+
+\subsection dep_gr_comedi gr-comedi: Comedi hardware interface
+\li comedilib (>= 0.8) http://www.comedi.org/
+
+
+
+\section build_gr_cmake Building GNU Radio
+
+GNU Radio is built using the Cmake build system
+(http://www.cmake.org/). The standard build method is as follows:
+
+\code
+$ mkdir $(builddir)
+$ cd $(builddir)
+$ cmake [OPTIONS] $(srcdir)
+$ make
+$ make test
+$ sudo make install
+\endcode
+
+The \$(builddir) is the directory in which the code is built. This
+<b>cannot</b> be the same path as where the source code resides. Often,
+\$(builddir) is \$(srcdir)/build.
+
+\subsection Cmake Options
+
+Options can be used to specify where to find various library or
+include file dependencies that are not automatically being found
+(-DCMAKE_PREFIX_PATH) or set the prefix
+(-DCMAKE_INSTALL_PREFIX=(dir)).
+
+Components can also be enabled and disabled through the options. For a
+component named *gr-comp*, the option to disable would look like:
+-DENABLE_GR_COMP=off. The "off" could also be "false" or "no", and
+cmake is not case sensitive about these options. Similarly, "true",
+"on", or "yes" will turn this component on. All components are enabled
+by default.
+
+An example is -DENABLE_PYTHON=False turns off building any Python or
+Swigging components. The result will be the GNU Radio libraries and
+C++ programs/applications/examples. No Python or GRC files will be
+built or installed.
+
+The -DENABLE_DEFAULT=False can be used to disable all
+components. Individual components can then be selectively turned back
+on. For example, just buidling the Volk and Gruel libraries can be
+done with this:
+
+\code
+cmake -DENABLE_DEFAULT=Off -DENABLE_VOLK=True -DENABLE_GRUEL=True <srcdir>
+\endcode
+
+
+The build type allows you to specify the build as a debug or release
+version. Each type sets different flags for different purposes. To set
+the build type, use:
+
+\code
+-DCMAKE_BUILD_TYPE="Release"|"Debug"
+\endcode
+
+If not specified, the "Release" mode is the defaulted to.
+
+"Release" mode sets the '-O3' optimization flag.
+
+"Debug" mode sets '-g -O2' flags to export debug symbols and reduce
+the optimization to make the libraries easier to debug and step
+through.
+
+
+\subsection build_gr_cmake_e100 Building for the E100
+
+To build GNU Radio on the Ettus Research E100 embedded platforms,
+Cmake has to know that the processors uses the NEON extensions. Use
+the
+
+\code
+cmake -DCMAKE_CXX_FLAGS:STRING="-mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp -g" \
+ -DCMAKE_C_FLAGS:STRING="-mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp -g" \
+ <gr_source_dir>
+\endcode
+
+*/
+
+
+
+/*! \page volk_guide Instructions for using Volk in GNU Radio
+
+\section volk_intro Introduction
+
+Volk is the Vector-Optimized Library of Kernels. It is a library that
+contains kernels of hand-written SIMD code for different mathematical
+operations. Since each SIMD architecture can be greatly different and
+no compiler has yet come along to handle vectorization properly or
+highly efficiently, Volk approaches the problem differently. For each
+architecture or platform that a developer wishes to vectorize for, a
+new proto-kernel is added to Volk. At runtime, Volk will select the
+correct proto-kernel. In this way, the users of Volk call a kernel for
+performing the operation that is platform/architecture agnostic. This
+allows us to write portable SIMD code.
+
+Volk kernels are always defined with a 'generic' proto-kernel, which
+is written in plain C. With the generic kernel, the kernel becomes
+portable to any platform. Kernels are then extended by adding
+proto-kernels for new platforms in which they are desired.
+
+A good example of a Volk kernel with multiple proto-kernels defined is
+the volk_32f_s32f_multiply_32f_a. This kernel implements a scalar
+multiplication of a vector of floating point numbers (each item in the
+vector is multiplied by the same value). This kernel has the following
+proto-kernels that are defined for 'generic,' 'avx,' 'sse,' and 'orc.'
+
+\code
+ void volk_32f_s32f_multiply_32f_a_generic
+ void volk_32f_s32f_multiply_32f_a_sse
+ void volk_32f_s32f_multiply_32f_a_avx
+ void volk_32f_s32f_multiply_32f_a_orc
+\endcode
+
+These proto-kernels means that on platforms with AVX support, Volk can
+select this option or the SSE option, depending on which is faster. On
+other platforms, the ORC SIMD compiler might provide a solution. If
+all else fails, Volk can fall back on the generic proto-kernel, which
+will always work.
+
+Just a note on ORC. ORC is a SIMD compiler library that uses a generic
+assembly-like language for SIMD commands. Based on the available SIMD
+architecture of a system, it will try and compile a good
+solution. Tests show that the results of ORC proto-kernels are
+generally better than the generic versions but often not as good as
+the hand-tuned proto-kernels for a specific SIMD architecture. This
+is, of course, to be expected, and ORC provides a nice intermediary
+step to performance improvements until a specific hand-tuned
+proto-kernel can be made for a given platform.
+
+See <a
+href="http://gnuradio.org/redmine/projects/gnuradio/wiki/Volk">Volk on
+gnuradio.org</a> for details on the Volk naming scheme.
+
+
+\section volk_alignment Setting and Using Memory Alignment Information
+
+For Volk to work as best as possible, we want to use memory-aligned
+SIMD calls, which means we have to have some way of knowing and
+controlling the alignment of the buffers passed to gr_block's work
+function. We set the alignment requirement for SIMD aligned memory
+calls with:
+
+\code
+ const int alignment_multiple =
+ volk_get_alignment() / output_item_size;
+ set_alignment(std::max(1,alignment_multiple));
+\endcode
+
+The Volk function 'volk_get_alignment' provides the alignment of the
+the machine architecture. We then base the alignment on the number of
+output items required to maintain the alignment, so we divide the
+number of alignment bytes by the number of bytes in an output items
+(sizeof(float), sizeof(gr_complex), etc.). This value is then set per
+block with the 'set_alignment' function.
+
+Because the scheduler tries to optimize throughput, the number of
+items available per call to work will change and depends on the
+availability of the read and write buffers. This means that it
+sometimes cannot produce a buffer that is properly memory
+aligned. This is an inevitable consequence of the scheduler
+system. Instead of requiring alignment, the scheduler enforces the
+alignment as much as possible, and when a buffer becomes unaligned,
+the scheduler will work to correct it as much as possible. If a
+block's buffers are unaligned, then, the scheduler sets a flag to
+indicate as much so that the block can then decide what best to
+do. The next section discusses the use of the aligned/unaligned
+information in a gr_block's work function.
+
+
+\section volk_work Using Alignment Properties in Work()
+
+The buffers passed to work/general_work in a gr_block are not
+guaranteed to be aligned, but they will mostly be aligned whenever
+possible. When not aligned, the 'is_unaligned()' flag will be set. So
+a block can know if its buffers are aligned and make the right
+decisions. This looks like:
+
+\code
+int
+gr_some_block::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const float *in = (const float *) input_items[0];
+ float *out = (float *) output_items[0];
+
+ if(is_unaligned()) {
+ // do something with unaligned data. This can either be a manual
+ // handling of the items or a call to an unaligned Volk function.
+ volk_32f_something_32f_u(out, in, noutput_items);
+ }
+ else {
+ // Buffers are aligned; can call the aligned Volk function.
+ volk_32f_something_32f_a(out, in, noutput_items);
+ }
+
+ return noutput_items;
+}
+\endcode
+
+
+
+\section volk_tuning Tuning Volk Performance
+
+VOLK comes with a profiler that will build a config file for the best
+SIMD architecture for your processor. Run volk_profile that is
+installed into $PREFIX/bin. This program tests all known VOLK kernels
+for each architecture supported by the processor. When finished, it
+will write to $HOME/.volk/volk_config the best architecture for the
+VOLK function. This file is read when using a function to know the
+best version of the function to execute.
+
+\subsection volk_hand_tuning Hand-Tuning Performance
+
+If you know a particular architecture works best for your processor,
+you can specify the particular architecture to use in the VOLK
+preferences file: $HOME/.volk/volk_config
+
+The file looks like:
+
+\code
+ volk_<FUNCTION_NAME> <ARCHITECTURE>
+\endcode
+
+Where the "FUNCTION_NAME" is the particular function that you want to
+over-ride the default value and "ARCHITECTURE" is the VOLK SIMD
+architecture to use (generic, sse, sse2, sse3, avx, etc.). For
+example, the following config file tells VOLK to use SSE3 for the
+aligned and unaligned versions of a function that multiplies two
+complex streams together.
+
+\code
+ volk_32fc_x2_multiply_32fc_a sse3
+ volk_32fc_x2_multiply_32fc_u sse3
+\endcode
+
+\b Tip: if benchmarking GNU Radio blocks, it can be useful to have a
+volk_config file that sets all architectures to 'generic' as a way to
+test the vectorized versus non-vectorized implementations.
+
+*/
+
+
diff --git a/docs/doxygen/other/group_defs.dox b/docs/doxygen/other/group_defs.dox
new file mode 100644
index 000000000..4aee49ec8
--- /dev/null
+++ b/docs/doxygen/other/group_defs.dox
@@ -0,0 +1,68 @@
+/*!
+ * \defgroup block GNU Radio C++ Signal Processing Blocks
+ * \brief All C++ blocks that can be used in GR graphs are listed here or in
+ * the subcategories below.
+ *
+ * Sorry, at this time the Python hierarchical blocks are not included
+ * in this index.
+ * @{
+ */
+
+/*! \defgroup container_blk Top Block and Hierarchical Block Base Classes */
+/*! \defgroup source_blk Signal Sources */
+/*! \defgroup sink_blk Signal Sinks */
+/*! \defgroup filter_blk Filters */
+/*! \defgroup math_blk Mathematics */
+/*! \defgroup modulation_blk Signal Modulation */
+/*! \defgroup demodulation_blk Signal Demodulation */
+/*! \defgroup coding_blk Information Coding and Decoding*/
+/*! \defgroup sync_blk Synchronization */
+/*! \defgroup eq_blk Equalization */
+/*! \defgroup converter_blk Type Conversions */
+/*! \defgroup level_blk Signal Level Control (AGC) */
+/*! \defgroup dft_blk Fourier Transform */
+/*! \defgroup wavelet_blk Wavelet Transform */
+/*! \defgroup ofdm_blk OFDM Blocks */
+/*! \defgroup pager_blk Pager Blocks */
+/*! \defgroup misc_blk Miscellaneous Blocks */
+/*! \defgroup slicedice_blk Slicing and Dicing Streams */
+/*! \defgroup vocoder_blk Voice Encoders and Decoders */
+/*! \defgroup digital Digital Modulation Blocks */
+/*! \defgroup analog Analog Communications Blocks */
+/*! \defgroup qtgui_blk QT Graphical Interfaces */
+/*! \defgroup uhd_blk UHD Interface */
+/*! \defgroup audio_blk Audio Interface */
+/*! \defgroup pfb_blk Polyphase Filterbank */
+/*! \defgroup snr_blk SNR estimators */
+
+/*!
+ * \defgroup base_blk Base classes for GR Blocks
+ * \brief All C++ blocks are derived from these base classes
+ */
+
+
+/*! @} */
+
+/*! \defgroup filter_design Digital Filter Design */
+/*! \defgroup misc Miscellaneous */
+/*! \defgroup internal Implementation Details */
+
+/*!
+ * \defgroup applications Applications
+ * These are some applications build using gnuradio...
+ * @{
+ */
+
+/*!
+ * \defgroup atsc ATSC
+ * ATSC Applications...
+ */
+
+/*!
+ * \defgroup pager Pager
+ * Pager Applications
+ */
+
+/*! @} */
+
+/*! \defgroup hardware Misc Hardware Control */
diff --git a/docs/doxygen/other/main_page.dox b/docs/doxygen/other/main_page.dox
new file mode 100644
index 000000000..e7d4685f7
--- /dev/null
+++ b/docs/doxygen/other/main_page.dox
@@ -0,0 +1,405 @@
+/*! \mainpage
+
+\image html gnuradio-logo.png
+
+Welcome to GNU Radio!
+
+For details about GNU Radio and using it, please see the <a
+href="http://gnuradio.org" target="_blank"><b>main project page</b></a>.
+
+Other information about the project and discussion about GNU Radio,
+software radio, and communication theory in general can be found at
+the <a href="http://gnuradio.squarespace.com" target="_blank"><b>GNU Radio blog</b></a>.
+
+
+\section build Building GNU Radio
+
+See the \ref build_guide page for details about the project's
+dependencies and build process.
+
+
+\section blocks GNU Radio Blocks
+
+GNU Radio uses discrete signal processing blocks that are connected
+together to perform your signal processing application. This manual
+contain a list of all GNU Radio <a href="modules.html"><b>C++ Blocks</b></a>.
+
+Please note that at this time, we haven't found an acceptable way to
+provide unified documentation for the C++ parts of the system and the
+parts written in Python (mostly hierarchical blocks). Until this gets
+worked out, please bear with us, or better yet, solve it for us!
+
+
+\section toc Manual Contents
+More details on packages in GNU Radio:
+\li \ref page_audio
+\li \ref page_digital
+\li \ref page_qtgui
+\li \ref page_uhd
+\li \ref page_vocoder
+
+More details on GNU Radio concepts:
+\li \ref page_pmt
+\li \ref page_msg_passing
+\li \ref page_metadata
+\li \ref volk_guide
+\li \ref page_pfb
+
+
+\section flowgraph Operating a Flowgraph
+
+The basic data structure in GNU Radio is the flowgraph, which
+represents the connections of the blocks through which a continuous
+stream of samples flows. The concept of a flowgraph is an acyclic
+directional graph with one or more source blocks (to insert samples
+into the flowgraph), one or more sink blocks (to terminate or export
+samples from the flowgraph), and any signal processing blocks in
+between.
+
+A program must at least create a GNU Radio 'top_block', which
+represents the top-most structure of the flowgraph. The top blocks
+provide the overall control and hold methods such as 'start,' 'stop,'
+and 'wait.'
+
+The general construction of a GNU Radio application is to create a
+gr_top_block, instantiate the blocks, connect the blocks together, and
+then start the gr_top_block. The following program shows how this is
+done. A single source and sink are used with a FIR filter between
+them.
+
+\code
+ from gnuradio import gr, filter
+
+ class my_topblock(gr.top_block):
+ def __init__(self):
+ gr.top_block.__init__(self)
+
+ amp = 1
+ taps = filter.firdes.low_pass(1, 1, 0.1, 0.01)
+
+ self.src = gr.noise_source_c(gr.GR_GAUSSIAN, amp)
+ self.flt = filter.fir_filter_ccf(1, taps)
+ self.snk = gr.null_sink(gr.sizeof_gr_complex)
+
+ self.connect(self.src, self.flt, self.snk)
+
+ if __name__ == "__main__":
+ tb = my_topblock()
+ tb.start()
+ tb.wait()
+\endcode
+
+The 'tb.start()' starts the data flowing through the flowgraph while
+the 'tb.wait()' is the equivalent of a thread's 'join' operation and
+blocks until the gr_top_block is done.
+
+An alternative to using the 'start' and 'wait' methods, a 'run' method is
+also provided for convenience that is a blocking start call;
+equivalent to the above 'start' followed by a 'wait.'
+
+
+\subsection latency Latency and Throughput
+
+By default, GNU Radio runs a scheduler that attempts to optimize
+throughput. Using a dynamic scheduler, blocks in a flowgraph pass
+chunks of items from sources to sinks. The sizes of these chunks will
+vary depending on the speed of processing. For each block, the number
+of items is can process is dependent on how much space it has in its
+output buffer(s) and how many items are available on the input
+buffer(s).
+
+The consequence of this is that often a block may be called with a very
+large number of items to process (several thousand). In terms of
+speed, this is efficient since now the majority of the processing time
+is taken up with processing samples. Smaller chunks mean more calls
+into the scheduler to retrieve more data. The downside to this is that
+it can lead to large latency while a block is processing a large chunk
+of data.
+
+To combat this problem, the gr_top_block can be passed a limit on the
+number of output items a block will ever receive. A block may get less
+than this number, but never more, and so it serves as an upper limit
+to the latency any block will exhibit. By limiting the number of items
+per call to a block, though, we increase the overhead of the
+scheduler, and so reduce the overall efficiency of the application.
+
+To set the maximum number of output items, we pass a value into the
+'start' or 'run' method of the gr_top_block:
+
+\code
+ tb.start(1000)
+ tb.wait()
+or
+ tb.run(1000)
+\endcode
+
+Using this method, we place a global restriction on the size of items
+to all blocks. Each block, though, has the ability to overwrite this
+with its own limit. Using the 'set_max_noutput_items(m)' method for an
+individual block will overwrite the global setting. For example, in
+the following code, the global setting is 1000 items max, except for
+the FIR filter, which can receive up to 2000 items.
+
+\code
+ tb.flt.set_max_noutput_items(2000)
+ tb.run(1000)
+\endcode
+
+In some situations, you might actually want to restrict the size of
+the buffer itself. This can help to prevent a buffer who is blocked
+for data from just increasing the amount of items in its buffer, which
+will then cause an increased latency for new samples. You can set the
+size of an output buffer for each output port for every block.
+
+WARNING: This is an advanced feature in GNU Radio and should not be
+used without a full understanding of this concept as explained below.
+
+To set the output buffer size of a block, you simply call:
+
+\code
+ tb.blk0.set_max_output_buffer(2000)
+ tb.blk1.set_max_output_buffer(1, 2000)
+ tb.start()
+ print tb.blk1.max_output_buffer(0)
+ print tb.blk1.max_output_buffer(1)
+\endcode
+
+In the above example, all ports of blk0 are set to a buffer size of
+2000 in _items_ (not bytes), and blk1 only sets the size for output
+port 1, any and all other ports use the default. The third and fourth
+lines just print out the buffer sizes for ports 0 and 1 of blk1. This
+is done after start() is called because the values are updated based
+on what is actually allocated to the block's buffers.
+
+NOTES:
+
+1. Buffer length assignment is done once at runtime (i.e., when run()
+or start() is called). So to set the max buffer lengths, the
+set_max_output_buffer calls must be done before this.
+
+2. Once the flowgraph is started, the buffer lengths for a block are
+set and cannot be dynamically changed, even during a
+lock()/unlock(). If you need to change the buffer size, you will have
+to delete the block and rebuild it, and therefore must disconnect and
+reconnect the blocks.
+
+3. This can affect throughput. Large buffers are designed to improve
+the efficiency and speed of the program at the expense of
+latency. Limiting the size of the buffer may decrease performance.
+
+4. The real buffer size is actually based on a minimum granularity of
+the system. Typically, this is a page size, which is typically 4096
+bytes. This means that any buffer size that is specified with this
+command will get rounded up to the nearest granularity (e.g., page)
+size. When calling max_output_buffer(port) after the flowgraph is
+started, you will get how many items were actually allocated in the
+buffer, which may be different than what was initially specified.
+
+
+\section reconfigure Reconfiguring Flowgraphs
+
+It is possible to reconfigure the flowgraph at runtime. The
+reconfiguration is meant for changes in the flowgraph structure, not
+individual parameter settings of the blocks. For example, changing the
+constant in a gr_add_const_cc block can be done while the flowgraph is
+running using the 'set_k(k)' method.
+
+Reconfiguration is done by locking the flowgraph, which stops it from
+running and processing data, performing the reconfiguration, and then
+restarting the graph by unlocking it.
+
+The following example code shows a graph that first adds two
+gr_noise_source_c blocks and then replaces the gr_add_cc block with a
+gr_sub_cc block to then subtract the sources.
+
+\code
+from gnuradio import gr
+import time
+
+class mytb(gr.top_block):
+ def __init__(self):
+ gr.top_block.__init__(self)
+
+ self.src0 = gr.noise_source_c(gr.GR_GAUSSIAN, 1)
+ self.src1 = gr.noise_source_c(gr.GR_GAUSSIAN, 1)
+ self.add = gr.add_cc()
+ self.sub = gr.sub_cc()
+ self.head = gr.head(gr.sizeof_gr_complex, 1000000)
+ self.snk = gr.file_sink(gr.sizeof_gr_complex, "output.32fc")
+
+ self.connect(self.src0, (self.add,0))
+ self.connect(self.src1, (self.add,1))
+ self.connect(self.add, self.head)
+ self.connect(self.head, self.snk)
+
+def main():
+ tb = mytb()
+ tb.start()
+ time.sleep(0.01)
+
+ # Stop flowgraph and disconnect the add block
+ tb.lock()
+ tb.disconnect(tb.add, tb.head)
+ tb.disconnect(tb.src0, (tb.add,0))
+ tb.disconnect(tb.src1, (tb.add,1))
+
+ # Connect the sub block and restart
+ tb.connect(tb.sub, tb.head)
+ tb.connect(tb.src0, (tb.sub,0))
+ tb.connect(tb.src1, (tb.sub,1))
+ tb.unlock()
+
+ tb.wait()
+
+if __name__ == "__main__":
+ main()
+\endcode
+
+During reconfiguration, the maximum noutput_items value can be changed
+either globally using the 'set_max_noutput_items(m)' on the gr_top_block
+object or locally using the 'set_max_noutput_items(m)' on any given
+block object.
+
+A block also has a 'unset_max_noutput_items()' method that unsets the
+local max noutput_items value so that block reverts back to using the
+global value.
+
+The following example expands the previous example but sets and resets
+the max noutput_items both locally and globally.
+
+\code
+from gnuradio import gr
+import time
+
+class mytb(gr.top_block):
+ def __init__(self):
+ gr.top_block.__init__(self)
+
+ self.src0 = gr.noise_source_c(gr.GR_GAUSSIAN, 1)
+ self.src1 = gr.noise_source_c(gr.GR_GAUSSIAN, 1)
+ self.add = gr.add_cc()
+ self.sub = gr.sub_cc()
+ self.head = gr.head(gr.sizeof_gr_complex, 1000000)
+ self.snk = gr.file_sink(gr.sizeof_gr_complex, "output.32fc")
+
+ self.connect(self.src0, (self.add,0))
+ self.connect(self.src1, (self.add,1))
+ self.connect(self.add, self.head)
+ self.connect(self.head, self.snk)
+
+def main():
+ # Start the gr_top_block after setting some max noutput_items.
+ tb = mytb()
+ tb.src1.set_max_noutput_items(2000)
+ tb.start(100)
+ time.sleep(0.01)
+
+ # Stop flowgraph and disconnect the add block
+ tb.lock()
+
+ tb.disconnect(tb.add, tb.head)
+ tb.disconnect(tb.src0, (tb.add,0))
+ tb.disconnect(tb.src1, (tb.add,1))
+
+ # Connect the sub block
+ tb.connect(tb.sub, tb.head)
+ tb.connect(tb.src0, (tb.sub,0))
+ tb.connect(tb.src1, (tb.sub,1))
+
+ # Set new max_noutput_items for the gr_top_block
+ # and unset the local value for src1
+ tb.set_max_noutput_items(1000)
+ tb.src1.unset_max_noutput_items()
+ tb.unlock()
+
+ tb.wait()
+
+if __name__ == "__main__":
+ main()
+\endcode
+
+
+\section volk_main Using Volk in GNU Radio
+
+The \ref volk_guide page provides an overview of how to incorporate
+and use Volk in GNU Radio blocks.
+
+Many blocks have already been converted to use Volk in their calls, so
+they can also serve as examples. See the gr_complex_to_xxx.h file for
+examples of various blocks that make use of Volk.
+
+
+\section prefs Configuration / Preference Files
+
+GNU Radio defines some of its basic behavior through a set of
+configuration files located in
+${prefix}/etc/gnuradio/conf.d. Different components have different
+files listed in here for the various properties. These will be read
+once when starting a GNU Radio application, so updates during runtime
+will not affect them.
+
+The configuration files use the following format:
+
+\code
+# Stuff from section 1
+[section1]
+var1 = value1
+var2 = value2 # value of 2
+
+# Stuff from section 2
+[section2]
+var3 = value3
+\endcode
+
+In this file, the hash mark ('#') indicates a comment and blank lines
+are ignored. Section labels are defined inside square brackets as a
+group distinguisher. All options must be associated with a section
+name. The options are listed one per line with the option name is
+given followed by an equals ('=') sign and then the value. All section
+and option names must not have white spaces (actually, all white
+spaces are ignored).
+
+The value of an option can be a string or number and retrieved through
+a few different interfaces. There is a single preference object
+created when GNU Radio is launched. In Python, you can get this by
+making a new variable:
+
+\code
+p = gr.prefs()
+\endcode
+
+Similarly, in C++, we get a reference to the object by explicitly
+calling for the singleton of the object:
+
+\code
+ gr_prefs *p = gr_prefs::singleton();
+\endcode
+
+The methods associated with this preferences object are (from class gr_prefs):
+
+\code
+ bool has_section(string section)
+ bool has_option(string section, string option)
+ string get_string(string section, string option, string default_val)
+ bool get_bool(string section, string option, bool default_val)
+ long get_long(string section, string option, long default_val)
+ double get_double(string section, string option, double default_val)
+\endcode
+
+When setting a Boolean value, we can use 0, 1, "True", "true",
+"False", "false", "On", "on", "Off", and "off".
+
+All configuration preferences in these files can also be overloaded by
+an environmental variable. The environmental variable is named based
+on the section and option name from the configuration file as:
+
+\code
+ GR_CONF_<SECTION>_<OPTION> = <value>
+\endcode
+
+The "GR_CONF_" is a prefix to identify this as a GNU Radio
+configuration variable and the section and option names are in
+uppercase. The value is the same format that would be used in the
+config file itself.
+
+*/
diff --git a/docs/doxygen/other/metadata.dox b/docs/doxygen/other/metadata.dox
new file mode 100644
index 000000000..b527b2100
--- /dev/null
+++ b/docs/doxygen/other/metadata.dox
@@ -0,0 +1,330 @@
+/*! \page page_metadata Metadata Information
+
+\section Introduction
+
+Metadata files have extra information in the form of headers that
+carry metadata about the samples in the file. Raw, binary files carry
+no extra information and must be handled delicately. Any changes in
+the system state such as sample rate or if a receiver's frequency are
+not conveyed with the data in the file itself. Header of metadata
+solve this problem.
+
+We write metadata files using gr::blocks::file_meta_sink and read metadata
+files using gr::blocks::file_meta_source.
+
+Metadata files have headers that carry information about a segment of
+data within the file. The header structure is described in detail in
+the next section. A metadata file always starts with a header that
+describes the basic structure of the data. It contains information
+about the item size, data type, if it's complex, the sample rate of
+the segment, the time stamp of the first sample of the segment, and
+information regarding the header size and segment size.
+
+Headers have two main tags associated with them:
+
+- rx_rate: the sample rate of the stream.
+- rx_time: the time stamp of the first item in the segment.
+
+These tags were inspired by the UHD tag format.
+
+The header gives enough information to process and handle the
+data. One cautionary note, though, is that the data type should never
+change within a file. There should be very little need for this, but
+more importantly. GNU Radio blocks can only set the data type of their
+IO signatures in the constructor, so changes in the data type
+afterward will not be recognized.
+
+We also have an extra header segment that is option. This can be
+loaded up at the beginning by the user specifying some extra metadata
+that should be transmitted along with the data. It also grows whenever
+it sees a stream tag, so the dictionary will contain and key:value
+pairs out of tags from the flowgraph.
+
+
+\subsection types Types of Metadata Files
+
+GNU Radio currently supports two types of metadata files:
+
+- inline: headers are inline with the data in the same file.
+- detached: headers are in a separate header file from the data.
+
+The inline method is the standard version. When a detached header is
+used, the headers are simply inserted back-to-back in the detached
+header file. The dat file, then, is the standard raw binary format
+with no interruptions in the data.
+
+
+\subsection updating Updating Headers
+
+While there is always a header that starts a metadata file, they are
+updated throughout as well. There are two events that trigger a new
+header. We define a segment as the unit of data associated with the
+last header.
+
+The first event that will trigger a new header is when enough samples
+have been written for the given segment. This number is defined as the
+maximum segment size and is a parameter we pass to the
+file_meta_sink. It defaults to 1 million items (items, not
+bytes). When that number of items is reached, a new header is
+generated and a new segment is started. This makes it easier for us to
+manipulate the data later and helps protect against catastrophic data
+loss.
+
+The second event to trigger a new segment is if a new tag is
+observed. If the tag is a standard tag in the header, the header value
+is updated, the header and current extras are written to file, and the
+segment begins again. If a tag from the extras is seen, the value
+associated with that tag is updated; and if a new tag is seen, a new
+key:value pair are added to the extras dictionary.
+
+When new tags are seen, we generate a new segment so that we make sure
+that all samples in that segment are defined by the header. If the
+sample rate changes, we create a new segment where all of the new
+samples are at that new rate. Also, in the case of UHD devices, if a
+segment loss is observed, it will generate a new timestamp as a tag of
+'rx_time'. We create a new file segment that reflects this change to
+keep the sample times exact.
+
+
+\subsection implementation Implementation
+
+Metadata files are created using gr::blocks::file_meta_sink. The
+default behavior is to create a single file with inline headers as
+metadata. An option can be set to switch to detached header mode.
+
+Metadata file are read into a flowgraph using
+gr::blocks::file_meta_source. This source reads a metadata file,
+inline by default with a settable option to use detached headers. The
+data from the segments is converted into a standard streaming
+output. The 'rx_rate' and 'rx_time' and all key:value pairs in the
+extra header are converted into tags and added to the stream tags
+interface.
+
+
+\section structure Structure
+
+The file metadata consists of a static mandatory header and a dynamic
+optional extras header. Each header is a separate PMT
+dictionary. Headers are created by building a PMT dictionary
+(pmt::pmt_make_dict) of key:value pairs, then the dictionary is
+serialized into a string to be written to file. The header is always
+the same length that is predetermined by the version of the header
+(this must be known already). The header will then indicate if there
+is an extra data to be extracted as a separate serialized dictionary.
+
+To work with the PMTs for creating and extracting header information,
+we use PMT operators. For example, we create a simplified version of
+the header in C++ like this:
+
+\code
+ using namespace pmt;
+ const char METADATA_VERSION = 0x0;
+ pmt_t header;
+ header = pmt_make_dict();
+ header = pmt_dict_add(header, mp("version"), mp(METADATA_VERSION));
+ header = pmt_dict_add(header, mp("rx_rate"), mp(samp_rate));
+ std::string hdr_str = pmt_serialize_str(header);
+\endcode
+
+The call to pmt::pmt_dict_add adds a new key:value pair to the
+dictionary. Notice that it both takes and returns the 'header'
+variable. This is because we are actually creating a new dictionary
+with this function, so we just assign it to the same variable.
+
+The 'mp' functions are convenience functions provided by the PMT
+library. They interpret the data type of the value being inserted and
+call the correct 'pmt_from_xxx' function. For more direct control over
+the data type, see PMT functions in pmt.h, such as
+pmt::pmt_from_uint64 or pmt::pmt_from_double.
+
+We finish this off by using pmt::pmt_serialize_str to convert the PMT
+dictionary into a specialized string format that makes it easy to
+write to a file.
+
+The header is always METADATA_HEADER_SIZE bytes long and a metadata
+file always starts with a header. So to extract the header from a
+file, we need to read in this many bytes from the beginning of the
+file and deserialize it. An important note about this is that the
+deserialize function must operate on a std::string. The serialized
+format of a dictionary contains null characters, so normal C character
+arrays (e.g., 'char *s') get confused.
+
+Assuming that 'std::string str' contains the full string as read from
+a file, we can access the dictionary in C++ like this:
+
+\code
+ pmt_t hdr = pmt_deserialize_str(str);
+ if(pmt_dict_has_key(hdr, pmt_string_to_symbol("strt"))) {
+ pmt_t r = pmt_dict_ref(hdr, pmt_string_to_symbol("strt"), PMT_NIL);
+ uint64_t seg_start = pmt_to_uint64(r);
+ uint64_t extra_len = seg_start - METADATA_HEADER_SIZE;
+ }
+\endcode
+
+This example first deserializes the string into a PMT dictionary
+again. This will throw an error if the string is malformed and cannot
+be deserialized correctly. We then want to get access to the item with
+key 'strt'. As the next subsection will show, this value indicates at
+which byte the data segment starts. We first check to make sure that
+this key exists in the dictionary. If not, our header does not contain
+the correct information and we might want to handle this as an error.
+
+Assuming the header is properly formatted, we then get the particular
+item referenced by the key 'strt'. This is a uint64_t, so we use the
+PMT function to extract and convert this value properly. We now know
+if we have an extra header in the file by looking at the difference
+between 'seg_start' and the static header size,
+METADATA_HEADER_SIZE. If the 'extra_len' is greater than 0, we know we
+have an extra header that we can process. Moreover, this also tells us
+the size of the serialized PMT dictionary in bytes, so we can easily
+read this many bytes from the file. We can then deserialize and parse
+this header just like the first.
+
+
+\subsection header Header Information
+
+The header is a PMT dictionary with a known structure. This structure
+may change, but we version the headers, so all headers of version X
+must be the same length and structure. As of now, we only have version
+0 headers, which look like the following:
+
+- version: (char) version number (usually set to METADATA_VERSION)
+- rx_rate: (double) Stream's sample rate
+- rx_time: (pmt::pmt_t pair - (uint64_t, double)) Time stamp (format from UHD)
+- size: (int) item size in bytes - reflects vector length if any.
+- type: (int) data type (enum below)
+- cplx: (bool) true if data is complex
+- strt: (uint64_t) start of data relative to current header
+- bytes: (uint64_t) size of following data segment in bytes
+
+The data types are indicated by an integer value from the following
+enumeration type:
+
+\code
+enum gr_file_types {
+ GR_FILE_BYTE=0,
+ GR_FILE_CHAR=0,
+ GR_FILE_SHORT=1,
+ GR_FILE_INT,
+ GR_FILE_LONG,
+ GR_FILE_LONG_LONG,
+ GR_FILE_FLOAT,
+ GR_FILE_DOUBLE,
+};
+\endcode
+
+\subsection extras Extras Information
+
+The extras section is an optional segment of the header. If 'strt' ==
+METADATA_HEADER_SIZE, then there is no extras. Otherwise, it is simply
+a PMT dictionary of key:value pairs. The extras header can contain
+anything and can grow while a program is running.
+
+We can insert extra data into the header at the beginning if we
+wish. All we need to do is use the pmt::pmt_dict_add function to insert
+our hand-made metadata. This can be useful to add our own markers and
+information.
+
+The main role of the extras header, though, is as a container to hold
+any stream tags. When a stream tag is observed coming in, the tag's
+key and value are added to the dictionary. Like a standard dictionary,
+any time a key already exists, the value will be updated. If the key
+does not exist, a new entry is created and the new key:value pair are
+added together. So any new tags that the file metadata sink sees will
+add to the dictionary. It is therefore important to always check the
+'strt' value of the header to see if the length of the extras
+dictionary has changed at all.
+
+When reading out data from the extras, we do not necessarily know the
+data type of the PMT value. The key is always a PMT symbol, but the
+value can be any other PMT type. There are PMT functions that allow us
+to query the PMT to test if it is a particular type. We also have the
+ability to do pmt::pmt_print on any PMT object to print it to
+screen. Before converting from a PMT to it's natural data type, it is
+necessary to know the data type.
+
+
+\section Utilities
+
+GNU Radio comes with a couple of utilities to help in debugging and
+manipulating metadata files. There is a general parser in Python that
+will convert the PMT header and extra header into Python
+dictionaries. This utility is:
+
+- gr-blocks/python/parse_file_metadata.py
+
+This program is installed into the Python directory under the
+'gnuradio' module, so it can be accessed with:
+
+\code
+from gnuradio.blocks import parse_file_metadata
+\endcode
+
+It defines HEADER_LENGTH as the static length of the metadata header
+size. It also has dictionaries that can be used to convert from the
+file type to a string (ftype_to_string) and one to convert from the
+file type to the size of the data type in bytes (ftype_to_size).
+
+The 'parse_header' takes in a PMT dictionary, parses it, and returns a
+Python dictionary. An optional 'VERBOSE' bool can be set to print the
+information to standard out.
+
+The 'parse_extra_dict' is similar in that it converts from a PMT
+dictionary to a Python dictionary. The values are kept in their PMT
+format since we do not necessarily know the native data type.
+
+A program called 'gr_read_file_metadata' is installed into the path
+and can be used to read out all header information from a metadata
+file. This program is just called with the file name as the first
+command-line argument. An option '-D' will handle detached header
+files where the file of headers is expected to be the file name of the
+data with '.hdr' appended to it.
+
+
+\section Examples
+
+Examples are located in:
+
+- gr-blocks/examples/metadata
+
+Currently, there are a few GRC example programs.
+
+- file_metadata_sink: create a metadata file from UHD samples.
+- file_metadata_source: read the metadata file as input to a simple graph.
+- file_metadata_vector_sink: create a metadata file from UHD samples.
+- file_metadata_vector_source: read the metadata file as input to a simple graph.
+
+The file sink example can be switched to use a signal source instead
+of a UHD source, but no extra tagged data is used in this mode.
+
+The file source example pushes the data stream to a new raw file while
+a tag debugger block prints out any tags observed in the metadata
+file. A QT GUI time sink is used to look at the signal as well.
+
+The versions with 'vector' in the name are similar except they use
+vectors of data.
+
+The following shows a simple way of creating extra metadata for a
+metadata file. This example is just showing how we can insert a date
+into the metadata to keep track of later. The date in this case is
+encoded as a vector of uint16 with [day, month, year].
+
+\code
+ from gruel import pmt
+ from gnuradio import blocks
+
+ key = pmt.pmt_intern("date")
+ val = pmt.pmt_init_u16vector(3, [13,12,2012])
+
+ extras = pmt.pmt_make_dict()
+ extras = pmt.pmt_dict_add(extras, key, val)
+ extras_str = pmt.pmt_serialize_str(extras)
+ self.sink = blocks.file_meta_sink(gr.sizeof_gr_complex,
+ "/tmp/metadat_file.out",
+ samp_rate, 1,
+ blocks.GR_FILE_FLOAT, True,
+ 1000000, extra_str, False)
+
+\endcode
+
+*/
diff --git a/docs/doxygen/other/msg_passing.dox b/docs/doxygen/other/msg_passing.dox
new file mode 100644
index 000000000..aea0ac94a
--- /dev/null
+++ b/docs/doxygen/other/msg_passing.dox
@@ -0,0 +1,269 @@
+/*! \page page_msg_passing Message Passing
+
+\section intro Introduction
+
+GNU Radio was originally a streaming system with no other mechanism to
+pass data between blocks. Streams of data are a model that work well
+for samples, bits, etc., but are not really the right mechanism for
+control data, metadata, and, often, packet structures (at least at
+some point in the processing chain).
+
+We solved part of this problem a few years ago by introducing the tag
+stream. This is a parallel stream to the data streaming. The
+difference is that tags are designed to hold metadata and control
+information. Tags are specifically associated with a particular sample
+in the data stream and flow downstream alongside the data. This model
+allows other blocks to identify that an event or action has occurred
+or should occur on a particular item. The major limitation is that the
+tag stream is really only accessible inside a work function and only
+flows in one direction. Its benefit is that it is isosynchronous with
+the data.
+
+We want a more general message passing system for a couple of
+reasons. The first is to allow blocks downstream to communicate back
+to blocks upstream. The second is to allow an easier way for us to
+communicate back and forth between external applications and GNU
+Radio. The new message passing interface handles these cases, although
+it does so on an asynchronous basis.
+
+The message passing interface heavily relies on Polymorphic Types
+(PMTs) in GNU Radio. For further information about these data
+structures, see the page \ref page_pmt.
+
+\section api Message Passing API
+
+The message passing interface is designed into the gr_basic_block,
+which is the parent class for all blocks in GNU Radio. Each block has
+a set of message queues to hold incoming messages and can post
+messages to the message queues of other blocks. The blocks also
+distinguish between input and output ports.
+
+A block has to declare its input and output message ports in its
+constructor. The message ports are described by a name, which is in
+practice a PMT symbol (<em>i.e.</em>, an interned string). The API calls
+to register a new port are:
+
+\code
+ void message_port_register_in(pmt::pmt_t port_id)
+ void message_port_register_out(pmt::pmt_t port_id)
+\endcode
+
+The ports are now identifiable by that port name. Other blocks who may
+want to post or receive messages on a port must subscribe to it. When
+a block has a message to send, they are published on a particular
+port. The subscribe and publish API looks like:
+
+\code
+ void message_port_pub(pmt::pmt_t port_id,
+ pmt::pmt_t msg);
+ void message_port_sub(pmt::pmt_t port_id,
+ pmt::pmt_t target);
+ void message_port_unsub(pmt::pmt_t port_id,
+ pmt::pmt_t target);
+\endcode
+
+Any block that has a subscription to another block's output message
+port will receive the message when it is published. Internally, when a
+block publishes a message, it simply iterates through all blocks that
+have subscribed and uses the gr_basic_block::_post method to send the
+message to that block's message queue.
+
+From the flowgraph level, we have instrumented a gr_hier_block2::msg_connect
+method to make it easy to subscribe blocks to other blocks'
+messages. The message connection method looks like the following
+code. Assume that the block \b src has an output message port named
+\a pdus and the block \b dbg has an input port named \a print.
+
+\code
+ self.tb.msg_connect(src, "pdus", dbg, "print")
+\endcode
+
+All messages published by the \b src block on port \a pdus will be
+received by \b dbg on port \a print. Note here how we are just using
+strings to define the ports, not PMT symbols. This is a convenience to
+the user to be able to more easily type in the port names (for
+reference, you can create a PMT symbol in Python using the
+pmt::pmt_intern function as pmt.pmt_intern("string")).
+
+Users can also query blocks for the names of their input and output
+ports using the following API calls:
+
+\code
+ pmt::pmt_t message_ports_in();
+ pmt::pmt_t message_ports_out();
+\endcode
+
+The return value for these are a PMT vector filled with PMT symbols,
+so PMT operators must be used to manipulate them.
+
+Each block has internal methods to handle posting and receiving of
+messages. The gr_basic_block::_post method takes in a message and
+places it into its queue. The publishing model uses the
+gr_basic_block::_post method of the blocks as the way to access the
+message queue. So the message queue of the right name will have a new
+message. Posting messages also has the benefit of waking up the
+block's thread if it is in a wait state. So if idle, as soon as a
+message is posted, it will wake up and and call the message handler.
+
+The other side of the action in a block is in the message
+handler. When a block has an input message port, it needs a callback
+function to handle messages received on that port. We use a Boost bind
+operator to bind the message port to the message handling
+function. When a new message is pushed onto a port's message queue,
+it is this function that is used to process the message.
+
+
+\section examples Code Examples
+
+The following is snippets of code from blocks current in GNU Radio
+that take advantage of message passing. We will be using
+gr_message_debug and gr_tagged_stream_to_pdu below to show setting up
+both input and output message passing capabilities.
+
+The gr_message_debug block is used for debugging the message passing
+system. It describes two input message ports: \a print and \a
+store. The \a print port simply prints out all messages to standard
+out while the \a store port keeps a list of all messages posted to
+it. This latter port works in conjunction with a
+gr_message_debug::get_message(int i) call that allows us to retrieve
+message \p i afterward.
+
+The constructor of this block looks like this:
+
+\code
+{
+ message_port_register_in(pmt::mp("print"));
+ set_msg_handler(pmt::mp("print"),
+ boost::bind(&gr_message_debug::print, this, _1));
+
+ message_port_register_in(pmt::mp("store"));
+ set_msg_handler(pmt::mp("store"),
+ boost::bind(&gr_message_debug::store, this, _1));
+}
+\endcode
+
+So the two ports are registered by their respective names. We then use
+the gr_basic_block::set_msg_handler function to identify this
+particular port name with a callback function. The Boost \a bind
+function (<a target="_blank"
+href="http://www.boost.org/doc/libs/1_52_0/libs/bind/bind.html">Boost::bind</a>)
+here binds the callback to a function of this block's class. So now
+the block's gr_message_debug::print and gr_message_debug::store
+functions are assigned to handle messages passed to them. Below is the
+\a print function for reference.
+
+\code
+void
+gr_message_debug::print(pmt::pmt_t msg)
+{
+ std::cout << "***** MESSAGE DEBUG PRINT ********\n";
+ pmt::pmt_print(msg);
+ std::cout << "**********************************\n";
+}
+\endcode
+
+The function simply takes in the PMT message and prints it. The method
+pmt::pmt_print is a function in the PMT library to print the
+PMT in a friendly, (mostly) pretty manner.
+
+The gr_tagged_stream_to_pdu block only defines a single
+output message port. In this case, its constructor looks like:
+
+\code
+{
+ message_port_register_out(pdu_port_id);
+}
+\endcode
+
+So we are only creating a single output port where \a pdu_port_id
+is defined in the file gr_pdu.h as \a pdus.
+
+This blocks purpose is to take in a stream of samples along with
+stream tags and construct a predefined PDU message from this. In GNU
+Radio, we define a PDU as a PMT pair of (metadata, data). The metadata
+describes the samples found in the data portion of the
+pair. Specifically, the metadata can contain the length of the data
+segment and any other information (sample rate, etc.). The PMT vectors
+know their own length, so the length value is not actually necessary
+unless useful for purposes down the line. The metadata is a PMT
+dictionary while the data segment is a PMT uniform vector of either
+bytes, floats, or complex values.
+
+In the end, when a PDU message is ready, the block calls its
+gr_tagged_stream_to_pdu::send_message function that is shown below.
+
+\code
+void
+gr_tagged_stream_to_pdu::send_meassage()
+{
+ if(pmt::pmt_length(d_pdu_vector) != d_pdu_length) {
+ throw std::runtime_error("msg length not correct");
+ }
+
+ pmt::pmt_t msg = pmt::pmt_cons(d_pdu_meta,
+ d_pdu_vector);
+ message_port_pub(pdu_port_id, msg);
+
+ d_pdu_meta = pmt::PMT_NIL;
+ d_pdu_vector = pmt::PMT_NIL;
+ d_pdu_length = 0;
+ d_pdu_remain = 0;
+ d_inpdu = false;
+}
+\endcode
+
+This function does a bit of checking to make sure the PDU is ok as
+well as some cleanup in the end. But it is the line where the message
+is published that is important to this discussion. Here, the block
+posts the PDU message to any subscribers by calling
+gr_basic_block::message_port_pub publishing method.
+
+There is similarly a gr_pdu_to_tagged_stream block that essentially
+does the opposite. It acts as a source to a flowgraph and waits for
+PDU messages to be posted to it on its input port \a pdus. It extracts
+the metadata and data and processes them. The metadata dictionary is
+split up into key:value pairs and stream tags are created out of
+them. The data is then converted into an output stream of items and
+passed along. The next section describes how PDUs can be passed into a
+flowgraph using the gr_pdu_to_tagged_stream block.
+
+\section posting Posting from External Sources
+
+The last feature of the message passing architecture to discuss here
+is how it can be used to take in messages from an external source. We
+can call a block's gr_basic_block::_post method directly and pass it a
+message. So any block with an input message port can receive messages
+from the outside in this way.
+
+The following example uses a gr_pdu_to_tagged_stream block
+as the source block to a flowgraph. Its purpose is to wait for
+messages as PDUs posted to it and convert them to a normal stream. The
+payload will be sent on as a normal stream while the meta data will be
+decoded into tags and sent on the tagged stream.
+
+So if we have created a \b src block as a PDU to stream, it has a \a
+pdus input port, which is how we will inject PDU messages to the
+flowgraph. These PDUs could come from another block or flowgraph, but
+here, we will create and insert them by hand.
+
+\code
+ port = pmt.pmt_intern("pdus")
+ msg = pmt.pmt_cons(pmt.PMT_NIL,
+ pmt.pmt_make_u8vector(16, 0xFF))
+ src.to_basic_block()._post(port, msg)
+\endcode
+
+The PDU's metadata section is empty, hence the pmt::PMT_NIL
+object. The payload is now just a simple vector of 16 bytes of all
+1's. To post the message, we have to access the block's gr_basic_block
+class, which we do using the gr_basic_block::to_basic_block method and
+then call the gr_basic_block::_post method to pass the PDU to the
+right port.
+
+All of these mechanisms are explored and tested in the QA code of the
+file qa_pdu.py.
+
+There are some examples of using the message passing infrastructure
+through GRC in gnuradio-core/src/examples/msg_passing.
+
+*/
diff --git a/docs/doxygen/other/pfb_intro.dox b/docs/doxygen/other/pfb_intro.dox
new file mode 100644
index 000000000..01d08b0fa
--- /dev/null
+++ b/docs/doxygen/other/pfb_intro.dox
@@ -0,0 +1,96 @@
+/*! \page page_pfb Polyphase Filterbanks
+
+\section Introduction
+
+Polyphase filterbanks (PFB) are a very powerful set of filtering tools
+that can efficiently perform many multi-rate signal processing
+tasks. GNU Radio has a set of polyphase filterbank blocks to be used
+in all sorts of applications. These blocks and their documentation can
+be found in \ref pfb_blk.
+
+\section Usage
+
+See the documentation for the individual blocks for details about what
+they can do and how they should be used. Furthermore, there are
+examples for these blocks in <b>gnuradio-examples/python/pfb</b>.
+
+The main issue when using the PFB blocks is defining the prototype
+filter, which is passed to all of the blocks as a vector of \p
+taps. The taps from the prototype filter which get partitioned among
+the \p N channels of the channelizer.
+
+An example of creating a set of filter taps for a PFB channelizer is
+found on line 49 of <b>gnuradio-examples/python/pfb/channelizer.py</b>
+and reproduced below. Notice that the sample rate is the sample rate
+at the input to the channelizer while the bandwidth and transition
+width are defined for the channel bandwidths. This makes a fairly long
+filter that is then split up between the \p N channels of the PFB.
+
+\code
+ self._fs = 9000 # input sample rate
+ self._M = 9 # Number of channels to channelize
+
+ self._taps = gr.firdes.low_pass_2(1, self._fs, 475.50, 50,
+ attenuation_dB=100,
+ window=gr.firdes.WIN_BLACKMAN_hARRIS)
+\endcode
+
+In this example, the signal into the channelizer is sampled at 9 ksps
+(complex, so 9 kHz of bandwidth). The filter uses 9 channels, so each
+output channel will have a bandwidth and sample rate of 1 kHz. We want
+to pass most of the channel, so we define the channel bandwidth to be
+a low pass filter with a bandwidth of 475.5 Hz and a transition
+bandwidth of 50 Hz, but we have defined this using a sample rate of
+the original 9 kHz. The prototype filter has 819 taps to be divided up
+between the 9 channels, so each channel uses 91 taps. This is probably
+over-kill for a channelizer, and we could reduce the amount of taps
+per channel to a couple of dozen with no ill effects.
+
+The basic rule when defining a set of taps for a PFB block is to think
+about the filter running at the highest rate it will see while the
+bandwidth is defined for the size of the channels. In the channelizer
+case, the highest rate is defined as the rate of the incoming signal,
+but in other PFB blocks, this is not so obvious.
+
+Two very useful blocks to use are the arbitrary resampler and the
+clock synchronizer (for PAM signals). These PFBs are defined with a
+set number of filters based on the fidelity required from them, not
+the rate changes. By default, the \p filter_size is set to 32 for
+these blocks, which is a reasonable default for most tasks. Because
+the PFB uses this number of filters in the filterbank, the maximum
+rate of the bank is defined from this (see the theory of a polyphase
+interpolator for a justification of this). So the prototype filter is
+defined to use a sample rate of \p filter_size times the signal's
+sampling rate.
+
+A helpful wrapper for the arbitrary resampler is found in
+<b>gnuradio-core/src/python/gnuradio/blks2impl/pfb_arb_resampler.py</b>,
+which is exposed in Python as <b>blks2.pfb_arb_resampler_ccf</b> and
+<b>blks2.pfb_arb_resampler_fff</b>. This block is set up so that the
+user only needs to pass it the real number \p rate as the resampling
+rate. With just this information, this hierarchical block
+automatically creates a filter that fully passes the signal bandwidth
+being resampled but does not pass any out-of-band noise. See the code
+for this block for details of how the filter is constructed.
+
+Of course, a user can create his or her own taps and use them in the
+arbitrary resampler for more specific requirements. Some of the UHD
+examples (<b>gr-uhd/examples</b>) use this ability to create a
+received matched filter or channel filter that also resamples the
+signal.
+
+\section Examples
+
+The following is an example of the using the channelizer. It creates
+the appropriate filter to channelizer 9 channels out of an original
+signal that is 9000 Hz wide, so each output channel is now 1000
+Hz. The code then plots the PSD of the original signal to see the
+signals in the origina spectrum and then makes 9 plots for each of the
+channels.
+
+NOTE: you need the Scipy and Matplotlib Python modules installed to
+run this example.
+
+\include gnuradio-core/src/examples/pfb/channelize.py
+
+*/
diff --git a/docs/doxygen/other/pmt.dox b/docs/doxygen/other/pmt.dox
new file mode 100644
index 000000000..61b73bca1
--- /dev/null
+++ b/docs/doxygen/other/pmt.dox
@@ -0,0 +1,348 @@
+/*! \page page_pmt Polymorphic Types
+
+\section intro Introduction
+
+Polymorphic Types are opaque data types that are designed as generic
+containers of data that can be safely passed around between blocks and
+threads in GNU Radio. They are heavily used in the stream tags and
+message passing interfaces. The most complete list of PMT function is,
+of course, the source code, specifically the header file pmt.h. This
+manual page summarizes the most important features and points of PMTs.
+
+
+\section datatype PMT Data Type
+
+All PMTs are of the type pmt::pmt_t. This is an opaque container and
+PMT functions must be used to manipulate and even do things like
+compare PMTs. PMTs are also \a immutable (except PMT vectors). We
+never change the data in a PMT; instead, we create a new PMT with the
+new data. The main reason for this is thread safety. We can pass PMTs
+as tags and messages between blocks and each receives its own copy
+that we can read from. However, we can never write to this object, and
+so if multiple blocks have a reference to the same PMT, there is no
+possibility of thread-safety issues of one reading the PMT data while
+another is writing the data. If a block is trying to write new data to
+a PMT, it actually creates a new PMT to put the data into. Thus we
+allow easy access to data in the PMT format without worrying about
+mutex locking and unlocking while manipulating them.
+
+PMTs can represent the following:
+
+- Boolean values of true/false
+- Strings (as symbols)
+- Integers (long and uint64)
+- Floats (as doubles)
+- Complex (as two doubles)
+- Pairs
+- Tuples
+- Vectors (of PMTs)
+- Uniform vectors (of any standard data type)
+- Dictionaries (list of key:value pairs)
+- Any (contains a boost::any pointer to hold anything)
+
+The PMT library also defines a set of functions that operate directly
+on PMTs such as:
+
+- Equal/equivalence between PMTs
+- Length (of a tuple or vector)
+- Map (apply a function to all elements in the PMT)
+- Reverse
+- Get a PMT at a position in a list
+- Serialize and deserialize
+- Printing
+
+The constants in the PMT library are:
+
+- pmt::PMT_T - a PMT True
+- pmt::PMT_F - a PMT False
+- pmt::PMT_NIL - an empty PMT (think Python's 'None')
+
+\section insert Inserting and Extracting Data
+
+Use pmt.h for a complete guide to the list of functions used to create
+PMTs and get the data from a PMT. When using these functions, remember
+that while PMTs are opaque and designed to hold any data, the data
+underneath is still a C++ typed object, and so the right type of
+set/get function must be used for the data type.
+
+Typically, a PMT object can be made from a scalar item using a call
+like "pmt::pmt_from_<type>". Similarly, when getting data out of a
+PMT, we use a call like "pmt::pmt_to_<type>". For example:
+
+\code
+double a = 1.2345;
+pmt::pmt_t pmt_a = pmt::pmt_from_double(a);
+double b = pmt::pmt_to_double(pmt_a);
+
+int c = 12345;
+pmt::pmt_t pmt_c = pmt::pmt_from_long(c);
+int d = pmt::pmt_to_long(pmt_c);
+\endcode
+
+As a side-note, making a PMT from a complex number is not obvious:
+
+\code
+std::complex<double> a(1.2, 3.4);
+pmt::pmt_t pmt_a = pmt::pmt_make_rectangular(a.real(), b.imag());
+std::complex<double> b = pmt::pmt_to_complex(pmt_a);
+\endcode
+
+Pairs, dictionaries, and vectors have different constructors and ways
+to manipulate them, and these are explained in their own sections.
+
+
+\section strings Strings
+
+PMTs have a way of representing short strings. These strings are
+actually stored as interned symbols in a hash table, so in other
+words, only one PMT object for a given string exists. If creating a
+new symbol from a string, if that string already exists in the hash
+table, the constructor will return a reference to the existing PMT.
+
+We create strings with the following functions, where the second
+function, pmt::pmt_intern, is simply an alias of the first.
+
+\code
+pmt::pmt_t str0 = pmt::pmt_string_to_symbol(std::string("some string"));
+pmt::pmt_t str1 = pmt::pmt_intern(std::string("some string"));
+\endcode
+
+The string can be retrieved using the inverse function:
+
+\code
+std::string s = pmt::pmt_symbol_to_string(str0);
+\endcode
+
+
+\section tests Tests and Comparisons
+
+The PMT library comes with a number of functions to test and compare
+PMT objects. In general, for any PMT data type, there is an equivalent
+"pmt::pmt_is_<type>". We can use these to test the PMT before trying
+to access the data inside. Expanding our examples above, we have:
+
+\code
+pmt::pmt_t str0 = pmt::pmt_string_to_symbol(std::string("some string"));
+if(pmt::pmt_is_symbol(str0))
+ std::string s = pmt::pmt_symbol_to_string(str0);
+
+double a = 1.2345;
+pmt::pmt_t pmt_a = pmt::pmt_from_double(a);
+if(pmt::pmt_is_double(pmt_a))
+ double b = pmt::pmt_to_double(pmt_a);
+
+int c = 12345;
+pmt::pmt_t pmt_c = pmt::pmt_from_long(c);
+if(pmt::pmt_is_long(pmt_a))
+ int d = pmt::pmt_to_long(pmt_c);
+
+\\ This will fail the test. Otherwise, trying to coerce \b pmt_c as a
+\\ double when internally it is a long will result in an exception.
+if(pmt::pmt_is_double(pmt_a))
+ double d = pmt::pmt_to_double(pmt_c);
+
+\endcode
+
+
+\section dict Dictionaries
+
+PMT dictionaries and lists of key:value pairs. They have a
+well-defined interface for creating, adding, removing, and accessing
+items in the dictionary. Note that every operation that changes the
+dictionary both takes a PMT dictionary as an argument and returns a
+PMT dictionary. The dictionary used as an input is not changed and the
+returned dictionary is a new PMT with the changes made there.
+
+The following is a list of PMT dictionary functions. Click through to
+get more information on what each does.
+
+- bool pmt::pmt_is_dict(const pmt_t &obj)
+- pmt_t pmt::pmt_make_dict()
+- pmt_t pmt::pmt_dict_add(const pmt_t &dict, const pmt_t &key, const pmt_t &value)
+- pmt_t pmt::pmt_dict_delete(const pmt_t &dict, const pmt_t &key)
+- bool pmt::pmt_dict_has_key(const pmt_t &dict, const pmt_t &key)
+- pmt_t pmt::pmt_dict_ref(const pmt_t &dict, const pmt_t &key, const pmt_t &not_found)
+- pmt_t pmt::pmt_dict_items(pmt_t dict)
+- pmt_t pmt::pmt_dict_keys(pmt_t dict)
+- pmt_t pmt::pmt_dict_values(pmt_t dict)
+
+This example does some basic manipulations of PMT dictionaries in
+Python. Notice that we pass the dictionary \a a and return the results
+to \a a. This still creates a new dictionary and removes the local
+reference to the old dictionary. This just keeps our number of
+variables small.
+
+\code
+from gruel import pmt
+
+key0 = pmt.pmt_intern("int")
+val0 = pmt.pmt_from_long(123)
+val1 = pmt.pmt_from_long(234)
+
+key1 = pmt.pmt_intern("double")
+val2 = pmt.pmt_from_double(5.4321)
+
+# Make an empty dictionary
+a = pmt.pmt_make_dict()
+
+# Add a key:value pair to the dictionary
+a = pmt.pmt_dict_add(a, key0, val0)
+pmt.pmt_print(a)
+
+# Add a new value to the same key;
+# new dict will still have one item with new value
+a = pmt.pmt_dict_add(a, key0, val1)
+pmt.pmt_print(a)
+
+# Add a new key:value pair
+a = pmt.pmt_dict_add(a, key1, val2)
+pmt.pmt_print(a)
+
+# Test if we have a key, then delete it
+print pmt.pmt_dict_has_key(a, key1)
+a = pmt.pmt_dict_delete(a, key1)
+print pmt.pmt_dict_has_key(a, key1)
+
+ref = pmt.pmt_dict_ref(a, key0, pmt.PMT_NIL)
+pmt.pmt_print(ref)
+
+# The following should never print
+if(pmt.pmt_dict_has_key(a, key0) and pmt.pmt_eq(ref, pmt.PMT_NIL)):
+ print "Trouble! We have key0, but it returned PMT_NIL"
+\endcode
+
+\section vectors Vectors
+
+PMT vectors come in two forms: vectors of PMTs and vectors of uniform
+data. The standard PMT vector is a vector of PMTs, and each PMT can be
+of any internal type. On the other hand, uniform PMTs are of a
+specific data type which come in the form:
+
+- (u)int8
+- (u)int16
+- (u)int32
+- (u)int64
+- float32
+- float64
+- complex 32 (std::complex<float>)
+- complex 64 (std::complex<double>)
+
+That is, the standard sizes of integers, floats, and complex types of
+both signed and unsigned.
+
+Vectors have a well-defined interface that allows us to make, set,
+get, and fill them. We can also get the length of a vector with
+pmt::pmt_length.
+
+For standard vectors, these functions look like:
+
+- bool pmt::pmt_is_vector(pmt_t x)
+- pmt_t pmt::pmt_make_vector(size_t k, pmt_t fill)
+- pmt_t pmt::pmt_vector_ref(pmt_t vector, size_t k)
+- void pmt::pmt_vector_set(pmt_t vector, size_t k, pmt_t obj)
+- void pmt::pmt_vector_fill(pmt_t vector, pmt_t fill)
+
+Uniform vectors have the same types of functions, but they are data
+type-dependent. The following list tries to explain them where you
+substitute the specific data type prefix for \a dtype (prefixes being:
+u8, u16, u32, u64, s8, s16, s32, s64, f32, f64, c32, c64).
+
+- bool pmt::pmt_is_(dtype)vector(pmt_t x)
+- pmt_t pmt::pmt_make_(dtype)vector(size_t k, (dtype) fill)
+- pmt_t pmt::pmt_init_(dtype)vector(size_t k, const (dtype*) data)
+- pmt_t pmt::pmt_init_(dtype)vector(size_t k, const std::vector<dtype> data)
+- pmt_t pmt::pmt_(dtype)vector_ref(pmt_t vector, size_t k)
+- void pmt::pmt_(dtype)vector_set(pmt_t vector, size_t k, (dtype) x)
+- const dtype* pmt::pmt_(dtype)vector_elements(pmt_t vector, size_t &len)
+- dtype* pmt::pmt_(dtype)vector_writable_elements(pmt_t vector, size_t &len)
+
+\b Note: We break the contract with vectors. The 'set' functions
+actually change the data underneath. It is important to keep track of
+the implications of setting a new value as well as accessing the
+'vector_writable_elements' data. Since these are mostly standard data
+types, sets and gets are atomic, so it is unlikely to cause a great
+deal of harm. But it's only unlikely, not impossible. Best to use
+mutexes whenever manipulating data in a vector.
+
+
+\subsection blob BLOB
+
+A BLOB is a 'binary large object' type. In PMT's, this is actually
+just a thin wrapper around a u8vector.
+
+\section pairs Pairs
+
+Pairs are inspired by LISP 'cons' data types, so you will find the
+language here comes from LISP. A pair is just a pair of PMT
+objects. They are manipulated using the following functions:
+
+- bool pmt::pmt_is_pair (const pmt_t &obj): Return true if obj is a pair, else false
+- pmt_t pmt::pmt_cons(const pmt_t &x, const pmt_t &y): construct new pair
+- pmt_t pmt::pmt_car(const pmt_t &pair): get the car of the pair (first object)
+- pmt_t pmt::pmt_cdr(const pmt_t &pair): get the cdr of the pair (second object)
+- void pmt::pmt_set_car(pmt_t pair, pmt_t value): Stores value in the car field
+- void pmt::pmt_set_cdr(pmt_t pair, pmt_t value): Stores value in the cdr field
+
+
+\section serdes Serializing and Deserializing
+
+It is often important to hide the fact that we are working with PMTs
+to make them easier to transmit, store, write to file, etc. The PMT
+library has methods to serialize data into a string buffer or a
+string and then methods to deserialize the string buffer or string
+back into a PMT. We use this extensively in the metadata files (see
+\ref page_metadata).
+
+- bool pmt::pmt_serialize(pmt_t obj, std::streambuf &sink)
+- std::string pmt::pmt_serialize_str(pmt_t obj)
+- pmt_t pmt::pmt_deserialize(std::streambuf &source)
+- pmt_t pmt::pmt_deserialize_str(std::string str)
+
+For example, we will serialize the data above to make it into a string
+ready to be written to a file and then deserialize it back to its
+original PMT.
+
+\code
+from gruel import pmt
+
+key0 = pmt.pmt_intern("int")
+val0 = pmt.pmt_from_long(123)
+
+key1 = pmt.pmt_intern("double")
+val1 = pmt.pmt_from_double(5.4321)
+
+# Make an empty dictionary
+a = pmt.pmt_make_dict()
+
+# Add a key:value pair to the dictionary
+a = pmt.pmt_dict_add(a, key0, val0)
+a = pmt.pmt_dict_add(a, key1, val1)
+
+pmt.pmt_print(a)
+
+ser_str = pmt.pmt_serialize_str(a)
+print ser_str
+
+b = pmt.pmt_deserialize_str(ser_str)
+pmt.pmt_print(b)
+
+\endcode
+
+The line where we 'print ser_str' will print and parts will be
+readable, but the point of serializing is not to make a human-readable
+string. This is only done here as a test.
+
+
+\section printing Printing
+
+We have used the pmt::pmt_print function in these examples to nicely
+print the contents of a PMT. Another way to print the contents is
+using the overloaded "<<" operator with a stream buffer object. In
+C++, we can inline print the contents of a PMT like:
+
+\code
+pmt::pmt_t a pmt::pmt_from_double(1.0);
+std::cout << "The PMT a contains " << a << std::endl;
+\endcode
+
+*/
diff --git a/docs/doxygen/other/shared_ptr_docstub.h b/docs/doxygen/other/shared_ptr_docstub.h
new file mode 100755
index 000000000..428dd03f1
--- /dev/null
+++ b/docs/doxygen/other/shared_ptr_docstub.h
@@ -0,0 +1,24 @@
+namespace boost
+{
+ /*!
+ * \brief shared_ptr documentation stub
+ *
+ * \warning
+ * This isn't the real shared_ptr template. It's just enough to get doxygen
+ * to draw pretty collaboration diagrams.
+ *
+ * An enhanced relative of scoped_ptr with reference counted copy semantics.
+ * The object pointed to is deleted when the last shared_ptr pointing to it
+ * is destroyed or reset.
+ */
+
+template<class T> class shared_ptr
+{
+public:
+
+ T * px; // contained pointer
+
+}; // shared_ptr
+
+
+} // namespace boost
diff --git a/docs/doxygen/other/thread_affinity.dox b/docs/doxygen/other/thread_affinity.dox
new file mode 100644
index 000000000..235266feb
--- /dev/null
+++ b/docs/doxygen/other/thread_affinity.dox
@@ -0,0 +1,65 @@
+/*! \page page_affinity Block Thread Affinity
+
+\section intro Introduction
+
+In the thread-per-block scheduler, you can set the block's core
+affinity. Each block can be pinned to a group cores or be set back
+to use the standard kernel scheduler.
+
+The implementation is done by adding new functions to the GRUEL
+library:
+
+\code
+ gr_thread_t get_current_thread_id();
+ void thread_bind_to_processor(unsigned int n);
+ void thread_bind_to_processor(const std::vector<unsigned int> &mask);
+ void thread_bind_to_processor(gr_thread_t thread, unsigned int n);
+ void thread_bind_to_processor(gr_thread_t thread, const std::vector<unsigned int> &mask);
+ void thread_unbind();
+ void thread_unbind(gr_thread_t thread);
+\endcode
+
+The ability to set a thread's affinity to a core or groups of cores is
+not implemented in the Boost thread library, and so we have made our
+own portability library. In particular, the gruel::gr_thread_t type is
+defined as the thread type for the given system. The other functions
+are designed to be portable as well by calling the specific
+implementation for the thread affinity for a particular platform.
+
+There are functions to set a thread to a group of cores. If the thread
+is not given, the current thread is used. If a single number is
+passed, only that core is set (this is equivalent to a core mask with
+just a single value).
+
+Similarly, there are functions to unset the affinity. This practically
+implements the setting of the thread's affinity to all possible
+cores. Again, the function that does not take a thread argument unsets
+the affinity for the current thread.
+
+
+\section affinity_api GNU Radio Block API
+
+Each block has two new data members:
+
+- threaded: a boolean value that is true if the block is attached to a
+ thread.
+- thread: a gruel::gr_thread_t handle to the block's thread.
+
+A block can set and unset it's affinity at any time using the
+following member functions:
+
+- gr_block::set_processor_affinity(const std::vector<unsigned int> &mask)
+- gr_block::unset_processor_affinity()
+
+Where \p mask is a vector of core numbers to set the thread's affinity
+to.
+
+The current core affinity can be retrieved using the member function:
+
+- gr_block::processor_affinity()
+
+When set before the flowgraph is started, the scheduler will set the
+thread's affinity when it is started. When already running, the
+block's affinity will be immediately set.
+
+*/
diff --git a/docs/doxygen/other/tv-channel-frequencies b/docs/doxygen/other/tv-channel-frequencies
new file mode 100644
index 000000000..8613124f7
--- /dev/null
+++ b/docs/doxygen/other/tv-channel-frequencies
@@ -0,0 +1,79 @@
+# These are the center frequencies in MHz for North American broadcast
+# TV channels. Each channel is 6 MHz wide, hence the bottom edge of the
+# channel is 3 MHz below the value in this table.
+#
+# For NTSC (Analog) TV, the picture carrier is 1.25 MHz up from the
+# bottom edge. NTSC has the FM audio at bottom + 5.75 and the spike is easily
+# visible.
+#
+# For ATSC, the pilot tone is 0.31 MHz up from the bottom.
+#
+#
+ 2 57.00
+ 3 63.00
+ 4 69.00
+ 5 79.00
+ 6 85.00
+ 7 177.00
+ 8 183.00
+ 9 189.00
+ 10 195.00
+ 11 201.00
+ 12 207.00
+ 13 213.00
+ 14 473.00
+ 15 479.00
+ 16 485.00
+ 17 491.00
+ 18 497.00
+ 19 503.00
+ 20 509.00
+ 21 515.00
+ 22 521.00
+ 23 527.00
+ 24 533.00
+ 25 539.00
+ 26 545.00
+ 27 551.00
+ 28 557.00
+ 29 563.00
+ 30 569.00
+ 31 575.00
+ 32 581.00
+ 33 587.00
+ 34 593.00
+ 35 599.00
+ 36 605.00
+ 37 611.00
+ 38 617.00
+ 39 623.00
+ 40 629.00
+ 41 635.00
+ 42 641.00
+ 43 647.00
+ 44 653.00
+ 45 659.00
+ 46 665.00
+ 47 671.00
+ 48 677.00
+ 49 683.00
+ 50 689.00
+ 51 695.00
+ 52 701.00
+ 53 707.00
+ 54 713.00
+ 55 719.00
+ 56 725.00
+ 57 731.00
+ 58 737.00
+ 59 743.00
+ 60 749.00
+ 61 755.00
+ 62 761.00
+ 63 767.00
+ 64 773.00
+ 65 779.00
+ 66 785.00
+ 67 791.00
+ 68 797.00
+ 69 803.00
diff --git a/docs/doxygen/other/vector_docstub.h b/docs/doxygen/other/vector_docstub.h
new file mode 100644
index 000000000..062e08d30
--- /dev/null
+++ b/docs/doxygen/other/vector_docstub.h
@@ -0,0 +1,16 @@
+namespace std
+{
+ /*!
+ * \brief vector documentation stub
+ *
+ * \warning
+ * This isn't the real vector template. It's just enough to get doxygen
+ * to draw pretty collaboration diagrams.
+ */
+ template<class T> class vector
+ {
+ public:
+ T *p;
+ };
+
+} // namespace std
diff --git a/docs/doxygen/swig_doc.py b/docs/doxygen/swig_doc.py
new file mode 100644
index 000000000..f24608b3e
--- /dev/null
+++ b/docs/doxygen/swig_doc.py
@@ -0,0 +1,326 @@
+#
+# Copyright 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.
+#
+"""
+Creates the swig_doc.i SWIG interface file.
+Execute using: python swig_doc.py xml_path outputfilename
+
+The file instructs SWIG to transfer the doxygen comments into the
+python docstrings.
+
+"""
+
+import sys, time
+
+from doxyxml import DoxyIndex, DoxyClass, DoxyFriend, DoxyFunction, DoxyFile
+from doxyxml import DoxyOther, base
+
+def py_name(name):
+ bits = name.split('_')
+ return '_'.join(bits[1:])
+
+def make_name(name):
+ bits = name.split('_')
+ return bits[0] + '_make_' + '_'.join(bits[1:])
+
+
+class Block(object):
+ """
+ Checks if doxyxml produced objects correspond to a gnuradio block.
+ """
+
+ @classmethod
+ def includes(cls, item):
+ if not isinstance(item, DoxyClass):
+ return False
+ # Check for a parsing error.
+ if item.error():
+ return False
+ friendname = make_name(item.name())
+ is_a_block = item.has_member(friendname, DoxyFriend)
+ # But now sometimes the make function isn't a friend so check again.
+ if not is_a_block:
+ is_a_block = di.has_member(friendname, DoxyFunction)
+ return is_a_block
+
+class Block2(object):
+ """
+ Checks if doxyxml produced objects correspond to a new style
+ gnuradio block.
+ """
+
+ @classmethod
+ def includes(cls, item):
+ if not isinstance(item, DoxyClass):
+ return False
+ # Check for a parsing error.
+ if item.error():
+ return False
+ is_a_block2 = item.has_member('make', DoxyFunction) and item.has_member('sptr', DoxyOther)
+ return is_a_block2
+
+
+def utoascii(text):
+ """
+ Convert unicode text into ascii and escape quotes.
+ """
+ if text is None:
+ return ''
+ out = text.encode('ascii', 'replace')
+ out = out.replace('"', '\\"')
+ return out
+
+
+def combine_descriptions(obj):
+ """
+ Combines the brief and detailed descriptions of an object together.
+ """
+ description = []
+ bd = obj.brief_description.strip()
+ dd = obj.detailed_description.strip()
+ if bd:
+ description.append(bd)
+ if dd:
+ description.append(dd)
+ return utoascii('\n\n'.join(description)).strip()
+
+def format_params(parameteritems):
+ output = ['Args:']
+ template = ' {0} : {1}'
+ for pi in parameteritems:
+ output.append(template.format(pi.name, pi.description))
+ return '\n'.join(output)
+
+entry_templ = '%feature("docstring") {name} "{docstring}"'
+def make_entry(obj, name=None, templ="{description}", description=None, params=[]):
+ """
+ Create a docstring entry for a swig interface file.
+
+ obj - a doxyxml object from which documentation will be extracted.
+ name - the name of the C object (defaults to obj.name())
+ templ - an optional template for the docstring containing only one
+ variable named 'description'.
+ description - if this optional variable is set then it's value is
+ used as the description instead of extracting it from obj.
+ """
+ if name is None:
+ name=obj.name()
+ if "operator " in name:
+ return ''
+ if description is None:
+ description = combine_descriptions(obj)
+ if params:
+ description += '\n\n'
+ description += utoascii(format_params(params))
+ docstring = templ.format(description=description)
+ if not docstring:
+ return ''
+ return entry_templ.format(
+ name=name,
+ docstring=docstring,
+ )
+
+
+def make_func_entry(func, name=None, description=None, params=None):
+ """
+ Create a function docstring entry for a swig interface file.
+
+ func - a doxyxml object from which documentation will be extracted.
+ name - the name of the C object (defaults to func.name())
+ description - if this optional variable is set then it's value is
+ used as the description instead of extracting it from func.
+ params - a parameter list that overrides using func.params.
+ """
+ #if params is None:
+ # params = func.params
+ #params = [prm.declname for prm in params]
+ #if params:
+ # sig = "Params: (%s)" % ", ".join(params)
+ #else:
+ # sig = "Params: (NONE)"
+ #templ = "{description}\n\n" + sig
+ #return make_entry(func, name=name, templ=utoascii(templ),
+ # description=description)
+ return make_entry(func, name=name, description=description, params=params)
+
+
+def make_class_entry(klass, description=None, ignored_methods=[], params=None):
+ """
+ Create a class docstring for a swig interface file.
+ """
+ if params is None:
+ params = klass.params
+ output = []
+ output.append(make_entry(klass, description=description, params=params))
+ for func in klass.in_category(DoxyFunction):
+ if func.name() not in ignored_methods:
+ name = klass.name() + '::' + func.name()
+ output.append(make_func_entry(func, name=name))
+ return "\n\n".join(output)
+
+
+def make_block_entry(di, block):
+ """
+ Create class and function docstrings of a gnuradio block for a
+ swig interface file.
+ """
+ descriptions = []
+ # Get the documentation associated with the class.
+ class_desc = combine_descriptions(block)
+ if class_desc:
+ descriptions.append(class_desc)
+ # Get the documentation associated with the make function
+ make_func = di.get_member(make_name(block.name()), DoxyFunction)
+ make_func_desc = combine_descriptions(make_func)
+ if make_func_desc:
+ descriptions.append(make_func_desc)
+ # Get the documentation associated with the file
+ try:
+ block_file = di.get_member(block.name() + ".h", DoxyFile)
+ file_desc = combine_descriptions(block_file)
+ if file_desc:
+ descriptions.append(file_desc)
+ except base.Base.NoSuchMember:
+ # Don't worry if we can't find a matching file.
+ pass
+ # And join them all together to make a super duper description.
+ super_description = "\n\n".join(descriptions)
+ # Associate the combined description with the class and
+ # the make function.
+ output = []
+ output.append(make_class_entry(block, description=super_description))
+ output.append(make_func_entry(make_func, description=super_description,
+ params=block.params))
+ return "\n\n".join(output)
+
+def make_block2_entry(di, block):
+ """
+ Create class and function docstrings of a new style gnuradio block for a
+ swig interface file.
+ """
+ descriptions = []
+ # For new style blocks all the relevant documentation should be
+ # associated with the 'make' method.
+ make_func = block.get_member('make', DoxyFunction)
+ description = combine_descriptions(make_func)
+ # Associate the combined description with the class and
+ # the make function.
+ output = []
+ #output.append(make_class_entry(
+ # block, description=description,
+ # ignored_methods=['make'], params=make_func.params))
+ makename = block.name() + '::make'
+ output.append(make_func_entry(
+ make_func, name=makename, description=description,
+ params=make_func.params))
+ return "\n\n".join(output)
+
+def make_swig_interface_file(di, swigdocfilename, custom_output=None):
+
+ output = ["""
+/*
+ * This file was automatically generated using swig_doc.py.
+ *
+ * Any changes to it will be lost next time it is regenerated.
+ */
+"""]
+
+ if custom_output is not None:
+ output.append(custom_output)
+
+ # Create docstrings for the blocks.
+ blocks = di.in_category(Block)
+ blocks2 = di.in_category(Block2)
+
+ make_funcs = set([])
+ for block in blocks:
+ try:
+ make_func = di.get_member(make_name(block.name()), DoxyFunction)
+ # Don't want to risk writing to output twice.
+ if make_func.name() not in make_funcs:
+ make_funcs.add(make_func.name())
+ output.append(make_block_entry(di, block))
+ except block.ParsingError:
+ sys.stderr.write('Parsing error for block {0}\n'.format(block.name()))
+ raise
+
+ for block in blocks2:
+ try:
+ make_func = block.get_member('make', DoxyFunction)
+ make_func_name = block.name() +'::make'
+ # Don't want to risk writing to output twice.
+ if make_func_name not in make_funcs:
+ make_funcs.add(make_func_name)
+ output.append(make_block2_entry(di, block))
+ except block.ParsingError:
+ sys.stderr.write('Parsing error for block {0}\n'.format(block.name()))
+ raise
+
+ # Create docstrings for functions
+ # Don't include the make functions since they have already been dealt with.
+ funcs = [f for f in di.in_category(DoxyFunction)
+ if f.name() not in make_funcs and not f.name().startswith('std::')]
+ for f in funcs:
+ try:
+ output.append(make_func_entry(f))
+ except f.ParsingError:
+ sys.stderr.write('Parsing error for function {0}\n'.format(f.name()))
+
+ # Create docstrings for classes
+ block_names = [block.name() for block in blocks]
+ block_names += [block.name() for block in blocks2]
+ klasses = [k for k in di.in_category(DoxyClass)
+ if k.name() not in block_names and not k.name().startswith('std::')]
+ for k in klasses:
+ try:
+ output.append(make_class_entry(k))
+ except k.ParsingError:
+ sys.stderr.write('Parsing error for class {0}\n'.format(k.name()))
+
+ # Docstrings are not created for anything that is not a function or a class.
+ # If this excludes anything important please add it here.
+
+ output = "\n\n".join(output)
+
+ swig_doc = file(swigdocfilename, 'w')
+ swig_doc.write(output)
+ swig_doc.close()
+
+if __name__ == "__main__":
+ # Parse command line options and set up doxyxml.
+ err_msg = "Execute using: python swig_doc.py xml_path outputfilename"
+ if len(sys.argv) != 3:
+ raise StandardError(err_msg)
+ xml_path = sys.argv[1]
+ swigdocfilename = sys.argv[2]
+ di = DoxyIndex(xml_path)
+
+ # gnuradio.gr.msq_queue.insert_tail and delete_head create errors unless docstrings are defined!
+ # This is presumably a bug in SWIG.
+ #msg_q = di.get_member(u'gr_msg_queue', DoxyClass)
+ #insert_tail = msg_q.get_member(u'insert_tail', DoxyFunction)
+ #delete_head = msg_q.get_member(u'delete_head', DoxyFunction)
+ output = []
+ #output.append(make_func_entry(insert_tail, name='gr_py_msg_queue__insert_tail'))
+ #output.append(make_func_entry(delete_head, name='gr_py_msg_queue__delete_head'))
+ custom_output = "\n\n".join(output)
+
+ # Generate the docstrings interface file.
+ make_swig_interface_file(di, swigdocfilename, custom_output=custom_output)
diff --git a/docs/exploring-gnuradio/Makefile b/docs/exploring-gnuradio/Makefile
new file mode 100644
index 000000000..cd5da8523
--- /dev/null
+++ b/docs/exploring-gnuradio/Makefile
@@ -0,0 +1,30 @@
+#
+# 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.
+#
+
+TARGETS = exploring-gnuradio.html
+
+all: $(TARGETS)
+
+clean:
+ -rm -f $(TARGETS)
+
+%.html : %.xml
+ xmlto html-nochunks $<
diff --git a/docs/exploring-gnuradio/ddc.eps b/docs/exploring-gnuradio/ddc.eps
new file mode 100644
index 000000000..8931a16a4
--- /dev/null
+++ b/docs/exploring-gnuradio/ddc.eps
@@ -0,0 +1,3105 @@
+%!PS-Adobe-3.0 EPSF-3.0
+%%BoundingBox: 0 0 755 575
+%%Pages: 0
+%%Creator: Sun Microsystems, Inc.
+%%Title: none
+%%CreationDate: none
+%%LanguageLevel: 2
+%%EndComments
+%%BeginPreview: 760 575 1 1725
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000010008000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000300FE001800C100000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000701CF001800C300000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000F03830018000300000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000003F03000018000300000000000
+%00000000000000001F800000000000031800000000000000000000000000780000000000000000
+%000000000000000000000000000000000000000000F00019C03000000000000000000000000000
+%0000000007303000019E0CFC0000000000
+%00000000000000007FE00000000000031800000000000000C00000000000F80000000000000000
+%000000000000000000000000000000000000000001E00019C03000000000000000000000000000
+%000000000030638001FF0C7C0000000000
+%000000000000000060700000000000030000000000000000C00000000000C00000000000000000
+%000000000000000000000000000000000000000003000019E03000000000000000000000000000
+%0000000000307FE001C38C300000000000
+%0000000000000000E0380000000000030000000000000000C00000000000C00000000000000000
+%000000000000000000000000000000000000000003000031F03000000000000000000000000000
+%000000000030787001C18C300000000000
+%0000000000000000E0000C04202002030842002100110181F01000000001F02000000000000000
+%000000000000000000000000000000000000000007C08031B03000000000000000000000000000
+%000000000030703001818C300000000000
+%0000000000000000E0007F86FDF87FC3187FC0FF803F8FF1F8FE001FFC03F9FC00000000000000
+%00000000000000000000000000000000000000000FE7F031B83000000000000000000000000000
+%0000000000307033F181CC300000000000
+%00000000000000007C00E3879FBC78C31879C1CF803F9C70E1C7001FFC00C38E00000000000000
+%0000000000000000000000000000000000000000030E38219C3000000000000000000000000000
+%0000000000307033F981CC300000000000
+%00000000000000003FC0C1C70E0C70631860E30780381838C38300000000C30600000000000000
+%0000000000000000000000000000000000000000030C18618C3000000000000000000000000000
+%00000000003070300181CC300000000000
+%000000000000000007E000C60E0C60631860630380380038C30180000000C30000000000000000
+%0000000000000000000000000000000000000000030C00618E3000000000000000000000000000
+%000000000030303001818C300000000000
+%000000000000000000F001C60E0C60731860670380380038C30380000000C3C000000000000000
+%0000000000000000000000000000000000000000030F804187300001B6DBFFFB6DB00000000000
+%000000000030303001C18C300000000000
+%000000000000000000383FC60E0C60331860670380380FF8C3FF801FFC00C1FC00000000000000
+%00000000000000000000000000000000000000000307F041833000000000000000000000000000
+%0000000000301C6001E30C300000000000
+%0000000000000001C018F8C60E0C60731860670380381E38C300001FFC00C03E00000000000000
+%00000000000000000000000000000000000000000300F8C183B000000000000000000000000000
+%0000000000300FC001FF0C3C0000000000
+%0000000000000001C019C0C60E0C60731860670380383838C30000000000C00700000000000000
+%000000000000000000000000000000000000000003001CC181F000000000000000000000000000
+%0000000000300780019C0C1C0000000000
+%0000000000000000E039C1C60E0C70631860630380383038C30180000000C30700000000000000
+%0000000000000000000000000000000000000000030C0C8180F000000000000000000000000000
+%0000000000000000000000000000000000
+%0000000000000000F071C1C60E0C70E31860638780383078E38380000000C30600000000000000
+%0000000000000000000000000000000000000000030C1D8180F000000000000000080000000000
+%0000000000000000000000000000000000
+%00000000000000007FE0E7C60E0C7FC3186061FF80381CF8F9FF00000000C3DE00000000000000
+%00000000000000000000000000000000000000000307F981807000000000000000040000000000
+%0000000000000000000000000000000000
+%00000000000000001FC07CC60E0C7F83186060FB80380F98787C00000000C0FC00000000000000
+%00000000000000000000000000000000000000000303F181803000000000000000020000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000060000000000300000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000060000000030300000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000060000000038700000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000010000000000
+%0000000000000000000000000000000000
+%00000000000000000000000000006000000001FE00000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000060000000007800000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000008000000000
+%0008000000000000000018000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000004000000000
+%000C000180000060000018000000001000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000C000380000060000018000000003000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000004000000000
+%000C000380000060000018000000003000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000C000380000060000018000000003000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%03DC1F87E1F001F87E0019E01F00F87E00
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000001000000000
+%0FFC7FC7C7FC00F0FF001FF83FC3FC7C00
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%1C3C60C38E0C0061C3801C1870E30E3000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000001000000000
+%181C60E38C0C006181801C1CE063043000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000800000000
+%181C00E3800C006300C0181CC033803000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%381C0FE381FC006300C0181CC033F03000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000400000000
+%380C7FE387FC006300C0181CC030FC3000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%181C60E38E0C006300C0181CC0300E3000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%181CC0E38C0C006381C0181CC072063000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%1C1CC0E38C1C00618180181C6067063800
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0E3CE1E38E3C0071C380181C70E38E3800
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000100000000
+%07FC7F61E7EC0078FF00181C3FC1FC1E00
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000100000000
+%01881C60E3C600383C0018080F00F00E00
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000080000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000080000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000040000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000040000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000020000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000020000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000003000000C01803C03FC00000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000003000000C0180FF03FF00000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000003000000C0181E7C38F80000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000C018301C301C0000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000008000000
+%000000000000000C018300C301C0000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000004000000
+%00000603307E000C0183000301C0000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000070330FF800C0183C0030180000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000002000000
+%0000030631C1800C0181FC030380000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000002000000
+%000003063181800C01807F03FF00000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000001863001800C018007C3FF80000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000001000000
+%0000018C303F800C018001C301C0000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000018C30FD800C018000E300C0000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000800000
+%000000DC31C1800C018600E300E0000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000800000
+%000000D83181800E038700E300E0000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000F83183800E038380C300C0000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000400000
+%0000007031C78007FF03FF83FFC0000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000007030FD8003FE00FF03FF80000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000203070800070003C03FC00000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000200000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000100000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000040000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000020000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000010000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000010000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000004000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000004000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000002600
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000003E00
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%00000000000000000000000000000000000000000000000000000000000000000000000003FE00
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000003FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000001FE00
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%00000000000000000000020000000000000000000000000000000000000000000010000000FE00
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000200000000000000000000000000000000000000000000100000007E00
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000200000000000000000000000000000000000000000000100000003E00
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000200000000000000000000000000000000000000000000100000001E00
+%0000000000000000000000000000000000
+%000007000000000004003C00000000000000000000000000000000000F00000000000000000000
+%000000000000000000000200000000000000000000000000000000000000000000100000001E00
+%0000000000000000000000000000000000
+%00000700000000000C007C00000000000000000000000000000000007FE0000000000000000000
+%000000000000000000000200000000000000000000000000000000000000000000100000000E00
+%0000000000000000000000000000000000
+%00000700000000000C00600000000000000000000000000000000007FFFE000000000000000000
+%000000000000000000000200000000000000000000000000000000000000000000100000000600
+%0000000000000000000000000000000000
+%00000700000000000C0060000000000000000000000000000000001F801F800000000000000000
+%000000000000000000000200000000000000000000000000000000000000000000100000000200
+%0000000000000000000000000000000000
+%00000719E06F03033F01FCDC1E06787800000000000000000000007C0003E00000000000000000
+%000000000000000000000200000000000000000000000000000000000000000000100000000000
+%0000000000000000000000000000000000
+%0000071FF87FC3031F01F8FC7F87FDFC0000000000000000000000F80001F00000000000000000
+%000000000000000000000200000000000000000000000000000000000000000000100000000000
+%0000000000000000000000000000000000
+%0000071E1870E3030C0060E0E1C78F0C0000000000000000000001C00000380000000000000000
+%000000000000000000000200000000000000000000000000000000000000000000100000000000
+%0000000000000000000000000000000000
+%0000071C1C6063030C0060C0C0E7060E00000000000000000000038000001C0000000000000000
+%000000000000000000000200000000000000000000000000000000000000000000100000000000
+%0000000000000000000000000000000000
+%0000071C0C6063030C0060C18067060E00000000000000000000078000000E0000000000000000
+%000000000000000000000200000000000000000000000000000000000000000000100000000000
+%0000000000000000000000000000000000
+%000007180C6063030C0060C18067060E000000000000000000000CC000001B0000000000000000
+%000000000000000000000200000000000000000000000000000000000000000000100000000000
+%0000000000000000000000000000000000
+%000007180C6063030C0060C18067060E0000000000000000000018600000318000000000000000
+%000000000000000000000200000000000000000000000000000000000000000000100000000000
+%0000000000000000000000000000000000
+%000007180C6063030C0060C18067060E0000000000000000000018300000618000000000000000
+%000000000000000000000200000000000000000000000000000000000000000000100000000000
+%0000000000000000000000000000000000
+%000007180C6063070C0060C1C067060E0000000000000000000030180000C0C000000000000000
+%000000000000000000000200000000000000000000000000000000000000000000100000000000
+%0000000000000001800000000000000000
+%000007180C60E3070C0060C0C0C7060E00000000000000000000300C000180C000000000000000
+%000000000000000000000200000000000000000000000000000000000000000000100000000000
+%0000000000000001800000000000000000
+%000007180C71C38F0C0060C0E1C7060E0000000000000000000060060003006000000000000000
+%000000000000000000000200000000000000000000000000000000000000000000100000000000
+%0000000000000001800000000000000000
+%000007180C7F81FB0F0060C07F87060E0000000000000000000040030006002000000000000000
+%000000000000000000000200000000000000000000000000000000000000000000100000000000
+%0000000000000001800000000000000000
+%000006180C6700F3070060C01E07060600000000000000000000C001800C003000000000000000
+%000000000000000000000200000000000000000000000000000000000000000000100000000000
+%0000000000000001800000000000000000
+%0000000000600000000000000000000000000000000000000000C000C01C003000000000000000
+%000000000000000000000200000000000000000000000000000000000000000000100000000000
+%0000000000000001800000000000000000
+%0000000000600000000000000000000000000000000000000001C0006038003800000000000000
+%000000000000000000000200000000000000000000000000000000000000000000100000000000
+%0000000000000001800000000000000000
+%0000000000600000000000000000000000000000000000000601C0003070003800000000000000
+%000000000000000000700200000000000000000000000000000000000000000000100000000000
+%0000000060000001800000000000000000
+%00000000006000000000000000000000000000000000000007E1800018E0001800000000000000
+%0000000000000000007F0200000000000000000000000000000000000000000000100000000000
+%000000007E000001800000000000000000
+%00000000000000000000000000000000000000000000000007FD80000DC0001800000000000000
+%0000000000000000007FC200000000000000000000000000000000000000000000100000000000
+%000000007FC00001800000000000000000
+%00000000000000000000000000000000000000000000000007FF80000780001800000000000000
+%0000000000000000007FFA00000003FF0000000060000000000300000000000000100000000000
+%000000007FF00001800000000000000000
+%0000000000000000000000000000000000000000000000000FFF80000700001C00000000000000
+%0000000000000000007FFA00000003FF800000006000000000C300000000000000100000000000
+%00000000FFF00001800000000000000000
+%00000000000000000000000000000000000000000000000007FD80000780001800000000000000
+%0000000000000000007FC20000000301C00000000000000000C000000000000000100000000000
+%000000007FC00001800000000000000000
+%00000000000000000000000000000000000000000000000007F180000DC0001800000000000000
+%0000000000000000007F020000000300E00000000000000000C000000000000000100000000000
+%000000007E000001800000000000000000
+%00000000000001007F0000200000000000000000000000000601800018E0001800000000000000
+%00000000000000000070020000000300601800404210100301E200400420000000100000000000
+%0000000060000001800000000000000000
+%00000000000003807FF003FC0000000000000000000000000001C0003070003800000000000000
+%00000000000000000000020000000300707F03F8637EFC1FE3F31BF03F60000000100000000000
+%0000000000000001800000000000000000
+%00000000000007807FF807FF0000000000000000000000000001C0006038003800000000000000
+%0000000000000000000002000000030030E7871C63CFDE1CF0C31F3879E0000000100000000000
+%0000000000000001800000000000000000
+%00000000000006C0601C0E070000000000000000000000000000C000C018003000000000000000
+%000000000000000000000200000003003181860C6387063030C31C1C60E0000000100000000000
+%0000000000000000000000000000000000
+%00000000000006C0600C1C038000000000000000000000000000C001800C003000000000000000
+%000000000000000000000200000003003181CC006307060030C31C1CE060000000100000000000
+%0000000000000000000000000000000000
+%0000000000000C60600E18018000000000000000000000000000C0030006003000000000000000
+%000000000000000000000200000003003381CC006303060070C3181CC060000000100000000000
+%0000000000000000000000000000000000
+%0000000000000C6060063800000000000000000000000000000040060003002000000000000000
+%0000000000000000000002000000030033FFCC006303060FF0C3181CC060000000100000000000
+%0000000000000000000000000000000000
+%0000000000001C70600638000000000000000000000000000000600C0001806000000000000000
+%0000000000000000000002000000030073800C006303063E30C3181CC060000000100000000000
+%0000000000000000000000000000000000
+%000000000000183060063800000000000000000000000000000020180000C04000000000000000
+%0000000000000000000002000000030063800C006303063030C3181CC060000000100000000000
+%0000000000000000000000000000000000
+%00000000000018306006380000000000000000000000000000003070000060C000000000000000
+%00000000000000000000020000000300E1818E0E6303063030C3181C60E0000000100000000000
+%0000000000000000000000000000000000
+%000000000000383860063800000000000000000000000000000038E0000031C000000000000000
+%00000000000000000000020000000301C1C1860C6303063070C3181C60E0000000100000000000
+%0000000000000000000000000000000000
+%0000000000003FF86006180000000000000000000000000000001CC000001B8000000000000000
+%000000000000000000000200000003FFC0FF87BC63030639F0F3181C3FE0000000100000000000
+%0000000000000000000000000000000000
+%000000000000301C600E180180000000000000000000000000000F8000000F0000000000000000
+%000000000000000000000200000003FF007E01F06303061FB873181C1F60000000100000000000
+%0000000000000000000000000000000000
+%000000000000600C600C1C038000000000000000000000000000070000000E0000000000000000
+%000000000000000000000200000000000000000000000000000000000060000000100000000000
+%0000000000000000000000000000000000
+%000000000000600C601C0E038000000000000000000000000000038000001C0000000000000000
+%000000000000000000000200000000000000000000000000000000004060000000100000000000
+%0000000000000000000000000000000000
+%000000000000E00E6078078F000000000000000000000000000001E00000780000000000000000
+%0000000000000000000002000000000000000000000000000000000061C0000000100000000000
+%0000000000000000000000000000000000
+%000000000000C0067FF003FE000000000000000000000000000000F80001F00000000000000000
+%000000000000000000000200000000000000000000000000000000003F80000000100000000000
+%0000000000000000000000000000000000
+%000000000000C0067FC000F00000000000000000000000000000003E0007C00000000000000000
+%000000000000000000000200000000000000000000000000000000000F00000000100000000000
+%0000000000000000000000000000000000
+%00000000000000000000000000000000000000000000000000000007F07E000000000000000000
+%000000000000000000000200000000000000000000000000000000000000000000100000000000
+%0000000000000000000000000000000000
+%00000000000000000000000000000000000000000000000000000003FFFC000000000000000000
+%000000000000000000000200000000000000000000000000000000000000000000100000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000007FE0000000000000000000
+%000000000000000000000200000000000000000000000000000000000000000000100000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000400000000000000000000
+%000000000000000000000200000000000000000000000000000000000000000000100000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000400000000000000000000
+%000000000000000000000200000000000000000000000000000000000000000000100000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000600000000000000000000
+%00000000000000000000020000000000C000000000007FE0000000000000000000100000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000600000000000000000000
+%00000000000000000000020000000000C000000000007FF8000000000000000000100000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000600000000000000000000
+%00000000000000000000020000000000C00000000000701C000000000000000000100000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000F00000000000000000000
+%00000000000000000000020000000000C00000000000701C000000000000000000100000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000F00000000000000000000
+%00000000000000000000020000000000C000E040C080700C0700E00C0000000000100000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000F00000000000000000000
+%00000000000000000000020000000000C003F860C180700C3FC3F83F8000000000100000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000001F00000000000000000000
+%00000000000000000000020000000000C0071C61E180700C71E31C738000000000100000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000001F80000000000000000000
+%00000000000000000000020000000000C00E0E61E180701C60660C61C000000000100000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000003F80000000000000000000
+%00000000000000000000020000000000C00C0631E3007FF8006700600000000000100000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000003FC0000000000000000000
+%00000000000000000000020000000000C00C0731B3007FF000E3C0780000000000100000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000400000000000000000000
+%00000000000000000000020000000000C00C0733330070003FE1F83F8000000000100000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000400000000000000000000
+%00000000000000000000020000000000C00C071B360070007C607C07C000000000100000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000400000000000000000000
+%00000000000000000000020000000000C00C061B3600700060600E01C000000000100000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000400000000000000000000
+%00000000000000000000020000000000C00C061E1E007000E0E606C0C000000000100000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000400000000000000000000
+%00000000000000000000020000000000C00E0E1E1E007000E0E70E60C000000000100000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000400000000000000000000
+%00000000000000000000020000000000FFC7FC0E1C00700077E3FC7F8000000000100000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000400000000000000000000
+%00000000000000000000020000000000FFC1F00E1C0070003E61F83F0000000000100000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000400000000000000000000
+%000000000000000000000200000000000000000000000000000000000000000000100000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000400000000000000000000
+%000000000000000000000200000000000000000000000000000000000000000000100000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000400000000000000000000
+%000000000000000000000200000000000000000000000000000000000000000000100000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000400000000000000000000
+%000000000000000000000200000000000000000000000000000000000000000000100000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000400000000000000000000
+%000000000000000000000200000000000000000000000000000000000000000000100000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000400000000000000000000
+%000000000000000000000200000000000000000000000000000000000000000000100000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000400000000000000000003
+%C00000000000000000000200000000000000000000000000000000000000000000100000000000
+%0000000000000000000000000000000000
+%000007000000000000003C0000000000000000000000000000000000040000000000000000001F
+%FC0000000000000000000200000000000000000000000000000000000000000000100000000000
+%0000000000000000000000000000000000
+%00000700000000000C007C000000000000000000000000000000000004000000000000000001FC
+%7FC000000000000000000200000000000000000000000000000000000000000000100000000000
+%0000000000000000000000000000000000
+%00000700000000000C0060000000000000000000000000000000000004000000000000000007E0
+%07E000000000000000000200000000000000000000000000000000000000000000100000000000
+%0000000000000000000000000000000000
+%00000700000000000C006000000000000000000000000000000000000400000000000000001F00
+%00F80000000000000000020000000000000000FFE3180000000000000000000000100000000000
+%0000000000000000000000000000000000
+%00000718E04703021F01F89C1E0238700000000000000000000000000400000000000000007800
+%001C0000000000000000020000000000000000FFE3186000000000000000000000100000000000
+%0000000000000000000000000000000000
+%0000071BF07F83033F01FCFC7F87FCFC000000000000000000000000040000000000000000E000
+%000E0000000000000000020000000000000000C000186000000000000000000000100000000000
+%0000000000000000000000000000000000
+%0000071F3879C3030C0060FCF1C7CF9C000000000000000000000000040000000000000000E000
+%00070000000000000000020000000000000000C000186000000000000000000000100000000000
+%0000000000000000000000000000000000
+%0000071C1C70E3030C0060C0C0C7070E000000000000000000000000040000000000000001E000
+%00038000000000000000020000000000000000C00318F81C046000000000000000100000000000
+%0000000000000000000000000000000000
+%0000071C0C6063030C0060C1C067060E0000000000000000000000000400000000000000033000
+%0007C000000000000000020000000000000000C00318FC7F07F000000000000000100000000000
+%0000000000000000000000000000000000
+%000007180C6063030C0060C18067060E0000000000000000000000000400000000000000061800
+%000CE000000000000000020000000000000000C0031870E387E000000000000000100000000000
+%0000000000000000000000000000000000
+%000007180C6063030C0060C18067060E0000000000000000000000000400000000000000061C00
+%00187000000000000000020000000000000000FFC3186181870000000000000000100000000000
+%0000000000000000000000000000000000
+%000007180C6063030C0060C18067060E0000000000000000000000000400000000000000040E00
+%00307000000000000000020000000000000000FFC3186180C60000000000000000100000000000
+%0000000000000007C00000000000000000
+%000007180C6063030C0060C18067060E00000000000000000000000004000000000000000C0700
+%00603800000000000000020000000000000000C0031861FFC60000000000000000100000000000
+%000000000000001FF00000000000000000
+%000007180C6063070C0060C0C0E7060E0000000000000000000000000400000000000000180380
+%00C03800000000000000020000000000000000C0031861FFC60000000000000000100000000000
+%00000000000000383C0000000000000000
+%000007180C70C3070C0060C0E1C7060E00000000000000000000000004000000000000001801C0
+%01801800000000000000020000000000000000C003186180060000000000000000100000000000
+%00000000000000701C0000000000000000
+%000007180C7FC3FF0F0060C07F87060E00000000000000000000000004000000000000003000E0
+%03001C00000000000000020000000000000000C003186180060000000000000000100000000000
+%00000000000000E00E0000000000000000
+%000007180C6F00F3070060C03F07060E0000000000000000000000000400000000000000300060
+%06000C00000000000000020000000000000000C003186180C60000000000000000100000000000
+%00000000000000C0060000000000000000
+%000000000060000000000000000000000000000000000000000000000400000000000000300030
+%0C000C00000000000000020000000000000000C0031871C1860000000000000000100000000000
+%00000000000001C0070000000000000000
+%000000000060000000000000000000000000000000000000000000000400000000000C00300018
+%18000400000000000070020000000000000000C003187CFF860000000000000000100000000000
+%00000000600001C0070000000000000000
+%000000000060000000000000000000000000000000000000000000000400000000000FE060000E
+%3000060000000000007F020000000000000000C003183C3E060000000000000000100000000000
+%000000007E0001C0070000000000000000
+%000000000060000000000000000000000000000000000000000000000400000000000FF8600006
+%6000060000000000007FC200000000000000000000000000000000000000000000100000000000
+%000000007FC001C0070000000000000000
+%000000000060000000000000000000000000000000000000000000000400000000000FFF600003
+%C000060000000000007FFA00000000000000000000000000000000000000000000100000000000
+%00000000FFF001C0070000000000000000
+%000000000000000000000000000000000000000000000000000000000400000000000FFE600001
+%C000060000000000007FFA00000000000000000000000000000000000000000000100000000000
+%00000000FFF000C0060000000000000000
+%000000000000000000000000000000000000000000000000000000000400000000000FF8600003
+%C000060000000000007FC200000000000000000000000000000000000000000000100000000000
+%000000007FC000C0060000000000000000
+%000000000000000000000000000000000000000000000000000000000400000000000FE0600006
+%6000060000000000007F0200000000000000000000000000000000000000000000100000000000
+%000000007E000060EC0000000000000000
+%000000000000000000000000000000000000000000000000000000000400000000000C0060000C
+%380006000000000000700200000000000000000000000000000000000000000000100000000000
+%00000000600000707C0000000000000000
+%000000000000000000000000000000000000000000000000000000000400000000000000700018
+%180006000000000000000200000000000000000000000000000000000000000000100000000000
+%000000000000003FFC0000000000000000
+%00000000000003807FE001FC000000000000000000000000000000000400000000000000300030
+%0C000C000000000000000200000000000000000000000000000000000000000000100000000000
+%000000000000000FEE0000000000000000
+%00000000000003807FF807FE000000000000000000000000000000000400000000000000300070
+%07000C000000000000000200000000000000000000000000000000000000000000100000000000
+%0000000000000000030000000000000000
+%00000000000006C0603C0E070000000000000000000000000000000004000000000000003000E0
+%03000C000000000000000200000000000000000000000000000000000000000000100000000000
+%0000000000000000000000000000000000
+%00000000000006C0600C0C038000000000000000000000000000000004000000000000003001C0
+%01801C000000000000000200000000000000000000000000000000000000000000100000000000
+%0000000000000000000000000000000000
+%0000000000000EE0600E1801800000000000000000000000000000000400000000000000180380
+%00E018000000000000000200000000000000000000000000000000000000000000100000000000
+%0000000000000000000000000000000000
+%0000000000000C60600E1800000000000000000000000000000000000400000000000000180700
+%007038000000000000000200000000000000000000000000000000000000000000100000000000
+%0000000000000000000000000000000000
+%0000000000000C60600638000000000000000000000000000000000004000000000000000C0E00
+%003838000000000000000200000000000000000000000000000000000000000000100000000000
+%0000000000000000000000000000000000
+%0000000000001C70600638000000000000000000000000000000000004000000000000000C1C00
+%001C70000000000000000200000000000000000000000000000000000000000000100000000000
+%0000000000000000000000000000000000
+%000000000000183060063800000000000000000000000000000000000400000000000000061800
+%000E70000000000000000200000000000000000000000000000000000000000000100000000000
+%0000000000000000000000000000000000
+%000000000000183860063800000000000000000000000000000000000400000000000000033000
+%0007E0000000000000000200000000000000000000000000000000000000000000100000000000
+%0000000000000000000000000000000000
+%0000000000003FF86006380000000000000000000000000000000000040000000000000001A000
+%000380000000000000000200000000000000000000000000000000000000000000100000000000
+%0000000000000000000000000000000000
+%0000000000003FF8600E180180000000000000000000000000000000040000000000000000C000
+%000300000000000000000200000000000000000000000000000000000000000000100000000000
+%0000000000000000000000000000000000
+%000000000000701C600E1C0180000000000000000000000000000000040000000000000000E000
+%000700000000000000000200000000000000000000000000000000000000000000100000000000
+%0000000000000000000000000000000000
+%000000000000600C601C0C03800000000000000000000000000000000400000000000000007C00
+%003E00000000000000000200000000000000000000000000000000000000000000100000000000
+%0000000000000000000000000000000000
+%000000000000E00E603C0F07000000000000000000000000000000000400000000000000003E00
+%00FC00000000000000000200000000000000000000000000000000000000000000100000000000
+%0000000000000000000000000000000000
+%000000000000E00E7FF807FE000000000000000000000000000000000400000000000000000F80
+%01F000000000000000000200000000000000000000000000000000000000000000100000000000
+%0000000000000000000000000000000000
+%000000000000C0067FE001F80000000000000000000000000000000004000000000000000003FC
+%3F8000000000000000000200000000000000000000000000000000000000000000100000000000
+%0000000000000000000000000000000000
+%0000000000000000000000000000000000000000000000000000000004000000000000000000FF
+%FF0000000000000000000200000000000000000000000000000000000000000000100000000000
+%0000000000000000000000000000000000
+%00000000000000000000000000000000000000000000000000000000040000000000000000001F
+%F80000000000000000000200000000000000000000000000000000000000000000100000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000400000000000000000001
+%000000000000000000000200000000000000000000000000000000000000000000100000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000400000000000000000000
+%000000000000000000000200000000000000000000000000000000000000000000100000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000400000000000000000003
+%0000000000000000000003FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE00000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000400000000000000000003
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000400000000000000000007
+%00000000000000000000000000000000000000000000C000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000400000000000000000007
+%80000000000000000000000000000000000000000000C000000000000000000000000000000000
+%0000000000000000000000000000000000
+%00000000000000000000000000000000000000000000000000000000040000000000000000000F
+%80000000000000000000000000000000000000000001E000000000000000000000000000000000
+%0000000000000000000000000000000000
+%00000000000000000000000000000000000000000000000000000000040000000000000000000F
+%80000000000000000000000000000000000000000001E000000000000000000000000000000000
+%0000000000000000000000000000000000
+%00000000000000000000000000000000000000000000000000000000040000000000000000000F
+%C0000000000000000000000000000000000000000001E000000000000000000000000000000000
+%0000000000000000000000000000000000
+%00000000000000000000000000000000000000000000000000000000040000000000000000000F
+%C0000000000000000000000000000000000000000003F000000000000000000000000000000000
+%0000000000000000000000000000000000
+%00000000000000000000000000000000000000000000000000000000040000000000000000000F
+%C0000000000000000000000000000000000000000003F000000000000000000000000000000000
+%0000000000000000000000000000000000
+%00000000000000000000000000000000000000000000000000000000040000000000000000001F
+%C0000000000000000000000000000000000000000003F000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000400000000000000000000
+%00000000000000000000000000000000000000000003F000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000400000000000000000000
+%00000000000000000000000000000000000000000007F800000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000400000000000000000000
+%00000000000000000000000000000000000000000000C000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000400000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000400000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000400000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000400000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000400000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000400000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000400000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000400000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000400000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000400000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000400000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000400000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000400000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000400000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000400000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000400000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000400000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000400000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000C00000400000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000C00000400000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000800000400000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000400000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000400000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%0000000000000000000000000000000000000000000000007E0C6FC00400000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000E70C7FE00400000000000000000000
+%0007807807C0000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000C38C70600400000000000000000000
+%001FC1FE0FE0000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000C00C60600400000000000000000000
+%003863871870000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000F00C60600400000000000000000000
+%003033039830000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%0000000000000000000000000000000000000000000000007E0C60600400000000000000000000
+%007007019800000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%0000000000000000000000000000000000000000000000001F8C60600400000000000000000000
+%006007019F80000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000038C60600400000000000000000000
+%0060060187E0000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000818C60600400000000000000000000
+%0060070180F0000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000C18C60600400000000000000000000
+%007037018038000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000E38C60600400000000000000000000
+%003033039838000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%0000000000000000000000000000000000000000000000007F0C60600400000000000000000000
+%003863871830000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000400000000000000000000
+%001FE1FE0FF0000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000400000000000000000000
+%0007807C07C0000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000400000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000400000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000400000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000400000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000400000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000400000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000400000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000400000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000400000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000400000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000400000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000400000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000400000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000400000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%0000000000000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
+%FFFFFFFFFFFFFFFFC0000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000080000000000000000000000000000000000000
+%000000000000000040000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000080000000000000000000000000000000000000
+%000000000000000040000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000080000000000000000000000000000000000000
+%000000000000000040000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000080000000000000000000000000000000000000
+%000000000000000040000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000080000000000000000000000000000000000000
+%000000000000000040000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000080000000000000000000000000000000000000
+%000000000000000040000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000080000000000000000000000000000000000000
+%000000000000000040000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000080000000000000000000000000000000000000
+%000000000000000040000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000080000000000000000000000000000000000000
+%000000000000000040000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000080000000000000000000000000000000000000
+%000000000000000040000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000080000000000000000000000000000000000000
+%000000000000000040000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000080000000000000000000000000000000000000
+%000000000000000040000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000080000000000000000000000000000000000000
+%000000000000000040000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000080000000000000000000000000000000000000
+%000000000000000040000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000080000000000000000000000000000000000000
+%000000000000000040000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000080000000000000000000000000000000000000
+%000000000000000040000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000080000000000000000000000000000000000000
+%000000000000000040000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%0000000000000000000000000000000000000000800000000000000000001803003E000F800000
+%000000000000000040000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%0000000000000000000000000000000000000000800000000000000000001C0300FF803FE00000
+%000000000000000040000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%0000000000000000000000000000000000000000800000000000000000001E0303C1C070780000
+%000000000000000040000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%0000000000000000000000000000000000000000800000000000000000001E030300C0E0380000
+%000000000000000040000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%0000000000000000000000000000000000000000800000000000000000001F030700E1C01C0000
+%00000000000000004000000000000001FF00000000006000018006086000000000000000000000
+%0000000000000000000000000000000000
+%0000000000000000000000000000000000000000800000000000000000001B83060001800C0000
+%00000000000000004000000000000001FFC0000000006000018006186000000000000000000000
+%0000000000000000000000000000000000
+%00000000000000000000000000000000000000008000000000000000000019C30E0003800E0000
+%0000000000000000400000000000000180C0000000006000000006186000000000000000000000
+%0000000000000000000000000000000000
+%00000000000000000000000000000000000000008000000000000000000019C30E0003800E0000
+%0000000000000000400000000000000180E0000000006000000006186000000000000000000000
+%0000000000000000000000000000000000
+%00000000000000000000000000000000000000008000000000000000000018E30C0003800E0000
+%0000000000000000400000000000000180603C08E00E66060D80C67E6700000000000000000000
+%0000000000000000000000000000000000
+%00000000000000000000000000000000000000008000000000000000000018630E0003800E0000
+%000000000000000040000000000000018060FF1FF83FE30E0D83F67E6FC0000000000000000000
+%0000000000000000000000000000000000
+%00000000000000000000000000000000000000008000000000000000000018330E0003800E0000
+%0000000000000000400000000000000180C1C71F3871E30E0D871E1878E0000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000080000000000000000000183B060061800C0000
+%00000000000000004000000000000001FF83831C1C60E30F198E0E187060000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000080000000000000000000181B060061800C0000
+%00000000000000004000000000000001FF80031C0CE0630B198C0E186060000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000080000000000000000000181F0700E0C01C0000
+%0000000000000000400000000000000181E0071C0CE0619B198C06186060000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000080000000000000000000180F0381C0E0380000
+%000000000000000040000000000000018060FF1C0CC0619B318C06186060000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000080000000000000000000180701FF807FF00000
+%000000000000000040000000000000018071E31C0CC06199B18C06186060000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000080000000000000000000180700FF001FC00000
+%000000000000000040000000000000018073831C0CE060F1B18C06186060000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000080000000000000000000000000000000000000
+%000000000000000040000000000000018073031C0C6060F1E18E0E186060000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000080000000000000000000000000000000000000
+%0000000000000000400000000000000180E3071C0C70E0F0E1861E186060000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000080000000000000000000000000000000000000
+%00000000000000004000000000000001FFC1FF9C0C3FE070E187FE1E6060000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000080000000000000000000000000000000000000
+%00000000000000004000000000000001FF80F99C0C0F6060E181E60E6060000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000080000000000000000000000000000000000000
+%000000000000000040000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000080000000000000000000000000000000000000
+%000000000000000040000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000080000000000000000000000000000000000000
+%000000000000000040000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000080000000000000000000000000000000000000
+%000000000000000040000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000080000000000000000000000000000000000000
+%000000000000000040000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000080000000000000000000000000000000000000
+%000000000000000040000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000080000000003E0300000000006000FC00000003
+%000000000000000040000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%00000000000000000000000000000000000000008000000000FF830000000000C003FF00000003
+%000000000000000040000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%00000000000000000000000000000000000000008000000001C1C00000000000C0070780000000
+%000000000000000040000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%0000000000000000000000000000000000000000800000000380E00000000000C00E0180000000
+%000000000000000040000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%0000000000000000000000000000000000000000800000000380400000000000800C01C0000000
+%000000000000000040000000000000000C000000180000000010C0000000000000000000000000
+%0000000000000000000000000000000000
+%0000000000000000000000000000000000000000800000000380031BF81F8001801C0001FC1FC3
+%1BF03F800000000040000000000000000C000000180000000030C0000000000000000000000000
+%0000000000000000000000000000000000
+%00000000000000000000000000000000000000008000000001F0031F3839C001801800039E38E3
+%1F3879C00000000040000000000000000C00000000000000003000000000000000000000000000
+%0000000000000000000000000000000000
+%00000000000000000000000000000000000000008000000000FE031C1C60600100180007073063
+%1C1860E00000000040000000000000000C00000000000000003000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000080000000001FC31C0C60700300180006033003
+%1C1CC060000000004000000000000001CC07001C18CF0E01F07CC07819E0000000000000000000
+%0000000000000000000000000000000000
+%0000000000000000000000000000000000000000800000000003C31C0CE070030018000E033C03
+%181CE060000000004000000000000007EC1FC07F18FFBF83FC7CC0FE1BF0000000000000000000
+%0000000000000000000000000000000000
+%0000000000000000000000000000000000000000800000000000E31C0CFFF0030018000E031FC3
+%181CFFE000000000400000000000000E3C38E0E398F1F3861C30C1C71E38000000000000000000
+%0000000000000000000000000000000000
+%0000000000000000000000000000000000000000800000000300631C0CE00006001C00CE0303E3
+%181CC00000000000400000000000000C1C6070C198E0C18E0C30C3839C18000000000000000000
+%0000000000000000000000000000000000
+%0000000000000000000000000000000000000000800000000300631C0CE00006000C01CE030073
+%181CC0000000000040000000000000180C60318018E0C1800C30C3019818000000000000000000
+%0000000000000000000000000000000000
+%0000000000000000000000000000000000000000800000000380631C0C606006000E0186073073
+%181CE0600000000040000000000000180C7FF18018C0C1803C30C301981C000000000000000000
+%0000000000000000000000000000000000
+%00000000000000000000000000000000000000008000000003C0C31C0C70600400070387063073
+%181C70E00000000040000000000000180C7FF18018C0C183FC30C701981C000000000000000000
+%0000000000000000000000000000000000
+%00000000000000000000000000000000000000008000000001FFC31C0C3DE00C0003FF03DE3DE3
+%181C3BC00000000040000000000000180C60018018C0C1878C30C701981C000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000080000000007F031C0C1F800C0001FC01F80FC3
+%181C1F800000000040000000000000180C60018098C0C18C0C30C301981C000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000080000000000000000000000000000000000000
+%0000000000000000400000000000000C1C7031C1D8C0C18C0C30C301981C000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000080000000000000000000000000000000000000
+%0000000000000000400000000000000E1C7060C198C0C18C1C30C383981C000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000080000000000000000000000000000000000000
+%00000000000000004000000000000007FC3FE07F18C0C187FE3EC1FF181C000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000080000000000000000000000000000000000000
+%00000000000000004000000000000003CC0F803E18C0C183E61EC07C181C000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000080000000000000000000000000000000000000
+%000000000000000040000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000080000000000000000000000000000000000000
+%000000000000000040000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000080000000000000000000000000000000000000
+%000000000000000040000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000080000000000000000000000000000000000000
+%000000000000000040000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000080000000000000000000000000000000000000
+%000000000000000040000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000080000000000000000000000000000000000000
+%000000000000000040000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%00000000000000000000000000000000000000008000000000000007E000000000000000000000
+%000000000000000040000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%0000000000000000000000000000000000000000800000000000001FF800000000000000006000
+%000000000000000040000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000080000000000000381C00000000000000006000
+%000000000000000040000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000080000000000000700E00000000000000006000
+%000000000000000040000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%00000000000000000000000000000000000000008000000000000060060300860030110180F818
+%088000000000000040000000000000001E00000010000000000000380700000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000080000000000000E0001FC0DF81FC3F8FF0F8FE
+%0FE000000000000040000000000000003E000000300000000000003C0700000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000080000000000000C0003CE0F9C38E3F9C7061C7
+%0FC0000000000000400000000000000030000000300000000000003C0700000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000080000000000000C0003030E0C3073818386383
+%8E00000000000000400000000000000030000000300000000000003E0700000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000080000000000000C0FE6030C0E6033800386301
+%8C000000000000004000000000000000FE1F00F07E1F037007FF00360700000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000080000000000000C0FF7030C0E7033800386301
+%CC000000000000004000000000000000FE7FC1FC7C3F83F007FF00330700000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000080000000000000C0077FF0C0E7FF380FF86301
+%CC0000000000000040000000000000003061C38E3071C3D0000000338700000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000080000000000000E0076000C0E600381E386301
+%CC00000000000000400000000000000030E0C70630C0E38000000031C700000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000080000000000000E0076000C0E6003838386301
+%CC0000000000000040000000000000003000C60030C0630000000030C700000000000000000000
+%0000000000000000000000000000000000
+%00000000000000000000000000000000000000008000000000000070077030C0E7033830386301
+%8C0000000000000040000000000000003007C60030C0630000000030E700000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000080000000000000381E3870C0E3073830786383
+%8C000000000000004000000000000000303FC60031C0730007FF00307700000000000000000000
+%0000000000000000000000000000000000
+%0000000000000000000000000000000000000000800000000000001FFC1FE0C0E3FE381CF879FF
+%0C0000000000000040000000000000003070C60030C0630007FF00303700000000000000000000
+%0000000000000000000000000000000000
+%00000000000000000000000000000000000000008000000000000007F00FC0C0E0FC380F983C7C
+%0C00000000000000400000000000000030C0C60230C06300000000303F00000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000080000000000000000000000000000000000000
+%0000000000000000400000000000000030C0C60630C06300000000301F00000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000080000000000000000000000000000000000000
+%0000000000000000400000000000000030E1C30E38E0E300000000300F00000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000080000000000000000000000000000000000000
+%00000000000000004000000000000000307FE3FC3E7FC300000000300F00000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000080000000000000000000000000000000000000
+%00000000000000004000000000000000303C60F01E1F0300000000300700000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000080000000000000000000000000000000000000
+%000000000000000040000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000080000000000000000000000000000000000000
+%000000000000000040000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000080000000000000000000000000000000000000
+%000000000000000040000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000080000000000000000000000000000000000000
+%000000000000000040000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000080000000000000000000000000000000000000
+%000000000000000040000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000080000000000000000000000000000000000000
+%000000000000000040000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000080000000000000000000000000000000000000
+%000000000000000040000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000080000000000000000000000000000000000000
+%000000000000000040000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000080000000000000000000000000000000000000
+%000000000000000040000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000080000000000000000000000000000000000000
+%000000000000000040000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000080000000000000000000000000000000000000
+%000000000000000040000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000080000000000000000000000000000000000000
+%000000000000000040000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000080000000000000000000000000000000000000
+%000000000000000040000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000080000000000000000000000000000000000000
+%000000000000000040000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000080000000000000000000000000000000000000
+%000000000000000040000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%0000000000000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
+%FFFFFFFFFFFFFFFFC0000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000010000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000018000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000018000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%00000000000000000000000000000000000000000000000000000000000000000003C000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%00000000000000000000000000000000000000000000000000000000000000000003C000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%00000000000000000000000000000000000000000000000000000000000000000003C000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%00000000000000000000000000000000000000000000000000000000000000000007C000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%00000000000000000000000000000000000000000000000000000000000000000007C000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%0000000000000000000000000000000000000000000000000000000000000000000FE000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%0000000000000000000000000000000000000000000000000000000000000000000FE000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%0000000000000000000000000000000000000000000000000000000000000000000FF000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%0000000000000000000000000000000000000000000000000000000000000000000FF000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000010000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000010000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000010000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000010000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000010000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000010000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000010000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000010000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000010000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000010000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000010000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000010000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000010000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000010000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000010000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000010000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000010000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000010000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000010000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000010000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000010000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000010000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000010000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000010000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000010000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000010000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000010000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000010000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000010000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000010000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000010000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000010000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000010000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000010000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000010000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000010000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000010000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000010000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000010000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000010000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%0000000000000000000000000000000000000000000001F800000000000000000F000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%0000000000000000000000000000000000000000000007FE00000000C00000001F000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000E0F00000000C000000018000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000001C0300000000C000000018000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%00000000000000000000000000000000000000000000180380000000E000000038000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%00000000000000000000000000000000000000000000380003F837E3F0FC0FC07F7F1FC07EC606
+%0FE0DF81FC60700000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000003800073C3CF0C1CE0FC0187F3CE0E7C606
+%1C70FBC38E70600000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%0000000000000000000000000000000000000000000030000C0C3870C3030E0018703071C1C606
+%3830E0C30630600000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%0000000000000000000000000000000000000000000030000C0E3030C3038C001870603181C606
+%3018C0C60030E00000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%0000000000000000000000000000000000000000000030001C0E3030C7038C001870703181C606
+%3038C0C60038C00000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%0000000000000000000000000000000000000000000030001FFE3030C7FF8C0018707FF180C606
+%3FF8C0C60018C00000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%0000000000000000000000000000000000000000000038019C003030C7000C001870600180C606
+%3000C0C60019800000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%0000000000000000000000000000000000000000000018019C003030C7000C001870600181C606
+%3000C0C6000D800000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000001C030C0C3030C3030C001870703181C606
+%3018C0C6060D000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000E070E0C3030C3830C0018703871C3C70E
+%3838C0C3060F000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%0000000000000000000000000000000000000000000007FE07BC3030F1EF0C0018703FE0F7C3FE
+%1EF0C0C3DE07000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%0000000000000000000000000000000000000000000003F803F0303070FC0C0018700FC07DC1F6
+%07E0C0C0F806000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%00000000000000000000000000000000000000000000000000000000000000000000000001C000
+%000000000006000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%00000000000000000000000000000000000000000000000000000000000000000000000001C000
+%000000000006000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%00000000000000000000000000000000000000000000000000000000000000000000000001C000
+%00000000001C000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%00000000000000000000000000000000000000000000000000000000000000000000000001C000
+%000000000038000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000008000
+%000000000030000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000001E000187C00000000000003C0
+%0060F8000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000003E00011FF000C0000000007C0
+%0063FC000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%00000000000000000000000000000000000000000000000000000300003183001C000000000E00
+%00670E000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%00000000000000000000000000000000000000000000000000000300003303801C000000380C00
+%004606000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%00000000000000000000000000000000000000000000000000000FC1802301803E030000381F03
+%00C607000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%00000000000000000000000000000000000000000000000000000FC7F06001803F1FC000381F9F
+%C0C006000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%0000000000000000000000000000000000000000000000000000070E706003801C38E000380C18
+%E08006000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%0000000000000000000000000000000000000000000000000000031C386007001C707003FF8C30
+%60800E000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%0000000000000000000000000000000000000000000000000000031C00C00E001C603003FF8C38
+%01801C000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%0000000000000000000000000000000000000000000000000000030F00C01C001C603800380C1E
+%018038000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000FE307E0C038001C603800380C0F
+%C10070000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000FE300F88070001C603800380C03
+%E300E0000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000003003980E0001C603800380C00
+%7303C0000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000003181981C0001C703000380C30
+%330300000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%0000000000000000000000000000000000000000000000000000031C190380001C307000000C38
+%760600000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%0000000000000000000000000000000000000000000000000000030FF103FF800F3FE000000C1F
+%E60FFE000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%00000000000000000000000000000000000000000000000000000307E303FF800F0FC000000C0F
+%C60FFF000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%%EndPreview
+%%BeginProlog
+%%BeginResource: SDRes
+/b4_inc_state save def
+/dict_count countdictstack def
+/op_count count 1 sub def
+userdict begin
+0 setgray 0 setlinecap 1 setlinewidth 0 setlinejoin 10 setmiterlimit[] 0 setdash newpath
+/languagelevel where {pop languagelevel 1 ne {false setstrokeadjust false setoverprint} if} if
+/bdef {bind def} bind def
+/c {setgray} bdef
+/l {neg lineto} bdef
+/rl {neg rlineto} bdef
+/lc {setlinecap} bdef
+/lj {setlinejoin} bdef
+/lw {setlinewidth} bdef
+/ml {setmiterlimit} bdef
+/ld {setdash} bdef
+/m {neg moveto} bdef
+/ct {6 2 roll neg 6 2 roll neg 6 2 roll neg curveto} bdef
+/r {rotate} bdef
+/t {neg translate} bdef
+/s {scale} bdef
+/sw {show} bdef
+/gs {gsave} bdef
+/gr {grestore} bdef
+/f {findfont dup length dict begin
+{1 index /FID ne {def} {pop pop} ifelse} forall /Encoding ISOLatin1Encoding def
+currentdict end /NFont exch definefont pop /NFont findfont} bdef
+/p {closepath} bdef
+/sf {scalefont setfont} bdef
+/ef {eofill}bdef
+/pc {closepath stroke}bdef
+/ps {stroke}bdef
+/pum {matrix currentmatrix}bdef
+/pom {setmatrix}bdef
+/bs {/aString exch def /nXOfs exch def /nWidth exch def currentpoint nXOfs 0 rmoveto pum nWidth aString stringwidth pop div 1 scale aString show pom moveto} bdef
+%%EndResource
+%%EndProlog
+%%BeginSetup
+%%EndSetup
+%%Page: 1 1
+%%BeginPageSetup
+%%EndPageSetup
+pum
+0.02834 0.02833 s
+0 -20290 t
+/tm matrix currentmatrix def
+gs
+tm setmatrix
+-635 -635 t
+1 1 s
+635 635 m 27274 635 l 27274 20924 l 635 20924 l 635 635 l eoclip newpath
+0 lw 1 lj 0.000 c 17781 10461 m 14606 10461 l 14606 6016 l 20956 6016 l
+20956 10461 l 17781 10461 l pc
+gs
+pum
+15663 7567 t
+65 0 m 65 -606 l 274 -606 l 321 -606 357 -603 382 -597 ct 416 -589 446 -575 471 -554 ct
+503 -527 526 -492 542 -450 ct 558 -408 566 -360 566 -306 ct 566 -260 561 -219 550 -184 ct
+539 -148 525 -119 509 -95 ct 492 -72 473 -54 453 -40 ct 433 -27 409 -17 381 -10 ct
+353 -3 320 0 284 0 ct p
+145 -71 m 275 -71 l 315 -71 346 -75 369 -82 ct 391 -90 409 -100 423 -114 ct
+442 -133 457 -158 467 -190 ct 478 -222 483 -261 483 -307 ct 483 -371 473 -419 452 -453 ct
+431 -487 406 -510 376 -522 ct 355 -530 320 -534 272 -534 ct 145 -534 l p ef
+965 -141 m 1042 -131 l 1030 -86 1007 -52 975 -27 ct 942 -2 900 9 849 9 ct
+785 9 734 -9 696 -49 ct 658 -88 640 -144 640 -215 ct 640 -289 659 -347 697 -387 ct
+735 -428 784 -449 845 -449 ct 903 -449 951 -429 989 -389 ct 1026 -349 1044 -292 1044 -220 ct
+1044 -216 1044 -209 1044 -200 ct 716 -200 l 719 -152 733 -115 757 -89 ct 782 -64 813 -51 849 -51 ct
+877 -51 900 -58 919 -72 ct 938 -87 l 954 -110 l p
+721 -261 m 966 -261 l 963 -298 953 -326 938 -344 ct 914 -373 883 -387 845 -387 ct
+811 -387 783 -376 759 -353 ct 736 -330 l 723 -300 l p ef
+1427 -160 m 1500 -151 l 1492 -100 1472 -61 1439 -32 ct 1406 -4 1365 9 1317 9 ct
+1257 9 1209 -9 1172 -49 ct 1136 -88 1118 -144 1118 -217 ct 1118 -265 1125 -306 1141 -342 ct
+1157 -378 1181 -404 1213 -422 ct 1245 -440 1280 -449 1318 -449 ct 1365 -449 1404 -437 1435 -412 ct
+1465 -388 1485 -354 1493 -310 ct 1421 -299 l 1414 -328 1402 -350 1384 -365 ct
+1367 -380 1345 -387 1321 -387 ct 1283 -387 1253 -374 1229 -347 ct 1206 -320 1194 -278 1194 -220 ct
+1194 -161 1205 -118 1228 -91 ct 1251 -64 1280 -51 1317 -51 ct 1346 -51 1370 -60 1390 -78 ct
+1409 -96 l 1422 -123 l p ef
+1564 -520 m 1564 -606 l 1638 -606 l 1638 -520 l p
+1564 0 m 1564 -439 l 1638 -439 l 1638 0 l p ef
+1748 0 m 1748 -439 l 1815 -439 l 1815 -377 l 1829 -399 1847 -416 1870 -429 ct
+1893 -442 1919 -449 1948 -449 ct 1981 -449 2007 -442 2028 -428 ct 2049 -415 2064 -396 2072 -372 ct
+2107 -423 2152 -449 2208 -449 ct 2251 -449 2285 -437 2308 -412 ct 2332 -388 2343 -351 2343 -301 ct
+2343 0 l 2269 0 l 2269 -276 l 2269 -306 2267 -327 2262 -340 ct 2257 -354 2249 -364 2236 -372 ct
+2223 -380 2208 -384 2191 -384 ct 2160 -384 2135 -374 2114 -353 ct 2094 -333 2084 -300 2084 -255 ct
+2084 0 l 2009 0 l 2009 -285 l 2009 -318 2003 -343 1991 -359 ct 1979 -376 1959 -384 1932 -384 ct
+1911 -384 1891 -379 1873 -368 ct 1856 -357 1843 -340 1835 -319 ct 1827 -298 1823 -267 1823 -227 ct
+1823 0 l p ef
+2750 -54 m 2722 -30 2696 -14 2670 -4 ct 2645 5 2617 9 2588 9 ct 2540 9 2503 -1 2477 -25 ct
+2451 -49 2438 -79 2438 -115 ct 2438 -137 2443 -156 2453 -174 ct 2463 -192 2475 -206 2491 -217 ct
+2507 -228 2525 -236 2545 -241 ct 2559 -245 2581 -249 2611 -253 ct 2671 -260 2715 -268 2744 -278 ct
+2744 -288 2744 -295 2744 -298 ct 2744 -328 2737 -349 2723 -362 ct 2704 -379 2676 -387 2638 -387 ct
+2603 -387 2577 -381 2561 -369 ct 2544 -356 2532 -335 2524 -303 ct 2451 -313 l
+2458 -345 2468 -370 2484 -389 ct 2499 -408 2521 -423 2549 -433 ct 2578 -443 2611 -449 2649 -449 ct
+2687 -449 2717 -444 2740 -435 ct 2764 -427 2781 -415 2792 -402 ct 2803 -389 2811 -372 2815 -351 ct
+2818 -339 2819 -316 2819 -283 ct 2819 -184 l 2819 -114 2821 -71 2824 -52 ct
+2827 -34 2833 -16 2843 0 ct 2765 0 l 2757 -15 l 2752 -33 l p
+2744 -220 m 2717 -209 2676 -200 2622 -192 ct 2592 -187 2570 -182 2557 -177 ct
+2545 -171 2535 -163 2528 -153 ct 2521 -142 2518 -130 2518 -117 ct 2518 -98 2525 -81 2540 -68 ct
+2555 -55 2577 -48 2606 -48 ct 2635 -48 2660 -54 2683 -67 ct 2705 -79 2721 -96 2732 -118 ct
+2740 -135 2744 -160 2744 -193 ct p ef
+3076 -66 m 3087 0 l 3066 3 3047 5 3030 5 ct 3003 5 2982 1 2968 -7 ct 2953 -15 2942 -26 2936 -40 ct
+2930 -54 2927 -83 2927 -128 ct 2927 -381 l 2872 -381 l 2872 -439 l 2927 -439 l
+2927 -547 l 3001 -592 l 3001 -439 l 3076 -439 l 3076 -381 l 3001 -381 l
+3001 -124 l 3001 -103 3002 -89 3005 -83 ct 3008 -77 3012 -72 3018 -69 ct 3024 -65 3032 -63 3043 -63 ct
+3051 -63 l 3062 -64 l p ef
+3152 -520 m 3152 -606 l 3226 -606 l 3226 -520 l p
+3152 0 m 3152 -439 l 3226 -439 l 3226 0 l p ef
+3336 0 m 3336 -439 l 3403 -439 l 3403 -376 l 3436 -425 3482 -449 3543 -449 ct
+3570 -449 3594 -444 3616 -434 ct 3638 -425 3655 -412 3666 -397 ct 3677 -382 3685 -363 3689 -342 ct
+3692 -328 3693 -304 3693 -270 ct 3693 0 l 3619 0 l 3619 -267 l 3619 -297 3616 -320 3610 -335 ct
+3604 -350 3594 -362 3579 -371 ct 3565 -380 3547 -384 3527 -384 ct 3496 -384 3468 -374 3445 -354 ct
+3422 -334 3411 -296 3411 -239 ct 3411 0 l p ef
+3799 36 m 3871 47 l 3874 69 3883 85 3896 95 ct 3915 109 3940 116 3972 116 ct
+4006 116 4033 109 4052 95 ct 4071 82 4083 62 4090 38 ct 4094 22 4095 -8 4095 -57 ct
+4063 -19 4022 0 3974 0 ct 3913 0 3867 -21 3833 -65 ct 3800 -108 3784 -161 3784 -222 ct
+3784 -264 3791 -302 3807 -338 ct 3822 -373 3844 -400 3873 -420 ct 3901 -439 3935 -449 3974 -449 ct
+4026 -449 4069 -428 4102 -386 ct 4102 -439 l 4171 -439 l 4171 -59 l 4171 8 4164 57 4150 85 ct
+4136 114 4114 136 4084 153 ct 4054 169 4017 178 3972 178 ct 3920 178 3878 166 3845 142 ct
+3813 119 l 3798 83 l p
+3860 -227 m 3860 -169 3872 -127 3895 -101 ct 3918 -74 3946 -61 3981 -61 ct
+4015 -61 4044 -74 4067 -101 ct 4090 -127 4101 -168 4101 -224 ct 4101 -278 4090 -319 4066 -346 ct
+4042 -373 4013 -387 3979 -387 ct 3946 -387 3918 -374 3895 -347 ct 3872 -320 l
+3860 -280 l p ef
+pom
+pum
+16007 8520 t
+62 0 m 62 -606 l 142 -606 l 142 -71 l 440 -71 l 440 0 l p ef
+478 -219 m 478 -300 500 -361 545 -400 ct 583 -432 629 -449 684 -449 ct 744 -449 793 -429 832 -389 ct
+870 -350 889 -295 889 -225 ct 889 -169 881 -124 864 -92 ct 847 -60 822 -34 790 -16 ct
+757 0 722 9 684 9 ct 622 9 572 -9 534 -49 ct 497 -88 l 478 -145 l p
+554 -219 m 554 -163 566 -121 591 -93 ct 615 -65 646 -51 684 -51 ct 721 -51 751 -65 776 -93 ct
+800 -121 813 -164 813 -222 ct 813 -276 800 -317 776 -345 ct 751 -373 720 -387 684 -387 ct
+646 -387 615 -373 591 -345 ct 566 -317 l 554 -275 l p ef
+1062 0 m 928 -439 l 1005 -439 l 1075 -185 l 1101 -91 l 1102 -96 1110 -126 1124 -181 ct
+1194 -439 l 1270 -439 l 1336 -184 l 1358 -100 l 1383 -185 l 1458 -439 l
+1531 -439 l 1393 0 l 1316 0 l 1246 -263 l 1229 -337 l 1140 0 l p ef
+1811 0 m 1811 -606 l 2040 -606 l 2080 -606 2111 -604 2132 -600 ct 2162 -595 2187 -586 2207 -572 ct
+2227 -558 2243 -538 2255 -513 ct 2268 -488 2274 -461 2274 -430 ct 2274 -379 2257 -335 2224 -300 ct
+2192 -264 2132 -246 2047 -246 ct 1891 -246 l 1891 0 l p
+1891 -318 m 2048 -318 l 2100 -318 2136 -327 2158 -346 ct 2180 -366 2191 -393 2191 -428 ct
+2191 -453 2185 -475 2172 -493 ct 2159 -511 2142 -523 2121 -529 ct 2108 -532 2083 -534 2046 -534 ct
+1891 -534 l p ef
+2644 -54 m 2616 -30 2590 -14 2564 -4 ct 2539 5 2511 9 2482 9 ct 2434 9 2397 -1 2371 -25 ct
+2345 -49 2332 -79 2332 -115 ct 2332 -137 2337 -156 2347 -174 ct 2357 -192 2369 -206 2385 -217 ct
+2401 -228 2419 -236 2439 -241 ct 2453 -245 2475 -249 2505 -253 ct 2565 -260 2609 -268 2638 -278 ct
+2638 -288 2638 -295 2638 -298 ct 2638 -328 2631 -349 2617 -362 ct 2598 -379 2570 -387 2532 -387 ct
+2497 -387 2471 -381 2455 -369 ct 2438 -356 2426 -335 2418 -303 ct 2345 -313 l
+2352 -345 2362 -370 2378 -389 ct 2393 -408 2415 -423 2443 -433 ct 2472 -443 2505 -449 2543 -449 ct
+2581 -449 2611 -444 2634 -435 ct 2658 -427 2675 -415 2686 -402 ct 2697 -389 2705 -372 2709 -351 ct
+2712 -339 2713 -316 2713 -283 ct 2713 -184 l 2713 -114 2715 -71 2718 -52 ct
+2721 -34 2727 -16 2737 0 ct 2659 0 l 2651 -15 l 2646 -33 l p
+2638 -220 m 2611 -209 2570 -200 2516 -192 ct 2486 -187 2464 -182 2451 -177 ct
+2439 -171 2429 -163 2422 -153 ct 2415 -142 2412 -130 2412 -117 ct 2412 -98 2419 -81 2434 -68 ct
+2449 -55 2471 -48 2500 -48 ct 2529 -48 2554 -54 2577 -67 ct 2599 -79 2615 -96 2626 -118 ct
+2634 -135 2638 -160 2638 -193 ct p ef
+2778 -131 m 2851 -142 l 2855 -113 2867 -90 2886 -74 ct 2905 -59 2931 -51 2965 -51 ct
+2999 -51 3024 -58 3041 -72 ct 3058 -86 3066 -102 3066 -121 ct 3066 -138 3059 -151 3044 -160 ct
+3034 -167 3008 -175 2968 -186 ct 2913 -199 2875 -211 2854 -221 ct 2833 -231 2817 -245 2806 -263 ct
+2795 -281 2790 -301 2790 -322 ct 2790 -342 2794 -360 2803 -376 ct 2812 -393 2825 -407 2840 -418 ct
+2852 -427 2867 -434 2887 -440 ct 2907 -446 2929 -449 2952 -449 ct 2986 -449 3016 -444 3042 -434 ct
+3069 -424 3088 -410 3100 -393 ct 3113 -376 3121 -354 3126 -325 ct 3053 -315 l
+3050 -338 3040 -356 3024 -368 ct 3008 -381 2986 -387 2957 -387 ct 2923 -387 2898 -382 2884 -370 ct
+2869 -359 2862 -346 2862 -331 ct 2862 -321 2865 -312 2871 -305 ct 2877 -297 2887 -290 2900 -285 ct
+2907 -282 2929 -276 2965 -266 ct 3018 -252 3055 -240 3076 -231 ct 3096 -222 3113 -209 3125 -192 ct
+3136 -175 3142 -154 3142 -129 ct 3142 -104 3135 -80 3121 -58 ct 3106 -37 3085 -20 3058 -8 ct
+3031 3 3000 9 2965 9 ct 2908 9 2865 -1 2835 -25 ct 2805 -49 l 2786 -84 l p ef
+3175 -131 m 3248 -142 l 3252 -113 3264 -90 3283 -74 ct 3302 -59 3328 -51 3362 -51 ct
+3396 -51 3421 -58 3438 -72 ct 3455 -86 3463 -102 3463 -121 ct 3463 -138 3456 -151 3441 -160 ct
+3431 -167 3405 -175 3365 -186 ct 3310 -199 3272 -211 3251 -221 ct 3230 -231 3214 -245 3203 -263 ct
+3192 -281 3187 -301 3187 -322 ct 3187 -342 3191 -360 3200 -376 ct 3209 -393 3222 -407 3237 -418 ct
+3249 -427 3264 -434 3284 -440 ct 3304 -446 3326 -449 3349 -449 ct 3383 -449 3413 -444 3439 -434 ct
+3466 -424 3485 -410 3497 -393 ct 3510 -376 3518 -354 3523 -325 ct 3450 -315 l
+3447 -338 3437 -356 3421 -368 ct 3405 -381 3383 -387 3354 -387 ct 3320 -387 3295 -382 3281 -370 ct
+3266 -359 3259 -346 3259 -331 ct 3259 -321 3262 -312 3268 -305 ct 3274 -297 3284 -290 3297 -285 ct
+3304 -282 3326 -276 3362 -266 ct 3415 -252 3452 -240 3473 -231 ct 3493 -222 3510 -209 3522 -192 ct
+3533 -175 3539 -154 3539 -129 ct 3539 -104 3532 -80 3518 -58 ct 3503 -37 3482 -20 3455 -8 ct
+3428 3 3397 9 3362 9 ct 3305 9 3262 -1 3232 -25 ct 3202 -49 l 3183 -84 l p ef
+pom
+pum
+16827 9473 t
+69 0 m 69 -606 l 478 -606 l 478 -534 l 149 -534 l 149 -346 l 434 -346 l
+434 -275 l 149 -275 l 149 0 l p ef
+585 -520 m 585 -606 l 659 -606 l 659 -520 l p
+585 0 m 585 -439 l 659 -439 l 659 0 l p ef
+768 0 m 768 -606 l 842 -606 l 842 0 l p ef
+1118 -66 m 1129 0 l 1108 3 1089 5 1072 5 ct 1045 5 1024 1 1010 -7 ct 995 -15 984 -26 978 -40 ct
+972 -54 969 -83 969 -128 ct 969 -381 l 914 -381 l 914 -439 l 969 -439 l
+969 -547 l 1043 -592 l 1043 -439 l 1118 -439 l 1118 -381 l 1043 -381 l
+1043 -124 l 1043 -103 1044 -89 1047 -83 ct 1050 -77 1054 -72 1060 -69 ct 1066 -65 1074 -63 1085 -63 ct
+1093 -63 l 1104 -64 l p ef
+1494 -141 m 1571 -131 l 1559 -86 1536 -52 1504 -27 ct 1471 -2 1429 9 1378 9 ct
+1314 9 1263 -9 1225 -49 ct 1187 -88 1169 -144 1169 -215 ct 1169 -289 1188 -347 1226 -387 ct
+1264 -428 1313 -449 1374 -449 ct 1432 -449 1480 -429 1518 -389 ct 1555 -349 1573 -292 1573 -220 ct
+1573 -216 1573 -209 1573 -200 ct 1245 -200 l 1248 -152 1262 -115 1286 -89 ct
+1311 -64 1342 -51 1378 -51 ct 1406 -51 1429 -58 1448 -72 ct 1467 -87 l 1483 -110 l
+p
+1250 -261 m 1495 -261 l 1492 -298 1482 -326 1467 -344 ct 1443 -373 1412 -387 1374 -387 ct
+1340 -387 1312 -376 1288 -353 ct 1265 -330 l 1252 -300 l p ef
+1669 0 m 1669 -439 l 1736 -439 l 1736 -372 l 1753 -403 1768 -424 1783 -434 ct
+1797 -444 1813 -449 1831 -449 ct 1856 -449 1881 -441 1907 -425 ct 1882 -356 l
+1863 -366 1845 -372 1827 -372 ct 1811 -372 1796 -367 1783 -357 ct 1770 -347 1761 -334 1755 -316 ct
+1747 -290 1743 -261 1743 -229 ct 1743 0 l p ef
+pom
+gr
+11317 10321 m 11312 10318 l 11099 10206 l 11093 10203 l 10924 10032 l
+10921 10026 l 10811 9811 l 10808 9805 l 10769 9556 l 10769 9549 l
+10808 9299 l 10811 9293 l 10921 9078 l 10924 9072 l 11093 8901 l 11099 8898 l
+11312 8786 l 11317 8784 l 11564 8744 l 11571 8744 l 11817 8784 l 11823 8786 l
+12036 8898 l 12041 8901 l 12210 9072 l 12213 9078 l 12324 9293 l 12326 9299 l
+12366 9549 l 12366 9556 l 12326 9805 l 12324 9811 l 12213 10026 l
+12210 10032 l 12041 10203 l 12036 10206 l 11823 10318 l 11817 10321 l
+11571 10361 l 11564 10361 l 11317 10321 l p
+11567 10319 m 11806 10279 l 12013 10171 l 12178 10004 l 12285 9794 l
+12324 9552 l 12285 9310 l 12178 9100 l 12013 8933 l 11806 8825 l 11567 8786 l
+11328 8825 l 11121 8933 l 10956 9100 l 10849 9310 l 10811 9552 l 10849 9794 l
+10956 10004 l 11121 10171 l 11328 10279 l 11567 10319 l p
+11049 9029 m 11079 8998 l 11286 9208 l 11493 9417 l 11700 9627 l 11907 9837 l
+12115 10048 l 12085 10078 l 11877 9868 l 11670 9658 l 11463 9448 l
+11255 9238 l 11049 9029 l p
+11079 10078 m 11049 10049 l 11255 9838 l 11463 9628 l 11670 9418 l
+11878 9208 l 12086 8998 l 12115 9029 l 11907 9239 l 11700 9449 l 11493 9659 l
+11286 9869 l 11079 10078 l p ef
+1 lw 0 lj 11317 10321 m 11312 10318 l 11099 10206 l 11093 10203 l 10924 10032 l
+10921 10026 l 10811 9811 l 10808 9805 l 10769 9556 l 10769 9549 l
+10808 9299 l 10811 9293 l 10921 9078 l 10924 9072 l 11093 8901 l 11099 8898 l
+11312 8786 l 11317 8784 l 11564 8744 l 11571 8744 l 11817 8784 l 11823 8786 l
+12036 8898 l 12041 8901 l 12210 9072 l 12213 9078 l 12324 9293 l 12326 9299 l
+12366 9549 l 12366 9556 l 12326 9805 l 12324 9811 l 12213 10026 l
+12210 10032 l 12041 10203 l 12036 10206 l 11823 10318 l 11817 10321 l
+11571 10361 l 11564 10361 l 11317 10321 l pc
+11567 10319 m 11806 10279 l 12013 10171 l 12178 10004 l 12285 9794 l
+12324 9552 l 12285 9310 l 12178 9100 l 12013 8933 l 11806 8825 l 11567 8786 l
+11328 8825 l 11121 8933 l 10956 9100 l 10849 9310 l 10811 9552 l 10849 9794 l
+10956 10004 l 11121 10171 l 11328 10279 l 11567 10319 l pc
+11049 9029 m 11079 8998 l 11286 9208 l 11493 9417 l 11700 9627 l 11907 9837 l
+12115 10048 l 12085 10078 l 11877 9868 l 11670 9658 l 11463 9448 l
+11255 9238 l 11049 9029 l pc
+11079 10078 m 11049 10049 l 11255 9838 l 11463 9628 l 11670 9418 l
+11878 9208 l 12086 8998 l 12115 9029 l 11907 9239 l 11700 9449 l 11493 9659 l
+11286 9869 l 11079 10078 l pc
+7989 6986 m 7538 6836 l 7539 7136 l 7989 6986 l p ef
+5716 6986 m 7629 6986 l ps
+14606 6986 m 14155 6836 l 14156 7136 l 14606 6986 l p ef
+9526 6986 m 14246 6986 l ps
+10769 9526 m 10318 9376 l 10319 9676 l 10769 9526 l p ef
+5716 9526 m 10409 9526 l ps
+14606 9526 m 14155 9376 l 14156 9676 l 14606 9526 l p ef
+12426 9526 m 14246 9526 l ps
+0 lw 1 lj 10061 16546 m 6251 16546 l 6251 12736 l 13871 12736 l 13871 16546 l
+10061 16546 l pc
+gs
+pum
+9102 13970 t
+64 0 m 64 -606 l 146 -606 l 465 -130 l 465 -606 l 542 -606 l 542 0 l
+459 0 l 141 -476 l 141 0 l p ef
+1106 -212 m 1187 -192 l 1170 -126 1140 -76 1096 -41 ct 1052 -6 999 10 936 10 ct
+870 10 817 -2 776 -29 ct 735 -56 704 -94 683 -145 ct 661 -195 651 -249 651 -307 ct
+651 -370 663 -425 687 -472 ct 711 -519 745 -555 790 -580 ct 834 -604 883 -616 937 -616 ct
+998 -616 1049 -601 1090 -570 ct 1131 -539 1160 -496 1176 -440 ct 1097 -421 l
+1083 -465 1063 -497 1036 -517 ct 1009 -537 976 -547 935 -547 ct 889 -547 850 -536 818 -514 ct
+787 -492 765 -462 752 -424 ct 740 -386 733 -348 733 -308 ct 733 -256 741 -211 756 -173 ct
+771 -134 794 -105 826 -86 ct 858 -67 892 -58 929 -58 ct 974 -58 1012 -71 1043 -97 ct
+1074 -123 l 1095 -161 l p ef
+1284 -295 m 1284 -395 1311 -474 1366 -531 ct 1420 -588 1489 -617 1575 -617 ct
+1631 -617 1681 -603 1726 -576 ct 1771 -550 1805 -512 1829 -465 ct 1852 -417 1864 -362 1864 -302 ct
+1864 -240 1852 -185 1827 -137 ct 1802 -88 1767 -52 1722 -27 ct 1676 -2 1627 10 1574 10 ct
+1517 10 1466 -3 1421 -31 ct 1376 -58 1342 -96 1319 -143 ct 1296 -191 l 1284 -242 l
+p
+1367 -294 m 1367 -220 1387 -163 1426 -121 ct 1465 -79 1515 -58 1574 -58 ct
+1634 -58 1684 -79 1723 -122 ct 1762 -164 1782 -224 1782 -302 ct 1782 -352 1773 -395 1757 -431 ct
+1740 -468 1715 -497 1683 -517 ct 1651 -537 1615 -547 1575 -547 ct 1518 -547 1470 -528 1429 -489 ct
+1388 -450 l 1367 -385 l p ef
+pom
+pum
+7514 14923 t
+38 -194 m 113 -201 l 117 -171 125 -146 138 -126 ct 151 -107 172 -91 199 -79 ct
+227 -67 258 -61 292 -61 ct 323 -61 350 -66 373 -75 ct 397 -84 414 -96 426 -112 ct
+437 -128 443 -145 443 -164 ct 443 -183 437 -200 426 -214 ct 415 -228 397 -240 372 -250 ct
+355 -256 319 -266 264 -279 ct 208 -293 169 -305 147 -317 ct 118 -332 96 -351 82 -374 ct
+68 -396 61 -421 61 -449 ct 61 -480 69 -508 87 -535 ct 104 -561 130 -582 163 -595 ct
+196 -609 233 -616 274 -616 ct 319 -616 359 -609 393 -594 ct 427 -580 454 -559 472 -531 ct
+491 -502 501 -471 502 -435 ct 425 -429 l 421 -468 407 -496 383 -516 ct 359 -536 324 -545 277 -545 ct
+229 -545 194 -537 171 -519 ct 149 -501 138 -480 138 -454 ct 138 -433 146 -415 162 -401 ct
+177 -387 217 -372 283 -357 ct 348 -343 393 -330 417 -319 ct 452 -303 478 -282 495 -257 ct
+512 -232 520 -203 520 -171 ct 520 -138 511 -108 492 -80 ct 474 -51 447 -29 413 -13 ct
+378 2 339 10 296 10 ct 241 10 195 2 158 -13 ct 121 -29 92 -53 71 -85 ct 50 -117 l
+39 -154 l p ef
+638 -520 m 638 -606 l 712 -606 l 712 -520 l p
+638 0 m 638 -439 l 712 -439 l 712 0 l p ef
+822 0 m 822 -439 l 889 -439 l 889 -376 l 922 -425 968 -449 1029 -449 ct
+1056 -449 1080 -444 1102 -434 ct 1124 -425 1141 -412 1152 -397 ct 1163 -382 1171 -363 1175 -342 ct
+1178 -328 1179 -304 1179 -270 ct 1179 0 l 1105 0 l 1105 -267 l 1105 -297 1102 -320 1096 -335 ct
+1090 -350 1080 -362 1065 -371 ct 1051 -380 1033 -384 1013 -384 ct 982 -384 954 -374 931 -354 ct
+908 -334 897 -296 897 -239 ct 897 0 l p ef
+1600 -141 m 1677 -131 l 1665 -86 1642 -52 1610 -27 ct 1577 -2 1535 9 1484 9 ct
+1420 9 1369 -9 1331 -49 ct 1293 -88 1275 -144 1275 -215 ct 1275 -289 1294 -347 1332 -387 ct
+1370 -428 1419 -449 1480 -449 ct 1538 -449 1586 -429 1624 -389 ct 1661 -349 1679 -292 1679 -220 ct
+1679 -216 1679 -209 1679 -200 ct 1351 -200 l 1354 -152 1368 -115 1392 -89 ct
+1417 -64 1448 -51 1484 -51 ct 1512 -51 1535 -58 1554 -72 ct 1573 -87 l 1589 -110 l
+p
+1356 -261 m 1601 -261 l 1598 -298 1588 -326 1573 -344 ct 1549 -373 1518 -387 1480 -387 ct
+1446 -387 1418 -376 1394 -353 ct 1371 -330 l 1358 -300 l p ef
+1958 10 m 2133 -616 l 2193 -616 l 2017 10 l p ef
+2931 -212 m 3012 -192 l 2995 -126 2965 -76 2921 -41 ct 2877 -6 2824 10 2761 10 ct
+2695 10 2642 -2 2601 -29 ct 2560 -56 2529 -94 2508 -145 ct 2486 -195 2476 -249 2476 -307 ct
+2476 -370 2488 -425 2512 -472 ct 2536 -519 2570 -555 2615 -580 ct 2659 -604 2708 -616 2762 -616 ct
+2823 -616 2874 -601 2915 -570 ct 2956 -539 2985 -496 3001 -440 ct 2922 -421 l
+2908 -465 2888 -497 2861 -517 ct 2834 -537 2801 -547 2760 -547 ct 2714 -547 2675 -536 2643 -514 ct
+2612 -492 2590 -462 2577 -424 ct 2565 -386 2558 -348 2558 -308 ct 2558 -256 2566 -211 2581 -173 ct
+2596 -134 2619 -105 2651 -86 ct 2683 -67 2717 -58 2754 -58 ct 2799 -58 2837 -71 2868 -97 ct
+2899 -123 l 2920 -161 l p ef
+3097 -219 m 3097 -300 3119 -361 3164 -400 ct 3202 -432 3248 -449 3303 -449 ct
+3363 -449 3412 -429 3451 -389 ct 3489 -350 3508 -295 3508 -225 ct 3508 -169 3500 -124 3483 -92 ct
+3466 -60 3441 -34 3409 -16 ct 3376 0 3341 9 3303 9 ct 3241 9 3191 -9 3153 -49 ct
+3116 -88 l 3097 -145 l p
+3173 -219 m 3173 -163 3185 -121 3210 -93 ct 3234 -65 3265 -51 3303 -51 ct 3340 -51 3370 -65 3395 -93 ct
+3419 -121 3432 -164 3432 -222 ct 3432 -276 3419 -317 3395 -345 ct 3370 -373 3339 -387 3303 -387 ct
+3265 -387 3234 -373 3210 -345 ct 3185 -317 l 3173 -275 l p ef
+3571 -131 m 3644 -142 l 3648 -113 3660 -90 3679 -74 ct 3698 -59 3724 -51 3758 -51 ct
+3792 -51 3817 -58 3834 -72 ct 3851 -86 3859 -102 3859 -121 ct 3859 -138 3852 -151 3837 -160 ct
+3827 -167 3801 -175 3761 -186 ct 3706 -199 3668 -211 3647 -221 ct 3626 -231 3610 -245 3599 -263 ct
+3588 -281 3583 -301 3583 -322 ct 3583 -342 3587 -360 3596 -376 ct 3605 -393 3618 -407 3633 -418 ct
+3645 -427 3660 -434 3680 -440 ct 3700 -446 3722 -449 3745 -449 ct 3779 -449 3809 -444 3835 -434 ct
+3862 -424 3881 -410 3893 -393 ct 3906 -376 3914 -354 3919 -325 ct 3846 -315 l
+3843 -338 3833 -356 3817 -368 ct 3801 -381 3779 -387 3750 -387 ct 3716 -387 3691 -382 3677 -370 ct
+3662 -359 3655 -346 3655 -331 ct 3655 -321 3658 -312 3664 -305 ct 3670 -297 3680 -290 3693 -285 ct
+3700 -282 3722 -276 3758 -266 ct 3811 -252 3848 -240 3869 -231 ct 3889 -222 3906 -209 3918 -192 ct
+3929 -175 3935 -154 3935 -129 ct 3935 -104 3928 -80 3914 -58 ct 3899 -37 3878 -20 3851 -8 ct
+3824 3 3793 9 3758 9 ct 3701 9 3658 -1 3628 -25 ct 3598 -49 l 3579 -84 l p ef
+3998 -520 m 3998 -606 l 4072 -606 l 4072 -520 l p
+3998 0 m 3998 -439 l 4072 -439 l 4072 0 l p ef
+4183 0 m 4183 -439 l 4250 -439 l 4250 -376 l 4283 -425 4329 -449 4390 -449 ct
+4417 -449 4441 -444 4463 -434 ct 4485 -425 4502 -412 4513 -397 ct 4524 -382 4532 -363 4536 -342 ct
+4539 -328 4540 -304 4540 -270 ct 4540 0 l 4466 0 l 4466 -267 l 4466 -297 4463 -320 4457 -335 ct
+4451 -350 4441 -362 4426 -371 ct 4412 -380 4394 -384 4374 -384 ct 4343 -384 4315 -374 4292 -354 ct
+4269 -334 4258 -296 4258 -239 ct 4258 0 l p ef
+4960 -141 m 5037 -131 l 5025 -86 5002 -52 4970 -27 ct 4937 -2 4895 9 4844 9 ct
+4780 9 4729 -9 4691 -49 ct 4653 -88 4635 -144 4635 -215 ct 4635 -289 4654 -347 4692 -387 ct
+4730 -428 4779 -449 4840 -449 ct 4898 -449 4946 -429 4984 -389 ct 5021 -349 5039 -292 5039 -220 ct
+5039 -216 5039 -209 5039 -200 ct 4711 -200 l 4714 -152 4728 -115 4752 -89 ct
+4777 -64 4808 -51 4844 -51 ct 4872 -51 4895 -58 4914 -72 ct 4933 -87 l 4949 -110 l
+p
+4716 -261 m 4961 -261 l 4958 -298 4948 -326 4933 -344 ct 4909 -373 4878 -387 4840 -387 ct
+4806 -387 4778 -376 4754 -353 ct 4731 -330 l 4718 -300 l p ef
+pom
+pum
+8136 15876 t
+349 -237 m 349 -308 l 605 -309 l 605 -84 l 566 -52 525 -29 483 -13 ct
+441 2 398 10 354 10 ct 295 10 241 -2 192 -27 ct 143 -53 107 -90 82 -138 ct 57 -186 45 -240 45 -300 ct
+45 -359 57 -414 82 -465 ct 106 -516 142 -554 188 -579 ct 234 -604 288 -616 348 -616 ct
+392 -616 432 -609 467 -595 ct 502 -581 530 -561 550 -535 ct 571 -510 586 -477 596 -436 ct
+524 -416 l 515 -447 504 -472 490 -489 ct 476 -507 457 -521 432 -532 ct 407 -542 379 -547 349 -547 ct
+312 -547 280 -542 253 -531 ct 227 -520 205 -505 189 -487 ct 172 -468 160 -449 150 -427 ct
+135 -389 127 -349 127 -305 ct 127 -251 137 -205 155 -169 ct 174 -133 201 -106 236 -88 ct
+272 -70 310 -62 350 -62 ct 385 -62 418 -68 452 -82 ct 485 -95 510 -109 527 -124 ct
+527 -237 l p ef
+1017 -141 m 1094 -131 l 1082 -86 1059 -52 1027 -27 ct 994 -2 952 9 901 9 ct
+837 9 786 -9 748 -49 ct 710 -88 692 -144 692 -215 ct 692 -289 711 -347 749 -387 ct
+787 -428 836 -449 897 -449 ct 955 -449 1003 -429 1041 -389 ct 1078 -349 1096 -292 1096 -220 ct
+1096 -216 1096 -209 1096 -200 ct 768 -200 l 771 -152 785 -115 809 -89 ct 834 -64 865 -51 901 -51 ct
+929 -51 952 -58 971 -72 ct 990 -87 l 1006 -110 l p
+773 -261 m 1018 -261 l 1015 -298 1005 -326 990 -344 ct 966 -373 935 -387 897 -387 ct
+863 -387 835 -376 811 -353 ct 788 -330 l 775 -300 l p ef
+1193 0 m 1193 -439 l 1260 -439 l 1260 -376 l 1293 -425 1339 -449 1400 -449 ct
+1427 -449 1451 -444 1473 -434 ct 1495 -425 1512 -412 1523 -397 ct 1534 -382 1542 -363 1546 -342 ct
+1549 -328 1550 -304 1550 -270 ct 1550 0 l 1476 0 l 1476 -267 l 1476 -297 1473 -320 1467 -335 ct
+1461 -350 1451 -362 1436 -371 ct 1422 -380 1404 -384 1384 -384 ct 1353 -384 1325 -374 1302 -354 ct
+1279 -334 1268 -296 1268 -239 ct 1268 0 l p ef
+1970 -141 m 2047 -131 l 2035 -86 2012 -52 1980 -27 ct 1947 -2 1905 9 1854 9 ct
+1790 9 1739 -9 1701 -49 ct 1663 -88 1645 -144 1645 -215 ct 1645 -289 1664 -347 1702 -387 ct
+1740 -428 1789 -449 1850 -449 ct 1908 -449 1956 -429 1994 -389 ct 2031 -349 2049 -292 2049 -220 ct
+2049 -216 2049 -209 2049 -200 ct 1721 -200 l 1724 -152 1738 -115 1762 -89 ct
+1787 -64 1818 -51 1854 -51 ct 1882 -51 1905 -58 1924 -72 ct 1943 -87 l 1959 -110 l
+p
+1726 -261 m 1971 -261 l 1968 -298 1958 -326 1943 -344 ct 1919 -373 1888 -387 1850 -387 ct
+1816 -387 1788 -376 1764 -353 ct 1741 -330 l 1728 -300 l p ef
+2145 0 m 2145 -439 l 2212 -439 l 2212 -372 l 2229 -403 2244 -424 2259 -434 ct
+2273 -444 2289 -449 2307 -449 ct 2332 -449 2357 -441 2383 -425 ct 2358 -356 l
+2339 -366 2321 -372 2303 -372 ct 2287 -372 2272 -367 2259 -357 ct 2246 -347 2237 -334 2231 -316 ct
+2223 -290 2219 -261 2219 -229 ct 2219 0 l p ef
+2723 -54 m 2695 -30 2669 -14 2643 -4 ct 2618 5 2590 9 2561 9 ct 2513 9 2476 -1 2450 -25 ct
+2424 -49 2411 -79 2411 -115 ct 2411 -137 2416 -156 2426 -174 ct 2436 -192 2448 -206 2464 -217 ct
+2480 -228 2498 -236 2518 -241 ct 2532 -245 2554 -249 2584 -253 ct 2644 -260 2688 -268 2717 -278 ct
+2717 -288 2717 -295 2717 -298 ct 2717 -328 2710 -349 2696 -362 ct 2677 -379 2649 -387 2611 -387 ct
+2576 -387 2550 -381 2534 -369 ct 2517 -356 2505 -335 2497 -303 ct 2424 -313 l
+2431 -345 2441 -370 2457 -389 ct 2472 -408 2494 -423 2522 -433 ct 2551 -443 2584 -449 2622 -449 ct
+2660 -449 2690 -444 2713 -435 ct 2737 -427 2754 -415 2765 -402 ct 2776 -389 2784 -372 2788 -351 ct
+2791 -339 2792 -316 2792 -283 ct 2792 -184 l 2792 -114 2794 -71 2797 -52 ct
+2800 -34 2806 -16 2816 0 ct 2738 0 l 2730 -15 l 2725 -33 l p
+2717 -220 m 2690 -209 2649 -200 2595 -192 ct 2565 -187 2543 -182 2530 -177 ct
+2518 -171 2508 -163 2501 -153 ct 2494 -142 2491 -130 2491 -117 ct 2491 -98 2498 -81 2513 -68 ct
+2528 -55 2550 -48 2579 -48 ct 2608 -48 2633 -54 2656 -67 ct 2678 -79 2694 -96 2705 -118 ct
+2713 -135 2717 -160 2717 -193 ct p ef
+3049 -66 m 3060 0 l 3039 3 3020 5 3003 5 ct 2976 5 2955 1 2941 -7 ct 2926 -15 2915 -26 2909 -40 ct
+2903 -54 2900 -83 2900 -128 ct 2900 -381 l 2845 -381 l 2845 -439 l 2900 -439 l
+2900 -547 l 2974 -592 l 2974 -439 l 3049 -439 l 3049 -381 l 2974 -381 l
+2974 -124 l 2974 -103 2975 -89 2978 -83 ct 2981 -77 2985 -72 2991 -69 ct 2997 -65 3005 -63 3016 -63 ct
+3024 -63 l 3035 -64 l p ef
+3097 -219 m 3097 -300 3119 -361 3164 -400 ct 3202 -432 3248 -449 3303 -449 ct
+3363 -449 3412 -429 3451 -389 ct 3489 -350 3508 -295 3508 -225 ct 3508 -169 3500 -124 3483 -92 ct
+3466 -60 3441 -34 3409 -16 ct 3376 0 3341 9 3303 9 ct 3241 9 3191 -9 3153 -49 ct
+3116 -88 l 3097 -145 l p
+3173 -219 m 3173 -163 3185 -121 3210 -93 ct 3234 -65 3265 -51 3303 -51 ct 3340 -51 3370 -65 3395 -93 ct
+3419 -121 3432 -164 3432 -222 ct 3432 -276 3419 -317 3395 -345 ct 3370 -373 3339 -387 3303 -387 ct
+3265 -387 3234 -373 3210 -345 ct 3185 -317 l 3173 -275 l p ef
+3600 0 m 3600 -439 l 3667 -439 l 3667 -372 l 3684 -403 3699 -424 3714 -434 ct
+3728 -444 3744 -449 3762 -449 ct 3787 -449 3812 -441 3838 -425 ct 3813 -356 l
+3794 -366 3776 -372 3758 -372 ct 3742 -372 3727 -367 3714 -357 ct 3701 -347 3692 -334 3686 -316 ct
+3678 -290 3674 -261 3674 -229 ct 3674 0 l p ef
+pom
+gr
+gs
+pum
+1284 9366 t
+79 0 m 79 -606 l 159 -606 l 159 0 l p ef
+293 0 m 293 -439 l 360 -439 l 360 -376 l 393 -425 439 -449 500 -449 ct
+527 -449 551 -444 573 -434 ct 595 -425 612 -412 623 -397 ct 634 -382 642 -363 646 -342 ct
+649 -328 650 -304 650 -270 ct 650 0 l 576 0 l 576 -267 l 576 -297 573 -320 567 -335 ct
+561 -350 551 -362 536 -371 ct 522 -380 504 -384 484 -384 ct 453 -384 425 -374 402 -354 ct
+379 -334 368 -296 368 -239 ct 368 0 l p ef
+769 168 m 769 -439 l 837 -439 l 837 -382 l 853 -404 871 -421 891 -432 ct
+911 -443 936 -449 965 -449 ct 1002 -449 1035 -439 1064 -420 ct 1092 -400 1114 -373 1129 -338 ct
+1143 -303 1151 -264 1151 -222 ct 1151 -177 1143 -137 1126 -101 ct 1110 -65 1087 -37 1056 -18 ct
+1025 0 993 9 959 9 ct 934 9 912 4 892 -5 ct 873 -16 856 -29 844 -45 ct 844 168 l
+p
+837 -217 m 837 -160 848 -118 871 -91 ct 894 -64 922 -51 954 -51 ct 987 -51 1016 -65 1039 -93 ct
+1063 -121 1075 -164 1075 -223 ct 1075 -279 1063 -321 1040 -349 ct 1017 -376 990 -390 958 -390 ct
+926 -390 898 -376 873 -346 ct 849 -316 l 837 -273 l p ef
+1507 0 m 1507 -64 l 1473 -14 1427 9 1368 9 ct 1342 9 1318 4 1295 -4 ct 1273 -14 1256 -27 1245 -42 ct
+1234 -57 1227 -75 1222 -97 ct 1219 -112 1218 -135 1218 -167 ct 1218 -439 l 1292 -439 l
+1292 -195 l 1292 -156 1294 -130 1297 -117 ct 1301 -97 1311 -82 1326 -70 ct
+1342 -59 1360 -54 1383 -54 ct 1405 -54 1426 -59 1446 -71 ct 1465 -82 1479 -98 1487 -118 ct
+1495 -137 1499 -166 1499 -203 ct 1499 -439 l 1574 -439 l 1574 0 l p ef
+1858 -66 m 1869 0 l 1848 3 1829 5 1812 5 ct 1785 5 1764 1 1750 -7 ct 1735 -15 1724 -26 1718 -40 ct
+1712 -54 1709 -83 1709 -128 ct 1709 -381 l 1654 -381 l 1654 -439 l 1709 -439 l
+1709 -547 l 1783 -592 l 1783 -439 l 1858 -439 l 1858 -381 l 1783 -381 l
+1783 -124 l 1783 -103 1784 -89 1787 -83 ct 1790 -77 1794 -72 1800 -69 ct 1806 -65 1814 -63 1825 -63 ct
+1833 -63 l 1844 -64 l p ef
+2190 0 m 2190 -381 l 2124 -381 l 2124 -439 l 2190 -439 l 2190 -485 l
+2190 -515 2193 -537 2198 -551 ct 2205 -571 2218 -586 2236 -598 ct 2254 -610 2279 -616 2312 -616 ct
+2333 -616 2356 -614 2381 -609 ct 2370 -544 l 2355 -547 2340 -548 2326 -548 ct
+2304 -548 2288 -543 2278 -533 ct 2269 -524 2264 -506 2264 -479 ct 2264 -439 l
+2350 -439 l 2350 -381 l 2264 -381 l 2264 0 l p ef
+2410 0 m 2410 -439 l 2477 -439 l 2477 -372 l 2494 -403 2509 -424 2524 -434 ct
+2538 -444 2554 -449 2572 -449 ct 2597 -449 2622 -441 2648 -425 ct 2623 -356 l
+2604 -366 2586 -372 2568 -372 ct 2552 -372 2537 -367 2524 -357 ct 2511 -347 2502 -334 2496 -316 ct
+2488 -290 2484 -261 2484 -229 ct 2484 0 l p ef
+2674 -219 m 2674 -300 2696 -361 2741 -400 ct 2779 -432 2825 -449 2880 -449 ct
+2940 -449 2989 -429 3028 -389 ct 3066 -350 3085 -295 3085 -225 ct 3085 -169 3077 -124 3060 -92 ct
+3043 -60 3018 -34 2986 -16 ct 2953 0 2918 9 2880 9 ct 2818 9 2768 -9 2730 -49 ct
+2693 -88 l 2674 -145 l p
+2750 -219 m 2750 -163 2762 -121 2787 -93 ct 2811 -65 2842 -51 2880 -51 ct 2917 -51 2947 -65 2972 -93 ct
+2996 -121 3009 -164 3009 -222 ct 3009 -276 2996 -317 2972 -345 ct 2947 -373 2916 -387 2880 -387 ct
+2842 -387 2811 -373 2787 -345 ct 2762 -317 l 2750 -275 l p ef
+3177 0 m 3177 -439 l 3244 -439 l 3244 -377 l 3258 -399 3276 -416 3299 -429 ct
+3322 -442 3348 -449 3377 -449 ct 3410 -449 3436 -442 3457 -428 ct 3478 -415 3493 -396 3501 -372 ct
+3536 -423 3581 -449 3637 -449 ct 3680 -449 3714 -437 3737 -412 ct 3761 -388 3772 -351 3772 -301 ct
+3772 0 l 3698 0 l 3698 -276 l 3698 -306 3696 -327 3691 -340 ct 3686 -354 3678 -364 3665 -372 ct
+3652 -380 3637 -384 3620 -384 ct 3589 -384 3564 -374 3543 -353 ct 3523 -333 3513 -300 3513 -255 ct
+3513 0 l 3438 0 l 3438 -285 l 3438 -318 3432 -343 3420 -359 ct 3408 -376 3388 -384 3361 -384 ct
+3340 -384 3320 -379 3302 -368 ct 3285 -357 3272 -340 3264 -319 ct 3256 -298 3252 -267 3252 -227 ct
+3252 0 l p ef
+pom
+pum
+2302 10319 t
+-1 0 m 231 -606 l 318 -606 l 566 0 l 474 0 l 404 -183 l 150 -183 l
+83 0 l p
+173 -248 m 379 -248 l 315 -416 l 296 -467 282 -509 272 -542 ct 265 -503 254 -465 240 -426 ct
+p ef
+621 0 m 621 -606 l 830 -606 l 877 -606 913 -603 938 -597 ct 972 -589 1002 -575 1027 -554 ct
+1059 -527 1082 -492 1098 -450 ct 1114 -408 1122 -360 1122 -306 ct 1122 -260 1117 -219 1106 -184 ct
+1095 -148 1081 -119 1065 -95 ct 1048 -72 1029 -54 1009 -40 ct 989 -27 965 -17 937 -10 ct
+909 -3 876 0 840 0 ct p
+701 -71 m 831 -71 l 871 -71 902 -75 925 -82 ct 947 -90 965 -100 979 -114 ct
+998 -133 1013 -158 1023 -190 ct 1034 -222 1039 -261 1039 -307 ct 1039 -371 1029 -419 1008 -453 ct
+987 -487 962 -510 932 -522 ct 911 -530 876 -534 828 -534 ct 701 -534 l p ef
+1661 -212 m 1742 -192 l 1725 -126 1695 -76 1651 -41 ct 1607 -6 1554 10 1491 10 ct
+1425 10 1372 -2 1331 -29 ct 1290 -56 1259 -94 1238 -145 ct 1216 -195 1206 -249 1206 -307 ct
+1206 -370 1218 -425 1242 -472 ct 1266 -519 1300 -555 1345 -580 ct 1389 -604 1438 -616 1492 -616 ct
+1553 -616 1604 -601 1645 -570 ct 1686 -539 1715 -496 1731 -440 ct 1652 -421 l
+1638 -465 1618 -497 1591 -517 ct 1564 -537 1531 -547 1490 -547 ct 1444 -547 1405 -536 1373 -514 ct
+1342 -492 1320 -462 1307 -424 ct 1295 -386 1288 -348 1288 -308 ct 1288 -256 1296 -211 1311 -173 ct
+1326 -134 1349 -105 1381 -86 ct 1413 -67 1447 -58 1484 -58 ct 1529 -58 1567 -71 1598 -97 ct
+1629 -123 l 1650 -161 l p ef
+pom
+gr
+gs
+pum
+1284 6773 t
+79 0 m 79 -606 l 159 -606 l 159 0 l p ef
+293 0 m 293 -439 l 360 -439 l 360 -376 l 393 -425 439 -449 500 -449 ct
+527 -449 551 -444 573 -434 ct 595 -425 612 -412 623 -397 ct 634 -382 642 -363 646 -342 ct
+649 -328 650 -304 650 -270 ct 650 0 l 576 0 l 576 -267 l 576 -297 573 -320 567 -335 ct
+561 -350 551 -362 536 -371 ct 522 -380 504 -384 484 -384 ct 453 -384 425 -374 402 -354 ct
+379 -334 368 -296 368 -239 ct 368 0 l p ef
+769 168 m 769 -439 l 837 -439 l 837 -382 l 853 -404 871 -421 891 -432 ct
+911 -443 936 -449 965 -449 ct 1002 -449 1035 -439 1064 -420 ct 1092 -400 1114 -373 1129 -338 ct
+1143 -303 1151 -264 1151 -222 ct 1151 -177 1143 -137 1126 -101 ct 1110 -65 1087 -37 1056 -18 ct
+1025 0 993 9 959 9 ct 934 9 912 4 892 -5 ct 873 -16 856 -29 844 -45 ct 844 168 l
+p
+837 -217 m 837 -160 848 -118 871 -91 ct 894 -64 922 -51 954 -51 ct 987 -51 1016 -65 1039 -93 ct
+1063 -121 1075 -164 1075 -223 ct 1075 -279 1063 -321 1040 -349 ct 1017 -376 990 -390 958 -390 ct
+926 -390 898 -376 873 -346 ct 849 -316 l 837 -273 l p ef
+1507 0 m 1507 -64 l 1473 -14 1427 9 1368 9 ct 1342 9 1318 4 1295 -4 ct 1273 -14 1256 -27 1245 -42 ct
+1234 -57 1227 -75 1222 -97 ct 1219 -112 1218 -135 1218 -167 ct 1218 -439 l 1292 -439 l
+1292 -195 l 1292 -156 1294 -130 1297 -117 ct 1301 -97 1311 -82 1326 -70 ct
+1342 -59 1360 -54 1383 -54 ct 1405 -54 1426 -59 1446 -71 ct 1465 -82 1479 -98 1487 -118 ct
+1495 -137 1499 -166 1499 -203 ct 1499 -439 l 1574 -439 l 1574 0 l p ef
+1858 -66 m 1869 0 l 1848 3 1829 5 1812 5 ct 1785 5 1764 1 1750 -7 ct 1735 -15 1724 -26 1718 -40 ct
+1712 -54 1709 -83 1709 -128 ct 1709 -381 l 1654 -381 l 1654 -439 l 1709 -439 l
+1709 -547 l 1783 -592 l 1783 -439 l 1858 -439 l 1858 -381 l 1783 -381 l
+1783 -124 l 1783 -103 1784 -89 1787 -83 ct 1790 -77 1794 -72 1800 -69 ct 1806 -65 1814 -63 1825 -63 ct
+1833 -63 l 1844 -64 l p ef
+2190 0 m 2190 -381 l 2124 -381 l 2124 -439 l 2190 -439 l 2190 -485 l
+2190 -515 2193 -537 2198 -551 ct 2205 -571 2218 -586 2236 -598 ct 2254 -610 2279 -616 2312 -616 ct
+2333 -616 2356 -614 2381 -609 ct 2370 -544 l 2355 -547 2340 -548 2326 -548 ct
+2304 -548 2288 -543 2278 -533 ct 2269 -524 2264 -506 2264 -479 ct 2264 -439 l
+2350 -439 l 2350 -381 l 2264 -381 l 2264 0 l p ef
+2410 0 m 2410 -439 l 2477 -439 l 2477 -372 l 2494 -403 2509 -424 2524 -434 ct
+2538 -444 2554 -449 2572 -449 ct 2597 -449 2622 -441 2648 -425 ct 2623 -356 l
+2604 -366 2586 -372 2568 -372 ct 2552 -372 2537 -367 2524 -357 ct 2511 -347 2502 -334 2496 -316 ct
+2488 -290 2484 -261 2484 -229 ct 2484 0 l p ef
+2674 -219 m 2674 -300 2696 -361 2741 -400 ct 2779 -432 2825 -449 2880 -449 ct
+2940 -449 2989 -429 3028 -389 ct 3066 -350 3085 -295 3085 -225 ct 3085 -169 3077 -124 3060 -92 ct
+3043 -60 3018 -34 2986 -16 ct 2953 0 2918 9 2880 9 ct 2818 9 2768 -9 2730 -49 ct
+2693 -88 l 2674 -145 l p
+2750 -219 m 2750 -163 2762 -121 2787 -93 ct 2811 -65 2842 -51 2880 -51 ct 2917 -51 2947 -65 2972 -93 ct
+2996 -121 3009 -164 3009 -222 ct 3009 -276 2996 -317 2972 -345 ct 2947 -373 2916 -387 2880 -387 ct
+2842 -387 2811 -373 2787 -345 ct 2762 -317 l 2750 -275 l p ef
+3177 0 m 3177 -439 l 3244 -439 l 3244 -377 l 3258 -399 3276 -416 3299 -429 ct
+3322 -442 3348 -449 3377 -449 ct 3410 -449 3436 -442 3457 -428 ct 3478 -415 3493 -396 3501 -372 ct
+3536 -423 3581 -449 3637 -449 ct 3680 -449 3714 -437 3737 -412 ct 3761 -388 3772 -351 3772 -301 ct
+3772 0 l 3698 0 l 3698 -276 l 3698 -306 3696 -327 3691 -340 ct 3686 -354 3678 -364 3665 -372 ct
+3652 -380 3637 -384 3620 -384 ct 3589 -384 3564 -374 3543 -353 ct 3523 -333 3513 -300 3513 -255 ct
+3513 0 l 3438 0 l 3438 -285 l 3438 -318 3432 -343 3420 -359 ct 3408 -376 3388 -384 3361 -384 ct
+3340 -384 3320 -379 3302 -368 ct 3285 -357 3272 -340 3264 -319 ct 3256 -298 3252 -267 3252 -227 ct
+3252 0 l p ef
+pom
+pum
+2302 7726 t
+-1 0 m 231 -606 l 318 -606 l 566 0 l 474 0 l 404 -183 l 150 -183 l
+83 0 l p
+173 -248 m 379 -248 l 315 -416 l 296 -467 282 -509 272 -542 ct 265 -503 254 -465 240 -426 ct
+p ef
+621 0 m 621 -606 l 830 -606 l 877 -606 913 -603 938 -597 ct 972 -589 1002 -575 1027 -554 ct
+1059 -527 1082 -492 1098 -450 ct 1114 -408 1122 -360 1122 -306 ct 1122 -260 1117 -219 1106 -184 ct
+1095 -148 1081 -119 1065 -95 ct 1048 -72 1029 -54 1009 -40 ct 989 -27 965 -17 937 -10 ct
+909 -3 876 0 840 0 ct p
+701 -71 m 831 -71 l 871 -71 902 -75 925 -82 ct 947 -90 965 -100 979 -114 ct
+998 -133 1013 -158 1023 -190 ct 1034 -222 1039 -261 1039 -307 ct 1039 -371 1029 -419 1008 -453 ct
+987 -487 962 -510 932 -522 ct 911 -530 876 -534 828 -534 ct 701 -534 l p ef
+1661 -212 m 1742 -192 l 1725 -126 1695 -76 1651 -41 ct 1607 -6 1554 10 1491 10 ct
+1425 10 1372 -2 1331 -29 ct 1290 -56 1259 -94 1238 -145 ct 1216 -195 1206 -249 1206 -307 ct
+1206 -370 1218 -425 1242 -472 ct 1266 -519 1300 -555 1345 -580 ct 1389 -604 1438 -616 1492 -616 ct
+1553 -616 1604 -601 1645 -570 ct 1686 -539 1715 -496 1731 -440 ct 1652 -421 l
+1638 -465 1618 -497 1591 -517 ct 1564 -537 1531 -547 1490 -547 ct 1444 -547 1405 -536 1373 -514 ct
+1342 -492 1320 -462 1307 -424 ct 1295 -386 1288 -348 1288 -308 ct 1288 -256 1296 -211 1311 -173 ct
+1326 -134 1349 -105 1381 -86 ct 1413 -67 1447 -58 1484 -58 ct 1529 -58 1567 -71 1598 -97 ct
+1629 -123 l 1650 -161 l p ef
+pom
+gr
+8442 7781 m 8437 7778 l 8224 7666 l 8218 7663 l 8049 7492 l 8046 7486 l
+7936 7271 l 7933 7265 l 7894 7016 l 7894 7009 l 7933 6759 l 7936 6753 l
+8046 6538 l 8049 6532 l 8218 6361 l 8224 6358 l 8437 6246 l 8442 6244 l
+8689 6204 l 8696 6204 l 8942 6244 l 8948 6246 l 9161 6358 l 9166 6361 l
+9335 6532 l 9338 6538 l 9449 6753 l 9451 6759 l 9491 7009 l 9491 7016 l
+9451 7265 l 9449 7271 l 9338 7486 l 9335 7492 l 9166 7663 l 9161 7666 l
+8948 7778 l 8942 7781 l 8696 7821 l 8689 7821 l 8442 7781 l p
+8692 7779 m 8931 7739 l 9138 7631 l 9303 7464 l 9410 7254 l 9449 7012 l
+9410 6770 l 9303 6560 l 9138 6393 l 8931 6285 l 8692 6246 l 8453 6285 l
+8246 6393 l 8081 6560 l 7974 6770 l 7936 7012 l 7974 7254 l 8081 7464 l
+8246 7631 l 8453 7739 l 8692 7779 l p
+8174 6489 m 8204 6458 l 8411 6668 l 8618 6877 l 8825 7087 l 9032 7297 l
+9240 7508 l 9210 7538 l 9002 7328 l 8795 7118 l 8588 6908 l 8380 6698 l
+8174 6489 l p
+8204 7538 m 8174 7509 l 8380 7298 l 8588 7088 l 8795 6878 l 9003 6668 l
+9211 6458 l 9240 6489 l 9032 6699 l 8825 6909 l 8618 7119 l 8411 7329 l
+8204 7538 l p ef
+1 lw 0 lj 8442 7781 m 8437 7778 l 8224 7666 l 8218 7663 l 8049 7492 l
+8046 7486 l 7936 7271 l 7933 7265 l 7894 7016 l 7894 7009 l 7933 6759 l
+7936 6753 l 8046 6538 l 8049 6532 l 8218 6361 l 8224 6358 l 8437 6246 l
+8442 6244 l 8689 6204 l 8696 6204 l 8942 6244 l 8948 6246 l 9161 6358 l
+9166 6361 l 9335 6532 l 9338 6538 l 9449 6753 l 9451 6759 l 9491 7009 l
+9491 7016 l 9451 7265 l 9449 7271 l 9338 7486 l 9335 7492 l 9166 7663 l
+9161 7666 l 8948 7778 l 8942 7781 l 8696 7821 l 8689 7821 l 8442 7781 l
+pc
+8692 7779 m 8931 7739 l 9138 7631 l 9303 7464 l 9410 7254 l 9449 7012 l
+9410 6770 l 9303 6560 l 9138 6393 l 8931 6285 l 8692 6246 l 8453 6285 l
+8246 6393 l 8081 6560 l 7974 6770 l 7936 7012 l 7974 7254 l 8081 7464 l
+8246 7631 l 8453 7739 l 8692 7779 l pc
+8174 6489 m 8204 6458 l 8411 6668 l 8618 6877 l 8825 7087 l 9032 7297 l
+9240 7508 l 9210 7538 l 9002 7328 l 8795 7118 l 8588 6908 l 8380 6698 l
+8174 6489 l pc
+8204 7538 m 8174 7509 l 8380 7298 l 8588 7088 l 8795 6878 l 9003 6668 l
+9211 6458 l 9240 6489 l 9032 6699 l 8825 6909 l 8618 7119 l 8411 7329 l
+8204 7538 l pc
+8691 7821 m 8541 8271 l 8841 8270 l 8691 7821 l p ef
+8691 8181 m 8691 12701 l ps
+11531 10361 m 11381 10811 l 11681 10810 l 11531 10361 l p ef
+11531 10721 m 11531 12701 l ps
+gs
+pum
+7329 12171 t
+26 -131 m 99 -142 l 103 -113 115 -90 134 -74 ct 153 -59 179 -51 213 -51 ct
+247 -51 272 -58 289 -72 ct 306 -86 314 -102 314 -121 ct 314 -138 307 -151 292 -160 ct
+282 -167 256 -175 216 -186 ct 161 -199 123 -211 102 -221 ct 81 -231 65 -245 54 -263 ct
+43 -281 38 -301 38 -322 ct 38 -342 42 -360 51 -376 ct 60 -393 73 -407 88 -418 ct
+100 -427 115 -434 135 -440 ct 155 -446 177 -449 200 -449 ct 234 -449 264 -444 290 -434 ct
+317 -424 336 -410 348 -393 ct 361 -376 369 -354 374 -325 ct 301 -315 l 298 -338 288 -356 272 -368 ct
+256 -381 234 -387 205 -387 ct 171 -387 146 -382 132 -370 ct 117 -359 110 -346 110 -331 ct
+110 -321 113 -312 119 -305 ct 125 -297 135 -290 148 -285 ct 155 -282 177 -276 213 -266 ct
+266 -252 303 -240 324 -231 ct 344 -222 361 -209 373 -192 ct 384 -175 390 -154 390 -129 ct
+390 -104 383 -80 369 -58 ct 354 -37 333 -20 306 -8 ct 279 3 248 9 213 9 ct 156 9 113 -1 83 -25 ct
+53 -49 l 34 -84 l p ef
+453 -520 m 453 -606 l 527 -606 l 527 -520 l p
+453 0 m 453 -439 l 527 -439 l 527 0 l p ef
+637 0 m 637 -439 l 704 -439 l 704 -376 l 737 -425 783 -449 844 -449 ct
+871 -449 895 -444 917 -434 ct 939 -425 956 -412 967 -397 ct 978 -382 986 -363 990 -342 ct
+993 -328 994 -304 994 -270 ct 994 0 l 920 0 l 920 -267 l 920 -297 917 -320 911 -335 ct
+905 -350 895 -362 880 -371 ct 866 -380 848 -384 828 -384 ct 797 -384 769 -374 746 -354 ct
+723 -334 712 -296 712 -239 ct 712 0 l p ef
+pom
+gr
+gs
+pum
+11880 12223 t
+342 -160 m 415 -151 l 407 -100 387 -61 354 -32 ct 321 -4 280 9 232 9 ct 172 9 124 -9 87 -49 ct
+51 -88 33 -144 33 -217 ct 33 -265 40 -306 56 -342 ct 72 -378 96 -404 128 -422 ct
+160 -440 195 -449 233 -449 ct 280 -449 319 -437 350 -412 ct 380 -388 400 -354 408 -310 ct
+336 -299 l 329 -328 317 -350 299 -365 ct 282 -380 260 -387 236 -387 ct 198 -387 168 -374 144 -347 ct
+121 -320 109 -278 109 -220 ct 109 -161 120 -118 143 -91 ct 166 -64 195 -51 232 -51 ct
+261 -51 285 -60 305 -78 ct 324 -96 l 337 -123 l p ef
+451 -219 m 451 -300 473 -361 518 -400 ct 556 -432 602 -449 657 -449 ct 717 -449 766 -429 805 -389 ct
+843 -350 862 -295 862 -225 ct 862 -169 854 -124 837 -92 ct 820 -60 795 -34 763 -16 ct
+730 0 695 9 657 9 ct 595 9 545 -9 507 -49 ct 470 -88 l 451 -145 l p
+527 -219 m 527 -163 539 -121 564 -93 ct 588 -65 619 -51 657 -51 ct 694 -51 724 -65 749 -93 ct
+773 -121 786 -164 786 -222 ct 786 -276 773 -317 749 -345 ct 724 -373 693 -387 657 -387 ct
+619 -387 588 -373 564 -345 ct 539 -317 l 527 -275 l p ef
+926 -131 m 999 -142 l 1003 -113 1015 -90 1034 -74 ct 1053 -59 1079 -51 1113 -51 ct
+1147 -51 1172 -58 1189 -72 ct 1206 -86 1214 -102 1214 -121 ct 1214 -138 1207 -151 1192 -160 ct
+1182 -167 1156 -175 1116 -186 ct 1061 -199 1023 -211 1002 -221 ct 981 -231 965 -245 954 -263 ct
+943 -281 938 -301 938 -322 ct 938 -342 942 -360 951 -376 ct 960 -393 973 -407 988 -418 ct
+1000 -427 1015 -434 1035 -440 ct 1055 -446 1077 -449 1100 -449 ct 1134 -449 1164 -444 1190 -434 ct
+1217 -424 1236 -410 1248 -393 ct 1261 -376 1269 -354 1274 -325 ct 1201 -315 l
+1198 -338 1188 -356 1172 -368 ct 1156 -381 1134 -387 1105 -387 ct 1071 -387 1046 -382 1032 -370 ct
+1017 -359 1010 -346 1010 -331 ct 1010 -321 1013 -312 1019 -305 ct 1025 -297 1035 -290 1048 -285 ct
+1055 -282 1077 -276 1113 -266 ct 1166 -252 1203 -240 1224 -231 ct 1244 -222 1261 -209 1273 -192 ct
+1284 -175 1290 -154 1290 -129 ct 1290 -104 1283 -80 1269 -58 ct 1254 -37 1233 -20 1206 -8 ct
+1179 3 1148 9 1113 9 ct 1056 9 1013 -1 983 -25 ct 953 -49 l 934 -84 l p ef
+pom
+gr
+24131 6986 m 23680 6836 l 23681 7136 l 24131 6986 l p ef
+20956 6986 m 23771 6986 l ps
+24131 9526 m 23680 9376 l 23681 9676 l 24131 9526 l p ef
+20956 9526 m 23771 9526 l ps
+gs
+pum
+24646 7223 t
+79 0 m 79 -606 l 159 -606 l 159 0 l p ef
+pom
+gr
+gs
+pum
+24435 9763 t
+524 -64 m 562 -39 596 -20 627 -8 ct 604 47 l 560 31 517 6 473 -27 ct 429 -2 379 10 325 10 ct
+270 10 220 -2 175 -29 ct 131 -55 96 -93 72 -141 ct 48 -189 36 -243 36 -303 ct 36 -362 48 -417 72 -466 ct
+97 -515 131 -552 176 -578 ct 221 -604 271 -617 326 -617 ct 382 -617 433 -603 478 -577 ct
+523 -550 557 -513 580 -465 ct 604 -417 616 -363 616 -303 ct 616 -253 608 -208 593 -168 ct
+578 -129 l 555 -94 l p
+348 -167 m 394 -154 432 -135 462 -109 ct 509 -152 533 -217 533 -303 ct 533 -352 525 -395 508 -432 ct
+491 -468 467 -497 435 -517 ct 403 -537 367 -547 327 -547 ct 267 -547 217 -527 178 -486 ct
+138 -445 119 -384 119 -303 ct 119 -224 138 -163 177 -121 ct 216 -79 266 -58 327 -58 ct
+355 -58 382 -63 408 -74 ct 383 -90 356 -102 328 -109 ct p ef
+pom
+gr
+gs
+pum
+23747 3307 t
+315 0 m 241 0 l 241 -474 l 223 -457 199 -440 170 -423 ct 141 -405 115 -393 92 -384 ct
+92 -456 l 133 -476 170 -499 201 -527 ct 232 -555 254 -582 267 -608 ct 315 -608 l
+p ef
+897 -457 m 823 -452 l 816 -481 807 -502 795 -515 ct 775 -536 750 -547 720 -547 ct
+697 -547 676 -540 658 -527 ct 634 -510 616 -485 602 -452 ct 589 -420 582 -373 581 -312 ct
+599 -339 621 -360 647 -373 ct 673 -386 700 -393 729 -393 ct 778 -393 820 -375 855 -338 ct
+890 -301 908 -254 908 -196 ct 908 -158 899 -123 883 -90 ct 867 -58 844 -33 815 -15 ct
+787 1 754 10 718 10 ct 656 10 605 -12 566 -58 ct 527 -103 507 -178 507 -283 ct
+507 -400 529 -486 572 -539 ct 610 -585 661 -608 725 -608 ct 773 -608 812 -595 842 -568 ct
+873 -541 l 891 -504 l p
+593 -196 m 593 -170 598 -146 609 -122 ct 620 -99 635 -81 655 -69 ct 675 -57 695 -50 717 -50 ct
+748 -50 775 -63 798 -88 ct 820 -114 832 -148 832 -192 ct 832 -234 820 -267 798 -291 ct
+776 -315 748 -327 714 -327 ct 680 -327 652 -315 628 -291 ct 605 -267 l 593 -235 l
+p ef
+952 -181 m 952 -256 l 1181 -256 l 1181 -181 l p ef
+1341 0 m 1272 0 l 1272 -606 l 1346 -606 l 1346 -390 l 1378 -429 1418 -449 1467 -449 ct
+1494 -449 1519 -443 1543 -432 ct 1568 -421 1587 -406 1603 -386 ct 1619 -367 1631 -343 1640 -315 ct
+1648 -287 1653 -257 1653 -226 ct 1653 -150 1634 -92 1597 -51 ct 1560 -10 1515 9 1463 9 ct
+1411 9 1370 -11 1341 -55 ct p
+1340 -222 m 1340 -170 1347 -132 1362 -108 ct 1385 -70 1417 -51 1457 -51 ct
+1489 -51 1517 -65 1541 -93 ct 1565 -121 1577 -164 1577 -220 ct 1577 -277 1565 -319 1543 -346 ct
+1520 -374 1492 -387 1460 -387 ct 1428 -387 1399 -373 1376 -345 ct 1352 -317 l
+1340 -276 l p ef
+1723 -520 m 1723 -606 l 1797 -606 l 1797 -520 l p
+1723 0 m 1723 -439 l 1797 -439 l 1797 0 l p ef
+2070 -66 m 2081 0 l 2060 3 2041 5 2024 5 ct 1997 5 1976 1 1962 -7 ct 1947 -15 1936 -26 1930 -40 ct
+1924 -54 1921 -83 1921 -128 ct 1921 -381 l 1866 -381 l 1866 -439 l 1921 -439 l
+1921 -547 l 1995 -592 l 1995 -439 l 2070 -439 l 2070 -381 l 1995 -381 l
+1995 -124 l 1995 -103 1996 -89 1999 -83 ct 2002 -77 2006 -72 2012 -69 ct 2018 -65 2026 -63 2037 -63 ct
+2045 -63 l 2056 -64 l p ef
+pom
+pum
+22596 4260 t
+340 0 m 340 -55 l 312 -11 272 9 217 9 ct 182 9 150 0 121 -19 ct 92 -38 69 -65 53 -99 ct
+37 -134 28 -174 28 -219 ct 28 -263 36 -302 50 -338 ct 65 -374 87 -401 116 -420 ct
+145 -439 178 -449 214 -449 ct 241 -449 264 -443 285 -432 ct 306 -421 322 -406 335 -388 ct
+335 -606 l 409 -606 l 409 0 l p
+105 -219 m 105 -162 117 -120 141 -93 ct 164 -65 192 -51 224 -51 ct 257 -51 285 -64 307 -91 ct
+330 -117 342 -158 342 -212 ct 342 -273 330 -317 307 -345 ct 284 -373 255 -387 221 -387 ct
+188 -387 160 -374 138 -346 ct 116 -319 l 105 -277 l p ef
+818 -54 m 790 -30 764 -14 738 -4 ct 713 5 685 9 656 9 ct 608 9 571 -1 545 -25 ct
+519 -49 506 -79 506 -115 ct 506 -137 511 -156 521 -174 ct 531 -192 543 -206 559 -217 ct
+575 -228 593 -236 613 -241 ct 627 -245 649 -249 679 -253 ct 739 -260 783 -268 812 -278 ct
+812 -288 812 -295 812 -298 ct 812 -328 805 -349 791 -362 ct 772 -379 744 -387 706 -387 ct
+671 -387 645 -381 629 -369 ct 612 -356 600 -335 592 -303 ct 519 -313 l 526 -345 536 -370 552 -389 ct
+567 -408 589 -423 617 -433 ct 646 -443 679 -449 717 -449 ct 755 -449 785 -444 808 -435 ct
+832 -427 849 -415 860 -402 ct 871 -389 879 -372 883 -351 ct 886 -339 887 -316 887 -283 ct
+887 -184 l 887 -114 889 -71 892 -52 ct 895 -34 901 -16 911 0 ct 833 0 l 825 -15 l
+820 -33 l p
+812 -220 m 785 -209 744 -200 690 -192 ct 660 -187 638 -182 625 -177 ct 613 -171 603 -163 596 -153 ct
+589 -142 586 -130 586 -117 ct 586 -98 593 -81 608 -68 ct 623 -55 645 -48 674 -48 ct
+703 -48 728 -54 751 -67 ct 773 -79 789 -96 800 -118 ct 808 -135 812 -160 812 -193 ct
+p ef
+1144 -66 m 1155 0 l 1134 3 1115 5 1098 5 ct 1071 5 1050 1 1036 -7 ct 1021 -15 1010 -26 1004 -40 ct
+998 -54 995 -83 995 -128 ct 995 -381 l 940 -381 l 940 -439 l 995 -439 l
+995 -547 l 1069 -592 l 1069 -439 l 1144 -439 l 1144 -381 l 1069 -381 l
+1069 -124 l 1069 -103 1070 -89 1073 -83 ct 1076 -77 1080 -72 1086 -69 ct 1092 -65 1100 -63 1111 -63 ct
+1119 -63 l 1130 -64 l p ef
+1506 -54 m 1478 -30 1452 -14 1426 -4 ct 1401 5 1373 9 1344 9 ct 1296 9 1259 -1 1233 -25 ct
+1207 -49 1194 -79 1194 -115 ct 1194 -137 1199 -156 1209 -174 ct 1219 -192 1231 -206 1247 -217 ct
+1263 -228 1281 -236 1301 -241 ct 1315 -245 1337 -249 1367 -253 ct 1427 -260 1471 -268 1500 -278 ct
+1500 -288 1500 -295 1500 -298 ct 1500 -328 1493 -349 1479 -362 ct 1460 -379 1432 -387 1394 -387 ct
+1359 -387 1333 -381 1317 -369 ct 1300 -356 1288 -335 1280 -303 ct 1207 -313 l
+1214 -345 1224 -370 1240 -389 ct 1255 -408 1277 -423 1305 -433 ct 1334 -443 1367 -449 1405 -449 ct
+1443 -449 1473 -444 1496 -435 ct 1520 -427 1537 -415 1548 -402 ct 1559 -389 1567 -372 1571 -351 ct
+1574 -339 1575 -316 1575 -283 ct 1575 -184 l 1575 -114 1577 -71 1580 -52 ct
+1583 -34 1589 -16 1599 0 ct 1521 0 l 1513 -15 l 1508 -33 l p
+1500 -220 m 1473 -209 1432 -200 1378 -192 ct 1348 -187 1326 -182 1313 -177 ct
+1301 -171 1291 -163 1284 -153 ct 1277 -142 1274 -130 1274 -117 ct 1274 -98 1281 -81 1296 -68 ct
+1311 -55 1333 -48 1362 -48 ct 1391 -48 1416 -54 1439 -67 ct 1461 -79 1477 -96 1488 -118 ct
+1496 -135 1500 -160 1500 -193 ct p ef
+2070 -66 m 2081 0 l 2060 3 2041 5 2024 5 ct 1997 5 1976 1 1962 -7 ct 1947 -15 1936 -26 1930 -40 ct
+1924 -54 1921 -83 1921 -128 ct 1921 -381 l 1866 -381 l 1866 -439 l 1921 -439 l
+1921 -547 l 1995 -592 l 1995 -439 l 2070 -439 l 2070 -381 l 1995 -381 l
+1995 -124 l 1995 -103 1996 -89 1999 -83 ct 2002 -77 2006 -72 2012 -69 ct 2018 -65 2026 -63 2037 -63 ct
+2045 -63 l 2056 -64 l p ef
+2118 -219 m 2118 -300 2140 -361 2185 -400 ct 2223 -432 2269 -449 2324 -449 ct
+2384 -449 2433 -429 2472 -389 ct 2510 -350 2529 -295 2529 -225 ct 2529 -169 2521 -124 2504 -92 ct
+2487 -60 2462 -34 2430 -16 ct 2397 0 2362 9 2324 9 ct 2262 9 2212 -9 2174 -49 ct
+2137 -88 l 2118 -145 l p
+2194 -219 m 2194 -163 2206 -121 2231 -93 ct 2255 -65 2286 -51 2324 -51 ct 2361 -51 2391 -65 2416 -93 ct
+2440 -121 2453 -164 2453 -222 ct 2453 -276 2440 -317 2416 -345 ct 2391 -373 2360 -387 2324 -387 ct
+2286 -387 2255 -373 2231 -345 ct 2206 -317 l 2194 -275 l p ef
+2860 0 m 2860 -606 l 2935 -606 l 2935 -388 l 2970 -429 3013 -449 3066 -449 ct
+3099 -449 3127 -442 3151 -429 ct 3175 -417 3192 -399 3203 -376 ct 3213 -354 3218 -321 3218 -278 ct
+3218 0 l 3144 0 l 3144 -278 l 3144 -315 3136 -342 3119 -359 ct 3103 -376 3081 -385 3051 -385 ct
+3029 -385 3008 -379 2989 -367 ct 2969 -356 2955 -340 2947 -321 ct 2939 -301 2935 -274 2935 -240 ct
+2935 0 l p ef
+3309 -219 m 3309 -300 3331 -361 3376 -400 ct 3414 -432 3460 -449 3515 -449 ct
+3575 -449 3624 -429 3663 -389 ct 3701 -350 3720 -295 3720 -225 ct 3720 -169 3712 -124 3695 -92 ct
+3678 -60 3653 -34 3621 -16 ct 3588 0 3553 9 3515 9 ct 3453 9 3403 -9 3365 -49 ct
+3328 -88 l 3309 -145 l p
+3385 -219 m 3385 -163 3397 -121 3422 -93 ct 3446 -65 3477 -51 3515 -51 ct 3552 -51 3582 -65 3607 -93 ct
+3631 -121 3644 -164 3644 -222 ct 3644 -276 3631 -317 3607 -345 ct 3582 -373 3551 -387 3515 -387 ct
+3477 -387 3446 -373 3422 -345 ct 3397 -317 l 3385 -275 l p ef
+3783 -131 m 3856 -142 l 3860 -113 3872 -90 3891 -74 ct 3910 -59 3936 -51 3970 -51 ct
+4004 -51 4029 -58 4046 -72 ct 4063 -86 4071 -102 4071 -121 ct 4071 -138 4064 -151 4049 -160 ct
+4039 -167 4013 -175 3973 -186 ct 3918 -199 3880 -211 3859 -221 ct 3838 -231 3822 -245 3811 -263 ct
+3800 -281 3795 -301 3795 -322 ct 3795 -342 3799 -360 3808 -376 ct 3817 -393 3830 -407 3845 -418 ct
+3857 -427 3872 -434 3892 -440 ct 3912 -446 3934 -449 3957 -449 ct 3991 -449 4021 -444 4047 -434 ct
+4074 -424 4093 -410 4105 -393 ct 4118 -376 4126 -354 4131 -325 ct 4058 -315 l
+4055 -338 4045 -356 4029 -368 ct 4013 -381 3991 -387 3962 -387 ct 3928 -387 3903 -382 3889 -370 ct
+3874 -359 3867 -346 3867 -331 ct 3867 -321 3870 -312 3876 -305 ct 3882 -297 3892 -290 3905 -285 ct
+3912 -282 3934 -276 3970 -266 ct 4023 -252 4060 -240 4081 -231 ct 4101 -222 4118 -209 4130 -192 ct
+4141 -175 4147 -154 4147 -129 ct 4147 -104 4140 -80 4126 -58 ct 4111 -37 4090 -20 4063 -8 ct
+4036 3 4005 9 3970 9 ct 3913 9 3870 -1 3840 -25 ct 3810 -49 l 3791 -84 l p ef
+4372 -66 m 4383 0 l 4362 3 4343 5 4326 5 ct 4299 5 4278 1 4264 -7 ct 4249 -15 4238 -26 4232 -40 ct
+4226 -54 4223 -83 4223 -128 ct 4223 -381 l 4168 -381 l 4168 -439 l 4223 -439 l
+4223 -547 l 4297 -592 l 4297 -439 l 4372 -439 l 4372 -381 l 4297 -381 l
+4297 -124 l 4297 -103 4298 -89 4301 -83 ct 4304 -77 4308 -72 4314 -69 ct 4320 -65 4328 -63 4339 -63 ct
+4347 -63 l 4358 -64 l p ef
+pom
+pum
+23257 5213 t
+177 0 m 10 -439 l 89 -439 l 183 -176 l 193 -147 203 -118 211 -87 ct 218 -110 227 -138 239 -171 ct
+337 -439 l 413 -439 l 247 0 l p ef
+479 -520 m 479 -606 l 553 -606 l 553 -520 l p
+479 0 m 479 -439 l 553 -439 l 553 0 l p ef
+951 -54 m 923 -30 897 -14 871 -4 ct 846 5 818 9 789 9 ct 741 9 704 -1 678 -25 ct
+652 -49 639 -79 639 -115 ct 639 -137 644 -156 654 -174 ct 664 -192 676 -206 692 -217 ct
+708 -228 726 -236 746 -241 ct 760 -245 782 -249 812 -253 ct 872 -260 916 -268 945 -278 ct
+945 -288 945 -295 945 -298 ct 945 -328 938 -349 924 -362 ct 905 -379 877 -387 839 -387 ct
+804 -387 778 -381 762 -369 ct 745 -356 733 -335 725 -303 ct 652 -313 l 659 -345 669 -370 685 -389 ct
+700 -408 722 -423 750 -433 ct 779 -443 812 -449 850 -449 ct 888 -449 918 -444 941 -435 ct
+965 -427 982 -415 993 -402 ct 1004 -389 1012 -372 1016 -351 ct 1019 -339 1020 -316 1020 -283 ct
+1020 -184 l 1020 -114 1022 -71 1025 -52 ct 1028 -34 1034 -16 1044 0 ct 966 0 l
+958 -15 l 953 -33 l p
+945 -220 m 918 -209 877 -200 823 -192 ct 793 -187 771 -182 758 -177 ct 746 -171 736 -163 729 -153 ct
+722 -142 719 -130 719 -117 ct 719 -98 726 -81 741 -68 ct 756 -55 778 -48 807 -48 ct
+836 -48 861 -54 884 -67 ct 906 -79 922 -96 933 -118 ct 941 -135 945 -160 945 -193 ct
+p ef
+1759 -606 m 1839 -606 l 1839 -256 l 1839 -195 1832 -146 1818 -110 ct 1804 -75 1780 -45 1744 -23 ct
+1708 0 1660 10 1602 10 ct 1545 10 1499 0 1463 -19 ct 1426 -38 1401 -66 1385 -104 ct
+1370 -141 1362 -191 1362 -256 ct 1362 -606 l 1442 -606 l 1442 -256 l 1442 -203 1447 -164 1457 -139 ct
+1467 -115 1484 -95 1507 -82 ct 1531 -68 1560 -62 1595 -62 ct 1654 -62 1696 -75 1721 -102 ct
+1746 -128 1759 -180 1759 -256 ct p ef
+1969 -194 m 2044 -201 l 2048 -171 2056 -146 2069 -126 ct 2082 -107 2103 -91 2130 -79 ct
+2158 -67 2189 -61 2223 -61 ct 2254 -61 2281 -66 2304 -75 ct 2328 -84 2345 -96 2357 -112 ct
+2368 -128 2374 -145 2374 -164 ct 2374 -183 2368 -200 2357 -214 ct 2346 -228 2328 -240 2303 -250 ct
+2286 -256 2250 -266 2195 -279 ct 2139 -293 2100 -305 2078 -317 ct 2049 -332 2027 -351 2013 -374 ct
+1999 -396 1992 -421 1992 -449 ct 1992 -480 2000 -508 2018 -535 ct 2035 -561 2061 -582 2094 -595 ct
+2127 -609 2164 -616 2205 -616 ct 2250 -616 2290 -609 2324 -594 ct 2358 -580 2385 -559 2403 -531 ct
+2422 -502 2432 -471 2433 -435 ct 2356 -429 l 2352 -468 2338 -496 2314 -516 ct
+2290 -536 2255 -545 2208 -545 ct 2160 -545 2125 -537 2102 -519 ct 2080 -501 2069 -480 2069 -454 ct
+2069 -433 2077 -415 2093 -401 ct 2108 -387 2148 -372 2214 -357 ct 2279 -343 2324 -330 2348 -319 ct
+2383 -303 2409 -282 2426 -257 ct 2443 -232 2451 -203 2451 -171 ct 2451 -138 2442 -108 2423 -80 ct
+2405 -51 2378 -29 2344 -13 ct 2309 2 2270 10 2227 10 ct 2172 10 2126 2 2089 -13 ct
+2052 -29 2023 -53 2002 -85 ct 1981 -117 l 1970 -154 l p ef
+2576 0 m 2576 -606 l 2803 -606 l 2849 -606 2886 -600 2914 -587 ct 2942 -575 2964 -556 2980 -531 ct
+2996 -505 3004 -479 3004 -451 ct 3004 -425 2997 -400 2983 -378 ct 2969 -355 2948 -336 2919 -322 ct
+2956 -311 2984 -293 3004 -267 ct 3024 -241 3033 -211 3033 -175 ct 3033 -147 3027 -120 3015 -96 ct
+3003 -72 2989 -53 2971 -40 ct 2953 -26 2931 -16 2905 -10 ct 2878 -3 2845 0 2807 0 ct
+p
+2656 -351 m 2787 -351 l 2822 -351 2848 -353 2863 -358 ct 2884 -364 2899 -374 2909 -388 ct
+2920 -402 2925 -420 2925 -441 ct 2925 -461 2920 -479 2911 -494 ct 2901 -510 2887 -520 2869 -526 ct
+2851 -531 2821 -534 2777 -534 ct 2656 -534 l p
+2656 -71 m 2807 -71 l 2833 -71 2851 -72 2861 -74 ct 2880 -77 2895 -83 2908 -90 ct
+2920 -98 2930 -109 2938 -124 ct 2946 -139 2950 -156 2950 -175 ct 2950 -198 2944 -218 2933 -234 ct
+2921 -251 2905 -263 2885 -269 ct 2864 -276 2835 -279 2796 -279 ct 2656 -279 l
+p ef
+pom
+gr
+gs
+pum
+6825 19235 t
+497 -212 m 578 -192 l 561 -126 531 -76 487 -41 ct 443 -6 390 10 327 10 ct
+261 10 208 -2 167 -29 ct 126 -56 95 -94 74 -145 ct 52 -195 42 -249 42 -307 ct 42 -370 54 -425 78 -472 ct
+102 -519 136 -555 181 -580 ct 225 -604 274 -616 328 -616 ct 389 -616 440 -601 481 -570 ct
+522 -539 551 -496 567 -440 ct 488 -421 l 474 -465 454 -497 427 -517 ct 400 -537 367 -547 326 -547 ct
+280 -547 241 -536 209 -514 ct 178 -492 156 -462 143 -424 ct 131 -386 124 -348 124 -308 ct
+124 -256 132 -211 147 -173 ct 162 -134 185 -105 217 -86 ct 249 -67 283 -58 320 -58 ct
+365 -58 403 -71 434 -97 ct 465 -123 l 486 -161 l p ef
+991 -141 m 1068 -131 l 1056 -86 1033 -52 1001 -27 ct 968 -2 926 9 875 9 ct
+811 9 760 -9 722 -49 ct 684 -88 666 -144 666 -215 ct 666 -289 685 -347 723 -387 ct
+761 -428 810 -449 871 -449 ct 929 -449 977 -429 1015 -389 ct 1052 -349 1070 -292 1070 -220 ct
+1070 -216 1070 -209 1070 -200 ct 742 -200 l 745 -152 759 -115 783 -89 ct 808 -64 839 -51 875 -51 ct
+903 -51 926 -58 945 -72 ct 964 -87 l 980 -110 l p
+747 -261 m 992 -261 l 989 -298 979 -326 964 -344 ct 940 -373 909 -387 871 -387 ct
+837 -387 809 -376 785 -353 ct 762 -330 l 749 -300 l p ef
+1166 0 m 1166 -439 l 1233 -439 l 1233 -376 l 1266 -425 1312 -449 1373 -449 ct
+1400 -449 1424 -444 1446 -434 ct 1468 -425 1485 -412 1496 -397 ct 1507 -382 1515 -363 1519 -342 ct
+1522 -328 1523 -304 1523 -270 ct 1523 0 l 1449 0 l 1449 -267 l 1449 -297 1446 -320 1440 -335 ct
+1434 -350 1424 -362 1409 -371 ct 1395 -380 1377 -384 1357 -384 ct 1326 -384 1298 -374 1275 -354 ct
+1252 -334 1241 -296 1241 -239 ct 1241 0 l p ef
+1806 -66 m 1817 0 l 1796 3 1777 5 1760 5 ct 1733 5 1712 1 1698 -7 ct 1683 -15 1672 -26 1666 -40 ct
+1660 -54 1657 -83 1657 -128 ct 1657 -381 l 1602 -381 l 1602 -439 l 1657 -439 l
+1657 -547 l 1731 -592 l 1731 -439 l 1806 -439 l 1806 -381 l 1731 -381 l
+1731 -124 l 1731 -103 1732 -89 1735 -83 ct 1738 -77 1742 -72 1748 -69 ct 1754 -65 1762 -63 1773 -63 ct
+1781 -63 l 1792 -64 l p ef
+2182 -141 m 2259 -131 l 2247 -86 2224 -52 2192 -27 ct 2159 -2 2117 9 2066 9 ct
+2002 9 1951 -9 1913 -49 ct 1875 -88 1857 -144 1857 -215 ct 1857 -289 1876 -347 1914 -387 ct
+1952 -428 2001 -449 2062 -449 ct 2120 -449 2168 -429 2206 -389 ct 2243 -349 2261 -292 2261 -220 ct
+2261 -216 2261 -209 2261 -200 ct 1933 -200 l 1936 -152 1950 -115 1974 -89 ct
+1999 -64 2030 -51 2066 -51 ct 2094 -51 2117 -58 2136 -72 ct 2155 -87 l 2171 -110 l
+p
+1938 -261 m 2183 -261 l 2180 -298 2170 -326 2155 -344 ct 2131 -373 2100 -387 2062 -387 ct
+2028 -387 2000 -376 1976 -353 ct 1953 -330 l 1940 -300 l p ef
+2357 0 m 2357 -439 l 2424 -439 l 2424 -372 l 2441 -403 2456 -424 2471 -434 ct
+2485 -444 2501 -449 2519 -449 ct 2544 -449 2569 -441 2595 -425 ct 2570 -356 l
+2551 -366 2533 -372 2515 -372 ct 2499 -372 2484 -367 2471 -357 ct 2458 -347 2449 -334 2443 -316 ct
+2435 -290 2431 -261 2431 -229 ct 2431 0 l p ef
+2904 0 m 2904 -381 l 2838 -381 l 2838 -439 l 2904 -439 l 2904 -485 l
+2904 -515 2907 -537 2912 -551 ct 2919 -571 2932 -586 2950 -598 ct 2968 -610 2993 -616 3026 -616 ct
+3047 -616 3070 -614 3095 -609 ct 3084 -544 l 3069 -547 3054 -548 3040 -548 ct
+3018 -548 3002 -543 2992 -533 ct 2983 -524 2978 -506 2978 -479 ct 2978 -439 l
+3064 -439 l 3064 -381 l 2978 -381 l 2978 0 l p ef
+3124 0 m 3124 -439 l 3191 -439 l 3191 -372 l 3208 -403 3223 -424 3238 -434 ct
+3252 -444 3268 -449 3286 -449 ct 3311 -449 3336 -441 3362 -425 ct 3337 -356 l
+3318 -366 3300 -372 3282 -372 ct 3266 -372 3251 -367 3238 -357 ct 3225 -347 3216 -334 3210 -316 ct
+3202 -290 3198 -261 3198 -229 ct 3198 0 l p ef
+3716 -141 m 3793 -131 l 3781 -86 3758 -52 3726 -27 ct 3693 -2 3651 9 3600 9 ct
+3536 9 3485 -9 3447 -49 ct 3409 -88 3391 -144 3391 -215 ct 3391 -289 3410 -347 3448 -387 ct
+3486 -428 3535 -449 3596 -449 ct 3654 -449 3702 -429 3740 -389 ct 3777 -349 3795 -292 3795 -220 ct
+3795 -216 3795 -209 3795 -200 ct 3467 -200 l 3470 -152 3484 -115 3508 -89 ct
+3533 -64 3564 -51 3600 -51 ct 3628 -51 3651 -58 3670 -72 ct 3689 -87 l 3705 -110 l
+p
+3472 -261 m 3717 -261 l 3714 -298 3704 -326 3689 -344 ct 3665 -373 3634 -387 3596 -387 ct
+3562 -387 3534 -376 3510 -353 ct 3487 -330 l 3474 -300 l p ef
+4171 168 m 4171 -46 l 4160 -30 4144 -16 4123 -6 ct 4102 4 4080 9 4056 9 ct
+4004 9 3959 -10 3922 -52 ct 3884 -94 3865 -151 3865 -223 ct 3865 -267 3873 -307 3888 -342 ct
+3904 -377 3926 -404 3955 -422 ct 3984 -440 4016 -449 4051 -449 ct 4105 -449 4148 -426 4179 -380 ct
+4179 -439 l 4246 -439 l 4246 168 l p
+3942 -220 m 3942 -164 3954 -121 3977 -93 ct 4001 -65 4029 -51 4063 -51 ct 4094 -51 4122 -64 4144 -91 ct
+4167 -118 4179 -159 4179 -214 ct 4179 -272 4167 -316 4143 -346 ct 4118 -375 4090 -390 4058 -390 ct
+4025 -390 3998 -376 3975 -349 ct 3953 -321 l 3942 -279 l p ef
+4656 0 m 4656 -64 l 4622 -14 4576 9 4517 9 ct 4491 9 4467 4 4444 -4 ct 4422 -14 4405 -27 4394 -42 ct
+4383 -57 4376 -75 4371 -97 ct 4368 -112 4367 -135 4367 -167 ct 4367 -439 l 4441 -439 l
+4441 -195 l 4441 -156 4443 -130 4446 -117 ct 4450 -97 4460 -82 4475 -70 ct
+4491 -59 4509 -54 4532 -54 ct 4554 -54 4575 -59 4595 -71 ct 4614 -82 4628 -98 4636 -118 ct
+4644 -137 4648 -166 4648 -203 ct 4648 -439 l 4723 -439 l 4723 0 l p ef
+5145 -141 m 5222 -131 l 5210 -86 5187 -52 5155 -27 ct 5122 -2 5080 9 5029 9 ct
+4965 9 4914 -9 4876 -49 ct 4838 -88 4820 -144 4820 -215 ct 4820 -289 4839 -347 4877 -387 ct
+4915 -428 4964 -449 5025 -449 ct 5083 -449 5131 -429 5169 -389 ct 5206 -349 5224 -292 5224 -220 ct
+5224 -216 5224 -209 5224 -200 ct 4896 -200 l 4899 -152 4913 -115 4937 -89 ct
+4962 -64 4993 -51 5029 -51 ct 5057 -51 5080 -58 5099 -72 ct 5118 -87 l 5134 -110 l
+p
+4901 -261 m 5146 -261 l 5143 -298 5133 -326 5118 -344 ct 5094 -373 5063 -387 5025 -387 ct
+4991 -387 4963 -376 4939 -353 ct 4916 -330 l 4903 -300 l p ef
+5320 0 m 5320 -439 l 5387 -439 l 5387 -376 l 5420 -425 5466 -449 5527 -449 ct
+5554 -449 5578 -444 5600 -434 ct 5622 -425 5639 -412 5650 -397 ct 5661 -382 5669 -363 5673 -342 ct
+5676 -328 5677 -304 5677 -270 ct 5677 0 l 5603 0 l 5603 -267 l 5603 -297 5600 -320 5594 -335 ct
+5588 -350 5578 -362 5563 -371 ct 5549 -380 5531 -384 5511 -384 ct 5480 -384 5452 -374 5429 -354 ct
+5406 -334 5395 -296 5395 -239 ct 5395 0 l p ef
+6083 -160 m 6156 -151 l 6148 -100 6128 -61 6095 -32 ct 6062 -4 6021 9 5973 9 ct
+5913 9 5865 -9 5828 -49 ct 5792 -88 5774 -144 5774 -217 ct 5774 -265 5781 -306 5797 -342 ct
+5813 -378 5837 -404 5869 -422 ct 5901 -440 5936 -449 5974 -449 ct 6021 -449 6060 -437 6091 -412 ct
+6121 -388 6141 -354 6149 -310 ct 6077 -299 l 6070 -328 6058 -350 6040 -365 ct
+6023 -380 6001 -387 5977 -387 ct 5939 -387 5909 -374 5885 -347 ct 5862 -320 5850 -278 5850 -220 ct
+5850 -161 5861 -118 5884 -91 ct 5907 -64 5936 -51 5973 -51 ct 6002 -51 6026 -60 6046 -78 ct
+6065 -96 l 6078 -123 l p ef
+6217 169 m 6209 99 l 6225 103 6239 105 6251 105 ct 6268 105 6281 103 6291 97 ct
+6301 92 6309 84 6315 74 ct 6320 66 6328 48 6338 19 ct 6340 14 6342 8 6345 0 ct
+6178 -439 l 6258 -439 l 6350 -184 l 6362 -152 6372 -118 6382 -83 ct 6390 -117 6400 -150 6412 -183 ct
+6506 -439 l 6581 -439 l 6413 7 l 6396 55 6382 88 6372 107 ct 6358 131 6343 149 6326 161 ct
+6309 172 6289 178 6265 178 ct 6251 178 l 6235 175 l p ef
+pom
+pum
+7778 20188 t
+26 -181 m 26 -256 l 255 -256 l 255 -181 l p ef
+364 0 m 364 -381 l 298 -381 l 298 -439 l 364 -439 l 364 -485 l 364 -515 367 -537 372 -551 ct
+379 -571 392 -586 410 -598 ct 428 -610 453 -616 486 -616 ct 507 -616 530 -614 555 -609 ct
+544 -544 l 529 -547 514 -548 500 -548 ct 478 -548 462 -543 452 -533 ct 443 -524 438 -506 438 -479 ct
+438 -439 l 524 -439 l 524 -381 l 438 -381 l 438 0 l p ef
+555 -131 m 628 -142 l 632 -113 644 -90 663 -74 ct 682 -59 708 -51 742 -51 ct
+776 -51 801 -58 818 -72 ct 835 -86 843 -102 843 -121 ct 843 -138 836 -151 821 -160 ct
+811 -167 785 -175 745 -186 ct 690 -199 652 -211 631 -221 ct 610 -231 594 -245 583 -263 ct
+572 -281 567 -301 567 -322 ct 567 -342 571 -360 580 -376 ct 589 -393 602 -407 617 -418 ct
+629 -427 644 -434 664 -440 ct 684 -446 706 -449 729 -449 ct 763 -449 793 -444 819 -434 ct
+846 -424 865 -410 877 -393 ct 890 -376 898 -354 903 -325 ct 830 -315 l 827 -338 817 -356 801 -368 ct
+785 -381 763 -387 734 -387 ct 700 -387 675 -382 661 -370 ct 646 -359 639 -346 639 -331 ct
+639 -321 642 -312 648 -305 ct 654 -297 664 -290 677 -285 ct 684 -282 706 -276 742 -266 ct
+795 -252 832 -240 853 -231 ct 873 -222 890 -209 902 -192 ct 913 -175 919 -154 919 -129 ct
+919 -104 912 -80 898 -58 ct 883 -37 862 -20 835 -8 ct 808 3 777 9 742 9 ct 685 9 642 -1 612 -25 ct
+582 -49 l 563 -84 l p ef
+926 10 m 1101 -616 l 1161 -616 l 985 10 l p ef
+1590 -71 m 1590 0 l 1189 0 l 1189 -17 1191 -35 1198 -51 ct 1208 -79 1224 -105 1247 -132 ct
+1269 -158 1302 -189 1344 -224 ct 1410 -278 1455 -321 1478 -352 ct 1501 -384 1513 -413 1513 -442 ct
+1513 -471 1502 -496 1481 -516 ct 1460 -537 1432 -547 1398 -547 ct 1363 -547 1334 -536 1312 -514 ct
+1291 -493 1280 -463 1280 -425 ct 1203 -433 l 1208 -490 1228 -533 1262 -563 ct
+1297 -593 1342 -608 1400 -608 ct 1458 -608 1504 -592 1538 -560 ct 1572 -528 1589 -488 1589 -440 ct
+1589 -416 1584 -392 1574 -368 ct 1564 -345 1548 -320 1525 -294 ct 1502 -268 1463 -233 1410 -188 ct
+1365 -150 1337 -125 1324 -111 ct 1311 -98 1301 -85 1293 -71 ct p ef
+2097 -66 m 2108 0 l 2087 3 2068 5 2051 5 ct 2024 5 2003 1 1989 -7 ct 1974 -15 1963 -26 1957 -40 ct
+1951 -54 1948 -83 1948 -128 ct 1948 -381 l 1893 -381 l 1893 -439 l 1948 -439 l
+1948 -547 l 2022 -592 l 2022 -439 l 2097 -439 l 2097 -381 l 2022 -381 l
+2022 -124 l 2022 -103 2023 -89 2026 -83 ct 2029 -77 2033 -72 2039 -69 ct 2045 -65 2053 -63 2064 -63 ct
+2072 -63 l 2083 -64 l p ef
+2145 -219 m 2145 -300 2167 -361 2212 -400 ct 2250 -432 2296 -449 2351 -449 ct
+2411 -449 2460 -429 2499 -389 ct 2537 -350 2556 -295 2556 -225 ct 2556 -169 2548 -124 2531 -92 ct
+2514 -60 2489 -34 2457 -16 ct 2424 0 2389 9 2351 9 ct 2289 9 2239 -9 2201 -49 ct
+2164 -88 l 2145 -145 l p
+2221 -219 m 2221 -163 2233 -121 2258 -93 ct 2282 -65 2313 -51 2351 -51 ct 2388 -51 2418 -65 2443 -93 ct
+2467 -121 2480 -164 2480 -222 ct 2480 -276 2467 -317 2443 -345 ct 2418 -373 2387 -387 2351 -387 ct
+2313 -387 2282 -373 2258 -345 ct 2233 -317 l 2221 -275 l p ef
+3043 -98 m 3043 -264 l 2878 -264 l 2878 -333 l 3043 -333 l 3043 -498 l
+3113 -498 l 3113 -333 l 3278 -333 l 3278 -264 l 3113 -264 l 3113 -98 l
+p ef
+3407 0 m 3407 -381 l 3341 -381 l 3341 -439 l 3407 -439 l 3407 -485 l
+3407 -515 3410 -537 3415 -551 ct 3422 -571 3435 -586 3453 -598 ct 3471 -610 3496 -616 3529 -616 ct
+3550 -616 3573 -614 3598 -609 ct 3587 -544 l 3572 -547 3557 -548 3543 -548 ct
+3521 -548 3505 -543 3495 -533 ct 3486 -524 3481 -506 3481 -479 ct 3481 -439 l
+3567 -439 l 3567 -381 l 3481 -381 l 3481 0 l p ef
+3598 -131 m 3671 -142 l 3675 -113 3687 -90 3706 -74 ct 3725 -59 3751 -51 3785 -51 ct
+3819 -51 3844 -58 3861 -72 ct 3878 -86 3886 -102 3886 -121 ct 3886 -138 3879 -151 3864 -160 ct
+3854 -167 3828 -175 3788 -186 ct 3733 -199 3695 -211 3674 -221 ct 3653 -231 3637 -245 3626 -263 ct
+3615 -281 3610 -301 3610 -322 ct 3610 -342 3614 -360 3623 -376 ct 3632 -393 3645 -407 3660 -418 ct
+3672 -427 3687 -434 3707 -440 ct 3727 -446 3749 -449 3772 -449 ct 3806 -449 3836 -444 3862 -434 ct
+3889 -424 3908 -410 3920 -393 ct 3933 -376 3941 -354 3946 -325 ct 3873 -315 l
+3870 -338 3860 -356 3844 -368 ct 3828 -381 3806 -387 3777 -387 ct 3743 -387 3718 -382 3704 -370 ct
+3689 -359 3682 -346 3682 -331 ct 3682 -321 3685 -312 3691 -305 ct 3697 -297 3707 -290 3720 -285 ct
+3727 -282 3749 -276 3785 -266 ct 3838 -252 3875 -240 3896 -231 ct 3916 -222 3933 -209 3945 -192 ct
+3956 -175 3962 -154 3962 -129 ct 3962 -104 3955 -80 3941 -58 ct 3926 -37 3905 -20 3878 -8 ct
+3851 3 3820 9 3785 9 ct 3728 9 3685 -1 3655 -25 ct 3625 -49 l 3606 -84 l p ef
+3969 10 m 4144 -616 l 4204 -616 l 4028 10 l p ef
+4633 -71 m 4633 0 l 4232 0 l 4232 -17 4234 -35 4241 -51 ct 4251 -79 4267 -105 4290 -132 ct
+4312 -158 4345 -189 4387 -224 ct 4453 -278 4498 -321 4521 -352 ct 4544 -384 4556 -413 4556 -442 ct
+4556 -471 4545 -496 4524 -516 ct 4503 -537 4475 -547 4441 -547 ct 4406 -547 4377 -536 4355 -514 ct
+4334 -493 4323 -463 4323 -425 ct 4246 -433 l 4251 -490 4271 -533 4305 -563 ct
+4340 -593 4385 -608 4443 -608 ct 4501 -608 4547 -592 4581 -560 ct 4615 -528 4632 -488 4632 -440 ct
+4632 -416 4627 -392 4617 -368 ct 4607 -345 4591 -320 4568 -294 ct 4545 -268 4506 -233 4453 -188 ct
+4408 -150 4380 -125 4367 -111 ct 4354 -98 4344 -85 4336 -71 ct p ef
+pom
+gr
+10161 16546 m 10011 16996 l 10311 16995 l 10161 16546 l p ef
+10161 18381 m 10161 16906 l ps
+gs
+pum
+2805 3466 t
+38 -194 m 113 -201 l 117 -171 125 -146 138 -126 ct 151 -107 172 -91 199 -79 ct
+227 -67 258 -61 292 -61 ct 323 -61 350 -66 373 -75 ct 397 -84 414 -96 426 -112 ct
+437 -128 443 -145 443 -164 ct 443 -183 437 -200 426 -214 ct 415 -228 397 -240 372 -250 ct
+355 -256 319 -266 264 -279 ct 208 -293 169 -305 147 -317 ct 118 -332 96 -351 82 -374 ct
+68 -396 61 -421 61 -449 ct 61 -480 69 -508 87 -535 ct 104 -561 130 -582 163 -595 ct
+196 -609 233 -616 274 -616 ct 319 -616 359 -609 393 -594 ct 427 -580 454 -559 472 -531 ct
+491 -502 501 -471 502 -435 ct 425 -429 l 421 -468 407 -496 383 -516 ct 359 -536 324 -545 277 -545 ct
+229 -545 194 -537 171 -519 ct 149 -501 138 -480 138 -454 ct 138 -433 146 -415 162 -401 ct
+177 -387 217 -372 283 -357 ct 348 -343 393 -330 417 -319 ct 452 -303 478 -282 495 -257 ct
+512 -232 520 -203 520 -171 ct 520 -138 511 -108 492 -80 ct 474 -51 447 -29 413 -13 ct
+378 2 339 10 296 10 ct 241 10 195 2 158 -13 ct 121 -29 92 -53 71 -85 ct 50 -117 l
+39 -154 l p ef
+924 -54 m 896 -30 870 -14 844 -4 ct 819 5 791 9 762 9 ct 714 9 677 -1 651 -25 ct
+625 -49 612 -79 612 -115 ct 612 -137 617 -156 627 -174 ct 637 -192 649 -206 665 -217 ct
+681 -228 699 -236 719 -241 ct 733 -245 755 -249 785 -253 ct 845 -260 889 -268 918 -278 ct
+918 -288 918 -295 918 -298 ct 918 -328 911 -349 897 -362 ct 878 -379 850 -387 812 -387 ct
+777 -387 751 -381 735 -369 ct 718 -356 706 -335 698 -303 ct 625 -313 l 632 -345 642 -370 658 -389 ct
+673 -408 695 -423 723 -433 ct 752 -443 785 -449 823 -449 ct 861 -449 891 -444 914 -435 ct
+938 -427 955 -415 966 -402 ct 977 -389 985 -372 989 -351 ct 992 -339 993 -316 993 -283 ct
+993 -184 l 993 -114 995 -71 998 -52 ct 1001 -34 1007 -16 1017 0 ct 939 0 l
+931 -15 l 926 -33 l p
+918 -220 m 891 -209 850 -200 796 -192 ct 766 -187 744 -182 731 -177 ct 719 -171 709 -163 702 -153 ct
+695 -142 692 -130 692 -117 ct 692 -98 699 -81 714 -68 ct 729 -55 751 -48 780 -48 ct
+809 -48 834 -54 857 -67 ct 879 -79 895 -96 906 -118 ct 914 -135 918 -160 918 -193 ct
+p ef
+1087 0 m 1087 -439 l 1154 -439 l 1154 -377 l 1168 -399 1186 -416 1209 -429 ct
+1232 -442 1258 -449 1287 -449 ct 1320 -449 1346 -442 1367 -428 ct 1388 -415 1403 -396 1411 -372 ct
+1446 -423 1491 -449 1547 -449 ct 1590 -449 1624 -437 1647 -412 ct 1671 -388 1682 -351 1682 -301 ct
+1682 0 l 1608 0 l 1608 -276 l 1608 -306 1606 -327 1601 -340 ct 1596 -354 1588 -364 1575 -372 ct
+1562 -380 1547 -384 1530 -384 ct 1499 -384 1474 -374 1453 -353 ct 1433 -333 1423 -300 1423 -255 ct
+1423 0 l 1348 0 l 1348 -285 l 1348 -318 1342 -343 1330 -359 ct 1318 -376 1298 -384 1271 -384 ct
+1250 -384 1230 -379 1212 -368 ct 1195 -357 1182 -340 1174 -319 ct 1166 -298 1162 -267 1162 -227 ct
+1162 0 l p ef
+1801 168 m 1801 -439 l 1869 -439 l 1869 -382 l 1885 -404 1903 -421 1923 -432 ct
+1943 -443 1968 -449 1997 -449 ct 2034 -449 2067 -439 2096 -420 ct 2124 -400 2146 -373 2161 -338 ct
+2175 -303 2183 -264 2183 -222 ct 2183 -177 2175 -137 2158 -101 ct 2142 -65 2119 -37 2088 -18 ct
+2057 0 2025 9 1991 9 ct 1966 9 1944 4 1924 -5 ct 1905 -16 1888 -29 1876 -45 ct
+1876 168 l p
+1869 -217 m 1869 -160 1880 -118 1903 -91 ct 1926 -64 1954 -51 1986 -51 ct 2019 -51 2048 -65 2071 -93 ct
+2095 -121 2107 -164 2107 -223 ct 2107 -279 2095 -321 2072 -349 ct 2049 -376 2022 -390 1990 -390 ct
+1958 -390 1930 -376 1905 -346 ct 1881 -316 l 1869 -273 l p ef
+2250 0 m 2250 -606 l 2324 -606 l 2324 0 l p ef
+2437 -520 m 2437 -606 l 2511 -606 l 2511 -520 l p
+2437 0 m 2437 -439 l 2511 -439 l 2511 0 l p ef
+2621 0 m 2621 -439 l 2688 -439 l 2688 -376 l 2721 -425 2767 -449 2828 -449 ct
+2855 -449 2879 -444 2901 -434 ct 2923 -425 2940 -412 2951 -397 ct 2962 -382 2970 -363 2974 -342 ct
+2977 -328 2978 -304 2978 -270 ct 2978 0 l 2904 0 l 2904 -267 l 2904 -297 2901 -320 2895 -335 ct
+2889 -350 2879 -362 2864 -371 ct 2850 -380 2832 -384 2812 -384 ct 2781 -384 2753 -374 2730 -354 ct
+2707 -334 2696 -296 2696 -239 ct 2696 0 l p ef
+3085 36 m 3157 47 l 3160 69 3169 85 3182 95 ct 3201 109 3226 116 3258 116 ct
+3292 116 3319 109 3338 95 ct 3357 82 3369 62 3376 38 ct 3380 22 3381 -8 3381 -57 ct
+3349 -19 3308 0 3260 0 ct 3199 0 3153 -21 3119 -65 ct 3086 -108 3070 -161 3070 -222 ct
+3070 -264 3077 -302 3093 -338 ct 3108 -373 3130 -400 3159 -420 ct 3187 -439 3221 -449 3260 -449 ct
+3312 -449 3355 -428 3388 -386 ct 3388 -439 l 3457 -439 l 3457 -59 l 3457 8 3450 57 3436 85 ct
+3422 114 3400 136 3370 153 ct 3340 169 3303 178 3258 178 ct 3206 178 3164 166 3131 142 ct
+3099 119 l 3084 83 l p
+3146 -227 m 3146 -169 3158 -127 3181 -101 ct 3204 -74 3232 -61 3267 -61 ct
+3301 -61 3330 -74 3353 -101 ct 3376 -127 3387 -168 3387 -224 ct 3387 -278 3376 -319 3352 -346 ct
+3328 -373 3299 -387 3265 -387 ct 3232 -387 3204 -374 3181 -347 ct 3158 -320 l
+3146 -280 l p ef
+3812 0 m 3812 -439 l 3879 -439 l 3879 -372 l 3896 -403 3911 -424 3926 -434 ct
+3940 -444 3956 -449 3974 -449 ct 3999 -449 4024 -441 4050 -425 ct 4025 -356 l
+4006 -366 3988 -372 3970 -372 ct 3954 -372 3939 -367 3926 -357 ct 3913 -347 3904 -334 3898 -316 ct
+3890 -290 3886 -261 3886 -229 ct 3886 0 l p ef
+4390 -54 m 4362 -30 4336 -14 4310 -4 ct 4285 5 4257 9 4228 9 ct 4180 9 4143 -1 4117 -25 ct
+4091 -49 4078 -79 4078 -115 ct 4078 -137 4083 -156 4093 -174 ct 4103 -192 4115 -206 4131 -217 ct
+4147 -228 4165 -236 4185 -241 ct 4199 -245 4221 -249 4251 -253 ct 4311 -260 4355 -268 4384 -278 ct
+4384 -288 4384 -295 4384 -298 ct 4384 -328 4377 -349 4363 -362 ct 4344 -379 4316 -387 4278 -387 ct
+4243 -387 4217 -381 4201 -369 ct 4184 -356 4172 -335 4164 -303 ct 4091 -313 l
+4098 -345 4108 -370 4124 -389 ct 4139 -408 4161 -423 4189 -433 ct 4218 -443 4251 -449 4289 -449 ct
+4327 -449 4357 -444 4380 -435 ct 4404 -427 4421 -415 4432 -402 ct 4443 -389 4451 -372 4455 -351 ct
+4458 -339 4459 -316 4459 -283 ct 4459 -184 l 4459 -114 4461 -71 4464 -52 ct
+4467 -34 4473 -16 4483 0 ct 4405 0 l 4397 -15 l 4392 -33 l p
+4384 -220 m 4357 -209 4316 -200 4262 -192 ct 4232 -187 4210 -182 4197 -177 ct
+4185 -171 4175 -163 4168 -153 ct 4161 -142 4158 -130 4158 -117 ct 4158 -98 4165 -81 4180 -68 ct
+4195 -55 4217 -48 4246 -48 ct 4275 -48 4300 -54 4323 -67 ct 4345 -79 4361 -96 4372 -118 ct
+4380 -135 4384 -160 4384 -193 ct p ef
+4716 -66 m 4727 0 l 4706 3 4687 5 4670 5 ct 4643 5 4622 1 4608 -7 ct 4593 -15 4582 -26 4576 -40 ct
+4570 -54 4567 -83 4567 -128 ct 4567 -381 l 4512 -381 l 4512 -439 l 4567 -439 l
+4567 -547 l 4641 -592 l 4641 -439 l 4716 -439 l 4716 -381 l 4641 -381 l
+4641 -124 l 4641 -103 4642 -89 4645 -83 ct 4648 -77 4652 -72 4658 -69 ct 4664 -65 4672 -63 4683 -63 ct
+4691 -63 l 4702 -64 l p ef
+5092 -141 m 5169 -131 l 5157 -86 5134 -52 5102 -27 ct 5069 -2 5027 9 4976 9 ct
+4912 9 4861 -9 4823 -49 ct 4785 -88 4767 -144 4767 -215 ct 4767 -289 4786 -347 4824 -387 ct
+4862 -428 4911 -449 4972 -449 ct 5030 -449 5078 -429 5116 -389 ct 5153 -349 5171 -292 5171 -220 ct
+5171 -216 5171 -209 5171 -200 ct 4843 -200 l 4846 -152 4860 -115 4884 -89 ct
+4909 -64 4940 -51 4976 -51 ct 5004 -51 5027 -58 5046 -72 ct 5065 -87 l 5081 -110 l
+p
+4848 -261 m 5093 -261 l 5090 -298 5080 -326 5065 -344 ct 5041 -373 5010 -387 4972 -387 ct
+4938 -387 4910 -376 4886 -353 ct 4863 -330 l 4850 -300 l p ef
+5897 -356 m 5497 -356 l 5497 -425 l 5897 -425 l p
+5897 -172 m 5497 -172 l 5497 -241 l 5897 -241 l p ef
+6264 0 m 6264 -381 l 6198 -381 l 6198 -439 l 6264 -439 l 6264 -485 l
+6264 -515 6267 -537 6272 -551 ct 6279 -571 6292 -586 6310 -598 ct 6328 -610 6353 -616 6386 -616 ct
+6407 -616 6430 -614 6455 -609 ct 6444 -544 l 6429 -547 6414 -548 6400 -548 ct
+6378 -548 6362 -543 6352 -533 ct 6343 -524 6338 -506 6338 -479 ct 6338 -439 l
+6424 -439 l 6424 -381 l 6338 -381 l 6338 0 l p ef
+6455 -131 m 6528 -142 l 6532 -113 6544 -90 6563 -74 ct 6582 -59 6608 -51 6642 -51 ct
+6676 -51 6701 -58 6718 -72 ct 6735 -86 6743 -102 6743 -121 ct 6743 -138 6736 -151 6721 -160 ct
+6711 -167 6685 -175 6645 -186 ct 6590 -199 6552 -211 6531 -221 ct 6510 -231 6494 -245 6483 -263 ct
+6472 -281 6467 -301 6467 -322 ct 6467 -342 6471 -360 6480 -376 ct 6489 -393 6502 -407 6517 -418 ct
+6529 -427 6544 -434 6564 -440 ct 6584 -446 6606 -449 6629 -449 ct 6663 -449 6693 -444 6719 -434 ct
+6746 -424 6765 -410 6777 -393 ct 6790 -376 6798 -354 6803 -325 ct 6730 -315 l
+6727 -338 6717 -356 6701 -368 ct 6685 -381 6663 -387 6634 -387 ct 6600 -387 6575 -382 6561 -370 ct
+6546 -359 6539 -346 6539 -331 ct 6539 -321 6542 -312 6548 -305 ct 6554 -297 6564 -290 6577 -285 ct
+6584 -282 6606 -276 6642 -266 ct 6695 -252 6732 -240 6753 -231 ct 6773 -222 6790 -209 6802 -192 ct
+6813 -175 6819 -154 6819 -129 ct 6819 -104 6812 -80 6798 -58 ct 6783 -37 6762 -20 6735 -8 ct
+6708 3 6677 9 6642 9 ct 6585 9 6542 -1 6512 -25 ct 6482 -49 l 6463 -84 l p ef
+pom
+gr
+gs
+pum
+15981 14102 t
+62 0 m 62 -606 l 289 -606 l 335 -606 372 -600 400 -587 ct 428 -575 450 -556 466 -531 ct
+482 -505 490 -479 490 -451 ct 490 -425 483 -400 469 -378 ct 455 -355 434 -336 405 -322 ct
+442 -311 470 -293 490 -267 ct 510 -241 519 -211 519 -175 ct 519 -147 513 -120 501 -96 ct
+489 -72 475 -53 457 -40 ct 439 -26 417 -16 391 -10 ct 364 -3 331 0 293 0 ct p
+142 -351 m 273 -351 l 308 -351 334 -353 349 -358 ct 370 -364 385 -374 395 -388 ct
+406 -402 411 -420 411 -441 ct 411 -461 406 -479 397 -494 ct 387 -510 373 -520 355 -526 ct
+337 -531 307 -534 263 -534 ct 142 -534 l p
+142 -71 m 293 -71 l 319 -71 337 -72 347 -74 ct 366 -77 381 -83 394 -90 ct
+406 -98 416 -109 424 -124 ct 432 -139 436 -156 436 -175 ct 436 -198 430 -218 419 -234 ct
+407 -251 391 -263 371 -269 ct 350 -276 321 -279 282 -279 ct 142 -279 l p ef
+898 -54 m 870 -30 844 -14 818 -4 ct 793 5 765 9 736 9 ct 688 9 651 -1 625 -25 ct
+599 -49 586 -79 586 -115 ct 586 -137 591 -156 601 -174 ct 611 -192 623 -206 639 -217 ct
+655 -228 673 -236 693 -241 ct 707 -245 729 -249 759 -253 ct 819 -260 863 -268 892 -278 ct
+892 -288 892 -295 892 -298 ct 892 -328 885 -349 871 -362 ct 852 -379 824 -387 786 -387 ct
+751 -387 725 -381 709 -369 ct 692 -356 680 -335 672 -303 ct 599 -313 l 606 -345 616 -370 632 -389 ct
+647 -408 669 -423 697 -433 ct 726 -443 759 -449 797 -449 ct 835 -449 865 -444 888 -435 ct
+912 -427 929 -415 940 -402 ct 951 -389 959 -372 963 -351 ct 966 -339 967 -316 967 -283 ct
+967 -184 l 967 -114 969 -71 972 -52 ct 975 -34 981 -16 991 0 ct 913 0 l 905 -15 l
+900 -33 l p
+892 -220 m 865 -209 824 -200 770 -192 ct 740 -187 718 -182 705 -177 ct 693 -171 683 -163 676 -153 ct
+669 -142 666 -130 666 -117 ct 666 -98 673 -81 688 -68 ct 703 -55 725 -48 754 -48 ct
+783 -48 808 -54 831 -67 ct 853 -79 869 -96 880 -118 ct 888 -135 892 -160 892 -193 ct
+p ef
+1060 0 m 1060 -439 l 1127 -439 l 1127 -376 l 1160 -425 1206 -449 1267 -449 ct
+1294 -449 1318 -444 1340 -434 ct 1362 -425 1379 -412 1390 -397 ct 1401 -382 1409 -363 1413 -342 ct
+1416 -328 1417 -304 1417 -270 ct 1417 0 l 1343 0 l 1343 -267 l 1343 -297 1340 -320 1334 -335 ct
+1328 -350 1318 -362 1303 -371 ct 1289 -380 1271 -384 1251 -384 ct 1220 -384 1192 -374 1169 -354 ct
+1146 -334 1135 -296 1135 -239 ct 1135 0 l p ef
+1822 0 m 1822 -55 l 1794 -11 1754 9 1699 9 ct 1664 9 1632 0 1603 -19 ct 1574 -38 1551 -65 1535 -99 ct
+1519 -134 1510 -174 1510 -219 ct 1510 -263 1518 -302 1532 -338 ct 1547 -374 1569 -401 1598 -420 ct
+1627 -439 1660 -449 1696 -449 ct 1723 -449 1746 -443 1767 -432 ct 1788 -421 1804 -406 1817 -388 ct
+1817 -606 l 1891 -606 l 1891 0 l p
+1587 -219 m 1587 -162 1599 -120 1623 -93 ct 1646 -65 1674 -51 1706 -51 ct 1739 -51 1767 -64 1789 -91 ct
+1812 -117 1824 -158 1824 -212 ct 1824 -273 1812 -317 1789 -345 ct 1766 -373 1737 -387 1703 -387 ct
+1670 -387 1642 -374 1620 -346 ct 1598 -319 l 1587 -277 l p ef
+2094 0 m 1960 -439 l 2037 -439 l 2107 -185 l 2133 -91 l 2134 -96 2142 -126 2156 -181 ct
+2226 -439 l 2302 -439 l 2368 -184 l 2390 -100 l 2415 -185 l 2490 -439 l
+2563 -439 l 2425 0 l 2348 0 l 2278 -263 l 2261 -337 l 2172 0 l p ef
+2596 -520 m 2596 -606 l 2670 -606 l 2670 -520 l p
+2596 0 m 2596 -439 l 2670 -439 l 2670 0 l p ef
+3065 0 m 3065 -55 l 3037 -11 2997 9 2942 9 ct 2907 9 2875 0 2846 -19 ct 2817 -38 2794 -65 2778 -99 ct
+2762 -134 2753 -174 2753 -219 ct 2753 -263 2761 -302 2775 -338 ct 2790 -374 2812 -401 2841 -420 ct
+2870 -439 2903 -449 2939 -449 ct 2966 -449 2989 -443 3010 -432 ct 3031 -421 3047 -406 3060 -388 ct
+3060 -606 l 3134 -606 l 3134 0 l p
+2830 -219 m 2830 -162 2842 -120 2866 -93 ct 2889 -65 2917 -51 2949 -51 ct 2982 -51 3010 -64 3032 -91 ct
+3055 -117 3067 -158 3067 -212 ct 3067 -273 3055 -317 3032 -345 ct 3009 -373 2980 -387 2946 -387 ct
+2913 -387 2885 -374 2863 -346 ct 2841 -319 l 2830 -277 l p ef
+3419 -66 m 3430 0 l 3409 3 3390 5 3373 5 ct 3346 5 3325 1 3311 -7 ct 3296 -15 3285 -26 3279 -40 ct
+3273 -54 3270 -83 3270 -128 ct 3270 -381 l 3215 -381 l 3215 -439 l 3270 -439 l
+3270 -547 l 3344 -592 l 3344 -439 l 3419 -439 l 3419 -381 l 3344 -381 l
+3344 -124 l 3344 -103 3345 -89 3348 -83 ct 3351 -77 3355 -72 3361 -69 ct 3367 -65 3375 -63 3386 -63 ct
+3394 -63 l 3405 -64 l p ef
+3495 0 m 3495 -606 l 3570 -606 l 3570 -388 l 3605 -429 3648 -449 3701 -449 ct
+3734 -449 3762 -442 3786 -429 ct 3810 -417 3827 -399 3838 -376 ct 3848 -354 3853 -321 3853 -278 ct
+3853 0 l 3779 0 l 3779 -278 l 3779 -315 3771 -342 3754 -359 ct 3738 -376 3716 -385 3686 -385 ct
+3664 -385 3643 -379 3624 -367 ct 3604 -356 3590 -340 3582 -321 ct 3574 -301 3570 -274 3570 -240 ct
+3570 0 l p ef
+pom
+pum
+15888 15055 t
+340 0 m 340 -55 l 312 -11 272 9 217 9 ct 182 9 150 0 121 -19 ct 92 -38 69 -65 53 -99 ct
+37 -134 28 -174 28 -219 ct 28 -263 36 -302 50 -338 ct 65 -374 87 -401 116 -420 ct
+145 -439 178 -449 214 -449 ct 241 -449 264 -443 285 -432 ct 306 -421 322 -406 335 -388 ct
+335 -606 l 409 -606 l 409 0 l p
+105 -219 m 105 -162 117 -120 141 -93 ct 164 -65 192 -51 224 -51 ct 257 -51 285 -64 307 -91 ct
+330 -117 342 -158 342 -212 ct 342 -273 330 -317 307 -345 ct 284 -373 255 -387 221 -387 ct
+188 -387 160 -374 138 -346 ct 116 -319 l 105 -277 l p ef
+832 -141 m 909 -131 l 897 -86 874 -52 842 -27 ct 809 -2 767 9 716 9 ct 652 9 601 -9 563 -49 ct
+525 -88 507 -144 507 -215 ct 507 -289 526 -347 564 -387 ct 602 -428 651 -449 712 -449 ct
+770 -449 818 -429 856 -389 ct 893 -349 911 -292 911 -220 ct 911 -216 911 -209 911 -200 ct
+583 -200 l 586 -152 600 -115 624 -89 ct 649 -64 680 -51 716 -51 ct 744 -51 767 -58 786 -72 ct
+805 -87 l 821 -110 l p
+588 -261 m 833 -261 l 830 -298 820 -326 805 -344 ct 781 -373 750 -387 712 -387 ct
+678 -387 650 -376 626 -353 ct 603 -330 l 590 -300 l p ef
+1295 -160 m 1368 -151 l 1360 -100 1340 -61 1307 -32 ct 1274 -4 1233 9 1185 9 ct
+1125 9 1077 -9 1040 -49 ct 1004 -88 986 -144 986 -217 ct 986 -265 993 -306 1009 -342 ct
+1025 -378 1049 -404 1081 -422 ct 1113 -440 1148 -449 1186 -449 ct 1233 -449 1272 -437 1303 -412 ct
+1333 -388 1353 -354 1361 -310 ct 1289 -299 l 1282 -328 1270 -350 1252 -365 ct
+1235 -380 1213 -387 1189 -387 ct 1151 -387 1121 -374 1097 -347 ct 1074 -320 1062 -278 1062 -220 ct
+1062 -161 1073 -118 1096 -91 ct 1119 -64 1148 -51 1185 -51 ct 1214 -51 1238 -60 1258 -78 ct
+1277 -96 l 1290 -123 l p ef
+1432 -520 m 1432 -606 l 1506 -606 l 1506 -520 l p
+1432 0 m 1432 -439 l 1506 -439 l 1506 0 l p ef
+1616 0 m 1616 -439 l 1683 -439 l 1683 -377 l 1697 -399 1715 -416 1738 -429 ct
+1761 -442 1787 -449 1816 -449 ct 1849 -449 1875 -442 1896 -428 ct 1917 -415 1932 -396 1940 -372 ct
+1975 -423 2020 -449 2076 -449 ct 2119 -449 2153 -437 2176 -412 ct 2200 -388 2211 -351 2211 -301 ct
+2211 0 l 2137 0 l 2137 -276 l 2137 -306 2135 -327 2130 -340 ct 2125 -354 2117 -364 2104 -372 ct
+2091 -380 2076 -384 2059 -384 ct 2028 -384 2003 -374 1982 -353 ct 1962 -333 1952 -300 1952 -255 ct
+1952 0 l 1877 0 l 1877 -285 l 1877 -318 1871 -343 1859 -359 ct 1847 -376 1827 -384 1800 -384 ct
+1779 -384 1759 -379 1741 -368 ct 1724 -357 1711 -340 1703 -319 ct 1695 -298 1691 -267 1691 -227 ct
+1691 0 l p ef
+2617 -54 m 2589 -30 2563 -14 2537 -4 ct 2512 5 2484 9 2455 9 ct 2407 9 2370 -1 2344 -25 ct
+2318 -49 2305 -79 2305 -115 ct 2305 -137 2310 -156 2320 -174 ct 2330 -192 2342 -206 2358 -217 ct
+2374 -228 2392 -236 2412 -241 ct 2426 -245 2448 -249 2478 -253 ct 2538 -260 2582 -268 2611 -278 ct
+2611 -288 2611 -295 2611 -298 ct 2611 -328 2604 -349 2590 -362 ct 2571 -379 2543 -387 2505 -387 ct
+2470 -387 2444 -381 2428 -369 ct 2411 -356 2399 -335 2391 -303 ct 2318 -313 l
+2325 -345 2335 -370 2351 -389 ct 2366 -408 2388 -423 2416 -433 ct 2445 -443 2478 -449 2516 -449 ct
+2554 -449 2584 -444 2607 -435 ct 2631 -427 2648 -415 2659 -402 ct 2670 -389 2678 -372 2682 -351 ct
+2685 -339 2686 -316 2686 -283 ct 2686 -184 l 2686 -114 2688 -71 2691 -52 ct
+2694 -34 2700 -16 2710 0 ct 2632 0 l 2624 -15 l 2619 -33 l p
+2611 -220 m 2584 -209 2543 -200 2489 -192 ct 2459 -187 2437 -182 2424 -177 ct
+2412 -171 2402 -163 2395 -153 ct 2388 -142 2385 -130 2385 -117 ct 2385 -98 2392 -81 2407 -68 ct
+2422 -55 2444 -48 2473 -48 ct 2502 -48 2527 -54 2550 -67 ct 2572 -79 2588 -96 2599 -118 ct
+2607 -135 2611 -160 2611 -193 ct p ef
+2943 -66 m 2954 0 l 2933 3 2914 5 2897 5 ct 2870 5 2849 1 2835 -7 ct 2820 -15 2809 -26 2803 -40 ct
+2797 -54 2794 -83 2794 -128 ct 2794 -381 l 2739 -381 l 2739 -439 l 2794 -439 l
+2794 -547 l 2868 -592 l 2868 -439 l 2943 -439 l 2943 -381 l 2868 -381 l
+2868 -124 l 2868 -103 2869 -89 2872 -83 ct 2875 -77 2879 -72 2885 -69 ct 2891 -65 2899 -63 2910 -63 ct
+2918 -63 l 2929 -64 l p ef
+3019 -520 m 3019 -606 l 3093 -606 l 3093 -520 l p
+3019 0 m 3019 -439 l 3093 -439 l 3093 0 l p ef
+3177 -219 m 3177 -300 3199 -361 3244 -400 ct 3282 -432 3328 -449 3383 -449 ct
+3443 -449 3492 -429 3531 -389 ct 3569 -350 3588 -295 3588 -225 ct 3588 -169 3580 -124 3563 -92 ct
+3546 -60 3521 -34 3489 -16 ct 3456 0 3421 9 3383 9 ct 3321 9 3271 -9 3233 -49 ct
+3196 -88 l 3177 -145 l p
+3253 -219 m 3253 -163 3265 -121 3290 -93 ct 3314 -65 3345 -51 3383 -51 ct 3420 -51 3450 -65 3475 -93 ct
+3499 -121 3512 -164 3512 -222 ct 3512 -276 3499 -317 3475 -345 ct 3450 -373 3419 -387 3383 -387 ct
+3345 -387 3314 -373 3290 -345 ct 3265 -317 l 3253 -275 l p ef
+3680 0 m 3680 -439 l 3747 -439 l 3747 -376 l 3780 -425 3826 -449 3887 -449 ct
+3914 -449 3938 -444 3960 -434 ct 3982 -425 3999 -412 4010 -397 ct 4021 -382 4029 -363 4033 -342 ct
+4036 -328 4037 -304 4037 -270 ct 4037 0 l 3963 0 l 3963 -267 l 3963 -297 3960 -320 3954 -335 ct
+3948 -350 3938 -362 3923 -371 ct 3909 -380 3891 -384 3871 -384 ct 3840 -384 3812 -374 3789 -354 ct
+3766 -334 3755 -296 3755 -239 ct 3755 0 l p ef
+pom
+pum
+16087 16008 t
+73 0 m 73 -381 l 7 -381 l 7 -439 l 73 -439 l 73 -485 l 73 -515 76 -537 81 -551 ct
+88 -571 101 -586 119 -598 ct 137 -610 162 -616 195 -616 ct 216 -616 239 -614 264 -609 ct
+253 -544 l 238 -547 223 -548 209 -548 ct 187 -548 171 -543 161 -533 ct 152 -524 147 -506 147 -479 ct
+147 -439 l 233 -439 l 233 -381 l 147 -381 l 147 0 l p ef
+580 -54 m 552 -30 526 -14 500 -4 ct 475 5 447 9 418 9 ct 370 9 333 -1 307 -25 ct
+281 -49 268 -79 268 -115 ct 268 -137 273 -156 283 -174 ct 293 -192 305 -206 321 -217 ct
+337 -228 355 -236 375 -241 ct 389 -245 411 -249 441 -253 ct 501 -260 545 -268 574 -278 ct
+574 -288 574 -295 574 -298 ct 574 -328 567 -349 553 -362 ct 534 -379 506 -387 468 -387 ct
+433 -387 407 -381 391 -369 ct 374 -356 362 -335 354 -303 ct 281 -313 l 288 -345 298 -370 314 -389 ct
+329 -408 351 -423 379 -433 ct 408 -443 441 -449 479 -449 ct 517 -449 547 -444 570 -435 ct
+594 -427 611 -415 622 -402 ct 633 -389 641 -372 645 -351 ct 648 -339 649 -316 649 -283 ct
+649 -184 l 649 -114 651 -71 654 -52 ct 657 -34 663 -16 673 0 ct 595 0 l 587 -15 l
+582 -33 l p
+574 -220 m 547 -209 506 -200 452 -192 ct 422 -187 400 -182 387 -177 ct 375 -171 365 -163 358 -153 ct
+351 -142 348 -130 348 -117 ct 348 -98 355 -81 370 -68 ct 385 -55 407 -48 436 -48 ct
+465 -48 490 -54 513 -67 ct 535 -79 551 -96 562 -118 ct 570 -135 574 -160 574 -193 ct
+p ef
+1030 -160 m 1103 -151 l 1095 -100 1075 -61 1042 -32 ct 1009 -4 968 9 920 9 ct
+860 9 812 -9 775 -49 ct 739 -88 721 -144 721 -217 ct 721 -265 728 -306 744 -342 ct
+760 -378 784 -404 816 -422 ct 848 -440 883 -449 921 -449 ct 968 -449 1007 -437 1038 -412 ct
+1068 -388 1088 -354 1096 -310 ct 1024 -299 l 1017 -328 1005 -350 987 -365 ct
+970 -380 948 -387 924 -387 ct 886 -387 856 -374 832 -347 ct 809 -320 797 -278 797 -220 ct
+797 -161 808 -118 831 -91 ct 854 -64 883 -51 920 -51 ct 949 -51 973 -60 993 -78 ct
+1012 -96 l 1025 -123 l p ef
+1329 -66 m 1340 0 l 1319 3 1300 5 1283 5 ct 1256 5 1235 1 1221 -7 ct 1206 -15 1195 -26 1189 -40 ct
+1183 -54 1180 -83 1180 -128 ct 1180 -381 l 1125 -381 l 1125 -439 l 1180 -439 l
+1180 -547 l 1254 -592 l 1254 -439 l 1329 -439 l 1329 -381 l 1254 -381 l
+1254 -124 l 1254 -103 1255 -89 1258 -83 ct 1261 -77 1265 -72 1271 -69 ct 1277 -65 1285 -63 1296 -63 ct
+1304 -63 l 1315 -64 l p ef
+1377 -219 m 1377 -300 1399 -361 1444 -400 ct 1482 -432 1528 -449 1583 -449 ct
+1643 -449 1692 -429 1731 -389 ct 1769 -350 1788 -295 1788 -225 ct 1788 -169 1780 -124 1763 -92 ct
+1746 -60 1721 -34 1689 -16 ct 1656 0 1621 9 1583 9 ct 1521 9 1471 -9 1433 -49 ct
+1396 -88 l 1377 -145 l p
+1453 -219 m 1453 -163 1465 -121 1490 -93 ct 1514 -65 1545 -51 1583 -51 ct 1620 -51 1650 -65 1675 -93 ct
+1699 -121 1712 -164 1712 -222 ct 1712 -276 1699 -317 1675 -345 ct 1650 -373 1619 -387 1583 -387 ct
+1545 -387 1514 -373 1490 -345 ct 1465 -317 l 1453 -275 l p ef
+1881 0 m 1881 -439 l 1948 -439 l 1948 -372 l 1965 -403 1980 -424 1995 -434 ct
+2009 -444 2025 -449 2043 -449 ct 2068 -449 2093 -441 2119 -425 ct 2094 -356 l
+2075 -366 2057 -372 2039 -372 ct 2023 -372 2008 -367 1995 -357 ct 1982 -347 1973 -334 1967 -316 ct
+1959 -290 1955 -261 1955 -229 ct 1955 0 l p ef
+2802 -356 m 2402 -356 l 2402 -425 l 2802 -425 l p
+2802 -172 m 2402 -172 l 2402 -241 l 2802 -241 l p ef
+3160 0 m 3160 -606 l 3242 -606 l 3561 -130 l 3561 -606 l 3638 -606 l
+3638 0 l 3555 0 l 3237 -476 l 3237 0 l p ef
+pom
+gr
+17781 10461 m 17631 10911 l 17931 10910 l 17781 10461 l p ef
+17781 13336 m 17781 10821 l ps
+gs
+pum
+17357 3466 t
+73 0 m 73 -381 l 7 -381 l 7 -439 l 73 -439 l 73 -485 l 73 -515 76 -537 81 -551 ct
+88 -571 101 -586 119 -598 ct 137 -610 162 -616 195 -616 ct 216 -616 239 -614 264 -609 ct
+253 -544 l 238 -547 223 -548 209 -548 ct 187 -548 171 -543 161 -533 ct 152 -524 147 -506 147 -479 ct
+147 -439 l 233 -439 l 233 -381 l 147 -381 l 147 0 l p ef
+264 -131 m 337 -142 l 341 -113 353 -90 372 -74 ct 391 -59 417 -51 451 -51 ct
+485 -51 510 -58 527 -72 ct 544 -86 552 -102 552 -121 ct 552 -138 545 -151 530 -160 ct
+520 -167 494 -175 454 -186 ct 399 -199 361 -211 340 -221 ct 319 -231 303 -245 292 -263 ct
+281 -281 276 -301 276 -322 ct 276 -342 280 -360 289 -376 ct 298 -393 311 -407 326 -418 ct
+338 -427 353 -434 373 -440 ct 393 -446 415 -449 438 -449 ct 472 -449 502 -444 528 -434 ct
+555 -424 574 -410 586 -393 ct 599 -376 607 -354 612 -325 ct 539 -315 l 536 -338 526 -356 510 -368 ct
+494 -381 472 -387 443 -387 ct 409 -387 384 -382 370 -370 ct 355 -359 348 -346 348 -331 ct
+348 -321 351 -312 357 -305 ct 363 -297 373 -290 386 -285 ct 393 -282 415 -276 451 -266 ct
+504 -252 541 -240 562 -231 ct 582 -222 599 -209 611 -192 ct 622 -175 628 -154 628 -129 ct
+628 -104 621 -80 607 -58 ct 592 -37 571 -20 544 -8 ct 517 3 486 9 451 9 ct 394 9 351 -1 321 -25 ct
+291 -49 l 272 -84 l p ef
+635 10 m 810 -616 l 870 -616 l 694 10 l p ef
+937 0 m 937 -606 l 1019 -606 l 1338 -130 l 1338 -606 l 1415 -606 l
+1415 0 l 1332 0 l 1014 -476 l 1014 0 l p ef
+pom
+gr
+22227 6350 m 22199 5876 l 21920 5987 l 22227 6350 l p ef
+19422 3175 m 19475 3175 l ps
+19528 3175 m 19581 3175 l ps
+19634 3175 m 19687 3175 l ps
+19740 3175 m 19793 3175 l ps
+19846 3175 m 19899 3175 l ps
+19952 3175 m 20006 3175 l ps
+20059 3175 m 20112 3175 l ps
+20165 3175 m 20218 3175 l ps
+20271 3175 m 20324 3175 l ps
+20377 3175 m 20430 3175 l ps
+20483 3175 m 20536 3175 l ps
+20590 3175 m 20643 3175 l ps
+20696 3175 m 20749 3175 l ps
+20802 3175 m 20855 3175 l ps
+20908 3175 m 20956 3175 l ps
+20956 3175 m 20958 3180 l ps
+20977 3229 m 20997 3278 l ps
+21017 3328 m 21037 3377 l ps
+21056 3426 m 21076 3475 l ps
+21096 3525 m 21115 3574 l ps
+21135 3623 m 21155 3673 l ps
+21175 3722 m 21194 3771 l ps
+21214 3821 m 21234 3870 l ps
+21254 3919 m 21273 3968 l ps
+21293 4018 m 21313 4067 l ps
+21332 4116 m 21352 4166 l ps
+21372 4215 m 21392 4264 l ps
+21411 4313 m 21431 4363 l ps
+21451 4412 m 21471 4461 l ps
+21490 4511 m 21510 4560 l ps
+21530 4609 m 21550 4658 l ps
+21569 4708 m 21589 4757 l ps
+21609 4806 m 21628 4856 l ps
+21648 4905 m 21668 4954 l ps
+21688 5003 m 21707 5053 l ps
+21727 5102 m 21747 5151 l ps
+21767 5201 m 21786 5250 l ps
+21806 5299 m 21826 5348 l ps
+21845 5398 m 21865 5447 l ps
+21885 5496 m 21905 5546 l ps
+21924 5595 m 21944 5644 l ps
+21964 5693 m 21984 5743 l ps
+22003 5792 m 22023 5841 l ps
+22043 5891 m 22063 5940 l ps
+22082 5989 m 22093 6015 l ps
+gr
+0 20290 t
+pom
+count op_count sub {pop} repeat countdictstack dict_count sub {end} repeat b4_inc_state restore
+%%PageTrailer
+%%Trailer
+%%EOF
diff --git a/docs/exploring-gnuradio/ddc.png b/docs/exploring-gnuradio/ddc.png
new file mode 100644
index 000000000..ce35bc2a9
--- /dev/null
+++ b/docs/exploring-gnuradio/ddc.png
Binary files differ
diff --git a/docs/exploring-gnuradio/dial_tone.py b/docs/exploring-gnuradio/dial_tone.py
new file mode 100755
index 000000000..cabfa0864
--- /dev/null
+++ b/docs/exploring-gnuradio/dial_tone.py
@@ -0,0 +1,43 @@
+#!/usr/bin/env python
+#
+# Copyright 2004,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.
+#
+
+from gnuradio import gr
+from gnuradio import audio
+
+def build_graph ():
+ sampling_freq = 32000
+ ampl = 0.1
+
+ tb = gr.top_block ()
+ src0 = gr.sig_source_f (sampling_freq, gr.GR_SIN_WAVE, 350, ampl)
+ src1 = gr.sig_source_f (sampling_freq, gr.GR_SIN_WAVE, 440, ampl)
+ dst = audio.sink (sampling_freq)
+ tb.connect (src0, (dst, 0))
+ tb.connect (src1, (dst, 1))
+
+ return tb
+
+if __name__ == '__main__':
+ tb = build_graph ()
+ tb.start ()
+ raw_input ('Press Enter to quit: ')
+ tb.stop ()
diff --git a/docs/exploring-gnuradio/dial_tone_example.xml b/docs/exploring-gnuradio/dial_tone_example.xml
new file mode 100644
index 000000000..14ea68039
--- /dev/null
+++ b/docs/exploring-gnuradio/dial_tone_example.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<example id="dial_tone_ex"><title>Dial Tone Output</title>
+<programlisting>
+#!/usr/bin/env python
+
+from gnuradio import gr
+from gnuradio import audio
+
+def build_graph ():
+ sampling_freq = 48000
+ ampl = 0.1
+
+ fg = gr.flow_graph ()
+ src0 = gr.sig_source_f (sampling_freq, gr.GR_SIN_WAVE, 350, ampl)
+ src1 = gr.sig_source_f (sampling_freq, gr.GR_SIN_WAVE, 440, ampl)
+ dst = audio.sink (sampling_freq)
+ fg.connect ((src0, 0), (dst, 0))
+ fg.connect ((src1, 0), (dst, 1))
+
+ return fg
+
+if __name__ == '__main__':
+ fg = build_graph ()
+ fg.start ()
+ raw_input ('Press Enter to quit: ')
+ fg.stop ()
+</programlisting>
+</example>
diff --git a/docs/exploring-gnuradio/exploring-gnuradio.xml b/docs/exploring-gnuradio/exploring-gnuradio.xml
new file mode 100644
index 000000000..286ca8609
--- /dev/null
+++ b/docs/exploring-gnuradio/exploring-gnuradio.xml
@@ -0,0 +1,460 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
+ "docbookx.dtd" [
+ <!ENTITY dial_tone_example SYSTEM "dial_tone_example.xml">
+ <!ENTITY fm_demod_example SYSTEM "fm_demod_example.xml">
+]>
+
+<article>
+<articleinfo>
+ <title>Exploring GNU Radio</title>
+ <author>
+ <firstname>Eric</firstname>
+ <surname>Blossom</surname>
+ <affiliation>
+ <address>
+ <email>eb@comsec.com</email>
+ </address>
+ </affiliation>
+ </author>
+
+<revhistory>
+ <revision>
+ <revnumber>v1.1</revnumber>
+ <date>2004-11-29</date>
+ <revremark>
+ Revised and expanded. Examples now use 2.x code base.
+ </revremark>
+ </revision>
+
+ <revision>
+ <revnumber>v1.0</revnumber>
+ <date>2004-02-29</date>
+ <revremark>
+ Initial version published in Linux Journal, Issue 122, June 2004, as
+ <emphasis>GNU Radio: Tools for Exploring the RF Spectrum</emphasis>.
+ </revremark>
+ </revision>
+</revhistory>
+
+<abstract><para>This article provides an overview of the GNU Radio
+toolkit for building software radios.
+</para></abstract>
+
+</articleinfo>
+
+<sect1 id="intro"><title>Introduction</title>
+
+<para>Software radio is the technique of getting code as close to the
+antenna as possible. It turns radio hardware problems into software
+problems. The fundamental characteristic of software radio is that
+software defines the transmitted waveforms, and software demodulates
+the received waveforms. This is in contrast to most radios in which
+the processing is done with either analog circuitry or analog
+circuitry combined with digital chips. GNU Radio is a free software
+toolkit for building software radios.</para>
+
+<para>Software radio is a revolution in radio design due to its ability to
+create radios that change on the fly, creating new choices for
+users. At the baseline, software radios can do pretty much anything a
+traditional radio can do. The exciting part is the flexibility that
+software provides you. Instead of a bunch of fixed function gadgets,
+in the next few years we'll see a move to universal communication
+devices. Imagine a device that can morph into a cell phone and get you
+connectivity using GPRS, 802.11 Wi-Fi, 802.16 WiMax, a satellite
+hookup or the emerging standard of the day. You could determine your
+location using GPS, GLONASS or both.</para>
+
+<para>Perhaps most exciting of all is the potential to build decentralized
+communication systems. If you look at today's systems, the vast
+majority are infrastructure-based. Broadcast radio and TV provide a
+one-way channel, are tightly regulated and the content is controlled
+by a handful of organizations. Cell phones are a great convenience,
+but the features your phone supports are determined by the operator's
+interests, not yours.</para>
+
+<para>A centralized system limits the rate of innovation. We could take some
+lessons from the Internet and push the smarts out to the
+edges. Instead of cell phones being second-class citizens, usable only
+if infrastructure is in place and limited to the capabilities
+determined worthwhile by the operator, we could build smarter
+devices. These user-owned devices would generate the network. They'd
+create a mesh among themselves, negotiate for backhaul and be free to
+evolve new solutions, features and applications.</para>
+
+</sect1>
+
+<sect1 id="block-diagram"><title>The Block Diagram</title>
+
+<para><xref linkend="block-diagram-fig"/> shows a typical block
+diagram for a software radio. To understand the software part of the
+radio, we first need to understand a bit about the associated
+hardware. Examining the receive path in the figure,
+we see an antenna, a mysterious RF front end, an analog-to-digital
+converter (ADC) and a bunch of code. The analog-to-digital converter
+is the bridge between the physical world of continuous analog signals
+and the world of discrete digital samples manipulated by
+software.</para>
+
+<figure id="block-diagram-fig"><title>Typical software radio block diagram</title>
+<mediaobject>
+<imageobject><imagedata fileref="swr-block-diagram.eps" format="EPS"/></imageobject>
+<imageobject><imagedata fileref="swr-block-diagram.png" format="PNG"/></imageobject>
+<caption><para></para></caption>
+</mediaobject>
+</figure>
+
+<para>ADCs have two primary characteristics, sampling rate and dynamic
+range. Sampling rate is the number of times per second that the ADC
+measures the analog signal. Dynamic range refers to the difference
+between the smallest and largest signal that can be distinguished;
+it's a function of the number of bits in the ADC's digital output and
+the design of the converter. For example, an 8-bit converter at most
+can represent 256 (2<superscript>8</superscript>) signal levels, while
+a 16-bit converter represents up to 65,536 levels. Generally speaking,
+device physics and cost impose trade-offs between the sample rate and
+dynamic range.</para>
+
+<para>Before we dive into the software, we need to talk about a bit of
+theory. In 1927, a Swedish-born physicist and electrical engineer
+named Harry Nyquist determined that to avoid aliasing when converting
+from analog to digital, the ADC sampling frequency must be at least
+twice the bandwidth of the signal of interest. Aliasing is what makes
+the wagon wheels look like they're going backward in the old westerns:
+the sampling rate of the movie camera is not fast enough to represent
+the position of the spokes unambiguously.</para>
+
+<para>Assuming we're dealing with low pass signals - signals where the
+bandwidth of interest goes from 0 to f<subscript>MAX</subscript>, the
+Nyquist criterion states that our sampling frequency needs to be at
+least 2 * f<subscript>MAX</subscript>. But if our ADC runs at 20 MHz,
+how can we listen to broadcast FM radio at 92.1 MHz? The answer is the
+RF front end. The receive RF front end translates a range of
+frequencies appearing at its input to a lower range at its output. For
+example, we could imagine an RF front end that translated the signals
+occurring in the 90 - 100 MHz range down to the 0 - 10 MHz
+range.</para>
+
+<para>Mostly, we can treat the RF front end as a black box with a single
+control, the center of the input range that's to be translated. As a
+concrete example, a cable modem tuner module that we've employed
+successfully has the following characteristics. It translates a 6 MHz
+chunk of the spectrum centered between about 50 MHz and 800 MHz down to
+an output range centered at 5.75 MHz. The center frequency of the
+output range is called the intermediate frequency, or IF.</para>
+
+<para>In the simplest-thing-that-possibly-could-work category, the RF front
+end may be eliminated altogether. One GNU Radio experimenter has
+listened to AM and shortwave broadcasts by connecting a 100-foot piece
+of wire directly to his 20M sample/sec ADC.</para>
+
+</sect1>
+
+<sect1 id="software"><title>On to the Software</title>
+
+<para>GNU Radio provides a library of signal processing blocks and the
+glue to tie it all together. The programmer builds a radio by creating
+a graph (as in graph theory) where the vertices are signal processing
+blocks and the edges represent the data flow between them. The
+signal processing blocks are implemented in C++. Conceptually,
+blocks process infinite streams of data flowing from their input
+ports to their output ports. Blocks' attributes include the number
+of input and output ports they have as well as the type of data that
+flows through each. The most frequently used types are short, float
+and complex.</para>
+
+<para>Some blocks have only output ports or input ports. These serve as
+data sources and sinks in the graph. There are sources that read from
+a file or ADC, and sinks that write to a file, digital-to-analog
+converter (DAC) or graphical display. About 100 blocks come with
+GNU Radio. Writing new blocks is not difficult.</para>
+
+<para>Graphs are constructed and run in Python.
+<!-- <xref linkend="dial_tone_ex"/> -->
+Example 1
+is the "Hello World" of GNU Radio. It generates two sine waves and outputs
+them to the sound card, one on the left channel, one on the
+right.</para>
+
+&dial_tone_example;
+
+<para>We start by creating a flow graph to hold the blocks and
+connections between them. The two sine waves are generated by the
+gr.sig_source_f calls. The f suffix indicates that the source produces
+floats. One sine wave is at 350 Hz, and the other is at
+440 Hz. Together, they sound like the US dial tone.</para>
+
+<para>audio.sink is a sink that writes its input to the sound card. It
+takes one or more streams of floats in the range -1 to +1 as its
+input. We connect the three blocks together using the
+<methodname>connect</methodname> method of the flow graph.</para>
+
+<para><methodname>connect</methodname> takes two parameters, the
+source endpoint and the destination endpoint, and creates a connection
+from the source to the destination. An endpoint has two components: a
+signal processing block and a port number. The port number specifies
+which input or output port of the specified block is to be connected.
+In the most general form, an endpoint is represented as a python tuple
+like this: <literal>(block, port_number)</literal>. When
+<literal>port_number</literal> is zero, the block may be used alone.
+</para>
+
+<para>These two expressions are equivalent:</para>
+<programlisting>
+fg.connect ((src1, 0), (dst, 1))
+fg.connect (src1, (dst, 1))
+</programlisting>
+
+<para>Once the graph is built, we start it. Calling
+<methodname>start</methodname> forks one or more threads to run the
+computation described by the graph and returns control immediately to
+the caller. In this case, we simply wait for any keystroke.</para>
+
+</sect1>
+
+<sect1 id="fm-receiver"><title>A Complete FM Receiver</title>
+
+<para>
+<!-- <xref linkend="fm_demod_ex"/> -->
+Example 2
+shows a somewhat simplified but
+complete broadcast FM receiver. It includes control of the RF front
+end and all required signal processing. This example uses an RF front
+end built from a cable modem tuner and a 20M sample/sec
+analog-to-digital converter.</para>
+
+&fm_demod_example;
+
+<para>Like the Hello World example, we build a graph, connect the
+blocks together and start it. In this case, our source, mc4020.source,
+is an interface to the Measurement Computing PCI-DAS 4020/12
+high-speed ADC. We follow it with gr.freq_xlating_fir_filter_scf, a
+finite impulse response (FIR) filter that selects the FM station we're
+looking for and translates it to baseband (0Hz, DC). With the 20M
+sample/sec converter and cable modem tuner, we're really grabbing
+something in the neighborhood of a 6 MHz chunk of the spectrum. This
+single chunk may contain ten or more FM stations, and
+gr.freq_xlating_fir_filter_scf allows us to select the one we
+want.</para>
+
+<para>In this case, we select the one at the exact center of the IF of
+the RF front end (5.75 MHz). The output of
+gr.freq_xlating_fir_filter_scf is a stream of complex samples at
+160,000 samples/second. We feed the complex baseband signal into
+gr.quadrature_demod_cf, the block that does the actual FM
+demodulation.</para>
+
+<para>gr.quadrature_demod_cf works by subtracting the angle of
+each adjacent complex sample, effectively differentiating the
+frequency. The output of gr.quadrature_demod_cf contains the
+left-plus-right FM mono audio signal, the stereo pilot tone at 19kHz,
+the left-minus-right stereo information centered at 38kHz and any
+other sub-carriers above that. For this simplified receiver, we finish
+off by low pass filtering and decimating the stream, keeping only the
+left-plus-right audio information, and send that to the sound card at
+32,000 samples/sec.</para>
+
+<para>For a more indepth look at how the FM receiver
+works, please see "Listening to FM, Step by Step."</para>
+
+</sect1>
+
+<sect1 id="gui"><title>Graphical User Interfaces</title>
+
+<para>Graphical interfaces for GNU Radio applications are built in
+Python. Interfaces may be built using any toolkit you can access from
+Python; we recommend wxPython to maximize cross-platform
+portability. GNU Radio provides blocks that use interprocess
+communication to transfer chunks of data from the real-time C++ flow
+graph to Python-land. </para>
+
+<!-- please add more here, including example code and screen shots -->
+
+</sect1>
+
+<sect1 id="hardware-requirements"><title>Hardware Requirements</title>
+
+<para>GNU Radio is reasonably hardware-independent. Today's commodity
+multi-gigahertz, super-scalar CPUs with single-cycle floating-point
+units mean that serious digital signal processing is possible on the
+desktop. A 3 GHz Pentium or Athlon can evaluate 3 billion
+floating-point FIR taps/s. We now can build, virtually all in
+software, communication systems unthinkable only a few years ago.</para>
+
+<para>Your computational requirements depend on what you're trying to do,
+but generally speaking, a 1 or 2 GHz machine with at least 256 MB of RAM
+should suffice. You also need some way to connect the analog world to
+your computer. Low-cost options include built-in sound cards and
+audiophile quality 96 kHz, 24-bit, add-in cards. With either of these
+options, you are limited to processing relatively narrow band signals
+and need to use some kind of narrow-band RF front end.</para>
+
+<para>Another possible solution is an off-the-shelf, high-speed PCI
+analog-to-digital board. These are available in the 20M sample/sec
+range, but they are expensive, about the cost of a complete PC. For
+these high-speed boards, cable modem tuners make reasonable RF front
+ends.</para>
+
+<para>Finding none of these alternatives completely satisfactory, we
+designed the Universal Software Radio Peripheral, or USRP for short.
+</para>
+
+</sect1>
+
+<sect1 id="usrp"><title>The Universal Software Radio Peripheral</title>
+
+<para>Our preferred hardware solution is the Universal Software Radio
+Peripheral (USRP). <xref linkend="usrp-block-diagram-fig"/> shows the
+block diagram of the USRP. The brainchild of Matt Ettus, the USRP is
+an extremely flexible USB device that connects your PC to the RF
+world. The USRP consists of a small motherboard containing up to four
+12-bit 64M sample/sec ADCs, four 14-bit, 128M sample/sec DACs, a
+million gate-field programmable gate array (FPGA) and a programmable
+USB 2.0 controller. Each fully populated USRP motherboard supports
+four daughterboards, two for receive and two for transmit. RF front
+ends are implemented on the daughterboards. A variety of
+daughterboards is available to handle different frequency bands. For
+amateur radio use, low-power daughterboards are available that receive
+and transmit in the 440 MHz band and the 1.24 GHz band. A receive-only
+daughterboard based on a cable modem tuner is available that covers
+the range from 50 MHz to 800 MHz. Daughterboards are designed to be easy
+to prototype by hand in order to facilitate experimentation.</para>
+
+<figure id="usrp-block-diagram-fig"><title>Universal Software Radio Peripheral</title>
+<mediaobject>
+<imageobject><imagedata fileref="usrp-block-diagram.eps" format="EPS"/></imageobject>
+<imageobject><imagedata fileref="usrp-block-diagram.png" format="PNG"/></imageobject>
+<caption><para></para></caption>
+</mediaobject>
+</figure>
+
+<para>The flexibility of the USRP comes from the two programmable components
+on the board and their interaction with the host-side library. To get
+a feel for the USRP, let's look at its boot sequence. The USRP itself
+contains no ROM-based firmware, merely a few bytes that specify the
+vendor ID (VID), product ID (PID) and revision. When the USRP is
+plugged in to the USB for the first time, the host-side library sees
+an unconfigured USRP. It can tell it's unconfigured by reading the
+VID, PID and revision. The first thing the library code does is
+download the 8051 code that defines the behavior of the USB peripheral
+controller. When this code boots, the USRP simulates a USB disconnect
+and reconnect. When it reconnects, the host sees a different device:
+the VID, PID and revision are different. The firmware now running
+defines the USB endpoints, interfaces and command handlers. One of the
+commands the USB controller now understands is load the FPGA. The
+library code, after seeing the USRP reconnect as the new device, goes
+to the next stage of the boot process and downloads the FPGA
+configuration bitstream.</para>
+
+<para>FPGAs are generic hardware chips whose behavior is determined by the
+configuration bitstream that's loaded into them. You can think of the
+bitstream as object code. The bitstream is the output of compiling a
+high-level description of the design. In our case, the design is coded
+in the Verilog hardware description language. This is source code and,
+like the rest of the code in GNU Radio, is licensed under the GNU
+General Public License.</para>
+
+</sect1>
+
+<sect1 id="fpga"><title>What Goes in the FPGA?</title>
+
+<para>An FPGA is like a small, massively parallel computer that you design
+to do exactly what you want. Programming the FPGA takes a bit of
+skill, and mistakes can fry the board permanently. That said, we
+provide a standard configuration that is useful for a wide variety of
+applications.</para>
+
+<para>Using a good USB host controller, the USRP can sustain 32 MB/sec across
+the USB. The USB is half-duplex. Based on your needs, you partition
+the 32 MB/sec between the transmit and the receive directions. In the
+receive direction, the standard configuration allows you to select the
+part or parts of the digitized spectrum you're interested in,
+translate them to baseband and decimate as required. This is exactly
+equivalent to what's happening in the RF front end, only now we're
+doing it on digitized samples. The block of code that performs this
+function is called a digital down converter (<xref linkend="ddc-fig"/>).
+One advantage of performing this function in the digital domain is we can change the
+center frequency instantaneously, which is handy for frequency hopping
+spread spectrum systems.</para>
+
+<figure id="ddc-fig"><title>Digital Down Converter Block Diagram</title>
+<mediaobject>
+<imageobject><imagedata fileref="ddc.eps" format="EPS"/></imageobject>
+<imageobject><imagedata fileref="ddc.png" format="PNG"/></imageobject>
+<caption><para></para></caption>
+</mediaobject>
+</figure>
+
+
+<para>In the transmit direction, the exact inverse is performed. The FPGA
+contains multiple instances of the digital up and down
+converters. These instances can be connected to the same or different
+ADCs, depending on your needs. We don't have room here to cover all
+the theory behind them; see the GNU Radio Wiki for more information.</para>
+
+</sect1>
+
+<sect1 id="apps"><title>GNU Radio Applications</title>
+
+<para>In addition to the examples discussed above, GNU Radio comes with a
+complete HDTV transmitter and receiver, a spectrum analyzer, an
+oscilloscope, concurrent multichannel receiver and an ever-growing
+collection of modulators and demodulators.</para>
+
+<para>Projects under investigation or in progress include:</para>
+
+<itemizedlist>
+<listitem><para>A TiVo equivalent for radio, capable of recording multiple stations simultaneously.</para></listitem>
+<listitem><para>Time Division Multiple Access (TDMA) waveforms.</para></listitem>
+<listitem><para>A passive radar system that takes advantage of
+broadcast TV for its signal source. For those of you with old TVs
+hooked to antennas, think about the flutter you see when airplanes fly
+over.</para></listitem>
+<listitem><para>Radio astronomy.</para></listitem>
+<listitem><para>TETRA transceiver.</para></listitem>
+<listitem><para>Digital Radio Mundial (DRM).</para></listitem>
+<listitem><para>Software GPS.</para></listitem>
+<listitem><para>Distributed sensor networks.</para></listitem>
+<listitem><para>Distributed measurement of spectrum utilization.</para></listitem>
+<listitem><para>Amateur radio transceivers.</para></listitem>
+<listitem><para>Ad hoc mesh networks.</para></listitem>
+<listitem><para>RFID detector/reader.</para></listitem>
+<listitem><para>Multiple input multiple output (MIMO) processing. </para></listitem>
+</itemizedlist>
+
+</sect1>
+
+<sect1 id="politics"><title>Politics</title>
+
+<para>Every revolution has its political issues. Free software for building
+radios is troublesome to some people. In the US, we've run into
+opposition from the Motion Picture Association of America and its
+attempt with the Broadcast Flag to restrict the kinds of receivers
+that can be built for over-the-air digital TV.</para>
+
+<para>The US Federal Communications Commission has issued a Notice of
+Proposed Rule Making (NPRM) concerning Cognitive Radio
+Technologies and Software Defined Radios. Several troublesome
+issues are raised in the NPRM, including restricting the sale of
+high-speed digital-to-analog converters, requirements for digital
+signatures or similar methods to keep unauthorized software out of
+software radio hardware and new restrictions on radios built for the
+amateur radio market.</para>
+
+</sect1>
+
+<sect1 id="summary"><title>Summary</title>
+
+<para>Software radio is an exciting field, and GNU Radio provides the tools
+to start exploring. A deep understanding of software radio requires
+knowledge from many domains. We're doing our best to lower the
+barriers to entry.</para>
+</sect1>
+
+<!-- FIXME
+<sect1 id="resource"><title>Resources</title>
+<para></para>
+</sect1>
+-->
+
+</article>
diff --git a/docs/exploring-gnuradio/fm_demod.py b/docs/exploring-gnuradio/fm_demod.py
new file mode 100755
index 000000000..0071fd751
--- /dev/null
+++ b/docs/exploring-gnuradio/fm_demod.py
@@ -0,0 +1,150 @@
+#!/usr/bin/env python
+
+from gnuradio import gr
+from gnuradio import audio
+from gnuradio import mc4020
+import sys
+
+def high_speed_adc (fg, input_rate):
+ # return gr.file_source (gr.sizeof_short, "dummy.dat", False)
+ return mc4020.source (input_rate, mc4020.MCC_CH3_EN | mc4020.MCC_ALL_1V)
+
+#
+# return a gr.flow_graph
+#
+def build_graph (freq1, freq2):
+ input_rate = 20e6
+ cfir_decimation = 125
+ audio_decimation = 5
+
+ quad_rate = input_rate / cfir_decimation
+ audio_rate = quad_rate / audio_decimation
+
+ fg = gr.flow_graph ()
+
+ # use high speed ADC as input source
+ src = high_speed_adc (fg, input_rate)
+
+ # compute FIR filter taps for channel selection
+ channel_coeffs = \
+ gr.firdes.low_pass (1.0, # gain
+ input_rate, # sampling rate
+ 250e3, # low pass cutoff freq
+ 8*100e3, # width of trans. band
+ gr.firdes.WIN_HAMMING)
+
+ # input: short; output: complex
+ chan_filter1 = \
+ gr.freq_xlating_fir_filter_scf (cfir_decimation,
+ channel_coeffs,
+ freq1, # 1st station freq
+ input_rate)
+
+ (head1, tail1) = build_pipeline (fg, quad_rate, audio_decimation)
+
+ # sound card as final sink
+ audio_sink = audio.sink (int (audio_rate))
+
+ # now wire it all together
+ fg.connect (src, chan_filter1)
+ fg.connect (chan_filter1, head1)
+ fg.connect (tail1, (audio_sink, 0))
+
+ # two stations at once?
+ if freq2:
+ # Extract the second station and connect
+ # it to a second pipeline...
+
+ # input: short; output: complex
+ chan_filter2 = \
+ gr.freq_xlating_fir_filter_scf (cfir_decimation,
+ channel_coeffs,
+ freq2, # 2nd station freq
+ input_rate)
+
+ (head2, tail2) = build_pipeline (fg, quad_rate, audio_decimation)
+
+ fg.connect (src, chan_filter2)
+ fg.connect (chan_filter2, head2)
+ fg.connect (tail2, (audio_sink, 1))
+
+ return fg
+
+def build_pipeline (fg, quad_rate, audio_decimation):
+ '''Given a flow_graph, fg, construct a pipeline
+ for demodulating a broadcast FM signal. The
+ input is the downconverteed complex baseband
+ signal. The output is the demodulated audio.
+
+ build_pipeline returns a two element tuple
+ containing the input and output endpoints.
+ '''
+ fm_demod_gain = 2200.0/32768.0
+ audio_rate = quad_rate / audio_decimation
+ volume = 1.0
+
+ # input: complex; output: float
+ fm_demod = gr.quadrature_demod_cf (volume*fm_demod_gain)
+
+ # compute FIR filter taps for audio filter
+ width_of_transition_band = audio_rate / 32
+ audio_coeffs = gr.firdes.low_pass (1.0, # gain
+ quad_rate, # sampling rate
+ audio_rate/2 - width_of_transition_band,
+ width_of_transition_band,
+ gr.firdes.WIN_HAMMING)
+
+ # input: float; output: float
+ audio_filter = gr.fir_filter_fff (audio_decimation, audio_coeffs)
+
+ fg.connect (fm_demod, audio_filter)
+ return ((fm_demod, 0), (audio_filter, 0))
+
+
+def main (args):
+ nargs = len (args)
+ if nargs == 1:
+ freq1 = float (args[0]) * 1e6
+ freq2 = None
+ elif nargs == 2:
+ freq1 = float (args[0]) * 1e6
+ freq2 = float (args[1]) * 1e6
+ else:
+ sys.stderr.write ('usage: fm_demod freq1 [freq2]\n')
+ sys.exit (1)
+
+ # connect to RF front end
+ rf_front_end = gr.microtune_4937_eval_board ()
+ if not rf_front_end.board_present_p ():
+ raise IOError, 'RF front end not found'
+
+ # set front end gain
+ rf_front_end.set_AGC (300)
+ IF_freq = rf_front_end.get_output_freq ()
+ IF_freq = 5.75e6
+
+ if not freq2: # one station
+
+ rf_front_end.set_RF_freq (freq1)
+ fg = build_graph (IF_freq, None)
+
+ else: # two stations
+
+ if abs (freq1 - freq2) > 5.5e6:
+ raise IOError, 'freqs too far apart'
+
+ target_freq = (freq1 + freq2) / 2
+ actual_freq = rf_front_end.set_RF_freq (target_freq)
+ #actual_freq = target_freq
+
+ fg = build_graph (IF_freq + freq1 - actual_freq,
+ IF_freq + freq2 - actual_freq)
+
+ fg.start () # fork thread(s) and return
+ raw_input ('Press Enter to quit: ')
+ fg.stop ()
+
+if __name__ == '__main__':
+ main (sys.argv[1:])
+
+
diff --git a/docs/exploring-gnuradio/fm_demod_example.xml b/docs/exploring-gnuradio/fm_demod_example.xml
new file mode 100644
index 000000000..b417da0a8
--- /dev/null
+++ b/docs/exploring-gnuradio/fm_demod_example.xml
@@ -0,0 +1,123 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<example id="fm_demod_ex"><title>Broadcast FM Receiver</title>
+<programlisting>
+#!/usr/bin/env python
+
+from gnuradio import gr
+from gnuradio import audio
+from gnuradio import mc4020
+import sys
+
+def high_speed_adc (fg, input_rate):
+ # return gr.file_source (gr.sizeof_short, "dummy.dat", False)
+ return mc4020.source (input_rate, mc4020.MCC_CH3_EN | mc4020.MCC_ALL_1V)
+
+#
+# return a gr.flow_graph
+#
+def build_graph (freq1, freq2):
+ input_rate = 20e6
+ cfir_decimation = 125
+ audio_decimation = 5
+
+ quad_rate = input_rate / cfir_decimation
+ audio_rate = quad_rate / audio_decimation
+
+ fg = gr.flow_graph ()
+
+ # use high speed ADC as input source
+ src = high_speed_adc (fg, input_rate)
+
+ # compute FIR filter taps for channel selection
+ channel_coeffs = \
+ gr.firdes.low_pass (1.0, # gain
+ input_rate, # sampling rate
+ 250e3, # low pass cutoff freq
+ 8*100e3, # width of trans. band
+ gr.firdes.WIN_HAMMING)
+
+ # input: short; output: complex
+ chan_filter1 = \
+ gr.freq_xlating_fir_filter_scf (cfir_decimation,
+ channel_coeffs,
+ freq1, # 1st station freq
+ input_rate)
+
+ (head1, tail1) = build_pipeline (fg, quad_rate, audio_decimation)
+
+ # sound card as final sink
+ audio_sink = audio.sink (int (audio_rate))
+
+ # now wire it all together
+ fg.connect (src, chan_filter1)
+ fg.connect (chan_filter1, head1)
+ fg.connect (tail1, (audio_sink, 0))
+
+ return fg
+
+def build_pipeline (fg, quad_rate, audio_decimation):
+ '''Given a flow_graph, fg, construct a pipeline
+ for demodulating a broadcast FM signal. The
+ input is the downconverted complex baseband
+ signal. The output is the demodulated audio.
+
+ build_pipeline returns a two element tuple
+ containing the input and output endpoints.
+ '''
+ fm_demod_gain = 2200.0/32768.0
+ audio_rate = quad_rate / audio_decimation
+ volume = 1.0
+
+ # input: complex; output: float
+ fm_demod = gr.quadrature_demod_cf (volume*fm_demod_gain)
+
+ # compute FIR filter taps for audio filter
+ width_of_transition_band = audio_rate / 32
+ audio_coeffs = gr.firdes.low_pass (1.0, # gain
+ quad_rate, # sampling rate
+ audio_rate/2 - width_of_transition_band,
+ width_of_transition_band,
+ gr.firdes.WIN_HAMMING)
+
+ # input: float; output: float
+ audio_filter = gr.fir_filter_fff (audio_decimation, audio_coeffs)
+
+ fg.connect (fm_demod, audio_filter)
+ return ((fm_demod, 0), (audio_filter, 0))
+
+
+def main (args):
+ nargs = len (args)
+ if nargs == 1:
+ # get station frequency from command line
+ freq1 = float (args[0]) * 1e6
+ else:
+ sys.stderr.write ('usage: fm_demod freq\n')
+ sys.exit (1)
+
+ # connect to RF front end
+ rf_front_end = gr.microtune_4937_eval_board ()
+ if not rf_front_end.board_present_p ():
+ raise IOError, 'RF front end not found'
+
+ # set front end gain
+ rf_front_end.set_AGC (300)
+
+ # determine the front end's "Intermediate Frequency"
+ IF_freq = rf_front_end.get_output_freq () # 5.75e6
+
+ # Tell the front end to tune to freq1.
+ # I.e., freq1 is translated down to the IF frequency
+ rf_front_end.set_RF_freq (freq1)
+
+ # build the flow graph
+ fg = build_graph (IF_freq, None)
+
+ fg.start () # fork thread(s) and return
+ raw_input ('Press Enter to quit: ')
+ fg.stop ()
+
+if __name__ == '__main__':
+ main (sys.argv[1:])
+</programlisting>
+</example>
diff --git a/docs/exploring-gnuradio/swr-block-diagram.eps b/docs/exploring-gnuradio/swr-block-diagram.eps
new file mode 100644
index 000000000..dd029f357
--- /dev/null
+++ b/docs/exploring-gnuradio/swr-block-diagram.eps
@@ -0,0 +1,2399 @@
+%!PS-Adobe-3.0 EPSF-3.0
+%%BoundingBox: 0 0 755 575
+%%Pages: 0
+%%Creator: Sun Microsystems, Inc.
+%%Title: none
+%%CreationDate: none
+%%LanguageLevel: 2
+%%EndComments
+%%BeginPreview: 760 575 1 1725
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000800000000800000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000400000000800000000800000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000800000001000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000800000002000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000800000002000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000080000000800000004000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000080000000800000004000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000040000000800000008000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000800000010000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000020000000800000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000010000000800000020000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000008000000800000040000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000800000080000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000800000080000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000002000000800000100000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000002000000800000100000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000001000000800000200000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000800000400000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000800000800000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000007FFFFFFFFFFFFFFFFFFFFF
+%FFFF000000000000000000000000000000
+%000000000000400000800000800000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000030000000000000000000000
+%0000E00000000000000000000000000000
+%000000000000200000800001000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000080000000000000000000000
+%0000080000000000000000000000000000
+%000000000000000000800002000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000040000000000000000000000000000
+%000000000000100000800002000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000020000000000000000000000000000
+%000000000000080000800004000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000080000800004000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000040000800000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000001000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000800010000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000002000000000000000000000000
+%0000004000000000000000000000000000
+%000000000000020000800000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000004000000000000000000000000
+%0000002000000000000000000000000000
+%000000000000010000800020000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000004000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000008000800040000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000004000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000800080000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000004000800000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000002000800100000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000002000800000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000800000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000800400000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000800000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000400800800000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000200801000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000802000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000100800000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000080804000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000080800000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000800000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000810000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000800000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000010820000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000008840000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000880000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000004800000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000002900000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000002800000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000C00000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000C00000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%0000000000000000008000000000000000007FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC00000
+%0000000000000000FFFFFFFFFFFFFFFFFF80000000000000000000000000000380180000000000
+%0000001000000000000000000000000000
+%000000000000000000800000000000000000400000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000180380000000000
+%0000001000000000000000000000000000
+%000000000000000000800000000000000000400000000000000000000000000000000000000000
+%0000000000000002000000000000000000000000000000000000000000000001C0700000000000
+%0000001000000000000000000000000000
+%000000000000000000800000000000000000400000000000000000000000000000000000000000
+%0000000000000004000000000000000000000000000000000000000000000000C0E00000000000
+%0000001000000000000000000000000000
+%000000000000000000800000000000000000400000000000000000000000000000000000000000
+%0000000000000000000000000000000000000000000000000000000000000000E1C07008184600
+%0000001000000000000000000000000000
+%000000000000000000800000000000000000400000000000000000000000000000000000000000
+%000000000000001000000000000000000000000000000000000000000000000061C1FC1818FE00
+%0000001000000000000000000000000000
+%000000000000000000800000000000000000400000000000000000000000000000000000000000
+%000000000000002000000000000000000000000000000000000000000000000073838E1818FC00
+%0000001000000000000000000000000000
+%000000000000000000800000000000000000400000000000000000000000000000000000000000
+%00000000000000000000000000000000000000000000000000000000000000003707061838E000
+%0000001000000000000000000000000000
+%000000000000000000800000000000000000400000000000000000000000000000000000000000
+%00000000000000800000000000000000000000000000000000000000000000003E0E073030E000
+%0000001000000000000000000000000000
+%000000000000000000800000000000000000400000000000000000000000000000000000000000
+%00000000000001000000000000000000000000000000000000000000000000001C0C033030C000
+%0000001000000000000000000000000000
+%000000000000000000800000000000000000400000000000000000000000000000000000000000
+%00000000000000000000000000000000000000000000000000000000000000001C0C073030C000
+%0000001000000000000000000000000000
+%000000000000000000800000000000000000400000000000000000000000000000000000000000
+%0000000000000400000000000000000000000000000000000000000000000000180C0630318000
+%0000001000000000000000000000000000
+%000000000000000000800000000000000000400000000000000000000000000000000000000000
+%0000000000000800000000000000000000000000000000000000000000000000180C0670718000
+%0000001000000000000000000000000000
+%000000000000000000800000000000000000400FFC00000000000C000000001FF00FFE00000000
+%0000000000000000000000000000000000000000000000000000000000000000180C0E70618000
+%0000001000000000000000000000000000
+%000000000000000000800000000000000000400FFF00000000000C000000003FFC0FFE00000000
+%0000000000002000000000000000000000000000000000000000000000000000180E1C70E18000
+%0000001000000000000000000000000000
+%000000000000000000800000000000000000400E0780000000000C00000000381E0FFE00000000
+%00000000000040000000000000000000000000000000000000000000000000003807783F630000
+%0000001000000000000000000000000000
+%000000000000000000800000000000000000400C01C000000000000000000038070C0000000000
+%00000000000000000000000000000000000000000000000000000000000000003003F01E630000
+%0000001000000000000000000000000000
+%000000000000000000800000000000000000400C01C000000000000000000038030C0000000000
+%000000000001000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000800000000000000000400C01C1F007C07C0CE060F80038030C0000000000
+%000000000002000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000800000000000000000400C01C3FC1FE1FE0C6063FC0038070C0000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000800000000000000000400C03860E3873830C60C70600380E0C0000000000
+%000000000008000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000800000000000000000400FFF06063033018C60C607003FFC0FFC00000000
+%000000000010000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000800000000000000000400FFC0C063003018C30C603003FF00FFC00000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000800000000000000000400C1C0FFE3003FF8C3187FF0038300C0000000000
+%000000000040000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000800000000000000000400C0E0FFE3003FF8C1987FF0038180C0000000000
+%000000000080000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000800000000000000000400C070C003003000C19860000381C0C0000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000800000000000000000400C038C063033018C1B060200380E0C0000000000
+%000000000200000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000800000000000000000400C0386063833838C0F07070038060C0000000000
+%0000000004000001C03FF000FE00000000000000000000000000000000000001F8000000300000
+%0000001000000000000000000000000000
+%000000000000000000800000000000000000400C01C71E1C61C70C0E038E0038070C0000000000
+%0000000000000001C03FFC03FF00000000000000000000000000000000000007FE000000300000
+%0000001000000000000000000000000000
+%000000000000000000800000000000000000400C00E3FC0FE0FE0C0E01FC0038038C0000000000
+%0000000010000003E0301E07838000000000000000000000000000000000000E0E000000300000
+%0000001000000000000000000000000000
+%000000000000000000800000000000000000400C00E0E00380380C0400700010018C0000000000
+%00000000200000036030060601C000000000000000000000000000000000001C07000000700000
+%0000001000000000000000000000000000
+%000000000000000000800000000000000000400000000000000000000000000000000000000000
+%00000000000000077030070E00C00000000000000000000000000000000000380301C00C603800
+%0000001000000000000000000000000000
+%000000000000000000800000000000000C00400000000000000000000000000000000000000000
+%0001C000800000063030030C00000000000000000000000000C00000000000300007F03F60FE00
+%0000001000000000000000000000000000
+%000000000000000000800000000000000F80400000000000000000000000000000000000000000
+%0001F001000000063830031C00000000000000000000000000F8000000000070000C3871E1C700
+%0000001000000000000000000000000000
+%000000000000000000800000000000000FF8400000000000000000000000000000000000000000
+%0001FF000000000E1830031C00000000000000000000000000FF800000000060001818E0E30300
+%0000001000000000000000000000000000
+%000000000000000000800000000000000FFE400000000000000000000000000000000000000000
+%0001FFE40000000C1830031C00000000000000000000000000FFE00000000060003018C0C70300
+%0000001000000000000000000000000000
+%0000000000000000007FFFFFFFFFFFFFFFFFC000000000000000000000000000000000003FFFFF
+%FFFFFFF80000000C1C30031C00000000007FFFFFFFFFFFFFFFFFF80000000060003019C0C70300
+%0000001000000000000000000000000000
+%000000000000000000000000000000000FF8400000000000000000000000000000000000000000
+%0001FF000000001FFC30030C00000000000000000000000000FF80000000006000301980C7FF00
+%0000001000000000000000000000000000
+%000000000000000000000000000000000FE0400000000000000000000000000000000000000000
+%0001FC020000001FFC30030C00C00000000000000000000000FE00000000006006701980C60000
+%0000001000000000000000000000000000
+%000000000000000000000000000000000F00400000000000000000000000000000000000000000
+%0001F001000000380E30070E00C00000000000000000000000F00000000000700E701981C60000
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000400003FF80000000000003FFC00000080000000000
+%00000000000000300630060601C00000000000000000000000000000000000300C303181860600
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000400003FFC0000000006003FFE000000C0000000000
+%000000004000003007301E0783800000000000000000000000000000000000381C3071C3870E00
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000400003800000000000E003800000000C0000000000
+%0000000020000070033FFC03FF0000000000000000000000000000000000001FF81FE0FF83FC00
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000400003000000000000E003000000000C0000000000
+%000000000000006003BFF000FC00000000000000000000000000000000000007E00F807981F000
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000400003000000000000E003000000000C0000000000
+%000000000800000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000400003000DE1F833E1F80300037C03CC0000000000
+%000000000400000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000400003000FE7FC3FF0E0030003FF0FFC0000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000400003000E060E3830E0030003871C3C0000000000
+%000000000100000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000400003FF0E0E063838E003FFC303181C0000000000
+%000000000080000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000400003FF0E0C073038E003FFC303180C0000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000400003000C0C033038E003000303180C0000000000
+%000000000020000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000400003000C0C033038E003000303180C0000000000
+%000000000010000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000400003000C0C033038E003000303180C0000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000400003000C0C063038E003000303181C0000000000
+%000000000004000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000400003000C06063038E0030003031C1C0000000000
+%0000000000020000000000000000000000000000000000000000000000000038030000000001C0
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000400003000C071C30387003FFE3030E7C0000000000
+%0000000000000000000000000000000000000000000000000000000000000038070000000001C0
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000400003000C03F830387803FFE30307EC0000000000
+%000000000000800000000000000000000000000000000000000000000000003006000000000180
+%0000001000000000000000000000000000
+%0000000000000000000000000000000000004000030004006030103803FFE30301880000000000
+%000000000000400000000000000000000000000000000000000000000000003006000000000180
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000400000000000000000000000000000000000000000
+%0000000000000000000000000000000000000000000000000000000000000030060380CC0E0380
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000400000000000000000000000000000000000000000
+%0000000000001000000000000000000000000000000000000000000000000070060FE0DE3F8380
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000400000000000000000000000000000000000000000
+%00000000000008000000000000000000000000000000000000000000000000700E1C70F061C300
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000400000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000007FFC3030E0C0C300
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000400000000000000000000000000000000000000000
+%000000000000020000000000000000000000000000000000000000000000007FFC7039C1C0C300
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000400000000000000000000000000000000000000000
+%00000000000001000000000000000000000000000000000000000000000000E00C7FF981FFC200
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000400000000000000000000000000000000000000000
+%00000000000000000000000000000000000000000000000000000000000000C01C7FF181FFC200
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000400000000000000000000000000000000000000000
+%00000000000000400000000000000000000000000000000000000000000000C01C600181800200
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000400000000000000000000000000000000000000000
+%00000000000000000000000000000000000000000000000000000000000000C018600381800000
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000400000000000000000000000000000000000000000
+%00000000000000000000000000000000000000000000000000000000000000C018606301818000
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000400000000000000000000000000000000000000000
+%00000000000000000000000000000000000000000000000000000000000001C01870E301C38000
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000400000000000000000000000000000000000000000
+%00000000000000000000000000000000000000000000000000000000000001C0183FC300FF0E00
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000400000000000000000000000000000000000000000
+%0000000000000000000000000000000000000000000000000000000000000180380F03007C0C00
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000400000000000000000000000000000000000400000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%0000000000000000000000000000000000007FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC00000
+%00000000000000007FFFFFFFFFFFFFFFFF80000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000004000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000004000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000004000000000000000000000000
+%0000002000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000002000000000000000000000000
+%0000004000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000001000000000000000000000000
+%0000004000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000001000000000000000000000000
+%0000008000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000800000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000400000000000000000000000
+%0000010000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000300000000000000000000000
+%0000060000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000080000000000000000000000
+%0000180000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000020000000000000000000000
+%0000200000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%00000000000000000000000000000000000000000000000000000001C000000000000000000000
+%0001800000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%00000000000000000000000000000000000000000000000000000000000000000000007FF00000
+%0000006000000001FF800000300000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%00000000000000000000000000000000000000000000000000000000000000000000007FFC0000
+%0000006000000001FFC0000C300000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%0000000000000000000000000000000000000000000000000000000000000000000000700C0000
+%000000000000000180E0000C300000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%0000000000000000000000000000000000000000000000000000000000000000000000700E0000
+%00000000000000018060000C300000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000070060300
+%1C01C062010380018070381F318000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%0000000000000000000000000000000000000000000000000000000000000000000000700E1FC0
+%7F07F063030FE0018070FE1F3FE000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%0000000000000000000000000000000000000000000000000000000000000000000000700E38E0
+%E38E3863031C70018061C70C3E7000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%00000000000000000000000000000000000000000000000000000000000000000000007FFC3031
+%C19C1C630638300180E3830C383000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%00000000000000000000000000000000000000000000000000000000000000000000007FF06031
+%80180C6186301801FFC0030C303800000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000071E07FF1
+%801FFC61863FF801FF80070C303800000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000070707FF9
+%801FFC618C3FF8018000FF0C303800000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000070386001
+%80180060CC3000018001E30C303800000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000070386001
+%80180060CC3000018003830C303800000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%0000000000000000000000000000000000000000000000000000000000000000000000701C3031
+%819C0C60783018018003030C303800000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%0000000000000000000000000000000000000000000000000000000000000000000000700E3871
+%C18C1C60783830018003070C303800000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%0000000000000000000000000000000000000000000000000000000000000000000000700E1FE0
+%FF0FF860701FF0018003DF0F303800000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000070070FC0
+%3E03E0603007C0018001F987B03800000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000400000000800000000800000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000400000000800000000800000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000200000000800000001000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000800000002000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000100000000800000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000080000000800000004000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000800000008000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000800000010000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000800000010000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000010000000800000020000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000010000000800000020000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000008000000800000040000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000800000080000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000004000000800000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000002000000800000100000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000800000200000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000800000400000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000800000400000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000400000800000800000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000038000000000000000000000
+%0000E00000000000000000000000000000
+%000000000000400000800000800000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000000000000000000000000C0000000000000000000000
+%0000180000000000000000000000000000
+%000000000000200000800001000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000100000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000800002000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000400000000000000000000000
+%0000000000000000000000000000000000
+%000000000000100000800000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000800000000000000000000000
+%0000000000000000000000000000000000
+%000000000000080000800004000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000800008000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000001000000000000000000000000
+%0000004000000000000000000000000000
+%000000000000000000800010000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000002000000000000000000000000
+%0000004000000000000000000000000000
+%000000000000000000800010000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000004000000000000000000000000
+%0000002000000000000000000000000000
+%000000000000010000800020000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000004000000000000000000000000
+%0000002000000000000000000000000000
+%000000000000010000800020000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000004000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000008000800040000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000004000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000800080000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000004000800000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000002000800100000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000001000800200000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000800400000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000800400000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000400800800000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000400800800000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000200801000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000802000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000100800000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000080804000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000040808000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000810000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000810000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000010820000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000010800000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000008840000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000880000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000004900000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000002800000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000001A00000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000C00000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000C00000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000800000000000000000400000000000000000000000000000000000400000
+%000000000000000000000000000000000080000000000000000000000000000380380000000000
+%0000001000000000000000000000000000
+%000000000000000000800000000000000000400000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000180700000000000
+%0000001000000000000000000000000000
+%000000000000000000800000000000000000400000000000000000000000000000000000000000
+%0000000000000000000000000000000000000000000000000000000000000000C0700000000000
+%0000001000000000000000000000000000
+%000000000000000000800000000000000000400000000000000000000000000000000000000000
+%0000000000000000000000000000000000000000000000000000000000000000C0E00000000000
+%0000001000000000000000000000000000
+%000000000000000000800000000000000000400000000000000000000000000000000000000000
+%0000000000000000000000000000000000000000000000000000000000000000E1C0F818186E00
+%0000001000000000000000000000000000
+%000000000000000000800000000000000000400000000000000000000000000000000000000000
+%00000000000000000000000000000000000000000000000000000000000000006383FC1818FE00
+%0000001000000000000000000000000000
+%000000000000000000800000000000000000400000000000000000000000000000000000000000
+%00000000000000000000000000000000000000000000000000000000000000007307061818F000
+%0000001000000000000000000000000000
+%000000000000000000800000000000000000400000000000000000000000000000000000000000
+%00000000000000000000000000000000000000000000000000000000000000003706061838E000
+%0000001000000000000000000000000000
+%000000000000000000800000000000000000400000000000000000000000000000000000000000
+%00000000000000000000000000000000000000000000000000000000000000001E0E073030C000
+%0000001000000000000000000000000000
+%000000000000000000800000000000000000400000000000000000000000000000000000000000
+%00000000000000000000000000000000000000000000000000000000000000001C0C033030C000
+%0000001000000000000000000000000000
+%000000000000000000800000000000000000400000000000000000000000000000000000000000
+%00000000000000000000000000000000000000000000000000000000000000001C0C073030C000
+%0000001000000000000000000000000000
+%000000000000000000800000000000000000400000000000000000000000000000000000000000
+%0000000000000000000000000000000000000000000000000000000000000000180C0630718000
+%0000001000000000000000000000000000
+%000000000000000000800000000000000000400000000000000000000000000000000000000000
+%0000000000000000000000000000000000000000000000000000000000000000180C0670718000
+%0000001000000000000000000000000000
+%0000000000000000008000000000000000004000000180380000180001FFC0FFF0000000000000
+%0000000000000000000000000000000000000000000000000000000000000000180C0C70E18000
+%0000001000000000000000000000000000
+%00000000000000000080000000000000000040000001C0700000186001FFE0FFF0000000000000
+%0000000000000000000000000000000000000000000000000000000000000000380E1C71E18000
+%0000001000000000000000000000000000
+%00000000000000000080000000000000000040000000E06000000060018070C000000000000000
+%00000000000080000000000000000000000000000000000000000000000000003007F83F630000
+%0000001000000000000000000000000000
+%0000000000000000008000000000000000004000000070C000000060018030C000000000000000
+%00000000000000000000000000000000000000000000000000000000000000003001E01C630000
+%0000001000000000000000000000000000
+%0000000000000000008000000000000000004000000031C000000070018030C000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000800000000000000000400000003B81BE7E18FC018030C000000000000000
+%000000000004000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000800000000000000000400000001F01E7EF1860018070C000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000800000000000000000400000000E01C383186001C3E0E000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000800000000000000000400000000E018383186001FFC0FFE0000000000000
+%000000000020000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000800000000000000000400000001F018383186001FF00FFC0000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000800000000000000000400000001B8183831860018380C000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000800000000000000000400000003181838318600181C0C000000000000000
+%000000000100000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%0000000000000000008000000000000000004000000071C1838318600180E0C000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%00000000000000000080000000000000000040000000E0E183831860018070C000000000000000
+%000000000400001F80006000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%00000000000000000080000000000000000040000000C07183831860018070C000000000000000
+%000000000800003FF800F001FE00000000000000000000000000000000000003FC000000300000
+%0000001000000000000000000000000000
+%00000000000000000080000000000000000040000001C07183831878018038C000000000000000
+%000000000000003FFC00F003FF8000000000000000000000000000000000000F9E000000300000
+%0000001000000000000000000000000000
+%0000000000000000008000000000000000004000000380398383183C018018C000000000000000
+%00000000200000300E01F007018000000000000000000000000000000000001C07000000300000
+%0000001000000000000000000000000000
+%000000000000000000800000000000000000400000000000000000000000000000000000000000
+%00000000400000300701B80E01C000000000000000000000000000000000001803000000600000
+%0000001000000000000000000000000000
+%000000000000000000800000000000000000400000000000000000000000000000000000000000
+%00000000000000300301980C00C00000000000000000000000000000000000380303E01E607C00
+%0000001000000000000000000000000000
+%000000000000000000800800000000000000400000000000000000000000000000000000000400
+%00000001000000300303980C0000000000000080000000000000000000000030000FF03F61FE00
+%0000001000000000000000000000000000
+%000000000000000000803800000000000000400000000000000000000000000000000000001C00
+%000000020000003003030C1C0000000000000780000000000000000000000070001C3861E38300
+%0000001000000000000000000000000000
+%00000000000000000081F80000000000000040000000000000000000000000000000000000FC00
+%000000000000003003830C1C0000000000001F80000000000000000000000060003818C0E30300
+%0000001000000000000000000000000000
+%0000000000000000009FF8000000000000004000000000000000000000000000000000000FFC00
+%000000080000003003860E1C000000000001FF80000000000000000000000060003018C0C70300
+%0000001000000000000000000000000000
+%000000000000000000FFFFFFFFFFFFFFFFFFC000000000000000000000000000000000003FFFFF
+%FFFFFFFC0000003003070E1C00000000000FFFFFFFFFFFFFFFFFF8000000006000301980C7FF00
+%0000001000000000000000000000000000
+%0000000000000000001FF8000000000000004000000000000000000000000000000000000FFC00
+%0000000000000030030FFF0C000000000001FF8000000000000000000000006000301980C7FF00
+%0000001000000000000000000000000000
+%00000000000000000001F80000000000000040000000000000000000000000000000000000FC00
+%0000000100000030030E070C00C0000000001F8000000000000000000000006006701980C60000
+%0000001000000000000000000000000000
+%000000000000000000007800000000000000400000000000000000000000000000000000001C00
+%0000000080000030070C030E00C00000000007800000000000000000000000700E703981C60600
+%0000001000000000000000000000000000
+%000000000000000000000800000000000000400007FF80000000004007FFC00000180000000400
+%00000000000000300E1C038701C00000000000800000000000000000000000381C303181860600
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000400007FF8000000000C007FFC00000180000000000
+%00000000200000383C180183C78000000000000000000000000000000000003C3838E0C7871C00
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000400007000000000000C00700000000180000000000
+%000000001000003FF83801C1FF0000000000000000000000000000000000000FF01FC0FF83F800
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000400006000000000000C00700000000180000000000
+%000000000000003FE03000C07C00000000000000000000000000000000000003C007003980E000
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000400006000880C02303E00700043003180000000000
+%000000000400000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000400006000FC7F86FE3F0070006FC0FD80000000000
+%000000000200000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000400006000FCF3C7CE0C0070007CE1C780000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000400007FE0C0C0C7070C007FF870618380000000000
+%000000000080000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000400007FF0C1C0E7030C007FF860730180000000000
+%000000000040000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000400007FE0C18067030C007FF060730180000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000400006000C18067030C00700060730180000000000
+%000000000010000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000400006000C18067030C00700060730180000000000
+%000000000008000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000400006000C18067030C00700060730180000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000400006000C1C0E7030C00700060738380000000000
+%000000000002000000000000000000000000000000000000000000000000001003000000000080
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000400006000C0E1C7030C00700060718380000000000
+%0000000000010000000000000000000000000000000000000000000000000038030000000001C0
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000400006000C07F87030F007FFC6071FF80000000000
+%000000000000000000000000000000000000000000000000000000000000003007000000000180
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000400006000C03F070307007FFC60707D80000000000
+%000000000000400000000000000000000000000000000000000000000000003006000000000180
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000400000000000000000000000000000000000000000
+%000000000000200000000000000000000000000000000000000000000000003006000000000180
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000400000000000000000000000000000000000000000
+%00000000000000000000000000000000000000000000000000000000000000300607C0CE1F0380
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000400000000000000000000000000000000000000000
+%00000000000008000000000000000000000000000000000000000000000000700E1FE0FC7F8380
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000400000000000000000000000000000000000000000
+%000000000000040000000000000000000000000000000000000000000000007FFE3830E0E0C300
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000400000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000007FFC3031C0C0C300
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000400000000000000000000000000000000000000000
+%00000000000001000000000000000000000000000000000000000000000000601C7039C1C0C300
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000400000000000000000000000000000000000000000
+%00000000000000800000000000000000000000000000000000000000000000E00C7FF981FFC200
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000400000000000000000000000000000000000000000
+%00000000000000000000000000000000000000000000000000000000000000C01C7FF181FFC200
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000400000000000000000000000000000000000000000
+%00000000000000200000000000000000000000000000000000000000000000C01C600181800600
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000400000000000000000000000000000000000000000
+%00000000000000100000000000000000000000000000000000000000000000C018602381818000
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000400000000000000000000000000000000000000000
+%00000000000000000000000000000000000000000000000000000000000001C018606301818000
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000400000000000000000000000000000000000000000
+%00000000000000040000000000000000000000000000000000000000000001C01831C301C70400
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000400000000000000000000000000000000000000000
+%00000000000000020000000000000000000000000000000000000000000001C0383F8300FE0E00
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000400000000000000000000000000000000000000000
+%0000000000000000000000000000000000000000000000000000000000000180300E0300380C00
+%0000001000000000000000000000000000
+%0000000000000000000000000000000000007FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC00000
+%0000000000000000FFFFFFFFFFFFFFFFFF80000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000001000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000004000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000004000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000004000000000000000000000000
+%0000002000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000002000000000000000000000000
+%0000004000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000001000000000000000000000000
+%0000004000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000400000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000100000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000000000000000000000000C0000000000000000000000
+%0000180000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000020000000000000000000000
+%0000200000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000003FFFFFFFFFFFFFFFFFFFFF
+%FFFE000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%0000000000000000000000000000000000000000000000000000000000000000000007FFC00000
+%00000000000182003FF80000860000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%0000000000000000000000000000000000000000000000000000000000000000000007FFC00000
+%00000000000186003FFC0001860000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000018000000
+%0000000000000600301C0001860000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000018000000
+%0000000000000600300E0001860000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%00000000000000000000000000000000000000000000000000000000000000000000001806E1F8
+%33C07813C3C19F80300E0F83E67800000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%00000000000000000000000000000000000000000000000000000000000000000000001807E3FC
+%3FE1FE1FFFE18F80300E3FE3E7FE00000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%00000000000000000000000000000000000000000000000000000000000000000000001807060E
+%3871871C78618600300C3061878600000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%00000000000000000000000000000000000000000000000000000000000000000000001806060E
+%3033821838318600303C6061870700000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%00000000000000000000000000000000000000000000000000000000000000000000001806000E
+%30318018303186003FF80061860700000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%0000000000000000000000000000000000000000000000000000000000000000000000180600FE
+%3031F818303186003FE007E1860700000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%0000000000000000000000000000000000000000000000000000000000000000000000180603FE
+%30307E183031860030003FE1860700000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%00000000000000000000000000000000000000000000000000000000000000000000001806070E
+%30300F183031860030007861860700000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000018060E0E
+%303003183031860030006061860700000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000018060C0E
+%303383183031860030006061860700000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000018060E1E
+%3031871830318600300070E1C60700000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%0000000000000000000000000000000000000000000000000000000000000000000000180607FE
+%3031FE183031878030003FF1F60700000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%0000000000000000000000000000000000000000000000000000000000000000000000180603C6
+%303078183031838030001E30F60300000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%%EndPreview
+%%BeginProlog
+%%BeginResource: SDRes
+/b4_inc_state save def
+/dict_count countdictstack def
+/op_count count 1 sub def
+userdict begin
+0 setgray 0 setlinecap 1 setlinewidth 0 setlinejoin 10 setmiterlimit[] 0 setdash newpath
+/languagelevel where {pop languagelevel 1 ne {false setstrokeadjust false setoverprint} if} if
+/bdef {bind def} bind def
+/c {setgray} bdef
+/l {neg lineto} bdef
+/rl {neg rlineto} bdef
+/lc {setlinecap} bdef
+/lj {setlinejoin} bdef
+/lw {setlinewidth} bdef
+/ml {setmiterlimit} bdef
+/ld {setdash} bdef
+/m {neg moveto} bdef
+/ct {6 2 roll neg 6 2 roll neg 6 2 roll neg curveto} bdef
+/r {rotate} bdef
+/t {neg translate} bdef
+/s {scale} bdef
+/sw {show} bdef
+/gs {gsave} bdef
+/gr {grestore} bdef
+/f {findfont dup length dict begin
+{1 index /FID ne {def} {pop pop} ifelse} forall /Encoding ISOLatin1Encoding def
+currentdict end /NFont exch definefont pop /NFont findfont} bdef
+/p {closepath} bdef
+/sf {scalefont setfont} bdef
+/ef {eofill}bdef
+/pc {closepath stroke}bdef
+/ps {stroke}bdef
+/pum {matrix currentmatrix}bdef
+/pom {setmatrix}bdef
+/bs {/aString exch def /nXOfs exch def /nWidth exch def currentpoint nXOfs 0 rmoveto pum nWidth aString stringwidth pop div 1 scale aString show pom moveto} bdef
+%%EndResource
+%%EndProlog
+%%BeginSetup
+%%EndSetup
+%%Page: 1 1
+%%BeginPageSetup
+%%EndPageSetup
+pum
+0.02834 0.02833 s
+0 -20290 t
+/tm matrix currentmatrix def
+gs
+tm setmatrix
+-635 -635 t
+1 1 s
+635 635 m 27274 635 l 27274 20924 l 635 20924 l 635 635 l eoclip newpath
+0 lw 1 lj 0.000 c 1905 1905 m 3175 3810 l ps
+3175 3810 m 4445 1905 l ps
+3175 1905 m 3175 5080 l ps
+0.996 c 12565 5080 m 13835 3810 l 16375 3810 l 16375 6350 l 13835 6350 l
+12565 5080 l p ef
+0.000 c 12565 5080 m 13835 3810 l 16375 3810 l 16375 6350 l 13835 6350 l
+12565 5080 l pc
+gs
+pum
+13573 5371 t
+-1 0 m 231 -606 l 318 -606 l 566 0 l 474 0 l 404 -183 l 150 -183 l
+83 0 l p
+173 -248 m 379 -248 l 315 -416 l 296 -467 282 -509 272 -542 ct 265 -503 254 -465 240 -426 ct
+p ef
+621 0 m 621 -606 l 830 -606 l 877 -606 913 -603 938 -597 ct 972 -589 1002 -575 1027 -554 ct
+1059 -527 1082 -492 1098 -450 ct 1114 -408 1122 -360 1122 -306 ct 1122 -260 1117 -219 1106 -184 ct
+1095 -148 1081 -119 1065 -95 ct 1048 -72 1029 -54 1009 -40 ct 989 -27 965 -17 937 -10 ct
+909 -3 876 0 840 0 ct p
+701 -71 m 831 -71 l 871 -71 902 -75 925 -82 ct 947 -90 965 -100 979 -114 ct
+998 -133 1013 -158 1023 -190 ct 1034 -222 1039 -261 1039 -307 ct 1039 -371 1029 -419 1008 -453 ct
+987 -487 962 -510 932 -522 ct 911 -530 876 -534 828 -534 ct 701 -534 l p ef
+1661 -212 m 1742 -192 l 1725 -126 1695 -76 1651 -41 ct 1607 -6 1554 10 1491 10 ct
+1425 10 1372 -2 1331 -29 ct 1290 -56 1259 -94 1238 -145 ct 1216 -195 1206 -249 1206 -307 ct
+1206 -370 1218 -425 1242 -472 ct 1266 -519 1300 -555 1345 -580 ct 1389 -604 1438 -616 1492 -616 ct
+1553 -616 1604 -601 1645 -570 ct 1686 -539 1715 -496 1731 -440 ct 1652 -421 l
+1638 -465 1618 -497 1591 -517 ct 1564 -537 1531 -547 1490 -547 ct 1444 -547 1405 -536 1373 -514 ct
+1342 -492 1320 -462 1307 -424 ct 1295 -386 1288 -348 1288 -308 ct 1288 -256 1296 -211 1311 -173 ct
+1326 -134 1349 -105 1381 -86 ct 1413 -67 1447 -58 1484 -58 ct 1529 -58 1567 -71 1598 -97 ct
+1629 -123 l 1650 -161 l p ef
+pom
+gr
+8255 6350 m 5715 6350 l 5715 3810 l 10795 3810 l 10795 6350 l 8255 6350 l
+pc
+gs
+pum
+6033 4895 t
+66 0 m 66 -606 l 335 -606 l 389 -606 430 -600 458 -589 ct 486 -579 509 -559 526 -532 ct
+542 -504 551 -474 551 -440 ct 551 -397 537 -361 509 -332 ct 481 -302 438 -283 380 -275 ct
+401 -265 417 -255 428 -245 ct 452 -224 474 -197 495 -165 ct 600 0 l 500 0 l
+419 -126 l 396 -162 377 -190 361 -209 ct 346 -228 333 -242 321 -250 ct 309 -257 296 -263 284 -266 ct
+275 -268 260 -269 239 -269 ct 146 -269 l 146 0 l p
+146 -338 m 319 -338 l 355 -338 384 -342 405 -350 ct 425 -357 441 -369 452 -386 ct
+463 -403 468 -421 468 -440 ct 468 -469 458 -493 437 -511 ct 416 -530 383 -539 338 -539 ct
+146 -539 l p ef
+965 -141 m 1042 -131 l 1030 -86 1007 -52 975 -27 ct 942 -2 900 9 849 9 ct
+785 9 734 -9 696 -49 ct 658 -88 640 -144 640 -215 ct 640 -289 659 -347 697 -387 ct
+735 -428 784 -449 845 -449 ct 903 -449 951 -429 989 -389 ct 1026 -349 1044 -292 1044 -220 ct
+1044 -216 1044 -209 1044 -200 ct 716 -200 l 719 -152 733 -115 757 -89 ct 782 -64 813 -51 849 -51 ct
+877 -51 900 -58 919 -72 ct 938 -87 l 954 -110 l p
+721 -261 m 966 -261 l 963 -298 953 -326 938 -344 ct 914 -373 883 -387 845 -387 ct
+811 -387 783 -376 759 -353 ct 736 -330 l 723 -300 l p ef
+1427 -160 m 1500 -151 l 1492 -100 1472 -61 1439 -32 ct 1406 -4 1365 9 1317 9 ct
+1257 9 1209 -9 1172 -49 ct 1136 -88 1118 -144 1118 -217 ct 1118 -265 1125 -306 1141 -342 ct
+1157 -378 1181 -404 1213 -422 ct 1245 -440 1280 -449 1318 -449 ct 1365 -449 1404 -437 1435 -412 ct
+1465 -388 1485 -354 1493 -310 ct 1421 -299 l 1414 -328 1402 -350 1384 -365 ct
+1367 -380 1345 -387 1321 -387 ct 1283 -387 1253 -374 1229 -347 ct 1206 -320 1194 -278 1194 -220 ct
+1194 -161 1205 -118 1228 -91 ct 1251 -64 1280 -51 1317 -51 ct 1346 -51 1370 -60 1390 -78 ct
+1409 -96 l 1422 -123 l p ef
+1864 -141 m 1941 -131 l 1929 -86 1906 -52 1874 -27 ct 1841 -2 1799 9 1748 9 ct
+1684 9 1633 -9 1595 -49 ct 1557 -88 1539 -144 1539 -215 ct 1539 -289 1558 -347 1596 -387 ct
+1634 -428 1683 -449 1744 -449 ct 1802 -449 1850 -429 1888 -389 ct 1925 -349 1943 -292 1943 -220 ct
+1943 -216 1943 -209 1943 -200 ct 1615 -200 l 1618 -152 1632 -115 1656 -89 ct
+1681 -64 1712 -51 1748 -51 ct 1776 -51 1799 -58 1818 -72 ct 1837 -87 l 1853 -110 l
+p
+1620 -261 m 1865 -261 l 1862 -298 1852 -326 1837 -344 ct 1813 -373 1782 -387 1744 -387 ct
+1710 -387 1682 -376 1658 -353 ct 1635 -330 l 1622 -300 l p ef
+2040 -520 m 2040 -606 l 2114 -606 l 2114 -520 l p
+2040 0 m 2040 -439 l 2114 -439 l 2114 0 l p ef
+2347 0 m 2180 -439 l 2259 -439 l 2353 -176 l 2363 -147 2373 -118 2381 -87 ct
+2388 -110 2397 -138 2409 -171 ct 2507 -439 l 2583 -439 l 2417 0 l p ef
+2949 -141 m 3026 -131 l 3014 -86 2991 -52 2959 -27 ct 2926 -2 2884 9 2833 9 ct
+2769 9 2718 -9 2680 -49 ct 2642 -88 2624 -144 2624 -215 ct 2624 -289 2643 -347 2681 -387 ct
+2719 -428 2768 -449 2829 -449 ct 2887 -449 2935 -429 2973 -389 ct 3010 -349 3028 -292 3028 -220 ct
+3028 -216 3028 -209 3028 -200 ct 2700 -200 l 2703 -152 2717 -115 2741 -89 ct
+2766 -64 2797 -51 2833 -51 ct 2861 -51 2884 -58 2903 -72 ct 2922 -87 l 2938 -110 l
+p
+2705 -261 m 2950 -261 l 2947 -298 2937 -326 2922 -344 ct 2898 -373 2867 -387 2829 -387 ct
+2795 -387 2767 -376 2743 -353 ct 2720 -330 l 2707 -300 l p ef
+3373 0 m 3373 -606 l 3642 -606 l 3696 -606 3737 -600 3765 -589 ct 3793 -579 3816 -559 3833 -532 ct
+3849 -504 3858 -474 3858 -440 ct 3858 -397 3844 -361 3816 -332 ct 3788 -302 3745 -283 3687 -275 ct
+3708 -265 3724 -255 3735 -245 ct 3759 -224 3781 -197 3802 -165 ct 3907 0 l 3807 0 l
+3726 -126 l 3703 -162 3684 -190 3668 -209 ct 3653 -228 3640 -242 3628 -250 ct
+3616 -257 3603 -263 3591 -266 ct 3582 -268 3567 -269 3546 -269 ct 3453 -269 l
+3453 0 l p
+3453 -338 m 3626 -338 l 3662 -338 3691 -342 3712 -350 ct 3732 -357 3748 -369 3759 -386 ct
+3770 -403 3775 -421 3775 -440 ct 3775 -469 3765 -493 3744 -511 ct 3723 -530 3690 -539 3645 -539 ct
+3453 -539 l p ef
+3985 0 m 3985 -606 l 4394 -606 l 4394 -534 l 4065 -534 l 4065 -346 l
+4350 -346 l 4350 -275 l 4065 -275 l 4065 0 l p ef
+pom
+pum
+6364 5848 t
+69 0 m 69 -606 l 478 -606 l 478 -534 l 149 -534 l 149 -346 l 434 -346 l
+434 -275 l 149 -275 l 149 0 l p ef
+584 0 m 584 -439 l 651 -439 l 651 -372 l 668 -403 683 -424 698 -434 ct
+712 -444 728 -449 746 -449 ct 771 -449 796 -441 822 -425 ct 797 -356 l 778 -366 760 -372 742 -372 ct
+726 -372 711 -367 698 -357 ct 685 -347 676 -334 670 -316 ct 662 -290 658 -261 658 -229 ct
+658 0 l p ef
+848 -219 m 848 -300 870 -361 915 -400 ct 953 -432 999 -449 1054 -449 ct 1114 -449 1163 -429 1202 -389 ct
+1240 -350 1259 -295 1259 -225 ct 1259 -169 1251 -124 1234 -92 ct 1217 -60 1192 -34 1160 -16 ct
+1127 0 1092 9 1054 9 ct 992 9 942 -9 904 -49 ct 867 -88 l 848 -145 l p
+924 -219 m 924 -163 936 -121 961 -93 ct 985 -65 1016 -51 1054 -51 ct 1091 -51 1121 -65 1146 -93 ct
+1170 -121 1183 -164 1183 -222 ct 1183 -276 1170 -317 1146 -345 ct 1121 -373 1090 -387 1054 -387 ct
+1016 -387 985 -373 961 -345 ct 936 -317 l 924 -275 l p ef
+1351 0 m 1351 -439 l 1418 -439 l 1418 -376 l 1451 -425 1497 -449 1558 -449 ct
+1585 -449 1609 -444 1631 -434 ct 1653 -425 1670 -412 1681 -397 ct 1692 -382 1700 -363 1704 -342 ct
+1707 -328 1708 -304 1708 -270 ct 1708 0 l 1634 0 l 1634 -267 l 1634 -297 1631 -320 1625 -335 ct
+1619 -350 1609 -362 1594 -371 ct 1580 -380 1562 -384 1542 -384 ct 1511 -384 1483 -374 1460 -354 ct
+1437 -334 1426 -296 1426 -239 ct 1426 0 l p ef
+1991 -66 m 2002 0 l 1981 3 1962 5 1945 5 ct 1918 5 1897 1 1883 -7 ct 1868 -15 1857 -26 1851 -40 ct
+1845 -54 1842 -83 1842 -128 ct 1842 -381 l 1787 -381 l 1787 -439 l 1842 -439 l
+1842 -547 l 1916 -592 l 1916 -439 l 1991 -439 l 1991 -381 l 1916 -381 l
+1916 -124 l 1916 -103 1917 -89 1920 -83 ct 1923 -77 1927 -72 1933 -69 ct 1939 -65 1947 -63 1958 -63 ct
+1966 -63 l 1977 -64 l p ef
+2316 0 m 2316 -606 l 2754 -606 l 2754 -534 l 2396 -534 l 2396 -349 l
+2731 -349 l 2731 -277 l 2396 -277 l 2396 -71 l 2768 -71 l 2768 0 l
+p ef
+2886 0 m 2886 -439 l 2953 -439 l 2953 -376 l 2986 -425 3032 -449 3093 -449 ct
+3120 -449 3144 -444 3166 -434 ct 3188 -425 3205 -412 3216 -397 ct 3227 -382 3235 -363 3239 -342 ct
+3242 -328 3243 -304 3243 -270 ct 3243 0 l 3169 0 l 3169 -267 l 3169 -297 3166 -320 3160 -335 ct
+3154 -350 3144 -362 3129 -371 ct 3115 -380 3097 -384 3077 -384 ct 3046 -384 3018 -374 2995 -354 ct
+2972 -334 2961 -296 2961 -239 ct 2961 0 l p ef
+3647 0 m 3647 -55 l 3619 -11 3579 9 3524 9 ct 3489 9 3457 0 3428 -19 ct 3399 -38 3376 -65 3360 -99 ct
+3344 -134 3335 -174 3335 -219 ct 3335 -263 3343 -302 3357 -338 ct 3372 -374 3394 -401 3423 -420 ct
+3452 -439 3485 -449 3521 -449 ct 3548 -449 3571 -443 3592 -432 ct 3613 -421 3629 -406 3642 -388 ct
+3642 -606 l 3716 -606 l 3716 0 l p
+3412 -219 m 3412 -162 3424 -120 3448 -93 ct 3471 -65 3499 -51 3531 -51 ct 3564 -51 3592 -64 3614 -91 ct
+3637 -117 3649 -158 3649 -212 ct 3649 -273 3637 -317 3614 -345 ct 3591 -373 3562 -387 3528 -387 ct
+3495 -387 3467 -374 3445 -346 ct 3423 -319 l 3412 -277 l p ef
+pom
+gr
+21272 7620 m 19550 7620 l 19274 7620 19050 7396 19050 7120 ct 19050 3040 l
+19050 2764 19274 2540 19550 2540 ct 22995 2540 l 23271 2540 23495 2764 23495 3040 ct
+23495 7120 l 23495 7396 23271 7620 22995 7620 ct 21272 7620 l pc
+gs
+pum
+20360 4418 t
+236 0 m 285 -234 l 98 -606 l 185 -606 l 275 -429 l 294 -390 313 -349 332 -305 ct
+352 -342 380 -383 415 -428 ct 557 -606 l 654 -606 l 365 -228 l 317 0 l
+p ef
+597 -166 m 597 -252 622 -323 673 -379 ct 714 -425 769 -449 836 -449 ct 889 -449 932 -432 964 -399 ct
+997 -366 1013 -321 1013 -265 ct 1013 -215 1003 -168 982 -124 ct 962 -81 933 -47 895 -24 ct
+858 -1 818 9 776 9 ct 742 9 711 2 683 -11 ct 655 -26 634 -47 619 -74 ct 604 -100 l
+597 -131 l p
+672 -174 m 672 -132 682 -101 701 -80 ct 721 -58 747 -47 777 -47 ct 793 -47 809 -51 825 -57 ct
+840 -64 855 -74 869 -87 ct 882 -100 894 -115 903 -132 ct 913 -149 920 -167 926 -187 ct
+935 -214 939 -240 939 -265 ct 939 -305 929 -336 909 -358 ct 889 -380 864 -391 833 -391 ct
+810 -391 789 -385 769 -374 ct 750 -363 733 -346 717 -325 ct 701 -303 690 -278 683 -250 ct
+675 -221 l 672 -196 l p ef
+1359 -79 m 1307 -19 1253 9 1198 9 ct 1164 9 1136 0 1116 -19 ct 1095 -38 1084 -62 1084 -90 ct
+1084 -109 1089 -140 1099 -185 ct 1151 -439 l 1226 -439 l 1168 -158 l 1163 -134 1160 -116 1160 -103 ct
+1160 -87 1165 -74 1175 -65 ct 1185 -55 1200 -51 1220 -51 ct 1241 -51 1261 -56 1281 -66 ct
+1301 -76 1318 -90 1333 -107 ct 1347 -125 1359 -145 1368 -169 ct 1374 -184 1381 -211 1389 -249 ct
+1429 -439 l 1504 -439 l 1412 0 l 1343 0 l p ef
+1536 0 m 1627 -439 l 1694 -439 l 1675 -349 l 1698 -383 1720 -408 1741 -424 ct
+1763 -441 1785 -449 1808 -449 ct 1823 -449 1841 -443 1863 -433 ct 1832 -363 l
+1819 -372 1805 -377 1790 -377 ct 1763 -377 1736 -362 1709 -333 ct 1681 -304 1660 -252 1644 -176 ct
+1607 0 l p ef
+pom
+pum
+20241 5371 t
+510 -213 m 591 -202 l 565 -132 528 -79 480 -43 ct 431 -7 377 10 316 10 ct
+243 10 184 -12 141 -57 ct 98 -102 76 -166 76 -250 ct 76 -359 109 -449 175 -521 ct
+233 -584 306 -616 393 -616 ct 457 -616 509 -599 549 -564 ct 589 -530 612 -484 618 -425 ct
+543 -418 l 535 -462 518 -495 493 -517 ct 468 -538 436 -549 397 -549 ct 322 -549 262 -516 217 -450 ct
+177 -394 157 -326 157 -248 ct 157 -186 172 -138 203 -105 ct 234 -73 273 -56 323 -56 ct
+364 -56 402 -70 436 -97 ct 470 -124 l 495 -163 l p ef
+650 -166 m 650 -252 675 -323 726 -379 ct 767 -425 822 -449 889 -449 ct 942 -449 985 -432 1017 -399 ct
+1050 -366 1066 -321 1066 -265 ct 1066 -215 1056 -168 1035 -124 ct 1015 -81 986 -47 948 -24 ct
+911 -1 871 9 829 9 ct 795 9 764 2 736 -11 ct 708 -26 687 -47 672 -74 ct 657 -100 l
+650 -131 l p
+725 -174 m 725 -132 735 -101 754 -80 ct 774 -58 800 -47 830 -47 ct 846 -47 862 -51 878 -57 ct
+893 -64 908 -74 922 -87 ct 935 -100 947 -115 956 -132 ct 966 -149 973 -167 979 -187 ct
+988 -214 992 -240 992 -265 ct 992 -305 982 -336 962 -358 ct 942 -380 917 -391 886 -391 ct
+863 -391 842 -385 822 -374 ct 803 -363 786 -346 770 -325 ct 754 -303 743 -278 736 -250 ct
+728 -221 l 725 -196 l p ef
+1409 -63 m 1366 -14 1321 9 1275 9 ct 1233 9 1198 -5 1171 -36 ct 1143 -66 1129 -111 1129 -169 ct
+1129 -223 1140 -272 1162 -316 ct 1184 -360 1211 -394 1244 -416 ct 1277 -438 1310 -449 1343 -449 ct
+1398 -449 1439 -422 1467 -370 ct 1517 -606 l 1591 -606 l 1465 0 l 1396 0 l
+p
+1204 -184 m 1204 -153 1207 -129 1213 -111 ct 1219 -94 1229 -79 1244 -67 ct
+1258 -55 1276 -50 1296 -50 ct 1330 -50 1361 -67 1388 -102 ct 1425 -149 1444 -207 1444 -276 ct
+1444 -311 1435 -338 1417 -358 ct 1398 -377 1376 -387 1348 -387 ct 1330 -387 1314 -383 1299 -375 ct
+1284 -367 1270 -353 1255 -334 ct 1241 -315 1228 -291 1219 -261 ct 1209 -232 l
+1204 -206 l p ef
+1911 -149 m 1984 -141 l 1974 -105 1949 -71 1912 -38 ct 1874 -6 1829 9 1777 9 ct
+1745 9 1715 2 1688 -12 ct 1661 -27 1640 -49 1626 -78 ct 1611 -106 1604 -139 1604 -176 ct
+1604 -224 1615 -270 1638 -315 ct 1660 -360 1689 -394 1724 -416 ct 1759 -438 1797 -449 1838 -449 ct
+1891 -449 1933 -432 1964 -400 ct 1995 -367 2011 -323 2011 -267 ct 2011 -245 2009 -223 2005 -201 ct
+1682 -201 l 1681 -192 1680 -184 1680 -177 ct 1680 -136 1689 -105 1708 -83 ct
+1727 -62 1750 -51 1778 -51 ct 1803 -51 1829 -59 1853 -76 ct 1878 -93 l 1897 -117 l
+p
+1694 -258 m 1940 -258 l 1940 -265 1941 -271 1941 -274 ct 1941 -312 1931 -340 1912 -360 ct
+1894 -380 1870 -390 1840 -390 ct 1808 -390 1779 -379 1753 -357 ct 1726 -335 l
+1707 -302 l p ef
+pom
+pum
+20214 6324 t
+35 0 m 162 -606 l 243 -606 l 190 -354 l 504 -354 l 557 -606 l 638 -606 l
+512 0 l 430 0 l 490 -285 l 176 -285 l 116 0 l p ef
+959 -149 m 1032 -141 l 1022 -105 997 -71 960 -38 ct 922 -6 877 9 825 9 ct
+793 9 763 2 736 -12 ct 709 -27 688 -49 674 -78 ct 659 -106 652 -139 652 -176 ct
+652 -224 663 -270 686 -315 ct 708 -360 737 -394 772 -416 ct 807 -438 845 -449 886 -449 ct
+939 -449 981 -432 1012 -400 ct 1043 -367 1059 -323 1059 -267 ct 1059 -245 1057 -223 1053 -201 ct
+730 -201 l 729 -192 728 -184 728 -177 ct 728 -136 737 -105 756 -83 ct 775 -62 798 -51 826 -51 ct
+851 -51 877 -59 901 -76 ct 926 -93 l 945 -117 l p
+742 -258 m 988 -258 l 988 -265 989 -271 989 -274 ct 989 -312 979 -340 960 -360 ct
+942 -380 918 -390 888 -390 ct 856 -390 827 -379 801 -357 ct 774 -335 l 755 -302 l
+p ef
+1113 0 m 1204 -439 l 1271 -439 l 1252 -349 l 1275 -383 1297 -408 1318 -424 ct
+1340 -441 1362 -449 1385 -449 ct 1400 -449 1418 -443 1440 -433 ct 1409 -363 l
+1396 -372 1382 -377 1367 -377 ct 1340 -377 1313 -362 1286 -333 ct 1258 -304 1237 -252 1221 -176 ct
+1184 0 l p ef
+1726 -149 m 1799 -141 l 1789 -105 1764 -71 1727 -38 ct 1689 -6 1644 9 1592 9 ct
+1560 9 1530 2 1503 -12 ct 1476 -27 1455 -49 1441 -78 ct 1426 -106 1419 -139 1419 -176 ct
+1419 -224 1430 -270 1453 -315 ct 1475 -360 1504 -394 1539 -416 ct 1574 -438 1612 -449 1653 -449 ct
+1706 -449 1748 -432 1779 -400 ct 1810 -367 1826 -323 1826 -267 ct 1826 -245 1824 -223 1820 -201 ct
+1497 -201 l 1496 -192 1495 -184 1495 -177 ct 1495 -136 1504 -105 1523 -83 ct
+1542 -62 1565 -51 1593 -51 ct 1618 -51 1644 -59 1668 -76 ct 1693 -93 l 1712 -117 l
+p
+1509 -258 m 1755 -258 l 1755 -265 1756 -271 1756 -274 ct 1756 -312 1746 -340 1727 -360 ct
+1709 -380 1685 -390 1655 -390 ct 1623 -390 1594 -379 1568 -357 ct 1541 -335 l
+1522 -302 l p ef
+1946 -153 m 1992 -482 l 2018 -606 l 2109 -606 l 2081 -471 l 1993 -153 l
+p
+1899 0 m 1917 -84 l 2001 -84 l 1983 0 l p ef
+pom
+gr
+5715 5080 m 5264 4930 l 5265 5230 l 5715 5080 l p ef
+1 lw 0 lj 3175 5080 m 5355 5080 l ps
+12565 5080 m 12114 4930 l 12115 5230 l 12565 5080 l p ef
+10795 5080 m 12205 5080 l ps
+19050 5080 m 18599 4930 l 18600 5230 l 19050 5080 l p ef
+16375 5080 m 18690 5080 l ps
+gs
+pum
+10425 8413 t
+66 0 m 66 -606 l 335 -606 l 389 -606 430 -600 458 -589 ct 486 -579 509 -559 526 -532 ct
+542 -504 551 -474 551 -440 ct 551 -397 537 -361 509 -332 ct 481 -302 438 -283 380 -275 ct
+401 -265 417 -255 428 -245 ct 452 -224 474 -197 495 -165 ct 600 0 l 500 0 l
+419 -126 l 396 -162 377 -190 361 -209 ct 346 -228 333 -242 321 -250 ct 309 -257 296 -263 284 -266 ct
+275 -268 260 -269 239 -269 ct 146 -269 l 146 0 l p
+146 -338 m 319 -338 l 355 -338 384 -342 405 -350 ct 425 -357 441 -369 452 -386 ct
+463 -403 468 -421 468 -440 ct 468 -469 458 -493 437 -511 ct 416 -530 383 -539 338 -539 ct
+146 -539 l p ef
+965 -141 m 1042 -131 l 1030 -86 1007 -52 975 -27 ct 942 -2 900 9 849 9 ct
+785 9 734 -9 696 -49 ct 658 -88 640 -144 640 -215 ct 640 -289 659 -347 697 -387 ct
+735 -428 784 -449 845 -449 ct 903 -449 951 -429 989 -389 ct 1026 -349 1044 -292 1044 -220 ct
+1044 -216 1044 -209 1044 -200 ct 716 -200 l 719 -152 733 -115 757 -89 ct 782 -64 813 -51 849 -51 ct
+877 -51 900 -58 919 -72 ct 938 -87 l 954 -110 l p
+721 -261 m 966 -261 l 963 -298 953 -326 938 -344 ct 914 -373 883 -387 845 -387 ct
+811 -387 783 -376 759 -353 ct 736 -330 l 723 -300 l p ef
+1427 -160 m 1500 -151 l 1492 -100 1472 -61 1439 -32 ct 1406 -4 1365 9 1317 9 ct
+1257 9 1209 -9 1172 -49 ct 1136 -88 1118 -144 1118 -217 ct 1118 -265 1125 -306 1141 -342 ct
+1157 -378 1181 -404 1213 -422 ct 1245 -440 1280 -449 1318 -449 ct 1365 -449 1404 -437 1435 -412 ct
+1465 -388 1485 -354 1493 -310 ct 1421 -299 l 1414 -328 1402 -350 1384 -365 ct
+1367 -380 1345 -387 1321 -387 ct 1283 -387 1253 -374 1229 -347 ct 1206 -320 1194 -278 1194 -220 ct
+1194 -161 1205 -118 1228 -91 ct 1251 -64 1280 -51 1317 -51 ct 1346 -51 1370 -60 1390 -78 ct
+1409 -96 l 1422 -123 l p ef
+1864 -141 m 1941 -131 l 1929 -86 1906 -52 1874 -27 ct 1841 -2 1799 9 1748 9 ct
+1684 9 1633 -9 1595 -49 ct 1557 -88 1539 -144 1539 -215 ct 1539 -289 1558 -347 1596 -387 ct
+1634 -428 1683 -449 1744 -449 ct 1802 -449 1850 -429 1888 -389 ct 1925 -349 1943 -292 1943 -220 ct
+1943 -216 1943 -209 1943 -200 ct 1615 -200 l 1618 -152 1632 -115 1656 -89 ct
+1681 -64 1712 -51 1748 -51 ct 1776 -51 1799 -58 1818 -72 ct 1837 -87 l 1853 -110 l
+p
+1620 -261 m 1865 -261 l 1862 -298 1852 -326 1837 -344 ct 1813 -373 1782 -387 1744 -387 ct
+1710 -387 1682 -376 1658 -353 ct 1635 -330 l 1622 -300 l p ef
+2040 -520 m 2040 -606 l 2114 -606 l 2114 -520 l p
+2040 0 m 2040 -439 l 2114 -439 l 2114 0 l p ef
+2347 0 m 2180 -439 l 2259 -439 l 2353 -176 l 2363 -147 2373 -118 2381 -87 ct
+2388 -110 2397 -138 2409 -171 ct 2507 -439 l 2583 -439 l 2417 0 l p ef
+2949 -141 m 3026 -131 l 3014 -86 2991 -52 2959 -27 ct 2926 -2 2884 9 2833 9 ct
+2769 9 2718 -9 2680 -49 ct 2642 -88 2624 -144 2624 -215 ct 2624 -289 2643 -347 2681 -387 ct
+2719 -428 2768 -449 2829 -449 ct 2887 -449 2935 -429 2973 -389 ct 3010 -349 3028 -292 3028 -220 ct
+3028 -216 3028 -209 3028 -200 ct 2700 -200 l 2703 -152 2717 -115 2741 -89 ct
+2766 -64 2797 -51 2833 -51 ct 2861 -51 2884 -58 2903 -72 ct 2922 -87 l 2938 -110 l
+p
+2705 -261 m 2950 -261 l 2947 -298 2937 -326 2922 -344 ct 2898 -373 2867 -387 2829 -387 ct
+2795 -387 2767 -376 2743 -353 ct 2720 -330 l 2707 -300 l p ef
+3372 0 m 3372 -606 l 3601 -606 l 3641 -606 3672 -604 3693 -600 ct 3723 -595 3748 -586 3768 -572 ct
+3788 -558 3804 -538 3816 -513 ct 3829 -488 3835 -461 3835 -430 ct 3835 -379 3818 -335 3785 -300 ct
+3753 -264 3693 -246 3608 -246 ct 3452 -246 l 3452 0 l p
+3452 -318 m 3609 -318 l 3661 -318 3697 -327 3719 -346 ct 3741 -366 3752 -393 3752 -428 ct
+3752 -453 3746 -475 3733 -493 ct 3720 -511 3703 -523 3682 -529 ct 3669 -532 3644 -534 3607 -534 ct
+3452 -534 l p ef
+4205 -54 m 4177 -30 4151 -14 4125 -4 ct 4100 5 4072 9 4043 9 ct 3995 9 3958 -1 3932 -25 ct
+3906 -49 3893 -79 3893 -115 ct 3893 -137 3898 -156 3908 -174 ct 3918 -192 3930 -206 3946 -217 ct
+3962 -228 3980 -236 4000 -241 ct 4014 -245 4036 -249 4066 -253 ct 4126 -260 4170 -268 4199 -278 ct
+4199 -288 4199 -295 4199 -298 ct 4199 -328 4192 -349 4178 -362 ct 4159 -379 4131 -387 4093 -387 ct
+4058 -387 4032 -381 4016 -369 ct 3999 -356 3987 -335 3979 -303 ct 3906 -313 l
+3913 -345 3923 -370 3939 -389 ct 3954 -408 3976 -423 4004 -433 ct 4033 -443 4066 -449 4104 -449 ct
+4142 -449 4172 -444 4195 -435 ct 4219 -427 4236 -415 4247 -402 ct 4258 -389 4266 -372 4270 -351 ct
+4273 -339 4274 -316 4274 -283 ct 4274 -184 l 4274 -114 4276 -71 4279 -52 ct
+4282 -34 4288 -16 4298 0 ct 4220 0 l 4212 -15 l 4207 -33 l p
+4199 -220 m 4172 -209 4131 -200 4077 -192 ct 4047 -187 4025 -182 4012 -177 ct
+4000 -171 3990 -163 3983 -153 ct 3976 -142 3973 -130 3973 -117 ct 3973 -98 3980 -81 3995 -68 ct
+4010 -55 4032 -48 4061 -48 ct 4090 -48 4115 -54 4138 -67 ct 4160 -79 4176 -96 4187 -118 ct
+4195 -135 4199 -160 4199 -193 ct p ef
+4531 -66 m 4542 0 l 4521 3 4502 5 4485 5 ct 4458 5 4437 1 4423 -7 ct 4408 -15 4397 -26 4391 -40 ct
+4385 -54 4382 -83 4382 -128 ct 4382 -381 l 4327 -381 l 4327 -439 l 4382 -439 l
+4382 -547 l 4456 -592 l 4456 -439 l 4531 -439 l 4531 -381 l 4456 -381 l
+4456 -124 l 4456 -103 4457 -89 4460 -83 ct 4463 -77 4467 -72 4473 -69 ct 4479 -65 4487 -63 4498 -63 ct
+4506 -63 l 4517 -64 l p ef
+4606 0 m 4606 -606 l 4681 -606 l 4681 -388 l 4716 -429 4759 -449 4812 -449 ct
+4845 -449 4873 -442 4897 -429 ct 4921 -417 4938 -399 4949 -376 ct 4959 -354 4964 -321 4964 -278 ct
+4964 0 l 4890 0 l 4890 -278 l 4890 -315 4882 -342 4865 -359 ct 4849 -376 4827 -385 4797 -385 ct
+4775 -385 4754 -379 4735 -367 ct 4715 -356 4701 -340 4693 -321 ct 4685 -301 4681 -274 4681 -240 ct
+4681 0 l p ef
+pom
+gr
+0 lw 1 lj 1905 12030 m 3175 13935 l ps
+3175 13935 m 4445 12030 l ps
+3175 12030 m 3175 15205 l ps
+0.996 c 12565 15205 m 13835 13935 l 16375 13935 l 16375 16475 l 13835 16475 l
+12565 15205 l p ef
+0.000 c 12565 15205 m 13835 13935 l 16375 13935 l 16375 16475 l 13835 16475 l
+12565 15205 l pc
+gs
+pum
+13573 15504 t
+65 0 m 65 -606 l 274 -606 l 321 -606 357 -603 382 -597 ct 416 -589 446 -575 471 -554 ct
+503 -527 526 -492 542 -450 ct 558 -408 566 -360 566 -306 ct 566 -260 561 -219 550 -184 ct
+539 -148 525 -119 509 -95 ct 492 -72 473 -54 453 -40 ct 433 -27 409 -17 381 -10 ct
+353 -3 320 0 284 0 ct p
+145 -71 m 275 -71 l 315 -71 346 -75 369 -82 ct 391 -90 409 -100 423 -114 ct
+442 -133 457 -158 467 -190 ct 478 -222 483 -261 483 -307 ct 483 -371 473 -419 452 -453 ct
+431 -487 406 -510 376 -522 ct 355 -530 320 -534 272 -534 ct 145 -534 l p ef
+608 0 m 840 -606 l 927 -606 l 1175 0 l 1083 0 l 1013 -183 l 759 -183 l
+692 0 l p
+782 -248 m 988 -248 l 924 -416 l 905 -467 891 -509 881 -542 ct 874 -503 863 -465 849 -426 ct
+p ef
+1661 -212 m 1742 -192 l 1725 -126 1695 -76 1651 -41 ct 1607 -6 1554 10 1491 10 ct
+1425 10 1372 -2 1331 -29 ct 1290 -56 1259 -94 1238 -145 ct 1216 -195 1206 -249 1206 -307 ct
+1206 -370 1218 -425 1242 -472 ct 1266 -519 1300 -555 1345 -580 ct 1389 -604 1438 -616 1492 -616 ct
+1553 -616 1604 -601 1645 -570 ct 1686 -539 1715 -496 1731 -440 ct 1652 -421 l
+1638 -465 1618 -497 1591 -517 ct 1564 -537 1531 -547 1490 -547 ct 1444 -547 1405 -536 1373 -514 ct
+1342 -492 1320 -462 1307 -424 ct 1295 -386 1288 -348 1288 -308 ct 1288 -256 1296 -211 1311 -173 ct
+1326 -134 1349 -105 1381 -86 ct 1413 -67 1447 -58 1484 -58 ct 1529 -58 1567 -71 1598 -97 ct
+1629 -123 l 1650 -161 l p ef
+pom
+gr
+8255 16475 m 5715 16475 l 5715 13935 l 10795 13935 l 10795 16475 l
+8255 16475 l pc
+gs
+pum
+6708 15028 t
+3 0 m 238 -315 l 31 -606 l 126 -606 l 236 -450 l 259 -418 276 -393 285 -376 ct
+299 -398 315 -421 333 -445 ct 455 -606 l 543 -606 l 330 -320 l 559 0 l
+460 0 l 307 -216 l 299 -228 290 -242 281 -256 ct 267 -234 258 -219 252 -211 ct
+100 0 l p ef
+611 0 m 611 -439 l 678 -439 l 678 -377 l 692 -399 710 -416 733 -429 ct
+756 -442 782 -449 811 -449 ct 844 -449 870 -442 891 -428 ct 912 -415 927 -396 935 -372 ct
+970 -423 1015 -449 1071 -449 ct 1114 -449 1148 -437 1171 -412 ct 1195 -388 1206 -351 1206 -301 ct
+1206 0 l 1132 0 l 1132 -276 l 1132 -306 1130 -327 1125 -340 ct 1120 -354 1112 -364 1099 -372 ct
+1086 -380 1071 -384 1054 -384 ct 1023 -384 998 -374 977 -353 ct 957 -333 947 -300 947 -255 ct
+947 0 l 872 0 l 872 -285 l 872 -318 866 -343 854 -359 ct 842 -376 822 -384 795 -384 ct
+774 -384 754 -379 736 -368 ct 719 -357 706 -340 698 -319 ct 690 -298 686 -267 686 -227 ct
+686 0 l p ef
+1326 -520 m 1326 -606 l 1400 -606 l 1400 -520 l p
+1326 0 m 1326 -439 l 1400 -439 l 1400 0 l p ef
+1673 -66 m 1684 0 l 1663 3 1644 5 1627 5 ct 1600 5 1579 1 1565 -7 ct 1550 -15 1539 -26 1533 -40 ct
+1527 -54 1524 -83 1524 -128 ct 1524 -381 l 1469 -381 l 1469 -439 l 1524 -439 l
+1524 -547 l 1598 -592 l 1598 -439 l 1673 -439 l 1673 -381 l 1598 -381 l
+1598 -124 l 1598 -103 1599 -89 1602 -83 ct 1605 -77 1609 -72 1615 -69 ct 1621 -65 1629 -63 1640 -63 ct
+1648 -63 l 1659 -64 l p ef
+1997 0 m 1997 -606 l 2266 -606 l 2320 -606 2361 -600 2389 -589 ct 2417 -579 2440 -559 2457 -532 ct
+2473 -504 2482 -474 2482 -440 ct 2482 -397 2468 -361 2440 -332 ct 2412 -302 2369 -283 2311 -275 ct
+2332 -265 2348 -255 2359 -245 ct 2383 -224 2405 -197 2426 -165 ct 2531 0 l 2431 0 l
+2350 -126 l 2327 -162 2308 -190 2292 -209 ct 2277 -228 2264 -242 2252 -250 ct
+2240 -257 2227 -263 2215 -266 ct 2206 -268 2191 -269 2170 -269 ct 2077 -269 l
+2077 0 l p
+2077 -338 m 2250 -338 l 2286 -338 2315 -342 2336 -350 ct 2356 -357 2372 -369 2383 -386 ct
+2394 -403 2399 -421 2399 -440 ct 2399 -469 2389 -493 2368 -511 ct 2347 -530 2314 -539 2269 -539 ct
+2077 -539 l p ef
+2609 0 m 2609 -606 l 3018 -606 l 3018 -534 l 2689 -534 l 2689 -346 l
+2974 -346 l 2974 -275 l 2689 -275 l 2689 0 l p ef
+pom
+pum
+6350 15981 t
+69 0 m 69 -606 l 478 -606 l 478 -534 l 149 -534 l 149 -346 l 434 -346 l
+434 -275 l 149 -275 l 149 0 l p ef
+584 0 m 584 -439 l 651 -439 l 651 -372 l 668 -403 683 -424 698 -434 ct
+712 -444 728 -449 746 -449 ct 771 -449 796 -441 822 -425 ct 797 -356 l 778 -366 760 -372 742 -372 ct
+726 -372 711 -367 698 -357 ct 685 -347 676 -334 670 -316 ct 662 -290 658 -261 658 -229 ct
+658 0 l p ef
+848 -219 m 848 -300 870 -361 915 -400 ct 953 -432 999 -449 1054 -449 ct 1114 -449 1163 -429 1202 -389 ct
+1240 -350 1259 -295 1259 -225 ct 1259 -169 1251 -124 1234 -92 ct 1217 -60 1192 -34 1160 -16 ct
+1127 0 1092 9 1054 9 ct 992 9 942 -9 904 -49 ct 867 -88 l 848 -145 l p
+924 -219 m 924 -163 936 -121 961 -93 ct 985 -65 1016 -51 1054 -51 ct 1091 -51 1121 -65 1146 -93 ct
+1170 -121 1183 -164 1183 -222 ct 1183 -276 1170 -317 1146 -345 ct 1121 -373 1090 -387 1054 -387 ct
+1016 -387 985 -373 961 -345 ct 936 -317 l 924 -275 l p ef
+1351 0 m 1351 -439 l 1418 -439 l 1418 -376 l 1451 -425 1497 -449 1558 -449 ct
+1585 -449 1609 -444 1631 -434 ct 1653 -425 1670 -412 1681 -397 ct 1692 -382 1700 -363 1704 -342 ct
+1707 -328 1708 -304 1708 -270 ct 1708 0 l 1634 0 l 1634 -267 l 1634 -297 1631 -320 1625 -335 ct
+1619 -350 1609 -362 1594 -371 ct 1580 -380 1562 -384 1542 -384 ct 1511 -384 1483 -374 1460 -354 ct
+1437 -334 1426 -296 1426 -239 ct 1426 0 l p ef
+1991 -66 m 2002 0 l 1981 3 1962 5 1945 5 ct 1918 5 1897 1 1883 -7 ct 1868 -15 1857 -26 1851 -40 ct
+1845 -54 1842 -83 1842 -128 ct 1842 -381 l 1787 -381 l 1787 -439 l 1842 -439 l
+1842 -547 l 1916 -592 l 1916 -439 l 1991 -439 l 1991 -381 l 1916 -381 l
+1916 -124 l 1916 -103 1917 -89 1920 -83 ct 1923 -77 1927 -72 1933 -69 ct 1939 -65 1947 -63 1958 -63 ct
+1966 -63 l 1977 -64 l p ef
+2316 0 m 2316 -606 l 2754 -606 l 2754 -534 l 2396 -534 l 2396 -349 l
+2731 -349 l 2731 -277 l 2396 -277 l 2396 -71 l 2768 -71 l 2768 0 l
+p ef
+2886 0 m 2886 -439 l 2953 -439 l 2953 -376 l 2986 -425 3032 -449 3093 -449 ct
+3120 -449 3144 -444 3166 -434 ct 3188 -425 3205 -412 3216 -397 ct 3227 -382 3235 -363 3239 -342 ct
+3242 -328 3243 -304 3243 -270 ct 3243 0 l 3169 0 l 3169 -267 l 3169 -297 3166 -320 3160 -335 ct
+3154 -350 3144 -362 3129 -371 ct 3115 -380 3097 -384 3077 -384 ct 3046 -384 3018 -374 2995 -354 ct
+2972 -334 2961 -296 2961 -239 ct 2961 0 l p ef
+3647 0 m 3647 -55 l 3619 -11 3579 9 3524 9 ct 3489 9 3457 0 3428 -19 ct 3399 -38 3376 -65 3360 -99 ct
+3344 -134 3335 -174 3335 -219 ct 3335 -263 3343 -302 3357 -338 ct 3372 -374 3394 -401 3423 -420 ct
+3452 -439 3485 -449 3521 -449 ct 3548 -449 3571 -443 3592 -432 ct 3613 -421 3629 -406 3642 -388 ct
+3642 -606 l 3716 -606 l 3716 0 l p
+3412 -219 m 3412 -162 3424 -120 3448 -93 ct 3471 -65 3499 -51 3531 -51 ct 3564 -51 3592 -64 3614 -91 ct
+3637 -117 3649 -158 3649 -212 ct 3649 -273 3637 -317 3614 -345 ct 3591 -373 3562 -387 3528 -387 ct
+3495 -387 3467 -374 3445 -346 ct 3423 -319 l 3412 -277 l p ef
+pom
+gr
+21272 17745 m 19550 17745 l 19274 17745 19050 17521 19050 17245 ct 19050 13165 l
+19050 12889 19274 12665 19550 12665 ct 22995 12665 l 23271 12665 23495 12889 23495 13165 ct
+23495 17245 l 23495 17521 23271 17745 22995 17745 ct 21272 17745 l pc
+gs
+pum
+20360 14552 t
+236 0 m 285 -234 l 98 -606 l 185 -606 l 275 -429 l 294 -390 313 -349 332 -305 ct
+352 -342 380 -383 415 -428 ct 557 -606 l 654 -606 l 365 -228 l 317 0 l
+p ef
+597 -166 m 597 -252 622 -323 673 -379 ct 714 -425 769 -449 836 -449 ct 889 -449 932 -432 964 -399 ct
+997 -366 1013 -321 1013 -265 ct 1013 -215 1003 -168 982 -124 ct 962 -81 933 -47 895 -24 ct
+858 -1 818 9 776 9 ct 742 9 711 2 683 -11 ct 655 -26 634 -47 619 -74 ct 604 -100 l
+597 -131 l p
+672 -174 m 672 -132 682 -101 701 -80 ct 721 -58 747 -47 777 -47 ct 793 -47 809 -51 825 -57 ct
+840 -64 855 -74 869 -87 ct 882 -100 894 -115 903 -132 ct 913 -149 920 -167 926 -187 ct
+935 -214 939 -240 939 -265 ct 939 -305 929 -336 909 -358 ct 889 -380 864 -391 833 -391 ct
+810 -391 789 -385 769 -374 ct 750 -363 733 -346 717 -325 ct 701 -303 690 -278 683 -250 ct
+675 -221 l 672 -196 l p ef
+1359 -79 m 1307 -19 1253 9 1198 9 ct 1164 9 1136 0 1116 -19 ct 1095 -38 1084 -62 1084 -90 ct
+1084 -109 1089 -140 1099 -185 ct 1151 -439 l 1226 -439 l 1168 -158 l 1163 -134 1160 -116 1160 -103 ct
+1160 -87 1165 -74 1175 -65 ct 1185 -55 1200 -51 1220 -51 ct 1241 -51 1261 -56 1281 -66 ct
+1301 -76 1318 -90 1333 -107 ct 1347 -125 1359 -145 1368 -169 ct 1374 -184 1381 -211 1389 -249 ct
+1429 -439 l 1504 -439 l 1412 0 l 1343 0 l p ef
+1536 0 m 1627 -439 l 1694 -439 l 1675 -349 l 1698 -383 1720 -408 1741 -424 ct
+1763 -441 1785 -449 1808 -449 ct 1823 -449 1841 -443 1863 -433 ct 1832 -363 l
+1819 -372 1805 -377 1790 -377 ct 1763 -377 1736 -362 1709 -333 ct 1681 -304 1660 -252 1644 -176 ct
+1607 0 l p ef
+pom
+pum
+20241 15505 t
+510 -213 m 591 -202 l 565 -132 528 -79 480 -43 ct 431 -7 377 10 316 10 ct
+243 10 184 -12 141 -57 ct 98 -102 76 -166 76 -250 ct 76 -359 109 -449 175 -521 ct
+233 -584 306 -616 393 -616 ct 457 -616 509 -599 549 -564 ct 589 -530 612 -484 618 -425 ct
+543 -418 l 535 -462 518 -495 493 -517 ct 468 -538 436 -549 397 -549 ct 322 -549 262 -516 217 -450 ct
+177 -394 157 -326 157 -248 ct 157 -186 172 -138 203 -105 ct 234 -73 273 -56 323 -56 ct
+364 -56 402 -70 436 -97 ct 470 -124 l 495 -163 l p ef
+650 -166 m 650 -252 675 -323 726 -379 ct 767 -425 822 -449 889 -449 ct 942 -449 985 -432 1017 -399 ct
+1050 -366 1066 -321 1066 -265 ct 1066 -215 1056 -168 1035 -124 ct 1015 -81 986 -47 948 -24 ct
+911 -1 871 9 829 9 ct 795 9 764 2 736 -11 ct 708 -26 687 -47 672 -74 ct 657 -100 l
+650 -131 l p
+725 -174 m 725 -132 735 -101 754 -80 ct 774 -58 800 -47 830 -47 ct 846 -47 862 -51 878 -57 ct
+893 -64 908 -74 922 -87 ct 935 -100 947 -115 956 -132 ct 966 -149 973 -167 979 -187 ct
+988 -214 992 -240 992 -265 ct 992 -305 982 -336 962 -358 ct 942 -380 917 -391 886 -391 ct
+863 -391 842 -385 822 -374 ct 803 -363 786 -346 770 -325 ct 754 -303 743 -278 736 -250 ct
+728 -221 l 725 -196 l p ef
+1409 -63 m 1366 -14 1321 9 1275 9 ct 1233 9 1198 -5 1171 -36 ct 1143 -66 1129 -111 1129 -169 ct
+1129 -223 1140 -272 1162 -316 ct 1184 -360 1211 -394 1244 -416 ct 1277 -438 1310 -449 1343 -449 ct
+1398 -449 1439 -422 1467 -370 ct 1517 -606 l 1591 -606 l 1465 0 l 1396 0 l
+p
+1204 -184 m 1204 -153 1207 -129 1213 -111 ct 1219 -94 1229 -79 1244 -67 ct
+1258 -55 1276 -50 1296 -50 ct 1330 -50 1361 -67 1388 -102 ct 1425 -149 1444 -207 1444 -276 ct
+1444 -311 1435 -338 1417 -358 ct 1398 -377 1376 -387 1348 -387 ct 1330 -387 1314 -383 1299 -375 ct
+1284 -367 1270 -353 1255 -334 ct 1241 -315 1228 -291 1219 -261 ct 1209 -232 l
+1204 -206 l p ef
+1911 -149 m 1984 -141 l 1974 -105 1949 -71 1912 -38 ct 1874 -6 1829 9 1777 9 ct
+1745 9 1715 2 1688 -12 ct 1661 -27 1640 -49 1626 -78 ct 1611 -106 1604 -139 1604 -176 ct
+1604 -224 1615 -270 1638 -315 ct 1660 -360 1689 -394 1724 -416 ct 1759 -438 1797 -449 1838 -449 ct
+1891 -449 1933 -432 1964 -400 ct 1995 -367 2011 -323 2011 -267 ct 2011 -245 2009 -223 2005 -201 ct
+1682 -201 l 1681 -192 1680 -184 1680 -177 ct 1680 -136 1689 -105 1708 -83 ct
+1727 -62 1750 -51 1778 -51 ct 1803 -51 1829 -59 1853 -76 ct 1878 -93 l 1897 -117 l
+p
+1694 -258 m 1940 -258 l 1940 -265 1941 -271 1941 -274 ct 1941 -312 1931 -340 1912 -360 ct
+1894 -380 1870 -390 1840 -390 ct 1808 -390 1779 -379 1753 -357 ct 1726 -335 l
+1707 -302 l p ef
+pom
+pum
+20214 16458 t
+35 0 m 162 -606 l 243 -606 l 190 -354 l 504 -354 l 557 -606 l 638 -606 l
+512 0 l 430 0 l 490 -285 l 176 -285 l 116 0 l p ef
+959 -149 m 1032 -141 l 1022 -105 997 -71 960 -38 ct 922 -6 877 9 825 9 ct
+793 9 763 2 736 -12 ct 709 -27 688 -49 674 -78 ct 659 -106 652 -139 652 -176 ct
+652 -224 663 -270 686 -315 ct 708 -360 737 -394 772 -416 ct 807 -438 845 -449 886 -449 ct
+939 -449 981 -432 1012 -400 ct 1043 -367 1059 -323 1059 -267 ct 1059 -245 1057 -223 1053 -201 ct
+730 -201 l 729 -192 728 -184 728 -177 ct 728 -136 737 -105 756 -83 ct 775 -62 798 -51 826 -51 ct
+851 -51 877 -59 901 -76 ct 926 -93 l 945 -117 l p
+742 -258 m 988 -258 l 988 -265 989 -271 989 -274 ct 989 -312 979 -340 960 -360 ct
+942 -380 918 -390 888 -390 ct 856 -390 827 -379 801 -357 ct 774 -335 l 755 -302 l
+p ef
+1113 0 m 1204 -439 l 1271 -439 l 1252 -349 l 1275 -383 1297 -408 1318 -424 ct
+1340 -441 1362 -449 1385 -449 ct 1400 -449 1418 -443 1440 -433 ct 1409 -363 l
+1396 -372 1382 -377 1367 -377 ct 1340 -377 1313 -362 1286 -333 ct 1258 -304 1237 -252 1221 -176 ct
+1184 0 l p ef
+1726 -149 m 1799 -141 l 1789 -105 1764 -71 1727 -38 ct 1689 -6 1644 9 1592 9 ct
+1560 9 1530 2 1503 -12 ct 1476 -27 1455 -49 1441 -78 ct 1426 -106 1419 -139 1419 -176 ct
+1419 -224 1430 -270 1453 -315 ct 1475 -360 1504 -394 1539 -416 ct 1574 -438 1612 -449 1653 -449 ct
+1706 -449 1748 -432 1779 -400 ct 1810 -367 1826 -323 1826 -267 ct 1826 -245 1824 -223 1820 -201 ct
+1497 -201 l 1496 -192 1495 -184 1495 -177 ct 1495 -136 1504 -105 1523 -83 ct
+1542 -62 1565 -51 1593 -51 ct 1618 -51 1644 -59 1668 -76 ct 1693 -93 l 1712 -117 l
+p
+1509 -258 m 1755 -258 l 1755 -265 1756 -271 1756 -274 ct 1756 -312 1746 -340 1727 -360 ct
+1709 -380 1685 -390 1655 -390 ct 1623 -390 1594 -379 1568 -357 ct 1541 -335 l
+1522 -302 l p ef
+1946 -153 m 1992 -482 l 2018 -606 l 2109 -606 l 2081 -471 l 1993 -153 l
+p
+1899 0 m 1917 -84 l 2001 -84 l 1983 0 l p ef
+pom
+gr
+3175 15240 m 3625 15389 l 3624 15089 l 3175 15240 l p ef
+1 lw 0 lj 5715 15240 m 3535 15240 l ps
+10795 15240 m 11245 15389 l 11244 15089 l 10795 15240 l p ef
+12565 15240 m 11155 15240 l ps
+16510 15240 m 16960 15389 l 16959 15089 l 16510 15240 l p ef
+19050 15240 m 16870 15240 l ps
+gs
+pum
+10319 18547 t
+219 0 m 219 -534 l 19 -534 l 19 -606 l 500 -606 l 500 -534 l 299 -534 l
+299 0 l p ef
+584 0 m 584 -439 l 651 -439 l 651 -372 l 668 -403 683 -424 698 -434 ct
+712 -444 728 -449 746 -449 ct 771 -449 796 -441 822 -425 ct 797 -356 l 778 -366 760 -372 742 -372 ct
+726 -372 711 -367 698 -357 ct 685 -347 676 -334 670 -316 ct 662 -290 658 -261 658 -229 ct
+658 0 l p ef
+1162 -54 m 1134 -30 1108 -14 1082 -4 ct 1057 5 1029 9 1000 9 ct 952 9 915 -1 889 -25 ct
+863 -49 850 -79 850 -115 ct 850 -137 855 -156 865 -174 ct 875 -192 887 -206 903 -217 ct
+919 -228 937 -236 957 -241 ct 971 -245 993 -249 1023 -253 ct 1083 -260 1127 -268 1156 -278 ct
+1156 -288 1156 -295 1156 -298 ct 1156 -328 1149 -349 1135 -362 ct 1116 -379 1088 -387 1050 -387 ct
+1015 -387 989 -381 973 -369 ct 956 -356 944 -335 936 -303 ct 863 -313 l 870 -345 880 -370 896 -389 ct
+911 -408 933 -423 961 -433 ct 990 -443 1023 -449 1061 -449 ct 1099 -449 1129 -444 1152 -435 ct
+1176 -427 1193 -415 1204 -402 ct 1215 -389 1223 -372 1227 -351 ct 1230 -339 1231 -316 1231 -283 ct
+1231 -184 l 1231 -114 1233 -71 1236 -52 ct 1239 -34 1245 -16 1255 0 ct 1177 0 l
+1169 -15 l 1164 -33 l p
+1156 -220 m 1129 -209 1088 -200 1034 -192 ct 1004 -187 982 -182 969 -177 ct
+957 -171 947 -163 940 -153 ct 933 -142 930 -130 930 -117 ct 930 -98 937 -81 952 -68 ct
+967 -55 989 -48 1018 -48 ct 1047 -48 1072 -54 1095 -67 ct 1117 -79 1133 -96 1144 -118 ct
+1152 -135 1156 -160 1156 -193 ct p ef
+1325 0 m 1325 -439 l 1392 -439 l 1392 -376 l 1425 -425 1471 -449 1532 -449 ct
+1559 -449 1583 -444 1605 -434 ct 1627 -425 1644 -412 1655 -397 ct 1666 -382 1674 -363 1678 -342 ct
+1681 -328 1682 -304 1682 -270 ct 1682 0 l 1608 0 l 1608 -267 l 1608 -297 1605 -320 1599 -335 ct
+1593 -350 1583 -362 1568 -371 ct 1554 -380 1536 -384 1516 -384 ct 1485 -384 1457 -374 1434 -354 ct
+1411 -334 1400 -296 1400 -239 ct 1400 0 l p ef
+1772 -131 m 1845 -142 l 1849 -113 1861 -90 1880 -74 ct 1899 -59 1925 -51 1959 -51 ct
+1993 -51 2018 -58 2035 -72 ct 2052 -86 2060 -102 2060 -121 ct 2060 -138 2053 -151 2038 -160 ct
+2028 -167 2002 -175 1962 -186 ct 1907 -199 1869 -211 1848 -221 ct 1827 -231 1811 -245 1800 -263 ct
+1789 -281 1784 -301 1784 -322 ct 1784 -342 1788 -360 1797 -376 ct 1806 -393 1819 -407 1834 -418 ct
+1846 -427 1861 -434 1881 -440 ct 1901 -446 1923 -449 1946 -449 ct 1980 -449 2010 -444 2036 -434 ct
+2063 -424 2082 -410 2094 -393 ct 2107 -376 2115 -354 2120 -325 ct 2047 -315 l
+2044 -338 2034 -356 2018 -368 ct 2002 -381 1980 -387 1951 -387 ct 1917 -387 1892 -382 1878 -370 ct
+1863 -359 1856 -346 1856 -331 ct 1856 -321 1859 -312 1865 -305 ct 1871 -297 1881 -290 1894 -285 ct
+1901 -282 1923 -276 1959 -266 ct 2012 -252 2049 -240 2070 -231 ct 2090 -222 2107 -209 2119 -192 ct
+2130 -175 2136 -154 2136 -129 ct 2136 -104 2129 -80 2115 -58 ct 2100 -37 2079 -20 2052 -8 ct
+2025 3 1994 9 1959 9 ct 1902 9 1859 -1 1829 -25 ct 1799 -49 l 1780 -84 l p ef
+2198 0 m 2198 -439 l 2265 -439 l 2265 -377 l 2279 -399 2297 -416 2320 -429 ct
+2343 -442 2369 -449 2398 -449 ct 2431 -449 2457 -442 2478 -428 ct 2499 -415 2514 -396 2522 -372 ct
+2557 -423 2602 -449 2658 -449 ct 2701 -449 2735 -437 2758 -412 ct 2782 -388 2793 -351 2793 -301 ct
+2793 0 l 2719 0 l 2719 -276 l 2719 -306 2717 -327 2712 -340 ct 2707 -354 2699 -364 2686 -372 ct
+2673 -380 2658 -384 2641 -384 ct 2610 -384 2585 -374 2564 -353 ct 2544 -333 2534 -300 2534 -255 ct
+2534 0 l 2459 0 l 2459 -285 l 2459 -318 2453 -343 2441 -359 ct 2429 -376 2409 -384 2382 -384 ct
+2361 -384 2341 -379 2323 -368 ct 2306 -357 2293 -340 2285 -319 ct 2277 -298 2273 -267 2273 -227 ct
+2273 0 l p ef
+2914 -520 m 2914 -606 l 2988 -606 l 2988 -520 l p
+2914 0 m 2914 -439 l 2988 -439 l 2988 0 l p ef
+3261 -66 m 3272 0 l 3251 3 3232 5 3215 5 ct 3188 5 3167 1 3153 -7 ct 3138 -15 3127 -26 3121 -40 ct
+3115 -54 3112 -83 3112 -128 ct 3112 -381 l 3057 -381 l 3057 -439 l 3112 -439 l
+3112 -547 l 3186 -592 l 3186 -439 l 3261 -439 l 3261 -381 l 3186 -381 l
+3186 -124 l 3186 -103 3187 -89 3190 -83 ct 3193 -77 3197 -72 3203 -69 ct 3209 -65 3217 -63 3228 -63 ct
+3236 -63 l 3247 -64 l p ef
+3584 0 m 3584 -606 l 3813 -606 l 3853 -606 3884 -604 3905 -600 ct 3935 -595 3960 -586 3980 -572 ct
+4000 -558 4016 -538 4028 -513 ct 4041 -488 4047 -461 4047 -430 ct 4047 -379 4030 -335 3997 -300 ct
+3965 -264 3905 -246 3820 -246 ct 3664 -246 l 3664 0 l p
+3664 -318 m 3821 -318 l 3873 -318 3909 -327 3931 -346 ct 3953 -366 3964 -393 3964 -428 ct
+3964 -453 3958 -475 3945 -493 ct 3932 -511 3915 -523 3894 -529 ct 3881 -532 3856 -534 3819 -534 ct
+3664 -534 l p ef
+4417 -54 m 4389 -30 4363 -14 4337 -4 ct 4312 5 4284 9 4255 9 ct 4207 9 4170 -1 4144 -25 ct
+4118 -49 4105 -79 4105 -115 ct 4105 -137 4110 -156 4120 -174 ct 4130 -192 4142 -206 4158 -217 ct
+4174 -228 4192 -236 4212 -241 ct 4226 -245 4248 -249 4278 -253 ct 4338 -260 4382 -268 4411 -278 ct
+4411 -288 4411 -295 4411 -298 ct 4411 -328 4404 -349 4390 -362 ct 4371 -379 4343 -387 4305 -387 ct
+4270 -387 4244 -381 4228 -369 ct 4211 -356 4199 -335 4191 -303 ct 4118 -313 l
+4125 -345 4135 -370 4151 -389 ct 4166 -408 4188 -423 4216 -433 ct 4245 -443 4278 -449 4316 -449 ct
+4354 -449 4384 -444 4407 -435 ct 4431 -427 4448 -415 4459 -402 ct 4470 -389 4478 -372 4482 -351 ct
+4485 -339 4486 -316 4486 -283 ct 4486 -184 l 4486 -114 4488 -71 4491 -52 ct
+4494 -34 4500 -16 4510 0 ct 4432 0 l 4424 -15 l 4419 -33 l p
+4411 -220 m 4384 -209 4343 -200 4289 -192 ct 4259 -187 4237 -182 4224 -177 ct
+4212 -171 4202 -163 4195 -153 ct 4188 -142 4185 -130 4185 -117 ct 4185 -98 4192 -81 4207 -68 ct
+4222 -55 4244 -48 4273 -48 ct 4302 -48 4327 -54 4350 -67 ct 4372 -79 4388 -96 4399 -118 ct
+4407 -135 4411 -160 4411 -193 ct p ef
+4742 -66 m 4753 0 l 4732 3 4713 5 4696 5 ct 4669 5 4648 1 4634 -7 ct 4619 -15 4608 -26 4602 -40 ct
+4596 -54 4593 -83 4593 -128 ct 4593 -381 l 4538 -381 l 4538 -439 l 4593 -439 l
+4593 -547 l 4667 -592 l 4667 -439 l 4742 -439 l 4742 -381 l 4667 -381 l
+4667 -124 l 4667 -103 4668 -89 4671 -83 ct 4674 -77 4678 -72 4684 -69 ct 4690 -65 4698 -63 4709 -63 ct
+4717 -63 l 4728 -64 l p ef
+4818 0 m 4818 -606 l 4893 -606 l 4893 -388 l 4928 -429 4971 -449 5024 -449 ct
+5057 -449 5085 -442 5109 -429 ct 5133 -417 5150 -399 5161 -376 ct 5171 -354 5176 -321 5176 -278 ct
+5176 0 l 5102 0 l 5102 -278 l 5102 -315 5094 -342 5077 -359 ct 5061 -376 5039 -385 5009 -385 ct
+4987 -385 4966 -379 4947 -367 ct 4927 -356 4913 -340 4905 -321 ct 4897 -301 4893 -274 4893 -240 ct
+4893 0 l p ef
+pom
+gr
+gr
+0 20290 t
+pom
+count op_count sub {pop} repeat countdictstack dict_count sub {end} repeat b4_inc_state restore
+%%PageTrailer
+%%Trailer
+%%EOF
diff --git a/docs/exploring-gnuradio/swr-block-diagram.png b/docs/exploring-gnuradio/swr-block-diagram.png
new file mode 100644
index 000000000..580aa687d
--- /dev/null
+++ b/docs/exploring-gnuradio/swr-block-diagram.png
Binary files differ
diff --git a/docs/exploring-gnuradio/usrp-block-diagram.eps b/docs/exploring-gnuradio/usrp-block-diagram.eps
new file mode 100644
index 000000000..190b9dee3
--- /dev/null
+++ b/docs/exploring-gnuradio/usrp-block-diagram.eps
@@ -0,0 +1,2785 @@
+%!PS-Adobe-3.0 EPSF-3.0
+%%BoundingBox: 0 0 755 575
+%%Pages: 0
+%%Creator: Sun Microsystems, Inc.
+%%Title: none
+%%CreationDate: none
+%%LanguageLevel: 2
+%%EndComments
+%%BeginPreview: 760 575 1 1725
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%080000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%080000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%080000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%080000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%080000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%080000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%080000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%080000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%080000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%080000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%080000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%080000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%080000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%080000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%080000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%080000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%080000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%080000000000FFE300707800000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%080000000000FFE380E1FE00000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%080000000000C001C0C30700000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%080000000000C000E1830300000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%080000000000C000E3820300000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%080000000000C00077000300000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%080000000000C0003E000300000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%080000000000C0001C000700000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%080000000000FFC01C000E00000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%080000000000FFC03E001C00000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%080000000000C00037003800000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%080000000000C0006700F000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%080000000000C000E381C000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%080000000000C001C1C18000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%080000000000C00180C30000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%080000000000C00380E7FF00000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%080000000000C0070077FF00000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%080000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%080000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%080000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%080000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%080000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%080000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%080000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%080000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%080000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%080000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%08000000300701F80FF80007C00000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%08000000300707FE0FFE000FF00000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%08000000300706070C060018380000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0800000030070E038C030010180000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0800000030070C000C030030180000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0800000030070E000C030000180000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%08000000300707C00C070000380000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%08000000300703FC0FFE0000300000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%080000003007007E0FFC0000700000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%080000003007000F0FFF0000E00000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%08000000300700038C030003C00000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0800000030071C018C038007000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0800000038061C018C01800E000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0800000018060E038C03801C000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%080000001C0E0F070C070018000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%080000000FFC07FE0FFF003FF80000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0800000007F001FC0FFC003FF80000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%080000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%080000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%080000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%080000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%080000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%080000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%080000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%080000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%080000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%080000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%080007E00000000000000031800000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%08001FF80000000300000031800000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0800381C0000000300000031800000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0800700C0000000300000031800000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0800600E03808E07C8C0E03180E023000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0800E0000FE0FF8FCFE3F83183F83F800000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0800E0001C70F3C30FC71C31871C3F000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0800C0003038E0C30E0E0E318E0E38000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0800C0003018C0C30C0C06318C0630000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0800C0007018C0C30C0C06318FFE30000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0800C0007018C0C30C0C07318FFE30000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0800E0067018C0C30C0C07318C0030000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0800600E7018C0C30C0C06318C0030000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0800700C3038C0C30C0C06318C0630000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0800381C3830C0C30C0E0E318E0E30000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%08001FF81FF0C0C3CC07FC3187FC30000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%080007E00FC0C0C1CC01F03181F030000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%080000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%080000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%080000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%080000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%080000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%080000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%080000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%080000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%080000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%080000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%080000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%080000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%080000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%080000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%080000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%080000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%080000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%080000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%080000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000018000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000018000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000018000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000018000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000018000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000018000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000018000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000018000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000018000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000018000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000018000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000018000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000018000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000018000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000018000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000018000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000018000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000018000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000018000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000018000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000018000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000018000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000018000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000018000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000018000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000018000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000018000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000018000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000018000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000018000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000018000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000018000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000018000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000018000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000018000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC00000000000000000000000000000
+%007FFFFFFFFFFFFFFFFFFFFFFFFFFFFE00000000000000000000000000000000FFFFFFFFFFFFFF
+%FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC00
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000010000
+%004000000000000000000000000000020000040000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000020000000000000000000
+%004000000000000000000000000000020000000000000000000020000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000040000000000000000000
+%004000000000000000000000000000020000000000000000000010000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000100000000000000000000
+%004000000000000000000000000000020000000000000000000004000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000200000000000000000000
+%004000000000000000000000000000020000000000000000000002000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000400000000000000000000
+%004000000000000000000000000000020000000000000000000001000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000800000000000000000000
+%004000000000000000000000000000020000000000000000000000800000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000001000000000000000000000
+%004000000000000000000000000000020000000000000000000000400000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000002000000000000000000000
+%004000000000000000000000000000020000000000000000000000200000000080000000000000
+%0000000000000000000000000000000400
+%00080000000000000000000000000000000000000000000040000000C000000000000000000000
+%004000000000000000000000000000020000000000000000000000180000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000010000000000000000000000
+%004000000000000000000000000000020000000000000000000000040000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000020000000000000000000000
+%004000000000000000000000000000020000000000000000000000020000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000040000000000000000000000
+%004000000000000000000000000000020000000000000000000000010000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000080000000000000000000000
+%004000000000000000000000000000020000000000000000000000008000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000100000000000000000000000
+%004000000000000000000000000000020000000000000000000000004000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000200000000000000000000000
+%004000000000000000000000000000020000000000000000000000002000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000C00000000000000000000000
+%004000000000000000000000000000020000000000000000000000001800000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%0008000000000000000000000000000000000000000000004000020001C03FF800FE0000000000
+%00400000000000000000000000000002000000000003C03FF001FE000200000080000000000000
+%0000000000000000000000000000000400
+%0008000000000000000000000000000000000000000000004000040001E03FFC03FF8000000000
+%00400000000000000000000000000002000000000003C03FFC03FF000100000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000360300E07038000000000
+%00400000000000000000000000000002000000000003C0301C0703800000000080000000000000
+%0000000000000000000000000000000400
+%00080000000000000000000000000000000000000000000040001000036030060601C000000000
+%0040000000000000000000000000000200000000000760300E0E01800040000080000000000000
+%0000000000000000000000000000000400
+%00080000000000000000000000000000000000000000000040002000073030070C00C000000000
+%004000000000000000000000000000020000000000066030060C01C00020000080000000000000
+%0000000000000000000000000000000400
+%00080000000000000000000000000000000000000000000040004000063030030C000000000000
+%004000000000000000000000000000020000000000067030071C00000010000080000000000000
+%0000000000000000000000000000000400
+%00080000000000000000000000000000000000000000000040000000063830031C000000000000
+%0040000000000000000000000000000200000000000C3030071800000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000E1830031C00000000FFFF
+%FFC0000000000000000000000000000200000000000C3030031800000001FFFF80000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400200000C1830031C00000000FFFF
+%FFC0000000000000000000000000000200000000001C1830031800000003FFFF80000000000000
+%0000000000000000000000000000000400
+%0008000000000000000000000000000000000000000000007FF800000C1C30031C000000000000
+%00400000000000000000000000000003FFFFF800001C1830031800000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000001FFC30030C000000000000
+%0040000000000000000000000000000200000000001FFC30071800000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000001FFE30070C00C000000000
+%0040000000000000000000000000000200000000003FFC30061C00C00000000080000000000000
+%0000000000000000000000000000000400
+%00080000000000000000000000000000000000000000000040000000380630070E00C000000000
+%004000000000000000000000000000020000000000300E30060C01C00000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400020003006300E0701C000000000
+%004000000000000000000000000000020000000000300E300E0E03800020000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400010003007301E07838000000000
+%0040000000000000000000000000000200000000006006301C0707800040000080000000000000
+%0000000000000000000000000000000400
+%0008000000000000000000000000000000000000000000004000000070033FF801FF0000000000
+%00400000000000000000000000000002000000000060073FF803FE000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400004006003BFE0007C0000000000
+%004000000000000000000000000000020000000000E0033FE000FC000100000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400002000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000200000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000800000000000000000000000
+%004000000000000000000000000000020000000000000000000000000800000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000400000000000000000000000
+%004000000000000000000000000000020000000000000000000000001000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000200000000000000000000000
+%004000000000000000000000000000020000000000000000000000002000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000100000000000000000000000
+%004000000000000000000000000000020000000000000000000000004000000080000000000000
+%0000000000000000000000000000000400
+%0008000000000003FF800000000003000000000000000000400000080000000000000000000000
+%00400000000000000000000000000002000000000000000000000000800000008000000000003F
+%F800000000003000000000000000000400
+%0008000000000003FFC00000000003000000000000000000400000040000000000000000000000
+%00400000000000000000000000000002000000000000000000000001000000008000000000003F
+%FC00000000003000000000000000000400
+%000800000000000300E00000000002000000000000000000400000020000000000000000000000
+%004000000000000000000000000000020000000000000000000000020000000080000000000038
+%0E00000000002000000000000000000400
+%000800000000000300600000000000000000000000000000400000018000000000000000000000
+%0040000000000000000000000000000200000000000000000000000C0000000080000000000030
+%0700000000000000000000000000000400
+%000800000000000300700000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000100000000080000000000030
+%0700000000000000000000000000000400
+%00080000000000030070FE03F03F0330187E000000000000400000002000000000000000000000
+%004000000000000000000000000000020000000000000000000000200000000080000000000030
+%0707E03F03F8338187F000000000000400
+%00080000000000030061EF073873833838E7000000000000400000001000000000000000000000
+%004000000000000000000000000000020000000000000000000000400000000080000000000030
+%070E7073873C31818E7800000000000400
+%000800000000000301E1830E1CE0C3183181800000000000400000000800000000000000000000
+%004000000000000000000000000000020000000000000000000000800000000080000000000038
+%1E1838E0CE0C31831C1800000000000400
+%0008000000000003FF83018C0CC0E3183181C00000000000400000000400000000000000000000
+%00400000000000000000000000000002000000000000000000000100000000008000000000003F
+%FC3018C0CC0631C3180C00000000000400
+%0008000000000003FE03019C01C0E30C6381C00000000000400000000200000000000000000000
+%00400000000000000000000000000002000000000000000000000200000000008000000000003F
+%F03018C00C0630C3181C00000000000400
+%00080000000000030703FF9C01FFE30C63FFC00000000000400000000100000000000000000000
+%004000000000000000000000000000020000000000000000000004000000000080000000000030
+%383FF8C00FFE30C61FFC00000000000400
+%00080000000000030383001C01C0030C6380000000000000400000000040000000000000000000
+%004000000000000000000000000000020000000000000000000010000000000080000000000030
+%183000C00C003066180000000000000400
+%000800000000000301C3001C01C00306C380000000000000400000000020000000000000000000
+%004000000000000000000000000000020000000000000000000020000000000080000000000030
+%1C3000C00C003066180000000000000400
+%000800000000000300E3018C0CC04306C181800000000000400000000000000000000000010000
+%004000000000000000000000000000020000040000000000000000000000000080000000000030
+%0E3818C0CC06306C180C00000000000400
+%000800000000000300E1838E1CE0C307C1C1800000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000030
+%071838E0CE0E303C1C1C00000000000400
+%00080000000000030071E7073873C30380E7800000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000030
+%071E707387BC30380F7800000000000400
+%00080000000000030030FE03F03F8303807F000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000030
+%0387E03F03F8303807F000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800FFC0000000000030000000000C0000000000000C00400000000000000000000000000000
+%0040000000000000000000000000000200000000000000000000000000000000800FFC00000000
+%00030000000000C0000000000000C00400
+%000800FFF000000000003000C000000C0000000000000C00400000000000000000000000000000
+%0040000000000000000000000000000200000000000000000000000000000000800FFF00000000
+%0003000C000000C0000000000000C00400
+%000800E07800000000003000C000000C0000000000000C00400000000000000000000000000000
+%0040000000000000000000000000000200000000000000000000000000000000800E0780000000
+%0003000C000000C0000000000000C00400
+%000800E01800000000003000C000000C0000000000000C00400000000000000000000000000000
+%0040000000000000000000000000000200000000000000000000000000000000800E01C0000000
+%0003000C000000C0000000000000C00400
+%000800E01C00000000003000C000000C0000000000000C00400000000000000000000000000000
+%0040000000000000000000000000000200000000000000000000000000000000800E00C0000000
+%0003000E000000C0000000000000C00400
+%000800E00C1FC38183FC37E3F0FC1FCDF03F81FE1FC7FC00400000000000000000000000010000
+%0040000000000000000000000000000200000400000000000000000000000000800E00C1FE1818
+%3FE37E1F0FC0FCDF01FC0FE1FC7EC00400
+%000800E00C39E381873C3CE0C1CE1FCF3879C3CF1F8E7C00400000000020000000000000000000
+%0040000000000000000000000000000200000000000000000000200000000000800E00E38E1818
+%73E3EF0C1CF0FCFB879E1CF1F8E7C00400
+%000800E00E7063818C1C3870C3031C0E1C60E3031C1C3C00400000000040000000000000000000
+%0040000000000000000000000000000200000000000000000000100000000000800E00E3071818
+%E1E3830C3030E0E1C6063831C1C1C00400
+%000800E00E0063818C0C3030C7031C0C0CC0600318181C00400000000100000000000000000000
+%0040000000000000000000000000000200000000000000000000040000000000800E00E0071818
+%C0E3030C3038C0C0CE070031C181C00400
+%000800E00E006381980C3030C7039C0C0CC0700718181C00400000000200000000000000000000
+%0040000000000000000000000000000200000000000000000000020000000000800E00E0071818
+%C0E3030C7038C0C0CC0300718180C00400
+%000800E00C1FE381980C3030C7FF9C0C0CC030FF18381C00400000000400000000000000000000
+%0040000000000000000000000000000200000000000000000000010000000000800E00E0FF1819
+%C0E3030C7FF8C0C0EC030FF18180C00400
+%000800E00C3E6381980C3030C7001C0C0CC033E318381C00400000000800000000000000000000
+%0040000000000000000000000000000200000000000000000000008000000000800E00E3E71819
+%C0E3030C7000C0C0EC031E318180C00400
+%000800E00C7063839C0C3030C6001C0C0CC0730318181C00400000001000000000000000000000
+%0040000000000000000000000000000200000000000000000000004000000000800E00C7071818
+%C0E3030C7000C0C0CC0330318180C00400
+%000800E01C6063838C0C3030C7031C0C0CE0670318181C00400000002000000000000000000000
+%0040000000000000000000000000000200000000000000000000002000000000800E01C6071838
+%C0E3030C3030C0C0CE0730318181C00400
+%000800E03860E1878C1C3030C3871C0E1860E707181C3C00400000008000000000000000000000
+%0040000000000000000000000000000200000000000000000000001800000000800E0386071838
+%E1E3030C3830C0E1C706307180C1C00400
+%000800FFF071E1FF877C3030F1CE1C0F3879C39F180E7C00400000010000000000000000000000
+%0040000000000000000000000000000200000000000000000000000400000000800FFF039F1FF8
+%73E3030F1EF0C0FB839E39F180F7C00400
+%000800FFE03F30F983EC303070FC1C0DF01F81FB1807FC00400000020000000000000000000000
+%0040000000000000000000000000000200000000000000000000000200000000800FFE03F30FD8
+%3FE303078FE0C0DF01F81FB9807EC00400
+%0008000000000000000C0000000000000000000000000000400000040000000000000000000000
+%004000000000000000000000000000020000000000000000000000010000000080000000000000
+%00E0000000000000000000000000000400
+%0008000000000000080C0000000000000000000000000000400000080000000000000000000000
+%004000000000000000000000000000020000000000000000000000008000000080000000000000
+%C0C0000000000000000000000000000400
+%00080000000000000C1C0000000000000000000000000000400000100000000000000000000000
+%004000000000000000000000000000020000000000000000000000004000000080000000000000
+%E1C0000000000000000000000000000400
+%000800000000000007F80000000000000000000000000000400000200000000000000000000000
+%004000000000000000000000000000020000000000000000000000002000000080000000000000
+%7F80000000000000000000000000000400
+%000800000000000003E00000000000000000000000000000400000C00000000000000000000000
+%004000000000000000000000000000020000000000000000000000001800000080000000000000
+%1E00000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%0008000000000000000000000000000000000000000000004000020001C03FF801FE0000000000
+%00400000000000000000000000000002000000000003C03FF801FE000200000080000000000000
+%0000000000000000000000000000000400
+%0008000000000000000000000000000000000000000000004000040001E03FFC03FF8000000000
+%00400000000000000000000000000002000000000003C03FFC03FF000100000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000360300E07018000000000
+%00400000000000000000000000000002000000000003E0301C0703800000000080000000000000
+%0000000000000000000000000000000400
+%00080000000000000000000000000000000000000000000040001000036030070E01C000000000
+%0040000000000000000000000000000200000000000660300E0E01800040000080000000000000
+%0000000000000000000000000000000400
+%00080000000000000000000000000000000000000000000040002000073030070C00C000000000
+%004000000000000000000000000000020000000000066030060C00800020000080000000000000
+%0000000000000000000000000000000400
+%00080000000000000000000000000000000000000000000040004000063030030C000000000000
+%004000000000000000000000000000020000000000067030071C00000010000080000000000000
+%0000000000000000000000000000000400
+%00080000000000000000000000000000000000000000000040010000063830031C000000000000
+%0040000000000000000000000000000200000000000C3030031800000000000080000000000000
+%0000000000000000000000000000000400
+%0008000000000000000000000000000000000000000000007FF800000E1830031C00000000FFFF
+%FFC0000000000000000000000000000200000000000C3830031800000001FFFF80000000000000
+%0000000000000000000000000000000400
+%0008000000000000000000000000000000000000000000007FF800000C1C30031C00000000FFFF
+%FFC0000000000000000000000000000200000800001C1830031800000001FFFF80000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400200000C1C30031C000000000000
+%00400000000000000000000000000003FFFFF800001C1830031800000002000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000001FFC30030C000000000000
+%0040000000000000000000000000000200000000001FFC30071C00000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000001FFE30070C00C000000000
+%0040000000000000000000000000000200000000003FFC30060C00C00000000080000000000000
+%0000000000000000000000000000000400
+%00080000000000000000000000000000000000000000000040000000380630070E00C000000000
+%004000000000000000000000000000020000000000300E30060C01C00000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400020003007300E0701C000000000
+%004000000000000000000000000000020000000000300E300E0E03800020000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000003007383C03C78000000000
+%0040000000000000000000000000000200000000006006303C0787000000000080000000000000
+%0000000000000000000000000000000400
+%0008000000000000000000000000000000000000000000004000000070033FF801FF0000000000
+%00400000000000000000000000000002000000000060073FF803FE000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400004006003BFE0007C0000000000
+%004000000000000000000000000000020000000000E0033FE000F8000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000800000000000000000000000
+%004000000000000000000000000000020000000000000000000000000800000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000400000000000000000000000
+%004000000000000000000000000000020000000000000000000000001000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000100000000000000000000000
+%004000000000000000000000000000020000000000000000000000004000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000080000000000000000000000
+%004000000000000000000000000000020000000000000000000000008000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000020000000000000000000000
+%004000000000000000000000000000020000000000000000000000020000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000018000000000000000000000
+%0040000000000000000000000000000200000000000000000000000C0000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000004000000000000000000000
+%004000000000000000000000000000020000000000000000000000100000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000002000000000000000000000
+%004000000000000000000000000000020000000000000000000000200000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000001000000000000000000000
+%004000000000000000000000000000020000000000000000000000400000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000800000000000000000000
+%004000000000000000000000000000020000000000000000000000800000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000400000000000000000000
+%004000000000000000000000000000020000000000000000000001000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000200000000000000000000
+%004000000000000000000000000000020000000000000000000002000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000080000000000000000000
+%004000000000000000000000000000020000000000000000000008000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000040000000000000000000
+%004000000000000000000000000000020000000000000000000010000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000020000000000000000000
+%004000000000000000000000000000020000000000000000000020000000000080000000000000
+%0000000000000000000000000000000400
+%00080000000000000000000000000000000000000000000040000000001FFFFFFFFFFFFFFF0000
+%00400000000000000000000000000002000007FFFFFFFFFFFFFFC0000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC00000000000000000000000000000
+%0040000000000000000000000000000200000000000000000000000000000000FFFFFFFFFFFFFF
+%FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC00
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0040000007FF9FF8007C001C000000020000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0040000007FF9FFE01FF801C000000020000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0040000007001C0F0383C03E000000020000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0040000006001C070700C036000000020000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0040000006001C030E00C036000000020000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0040000006001C030C000063000000020000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0040000006001C031C000063000000020000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0040000007001C071C0000E3800000020000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0040000007FF1FFE1C0FE0C1800000020000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0040000007FE1FFC1C0FE0C1800000020000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0040000006001C001C00E1FFC00000020000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0040000006001C000C0061FFC00000020000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0040000006001C000C006380E00000020000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0040000006001C000E006300600000020000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0040000006001C000781E300700000020000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0040000006001C0003FFC700700000020000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0040000006001C0000FF0600300000020000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC00000000000000000000000000000
+%00400000000000000000000000000002000000000000000000000000000000007FFFFFFFFFFFFF
+%FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC00
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%00080000000000000000000000000000000000000000000040000000001FFFFFFFFFFFFFFF0000
+%00400000000000000000000000000002000007FFFFFFFFFFFFFFC0000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000080000000000000000000
+%004000000000000000000000000000020000000000000000000008000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000002000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000008000000000000000000000
+%004000000000000000000000000000020000000000000000000000080000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000010000000000000000000000
+%004000000000000000000000000000020000000000000000000000040000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000040000000000000000000000
+%004000000000000000000000000000020000000000000000000000010000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000080000000000000000000000
+%004000000000000000000000000000020000000000000000000000008000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000200000000000000000000000
+%004000000000000000000000000000020000000000000000000000002000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000C00000000000000000000000
+%004000000000000000000000000000020000000000000000000000001800000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400001003FE00060007C0000000000
+%0040000000000000000000000000000200000000003FE000E00078000400000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400002003FF800F001FF0000000000
+%0040000000000000000000000000000200000000003FF800E001FE000200000080000000000000
+%0000000000000000000000000000000400
+%00080000000000000000000000000000000000000000000040000400383E00F003C78000000000
+%004000000000000000000000000000020000000000303C01E00787000100000080000000000000
+%0000000000000000000000000000000400
+%00080000000000000000000000000000000000000000000040000800380E01F80701C000000000
+%004000000000000000000000000000020000000000300E01B00E03800080000080000000000000
+%0000000000000000000000000000000400
+%00080000000000000000000000000000000000000000000040001000380701980E00C000000000
+%004000000000000000000000000000020000000000300601B00C01C00040000080000000000000
+%0000000000000000000000000000000400
+%00080000000000000000000000000000000000000000000040002000380301980C008000000000
+%004000000000000000000000000000020000000000300703181C00800020000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400080003803039C0C000000000000
+%004000000000000000000000000000020000000000300303181C00000008000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400100003803830C1C000000000000
+%0040000000000000000000000000000200000000003003071C1800000004000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000003803830C1C000000008000
+%0040000000000000000000000000000200000800003003060C1800000000000080000000000000
+%0000000000000000000000000000000400
+%0008000000000000000000000000000000000000000000007FFC0000380386061C00000000FFFF
+%FFC00000000000000000000000000003FFFFF800003003060C1800000001FFFF80000000000000
+%0000000000000000000000000000000400
+%00080000000000000000000000000000000000000000000040020000380387FE1C000000000000
+%00400000000000000000000000000002000000000030030FFE1800000002000080000000000000
+%0000000000000000000000000000000400
+%0008000000000000000000000000000000000000000000004000000038030FFF0C000000000000
+%00400000000000000000000000000002000000000030070FFE1C00000004000080000000000000
+%0000000000000000000000000000000400
+%0008000000000000000000000000000000000000000000004000C00038030C030C00C000000000
+%00400000000000000000000000000002000000000030061C070C00C00018000080000000000000
+%0000000000000000000000000000000400
+%0008000000000000000000000000000000000000000000004000000038070C030E01C000000000
+%004000000000000000000000000000020000000000300618030E01C00000000080000000000000
+%0000000000000000000000000000000400
+%00080000000000000000000000000000000000000000000040000000380E1C038701C000000000
+%004000000000000000000000000000020000000000300E18038703800000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400008003FFC180183FF8000000000
+%0040000000000000000000000000000200000000003FFC380387FF000080000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000003FF83801C1FE0000000000
+%0040000000000000000000000000000200000000003FF8300181FE000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400002000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000200000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400001000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000400000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000800000000000000000000000
+%004000000000000000000000000000020000000000000000000000000800000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000007FFE00000000000000000C100000000000400000000000000000000000000000
+%0040000000000000000000000000000200000000000000000000000000000000800000000003FF
+%E00000000000000000C100000000000400
+%000800000000003FFE00000000000000000C300000000000400000004000000000000000000000
+%0040000000000000000000000000000200000000000000000000001000000000800000000003FF
+%E00000000000000000C300000000000400
+%0008000000000001C0000000000000000000300000000000400000002000000000000000000000
+%00400000000000000000000000000002000000000000000000000020000000008000000000000C
+%0000000000000000000300000000000400
+%0008000000000001C0000000000000000000300000000000400000000000000000000000000000
+%00400000000000000000000000000002000000000000000000000000000000008000000000000C
+%0000000000000000000300000000000400
+%0008000000000001C0670F833C03C19E1C0CFC0000000000400000000800000000000000000000
+%00400000000000000000000000000002000000000000000000000000000000008000000000000C
+%0270F811C03C09E1C0CFC0000000000400
+%0008000000000001C07F3FE3FF0FE1FF7F0CFC0000000000400000000400000000000000000000
+%00400000000000000000000000000002000000000000000000000100000000008000000000000C
+%07F1FE1FF0FF1FF3F0CFC0000000000400
+%0008000000000001C07A30E3C31C31E3C70C300000000000400000000100000000000000000000
+%00400000000000000000000000000002000000000000000000000400000000008000000000000C
+%0783061C38C31E3E30C300000000000400
+%0008000000000001C0707063839831C1830C300000000000400000000080000000000000000000
+%00400000000000000000000000000002000000000000000000000800000000008000000000000C
+%0703071819C11C1C38C300000000000400
+%0008000000000001C0700063819C01C1830C300000000000400000000040000000000000000000
+%00400000000000000000000000000002000000000000000000001000000000008000000000000C
+%0700071819C01C1818C300000000000400
+%0008000000000001C06003E3818F8181830C300000000000400000000000000000000000000000
+%00400000000000000000000000000002000000000000000000000000000000008000000000000C
+%07001F1818F81C1818C300000000000400
+%0008000000000001C0603FE38187F181830C30000000000040000000001FFFFFFFFFFFFFFF0000
+%00400000000000000000000000000002000007FFFFFFFFFFFFFFC000000000008000000000000C
+%0701FF18187F1C1818C300000000000400
+%0008000000000001C06078638180F181830C300000000000400000000000000000000000000000
+%00400000000000000000000000000002000000000000000000000000000000008000000000000C
+%0703C718180F9C1818C300000000000400
+%0008000000000001C060606381803981830C300000000000400000000000000000000000000000
+%00400000000000000000000000000002000000000000000000000000000000008000000000000C
+%0707071818019C1818C300000000000400
+%0008000000000001C060606381981981830C300000000000400000000000000000000000000000
+%00400000000000000000000000000002000000000000000000000000000000008000000000000C
+%0706071819819C1818C300000000000400
+%0008000000000001C06060E3819C3981830C300000000000400000000000000000000000000000
+%00400000000000000000000000000002000000000000000000000000000000008000000000000C
+%07070F1819C39C1818C300000000000400
+%0008000000000001C0607FE3818FF181830C3C0000000000400000000000000000000000000000
+%00400000000000000000000000000002000000000000000000000000000000008000000000000C
+%0703FF1818FF1C1818C3C0000000000400
+%0008000000000001C0601E338187C181830C1C0000000000400000000000000000000000000000
+%00400000000000000000000000000002000000000000000000000000000000008000000000000C
+%0701F318183E1C1818C1C0000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800FFE0000000000030004000000C0000000000000C00400000000000000000000000000000
+%0040000000000000000000000000000200000000000000000000000000000000800FFE00000000
+%00030004000000C0000000000000C00400
+%000800FFF000000000003000C000000C0000000000000C00400000000000000000000000000000
+%0040000000000000000000000000000200000000000000000000000000000000800FFF00000000
+%0003000C000000C0000000000000C00400
+%000800E03800000000003000C000000C0000000000000C00400000000000000000000000000000
+%0040000000000000000000000000000200000000000000000000000000000000800E0380000000
+%0003000C000000C0000000000000C00400
+%000800E01C00000000003000C000000C0000000000000C00400000000000000000000000000000
+%0040000000000000000000000000000200000000000000000000000000000000800E01C0000000
+%0003000C000000C0000000000000C00400
+%000800E00C0F838181EC33C3F07819CCE00F007C1B83CC0040000000001FFFFFFFFFFFFFFF0000
+%00400000000000000000000000000002000007FFFFFFFFFFFFFFC00000000000800E00C0F81818
+%1E633C1F0780DCCE00F007C1BC3CC00400
+%000800E00C3FE38187FC3FE3F1FE1FCFF83FC1FE1F8FFC00400000000000000000000000000000
+%0040000000000000000000000000000200000000000000000000000000000000800E00E1FE1818
+%7FE3FE1F1FE0FCFF83FC1FE1FC7FC00400
+%000800E00E30E3818E1C3870C3871E0E1870E3871E9C3C00400000000040000000000000000000
+%0040000000000000000000000000000200000000000000000000100000000000800E00E3061818
+%61E3870C3870E0F1C70E3871E0C3C00400
+%000800E00E7063818C0C3030C3031C0E1CE063031C181C00400000000080000000000000000000
+%0040000000000000000000000000000200000000000000000000080000000000800E00E3071818
+%C0E3030C3030C0E0C6063031C1C1C00400
+%000800E00E0063819C0C3030C6031C0C0CC0700318181C00400000000000000000000000000000
+%0040000000000000000000000000000200000000000000000000000000000000800E00E0071818
+%C0E3030C3038C0C0CC0300318181C00400
+%000800E00E03E381980C3030C7FF9C0C0CC0303F18381C00400000000400000000000000000000
+%0040000000000000000000000000000200000000000000000000010000000000800E00E03F1819
+%C0E3030C7FF8C0C0EC0301F18180C00400
+%000800E00C3FE381980C3030C7FF9C0C0CC031FF18381C00400000000000000000000000000000
+%0040000000000000000000000000000200000000000000000000000000000000800E00E1FF1819
+%C0E3030C7FF8C0C0EC031FF18180C00400
+%000800E00C786383980C3030C6001C0C0CC033C318381C00400000000000000000000000000000
+%0040000000000000000000000000000200000000000000000000000000000000800E00C3871819
+%C0E3030C7000C0C0EC033C318180C00400
+%000800E01C6063839C0C3030C7001C0C0CC0770318181C00400000002000000000000000000000
+%0040000000000000000000000000000200000000000000000000002000000000800E00C7071818
+%C0E3030C7000C0C0CC0330318180C00400
+%000800E0186063838C0C3030C3031C0C1CE0670718181C00400000004000000000000000000000
+%0040000000000000000000000000000200000000000000000000000000000000800E01C6071838
+%C0E3030C3038C0E0C606303181C1C00400
+%000800E07870E1878E1C3030C3871C0E1870E70F180C3C00400000008000000000000000000000
+%0040000000000000000000000000000200000000000000000000000800000000800E07870F1C78
+%E1E3030C3870C0E1C70E307180C3C00400
+%000800FFF03FF1FD87FC3030F1FE1C0FF03FC3FF180FFC00400000000000000000000000000000
+%0040000000000000000000000000000200000000000000000000000000000000800FFF03FF0FD8
+%7FE3030F1FE0C0FF83FC3FF1807FC00400
+%000800FFC01E307981EC303070781C0DE01F01F39803CC00400000000000000000000000000000
+%0040000000000000000000000000000200000000000000000000000000000000800FFC01F30798
+%1EE3030787C0C0CE00F00F19803CC00400
+%0008000000000000000C0000000000000000000000000000400000040000000000000000000000
+%004000000000000000000000000000020000000000000000000000010000000080000000000000
+%00C0000000000000000000000000000400
+%00080000000000000C0C0000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%C0C0000000000000000000000000000400
+%00080000000000000E380000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%F3C0000000000000000000000000000400
+%000800000000000007F00000000000000000000000000000400000200000000000000000000000
+%004000000000000000000000000000020000000000000000000000002000000080000000000000
+%7F80000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400001003FF00060007C0000000000
+%0040000000000000000000000000000200000000003FE000E000FC000400000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400002003FFC00F001FF0000000000
+%0040000000000000000000000000000200000000003FF800E003FE000200000080000000000000
+%0000000000000000000000000000000400
+%00080000000000000000000000000000000000000000000040000000381E00F003838000000000
+%004000000000000000000000000000020000000000301C01F00787800000000080000000000000
+%0000000000000000000000000000000400
+%00080000000000000000000000000000000000000000000040000800380601F80701C000000000
+%004000000000000000000000000000020000000000300E01B00E03800080000080000000000000
+%0000000000000000000000000000000400
+%00080000000000000000000000000000000000000000000040001000380701980E00C000000000
+%004000000000000000000000000000020000000000300603B00C01C00040000080000000000000
+%0000000000000000000000000000000400
+%00080000000000000000000000000000000000000000000040004000380301980C000000000000
+%004000000000000000000000000000020000000000300703181C00000010000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400080003803031C0C000000000000
+%004000000000000000000000000000020000000000300303181800000008000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400100003803830C1C000000000000
+%0040000000000000000000000000000200000000003003071C1800000004000080000000000000
+%0000000000000000000000000000000400
+%0008000000000000000000000000000000000000000000007FFA00003803870E1C00000000FFFF
+%FFC00000000000000000000000000003FFFFF800003003060C1800000003FFFF80000000000000
+%0000000000000000000000000000000400
+%0008000000000000000000000000000000000000000000007FFC0000380386061C00000000FFFF
+%FFC00000000000000000000000000003FFFFF800003003060C1800000001FFFF80000000000000
+%0000000000000000000000000000000400
+%00080000000000000000000000000000000000000000000040020000380307FE0C000000000000
+%00400000000000000000000000000002000000000030030FFE1800000002000080000000000000
+%0000000000000000000000000000000400
+%0008000000000000000000000000000000000000000000004001000038030FFF0C00C000000000
+%00400000000000000000000000000002000000000030070FFE1C00800004000080000000000000
+%0000000000000000000000000000000400
+%0008000000000000000000000000000000000000000000004000C00038030C030C00C000000000
+%00400000000000000000000000000002000000000030061C070C01C00018000080000000000000
+%0000000000000000000000000000000400
+%0008000000000000000000000000000000000000000000004000000038070C038601C000000000
+%004000000000000000000000000000020000000000300E18030E01800000000080000000000000
+%0000000000000000000000000000000400
+%00080000000000000000000000000000000000000000000040001000380E1C0387038000000000
+%004000000000000000000000000000020000000000301E18038703800040000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400008003FFC180183FF8000000000
+%0040000000000000000000000000000200000000003FFC380387FF000080000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000003FF83801C1FE0000000000
+%0040000000000000000000000000000200000000003FF0300181FE000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400002000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000200000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400001000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000400000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000800000000000000000000000
+%004000000000000000000000000000020000000000000000000000000800000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000200000000000000000000000
+%004000000000000000000000000000020000000000000000000000002000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000040000000000000000000000
+%004000000000000000000000000000020000000000000000000000010000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000100000000000000000000
+%004000000000000000000000000000020000000000000000000004000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000080000000000000000000
+%004000000000000000000000000000020000000000000000000008000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000040000000000000000000
+%004000000000000000000000000000020000000000000000000010000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%00080000000000000000000000000000000000000000000040000000001FFFFFFFFFFFFFFF0000
+%00400000000000000000000000000002000007FFFFFFFFFFFFFFC0000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000800000000000000000000000000000000000000000000400000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000080000000000000
+%0000000000000000000000000000000400
+%000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC00000000000000000000000000000
+%00400000000000000000000000000002000000000000000000000000000000007FFFFFFFFFFFFF
+%FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC00
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%004000000000000000000000000000020000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%007FFFFFFFFFFFFFFFFFFFFFFFFFFFFE0000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%000000000000000000000000000000000000000000000000000000000000000000000000000000
+%0000000000000000000000000000000000
+%%EndPreview
+%%BeginProlog
+%%BeginResource: SDRes
+/b4_inc_state save def
+/dict_count countdictstack def
+/op_count count 1 sub def
+userdict begin
+0 setgray 0 setlinecap 1 setlinewidth 0 setlinejoin 10 setmiterlimit[] 0 setdash newpath
+/languagelevel where {pop languagelevel 1 ne {false setstrokeadjust false setoverprint} if} if
+/bdef {bind def} bind def
+/c {setgray} bdef
+/l {neg lineto} bdef
+/rl {neg rlineto} bdef
+/lc {setlinecap} bdef
+/lj {setlinejoin} bdef
+/lw {setlinewidth} bdef
+/ml {setmiterlimit} bdef
+/ld {setdash} bdef
+/m {neg moveto} bdef
+/ct {6 2 roll neg 6 2 roll neg 6 2 roll neg curveto} bdef
+/r {rotate} bdef
+/t {neg translate} bdef
+/s {scale} bdef
+/sw {show} bdef
+/gs {gsave} bdef
+/gr {grestore} bdef
+/f {findfont dup length dict begin
+{1 index /FID ne {def} {pop pop} ifelse} forall /Encoding ISOLatin1Encoding def
+currentdict end /NFont exch definefont pop /NFont findfont} bdef
+/p {closepath} bdef
+/sf {scalefont setfont} bdef
+/ef {eofill}bdef
+/pc {closepath stroke}bdef
+/ps {stroke}bdef
+/pum {matrix currentmatrix}bdef
+/pom {setmatrix}bdef
+/bs {/aString exch def /nXOfs exch def /nWidth exch def currentpoint nXOfs 0 rmoveto pum nWidth aString stringwidth pop div 1 scale aString show pom moveto} bdef
+%%EndResource
+%%EndProlog
+%%BeginSetup
+%%EndSetup
+%%Page: 1 1
+%%BeginPageSetup
+%%EndPageSetup
+pum
+0.02834 0.02833 s
+0 -20290 t
+/tm matrix currentmatrix def
+gs
+tm setmatrix
+-635 -635 t
+1 1 s
+635 635 m 27274 635 l 27274 20924 l 635 20924 l 635 635 l eoclip newpath
+0.996 c 7835 7938 m 8893 6985 l 11010 6985 l 11010 8890 l 8893 8890 l
+7835 7938 l p ef
+0 lw 1 lj 0.000 c 7835 7938 m 8893 6985 l 11010 6985 l 11010 8890 l 8893 8890 l
+7835 7938 l pc
+gs
+pum
+8520 8228 t
+-1 0 m 231 -605 l 317 -605 l 565 0 l 474 0 l 403 -183 l 150 -183 l
+83 0 l p
+173 -248 m 378 -248 l 315 -416 l 296 -467 282 -509 272 -541 ct 264 -503 254 -464 240 -426 ct
+p ef
+621 0 m 621 -605 l 829 -605 l 876 -605 912 -602 937 -596 ct 972 -588 1001 -574 1026 -553 ct
+1058 -526 1082 -492 1098 -450 ct 1114 -408 1121 -360 1121 -306 ct 1121 -260 1116 -219 1105 -183 ct
+1095 -148 1081 -118 1064 -95 ct 1047 -72 1029 -54 1009 -40 ct 989 -27 965 -17 937 -10 ct
+908 -3 876 0 839 0 ct p
+701 -71 m 830 -71 l 870 -71 901 -75 924 -82 ct 947 -90 965 -100 979 -114 ct
+998 -133 1012 -158 1023 -190 ct 1034 -222 1039 -261 1039 -307 ct 1039 -370 1028 -419 1008 -453 ct
+987 -487 962 -510 932 -521 ct 910 -530 876 -534 828 -534 ct 701 -534 l p ef
+1661 -212 m 1741 -192 l 1724 -126 1694 -76 1650 -41 ct 1607 -6 1553 10 1490 10 ct
+1425 10 1372 -2 1331 -29 ct 1290 -56 1259 -94 1238 -145 ct 1216 -195 1206 -249 1206 -307 ct
+1206 -370 1218 -425 1242 -472 ct 1266 -519 1300 -554 1345 -579 ct 1389 -603 1438 -615 1491 -615 ct
+1552 -615 1603 -600 1644 -569 ct 1686 -538 1714 -495 1731 -439 ct 1652 -420 l
+1638 -465 1617 -497 1591 -517 ct 1564 -537 1530 -547 1490 -547 ct 1443 -547 1404 -536 1373 -513 ct
+1342 -491 1320 -461 1307 -424 ct 1295 -386 1288 -347 1288 -307 ct 1288 -256 1296 -211 1311 -172 ct
+1326 -134 1349 -105 1381 -86 ct 1412 -67 1447 -58 1484 -58 ct 1529 -58 1567 -71 1598 -97 ct
+1629 -122 l 1650 -161 l p ef
+pom
+gr
+13955 5080 m 11733 5080 l 11733 1270 l 16178 1270 l 16178 5080 l 13955 5080 l
+pc
+gs
+pum
+13176 2513 t
+69 0 m 69 -605 l 477 -605 l 477 -534 l 149 -534 l 149 -346 l 433 -346 l
+433 -275 l 149 -275 l 149 0 l p ef
+532 0 m 766 -315 l 560 -605 l 655 -605 l 765 -450 l 788 -418 804 -393 814 -375 ct
+827 -397 843 -420 862 -444 ct 984 -605 l 1071 -605 l 858 -320 l 1087 0 l
+988 0 l 836 -216 l 827 -228 818 -241 809 -256 ct 796 -234 786 -219 780 -211 ct
+628 0 l p ef
+1510 -71 m 1510 0 l 1110 0 l 1110 -17 1112 -35 1119 -51 ct 1129 -78 1145 -105 1168 -132 ct
+1190 -158 1223 -189 1265 -223 ct 1331 -277 1375 -320 1398 -352 ct 1422 -383 1433 -413 1433 -441 ct
+1433 -471 1423 -495 1402 -516 ct 1380 -536 1353 -546 1319 -546 ct 1283 -546 1255 -535 1233 -514 ct
+1212 -492 1201 -463 1201 -425 ct 1124 -432 l 1129 -489 1149 -533 1183 -563 ct
+1217 -593 1263 -608 1321 -608 ct 1379 -608 1425 -591 1459 -559 ct 1493 -527 1510 -487 1510 -439 ct
+1510 -415 1505 -391 1495 -368 ct 1485 -345 1468 -320 1445 -294 ct 1422 -268 1384 -233 1331 -187 ct
+1286 -150 1257 -125 1245 -111 ct 1232 -98 1222 -84 1213 -71 ct p ef
+pom
+pum
+12713 3466 t
+462 -605 m 542 -605 l 542 -255 l 542 -194 535 -146 522 -110 ct 508 -74 483 -45 447 -23 ct
+411 0 364 10 306 10 ct 249 10 202 0 166 -19 ct 130 -38 105 -66 89 -103 ct 74 -140 66 -191 66 -255 ct
+66 -605 l 146 -605 l 146 -256 l 146 -203 151 -164 161 -139 ct 171 -114 187 -95 211 -82 ct
+235 -68 264 -61 299 -61 ct 358 -61 400 -75 425 -102 ct 450 -128 462 -180 462 -256 ct
+p ef
+673 -194 m 748 -201 l 752 -170 760 -146 773 -126 ct 786 -107 806 -91 834 -79 ct
+862 -67 893 -61 927 -61 ct 958 -61 985 -66 1008 -75 ct 1031 -84 1049 -96 1060 -112 ct
+1072 -128 1077 -145 1077 -164 ct 1077 -183 1072 -200 1061 -214 ct 1050 -228 1032 -240 1006 -249 ct
+990 -256 954 -266 898 -279 ct 843 -292 804 -305 782 -317 ct 753 -332 731 -351 717 -373 ct
+703 -396 696 -421 696 -449 ct 696 -479 704 -508 722 -534 ct 739 -561 764 -581 798 -595 ct
+831 -609 868 -615 909 -615 ct 954 -615 993 -608 1028 -594 ct 1062 -579 1088 -558 1107 -530 ct
+1125 -502 1135 -470 1136 -434 ct 1060 -429 l 1055 -467 1041 -496 1018 -515 ct
+994 -535 959 -545 912 -545 ct 864 -545 828 -536 806 -518 ct 784 -500 773 -479 773 -454 ct
+773 -432 781 -414 796 -400 ct 812 -386 852 -372 917 -357 ct 982 -342 1027 -329 1051 -318 ct
+1087 -302 1113 -282 1129 -257 ct 1146 -232 1155 -203 1155 -171 ct 1155 -138 1145 -108 1127 -79 ct
+1108 -51 1082 -29 1047 -13 ct 1013 2 974 10 931 10 ct 876 10 830 2 793 -13 ct 756 -29 727 -53 706 -85 ct
+685 -117 l 674 -154 l p ef
+1278 0 m 1278 -605 l 1506 -605 l 1552 -605 1589 -599 1617 -587 ct 1645 -574 1667 -556 1683 -530 ct
+1699 -505 1706 -478 1706 -450 ct 1706 -424 1699 -400 1685 -377 ct 1671 -354 1650 -336 1622 -322 ct
+1658 -311 1687 -293 1706 -267 ct 1726 -241 1736 -210 1736 -175 ct 1736 -147 1730 -120 1718 -96 ct
+1706 -72 1691 -53 1673 -40 ct 1656 -26 1634 -16 1607 -10 ct 1580 -3 1548 0 1509 0 ct
+p
+1359 -351 m 1490 -351 l 1525 -351 1551 -353 1566 -358 ct 1586 -364 1602 -374 1612 -388 ct
+1622 -402 1628 -419 1628 -441 ct 1628 -461 1623 -478 1613 -494 ct 1603 -509 1590 -520 1572 -525 ct
+1554 -531 1523 -534 1480 -534 ct 1359 -534 l p
+1359 -71 m 1509 -71 l 1535 -71 1553 -72 1564 -74 ct 1582 -77 1598 -83 1610 -90 ct
+1623 -98 1633 -109 1641 -124 ct 1649 -139 1653 -156 1653 -175 ct 1653 -198 1647 -217 1635 -234 ct
+1624 -251 1608 -262 1587 -269 ct 1567 -276 1537 -279 1499 -279 ct 1359 -279 l
+p ef
+2436 -71 m 2436 0 l 2036 0 l 2036 -17 2038 -35 2045 -51 ct 2055 -78 2071 -105 2094 -132 ct
+2116 -158 2149 -189 2191 -223 ct 2257 -277 2301 -320 2324 -352 ct 2348 -383 2359 -413 2359 -441 ct
+2359 -471 2349 -495 2328 -516 ct 2306 -536 2279 -546 2245 -546 ct 2209 -546 2181 -535 2159 -514 ct
+2138 -492 2127 -463 2127 -425 ct 2050 -432 l 2055 -489 2075 -533 2109 -563 ct
+2143 -593 2189 -608 2247 -608 ct 2305 -608 2351 -591 2385 -559 ct 2419 -527 2436 -487 2436 -439 ct
+2436 -415 2431 -391 2421 -368 ct 2411 -345 2394 -320 2371 -294 ct 2348 -268 2310 -233 2257 -187 ct
+2212 -150 2183 -125 2171 -111 ct 2158 -98 2148 -84 2139 -71 ct p ef
+pom
+pum
+12091 4419 t
+497 -212 m 577 -192 l 560 -126 530 -76 486 -41 ct 443 -6 389 10 326 10 ct
+261 10 208 -2 167 -29 ct 126 -56 95 -94 74 -145 ct 52 -195 42 -249 42 -307 ct 42 -370 54 -425 78 -472 ct
+102 -519 136 -554 181 -579 ct 225 -603 274 -615 327 -615 ct 388 -615 439 -600 480 -569 ct
+522 -538 550 -495 567 -439 ct 488 -420 l 474 -465 453 -497 427 -517 ct 400 -537 366 -547 326 -547 ct
+279 -547 240 -536 209 -513 ct 178 -491 156 -461 143 -424 ct 131 -386 124 -347 124 -307 ct
+124 -256 132 -211 147 -172 ct 162 -134 185 -105 217 -86 ct 248 -67 283 -58 320 -58 ct
+365 -58 403 -71 434 -97 ct 465 -122 l 486 -161 l p ef
+663 -219 m 663 -300 685 -360 730 -399 ct 768 -432 814 -448 868 -448 ct 929 -448 978 -428 1016 -389 ct
+1054 -349 1074 -295 1074 -225 ct 1074 -169 1065 -124 1048 -92 ct 1031 -59 1007 -34 974 -16 ct
+942 0 907 9 868 9 ct 807 9 757 -9 719 -49 ct 682 -88 l 663 -145 l p
+739 -219 m 739 -163 751 -121 776 -93 ct 800 -65 831 -51 868 -51 ct 905 -51 936 -65 960 -93 ct
+985 -121 997 -164 997 -221 ct 997 -276 985 -317 960 -345 ct 936 -373 905 -387 868 -387 ct
+831 -387 800 -373 776 -345 ct 751 -317 l 739 -275 l p ef
+1166 0 m 1166 -438 l 1233 -438 l 1233 -376 l 1265 -424 1312 -448 1373 -448 ct
+1399 -448 1424 -443 1446 -434 ct 1468 -424 1484 -412 1495 -396 ct 1507 -381 1514 -363 1519 -342 ct
+1521 -328 1523 -304 1523 -269 ct 1523 0 l 1448 0 l 1448 -266 l 1448 -297 1446 -319 1440 -334 ct
+1434 -349 1424 -361 1409 -370 ct 1394 -379 1377 -384 1357 -384 ct 1325 -384 1298 -374 1275 -354 ct
+1252 -333 1241 -295 1241 -239 ct 1241 0 l p ef
+1806 -66 m 1816 0 l 1795 3 1777 5 1760 5 ct 1733 5 1712 1 1697 -7 ct 1683 -15 1672 -26 1666 -40 ct
+1660 -54 1657 -83 1657 -128 ct 1657 -380 l 1602 -380 l 1602 -438 l 1657 -438 l
+1657 -547 l 1731 -591 l 1731 -438 l 1806 -438 l 1806 -380 l 1731 -380 l
+1731 -124 l 1731 -103 1732 -89 1735 -83 ct 1737 -77 1742 -72 1748 -68 ct 1753 -65 1762 -63 1773 -63 ct
+1781 -63 l 1792 -64 l p ef
+1880 0 m 1880 -438 l 1947 -438 l 1947 -372 l 1964 -403 1980 -423 1995 -433 ct
+2009 -443 2025 -448 2042 -448 ct 2067 -448 2093 -440 2119 -424 ct 2093 -355 l
+2075 -366 2057 -371 2039 -371 ct 2022 -371 2008 -366 1995 -357 ct 1982 -347 1973 -333 1967 -316 ct
+1959 -289 1955 -261 1955 -229 ct 1955 0 l p ef
+2145 -219 m 2145 -300 2167 -360 2212 -399 ct 2250 -432 2296 -448 2350 -448 ct
+2411 -448 2460 -428 2498 -389 ct 2536 -349 2556 -295 2556 -225 ct 2556 -169 2547 -124 2530 -92 ct
+2513 -59 2489 -34 2456 -16 ct 2424 0 2389 9 2350 9 ct 2289 9 2239 -9 2201 -49 ct
+2164 -88 l 2145 -145 l p
+2221 -219 m 2221 -163 2233 -121 2258 -93 ct 2282 -65 2313 -51 2350 -51 ct 2387 -51 2418 -65 2442 -93 ct
+2467 -121 2479 -164 2479 -221 ct 2479 -276 2467 -317 2442 -345 ct 2418 -373 2387 -387 2350 -387 ct
+2313 -387 2282 -373 2258 -345 ct 2233 -317 l 2221 -275 l p ef
+2647 0 m 2647 -605 l 2721 -605 l 2721 0 l p ef
+2832 0 m 2832 -605 l 2906 -605 l 2906 0 l p ef
+3319 -141 m 3395 -131 l 3383 -86 3361 -52 3328 -27 ct 3295 -2 3253 9 3203 9 ct
+3138 9 3087 -9 3050 -49 ct 3012 -88 2993 -144 2993 -215 ct 2993 -289 3012 -346 3050 -387 ct
+3089 -428 3138 -448 3198 -448 ct 3257 -448 3305 -428 3342 -388 ct 3379 -348 3398 -292 3398 -220 ct
+3398 -215 3398 -209 3397 -200 ct 3070 -200 l 3073 -152 3087 -115 3111 -89 ct
+3136 -64 3166 -51 3203 -51 ct 3230 -51 3253 -58 3273 -72 ct 3292 -87 l 3307 -109 l
+p
+3074 -261 m 3319 -261 l 3316 -298 3307 -326 3291 -344 ct 3268 -373 3237 -387 3199 -387 ct
+3165 -387 3136 -376 3113 -353 ct 3090 -330 l 3077 -299 l p ef
+3494 0 m 3494 -438 l 3561 -438 l 3561 -372 l 3578 -403 3594 -423 3609 -433 ct
+3623 -443 3639 -448 3656 -448 ct 3681 -448 3707 -440 3733 -424 ct 3707 -355 l
+3689 -366 3671 -371 3653 -371 ct 3636 -371 3622 -366 3609 -357 ct 3596 -347 3587 -333 3581 -316 ct
+3573 -289 3569 -261 3569 -229 ct 3569 0 l p ef
+pom
+gr
+13956 19115 m 11900 19115 l 11900 6350 l 16013 6350 l 16013 19115 l
+13956 19115 l pc
+gs
+pum
+12806 13017 t
+69 0 m 69 -605 l 477 -605 l 477 -534 l 149 -534 l 149 -346 l 433 -346 l
+433 -275 l 149 -275 l 149 0 l p ef
+594 0 m 594 -605 l 822 -605 l 862 -605 893 -603 914 -599 ct 944 -594 969 -585 989 -571 ct
+1009 -557 1025 -538 1038 -513 ct 1050 -488 1056 -460 1056 -430 ct 1056 -378 1040 -335 1007 -299 ct
+974 -264 915 -246 829 -246 ct 674 -246 l 674 0 l p
+674 -317 m 830 -317 l 882 -317 919 -327 941 -346 ct 963 -365 973 -392 973 -427 ct
+973 -453 967 -474 954 -493 ct 941 -511 925 -522 904 -528 ct 890 -532 865 -534 829 -534 ct
+674 -534 l p ef
+1433 -237 m 1433 -308 l 1690 -308 l 1690 -84 l 1650 -52 1610 -29 1568 -13 ct
+1526 2 1483 10 1439 10 ct 1379 10 1325 -2 1277 -27 ct 1228 -53 1191 -90 1167 -138 ct
+1142 -186 1130 -240 1130 -299 ct 1130 -358 1142 -413 1167 -464 ct 1191 -516 1227 -553 1273 -578 ct
+1319 -603 1372 -615 1433 -615 ct 1477 -615 1516 -608 1551 -594 ct 1587 -580 1615 -560 1635 -535 ct
+1655 -510 1670 -476 1681 -436 ct 1608 -416 l 1599 -447 1588 -471 1574 -489 ct
+1561 -506 1542 -520 1517 -531 ct 1492 -542 1464 -547 1433 -547 ct 1397 -547 1365 -541 1338 -530 ct
+1311 -519 1290 -504 1273 -486 ct 1257 -468 1244 -448 1235 -426 ct 1220 -389 1212 -348 1212 -304 ct
+1212 -250 1221 -205 1240 -169 ct 1259 -133 1286 -106 1321 -88 ct 1357 -70 1394 -61 1434 -61 ct
+1469 -61 1503 -68 1536 -82 ct 1569 -95 1594 -109 1611 -124 ct 1611 -237 l p ef
+1745 0 m 1977 -605 l 2063 -605 l 2311 0 l 2220 0 l 2149 -183 l 1896 -183 l
+1829 0 l p
+1919 -248 m 2124 -248 l 2061 -416 l 2042 -467 2028 -509 2018 -541 ct 2010 -503 2000 -464 1986 -426 ct
+p ef
+pom
+gr
+0.996 c 7835 17258 m 8893 16305 l 11010 16305 l 11010 18210 l 8893 18210 l
+7835 17258 l p ef
+0.000 c 7835 17258 m 8893 16305 l 11010 16305 l 11010 18210 l 8893 18210 l
+7835 17258 l pc
+gs
+pum
+8520 17542 t
+65 0 m 65 -605 l 273 -605 l 320 -605 356 -602 381 -596 ct 416 -588 445 -574 470 -553 ct
+502 -526 526 -492 542 -450 ct 558 -408 565 -360 565 -306 ct 565 -260 560 -219 549 -183 ct
+539 -148 525 -118 508 -95 ct 491 -72 473 -54 453 -40 ct 433 -27 409 -17 381 -10 ct
+352 -3 320 0 283 0 ct p
+145 -71 m 274 -71 l 314 -71 345 -75 368 -82 ct 391 -90 409 -100 423 -114 ct
+442 -133 456 -158 467 -190 ct 478 -222 483 -261 483 -307 ct 483 -370 472 -419 452 -453 ct
+431 -487 406 -510 376 -521 ct 354 -530 320 -534 272 -534 ct 145 -534 l p ef
+608 0 m 840 -605 l 926 -605 l 1174 0 l 1083 0 l 1012 -183 l 759 -183 l
+692 0 l p
+782 -248 m 987 -248 l 924 -416 l 905 -467 891 -509 881 -541 ct 873 -503 863 -464 849 -426 ct
+p ef
+1661 -212 m 1741 -192 l 1724 -126 1694 -76 1650 -41 ct 1607 -6 1553 10 1490 10 ct
+1425 10 1372 -2 1331 -29 ct 1290 -56 1259 -94 1238 -145 ct 1216 -195 1206 -249 1206 -307 ct
+1206 -370 1218 -425 1242 -472 ct 1266 -519 1300 -554 1345 -579 ct 1389 -603 1438 -615 1491 -615 ct
+1552 -615 1603 -600 1644 -569 ct 1686 -538 1714 -495 1731 -439 ct 1652 -420 l
+1638 -465 1617 -497 1591 -517 ct 1564 -537 1530 -547 1490 -547 ct 1443 -547 1404 -536 1373 -513 ct
+1342 -491 1320 -461 1307 -424 ct 1295 -386 1288 -347 1288 -307 ct 1288 -256 1296 -211 1311 -172 ct
+1326 -134 1349 -105 1381 -86 ct 1412 -67 1447 -58 1484 -58 ct 1529 -58 1567 -71 1598 -97 ct
+1629 -122 l 1650 -161 l p ef
+pom
+gr
+0.996 c 7835 10478 m 8893 9525 l 11010 9525 l 11010 11430 l 8893 11430 l
+7835 10478 l p ef
+0.000 c 7835 10478 m 8893 9525 l 11010 9525 l 11010 11430 l 8893 11430 l
+7835 10478 l pc
+gs
+pum
+8520 10768 t
+-1 0 m 231 -605 l 317 -605 l 565 0 l 474 0 l 403 -183 l 150 -183 l
+83 0 l p
+173 -248 m 378 -248 l 315 -416 l 296 -467 282 -509 272 -541 ct 264 -503 254 -464 240 -426 ct
+p ef
+621 0 m 621 -605 l 829 -605 l 876 -605 912 -602 937 -596 ct 972 -588 1001 -574 1026 -553 ct
+1058 -526 1082 -492 1098 -450 ct 1114 -408 1121 -360 1121 -306 ct 1121 -260 1116 -219 1105 -183 ct
+1095 -148 1081 -118 1064 -95 ct 1047 -72 1029 -54 1009 -40 ct 989 -27 965 -17 937 -10 ct
+908 -3 876 0 839 0 ct p
+701 -71 m 830 -71 l 870 -71 901 -75 924 -82 ct 947 -90 965 -100 979 -114 ct
+998 -133 1012 -158 1023 -190 ct 1034 -222 1039 -261 1039 -307 ct 1039 -370 1028 -419 1008 -453 ct
+987 -487 962 -510 932 -521 ct 910 -530 876 -534 828 -534 ct 701 -534 l p ef
+1661 -212 m 1741 -192 l 1724 -126 1694 -76 1650 -41 ct 1607 -6 1553 10 1490 10 ct
+1425 10 1372 -2 1331 -29 ct 1290 -56 1259 -94 1238 -145 ct 1216 -195 1206 -249 1206 -307 ct
+1206 -370 1218 -425 1242 -472 ct 1266 -519 1300 -554 1345 -579 ct 1389 -603 1438 -615 1491 -615 ct
+1552 -615 1603 -600 1644 -569 ct 1686 -538 1714 -495 1731 -439 ct 1652 -420 l
+1638 -465 1617 -497 1591 -517 ct 1564 -537 1530 -547 1490 -547 ct 1443 -547 1404 -536 1373 -513 ct
+1342 -491 1320 -461 1307 -424 ct 1295 -386 1288 -347 1288 -307 ct 1288 -256 1296 -211 1311 -172 ct
+1326 -134 1349 -105 1381 -86 ct 1412 -67 1447 -58 1484 -58 ct 1529 -58 1567 -71 1598 -97 ct
+1629 -122 l 1650 -161 l p ef
+pom
+gr
+0.996 c 7835 14618 m 8893 13665 l 11010 13665 l 11010 15570 l 8893 15570 l
+7835 14618 l p ef
+0.000 c 7835 14618 m 8893 13665 l 11010 13665 l 11010 15570 l 8893 15570 l
+7835 14618 l pc
+gs
+pum
+8520 14896 t
+65 0 m 65 -605 l 273 -605 l 320 -605 356 -602 381 -596 ct 416 -588 445 -574 470 -553 ct
+502 -526 526 -492 542 -450 ct 558 -408 565 -360 565 -306 ct 565 -260 560 -219 549 -183 ct
+539 -148 525 -118 508 -95 ct 491 -72 473 -54 453 -40 ct 433 -27 409 -17 381 -10 ct
+352 -3 320 0 283 0 ct p
+145 -71 m 274 -71 l 314 -71 345 -75 368 -82 ct 391 -90 409 -100 423 -114 ct
+442 -133 456 -158 467 -190 ct 478 -222 483 -261 483 -307 ct 483 -370 472 -419 452 -453 ct
+431 -487 406 -510 376 -521 ct 354 -530 320 -534 272 -534 ct 145 -534 l p ef
+608 0 m 840 -605 l 926 -605 l 1174 0 l 1083 0 l 1012 -183 l 759 -183 l
+692 0 l p
+782 -248 m 987 -248 l 924 -416 l 905 -467 891 -509 881 -541 ct 873 -503 863 -464 849 -426 ct
+p ef
+1661 -212 m 1741 -192 l 1724 -126 1694 -76 1650 -41 ct 1607 -6 1553 10 1490 10 ct
+1425 10 1372 -2 1331 -29 ct 1290 -56 1259 -94 1238 -145 ct 1216 -195 1206 -249 1206 -307 ct
+1206 -370 1218 -425 1242 -472 ct 1266 -519 1300 -554 1345 -579 ct 1389 -603 1438 -615 1491 -615 ct
+1552 -615 1603 -600 1644 -569 ct 1686 -538 1714 -495 1731 -439 ct 1652 -420 l
+1638 -465 1617 -497 1591 -517 ct 1564 -537 1530 -547 1490 -547 ct 1443 -547 1404 -536 1373 -513 ct
+1342 -491 1320 -461 1307 -424 ct 1295 -386 1288 -347 1288 -307 ct 1288 -256 1296 -211 1311 -172 ct
+1326 -134 1349 -105 1381 -86 ct 1412 -67 1447 -58 1484 -58 ct 1529 -58 1567 -71 1598 -97 ct
+1629 -122 l 1650 -161 l p ef
+pom
+gr
+0.996 c 19984 7938 m 18926 6985 l 16809 6985 l 16809 8890 l 18926 8890 l
+19984 7938 l p ef
+0.000 c 19984 7938 m 18926 6985 l 16809 6985 l 16809 8890 l 18926 8890 l
+19984 7938 l pc
+gs
+pum
+17489 8228 t
+-1 0 m 231 -605 l 317 -605 l 565 0 l 474 0 l 403 -183 l 150 -183 l
+83 0 l p
+173 -248 m 378 -248 l 315 -416 l 296 -467 282 -509 272 -541 ct 264 -503 254 -464 240 -426 ct
+p ef
+621 0 m 621 -605 l 829 -605 l 876 -605 912 -602 937 -596 ct 972 -588 1001 -574 1026 -553 ct
+1058 -526 1082 -492 1098 -450 ct 1114 -408 1121 -360 1121 -306 ct 1121 -260 1116 -219 1105 -183 ct
+1095 -148 1081 -118 1064 -95 ct 1047 -72 1029 -54 1009 -40 ct 989 -27 965 -17 937 -10 ct
+908 -3 876 0 839 0 ct p
+701 -71 m 830 -71 l 870 -71 901 -75 924 -82 ct 947 -90 965 -100 979 -114 ct
+998 -133 1012 -158 1023 -190 ct 1034 -222 1039 -261 1039 -307 ct 1039 -370 1028 -419 1008 -453 ct
+987 -487 962 -510 932 -521 ct 910 -530 876 -534 828 -534 ct 701 -534 l p ef
+1661 -212 m 1741 -192 l 1724 -126 1694 -76 1650 -41 ct 1607 -6 1553 10 1490 10 ct
+1425 10 1372 -2 1331 -29 ct 1290 -56 1259 -94 1238 -145 ct 1216 -195 1206 -249 1206 -307 ct
+1206 -370 1218 -425 1242 -472 ct 1266 -519 1300 -554 1345 -579 ct 1389 -603 1438 -615 1491 -615 ct
+1552 -615 1603 -600 1644 -569 ct 1686 -538 1714 -495 1731 -439 ct 1652 -420 l
+1638 -465 1617 -497 1591 -517 ct 1564 -537 1530 -547 1490 -547 ct 1443 -547 1404 -536 1373 -513 ct
+1342 -491 1320 -461 1307 -424 ct 1295 -386 1288 -347 1288 -307 ct 1288 -256 1296 -211 1311 -172 ct
+1326 -134 1349 -105 1381 -86 ct 1412 -67 1447 -58 1484 -58 ct 1529 -58 1567 -71 1598 -97 ct
+1629 -122 l 1650 -161 l p ef
+pom
+gr
+0.996 c 19984 17258 m 18926 16305 l 16809 16305 l 16809 18210 l 18926 18210 l
+19984 17258 l p ef
+0.000 c 19984 17258 m 18926 16305 l 16809 16305 l 16809 18210 l 18926 18210 l
+19984 17258 l pc
+gs
+pum
+17489 17542 t
+65 0 m 65 -605 l 273 -605 l 320 -605 356 -602 381 -596 ct 416 -588 445 -574 470 -553 ct
+502 -526 526 -492 542 -450 ct 558 -408 565 -360 565 -306 ct 565 -260 560 -219 549 -183 ct
+539 -148 525 -118 508 -95 ct 491 -72 473 -54 453 -40 ct 433 -27 409 -17 381 -10 ct
+352 -3 320 0 283 0 ct p
+145 -71 m 274 -71 l 314 -71 345 -75 368 -82 ct 391 -90 409 -100 423 -114 ct
+442 -133 456 -158 467 -190 ct 478 -222 483 -261 483 -307 ct 483 -370 472 -419 452 -453 ct
+431 -487 406 -510 376 -521 ct 354 -530 320 -534 272 -534 ct 145 -534 l p ef
+608 0 m 840 -605 l 926 -605 l 1174 0 l 1083 0 l 1012 -183 l 759 -183 l
+692 0 l p
+782 -248 m 987 -248 l 924 -416 l 905 -467 891 -509 881 -541 ct 873 -503 863 -464 849 -426 ct
+p ef
+1661 -212 m 1741 -192 l 1724 -126 1694 -76 1650 -41 ct 1607 -6 1553 10 1490 10 ct
+1425 10 1372 -2 1331 -29 ct 1290 -56 1259 -94 1238 -145 ct 1216 -195 1206 -249 1206 -307 ct
+1206 -370 1218 -425 1242 -472 ct 1266 -519 1300 -554 1345 -579 ct 1389 -603 1438 -615 1491 -615 ct
+1552 -615 1603 -600 1644 -569 ct 1686 -538 1714 -495 1731 -439 ct 1652 -420 l
+1638 -465 1617 -497 1591 -517 ct 1564 -537 1530 -547 1490 -547 ct 1443 -547 1404 -536 1373 -513 ct
+1342 -491 1320 -461 1307 -424 ct 1295 -386 1288 -347 1288 -307 ct 1288 -256 1296 -211 1311 -172 ct
+1326 -134 1349 -105 1381 -86 ct 1412 -67 1447 -58 1484 -58 ct 1529 -58 1567 -71 1598 -97 ct
+1629 -122 l 1650 -161 l p ef
+pom
+gr
+0.996 c 19984 10478 m 18926 9525 l 16809 9525 l 16809 11430 l 18926 11430 l
+19984 10478 l p ef
+0.000 c 19984 10478 m 18926 9525 l 16809 9525 l 16809 11430 l 18926 11430 l
+19984 10478 l pc
+gs
+pum
+17489 10768 t
+-1 0 m 231 -605 l 317 -605 l 565 0 l 474 0 l 403 -183 l 150 -183 l
+83 0 l p
+173 -248 m 378 -248 l 315 -416 l 296 -467 282 -509 272 -541 ct 264 -503 254 -464 240 -426 ct
+p ef
+621 0 m 621 -605 l 829 -605 l 876 -605 912 -602 937 -596 ct 972 -588 1001 -574 1026 -553 ct
+1058 -526 1082 -492 1098 -450 ct 1114 -408 1121 -360 1121 -306 ct 1121 -260 1116 -219 1105 -183 ct
+1095 -148 1081 -118 1064 -95 ct 1047 -72 1029 -54 1009 -40 ct 989 -27 965 -17 937 -10 ct
+908 -3 876 0 839 0 ct p
+701 -71 m 830 -71 l 870 -71 901 -75 924 -82 ct 947 -90 965 -100 979 -114 ct
+998 -133 1012 -158 1023 -190 ct 1034 -222 1039 -261 1039 -307 ct 1039 -370 1028 -419 1008 -453 ct
+987 -487 962 -510 932 -521 ct 910 -530 876 -534 828 -534 ct 701 -534 l p ef
+1661 -212 m 1741 -192 l 1724 -126 1694 -76 1650 -41 ct 1607 -6 1553 10 1490 10 ct
+1425 10 1372 -2 1331 -29 ct 1290 -56 1259 -94 1238 -145 ct 1216 -195 1206 -249 1206 -307 ct
+1206 -370 1218 -425 1242 -472 ct 1266 -519 1300 -554 1345 -579 ct 1389 -603 1438 -615 1491 -615 ct
+1552 -615 1603 -600 1644 -569 ct 1686 -538 1714 -495 1731 -439 ct 1652 -420 l
+1638 -465 1617 -497 1591 -517 ct 1564 -537 1530 -547 1490 -547 ct 1443 -547 1404 -536 1373 -513 ct
+1342 -491 1320 -461 1307 -424 ct 1295 -386 1288 -347 1288 -307 ct 1288 -256 1296 -211 1311 -172 ct
+1326 -134 1349 -105 1381 -86 ct 1412 -67 1447 -58 1484 -58 ct 1529 -58 1567 -71 1598 -97 ct
+1629 -122 l 1650 -161 l p ef
+pom
+gr
+0.996 c 19984 14618 m 18926 13665 l 16809 13665 l 16809 15570 l 18926 15570 l
+19984 14618 l p ef
+0.000 c 19984 14618 m 18926 13665 l 16809 13665 l 16809 15570 l 18926 15570 l
+19984 14618 l pc
+gs
+pum
+17489 14896 t
+65 0 m 65 -605 l 273 -605 l 320 -605 356 -602 381 -596 ct 416 -588 445 -574 470 -553 ct
+502 -526 526 -492 542 -450 ct 558 -408 565 -360 565 -306 ct 565 -260 560 -219 549 -183 ct
+539 -148 525 -118 508 -95 ct 491 -72 473 -54 453 -40 ct 433 -27 409 -17 381 -10 ct
+352 -3 320 0 283 0 ct p
+145 -71 m 274 -71 l 314 -71 345 -75 368 -82 ct 391 -90 409 -100 423 -114 ct
+442 -133 456 -158 467 -190 ct 478 -222 483 -261 483 -307 ct 483 -370 472 -419 452 -453 ct
+431 -487 406 -510 376 -521 ct 354 -530 320 -534 272 -534 ct 145 -534 l p ef
+608 0 m 840 -605 l 926 -605 l 1174 0 l 1083 0 l 1012 -183 l 759 -183 l
+692 0 l p
+782 -248 m 987 -248 l 924 -416 l 905 -467 891 -509 881 -541 ct 873 -503 863 -464 849 -426 ct
+p ef
+1661 -212 m 1741 -192 l 1724 -126 1694 -76 1650 -41 ct 1607 -6 1553 10 1490 10 ct
+1425 10 1372 -2 1331 -29 ct 1290 -56 1259 -94 1238 -145 ct 1216 -195 1206 -249 1206 -307 ct
+1206 -370 1218 -425 1242 -472 ct 1266 -519 1300 -554 1345 -579 ct 1389 -603 1438 -615 1491 -615 ct
+1552 -615 1603 -600 1644 -569 ct 1686 -538 1714 -495 1731 -439 ct 1652 -420 l
+1638 -465 1617 -497 1591 -517 ct 1564 -537 1530 -547 1490 -547 ct 1443 -547 1404 -536 1373 -513 ct
+1342 -491 1320 -461 1307 -424 ct 1295 -386 1288 -347 1288 -307 ct 1288 -256 1296 -211 1311 -172 ct
+1326 -134 1349 -105 1381 -86 ct 1412 -67 1447 -58 1484 -58 ct 1529 -58 1567 -71 1598 -97 ct
+1629 -122 l 1650 -161 l p ef
+pom
+gr
+23767 18828 m 20592 18828 l 20592 13113 l 26942 13113 l 26942 18828 l
+23767 18828 l pc
+gs
+pum
+22133 15795 t
+219 0 m 219 -534 l 19 -534 l 19 -605 l 499 -605 l 499 -534 l 299 -534 l
+299 0 l p ef
+583 0 m 583 -438 l 650 -438 l 650 -372 l 667 -403 683 -423 698 -433 ct
+712 -443 728 -448 745 -448 ct 770 -448 796 -440 822 -424 ct 796 -355 l 778 -366 760 -371 742 -371 ct
+725 -371 711 -366 698 -357 ct 685 -347 676 -333 670 -316 ct 662 -289 658 -261 658 -229 ct
+658 0 l p ef
+1162 -54 m 1134 -30 1108 -14 1082 -4 ct 1057 5 1029 9 1000 9 ct 952 9 915 -1 889 -25 ct
+863 -48 850 -79 850 -115 ct 850 -137 855 -156 865 -174 ct 875 -192 887 -206 903 -217 ct
+919 -228 937 -236 957 -241 ct 971 -245 993 -249 1023 -252 ct 1083 -259 1127 -268 1155 -278 ct
+1156 -288 1156 -295 1156 -297 ct 1156 -328 1149 -349 1135 -361 ct 1116 -378 1087 -387 1050 -387 ct
+1015 -387 989 -380 973 -368 ct 956 -356 944 -334 936 -303 ct 863 -313 l 869 -344 880 -369 896 -388 ct
+911 -408 933 -422 961 -433 ct 990 -443 1023 -448 1061 -448 ct 1098 -448 1129 -444 1152 -435 ct
+1175 -426 1193 -415 1204 -402 ct 1215 -388 1222 -371 1227 -351 ct 1229 -338 1231 -316 1231 -282 ct
+1231 -183 l 1231 -114 1232 -70 1235 -52 ct 1238 -34 1245 -16 1254 0 ct 1176 0 l
+1169 -15 l 1164 -33 l p
+1155 -220 m 1128 -209 1088 -199 1034 -192 ct 1003 -187 982 -182 969 -177 ct
+956 -171 947 -163 940 -153 ct 933 -142 929 -130 929 -117 ct 929 -97 937 -81 952 -68 ct
+967 -54 989 -48 1018 -48 ct 1046 -48 1072 -54 1094 -67 ct 1117 -79 1133 -96 1143 -118 ct
+1151 -135 1155 -160 1155 -192 ct p ef
+1325 0 m 1325 -438 l 1392 -438 l 1392 -376 l 1424 -424 1471 -448 1532 -448 ct
+1558 -448 1583 -443 1605 -434 ct 1627 -424 1643 -412 1654 -396 ct 1666 -381 1673 -363 1678 -342 ct
+1680 -328 1682 -304 1682 -269 ct 1682 0 l 1607 0 l 1607 -266 l 1607 -297 1605 -319 1599 -334 ct
+1593 -349 1583 -361 1568 -370 ct 1553 -379 1536 -384 1516 -384 ct 1484 -384 1457 -374 1434 -354 ct
+1411 -333 1400 -295 1400 -239 ct 1400 0 l p ef
+1772 -130 m 1845 -142 l 1849 -113 1861 -90 1880 -74 ct 1898 -59 1925 -51 1959 -51 ct
+1993 -51 2018 -58 2035 -72 ct 2051 -85 2059 -102 2059 -121 ct 2059 -137 2052 -151 2038 -160 ct
+2027 -167 2002 -175 1962 -185 ct 1907 -199 1869 -211 1848 -221 ct 1827 -231 1811 -245 1800 -263 ct
+1789 -281 1784 -300 1784 -322 ct 1784 -341 1788 -359 1797 -376 ct 1806 -393 1818 -407 1834 -418 ct
+1845 -426 1861 -433 1881 -439 ct 1901 -445 1923 -448 1945 -448 ct 1980 -448 2010 -443 2036 -433 ct
+2062 -423 2081 -410 2094 -393 ct 2106 -376 2115 -353 2119 -325 ct 2047 -315 l
+2043 -338 2034 -355 2018 -368 ct 2002 -381 1980 -387 1951 -387 ct 1917 -387 1892 -381 1878 -370 ct
+1863 -359 1856 -346 1856 -330 ct 1856 -321 1859 -312 1865 -304 ct 1871 -296 1880 -290 1893 -285 ct
+1901 -282 1923 -275 1959 -266 ct 2012 -251 2048 -240 2069 -231 ct 2090 -222 2106 -209 2118 -192 ct
+2130 -175 2136 -154 2136 -128 ct 2136 -104 2129 -80 2114 -58 ct 2100 -36 2079 -20 2052 -8 ct
+2024 3 1993 9 1959 9 ct 1902 9 1859 -1 1829 -25 ct 1799 -49 l 1780 -84 l p ef
+2198 0 m 2198 -438 l 2265 -438 l 2265 -377 l 2279 -398 2297 -415 2320 -428 ct
+2343 -442 2369 -448 2398 -448 ct 2430 -448 2457 -441 2478 -428 ct 2499 -414 2513 -396 2522 -371 ct
+2556 -423 2602 -448 2657 -448 ct 2701 -448 2734 -436 2758 -412 ct 2781 -388 2793 -351 2793 -301 ct
+2793 0 l 2719 0 l 2719 -276 l 2719 -306 2716 -327 2712 -340 ct 2707 -353 2698 -364 2685 -372 ct
+2673 -380 2658 -384 2641 -384 ct 2610 -384 2584 -373 2564 -353 ct 2543 -332 2533 -300 2533 -254 ct
+2533 0 l 2459 0 l 2459 -285 l 2459 -318 2453 -342 2441 -359 ct 2429 -375 2409 -384 2381 -384 ct
+2360 -384 2341 -378 2323 -367 ct 2305 -356 2293 -340 2285 -319 ct 2277 -298 2273 -267 2273 -227 ct
+2273 0 l p ef
+2914 -520 m 2914 -605 l 2988 -605 l 2988 -520 l p
+2914 0 m 2914 -438 l 2988 -438 l 2988 0 l p ef
+3261 -66 m 3271 0 l 3250 3 3232 5 3215 5 ct 3188 5 3167 1 3152 -7 ct 3138 -15 3127 -26 3121 -40 ct
+3115 -54 3112 -83 3112 -128 ct 3112 -380 l 3057 -380 l 3057 -438 l 3112 -438 l
+3112 -547 l 3186 -591 l 3186 -438 l 3261 -438 l 3261 -380 l 3186 -380 l
+3186 -124 l 3186 -103 3187 -89 3190 -83 ct 3192 -77 3197 -72 3203 -68 ct 3208 -65 3217 -63 3228 -63 ct
+3236 -63 l 3247 -64 l p ef
+pom
+pum
+20955 16748 t
+65 0 m 65 -605 l 273 -605 l 320 -605 356 -602 381 -596 ct 416 -588 445 -574 470 -553 ct
+502 -526 526 -492 542 -450 ct 558 -408 565 -360 565 -306 ct 565 -260 560 -219 549 -183 ct
+539 -148 525 -118 508 -95 ct 491 -72 473 -54 453 -40 ct 433 -27 409 -17 381 -10 ct
+352 -3 320 0 283 0 ct p
+145 -71 m 274 -71 l 314 -71 345 -75 368 -82 ct 391 -90 409 -100 423 -114 ct
+442 -133 456 -158 467 -190 ct 478 -222 483 -261 483 -307 ct 483 -370 472 -419 452 -453 ct
+431 -487 406 -510 376 -521 ct 354 -530 320 -534 272 -534 ct 145 -534 l p ef
+951 -54 m 923 -30 897 -14 871 -4 ct 846 5 818 9 789 9 ct 741 9 704 -1 678 -25 ct
+652 -48 639 -79 639 -115 ct 639 -137 644 -156 654 -174 ct 664 -192 676 -206 692 -217 ct
+708 -228 726 -236 746 -241 ct 760 -245 782 -249 812 -252 ct 872 -259 916 -268 944 -278 ct
+945 -288 945 -295 945 -297 ct 945 -328 938 -349 924 -361 ct 905 -378 876 -387 839 -387 ct
+804 -387 778 -380 762 -368 ct 745 -356 733 -334 725 -303 ct 652 -313 l 658 -344 669 -369 685 -388 ct
+700 -408 722 -422 750 -433 ct 779 -443 812 -448 850 -448 ct 887 -448 918 -444 941 -435 ct
+964 -426 982 -415 993 -402 ct 1004 -388 1011 -371 1016 -351 ct 1018 -338 1020 -316 1020 -282 ct
+1020 -183 l 1020 -114 1021 -70 1024 -52 ct 1027 -34 1034 -16 1043 0 ct 965 0 l
+958 -15 l 953 -33 l p
+944 -220 m 917 -209 877 -199 823 -192 ct 792 -187 771 -182 758 -177 ct 745 -171 736 -163 729 -153 ct
+722 -142 718 -130 718 -117 ct 718 -97 726 -81 741 -68 ct 756 -54 778 -48 807 -48 ct
+835 -48 861 -54 883 -67 ct 906 -79 922 -96 932 -118 ct 940 -135 944 -160 944 -192 ct
+p ef
+1401 0 m 1401 -64 l 1367 -14 1320 9 1262 9 ct 1236 9 1212 4 1189 -4 ct 1167 -14 1150 -27 1139 -42 ct
+1128 -57 1121 -75 1116 -97 ct 1113 -112 1112 -135 1112 -166 ct 1112 -438 l 1186 -438 l
+1186 -195 l 1186 -156 1187 -130 1191 -116 ct 1195 -97 1205 -82 1220 -70 ct
+1235 -59 1254 -54 1276 -54 ct 1299 -54 1320 -59 1339 -71 ct 1359 -82 1373 -98 1381 -117 ct
+1389 -137 1393 -166 1393 -203 ct 1393 -438 l 1467 -438 l 1467 0 l p ef
+1577 36 m 1649 47 l 1652 69 1660 85 1674 95 ct 1693 109 1718 116 1750 116 ct
+1784 116 1811 109 1829 95 ct 1848 82 1861 62 1867 38 ct 1871 22 1873 -8 1873 -57 ct
+1840 -19 1800 0 1751 0 ct 1691 0 1644 -21 1611 -65 ct 1578 -108 1562 -160 1562 -221 ct
+1562 -263 1569 -302 1584 -337 ct 1600 -373 1622 -400 1650 -419 ct 1679 -438 1713 -448 1752 -448 ct
+1804 -448 1846 -427 1880 -385 ct 1880 -438 l 1948 -438 l 1948 -59 l 1948 8 1941 57 1928 85 ct
+1914 114 1892 136 1861 153 ct 1831 169 1794 178 1750 178 ct 1698 178 1656 166 1623 142 ct
+1591 119 l 1576 83 l p
+1638 -227 m 1638 -169 1650 -127 1672 -101 ct 1695 -74 1724 -61 1758 -61 ct
+1793 -61 1821 -74 1844 -101 ct 1867 -127 1879 -168 1879 -224 ct 1879 -278 1867 -318 1843 -346 ct
+1819 -373 1791 -387 1757 -387 ct 1724 -387 1696 -373 1673 -346 ct 1650 -319 l
+1638 -280 l p ef
+2066 0 m 2066 -605 l 2141 -605 l 2141 -388 l 2175 -428 2219 -448 2272 -448 ct
+2304 -448 2333 -442 2357 -429 ct 2381 -416 2398 -398 2408 -376 ct 2418 -353 2424 -320 2424 -278 ct
+2424 0 l 2349 0 l 2349 -278 l 2349 -315 2341 -342 2325 -359 ct 2309 -376 2286 -384 2257 -384 ct
+2235 -384 2214 -378 2195 -367 ct 2175 -356 2161 -340 2153 -320 ct 2145 -301 2141 -274 2141 -240 ct
+2141 0 l p ef
+2705 -66 m 2715 0 l 2694 3 2676 5 2659 5 ct 2632 5 2611 1 2596 -7 ct 2582 -15 2571 -26 2565 -40 ct
+2559 -54 2556 -83 2556 -128 ct 2556 -380 l 2501 -380 l 2501 -438 l 2556 -438 l
+2556 -547 l 2630 -591 l 2630 -438 l 2705 -438 l 2705 -380 l 2630 -380 l
+2630 -124 l 2630 -103 2631 -89 2634 -83 ct 2636 -77 2641 -72 2647 -68 ct 2652 -65 2661 -63 2672 -63 ct
+2680 -63 l 2691 -64 l p ef
+3081 -141 m 3157 -131 l 3145 -86 3123 -52 3090 -27 ct 3057 -2 3015 9 2965 9 ct
+2900 9 2849 -9 2812 -49 ct 2774 -88 2755 -144 2755 -215 ct 2755 -289 2774 -346 2812 -387 ct
+2851 -428 2900 -448 2960 -448 ct 3019 -448 3067 -428 3104 -388 ct 3141 -348 3160 -292 3160 -220 ct
+3160 -215 3160 -209 3159 -200 ct 2832 -200 l 2835 -152 2849 -115 2873 -89 ct
+2898 -64 2928 -51 2965 -51 ct 2992 -51 3015 -58 3035 -72 ct 3054 -87 l 3069 -109 l
+p
+2836 -261 m 3081 -261 l 3078 -298 3069 -326 3053 -344 ct 3030 -373 2999 -387 2961 -387 ct
+2927 -387 2898 -376 2875 -353 ct 2852 -330 l 2839 -299 l p ef
+3255 0 m 3255 -438 l 3322 -438 l 3322 -372 l 3339 -403 3355 -423 3370 -433 ct
+3384 -443 3400 -448 3417 -448 ct 3442 -448 3468 -440 3494 -424 ct 3468 -355 l
+3450 -366 3432 -371 3414 -371 ct 3397 -371 3383 -366 3370 -357 ct 3357 -347 3348 -333 3342 -316 ct
+3334 -289 3330 -261 3330 -229 ct 3330 0 l p ef
+3617 0 m 3548 0 l 3548 -605 l 3622 -605 l 3622 -389 l 3654 -428 3694 -448 3742 -448 ct
+3769 -448 3795 -443 3819 -432 ct 3843 -421 3863 -406 3879 -386 ct 3894 -366 3906 -343 3915 -315 ct
+3924 -287 3928 -257 3928 -225 ct 3928 -150 3910 -92 3873 -51 ct 3835 -10 3791 9 3739 9 ct
+3687 9 3646 -11 3617 -54 ct p
+3616 -222 m 3616 -170 3623 -132 3638 -108 ct 3661 -70 3693 -51 3733 -51 ct
+3765 -51 3793 -65 3817 -93 ct 3840 -121 3852 -163 3852 -219 ct 3852 -277 3841 -319 3818 -346 ct
+3796 -373 3768 -387 3736 -387 ct 3703 -387 3675 -373 3652 -345 ct 3628 -316 l
+3616 -276 l p ef
+3970 -219 m 3970 -300 3992 -360 4037 -399 ct 4075 -432 4121 -448 4175 -448 ct
+4236 -448 4285 -428 4323 -389 ct 4361 -349 4381 -295 4381 -225 ct 4381 -169 4372 -124 4355 -92 ct
+4338 -59 4314 -34 4281 -16 ct 4249 0 4214 9 4175 9 ct 4114 9 4064 -9 4026 -49 ct
+3989 -88 l 3970 -145 l p
+4046 -219 m 4046 -163 4058 -121 4083 -93 ct 4107 -65 4138 -51 4175 -51 ct 4212 -51 4243 -65 4267 -93 ct
+4292 -121 4304 -164 4304 -221 ct 4304 -276 4292 -317 4267 -345 ct 4243 -373 4212 -387 4175 -387 ct
+4138 -387 4107 -373 4083 -345 ct 4058 -317 l 4046 -275 l p ef
+4761 -54 m 4733 -30 4707 -14 4681 -4 ct 4656 5 4628 9 4599 9 ct 4551 9 4514 -1 4488 -25 ct
+4462 -48 4449 -79 4449 -115 ct 4449 -137 4454 -156 4464 -174 ct 4474 -192 4486 -206 4502 -217 ct
+4518 -228 4536 -236 4556 -241 ct 4570 -245 4592 -249 4622 -252 ct 4682 -259 4726 -268 4754 -278 ct
+4755 -288 4755 -295 4755 -297 ct 4755 -328 4748 -349 4734 -361 ct 4715 -378 4686 -387 4649 -387 ct
+4614 -387 4588 -380 4572 -368 ct 4555 -356 4543 -334 4535 -303 ct 4462 -313 l
+4468 -344 4479 -369 4495 -388 ct 4510 -408 4532 -422 4560 -433 ct 4589 -443 4622 -448 4660 -448 ct
+4697 -448 4728 -444 4751 -435 ct 4774 -426 4792 -415 4803 -402 ct 4814 -388 4821 -371 4826 -351 ct
+4828 -338 4830 -316 4830 -282 ct 4830 -183 l 4830 -114 4831 -70 4834 -52 ct
+4837 -34 4844 -16 4853 0 ct 4775 0 l 4768 -15 l 4763 -33 l p
+4754 -220 m 4727 -209 4687 -199 4633 -192 ct 4602 -187 4581 -182 4568 -177 ct
+4555 -171 4546 -163 4539 -153 ct 4532 -142 4528 -130 4528 -117 ct 4528 -97 4536 -81 4551 -68 ct
+4566 -54 4588 -48 4617 -48 ct 4645 -48 4671 -54 4693 -67 ct 4716 -79 4732 -96 4742 -118 ct
+4750 -135 4754 -160 4754 -192 ct p ef
+4922 0 m 4922 -438 l 4989 -438 l 4989 -372 l 5006 -403 5022 -423 5037 -433 ct
+5051 -443 5067 -448 5084 -448 ct 5109 -448 5135 -440 5161 -424 ct 5135 -355 l
+5117 -366 5099 -371 5081 -371 ct 5064 -371 5050 -366 5037 -357 ct 5024 -347 5015 -333 5009 -316 ct
+5001 -289 4997 -261 4997 -229 ct 4997 0 l p ef
+5499 0 m 5499 -55 l 5471 -11 5430 9 5376 9 ct 5341 9 5309 0 5280 -19 ct 5250 -38 5228 -65 5212 -99 ct
+5195 -134 5187 -174 5187 -218 ct 5187 -262 5195 -302 5209 -338 ct 5224 -373 5246 -401 5275 -420 ct
+5304 -439 5337 -448 5373 -448 ct 5399 -448 5423 -443 5444 -431 ct 5464 -420 5481 -406 5494 -388 ct
+5494 -605 l 5568 -605 l 5568 0 l p
+5264 -218 m 5264 -162 5276 -120 5299 -92 ct 5323 -65 5351 -51 5383 -51 ct 5416 -51 5443 -64 5466 -91 ct
+5489 -117 5500 -158 5500 -212 ct 5500 -272 5489 -316 5465 -344 ct 5442 -373 5414 -387 5380 -387 ct
+5347 -387 5319 -373 5297 -346 ct 5275 -319 l 5264 -277 l p ef
+pom
+gr
+23767 12065 m 20592 12065 l 20592 6350 l 26942 6350 l 26942 12065 l
+23767 12065 l pc
+gs
+pum
+22239 9022 t
+66 0 m 66 -605 l 335 -605 l 389 -605 430 -600 458 -589 ct 486 -578 508 -559 525 -531 ct
+542 -504 550 -473 550 -440 ct 550 -397 536 -361 508 -331 ct 481 -302 438 -283 380 -275 ct
+401 -265 417 -255 428 -245 ct 451 -223 473 -197 494 -164 ct 600 0 l 499 0 l
+419 -125 l 395 -162 376 -190 361 -209 ct 346 -228 332 -242 320 -249 ct 308 -257 296 -263 284 -266 ct
+275 -267 260 -268 239 -268 ct 146 -268 l 146 0 l p
+146 -338 m 318 -338 l 355 -338 384 -342 404 -349 ct 425 -357 441 -369 451 -386 ct
+462 -402 468 -420 468 -440 ct 468 -468 457 -492 436 -510 ct 416 -529 383 -538 338 -538 ct
+146 -538 l p ef
+965 -141 m 1041 -131 l 1029 -86 1007 -52 974 -27 ct 941 -2 899 9 849 9 ct
+784 9 733 -9 696 -49 ct 658 -88 639 -144 639 -215 ct 639 -289 658 -346 696 -387 ct
+735 -428 784 -448 844 -448 ct 903 -448 951 -428 988 -388 ct 1025 -348 1044 -292 1044 -220 ct
+1044 -215 1044 -209 1043 -200 ct 716 -200 l 719 -152 733 -115 757 -89 ct 782 -64 812 -51 849 -51 ct
+876 -51 899 -58 919 -72 ct 938 -87 l 953 -109 l p
+720 -261 m 965 -261 l 962 -298 953 -326 937 -344 ct 914 -373 883 -387 845 -387 ct
+811 -387 782 -376 759 -353 ct 736 -330 l 723 -299 l p ef
+1427 -160 m 1500 -151 l 1492 -100 1471 -61 1438 -32 ct 1405 -4 1365 9 1317 9 ct
+1257 9 1209 -9 1172 -48 ct 1136 -88 1118 -144 1118 -217 ct 1118 -265 1125 -306 1141 -342 ct
+1157 -377 1181 -404 1213 -421 ct 1245 -439 1280 -448 1317 -448 ct 1365 -448 1404 -436 1434 -412 ct
+1465 -388 1484 -354 1493 -309 ct 1420 -298 l 1413 -328 1401 -350 1384 -365 ct
+1366 -380 1345 -387 1320 -387 ct 1283 -387 1252 -374 1229 -347 ct 1206 -320 1194 -277 1194 -219 ct
+1194 -160 1205 -118 1228 -91 ct 1250 -64 1280 -51 1316 -51 ct 1345 -51 1370 -60 1389 -78 ct
+1409 -95 l 1421 -123 l p ef
+1864 -141 m 1940 -131 l 1928 -86 1906 -52 1873 -27 ct 1840 -2 1798 9 1748 9 ct
+1683 9 1632 -9 1595 -49 ct 1557 -88 1538 -144 1538 -215 ct 1538 -289 1557 -346 1595 -387 ct
+1634 -428 1683 -448 1743 -448 ct 1802 -448 1850 -428 1887 -388 ct 1924 -348 1943 -292 1943 -220 ct
+1943 -215 1943 -209 1942 -200 ct 1615 -200 l 1618 -152 1632 -115 1656 -89 ct
+1681 -64 1711 -51 1748 -51 ct 1775 -51 1798 -58 1818 -72 ct 1837 -87 l 1852 -109 l
+p
+1619 -261 m 1864 -261 l 1861 -298 1852 -326 1836 -344 ct 1813 -373 1782 -387 1744 -387 ct
+1710 -387 1681 -376 1658 -353 ct 1635 -330 l 1622 -299 l p ef
+2040 -520 m 2040 -605 l 2114 -605 l 2114 -520 l p
+2040 0 m 2040 -438 l 2114 -438 l 2114 0 l p ef
+2347 0 m 2180 -438 l 2259 -438 l 2353 -175 l 2363 -147 2372 -118 2381 -87 ct
+2388 -110 2397 -138 2409 -171 ct 2506 -438 l 2583 -438 l 2417 0 l p ef
+2949 -141 m 3025 -131 l 3013 -86 2991 -52 2958 -27 ct 2925 -2 2883 9 2833 9 ct
+2768 9 2717 -9 2680 -49 ct 2642 -88 2623 -144 2623 -215 ct 2623 -289 2642 -346 2680 -387 ct
+2719 -428 2768 -448 2828 -448 ct 2887 -448 2935 -428 2972 -388 ct 3009 -348 3028 -292 3028 -220 ct
+3028 -215 3028 -209 3027 -200 ct 2700 -200 l 2703 -152 2717 -115 2741 -89 ct
+2766 -64 2796 -51 2833 -51 ct 2860 -51 2883 -58 2903 -72 ct 2922 -87 l 2937 -109 l
+p
+2704 -261 m 2949 -261 l 2946 -298 2937 -326 2921 -344 ct 2898 -373 2867 -387 2829 -387 ct
+2795 -387 2766 -376 2743 -353 ct 2720 -330 l 2707 -299 l p ef
+pom
+pum
+20955 9975 t
+65 0 m 65 -605 l 273 -605 l 320 -605 356 -602 381 -596 ct 416 -588 445 -574 470 -553 ct
+502 -526 526 -492 542 -450 ct 558 -408 565 -360 565 -306 ct 565 -260 560 -219 549 -183 ct
+539 -148 525 -118 508 -95 ct 491 -72 473 -54 453 -40 ct 433 -27 409 -17 381 -10 ct
+352 -3 320 0 283 0 ct p
+145 -71 m 274 -71 l 314 -71 345 -75 368 -82 ct 391 -90 409 -100 423 -114 ct
+442 -133 456 -158 467 -190 ct 478 -222 483 -261 483 -307 ct 483 -370 472 -419 452 -453 ct
+431 -487 406 -510 376 -521 ct 354 -530 320 -534 272 -534 ct 145 -534 l p ef
+951 -54 m 923 -30 897 -14 871 -4 ct 846 5 818 9 789 9 ct 741 9 704 -1 678 -25 ct
+652 -48 639 -79 639 -115 ct 639 -137 644 -156 654 -174 ct 664 -192 676 -206 692 -217 ct
+708 -228 726 -236 746 -241 ct 760 -245 782 -249 812 -252 ct 872 -259 916 -268 944 -278 ct
+945 -288 945 -295 945 -297 ct 945 -328 938 -349 924 -361 ct 905 -378 876 -387 839 -387 ct
+804 -387 778 -380 762 -368 ct 745 -356 733 -334 725 -303 ct 652 -313 l 658 -344 669 -369 685 -388 ct
+700 -408 722 -422 750 -433 ct 779 -443 812 -448 850 -448 ct 887 -448 918 -444 941 -435 ct
+964 -426 982 -415 993 -402 ct 1004 -388 1011 -371 1016 -351 ct 1018 -338 1020 -316 1020 -282 ct
+1020 -183 l 1020 -114 1021 -70 1024 -52 ct 1027 -34 1034 -16 1043 0 ct 965 0 l
+958 -15 l 953 -33 l p
+944 -220 m 917 -209 877 -199 823 -192 ct 792 -187 771 -182 758 -177 ct 745 -171 736 -163 729 -153 ct
+722 -142 718 -130 718 -117 ct 718 -97 726 -81 741 -68 ct 756 -54 778 -48 807 -48 ct
+835 -48 861 -54 883 -67 ct 906 -79 922 -96 932 -118 ct 940 -135 944 -160 944 -192 ct
+p ef
+1401 0 m 1401 -64 l 1367 -14 1320 9 1262 9 ct 1236 9 1212 4 1189 -4 ct 1167 -14 1150 -27 1139 -42 ct
+1128 -57 1121 -75 1116 -97 ct 1113 -112 1112 -135 1112 -166 ct 1112 -438 l 1186 -438 l
+1186 -195 l 1186 -156 1187 -130 1191 -116 ct 1195 -97 1205 -82 1220 -70 ct
+1235 -59 1254 -54 1276 -54 ct 1299 -54 1320 -59 1339 -71 ct 1359 -82 1373 -98 1381 -117 ct
+1389 -137 1393 -166 1393 -203 ct 1393 -438 l 1467 -438 l 1467 0 l p ef
+1577 36 m 1649 47 l 1652 69 1660 85 1674 95 ct 1693 109 1718 116 1750 116 ct
+1784 116 1811 109 1829 95 ct 1848 82 1861 62 1867 38 ct 1871 22 1873 -8 1873 -57 ct
+1840 -19 1800 0 1751 0 ct 1691 0 1644 -21 1611 -65 ct 1578 -108 1562 -160 1562 -221 ct
+1562 -263 1569 -302 1584 -337 ct 1600 -373 1622 -400 1650 -419 ct 1679 -438 1713 -448 1752 -448 ct
+1804 -448 1846 -427 1880 -385 ct 1880 -438 l 1948 -438 l 1948 -59 l 1948 8 1941 57 1928 85 ct
+1914 114 1892 136 1861 153 ct 1831 169 1794 178 1750 178 ct 1698 178 1656 166 1623 142 ct
+1591 119 l 1576 83 l p
+1638 -227 m 1638 -169 1650 -127 1672 -101 ct 1695 -74 1724 -61 1758 -61 ct
+1793 -61 1821 -74 1844 -101 ct 1867 -127 1879 -168 1879 -224 ct 1879 -278 1867 -318 1843 -346 ct
+1819 -373 1791 -387 1757 -387 ct 1724 -387 1696 -373 1673 -346 ct 1650 -319 l
+1638 -280 l p ef
+2066 0 m 2066 -605 l 2141 -605 l 2141 -388 l 2175 -428 2219 -448 2272 -448 ct
+2304 -448 2333 -442 2357 -429 ct 2381 -416 2398 -398 2408 -376 ct 2418 -353 2424 -320 2424 -278 ct
+2424 0 l 2349 0 l 2349 -278 l 2349 -315 2341 -342 2325 -359 ct 2309 -376 2286 -384 2257 -384 ct
+2235 -384 2214 -378 2195 -367 ct 2175 -356 2161 -340 2153 -320 ct 2145 -301 2141 -274 2141 -240 ct
+2141 0 l p ef
+2705 -66 m 2715 0 l 2694 3 2676 5 2659 5 ct 2632 5 2611 1 2596 -7 ct 2582 -15 2571 -26 2565 -40 ct
+2559 -54 2556 -83 2556 -128 ct 2556 -380 l 2501 -380 l 2501 -438 l 2556 -438 l
+2556 -547 l 2630 -591 l 2630 -438 l 2705 -438 l 2705 -380 l 2630 -380 l
+2630 -124 l 2630 -103 2631 -89 2634 -83 ct 2636 -77 2641 -72 2647 -68 ct 2652 -65 2661 -63 2672 -63 ct
+2680 -63 l 2691 -64 l p ef
+3081 -141 m 3157 -131 l 3145 -86 3123 -52 3090 -27 ct 3057 -2 3015 9 2965 9 ct
+2900 9 2849 -9 2812 -49 ct 2774 -88 2755 -144 2755 -215 ct 2755 -289 2774 -346 2812 -387 ct
+2851 -428 2900 -448 2960 -448 ct 3019 -448 3067 -428 3104 -388 ct 3141 -348 3160 -292 3160 -220 ct
+3160 -215 3160 -209 3159 -200 ct 2832 -200 l 2835 -152 2849 -115 2873 -89 ct
+2898 -64 2928 -51 2965 -51 ct 2992 -51 3015 -58 3035 -72 ct 3054 -87 l 3069 -109 l
+p
+2836 -261 m 3081 -261 l 3078 -298 3069 -326 3053 -344 ct 3030 -373 2999 -387 2961 -387 ct
+2927 -387 2898 -376 2875 -353 ct 2852 -330 l 2839 -299 l p ef
+3255 0 m 3255 -438 l 3322 -438 l 3322 -372 l 3339 -403 3355 -423 3370 -433 ct
+3384 -443 3400 -448 3417 -448 ct 3442 -448 3468 -440 3494 -424 ct 3468 -355 l
+3450 -366 3432 -371 3414 -371 ct 3397 -371 3383 -366 3370 -357 ct 3357 -347 3348 -333 3342 -316 ct
+3334 -289 3330 -261 3330 -229 ct 3330 0 l p ef
+3617 0 m 3548 0 l 3548 -605 l 3622 -605 l 3622 -389 l 3654 -428 3694 -448 3742 -448 ct
+3769 -448 3795 -443 3819 -432 ct 3843 -421 3863 -406 3879 -386 ct 3894 -366 3906 -343 3915 -315 ct
+3924 -287 3928 -257 3928 -225 ct 3928 -150 3910 -92 3873 -51 ct 3835 -10 3791 9 3739 9 ct
+3687 9 3646 -11 3617 -54 ct p
+3616 -222 m 3616 -170 3623 -132 3638 -108 ct 3661 -70 3693 -51 3733 -51 ct
+3765 -51 3793 -65 3817 -93 ct 3840 -121 3852 -163 3852 -219 ct 3852 -277 3841 -319 3818 -346 ct
+3796 -373 3768 -387 3736 -387 ct 3703 -387 3675 -373 3652 -345 ct 3628 -316 l
+3616 -276 l p ef
+3970 -219 m 3970 -300 3992 -360 4037 -399 ct 4075 -432 4121 -448 4175 -448 ct
+4236 -448 4285 -428 4323 -389 ct 4361 -349 4381 -295 4381 -225 ct 4381 -169 4372 -124 4355 -92 ct
+4338 -59 4314 -34 4281 -16 ct 4249 0 4214 9 4175 9 ct 4114 9 4064 -9 4026 -49 ct
+3989 -88 l 3970 -145 l p
+4046 -219 m 4046 -163 4058 -121 4083 -93 ct 4107 -65 4138 -51 4175 -51 ct 4212 -51 4243 -65 4267 -93 ct
+4292 -121 4304 -164 4304 -221 ct 4304 -276 4292 -317 4267 -345 ct 4243 -373 4212 -387 4175 -387 ct
+4138 -387 4107 -373 4083 -345 ct 4058 -317 l 4046 -275 l p ef
+4761 -54 m 4733 -30 4707 -14 4681 -4 ct 4656 5 4628 9 4599 9 ct 4551 9 4514 -1 4488 -25 ct
+4462 -48 4449 -79 4449 -115 ct 4449 -137 4454 -156 4464 -174 ct 4474 -192 4486 -206 4502 -217 ct
+4518 -228 4536 -236 4556 -241 ct 4570 -245 4592 -249 4622 -252 ct 4682 -259 4726 -268 4754 -278 ct
+4755 -288 4755 -295 4755 -297 ct 4755 -328 4748 -349 4734 -361 ct 4715 -378 4686 -387 4649 -387 ct
+4614 -387 4588 -380 4572 -368 ct 4555 -356 4543 -334 4535 -303 ct 4462 -313 l
+4468 -344 4479 -369 4495 -388 ct 4510 -408 4532 -422 4560 -433 ct 4589 -443 4622 -448 4660 -448 ct
+4697 -448 4728 -444 4751 -435 ct 4774 -426 4792 -415 4803 -402 ct 4814 -388 4821 -371 4826 -351 ct
+4828 -338 4830 -316 4830 -282 ct 4830 -183 l 4830 -114 4831 -70 4834 -52 ct
+4837 -34 4844 -16 4853 0 ct 4775 0 l 4768 -15 l 4763 -33 l p
+4754 -220 m 4727 -209 4687 -199 4633 -192 ct 4602 -187 4581 -182 4568 -177 ct
+4555 -171 4546 -163 4539 -153 ct 4532 -142 4528 -130 4528 -117 ct 4528 -97 4536 -81 4551 -68 ct
+4566 -54 4588 -48 4617 -48 ct 4645 -48 4671 -54 4693 -67 ct 4716 -79 4732 -96 4742 -118 ct
+4750 -135 4754 -160 4754 -192 ct p ef
+4922 0 m 4922 -438 l 4989 -438 l 4989 -372 l 5006 -403 5022 -423 5037 -433 ct
+5051 -443 5067 -448 5084 -448 ct 5109 -448 5135 -440 5161 -424 ct 5135 -355 l
+5117 -366 5099 -371 5081 -371 ct 5064 -371 5050 -366 5037 -357 ct 5024 -347 5015 -333 5009 -316 ct
+5001 -289 4997 -261 4997 -229 ct 4997 0 l p ef
+5499 0 m 5499 -55 l 5471 -11 5430 9 5376 9 ct 5341 9 5309 0 5280 -19 ct 5250 -38 5228 -65 5212 -99 ct
+5195 -134 5187 -174 5187 -218 ct 5187 -262 5195 -302 5209 -338 ct 5224 -373 5246 -401 5275 -420 ct
+5304 -439 5337 -448 5373 -448 ct 5399 -448 5423 -443 5444 -431 ct 5464 -420 5481 -406 5494 -388 ct
+5494 -605 l 5568 -605 l 5568 0 l p
+5264 -218 m 5264 -162 5276 -120 5299 -92 ct 5323 -65 5351 -51 5383 -51 ct 5416 -51 5443 -64 5466 -91 ct
+5489 -117 5500 -158 5500 -212 ct 5500 -272 5489 -316 5465 -344 ct 5442 -373 5414 -387 5380 -387 ct
+5347 -387 5319 -373 5297 -346 ct 5275 -319 l 5264 -277 l p ef
+pom
+gr
+4245 18828 m 1070 18828 l 1070 13113 l 7420 13113 l 7420 18828 l 4245 18828 l
+pc
+gs
+pum
+2607 15795 t
+219 0 m 219 -534 l 19 -534 l 19 -605 l 499 -605 l 499 -534 l 299 -534 l
+299 0 l p ef
+583 0 m 583 -438 l 650 -438 l 650 -372 l 667 -403 683 -423 698 -433 ct
+712 -443 728 -448 745 -448 ct 770 -448 796 -440 822 -424 ct 796 -355 l 778 -366 760 -371 742 -371 ct
+725 -371 711 -366 698 -357 ct 685 -347 676 -333 670 -316 ct 662 -289 658 -261 658 -229 ct
+658 0 l p ef
+1162 -54 m 1134 -30 1108 -14 1082 -4 ct 1057 5 1029 9 1000 9 ct 952 9 915 -1 889 -25 ct
+863 -48 850 -79 850 -115 ct 850 -137 855 -156 865 -174 ct 875 -192 887 -206 903 -217 ct
+919 -228 937 -236 957 -241 ct 971 -245 993 -249 1023 -252 ct 1083 -259 1127 -268 1155 -278 ct
+1156 -288 1156 -295 1156 -297 ct 1156 -328 1149 -349 1135 -361 ct 1116 -378 1087 -387 1050 -387 ct
+1015 -387 989 -380 973 -368 ct 956 -356 944 -334 936 -303 ct 863 -313 l 869 -344 880 -369 896 -388 ct
+911 -408 933 -422 961 -433 ct 990 -443 1023 -448 1061 -448 ct 1098 -448 1129 -444 1152 -435 ct
+1175 -426 1193 -415 1204 -402 ct 1215 -388 1222 -371 1227 -351 ct 1229 -338 1231 -316 1231 -282 ct
+1231 -183 l 1231 -114 1232 -70 1235 -52 ct 1238 -34 1245 -16 1254 0 ct 1176 0 l
+1169 -15 l 1164 -33 l p
+1155 -220 m 1128 -209 1088 -199 1034 -192 ct 1003 -187 982 -182 969 -177 ct
+956 -171 947 -163 940 -153 ct 933 -142 929 -130 929 -117 ct 929 -97 937 -81 952 -68 ct
+967 -54 989 -48 1018 -48 ct 1046 -48 1072 -54 1094 -67 ct 1117 -79 1133 -96 1143 -118 ct
+1151 -135 1155 -160 1155 -192 ct p ef
+1325 0 m 1325 -438 l 1392 -438 l 1392 -376 l 1424 -424 1471 -448 1532 -448 ct
+1558 -448 1583 -443 1605 -434 ct 1627 -424 1643 -412 1654 -396 ct 1666 -381 1673 -363 1678 -342 ct
+1680 -328 1682 -304 1682 -269 ct 1682 0 l 1607 0 l 1607 -266 l 1607 -297 1605 -319 1599 -334 ct
+1593 -349 1583 -361 1568 -370 ct 1553 -379 1536 -384 1516 -384 ct 1484 -384 1457 -374 1434 -354 ct
+1411 -333 1400 -295 1400 -239 ct 1400 0 l p ef
+1772 -130 m 1845 -142 l 1849 -113 1861 -90 1880 -74 ct 1898 -59 1925 -51 1959 -51 ct
+1993 -51 2018 -58 2035 -72 ct 2051 -85 2059 -102 2059 -121 ct 2059 -137 2052 -151 2038 -160 ct
+2027 -167 2002 -175 1962 -185 ct 1907 -199 1869 -211 1848 -221 ct 1827 -231 1811 -245 1800 -263 ct
+1789 -281 1784 -300 1784 -322 ct 1784 -341 1788 -359 1797 -376 ct 1806 -393 1818 -407 1834 -418 ct
+1845 -426 1861 -433 1881 -439 ct 1901 -445 1923 -448 1945 -448 ct 1980 -448 2010 -443 2036 -433 ct
+2062 -423 2081 -410 2094 -393 ct 2106 -376 2115 -353 2119 -325 ct 2047 -315 l
+2043 -338 2034 -355 2018 -368 ct 2002 -381 1980 -387 1951 -387 ct 1917 -387 1892 -381 1878 -370 ct
+1863 -359 1856 -346 1856 -330 ct 1856 -321 1859 -312 1865 -304 ct 1871 -296 1880 -290 1893 -285 ct
+1901 -282 1923 -275 1959 -266 ct 2012 -251 2048 -240 2069 -231 ct 2090 -222 2106 -209 2118 -192 ct
+2130 -175 2136 -154 2136 -128 ct 2136 -104 2129 -80 2114 -58 ct 2100 -36 2079 -20 2052 -8 ct
+2024 3 1993 9 1959 9 ct 1902 9 1859 -1 1829 -25 ct 1799 -49 l 1780 -84 l p ef
+2198 0 m 2198 -438 l 2265 -438 l 2265 -377 l 2279 -398 2297 -415 2320 -428 ct
+2343 -442 2369 -448 2398 -448 ct 2430 -448 2457 -441 2478 -428 ct 2499 -414 2513 -396 2522 -371 ct
+2556 -423 2602 -448 2657 -448 ct 2701 -448 2734 -436 2758 -412 ct 2781 -388 2793 -351 2793 -301 ct
+2793 0 l 2719 0 l 2719 -276 l 2719 -306 2716 -327 2712 -340 ct 2707 -353 2698 -364 2685 -372 ct
+2673 -380 2658 -384 2641 -384 ct 2610 -384 2584 -373 2564 -353 ct 2543 -332 2533 -300 2533 -254 ct
+2533 0 l 2459 0 l 2459 -285 l 2459 -318 2453 -342 2441 -359 ct 2429 -375 2409 -384 2381 -384 ct
+2360 -384 2341 -378 2323 -367 ct 2305 -356 2293 -340 2285 -319 ct 2277 -298 2273 -267 2273 -227 ct
+2273 0 l p ef
+2914 -520 m 2914 -605 l 2988 -605 l 2988 -520 l p
+2914 0 m 2914 -438 l 2988 -438 l 2988 0 l p ef
+3261 -66 m 3271 0 l 3250 3 3232 5 3215 5 ct 3188 5 3167 1 3152 -7 ct 3138 -15 3127 -26 3121 -40 ct
+3115 -54 3112 -83 3112 -128 ct 3112 -380 l 3057 -380 l 3057 -438 l 3112 -438 l
+3112 -547 l 3186 -591 l 3186 -438 l 3261 -438 l 3261 -380 l 3186 -380 l
+3186 -124 l 3186 -103 3187 -89 3190 -83 ct 3192 -77 3197 -72 3203 -68 ct 3208 -65 3217 -63 3228 -63 ct
+3236 -63 l 3247 -64 l p ef
+pom
+pum
+1429 16748 t
+65 0 m 65 -605 l 273 -605 l 320 -605 356 -602 381 -596 ct 416 -588 445 -574 470 -553 ct
+502 -526 526 -492 542 -450 ct 558 -408 565 -360 565 -306 ct 565 -260 560 -219 549 -183 ct
+539 -148 525 -118 508 -95 ct 491 -72 473 -54 453 -40 ct 433 -27 409 -17 381 -10 ct
+352 -3 320 0 283 0 ct p
+145 -71 m 274 -71 l 314 -71 345 -75 368 -82 ct 391 -90 409 -100 423 -114 ct
+442 -133 456 -158 467 -190 ct 478 -222 483 -261 483 -307 ct 483 -370 472 -419 452 -453 ct
+431 -487 406 -510 376 -521 ct 354 -530 320 -534 272 -534 ct 145 -534 l p ef
+951 -54 m 923 -30 897 -14 871 -4 ct 846 5 818 9 789 9 ct 741 9 704 -1 678 -25 ct
+652 -48 639 -79 639 -115 ct 639 -137 644 -156 654 -174 ct 664 -192 676 -206 692 -217 ct
+708 -228 726 -236 746 -241 ct 760 -245 782 -249 812 -252 ct 872 -259 916 -268 944 -278 ct
+945 -288 945 -295 945 -297 ct 945 -328 938 -349 924 -361 ct 905 -378 876 -387 839 -387 ct
+804 -387 778 -380 762 -368 ct 745 -356 733 -334 725 -303 ct 652 -313 l 658 -344 669 -369 685 -388 ct
+700 -408 722 -422 750 -433 ct 779 -443 812 -448 850 -448 ct 887 -448 918 -444 941 -435 ct
+964 -426 982 -415 993 -402 ct 1004 -388 1011 -371 1016 -351 ct 1018 -338 1020 -316 1020 -282 ct
+1020 -183 l 1020 -114 1021 -70 1024 -52 ct 1027 -34 1034 -16 1043 0 ct 965 0 l
+958 -15 l 953 -33 l p
+944 -220 m 917 -209 877 -199 823 -192 ct 792 -187 771 -182 758 -177 ct 745 -171 736 -163 729 -153 ct
+722 -142 718 -130 718 -117 ct 718 -97 726 -81 741 -68 ct 756 -54 778 -48 807 -48 ct
+835 -48 861 -54 883 -67 ct 906 -79 922 -96 932 -118 ct 940 -135 944 -160 944 -192 ct
+p ef
+1401 0 m 1401 -64 l 1367 -14 1320 9 1262 9 ct 1236 9 1212 4 1189 -4 ct 1167 -14 1150 -27 1139 -42 ct
+1128 -57 1121 -75 1116 -97 ct 1113 -112 1112 -135 1112 -166 ct 1112 -438 l 1186 -438 l
+1186 -195 l 1186 -156 1187 -130 1191 -116 ct 1195 -97 1205 -82 1220 -70 ct
+1235 -59 1254 -54 1276 -54 ct 1299 -54 1320 -59 1339 -71 ct 1359 -82 1373 -98 1381 -117 ct
+1389 -137 1393 -166 1393 -203 ct 1393 -438 l 1467 -438 l 1467 0 l p ef
+1577 36 m 1649 47 l 1652 69 1660 85 1674 95 ct 1693 109 1718 116 1750 116 ct
+1784 116 1811 109 1829 95 ct 1848 82 1861 62 1867 38 ct 1871 22 1873 -8 1873 -57 ct
+1840 -19 1800 0 1751 0 ct 1691 0 1644 -21 1611 -65 ct 1578 -108 1562 -160 1562 -221 ct
+1562 -263 1569 -302 1584 -337 ct 1600 -373 1622 -400 1650 -419 ct 1679 -438 1713 -448 1752 -448 ct
+1804 -448 1846 -427 1880 -385 ct 1880 -438 l 1948 -438 l 1948 -59 l 1948 8 1941 57 1928 85 ct
+1914 114 1892 136 1861 153 ct 1831 169 1794 178 1750 178 ct 1698 178 1656 166 1623 142 ct
+1591 119 l 1576 83 l p
+1638 -227 m 1638 -169 1650 -127 1672 -101 ct 1695 -74 1724 -61 1758 -61 ct
+1793 -61 1821 -74 1844 -101 ct 1867 -127 1879 -168 1879 -224 ct 1879 -278 1867 -318 1843 -346 ct
+1819 -373 1791 -387 1757 -387 ct 1724 -387 1696 -373 1673 -346 ct 1650 -319 l
+1638 -280 l p ef
+2066 0 m 2066 -605 l 2141 -605 l 2141 -388 l 2175 -428 2219 -448 2272 -448 ct
+2304 -448 2333 -442 2357 -429 ct 2381 -416 2398 -398 2408 -376 ct 2418 -353 2424 -320 2424 -278 ct
+2424 0 l 2349 0 l 2349 -278 l 2349 -315 2341 -342 2325 -359 ct 2309 -376 2286 -384 2257 -384 ct
+2235 -384 2214 -378 2195 -367 ct 2175 -356 2161 -340 2153 -320 ct 2145 -301 2141 -274 2141 -240 ct
+2141 0 l p ef
+2705 -66 m 2715 0 l 2694 3 2676 5 2659 5 ct 2632 5 2611 1 2596 -7 ct 2582 -15 2571 -26 2565 -40 ct
+2559 -54 2556 -83 2556 -128 ct 2556 -380 l 2501 -380 l 2501 -438 l 2556 -438 l
+2556 -547 l 2630 -591 l 2630 -438 l 2705 -438 l 2705 -380 l 2630 -380 l
+2630 -124 l 2630 -103 2631 -89 2634 -83 ct 2636 -77 2641 -72 2647 -68 ct 2652 -65 2661 -63 2672 -63 ct
+2680 -63 l 2691 -64 l p ef
+3081 -141 m 3157 -131 l 3145 -86 3123 -52 3090 -27 ct 3057 -2 3015 9 2965 9 ct
+2900 9 2849 -9 2812 -49 ct 2774 -88 2755 -144 2755 -215 ct 2755 -289 2774 -346 2812 -387 ct
+2851 -428 2900 -448 2960 -448 ct 3019 -448 3067 -428 3104 -388 ct 3141 -348 3160 -292 3160 -220 ct
+3160 -215 3160 -209 3159 -200 ct 2832 -200 l 2835 -152 2849 -115 2873 -89 ct
+2898 -64 2928 -51 2965 -51 ct 2992 -51 3015 -58 3035 -72 ct 3054 -87 l 3069 -109 l
+p
+2836 -261 m 3081 -261 l 3078 -298 3069 -326 3053 -344 ct 3030 -373 2999 -387 2961 -387 ct
+2927 -387 2898 -376 2875 -353 ct 2852 -330 l 2839 -299 l p ef
+3255 0 m 3255 -438 l 3322 -438 l 3322 -372 l 3339 -403 3355 -423 3370 -433 ct
+3384 -443 3400 -448 3417 -448 ct 3442 -448 3468 -440 3494 -424 ct 3468 -355 l
+3450 -366 3432 -371 3414 -371 ct 3397 -371 3383 -366 3370 -357 ct 3357 -347 3348 -333 3342 -316 ct
+3334 -289 3330 -261 3330 -229 ct 3330 0 l p ef
+3617 0 m 3548 0 l 3548 -605 l 3622 -605 l 3622 -389 l 3654 -428 3694 -448 3742 -448 ct
+3769 -448 3795 -443 3819 -432 ct 3843 -421 3863 -406 3879 -386 ct 3894 -366 3906 -343 3915 -315 ct
+3924 -287 3928 -257 3928 -225 ct 3928 -150 3910 -92 3873 -51 ct 3835 -10 3791 9 3739 9 ct
+3687 9 3646 -11 3617 -54 ct p
+3616 -222 m 3616 -170 3623 -132 3638 -108 ct 3661 -70 3693 -51 3733 -51 ct
+3765 -51 3793 -65 3817 -93 ct 3840 -121 3852 -163 3852 -219 ct 3852 -277 3841 -319 3818 -346 ct
+3796 -373 3768 -387 3736 -387 ct 3703 -387 3675 -373 3652 -345 ct 3628 -316 l
+3616 -276 l p ef
+3970 -219 m 3970 -300 3992 -360 4037 -399 ct 4075 -432 4121 -448 4175 -448 ct
+4236 -448 4285 -428 4323 -389 ct 4361 -349 4381 -295 4381 -225 ct 4381 -169 4372 -124 4355 -92 ct
+4338 -59 4314 -34 4281 -16 ct 4249 0 4214 9 4175 9 ct 4114 9 4064 -9 4026 -49 ct
+3989 -88 l 3970 -145 l p
+4046 -219 m 4046 -163 4058 -121 4083 -93 ct 4107 -65 4138 -51 4175 -51 ct 4212 -51 4243 -65 4267 -93 ct
+4292 -121 4304 -164 4304 -221 ct 4304 -276 4292 -317 4267 -345 ct 4243 -373 4212 -387 4175 -387 ct
+4138 -387 4107 -373 4083 -345 ct 4058 -317 l 4046 -275 l p ef
+4761 -54 m 4733 -30 4707 -14 4681 -4 ct 4656 5 4628 9 4599 9 ct 4551 9 4514 -1 4488 -25 ct
+4462 -48 4449 -79 4449 -115 ct 4449 -137 4454 -156 4464 -174 ct 4474 -192 4486 -206 4502 -217 ct
+4518 -228 4536 -236 4556 -241 ct 4570 -245 4592 -249 4622 -252 ct 4682 -259 4726 -268 4754 -278 ct
+4755 -288 4755 -295 4755 -297 ct 4755 -328 4748 -349 4734 -361 ct 4715 -378 4686 -387 4649 -387 ct
+4614 -387 4588 -380 4572 -368 ct 4555 -356 4543 -334 4535 -303 ct 4462 -313 l
+4468 -344 4479 -369 4495 -388 ct 4510 -408 4532 -422 4560 -433 ct 4589 -443 4622 -448 4660 -448 ct
+4697 -448 4728 -444 4751 -435 ct 4774 -426 4792 -415 4803 -402 ct 4814 -388 4821 -371 4826 -351 ct
+4828 -338 4830 -316 4830 -282 ct 4830 -183 l 4830 -114 4831 -70 4834 -52 ct
+4837 -34 4844 -16 4853 0 ct 4775 0 l 4768 -15 l 4763 -33 l p
+4754 -220 m 4727 -209 4687 -199 4633 -192 ct 4602 -187 4581 -182 4568 -177 ct
+4555 -171 4546 -163 4539 -153 ct 4532 -142 4528 -130 4528 -117 ct 4528 -97 4536 -81 4551 -68 ct
+4566 -54 4588 -48 4617 -48 ct 4645 -48 4671 -54 4693 -67 ct 4716 -79 4732 -96 4742 -118 ct
+4750 -135 4754 -160 4754 -192 ct p ef
+4922 0 m 4922 -438 l 4989 -438 l 4989 -372 l 5006 -403 5022 -423 5037 -433 ct
+5051 -443 5067 -448 5084 -448 ct 5109 -448 5135 -440 5161 -424 ct 5135 -355 l
+5117 -366 5099 -371 5081 -371 ct 5064 -371 5050 -366 5037 -357 ct 5024 -347 5015 -333 5009 -316 ct
+5001 -289 4997 -261 4997 -229 ct 4997 0 l p ef
+5499 0 m 5499 -55 l 5471 -11 5430 9 5376 9 ct 5341 9 5309 0 5280 -19 ct 5250 -38 5228 -65 5212 -99 ct
+5195 -134 5187 -174 5187 -218 ct 5187 -262 5195 -302 5209 -338 ct 5224 -373 5246 -401 5275 -420 ct
+5304 -439 5337 -448 5373 -448 ct 5399 -448 5423 -443 5444 -431 ct 5464 -420 5481 -406 5494 -388 ct
+5494 -605 l 5568 -605 l 5568 0 l p
+5264 -218 m 5264 -162 5276 -120 5299 -92 ct 5323 -65 5351 -51 5383 -51 ct 5416 -51 5443 -64 5466 -91 ct
+5489 -117 5500 -158 5500 -212 ct 5500 -272 5489 -316 5465 -344 ct 5442 -373 5414 -387 5380 -387 ct
+5347 -387 5319 -373 5297 -346 ct 5275 -319 l 5264 -277 l p ef
+pom
+gr
+4245 12065 m 1070 12065 l 1070 6350 l 7420 6350 l 7420 12065 l 4245 12065 l
+pc
+gs
+pum
+2713 9022 t
+66 0 m 66 -605 l 335 -605 l 389 -605 430 -600 458 -589 ct 486 -578 508 -559 525 -531 ct
+542 -504 550 -473 550 -440 ct 550 -397 536 -361 508 -331 ct 481 -302 438 -283 380 -275 ct
+401 -265 417 -255 428 -245 ct 451 -223 473 -197 494 -164 ct 600 0 l 499 0 l
+419 -125 l 395 -162 376 -190 361 -209 ct 346 -228 332 -242 320 -249 ct 308 -257 296 -263 284 -266 ct
+275 -267 260 -268 239 -268 ct 146 -268 l 146 0 l p
+146 -338 m 318 -338 l 355 -338 384 -342 404 -349 ct 425 -357 441 -369 451 -386 ct
+462 -402 468 -420 468 -440 ct 468 -468 457 -492 436 -510 ct 416 -529 383 -538 338 -538 ct
+146 -538 l p ef
+965 -141 m 1041 -131 l 1029 -86 1007 -52 974 -27 ct 941 -2 899 9 849 9 ct
+784 9 733 -9 696 -49 ct 658 -88 639 -144 639 -215 ct 639 -289 658 -346 696 -387 ct
+735 -428 784 -448 844 -448 ct 903 -448 951 -428 988 -388 ct 1025 -348 1044 -292 1044 -220 ct
+1044 -215 1044 -209 1043 -200 ct 716 -200 l 719 -152 733 -115 757 -89 ct 782 -64 812 -51 849 -51 ct
+876 -51 899 -58 919 -72 ct 938 -87 l 953 -109 l p
+720 -261 m 965 -261 l 962 -298 953 -326 937 -344 ct 914 -373 883 -387 845 -387 ct
+811 -387 782 -376 759 -353 ct 736 -330 l 723 -299 l p ef
+1427 -160 m 1500 -151 l 1492 -100 1471 -61 1438 -32 ct 1405 -4 1365 9 1317 9 ct
+1257 9 1209 -9 1172 -48 ct 1136 -88 1118 -144 1118 -217 ct 1118 -265 1125 -306 1141 -342 ct
+1157 -377 1181 -404 1213 -421 ct 1245 -439 1280 -448 1317 -448 ct 1365 -448 1404 -436 1434 -412 ct
+1465 -388 1484 -354 1493 -309 ct 1420 -298 l 1413 -328 1401 -350 1384 -365 ct
+1366 -380 1345 -387 1320 -387 ct 1283 -387 1252 -374 1229 -347 ct 1206 -320 1194 -277 1194 -219 ct
+1194 -160 1205 -118 1228 -91 ct 1250 -64 1280 -51 1316 -51 ct 1345 -51 1370 -60 1389 -78 ct
+1409 -95 l 1421 -123 l p ef
+1864 -141 m 1940 -131 l 1928 -86 1906 -52 1873 -27 ct 1840 -2 1798 9 1748 9 ct
+1683 9 1632 -9 1595 -49 ct 1557 -88 1538 -144 1538 -215 ct 1538 -289 1557 -346 1595 -387 ct
+1634 -428 1683 -448 1743 -448 ct 1802 -448 1850 -428 1887 -388 ct 1924 -348 1943 -292 1943 -220 ct
+1943 -215 1943 -209 1942 -200 ct 1615 -200 l 1618 -152 1632 -115 1656 -89 ct
+1681 -64 1711 -51 1748 -51 ct 1775 -51 1798 -58 1818 -72 ct 1837 -87 l 1852 -109 l
+p
+1619 -261 m 1864 -261 l 1861 -298 1852 -326 1836 -344 ct 1813 -373 1782 -387 1744 -387 ct
+1710 -387 1681 -376 1658 -353 ct 1635 -330 l 1622 -299 l p ef
+2040 -520 m 2040 -605 l 2114 -605 l 2114 -520 l p
+2040 0 m 2040 -438 l 2114 -438 l 2114 0 l p ef
+2347 0 m 2180 -438 l 2259 -438 l 2353 -175 l 2363 -147 2372 -118 2381 -87 ct
+2388 -110 2397 -138 2409 -171 ct 2506 -438 l 2583 -438 l 2417 0 l p ef
+2949 -141 m 3025 -131 l 3013 -86 2991 -52 2958 -27 ct 2925 -2 2883 9 2833 9 ct
+2768 9 2717 -9 2680 -49 ct 2642 -88 2623 -144 2623 -215 ct 2623 -289 2642 -346 2680 -387 ct
+2719 -428 2768 -448 2828 -448 ct 2887 -448 2935 -428 2972 -388 ct 3009 -348 3028 -292 3028 -220 ct
+3028 -215 3028 -209 3027 -200 ct 2700 -200 l 2703 -152 2717 -115 2741 -89 ct
+2766 -64 2796 -51 2833 -51 ct 2860 -51 2883 -58 2903 -72 ct 2922 -87 l 2937 -109 l
+p
+2704 -261 m 2949 -261 l 2946 -298 2937 -326 2921 -344 ct 2898 -373 2867 -387 2829 -387 ct
+2795 -387 2766 -376 2743 -353 ct 2720 -330 l 2707 -299 l p ef
+pom
+pum
+1429 9975 t
+65 0 m 65 -605 l 273 -605 l 320 -605 356 -602 381 -596 ct 416 -588 445 -574 470 -553 ct
+502 -526 526 -492 542 -450 ct 558 -408 565 -360 565 -306 ct 565 -260 560 -219 549 -183 ct
+539 -148 525 -118 508 -95 ct 491 -72 473 -54 453 -40 ct 433 -27 409 -17 381 -10 ct
+352 -3 320 0 283 0 ct p
+145 -71 m 274 -71 l 314 -71 345 -75 368 -82 ct 391 -90 409 -100 423 -114 ct
+442 -133 456 -158 467 -190 ct 478 -222 483 -261 483 -307 ct 483 -370 472 -419 452 -453 ct
+431 -487 406 -510 376 -521 ct 354 -530 320 -534 272 -534 ct 145 -534 l p ef
+951 -54 m 923 -30 897 -14 871 -4 ct 846 5 818 9 789 9 ct 741 9 704 -1 678 -25 ct
+652 -48 639 -79 639 -115 ct 639 -137 644 -156 654 -174 ct 664 -192 676 -206 692 -217 ct
+708 -228 726 -236 746 -241 ct 760 -245 782 -249 812 -252 ct 872 -259 916 -268 944 -278 ct
+945 -288 945 -295 945 -297 ct 945 -328 938 -349 924 -361 ct 905 -378 876 -387 839 -387 ct
+804 -387 778 -380 762 -368 ct 745 -356 733 -334 725 -303 ct 652 -313 l 658 -344 669 -369 685 -388 ct
+700 -408 722 -422 750 -433 ct 779 -443 812 -448 850 -448 ct 887 -448 918 -444 941 -435 ct
+964 -426 982 -415 993 -402 ct 1004 -388 1011 -371 1016 -351 ct 1018 -338 1020 -316 1020 -282 ct
+1020 -183 l 1020 -114 1021 -70 1024 -52 ct 1027 -34 1034 -16 1043 0 ct 965 0 l
+958 -15 l 953 -33 l p
+944 -220 m 917 -209 877 -199 823 -192 ct 792 -187 771 -182 758 -177 ct 745 -171 736 -163 729 -153 ct
+722 -142 718 -130 718 -117 ct 718 -97 726 -81 741 -68 ct 756 -54 778 -48 807 -48 ct
+835 -48 861 -54 883 -67 ct 906 -79 922 -96 932 -118 ct 940 -135 944 -160 944 -192 ct
+p ef
+1401 0 m 1401 -64 l 1367 -14 1320 9 1262 9 ct 1236 9 1212 4 1189 -4 ct 1167 -14 1150 -27 1139 -42 ct
+1128 -57 1121 -75 1116 -97 ct 1113 -112 1112 -135 1112 -166 ct 1112 -438 l 1186 -438 l
+1186 -195 l 1186 -156 1187 -130 1191 -116 ct 1195 -97 1205 -82 1220 -70 ct
+1235 -59 1254 -54 1276 -54 ct 1299 -54 1320 -59 1339 -71 ct 1359 -82 1373 -98 1381 -117 ct
+1389 -137 1393 -166 1393 -203 ct 1393 -438 l 1467 -438 l 1467 0 l p ef
+1577 36 m 1649 47 l 1652 69 1660 85 1674 95 ct 1693 109 1718 116 1750 116 ct
+1784 116 1811 109 1829 95 ct 1848 82 1861 62 1867 38 ct 1871 22 1873 -8 1873 -57 ct
+1840 -19 1800 0 1751 0 ct 1691 0 1644 -21 1611 -65 ct 1578 -108 1562 -160 1562 -221 ct
+1562 -263 1569 -302 1584 -337 ct 1600 -373 1622 -400 1650 -419 ct 1679 -438 1713 -448 1752 -448 ct
+1804 -448 1846 -427 1880 -385 ct 1880 -438 l 1948 -438 l 1948 -59 l 1948 8 1941 57 1928 85 ct
+1914 114 1892 136 1861 153 ct 1831 169 1794 178 1750 178 ct 1698 178 1656 166 1623 142 ct
+1591 119 l 1576 83 l p
+1638 -227 m 1638 -169 1650 -127 1672 -101 ct 1695 -74 1724 -61 1758 -61 ct
+1793 -61 1821 -74 1844 -101 ct 1867 -127 1879 -168 1879 -224 ct 1879 -278 1867 -318 1843 -346 ct
+1819 -373 1791 -387 1757 -387 ct 1724 -387 1696 -373 1673 -346 ct 1650 -319 l
+1638 -280 l p ef
+2066 0 m 2066 -605 l 2141 -605 l 2141 -388 l 2175 -428 2219 -448 2272 -448 ct
+2304 -448 2333 -442 2357 -429 ct 2381 -416 2398 -398 2408 -376 ct 2418 -353 2424 -320 2424 -278 ct
+2424 0 l 2349 0 l 2349 -278 l 2349 -315 2341 -342 2325 -359 ct 2309 -376 2286 -384 2257 -384 ct
+2235 -384 2214 -378 2195 -367 ct 2175 -356 2161 -340 2153 -320 ct 2145 -301 2141 -274 2141 -240 ct
+2141 0 l p ef
+2705 -66 m 2715 0 l 2694 3 2676 5 2659 5 ct 2632 5 2611 1 2596 -7 ct 2582 -15 2571 -26 2565 -40 ct
+2559 -54 2556 -83 2556 -128 ct 2556 -380 l 2501 -380 l 2501 -438 l 2556 -438 l
+2556 -547 l 2630 -591 l 2630 -438 l 2705 -438 l 2705 -380 l 2630 -380 l
+2630 -124 l 2630 -103 2631 -89 2634 -83 ct 2636 -77 2641 -72 2647 -68 ct 2652 -65 2661 -63 2672 -63 ct
+2680 -63 l 2691 -64 l p ef
+3081 -141 m 3157 -131 l 3145 -86 3123 -52 3090 -27 ct 3057 -2 3015 9 2965 9 ct
+2900 9 2849 -9 2812 -49 ct 2774 -88 2755 -144 2755 -215 ct 2755 -289 2774 -346 2812 -387 ct
+2851 -428 2900 -448 2960 -448 ct 3019 -448 3067 -428 3104 -388 ct 3141 -348 3160 -292 3160 -220 ct
+3160 -215 3160 -209 3159 -200 ct 2832 -200 l 2835 -152 2849 -115 2873 -89 ct
+2898 -64 2928 -51 2965 -51 ct 2992 -51 3015 -58 3035 -72 ct 3054 -87 l 3069 -109 l
+p
+2836 -261 m 3081 -261 l 3078 -298 3069 -326 3053 -344 ct 3030 -373 2999 -387 2961 -387 ct
+2927 -387 2898 -376 2875 -353 ct 2852 -330 l 2839 -299 l p ef
+3255 0 m 3255 -438 l 3322 -438 l 3322 -372 l 3339 -403 3355 -423 3370 -433 ct
+3384 -443 3400 -448 3417 -448 ct 3442 -448 3468 -440 3494 -424 ct 3468 -355 l
+3450 -366 3432 -371 3414 -371 ct 3397 -371 3383 -366 3370 -357 ct 3357 -347 3348 -333 3342 -316 ct
+3334 -289 3330 -261 3330 -229 ct 3330 0 l p ef
+3617 0 m 3548 0 l 3548 -605 l 3622 -605 l 3622 -389 l 3654 -428 3694 -448 3742 -448 ct
+3769 -448 3795 -443 3819 -432 ct 3843 -421 3863 -406 3879 -386 ct 3894 -366 3906 -343 3915 -315 ct
+3924 -287 3928 -257 3928 -225 ct 3928 -150 3910 -92 3873 -51 ct 3835 -10 3791 9 3739 9 ct
+3687 9 3646 -11 3617 -54 ct p
+3616 -222 m 3616 -170 3623 -132 3638 -108 ct 3661 -70 3693 -51 3733 -51 ct
+3765 -51 3793 -65 3817 -93 ct 3840 -121 3852 -163 3852 -219 ct 3852 -277 3841 -319 3818 -346 ct
+3796 -373 3768 -387 3736 -387 ct 3703 -387 3675 -373 3652 -345 ct 3628 -316 l
+3616 -276 l p ef
+3970 -219 m 3970 -300 3992 -360 4037 -399 ct 4075 -432 4121 -448 4175 -448 ct
+4236 -448 4285 -428 4323 -389 ct 4361 -349 4381 -295 4381 -225 ct 4381 -169 4372 -124 4355 -92 ct
+4338 -59 4314 -34 4281 -16 ct 4249 0 4214 9 4175 9 ct 4114 9 4064 -9 4026 -49 ct
+3989 -88 l 3970 -145 l p
+4046 -219 m 4046 -163 4058 -121 4083 -93 ct 4107 -65 4138 -51 4175 -51 ct 4212 -51 4243 -65 4267 -93 ct
+4292 -121 4304 -164 4304 -221 ct 4304 -276 4292 -317 4267 -345 ct 4243 -373 4212 -387 4175 -387 ct
+4138 -387 4107 -373 4083 -345 ct 4058 -317 l 4046 -275 l p ef
+4761 -54 m 4733 -30 4707 -14 4681 -4 ct 4656 5 4628 9 4599 9 ct 4551 9 4514 -1 4488 -25 ct
+4462 -48 4449 -79 4449 -115 ct 4449 -137 4454 -156 4464 -174 ct 4474 -192 4486 -206 4502 -217 ct
+4518 -228 4536 -236 4556 -241 ct 4570 -245 4592 -249 4622 -252 ct 4682 -259 4726 -268 4754 -278 ct
+4755 -288 4755 -295 4755 -297 ct 4755 -328 4748 -349 4734 -361 ct 4715 -378 4686 -387 4649 -387 ct
+4614 -387 4588 -380 4572 -368 ct 4555 -356 4543 -334 4535 -303 ct 4462 -313 l
+4468 -344 4479 -369 4495 -388 ct 4510 -408 4532 -422 4560 -433 ct 4589 -443 4622 -448 4660 -448 ct
+4697 -448 4728 -444 4751 -435 ct 4774 -426 4792 -415 4803 -402 ct 4814 -388 4821 -371 4826 -351 ct
+4828 -338 4830 -316 4830 -282 ct 4830 -183 l 4830 -114 4831 -70 4834 -52 ct
+4837 -34 4844 -16 4853 0 ct 4775 0 l 4768 -15 l 4763 -33 l p
+4754 -220 m 4727 -209 4687 -199 4633 -192 ct 4602 -187 4581 -182 4568 -177 ct
+4555 -171 4546 -163 4539 -153 ct 4532 -142 4528 -130 4528 -117 ct 4528 -97 4536 -81 4551 -68 ct
+4566 -54 4588 -48 4617 -48 ct 4645 -48 4671 -54 4693 -67 ct 4716 -79 4732 -96 4742 -118 ct
+4750 -135 4754 -160 4754 -192 ct p ef
+4922 0 m 4922 -438 l 4989 -438 l 4989 -372 l 5006 -403 5022 -423 5037 -433 ct
+5051 -443 5067 -448 5084 -448 ct 5109 -448 5135 -440 5161 -424 ct 5135 -355 l
+5117 -366 5099 -371 5081 -371 ct 5064 -371 5050 -366 5037 -357 ct 5024 -347 5015 -333 5009 -316 ct
+5001 -289 4997 -261 4997 -229 ct 4997 0 l p ef
+5499 0 m 5499 -55 l 5471 -11 5430 9 5376 9 ct 5341 9 5309 0 5280 -19 ct 5250 -38 5228 -65 5212 -99 ct
+5195 -134 5187 -174 5187 -218 ct 5187 -262 5195 -302 5209 -338 ct 5224 -373 5246 -401 5275 -420 ct
+5304 -439 5337 -448 5373 -448 ct 5399 -448 5423 -443 5444 -431 ct 5464 -420 5481 -406 5494 -388 ct
+5494 -605 l 5568 -605 l 5568 0 l p
+5264 -218 m 5264 -162 5276 -120 5299 -92 ct 5323 -65 5351 -51 5383 -51 ct 5416 -51 5443 -64 5466 -91 ct
+5489 -117 5500 -158 5500 -212 ct 5500 -272 5489 -316 5465 -344 ct 5442 -373 5414 -387 5380 -387 ct
+5347 -387 5319 -373 5297 -346 ct 5275 -319 l 5264 -277 l p ef
+pom
+gr
+51 lw 13970 5080 m 13970 6350 l ps
+11010 7920 m 11900 7920 l ps
+11010 10460 m 11900 10460 l ps
+11010 14605 m 11900 14605 l ps
+11010 17245 m 11900 17245 l ps
+7835 7955 m 7420 7955 l ps
+7835 10460 m 7420 10460 l ps
+7835 14605 m 7420 14605 l ps
+7835 17245 m 7420 17245 l ps
+16013 7955 m 16809 7955 l ps
+19984 7920 m 20592 7920 l ps
+19984 10460 m 20592 10460 l ps
+16013 10495 m 16809 10495 l ps
+16013 14605 m 16809 14605 l ps
+16013 17245 m 16809 17245 l ps
+19984 14605 m 20592 14605 l ps
+19984 17245 m 20592 17245 l ps
+gr
+0 20290 t
+pom
+count op_count sub {pop} repeat countdictstack dict_count sub {end} repeat b4_inc_state restore
+%%PageTrailer
+%%Trailer
+%%EOF
diff --git a/docs/exploring-gnuradio/usrp-block-diagram.png b/docs/exploring-gnuradio/usrp-block-diagram.png
new file mode 100644
index 000000000..55a0f0b38
--- /dev/null
+++ b/docs/exploring-gnuradio/usrp-block-diagram.png
Binary files differ
diff --git a/docs/sphinx/CMakeLists.txt b/docs/sphinx/CMakeLists.txt
new file mode 100644
index 000000000..38d77fb3a
--- /dev/null
+++ b/docs/sphinx/CMakeLists.txt
@@ -0,0 +1,35 @@
+# 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.
+
+include(GrPython)
+
+configure_file(
+ ${CMAKE_CURRENT_SOURCE_DIR}/source/conf.py.in
+ ${CMAKE_CURRENT_BINARY_DIR}/conf.py
+@ONLY)
+
+configure_file(
+ ${CMAKE_CURRENT_SOURCE_DIR}/run_sphinx_build.sh.in
+ ${CMAKE_BINARY_DIR}/run_sphinx_build.sh
+@ONLY)
+
+if(UNIX)
+ #make the shell file executable
+ execute_process(COMMAND chmod +x ${CMAKE_BINARY_DIR}/run_sphinx_build.sh)
+endif(UNIX)
diff --git a/docs/sphinx/README b/docs/sphinx/README
new file mode 100644
index 000000000..0ae3a43f8
--- /dev/null
+++ b/docs/sphinx/README
@@ -0,0 +1,72 @@
+INTRODUCTION
+The Sphinx documentation system uses the fully installed Python tree
+to build a set of documents (generally in HTML). In GNU Radio, the
+documentation system is done through Doxygen in the public header
+(/include/foo.h) files. Doxygen first builds its documentation files,
+then the swig_docs program uses Doxygen's XML output and smashed the
+documentation from each header file into the SWIG'd Python
+block. Basically, using a single documentation markup, Doxygen, we
+expose the documentation strings in both the Doxygen-built manual and
+within the Python blocks themselves.
+
+Sphinx takes this process one step farther by reading the docstrings
+of all Python blocks and creating its own manual. This has two
+benefits. First, the Sphinx documentation looks nice and is formatted
+in such a way that Python users of GNU Radio can easy see the module
+structure and hierarchy. It also not only takes the Doxygen
+documentation from C++, but it also allows us to take any Python files
+and include their documentation.
+
+The end result is two manuals: one for Python and one for C++ users
+without having to duplicate comments, markup, or documentation.
+
+
+BUILDING THE SPHINX MANUAL
+Building the Sphinx docs takes some manual intervention as it
+requires GNU Radio to already be installed. So first follow the steps
+to build and install GNU Radio.
+
+In the build directory, a helper file is created called
+run_sphinx_build.sh. This is a Linux shell script that runs the
+sphinx-build command with all of the normal settings and important
+directories preloaded. For non Linux systems, it should be easy to
+pull out the executable and options to run it by hand.
+
+The run_sphinx_build.sh outputs the manual into
+$builddir/docs/sphinx/sphinx_out. Open up the index.html file in a
+browser to view it.
+
+ADDING NEW CONTENT TO THE SPHINX MANUAL
+Although the content of the sphinx manual is automatically generated,
+new blocks are not automatically added to the generated documentation.
+The procedure for adding new content is best illustrated with two
+examples.
+
+1) Adding a new C++ signal processing block gnuradio.gr.myslicer
+ Edit file gnuradio/docs/sphinx/source/gr/index.rst and add the line
+ > gnuradio.gr.myslicer
+ under the "Slicing and Dicing Streams" subheading.
+ Edit file gnuradio/docs/sphinx/source/gr/slicedice_blk.rst and add
+ the line
+ >.. autooldblock:: gnuradio.gr.myslicer
+
+2) Adding a new python hierarchical block gnuradio.digital.mymod
+ Edit file gnruadio/docs/sphinx/source/digital/index.rst and add the
+ line
+ > gnuradio.digital.mymod
+ under the "Signal Processing Blocks" subheading.
+ Edit file gnuradio/docs/sphinx/source/digital/blocks.rst and add
+ the line
+ >.. autopyblock:: gnuradio.digital.mymod
+ Notice that the 'autopyblock' directive is used rather than the
+ 'autoblock' directive. This lets sphinx know that it is displaying
+ a python hierarchical signal processing block so that it can format
+ it appropriately.
+
+The process for documenting objects that are not signal processing
+blocks is similar but rather than using the 'autooldblock', and
+'autopyblock' directives the standard sphinx directives such as
+'autofunction' and 'autoclass' can be used.
+
+Finally for signal processing blocks using the 3.7 style the directive
+'autoblock' rather than 'autooldblock' can be used. \ No newline at end of file
diff --git a/docs/sphinx/gnuradio_sphinx.py b/docs/sphinx/gnuradio_sphinx.py
new file mode 100644
index 000000000..06a3150c4
--- /dev/null
+++ b/docs/sphinx/gnuradio_sphinx.py
@@ -0,0 +1,208 @@
+"""
+Customizations of sphinx for gnuradio use.
+"""
+
+from sphinx.ext.autodoc import py_ext_sig_re
+from sphinx.ext.autodoc import ClassDocumenter, FunctionDocumenter, members_option
+from sphinx.ext.autodoc import bool_option, members_set_option, identity
+from sphinx.ext.autodoc import ALL
+
+# A dictionary of the number of lines to delete from the beginning of docstrings
+lines_to_delete = {}
+
+def setup(sp):
+ # Fix line-breaks in signature.
+ sp.connect('autodoc-process-signature', fix_signature)
+ sp.connect('autodoc-process-docstring', remove_lines)
+ # Add node to autodocument signal-processing blocks.
+ sp.add_autodocumenter(OldBlockDocumenter)
+ sp.add_autodocumenter(BlockDocumenter)
+ sp.add_autodocumenter(PyBlockDocumenter)
+
+def remove_lines(app, what, name, obj, options, lines):
+ del_lines = lines_to_delete.get(name, 0)
+ # Don't delete any lines if this is called again.
+ lines_to_delete[name] = 0
+ lines[:] = lines[del_lines:]
+
+def fix_signature(app, what, name, obj, options, signature, return_annotation):
+ """
+ SWIG produces signature at the top of docstrings of the form
+ 'blah(int arg1, float arg2) -> return_type'
+ and if the string is long it breaks it over multiple lines.
+
+ Sphinx gets confused if it is broken over multiple lines.
+ fix_signature and remove_lines get around this problem.
+ """
+ if return_annotation is not None:
+ return
+
+ if hasattr(obj, '__doc__'):
+ docs = obj.__doc__
+ else:
+ docs = None
+ if not docs:
+ return None
+ doclines = docs.split('\n')
+ del_lines = remove_linebreaks_in_signature(doclines)
+ # match first line of docstring against signature RE
+ match = py_ext_sig_re.match(doclines[0])
+ if not match:
+ return None
+ exmod, path, base, args, retann = match.groups()
+ # ok, now jump over remaining empty lines and set the remaining
+ # lines as the new doclines
+ i = 1
+ while i < len(doclines) and not doclines[i].strip():
+ i += 1
+ lines_to_delete[name] = i - 1 + del_lines
+ # format args
+ signature = "({0})".format(args)
+ return signature, retann
+
+def remove_linebreaks_in_signature(lines):
+ alllines = '\n'.join(lines)
+ alllines = alllines.lstrip()
+ bits = alllines.split('->')
+ if len(bits) == 1:
+ return 0
+ after = '->'.join(bits[1:])
+ after_lines = after.split('\n')
+ ending = None
+ remainder = []
+ for line in after_lines:
+ if line and ending is None:
+ ending = line
+ elif ending is not None:
+ remainder.append(line)
+ first_line = ' '.join([a.strip() for a in bits[0].split('\n') if a.strip()]) + ' -> ' + ending.strip()
+ match = py_ext_sig_re.match(first_line)
+ # If it is a signature, make the change to lines.
+ if match:
+ new_lines = [first_line] + remainder
+ lines[:] = new_lines
+ return len(bits[0].split('\n'))
+ else:
+ return 0
+
+# These methods are not displayed in the documentation of blocks to
+# avoid redundancy.
+common_block_members =[
+ 'check_topology',
+ 'detail',
+ 'history',
+ 'input_signature',
+ 'name',
+ 'nitems_read',
+ 'nitems_written',
+ 'nthreads',
+ 'output_multiple',
+ 'output_signature',
+ 'relative_rate',
+ 'set_detail',
+ 'set_nthreads',
+ 'start',
+ 'stop',
+ 'thisown',
+ 'to_basic_block',
+ 'unique_id',
+ 'make',
+ 'alias',
+ 'is_set_max_noutput_items',
+ 'max_noutput_items',
+ 'max_output_buffer',
+ 'message_ports_in',
+ 'message_ports_out',
+ 'min_output_buffer',
+ 'pc_input_buffers_full',
+ 'pc_input_buffers_full_var',
+ 'pc_noutput_items',
+ 'pc_noutput_items_var',
+ 'pc_nproduced',
+ 'pc_nproduced_var',
+ 'pc_output_buffers_full',
+ 'pc_output_buffers_full_var',
+ 'pc_work_time',
+ 'pc_work_time_var',
+ 'processor_affinity',
+ 'set_block_alias',
+ 'set_max_noutput_items',
+ 'unset_max_noutput_items',
+ 'set_max_output_buffer',
+ 'set_min_output_buffer',
+ 'set_processor_affinity',
+ 'symbol_name',
+ 'unset_processor_affinity', ]
+
+class OldBlockDocumenter(FunctionDocumenter):
+ """
+ Specialized Documenter subclass for gnuradio blocks.
+
+ It merges together the documentation for the generator function (e.g. gr.head)
+ with the wrapped sptr (e.g. gr.gr_head_sptr) to keep the documentation
+ tidier.
+ """
+ objtype = 'oldblock'
+ directivetype = 'function'
+ # Don't want to use this for generic functions for give low priority.
+ priority = -10
+
+ def __init__(self, *args, **kwargs):
+ super(OldBlockDocumenter, self).__init__(*args, **kwargs)
+ # Get class name
+ bits = self.name.split('.')
+ if len(bits) != 3 or bits[0] != 'gnuradio':
+ raise ValueError("expected name to be of form gnuradio.x.y but it is {0}".format(self.name))
+ sptr_name = 'gnuradio.{0}.{0}_{1}_sptr'.format(bits[1], bits[2])
+ # Create a Class Documenter to create documentation for the classes members.
+ self.classdoccer = ClassDocumenter(self.directive, sptr_name, indent=self.content_indent)
+ self.classdoccer.doc_as_attr = False
+ self.classdoccer.real_modname = self.classdoccer.get_real_modname()
+ self.classdoccer.options.members = ALL
+ self.classdoccer.options.exclude_members = common_block_members
+ self.classdoccer.parse_name()
+ self.classdoccer.import_object()
+
+ def document_members(self, *args, **kwargs):
+ return self.classdoccer.document_members(*args, **kwargs)
+
+class BlockDocumenter(FunctionDocumenter):
+ """
+ Specialized Documenter subclass for new style gnuradio blocks.
+
+ It merges together the documentation for the generator function (e.g. wavelet.squash_ff)
+ with the wrapped sptr (e.g. wavelet.squash_ff_sptr) to keep the documentation
+ tidier.
+ """
+ objtype = 'block'
+ directivetype = 'function'
+ # Don't want to use this for generic functions for give low priority.
+ priority = -10
+
+ def __init__(self, *args, **kwargs):
+ super(BlockDocumenter, self).__init__(*args, **kwargs)
+ # Get class name
+ sptr_name = self.name + '_sptr'
+ # Create a Class Documenter to create documentation for the classes members.
+ self.classdoccer = ClassDocumenter(self.directive, sptr_name, indent=self.content_indent)
+ self.classdoccer.doc_as_attr = False
+ self.classdoccer.real_modname = self.classdoccer.get_real_modname()
+ self.classdoccer.options.members = ALL
+ self.classdoccer.options.exclude_members = common_block_members
+ self.classdoccer.parse_name()
+ self.classdoccer.import_object()
+
+ def document_members(self, *args, **kwargs):
+ return self.classdoccer.document_members(*args, **kwargs)
+
+class PyBlockDocumenter(ClassDocumenter):
+ """
+ Specialized Documenter subclass for hierarchical python gnuradio blocks.
+ """
+ objtype = 'pyblock'
+ directivetype = 'class'
+
+ def __init__(self, *args, **kwargs):
+ super(PyBlockDocumenter, self).__init__(*args, **kwargs)
+ self.options.members = ALL
+ self.options.exclude_members = common_block_members
diff --git a/docs/sphinx/hieroglyph/LICENSE.txt b/docs/sphinx/hieroglyph/LICENSE.txt
new file mode 100644
index 000000000..3f7a63830
--- /dev/null
+++ b/docs/sphinx/hieroglyph/LICENSE.txt
@@ -0,0 +1,26 @@
+Copyright (c) 2011, Robert Smallshire
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of Robert Smallshire nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
diff --git a/docs/sphinx/hieroglyph/README.txt b/docs/sphinx/hieroglyph/README.txt
new file mode 100644
index 000000000..c26409d89
--- /dev/null
+++ b/docs/sphinx/hieroglyph/README.txt
@@ -0,0 +1,10 @@
+Sphinx is a popular tool for documenting Python APIs which uses reStructuredText
+as a its lightweight markup language. Sphinx extends restructured text with
+semantic markup elements for documenting Python APIs but once these are used the
+ratio of markup to content becomes too high and readability is compromised
+enough that the docstring becomes unsuitable for use with standard Python
+introspection mechanisms like help() or IDEs.
+
+Hieroglyph is an a Sphinx extension which automatically converts a highly
+readable docstring format suitable for use with help() and IDEs to the
+reStructuredText hieroglyphics required by Sphinx. \ No newline at end of file
diff --git a/docs/sphinx/hieroglyph/__init__.py b/docs/sphinx/hieroglyph/__init__.py
new file mode 100644
index 000000000..25dea27fb
--- /dev/null
+++ b/docs/sphinx/hieroglyph/__init__.py
@@ -0,0 +1,6 @@
+# We only need to expose the setup function to Sphinx
+
+from .hieroglyph import setup
+from .version import __version__
+
+__author__ = 'Robert Smallshire' \ No newline at end of file
diff --git a/docs/sphinx/hieroglyph/errors.py b/docs/sphinx/hieroglyph/errors.py
new file mode 100644
index 000000000..334b097d8
--- /dev/null
+++ b/docs/sphinx/hieroglyph/errors.py
@@ -0,0 +1,10 @@
+
+from sphinx.errors import ExtensionError
+
+__author__ = 'rjs'
+
+class HieroglyphError(ExtensionError):
+ '''
+ An exception type specific to the Hieroglyph Sphinx extension.
+ '''
+ pass \ No newline at end of file
diff --git a/docs/sphinx/hieroglyph/hieroglyph.py b/docs/sphinx/hieroglyph/hieroglyph.py
new file mode 100644
index 000000000..0056d9ab8
--- /dev/null
+++ b/docs/sphinx/hieroglyph/hieroglyph.py
@@ -0,0 +1,404 @@
+from __future__ import print_function
+
+import re
+
+from errors import HieroglyphError
+from nodes import (Node, Raises, Except, Note, Warning, Returns, Arg,
+ ensure_terminal_blank)
+
+__author__ = 'Robert Smallshire'
+
+def parse_hieroglyph_text(lines):
+ '''Parse text in hieroglyph format and return a reStructuredText equivalent
+
+ Args:
+ lines: A sequence of strings representing the lines of a single
+ docstring as read from the source by Sphinx. This string should be
+ in a format that can be parsed by hieroglyph.
+
+ Returns:
+ A list of lines containing the transformed docstring as
+ reStructuredText as produced by hieroglyph.
+
+ Raises:
+ RuntimeError: If the docstring cannot be parsed.
+ '''
+ indent_lines = unindent(lines)
+ indent_lines = pad_blank_lines(indent_lines)
+ indent_lines = first_paragraph_indent(indent_lines)
+ indent_paragraphs = gather_lines(indent_lines)
+ parse_tree = group_paragraphs(indent_paragraphs)
+ syntax_tree = extract_structure(parse_tree)
+ result = syntax_tree.render_rst()
+ ensure_terminal_blank(result)
+ return result
+
+
+def unindent(lines):
+ '''Convert an iterable of indented lines into a sequence of tuples.
+
+ The first element of each tuple is the indent in number of characters, and
+ the second element is the unindented string.
+
+ Args:
+ lines: A sequence of strings representing the lines of text in a docstring.
+
+ Returns:
+ A list of tuples where each tuple corresponds to one line of the input
+ list. Each tuple has two entries - the first is an integer giving the
+ size of the indent in characters, the second is the unindented text.
+ '''
+ unindented_lines = []
+ for line in lines:
+ unindented_line = line.lstrip()
+ indent = len(line) - len(unindented_line)
+ unindented_lines.append((indent, unindented_line))
+ return unindented_lines
+
+
+def pad_blank_lines(indent_texts):
+ '''Give blank (empty) lines the same indent level as the preceding line.
+
+ Args:
+ indent_texts: An iterable of tuples each containing an integer in the
+ first element and a string in the second element.
+
+ Returns:
+ A list of tuples each containing an integer in the first element and a
+ string in the second element.
+ '''
+ current_indent = 0
+ result = []
+ for indent, text in indent_texts:
+ if len(text) > 0:
+ current_indent = indent
+ result.append((current_indent, text))
+ return result
+
+
+def extract_structure(parse_tree):
+ '''Create an Abstract Syntax Tree representing the semantics of a parse tree.
+
+ Args:
+ parse_tree: TODO
+
+ Returns:
+ A Node with is the result of an Abstract Syntax Tree representing the
+ docstring.
+
+ Raises:
+ HieroglyphError: In the event that the parse tree cannot be understood.
+ '''
+ return convert_node(parse_tree)
+
+
+def convert_node(node):
+ if node.indent == 0 and len(node.lines) == 0:
+ return convert_children(node)
+ if node.lines[0].startswith('Args:'):
+ return convert_args(node)
+ if node.lines[0].startswith('Returns:'):
+ return convert_returns(node)
+ if node.lines[0].startswith('Raises:'):
+ return convert_raises(node)
+ if node.lines[0].startswith('Note:'):
+ return convert_note(node)
+ if node.lines[0].startswith('Warning:'):
+ return convert_warning(node)
+ result = convert_children(node)
+ result.lines = node.lines
+ result.indent = node.indent
+ return result
+
+
+def convert_children(node):
+ converted_children = [convert_node(child) for child in node.children]
+ result = Node()
+ result.children = converted_children
+ return result
+
+
+ARG_REGEX = re.compile(r'(\*{0,2}\w+)(\s+\((\w+)\))?\s*:\s*(.*)')
+
+def append_child_to_args_group_node(child, group_node, indent):
+ arg = None
+ non_empty_lines = (line for line in child.lines if line)
+ for line in non_empty_lines:
+ m = ARG_REGEX.match(line)
+ if m is None:
+ raise HieroglyphError("Invalid hieroglyph argument syntax: {0}".format(line))
+ param_name = m.group(1)
+ param_type = m.group(3)
+ param_text = m.group(4)
+
+ arg = Arg(indent, child.indent, param_name)
+ group_node.children.append(arg)
+ arg.type = param_type
+
+ if param_text is not None:
+ arg.children.append(Node(indent, [param_text], arg))
+ if arg is not None:
+ last_child = arg.children[-1] if len(arg.children) != 0 else arg
+ for grandchild in child.children:
+ last_child.children.append(grandchild)
+
+
+def convert_args(node):
+ assert node.lines[0].startswith('Args:')
+ group_node = Node()
+ for child in node.children:
+ append_child_to_args_group_node(child, group_node, node.indent)
+ return group_node
+
+
+def convert_returns(node):
+ assert node.lines[0].startswith('Returns:')
+ returns = Returns(node.indent)
+ returns.line = node.lines[0][8:].strip()
+ returns.children = node.children
+ return returns
+
+
+def convert_note(node):
+ assert node.lines[0].startswith('Note:')
+ note = Note(node.indent)
+ note.line = node.lines[0][5:].strip()
+ note.children = node.children
+ return note
+
+
+def convert_warning(node):
+ assert node.lines[0].startswith('Warning:')
+ warning = Warning(node.indent)
+ warning.line = node.lines[0][8:].strip()
+ warning.children = node.children
+ return warning
+
+
+def convert_raises(node):
+ assert node.lines[0].startswith('Raises:')
+ group_node = Raises(node.indent)
+ for child in node.children:
+ append_child_to_raise_node(child, group_node)
+ return group_node
+
+
+RAISE_REGEX = re.compile(r'(\w+)\s*:\s*(.*)')
+
+def extract_exception_type_and_text(line):
+ m = RAISE_REGEX.match(line)
+ if m is None:
+ raise HieroglyphError("Invalid hieroglyph exception syntax: {0}".format(line))
+ return (m.group(2), m.group(1))
+
+
+def append_child_to_raise_node(child, group_node):
+ exception = None
+ non_empty_lines = (line for line in child.lines if line)
+ for line in non_empty_lines:
+ exception_text, exception_type = extract_exception_type_and_text(line)
+
+ exception = Except(child.indent, exception_type)
+ group_node.children.append(exception) # TODO: Could use parent here.
+
+ if exception_text is not None:
+ exception.children.append( Node(child.indent,
+ [exception_text], exception))
+ if exception is not None:
+ last_child = exception.children[-1] if len(exception.children) != 0 else exception
+ for grandchild in child.children:
+ last_child.children.append(grandchild)
+
+
+def group_paragraphs(indent_paragraphs):
+ '''
+ Group paragraphs so that more indented paragraphs become children of less
+ indented paragraphs.
+ '''
+ # The tree consists of tuples of the form (indent, [children]) where the
+ # children may be strings or other tuples
+
+ root = Node(0, [], None)
+ current_node = root
+
+ previous_indent = -1
+ for indent, lines in indent_paragraphs:
+ if indent > previous_indent:
+ current_node = create_child_node(current_node, indent, lines)
+ elif indent == previous_indent:
+ current_node = create_sibling_node(current_node, indent, lines)
+ elif indent < previous_indent:
+ current_node = create_uncle_node(current_node, indent, lines)
+ previous_indent = indent
+ return root
+
+
+def create_sibling_node(current_node, indent, lines):
+ sibling = Node(indent, lines, current_node.parent)
+ current_node.parent.add_child(sibling)
+ current_node = sibling
+ return current_node
+
+
+def create_child_node(current_node, indent, lines):
+ child = Node(indent, lines, current_node)
+ current_node.add_child(child)
+ current_node = child
+ return current_node
+
+
+def create_uncle_node(current_node, indent, lines):
+ ancestor = current_node
+ while ancestor.indent >= indent:
+ if ancestor.parent is None:
+ break
+ ancestor = ancestor.parent
+ uncle = Node(indent, lines, ancestor)
+ ancestor.add_child(uncle)
+ current_node = uncle
+ return current_node
+
+
+def gather_lines(indent_lines):
+ '''Split the list of (int, str) tuples into a list of (int, [str]) tuples
+ to group the lines into paragraphs of consistent indent.
+ '''
+ return remove_empty_paragraphs(split_separated_lines(gather_lines_by_indent(indent_lines)))
+
+def gather_lines_by_indent(indent_lines):
+ result = []
+ previous_indent = -1
+ for indent, line in indent_lines:
+ if indent != previous_indent:
+ paragraph = (indent, [])
+ result.append(paragraph)
+ else:
+ paragraph = result[-1]
+ paragraph[1].append(line)
+ previous_indent = indent
+ return result
+
+def split_separated_lines(indent_paragraphs):
+ result = []
+ for indent, paragraph in indent_paragraphs:
+ result.append((indent, []))
+
+ if len(paragraph) > 0:
+ result[-1][1].append(paragraph[0])
+
+ if len(paragraph) > 2:
+ for line in paragraph[1: -1]:
+ result[-1][1].append(line)
+ if len(line) == 0:
+ result.append((indent, []))
+
+ if len(paragraph) > 1:
+ result[-1][1].append(paragraph[-1])
+
+ return result
+
+def remove_empty_paragraphs(indent_paragraphs):
+ return [(indent, paragraph) for indent, paragraph in indent_paragraphs if len(paragraph)]
+
+def first_paragraph_indent(indent_texts):
+ '''Fix the indentation on the first paragraph.
+
+ This occurs because the first line of a multi-line docstring following the
+ opening quote usually has no indent.
+
+ Args:
+ indent_texts: The lines of the docstring as an iterable over 2-tuples
+ each containing an integer indent level as the first element and
+ the text as the second element.
+
+ Return:
+ A list of 2-tuples, each containing an integer indent level as the
+ first element and the text as the second element.
+ '''
+ opening_indent = determine_opening_indent(indent_texts)
+
+ result = []
+ input = iter(indent_texts)
+ for indent, text in input:
+ if indent == 0:
+ result.append((opening_indent, text))
+ else:
+ result.append((indent, text))
+ break
+
+ for indent, text in input:
+ result.append((indent, text))
+
+ return result
+
+
+def determine_opening_indent(indent_texts):
+ '''Determine the opening indent level for a docstring.
+
+ The opening indent level is the indent level is the first non-zero indent
+ level of a non-empty line in the docstring.
+
+ Args:
+ indent_texts: The lines of the docstring as an iterable over 2-tuples
+ each containing an integer indent level as the first element and
+ the text as the second element.
+
+ Returns:
+ The opening indent level as an integer.
+ '''
+ num_lines = len(indent_texts)
+
+ if num_lines < 1:
+ return 0
+
+ assert num_lines >= 1
+
+ first_line_indent = indent_texts[0][0]
+
+ if num_lines == 1:
+ return first_line_indent
+
+ assert num_lines >= 2
+
+ second_line_indent = indent_texts[1][0]
+ second_line_text = indent_texts[1][1]
+
+ if len(second_line_text) == 0:
+ return first_line_indent
+
+ return second_line_indent
+
+
+
+def rewrite_autodoc(app, what, name, obj, options, lines):
+ '''Convert lines from Hieroglyph to Sphinx format.
+
+ The function to be called by the Sphinx autodoc extension when autodoc
+ has read and processed a docstring. This function modified its
+ ``lines`` argument *in place* replacing Hieroglyph syntax input into
+ Sphinx reStructuredText output.
+
+ Args:
+ apps: The Sphinx application object.
+
+ what: The type of object which the docstring belongs to. One of
+ 'module', 'class', 'exception', 'function', 'method', 'attribute'
+
+ name: The fully qualified name of the object.
+
+ obj: The object itself.
+
+ options: The options given to the directive. An object with attributes
+ ``inherited_members``, ``undoc_members``, ``show_inheritance`` and
+ ``noindex`` that are ``True`` if the flag option of the same name
+ was given to the auto directive.
+
+ lines: The lines of the docstring. Will be modified *in place*.
+ '''
+ lines[:] = parse_hieroglyph_text(lines)
+
+
+def setup(app):
+ app.connect('autodoc-process-docstring', rewrite_autodoc)
+
+
diff --git a/docs/sphinx/hieroglyph/nodes.py b/docs/sphinx/hieroglyph/nodes.py
new file mode 100644
index 000000000..e583ce04d
--- /dev/null
+++ b/docs/sphinx/hieroglyph/nodes.py
@@ -0,0 +1,267 @@
+__author__ = 'Robert Smallshire'
+
+class Node(object):
+
+ def __init__(self, indent=None, lines=None, parent=None):
+ if indent is not None:
+ self.indent = indent
+ else:
+ self.indent = 0
+
+ if lines is not None:
+ self.lines = lines
+ else:
+ self.lines = []
+
+ self._parent = parent
+
+ self.children = []
+
+ parent = property(lambda self: self._parent)
+
+ def add_child(self, child):
+ assert(child.parent is self)
+ self.children.append(child)
+
+
+ def __repr__(self):
+ return "Node(" + repr(self.indent) + ", " + repr(self.lines) + ", children=" + repr(self.children) + ")"
+
+
+ def render_rst(self, *args, **kwargs):
+ result = []
+ prefix = ' ' * self.indent
+ result.extend(prefix + line for line in self.lines)
+ for child in self.children:
+ result.extend(child.render_rst())
+ return result
+
+
+
+class Arg(Node):
+
+ def __init__(self, indent, child_indent, name):
+ super(Arg, self).__init__(indent)
+ self.child_indent = child_indent
+ self.name = name
+ self.type = None
+
+
+ def __repr__(self):
+ return "Arg(" + repr(self.name) + ", " + repr(self.type) + ", children=" + repr(self.children) + ")"
+
+
+ def render_rst(self, *args, **kwargs):
+ result = []
+ indent = ' ' * self.indent
+
+ # Render the param description
+ description = []
+ for child in self.children:
+ child_lines = child.render_rst()
+ description.extend(child_lines)
+
+ dedent = self.child_indent - self.indent
+
+ name = self.name.replace('*', r'\*')
+
+ first_description = description[0].lstrip() if len(description) else ''
+ if not first_description:
+ # TODO: Emit a warning about a missing argument description
+ pass
+
+ result.append("{indent}:param {name}: {first_description}".format(indent=indent, name=name,
+ first_description=first_description))
+
+ dedented_body = [line[dedent:] for line in description[1:]]
+
+ result.extend(dedented_body)
+
+ # If a type was specified render the type
+ if self.type is not None:
+ result.append("{indent}:type {name}: {type}".format(indent=indent, name=self.name, type=self.type))
+ result.append('')
+
+ ensure_terminal_blank(result)
+
+ return result
+
+
+
+class Raises(Node):
+
+ def __init__(self, indent=None):
+ super(Raises, self).__init__(indent=indent)
+
+ def __repr__(self):
+ return "Raises(" + repr(self.indent) + ", children=" + repr(self.children) + ")"
+
+
+ def render_rst(self, *args, **kwargs):
+ result = []
+ indent = ' ' * self.indent
+ result.append(indent + ':raises:')
+ for child in self.children:
+ result.extend(child.render_rst(only_child=len(self.children) == 1))
+
+ ensure_terminal_blank(result)
+
+ return result
+
+
+class Except(Node):
+
+ def __init__(self, indent, type):
+ super(Except, self).__init__(indent=indent)
+ #self.child_indent = child_indent
+ self.type = type
+
+
+ def __repr__(self):
+ return "Except(" + repr(self.type) + ", children=" + repr(self.children) + ")"
+
+
+ def render_rst(self, only_child=False, *args, **kwargs):
+ result = []
+ indent = ' ' * self.indent
+
+ # Render the param description
+ description = []
+ for child in self.children:
+ child_lines = child.render_rst()
+ description.extend(child_lines)
+
+ #dedent = self.child_indent - self.indent
+ bullet = '* ' if not only_child else ''
+
+ first_description = description[0].lstrip() if len(description) else ''
+ result.append("{indent}{bullet}{type} - {first_description}".format(indent=indent,
+ bullet=bullet, type=self.type,
+ first_description=first_description))
+
+ #dedented_body = [' ' * len(bullet) + line[dedent:] for line in description[1:]]
+ #result.extend(dedented_body)
+ result.extend(description[1:])
+ ensure_terminal_blank(result)
+
+ return result
+
+
+
+class Returns(Node):
+
+ def __init__(self, indent):
+ super(Returns, self).__init__(indent=indent)
+ self.title = 'Returns'
+ self.line = ''
+
+
+ def __repr__(self):
+ return "Returns(" + str(self.indent) + ", children=" + str(self.children) + ")"
+
+
+ def render_rst(self, *args, **kwargs):
+ result = []
+ indent = ' ' * self.indent
+
+ # Render the param description
+ description = [self.line] if self.line else []
+ for child in self.children:
+ child_lines = child.render_rst()
+ description.extend(child_lines)
+
+ self.render_title(description, indent, result)
+
+ result.extend(description[1:])
+
+ ensure_terminal_blank(result)
+ return result
+
+
+ def render_title(self, description, indent, result):
+ result.append(
+ "{indent}:returns: {first_description}".format(indent=indent,
+ first_description=description[0].lstrip()))
+
+
+
+class Warning(Node):
+
+ def __init__(self, indent):
+ super(Warning, self).__init__(indent=indent)
+
+ def __repr__(self):
+ return "Warning(" + repr(self.indent) + ", children=" + str(self.children) + ")"
+
+ def render_rst(self, *args, **kwargs):
+ # TODO: Factor out the commonality between this and Note below
+ result = []
+ indent = ' ' * self.indent
+
+ # Render the param description
+ description = [self.line] if self.line else []
+ for child in self.children:
+ child_lines = child.render_rst()
+ description.extend(child_lines)
+
+ # Fix the indent on the first line
+ if len(description) > 1 and len(description[1].strip()) != 0:
+ body_indent = len(description[1]) - len(description[1].strip())
+ else:
+ body_indent = self.indent + 4
+
+ if len(description) > 0:
+ description[0] = ' ' * body_indent + description[0]
+
+ result.append(indent + ".. warning::")
+ result.append(indent + '')
+ result.extend(description)
+
+ ensure_terminal_blank(result)
+ return result
+
+
+class Note(Node):
+
+ def __init__(self, indent):
+ super(Note, self).__init__(indent=indent)
+ self.line = ''
+
+
+ def __repr__(self):
+ return "Note(" + repr(self.indent) + ", children=" + str(self.children) + ")"
+
+
+ def render_rst(self, *args, **kwargs):
+ # TODO: Factor out the commonality between this and Warning above
+ result = []
+ indent = ' ' * self.indent
+
+ # Render the param description
+ description = [self.line] if self.line else []
+ for child in self.children:
+ child_lines = child.render_rst()
+ description.extend(child_lines)
+
+ # Fix the indent on the first line
+ if len(description) > 1 and len(description[1].strip()) != 0:
+ body_indent = len(description[1]) - len(description[1].strip())
+ else:
+ body_indent = self.indent + 4
+
+ if len(description) > 0:
+ description[0] = ' ' * body_indent + description[0]
+
+ result.append(indent + ".. note::")
+ result.append(indent + '')
+ result.extend(description)
+
+ ensure_terminal_blank(result)
+ return result
+
+
+def ensure_terminal_blank(result):
+ '''If the description didn't end with a blank line add one here.'''
+ if len(result) > 0:
+ if len(result[-1].strip()) != 0:
+ result.append('')
diff --git a/docs/sphinx/hieroglyph/test/__init__.py b/docs/sphinx/hieroglyph/test/__init__.py
new file mode 100644
index 000000000..fd249423f
--- /dev/null
+++ b/docs/sphinx/hieroglyph/test/__init__.py
@@ -0,0 +1,2 @@
+__author__ = 'rjs'
+ \ No newline at end of file
diff --git a/docs/sphinx/hieroglyph/test/test_comments.py b/docs/sphinx/hieroglyph/test/test_comments.py
new file mode 100644
index 000000000..d1a1453ee
--- /dev/null
+++ b/docs/sphinx/hieroglyph/test/test_comments.py
@@ -0,0 +1,586 @@
+import unittest
+
+from hieroglyph.hieroglyph import parse_hieroglyph_text
+from hieroglyph.errors import HieroglyphError
+
+class CommentTests(unittest.TestCase):
+
+ def test_comment1(self):
+ source = """Fetches rows from a Bigtable.
+ This is a continuation of the opening paragraph.
+
+ Retrieves rows pertaining to the given keys from the Table instance
+ represented by big_table. Silly things may happen if
+ other_silly_variable is not None.
+
+ Args:
+ big_table: An open Bigtable Table instance.
+ keys: A sequence of strings representing the key of each table row
+ to fetch.
+ other_silly_variable (str): Another optional variable, that has a much
+ longer name than the other args, and which does nothing.
+
+ Returns:
+ A dict mapping keys to the corresponding table row data
+ fetched. Each row is represented as a tuple of strings. For
+ example:
+
+ {'Serak': ('Rigel VII', 'Preparer'),
+ 'Zim': ('Irk', 'Invader'),
+ 'Lrrr': ('Omicron Persei 8', 'Emperor')}
+
+ If a key from the keys argument is missing from the dictionary,
+ then that row was not found in the table.
+
+ Raises:
+ IOError: An error occurred accessing the bigtable.Table object.
+ """
+
+ expected = """ Fetches rows from a Bigtable.
+ This is a continuation of the opening paragraph.
+
+ Retrieves rows pertaining to the given keys from the Table instance
+ represented by big_table. Silly things may happen if
+ other_silly_variable is not None.
+
+ :param big_table: An open Bigtable Table instance.
+
+ :param keys: A sequence of strings representing the key of each table row
+ to fetch.
+
+ :param other_silly_variable: Another optional variable, that has a much
+ longer name than the other args, and which does nothing.
+
+ :type other_silly_variable: str
+
+ :returns: A dict mapping keys to the corresponding table row data
+ fetched. Each row is represented as a tuple of strings. For
+ example:
+
+ {'Serak': ('Rigel VII', 'Preparer'),
+ 'Zim': ('Irk', 'Invader'),
+ 'Lrrr': ('Omicron Persei 8', 'Emperor')}
+
+ If a key from the keys argument is missing from the dictionary,
+ then that row was not found in the table.
+
+ :raises:
+ IOError - An error occurred accessing the bigtable.Table object.
+ """
+ source_lines = source.splitlines()
+ actual_lines = parse_hieroglyph_text(source_lines)
+ expected_lines = expected.splitlines()
+ self.assertEqual(len(actual_lines), len(expected_lines))
+ for actual_line, result_line in zip(actual_lines, expected_lines):
+ if len(actual_line.strip()) == 0:
+ self.assertTrue(len(result_line.strip()) == 0)
+ else:
+ self.assertEqual(actual_line, result_line)
+
+ def test_comment2(self):
+ source = """Determine if all elements in the source sequence satisfy a condition.
+
+ All of the source sequence will be consumed.
+
+ Note: This method uses immediate execution.
+
+ Args:
+ predicate: An optional single argument function used to test each
+ elements. If omitted, the bool() function is used resulting in
+ the elements being tested directly.
+
+ Returns:
+ True if all elements in the sequence meet the predicate condition,
+ otherwise False.
+
+ Raises:
+ ValueError: If the Queryable is closed()
+ TypeError: If predicate is not callable.
+ """
+
+ expected = """Determine if all elements in the source sequence satisfy a condition.
+
+ All of the source sequence will be consumed.
+
+ .. note::
+
+ This method uses immediate execution.
+
+ :param predicate: An optional single argument function used to test each
+ elements. If omitted, the bool() function is used resulting in
+ the elements being tested directly.
+
+ :returns: True if all elements in the sequence meet the predicate condition,
+ otherwise False.
+
+ :raises:
+ * ValueError - If the Queryable is closed()
+
+ * TypeError - If predicate is not callable.
+ """
+ source_lines = source.splitlines()
+ actual_lines = parse_hieroglyph_text(source_lines)
+ expected_lines = expected.splitlines()
+ self.assertEqual(len(actual_lines), len(expected_lines))
+ for actual_line, result_line in zip(actual_lines, expected_lines):
+ if len(actual_line.strip()) == 0:
+ self.assertTrue(len(result_line.strip()) == 0)
+ else:
+ self.assertEqual(actual_line, result_line)
+
+ def test_comment3(self):
+ source = """Determine if all elements in the source sequence satisfy a condition.
+
+ All of the source sequence will be consumed.
+
+ Note: This method uses immediate execution.
+
+ Args:
+ predicate: An optional single argument function used to test each
+ elements. If omitted, the bool() function is used resulting in
+ the elements being tested directly.
+
+ Returns:
+ True if all elements in the sequence meet the predicate condition,
+ otherwise False.
+
+ Raises:
+ ValueError: If the Queryable is closed()
+ TypeError: If predicate is not callable.
+ """
+
+ expected = """Determine if all elements in the source sequence satisfy a condition.
+
+ All of the source sequence will be consumed.
+
+ .. note::
+
+ This method uses immediate execution.
+
+ :param predicate: An optional single argument function used to test each
+ elements. If omitted, the bool() function is used resulting in
+ the elements being tested directly.
+
+ :returns: True if all elements in the sequence meet the predicate condition,
+ otherwise False.
+
+ :raises:
+ * ValueError - If the Queryable is closed()
+
+ * TypeError - If predicate is not callable.
+ """
+ source_lines = source.splitlines()
+ actual_lines = parse_hieroglyph_text(source_lines)
+ expected_lines = expected.splitlines()
+ self.assertEqual(len(actual_lines), len(expected_lines))
+ for actual_line, result_line in zip(actual_lines, expected_lines):
+ if len(actual_line.strip()) == 0:
+ self.assertTrue(len(result_line.strip()) == 0)
+ else:
+ self.assertEqual(actual_line, result_line)
+
+ def test_comment4(self):
+ source_lines = [u'Determine if all elements in the source sequence satisfy a condition.',
+ u'',
+ u'All of the source sequence will be consumed.',
+ u'',
+ u'Note: This method uses immediate execution.',
+ u'',
+ u'Args:',
+ u' predicate: An optional single argument function used to test each',
+ u' elements. If omitted, the bool() function is used resulting in',
+ u' the elements being tested directly.',
+ u'',
+ u'Returns:',
+ u' True if all elements in the sequence meet the predicate condition,',
+ u' otherwise False.',
+ u'',
+ u'Raises:',
+ u' ValueError: If the Queryable is closed()',
+ u' TypeError: If predicate is not callable.',
+ u'']
+
+ expected = """Determine if all elements in the source sequence satisfy a condition.
+
+All of the source sequence will be consumed.
+
+.. note::
+
+ This method uses immediate execution.
+
+:param predicate: An optional single argument function used to test each
+ elements. If omitted, the bool() function is used resulting in
+ the elements being tested directly.
+
+:returns: True if all elements in the sequence meet the predicate condition,
+ otherwise False.
+
+:raises:
+ * ValueError - If the Queryable is closed()
+
+ * TypeError - If predicate is not callable.
+
+"""
+ actual_lines = parse_hieroglyph_text(source_lines)
+ expected_lines = expected.splitlines()
+ self.assertEqual(len(actual_lines), len(expected_lines))
+ for actual_line, result_line in zip(actual_lines, expected_lines):
+ if len(actual_line.strip()) == 0:
+ self.assertTrue(len(result_line.strip()) == 0)
+ else:
+ self.assertEqual(actual_line, result_line)
+
+ def test_comment5(self):
+ source_lines = [u'An empty Queryable.',
+ u'',
+ u'Note: The same empty instance will be returned each time.',
+ u'',
+ u'Returns: A Queryable over an empty sequence.',
+ u'']
+
+ expected = """An empty Queryable.
+
+.. note::
+
+ The same empty instance will be returned each time.
+
+:returns: A Queryable over an empty sequence.
+
+"""
+ actual_lines = parse_hieroglyph_text(source_lines)
+ expected_lines = expected.splitlines()
+ self.assertEqual(len(actual_lines), len(expected_lines))
+ for actual_line, result_line in zip(actual_lines, expected_lines):
+ if len(actual_line.strip()) == 0:
+ self.assertTrue(len(result_line.strip()) == 0)
+ else:
+ self.assertEqual(actual_line, result_line)
+
+ def test_comment6(self):
+ source_lines = [u'A convenience factory for creating Records.',
+ u'',
+ u'Args:',
+ u' **kwargs: Each keyword argument will be used to initialise an',
+ u' attribute with the same name as the argument and the given',
+ u' value.',
+ u'',
+ u'Returns:',
+ u' A Record which has a named attribute for each of the keyword arguments.',
+ u'']
+
+ expected = """A convenience factory for creating Records.
+
+:param \*\*kwargs: Each keyword argument will be used to initialise an
+ attribute with the same name as the argument and the given
+ value.
+
+:returns: A Record which has a named attribute for each of the keyword arguments.
+
+"""
+ actual_lines = parse_hieroglyph_text(source_lines)
+ expected_lines = expected.splitlines()
+ self.assertEqual(len(actual_lines), len(expected_lines))
+ for actual_line, result_line in zip(actual_lines, expected_lines):
+ if len(actual_line.strip()) == 0:
+ self.assertTrue(len(result_line.strip()) == 0)
+ else:
+ self.assertEqual(actual_line, result_line)
+
+ def test_comment7(self):
+ source = """Projects each element of a sequence to an intermediate new sequence,
+ flattens the resulting sequences into one sequence and optionally
+ transforms the flattened sequence using a selector function.
+
+ Note: This method uses deferred execution.
+
+ Args:
+ collection_selector: A unary function mapping each element of the
+ source iterable into an intermediate sequence. The single
+ argument of the collection_selector is the value of an element
+ from the source sequence. The return value should be an
+ iterable derived from that element value. The default
+ collection_selector, which is the identity function, assumes
+ that each element of the source sequence is itself iterable.
+
+ result_selector: An optional unary function mapping the elements in
+ the flattened intermediate sequence to corresponding elements
+ of the result sequence. The single argument of the
+ result_selector is the value of an element from the flattened
+ intermediate sequence. The return value should be the
+ corresponding value in the result sequence. The default
+ result_selector is the identity function.
+
+ Returns:
+ A Queryable over a generated sequence whose elements are the result
+ of applying the one-to-many collection_selector to each element of
+ the source sequence, concatenating the results into an intermediate
+ sequence, and then mapping each of those elements through the
+ result_selector into the result sequence.
+
+ Raises:
+ ValueError: If this Queryable has been closed.
+ TypeError: If either collection_selector or result_selector are not
+ callable.
+ """
+
+ expected = """ Projects each element of a sequence to an intermediate new sequence,
+ flattens the resulting sequences into one sequence and optionally
+ transforms the flattened sequence using a selector function.
+
+ .. note::
+
+ This method uses deferred execution.
+
+ :param collection_selector: A unary function mapping each element of the
+ source iterable into an intermediate sequence. The single
+ argument of the collection_selector is the value of an element
+ from the source sequence. The return value should be an
+ iterable derived from that element value. The default
+ collection_selector, which is the identity function, assumes
+ that each element of the source sequence is itself iterable.
+
+ :param result_selector: An optional unary function mapping the elements in
+ the flattened intermediate sequence to corresponding elements
+ of the result sequence. The single argument of the
+ result_selector is the value of an element from the flattened
+ intermediate sequence. The return value should be the
+ corresponding value in the result sequence. The default
+ result_selector is the identity function.
+
+ :returns: A Queryable over a generated sequence whose elements are the result
+ of applying the one-to-many collection_selector to each element of
+ the source sequence, concatenating the results into an intermediate
+ sequence, and then mapping each of those elements through the
+ result_selector into the result sequence.
+
+ :raises:
+ * ValueError - If this Queryable has been closed.
+
+ * TypeError - If either collection_selector or result_selector are not
+ callable.
+ """
+ source_lines = source.splitlines()
+ actual_lines = parse_hieroglyph_text(source_lines)
+ expected_lines = expected.splitlines()
+ self.assertEqual(len(actual_lines), len(expected_lines))
+ for actual_line, result_line in zip(actual_lines, expected_lines):
+ if len(actual_line.strip()) == 0:
+ self.assertTrue(len(result_line.strip()) == 0)
+ else:
+ self.assertEqual(actual_line, result_line)
+
+ def test_comment8(self):
+ source = """A convenience factory for creating Records.
+
+ Args:
+ **kwargs: Each keyword argument will be used to initialise an
+ attribute with the same name as the argument and the given
+ value.
+
+ Returns:
+ A Record which has a named attribute for each of the keyword arguments.
+ """
+
+ expected = """A convenience factory for creating Records.
+
+ :param \*\*kwargs: Each keyword argument will be used to initialise an
+ attribute with the same name as the argument and the given
+ value.
+
+ :returns: A Record which has a named attribute for each of the keyword arguments.
+
+"""
+ source_lines = source.splitlines()
+ actual_lines = parse_hieroglyph_text(source_lines)
+ expected_lines = expected.splitlines()
+ self.assertEqual(len(actual_lines), len(expected_lines))
+ for actual_line, result_line in zip(actual_lines, expected_lines):
+ if len(actual_line.strip()) == 0:
+ self.assertTrue(len(result_line.strip()) == 0)
+ else:
+ self.assertEqual(actual_line, result_line)
+
+ def test_comment9(self):
+ source_lines = [u'Parse a single line of a tree to determine depth and node.',
+ u'',
+ u'Args:',
+ u' This line is missing an argument name.',
+ u' ',
+ u'Returns:',
+ u' A 2-tuple containing the tree 0 based tree depth as the first',
+ u' element and the node description as the second element.',
+ u'',
+ u'Raises:',
+ u' ValueError: If line does not have the expected form.',
+ u'']
+
+ self.assertRaises(HieroglyphError, lambda: parse_hieroglyph_text(source_lines))
+
+ def test_comment10(self):
+ source = """
+ Execute the command described by concatenating the string function arguments
+ with the p4 -s global scripting flag and return the results in a dictionary.
+
+ For example, to run the command::
+
+ p4 -s fstat -T depotFile foo.h
+
+ call::
+
+ p4('fstat', '-T', 'depotFile', 'foo.h')
+
+ Args:
+ args: The arguments to the p4 command as a list of objects which will
+ be converted to strings.
+
+ Returns:
+ A dictionary of lists where each key in the dictionary is the field name
+ from the command output, and each value is a list of output lines in
+ order.
+
+ Raises:
+ PerforceError: If the command could not be run or if the command
+ reported an error.
+ """
+
+ expected = """
+ Execute the command described by concatenating the string function arguments
+ with the p4 -s global scripting flag and return the results in a dictionary.
+
+ For example, to run the command::
+
+ p4 -s fstat -T depotFile foo.h
+
+ call::
+
+ p4('fstat', '-T', 'depotFile', 'foo.h')
+
+ :param args: The arguments to the p4 command as a list of objects which will
+ be converted to strings.
+
+ :returns: A dictionary of lists where each key in the dictionary is the field name
+ from the command output, and each value is a list of output lines in
+ order.
+
+ :raises:
+ PerforceError - If the command could not be run or if the command
+ reported an error.
+
+"""
+
+ source_lines = source.splitlines()
+ actual_lines = parse_hieroglyph_text(source_lines)
+ expected_lines = expected.splitlines()
+ self.assertEqual(len(actual_lines), len(expected_lines))
+ for actual_line, result_line in zip(actual_lines, expected_lines):
+ if len(actual_line.strip()) == 0:
+ self.assertTrue(len(result_line.strip()) == 0)
+ else:
+ self.assertEqual(actual_line, result_line)
+
+ def test_comment11(self):
+ source = """Projects each element of a sequence to an intermediate new sequence,
+ flattens the resulting sequences into one sequence and optionally
+ transforms the flattened sequence using a selector function.
+
+ Warning: This method may explode at short notice.
+
+ Args:
+ collection_selector: A unary function mapping each element of the
+ source iterable into an intermediate sequence. The single
+ argument of the collection_selector is the value of an element
+ from the source sequence. The return value should be an
+ iterable derived from that element value. The default
+ collection_selector, which is the identity function, assumes
+ that each element of the source sequence is itself iterable.
+
+ result_selector: An optional unary function mapping the elements in
+ the flattened intermediate sequence to corresponding elements
+ of the result sequence. The single argument of the
+ result_selector is the value of an element from the flattened
+ intermediate sequence. The return value should be the
+ corresponding value in the result sequence. The default
+ result_selector is the identity function.
+
+ Returns:
+ A Queryable over a generated sequence whose elements are the result
+ of applying the one-to-many collection_selector to each element of
+ the source sequence, concatenating the results into an intermediate
+ sequence, and then mapping each of those elements through the
+ result_selector into the result sequence.
+
+ Raises:
+ ValueError: If this Queryable has been closed.
+ TypeError: If either collection_selector or result_selector are not
+ callable.
+ """
+
+ expected = """ Projects each element of a sequence to an intermediate new sequence,
+ flattens the resulting sequences into one sequence and optionally
+ transforms the flattened sequence using a selector function.
+
+ .. warning::
+
+ This method may explode at short notice.
+
+ :param collection_selector: A unary function mapping each element of the
+ source iterable into an intermediate sequence. The single
+ argument of the collection_selector is the value of an element
+ from the source sequence. The return value should be an
+ iterable derived from that element value. The default
+ collection_selector, which is the identity function, assumes
+ that each element of the source sequence is itself iterable.
+
+ :param result_selector: An optional unary function mapping the elements in
+ the flattened intermediate sequence to corresponding elements
+ of the result sequence. The single argument of the
+ result_selector is the value of an element from the flattened
+ intermediate sequence. The return value should be the
+ corresponding value in the result sequence. The default
+ result_selector is the identity function.
+
+ :returns: A Queryable over a generated sequence whose elements are the result
+ of applying the one-to-many collection_selector to each element of
+ the source sequence, concatenating the results into an intermediate
+ sequence, and then mapping each of those elements through the
+ result_selector into the result sequence.
+
+ :raises:
+ * ValueError - If this Queryable has been closed.
+
+ * TypeError - If either collection_selector or result_selector are not
+ callable.
+ """
+ source_lines = source.splitlines()
+ actual_lines = parse_hieroglyph_text(source_lines)
+ expected_lines = expected.splitlines()
+ self.assertEqual(len(actual_lines), len(expected_lines))
+ for actual_line, result_line in zip(actual_lines, expected_lines):
+ if len(actual_line.strip()) == 0:
+ self.assertTrue(len(result_line.strip()) == 0)
+ else:
+ self.assertEqual(actual_line, result_line)
+
+ def test_comment12(self):
+ source = """Determine if all elements in the source sequence satisfy a condition.
+
+ All of the source sequence will be consumed.
+
+ Note: This method uses immediate execution.
+
+ Args:
+ predicate: An optional single argument function used to test each
+ elements. If omitted, the bool() function is used resulting in
+ the elements being tested directly.
+
+ Returns:
+ True if all elements in the sequence meet the predicate condition,
+ otherwise False.
+
+ Raises:
+ This is not a proper exception description
+ """
+
+ source_lines = source.splitlines()
+ self.assertRaises(HieroglyphError, lambda: parse_hieroglyph_text(source_lines))
+
diff --git a/docs/sphinx/hieroglyph/test/test_hierglyph.py b/docs/sphinx/hieroglyph/test/test_hierglyph.py
new file mode 100644
index 000000000..42947cb0c
--- /dev/null
+++ b/docs/sphinx/hieroglyph/test/test_hierglyph.py
@@ -0,0 +1,264 @@
+import unittest
+from hieroglyph.hieroglyph import first_paragraph_indent, gather_lines, unindent
+
+__author__ = 'Robert Smallshire'
+
+class UnindentTests(unittest.TestCase):
+
+ def test_zero_lines(self):
+ source = []
+ expected = []
+ actual = unindent(source)
+ self.assertEqual(actual, expected)
+
+ def test_one_zero_indent_line(self):
+ source = ["First line"]
+ expected = [(0, "First line")]
+ actual = unindent(source)
+ self.assertEqual(actual, expected)
+
+ def test_two_zero_indent_lines(self):
+ source = ["First line",
+ "Second line"]
+ expected = [(0, "First line"),
+ (0, "Second line")]
+ actual = unindent(source)
+ self.assertEqual(actual, expected)
+
+ def test_two_indented_lines(self):
+ source = [" First line",
+ " Second line"]
+ expected = [(4, "First line"),
+ (6, "Second line")]
+ actual = unindent(source)
+ self.assertEqual(actual, expected)
+
+ def test_whitespace_line(self):
+ source = [" "]
+ expected = [(4, "")]
+ actual = unindent(source)
+ self.assertEqual(actual, expected)
+
+ def test_tab_line(self):
+ source = ["\tHello"]
+ expected = [(1, "Hello")]
+ actual = unindent(source)
+ self.assertEqual(actual, expected)
+
+
+class FirstParagraphIndentTests(unittest.TestCase):
+
+ def test_zero_lines(self):
+ source = []
+ expected = []
+ actual = first_paragraph_indent(source)
+ self.assertEqual(actual, expected)
+
+ def test_single_line_non_indented_comment(self):
+ source = [(0, "A single line comment")]
+ expected = [(0, "A single line comment")]
+ actual = first_paragraph_indent(source)
+ self.assertEqual(actual, expected)
+
+ def test_single_line_indented_comment(self):
+ source = [(4, "A single line comment")]
+ expected = [(4, "A single line comment")]
+ actual = first_paragraph_indent(source)
+ self.assertEqual(actual, expected)
+
+ def test_double_line_non_indented_comment(self):
+ source = [(0, "The first line"),
+ (0, "The second line")]
+ expected = [(0, "The first line"),
+ (0, "The second line")]
+ actual = first_paragraph_indent(source)
+ self.assertEqual(actual, expected)
+
+ def test_double_line_indented_comment(self):
+ source = [(4, "The first line"),
+ (4, "The second line")]
+ expected = [(4, "The first line"),
+ (4, "The second line")]
+ actual = first_paragraph_indent(source)
+ self.assertEqual(actual, expected)
+
+ def test_first_line_indent(self):
+ source = [(4, "The first line"),
+ (0, "The second line")]
+ expected = [(4, "The first line"),
+ (0, "The second line")]
+ actual = first_paragraph_indent(source)
+ self.assertEqual(actual, expected)
+
+ def test_first_line_non_indent(self):
+ source = [(0, "The first line"),
+ (4, "The second line")]
+ expected = [(4, "The first line"),
+ (4, "The second line")]
+ actual = first_paragraph_indent(source)
+ self.assertEqual(actual, expected)
+
+ def test_increasing_indent(self):
+ source = [(0, "The first line"),
+ (4, "The second line"),
+ (8, "The third line")]
+ expected = [(4, "The first line"),
+ (4, "The second line"),
+ (8, "The third line")]
+ actual = first_paragraph_indent(source)
+ self.assertEqual(actual, expected)
+
+ def test_separate_paragraphs(self):
+ source = [(0, "This is the first paragraph"),
+ (0, ""),
+ (4, "This is the second paragraph")]
+ expected = [(0, "This is the first paragraph"),
+ (0, ""),
+ (4, "This is the second paragraph")]
+ actual = first_paragraph_indent(source)
+ self.assertEqual(actual, expected)
+
+ def test_separate_paragraphs_indented(self):
+ source = [(4, "This is the first paragraph"),
+ (4, ""),
+ (8, "This is the second paragraph")]
+ expected = [(4, "This is the first paragraph"),
+ (4, ""),
+ (8, "This is the second paragraph")]
+ actual = first_paragraph_indent(source)
+ self.assertEqual(actual, expected)
+
+ def test_separated_lines_first_line_non_indented(self):
+ source = [(0, "The first line"),
+ (0, ""),
+ (4, "The third line")]
+ expected = [(0, "The first line"),
+ (0, ""),
+ (4, "The third line")]
+ actual = first_paragraph_indent(source)
+ self.assertEqual(actual, expected)
+
+ def test_separated_lines_first_line_indented(self):
+ source = [(4, "The first line"),
+ (4, ""),
+ (4, "The third line")]
+ expected = [(4, "The first line"),
+ (4, ""),
+ (4, "The third line")]
+ actual = first_paragraph_indent(source)
+ self.assertEqual(actual, expected)
+
+class GatherLinesTests(unittest.TestCase):
+
+ def test_empty(self):
+ source = []
+ expected = []
+ actual = gather_lines(source)
+ self.assertEqual(actual, expected)
+
+ def test_one_liner(self):
+ source = [(0, 'One liner')]
+ expected = [(0, ['One liner'])]
+ actual = gather_lines(source)
+ self.assertEqual(actual, expected)
+
+ def test_two_liner(self):
+ source = [(0, 'First line'),
+ (0, 'Second line')]
+ expected = [(0, ['First line',
+ 'Second line'])]
+ actual = gather_lines(source)
+ self.assertEqual(actual, expected)
+
+ def test_separated_lines(self):
+ source = [(0, 'First line'),
+ (0, ''),
+ (0, 'Third line')]
+ expected = [(0, ['First line',
+ '']),
+ (0, ['Third line'])]
+ actual = gather_lines(source)
+ self.assertEqual(actual, expected)
+
+ def test_separated_multi_lines(self):
+ source = [(0, 'First line'),
+ (0, 'Second line'),
+ (0, ''),
+ (0, 'Fourth line'),
+ (0, 'Fifth line')]
+ expected = [(0, ['First line',
+ 'Second line',
+ '']),
+ (0, ['Fourth line',
+ 'Fifth line'])]
+ actual = gather_lines(source)
+ self.assertEqual(actual, expected)
+
+
+ def test_indented_lines(self):
+ source = [(0, 'First line'),
+ (4, 'Second line')]
+ expected = [(0, ['First line']),
+ (4, ['Second line'])]
+ actual = gather_lines(source)
+ self.assertEqual(actual, expected)
+
+ def test_dedented_lines(self):
+ source = [(4, 'First line'),
+ (0, 'Second line')]
+ expected = [(4, ['First line']),
+ (0, ['Second line'])]
+ actual = gather_lines(source)
+ self.assertEqual(actual, expected)
+
+ def test_indented_multi_lines(self):
+ source = [(0, 'First line'),
+ (0, 'Second line'),
+ (4, 'Third line'),
+ (4, 'Fourth line')]
+ expected = [(0, ['First line',
+ 'Second line']),
+ (4, ['Third line',
+ 'Fourth line'])]
+ actual = gather_lines(source)
+ self.assertEqual(actual, expected)
+
+ def test_dedented_multi_lines(self):
+ source = [(4, 'First line'),
+ (4, 'Second line'),
+ (0, 'Third line'),
+ (0, 'Fourth line')]
+ expected = [(4, ['First line',
+ 'Second line']),
+ (0, ['Third line',
+ 'Fourth line'])]
+ actual = gather_lines(source)
+ self.assertEqual(actual, expected)
+
+ def test_indented_separated_multi_lines(self):
+ source = [(0, 'First line'),
+ (0, 'Second line'),
+ (0, ''),
+ (4, 'Fourth line'),
+ (4, 'Fifth line')]
+ expected = [(0, ['First line',
+ 'Second line',
+ '']),
+ (4, ['Fourth line',
+ 'Fifth line'])]
+ actual = gather_lines(source)
+ self.assertEqual(actual, expected)
+
+ def test_dedented_separated_multi_lines(self):
+ source = [(4, 'First line'),
+ (4, 'Second line'),
+ (4, ''),
+ (0, 'Fourth line'),
+ (0, 'Fifth line')]
+ expected = [(4, ['First line',
+ 'Second line',
+ '']),
+ (0, ['Fourth line',
+ 'Fifth line'])]
+ actual = gather_lines(source)
+ self.assertEqual(actual, expected)
diff --git a/docs/sphinx/hieroglyph/test/test_nodes.py b/docs/sphinx/hieroglyph/test/test_nodes.py
new file mode 100644
index 000000000..4cc17b477
--- /dev/null
+++ b/docs/sphinx/hieroglyph/test/test_nodes.py
@@ -0,0 +1,386 @@
+import unittest
+from hieroglyph.nodes import Node, Arg, Raises, Except, Returns, Warning, Note
+
+__author__ = 'Robert Smallshire'
+
+class NodeTests(unittest.TestCase):
+
+ def test_create_default_node(self):
+ node = Node()
+ self.assertEqual(node.indent, 0)
+ self.assertEqual(node.lines, [])
+ self.assertIsNone(node.parent)
+
+ def test_create_with_indent(self):
+ node = Node(indent=4)
+ self.assertEqual(node.indent, 4)
+ self.assertEqual(node.lines, [])
+ self.assertIsNone(node.parent)
+
+ def test_create_with_lines(self):
+ node = Node(lines= ['First', 'Second', 'Third'])
+ self.assertEqual(node.indent, 0)
+ self.assertEqual(node.lines, ['First', 'Second', 'Third'])
+ self.assertIsNone(node.parent)
+
+ def test_repr(self):
+ node = Node(5, ['One', 'Two', 'Three'])
+ actual = repr(node)
+ expected = "Node(5, ['One', 'Two', 'Three'], children=[])"
+ self.assertEqual(expected, actual)
+
+ def test_add_one_child(self):
+ node = Node()
+ child = Node(parent=node)
+ node.add_child(child)
+ self.assertIs(node.children[0], child)
+
+ def test_add_two_children(self):
+ node = Node()
+ child0 = Node(parent=node)
+ child1 = Node(parent=node)
+ node.add_child(child0)
+ node.add_child(child1)
+ self.assertIs(node.children[0], child0)
+ self.assertIs(node.children[1], child1)
+
+ def test_render_rst_empty(self):
+ node = Node()
+ rst = node.render_rst()
+ self.assertEqual(len(rst), 0)
+
+ def test_render_rst_indent(self):
+ node = Node(indent=4)
+ rst = node.render_rst()
+ self.assertEqual(len(rst), 0)
+
+ def test_render_rst_lines(self):
+ node = Node(lines= ['First',
+ 'Second',
+ 'Third'])
+ rst = node.render_rst()
+ self.assertEqual(rst, ['First',
+ 'Second',
+ 'Third'])
+
+ def test_render_rst_indented_lines(self):
+ node = Node(indent=3, lines= ['First',
+ 'Second',
+ 'Third'])
+ rst = node.render_rst()
+ self.assertEqual(rst, [' First',
+ ' Second',
+ ' Third'])
+
+ def test_render_rst_with_child(self):
+ node = Node(indent=4, lines=["Parent"])
+ child = Node(indent=8, lines=["Child"], parent=node)
+ node.add_child(child)
+ rst = node.render_rst()
+ self.assertEqual(rst, [' Parent',
+ ' Child'])
+
+ def test_render_rst_with_children(self):
+ node = Node(indent=4, lines=["Parent"])
+ child_a = Node(indent=8, lines=["ChildA"], parent=node)
+ node.add_child(child_a)
+ child_b = Node(indent=6, lines=["ChildB"], parent=node)
+ node.add_child(child_b)
+ rst = node.render_rst()
+ self.assertEqual(rst, [' Parent',
+ ' ChildA',
+ ' ChildB'])
+
+
+class ArgTests(unittest.TestCase):
+
+ def test_create(self):
+ node = Arg(5, 10, 'foo')
+ self.assertEqual(node.indent, 5)
+ self.assertEqual(node.child_indent, 10)
+ self.assertEqual(node.name, 'foo')
+ self.assertEqual(node.lines, [])
+ self.assertIsNone(node.parent)
+
+ def test_set_type(self):
+ node = Arg(5, 10, 'foo')
+ node.type = 'str'
+ self.assertEqual(node.type, 'str')
+
+ def test_add_one_child(self):
+ node = Arg(5, 10, 'foo')
+ child = Node(parent=node)
+ node.add_child(child)
+ self.assertIs(node.children[0], child)
+
+ def test_add_two_children(self):
+ node = Arg(5, 10, 'foo')
+ child0 = Node(parent=node)
+ child1 = Node(parent=node)
+ node.add_child(child0)
+ node.add_child(child1)
+ self.assertIs(node.children[0], child0)
+ self.assertIs(node.children[1], child1)
+
+ def test_repr(self):
+ node = Arg(5, 10, 'foo')
+ actual = repr(node)
+ expected = "Arg('foo', None, children=[])"
+ self.assertEqual(expected, actual)
+
+ def test_render_rst_empty(self):
+ node = Arg(5, 10, 'bar')
+ rst = node.render_rst()
+ self.assertEqual(rst, [' :param bar: ',
+ ''])
+
+ def test_render_rst_with_child(self):
+ node = Arg(5, 10, 'bar')
+ child = Node(indent=10, lines=["Description"], parent=node)
+ node.add_child(child)
+ rst = node.render_rst()
+ self.assertEqual(rst, [' :param bar: Description',
+ ''])
+
+ def test_render_rst_with_children(self):
+ node = Arg(5, 10, 'bar')
+ child_a = Node(indent=10, lines=["ChildA"], parent=node)
+ node.add_child(child_a)
+ child_b = Node(indent=10, lines=["ChildB"], parent=node)
+ node.add_child(child_b)
+ rst = node.render_rst()
+ self.assertEqual(rst, [' :param bar: ChildA',
+ ' ChildB',
+ ''])
+
+ def test_render_rst_with_type(self):
+ node = Arg(5, 10, 'bar')
+ node.type = 'str'
+ rst = node.render_rst()
+ self.assertEqual(rst, [' :param bar: ',
+ ' :type bar: str',
+ ''])
+
+
+class RaisesTests(unittest.TestCase):
+
+ def test_create_default_node(self):
+ node = Raises()
+ self.assertEqual(node.indent, 0)
+ self.assertEqual(node.lines, [])
+ self.assertIsNone(node.parent)
+
+ def test_create_with_indent(self):
+ node = Raises(indent=4)
+ self.assertEqual(node.indent, 4)
+ self.assertEqual(node.lines, [])
+ self.assertIsNone(node.parent)
+
+ def test_repr(self):
+ node = Raises(5)
+ actual = repr(node)
+ expected = "Raises(5, children=[])"
+ self.assertEqual(expected, actual)
+
+ def test_add_one_child(self):
+ node = Raises()
+ child = Node(parent=node)
+ node.add_child(child)
+ self.assertIs(node.children[0], child)
+
+ def test_add_two_children(self):
+ node = Raises()
+ child0 = Node(parent=node)
+ child1 = Node(parent=node)
+ node.add_child(child0)
+ node.add_child(child1)
+ self.assertIs(node.children[0], child0)
+ self.assertIs(node.children[1], child1)
+
+ def test_render_rst_empty(self):
+ node = Raises()
+ rst = node.render_rst()
+ self.assertEqual(rst, [':raises:',
+ ''])
+
+ def test_render_rst_indent(self):
+ node = Raises(indent=5)
+ rst = node.render_rst()
+ self.assertEqual(rst, [' :raises:',
+ ''])
+
+ def test_render_rst_with_child(self):
+ node = Raises(5)
+ child = Node(indent=10, lines=["Description"], parent=node)
+ node.add_child(child)
+ rst = node.render_rst()
+ self.assertEqual(rst, [' :raises:',
+ ' Description',
+ ''])
+
+ def test_render_rst_with_children(self):
+ node = Raises(5)
+ child_a = Node(indent=10, lines=["ChildA"], parent=node)
+ node.add_child(child_a)
+ child_b = Node(indent=10, lines=["ChildB"], parent=node)
+ node.add_child(child_b)
+ rst = node.render_rst()
+ self.assertEqual(rst, [' :raises:',
+ ' ChildA',
+ ' ChildB',
+ ''])
+
+
+class ExceptTests(unittest.TestCase):
+
+ def test_create(self):
+ node = Except(5, 'FooError')
+ self.assertEqual(node.indent, 5)
+ self.assertEqual(node.type, 'FooError')
+ self.assertEqual(node.lines, [])
+ self.assertIsNone(node.parent)
+
+ def test_add_one_child(self):
+ node = Except(5, 'FooError')
+ child = Node(parent=node)
+ node.add_child(child)
+ self.assertIs(node.children[0], child)
+
+ def test_add_two_children(self):
+ node = Except(5, 'FooError')
+ child0 = Node(parent=node)
+ child1 = Node(parent=node)
+ node.add_child(child0)
+ node.add_child(child1)
+ self.assertIs(node.children[0], child0)
+ self.assertIs(node.children[1], child1)
+
+ def test_repr(self):
+ node = Except(5,'FooError')
+ actual = repr(node)
+ expected = "Except('FooError', children=[])"
+ self.assertEqual(expected, actual)
+
+ def test_render_rst_empty(self):
+ node = Except(5, 'FooError')
+ rst = node.render_rst()
+ self.assertEqual(rst, [' * FooError - ',
+ ''])
+
+ def test_render_rst_indent(self):
+ node = Except(5, 'FooError')
+ rst = node.render_rst()
+ self.assertEqual(rst, [' * FooError - ',
+ ''])
+
+ def test_render_rst_with_child(self):
+ node = Except(5, 'FooError')
+ child = Node(indent=10, lines=["Description"], parent=node)
+ node.add_child(child)
+ rst = node.render_rst()
+ self.assertEqual(rst, [' * FooError - Description',
+ ''])
+
+ def test_render_rst_with_children(self):
+ node = Except(5, 'FooError')
+ child_a = Node(indent=10, lines=["ChildA"], parent=node)
+ node.add_child(child_a)
+ child_b = Node(indent=10, lines=["ChildB"], parent=node)
+ node.add_child(child_b)
+ rst = node.render_rst()
+ self.assertEqual(rst, [' * FooError - ChildA',
+ ' ChildB',
+ ''])
+
+class ReturnsTests(unittest.TestCase):
+
+ def test_create(self):
+ node = Returns(5)
+ self.assertEqual(node.indent, 5)
+ self.assertEqual(node.lines, [])
+ self.assertIsNone(node.parent)
+
+ def test_add_one_child(self):
+ node = Returns(5)
+ child = Node(parent=node)
+ node.add_child(child)
+ self.assertIs(node.children[0], child)
+
+ def test_add_two_children(self):
+ node = Returns(5)
+ child0 = Node(parent=node)
+ child1 = Node(parent=node)
+ node.add_child(child0)
+ node.add_child(child1)
+ self.assertIs(node.children[0], child0)
+ self.assertIs(node.children[1], child1)
+
+ def test_repr(self):
+ node = Returns(5)
+ actual = repr(node)
+ expected = "Returns(5, children=[])"
+ self.assertEqual(expected, actual)
+
+ # TODO test_render_rst
+
+class WarningTests(unittest.TestCase):
+
+ def test_create(self):
+ node = Warning(5)
+ self.assertEqual(node.indent, 5)
+ self.assertEqual(node.lines, [])
+ self.assertIsNone(node.parent)
+
+ def test_add_one_child(self):
+ node = Warning(5)
+ child = Node(parent=node)
+ node.add_child(child)
+ self.assertIs(node.children[0], child)
+
+ def test_add_two_children(self):
+ node = Warning(5)
+ child0 = Node(parent=node)
+ child1 = Node(parent=node)
+ node.add_child(child0)
+ node.add_child(child1)
+ self.assertIs(node.children[0], child0)
+ self.assertIs(node.children[1], child1)
+
+ def test_repr(self):
+ node = Warning(5)
+ actual = repr(node)
+ expected = "Warning(5, children=[])"
+ self.assertEqual(expected, actual)
+
+ # TODO test_render_rst
+
+class NoteTests(unittest.TestCase):
+
+ def test_create(self):
+ node = Note(5)
+ self.assertEqual(node.indent, 5)
+ self.assertEqual(node.lines, [])
+ self.assertIsNone(node.parent)
+
+ def test_add_one_child(self):
+ node = Note(5)
+ child = Node(parent=node)
+ node.add_child(child)
+ self.assertIs(node.children[0], child)
+
+ def test_add_two_children(self):
+ node = Note(5)
+ child0 = Node(parent=node)
+ child1 = Node(parent=node)
+ node.add_child(child0)
+ node.add_child(child1)
+ self.assertIs(node.children[0], child0)
+ self.assertIs(node.children[1], child1)
+
+ def test_repr(self):
+ node = Note(5)
+ actual = repr(node)
+ expected = "Note(5, children=[])"
+ self.assertEqual(expected, actual)
+
+ # TODO test_render_rst
diff --git a/docs/sphinx/hieroglyph/version.py b/docs/sphinx/hieroglyph/version.py
new file mode 100644
index 000000000..d060125c0
--- /dev/null
+++ b/docs/sphinx/hieroglyph/version.py
@@ -0,0 +1,3 @@
+'''Specification of the hieroglyph version'''
+
+__version__ = '0.6'
diff --git a/docs/sphinx/run_sphinx_build.sh.in b/docs/sphinx/run_sphinx_build.sh.in
new file mode 100644
index 000000000..bc89f2de7
--- /dev/null
+++ b/docs/sphinx/run_sphinx_build.sh.in
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+echo "Creating Sphinx documentation in: @CMAKE_CURRENT_BINARY_DIR@/sphinx_out"
+
+LD_LIBRARY_PATH="@CMAKE_INSTALL_PREFIX@/lib"
+@SPHINX_EXECUTABLE@ -b html -c @CMAKE_CURRENT_BINARY_DIR@/ @CMAKE_CURRENT_SOURCE_DIR@/source @CMAKE_CURRENT_BINARY_DIR@/sphinx_out
+
diff --git a/docs/sphinx/source/atsc/blks.rst b/docs/sphinx/source/atsc/blks.rst
new file mode 100644
index 000000000..6f51a2287
--- /dev/null
+++ b/docs/sphinx/source/atsc/blks.rst
@@ -0,0 +1,20 @@
+gnuradio.atsc: Signal Processing Blocks
+=======================================
+
+.. autooldblock:: gnuradio.atsc.bit_timing_loop
+.. autooldblock:: gnuradio.atsc.deinterleaver
+.. autooldblock:: gnuradio.atsc.depad
+.. autooldblock:: gnuradio.atsc.derandomizer
+.. autooldblock:: gnuradio.atsc.ds_to_softds
+.. autooldblock:: gnuradio.atsc.equalizer
+.. autooldblock:: gnuradio.atsc.field_sync_demux
+.. autooldblock:: gnuradio.atsc.field_sync_mux
+.. autooldblock:: gnuradio.atsc.fpll
+.. autooldblock:: gnuradio.atsc.fs_checker
+.. autooldblock:: gnuradio.atsc.interleaver
+.. autooldblock:: gnuradio.atsc.pad
+.. autooldblock:: gnuradio.atsc.randomizer
+.. autooldblock:: gnuradio.atsc.rs_decoder
+.. autooldblock:: gnuradio.atsc.rs_encoder
+.. autooldblock:: gnuradio.atsc.trellis_encoder
+.. autooldblock:: gnuradio.atsc.viterbi_decoder
diff --git a/docs/sphinx/source/atsc/index.rst b/docs/sphinx/source/atsc/index.rst
new file mode 100644
index 000000000..2371f2456
--- /dev/null
+++ b/docs/sphinx/source/atsc/index.rst
@@ -0,0 +1,62 @@
+gnuradio.atsc
+=============
+
+.. automodule:: gnuradio.atsc
+
+Signal Processing Blocks
+------------------------
+
+.. autosummary::
+ :nosignatures:
+
+ gnuradio.atsc.bit_timing_loop
+ gnuradio.atsc.deinterleaver
+ gnuradio.atsc.depad
+ gnuradio.atsc.derandomizer
+ gnuradio.atsc.ds_to_softds
+ gnuradio.atsc.equalizer
+ gnuradio.atsc.field_sync_demux
+ gnuradio.atsc.field_sync_mux
+ gnuradio.atsc.fpll
+ gnuradio.atsc.fs_checker
+ gnuradio.atsc.interleaver
+ gnuradio.atsc.pad
+ gnuradio.atsc.randomizer
+ gnuradio.atsc.rs_decoder
+ gnuradio.atsc.rs_encoder
+ gnuradio.atsc.trellis_encoder
+ gnuradio.atsc.viterbi_decoder
+
+Constants
+---------
+
+.. autosummary::
+ :nosignatures:
+
+ gnuradio.atsc.ATSC_DATA_SEGMENT_LENGTH
+ gnuradio.atsc.ATSC_DATA_SEGMENT_RATE
+ gnuradio.atsc.ATSC_DSEGS_PER_FIELD
+ gnuradio.atsc.ATSC_MPEG_DATA_LENGTH
+ gnuradio.atsc.ATSC_MPEG_PKT_LENGTH
+ gnuradio.atsc.ATSC_MPEG_RS_ENCODED_LENGTH
+ gnuradio.atsc.ATSC_SYMBOL_RATE
+ gnuradio.atsc.MPEG_SYNC_BYTE
+ gnuradio.atsc.MPEG_TRANSPORT_ERROR_BIT
+
+Sizes
+---------
+
+.. autosummary::
+ :nosignatures:
+
+ gnuradio.atsc.sizeof_atsc_data_segment
+ gnuradio.atsc.sizeof_atsc_data_segment_pad
+ gnuradio.atsc.sizeof_atsc_mpeg_packet
+ gnuradio.atsc.sizeof_atsc_mpeg_packet_no_sync
+ gnuradio.atsc.sizeof_atsc_mpeg_packet_no_sync_pad
+ gnuradio.atsc.sizeof_atsc_mpeg_packet_pad
+ gnuradio.atsc.sizeof_atsc_mpeg_packet_rs_encoded
+ gnuradio.atsc.sizeof_atsc_mpeg_packet_rs_encoded_pad
+ gnuradio.atsc.sizeof_atsc_soft_data_segment
+ gnuradio.atsc.sizeof_atsc_soft_data_segment_pad
+
diff --git a/docs/sphinx/source/audio/index.rst b/docs/sphinx/source/audio/index.rst
new file mode 100644
index 000000000..d0bc4f3c0
--- /dev/null
+++ b/docs/sphinx/source/audio/index.rst
@@ -0,0 +1,7 @@
+gnuradio.audio
+==============
+
+.. automodule:: gnuradio.audio
+
+.. autooldblock:: gnuradio.audio.source
+.. autooldblock:: gnuradio.audio.sink
diff --git a/docs/sphinx/source/blks2/blks.rst b/docs/sphinx/source/blks2/blks.rst
new file mode 100644
index 000000000..c28c7af0f
--- /dev/null
+++ b/docs/sphinx/source/blks2/blks.rst
@@ -0,0 +1,31 @@
+gnuradio.blks2: Signal Processing Blocks
+========================================
+
+.. autopyblock:: gnuradio.blks2.am_demod_cf
+.. autopyblock:: gnuradio.blks2.ctcss_gen_f
+.. autopyblock:: gnuradio.blks2.demod_10k0a3e_cf
+.. autopyblock:: gnuradio.blks2.demod_200kf3e_cf
+.. autopyblock:: gnuradio.blks2.demod_20k0f3e_cf
+.. autopyblock:: gnuradio.blks2.fm_demod_cf
+.. autopyblock:: gnuradio.blks2.logpwrfft_c
+.. autopyblock:: gnuradio.blks2.logpwrfft_f
+.. autopyblock:: gnuradio.blks2.pfb_arb_resampler_ccf
+.. autopyblock:: gnuradio.blks2.pfb_arb_resampler_fff
+.. autopyblock:: gnuradio.blks2.pfb_channelizer_ccf
+.. autopyblock:: gnuradio.blks2.pfb_decimator_ccf
+.. autopyblock:: gnuradio.blks2.pfb_interpolator_ccf
+.. autopyblock:: gnuradio.blks2.rational_resampler_ccc
+.. autopyblock:: gnuradio.blks2.rational_resampler_ccf
+.. autopyblock:: gnuradio.blks2.rational_resampler_fff
+.. autopyblock:: gnuradio.blks2.analysis_filterbank
+.. autopyblock:: gnuradio.blks2.fm_deemph
+.. autopyblock:: gnuradio.blks2.fm_preemph
+.. autopyblock:: gnuradio.blks2.nbfm_rx
+.. autopyblock:: gnuradio.blks2.nbfm_tx
+.. autopyblock:: gnuradio.blks2.stream_to_vector_decimator
+.. autopyblock:: gnuradio.blks2.standard_squelch
+.. autopyblock:: gnuradio.blks2.synthesis_filterbank
+.. autopyblock:: gnuradio.blks2.wfm_rcv
+.. autopyblock:: gnuradio.blks2.wfm_rcv_fmdet
+.. autopyblock:: gnuradio.blks2.wfm_rcv_pll
+.. autopyblock:: gnuradio.blks2.wfm_tx
diff --git a/docs/sphinx/source/blks2/index.rst b/docs/sphinx/source/blks2/index.rst
new file mode 100644
index 000000000..4df8e5a79
--- /dev/null
+++ b/docs/sphinx/source/blks2/index.rst
@@ -0,0 +1,47 @@
+gnuradio.blks2
+==============
+
+.. automodule:: gnuradio.blks2
+
+Signal Processing Blocks
+------------------------
+
+.. autosummary::
+ :nosignatures:
+
+ gnuradio.blks2.am_demod_cf
+ gnuradio.blks2.ctcss_gen_f
+ gnuradio.blks2.demod_10k0a3e_cf
+ gnuradio.blks2.demod_200kf3e_cf
+ gnuradio.blks2.demod_20k0f3e_cf
+ gnuradio.blks2.fm_demod_cf
+ gnuradio.blks2.logpwrfft_c
+ gnuradio.blks2.logpwrfft_f
+ gnuradio.blks2.pfb_arb_resampler_ccf
+ gnuradio.blks2.pfb_arb_resampler_fff
+ gnuradio.blks2.pfb_channelizer_ccf
+ gnuradio.blks2.pfb_decimator_ccf
+ gnuradio.blks2.pfb_interpolator_ccf
+ gnuradio.blks2.rational_resampler_ccc
+ gnuradio.blks2.rational_resampler_ccf
+ gnuradio.blks2.rational_resampler_fff
+ gnuradio.blks2.analysis_filterbank
+ gnuradio.blks2.fm_deemph
+ gnuradio.blks2.fm_preemph
+ gnuradio.blks2.nbfm_rx
+ gnuradio.blks2.nbfm_tx
+ gnuradio.blks2.stream_to_vector_decimator
+ gnuradio.blks2.standard_squelch
+ gnuradio.blks2.synthesis_filterbank
+ gnuradio.blks2.wfm_rcv
+ gnuradio.blks2.wfm_rcv_fmdet
+ gnuradio.blks2.wfm_rcv_pll
+ gnuradio.blks2.wfm_tx
+
+Utility Functions
+-----------------
+
+.. autosummary::
+ :nosignatures:
+
+ gnuradio.blks2.design_filter
diff --git a/docs/sphinx/source/blks2/utilities.rst b/docs/sphinx/source/blks2/utilities.rst
new file mode 100644
index 000000000..3ce068fb4
--- /dev/null
+++ b/docs/sphinx/source/blks2/utilities.rst
@@ -0,0 +1,4 @@
+gnuradio.blks2: Utility Functions
+=================================
+
+.. autoclass:: gnuradio.blks2.design_filter
diff --git a/docs/sphinx/source/conf.py.in b/docs/sphinx/source/conf.py.in
new file mode 100644
index 000000000..aa7b122cc
--- /dev/null
+++ b/docs/sphinx/source/conf.py.in
@@ -0,0 +1,217 @@
+# -*- coding: utf-8 -*-
+#
+# GNU Radio documentation build configuration file, created by
+# sphinx-quickstart on Sun Oct 16 22:27:51 2011.
+#
+# This file is execfile()d with the current directory set to its containing dir.
+#
+# Note that not all possible configuration values are present in this
+# autogenerated file.
+#
+# All configuration values have a default; values that are commented out
+# serve to show the default.
+
+import sys, os
+
+# If extensions (or modules to document with autodoc) are in another directory,
+# add these directories to sys.path here. If the directory is relative to the
+# documentation root, use os.path.abspath to make it absolute, like shown here.
+sys.path.insert(0, os.path.abspath('@CMAKE_CURRENT_SOURCE_DIR@'))
+sys.path.insert(0, '@CMAKE_INSTALL_PREFIX@/@GR_PYTHON_DIR@')
+
+# -- General configuration -----------------------------------------------------
+
+# If your documentation needs a minimal Sphinx version, state it here.
+#needs_sphinx = '1.0'
+
+# Add any Sphinx extension module names here, as strings. They can be extensions
+# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
+extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.autosummary', 'sphinx.ext.mathjax', 'gnuradio_sphinx', 'hieroglyph']
+
+# Add any paths that contain templates here, relative to this directory.
+templates_path = ['_templates']
+
+# The suffix of source filenames.
+source_suffix = '.rst'
+
+# The encoding of source files.
+#source_encoding = 'utf-8-sig'
+
+# The master toctree document.
+master_doc = 'index'
+
+# General information about the project.
+project = u'GNU Radio'
+copyright = u'2012, Free Software Foundation'
+
+# The version info for the project you're documenting, acts as replacement for
+# |version| and |release|, also used in various other places throughout the
+# built documents.
+#
+# The short X.Y version.
+version = '@VERSION@'
+# The full version, including alpha/beta/rc tags.
+release = '@VERSION@'
+
+# The language for content autogenerated by Sphinx. Refer to documentation
+# for a list of supported languages.
+#language = None
+
+# There are two options for replacing |today|: either, you set today to some
+# non-false value, then it is used:
+#today = ''
+# Else, today_fmt is used as the format for a strftime call.
+#today_fmt = '%B %d, %Y'
+
+# List of patterns, relative to source directory, that match files and
+# directories to ignore when looking for source files.
+exclude_patterns = []
+
+# The reST default role (used for this markup: `text`) to use for all documents.
+#default_role = None
+
+# If true, '()' will be appended to :func: etc. cross-reference text.
+#add_function_parentheses = True
+
+# If true, the current module name will be prepended to all description
+# unit titles (such as .. function::).
+#add_module_names = True
+
+# If true, sectionauthor and moduleauthor directives will be shown in the
+# output. They are ignored by default.
+#show_authors = False
+
+# The name of the Pygments (syntax highlighting) style to use.
+pygments_style = 'sphinx'
+
+# A list of ignored prefixes for module index sorting.
+#modindex_common_prefix = []
+
+
+# -- Options for HTML output ---------------------------------------------------
+
+# The theme to use for HTML and HTML Help pages. See the documentation for
+# a list of builtin themes.
+html_theme = 'default'
+
+# Theme options are theme-specific and customize the look and feel of a theme
+# further. For a list of options available for each theme, see the
+# documentation.
+#html_theme_options = {}
+
+# Add any paths that contain custom themes here, relative to this directory.
+#html_theme_path = []
+
+# The name for this set of Sphinx documents. If None, it defaults to
+# "<project> v<release> documentation".
+#html_title = None
+
+# A shorter title for the navigation bar. Default is the same as html_title.
+#html_short_title = None
+
+# The name of an image file (relative to this directory) to place at the top
+# of the sidebar.
+#html_logo = None
+
+# The name of an image file (within the static path) to use as favicon of the
+# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
+# pixels large.
+#html_favicon = None
+
+# Add any paths that contain custom static files (such as style sheets) here,
+# relative to this directory. They are copied after the builtin static files,
+# so a file named "default.css" will overwrite the builtin "default.css".
+html_static_path = ['_static']
+
+# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
+# using the given strftime format.
+#html_last_updated_fmt = '%b %d, %Y'
+
+# If true, SmartyPants will be used to convert quotes and dashes to
+# typographically correct entities.
+#html_use_smartypants = True
+
+# Custom sidebar templates, maps document names to template names.
+#html_sidebars = {}
+
+# Additional templates that should be rendered to pages, maps page names to
+# template names.
+#html_additional_pages = {}
+
+# If false, no module index is generated.
+#html_domain_indices = True
+
+# If false, no index is generated.
+#html_use_index = True
+
+# If true, the index is split into individual pages for each letter.
+#html_split_index = False
+
+# If true, links to the reST sources are added to the pages.
+#html_show_sourcelink = True
+
+# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
+#html_show_sphinx = True
+
+# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
+#html_show_copyright = True
+
+# If true, an OpenSearch description file will be output, and all pages will
+# contain a <link> tag referring to it. The value of this option must be the
+# base URL from which the finished HTML is served.
+#html_use_opensearch = ''
+
+# This is the file name suffix for HTML files (e.g. ".xhtml").
+#html_file_suffix = None
+
+# Output file base name for HTML help builder.
+htmlhelp_basename = 'GNURadiodoc'
+
+
+# -- Options for LaTeX output --------------------------------------------------
+
+# The paper size ('letter' or 'a4').
+#latex_paper_size = 'letter'
+
+# The font size ('10pt', '11pt' or '12pt').
+#latex_font_size = '10pt'
+
+# Grouping the document tree into LaTeX files. List of tuples
+# (source start file, target name, title, author, documentclass [howto/manual]).
+latex_documents = [
+ ('index', 'GNURadio.tex', u'GNU Radio Documentation',
+ u'Free Software Foundation', 'manual'),
+]
+
+# The name of an image file (relative to this directory) to place at the top of
+# the title page.
+#latex_logo = None
+
+# For "manual" documents, if this is true, then toplevel headings are parts,
+# not chapters.
+#latex_use_parts = False
+
+# If true, show page references after internal links.
+#latex_show_pagerefs = False
+
+# If true, show URL addresses after external links.
+#latex_show_urls = False
+
+# Additional stuff for the LaTeX preamble.
+#latex_preamble = ''
+
+# Documents to append as an appendix to all manuals.
+#latex_appendices = []
+
+# If false, no module index is generated.
+#latex_domain_indices = True
+
+
+# -- Options for manual page output --------------------------------------------
+
+# One entry per manual page. List of tuples
+# (source start file, name, description, authors, manual section).
+man_pages = [
+ ('index', 'gnuradio', u'GNU Radio Documentation',
+ [u'Free Software Foundation'], 1)
+]
diff --git a/docs/sphinx/source/digital/blocks.rst b/docs/sphinx/source/digital/blocks.rst
new file mode 100644
index 000000000..68ec8dad1
--- /dev/null
+++ b/docs/sphinx/source/digital/blocks.rst
@@ -0,0 +1,51 @@
+gnuradio.digital: Signal Processing Blocks
+==========================================
+
+.. autooldblock:: gnuradio.digital.fll_band_edge_cc
+.. autooldblock:: gnuradio.digital.kurtotic_equalizer_cc
+.. autooldblock:: gnuradio.digital.lms_dd_equalizer_cc
+.. autooldblock:: gnuradio.digital.mpsk_receiver_cc
+.. autooldblock:: gnuradio.digital.mpsk_snr_est_cc
+.. autooldblock:: gnuradio.digital.clock_recovery_mm_cc
+.. autooldblock:: gnuradio.digital.clock_recovery_mm_ff
+.. autooldblock:: gnuradio.digital.constellation_decoder_cb
+.. autooldblock:: gnuradio.digital.constellation_receiver_cb
+.. autooldblock:: gnuradio.digital.correlate_access_code_bb
+.. autooldblock:: gnuradio.digital.costas_loop_cc
+.. autooldblock:: gnuradio.digital.cma_equalizer_cc
+.. autooldblock:: gnuradio.digital.binary_slicer_fb
+.. autooldblock:: gnuradio.digital.gmskmod_bc
+.. autooldblock:: gnuradio.digital.probe_mpsk_snr_est_c
+.. autooldblock:: gnuradio.digital.cpmmod_bc
+.. autopyblock:: gnuradio.digital.generic_demod
+.. autopyblock:: gnuradio.digital.generic_mod
+.. autopyblock:: gnuradio.digital.bpsk.dbpsk_demod
+.. autopyblock:: gnuradio.digital.bpsk.dbpsk_mod
+.. autopyblock:: gnuradio.digital.qpsk.dqpsk_demod
+.. autopyblock:: gnuradio.digital.qpsk.dqpsk_mod
+.. autopyblock:: gnuradio.digital.gmsk.gmsk_demod
+.. autopyblock:: gnuradio.digital.gmsk.gmsk_mod
+.. autopyblock:: gnuradio.digital.bpsk.bpsk_demod
+.. autopyblock:: gnuradio.digital.bpsk.bpsk_mod
+.. autopyblock:: gnuradio.digital.psk.psk_demod
+.. autopyblock:: gnuradio.digital.psk.psk_mod
+.. autopyblock:: gnuradio.digital.qam.qam_demod
+.. autopyblock:: gnuradio.digital.qam.qam_mod
+.. autopyblock:: gnuradio.digital.qpsk.qpsk_demod
+.. autopyblock:: gnuradio.digital.qpsk.qpsk_mod
+.. autopyblock:: gnuradio.digital.cpm.cpm_mod
+.. autopyblock:: gnuradio.digital.pkt.mod_pkts
+.. autopyblock:: gnuradio.digital.pkt.demod_pkts
+.. autopyblock:: gnuradio.digital.ofdm_cyclic_prefixer
+.. autopyblock:: gnuradio.digital.ofdm_frame_acquisition
+.. autopyblock:: gnuradio.digital.ofdm_frame_sink
+.. autopyblock:: gnuradio.digital.ofdm_insert_preamble
+.. autopyblock:: gnuradio.digital.ofdm_mapper_bcv
+.. autopyblock:: gnuradio.digital.ofdm_mod
+.. autopyblock:: gnuradio.digital.ofdm_demod
+.. autopyblock:: gnuradio.digital.ofdm_receiver
+.. autopyblock:: gnuradio.digital.ofdm_sampler
+.. autopyblock:: gnuradio.digital.ofdm_sync_fixed
+.. autopyblock:: gnuradio.digital.ofdm_sync_ml
+.. autopyblock:: gnuradio.digital.ofdm_sync_pn
+.. autopyblock:: gnuradio.digital.ofdm_sync_pnac
diff --git a/docs/sphinx/source/digital/constellations.rst b/docs/sphinx/source/digital/constellations.rst
new file mode 100644
index 000000000..3fa02613a
--- /dev/null
+++ b/docs/sphinx/source/digital/constellations.rst
@@ -0,0 +1,13 @@
+gnuradio.digital: Constellations
+================================
+
+.. autofunction:: gnuradio.digital.constellation_8psk
+.. autofunction:: gnuradio.digital.constellation_bpsk
+.. autofunction:: gnuradio.digital.constellation_calcdist
+.. autofunction:: gnuradio.digital.constellation_dqpsk
+.. autofunction:: gnuradio.digital.constellation_psk
+.. autofunction:: gnuradio.digital.constellation_qpsk
+.. autofunction:: gnuradio.digital.constellation_rect
+.. autofunction:: gnuradio.digital.qpsk.qpsk_constellation
+.. autofunction:: gnuradio.digital.psk.psk_constellation
+.. autofunction:: gnuradio.digital.qam.qam_constellation
diff --git a/docs/sphinx/source/digital/index.rst b/docs/sphinx/source/digital/index.rst
new file mode 100644
index 000000000..da5227e45
--- /dev/null
+++ b/docs/sphinx/source/digital/index.rst
@@ -0,0 +1,133 @@
+gnuradio.digital
+================
+
+.. automodule:: gnuradio.digital
+
+Signal Processing Blocks
+------------------------
+
+.. autosummary::
+ :nosignatures:
+
+ gnuradio.digital.fll_band_edge_cc
+ gnuradio.digital.kurtotic_equalizer_cc
+ gnuradio.digital.lms_dd_equalizer_cc
+ gnuradio.digital.mpsk_receiver_cc
+ gnuradio.digital.mpsk_snr_est_cc
+ gnuradio.digital.clock_recovery_mm_cc
+ gnuradio.digital.clock_recovery_mm_ff
+ gnuradio.digital.constellation_decoder_cb
+ gnuradio.digital.constellation_receiver_cb
+ gnuradio.digital.correlate_access_code_bb
+ gnuradio.digital.costas_loop_cc
+ gnuradio.digital.cma_equalizer_cc
+ gnuradio.digital.binary_slicer_fb
+ gnuradio.digital.gmskmod_bc
+ gnuradio.digital.probe_mpsk_snr_est_c
+ gnuradio.digital.cpmmod_bc
+ gnuradio.digital.generic_demod
+ gnuradio.digital.generic_mod
+ gnuradio.digital.bpsk.dbpsk_demod
+ gnuradio.digital.bpsk.dbpsk_mod
+ gnuradio.digital.qpsk.dqpsk_demod
+ gnuradio.digital.qpsk.dqpsk_mod
+ gnuradio.digital.gmsk.gmsk_demod
+ gnuradio.digital.gmsk.gmsk_mod
+ gnuradio.digital.bpsk.bpsk_demod
+ gnuradio.digital.bpsk.bpsk_mod
+ gnuradio.digital.psk.psk_demod
+ gnuradio.digital.psk.psk_mod
+ gnuradio.digital.qam.qam_demod
+ gnuradio.digital.qam.qam_mod
+ gnuradio.digital.qpsk.qpsk_demod
+ gnuradio.digital.qpsk.qpsk_mod
+ gnuradio.digital.cpm.cpm_mod
+ gnuradio.digital.pkt.mod_pkts
+ gnuradio.digital.pkt.demod_pkts
+ gnuradio.digital.ofdm_cyclic_prefixer
+ gnuradio.digital.ofdm_frame_acquisition
+ gnuradio.digital.ofdm_frame_sink
+ gnuradio.digital.ofdm_insert_preamble
+ gnuradio.digital.ofdm_mapper_bcv
+ gnuradio.digital.ofdm_mod
+ gnuradio.digital.ofdm_demod
+ gnuradio.digital.ofdm_receiver
+ gnuradio.digital.ofdm_sampler
+ gnuradio.digital.ofdm_sync_fixed
+ gnuradio.digital.ofdm_sync_ml
+ gnuradio.digital.ofdm_sync_pn
+ gnuradio.digital.ofdm_sync_pnac
+
+Constellations
+--------------
+
+.. autosummary::
+ :nosignatures:
+
+ gnuradio.digital.constellation_8psk
+ gnuradio.digital.constellation_bpsk
+ gnuradio.digital.constellation_calcdist
+ gnuradio.digital.constellation_dqpsk
+ gnuradio.digital.constellation_psk
+ gnuradio.digital.constellation_qpsk
+ gnuradio.digital.constellation_qpsk
+ gnuradio.digital.constellation_rect
+ gnuradio.digital.qpsk.qpsk_constellation
+ gnuradio.digital.psk.psk_constellation
+ gnuradio.digital.qam.qam_constellation
+
+Modulation Utilties
+-------------------
+
+.. autosummary::
+ :nosignatures:
+
+ gnuradio.digital.utils.gray_code.gray_code
+ gnuradio.digital.utils.mod_codes.GRAY_CODE
+ gnuradio.digital.utils.mod_codes.NO_CODE
+ gnuradio.digital.modulation_utils.add_type_1_constellation
+ gnuradio.digital.modulation_utils.add_type_1_demod
+ gnuradio.digital.modulation_utils.add_type_1_mod
+ gnuradio.digital.modulation_utils.type_1_constellations
+ gnuradio.digital.modulation_utils.type_1_demods
+ gnuradio.digital.modulation_utils.type_1_mods
+
+Packet Utilities
+----------------
+
+.. autosummary::
+ :nosignatures:
+
+ gnuradio.digital.packet_utils.conv_1_0_string_to_packed_binary_string
+ gnuradio.digital.packet_utils.conv_packed_binary_string_to_1_0_string
+ gnuradio.digital.packet_utils.default_access_code
+ gnuradio.digital.packet_utils.dewhiten
+ gnuradio.digital.packet_utils.is_1_0_string
+ gnuradio.digital.packet_utils.make_header
+ gnuradio.digital.packet_utils.make_packet
+ gnuradio.digital.packet_utils.preamble
+ gnuradio.digital.packet_utils.random_mask_tuple
+ gnuradio.digital.packet_utils.random_mask_vec8
+ gnuradio.digital.packet_utils.string_to_hex_list
+ gnuradio.digital.packet_utils.unmake_packet
+ gnuradio.digital.packet_utils.whiten
+ gnuradio.digital.crc.check_crc32
+ gnuradio.digital.crc.gen_and_append_crc32
+
+OFDM Packet Utilities
+---------------------
+
+.. autosummary::
+ :nosignatures:
+
+ gnuradio.digital.ofdm_packet_utils.conv_1_0_string_to_packed_binary_string
+ gnuradio.digital.ofdm_packet_utils.conv_packed_binary_string_to_1_0_string
+ gnuradio.digital.ofdm_packet_utils.dewhiten
+ gnuradio.digital.ofdm_packet_utils.is_1_0_string
+ gnuradio.digital.ofdm_packet_utils.make_header
+ gnuradio.digital.ofdm_packet_utils.make_packet
+ gnuradio.digital.ofdm_packet_utils.random_mask_tuple
+ gnuradio.digital.ofdm_packet_utils.random_mask_vec8
+ gnuradio.digital.ofdm_packet_utils.string_to_hex_list
+ gnuradio.digital.ofdm_packet_utils.unmake_packet
+ gnuradio.digital.ofdm_packet_utils.whiten
diff --git a/docs/sphinx/source/digital/ofdm.rst b/docs/sphinx/source/digital/ofdm.rst
new file mode 100644
index 000000000..8680503f2
--- /dev/null
+++ b/docs/sphinx/source/digital/ofdm.rst
@@ -0,0 +1,14 @@
+gnuradio.digital: OFDM Packet Utilities
+=======================================
+
+.. autofunction:: gnuradio.digital.ofdm_packet_utils.conv_1_0_string_to_packed_binary_string
+.. autofunction:: gnuradio.digital.ofdm_packet_utils.conv_packed_binary_string_to_1_0_string
+.. autofunction:: gnuradio.digital.ofdm_packet_utils.dewhiten
+.. autofunction:: gnuradio.digital.ofdm_packet_utils.is_1_0_string
+.. autofunction:: gnuradio.digital.ofdm_packet_utils.make_header
+.. autofunction:: gnuradio.digital.ofdm_packet_utils.make_packet
+.. autofunction:: gnuradio.digital.ofdm_packet_utils.random_mask_tuple
+.. autofunction:: gnuradio.digital.ofdm_packet_utils.random_mask_vec8
+.. autofunction:: gnuradio.digital.ofdm_packet_utils.string_to_hex_list
+.. autofunction:: gnuradio.digital.ofdm_packet_utils.unmake_packet
+.. autofunction:: gnuradio.digital.ofdm_packet_utils.whiten
diff --git a/docs/sphinx/source/digital/pkt_utils.rst b/docs/sphinx/source/digital/pkt_utils.rst
new file mode 100644
index 000000000..112e103a2
--- /dev/null
+++ b/docs/sphinx/source/digital/pkt_utils.rst
@@ -0,0 +1,18 @@
+gnuradio.digital: Packet Utilities
+==================================
+
+.. autofunction:: gnuradio.digital.packet_utils.conv_1_0_string_to_packed_binary_string
+.. autofunction:: gnuradio.digital.packet_utils.conv_packed_binary_string_to_1_0_string
+.. data:: gnuradio.digital.packet_utils.default_access_code
+.. autofunction:: gnuradio.digital.packet_utils.dewhiten
+.. autofunction:: gnuradio.digital.packet_utils.is_1_0_string
+.. autofunction:: gnuradio.digital.packet_utils.make_header
+.. autofunction:: gnuradio.digital.packet_utils.make_packet
+.. data:: gnuradio.digital.packet_utils.preamble
+.. autofunction:: gnuradio.digital.packet_utils.random_mask_tuple
+.. autofunction:: gnuradio.digital.packet_utils.random_mask_vec8
+.. autofunction:: gnuradio.digital.packet_utils.string_to_hex_list
+.. autofunction:: gnuradio.digital.packet_utils.unmake_packet
+.. autofunction:: gnuradio.digital.packet_utils.whiten
+.. autofunction:: gnuradio.digital.crc.check_crc32
+.. autofunction:: gnuradio.digital.crc.gen_and_append_crc32
diff --git a/docs/sphinx/source/digital/utilities.rst b/docs/sphinx/source/digital/utilities.rst
new file mode 100644
index 000000000..7a08725a5
--- /dev/null
+++ b/docs/sphinx/source/digital/utilities.rst
@@ -0,0 +1,12 @@
+gnuradio.digital: Modulation Utilities
+======================================
+
+.. autofunction:: gnuradio.digital.utils.gray_code.gray_code
+.. data:: gnuradio.digital.utils.mod_codes.GRAY_CODE
+.. data:: gnuradio.digital.utils.mod_codes.NO_CODE
+.. autofunction:: gnuradio.digital.modulation_utils.add_type_1_constellation
+.. autofunction:: gnuradio.digital.modulation_utils.add_type_1_demod
+.. autofunction:: gnuradio.digital.modulation_utils.add_type_1_mod
+.. data:: gnuradio.digital.modulation_utils.type_1_constellations
+.. data:: gnuradio.digital.modulation_utils.type_1_demods
+.. data:: gnuradio.digital.modulation_utils.type_1_mods
diff --git a/docs/sphinx/source/eng_notation/index.rst b/docs/sphinx/source/eng_notation/index.rst
new file mode 100644
index 000000000..f457754ac
--- /dev/null
+++ b/docs/sphinx/source/eng_notation/index.rst
@@ -0,0 +1,8 @@
+gnuradio.eng_notation
+=====================
+
+.. automodule:: gnuradio.eng_notation
+
+.. autofunction:: gnuradio.eng_notation.num_to_str
+.. autofunction:: gnuradio.eng_notation.str_to_num
+
diff --git a/docs/sphinx/source/eng_option/index.rst b/docs/sphinx/source/eng_option/index.rst
new file mode 100644
index 000000000..b9119ee69
--- /dev/null
+++ b/docs/sphinx/source/eng_option/index.rst
@@ -0,0 +1,6 @@
+gnuradio.eng_option
+===================
+
+.. automodule:: gnuradio.eng_option
+
+.. autoclass:: gnuradio.eng_option.eng_option
diff --git a/docs/sphinx/source/fft.rst b/docs/sphinx/source/fft.rst
new file mode 100644
index 000000000..79a0a4ed2
--- /dev/null
+++ b/docs/sphinx/source/fft.rst
@@ -0,0 +1,8 @@
+gnuradio.fft
+============
+
+.. automodule:: gnuradio.fft
+
+.. autoblock:: gnuradio.fft.fft_vcc
+.. autoblock:: gnuradio.fft.fft_vfc
+.. autoblock:: gnuradio.fft.goertzel_fc
diff --git a/docs/sphinx/source/gr/coding_blk.rst b/docs/sphinx/source/gr/coding_blk.rst
new file mode 100644
index 000000000..e50b990bc
--- /dev/null
+++ b/docs/sphinx/source/gr/coding_blk.rst
@@ -0,0 +1,11 @@
+gnuradio.gr: Information Coding and Decoding
+============================================
+
+.. autooldblock:: gnuradio.gr.additive_scrambler_bb
+.. autooldblock:: gnuradio.gr.descrambler_bb
+.. autooldblock:: gnuradio.gr.diff_decoder_bb
+.. autooldblock:: gnuradio.gr.diff_encoder_bb
+.. autooldblock:: gnuradio.gr.fake_channel_encoder_pp
+.. autooldblock:: gnuradio.gr.fake_channel_decoder_pp
+.. autooldblock:: gnuradio.gr.map_bb
+.. autooldblock:: gnuradio.gr.scrambler_bb
diff --git a/docs/sphinx/source/gr/converter_blk.rst b/docs/sphinx/source/gr/converter_blk.rst
new file mode 100644
index 000000000..790109a94
--- /dev/null
+++ b/docs/sphinx/source/gr/converter_blk.rst
@@ -0,0 +1,32 @@
+gnuradio.gr: Type Conversions
+=============================
+
+.. autooldblock:: gnuradio.gr.bytes_to_syms
+.. autooldblock:: gnuradio.gr.char_to_float
+.. autooldblock:: gnuradio.gr.complex_to_interleaved_short
+.. autooldblock:: gnuradio.gr.complex_to_float
+.. autooldblock:: gnuradio.gr.complex_to_real
+.. autooldblock:: gnuradio.gr.complex_to_imag
+.. autooldblock:: gnuradio.gr.complex_to_mag
+.. autooldblock:: gnuradio.gr.complex_to_mag_squared
+.. autooldblock:: gnuradio.gr.complex_to_arg
+.. autooldblock:: gnuradio.gr.float_to_char
+.. autooldblock:: gnuradio.gr.float_to_complex
+.. autooldblock:: gnuradio.gr.float_to_short
+.. autooldblock:: gnuradio.gr.float_to_uchar
+.. autooldblock:: gnuradio.gr.interleaved_short_to_complex
+.. autooldblock:: gnuradio.gr.short_to_float
+.. autooldblock:: gnuradio.gr.uchar_to_float
+.. autooldblock:: gnuradio.gr.unpack_k_bits_bb
+.. autooldblock:: gnuradio.gr.chunks_to_symbols_bc
+.. autooldblock:: gnuradio.gr.chunks_to_symbols_bf
+.. autooldblock:: gnuradio.gr.chunks_to_symbols_ic
+.. autooldblock:: gnuradio.gr.chunks_to_symbols_if
+.. autooldblock:: gnuradio.gr.chunks_to_symbols_sc
+.. autooldblock:: gnuradio.gr.chunks_to_symbols_sf
+.. autooldblock:: gnuradio.gr.packed_to_unpacked_bb
+.. autooldblock:: gnuradio.gr.packed_to_unpacked_ii
+.. autooldblock:: gnuradio.gr.packed_to_unpacked_ss
+.. autooldblock:: gnuradio.gr.unpacked_to_packed_bb
+.. autooldblock:: gnuradio.gr.unpacked_to_packed_ii
+.. autooldblock:: gnuradio.gr.unpacked_to_packed_ss
diff --git a/docs/sphinx/source/gr/demodulation_blk.rst b/docs/sphinx/source/gr/demodulation_blk.rst
new file mode 100644
index 000000000..4f800b642
--- /dev/null
+++ b/docs/sphinx/source/gr/demodulation_blk.rst
@@ -0,0 +1,4 @@
+gnuradio.gr: Demodulation
+=========================
+
+.. autooldblock:: gnuradio.gr.quadrature_demod_cf
diff --git a/docs/sphinx/source/gr/dft_blk.rst b/docs/sphinx/source/gr/dft_blk.rst
new file mode 100644
index 000000000..4ac1d2e62
--- /dev/null
+++ b/docs/sphinx/source/gr/dft_blk.rst
@@ -0,0 +1,6 @@
+gnuradio.gr: Fourier Transform
+==============================
+
+.. autooldblock:: gnuradio.gr.goertzel_fc
+.. autooldblock:: gnuradio.gr.fft_vcc
+.. autooldblock:: gnuradio.gr.fft_vfc
diff --git a/docs/sphinx/source/gr/filter_blk.rst b/docs/sphinx/source/gr/filter_blk.rst
new file mode 100644
index 000000000..a73ddda2a
--- /dev/null
+++ b/docs/sphinx/source/gr/filter_blk.rst
@@ -0,0 +1,46 @@
+gnuradio.gr: Filters
+====================
+
+.. autooldblock:: gnuradio.gr.fft_filter_ccc
+.. autooldblock:: gnuradio.gr.fft_filter_fff
+.. autooldblock:: gnuradio.gr.filter_delay_fc
+.. autooldblock:: gnuradio.gr.fir_filter_ccc
+.. autooldblock:: gnuradio.gr.fir_filter_ccf
+.. autooldblock:: gnuradio.gr.fir_filter_fcc
+.. autooldblock:: gnuradio.gr.fir_filter_fff
+.. autooldblock:: gnuradio.gr.fir_filter_fsf
+.. autooldblock:: gnuradio.gr.fir_filter_scc
+.. autooldblock:: gnuradio.gr.fractional_interpolator_cc
+.. autooldblock:: gnuradio.gr.fractional_interpolator_ff
+.. autooldblock:: gnuradio.gr.freq_xlating_fir_filter_ccc
+.. autooldblock:: gnuradio.gr.freq_xlating_fir_filter_ccf
+.. autooldblock:: gnuradio.gr.freq_xlating_fir_filter_fcc
+.. autooldblock:: gnuradio.gr.freq_xlating_fir_filter_fcf
+.. autooldblock:: gnuradio.gr.freq_xlating_fir_filter_scc
+.. autooldblock:: gnuradio.gr.freq_xlating_fir_filter_scf
+.. autooldblock:: gnuradio.gr.hilbert_fc
+.. autooldblock:: gnuradio.gr.iir_filter_ffd
+.. autooldblock:: gnuradio.gr.interp_fir_filter_ccc
+.. autooldblock:: gnuradio.gr.interp_fir_filter_ccf
+.. autooldblock:: gnuradio.gr.interp_fir_filter_fcc
+.. autooldblock:: gnuradio.gr.interp_fir_filter_fff
+.. autooldblock:: gnuradio.gr.interp_fir_filter_fsf
+.. autooldblock:: gnuradio.gr.interp_fir_filter_scc
+.. autooldblock:: gnuradio.gr.rational_resampler_base_ccc
+.. autooldblock:: gnuradio.gr.rational_resampler_base_ccf
+.. autooldblock:: gnuradio.gr.rational_resampler_base_fcc
+.. autooldblock:: gnuradio.gr.rational_resampler_base_fff
+.. autooldblock:: gnuradio.gr.rational_resampler_base_fsf
+.. autooldblock:: gnuradio.gr.rational_resampler_base_scc
+.. autooldblock:: gnuradio.gr.single_pole_iir_filter_cc
+.. autooldblock:: gnuradio.gr.single_pole_iir_filter_ff
+.. autooldblock:: gnuradio.gr.moving_average_cc
+.. autooldblock:: gnuradio.gr.moving_average_ff
+.. autooldblock:: gnuradio.gr.moving_average_ii
+.. autooldblock:: gnuradio.gr.moving_average_ss
+.. autooldblock:: gnuradio.gr.pfb_arb_resampler_ccf
+.. autooldblock:: gnuradio.gr.pfb_channelizer_ccf
+.. autooldblock:: gnuradio.gr.pfb_clock_sync_ccf
+.. autooldblock:: gnuradio.gr.pfb_clock_sync_fff
+.. autooldblock:: gnuradio.gr.pfb_decimator_ccf
+.. autooldblock:: gnuradio.gr.pfb_interpolator_ccf
diff --git a/docs/sphinx/source/gr/filter_design.rst b/docs/sphinx/source/gr/filter_design.rst
new file mode 100644
index 000000000..6ab23c50b
--- /dev/null
+++ b/docs/sphinx/source/gr/filter_design.rst
@@ -0,0 +1,7 @@
+gnuradio.gr: Digital Filter Design
+==================================
+
+.. autoclass:: gnuradio.gr.firdes
+ :members:
+
+.. autofunction:: gnuradio.gr.remez
diff --git a/docs/sphinx/source/gr/index.rst b/docs/sphinx/source/gr/index.rst
new file mode 100644
index 000000000..3d32599f1
--- /dev/null
+++ b/docs/sphinx/source/gr/index.rst
@@ -0,0 +1,380 @@
+gnuradio.gr
+===========
+
+.. automodule:: gnuradio.gr
+
+Signal Processing Blocks
+------------------------
+
+Top Block and Hierarchical Block Base Classes
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+.. autosummary::
+ :nosignatures:
+
+ gnuradio.gr.top_block
+ gnuradio.gr.hier_block2
+
+Signal Sources
+^^^^^^^^^^^^^^
+
+.. autosummary::
+ :nosignatures:
+
+ gnuradio.gr.glfsr_source_b
+ gnuradio.gr.glfsr_source_f
+ gnuradio.gr.lfsr_32k_source_s
+ gnuradio.gr.null_source
+ gnuradio.gr.noise_source_c
+ gnuradio.gr.noise_source_f
+ gnuradio.gr.noise_source_i
+ gnuradio.gr.noise_source_s
+ gnuradio.gr.sig_source_c
+ gnuradio.gr.sig_source_f
+ gnuradio.gr.sig_source_i
+ gnuradio.gr.sig_source_s
+ gnuradio.gr.vector_source_b
+ gnuradio.gr.vector_source_c
+ gnuradio.gr.vector_source_f
+ gnuradio.gr.vector_source_i
+ gnuradio.gr.vector_source_s
+ gnuradio.gr.file_descriptor_source
+ gnuradio.gr.file_source
+ gnuradio.gr.message_source
+ gnuradio.gr.udp_source
+ gnuradio.gr.wavfile_source
+
+Signal Sinks
+^^^^^^^^^^^^
+
+.. autosummary::
+ :nosignatures:
+
+ gnuradio.gr.bin_statistics_f
+ gnuradio.gr.check_counting_s
+ gnuradio.gr.check_lfsr_32k_s
+ gnuradio.gr.framer_sink_1
+ gnuradio.gr.null_sink
+ gnuradio.gr.packet_sink
+ gnuradio.gr.probe_avg_mag_sqrd_c
+ gnuradio.gr.probe_avg_mag_sqrd_cf
+ gnuradio.gr.probe_avg_mag_sqrd_f
+ gnuradio.gr.probe_signal_f
+ gnuradio.gr.vector_sink_b
+ gnuradio.gr.vector_sink_c
+ gnuradio.gr.vector_sink_f
+ gnuradio.gr.vector_sink_i
+ gnuradio.gr.vector_sink_s
+ gnuradio.gr.file_descriptor_sink
+ gnuradio.gr.file_sink
+ gnuradio.gr.histo_sink_f
+ gnuradio.gr.message_sink
+ gnuradio.gr.oscope_sink_f
+ gnuradio.gr.udp_sink
+ gnuradio.gr.wavfile_sink
+
+Filters
+^^^^^^^
+
+.. autosummary::
+ :nosignatures:
+
+ gnuradio.gr.fft_filter_ccc
+ gnuradio.gr.fft_filter_fff
+ gnuradio.gr.filter_delay_fc
+ gnuradio.gr.fir_filter_ccc
+ gnuradio.gr.fir_filter_ccf
+ gnuradio.gr.fir_filter_fcc
+ gnuradio.gr.fir_filter_fff
+ gnuradio.gr.fir_filter_fsf
+ gnuradio.gr.fir_filter_scc
+ gnuradio.gr.fractional_interpolator_cc
+ gnuradio.gr.fractional_interpolator_ff
+ gnuradio.gr.freq_xlating_fir_filter_ccc
+ gnuradio.gr.freq_xlating_fir_filter_ccf
+ gnuradio.gr.freq_xlating_fir_filter_fcc
+ gnuradio.gr.freq_xlating_fir_filter_fcf
+ gnuradio.gr.freq_xlating_fir_filter_scc
+ gnuradio.gr.freq_xlating_fir_filter_scf
+ gnuradio.gr.hilbert_fc
+ gnuradio.gr.iir_filter_ffd
+ gnuradio.gr.interp_fir_filter_ccc
+ gnuradio.gr.interp_fir_filter_ccf
+ gnuradio.gr.interp_fir_filter_fcc
+ gnuradio.gr.interp_fir_filter_fff
+ gnuradio.gr.interp_fir_filter_fsf
+ gnuradio.gr.interp_fir_filter_scc
+ gnuradio.gr.rational_resampler_base_ccc
+ gnuradio.gr.rational_resampler_base_ccf
+ gnuradio.gr.rational_resampler_base_fcc
+ gnuradio.gr.rational_resampler_base_fff
+ gnuradio.gr.rational_resampler_base_fsf
+ gnuradio.gr.rational_resampler_base_scc
+ gnuradio.gr.single_pole_iir_filter_cc
+ gnuradio.gr.single_pole_iir_filter_ff
+ gnuradio.gr.moving_average_cc
+ gnuradio.gr.moving_average_ff
+ gnuradio.gr.moving_average_ii
+ gnuradio.gr.moving_average_ss
+ gnuradio.gr.pfb_arb_resampler_ccf
+ gnuradio.gr.pfb_channelizer_ccf
+ gnuradio.gr.pfb_clock_sync_ccf
+ gnuradio.gr.pfb_clock_sync_fff
+ gnuradio.gr.pfb_decimator_ccf
+ gnuradio.gr.pfb_interpolator_ccf
+
+Mathematics
+^^^^^^^^^^^
+
+.. autosummary::
+ :nosignatures:
+
+ gnuradio.gr.conjugate_cc
+ gnuradio.gr.nlog10_ff
+ gnuradio.gr.rms_cf
+ gnuradio.gr.rms_ff
+ gnuradio.gr.add_cc
+ gnuradio.gr.add_const_cc
+ gnuradio.gr.add_const_ff
+ gnuradio.gr.add_const_ii
+ gnuradio.gr.add_const_sf
+ gnuradio.gr.add_const_ss
+ gnuradio.gr.add_const_vcc
+ gnuradio.gr.add_const_vff
+ gnuradio.gr.add_const_vii
+ gnuradio.gr.add_const_vss
+ gnuradio.gr.add_ff
+ gnuradio.gr.add_ii
+ gnuradio.gr.add_ss
+ gnuradio.gr.and_bb
+ gnuradio.gr.and_const_bb
+ gnuradio.gr.and_const_ii
+ gnuradio.gr.and_const_ss
+ gnuradio.gr.and_ii
+ gnuradio.gr.and_ss
+ gnuradio.gr.divide_cc
+ gnuradio.gr.divide_ff
+ gnuradio.gr.divide_ii
+ gnuradio.gr.divide_ss
+ gnuradio.gr.integrate_cc
+ gnuradio.gr.integrate_ff
+ gnuradio.gr.integrate_ii
+ gnuradio.gr.integrate_ss
+ gnuradio.gr.multiply_cc
+ gnuradio.gr.multiply_const_cc
+ gnuradio.gr.multiply_const_ff
+ gnuradio.gr.multiply_const_ii
+ gnuradio.gr.multiply_const_ss
+ gnuradio.gr.multiply_const_vcc
+ gnuradio.gr.multiply_const_vff
+ gnuradio.gr.multiply_const_vii
+ gnuradio.gr.multiply_const_vss
+ gnuradio.gr.multiply_ff
+ gnuradio.gr.multiply_ii
+ gnuradio.gr.multiply_ss
+ gnuradio.gr.not_bb
+ gnuradio.gr.not_ii
+ gnuradio.gr.not_ss
+ gnuradio.gr.or_bb
+ gnuradio.gr.or_ii
+ gnuradio.gr.or_ss
+ gnuradio.gr.sub_cc
+ gnuradio.gr.sub_ff
+ gnuradio.gr.sub_ii
+ gnuradio.gr.sub_ss
+ gnuradio.gr.xor_bb
+ gnuradio.gr.xor_ii
+ gnuradio.gr.xor_ss
+
+Modulation
+^^^^^^^^^^
+
+.. autosummary::
+ :nosignatures:
+
+ gnuradio.gr.cpfsk_bc
+ gnuradio.gr.frequency_modulator_fc
+ gnuradio.gr.phase_modulator_fc
+
+Demodulation
+^^^^^^^^^^^^
+
+.. autosummary::
+ :nosignatures:
+
+ gnuradio.gr.quadrature_demod_cf
+
+Information Coding and Decoding
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+.. autosummary::
+ :nosignatures:
+
+ gnuradio.gr.additive_scrambler_bb
+ gnuradio.gr.descrambler_bb
+ gnuradio.gr.diff_decoder_bb
+ gnuradio.gr.diff_encoder_bb
+ gnuradio.gr.fake_channel_encoder_pp
+ gnuradio.gr.fake_channel_decoder_pp
+ gnuradio.gr.map_bb
+ gnuradio.gr.scrambler_bb
+
+Synchronization
+^^^^^^^^^^^^^^^
+
+.. autosummary::
+ :nosignatures:
+
+ gnuradio.gr.pll_carriertracking_cc
+ gnuradio.gr.pll_freqdet_cf
+ gnuradio.gr.pll_refout_cc
+ gnuradio.gr.pn_correlator_cc
+ gnuradio.gr.simple_correlator
+ gnuradio.gr.simple_framer
+
+Type Conversions
+^^^^^^^^^^^^^^^^
+
+.. autosummary::
+ :nosignatures:
+
+ gnuradio.gr.bytes_to_syms
+ gnuradio.gr.char_to_float
+ gnuradio.gr.complex_to_interleaved_short
+ gnuradio.gr.complex_to_float
+ gnuradio.gr.complex_to_real
+ gnuradio.gr.complex_to_imag
+ gnuradio.gr.complex_to_mag
+ gnuradio.gr.complex_to_mag_squared
+ gnuradio.gr.complex_to_arg
+ gnuradio.gr.float_to_char
+ gnuradio.gr.float_to_complex
+ gnuradio.gr.float_to_short
+ gnuradio.gr.float_to_uchar
+ gnuradio.gr.interleaved_short_to_complex
+ gnuradio.gr.short_to_float
+ gnuradio.gr.uchar_to_float
+ gnuradio.gr.unpack_k_bits_bb
+ gnuradio.gr.chunks_to_symbols_bc
+ gnuradio.gr.chunks_to_symbols_bf
+ gnuradio.gr.chunks_to_symbols_ic
+ gnuradio.gr.chunks_to_symbols_if
+ gnuradio.gr.chunks_to_symbols_sc
+ gnuradio.gr.chunks_to_symbols_sf
+ gnuradio.gr.packed_to_unpacked_bb
+ gnuradio.gr.packed_to_unpacked_ii
+ gnuradio.gr.packed_to_unpacked_ss
+ gnuradio.gr.unpacked_to_packed_bb
+ gnuradio.gr.unpacked_to_packed_ii
+ gnuradio.gr.unpacked_to_packed_ss
+
+Signal Level Control (AGC)
+^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+.. autosummary::
+ :nosignatures:
+
+ gnuradio.gr.agc2_cc
+ gnuradio.gr.agc2_ff
+ gnuradio.gr.agc_cc
+ gnuradio.gr.agc_ff
+ gnuradio.gr.ctcss_squelch_ff
+ gnuradio.gr.dpll_bb
+ gnuradio.gr.feedforward_agc_cc
+ gnuradio.gr.peak_detector2_fb
+ gnuradio.gr.pwr_squelch_cc
+ gnuradio.gr.pwr_squelch_ff
+ gnuradio.gr.regenerate_bb
+ gnuradio.gr.simple_squelch_cc
+ gnuradio.gr.mute_cc
+ gnuradio.gr.mute_ff
+ gnuradio.gr.mute_ii
+ gnuradio.gr.mute_ss
+ gnuradio.gr.peak_detector_fb
+ gnuradio.gr.peak_detector_ib
+ gnuradio.gr.peak_detector_sb
+ gnuradio.gr.sample_and_hold_bb
+ gnuradio.gr.sample_and_hold_ff
+ gnuradio.gr.sample_and_hold_ii
+ gnuradio.gr.sample_and_hold_ss
+
+Fourier Transform
+^^^^^^^^^^^^^^^^^
+
+.. autosummary::
+ :nosignatures:
+
+ gnuradio.gr.goertzel_fc
+ gnuradio.gr.fft_vcc
+ gnuradio.gr.fft_vfc
+
+Miscellaneous Blocks
+^^^^^^^^^^^^^^^^^^^^
+
+.. autosummary::
+ :nosignatures:
+
+ gnuradio.gr.copy
+ gnuradio.gr.delay
+ gnuradio.gr.kludge_copy
+ gnuradio.gr.nop
+ gnuradio.gr.pa_2x2_phase_combiner
+ gnuradio.gr.repeat
+ gnuradio.gr.threshold_ff
+ gnuradio.gr.throttle
+ gnuradio.gr.channel_model
+
+Slicing and Dicing Streams
+^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+.. autosummary::
+ :nosignatures:
+
+ gnuradio.gr.deinterleave
+ gnuradio.gr.head
+ gnuradio.gr.interleave
+ gnuradio.gr.keep_one_in_n
+ gnuradio.gr.skiphead
+ gnuradio.gr.stream_to_streams
+ gnuradio.gr.stream_to_vector
+ gnuradio.gr.streams_to_stream
+ gnuradio.gr.streams_to_vector
+ gnuradio.gr.vector_to_stream
+ gnuradio.gr.vector_to_streams
+
+Digital Filter Design
+---------------------
+
+.. autosummary::
+ :nosignatures:
+
+ gnuradio.gr.firdes
+ gnuradio.gr.remez
+
+Miscellaneous
+-------------
+
+.. autosummary::
+ :nosignatures:
+
+ gnuradio.gr.feval_dd
+ gnuradio.gr.feval_cc
+ gnuradio.gr.feval_ll
+ gnuradio.gr.feval
+ gnuradio.gr.prefs
+ gnuradio.gr.test
+ gnuradio.gr.message
+ gnuradio.gr.msg_queue
+ gnuradio.gr.enable_realtime_scheduling
+
+Implementation Details
+----------------------
+
+.. autosummary::
+ :nosignatures:
+
+ gnuradio.gr.block_detail
+ gnuradio.gr.buffer
+ gnuradio.gr.dispatcher
+ gnuradio.gr.single_threaded_scheduler
+
diff --git a/docs/sphinx/source/gr/internal.rst b/docs/sphinx/source/gr/internal.rst
new file mode 100644
index 000000000..4948b38d4
--- /dev/null
+++ b/docs/sphinx/source/gr/internal.rst
@@ -0,0 +1,7 @@
+gnuradio.gr: Implementation Details
+===================================
+
+.. autofunction:: gnuradio.gr.block_detail
+.. autofunction:: gnuradio.gr.buffer
+.. autofunction:: gnuradio.gr.dispatcher
+.. autofunction:: gnuradio.gr.single_threaded_scheduler
diff --git a/docs/sphinx/source/gr/level_blk.rst b/docs/sphinx/source/gr/level_blk.rst
new file mode 100644
index 000000000..d6c565c65
--- /dev/null
+++ b/docs/sphinx/source/gr/level_blk.rst
@@ -0,0 +1,26 @@
+gnuradio.gr: Signal Level Control (AGC)
+=======================================
+
+.. autooldblock:: gnuradio.gr.agc2_cc
+.. autooldblock:: gnuradio.gr.agc2_ff
+.. autooldblock:: gnuradio.gr.agc_cc
+.. autooldblock:: gnuradio.gr.agc_ff
+.. autooldblock:: gnuradio.gr.ctcss_squelch_ff
+.. autooldblock:: gnuradio.gr.dpll_bb
+.. autooldblock:: gnuradio.gr.feedforward_agc_cc
+.. autooldblock:: gnuradio.gr.peak_detector2_fb
+.. autooldblock:: gnuradio.gr.pwr_squelch_cc
+.. autooldblock:: gnuradio.gr.pwr_squelch_ff
+.. autooldblock:: gnuradio.gr.regenerate_bb
+.. autooldblock:: gnuradio.gr.simple_squelch_cc
+.. autooldblock:: gnuradio.gr.mute_cc
+.. autooldblock:: gnuradio.gr.mute_ff
+.. autooldblock:: gnuradio.gr.mute_ii
+.. autooldblock:: gnuradio.gr.mute_ss
+.. autooldblock:: gnuradio.gr.peak_detector_fb
+.. autooldblock:: gnuradio.gr.peak_detector_ib
+.. autooldblock:: gnuradio.gr.peak_detector_sb
+.. autooldblock:: gnuradio.gr.sample_and_hold_bb
+.. autooldblock:: gnuradio.gr.sample_and_hold_ff
+.. autooldblock:: gnuradio.gr.sample_and_hold_ii
+.. autooldblock:: gnuradio.gr.sample_and_hold_ss
diff --git a/docs/sphinx/source/gr/math_blk.rst b/docs/sphinx/source/gr/math_blk.rst
new file mode 100644
index 000000000..7b9437f99
--- /dev/null
+++ b/docs/sphinx/source/gr/math_blk.rst
@@ -0,0 +1,59 @@
+gnuradio.gr: Mathematics
+========================
+
+.. autooldblock:: gnuradio.gr.conjugate_cc
+.. autooldblock:: gnuradio.gr.nlog10_ff
+.. autooldblock:: gnuradio.gr.rms_cf
+.. autooldblock:: gnuradio.gr.rms_ff
+.. autooldblock:: gnuradio.gr.add_cc
+.. autooldblock:: gnuradio.gr.add_const_cc
+.. autooldblock:: gnuradio.gr.add_const_ff
+.. autooldblock:: gnuradio.gr.add_const_ii
+.. autooldblock:: gnuradio.gr.add_const_sf
+.. autooldblock:: gnuradio.gr.add_const_ss
+.. autooldblock:: gnuradio.gr.add_const_vcc
+.. autooldblock:: gnuradio.gr.add_const_vff
+.. autooldblock:: gnuradio.gr.add_const_vii
+.. autooldblock:: gnuradio.gr.add_const_vss
+.. autooldblock:: gnuradio.gr.add_ff
+.. autooldblock:: gnuradio.gr.add_ii
+.. autooldblock:: gnuradio.gr.add_ss
+.. autooldblock:: gnuradio.gr.and_bb
+.. autooldblock:: gnuradio.gr.and_const_bb
+.. autooldblock:: gnuradio.gr.and_const_ii
+.. autooldblock:: gnuradio.gr.and_const_ss
+.. autooldblock:: gnuradio.gr.and_ii
+.. autooldblock:: gnuradio.gr.and_ss
+.. autooldblock:: gnuradio.gr.divide_cc
+.. autooldblock:: gnuradio.gr.divide_ff
+.. autooldblock:: gnuradio.gr.divide_ii
+.. autooldblock:: gnuradio.gr.divide_ss
+.. autooldblock:: gnuradio.gr.integrate_cc
+.. autooldblock:: gnuradio.gr.integrate_ff
+.. autooldblock:: gnuradio.gr.integrate_ii
+.. autooldblock:: gnuradio.gr.integrate_ss
+.. autooldblock:: gnuradio.gr.multiply_cc
+.. autooldblock:: gnuradio.gr.multiply_const_cc
+.. autooldblock:: gnuradio.gr.multiply_const_ff
+.. autooldblock:: gnuradio.gr.multiply_const_ii
+.. autooldblock:: gnuradio.gr.multiply_const_ss
+.. autooldblock:: gnuradio.gr.multiply_const_vcc
+.. autooldblock:: gnuradio.gr.multiply_const_vff
+.. autooldblock:: gnuradio.gr.multiply_const_vii
+.. autooldblock:: gnuradio.gr.multiply_const_vss
+.. autooldblock:: gnuradio.gr.multiply_ff
+.. autooldblock:: gnuradio.gr.multiply_ii
+.. autooldblock:: gnuradio.gr.multiply_ss
+.. autooldblock:: gnuradio.gr.not_bb
+.. autooldblock:: gnuradio.gr.not_ii
+.. autooldblock:: gnuradio.gr.not_ss
+.. autooldblock:: gnuradio.gr.or_bb
+.. autooldblock:: gnuradio.gr.or_ii
+.. autooldblock:: gnuradio.gr.or_ss
+.. autooldblock:: gnuradio.gr.sub_cc
+.. autooldblock:: gnuradio.gr.sub_ff
+.. autooldblock:: gnuradio.gr.sub_ii
+.. autooldblock:: gnuradio.gr.sub_ss
+.. autooldblock:: gnuradio.gr.xor_bb
+.. autooldblock:: gnuradio.gr.xor_ii
+.. autooldblock:: gnuradio.gr.xor_ss
diff --git a/docs/sphinx/source/gr/misc.rst b/docs/sphinx/source/gr/misc.rst
new file mode 100644
index 000000000..b0a3f3ba1
--- /dev/null
+++ b/docs/sphinx/source/gr/misc.rst
@@ -0,0 +1,12 @@
+gnuradio.gr: Miscellaneous
+==========================
+
+.. autofunction:: gnuradio.gr.feval_dd
+.. autofunction:: gnuradio.gr.feval_cc
+.. autofunction:: gnuradio.gr.feval_ll
+.. autofunction:: gnuradio.gr.feval
+.. autofunction:: gnuradio.gr.prefs
+.. autofunction:: gnuradio.gr.test
+.. autofunction:: gnuradio.gr.message
+.. autofunction:: gnuradio.gr.msg_queue
+.. autofunction:: gnuradio.gr.enable_realtime_scheduling
diff --git a/docs/sphinx/source/gr/misc_blk.rst b/docs/sphinx/source/gr/misc_blk.rst
new file mode 100644
index 000000000..c69293056
--- /dev/null
+++ b/docs/sphinx/source/gr/misc_blk.rst
@@ -0,0 +1,12 @@
+gnuradio.gr: Miscellaneous Blocks
+=================================
+
+.. autooldblock:: gnuradio.gr.copy
+.. autooldblock:: gnuradio.gr.delay
+.. autooldblock:: gnuradio.gr.kludge_copy
+.. autooldblock:: gnuradio.gr.nop
+.. autooldblock:: gnuradio.gr.pa_2x2_phase_combiner
+.. autooldblock:: gnuradio.gr.repeat
+.. autooldblock:: gnuradio.gr.threshold_ff
+.. autooldblock:: gnuradio.gr.throttle
+.. autooldblock:: gnuradio.gr.channel_model
diff --git a/docs/sphinx/source/gr/modulation_blk.rst b/docs/sphinx/source/gr/modulation_blk.rst
new file mode 100644
index 000000000..1fff4614c
--- /dev/null
+++ b/docs/sphinx/source/gr/modulation_blk.rst
@@ -0,0 +1,6 @@
+gnuradio.gr: Modulation
+=======================
+
+.. autooldblock:: gnuradio.gr.cpfsk_bc
+.. autooldblock:: gnuradio.gr.frequency_modulator_fc
+.. autooldblock:: gnuradio.gr.phase_modulator_fc
diff --git a/docs/sphinx/source/gr/sink_blk.rst b/docs/sphinx/source/gr/sink_blk.rst
new file mode 100644
index 000000000..7608ff09b
--- /dev/null
+++ b/docs/sphinx/source/gr/sink_blk.rst
@@ -0,0 +1,25 @@
+gnuradio.gr: Signal Sinks
+=========================
+
+.. autooldblock:: gnuradio.gr.bin_statistics_f
+.. autooldblock:: gnuradio.gr.check_counting_s
+.. autooldblock:: gnuradio.gr.check_lfsr_32k_s
+.. autooldblock:: gnuradio.gr.framer_sink_1
+.. autooldblock:: gnuradio.gr.null_sink
+.. autooldblock:: gnuradio.gr.packet_sink
+.. autooldblock:: gnuradio.gr.probe_avg_mag_sqrd_c
+.. autooldblock:: gnuradio.gr.probe_avg_mag_sqrd_cf
+.. autooldblock:: gnuradio.gr.probe_avg_mag_sqrd_f
+.. autooldblock:: gnuradio.gr.probe_signal_f
+.. autooldblock:: gnuradio.gr.vector_sink_b
+.. autooldblock:: gnuradio.gr.vector_sink_c
+.. autooldblock:: gnuradio.gr.vector_sink_f
+.. autooldblock:: gnuradio.gr.vector_sink_i
+.. autooldblock:: gnuradio.gr.vector_sink_s
+.. autooldblock:: gnuradio.gr.file_descriptor_sink
+.. autooldblock:: gnuradio.gr.file_sink
+.. autooldblock:: gnuradio.gr.histo_sink_f
+.. autooldblock:: gnuradio.gr.message_sink
+.. autooldblock:: gnuradio.gr.oscope_sink_f
+.. autooldblock:: gnuradio.gr.udp_sink
+.. autooldblock:: gnuradio.gr.wavfile_sink
diff --git a/docs/sphinx/source/gr/slicedice_blk.rst b/docs/sphinx/source/gr/slicedice_blk.rst
new file mode 100644
index 000000000..e845627aa
--- /dev/null
+++ b/docs/sphinx/source/gr/slicedice_blk.rst
@@ -0,0 +1,14 @@
+gnuradio.gr: Slicing and Dicing Streams
+=======================================
+
+.. autooldblock:: gnuradio.gr.deinterleave
+.. autooldblock:: gnuradio.gr.head
+.. autooldblock:: gnuradio.gr.interleave
+.. autooldblock:: gnuradio.gr.keep_one_in_n
+.. autooldblock:: gnuradio.gr.skiphead
+.. autooldblock:: gnuradio.gr.stream_to_streams
+.. autooldblock:: gnuradio.gr.stream_to_vector
+.. autooldblock:: gnuradio.gr.streams_to_stream
+.. autooldblock:: gnuradio.gr.streams_to_vector
+.. autooldblock:: gnuradio.gr.vector_to_stream
+.. autooldblock:: gnuradio.gr.vector_to_streams
diff --git a/docs/sphinx/source/gr/source_blk.rst b/docs/sphinx/source/gr/source_blk.rst
new file mode 100644
index 000000000..df873bcf7
--- /dev/null
+++ b/docs/sphinx/source/gr/source_blk.rst
@@ -0,0 +1,26 @@
+gnuradio.gr: Signal Sources
+===========================
+
+.. autooldblock:: gnuradio.gr.glfsr_source_b
+.. autooldblock:: gnuradio.gr.glfsr_source_f
+.. autooldblock:: gnuradio.gr.lfsr_32k_source_s
+.. autooldblock:: gnuradio.gr.null_source
+.. autooldblock:: gnuradio.gr.noise_source_c
+.. autooldblock:: gnuradio.gr.noise_source_f
+.. autooldblock:: gnuradio.gr.noise_source_i
+.. autooldblock:: gnuradio.gr.noise_source_s
+.. autooldblock:: gnuradio.gr.sig_source_c
+.. autooldblock:: gnuradio.gr.sig_source_f
+.. autooldblock:: gnuradio.gr.sig_source_i
+.. autooldblock:: gnuradio.gr.sig_source_s
+.. autooldblock:: gnuradio.gr.vector_source_b
+.. autooldblock:: gnuradio.gr.vector_source_c
+.. autooldblock:: gnuradio.gr.vector_source_f
+.. autooldblock:: gnuradio.gr.vector_source_i
+.. autooldblock:: gnuradio.gr.vector_source_s
+.. autooldblock:: gnuradio.gr.file_descriptor_source
+.. autooldblock:: gnuradio.gr.file_source
+.. autooldblock:: gnuradio.gr.message_source
+.. autooldblock:: gnuradio.gr.udp_source
+.. autooldblock:: gnuradio.gr.wavfile_source
+
diff --git a/docs/sphinx/source/gr/sync_blk.rst b/docs/sphinx/source/gr/sync_blk.rst
new file mode 100644
index 000000000..be9f908f7
--- /dev/null
+++ b/docs/sphinx/source/gr/sync_blk.rst
@@ -0,0 +1,9 @@
+gnuradio.gr: Synchronization
+============================
+
+.. autooldblock:: gnuradio.gr.pll_carriertracking_cc
+.. autooldblock:: gnuradio.gr.pll_freqdet_cf
+.. autooldblock:: gnuradio.gr.pll_refout_cc
+.. autooldblock:: gnuradio.gr.pn_correlator_cc
+.. autooldblock:: gnuradio.gr.simple_correlator
+.. autooldblock:: gnuradio.gr.simple_framer
diff --git a/docs/sphinx/source/gr/top_block.rst b/docs/sphinx/source/gr/top_block.rst
new file mode 100644
index 000000000..3d4e9ef3d
--- /dev/null
+++ b/docs/sphinx/source/gr/top_block.rst
@@ -0,0 +1,7 @@
+gnuradio.gr: Top Block and Hierarchical Block Base Classes
+==========================================================
+
+.. autoclass:: gnuradio.gr.top_block
+
+.. autoclass:: gnuradio.gr.hier_block2
+
diff --git a/docs/sphinx/source/gr_unittest/index.rst b/docs/sphinx/source/gr_unittest/index.rst
new file mode 100644
index 000000000..2169a7da4
--- /dev/null
+++ b/docs/sphinx/source/gr_unittest/index.rst
@@ -0,0 +1,7 @@
+gnuradio.gr_unittest
+====================
+
+.. automodule:: gnuradio.gr_unittest
+
+.. autoclass:: gnuradio.gr_unittest.TestCase
+.. autofunction:: gnuradio.gr_unittest.run
diff --git a/docs/sphinx/source/index.rst b/docs/sphinx/source/index.rst
new file mode 100644
index 000000000..eafebc8d0
--- /dev/null
+++ b/docs/sphinx/source/index.rst
@@ -0,0 +1,133 @@
+gnuradio
+========
+
+.. automodule:: gnuradio
+
+Core Framework
+--------------
+
+.. autosummary::
+ :nosignatures:
+
+ gnuradio.gr
+ gnuradio.digital
+ gnuradio.blks2
+ gnuradio.audio
+ gnuradio.trellis
+ gnuradio.wavelet
+ gnuradio.fft
+ gnuradio.window
+ gnuradio.optfir
+ gnuradio.gr_unittest
+ gnuradio.qtgui
+ gnuradio.wxgui
+
+.. toctree::
+ :hidden:
+
+ gnuradio.gr <gr/index>
+ gnuradio.digital <digital/index>
+ gnuradio.blks2 <blks2/index>
+ gnuradio.audio <audio/index>
+ gnuradio.gr_unittest <gr_unittest/index>
+ gnuradio.optfir <optfir/index>
+ gnuradio.trellis <trellis/index>
+ gnuradio.wavelet <wavelet>
+ gnuradio.fft <fft>
+ gnuradio.window <window/index>
+ gnuradio.qtgui <qtgui/index>
+ gnuradio.wxgui <wxgui/index>
+
+Hardware Interfaces
+------------------
+
+.. autosummary::
+ :nosignatures:
+
+ gnuradio.uhd
+
+.. toctree::
+ :hidden:
+
+ gnuradio.uhd <uhd>
+
+Utilities
+---------
+
+.. autosummary::
+ :nosignatures:
+
+ gnuradio.plot_data
+ gnuradio.eng_notation
+ gnuradio.eng_option
+
+.. toctree::
+ :hidden:
+
+ gnuradio.plot_data <plot_data>
+ gnuradio.eng_notation <eng_notation/index>
+ gnuradio.eng_option <eng_option/index>
+
+Framework Extensions
+--------------------
+
+.. autosummary::
+ :nosignatures:
+
+ gnuradio.atsc
+ gnuradio.noaa
+ gnuradio.pager
+ gnuradio.video_sdl
+ gnuradio.vocoder
+
+.. toctree::
+ :hidden:
+
+ gnuradio.atsc <atsc/index>
+ gnuradio.noaa <noaa>
+ gnuradio.pager <pager/index>
+ gnuradio.video_sdl <video_sdl>
+ gnuradio.vocoder <vocoder/index>
+
+
+.. Use this to add to the toctree but not displayed
+.. It's mostly to get rid of warnings
+
+.. toctree::
+ :hidden:
+
+ coding <gr/coding_blk>
+ converter <gr/converter_blk>
+ demodulation <gr/demodulation_blk>
+ dft <gr/dft_blk>
+ filter <gr/filter_blk>
+ filter_design <gr/filter_design>
+ internal <gr/internal>
+ level <gr/level_blk>
+ math <gr/math_blk>
+ misc <gr/misc>
+ misc <gr/misc_blk>
+ modulation <gr/modulation_blk>
+ sink <gr/sink_blk>
+ slicedice <gr/slicedice_blk>
+ source <gr/source_blk>
+ sync <gr/sync_blk>
+ top_block <gr/top_block>
+
+ atsc_blks <atsc/blks>
+ blks <blks2/blks>
+ blks2_utilities <blks2/utilities>
+ digital_blocks <digital/blocks>
+ constellations <digital/constellations>
+ ofdm <digital/ofdm>
+ pkt_utils <digital/pkt_utils>
+ digital_utilities <digital/utilities>
+ optfir <optfir/detail>
+ pager_blks <pager/blks>
+ pyqt_filter <pyqt_filter>
+ pyqt_plot <pyqt_plot>
+ trellis_blks <trellis/blks>
+ trellis_objs <trellis/objs>
+ vocoder_blks <vocoder/blks>
+ window_detail <window/detail>
+ wxgui_blks <wxgui/blks>
diff --git a/docs/sphinx/source/noaa.rst b/docs/sphinx/source/noaa.rst
new file mode 100644
index 000000000..65461f99b
--- /dev/null
+++ b/docs/sphinx/source/noaa.rst
@@ -0,0 +1,8 @@
+gnuradio.noaa
+==============
+
+.. automodule:: gnuradio.noaa
+
+.. autooldblock:: gnuradio.noaa.hrpt_decoder
+.. autooldblock:: gnuradio.noaa.hrpt_deframer
+.. autooldblock:: gnuradio.noaa.hrpt_pll_cf
diff --git a/docs/sphinx/source/optfir/detail.rst b/docs/sphinx/source/optfir/detail.rst
new file mode 100644
index 000000000..78807bee0
--- /dev/null
+++ b/docs/sphinx/source/optfir/detail.rst
@@ -0,0 +1,14 @@
+gnuradio.optfir
+===============
+
+.. autofunction:: gnuradio.optfir.band_pass
+.. autofunction:: gnuradio.optfir.band_reject
+.. autofunction:: gnuradio.optfir.bporder
+.. autofunction:: gnuradio.optfir.complex_band_pass
+.. autofunction:: gnuradio.optfir.high_pass
+.. autofunction:: gnuradio.optfir.low_pass
+.. autofunction:: gnuradio.optfir.lporder
+.. autofunction:: gnuradio.optfir.passband_ripple_to_dev
+.. autofunction:: gnuradio.optfir.remez
+.. autofunction:: gnuradio.optfir.remezord
+.. autofunction:: gnuradio.optfir.stopband_atten_to_dev
diff --git a/docs/sphinx/source/optfir/index.rst b/docs/sphinx/source/optfir/index.rst
new file mode 100644
index 000000000..f49b01a1f
--- /dev/null
+++ b/docs/sphinx/source/optfir/index.rst
@@ -0,0 +1,19 @@
+gnuradio.optfir
+===============
+
+.. automodule:: gnuradio.optfir
+
+.. autosummary::
+ :nosignatures:
+
+ gnuradio.optfir.band_pass
+ gnuradio.optfir.band_reject
+ gnuradio.optfir.bporder
+ gnuradio.optfir.complex_band_pass
+ gnuradio.optfir.high_pass
+ gnuradio.optfir.low_pass
+ gnuradio.optfir.lporder
+ gnuradio.optfir.passband_ripple_to_dev
+ gnuradio.optfir.remez
+ gnuradio.optfir.remezord
+ gnuradio.optfir.stopband_atten_to_dev
diff --git a/docs/sphinx/source/pager/blks.rst b/docs/sphinx/source/pager/blks.rst
new file mode 100644
index 000000000..a36103d1f
--- /dev/null
+++ b/docs/sphinx/source/pager/blks.rst
@@ -0,0 +1,9 @@
+gnuradio.pager: Signal Processing Blocks
+========================================
+
+.. autooldblock:: gnuradio.pager.flex_deinterleave
+.. autopyblock:: gnuradio.pager.flex_demod
+.. autooldblock:: gnuradio.pager.flex_frame
+.. autooldblock:: gnuradio.pager.flex_parse
+.. autooldblock:: gnuradio.pager.flex_sync
+.. autooldblock:: gnuradio.pager.slicer_fb
diff --git a/docs/sphinx/source/pager/index.rst b/docs/sphinx/source/pager/index.rst
new file mode 100644
index 000000000..36df48451
--- /dev/null
+++ b/docs/sphinx/source/pager/index.rst
@@ -0,0 +1,23 @@
+gnuradio.pager
+==============
+
+.. automodule:: gnuradio.pager
+
+Signal Processing Blocks
+------------------------
+
+.. autosummary::
+ :nosignatures:
+
+ gnuradio.pager.flex_deinterleave
+ gnuradio.pager.flex_demod
+ gnuradio.pager.flex_frame
+ gnuradio.pager.flex_parse
+ gnuradio.pager.flex_sync
+ gnuradio.pager.pager_flex_frame
+ gnuradio.pager.slicer_fb
+
+Utility Functions
+-----------------
+
+.. autofunction:: gnuradio.pager.queue_runner
diff --git a/docs/sphinx/source/plot_data.rst b/docs/sphinx/source/plot_data.rst
new file mode 100644
index 000000000..1b52a083c
--- /dev/null
+++ b/docs/sphinx/source/plot_data.rst
@@ -0,0 +1,6 @@
+gnuradio.plot_data
+==================
+
+.. automodule:: gnuradio.plot_data
+
+.. autoclass:: gnuradio.plot_data.plot_data
diff --git a/docs/sphinx/source/pyqt_filter.rst b/docs/sphinx/source/pyqt_filter.rst
new file mode 100644
index 000000000..cc52abfa7
--- /dev/null
+++ b/docs/sphinx/source/pyqt_filter.rst
@@ -0,0 +1,6 @@
+gnuradio.pyqt_filter
+====================
+
+.. automodule:: gnuradio.pyqt_filter
+
+.. autoclass:: gnuradio.pyqt_filter.Ui_MainWindow
diff --git a/docs/sphinx/source/pyqt_plot.rst b/docs/sphinx/source/pyqt_plot.rst
new file mode 100644
index 000000000..3537a080b
--- /dev/null
+++ b/docs/sphinx/source/pyqt_plot.rst
@@ -0,0 +1,6 @@
+gnuradio.pyqt_plot
+==================
+
+.. automodule:: gnuradio.pyqt_plot
+
+.. autoclass:: gnuradio.pyqt_plot.Ui_MainWindow
diff --git a/docs/sphinx/source/qtgui/index.rst b/docs/sphinx/source/qtgui/index.rst
new file mode 100644
index 000000000..83bdedca8
--- /dev/null
+++ b/docs/sphinx/source/qtgui/index.rst
@@ -0,0 +1,9 @@
+gnuradio.qtgui
+==============
+
+.. automodule:: gnuradio.qtgui
+
+.. autooldblock:: gnuradio.qtgui.sink_c
+.. autooldblock:: gnuradio.qtgui.sink_f
+.. autooldblock:: gnuradio.qtgui.time_sink_c
+.. autooldblock:: gnuradio.qtgui.time_sink_f
diff --git a/docs/sphinx/source/trellis/blks.rst b/docs/sphinx/source/trellis/blks.rst
new file mode 100644
index 000000000..d82319bad
--- /dev/null
+++ b/docs/sphinx/source/trellis/blks.rst
@@ -0,0 +1,62 @@
+gnuradio.trellis: Signal Processing Blocks
+==========================================
+
+.. autooldblock:: gnuradio.trellis.constellation_metrics_cf
+.. autooldblock:: gnuradio.trellis.encoder_bb
+.. autooldblock:: gnuradio.trellis.encoder_bi
+.. autooldblock:: gnuradio.trellis.encoder_bs
+.. autooldblock:: gnuradio.trellis.encoder_ii
+.. autooldblock:: gnuradio.trellis.encoder_si
+.. autooldblock:: gnuradio.trellis.encoder_ss
+.. autooldblock:: gnuradio.trellis.metrics_c
+.. autooldblock:: gnuradio.trellis.metrics_f
+.. autooldblock:: gnuradio.trellis.metrics_i
+.. autooldblock:: gnuradio.trellis.metrics_s
+.. autooldblock:: gnuradio.trellis.pccc_decoder_b
+.. autooldblock:: gnuradio.trellis.pccc_decoder_combined_cb
+.. autooldblock:: gnuradio.trellis.pccc_decoder_combined_ci
+.. autooldblock:: gnuradio.trellis.pccc_decoder_combined_cs
+.. autooldblock:: gnuradio.trellis.pccc_decoder_combined_fb
+.. autooldblock:: gnuradio.trellis.pccc_decoder_combined_fi
+.. autooldblock:: gnuradio.trellis.pccc_decoder_combined_fs
+.. autooldblock:: gnuradio.trellis.pccc_decoder_i
+.. autooldblock:: gnuradio.trellis.pccc_decoder_s
+.. autooldblock:: gnuradio.trellis.pccc_encoder_bb
+.. autooldblock:: gnuradio.trellis.pccc_encoder_bi
+.. autooldblock:: gnuradio.trellis.pccc_encoder_bs
+.. autooldblock:: gnuradio.trellis.pccc_encoder_ii
+.. autooldblock:: gnuradio.trellis.pccc_encoder_si
+.. autooldblock:: gnuradio.trellis.pccc_encoder_ss
+.. autooldblock:: gnuradio.trellis.permutation
+.. autooldblock:: gnuradio.trellis.sccc_decoder_b
+.. autooldblock:: gnuradio.trellis.sccc_decoder_combined_cb
+.. autooldblock:: gnuradio.trellis.sccc_decoder_combined_ci
+.. autooldblock:: gnuradio.trellis.sccc_decoder_combined_cs
+.. autooldblock:: gnuradio.trellis.sccc_decoder_combined_fb
+.. autooldblock:: gnuradio.trellis.sccc_decoder_combined_fi
+.. autooldblock:: gnuradio.trellis.sccc_decoder_combined_fs
+.. autooldblock:: gnuradio.trellis.sccc_decoder_i
+.. autooldblock:: gnuradio.trellis.sccc_decoder_s
+.. autooldblock:: gnuradio.trellis.sccc_encoder_bb
+.. autooldblock:: gnuradio.trellis.sccc_encoder_bi
+.. autooldblock:: gnuradio.trellis.sccc_encoder_bs
+.. autooldblock:: gnuradio.trellis.sccc_encoder_ii
+.. autooldblock:: gnuradio.trellis.sccc_encoder_si
+.. autooldblock:: gnuradio.trellis.sccc_encoder_ss
+.. autooldblock:: gnuradio.trellis.siso_combined_f
+.. autooldblock:: gnuradio.trellis.siso_f
+.. autooldblock:: gnuradio.trellis.viterbi_b
+.. autooldblock:: gnuradio.trellis.viterbi_combined_cb
+.. autooldblock:: gnuradio.trellis.viterbi_combined_ci
+.. autooldblock:: gnuradio.trellis.viterbi_combined_cs
+.. autooldblock:: gnuradio.trellis.viterbi_combined_fb
+.. autooldblock:: gnuradio.trellis.viterbi_combined_fi
+.. autooldblock:: gnuradio.trellis.viterbi_combined_fs
+.. autooldblock:: gnuradio.trellis.viterbi_combined_ib
+.. autooldblock:: gnuradio.trellis.viterbi_combined_ii
+.. autooldblock:: gnuradio.trellis.viterbi_combined_is
+.. autooldblock:: gnuradio.trellis.viterbi_combined_sb
+.. autooldblock:: gnuradio.trellis.viterbi_combined_si
+.. autooldblock:: gnuradio.trellis.viterbi_combined_ss
+.. autooldblock:: gnuradio.trellis.viterbi_i
+.. autooldblock:: gnuradio.trellis.viterbi_s
diff --git a/docs/sphinx/source/trellis/index.rst b/docs/sphinx/source/trellis/index.rst
new file mode 100644
index 000000000..8a451a913
--- /dev/null
+++ b/docs/sphinx/source/trellis/index.rst
@@ -0,0 +1,90 @@
+gnuradio.trellis
+================
+
+.. automodule:: gnuradio.trellis
+
+Object Classes
+--------------
+
+.. autosummary::
+ :nosignatures:
+
+ gnuradio.trellis.fsm
+ gnuradio.trellis.interleaver
+
+Signal Processing Blocks
+------------------------
+
+.. autosummary::
+ :nosignatures:
+
+ gnuradio.trellis.constellation_metrics_cf
+ gnuradio.trellis.encoder_bb
+ gnuradio.trellis.encoder_bi
+ gnuradio.trellis.encoder_bs
+ gnuradio.trellis.encoder_ii
+ gnuradio.trellis.encoder_si
+ gnuradio.trellis.encoder_ss
+ gnuradio.trellis.metrics_c
+ gnuradio.trellis.metrics_f
+ gnuradio.trellis.metrics_i
+ gnuradio.trellis.metrics_s
+ gnuradio.trellis.pccc_decoder_b
+ gnuradio.trellis.pccc_decoder_combined_cb
+ gnuradio.trellis.pccc_decoder_combined_ci
+ gnuradio.trellis.pccc_decoder_combined_cs
+ gnuradio.trellis.pccc_decoder_combined_fb
+ gnuradio.trellis.pccc_decoder_combined_fi
+ gnuradio.trellis.pccc_decoder_combined_fs
+ gnuradio.trellis.pccc_decoder_i
+ gnuradio.trellis.pccc_decoder_s
+ gnuradio.trellis.pccc_encoder_bb
+ gnuradio.trellis.pccc_encoder_bi
+ gnuradio.trellis.pccc_encoder_bs
+ gnuradio.trellis.pccc_encoder_ii
+ gnuradio.trellis.pccc_encoder_si
+ gnuradio.trellis.pccc_encoder_ss
+ gnuradio.trellis.permutation
+ gnuradio.trellis.sccc_decoder_b
+ gnuradio.trellis.sccc_decoder_combined_cb
+ gnuradio.trellis.sccc_decoder_combined_ci
+ gnuradio.trellis.sccc_decoder_combined_cs
+ gnuradio.trellis.sccc_decoder_combined_fb
+ gnuradio.trellis.sccc_decoder_combined_fi
+ gnuradio.trellis.sccc_decoder_combined_fs
+ gnuradio.trellis.sccc_decoder_i
+ gnuradio.trellis.sccc_decoder_s
+ gnuradio.trellis.sccc_encoder_bb
+ gnuradio.trellis.sccc_encoder_bi
+ gnuradio.trellis.sccc_encoder_bs
+ gnuradio.trellis.sccc_encoder_ii
+ gnuradio.trellis.sccc_encoder_si
+ gnuradio.trellis.sccc_encoder_ss
+ gnuradio.trellis.siso_combined_f
+ gnuradio.trellis.siso_f
+ gnuradio.trellis.viterbi_b
+ gnuradio.trellis.viterbi_combined_cb
+ gnuradio.trellis.viterbi_combined_ci
+ gnuradio.trellis.viterbi_combined_cs
+ gnuradio.trellis.viterbi_combined_fb
+ gnuradio.trellis.viterbi_combined_fi
+ gnuradio.trellis.viterbi_combined_fs
+ gnuradio.trellis.viterbi_combined_ib
+ gnuradio.trellis.viterbi_combined_ii
+ gnuradio.trellis.viterbi_combined_is
+ gnuradio.trellis.viterbi_combined_sb
+ gnuradio.trellis.viterbi_combined_si
+ gnuradio.trellis.viterbi_combined_ss
+ gnuradio.trellis.viterbi_i
+ gnuradio.trellis.viterbi_s
+
+Constants
+---------
+
+.. autosummary::
+ :nosignatures:
+
+ gnuradio.trellis.TRELLIS_MIN_SUM
+ gnuradio.trellis.TRELLIS_SUM_PRODUCT
+
+
diff --git a/docs/sphinx/source/trellis/objs.rst b/docs/sphinx/source/trellis/objs.rst
new file mode 100644
index 000000000..b3a4b7a4a
--- /dev/null
+++ b/docs/sphinx/source/trellis/objs.rst
@@ -0,0 +1,5 @@
+gnuradio.trellis: Object Classes
+--------------------------------
+
+.. autoclass:: gnuradio.trellis.fsm
+.. autoclass:: gnuradio.trellis.interleaver
diff --git a/docs/sphinx/source/uhd.rst b/docs/sphinx/source/uhd.rst
new file mode 100644
index 000000000..d9ecf3a51
--- /dev/null
+++ b/docs/sphinx/source/uhd.rst
@@ -0,0 +1,18 @@
+gnuradio.uhd
+============
+
+.. automodule:: gnuradio.uhd
+
+.. autooldblock:: gnuradio.uhd.usrp_sink
+.. autooldblock:: gnuradio.uhd.usrp_source
+.. autooldblock:: gnuradio.uhd.amsg_source
+.. autoclass:: gnuradio.uhd.stream_cmd_t
+.. autoclass:: gnuradio.uhd.time_spec_t
+.. autoclass:: gnuradio.uhd.meta_range_t
+.. autoclass:: gnuradio.uhd.stream_args_t
+.. autoclass:: gnuradio.uhd.device_addr_t
+.. autoclass:: gnuradio.uhd.tune_request_t
+.. autoclass:: gnuradio.uhd.tune_result_t
+.. autoclass:: gnuradio.uhd.sensor_value_t
+
+
diff --git a/docs/sphinx/source/video_sdl.rst b/docs/sphinx/source/video_sdl.rst
new file mode 100644
index 000000000..6be88d788
--- /dev/null
+++ b/docs/sphinx/source/video_sdl.rst
@@ -0,0 +1,7 @@
+gnuradio.video_sdl
+==================
+
+.. automodule:: gnuradio.video_sdl
+
+.. autooldblock:: gnuradio.video_sdl.sink_s
+.. autooldblock:: gnuradio.video_sdl.sink_uc
diff --git a/docs/sphinx/source/vocoder/blks.rst b/docs/sphinx/source/vocoder/blks.rst
new file mode 100644
index 000000000..34eda9d25
--- /dev/null
+++ b/docs/sphinx/source/vocoder/blks.rst
@@ -0,0 +1,19 @@
+gnuradio.vocoder
+================
+
+.. autooldblock:: gnuradio.vocoder.alaw_decode_bs
+.. autooldblock:: gnuradio.vocoder.alaw_encode_sb
+.. autooldblock:: gnuradio.vocoder.codec2_decode_ps
+.. autooldblock:: gnuradio.vocoder.codec2_encode_sp
+.. autooldblock:: gnuradio.vocoder.cvsd_decode_bs
+.. autooldblock:: gnuradio.vocoder.cvsd_encode_sb
+.. autooldblock:: gnuradio.vocoder.g721_decode_bs
+.. autooldblock:: gnuradio.vocoder.g721_encode_sb
+.. autooldblock:: gnuradio.vocoder.g723_24_decode_bs
+.. autooldblock:: gnuradio.vocoder.g723_24_encode_sb
+.. autooldblock:: gnuradio.vocoder.g723_40_decode_bs
+.. autooldblock:: gnuradio.vocoder.g723_40_encode_sb
+.. autooldblock:: gnuradio.vocoder.gsm_fr_decode_ps
+.. autooldblock:: gnuradio.vocoder.gsm_fr_encode_sp
+.. autooldblock:: gnuradio.vocoder.ulaw_decode_bs
+.. autooldblock:: gnuradio.vocoder.ulaw_encode_sb
diff --git a/docs/sphinx/source/vocoder/index.rst b/docs/sphinx/source/vocoder/index.rst
new file mode 100644
index 000000000..2e3180995
--- /dev/null
+++ b/docs/sphinx/source/vocoder/index.rst
@@ -0,0 +1,26 @@
+gnuradio.vocoder
+================
+
+.. automodule:: gnuradio.vocoder
+
+.. autosummary::
+ :nosignatures:
+
+ gnuradio.vocoder.alaw_decode_bs
+ gnuradio.vocoder.alaw_encode_sb
+ gnuradio.vocoder.codec2_decode_ps
+ gnuradio.vocoder.codec2_encode_sp
+ gnuradio.vocoder.cvsd_decode_bf
+ gnuradio.vocoder.cvsd_decode_bs
+ gnuradio.vocoder.cvsd_encode_fb
+ gnuradio.vocoder.cvsd_encode_sb
+ gnuradio.vocoder.g721_decode_bs
+ gnuradio.vocoder.g721_encode_sb
+ gnuradio.vocoder.g723_24_decode_bs
+ gnuradio.vocoder.g723_24_encode_sb
+ gnuradio.vocoder.g723_40_decode_bs
+ gnuradio.vocoder.g723_40_encode_sb
+ gnuradio.vocoder.gsm_fr_decode_ps
+ gnuradio.vocoder.gsm_fr_encode_sp
+ gnuradio.vocoder.ulaw_decode_bs
+ gnuradio.vocoder.ulaw_encode_sb
diff --git a/docs/sphinx/source/wavelet.rst b/docs/sphinx/source/wavelet.rst
new file mode 100644
index 000000000..5236c4dbb
--- /dev/null
+++ b/docs/sphinx/source/wavelet.rst
@@ -0,0 +1,8 @@
+gnuradio.wavelet
+================
+
+.. automodule:: gnuradio.wavelet
+
+.. autooldblock:: gnuradio.wavelet.squash_ff
+.. autooldblock:: gnuradio.wavelet.wavelet_ff
+.. autooldblock:: gnuradio.wavelet.wvps_ff
diff --git a/docs/sphinx/source/window/detail.rst b/docs/sphinx/source/window/detail.rst
new file mode 100644
index 000000000..7222a0cb4
--- /dev/null
+++ b/docs/sphinx/source/window/detail.rst
@@ -0,0 +1,20 @@
+gnuradio.window
+===============
+
+.. autofunction:: gnuradio.window.bartlett
+.. autofunction:: gnuradio.window.blackman2
+.. autofunction:: gnuradio.window.blackman3
+.. autofunction:: gnuradio.window.blackman4
+.. autofunction:: gnuradio.window.blackmanharris
+.. autofunction:: gnuradio.window.coswindow
+.. autofunction:: gnuradio.window.exponential
+.. autofunction:: gnuradio.window.flattop
+.. autofunction:: gnuradio.window.hamming
+.. autofunction:: gnuradio.window.hanning
+.. autofunction:: gnuradio.window.kaiser
+.. autofunction:: gnuradio.window.nuttall
+.. autofunction:: gnuradio.window.nuttall_cfd
+.. autofunction:: gnuradio.window.parzen
+.. autofunction:: gnuradio.window.rectangular
+.. autofunction:: gnuradio.window.riemann
+.. autofunction:: gnuradio.window.welch
diff --git a/docs/sphinx/source/window/index.rst b/docs/sphinx/source/window/index.rst
new file mode 100644
index 000000000..6ecfea0e9
--- /dev/null
+++ b/docs/sphinx/source/window/index.rst
@@ -0,0 +1,25 @@
+gnuradio.window
+===============
+
+.. automodule:: gnuradio.window
+
+.. autosummary::
+ :nosignatures:
+
+ gnuradio.window.bartlett
+ gnuradio.window.blackman2
+ gnuradio.window.blackman3
+ gnuradio.window.blackman4
+ gnuradio.window.blackmanharris
+ gnuradio.window.coswindow
+ gnuradio.window.exponential
+ gnuradio.window.flattop
+ gnuradio.window.hamming
+ gnuradio.window.hanning
+ gnuradio.window.kaiser
+ gnuradio.window.nuttall
+ gnuradio.window.nuttall_cfd
+ gnuradio.window.parzen
+ gnuradio.window.rectangular
+ gnuradio.window.riemann
+ gnuradio.window.welch
diff --git a/docs/sphinx/source/wxgui/blks.rst b/docs/sphinx/source/wxgui/blks.rst
new file mode 100644
index 000000000..c304ea0a8
--- /dev/null
+++ b/docs/sphinx/source/wxgui/blks.rst
@@ -0,0 +1,13 @@
+gnuradio.wxgui
+=====================
+
+.. autopyblock:: gnuradio.wxgui.constsink_gl.const_sink_c
+.. autopyblock:: gnuradio.wxgui.fftsink2.fft_sink_c
+.. autopyblock:: gnuradio.wxgui.fftsink2.fft_sink_f
+.. autopyblock:: gnuradio.wxgui.histosink_gl.histo_sink_f
+.. autopyblock:: gnuradio.wxgui.numbersink2.number_sink_c
+.. autopyblock:: gnuradio.wxgui.numbersink2.number_sink_f
+.. autopyblock:: gnuradio.wxgui.scopesink2.scope_sink_c
+.. autopyblock:: gnuradio.wxgui.scopesink2.scope_sink_f
+.. autopyblock:: gnuradio.wxgui.waterfallsink2.waterfall_sink_c
+.. autopyblock:: gnuradio.wxgui.waterfallsink2.waterfall_sink_f
diff --git a/docs/sphinx/source/wxgui/index.rst b/docs/sphinx/source/wxgui/index.rst
new file mode 100644
index 000000000..f3fa4f337
--- /dev/null
+++ b/docs/sphinx/source/wxgui/index.rst
@@ -0,0 +1,18 @@
+gnuradio.wxgui
+==============
+
+.. automodule:: gnuradio.wxgui
+
+.. autosummary::
+ :nosignatures:
+
+ gnuradio.wxgui.common.const_sink_c
+ gnuradio.wxgui.fftsink2.fft_sink_c
+ gnuradio.wxgui.fftsink2.fft_sink_f
+ gnuradio.wxgui.histosink_gl.histosink_f
+ gnuradio.wxgui.numbersink2.number_sink_c
+ gnuradio.wxgui.numbersink2.number_sink_f
+ gnuradio.wxgui.scopesink2.scope_sink_c
+ gnuradio.wxgui.scopesink2.scope_sink_f
+ gnuradio.wxgui.waterfallsink2.waterfall_sink_c
+ gnuradio.wxgui.waterfallsink2.waterfall_sink_f
diff --git a/dtools/README b/dtools/README
new file mode 100644
index 000000000..280b19bbd
--- /dev/null
+++ b/dtools/README
@@ -0,0 +1,25 @@
+#
+# 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.
+#
+
+This is a collection of tools that are useful for building tarball
+distributions of GNU Radio. They're probably not of general interest.
+
+To use, add dtools/bin to PATH and dtools/python to PYTHONPATH
diff --git a/dtools/bin/check-imports b/dtools/bin/check-imports
new file mode 100755
index 000000000..fe4bf2302
--- /dev/null
+++ b/dtools/bin/check-imports
@@ -0,0 +1,4 @@
+#!/bin/bash
+
+find . -name '*.py' | xargs grep -h -E '^(from|import)' | sort -u
+
diff --git a/dtools/bin/check-tarball-h-files b/dtools/bin/check-tarball-h-files
new file mode 100755
index 000000000..6e3e1e776
--- /dev/null
+++ b/dtools/bin/check-tarball-h-files
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+tarball=$1
+if [ "x$tarball" = "x" ]
+then
+ echo "usage: $0 tarball" 1>&2
+ exit 1
+fi
+
+path=${tarball%%.tar.gz}
+
+tar tzf $tarball \
+ | grep -E '\.(h|py|v|vh)$' \
+ | sed -e "s/$path/./" \
+ | sort >/tmp/tarball-h-files
+
+find . \( -name '*.h' -o -name '*.py' -o -name '*.v' -o -name '*.vh' \) -print \
+ | grep -v ./$path | sort >/tmp/build-h-files
+
+comm -23 /tmp/build-h-files /tmp/tarball-h-files \
+ | grep -Ev '(GrAtsc|_swig_|limbo|config\.h|std_paths\.h)'
+
+# rm /tmp/tarball-h-files /tmp/build-h-files
+
+
diff --git a/dtools/bin/fix-copyright-years b/dtools/bin/fix-copyright-years
new file mode 100755
index 000000000..bb0f3009d
--- /dev/null
+++ b/dtools/bin/fix-copyright-years
@@ -0,0 +1,65 @@
+#!/usr/bin/env python
+
+import re
+import datetime
+import subprocess
+import multiprocessing
+
+def command(*args): return subprocess.Popen(args, stdout=subprocess.PIPE).communicate()[0]
+
+def is_gnuradio_co_source(lines):
+ for line in lines[:20]:
+ if 'GNU Radio is free software' in line: return True
+ return False
+
+def get_gnuradio_co_line(lines):
+ for i, line in enumerate(lines[:5]):
+ if 'Copyright' in line and 'Free Software Foundation' in line: return line, i
+ return None
+
+def fix_co_years(files):
+ for file in files:
+ print file
+ lines = open(file).readlines()
+ if not is_gnuradio_co_source(lines): continue
+
+ #extract the years from the git history
+ years = set(map(
+ lambda l: int(l.split()[-2]),
+ filter(
+ lambda l: l.startswith('Date'),
+ command('git', 'log', file).splitlines(),
+ ),
+ ))
+
+ #extract line and line number for co line
+ try: line, num = get_gnuradio_co_line(lines)
+ except: continue
+
+ #extract years from co string
+ try:
+ co_years_str = re.match('^.*Copyright (.*) Free Software Foundation.*$', line).groups()[0]
+ co_years = set(map(int, co_years_str.split(',')))
+ except: print ' format error on line %d: "%s"'%(num, line); continue
+
+ #update the years if missing any
+ all_years = co_years.union(years)
+ if all_years != co_years:
+ print ' missing years: %s'%(', '.join(map(str, sorted(all_years - co_years))))
+ all_years.add(datetime.datetime.now().year) #add the current year
+ all_years_str = ', '.join(map(str, sorted(all_years)))
+ new_text = ''.join(lines[:num] + [line.replace(co_years_str, all_years_str)] + lines[num+1:])
+ open(file, 'w').write(new_text)
+
+if __name__ == "__main__":
+ #get recursive list of files in the repo
+ files = command('git', 'ls-tree', '--name-only', 'HEAD', '-r').splitlines()
+
+ #start n+1 processes to handle the files
+ num_procs = multiprocessing.cpu_count()
+ procs = [multiprocessing.Process(
+ target=lambda *files: fix_co_years(files),
+ args=files[num::num_procs],
+ ) for num in range(num_procs)]
+ map(multiprocessing.Process.start, procs)
+ map(multiprocessing.Process.join, procs)
diff --git a/dtools/bin/install-tbb b/dtools/bin/install-tbb
new file mode 100755
index 000000000..8ff216da4
--- /dev/null
+++ b/dtools/bin/install-tbb
@@ -0,0 +1,88 @@
+#!/usr/bin/env python
+
+"""
+Install the release and debug libs and includes under --prefix
+"""
+
+from optparse import OptionParser
+import os
+import os.path
+import glob
+
+default_prefix="/usr/local"
+
+pkgconfig_filename = "tbb.pc"
+pkgconfig_file_contents = """\
+prefix=%s
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
+
+Name: tbb
+Description: Intel Threading Building Blocks
+Requires:
+Version: 2.0
+Libs: -L${libdir} -ltbb -ltbbmalloc
+Cflags: -I${includedir}
+"""
+
+debug_pkgconfig_filename = "tbb_debug.pc"
+debug_pkgconfig_file_contents = """\
+prefix=%s
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
+
+Name: tbb
+Description: Intel Threading Building Blocks
+Requires:
+Version: 2.0
+Libs: -L${libdir} -ltbb_debug -ltbbmalloc_debug
+Cflags: -I${includedir}
+"""
+
+def main():
+ parser = OptionParser()
+ parser.add_option('','--prefix', default=default_prefix,
+ help="install architecture-independent files in PREFIX [default=%default]")
+ (options, args) = parser.parse_args()
+ if len(args) != 0:
+ parser.print_help()
+ raise SystemExit, 1
+
+ prefix = options.prefix
+
+ # are we installing 64-bit libs?
+
+ is_64bit = False
+ files = glob.glob('build/*_em64t_*_release')
+ # print "files: ", files
+ if len(files) != 0:
+ is_64bit = True
+
+ # FIXME add 32 and 64-bit PPC support
+
+ if is_64bit:
+ lib = 'lib64'
+ else:
+ lib = 'lib'
+
+ os.system('install -d ' + os.path.join(prefix, 'include/tbb'))
+ os.system('install -d ' + os.path.join(prefix, 'include/tbb/machine'))
+ os.system('install -d ' + os.path.join(prefix, lib))
+ os.system('install -d ' + os.path.join(prefix, lib, 'pkgconfig'))
+ os.system('install -t ' + os.path.join(prefix, lib) + ' build/linux*release/*.so*')
+ os.system('install -t ' + os.path.join(prefix, lib) + ' build/linux*debug/*.so*')
+ os.system('install -t ' + os.path.join(prefix, 'include/tbb') + ' include/tbb/*.h')
+ os.system('install -t ' + os.path.join(prefix, 'include/tbb/machine') + ' include/tbb/machine/*.h')
+
+ f = open(os.path.join(prefix, lib, 'pkgconfig', pkgconfig_filename), 'w')
+ f.write(pkgconfig_file_contents % (prefix,))
+ f.close()
+
+ f = open(os.path.join(prefix, lib, 'pkgconfig', debug_pkgconfig_filename), 'w')
+ f.write(debug_pkgconfig_file_contents % (prefix,))
+ f.close()
+
+if __name__ == "__main__":
+ main()
diff --git a/dtools/bin/make-upload b/dtools/bin/make-upload
new file mode 100755
index 000000000..967dcfa1e
--- /dev/null
+++ b/dtools/bin/make-upload
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+read -s -p "GPG Passphrase: " passphrase
+
+for file in "$@"
+do
+ (
+ echo "version: 1.1"
+ echo "directory: gnuradio"
+ echo "filename: $file"
+ )> $file.directive
+ echo "$passphrase" | gpg --passphrase-fd 0 --clearsign $file.directive
+ rm $file.directive
+ echo "$passphrase" | gpg --passphrase-fd 0 -b $file
+done
+passphrase="XYZabcdefhghakdsj;lasjdf;ajfdiuiwjr;lajv;laoisfuaoieurlkajdsflkajsdfoiuew"
diff --git a/dtools/bin/remove-whitespace b/dtools/bin/remove-whitespace
new file mode 100755
index 000000000..9f011be3b
--- /dev/null
+++ b/dtools/bin/remove-whitespace
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+sed -i -e 's/\s\+$//g' $(find . -type f | grep -v '.git' | grep -v 'png' | grep -v 'eps') \ No newline at end of file
diff --git a/dtools/bin/update_fsf_address b/dtools/bin/update_fsf_address
new file mode 100755
index 000000000..608ba0a8e
--- /dev/null
+++ b/dtools/bin/update_fsf_address
@@ -0,0 +1,134 @@
+#!/usr/bin/env python
+#
+# 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 this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+
+import re
+import os
+import os.path
+import sys
+from optparse import OptionParser
+
+dry_run = False
+modified_files = []
+
+dirs_to_ignore = ('CVS', '.svn', '.deps', '.libs')
+extensions_to_ignore = ('.o', '.lo',
+ '.a', '.la', '.lai',
+ '.so', '.soT',
+ '.pyc', '.pyo',
+ '.ko', '.fasl', '.rwbak',
+ '.tar', '.gz', '.log',
+ '.eps', '.ps', '.pdf',
+ '.png', '.jpg', '.jpeg', '.bmp',
+ '.dat', '.ihx',
+ '.diff',
+ '.lib', '.lst', '.rel', '.sym', '.asm', '.rst', 'mem', '.map', # sdcc output
+ '.rbf', '.esf', '.qpf', '.psf', '.quartus', '.bsf', '.cmp' # quartus
+ )
+
+def destructively_remove(list, predicate):
+ """
+ Destructively remove elements from LIST for which PREDICATE is true
+ """
+ for i in range(len(list)):
+ if predicate(list[i]):
+ del list[i]
+ destructively_remove(list, predicate)
+ return
+
+
+def expunge_unwanted_dirnames(dirnames):
+ """
+ Destructively remove directory names that we don't want to visit.
+ This is a _very_ non-functional approach to programming...
+ """
+ destructively_remove(dirnames, lambda d: d in dirs_to_ignore)
+
+def expunge_unwanted_filenames(filenames):
+ """
+ Destructively remove filenames that we don't want to visit.
+ This is a _very_ non-functional approach to programming...
+ """
+ destructively_remove(filenames,
+ lambda f: f.endswith('~') or os.path.splitext(f)[1] in extensions_to_ignore)
+
+
+def walk_directory(dirname):
+ for dirpath, dirnames, filenames in os.walk(dirname):
+ expunge_unwanted_dirnames(dirnames)
+ expunge_unwanted_filenames(filenames)
+ for f in filenames:
+ update_one(os.path.join(dirpath, f))
+
+
+addr_pattern = re.compile(r'\b59 Temple Place(,| *-) *Suite 330\b', re.IGNORECASE)
+addr_replacement = '51 Franklin Street'
+zip_pattern = re.compile(r'\b02111-1307\b')
+zip_replacement = '02110-1301'
+
+def update_one(filename):
+ f = open(filename, 'r')
+ s = f.read()
+ f.close()
+ t = s
+ t = addr_pattern.sub(addr_replacement, t)
+ t = zip_pattern.sub(zip_replacement, t)
+ if s != t:
+ modified_files.append(filename)
+ if not dry_run:
+ f = open(filename, 'w')
+ f.write(t)
+
+
+def handle_file_or_dir(file_or_dir):
+ if os.path.isfile(file_or_dir):
+ update_one(file_or_dir)
+ elif os.path.isdir(file_or_dir):
+ walk_directory(file_or_dir)
+ else:
+ pass # ignore the other cases
+
+
+def main():
+ global dry_run
+
+ usage = '%prog: [options] [file_or_dir...]'
+ parser = OptionParser (usage=usage)
+ parser.add_option('-l', '--list-modified-files', action='store_true', default=False,
+ help='List modified files to stdout [default=%default]')
+ parser.add_option('', '--dry-run', action='store_true', default=False,
+ help="Don't modify any files, just report what would be modified [default=%default]")
+ (options, args) = parser.parse_args()
+
+ dry_run = options.dry_run
+ if options.dry_run:
+ options.list_modified_files = True
+
+ for file_or_dir in args:
+ handle_file_or_dir(file_or_dir)
+
+ if options.list_modified_files:
+ for f in modified_files:
+ sys.stdout.write(f + '\n')
+
+
+if __name__ == '__main__':
+ main()
+
diff --git a/gnuradio-core/CMakeLists.txt b/gnuradio-core/CMakeLists.txt
new file mode 100644
index 000000000..dfbf28bd8
--- /dev/null
+++ b/gnuradio-core/CMakeLists.txt
@@ -0,0 +1,145 @@
+# Copyright 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.
+
+########################################################################
+# Setup dependencies
+########################################################################
+include(GrBoost)
+
+find_package(FFTW3f)
+
+include(GrPython) #used for code generation
+
+get_filename_component(GR_CORE_PYTHONPATH
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/python ABSOLUTE
+)
+GR_SET_GLOBAL(GR_CORE_PYTHONPATH ${GR_CORE_PYTHONPATH})
+
+########################################################################
+# Register component
+########################################################################
+include(GrComponent)
+GR_REGISTER_COMPONENT("gnuradio-core" ENABLE_GR_CORE
+ ENABLE_GRUEL
+ ENABLE_VOLK
+ Boost_FOUND
+ FFTW3F_FOUND
+ PYTHONINTERP_FOUND
+)
+
+include(GrMiscUtils)
+GR_SET_GLOBAL(GNURADIO_CORE_INCLUDE_DIRS
+ ${GRAS_INCLUDE_DIRS}
+ ${GRUEL_INCLUDE_DIRS} #headers depend on gruel
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/lib/runtime
+ ${CMAKE_CURRENT_BINARY_DIR}/src/lib/general
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/lib/general
+ ${CMAKE_CURRENT_BINARY_DIR}/src/lib/gengen
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/lib/gengen
+ ${CMAKE_CURRENT_BINARY_DIR}/src/lib/filter
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/lib/filter
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/lib/missing
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/lib/reed-solomon
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/lib/viterbi
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/lib/io
+ ${CMAKE_CURRENT_BINARY_DIR}/src/lib/swig
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/lib/swig
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/lib/hier
+)
+
+GR_SET_GLOBAL(GNURADIO_CORE_SWIG_INCLUDE_DIRS
+ ${GNURADIO_CORE_INCLUDE_DIRS}
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/lib/swig
+ ${CMAKE_SOURCE_DIR}/gruel/src/swig
+ ${CMAKE_BINARY_DIR}/gruel/src/swig
+)
+
+########################################################################
+# Begin conditional configuration
+########################################################################
+if(ENABLE_GR_CORE)
+
+########################################################################
+# Setup CPack components
+########################################################################
+include(GrPackage)
+CPACK_SET(CPACK_COMPONENT_GROUP_CORE_DESCRIPTION "GNU Radio Core Library")
+
+CPACK_COMPONENT("core_runtime"
+ GROUP "Core"
+ DISPLAY_NAME "Runtime"
+ DESCRIPTION "Runtime"
+ DEPENDS "gruel_runtime"
+)
+
+CPACK_COMPONENT("core_devel"
+ GROUP "Core"
+ DISPLAY_NAME "Development"
+ DESCRIPTION "C++ headers, package config, import libraries"
+ DEPENDS "gruel_devel"
+)
+
+CPACK_COMPONENT("core_python"
+ GROUP "Core"
+ DISPLAY_NAME "Python"
+ DESCRIPTION "Python modules for runtime; GRC xml files"
+ DEPENDS "gruel_python;core_runtime"
+)
+
+CPACK_COMPONENT("core_swig"
+ GROUP "Core"
+ DISPLAY_NAME "SWIG"
+ DESCRIPTION "SWIG development .i files"
+ DEPENDS "gruel_swig;core_python;core_devel"
+)
+
+install(
+ FILES gnuradio-core.conf
+ DESTINATION ${GR_PREFSDIR}
+ COMPONENT "core_runtime"
+)
+
+########################################################################
+# Add subdirectories
+########################################################################
+add_subdirectory(src/lib)
+if(ENABLE_TESTING)
+ add_subdirectory(src/tests)
+endif(ENABLE_TESTING)
+if(ENABLE_PYTHON)
+ add_subdirectory(src/lib/swig)
+ add_subdirectory(src/python/gnuradio)
+ add_subdirectory(src/examples)
+endif(ENABLE_PYTHON)
+
+########################################################################
+# Create Pkg Config File
+########################################################################
+configure_file(
+ ${CMAKE_CURRENT_SOURCE_DIR}/gnuradio-core.pc.in
+ ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-core.pc
+@ONLY)
+
+install(
+ FILES ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-core.pc
+ DESTINATION ${GR_LIBRARY_DIR}/pkgconfig
+ COMPONENT "core_devel"
+)
+
+endif(ENABLE_GR_CORE)
diff --git a/gnuradio-core/gnuradio-core.conf b/gnuradio-core/gnuradio-core.conf
new file mode 100644
index 000000000..d575d1dc8
--- /dev/null
+++ b/gnuradio-core/gnuradio-core.conf
@@ -0,0 +1,14 @@
+# This file contains system wide configuration data for GNU Radio.
+# You may override any setting on a per-user basis by editing
+# ~/.gnuradio/config.conf
+
+[DEFAULT]
+
+verbose = False
+
+# The maximum number of messages a block will store up before pruning
+# the queue by popping messages from the front.
+max_messages = 100
+
+[PerfCounters]
+on = False
diff --git a/gnuradio-core/gnuradio-core.pc.in b/gnuradio-core/gnuradio-core.pc.in
new file mode 100644
index 000000000..2de9a32e7
--- /dev/null
+++ b/gnuradio-core/gnuradio-core.pc.in
@@ -0,0 +1,12 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@/gnuradio
+
+Name: gnuradio-core
+Description: GNU Software Radio toolkit
+Requires: gruel fftw3f
+Version: @LIBVER@
+Libs.private: @BOOST_LDFLAGS@ @BOOST_THREAD_LIB@ @BOOST_DATE_TIME_LIB@
+Libs: -L${libdir} -lgnuradio-core
+Cflags: @BOOST_CPPFLAGS@ @BOOST_CXXFLAGS@ -I${includedir}
diff --git a/gnuradio-core/src/examples/CMakeLists.txt b/gnuradio-core/src/examples/CMakeLists.txt
new file mode 100644
index 000000000..01d9eb83e
--- /dev/null
+++ b/gnuradio-core/src/examples/CMakeLists.txt
@@ -0,0 +1,25 @@
+# Copyright 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.
+
+add_subdirectory(mp-sched)
+add_subdirectory(msg_passing)
+add_subdirectory(network)
+add_subdirectory(pfb)
+add_subdirectory(tags)
+add_subdirectory(volk_benchmark) \ No newline at end of file
diff --git a/gnuradio-core/src/examples/mp-sched/CMakeLists.txt b/gnuradio-core/src/examples/mp-sched/CMakeLists.txt
new file mode 100644
index 000000000..d2d910ecf
--- /dev/null
+++ b/gnuradio-core/src/examples/mp-sched/CMakeLists.txt
@@ -0,0 +1,36 @@
+# Copyright 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.
+
+include(GrPython)
+
+GR_PYTHON_INSTALL(PROGRAMS
+ affinity_set.py
+ plot_flops.py
+ run_synthetic.py
+ synthetic.py
+ wfm_rcv_pll_to_wav.py
+ DESTINATION ${GR_PKG_DATA_DIR}/examples/mp-sched
+ COMPONENT "core_python"
+)
+
+install(
+ FILES README
+ DESTINATION ${GR_PKG_DATA_DIR}/examples/mp-sched
+ COMPONENT "core_python"
+)
diff --git a/gnuradio-core/src/examples/mp-sched/README b/gnuradio-core/src/examples/mp-sched/README
new file mode 100644
index 000000000..ae575437a
--- /dev/null
+++ b/gnuradio-core/src/examples/mp-sched/README
@@ -0,0 +1,2 @@
+These are pieces of code used to test and benchmark the
+multi-processor scheduler.
diff --git a/gnuradio-core/src/examples/mp-sched/affinity_set.py b/gnuradio-core/src/examples/mp-sched/affinity_set.py
new file mode 100755
index 000000000..65e929051
--- /dev/null
+++ b/gnuradio-core/src/examples/mp-sched/affinity_set.py
@@ -0,0 +1,70 @@
+#!/usr/bin/env python
+##################################################
+# Gnuradio Python Flow Graph
+# Title: Affinity Set Test
+##################################################
+
+from gnuradio import eng_notation
+from gnuradio import gr
+from gnuradio.eng_option import eng_option
+from gnuradio.gr import firdes
+from optparse import OptionParser
+import sys
+
+class affinity_set(gr.top_block):
+
+ def __init__(self):
+ gr.top_block.__init__(self, "Affinity Set Test")
+
+ ##################################################
+ # Variables
+ ##################################################
+ self.samp_rate = samp_rate = 32000
+
+ ##################################################
+ # Blocks
+ ##################################################
+ vec_len = 1
+ self.gr_throttle_0 = gr.throttle(gr.sizeof_gr_complex*vec_len, samp_rate)
+ self.gr_null_source_0 = gr.null_source(gr.sizeof_gr_complex*vec_len)
+ self.gr_null_sink_0 = gr.null_sink(gr.sizeof_gr_complex*vec_len)
+ self.gr_filt_0 = gr.fir_filter_ccc(1, 40000*[0.2+0.3j,])
+ self.gr_filt_1 = gr.fir_filter_ccc(1, 40000*[0.2+0.3j,])
+
+ self.gr_filt_0.set_processor_affinity([0,])
+ self.gr_filt_1.set_processor_affinity([0,1])
+
+ ##################################################
+ # Connections
+ ##################################################
+ self.connect((self.gr_null_source_0, 0), (self.gr_throttle_0, 0))
+ self.connect((self.gr_throttle_0, 0), (self.gr_filt_0, 0))
+ self.connect((self.gr_filt_0, 0), (self.gr_filt_1, 0))
+ self.connect((self.gr_filt_1, 0), (self.gr_null_sink_0, 0))
+
+ def get_samp_rate(self):
+ return self.samp_rate
+
+ def set_samp_rate(self, samp_rate):
+ self.samp_rate = samp_rate
+
+if __name__ == '__main__':
+ parser = OptionParser(option_class=eng_option, usage="%prog: [options]")
+ (options, args) = parser.parse_args()
+ tb = affinity_set()
+ tb.start()
+
+ while(1):
+ ret = raw_input('Enter a new Core # or Press Enter to quit: ')
+ if(len(ret) == 0):
+ tb.stop()
+ sys.exit(0)
+ elif(ret.lower() == "none"):
+ tb.gr_filt_0.unset_processor_affinity()
+ else:
+ try:
+ n = int(ret)
+ except ValueError:
+ print "Invalid number"
+ else:
+ tb.gr_filt_0.set_processor_affinity([n,])
diff --git a/gnuradio-core/src/examples/mp-sched/perf-data/core-duo.dat b/gnuradio-core/src/examples/mp-sched/perf-data/core-duo.dat
new file mode 100644
index 000000000..064d1e128
--- /dev/null
+++ b/gnuradio-core/src/examples/mp-sched/perf-data/core-duo.dat
@@ -0,0 +1,65 @@
+#D Core Duo 1.83 GHz (T2400)
+ 1 1 5.273e+07 10.010 10.160 0.060 1.021 2.700000e+10 2.697e+09
+ 1 2 5.273e+07 10.410 20.180 0.150 1.953 5.400000e+10 5.187e+09
+ 1 3 3.516e+07 10.360 20.030 0.150 1.948 5.400000e+10 5.212e+09
+ 1 4 2.637e+07 10.100 20.030 0.100 1.993 5.400000e+10 5.347e+09
+ 1 5 2.109e+07 10.140 19.980 0.110 1.981 5.400000e+10 5.325e+09
+ 1 6 1.758e+07 10.110 20.030 0.110 1.992 5.400000e+10 5.341e+09
+ 1 7 1.507e+07 10.120 20.030 0.110 1.990 5.400000e+10 5.336e+09
+ 1 8 1.318e+07 10.060 19.980 0.090 1.995 5.400000e+10 5.368e+09
+ 2 1 5.273e+07 10.210 20.130 0.260 1.997 5.400000e+10 5.289e+09
+ 2 2 2.637e+07 10.110 20.030 0.140 1.995 5.400000e+10 5.341e+09
+ 2 3 1.758e+07 10.120 20.010 0.150 1.992 5.400000e+10 5.336e+09
+ 2 4 1.318e+07 10.080 19.990 0.110 1.994 5.400000e+10 5.357e+09
+ 2 5 1.055e+07 10.050 19.990 0.090 1.998 5.400000e+10 5.373e+09
+ 2 6 8.789e+06 10.050 19.980 0.080 1.996 5.400000e+10 5.373e+09
+ 2 7 7.533e+06 10.050 19.970 0.090 1.996 5.400000e+10 5.373e+09
+ 2 8 6.592e+06 10.040 19.970 0.090 1.998 5.399999e+10 5.378e+09
+ 3 1 3.516e+07 10.630 20.130 0.230 1.915 5.400000e+10 5.080e+09
+ 3 2 1.758e+07 10.120 20.020 0.170 1.995 5.400000e+10 5.336e+09
+ 3 3 1.172e+07 10.140 20.050 0.130 1.990 5.400000e+10 5.325e+09
+ 3 4 8.789e+06 10.070 20.010 0.100 1.997 5.400000e+10 5.362e+09
+ 3 5 7.031e+06 10.060 19.980 0.100 1.996 5.400000e+10 5.368e+09
+ 3 6 5.859e+06 10.060 20.000 0.100 1.998 5.400000e+10 5.368e+09
+ 3 7 5.022e+06 10.050 20.010 0.070 1.998 5.400000e+10 5.373e+09
+ 3 8 4.395e+06 10.050 19.990 0.070 1.996 5.400000e+10 5.373e+09
+ 4 1 2.637e+07 10.180 20.080 0.240 1.996 5.400000e+10 5.305e+09
+ 4 2 1.318e+07 10.140 20.000 0.180 1.990 5.400000e+10 5.325e+09
+ 4 3 8.789e+06 10.110 20.020 0.120 1.992 5.400000e+10 5.341e+09
+ 4 4 6.592e+06 10.080 20.020 0.090 1.995 5.399999e+10 5.357e+09
+ 4 5 5.273e+06 10.050 19.990 0.090 1.998 5.399999e+10 5.373e+09
+ 4 6 4.395e+06 10.080 20.010 0.080 1.993 5.400000e+10 5.357e+09
+ 4 7 3.767e+06 10.070 20.000 0.080 1.994 5.400000e+10 5.362e+09
+ 4 8 3.296e+06 10.050 20.000 0.080 1.998 5.399999e+10 5.373e+09
+ 5 1 2.109e+07 11.240 20.080 0.260 1.810 5.400000e+10 4.804e+09
+ 5 2 1.055e+07 10.130 19.990 0.150 1.988 5.400000e+10 5.331e+09
+ 5 3 7.031e+06 10.100 20.020 0.120 1.994 5.400000e+10 5.347e+09
+ 5 4 5.273e+06 10.070 20.000 0.090 1.995 5.399999e+10 5.362e+09
+ 5 5 4.219e+06 10.100 20.040 0.090 1.993 5.400000e+10 5.347e+09
+ 5 6 3.516e+06 10.080 20.000 0.090 1.993 5.400000e+10 5.357e+09
+ 5 7 3.013e+06 10.070 20.000 0.100 1.996 5.399998e+10 5.362e+09
+ 5 8 2.637e+06 10.070 20.000 0.090 1.995 5.399998e+10 5.362e+09
+ 6 1 1.758e+07 10.220 20.100 0.290 1.995 5.400000e+10 5.284e+09
+ 6 2 8.789e+06 10.080 20.010 0.130 1.998 5.400000e+10 5.357e+09
+ 6 3 5.859e+06 10.090 20.030 0.120 1.997 5.400000e+10 5.352e+09
+ 6 4 4.395e+06 10.100 20.030 0.080 1.991 5.400000e+10 5.347e+09
+ 6 5 3.516e+06 10.060 20.020 0.080 1.998 5.400000e+10 5.368e+09
+ 6 6 2.930e+06 10.070 20.030 0.090 1.998 5.399999e+10 5.362e+09
+ 6 7 2.511e+06 10.070 20.030 0.080 1.997 5.399998e+10 5.362e+09
+ 6 8 2.197e+06 10.070 20.010 0.090 1.996 5.399998e+10 5.362e+09
+ 7 1 1.507e+07 10.420 20.030 0.260 1.947 5.400000e+10 5.182e+09
+ 7 2 7.533e+06 10.100 20.010 0.140 1.995 5.400000e+10 5.347e+09
+ 7 3 5.022e+06 10.080 20.020 0.120 1.998 5.400000e+10 5.357e+09
+ 7 4 3.767e+06 10.080 20.010 0.100 1.995 5.400000e+10 5.357e+09
+ 7 5 3.013e+06 10.070 20.030 0.080 1.997 5.399998e+10 5.362e+09
+ 7 6 2.511e+06 10.080 20.010 0.090 1.994 5.399998e+10 5.357e+09
+ 7 7 2.152e+06 10.080 20.060 0.070 1.997 5.399999e+10 5.357e+09
+ 7 8 1.883e+06 10.070 20.040 0.070 1.997 5.399998e+10 5.362e+09
+ 8 1 1.318e+07 10.220 20.080 0.270 1.991 5.400000e+10 5.284e+09
+ 8 2 6.592e+06 10.100 20.010 0.140 1.995 5.399999e+10 5.347e+09
+ 8 3 4.395e+06 10.110 20.020 0.120 1.992 5.400000e+10 5.341e+09
+ 8 4 3.296e+06 10.090 20.040 0.090 1.995 5.399999e+10 5.352e+09
+ 8 5 2.637e+06 10.090 20.040 0.090 1.995 5.399998e+10 5.352e+09
+ 8 6 2.197e+06 10.070 20.040 0.100 2.000 5.399998e+10 5.362e+09
+ 8 7 1.883e+06 10.090 20.050 0.080 1.995 5.399998e+10 5.352e+09
+ 8 8 1.648e+06 10.090 20.040 0.090 1.995 5.399999e+10 5.352e+09
diff --git a/gnuradio-core/src/examples/mp-sched/perf-data/core2-duo.dat b/gnuradio-core/src/examples/mp-sched/perf-data/core2-duo.dat
new file mode 100644
index 000000000..d67dee8e5
--- /dev/null
+++ b/gnuradio-core/src/examples/mp-sched/perf-data/core2-duo.dat
@@ -0,0 +1,65 @@
+#D Core2 Duo 2.66 GHz (6700)
+ 1 1 1.406e+08 9.890 10.100 0.230 1.044 7.200000e+10 7.280e+09
+ 1 2 1.406e+08 10.400 19.900 0.290 1.941 1.440000e+11 1.385e+10
+ 1 3 9.375e+07 11.410 19.950 0.200 1.766 1.440000e+11 1.262e+10
+ 1 4 7.031e+07 10.230 19.800 0.230 1.958 1.440000e+11 1.408e+10
+ 1 5 5.625e+07 10.640 19.800 0.180 1.878 1.440000e+11 1.353e+10
+ 1 6 4.688e+07 10.000 19.780 0.130 1.991 1.440000e+11 1.440e+10
+ 1 7 4.018e+07 10.500 19.690 0.180 1.892 1.440000e+11 1.371e+10
+ 1 8 3.516e+07 10.020 19.750 0.170 1.988 1.440000e+11 1.437e+10
+ 2 1 1.406e+08 10.330 20.000 0.460 1.981 1.440000e+11 1.394e+10
+ 2 2 7.031e+07 10.160 19.870 0.270 1.982 1.440000e+11 1.417e+10
+ 2 3 4.688e+07 10.210 19.780 0.230 1.960 1.440000e+11 1.410e+10
+ 2 4 3.516e+07 10.050 19.730 0.210 1.984 1.440000e+11 1.433e+10
+ 2 5 2.812e+07 10.060 19.760 0.170 1.981 1.440000e+11 1.431e+10
+ 2 6 2.344e+07 10.030 19.780 0.180 1.990 1.440000e+11 1.436e+10
+ 2 7 2.009e+07 10.040 19.820 0.180 1.992 1.440000e+11 1.434e+10
+ 2 8 1.758e+07 10.050 19.820 0.180 1.990 1.440000e+11 1.433e+10
+ 3 1 9.375e+07 13.140 19.950 0.450 1.553 1.440000e+11 1.096e+10
+ 3 2 4.688e+07 10.570 19.840 0.290 1.904 1.440000e+11 1.362e+10
+ 3 3 3.125e+07 10.420 19.730 0.280 1.920 1.440000e+11 1.382e+10
+ 3 4 2.344e+07 10.120 19.710 0.240 1.971 1.440000e+11 1.423e+10
+ 3 5 1.875e+07 10.140 19.750 0.190 1.966 1.440000e+11 1.420e+10
+ 3 6 1.562e+07 10.030 19.730 0.190 1.986 1.440000e+11 1.436e+10
+ 3 7 1.339e+07 10.020 19.720 0.200 1.988 1.440000e+11 1.437e+10
+ 3 8 1.172e+07 9.990 19.720 0.170 1.991 1.440000e+11 1.441e+10
+ 4 1 7.031e+07 10.310 19.980 0.460 1.983 1.440000e+11 1.397e+10
+ 4 2 3.516e+07 10.300 19.830 0.320 1.956 1.440000e+11 1.398e+10
+ 4 3 2.344e+07 10.180 19.780 0.230 1.966 1.440000e+11 1.415e+10
+ 4 4 1.758e+07 10.070 19.750 0.220 1.983 1.440000e+11 1.430e+10
+ 4 5 1.406e+07 10.090 19.750 0.190 1.976 1.440000e+11 1.427e+10
+ 4 6 1.172e+07 10.020 19.720 0.190 1.987 1.440000e+11 1.437e+10
+ 4 7 1.004e+07 10.040 19.780 0.190 1.989 1.440000e+11 1.434e+10
+ 4 8 8.789e+06 10.000 19.750 0.160 1.991 1.440000e+11 1.440e+10
+ 5 1 5.625e+07 11.580 19.930 0.500 1.764 1.440000e+11 1.244e+10
+ 5 2 2.812e+07 10.300 19.830 0.320 1.956 1.440000e+11 1.398e+10
+ 5 3 1.875e+07 10.240 19.760 0.240 1.953 1.440000e+11 1.406e+10
+ 5 4 1.406e+07 10.140 19.880 0.230 1.983 1.440000e+11 1.420e+10
+ 5 5 1.125e+07 10.040 19.730 0.200 1.985 1.440000e+11 1.434e+10
+ 5 6 9.375e+06 10.030 19.770 0.200 1.991 1.440000e+11 1.436e+10
+ 5 7 8.036e+06 10.030 19.780 0.170 1.989 1.440000e+11 1.436e+10
+ 5 8 7.031e+06 10.000 19.750 0.180 1.993 1.440000e+11 1.440e+10
+ 6 1 4.688e+07 10.340 19.910 0.560 1.980 1.440000e+11 1.393e+10
+ 6 2 2.344e+07 10.290 19.770 0.330 1.953 1.440000e+11 1.399e+10
+ 6 3 1.562e+07 10.150 19.770 0.270 1.974 1.440000e+11 1.419e+10
+ 6 4 1.172e+07 10.170 19.880 0.240 1.978 1.440000e+11 1.416e+10
+ 6 5 9.375e+06 10.080 19.780 0.240 1.986 1.440000e+11 1.429e+10
+ 6 6 7.812e+06 10.020 19.740 0.220 1.992 1.440000e+11 1.437e+10
+ 6 7 6.696e+06 10.050 19.760 0.200 1.986 1.440000e+11 1.433e+10
+ 6 8 5.859e+06 10.070 19.750 0.210 1.982 1.440000e+11 1.430e+10
+ 7 1 4.018e+07 11.220 19.880 0.530 1.819 1.440000e+11 1.283e+10
+ 7 2 2.009e+07 10.280 19.790 0.340 1.958 1.440000e+11 1.401e+10
+ 7 3 1.339e+07 10.190 19.760 0.250 1.964 1.440000e+11 1.413e+10
+ 7 4 1.004e+07 10.060 19.750 0.240 1.987 1.440000e+11 1.431e+10
+ 7 5 8.036e+06 10.070 19.750 0.240 1.985 1.440000e+11 1.430e+10
+ 7 6 6.696e+06 10.040 19.810 0.220 1.995 1.440000e+11 1.434e+10
+ 7 7 5.740e+06 10.050 19.780 0.210 1.989 1.440000e+11 1.433e+10
+ 7 8 5.022e+06 10.010 19.790 0.190 1.996 1.440000e+11 1.439e+10
+ 8 1 3.516e+07 10.320 19.900 0.470 1.974 1.440000e+11 1.395e+10
+ 8 2 1.758e+07 10.340 19.900 0.320 1.956 1.440000e+11 1.393e+10
+ 8 3 1.172e+07 10.130 19.770 0.290 1.980 1.440000e+11 1.422e+10
+ 8 4 8.789e+06 10.120 19.780 0.230 1.977 1.440000e+11 1.423e+10
+ 8 5 7.031e+06 10.040 19.790 0.200 1.991 1.440000e+11 1.434e+10
+ 8 6 5.859e+06 10.050 19.770 0.220 1.989 1.440000e+11 1.433e+10
+ 8 7 5.022e+06 10.030 19.800 0.200 1.994 1.440000e+11 1.436e+10
+ 8 8 4.395e+06 10.050 19.800 0.210 1.991 1.440000e+11 1.433e+10
diff --git a/gnuradio-core/src/examples/mp-sched/perf-data/dual-quad-core-2.33-clovertown.dat b/gnuradio-core/src/examples/mp-sched/perf-data/dual-quad-core-2.33-clovertown.dat
new file mode 100644
index 000000000..fa182c69a
--- /dev/null
+++ b/gnuradio-core/src/examples/mp-sched/perf-data/dual-quad-core-2.33-clovertown.dat
@@ -0,0 +1,257 @@
+#D Dual quad-core Xeon 2.33GHz (Clovertown E5345)
+ 1 1 1.367e+08 10.980 12.080 0.360 1.133 7.000000e+10 6.375e+09
+ 1 2 1.367e+08 12.250 24.310 0.400 2.017 1.400000e+11 1.143e+10
+ 1 3 1.367e+08 12.830 36.080 0.580 2.857 2.100000e+11 1.637e+10
+ 1 4 1.367e+08 12.600 46.820 0.770 3.777 2.800000e+11 2.222e+10
+ 1 5 1.367e+08 12.620 58.850 0.720 4.720 3.500000e+11 2.773e+10
+ 1 6 1.367e+08 12.310 69.430 0.860 5.710 4.200000e+11 3.412e+10
+ 1 7 1.367e+08 12.720 80.580 0.950 6.410 4.900000e+11 3.852e+10
+ 1 8 1.367e+08 12.440 91.530 1.010 7.439 5.600000e+11 4.502e+10
+ 1 9 1.367e+08 22.310 102.660 1.080 4.650 6.300000e+11 2.824e+10
+ 1 10 1.367e+08 22.610 113.670 1.160 5.079 7.000000e+11 3.096e+10
+ 1 11 1.367e+08 22.690 124.730 1.030 5.543 7.700000e+11 3.394e+10
+ 1 12 1.367e+08 23.260 136.520 1.030 5.914 8.400000e+11 3.611e+10
+ 1 13 1.367e+08 23.330 147.270 1.130 6.361 9.100000e+11 3.901e+10
+ 1 14 1.367e+08 24.110 158.070 1.010 6.598 9.800000e+11 4.065e+10
+ 1 15 1.367e+08 25.380 168.370 1.080 6.677 1.050000e+12 4.137e+10
+ 1 16 1.367e+08 26.660 179.130 1.250 6.766 1.120000e+12 4.201e+10
+ 2 1 1.367e+08 11.190 23.330 0.420 2.122 1.400000e+11 1.251e+10
+ 2 2 1.367e+08 12.650 46.350 0.940 3.738 2.800000e+11 2.213e+10
+ 2 3 1.367e+08 12.510 69.010 0.980 5.595 4.200000e+11 3.357e+10
+ 2 4 1.367e+08 13.250 89.330 0.890 6.809 5.600000e+11 4.226e+10
+ 2 5 1.367e+08 22.540 113.580 1.150 5.090 7.000000e+11 3.106e+10
+ 2 6 1.367e+08 22.940 135.790 1.260 5.974 8.400000e+11 3.662e+10
+ 2 7 1.367e+08 24.250 158.360 1.520 6.593 9.800000e+11 4.041e+10
+ 2 8 1.367e+08 26.610 179.840 1.490 6.814 1.120000e+12 4.209e+10
+ 2 9 1.215e+08 26.860 179.400 1.540 6.736 1.120000e+12 4.170e+10
+ 2 10 1.094e+08 26.350 178.740 1.430 6.838 1.120000e+12 4.250e+10
+ 2 11 9.943e+07 25.790 177.910 1.350 6.951 1.120000e+12 4.343e+10
+ 2 12 9.115e+07 25.200 176.980 1.460 7.081 1.120000e+12 4.444e+10
+ 2 13 8.413e+07 24.840 177.320 1.260 7.189 1.120000e+12 4.509e+10
+ 2 14 7.812e+07 24.450 176.920 1.130 7.282 1.120000e+12 4.581e+10
+ 2 15 7.292e+07 24.280 177.400 1.140 7.353 1.120000e+12 4.613e+10
+ 2 16 6.836e+07 23.830 176.290 1.100 7.444 1.120000e+12 4.700e+10
+ 3 1 1.367e+08 11.360 34.790 0.930 3.144 2.100000e+11 1.849e+10
+ 3 2 1.367e+08 12.560 68.800 1.400 5.589 4.200000e+11 3.344e+10
+ 3 3 1.367e+08 22.310 103.250 1.310 4.687 6.300000e+11 2.824e+10
+ 3 4 1.367e+08 22.940 136.120 1.500 5.999 8.400000e+11 3.662e+10
+ 3 5 1.367e+08 25.240 168.550 1.790 6.749 1.050000e+12 4.160e+10
+ 3 6 1.215e+08 26.800 178.710 1.610 6.728 1.120000e+12 4.179e+10
+ 3 7 1.042e+08 26.090 178.710 1.490 6.907 1.120000e+12 4.293e+10
+ 3 8 9.115e+07 25.420 178.140 1.360 7.061 1.120000e+12 4.406e+10
+ 3 9 8.102e+07 24.680 177.260 1.410 7.239 1.120000e+12 4.538e+10
+ 3 10 7.292e+07 24.270 176.830 1.390 7.343 1.120000e+12 4.615e+10
+ 3 11 6.629e+07 23.890 177.060 1.240 7.463 1.120000e+12 4.688e+10
+ 3 12 6.076e+07 23.620 176.290 1.300 7.519 1.120000e+12 4.742e+10
+ 3 13 5.609e+07 23.340 176.780 1.230 7.627 1.120000e+12 4.799e+10
+ 3 14 5.208e+07 23.140 176.330 1.300 7.676 1.120000e+12 4.840e+10
+ 3 15 4.861e+07 23.100 176.940 1.080 7.706 1.120000e+12 4.848e+10
+ 3 16 4.557e+07 22.850 176.120 1.060 7.754 1.120000e+12 4.902e+10
+ 4 1 1.367e+08 11.440 45.520 1.080 4.073 2.800000e+11 2.448e+10
+ 4 2 1.367e+08 12.410 90.020 1.440 7.370 5.600000e+11 4.512e+10
+ 4 3 1.367e+08 23.060 135.570 1.600 5.948 8.400000e+11 3.643e+10
+ 4 4 1.367e+08 26.720 179.780 1.880 6.799 1.120000e+12 4.192e+10
+ 4 5 1.094e+08 26.280 178.110 1.890 6.849 1.120000e+12 4.262e+10
+ 4 6 9.115e+07 25.250 177.280 1.700 7.088 1.120000e+12 4.436e+10
+ 4 7 7.812e+07 24.880 177.830 1.570 7.211 1.120000e+12 4.502e+10
+ 4 8 6.836e+07 24.150 177.240 1.350 7.395 1.120000e+12 4.638e+10
+ 4 9 6.076e+07 23.730 176.590 1.370 7.499 1.120000e+12 4.720e+10
+ 4 10 5.469e+07 23.380 176.570 1.310 7.608 1.120000e+12 4.790e+10
+ 4 11 4.972e+07 23.230 176.400 1.290 7.649 1.120000e+12 4.821e+10
+ 4 12 4.557e+07 22.950 176.100 1.250 7.728 1.120000e+12 4.880e+10
+ 4 13 4.207e+07 22.980 176.430 1.260 7.732 1.120000e+12 4.874e+10
+ 4 14 3.906e+07 22.820 176.300 1.350 7.785 1.120000e+12 4.908e+10
+ 4 15 3.646e+07 22.750 176.450 1.220 7.810 1.120000e+12 4.923e+10
+ 4 16 3.418e+07 22.620 176.350 1.080 7.844 1.120000e+12 4.951e+10
+ 5 1 1.367e+08 12.000 56.890 1.600 4.874 3.500000e+11 2.917e+10
+ 5 2 1.367e+08 22.390 112.870 1.920 5.127 7.000000e+11 3.126e+10
+ 5 3 1.367e+08 25.170 167.880 2.110 6.754 1.050000e+12 4.172e+10
+ 5 4 1.094e+08 26.380 178.010 1.900 6.820 1.120000e+12 4.246e+10
+ 5 5 8.750e+07 25.190 177.570 1.660 7.115 1.120000e+12 4.446e+10
+ 5 6 7.292e+07 24.400 176.750 1.650 7.311 1.120000e+12 4.590e+10
+ 5 7 6.250e+07 24.020 177.580 1.570 7.458 1.120000e+12 4.663e+10
+ 5 8 5.469e+07 23.470 176.650 1.350 7.584 1.120000e+12 4.772e+10
+ 5 9 4.861e+07 23.200 176.350 1.280 7.656 1.120000e+12 4.828e+10
+ 5 10 4.375e+07 23.140 176.230 1.410 7.677 1.120000e+12 4.840e+10
+ 5 11 3.977e+07 22.930 176.120 1.320 7.738 1.120000e+12 4.884e+10
+ 5 12 3.646e+07 22.740 176.060 1.330 7.801 1.120000e+12 4.925e+10
+ 5 13 3.365e+07 22.690 176.450 1.210 7.830 1.120000e+12 4.936e+10
+ 5 14 3.125e+07 22.690 176.430 1.230 7.830 1.120000e+12 4.936e+10
+ 5 15 2.917e+07 22.690 176.410 1.260 7.830 1.120000e+12 4.936e+10
+ 5 16 2.734e+07 22.560 176.150 1.110 7.857 1.120000e+12 4.965e+10
+ 6 1 1.367e+08 12.600 68.590 2.230 5.621 4.200000e+11 3.333e+10
+ 6 2 1.367e+08 22.830 135.260 2.100 6.017 8.400000e+11 3.679e+10
+ 6 3 1.215e+08 26.860 178.470 2.140 6.724 1.120000e+12 4.170e+10
+ 6 4 9.115e+07 25.450 177.110 2.060 7.040 1.120000e+12 4.401e+10
+ 6 5 7.292e+07 24.510 176.850 1.910 7.293 1.120000e+12 4.570e+10
+ 6 6 6.076e+07 23.890 176.450 1.760 7.460 1.120000e+12 4.688e+10
+ 6 7 5.208e+07 23.460 175.980 1.540 7.567 1.120000e+12 4.774e+10
+ 6 8 4.557e+07 23.150 176.480 1.370 7.683 1.120000e+12 4.838e+10
+ 6 9 4.051e+07 22.920 176.030 1.400 7.741 1.120000e+12 4.887e+10
+ 6 10 3.646e+07 22.880 176.300 1.350 7.764 1.120000e+12 4.895e+10
+ 6 11 3.314e+07 22.830 175.970 1.360 7.767 1.120000e+12 4.906e+10
+ 6 12 3.038e+07 22.710 176.040 1.190 7.804 1.120000e+12 4.932e+10
+ 6 13 2.804e+07 22.690 176.050 1.340 7.818 1.120000e+12 4.936e+10
+ 6 14 2.604e+07 22.650 176.410 1.140 7.839 1.120000e+12 4.945e+10
+ 6 15 2.431e+07 22.570 175.940 1.250 7.851 1.120000e+12 4.962e+10
+ 6 16 2.279e+07 22.500 175.980 1.170 7.873 1.120000e+12 4.978e+10
+ 7 1 1.367e+08 12.960 79.970 2.850 6.390 4.900000e+11 3.781e+10
+ 7 2 1.367e+08 24.040 156.540 2.500 6.616 9.800000e+11 4.077e+10
+ 7 3 1.042e+08 26.130 178.060 2.210 6.899 1.120000e+12 4.286e+10
+ 7 4 7.812e+07 24.860 176.880 1.810 7.188 1.120000e+12 4.505e+10
+ 7 5 6.250e+07 24.000 176.590 1.790 7.433 1.120000e+12 4.667e+10
+ 7 6 5.208e+07 23.540 176.480 1.670 7.568 1.120000e+12 4.758e+10
+ 7 7 4.464e+07 23.180 176.030 1.510 7.659 1.120000e+12 4.832e+10
+ 7 8 3.906e+07 22.980 176.500 1.340 7.739 1.120000e+12 4.874e+10
+ 7 9 3.472e+07 22.870 175.970 1.280 7.750 1.120000e+12 4.897e+10
+ 7 10 3.125e+07 22.730 176.220 1.300 7.810 1.120000e+12 4.927e+10
+ 7 11 2.841e+07 22.700 176.030 1.300 7.812 1.120000e+12 4.934e+10
+ 7 12 2.604e+07 22.650 176.300 1.210 7.837 1.120000e+12 4.945e+10
+ 7 13 2.404e+07 22.580 176.140 1.170 7.853 1.120000e+12 4.960e+10
+ 7 14 2.232e+07 22.540 176.550 1.130 7.883 1.120000e+12 4.969e+10
+ 7 15 2.083e+07 22.570 175.870 1.260 7.848 1.120000e+12 4.962e+10
+ 7 16 1.953e+07 22.520 175.980 1.310 7.873 1.120000e+12 4.973e+10
+ 8 1 1.367e+08 13.250 91.770 3.010 7.153 5.600000e+11 4.226e+10
+ 8 2 1.367e+08 26.280 178.100 2.980 6.890 1.120000e+12 4.262e+10
+ 8 3 9.115e+07 25.510 177.140 2.270 7.033 1.120000e+12 4.390e+10
+ 8 4 6.836e+07 24.330 176.850 1.870 7.346 1.120000e+12 4.603e+10
+ 8 5 5.469e+07 23.680 176.850 1.690 7.540 1.120000e+12 4.730e+10
+ 8 6 4.557e+07 23.430 176.210 1.700 7.593 1.120000e+12 4.780e+10
+ 8 7 3.906e+07 23.100 176.680 1.440 7.711 1.120000e+12 4.848e+10
+ 8 8 3.418e+07 22.890 176.270 1.430 7.763 1.120000e+12 4.893e+10
+ 8 9 3.038e+07 22.760 175.980 1.320 7.790 1.120000e+12 4.921e+10
+ 8 10 2.734e+07 22.760 176.340 1.290 7.804 1.120000e+12 4.921e+10
+ 8 11 2.486e+07 22.660 176.220 1.170 7.828 1.120000e+12 4.943e+10
+ 8 12 2.279e+07 22.660 176.050 1.280 7.826 1.120000e+12 4.943e+10
+ 8 13 2.103e+07 22.590 176.170 1.350 7.858 1.120000e+12 4.958e+10
+ 8 14 1.953e+07 22.550 176.120 1.320 7.869 1.120000e+12 4.967e+10
+ 8 15 1.823e+07 22.590 176.130 1.270 7.853 1.120000e+12 4.958e+10
+ 8 16 1.709e+07 22.500 176.090 1.230 7.881 1.120000e+12 4.978e+10
+ 9 1 1.367e+08 21.110 101.410 2.640 4.929 6.300000e+11 2.984e+10
+ 9 2 1.215e+08 27.400 178.180 2.720 6.602 1.120000e+12 4.088e+10
+ 9 3 8.102e+07 25.140 177.370 2.230 7.144 1.120000e+12 4.455e+10
+ 9 4 6.076e+07 24.110 176.810 1.910 7.413 1.120000e+12 4.645e+10
+ 9 5 4.861e+07 23.460 176.240 1.600 7.581 1.120000e+12 4.774e+10
+ 9 6 4.051e+07 23.200 176.310 1.620 7.669 1.120000e+12 4.828e+10
+ 9 7 3.472e+07 22.970 176.560 1.540 7.754 1.120000e+12 4.876e+10
+ 9 8 3.038e+07 22.920 176.300 1.440 7.755 1.120000e+12 4.887e+10
+ 9 9 2.701e+07 22.830 176.090 1.370 7.773 1.120000e+12 4.906e+10
+ 9 10 2.431e+07 22.730 175.960 1.430 7.804 1.120000e+12 4.927e+10
+ 9 11 2.210e+07 22.750 176.160 1.260 7.799 1.120000e+12 4.923e+10
+ 9 12 2.025e+07 22.660 176.100 1.380 7.832 1.120000e+12 4.943e+10
+ 9 13 1.870e+07 22.700 176.040 1.400 7.817 1.120000e+12 4.934e+10
+ 9 14 1.736e+07 22.620 175.940 1.410 7.840 1.120000e+12 4.951e+10
+ 9 15 1.620e+07 22.490 175.910 1.340 7.881 1.120000e+12 4.980e+10
+ 9 16 1.519e+07 22.540 175.990 1.330 7.867 1.120000e+12 4.969e+10
+ 10 1 1.367e+08 21.730 113.690 2.870 5.364 7.000000e+11 3.221e+10
+ 10 2 1.094e+08 26.660 177.920 3.180 6.793 1.120000e+12 4.201e+10
+ 10 3 7.292e+07 24.740 176.810 2.090 7.231 1.120000e+12 4.527e+10
+ 10 4 5.469e+07 23.880 176.280 2.020 7.466 1.120000e+12 4.690e+10
+ 10 5 4.375e+07 23.330 176.510 1.610 7.635 1.120000e+12 4.801e+10
+ 10 6 3.646e+07 23.170 176.160 1.680 7.675 1.120000e+12 4.834e+10
+ 10 7 3.125e+07 22.950 176.490 1.470 7.754 1.120000e+12 4.880e+10
+ 10 8 2.734e+07 22.830 176.260 1.360 7.780 1.120000e+12 4.906e+10
+ 10 9 2.431e+07 22.770 175.930 1.410 7.788 1.120000e+12 4.919e+10
+ 10 10 2.188e+07 22.680 175.870 1.440 7.818 1.120000e+12 4.938e+10
+ 10 11 1.989e+07 22.700 176.140 1.310 7.817 1.120000e+12 4.934e+10
+ 10 12 1.823e+07 22.630 176.040 1.430 7.842 1.120000e+12 4.949e+10
+ 10 13 1.683e+07 22.640 176.000 1.320 7.832 1.120000e+12 4.947e+10
+ 10 14 1.562e+07 22.610 176.160 1.230 7.846 1.120000e+12 4.954e+10
+ 10 15 1.458e+07 22.570 176.010 1.290 7.856 1.120000e+12 4.962e+10
+ 10 16 1.367e+07 22.640 176.060 1.270 7.833 1.120000e+12 4.947e+10
+ 11 1 1.367e+08 22.060 124.440 3.050 5.779 7.700000e+11 3.490e+10
+ 11 2 9.943e+07 26.060 178.400 3.000 6.961 1.120000e+12 4.298e+10
+ 11 3 6.629e+07 24.380 176.690 2.200 7.338 1.120000e+12 4.594e+10
+ 11 4 4.972e+07 23.650 176.730 1.830 7.550 1.120000e+12 4.736e+10
+ 11 5 3.977e+07 23.310 176.030 1.780 7.628 1.120000e+12 4.805e+10
+ 11 6 3.314e+07 23.050 176.210 1.680 7.718 1.120000e+12 4.859e+10
+ 11 7 2.841e+07 22.940 176.300 1.540 7.752 1.120000e+12 4.882e+10
+ 11 8 2.486e+07 22.830 175.990 1.530 7.776 1.120000e+12 4.906e+10
+ 11 9 2.210e+07 22.760 176.060 1.440 7.799 1.120000e+12 4.921e+10
+ 11 10 1.989e+07 22.630 176.010 1.430 7.841 1.120000e+12 4.949e+10
+ 11 11 1.808e+07 22.720 176.040 1.390 7.809 1.120000e+12 4.930e+10
+ 11 12 1.657e+07 22.640 175.890 1.400 7.831 1.120000e+12 4.947e+10
+ 11 13 1.530e+07 22.570 176.090 1.260 7.858 1.120000e+12 4.962e+10
+ 11 14 1.420e+07 22.610 176.150 1.450 7.855 1.120000e+12 4.954e+10
+ 11 15 1.326e+07 22.550 175.980 1.310 7.862 1.120000e+12 4.967e+10
+ 11 16 1.243e+07 22.610 175.920 1.400 7.843 1.120000e+12 4.954e+10
+ 12 1 1.367e+08 22.220 136.260 3.390 6.285 8.400000e+11 3.780e+10
+ 12 2 9.115e+07 25.610 178.090 2.800 7.063 1.120000e+12 4.373e+10
+ 12 3 6.076e+07 24.180 176.320 2.230 7.384 1.120000e+12 4.632e+10
+ 12 4 4.557e+07 23.570 176.570 2.010 7.577 1.120000e+12 4.752e+10
+ 12 5 3.646e+07 23.210 176.420 1.710 7.675 1.120000e+12 4.826e+10
+ 12 6 3.038e+07 23.040 175.910 1.640 7.706 1.120000e+12 4.861e+10
+ 12 7 2.604e+07 22.980 176.390 1.510 7.742 1.120000e+12 4.874e+10
+ 12 8 2.279e+07 22.840 176.110 1.640 7.782 1.120000e+12 4.904e+10
+ 12 9 2.025e+07 22.760 175.950 1.500 7.797 1.120000e+12 4.921e+10
+ 12 10 1.823e+07 22.660 175.810 1.600 7.829 1.120000e+12 4.943e+10
+ 12 11 1.657e+07 22.710 175.940 1.410 7.809 1.120000e+12 4.932e+10
+ 12 12 1.519e+07 22.650 175.870 1.400 7.826 1.120000e+12 4.945e+10
+ 12 13 1.402e+07 22.640 176.040 1.260 7.831 1.120000e+12 4.947e+10
+ 12 14 1.302e+07 22.650 176.130 1.450 7.840 1.120000e+12 4.945e+10
+ 12 15 1.215e+07 22.580 175.990 1.370 7.855 1.120000e+12 4.960e+10
+ 12 16 1.139e+07 22.640 175.870 1.440 7.832 1.120000e+12 4.947e+10
+ 13 1 1.367e+08 22.640 147.020 3.570 6.652 9.100000e+11 4.019e+10
+ 13 2 8.413e+07 25.600 177.820 2.870 7.058 1.120000e+12 4.375e+10
+ 13 3 5.609e+07 24.020 176.980 2.270 7.463 1.120000e+12 4.663e+10
+ 13 4 4.207e+07 23.440 176.430 2.030 7.613 1.120000e+12 4.778e+10
+ 13 5 3.365e+07 23.080 176.110 1.790 7.708 1.120000e+12 4.853e+10
+ 13 6 2.804e+07 22.870 176.210 1.600 7.775 1.120000e+12 4.897e+10
+ 13 7 2.404e+07 22.940 176.340 1.580 7.756 1.120000e+12 4.882e+10
+ 13 8 2.103e+07 22.880 176.050 1.520 7.761 1.120000e+12 4.895e+10
+ 13 9 1.870e+07 22.740 176.020 1.400 7.802 1.120000e+12 4.925e+10
+ 13 10 1.683e+07 22.710 175.880 1.440 7.808 1.120000e+12 4.932e+10
+ 13 11 1.530e+07 22.590 176.040 1.350 7.853 1.120000e+12 4.958e+10
+ 13 12 1.402e+07 22.600 175.930 1.380 7.846 1.120000e+12 4.956e+10
+ 13 13 1.294e+07 22.710 176.010 1.340 7.809 1.120000e+12 4.932e+10
+ 13 14 1.202e+07 22.690 176.270 1.350 7.828 1.120000e+12 4.936e+10
+ 13 15 1.122e+07 22.590 175.960 1.290 7.846 1.120000e+12 4.958e+10
+ 13 16 1.052e+07 22.610 175.960 1.370 7.843 1.120000e+12 4.954e+10
+ 14 1 1.367e+08 23.120 157.180 3.810 6.963 9.800000e+11 4.239e+10
+ 14 2 7.812e+07 25.310 177.210 3.020 7.121 1.120000e+12 4.425e+10
+ 14 3 5.208e+07 24.130 177.110 2.340 7.437 1.120000e+12 4.642e+10
+ 14 4 3.906e+07 23.390 176.660 1.800 7.630 1.120000e+12 4.788e+10
+ 14 5 3.125e+07 23.060 176.420 1.750 7.726 1.120000e+12 4.857e+10
+ 14 6 2.604e+07 22.890 176.180 1.530 7.764 1.120000e+12 4.893e+10
+ 14 7 2.232e+07 22.940 176.060 1.550 7.742 1.120000e+12 4.882e+10
+ 14 8 1.953e+07 22.810 176.110 1.500 7.786 1.120000e+12 4.910e+10
+ 14 9 1.736e+07 22.750 176.370 1.370 7.813 1.120000e+12 4.923e+10
+ 14 10 1.562e+07 22.720 176.020 1.450 7.811 1.120000e+12 4.930e+10
+ 14 11 1.420e+07 22.680 176.090 1.310 7.822 1.120000e+12 4.938e+10
+ 14 12 1.302e+07 22.710 175.950 1.510 7.814 1.120000e+12 4.932e+10
+ 14 13 1.202e+07 22.700 176.100 1.500 7.824 1.120000e+12 4.934e+10
+ 14 14 1.116e+07 22.660 176.150 1.460 7.838 1.120000e+12 4.943e+10
+ 14 15 1.042e+07 22.680 176.120 1.370 7.826 1.120000e+12 4.938e+10
+ 14 16 9.766e+06 22.710 176.110 1.430 7.818 1.120000e+12 4.932e+10
+ 15 1 1.367e+08 23.710 168.080 4.140 7.264 1.050000e+12 4.429e+10
+ 15 2 7.292e+07 25.170 176.640 2.930 7.134 1.120000e+12 4.450e+10
+ 15 3 4.861e+07 23.820 176.980 2.110 7.518 1.120000e+12 4.702e+10
+ 15 4 3.646e+07 23.250 176.190 1.970 7.663 1.120000e+12 4.817e+10
+ 15 5 2.917e+07 23.050 176.450 1.690 7.728 1.120000e+12 4.859e+10
+ 15 6 2.431e+07 22.900 175.980 1.680 7.758 1.120000e+12 4.891e+10
+ 15 7 2.083e+07 22.830 176.090 1.640 7.785 1.120000e+12 4.906e+10
+ 15 8 1.823e+07 22.850 176.160 1.530 7.776 1.120000e+12 4.902e+10
+ 15 9 1.620e+07 22.780 176.390 1.360 7.803 1.120000e+12 4.917e+10
+ 15 10 1.458e+07 22.660 176.000 1.440 7.831 1.120000e+12 4.943e+10
+ 15 11 1.326e+07 22.660 176.110 1.430 7.835 1.120000e+12 4.943e+10
+ 15 12 1.215e+07 22.660 176.150 1.380 7.835 1.120000e+12 4.943e+10
+ 15 13 1.122e+07 22.760 175.970 1.580 7.801 1.120000e+12 4.921e+10
+ 15 14 1.042e+07 22.670 176.290 1.270 7.832 1.120000e+12 4.940e+10
+ 15 15 9.722e+06 22.710 176.060 1.550 7.821 1.120000e+12 4.932e+10
+ 15 16 9.115e+06 22.800 176.020 1.490 7.786 1.120000e+12 4.912e+10
+ 16 1 1.367e+08 25.470 179.270 4.730 7.224 1.120000e+12 4.397e+10
+ 16 2 6.836e+07 24.870 176.820 2.960 7.229 1.120000e+12 4.503e+10
+ 16 3 4.557e+07 23.810 176.930 2.250 7.525 1.120000e+12 4.704e+10
+ 16 4 3.418e+07 23.240 176.650 1.950 7.685 1.120000e+12 4.819e+10
+ 16 5 2.734e+07 23.090 175.940 1.940 7.704 1.120000e+12 4.851e+10
+ 16 6 2.279e+07 22.900 176.120 1.680 7.764 1.120000e+12 4.891e+10
+ 16 7 1.953e+07 22.890 176.290 1.440 7.765 1.120000e+12 4.893e+10
+ 16 8 1.709e+07 22.820 176.040 1.610 7.785 1.120000e+12 4.908e+10
+ 16 9 1.519e+07 22.890 175.990 1.470 7.753 1.120000e+12 4.893e+10
+ 16 10 1.367e+07 22.700 175.890 1.470 7.813 1.120000e+12 4.934e+10
+ 16 11 1.243e+07 22.770 175.960 1.520 7.794 1.120000e+12 4.919e+10
+ 16 12 1.139e+07 22.730 176.000 1.430 7.806 1.120000e+12 4.927e+10
+ 16 13 1.052e+07 22.670 175.990 1.540 7.831 1.120000e+12 4.940e+10
+ 16 14 9.766e+06 22.720 176.130 1.440 7.816 1.120000e+12 4.930e+10
+ 16 15 9.115e+06 22.740 176.320 1.360 7.814 1.120000e+12 4.925e+10
+ 16 16 8.545e+06 22.680 176.170 1.320 7.826 1.120000e+12 4.938e+10
diff --git a/gnuradio-core/src/examples/mp-sched/perf-data/dual-quad-core-3.00-penryn.dat b/gnuradio-core/src/examples/mp-sched/perf-data/dual-quad-core-3.00-penryn.dat
new file mode 100644
index 000000000..57d49ed33
--- /dev/null
+++ b/gnuradio-core/src/examples/mp-sched/perf-data/dual-quad-core-3.00-penryn.dat
@@ -0,0 +1,257 @@
+#D Dual quad-core Xeon 3.0 GHz (Penryn E5472, 1600 MHz FSB, 5400 chipset)
+ 1 1 5.000e+07 2.720 3.020 0.110 1.151 2.560000e+10 9.412e+09
+ 1 2 5.000e+07 2.870 5.630 0.170 2.021 5.120000e+10 1.784e+10
+ 1 3 5.000e+07 2.880 8.380 0.160 2.965 7.680000e+10 2.667e+10
+ 1 4 5.000e+07 2.990 11.080 0.200 3.773 1.024000e+11 3.425e+10
+ 1 5 5.000e+07 2.950 13.950 0.190 4.793 1.280000e+11 4.339e+10
+ 1 6 5.000e+07 3.020 16.620 0.240 5.583 1.536000e+11 5.086e+10
+ 1 7 5.000e+07 2.930 19.250 0.200 6.638 1.792000e+11 6.116e+10
+ 1 8 5.000e+07 3.170 22.240 0.290 7.107 2.048000e+11 6.461e+10
+ 1 9 5.000e+07 5.450 24.410 0.310 4.536 2.304000e+11 4.228e+10
+ 1 10 5.000e+07 5.610 27.400 0.370 4.950 2.560000e+11 4.563e+10
+ 1 11 5.000e+07 5.680 29.960 0.370 5.340 2.816000e+11 4.958e+10
+ 1 12 5.000e+07 5.440 32.490 0.350 6.037 3.072000e+11 5.647e+10
+ 1 13 5.000e+07 5.630 35.270 0.400 6.336 3.328000e+11 5.911e+10
+ 1 14 5.000e+07 6.270 38.500 0.480 6.217 3.584000e+11 5.716e+10
+ 1 15 5.000e+07 6.080 40.880 0.490 6.804 3.840000e+11 6.316e+10
+ 1 16 5.000e+07 7.740 43.390 0.600 5.683 4.096000e+11 5.292e+10
+ 2 1 5.000e+07 2.820 5.700 0.210 2.096 5.120000e+10 1.816e+10
+ 2 2 5.000e+07 2.820 11.130 0.230 4.028 1.024000e+11 3.631e+10
+ 2 3 5.000e+07 2.960 16.570 0.320 5.706 1.536000e+11 5.189e+10
+ 2 4 5.000e+07 3.110 21.920 0.390 7.174 2.048000e+11 6.585e+10
+ 2 5 5.000e+07 5.650 27.550 0.520 4.968 2.560000e+11 4.531e+10
+ 2 6 5.000e+07 5.880 32.890 0.440 5.668 3.072000e+11 5.224e+10
+ 2 7 5.000e+07 6.750 38.210 0.560 5.744 3.584000e+11 5.310e+10
+ 2 8 5.000e+07 6.360 43.480 0.580 6.928 4.096000e+11 6.440e+10
+ 2 9 5.000e+07 8.270 48.750 0.730 5.983 4.608000e+11 5.572e+10
+ 2 10 5.000e+07 8.210 54.400 0.610 6.700 5.120000e+11 6.236e+10
+ 2 11 5.000e+07 8.750 59.760 0.640 6.903 5.632000e+11 6.437e+10
+ 2 12 5.000e+07 9.300 65.050 0.700 7.070 6.144000e+11 6.606e+10
+ 2 13 5.000e+07 9.990 70.750 0.750 7.157 6.656000e+11 6.663e+10
+ 2 14 5.000e+07 10.610 75.950 0.810 7.235 7.168000e+11 6.756e+10
+ 2 15 5.000e+07 11.900 80.400 0.870 6.829 7.680000e+11 6.454e+10
+ 2 16 5.000e+07 11.820 86.790 0.900 7.419 8.192000e+11 6.931e+10
+ 3 1 5.000e+07 2.970 8.300 0.380 2.923 7.680000e+10 2.586e+10
+ 3 2 5.000e+07 2.980 16.660 0.390 5.721 1.536000e+11 5.154e+10
+ 3 3 5.000e+07 5.480 24.690 0.420 4.582 2.304000e+11 4.204e+10
+ 3 4 5.000e+07 5.620 32.820 0.560 5.940 3.072000e+11 5.466e+10
+ 3 5 5.000e+07 6.940 40.800 0.620 5.968 3.840000e+11 5.533e+10
+ 3 6 5.000e+07 7.860 49.010 0.710 6.326 4.608000e+11 5.863e+10
+ 3 7 5.000e+07 8.470 57.130 0.750 6.834 5.376000e+11 6.347e+10
+ 3 8 5.000e+07 9.420 65.310 0.820 7.020 6.144000e+11 6.522e+10
+ 3 9 5.000e+07 10.350 73.640 0.940 7.206 6.912000e+11 6.678e+10
+ 3 10 5.000e+07 11.460 82.230 1.030 7.265 7.680000e+11 6.702e+10
+ 3 11 5.000e+07 12.200 89.590 1.050 7.430 8.448000e+11 6.925e+10
+ 3 12 5.000e+07 13.040 97.520 1.140 7.566 9.216000e+11 7.067e+10
+ 3 13 5.000e+07 14.000 105.560 1.150 7.622 9.984000e+11 7.131e+10
+ 3 14 5.000e+07 14.930 113.630 1.210 7.692 1.075200e+12 7.202e+10
+ 3 15 5.000e+07 15.920 121.610 1.350 7.724 1.152000e+12 7.236e+10
+ 3 16 5.000e+07 16.870 129.770 1.390 7.775 1.228800e+12 7.284e+10
+ 4 1 5.000e+07 2.900 11.100 0.340 3.945 1.024000e+11 3.531e+10
+ 4 2 5.000e+07 4.380 21.980 0.480 5.128 2.048000e+11 4.676e+10
+ 4 3 5.000e+07 5.720 32.800 0.610 5.841 3.072000e+11 5.371e+10
+ 4 4 5.000e+07 6.820 43.880 0.700 6.537 4.096000e+11 6.006e+10
+ 4 5 5.000e+07 8.150 54.420 0.760 6.771 5.120000e+11 6.282e+10
+ 4 6 5.000e+07 9.510 65.180 0.980 6.957 6.144000e+11 6.461e+10
+ 4 7 5.000e+07 10.650 76.080 1.020 7.239 7.168000e+11 6.731e+10
+ 4 8 5.000e+07 11.880 86.720 1.110 7.393 8.192000e+11 6.896e+10
+ 4 9 5.000e+07 13.150 97.920 1.250 7.541 9.216000e+11 7.008e+10
+ 4 10 5.000e+07 14.640 109.260 1.410 7.559 1.024000e+12 6.995e+10
+ 4 11 5.000e+07 15.710 119.170 1.440 7.677 1.126400e+12 7.170e+10
+ 4 12 5.000e+07 16.950 129.960 1.420 7.751 1.228800e+12 7.250e+10
+ 4 13 5.000e+07 18.260 140.520 1.620 7.784 1.331200e+12 7.290e+10
+ 4 14 5.000e+07 19.610 151.290 1.780 7.806 1.433600e+12 7.311e+10
+ 4 15 5.000e+07 21.060 162.760 1.890 7.818 1.536000e+12 7.293e+10
+ 4 16 5.000e+07 22.280 172.870 1.980 7.848 1.638400e+12 7.354e+10
+ 5 1 5.000e+07 3.040 13.810 0.390 4.671 1.280000e+11 4.211e+10
+ 5 2 5.000e+07 5.590 27.510 0.610 5.030 2.560000e+11 4.580e+10
+ 5 3 5.000e+07 6.550 40.970 0.780 6.374 3.840000e+11 5.863e+10
+ 5 4 5.000e+07 8.520 54.470 0.940 6.504 5.120000e+11 6.009e+10
+ 5 5 5.000e+07 9.920 67.950 1.060 6.957 6.400000e+11 6.452e+10
+ 5 6 5.000e+07 11.350 81.490 1.180 7.284 7.680000e+11 6.767e+10
+ 5 7 5.000e+07 12.910 94.960 1.300 7.456 8.960000e+11 6.940e+10
+ 5 8 5.000e+07 14.520 108.510 1.400 7.570 1.024000e+12 7.052e+10
+ 5 9 5.000e+07 16.070 122.120 1.620 7.700 1.152000e+12 7.169e+10
+ 5 10 5.000e+07 17.950 136.140 1.730 7.681 1.280000e+12 7.131e+10
+ 5 11 5.000e+07 19.470 148.330 1.830 7.712 1.408000e+12 7.232e+10
+ 5 12 5.000e+07 20.980 162.100 2.030 7.823 1.536000e+12 7.321e+10
+ 5 13 5.000e+07 22.670 175.470 2.160 7.835 1.664000e+12 7.340e+10
+ 5 14 5.000e+07 24.440 189.630 2.170 7.848 1.792000e+12 7.332e+10
+ 5 15 5.000e+07 26.100 203.010 2.450 7.872 1.920000e+12 7.356e+10
+ 5 16 5.000e+07 27.720 216.000 2.550 7.884 2.048000e+12 7.388e+10
+ 6 1 5.000e+07 2.950 16.560 0.540 5.797 1.536000e+11 5.207e+10
+ 6 2 5.000e+07 5.540 32.900 0.720 6.069 3.072000e+11 5.545e+10
+ 6 3 5.000e+07 8.490 48.860 1.000 5.873 4.608000e+11 5.428e+10
+ 6 4 5.000e+07 10.000 64.670 1.100 6.577 6.144000e+11 6.144e+10
+ 6 5 5.000e+07 11.440 81.430 1.310 7.233 7.680000e+11 6.713e+10
+ 6 6 5.000e+07 13.250 97.690 1.360 7.475 9.216000e+11 6.955e+10
+ 6 7 5.000e+07 15.270 113.730 1.610 7.553 1.075200e+12 7.041e+10
+ 6 8 5.000e+07 17.180 129.780 1.820 7.660 1.228800e+12 7.153e+10
+ 6 9 5.000e+07 19.200 146.020 1.870 7.703 1.382400e+12 7.200e+10
+ 6 10 5.000e+07 21.220 162.290 2.100 7.747 1.536000e+12 7.238e+10
+ 6 11 5.000e+07 23.070 178.420 2.160 7.827 1.689600e+12 7.324e+10
+ 6 12 5.000e+07 25.120 194.590 2.450 7.844 1.843200e+12 7.338e+10
+ 6 13 5.000e+07 27.110 210.640 2.660 7.868 1.996800e+12 7.366e+10
+ 6 14 5.000e+07 29.110 226.820 2.750 7.886 2.150400e+12 7.387e+10
+ 6 15 5.000e+07 31.130 242.800 2.940 7.894 2.304000e+12 7.401e+10
+ 6 16 5.000e+07 33.100 258.790 3.210 7.915 2.457600e+12 7.425e+10
+ 7 1 5.000e+07 2.940 19.140 0.590 6.711 1.792000e+11 6.095e+10
+ 7 2 5.000e+07 5.920 37.910 1.030 6.578 3.584000e+11 6.054e+10
+ 7 3 5.000e+07 8.570 57.010 1.150 6.786 5.376000e+11 6.273e+10
+ 7 4 5.000e+07 10.840 76.060 1.320 7.138 7.168000e+11 6.613e+10
+ 7 5 5.000e+07 13.070 94.920 1.540 7.380 8.960000e+11 6.855e+10
+ 7 6 5.000e+07 15.270 113.790 1.730 7.565 1.075200e+12 7.041e+10
+ 7 7 5.000e+07 17.700 132.560 1.960 7.600 1.254400e+12 7.087e+10
+ 7 8 5.000e+07 19.930 151.500 2.130 7.708 1.433600e+12 7.193e+10
+ 7 9 5.000e+07 22.250 170.570 2.340 7.771 1.612800e+12 7.249e+10
+ 7 10 5.000e+07 24.600 189.280 2.450 7.794 1.792000e+12 7.285e+10
+ 7 11 5.000e+07 26.950 208.030 2.700 7.819 1.971200e+12 7.314e+10
+ 7 12 5.000e+07 29.280 227.070 2.850 7.852 2.150400e+12 7.344e+10
+ 7 13 5.000e+07 31.570 245.750 3.040 7.881 2.329600e+12 7.379e+10
+ 7 14 5.000e+07 33.930 264.960 3.160 7.902 2.508800e+12 7.394e+10
+ 7 15 5.000e+07 36.310 283.960 3.440 7.915 2.688000e+12 7.403e+10
+ 7 16 5.000e+07 38.560 302.120 3.630 7.929 2.867200e+12 7.436e+10
+ 8 1 5.000e+07 3.200 21.880 0.860 7.106 2.048000e+11 6.400e+10
+ 8 2 5.000e+07 5.890 43.450 0.930 7.535 4.096000e+11 6.954e+10
+ 8 3 5.000e+07 9.520 65.180 1.250 6.978 6.144000e+11 6.454e+10
+ 8 4 5.000e+07 12.200 86.780 1.480 7.234 8.192000e+11 6.715e+10
+ 8 5 5.000e+07 14.760 108.420 1.670 7.459 1.024000e+12 6.938e+10
+ 8 6 5.000e+07 17.300 129.850 1.960 7.619 1.228800e+12 7.103e+10
+ 8 7 5.000e+07 20.020 151.430 2.190 7.673 1.433600e+12 7.161e+10
+ 8 8 5.000e+07 22.750 173.550 2.420 7.735 1.638400e+12 7.202e+10
+ 8 9 5.000e+07 25.410 194.560 2.760 7.765 1.843200e+12 7.254e+10
+ 8 10 5.000e+07 28.410 217.250 2.920 7.750 2.048000e+12 7.209e+10
+ 8 11 5.000e+07 30.720 237.990 3.210 7.852 2.252800e+12 7.333e+10
+ 8 12 5.000e+07 33.310 259.340 3.280 7.884 2.457600e+12 7.378e+10
+ 8 13 5.000e+07 36.000 280.760 3.670 7.901 2.662400e+12 7.396e+10
+ 8 14 5.000e+07 38.800 302.570 3.740 7.895 2.867200e+12 7.390e+10
+ 8 15 5.000e+07 41.530 324.520 4.060 7.912 3.072000e+12 7.397e+10
+ 8 16 5.000e+07 44.060 345.420 4.250 7.936 3.276800e+12 7.437e+10
+ 9 1 5.000e+07 5.460 24.660 1.000 4.700 2.304000e+11 4.220e+10
+ 9 2 5.000e+07 8.460 49.010 1.200 5.935 4.608000e+11 5.447e+10
+ 9 3 5.000e+07 10.810 71.410 1.400 6.735 6.912000e+11 6.394e+10
+ 9 4 5.000e+07 13.470 97.570 1.710 7.370 9.216000e+11 6.842e+10
+ 9 5 5.000e+07 16.490 121.780 2.130 7.514 1.152000e+12 6.986e+10
+ 9 6 5.000e+07 19.540 146.070 2.280 7.592 1.382400e+12 7.075e+10
+ 9 7 5.000e+07 22.660 170.830 2.570 7.652 1.612800e+12 7.117e+10
+ 9 8 5.000e+07 25.520 194.720 2.760 7.738 1.843200e+12 7.223e+10
+ 9 9 5.000e+07 28.400 219.020 3.060 7.820 2.073600e+12 7.301e+10
+ 9 10 5.000e+07 31.490 243.030 3.320 7.823 2.304000e+12 7.317e+10
+ 9 11 5.000e+07 34.530 267.230 3.420 7.838 2.534400e+12 7.340e+10
+ 9 12 5.000e+07 37.520 291.720 3.860 7.878 2.764800e+12 7.369e+10
+ 9 13 5.000e+07 40.550 315.780 4.170 7.890 2.995200e+12 7.386e+10
+ 9 14 5.000e+07 43.470 339.930 4.290 7.919 3.225600e+12 7.420e+10
+ 9 15 5.000e+07 46.820 364.970 4.640 7.894 3.456000e+12 7.381e+10
+ 9 16 5.000e+07 49.660 388.630 4.890 7.924 3.686400e+12 7.423e+10
+ 10 1 5.000e+07 5.500 27.290 0.980 5.140 2.560000e+11 4.655e+10
+ 10 2 5.000e+07 8.480 54.830 1.420 6.633 5.120000e+11 6.038e+10
+ 10 3 5.000e+07 11.540 81.580 1.630 7.211 7.680000e+11 6.655e+10
+ 10 4 5.000e+07 14.950 108.480 1.860 7.381 1.024000e+12 6.849e+10
+ 10 5 5.000e+07 18.330 135.300 2.280 7.506 1.280000e+12 6.983e+10
+ 10 6 5.000e+07 21.680 162.380 2.540 7.607 1.536000e+12 7.085e+10
+ 10 7 5.000e+07 24.950 189.360 2.730 7.699 1.792000e+12 7.182e+10
+ 10 8 5.000e+07 28.280 216.090 3.110 7.751 2.048000e+12 7.242e+10
+ 10 9 5.000e+07 31.730 243.290 3.450 7.776 2.304000e+12 7.261e+10
+ 10 10 5.000e+07 35.040 270.380 3.680 7.821 2.560000e+12 7.306e+10
+ 10 11 5.000e+07 38.340 297.080 4.050 7.854 2.816000e+12 7.345e+10
+ 10 12 5.000e+07 41.770 323.840 4.330 7.857 3.072000e+12 7.355e+10
+ 10 13 5.000e+07 45.120 351.380 4.710 7.892 3.328000e+12 7.376e+10
+ 10 14 5.000e+07 48.360 377.870 4.880 7.915 3.584000e+12 7.411e+10
+ 10 15 5.000e+07 51.760 404.740 5.110 7.918 3.840000e+12 7.419e+10
+ 10 16 5.000e+07 55.130 431.760 5.430 7.930 4.096000e+12 7.430e+10
+ 11 1 5.000e+07 5.570 30.080 1.080 5.594 2.816000e+11 5.056e+10
+ 11 2 5.000e+07 9.000 60.230 1.470 6.856 5.632000e+11 6.258e+10
+ 11 3 5.000e+07 12.630 89.890 1.770 7.257 8.448000e+11 6.689e+10
+ 11 4 5.000e+07 16.290 119.110 2.140 7.443 1.126400e+12 6.915e+10
+ 11 5 5.000e+07 19.940 148.730 2.440 7.581 1.408000e+12 7.061e+10
+ 11 6 5.000e+07 23.800 178.620 2.790 7.622 1.689600e+12 7.099e+10
+ 11 7 5.000e+07 27.480 208.510 3.160 7.703 1.971200e+12 7.173e+10
+ 11 8 5.000e+07 31.140 237.820 3.490 7.749 2.252800e+12 7.234e+10
+ 11 9 5.000e+07 34.770 267.390 3.800 7.800 2.534400e+12 7.289e+10
+ 11 10 5.000e+07 38.510 297.250 4.240 7.829 2.816000e+12 7.312e+10
+ 11 11 5.000e+07 42.080 326.570 4.610 7.870 3.097600e+12 7.361e+10
+ 11 12 5.000e+07 45.860 356.540 4.590 7.875 3.379200e+12 7.369e+10
+ 11 13 5.000e+07 49.570 386.250 5.150 7.896 3.660800e+12 7.385e+10
+ 11 14 5.000e+07 53.220 415.630 5.360 7.910 3.942400e+12 7.408e+10
+ 11 15 5.000e+07 57.000 445.200 5.870 7.914 4.224000e+12 7.411e+10
+ 11 16 5.000e+07 60.800 474.810 6.250 7.912 4.505600e+12 7.411e+10
+ 12 1 5.000e+07 5.600 32.770 1.240 6.073 3.072000e+11 5.486e+10
+ 12 2 5.000e+07 10.220 65.660 1.600 6.581 6.144000e+11 6.012e+10
+ 12 3 5.000e+07 13.680 97.900 2.000 7.303 9.216000e+11 6.737e+10
+ 12 4 5.000e+07 17.790 129.710 2.330 7.422 1.228800e+12 6.907e+10
+ 12 5 5.000e+07 21.770 162.420 2.700 7.585 1.536000e+12 7.056e+10
+ 12 6 5.000e+07 25.770 194.770 3.090 7.678 1.843200e+12 7.153e+10
+ 12 7 5.000e+07 29.940 227.290 3.390 7.705 2.150400e+12 7.182e+10
+ 12 8 5.000e+07 34.030 259.370 3.860 7.735 2.457600e+12 7.222e+10
+ 12 9 5.000e+07 38.070 291.890 4.310 7.780 2.764800e+12 7.262e+10
+ 12 10 5.000e+07 42.080 324.370 4.660 7.819 3.072000e+12 7.300e+10
+ 12 11 5.000e+07 45.950 356.370 5.000 7.864 3.379200e+12 7.354e+10
+ 12 12 5.000e+07 49.960 388.790 5.250 7.887 3.686400e+12 7.379e+10
+ 12 13 5.000e+07 54.010 422.050 5.420 7.915 3.993600e+12 7.394e+10
+ 12 14 5.000e+07 58.010 453.330 6.120 7.920 4.300800e+12 7.414e+10
+ 12 15 5.000e+07 62.080 485.830 6.310 7.928 4.608000e+12 7.423e+10
+ 12 16 5.000e+07 66.200 518.060 6.780 7.928 4.915200e+12 7.425e+10
+ 13 1 5.000e+07 5.630 35.420 1.300 6.522 3.328000e+11 5.911e+10
+ 13 2 5.000e+07 10.730 71.050 1.830 6.792 6.656000e+11 6.203e+10
+ 13 3 5.000e+07 14.690 105.710 2.160 7.343 9.984000e+11 6.796e+10
+ 13 4 5.000e+07 19.120 140.630 2.510 7.486 1.331200e+12 6.962e+10
+ 13 5 5.000e+07 23.600 175.730 3.000 7.573 1.664000e+12 7.051e+10
+ 13 6 5.000e+07 27.910 211.000 3.350 7.680 1.996800e+12 7.154e+10
+ 13 7 5.000e+07 32.370 246.320 3.860 7.729 2.329600e+12 7.197e+10
+ 13 8 5.000e+07 36.790 281.150 4.260 7.758 2.662400e+12 7.237e+10
+ 13 9 5.000e+07 41.080 316.080 4.520 7.804 2.995200e+12 7.291e+10
+ 13 10 5.000e+07 45.600 352.020 5.090 7.831 3.328000e+12 7.298e+10
+ 13 11 5.000e+07 49.760 386.130 5.470 7.870 3.660800e+12 7.357e+10
+ 13 12 5.000e+07 54.080 421.160 5.780 7.895 3.993600e+12 7.385e+10
+ 13 13 5.000e+07 58.520 455.980 6.170 7.897 4.326400e+12 7.393e+10
+ 13 14 5.000e+07 63.000 491.340 6.710 7.906 4.659200e+12 7.396e+10
+ 13 15 5.000e+07 67.250 525.920 6.920 7.923 4.992000e+12 7.423e+10
+ 13 16 5.000e+07 72.090 560.640 7.160 7.876 5.324800e+12 7.386e+10
+ 14 1 5.000e+07 5.670 38.290 1.330 6.988 3.584000e+11 6.321e+10
+ 14 2 5.000e+07 10.850 75.880 1.940 7.172 7.168000e+11 6.606e+10
+ 14 3 5.000e+07 15.840 114.160 2.400 7.359 1.075200e+12 6.788e+10
+ 14 4 5.000e+07 20.610 151.540 2.710 7.484 1.433600e+12 6.956e+10
+ 14 5 5.000e+07 25.330 189.160 3.320 7.599 1.792000e+12 7.075e+10
+ 14 6 5.000e+07 30.160 227.510 3.670 7.665 2.150400e+12 7.130e+10
+ 14 7 5.000e+07 34.730 265.020 3.960 7.745 2.508800e+12 7.224e+10
+ 14 8 5.000e+07 39.530 302.550 4.640 7.771 2.867200e+12 7.253e+10
+ 14 9 5.000e+07 44.220 340.330 5.180 7.813 3.225600e+12 7.294e+10
+ 14 10 5.000e+07 48.800 378.180 5.430 7.861 3.584000e+12 7.344e+10
+ 14 11 5.000e+07 53.550 415.790 5.800 7.873 3.942400e+12 7.362e+10
+ 14 12 5.000e+07 58.250 453.340 6.430 7.893 4.300800e+12 7.383e+10
+ 14 13 5.000e+07 63.150 492.200 6.960 7.904 4.659200e+12 7.378e+10
+ 14 14 5.000e+07 67.850 528.470 6.970 7.892 5.017600e+12 7.395e+10
+ 14 15 5.000e+07 72.510 566.950 7.720 7.925 5.376000e+12 7.414e+10
+ 14 16 5.000e+07 77.230 604.250 8.170 7.930 5.734400e+12 7.425e+10
+ 15 1 5.000e+07 5.800 41.070 1.460 7.333 3.840000e+11 6.621e+10
+ 15 2 5.000e+07 11.900 80.380 2.190 6.939 7.680000e+11 6.454e+10
+ 15 3 5.000e+07 16.990 121.790 2.610 7.322 1.152000e+12 6.780e+10
+ 15 4 5.000e+07 22.040 162.330 3.030 7.503 1.536000e+12 6.969e+10
+ 15 5 5.000e+07 27.120 202.750 3.460 7.604 1.920000e+12 7.080e+10
+ 15 6 5.000e+07 32.290 243.420 3.870 7.658 2.304000e+12 7.135e+10
+ 15 7 5.000e+07 37.450 284.300 4.410 7.709 2.688000e+12 7.178e+10
+ 15 8 5.000e+07 42.560 323.740 4.890 7.722 3.072000e+12 7.218e+10
+ 15 9 5.000e+07 47.440 364.880 5.330 7.804 3.456000e+12 7.285e+10
+ 15 10 5.000e+07 52.440 405.400 5.750 7.840 3.840000e+12 7.323e+10
+ 15 11 5.000e+07 57.270 445.500 6.070 7.885 4.224000e+12 7.376e+10
+ 15 12 5.000e+07 62.450 485.920 6.770 7.889 4.608000e+12 7.379e+10
+ 15 13 5.000e+07 67.680 527.540 7.440 7.905 4.992000e+12 7.376e+10
+ 15 14 5.000e+07 72.740 566.990 7.790 7.902 5.376000e+12 7.391e+10
+ 15 15 5.000e+07 77.760 607.620 8.060 7.918 5.760000e+12 7.407e+10
+ 15 16 5.000e+07 82.750 647.630 8.640 7.931 6.144000e+12 7.425e+10
+ 16 1 5.000e+07 6.310 43.540 1.790 7.184 4.096000e+11 6.491e+10
+ 16 2 5.000e+07 12.340 87.310 2.190 7.253 8.192000e+11 6.639e+10
+ 16 3 5.000e+07 17.930 130.440 2.830 7.433 1.228800e+12 6.853e+10
+ 16 4 5.000e+07 23.530 173.540 3.140 7.509 1.638400e+12 6.963e+10
+ 16 5 5.000e+07 28.910 216.290 3.710 7.610 2.048000e+12 7.084e+10
+ 16 6 5.000e+07 34.310 259.400 4.260 7.685 2.457600e+12 7.163e+10
+ 16 7 5.000e+07 39.790 302.740 4.620 7.725 2.867200e+12 7.206e+10
+ 16 8 5.000e+07 44.970 346.250 5.340 7.818 3.276800e+12 7.287e+10
+ 16 9 5.000e+07 50.470 388.870 5.910 7.822 3.686400e+12 7.304e+10
+ 16 10 5.000e+07 55.890 432.480 6.140 7.848 4.096000e+12 7.329e+10
+ 16 11 5.000e+07 61.250 475.380 6.770 7.872 4.505600e+12 7.356e+10
+ 16 12 5.000e+07 66.670 518.940 7.160 7.891 4.915200e+12 7.372e+10
+ 16 13 5.000e+07 72.160 562.230 7.890 7.901 5.324800e+12 7.379e+10
+ 16 14 5.000e+07 77.600 604.950 8.230 7.902 5.734400e+12 7.390e+10
+ 16 15 5.000e+07 82.970 648.420 8.690 7.920 6.144000e+12 7.405e+10
+ 16 16 5.000e+07 88.370 690.730 9.460 7.923 6.553600e+12 7.416e+10
diff --git a/gnuradio-core/src/examples/mp-sched/perf-data/js21-altivec.dat b/gnuradio-core/src/examples/mp-sched/perf-data/js21-altivec.dat
new file mode 100644
index 000000000..d0b8148f0
--- /dev/null
+++ b/gnuradio-core/src/examples/mp-sched/perf-data/js21-altivec.dat
@@ -0,0 +1,65 @@
+#D JS21 4-core PPC970M 2.5 GHz (using Altivec)
+ 1 1 9.766e+07 9.820 10.210 0.360 1.076 5.000000e+10 5.092e+09
+ 1 2 9.766e+07 10.620 19.890 0.640 1.933 1.000000e+11 9.416e+09
+ 1 3 9.766e+07 10.310 29.590 0.610 2.929 1.500000e+11 1.455e+10
+ 1 4 9.766e+07 10.440 39.290 0.680 3.829 2.000000e+11 1.916e+10
+ 1 5 7.812e+07 15.730 39.150 0.590 2.526 2.000000e+11 1.271e+10
+ 1 6 6.510e+07 13.100 39.080 0.590 3.028 2.000000e+11 1.527e+10
+ 1 7 5.580e+07 11.550 39.030 0.500 3.423 2.000000e+11 1.732e+10
+ 1 8 4.883e+07 10.410 39.010 0.510 3.796 2.000000e+11 1.921e+10
+ 2 1 9.766e+07 10.080 20.070 0.700 2.061 1.000000e+11 9.921e+09
+ 2 2 9.766e+07 11.360 39.650 0.960 3.575 2.000000e+11 1.761e+10
+ 2 3 6.510e+07 13.120 39.270 0.740 3.050 2.000000e+11 1.524e+10
+ 2 4 4.883e+07 10.410 39.110 0.650 3.819 2.000000e+11 1.921e+10
+ 2 5 3.906e+07 11.030 39.080 0.610 3.598 2.000000e+11 1.813e+10
+ 2 6 3.255e+07 10.640 39.020 0.560 3.720 2.000000e+11 1.880e+10
+ 2 7 2.790e+07 10.510 38.980 0.550 3.761 2.000000e+11 1.903e+10
+ 2 8 2.441e+07 10.440 38.970 0.570 3.787 2.000000e+11 1.916e+10
+ 3 1 9.766e+07 12.130 29.970 0.920 2.547 1.500000e+11 1.237e+10
+ 3 2 6.510e+07 13.100 39.300 0.920 3.070 2.000000e+11 1.527e+10
+ 3 3 4.340e+07 11.400 39.200 0.760 3.505 2.000000e+11 1.754e+10
+ 3 4 3.255e+07 10.730 39.100 0.690 3.708 2.000000e+11 1.864e+10
+ 3 5 2.604e+07 10.470 39.010 0.620 3.785 2.000000e+11 1.910e+10
+ 3 6 2.170e+07 10.380 39.010 0.620 3.818 2.000000e+11 1.927e+10
+ 3 7 1.860e+07 10.280 39.120 0.580 3.862 2.000000e+11 1.946e+10
+ 3 8 1.628e+07 10.230 39.000 0.600 3.871 2.000000e+11 1.955e+10
+ 4 1 9.766e+07 10.700 39.990 1.540 3.881 2.000000e+11 1.869e+10
+ 4 2 4.883e+07 10.530 39.260 0.940 3.818 2.000000e+11 1.899e+10
+ 4 3 3.255e+07 10.840 39.140 0.760 3.681 2.000000e+11 1.845e+10
+ 4 4 2.441e+07 10.530 39.040 0.680 3.772 2.000000e+11 1.899e+10
+ 4 5 1.953e+07 10.380 39.030 0.650 3.823 2.000000e+11 1.927e+10
+ 4 6 1.628e+07 10.310 39.020 0.650 3.848 2.000000e+11 1.940e+10
+ 4 7 1.395e+07 10.160 38.980 0.620 3.898 2.000000e+11 1.969e+10
+ 4 8 1.221e+07 10.150 38.990 0.580 3.899 2.000000e+11 1.970e+10
+ 5 1 7.812e+07 14.750 39.780 1.470 2.797 2.000000e+11 1.356e+10
+ 5 2 3.906e+07 11.350 39.240 0.950 3.541 2.000000e+11 1.762e+10
+ 5 3 2.604e+07 10.720 39.120 0.800 3.724 2.000000e+11 1.866e+10
+ 5 4 1.953e+07 10.440 39.060 0.730 3.811 2.000000e+11 1.916e+10
+ 5 5 1.562e+07 10.410 39.060 0.690 3.818 2.000000e+11 1.921e+10
+ 5 6 1.302e+07 10.260 38.970 0.650 3.862 2.000000e+11 1.949e+10
+ 5 7 1.116e+07 10.270 39.020 0.650 3.863 2.000000e+11 1.947e+10
+ 5 8 9.766e+06 10.130 39.010 0.660 3.916 2.000000e+11 1.974e+10
+ 6 1 6.510e+07 12.850 39.730 1.450 3.205 2.000000e+11 1.556e+10
+ 6 2 3.255e+07 10.700 39.300 0.990 3.765 2.000000e+11 1.869e+10
+ 6 3 2.170e+07 10.770 39.110 0.810 3.707 2.000000e+11 1.857e+10
+ 6 4 1.628e+07 10.570 39.090 0.750 3.769 2.000000e+11 1.892e+10
+ 6 5 1.302e+07 10.310 39.040 0.690 3.854 2.000000e+11 1.940e+10
+ 6 6 1.085e+07 10.260 39.030 0.700 3.872 2.000000e+11 1.949e+10
+ 6 7 9.301e+06 10.170 39.020 0.680 3.904 2.000000e+11 1.967e+10
+ 6 8 8.138e+06 10.150 39.020 0.670 3.910 2.000000e+11 1.970e+10
+ 7 1 5.580e+07 11.440 39.730 1.500 3.604 2.000000e+11 1.748e+10
+ 7 2 2.790e+07 10.950 39.260 0.990 3.676 2.000000e+11 1.826e+10
+ 7 3 1.860e+07 10.620 39.140 0.860 3.766 2.000000e+11 1.883e+10
+ 7 4 1.395e+07 10.420 39.070 0.750 3.821 2.000000e+11 1.919e+10
+ 7 5 1.116e+07 10.290 39.040 0.710 3.863 2.000000e+11 1.944e+10
+ 7 6 9.301e+06 10.200 39.040 0.720 3.898 2.000000e+11 1.961e+10
+ 7 7 7.972e+06 10.210 39.020 0.670 3.887 2.000000e+11 1.959e+10
+ 7 8 6.975e+06 10.160 39.020 0.650 3.905 2.000000e+11 1.969e+10
+ 8 1 4.883e+07 10.870 39.950 1.520 3.815 2.000000e+11 1.840e+10
+ 8 2 2.441e+07 10.690 39.270 1.000 3.767 2.000000e+11 1.871e+10
+ 8 3 1.628e+07 10.540 39.130 0.860 3.794 2.000000e+11 1.898e+10
+ 8 4 1.221e+07 10.410 39.110 0.790 3.833 2.000000e+11 1.921e+10
+ 8 5 9.766e+06 10.230 39.040 0.710 3.886 2.000000e+11 1.955e+10
+ 8 6 8.138e+06 10.260 39.050 0.700 3.874 2.000000e+11 1.949e+10
+ 8 7 6.975e+06 10.220 39.100 0.690 3.893 2.000000e+11 1.957e+10
+ 8 8 6.104e+06 10.170 39.020 0.650 3.901 2.000000e+11 1.967e+10
diff --git a/gnuradio-core/src/examples/mp-sched/perf-data/js21.dat b/gnuradio-core/src/examples/mp-sched/perf-data/js21.dat
new file mode 100644
index 000000000..a23bcebe7
--- /dev/null
+++ b/gnuradio-core/src/examples/mp-sched/perf-data/js21.dat
@@ -0,0 +1,65 @@
+#D JS21 4-core PPC970MP 2.5 GHz
+ 1 1 5.273e+07 10.050 10.180 0.290 1.042 2.700000e+10 2.687e+09
+ 1 2 5.273e+07 10.240 20.210 0.260 1.999 5.400000e+10 5.273e+09
+ 1 3 5.273e+07 10.300 30.090 0.340 2.954 8.100000e+10 7.864e+09
+ 1 4 5.273e+07 10.490 40.120 0.490 3.871 1.080000e+11 1.030e+10
+ 1 5 4.219e+07 16.010 39.900 0.380 2.516 1.080000e+11 6.746e+09
+ 1 6 3.516e+07 13.360 39.920 0.370 3.016 1.080000e+11 8.084e+09
+ 1 7 3.013e+07 11.510 39.900 0.330 3.495 1.080000e+11 9.383e+09
+ 1 8 2.637e+07 10.420 39.880 0.320 3.858 1.080000e+11 1.036e+10
+ 2 1 5.273e+07 10.370 20.340 0.470 2.007 5.400000e+10 5.207e+09
+ 2 2 5.273e+07 10.320 40.080 0.550 3.937 1.080000e+11 1.047e+10
+ 2 3 3.516e+07 13.340 39.990 0.470 3.033 1.080000e+11 8.096e+09
+ 2 4 2.637e+07 10.480 39.970 0.400 3.852 1.080000e+11 1.031e+10
+ 2 5 2.109e+07 10.910 39.920 0.390 3.695 1.080000e+11 9.899e+09
+ 2 6 1.758e+07 10.610 39.860 0.360 3.791 1.080000e+11 1.018e+10
+ 2 7 1.507e+07 10.520 39.890 0.360 3.826 1.080000e+11 1.027e+10
+ 2 8 1.318e+07 10.470 39.980 0.350 3.852 1.080000e+11 1.032e+10
+ 3 1 5.273e+07 10.230 30.320 0.600 3.022 8.100000e+10 7.918e+09
+ 3 2 3.516e+07 13.250 40.050 0.560 3.065 1.080000e+11 8.151e+09
+ 3 3 2.344e+07 11.160 40.010 0.470 3.627 1.080000e+11 9.677e+09
+ 3 4 1.758e+07 10.710 39.950 0.420 3.769 1.080000e+11 1.008e+10
+ 3 5 1.406e+07 10.520 39.920 0.400 3.833 1.080000e+11 1.027e+10
+ 3 6 1.172e+07 10.420 39.880 0.380 3.864 1.080000e+11 1.036e+10
+ 3 7 1.004e+07 10.340 39.880 0.370 3.893 1.080000e+11 1.044e+10
+ 3 8 8.789e+06 10.380 39.960 0.380 3.886 1.080000e+11 1.040e+10
+ 4 1 5.273e+07 10.570 40.390 0.890 3.905 1.080000e+11 1.022e+10
+ 4 2 2.637e+07 10.690 40.020 0.560 3.796 1.080000e+11 1.010e+10
+ 4 3 1.758e+07 10.790 39.980 0.480 3.750 1.080000e+11 1.001e+10
+ 4 4 1.318e+07 10.570 39.950 0.430 3.820 1.080000e+11 1.022e+10
+ 4 5 1.055e+07 10.440 39.950 0.420 3.867 1.080000e+11 1.034e+10
+ 4 6 8.789e+06 10.340 39.900 0.420 3.899 1.080000e+11 1.044e+10
+ 4 7 7.533e+06 10.290 39.870 0.410 3.914 1.080000e+11 1.050e+10
+ 4 8 6.592e+06 10.270 39.950 0.390 3.928 1.080000e+11 1.052e+10
+ 5 1 4.219e+07 15.110 40.290 0.830 2.721 1.080000e+11 7.148e+09
+ 5 2 2.109e+07 11.240 40.000 0.580 3.610 1.080000e+11 9.609e+09
+ 5 3 1.406e+07 10.710 39.970 0.490 3.778 1.080000e+11 1.008e+10
+ 5 4 1.055e+07 10.490 39.980 0.460 3.855 1.080000e+11 1.030e+10
+ 5 5 8.438e+06 10.430 39.940 0.440 3.872 1.080000e+11 1.035e+10
+ 5 6 7.031e+06 10.280 39.890 0.420 3.921 1.080000e+11 1.051e+10
+ 5 7 6.027e+06 10.290 39.870 0.400 3.914 1.080000e+11 1.050e+10
+ 5 8 5.273e+06 10.290 39.940 0.400 3.920 1.080000e+11 1.050e+10
+ 6 1 3.516e+07 12.880 40.250 0.850 3.191 1.080000e+11 8.385e+09
+ 6 2 1.758e+07 10.730 39.980 0.580 3.780 1.080000e+11 1.007e+10
+ 6 3 1.172e+07 10.740 39.980 0.490 3.768 1.080000e+11 1.006e+10
+ 6 4 8.789e+06 10.510 39.940 0.460 3.844 1.080000e+11 1.028e+10
+ 6 5 7.031e+06 10.430 39.920 0.450 3.871 1.080000e+11 1.035e+10
+ 6 6 5.859e+06 10.300 39.910 0.430 3.917 1.080000e+11 1.049e+10
+ 6 7 5.022e+06 10.290 39.870 0.420 3.915 1.080000e+11 1.050e+10
+ 6 8 4.395e+06 10.300 39.950 0.420 3.919 1.080000e+11 1.049e+10
+ 7 1 3.013e+07 11.240 40.270 0.860 3.659 1.080000e+11 9.609e+09
+ 7 2 1.507e+07 11.040 40.000 0.590 3.677 1.080000e+11 9.783e+09
+ 7 3 1.004e+07 10.660 39.970 0.520 3.798 1.080000e+11 1.013e+10
+ 7 4 7.533e+06 10.430 39.930 0.470 3.873 1.080000e+11 1.035e+10
+ 7 5 6.027e+06 10.390 39.920 0.470 3.887 1.080000e+11 1.039e+10
+ 7 6 5.022e+06 10.320 39.910 0.430 3.909 1.080000e+11 1.047e+10
+ 7 7 4.305e+06 10.330 39.890 0.420 3.902 1.080000e+11 1.045e+10
+ 7 8 3.767e+06 10.300 39.930 0.420 3.917 1.080000e+11 1.049e+10
+ 8 1 2.637e+07 10.530 40.290 0.910 3.913 1.080000e+11 1.026e+10
+ 8 2 1.318e+07 10.850 40.040 0.610 3.747 1.080000e+11 9.954e+09
+ 8 3 8.789e+06 10.500 39.960 0.540 3.857 1.080000e+11 1.029e+10
+ 8 4 6.592e+06 10.490 39.960 0.500 3.857 1.080000e+11 1.030e+10
+ 8 5 5.273e+06 10.330 39.930 0.480 3.912 1.080000e+11 1.045e+10
+ 8 6 4.395e+06 10.340 39.900 0.450 3.902 1.080000e+11 1.044e+10
+ 8 7 3.767e+06 10.260 39.900 0.430 3.931 1.080000e+11 1.053e+10
+ 8 8 3.296e+06 10.250 39.960 0.430 3.940 1.080000e+11 1.054e+10
diff --git a/gnuradio-core/src/examples/mp-sched/perf-data/ps3-altivec.dat b/gnuradio-core/src/examples/mp-sched/perf-data/ps3-altivec.dat
new file mode 100644
index 000000000..dd01b31bd
--- /dev/null
+++ b/gnuradio-core/src/examples/mp-sched/perf-data/ps3-altivec.dat
@@ -0,0 +1,65 @@
+#D Playstation 3 (using Altivec)
+ 1 1 3.906e+07 10.500 10.580 0.440 1.050 2.000000e+10 1.905e+09
+ 1 2 1.953e+07 7.010 13.200 0.400 1.940 2.000000e+10 2.853e+09
+ 1 3 1.302e+07 7.540 13.140 0.380 1.793 2.000000e+10 2.653e+09
+ 1 4 9.766e+06 7.200 13.620 0.370 1.943 2.000000e+10 2.778e+09
+ 1 5 7.812e+06 7.170 13.670 0.340 1.954 2.000000e+10 2.789e+09
+ 1 6 6.510e+06 7.010 13.590 0.320 1.984 2.000000e+10 2.853e+09
+ 1 7 5.580e+06 6.990 13.530 0.330 1.983 2.000000e+10 2.861e+09
+ 1 8 4.883e+06 6.980 13.490 0.320 1.979 2.000000e+10 2.865e+09
+ 2 1 1.953e+07 8.110 14.730 0.530 1.882 2.000000e+10 2.466e+09
+ 2 2 9.766e+06 7.090 13.570 0.420 1.973 2.000000e+10 2.821e+09
+ 2 3 6.510e+06 7.040 13.590 0.410 1.989 2.000000e+10 2.841e+09
+ 2 4 4.883e+06 6.990 13.490 0.370 1.983 2.000000e+10 2.861e+09
+ 2 5 3.906e+06 6.970 13.480 0.360 1.986 2.000000e+10 2.869e+09
+ 2 6 3.255e+06 6.990 13.530 0.370 1.989 2.000000e+10 2.861e+09
+ 2 7 2.790e+06 6.890 13.390 0.350 1.994 2.000000e+10 2.903e+09
+ 2 8 2.441e+06 6.880 13.380 0.350 1.996 2.000000e+10 2.907e+09
+ 3 1 1.302e+07 8.220 13.720 0.510 1.731 2.000000e+10 2.433e+09
+ 3 2 6.510e+06 7.050 13.480 0.450 1.976 2.000000e+10 2.837e+09
+ 3 3 4.340e+06 6.990 13.460 0.400 1.983 2.000000e+10 2.861e+09
+ 3 4 3.255e+06 6.990 13.550 0.380 1.993 2.000000e+10 2.861e+09
+ 3 5 2.604e+06 6.920 13.430 0.360 1.993 1.999999e+10 2.890e+09
+ 3 6 2.170e+06 6.940 13.460 0.360 1.991 1.999999e+10 2.882e+09
+ 3 7 1.860e+06 6.920 13.440 0.360 1.994 2.000000e+10 2.890e+09
+ 3 8 1.628e+06 6.890 13.380 0.350 1.993 2.000000e+10 2.903e+09
+ 4 1 9.766e+06 7.620 14.550 0.590 1.987 2.000000e+10 2.625e+09
+ 4 2 4.883e+06 7.010 13.460 0.440 1.983 2.000000e+10 2.853e+09
+ 4 3 3.255e+06 7.040 13.580 0.410 1.987 2.000000e+10 2.841e+09
+ 4 4 2.441e+06 6.960 13.470 0.390 1.991 2.000000e+10 2.874e+09
+ 4 5 1.953e+06 6.920 13.410 0.370 1.991 2.000000e+10 2.890e+09
+ 4 6 1.628e+06 6.950 13.490 0.370 1.994 2.000000e+10 2.878e+09
+ 4 7 1.395e+06 6.890 13.350 0.370 1.991 2.000000e+10 2.903e+09
+ 4 8 1.221e+06 6.940 13.490 0.360 1.996 2.000000e+10 2.882e+09
+ 5 1 7.812e+06 7.680 14.000 0.560 1.896 2.000000e+10 2.604e+09
+ 5 2 3.906e+06 7.070 13.460 0.460 1.969 2.000000e+10 2.829e+09
+ 5 3 2.604e+06 6.990 13.430 0.420 1.981 1.999999e+10 2.861e+09
+ 5 4 1.953e+06 7.010 13.550 0.390 1.989 2.000000e+10 2.853e+09
+ 5 5 1.562e+06 6.920 13.430 0.380 1.996 2.000000e+10 2.890e+09
+ 5 6 1.302e+06 6.920 13.410 0.380 1.993 1.999999e+10 2.890e+09
+ 5 7 1.116e+06 6.920 13.420 0.370 1.993 1.999999e+10 2.890e+09
+ 5 8 9.766e+05 6.910 13.360 0.370 1.987 1.999999e+10 2.894e+09
+ 6 1 6.510e+06 7.350 13.970 0.630 1.986 2.000000e+10 2.721e+09
+ 6 2 3.255e+06 7.040 13.470 0.470 1.980 2.000000e+10 2.841e+09
+ 6 3 2.170e+06 7.050 13.600 0.420 1.989 1.999999e+10 2.837e+09
+ 6 4 1.628e+06 6.970 13.480 0.400 1.991 2.000000e+10 2.869e+09
+ 6 5 1.302e+06 6.990 13.540 0.390 1.993 1.999999e+10 2.861e+09
+ 6 6 1.085e+06 6.970 13.470 0.380 1.987 1.999999e+10 2.869e+09
+ 6 7 9.301e+05 6.890 13.350 0.380 1.993 1.999999e+10 2.903e+09
+ 6 8 8.138e+05 6.920 13.420 0.370 1.993 2.000000e+10 2.890e+09
+ 7 1 5.580e+06 7.530 14.030 0.580 1.940 2.000000e+10 2.656e+09
+ 7 2 2.790e+06 7.000 13.370 0.460 1.976 2.000000e+10 2.857e+09
+ 7 3 1.860e+06 7.000 13.520 0.420 1.991 2.000000e+10 2.857e+09
+ 7 4 1.395e+06 7.060 13.590 0.410 1.983 2.000000e+10 2.833e+09
+ 7 5 1.116e+06 6.950 13.460 0.390 1.993 1.999999e+10 2.878e+09
+ 7 6 9.301e+05 6.950 13.420 0.380 1.986 1.999999e+10 2.878e+09
+ 7 7 7.972e+05 6.880 13.300 0.380 1.988 1.999998e+10 2.907e+09
+ 7 8 6.975e+05 6.920 13.390 0.380 1.990 1.999998e+10 2.890e+09
+ 8 1 4.883e+06 7.440 14.150 0.620 1.985 2.000000e+10 2.688e+09
+ 8 2 2.441e+06 6.990 13.400 0.480 1.986 2.000000e+10 2.861e+09
+ 8 3 1.628e+06 6.990 13.460 0.430 1.987 2.000000e+10 2.861e+09
+ 8 4 1.221e+06 7.020 13.550 0.410 1.989 2.000000e+10 2.849e+09
+ 8 5 9.766e+05 6.920 13.370 0.390 1.988 1.999999e+10 2.890e+09
+ 8 6 8.138e+05 6.950 13.400 0.390 1.984 2.000000e+10 2.878e+09
+ 8 7 6.975e+05 6.930 13.360 0.390 1.984 1.999998e+10 2.886e+09
+ 8 8 6.104e+05 6.920 13.390 0.380 1.990 1.999998e+10 2.890e+09
diff --git a/gnuradio-core/src/examples/mp-sched/perf-data/ps3.dat b/gnuradio-core/src/examples/mp-sched/perf-data/ps3.dat
new file mode 100644
index 000000000..c9bac37cc
--- /dev/null
+++ b/gnuradio-core/src/examples/mp-sched/perf-data/ps3.dat
@@ -0,0 +1,65 @@
+#D Playstation 3
+ 1 1 2.344e+07 9.970 9.960 0.280 1.027 1.200000e+10 1.204e+09
+ 1 2 1.172e+07 12.590 24.430 0.400 1.972 1.200000e+10 9.531e+08
+ 1 3 7.812e+06 12.200 22.790 0.360 1.898 1.200000e+10 9.836e+08
+ 1 4 5.859e+06 12.450 24.440 0.360 1.992 1.200000e+10 9.639e+08
+ 1 5 4.688e+06 12.390 24.100 0.360 1.974 1.200000e+10 9.685e+08
+ 1 6 3.906e+06 12.360 24.200 0.370 1.988 1.200000e+10 9.709e+08
+ 1 7 3.348e+06 12.460 24.390 0.360 1.986 1.200000e+10 9.631e+08
+ 1 8 2.930e+06 12.440 24.400 0.360 1.990 1.200000e+10 9.646e+08
+ 2 1 1.172e+07 12.580 24.660 0.490 1.999 1.200000e+10 9.539e+08
+ 2 2 5.859e+06 12.480 24.290 0.420 1.980 1.200000e+10 9.615e+08
+ 2 3 3.906e+06 12.500 24.500 0.400 1.992 1.200000e+10 9.600e+08
+ 2 4 2.930e+06 12.440 24.400 0.390 1.993 1.200000e+10 9.646e+08
+ 2 5 2.344e+06 12.500 24.510 0.380 1.991 1.200000e+10 9.600e+08
+ 2 6 1.953e+06 12.450 24.480 0.380 1.997 1.200000e+10 9.639e+08
+ 2 7 1.674e+06 12.450 24.430 0.380 1.993 1.200000e+10 9.639e+08
+ 2 8 1.465e+06 12.430 24.450 0.380 1.998 1.199999e+10 9.654e+08
+ 3 1 7.812e+06 12.280 23.600 0.460 1.959 1.200000e+10 9.772e+08
+ 3 2 3.906e+06 12.690 24.760 0.430 1.985 1.200000e+10 9.456e+08
+ 3 3 2.604e+06 12.610 24.700 0.410 1.991 1.200000e+10 9.516e+08
+ 3 4 1.953e+06 12.440 24.410 0.400 1.994 1.200000e+10 9.646e+08
+ 3 5 1.562e+06 12.400 24.370 0.380 1.996 1.200000e+10 9.677e+08
+ 3 6 1.302e+06 12.440 24.450 0.380 1.996 1.200000e+10 9.646e+08
+ 3 7 1.116e+06 12.470 24.470 0.380 1.993 1.200000e+10 9.623e+08
+ 3 8 9.766e+05 12.440 24.440 0.380 1.995 1.199999e+10 9.646e+08
+ 4 1 5.859e+06 12.670 24.710 0.500 1.990 1.200000e+10 9.471e+08
+ 4 2 2.930e+06 12.600 24.600 0.440 1.987 1.200000e+10 9.524e+08
+ 4 3 1.953e+06 12.490 24.480 0.410 1.993 1.200000e+10 9.608e+08
+ 4 4 1.465e+06 12.400 24.340 0.400 1.995 1.199999e+10 9.677e+08
+ 4 5 1.172e+06 12.440 24.410 0.390 1.994 1.200000e+10 9.646e+08
+ 4 6 9.766e+05 12.440 24.440 0.390 1.996 1.199999e+10 9.646e+08
+ 4 7 8.371e+05 12.450 24.420 0.390 1.993 1.199999e+10 9.639e+08
+ 4 8 7.324e+05 12.370 24.310 0.380 1.996 1.199999e+10 9.701e+08
+ 5 1 4.688e+06 12.890 24.790 0.500 1.962 1.200000e+10 9.310e+08
+ 5 2 2.344e+06 12.620 24.680 0.450 1.991 1.200000e+10 9.509e+08
+ 5 3 1.562e+06 12.430 24.360 0.410 1.993 1.200000e+10 9.654e+08
+ 5 4 1.172e+06 12.420 24.390 0.410 1.997 1.200000e+10 9.662e+08
+ 5 5 9.375e+05 12.430 24.380 0.400 1.994 1.200000e+10 9.654e+08
+ 5 6 7.812e+05 12.400 24.340 0.400 1.995 1.200000e+10 9.677e+08
+ 5 7 6.696e+05 12.360 24.290 0.390 1.997 1.199998e+10 9.709e+08
+ 5 8 5.859e+05 12.420 24.370 0.390 1.994 1.199999e+10 9.662e+08
+ 6 1 3.906e+06 12.990 25.320 0.560 1.992 1.200000e+10 9.238e+08
+ 6 2 1.953e+06 12.610 24.550 0.440 1.982 1.200000e+10 9.516e+08
+ 6 3 1.302e+06 12.520 24.310 0.420 1.975 1.200000e+10 9.585e+08
+ 6 4 9.766e+05 12.460 24.310 0.420 1.985 1.199999e+10 9.631e+08
+ 6 5 7.812e+05 12.440 24.240 0.410 1.982 1.200000e+10 9.646e+08
+ 6 6 6.510e+05 12.430 24.170 0.410 1.977 1.199999e+10 9.654e+08
+ 6 7 5.580e+05 12.450 24.230 0.410 1.979 1.199998e+10 9.639e+08
+ 6 8 4.883e+05 12.490 24.190 0.420 1.970 1.199999e+10 9.608e+08
+ 7 1 3.348e+06 13.150 24.280 0.500 1.884 1.200000e+10 9.125e+08
+ 7 2 1.674e+06 12.480 24.170 0.430 1.971 1.200000e+10 9.615e+08
+ 7 3 1.116e+06 12.480 24.430 0.440 1.993 1.200000e+10 9.615e+08
+ 7 4 8.371e+05 12.380 24.270 0.420 1.994 1.199999e+10 9.693e+08
+ 7 5 6.696e+05 12.390 24.290 0.430 1.995 1.199998e+10 9.685e+08
+ 7 6 5.580e+05 12.430 24.300 0.430 1.990 1.199998e+10 9.654e+08
+ 7 7 4.783e+05 12.460 24.360 0.430 1.990 1.199999e+10 9.631e+08
+ 7 8 4.185e+05 12.460 24.340 0.430 1.988 1.199998e+10 9.631e+08
+ 8 1 2.930e+06 12.960 24.600 0.530 1.939 1.200000e+10 9.259e+08
+ 8 2 1.465e+06 12.580 24.240 0.440 1.962 1.199999e+10 9.539e+08
+ 8 3 9.766e+05 12.520 24.060 0.430 1.956 1.199999e+10 9.585e+08
+ 8 4 7.324e+05 12.420 24.200 0.410 1.981 1.199999e+10 9.662e+08
+ 8 5 5.859e+05 12.430 24.310 0.430 1.990 1.199999e+10 9.654e+08
+ 8 6 4.883e+05 12.430 24.130 0.420 1.975 1.199999e+10 9.654e+08
+ 8 7 4.185e+05 12.800 24.220 0.490 1.930 1.199998e+10 9.375e+08
+ 8 8 3.662e+05 12.460 24.340 0.430 1.988 1.199997e+10 9.631e+08
diff --git a/gnuradio-core/src/examples/mp-sched/perf-data/qs21-altivec.dat b/gnuradio-core/src/examples/mp-sched/perf-data/qs21-altivec.dat
new file mode 100644
index 000000000..8364be363
--- /dev/null
+++ b/gnuradio-core/src/examples/mp-sched/perf-data/qs21-altivec.dat
@@ -0,0 +1,65 @@
+#D QS21 dual cell 3.2 GHz (using Altivec)
+ 1 1 3.516e+07 9.810 10.240 0.430 1.088 1.800000e+10 1.835e+09
+ 1 2 3.516e+07 11.650 22.840 0.750 2.025 3.600000e+10 3.090e+09
+ 1 3 2.344e+07 9.400 24.860 0.680 2.717 3.600000e+10 3.830e+09
+ 1 4 1.758e+07 7.800 26.820 0.740 3.533 3.600000e+10 4.615e+09
+ 1 5 1.406e+07 8.810 25.970 0.760 3.034 3.600000e+10 4.086e+09
+ 1 6 1.172e+07 8.110 25.710 0.740 3.261 3.600000e+10 4.439e+09
+ 1 7 1.004e+07 7.750 26.020 0.710 3.449 3.600000e+10 4.645e+09
+ 1 8 8.789e+06 7.290 26.600 0.690 3.743 3.600000e+10 4.938e+09
+ 2 1 3.516e+07 10.130 20.690 0.770 2.118 3.600000e+10 3.554e+09
+ 2 2 1.758e+07 7.240 26.820 0.920 3.831 3.600000e+10 4.972e+09
+ 2 3 1.172e+07 8.090 26.670 0.840 3.400 3.600000e+10 4.450e+09
+ 2 4 8.789e+06 7.480 27.010 0.790 3.717 3.600000e+10 4.813e+09
+ 2 5 7.031e+06 7.180 26.530 0.740 3.798 3.600000e+10 5.014e+09
+ 2 6 5.859e+06 7.060 26.590 0.730 3.870 3.600000e+10 5.099e+09
+ 2 7 5.022e+06 7.040 26.610 0.740 3.885 3.600000e+10 5.114e+09
+ 2 8 4.395e+06 7.090 27.020 0.730 3.914 3.600000e+10 5.078e+09
+ 3 1 2.344e+07 9.670 25.850 1.020 2.779 3.600000e+10 3.723e+09
+ 3 2 1.172e+07 7.700 25.940 0.930 3.490 3.600000e+10 4.675e+09
+ 3 3 7.812e+06 7.290 26.760 0.830 3.785 3.600000e+10 4.938e+09
+ 3 4 5.859e+06 7.210 26.900 0.800 3.842 3.600000e+10 4.993e+09
+ 3 5 4.688e+06 7.060 26.690 0.770 3.890 3.600000e+10 5.099e+09
+ 3 6 3.906e+06 7.060 26.830 0.810 3.915 3.600000e+10 5.099e+09
+ 3 7 3.348e+06 6.960 26.680 0.780 3.945 3.600000e+10 5.172e+09
+ 3 8 2.930e+06 6.960 26.600 0.770 3.932 3.599999e+10 5.172e+09
+ 4 1 1.758e+07 7.640 28.700 1.250 3.920 3.600000e+10 4.712e+09
+ 4 2 8.789e+06 7.230 26.640 0.940 3.815 3.600000e+10 4.979e+09
+ 4 3 5.859e+06 7.200 26.800 0.860 3.842 3.600000e+10 5.000e+09
+ 4 4 4.395e+06 7.110 26.900 0.840 3.902 3.600000e+10 5.063e+09
+ 4 5 3.516e+06 7.020 26.680 0.800 3.915 3.600000e+10 5.128e+09
+ 4 6 2.930e+06 6.950 26.700 0.800 3.957 3.599999e+10 5.180e+09
+ 4 7 2.511e+06 6.930 26.590 0.800 3.952 3.599999e+10 5.195e+09
+ 4 8 2.197e+06 6.960 26.570 0.790 3.931 3.599999e+10 5.172e+09
+ 5 1 1.406e+07 8.730 26.540 1.190 3.176 3.600000e+10 4.124e+09
+ 5 2 7.031e+06 7.270 26.450 0.960 3.770 3.600000e+10 4.952e+09
+ 5 3 4.688e+06 7.100 26.630 0.880 3.875 3.600000e+10 5.070e+09
+ 5 4 3.516e+06 7.050 26.700 0.850 3.908 3.600000e+10 5.106e+09
+ 5 5 2.812e+06 6.970 26.610 0.830 3.937 3.600000e+10 5.165e+09
+ 5 6 2.344e+06 6.980 26.710 0.840 3.947 3.600000e+10 5.158e+09
+ 5 7 2.009e+06 6.900 26.470 0.800 3.952 3.599999e+10 5.217e+09
+ 5 8 1.758e+06 6.940 26.580 0.820 3.948 3.599999e+10 5.187e+09
+ 6 1 1.172e+07 8.200 26.510 1.190 3.378 3.600000e+10 4.390e+09
+ 6 2 5.859e+06 7.210 26.590 0.970 3.822 3.600000e+10 4.993e+09
+ 6 3 3.906e+06 7.070 26.580 0.910 3.888 3.600000e+10 5.092e+09
+ 6 4 2.930e+06 7.090 26.750 0.860 3.894 3.599999e+10 5.078e+09
+ 6 5 2.344e+06 7.040 26.830 0.830 3.929 3.600000e+10 5.114e+09
+ 6 6 1.953e+06 6.960 26.600 0.830 3.941 3.600000e+10 5.172e+09
+ 6 7 1.674e+06 6.940 26.500 0.810 3.935 3.600000e+10 5.187e+09
+ 6 8 1.465e+06 6.940 26.540 0.830 3.944 3.599998e+10 5.187e+09
+ 7 1 1.004e+07 7.730 26.940 1.190 3.639 3.600000e+10 4.657e+09
+ 7 2 5.022e+06 7.240 26.600 0.980 3.809 3.600000e+10 4.972e+09
+ 7 3 3.348e+06 7.120 26.680 0.930 3.878 3.600000e+10 5.056e+09
+ 7 4 2.511e+06 7.070 26.840 0.890 3.922 3.599999e+10 5.092e+09
+ 7 5 2.009e+06 6.980 26.570 0.850 3.928 3.599999e+10 5.158e+09
+ 7 6 1.674e+06 6.950 26.530 0.840 3.938 3.600000e+10 5.180e+09
+ 7 7 1.435e+06 6.940 26.570 0.860 3.952 3.599998e+10 5.187e+09
+ 7 8 1.256e+06 6.980 26.590 0.840 3.930 3.599999e+10 5.158e+09
+ 8 1 8.789e+06 7.570 27.360 1.260 3.781 3.600000e+10 4.756e+09
+ 8 2 4.395e+06 7.130 26.460 0.980 3.849 3.600000e+10 5.049e+09
+ 8 3 2.930e+06 7.060 26.680 0.920 3.909 3.599999e+10 5.099e+09
+ 8 4 2.197e+06 7.040 26.670 0.880 3.913 3.599999e+10 5.114e+09
+ 8 5 1.758e+06 6.970 26.600 0.860 3.940 3.599999e+10 5.165e+09
+ 8 6 1.465e+06 6.940 26.490 0.840 3.938 3.599998e+10 5.187e+09
+ 8 7 1.256e+06 6.980 26.630 0.850 3.937 3.599999e+10 5.158e+09
+ 8 8 1.099e+06 7.010 26.820 0.860 3.949 3.599997e+10 5.136e+09
diff --git a/gnuradio-core/src/examples/mp-sched/perf-data/qs21.dat b/gnuradio-core/src/examples/mp-sched/perf-data/qs21.dat
new file mode 100644
index 000000000..cc628740a
--- /dev/null
+++ b/gnuradio-core/src/examples/mp-sched/perf-data/qs21.dat
@@ -0,0 +1,65 @@
+#D QS21 dual cell 3.2 GHz
+ 1 1 1.953e+07 8.480 8.730 0.270 1.061 1.000000e+10 1.179e+09
+ 1 2 1.953e+07 8.750 17.210 0.460 2.019 2.000000e+10 2.286e+09
+ 1 3 1.302e+07 12.390 29.530 0.540 2.427 2.000000e+10 1.614e+09
+ 1 4 9.766e+06 10.120 31.500 0.590 3.171 2.000000e+10 1.976e+09
+ 1 5 7.812e+06 10.200 31.350 0.610 3.133 2.000000e+10 1.961e+09
+ 1 6 6.510e+06 9.520 31.690 0.590 3.391 2.000000e+10 2.101e+09
+ 1 7 5.580e+06 9.430 32.610 0.600 3.522 2.000000e+10 2.121e+09
+ 1 8 4.883e+06 9.400 34.160 0.620 3.700 2.000000e+10 2.128e+09
+ 2 1 1.953e+07 8.800 17.750 0.500 2.074 2.000000e+10 2.273e+09
+ 2 2 9.766e+06 8.990 28.900 0.640 3.286 2.000000e+10 2.225e+09
+ 2 3 6.510e+06 9.390 32.450 0.660 3.526 2.000000e+10 2.130e+09
+ 2 4 4.883e+06 9.220 34.450 0.660 3.808 2.000000e+10 2.169e+09
+ 2 5 3.906e+06 9.180 34.730 0.650 3.854 2.000000e+10 2.179e+09
+ 2 6 3.255e+06 9.150 34.960 0.650 3.892 2.000000e+10 2.186e+09
+ 2 7 2.790e+06 9.140 35.290 0.650 3.932 2.000000e+10 2.188e+09
+ 2 8 2.441e+06 9.080 35.240 0.650 3.953 2.000000e+10 2.203e+09
+ 3 1 1.302e+07 11.720 28.890 0.740 2.528 2.000000e+10 1.706e+09
+ 3 2 6.510e+06 9.390 32.700 0.730 3.560 2.000000e+10 2.130e+09
+ 3 3 4.340e+06 9.150 33.930 0.690 3.784 2.000000e+10 2.186e+09
+ 3 4 3.255e+06 9.040 34.650 0.680 3.908 2.000000e+10 2.212e+09
+ 3 5 2.604e+06 9.090 34.990 0.680 3.924 1.999999e+10 2.200e+09
+ 3 6 2.170e+06 9.050 34.870 0.670 3.927 1.999999e+10 2.210e+09
+ 3 7 1.860e+06 9.010 34.850 0.660 3.941 2.000000e+10 2.220e+09
+ 3 8 1.628e+06 8.980 34.860 0.670 3.957 2.000000e+10 2.227e+09
+ 4 1 9.766e+06 9.000 34.680 0.940 3.958 2.000000e+10 2.222e+09
+ 4 2 4.883e+06 9.020 34.180 0.740 3.871 2.000000e+10 2.217e+09
+ 4 3 3.255e+06 9.150 34.640 0.710 3.863 2.000000e+10 2.186e+09
+ 4 4 2.441e+06 9.010 34.780 0.690 3.937 2.000000e+10 2.220e+09
+ 4 5 1.953e+06 8.980 34.680 0.690 3.939 2.000000e+10 2.227e+09
+ 4 6 1.628e+06 9.050 35.120 0.690 3.957 2.000000e+10 2.210e+09
+ 4 7 1.395e+06 9.010 34.900 0.670 3.948 2.000000e+10 2.220e+09
+ 4 8 1.221e+06 8.960 34.900 0.680 3.971 2.000000e+10 2.232e+09
+ 5 1 7.812e+06 10.150 31.760 0.840 3.212 2.000000e+10 1.970e+09
+ 5 2 3.906e+06 9.090 34.040 0.750 3.827 2.000000e+10 2.200e+09
+ 5 3 2.604e+06 9.030 34.650 0.720 3.917 1.999999e+10 2.215e+09
+ 5 4 1.953e+06 8.990 34.610 0.700 3.928 2.000000e+10 2.225e+09
+ 5 5 1.562e+06 9.000 34.920 0.700 3.958 2.000000e+10 2.222e+09
+ 5 6 1.302e+06 9.120 35.370 0.690 3.954 1.999999e+10 2.193e+09
+ 5 7 1.116e+06 8.910 34.680 0.690 3.970 1.999999e+10 2.245e+09
+ 5 8 9.766e+05 8.930 34.790 0.680 3.972 1.999999e+10 2.240e+09
+ 6 1 6.510e+06 9.390 31.810 0.840 3.477 2.000000e+10 2.130e+09
+ 6 2 3.255e+06 9.000 34.320 0.760 3.898 2.000000e+10 2.222e+09
+ 6 3 2.170e+06 8.960 34.310 0.740 3.912 1.999999e+10 2.232e+09
+ 6 4 1.628e+06 8.970 34.640 0.730 3.943 2.000000e+10 2.230e+09
+ 6 5 1.302e+06 9.110 35.360 0.710 3.959 1.999999e+10 2.195e+09
+ 6 6 1.085e+06 8.970 34.750 0.710 3.953 1.999999e+10 2.230e+09
+ 6 7 9.301e+05 8.950 34.710 0.700 3.956 1.999999e+10 2.235e+09
+ 6 8 8.138e+05 8.920 34.570 0.710 3.955 2.000000e+10 2.242e+09
+ 7 1 5.580e+06 9.290 32.840 0.870 3.629 2.000000e+10 2.153e+09
+ 7 2 2.790e+06 9.040 34.400 0.770 3.890 2.000000e+10 2.212e+09
+ 7 3 1.860e+06 8.940 34.380 0.740 3.928 2.000000e+10 2.237e+09
+ 7 4 1.395e+06 8.990 34.820 0.730 3.954 2.000000e+10 2.225e+09
+ 7 5 1.116e+06 8.990 34.820 0.720 3.953 1.999999e+10 2.225e+09
+ 7 6 9.301e+05 8.940 34.720 0.720 3.964 1.999999e+10 2.237e+09
+ 7 7 7.972e+05 8.930 34.700 0.710 3.965 1.999998e+10 2.240e+09
+ 7 8 6.975e+05 8.910 34.510 0.700 3.952 1.999998e+10 2.245e+09
+ 8 1 4.883e+06 9.070 33.770 0.910 3.824 2.000000e+10 2.205e+09
+ 8 2 2.441e+06 9.000 34.340 0.780 3.902 2.000000e+10 2.222e+09
+ 8 3 1.628e+06 8.990 34.510 0.740 3.921 2.000000e+10 2.225e+09
+ 8 4 1.221e+06 8.980 34.650 0.740 3.941 2.000000e+10 2.227e+09
+ 8 5 9.766e+05 8.960 34.700 0.720 3.953 1.999999e+10 2.232e+09
+ 8 6 8.138e+05 8.920 34.680 0.710 3.967 2.000000e+10 2.242e+09
+ 8 7 6.975e+05 8.900 34.580 0.720 3.966 1.999998e+10 2.247e+09
+ 8 8 6.104e+05 8.930 34.590 0.710 3.953 1.999998e+10 2.240e+09
diff --git a/gnuradio-core/src/examples/mp-sched/plot_flops.py b/gnuradio-core/src/examples/mp-sched/plot_flops.py
new file mode 100755
index 000000000..d9d810ae2
--- /dev/null
+++ b/gnuradio-core/src/examples/mp-sched/plot_flops.py
@@ -0,0 +1,98 @@
+#!/usr/bin/env python
+#
+# 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 this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+
+"""
+Reads output from run_synthetic.py and runs gnuplot showing
+GFLOPS as f(npipes, nstages)
+"""
+
+import re
+import sys
+import os
+import tempfile
+from optparse import OptionParser
+
+
+def parse_file(input_filename, output):
+ last = None
+ desc = ''
+ for line in open(input_filename, 'r'):
+ s = line.strip()
+ if s.startswith('>>>'): # ignore ">>> using SSE cruft"
+ continue
+
+ if s.startswith('#D'): # machine description
+ desc = s[2:].strip()
+ continue
+
+ fields = s.split()
+ npipes, nstages, flops = fields[0], fields[1], fields[8]
+
+ if last is not None and npipes != last:
+ output.write('\n')
+ last = npipes
+
+ output.write(' '.join((npipes, nstages, flops)))
+ output.write('\n')
+
+ output.flush()
+ return desc
+
+
+def handle_file(input_filename):
+ cmd_file = tempfile.NamedTemporaryFile(mode='w+', prefix='pf', suffix='.cmd')
+ cmd_file_name = cmd_file.name
+ data_file = tempfile.NamedTemporaryFile(mode='w+', prefix='pf', suffix='.dat')
+ data_file_name = data_file.name
+ desc = parse_file(input_filename, data_file)
+ if len(desc) > 0:
+ cmd_file.write("set title '%s'\n" % (desc,))
+ cmd_file.write("set xlabel 'N pipes'\n")
+ cmd_file.write("set ylabel 'N stages'\n")
+ cmd_file.write("set zlabel 'GFLOPS'\n")
+ cmd_file.write("set key off\n")
+ cmd_file.write("set view 60, 312\n")
+ cmd_file.write("set pm3d\n")
+ cmd_file.write("splot '%s' using 1:2:($3*1e-9) with pm3d at b, '%s' using 1:2:($3*1e-9) with pm3d\n" % (
+ data_file_name, data_file_name))
+
+ cmd_file.flush()
+ data_file.flush()
+
+ os.system("gnuplot " + cmd_file_name + " -")
+
+ #sys.stdout.write(open(cmd_file_name,'r').read())
+ #sys.stdout.write(open(data_file_name,'r').read())
+
+
+def main():
+ usage = "usage: %prog [options] file.dat"
+ parser = OptionParser(usage=usage)
+ (options, args) = parser.parse_args()
+ if len(args) != 1:
+ parser.print_help()
+ raise SystemExit, 1
+
+ handle_file(args[0])
+
+
+if __name__ == '__main__':
+ main()
diff --git a/gnuradio-core/src/examples/mp-sched/run_synthetic.py b/gnuradio-core/src/examples/mp-sched/run_synthetic.py
new file mode 100755
index 000000000..4896bca46
--- /dev/null
+++ b/gnuradio-core/src/examples/mp-sched/run_synthetic.py
@@ -0,0 +1,101 @@
+#!/usr/bin/env python
+#
+# 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 this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+
+"""
+Run synthetic.py for npipes in [1,16], nstages in [1,16]
+"""
+
+import re
+import sys
+import os
+import tempfile
+from optparse import OptionParser
+
+
+def write_shell_script(f, data_filename, description, ncores, gflops, max_pipes_and_stages):
+ """
+ f is the file to write the script to
+ data_filename is the where the data ends up
+ description describes the machine
+ ncores is the number of cores (used to size the workload)
+ gflops is the estimated GFLOPS per core (used to size the workload)
+ """
+
+ f.write("#!/bin/sh\n")
+ f.write("(\n")
+ if description:
+ f.write("echo '#D %s'\n" % (description,))
+
+ for npipes in range(1, max_pipes_and_stages + 1):
+ for nstages in range(1, max_pipes_and_stages + 1):
+ # We'd like each run of synthetic to take ~10 seconds
+ desired_time_per_run = 10
+ est_gflops_avail = min(nstages * npipes, ncores) * gflops
+ nsamples = (est_gflops_avail * desired_time_per_run)/(512.0 * nstages * npipes)
+ nsamples = int(nsamples * 1e9)
+
+ cmd = "./synthetic.py -m -s %d -p %d -N %d\n" % (nstages, npipes, nsamples)
+ f.write(cmd)
+ f.write('if test $? -ge 128; then exit 128; fi\n')
+
+ f.write(") 2>&1 | grep --line-buffered -v '^>>>' | tee %s\n" % (data_filename,))
+ f.flush()
+
+
+
+def main():
+ description = """%prog gathers multiprocessor scaling data using the ./synthetic.py benchmark.
+All combinations of npipes and nstages between 1 and --max-pipes-and-stages are tried.
+The -n and -f options provides hints used to size the workload. We'd like each run
+of synthetic to take about 10 seconds. For the full 16x16 case this results in a
+total runtime of about 43 minutes, assuming that your values for -n and -f are reasonable.
+For x86 machines, assume 3 FLOPS per processor Hz. E.g., 3 GHz machine -> 9 GFLOPS.
+plot_flops.py will make pretty graphs from the output data generated by %prog.
+"""
+ usage = "usage: %prog [options] output.dat"
+ parser = OptionParser(usage=usage, description=description)
+ parser.add_option("-d", "--description", metavar="DESC",
+ help="machine description, e.g., \"Dual quad-core Xeon 3 GHz\"", default=None)
+ parser.add_option("-n", "--ncores", type="int", default=1,
+ help="number of processor cores [default=%default]")
+ parser.add_option("-g", "--gflops", metavar="GFLOPS", type="float", default=3.0,
+ help="estimated GFLOPS per core [default=%default]")
+ parser.add_option("-m", "--max-pipes-and-stages", metavar="MAX", type="int", default=16,
+ help="maximum number of pipes and stages to use [default=%default]")
+ (options, args) = parser.parse_args()
+ if len(args) != 1:
+ parser.print_help()
+ raise SystemExit, 1
+
+ output_filename = args[0]
+
+ shell = os.popen("/bin/sh", "w")
+
+ write_shell_script(shell,
+ output_filename,
+ options.description,
+ options.ncores,
+ options.gflops,
+ options.max_pipes_and_stages)
+
+if __name__ == '__main__':
+ main()
+
diff --git a/gnuradio-core/src/examples/mp-sched/synthetic.py b/gnuradio-core/src/examples/mp-sched/synthetic.py
new file mode 100755
index 000000000..5ce1b5eb8
--- /dev/null
+++ b/gnuradio-core/src/examples/mp-sched/synthetic.py
@@ -0,0 +1,118 @@
+#!/usr/bin/env python
+#
+# 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 this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+
+from gnuradio import gr, gru, eng_notation, blks2
+from gnuradio.eng_option import eng_option
+from optparse import OptionParser
+import os
+
+
+class pipeline(gr.hier_block2):
+ def __init__(self, nstages, ntaps=256):
+ """
+ Create a pipeline of nstages of gr.fir_filter_fff's connected in serial
+ terminating in a gr.null_sink.
+ """
+ gr.hier_block2.__init__(self, "pipeline",
+ gr.io_signature(1, 1, gr.sizeof_float),
+ gr.io_signature(0, 0, 0))
+ taps = ntaps*[1.0/ntaps]
+ upstream = self
+ for i in range(nstages):
+ op = gr.fir_filter_fff(1, taps)
+ self.connect(upstream, op)
+ upstream = op
+
+ self.connect(upstream, gr.null_sink(gr.sizeof_float))
+
+
+class top(gr.top_block):
+ def __init__(self):
+ gr.top_block.__init__(self)
+
+ default_nsamples = 10e6
+ parser=OptionParser(option_class=eng_option)
+ parser.add_option("-p", "--npipelines", type="intx", default=1,
+ metavar="NPIPES", help="the number of pipelines to create (default=%default)")
+ parser.add_option("-s", "--nstages", type="intx", default=1,
+ metavar="NSTAGES", help="the number of stages in each pipeline (default=%default)")
+ parser.add_option("-N", "--nsamples", type="eng_float", default=default_nsamples,
+ help=("the number of samples to run through the graph (default=%s)" %
+ (eng_notation.num_to_str(default_nsamples))))
+ parser.add_option("-m", "--machine-readable", action="store_true", default=False,
+ help="enable machine readable output")
+
+ (options, args) = parser.parse_args()
+ if len(args) != 0:
+ parser.print_help()
+ raise SystemExit, 1
+
+ self.npipes = options.npipelines
+ self.nstages = options.nstages
+ self.nsamples = options.nsamples
+ self.machine_readable = options.machine_readable
+
+ ntaps = 256
+
+ # Something vaguely like floating point ops
+ self.flop = 2 * ntaps * options.npipelines * options.nstages * options.nsamples
+
+ src = gr.null_source(gr.sizeof_float)
+ head = gr.head(gr.sizeof_float, int(options.nsamples))
+ self.connect(src, head)
+
+ for n in range(options.npipelines):
+ self.connect(head, pipeline(options.nstages, ntaps))
+
+
+def time_it(tb):
+ start = os.times()
+ tb.run()
+ stop = os.times()
+ delta = map((lambda a, b: a-b), stop, start)
+ user, sys, childrens_user, childrens_sys, real = delta
+ total_user = user + childrens_user
+ total_sys = sys + childrens_sys
+ if tb.machine_readable:
+ print "%3d %3d %.3e %7.3f %7.3f %7.3f %7.3f %.6e %.3e" % (
+ tb.npipes, tb.nstages, tb.nsamples, real, total_user, total_sys, (total_user+total_sys)/real, tb.flop, tb.flop/real)
+ else:
+ print "npipes %7d" % (tb.npipes,)
+ print "nstages %7d" % (tb.nstages,)
+ print "nsamples %s" % (eng_notation.num_to_str(tb.nsamples),)
+ print "real %7.3f" % (real,)
+ print "user %7.3f" % (total_user,)
+ print "sys %7.3f" % (total_sys,)
+ print "(user+sys)/real %7.3f" % ((total_user + total_sys)/real,)
+ print "pseudo_flop %s" % (eng_notation.num_to_str(tb.flop),)
+ print "pseudo_flop/real %s" % (eng_notation.num_to_str(tb.flop/real),)
+
+
+if __name__ == "__main__":
+ try:
+ tb = top()
+ time_it(tb)
+ except KeyboardInterrupt:
+ raise SystemExit, 128
+
+
+
+
diff --git a/gnuradio-core/src/examples/mp-sched/wfm_rcv_pll_to_wav.py b/gnuradio-core/src/examples/mp-sched/wfm_rcv_pll_to_wav.py
new file mode 100755
index 000000000..81613922b
--- /dev/null
+++ b/gnuradio-core/src/examples/mp-sched/wfm_rcv_pll_to_wav.py
@@ -0,0 +1,127 @@
+#!/usr/bin/env python
+#
+# Copyright 2005,2006,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.
+#
+
+from gnuradio import gr, gru, eng_notation, optfir
+from gnuradio import audio
+from gnuradio import blks2
+from gnuradio.eng_option import eng_option
+from optparse import OptionParser
+import sys
+import math
+
+class wfm_rx_block (gr.top_block):
+ def __init__(self):
+ gr.top_block.__init__(self)
+
+ usage = "usage: %prog [options] input-samples-320kS.dat output.wav"
+ parser=OptionParser(option_class=eng_option, usage=usage)
+ parser.add_option("-V", "--volume", type="eng_float", default=None,
+ help="set volume (default is midpoint)")
+
+ (options, args) = parser.parse_args()
+ if len(args) != 2:
+ parser.print_help()
+ sys.exit(1)
+
+ input_filename = args[0]
+ output_filename = args[1]
+
+ self.vol = 0
+
+ # build graph
+
+ self.src = gr.file_source(gr.sizeof_gr_complex, input_filename, False)
+
+ adc_rate = 64e6 # 64 MS/s
+ usrp_decim = 200
+ usrp_rate = adc_rate / usrp_decim # 320 kS/s
+ chanfilt_decim = 1
+ demod_rate = usrp_rate / chanfilt_decim
+ audio_decimation = 10
+ audio_rate = demod_rate / audio_decimation # 32 kHz
+
+
+ chan_filt_coeffs = optfir.low_pass (1, # gain
+ usrp_rate, # sampling rate
+ 80e3, # passband cutoff
+ 115e3, # stopband cutoff
+ 0.1, # passband ripple
+ 60) # stopband attenuation
+ #print len(chan_filt_coeffs)
+ chan_filt = gr.fir_filter_ccf (chanfilt_decim, chan_filt_coeffs)
+
+
+ #self.guts = blks2.wfm_rcv (demod_rate, audio_decimation)
+ self.guts = blks2.wfm_rcv_pll (demod_rate, audio_decimation)
+
+ # FIXME rework {add,multiply}_const_* to handle multiple streams
+ self.volume_control_l = gr.multiply_const_ff(self.vol)
+ self.volume_control_r = gr.multiply_const_ff(self.vol)
+
+ # wave file as final sink
+ if 1:
+ sink = gr.wavfile_sink(output_filename, 2, int(audio_rate), 16)
+ else:
+ sink = audio.sink (int (audio_rate),
+ options.audio_output,
+ False) # ok_to_block
+
+ # now wire it all together
+ self.connect (self.src, chan_filt, self.guts)
+ self.connect ((self.guts, 0), self.volume_control_l, (sink, 0))
+ self.connect ((self.guts, 1), self.volume_control_r, (sink, 1))
+ try:
+ self.guts.stereo_carrier_pll_recovery.squelch_enable(True)
+ except:
+ pass
+ #print "FYI: This implementation of the stereo_carrier_pll_recovery has no squelch implementation yet"
+
+ if options.volume is None:
+ g = self.volume_range()
+ options.volume = float(g[0]+g[1])/2
+
+ # set initial values
+
+ self.set_vol(options.volume)
+ try:
+ self.guts.stereo_carrier_pll_recovery.set_lock_threshold(options.squelch)
+ except:
+ pass
+ #print "FYI: This implementation of the stereo_carrier_pll_recovery has no squelch implementation yet"
+
+
+ def set_vol (self, vol):
+ g = self.volume_range()
+ self.vol = max(g[0], min(g[1], vol))
+ self.volume_control_l.set_k(10**(self.vol/10))
+ self.volume_control_r.set_k(10**(self.vol/10))
+
+ def volume_range(self):
+ return (-20.0, 0.0, 0.5)
+
+
+if __name__ == '__main__':
+ tb = wfm_rx_block()
+ try:
+ tb.run()
+ except KeyboardInterrupt:
+ pass
diff --git a/gnuradio-core/src/examples/msg_passing/CMakeLists.txt b/gnuradio-core/src/examples/msg_passing/CMakeLists.txt
new file mode 100644
index 000000000..c4b207a1e
--- /dev/null
+++ b/gnuradio-core/src/examples/msg_passing/CMakeLists.txt
@@ -0,0 +1,27 @@
+# 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.
+
+include(GrPython)
+
+install(
+ FILES
+ strobe.grc
+ DESTINATION ${GR_PKG_DATA_DIR}/examples/msg_passing
+ COMPONENT "core_python"
+)
diff --git a/gnuradio-core/src/examples/msg_passing/hier/test_msg_hier.grc b/gnuradio-core/src/examples/msg_passing/hier/test_msg_hier.grc
new file mode 100644
index 000000000..0faed49bc
--- /dev/null
+++ b/gnuradio-core/src/examples/msg_passing/hier/test_msg_hier.grc
@@ -0,0 +1,287 @@
+<?xml version='1.0' encoding='ASCII'?>
+<flow_graph>
+ <timestamp>Mon Dec 10 19:56:24 2012</timestamp>
+ <block>
+ <key>options</key>
+ <param>
+ <key>id</key>
+ <value>test_msg_hier</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>title</key>
+ <value></value>
+ </param>
+ <param>
+ <key>author</key>
+ <value></value>
+ </param>
+ <param>
+ <key>description</key>
+ <value></value>
+ </param>
+ <param>
+ <key>window_size</key>
+ <value>1280, 1024</value>
+ </param>
+ <param>
+ <key>generate_options</key>
+ <value>hb</value>
+ </param>
+ <param>
+ <key>category</key>
+ <value>Custom</value>
+ </param>
+ <param>
+ <key>run_options</key>
+ <value>prompt</value>
+ </param>
+ <param>
+ <key>run</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>max_nouts</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>realtime_scheduling</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(10, 10)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>pad_source</key>
+ <param>
+ <key>id</key>
+ <value>pad_source_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>label</key>
+ <value>TEST_PORT</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>message</value>
+ </param>
+ <param>
+ <key>vlen</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>optional</key>
+ <value>False</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(234, 145)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>pad_source</key>
+ <param>
+ <key>id</key>
+ <value>pad_source_0_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>label</key>
+ <value>TEST_PORT2</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>message</value>
+ </param>
+ <param>
+ <key>vlen</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>optional</key>
+ <value>False</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(167, 54)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>gr_message_strobe</key>
+ <param>
+ <key>id</key>
+ <value>gr_message_strobe_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>msg</key>
+ <value>pmt.pmt_cons(pmt.PMT_NIL, pmt.pmt_make_u8vector(16,0x77))</value>
+ </param>
+ <param>
+ <key>period</key>
+ <value>200</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(362, 81)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>pad_sink</key>
+ <param>
+ <key>id</key>
+ <value>pad_sink_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>label</key>
+ <value>TEST_PORT</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>message</value>
+ </param>
+ <param>
+ <key>vlen</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>optional</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(618, 87)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>gr_message_strobe</key>
+ <param>
+ <key>id</key>
+ <value>gr_message_strobe_0_1</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>msg</key>
+ <value>pmt.pmt_intern("OUTPUT2")</value>
+ </param>
+ <param>
+ <key>period</key>
+ <value>100</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(400, 156)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>pad_sink</key>
+ <param>
+ <key>id</key>
+ <value>pad_sink_0_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>label</key>
+ <value>TEST_PORT3</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>message</value>
+ </param>
+ <param>
+ <key>vlen</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>optional</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(695, 172)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <connection>
+ <source_block_id>pad_source_0_0</source_block_id>
+ <sink_block_id>gr_message_strobe_0</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>pad_source_0</source_block_id>
+ <sink_block_id>gr_message_strobe_0</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>gr_message_strobe_0</source_block_id>
+ <sink_block_id>pad_sink_0</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>gr_message_strobe_0_1</source_block_id>
+ <sink_block_id>pad_sink_0</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>gr_message_strobe_0_1</source_block_id>
+ <sink_block_id>pad_sink_0_0</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+</flow_graph>
diff --git a/gnuradio-core/src/examples/msg_passing/hier/test_msg_hier_topblock.grc b/gnuradio-core/src/examples/msg_passing/hier/test_msg_hier_topblock.grc
new file mode 100644
index 000000000..f440b06b3
--- /dev/null
+++ b/gnuradio-core/src/examples/msg_passing/hier/test_msg_hier_topblock.grc
@@ -0,0 +1,185 @@
+<?xml version='1.0' encoding='ASCII'?>
+<flow_graph>
+ <timestamp>Mon Dec 10 19:56:42 2012</timestamp>
+ <block>
+ <key>options</key>
+ <param>
+ <key>id</key>
+ <value>test_msg_hier_topblock</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>title</key>
+ <value></value>
+ </param>
+ <param>
+ <key>author</key>
+ <value></value>
+ </param>
+ <param>
+ <key>description</key>
+ <value></value>
+ </param>
+ <param>
+ <key>window_size</key>
+ <value>1280, 1024</value>
+ </param>
+ <param>
+ <key>generate_options</key>
+ <value>no_gui</value>
+ </param>
+ <param>
+ <key>category</key>
+ <value>Custom</value>
+ </param>
+ <param>
+ <key>run_options</key>
+ <value>prompt</value>
+ </param>
+ <param>
+ <key>run</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>max_nouts</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>realtime_scheduling</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(10, 10)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>gr_message_strobe</key>
+ <param>
+ <key>id</key>
+ <value>gr_message_strobe_0_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>msg</key>
+ <value>pmt.pmt_intern("UPDATED2")</value>
+ </param>
+ <param>
+ <key>period</key>
+ <value>3000</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(51, 88)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>gr_message_strobe</key>
+ <param>
+ <key>id</key>
+ <value>gr_message_strobe_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>msg</key>
+ <value>pmt.pmt_intern("UPDATED")</value>
+ </param>
+ <param>
+ <key>period</key>
+ <value>2000</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(211, 168)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>gr_message_debug</key>
+ <param>
+ <key>id</key>
+ <value>gr_message_debug_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(758, 71)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>TEST_MSG_HIER</key>
+ <param>
+ <key>id</key>
+ <value>TEST_MSG_HIER_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(402, 52)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <connection>
+ <source_block_id>TEST_MSG_HIER_0</source_block_id>
+ <sink_block_id>gr_message_debug_0</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>gr_message_strobe_0</source_block_id>
+ <sink_block_id>TEST_MSG_HIER_0</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>gr_message_strobe_0_0</source_block_id>
+ <sink_block_id>TEST_MSG_HIER_0</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>1</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>TEST_MSG_HIER_0</source_block_id>
+ <sink_block_id>gr_message_debug_0</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>1</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>TEST_MSG_HIER_0</source_block_id>
+ <sink_block_id>gr_message_debug_0</sink_block_id>
+ <source_key>1</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+</flow_graph>
diff --git a/gnuradio-core/src/examples/msg_passing/strobe.grc b/gnuradio-core/src/examples/msg_passing/strobe.grc
new file mode 100644
index 000000000..7e7e8c345
--- /dev/null
+++ b/gnuradio-core/src/examples/msg_passing/strobe.grc
@@ -0,0 +1,266 @@
+<?xml version='1.0' encoding='ASCII'?>
+<flow_graph>
+ <timestamp>Thu Dec 6 11:33:08 2012</timestamp>
+ <block>
+ <key>variable</key>
+ <param>
+ <key>id</key>
+ <value>samp_rate</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>32000</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(10, 170)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>gr_pdu_to_tagged_stream</key>
+ <param>
+ <key>id</key>
+ <value>gr_pdu_to_tagged_stream_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>byte</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(443, 89)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>gr_message_debug</key>
+ <param>
+ <key>id</key>
+ <value>gr_message_debug_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(1049, 176)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>gr_tagged_stream_to_pdu</key>
+ <param>
+ <key>id</key>
+ <value>gr_tagged_stream_to_pdu_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>byte</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(870, 89)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>gr_kludge_copy</key>
+ <param>
+ <key>id</key>
+ <value>gr_kludge_copy_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>byte</value>
+ </param>
+ <param>
+ <key>num_ports</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>vlen</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(686, 89)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>gr_message_strobe</key>
+ <param>
+ <key>id</key>
+ <value>gr_message_strobe_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>msg</key>
+ <value>pmt.pmt_intern("TEST")</value>
+ </param>
+ <param>
+ <key>period</key>
+ <value>1000</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(423, 177)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>gr_message_strobe</key>
+ <param>
+ <key>id</key>
+ <value>gr_message_strobe_0_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>msg</key>
+ <value>pmt.pmt_cons( pmt.PMT_NIL, pmt.pmt_make_u8vector(512,0) )</value>
+ </param>
+ <param>
+ <key>period</key>
+ <value>750</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(99, 85)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>options</key>
+ <param>
+ <key>id</key>
+ <value>strobe</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>title</key>
+ <value></value>
+ </param>
+ <param>
+ <key>author</key>
+ <value></value>
+ </param>
+ <param>
+ <key>description</key>
+ <value></value>
+ </param>
+ <param>
+ <key>window_size</key>
+ <value>1280, 1024</value>
+ </param>
+ <param>
+ <key>generate_options</key>
+ <value>no_gui</value>
+ </param>
+ <param>
+ <key>category</key>
+ <value>Custom</value>
+ </param>
+ <param>
+ <key>run_options</key>
+ <value>prompt</value>
+ </param>
+ <param>
+ <key>run</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>max_nouts</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>realtime_scheduling</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(10, 10)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <connection>
+ <source_block_id>gr_message_strobe_0_0</source_block_id>
+ <sink_block_id>gr_pdu_to_tagged_stream_0</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>gr_message_strobe_0</source_block_id>
+ <sink_block_id>gr_message_debug_0</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>gr_tagged_stream_to_pdu_0</source_block_id>
+ <sink_block_id>gr_message_debug_0</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>gr_kludge_copy_0</source_block_id>
+ <sink_block_id>gr_tagged_stream_to_pdu_0</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>gr_pdu_to_tagged_stream_0</source_block_id>
+ <sink_block_id>gr_kludge_copy_0</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+</flow_graph>
diff --git a/gnuradio-core/src/examples/network/CMakeLists.txt b/gnuradio-core/src/examples/network/CMakeLists.txt
new file mode 100644
index 000000000..902933e29
--- /dev/null
+++ b/gnuradio-core/src/examples/network/CMakeLists.txt
@@ -0,0 +1,30 @@
+# Copyright 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.
+
+GR_PYTHON_INSTALL(PROGRAMS
+ audio_sink.py
+ audio_source.py
+ dial_tone_sink.py
+ dial_tone_source.py
+ vector_sink.py
+ vector_source.py
+ DESTINATION ${GR_PKG_DATA_DIR}/examples/network
+ COMPONENT "core_python"
+)
+
diff --git a/gnuradio-core/src/examples/network/audio_sink.py b/gnuradio-core/src/examples/network/audio_sink.py
new file mode 100755
index 000000000..72a678816
--- /dev/null
+++ b/gnuradio-core/src/examples/network/audio_sink.py
@@ -0,0 +1,72 @@
+#!/usr/bin/env python
+#
+# Copyright 2006,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.
+#
+
+from gnuradio import gr
+from gnuradio.eng_option import eng_option
+from optparse import OptionParser
+import sys
+
+try:
+ from gnuradio import audio
+except ImportError:
+ sys.stderr.write("Failed to import gnuradio.audio. Make sure gr-audio component is installed.\n")
+ sys.exit(1)
+
+class audio_sink(gr.top_block):
+ def __init__(self, host, port, pkt_size, sample_rate, eof, wait):
+ gr.top_block.__init__(self, "audio_sink")
+ src = gr.udp_source(gr.sizeof_float, host, port, pkt_size,
+ eof=eof, wait=wait)
+ dst = audio.sink(sample_rate)
+ self.connect(src, dst)
+
+if __name__ == '__main__':
+ parser = OptionParser(option_class=eng_option)
+ parser.add_option("", "--host", type="string", default="0.0.0.0",
+ help="local host name (domain name or IP address)")
+ parser.add_option("", "--port", type="int", default=65500,
+ help="port value to listen to for connection")
+ parser.add_option("", "--packet-size", type="int", default=1472,
+ help="packet size.")
+ parser.add_option("-r", "--sample-rate", type="int", default=32000,
+ help="audio signal sample rate [default=%default]")
+ parser.add_option("", "--no-eof", action="store_true", default=False,
+ help="don't send EOF on disconnect")
+ parser.add_option("", "--no-wait", action="store_true", default=False,
+ help="don't wait for source")
+ (options, args) = parser.parse_args()
+ if len(args) != 0:
+ parser.print_help()
+ raise SystemExit, 1
+
+ # Create an instance of a hierarchical block
+ top_block = audio_sink(options.host, options.port,
+ options.packet_size, options.sample_rate,
+ not options.no_eof, not options.no_wait)
+
+ try:
+ # Run forever
+ top_block.run()
+ except KeyboardInterrupt:
+ # Ctrl-C exits
+ pass
+
diff --git a/gnuradio-core/src/examples/network/audio_source.py b/gnuradio-core/src/examples/network/audio_source.py
new file mode 100755
index 000000000..0baf7d2e9
--- /dev/null
+++ b/gnuradio-core/src/examples/network/audio_source.py
@@ -0,0 +1,69 @@
+#!/usr/bin/env python
+#
+# Copyright 2006,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.
+#
+
+from gnuradio import gr
+from gnuradio.eng_option import eng_option
+from optparse import OptionParser
+import sys
+
+try:
+ from gnuradio import audio
+except ImportError:
+ sys.stderr.write("Failed to import gnuradio.audio. Make sure gr-audio component is installed.\n")
+ sys.exit(1)
+
+class audio_source(gr.top_block):
+ def __init__(self, host, port, pkt_size, sample_rate, eof):
+ gr.top_block.__init__(self, "audio_source")
+ self.audio = audio.source(sample_rate)
+ self.sink = gr.udp_sink(gr.sizeof_float, host, port, pkt_size, eof=eof)
+ self.connect(self.audio, self.sink)
+
+if __name__ == '__main__':
+ parser = OptionParser(option_class=eng_option)
+ parser.add_option("", "--host", type="string", default="localhost",
+ help="Remote host name (domain name or IP address")
+ parser.add_option("", "--port", type="int", default=65500,
+ help="port number to connect to")
+ parser.add_option("", "--packet-size", type="int", default=1472,
+ help="packet size.")
+ parser.add_option("-r", "--sample-rate", type="int", default=32000 ,
+ help="audio signal sample rate [default=%default]")
+ parser.add_option("", "--no-eof", action="store_true", default=False,
+ help="don't send EOF on disconnect")
+ (options, args) = parser.parse_args()
+ if len(args) != 0:
+ parser.print_help()
+ raise SystemExit, 1
+
+ # Create an instance of a hierarchical block
+ top_block = audio_source(options.host, options.port,
+ options.packet_size, options.sample_rate,
+ not options.no_eof)
+
+ try:
+ # Run forever
+ top_block.run()
+ except KeyboardInterrupt:
+ # Ctrl-C exits
+ pass
+
diff --git a/gnuradio-core/src/examples/network/dial_tone_sink.py b/gnuradio-core/src/examples/network/dial_tone_sink.py
new file mode 100755
index 000000000..83ad376c0
--- /dev/null
+++ b/gnuradio-core/src/examples/network/dial_tone_sink.py
@@ -0,0 +1,65 @@
+#!/usr/bin/env python
+#
+# Copyright 2006,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.
+#
+
+from gnuradio import gr, audio
+from gnuradio.eng_option import eng_option
+from optparse import OptionParser
+
+class dial_tone_sink(gr.top_block):
+ def __init__(self, host, port, pkt_size, sample_rate, eof, wait):
+ gr.top_block.__init__(self, "dial_tone_sink")
+ udp = gr.udp_source(gr.sizeof_float, host, port, pkt_size,
+ eof=eof, wait=wait)
+ sink = audio.sink(sample_rate)
+ self.connect(udp, sink)
+
+if __name__ == '__main__':
+ parser = OptionParser(option_class=eng_option)
+ parser.add_option("", "--host", type="string", default="0.0.0.0",
+ help="local host name (domain name or IP address)")
+ parser.add_option("", "--port", type="int", default=65500,
+ help="port value to listen to for connection")
+ parser.add_option("", "--packet-size", type="int", default=1472,
+ help="packet size.")
+ parser.add_option("-r", "--sample-rate", type="int", default=8000,
+ help="audio signal sample rate [default=%default]")
+ parser.add_option("", "--no-eof", action="store_true", default=False,
+ help="don't send EOF on disconnect")
+ parser.add_option("", "--no-wait", action="store_true", default=False,
+ help="don't wait for source")
+ (options, args) = parser.parse_args()
+ if len(args) != 0:
+ parser.print_help()
+ raise SystemExit, 1
+
+ # Create an instance of a hierarchical block
+ top_block = dial_tone_sink(options.host, options.port,
+ options.packet_size, options.sample_rate,
+ not options.no_eof, not options.no_wait)
+
+ try:
+ # Run forever
+ top_block.run()
+ except KeyboardInterrupt:
+ # Ctrl-C exits
+ pass
+
diff --git a/gnuradio-core/src/examples/network/dial_tone_source.py b/gnuradio-core/src/examples/network/dial_tone_source.py
new file mode 100755
index 000000000..232a06de8
--- /dev/null
+++ b/gnuradio-core/src/examples/network/dial_tone_source.py
@@ -0,0 +1,70 @@
+#!/usr/bin/env python
+#
+# Copyright 2006,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.
+#
+
+from gnuradio import gr
+from gnuradio.eng_option import eng_option
+from optparse import OptionParser
+
+class dial_tone_source(gr.top_block):
+ def __init__(self, host, port, pkt_size, sample_rate, eof):
+ gr.top_block.__init__(self, "dial_tone_source")
+
+ amplitude = 0.3
+ src0 = gr.sig_source_f (sample_rate, gr.GR_SIN_WAVE, 350, amplitude)
+ src1 = gr.sig_source_f (sample_rate, gr.GR_SIN_WAVE, 440, amplitude)
+ add = gr.add_ff()
+
+ # Throttle needed here to account for the other side's audio card sampling rate
+ thr = gr.throttle(gr.sizeof_float, sample_rate)
+ sink = gr.udp_sink(gr.sizeof_float, host, port, pkt_size, eof=eof)
+ self.connect(src0, (add, 0))
+ self.connect(src1, (add, 1))
+ self.connect(add, thr, sink)
+
+if __name__ == '__main__':
+ parser = OptionParser(option_class=eng_option)
+ parser.add_option("", "--host", type="string", default="localhost",
+ help="Remote host name (domain name or IP address")
+ parser.add_option("", "--port", type="int", default=65500,
+ help="port number to connect to")
+ parser.add_option("", "--packet-size", type="int", default=1472,
+ help="packet size.")
+ parser.add_option("-r", "--sample-rate", type="int", default=8000,
+ help="audio signal sample rate [default=%default]")
+ parser.add_option("", "--no-eof", action="store_true", default=False,
+ help="don't send EOF on disconnect")
+ (options, args) = parser.parse_args()
+ if len(args) != 0:
+ parser.print_help()
+ raise SystemExit, 1
+
+ # Create an instance of a hierarchical block
+ top_block = dial_tone_source(options.host, options.port,
+ options.packet_size, options.sample_rate,
+ not options.no_eof)
+
+ try:
+ # Run forever
+ top_block.run()
+ except KeyboardInterrupt:
+ # Ctrl-C exits
+ pass
diff --git a/gnuradio-core/src/examples/network/vector_sink.py b/gnuradio-core/src/examples/network/vector_sink.py
new file mode 100755
index 000000000..e84a27d9f
--- /dev/null
+++ b/gnuradio-core/src/examples/network/vector_sink.py
@@ -0,0 +1,64 @@
+#!/usr/bin/env python
+#
+# Copyright 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.
+#
+
+from gnuradio import gr
+from gnuradio.eng_option import eng_option
+from optparse import OptionParser
+
+class vector_sink(gr.top_block):
+ def __init__(self, host, port, pkt_size, eof, wait):
+ gr.top_block.__init__(self, "vector_sink")
+
+ udp = gr.udp_source(gr.sizeof_float, host, port, pkt_size,
+ eof=eof, wait=wait)
+ sink = gr.file_sink(gr.sizeof_float, "received.dat")
+ self.connect(udp, sink)
+
+if __name__ == "__main__":
+ parser = OptionParser(option_class=eng_option)
+ parser.add_option("", "--host", type="string", default="0.0.0.0",
+ help="local host name (domain name or IP address)")
+ parser.add_option("", "--port", type="int", default=65500,
+ help="port value to listen to for connection")
+ parser.add_option("", "--packet-size", type="int", default=1471,
+ help="packet size.")
+ parser.add_option("", "--no-eof", action="store_true", default=False,
+ help="don't send EOF on disconnect")
+ parser.add_option("", "--no-wait", action="store_true", default=False,
+ help="don't wait for source")
+ (options, args) = parser.parse_args()
+ if len(args) != 0:
+ parser.print_help()
+ raise SystemExit, 1
+
+ # Create an instance of a hierarchical block
+ top_block = vector_sink(options.host, options.port,
+ options.packet_size,
+ not options.no_eof, not options.no_wait)
+
+ try:
+ # Run forever
+ top_block.run()
+ except KeyboardInterrupt:
+ # Ctrl-C exits
+ pass
+
diff --git a/gnuradio-core/src/examples/network/vector_source.py b/gnuradio-core/src/examples/network/vector_source.py
new file mode 100755
index 000000000..d322dda3b
--- /dev/null
+++ b/gnuradio-core/src/examples/network/vector_source.py
@@ -0,0 +1,60 @@
+#!/usr/bin/env python
+#
+# Copyright 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.
+#
+
+from gnuradio import gr
+from gnuradio.eng_option import eng_option
+from optparse import OptionParser
+
+class vector_source(gr.top_block):
+ def __init__(self, host, port, pkt_size, eof):
+ gr.top_block.__init__(self, "vector_source")
+ data = [i*0.01 for i in range(1000)]
+ vec = gr.vector_source_f(data, True)
+ udp = gr.udp_sink(gr.sizeof_float, host, port, pkt_size, eof=eof)
+ self.connect(vec, udp)
+
+if __name__ == '__main__':
+ parser = OptionParser(option_class=eng_option)
+ parser.add_option("", "--host", type="string", default="localhost",
+ help="Remote host name (domain name or IP address")
+ parser.add_option("", "--port", type="int", default=65500,
+ help="port number to connect to")
+ parser.add_option("", "--packet-size", type="int", default=1471,
+ help="packet size.")
+ parser.add_option("", "--no-eof", action="store_true", default=False,
+ help="don't send EOF on disconnect")
+ (options, args) = parser.parse_args()
+ if len(args) != 0:
+ parser.print_help()
+ raise SystemExit, 1
+
+# Create an instance of a hierarchical block
+ top_block = vector_source(options.host, options.port, options.packet_size,
+ not options.no_eof)
+
+ try:
+ # Run forever
+ top_block.run()
+ except KeyboardInterrupt:
+ # Ctrl-C exits
+ pass
+
diff --git a/gnuradio-core/src/examples/pfb/CMakeLists.txt b/gnuradio-core/src/examples/pfb/CMakeLists.txt
new file mode 100644
index 000000000..090b2401d
--- /dev/null
+++ b/gnuradio-core/src/examples/pfb/CMakeLists.txt
@@ -0,0 +1,41 @@
+# Copyright 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.
+
+include(GrPython)
+
+GR_PYTHON_INSTALL(PROGRAMS
+ channelize.py
+ chirp_channelize.py
+ decimate.py
+ fmtest.py
+ interpolate.py
+ resampler.py
+ synth_filter.py
+ synth_to_chan.py
+ reconstruction.py
+ DESTINATION ${GR_PKG_DATA_DIR}/examples/pfb
+ COMPONENT "core_python"
+)
+
+install(
+ FILES
+ resampler_demo.grc
+ DESTINATION ${GR_PKG_DATA_DIR}/examples/pfb
+ COMPONENT "core_python"
+)
diff --git a/gnuradio-core/src/examples/pfb/channelize.py b/gnuradio-core/src/examples/pfb/channelize.py
new file mode 100755
index 000000000..442f263f4
--- /dev/null
+++ b/gnuradio-core/src/examples/pfb/channelize.py
@@ -0,0 +1,191 @@
+#!/usr/bin/env python
+#
+# 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.
+#
+
+from gnuradio import gr, blks2
+import sys, time
+
+try:
+ import scipy
+ from scipy import fftpack
+except ImportError:
+ print "Error: Program requires scipy (see: www.scipy.org)."
+ sys.exit(1)
+
+try:
+ import pylab
+ from pylab import mlab
+except ImportError:
+ print "Error: Program requires matplotlib (see: matplotlib.sourceforge.net)."
+ sys.exit(1)
+
+class pfb_top_block(gr.top_block):
+ def __init__(self):
+ gr.top_block.__init__(self)
+
+ self._N = 2000000 # number of samples to use
+ self._fs = 9000 # initial sampling rate
+ self._M = 9 # Number of channels to channelize
+
+ # Create a set of taps for the PFB channelizer
+ self._taps = gr.firdes.low_pass_2(1, self._fs, 475.50, 50,
+ attenuation_dB=100, window=gr.firdes.WIN_BLACKMAN_hARRIS)
+
+ # Calculate the number of taps per channel for our own information
+ tpc = scipy.ceil(float(len(self._taps)) / float(self._M))
+ print "Number of taps: ", len(self._taps)
+ print "Number of channels: ", self._M
+ print "Taps per channel: ", tpc
+
+ # Create a set of signals at different frequencies
+ # freqs lists the frequencies of the signals that get stored
+ # in the list "signals", which then get summed together
+ self.signals = list()
+ self.add = gr.add_cc()
+ freqs = [-4070, -3050, -2030, -1010, 10, 1020, 2040, 3060, 4080]
+ for i in xrange(len(freqs)):
+ self.signals.append(gr.sig_source_c(self._fs, gr.GR_SIN_WAVE, freqs[i], 1))
+ self.connect(self.signals[i], (self.add,i))
+
+ self.head = gr.head(gr.sizeof_gr_complex, self._N)
+
+ # Construct the channelizer filter
+ self.pfb = blks2.pfb_channelizer_ccf(self._M, self._taps, 1)
+
+ # Construct a vector sink for the input signal to the channelizer
+ self.snk_i = gr.vector_sink_c()
+
+ # Connect the blocks
+ self.connect(self.add, self.head, self.pfb)
+ self.connect(self.add, self.snk_i)
+
+ # Use this to play with the channel mapping
+ #self.pfb.set_channel_map([5,6,7,8,0,1,2,3,4])
+
+ # Create a vector sink for each of M output channels of the filter and connect it
+ self.snks = list()
+ for i in xrange(self._M):
+ self.snks.append(gr.vector_sink_c())
+ self.connect((self.pfb, i), self.snks[i])
+
+
+def main():
+ tstart = time.time()
+
+ tb = pfb_top_block()
+ tb.run()
+
+ tend = time.time()
+ print "Run time: %f" % (tend - tstart)
+
+ if 1:
+ fig_in = pylab.figure(1, figsize=(16,9), facecolor="w")
+ fig1 = pylab.figure(2, figsize=(16,9), facecolor="w")
+ fig2 = pylab.figure(3, figsize=(16,9), facecolor="w")
+
+ Ns = 1000
+ Ne = 10000
+
+ fftlen = 8192
+ winfunc = scipy.blackman
+ fs = tb._fs
+
+ # Plot the input signal on its own figure
+ d = tb.snk_i.data()[Ns:Ne]
+ spin_f = fig_in.add_subplot(2, 1, 1)
+
+ X,freq = mlab.psd(d, NFFT=fftlen, noverlap=fftlen/4, Fs=fs,
+ window = lambda d: d*winfunc(fftlen),
+ scale_by_freq=True)
+ X_in = 10.0*scipy.log10(abs(X))
+ f_in = scipy.arange(-fs/2.0, fs/2.0, fs/float(X_in.size))
+ pin_f = spin_f.plot(f_in, X_in, "b")
+ spin_f.set_xlim([min(f_in), max(f_in)+1])
+ spin_f.set_ylim([-200.0, 50.0])
+
+ spin_f.set_title("Input Signal", weight="bold")
+ spin_f.set_xlabel("Frequency (Hz)")
+ spin_f.set_ylabel("Power (dBW)")
+
+
+ Ts = 1.0/fs
+ Tmax = len(d)*Ts
+
+ t_in = scipy.arange(0, Tmax, Ts)
+ x_in = scipy.array(d)
+ spin_t = fig_in.add_subplot(2, 1, 2)
+ pin_t = spin_t.plot(t_in, x_in.real, "b")
+ pin_t = spin_t.plot(t_in, x_in.imag, "r")
+
+ spin_t.set_xlabel("Time (s)")
+ spin_t.set_ylabel("Amplitude")
+
+ Ncols = int(scipy.floor(scipy.sqrt(tb._M)))
+ Nrows = int(scipy.floor(tb._M / Ncols))
+ if(tb._M % Ncols != 0):
+ Nrows += 1
+
+ # Plot each of the channels outputs. Frequencies on Figure 2 and
+ # time signals on Figure 3
+ fs_o = tb._fs / tb._M
+ Ts_o = 1.0/fs_o
+ Tmax_o = len(d)*Ts_o
+ for i in xrange(len(tb.snks)):
+ # remove issues with the transients at the beginning
+ # also remove some corruption at the end of the stream
+ # this is a bug, probably due to the corner cases
+ d = tb.snks[i].data()[Ns:Ne]
+
+ sp1_f = fig1.add_subplot(Nrows, Ncols, 1+i)
+ X,freq = mlab.psd(d, NFFT=fftlen, noverlap=fftlen/4, Fs=fs_o,
+ window = lambda d: d*winfunc(fftlen),
+ scale_by_freq=True)
+ X_o = 10.0*scipy.log10(abs(X))
+ f_o = scipy.arange(-fs_o/2.0, fs_o/2.0, fs_o/float(X_o.size))
+ p2_f = sp1_f.plot(f_o, X_o, "b")
+ sp1_f.set_xlim([min(f_o), max(f_o)+1])
+ sp1_f.set_ylim([-200.0, 50.0])
+
+ sp1_f.set_title(("Channel %d" % i), weight="bold")
+ sp1_f.set_xlabel("Frequency (Hz)")
+ sp1_f.set_ylabel("Power (dBW)")
+
+ x_o = scipy.array(d)
+ t_o = scipy.arange(0, Tmax_o, Ts_o)
+ sp2_o = fig2.add_subplot(Nrows, Ncols, 1+i)
+ p2_o = sp2_o.plot(t_o, x_o.real, "b")
+ p2_o = sp2_o.plot(t_o, x_o.imag, "r")
+ sp2_o.set_xlim([min(t_o), max(t_o)+1])
+ sp2_o.set_ylim([-2, 2])
+
+ sp2_o.set_title(("Channel %d" % i), weight="bold")
+ sp2_o.set_xlabel("Time (s)")
+ sp2_o.set_ylabel("Amplitude")
+
+ pylab.show()
+
+
+if __name__ == "__main__":
+ try:
+ main()
+ except KeyboardInterrupt:
+ pass
+
diff --git a/gnuradio-core/src/examples/pfb/chirp_channelize.py b/gnuradio-core/src/examples/pfb/chirp_channelize.py
new file mode 100755
index 000000000..1c485ea9d
--- /dev/null
+++ b/gnuradio-core/src/examples/pfb/chirp_channelize.py
@@ -0,0 +1,203 @@
+#!/usr/bin/env python
+#
+# 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.
+#
+
+from gnuradio import gr, blks2
+import sys, time
+
+try:
+ import scipy
+ from scipy import fftpack
+except ImportError:
+ print "Error: Program requires scipy (see: www.scipy.org)."
+ sys.exit(1)
+
+try:
+ import pylab
+ from pylab import mlab
+except ImportError:
+ print "Error: Program requires matplotlib (see: matplotlib.sourceforge.net)."
+ sys.exit(1)
+
+class pfb_top_block(gr.top_block):
+ def __init__(self):
+ gr.top_block.__init__(self)
+
+ self._N = 200000 # number of samples to use
+ self._fs = 9000 # initial sampling rate
+ self._M = 9 # Number of channels to channelize
+
+ # Create a set of taps for the PFB channelizer
+ self._taps = gr.firdes.low_pass_2(1, self._fs, 500, 20,
+ attenuation_dB=10, window=gr.firdes.WIN_BLACKMAN_hARRIS)
+
+ # Calculate the number of taps per channel for our own information
+ tpc = scipy.ceil(float(len(self._taps)) / float(self._M))
+ print "Number of taps: ", len(self._taps)
+ print "Number of channels: ", self._M
+ print "Taps per channel: ", tpc
+
+ repeated = True
+ if(repeated):
+ self.vco_input = gr.sig_source_f(self._fs, gr.GR_SIN_WAVE, 0.25, 110)
+ else:
+ amp = 100
+ data = scipy.arange(0, amp, amp/float(self._N))
+ self.vco_input = gr.vector_source_f(data, False)
+
+ # Build a VCO controlled by either the sinusoid or single chirp tone
+ # Then convert this to a complex signal
+ self.vco = gr.vco_f(self._fs, 225, 1)
+ self.f2c = gr.float_to_complex()
+
+ self.head = gr.head(gr.sizeof_gr_complex, self._N)
+
+ # Construct the channelizer filter
+ self.pfb = blks2.pfb_channelizer_ccf(self._M, self._taps)
+
+ # Construct a vector sink for the input signal to the channelizer
+ self.snk_i = gr.vector_sink_c()
+
+ # Connect the blocks
+ self.connect(self.vco_input, self.vco, self.f2c)
+ self.connect(self.f2c, self.head, self.pfb)
+ self.connect(self.f2c, self.snk_i)
+
+ # Create a vector sink for each of M output channels of the filter and connect it
+ self.snks = list()
+ for i in xrange(self._M):
+ self.snks.append(gr.vector_sink_c())
+ self.connect((self.pfb, i), self.snks[i])
+
+
+def main():
+ tstart = time.time()
+
+ tb = pfb_top_block()
+ tb.run()
+
+ tend = time.time()
+ print "Run time: %f" % (tend - tstart)
+
+ if 1:
+ fig_in = pylab.figure(1, figsize=(16,9), facecolor="w")
+ fig1 = pylab.figure(2, figsize=(16,9), facecolor="w")
+ fig2 = pylab.figure(3, figsize=(16,9), facecolor="w")
+ fig3 = pylab.figure(4, figsize=(16,9), facecolor="w")
+
+ Ns = 650
+ Ne = 20000
+
+ fftlen = 8192
+ winfunc = scipy.blackman
+ fs = tb._fs
+
+ # Plot the input signal on its own figure
+ d = tb.snk_i.data()[Ns:Ne]
+ spin_f = fig_in.add_subplot(2, 1, 1)
+
+ X,freq = mlab.psd(d, NFFT=fftlen, noverlap=fftlen/4, Fs=fs,
+ window = lambda d: d*winfunc(fftlen),
+ scale_by_freq=True)
+ X_in = 10.0*scipy.log10(abs(fftpack.fftshift(X)))
+ f_in = scipy.arange(-fs/2.0, fs/2.0, fs/float(X_in.size))
+ pin_f = spin_f.plot(f_in, X_in, "b")
+ spin_f.set_xlim([min(f_in), max(f_in)+1])
+ spin_f.set_ylim([-200.0, 50.0])
+
+ spin_f.set_title("Input Signal", weight="bold")
+ spin_f.set_xlabel("Frequency (Hz)")
+ spin_f.set_ylabel("Power (dBW)")
+
+
+ Ts = 1.0/fs
+ Tmax = len(d)*Ts
+
+ t_in = scipy.arange(0, Tmax, Ts)
+ x_in = scipy.array(d)
+ spin_t = fig_in.add_subplot(2, 1, 2)
+ pin_t = spin_t.plot(t_in, x_in.real, "b")
+ pin_t = spin_t.plot(t_in, x_in.imag, "r")
+
+ spin_t.set_xlabel("Time (s)")
+ spin_t.set_ylabel("Amplitude")
+
+ Ncols = int(scipy.floor(scipy.sqrt(tb._M)))
+ Nrows = int(scipy.floor(tb._M / Ncols))
+ if(tb._M % Ncols != 0):
+ Nrows += 1
+
+ # Plot each of the channels outputs. Frequencies on Figure 2 and
+ # time signals on Figure 3
+ fs_o = tb._fs / tb._M
+ Ts_o = 1.0/fs_o
+ Tmax_o = len(d)*Ts_o
+ for i in xrange(len(tb.snks)):
+ # remove issues with the transients at the beginning
+ # also remove some corruption at the end of the stream
+ # this is a bug, probably due to the corner cases
+ d = tb.snks[i].data()[Ns:Ne]
+
+ sp1_f = fig1.add_subplot(Nrows, Ncols, 1+i)
+ X,freq = mlab.psd(d, NFFT=fftlen, noverlap=fftlen/4, Fs=fs_o,
+ window = lambda d: d*winfunc(fftlen),
+ scale_by_freq=True)
+ X_o = 10.0*scipy.log10(abs(X))
+ f_o = freq
+ p2_f = sp1_f.plot(f_o, X_o, "b")
+ sp1_f.set_xlim([min(f_o), max(f_o)+1])
+ sp1_f.set_ylim([-200.0, 50.0])
+
+ sp1_f.set_title(("Channel %d" % i), weight="bold")
+ sp1_f.set_xlabel("Frequency (Hz)")
+ sp1_f.set_ylabel("Power (dBW)")
+
+ x_o = scipy.array(d)
+ t_o = scipy.arange(0, Tmax_o, Ts_o)
+ sp2_o = fig2.add_subplot(Nrows, Ncols, 1+i)
+ p2_o = sp2_o.plot(t_o, x_o.real, "b")
+ p2_o = sp2_o.plot(t_o, x_o.imag, "r")
+ sp2_o.set_xlim([min(t_o), max(t_o)+1])
+ sp2_o.set_ylim([-2, 2])
+
+ sp2_o.set_title(("Channel %d" % i), weight="bold")
+ sp2_o.set_xlabel("Time (s)")
+ sp2_o.set_ylabel("Amplitude")
+
+
+ sp3 = fig3.add_subplot(1,1,1)
+ p3 = sp3.plot(t_o, x_o.real)
+ sp3.set_xlim([min(t_o), max(t_o)+1])
+ sp3.set_ylim([-2, 2])
+
+ sp3.set_title("All Channels")
+ sp3.set_xlabel("Time (s)")
+ sp3.set_ylabel("Amplitude")
+
+ pylab.show()
+
+
+if __name__ == "__main__":
+ try:
+ main()
+ except KeyboardInterrupt:
+ pass
+
diff --git a/gnuradio-core/src/examples/pfb/decimate.py b/gnuradio-core/src/examples/pfb/decimate.py
new file mode 100755
index 000000000..5322d746d
--- /dev/null
+++ b/gnuradio-core/src/examples/pfb/decimate.py
@@ -0,0 +1,178 @@
+#!/usr/bin/env python
+#
+# 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.
+#
+
+from gnuradio import gr, blks2
+import sys, time
+
+try:
+ import scipy
+ from scipy import fftpack
+except ImportError:
+ print "Error: Program requires scipy (see: www.scipy.org)."
+ sys.exit(1)
+
+try:
+ import pylab
+ from pylab import mlab
+except ImportError:
+ print "Error: Program requires matplotlib (see: matplotlib.sourceforge.net)."
+ sys.exit(1)
+
+class pfb_top_block(gr.top_block):
+ def __init__(self):
+ gr.top_block.__init__(self)
+
+ self._N = 10000000 # number of samples to use
+ self._fs = 10000 # initial sampling rate
+ self._decim = 20 # Decimation rate
+
+ # Generate the prototype filter taps for the decimators with a 200 Hz bandwidth
+ self._taps = gr.firdes.low_pass_2(1, self._fs, 200, 150,
+ attenuation_dB=120, window=gr.firdes.WIN_BLACKMAN_hARRIS)
+
+ # Calculate the number of taps per channel for our own information
+ tpc = scipy.ceil(float(len(self._taps)) / float(self._decim))
+ print "Number of taps: ", len(self._taps)
+ print "Number of filters: ", self._decim
+ print "Taps per channel: ", tpc
+
+ # Build the input signal source
+ # We create a list of freqs, and a sine wave is generated and added to the source
+ # for each one of these frequencies.
+ self.signals = list()
+ self.add = gr.add_cc()
+ freqs = [10, 20, 2040]
+ for i in xrange(len(freqs)):
+ self.signals.append(gr.sig_source_c(self._fs, gr.GR_SIN_WAVE, freqs[i], 1))
+ self.connect(self.signals[i], (self.add,i))
+
+ self.head = gr.head(gr.sizeof_gr_complex, self._N)
+
+ # Construct a PFB decimator filter
+ self.pfb = blks2.pfb_decimator_ccf(self._decim, self._taps, 0)
+
+ # Construct a standard FIR decimating filter
+ self.dec = gr.fir_filter_ccf(self._decim, self._taps)
+
+ self.snk_i = gr.vector_sink_c()
+
+ # Connect the blocks
+ self.connect(self.add, self.head, self.pfb)
+ self.connect(self.add, self.snk_i)
+
+ # Create the sink for the decimated siganl
+ self.snk = gr.vector_sink_c()
+ self.connect(self.pfb, self.snk)
+
+
+def main():
+ tb = pfb_top_block()
+
+ tstart = time.time()
+ tb.run()
+ tend = time.time()
+ print "Run time: %f" % (tend - tstart)
+
+ if 1:
+ fig1 = pylab.figure(1, figsize=(16,9))
+ fig2 = pylab.figure(2, figsize=(16,9))
+
+ Ns = 10000
+ Ne = 10000
+
+ fftlen = 8192
+ winfunc = scipy.blackman
+ fs = tb._fs
+
+ # Plot the input to the decimator
+
+ d = tb.snk_i.data()[Ns:Ns+Ne]
+ sp1_f = fig1.add_subplot(2, 1, 1)
+
+ X,freq = mlab.psd(d, NFFT=fftlen, noverlap=fftlen/4, Fs=fs,
+ window = lambda d: d*winfunc(fftlen),
+ scale_by_freq=True)
+ X_in = 10.0*scipy.log10(abs(fftpack.fftshift(X)))
+ f_in = scipy.arange(-fs/2.0, fs/2.0, fs/float(X_in.size))
+ p1_f = sp1_f.plot(f_in, X_in, "b")
+ sp1_f.set_xlim([min(f_in), max(f_in)+1])
+ sp1_f.set_ylim([-200.0, 50.0])
+
+ sp1_f.set_title("Input Signal", weight="bold")
+ sp1_f.set_xlabel("Frequency (Hz)")
+ sp1_f.set_ylabel("Power (dBW)")
+
+ Ts = 1.0/fs
+ Tmax = len(d)*Ts
+
+ t_in = scipy.arange(0, Tmax, Ts)
+ x_in = scipy.array(d)
+ sp1_t = fig1.add_subplot(2, 1, 2)
+ p1_t = sp1_t.plot(t_in, x_in.real, "b")
+ p1_t = sp1_t.plot(t_in, x_in.imag, "r")
+ sp1_t.set_ylim([-tb._decim*1.1, tb._decim*1.1])
+
+ sp1_t.set_xlabel("Time (s)")
+ sp1_t.set_ylabel("Amplitude")
+
+
+ # Plot the output of the decimator
+ fs_o = tb._fs / tb._decim
+
+ sp2_f = fig2.add_subplot(2, 1, 1)
+ d = tb.snk.data()[Ns:Ns+Ne]
+ X,freq = mlab.psd(d, NFFT=fftlen, noverlap=fftlen/4, Fs=fs_o,
+ window = lambda d: d*winfunc(fftlen),
+ scale_by_freq=True)
+ X_o = 10.0*scipy.log10(abs(fftpack.fftshift(X)))
+ f_o = scipy.arange(-fs_o/2.0, fs_o/2.0, fs_o/float(X_o.size))
+ p2_f = sp2_f.plot(f_o, X_o, "b")
+ sp2_f.set_xlim([min(f_o), max(f_o)+1])
+ sp2_f.set_ylim([-200.0, 50.0])
+
+ sp2_f.set_title("PFB Decimated Signal", weight="bold")
+ sp2_f.set_xlabel("Frequency (Hz)")
+ sp2_f.set_ylabel("Power (dBW)")
+
+
+ Ts_o = 1.0/fs_o
+ Tmax_o = len(d)*Ts_o
+
+ x_o = scipy.array(d)
+ t_o = scipy.arange(0, Tmax_o, Ts_o)
+ sp2_t = fig2.add_subplot(2, 1, 2)
+ p2_t = sp2_t.plot(t_o, x_o.real, "b-o")
+ p2_t = sp2_t.plot(t_o, x_o.imag, "r-o")
+ sp2_t.set_ylim([-2.5, 2.5])
+
+ sp2_t.set_xlabel("Time (s)")
+ sp2_t.set_ylabel("Amplitude")
+
+ pylab.show()
+
+
+if __name__ == "__main__":
+ try:
+ main()
+ except KeyboardInterrupt:
+ pass
+
diff --git a/gnuradio-core/src/examples/pfb/fmtest.py b/gnuradio-core/src/examples/pfb/fmtest.py
new file mode 100755
index 000000000..b9dd9b382
--- /dev/null
+++ b/gnuradio-core/src/examples/pfb/fmtest.py
@@ -0,0 +1,225 @@
+#!/usr/bin/env python
+#
+# 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.
+#
+
+from gnuradio import gr, blks2
+import sys, math, time
+
+try:
+ import scipy
+ from scipy import fftpack
+except ImportError:
+ print "Error: Program requires scipy (see: www.scipy.org)."
+ sys.exit(1)
+
+try:
+ import pylab
+except ImportError:
+ print "Error: Program requires matplotlib (see: matplotlib.sourceforge.net)."
+ sys.exit(1)
+
+
+class fmtx(gr.hier_block2):
+ def __init__(self, lo_freq, audio_rate, if_rate):
+
+ gr.hier_block2.__init__(self, "build_fm",
+ gr.io_signature(1, 1, gr.sizeof_float), # Input signature
+ gr.io_signature(1, 1, gr.sizeof_gr_complex)) # Output signature
+
+ fmtx = blks2.nbfm_tx (audio_rate, if_rate, max_dev=5e3, tau=75e-6)
+
+ # Local oscillator
+ lo = gr.sig_source_c (if_rate, # sample rate
+ gr.GR_SIN_WAVE, # waveform type
+ lo_freq, #frequency
+ 1.0, # amplitude
+ 0) # DC Offset
+ mixer = gr.multiply_cc ()
+
+ self.connect (self, fmtx, (mixer, 0))
+ self.connect (lo, (mixer, 1))
+ self.connect (mixer, self)
+
+class fmtest(gr.top_block):
+ def __init__(self):
+ gr.top_block.__init__(self)
+
+ self._nsamples = 1000000
+ self._audio_rate = 8000
+
+ # Set up N channels with their own baseband and IF frequencies
+ self._N = 5
+ chspacing = 16000
+ freq = [10, 20, 30, 40, 50]
+ f_lo = [0, 1*chspacing, -1*chspacing, 2*chspacing, -2*chspacing]
+
+ self._if_rate = 4*self._N*self._audio_rate
+
+ # Create a signal source and frequency modulate it
+ self.sum = gr.add_cc ()
+ for n in xrange(self._N):
+ sig = gr.sig_source_f(self._audio_rate, gr.GR_SIN_WAVE, freq[n], 0.5)
+ fm = fmtx(f_lo[n], self._audio_rate, self._if_rate)
+ self.connect(sig, fm)
+ self.connect(fm, (self.sum, n))
+
+ self.head = gr.head(gr.sizeof_gr_complex, self._nsamples)
+ self.snk_tx = gr.vector_sink_c()
+ self.channel = blks2.channel_model(0.1)
+
+ self.connect(self.sum, self.head, self.channel, self.snk_tx)
+
+
+ # Design the channlizer
+ self._M = 10
+ bw = chspacing/2.0
+ t_bw = chspacing/10.0
+ self._chan_rate = self._if_rate / self._M
+ self._taps = gr.firdes.low_pass_2(1, self._if_rate, bw, t_bw,
+ attenuation_dB=100,
+ window=gr.firdes.WIN_BLACKMAN_hARRIS)
+ tpc = math.ceil(float(len(self._taps)) / float(self._M))
+
+ print "Number of taps: ", len(self._taps)
+ print "Number of channels: ", self._M
+ print "Taps per channel: ", tpc
+
+ self.pfb = blks2.pfb_channelizer_ccf(self._M, self._taps)
+
+ self.connect(self.channel, self.pfb)
+
+ # Create a file sink for each of M output channels of the filter and connect it
+ self.fmdet = list()
+ self.squelch = list()
+ self.snks = list()
+ for i in xrange(self._M):
+ self.fmdet.append(blks2.nbfm_rx(self._audio_rate, self._chan_rate))
+ self.squelch.append(blks2.standard_squelch(self._audio_rate*10))
+ self.snks.append(gr.vector_sink_f())
+ self.connect((self.pfb, i), self.fmdet[i], self.squelch[i], self.snks[i])
+
+ def num_tx_channels(self):
+ return self._N
+
+ def num_rx_channels(self):
+ return self._M
+
+def main():
+
+ fm = fmtest()
+
+ tstart = time.time()
+ fm.run()
+ tend = time.time()
+
+ if 1:
+ fig1 = pylab.figure(1, figsize=(12,10), facecolor="w")
+ fig2 = pylab.figure(2, figsize=(12,10), facecolor="w")
+ fig3 = pylab.figure(3, figsize=(12,10), facecolor="w")
+
+ Ns = 10000
+ Ne = 100000
+
+ fftlen = 8192
+ winfunc = scipy.blackman
+
+ # Plot transmitted signal
+ fs = fm._if_rate
+
+ d = fm.snk_tx.data()[Ns:Ns+Ne]
+ sp1_f = fig1.add_subplot(2, 1, 1)
+
+ X,freq = sp1_f.psd(d, NFFT=fftlen, noverlap=fftlen/4, Fs=fs,
+ window = lambda d: d*winfunc(fftlen),
+ visible=False)
+ X_in = 10.0*scipy.log10(abs(fftpack.fftshift(X)))
+ f_in = scipy.arange(-fs/2.0, fs/2.0, fs/float(X_in.size))
+ p1_f = sp1_f.plot(f_in, X_in, "b")
+ sp1_f.set_xlim([min(f_in), max(f_in)+1])
+ sp1_f.set_ylim([-120.0, 20.0])
+
+ sp1_f.set_title("Input Signal", weight="bold")
+ sp1_f.set_xlabel("Frequency (Hz)")
+ sp1_f.set_ylabel("Power (dBW)")
+
+ Ts = 1.0/fs
+ Tmax = len(d)*Ts
+
+ t_in = scipy.arange(0, Tmax, Ts)
+ x_in = scipy.array(d)
+ sp1_t = fig1.add_subplot(2, 1, 2)
+ p1_t = sp1_t.plot(t_in, x_in.real, "b-o")
+ #p1_t = sp1_t.plot(t_in, x_in.imag, "r-o")
+ sp1_t.set_ylim([-5, 5])
+
+ # Set up the number of rows and columns for plotting the subfigures
+ Ncols = int(scipy.floor(scipy.sqrt(fm.num_rx_channels())))
+ Nrows = int(scipy.floor(fm.num_rx_channels() / Ncols))
+ if(fm.num_rx_channels() % Ncols != 0):
+ Nrows += 1
+
+ # Plot each of the channels outputs. Frequencies on Figure 2 and
+ # time signals on Figure 3
+ fs_o = fm._audio_rate
+ for i in xrange(len(fm.snks)):
+ # remove issues with the transients at the beginning
+ # also remove some corruption at the end of the stream
+ # this is a bug, probably due to the corner cases
+ d = fm.snks[i].data()[Ns:Ne]
+
+ sp2_f = fig2.add_subplot(Nrows, Ncols, 1+i)
+ X,freq = sp2_f.psd(d, NFFT=fftlen, noverlap=fftlen/4, Fs=fs_o,
+ window = lambda d: d*winfunc(fftlen),
+ visible=False)
+ #X_o = 10.0*scipy.log10(abs(fftpack.fftshift(X)))
+ X_o = 10.0*scipy.log10(abs(X))
+ #f_o = scipy.arange(-fs_o/2.0, fs_o/2.0, fs_o/float(X_o.size))
+ f_o = scipy.arange(0, fs_o/2.0, fs_o/2.0/float(X_o.size))
+ p2_f = sp2_f.plot(f_o, X_o, "b")
+ sp2_f.set_xlim([min(f_o), max(f_o)+0.1])
+ sp2_f.set_ylim([-120.0, 20.0])
+ sp2_f.grid(True)
+
+ sp2_f.set_title(("Channel %d" % i), weight="bold")
+ sp2_f.set_xlabel("Frequency (kHz)")
+ sp2_f.set_ylabel("Power (dBW)")
+
+
+ Ts = 1.0/fs_o
+ Tmax = len(d)*Ts
+ t_o = scipy.arange(0, Tmax, Ts)
+
+ x_t = scipy.array(d)
+ sp2_t = fig3.add_subplot(Nrows, Ncols, 1+i)
+ p2_t = sp2_t.plot(t_o, x_t.real, "b")
+ p2_t = sp2_t.plot(t_o, x_t.imag, "r")
+ sp2_t.set_xlim([min(t_o), max(t_o)+1])
+ sp2_t.set_ylim([-1, 1])
+
+ sp2_t.set_xlabel("Time (s)")
+ sp2_t.set_ylabel("Amplitude")
+
+
+ pylab.show()
+
+
+if __name__ == "__main__":
+ main()
diff --git a/gnuradio-core/src/examples/pfb/interpolate.py b/gnuradio-core/src/examples/pfb/interpolate.py
new file mode 100755
index 000000000..98068f220
--- /dev/null
+++ b/gnuradio-core/src/examples/pfb/interpolate.py
@@ -0,0 +1,233 @@
+#!/usr/bin/env python
+#
+# 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.
+#
+
+from gnuradio import gr, blks2
+import sys, time
+
+try:
+ import scipy
+ from scipy import fftpack
+except ImportError:
+ print "Error: Program requires scipy (see: www.scipy.org)."
+ sys.exit(1)
+
+try:
+ import pylab
+ from pylab import mlab
+except ImportError:
+ print "Error: Program requires matplotlib (see: matplotlib.sourceforge.net)."
+ sys.exit(1)
+
+class pfb_top_block(gr.top_block):
+ def __init__(self):
+ gr.top_block.__init__(self)
+
+ self._N = 100000 # number of samples to use
+ self._fs = 2000 # initial sampling rate
+ self._interp = 5 # Interpolation rate for PFB interpolator
+ self._ainterp = 5.5 # Resampling rate for the PFB arbitrary resampler
+
+ # Frequencies of the signals we construct
+ freq1 = 100
+ freq2 = 200
+
+ # Create a set of taps for the PFB interpolator
+ # This is based on the post-interpolation sample rate
+ self._taps = gr.firdes.low_pass_2(self._interp, self._interp*self._fs, freq2+50, 50,
+ attenuation_dB=120, window=gr.firdes.WIN_BLACKMAN_hARRIS)
+
+ # Create a set of taps for the PFB arbitrary resampler
+ # The filter size is the number of filters in the filterbank; 32 will give very low side-lobes,
+ # and larger numbers will reduce these even farther
+ # The taps in this filter are based on a sampling rate of the filter size since it acts
+ # internally as an interpolator.
+ flt_size = 32
+ self._taps2 = gr.firdes.low_pass_2(flt_size, flt_size*self._fs, freq2+50, 150,
+ attenuation_dB=120, window=gr.firdes.WIN_BLACKMAN_hARRIS)
+
+ # Calculate the number of taps per channel for our own information
+ tpc = scipy.ceil(float(len(self._taps)) / float(self._interp))
+ print "Number of taps: ", len(self._taps)
+ print "Number of filters: ", self._interp
+ print "Taps per channel: ", tpc
+
+ # Create a couple of signals at different frequencies
+ self.signal1 = gr.sig_source_c(self._fs, gr.GR_SIN_WAVE, freq1, 0.5)
+ self.signal2 = gr.sig_source_c(self._fs, gr.GR_SIN_WAVE, freq2, 0.5)
+ self.signal = gr.add_cc()
+
+ self.head = gr.head(gr.sizeof_gr_complex, self._N)
+
+ # Construct the PFB interpolator filter
+ self.pfb = blks2.pfb_interpolator_ccf(self._interp, self._taps)
+
+ # Construct the PFB arbitrary resampler filter
+ self.pfb_ar = blks2.pfb_arb_resampler_ccf(self._ainterp, self._taps2, flt_size)
+ self.snk_i = gr.vector_sink_c()
+
+ #self.pfb_ar.pfb.print_taps()
+ #self.pfb.pfb.print_taps()
+
+ # Connect the blocks
+ self.connect(self.signal1, self.head, (self.signal,0))
+ self.connect(self.signal2, (self.signal,1))
+ self.connect(self.signal, self.pfb)
+ self.connect(self.signal, self.pfb_ar)
+ self.connect(self.signal, self.snk_i)
+
+ # Create the sink for the interpolated signals
+ self.snk1 = gr.vector_sink_c()
+ self.snk2 = gr.vector_sink_c()
+ self.connect(self.pfb, self.snk1)
+ self.connect(self.pfb_ar, self.snk2)
+
+
+def main():
+ tb = pfb_top_block()
+
+ tstart = time.time()
+ tb.run()
+ tend = time.time()
+ print "Run time: %f" % (tend - tstart)
+
+
+ if 1:
+ fig1 = pylab.figure(1, figsize=(12,10), facecolor="w")
+ fig2 = pylab.figure(2, figsize=(12,10), facecolor="w")
+ fig3 = pylab.figure(3, figsize=(12,10), facecolor="w")
+
+ Ns = 10000
+ Ne = 10000
+
+ fftlen = 8192
+ winfunc = scipy.blackman
+
+ # Plot input signal
+ fs = tb._fs
+
+ d = tb.snk_i.data()[Ns:Ns+Ne]
+ sp1_f = fig1.add_subplot(2, 1, 1)
+
+ X,freq = mlab.psd(d, NFFT=fftlen, noverlap=fftlen/4, Fs=fs,
+ window = lambda d: d*winfunc(fftlen),
+ scale_by_freq=True)
+ X_in = 10.0*scipy.log10(abs(fftpack.fftshift(X)))
+ f_in = scipy.arange(-fs/2.0, fs/2.0, fs/float(X_in.size))
+ p1_f = sp1_f.plot(f_in, X_in, "b")
+ sp1_f.set_xlim([min(f_in), max(f_in)+1])
+ sp1_f.set_ylim([-200.0, 50.0])
+
+
+ sp1_f.set_title("Input Signal", weight="bold")
+ sp1_f.set_xlabel("Frequency (Hz)")
+ sp1_f.set_ylabel("Power (dBW)")
+
+ Ts = 1.0/fs
+ Tmax = len(d)*Ts
+
+ t_in = scipy.arange(0, Tmax, Ts)
+ x_in = scipy.array(d)
+ sp1_t = fig1.add_subplot(2, 1, 2)
+ p1_t = sp1_t.plot(t_in, x_in.real, "b-o")
+ #p1_t = sp1_t.plot(t_in, x_in.imag, "r-o")
+ sp1_t.set_ylim([-2.5, 2.5])
+
+ sp1_t.set_title("Input Signal", weight="bold")
+ sp1_t.set_xlabel("Time (s)")
+ sp1_t.set_ylabel("Amplitude")
+
+
+ # Plot output of PFB interpolator
+ fs_int = tb._fs*tb._interp
+
+ sp2_f = fig2.add_subplot(2, 1, 1)
+ d = tb.snk1.data()[Ns:Ns+(tb._interp*Ne)]
+ X,freq = mlab.psd(d, NFFT=fftlen, noverlap=fftlen/4, Fs=fs,
+ window = lambda d: d*winfunc(fftlen),
+ scale_by_freq=True)
+ X_o = 10.0*scipy.log10(abs(fftpack.fftshift(X)))
+ f_o = scipy.arange(-fs_int/2.0, fs_int/2.0, fs_int/float(X_o.size))
+ p2_f = sp2_f.plot(f_o, X_o, "b")
+ sp2_f.set_xlim([min(f_o), max(f_o)+1])
+ sp2_f.set_ylim([-200.0, 50.0])
+
+ sp2_f.set_title("Output Signal from PFB Interpolator", weight="bold")
+ sp2_f.set_xlabel("Frequency (Hz)")
+ sp2_f.set_ylabel("Power (dBW)")
+
+ Ts_int = 1.0/fs_int
+ Tmax = len(d)*Ts_int
+
+ t_o = scipy.arange(0, Tmax, Ts_int)
+ x_o1 = scipy.array(d)
+ sp2_t = fig2.add_subplot(2, 1, 2)
+ p2_t = sp2_t.plot(t_o, x_o1.real, "b-o")
+ #p2_t = sp2_t.plot(t_o, x_o.imag, "r-o")
+ sp2_t.set_ylim([-2.5, 2.5])
+
+ sp2_t.set_title("Output Signal from PFB Interpolator", weight="bold")
+ sp2_t.set_xlabel("Time (s)")
+ sp2_t.set_ylabel("Amplitude")
+
+
+ # Plot output of PFB arbitrary resampler
+ fs_aint = tb._fs * tb._ainterp
+
+ sp3_f = fig3.add_subplot(2, 1, 1)
+ d = tb.snk2.data()[Ns:Ns+(tb._interp*Ne)]
+ X,freq = mlab.psd(d, NFFT=fftlen, noverlap=fftlen/4, Fs=fs,
+ window = lambda d: d*winfunc(fftlen),
+ scale_by_freq=True)
+ X_o = 10.0*scipy.log10(abs(fftpack.fftshift(X)))
+ f_o = scipy.arange(-fs_aint/2.0, fs_aint/2.0, fs_aint/float(X_o.size))
+ p3_f = sp3_f.plot(f_o, X_o, "b")
+ sp3_f.set_xlim([min(f_o), max(f_o)+1])
+ sp3_f.set_ylim([-200.0, 50.0])
+
+ sp3_f.set_title("Output Signal from PFB Arbitrary Resampler", weight="bold")
+ sp3_f.set_xlabel("Frequency (Hz)")
+ sp3_f.set_ylabel("Power (dBW)")
+
+ Ts_aint = 1.0/fs_aint
+ Tmax = len(d)*Ts_aint
+
+ t_o = scipy.arange(0, Tmax, Ts_aint)
+ x_o2 = scipy.array(d)
+ sp3_f = fig3.add_subplot(2, 1, 2)
+ p3_f = sp3_f.plot(t_o, x_o2.real, "b-o")
+ p3_f = sp3_f.plot(t_o, x_o1.real, "m-o")
+ #p3_f = sp3_f.plot(t_o, x_o2.imag, "r-o")
+ sp3_f.set_ylim([-2.5, 2.5])
+
+ sp3_f.set_title("Output Signal from PFB Arbitrary Resampler", weight="bold")
+ sp3_f.set_xlabel("Time (s)")
+ sp3_f.set_ylabel("Amplitude")
+
+ pylab.show()
+
+
+if __name__ == "__main__":
+ try:
+ main()
+ except KeyboardInterrupt:
+ pass
+
diff --git a/gnuradio-core/src/examples/pfb/reconstruction.py b/gnuradio-core/src/examples/pfb/reconstruction.py
new file mode 100755
index 000000000..59910e4d6
--- /dev/null
+++ b/gnuradio-core/src/examples/pfb/reconstruction.py
@@ -0,0 +1,131 @@
+#!/usr/bin/env python
+
+import scipy, math, pylab
+from scipy import fftpack
+from gnuradio import gr, digital, blks2
+
+fftlen = 8192
+
+def main():
+ N = 10000
+ fs = 2000.0
+ Ts = 1.0/fs
+ t = scipy.arange(0, N*Ts, Ts)
+
+ # When playing with the number of channels, be careful about the filter
+ # specs and the channel map of the synthesizer set below.
+ nchans = 10
+
+ # Build the filter(s)
+ bw = 1000
+ tb = 400
+ proto_taps = gr.firdes.low_pass_2(1, nchans*fs, bw, tb, 80,
+ gr.firdes.WIN_BLACKMAN_hARRIS)
+ print "Filter length: ", len(proto_taps)
+
+
+ # Create a modulated signal
+ npwr = 0.01
+ data = scipy.random.randint(0, 256, N)
+ rrc_taps = gr.firdes.root_raised_cosine(1, 2, 1, 0.35, 41)
+
+ src = gr.vector_source_b(data.astype(scipy.uint8).tolist(), False)
+ mod = digital.bpsk_mod(samples_per_symbol=2)
+ chan = gr.channel_model(npwr)
+ rrc = gr.fft_filter_ccc(1, rrc_taps)
+
+ # Split it up into pieces
+ channelizer = blks2.pfb_channelizer_ccf(nchans, proto_taps, 2)
+
+ # Put the pieces back together again
+ syn_taps = [nchans*t for t in proto_taps]
+ synthesizer = gr.pfb_synthesizer_ccf(nchans, syn_taps, True)
+ src_snk = gr.vector_sink_c()
+ snk = gr.vector_sink_c()
+
+ # Remap the location of the channels
+ # Can be done in synth or channelizer (watch out for rotattions in
+ # the channelizer)
+ synthesizer.set_channel_map([ 0, 1, 2, 3, 4,
+ 15, 16, 17, 18, 19])
+
+ tb = gr.top_block()
+ tb.connect(src, mod, chan, rrc, channelizer)
+ tb.connect(rrc, src_snk)
+
+ vsnk = []
+ for i in xrange(nchans):
+ tb.connect((channelizer,i), (synthesizer, i))
+
+ vsnk.append(gr.vector_sink_c())
+ tb.connect((channelizer,i), vsnk[i])
+
+ tb.connect(synthesizer, snk)
+ tb.run()
+
+ sin = scipy.array(src_snk.data()[1000:])
+ sout = scipy.array(snk.data()[1000:])
+
+
+ # Plot original signal
+ fs_in = nchans*fs
+ f1 = pylab.figure(1, figsize=(16,12), facecolor='w')
+ s11 = f1.add_subplot(2,2,1)
+ s11.psd(sin, NFFT=fftlen, Fs=fs_in)
+ s11.set_title("PSD of Original Signal")
+ s11.set_ylim([-200, -20])
+
+ s12 = f1.add_subplot(2,2,2)
+ s12.plot(sin.real[1000:1500], "o-b")
+ s12.plot(sin.imag[1000:1500], "o-r")
+ s12.set_title("Original Signal in Time")
+
+ start = 1
+ skip = 4
+ s13 = f1.add_subplot(2,2,3)
+ s13.plot(sin.real[start::skip], sin.imag[start::skip], "o")
+ s13.set_title("Constellation")
+ s13.set_xlim([-2, 2])
+ s13.set_ylim([-2, 2])
+
+ # Plot channels
+ nrows = int(scipy.sqrt(nchans))
+ ncols = int(scipy.ceil(float(nchans)/float(nrows)))
+
+ f2 = pylab.figure(2, figsize=(16,12), facecolor='w')
+ for n in xrange(nchans):
+ s = f2.add_subplot(nrows, ncols, n+1)
+ s.psd(vsnk[n].data(), NFFT=fftlen, Fs=fs_in)
+ s.set_title("Channel {0}".format(n))
+ s.set_ylim([-200, -20])
+
+ # Plot reconstructed signal
+ fs_out = 2*nchans*fs
+ f3 = pylab.figure(3, figsize=(16,12), facecolor='w')
+ s31 = f3.add_subplot(2,2,1)
+ s31.psd(sout, NFFT=fftlen, Fs=fs_out)
+ s31.set_title("PSD of Reconstructed Signal")
+ s31.set_ylim([-200, -20])
+
+ s32 = f3.add_subplot(2,2,2)
+ s32.plot(sout.real[1000:1500], "o-b")
+ s32.plot(sout.imag[1000:1500], "o-r")
+ s32.set_title("Reconstructed Signal in Time")
+
+ start = 2
+ skip = 4
+ s33 = f3.add_subplot(2,2,3)
+ s33.plot(sout.real[start::skip], sout.imag[start::skip], "o")
+ s33.set_title("Constellation")
+ s33.set_xlim([-2, 2])
+ s33.set_ylim([-2, 2])
+
+ pylab.show()
+
+
+if __name__ == "__main__":
+ try:
+ main()
+ except KeyboardInterrupt:
+ pass
+
diff --git a/gnuradio-core/src/examples/pfb/resampler.py b/gnuradio-core/src/examples/pfb/resampler.py
new file mode 100755
index 000000000..555938d28
--- /dev/null
+++ b/gnuradio-core/src/examples/pfb/resampler.py
@@ -0,0 +1,127 @@
+#!/usr/bin/env python
+#
+# 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.
+#
+
+from gnuradio import gr, blks2
+import sys
+
+try:
+ import scipy
+except ImportError:
+ print "Error: Program requires scipy (see: www.scipy.org)."
+ sys.exit(1)
+
+try:
+ import pylab
+except ImportError:
+ print "Error: Program requires matplotlib (see: matplotlib.sourceforge.net)."
+ sys.exit(1)
+
+class mytb(gr.top_block):
+ def __init__(self, fs_in, fs_out, fc, N=10000):
+ gr.top_block.__init__(self)
+
+ rerate = float(fs_out) / float(fs_in)
+ print "Resampling from %f to %f by %f " %(fs_in, fs_out, rerate)
+
+ # Creating our own taps
+ taps = gr.firdes.low_pass_2(32, 32, 0.25, 0.1, 80)
+
+ self.src = gr.sig_source_c(fs_in, gr.GR_SIN_WAVE, fc, 1)
+ #self.src = gr.noise_source_c(gr.GR_GAUSSIAN, 1)
+ self.head = gr.head(gr.sizeof_gr_complex, N)
+
+ # A resampler with our taps
+ self.resamp_0 = blks2.pfb_arb_resampler_ccf(rerate, taps,
+ flt_size=32)
+
+ # A resampler that just needs a resampling rate.
+ # Filter is created for us and designed to cover
+ # entire bandwidth of the input signal.
+ # An optional atten=XX rate can be used here to
+ # specify the out-of-band rejection (default=80).
+ self.resamp_1 = blks2.pfb_arb_resampler_ccf(rerate)
+
+ self.snk_in = gr.vector_sink_c()
+ self.snk_0 = gr.vector_sink_c()
+ self.snk_1 = gr.vector_sink_c()
+
+ self.connect(self.src, self.head, self.snk_in)
+ self.connect(self.head, self.resamp_0, self.snk_0)
+ self.connect(self.head, self.resamp_1, self.snk_1)
+
+def main():
+ fs_in = 8000
+ fs_out = 20000
+ fc = 1000
+ N = 10000
+
+ tb = mytb(fs_in, fs_out, fc, N)
+ tb.run()
+
+
+ # Plot PSD of signals
+ nfftsize = 2048
+ fig1 = pylab.figure(1, figsize=(10,10), facecolor="w")
+ sp1 = fig1.add_subplot(2,1,1)
+ sp1.psd(tb.snk_in.data(), NFFT=nfftsize,
+ noverlap=nfftsize/4, Fs = fs_in)
+ sp1.set_title(("Input Signal at f_s=%.2f kHz" % (fs_in/1000.0)))
+ sp1.set_xlim([-fs_in/2, fs_in/2])
+
+ sp2 = fig1.add_subplot(2,1,2)
+ sp2.psd(tb.snk_0.data(), NFFT=nfftsize,
+ noverlap=nfftsize/4, Fs = fs_out,
+ label="With our filter")
+ sp2.psd(tb.snk_1.data(), NFFT=nfftsize,
+ noverlap=nfftsize/4, Fs = fs_out,
+ label="With auto-generated filter")
+ sp2.set_title(("Output Signals at f_s=%.2f kHz" % (fs_out/1000.0)))
+ sp2.set_xlim([-fs_out/2, fs_out/2])
+ sp2.legend()
+
+ # Plot signals in time
+ Ts_in = 1.0/fs_in
+ Ts_out = 1.0/fs_out
+ t_in = scipy.arange(0, len(tb.snk_in.data())*Ts_in, Ts_in)
+ t_out = scipy.arange(0, len(tb.snk_0.data())*Ts_out, Ts_out)
+
+ fig2 = pylab.figure(2, figsize=(10,10), facecolor="w")
+ sp21 = fig2.add_subplot(2,1,1)
+ sp21.plot(t_in, tb.snk_in.data())
+ sp21.set_title(("Input Signal at f_s=%.2f kHz" % (fs_in/1000.0)))
+ sp21.set_xlim([t_in[100], t_in[200]])
+
+ sp22 = fig2.add_subplot(2,1,2)
+ sp22.plot(t_out, tb.snk_0.data(),
+ label="With our filter")
+ sp22.plot(t_out, tb.snk_1.data(),
+ label="With auto-generated filter")
+ sp22.set_title(("Output Signals at f_s=%.2f kHz" % (fs_out/1000.0)))
+ r = float(fs_out)/float(fs_in)
+ sp22.set_xlim([t_out[r * 100], t_out[r * 200]])
+ sp22.legend()
+
+ pylab.show()
+
+if __name__ == "__main__":
+ main()
+
diff --git a/gnuradio-core/src/examples/pfb/resampler_demo.grc b/gnuradio-core/src/examples/pfb/resampler_demo.grc
new file mode 100644
index 000000000..468636a5c
--- /dev/null
+++ b/gnuradio-core/src/examples/pfb/resampler_demo.grc
@@ -0,0 +1,598 @@
+<?xml version='1.0' encoding='ASCII'?>
+<flow_graph>
+ <timestamp>Sun Aug 23 11:39:47 2009</timestamp>
+ <block>
+ <key>options</key>
+ <param>
+ <key>id</key>
+ <value>resampler_demo</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>title</key>
+ <value></value>
+ </param>
+ <param>
+ <key>author</key>
+ <value></value>
+ </param>
+ <param>
+ <key>description</key>
+ <value></value>
+ </param>
+ <param>
+ <key>window_size</key>
+ <value>1280, 1024</value>
+ </param>
+ <param>
+ <key>generate_options</key>
+ <value>wx_gui</value>
+ </param>
+ <param>
+ <key>category</key>
+ <value>Custom</value>
+ </param>
+ <param>
+ <key>run</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>realtime_scheduling</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(10, 10)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>import</key>
+ <param>
+ <key>id</key>
+ <value>import_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>import</key>
+ <value>import math</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(11, 59)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable</key>
+ <param>
+ <key>id</key>
+ <value>rs_taps</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>firdes.low_pass(nphases, nphases, frac_bw, 0.5-frac_bw)</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(273, 154)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>gr_add_const_vxx</key>
+ <param>
+ <key>id</key>
+ <value>adder</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>float</value>
+ </param>
+ <param>
+ <key>const</key>
+ <value>-1.0</value>
+ </param>
+ <param>
+ <key>vlen</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(227, 303)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>gr_throttle</key>
+ <param>
+ <key>id</key>
+ <value>throttle</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>float</value>
+ </param>
+ <param>
+ <key>samples_per_second</key>
+ <value>samp_rate</value>
+ </param>
+ <param>
+ <key>vlen</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(227, 493)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>wxgui_fftsink2</key>
+ <param>
+ <key>id</key>
+ <value>orig_fft</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>complex</value>
+ </param>
+ <param>
+ <key>title</key>
+ <value>Original Spectrum</value>
+ </param>
+ <param>
+ <key>samp_rate</key>
+ <value>samp_rate</value>
+ </param>
+ <param>
+ <key>baseband_freq</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>y_per_div</key>
+ <value>10</value>
+ </param>
+ <param>
+ <key>y_divs</key>
+ <value>10</value>
+ </param>
+ <param>
+ <key>ref_level</key>
+ <value>30</value>
+ </param>
+ <param>
+ <key>fft_size</key>
+ <value>1024</value>
+ </param>
+ <param>
+ <key>fft_rate</key>
+ <value>30</value>
+ </param>
+ <param>
+ <key>peak_hold</key>
+ <value>False</value>
+ </param>
+ <param>
+ <key>average</key>
+ <value>False</value>
+ </param>
+ <param>
+ <key>avg_alpha</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>grid_pos</key>
+ <value>1, 0, 1, 3</value>
+ </param>
+ <param>
+ <key>notebook</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(409, 289)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>180</value>
+ </param>
+ </block>
+ <block>
+ <key>wxgui_fftsink2</key>
+ <param>
+ <key>id</key>
+ <value>resamp_fft</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>complex</value>
+ </param>
+ <param>
+ <key>title</key>
+ <value>Resampled Spectrum</value>
+ </param>
+ <param>
+ <key>samp_rate</key>
+ <value>new_rate</value>
+ </param>
+ <param>
+ <key>baseband_freq</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>y_per_div</key>
+ <value>10</value>
+ </param>
+ <param>
+ <key>y_divs</key>
+ <value>10</value>
+ </param>
+ <param>
+ <key>ref_level</key>
+ <value>30</value>
+ </param>
+ <param>
+ <key>fft_size</key>
+ <value>1024</value>
+ </param>
+ <param>
+ <key>fft_rate</key>
+ <value>30</value>
+ </param>
+ <param>
+ <key>peak_hold</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>average</key>
+ <value>False</value>
+ </param>
+ <param>
+ <key>avg_alpha</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>grid_pos</key>
+ <value>2, 0, 1, 3</value>
+ </param>
+ <param>
+ <key>notebook</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(640, 256)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>180</value>
+ </param>
+ </block>
+ <block>
+ <key>gr_sig_source_x</key>
+ <param>
+ <key>id</key>
+ <value>tri_source</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>float</value>
+ </param>
+ <param>
+ <key>samp_rate</key>
+ <value>samp_rate</value>
+ </param>
+ <param>
+ <key>waveform</key>
+ <value>gr.GR_TRI_WAVE</value>
+ </param>
+ <param>
+ <key>freq</key>
+ <value>0.05</value>
+ </param>
+ <param>
+ <key>amp</key>
+ <value>2.0</value>
+ </param>
+ <param>
+ <key>offset</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(21, 271)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>gr_frequency_modulator_fc</key>
+ <param>
+ <key>id</key>
+ <value>fm_mod</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>sensitivity</key>
+ <value>math.pi</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(411, 493)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>blks2_pfb_arb_resampler_ccf</key>
+ <param>
+ <key>id</key>
+ <value>resampler</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>rate</key>
+ <value>float(new_rate)/samp_rate</value>
+ </param>
+ <param>
+ <key>taps</key>
+ <value>rs_taps</value>
+ </param>
+ <param>
+ <key>size</key>
+ <value>nphases</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(641, 477)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable</key>
+ <param>
+ <key>id</key>
+ <value>nphases</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>32</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(185, 153)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable_static_text</key>
+ <param>
+ <key>id</key>
+ <value>samp_rate</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>label</key>
+ <value>Sample Rate</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>44100</value>
+ </param>
+ <param>
+ <key>converver</key>
+ <value>float_converter</value>
+ </param>
+ <param>
+ <key>formatter</key>
+ <value>None</value>
+ </param>
+ <param>
+ <key>grid_pos</key>
+ <value>0, 0, 1, 1</value>
+ </param>
+ <param>
+ <key>notebook</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(179, 14)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable_static_text</key>
+ <param>
+ <key>id</key>
+ <value>new_rate</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>label</key>
+ <value>Resampled Rate</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>48000</value>
+ </param>
+ <param>
+ <key>converver</key>
+ <value>float_converter</value>
+ </param>
+ <param>
+ <key>formatter</key>
+ <value>None</value>
+ </param>
+ <param>
+ <key>grid_pos</key>
+ <value>0, 1, 1, 1</value>
+ </param>
+ <param>
+ <key>notebook</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(328, 15)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable_static_text</key>
+ <param>
+ <key>id</key>
+ <value>frac_bw</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>label</key>
+ <value>Fractional Bandwidth</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>0.45</value>
+ </param>
+ <param>
+ <key>converver</key>
+ <value>float_converter</value>
+ </param>
+ <param>
+ <key>formatter</key>
+ <value>lambda x: "%0.2f"%x</value>
+ </param>
+ <param>
+ <key>grid_pos</key>
+ <value>0,2,1,1</value>
+ </param>
+ <param>
+ <key>notebook</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(473, 14)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <connection>
+ <source_block_id>tri_source</source_block_id>
+ <sink_block_id>adder</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>adder</source_block_id>
+ <sink_block_id>throttle</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>resampler</source_block_id>
+ <sink_block_id>resamp_fft</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>fm_mod</source_block_id>
+ <sink_block_id>resampler</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>fm_mod</source_block_id>
+ <sink_block_id>orig_fft</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>throttle</source_block_id>
+ <sink_block_id>fm_mod</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+</flow_graph>
diff --git a/gnuradio-core/src/examples/pfb/synth_filter.py b/gnuradio-core/src/examples/pfb/synth_filter.py
new file mode 100755
index 000000000..c0f7376ec
--- /dev/null
+++ b/gnuradio-core/src/examples/pfb/synth_filter.py
@@ -0,0 +1,83 @@
+#!/usr/bin/env python
+#
+# Copyright 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.
+#
+
+from gnuradio import gr, blks2
+import sys
+
+try:
+ import scipy
+except ImportError:
+ print "Error: Program requires scipy (see: www.scipy.org)."
+ sys.exit(1)
+
+try:
+ import pylab
+except ImportError:
+ print "Error: Program requires matplotlib (see: matplotlib.sourceforge.net)."
+ sys.exit(1)
+
+def main():
+ N = 1000000
+ fs = 8000
+
+ freqs = [100, 200, 300, 400, 500]
+ nchans = 7
+
+ sigs = list()
+ for fi in freqs:
+ s = gr.sig_source_c(fs, gr.GR_SIN_WAVE, fi, 1)
+ sigs.append(s)
+
+ taps = gr.firdes.low_pass_2(len(freqs), fs, fs/float(nchans)/2, 100, 100)
+ print "Num. Taps = %d (taps per filter = %d)" % (len(taps),
+ len(taps)/nchans)
+ filtbank = gr.pfb_synthesizer_ccf(nchans, taps)
+
+ head = gr.head(gr.sizeof_gr_complex, N)
+ snk = gr.vector_sink_c()
+
+ tb = gr.top_block()
+ tb.connect(filtbank, head, snk)
+
+ for i,si in enumerate(sigs):
+ tb.connect(si, (filtbank, i))
+
+ tb.run()
+
+ if 1:
+ f1 = pylab.figure(1)
+ s1 = f1.add_subplot(1,1,1)
+ s1.plot(snk.data()[1000:])
+
+ fftlen = 2048
+ f2 = pylab.figure(2)
+ s2 = f2.add_subplot(1,1,1)
+ winfunc = scipy.blackman
+ s2.psd(snk.data()[10000:], NFFT=fftlen,
+ Fs = nchans*fs,
+ noverlap=fftlen/4,
+ window = lambda d: d*winfunc(fftlen))
+
+ pylab.show()
+
+if __name__ == "__main__":
+ main()
diff --git a/gnuradio-core/src/examples/pfb/synth_to_chan.py b/gnuradio-core/src/examples/pfb/synth_to_chan.py
new file mode 100755
index 000000000..18b2e7b53
--- /dev/null
+++ b/gnuradio-core/src/examples/pfb/synth_to_chan.py
@@ -0,0 +1,117 @@
+#!/usr/bin/env python
+#
+# Copyright 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.
+#
+
+from gnuradio import gr, blks2
+import sys
+
+try:
+ import scipy
+except ImportError:
+ print "Error: Program requires scipy (see: www.scipy.org)."
+ sys.exit(1)
+
+try:
+ import pylab
+except ImportError:
+ print "Error: Program requires matplotlib (see: matplotlib.sourceforge.net)."
+ sys.exit(1)
+
+def main():
+ N = 1000000
+ fs = 8000
+
+ freqs = [100, 200, 300, 400, 500]
+ nchans = 7
+
+ sigs = list()
+ fmtx = list()
+ for fi in freqs:
+ s = gr.sig_source_f(fs, gr.GR_SIN_WAVE, fi, 1)
+ fm = blks2.nbfm_tx (fs, 4*fs, max_dev=10000, tau=75e-6)
+ sigs.append(s)
+ fmtx.append(fm)
+
+ syntaps = gr.firdes.low_pass_2(len(freqs), fs, fs/float(nchans)/2, 100, 100)
+ print "Synthesis Num. Taps = %d (taps per filter = %d)" % (len(syntaps),
+ len(syntaps)/nchans)
+ chtaps = gr.firdes.low_pass_2(len(freqs), fs, fs/float(nchans)/2, 100, 100)
+ print "Channelizer Num. Taps = %d (taps per filter = %d)" % (len(chtaps),
+ len(chtaps)/nchans)
+ filtbank = gr.pfb_synthesizer_ccf(nchans, syntaps)
+ channelizer = blks2.pfb_channelizer_ccf(nchans, chtaps)
+
+ noise_level = 0.01
+ head = gr.head(gr.sizeof_gr_complex, N)
+ noise = gr.noise_source_c(gr.GR_GAUSSIAN, noise_level)
+ addnoise = gr.add_cc()
+ snk_synth = gr.vector_sink_c()
+
+ tb = gr.top_block()
+
+ tb.connect(noise, (addnoise,0))
+ tb.connect(filtbank, head, (addnoise, 1))
+ tb.connect(addnoise, channelizer)
+ tb.connect(addnoise, snk_synth)
+
+ snk = list()
+ for i,si in enumerate(sigs):
+ tb.connect(si, fmtx[i], (filtbank, i))
+
+ for i in xrange(nchans):
+ snk.append(gr.vector_sink_c())
+ tb.connect((channelizer, i), snk[i])
+
+ tb.run()
+
+ if 1:
+ channel = 1
+ data = snk[channel].data()[1000:]
+
+ f1 = pylab.figure(1)
+ s1 = f1.add_subplot(1,1,1)
+ s1.plot(data[10000:10200] )
+ s1.set_title(("Output Signal from Channel %d" % channel))
+
+ fftlen = 2048
+ winfunc = scipy.blackman
+ #winfunc = scipy.hamming
+
+ f2 = pylab.figure(2)
+ s2 = f2.add_subplot(1,1,1)
+ s2.psd(data, NFFT=fftlen,
+ Fs = nchans*fs,
+ noverlap=fftlen/4,
+ window = lambda d: d*winfunc(fftlen))
+ s2.set_title(("Output PSD from Channel %d" % channel))
+
+ f3 = pylab.figure(3)
+ s3 = f3.add_subplot(1,1,1)
+ s3.psd(snk_synth.data()[1000:], NFFT=fftlen,
+ Fs = nchans*fs,
+ noverlap=fftlen/4,
+ window = lambda d: d*winfunc(fftlen))
+ s3.set_title("Output of Synthesis Filter")
+
+ pylab.show()
+
+if __name__ == "__main__":
+ main()
diff --git a/gnuradio-core/src/examples/tags/CMakeLists.txt b/gnuradio-core/src/examples/tags/CMakeLists.txt
new file mode 100644
index 000000000..2d9dc2083
--- /dev/null
+++ b/gnuradio-core/src/examples/tags/CMakeLists.txt
@@ -0,0 +1,28 @@
+# Copyright 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.
+
+include(GrPython)
+
+GR_PYTHON_INSTALL(PROGRAMS
+ test_file_tags.py
+ uhd_burst_detector.py
+ DESTINATION ${GR_PKG_DATA_DIR}/examples/tags
+ COMPONENT "core_python"
+)
+
diff --git a/gnuradio-core/src/examples/tags/test_file_tags.py b/gnuradio-core/src/examples/tags/test_file_tags.py
new file mode 100755
index 000000000..135626d2c
--- /dev/null
+++ b/gnuradio-core/src/examples/tags/test_file_tags.py
@@ -0,0 +1,55 @@
+#!/usr/bin/env python
+#
+# Copyright 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.
+#
+
+from gnuradio import gr
+import sys
+
+try:
+ import scipy
+except ImportError:
+ print "Error: Program requires scipy (see: www.scipy.org)."
+ sys.exit(1)
+
+def main():
+ data = scipy.arange(0, 32000, 1).tolist()
+ trig = 100*[0,] + 100*[1,]
+
+ src = gr.vector_source_s(data, True)
+ trigger = gr.vector_source_s(trig, True)
+
+ thr = gr.throttle(gr.sizeof_short, 10e3)
+ ann = gr.annotator_alltoall(1000000, gr.sizeof_short)
+ tagger = gr.burst_tagger(gr.sizeof_short)
+
+ fsnk = gr.tagged_file_sink(gr.sizeof_short, 1)
+
+ tb = gr.top_block()
+ tb.connect(src, thr, (tagger, 0))
+ tb.connect(trigger, (tagger, 1))
+ tb.connect(tagger, fsnk)
+
+ tb.run()
+
+if __name__ == "__main__":
+ main()
+
+
diff --git a/gnuradio-core/src/examples/tags/uhd_burst_detector.py b/gnuradio-core/src/examples/tags/uhd_burst_detector.py
new file mode 100755
index 000000000..512fc715d
--- /dev/null
+++ b/gnuradio-core/src/examples/tags/uhd_burst_detector.py
@@ -0,0 +1,116 @@
+#!/usr/bin/env python
+#
+# Copyright 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.
+#
+
+from gnuradio import eng_notation
+from gnuradio import gr
+from gnuradio import uhd
+from gnuradio import window
+from gnuradio.eng_option import eng_option
+from gnuradio.gr import firdes
+from optparse import OptionParser
+
+class uhd_burst_detector(gr.top_block):
+ def __init__(self, uhd_address, options):
+
+ gr.top_block.__init__(self)
+
+ self.uhd_addr = uhd_address
+ self.freq = options.freq
+ self.samp_rate = options.samp_rate
+ self.gain = options.gain
+ self.threshold = options.threshold
+ self.trigger = options.trigger
+
+ self.uhd_src = uhd.single_usrp_source(
+ device_addr=self.uhd_addr,
+ stream_args=uhd.stream_args('fc32'))
+
+ self.uhd_src.set_samp_rate(self.samp_rate)
+ self.uhd_src.set_center_freq(self.freq, 0)
+ self.uhd_src.set_gain(self.gain, 0)
+
+ taps = firdes.low_pass_2(1, 1, 0.4, 0.1, 60)
+ self.chanfilt = gr.fir_filter_ccc(10, taps)
+ self.tagger = gr.burst_tagger(gr.sizeof_gr_complex)
+
+ # Dummy signaler to collect a burst on known periods
+ data = 1000*[0,] + 1000*[1,]
+ self.signal = gr.vector_source_s(data, True)
+
+ # Energy detector to get signal burst
+ ## use squelch to detect energy
+ self.det = gr.simple_squelch_cc(self.threshold, 0.01)
+ ## convert to mag squared (float)
+ self.c2m = gr.complex_to_mag_squared()
+ ## average to debounce
+ self.avg = gr.single_pole_iir_filter_ff(0.01)
+ ## rescale signal for conversion to short
+ self.scale = gr.multiply_const_ff(2**16)
+ ## signal input uses shorts
+ self.f2s = gr.float_to_short()
+
+ # Use file sink burst tagger to capture bursts
+ self.fsnk = gr.tagged_file_sink(gr.sizeof_gr_complex, self.samp_rate)
+
+
+ ##################################################
+ # Connections
+ ##################################################
+ self.connect((self.uhd_src, 0), (self.tagger, 0))
+ self.connect((self.tagger, 0), (self.fsnk, 0))
+
+ if self.trigger:
+ # Connect a dummy signaler to the burst tagger
+ self.connect((self.signal, 0), (self.tagger, 1))
+
+ else:
+ # Connect an energy detector signaler to the burst tagger
+ self.connect(self.uhd_src, self.det)
+ self.connect(self.det, self.c2m, self.avg, self.scale, self.f2s)
+ self.connect(self.f2s, (self.tagger, 1))
+
+ def set_samp_rate(self, samp_rate):
+ self.samp_rate = samp_rate
+ self.uhd_src_0.set_samp_rate(self.samp_rate)
+
+if __name__ == '__main__':
+ parser = OptionParser(option_class=eng_option, usage="%prog: [options]")
+ parser.add_option("-a", "--address", type="string", default="addr=192.168.10.2",
+ help="select address of the device [default=%default]")
+ #parser.add_option("-A", "--antenna", default=None,
+ # help="select Rx Antenna (only on RFX-series boards)")
+ parser.add_option("-f", "--freq", type="eng_float", default=450e6,
+ help="set frequency to FREQ", metavar="FREQ")
+ parser.add_option("-g", "--gain", type="eng_float", default=0,
+ help="set gain in dB [default=%default]")
+ parser.add_option("-R", "--samp-rate", type="eng_float", default=200000,
+ help="set USRP sample rate [default=%default]")
+ parser.add_option("-t", "--threshold", type="float", default=-60,
+ help="Set the detection power threshold (dBm) [default=%default")
+ parser.add_option("-T", "--trigger", action="store_true", default=False,
+ help="Use internal trigger instead of detector [default=%default]")
+ (options, args) = parser.parse_args()
+
+ uhd_addr = options.address
+
+ tb = uhd_burst_detector(uhd_addr, options)
+ tb.run()
diff --git a/gnuradio-core/src/examples/volk_benchmark/CMakeLists.txt b/gnuradio-core/src/examples/volk_benchmark/CMakeLists.txt
new file mode 100644
index 000000000..255d9bf5c
--- /dev/null
+++ b/gnuradio-core/src/examples/volk_benchmark/CMakeLists.txt
@@ -0,0 +1,35 @@
+# 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.
+
+include(GrPython)
+
+GR_PYTHON_INSTALL(PROGRAMS
+ volk_math.py
+ volk_plot.py
+ volk_test_funcs.py
+ volk_types.py
+ DESTINATION ${GR_PKG_DATA_DIR}/examples/volk_benchmark
+ COMPONENT "core_python"
+)
+
+install(
+ FILES README
+ DESTINATION ${GR_PKG_DATA_DIR}/examples/volk_benchmark
+ COMPONENT "core_python"
+)
diff --git a/gnuradio-core/src/examples/volk_benchmark/README b/gnuradio-core/src/examples/volk_benchmark/README
new file mode 100644
index 000000000..c58b40d11
--- /dev/null
+++ b/gnuradio-core/src/examples/volk_benchmark/README
@@ -0,0 +1,252 @@
+VOLK Benchmarking Scripts
+
+The Python programs in this directory are designed to help benchmark
+and compare Volk enhancements to GNU Radio. There are two kinds of
+scripts here: collecting data and displaying the data.
+
+Data collection is done by running a Volk testing script that will
+populate a SQLite database file (volk_results.db by default). The
+plotting utility provided here reads from the database files and plots
+bar graphs to compare the different installations.
+
+These benchmarks can be used to compare previous versions of GNU
+Radio to using Volk; they can be used to compare different Volk
+proto-kernels, as well, by editing the volk_config file; or they could
+be used to compare performance between different machines and/or
+processors.
+
+
+======================================================================
+Volk Profiling
+
+Before doing any kind of Volk benchmarking, it is important to run the
+volk_profile program. The profiler will build a config file for the
+best SIMD architecture for your processor. Run volk_profile that is
+installed into $PREFIX/bin. This program tests all known Volk kernels
+for each proto-kernel supported by the processor. When finished, it
+will write to $HOME/.volk/volk_config the best architecture for the
+VOLK function. This file is read when using a function to know the
+best version of the function to execute.
+
+The volk_config file contains a line for each kernel, where each line
+looks like:
+
+ volk_<KERNEL_NAME> <ARCHITECTURE>
+
+The architecture will be something like (sse, sse2, sse3, avx, neon,
+etc.), depending on your processor.
+
+
+======================================================================
+Benchmark Tests
+
+There are currently two benchmark scripts defined for collecting
+data. There is one that runs through the type conversions that have
+been converted to Volk (volk_types.py) and the other runs through the
+math operators converted to using Volk (volk_math.py).
+
+Script prototypes
+Both have the same structure for use:
+
+----------------------------------------------------------------------
+./volk_<test>.py [-h] -L LABEL [-D DATABASE] [-N NITEMS] [-I ITERATIONS]
+ [--tests [{0,1,2,3} [{0,1,2,3} ...]]] [--list]
+ [--all]
+
+optional arguments:
+ -h, --help show this help message and exit
+ -L LABEL, --label LABEL
+ Label of database table [default: None]
+ -D DATABASE, --database DATABASE
+ Database file to store data in [default:
+ volk_results.db]
+ -N NITEMS, --nitems NITEMS
+ Number of items per iterations [default: 1000000000.0]
+ -I ITERATIONS, --iterations ITERATIONS
+ Number of iterations [default: 20]
+ --tests [{0,1,2,3} [{0,1,2,3} ...]]
+ A list of tests to run; can be a single test or a
+ space-separated list.
+ --list List the available tests
+ --all Run all tests
+----------------------------------------------------------------------
+
+To run, you specify the tests to run and a label to store along with
+the results. To find out what the available tests are, use the
+'--list' option.
+
+To specify a subset of tests, use the '--tests' with space-separated
+list of tests numbers (e.g., --tests 0 2 4 9).
+
+Use the '--all' to run all tests.
+
+The label specified is used as an identifier for the benchmarking
+currently being done. This is required as it is important in
+organizing the data in the database (each label is its own
+table). Usually, the label will specify the type of run being done,
+such as "volk_aligned" or "v3_5_1". In these cases, the "volk_aligned"
+label says that this is for a benchmarking using the GNU Radio version
+that uses the aligned scheduler and Volk calls in the work
+functions. The "v3_5_1" label is if you were benchmarking an installed
+version 3.5.1 of GNU Radio, which is pre-Volk. These will then be
+plotted against each other to see the timing differences.
+
+The 'database' option will output the results to a new database
+file. This can be useful for separating the output of different runs
+or of different benchmarks, such as the types versus the math scripts,
+say, or to distinguish results from different computers.
+
+If rerun using the same database and label, the entries in the table
+will simply be replaced by the new results.
+
+It is often useful to use the 'sqlitebrowser' program to interrogate
+the database file farther, if you are interested in the structure or
+the raw data.
+
+Other parameters of this script set the number of items to process and
+number of iterations to use when computing the benchmarking
+data. These default to 1 billion samples per iteration over 20
+iterations. Expect a default run to take a long time. Using the '-N'
+and '-I' options can be used to change the runtime of the benchmarks
+but are set high to remove problems of variance between iterations.
+
+======================================================================
+Plotting Results
+
+The volk_plot.py script reads a given database file and plots the
+results. The default behavior is to read all of the labels stored in
+the database and plot them as data sets on a bar graph. This shows the
+average time taken to process the number of items given.
+
+The options for the plotting script are:
+
+usage: volk_plot.py [-h] [-D DATABASE] [-E] [-P {mean,min,max}] [-% table]
+
+Plot Volk performance results from a SQLite database. Run one of the volk
+tests first (e.g, volk_math.py)
+
+----------------------------------------------------------------------
+optional arguments:
+ -h, --help show this help message and exit
+ -D DATABASE, --database DATABASE
+ Database file to read data from [default:
+ volk_results.db]
+ -E, --errorbars Show error bars (1 standard dev.)
+ -P {mean,min,max}, --plot {mean,min,max}
+ Set the type of plot to produce [default: mean]
+ -% table, --percent table
+ Show percent difference to the given type [default:
+ None]
+----------------------------------------------------------------------
+
+This script allows you to specify the database used (-D), but will
+always read all rows from all tables from it and display them. You can
+also turn on plotting error bars (1 standard deviation the mean). Be
+careful, though, as some older versions of Matplotlib might have an
+issue with this option.
+
+The mean time is only one possible statistic that we might be
+interested in when looking at the data. It represents the average user
+experience when running a given block. On the other hand, the minimum
+runtime best represents the actual performance of a block given
+minimal OS interruptions while running. Right now, the data collected
+includes the mean, variance, min, and max over the number of
+iterations given. Using the '-P' option, you can specify the type of
+data to plot (mean, min, or max).
+
+Another useful way of looking at the data is to compare the percent
+improvement of a benchmark compared to another. This is done using the
+'-%' option with the provided table (or label) as the baseline. So if
+we were interested in comparing how much the 'volk_aligned' was over
+'v3_5_1', we would specify '-% v3_5_1' to see this. The plot would
+then only show the percent speedup observed using Volk for each of the
+blocks.
+
+
+======================================================================
+Benchmarking Walkthrough
+
+This will walk through an example of benchmarking the new Volk
+implementation versus the pre-Volk GNU Radio. It also shows how to
+look at the SIMD optimized versions versus the generic
+implementations.
+
+Since we introduced Volk in GNU Radio 3.5.2, we will use the following
+labels for our data:
+
+ 1.) volk_aligned: v3.5.2 with volk_profile results in .volk/volk_config
+ 2.) v3_5_2: v3.5.2 with the generic (non-SIMD) calls to Volk
+ 3.) v3_5_1: an installation of GNU Radio from version v3.5.1
+
+We assume that we have installed two versions of GNU Radio.
+
+ v3.5.2 installed into /opt/gr-3_5_2
+ v3.5.1 installed into /opt/gr-3_5_1
+
+To test cases 1 and 2 above, we have to run GNU Radio from the v3.5.2
+installation, so we set the following environmental variables. Note
+that this is written for Ubuntu 11.10. These commands and directories
+may have to be changed depending on your OS and versions.
+
+ export LD_LIBRARY_PATH=/opt/gr-3_5_2/lib
+ export LD_LIBRARY_PATH=/opt/gr-3_5_2/lib/python2.7/dist-packages
+
+Now we can run the benchmark tests, so we will focus on the math
+operators:
+
+ ./volk_math.py -D volk_results_math.db --all -L volk_aligned
+
+When this finishes, the 'volk_results_math.db' will contain our
+results for this run.
+
+We next want to run the generic, non-SIMD, calls. This can be done by
+changing the Volk kernel settings in $HOME/.volk/volk_config. First,
+make a backup of this file. Then edit it and change all architecture
+calls (sse, sse2, etc.) to 'generic.' Now, Volk will only call the
+generic versions of these functions. So we rerun the benchmark with:
+
+ ./volk_math.py -D volk_results_math.db --all -L v3_5_2
+
+Notice that the only thing changed here was the label to 'v3_5_2'.
+
+Next, we want to collect data for the non-Volk version of GNU
+Radio. This is important because some internals to GNU Radio were made
+when adding support for Volk, so it is nice to know what the
+differences do to our performance. First, we set the environmental
+variables to point to the v3.5.1 installation:
+
+ export LD_LIBRARY_PATH=/opt/gr-3_5_1/lib
+ export LD_LIBRARY_PATH=/opt/gr-3_5_1/lib/python2.7/dist-packages
+
+And when we run the test, we use the same command line, but the GNU
+Radio libraries and Python files used come from v3.5.1. We also change
+the label to indicate the different version to store.
+
+ ./volk_math.py -D volk_results_math.db --all -L v3_5_1
+
+We now have a database populated with three tables for the three
+different labels. We can plot them all together by simply running:
+
+ ./volk_plot.py -D volk_results_math.db
+
+This will show the average run times for each of the three
+configurations for all math functions tested. We might also be
+interested to see the difference in performance from the v3.5.1
+version, so we can run:
+
+ ./volk_plot.py -D volk_results_math.db -% v3_5_1
+
+That will plot both the 'volk_aligned' and 'v3_5_2' as a percentage
+improvement over v3_5_1. A positive value indicates that this version
+runs faster than the v3.5.1 version.
+
+
+----------------------------------------------------------------------
+
+Another interesting test case could be to compare results on different
+processors. So if you have different generation Intels, AMD, or
+whatever, you can simply pass the .db file around and run the Volk
+benchmark script to populate the database with different results. For
+this, you would specify a label like '-L i7_2620M' that indicates the
+processor type to uniquely ID the data.
+
diff --git a/gnuradio-core/src/examples/volk_benchmark/volk_math.py b/gnuradio-core/src/examples/volk_benchmark/volk_math.py
new file mode 100755
index 000000000..1d8bf04cc
--- /dev/null
+++ b/gnuradio-core/src/examples/volk_benchmark/volk_math.py
@@ -0,0 +1,151 @@
+#!/usr/bin/env python
+
+from gnuradio import gr
+import argparse
+from volk_test_funcs import *
+
+def multiply_const_cc(N):
+ k = 3.3
+ op = gr.multiply_const_cc(k)
+ tb = helper(N, op, gr.sizeof_gr_complex, gr.sizeof_gr_complex, 1, 1)
+ return tb
+
+######################################################################
+
+def multiply_const_ff(N):
+ k = 3.3
+ op = gr.multiply_const_ff(k)
+ tb = helper(N, op, gr.sizeof_float, gr.sizeof_float, 1, 1)
+ return tb
+
+######################################################################
+
+def multiply_cc(N):
+ op = gr.multiply_cc(1)
+ tb = helper(N, op, gr.sizeof_gr_complex, gr.sizeof_gr_complex, 2, 1)
+ return tb
+
+######################################################################
+
+def multiply_ff(N):
+ op = gr.multiply_ff()
+ tb = helper(N, op, gr.sizeof_float, gr.sizeof_float, 2, 1)
+ return tb
+
+######################################################################
+
+def add_ff(N):
+ op = gr.add_ff()
+ tb = helper(N, op, gr.sizeof_float, gr.sizeof_float, 2, 1)
+ return tb
+
+######################################################################
+
+def conjugate_cc(N):
+ op = gr.conjugate_cc()
+ tb = helper(N, op, gr.sizeof_gr_complex, gr.sizeof_gr_complex, 1, 1)
+ return tb
+
+######################################################################
+
+def multiply_conjugate_cc(N):
+ try:
+ op = gr.multiply_conjugate_cc()
+ tb = helper(N, op, gr.sizeof_gr_complex, gr.sizeof_gr_complex, 2, 1)
+ return tb
+
+ except AttributeError:
+ class s(gr.hier_block2):
+ def __init__(self):
+ gr.hier_block2.__init__(self, "s",
+ gr.io_signature(2, 2, gr.sizeof_gr_complex),
+ gr.io_signature(1, 1, gr.sizeof_gr_complex))
+ conj = gr.conjugate_cc()
+ mult = gr.multiply_cc()
+ self.connect((self,0), (mult,0))
+ self.connect((self,1), conj, (mult,1))
+ self.connect(mult, self)
+
+ op = s()
+ tb = helper(N, op, gr.sizeof_gr_complex, gr.sizeof_gr_complex, 2, 1)
+ return tb
+
+
+######################################################################
+
+def run_tests(func, N, iters):
+ print("Running Test: {0}".format(func.__name__))
+ try:
+ tb = func(N)
+ t = timeit(tb, iters)
+ res = format_results(func.__name__, t)
+ return res
+ except AttributeError:
+ print "\tCould not run test. Skipping."
+ return None
+
+def main():
+ avail_tests = [multiply_const_cc,
+ multiply_const_ff,
+ multiply_cc,
+ multiply_ff,
+ add_ff,
+ conjugate_cc,
+ multiply_conjugate_cc]
+
+ desc='Time an operation to compare with other implementations. \
+ This program runs a simple GNU Radio flowgraph to test a \
+ particular math function, mostly to compare the \
+ Volk-optimized implementation versus a regular \
+ implementation. The results are stored to an SQLite database \
+ that can then be read by volk_plot.py to plot the differences.'
+ parser = argparse.ArgumentParser(description=desc)
+ parser.add_argument('-L', '--label', type=str,
+ required=True, default=None,
+ help='Label of database table [default: %(default)s]')
+ parser.add_argument('-D', '--database', type=str,
+ default="volk_results.db",
+ help='Database file to store data in [default: %(default)s]')
+ parser.add_argument('-N', '--nitems', type=float,
+ default=1e9,
+ help='Number of items per iterations [default: %(default)s]')
+ parser.add_argument('-I', '--iterations', type=int,
+ default=20,
+ help='Number of iterations [default: %(default)s]')
+ parser.add_argument('--tests', type=int, nargs='*',
+ choices=xrange(len(avail_tests)),
+ help='A list of tests to run; can be a single test or a \
+ space-separated list.')
+ parser.add_argument('--list', action='store_true',
+ help='List the available tests')
+ parser.add_argument('--all', action='store_true',
+ help='Run all tests')
+ args = parser.parse_args()
+
+ if(args.list):
+ print "Available Tests to Run:"
+ print "\n".join(["\t{0}: {1}".format(i,f.__name__) for i,f in enumerate(avail_tests)])
+ sys.exit(0)
+
+ N = int(args.nitems)
+ iters = args.iterations
+ label = args.label
+
+ conn = create_connection(args.database)
+ new_table(conn, label)
+
+ if args.all:
+ tests = xrange(len(avail_tests))
+ else:
+ tests = args.tests
+
+ for test in tests:
+ res = run_tests(avail_tests[test], N, iters)
+ if res is not None:
+ replace_results(conn, label, N, iters, res)
+
+if __name__ == "__main__":
+ try:
+ main()
+ except KeyboardInterrupt:
+ pass
diff --git a/gnuradio-core/src/examples/volk_benchmark/volk_plot.py b/gnuradio-core/src/examples/volk_benchmark/volk_plot.py
new file mode 100755
index 000000000..48f992205
--- /dev/null
+++ b/gnuradio-core/src/examples/volk_benchmark/volk_plot.py
@@ -0,0 +1,169 @@
+#!/usr/bin/env python
+
+import sys, math
+import argparse
+from volk_test_funcs import *
+
+try:
+ import matplotlib
+ import matplotlib.pyplot as plt
+except ImportError:
+ sys.stderr.write("Could not import Matplotlib (http://matplotlib.sourceforge.net/)\n")
+ sys.exit(1)
+
+def main():
+ desc='Plot Volk performance results from a SQLite database. ' + \
+ 'Run one of the volk tests first (e.g, volk_math.py)'
+ parser = argparse.ArgumentParser(description=desc)
+ parser.add_argument('-D', '--database', type=str,
+ default='volk_results.db',
+ help='Database file to read data from [default: %(default)s]')
+ parser.add_argument('-E', '--errorbars',
+ action='store_true', default=False,
+ help='Show error bars (1 standard dev.)')
+ parser.add_argument('-P', '--plot', type=str,
+ choices=['mean', 'min', 'max'],
+ default='mean',
+ help='Set the type of plot to produce [default: %(default)s]')
+ parser.add_argument('-%', '--percent', type=str,
+ default=None, metavar="table",
+ help='Show percent difference to the given type [default: %(default)s]')
+ args = parser.parse_args()
+
+ # Set up global plotting properties
+ matplotlib.rcParams['figure.subplot.bottom'] = 0.2
+ matplotlib.rcParams['figure.subplot.top'] = 0.95
+ matplotlib.rcParams['figure.subplot.right'] = 0.98
+ matplotlib.rcParams['ytick.labelsize'] = 16
+ matplotlib.rcParams['xtick.labelsize'] = 16
+ matplotlib.rcParams['legend.fontsize'] = 18
+
+ # Get list of tables to compare
+ conn = create_connection(args.database)
+ tables = list_tables(conn)
+ M = len(tables)
+
+ # Colors to distinguish each table in the bar graph
+ # More than 5 tables will wrap around to the start.
+ colors = ['b', 'r', 'g', 'm', 'k']
+
+ # Set up figure for plotting
+ f0 = plt.figure(0, facecolor='w', figsize=(14,10))
+ s0 = f0.add_subplot(1,1,1)
+
+ # Create a register of names that exist in all tables
+ tmp_regs = []
+ for table in tables:
+ # Get results from the next table
+ res = get_results(conn, table[0])
+
+ tmp_regs.append(list())
+ for r in res:
+ try:
+ tmp_regs[-1].index(r['kernel'])
+ except ValueError:
+ tmp_regs[-1].append(r['kernel'])
+
+ # Get only those names that are common in all tables
+ name_reg = tmp_regs[0]
+ for t in tmp_regs[1:]:
+ name_reg = list(set(name_reg) & set(t))
+ name_reg.sort()
+
+ # Pull the data out for each table into a dictionary
+ # we can ref the table by it's name and the data associated
+ # with a given kernel in name_reg by it's name.
+ # This ensures there is no sorting issue with the data in the
+ # dictionary, so the kernels are plotted against each other.
+ table_data = dict()
+ for i,table in enumerate(tables):
+ # Get results from the next table
+ res = get_results(conn, table[0])
+
+ data = dict()
+ for r in res:
+ data[r['kernel']] = r
+
+ table_data[table[0]] = data
+
+ if args.percent is not None:
+ for i,t in enumerate(table_data):
+ if args.percent == t:
+ norm_data = []
+ for name in name_reg:
+ if(args.plot == 'max'):
+ norm_data.append(table_data[t][name]['max'])
+ elif(args.plot == 'min'):
+ norm_data.append(table_data[t][name]['min'])
+ elif(args.plot == 'mean'):
+ norm_data.append(table_data[t][name]['avg'])
+
+
+ # Plot the results
+ x0 = xrange(len(name_reg))
+ i = 0
+ for t in (table_data):
+ ydata = []
+ stds = []
+ for name in name_reg:
+ stds.append(math.sqrt(table_data[t][name]['var']))
+ if(args.plot == 'max'):
+ ydata.append(table_data[t][name]['max'])
+ elif(args.plot == 'min'):
+ ydata.append(table_data[t][name]['min'])
+ elif(args.plot == 'mean'):
+ ydata.append(table_data[t][name]['avg'])
+
+ if args.percent is not None:
+ ydata = [-100*(y-n)/y for y,n in zip(ydata,norm_data)]
+ if(args.percent != t):
+ # makes x values for this data set placement
+ # width of bars depends on number of comparisons
+ wdth = 0.80/(M-1)
+ x1 = [x + i*wdth for x in x0]
+ i += 1
+
+ s0.bar(x1, ydata, width=wdth,
+ color=colors[(i-1)%M], label=t,
+ edgecolor='k', linewidth=2)
+
+ else:
+ # makes x values for this data set placement
+ # width of bars depends on number of comparisons
+ wdth = 0.80/M
+ x1 = [x + i*wdth for x in x0]
+ i += 1
+
+ if(args.errorbars is False):
+ s0.bar(x1, ydata, width=wdth,
+ color=colors[(i-1)%M], label=t,
+ edgecolor='k', linewidth=2)
+ else:
+ s0.bar(x1, ydata, width=wdth,
+ yerr=stds,
+ color=colors[i%M], label=t,
+ edgecolor='k', linewidth=2,
+ error_kw={"ecolor": 'k', "capsize":5,
+ "linewidth":2})
+
+ nitems = res[0]['nitems']
+ if args.percent is None:
+ s0.set_ylabel("Processing time (sec) [{0:G} items]".format(nitems),
+ fontsize=22, fontweight='bold',
+ horizontalalignment='center')
+ else:
+ s0.set_ylabel("% Improvement over {0} [{1:G} items]".format(
+ args.percent, nitems),
+ fontsize=22, fontweight='bold')
+
+ s0.legend()
+ s0.set_xticks(x0)
+ s0.set_xticklabels(name_reg)
+ for label in s0.xaxis.get_ticklabels():
+ label.set_rotation(45)
+ label.set_fontsize(16)
+
+ plt.show()
+
+if __name__ == "__main__":
+ main()
diff --git a/gnuradio-core/src/examples/volk_benchmark/volk_test_funcs.py b/gnuradio-core/src/examples/volk_benchmark/volk_test_funcs.py
new file mode 100644
index 000000000..0ce25fcc6
--- /dev/null
+++ b/gnuradio-core/src/examples/volk_benchmark/volk_test_funcs.py
@@ -0,0 +1,171 @@
+#!/usr/bin/env python
+
+from gnuradio import gr
+import math, sys, os, time
+
+try:
+ import scipy
+except ImportError:
+ sys.stderr.write("Unable to import Scipy (www.scipy.org)\n")
+ sys.exit(1)
+
+try:
+ import sqlite3
+except ImportError:
+ sys.stderr.write("Unable to import sqlite3: requires Python 2.5\n")
+ sys.exit(1)
+
+def execute(conn, cmd):
+ '''
+ Executes the command cmd to the database opened in connection conn.
+ '''
+ c = conn.cursor()
+ c.execute(cmd)
+ conn.commit()
+ c.close()
+
+def create_connection(database):
+ '''
+ Returns a connection object to the SQLite database.
+ '''
+ return sqlite3.connect(database)
+
+def new_table(conn, tablename):
+ '''
+ Create a new table for results.
+ All results are in the form: [kernel | nitems | iters | avg. time | variance | max time | min time ]
+ Each table is meant as a different setting (e.g., volk_aligned, volk_unaligned, etc.)
+ '''
+ cols = "kernel text, nitems int, iters int, avg real, var real, max real, min real"
+ cmd = "create table if not exists {0} ({1})".format(
+ tablename, cols)
+ execute(conn, cmd)
+
+def replace_results(conn, tablename, nitems, iters, res):
+ '''
+ Inserts or replaces the results 'res' dictionary values into the table.
+ This deletes all old entries of the kernel in this table.
+ '''
+ cmd = "DELETE FROM {0} where kernel='{1}'".format(tablename, res["kernel"])
+ execute(conn, cmd)
+ insert_results(conn, tablename, nitems, iters, res)
+
+def insert_results(conn, tablename, nitems, iters, res):
+ '''
+ Inserts the results dictionary values into the table.
+ '''
+ cols = "kernel, nitems, iters, avg, var, max, min"
+ cmd = "INSERT INTO {0} ({1}) VALUES ('{2}', {3}, {4}, {5}, {6}, {7}, {8})".format(
+ tablename, cols, res["kernel"], nitems, iters,
+ res["avg"], res["var"], res["max"], res["min"])
+ execute(conn, cmd)
+
+def list_tables(conn):
+ '''
+ Returns a list of all tables in the database.
+ '''
+ cmd = "SELECT name FROM sqlite_master WHERE type='table' ORDER BY name"
+ c = conn.cursor()
+ c.execute(cmd)
+ t = c.fetchall()
+ c.close()
+
+ return t
+
+def get_results(conn, tablename):
+ '''
+ Gets all results in tablename.
+ '''
+ cmd = "SELECT * FROM {0}".format(tablename)
+ c = conn.cursor()
+ c.execute(cmd)
+ fetched = c.fetchall()
+ c.close()
+
+ res = list()
+ for f in fetched:
+ r = dict()
+ r['kernel'] = f[0]
+ r['nitems'] = f[1]
+ r['iters'] = f[2]
+ r['avg'] = f[3]
+ r['var'] = f[4]
+ r['min'] = f[5]
+ r['max'] = f[6]
+ res.append(r)
+
+ return res
+
+
+class helper(gr.top_block):
+ '''
+ Helper function to run the tests. The parameters are:
+ N: number of items to process (int)
+ op: The GR block/hier_block to test
+ isizeof: the sizeof the input type
+ osizeof: the sizeof the output type
+ nsrcs: number of inputs to the op
+ nsnks: number of outputs of the op
+
+ This function can only handle blocks where all inputs are the same
+ datatype and all outputs are the same data type
+ '''
+ def __init__(self, N, op,
+ isizeof=gr.sizeof_gr_complex,
+ osizeof=gr.sizeof_gr_complex,
+ nsrcs=1, nsnks=1):
+ gr.top_block.__init__(self, "helper")
+
+ self.op = op
+ self.srcs = []
+ self.snks = []
+ self.head = gr.head(isizeof, N)
+
+ for n in xrange(nsrcs):
+ self.srcs.append(gr.null_source(isizeof))
+
+ for n in xrange(nsnks):
+ self.snks.append(gr.null_sink(osizeof))
+
+ self.connect(self.srcs[0], self.head, (self.op,0))
+
+ for n in xrange(1, nsrcs):
+ self.connect(self.srcs[n], (self.op,n))
+
+ for n in xrange(nsnks):
+ self.connect((self.op,n), self.snks[n])
+
+def timeit(tb, iterations):
+ '''
+ Given a top block, this function times it for a number of
+ iterations and stores the time in a list that is returned.
+ '''
+ r = gr.enable_realtime_scheduling()
+ if r != gr.RT_OK:
+ print "Warning: failed to enable realtime scheduling"
+
+ times = []
+ for i in xrange(iterations):
+ start_time = time.time()
+ tb.run()
+ end_time = time.time()
+ tb.head.reset()
+
+ times.append(end_time - start_time)
+
+ return times
+
+def format_results(kernel, times):
+ '''
+ Convinience function to convert the results of the timeit function
+ into a dictionary.
+ '''
+ res = dict()
+ res["kernel"] = kernel
+ res["avg"] = scipy.mean(times)
+ res["var"] = scipy.var(times)
+ res["max"] = max(times)
+ res["min"] = min(times)
+ return res
+
+
diff --git a/gnuradio-core/src/examples/volk_benchmark/volk_types.py b/gnuradio-core/src/examples/volk_benchmark/volk_types.py
new file mode 100755
index 000000000..5dac23c53
--- /dev/null
+++ b/gnuradio-core/src/examples/volk_benchmark/volk_types.py
@@ -0,0 +1,182 @@
+#!/usr/bin/env python
+
+from gnuradio import gr
+import argparse
+from volk_test_funcs import *
+
+######################################################################
+
+def float_to_char(N):
+ op = gr.float_to_char()
+ tb = helper(N, op, gr.sizeof_float, gr.sizeof_char, 1, 1)
+ return tb
+
+######################################################################
+
+def float_to_int(N):
+ op = gr.float_to_int()
+ tb = helper(N, op, gr.sizeof_float, gr.sizeof_int, 1, 1)
+ return tb
+
+######################################################################
+
+def float_to_short(N):
+ op = gr.float_to_short()
+ tb = helper(N, op, gr.sizeof_float, gr.sizeof_short, 1, 1)
+ return tb
+
+######################################################################
+
+def short_to_float(N):
+ op = gr.short_to_float()
+ tb = helper(N, op, gr.sizeof_short, gr.sizeof_float, 1, 1)
+ return tb
+
+######################################################################
+
+def short_to_char(N):
+ op = gr.short_to_char()
+ tb = helper(N, op, gr.sizeof_short, gr.sizeof_char, 1, 1)
+ return tb
+
+######################################################################
+
+def char_to_short(N):
+ op = gr.char_to_short()
+ tb = helper(N, op, gr.sizeof_char, gr.sizeof_short, 1, 1)
+ return tb
+
+######################################################################
+
+def char_to_float(N):
+ op = gr.char_to_float()
+ tb = helper(N, op, gr.sizeof_char, gr.sizeof_float, 1, 1)
+ return tb
+
+######################################################################
+
+def int_to_float(N):
+ op = gr.int_to_float()
+ tb = helper(N, op, gr.sizeof_int, gr.sizeof_float, 1, 1)
+ return tb
+
+######################################################################
+
+def complex_to_float(N):
+ op = gr.complex_to_float()
+ tb = helper(N, op, gr.sizeof_gr_complex, gr.sizeof_float, 1, 2)
+ return tb
+
+######################################################################
+
+def complex_to_real(N):
+ op = gr.complex_to_real()
+ tb = helper(N, op, gr.sizeof_gr_complex, gr.sizeof_float, 1, 1)
+ return tb
+
+######################################################################
+
+def complex_to_imag(N):
+ op = gr.complex_to_imag()
+ tb = helper(N, op, gr.sizeof_gr_complex, gr.sizeof_float, 1, 1)
+ return tb
+
+######################################################################
+
+def complex_to_mag(N):
+ op = gr.complex_to_mag()
+ tb = helper(N, op, gr.sizeof_gr_complex, gr.sizeof_float, 1, 1)
+ return tb
+
+######################################################################
+
+def complex_to_mag_squared(N):
+ op = gr.complex_to_mag_squared()
+ tb = helper(N, op, gr.sizeof_gr_complex, gr.sizeof_float, 1, 1)
+ return tb
+
+######################################################################
+
+
+def run_tests(func, N, iters):
+ print("Running Test: {0}".format(func.__name__))
+ try:
+ tb = func(N)
+ t = timeit(tb, iters)
+ res = format_results(func.__name__, t)
+ return res
+ except AttributeError:
+ print "\tCould not run test. Skipping."
+ return None
+
+def main():
+ avail_tests = [float_to_char,
+ float_to_int,
+ float_to_short,
+ short_to_float,
+ short_to_char,
+ char_to_short,
+ char_to_float,
+ int_to_float,
+ complex_to_float,
+ complex_to_real,
+ complex_to_imag,
+ complex_to_mag,
+ complex_to_mag_squared]
+
+ desc='Time an operation to compare with other implementations. \
+ This program runs a simple GNU Radio flowgraph to test a \
+ particular math function, mostly to compare the \
+ Volk-optimized implementation versus a regular \
+ implementation. The results are stored to an SQLite database \
+ that can then be read by volk_plot.py to plot the differences.'
+ parser = argparse.ArgumentParser(description=desc)
+ parser.add_argument('-L', '--label', type=str,
+ required=True, default=None,
+ help='Label of database table [default: %(default)s]')
+ parser.add_argument('-D', '--database', type=str,
+ default="volk_results.db",
+ help='Database file to store data in [default: %(default)s]')
+ parser.add_argument('-N', '--nitems', type=float,
+ default=1e9,
+ help='Number of items per iterations [default: %(default)s]')
+ parser.add_argument('-I', '--iterations', type=int,
+ default=20,
+ help='Number of iterations [default: %(default)s]')
+ parser.add_argument('--tests', type=int, nargs='*',
+ choices=xrange(len(avail_tests)),
+ help='A list of tests to run; can be a single test or a \
+ space-separated list.')
+ parser.add_argument('--list', action='store_true',
+ help='List the available tests')
+ parser.add_argument('--all', action='store_true',
+ help='Run all tests')
+ args = parser.parse_args()
+
+ if(args.list):
+ print "Available Tests to Run:"
+ print "\n".join(["\t{0}: {1}".format(i,f.__name__) for i,f in enumerate(avail_tests)])
+ sys.exit(0)
+
+ N = int(args.nitems)
+ iters = args.iterations
+ label = args.label
+
+ conn = create_connection(args.database)
+ new_table(conn, label)
+
+ if args.all:
+ tests = xrange(len(avail_tests))
+ else:
+ tests = args.tests
+
+ for test in tests:
+ res = run_tests(avail_tests[test], N, iters)
+ if res is not None:
+ replace_results(conn, label, N, iters, res)
+
+if __name__ == "__main__":
+ try:
+ main()
+ except KeyboardInterrupt:
+ pass
diff --git a/gnuradio-core/src/gen_interpolator_taps/Makefile.am.obsolete b/gnuradio-core/src/gen_interpolator_taps/Makefile.am.obsolete
new file mode 100644
index 000000000..cd0edaf5c
--- /dev/null
+++ b/gnuradio-core/src/gen_interpolator_taps/Makefile.am.obsolete
@@ -0,0 +1,39 @@
+#
+# Copyright 2002 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 $(top_srcdir)/Makefile.common
+
+EXTRA_DIST += \
+ praxis.txt \
+ simpson.h \
+ objective_fct.c \
+ gen_interpolator_taps.c \
+ simpson.c \
+ praxis.f
+
+# if ENABLE_FORTRAN
+# noinst_PROGRAMS = gen_interpolator_taps
+# noinst_HEADERS = simpson.h
+#
+# gen_interpolator_taps_SOURCES = gen_interpolator_taps.c objective_fct.c simpson.c praxis.f
+# gen_interpolator_taps_LDADD = $(FLIBS) -lm
+#
+# endif
diff --git a/gnuradio-core/src/gen_interpolator_taps/README b/gnuradio-core/src/gen_interpolator_taps/README
new file mode 100644
index 000000000..8fe3e2ba3
--- /dev/null
+++ b/gnuradio-core/src/gen_interpolator_taps/README
@@ -0,0 +1,47 @@
+#
+# Copyright 2002 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 contains the source for gen_interpolator_taps, a program
+which generates optimal interpolator taps for a fractional
+interpolator.
+
+The ideal interpolator requires an infinite tap FIR filter to
+realize. We design a separate 8 tap filter for each value of mu,
+the fractional delay, that we are interested in. The taps are
+selected such that the mean squared error between the ideal frequency
+response and the approximation is mininimized over all frequencies of
+interest. In this implementation we define ``frequencies of
+interest'' as those from -B to +B, where B = 1/(4*Ts), where Ts is the
+sampling period.
+
+For a detailed look at what this is all about, please see Chapter 9 of
+"Digital Communication Receivers: Synchronization, Channel Estimation
+and Signal Processing" by Meyr, Moeneclaey and Fechtel, ISBN 0-471-50275-8
+
+NOTE, if you're running gen_interpolator_taps and it seg faults in
+RANDOM, you're probably using g77-2.96. The fix is to use g77 3.0 or later
+
+ cd <top_of_build_tree>
+ rm config.cache
+ export F77=g77-3.0.4
+ ./configure
+ make
diff --git a/gnuradio-core/src/gen_interpolator_taps/gen_interpolator_taps.c b/gnuradio-core/src/gen_interpolator_taps/gen_interpolator_taps.c
new file mode 100644
index 000000000..2f359102c
--- /dev/null
+++ b/gnuradio-core/src/gen_interpolator_taps/gen_interpolator_taps.c
@@ -0,0 +1,186 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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 <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+
+#define NSTEPS 10 // how many steps of mu are in the generated table
+#define MAX_NSTEPS 256
+#define NTAPS 8 // # of taps in the interpolator
+#define MAX_NTAPS 128
+
+extern void initpt (double x[], int ntaps);
+extern double objective (double x[], int *ntaps);
+extern double global_mu;
+extern double global_B;
+
+// fortran
+extern double prax2_ (double (fct)(double x[], int *ntaps),
+ double initv[], int *ntaps, double result[]);
+
+static void
+usage (char *name)
+{
+ fprintf (stderr, "usage: %s [-v] [-n <nsteps>] [-t <ntaps>] [-B <bw>]\n", name);
+ exit (1);
+}
+
+static void
+printline (double x[], int ntaps, int imu, int nsteps)
+{
+ int i;
+
+ printf (" { ");
+ for (i = 0; i < ntaps; i++){
+ printf ("%12.5e", x[i]);
+ if (i != ntaps - 1)
+ printf (", ");
+ else
+ printf (" }, // %3d/%d\n", imu, nsteps);
+ }
+}
+
+int
+main (int argc, char **argv)
+{
+ double xx[MAX_NSTEPS+1][MAX_NTAPS];
+ int ntaps = NTAPS;
+ int nsteps = NSTEPS;
+ int i, j;
+ double result;
+ double step_size;
+ int c;
+ int verbose = 0;
+
+ global_B = 0.25;
+
+ while ((c = getopt (argc, argv, "n:t:B:v")) != EOF){
+ switch (c){
+ case 'n':
+ nsteps = strtol (optarg, 0, 0);
+ break;
+
+ case 't':
+ ntaps = strtol (optarg, 0, 0);
+ break;
+
+ case 'B':
+ global_B = strtod (optarg, 0);
+ break;
+
+ case 'v':
+ verbose = 1;
+ break;
+
+ default:
+ usage (argv[0]);
+ break;
+ }
+ }
+
+ if ((nsteps & 1) != 0){
+ fprintf (stderr, "%s: nsteps must be even\n", argv[0]);
+ exit (1);
+ }
+
+ if (nsteps > MAX_NSTEPS){
+ fprintf (stderr, "%s: nsteps must be < %d\n", argv[0], MAX_NSTEPS);
+ exit (1);
+ }
+
+ if ((ntaps & 1) != 0){
+ fprintf (stderr, "%s: ntaps must be even\n", argv[0]);
+ exit (1);
+ }
+
+ if (nsteps > MAX_NTAPS){
+ fprintf (stderr, "%s: ntaps must be < %d\n", argv[0], MAX_NTAPS);
+ exit (1);
+ }
+
+ if (global_B < 0 || global_B > 0.5){
+ fprintf (stderr, "%s: bandwidth must be in the range (0, 0.5)\n", argv[0]);
+ exit (1);
+ }
+
+ step_size = 1.0/nsteps;
+
+ // the optimizer chokes on the two easy cases (0/N and N/N). We do them by hand...
+
+ for (i = 0; i < ntaps; i++)
+ xx[0][i] = 0.0;
+ xx[0][ntaps/2] = 1.0;
+
+
+ // compute optimal values for mu <= 0.5
+
+ for (j = 1; j <= nsteps/2; j++){
+
+ global_mu = j * step_size; // this determines the MU for which we're computing the taps
+
+ // initialize X to a reasonable starting value
+
+ initpt (&xx[j][0], ntaps);
+
+ // find the value of X that minimizes the value of OBJECTIVE
+
+ result = prax2_ (objective, &xx[j][0], &ntaps, &xx[j][0]);
+
+ if (verbose){
+ fprintf (stderr, "Mu: %10.8f\t", global_mu);
+ fprintf (stderr, "Objective: %g\n", result);
+ }
+ }
+
+ // now compute remaining values via symmetry
+
+ for (j = 0; j < nsteps/2; j++){
+ for (i = 0; i < ntaps; i++){
+ xx[nsteps - j][i] = xx[j][ntaps-i-1];
+ }
+ }
+
+ // now print out the table
+
+ printf ("\
+/*\n\
+ * This file was machine generated by gen_interpolator_taps.\n\
+ * DO NOT EDIT BY HAND.\n\
+ */\n\n");
+
+
+ printf ("static const int NTAPS = %4d;\n", ntaps);
+ printf ("static const int NSTEPS = %4d;\n", nsteps);
+ printf ("static const double BANDWIDTH = %g;\n\n", global_B);
+
+ printf ("static const float taps[NSTEPS+1][NTAPS] = {\n");
+ printf (" // -4 -3 -2 -1 0 1 2 3 mu\n");
+
+
+ for (i = 0; i <= nsteps; i++)
+ printline (xx[i], ntaps, i, nsteps);
+
+ printf ("};\n\n");
+
+ return 0;
+}
diff --git a/gnuradio-core/src/gen_interpolator_taps/objective_fct.c b/gnuradio-core/src/gen_interpolator_taps/objective_fct.c
new file mode 100644
index 000000000..129486d63
--- /dev/null
+++ b/gnuradio-core/src/gen_interpolator_taps/objective_fct.c
@@ -0,0 +1,124 @@
+/* -*- c -*- */
+/*
+ * Copyright 2002 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.
+ */
+
+/*
+ * generate MMSE FIR interpolation table values
+ */
+
+#include <math.h>
+#include <assert.h>
+#include "simpson.h"
+
+#define MU 0.5 /* the MU for which we're computing coeffs */
+
+#define Ts (1.0) /* sampling period */
+#define B (1.0/(4*Ts)) /* one-sided signal bandwidth */
+//#define B (1.0/(8./3*Ts)) /* one-sided signal bandwidth */
+
+static unsigned global_n;
+static double *global_h;
+double global_mu = MU;
+double global_B = B;
+
+/*
+ * This function computes the difference squared between the ideal
+ * interpolator frequency response at frequency OMEGA and the
+ * approximation defined by the FIR coefficients in global_h[]
+ *
+ * See eqn (9-7), "Digital Communication Receivers", Meyr, Moeneclaey
+ * and Fechtel, Wiley, 1998.
+ */
+
+static double
+integrand (double omega)
+{
+ double real_ideal;
+ double real_approx;
+ double real_diff;
+ double imag_ideal;
+ double imag_approx;
+ double imag_diff;
+
+ int i, n;
+ int I1;
+ double *h;
+
+ real_ideal = cos (omega * Ts * global_mu);
+ imag_ideal = sin (omega * Ts * global_mu);
+
+ n = global_n;
+ h = global_h;
+ I1 = -(n / 2);
+
+ real_approx = 0;
+ imag_approx = 0;
+
+ for (i = 0; i < n; i++){
+ real_approx += h[i] * cos (-omega * Ts * (i + I1));
+ imag_approx += h[i] * sin (-omega * Ts * (i + I1));
+ }
+
+ real_diff = real_ideal - real_approx;
+ imag_diff = imag_ideal - imag_approx;
+
+ return real_diff * real_diff + imag_diff * imag_diff;
+}
+
+/*
+ * Integrate the difference squared over all frequencies of interest.
+ */
+double
+c_fcn (double *x, int n)
+{
+ assert ((n & 1) == 0); /* assert n is even */
+ global_n = n;
+ global_h = x;
+ return qsimp (integrand, -2 * M_PI * global_B, 2 * M_PI * global_B);
+}
+
+/* this is the interface expected by the calling fortran code */
+
+double
+objective (double x[], int *ndim)
+{
+ return c_fcn (x, *ndim);
+}
+
+static double
+si (double x)
+{
+ if (fabs (x) < 1e-9)
+ return 1.0;
+
+ return sin(x) / x;
+}
+
+/*
+ * starting guess for optimization
+ */
+void initpt (double x[], int ndim)
+{
+ int i;
+ for (i = 0; i < ndim; i++){
+ x[i] = si (M_PI * ((double) (i - ndim/2) + global_mu));
+ }
+}
diff --git a/gnuradio-core/src/gen_interpolator_taps/praxis.f b/gnuradio-core/src/gen_interpolator_taps/praxis.f
new file mode 100644
index 000000000..9f3e03c97
--- /dev/null
+++ b/gnuradio-core/src/gen_interpolator_taps/praxis.f
@@ -0,0 +1,1705 @@
+C
+C Copyright 2002 Free Software Foundation, Inc.
+C
+C This file is part of GNU Radio
+C
+C GNU Radio is free software; you can redistribute it and/or modify
+C it under the terms of the GNU General Public License as published by
+C the Free Software Foundation; either version 3, or (at your option)
+C any later version.
+C
+C GNU Radio is distributed in the hope that it will be useful,
+C but WITHOUT ANY WARRANTY; without even the implied warranty of
+C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+C GNU General Public License for more details.
+C
+C You should have received a copy of the GNU General Public License
+C along with GNU Radio; see the file COPYING. If not, write to
+C the Free Software Foundation, Inc., 51 Franklin Street,
+C Boston, MA 02110-1301, USA.
+C
+ DOUBLE PRECISION FUNCTION PRAX2(F,INITV,NDIM,OUT)
+ DOUBLE PRECISION INITV(128),OUT(128), F
+ INTEGER NDIM
+ EXTERNAL F
+C
+ DOUBLE PRECISION V,X,D,Q0,Q1,DMIN,EPSMCH,FX,H,QD0,QD1,QF1,
+ * SMALL,T,XLDT,XM2,XM4,DSEED,SCBD
+C
+ COMMON /CPRAX/ V(128,128),X(128),D(128),Q0(128),Q1(128),
+ * DMIN,EPSMCH,FX,H,QD0,QD1,QF1,SMALL,T,XLDT,XM2,XM4,DSEED,SCBD,
+ * N,NL,NF,LP,JPRINT,NMAX,ILLCIN,KTM,NFMAX,JRANCH
+
+C
+ N=NDIM
+ do 10 I=1,N
+ 10 X(I) = INITV(I)
+
+C
+ call praset
+
+C -1 produces no diagnostic output
+ jprint = -1
+ nfmax = 3000
+C tighter tolerance
+ T=1.0D-6
+C
+ call praxis(f)
+C
+ do 30 I=1,N
+ 30 OUT(I) = X(I)
+C
+ prax2 = fx
+ return
+ end
+
+
+ SUBROUTINE PRASET
+C
+C PRASET 1.0 JUNE 1995
+C
+C SET INITIAL VALUES FOR SOME QUANTITIES USED IN SUBROUTINE PRAXIS.
+C THE USER CAN RESET THESE, IF DESIRED,
+C AFTER CALLING PRASET AND BEFORE CALLING PRAXIS.
+C
+C J. P. CHANDLER, COMPUTER SCIENCE DEPARTMENT,
+C OKLAHOMA STATE UNIVERSITY
+C
+C ON MANY MACHINES, SUBROUTINE PRAXIS WILL CAUSE UNDERFLOW AND/OR
+C DIVIDE CHECK WHEN COMPUTING EPSMCH**4 AND EPSMCH**(-4).
+C IN THAT CASE, SET EPSMCH=1.0D-9 (OR POSSIBLY EPSMCH=1.0D-8)
+C AFTER CALLING SUBROUTINE PRASET.
+C
+ INTEGER N,NL,NF,LP,JPRINT,NMAX,ILLCIN,KTM,NFMAX,JRANCH
+ INTEGER J
+C
+ DOUBLE PRECISION V,X,D,Q0,Q1,DMIN,EPSMCH,FX,H,QD0,QD1,QF1,
+ * SMALL,T,XLDT,XM2,XM4,DSEED,SCBD
+ DOUBLE PRECISION A,B,XMID,XPLUS,RZERO,UNITR,RTWO
+C
+ COMMON /CPRAX/ V(128,128),X(128),D(128),Q0(128),Q1(128),
+ * DMIN,EPSMCH,FX,H,QD0,QD1,QF1,SMALL,T,XLDT,XM2,XM4,DSEED,SCBD,
+ * N,NL,NF,LP,JPRINT,NMAX,ILLCIN,KTM,NFMAX,JRANCH
+C
+ RZERO=0.0D0
+ UNITR=1.0D0
+ RTWO=2.0D0
+C
+C NMAX IS THE DIMENSION OF THE ARRAYS V(*,*), X(*), D(*),
+C Q0(*), AND Q1(*).
+C
+ NMAX=128
+C
+C NFMAX IS THE MAXIMUM NUMBER OF FUNCTION EVALUATIONS PERMITTED.
+C
+ NFMAX=100000
+C
+C LP IS THE LOGICAL UNIT NUMBER FOR PRINTED OUTPUT.
+C
+ LP=6
+C
+C T IS A CONVERGENCE TOLERANCE USED IN SUBROUTINE PRAXIS.
+C
+ T=1.0D-5
+C
+C JPRINT CONTROLS PRINTED OUTPUT IN PRAXIS.
+C
+ JPRINT=4
+C
+C H IS AN ESTIMATE OF THE DISTANCE FROM THE INITIAL POINT
+C TO THE SOLUTION.
+C
+ H=1.0D0
+C
+C USE BISECTION TO COMPUTE THE VALUE OF EPSMCH, "MACHINE EPSILON".
+C EPSMCH IS THE SMALLEST FLOATING POINT (REAL OR DOUBLE PRECISION)
+C NUMBER WHICH, WHEN ADDED TO ONE, GIVES A RESULT GREATER THAN ONE.
+C
+ A=RZERO
+ B=UNITR
+ 10 XMID=A+(B-A)/RTWO
+ IF(XMID.LE.A .OR. XMID.GE.B) GO TO 20
+ XPLUS=UNITR+XMID
+ IF(XPLUS.GT.UNITR) THEN
+ B=XMID
+ ELSE
+ A=XMID
+ ENDIF
+ GO TO 10
+C
+ 20 EPSMCH=B
+C
+ DO 30 J=1,NMAX
+ X(J)=RZERO
+ 30 CONTINUE
+C
+C JRANCH = 1 TO USE BRENT'S RANDOM,
+C JRANCH = 2 TO USE FUNCTION DRANDM.
+C
+ JRANCH=1
+C
+ CALL RANINI(4.0D0)
+C
+C DSEED IS AN INITIAL SEED FOR DRANDM,
+C A SUBROUTINE THAT GENERATES PSEUDORANDOM NUMBERS
+C UNIFORMLY DISTRIBUTED ON (0,1).
+C
+ DSEED=1234567.0D0
+C
+C SCBD IS AN UPPER BOUND ON THE SCALE FACTORS IN PRAXIS.
+C IF THE AXES MAY BE BADLY SCALED (WHICH IS TO BE AVOIDED IF
+C POSSIBLE) THEN SET SCBD = 10, OTHERWISE 1.
+C
+ SCBD=1.0D0
+C
+C ILLCIN IS THE INITIAL VALUE OF ILLC,
+C THE FLAG THAT SIGNALS AN ILL-CONDITIONED PROBLEM.
+C IF THE PROBLEM IS KNOWN TO BE ILL-CONDITIONED SET ILLCIN=1,
+C OTHERWISE 0.
+C
+ ILLCIN=0
+C
+C KTM IS A CONVERGENCE SWITCH USED IN PRAXIS.
+C KTM+1 IS THE NUMBER OF ITERATIONS WITHOUT IMPROVEMENT
+C BEFORE THE ALGORITHM TERMINATES.
+C KTM=4 IS VERY CAUTIOUS.
+C USUALLY KTM=1 IS SATISFACTORY.
+C
+ KTM=1
+C
+ RETURN
+C
+C END PRASET
+C
+ END
+ SUBROUTINE PRAXIS(F)
+C
+C PRAXIS 2.0 JUNE 1995
+C
+C THE PRAXIS PACKAGE MINIMIZES THE FUNCTION F(X,N) OF N
+C VARIABLES X(1),...,X(N), USING THE PRINCIPAL AXIS METHOD.
+C F MUST BE A SMOOTH (CONTINUOUSLY DIFFERENTIABLE) FUNCTION.
+C
+C "ALGORITHMS FOR MINIMIZATION WITHOUT DERIVATIVES",
+C RICHARD P. BRENT, PRENTICE-HALL 1973 (ISBN 0-13-022335-2),
+C PAGES 156-167
+C
+C TRANSLATED FROM ALGOL W TO A.N.S.I. 1966 STANDARD BASIC FORTRAN
+C BY ROSALEE TAYLOR AND SUE PINSKI, COMPUTER SCIENCE DEPARTMENT,
+C OKLAHOMA STATE UNIVERSITY (DECEMBER 1973).
+C
+C UPDATED TO A.N.S.I. STANDARD FORTRAN 77 BY J. P. CHANDLER
+C COMPUTER SCIENCE DEPARTMENT, OKLAHOMA STATE UNIVERSITY
+C
+C
+C SUBROUTINE PRAXIS CALLS SUBPROGRAMS
+C F, MINX, RANDOM (OR DRANDM), QUAD, MINFIT, SORT.
+C
+C SUBROUTINE QUAD CALLS MINX.
+C
+C SUBROUTINE MINX CALLS FLIN.
+C
+C SUBROUTINE FLIN CALLS F.
+C
+C
+C INPUT QUANTITIES (SET IN THE CALLING PROGRAM)...
+C
+C F FUNCTION F(X,N) TO BE MINIMIZED
+C
+C X(*) INITIAL GUESS OF MINIMUM
+C
+C N DIMENSION OF X (NOTE... N MUST BE .GE. 2)
+C
+C H MAXIMUM STEP SIZE
+C
+C T TOLERANCE
+C
+C EPSMCH MACHINE PRECISION
+C
+C JPRINT PRINT SWITCH
+C
+C
+C OUTPUT QUANTITIES...
+C
+C X(*) ESTIMATED POINT OF MINIMUM
+C
+C FX VALUE OF F AT X
+C
+C NL NUMBER OF LINEAR SEARCHES
+C
+C NF NUMBER OF FUNCTION EVALUATIONS
+C
+C V(*,*) EIGENVECTORS OF A
+C NEW DIRECTIONS
+C
+C D(*) EIGENVALUES OF A
+C NEW D
+C
+C Z(*) SCALE FACTORS
+C
+C
+C ON ENTRY X(*) HOLDS A GUESS. ON RETURN IT HOLDS THE ESTIMATED
+C POINT OF MINIMUM, WITH (HOPEFULLY)
+C ABS(ERROR) LESS THAN SQRT(EPSMCH)*ABS(X) + T, WHERE
+C EPSMCH IS THE MACHINE PRECISION, THE SMALLEST NUMBER SUCH THAT
+C (1 + EPSMCH) IS GREATER THAN 1.
+C
+C T IS A TOLERANCE.
+C
+C H IS THE MAXIMUM STEP SIZE, SET TO ABOUT THE MAXIMUM EXPECTED
+C DISTANCE FROM THE GUESS TO THE MINIMUM. IF H IS SET TOO
+C SMALL OR TOO LARGE THEN THE INITIAL RATE OF CONVERGENCE WILL
+C BE SLOW.
+C
+C THE USER SHOULD OBSERVE THE COMMENT ON HEURISTIC NUMBERS
+C AT THE BEGINNING OF THE SUBROUTINE.
+C
+C JPRINT CONTROLS THE PRINTING OF INTERMEDIATE RESULTS.
+C IT USES SUBROUTINES FLIN, MINX, QUAD, SORT, AND MINFIT.
+C IF JPRINT = 1, F IS PRINTED AFTER EVERY N+1 OR N+2 LINEAR
+C MINIMIZATIONS, AND FINAL X IS PRINTED, BUT INTERMEDIATE
+C X ONLY IF N IS LESS THAN OR EQUAL TO 4.
+C IF JPRINT = 2, EIGENVALUES OF A AND SCALE FACTORS ARE ALSO PRINTED.
+C IF JPRINT = 3, F AND X ARE PRINTED AFTER EVERY FEW LINEAR
+C MINIMIZATIONS.
+C IF JPRINT = 4, EIGENVECTORS ARE ALSO PRINTED.
+C IF JPRINT = 5, ADDITIONAL DEBUGGING INFORMATION IS ALSO PRINTED.
+C
+C RANDOM RETURNS A RANDOM NUMBER UNIFORMLY DISTRIBUTED IN (0, 1).
+C
+C THIS SUBROUTINE IS MACHINE-INDEPENDENT, APART FROM THE
+C SPECIFICATION OF EPSMCH. WE ASSUME THAT EPSMCH**(-4) DOES NOT
+C OVERFLOW (IF IT DOES THEN EPSMCH MUST BE INCREASED), AND THAT ON
+C FLOATING-POINT UNDERFLOW THE RESULT IS SET TO ZERO.
+C
+ INTEGER N,NL,NF,LP,JPRINT,NMAX,ILLCIN,KTM,NFMAX,JRANCH
+ INTEGER ILLC,I,IK,IM,IMU,J,K,KL,KM1,KT,K2
+C
+ DOUBLE PRECISION V,X,D,Q0,Q1,DMIN,EPSMCH,FX,H,QD0,QD1,QF1,
+ * SMALL,T,XLDT,XM2,XM4,DSEED,SCBD
+ DOUBLE PRECISION F, Y,Z,E, DABS,DSQRT,ZABS,ZSQRT,DRANDM,
+ * HUNDRD,HUNDTH,ONE,PT9,RHALF,TEN,TENTH,TWO,ZERO,
+ * DF,DLDFAC,DN,F1,XF,XL,T2,RANVAL,ARG,
+ * VLARGE,VSMALL,XLARGE,XLDS,FXVALU,F1VALU,S,SF,SL
+C
+ EXTERNAL F
+C
+ DIMENSION Y(128),Z(128),E(128)
+C
+ COMMON /CPRAX/ V(128,128),X(128),D(128),Q0(128),Q1(128),
+ * DMIN,EPSMCH,FX,H,QD0,QD1,QF1,SMALL,T,XLDT,XM2,XM4,DSEED,SCBD,
+ * N,NL,NF,LP,JPRINT,NMAX,ILLCIN,KTM,NFMAX,JRANCH
+C
+ ZABS(ARG)=DABS(ARG)
+ ZSQRT(ARG)=DSQRT(ARG)
+C
+C INITIALIZATION...
+C
+ RHALF=0.5D0
+ ONE=1.0D0
+ TENTH=0.1D0
+ HUNDTH=0.01D0
+ HUNDRD=100.0D0
+ ZERO=0.0D0
+ PT9=0.9D0
+ TEN=10.0D0
+ TWO=2.0D0
+C
+C MACHINE DEPENDENT NUMBERS...
+C
+C ON MANY COMPUTERS, VSMALL WILL UNDERFLOW,
+C AND COMPUTING XLARGE MAY CAUSE A DIVISION BY ZERO.
+C IN THAT CASE, EPSMCH SHOULD BE SET EQUAL TO 1.0D-9
+C (OR POSSIBLY 1.0D-8) BEFORE CALLING PRAXIS.
+C
+ SMALL=EPSMCH*EPSMCH
+ VSMALL=SMALL*SMALL
+ XLARGE=ONE/SMALL
+ VLARGE=ONE/VSMALL
+ XM2=ZSQRT(EPSMCH)
+ XM4=ZSQRT(XM2)
+C
+C HEURISTIC NUMBERS...
+C
+C IF THE AXES MAY BE BADLY SCALED (WHICH IS TO BE AVOIDED IF
+C POSSIBLE) THEN SET SCBD = 10, OTHERWISE 1.
+C
+C IF THE PROBLEM IS KNOWN TO BE ILL-CONDITIONED SET ILLC = 1,
+C OTHERWISE 0.
+C
+C KTM+1 IS THE NUMBER OF ITERATIONS WITHOUT IMPROVEMENT
+C BEFORE THE ALGORITHM TERMINATES.
+C KTM=4 IS VERY CAUTIOUS.
+C USUALLY KTM=1 IS SATISFACTORY.
+C
+C BRENT RECOMMENDED THE FOLLOWING VALUES FOR MOST PROBLEMS...
+C
+C SCBD=1.0
+C ILLC=0
+C KTM=1
+C
+C SCBD, ILLCIN, AND KTM ARE NOW IN COMMON.
+C THEY ARE INITIALIZED IN SUBROUTINE PRASET,
+C AND CAN BE RESET BY THE USER AFTER CALLING PRASET.
+C
+ ILLC=ILLCIN
+C
+ IF(ILLC.EQ.1) THEN
+ DLDFAC=TENTH
+ ELSE
+ DLDFAC=HUNDTH
+ ENDIF
+C
+ KT=0
+ NL=0
+ NF=1
+ FX=F(X,N)
+ QF1=FX
+ T=SMALL+ZABS(T)
+ T2=T
+ DMIN=SMALL
+ IF(H.LT.HUNDRD*T) H=HUNDRD*T
+ XLDT=H
+C
+ DO 20 I=1,N
+ DO 10 J=1,N
+ V(I,J)=ZERO
+ 10 CONTINUE
+ V(I,I)=ONE
+ 20 CONTINUE
+C
+ QD0=ZERO
+ D(1)=ZERO
+C
+C Q0(*) AND Q1(*) ARE PREVIOUS X(*) POINTS,
+C INITIALIZED IN PRAXIS, USED IN FLIN,
+C AND CHANGED IN QUAD.
+C
+ DO 30 I=1,N
+ Q1(I)=X(I)
+C
+C Q0(*) WAS NOT INITIALIZED IN BRENT'S ALGOL PROCEDURE.
+C
+ Q0(I)=X(I)
+ 30 CONTINUE
+C
+ IF(JPRINT.GT.0) THEN
+ WRITE(LP,40)NL,NF,FX
+ 40 FORMAT(/' NL =',I10,5X,'NF =',I10/5X,'FX =',1PG15.7)
+C
+ IF(N.LE.4 .OR. JPRINT.GT.2) THEN
+ WRITE(LP,50)(X(I),I=1,N)
+ 50 FORMAT(/8X,'X'/(1X,1PG15.7,4G15.7))
+ ENDIF
+ ENDIF
+C
+C MAIN LOOP...
+C LABEL L0...
+C
+ 60 SF=D(1)
+ S=ZERO
+ D(1)=ZERO
+C
+C MINIMIZE ALONG THE FIRST DIRECTION.
+C
+ IF(JPRINT.GE.5) WRITE(LP,70)D(1),S,FX
+ 70 FORMAT(/' CALL NO. 1 TO MINX.'/
+ * 5X,'D(1) =',1PG15.7,5X,'S =',G15.7,5X,'FX =',G15.7)
+C
+ FXVALU=FX
+ CALL MINX(1,2,D(1),S,FXVALU,0,F)
+C
+ IF(S.LE.ZERO) THEN
+ DO 80 I=1,N
+ V(I,1)=-V(I,1)
+ 80 CONTINUE
+ ENDIF
+C
+ IF(SF.LE.PT9*D(1) .OR. PT9*SF.GE.D(1)) THEN
+C
+ IF(N.GE.2) THEN
+ DO 90 I=2,N
+ D(I)=ZERO
+ 90 CONTINUE
+ ENDIF
+C
+ ENDIF
+C
+ IF(N.LT.2) GO TO 320
+ DO 310 K=2,N
+C
+ DO 100 I=1,N
+ Y(I)=X(I)
+ 100 CONTINUE
+C
+ SF=FX
+ IF(KT.GT.0) ILLC=1
+C
+C LABEL L1...
+C
+ 110 KL=K
+ DF=ZERO
+C
+ IF(ILLC.EQ.1) THEN
+C
+C TAKE A RANDOM STEP TO GET OUT OF A RESOLUTION VALLEY.
+C
+C PRAXIS ASSUMES THAT RANDOM (OR DRANDM) RETURNS
+C A PSEUDORANDOM NUMBER UNIFORMLY DISTRIBUTED IN (0,1),
+C AND THAT ANY INITIALIZATION OF THE RANDOM NUMBER GENERATOR
+C HAS ALREADY BEEN DONE.
+C
+ DO 130 I=1,N
+C
+ IF(JRANCH.EQ.1) THEN
+ CALL RANDOM(RANVAL)
+ ELSE
+ RANVAL=DRANDM(DSEED)
+ ENDIF
+C
+ S=(TENTH*XLDT+T2*TEN**KT)*(RANVAL-RHALF)
+ Z(I)=S
+C
+ DO 120 J=1,N
+ X(J)=X(J)+S*V(J,I)
+ 120 CONTINUE
+ 130 CONTINUE
+C
+ FX=F(X,N)
+ NF=NF+1
+C
+ IF(JPRINT.GE.1) WRITE(LP,140)NF,SF,FX
+ 140 FORMAT(/' ***** RANDOM STEP IN PRAXIS. NF =',I11/
+ * 5X,'SF =',1PG15.7,5X,'FX =',G15.7)
+ ENDIF
+C
+ IF(K.GT.N) GO TO 170
+ DO 160 K2=K,N
+ SL=FX
+ S=ZERO
+C
+C MINIMIZE ALONG NON-CONJUGATE DIRECTIONS.
+C
+ IF(JPRINT.GE.5) WRITE(LP,150)K2,D(K2),S,FX
+ 150 FORMAT(/' CALL NO. 2 TO MINX.'/
+ * 5X,'K2 =',I4,5X,'D(K2) =',1PG15.7,5X,
+ * 'S =',G15.7/5X,'FX =',G15.7)
+C
+ FXVALU=FX
+ CALL MINX(K2,2,D(K2),S,FXVALU,0,F)
+C
+ IF(ILLC.EQ.1) THEN
+ S=D(K2)*(S+Z(K2))**2
+ ELSE
+ S=SL-FX
+ ENDIF
+C
+ IF(DF.LT.S) THEN
+ DF=S
+ KL=K2
+ ENDIF
+ 160 CONTINUE
+C
+ 170 IF(ILLC.EQ.0 .AND. DF.LT.ZABS(HUNDRD*EPSMCH*FX)) THEN
+C
+C NO SUCCESS WITH ILLC=0, SO TRY ONCE WITH ILLC=1 .
+C
+ ILLC=1
+C
+C GO TO L1.
+C
+ GO TO 110
+ ENDIF
+C
+ IF(K.EQ.2 .AND. JPRINT.GT.1) THEN
+ WRITE(LP,180)(D(I),I=1,N)
+ 180 FORMAT(/' NEW D'/(1X,1PG15.7,4G15.7))
+ ENDIF
+C
+ KM1=K-1
+ IF(KM1.LT.1) GO TO 210
+ DO 200 K2=1,KM1
+C
+C MINIMIZE ALONG CONJUGATE DIRECTIONS.
+C
+ IF(JPRINT.GE.5) WRITE(LP,190)K2,D(K2),S,FX
+ 190 FORMAT(/' CALL NO. 3 TO MINX.'/
+ * 5X,'K2 =',I4,5X,'D(K2) =',1PG15.7,5X,
+ * 'S =',G15.7/5X,'FX =',G15.7)
+C
+ S=ZERO
+ FXVALU=FX
+ CALL MINX(K2,2,D(K2),S,FXVALU,0,F)
+ 200 CONTINUE
+C
+ 210 F1=FX
+ FX=SF
+C
+ XLDS=ZERO
+ DO 220 I=1,N
+ SL=X(I)
+ X(I)=Y(I)
+ SL=SL-Y(I)
+ Y(I)=SL
+ XLDS=XLDS+SL*SL
+ 220 CONTINUE
+C
+ XLDS=ZSQRT(XLDS)
+ IF(XLDS.GT.SMALL) THEN
+C
+C THROW AWAY THE DIRECTION KL AND MINIMIZE ALONG
+C THE NEW CONJUGATE DIRECTION.
+C
+ IK=KL-1
+ IF(K.GT.IK) GO TO 250
+ DO 240 IM=K,IK
+ I=IK-IM+K
+C
+ DO 230 J=1,N
+ V(J,I+1)=V(J,I)
+ 230 CONTINUE
+C
+ D(I+1)=D(I)
+ 240 CONTINUE
+C
+ 250 D(K)=ZERO
+C
+ DO 260 I=1,N
+ V(I,K)=Y(I)/XLDS
+ 260 CONTINUE
+C
+ IF(JPRINT.GE.5) WRITE(LP,270)K,D(K),XLDS,F1
+ 270 FORMAT(/' CALL NO. 4 TO MINX.'/
+ * 5X,'K =',I4,5X,'D(K) =',1PG15.7,5X,
+ * 'XLDS =',G15.7/5X,'F1 =',G15.7)
+C
+ F1VALU=F1
+ CALL MINX(K,4,D(K),XLDS,F1VALU,1,F)
+C
+ IF(XLDS.LE.ZERO) THEN
+ XLDS=-XLDS
+C
+ DO 280 I=1,N
+ V(I,K)=-V(I,K)
+ 280 CONTINUE
+ ENDIF
+ ENDIF
+C
+ XLDT=DLDFAC*XLDT
+ IF(XLDT.LT.XLDS) XLDT=XLDS
+C
+ IF(JPRINT.GT.0) THEN
+ WRITE(LP,40)NL,NF,FX
+ IF(N.LE.4 .OR. JPRINT.GT.2) THEN
+ WRITE(LP,50)(X(I),I=1,N)
+ ENDIF
+ ENDIF
+C
+ T2=ZERO
+ DO 290 I=1,N
+ T2=T2+X(I)**2
+ 290 CONTINUE
+ T2=XM2*ZSQRT(T2)+T
+C
+C SEE IF THE STEP LENGTH EXCEEDS HALF THE TOLERANCE.
+C
+ IF(XLDT.GT.RHALF*T2) THEN
+ KT=0
+ ELSE
+ KT=KT+1
+ ENDIF
+C
+C IF(...) GO TO L2
+C
+ IF(KT.GT.KTM) GO TO 550
+C
+ IF(NF.GE.NFMAX) THEN
+ WRITE(LP,300)NFMAX
+ 300 FORMAT(/' IN PRAXIS, NF REACHED THE LIMIT NFMAX =',I11/
+ * 5X,'THIS IS AN ABNORMAL TERMINATION.'/
+ * 5X,'THE FUNCTION HAS NOT BEEN MINIMIZED AND',
+ * ' THE RESULTING X(*) VECTOR SHOULD NOT BE USED.')
+ GO TO 550
+ ENDIF
+C
+ 310 CONTINUE
+C
+C TRY QUADRATIC EXTRAPOLATION IN CASE WE ARE STUCK IN A CURVED VALLEY.
+C
+ 320 CALL QUAD(F)
+C
+ DN=ZERO
+ DO 330 I=1,N
+ D(I)=ONE/ZSQRT(D(I))
+ IF(DN.LT.D(I)) DN=D(I)
+ 330 CONTINUE
+C
+ IF(JPRINT.GT.3) THEN
+C
+ WRITE(LP,340)
+ 340 FORMAT(/' NEW DIRECTIONS')
+C
+ DO 360 I=1,N
+ WRITE(LP,350)I,(V(I,J),J=1,N)
+ 350 FORMAT(1X,I5,4X,1PG15.7,4G15.7/(10X,5G15.7))
+ 360 CONTINUE
+ ENDIF
+C
+ DO 380 J=1,N
+C
+ S=D(J)/DN
+ DO 370 I=1,N
+ V(I,J)=S*V(I,J)
+ 370 CONTINUE
+ 380 CONTINUE
+C
+ IF(SCBD.GT.ONE) THEN
+C
+C SCALE THE AXES TO TRY TO REDUCE THE CONDITION NUMBER.
+C
+ S=VLARGE
+ DO 400 I=1,N
+C
+ SL=ZERO
+ DO 390 J=1,N
+ SL=SL+V(I,J)**2
+ 390 CONTINUE
+C
+ Z(I)=ZSQRT(SL)
+ IF(Z(I).LT.XM4) Z(I)=XM4
+ IF(S.GT.Z(I)) S=Z(I)
+ 400 CONTINUE
+C
+ DO 410 I=1,N
+ SL=S/Z(I)
+ Z(I)=ONE/SL
+C
+ IF(Z(I).GT.SCBD) THEN
+ SL=ONE/SCBD
+ Z(I)=SCBD
+ ENDIF
+C
+C IT APPEARS THAT THERE ARE TWO MISSING END; STATEMENTS
+C AT THIS POINT IN BRENT'S LISTING.
+C
+ 410 CONTINUE
+ ENDIF
+C
+C TRANSPOSE V FOR MINFIT.
+C
+ IF(N.LT.2) GO TO 440
+ DO 430 I=2,N
+C
+ IMU=I-1
+ DO 420 J=1,IMU
+ S=V(I,J)
+ V(I,J)=V(J,I)
+ V(J,I)=S
+ 420 CONTINUE
+ 430 CONTINUE
+C
+C FIND THE SINGULAR VALUE DECOMPOSITION OF V.
+C THIS GIVES THE EIGENVALUES AND PRINCIPAL AXES
+C OF THE APPROXIMATING QUADRATIC FORM
+C WITHOUT SQUARING THE CONDITION NUMBER.
+C
+ 440 CALL MINFIT(N,EPSMCH,VSMALL,V,D,E,NMAX,LP)
+C
+ IF(SCBD.GT.ONE) THEN
+C
+C UNSCALING...
+C
+ DO 460 I=1,N
+C
+ S=Z(I)
+ DO 450 J=1,N
+ V(I,J)=S*V(I,J)
+ 450 CONTINUE
+ 460 CONTINUE
+C
+ DO 490 I=1,N
+C
+ S=ZERO
+ DO 470 J=1,N
+ S=S+V(J,I)**2
+ 470 CONTINUE
+ S=ZSQRT(S)
+C
+ D(I)=S*D(I)
+C
+ S=ONE/S
+ DO 480 J=1,N
+ V(J,I)=S*V(J,I)
+ 480 CONTINUE
+ 490 CONTINUE
+ ENDIF
+C
+ DO 500 I=1,N
+C
+ IF(DN*D(I).GT.XLARGE) THEN
+ D(I)=VSMALL
+ ELSE IF(DN*D(I).LT.SMALL) THEN
+ D(I)=VLARGE
+ ELSE
+ D(I)=ONE/(DN*D(I))**2
+ ENDIF
+ 500 CONTINUE
+C
+C SORT THE NEW EIGENVALUES AND EIGENVECTORS.
+C
+ CALL SORT
+C
+ DMIN=D(N)
+ IF(DMIN.LT.SMALL) DMIN=SMALL
+C
+ IF(XM2*D(1).GT.DMIN) THEN
+ ILLC=1
+ ELSE
+ ILLC=0
+ ENDIF
+C
+ IF(JPRINT.GT.1 .AND. SCBD.GT.ONE) THEN
+ WRITE(LP,510)(Z(I),I=1,N)
+ 510 FORMAT(/' SCALE FACTORS'/(1X,1PG15.7,4G15.7))
+ ENDIF
+C
+ IF(JPRINT.GT.1) THEN
+ WRITE(LP,520)(D(I),I=1,N)
+ 520 FORMAT(/' EIGENVALUES OF A'/(1X,1PG15.7,4G15.7))
+ ENDIF
+C
+ IF(JPRINT.GT.3) THEN
+C
+ WRITE(LP,530)
+ 530 FORMAT(/' EIGENVECTORS OF A')
+C
+ DO 540 I=1,N
+ WRITE(LP,350)I,(V(I,J),J=1,N)
+ 540 CONTINUE
+ ENDIF
+C
+C GO BACK TO THE MAIN LOOP.
+C GO TO L0
+C
+C HANDLE THE CASE N .EQ. 1 IN AN AD HOC WAY.
+C (BRENT DID NOT PROVIDE FOR THIS CASE.)
+C
+ IF(N.GE.2) GO TO 60
+C
+C LABEL L2...
+C
+ 550 IF(JPRINT.GT.0) THEN
+ WRITE(LP,560)(X(I),I=1,N)
+ 560 FORMAT(//7X,'X'/(1X,1PG15.7,4G15.7))
+ ENDIF
+C
+ FX=F(X,N)
+C
+ IF(JPRINT.GE.0) WRITE(LP,570)FX,NL,NF
+ 570 FORMAT(/' EXIT PRAXIS. FX =',1PG25.17,5X,'NL =',I8,
+ * 5X,'NF =',I9)
+C
+ RETURN
+C
+C END PRAXIS
+C
+ END
+ SUBROUTINE QUAD(F)
+C
+C THIS SUBROUTINE LOOKS FOR THE MINIMUM ALONG
+C A CURVE DEFINED BY Q0, Q1, AND X.
+C
+C "ALGORITHMS FOR MINIMIZATION WITHOUT DERIVATIVES",
+C RICHARD P. BRENT, PRENTICE-HALL 1973, PAGE 161
+C
+C SUBROUTINE QUAD IS CALLED BY SUBROUTINE PRAXIS.
+C
+ INTEGER N,NL,NF,LP,JPRINT,NMAX,ILLCIN,KTM,NFMAX,JRANCH
+ INTEGER I
+C
+ DOUBLE PRECISION V,X,D,Q0,Q1,DMIN,EPSMCH,FX,H,QD0,QD1,QF1,
+ * SMALL,T,XLDT,XM2,XM4,DSEED,SCBD
+ DOUBLE PRECISION F, DSQRT,ZSQRT,ARG,
+ * ONE,QA,QB,QC,S,TWO,XL,ZERO,QF1VAL
+C
+ EXTERNAL F
+C
+ COMMON /CPRAX/ V(128,128),X(128),D(128),Q0(128),Q1(128),
+ * DMIN,EPSMCH,FX,H,QD0,QD1,QF1,SMALL,T,XLDT,XM2,XM4,DSEED,SCBD,
+ * N,NL,NF,LP,JPRINT,NMAX,ILLCIN,KTM,NFMAX,JRANCH
+C
+ ZSQRT(ARG)=DSQRT(ARG)
+C
+ ZERO=0.0D0
+ ONE=1.0D0
+C
+ S=FX
+ FX=QF1
+ QF1=S
+ QD1=ZERO
+C
+ DO 10 I=1,N
+ S=X(I)
+ XL=Q1(I)
+ X(I)=XL
+ Q1(I)=S
+ QD1=QD1+(S-XL)**2
+ 10 CONTINUE
+C
+ QD1=ZSQRT(QD1)
+ XL=QD1
+ S=ZERO
+C
+ IF(QD0.GT.ZERO .AND. QD1.GT.ZERO .AND. NL.GE.3*N*N) THEN
+C
+ IF(JPRINT.GE.1) WRITE(LP,20)NF,QD0,QD1,FX,QF1
+ 20 FORMAT(/' ***** CALL MINX FROM QUAD. NF =',I11/
+ * 5X,'QD0 =',1PG15.7,5X,'QD1 =',G15.7/
+ * 5X,'FX =',G15.7,5X,'QF1 =',G15.7)
+C
+ QF1VAL=QF1
+ CALL MINX(0,2,S,XL,QF1VAL,1,F)
+ QA=XL*(XL-QD1)/(QD0*(QD0+QD1))
+ QB=(XL+QD0)*(QD1-XL)/(QD0*QD1)
+ QC=XL*(XL+QD0)/(QD1*(QD0+QD1))
+ ELSE
+ FX=QF1
+ QA=ZERO
+ QB=ZERO
+ QC=ONE
+ ENDIF
+C
+ QD0=QD1
+C
+ DO 30 I=1,N
+ S=Q0(I)
+ Q0(I)=X(I)
+ X(I)=QA*S+QB*X(I)+QC*Q1(I)
+ 30 CONTINUE
+C
+ RETURN
+C
+C END QUAD
+C
+ END
+ SUBROUTINE MINX(J,NITS,D2,X1,F1,IFK,F)
+C
+C SUBROUTINE MINX MINIMIZES F FROM X IN THE DIRECTION V(*,J)
+C UNLESS J IS LESS THAN 1, WHEN A QUADRATIC SEARCH IS DONE IN
+C THE PLANE DEFINED BY Q0, Q1, AND X.
+C
+C "ALGORITHMS FOR MINIMIZATION WITHOUT DERIVATIVES",
+C RICHARD P. BRENT, PRENTICE-HALL 1973, PAGES 159-160
+C
+C SUBROUTINE MINX IS CALLED BY SUBROUTINES PRAXIS AND QUAD.
+C
+C D2 AND X1 RETURN RESULTS.
+C J, NITS, F1 AND IFK ARE VALUE PARAMETERS THAT RETURN NOTHING.
+C DO NOT SEND A COMMON VARIABLE TO MINX FOR PARAMETER F1.
+C
+C
+C D2 IS AN APPROXIMATION TO HALF OF
+C THE SECOND DERIVATIVE OF F (OR ZERO).
+C
+C X1 IS AN ESTIMATE OF DISTANCE TO MINIMUM,
+C RETURNED AS THE DISTANCE FOUND.
+C
+C IF IFK = 1 THEN F1 IS FLIN(X1), OTHERWISE X1 AND F1 ARE
+C IGNORED ON ENTRY UNLESS FINAL FX IS GREATER THAN F1.
+C
+C NITS CONTROLS THE NUMBER OF TIMES AN ATTEMPT IS MADE TO
+C HALVE THE INTERVAL.
+C
+ EXTERNAL F
+C
+ INTEGER N,NL,NF,LP,JPRINT,NMAX,ILLCIN,KTM,NFMAX,JRANCH
+ INTEGER IFK,J,NITS, I,IDZ,K
+C
+ DOUBLE PRECISION V,X,D,Q0,Q1,DMIN,EPSMCH,FX,H,QD0,QD1,QF1,
+ * SMALL,T,XLDT,XM2,XM4,DSEED,SCBD
+ DOUBLE PRECISION D2,X1,
+ * DABS,DSQRT,ZABS,ZSQRT,ARG,
+ * HUNDTH,RHALF,TWO,ZERO,
+ * DENOM,D1,FM,F0,F1,F2,S,SF1,SX1,T2,XM,X2
+C
+ COMMON /CPRAX/ V(128,128),X(128),D(128),Q0(128),Q1(128),
+ * DMIN,EPSMCH,FX,H,QD0,QD1,QF1,SMALL,T,XLDT,XM2,XM4,DSEED,SCBD,
+ * N,NL,NF,LP,JPRINT,NMAX,ILLCIN,KTM,NFMAX,JRANCH
+C
+ ZSQRT(ARG)=DSQRT(ARG)
+ ZABS(ARG)=DABS(ARG)
+C
+ HUNDTH=0.01D0
+ ZERO=0.0D0
+ TWO=2.0D0
+ RHALF=0.5D0
+C
+ SF1=F1
+ SX1=X1
+ K=0
+ XM=ZERO
+ FM=FX
+ F0=FX
+C
+ IF(D2.LT.EPSMCH) THEN
+ IDZ=1
+ ELSE
+ IDZ=0
+ ENDIF
+C
+C FIND THE STEP SIZE.
+C
+ S=ZERO
+ DO 10 I=1,N
+ S=S+X(I)**2
+ 10 CONTINUE
+ S=ZSQRT(S)
+C
+ IF(IDZ.EQ.1) THEN
+ DENOM=DMIN
+ ELSE
+ DENOM=D2
+ ENDIF
+C
+ T2=XM4*ZSQRT(ZABS(FX)/DENOM+S*XLDT)+XM2*XLDT
+ S=XM4*S+T
+ IF(IDZ.EQ.1 .AND. T2.GT.S) T2=S
+ IF(T2.LT.SMALL) T2=SMALL
+ IF(T2.GT.HUNDTH*H) T2=HUNDTH*H
+C
+ IF(IFK.EQ.1 .AND. F1.LE.FM) THEN
+ XM=X1
+ FM=F1
+ ENDIF
+C
+ IF(IFK.EQ.0 .OR. ZABS(X1).LT.T2) THEN
+C
+ IF(X1.GE.ZERO) THEN
+ X1=T2
+ ELSE
+ X1=-T2
+ ENDIF
+C
+ CALL FLIN(X1,J,F,F1)
+ ENDIF
+C
+ IF(F1.LT.FM) THEN
+ XM=X1
+ FM=F1
+ ENDIF
+C
+C LABEL L0...
+C
+ 20 IF(IDZ.EQ.1) THEN
+C
+C EVALUATE FLIN AT ANOTHER POINT,
+C AND ESTIMATE THE SECOND DERIVATIVE.
+C
+ IF(F0.LT.F1) THEN
+ X2=-X1
+ ELSE
+ X2=TWO*X1
+ ENDIF
+C
+ CALL FLIN(X2,J,F,F2)
+C
+ IF(F2.LE.FM) THEN
+ XM=X2
+ FM=F2
+ ENDIF
+C
+ D2=(X2*(F1-F0)-X1*(F2-F0))/(X1*X2*(X1-X2))
+C
+ IF(JPRINT.GE.5) WRITE(LP,30)X1,X2,F0,F1,F2,D2
+ 30 FORMAT(/' COMPUTE D2 IN SUBROUTINE MINX.'/
+ * 5X,'X1 =',1PG15.7,5X,'X2 =',G15.7/
+ * 5X,'F0 =',G15.7,5X,'F1 =',G15.7,5X,'F2 =',G15.7/
+ * 5X,'D2 =',G15.7)
+ ENDIF
+C
+C ESTIMATE THE FIRST DERIVATIVE AT 0.
+C
+ D1=(F1-F0)/X1-X1*D2
+ IDZ=1
+C
+C PREDICT THE MINIMUM.
+C
+ IF(D2.LE.SMALL) THEN
+C
+ IF(D1.LT.ZERO) THEN
+ X2=H
+ ELSE
+ X2=-H
+ ENDIF
+C
+ ELSE
+ X2=-RHALF*D1/D2
+ ENDIF
+C
+ IF(ZABS(X2).GT.H) THEN
+C
+ IF(X2.GT.ZERO) THEN
+ X2=H
+ ELSE
+ X2=-H
+ ENDIF
+ ENDIF
+C
+C EVALUATE F AT THE PREDICTED MINIMUM.
+C LABEL L1...
+C
+ 40 CALL FLIN(X2,J,F,F2)
+C
+ IF(K.LT.NITS .AND. F2.GT.F0) THEN
+C
+C NO SUCCESS, SO TRY AGAIN.
+C
+ K=K+1
+C
+C IF(...) GO TO L0
+C
+ IF(F0.LT.F1 .AND. X1*X2.GT.ZERO) GO TO 20
+ X2=X2/TWO
+C
+C GO TO L1
+C
+ GO TO 40
+C
+ ENDIF
+C
+C INCREMENT THE ONE-DIMENSIONAL SEARCH COUNTER.
+C
+ NL=NL+1
+C
+ IF(F2.GT.FM) THEN
+ X2=XM
+ ELSE
+ FM=F2
+ ENDIF
+C
+C GET A NEW ESTIMATE OF THE SECOND DERIVATIVE.
+C
+ IF(ZABS(X2*(X2-X1)).GT.SMALL) THEN
+ D2=(X2*(F1-F0)-X1*(FM-F0))/(X1*X2*(X1-X2))
+C
+ IF(JPRINT.GE.5) WRITE(LP,50)X1,X2,F0,FM,F1,D2
+ 50 FORMAT(/' RECOMPUTE D2 IN SUBROUTINE MINX.'/
+ * 5X,'X1 =',1PG15.7,5X,'X2 =',G15.7/
+ * 5X,'F0 =',G15.7,5X,'FM =',G15.7,5X,'F1 =',G15.7/
+ * 5X,'D2 =',G15.7)
+C
+ ELSE IF(K.GT.0) THEN
+ D2=ZERO
+C
+ IF(JPRINT.GE.5) WRITE(LP,60)
+ 60 FORMAT(/' SET D2=0 IN SUBROUTINE MINX.')
+ ELSE
+ D2=D2
+ ENDIF
+C
+ IF(D2.LE.SMALL) THEN
+ D2=SMALL
+C
+ IF(JPRINT.GE.5) WRITE(LP,70)D2
+ 70 FORMAT(/' SET D2=SMALL=',1PG15.7,' IN SUBROUTINE MINX.')
+ ENDIF
+C
+ IF(JPRINT.GE.5) WRITE(LP,80)X1,X2,FX,FM,SF1
+ 80 FORMAT(/' SUBROUTINE MINX. X1 =',1PG15.7,5X,'X2 =',G15.7/
+ * 5X,'FX =',G15.7,5X,'FM =',G15.7,5X,'SF1 =',G15.7)
+C
+ X1=X2
+ FX=FM
+ IF(SF1.LT.FX) THEN
+ FX=SF1
+ X1=SX1
+ ENDIF
+C
+C UPDATE X FOR A LINEAR SEARCH BUT NOT FOR A PARABOLIC SEARCH.
+C
+ IF(J.GT.0) THEN
+C
+ DO 90 I=1,N
+ X(I)=X(I)+X1*V(I,J)
+ 90 CONTINUE
+ ENDIF
+C
+ IF(JPRINT.GE.5) WRITE(LP,100)D2,X1,F1,FX
+ 100 FORMAT(/' LEAVE SUBROUTINE MINX.'/
+ * 5X,'D2 =',1PG15.7,5X,'X1 =',G15.7,5X,'F1 =',G15.7/
+ * 5X,'FX =',G15.7)
+C
+ RETURN
+C
+C END MINX
+C
+ END
+ SUBROUTINE FLIN(XL,J,F,FLN)
+C
+C FLIN IS A FUNCTION OF ONE VARIABLE XL WHICH IS MINIMIZED BY
+C SUBROUTINE MINX.
+C
+C "ALGORITHMS FOR MINIMIZATION WITHOUT DERIVATIVES",
+C RICHARD P. BRENT, PRENTICE-HALL 1973, PAGES 159-160
+C
+C SUBROUTINE FLIN IS CALLED BY SUBROUTINE MINX.
+C
+ INTEGER N,NL,NF,LP,JPRINT,NMAX,ILLCIN,KTM,NFMAX,JRANCH
+ INTEGER J, I
+C
+ DOUBLE PRECISION V,X,D,Q0,Q1,DMIN,EPSMCH,FX,H,QD0,QD1,QF1,
+ * SMALL,T,XLDT,XM2,XM4,DSEED,SCBD
+ DOUBLE PRECISION XL,F,FLN, TT, QA,QB,QC
+C
+ DIMENSION TT(128)
+C
+ COMMON /CPRAX/ V(128,128),X(128),D(128),Q0(128),Q1(128),
+ * DMIN,EPSMCH,FX,H,QD0,QD1,QF1,SMALL,T,XLDT,XM2,XM4,DSEED,SCBD,
+ * N,NL,NF,LP,JPRINT,NMAX,ILLCIN,KTM,NFMAX,JRANCH
+C
+ IF(J.GT.0) THEN
+C
+C LINEAR SEARCH...
+C
+ DO 10 I=1,N
+ TT(I)=X(I)+XL*V(I,J)
+ 10 CONTINUE
+C
+ ELSE
+C
+C SEARCH ALONG A PARABOLIC SPACE CURVE.
+C
+ QA=XL*(XL-QD1)/(QD0*(QD0+QD1))
+ QB=(XL+QD0)*(QD1-XL)/(QD0*QD1)
+ QC=XL*(XL+QD0)/(QD1*(QD0+QD1))
+C
+ DO 20 I=1,N
+ TT(I)=QA*Q0(I)+QB*X(I)+QC*Q1(I)
+ 20 CONTINUE
+ ENDIF
+C
+C INCREMENT FUNCTION EVALUATION COUNTER.
+C
+ NF=NF+1
+ FLN=F(TT,N)
+C
+ RETURN
+C
+C END FLIN
+C
+ END
+ SUBROUTINE MINFIT(N,EPS,TOL,AB,Q,E,NMAX,LP)
+C
+C AN IMPROVED VERSION OF MINFIT, RESTRICTED TO M=N, P=0.
+C SEE GOLUB AND REINSCH (1970).
+C
+C "ALGORITHMS FOR MINIMIZATION WITHOUT DERIVATIVES",
+C RICHARD P. BRENT, PRENTICE-HALL 1973, PAGES 156-158
+C
+C G. H. GOLUB AND C. REINSCH,
+C "SINGULAR VALUE DECOMPOSITION AND LEAST SQUARES SOLUTIONS',
+C NUMERISCHE MATHEMATIK 14 (1970) PAGES 403-420
+C
+C THE SINGULAR VALUES OF THE ARRAY AB ARE RETURNED IN Q,
+C AND AB IS OVERWRITTEN WITH THE ORTHOGONAL MATRIX V SUCH THAT
+C U.DIAG(Q)=AB.V, WHERE U IS ANOTHER ORTHOGONAL MATRIX.
+C
+C SUBROUTINE MINFIT IS CALLED BY SUBROUTINE PRAXIS.
+C
+ INTEGER N,NMAX,LP,
+ * I,II,J,JTHIRT,K,KK,KT,L,LL2,LPI,L2
+C
+ DOUBLE PRECISION EPS,TOL,AB,Q,E,
+ * DABS,DSQRT,ZABS,ZSQRT,ARG,
+ * C,DENOM,F,G,H,ONE,X,Y,Z,ZERO,S,TWO
+C
+ DIMENSION AB(NMAX,N),Q(N),E(N)
+C
+ ZABS(ARG)=DABS(ARG)
+ ZSQRT(ARG)=DSQRT(ARG)
+C
+ JTHIRT=30
+C
+ ZERO=0.0D0
+ ONE=1.0D0
+ TWO=2.0D0
+C
+C HOUSEHOLDER'S REDUCTION TO BIDIAGONAL FORM...
+C
+ X=ZERO
+ G=ZERO
+C
+ DO 140 I=1,N
+ E(I)=G
+ S=ZERO
+ L=I+1
+C
+ DO 10 J=I,N
+ S=S+AB(J,I)**2
+ 10 CONTINUE
+C
+ IF(S.LT.TOL) THEN
+ G=ZERO
+ ELSE
+ F=AB(I,I)
+C
+ IF(F.LT.ZERO) THEN
+ G=ZSQRT(S)
+ ELSE
+ G=-ZSQRT(S)
+ ENDIF
+C
+ H=F*G-S
+ AB(I,I)=F-G
+C
+ IF(L.GT.N) GO TO 60
+ DO 50 J=L,N
+C
+ F=ZERO
+ IF(I.GT.N) GO TO 30
+ DO 20 K=I,N
+ F=F+AB(K,I)*AB(K,J)
+ 20 CONTINUE
+ 30 F=F/H
+C
+ IF(I.GT.N) GO TO 50
+ DO 40 K=I,N
+ AB(K,J)=AB(K,J)+F*AB(K,I)
+ 40 CONTINUE
+ 50 CONTINUE
+ ENDIF
+C
+ 60 Q(I)=G
+ S=ZERO
+C
+ IF(I.LE.N) THEN
+C
+ IF(L.GT.N) GO TO 80
+ DO 70 J=L,N
+ S=S+AB(I,J)**2
+ 70 CONTINUE
+ ENDIF
+C
+ 80 IF(S.LT.TOL) THEN
+ G=ZERO
+ ELSE
+ F=AB(I,I+1)
+C
+ IF(F.LT.ZERO) THEN
+ G=ZSQRT(S)
+ ELSE
+ G=-ZSQRT(S)
+ ENDIF
+C
+ H=F*G-S
+ AB(I,I+1)=F-G
+ IF(L.GT.N) GO TO 130
+ DO 90 J=L,N
+ E(J)=AB(I,J)/H
+ 90 CONTINUE
+C
+ DO 120 J=L,N
+C
+ S=ZERO
+ DO 100 K=L,N
+ S=S+AB(J,K)*AB(I,K)
+ 100 CONTINUE
+C
+ DO 110 K=L,N
+ AB(J,K)=AB(J,K)+S*E(K)
+ 110 CONTINUE
+ 120 CONTINUE
+ ENDIF
+C
+ 130 Y=ZABS(Q(I))+ZABS(E(I))
+C
+ IF(Y.GT.X) X=Y
+ 140 CONTINUE
+C
+C ACCUMULATION OF RIGHT-HAND TRANSFORMATIONS...
+C
+ DO 210 II=1,N
+ I=N-II+1
+C
+ IF(G.NE.ZERO) THEN
+ H=AB(I,I+1)*G
+C
+ IF(L.GT.N) GO TO 200
+ DO 150 J=L,N
+ AB(J,I)=AB(I,J)/H
+ 150 CONTINUE
+C
+ DO 180 J=L,N
+C
+ S=ZERO
+ DO 160 K=L,N
+ S=S+AB(I,K)*AB(K,J)
+ 160 CONTINUE
+C
+ DO 170 K=L,N
+ AB(K,J)=AB(K,J)+S*AB(K,I)
+ 170 CONTINUE
+ 180 CONTINUE
+ ENDIF
+C
+ IF(L.GT.N) GO TO 200
+ DO 190 J=L,N
+ AB(J,I)=ZERO
+ AB(I,J)=ZERO
+ 190 CONTINUE
+C
+ 200 AB(I,I)=ONE
+ G=E(I)
+ L=I
+ 210 CONTINUE
+C
+C DIAGONALIZATION OF THE BIDIAGONAL FORM...
+C
+ EPS=EPS*X
+ DO 330 KK=1,N
+ K=N-KK+1
+ KT=0
+C
+C LABEL TESTFSPLITTING...
+C
+ 220 KT=KT+1
+C
+ IF(KT.GT.JTHIRT) THEN
+ E(K)=ZERO
+ WRITE(LP,230)
+ 230 FORMAT(' QR FAILED.')
+ ENDIF
+C
+ DO 240 LL2=1,K
+ L2=K-LL2+1
+ L=L2
+C
+C IF(...) GO TO TESTFCONVERGENCE
+C
+ IF(ZABS(E(L)).LE.EPS) GO TO 270
+C
+C IF(...) GO TO CANCELLATION
+C
+ IF(ZABS(Q(L-1)).LE.EPS) GO TO 250
+ 240 CONTINUE
+C
+C CANCELLATION OF E(L) IF L IS GREATER THAN 1...
+C LABEL CANCELLATION...
+C
+ 250 C=ZERO
+ S=ONE
+ IF(L.GT.K) GO TO 270
+ DO 260 I=L,K
+ F=S*E(I)
+ E(I)=C*E(I)
+C
+C IF(...) GO TO TESTFCONVERGENCE
+C
+ IF(ZABS(F).LE.EPS) GO TO 270
+ G=Q(I)
+C
+ IF(ZABS(F).LT.ZABS(G)) THEN
+ H=ZABS(G)*ZSQRT(ONE+(F/G)**2)
+ ELSE IF(F.NE.ZERO) THEN
+ H=ZABS(F)*ZSQRT(ONE+(G/F)**2)
+ ELSE
+ H=ZERO
+ ENDIF
+C
+ Q(I)=H
+C
+ IF(H.EQ.ZERO) THEN
+ H=ONE
+ G=ONE
+ ENDIF
+C
+C THE ABOVE REPLACES Q(I) AND H BY SQUARE ROOT OF (G*G+F*F)
+C WHICH MAY GIVE INCORRECT RESULTS IF THE SQUARES UNDERFLOW OR IF
+C F = G = 0 .
+C
+ C=G/H
+ S=-F/H
+ 260 CONTINUE
+C
+C LABEL TESTFCONVERGENCE...
+C
+ 270 Z=Q(K)
+C
+C IF(...) GO TO CONVERGENCE
+C
+ IF(L.EQ.K) GO TO 310
+C
+C SHIFT FROM BOTTOM 2*2 MINOR.
+C
+ X=Q(L)
+ Y=Q(K-1)
+ G=E(K-1)
+ H=E(K)
+ F=((Y-Z)*(Y+Z)+(G-H)*(G+H))/(TWO*H*Y)
+ G=ZSQRT(F*F+ONE)
+C
+ IF(F.LT.ZERO) THEN
+ DENOM=F-G
+ ELSE
+ DENOM=F+G
+ ENDIF
+C
+ F=((X-Z)*(X+Z)+H*(Y/DENOM-H))/X
+C
+C NEXT QR TRANSFORMATION...
+C
+ S=ONE
+ C=ONE
+ LPI=L+1
+ IF(LPI.GT.K) GO TO 300
+ DO 290 I=LPI,K
+ G=E(I)
+ Y=Q(I)
+ H=S*G
+ G=G*C
+C
+ IF(ZABS(F).LT.ZABS(H)) THEN
+ Z=ZABS(H)*ZSQRT(ONE+(F/H)**2)
+ ELSE IF(F.NE.ZERO) THEN
+ Z=ZABS(F)*ZSQRT(ONE+(H/F)**2)
+ ELSE
+ Z=ZERO
+ ENDIF
+C
+ E(I-1)=Z
+C
+ IF(Z.EQ.ZERO) THEN
+ F=ONE
+ Z=ONE
+ ENDIF
+C
+ C=F/Z
+ S=H/Z
+ F=X*C+G*S
+ G=-X*S+G*C
+ H=Y*S
+ Y=Y*C
+C
+ DO 280 J=1,N
+ X=AB(J,I-1)
+ Z=AB(J,I)
+ AB(J,I-1)=X*C+Z*S
+ AB(J,I)=-X*S+Z*C
+ 280 CONTINUE
+C
+ IF(ZABS(F).LT.ZABS(H)) THEN
+ Z=ZABS(H)*ZSQRT(ONE+(F/H)**2)
+ ELSE IF(F.NE.ZERO) THEN
+ Z=ZABS(F)*ZSQRT(ONE+(H/F)**2)
+ ELSE
+ Z=ZERO
+ ENDIF
+C
+ Q(I-1)=Z
+C
+ IF(Z.EQ.ZERO) THEN
+ F=ONE
+ Z=ONE
+ ENDIF
+C
+ C=F/Z
+ S=H/Z
+ F=C*G+S*Y
+ X=-S*G+C*Y
+ 290 CONTINUE
+C
+ 300 E(L)=ZERO
+ E(K)=F
+ Q(K)=X
+C
+C GO TO TESTFSPLITTING
+C
+ GO TO 220
+C
+C LABEL CONVERGENCE...
+C
+ 310 IF(Z.LT.ZERO) THEN
+C
+C Q(K) IS MADE NON-NEGATIVE.
+C
+ Q(K)=-Z
+ DO 320 J=1,N
+ AB(J,K)=-AB(J,K)
+ 320 CONTINUE
+ ENDIF
+ 330 CONTINUE
+C
+ RETURN
+C
+C END MINFIT
+C
+ END
+ SUBROUTINE SORT
+C
+C THIS SUBROUTINE SORTS THE ELEMENTS OF D
+C AND THE CORRESPONDING COLUMNS OF V INTO DESCENDING ORDER.
+C
+C "ALGORITHMS FOR MINIMIZATION WITHOUT DERIVATIVES",
+C RICHARD P. BRENT, PRENTICE-HALL 1973, PAGES 158-159
+C
+ INTEGER N,NL,NF,LP,JPRINT,NMAX,ILLCIN,KTM,NFMAX,JRANCH
+ INTEGER I,IPI,J,K,NMI
+C
+ DOUBLE PRECISION V,X,D,Q0,Q1,DMIN,EPSMCH,FX,H,QD0,QD1,QF1,
+ * SMALL,T,XLDT,XM2,XM4,DSEED,SCBD
+ DOUBLE PRECISION S
+C
+ COMMON /CPRAX/ V(128,128),X(128),D(128),Q0(128),Q1(128),
+ * DMIN,EPSMCH,FX,H,QD0,QD1,QF1,SMALL,T,XLDT,XM2,XM4,DSEED,SCBD,
+ * N,NL,NF,LP,JPRINT,NMAX,ILLCIN,KTM,NFMAX,JRANCH
+C
+ NMI=N-1
+ IF(NMI.LT.1) GO TO 50
+ DO 40 I=1,NMI
+ K=I
+ S=D(I)
+ IPI=I+1
+ IF(IPI.GT.N) GO TO 20
+C
+ DO 10 J=IPI,N
+C
+ IF(D(J).GT.S) THEN
+ K=J
+ S=D(J)
+ ENDIF
+ 10 CONTINUE
+C
+ 20 IF(K.GT.I) THEN
+ D(K)=D(I)
+ D(I)=S
+C
+ DO 30 J=1,N
+ S=V(J,I)
+ V(J,I)=V(J,K)
+ V(J,K)=S
+ 30 CONTINUE
+ ENDIF
+ 40 CONTINUE
+C
+ 50 RETURN
+C
+C END SORT
+C
+ END
+ SUBROUTINE RANINI(RVALUE)
+C
+C SUBROUTINE RANINI PERFORMS INITIALIZATION FOR SUBROUTINE RANDOM.
+C
+C "ALGORITHMS FOR MINIMIZATION WITHOUT DERIVATIVES",
+C RICHARD P. BRENT, PRENTICE-HALL 1973, PAGES 163-164
+C
+ INTEGER JRAN2,I
+C
+ DOUBLE PRECISION RVALUE,R,RAN3,DMOD,DABS,RAN1
+C
+ COMMON /COMRAN/ RAN3(127),RAN1,JRAN2
+C
+ R=DMOD(DABS(RVALUE),8190.0D0)+1
+ JRAN2=127
+C
+ 10 IF(JRAN2.GT.0) THEN
+ JRAN2=JRAN2-1
+ RAN1=-2.0D0**55
+C
+ DO 20 I=1,7
+ R=DMOD(1756.0D0*R,8191.0D0)
+ RAN1=(RAN1+(R-DMOD(R,32.0D0))/32.0D0)/256.0D0
+ 20 CONTINUE
+C
+ RAN3(JRAN2+1)=RAN1
+ GO TO 10
+ ENDIF
+C
+ RETURN
+C
+C END RANINI
+C
+ END
+ SUBROUTINE RANDOM(RANVAL)
+C
+C SUBROUTINE RANDOM RETURNS A DOUBLE PRECISION PSEUDORANDOM NUMBER
+C UNIFORMLY DISTRIBUTED IN (0,1) (INCLUDING 0 BUT NOT 1).
+C
+C "ALGORITHMS FOR MINIMIZATION WITHOUT DERIVATIVES",
+C RICHARD P. BRENT, PRENTICE-HALL 1973, PAGES 163-164
+C
+C BEFORE THE FIRST CALL TO RANDOM, THE USER MUST
+C CALL RANINI(R) ONCE (ONLY) WITH R A DOUBLE PRECISION NUMBER
+C EQUAL TO ANY INTEGER VALUE.
+C BRENT (PAGE 166) USED THE EQUIVALENT OF
+C CALL RANINI(4.0D0) .
+C
+C THE ALGORITHM USED IN SUBROUTINE RANDOM RETURNS X(N)/2**56,
+C WHERE X(N) = X(N-1) + X(N-127) (MOD 2**56) .
+C SINCE (1 + X + X**127) IS PRIMITIVE (MOD 2),
+C THE PERIOD IS AT LEAST (2**127 - 1), WHICH EXCEEDS 10**38.
+C
+C SEE "SEMINUMERICAL ALGORITHMS", VOLUME 2 OF
+C "THE ART OF COMPUTER PROGRAMMING" BY DONALD E. KNUTH,
+C ADDISON-WESLEY 1969, PAGES 26, 34, AND 464.
+C
+C X(N) IS STORED IN DOUBLE PRECISION AS RAN3 = X(N)/2**56 - 1/2,
+C AND ALL DOUBLE PRECISION ARITHMETIC IS EXACT.
+C
+ INTEGER JRAN2
+C
+ DOUBLE PRECISION RANVAL,RAN3,RAN1
+C
+ COMMON /COMRAN/ RAN3(127),RAN1,JRAN2
+C
+ IF(JRAN2.EQ.0) THEN
+ JRAN2=126
+ ELSE
+ JRAN2=JRAN2-1
+ ENDIF
+C
+ RAN1=RAN1+RAN3(JRAN2+1)
+ IF(RAN1.LT.0.0D0) THEN
+ RAN1=RAN1+0.5D0
+ ELSE
+ RAN1=RAN1-0.5D0
+ ENDIF
+C
+ RAN3(JRAN2+1)=RAN1
+ RANVAL=RAN1+0.5D0
+C
+ RETURN
+C
+C END RANDOM
+C
+ END
+ DOUBLE PRECISION FUNCTION DRANDM(DL)
+C
+C SIMPLE PORTABLE PSEUDORANDOM NUMBER GENERATOR.
+C
+C DRANDM RETURNS FUNCTION VALUES THAT ARE PSEUDORANDOM
+C NUMBERS UNIFORMLY DISTRIBUTED ON THE INTERVAL (0,1).
+C
+C 'NUMERICAL MATHEMATICS AND COMPUTING' BY WARD CHENEY AND
+C DAVID KINCAID, BROOKS/COLE PUBLISHING COMPANY
+C (FIRST EDITION, 1980), PAGE 203
+C
+C AT THE BEGINNING OF EXECUTION, OR WHENEVER A NEW SEQUENCE IS
+C TO BE INITIATED, SET DL EQUAL TO AN INTEGER VALUE BETWEEN
+C 1.0D0 AND 2147483646.0D0, INCLUSIVE. DO THIS ONLY ONCE.
+C THEREAFTER, DO NOT SET OR ALTER DL IN ANY WAY.
+C FUNCTION DRANDM WILL MODIFY DL FOR ITS OWN PURPOSES.
+C
+C DRANDM USES A MULTIPLICATIVE CONGRUENTIAL METHOD.
+C THE NUMBERS GENERATED BY DRANDM SUFFER FROM THE PARALLEL
+C PLANES DEFECT DISCOVERED BY G. MARSAGLIA, AND SHOULD NOT BE
+C USED WHEN HIGH-QUALITY RANDOMNESS IS REQUIRED. IN THAT
+C CASE, USE A "SHUFFLING" METHOD.
+C
+ DOUBLE PRECISION DL,DMOD
+C
+ 10 DL=DMOD(16807.0D0*DL,2147483647.0D0)
+ DRANDM=DL/2147483647.0D0
+ IF(DRANDM.LE.0.0D0 .OR. DRANDM.GE.1.0D0) GO TO 10
+ RETURN
+ END
diff --git a/gnuradio-core/src/gen_interpolator_taps/praxis.txt b/gnuradio-core/src/gen_interpolator_taps/praxis.txt
new file mode 100644
index 000000000..9d0606566
--- /dev/null
+++ b/gnuradio-core/src/gen_interpolator_taps/praxis.txt
@@ -0,0 +1,176 @@
+Brent's PRAXIS minimizer is available in FORTRAN 77. July 1995
+
+"Algorithms for Minimization Without Derivatives"
+by Richard P. Brent, Prentice-Hall, 1973
+ISBN: 0-13-022335-2
+
+This book by Brent was a groundbreaking effort.
+(I believe that it was his Ph.D. thesis at Stanford.)
+His algorithms for finding roots and minima in
+one dimension have good performance for typical problems
+and guaranteed performance in the worst case.
+(A later rootfinder by J. Bus and Dekker gave
+a much lower bound for the worst case,
+but no better performance in typical problems.)
+These algorithms were implemented in both ALGOL W
+and FORTRAN by Brent, and have been used fairly widely.
+
+Brent also gave a multi-dimensional minimization algorithm,
+PRAXIS, but only shows an implementation in ALGOL W.
+This routine has not been widely used, at least in the U.S.
+The PRAXIS package has been translated into FORTRAN
+by Rosalee Taylor, Sue Pinski, and me, and
+I am making it available via anonymous ftp for use as
+freeware (please do not remove our names).
+
+ ftp a.cs.okstate.edu
+ anonymous
+ [enter your userid as password]
+ cd /pub/jpc
+ get praxis.f
+ quit
+
+
+Brent's method and its performance
+
+Newton's method for minimization can find the minimum of a
+quadratic function in one iteration, but is sometimes not
+convenient to use. In the 1960s, several researchers found
+iterative methods that solve quadratic problems exactly in a
+finite number of steps. C. S. Smith (1962) and
+M. J. D. Powell (1964) devised methods
+that had this property and did not require derivatives.
+G. W. Stewart modified the Davidon-Fletcher-Powell quasi-Newton
+method to use finite difference approximations to approximate
+the gradient. Powell's method, or later versions by Zangwill,
+were the most successful of the early direct search methods
+having the property of finite convergence on quadratic functions.
+
+Powell's method was programmed at Harwell as subroutine VA04A,
+and is available as file va04a.f in the same directory as praxis.f.
+VA04A is not extremely robust, and can give underflow, overflow,
+or division by zero. va04a.f has several documented patches in it
+where I tried to get around various abnormal terminations.
+I do not recommend VA04A very strongly.
+
+Brent's PRAXIS added orthogonalization and several other features
+to Powell's method. Brent also dealt carefully with roundoff.
+
+William H. Press et al. in their book "Numerical Recipes"
+comment that
+"Brent has a number of other cute tricks up his sleeve,
+and his modification of Powell's method is probably
+the best presently known."
+
+Roger Fletcher was less enthusiastic in his review of Brent's book
+in The Computer Journal 16 (1973) 314:
+"... I am not convinced that the modifications to Powell's
+method are the best. Use of eigenvector directions
+is not independent of scale changes to the variables,
+and the use of searches in random directions is hardly
+appealing. Nonetheless all the algorithms are demonstrated
+to be competitive by numerical examples."
+
+The methods of Powell, Brent, et al. require that the function
+for which a local minimum is sought must be smooth;
+that is, the function and all of its first partial derivatives
+must be continuous.
+
+Brent compared his method to the methods of Powell, of Stewart,
+and of Davies, Swann, and Campey. Indirectly, he compared it
+also to the Davidon-Fletcher-Powell quasi-Newton method.
+He found that his method was about as efficient as the best
+of these in most cases, and that it was more robust than others
+in some cases. (Pages 139-155 in Brent's book give fair
+comparisons to other methods. The results in Table 7.1 on
+page 138 are correct, but do not include progress all the way
+to convergence, and are therefore not too useful.)
+
+On least squares problems, all of these general minimization
+methods are likely to be inefficient compared to least squares
+methods such as the Gauss-Newton or Marquardt methods.
+
+In addition to the scale dependence that Fletcher deplored,
+PRAXIS also had the disadvantage that it required N, the number
+of parameters, to be greater than or equal to two.
+The failure to handle N=1 is an unnecessary and pointless limitation.
+
+
+The FORTRAN version
+
+We have followed Brent's PRAXIS rather closely.
+I have added a patch to try to handle the case N=1,
+and an option to use a simpler pseudorandom number generator,
+DRANDM. The handling of N=1 is not guaranteed.
+
+The user writes a main program and a function subprogram
+to compute the function to be minimized.
+All communication between the user's main program and PRAXIS
+is done via COMMON, except for an EXTERNAL parameter giving
+the name of the function subprogram.
+The disadvantages of using COMMON are at least two-fold:
+
+ 1) Arrays cannot have adjustable dimensions.
+
+ 2) Because some actual parameters are COMMON variables,
+ the FORTRAN version of PRAXIS probably will not pass
+ the Bell Labs PFORT package as being 100% standard FORTRAN.
+ Nevertheless, this usage will not cause any conflict in
+ any commercial FORTRAN compiler ever written.
+ (If it does, I will apologize and rewrite PRAXIS.)
+
+The advantage of using COMMON is that it is not necessary to pass
+about fifteen more parameters every time the user calls PRAXIS.
+At present all arrays are dimensioned (20) or (20,20),
+and this can easily be increased using two simple global editing
+commands. (In this case, increase the value of NMAX.)
+
+There are no DATA statements in PRAXIS, and it was not necessary
+to use any SAVE statements.
+
+We have used DOUBLE PRECISION for all floating point computations,
+as Brent did. We recommend using DOUBLE PRECISION on all computers
+except possibly Cray computers, in which REAL is reasonably precise.
+The value of "machine epsilon" is computed in subroutine PRASET
+using bisection, and is called EPSMCH.
+Brent computes EPSMCH**4 and 1/EPSMCH**4 in PRAXIS,
+and uses these quantities later.
+Because EPSMCH in DOUBLE PRECISION is less than 1E-16,
+these fourth powers of EPSMCH and 1/EPSMCH will underflow
+and overflow on such machines as VAXs and PCs,
+which have a range of only about 1E38, grossly insufficient
+for scientific computation. For such machines, Brent recommends
+increasing the value of EPSMCH.
+EPSMCH=1E-9 or possibly even 1E-8 might be necessary.
+A better solution would be to eliminate the explicit use of
+these fourth powers, accomplishing the same result implicitly.
+
+A "bug bounty" of $10 U.S. will be paid by me for the first
+notification of any error in PRAXIS.
+The same bounty also applies to any substantive poor design
+choice (having no redeeming advantages whatever) in the FORTRAN
+package. (The patch for N=1 is not included, although any
+suggested improvements in that will be considered carefully.)
+
+praxis.f includes test software to run any of the test problems
+that Brent ran, and is set to run at least one case of each problem.
+I have run these on an IBM 3090, essentially the same
+architecture that Brent used, and obtained essentially the same
+results that Brent shows on pages 140-155. The Hilbert problem with
+N=12, for which Brent shows no termination results and for which
+the results in Table 7.1 are correct but not relevant,
+runs a long time; I cut it off at 3000 function evaluations.
+I don't particularly like Brent's convergence criterion,
+which allows this sort of extremely slow creeping progress,
+but have not modified it.
+
+Please notify me of any problems with this software,
+or of any suggested modifications.
+
+John Chandler
+Computer Science Department
+Oklahoma State University
+Stillwater, Oklahoma 74078, U.S.A.
+(405) 744-5676
+jpc@a.cs.okstate.edu
+
diff --git a/gnuradio-core/src/gen_interpolator_taps/simpson.c b/gnuradio-core/src/gen_interpolator_taps/simpson.c
new file mode 100644
index 000000000..31aaae4ae
--- /dev/null
+++ b/gnuradio-core/src/gen_interpolator_taps/simpson.c
@@ -0,0 +1,76 @@
+/* -*- c -*- */
+#include <math.h>
+#include <stdio.h>
+
+#define EPS (1.0e-5)
+#define JMAX 16
+
+/*
+ * Compute the Nth stage of refinement of an extended trapezoidal
+ * rule. FUNC is input as a pointer to a function to be integrated
+ * between limits A and B. When called with N = 1, the routine
+ * returns the crudest estimate of the integral from A to B of f(x)
+ * dx. Subsequent calls with N=2,3,... (in that sequential order)
+ * will improve the accuracy by adding 2**(N-2) additional interior
+ * points.
+ *
+ * N.B., this function contains static state and IS NEITHER RENTRANT
+ * NOR THREAD SAFE!
+ */
+
+double
+trapzd (double (*func)(double),
+ double a, double b,
+ int n)
+{
+ long double x, tnm, sum, del;
+ static long double s;
+ static int it;
+ int j;
+
+ if (n == 1){
+ it = 1; /* # of points to add on the next call */
+ s = 0.5 * (b - a) * (func(a) + func(b));
+ return s;
+ }
+ else {
+ tnm = it;
+ del = (b-a)/tnm; /* this is the spacing of the points to be added */
+ x = a + 0.5*del;
+ for (sum = 0.0, j = 1; j <= it; j++, x += del)
+ sum += func(x);
+ it *= 2;
+ s = 0.5 * (s + (b-a) * sum/tnm); /* replace s by it's refined value */
+ return s;
+ }
+}
+
+/*
+ * Returns the integral of the function FUNC from A to B. The
+ * parameters EPS can be set to the desired fractional accuracy and
+ * JMAX so that 2**(JMAX-1) is the maximum allowed number of steps.
+ * Integration is performed by Simpson's rule.
+ */
+
+double
+qsimp (double (*func)(double),
+ double a, /* lower limit */
+ double b) /* upper limit */
+{
+ int j;
+ long double s, st, ost, os;
+
+ ost = os = -1.0e30;
+ for (j = 1; j <= JMAX; j++){
+ st = trapzd (func, a, b, j);
+ s = (4.0 * st - ost)/3.0;
+ if (fabs (s - os) < EPS * fabs(os))
+ return s;
+ os = s;
+ ost = st;
+ }
+ fprintf (stderr, "Too many steps in routine QSIMP\n");
+ // exit (1);
+ return s;
+}
+
diff --git a/gnuradio-core/src/gen_interpolator_taps/simpson.h b/gnuradio-core/src/gen_interpolator_taps/simpson.h
new file mode 100644
index 000000000..68774f9a2
--- /dev/null
+++ b/gnuradio-core/src/gen_interpolator_taps/simpson.h
@@ -0,0 +1,3 @@
+double qsimp (double (*func)(double),
+ double a, double b);
+
diff --git a/gnuradio-core/src/lib/CMakeLists.txt b/gnuradio-core/src/lib/CMakeLists.txt
new file mode 100644
index 000000000..c061a5723
--- /dev/null
+++ b/gnuradio-core/src/lib/CMakeLists.txt
@@ -0,0 +1,106 @@
+# 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.
+
+########################################################################
+# Setup compatibility checks and defines
+########################################################################
+include(${CMAKE_CURRENT_SOURCE_DIR}/ConfigChecks.cmake)
+
+########################################################################
+# Include subdirs rather to populate to the sources lists.
+########################################################################
+GR_INCLUDE_SUBDIRECTORY(missing)
+GR_INCLUDE_SUBDIRECTORY(runtime)
+GR_INCLUDE_SUBDIRECTORY(filter)
+GR_INCLUDE_SUBDIRECTORY(viterbi)
+GR_INCLUDE_SUBDIRECTORY(general)
+GR_INCLUDE_SUBDIRECTORY(gengen)
+GR_INCLUDE_SUBDIRECTORY(reed-solomon)
+GR_INCLUDE_SUBDIRECTORY(io)
+GR_INCLUDE_SUBDIRECTORY(hier)
+
+list(APPEND gnuradio_core_sources bug_work_around_6.cc)
+list(APPEND test_gnuradio_core_sources bug_work_around_6.cc)
+
+########################################################################
+# Setup the include and linker paths
+########################################################################
+include_directories(
+ ${GNURADIO_CORE_INCLUDE_DIRS}
+ ${VOLK_INCLUDE_DIRS}
+ ${GRUEL_INCLUDE_DIRS}
+ ${Boost_INCLUDE_DIRS}
+ ${FFTW3F_INCLUDE_DIRS}
+)
+
+link_directories(
+ ${Boost_LIBRARY_DIRS}
+ ${FFTW3F_LIBRARY_DIRS}
+)
+
+########################################################################
+# Setup library
+########################################################################
+list(APPEND gnuradio_core_libs
+ gruel
+ ${Boost_LIBRARIES}
+ ${FFTW3F_LIBRARIES}
+)
+
+if(FFTW3F_THREADS_LIBRARIES)
+ list(APPEND gnuradio_core_libs ${FFTW3F_THREADS_LIBRARIES} )
+ add_definitions("-DFFTW3F_THREADS")
+endif()
+
+#need to link with librt on ubuntu 11.10 for shm_*
+if(LINUX)
+ list(APPEND gnuradio_core_libs rt)
+endif()
+
+# Link against libvolk
+list(APPEND gnuradio_core_libs volk)
+
+add_library(gnuradio-core SHARED ${gnuradio_core_sources})
+target_link_libraries(gnuradio-core ${gnuradio_core_libs})
+GR_LIBRARY_FOO(gnuradio-core RUNTIME_COMPONENT "core_runtime" DEVEL_COMPONENT "core_devel")
+set_target_properties(gnuradio-core PROPERTIES LINK_INTERFACE_LIBRARIES "gruel")
+
+########################################################################
+# Setup executables
+########################################################################
+add_executable(gnuradio-config-info gnuradio-config-info.cc)
+target_link_libraries(gnuradio-config-info gnuradio-core ${Boost_LIBRARIES})
+install(
+ TARGETS gnuradio-config-info
+ DESTINATION ${GR_RUNTIME_DIR}
+ COMPONENT "core_runtime"
+)
+
+########################################################################
+# Setup tests
+########################################################################
+if(ENABLE_TESTING)
+
+include_directories(${CPPUNIT_INCLUDE_DIRS})
+link_directories(${CPPUNIT_LIBRARY_DIRS})
+
+add_library(test-gnuradio-core SHARED ${test_gnuradio_core_sources})
+target_link_libraries(test-gnuradio-core ${GR_TEST_TARGET_DEPS} ${CPPUNIT_LIBRARIES} ${Boost_LIBRARIES})
+
+endif(ENABLE_TESTING)
diff --git a/gnuradio-core/src/lib/ConfigChecks.cmake b/gnuradio-core/src/lib/ConfigChecks.cmake
new file mode 100644
index 000000000..26b778a7a
--- /dev/null
+++ b/gnuradio-core/src/lib/ConfigChecks.cmake
@@ -0,0 +1,212 @@
+# 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.
+
+########################################################################
+INCLUDE(GrMiscUtils)
+INCLUDE(CheckCXXSourceCompiles)
+
+IF(MSVC) #add this directory for our provided headers
+LIST(APPEND CMAKE_REQUIRED_INCLUDES ${CMAKE_SOURCE_DIR}/msvc)
+ENDIF(MSVC)
+
+GR_CHECK_HDR_N_DEF(netdb.h HAVE_NETDB_H)
+GR_CHECK_HDR_N_DEF(sys/time.h HAVE_SYS_TIME_H)
+GR_CHECK_HDR_N_DEF(sys/types.h HAVE_SYS_TYPES_H)
+GR_CHECK_HDR_N_DEF(sys/select.h HAVE_SYS_SELECT_H)
+GR_CHECK_HDR_N_DEF(sys/socket.h HAVE_SYS_SOCKET_H)
+GR_CHECK_HDR_N_DEF(io.h HAVE_IO_H)
+GR_CHECK_HDR_N_DEF(sys/mman.h HAVE_SYS_MMAN_H)
+GR_CHECK_HDR_N_DEF(sys/ipc.h HAVE_SYS_IPC_H)
+GR_CHECK_HDR_N_DEF(sys/shm.h HAVE_SYS_SHM_H)
+GR_CHECK_HDR_N_DEF(signal.h HAVE_SIGNAL_H)
+GR_CHECK_HDR_N_DEF(netinet/in.h HAVE_NETINET_IN_H)
+GR_CHECK_HDR_N_DEF(arpa/inet.h HAVE_ARPA_INET_H)
+GR_CHECK_HDR_N_DEF(byteswap.h HAVE_BYTESWAP_H)
+GR_CHECK_HDR_N_DEF(linux/ppdev.h HAVE_LINUX_PPDEV_H)
+GR_CHECK_HDR_N_DEF(dev/ppbus/ppi.h HAVE_DEV_PPBUS_PPI_H)
+GR_CHECK_HDR_N_DEF(unistd.h HAVE_UNISTD_H)
+GR_CHECK_HDR_N_DEF(malloc.h HAVE_MALLOC_H)
+
+
+########################################################################
+CHECK_CXX_SOURCE_COMPILES("
+ #include <stdio.h>
+ int main(){snprintf(0, 0, 0); return 0;}
+ " HAVE_SNPRINTF
+)
+GR_ADD_COND_DEF(HAVE_SNPRINTF)
+
+########################################################################
+CHECK_CXX_SOURCE_COMPILES("
+ #include <signal.h>
+ int main(){sigaction(0, 0, 0); return 0;}
+ " HAVE_SIGACTION
+)
+GR_ADD_COND_DEF(HAVE_SIGACTION)
+
+########################################################################
+CHECK_CXX_SOURCE_COMPILES("
+ #include <sys/select.h>
+ int main(){select(0, 0, 0, 0, 0); return 0;}
+ " HAVE_SELECT
+)
+GR_ADD_COND_DEF(HAVE_SELECT)
+
+
+########################################################################
+CHECK_CXX_SOURCE_COMPILES("
+ #include <unistd.h>
+ int main(){sysconf(0); return 0;}
+ " HAVE_SYSCONF
+)
+GR_ADD_COND_DEF(HAVE_SYSCONF)
+
+CHECK_CXX_SOURCE_COMPILES("
+ #include <unistd.h>
+ int main(){getpagesize(); return 0;}
+ " HAVE_GETPAGESIZE
+)
+GR_ADD_COND_DEF(HAVE_GETPAGESIZE)
+
+
+########################################################################
+CHECK_CXX_SOURCE_COMPILES("
+ #include <Winbase.h>
+ int main(){Sleep(0); return 0;}
+ " HAVE_SSLEEP
+)
+GR_ADD_COND_DEF(HAVE_SSLEEP)
+
+CHECK_CXX_SOURCE_COMPILES("
+ #include <time.h>
+ int main(){nanosleep(0, 0); return 0;}
+ " HAVE_NANOSLEEP
+)
+GR_ADD_COND_DEF(HAVE_NANOSLEEP)
+
+CHECK_CXX_SOURCE_COMPILES("
+ #include <sys/time.h>
+ int main(){gettimeofday(0, 0); return 0;}
+ " HAVE_GETTIMEOFDAY
+)
+GR_ADD_COND_DEF(HAVE_GETTIMEOFDAY)
+
+########################################################################
+CHECK_CXX_SOURCE_COMPILES("
+ #include <stdlib.h>
+ int main(){posix_memalign(0, 0, 0); return 0;}
+ " HAVE_POSIX_MEMALIGN
+)
+GR_ADD_COND_DEF(HAVE_POSIX_MEMALIGN)
+
+CHECK_CXX_SOURCE_COMPILES("
+ #include <malloc.h>
+ int main(){valloc(0); return 0;}
+ " HAVE_VALLOC
+)
+GR_ADD_COND_DEF(HAVE_VALLOC)
+
+ADD_DEFINITIONS(-DALIGNED_MALLOC=0)
+
+########################################################################
+SET(CMAKE_REQUIRED_LIBRARIES -lpthread)
+CHECK_CXX_SOURCE_COMPILES("
+ #include <signal.h>
+ int main(){pthread_sigmask(0, 0, 0); return 0;}
+ " HAVE_PTHREAD_SIGMASK
+)
+GR_ADD_COND_DEF(HAVE_PTHREAD_SIGMASK)
+SET(CMAKE_REQUIRED_LIBRARIES)
+
+########################################################################
+CHECK_CXX_SOURCE_COMPILES("
+ #include <windows.h>
+ int main(){
+ HANDLE handle;
+ int size;
+ LPCTSTR lpName;
+ handle = CreateFileMapping(
+ INVALID_HANDLE_VALUE, // use paging file
+ NULL, // default security
+ PAGE_READWRITE, // read/write access
+ 0, // max. object size
+ size, // buffer size
+ lpName); // name of mapping object
+ return 0;
+ } " HAVE_CREATEFILEMAPPING
+)
+GR_ADD_COND_DEF(HAVE_CREATEFILEMAPPING)
+
+########################################################################
+CHECK_INCLUDE_FILE_CXX(windows.h HAVE_WINDOWS_H)
+IF(HAVE_WINDOWS_H)
+ ADD_DEFINITIONS(-DHAVE_WINDOWS_H -DUSING_WINSOCK)
+ MESSAGE(STATUS "Adding windows libs to gnuradio core libs...")
+ LIST(APPEND gnuradio_core_libs WS2_32.lib WSock32.lib)
+ENDIF(HAVE_WINDOWS_H)
+
+########################################################################
+SET(CMAKE_REQUIRED_LIBRARIES -lrt)
+CHECK_CXX_SOURCE_COMPILES("
+ #include <sys/types.h>
+ #include <sys/mman.h>
+ int main(){shm_open(0, 0, 0); return 0;}
+ " HAVE_SHM_OPEN
+)
+GR_ADD_COND_DEF(HAVE_SHM_OPEN)
+SET(CMAKE_REQUIRED_LIBRARIES)
+
+########################################################################
+CHECK_CXX_SOURCE_COMPILES("
+ #define _GNU_SOURCE
+ #include <math.h>
+ int main(){double x, sin, cos; sincos(x, &sin, &cos); return 0;}
+ " HAVE_SINCOS
+)
+GR_ADD_COND_DEF(HAVE_SINCOS)
+
+CHECK_CXX_SOURCE_COMPILES("
+ #define _GNU_SOURCE
+ #include <math.h>
+ int main(){float x, sin, cos; sincosf(x, &sin, &cos); return 0;}
+ " HAVE_SINCOSF
+)
+GR_ADD_COND_DEF(HAVE_SINCOSF)
+
+CHECK_CXX_SOURCE_COMPILES("
+ #include <math.h>
+ int main(){sinf(0); return 0;}
+ " HAVE_SINF
+)
+GR_ADD_COND_DEF(HAVE_SINF)
+
+CHECK_CXX_SOURCE_COMPILES("
+ #include <math.h>
+ int main(){cosf(0); return 0;}
+ " HAVE_COSF
+)
+GR_ADD_COND_DEF(HAVE_COSF)
+
+########################################################################
+CHECK_CXX_SOURCE_COMPILES("
+ #include <sys/mman.h>
+ int main(){mmap(0, 0, 0, 0, 0, 0); return 0;}
+ " HAVE_MMAP
+)
+GR_ADD_COND_DEF(HAVE_MMAP)
diff --git a/gnuradio-core/src/lib/bug_work_around_6.cc b/gnuradio-core/src/lib/bug_work_around_6.cc
new file mode 100644
index 000000000..f8012af0d
--- /dev/null
+++ b/gnuradio-core/src/lib/bug_work_around_6.cc
@@ -0,0 +1,3 @@
+// if libgrio has no sources, it doesn't get built correctly
+#include <gruel/attributes.h>
+static int gr_bug_work_around_6 __GR_ATTR_UNUSED;
diff --git a/gnuradio-core/src/lib/filter/3dnow_float_dotprod_really_simple.S b/gnuradio-core/src/lib/filter/3dnow_float_dotprod_really_simple.S
new file mode 100644
index 000000000..546a4a6f3
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/3dnow_float_dotprod_really_simple.S
@@ -0,0 +1,99 @@
+#
+# Copyright 2002 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.
+#
+
+
+# input and taps are guarenteed to be 16 byte aligned.
+# n_4_float_blocks is != 0
+#
+#
+# float
+# sse_float_dotprod (const float *input,
+# const float *taps, unsigned n_4_float_blocks)
+# {
+# float sum0 = 0;
+# float sum1 = 0;
+# float sum2 = 0;
+# float sum3 = 0;
+#
+# do {
+#
+# sum0 += input[0] * taps[0];
+# sum1 += input[1] * taps[1];
+# sum2 += input[2] * taps[2];
+# sum3 += input[3] * taps[3];
+#
+# input += 4;
+# taps += 4;
+#
+# } while (--n_4_float_blocks != 0);
+#
+#
+# return sum0 + sum1 + sum2 + sum3;
+# }
+#
+
+
+ .file "3dnow_float_dotprod_really_simple.s"
+// .version "01.01"
+.text
+ .p2align 4
+.globl sse_float_dotprod
+ .type sse_float_dotprod,@function
+sse_float_dotprod:
+ pushl %ebp
+ movl %esp, %ebp
+ movl 8(%ebp), %edx
+ movl 12(%ebp), %eax
+ movl 16(%ebp), %ecx
+
+
+ # The plan is to get it computing the correct answer, and
+ # then to unroll and schedule the inner loop.
+
+ pxor %mm4, %mm4 # mm4 = 0 0
+ shll $1, %ecx # count * 2
+
+ .p2align 4
+.Loop1:
+ movq (%eax), %mm0
+ pfmul (%edx), %mm0
+ pfadd %mm0, %mm4
+ addl $8, %edx
+ addl $8, %eax
+ decl %ecx
+ jne .Loop1
+
+ # at this point mm4 contains partial sums
+
+ pfacc %mm4, %mm4
+ movd %mm4, 16(%ebp)
+ femms
+ flds 16(%ebp)
+
+ popl %ebp
+ ret
+.Lfe1:
+ .size sse_float_dotprod,.Lfe1-sse_float_dotprod
+ .ident "Hand coded x86 3DNow! assembly"
+
+#if defined(__linux__) && defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff --git a/gnuradio-core/src/lib/filter/3dnow_float_dotprod_simple.S b/gnuradio-core/src/lib/filter/3dnow_float_dotprod_simple.S
new file mode 100644
index 000000000..c721c3601
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/3dnow_float_dotprod_simple.S
@@ -0,0 +1,106 @@
+#
+# Copyright 2002 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.
+#
+
+
+# input and taps are guarenteed to be 16 byte aligned.
+# n_4_float_blocks is != 0
+#
+#
+# float
+# sse_float_dotprod (const float *input,
+# const float *taps, unsigned n_4_float_blocks)
+# {
+# float sum0 = 0;
+# float sum1 = 0;
+# float sum2 = 0;
+# float sum3 = 0;
+#
+# do {
+#
+# sum0 += input[0] * taps[0];
+# sum1 += input[1] * taps[1];
+# sum2 += input[2] * taps[2];
+# sum3 += input[3] * taps[3];
+#
+# input += 4;
+# taps += 4;
+#
+# } while (--n_4_float_blocks != 0);
+#
+#
+# return sum0 + sum1 + sum2 + sum3;
+# }
+#
+
+
+ .file "3dnow_float_dotprod_simple.s"
+// .version "01.01"
+.text
+ .p2align 4
+.globl sse_float_dotprod
+ .type sse_float_dotprod,@function
+sse_float_dotprod:
+ pushl %ebp
+ movl %esp, %ebp
+ movl 8(%ebp), %edx
+ movl 12(%ebp), %eax
+ movl 16(%ebp), %ecx
+
+
+ # The plan is to get it computing the correct answer, and
+ # then to unroll and schedule the inner loop.
+
+ pxor %mm4, %mm4 # mm4 = 0 0
+ pxor %mm5, %mm5 # mm5 = 0 0
+
+ .p2align 4
+.Loop1:
+ movq 0(%eax), %mm0
+ movq 8(%eax), %mm1
+
+ pfmul 0(%edx), %mm0
+ pfadd %mm0, %mm4
+
+ pfmul 8(%edx), %mm1
+ pfadd %mm1, %mm5
+
+ addl $16, %edx
+ addl $16, %eax
+ decl %ecx
+ jne .Loop1
+
+ # at this point mm4 and mm5 contain partial sums
+
+ pfadd %mm5, %mm4
+ pfacc %mm4, %mm4
+ movd %mm4, 16(%ebp)
+ femms
+ flds 16(%ebp)
+
+ popl %ebp
+ ret
+.Lfe1:
+ .size sse_float_dotprod,.Lfe1-sse_float_dotprod
+ .ident "Hand coded x86 3DNow! assembly"
+
+#if defined(__linux__) && defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff --git a/gnuradio-core/src/lib/filter/CMakeLists.txt b/gnuradio-core/src/lib/filter/CMakeLists.txt
new file mode 100644
index 000000000..088d3376d
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/CMakeLists.txt
@@ -0,0 +1,357 @@
+# 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
+########################################################################
+
+#set the C language property on the assembly files so the compiler will pick them up
+file(GLOB gr_core_filter_asms ${CMAKE_CURRENT_SOURCE_DIR}/*.S)
+foreach(gr_core_filter_asm ${gr_core_filter_asms})
+ set_property(SOURCE ${gr_core_filter_asm} PROPERTY LANGUAGE C)
+endforeach(gr_core_filter_asm)
+
+#detect 32 or 64 bit compiler
+if(CMAKE_SYSTEM_PROCESSOR MATCHES "^(i.86|x86|x86_64|amd64)$")
+ include(CheckTypeSize)
+ check_type_size("void*" SIZEOF_VOID_P BUILTIN_TYPES_ONLY)
+ if (${SIZEOF_VOID_P} EQUAL 8)
+ set(CMAKE_SYSTEM_PROCESSOR_x86 64)
+ else()
+ set(CMAKE_SYSTEM_PROCESSOR_x86 32)
+ endif()
+endif()
+
+########################################################################
+# Generate the makefile.gen, then extract its sources:
+# This is a round-about way to extract the sources,
+# but it requires minimum changed to the python utils.
+#
+# The recommended way to do this:
+# - Make a generation macro that registers the sources command.
+# - List the generation macro with each templated source file.
+# - Create a python script (very generic) to perform generation.
+# - This way the targets would depend only on their sources.
+########################################################################
+execute_process(
+ COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} -c "
+import os, sys
+sys.path.append('${GR_CORE_PYTHONPATH}')
+sys.path.append('${CMAKE_CURRENT_SOURCE_DIR}')
+os.environ['srcdir'] = '${CMAKE_CURRENT_SOURCE_DIR}'
+os.environ['gendir'] = '${CMAKE_CURRENT_BINARY_DIR}'
+os.environ['do_makefile'] = '1'
+os.environ['do_sources'] = '0'
+from generate_all import generate_all
+generate_all()
+ " WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+)
+
+macro(FILTER_GEN_EXTRACT outvar ext)
+ execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import os; print ';'.join(
+ map(lambda x: os.path.join('${CMAKE_CURRENT_BINARY_DIR}', x.replace('\\\\', '').strip()),
+ filter(lambda f: '${ext}' in f, open('${CMAKE_CURRENT_BINARY_DIR}/Makefile.gen').readlines()
+ )))" OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE ${outvar})
+ file(TO_CMAKE_PATH "${${outvar}}" ${outvar})
+endmacro(FILTER_GEN_EXTRACT)
+
+FILTER_GEN_EXTRACT(generated_filter_sources ".cc")
+FILTER_GEN_EXTRACT(generated_filter_includes ".h")
+FILTER_GEN_EXTRACT(generated_filter_swigs ".i")
+
+#TODO simplify this list with a triple-threat for loop
+set(generated_filter_deps
+ ${CMAKE_CURRENT_SOURCE_DIR}/generate_all.py
+ ${CMAKE_CURRENT_SOURCE_DIR}/generate_gr_fir_XXX.py
+ ${CMAKE_CURRENT_SOURCE_DIR}/generate_gr_fir_filter_XXX.py
+ ${CMAKE_CURRENT_SOURCE_DIR}/generate_gr_interp_fir_filter_XXX.py
+ ${CMAKE_CURRENT_SOURCE_DIR}/generate_gr_rational_resampler_base_XXX.py
+ ${CMAKE_CURRENT_SOURCE_DIR}/generate_gr_fir_sysconfig.py
+ ${CMAKE_CURRENT_SOURCE_DIR}/generate_gr_fir_sysconfig_generic.py
+ ${CMAKE_CURRENT_SOURCE_DIR}/generate_gr_fir_util.py
+ ${CMAKE_CURRENT_SOURCE_DIR}/generate_gr_freq_xlating_fir_filter_XXX.py
+ ${CMAKE_CURRENT_SOURCE_DIR}/generate_gri_fir_filter_with_buffer_XXX.py
+ ${CMAKE_CURRENT_SOURCE_DIR}/generate_utils.py
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_XXX.cc.t
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_XXX.h.t
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_XXX_generic.cc.t
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_XXX_generic.h.t
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_filter_XXX.cc.t
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_filter_XXX.h.t
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_filter_XXX.i.t
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_interp_fir_filter_XXX.cc.t
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_interp_fir_filter_XXX.h.t
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_interp_fir_filter_XXX.i.t
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_rational_resampler_base_XXX.cc.t
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_rational_resampler_base_XXX.h.t
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_rational_resampler_base_XXX.i.t
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_freq_xlating_fir_filter_XXX.cc.t
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_freq_xlating_fir_filter_XXX.h.t
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_freq_xlating_fir_filter_XXX.i.t
+ ${CMAKE_CURRENT_SOURCE_DIR}/gri_fir_filter_with_buffer_XXX.cc.t
+ ${CMAKE_CURRENT_SOURCE_DIR}/gri_fir_filter_with_buffer_XXX.h.t
+)
+
+add_custom_command(
+ OUTPUT
+ ${generated_filter_sources}
+ ${generated_filter_includes}
+ ${generated_filter_swigs}
+ DEPENDS ${generated_filter_deps}
+ COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} -c
+ "import os, sys;sys.path.append('${GR_CORE_PYTHONPATH}');sys.path.append('${CMAKE_CURRENT_SOURCE_DIR}');os.environ['srcdir'] = '${CMAKE_CURRENT_SOURCE_DIR}';from generate_all import generate_all;generate_all()"
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ COMMENT "generating filter files"
+ VERBATIM
+)
+
+add_custom_target(filter_generated DEPENDS
+ ${generated_filter_sources}
+ ${generated_filter_includes}
+ ${generated_filter_swigs}
+)
+
+########################################################################
+# Add target specific files
+# May VOLK put a rest to all the insanity below.
+########################################################################
+if(MSVC)
+ list(APPEND gnuradio_core_sources
+ ${CMAKE_CURRENT_SOURCE_DIR}/sysconfig_generic.cc
+ )
+ list(APPEND test_gnuradio_core_sources
+ ${CMAKE_CURRENT_SOURCE_DIR}/qa_dotprod_generic.cc
+ )
+else(MSVC)
+if(CMAKE_SYSTEM_PROCESSOR_x86)
+ list(APPEND gnuradio_core_sources
+ ${CMAKE_CURRENT_SOURCE_DIR}/sysconfig_x86.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_sysconfig_x86.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_cpu_x86.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_ccc_simd.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_ccc_x86.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_fff_simd.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_fff_x86.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_fsf_simd.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_fsf_x86.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_scc_simd.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_scc_x86.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_fcc_simd.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_fcc_x86.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_ccf_simd.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_ccf_x86.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/sse_debug.c
+ )
+ list(APPEND test_gnuradio_core_sources
+ ${CMAKE_CURRENT_SOURCE_DIR}/qa_dotprod_x86.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/qa_float_dotprod_x86.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/qa_complex_dotprod_x86.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/qa_ccomplex_dotprod_x86.cc
+ )
+endif()
+
+if(CMAKE_SYSTEM_PROCESSOR_x86 AND "${CMAKE_SYSTEM_PROCESSOR_x86}" STREQUAL "64")
+ list(APPEND gnuradio_core_sources
+ ${CMAKE_CURRENT_SOURCE_DIR}/float_dotprod_sse64.S
+ ${CMAKE_CURRENT_SOURCE_DIR}/float_dotprod_3dnow64.S
+ ${CMAKE_CURRENT_SOURCE_DIR}/complex_dotprod_3dnowext64.S
+ ${CMAKE_CURRENT_SOURCE_DIR}/complex_dotprod_3dnow64.S
+ ${CMAKE_CURRENT_SOURCE_DIR}/complex_dotprod_sse64.S
+ ${CMAKE_CURRENT_SOURCE_DIR}/ccomplex_dotprod_3dnowext64.S
+ ${CMAKE_CURRENT_SOURCE_DIR}/ccomplex_dotprod_3dnow64.S
+ ${CMAKE_CURRENT_SOURCE_DIR}/ccomplex_dotprod_sse64.S
+ ${CMAKE_CURRENT_SOURCE_DIR}/fcomplex_dotprod_3dnow64.S
+ ${CMAKE_CURRENT_SOURCE_DIR}/fcomplex_dotprod_sse64.S
+ ${CMAKE_CURRENT_SOURCE_DIR}/short_dotprod_mmx64.S
+ )
+elseif(CMAKE_SYSTEM_PROCESSOR_x86 AND "${CMAKE_SYSTEM_PROCESSOR_x86}" STREQUAL "32")
+ list(APPEND gnuradio_core_sources
+ ${CMAKE_CURRENT_SOURCE_DIR}/float_dotprod_sse.S
+ ${CMAKE_CURRENT_SOURCE_DIR}/float_dotprod_3dnow.S
+ ${CMAKE_CURRENT_SOURCE_DIR}/complex_dotprod_3dnowext.S
+ ${CMAKE_CURRENT_SOURCE_DIR}/complex_dotprod_3dnow.S
+ ${CMAKE_CURRENT_SOURCE_DIR}/complex_dotprod_sse.S
+ ${CMAKE_CURRENT_SOURCE_DIR}/ccomplex_dotprod_3dnowext.S
+ ${CMAKE_CURRENT_SOURCE_DIR}/ccomplex_dotprod_3dnow.S
+ ${CMAKE_CURRENT_SOURCE_DIR}/ccomplex_dotprod_sse.S
+ ${CMAKE_CURRENT_SOURCE_DIR}/fcomplex_dotprod_3dnow.S
+ ${CMAKE_CURRENT_SOURCE_DIR}/fcomplex_dotprod_sse.S
+ ${CMAKE_CURRENT_SOURCE_DIR}/short_dotprod_mmx.S
+ )
+elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)")
+ if(CMAKE_COMPILER_IS_GNUCXX)
+ add_definitions(-maltivec)
+ endif()
+ list(APPEND gnuradio_core_sources
+ ${CMAKE_CURRENT_SOURCE_DIR}/sysconfig_powerpc.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_sysconfig_powerpc.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_cpu_powerpc.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_fff_altivec.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_altivec.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/dotprod_fff_altivec.c
+ )
+ list(APPEND test_gnuradio_core_sources
+ ${CMAKE_CURRENT_SOURCE_DIR}/qa_dotprod_powerpc.cc
+ )
+elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm")
+ if(have_mfpu_neon)
+ add_definitions(-DHAVE_MFPU_NEON)
+ endif()
+ list(APPEND gnuradio_core_sources
+ ${CMAKE_CURRENT_SOURCE_DIR}/sysconfig_armv7_a.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_sysconfig_armv7_a.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_cpu_armv7_a.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_fff_armv7_a.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/dotprod_fff_armv7_a.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/dotprod_ccf_armv7_a.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_ccf_armv7_a.cc
+ )
+ list(APPEND test_gnuradio_core_sources
+ ${CMAKE_CURRENT_SOURCE_DIR}/qa_dotprod_armv7_a.cc
+ )
+else()
+ list(APPEND gnuradio_core_sources
+ ${CMAKE_CURRENT_SOURCE_DIR}/sysconfig_generic.cc
+ )
+ list(APPEND test_gnuradio_core_sources
+ ${CMAKE_CURRENT_SOURCE_DIR}/qa_dotprod_generic.cc
+ )
+endif()
+endif(MSVC)
+
+########################################################################
+# Append gnuradio-core library sources
+########################################################################
+list(APPEND gnuradio_core_sources
+ ${generated_filter_sources}
+ ${CMAKE_CURRENT_SOURCE_DIR}/gri_fft_filter_fff_generic.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/gri_fft_filter_ccc_generic.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_sincos.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/gri_goertzel.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/gri_mmse_fir_interpolator.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/gri_mmse_fir_interpolator_cc.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/complex_dotprod_generic.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/ccomplex_dotprod_generic.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/float_dotprod_generic.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/short_dotprod_generic.c
+)
+
+########################################################################
+# Append gnuradio-core test sources
+########################################################################
+list(APPEND test_gnuradio_core_sources
+ ${CMAKE_CURRENT_SOURCE_DIR}/qa_filter.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_fir_ccf.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_fir_fcc.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_fir_fff.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_fir_ccc.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_fir_scc.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_rotator.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/qa_gri_mmse_fir_interpolator.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/qa_gri_mmse_fir_interpolator_cc.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/qa_gri_fir_filter_with_buffer_ccf.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/qa_gri_fir_filter_with_buffer_ccc.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/qa_gri_fir_filter_with_buffer_fcc.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/qa_gri_fir_filter_with_buffer_fff.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/qa_gri_fir_filter_with_buffer_fsf.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/qa_gri_fir_filter_with_buffer_scc.cc
+)
+
+########################################################################
+# Install runtime headers
+########################################################################
+install(FILES
+ ${generated_filter_includes}
+ ${CMAKE_CURRENT_SOURCE_DIR}/complex_dotprod_generic.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/complex_dotprod_x86.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/fcomplex_dotprod_x86.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/ccomplex_dotprod_generic.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/ccomplex_dotprod_x86.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/float_dotprod_generic.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/float_dotprod_x86.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_altivec.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_cpu.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gri_fft_filter_fff_generic.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gri_fft_filter_ccc_generic.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_sysconfig_x86.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_sysconfig_powerpc.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_rotator.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_sincos.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_single_pole_iir.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_vec_types.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gri_goertzel.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gri_iir.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gri_mmse_fir_interpolator.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gri_mmse_fir_interpolator_cc.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/qa_filter.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/short_dotprod_generic.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/short_dotprod_x86.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/sse_debug.h
+ DESTINATION ${GR_INCLUDE_DIR}/gnuradio
+ COMPONENT "core_devel"
+)
+
+########################################################################
+# Install swig headers
+########################################################################
+if(ENABLE_PYTHON)
+install(FILES
+ ${generated_filter_swigs}
+ ${CMAKE_CURRENT_SOURCE_DIR}/filter.i
+ ${CMAKE_CURRENT_BINARY_DIR}/filter_generated.i
+ DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig
+ COMPONENT "core_swig"
+)
+endif(ENABLE_PYTHON)
+
+########################################################################
+# Handle triple-threat files that have cc, h, and i
+########################################################################
+set(gr_core_filter_triple_threats
+ gr_adaptive_fir_ccc
+ gr_adaptive_fir_ccf
+ gr_dc_blocker_cc
+ gr_dc_blocker_ff
+ gr_fft_filter_ccc
+ gr_fft_filter_fff
+ gr_filter_delay_fc
+ gr_fractional_interpolator_ff
+ gr_fractional_interpolator_cc
+ gr_goertzel_fc
+ gr_hilbert_fc
+ gr_iir_filter_ffd
+ gr_single_pole_iir_filter_ff
+ gr_single_pole_iir_filter_cc
+ gr_pfb_channelizer_ccf
+ gr_pfb_synthesizer_ccf
+ gr_pfb_decimator_ccf
+ gr_pfb_interpolator_ccf
+ gr_pfb_arb_resampler_ccf
+ gr_pfb_arb_resampler_fff
+ gr_pfb_clock_sync_ccf
+ gr_pfb_clock_sync_fff
+)
+
+foreach(file_tt ${gr_core_filter_triple_threats})
+ list(APPEND gnuradio_core_sources ${CMAKE_CURRENT_SOURCE_DIR}/${file_tt}.cc)
+ install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${file_tt}.h DESTINATION ${GR_INCLUDE_DIR}/gnuradio COMPONENT "core_devel")
+ if(ENABLE_PYTHON)
+ install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${file_tt}.i DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig COMPONENT "core_swig")
+ endif(ENABLE_PYTHON)
+endforeach(file_tt ${gr_core_filter_triple_threats})
diff --git a/gnuradio-core/src/lib/filter/Makefile.gen b/gnuradio-core/src/lib/filter/Makefile.gen
new file mode 100644
index 000000000..909899c05
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/Makefile.gen
@@ -0,0 +1,124 @@
+#
+# This file is machine generated. All edits will be overwritten
+#
+GENERATED_H = \
+ gr_fir_ccc.h \
+ gr_fir_ccc_generic.h \
+ gr_fir_ccf.h \
+ gr_fir_ccf_generic.h \
+ gr_fir_fcc.h \
+ gr_fir_fcc_generic.h \
+ gr_fir_fff.h \
+ gr_fir_fff_generic.h \
+ gr_fir_filter_ccc.h \
+ gr_fir_filter_ccf.h \
+ gr_fir_filter_fcc.h \
+ gr_fir_filter_fff.h \
+ gr_fir_filter_fsf.h \
+ gr_fir_filter_scc.h \
+ gr_fir_fsf.h \
+ gr_fir_fsf_generic.h \
+ gr_fir_scc.h \
+ gr_fir_scc_generic.h \
+ gr_fir_sysconfig.h \
+ gr_fir_sysconfig_generic.h \
+ gr_fir_util.h \
+ gr_freq_xlating_fir_filter_ccc.h \
+ gr_freq_xlating_fir_filter_ccf.h \
+ gr_freq_xlating_fir_filter_fcc.h \
+ gr_freq_xlating_fir_filter_fcf.h \
+ gr_freq_xlating_fir_filter_scc.h \
+ gr_freq_xlating_fir_filter_scf.h \
+ gr_interp_fir_filter_ccc.h \
+ gr_interp_fir_filter_ccf.h \
+ gr_interp_fir_filter_fcc.h \
+ gr_interp_fir_filter_fff.h \
+ gr_interp_fir_filter_fsf.h \
+ gr_interp_fir_filter_scc.h \
+ gr_rational_resampler_base_ccc.h \
+ gr_rational_resampler_base_ccf.h \
+ gr_rational_resampler_base_fcc.h \
+ gr_rational_resampler_base_fff.h \
+ gr_rational_resampler_base_fsf.h \
+ gr_rational_resampler_base_scc.h \
+ gri_fir_filter_with_buffer_ccc.h \
+ gri_fir_filter_with_buffer_ccf.h \
+ gri_fir_filter_with_buffer_fcc.h \
+ gri_fir_filter_with_buffer_fff.h \
+ gri_fir_filter_with_buffer_fsf.h \
+ gri_fir_filter_with_buffer_scc.h
+
+
+GENERATED_I = \
+ gr_fir_filter_ccc.i \
+ gr_fir_filter_ccf.i \
+ gr_fir_filter_fcc.i \
+ gr_fir_filter_fff.i \
+ gr_fir_filter_fsf.i \
+ gr_fir_filter_scc.i \
+ gr_freq_xlating_fir_filter_ccc.i \
+ gr_freq_xlating_fir_filter_ccf.i \
+ gr_freq_xlating_fir_filter_fcc.i \
+ gr_freq_xlating_fir_filter_fcf.i \
+ gr_freq_xlating_fir_filter_scc.i \
+ gr_freq_xlating_fir_filter_scf.i \
+ gr_interp_fir_filter_ccc.i \
+ gr_interp_fir_filter_ccf.i \
+ gr_interp_fir_filter_fcc.i \
+ gr_interp_fir_filter_fff.i \
+ gr_interp_fir_filter_fsf.i \
+ gr_interp_fir_filter_scc.i \
+ gr_rational_resampler_base_ccc.i \
+ gr_rational_resampler_base_ccf.i \
+ gr_rational_resampler_base_fcc.i \
+ gr_rational_resampler_base_fff.i \
+ gr_rational_resampler_base_fsf.i \
+ gr_rational_resampler_base_scc.i
+
+GENERATED_CC = \
+ gr_fir_ccc.cc \
+ gr_fir_ccc_generic.cc \
+ gr_fir_ccf.cc \
+ gr_fir_ccf_generic.cc \
+ gr_fir_fcc.cc \
+ gr_fir_fcc_generic.cc \
+ gr_fir_fff.cc \
+ gr_fir_fff_generic.cc \
+ gr_fir_filter_ccc.cc \
+ gr_fir_filter_ccf.cc \
+ gr_fir_filter_fcc.cc \
+ gr_fir_filter_fff.cc \
+ gr_fir_filter_fsf.cc \
+ gr_fir_filter_scc.cc \
+ gr_fir_fsf.cc \
+ gr_fir_fsf_generic.cc \
+ gr_fir_scc.cc \
+ gr_fir_scc_generic.cc \
+ gr_fir_sysconfig.cc \
+ gr_fir_sysconfig_generic.cc \
+ gr_fir_util.cc \
+ gr_freq_xlating_fir_filter_ccc.cc \
+ gr_freq_xlating_fir_filter_ccf.cc \
+ gr_freq_xlating_fir_filter_fcc.cc \
+ gr_freq_xlating_fir_filter_fcf.cc \
+ gr_freq_xlating_fir_filter_scc.cc \
+ gr_freq_xlating_fir_filter_scf.cc \
+ gr_interp_fir_filter_ccc.cc \
+ gr_interp_fir_filter_ccf.cc \
+ gr_interp_fir_filter_fcc.cc \
+ gr_interp_fir_filter_fff.cc \
+ gr_interp_fir_filter_fsf.cc \
+ gr_interp_fir_filter_scc.cc \
+ gr_rational_resampler_base_ccc.cc \
+ gr_rational_resampler_base_ccf.cc \
+ gr_rational_resampler_base_fcc.cc \
+ gr_rational_resampler_base_fff.cc \
+ gr_rational_resampler_base_fsf.cc \
+ gr_rational_resampler_base_scc.cc \
+ gri_fir_filter_with_buffer_ccc.cc \
+ gri_fir_filter_with_buffer_ccf.cc \
+ gri_fir_filter_with_buffer_fcc.cc \
+ gri_fir_filter_with_buffer_fff.cc \
+ gri_fir_filter_with_buffer_fsf.cc \
+ gri_fir_filter_with_buffer_scc.cc
+
diff --git a/gnuradio-core/src/lib/filter/README b/gnuradio-core/src/lib/filter/README
new file mode 100644
index 000000000..90c1584fc
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/README
@@ -0,0 +1,28 @@
+#
+# 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.
+#
+
+This directory holds filtering code, some of which is machine
+generated. Which variations are generated is controlled by two
+variables. For most everything, the global "signatures"
+in generate_utils.py controls.
+
+For GrFreqXlatingFIRfilter<foo>, the global "fx_signatures" in
+generate_GrFreqXlatingFIRfilterXXX.py controls.
diff --git a/gnuradio-core/src/lib/filter/assembly.h b/gnuradio-core/src/lib/filter/assembly.h
new file mode 100644
index 000000000..32477dfd7
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/assembly.h
@@ -0,0 +1,67 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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 _ASSEMBLY_H_
+#define _ASSEMBLY_H_
+
+#if defined (__APPLE__) && defined (__APPLE_CC__)
+
+// XCode ignores the .scl and .type functions in XCode 2.2.1 and 2.3,
+// but creates an error in XCode 2.4. Just ignore them.
+
+#define GLOB_SYMB(f) _ ## f
+
+#define DEF_FUNC_HEAD(f) /* none */
+
+#define FUNC_TAIL(f) /* none*/
+
+#elif !defined (__ELF__)
+
+/*
+ * Too bad, the following define does not work as expected --SF
+ * #define GLOB_SYMB(f) __USER_LABEL_PREFIX__ ## f
+ */
+#define GLOB_SYMB(f) _ ## f
+
+#define DEF_FUNC_HEAD(f) \
+ .def GLOB_SYMB(f); .scl 2; .type 32; .endef
+
+#define FUNC_TAIL(f) /* none */
+
+
+#else /* !__ELF__ */
+
+
+#define GLOB_SYMB(f) f
+
+#define DEF_FUNC_HEAD(f) \
+ .type GLOB_SYMB(f),@function \
+
+#define FUNC_TAIL(f) \
+ .Lfe1: \
+ .size GLOB_SYMB(f),.Lfe1-GLOB_SYMB(f)
+
+
+#endif /* !__ELF__ */
+
+
+#endif /* _ASSEMBLY_H_ */
diff --git a/gnuradio-core/src/lib/filter/ccomplex_dotprod_3dnow.S b/gnuradio-core/src/lib/filter/ccomplex_dotprod_3dnow.S
new file mode 100644
index 000000000..f66356337
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/ccomplex_dotprod_3dnow.S
@@ -0,0 +1,220 @@
+#
+# Copyright 2002 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.
+#
+
+
+# input and taps are guarenteed to be 16 byte aligned.
+# n_2_ccomplex_blocks is != 0
+#
+#
+# ccomplex_dotprod_generic (const float *input,
+# const float *taps, unsigned n_2_ccomplex_blocks, float *result)
+# {
+# float sum0 = 0;
+# float sum1 = 0;
+# float sum2 = 0;
+# float sum3 = 0;
+#
+# do {
+#
+# sum0 += input[0] * taps[0] - input[1] * taps[1];
+# sum1 += input[0] * taps[1] + input[1] * taps[0];
+# sum2 += input[2] * taps[2] - input[3] * taps[3];
+# sum3 += input[2] * taps[3] + input[3] * taps[2];
+#
+# input += 4;
+# taps += 4;
+#
+# } while (--n_2_ccomplex_blocks != 0);
+#
+#
+# result[0] = sum0 + sum2;
+# result[1] = sum1 + sum3;
+# }
+#
+
+# TODO: prefetch and better scheduling
+
+#include "assembly.h"
+
+ .file "ccomplex_dotprod_3dnow.S"
+// .version "01.01"
+.text
+ .p2align 4
+.globl GLOB_SYMB(ccomplex_dotprod_3dnow)
+ DEF_FUNC_HEAD(ccomplex_dotprod_3dnow)
+GLOB_SYMB(ccomplex_dotprod_3dnow):
+ pushl %ebp
+ movl %esp, %ebp
+ movl 8(%ebp), %eax # input
+ movl 12(%ebp), %edx # taps
+ movl 16(%ebp), %ecx # n_2_ccomplex_blocks
+
+ # zero accumulators
+
+ pxor %mm6, %mm6 # mm6 = 0 0
+
+ movq 0(%eax), %mm0
+
+ pxor %mm7, %mm7 # mm7 = 0 0
+
+ movq 0(%edx), %mm2
+
+ movq 8(%eax), %mm1
+
+ shrl $1, %ecx # ecx = n_2_ccomplex_blocks / 2
+
+ movq 8(%edx), %mm3
+
+ jmp .L1_test
+
+ #
+ # 4 taps / loop
+ # something like ?? cycles / loop
+ #
+
+ .p2align 4
+.Loop1:
+
+# complex prod: C += A * B, w/ temp Z, mmPN=$80000000
+#
+# movq (%eax), %mmA
+# movq (%edx), %mmB
+#
+# # 3DNow! replacement for: pswapd %mmA, %mmZ
+# # TODO: optimize the punpckhdq
+# movq %mmA, %mmZ
+# punpckhdq %mmZ, %mmZ
+# punpckldq %mmA, %mmZ
+#
+# pfmul %mmB, %mmA
+# pfmul %mmZ, %mmB
+#
+# # 3DNow! replacement for: pfpnacc %mmB, %mmA
+# pxor %mmPN, %mmA
+# pfacc %mmB, %mmA
+#
+# pfadd %mmA, %mmC
+
+
+# A=mm0, B=mm2, Z=mm4
+# A'=mm1, B'=mm3, Z'=mm5
+
+ movq %mm0, %mm4
+ movq %mm1, %mm5
+ punpckhdq %mm4, %mm4
+ punpckhdq %mm5, %mm5
+ punpckldq %mm0, %mm4
+ pfmul %mm2, %mm0
+ punpckldq %mm1, %mm5
+ pfmul %mm4, %mm2
+ pfadd %mm0, %mm6
+ movq 16(%edx), %mm0
+ pfmul %mm3, %mm1
+ pfadd %mm2, %mm7
+ movq 16(%eax), %mm2
+ pfadd %mm1, %mm6
+ pfmul %mm5, %mm3
+ movq 24(%edx), %mm1
+
+ movq %mm0, %mm4
+ movq %mm1, %mm5
+
+ pfadd %mm3, %mm7
+ movq 24(%eax), %mm3
+
+# unroll
+
+ punpckhdq %mm4, %mm4
+ punpckhdq %mm5, %mm5
+ punpckldq %mm0, %mm4
+ pfmul %mm2, %mm0
+ punpckldq %mm1, %mm5
+ pfmul %mm4, %mm2
+ pfadd %mm0, %mm6
+ movq 32(%edx), %mm0
+ pfmul %mm3, %mm1
+ pfadd %mm2, %mm7
+ movq 32(%eax), %mm2
+ pfadd %mm1, %mm6
+ pfmul %mm5, %mm3
+ movq 40(%edx), %mm1
+
+ addl $32, %eax
+ addl $32, %edx
+
+ pfadd %mm3, %mm7
+ movq 8(%eax), %mm3
+
+.L1_test:
+ decl %ecx
+ jge .Loop1
+
+ # We've handled the bulk of multiplies up to here.
+ # Let's see if original n_2_ccomplex_blocks was odd.
+ # If so, we've got 2 more taps to do.
+
+ movl 16(%ebp), %ecx # n_2_ccomplex_blocks
+ andl $1, %ecx
+ je .Leven
+
+ # The count was odd, do 2 more taps.
+ # Note that we've already got mm0/mm2 & mm1/mm3 preloaded
+ # from the main loop.
+
+ movq %mm0, %mm4
+ movq %mm1, %mm5
+ punpckhdq %mm4, %mm4
+ punpckhdq %mm5, %mm5
+ punpckldq %mm0, %mm4
+ pfmul %mm2, %mm0
+ punpckldq %mm1, %mm5
+ pfmul %mm4, %mm2
+ pfadd %mm0, %mm6
+ pfmul %mm3, %mm1
+ pfadd %mm2, %mm7
+ pfmul %mm5, %mm3
+ pfadd %mm1, %mm6
+ pfadd %mm3, %mm7
+
+.Leven:
+ # mmNP: negative inversor
+
+ pcmpeqd %mm0, %mm0 # set all bits to 1
+ psllq $63, %mm0 # keep only hsb
+
+ pxor %mm0, %mm6
+ pfacc %mm7, %mm6
+
+ movl 20(%ebp), %eax # result
+ movq %mm6, (%eax)
+
+ femms
+
+ popl %ebp
+ ret
+
+FUNC_TAIL(ccomplex_dotprod_3dnow)
+ .ident "Hand coded x86 3DNow! assembly"
+
+
+#if defined(__linux__) && defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff --git a/gnuradio-core/src/lib/filter/ccomplex_dotprod_3dnow64.S b/gnuradio-core/src/lib/filter/ccomplex_dotprod_3dnow64.S
new file mode 100644
index 000000000..e81d21993
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/ccomplex_dotprod_3dnow64.S
@@ -0,0 +1,217 @@
+#
+# Copyright 2002,2005 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.
+#
+
+
+# input and taps are guarenteed to be 16 byte aligned.
+# n_2_ccomplex_blocks is != 0
+#
+#
+# ccomplex_dotprod_generic (const float *input,
+# const float *taps, unsigned n_2_ccomplex_blocks, float *result)
+# {
+# float sum0 = 0;
+# float sum1 = 0;
+# float sum2 = 0;
+# float sum3 = 0;
+#
+# do {
+#
+# sum0 += input[0] * taps[0] - input[1] * taps[1];
+# sum1 += input[0] * taps[1] + input[1] * taps[0];
+# sum2 += input[2] * taps[2] - input[3] * taps[3];
+# sum3 += input[2] * taps[3] + input[3] * taps[2];
+#
+# input += 4;
+# taps += 4;
+#
+# } while (--n_2_ccomplex_blocks != 0);
+#
+#
+# result[0] = sum0 + sum2;
+# result[1] = sum1 + sum3;
+# }
+#
+
+# TODO: prefetch and better scheduling
+
+#include "assembly.h"
+
+
+ .file "ccomplex_dotprod_3dnow64.S"
+// .version "01.01"
+.text
+ .p2align 4
+.globl GLOB_SYMB(ccomplex_dotprod_3dnow)
+ DEF_FUNC_HEAD(ccomplex_dotprod_3dnow)
+GLOB_SYMB(ccomplex_dotprod_3dnow):
+
+ # intput: rdi, taps: rsi, n_2_ccomplex_blocks: rdx, result: rcx
+
+ mov %rdx, %rax
+
+ # zero accumulators
+
+ pxor %mm6, %mm6 # mm6 = 0 0
+
+ movq 0(%rdi), %mm0
+
+ pxor %mm7, %mm7 # mm7 = 0 0
+
+ movq 0(%rsi), %mm2
+
+ movq 8(%rdi), %mm1
+
+ shr $1, %rax # rax = n_2_ccomplex_blocks / 2
+
+ movq 8(%rsi), %mm3
+
+ jmp .L1_test
+
+ #
+ # 4 taps / loop
+ # something like ?? cycles / loop
+ #
+
+ .p2align 4
+.Loop1:
+
+# complex prod: C += A * B, w/ temp Z, mmPN=$80000000
+#
+# movq (%rdx), %mmA
+# movq (%rsi), %mmB
+#
+# # 3DNow! replacement for: pswapd %mmA, %mmZ
+# # TODO: optimize the punpckhdq
+# movq %mmA, %mmZ
+# punpckhdq %mmZ, %mmZ
+# punpckldq %mmA, %mmZ
+#
+# pfmul %mmB, %mmA
+# pfmul %mmZ, %mmB
+#
+# # 3DNow! replacement for: pfpnacc %mmB, %mmA
+# pxor %mmPN, %mmA
+# pfacc %mmB, %mmA
+#
+# pfadd %mmA, %mmC
+
+
+# A=mm0, B=mm2, Z=mm4
+# A'=mm1, B'=mm3, Z'=mm5
+
+ movq %mm0, %mm4
+ movq %mm1, %mm5
+ punpckhdq %mm4, %mm4
+ punpckhdq %mm5, %mm5
+ punpckldq %mm0, %mm4
+ pfmul %mm2, %mm0
+ punpckldq %mm1, %mm5
+ pfmul %mm4, %mm2
+ pfadd %mm0, %mm6
+ movq 16(%rsi), %mm0
+ pfmul %mm3, %mm1
+ pfadd %mm2, %mm7
+ movq 16(%rdi), %mm2
+ pfadd %mm1, %mm6
+ pfmul %mm5, %mm3
+ movq 24(%rsi), %mm1
+
+ movq %mm0, %mm4
+ movq %mm1, %mm5
+
+ pfadd %mm3, %mm7
+ movq 24(%rdi), %mm3
+
+# unroll
+
+ punpckhdq %mm4, %mm4
+ punpckhdq %mm5, %mm5
+ punpckldq %mm0, %mm4
+ pfmul %mm2, %mm0
+ punpckldq %mm1, %mm5
+ pfmul %mm4, %mm2
+ pfadd %mm0, %mm6
+ movq 32(%rsi), %mm0
+ pfmul %mm3, %mm1
+ pfadd %mm2, %mm7
+ movq 32(%rdi), %mm2
+ pfadd %mm1, %mm6
+ pfmul %mm5, %mm3
+ movq 40(%rsi), %mm1
+
+ add $32, %rdi
+ add $32, %rsi
+
+ pfadd %mm3, %mm7
+ movq 8(%rdi), %mm3
+
+.L1_test:
+ dec %rax
+ jge .Loop1
+
+ # We've handled the bulk of multiplies up to here.
+ # Let's see if original n_2_ccomplex_blocks was odd.
+ # If so, we've got 2 more taps to do.
+
+ and $1, %rdx
+ je .Leven
+
+ # The count was odd, do 2 more taps.
+ # Note that we've already got mm0/mm2 & mm1/mm3 preloaded
+ # from the main loop.
+
+ movq %mm0, %mm4
+ movq %mm1, %mm5
+ punpckhdq %mm4, %mm4
+ punpckhdq %mm5, %mm5
+ punpckldq %mm0, %mm4
+ pfmul %mm2, %mm0
+ punpckldq %mm1, %mm5
+ pfmul %mm4, %mm2
+ pfadd %mm0, %mm6
+ pfmul %mm3, %mm1
+ pfadd %mm2, %mm7
+ pfmul %mm5, %mm3
+ pfadd %mm1, %mm6
+ pfadd %mm3, %mm7
+
+.Leven:
+ # mmNP: negative inversor
+
+ pcmpeqd %mm0, %mm0 # set all bits to 1
+ psllq $63, %mm0 # keep only hsb
+
+ pxor %mm0, %mm6
+ pfacc %mm7, %mm6
+
+ movq %mm6, (%rcx)
+
+ femms
+
+ retq
+
+FUNC_TAIL(ccomplex_dotprod_3dnow)
+ .ident "Hand coded x86_64 3DNow! assembly"
+
+
+#if defined(__linux__) && defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff --git a/gnuradio-core/src/lib/filter/ccomplex_dotprod_3dnowext.S b/gnuradio-core/src/lib/filter/ccomplex_dotprod_3dnowext.S
new file mode 100644
index 000000000..22c390bdd
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/ccomplex_dotprod_3dnowext.S
@@ -0,0 +1,195 @@
+#
+# Copyright 2002 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.
+#
+
+
+# input and taps are guarenteed to be 16 byte aligned.
+# n_2_ccomplex_blocks is != 0
+#
+#
+# ccomplex_dotprod_generic (const float *input,
+# const float *taps, unsigned n_2_ccomplex_blocks, float *result)
+# {
+# float sum0 = 0;
+# float sum1 = 0;
+# float sum2 = 0;
+# float sum3 = 0;
+#
+# do {
+#
+# sum0 += input[0] * taps[0] - input[1] * taps[1];
+# sum1 += input[0] * taps[1] + input[1] * taps[0];
+# sum2 += input[2] * taps[2] - input[3] * taps[3];
+# sum3 += input[2] * taps[3] + input[3] * taps[2];
+#
+# input += 4;
+# taps += 4;
+#
+# } while (--n_2_ccomplex_blocks != 0);
+#
+#
+# result[0] = sum0 + sum2;
+# result[1] = sum1 + sum3;
+# }
+#
+
+# TODO: prefetch and better scheduling
+
+#include "assembly.h"
+
+ .file "ccomplex_dotprod_3dnowext.S"
+// .version "01.01"
+.text
+ .p2align 4
+.globl GLOB_SYMB(ccomplex_dotprod_3dnowext)
+ DEF_FUNC_HEAD(ccomplex_dotprod_3dnowext)
+GLOB_SYMB(ccomplex_dotprod_3dnowext):
+ pushl %ebp
+ movl %esp, %ebp
+ movl 8(%ebp), %eax # input
+ movl 12(%ebp), %edx # taps
+ movl 16(%ebp), %ecx # n_2_ccomplex_blocks
+
+ # zero accumulators
+
+ pxor %mm6, %mm6 # mm6 = 0 0
+ pxor %mm7, %mm7 # mm7 = 0 0
+
+ movq 0(%eax), %mm0
+ movq 0(%edx), %mm2
+
+ shrl $1, %ecx # ecx = n_2_ccomplex_blocks / 2
+
+ movq 8(%eax), %mm1
+ movq 8(%edx), %mm3
+
+
+ jmp .L1_test
+
+ #
+ # 4 taps / loop
+ # something like ?? cycles / loop
+ #
+
+ .p2align 4
+.Loop1:
+
+# complex prod: C += A * B, w/ temp Z
+#
+# movq 0(%eax), %mmA
+# movq 0(%edx), %mmB
+# pswapd %mmA, %mmZ
+# pfmul %mmB, %mmA
+# pfmul %mmZ, %mmB
+# pfpnacc %mmB, %mmA
+# pfadd %mmA, %mmC
+
+
+# A=mm0, B=mm2, Z=mm4
+# A'=mm1, B'=mm3, Z'=mm5
+
+ pswapd %mm0, %mm4
+ pfmul %mm2, %mm0
+ pswapd %mm1, %mm5
+ pfmul %mm4, %mm2
+ pfmul %mm3, %mm1
+ pfpnacc %mm2, %mm0
+ pfmul %mm5, %mm3
+ movq 16(%edx), %mm2
+ pfpnacc %mm3, %mm1
+ movq 24(%edx), %mm3
+
+ pfadd %mm0, %mm6
+ movq 16(%eax), %mm0
+ pfadd %mm1, %mm7
+ movq 24(%eax), %mm1
+
+# unroll
+
+ pswapd %mm0, %mm4
+ pfmul %mm2, %mm0
+ pswapd %mm1, %mm5
+ pfmul %mm4, %mm2
+ pfmul %mm3, %mm1
+ pfpnacc %mm2, %mm0
+ pfmul %mm5, %mm3
+ movq 32(%edx), %mm2
+ pfpnacc %mm3, %mm1
+ movq 40(%edx), %mm3
+
+ pfadd %mm0, %mm6
+ movq 32(%eax), %mm0
+ pfadd %mm1, %mm7
+ movq 40(%eax), %mm1
+
+ addl $32, %edx
+ addl $32, %eax
+
+.L1_test:
+ decl %ecx
+ jge .Loop1
+
+ # We've handled the bulk of multiplies up to here.
+ # Let's see if original n_2_ccomplex_blocks was odd.
+ # If so, we've got 2 more taps to do.
+
+ movl 16(%ebp), %ecx # n_2_ccomplex_blocks
+ andl $1, %ecx
+ je .Leven
+
+ # The count was odd, do 2 more taps.
+ # Note that we've already got mm0/mm2 & mm1/mm3 preloaded
+ # from the main loop.
+
+# A=mm0, B=mm2, Z=mm4
+# A'=mm1, B'=mm3, Z'=mm5
+
+ pswapd %mm0, %mm4
+ pfmul %mm2, %mm0
+ pswapd %mm1, %mm5
+ pfmul %mm4, %mm2
+ pfmul %mm3, %mm1
+ pfpnacc %mm2, %mm0
+ pfmul %mm5, %mm3
+ pfpnacc %mm3, %mm1
+
+ pfadd %mm0, %mm6
+ pfadd %mm1, %mm7
+
+.Leven:
+ # at this point mm6 and mm7 contain partial sums
+
+ pfadd %mm7, %mm6
+
+ movl 20(%ebp), %eax # result
+ movq %mm6, (%eax)
+
+ femms
+
+ popl %ebp
+ ret
+
+FUNC_TAIL(ccomplex_dotprod_3dnowext)
+ .ident "Hand coded x86 3DNow!Ext assembly"
+
+
+#if defined(__linux__) && defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff --git a/gnuradio-core/src/lib/filter/ccomplex_dotprod_3dnowext64.S b/gnuradio-core/src/lib/filter/ccomplex_dotprod_3dnowext64.S
new file mode 100644
index 000000000..75608914b
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/ccomplex_dotprod_3dnowext64.S
@@ -0,0 +1,192 @@
+#
+# Copyright 2002,2005 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.
+#
+
+
+# input and taps are guarenteed to be 16 byte aligned.
+# n_2_ccomplex_blocks is != 0
+#
+#
+# ccomplex_dotprod_generic (const float *input,
+# const float *taps, unsigned n_2_ccomplex_blocks, float *result)
+# {
+# float sum0 = 0;
+# float sum1 = 0;
+# float sum2 = 0;
+# float sum3 = 0;
+#
+# do {
+#
+# sum0 += input[0] * taps[0] - input[1] * taps[1];
+# sum1 += input[0] * taps[1] + input[1] * taps[0];
+# sum2 += input[2] * taps[2] - input[3] * taps[3];
+# sum3 += input[2] * taps[3] + input[3] * taps[2];
+#
+# input += 4;
+# taps += 4;
+#
+# } while (--n_2_ccomplex_blocks != 0);
+#
+#
+# result[0] = sum0 + sum2;
+# result[1] = sum1 + sum3;
+# }
+#
+
+# TODO: prefetch and better scheduling
+
+#include "assembly.h"
+
+ .file "ccomplex_dotprod_3dnowext64.S"
+// .version "01.01"
+.text
+ .p2align 4
+.globl GLOB_SYMB(ccomplex_dotprod_3dnowext)
+ DEF_FUNC_HEAD(ccomplex_dotprod_3dnowext)
+GLOB_SYMB(ccomplex_dotprod_3dnowext):
+
+ # intput: rdi, taps: rsi, n_2_ccomplex_blocks: rdx, result: rcx
+
+ mov %rdx, %rax
+
+
+ # zero accumulators
+
+ pxor %mm6, %mm6 # mm6 = 0 0
+ pxor %mm7, %mm7 # mm7 = 0 0
+
+ movq 0(%rdi), %mm0
+ movq 0(%rsi), %mm2
+
+ shr $1, %rax # rax = n_2_ccomplex_blocks / 2
+
+ movq 8(%rdi), %mm1
+ movq 8(%rsi), %mm3
+
+
+ jmp .L1_test
+
+ #
+ # 4 taps / loop
+ # something like ?? cycles / loop
+ #
+
+ .p2align 4
+.Loop1:
+
+# complex prod: C += A * B, w/ temp Z
+#
+# movq 0(%rdi), %mmA
+# movq 0(%rsi), %mmB
+# pswapd %mmA, %mmZ
+# pfmul %mmB, %mmA
+# pfmul %mmZ, %mmB
+# pfpnacc %mmB, %mmA
+# pfadd %mmA, %mmC
+
+
+# A=mm0, B=mm2, Z=mm4
+# A'=mm1, B'=mm3, Z'=mm5
+
+ pswapd %mm0, %mm4
+ pfmul %mm2, %mm0
+ pswapd %mm1, %mm5
+ pfmul %mm4, %mm2
+ pfmul %mm3, %mm1
+ pfpnacc %mm2, %mm0
+ pfmul %mm5, %mm3
+ movq 16(%rsi), %mm2
+ pfpnacc %mm3, %mm1
+ movq 24(%rsi), %mm3
+
+ pfadd %mm0, %mm6
+ movq 16(%rdi), %mm0
+ pfadd %mm1, %mm7
+ movq 24(%rdi), %mm1
+
+# unroll
+
+ pswapd %mm0, %mm4
+ pfmul %mm2, %mm0
+ pswapd %mm1, %mm5
+ pfmul %mm4, %mm2
+ pfmul %mm3, %mm1
+ pfpnacc %mm2, %mm0
+ pfmul %mm5, %mm3
+ movq 32(%rsi), %mm2
+ pfpnacc %mm3, %mm1
+ movq 40(%rsi), %mm3
+
+ pfadd %mm0, %mm6
+ movq 32(%rdi), %mm0
+ pfadd %mm1, %mm7
+ movq 40(%rdi), %mm1
+
+ add $32, %rsi
+ add $32, %rdi
+
+.L1_test:
+ dec %rax
+ jge .Loop1
+
+ # We've handled the bulk of multiplies up to here.
+ # Let's see if original n_2_ccomplex_blocks was odd.
+ # If so, we've got 2 more taps to do.
+
+ and $1, %rdx
+ je .Leven
+
+ # The count was odd, do 2 more taps.
+ # Note that we've already got mm0/mm2 & mm1/mm3 preloaded
+ # from the main loop.
+
+# A=mm0, B=mm2, Z=mm4
+# A'=mm1, B'=mm3, Z'=mm5
+
+ pswapd %mm0, %mm4
+ pfmul %mm2, %mm0
+ pswapd %mm1, %mm5
+ pfmul %mm4, %mm2
+ pfmul %mm3, %mm1
+ pfpnacc %mm2, %mm0
+ pfmul %mm5, %mm3
+ pfpnacc %mm3, %mm1
+
+ pfadd %mm0, %mm6
+ pfadd %mm1, %mm7
+
+.Leven:
+ # at this point mm6 and mm7 contain partial sums
+
+ pfadd %mm7, %mm6
+
+ movq %mm6, (%rcx) # result
+
+ femms
+
+ retq
+
+FUNC_TAIL(ccomplex_dotprod_3dnowext)
+ .ident "Hand coded x86_64 3DNow!Ext assembly"
+
+
+#if defined(__linux__) && defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff --git a/gnuradio-core/src/lib/filter/ccomplex_dotprod_generic.cc b/gnuradio-core/src/lib/filter/ccomplex_dotprod_generic.cc
new file mode 100644
index 000000000..a6f392211
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/ccomplex_dotprod_generic.cc
@@ -0,0 +1,58 @@
+/* -*- c -*- */
+/*
+ * Copyright 2002 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 <gr_complex.h>
+#include "ccomplex_dotprod_generic.h"
+
+#include <iostream>
+
+void
+ccomplex_dotprod_generic (const float *input,
+ const float *taps, unsigned n_2_ccomplex_blocks,
+ float *result)
+{
+ gr_complex sum0(0,0);
+ gr_complex sum1(0,0);
+
+ std::cerr << "Blah!!!\n";
+ do {
+ const gr_complex tap0(taps[0], taps[1]);
+ const gr_complex tap1(taps[2], taps[3]);
+ const gr_complex input0(input[0], input[1]);
+ const gr_complex input1(input[2], input[3]);
+
+ sum0 += input0 * tap0;
+ sum1 += input1 * tap1;
+
+ input += 8;
+ taps += 8;
+
+ } while (--n_2_ccomplex_blocks != 0);
+
+
+ sum0 += sum1;
+ result[0] = sum0.real();
+ result[1] = sum0.imag();
+}
diff --git a/gnuradio-core/src/lib/filter/ccomplex_dotprod_generic.h b/gnuradio-core/src/lib/filter/ccomplex_dotprod_generic.h
new file mode 100644
index 000000000..c7d761c07
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/ccomplex_dotprod_generic.h
@@ -0,0 +1,34 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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 _CCOMPLEX_DOTPROD_GENERIC_H_
+#define _CCOMPLEX_DOTPROD_GENERIC_H_
+
+#include <gr_core_api.h>
+
+GR_CORE_API void
+ccomplex_dotprod_generic (const float *input,
+ const float *taps, unsigned n_2_ccomplex_blocks,
+ float *result);
+
+
+#endif /* _CCOMPLEX_DOTPROD_GENERIC_H_ */
diff --git a/gnuradio-core/src/lib/filter/ccomplex_dotprod_sse.S b/gnuradio-core/src/lib/filter/ccomplex_dotprod_sse.S
new file mode 100644
index 000000000..3d16c352e
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/ccomplex_dotprod_sse.S
@@ -0,0 +1,198 @@
+#
+# Copyright 2002 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.
+#
+
+
+# input and taps are guarenteed to be 16 byte aligned.
+# n_2_ccomplex_blocks is != 0
+#
+#
+# ccomplex_dotprod_generic (const float *input,
+# const float *taps, unsigned n_2_ccomplex_blocks, float *result)
+# {
+# float sum0 = 0;
+# float sum1 = 0;
+# float sum2 = 0;
+# float sum3 = 0;
+#
+# do {
+#
+# sum0 += input[0] * taps[0] - input[1] * taps[1];
+# sum1 += input[0] * taps[1] + input[1] * taps[0];
+# sum2 += input[2] * taps[2] - input[3] * taps[3];
+# sum3 += input[2] * taps[3] + input[3] * taps[2];
+#
+# input += 4;
+# taps += 4;
+#
+# } while (--n_2_ccomplex_blocks != 0);
+#
+#
+# result[0] = sum0 + sum2;
+# result[1] = sum1 + sum3;
+# }
+#
+
+# TODO: prefetch and better scheduling
+
+#include "assembly.h"
+
+ .file "ccomplex_dotprod_sse.S"
+// .version "01.01"
+.text
+ .p2align 4
+.globl GLOB_SYMB(ccomplex_dotprod_sse)
+ DEF_FUNC_HEAD(ccomplex_dotprod_sse)
+GLOB_SYMB(ccomplex_dotprod_sse):
+ pushl %ebp
+ movl %esp, %ebp
+ movl 8(%ebp), %eax # input
+ movl 12(%ebp), %edx # taps
+ movl 16(%ebp), %ecx # n_2_ccomplex_blocks
+
+ xorps %xmm6, %xmm6 # zero accumulators
+
+ movaps 0(%eax), %xmm0
+
+ xorps %xmm7, %xmm7 # zero accumulators
+
+ movaps 0(%edx), %xmm2
+
+ shrl $1, %ecx # ecx = n_2_ccomplex_blocks / 2
+
+ jmp .L1_test
+
+ #
+ # 4 taps / loop
+ # something like ?? cycles / loop
+ #
+
+ .p2align 4
+.Loop1:
+
+# complex prod: C += A * B, w/ temp Z & Y (or B), xmmPN=$0x8000000080000000
+#
+# movaps (%eax), %xmmA
+# movaps (%edx), %xmmB
+#
+# movaps %xmmA, %xmmZ
+# shufps $0xb1, %xmmZ, %xmmZ # swap internals
+#
+# mulps %xmmB, %xmmA
+# mulps %xmmZ, %xmmB
+#
+# # SSE replacement for: pfpnacc %xmmB, %xmmA
+# xorps %xmmPN, %xmmA
+# movaps %xmmA, %xmmZ
+# unpcklps %xmmB, %xmmA
+# unpckhps %xmmB, %xmmZ
+# movaps %xmmZ, %xmmY
+# shufps $0x44, %xmmA, %xmmZ # b01000100
+# shufps $0xee, %xmmY, %xmmA # b11101110
+# addps %xmmZ, %xmmA
+#
+# addps %xmmA, %xmmC
+
+# A=xmm0, B=xmm2, Z=xmm4
+# A'=xmm1, B'=xmm3, Z'=xmm5
+
+ movaps 16(%eax), %xmm1
+
+ movaps %xmm0, %xmm4
+ mulps %xmm2, %xmm0
+
+ shufps $0xb1, %xmm4, %xmm4 # swap internals
+ movaps 16(%edx), %xmm3
+ movaps %xmm1, %xmm5
+ addps %xmm0, %xmm6
+ mulps %xmm3, %xmm1
+ shufps $0xb1, %xmm5, %xmm5 # swap internals
+ addps %xmm1, %xmm6
+ mulps %xmm4, %xmm2
+ movaps 32(%eax), %xmm0
+ addps %xmm2, %xmm7
+ mulps %xmm5, %xmm3
+
+ addl $32, %eax
+
+ movaps 32(%edx), %xmm2
+ addps %xmm3, %xmm7
+
+ addl $32, %edx
+
+
+
+.L1_test:
+ decl %ecx
+ jge .Loop1
+
+ # We've handled the bulk of multiplies up to here.
+ # Let's sse if original n_2_ccomplex_blocks was odd.
+ # If so, we've got 2 more taps to do.
+
+ movl 16(%ebp), %ecx # n_2_ccomplex_blocks
+ andl $1, %ecx
+ je .Leven
+
+ # The count was odd, do 2 more taps.
+ # Note that we've already got mm0/mm2 preloaded
+ # from the main loop.
+
+ movaps %xmm0, %xmm4
+ mulps %xmm2, %xmm0
+ shufps $0xb1, %xmm4, %xmm4 # swap internals
+ addps %xmm0, %xmm6
+ mulps %xmm4, %xmm2
+ addps %xmm2, %xmm7
+
+
+.Leven:
+ # neg inversor
+ xorps %xmm1, %xmm1
+ movl $0x80000000, 16(%ebp)
+ movss 16(%ebp), %xmm1
+ shufps $0x11, %xmm1, %xmm1 # b00010001 # 0 -0 0 -0
+
+ # pfpnacc
+ xorps %xmm1, %xmm6
+
+ movaps %xmm6, %xmm2
+ unpcklps %xmm7, %xmm6
+ unpckhps %xmm7, %xmm2
+ movaps %xmm2, %xmm3
+ shufps $0x44, %xmm6, %xmm2 # b01000100
+ shufps $0xee, %xmm3, %xmm6 # b11101110
+ addps %xmm2, %xmm6
+
+ # xmm6 = r1 i2 r3 i4
+ movl 20(%ebp), %eax # @result
+ movhlps %xmm6, %xmm4 # xmm4 = r3 i4 ?? ??
+ addps %xmm4, %xmm6 # xmm6 = r1+r3 i2+i4 ?? ??
+ movlps %xmm6, (%eax) # store low 2x32 bits (complex) to memory
+
+ popl %ebp
+ ret
+
+FUNC_TAIL(ccomplex_dotprod_sse)
+ .ident "Hand coded x86 SSE assembly"
+
+#if defined(__linux__) && defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff --git a/gnuradio-core/src/lib/filter/ccomplex_dotprod_sse64.S b/gnuradio-core/src/lib/filter/ccomplex_dotprod_sse64.S
new file mode 100644
index 000000000..95ac3dac3
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/ccomplex_dotprod_sse64.S
@@ -0,0 +1,195 @@
+#
+# Copyright 2002,2005 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.
+#
+
+
+# input and taps are guarenteed to be 16 byte aligned.
+# n_2_ccomplex_blocks is != 0
+#
+#
+# ccomplex_dotprod_generic (const float *input,
+# const float *taps, unsigned n_2_ccomplex_blocks, float *result)
+# {
+# float sum0 = 0;
+# float sum1 = 0;
+# float sum2 = 0;
+# float sum3 = 0;
+#
+# do {
+#
+# sum0 += input[0] * taps[0] - input[1] * taps[1];
+# sum1 += input[0] * taps[1] + input[1] * taps[0];
+# sum2 += input[2] * taps[2] - input[3] * taps[3];
+# sum3 += input[2] * taps[3] + input[3] * taps[2];
+#
+# input += 4;
+# taps += 4;
+#
+# } while (--n_2_ccomplex_blocks != 0);
+#
+#
+# result[0] = sum0 + sum2;
+# result[1] = sum1 + sum3;
+# }
+#
+
+# TODO: prefetch and better scheduling
+
+#include "assembly.h"
+
+
+ .file "ccomplex_dotprod_sse64.S"
+// .version "01.01"
+.text
+ .p2align 4
+.globl GLOB_SYMB(ccomplex_dotprod_sse)
+ DEF_FUNC_HEAD(ccomplex_dotprod_sse)
+GLOB_SYMB(ccomplex_dotprod_sse):
+
+ # intput: rdi, taps: rsi, n_2_ccomplex_blocks: rdx, result: rcx
+
+ mov %rdx, %rax
+
+ xorps %xmm6, %xmm6 # zero accumulators
+
+ movaps 0(%rdi), %xmm0
+
+ xorps %xmm7, %xmm7 # zero accumulators
+
+ movaps 0(%rsi), %xmm2
+
+ shr $1, %rax # rax = n_2_ccomplex_blocks / 2
+
+ jmp .L1_test
+
+ #
+ # 4 taps / loop
+ # something like ?? cycles / loop
+ #
+
+ .p2align 4
+.Loop1:
+
+# complex prod: C += A * B, w/ temp Z & Y (or B), xmmPN=$0x8000000080000000
+#
+# movaps (%rdi), %xmmA
+# movaps (%rsi), %xmmB
+#
+# movaps %xmmA, %xmmZ
+# shufps $0xb1, %xmmZ, %xmmZ # swap internals
+#
+# mulps %xmmB, %xmmA
+# mulps %xmmZ, %xmmB
+#
+# # SSE replacement for: pfpnacc %xmmB, %xmmA
+# xorps %xmmPN, %xmmA
+# movaps %xmmA, %xmmZ
+# unpcklps %xmmB, %xmmA
+# unpckhps %xmmB, %xmmZ
+# movaps %xmmZ, %xmmY
+# shufps $0x44, %xmmA, %xmmZ # b01000100
+# shufps $0xee, %xmmY, %xmmA # b11101110
+# addps %xmmZ, %xmmA
+#
+# addps %xmmA, %xmmC
+
+# A=xmm0, B=xmm2, Z=xmm4
+# A'=xmm1, B'=xmm3, Z'=xmm5
+
+ movaps 16(%rdi), %xmm1
+
+ movaps %xmm0, %xmm4
+ mulps %xmm2, %xmm0
+
+ shufps $0xb1, %xmm4, %xmm4 # swap internals
+ movaps 16(%rsi), %xmm3
+ movaps %xmm1, %xmm5
+ addps %xmm0, %xmm6
+ mulps %xmm3, %xmm1
+ shufps $0xb1, %xmm5, %xmm5 # swap internals
+ addps %xmm1, %xmm6
+ mulps %xmm4, %xmm2
+ movaps 32(%rdi), %xmm0
+ addps %xmm2, %xmm7
+ mulps %xmm5, %xmm3
+
+ add $32, %rdi
+
+ movaps 32(%rsi), %xmm2
+ addps %xmm3, %xmm7
+
+ add $32, %rsi
+
+
+
+.L1_test:
+ dec %rax
+ jge .Loop1
+
+ # We've handled the bulk of multiplies up to here.
+ # Let's sse if original n_2_ccomplex_blocks was odd.
+ # If so, we've got 2 more taps to do.
+
+ and $1, %rdx
+ je .Leven
+
+ # The count was odd, do 2 more taps.
+ # Note that we've already got mm0/mm2 preloaded
+ # from the main loop.
+
+ movaps %xmm0, %xmm4
+ mulps %xmm2, %xmm0
+ shufps $0xb1, %xmm4, %xmm4 # swap internals
+ addps %xmm0, %xmm6
+ mulps %xmm4, %xmm2
+ addps %xmm2, %xmm7
+
+
+.Leven:
+ # neg inversor
+ xorps %xmm1, %xmm1
+ movl $0x80000000, -8(%rsp)
+ movss -8(%rsp), %xmm1
+ shufps $0x11, %xmm1, %xmm1 # b00010001 # 0 -0 0 -0
+
+ # pfpnacc
+ xorps %xmm1, %xmm6
+
+ movaps %xmm6, %xmm2
+ unpcklps %xmm7, %xmm6
+ unpckhps %xmm7, %xmm2
+ movaps %xmm2, %xmm3
+ shufps $0x44, %xmm6, %xmm2 # b01000100
+ shufps $0xee, %xmm3, %xmm6 # b11101110
+ addps %xmm2, %xmm6
+
+ # xmm6 = r1 i2 r3 i4
+ movhlps %xmm6, %xmm4 # xmm4 = r3 i4 ?? ??
+ addps %xmm4, %xmm6 # xmm6 = r1+r3 i2+i4 ?? ??
+ movlps %xmm6, (%rcx) # store low 2x32 bits (complex) to memory
+
+ retq
+
+FUNC_TAIL(ccomplex_dotprod_sse)
+ .ident "Hand coded x86_64 SSE assembly"
+
+#if defined(__linux__) && defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff --git a/gnuradio-core/src/lib/filter/ccomplex_dotprod_x86.h b/gnuradio-core/src/lib/filter/ccomplex_dotprod_x86.h
new file mode 100644
index 000000000..ebb63c258
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/ccomplex_dotprod_x86.h
@@ -0,0 +1,46 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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 _CCOMPLEX_DOTPROD_X86_H_
+#define _CCOMPLEX_DOTPROD_X86_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void
+ccomplex_dotprod_3dnow (const float *input,
+ const float *taps, unsigned n_2_ccomplex_blocks, float *result);
+
+void
+ccomplex_dotprod_3dnowext (const float *input,
+ const float *taps, unsigned n_2_ccomplex_blocks, float *result);
+
+void
+ccomplex_dotprod_sse (const float *input,
+ const float *taps, unsigned n_2_ccomplex_blocks, float *result);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _CCOMPLEX_DOTPROD_X86_H_ */
diff --git a/gnuradio-core/src/lib/filter/complex_dotprod_3dnow.S b/gnuradio-core/src/lib/filter/complex_dotprod_3dnow.S
new file mode 100644
index 000000000..be49bb863
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/complex_dotprod_3dnow.S
@@ -0,0 +1,192 @@
+#
+# Copyright 2002 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.
+#
+
+
+# input and taps are guarenteed to be 16 byte aligned.
+# n_2_complex_blocks is != 0
+#
+#
+# complex_dotprod_generic (const short *input,
+# const float *taps, unsigned n_2_complex_blocks, float *result)
+# {
+# float sum0 = 0;
+# float sum1 = 0;
+# float sum2 = 0;
+# float sum3 = 0;
+#
+# do {
+#
+# sum0 += input[0] * taps[0];
+# sum1 += input[0] * taps[1];
+# sum2 += input[1] * taps[2];
+# sum3 += input[1] * taps[3];
+#
+# input += 2;
+# taps += 4;
+#
+# } while (--n_2_complex_blocks != 0);
+#
+#
+# result[0] = sum0 + sum2;
+# result[1] = sum1 + sum3;
+# }
+#
+
+#include "assembly.h"
+
+ .file "complex_dotprod_3dnow.S"
+// .version "01.01"
+.text
+ .p2align 4
+.globl GLOB_SYMB(complex_dotprod_3dnow)
+ DEF_FUNC_HEAD(complex_dotprod_3dnow)
+GLOB_SYMB(complex_dotprod_3dnow):
+ pushl %ebp
+ movl %esp, %ebp
+ movl 8(%ebp), %eax # input
+ movl 12(%ebp), %edx # taps
+ movl 16(%ebp), %ecx
+
+ # zero accumulators
+
+ pxor %mm4, %mm4 # mm4 = 0 0
+ pxor %mm5, %mm5 # mm5 = 0 0
+ pxor %mm6, %mm6 # mm6 = 0 0
+ pxor %mm7, %mm7 # mm7 = 0 0
+
+
+ shrl $1, %ecx # ecx = n_2_complex_blocks / 2
+
+ # pshufw & pi2fw
+ pxor %mm0, %mm0
+ punpcklwd 0(%eax), %mm0
+ psrad $16, %mm0
+ punpckldq %mm0, %mm0
+ pi2fd %mm0, %mm0
+
+ pxor %mm1, %mm1
+ punpcklwd 0(%eax), %mm1
+ psrad $16, %mm1
+ punpckhdq %mm1, %mm1
+ pi2fd %mm1, %mm1
+
+ pxor %mm2, %mm2
+ pxor %mm3, %mm3
+
+
+ jmp .L1_test
+
+ #
+ # 4 taps / loop
+ # something like ?? cycles / loop
+ #
+
+ .p2align 4
+.Loop1:
+ pfmul 0(%edx), %mm0
+ pfadd %mm2, %mm6
+
+ pxor %mm2, %mm2
+ punpcklwd 4(%eax), %mm2
+ psrad $16, %mm2
+ punpckldq %mm2, %mm2
+
+ pfmul 8(%edx), %mm1
+ pfadd %mm3, %mm7
+ pi2fd %mm2, %mm2
+
+ pxor %mm3, %mm3
+ punpcklwd 4(%eax), %mm3
+ psrad $16, %mm3
+ punpckhdq %mm3, %mm3
+
+ pfmul 16(%edx), %mm2
+ pfadd %mm0, %mm4
+ pi2fd %mm3, %mm3
+
+ pxor %mm0, %mm0
+ punpcklwd 8(%eax), %mm0
+ psrad $16, %mm0
+ punpckldq %mm0, %mm0
+
+ pfmul 24(%edx), %mm3
+ pfadd %mm1, %mm5
+
+ pxor %mm1, %mm1
+ punpcklwd 8(%eax), %mm1
+ psrad $16, %mm1
+ punpckhdq %mm1, %mm1
+
+ pi2fd %mm0, %mm0
+ pi2fd %mm1, %mm1
+
+#TODO: add prefetch
+
+ addl $32, %edx
+ addl $8, %eax
+
+.L1_test:
+ decl %ecx
+ jge .Loop1
+
+ # We've handled the bulk of multiplies up to here.
+ # Now accumulate the final two additions and see if original
+ # n_2_complex_blocks was odd. If so, we've got 2 more
+ # taps to do.
+
+ movl 16(%ebp), %ecx
+ pfadd %mm2, %mm6
+ andl $1, %ecx
+ pfadd %mm3, %mm7
+ je .Leven
+
+ # The count was odd, do 2 more taps.
+ # Note that we've already got mm0 and mm1 preloaded
+ # from the main loop.
+
+ pfmul 0(%edx), %mm0
+ pfadd %mm0, %mm4
+ pfmul 8(%edx), %mm1
+ pfadd %mm1, %mm5
+
+.Leven:
+ # at this point mm4, mm5, mm6 and mm7 contain partial sums
+
+ pfadd %mm7, %mm6
+ pfadd %mm5, %mm4
+
+ movl 20(%ebp), %eax # result
+
+ pfadd %mm6, %mm4
+
+ movq %mm4, (%eax)
+ femms
+
+ popl %ebp
+ ret
+
+FUNC_TAIL(complex_dotprod_3dnow)
+ .ident "Hand coded x86 3DNow! assembly"
+
+
+#if defined(__linux__) && defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff --git a/gnuradio-core/src/lib/filter/complex_dotprod_3dnow64.S b/gnuradio-core/src/lib/filter/complex_dotprod_3dnow64.S
new file mode 100644
index 000000000..f1c813078
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/complex_dotprod_3dnow64.S
@@ -0,0 +1,187 @@
+#
+# Copyright 2002,2005 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.
+#
+
+
+# input and taps are guarenteed to be 16 byte aligned.
+# n_2_complex_blocks is != 0
+#
+#
+# complex_dotprod_generic (const short *input,
+# const float *taps, unsigned n_2_complex_blocks, float *result)
+# {
+# float sum0 = 0;
+# float sum1 = 0;
+# float sum2 = 0;
+# float sum3 = 0;
+#
+# do {
+#
+# sum0 += input[0] * taps[0];
+# sum1 += input[0] * taps[1];
+# sum2 += input[1] * taps[2];
+# sum3 += input[1] * taps[3];
+#
+# input += 2;
+# taps += 4;
+#
+# } while (--n_2_complex_blocks != 0);
+#
+#
+# result[0] = sum0 + sum2;
+# result[1] = sum1 + sum3;
+# }
+#
+
+#include "assembly.h"
+
+
+ .file "complex_dotprod_3dnow64.S"
+// .version "01.01"
+.text
+ .p2align 4
+.globl GLOB_SYMB(complex_dotprod_3dnow)
+ DEF_FUNC_HEAD(complex_dotprod_3dnow)
+GLOB_SYMB(complex_dotprod_3dnow):
+
+ # intput: rdi, taps: rsi, n_2_ccomplex_blocks: rdx, result: rcx
+
+ mov %rdx, %rax
+
+ # zero accumulators
+
+ pxor %mm4, %mm4 # mm4 = 0 0
+ pxor %mm5, %mm5 # mm5 = 0 0
+ pxor %mm6, %mm6 # mm6 = 0 0
+ pxor %mm7, %mm7 # mm7 = 0 0
+
+
+ shr $1, %rax # rax = n_2_complex_blocks / 2
+
+ # pshufw & pi2fw
+ pxor %mm0, %mm0
+ punpcklwd 0(%rdi), %mm0
+ psrad $16, %mm0
+ punpckldq %mm0, %mm0
+ pi2fd %mm0, %mm0
+
+ pxor %mm1, %mm1
+ punpcklwd 0(%rdi), %mm1
+ psrad $16, %mm1
+ punpckhdq %mm1, %mm1
+ pi2fd %mm1, %mm1
+
+ pxor %mm2, %mm2
+ pxor %mm3, %mm3
+
+
+ jmp .L1_test
+
+ #
+ # 4 taps / loop
+ # something like ?? cycles / loop
+ #
+
+ .p2align 4
+.Loop1:
+ pfmul 0(%rsi), %mm0
+ pfadd %mm2, %mm6
+
+ pxor %mm2, %mm2
+ punpcklwd 4(%rdi), %mm2
+ psrad $16, %mm2
+ punpckldq %mm2, %mm2
+
+ pfmul 8(%rsi), %mm1
+ pfadd %mm3, %mm7
+ pi2fd %mm2, %mm2
+
+ pxor %mm3, %mm3
+ punpcklwd 4(%rdi), %mm3
+ psrad $16, %mm3
+ punpckhdq %mm3, %mm3
+
+ pfmul 16(%rsi), %mm2
+ pfadd %mm0, %mm4
+ pi2fd %mm3, %mm3
+
+ pxor %mm0, %mm0
+ punpcklwd 8(%rdi), %mm0
+ psrad $16, %mm0
+ punpckldq %mm0, %mm0
+
+ pfmul 24(%rsi), %mm3
+ pfadd %mm1, %mm5
+
+ pxor %mm1, %mm1
+ punpcklwd 8(%rdi), %mm1
+ psrad $16, %mm1
+ punpckhdq %mm1, %mm1
+
+ pi2fd %mm0, %mm0
+ pi2fd %mm1, %mm1
+
+#TODO: add prefetch
+
+ add $32, %rsi
+ add $8, %rdi
+
+.L1_test:
+ dec %rax
+ jge .Loop1
+
+ # We've handled the bulk of multiplies up to here.
+ # Now accumulate the final two additions and see if original
+ # n_2_complex_blocks was odd. If so, we've got 2 more
+ # taps to do.
+
+ pfadd %mm2, %mm6
+ and $1, %rdx
+ pfadd %mm3, %mm7
+ je .Leven
+
+ # The count was odd, do 2 more taps.
+ # Note that we've already got mm0 and mm1 preloaded
+ # from the main loop.
+
+ pfmul 0(%rsi), %mm0
+ pfadd %mm0, %mm4
+ pfmul 8(%rsi), %mm1
+ pfadd %mm1, %mm5
+
+.Leven:
+ # at this point mm4, mm5, mm6 and mm7 contain partial sums
+
+ pfadd %mm7, %mm6
+ pfadd %mm5, %mm4
+ pfadd %mm6, %mm4
+
+ movq %mm4, (%rcx)
+ femms
+
+ retq
+
+FUNC_TAIL(complex_dotprod_3dnow)
+ .ident "Hand coded x86_64 3DNow! assembly"
+
+
+#if defined(__linux__) && defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff --git a/gnuradio-core/src/lib/filter/complex_dotprod_3dnowext.S b/gnuradio-core/src/lib/filter/complex_dotprod_3dnowext.S
new file mode 100644
index 000000000..52f04f10c
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/complex_dotprod_3dnowext.S
@@ -0,0 +1,171 @@
+#
+# Copyright 2002 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.
+#
+
+
+# input and taps are guarenteed to be 16 byte aligned.
+# n_2_complex_blocks is != 0
+#
+#
+# complex_dotprod_generic (const short *input,
+# const float *taps, unsigned n_2_complex_blocks, float *result)
+# {
+# float sum0 = 0;
+# float sum1 = 0;
+# float sum2 = 0;
+# float sum3 = 0;
+#
+# do {
+#
+# sum0 += input[0] * taps[0];
+# sum1 += input[0] * taps[1];
+# sum2 += input[1] * taps[2];
+# sum3 += input[1] * taps[3];
+#
+# input += 2;
+# taps += 4;
+#
+# } while (--n_2_complex_blocks != 0);
+#
+#
+# result[0] = sum0 + sum2;
+# result[1] = sum1 + sum3;
+# }
+#
+
+#include "assembly.h"
+
+ .file "complex_dotprod_3dnowext.S"
+// .version "01.01"
+.text
+ .p2align 4
+.globl GLOB_SYMB(complex_dotprod_3dnowext)
+ DEF_FUNC_HEAD(complex_dotprod_3dnowext)
+GLOB_SYMB(complex_dotprod_3dnowext):
+ pushl %ebp
+ movl %esp, %ebp
+ movl 8(%ebp), %eax # input
+ movl 12(%ebp), %edx # taps
+ movl 16(%ebp), %ecx
+
+ # zero accumulators
+
+ pxor %mm4, %mm4 # mm4 = 0 0
+ pxor %mm5, %mm5 # mm5 = 0 0
+ pxor %mm6, %mm6 # mm6 = 0 0
+ pxor %mm7, %mm7 # mm7 = 0 0
+
+
+ shrl $1, %ecx # ecx = n_2_complex_blocks / 2
+
+ movd 0(%eax), %mm0
+ pshufw $0x55, %mm0, %mm1 # b01010101
+ pshufw $0, %mm0, %mm0
+
+ pxor %mm2, %mm2
+ pxor %mm3, %mm3
+
+ pi2fw %mm1, %mm1
+ pi2fw %mm0, %mm0
+
+ jmp .L1_test
+
+ #
+ # 4 taps / loop
+ # something like ?? cycles / loop
+ #
+
+ .p2align 4
+.Loop1:
+ pfmul 0(%edx), %mm0
+ pfadd %mm2, %mm6
+
+ pshufw $0, 4(%eax), %mm2
+
+ pfmul 8(%edx), %mm1
+ pfadd %mm3, %mm7
+ pi2fw %mm2, %mm2
+
+ pshufw $0x55, 4(%eax), %mm3 # b01010101
+
+ pfmul 16(%edx), %mm2
+ pi2fw %mm3, %mm3
+ pfadd %mm0, %mm4
+
+ pshufw $0, 8(%eax), %mm0
+
+ pfmul 24(%edx), %mm3
+ pfadd %mm1, %mm5
+
+ pshufw $0x55, 8(%eax), %mm1 # b01010101
+ pi2fw %mm0, %mm0
+
+#TODO: add prefetch
+
+ addl $32, %edx
+ addl $8, %eax
+ pi2fw %mm1, %mm1
+
+.L1_test:
+ decl %ecx
+ jge .Loop1
+
+ # We've handled the bulk of multiplies up to here.
+ # Now accumulate the final two additions and see if original
+ # n_2_complex_blocks was odd. If so, we've got 2 more
+ # taps to do.
+
+ movl 16(%ebp), %ecx
+ pfadd %mm2, %mm6
+ andl $1, %ecx
+ pfadd %mm3, %mm7
+ je .Leven
+
+ # The count was odd, do 2 more taps.
+ # Note that we've already got mm0 and mm1 preloaded
+ # from the main loop.
+
+ pfmul 0(%edx), %mm0
+ pfadd %mm0, %mm4
+ pfmul 8(%edx), %mm1
+ pfadd %mm1, %mm5
+
+.Leven:
+ # at this point mm4, mm5, mm6 and mm7 contain partial sums
+
+ pfadd %mm7, %mm6
+ pfadd %mm5, %mm4
+
+ movl 20(%ebp), %eax # result
+ pfadd %mm6, %mm4
+ movq %mm4, (%eax)
+
+ femms
+
+ popl %ebp
+ ret
+
+FUNC_TAIL(complex_dotprod_3dnowext)
+ .ident "Hand coded x86 3DNow!Ext assembly"
+
+
+#if defined(__linux__) && defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff --git a/gnuradio-core/src/lib/filter/complex_dotprod_3dnowext64.S b/gnuradio-core/src/lib/filter/complex_dotprod_3dnowext64.S
new file mode 100644
index 000000000..6d7ad5ad4
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/complex_dotprod_3dnowext64.S
@@ -0,0 +1,168 @@
+#
+# Copyright 2002,2005 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.
+#
+
+
+# input and taps are guarenteed to be 16 byte aligned.
+# n_2_complex_blocks is != 0
+#
+#
+# complex_dotprod_generic (const short *input,
+# const float *taps, unsigned n_2_complex_blocks, float *result)
+# {
+# float sum0 = 0;
+# float sum1 = 0;
+# float sum2 = 0;
+# float sum3 = 0;
+#
+# do {
+#
+# sum0 += input[0] * taps[0];
+# sum1 += input[0] * taps[1];
+# sum2 += input[1] * taps[2];
+# sum3 += input[1] * taps[3];
+#
+# input += 2;
+# taps += 4;
+#
+# } while (--n_2_complex_blocks != 0);
+#
+#
+# result[0] = sum0 + sum2;
+# result[1] = sum1 + sum3;
+# }
+#
+
+#include "assembly.h"
+
+
+ .file "complex_dotprod_3dnowext64.S"
+// .version "01.01"
+.text
+ .p2align 4
+.globl GLOB_SYMB(complex_dotprod_3dnowext)
+ DEF_FUNC_HEAD(complex_dotprod_3dnowext)
+GLOB_SYMB(complex_dotprod_3dnowext):
+
+ # intput: rdi, taps: rsi, n_2_ccomplex_blocks: rdx, result: rcx
+
+ mov %rdx, %rax
+
+ # zero accumulators
+
+ pxor %mm4, %mm4 # mm4 = 0 0
+ pxor %mm5, %mm5 # mm5 = 0 0
+ pxor %mm6, %mm6 # mm6 = 0 0
+ pxor %mm7, %mm7 # mm7 = 0 0
+
+
+ shr $1, %rax # rax = n_2_complex_blocks / 2
+
+ movd 0(%rdi), %mm0
+ pshufw $0x55, %mm0, %mm1 # b01010101
+ pshufw $0, %mm0, %mm0
+
+ pxor %mm2, %mm2
+ pxor %mm3, %mm3
+
+ pi2fw %mm1, %mm1
+ pi2fw %mm0, %mm0
+
+ jmp .L1_test
+
+ #
+ # 4 taps / loop
+ # something like ?? cycles / loop
+ #
+
+ .p2align 4
+.Loop1:
+ pfmul 0(%rsi), %mm0
+ pfadd %mm2, %mm6
+
+ pshufw $0, 4(%rdi), %mm2
+
+ pfmul 8(%rsi), %mm1
+ pfadd %mm3, %mm7
+ pi2fw %mm2, %mm2
+
+ pshufw $0x55, 4(%rdi), %mm3 # b01010101
+
+ pfmul 16(%rsi), %mm2
+ pi2fw %mm3, %mm3
+ pfadd %mm0, %mm4
+
+ pshufw $0, 8(%rdi), %mm0
+
+ pfmul 24(%rsi), %mm3
+ pfadd %mm1, %mm5
+
+ pshufw $0x55, 8(%rdi), %mm1 # b01010101
+ pi2fw %mm0, %mm0
+
+#TODO: add prefetch
+
+ add $32, %rsi
+ add $8, %rdi
+ pi2fw %mm1, %mm1
+
+.L1_test:
+ dec %rax
+ jge .Loop1
+
+ # We've handled the bulk of multiplies up to here.
+ # Now accumulate the final two additions and see if original
+ # n_2_complex_blocks was odd. If so, we've got 2 more
+ # taps to do.
+
+ pfadd %mm2, %mm6
+ and $1, %rdx
+ pfadd %mm3, %mm7
+ je .Leven
+
+ # The count was odd, do 2 more taps.
+ # Note that we've already got mm0 and mm1 preloaded
+ # from the main loop.
+
+ pfmul 0(%rsi), %mm0
+ pfadd %mm0, %mm4
+ pfmul 8(%rsi), %mm1
+ pfadd %mm1, %mm5
+
+.Leven:
+ # at this point mm4, mm5, mm6 and mm7 contain partial sums
+
+ pfadd %mm7, %mm6
+ pfadd %mm5, %mm4
+
+ pfadd %mm6, %mm4
+ movq %mm4, (%rcx)
+
+ femms
+
+ retq
+
+FUNC_TAIL(complex_dotprod_3dnowext)
+ .ident "Hand coded x86_64 3DNow!Ext assembly"
+
+
+#if defined(__linux__) && defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff --git a/gnuradio-core/src/lib/filter/complex_dotprod_generic.cc b/gnuradio-core/src/lib/filter/complex_dotprod_generic.cc
new file mode 100644
index 000000000..229cbe978
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/complex_dotprod_generic.cc
@@ -0,0 +1,54 @@
+/* -*- c -*- */
+/*
+ * Copyright 2002 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 <gr_complex.h>
+#include "complex_dotprod_generic.h"
+
+
+void
+complex_dotprod_generic (const short *input,
+ const float *taps, unsigned n_2_complex_blocks,
+ float *result)
+{
+ gr_complex sum0(0,0);
+ gr_complex sum1(0,0);
+
+ do {
+ const gr_complex tap0(taps[0], taps[1]);
+ const gr_complex tap1(taps[2], taps[3]);
+
+ sum0 += (float)input[0] * tap0;
+ sum1 += (float)input[1] * tap1;
+
+ input += 4;
+ taps += 8;
+
+ } while (--n_2_complex_blocks != 0);
+
+
+ sum0 += sum1;
+ result[0] = sum0.real();
+ result[1] = sum0.imag();
+}
diff --git a/gnuradio-core/src/lib/filter/complex_dotprod_generic.h b/gnuradio-core/src/lib/filter/complex_dotprod_generic.h
new file mode 100644
index 000000000..152f6e459
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/complex_dotprod_generic.h
@@ -0,0 +1,34 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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 _COMPLEX_DOTPROD_GENERIC_H_
+#define _COMPLEX_DOTPROD_GENERIC_H_
+
+#include <gr_core_api.h>
+
+GR_CORE_API void
+complex_dotprod_generic (const short *input,
+ const float *taps, unsigned n_2_complex_blocks,
+ float *result);
+
+
+#endif /* _COMPLEX_DOTPROD_GENERIC_H_ */
diff --git a/gnuradio-core/src/lib/filter/complex_dotprod_sse.S b/gnuradio-core/src/lib/filter/complex_dotprod_sse.S
new file mode 100644
index 000000000..fb998cc45
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/complex_dotprod_sse.S
@@ -0,0 +1,206 @@
+#
+# Copyright 2002 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.
+#
+
+
+# input and taps are guarenteed to be 16 byte aligned.
+# n_2_complex_blocks is != 0
+#
+#
+# complex_dotprod_generic (const short *input,
+# const float *taps, unsigned n_2_complex_blocks, float *result)
+# {
+# float sum0 = 0;
+# float sum1 = 0;
+# float sum2 = 0;
+# float sum3 = 0;
+#
+# do {
+#
+# sum0 += input[0] * taps[0];
+# sum1 += input[0] * taps[1];
+# sum2 += input[1] * taps[2];
+# sum3 += input[1] * taps[3];
+#
+# input += 2;
+# taps += 4;
+#
+# } while (--n_2_complex_blocks != 0);
+#
+#
+# result[0] = sum0 + sum2;
+# result[1] = sum1 + sum3;
+# }
+#
+
+# TODO: prefetch and better scheduling
+
+#include "assembly.h"
+
+
+ .file "complex_dotprod_sse.S"
+// .version "01.01"
+.text
+ .p2align 4
+.globl GLOB_SYMB(complex_dotprod_sse)
+ DEF_FUNC_HEAD(complex_dotprod_sse)
+GLOB_SYMB(complex_dotprod_sse):
+ pushl %ebp
+ movl %esp, %ebp
+ movl 8(%ebp), %eax # input
+ movl 12(%ebp), %edx # taps
+ movl 16(%ebp), %ecx
+
+
+ # xmm0 xmm1 xmm2 xmm3 are used to hold taps and the result of mults
+ # xmm4 xmm5 xmm6 xmm7 are used to hold the accumulated results
+
+ xorps %xmm4, %xmm4 # zero two accumulators
+ xorps %xmm5, %xmm5 # xmm5 holds zero for use below
+
+ # first handle any non-zero remainder of (n_2_complex_blocks % 4)
+
+ andl $0x3, %ecx
+ jmp .L1_test
+
+ .p2align 4
+.Loop1:
+
+ pxor %mm0, %mm0
+ punpcklwd 0(%eax), %mm0
+ psrad $16, %mm0
+ cvtpi2ps %mm0, %xmm0
+ shufps $0x50, %xmm0, %xmm0
+
+ mulps (%edx), %xmm0
+ addl $0x10, %edx
+ addl $4, %eax
+ addps %xmm0, %xmm4
+.L1_test:
+ decl %ecx
+ jge .Loop1
+
+
+ # set up for primary loop which is unrolled 4 times
+
+ movl 16(%ebp), %ecx
+ movaps %xmm5, %xmm6 # zero remaining accumulators
+ movaps %xmm5, %xmm7
+
+ shrl $2, %ecx # n_2_complex_blocks / 4
+ je .Lcleanup # if zero, take short path
+
+ # finish setup and loop priming
+
+ pxor %mm0, %mm0
+ punpcklwd 0(%eax), %mm0
+ psrad $16, %mm0
+ cvtpi2ps %mm0, %xmm0
+ shufps $0x50, %xmm0, %xmm0
+
+ movaps %xmm5, %xmm2
+
+ pxor %mm1, %mm1
+ punpcklwd 4(%eax), %mm1
+ psrad $16, %mm1
+ cvtpi2ps %mm1, %xmm1
+ shufps $0x50, %xmm1, %xmm1
+
+ movaps %xmm5, %xmm3
+
+ # we know ecx is not zero, we checked above,
+ # hence enter loop at top
+
+ .p2align 4
+.Loop2:
+ mulps (%edx), %xmm0
+ addps %xmm2, %xmm6
+
+ pxor %mm2, %mm2
+ punpcklwd 8(%eax), %mm2
+ psrad $16, %mm2
+ cvtpi2ps %mm2, %xmm2
+ shufps $0x50, %xmm2, %xmm2
+
+ mulps 0x10(%edx), %xmm1
+ addps %xmm3, %xmm7
+
+ pxor %mm3, %mm3
+ punpcklwd 12(%eax), %mm3
+ psrad $16, %mm3
+ cvtpi2ps %mm3, %xmm3
+ shufps $0x50, %xmm3, %xmm3
+
+ mulps 0x20(%edx), %xmm2
+ addps %xmm0, %xmm4
+
+ pxor %mm0, %mm0
+ punpcklwd 16(%eax), %mm0
+ psrad $16, %mm0
+ cvtpi2ps %mm0, %xmm0
+ shufps $0x50, %xmm0, %xmm0
+
+ mulps 0x30(%edx), %xmm3
+ addps %xmm1, %xmm5
+
+ pxor %mm1, %mm1
+ punpcklwd 20(%eax), %mm1
+ psrad $16, %mm1
+ cvtpi2ps %mm1, %xmm1
+ shufps $0x50, %xmm1, %xmm1
+
+ addl $0x40, %edx
+ addl $0x10, %eax
+ decl %ecx
+ jne .Loop2
+
+ # OK, now we've done with all the multiplies, but
+ # we still need to handle the unaccumulated
+ # products in xmm2 and xmm3
+
+ addps %xmm2, %xmm6
+ addps %xmm3, %xmm7
+
+ # now we want to add all accumulators into xmm4
+
+ addps %xmm5, %xmm4
+ addps %xmm6, %xmm7
+ addps %xmm7, %xmm4
+
+
+ # At this point, xmm4 contains 2x2 partial sums. We need
+ # to compute a "horizontal complex add" across xmm4.
+
+.Lcleanup: # xmm4 = r1 i2 r3 i4
+ movl 20(%ebp), %eax # @result
+ movhlps %xmm4, %xmm0 # xmm0 = ?? ?? r1 r2
+ addps %xmm4, %xmm0 # xmm0 = ?? ?? r1+r3 i2+i4
+ movlps %xmm0, (%eax) # store low 2x32 bits (complex) to memory
+
+ emms
+ popl %ebp
+ ret
+
+FUNC_TAIL(complex_dotprod_sse)
+ .ident "Hand coded x86 SSE assembly"
+
+#if defined(__linux__) && defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff --git a/gnuradio-core/src/lib/filter/complex_dotprod_sse64.S b/gnuradio-core/src/lib/filter/complex_dotprod_sse64.S
new file mode 100644
index 000000000..67d3519e4
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/complex_dotprod_sse64.S
@@ -0,0 +1,202 @@
+#
+# Copyright 2002,2005 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.
+#
+
+
+# input and taps are guarenteed to be 16 byte aligned.
+# n_2_complex_blocks is != 0
+#
+#
+# complex_dotprod_generic (const short *input,
+# const float *taps, unsigned n_2_complex_blocks, float *result)
+# {
+# float sum0 = 0;
+# float sum1 = 0;
+# float sum2 = 0;
+# float sum3 = 0;
+#
+# do {
+#
+# sum0 += input[0] * taps[0];
+# sum1 += input[0] * taps[1];
+# sum2 += input[1] * taps[2];
+# sum3 += input[1] * taps[3];
+#
+# input += 2;
+# taps += 4;
+#
+# } while (--n_2_complex_blocks != 0);
+#
+#
+# result[0] = sum0 + sum2;
+# result[1] = sum1 + sum3;
+# }
+#
+
+# TODO: prefetch and better scheduling
+
+#include "assembly.h"
+
+
+ .file "complex_dotprod_sse64.S"
+// .version "01.01"
+.text
+ .p2align 4
+.globl GLOB_SYMB(complex_dotprod_sse)
+ DEF_FUNC_HEAD(complex_dotprod_sse)
+GLOB_SYMB(complex_dotprod_sse):
+
+ # intput: rdi, taps: rsi, n_2_ccomplex_blocks: rdx, result: rcx
+
+ mov %rdx, %rax
+
+
+ # xmm0 xmm1 xmm2 xmm3 are used to hold taps and the result of mults
+ # xmm4 xmm5 xmm6 xmm7 are used to hold the accumulated results
+
+ xorps %xmm4, %xmm4 # zero two accumulators
+ xorps %xmm5, %xmm5 # xmm5 holds zero for use below
+
+ # first handle any non-zero remainder of (n_2_complex_blocks % 4)
+
+ and $0x3, %rax
+ jmp .L1_test
+
+ .p2align 4
+.Loop1:
+
+ pxor %mm0, %mm0
+ punpcklwd 0(%rdi), %mm0
+ psrad $16, %mm0
+ cvtpi2ps %mm0, %xmm0
+ shufps $0x50, %xmm0, %xmm0
+
+ mulps (%rsi), %xmm0
+ add $0x10, %rsi
+ add $4, %rdi
+ addps %xmm0, %xmm4
+.L1_test:
+ dec %rax
+ jge .Loop1
+
+
+ # set up for primary loop which is unrolled 4 times
+
+ movaps %xmm5, %xmm6 # zero remaining accumulators
+ shr $2, %rdx # n_2_complex_blocks / 4
+ movaps %xmm5, %xmm7
+
+ je .Lcleanup # if zero, take short path
+
+ # finish setup and loop priming
+
+ pxor %mm0, %mm0
+ punpcklwd 0(%rdi), %mm0
+ psrad $16, %mm0
+ cvtpi2ps %mm0, %xmm0
+ shufps $0x50, %xmm0, %xmm0
+
+ movaps %xmm5, %xmm2
+
+ pxor %mm1, %mm1
+ punpcklwd 4(%rdi), %mm1
+ psrad $16, %mm1
+ cvtpi2ps %mm1, %xmm1
+ shufps $0x50, %xmm1, %xmm1
+
+ movaps %xmm5, %xmm3
+
+ # we know rax is not zero, we checked above,
+ # hence enter loop at top
+
+ .p2align 4
+.Loop2:
+ mulps (%rsi), %xmm0
+ addps %xmm2, %xmm6
+
+ pxor %mm2, %mm2
+ punpcklwd 8(%rdi), %mm2
+ psrad $16, %mm2
+ cvtpi2ps %mm2, %xmm2
+ shufps $0x50, %xmm2, %xmm2
+
+ mulps 0x10(%rsi), %xmm1
+ addps %xmm3, %xmm7
+
+ pxor %mm3, %mm3
+ punpcklwd 12(%rdi), %mm3
+ psrad $16, %mm3
+ cvtpi2ps %mm3, %xmm3
+ shufps $0x50, %xmm3, %xmm3
+
+ mulps 0x20(%rsi), %xmm2
+ addps %xmm0, %xmm4
+
+ pxor %mm0, %mm0
+ punpcklwd 16(%rdi), %mm0
+ psrad $16, %mm0
+ cvtpi2ps %mm0, %xmm0
+ shufps $0x50, %xmm0, %xmm0
+
+ mulps 0x30(%rsi), %xmm3
+ addps %xmm1, %xmm5
+
+ pxor %mm1, %mm1
+ punpcklwd 20(%rdi), %mm1
+ psrad $16, %mm1
+ cvtpi2ps %mm1, %xmm1
+ shufps $0x50, %xmm1, %xmm1
+
+ add $0x40, %rsi
+ add $0x10, %rdi
+ dec %rdx
+ jne .Loop2
+
+ # OK, now we've done with all the multiplies, but
+ # we still need to handle the unaccumulated
+ # products in xmm2 and xmm3
+
+ addps %xmm2, %xmm6
+ addps %xmm3, %xmm7
+
+ # now we want to add all accumulators into xmm4
+
+ addps %xmm5, %xmm4
+ addps %xmm6, %xmm7
+ addps %xmm7, %xmm4
+
+
+ # At this point, xmm4 contains 2x2 partial sums. We need
+ # to compute a "horizontal complex add" across xmm4.
+
+.Lcleanup: # xmm4 = r1 i2 r3 i4
+ movhlps %xmm4, %xmm0 # xmm0 = ?? ?? r1 r2
+ addps %xmm4, %xmm0 # xmm0 = ?? ?? r1+r3 i2+i4
+ movlps %xmm0, (%rcx) # store low 2x32 bits (complex) to memory
+
+ emms
+ retq
+
+FUNC_TAIL(complex_dotprod_sse)
+ .ident "Hand coded x86_64 SSE assembly"
+
+#if defined(__linux__) && defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff --git a/gnuradio-core/src/lib/filter/complex_dotprod_x86.h b/gnuradio-core/src/lib/filter/complex_dotprod_x86.h
new file mode 100644
index 000000000..aad9fb5e9
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/complex_dotprod_x86.h
@@ -0,0 +1,46 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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 _COMPLEX_DOTPROD_X86_H_
+#define _COMPLEX_DOTPROD_X86_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void
+complex_dotprod_3dnow (const short *input,
+ const float *taps, unsigned n_2_complex_blocks, float *result);
+
+void
+complex_dotprod_3dnowext (const short *input,
+ const float *taps, unsigned n_2_complex_blocks, float *result);
+
+void
+complex_dotprod_sse (const short *input,
+ const float *taps, unsigned n_2_complex_blocks, float *result);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _COMPLEX_DOTPROD_X86_H_ */
diff --git a/gnuradio-core/src/lib/filter/dotprod_ccf_armv7_a.c b/gnuradio-core/src/lib/filter/dotprod_ccf_armv7_a.c
new file mode 100644
index 000000000..c125b49b3
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/dotprod_ccf_armv7_a.c
@@ -0,0 +1,90 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,2009,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 this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <dotprod_ccf_armv7_a.h>
+
+/*!
+ * \param x any value
+ * \param pow2 must be a power of 2
+ * \returns \p x rounded down to a multiple of \p pow2.
+ */
+static inline size_t
+gr_p2_round_down(size_t x, size_t pow2)
+{
+ return x & -pow2;
+}
+
+
+#ifndef HAVE_MFPU_NEON
+
+void
+dotprod_ccf_armv7_a(const float *a, const float *b, float *res, size_t n)
+{
+ size_t i;
+ res[0] = 0;
+ res[1] = 0;
+
+ for (i = 0; i < n; i++){
+ res[0] += a[2*i] * b[i];
+ res[1] += a[2*i+1] * b[i];
+ }
+}
+
+#else
+
+/*
+ * preconditions:
+ *
+ * n > 0 and a multiple of 4
+ * a 4-byte aligned
+ * b 16-byte aligned
+ */
+void
+dotprod_ccf_armv7_a(const float *a, const float *b, float *res, size_t n)
+{
+
+ asm volatile(
+ "vmov.f32 q14, #0.0 \n\t"
+ "vmov.f32 q15, #0.0 \n\t"
+ "1: \n\t"
+ "subs %2, %2, #4 \n\t"
+ "vld2.f32 {q0-q1}, [%0]! \n\t"
+ "vld1.f32 {q2}, [%1]! \n\t"
+ "vmla.f32 q14, q0, q2 \n\t"
+ "vmla.f32 q15, q1, q2 \n\t"
+ "bgt 1b \n\t"
+ "vpadd.f32 d0, d28, d29 \n\t"
+ "vpadd.f32 d1, d30, d31 \n\t"
+ "vpadd.f32 d0, d0, d1 \n\t"
+ "vst1.f32 {d0}, [%3] \n\t"
+
+ : "+&r"(a), "+&r"(b), "+&r"(n)
+ : "r"(res)
+ : "memory", "d0", "d1", "d2", "d3", "d4", "d5",
+ "d28", "d29", "d30", "d31" );
+}
+
+
+#endif
diff --git a/gnuradio-core/src/lib/filter/dotprod_ccf_armv7_a.h b/gnuradio-core/src/lib/filter/dotprod_ccf_armv7_a.h
new file mode 100644
index 000000000..e42d6d10b
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/dotprod_ccf_armv7_a.h
@@ -0,0 +1,47 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,2009,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 this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+#ifndef INCLUDED_DOTPROD_CCF_ARMV7_A_H
+#define INCLUDED_DOTPROD_CCF_ARMV7_A_H
+
+#include <stddef.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*!
+ * <pre>
+ *
+ * preconditions:
+ *
+ * n > 0 and a multiple of 4
+ * a 4-byte aligned
+ * b 16-byte aligned
+ *
+ * </pre>
+ */
+void dotprod_ccf_armv7_a(const float *a, const float *b, float *res, size_t n);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* INCLUDED_DOTPROD_CCF_ARMV7_A_H */
diff --git a/gnuradio-core/src/lib/filter/dotprod_fff_altivec.c b/gnuradio-core/src/lib/filter/dotprod_fff_altivec.c
new file mode 100644
index 000000000..53d6df714
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/dotprod_fff_altivec.c
@@ -0,0 +1,162 @@
+/* -*- 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 this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <dotprod_fff_altivec.h>
+#include <gr_altivec.h>
+
+/*!
+ * \param x any value
+ * \param pow2 must be a power of 2
+ * \returns \p x rounded down to a multiple of \p pow2.
+ */
+static inline size_t
+gr_p2_round_down(size_t x, size_t pow2)
+{
+ return x & -pow2;
+}
+
+
+#if 0
+
+float
+dotprod_fff_altivec(const float *a, const float *b, size_t n)
+{
+ float sum = 0;
+ for (size_t i = 0; i < n; i++){
+ sum += a[i] * b[i];
+ }
+ return sum;
+}
+
+#else
+
+/*
+ * preconditions:
+ *
+ * n > 0 and a multiple of 4
+ * a 4-byte aligned
+ * b 16-byte aligned
+ */
+float
+dotprod_fff_altivec(const float *_a, const float *_b, size_t n)
+{
+ const vec_float4 *a = (const vec_float4 *) _a;
+ const vec_float4 *b = (const vec_float4 *) _b;
+
+ static const size_t UNROLL_CNT = 4;
+
+ n = gr_p2_round_down(n, 4);
+ size_t loop_cnt = n / (UNROLL_CNT * FLOATS_PER_VEC);
+ size_t nleft = n % (UNROLL_CNT * FLOATS_PER_VEC);
+
+ // printf("n = %zd, loop_cnt = %zd, nleft = %zd\n", n, loop_cnt, nleft);
+
+ // Used with vperm to build a* from p*
+ vec_uchar16 lvsl_a = vec_lvsl(0, _a);
+
+ vec_float4 p0, p1, p2, p3;
+ vec_float4 a0, a1, a2, a3;
+ vec_float4 b0, b1, b2, b3;
+ vec_float4 acc0 = {0, 0, 0, 0};
+ vec_float4 acc1 = {0, 0, 0, 0};
+ vec_float4 acc2 = {0, 0, 0, 0};
+ vec_float4 acc3 = {0, 0, 0, 0};
+
+ // wind in
+
+ p0 = vec_ld(0*VS, a);
+ p1 = vec_ld(1*VS, a);
+ p2 = vec_ld(2*VS, a);
+ p3 = vec_ld(3*VS, a);
+ a += UNROLL_CNT;
+
+ a0 = vec_perm(p0, p1, lvsl_a);
+ b0 = vec_ld(0*VS, b);
+ p0 = vec_ld(0*VS, a);
+
+ size_t i;
+ for (i = 0; i < loop_cnt; i++){
+
+ a1 = vec_perm(p1, p2, lvsl_a);
+ b1 = vec_ld(1*VS, b);
+ p1 = vec_ld(1*VS, a);
+ acc0 = vec_madd(a0, b0, acc0);
+
+ a2 = vec_perm(p2, p3, lvsl_a);
+ b2 = vec_ld(2*VS, b);
+ p2 = vec_ld(2*VS, a);
+ acc1 = vec_madd(a1, b1, acc1);
+
+ a3 = vec_perm(p3, p0, lvsl_a);
+ b3 = vec_ld(3*VS, b);
+ p3 = vec_ld(3*VS, a);
+ acc2 = vec_madd(a2, b2, acc2);
+
+ a += UNROLL_CNT;
+ b += UNROLL_CNT;
+
+ a0 = vec_perm(p0, p1, lvsl_a);
+ b0 = vec_ld(0*VS, b);
+ p0 = vec_ld(0*VS, a);
+ acc3 = vec_madd(a3, b3, acc3);
+ }
+
+ /*
+ * The compiler ought to be able to figure out that 0, 4, 8 and 12
+ * are the only possible values for nleft.
+ */
+ switch (nleft){
+ case 0:
+ break;
+
+ case 4:
+ acc0 = vec_madd(a0, b0, acc0);
+ break;
+
+ case 8:
+ a1 = vec_perm(p1, p2, lvsl_a);
+ b1 = vec_ld(1*VS, b);
+ acc0 = vec_madd(a0, b0, acc0);
+ acc1 = vec_madd(a1, b1, acc1);
+ break;
+
+ case 12:
+ a1 = vec_perm(p1, p2, lvsl_a);
+ b1 = vec_ld(1*VS, b);
+ acc0 = vec_madd(a0, b0, acc0);
+ a2 = vec_perm(p2, p3, lvsl_a);
+ b2 = vec_ld(2*VS, b);
+ acc1 = vec_madd(a1, b1, acc1);
+ acc2 = vec_madd(a2, b2, acc2);
+ break;
+ }
+
+ acc0 = acc0 + acc1;
+ acc2 = acc2 + acc3;
+ acc0 = acc0 + acc2;
+
+ return horizontal_add_f(acc0);
+}
+
+#endif
diff --git a/gnuradio-core/src/lib/filter/dotprod_fff_altivec.h b/gnuradio-core/src/lib/filter/dotprod_fff_altivec.h
new file mode 100644
index 000000000..a52370d56
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/dotprod_fff_altivec.h
@@ -0,0 +1,50 @@
+/* -*- 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 this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+#ifndef INCLUDED_DOTPROD_FFF_ALTIVEC_H
+#define INCLUDED_DOTPROD_FFF_ALTIVEC_H
+
+#include <gr_core_api.h>
+#include <stddef.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*!
+ * <pre>
+ *
+ * preconditions:
+ *
+ * n > 0 and a multiple of 4
+ * a 4-byte aligned
+ * b 16-byte aligned
+ *
+ * </pre>
+ */
+float
+dotprod_fff_altivec(const float *a, const float *b, size_t n);
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /* INCLUDED_DOTPROD_FFF_ALTIVEC_H */
diff --git a/gnuradio-core/src/lib/filter/dotprod_fff_armv7_a.c b/gnuradio-core/src/lib/filter/dotprod_fff_armv7_a.c
new file mode 100644
index 000000000..23bbef033
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/dotprod_fff_armv7_a.c
@@ -0,0 +1,87 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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 this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <dotprod_fff_armv7_a.h>
+
+/*!
+ * \param x any value
+ * \param pow2 must be a power of 2
+ * \returns \p x rounded down to a multiple of \p pow2.
+ */
+static inline size_t
+gr_p2_round_down(size_t x, size_t pow2)
+{
+ return x & -pow2;
+}
+
+
+#ifndef HAVE_MFPU_NEON
+
+float
+dotprod_fff_armv7_a(const float *a, const float *b, size_t n)
+{
+ float sum = 0;
+ size_t i;
+ for (i = 0; i < n; i++){
+ sum += a[i] * b[i];
+ }
+ return sum;
+}
+
+#else
+
+/*
+ * preconditions:
+ *
+ * n > 0 and a multiple of 4
+ * a 4-byte aligned
+ * b 16-byte aligned
+ */
+float
+dotprod_fff_armv7_a(const float *a, const float *b, size_t n)
+{
+ float s = 0;
+
+ asm ("vmov.f32 q8, #0.0 \n\t"
+ "vmov.f32 q9, #0.0 \n\t"
+ "1: \n\t"
+ "subs %3, %3, #8 \n\t"
+ "vld1.32 {d0,d1,d2,d3}, [%1]! \n\t"
+ "vld1.32 {d4,d5,d6,d7}, [%2]! \n\t"
+ "vmla.f32 q8, q0, q2 \n\t"
+ "vmla.f32 q9, q1, q3 \n\t"
+ "bgt 1b \n\t"
+ "vadd.f32 q8, q8, q9 \n\t"
+ "vpadd.f32 d0, d16, d17 \n\t"
+ "vadd.f32 %0, s0, s1 \n\t"
+ : "=w"(s), "+r"(a), "+r"(b), "+r"(n)
+ :: "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7",
+ "d16", "d17", "d18", "d19");
+
+ return s;
+
+}
+
+#endif
diff --git a/gnuradio-core/src/lib/filter/dotprod_fff_armv7_a.h b/gnuradio-core/src/lib/filter/dotprod_fff_armv7_a.h
new file mode 100644
index 000000000..6cea45cea
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/dotprod_fff_armv7_a.h
@@ -0,0 +1,50 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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 this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+#ifndef INCLUDED_DOTPROD_FFF_ARMV7_A_H
+#define INCLUDED_DOTPROD_FFF_ARMV7_A_H
+
+#include <gr_core_api.h>
+#include <stddef.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*!
+ * <pre>
+ *
+ * preconditions:
+ *
+ * n > 0 and a multiple of 4
+ * a 4-byte aligned
+ * b 16-byte aligned
+ *
+ * </pre>
+ */
+float
+dotprod_fff_armv7_a(const float *a, const float *b, size_t n);
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /* INCLUDED_DOTPROD_FFF_ARMV7_A_H */
diff --git a/gnuradio-core/src/lib/filter/fcomplex_dotprod_3dnow.S b/gnuradio-core/src/lib/filter/fcomplex_dotprod_3dnow.S
new file mode 100644
index 000000000..536e46dc1
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/fcomplex_dotprod_3dnow.S
@@ -0,0 +1,176 @@
+#
+# Copyright 2002 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.
+#
+
+# input and taps are guarenteed to be 16 byte aligned.
+# n_2_complex_blocks is != 0
+#
+#
+# fcomplex_dotprod_generic (const float *input,
+# const float *taps, unsigned n_2_complex_blocks, float *result)
+# {
+# float sum0 = 0;
+# float sum1 = 0;
+# float sum2 = 0;
+# float sum3 = 0;
+#
+# do {
+#
+# sum0 += input[0] * taps[0];
+# sum1 += input[0] * taps[1];
+# sum2 += input[1] * taps[2];
+# sum3 += input[1] * taps[3];
+#
+# input += 2;
+# taps += 4;
+#
+# } while (--n_2_complex_blocks != 0);
+#
+#
+# result[0] = sum0 + sum2;
+# result[1] = sum1 + sum3;
+# }
+#
+
+#include "assembly.h"
+
+
+ .file "fcomplex_dotprod_3dnow.S"
+// .version "01.01"
+.text
+ .p2align 4
+.globl GLOB_SYMB(fcomplex_dotprod_3dnow)
+ DEF_FUNC_HEAD(fcomplex_dotprod_3dnow)
+GLOB_SYMB(fcomplex_dotprod_3dnow):
+ pushl %ebp
+ movl %esp, %ebp
+ movl 8(%ebp), %eax # input
+ movl 12(%ebp), %edx # taps
+ movl 16(%ebp), %ecx
+
+ # zero accumulators
+
+ pxor %mm4, %mm4 # mm4 = 0 0
+ pxor %mm5, %mm5 # mm5 = 0 0
+ pxor %mm6, %mm6 # mm6 = 0 0
+ pxor %mm7, %mm7 # mm7 = 0 0
+
+ shrl $1, %ecx # ecx = n_2_complex_blocks / 2
+
+ movq 0(%eax), %mm0
+
+ pxor %mm2, %mm2
+ pxor %mm3, %mm3
+
+ movq %mm0, %mm1
+ punpckldq %mm0, %mm0
+ punpckhdq %mm1, %mm1
+
+
+ jmp .L1_test
+
+ #
+ # 4 taps / loop
+ # something like ?? cycles / loop
+ #
+
+ .p2align 4
+.Loop1:
+ pfmul 0(%edx), %mm0
+ pfadd %mm2, %mm6
+
+ movq 8(%eax), %mm2
+
+ pfadd %mm3, %mm7
+
+ pfmul 8(%edx), %mm1
+
+ movq %mm2, %mm3
+ punpckldq %mm2, %mm2
+ punpckhdq %mm3, %mm3
+
+
+ pfmul 16(%edx), %mm2
+ pfadd %mm0, %mm4
+
+ movq 16(%eax), %mm0
+
+ pfadd %mm1, %mm5
+
+ movq %mm0, %mm1
+ punpckldq %mm0, %mm0
+
+ pfmul 24(%edx), %mm3
+
+ punpckhdq %mm1, %mm1
+
+
+#TODO: add prefetch?
+
+ addl $32, %edx
+ addl $16, %eax
+
+.L1_test:
+ decl %ecx
+ jge .Loop1
+
+ # We've handled the bulk of multiplies up to here.
+ # Now accumulate the final two additions and see if original
+ # n_2_complex_blocks was odd. If so, we've got 2 more
+ # taps to do.
+
+ movl 16(%ebp), %ecx
+ pfadd %mm2, %mm6
+ andl $1, %ecx
+ pfadd %mm3, %mm7
+ je .Leven
+
+ # The count was odd, do 2 more taps.
+ # Note that we've already got mm0 and mm1 preloaded
+ # from the main loop.
+
+ pfmul 0(%edx), %mm0
+ pfadd %mm0, %mm4
+ pfmul 8(%edx), %mm1
+ pfadd %mm1, %mm5
+
+
+.Leven:
+ # at this point mm4, mm5, mm6 and mm7 contain partial sums
+
+ pfadd %mm7, %mm6
+ pfadd %mm5, %mm4
+
+ movl 20(%ebp), %eax # result
+
+ pfadd %mm6, %mm4
+
+ movq %mm4, (%eax)
+ femms
+
+ popl %ebp
+ ret
+
+FUNC_TAIL(fcomplex_dotprod_3dnow)
+ .ident "Hand coded x86 3DNow! assembly"
+
+#if defined(__linux__) && defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff --git a/gnuradio-core/src/lib/filter/fcomplex_dotprod_3dnow64.S b/gnuradio-core/src/lib/filter/fcomplex_dotprod_3dnow64.S
new file mode 100644
index 000000000..d9a695949
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/fcomplex_dotprod_3dnow64.S
@@ -0,0 +1,170 @@
+#
+# Copyright 2002,2005 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.
+#
+
+# input and taps are guarenteed to be 16 byte aligned.
+# n_2_complex_blocks is != 0
+#
+#
+# fcomplex_dotprod_generic (const float *input,
+# const float *taps, unsigned n_2_complex_blocks, float *result)
+# {
+# float sum0 = 0;
+# float sum1 = 0;
+# float sum2 = 0;
+# float sum3 = 0;
+#
+# do {
+#
+# sum0 += input[0] * taps[0];
+# sum1 += input[0] * taps[1];
+# sum2 += input[1] * taps[2];
+# sum3 += input[1] * taps[3];
+#
+# input += 2;
+# taps += 4;
+#
+# } while (--n_2_complex_blocks != 0);
+#
+#
+# result[0] = sum0 + sum2;
+# result[1] = sum1 + sum3;
+# }
+#
+
+#include "assembly.h"
+
+
+ .file "fcomplex_dotprod_3dnow64.S"
+// .version "01.01"
+.text
+ .p2align 4
+.globl GLOB_SYMB(fcomplex_dotprod_3dnow)
+ DEF_FUNC_HEAD(fcomplex_dotprod_3dnow)
+GLOB_SYMB(fcomplex_dotprod_3dnow):
+
+ # intput: rdi, taps: rsi, n_2_ccomplex_blocks: rdx, result: rcx
+
+ mov %rdx, %rax
+
+ # zero accumulators
+
+ pxor %mm4, %mm4 # mm4 = 0 0
+ pxor %mm5, %mm5 # mm5 = 0 0
+ pxor %mm6, %mm6 # mm6 = 0 0
+ pxor %mm7, %mm7 # mm7 = 0 0
+
+ shr $1, %rax # rax = n_2_complex_blocks / 2
+
+ movq 0(%rdi), %mm0
+
+ pxor %mm2, %mm2
+ pxor %mm3, %mm3
+
+ movq %mm0, %mm1
+ punpckldq %mm0, %mm0
+ punpckhdq %mm1, %mm1
+
+
+ jmp .L1_test
+
+ #
+ # 4 taps / loop
+ # something like ?? cycles / loop
+ #
+
+ .p2align 4
+.Loop1:
+ pfmul 0(%rsi), %mm0
+ pfadd %mm2, %mm6
+
+ movq 8(%rdi), %mm2
+
+ pfadd %mm3, %mm7
+
+ pfmul 8(%rsi), %mm1
+
+ movq %mm2, %mm3
+ punpckldq %mm2, %mm2
+ punpckhdq %mm3, %mm3
+
+
+ pfmul 16(%rsi), %mm2
+ pfadd %mm0, %mm4
+
+ movq 16(%rdi), %mm0
+
+ pfadd %mm1, %mm5
+
+ movq %mm0, %mm1
+ punpckldq %mm0, %mm0
+
+ pfmul 24(%rsi), %mm3
+
+ punpckhdq %mm1, %mm1
+
+
+#TODO: add prefetch?
+
+ add $32, %rsi
+ add $16, %rdi
+
+.L1_test:
+ dec %rax
+ jge .Loop1
+
+ # We've handled the bulk of multiplies up to here.
+ # Now accumulate the final two additions and see if original
+ # n_2_complex_blocks was odd. If so, we've got 2 more
+ # taps to do.
+
+ pfadd %mm2, %mm6
+ and $1, %rdx
+ pfadd %mm3, %mm7
+ je .Leven
+
+ # The count was odd, do 2 more taps.
+ # Note that we've already got mm0 and mm1 preloaded
+ # from the main loop.
+
+ pfmul 0(%rsi), %mm0
+ pfadd %mm0, %mm4
+ pfmul 8(%rsi), %mm1
+ pfadd %mm1, %mm5
+
+
+.Leven:
+ # at this point mm4, mm5, mm6 and mm7 contain partial sums
+
+ pfadd %mm7, %mm6
+ pfadd %mm5, %mm4
+ pfadd %mm6, %mm4
+
+ movq %mm4, (%rcx) # result
+ femms
+
+ retq
+
+FUNC_TAIL(fcomplex_dotprod_3dnow)
+ .ident "Hand coded x86_64 3DNow! assembly"
+
+#if defined(__linux__) && defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff --git a/gnuradio-core/src/lib/filter/fcomplex_dotprod_sse.S b/gnuradio-core/src/lib/filter/fcomplex_dotprod_sse.S
new file mode 100644
index 000000000..4c5e956f2
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/fcomplex_dotprod_sse.S
@@ -0,0 +1,188 @@
+#
+# Copyright 2002 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.
+#
+
+
+# input and taps are guarenteed to be 16 byte aligned.
+# n_2_complex_blocks is != 0
+#
+#
+# fcomplex_dotprod_generic (const float *input,
+# const float *taps, unsigned n_2_complex_blocks, float *result)
+# {
+# float sum0 = 0;
+# float sum1 = 0;
+# float sum2 = 0;
+# float sum3 = 0;
+#
+# do {
+#
+# sum0 += input[0] * taps[0];
+# sum1 += input[0] * taps[1];
+# sum2 += input[1] * taps[2];
+# sum3 += input[1] * taps[3];
+#
+# input += 2;
+# taps += 4;
+#
+# } while (--n_2_complex_blocks != 0);
+#
+#
+# result[0] = sum0 + sum2;
+# result[1] = sum1 + sum3;
+# }
+#
+
+# TODO: prefetch and better scheduling
+
+#include "assembly.h"
+
+
+ .file "fcomplex_dotprod_sse.S"
+// .version "01.01"
+.text
+ .p2align 4
+.globl GLOB_SYMB(fcomplex_dotprod_sse)
+ DEF_FUNC_HEAD(fcomplex_dotprod_sse)
+GLOB_SYMB(fcomplex_dotprod_sse):
+ pushl %ebp
+ movl %esp, %ebp
+ movl 8(%ebp), %eax # input
+ movl 12(%ebp), %edx # taps
+ movl 16(%ebp), %ecx
+
+
+ # xmm0 xmm1 xmm2 xmm3 are used to hold taps and the result of mults
+ # xmm4 xmm5 xmm6 xmm7 are used to hold the accumulated results
+
+ xorps %xmm4, %xmm4 # zero two accumulators
+ xorps %xmm5, %xmm5 # xmm5 holds zero for use below
+
+ # first handle any non-zero remainder of (n_2_complex_blocks % 4)
+
+ andl $0x3, %ecx
+ jmp .L1_test
+
+ .p2align 4
+.Loop1:
+
+ movlps 0(%eax), %xmm0
+ shufps $0x50, %xmm0, %xmm0 # b01010000
+
+ mulps (%edx), %xmm0
+ addl $0x10, %edx
+ addl $8, %eax
+ addps %xmm0, %xmm4
+.L1_test:
+ decl %ecx
+ jge .Loop1
+
+
+ # set up for primary loop which is unrolled 4 times
+
+ movl 16(%ebp), %ecx
+ movaps %xmm5, %xmm6 # zero remaining accumulators
+ movaps %xmm5, %xmm7
+
+ shrl $2, %ecx # n_2_complex_blocks / 4
+ je .Lcleanup # if zero, take short path
+
+ # finish setup and loop priming
+
+ movlps 0(%eax), %xmm0
+
+ movaps %xmm5, %xmm2
+ movaps %xmm5, %xmm3
+
+ movlps 8(%eax), %xmm1
+ shufps $0x50, %xmm0, %xmm0
+
+ shufps $0x50, %xmm1, %xmm1
+
+ # we know ecx is not zero, we checked above,
+ # hence enter loop at top
+
+ .p2align 4
+.Loop2:
+ addps %xmm2, %xmm6
+ movlps 0x10(%eax), %xmm2
+
+ addps %xmm3, %xmm7
+
+ mulps (%edx), %xmm0
+
+ movlps 0x18(%eax), %xmm3
+ shufps $0x50, %xmm2, %xmm2
+
+ mulps 0x10(%edx), %xmm1
+
+ shufps $0x50, %xmm3, %xmm3
+
+ addps %xmm0, %xmm4
+ movlps 0x20(%eax), %xmm0
+
+ addps %xmm1, %xmm5
+
+ mulps 0x20(%edx), %xmm2
+
+ movlps 0x28(%eax), %xmm1
+ shufps $0x50, %xmm0, %xmm0
+
+ mulps 0x30(%edx), %xmm3
+
+ shufps $0x50, %xmm1, %xmm1
+
+ addl $0x40, %edx
+ addl $0x20, %eax
+ decl %ecx
+ jne .Loop2
+
+ # OK, now we've done with all the multiplies, but
+ # we still need to handle the unaccumulated
+ # products in xmm2 and xmm3
+
+ addps %xmm2, %xmm6
+ addps %xmm3, %xmm7
+
+ # now we want to add all accumulators into xmm4
+
+ addps %xmm5, %xmm4
+ addps %xmm6, %xmm7
+ addps %xmm7, %xmm4
+
+
+ # At this point, xmm4 contains 2x2 partial sums. We need
+ # to compute a "horizontal complex add" across xmm4.
+
+.Lcleanup: # xmm4 = r1 i2 r3 i4
+ movl 20(%ebp), %eax # @result
+ movhlps %xmm4, %xmm0 # xmm0 = ?? ?? r1 r2
+ addps %xmm4, %xmm0 # xmm0 = ?? ?? r1+r3 i2+i4
+ movlps %xmm0, (%eax) # store low 2x32 bits (complex) to memory
+
+ popl %ebp
+ ret
+
+FUNC_TAIL(fcomplex_dotprod_sse)
+ .ident "Hand coded x86 SSE assembly"
+
+#if defined(__linux__) && defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff --git a/gnuradio-core/src/lib/filter/fcomplex_dotprod_sse64.S b/gnuradio-core/src/lib/filter/fcomplex_dotprod_sse64.S
new file mode 100644
index 000000000..53a4f25e0
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/fcomplex_dotprod_sse64.S
@@ -0,0 +1,183 @@
+#
+# Copyright 2002,2005 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.
+#
+
+
+# input and taps are guarenteed to be 16 byte aligned.
+# n_2_complex_blocks is != 0
+#
+#
+# fcomplex_dotprod_generic (const float *input,
+# const float *taps, unsigned n_2_complex_blocks, float *result)
+# {
+# float sum0 = 0;
+# float sum1 = 0;
+# float sum2 = 0;
+# float sum3 = 0;
+#
+# do {
+#
+# sum0 += input[0] * taps[0];
+# sum1 += input[0] * taps[1];
+# sum2 += input[1] * taps[2];
+# sum3 += input[1] * taps[3];
+#
+# input += 2;
+# taps += 4;
+#
+# } while (--n_2_complex_blocks != 0);
+#
+#
+# result[0] = sum0 + sum2;
+# result[1] = sum1 + sum3;
+# }
+#
+
+# TODO: prefetch and better scheduling
+
+#include "assembly.h"
+
+
+ .file "fcomplex_dotprod_sse64.S"
+// .version "01.01"
+.text
+ .p2align 4
+.globl GLOB_SYMB(fcomplex_dotprod_sse)
+ DEF_FUNC_HEAD(fcomplex_dotprod_sse)
+GLOB_SYMB(fcomplex_dotprod_sse):
+
+ # intput: rdi, taps: rsi, n_2_ccomplex_blocks: rdx, result: rcx
+
+ mov %rdx, %rax
+
+ # xmm0 xmm1 xmm2 xmm3 are used to hold taps and the result of mults
+ # xmm4 xmm5 xmm6 xmm7 are used to hold the accumulated results
+
+ xorps %xmm4, %xmm4 # zero two accumulators
+ xorps %xmm5, %xmm5 # xmm5 holds zero for use below
+
+ # first handle any non-zero remainder of (n_2_complex_blocks % 4)
+
+ and $0x3, %rax
+ jmp .L1_test
+
+ .p2align 4
+.Loop1:
+
+ movlps 0(%rdi), %xmm0
+ shufps $0x50, %xmm0, %xmm0 # b01010000
+
+ mulps (%rsi), %xmm0
+ add $0x10, %rsi
+ add $8, %rdi
+ addps %xmm0, %xmm4
+.L1_test:
+ dec %rax
+ jge .Loop1
+
+
+ # set up for primary loop which is unrolled 4 times
+
+ movaps %xmm5, %xmm6 # zero remaining accumulators
+ movaps %xmm5, %xmm7
+
+ shr $2, %rdx # n_2_complex_blocks / 4
+ je .Lcleanup # if zero, take short path
+
+ # finish setup and loop priming
+
+ movlps 0(%rdi), %xmm0
+
+ movaps %xmm5, %xmm2
+ movaps %xmm5, %xmm3
+
+ movlps 8(%rdi), %xmm1
+ shufps $0x50, %xmm0, %xmm0
+
+ shufps $0x50, %xmm1, %xmm1
+
+ # we know rdx is not zero, we checked above,
+ # hence enter loop at top
+
+ .p2align 4
+.Loop2:
+ addps %xmm2, %xmm6
+ movlps 0x10(%rdi), %xmm2
+
+ addps %xmm3, %xmm7
+
+ mulps (%rsi), %xmm0
+
+ movlps 0x18(%rdi), %xmm3
+ shufps $0x50, %xmm2, %xmm2
+
+ mulps 0x10(%rsi), %xmm1
+
+ shufps $0x50, %xmm3, %xmm3
+
+ addps %xmm0, %xmm4
+ movlps 0x20(%rdi), %xmm0
+
+ addps %xmm1, %xmm5
+
+ mulps 0x20(%rsi), %xmm2
+
+ movlps 0x28(%rdi), %xmm1
+ shufps $0x50, %xmm0, %xmm0
+
+ mulps 0x30(%rsi), %xmm3
+
+ shufps $0x50, %xmm1, %xmm1
+
+ add $0x40, %rsi
+ add $0x20, %rdi
+ dec %rdx
+ jne .Loop2
+
+ # OK, now we've done with all the multiplies, but
+ # we still need to handle the unaccumulated
+ # products in xmm2 and xmm3
+
+ addps %xmm2, %xmm6
+ addps %xmm3, %xmm7
+
+ # now we want to add all accumulators into xmm4
+
+ addps %xmm5, %xmm4
+ addps %xmm6, %xmm7
+ addps %xmm7, %xmm4
+
+
+ # At this point, xmm4 contains 2x2 partial sums. We need
+ # to compute a "horizontal complex add" across xmm4.
+
+.Lcleanup: # xmm4 = r1 i2 r3 i4
+ movhlps %xmm4, %xmm0 # xmm0 = ?? ?? r1 r2
+ addps %xmm4, %xmm0 # xmm0 = ?? ?? r1+r3 i2+i4
+ movlps %xmm0, (%rcx) # store low 2x32 bits (complex) to memory
+
+ retq
+
+FUNC_TAIL(fcomplex_dotprod_sse)
+ .ident "Hand coded x86_64 SSE assembly"
+
+#if defined(__linux__) && defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff --git a/gnuradio-core/src/lib/filter/fcomplex_dotprod_x86.h b/gnuradio-core/src/lib/filter/fcomplex_dotprod_x86.h
new file mode 100644
index 000000000..b7eddf936
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/fcomplex_dotprod_x86.h
@@ -0,0 +1,42 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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 _FCOMPLEX_DOTPROD_X86_H_
+#define _FCOMPLEX_DOTPROD_X86_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void
+fcomplex_dotprod_3dnow (const float *input,
+ const float *taps, unsigned n_2_complex_blocks, float *result);
+
+void
+fcomplex_dotprod_sse (const float *input,
+ const float *taps, unsigned n_2_complex_blocks, float *result);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _FCOMPLEX_DOTPROD_X86_H_ */
diff --git a/gnuradio-core/src/lib/filter/filter.i b/gnuradio-core/src/lib/filter/filter.i
new file mode 100644
index 000000000..12580aa10
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/filter.i
@@ -0,0 +1,70 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2005,2006,2007,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_iir_filter_ffd.h>
+#include <gr_single_pole_iir_filter_ff.h>
+#include <gr_single_pole_iir_filter_cc.h>
+#include <gr_hilbert_fc.h>
+#include <gr_filter_delay_fc.h>
+#include <gr_fft_filter_ccc.h>
+#include <gr_fft_filter_fff.h>
+#include <gr_fractional_interpolator_ff.h>
+#include <gr_fractional_interpolator_cc.h>
+#include <gr_goertzel_fc.h>
+#include <gr_pfb_channelizer_ccf.h>
+#include <gr_pfb_synthesizer_ccf.h>
+#include <gr_pfb_decimator_ccf.h>
+#include <gr_pfb_interpolator_ccf.h>
+#include <gr_pfb_arb_resampler_ccf.h>
+#include <gr_pfb_arb_resampler_fff.h>
+#include <gr_pfb_clock_sync_ccf.h>
+#include <gr_pfb_clock_sync_fff.h>
+#include <gr_dc_blocker_cc.h>
+#include <gr_dc_blocker_ff.h>
+%}
+
+%include "gr_iir_filter_ffd.i"
+%include "gr_single_pole_iir_filter_ff.i"
+%include "gr_single_pole_iir_filter_cc.i"
+%include "gr_hilbert_fc.i"
+%include "gr_filter_delay_fc.i"
+%include "gr_fft_filter_ccc.i"
+%include "gr_fft_filter_fff.i"
+%include "gr_fractional_interpolator_ff.i"
+%include "gr_fractional_interpolator_cc.i"
+%include "gr_goertzel_fc.i"
+%include "gr_pfb_channelizer_ccf.i"
+%include "gr_pfb_synthesizer_ccf.i"
+%include "gr_pfb_decimator_ccf.i"
+%include "gr_pfb_interpolator_ccf.i"
+%include "gr_pfb_arb_resampler_ccf.i"
+%include "gr_pfb_arb_resampler_fff.i"
+%include "gr_pfb_decimator_ccf.i"
+%include "gr_pfb_interpolator_ccf.i"
+%include "gr_pfb_arb_resampler_ccf.i"
+%include "gr_pfb_clock_sync_ccf.i"
+%include "gr_pfb_clock_sync_fff.i"
+%include "gr_dc_blocker_cc.i"
+%include "gr_dc_blocker_ff.i"
+
+%include "filter_generated.i"
diff --git a/gnuradio-core/src/lib/filter/float_dotprod_3dnow.S b/gnuradio-core/src/lib/filter/float_dotprod_3dnow.S
new file mode 100644
index 000000000..cdebe9bc3
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/float_dotprod_3dnow.S
@@ -0,0 +1,152 @@
+#
+# Copyright 2002 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.
+#
+
+
+# input and taps are guarenteed to be 16 byte aligned.
+# n_4_float_blocks is != 0
+#
+#
+# float
+# float_dotprod_generic (const float *input,
+# const float *taps, unsigned n_4_float_blocks)
+# {
+# float sum0 = 0;
+# float sum1 = 0;
+# float sum2 = 0;
+# float sum3 = 0;
+#
+# do {
+#
+# sum0 += input[0] * taps[0];
+# sum1 += input[1] * taps[1];
+# sum2 += input[2] * taps[2];
+# sum3 += input[3] * taps[3];
+#
+# input += 4;
+# taps += 4;
+#
+# } while (--n_4_float_blocks != 0);
+#
+#
+# return sum0 + sum1 + sum2 + sum3;
+# }
+#
+
+#include "assembly.h"
+
+
+ .file "float_dotprod_3dnow.S"
+// .version "01.01"
+.text
+ .p2align 4
+.globl GLOB_SYMB(float_dotprod_3dnow)
+ DEF_FUNC_HEAD(float_dotprod_3dnow)
+GLOB_SYMB(float_dotprod_3dnow):
+ pushl %ebp
+ movl %esp, %ebp
+ movl 8(%ebp), %edx
+ movl 12(%ebp), %eax
+ movl 16(%ebp), %ecx
+
+ # zero accumulators
+
+ pxor %mm4, %mm4 # mm4 = 0 0
+ pxor %mm5, %mm5 # mm5 = 0 0
+ pxor %mm6, %mm6 # mm6 = 0 0
+ pxor %mm7, %mm7 # mm7 = 0 0
+
+ shrl $1, %ecx # ecx = n_4_float_blocks / 2
+ movq 0(%eax), %mm0
+ movq 8(%eax), %mm1
+ pxor %mm2, %mm2
+ pxor %mm3, %mm3
+ jmp .L1_test
+
+ #
+ # 8 taps / loop
+ # something like 6 cycles / loop
+ #
+
+ .p2align 4
+.Loop1:
+ pfmul 0(%edx), %mm0
+ pfadd %mm2, %mm6
+ movq 16(%eax), %mm2
+
+ pfmul 8(%edx), %mm1
+ pfadd %mm3, %mm7
+ movq 24(%eax), %mm3
+
+ pfmul 16(%edx), %mm2
+ pfadd %mm0, %mm4
+ movq 32(%eax), %mm0
+
+ pfmul 24(%edx), %mm3
+ pfadd %mm1, %mm5
+ movq 40(%eax), %mm1
+
+ addl $32, %edx
+ addl $32, %eax
+.L1_test:
+ decl %ecx
+ jge .Loop1
+
+ # We've handled the bulk of multiplies up to here.
+ # Now accumulate the final two additions and see if original
+ # n_4_float_blocks was odd. If so, we've got 4 more
+ # taps to do.
+
+ movl 16(%ebp), %ecx
+ pfadd %mm2, %mm6
+ andl $1, %ecx
+ pfadd %mm3, %mm7
+ je .Leven
+
+ # The count was odd, do 4 more taps.
+ # Note that we've already got mm0 and mm1 preloaded
+ # from the main loop.
+
+ pfmul 0(%edx), %mm0
+ pfadd %mm0, %mm4
+ pfmul 8(%edx), %mm1
+ pfadd %mm1, %mm5
+
+.Leven:
+ # at this point mm4, mm5, mm6 and mm7 contain partial sums
+
+ pfadd %mm7, %mm6
+ pfadd %mm5, %mm4
+ pfadd %mm6, %mm4
+ pfacc %mm4, %mm4
+
+ movd %mm4, 16(%ebp)
+ femms
+ flds 16(%ebp)
+
+ popl %ebp
+ ret
+
+FUNC_TAIL(float_dotprod_3dnow)
+ .ident "Hand coded x86 3DNow! assembly"
+
+#if defined(__linux__) && defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff --git a/gnuradio-core/src/lib/filter/float_dotprod_3dnow64.S b/gnuradio-core/src/lib/filter/float_dotprod_3dnow64.S
new file mode 100644
index 000000000..1e859d75a
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/float_dotprod_3dnow64.S
@@ -0,0 +1,149 @@
+#
+# Copyright 2002,2005 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.
+#
+
+
+# input and taps are guarenteed to be 16 byte aligned.
+# n_4_float_blocks is != 0
+#
+#
+# float
+# float_dotprod_generic (const float *input,
+# const float *taps, unsigned n_4_float_blocks)
+# {
+# float sum0 = 0;
+# float sum1 = 0;
+# float sum2 = 0;
+# float sum3 = 0;
+#
+# do {
+#
+# sum0 += input[0] * taps[0];
+# sum1 += input[1] * taps[1];
+# sum2 += input[2] * taps[2];
+# sum3 += input[3] * taps[3];
+#
+# input += 4;
+# taps += 4;
+#
+# } while (--n_4_float_blocks != 0);
+#
+#
+# return sum0 + sum1 + sum2 + sum3;
+# }
+#
+
+#include "assembly.h"
+
+
+ .file "float_dotprod_3dnow64.S"
+// .version "01.01"
+.text
+ .p2align 4
+.globl GLOB_SYMB(float_dotprod_3dnow)
+ DEF_FUNC_HEAD(float_dotprod_3dnow)
+GLOB_SYMB(float_dotprod_3dnow):
+
+ # intput: rdi, taps: rsi, n_2_ccomplex_blocks: rdx
+
+ mov %rdx, %rax
+
+ # zero accumulators
+
+ pxor %mm4, %mm4 # mm4 = 0 0
+ pxor %mm5, %mm5 # mm5 = 0 0
+ pxor %mm6, %mm6 # mm6 = 0 0
+ pxor %mm7, %mm7 # mm7 = 0 0
+
+ shr $1, %rax # rax = n_4_float_blocks / 2
+ movq 0(%rsi), %mm0
+ movq 8(%rsi), %mm1
+ pxor %mm2, %mm2
+ pxor %mm3, %mm3
+ jmp .L1_test
+
+ #
+ # 8 taps / loop
+ # something like 6 cycles / loop
+ #
+
+ .p2align 4
+.Loop1:
+ pfmul 0(%rdi), %mm0
+ pfadd %mm2, %mm6
+ movq 16(%rsi), %mm2
+
+ pfmul 8(%rdi), %mm1
+ pfadd %mm3, %mm7
+ movq 24(%rsi), %mm3
+
+ pfmul 16(%rdi), %mm2
+ pfadd %mm0, %mm4
+ movq 32(%rsi), %mm0
+
+ pfmul 24(%rdi), %mm3
+ pfadd %mm1, %mm5
+ movq 40(%rsi), %mm1
+
+ add $32, %rdi
+ add $32, %rsi
+.L1_test:
+ dec %rax
+ jge .Loop1
+
+ # We've handled the bulk of multiplies up to here.
+ # Now accumulate the final two additions and see if original
+ # n_4_float_blocks was odd. If so, we've got 4 more
+ # taps to do.
+
+ pfadd %mm2, %mm6
+ and $1, %rdx
+ pfadd %mm3, %mm7
+ je .Leven
+
+ # The count was odd, do 4 more taps.
+ # Note that we've already got mm0 and mm1 preloaded
+ # from the main loop.
+
+ pfmul 0(%rdi), %mm0
+ pfadd %mm0, %mm4
+ pfmul 8(%rdi), %mm1
+ pfadd %mm1, %mm5
+
+.Leven:
+ # at this point mm4, mm5, mm6 and mm7 contain partial sums
+
+ pfadd %mm7, %mm6
+ pfadd %mm5, %mm4
+ pfadd %mm6, %mm4
+ pfacc %mm4, %mm4
+
+ movd %mm4, -8(%rsp)
+ movss -8(%rsp), %xmm0
+ femms
+
+ retq
+
+FUNC_TAIL(float_dotprod_3dnow)
+ .ident "Hand coded x86_64 3DNow! assembly"
+
+#if defined(__linux__) && defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff --git a/gnuradio-core/src/lib/filter/float_dotprod_generic.c b/gnuradio-core/src/lib/filter/float_dotprod_generic.c
new file mode 100644
index 000000000..fb9139036
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/float_dotprod_generic.c
@@ -0,0 +1,49 @@
+/* -*- c -*- */
+/*
+ * Copyright 2002 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 "float_dotprod_generic.h"
+
+
+float
+float_dotprod_generic (const float *input,
+ const float *taps, unsigned n_4_float_blocks)
+{
+ float sum0 = 0;
+ float sum1 = 0;
+ float sum2 = 0;
+ float sum3 = 0;
+
+ do {
+
+ sum0 += input[0] * taps[0];
+ sum1 += input[1] * taps[1];
+ sum2 += input[2] * taps[2];
+ sum3 += input[3] * taps[3];
+
+ input += 4;
+ taps += 4;
+
+ } while (--n_4_float_blocks != 0);
+
+
+ return sum0 + sum1 + sum2 + sum3;
+}
diff --git a/gnuradio-core/src/lib/filter/float_dotprod_generic.h b/gnuradio-core/src/lib/filter/float_dotprod_generic.h
new file mode 100644
index 000000000..dee967642
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/float_dotprod_generic.h
@@ -0,0 +1,41 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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 _FLOAT_DOTPROD_GENERIC_H_
+#define _FLOAT_DOTPROD_GENERIC_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+float
+float_dotprod_generic (const float *input,
+ const float *taps, unsigned n_4_float_blocks);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+
+#endif /* _FLOAT_DOTPROD_GENERIC_H_ */
diff --git a/gnuradio-core/src/lib/filter/float_dotprod_sse.S b/gnuradio-core/src/lib/filter/float_dotprod_sse.S
new file mode 100644
index 000000000..66604526d
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/float_dotprod_sse.S
@@ -0,0 +1,171 @@
+#
+# Copyright 2002 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.
+#
+
+
+# input and taps are guarenteed to be 16 byte aligned.
+# n_4_float_blocks is != 0
+#
+#
+# float
+# float_dotprod_generic (const float *input,
+# const float *taps, unsigned n_4_float_blocks)
+# {
+# float sum0 = 0;
+# float sum1 = 0;
+# float sum2 = 0;
+# float sum3 = 0;
+#
+# do {
+#
+# sum0 += input[0] * taps[0];
+# sum1 += input[1] * taps[1];
+# sum2 += input[2] * taps[2];
+# sum3 += input[3] * taps[3];
+#
+# input += 4;
+# taps += 4;
+#
+# } while (--n_4_float_blocks != 0);
+#
+#
+# return sum0 + sum1 + sum2 + sum3;
+# }
+#
+
+#include "assembly.h"
+
+
+ .file "float_dotprod_sse.S"
+// .version "01.01"
+.text
+ .p2align 4
+.globl GLOB_SYMB(float_dotprod_sse)
+ DEF_FUNC_HEAD(float_dotprod_sse)
+GLOB_SYMB(float_dotprod_sse):
+ pushl %ebp
+ movl %esp, %ebp
+ movl 8(%ebp), %edx
+ movl 12(%ebp), %eax
+ movl 16(%ebp), %ecx
+
+
+ # xmm0 xmm1 xmm2 xmm3 are used to hold taps and the result of mults
+ # xmm4 xmm5 xmm6 xmm7 are used to hold the accumulated results
+
+ xorps %xmm4, %xmm4 # zero two accumulators
+ xorps %xmm5, %xmm5 # xmm5 holds zero for use below
+
+ # first handle any non-zero remainder of (n_4_float_blocks % 4)
+
+ andl $0x3, %ecx
+ jmp .L1_test
+
+ .p2align 4
+.Loop1:
+ movaps (%eax), %xmm0
+ mulps (%edx), %xmm0
+ addl $0x10, %edx
+ addl $0x10, %eax
+ addps %xmm0, %xmm4
+.L1_test:
+ decl %ecx
+ jge .Loop1
+
+
+ # set up for primary loop which is unrolled 4 times
+
+ movl 16(%ebp), %ecx
+ movaps %xmm5, %xmm6 # zero remaining accumulators
+ movaps %xmm5, %xmm7
+
+ shrl $2, %ecx # n_4_float_blocks / 4
+ je .Lcleanup # if zero, take short path
+
+ # finish setup and loop priming
+
+ movaps 0x00(%eax), %xmm0
+ movaps %xmm5, %xmm2
+ movaps 0x10(%eax), %xmm1
+ movaps %xmm5, %xmm3
+
+ # we know ecx is not zero, we checked above,
+ # hence enter loop at top
+
+ .p2align 4
+.Loop2:
+ mulps (%edx), %xmm0
+ addps %xmm2, %xmm6
+ movaps 0x20(%eax), %xmm2
+
+ mulps 0x10(%edx), %xmm1
+ addps %xmm3, %xmm7
+ movaps 0x30(%eax), %xmm3
+
+ mulps 0x20(%edx), %xmm2
+ addps %xmm0, %xmm4
+ movaps 0x40(%eax), %xmm0
+
+ mulps 0x30(%edx), %xmm3
+ addps %xmm1, %xmm5
+ movaps 0x50(%eax), %xmm1
+
+ addl $0x40, %edx
+ addl $0x40, %eax
+ decl %ecx
+ jne .Loop2
+
+ # OK, now we've done with all the multiplies, but
+ # we still need to handle the unaccumulated
+ # products in xmm2 and xmm3
+
+ addps %xmm2, %xmm6
+ addps %xmm3, %xmm7
+
+ # now we want to add all accumulators into xmm4
+
+ addps %xmm5, %xmm4
+ addps %xmm6, %xmm7
+ addps %xmm7, %xmm4
+
+
+ # At this point, xmm4 contains 4 partial sums. We need
+ # to compute a "horizontal add" across xmm4.
+ # This is a fairly nasty operation...
+
+.Lcleanup: # xmm4 = d1 d2 d3 d4
+ xorps %xmm0, %xmm0 # xmm0 = 0 0 0 0 (may be unnecessary)
+ movhlps %xmm4, %xmm0 # xmm0 = 0 0 d1 d2
+ addps %xmm4, %xmm0 # xmm0 = d1 d2 d1+d3 d2+d4
+ movaps %xmm0, %xmm1 # xmm1 = d1 d2 d1+d3 d2+d4
+ shufps $0xE1, %xmm4, %xmm1 # xmm1 = d1 d2 d2+d4 d1+d3
+ addss %xmm1, %xmm0 # xmm1 = d1 d2 d1+d3 d1+d2+d3+d4
+ movss %xmm0, 16(%ebp) # store low 32 bits (sum) to memory
+ flds 16(%ebp) # and load onto FPU stack for return
+
+ popl %ebp
+ ret
+
+FUNC_TAIL(float_dotprod_sse)
+ .ident "Hand coded x86 SSE assembly"
+
+#if defined(__linux__) && defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff --git a/gnuradio-core/src/lib/filter/float_dotprod_sse64.S b/gnuradio-core/src/lib/filter/float_dotprod_sse64.S
new file mode 100644
index 000000000..0dd0764c5
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/float_dotprod_sse64.S
@@ -0,0 +1,165 @@
+#
+# Copyright 2002,2005 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.
+#
+
+
+# input and taps are guarenteed to be 16 byte aligned.
+# n_4_float_blocks is != 0
+#
+#
+# float
+# float_dotprod_generic (const float *input,
+# const float *taps, unsigned n_4_float_blocks)
+# {
+# float sum0 = 0;
+# float sum1 = 0;
+# float sum2 = 0;
+# float sum3 = 0;
+#
+# do {
+#
+# sum0 += input[0] * taps[0];
+# sum1 += input[1] * taps[1];
+# sum2 += input[2] * taps[2];
+# sum3 += input[3] * taps[3];
+#
+# input += 4;
+# taps += 4;
+#
+# } while (--n_4_float_blocks != 0);
+#
+#
+# return sum0 + sum1 + sum2 + sum3;
+# }
+#
+
+#include "assembly.h"
+
+
+ .file "float_dotprod_sse64.S"
+// .version "01.01"
+.text
+ .p2align 4
+.globl GLOB_SYMB(float_dotprod_sse)
+ DEF_FUNC_HEAD(float_dotprod_sse)
+GLOB_SYMB(float_dotprod_sse):
+
+ # intput: rdi, taps: rsi, n_2_ccomplex_blocks: rdx
+
+ mov %rdx, %rax
+
+ # xmm0 xmm1 xmm2 xmm3 are used to hold taps and the result of mults
+ # xmm4 xmm5 xmm6 xmm7 are used to hold the accumulated results
+
+ xorps %xmm4, %xmm4 # zero two accumulators
+ xorps %xmm5, %xmm5 # xmm5 holds zero for use below
+
+ # first handle any non-zero remainder of (n_4_float_blocks % 4)
+
+ and $0x3, %rax
+ jmp .L1_test
+
+ .p2align 4
+.Loop1:
+ movaps (%rsi), %xmm0
+ mulps (%rdi), %xmm0
+ add $0x10, %rdi
+ add $0x10, %rsi
+ addps %xmm0, %xmm4
+.L1_test:
+ dec %rax
+ jge .Loop1
+
+
+ # set up for primary loop which is unrolled 4 times
+
+ movaps %xmm5, %xmm6 # zero remaining accumulators
+ movaps %xmm5, %xmm7
+
+ shr $2, %rdx # n_4_float_blocks / 4
+ je .Lcleanup # if zero, take short path
+
+ # finish setup and loop priming
+
+ movaps 0x00(%rsi), %xmm0
+ movaps %xmm5, %xmm2
+ movaps 0x10(%rsi), %xmm1
+ movaps %xmm5, %xmm3
+
+ # we know rdx is not zero, we checked above,
+ # hence enter loop at top
+
+ .p2align 4
+.Loop2:
+ mulps (%rdi), %xmm0
+ addps %xmm2, %xmm6
+ movaps 0x20(%rsi), %xmm2
+
+ mulps 0x10(%rdi), %xmm1
+ addps %xmm3, %xmm7
+ movaps 0x30(%rsi), %xmm3
+
+ mulps 0x20(%rdi), %xmm2
+ addps %xmm0, %xmm4
+ movaps 0x40(%rsi), %xmm0
+
+ mulps 0x30(%rdi), %xmm3
+ addps %xmm1, %xmm5
+ movaps 0x50(%rsi), %xmm1
+
+ add $0x40, %rdi
+ add $0x40, %rsi
+ dec %rdx
+ jne .Loop2
+
+ # OK, now we've done with all the multiplies, but
+ # we still need to handle the unaccumulated
+ # products in xmm2 and xmm3
+
+ addps %xmm2, %xmm6
+ addps %xmm3, %xmm7
+
+ # now we want to add all accumulators into xmm4
+
+ addps %xmm5, %xmm4
+ addps %xmm6, %xmm7
+ addps %xmm7, %xmm4
+
+
+ # At this point, xmm4 contains 4 partial sums. We need
+ # to compute a "horizontal add" across xmm4.
+ # This is a fairly nasty operation...
+
+.Lcleanup: # xmm4 = d1 d2 d3 d4
+ xorps %xmm0, %xmm0 # xmm0 = 0 0 0 0 (may be unnecessary)
+ movhlps %xmm4, %xmm0 # xmm0 = 0 0 d1 d2
+ addps %xmm4, %xmm0 # xmm0 = d1 d2 d1+d3 d2+d4
+ movaps %xmm0, %xmm1 # xmm1 = d1 d2 d1+d3 d2+d4
+ shufps $0xE1, %xmm4, %xmm1 # xmm1 = d1 d2 d2+d4 d1+d3
+ addss %xmm1, %xmm0 # xmm1 = d1 d2 d1+d3 d1+d2+d3+d4
+
+ retq
+
+FUNC_TAIL(float_dotprod_sse)
+ .ident "Hand coded x86_64 SSE assembly"
+
+#if defined(__linux__) && defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff --git a/gnuradio-core/src/lib/filter/float_dotprod_x86.h b/gnuradio-core/src/lib/filter/float_dotprod_x86.h
new file mode 100644
index 000000000..fd1a2cc93
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/float_dotprod_x86.h
@@ -0,0 +1,44 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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 _FLOAT_DOTPROD_X86_H_
+#define _FLOAT_DOTPROD_X86_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+float
+float_dotprod_3dnow (const float *input,
+ const float *taps, unsigned n_4_float_blocks);
+
+float
+float_dotprod_sse (const float *input,
+ const float *taps, unsigned n_4_float_blocks);
+
+#ifdef __cplusplus
+}
+#endif
+
+
+
+#endif /* _FLOAT_DOTPROD_X86_H_ */
diff --git a/gnuradio-core/src/lib/filter/gcc_x86_cpuid.h b/gnuradio-core/src/lib/filter/gcc_x86_cpuid.h
new file mode 100644
index 000000000..98eeb33a3
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gcc_x86_cpuid.h
@@ -0,0 +1,178 @@
+/*
+ * Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+ *
+ * This file 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.
+ *
+ * This file 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.
+ *
+ * Under Section 7 of GPL version 3, you are granted additional
+ * permissions described in the GCC Runtime Library Exception, version
+ * 3.1, as published by the Free Software Foundation.
+ *
+ * You should have received a copy of the GNU General Public License and
+ * a copy of the GCC Runtime Library Exception along with this program;
+ * see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+ * <http://www.gnu.org/licenses/>.
+ */
+
+/* %ecx */
+#define bit_SSE3 (1 << 0)
+#define bit_PCLMUL (1 << 1)
+#define bit_SSSE3 (1 << 9)
+#define bit_FMA (1 << 12)
+#define bit_CMPXCHG16B (1 << 13)
+#define bit_SSE4_1 (1 << 19)
+#define bit_SSE4_2 (1 << 20)
+#define bit_MOVBE (1 << 22)
+#define bit_POPCNT (1 << 23)
+#define bit_AES (1 << 25)
+#define bit_XSAVE (1 << 26)
+#define bit_OSXSAVE (1 << 27)
+#define bit_AVX (1 << 28)
+
+/* %edx */
+#define bit_CMPXCHG8B (1 << 8)
+#define bit_CMOV (1 << 15)
+#define bit_MMX (1 << 23)
+#define bit_FXSAVE (1 << 24)
+#define bit_SSE (1 << 25)
+#define bit_SSE2 (1 << 26)
+
+/* Extended Features */
+/* %ecx */
+#define bit_LAHF_LM (1 << 0)
+#define bit_SSE4a (1 << 6)
+#define bit_SSE5 (1 << 11)
+
+/* %edx */
+#define bit_LM (1 << 29)
+#define bit_3DNOWP (1 << 30)
+#define bit_3DNOW (1 << 31)
+
+
+#if defined(__i386__) && defined(__PIC__)
+/* %ebx may be the PIC register. */
+#if __GNUC__ >= 3
+#define __cpuid(level, a, b, c, d) \
+ __asm__ ("xchg{l}\t{%%}ebx, %1\n\t" \
+ "cpuid\n\t" \
+ "xchg{l}\t{%%}ebx, %1\n\t" \
+ : "=a" (a), "=r" (b), "=c" (c), "=d" (d) \
+ : "0" (level))
+
+#define __cpuid_count(level, count, a, b, c, d) \
+ __asm__ ("xchg{l}\t{%%}ebx, %1\n\t" \
+ "cpuid\n\t" \
+ "xchg{l}\t{%%}ebx, %1\n\t" \
+ : "=a" (a), "=r" (b), "=c" (c), "=d" (d) \
+ : "0" (level), "2" (count))
+#else
+/* Host GCCs older than 3.0 weren't supporting Intel asm syntax
+ nor alternatives in i386 code. */
+#define __cpuid(level, a, b, c, d) \
+ __asm__ ("xchgl\t%%ebx, %1\n\t" \
+ "cpuid\n\t" \
+ "xchgl\t%%ebx, %1\n\t" \
+ : "=a" (a), "=r" (b), "=c" (c), "=d" (d) \
+ : "0" (level))
+
+#define __cpuid_count(level, count, a, b, c, d) \
+ __asm__ ("xchgl\t%%ebx, %1\n\t" \
+ "cpuid\n\t" \
+ "xchgl\t%%ebx, %1\n\t" \
+ : "=a" (a), "=r" (b), "=c" (c), "=d" (d) \
+ : "0" (level), "2" (count))
+#endif
+#else
+#define __cpuid(level, a, b, c, d) \
+ __asm__ ("cpuid\n\t" \
+ : "=a" (a), "=b" (b), "=c" (c), "=d" (d) \
+ : "0" (level))
+
+#define __cpuid_count(level, count, a, b, c, d) \
+ __asm__ ("cpuid\n\t" \
+ : "=a" (a), "=b" (b), "=c" (c), "=d" (d) \
+ : "0" (level), "2" (count))
+#endif
+
+/* Return highest supported input value for cpuid instruction. ext can
+ be either 0x0 or 0x8000000 to return highest supported value for
+ basic or extended cpuid information. Function returns 0 if cpuid
+ is not supported or whatever cpuid returns in eax register. If sig
+ pointer is non-null, then first four bytes of the signature
+ (as found in ebx register) are returned in location pointed by sig. */
+
+static __inline unsigned int
+__get_cpuid_max (unsigned int __ext, unsigned int *__sig)
+{
+ unsigned int __eax, __ebx, __ecx, __edx;
+
+#ifndef __x86_64__
+#if __GNUC__ >= 3
+ /* See if we can use cpuid. On AMD64 we always can. */
+ __asm__ ("pushf{l|d}\n\t"
+ "pushf{l|d}\n\t"
+ "pop{l}\t%0\n\t"
+ "mov{l}\t{%0, %1|%1, %0}\n\t"
+ "xor{l}\t{%2, %0|%0, %2}\n\t"
+ "push{l}\t%0\n\t"
+ "popf{l|d}\n\t"
+ "pushf{l|d}\n\t"
+ "pop{l}\t%0\n\t"
+ "popf{l|d}\n\t"
+ : "=&r" (__eax), "=&r" (__ebx)
+ : "i" (0x00200000));
+#else
+/* Host GCCs older than 3.0 weren't supporting Intel asm syntax
+ nor alternatives in i386 code. */
+ __asm__ ("pushfl\n\t"
+ "pushfl\n\t"
+ "popl\t%0\n\t"
+ "movl\t%0, %1\n\t"
+ "xorl\t%2, %0\n\t"
+ "pushl\t%0\n\t"
+ "popfl\n\t"
+ "pushfl\n\t"
+ "popl\t%0\n\t"
+ "popfl\n\t"
+ : "=&r" (__eax), "=&r" (__ebx)
+ : "i" (0x00200000));
+#endif
+
+ if (!((__eax ^ __ebx) & 0x00200000))
+ return 0;
+#endif
+
+ /* Host supports cpuid. Return highest supported cpuid input value. */
+ __cpuid (__ext, __eax, __ebx, __ecx, __edx);
+
+ if (__sig)
+ *__sig = __ebx;
+
+ return __eax;
+}
+
+/* Return cpuid data for requested cpuid level, as found in returned
+ eax, ebx, ecx and edx registers. The function checks if cpuid is
+ supported and returns 1 for valid cpuid information or 0 for
+ unsupported cpuid level. All pointers are required to be non-null. */
+
+static __inline int
+__get_cpuid (unsigned int __level,
+ unsigned int *__eax, unsigned int *__ebx,
+ unsigned int *__ecx, unsigned int *__edx)
+{
+ unsigned int __ext = __level & 0x80000000;
+
+ if (__get_cpuid_max (__ext, 0) < __level)
+ return 0;
+
+ __cpuid (__level, *__eax, *__ebx, *__ecx, *__edx);
+ return 1;
+}
diff --git a/gnuradio-core/src/lib/filter/generate_all.py b/gnuradio-core/src/lib/filter/generate_all.py
new file mode 100755
index 000000000..1da9f7209
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/generate_all.py
@@ -0,0 +1,48 @@
+#!/usr/bin/env python
+#
+# Copyright 2003 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_gr_fir_filter_XXX
+import generate_gr_interp_fir_filter_XXX
+import generate_gr_rational_resampler_base_XXX
+import generate_gr_freq_xlating_fir_filter_XXX
+import generate_gr_fir_sysconfig_generic
+import generate_gr_fir_sysconfig
+import generate_gr_fir_util
+import generate_gr_fir_XXX
+import generate_gri_fir_filter_with_buffer_XXX
+
+def generate_all():
+ generate_gr_fir_XXX.generate()
+ generate_gr_fir_filter_XXX.generate()
+ generate_gr_interp_fir_filter_XXX.generate()
+ generate_gr_rational_resampler_base_XXX.generate()
+ generate_gr_freq_xlating_fir_filter_XXX.generate()
+ generate_gr_fir_sysconfig_generic.generate()
+ generate_gr_fir_sysconfig.generate()
+ generate_gr_fir_util.generate()
+ generate_gri_fir_filter_with_buffer_XXX.generate()
+ output_glue('filter')
+
+if __name__ == '__main__':
+ generate_all()
diff --git a/gnuradio-core/src/lib/filter/generate_gr_fir_XXX.py b/gnuradio-core/src/lib/filter/generate_gr_fir_XXX.py
new file mode 100755
index 000000000..cf37fbb24
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/generate_gr_fir_XXX.py
@@ -0,0 +1,75 @@
+#!/bin/env python
+# -*- python -*-
+#
+# Copyright 2003 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.
+#
+
+import re
+from generate_utils import *
+
+roots = ['gr_fir_XXX', 'gr_fir_XXX_generic']
+
+
+# figure out accumulator type. Use biggest of input, output and tap type
+
+def code3_to_acc_code (code3):
+ if i_code (code3) == 'c' or o_code (code3) == 'c' or tap_code (code3) == 'c':
+ return 'c'
+ if i_code (code3) == 'f' or o_code (code3) == 'f' or tap_code (code3) == 'f':
+ return 'f'
+ if i_code (code3) == 'i' or o_code (code3) == 'i' or tap_code (code3) == 'i':
+ return 'i'
+ return 'i' # even short short short needs int accumulator
+
+
+def code3_to_input_cast (code3):
+ if i_code (code3) == 's' and o_code (code3) == 'c':
+ return '(float)'
+ return ''
+
+def expand_h_cc (root, code3):
+ d = init_dict (root, code3)
+ expand_template (d, root + '.h.t')
+ expand_template (d, root + '.cc.t')
+
+def init_dict (root, code3):
+ name = re.sub ('X+', code3, root)
+ d = standard_dict (name, code3)
+ d['FIR_TYPE'] = 'gr_fir_' + code3
+ d['INPUT_CAST'] = code3_to_input_cast (code3)
+ acc_code = code3_to_acc_code (code3)
+ d['ACC_TYPE'] = char_to_type[acc_code]
+ if acc_code == 'c':
+ d['N_UNROLL'] = '2'
+ d['VRCOMPLEX_INCLUDE'] = '#include <gr_types.h>'
+ else:
+ d['N_UNROLL'] = '4'
+ d['VRCOMPLEX_INCLUDE'] = ''
+ return d
+
+
+def generate ():
+ for r in roots:
+ for s in fir_signatures:
+ expand_h_cc (r, s)
+
+
+if __name__ == '__main__':
+ generate ()
diff --git a/gnuradio-core/src/lib/filter/generate_gr_fir_filter_XXX.py b/gnuradio-core/src/lib/filter/generate_gr_fir_filter_XXX.py
new file mode 100755
index 000000000..50cc586e5
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/generate_gr_fir_filter_XXX.py
@@ -0,0 +1,49 @@
+#!/bin/env python
+# -*- python -*-
+#
+# Copyright 2003,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.
+#
+
+import re
+from generate_utils import *
+
+roots = ['gr_fir_filter_XXX']
+
+
+def expand_h_cc_i (root, code3):
+ d = init_dict (root, code3)
+ expand_template (d, root + '.h.t')
+ expand_template (d, root + '.cc.t')
+ expand_template (d, root + '.i.t')
+
+def init_dict (root, code3):
+ name = re.sub ('X+', code3, root)
+ d = standard_dict (name, code3)
+ d['FIR_TYPE'] = 'gr_fir_' + code3
+ return d
+
+def generate ():
+ for r in roots:
+ for s in fir_signatures:
+ expand_h_cc_i (r, s)
+
+if __name__ == '__main__':
+ generate ()
+
diff --git a/gnuradio-core/src/lib/filter/generate_gr_fir_sysconfig.py b/gnuradio-core/src/lib/filter/generate_gr_fir_sysconfig.py
new file mode 100755
index 000000000..50d819fd1
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/generate_gr_fir_sysconfig.py
@@ -0,0 +1,133 @@
+#!/bin/env python
+# -*- python -*-
+#
+# Copyright 2003,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 generate_utils import *
+
+
+# ----------------------------------------------------------------
+
+def make_gr_fir_sysconfig_h ():
+ out = open_and_log_name ('gr_fir_sysconfig.h', 'w')
+ if not out:
+ return
+
+ out.write (copyright)
+
+ out.write (
+'''
+/*
+ * WARNING: This file is automatically generated by generate_gr_fir_sysconfig.py
+ * Any changes made to this file will be overwritten.
+ */
+
+#ifndef INCLUDED_GR_FIR_SYSCONFIG_H
+#define INCLUDED_GR_FIR_SYSCONFIG_H
+
+#include <gr_types.h>
+
+''')
+
+ # for sig in fir_signatures:
+ # out.write ('class gr_fir_' + sig + ';\n')
+
+ out.write ('#include <gr_fir_util.h>\n')
+
+ out.write (
+'''
+/*!
+ * \\brief abstract base class for configuring the automatic selection of the
+ * fastest gr_fir for your platform.
+ *
+ * This is used internally by gr_fir_util.
+ */
+
+class gr_fir_sysconfig {
+public:
+ virtual ~gr_fir_sysconfig ();
+
+''')
+
+ for sig in fir_signatures:
+ out.write ((' virtual gr_fir_%s *create_gr_fir_%s (const std::vector<%s> &taps) = 0;\n' %
+ (sig, sig, tap_type (sig))))
+
+ out.write ('\n')
+
+ for sig in fir_signatures:
+ out.write ((' virtual void get_gr_fir_%s_info (std::vector<gr_fir_%s_info> *info) = 0;\n' %
+ (sig, sig)))
+
+ out.write (
+'''
+};
+
+/*
+ * This returns the single instance of the appropriate derived class.
+ * This function must be defined only once in the system, and should be defined
+ * in the platform specific code.
+ */
+
+gr_fir_sysconfig *gr_fir_sysconfig_singleton ();
+
+
+#endif /* INCLUDED_GR_FIR_SYSCONFIG_H */
+''')
+ out.close ()
+
+
+# ----------------------------------------------------------------
+
+def make_gr_fir_sysconfig_cc ():
+ out = open_and_log_name ('gr_fir_sysconfig.cc', 'w')
+ if not out:
+ return
+
+ out.write (copyright)
+
+ out.write (
+'''
+/*
+ * WARNING: This file is automatically generated by generate_gr_fir_sysconfig.py
+ * Any changes made to this file will be overwritten.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <gr_fir_sysconfig.h>
+
+gr_fir_sysconfig::~gr_fir_sysconfig ()
+{
+}
+''')
+ out.close ()
+
+
+# ----------------------------------------------------------------
+
+def generate ():
+ make_gr_fir_sysconfig_h ()
+ make_gr_fir_sysconfig_cc ()
+
+if __name__ == '__main__':
+ generate ()
diff --git a/gnuradio-core/src/lib/filter/generate_gr_fir_sysconfig_generic.py b/gnuradio-core/src/lib/filter/generate_gr_fir_sysconfig_generic.py
new file mode 100755
index 000000000..dcbadd30f
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/generate_gr_fir_sysconfig_generic.py
@@ -0,0 +1,186 @@
+#!/bin/env python
+# -*- python -*-
+#
+# Copyright 2003,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 generate_utils import *
+
+
+# ----------------------------------------------------------------
+
+def make_gr_fir_sysconfig_generic_h ():
+ out = open_and_log_name ('gr_fir_sysconfig_generic.h', 'w')
+ if not out:
+ return
+ out.write (copyright)
+
+ out.write (
+'''
+/*
+ * WARNING: This file is automatically generated by
+ * generate_gr_fir_sysconfig_generic.py.
+ *
+ * Any changes made to this file will be overwritten.
+ */
+
+#ifndef _GR_FIR_SYSCONFIG_GENERIC_H_
+#define _GR_FIR_SYSCONFIG_GENERIC_H_
+
+#include <gr_fir_sysconfig.h>
+
+''')
+
+ out.write (
+'''
+class gr_fir_sysconfig_generic : public gr_fir_sysconfig {
+public:
+''')
+
+ for sig in fir_signatures:
+ out.write ((' virtual gr_fir_%s *create_gr_fir_%s (const std::vector<%s> &taps);\n' %
+ (sig, sig, tap_type (sig))))
+
+ out.write ('\n')
+
+ for sig in fir_signatures:
+ out.write ((' virtual void get_gr_fir_%s_info (std::vector<gr_fir_%s_info> *info);\n' %
+ (sig, sig)))
+
+ out.write (
+'''
+};
+
+
+#endif /* _GR_FIR_SYSCONFIG_GENERIC_H_ */
+''')
+ out.close ()
+
+
+# ----------------------------------------------------------------
+
+def make_constructor (sig, out):
+ out.write ('''
+static gr_fir_%s *
+make_gr_fir_%s (const std::vector<%s> &taps)
+{
+ return new gr_fir_%s_generic (taps);
+}
+''' % (sig, sig, tap_type (sig), sig))
+
+
+def make_creator (sig, out):
+ out.write ('''
+gr_fir_%s *
+gr_fir_sysconfig_generic::create_gr_fir_%s (const std::vector<%s> &taps)
+{
+ return make_gr_fir_%s (taps);
+}
+''' % (sig, sig, tap_type (sig), sig))
+
+
+def make_info (sig, out):
+ out.write ('''
+void
+gr_fir_sysconfig_generic::get_gr_fir_%s_info (std::vector<gr_fir_%s_info> *info)
+{
+ info->resize (1);
+ (*info)[0].name = "generic";
+ (*info)[0].create = make_gr_fir_%s;
+}
+''' % (sig, sig, sig))
+
+
+# ----------------------------------------------------------------
+
+def make_gr_fir_sysconfig_generic_cc ():
+ out = open_and_log_name ('gr_fir_sysconfig_generic.cc', 'w')
+ if not out:
+ return
+ out.write (copyright)
+
+ out.write (
+'''
+/*
+ * WARNING: This file is automatically generated by
+ * generate_gr_fir_sysconfig_generic.py.
+ *
+ * Any changes made to this file will be overwritten.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <gr_fir_sysconfig_generic.h>
+
+''')
+
+ for sig in fir_signatures:
+ out.write ('#include <gr_fir_%s_generic.h>\n' % (sig))
+
+ out.write (
+'''
+/*
+ * ----------------------------------------------------------------
+ * static functions that serve as constructors returned by info
+ * ----------------------------------------------------------------
+ */
+''')
+
+ for sig in fir_signatures:
+ make_constructor (sig, out)
+
+ out.write (
+'''
+/*
+ * ----------------------------------------------------------------
+ * return instances of the generic C++ versions of these classes.
+ * ----------------------------------------------------------------
+ */
+''')
+
+ for sig in fir_signatures:
+ make_creator (sig, out)
+
+ out.write (
+'''
+/*
+ * Return info about available implementations.
+ *
+ * This is the bottom of the concrete hierarchy, so we set the
+ * size of the vector to 1, and install our info. Classes derived
+ * from us invoke us first, then append their own info.
+ */
+''')
+
+ for sig in fir_signatures:
+ make_info (sig, out)
+
+
+ out.close ()
+
+# ----------------------------------------------------------------
+
+def generate ():
+ make_gr_fir_sysconfig_generic_h ()
+ make_gr_fir_sysconfig_generic_cc ()
+
+if __name__ == '__main__':
+ generate ()
diff --git a/gnuradio-core/src/lib/filter/generate_gr_fir_util.py b/gnuradio-core/src/lib/filter/generate_gr_fir_util.py
new file mode 100755
index 000000000..79fa51c27
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/generate_gr_fir_util.py
@@ -0,0 +1,190 @@
+#!/bin/env python
+#
+# Copyright 2003,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 generate_utils import *
+
+def make_info_struct (out, sig):
+ out.write (
+'''
+struct GR_CORE_API gr_fir_%s_info {
+ const char *name; // implementation name, e.g., "generic", "SSE", "3DNow!"
+ gr_fir_%s *(*create)(const std::vector<%s> &taps);
+};
+''' % (sig, sig, tap_type(sig)))
+
+def make_create (out, sig):
+ out.write (''' static gr_fir_%s *create_gr_fir_%s (const std::vector<%s> &taps);
+''' % (sig, sig, tap_type (sig)))
+
+def make_info (out, sig):
+ out.write (''' static void get_gr_fir_%s_info (std::vector<gr_fir_%s_info> *info);
+''' % (sig, sig))
+
+
+# ----------------------------------------------------------------
+
+def make_gr_fir_util_h ():
+ out = open_and_log_name ('gr_fir_util.h', 'w')
+ if not out:
+ return
+ out.write (copyright)
+
+ out.write (
+'''
+/*
+ * WARNING: This file is automatically generated by
+ * generate_gr_fir_util.py.
+ *
+ * Any changes made to this file will be overwritten.
+ */
+
+#ifndef INCLUDED_GR_FIR_UTIL_H
+#define INCLUDED_GR_FIR_UTIL_H
+
+/*!
+ * \\brief routines to create gr_fir_XXX's
+ *
+ * This class handles selecting the fastest version of the finite
+ * implulse response filter available for your platform. This
+ * interface should be used by the rest of the system for creating
+ * gr_fir_XXX's.
+ *
+ * The trailing suffix has the form _IOT where I codes the input type,
+ * O codes the output type, and T codes the tap type.
+ * I,O,T are elements of the set 's' (short), 'f' (float), 'c' (gr_complex),
+ * 'i' (short)
+ */
+
+#include <gr_core_api.h>
+#include <gr_types.h>
+
+''')
+
+ for sig in fir_signatures:
+ out.write ('class gr_fir_%s;\n' % sig);
+
+ out.write ('\n// structures returned by get_gr_fir_XXX_info methods\n\n')
+
+ for sig in fir_signatures:
+ make_info_struct (out, sig)
+
+ out.write ('''
+struct GR_CORE_API gr_fir_util {
+
+ // create a fast version of gr_fir_XXX.
+
+''')
+
+ for sig in fir_signatures:
+ make_create (out, sig)
+
+ out.write ('''
+ // Get information about all gr_fir_XXX implementations.
+ // This is useful for benchmarking, testing, etc without having to
+ // know a priori what's linked into this image
+ //
+ // The caller must pass in a valid pointer to a vector.
+ // The vector will be filled with structs describing the
+ // available implementations.
+
+''')
+
+ for sig in fir_signatures:
+ make_info (out, sig)
+
+ out.write ('''
+};
+
+#endif /* INCLUDED_GR_FIR_UTIL_H */
+''')
+ out.close ()
+
+
+# ----------------------------------------------------------------
+
+def make_constructor_cc (out, sig):
+ out.write (
+'''
+gr_fir_%s *
+gr_fir_util::create_gr_fir_%s (const std::vector<%s> &taps)
+{
+ return gr_fir_sysconfig_singleton()->create_gr_fir_%s (taps);
+}
+''' % (sig, sig, tap_type (sig), sig))
+
+
+def make_info_cc (out, sig):
+ out.write (
+'''
+void
+gr_fir_util::get_gr_fir_%s_info (std::vector<gr_fir_%s_info> *info)
+{
+ gr_fir_sysconfig_singleton()->get_gr_fir_%s_info (info);
+}
+''' % (sig, sig, sig))
+
+
+def make_gr_fir_util_cc ():
+ out = open_and_log_name ('gr_fir_util.cc', 'w')
+ if not out:
+ return
+ out.write (copyright)
+ out.write ('''
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <gr_fir_util.h>
+#include <gr_fir_sysconfig.h>
+
+//
+// There's no problem that can't be solved by the addition of
+// another layer of indirection...
+//
+
+// --- constructors ---
+
+''')
+
+ for sig in fir_signatures:
+ make_constructor_cc (out, sig)
+
+ out.write ('''
+// --- info gatherers ---
+
+''')
+
+ for sig in fir_signatures:
+ make_info_cc (out, sig)
+
+ out.close ()
+
+
+# ----------------------------------------------------------------
+
+def generate ():
+ make_gr_fir_util_h ()
+ make_gr_fir_util_cc ()
+
+if __name__ == '__main__':
+ generate ()
+
diff --git a/gnuradio-core/src/lib/filter/generate_gr_freq_xlating_fir_filter_XXX.py b/gnuradio-core/src/lib/filter/generate_gr_freq_xlating_fir_filter_XXX.py
new file mode 100755
index 000000000..41c0b2b70
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/generate_gr_freq_xlating_fir_filter_XXX.py
@@ -0,0 +1,53 @@
+#!/bin/env python
+# -*- python -*-
+#
+# Copyright 2003,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.
+#
+
+import re
+from generate_utils import *
+
+# files to generate
+
+fx_signatures = [ 'scf', 'scc', 'fcf', 'fcc', 'ccf', 'ccc' ]
+
+roots = ['gr_freq_xlating_fir_filter_XXX']
+
+def expand_h_cc_i (root, code3):
+ d = init_dict (root, code3)
+ expand_template (d, root + '.h.t')
+ expand_template (d, root + '.cc.t')
+ expand_template (d, root + '.i.t')
+
+def init_dict (root, code3):
+ name = re.sub ('X+', code3, root)
+ d = standard_dict (name, code3)
+ d['FIR_TYPE'] = 'gr_fir_' + i_code (code3) + 'cc'
+ return d
+
+
+def generate ():
+ for r in roots:
+ for s in fx_signatures:
+ expand_h_cc_i (r, s)
+
+
+if __name__ == '__main__':
+ generate ()
diff --git a/gnuradio-core/src/lib/filter/generate_gr_interp_fir_filter_XXX.py b/gnuradio-core/src/lib/filter/generate_gr_interp_fir_filter_XXX.py
new file mode 100644
index 000000000..1dcfdaded
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/generate_gr_interp_fir_filter_XXX.py
@@ -0,0 +1,48 @@
+#!/bin/env python
+# -*- python -*-
+#
+# Copyright 2003,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.
+#
+
+import re
+from generate_utils import *
+
+roots = ['gr_interp_fir_filter_XXX']
+
+def expand_h_cc_i (root, code3):
+ d = init_dict (root, code3)
+ expand_template (d, root + '.h.t')
+ expand_template (d, root + '.cc.t')
+ expand_template (d, root + '.i.t')
+
+def init_dict (root, code3):
+ name = re.sub ('X+', code3, root)
+ d = standard_dict (name, code3)
+ d['FIR_TYPE'] = 'gr_fir_' + code3
+ return d
+
+def generate ():
+ for r in roots:
+ for s in fir_signatures:
+ expand_h_cc_i (r, s)
+
+if __name__ == '__main__':
+ generate ()
+
diff --git a/gnuradio-core/src/lib/filter/generate_gr_rational_resampler_base_XXX.py b/gnuradio-core/src/lib/filter/generate_gr_rational_resampler_base_XXX.py
new file mode 100644
index 000000000..1dafec3fb
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/generate_gr_rational_resampler_base_XXX.py
@@ -0,0 +1,48 @@
+#!/bin/env python
+# -*- python -*-
+#
+# Copyright 2003,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.
+#
+
+import re
+from generate_utils import *
+
+roots = ['gr_rational_resampler_base_XXX']
+
+def expand_h_cc_i (root, code3):
+ d = init_dict (root, code3)
+ expand_template (d, root + '.h.t')
+ expand_template (d, root + '.cc.t')
+ expand_template (d, root + '.i.t')
+
+def init_dict (root, code3):
+ name = re.sub ('X+', code3, root)
+ d = standard_dict (name, code3)
+ d['FIR_TYPE'] = 'gr_fir_' + code3
+ return d
+
+def generate ():
+ for r in roots:
+ for s in fir_signatures:
+ expand_h_cc_i (r, s)
+
+if __name__ == '__main__':
+ generate ()
+
diff --git a/gnuradio-core/src/lib/filter/generate_gri_fir_filter_with_buffer_XXX.py b/gnuradio-core/src/lib/filter/generate_gri_fir_filter_with_buffer_XXX.py
new file mode 100755
index 000000000..6442fb3dc
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/generate_gri_fir_filter_with_buffer_XXX.py
@@ -0,0 +1,64 @@
+#!/usr/bin/env python
+# -*- python -*-
+#
+# Copyright 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.
+#
+
+import re
+from generate_utils import *
+
+roots = ['gri_fir_filter_with_buffer_XXX',]
+
+def code3_to_acc_code (code3):
+ if i_code (code3) == 'c' or o_code (code3) == 'c' or tap_code (code3) == 'c':
+ return 'c'
+ if i_code (code3) == 'f' or o_code (code3) == 'f' or tap_code (code3) == 'f':
+ return 'f'
+ if i_code (code3) == 'i' or o_code (code3) == 'i' or tap_code (code3) == 'i':
+ return 'i'
+ return 'i' # even short short short needs int accumulator
+
+def code3_to_input_cast (code3):
+ if i_code (code3) == 's' and o_code (code3) == 'c':
+ return '(float)'
+ return ''
+
+def expand_h_cc (root, code3):
+ d = init_dict (root, code3)
+ expand_template (d, root + '.h.t')
+ expand_template (d, root + '.cc.t')
+
+def init_dict (root, code3):
+ name = re.sub ('X+', code3, root)
+ d = standard_dict (name, code3)
+ d['INPUT_CAST'] = code3_to_input_cast (code3)
+ acc_code = code3_to_acc_code (code3)
+ d['ACC_TYPE'] = char_to_type[acc_code]
+ return d
+
+
+def generate ():
+ for r in roots:
+ for s in fir_signatures:
+ expand_h_cc (r, s)
+
+
+if __name__ == '__main__':
+ generate ()
diff --git a/gnuradio-core/src/lib/filter/generate_utils.py b/gnuradio-core/src/lib/filter/generate_utils.py
new file mode 100644
index 000000000..212ea95f9
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/generate_utils.py
@@ -0,0 +1,31 @@
+#
+# Copyright 2003,2005 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.
+#
+
+## -----------------------------------------------------------------------
+## signatures defines which variations to generate (input, output, taps)
+
+fir_signatures = [ 'ccf', 'fcc', 'ccc', 'fff', 'scc', 'fsf' ]
+
+
+## -----------------------------------------------------------------------
+
+from build_utils import expand_template, copyright, open_and_log_name, standard_dict
+from build_utils_codes import *
diff --git a/gnuradio-core/src/lib/filter/gr_adaptive_fir_ccc.cc b/gnuradio-core/src/lib/filter/gr_adaptive_fir_ccc.cc
new file mode 100644
index 000000000..da407caa0
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_adaptive_fir_ccc.cc
@@ -0,0 +1,88 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_adaptive_fir_ccc.h>
+#include <gr_io_signature.h>
+
+gr_adaptive_fir_ccc::gr_adaptive_fir_ccc(const char *name, int decimation,
+ const std::vector<gr_complex> &taps)
+ : gr_sync_decimator (name,
+ gr_make_io_signature (1, 1, sizeof(gr_complex)),
+ gr_make_io_signature (1, 1, sizeof(gr_complex)),
+ decimation),
+ d_updated(false), d_taps(taps)
+{
+ set_history(d_taps.size());
+}
+
+void
+gr_adaptive_fir_ccc::set_taps(const std::vector<gr_complex> &taps)
+{
+ d_new_taps = taps;
+ d_updated = true;
+}
+
+gr_complex
+gr_adaptive_fir_ccc::filter(gr_complex *x)
+{
+ // Generic dot product of d_taps[] and in[]
+ gr_complex acc(0.0, 0.0);
+ int l = d_taps.size();
+ for (int k = 0; k < l; k++)
+ acc += d_taps[l-k-1] * x[k];
+ return acc;
+}
+
+int
+gr_adaptive_fir_ccc::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ gr_complex *in = (gr_complex *)input_items[0];
+ gr_complex *out = (gr_complex *)output_items[0];
+
+ if (d_updated) {
+ d_taps = d_new_taps;
+ set_history(d_taps.size());
+ d_updated = false;
+ return 0; // history requirements may have changed.
+ }
+
+ int j = 0, k, l = d_taps.size();
+ for (int i = 0; i < noutput_items; i++) {
+ out[i] = filter(&in[j]);
+
+ // Adjust taps
+ d_error = error(out[i]);
+ for (k = 0; k < l; k++) {
+ update_tap(d_taps[l-k-1], in[j+k]);
+ }
+
+ j += decimation();
+ }
+
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/filter/gr_adaptive_fir_ccc.h b/gnuradio-core/src/lib/filter/gr_adaptive_fir_ccc.h
new file mode 100644
index 000000000..d144c3eb4
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_adaptive_fir_ccc.h
@@ -0,0 +1,62 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+#ifndef INCLUDED_GR_ADAPTIVE_FIR_CCC_H
+#define INCLUDED_GR_ADAPTIVE_FIR_CCC_H
+
+#include <gr_core_api.h>
+#include <gr_sync_decimator.h>
+
+/*!
+ * \brief Adaptive FIR filter with gr_complex input, gr_complex output and float taps
+ * \ingroup filter_blk
+ */
+class GR_CORE_API gr_adaptive_fir_ccc : public gr_sync_decimator
+{
+private:
+ std::vector<gr_complex> d_new_taps;
+ bool d_updated;
+
+protected:
+ gr_complex d_error;
+ std::vector<gr_complex> d_taps;
+
+ // Override to calculate error signal per output
+ virtual gr_complex error(const gr_complex &out) = 0;
+
+ // Override to calculate new weight from old, corresponding input
+ virtual void update_tap(gr_complex &tap, const gr_complex &in) = 0;
+
+ gr_complex filter(gr_complex *x);
+
+ gr_adaptive_fir_ccc(const char *name, int decimation,
+ const std::vector<gr_complex> &taps);
+
+public:
+ void set_taps(const std::vector<gr_complex> &taps);
+
+ 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/filter/gr_adaptive_fir_ccc.i b/gnuradio-core/src/lib/filter/gr_adaptive_fir_ccc.i
new file mode 100644
index 000000000..a3c875a3d
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_adaptive_fir_ccc.i
@@ -0,0 +1,31 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+class gr_adaptive_fir_ccc : public gr_sync_decimator
+{
+protected:
+ gr_adaptive_fir_ccc(char *name, int decimation,
+ const std::vector<gr_complex> &taps);
+
+public:
+ void set_taps(const std::vector<gr_complex> &taps);
+};
diff --git a/gnuradio-core/src/lib/filter/gr_adaptive_fir_ccf.cc b/gnuradio-core/src/lib/filter/gr_adaptive_fir_ccf.cc
new file mode 100644
index 000000000..045d9faf9
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_adaptive_fir_ccf.cc
@@ -0,0 +1,81 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_adaptive_fir_ccf.h>
+#include <gr_io_signature.h>
+
+gr_adaptive_fir_ccf::gr_adaptive_fir_ccf(const char *name, int decimation, const std::vector<float> &taps)
+ : gr_sync_decimator (name,
+ gr_make_io_signature (1, 1, sizeof(gr_complex)),
+ gr_make_io_signature (1, 1, sizeof(gr_complex)),
+ decimation),
+ d_updated(false)
+{
+ d_taps = taps;
+ set_history(d_taps.size());
+}
+
+void gr_adaptive_fir_ccf::set_taps(const std::vector<float> &taps)
+{
+ d_new_taps = taps;
+ d_updated = true;
+}
+
+int gr_adaptive_fir_ccf::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ gr_complex *in = (gr_complex *)input_items[0];
+ gr_complex *out = (gr_complex *)output_items[0];
+
+ if (d_updated) {
+ d_taps = d_new_taps;
+ set_history(d_taps.size());
+ d_updated = false;
+ return 0; // history requirements may have changed.
+ }
+
+ int j = 0, k, l = d_taps.size();
+ for (int i = 0; i < noutput_items; i++) {
+ // Generic dot product of d_taps[] and in[]
+ gr_complex sum(0.0, 0.0);
+ for (k = 0; k < l; k++)
+ sum += d_taps[l-k-1]*in[j+k];
+ out[i] = sum;
+
+ // Adjust taps
+ d_error = error(sum);
+ for (k = 0; k < l; k++) {
+ //printf("%f ", d_taps[k]);
+ update_tap(d_taps[l-k-1], in[j+k]);
+ }
+ //printf("\n");
+
+ j += decimation();
+ }
+
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/filter/gr_adaptive_fir_ccf.h b/gnuradio-core/src/lib/filter/gr_adaptive_fir_ccf.h
new file mode 100644
index 000000000..7ec78099f
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_adaptive_fir_ccf.h
@@ -0,0 +1,59 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_GR_ADAPTIVE_FIR_CCF_H
+#define INCLUDED_GR_ADAPTIVE_FIR_CCF_H
+
+#include <gr_core_api.h>
+#include <gr_sync_decimator.h>
+
+/*!
+ * \brief Adaptive FIR filter with gr_complex input, gr_complex output and float taps
+ * \ingroup filter_blk
+ */
+class GR_CORE_API gr_adaptive_fir_ccf : public gr_sync_decimator
+{
+private:
+ std::vector<float> d_new_taps;
+ bool d_updated;
+
+protected:
+ float d_error;
+ std::vector<float> d_taps;
+
+ // Override to calculate error signal per output
+ virtual float error(const gr_complex &out) = 0;
+
+ // Override to calculate new weight from old, corresponding input
+ virtual void update_tap(float &tap, const gr_complex &in) = 0;
+
+ gr_adaptive_fir_ccf(const char *name, int decimation, const std::vector<float> &taps);
+
+public:
+ void set_taps(const std::vector<float> &taps);
+
+ 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/filter/gr_adaptive_fir_ccf.i b/gnuradio-core/src/lib/filter/gr_adaptive_fir_ccf.i
new file mode 100644
index 000000000..346defd4d
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_adaptive_fir_ccf.i
@@ -0,0 +1,30 @@
+/* -*- 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.
+ */
+
+class gr_adaptive_fir_ccf : public gr_sync_decimator
+{
+protected:
+ gr_adaptive_fir_ccf(char *name, int decimation, const std::vector<float> &taps);
+
+public:
+ void set_taps(const std::vector<float> &taps);
+};
diff --git a/gnuradio-core/src/lib/filter/gr_altivec.c b/gnuradio-core/src/lib/filter/gr_altivec.c
new file mode 100644
index 000000000..22a67291d
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_altivec.c
@@ -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 this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <gr_altivec.h>
+
+void
+gr_print_vector_float(FILE *fp, vec_float4 v)
+{
+ union v_float_u u;
+ u.v = v;
+ fprintf(fp, "{ %f, %f, %f, %f }", u.f[0], u.f[1], u.f[2], u.f[3]);
+}
+
+void
+gr_pvf(FILE *fp, const char *label, vec_float4 v)
+{
+ fprintf(fp, "%s = ", label);
+ gr_print_vector_float(fp, v);
+ putc('\n', fp);
+}
diff --git a/gnuradio-core/src/lib/filter/gr_altivec.h b/gnuradio-core/src/lib/filter/gr_altivec.h
new file mode 100644
index 000000000..ed11490f5
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_altivec.h
@@ -0,0 +1,76 @@
+/* -*- 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 this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+#ifndef INCLUDED_GR_ALTIVEC_H
+#define INCLUDED_GR_ALTIVEC_H
+
+/*
+ * N.B., always use "vec_float4" et al. instead of "vector float" to
+ * ensure portability across the various powerpc compilers. Some of
+ * them treat "vector" as a context specific keyword, some don't.
+ * Avoid the problem by always using the defines in vec_types.h
+ * (included below)
+ */
+
+#include <gr_core_api.h>
+#include <altivec.h>
+#undef bool // repair namespace pollution
+#undef vector // repair namespace pollution
+
+#ifdef HAVE_VEC_TYPES_H
+#include <vec_types.h> // use system version if we've got it
+#else
+#include <gr_vec_types.h> // fall back to our local copy
+#endif
+#undef qword // repair namespace pollution
+
+#include <stddef.h>
+#include <stdio.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define VS sizeof(vec_float4)
+#define FLOATS_PER_VEC (sizeof(vec_float4)/sizeof(float))
+
+union v_float_u {
+ vec_float4 v;
+ float f[FLOATS_PER_VEC];
+};
+
+GR_CORE_API void gr_print_vector_float(FILE *fp, vec_float4 v);
+GR_CORE_API void gr_pvf(FILE *fp, const char *label, vec_float4 v);
+
+static inline float
+horizontal_add_f(vec_float4 v)
+{
+ union v_float_u u;
+ vec_float4 t0 = vec_add(v, vec_sld(v, v, 8));
+ vec_float4 t1 = vec_add(t0, vec_sld(t0, t0, 4));
+ u.v = t1;
+ return u.f[0];
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* INCLUDED_GR_ALTIVEC_H */
diff --git a/gnuradio-core/src/lib/filter/gr_cpu.h b/gnuradio-core/src/lib/filter/gr_cpu.h
new file mode 100644
index 000000000..35824ac1e
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_cpu.h
@@ -0,0 +1,42 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002,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.
+ */
+
+#ifndef _GR_CPU_H_
+#define _GR_CPU_H_
+
+#include <gr_core_api.h>
+
+struct GR_CORE_API gr_cpu {
+ static bool has_mmx ();
+ static bool has_sse ();
+ static bool has_sse2 ();
+ static bool has_sse3 ();
+ static bool has_ssse3 ();
+ static bool has_sse4_1 ();
+ static bool has_sse4_2 ();
+ static bool has_3dnow ();
+ static bool has_3dnowext ();
+ static bool has_altivec ();
+ static bool has_armv7_a ();
+};
+
+#endif /* _GR_CPU_H_ */ \ No newline at end of file
diff --git a/gnuradio-core/src/lib/filter/gr_cpu_armv7_a.cc b/gnuradio-core/src/lib/filter/gr_cpu_armv7_a.cc
new file mode 100644
index 000000000..245049206
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_cpu_armv7_a.cc
@@ -0,0 +1,65 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002,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.
+ */
+
+#include <gr_cpu.h>
+
+bool
+gr_cpu::has_mmx ()
+{
+ return false;
+}
+
+bool
+gr_cpu::has_sse ()
+{
+ return false;
+}
+
+bool
+gr_cpu::has_sse2 ()
+{
+ return false;
+}
+
+bool
+gr_cpu::has_3dnow ()
+{
+ return false;
+}
+
+bool
+gr_cpu::has_3dnowext ()
+{
+ return false;
+}
+
+bool
+gr_cpu::has_altivec ()
+{
+ return false;
+}
+
+bool
+gr_cpu::has_armv7_a ()
+{
+ return true;
+}
diff --git a/gnuradio-core/src/lib/filter/gr_cpu_powerpc.cc b/gnuradio-core/src/lib/filter/gr_cpu_powerpc.cc
new file mode 100644
index 000000000..d613f0ae4
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_cpu_powerpc.cc
@@ -0,0 +1,65 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002,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.
+ */
+
+#include <gr_cpu.h>
+
+bool
+gr_cpu::has_mmx ()
+{
+ return false;
+}
+
+bool
+gr_cpu::has_sse ()
+{
+ return false;
+}
+
+bool
+gr_cpu::has_sse2 ()
+{
+ return false;
+}
+
+bool
+gr_cpu::has_3dnow ()
+{
+ return false;
+}
+
+bool
+gr_cpu::has_3dnowext ()
+{
+ return false;
+}
+
+bool
+gr_cpu::has_altivec ()
+{
+ return true; // FIXME assume we've always got it
+}
+
+bool
+gr_cpu::has_armv7_a ()
+{
+ return false;
+}
diff --git a/gnuradio-core/src/lib/filter/gr_cpu_x86.cc b/gnuradio-core/src/lib/filter/gr_cpu_x86.cc
new file mode 100644
index 000000000..3acd694d5
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_cpu_x86.cc
@@ -0,0 +1,119 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002,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_cpu.h>
+#include "gcc_x86_cpuid.h"
+
+/*
+ * execute CPUID instruction, return EAX, EBX, ECX and EDX values in result
+ */
+#define cpuid_x86(op, r) __get_cpuid(op, r+0, r+1, r+2, r+3)
+
+/*
+ * CPUID functions returning a single datum
+ */
+
+static inline unsigned int cpuid_eax(unsigned int op)
+{
+ unsigned int regs[4] = {0,0,0,0};
+ cpuid_x86 (op, regs);
+ return regs[0];
+}
+
+static inline unsigned int cpuid_ebx(unsigned int op)
+{
+ unsigned int regs[4] = {0,0,0,0};
+ cpuid_x86 (op, regs);
+ return regs[1];
+}
+
+static inline unsigned int cpuid_ecx(unsigned int op)
+{
+ unsigned int regs[4] = {0,0,0,0};
+ cpuid_x86 (op, regs);
+ return regs[2];
+}
+
+static inline unsigned int cpuid_edx(unsigned int op)
+{
+ unsigned int regs[4] = {0,0,0,0};
+ cpuid_x86 (op, regs);
+ return regs[3];
+}
+
+// ----------------------------------------------------------------
+
+bool
+gr_cpu::has_mmx ()
+{
+ unsigned int edx = cpuid_edx (1); // standard features
+ return (edx & (1 << 23)) != 0;
+}
+
+bool
+gr_cpu::has_sse ()
+{
+ unsigned int edx = cpuid_edx (1); // standard features
+ return (edx & (1 << 25)) != 0;
+}
+
+bool
+gr_cpu::has_sse2 ()
+{
+ unsigned int edx = cpuid_edx (1); // standard features
+ return (edx & (1 << 26)) != 0;
+}
+
+bool
+gr_cpu::has_3dnow ()
+{
+ unsigned int extended_fct_count = cpuid_eax (0x80000000);
+ if (extended_fct_count < 0x80000001)
+ return false;
+
+ unsigned int extended_features = cpuid_edx (0x80000001);
+ return (extended_features & (1 << 31)) != 0;
+}
+
+bool
+gr_cpu::has_3dnowext ()
+{
+ unsigned int extended_fct_count = cpuid_eax (0x80000000);
+ if (extended_fct_count < 0x80000001)
+ return false;
+
+ unsigned int extended_features = cpuid_edx (0x80000001);
+ return (extended_features & (1 << 30)) != 0;
+}
+
+bool
+gr_cpu::has_altivec ()
+{
+ return false;
+}
+
+bool
+gr_cpu::has_armv7_a ()
+{
+ return false;
+}
+
diff --git a/gnuradio-core/src/lib/filter/gr_dc_blocker_cc.cc b/gnuradio-core/src/lib/filter/gr_dc_blocker_cc.cc
new file mode 100644
index 000000000..0438a193f
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_dc_blocker_cc.cc
@@ -0,0 +1,138 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_dc_blocker_cc.h>
+#include <gr_io_signature.h>
+#include <cstdio>
+
+moving_averager_c::moving_averager_c(int D)
+ : d_length(D), d_out(0), d_out_d1(0), d_out_d2(0)
+{
+ d_delay_line = std::deque<gr_complex>(d_length-1, gr_complex(0,0));
+}
+
+moving_averager_c::~moving_averager_c()
+{
+}
+
+gr_complex
+moving_averager_c::filter(gr_complex x)
+{
+ d_out_d1 = d_out;
+ d_delay_line.push_back(x);
+ d_out = d_delay_line[0];
+ d_delay_line.pop_front();
+
+ gr_complex y = x - d_out_d1 + d_out_d2;
+ d_out_d2 = y;
+
+ return (y / (float)(d_length));
+}
+
+
+
+gr_dc_blocker_cc_sptr gr_make_dc_blocker_cc (int D, bool long_form)
+{
+ return gnuradio::get_initial_sptr(new gr_dc_blocker_cc(D, long_form));
+}
+
+
+gr_dc_blocker_cc::gr_dc_blocker_cc (int D, bool long_form)
+ : gr_sync_block ("dc_blocker_cc",
+ gr_make_io_signature (1, 1, sizeof(gr_complex)),
+ gr_make_io_signature (1, 1, sizeof(gr_complex))),
+ d_length(D), d_long_form(long_form)
+{
+ if(d_long_form) {
+ d_ma_0 = new moving_averager_c(D);
+ d_ma_1 = new moving_averager_c(D);
+ d_ma_2 = new moving_averager_c(D);
+ d_ma_3 = new moving_averager_c(D);
+ d_delay_line = std::deque<gr_complex>(d_length-1, gr_complex(0,0));
+ }
+ else {
+ d_ma_0 = new moving_averager_c(D);
+ d_ma_1 = new moving_averager_c(D);
+ }
+}
+
+gr_dc_blocker_cc::~gr_dc_blocker_cc()
+{
+ if(d_long_form) {
+ delete d_ma_0;
+ delete d_ma_1;
+ delete d_ma_2;
+ delete d_ma_3;
+ }
+ else {
+ delete d_ma_0;
+ delete d_ma_1;
+ }
+}
+
+int
+gr_dc_blocker_cc::get_group_delay()
+{
+ if(d_long_form)
+ return (2*d_length-2);
+ else
+ return d_length - 1;
+}
+
+int
+gr_dc_blocker_cc::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const gr_complex *in = (const gr_complex*)input_items[0];
+ gr_complex *out = (gr_complex*)output_items[0];
+
+ if(d_long_form) {
+ gr_complex y1, y2, y3, y4, d;
+ for(int i = 0; i < noutput_items; i++) {
+ y1 = d_ma_0->filter(in[i]);
+ y2 = d_ma_1->filter(y1);
+ y3 = d_ma_2->filter(y2);
+ y4 = d_ma_3->filter(y3);
+
+ d_delay_line.push_back(d_ma_0->delayed_sig());
+ d = d_delay_line[0];
+ d_delay_line.pop_front();
+
+ out[i] = d - y4;
+ }
+ }
+ else {
+ gr_complex y1, y2;
+ for(int i = 0; i < noutput_items; i++) {
+ y1 = d_ma_0->filter(in[i]);
+ y2 = d_ma_1->filter(y1);
+ out[i] = d_ma_0->delayed_sig() - y2;
+ }
+ }
+
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/filter/gr_dc_blocker_cc.h b/gnuradio-core/src/lib/filter/gr_dc_blocker_cc.h
new file mode 100644
index 000000000..e4d89a775
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_dc_blocker_cc.h
@@ -0,0 +1,111 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+
+#ifndef INCLUDED_GR_DC_BLOCKER_CC_H
+#define INCLUDED_GR_DC_BLOCKER_CC_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+#include <deque>
+
+class GR_CORE_API moving_averager_c
+{
+public:
+ moving_averager_c(int D);
+ ~moving_averager_c();
+
+ gr_complex filter(gr_complex x);
+ gr_complex delayed_sig() { return d_out; }
+
+private:
+ int d_length;
+ gr_complex d_out, d_out_d1, d_out_d2;
+ std::deque<gr_complex> d_delay_line;
+};
+
+class gr_dc_blocker_cc;
+typedef boost::shared_ptr<gr_dc_blocker_cc> gr_dc_blocker_cc_sptr;
+GR_CORE_API gr_dc_blocker_cc_sptr gr_make_dc_blocker_cc (int D=32, bool long_form=true);
+
+/*!
+ * \class gr_dc_blocker_cc
+ * \brief a computationally efficient controllable DC blocker
+ *
+ * \ingroup filter_blk
+ *
+ * This block implements a computationally efficient DC blocker that produces
+ * a tighter notch filter around DC for a smaller group delay than an
+ * equivalent FIR filter or using a single pole IIR filter (though the IIR
+ * filter is computationally cheaper).
+ *
+ * The block defaults to using a delay line of length 32 and the long form
+ * of the filter. Optionally, the delay line length can be changed to alter
+ * the width of the DC notch (longer lines will decrease the width).
+ *
+ * The long form of the filter produces a nearly flat response outside of
+ * the notch but at the cost of a group delay of 2D-2.
+ *
+ * The short form of the filter does not have as flat a response in the
+ * passband but has a group delay of only D-1 and is cheaper to compute.
+ *
+ * The theory behind this block can be found in the paper:
+ *
+ * <B><EM>R. Yates, "DC Blocker Algorithms," IEEE Signal Processing Magazine,
+ * Mar. 2008, pp 132-134.</EM></B>
+ */
+class GR_CORE_API gr_dc_blocker_cc : public gr_sync_block
+{
+ private:
+ /*!
+ * Build the DC blocker.
+ * \param D (int) the length of the delay line
+ * \param long_form (bool) whether to use long (true, default) or short form
+ */
+ friend GR_CORE_API gr_dc_blocker_cc_sptr gr_make_dc_blocker_cc (int D, bool long_form);
+
+ int d_length;
+ bool d_long_form;
+ moving_averager_c *d_ma_0;
+ moving_averager_c *d_ma_1;
+ moving_averager_c *d_ma_2;
+ moving_averager_c *d_ma_3;
+ std::deque<gr_complex> d_delay_line;
+
+ gr_dc_blocker_cc (int D, bool long_form);
+
+public:
+ ~gr_dc_blocker_cc ();
+
+ /*!
+ * Get the blocker's group delay that is based on length of delay lines
+ */
+ int get_group_delay();
+
+ //int set_length(int D);
+
+ 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/filter/gr_dc_blocker_cc.i b/gnuradio-core/src/lib/filter/gr_dc_blocker_cc.i
new file mode 100644
index 000000000..83d05044b
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_dc_blocker_cc.i
@@ -0,0 +1,34 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,dc_blocker_cc);
+
+gr_dc_blocker_cc_sptr gr_make_dc_blocker_cc (int D=32, bool long_form=true);
+
+class gr_dc_blocker_cc : public gr_sync_block
+{
+ private:
+ gr_dc_blocker_cc (int D, bool long_form);
+
+ public:
+ ~gr_dc_blocker_cc ();
+};
diff --git a/gnuradio-core/src/lib/filter/gr_dc_blocker_ff.cc b/gnuradio-core/src/lib/filter/gr_dc_blocker_ff.cc
new file mode 100644
index 000000000..04ee64879
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_dc_blocker_ff.cc
@@ -0,0 +1,138 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_dc_blocker_ff.h>
+#include <gr_io_signature.h>
+#include <cstdio>
+
+moving_averager_f::moving_averager_f(int D)
+ : d_length(D), d_out(0), d_out_d1(0), d_out_d2(0)
+{
+ d_delay_line = std::deque<float>(d_length-1, 0);
+}
+
+moving_averager_f::~moving_averager_f()
+{
+}
+
+float
+moving_averager_f::filter(float x)
+{
+ d_out_d1 = d_out;
+ d_delay_line.push_back(x);
+ d_out = d_delay_line[0];
+ d_delay_line.pop_front();
+
+ float y = x - d_out_d1 + d_out_d2;
+ d_out_d2 = y;
+
+ return (y / (float)(d_length));
+}
+
+
+
+gr_dc_blocker_ff_sptr gr_make_dc_blocker_ff (int D, bool long_form)
+{
+ return gnuradio::get_initial_sptr(new gr_dc_blocker_ff(D, long_form));
+}
+
+
+gr_dc_blocker_ff::gr_dc_blocker_ff (int D, bool long_form)
+ : gr_sync_block ("dc_blocker_ff",
+ gr_make_io_signature (1, 1, sizeof(float)),
+ gr_make_io_signature (1, 1, sizeof(float))),
+ d_length(D), d_long_form(long_form)
+{
+ if(d_long_form) {
+ d_ma_0 = new moving_averager_f(D);
+ d_ma_1 = new moving_averager_f(D);
+ d_ma_2 = new moving_averager_f(D);
+ d_ma_3 = new moving_averager_f(D);
+ d_delay_line = std::deque<float>(d_length-1, 0);
+ }
+ else {
+ d_ma_0 = new moving_averager_f(D);
+ d_ma_1 = new moving_averager_f(D);
+ }
+}
+
+gr_dc_blocker_ff::~gr_dc_blocker_ff()
+{
+ if(d_long_form) {
+ delete d_ma_0;
+ delete d_ma_1;
+ delete d_ma_2;
+ delete d_ma_3;
+ }
+ else {
+ delete d_ma_0;
+ delete d_ma_1;
+ }
+}
+
+int
+gr_dc_blocker_ff::get_group_delay()
+{
+ if(d_long_form)
+ return (2*d_length-2);
+ else
+ return d_length - 1;
+}
+
+int
+gr_dc_blocker_ff::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const float *in = (const float*)input_items[0];
+ float *out = (float*)output_items[0];
+
+ if(d_long_form) {
+ float y1, y2, y3, y4, d;
+ for(int i = 0; i < noutput_items; i++) {
+ y1 = d_ma_0->filter(in[i]);
+ y2 = d_ma_1->filter(y1);
+ y3 = d_ma_2->filter(y2);
+ y4 = d_ma_3->filter(y3);
+
+ d_delay_line.push_back(d_ma_0->delayed_sig());
+ d = d_delay_line[0];
+ d_delay_line.pop_front();
+
+ out[i] = d - y4;
+ }
+ }
+ else {
+ float y1, y2;
+ for(int i = 0; i < noutput_items; i++) {
+ y1 = d_ma_0->filter(in[i]);
+ y2 = d_ma_1->filter(y1);
+ out[i] = d_ma_0->delayed_sig() - y2;
+ }
+ }
+
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/filter/gr_dc_blocker_ff.h b/gnuradio-core/src/lib/filter/gr_dc_blocker_ff.h
new file mode 100644
index 000000000..d69f24835
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_dc_blocker_ff.h
@@ -0,0 +1,112 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+
+#ifndef INCLUDED_GR_DC_BLOCKER_FF_H
+#define INCLUDED_GR_DC_BLOCKER_FF_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+#include <deque>
+
+class GR_CORE_API moving_averager_f
+{
+public:
+ moving_averager_f(int D);
+ ~moving_averager_f();
+
+ float filter(float x);
+ float delayed_sig() { return d_out; }
+
+private:
+ int d_length;
+ float d_out, d_out_d1, d_out_d2;
+ std::deque<float> d_delay_line;
+};
+
+
+class gr_dc_blocker_ff;
+typedef boost::shared_ptr<gr_dc_blocker_ff> gr_dc_blocker_ff_sptr;
+GR_CORE_API gr_dc_blocker_ff_sptr gr_make_dc_blocker_ff (int D=32, bool long_form=true);
+
+/*!
+ * \class gr_dc_blocker_ff
+ * \brief a computationally efficient controllable DC blocker
+ *
+ * \ingroup filter_blk
+ *
+ * This block implements a computationally efficient DC blocker that produces
+ * a tighter notch filter around DC for a smaller group delay than an
+ * equivalent FIR filter or using a single pole IIR filter (though the IIR
+ * filter is computationally cheaper).
+ *
+ * The block defaults to using a delay line of length 32 and the long form
+ * of the filter. Optionally, the delay line length can be changed to alter
+ * the width of the DC notch (longer lines will decrease the width).
+ *
+ * The long form of the filter produces a nearly flat response outside of
+ * the notch but at the cost of a group delay of 2D-2.
+ *
+ * The short form of the filter does not have as flat a response in the
+ * passband but has a group delay of only D-1 and is cheaper to compute.
+ *
+ * The theory behind this block can be found in the paper:
+ *
+ * <B><EM>R. Yates, "DC Blocker Algorithms," IEEE Signal Processing Magazine,
+ * Mar. 2008, pp 132-134.</EM></B>
+ */
+class GR_CORE_API gr_dc_blocker_ff : public gr_sync_block
+{
+ private:
+ /*!
+ * Build the DC blocker.
+ * \param D (int) the length of the delay line
+ * \param long_form (bool) whether to use long (true, default) or short form
+ */
+ friend GR_CORE_API gr_dc_blocker_ff_sptr gr_make_dc_blocker_ff (int D, bool long_form);
+
+ int d_length;
+ bool d_long_form;
+ moving_averager_f *d_ma_0;
+ moving_averager_f *d_ma_1;
+ moving_averager_f *d_ma_2;
+ moving_averager_f *d_ma_3;
+ std::deque<float> d_delay_line;
+
+ gr_dc_blocker_ff (int D, bool long_form);
+
+public:
+ ~gr_dc_blocker_ff ();
+
+ /*!
+ * Get the blocker's group delay that is based on length of delay lines
+ */
+ int get_group_delay();
+
+ //int set_length(int D);
+
+ 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/filter/gr_dc_blocker_ff.i b/gnuradio-core/src/lib/filter/gr_dc_blocker_ff.i
new file mode 100644
index 000000000..065eb441d
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_dc_blocker_ff.i
@@ -0,0 +1,34 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,dc_blocker_ff);
+
+gr_dc_blocker_ff_sptr gr_make_dc_blocker_ff (int D=32, bool long_form=true);
+
+class gr_dc_blocker_ff : public gr_sync_block
+{
+ private:
+ gr_dc_blocker_ff (int D, bool long_form);
+
+ public:
+ ~gr_dc_blocker_ff ();
+};
diff --git a/gnuradio-core/src/lib/filter/gr_fft_filter_ccc.cc b/gnuradio-core/src/lib/filter/gr_fft_filter_ccc.cc
new file mode 100644
index 000000000..08e231a44
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_fft_filter_ccc.cc
@@ -0,0 +1,132 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005,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: This file is automatically generated by generate_gr_fft_filter_XXX.py
+ * Any changes made to this file will be overwritten.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_fft_filter_ccc.h>
+#include <gri_fft_filter_ccc_generic.h>
+#include <gr_io_signature.h>
+#include <gri_fft.h>
+#include <math.h>
+#include <assert.h>
+#include <stdexcept>
+#include <gr_firdes.h>
+
+#include <cstdio>
+#include <iostream>
+#include <string.h>
+
+gr_fft_filter_ccc_sptr gr_make_fft_filter_ccc (int decimation,
+ const std::vector<gr_complex> &taps,
+ int nthreads)
+{
+ return gnuradio::get_initial_sptr(new gr_fft_filter_ccc (decimation, taps, nthreads));
+}
+
+
+gr_fft_filter_ccc::gr_fft_filter_ccc (int decimation,
+ const std::vector<gr_complex> &taps,
+ int nthreads)
+ : gr_sync_decimator ("fft_filter_ccc",
+ gr_make_io_signature (1, 1, sizeof (gr_complex)),
+ gr_make_io_signature (1, 1, sizeof (gr_complex)),
+ decimation),
+ d_updated(false)
+{
+ set_history(1);
+
+#if 1 // don't enable the sse version until handling it is worked out
+ d_filter = new gri_fft_filter_ccc_generic(decimation, taps, nthreads);
+#else
+ d_filter = new gri_fft_filter_ccc_sse(decimation, taps);
+#endif
+
+ d_new_taps = taps;
+ d_nsamples = d_filter->set_taps(taps);
+ set_output_multiple(d_nsamples);
+}
+
+gr_fft_filter_ccc::~gr_fft_filter_ccc ()
+{
+ delete d_filter;
+}
+
+void
+gr_fft_filter_ccc::set_taps (const std::vector<gr_complex> &taps)
+{
+ d_new_taps = taps;
+ d_updated = true;
+}
+
+std::vector<gr_complex>
+gr_fft_filter_ccc::taps () const
+{
+ return d_new_taps;
+}
+
+void
+gr_fft_filter_ccc::set_nthreads(int n)
+{
+ if(d_filter)
+ d_filter->set_nthreads(n);
+}
+
+int
+gr_fft_filter_ccc::nthreads() const
+{
+ if(d_filter)
+ return d_filter->nthreads();
+ else
+ return 0;
+}
+
+
+int
+gr_fft_filter_ccc::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const gr_complex *in = (const gr_complex *) input_items[0];
+ gr_complex *out = (gr_complex *) output_items[0];
+
+ if (d_updated){
+ d_nsamples = d_filter->set_taps(d_new_taps);
+ d_updated = false;
+ set_output_multiple(d_nsamples);
+ return 0; // output multiple may have changed
+ }
+
+ assert(noutput_items % d_nsamples == 0);
+
+ d_filter->filter(noutput_items, in, out);
+
+ //assert((out - (gr_complex *) output_items[0]) == noutput_items);
+
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/filter/gr_fft_filter_ccc.h b/gnuradio-core/src/lib/filter/gr_fft_filter_ccc.h
new file mode 100644
index 000000000..4b478b65f
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_fft_filter_ccc.h
@@ -0,0 +1,90 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005 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_FFT_FILTER_CCC_H
+#define INCLUDED_GR_FFT_FILTER_CCC_H
+
+#include <gr_core_api.h>
+#include <gr_sync_decimator.h>
+
+class gr_fft_filter_ccc;
+typedef boost::shared_ptr<gr_fft_filter_ccc> gr_fft_filter_ccc_sptr;
+GR_CORE_API gr_fft_filter_ccc_sptr
+gr_make_fft_filter_ccc (int decimation, const std::vector<gr_complex> &taps,
+ int nthreads=1);
+
+//class gri_fft_filter_ccc_sse;
+class gri_fft_filter_ccc_generic;
+
+/*!
+ * \brief Fast FFT filter with gr_complex input, gr_complex output and gr_complex taps
+ * \ingroup filter_blk
+ */
+class GR_CORE_API gr_fft_filter_ccc : public gr_sync_decimator
+{
+ private:
+ friend GR_CORE_API gr_fft_filter_ccc_sptr
+ gr_make_fft_filter_ccc (int decimation, const std::vector<gr_complex> &taps,
+ int nthreads);
+
+ int d_nsamples;
+ bool d_updated;
+#if 1 // don't enable the sse version until handling it is worked out
+ gri_fft_filter_ccc_generic *d_filter;
+#else
+ gri_fft_filter_ccc_sse *d_filter;
+#endif
+ std::vector<gr_complex> d_new_taps;
+
+ /*!
+ * Construct a FFT filter with the given taps
+ *
+ * \param decimation >= 1
+ * \param taps complex filter taps
+ * \param nthreads number of threads for the FFT to use
+ */
+ gr_fft_filter_ccc (int decimation, const std::vector<gr_complex> &taps,
+ int nthreads=1);
+
+ public:
+ ~gr_fft_filter_ccc ();
+
+ void set_taps (const std::vector<gr_complex> &taps);
+ std::vector<gr_complex> taps () const;
+
+ /*!
+ * \brief Set number of threads to use.
+ */
+ void set_nthreads(int n);
+
+ /*!
+ * \brief Get number of threads being used.
+ */
+ int nthreads() const;
+
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+
+
+#endif /* INCLUDED_GR_FFT_FILTER_CCC_H */
diff --git a/gnuradio-core/src/lib/filter/gr_fft_filter_ccc.i b/gnuradio-core/src/lib/filter/gr_fft_filter_ccc.i
new file mode 100644
index 000000000..76837b582
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_fft_filter_ccc.i
@@ -0,0 +1,46 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2005 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,fft_filter_ccc)
+
+gr_fft_filter_ccc_sptr
+gr_make_fft_filter_ccc (int decimation,
+ const std::vector<gr_complex> &taps,
+ int nthreads=1
+ ) throw (std::invalid_argument);
+
+class gr_fft_filter_ccc : public gr_sync_decimator
+{
+ private:
+ gr_fft_filter_ccc (int decimation, const std::vector<gr_complex> &taps,
+ int nthreads=1);
+
+ public:
+ ~gr_fft_filter_ccc ();
+
+ void set_taps (const std::vector<gr_complex> &taps);
+ std::vector<gr_complex> taps () const;
+
+ void set_nthreads(int n);
+ int nthreads() const;
+
+};
diff --git a/gnuradio-core/src/lib/filter/gr_fft_filter_fff.cc b/gnuradio-core/src/lib/filter/gr_fft_filter_fff.cc
new file mode 100644
index 000000000..a09feb7f1
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_fft_filter_fff.cc
@@ -0,0 +1,123 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_fft_filter_fff.h>
+#include <gri_fft_filter_fff_generic.h>
+#include <gr_io_signature.h>
+#include <assert.h>
+#include <stdexcept>
+
+#include <cstdio>
+#include <iostream>
+#include <string.h>
+
+gr_fft_filter_fff_sptr gr_make_fft_filter_fff (int decimation,
+ const std::vector<float> &taps,
+ int nthreads)
+{
+ return gnuradio::get_initial_sptr(new gr_fft_filter_fff (decimation, taps, nthreads));
+}
+
+
+gr_fft_filter_fff::gr_fft_filter_fff (int decimation,
+ const std::vector<float> &taps,
+ int nthreads)
+ : gr_sync_decimator ("fft_filter_fff",
+ gr_make_io_signature (1, 1, sizeof (float)),
+ gr_make_io_signature (1, 1, sizeof (float)),
+ decimation),
+ d_updated(false)
+{
+ set_history(1);
+
+#if 1 // don't enable the sse version until handling it is worked out
+ d_filter = new gri_fft_filter_fff_generic(decimation, taps, nthreads);
+#else
+ d_filter = new gri_fft_filter_fff_sse(decimation, taps);
+#endif
+
+ d_new_taps = taps;
+ d_nsamples = d_filter->set_taps(taps);
+ set_output_multiple(d_nsamples);
+}
+
+gr_fft_filter_fff::~gr_fft_filter_fff ()
+{
+ delete d_filter;
+}
+
+void
+gr_fft_filter_fff::set_taps (const std::vector<float> &taps)
+{
+ d_new_taps = taps;
+ d_updated = true;
+}
+
+std::vector<float>
+gr_fft_filter_fff::taps () const
+{
+ return d_new_taps;
+}
+
+void
+gr_fft_filter_fff::set_nthreads(int n)
+{
+ if(d_filter)
+ d_filter->set_nthreads(n);
+}
+
+int
+gr_fft_filter_fff::nthreads() const
+{
+ if(d_filter)
+ return d_filter->nthreads();
+ else
+ return 0;
+}
+
+int
+gr_fft_filter_fff::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const float *in = (const float *) input_items[0];
+ float *out = (float *) output_items[0];
+
+ if (d_updated){
+ d_nsamples = d_filter->set_taps(d_new_taps);
+ d_updated = false;
+ set_output_multiple(d_nsamples);
+ return 0; // output multiple may have changed
+ }
+
+ assert(noutput_items % d_nsamples == 0);
+
+ d_filter->filter(noutput_items, in, out);
+
+ //assert((out - (float *) output_items[0]) == noutput_items);
+
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/filter/gr_fft_filter_fff.h b/gnuradio-core/src/lib/filter/gr_fft_filter_fff.h
new file mode 100644
index 000000000..309a55135
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_fft_filter_fff.h
@@ -0,0 +1,88 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005 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_FFT_FILTER_FFF_H
+#define INCLUDED_GR_FFT_FILTER_FFF_H
+
+#include <gr_core_api.h>
+#include <gr_sync_decimator.h>
+
+class gr_fft_filter_fff;
+typedef boost::shared_ptr<gr_fft_filter_fff> gr_fft_filter_fff_sptr;
+GR_CORE_API gr_fft_filter_fff_sptr
+gr_make_fft_filter_fff (int decimation, const std::vector<float> &taps,
+ int nthreads=1);
+
+class gri_fft_filter_fff_generic;
+//class gri_fft_filter_fff_sse;
+
+/*!
+ * \brief Fast FFT filter with float input, float output and float taps
+ * \ingroup filter_blk
+ */
+class GR_CORE_API gr_fft_filter_fff : public gr_sync_decimator
+{
+ private:
+ friend GR_CORE_API gr_fft_filter_fff_sptr
+ gr_make_fft_filter_fff (int decimation, const std::vector<float> &taps,
+ int nthreads);
+
+ int d_nsamples;
+ bool d_updated;
+#if 1 // don't enable the sse version until handling it is worked out
+ gri_fft_filter_fff_generic *d_filter;
+#else
+ gri_fft_filter_fff_sse *d_filter;
+#endif
+ std::vector<float> d_new_taps;
+
+ /*!
+ * Construct a FFT filter with the given taps
+ *
+ * \param decimation >= 1
+ * \param taps float filter taps
+ * \param nthreads number of threads for the FFT to use
+ */
+ gr_fft_filter_fff (int decimation, const std::vector<float> &taps,
+ int nthreads=1);
+
+ public:
+ ~gr_fft_filter_fff ();
+
+ void set_taps (const std::vector<float> &taps);
+ std::vector<float> taps () const;
+
+ /*!
+ * \brief Set number of threads to use.
+ */
+ void set_nthreads(int n);
+
+ /*!
+ * \brief Get number of threads being used.
+ */
+ int nthreads() const;
+
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif /* INCLUDED_GR_FFT_FILTER_FFF_H */
diff --git a/gnuradio-core/src/lib/filter/gr_fft_filter_fff.i b/gnuradio-core/src/lib/filter/gr_fft_filter_fff.i
new file mode 100644
index 000000000..86c554893
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_fft_filter_fff.i
@@ -0,0 +1,45 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2005 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,fft_filter_fff)
+
+gr_fft_filter_fff_sptr
+gr_make_fft_filter_fff (int decimation,
+ const std::vector<float> &taps,
+ int nthreads=1
+ ) throw (std::invalid_argument);
+
+class gr_fft_filter_fff : public gr_sync_decimator
+{
+ private:
+ gr_fft_filter_fff (int decimation, const std::vector<float> &taps,
+ int nthreads=1);
+
+ public:
+ ~gr_fft_filter_fff ();
+
+ void set_taps (const std::vector<float> &taps);
+ std::vector<float> taps () const;
+ void set_nthreads(int n);
+ int nthreads() const;
+
+};
diff --git a/gnuradio-core/src/lib/filter/gr_filter_delay_fc.cc b/gnuradio-core/src/lib/filter/gr_filter_delay_fc.cc
new file mode 100644
index 000000000..af8a8e9e7
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_filter_delay_fc.cc
@@ -0,0 +1,80 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_filter_delay_fc.h>
+#include <gr_fir_fff.h>
+#include <gr_fir_util.h>
+
+// public constructor
+gr_filter_delay_fc_sptr
+gr_make_filter_delay_fc (const std::vector<float> &taps)
+{
+ return gnuradio::get_initial_sptr(new gr_filter_delay_fc (taps));
+}
+
+gr_filter_delay_fc::gr_filter_delay_fc (const std::vector<float> &taps)
+ : gr_sync_block ("filter_delay_fc",
+ gr_make_io_signature (1, 2, sizeof (float)),
+ gr_make_io_signature (1, 1, sizeof (gr_complex)))
+{
+ d_fir = gr_fir_util::create_gr_fir_fff (taps);
+ d_delay = d_fir->ntaps () / 2;
+ set_history (d_fir->ntaps ());
+}
+
+gr_filter_delay_fc::~gr_filter_delay_fc ()
+{
+ delete d_fir;
+}
+
+int
+gr_filter_delay_fc::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ float *in0 = (float *) input_items[0];
+ float *in1 = (float *) input_items[1];
+ gr_complex *out = (gr_complex *) output_items[0];
+
+ switch (input_items.size ()){
+ case 1:
+ for (int i = 0; i < noutput_items; i++)
+ out[i] = gr_complex (in0[i + d_delay],
+ d_fir->filter (&in0[i]));
+ break;
+
+ case 2:
+ for (int j = 0; j < noutput_items; j++)
+ out[j] = gr_complex (in0[j + d_delay],
+ d_fir->filter (&in1[j]));
+ break;
+
+ default:
+ assert (0);
+ }
+
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/filter/gr_filter_delay_fc.h b/gnuradio-core/src/lib/filter/gr_filter_delay_fc.h
new file mode 100644
index 000000000..fee11243a
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_filter_delay_fc.h
@@ -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.
+ */
+
+#ifndef INCLUDED_GR_FILTER_DELAY_FC_H
+#define INCLUDED_GR_FILTER_DELAY_FC_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+#include <gr_io_signature.h>
+#include <gr_types.h>
+
+class gr_filter_delay_fc;
+typedef boost::shared_ptr<gr_filter_delay_fc> gr_filter_delay_fc_sptr;
+
+// public constructor
+GR_CORE_API gr_filter_delay_fc_sptr gr_make_filter_delay_fc (const std::vector<float> &taps);
+
+class gr_fir_fff;
+
+/*!
+ * \brief Filter-Delay Combination Block.
+ * \ingroup filter_blk
+ *
+ * The block takes one or two float stream and outputs a complex
+ * stream. If only one float stream is input, the real output is
+ * a delayed version of this input and the imaginary output is the
+ * filtered output. If two floats are connected to the input, then
+ * the real output is the delayed version of the first input, and
+ * the imaginary output is the filtered output. The delay in the
+ * real path accounts for the group delay introduced by the filter
+ * in the imaginary path. The filter taps needs to be calculated
+ * before initializing this block.
+ *
+ */
+class GR_CORE_API gr_filter_delay_fc : public gr_sync_block
+{
+ public:
+ ~gr_filter_delay_fc ();
+
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+
+ protected:
+ gr_filter_delay_fc (const std::vector<float> &taps);
+
+ private:
+ unsigned int d_delay;
+ gr_fir_fff *d_fir;
+
+ friend GR_CORE_API gr_filter_delay_fc_sptr gr_make_filter_delay_fc (const std::vector<float> &taps);
+};
+
+#endif /* INCLUDED_GR_FILTER_DELAY_FC_H */
diff --git a/gnuradio-core/src/lib/filter/gr_filter_delay_fc.i b/gnuradio-core/src/lib/filter/gr_filter_delay_fc.i
new file mode 100644
index 000000000..54b721cee
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_filter_delay_fc.i
@@ -0,0 +1,34 @@
+/* -*- 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,filter_delay_fc);
+
+gr_filter_delay_fc_sptr gr_make_filter_delay_fc (const std::vector<float> &taps);
+
+class gr_filter_delay_fc : public gr_sync_block
+{
+private:
+ gr_filter_delay_fc ();
+};
+
+// ----------------------------------------------------------------
+
diff --git a/gnuradio-core/src/lib/filter/gr_fir_XXX.cc.t b/gnuradio-core/src/lib/filter/gr_fir_XXX.cc.t
new file mode 100644
index 000000000..2396f0fe6
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_fir_XXX.cc.t
@@ -0,0 +1,30 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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 <@FIR_TYPE@.h>
+
+@FIR_TYPE@::~@FIR_TYPE@ ()
+{
+}
diff --git a/gnuradio-core/src/lib/filter/gr_fir_XXX.h.t b/gnuradio-core/src/lib/filter/gr_fir_XXX.h.t
new file mode 100644
index 000000000..197bb3cd2
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_fir_XXX.h.t
@@ -0,0 +1,124 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002,2003 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: This file is automatically generated by generate_gr_fir_XXX.py
+ * Any changes made to this file will be overwritten.
+ */
+
+
+#ifndef @GUARD_NAME@
+#define @GUARD_NAME@
+
+#include <gr_core_api.h>
+#include <vector>
+@VRCOMPLEX_INCLUDE@
+#include <gr_reverse.h>
+
+/*!
+ * \brief Abstract class for FIR with @I_TYPE@ input, @O_TYPE@ output and @TAP_TYPE@ taps
+ * \ingroup filter_primitive
+ *
+ * This is the abstract class for a Finite Impulse Response filter.
+ *
+ * The trailing suffix has the form _IOT where I codes the input type,
+ * O codes the output type, and T codes the tap type.
+ * I,O,T are elements of the set 's' (short), 'f' (float), 'c' (gr_complex), 'i' (int)
+ */
+
+class GR_CORE_API @FIR_TYPE@ {
+
+protected:
+ std::vector<@TAP_TYPE@> d_taps; // reversed taps
+
+public:
+
+ // CONSTRUCTORS
+
+ /*!
+ * \brief construct new FIR with given taps.
+ *
+ * Note that taps must be in forward order, e.g., coefficient 0 is
+ * stored in new_taps[0], coefficient 1 is stored in
+ * new_taps[1], etc.
+ */
+ @FIR_TYPE@ () {}
+ @FIR_TYPE@ (const std::vector<@TAP_TYPE@> &taps) : d_taps (gr_reverse(taps)) {}
+
+ virtual ~@FIR_TYPE@ ();
+
+ // MANIPULATORS
+
+ /*!
+ * \brief compute a single output value.
+ *
+ * \p input must have ntaps() valid entries.
+ * input[0] .. input[ntaps() - 1] are referenced to compute the output value.
+ *
+ * \returns the filtered input value.
+ */
+ virtual @O_TYPE@ filter (const @I_TYPE@ input[]) = 0;
+
+ /*!
+ * \brief compute an array of N output values.
+ *
+ * \p input must have (n - 1 + ntaps()) valid entries.
+ * input[0] .. input[n - 1 + ntaps() - 1] are referenced to compute the output values.
+ */
+ virtual void filterN (@O_TYPE@ output[], const @I_TYPE@ input[],
+ unsigned long n) = 0;
+
+ /*!
+ * \brief compute an array of N output values, decimating the input
+ *
+ * \p input must have (decimate * (n - 1) + ntaps()) valid entries.
+ * input[0] .. input[decimate * (n - 1) + ntaps() - 1] are referenced to
+ * compute the output values.
+ */
+ virtual void filterNdec (@O_TYPE@ output[], const @I_TYPE@ input[],
+ unsigned long n, unsigned decimate) = 0;
+
+ /*!
+ * \brief install \p new_taps as the current taps.
+ */
+ virtual void set_taps (const std::vector<@TAP_TYPE@> &taps)
+ {
+ d_taps = gr_reverse(taps);
+ }
+
+ // ACCESSORS
+
+ /*!
+ * \return number of taps in filter.
+ */
+ unsigned ntaps () const { return d_taps.size (); }
+
+ /*!
+ * \return current taps
+ */
+ virtual const std::vector<@TAP_TYPE@> get_taps () const
+ {
+ return gr_reverse(d_taps);
+ }
+};
+
+#endif /* @GUARD_NAME@ */
diff --git a/gnuradio-core/src/lib/filter/gr_fir_XXX_generic.cc.t b/gnuradio-core/src/lib/filter/gr_fir_XXX_generic.cc.t
new file mode 100644
index 000000000..11b4fd50f
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_fir_XXX_generic.cc.t
@@ -0,0 +1,103 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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 <@FIR_TYPE@_generic.h>
+
+#if (@N_UNROLL@ == 4)
+
+@O_TYPE@
+@FIR_TYPE@_generic::filter (const @I_TYPE@ input[])
+{
+ static const int N_UNROLL = 4;
+
+ @ACC_TYPE@ acc0 = 0;
+ @ACC_TYPE@ acc1 = 0;
+ @ACC_TYPE@ acc2 = 0;
+ @ACC_TYPE@ acc3 = 0;
+
+
+ unsigned i = 0;
+ unsigned n = (ntaps () / N_UNROLL) * N_UNROLL;
+
+ for (i = 0; i < n; i += N_UNROLL){
+ acc0 += d_taps[i + 0] * @INPUT_CAST@ input[i + 0];
+ acc1 += d_taps[i + 1] * @INPUT_CAST@ input[i + 1];
+ acc2 += d_taps[i + 2] * @INPUT_CAST@ input[i + 2];
+ acc3 += d_taps[i + 3] * @INPUT_CAST@ input[i + 3];
+ }
+
+ for (; i < ntaps (); i++)
+ acc0 += d_taps[i] * @INPUT_CAST@ input[i];
+
+ return (@O_TYPE@) (acc0 + acc1 + acc2 + acc3);
+}
+
+#else
+
+@O_TYPE@
+@FIR_TYPE@_generic::filter (const @I_TYPE@ input[])
+{
+ static const int N_UNROLL = 2;
+
+ @ACC_TYPE@ acc0 = 0;
+ @ACC_TYPE@ acc1 = 0;
+
+ unsigned i = 0;
+ unsigned n = (ntaps () / N_UNROLL) * N_UNROLL;
+
+ for (i = 0; i < n; i += N_UNROLL){
+ acc0 += d_taps[i + 0] * @INPUT_CAST@ input[i + 0];
+ acc1 += d_taps[i + 1] * @INPUT_CAST@ input[i + 1];
+ }
+
+ for (; i < ntaps (); i++)
+ acc0 += d_taps[i] * @INPUT_CAST@ input[i];
+
+ return (@O_TYPE@) (acc0 + acc1);
+}
+
+#endif // N_UNROLL
+
+void
+@FIR_TYPE@_generic::filterN (@O_TYPE@ output[],
+ const @I_TYPE@ input[],
+ unsigned long n)
+{
+ for (unsigned i = 0; i < n; i++)
+ output[i] = filter (&input[i]);
+}
+
+void
+@FIR_TYPE@_generic::filterNdec (@O_TYPE@ output[],
+ const @I_TYPE@ input[],
+ unsigned long n,
+ unsigned decimate)
+{
+ unsigned j = 0;
+ for (unsigned i = 0; i < n; i++){
+ output[i] = filter (&input[j]);
+ j += decimate;
+ }
+}
diff --git a/gnuradio-core/src/lib/filter/gr_fir_XXX_generic.h.t b/gnuradio-core/src/lib/filter/gr_fir_XXX_generic.h.t
new file mode 100644
index 000000000..f7382d739
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_fir_XXX_generic.h.t
@@ -0,0 +1,78 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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 <@FIR_TYPE@.h>
+
+/*!
+ * \brief Concrete class for generic implementation of FIR with @I_TYPE@ input, @O_TYPE@ output and @TAP_TYPE@ taps
+ *
+ * The trailing suffix has the form _IOT where I codes the input type,
+ * O codes the output type, and T codes the tap type.
+ * I,O,T are elements of the set 's' (short), 'f' (float), 'c' (gr_complex), 'i' (int)
+ */
+
+class GR_CORE_API @FIR_TYPE@_generic : public @FIR_TYPE@ {
+
+public:
+
+ // CREATORS
+
+ @FIR_TYPE@_generic () {}
+ @FIR_TYPE@_generic (const std::vector<@TAP_TYPE@> &taps) : @FIR_TYPE@ (taps) {}
+
+ // MANIPULATORS
+
+ /*!
+ * \brief compute a single output value.
+ *
+ * \p input must have ntaps() valid entries.
+ * input[0] .. input[ntaps() - 1] are referenced to compute the output value.
+ *
+ * \returns the filtered input value.
+ */
+ virtual @O_TYPE@ filter (const @I_TYPE@ input[]);
+
+ /*!
+ * \brief compute an array of N output values.
+ *
+ * \p input must have (n - 1 + ntaps()) valid entries.
+ * input[0] .. input[n - 1 + ntaps() - 1] are referenced to compute the output values.
+ */
+ virtual void filterN (@O_TYPE@ output[], const @I_TYPE@ input[],
+ unsigned long n);
+
+ /*!
+ * \brief compute an array of N output values, decimating the input
+ *
+ * \p input must have (decimate * (n - 1) + ntaps()) valid entries.
+ * input[0] .. input[decimate * (n - 1) + ntaps() - 1] are referenced to
+ * compute the output values.
+ */
+ virtual void filterNdec (@O_TYPE@ output[], const @I_TYPE@ input[],
+ unsigned long n, unsigned decimate);
+
+};
+
+#endif /* @GUARD_NAME@ */
diff --git a/gnuradio-core/src/lib/filter/gr_fir_ccc_simd.cc b/gnuradio-core/src/lib/filter/gr_fir_ccc_simd.cc
new file mode 100644
index 000000000..d88b696c9
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_fir_ccc_simd.cc
@@ -0,0 +1,142 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <gr_fir_ccc_simd.h>
+
+#include <assert.h>
+#include <malloc16.h>
+#include <iostream>
+#include <stdexcept>
+
+using std::cerr;
+using std::endl;
+
+gr_fir_ccc_simd::gr_fir_ccc_simd ()
+ : gr_fir_ccc_generic ()
+{
+ // cerr << "@@@ gr_fir_ccc_simd\n";
+
+ d_ccomplex_dotprod = 0;
+
+ d_aligned_taps[0] = 0;
+ d_aligned_taps[1] = 0;
+ d_aligned_taps[2] = 0;
+ d_aligned_taps[3] = 0;
+}
+
+gr_fir_ccc_simd::gr_fir_ccc_simd (const std::vector<gr_complex> &new_taps)
+ : gr_fir_ccc_generic (new_taps)
+{
+ // cerr << "@@@ gr_fir_ccc_simd\n";
+
+ d_ccomplex_dotprod = 0;
+
+ d_aligned_taps[0] = 0;
+ d_aligned_taps[1] = 0;
+ d_aligned_taps[2] = 0;
+ d_aligned_taps[3] = 0;
+ set_taps (new_taps);
+}
+
+gr_fir_ccc_simd::~gr_fir_ccc_simd ()
+{
+ free16Align (d_aligned_taps[0]);
+ free16Align (d_aligned_taps[1]);
+ free16Align (d_aligned_taps[2]);
+ free16Align (d_aligned_taps[3]);
+}
+
+void
+gr_fir_ccc_simd::set_taps (const std::vector<gr_complex> &inew_taps)
+{
+ gr_fir_ccc::set_taps (inew_taps); // call superclass
+
+ const std::vector<gr_complex> new_taps = gr_reverse(inew_taps);
+ unsigned len = new_taps.size ();
+
+ // Make 4 copies of the coefficients, one for each data alignment
+ // Note use of special 16-byte-aligned version of calloc()
+
+ for (unsigned i = 0; i < 4; i++){
+ free16Align (d_aligned_taps[i]); // free old value
+
+ // this works because the bit representation of a IEEE floating point
+ // +zero is all zeros. If you're using a different representation,
+ // you'll need to explictly set the result to the appropriate 0.0 value.
+
+ d_aligned_taps[i] = (float *) calloc16Align (1 + (len + i - 1) / 2,
+ 2 * 4 * sizeof (float));
+ if (d_aligned_taps[i] == 0){
+ // throw something...
+ cerr << "@@@ gr_fir_ccc_simd d_aligned_taps[" << i << "] == 0\n";
+ }
+
+ for (unsigned j = 0; j < len; j++) {
+ d_aligned_taps[i][2*(j+i)] = new_taps[j].real();
+ d_aligned_taps[i][2*(j+i)+1] = new_taps[j].imag();
+ }
+ }
+}
+
+gr_complex
+gr_fir_ccc_simd::filter (const gr_complex input[])
+{
+ if (ntaps () == 0)
+ return 0.0;
+
+ if (((intptr_t) input & 0x7) != 0)
+ throw std::invalid_argument("gr_complex must be 8-byte aligned");
+
+ // Round input data address down to 16 byte boundary
+ // NB: depending on the alignment of input[], memory
+ // before input[] will be accessed. The contents don't matter since
+ // they'll be multiplied by zero coefficients. I can't conceive of any
+ // situation where this could cause a segfault since memory protection
+ // in the x86 machines is done on much larger boundaries.
+
+ const gr_complex *ar = (gr_complex *)((unsigned long) input & ~15);
+
+ // Choose one of 4 sets of pre-shifted coefficients. al is both the
+ // index into d_aligned_taps[] and the number of 0 words padded onto
+ // that coefficients array for alignment purposes.
+
+ unsigned al = input - ar;
+
+ // call assembler routine to do the work, passing number of 2x4-float blocks.
+
+ // assert (((unsigned long) ar & 15) == 0);
+ // assert (((unsigned long) d_aligned_taps[al] & 15) == 0);
+
+ // cerr << "ar: " << ar << " d_aligned_taps[ar]: " << d_aligned_taps[al]
+ // << " (ntaps() + al - 1)/2 + 1: " << (ntaps() + al -1) / 2 + 1 << endl;
+
+ float result[2];
+
+ d_ccomplex_dotprod ((float*)ar, d_aligned_taps[al], (ntaps() + al - 1) / 2 + 1, result);
+
+ // cerr << "result = " << result[0] << " " << result[1] << endl;
+
+ return gr_complex(result[0], result[1]);
+}
diff --git a/gnuradio-core/src/lib/filter/gr_fir_ccc_simd.h b/gnuradio-core/src/lib/filter/gr_fir_ccc_simd.h
new file mode 100644
index 000000000..ed7249c91
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_fir_ccc_simd.h
@@ -0,0 +1,65 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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_FIR_CCC_SIMD_H
+#define INCLUDED_GR_FIR_CCC_SIMD_H
+
+#include <gr_core_api.h>
+#include <gr_fir_ccc_generic.h>
+
+/*!
+ * \brief common base class for SIMD versions of gr_fir_ccc
+ * \ingroup filter_primitive
+ *
+ * This base class handles alignment issues common to SSE and 3DNOW
+ * subclasses.
+ */
+
+class GR_CORE_API gr_fir_ccc_simd : public gr_fir_ccc_generic
+{
+protected:
+ typedef void (*ccomplex_dotprod_t)(const float *input,
+ const float *taps,
+ unsigned n_2_ccomplex_blocks,
+ float *result);
+
+ /*!
+ * \p aligned_taps holds 4 copies of the coefficients preshifted
+ * by 0, 1, 2, or 3 floats to meet all possible input data alignments.
+ * This allows us to always fetch data and taps that are 128-bit aligned.
+ */
+ float *d_aligned_taps[4];
+
+ ccomplex_dotprod_t d_ccomplex_dotprod; // fast dot product primitive
+
+public:
+
+ // CREATORS
+ gr_fir_ccc_simd ();
+ gr_fir_ccc_simd (const std::vector<gr_complex> &taps);
+ ~gr_fir_ccc_simd ();
+
+ // MANIPULATORS
+ virtual void set_taps (const std::vector<gr_complex> &taps);
+ virtual gr_complex filter (const gr_complex input[]);
+};
+
+#endif
diff --git a/gnuradio-core/src/lib/filter/gr_fir_ccc_x86.cc b/gnuradio-core/src/lib/filter/gr_fir_ccc_x86.cc
new file mode 100644
index 000000000..28bc008e8
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_fir_ccc_x86.cc
@@ -0,0 +1,77 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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 <gr_fir_ccc_x86.h>
+#include <ccomplex_dotprod_x86.h>
+
+/*
+ * --- 3DNow! version ---
+ */
+
+gr_fir_ccc_3dnow::gr_fir_ccc_3dnow ()
+ : gr_fir_ccc_simd ()
+{
+ d_ccomplex_dotprod = ccomplex_dotprod_3dnow;
+}
+
+gr_fir_ccc_3dnow::gr_fir_ccc_3dnow (const std::vector<gr_complex> &new_taps)
+ : gr_fir_ccc_simd (new_taps)
+{
+ d_ccomplex_dotprod = ccomplex_dotprod_3dnow;
+}
+
+
+/*
+ * --- 3DNow!Ext version ---
+ */
+
+gr_fir_ccc_3dnowext::gr_fir_ccc_3dnowext ()
+ : gr_fir_ccc_simd ()
+{
+ d_ccomplex_dotprod = ccomplex_dotprod_3dnowext;
+}
+
+gr_fir_ccc_3dnowext::gr_fir_ccc_3dnowext (const std::vector<gr_complex> &new_taps)
+ : gr_fir_ccc_simd (new_taps)
+{
+ d_ccomplex_dotprod = ccomplex_dotprod_3dnowext;
+}
+
+
+/*
+ * --- SSE version ---
+ */
+
+gr_fir_ccc_sse::gr_fir_ccc_sse ()
+ : gr_fir_ccc_simd ()
+{
+ d_ccomplex_dotprod = ccomplex_dotprod_sse;
+}
+
+gr_fir_ccc_sse::gr_fir_ccc_sse (const std::vector<gr_complex> &new_taps)
+ : gr_fir_ccc_simd (new_taps)
+{
+ d_ccomplex_dotprod = ccomplex_dotprod_sse;
+}
diff --git a/gnuradio-core/src/lib/filter/gr_fir_ccc_x86.h b/gnuradio-core/src/lib/filter/gr_fir_ccc_x86.h
new file mode 100644
index 000000000..0a9d2c83c
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_fir_ccc_x86.h
@@ -0,0 +1,56 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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_FIR_CCC_X86_H
+#define INCLUDED_GR_FIR_CCC_X86_H
+
+#include <gr_core_api.h>
+#include <gr_fir_ccc_simd.h>
+
+/*!
+ * \brief 3DNow! version of gr_fir_ccc
+ */
+class GR_CORE_API gr_fir_ccc_3dnow : public gr_fir_ccc_simd
+{
+public:
+ gr_fir_ccc_3dnow ();
+ gr_fir_ccc_3dnow (const std::vector<gr_complex> &taps);
+};
+
+class GR_CORE_API gr_fir_ccc_3dnowext : public gr_fir_ccc_simd
+{
+public:
+ gr_fir_ccc_3dnowext ();
+ gr_fir_ccc_3dnowext (const std::vector<gr_complex> &taps);
+};
+
+/*!
+ * \brief SSE version of gr_fir_ccc
+ */
+class GR_CORE_API gr_fir_ccc_sse : public gr_fir_ccc_simd
+{
+public:
+ gr_fir_ccc_sse ();
+ gr_fir_ccc_sse (const std::vector<gr_complex> &taps);
+};
+
+#endif
diff --git a/gnuradio-core/src/lib/filter/gr_fir_ccf_armv7_a.cc b/gnuradio-core/src/lib/filter/gr_fir_ccf_armv7_a.cc
new file mode 100644
index 000000000..d849c3dd5
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_fir_ccf_armv7_a.cc
@@ -0,0 +1,91 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,2009,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 this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <gr_fir_ccf_armv7_a.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdexcept>
+#include <assert.h>
+#include <gr_math.h>
+#include <dotprod_ccf_armv7_a.h>
+
+#define FLOATS_PER_VEC 4
+
+gr_fir_ccf_armv7_a::gr_fir_ccf_armv7_a()
+ : gr_fir_ccf_generic(),
+ d_naligned_taps(0), d_aligned_taps(0)
+{
+}
+
+gr_fir_ccf_armv7_a::gr_fir_ccf_armv7_a (const std::vector<float> &new_taps)
+ : gr_fir_ccf_generic(new_taps),
+ d_naligned_taps(0), d_aligned_taps(0)
+{
+ set_taps(new_taps);
+}
+
+gr_fir_ccf_armv7_a::~gr_fir_ccf_armv7_a()
+{
+ if (d_aligned_taps){
+ free(d_aligned_taps);
+ d_aligned_taps = 0;
+ }
+}
+
+void
+gr_fir_ccf_armv7_a::set_taps(const std::vector<float> &inew_taps)
+{
+ gr_fir_ccf_generic::set_taps(inew_taps); // call superclass
+ d_naligned_taps = gr_p2_round_up(ntaps(), FLOATS_PER_VEC);
+
+ if (d_aligned_taps){
+ free(d_aligned_taps);
+ d_aligned_taps = 0;
+ }
+ void *p;
+ int r = posix_memalign(&p, sizeof(float), d_naligned_taps * sizeof(d_aligned_taps[0]));
+ if (r != 0){
+ throw std::bad_alloc();
+ }
+ d_aligned_taps = (float *) p;
+ memcpy(d_aligned_taps, &d_taps[0], ntaps() * sizeof(d_aligned_taps[0]));
+ for (size_t i = ntaps(); i < d_naligned_taps; i++)
+ d_aligned_taps[i] = 0.0;
+}
+
+
+gr_complex
+gr_fir_ccf_armv7_a::filter (const gr_complex input[])
+{
+ if (d_naligned_taps == 0)
+ return 0.0;
+
+ gr_complex result;
+ float *presult = reinterpret_cast<float *>(&result);
+ const float *pinput = reinterpret_cast<const float *>(input);
+
+ dotprod_ccf_armv7_a(pinput, d_aligned_taps, presult, d_naligned_taps);
+ return result;
+}
diff --git a/gnuradio-core/src/lib/filter/gr_fir_ccf_armv7_a.h b/gnuradio-core/src/lib/filter/gr_fir_ccf_armv7_a.h
new file mode 100644
index 000000000..e4844bae1
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_fir_ccf_armv7_a.h
@@ -0,0 +1,45 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,2009,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 this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+#ifndef INCLUDED_GR_FIR_CCF_ARMV7_A_H
+#define INCLUDED_GR_FIR_CCF_ARMV7_A_H
+
+#include <gr_fir_ccf_generic.h>
+
+/*!
+ * \brief armv7_a using NEON coprocessor version of gr_fir_ccf
+ */
+class gr_fir_ccf_armv7_a : public gr_fir_ccf_generic
+{
+protected:
+
+ size_t d_naligned_taps; // number of taps (multiple of 4)
+ float *d_aligned_taps; // 16-byte aligned, and zero padded to multiple of 4
+
+public:
+ gr_fir_ccf_armv7_a();
+ gr_fir_ccf_armv7_a(const std::vector<float> &taps);
+ ~gr_fir_ccf_armv7_a();
+
+ virtual void set_taps (const std::vector<float> &taps);
+ virtual gr_complex filter (const gr_complex input[]);
+};
+
+#endif /* INCLUDED_GR_FIR_CCF_ARMV7_A*_H */
diff --git a/gnuradio-core/src/lib/filter/gr_fir_ccf_simd.cc b/gnuradio-core/src/lib/filter/gr_fir_ccf_simd.cc
new file mode 100644
index 000000000..872415e8e
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_fir_ccf_simd.cc
@@ -0,0 +1,141 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <gr_fir_ccf_simd.h>
+
+#include <assert.h>
+#include <malloc16.h>
+#include <iostream>
+#include <stdexcept>
+
+using std::cerr;
+using std::endl;
+
+gr_fir_ccf_simd::gr_fir_ccf_simd ()
+ : gr_fir_ccf_generic ()
+{
+ // cerr << "@@@ gr_fir_ccf_simd\n";
+
+ d_fcomplex_dotprod = 0;
+
+ d_aligned_taps[0] = 0;
+ d_aligned_taps[1] = 0;
+ d_aligned_taps[2] = 0;
+ d_aligned_taps[3] = 0;
+}
+
+gr_fir_ccf_simd::gr_fir_ccf_simd (const std::vector<float> &new_taps)
+ : gr_fir_ccf_generic (new_taps)
+{
+ // cerr << "@@@ gr_fir_ccf_simd\n";
+
+ d_fcomplex_dotprod = 0;
+
+ d_aligned_taps[0] = 0;
+ d_aligned_taps[1] = 0;
+ d_aligned_taps[2] = 0;
+ d_aligned_taps[3] = 0;
+ set_taps (new_taps);
+}
+
+gr_fir_ccf_simd::~gr_fir_ccf_simd ()
+{
+ free16Align (d_aligned_taps[0]);
+ free16Align (d_aligned_taps[1]);
+ free16Align (d_aligned_taps[2]);
+ free16Align (d_aligned_taps[3]);
+}
+
+void
+gr_fir_ccf_simd::set_taps (const std::vector<float> &inew_taps)
+{
+ gr_fir_ccf::set_taps (inew_taps); // call superclass
+ const std::vector<float> new_taps = gr_reverse(inew_taps);
+
+ unsigned len = new_taps.size ();
+
+ // Make 4 copies of the coefficients, one for each data alignment
+ // Note use of special 16-byte-aligned version of calloc()
+
+ for (unsigned i = 0; i < 4; i++){
+ free16Align (d_aligned_taps[i]); // free old value
+
+ // this works because the bit representation of a IEEE floating point
+ // +zero is all zeros. If you're using a different representation,
+ // you'll need to explictly set the result to the appropriate 0.0 value.
+
+ d_aligned_taps[i] = (float *) calloc16Align (1 + (len + i - 1) / 4,
+ 4 * sizeof (float));
+ if (d_aligned_taps[i] == 0){
+ // throw something...
+ cerr << "@@@ gr_fir_ccf_simd d_aligned_taps[" << i << "] == 0\n";
+ }
+
+ for (unsigned j = 0; j < len; j++)
+ d_aligned_taps[i][j+i] = new_taps[j];
+ }
+}
+
+gr_complex
+gr_fir_ccf_simd::filter (const gr_complex input[])
+{
+ if (ntaps () == 0)
+ return 0.0;
+
+ if (((intptr_t) input & 0x7) != 0)
+ throw std::invalid_argument("gr_complex must be 8-byte aligned");
+
+ // Round input data address down to 16 byte boundary
+ // NB: depending on the alignment of input[], memory
+ // before input[] will be accessed. The contents don't matter since
+ // they'll be multiplied by zero coefficients. I can't conceive of any
+ // situation where this could cause a segfault since memory protection
+ // in the x86 machines is done on much larger boundaries.
+
+ const gr_complex *ar = (gr_complex *)((unsigned long) input & ~15);
+
+ // Choose one of 4 sets of pre-shifted coefficients. al is both the
+ // index into d_aligned_taps[] and the number of 0 words padded onto
+ // that coefficients array for alignment purposes.
+
+ unsigned al = input - ar;
+
+ // call assembler routine to do the work, passing number of 2x4-float blocks.
+
+ // assert (((unsigned long) ar & 15) == 0);
+ // assert (((unsigned long) d_aligned_taps[al] & 15) == 0);
+
+ // cerr << "ar: " << ar << " d_aligned_taps[ar]: " << d_aligned_taps[al]
+ // << " (ntaps() + al - 1)/2 + 1: " << (ntaps() + al -1) / 2 + 1 << endl;
+
+ float result[2];
+
+ // the trick here is to invert input and taps, and reuse FCC speedup
+ d_fcomplex_dotprod (d_aligned_taps[al], (float*)ar, (ntaps() + al - 1) / 2 + 1, result);
+
+ // cerr << "result = " << result[0] << " " << result[1] << endl;
+
+ return gr_complex(result[0], result[1]);
+}
diff --git a/gnuradio-core/src/lib/filter/gr_fir_ccf_simd.h b/gnuradio-core/src/lib/filter/gr_fir_ccf_simd.h
new file mode 100644
index 000000000..3c3e7e4f5
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_fir_ccf_simd.h
@@ -0,0 +1,66 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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_FIR_CCF_SIMD_H
+#define INCLUDED_GR_FIR_CCF_SIMD_H
+
+#include <gr_core_api.h>
+#include <gr_fir_ccf_generic.h>
+
+
+/*!
+ * \brief common base class for SIMD versions of gr_fir_ccf
+ * \ingroup filter_primitive
+ *
+ * This base class handles alignment issues common to SSE and 3DNOW
+ * subclasses.
+ */
+
+class GR_CORE_API gr_fir_ccf_simd : public gr_fir_ccf_generic
+{
+protected:
+ typedef void (*fcomplex_dotprod_t)(const float *taps,
+ const float *input,
+ unsigned n_2_complex_blocks,
+ float *result);
+
+ /*!
+ * \p aligned_taps holds 4 copies of the coefficients preshifted
+ * by 0, 1, 2, or 3 float pairs to meet all possible input data alignments.
+ * This allows us to always fetch data and taps that are 128-bit aligned.
+ */
+ float *d_aligned_taps[4];
+
+ fcomplex_dotprod_t d_fcomplex_dotprod; // fast dot product primitive
+
+public:
+
+ // CREATORS
+ gr_fir_ccf_simd ();
+ gr_fir_ccf_simd (const std::vector<float> &taps);
+ ~gr_fir_ccf_simd ();
+
+ // MANIPULATORS
+ virtual void set_taps (const std::vector<float> &taps);
+ virtual gr_complex filter (const gr_complex input[]);
+};
+
+#endif
diff --git a/gnuradio-core/src/lib/filter/gr_fir_ccf_x86.cc b/gnuradio-core/src/lib/filter/gr_fir_ccf_x86.cc
new file mode 100644
index 000000000..f26d4ecc2
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_fir_ccf_x86.cc
@@ -0,0 +1,60 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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 <gr_fir_ccf_x86.h>
+#include <fcomplex_dotprod_x86.h>
+
+/*
+ * --- 3DNow! version ---
+ */
+
+gr_fir_ccf_3dnow::gr_fir_ccf_3dnow ()
+ : gr_fir_ccf_simd ()
+{
+ d_fcomplex_dotprod = fcomplex_dotprod_3dnow;
+}
+
+gr_fir_ccf_3dnow::gr_fir_ccf_3dnow (const std::vector<float> &new_taps)
+ : gr_fir_ccf_simd (new_taps)
+{
+ d_fcomplex_dotprod = fcomplex_dotprod_3dnow;
+}
+
+
+/*
+ * --- SSE version ---
+ */
+
+gr_fir_ccf_sse::gr_fir_ccf_sse ()
+ : gr_fir_ccf_simd ()
+{
+ d_fcomplex_dotprod = fcomplex_dotprod_sse;
+}
+
+gr_fir_ccf_sse::gr_fir_ccf_sse (const std::vector<float> &new_taps)
+ : gr_fir_ccf_simd (new_taps)
+{
+ d_fcomplex_dotprod = fcomplex_dotprod_sse;
+}
diff --git a/gnuradio-core/src/lib/filter/gr_fir_ccf_x86.h b/gnuradio-core/src/lib/filter/gr_fir_ccf_x86.h
new file mode 100644
index 000000000..6b260c3db
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_fir_ccf_x86.h
@@ -0,0 +1,51 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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_FIR_CCF_X86_H
+#define INCLUDED_GR_FIR_CCF_X86_H
+
+#include <gr_core_api.h>
+#include <gr_fir_ccf_simd.h>
+
+/*!
+ * \brief 3DNow! version of gr_fir_ccf
+ * \ingroup filter_primitive
+ */
+class GR_CORE_API gr_fir_ccf_3dnow : public gr_fir_ccf_simd
+{
+public:
+ gr_fir_ccf_3dnow ();
+ gr_fir_ccf_3dnow (const std::vector<float> &taps);
+};
+
+/*!
+ * \brief SSE version of gr_fir_ccf
+ * \ingroup filter_primitive
+ */
+class GR_CORE_API gr_fir_ccf_sse : public gr_fir_ccf_simd
+{
+public:
+ gr_fir_ccf_sse ();
+ gr_fir_ccf_sse (const std::vector<float> &taps);
+};
+
+#endif
diff --git a/gnuradio-core/src/lib/filter/gr_fir_fcc_simd.cc b/gnuradio-core/src/lib/filter/gr_fir_fcc_simd.cc
new file mode 100644
index 000000000..5b75a43fd
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_fir_fcc_simd.cc
@@ -0,0 +1,139 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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 <gr_fir_fcc_simd.h>
+
+#include <assert.h>
+#include <malloc16.h>
+#include <iostream>
+
+using std::cerr;
+using std::endl;
+
+gr_fir_fcc_simd::gr_fir_fcc_simd ()
+ : gr_fir_fcc_generic ()
+{
+ // cerr << "@@@ gr_fir_fcc_simd\n";
+
+ d_fcomplex_dotprod = 0;
+
+ d_aligned_taps[0] = 0;
+ d_aligned_taps[1] = 0;
+ d_aligned_taps[2] = 0;
+ d_aligned_taps[3] = 0;
+}
+
+gr_fir_fcc_simd::gr_fir_fcc_simd (const std::vector<gr_complex> &new_taps)
+ : gr_fir_fcc_generic (new_taps)
+{
+ // cerr << "@@@ gr_fir_fcc_simd\n";
+
+ d_fcomplex_dotprod = 0;
+
+ d_aligned_taps[0] = 0;
+ d_aligned_taps[1] = 0;
+ d_aligned_taps[2] = 0;
+ d_aligned_taps[3] = 0;
+ set_taps (new_taps);
+}
+
+gr_fir_fcc_simd::~gr_fir_fcc_simd ()
+{
+ free16Align (d_aligned_taps[0]);
+ free16Align (d_aligned_taps[1]);
+ free16Align (d_aligned_taps[2]);
+ free16Align (d_aligned_taps[3]);
+}
+
+void
+gr_fir_fcc_simd::set_taps (const std::vector<gr_complex> &inew_taps)
+{
+ gr_fir_fcc::set_taps (inew_taps); // call superclass
+ const std::vector<gr_complex> new_taps = gr_reverse(inew_taps);
+
+ unsigned len = new_taps.size ();
+
+ // Make 4 copies of the coefficients, one for each data alignment
+ // Note use of special 16-byte-aligned version of calloc()
+
+ for (unsigned i = 0; i < 4; i++){
+ free16Align (d_aligned_taps[i]); // free old value
+
+ // this works because the bit representation of a IEEE floating point
+ // +zero is all zeros. If you're using a different representation,
+ // you'll need to explictly set the result to the appropriate 0.0 value.
+
+ d_aligned_taps[i] = (float *) calloc16Align (1 + (len + i - 1) / 2,
+ 2 * 4 * sizeof (float));
+ if (d_aligned_taps[i] == 0){
+ // throw something...
+ cerr << "@@@ gr_fir_fcc_simd d_aligned_taps[" << i << "] == 0\n";
+ }
+
+ for (unsigned j = 0; j < len; j++) {
+ d_aligned_taps[i][2*(j+i)] = new_taps[j].real();
+ d_aligned_taps[i][2*(j+i)+1] = new_taps[j].imag();
+ }
+ }
+}
+
+gr_complex
+gr_fir_fcc_simd::filter (const float input[])
+{
+ if (ntaps () == 0)
+ return 0.0;
+
+
+ // Round input data address down to 16 byte boundary
+ // NB: depending on the alignment of input[], memory
+ // before input[] will be accessed. The contents don't matter since
+ // they'll be multiplied by zero coefficients. I can't conceive of any
+ // situation where this could cause a segfault since memory protection
+ // in the x86 machines is done on much larger boundaries.
+
+ const float *ar = (float *)((unsigned long) input & ~15);
+
+ // Choose one of 4 sets of pre-shifted coefficients. al is both the
+ // index into d_aligned_taps[] and the number of 0 words padded onto
+ // that coefficients array for alignment purposes.
+
+ unsigned al = input - ar;
+
+ // call assembler routine to do the work, passing number of 2x4-float blocks.
+
+ // assert (((unsigned long) ar & 15) == 0);
+ // assert (((unsigned long) d_aligned_taps[al] & 15) == 0);
+
+ // cerr << "ar: " << ar << " d_aligned_taps[ar]: " << d_aligned_taps[al]
+ // << " (ntaps() + al - 1)/2 + 1: " << (ntaps() + al -1) / 2 + 1 << endl;
+
+ float result[2];
+
+ d_fcomplex_dotprod (ar, d_aligned_taps[al], (ntaps() + al - 1) / 2 + 1, result);
+
+ // cerr << "result = " << result[0] << " " << result[1] << endl;
+
+ return gr_complex(result[0], result[1]);
+}
diff --git a/gnuradio-core/src/lib/filter/gr_fir_fcc_simd.h b/gnuradio-core/src/lib/filter/gr_fir_fcc_simd.h
new file mode 100644
index 000000000..b7463070b
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_fir_fcc_simd.h
@@ -0,0 +1,66 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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_FIR_FCC_SIMD_H
+#define INCLUDED_GR_FIR_FCC_SIMD_H
+
+#include <gr_core_api.h>
+#include <gr_fir_fcc_generic.h>
+
+
+/*!
+ * \brief common base class for SIMD versions of gr_fir_fcc
+ * \ingroup filter_primitive
+ *
+ * This base class handles alignment issues common to SSE and 3DNOW
+ * subclasses.
+ */
+
+class GR_CORE_API gr_fir_fcc_simd : public gr_fir_fcc_generic
+{
+protected:
+ typedef void (*fcomplex_dotprod_t)(const float *input,
+ const float *taps,
+ unsigned n_2_complex_blocks,
+ float *result);
+
+ /*!
+ * \p aligned_taps holds 4 copies of the coefficients preshifted
+ * by 0, 1, 2, or 3 float pairs to meet all possible input data alignments.
+ * This allows us to always fetch data and taps that are 128-bit aligned.
+ */
+ float *d_aligned_taps[4];
+
+ fcomplex_dotprod_t d_fcomplex_dotprod; // fast dot product primitive
+
+public:
+
+ // CREATORS
+ gr_fir_fcc_simd ();
+ gr_fir_fcc_simd (const std::vector<gr_complex> &taps);
+ ~gr_fir_fcc_simd ();
+
+ // MANIPULATORS
+ virtual void set_taps (const std::vector<gr_complex> &taps);
+ virtual gr_complex filter (const float input[]);
+};
+
+#endif
diff --git a/gnuradio-core/src/lib/filter/gr_fir_fcc_x86.cc b/gnuradio-core/src/lib/filter/gr_fir_fcc_x86.cc
new file mode 100644
index 000000000..d9904133c
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_fir_fcc_x86.cc
@@ -0,0 +1,60 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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 <gr_fir_fcc_x86.h>
+#include <fcomplex_dotprod_x86.h>
+
+/*
+ * --- 3DNow! version ---
+ */
+
+gr_fir_fcc_3dnow::gr_fir_fcc_3dnow ()
+ : gr_fir_fcc_simd ()
+{
+ d_fcomplex_dotprod = fcomplex_dotprod_3dnow;
+}
+
+gr_fir_fcc_3dnow::gr_fir_fcc_3dnow (const std::vector<gr_complex> &new_taps)
+ : gr_fir_fcc_simd (new_taps)
+{
+ d_fcomplex_dotprod = fcomplex_dotprod_3dnow;
+}
+
+
+/*
+ * --- SSE version ---
+ */
+
+gr_fir_fcc_sse::gr_fir_fcc_sse ()
+ : gr_fir_fcc_simd ()
+{
+ d_fcomplex_dotprod = fcomplex_dotprod_sse;
+}
+
+gr_fir_fcc_sse::gr_fir_fcc_sse (const std::vector<gr_complex> &new_taps)
+ : gr_fir_fcc_simd (new_taps)
+{
+ d_fcomplex_dotprod = fcomplex_dotprod_sse;
+}
diff --git a/gnuradio-core/src/lib/filter/gr_fir_fcc_x86.h b/gnuradio-core/src/lib/filter/gr_fir_fcc_x86.h
new file mode 100644
index 000000000..3fc6c4855
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_fir_fcc_x86.h
@@ -0,0 +1,51 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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_FIR_FCC_X86_H
+#define INCLUDED_GR_FIR_FCC_X86_H
+
+#include <gr_core_api.h>
+#include <gr_fir_fcc_simd.h>
+
+/*!
+ * \brief 3DNow! version of gr_fir_fcc
+ * \ingroup filter_primitive
+ */
+class GR_CORE_API gr_fir_fcc_3dnow : public gr_fir_fcc_simd
+{
+public:
+ gr_fir_fcc_3dnow ();
+ gr_fir_fcc_3dnow (const std::vector<gr_complex> &taps);
+};
+
+/*!
+ * \brief SSE version of gr_fir_fcc
+ * \ingroup filter_blk
+ */
+class GR_CORE_API gr_fir_fcc_sse : public gr_fir_fcc_simd
+{
+public:
+ gr_fir_fcc_sse ();
+ gr_fir_fcc_sse (const std::vector<gr_complex> &taps);
+};
+
+#endif
diff --git a/gnuradio-core/src/lib/filter/gr_fir_fff_altivec.cc b/gnuradio-core/src/lib/filter/gr_fir_fff_altivec.cc
new file mode 100644
index 000000000..b81283ce5
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_fir_fff_altivec.cc
@@ -0,0 +1,84 @@
+/* -*- 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 this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <gr_fir_fff_altivec.h>
+#include <stdexcept>
+#include <assert.h>
+#include <gr_math.h>
+#include <gr_altivec.h>
+#include <dotprod_fff_altivec.h>
+#include <string.h>
+#include "posix_memalign.h"
+
+gr_fir_fff_altivec::gr_fir_fff_altivec()
+ : gr_fir_fff_generic(),
+ d_naligned_taps(0), d_aligned_taps(0)
+{
+}
+
+gr_fir_fff_altivec::gr_fir_fff_altivec (const std::vector<float> &new_taps)
+ : gr_fir_fff_generic(new_taps),
+ d_naligned_taps(0), d_aligned_taps(0)
+{
+ set_taps(new_taps);
+}
+
+gr_fir_fff_altivec::~gr_fir_fff_altivec()
+{
+ if (d_aligned_taps){
+ free(d_aligned_taps);
+ d_aligned_taps = 0;
+ }
+}
+
+void
+gr_fir_fff_altivec::set_taps(const std::vector<float> &inew_taps)
+{
+ gr_fir_fff_generic::set_taps(inew_taps); // call superclass
+ d_naligned_taps = gr_p2_round_up(ntaps(), FLOATS_PER_VEC);
+
+ if (d_aligned_taps){
+ free(d_aligned_taps);
+ d_aligned_taps = 0;
+ }
+ void *p;
+ int r = posix_memalign(&p, sizeof(vec_float4), d_naligned_taps * sizeof(d_aligned_taps[0]));
+ if (r != 0){
+ throw std::bad_alloc();
+ }
+ d_aligned_taps = (float *) p;
+ memcpy(d_aligned_taps, &d_taps[0], ntaps() * sizeof(d_aligned_taps[0]));
+ for (size_t i = ntaps(); i < d_naligned_taps; i++)
+ d_aligned_taps[i] = 0.0;
+}
+
+
+float
+gr_fir_fff_altivec::filter (const float input[])
+{
+ if (d_naligned_taps == 0)
+ return 0.0;
+
+ return dotprod_fff_altivec(input, d_aligned_taps, d_naligned_taps);
+}
diff --git a/gnuradio-core/src/lib/filter/gr_fir_fff_altivec.h b/gnuradio-core/src/lib/filter/gr_fir_fff_altivec.h
new file mode 100644
index 000000000..a3d4a2aae
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_fir_fff_altivec.h
@@ -0,0 +1,46 @@
+/* -*- 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 this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+#ifndef INCLUDED_GR_FIR_FFF_ALTIVEC_H
+#define INCLUDED_GR_FIR_FFF_ALTIVEC_H
+
+#include <gr_core_api.h>
+#include <gr_fir_fff_generic.h>
+
+/*!
+ * \brief altivec version of gr_fir_fff
+ */
+class GR_CORE_API gr_fir_fff_altivec : public gr_fir_fff_generic
+{
+protected:
+
+ size_t d_naligned_taps; // number of taps (multiple of 4)
+ float *d_aligned_taps; // 16-byte aligned, and zero padded to multiple of 4
+
+public:
+ gr_fir_fff_altivec();
+ gr_fir_fff_altivec(const std::vector<float> &taps);
+ ~gr_fir_fff_altivec();
+
+ virtual void set_taps (const std::vector<float> &taps);
+ virtual float filter (const float input[]);
+};
+
+#endif /* INCLUDED_GR_FIR_FFF_ALTIVEC_H */
diff --git a/gnuradio-core/src/lib/filter/gr_fir_fff_armv7_a.cc b/gnuradio-core/src/lib/filter/gr_fir_fff_armv7_a.cc
new file mode 100644
index 000000000..b43725420
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_fir_fff_armv7_a.cc
@@ -0,0 +1,86 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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 this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <gr_fir_fff_armv7_a.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdexcept>
+#include <assert.h>
+#include <gr_math.h>
+#include <dotprod_fff_armv7_a.h>
+
+#define FLOATS_PER_VEC 8
+
+gr_fir_fff_armv7_a::gr_fir_fff_armv7_a()
+ : gr_fir_fff_generic(),
+ d_naligned_taps(0), d_aligned_taps(0)
+{
+}
+
+gr_fir_fff_armv7_a::gr_fir_fff_armv7_a (const std::vector<float> &new_taps)
+ : gr_fir_fff_generic(new_taps),
+ d_naligned_taps(0), d_aligned_taps(0)
+{
+ set_taps(new_taps);
+}
+
+gr_fir_fff_armv7_a::~gr_fir_fff_armv7_a()
+{
+ if (d_aligned_taps){
+ free(d_aligned_taps);
+ d_aligned_taps = 0;
+ }
+}
+
+void
+gr_fir_fff_armv7_a::set_taps(const std::vector<float> &inew_taps)
+{
+ gr_fir_fff_generic::set_taps(inew_taps); // call superclass
+ d_naligned_taps = gr_p2_round_up(ntaps(), FLOATS_PER_VEC);
+
+ if (d_aligned_taps){
+ free(d_aligned_taps);
+ d_aligned_taps = 0;
+ }
+ void *p;
+ int r = posix_memalign(&p, sizeof(float), d_naligned_taps * sizeof(d_aligned_taps[0]));
+ if (r != 0){
+ throw std::bad_alloc();
+ }
+ d_aligned_taps = (float *) p;
+ memcpy(d_aligned_taps, &d_taps[0], ntaps() * sizeof(d_aligned_taps[0]));
+ for (size_t i = ntaps(); i < d_naligned_taps; i++)
+ d_aligned_taps[i] = 0.0;
+}
+
+
+float
+gr_fir_fff_armv7_a::filter (const float input[])
+{
+ if (d_naligned_taps == 0)
+ return 0.0;
+
+ return dotprod_fff_armv7_a(input, d_aligned_taps, d_naligned_taps);
+}
diff --git a/gnuradio-core/src/lib/filter/gr_fir_fff_armv7_a.h b/gnuradio-core/src/lib/filter/gr_fir_fff_armv7_a.h
new file mode 100644
index 000000000..78863d286
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_fir_fff_armv7_a.h
@@ -0,0 +1,46 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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 this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+#ifndef INCLUDED_GR_FIR_FFF_ARMV7_A_H
+#define INCLUDED_GR_FIR_FFF_ARMV7_A_H
+
+#include <gr_core_api.h>
+#include <gr_fir_fff_generic.h>
+
+/*!
+ * \brief armv7_a using NEON coprocessor version of gr_fir_fff
+ */
+class GR_CORE_API gr_fir_fff_armv7_a : public gr_fir_fff_generic
+{
+protected:
+
+ size_t d_naligned_taps; // number of taps (multiple of 4)
+ float *d_aligned_taps; // 16-byte aligned, and zero padded to multiple of 4
+
+public:
+ gr_fir_fff_armv7_a();
+ gr_fir_fff_armv7_a(const std::vector<float> &taps);
+ ~gr_fir_fff_armv7_a();
+
+ virtual void set_taps (const std::vector<float> &taps);
+ virtual float filter (const float input[]);
+};
+
+#endif /* INCLUDED_GR_FIR_FFF_ARMV7_A*_H */
diff --git a/gnuradio-core/src/lib/filter/gr_fir_fff_simd.cc b/gnuradio-core/src/lib/filter/gr_fir_fff_simd.cc
new file mode 100644
index 000000000..d6c28ed45
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_fir_fff_simd.cc
@@ -0,0 +1,134 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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 <gr_fir_fff_simd.h>
+
+#include <assert.h>
+#include <malloc16.h>
+#include <iostream>
+
+using std::cerr;
+
+gr_fir_fff_simd::gr_fir_fff_simd ()
+ : gr_fir_fff_generic ()
+{
+ // cerr << "@@@ gr_fir_fff_simd\n";
+
+ d_float_dotprod = 0;
+
+ d_aligned_taps[0] = 0;
+ d_aligned_taps[1] = 0;
+ d_aligned_taps[2] = 0;
+ d_aligned_taps[3] = 0;
+}
+
+gr_fir_fff_simd::gr_fir_fff_simd (const std::vector<float> &new_taps)
+ : gr_fir_fff_generic (new_taps)
+{
+ // cerr << "@@@ gr_fir_fff_simd\n";
+
+ d_float_dotprod = 0;
+
+ d_aligned_taps[0] = 0;
+ d_aligned_taps[1] = 0;
+ d_aligned_taps[2] = 0;
+ d_aligned_taps[3] = 0;
+ set_taps (new_taps);
+}
+
+gr_fir_fff_simd::~gr_fir_fff_simd ()
+{
+ free16Align (d_aligned_taps[0]);
+ free16Align (d_aligned_taps[1]);
+ free16Align (d_aligned_taps[2]);
+ free16Align (d_aligned_taps[3]);
+}
+
+void
+gr_fir_fff_simd::set_taps (const std::vector<float> &inew_taps)
+{
+ gr_fir_fff::set_taps (inew_taps); // call superclass
+ const std::vector<float> new_taps = gr_reverse(inew_taps);
+
+ unsigned len = new_taps.size ();
+
+ // Make 4 copies of the coefficients, one for each data alignment
+ // Note use of special 16-byte-aligned version of calloc()
+
+ for (unsigned i = 0; i < 4; i++){
+ free16Align (d_aligned_taps[i]); // free old value
+
+ // this works because the bit representation of a IEEE floating point
+ // +zero is all zeros. If you're using a different representation,
+ // you'll need to explictly set the result to the appropriate 0.0 value.
+
+ d_aligned_taps[i] = (float *) calloc16Align (1 + (len + i - 1) / 4,
+ 4 * sizeof (float));
+ if (d_aligned_taps[i] == 0){
+ // throw something...
+ cerr << "@@@ gr_fir_fff_simd d_aligned_taps[" << i << "] == 0\n";
+ }
+
+ for (unsigned j = 0; j < len; j++)
+ d_aligned_taps[i][j+i] = new_taps[j];
+ }
+}
+
+float
+gr_fir_fff_simd::filter (const float input[])
+{
+ if (ntaps () == 0)
+ return 0.0;
+
+
+ // Round input data address down to 16 byte boundary
+ // NB: depending on the alignment of input[], memory
+ // before input[] will be accessed. The contents don't matter since
+ // they'll be multiplied by zero coefficients. I can't conceive of any
+ // situation where this could cause a segfault since memory protection
+ // in the x86 machines is done on much larger boundaries.
+
+ const float *ar = (float *)((unsigned long) input & ~15);
+
+ // Choose one of 4 sets of pre-shifted coefficients. al is both the
+ // index into d_aligned_taps[] and the number of 0 words padded onto
+ // that coefficients array for alignment purposes.
+
+ unsigned al = input - ar;
+
+ // call assembler routine to do the work, passing number of 4-float blocks.
+
+ // assert (((unsigned long) ar & 15) == 0);
+ // assert (((unsigned long) d_aligned_taps[al] & 15) == 0);
+
+ // cerr << "ar: " << ar << " d_aligned_taps[ar]: " << d_aligned_taps[al]
+ // << " (ntaps() + al - 1)/4 + 1: " << (ntaps() + al -1) / 4 + 1 << endl;
+
+ float r = d_float_dotprod (ar, d_aligned_taps[al], (ntaps() + al - 1) / 4 + 1);
+
+ // cerr << "result = " << r << endl;
+
+ return r;
+}
diff --git a/gnuradio-core/src/lib/filter/gr_fir_fff_simd.h b/gnuradio-core/src/lib/filter/gr_fir_fff_simd.h
new file mode 100644
index 000000000..9d6106266
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_fir_fff_simd.h
@@ -0,0 +1,64 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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_FIR_FFF_SIMD_H
+#define INCLUDED_GR_FIR_FFF_SIMD_H
+
+#include <gr_core_api.h>
+#include <gr_fir_fff_generic.h>
+
+/*!
+ * \brief common base class for SIMD versions of gr_fir_fff
+ * \ingroup filter_primitive
+ *
+ * This base class handles alignment issues common to SSE and 3DNOW
+ * subclasses.
+ */
+
+class GR_CORE_API gr_fir_fff_simd : public gr_fir_fff_generic
+{
+protected:
+ typedef float (*float_dotprod_t)(const float *input,
+ const float *taps,
+ unsigned n_4_float_blocks);
+
+ /*!
+ * \p aligned_taps holds 4 copies of the coefficients preshifted
+ * by 0, 1, 2, or 3 floats to meet all possible input data alignments.
+ * This allows us to always fetch data and taps that are 128-bit aligned.
+ */
+ float *d_aligned_taps[4];
+
+ float_dotprod_t d_float_dotprod; // fast dot product primitive
+
+public:
+
+ // CREATORS
+ gr_fir_fff_simd ();
+ gr_fir_fff_simd (const std::vector<float> &taps);
+ ~gr_fir_fff_simd ();
+
+ // MANIPULATORS
+ virtual void set_taps (const std::vector<float> &taps);
+ virtual float filter (const float input[]);
+};
+
+#endif
diff --git a/gnuradio-core/src/lib/filter/gr_fir_fff_x86.cc b/gnuradio-core/src/lib/filter/gr_fir_fff_x86.cc
new file mode 100644
index 000000000..40ac266be
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_fir_fff_x86.cc
@@ -0,0 +1,60 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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 <gr_fir_fff_x86.h>
+#include <float_dotprod_x86.h>
+
+/*
+ * --- 3DNow! version ---
+ */
+
+gr_fir_fff_3dnow::gr_fir_fff_3dnow ()
+ : gr_fir_fff_simd ()
+{
+ d_float_dotprod = float_dotprod_3dnow;
+}
+
+gr_fir_fff_3dnow::gr_fir_fff_3dnow (const std::vector<float> &new_taps)
+ : gr_fir_fff_simd (new_taps)
+{
+ d_float_dotprod = float_dotprod_3dnow;
+}
+
+
+/*
+ * --- SSE version ---
+ */
+
+gr_fir_fff_sse::gr_fir_fff_sse ()
+ : gr_fir_fff_simd ()
+{
+ d_float_dotprod = float_dotprod_sse;
+}
+
+gr_fir_fff_sse::gr_fir_fff_sse (const std::vector<float> &new_taps)
+ : gr_fir_fff_simd (new_taps)
+{
+ d_float_dotprod = float_dotprod_sse;
+}
diff --git a/gnuradio-core/src/lib/filter/gr_fir_fff_x86.h b/gnuradio-core/src/lib/filter/gr_fir_fff_x86.h
new file mode 100644
index 000000000..8d451f0c9
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_fir_fff_x86.h
@@ -0,0 +1,49 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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_FIR_FFF_X86_H
+#define INCLUDED_GR_FIR_FFF_X86_H
+
+#include <gr_core_api.h>
+#include <gr_fir_fff_simd.h>
+
+/*!
+ * \brief 3DNow! version of gr_fir_fff
+ */
+class GR_CORE_API gr_fir_fff_3dnow : public gr_fir_fff_simd
+{
+public:
+ gr_fir_fff_3dnow ();
+ gr_fir_fff_3dnow (const std::vector<float> &taps);
+};
+
+/*!
+ * \brief SSE version of gr_fir_fff
+ */
+class GR_CORE_API gr_fir_fff_sse : public gr_fir_fff_simd
+{
+public:
+ gr_fir_fff_sse ();
+ gr_fir_fff_sse (const std::vector<float> &taps);
+};
+
+#endif
diff --git a/gnuradio-core/src/lib/filter/gr_fir_filter_XXX.cc.t b/gnuradio-core/src/lib/filter/gr_fir_filter_XXX.cc.t
new file mode 100644
index 000000000..39bc75630
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_fir_filter_XXX.cc.t
@@ -0,0 +1,94 @@
+/* -*- 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: This file is automatically generated by generate_gr_fir_filter_XXX.py
+ * Any changes made to this file will be overwritten.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <@NAME@.h>
+#include <@FIR_TYPE@.h>
+#include <gr_fir_util.h>
+#include <gr_io_signature.h>
+
+@SPTR_NAME@ gr_make_@BASE_NAME@ (int decimation, const std::vector<@TAP_TYPE@> &taps)
+{
+ return gnuradio::get_initial_sptr (new @NAME@ (decimation, taps));
+}
+
+
+@NAME@::@NAME@ (int decimation, const std::vector<@TAP_TYPE@> &taps)
+ : gr_sync_decimator ("@BASE_NAME@",
+ gr_make_io_signature (1, 1, sizeof (@I_TYPE@)),
+ gr_make_io_signature (1, 1, sizeof (@O_TYPE@)),
+ decimation),
+ d_updated (false)
+{
+ d_fir = gr_fir_util::create_@FIR_TYPE@ (taps);
+ set_history (d_fir->ntaps ());
+}
+
+@NAME@::~@NAME@ ()
+{
+ delete d_fir;
+}
+
+void
+@NAME@::set_taps (const std::vector<@TAP_TYPE@> &taps)
+{
+ d_new_taps = taps;
+ d_updated = true;
+}
+
+std::vector<@TAP_TYPE@>
+@NAME@::taps () const
+{
+ return d_new_taps;
+}
+
+int
+@NAME@::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ @I_TYPE@ *in = (@I_TYPE@ *) input_items[0];
+ @O_TYPE@ *out = (@O_TYPE@ *) output_items[0];
+
+ if (d_updated) {
+ d_fir->set_taps (d_new_taps);
+ set_history (d_fir->ntaps ());
+ d_updated = false;
+ return 0; // history requirements may have changed.
+ }
+
+ if (decimation() == 1)
+ d_fir->filterN (out, in, noutput_items);
+
+ else
+ d_fir->filterNdec (out, in, noutput_items, decimation());
+
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/filter/gr_fir_filter_XXX.h.t b/gnuradio-core/src/lib/filter/gr_fir_filter_XXX.h.t
new file mode 100644
index 000000000..b32e04bd3
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_fir_filter_XXX.h.t
@@ -0,0 +1,69 @@
+/* -*- 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: This file is automatically generated by generate_gr_fir_filter_XXX.py
+ * Any changes made to this file will be overwritten.
+ */
+
+#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 decimation, const std::vector<@TAP_TYPE@> &taps);
+
+class @FIR_TYPE@;
+
+/*!
+ * \brief FIR filter with @I_TYPE@ input, @O_TYPE@ output and @TAP_TYPE@ taps
+ * \ingroup filter_blk
+ */
+class GR_CORE_API @NAME@ : public gr_sync_decimator
+{
+ private:
+ friend GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (int decimation, const std::vector<@TAP_TYPE@> &taps);
+
+ @FIR_TYPE@ *d_fir;
+ std::vector<@TAP_TYPE@> d_new_taps;
+ bool d_updated;
+
+ /*!
+ * Construct a FIR filter with the given taps
+ */
+ @NAME@ (int decimation, const std::vector<@TAP_TYPE@> &taps);
+
+ public:
+ ~@NAME@ ();
+
+ void set_taps (const std::vector<@TAP_TYPE@> &taps);
+ std::vector<@TAP_TYPE@> taps () const;
+
+ 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/filter/gr_fir_filter_XXX.i.t b/gnuradio-core/src/lib/filter/gr_fir_filter_XXX.i.t
new file mode 100644
index 000000000..d9dc86180
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_fir_filter_XXX.i.t
@@ -0,0 +1,42 @@
+/* -*- 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: This file is automatically generated by generate_GrFIRfilterXXX.py
+ * Any changes made to this file will be overwritten.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@)
+
+@SPTR_NAME@ gr_make_@BASE_NAME@ (int decimation, const std::vector<@TAP_TYPE@> &taps);
+
+class @NAME@ : public gr_sync_decimator
+{
+ private:
+ @NAME@ (int decimation, const std::vector<@TAP_TYPE@> &taps);
+
+ public:
+ ~@NAME@ ();
+
+ void set_taps (const std::vector<@TAP_TYPE@> &taps);
+ std::vector<@TAP_TYPE@> taps () const;
+};
diff --git a/gnuradio-core/src/lib/filter/gr_fir_fsf_simd.cc b/gnuradio-core/src/lib/filter/gr_fir_fsf_simd.cc
new file mode 100644
index 000000000..a49503e6a
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_fir_fsf_simd.cc
@@ -0,0 +1,133 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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 <gr_fir_fsf_simd.h>
+
+#include <assert.h>
+#include <malloc16.h>
+#include <iostream>
+
+using std::cerr;
+
+gr_fir_fsf_simd::gr_fir_fsf_simd ()
+ : gr_fir_fsf_generic ()
+{
+ // cerr << "@@@ gr_fir_fsf_simd\n";
+
+ d_float_dotprod = 0;
+
+ d_aligned_taps[0] = 0;
+ d_aligned_taps[1] = 0;
+ d_aligned_taps[2] = 0;
+ d_aligned_taps[3] = 0;
+}
+
+gr_fir_fsf_simd::gr_fir_fsf_simd (const std::vector<float> &new_taps)
+ : gr_fir_fsf_generic (new_taps)
+{
+ // cerr << "@@@ gr_fir_fsf_simd\n";
+
+ d_float_dotprod = 0;
+
+ d_aligned_taps[0] = 0;
+ d_aligned_taps[1] = 0;
+ d_aligned_taps[2] = 0;
+ d_aligned_taps[3] = 0;
+ set_taps (new_taps);
+}
+
+gr_fir_fsf_simd::~gr_fir_fsf_simd ()
+{
+ free16Align (d_aligned_taps[0]);
+ free16Align (d_aligned_taps[1]);
+ free16Align (d_aligned_taps[2]);
+ free16Align (d_aligned_taps[3]);
+}
+
+void
+gr_fir_fsf_simd::set_taps (const std::vector<float> &inew_taps)
+{
+ gr_fir_fsf::set_taps (inew_taps); // call superclass
+ const std::vector<float> new_taps = gr_reverse(inew_taps);
+ unsigned len = new_taps.size ();
+
+ // Make 4 copies of the coefficients, one for each data alignment
+ // Note use of special 16-byte-aligned version of calloc()
+
+ for (unsigned i = 0; i < 4; i++){
+ free16Align (d_aligned_taps[i]); // free old value
+
+ // this works because the bit representation of a IEEE floating point
+ // +zero is all zeros. If you're using a different representation,
+ // you'll need to explictly set the result to the appropriate 0.0 value.
+
+ d_aligned_taps[i] = (float *) calloc16Align (1 + (len + i - 1) / 4,
+ 4 * sizeof (float));
+ if (d_aligned_taps[i] == 0){
+ // throw something...
+ cerr << "@@@ gr_fir_fsf_simd d_aligned_taps[" << i << "] == 0\n";
+ }
+
+ for (unsigned j = 0; j < len; j++)
+ d_aligned_taps[i][j+i] = new_taps[j];
+ }
+}
+
+short
+gr_fir_fsf_simd::filter (const float input[])
+{
+ if (ntaps () == 0)
+ return 0;
+
+
+ // Round input data address down to 16 byte boundary
+ // NB: depending on the alignment of input[], memory
+ // before input[] will be accessed. The contents don't matter since
+ // they'll be multiplied by zero coefficients. I can't conceive of any
+ // situation where this could cause a segfault since memory protection
+ // in the x86 machines is done on much larger boundaries.
+
+ const float *ar = (float *)((unsigned long) input & ~15);
+
+ // Choose one of 4 sets of pre-shifted coefficients. al is both the
+ // index into d_aligned_taps[] and the number of 0 words padded onto
+ // that coefficients array for alignment purposes.
+
+ unsigned al = input - ar;
+
+ // call assembler routine to do the work, passing number of 4-float blocks.
+
+ // assert (((unsigned long) ar & 15) == 0);
+ // assert (((unsigned long) d_aligned_taps[al] & 15) == 0);
+
+ // cerr << "ar: " << ar << " d_aligned_taps[ar]: " << d_aligned_taps[al]
+ // << " (ntaps() + al - 1)/4 + 1: " << (ntaps() + al -1) / 4 + 1 << endl;
+
+ float r = d_float_dotprod (ar, d_aligned_taps[al], (ntaps() + al - 1) / 4 + 1);
+
+ // cerr << "result = " << r << endl;
+
+ return (short) r; // FIXME? may want to saturate here
+}
diff --git a/gnuradio-core/src/lib/filter/gr_fir_fsf_simd.h b/gnuradio-core/src/lib/filter/gr_fir_fsf_simd.h
new file mode 100644
index 000000000..d63e9dd17
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_fir_fsf_simd.h
@@ -0,0 +1,64 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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 _GR_FIR_FSF_SIMD_H_
+#define _GR_FIR_FSF_SIMD_H_
+
+#include <gr_core_api.h>
+#include <gr_fir_fsf_generic.h>
+
+/*!
+ * \brief common base class for SIMD versions of gr_fir_fsf
+ * \ingroup filter_primitive
+ *
+ * This base class handles alignment issues common to SSE and 3DNOW
+ * subclasses.
+ */
+
+class GR_CORE_API gr_fir_fsf_simd : public gr_fir_fsf_generic
+{
+protected:
+ typedef float (*float_dotprod_t)(const float *input,
+ const float *taps,
+ unsigned n_4_float_blocks);
+
+ /*!
+ * \p aligned_taps holds 4 copies of the coefficients preshifted
+ * by 0, 1, 2, or 3 floats to meet all possible input data alignments.
+ * This allows us to always fetch data and taps that are 128-bit aligned.
+ */
+ float *d_aligned_taps[4];
+
+ float_dotprod_t d_float_dotprod; // fast dot product primitive
+
+public:
+
+ // CREATORS
+ gr_fir_fsf_simd ();
+ gr_fir_fsf_simd (const std::vector<float> &taps);
+ ~gr_fir_fsf_simd ();
+
+ // MANIPULATORS
+ virtual void set_taps (const std::vector<float> &taps);
+ virtual short filter (const float input[]);
+};
+
+#endif
diff --git a/gnuradio-core/src/lib/filter/gr_fir_fsf_x86.cc b/gnuradio-core/src/lib/filter/gr_fir_fsf_x86.cc
new file mode 100644
index 000000000..40ba17d3a
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_fir_fsf_x86.cc
@@ -0,0 +1,60 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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 <gr_fir_fsf_x86.h>
+#include <float_dotprod_x86.h>
+
+/*
+ * --- 3DNow! version ---
+ */
+
+gr_fir_fsf_3dnow::gr_fir_fsf_3dnow ()
+ : gr_fir_fsf_simd ()
+{
+ d_float_dotprod = float_dotprod_3dnow;
+}
+
+gr_fir_fsf_3dnow::gr_fir_fsf_3dnow (const std::vector<float> &new_taps)
+ : gr_fir_fsf_simd (new_taps)
+{
+ d_float_dotprod = float_dotprod_3dnow;
+}
+
+
+/*
+ * --- SSE version ---
+ */
+
+gr_fir_fsf_sse::gr_fir_fsf_sse ()
+ : gr_fir_fsf_simd ()
+{
+ d_float_dotprod = float_dotprod_sse;
+}
+
+gr_fir_fsf_sse::gr_fir_fsf_sse (const std::vector<float> &new_taps)
+ : gr_fir_fsf_simd (new_taps)
+{
+ d_float_dotprod = float_dotprod_sse;
+}
diff --git a/gnuradio-core/src/lib/filter/gr_fir_fsf_x86.h b/gnuradio-core/src/lib/filter/gr_fir_fsf_x86.h
new file mode 100644
index 000000000..df664d5e2
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_fir_fsf_x86.h
@@ -0,0 +1,51 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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_FIR_FSF_X86_H
+#define INCLUDED_GR_FIR_FSF_X86_H
+
+#include <gr_core_api.h>
+#include <gr_fir_fsf_simd.h>
+
+/*!
+ * \brief 3DNow! version of gr_fir_fsf
+ * \ingroup filter_primitive
+ */
+class GR_CORE_API gr_fir_fsf_3dnow : public gr_fir_fsf_simd
+{
+public:
+ gr_fir_fsf_3dnow ();
+ gr_fir_fsf_3dnow (const std::vector<float> &taps);
+};
+
+/*!
+ * \brief SSE version of gr_fir_fsf
+ * \ingroup filter_primitive
+ */
+class GR_CORE_API gr_fir_fsf_sse : public gr_fir_fsf_simd
+{
+public:
+ gr_fir_fsf_sse ();
+ gr_fir_fsf_sse (const std::vector<float> &taps);
+};
+
+#endif
diff --git a/gnuradio-core/src/lib/filter/gr_fir_scc_simd.cc b/gnuradio-core/src/lib/filter/gr_fir_scc_simd.cc
new file mode 100644
index 000000000..0b2dd7e61
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_fir_scc_simd.cc
@@ -0,0 +1,140 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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 <gr_fir_scc_simd.h>
+
+#include <assert.h>
+#include <malloc16.h>
+#include <iostream>
+
+using std::cerr;
+using std::endl;
+
+gr_fir_scc_simd::gr_fir_scc_simd ()
+ : gr_fir_scc_generic ()
+{
+ // cerr << "@@@ gr_fir_scc_simd\n";
+
+ d_complex_dotprod = 0;
+
+ d_aligned_taps[0] = 0;
+ d_aligned_taps[1] = 0;
+ d_aligned_taps[2] = 0;
+ d_aligned_taps[3] = 0;
+}
+
+gr_fir_scc_simd::gr_fir_scc_simd (const std::vector<gr_complex> &new_taps)
+ : gr_fir_scc_generic (new_taps)
+{
+ // cerr << "@@@ gr_fir_scc_simd\n";
+
+ d_complex_dotprod = 0;
+
+ d_aligned_taps[0] = 0;
+ d_aligned_taps[1] = 0;
+ d_aligned_taps[2] = 0;
+ d_aligned_taps[3] = 0;
+ set_taps (new_taps);
+}
+
+gr_fir_scc_simd::~gr_fir_scc_simd ()
+{
+ free16Align (d_aligned_taps[0]);
+ free16Align (d_aligned_taps[1]);
+ free16Align (d_aligned_taps[2]);
+ free16Align (d_aligned_taps[3]);
+}
+
+void
+gr_fir_scc_simd::set_taps (const std::vector<gr_complex> &inew_taps)
+{
+ gr_fir_scc::set_taps (inew_taps); // call superclass
+
+ const std::vector<gr_complex> new_taps = gr_reverse(inew_taps);
+
+ unsigned len = new_taps.size ();
+
+ // Make 4 copies of the coefficients, one for each data alignment
+ // Note use of special 16-byte-aligned version of calloc()
+
+ for (unsigned i = 0; i < 4; i++){
+ free16Align (d_aligned_taps[i]); // free old value
+
+ // this works because the bit representation of a IEEE floating point
+ // +zero is all zeros. If you're using a different representation,
+ // you'll need to explictly set the result to the appropriate 0.0 value.
+
+ d_aligned_taps[i] = (float *) calloc16Align (1 + (len + i - 1) / 2,
+ 2 * 4 * sizeof (float));
+ if (d_aligned_taps[i] == 0){
+ // throw something...
+ cerr << "@@@ gr_fir_scc_simd d_aligned_taps[" << i << "] == 0\n";
+ }
+
+ for (unsigned j = 0; j < len; j++) {
+ d_aligned_taps[i][2*(j+i)] = new_taps[j].real();
+ d_aligned_taps[i][2*(j+i)+1] = new_taps[j].imag();
+ }
+ }
+}
+
+gr_complex
+gr_fir_scc_simd::filter (const short input[])
+{
+ if (ntaps () == 0)
+ return 0.0;
+
+
+ // Round input data address down to 8 byte boundary
+ // NB: depending on the alignment of input[], memory
+ // before input[] will be accessed. The contents don't matter since
+ // they'll be multiplied by zero coefficients. I can't conceive of any
+ // situation where this could cause a segfault since memory protection
+ // in the x86 machines is done on much larger boundaries.
+
+ const short *ar = (short *)((unsigned long) input & ~7);
+
+ // Choose one of 4 sets of pre-shifted coefficients. al is both the
+ // index into d_aligned_taps[] and the number of 0 words padded onto
+ // that coefficients array for alignment purposes.
+
+ unsigned al = input - ar;
+
+ // call assembler routine to do the work, passing number of 2x4-float blocks.
+
+ // assert (((unsigned long) ar & 7) == 0);
+ // assert (((unsigned long) d_aligned_taps[al] & 15) == 0);
+
+ // cerr << "ar: " << ar << " d_aligned_taps[ar]: " << d_aligned_taps[al]
+ // << " (ntaps() + al - 1)/2 + 1: " << (ntaps() + al -1) / 2 + 1 << endl;
+
+ float result[2];
+
+ d_complex_dotprod (ar, d_aligned_taps[al], (ntaps() + al - 1) / 2 + 1, result);
+
+ // cerr << "result = " << result[0] << " " << result[1] << endl;
+
+ return gr_complex(result[0], result[1]);
+}
diff --git a/gnuradio-core/src/lib/filter/gr_fir_scc_simd.h b/gnuradio-core/src/lib/filter/gr_fir_scc_simd.h
new file mode 100644
index 000000000..72c15f93b
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_fir_scc_simd.h
@@ -0,0 +1,65 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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_FIR_SCC_SIMD_H
+#define INCLUDED_GR_FIR_SCC_SIMD_H
+
+#include <gr_core_api.h>
+#include <gr_fir_scc_generic.h>
+
+
+/*!
+ * \brief common base class for SIMD versions of gr_fir_scc
+ * \ingroup filter_primitive
+ *
+ * This base class handles alignment issues common to SSE and 3DNOW
+ * subclasses.
+ */
+class GR_CORE_API gr_fir_scc_simd : public gr_fir_scc_generic
+{
+protected:
+ typedef void (*complex_dotprod_t)(const short *input,
+ const float *taps,
+ unsigned n_2_complex_blocks,
+ float *result);
+
+ /*!
+ * \p aligned_taps holds 4 copies of the coefficients preshifted
+ * by 0, 1, 2, or 3 float pairs to meet all possible input data alignments.
+ * This allows us to always fetch data and taps that are 128-bit aligned.
+ */
+ float *d_aligned_taps[4];
+
+ complex_dotprod_t d_complex_dotprod; // fast dot product primitive
+
+public:
+
+ // CREATORS
+ gr_fir_scc_simd ();
+ gr_fir_scc_simd (const std::vector<gr_complex> &taps);
+ ~gr_fir_scc_simd ();
+
+ // MANIPULATORS
+ virtual void set_taps (const std::vector<gr_complex> &taps);
+ virtual gr_complex filter (const short input[]);
+};
+
+#endif
diff --git a/gnuradio-core/src/lib/filter/gr_fir_scc_x86.cc b/gnuradio-core/src/lib/filter/gr_fir_scc_x86.cc
new file mode 100644
index 000000000..ab0668c63
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_fir_scc_x86.cc
@@ -0,0 +1,77 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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 <gr_fir_scc_x86.h>
+#include <complex_dotprod_x86.h>
+
+/*
+ * --- 3DNow! version ---
+ */
+
+gr_fir_scc_3dnow::gr_fir_scc_3dnow ()
+ : gr_fir_scc_simd ()
+{
+ d_complex_dotprod = complex_dotprod_3dnow;
+}
+
+gr_fir_scc_3dnow::gr_fir_scc_3dnow (const std::vector<gr_complex> &new_taps)
+ : gr_fir_scc_simd (new_taps)
+{
+ d_complex_dotprod = complex_dotprod_3dnow;
+}
+
+
+/*
+ * --- 3DNow! Ext version ---
+ */
+
+gr_fir_scc_3dnowext::gr_fir_scc_3dnowext ()
+ : gr_fir_scc_simd ()
+{
+ d_complex_dotprod = complex_dotprod_3dnowext;
+}
+
+gr_fir_scc_3dnowext::gr_fir_scc_3dnowext (const std::vector<gr_complex> &new_taps)
+ : gr_fir_scc_simd (new_taps)
+{
+ d_complex_dotprod = complex_dotprod_3dnowext;
+}
+
+
+/*
+ * --- SSE version ---
+ */
+
+gr_fir_scc_sse::gr_fir_scc_sse ()
+ : gr_fir_scc_simd ()
+{
+ d_complex_dotprod = complex_dotprod_sse;
+}
+
+gr_fir_scc_sse::gr_fir_scc_sse (const std::vector<gr_complex> &new_taps)
+ : gr_fir_scc_simd (new_taps)
+{
+ d_complex_dotprod = complex_dotprod_sse;
+}
diff --git a/gnuradio-core/src/lib/filter/gr_fir_scc_x86.h b/gnuradio-core/src/lib/filter/gr_fir_scc_x86.h
new file mode 100644
index 000000000..85a63251b
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_fir_scc_x86.h
@@ -0,0 +1,59 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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_FIR_SCC_X86_H
+#define INCLUDED_GR_FIR_SCC_X86_H
+
+#include <gr_core_api.h>
+#include <gr_fir_scc_simd.h>
+
+/*!
+ * \brief 3DNow! version of gr_fir_scc
+ */
+class GR_CORE_API gr_fir_scc_3dnow : public gr_fir_scc_simd
+{
+public:
+ gr_fir_scc_3dnow ();
+ gr_fir_scc_3dnow (const std::vector<gr_complex> &taps);
+};
+
+/*!
+ * \brief 3DNow! Ext version of gr_fir_scc
+ */
+class GR_CORE_API gr_fir_scc_3dnowext : public gr_fir_scc_simd
+{
+public:
+ gr_fir_scc_3dnowext ();
+ gr_fir_scc_3dnowext (const std::vector<gr_complex> &taps);
+};
+
+/*!
+ * \brief SSE version of gr_fir_scc
+ */
+class GR_CORE_API gr_fir_scc_sse : public gr_fir_scc_simd
+{
+public:
+ gr_fir_scc_sse ();
+ gr_fir_scc_sse (const std::vector<gr_complex> &taps);
+};
+
+#endif
diff --git a/gnuradio-core/src/lib/filter/gr_fir_sysconfig_armv7_a.cc b/gnuradio-core/src/lib/filter/gr_fir_sysconfig_armv7_a.cc
new file mode 100644
index 000000000..70adbc092
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_fir_sysconfig_armv7_a.cc
@@ -0,0 +1,337 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002,2008,2009,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.
+ */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <gr_fir_sysconfig_armv7_a.h>
+#include <gr_cpu.h>
+
+#include <gr_fir_ccf.h>
+#include <gr_fir_ccf_generic.h>
+#include <gr_fir_ccf_armv7_a.h>
+#include <gr_fir_fcc.h>
+#include <gr_fir_fcc_generic.h>
+#include <gr_fir_fff.h>
+#include <gr_fir_fff_generic.h>
+#include <gr_fir_fff_armv7_a.h>
+#include <gr_fir_fsf.h>
+#include <gr_fir_fsf_generic.h>
+#include <gr_fir_ccc.h>
+#include <gr_fir_ccc_generic.h>
+#include <gr_fir_scc.h>
+#include <gr_fir_scc_generic.h>
+
+#include <iostream>
+using std::cerr;
+
+///\todo Remove commented out code for altivec and replace with NEON versions.
+
+/*
+ * ----------------------------------------------------------------
+ * static functions that serve as constructors...
+ * ----------------------------------------------------------------
+ */
+
+static gr_fir_ccf *
+make_gr_fir_ccf_armv7_a (const std::vector<float> &taps)
+{
+ return new gr_fir_ccf_armv7_a(taps);
+}
+
+#if 0
+static gr_fir_fcc *
+make_gr_fir_fcc_altivec(const std::vector<gr_complex> &taps)
+{
+ return new gr_fir_fcc_altivec(taps);
+}
+
+static gr_fir_ccc *
+make_gr_fir_ccc_altivec (const std::vector<gr_complex> &taps)
+{
+ return new gr_fir_ccc_altivec (taps);
+}
+#endif
+
+static gr_fir_fff *
+make_gr_fir_fff_armv7_a (const std::vector<float> &taps)
+{
+ return new gr_fir_fff_armv7_a (taps);
+}
+
+#if 0
+static gr_fir_fsf *
+make_gr_fir_fsf_altivec (const std::vector<float> &taps)
+{
+ return new gr_fir_fsf_altivec (taps);
+}
+
+static gr_fir_scc *
+make_gr_fir_scc_altivec(const std::vector<gr_complex> &taps)
+{
+ return new gr_fir_scc_altivec(taps);
+}
+#endif
+
+/*
+ * ----------------------------------------------------------------
+ * Return instances of the fastest arm versions of these classes.
+ *
+ * check CPUID, if has armv7-a, return armv7-a version,
+ * else return generic version. This will break
+ * when someone makes an armv7-a without a NEON
+ * coprocessor.
+ * ----------------------------------------------------------------
+ */
+
+gr_fir_ccf *
+gr_fir_sysconfig_armv7_a::create_gr_fir_ccf (const std::vector<float> &taps)
+{
+ static bool first = true;
+
+ if (gr_cpu::has_armv7_a ()){
+ if (first){
+ cerr << ">>> gr_fir_ccf: using armv7_a\n";
+ first = false;
+ }
+ return make_gr_fir_ccf_armv7_a (taps);
+ }
+
+ if (0 && first){
+ cerr << ">>> gr_fir_ccf: handing off to parent class\n";
+ first = false;
+ }
+ return gr_fir_sysconfig_generic::create_gr_fir_ccf (taps);
+}
+
+gr_fir_fcc *
+gr_fir_sysconfig_armv7_a::create_gr_fir_fcc (const std::vector<gr_complex> &taps)
+{
+ static bool first = true;
+
+#if 0
+ if (gr_cpu::has_altivec ()){
+ if (first){
+ cerr << ">>> gr_fir_fcc: using altivec\n";
+ first = false;
+ }
+ return make_gr_fir_fcc_altivec (taps);
+ }
+#endif
+
+ if (0 && first){
+ cerr << ">>> gr_fir_fcc: handing off to parent class\n";
+ first = false;
+ }
+ return gr_fir_sysconfig_generic::create_gr_fir_fcc (taps);
+}
+
+gr_fir_ccc *
+gr_fir_sysconfig_armv7_a::create_gr_fir_ccc (const std::vector<gr_complex> &taps)
+{
+ static bool first = true;
+
+#if 0
+ if (gr_cpu::has_altivec ()){
+ if (first){
+ cerr << ">>> gr_fir_ccc: using altivec\n";
+ first = false;
+ }
+ return make_gr_fir_ccc_altivec (taps);
+ }
+#endif
+
+ if (0 && first){
+ cerr << ">>> gr_fir_ccc: handing off to parent class\n";
+ first = false;
+ }
+ return gr_fir_sysconfig_generic::create_gr_fir_ccc (taps);
+}
+
+gr_fir_fff *
+gr_fir_sysconfig_armv7_a::create_gr_fir_fff (const std::vector<float> &taps)
+{
+ static bool first = true;
+
+ if (gr_cpu::has_armv7_a ()){
+ if (first){
+ cerr << ">>> gr_fir_fff: using armv7_a\n";
+ first = false;
+ }
+ return make_gr_fir_fff_armv7_a (taps);
+ }
+
+ if (0 && first){
+ cerr << ">>> gr_fir_fff: handing off to parent class\n";
+ first = false;
+ }
+ return gr_fir_sysconfig_generic::create_gr_fir_fff (taps);
+}
+
+gr_fir_fsf *
+gr_fir_sysconfig_armv7_a::create_gr_fir_fsf (const std::vector<float> &taps)
+{
+ static bool first = true;
+
+#if 0
+ if (gr_cpu::has_altivec ()){
+ if (first){
+ cerr << ">>> gr_fir_fsf: using altivec\n";
+ first = false;
+ }
+ return make_gr_fir_fsf_altivec (taps);
+ }
+#endif
+
+ if (0 && first){
+ cerr << ">>> gr_fir_fsf: handing off to parent class\n";
+ first = false;
+ }
+ return gr_fir_sysconfig_generic::create_gr_fir_fsf (taps);
+}
+
+
+gr_fir_scc *
+gr_fir_sysconfig_armv7_a::create_gr_fir_scc (const std::vector<gr_complex> &taps)
+{
+ static bool first = true;
+
+#if 0
+ if (gr_cpu::has_altivec ()){
+ if (first){
+ cerr << ">>> gr_fir_scc: using altivec\n";
+ first = false;
+ }
+ return make_gr_fir_scc_altivec (taps);
+ }
+#endif
+
+ if (0 && first){
+ cerr << ">>> gr_fir_scc: handing off to parent class\n";
+ first = false;
+ }
+ return gr_fir_sysconfig_generic::create_gr_fir_scc (taps);
+}
+
+/*
+ * ----------------------------------------------------------------
+ * Return info about available implementations
+ * ----------------------------------------------------------------
+ */
+
+void
+gr_fir_sysconfig_armv7_a::get_gr_fir_ccf_info (std::vector<gr_fir_ccf_info> *info)
+{
+ // invoke parent..
+ gr_fir_sysconfig_generic::get_gr_fir_ccf_info (info);
+
+ // add our stuff...
+ gr_fir_ccf_info t;
+ if (gr_cpu::has_armv7_a ()){
+ t.name = "armv7_a";
+ t.create = make_gr_fir_ccf_armv7_a;
+ (*info).push_back (t);
+ }
+}
+
+void
+gr_fir_sysconfig_armv7_a::get_gr_fir_fcc_info (std::vector<gr_fir_fcc_info> *info)
+{
+ // invoke parent..
+ gr_fir_sysconfig_generic::get_gr_fir_fcc_info (info);
+
+#if 0
+ // add our stuff...
+ gr_fir_fcc_info t;
+ if (gr_cpu::has_altivec ()){
+ t.name = "altivec";
+ t.create = make_gr_fir_fcc_altivec;
+ (*info).push_back (t);
+ }
+#endif
+}
+
+void
+gr_fir_sysconfig_armv7_a::get_gr_fir_ccc_info (std::vector<gr_fir_ccc_info> *info)
+{
+ // invoke parent..
+ gr_fir_sysconfig_generic::get_gr_fir_ccc_info (info);
+
+#if 0
+ // add our stuff...
+ gr_fir_ccc_info t;
+ if (gr_cpu::has_altivec ()){
+ t.name = "altivec";
+ t.create = make_gr_fir_ccc_altivec;
+ (*info).push_back (t);
+ }
+#endif
+}
+
+void
+gr_fir_sysconfig_armv7_a::get_gr_fir_fff_info (std::vector<gr_fir_fff_info> *info)
+{
+ // invoke parent..
+ gr_fir_sysconfig_generic::get_gr_fir_fff_info (info);
+
+ // add our stuff...
+ gr_fir_fff_info t;
+ if (gr_cpu::has_armv7_a ()){
+ t.name = "armv7_a";
+ t.create = make_gr_fir_fff_armv7_a;
+ (*info).push_back (t);
+ }
+}
+
+void
+gr_fir_sysconfig_armv7_a::get_gr_fir_fsf_info (std::vector<gr_fir_fsf_info> *info)
+{
+ // invoke parent..
+ gr_fir_sysconfig_generic::get_gr_fir_fsf_info (info);
+
+#if 0
+ // add our stuff...
+ gr_fir_fsf_info t;
+ if (gr_cpu::has_altivec ()){
+ t.name = "altivec";
+ t.create = make_gr_fir_fsf_altivec;
+ (*info).push_back (t);
+ }
+#endif
+}
+
+void
+gr_fir_sysconfig_armv7_a::get_gr_fir_scc_info (std::vector<gr_fir_scc_info> *info)
+{
+ // invoke parent..
+ gr_fir_sysconfig_generic::get_gr_fir_scc_info (info);
+
+#if 0
+ // add our stuff...
+ gr_fir_scc_info t;
+ if (gr_cpu::has_altivec ()){
+ t.name = "altivec";
+ t.create = make_gr_fir_scc_altivec;
+ (*info).push_back (t);
+ }
+#endif
+}
diff --git a/gnuradio-core/src/lib/filter/gr_fir_sysconfig_armv7_a.h b/gnuradio-core/src/lib/filter/gr_fir_sysconfig_armv7_a.h
new file mode 100644
index 000000000..7295475f6
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_fir_sysconfig_armv7_a.h
@@ -0,0 +1,47 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002,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.
+ */
+#ifndef INCLUDED_GR_FIR_SYSCONFIG_ARMV7_A_H
+#define INCLUDED_GR_FIR_SYSCONFIG_ARMV7_A_H
+
+#include <gr_core_api.h>
+#include <gr_fir_sysconfig_generic.h>
+
+class GR_CORE_API gr_fir_sysconfig_armv7_a : public gr_fir_sysconfig_generic {
+public:
+ virtual gr_fir_ccf *create_gr_fir_ccf (const std::vector<float> &taps);
+ virtual gr_fir_fcc *create_gr_fir_fcc (const std::vector<gr_complex> &taps);
+ virtual gr_fir_fff *create_gr_fir_fff (const std::vector<float> &taps);
+ virtual gr_fir_fsf *create_gr_fir_fsf (const std::vector<float> &taps);
+ virtual gr_fir_scc *create_gr_fir_scc (const std::vector<gr_complex> &taps);
+ virtual gr_fir_ccc *create_gr_fir_ccc (const std::vector<gr_complex> &taps);
+//virtual gr_fir_sss *create_gr_fir_sss (const std::vector<short> &taps);
+
+ virtual void get_gr_fir_ccf_info (std::vector<gr_fir_ccf_info> *info);
+ virtual void get_gr_fir_fcc_info (std::vector<gr_fir_fcc_info> *info);
+ virtual void get_gr_fir_fff_info (std::vector<gr_fir_fff_info> *info);
+ virtual void get_gr_fir_fsf_info (std::vector<gr_fir_fsf_info> *info);
+ virtual void get_gr_fir_scc_info (std::vector<gr_fir_scc_info> *info);
+ virtual void get_gr_fir_ccc_info (std::vector<gr_fir_ccc_info> *info);
+//virtual void get_gr_fir_sss_info (std::vector<gr_fir_sss_info> *info);
+};
+
+#endif
diff --git a/gnuradio-core/src/lib/filter/gr_fir_sysconfig_powerpc.cc b/gnuradio-core/src/lib/filter/gr_fir_sysconfig_powerpc.cc
new file mode 100644
index 000000000..f706bd5bf
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_fir_sysconfig_powerpc.cc
@@ -0,0 +1,340 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002,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.
+ */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <gr_fir_sysconfig_powerpc.h>
+#include <gr_cpu.h>
+
+#include <gr_fir_ccf.h>
+#include <gr_fir_ccf_generic.h>
+//#include <gr_fir_ccf_altivec.h>
+#include <gr_fir_fcc.h>
+#include <gr_fir_fcc_generic.h>
+//#include <gr_fir_fcc_altivec.h>
+#include <gr_fir_fff.h>
+#include <gr_fir_fff_generic.h>
+#include <gr_fir_fff_altivec.h>
+#include <gr_fir_fsf.h>
+#include <gr_fir_fsf_generic.h>
+//#include <gr_fir_fsf_powerpc.h>
+#include <gr_fir_ccc.h>
+#include <gr_fir_ccc_generic.h>
+//#include <gr_fir_ccc_altivec.h>
+#include <gr_fir_scc.h>
+#include <gr_fir_scc_generic.h>
+//#include <gr_fir_scc_altivec.h>
+
+#include <iostream>
+using std::cerr;
+
+/*
+ * ----------------------------------------------------------------
+ * static functions that serve as constructors...
+ * ----------------------------------------------------------------
+ */
+
+#if 0
+static gr_fir_ccf *
+make_gr_fir_ccf_altivec(const std::vector<float> &taps)
+{
+ return new gr_fir_ccf_altivec(taps);
+}
+
+static gr_fir_fcc *
+make_gr_fir_fcc_altivec(const std::vector<gr_complex> &taps)
+{
+ return new gr_fir_fcc_altivec(taps);
+}
+
+static gr_fir_ccc *
+make_gr_fir_ccc_altivec (const std::vector<gr_complex> &taps)
+{
+ return new gr_fir_ccc_altivec (taps);
+}
+#endif
+
+static gr_fir_fff *
+make_gr_fir_fff_altivec (const std::vector<float> &taps)
+{
+ return new gr_fir_fff_altivec (taps);
+}
+
+#if 0
+static gr_fir_fsf *
+make_gr_fir_fsf_altivec (const std::vector<float> &taps)
+{
+ return new gr_fir_fsf_altivec (taps);
+}
+
+static gr_fir_scc *
+make_gr_fir_scc_altivec(const std::vector<gr_complex> &taps)
+{
+ return new gr_fir_scc_altivec(taps);
+}
+#endif
+
+/*
+ * ----------------------------------------------------------------
+ * Return instances of the fastest powerpc versions of these classes.
+ *
+ * check CPUID, if has altivec, return altivec version,
+ * else return generic version.
+ * ----------------------------------------------------------------
+ */
+
+gr_fir_ccf *
+gr_fir_sysconfig_powerpc::create_gr_fir_ccf (const std::vector<float> &taps)
+{
+ static bool first = true;
+
+#if 0
+ if (gr_cpu::has_altivec ()){
+ if (first){
+ cerr << ">>> gr_fir_ccf: using altivec\n";
+ first = false;
+ }
+ return make_gr_fir_ccf_altivec (taps);
+ }
+#endif
+
+ if (0 && first){
+ cerr << ">>> gr_fir_ccf: handing off to parent class\n";
+ first = false;
+ }
+ return gr_fir_sysconfig_generic::create_gr_fir_ccf (taps);
+}
+
+gr_fir_fcc *
+gr_fir_sysconfig_powerpc::create_gr_fir_fcc (const std::vector<gr_complex> &taps)
+{
+ static bool first = true;
+
+#if 0
+ if (gr_cpu::has_altivec ()){
+ if (first){
+ cerr << ">>> gr_fir_fcc: using altivec\n";
+ first = false;
+ }
+ return make_gr_fir_fcc_altivec (taps);
+ }
+#endif
+
+ if (0 && first){
+ cerr << ">>> gr_fir_fcc: handing off to parent class\n";
+ first = false;
+ }
+ return gr_fir_sysconfig_generic::create_gr_fir_fcc (taps);
+}
+
+gr_fir_ccc *
+gr_fir_sysconfig_powerpc::create_gr_fir_ccc (const std::vector<gr_complex> &taps)
+{
+ static bool first = true;
+
+#if 0
+ if (gr_cpu::has_altivec ()){
+ if (first){
+ cerr << ">>> gr_fir_ccc: using altivec\n";
+ first = false;
+ }
+ return make_gr_fir_ccc_altivec (taps);
+ }
+#endif
+
+ if (0 && first){
+ cerr << ">>> gr_fir_ccc: handing off to parent class\n";
+ first = false;
+ }
+ return gr_fir_sysconfig_generic::create_gr_fir_ccc (taps);
+}
+
+gr_fir_fff *
+gr_fir_sysconfig_powerpc::create_gr_fir_fff (const std::vector<float> &taps)
+{
+ static bool first = true;
+
+ if (gr_cpu::has_altivec ()){
+ if (first){
+ cerr << ">>> gr_fir_fff: using altivec\n";
+ first = false;
+ }
+ return make_gr_fir_fff_altivec (taps);
+ }
+
+ if (0 && first){
+ cerr << ">>> gr_fir_fff: handing off to parent class\n";
+ first = false;
+ }
+ return gr_fir_sysconfig_generic::create_gr_fir_fff (taps);
+}
+
+gr_fir_fsf *
+gr_fir_sysconfig_powerpc::create_gr_fir_fsf (const std::vector<float> &taps)
+{
+ static bool first = true;
+
+#if 0
+ if (gr_cpu::has_altivec ()){
+ if (first){
+ cerr << ">>> gr_fir_fsf: using altivec\n";
+ first = false;
+ }
+ return make_gr_fir_fsf_altivec (taps);
+ }
+#endif
+
+ if (0 && first){
+ cerr << ">>> gr_fir_fsf: handing off to parent class\n";
+ first = false;
+ }
+ return gr_fir_sysconfig_generic::create_gr_fir_fsf (taps);
+}
+
+
+gr_fir_scc *
+gr_fir_sysconfig_powerpc::create_gr_fir_scc (const std::vector<gr_complex> &taps)
+{
+ static bool first = true;
+
+#if 0
+ if (gr_cpu::has_altivec ()){
+ if (first){
+ cerr << ">>> gr_fir_scc: using altivec\n";
+ first = false;
+ }
+ return make_gr_fir_scc_altivec (taps);
+ }
+#endif
+
+ if (0 && first){
+ cerr << ">>> gr_fir_scc: handing off to parent class\n";
+ first = false;
+ }
+ return gr_fir_sysconfig_generic::create_gr_fir_scc (taps);
+}
+
+/*
+ * ----------------------------------------------------------------
+ * Return info about available implementations
+ * ----------------------------------------------------------------
+ */
+
+void
+gr_fir_sysconfig_powerpc::get_gr_fir_ccf_info (std::vector<gr_fir_ccf_info> *info)
+{
+ // invoke parent..
+ gr_fir_sysconfig_generic::get_gr_fir_ccf_info (info);
+
+#if 0
+ // add our stuff...
+ gr_fir_ccf_info t;
+ if (gr_cpu::has_altivec ()){
+ t.name = "altivec";
+ t.create = make_gr_fir_ccf_altivec;
+ (*info).push_back (t);
+ }
+#endif
+}
+
+void
+gr_fir_sysconfig_powerpc::get_gr_fir_fcc_info (std::vector<gr_fir_fcc_info> *info)
+{
+ // invoke parent..
+ gr_fir_sysconfig_generic::get_gr_fir_fcc_info (info);
+
+#if 0
+ // add our stuff...
+ gr_fir_fcc_info t;
+ if (gr_cpu::has_altivec ()){
+ t.name = "altivec";
+ t.create = make_gr_fir_fcc_altivec;
+ (*info).push_back (t);
+ }
+#endif
+}
+
+void
+gr_fir_sysconfig_powerpc::get_gr_fir_ccc_info (std::vector<gr_fir_ccc_info> *info)
+{
+ // invoke parent..
+ gr_fir_sysconfig_generic::get_gr_fir_ccc_info (info);
+
+#if 0
+ // add our stuff...
+ gr_fir_ccc_info t;
+ if (gr_cpu::has_altivec ()){
+ t.name = "altivec";
+ t.create = make_gr_fir_ccc_altivec;
+ (*info).push_back (t);
+ }
+#endif
+}
+
+void
+gr_fir_sysconfig_powerpc::get_gr_fir_fff_info (std::vector<gr_fir_fff_info> *info)
+{
+ // invoke parent..
+ gr_fir_sysconfig_generic::get_gr_fir_fff_info (info);
+
+ // add our stuff...
+ gr_fir_fff_info t;
+ if (gr_cpu::has_altivec ()){
+ t.name = "altivec";
+ t.create = make_gr_fir_fff_altivec;
+ (*info).push_back (t);
+ }
+}
+
+void
+gr_fir_sysconfig_powerpc::get_gr_fir_fsf_info (std::vector<gr_fir_fsf_info> *info)
+{
+ // invoke parent..
+ gr_fir_sysconfig_generic::get_gr_fir_fsf_info (info);
+
+#if 0
+ // add our stuff...
+ gr_fir_fsf_info t;
+ if (gr_cpu::has_altivec ()){
+ t.name = "altivec";
+ t.create = make_gr_fir_fsf_altivec;
+ (*info).push_back (t);
+ }
+#endif
+}
+
+void
+gr_fir_sysconfig_powerpc::get_gr_fir_scc_info (std::vector<gr_fir_scc_info> *info)
+{
+ // invoke parent..
+ gr_fir_sysconfig_generic::get_gr_fir_scc_info (info);
+
+#if 0
+ // add our stuff...
+ gr_fir_scc_info t;
+ if (gr_cpu::has_altivec ()){
+ t.name = "altivec";
+ t.create = make_gr_fir_scc_altivec;
+ (*info).push_back (t);
+ }
+#endif
+}
diff --git a/gnuradio-core/src/lib/filter/gr_fir_sysconfig_powerpc.h b/gnuradio-core/src/lib/filter/gr_fir_sysconfig_powerpc.h
new file mode 100644
index 000000000..09a7a0ba0
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_fir_sysconfig_powerpc.h
@@ -0,0 +1,47 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002,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.
+ */
+#ifndef INCLUDED_GR_FIR_SYSCONFIG_POWERPC_H
+#define INCLUDED_GR_FIR_SYSCONFIG_POWERPC_H
+
+#include <gr_core_api.h>
+#include <gr_fir_sysconfig_generic.h>
+
+class GR_CORE_API gr_fir_sysconfig_powerpc : public gr_fir_sysconfig_generic {
+public:
+ virtual gr_fir_ccf *create_gr_fir_ccf (const std::vector<float> &taps);
+ virtual gr_fir_fcc *create_gr_fir_fcc (const std::vector<gr_complex> &taps);
+ virtual gr_fir_fff *create_gr_fir_fff (const std::vector<float> &taps);
+ virtual gr_fir_fsf *create_gr_fir_fsf (const std::vector<float> &taps);
+ virtual gr_fir_scc *create_gr_fir_scc (const std::vector<gr_complex> &taps);
+ virtual gr_fir_ccc *create_gr_fir_ccc (const std::vector<gr_complex> &taps);
+//virtual gr_fir_sss *create_gr_fir_sss (const std::vector<short> &taps);
+
+ virtual void get_gr_fir_ccf_info (std::vector<gr_fir_ccf_info> *info);
+ virtual void get_gr_fir_fcc_info (std::vector<gr_fir_fcc_info> *info);
+ virtual void get_gr_fir_fff_info (std::vector<gr_fir_fff_info> *info);
+ virtual void get_gr_fir_fsf_info (std::vector<gr_fir_fsf_info> *info);
+ virtual void get_gr_fir_scc_info (std::vector<gr_fir_scc_info> *info);
+ virtual void get_gr_fir_ccc_info (std::vector<gr_fir_ccc_info> *info);
+//virtual void get_gr_fir_sss_info (std::vector<gr_fir_sss_info> *info);
+};
+
+#endif
diff --git a/gnuradio-core/src/lib/filter/gr_fir_sysconfig_x86.cc b/gnuradio-core/src/lib/filter/gr_fir_sysconfig_x86.cc
new file mode 100644
index 000000000..97b810699
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_fir_sysconfig_x86.cc
@@ -0,0 +1,553 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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 <gr_fir_sysconfig_x86.h>
+#include <gr_cpu.h>
+
+#include <gr_fir_ccf.h>
+#include <gr_fir_ccf_generic.h>
+#include <gr_fir_ccf_x86.h>
+#include <gr_fir_fcc.h>
+#include <gr_fir_fcc_generic.h>
+#include <gr_fir_fcc_x86.h>
+#include <gr_fir_fff.h>
+#include <gr_fir_fff_generic.h>
+#include <gr_fir_fff_x86.h>
+#include <gr_fir_fsf.h>
+#include <gr_fir_fsf_generic.h>
+#include <gr_fir_fsf_x86.h>
+#include <gr_fir_ccc.h>
+#include <gr_fir_ccc_generic.h>
+#include <gr_fir_ccc_x86.h>
+#include <gr_fir_scc.h>
+#include <gr_fir_scc_generic.h>
+#include <gr_fir_scc_x86.h>
+// #include <gr_fir_sss.h>
+// #include <gr_fir_sss_generic.h>
+// #include <gr_fir_sss_mmx.h>
+// #include <gr_fir_sss_sse2.h>
+
+#include <iostream>
+using std::cerr;
+
+/*
+ * ----------------------------------------------------------------
+ * static functions that serve as constructors...
+ * Is it possible to take the address of a normal constructor?
+ * ----------------------------------------------------------------
+ */
+
+static gr_fir_ccf *
+make_gr_fir_ccf_3dnow(const std::vector<float> &taps)
+{
+ return new gr_fir_ccf_3dnow(taps);
+}
+
+static gr_fir_ccf *
+make_gr_fir_ccf_sse(const std::vector<float> &taps)
+{
+ return new gr_fir_ccf_sse(taps);
+}
+
+static gr_fir_fcc *
+make_gr_fir_fcc_3dnow(const std::vector<gr_complex> &taps)
+{
+ return new gr_fir_fcc_3dnow(taps);
+}
+
+static gr_fir_fcc *
+make_gr_fir_fcc_sse(const std::vector<gr_complex> &taps)
+{
+ return new gr_fir_fcc_sse(taps);
+}
+
+static gr_fir_ccc *
+make_gr_fir_ccc_3dnow (const std::vector<gr_complex> &taps)
+{
+ return new gr_fir_ccc_3dnow (taps);
+}
+
+static gr_fir_ccc *
+make_gr_fir_ccc_3dnowext (const std::vector<gr_complex> &taps)
+{
+ return new gr_fir_ccc_3dnowext (taps);
+}
+
+static gr_fir_ccc *
+make_gr_fir_ccc_sse (const std::vector<gr_complex> &taps)
+{
+ return new gr_fir_ccc_sse (taps);
+}
+
+static gr_fir_fff *
+make_gr_fir_fff_3dnow (const std::vector<float> &taps)
+{
+ return new gr_fir_fff_3dnow (taps);
+}
+
+static gr_fir_fff *
+make_gr_fir_fff_sse (const std::vector<float> &taps)
+{
+ return new gr_fir_fff_sse (taps);
+}
+
+static gr_fir_fsf *
+make_gr_fir_fsf_3dnow (const std::vector<float> &taps)
+{
+ return new gr_fir_fsf_3dnow (taps);
+}
+
+static gr_fir_fsf *
+make_gr_fir_fsf_sse (const std::vector<float> &taps)
+{
+ return new gr_fir_fsf_sse (taps);
+}
+
+#if 0
+static gr_fir_sss *
+make_gr_fir_sss_mmx (const std::vector<short> &taps)
+{
+ return new gr_fir_sss_mmx (taps);
+}
+
+static gr_fir_sss *
+make_gr_fir_sss_sse2 (const std::vector<short> &taps)
+{
+ return new gr_fir_sss_sse2 (taps);
+}
+#endif
+
+static gr_fir_scc *
+make_gr_fir_scc_3dnow(const std::vector<gr_complex> &taps)
+{
+ return new gr_fir_scc_3dnow(taps);
+}
+
+static gr_fir_scc *
+make_gr_fir_scc_3dnowext(const std::vector<gr_complex> &taps)
+{
+ return new gr_fir_scc_3dnowext(taps);
+}
+
+static gr_fir_scc *
+make_gr_fir_scc_sse(const std::vector<gr_complex> &taps)
+{
+ return new gr_fir_scc_sse(taps);
+}
+
+/*
+ * ----------------------------------------------------------------
+ * Return instances of the fastest x86 versions of these classes.
+ *
+ * check CPUID, if has 3DNowExt, return 3DNow!Ext version,
+ * else if 3DNow, return 3DNow! version,
+ * else if SSE2, return SSE2 version,
+ * else if SSE, return SSE version,
+ * else if MMX, return MMX version,
+ * else return generic version.
+ *
+ * FIXME: benchmark, store result, use stored result to
+ * select the fastest version.
+ * ----------------------------------------------------------------
+ */
+
+gr_fir_ccf *
+gr_fir_sysconfig_x86::create_gr_fir_ccf (const std::vector<float> &taps)
+{
+ static bool first = true;
+
+ if (gr_cpu::has_3dnow ()){
+ if (first){
+ cerr << ">>> gr_fir_ccf: using 3DNow!\n";
+ first = false;
+ }
+ return make_gr_fir_ccf_3dnow (taps);
+ }
+
+ if (gr_cpu::has_sse ()){
+ if (first){
+ cerr << ">>> gr_fir_ccf: using SSE\n";
+ first = false;
+ }
+ return make_gr_fir_ccf_sse (taps);
+ }
+
+ if (first){
+ cerr << ">>> gr_fir_ccf: handing off to parent class\n";
+ first = false;
+ }
+ return gr_fir_sysconfig_generic::create_gr_fir_ccf (taps);
+}
+
+gr_fir_fcc *
+gr_fir_sysconfig_x86::create_gr_fir_fcc (const std::vector<gr_complex> &taps)
+{
+ static bool first = true;
+
+ if (gr_cpu::has_3dnow ()){
+ if (first){
+ cerr << ">>> gr_fir_fcc: using 3DNow!\n";
+ first = false;
+ }
+ return make_gr_fir_fcc_3dnow (taps);
+ }
+
+ if (gr_cpu::has_sse ()){
+ if (first){
+ cerr << ">>> gr_fir_fcc: using SSE\n";
+ first = false;
+ }
+ return make_gr_fir_fcc_sse (taps);
+ }
+
+ if (first){
+ cerr << ">>> gr_fir_fcc: handing off to parent class\n";
+ first = false;
+ }
+ return gr_fir_sysconfig_generic::create_gr_fir_fcc (taps);
+}
+
+gr_fir_ccc *
+gr_fir_sysconfig_x86::create_gr_fir_ccc (const std::vector<gr_complex> &taps)
+{
+ static bool first = true;
+
+ if (gr_cpu::has_3dnowext ()){
+ if (first) {
+ cerr << ">>> gr_fir_ccc: using 3DNow!Ext\n";
+ first = false;
+ }
+ return make_gr_fir_ccc_3dnowext (taps);
+ }
+
+ if (gr_cpu::has_3dnow ()){
+ if (first) {
+ cerr << ">>> gr_fir_ccc: using 3DNow!\n";
+ first = false;
+ }
+ return make_gr_fir_ccc_3dnow (taps);
+ }
+
+ if (gr_cpu::has_sse ()){
+ if (first){
+ cerr << ">>> gr_fir_ccc: using SSE\n";
+ first = false;
+ }
+ return make_gr_fir_ccc_sse (taps);
+ }
+
+ if (first){
+ cerr << ">>> gr_fir_ccc: handing off to parent class\n";
+ first = false;
+ }
+ return gr_fir_sysconfig_generic::create_gr_fir_ccc (taps);
+}
+
+gr_fir_fff *
+gr_fir_sysconfig_x86::create_gr_fir_fff (const std::vector<float> &taps)
+{
+ static bool first = true;
+
+ if (gr_cpu::has_3dnow ()){
+ if (first) {
+ cerr << ">>> gr_fir_fff: using 3DNow!\n";
+ first = false;
+ }
+ return make_gr_fir_fff_3dnow (taps);
+ }
+
+ if (gr_cpu::has_sse ()){
+ if (first){
+ cerr << ">>> gr_fir_fff: using SSE\n";
+ first = false;
+ }
+ return make_gr_fir_fff_sse (taps);
+ }
+
+ if (first){
+ cerr << ">>> gr_fir_fff: handing off to parent class\n";
+ first = false;
+ }
+ return gr_fir_sysconfig_generic::create_gr_fir_fff (taps);
+}
+
+gr_fir_fsf *
+gr_fir_sysconfig_x86::create_gr_fir_fsf (const std::vector<float> &taps)
+{
+ static bool first = true;
+
+ if (gr_cpu::has_3dnow ()){
+ if (first) {
+ cerr << ">>> gr_fir_fsf: using 3DNow!\n";
+ first = false;
+ }
+ return make_gr_fir_fsf_3dnow (taps);
+ }
+
+ if (gr_cpu::has_sse ()){
+ if (first){
+ cerr << ">>> gr_fir_fsf: using SSE\n";
+ first = false;
+ }
+ return make_gr_fir_fsf_sse (taps);
+ }
+
+ if (first){
+ cerr << ">>> gr_fir_fsf: handing off to parent class\n";
+ first = false;
+ }
+ return gr_fir_sysconfig_generic::create_gr_fir_fsf (taps);
+}
+
+#if 0
+gr_fir_sss *
+gr_fir_sysconfig_x86::create_gr_fir_sss (const std::vector<short> &taps)
+{
+ // FIXME -- probably want to figure out best answer for Athlon and code
+ // add code to select it here...
+
+ if (gr_cpu::has_sse2 ()){
+ cerr << ">>> gr_fir_sss: using SSE2\n";
+ return make_gr_fir_sss_sse2 (taps);
+ }
+
+ if (gr_cpu::has_mmx ()){
+ cerr << ">>> gr_fir_sss: using MMX\n";
+ return make_gr_fir_sss_mmx (taps);
+ }
+
+ cerr << ">>> gr_fir_sss: handing off to parent class\n";
+ return gr_fir_sysconfig_generic::create_gr_fir_sss (taps);
+}
+#endif
+
+gr_fir_scc *
+gr_fir_sysconfig_x86::create_gr_fir_scc (const std::vector<gr_complex> &taps)
+{
+ static bool first = true;
+
+ if (gr_cpu::has_3dnowext ()){
+ if (first){
+ cerr << ">>> gr_fir_scc: using 3DNow!Ext\n";
+ first = false;
+ }
+ return make_gr_fir_scc_3dnowext (taps);
+ }
+
+ if (gr_cpu::has_3dnow ()){
+ if (first){
+ cerr << ">>> gr_fir_scc: using 3DNow!\n";
+ first = false;
+ }
+ return make_gr_fir_scc_3dnow (taps);
+ }
+
+ if (gr_cpu::has_sse ()){
+ if (first){
+ cerr << ">>> gr_fir_scc: using SSE\n";
+ first = false;
+ }
+ return make_gr_fir_scc_sse (taps);
+ }
+
+ if (first){
+ cerr << ">>> gr_fir_scc: handing off to parent class\n";
+ first = false;
+ }
+ return gr_fir_sysconfig_generic::create_gr_fir_scc (taps);
+}
+
+/*
+ * ----------------------------------------------------------------
+ * Return info about available implementations
+ * ----------------------------------------------------------------
+ */
+
+void
+gr_fir_sysconfig_x86::get_gr_fir_ccf_info (std::vector<gr_fir_ccf_info> *info)
+{
+ gr_fir_ccf_info t;
+
+ // invoke parent..
+ gr_fir_sysconfig_generic::get_gr_fir_ccf_info (info);
+
+ // add our stuff...
+ if (gr_cpu::has_3dnow ()){
+ t.name = "3DNow!";
+ t.create = make_gr_fir_ccf_3dnow;
+ (*info).push_back (t);
+ }
+
+ if (gr_cpu::has_sse ()){
+ t.name = "SSE";
+ t.create = make_gr_fir_ccf_sse;
+ (*info).push_back (t);
+ }
+}
+
+void
+gr_fir_sysconfig_x86::get_gr_fir_fcc_info (std::vector<gr_fir_fcc_info> *info)
+{
+ gr_fir_fcc_info t;
+
+ // invoke parent..
+ gr_fir_sysconfig_generic::get_gr_fir_fcc_info (info);
+
+ // add our stuff...
+ if (gr_cpu::has_3dnow ()){
+ t.name = "3DNow!";
+ t.create = make_gr_fir_fcc_3dnow;
+ (*info).push_back (t);
+ }
+
+ if (gr_cpu::has_sse ()){
+ t.name = "SSE";
+ t.create = make_gr_fir_fcc_sse;
+ (*info).push_back (t);
+ }
+}
+
+void
+gr_fir_sysconfig_x86::get_gr_fir_ccc_info (std::vector<gr_fir_ccc_info> *info)
+{
+ gr_fir_ccc_info t;
+
+ // invoke parent..
+ gr_fir_sysconfig_generic::get_gr_fir_ccc_info (info);
+
+ // add our stuff...
+ if (gr_cpu::has_3dnowext ()){
+ t.name = "3DNow!Ext";
+ t.create = make_gr_fir_ccc_3dnowext;
+ (*info).push_back (t);
+ }
+
+ if (gr_cpu::has_3dnow ()){
+ t.name = "3DNow!";
+ t.create = make_gr_fir_ccc_3dnow;
+ (*info).push_back (t);
+ }
+
+ if (gr_cpu::has_sse ()){
+ t.name = "SSE";
+ t.create = make_gr_fir_ccc_sse;
+ (*info).push_back (t);
+ }
+}
+
+void
+gr_fir_sysconfig_x86::get_gr_fir_fff_info (std::vector<gr_fir_fff_info> *info)
+{
+ gr_fir_fff_info t;
+
+ // invoke parent..
+ gr_fir_sysconfig_generic::get_gr_fir_fff_info (info);
+
+ // add our stuff...
+ if (gr_cpu::has_3dnow ()){
+ t.name = "3DNow!";
+ t.create = make_gr_fir_fff_3dnow;
+ (*info).push_back (t);
+ }
+
+ if (gr_cpu::has_sse ()){
+ t.name = "SSE";
+ t.create = make_gr_fir_fff_sse;
+ (*info).push_back (t);
+ }
+}
+
+void
+gr_fir_sysconfig_x86::get_gr_fir_fsf_info (std::vector<gr_fir_fsf_info> *info)
+{
+ gr_fir_fsf_info t;
+
+ // invoke parent..
+ gr_fir_sysconfig_generic::get_gr_fir_fsf_info (info);
+
+ // add our stuff...
+ if (gr_cpu::has_3dnow ()){
+ t.name = "3DNow!";
+ t.create = make_gr_fir_fsf_3dnow;
+ (*info).push_back (t);
+ }
+
+ if (gr_cpu::has_sse ()){
+ t.name = "SSE";
+ t.create = make_gr_fir_fsf_sse;
+ (*info).push_back (t);
+ }
+}
+
+void
+gr_fir_sysconfig_x86::get_gr_fir_scc_info (std::vector<gr_fir_scc_info> *info)
+{
+ gr_fir_scc_info t;
+
+ // invoke parent..
+ gr_fir_sysconfig_generic::get_gr_fir_scc_info (info);
+
+ // add our stuff...
+ if (gr_cpu::has_3dnowext ()){
+ t.name = "3DNow!Ext";
+ t.create = make_gr_fir_scc_3dnowext;
+ (*info).push_back (t);
+ }
+
+ if (gr_cpu::has_3dnow ()){
+ t.name = "3DNow!";
+ t.create = make_gr_fir_scc_3dnow;
+ (*info).push_back (t);
+ }
+
+ if (gr_cpu::has_sse ()){
+ t.name = "SSE";
+ t.create = make_gr_fir_scc_sse;
+ (*info).push_back (t);
+ }
+}
+
+#if 0
+void
+gr_fir_sysconfig_x86::get_gr_fir_sss_info (std::vector<gr_fir_sss_info> *info)
+{
+ gr_fir_sss_info t;
+
+ // invoke parent..
+ gr_fir_sysconfig_generic::get_gr_fir_sss_info (info);
+
+ // add our stuff...
+ if (gr_cpu::has_mmx ()){
+ t.name = "MMX";
+ t.create = make_gr_fir_sss_mmx;
+ (*info).push_back (t);
+ }
+
+ if (gr_cpu::has_sse2 ()){
+ t.name = "SSE2";
+ t.create = make_gr_fir_sss_sse2;
+ (*info).push_back (t);
+ }
+}
+#endif
diff --git a/gnuradio-core/src/lib/filter/gr_fir_sysconfig_x86.h b/gnuradio-core/src/lib/filter/gr_fir_sysconfig_x86.h
new file mode 100644
index 000000000..ebb399c8b
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_fir_sysconfig_x86.h
@@ -0,0 +1,47 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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_FIR_SYSCONFIG_X86_H
+#define INCLUDED_GR_FIR_SYSCONFIG_X86_H
+
+#include <gr_core_api.h>
+#include <gr_fir_sysconfig_generic.h>
+
+class GR_CORE_API gr_fir_sysconfig_x86 : public gr_fir_sysconfig_generic {
+public:
+ virtual gr_fir_ccf *create_gr_fir_ccf (const std::vector<float> &taps);
+ virtual gr_fir_fcc *create_gr_fir_fcc (const std::vector<gr_complex> &taps);
+ virtual gr_fir_fff *create_gr_fir_fff (const std::vector<float> &taps);
+ virtual gr_fir_fsf *create_gr_fir_fsf (const std::vector<float> &taps);
+ virtual gr_fir_scc *create_gr_fir_scc (const std::vector<gr_complex> &taps);
+ virtual gr_fir_ccc *create_gr_fir_ccc (const std::vector<gr_complex> &taps);
+//virtual gr_fir_sss *create_gr_fir_sss (const std::vector<short> &taps);
+
+ virtual void get_gr_fir_ccf_info (std::vector<gr_fir_ccf_info> *info);
+ virtual void get_gr_fir_fcc_info (std::vector<gr_fir_fcc_info> *info);
+ virtual void get_gr_fir_fff_info (std::vector<gr_fir_fff_info> *info);
+ virtual void get_gr_fir_fsf_info (std::vector<gr_fir_fsf_info> *info);
+ virtual void get_gr_fir_scc_info (std::vector<gr_fir_scc_info> *info);
+ virtual void get_gr_fir_ccc_info (std::vector<gr_fir_ccc_info> *info);
+//virtual void get_gr_fir_sss_info (std::vector<gr_fir_sss_info> *info);
+};
+
+#endif
diff --git a/gnuradio-core/src/lib/filter/gr_fractional_interpolator_cc.cc b/gnuradio-core/src/lib/filter/gr_fractional_interpolator_cc.cc
new file mode 100644
index 000000000..500958e3d
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_fractional_interpolator_cc.cc
@@ -0,0 +1,93 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_io_signature.h>
+#include <gr_fractional_interpolator_cc.h>
+#include <gri_mmse_fir_interpolator_cc.h>
+#include <stdexcept>
+
+// Public constructor
+gr_fractional_interpolator_cc_sptr gr_make_fractional_interpolator_cc(float phase_shift, float interp_ratio)
+{
+ return gnuradio::get_initial_sptr(new gr_fractional_interpolator_cc(phase_shift, interp_ratio));
+}
+
+gr_fractional_interpolator_cc::gr_fractional_interpolator_cc(float phase_shift, float interp_ratio)
+ : gr_block ("fractional_interpolator_cc",
+ gr_make_io_signature (1, 1, sizeof (gr_complex)),
+ gr_make_io_signature (1, 1, sizeof (gr_complex))),
+ d_mu (phase_shift), d_mu_inc (interp_ratio), d_interp(new gri_mmse_fir_interpolator_cc())
+{
+ if (interp_ratio <= 0)
+ throw std::out_of_range ("interpolation ratio must be > 0");
+ if (phase_shift < 0 || phase_shift > 1)
+ throw std::out_of_range ("phase shift ratio must be > 0 and < 1");
+
+ set_relative_rate (1.0 / interp_ratio);
+}
+
+gr_fractional_interpolator_cc::~gr_fractional_interpolator_cc()
+{
+ delete d_interp;
+}
+
+void
+gr_fractional_interpolator_cc::forecast(int noutput_items, gr_vector_int &ninput_items_required)
+{
+ unsigned ninputs = ninput_items_required.size();
+ for (unsigned i=0; i < ninputs; i++)
+
+ ninput_items_required[i] =
+ (int) ceil((noutput_items * d_mu_inc) + d_interp->ntaps());
+}
+
+int
+gr_fractional_interpolator_cc::general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const gr_complex *in = (const gr_complex *) input_items[0];
+ gr_complex *out = (gr_complex *) output_items[0];
+
+ int ii = 0; // input index
+ int oo = 0; // output index
+
+ while (oo < noutput_items) {
+
+ out[oo++] = d_interp->interpolate(&in[ii], d_mu);
+
+ double s = d_mu + d_mu_inc;
+ double f = floor (s);
+ int incr = (int) f;
+ d_mu = s - f;
+ ii += incr;
+ }
+
+ consume_each (ii);
+
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/filter/gr_fractional_interpolator_cc.h b/gnuradio-core/src/lib/filter/gr_fractional_interpolator_cc.h
new file mode 100644
index 000000000..29c67895a
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_fractional_interpolator_cc.h
@@ -0,0 +1,68 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,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.
+ */
+
+#ifndef INCLUDED_GR_FRACTIONAL_INTERPOLATOR_CC_H
+#define INCLUDED_GR_FRACTIONAL_INTERPOLATOR_CC_H
+
+#include <gr_core_api.h>
+#include <gr_block.h>
+
+class gri_mmse_fir_interpolator_cc;
+
+class gr_fractional_interpolator_cc;
+typedef boost::shared_ptr<gr_fractional_interpolator_cc> gr_fractional_interpolator_cc_sptr;
+
+// public constructor
+GR_CORE_API gr_fractional_interpolator_cc_sptr gr_make_fractional_interpolator_cc (float phase_shift, float interp_ratio);
+
+/*!
+ * \brief Interpolating mmse filter with gr_complex input, gr_complex output
+ * \ingroup filter_blk
+ */
+class GR_CORE_API gr_fractional_interpolator_cc : public gr_block
+{
+public:
+ ~gr_fractional_interpolator_cc ();
+ 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);
+
+ float mu() const { return d_mu;}
+ float interp_ratio() const { return d_mu_inc;}
+ void set_mu (float mu) { d_mu = mu; }
+ void set_interp_ratio (float interp_ratio) { d_mu_inc = interp_ratio; }
+
+protected:
+ gr_fractional_interpolator_cc (float phase_shift, float interp_ratio);
+
+private:
+ float d_mu;
+ float d_mu_inc;
+ gri_mmse_fir_interpolator_cc *d_interp;
+
+ friend GR_CORE_API gr_fractional_interpolator_cc_sptr
+ gr_make_fractional_interpolator_cc (float phase_shift, float interp_ratio);
+};
+
+#endif
diff --git a/gnuradio-core/src/lib/filter/gr_fractional_interpolator_cc.i b/gnuradio-core/src/lib/filter/gr_fractional_interpolator_cc.i
new file mode 100644
index 000000000..d7341176a
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_fractional_interpolator_cc.i
@@ -0,0 +1,37 @@
+/* -*- 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,fractional_interpolator_cc);
+
+gr_fractional_interpolator_cc_sptr gr_make_fractional_interpolator_cc (float phase_shift, float interp_ratio);
+
+class gr_fractional_interpolator_cc : public gr_block
+{
+private:
+ gr_fractional_interpolator_cc (float phase_shift, float interp_ratio);
+
+public:
+ float mu() const;
+ float interp_ratio() const;
+ void set_mu (float mu);
+ void set_interp_ratio (float interp_ratio);
+};
diff --git a/gnuradio-core/src/lib/filter/gr_fractional_interpolator_ff.cc b/gnuradio-core/src/lib/filter/gr_fractional_interpolator_ff.cc
new file mode 100644
index 000000000..9cbe31635
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_fractional_interpolator_ff.cc
@@ -0,0 +1,93 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_io_signature.h>
+#include <gr_fractional_interpolator_ff.h>
+#include <gri_mmse_fir_interpolator.h>
+#include <stdexcept>
+
+// Public constructor
+gr_fractional_interpolator_ff_sptr gr_make_fractional_interpolator_ff(float phase_shift, float interp_ratio)
+{
+ return gnuradio::get_initial_sptr(new gr_fractional_interpolator_ff(phase_shift, interp_ratio));
+}
+
+gr_fractional_interpolator_ff::gr_fractional_interpolator_ff(float phase_shift, float interp_ratio)
+ : gr_block ("fractional_interpolator_ff",
+ gr_make_io_signature (1, 1, sizeof (float)),
+ gr_make_io_signature (1, 1, sizeof (float))),
+ d_mu (phase_shift), d_mu_inc (interp_ratio), d_interp(new gri_mmse_fir_interpolator())
+{
+ if (interp_ratio <= 0)
+ throw std::out_of_range ("interpolation ratio must be > 0");
+ if (phase_shift < 0 || phase_shift > 1)
+ throw std::out_of_range ("phase shift ratio must be > 0 and < 1");
+
+ set_relative_rate (1.0 / interp_ratio);
+}
+
+gr_fractional_interpolator_ff::~gr_fractional_interpolator_ff()
+{
+ delete d_interp;
+}
+
+void
+gr_fractional_interpolator_ff::forecast(int noutput_items, gr_vector_int &ninput_items_required)
+{
+ unsigned ninputs = ninput_items_required.size();
+ for (unsigned i=0; i < ninputs; i++)
+
+ ninput_items_required[i] =
+ (int) ceil((noutput_items * d_mu_inc) + d_interp->ntaps());
+}
+
+int
+gr_fractional_interpolator_ff::general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const float *in = (const float *) input_items[0];
+ float *out = (float *) output_items[0];
+
+ int ii = 0; // input index
+ int oo = 0; // output index
+
+ while (oo < noutput_items) {
+
+ out[oo++] = d_interp->interpolate(&in[ii], d_mu);
+
+ double s = d_mu + d_mu_inc;
+ double f = floor (s);
+ int incr = (int) f;
+ d_mu = s - f;
+ ii += incr;
+ }
+
+ consume_each (ii);
+
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/filter/gr_fractional_interpolator_ff.h b/gnuradio-core/src/lib/filter/gr_fractional_interpolator_ff.h
new file mode 100644
index 000000000..7e000a6d1
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_fractional_interpolator_ff.h
@@ -0,0 +1,68 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,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.
+ */
+
+#ifndef INCLUDED_GR_FRACTIONAL_INTERPOLATOR_FF_H
+#define INCLUDED_GR_FRACTIONAL_INTERPOLATOR_FF_H
+
+#include <gr_core_api.h>
+#include <gr_block.h>
+
+class gri_mmse_fir_interpolator;
+
+class gr_fractional_interpolator_ff;
+typedef boost::shared_ptr<gr_fractional_interpolator_ff> gr_fractional_interpolator_ff_sptr;
+
+// public constructor
+GR_CORE_API gr_fractional_interpolator_ff_sptr gr_make_fractional_interpolator_ff (float phase_shift, float interp_ratio);
+
+/*!
+ * \brief Interpolating mmse filter with float input, float output
+ * \ingroup filter_blk
+ */
+class GR_CORE_API gr_fractional_interpolator_ff : public gr_block
+{
+public:
+ ~gr_fractional_interpolator_ff ();
+ 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);
+
+ float mu() const { return d_mu;}
+ float interp_ratio() const { return d_mu_inc;}
+ void set_mu (float mu) { d_mu = mu; }
+ void set_interp_ratio (float interp_ratio) { d_mu_inc = interp_ratio; }
+
+protected:
+ gr_fractional_interpolator_ff (float phase_shift, float interp_ratio);
+
+private:
+ float d_mu;
+ float d_mu_inc;
+ gri_mmse_fir_interpolator *d_interp;
+
+ friend GR_CORE_API gr_fractional_interpolator_ff_sptr
+ gr_make_fractional_interpolator_ff (float phase_shift, float interp_ratio);
+};
+
+#endif
diff --git a/gnuradio-core/src/lib/filter/gr_fractional_interpolator_ff.i b/gnuradio-core/src/lib/filter/gr_fractional_interpolator_ff.i
new file mode 100644
index 000000000..4ec7c85cf
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_fractional_interpolator_ff.i
@@ -0,0 +1,37 @@
+/* -*- 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,fractional_interpolator_ff);
+
+gr_fractional_interpolator_ff_sptr gr_make_fractional_interpolator_ff (float phase_shift, float interp_ratio);
+
+class gr_fractional_interpolator_ff : public gr_block
+{
+private:
+ gr_fractional_interpolator_ff (float phase_shift, float interp_ratio);
+
+public:
+ float mu() const;
+ float interp_ratio() const;
+ void set_mu (float mu);
+ void set_interp_ratio (float interp_ratio);
+};
diff --git a/gnuradio-core/src/lib/filter/gr_freq_xlating_fir_filter_XXX.cc.t b/gnuradio-core/src/lib/filter/gr_freq_xlating_fir_filter_XXX.cc.t
new file mode 100644
index 000000000..3d65f872e
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_freq_xlating_fir_filter_XXX.cc.t
@@ -0,0 +1,123 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2003,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: This file is automatically generated by
+ * generate_gr_freq_xlating_fir_filter_XXX.py
+ * Any changes made to this file will be overwritten.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <@NAME@.h>
+#include <@FIR_TYPE@.h>
+#include <gr_fir_util.h>
+#include <gr_io_signature.h>
+
+@SPTR_NAME@
+gr_make_@BASE_NAME@ (int decimation, const std::vector<@TAP_TYPE@> &taps,
+ double center_freq, double sampling_freq)
+{
+ return gnuradio::get_initial_sptr (new @NAME@ (decimation, taps, center_freq, sampling_freq));
+}
+
+
+@NAME@::@NAME@ (
+
+ int decimation,
+ const std::vector<@TAP_TYPE@> &taps,
+ double center_freq,
+ double sampling_freq)
+
+ : gr_sync_decimator ("@BASE_NAME@",
+ gr_make_io_signature (1, 1, sizeof (@I_TYPE@)),
+ gr_make_io_signature (1, 1, sizeof (@O_TYPE@)),
+ decimation),
+ d_proto_taps (taps), d_center_freq (center_freq), d_sampling_freq (sampling_freq),
+ d_updated (false)
+{
+ std::vector<gr_complex> dummy_taps;
+ d_composite_fir = gr_fir_util::create_@FIR_TYPE@ (dummy_taps);
+
+ set_history (d_proto_taps.size ());
+ build_composite_fir ();
+}
+
+@NAME@::~@NAME@ ()
+{
+ delete d_composite_fir;
+}
+
+void
+@NAME@::build_composite_fir ()
+{
+ std::vector<gr_complex> ctaps (d_proto_taps.size ());
+
+ float fwT0 = 2 * M_PI * d_center_freq / d_sampling_freq;
+ for (unsigned int i = 0; i < d_proto_taps.size (); i++)
+ ctaps[i] = d_proto_taps[i] * exp (gr_complex (0, i * fwT0));
+
+ d_composite_fir->set_taps (gr_reverse(ctaps));
+ d_r.set_phase_incr (exp (gr_complex (0, fwT0 * decimation ())));
+}
+
+void
+@NAME@::set_center_freq (double center_freq)
+{
+ d_center_freq = center_freq;
+ d_updated = true;
+}
+
+void
+@NAME@::set_taps (const std::vector<@TAP_TYPE@> &taps)
+{
+ d_proto_taps = taps;
+ d_updated = true;
+}
+
+int
+@NAME@::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ @I_TYPE@ *in = (@I_TYPE@ *) input_items[0];
+ @O_TYPE@ *out = (@O_TYPE@ *) output_items[0];
+
+ // rebuild composite FIR if the center freq has changed
+
+ if (d_updated){
+ set_history (d_proto_taps.size ());
+ build_composite_fir ();
+ d_updated = false;
+ return 0; // history requirements may have changed.
+ }
+
+ unsigned j = 0;
+ for (int i = 0; i < noutput_items; i++){
+ out[i] = d_r.rotate (d_composite_fir->filter (&in[j]));
+ j += decimation ();
+ }
+
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/filter/gr_freq_xlating_fir_filter_XXX.h.t b/gnuradio-core/src/lib/filter/gr_freq_xlating_fir_filter_XXX.h.t
new file mode 100644
index 000000000..97d20e04f
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_freq_xlating_fir_filter_XXX.h.t
@@ -0,0 +1,101 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002,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: This file is automatically generated by
+ * generate_gr_freq_xlating_fir_filter_XXX.py Any changes made to this file
+ * will be overwritten.
+ */
+
+#ifndef @GUARD_NAME@
+#define @GUARD_NAME@
+
+#include <gr_core_api.h>
+#include <gr_sync_decimator.h>
+#include <gr_rotator.h>
+
+class @NAME@;
+typedef boost::shared_ptr<@NAME@> @SPTR_NAME@;
+
+/*!
+ * Construct a FIR filter with the given taps and a composite frequency
+ * translation that shifts center_freq down to zero Hz. The frequency
+ * translation logically comes before the filtering operation.
+ */
+GR_CORE_API @SPTR_NAME@
+gr_make_@BASE_NAME@ (int decimation, const std::vector<@TAP_TYPE@> &taps,
+ double center_freq, double sampling_freq);
+
+
+class @FIR_TYPE@;
+
+/*!
+ * \brief FIR filter combined with frequency translation with @I_TYPE@ input, @O_TYPE@ output and @TAP_TYPE@ taps
+ * \ingroup filter_blk
+ *
+ * This class efficiently combines a frequency translation
+ * (typically "down conversion") with a FIR filter (typically low-pass)
+ * and decimation. It is ideally suited for a "channel selection filter"
+ * and can be efficiently used to select and decimate a narrow band signal
+ * out of wide bandwidth input.
+ *
+ * Uses a single input array to produce a single output array.
+ * Additional inputs and/or outputs are ignored.
+ */
+class GR_CORE_API @NAME@ : public gr_sync_decimator
+{
+ public:
+ virtual ~@NAME@ ();
+
+ void set_center_freq (double center_freq);
+ void set_taps (const std::vector<@TAP_TYPE@> &taps);
+
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+
+ private:
+ friend GR_CORE_API @SPTR_NAME@
+ gr_make_@BASE_NAME@ (int decimation, const std::vector<@TAP_TYPE@> &taps,
+ double center_freq, double sampling_freq);
+
+ protected:
+ std::vector<@TAP_TYPE@> d_proto_taps;
+ @FIR_TYPE@ *d_composite_fir;
+ gr_rotator d_r;
+ double d_center_freq;
+ double d_sampling_freq;
+ bool d_updated;
+
+ virtual void build_composite_fir ();
+
+ /*!
+ * Construct a FIR filter with the given taps and a composite frequency
+ * translation that shifts center_freq down to zero Hz. The frequency
+ * translation logically comes before the filtering operation.
+ */
+ @NAME@ (int decimation,
+ const std::vector<@TAP_TYPE@> &taps,
+ double center_freq, double sampling_freq);
+};
+
+#endif /* _@NAME@_H_ */
diff --git a/gnuradio-core/src/lib/filter/gr_freq_xlating_fir_filter_XXX.i.t b/gnuradio-core/src/lib/filter/gr_freq_xlating_fir_filter_XXX.i.t
new file mode 100644
index 000000000..ac6c8c9e1
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_freq_xlating_fir_filter_XXX.i.t
@@ -0,0 +1,47 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2003,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: This file is automatically generated by
+ * generate_gr_freq_xlating_fir_filter_XXX.py
+ * Any changes made to this file will be overwritten.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@)
+
+@SPTR_NAME@
+gr_make_@BASE_NAME@ (int decimation, const std::vector<@TAP_TYPE@> &taps,
+ double center_freq, double sampling_freq);
+
+
+class @NAME@ : public gr_sync_decimator
+{
+ protected:
+ @NAME@ (int decimation, const std::vector<@TAP_TYPE@> &taps,
+ double center_freq, double sampling_freq);
+
+ public:
+ ~@NAME@ ();
+
+ void set_center_freq (double center_freq);
+ void set_taps (const std::vector<@TAP_TYPE@> &taps);
+};
diff --git a/gnuradio-core/src/lib/filter/gr_goertzel_fc.cc b/gnuradio-core/src/lib/filter/gr_goertzel_fc.cc
new file mode 100644
index 000000000..07bed8157
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_goertzel_fc.cc
@@ -0,0 +1,76 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_goertzel_fc.h>
+#include <gr_io_signature.h>
+
+// public constructor
+gr_goertzel_fc_sptr
+gr_make_goertzel_fc(int rate, int len, float freq)
+{
+ return gnuradio::get_initial_sptr(new gr_goertzel_fc(rate, len, freq));
+}
+
+gr_goertzel_fc::gr_goertzel_fc(int rate, int len, float freq)
+ : gr_sync_decimator("goertzel_fc",
+ gr_make_io_signature (1, 1, sizeof (float)),
+ gr_make_io_signature (1, 1, sizeof (gr_complex)),
+ len),
+ d_goertzel(rate, len, freq)
+{
+ d_len = len;
+ d_rate = rate;
+ d_freq = freq;
+}
+
+int gr_goertzel_fc::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ float *in = (float *)input_items[0];
+ gr_complex *out = (gr_complex *)output_items[0];
+
+ for (int i = 0; i < noutput_items; i++) {
+ *out++ = d_goertzel.batch(in);
+ in += d_len;
+ }
+
+ return noutput_items;
+}
+
+void
+gr_goertzel_fc::set_freq(float freq)
+{
+ d_freq = freq;
+ d_goertzel.gri_setparms(d_rate, d_len, d_freq);
+}
+
+void
+gr_goertzel_fc::set_rate(int rate)
+{
+ d_rate = rate;
+ d_goertzel.gri_setparms(d_rate, d_len, d_freq);
+}
diff --git a/gnuradio-core/src/lib/filter/gr_goertzel_fc.h b/gnuradio-core/src/lib/filter/gr_goertzel_fc.h
new file mode 100644
index 000000000..5fb6e0ee0
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_goertzel_fc.h
@@ -0,0 +1,61 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006,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.
+ */
+
+#ifndef INCLUDED_GR_GOERTZEL_FC_H
+#define INCLUDED_GR_GOERTZEL_FC_H
+
+#include <gr_core_api.h>
+#include <gri_goertzel.h>
+#include <gr_sync_decimator.h>
+
+class gr_goertzel_fc;
+typedef boost::shared_ptr<gr_goertzel_fc> gr_goertzel_fc_sptr;
+
+// public constructor
+GR_CORE_API gr_goertzel_fc_sptr gr_make_goertzel_fc(int rate, int len, float freq);
+
+/*!
+ * \brief Goertzel single-bin DFT calculation.
+ * \ingroup dft_blk
+ */
+class GR_CORE_API gr_goertzel_fc : public gr_sync_decimator
+{
+private:
+ friend GR_CORE_API gr_goertzel_fc_sptr gr_make_goertzel_fc (int rate, int len, float freq);
+
+ gr_goertzel_fc(int rate, int len, float freq);
+ gri_goertzel d_goertzel;
+ int d_len;
+ float d_freq;
+ int d_rate;
+
+public:
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+
+ void set_freq (float freq);
+ void set_rate (int rate);
+};
+
+#endif /* INCLUDED_GR_GOERTZEL_FC_H */
+
diff --git a/gnuradio-core/src/lib/filter/gr_goertzel_fc.i b/gnuradio-core/src/lib/filter/gr_goertzel_fc.i
new file mode 100644
index 000000000..775c78cc8
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_goertzel_fc.i
@@ -0,0 +1,35 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006,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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,goertzel_fc);
+
+gr_goertzel_fc_sptr gr_make_goertzel_fc(int rate, int len, float freq);
+
+class gr_goertzel_fc : public gr_sync_decimator
+{
+private:
+ gr_goertzel_fc();
+
+public:
+ void set_freq (float freq);
+ void set_rate (int rate);
+};
diff --git a/gnuradio-core/src/lib/filter/gr_hilbert_fc.cc b/gnuradio-core/src/lib/filter/gr_hilbert_fc.cc
new file mode 100644
index 000000000..385e24ad2
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_hilbert_fc.cc
@@ -0,0 +1,67 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_hilbert_fc.h>
+#include <gr_firdes.h>
+#include <gr_fir_fff.h>
+#include <gr_fir_util.h>
+
+// public constructor
+gr_hilbert_fc_sptr
+gr_make_hilbert_fc (unsigned int ntaps)
+{
+ return gnuradio::get_initial_sptr(new gr_hilbert_fc (ntaps));
+}
+
+gr_hilbert_fc::gr_hilbert_fc (unsigned int ntaps)
+ : gr_sync_block ("hilbert_fc",
+ gr_make_io_signature (1, 1, sizeof (float)),
+ gr_make_io_signature (1, 1, sizeof (gr_complex))),
+ d_ntaps (ntaps | 0x1), // ensure ntaps is odd
+ d_hilb (gr_fir_util::create_gr_fir_fff (gr_firdes::hilbert (d_ntaps)))
+{
+ set_history (d_ntaps);
+}
+
+gr_hilbert_fc::~gr_hilbert_fc ()
+{
+ delete d_hilb;
+}
+
+int
+gr_hilbert_fc::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ float *in = (float *) input_items[0];
+ gr_complex *out = (gr_complex *) output_items[0];
+
+ for (int i = 0; i < noutput_items; i++)
+ out[i] = gr_complex (in[i + d_ntaps/2],
+ d_hilb->filter (&in[i]));
+
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/filter/gr_hilbert_fc.h b/gnuradio-core/src/lib/filter/gr_hilbert_fc.h
new file mode 100644
index 000000000..2bb5ff9e3
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_hilbert_fc.h
@@ -0,0 +1,69 @@
+/* -*- 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_HILBERT_FC_H
+#define INCLUDED_GR_HILBERT_FC_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+#include <gr_io_signature.h>
+#include <gr_types.h>
+
+class gr_hilbert_fc;
+typedef boost::shared_ptr<gr_hilbert_fc> gr_hilbert_fc_sptr;
+
+// public constructor
+GR_CORE_API gr_hilbert_fc_sptr gr_make_hilbert_fc (unsigned int ntaps);
+
+
+class gr_fir_fff;
+
+/*!
+ * \brief Hilbert transformer.
+ * \ingroup filter_blk
+ *
+ * real output is input appropriately delayed.
+ * imaginary output is hilbert filtered (90 degree phase shift)
+ * version of input.
+ */
+class GR_CORE_API gr_hilbert_fc : public gr_sync_block
+{
+ public:
+ ~gr_hilbert_fc ();
+
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+
+ protected:
+ gr_hilbert_fc (unsigned int ntaps);
+
+ private:
+ unsigned int d_ntaps;
+ gr_fir_fff *d_hilb;
+
+ friend GR_CORE_API gr_hilbert_fc_sptr gr_make_hilbert_fc (unsigned int ntaps);
+};
+
+
+
+#endif /* INCLUDED_GR_HILBERT_FC_H */
diff --git a/gnuradio-core/src/lib/filter/gr_hilbert_fc.i b/gnuradio-core/src/lib/filter/gr_hilbert_fc.i
new file mode 100644
index 000000000..91d4e23eb
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_hilbert_fc.i
@@ -0,0 +1,34 @@
+/* -*- 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,hilbert_fc);
+
+gr_hilbert_fc_sptr gr_make_hilbert_fc (unsigned int ntaps);
+
+class gr_hilbert_fc : public gr_sync_block
+{
+protected:
+ gr_hilbert_fc (unsigned int ntaps);
+
+public:
+ ~gr_hilbert_fc ();
+};
diff --git a/gnuradio-core/src/lib/filter/gr_iir_filter_ffd.cc b/gnuradio-core/src/lib/filter/gr_iir_filter_ffd.cc
new file mode 100644
index 000000000..4da2aa310
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_iir_filter_ffd.cc
@@ -0,0 +1,82 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_iir_filter_ffd.h>
+#include <gr_io_signature.h>
+#include <stdio.h>
+
+
+gr_iir_filter_ffd_sptr
+gr_make_iir_filter_ffd (const std::vector<double> &fftaps,
+ const std::vector<double> &fbtaps) throw (std::invalid_argument)
+{
+ return gnuradio::get_initial_sptr(new gr_iir_filter_ffd (fftaps, fbtaps));
+}
+
+gr_iir_filter_ffd::gr_iir_filter_ffd (const std::vector<double> &fftaps,
+ const std::vector<double> &fbtaps) throw (std::invalid_argument)
+
+ : gr_sync_block ("iir_filter_ffd",
+ gr_make_io_signature (1, 1, sizeof (float)),
+ gr_make_io_signature (1, 1, sizeof (float))),
+ d_iir (fftaps, fbtaps),
+ d_updated (false)
+{
+ // fprintf (stderr, "gr_iir_filter_ffd::ctor\n");
+}
+
+gr_iir_filter_ffd::~gr_iir_filter_ffd ()
+{
+ // nop
+}
+
+void
+gr_iir_filter_ffd::set_taps (const std::vector<double> &fftaps,
+ const std::vector<double> &fbtaps) throw (std::invalid_argument)
+{
+
+ d_new_fftaps = fftaps;
+ d_new_fbtaps = fbtaps;
+ d_updated = true;
+}
+
+int
+gr_iir_filter_ffd::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const float *in = (const float *) input_items[0];
+ float *out = (float *) output_items[0];
+
+
+ if (d_updated){
+ d_iir.set_taps (d_new_fftaps, d_new_fbtaps);
+ d_updated = false;
+ }
+
+ d_iir.filter_n (out, in, noutput_items);
+ return noutput_items;
+};
diff --git a/gnuradio-core/src/lib/filter/gr_iir_filter_ffd.h b/gnuradio-core/src/lib/filter/gr_iir_filter_ffd.h
new file mode 100644
index 000000000..ab7065e92
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_iir_filter_ffd.h
@@ -0,0 +1,99 @@
+/* -*- 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_IIR_FILTER_FFD_H
+#define INCLUDED_GR_IIR_FILTER_FFD_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+#include <gri_iir.h>
+#include <stdexcept>
+
+class gr_iir_filter_ffd;
+typedef boost::shared_ptr<gr_iir_filter_ffd> gr_iir_filter_ffd_sptr;
+GR_CORE_API gr_iir_filter_ffd_sptr
+gr_make_iir_filter_ffd (const std::vector<double> &fftaps,
+ const std::vector<double> &fbtaps) throw (std::invalid_argument);
+
+/*!
+ * \brief IIR filter with float input, float output and double taps
+ * \ingroup filter_blk
+ *
+ * This filter uses the Direct Form I implementation, where
+ * \p fftaps contains the feed-forward taps, and \p fbtaps the feedback ones.
+ *
+ *
+ * The input and output satisfy a difference equation of the form
+ \htmlonly
+ \f{
+ y[n] - \sum_{k=1}^{M} a_k y[n-k] = \sum_{k=0}^{N} b_k x[n-k]
+ \f}
+ \endhtmlonly
+
+ \xmlonly
+ y[n] - \sum_{k=1}^{M} a_k y[n-k] = \sum_{k=0}^{N} b_k x[n-k]
+ \endxmlonly
+
+ * with the corresponding rational system function
+ \htmlonly
+ \f{
+ H(z) = \ frac{\sum_{k=0}^{M} b_k z^{-k}}{1 - \sum_{k=1}^{N} a_k z^{-k}}
+ \f}
+ \endhtmlonly
+
+ \xmlonly
+ H(z) = \ frac{\sum_{k=0}^{M} b_k z^{-k}}{1 - \sum_{k=1}^{N} a_k z^{-k}}
+ \endxmlonly
+
+ * Note that some texts define the system function with a + in the denominator.
+ * If you're using that convention, you'll need to negate the feedback taps.
+ */
+class GR_CORE_API gr_iir_filter_ffd : public gr_sync_block
+{
+ private:
+ friend GR_CORE_API gr_iir_filter_ffd_sptr
+ gr_make_iir_filter_ffd (const std::vector<double> &fftaps,
+ const std::vector<double> &fbtaps) throw (std::invalid_argument);
+
+ gri_iir<float,float,double> d_iir;
+ std::vector<double> d_new_fftaps;
+ std::vector<double> d_new_fbtaps;
+ bool d_updated;
+
+ /*!
+ * Construct an IIR filter with the given taps
+ */
+ gr_iir_filter_ffd (const std::vector<double> &fftaps,
+ const std::vector<double> &fbtaps) throw (std::invalid_argument);
+
+ public:
+ ~gr_iir_filter_ffd ();
+
+ void set_taps (const std::vector<double> &fftaps,
+ const std::vector<double> &fbtaps) throw (std::invalid_argument);
+
+ 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/filter/gr_iir_filter_ffd.i b/gnuradio-core/src/lib/filter/gr_iir_filter_ffd.i
new file mode 100644
index 000000000..0a35ad89e
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_iir_filter_ffd.i
@@ -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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,iir_filter_ffd);
+
+gr_iir_filter_ffd_sptr
+gr_make_iir_filter_ffd (const std::vector<double> &fftaps,
+ const std::vector<double> &fbtaps) throw (std::invalid_argument);
+
+class gr_iir_filter_ffd : public gr_sync_block
+{
+ private:
+ gr_iir_filter_ffd (const std::vector<double> &fftaps,
+ const std::vector<double> &fbtaps) throw (std::invalid_argument);
+
+ public:
+ ~gr_iir_filter_ffd ();
+
+ void set_taps (const std::vector<double> &fftaps,
+ const std::vector<double> &fbtaps) throw (std::invalid_argument);
+};
diff --git a/gnuradio-core/src/lib/filter/gr_interp_fir_filter_XXX.cc.t b/gnuradio-core/src/lib/filter/gr_interp_fir_filter_XXX.cc.t
new file mode 100644
index 000000000..55297d1eb
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_interp_fir_filter_XXX.cc.t
@@ -0,0 +1,146 @@
+/* -*- 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: This file is automatically generated by generate_gr_fir_filter_XXX.py
+ * Any changes made to this file will be overwritten.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <@NAME@.h>
+#include <@FIR_TYPE@.h>
+#include <gr_fir_util.h>
+#include <gr_io_signature.h>
+#include <stdexcept>
+#include <iostream>
+
+@SPTR_NAME@ gr_make_@BASE_NAME@ (unsigned interpolation, const std::vector<@TAP_TYPE@> &taps)
+{
+ return gnuradio::get_initial_sptr (new @NAME@ (interpolation, taps));
+}
+
+
+@NAME@::@NAME@ (unsigned interpolation, const std::vector<@TAP_TYPE@> &taps)
+ : gr_sync_interpolator ("@BASE_NAME@",
+ gr_make_io_signature (1, 1, sizeof (@I_TYPE@)),
+ gr_make_io_signature (1, 1, sizeof (@O_TYPE@)),
+ interpolation),
+ d_updated (false), d_firs (interpolation)
+{
+ if (interpolation == 0)
+ throw std::out_of_range ("interpolation must be > 0");
+
+ std::vector<@TAP_TYPE@> dummy_taps;
+
+ for (unsigned i = 0; i < interpolation; i++)
+ d_firs[i] = gr_fir_util::create_@FIR_TYPE@ (dummy_taps);
+
+ set_taps (taps);
+ install_taps(d_new_taps);
+}
+
+@NAME@::~@NAME@ ()
+{
+ int interp = interpolation ();
+ for (int i = 0; i < interp; i++)
+ delete d_firs[i];
+}
+
+void
+@NAME@::set_taps (const std::vector<@TAP_TYPE@> &taps)
+{
+ d_new_taps = taps;
+ d_updated = true;
+
+ // round up length to a multiple of the interpolation factor
+ int n = taps.size () % interpolation ();
+ if (n > 0){
+ n = interpolation () - n;
+ while (n-- > 0)
+ d_new_taps.insert(d_new_taps.begin(), 0);
+ }
+
+ assert (d_new_taps.size () % interpolation () == 0);
+}
+
+
+void
+@NAME@::install_taps (const std::vector<@TAP_TYPE@> &taps)
+{
+ int nfilters = interpolation ();
+ int nt = taps.size () / nfilters;
+
+ assert (nt * nfilters == (int) taps.size ());
+
+ std::vector< std::vector <@TAP_TYPE@> > xtaps (nfilters);
+
+ for (int n = 0; n < nfilters; n++)
+ xtaps[n].resize (nt);
+
+ for (int i = 0; i < (int) taps.size(); i++)
+ xtaps[i % nfilters][i / nfilters] = taps[i];
+
+ for (int n = 0; n < nfilters; n++)
+ d_firs[n]->set_taps (xtaps[n]);
+
+ set_history (nt);
+ d_updated = false;
+
+#if 0
+ for (int i = 0; i < nfilters; i++){
+ std::cout << "filter[" << i << "] = ";
+ for (int j = 0; j < nt; j++)
+ std::cout << xtaps[i][j] << " ";
+
+ std::cout << "\n";
+ }
+#endif
+
+}
+
+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];
+
+ if (d_updated) {
+ install_taps (d_new_taps);
+ return 0; // history requirements may have changed.
+ }
+
+ int nfilters = interpolation ();
+ int ni = noutput_items / interpolation ();
+
+ for (int i = 0; i < ni; i++){
+ for (int nf = 0; nf < nfilters; nf++)
+ out[nf] = d_firs[nf]->filter (&in[i]);
+ out += nfilters;
+ }
+
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/filter/gr_interp_fir_filter_XXX.h.t b/gnuradio-core/src/lib/filter/gr_interp_fir_filter_XXX.h.t
new file mode 100644
index 000000000..83904dce2
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_interp_fir_filter_XXX.h.t
@@ -0,0 +1,70 @@
+/* -*- 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: This file is automatically generated by generate_gr_fir_filter_XXX.py
+ * Any changes made to this file will be overwritten.
+ */
+
+#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@ (unsigned interpolation, const std::vector<@TAP_TYPE@> &taps);
+
+class @FIR_TYPE@;
+
+/*!
+ * \brief Interpolating FIR filter with @I_TYPE@ input, @O_TYPE@ output and @TAP_TYPE@ taps
+ * \ingroup filter_blk
+ */
+class GR_CORE_API @NAME@ : public gr_sync_interpolator
+{
+ private:
+ friend GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (unsigned interpolation, const std::vector<@TAP_TYPE@> &taps);
+
+ std::vector<@TAP_TYPE@> d_new_taps;
+ bool d_updated;
+ std::vector<@FIR_TYPE@ *> d_firs;
+
+ /*!
+ * Construct a FIR filter with the given taps
+ */
+ @NAME@ (unsigned interpolation, const std::vector<@TAP_TYPE@> &taps);
+
+ void install_taps (const std::vector<@TAP_TYPE@> &taps);
+
+ public:
+ ~@NAME@ ();
+
+ void set_taps (const std::vector<@TAP_TYPE@> &taps);
+
+ 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/filter/gr_interp_fir_filter_XXX.i.t b/gnuradio-core/src/lib/filter/gr_interp_fir_filter_XXX.i.t
new file mode 100644
index 000000000..274753001
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_interp_fir_filter_XXX.i.t
@@ -0,0 +1,41 @@
+/* -*- 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: This file is automatically generated by generate_GrFIRfilterXXX.py
+ * Any changes made to this file will be overwritten.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@)
+
+@SPTR_NAME@ gr_make_@BASE_NAME@ (int interpolation, const std::vector<@TAP_TYPE@> &taps);
+
+class @NAME@ : public gr_sync_interpolator
+{
+ private:
+ @NAME@ (int interpolation, const std::vector<@TAP_TYPE@> &taps);
+
+ public:
+ ~@NAME@ ();
+
+ void set_taps (const std::vector<@TAP_TYPE@> &taps);
+};
diff --git a/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.cc b/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.cc
new file mode 100644
index 000000000..ee09fef44
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.cc
@@ -0,0 +1,210 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_pfb_arb_resampler_ccf.h>
+#include <gr_fir_ccf.h>
+#include <gr_fir_util.h>
+#include <gr_io_signature.h>
+#include <cstdio>
+
+gr_pfb_arb_resampler_ccf_sptr gr_make_pfb_arb_resampler_ccf (float rate,
+ const std::vector<float> &taps,
+ unsigned int filter_size)
+{
+ return gnuradio::get_initial_sptr(new gr_pfb_arb_resampler_ccf (rate, taps,
+ filter_size));
+}
+
+
+gr_pfb_arb_resampler_ccf::gr_pfb_arb_resampler_ccf (float rate,
+ const std::vector<float> &taps,
+ unsigned int filter_size)
+ : gr_block ("pfb_arb_resampler_ccf",
+ gr_make_io_signature (1, 1, sizeof(gr_complex)),
+ gr_make_io_signature (1, 1, sizeof(gr_complex))),
+ d_updated (false)
+{
+ d_acc = 0; // start accumulator at 0
+
+ /* The number of filters is specified by the user as the filter size;
+ this is also the interpolation rate of the filter. We use it and the
+ rate provided to determine the decimation rate. This acts as a
+ rational resampler. The flt_rate is calculated as the residual
+ between the integer decimation rate and the real decimation rate and
+ will be used to determine to interpolation point of the resampling
+ process.
+ */
+ d_int_rate = filter_size;
+ set_rate(rate);
+
+ // Store the last filter between calls to work
+ d_last_filter = 0;
+
+ d_start_index = 0;
+
+ d_filters = std::vector<gr_fir_ccf*>(d_int_rate);
+ d_diff_filters = std::vector<gr_fir_ccf*>(d_int_rate);
+
+ // Create an FIR filter for each channel and zero out the taps
+ std::vector<float> vtaps(0, d_int_rate);
+ for(unsigned int i = 0; i < d_int_rate; i++) {
+ d_filters[i] = gr_fir_util::create_gr_fir_ccf(vtaps);
+ d_diff_filters[i] = gr_fir_util::create_gr_fir_ccf(vtaps);
+ }
+
+ // Now, actually set the filters' taps
+ std::vector<float> dtaps;
+ create_diff_taps(taps, dtaps);
+ create_taps(taps, d_taps, d_filters);
+ create_taps(dtaps, d_dtaps, d_diff_filters);
+}
+
+gr_pfb_arb_resampler_ccf::~gr_pfb_arb_resampler_ccf ()
+{
+ for(unsigned int i = 0; i < d_int_rate; i++) {
+ delete d_filters[i];
+ delete d_diff_filters[i];
+ }
+}
+
+void
+gr_pfb_arb_resampler_ccf::create_taps (const std::vector<float> &newtaps,
+ std::vector< std::vector<float> > &ourtaps,
+ std::vector<gr_fir_ccf*> &ourfilter)
+{
+ unsigned int ntaps = newtaps.size();
+ d_taps_per_filter = (unsigned int)ceil((double)ntaps/(double)d_int_rate);
+
+ // Create d_numchan vectors to store each channel's taps
+ ourtaps.resize(d_int_rate);
+
+ // Make a vector of the taps plus fill it out with 0's to fill
+ // each polyphase filter with exactly d_taps_per_filter
+ std::vector<float> tmp_taps;
+ tmp_taps = newtaps;
+ while((float)(tmp_taps.size()) < d_int_rate*d_taps_per_filter) {
+ tmp_taps.push_back(0.0);
+ }
+
+ // Partition the filter
+ for(unsigned int i = 0; i < d_int_rate; i++) {
+ // Each channel uses all d_taps_per_filter with 0's if not enough taps to fill out
+ ourtaps[d_int_rate-1-i] = std::vector<float>(d_taps_per_filter, 0);
+ for(unsigned int j = 0; j < d_taps_per_filter; j++) {
+ ourtaps[d_int_rate - 1 - i][j] = tmp_taps[i + j*d_int_rate];
+ }
+
+ // Build a filter for each channel and add it's taps to it
+ ourfilter[i]->set_taps(ourtaps[d_int_rate-1-i]);
+ }
+
+ // Set the history to ensure enough input items for each filter
+ set_history (d_taps_per_filter + 1);
+
+ d_updated = true;
+}
+
+void
+gr_pfb_arb_resampler_ccf::create_diff_taps(const std::vector<float> &newtaps,
+ std::vector<float> &difftaps)
+{
+ // Calculate the differential taps (derivative filter) by taking the difference
+ // between two taps. Duplicate the last one to make both filters the same length.
+ float tap;
+ difftaps.clear();
+ for(unsigned int i = 0; i < newtaps.size()-1; i++) {
+ tap = newtaps[i+1] - newtaps[i];
+ difftaps.push_back(tap);
+ }
+ difftaps.push_back(tap);
+}
+
+void
+gr_pfb_arb_resampler_ccf::print_taps()
+{
+ unsigned int i, j;
+ for(i = 0; i < d_int_rate; i++) {
+ printf("filter[%d]: [", i);
+ for(j = 0; j < d_taps_per_filter; j++) {
+ printf(" %.4e", d_taps[i][j]);
+ }
+ printf("]\n");
+ }
+}
+
+int
+gr_pfb_arb_resampler_ccf::general_work (int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ gr_complex *in = (gr_complex *) input_items[0];
+ gr_complex *out = (gr_complex *) output_items[0];
+
+ if (d_updated) {
+ d_updated = false;
+ return 0; // history requirements may have changed.
+ }
+
+ int i = 0, count = d_start_index;
+ unsigned int j;
+ gr_complex o0, o1;
+
+ // Restore the last filter position
+ j = d_last_filter;
+
+ // produce output as long as we can and there are enough input samples
+ int max_input = ninput_items[0]-(int)d_taps_per_filter;
+ while((i < noutput_items) && (count < max_input)) {
+ // start j by wrapping around mod the number of channels
+ while((j < d_int_rate) && (i < noutput_items)) {
+ // Take the current filter and derivative filter output
+ o0 = d_filters[j]->filter(&in[count]);
+ o1 = d_diff_filters[j]->filter(&in[count]);
+
+ out[i] = o0 + o1*d_acc; // linearly interpolate between samples
+ i++;
+
+ // Adjust accumulator and index into filterbank
+ d_acc += d_flt_rate;
+ j += d_dec_rate + (int)floor(d_acc);
+ d_acc = fmodf(d_acc, 1.0);
+ }
+ if(i < noutput_items) { // keep state for next entry
+ float ss = (int)(j / d_int_rate); // number of items to skip ahead by
+ count += ss; // we have fully consumed another input
+ j = j % d_int_rate; // roll filter around
+ }
+ }
+
+ // Store the current filter position and start of next sample
+ d_last_filter = j;
+ d_start_index = std::max(0, count - ninput_items[0]);
+
+ // consume all we've processed but no more than we can
+ consume_each(std::min(count, ninput_items[0]));
+ return i;
+}
diff --git a/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.h b/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.h
new file mode 100644
index 000000000..d92898a23
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.h
@@ -0,0 +1,178 @@
+/* -*- 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.
+ */
+
+
+#ifndef INCLUDED_GR_PFB_ARB_RESAMPLER_CCF_H
+#define INCLUDED_GR_PFB_ARB_RESAMPLER_CCF_H
+
+#include <gr_core_api.h>
+#include <gr_block.h>
+
+class gr_pfb_arb_resampler_ccf;
+typedef boost::shared_ptr<gr_pfb_arb_resampler_ccf> gr_pfb_arb_resampler_ccf_sptr;
+GR_CORE_API gr_pfb_arb_resampler_ccf_sptr gr_make_pfb_arb_resampler_ccf (float rate,
+ const std::vector<float> &taps,
+ unsigned int filter_size=32);
+
+class gr_fir_ccf;
+
+/*!
+ * \class gr_pfb_arb_resampler_ccf
+ *
+ * \brief Polyphase filterbank arbitrary resampler with
+ * gr_complex input, gr_complex output and float taps
+ *
+ * \ingroup filter_blk
+ * \ingroup pfb_blk
+ *
+ * This block takes in a signal stream and performs arbitrary
+ * resampling. The resampling rate can be any real
+ * number <EM>r</EM>. The resampling is done by constructing
+ * <EM>N</EM> filters where <EM>N</EM> is the interpolation rate. We
+ * then calculate <EM>D</EM> where <EM>D = floor(N/r)</EM>.
+ *
+ * Using <EM>N</EM> and <EM>D</EM>, we can perform rational resampling
+ * where <EM>N/D</EM> is a rational number close to the input rate
+ * <EM>r</EM> where we have <EM>N</EM> filters and we cycle through
+ * them as a polyphase filterbank with a stride of <EM>D</EM> so that
+ * <EM>i+1 = (i + D) % N</EM>.
+ *
+ * To get the arbitrary rate, we want to interpolate between two
+ * points. For each value out, we take an output from the current
+ * filter, <EM>i</EM>, and the next filter <EM>i+1</EM> and then
+ * linearly interpolate between the two based on the real resampling
+ * rate we want.
+ *
+ * The linear interpolation only provides us with an approximation to
+ * the real sampling rate specified. The error is a quantization error
+ * between the two filters we used as our interpolation points. To
+ * this end, the number of filters, <EM>N</EM>, used determines the
+ * quantization error; the larger <EM>N</EM>, the smaller the
+ * noise. You can design for a specified noise floor by setting the
+ * filter size (parameters <EM>filter_size</EM>). The size defaults to
+ * 32 filters, which is about as good as most implementations need.
+ *
+ * The trick with designing this filter is in how to specify the taps
+ * of the prototype filter. Like the PFB interpolator, the taps are
+ * specified using the interpolated filter rate. In this case, that
+ * rate is the input sample rate multiplied by the number of filters
+ * in the filterbank, which is also the interpolation rate. All other
+ * values should be relative to this rate.
+ *
+ * For example, for a 32-filter arbitrary resampler and using the
+ * GNU Radio's firdes utility to build the filter, we build a low-pass
+ * filter with a sampling rate of <EM>fs</EM>, a 3-dB bandwidth of
+ * <EM>BW</EM> and a transition bandwidth of <EM>TB</EM>. We can also
+ * specify the out-of-band attenuation to use, <EM>ATT</EM>, and the
+ * filter window function (a Blackman-harris window in this case). The
+ * first input is the gain of the filter, which we specify here as the
+ * interpolation rate (<EM>32</EM>).
+ *
+ * <B><EM>self._taps = gr.firdes.low_pass_2(32, 32*fs, BW, TB,
+ * attenuation_dB=ATT, window=gr.firdes.WIN_BLACKMAN_hARRIS)</EM></B>
+ *
+ * The theory behind this block can be found in Chapter 7.5 of
+ * the following book.
+ *
+ * <B><EM>f. harris, "Multirate Signal Processing for Communication
+ * Systems", Upper Saddle River, NJ: Prentice Hall, Inc. 2004.</EM></B>
+ */
+
+class GR_CORE_API gr_pfb_arb_resampler_ccf : public gr_block
+{
+ private:
+ /*!
+ * Build the polyphase filterbank arbitray resampler.
+ * \param rate (float) Specifies the resampling rate to use
+ * \param taps (vector/list of floats) The prototype filter to populate the filterbank. The taps
+ * should be generated at the filter_size sampling rate.
+ * \param filter_size (unsigned int) The number of filters in the filter bank. This is directly
+ related to quantization noise introduced during the resampling.
+ Defaults to 32 filters.
+ */
+ friend GR_CORE_API gr_pfb_arb_resampler_ccf_sptr gr_make_pfb_arb_resampler_ccf (float rate,
+ const std::vector<float> &taps,
+ unsigned int filter_size);
+
+ std::vector<gr_fir_ccf*> d_filters;
+ std::vector<gr_fir_ccf*> d_diff_filters;
+ std::vector< std::vector<float> > d_taps;
+ std::vector< std::vector<float> > d_dtaps;
+ unsigned int d_int_rate; // the number of filters (interpolation rate)
+ unsigned int d_dec_rate; // the stride through the filters (decimation rate)
+ float d_flt_rate; // residual rate for the linear interpolation
+ float d_acc;
+ unsigned int d_last_filter;
+ int d_start_index;
+ unsigned int d_taps_per_filter;
+ bool d_updated;
+
+ /*!
+ * Build the polyphase filterbank arbitray resampler.
+ * \param rate (float) Specifies the resampling rate to use
+ * \param taps (vector/list of floats) The prototype filter to populate the filterbank. The taps
+ * should be generated at the filter_size sampling rate.
+ * \param filter_size (unsigned int) The number of filters in the filter bank. This is directly
+ related to quantization noise introduced during the resampling.
+ Defaults to 32 filters.
+ */
+ gr_pfb_arb_resampler_ccf (float rate,
+ const std::vector<float> &taps,
+ unsigned int filter_size);
+
+ void create_diff_taps(const std::vector<float> &newtaps,
+ std::vector<float> &difftaps);
+
+ /*!
+ * Resets the filterbank's filter taps with the new prototype filter
+ * \param newtaps (vector of floats) The prototype filter to populate the filterbank.
+ * The taps should be generated at the interpolated sampling rate.
+ * \param ourtaps (vector of floats) Reference to our internal member of holding the taps.
+ * \param ourfilter (vector of filters) Reference to our internal filter to set the taps for.
+ */
+ void create_taps (const std::vector<float> &newtaps,
+ std::vector< std::vector<float> > &ourtaps,
+ std::vector<gr_fir_ccf*> &ourfilter);
+
+
+public:
+ ~gr_pfb_arb_resampler_ccf ();
+
+ // FIXME: See about a set_taps function during runtime.
+
+ /*!
+ * Print all of the filterbank taps to screen.
+ */
+ void print_taps();
+ void set_rate (float rate) {
+ d_dec_rate = (unsigned int)floor(d_int_rate/rate);
+ d_flt_rate = (d_int_rate/rate) - d_dec_rate;
+ set_relative_rate(rate);
+ }
+
+ int general_work (int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif
diff --git a/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.i b/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.i
new file mode 100644
index 000000000..da58947e9
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.i
@@ -0,0 +1,42 @@
+/* -*- 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,pfb_arb_resampler_ccf);
+
+gr_pfb_arb_resampler_ccf_sptr gr_make_pfb_arb_resampler_ccf (float rate,
+ const std::vector<float> &taps,
+ unsigned int filter_size=32);
+
+class gr_pfb_arb_resampler_ccf : public gr_block
+{
+ private:
+ gr_pfb_arb_resampler_ccf (float rate,
+ const std::vector<float> &taps,
+ unsigned int filter_size);
+
+ public:
+ ~gr_pfb_arb_resampler_ccf ();
+
+ //void set_taps (const std::vector<float> &taps);
+ void print_taps();
+ void set_rate (float rate);
+};
diff --git a/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_fff.cc b/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_fff.cc
new file mode 100644
index 000000000..f01af2e6f
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_fff.cc
@@ -0,0 +1,210 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2009-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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_pfb_arb_resampler_fff.h>
+#include <gr_fir_fff.h>
+#include <gr_fir_util.h>
+#include <gr_io_signature.h>
+#include <cstdio>
+
+gr_pfb_arb_resampler_fff_sptr gr_make_pfb_arb_resampler_fff (float rate,
+ const std::vector<float> &taps,
+ unsigned int filter_size)
+{
+ return gnuradio::get_initial_sptr(new gr_pfb_arb_resampler_fff (rate, taps,
+ filter_size));
+}
+
+
+gr_pfb_arb_resampler_fff::gr_pfb_arb_resampler_fff (float rate,
+ const std::vector<float> &taps,
+ unsigned int filter_size)
+ : gr_block ("pfb_arb_resampler_fff",
+ gr_make_io_signature (1, 1, sizeof(float)),
+ gr_make_io_signature (1, 1, sizeof(float))),
+ d_updated (false)
+{
+ d_acc = 0; // start accumulator at 0
+
+ /* The number of filters is specified by the user as the filter size;
+ this is also the interpolation rate of the filter. We use it and the
+ rate provided to determine the decimation rate. This acts as a
+ rational resampler. The flt_rate is calculated as the residual
+ between the integer decimation rate and the real decimation rate and
+ will be used to determine to interpolation point of the resampling
+ process.
+ */
+ d_int_rate = filter_size;
+ set_rate(rate);
+
+ // Store the last filter between calls to work
+ d_last_filter = 0;
+
+ d_start_index = 0;
+
+ d_filters = std::vector<gr_fir_fff*>(d_int_rate);
+ d_diff_filters = std::vector<gr_fir_fff*>(d_int_rate);
+
+ // Create an FIR filter for each channel and zero out the taps
+ std::vector<float> vtaps(0, d_int_rate);
+ for(unsigned int i = 0; i < d_int_rate; i++) {
+ d_filters[i] = gr_fir_util::create_gr_fir_fff(vtaps);
+ d_diff_filters[i] = gr_fir_util::create_gr_fir_fff(vtaps);
+ }
+
+ // Now, actually set the filters' taps
+ std::vector<float> dtaps;
+ create_diff_taps(taps, dtaps);
+ create_taps(taps, d_taps, d_filters);
+ create_taps(dtaps, d_dtaps, d_diff_filters);
+}
+
+gr_pfb_arb_resampler_fff::~gr_pfb_arb_resampler_fff ()
+{
+ for(unsigned int i = 0; i < d_int_rate; i++) {
+ delete d_filters[i];
+ delete d_diff_filters[i];
+ }
+}
+
+void
+gr_pfb_arb_resampler_fff::create_taps (const std::vector<float> &newtaps,
+ std::vector< std::vector<float> > &ourtaps,
+ std::vector<gr_fir_fff*> &ourfilter)
+{
+ unsigned int ntaps = newtaps.size();
+ d_taps_per_filter = (unsigned int)ceil((double)ntaps/(double)d_int_rate);
+
+ // Create d_numchan vectors to store each channel's taps
+ ourtaps.resize(d_int_rate);
+
+ // Make a vector of the taps plus fill it out with 0's to fill
+ // each polyphase filter with exactly d_taps_per_filter
+ std::vector<float> tmp_taps;
+ tmp_taps = newtaps;
+ while((float)(tmp_taps.size()) < d_int_rate*d_taps_per_filter) {
+ tmp_taps.push_back(0.0);
+ }
+
+ // Partition the filter
+ for(unsigned int i = 0; i < d_int_rate; i++) {
+ // Each channel uses all d_taps_per_filter with 0's if not enough taps to fill out
+ ourtaps[d_int_rate-1-i] = std::vector<float>(d_taps_per_filter, 0);
+ for(unsigned int j = 0; j < d_taps_per_filter; j++) {
+ ourtaps[d_int_rate - 1 - i][j] = tmp_taps[i + j*d_int_rate];
+ }
+
+ // Build a filter for each channel and add it's taps to it
+ ourfilter[i]->set_taps(ourtaps[d_int_rate-1-i]);
+ }
+
+ // Set the history to ensure enough input items for each filter
+ set_history (d_taps_per_filter + 1);
+
+ d_updated = true;
+}
+
+void
+gr_pfb_arb_resampler_fff::create_diff_taps(const std::vector<float> &newtaps,
+ std::vector<float> &difftaps)
+{
+ // Calculate the differential taps (derivative filter) by taking the difference
+ // between two taps. Duplicate the last one to make both filters the same length.
+ float tap;
+ difftaps.clear();
+ for(unsigned int i = 0; i < newtaps.size()-1; i++) {
+ tap = newtaps[i+1] - newtaps[i];
+ difftaps.push_back(tap);
+ }
+ difftaps.push_back(tap);
+}
+
+void
+gr_pfb_arb_resampler_fff::print_taps()
+{
+ unsigned int i, j;
+ for(i = 0; i < d_int_rate; i++) {
+ printf("filter[%d]: [", i);
+ for(j = 0; j < d_taps_per_filter; j++) {
+ printf(" %.4e", d_taps[i][j]);
+ }
+ printf("]\n");
+ }
+}
+
+int
+gr_pfb_arb_resampler_fff::general_work (int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ float *in = (float *) input_items[0];
+ float *out = (float *) output_items[0];
+
+ if (d_updated) {
+ d_updated = false;
+ return 0; // history requirements may have changed.
+ }
+
+ int i = 0, count = d_start_index;
+ unsigned int j;
+ float o0, o1;
+
+ // Restore the last filter position
+ j = d_last_filter;
+
+ // produce output as long as we can and there are enough input samples
+ int max_input = ninput_items[0]-(int)d_taps_per_filter;
+ while((i < noutput_items) && (count < max_input)) {
+ // start j by wrapping around mod the number of channels
+ while((j < d_int_rate) && (i < noutput_items)) {
+ // Take the current filter and derivative filter output
+ o0 = d_filters[j]->filter(&in[count]);
+ o1 = d_diff_filters[j]->filter(&in[count]);
+
+ out[i] = o0 + o1*d_acc; // linearly interpolate between samples
+ i++;
+
+ // Adjust accumulator and index into filterbank
+ d_acc += d_flt_rate;
+ j += d_dec_rate + (int)floor(d_acc);
+ d_acc = fmodf(d_acc, 1.0);
+ }
+ if(i < noutput_items) { // keep state for next entry
+ float ss = (int)(j / d_int_rate); // number of items to skip ahead by
+ count += ss; // we have fully consumed another input
+ j = j % d_int_rate; // roll filter around
+ }
+ }
+
+ // Store the current filter position and start of next sample
+ d_last_filter = j;
+ d_start_index = std::max(0, count - ninput_items[0]);
+
+ // consume all we've processed but no more than we can
+ consume_each(std::min(count, ninput_items[0]));
+ return i;
+}
diff --git a/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_fff.h b/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_fff.h
new file mode 100644
index 000000000..d2e375210
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_fff.h
@@ -0,0 +1,178 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2009-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.
+ */
+
+
+#ifndef INCLUDED_GR_PFB_ARB_RESAMPLER_FFF_H
+#define INCLUDED_GR_PFB_ARB_RESAMPLER_FFF_H
+
+#include <gr_core_api.h>
+#include <gr_block.h>
+
+class gr_pfb_arb_resampler_fff;
+typedef boost::shared_ptr<gr_pfb_arb_resampler_fff> gr_pfb_arb_resampler_fff_sptr;
+GR_CORE_API gr_pfb_arb_resampler_fff_sptr gr_make_pfb_arb_resampler_fff (float rate,
+ const std::vector<float> &taps,
+ unsigned int filter_size=32);
+
+class gr_fir_fff;
+
+/*!
+ * \class gr_pfb_arb_resampler_fff
+ *
+ * \brief Polyphase filterbank arbitrary resampler with
+ * float input, float output and float taps
+ *
+ * \ingroup filter_blk
+ * \ingroup pfb_blk
+ *
+ * This block takes in a signal stream and performs arbitrary
+ * resampling. The resampling rate can be any real
+ * number <EM>r</EM>. The resampling is done by constructing
+ * <EM>N</EM> filters where <EM>N</EM> is the interpolation rate. We
+ * then calculate <EM>D</EM> where <EM>D = floor(N/r)</EM>.
+ *
+ * Using <EM>N</EM> and <EM>D</EM>, we can perform rational resampling
+ * where <EM>N/D</EM> is a rational number close to the input rate
+ * <EM>r</EM> where we have <EM>N</EM> filters and we cycle through
+ * them as a polyphase filterbank with a stride of <EM>D</EM> so that
+ * <EM>i+1 = (i + D) % N</EM>.
+ *
+ * To get the arbitrary rate, we want to interpolate between two
+ * points. For each value out, we take an output from the current
+ * filter, <EM>i</EM>, and the next filter <EM>i+1</EM> and then
+ * linearly interpolate between the two based on the real resampling
+ * rate we want.
+ *
+ * The linear interpolation only provides us with an approximation to
+ * the real sampling rate specified. The error is a quantization error
+ * between the two filters we used as our interpolation points. To
+ * this end, the number of filters, <EM>N</EM>, used determines the
+ * quantization error; the larger <EM>N</EM>, the smaller the
+ * noise. You can design for a specified noise floor by setting the
+ * filter size (parameters <EM>filter_size</EM>). The size defaults to
+ * 32 filters, which is about as good as most implementations need.
+ *
+ * The trick with designing this filter is in how to specify the taps
+ * of the prototype filter. Like the PFB interpolator, the taps are
+ * specified using the interpolated filter rate. In this case, that
+ * rate is the input sample rate multiplied by the number of filters
+ * in the filterbank, which is also the interpolation rate. All other
+ * values should be relative to this rate.
+ *
+ * For example, for a 32-filter arbitrary resampler and using the
+ * GNU Radio's firdes utility to build the filter, we build a low-pass
+ * filter with a sampling rate of <EM>fs</EM>, a 3-dB bandwidth of
+ * <EM>BW</EM> and a transition bandwidth of <EM>TB</EM>. We can also
+ * specify the out-of-band attenuation to use, <EM>ATT</EM>, and the
+ * filter window function (a Blackman-harris window in this case). The
+ * first input is the gain of the filter, which we specify here as the
+ * interpolation rate (<EM>32</EM>).
+ *
+ * <B><EM>self._taps = gr.firdes.low_pass_2(32, 32*fs, BW, TB,
+ * attenuation_dB=ATT, window=gr.firdes.WIN_BLACKMAN_hARRIS)</EM></B>
+ *
+ * The theory behind this block can be found in Chapter 7.5 of
+ * the following book.
+ *
+ * <B><EM>f. harris, "Multirate Signal Processing for Communication
+ * Systems", Upper Saddle River, NJ: Prentice Hall, Inc. 2004.</EM></B>
+ */
+
+class GR_CORE_API gr_pfb_arb_resampler_fff : public gr_block
+{
+ private:
+ /*!
+ * Build the polyphase filterbank arbitray resampler.
+ * \param rate (float) Specifies the resampling rate to use
+ * \param taps (vector/list of floats) The prototype filter to populate the filterbank. The taps
+ * should be generated at the filter_size sampling rate.
+ * \param filter_size (unsigned int) The number of filters in the filter bank. This is directly
+ related to quantization noise introduced during the resampling.
+ Defaults to 32 filters.
+ */
+ friend GR_CORE_API gr_pfb_arb_resampler_fff_sptr gr_make_pfb_arb_resampler_fff (float rate,
+ const std::vector<float> &taps,
+ unsigned int filter_size);
+
+ std::vector<gr_fir_fff*> d_filters;
+ std::vector<gr_fir_fff*> d_diff_filters;
+ std::vector< std::vector<float> > d_taps;
+ std::vector< std::vector<float> > d_dtaps;
+ unsigned int d_int_rate; // the number of filters (interpolation rate)
+ unsigned int d_dec_rate; // the stride through the filters (decimation rate)
+ float d_flt_rate; // residual rate for the linear interpolation
+ float d_acc;
+ unsigned int d_last_filter;
+ int d_start_index;
+ unsigned int d_taps_per_filter;
+ bool d_updated;
+
+ /*!
+ * Build the polyphase filterbank arbitray resampler.
+ * \param rate (float) Specifies the resampling rate to use
+ * \param taps (vector/list of floats) The prototype filter to populate the filterbank. The taps
+ * should be generated at the filter_size sampling rate.
+ * \param filter_size (unsigned int) The number of filters in the filter bank. This is directly
+ related to quantization noise introduced during the resampling.
+ Defaults to 32 filters.
+ */
+ gr_pfb_arb_resampler_fff (float rate,
+ const std::vector<float> &taps,
+ unsigned int filter_size);
+
+ void create_diff_taps(const std::vector<float> &newtaps,
+ std::vector<float> &difftaps);
+
+ /*!
+ * Resets the filterbank's filter taps with the new prototype filter
+ * \param newtaps (vector of floats) The prototype filter to populate the filterbank.
+ * The taps should be generated at the interpolated sampling rate.
+ * \param ourtaps (vector of floats) Reference to our internal member of holding the taps.
+ * \param ourfilter (vector of filters) Reference to our internal filter to set the taps for.
+ */
+ void create_taps (const std::vector<float> &newtaps,
+ std::vector< std::vector<float> > &ourtaps,
+ std::vector<gr_fir_fff*> &ourfilter);
+
+
+public:
+ ~gr_pfb_arb_resampler_fff ();
+
+ // FIXME: See about a set_taps function during runtime.
+
+ /*!
+ * Print all of the filterbank taps to screen.
+ */
+ void print_taps();
+ void set_rate (float rate) {
+ d_dec_rate = (unsigned int)floor(d_int_rate/rate);
+ d_flt_rate = (d_int_rate/rate) - d_dec_rate;
+ set_relative_rate(rate);
+ }
+
+ int general_work (int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif
diff --git a/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_fff.i b/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_fff.i
new file mode 100644
index 000000000..ad0905361
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_fff.i
@@ -0,0 +1,42 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2009,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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,pfb_arb_resampler_fff);
+
+gr_pfb_arb_resampler_fff_sptr gr_make_pfb_arb_resampler_fff (float rate,
+ const std::vector<float> &taps,
+ unsigned int filter_size=32);
+
+class gr_pfb_arb_resampler_fff : public gr_block
+{
+ private:
+ gr_pfb_arb_resampler_fff (float rate,
+ const std::vector<float> &taps,
+ unsigned int filter_size);
+
+ public:
+ ~gr_pfb_arb_resampler_fff ();
+
+ //void set_taps (const std::vector<float> &taps);
+ void print_taps();
+ void set_rate (float rate);
+};
diff --git a/gnuradio-core/src/lib/filter/gr_pfb_channelizer_ccf.cc b/gnuradio-core/src/lib/filter/gr_pfb_channelizer_ccf.cc
new file mode 100644
index 000000000..a8cb849e2
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_pfb_channelizer_ccf.cc
@@ -0,0 +1,240 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_pfb_channelizer_ccf.h>
+#include <gr_fir_ccf.h>
+#include <gr_fir_util.h>
+#include <gri_fft.h>
+#include <gr_io_signature.h>
+#include <cstdio>
+#include <cstring>
+
+gr_pfb_channelizer_ccf_sptr gr_make_pfb_channelizer_ccf (unsigned int numchans,
+ const std::vector<float> &taps,
+ float oversample_rate)
+{
+ return gnuradio::get_initial_sptr(new gr_pfb_channelizer_ccf (numchans, taps,
+ oversample_rate));
+}
+
+
+gr_pfb_channelizer_ccf::gr_pfb_channelizer_ccf (unsigned int numchans,
+ const std::vector<float> &taps,
+ float oversample_rate)
+ : gr_block ("pfb_channelizer_ccf",
+ gr_make_io_signature (numchans, numchans, sizeof(gr_complex)),
+ gr_make_io_signature (1, numchans, sizeof(gr_complex))),
+ d_updated (false), d_numchans(numchans), d_oversample_rate(oversample_rate)
+{
+ // The over sampling rate must be rationally related to the number of channels
+ // in that it must be N/i for i in [1,N], which gives an outputsample rate
+ // of [fs/N, fs] where fs is the input sample rate.
+ // This tests the specified input sample rate to see if it conforms to this
+ // requirement within a few significant figures.
+ double intp = 0;
+ double fltp = modf(numchans / oversample_rate, &intp);
+ if(fltp != 0.0)
+ throw std::invalid_argument("gr_pfb_channelizer: oversample rate must be N/i for i in [1, N]");
+
+ set_relative_rate(1.0/intp);
+
+ d_filters = std::vector<gr_fir_ccf*>(d_numchans);
+ d_channel_map.resize(d_numchans);
+
+ // Create an FIR filter for each channel and zero out the taps
+ std::vector<float> vtaps(0, d_numchans);
+ for(unsigned int i = 0; i < d_numchans; i++) {
+ d_filters[i] = gr_fir_util::create_gr_fir_ccf(vtaps);
+ d_channel_map[i] = i;
+ }
+
+ // Now, actually set the filters' taps
+ set_taps(taps);
+
+ // Create the FFT to handle the output de-spinning of the channels
+ d_fft = new gri_fft_complex (d_numchans, false);
+
+ // Although the filters change, we use this look up table
+ // to set the index of the FFT input buffer, which equivalently
+ // performs the FFT shift operation on every other turn.
+ d_rate_ratio = (int)rintf(d_numchans / d_oversample_rate);
+ d_idxlut = new int[d_numchans];
+ for(unsigned int i = 0; i < d_numchans; i++) {
+ d_idxlut[i] = d_numchans - ((i + d_rate_ratio) % d_numchans) - 1;
+ }
+
+ // Calculate the number of filtering rounds to do to evenly
+ // align the input vectors with the output channels
+ d_output_multiple = 1;
+ while((d_output_multiple * d_rate_ratio) % d_numchans != 0)
+ d_output_multiple++;
+ set_output_multiple(d_output_multiple);
+}
+
+gr_pfb_channelizer_ccf::~gr_pfb_channelizer_ccf ()
+{
+ delete d_fft;
+ delete [] d_idxlut;
+
+ for(unsigned int i = 0; i < d_numchans; i++) {
+ delete d_filters[i];
+ }
+}
+
+void
+gr_pfb_channelizer_ccf::set_taps (const std::vector<float> &taps)
+{
+ gruel::scoped_lock guard(d_mutex);
+ unsigned int i,j;
+
+ unsigned int ntaps = taps.size();
+ d_taps_per_filter = (unsigned int)ceil((double)ntaps/(double)d_numchans);
+
+ // Create d_numchan vectors to store each channel's taps
+ d_taps.resize(d_numchans);
+
+ // Make a vector of the taps plus fill it out with 0's to fill
+ // each polyphase filter with exactly d_taps_per_filter
+ std::vector<float> tmp_taps;
+ tmp_taps = taps;
+ while((float)(tmp_taps.size()) < d_numchans*d_taps_per_filter) {
+ tmp_taps.push_back(0.0);
+ }
+
+ // Partition the filter
+ for(i = 0; i < d_numchans; i++) {
+ // Each channel uses all d_taps_per_filter with 0's if not enough taps to fill out
+ d_taps[i] = std::vector<float>(d_taps_per_filter, 0);
+ for(j = 0; j < d_taps_per_filter; j++) {
+ d_taps[i][j] = tmp_taps[i + j*d_numchans]; // add taps to channels in reverse order
+ }
+
+ // Build a filter for each channel and add it's taps to it
+ d_filters[i]->set_taps(d_taps[i]);
+ }
+
+ // Set the history to ensure enough input items for each filter
+ set_history (d_taps_per_filter+1);
+
+ d_updated = true;
+}
+
+void
+gr_pfb_channelizer_ccf::print_taps()
+{
+ unsigned int i, j;
+ for(i = 0; i < d_numchans; i++) {
+ printf("filter[%d]: [", i);
+ for(j = 0; j < d_taps_per_filter; j++) {
+ printf(" %.4e", d_taps[i][j]);
+ }
+ printf("]\n\n");
+ }
+}
+
+std::vector< std::vector<float> >
+gr_pfb_channelizer_ccf::taps() const
+{
+ return d_taps;
+}
+
+void
+gr_pfb_channelizer_ccf::set_channel_map(const std::vector<int> &map)
+{
+ gruel::scoped_lock guard(d_mutex);
+
+ if(map.size() > 0) {
+ unsigned int max = (unsigned int)*std::max_element(map.begin(), map.end());
+ unsigned int min = (unsigned int)*std::min_element(map.begin(), map.end());
+ if((max >= d_numchans) || (min < 0)) {
+ throw std::invalid_argument("gr_pfb_channelizer_ccf::set_channel_map: map range out of bounds.\n");
+ }
+ d_channel_map = map;
+ }
+}
+
+std::vector<int>
+gr_pfb_channelizer_ccf::channel_map() const
+{
+ return d_channel_map;
+}
+
+
+int
+gr_pfb_channelizer_ccf::general_work (int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ gruel::scoped_lock guard(d_mutex);
+
+ gr_complex *in = (gr_complex *) input_items[0];
+ gr_complex *out = (gr_complex *) output_items[0];
+
+ if (d_updated) {
+ d_updated = false;
+ return 0; // history requirements may have changed.
+ }
+
+ size_t noutputs = output_items.size();
+
+ int n=1, i=-1, j=0, oo=0, last;
+ int toconsume = (int)rintf(noutput_items/d_oversample_rate);
+ while(n <= toconsume) {
+ j = 0;
+ i = (i + d_rate_ratio) % d_numchans;
+ last = i;
+ while(i >= 0) {
+ in = (gr_complex*)input_items[j];
+ d_fft->get_inbuf()[d_idxlut[j]] = d_filters[i]->filter(&in[n]);
+ j++;
+ i--;
+ }
+
+ i = d_numchans-1;
+ while(i > last) {
+ in = (gr_complex*)input_items[j];
+ d_fft->get_inbuf()[d_idxlut[j]] = d_filters[i]->filter(&in[n-1]);
+ j++;
+ i--;
+ }
+
+ n += (i+d_rate_ratio) >= (int)d_numchans;
+
+ // despin through FFT
+ d_fft->execute();
+
+ // Send to output channels
+ for(unsigned int nn = 0; nn < noutputs; nn++) {
+ out = (gr_complex*)output_items[nn];
+ out[oo] = d_fft->get_outbuf()[d_channel_map[nn]];
+ }
+ oo++;
+ }
+
+ consume_each(toconsume);
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/filter/gr_pfb_channelizer_ccf.h b/gnuradio-core/src/lib/filter/gr_pfb_channelizer_ccf.h
new file mode 100644
index 000000000..79ad322f9
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_pfb_channelizer_ccf.h
@@ -0,0 +1,226 @@
+/* -*- 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.
+ */
+
+
+#ifndef INCLUDED_GR_PFB_CHANNELIZER_CCF_H
+#define INCLUDED_GR_PFB_CHANNELIZER_CCF_H
+
+#include <gr_core_api.h>
+#include <gr_block.h>
+#include <gruel/thread.h>
+
+class gr_pfb_channelizer_ccf;
+typedef boost::shared_ptr<gr_pfb_channelizer_ccf> gr_pfb_channelizer_ccf_sptr;
+GR_CORE_API gr_pfb_channelizer_ccf_sptr gr_make_pfb_channelizer_ccf (unsigned int numchans,
+ const std::vector<float> &taps,
+ float oversample_rate=1);
+
+class gr_fir_ccf;
+class gri_fft_complex;
+
+
+/*!
+ * \class gr_pfb_channelizer_ccf
+ *
+ * \brief Polyphase filterbank channelizer with
+ * gr_complex input, gr_complex output and float taps
+ *
+ * \ingroup filter_blk
+ * \ingroup pfb_blk
+ *
+ * This block takes in complex inputs and channelizes it to <EM>M</EM>
+ * channels of equal bandwidth. Each of the resulting channels is
+ * decimated to the new rate that is the input sampling rate
+ * <EM>fs</EM> divided by the number of channels, <EM>M</EM>.
+ *
+ * The PFB channelizer code takes the taps generated above and builds
+ * a set of filters. The set contains <EM>M</EM> number of filters
+ * and each filter contains ceil(taps.size()/decim) number of taps.
+ * Each tap from the filter prototype is sequentially inserted into
+ * the next filter. When all of the input taps are used, the remaining
+ * filters in the filterbank are filled out with 0's to make sure each
+ * filter has the same number of taps.
+ *
+ * Each filter operates using the gr_fir filter classs of GNU Radio,
+ * which takes the input stream at <EM>i</EM> and performs the inner
+ * product calculation to <EM>i+(n-1)</EM> where <EM>n</EM> is the
+ * number of filter taps. To efficiently handle this in the GNU Radio
+ * structure, each filter input must come from its own input
+ * stream. So the channelizer must be provided with <EM>M</EM> streams
+ * where the input stream has been deinterleaved. This is most easily
+ * done using the gr_stream_to_streams block.
+ *
+ * The output is then produced as a vector, where index <EM>i</EM> in
+ * the vector is the next sample from the <EM>i</EM>th channel. This
+ * is most easily handled by sending the output to a
+ * gr_vector_to_streams block to handle the conversion and passing
+ * <EM>M</EM> streams out.
+ *
+ * The input and output formatting is done using a hier_block2 called
+ * pfb_channelizer_ccf. This can take in a single stream and outputs
+ * <EM>M</EM> streams based on the behavior described above.
+ *
+ * The filter's taps should be based on the input sampling rate.
+ *
+ * For example, using the GNU Radio's firdes utility to building
+ * filters, we build a low-pass filter with a sampling rate of
+ * <EM>fs</EM>, a 3-dB bandwidth of <EM>BW</EM> and a transition
+ * bandwidth of <EM>TB</EM>. We can also specify the out-of-band
+ * attenuation to use, <EM>ATT</EM>, and the filter window
+ * function (a Blackman-harris window in this case). The first input
+ * is the gain of the filter, which we specify here as unity.
+ *
+ * <B><EM>self._taps = gr.firdes.low_pass_2(1, fs, BW, TB,
+ * attenuation_dB=ATT, window=gr.firdes.WIN_BLACKMAN_hARRIS)</EM></B>
+ *
+ * The filter output can also be overs ampled. The over sampling rate
+ * is the ratio of the the actual output sampling rate to the normal
+ * output sampling rate. It must be rationally related to the number
+ * of channels as N/i for i in [1,N], which gives an outputsample rate
+ * of [fs/N, fs] where fs is the input sample rate and N is the number
+ * of channels.
+ *
+ * For example, for 6 channels with fs = 6000 Hz, the normal rate is
+ * 6000/6 = 1000 Hz. Allowable oversampling rates are 6/6, 6/5, 6/4,
+ * 6/3, 6/2, and 6/1 where the output sample rate of a 6/1 oversample
+ * ratio is 6000 Hz, or 6 times the normal 1000 Hz. A rate of 6/5 = 1.2,
+ * so the output rate would be 1200 Hz.
+ *
+ * The theory behind this block can be found in Chapter 6 of
+ * the following book.
+ *
+ * <B><EM>f. harris, "Multirate Signal Processing for Communication
+ * Systems," Upper Saddle River, NJ: Prentice Hall, Inc. 2004.</EM></B>
+ *
+ */
+
+class GR_CORE_API gr_pfb_channelizer_ccf : public gr_block
+{
+ private:
+ /*!
+ * Build the polyphase filterbank decimator.
+ * \param numchans (unsigned integer) Specifies the number of channels <EM>M</EM>
+ * \param taps (vector/list of floats) The prototype filter to populate the filterbank.
+ * \param oversample_rate (float) The over sampling rate is the ratio of the the actual
+ * output sampling rate to the normal output sampling rate.
+ * It must be rationally related to the number of channels
+ * as N/i for i in [1,N], which gives an outputsample rate
+ * of [fs/N, fs] where fs is the input sample rate and N is
+ * the number of channels.
+ *
+ * For example, for 6 channels with fs = 6000 Hz, the normal
+ * rate is 6000/6 = 1000 Hz. Allowable oversampling rates
+ * are 6/6, 6/5, 6/4, 6/3, 6/2, and 6/1 where the output
+ * sample rate of a 6/1 oversample ratio is 6000 Hz, or
+ * 6 times the normal 1000 Hz.
+ */
+ friend GR_CORE_API gr_pfb_channelizer_ccf_sptr gr_make_pfb_channelizer_ccf (unsigned int numchans,
+ const std::vector<float> &taps,
+ float oversample_rate);
+
+ bool d_updated;
+ unsigned int d_numchans;
+ float d_oversample_rate;
+ std::vector<gr_fir_ccf*> d_filters;
+ std::vector< std::vector<float> > d_taps;
+ unsigned int d_taps_per_filter;
+ gri_fft_complex *d_fft;
+ int *d_idxlut;
+ int d_rate_ratio;
+ int d_output_multiple;
+ std::vector<int> d_channel_map;
+ gruel::mutex d_mutex; // mutex to protect set/work access
+
+ /*!
+ * Build the polyphase filterbank decimator.
+ * \param numchans (unsigned integer) Specifies the number of channels <EM>M</EM>
+ * \param taps (vector/list of floats) The prototype filter to populate the filterbank.
+ * \param oversample_rate (float) The output over sampling rate.
+ */
+ gr_pfb_channelizer_ccf (unsigned int numchans,
+ const std::vector<float> &taps,
+ float oversample_rate);
+
+public:
+ ~gr_pfb_channelizer_ccf ();
+
+ /*!
+ * Resets the filterbank's filter taps with the new prototype filter
+ * \param taps (vector/list of floats) The prototype filter to populate the filterbank.
+ */
+ void set_taps (const std::vector<float> &taps);
+
+ /*!
+ * Print all of the filterbank taps to screen.
+ */
+ void print_taps();
+
+ /*!
+ * Return a vector<vector<>> of the filterbank taps
+ */
+ std::vector<std::vector<float> > taps() const;
+
+ /*!
+ * Set the channel map. Channels are numbers as:
+ *
+ * N/2+1 | ... | N-1 | 0 | 1 | 2 | ... | N/2
+ * <------------------- 0 -------------------->
+ * freq
+ *
+ * So output stream 0 comes from channel 0, etc. Setting a new
+ * channel map allows the user to specify which channel in frequency
+ * he/she wants to got to which output stream.
+ *
+ * The map should have the same number of elements as the number of
+ * output connections from the block. The minimum value of the map
+ * is 0 (for the 0th channel) and the maximum number is N-1 where N
+ * is the number of channels.
+ *
+ * We specify M as the number of output connections made where M <=
+ * N, so only M out of N channels are driven to an output
+ * stream. The number of items in the channel map should be at least
+ * M long. If there are more channels specified, any value in the
+ * map over M-1 will be ignored. If the size of the map is less than
+ * M the behavior is unknown (we don't wish to check every entry
+ * into the work function).
+ *
+ * This means that if the channelizer is splitting the signal up
+ * into N channels but only M channels are specified in the map
+ * (where M <= N), then M output streams must be connected and the
+ * map and the channel numbers used must be less than N-1. Output
+ * channel number can be reused, too. By default, the map is
+ * [0...M-1] with M = N.
+ */
+ void set_channel_map(const std::vector<int> &map);
+
+ /*!
+ * Gets the current channel map.
+ */
+ std::vector<int> channel_map() const;
+
+ int general_work (int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif
diff --git a/gnuradio-core/src/lib/filter/gr_pfb_channelizer_ccf.i b/gnuradio-core/src/lib/filter/gr_pfb_channelizer_ccf.i
new file mode 100644
index 000000000..1f2b49452
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_pfb_channelizer_ccf.i
@@ -0,0 +1,45 @@
+/* -*- 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,pfb_channelizer_ccf);
+
+gr_pfb_channelizer_ccf_sptr gr_make_pfb_channelizer_ccf (unsigned int numchans,
+ const std::vector<float> &taps,
+ float oversample_rate=1);
+
+class gr_pfb_channelizer_ccf : public gr_block
+{
+ private:
+ gr_pfb_channelizer_ccf (unsigned int numchans,
+ const std::vector<float> &taps,
+ float oversample_rate);
+
+ public:
+ ~gr_pfb_channelizer_ccf ();
+
+ void set_taps (const std::vector<float> &taps);
+ void print_taps();
+ std::vector<std::vector<float> > taps() const;
+
+ void set_channel_map(const std::vector<int> &map);
+ std::vector<int> channel_map() const;
+};
diff --git a/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_ccf.cc b/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_ccf.cc
new file mode 100644
index 000000000..efe417918
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_ccf.cc
@@ -0,0 +1,441 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2009-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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <cstdio>
+#include <cmath>
+
+#include <gr_pfb_clock_sync_ccf.h>
+#include <gr_fir_ccf.h>
+#include <gr_fir_util.h>
+#include <gr_io_signature.h>
+#include <gr_math.h>
+
+gr_pfb_clock_sync_ccf_sptr gr_make_pfb_clock_sync_ccf (double sps, float loop_bw,
+ const std::vector<float> &taps,
+ unsigned int filter_size,
+ float init_phase,
+ float max_rate_deviation,
+ int osps)
+{
+ return gnuradio::get_initial_sptr(new gr_pfb_clock_sync_ccf (sps, loop_bw, taps,
+ filter_size,
+ init_phase,
+ max_rate_deviation,
+ osps));
+}
+
+static int ios[] = {sizeof(gr_complex), sizeof(float), sizeof(float), sizeof(float)};
+static std::vector<int> iosig(ios, ios+sizeof(ios)/sizeof(int));
+gr_pfb_clock_sync_ccf::gr_pfb_clock_sync_ccf (double sps, float loop_bw,
+ const std::vector<float> &taps,
+ unsigned int filter_size,
+ float init_phase,
+ float max_rate_deviation,
+ int osps)
+ : gr_block ("pfb_clock_sync_ccf",
+ gr_make_io_signature (1, 1, sizeof(gr_complex)),
+ gr_make_io_signaturev (1, 4, iosig)),
+ d_updated (false), d_nfilters(filter_size),
+ d_max_dev(max_rate_deviation),
+ d_osps(osps), d_error(0), d_out_idx(0)
+{
+ d_nfilters = filter_size;
+ d_sps = floor(sps);
+
+ // Set the damping factor for a critically damped system
+ d_damping = sqrtf(2.0f)/2.0f;
+
+ // Set the bandwidth, which will then call update_gains()
+ set_loop_bandwidth(loop_bw);
+
+ // Store the last filter between calls to work
+ // The accumulator keeps track of overflow to increment the stride correctly.
+ // set it here to the fractional difference based on the initial phaes
+ d_k = init_phase;
+ d_rate = (sps-floor(sps))*(double)d_nfilters;
+ d_rate_i = (int)floor(d_rate);
+ d_rate_f = d_rate - (float)d_rate_i;
+ d_filtnum = (int)floor(d_k);
+
+ d_filters = std::vector<gr_fir_ccf*>(d_nfilters);
+ d_diff_filters = std::vector<gr_fir_ccf*>(d_nfilters);
+
+ // Create an FIR filter for each channel and zero out the taps
+ std::vector<float> vtaps(0, d_nfilters);
+ for(int i = 0; i < d_nfilters; i++) {
+ d_filters[i] = gr_fir_util::create_gr_fir_ccf(vtaps);
+ d_diff_filters[i] = gr_fir_util::create_gr_fir_ccf(vtaps);
+ }
+
+ // Now, actually set the filters' taps
+ std::vector<float> dtaps;
+ create_diff_taps(taps, dtaps);
+ set_taps(taps, d_taps, d_filters);
+ set_taps(dtaps, d_dtaps, d_diff_filters);
+}
+
+gr_pfb_clock_sync_ccf::~gr_pfb_clock_sync_ccf ()
+{
+ for(int i = 0; i < d_nfilters; i++) {
+ delete d_filters[i];
+ delete d_diff_filters[i];
+ }
+}
+
+bool
+gr_pfb_clock_sync_ccf::check_topology(int ninputs, int noutputs)
+{
+ return noutputs == 1 || noutputs == 4;
+}
+
+
+
+/*******************************************************************
+ SET FUNCTIONS
+*******************************************************************/
+
+
+void
+gr_pfb_clock_sync_ccf::set_loop_bandwidth(float bw)
+{
+ if(bw < 0) {
+ throw std::out_of_range ("gr_pfb_clock_sync_cc: invalid bandwidth. Must be >= 0.");
+ }
+
+ d_loop_bw = bw;
+ update_gains();
+}
+
+void
+gr_pfb_clock_sync_ccf::set_damping_factor(float df)
+{
+ if(df < 0 || df > 1.0) {
+ throw std::out_of_range ("gr_pfb_clock_sync_cc: invalid damping factor. Must be in [0,1].");
+ }
+
+ d_damping = df;
+ update_gains();
+}
+
+void
+gr_pfb_clock_sync_ccf::set_alpha(float alpha)
+{
+ if(alpha < 0 || alpha > 1.0) {
+ throw std::out_of_range ("gr_pfb_clock_sync_cc: invalid alpha. Must be in [0,1].");
+ }
+ d_alpha = alpha;
+}
+
+void
+gr_pfb_clock_sync_ccf::set_beta(float beta)
+{
+ if(beta < 0 || beta > 1.0) {
+ throw std::out_of_range ("gr_pfb_clock_sync_cc: invalid beta. Must be in [0,1].");
+ }
+ d_beta = beta;
+}
+
+/*******************************************************************
+ GET FUNCTIONS
+*******************************************************************/
+
+
+float
+gr_pfb_clock_sync_ccf::get_loop_bandwidth() const
+{
+ return d_loop_bw;
+}
+
+float
+gr_pfb_clock_sync_ccf::get_damping_factor() const
+{
+ return d_damping;
+}
+
+float
+gr_pfb_clock_sync_ccf::get_alpha() const
+{
+ return d_alpha;
+}
+
+float
+gr_pfb_clock_sync_ccf::get_beta() const
+{
+ return d_beta;
+}
+
+float
+gr_pfb_clock_sync_ccf::get_clock_rate() const
+{
+ return d_rate_f;
+}
+
+/*******************************************************************
+*******************************************************************/
+
+void
+gr_pfb_clock_sync_ccf::update_gains()
+{
+ float denom = (1.0 + 2.0*d_damping*d_loop_bw + d_loop_bw*d_loop_bw);
+ d_alpha = (4*d_damping*d_loop_bw) / denom;
+ d_beta = (4*d_loop_bw*d_loop_bw) / denom;
+}
+
+
+void
+gr_pfb_clock_sync_ccf::set_taps (const std::vector<float> &newtaps,
+ std::vector< std::vector<float> > &ourtaps,
+ std::vector<gr_fir_ccf*> &ourfilter)
+{
+ int i,j;
+
+ unsigned int ntaps = newtaps.size();
+ d_taps_per_filter = (unsigned int)ceil((double)ntaps/(double)d_nfilters);
+
+ // Create d_numchan vectors to store each channel's taps
+ ourtaps.resize(d_nfilters);
+
+ // Make a vector of the taps plus fill it out with 0's to fill
+ // each polyphase filter with exactly d_taps_per_filter
+ std::vector<float> tmp_taps;
+ tmp_taps = newtaps;
+ while((float)(tmp_taps.size()) < d_nfilters*d_taps_per_filter) {
+ tmp_taps.push_back(0.0);
+ }
+
+ // Partition the filter
+ for(i = 0; i < d_nfilters; i++) {
+ // Each channel uses all d_taps_per_filter with 0's if not enough taps to fill out
+ //ourtaps[d_nfilters-1-i] = std::vector<float>(d_taps_per_filter, 0);
+ ourtaps[i] = std::vector<float>(d_taps_per_filter, 0);
+ for(j = 0; j < d_taps_per_filter; j++) {
+ //ourtaps[d_nfilters - 1 - i][j] = tmp_taps[i + j*d_nfilters];
+ ourtaps[i][j] = tmp_taps[i + j*d_nfilters];
+ }
+
+ // Build a filter for each channel and add it's taps to it
+ //ourfilter[i]->set_taps(ourtaps[d_nfilters-1-i]);
+ ourfilter[i]->set_taps(ourtaps[i]);
+ }
+
+ // Set the history to ensure enough input items for each filter
+ set_history (d_taps_per_filter + d_sps);
+
+ // Make sure there is enough output space for d_osps outputs/input.
+ set_output_multiple(d_osps);
+
+ d_updated = true;
+}
+
+void
+gr_pfb_clock_sync_ccf::create_diff_taps(const std::vector<float> &newtaps,
+ std::vector<float> &difftaps)
+{
+ std::vector<float> diff_filter(3);
+ diff_filter[0] = -1;
+ diff_filter[1] = 0;
+ diff_filter[2] = 1;
+
+ float pwr = 0;
+ difftaps.push_back(0);
+ for(unsigned int i = 0; i < newtaps.size()-2; i++) {
+ float tap = 0;
+ for(int j = 0; j < 3; j++) {
+ tap += diff_filter[j]*newtaps[i+j];
+ pwr += fabsf(tap);
+ }
+ difftaps.push_back(tap);
+ }
+ difftaps.push_back(0);
+
+ for(unsigned int i = 0; i < difftaps.size(); i++) {
+ difftaps[i] *= pwr;
+ }
+}
+
+std::string
+gr_pfb_clock_sync_ccf::get_taps_as_string()
+{
+ int i, j;
+ std::stringstream str;
+ str.precision(4);
+ str.setf(std::ios::scientific);
+
+ str << "[ ";
+ for(i = 0; i < d_nfilters; i++) {
+ str << "[" << d_taps[i][0] << ", ";
+ for(j = 1; j < d_taps_per_filter-1; j++) {
+ str << d_taps[i][j] << ", ";
+ }
+ str << d_taps[i][j] << "],";
+ }
+ str << " ]" << std::endl;
+
+ return str.str();
+}
+
+std::string
+gr_pfb_clock_sync_ccf::get_diff_taps_as_string()
+{
+ int i, j;
+ std::stringstream str;
+ str.precision(4);
+ str.setf(std::ios::scientific);
+
+ str << "[ ";
+ for(i = 0; i < d_nfilters; i++) {
+ str << "[" << d_dtaps[i][0] << ", ";
+ for(j = 1; j < d_taps_per_filter-1; j++) {
+ str << d_dtaps[i][j] << ", ";
+ }
+ str << d_dtaps[i][j] << "],";
+ }
+ str << " ]" << std::endl;
+
+ return str.str();
+}
+
+std::vector< std::vector<float> >
+gr_pfb_clock_sync_ccf::get_taps()
+{
+ return d_taps;
+}
+
+std::vector< std::vector<float> >
+gr_pfb_clock_sync_ccf::get_diff_taps()
+{
+ return d_dtaps;
+}
+
+std::vector<float>
+gr_pfb_clock_sync_ccf::get_channel_taps(int channel)
+{
+ std::vector<float> taps;
+ for(int i = 0; i < d_taps_per_filter; i++) {
+ taps.push_back(d_taps[channel][i]);
+ }
+ return taps;
+}
+
+std::vector<float>
+gr_pfb_clock_sync_ccf::get_diff_channel_taps(int channel)
+{
+ std::vector<float> taps;
+ for(int i = 0; i < d_taps_per_filter; i++) {
+ taps.push_back(d_dtaps[channel][i]);
+ }
+ return taps;
+}
+
+
+int
+gr_pfb_clock_sync_ccf::general_work (int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ gr_complex *in = (gr_complex *) input_items[0];
+ gr_complex *out = (gr_complex *) output_items[0];
+
+ float *err = NULL, *outrate = NULL, *outk = NULL;
+ if(output_items.size() == 4) {
+ err = (float *) output_items[1];
+ outrate = (float*)output_items[2];
+ outk = (float*)output_items[3];
+ }
+
+ if (d_updated) {
+ d_updated = false;
+ return 0; // history requirements may have changed.
+ }
+
+ // We need this many to process one output
+ int nrequired = ninput_items[0] - d_taps_per_filter - d_osps;
+
+ int i = 0, count = 0;
+ float error_r, error_i;
+
+ // produce output as long as we can and there are enough input samples
+ while((i < noutput_items) && (count < nrequired)) {
+ while(d_out_idx < d_osps) {
+ d_filtnum = (int)floor(d_k);
+
+ // Keep the current filter number in [0, d_nfilters]
+ // If we've run beyond the last filter, wrap around and go to next sample
+ // If we've go below 0, wrap around and go to previous sample
+ while(d_filtnum >= d_nfilters) {
+ d_k -= d_nfilters;
+ d_filtnum -= d_nfilters;
+ count += 1;
+ }
+ while(d_filtnum < 0) {
+ d_k += d_nfilters;
+ d_filtnum += d_nfilters;
+ count -= 1;
+ }
+
+ out[i+d_out_idx] = d_filters[d_filtnum]->filter(&in[count+d_out_idx]);
+ d_k = d_k + d_rate_i + d_rate_f; // update phase
+ d_out_idx++;
+
+ if(output_items.size() == 4) {
+ err[i] = d_error;
+ outrate[i] = d_rate_f;
+ outk[i] = d_k;
+ }
+
+ // We've run out of output items we can create; return now.
+ if(i+d_out_idx >= noutput_items) {
+ consume_each(count);
+ return i;
+ }
+ }
+
+ // reset here; if we didn't complete a full osps samples last time,
+ // the early return would take care of it.
+ d_out_idx = 0;
+
+ // Update the phase and rate estimates for this symbol
+ gr_complex diff = d_diff_filters[d_filtnum]->filter(&in[count]);
+ error_r = out[i].real() * diff.real();
+ error_i = out[i].imag() * diff.imag();
+ d_error = (error_i + error_r) / 2.0; // average error from I&Q channel
+
+ // Run the control loop to update the current phase (k) and
+ // tracking rate estimates based on the error value
+ d_rate_f = d_rate_f + d_beta*d_error;
+ d_k = d_k + d_alpha*d_error;
+
+ // Keep our rate within a good range
+ d_rate_f = gr_branchless_clip(d_rate_f, d_max_dev);
+
+ i+=d_osps;
+ count += (int)floor(d_sps);
+ }
+
+ consume_each(count);
+ return i;
+}
diff --git a/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_ccf.h b/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_ccf.h
new file mode 100644
index 000000000..8715b4b10
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_ccf.h
@@ -0,0 +1,375 @@
+/* -*- 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.
+ */
+
+
+#ifndef INCLUDED_GR_PFB_CLOCK_SYNC_CCF_H
+#define INCLUDED_GR_PFB_CLOCK_SYNC_CCF_H
+
+#include <gr_core_api.h>
+#include <gr_block.h>
+
+class gr_pfb_clock_sync_ccf;
+typedef boost::shared_ptr<gr_pfb_clock_sync_ccf> gr_pfb_clock_sync_ccf_sptr;
+GR_CORE_API gr_pfb_clock_sync_ccf_sptr gr_make_pfb_clock_sync_ccf (double sps, float loop_bw,
+ const std::vector<float> &taps,
+ unsigned int filter_size=32,
+ float init_phase=0,
+ float max_rate_deviation=1.5,
+ int osps=1);
+
+class gr_fir_ccf;
+
+/*!
+ * \class gr_pfb_clock_sync_ccf
+ *
+ * \brief Timing synchronizer using polyphase filterbanks
+ *
+ * \ingroup filter_blk
+ * \ingroup pfb_blk
+ *
+ * This block performs timing synchronization for PAM signals by
+ * minimizing the derivative of the filtered signal, which in turn
+ * maximizes the SNR and minimizes ISI.
+ *
+ * This approach works by setting up two filterbanks; one filterbank
+ * contains the signal's pulse shaping matched filter (such as a root
+ * raised cosine filter), where each branch of the filterbank contains
+ * a different phase of the filter. The second filterbank contains
+ * the derivatives of the filters in the first filterbank. Thinking of
+ * this in the time domain, the first filterbank contains filters that
+ * have a sinc shape to them. We want to align the output signal to be
+ * sampled at exactly the peak of the sinc shape. The derivative of
+ * the sinc contains a zero at the maximum point of the sinc (sinc(0)
+ * = 1, sinc(0)' = 0). Furthermore, the region around the zero point
+ * is relatively linear. We make use of this fact to generate the
+ * error signal.
+ *
+ * If the signal out of the derivative filters is d_i[n] for the ith
+ * filter, and the output of the matched filter is x_i[n], we
+ * calculate the error as: e[n] = (Re{x_i[n]} * Re{d_i[n]} +
+ * Im{x_i[n]} * Im{d_i[n]}) / 2.0 This equation averages the error in
+ * the real and imaginary parts. There are two reasons we multiply by
+ * the signal itself. First, if the symbol could be positive or
+ * negative going, but we want the error term to always tell us to go
+ * in the same direction depending on which side of the zero point we
+ * are on. The sign of x_i[n] adjusts the error term to do
+ * this. Second, the magnitude of x_i[n] scales the error term
+ * depending on the symbol's amplitude, so larger signals give us a
+ * stronger error term because we have more confidence in that
+ * symbol's value. Using the magnitude of x_i[n] instead of just the
+ * sign is especially good for signals with low SNR.
+ *
+ * The error signal, e[n], gives us a value proportional to how far
+ * away from the zero point we are in the derivative signal. We want
+ * to drive this value to zero, so we set up a second order loop. We
+ * have two variables for this loop; d_k is the filter number in the
+ * filterbank we are on and d_rate is the rate which we travel through
+ * the filters in the steady state. That is, due to the natural clock
+ * differences between the transmitter and receiver, d_rate represents
+ * that difference and would traverse the filter phase paths to keep
+ * the receiver locked. Thinking of this as a second-order PLL, the
+ * d_rate is the frequency and d_k is the phase. So we update d_rate
+ * and d_k using the standard loop equations based on two error
+ * signals, d_alpha and d_beta. We have these two values set based on
+ * each other for a critically damped system, so in the block
+ * constructor, we just ask for "gain," which is d_alpha while d_beta
+ * is equal to (gain^2)/4.
+ *
+ * The block's parameters are:
+ *
+ * \li \p sps: The clock sync block needs to know the number of samples per
+ * symbol, because it defaults to return a single point representing
+ * the symbol. The sps can be any positive real number and does not
+ * need to be an integer.
+ *
+ * \li \p loop_bw: The loop bandwidth is used to set the gain of the
+ * inner control loop (see:
+ * http://gnuradio.squarespace.com/blog/2011/8/13/control-loop-gain-values.html).
+ * This should be set small (a value of around 2pi/100 is suggested in
+ * that blog post as the step size for the number of radians around
+ * the unit circle to move relative to the error).
+ *
+ * \li \p taps: One of the most important parameters for this block is
+ * the taps of the filter. One of the benefits of this algorithm is
+ * that you can put the matched filter in here as the taps, so you get
+ * both the matched filter and sample timing correction in one go. So
+ * create your normal matched filter. For a typical digital
+ * modulation, this is a root raised cosine filter. The number of taps
+ * of this filter is based on how long you expect the channel to be;
+ * that is, how many symbols do you want to combine to get the current
+ * symbols energy back (there's probably a better way of stating
+ * that). It's usually 5 to 10 or so. That gives you your filter, but
+ * now we need to think about it as a filter with different phase
+ * profiles in each filter. So take this number of taps and multiply
+ * it by the number of filters. This is the number you would use to
+ * create your prototype filter. When you use this in the PFB
+ * filerbank, it segments these taps into the filterbanks in such a
+ * way that each bank now represents the filter at different phases,
+ * equally spaced at 2pi/N, where N is the number of filters.
+ *
+ * \li \p filter_size (default=32): The number of filters can also be
+ * set and defaults to 32. With 32 filters, you get a good enough
+ * resolution in the phase to produce very small, almost unnoticeable,
+ * ISI. Going to 64 filters can reduce this more, but after that
+ * there is very little gained for the extra complexity.
+ *
+ * \li \p init_phase (default=0): The initial phase is another
+ * settable parameter and refers to the filter path the algorithm
+ * initially looks at (i.e., d_k starts at init_phase). This value
+ * defaults to zero, but it might be useful to start at a different
+ * phase offset, such as the mid-point of the filters.
+ *
+ * \li \p max_rate_deviation (default=1.5): The next parameter is the
+ * max_rate_devitation, which defaults to 1.5. This is how far we
+ * allow d_rate to swing, positive or negative, from 0. Constraining
+ * the rate can help keep the algorithm from walking too far away to
+ * lock during times when there is no signal.
+ *
+ * \li \p osps (default=1): The osps is the number of output samples per symbol. By default,
+ * the algorithm produces 1 sample per symbol, sampled at the exact
+ * sample value. This osps value was added to better work with
+ * equalizers, which do a better job of modeling the channel if they
+ * have 2 samps/sym.
+ */
+
+class GR_CORE_API gr_pfb_clock_sync_ccf : public gr_block
+{
+ private:
+ /*!
+ * Build the polyphase filterbank timing synchronizer.
+ * \param sps (double) The number of samples per symbol in the incoming signal
+ * \param loop_bw (float) The bandwidth of the control loop; set's alpha and beta.
+ * \param taps (vector<int>) The filter taps.
+ * \param filter_size (uint) The number of filters in the filterbank (default = 32).
+ * \param init_phase (float) The initial phase to look at, or which filter to start
+ * with (default = 0).
+ * \param max_rate_deviation (float) Distance from 0 d_rate can get (default = 1.5).
+ * \param osps (int) The number of output samples per symbol (default=1).
+ *
+ */
+
+ friend GR_CORE_API gr_pfb_clock_sync_ccf_sptr gr_make_pfb_clock_sync_ccf (double sps, float loop_bw,
+ const std::vector<float> &taps,
+ unsigned int filter_size,
+ float init_phase,
+ float max_rate_deviation,
+ int osps);
+
+ bool d_updated;
+ double d_sps;
+ double d_sample_num;
+ float d_loop_bw;
+ float d_damping;
+ float d_alpha;
+ float d_beta;
+
+ int d_nfilters;
+ int d_taps_per_filter;
+ std::vector<gr_fir_ccf*> d_filters;
+ std::vector<gr_fir_ccf*> d_diff_filters;
+ std::vector< std::vector<float> > d_taps;
+ std::vector< std::vector<float> > d_dtaps;
+
+ float d_k;
+ float d_rate;
+ float d_rate_i;
+ float d_rate_f;
+ float d_max_dev;
+ int d_filtnum;
+ int d_osps;
+ float d_error;
+ int d_out_idx;
+
+ /*!
+ * Build the polyphase filterbank timing synchronizer.
+ */
+ gr_pfb_clock_sync_ccf (double sps, float loop_bw,
+ const std::vector<float> &taps,
+ unsigned int filter_size,
+ float init_phase,
+ float max_rate_deviation,
+ int osps);
+
+ void create_diff_taps(const std::vector<float> &newtaps,
+ std::vector<float> &difftaps);
+
+public:
+ ~gr_pfb_clock_sync_ccf ();
+
+ /*! \brief update the system gains from omega and eta
+ *
+ * This function updates the system gains based on the loop
+ * bandwidth and damping factor of the system.
+ * These two factors can be set separately through their own
+ * set functions.
+ */
+ void update_gains();
+
+ /*!
+ * Resets the filterbank's filter taps with the new prototype filter
+ */
+ void set_taps (const std::vector<float> &taps,
+ std::vector< std::vector<float> > &ourtaps,
+ std::vector<gr_fir_ccf*> &ourfilter);
+
+ /*!
+ * Returns all of the taps of the matched filter
+ */
+ std::vector< std::vector<float> > get_taps();
+
+ /*!
+ * Returns all of the taps of the derivative filter
+ */
+ std::vector< std::vector<float> > get_diff_taps();
+
+ /*!
+ * Returns the taps of the matched filter for a particular channel
+ */
+ std::vector<float> get_channel_taps(int channel);
+
+ /*!
+ * Returns the taps in the derivative filter for a particular channel
+ */
+ std::vector<float> get_diff_channel_taps(int channel);
+
+ /*!
+ * Return the taps as a formatted string for printing
+ */
+ std::string get_taps_as_string();
+
+ /*!
+ * Return the derivative filter taps as a formatted string for printing
+ */
+ std::string get_diff_taps_as_string();
+
+
+ /*******************************************************************
+ SET FUNCTIONS
+ *******************************************************************/
+
+
+ /*!
+ * \brief Set the loop bandwidth
+ *
+ * Set the loop filter's bandwidth to \p bw. This should be between
+ * 2*pi/200 and 2*pi/100 (in rads/samp). It must also be a positive
+ * number.
+ *
+ * When a new damping factor is set, the gains, alpha and beta, of the loop
+ * are recalculated by a call to update_gains().
+ *
+ * \param bw (float) new bandwidth
+ *
+ */
+ void set_loop_bandwidth(float bw);
+
+ /*!
+ * \brief Set the loop damping factor
+ *
+ * Set the loop filter's damping factor to \p df. The damping factor
+ * should be sqrt(2)/2.0 for critically damped systems.
+ * Set it to anything else only if you know what you are doing. It must
+ * be a number between 0 and 1.
+ *
+ * When a new damping factor is set, the gains, alpha and beta, of the loop
+ * are recalculated by a call to update_gains().
+ *
+ * \param df (float) new damping factor
+ *
+ */
+ void set_damping_factor(float df);
+
+ /*!
+ * \brief Set the loop gain alpha
+ *
+ * Set's the loop filter's alpha gain parameter.
+ *
+ * This value should really only be set by adjusting the loop bandwidth
+ * and damping factor.
+ *
+ * \param alpha (float) new alpha gain
+ *
+ */
+ void set_alpha(float alpha);
+
+ /*!
+ * \brief Set the loop gain beta
+ *
+ * Set's the loop filter's beta gain parameter.
+ *
+ * This value should really only be set by adjusting the loop bandwidth
+ * and damping factor.
+ *
+ * \param beta (float) new beta gain
+ *
+ */
+ void set_beta(float beta);
+
+ /*!
+ * Set the maximum deviation from 0 d_rate can have
+ */
+ void set_max_rate_deviation(float m)
+ {
+ d_max_dev = m;
+ }
+
+ /*******************************************************************
+ GET FUNCTIONS
+ *******************************************************************/
+
+ /*!
+ * \brief Returns the loop bandwidth
+ */
+ float get_loop_bandwidth() const;
+
+ /*!
+ * \brief Returns the loop damping factor
+ */
+ float get_damping_factor() const;
+
+ /*!
+ * \brief Returns the loop gain alpha
+ */
+ float get_alpha() const;
+
+ /*!
+ * \brief Returns the loop gain beta
+ */
+ float get_beta() const;
+
+ /*!
+ * \brief Returns the current clock rate
+ */
+ float get_clock_rate() const;
+
+ /*******************************************************************
+ *******************************************************************/
+
+ bool check_topology(int ninputs, int noutputs);
+
+ int general_work (int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif
diff --git a/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_ccf.i b/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_ccf.i
new file mode 100644
index 000000000..85915196f
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_ccf.i
@@ -0,0 +1,67 @@
+/* -*- 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,pfb_clock_sync_ccf);
+
+gr_pfb_clock_sync_ccf_sptr gr_make_pfb_clock_sync_ccf (double sps, float loop_bw,
+ const std::vector<float> &taps,
+ unsigned int filter_size=32,
+ float init_phase=0,
+ float max_rate_deviation=1.5,
+ int osps=1);
+
+class gr_pfb_clock_sync_ccf : public gr_block
+{
+ private:
+ gr_pfb_clock_sync_ccf (double sps, float loop_bw,
+ const std::vector<float> &taps,
+ unsigned int filter_size,
+ float init_phase,
+ float max_rate_deviation,
+ int osps);
+
+ public:
+ ~gr_pfb_clock_sync_ccf ();
+
+ void set_taps (const std::vector<float> &taps,
+ std::vector< std::vector<float> > &ourtaps,
+ std::vector<gr_fir_ccf*> &ourfilter);
+
+ std::vector< std::vector<float> > get_taps();
+ std::vector< std::vector<float> > get_diff_taps();
+ std::vector<float> get_channel_taps(int channel);
+ std::vector<float> get_diff_channel_taps(int channel);
+ std::string get_taps_as_string();
+ std::string get_diff_taps_as_string();
+
+ void set_loop_bandwidth(float bw);
+ void set_damping_factor(float df);
+ void set_alpha(float alpha);
+ void set_beta(float beta);
+ void set_max_rate_deviation(float m);
+
+ float get_loop_bandwidth() const;
+ float get_damping_factor() const;
+ float get_alpha() const;
+ float get_beta() const;
+ float get_clock_rate() const;
+};
diff --git a/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_fff.cc b/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_fff.cc
new file mode 100644
index 000000000..886f98913
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_fff.cc
@@ -0,0 +1,288 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <cstdio>
+#include <cmath>
+
+#include <gr_pfb_clock_sync_fff.h>
+#include <gr_fir_fff.h>
+#include <gr_fir_util.h>
+#include <gr_io_signature.h>
+#include <gr_math.h>
+
+gr_pfb_clock_sync_fff_sptr gr_make_pfb_clock_sync_fff (double sps, float gain,
+ const std::vector<float> &taps,
+ unsigned int filter_size,
+ float init_phase,
+ float max_rate_deviation)
+{
+ return gnuradio::get_initial_sptr(new gr_pfb_clock_sync_fff (sps, gain, taps,
+ filter_size,
+ init_phase,
+ max_rate_deviation));
+}
+
+static int ios[] = {sizeof(float), sizeof(float), sizeof(float), sizeof(float)};
+static std::vector<int> iosig(ios, ios+sizeof(ios)/sizeof(int));
+gr_pfb_clock_sync_fff::gr_pfb_clock_sync_fff (double sps, float gain,
+ const std::vector<float> &taps,
+ unsigned int filter_size,
+ float init_phase,
+ float max_rate_deviation)
+ : gr_block ("pfb_clock_sync_fff",
+ gr_make_io_signature (1, 1, sizeof(float)),
+ gr_make_io_signaturev (1, 4, iosig)),
+ d_updated (false), d_nfilters(filter_size),
+ d_max_dev(max_rate_deviation)
+{
+ d_nfilters = filter_size;
+ d_sps = floor(sps);
+
+ // Store the last filter between calls to work
+ // The accumulator keeps track of overflow to increment the stride correctly.
+ // set it here to the fractional difference based on the initial phaes
+ set_alpha(gain);
+ set_beta(0.25*gain*gain);
+ d_k = init_phase;
+ d_rate = (sps-floor(sps))*(double)d_nfilters;
+ d_rate_i = (int)floor(d_rate);
+ d_rate_f = d_rate - (float)d_rate_i;
+ d_filtnum = (int)floor(d_k);
+
+ d_filters = std::vector<gr_fir_fff*>(d_nfilters);
+ d_diff_filters = std::vector<gr_fir_fff*>(d_nfilters);
+
+ // Create an FIR filter for each channel and zero out the taps
+ std::vector<float> vtaps(0, d_nfilters);
+ for(int i = 0; i < d_nfilters; i++) {
+ d_filters[i] = gr_fir_util::create_gr_fir_fff(vtaps);
+ d_diff_filters[i] = gr_fir_util::create_gr_fir_fff(vtaps);
+ }
+
+ // Now, actually set the filters' taps
+ std::vector<float> dtaps;
+ create_diff_taps(taps, dtaps);
+ set_taps(taps, d_taps, d_filters);
+ set_taps(dtaps, d_dtaps, d_diff_filters);
+}
+
+gr_pfb_clock_sync_fff::~gr_pfb_clock_sync_fff ()
+{
+ for(int i = 0; i < d_nfilters; i++) {
+ delete d_filters[i];
+ delete d_diff_filters[i];
+ }
+}
+
+bool
+gr_pfb_clock_sync_fff::check_topology(int ninputs, int noutputs)
+{
+ return noutputs == 1 || noutputs == 4;
+}
+
+void
+gr_pfb_clock_sync_fff::set_taps (const std::vector<float> &newtaps,
+ std::vector< std::vector<float> > &ourtaps,
+ std::vector<gr_fir_fff*> &ourfilter)
+{
+ int i,j;
+
+ unsigned int ntaps = newtaps.size();
+ d_taps_per_filter = (unsigned int)ceil((double)ntaps/(double)d_nfilters);
+
+ // Create d_numchan vectors to store each channel's taps
+ ourtaps.resize(d_nfilters);
+
+ // Make a vector of the taps plus fill it out with 0's to fill
+ // each polyphase filter with exactly d_taps_per_filter
+ std::vector<float> tmp_taps;
+ tmp_taps = newtaps;
+ while((float)(tmp_taps.size()) < d_nfilters*d_taps_per_filter) {
+ tmp_taps.push_back(0.0);
+ }
+
+ // Partition the filter
+ for(i = 0; i < d_nfilters; i++) {
+ // Each channel uses all d_taps_per_filter with 0's if not enough taps to fill out
+ ourtaps[d_nfilters-1-i] = std::vector<float>(d_taps_per_filter, 0);
+ for(j = 0; j < d_taps_per_filter; j++) {
+ ourtaps[d_nfilters - 1 - i][j] = tmp_taps[i + j*d_nfilters];
+ }
+
+ // Build a filter for each channel and add it's taps to it
+ ourfilter[i]->set_taps(ourtaps[d_nfilters-1-i]);
+ }
+
+ // Set the history to ensure enough input items for each filter
+ set_history (d_taps_per_filter + d_sps);
+
+ d_updated = true;
+}
+
+void
+gr_pfb_clock_sync_fff::create_diff_taps(const std::vector<float> &newtaps,
+ std::vector<float> &difftaps)
+{
+ float maxtap = 1e-20;
+ difftaps.clear();
+ difftaps.push_back(0); //newtaps[0]);
+ for(unsigned int i = 1; i < newtaps.size()-1; i++) {
+ float tap = newtaps[i+1] - newtaps[i-1];
+ difftaps.push_back(tap);
+ if(tap > maxtap) {
+ maxtap = tap;
+ }
+ }
+ difftaps.push_back(0);//-newtaps[newtaps.size()-1]);
+
+ // Scale the differential taps; helps scale error term to better update state
+ // FIXME: should this be scaled this way or use the same gain as the taps?
+ for(unsigned int i = 0; i < difftaps.size(); i++) {
+ difftaps[i] /= maxtap;
+ }
+}
+
+void
+gr_pfb_clock_sync_fff::print_taps()
+{
+ int i, j;
+ printf("[ ");
+ for(i = 0; i < d_nfilters; i++) {
+ printf("[%.4e, ", d_taps[i][0]);
+ for(j = 1; j < d_taps_per_filter-1; j++) {
+ printf("%.4e,", d_taps[i][j]);
+ }
+ printf("%.4e],", d_taps[i][j]);
+ }
+ printf(" ]\n");
+}
+
+void
+gr_pfb_clock_sync_fff::print_diff_taps()
+{
+ int i, j;
+ printf("[ ");
+ for(i = 0; i < d_nfilters; i++) {
+ printf("[%.4e, ", d_dtaps[i][0]);
+ for(j = 1; j < d_taps_per_filter-1; j++) {
+ printf("%.4e,", d_dtaps[i][j]);
+ }
+ printf("%.4e],", d_dtaps[i][j]);
+ }
+ printf(" ]\n");
+}
+
+
+std::vector<float>
+gr_pfb_clock_sync_fff::channel_taps(int channel)
+{
+ std::vector<float> taps;
+ for(int i = 0; i < d_taps_per_filter; i++) {
+ taps.push_back(d_taps[channel][i]);
+ }
+ return taps;
+}
+
+std::vector<float>
+gr_pfb_clock_sync_fff::diff_channel_taps(int channel)
+{
+ std::vector<float> taps;
+ for(int i = 0; i < d_taps_per_filter; i++) {
+ taps.push_back(d_dtaps[channel][i]);
+ }
+ return taps;
+}
+
+
+int
+gr_pfb_clock_sync_fff::general_work (int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ float *in = (float *) input_items[0];
+ float *out = (float *) output_items[0];
+
+ float *err = 0, *outrate = 0, *outk = 0;
+ if(output_items.size() == 4) {
+ err = (float *) output_items[1];
+ outrate = (float*)output_items[2];
+ outk = (float*)output_items[3];
+ }
+
+ if (d_updated) {
+ d_updated = false;
+ return 0; // history requirements may have changed.
+ }
+
+ // We need this many to process one output
+ int nrequired = ninput_items[0] - d_taps_per_filter;
+
+ int i = 0, count = 0;
+ float error;
+
+ // produce output as long as we can and there are enough input samples
+ while((i < noutput_items) && (count < nrequired)) {
+ d_filtnum = (int)floor(d_k);
+
+ // Keep the current filter number in [0, d_nfilters]
+ // If we've run beyond the last filter, wrap around and go to next sample
+ // If we've go below 0, wrap around and go to previous sample
+ while(d_filtnum >= d_nfilters) {
+ d_k -= d_nfilters;
+ d_filtnum -= d_nfilters;
+ count += 1;
+ }
+ while(d_filtnum < 0) {
+ d_k += d_nfilters;
+ d_filtnum += d_nfilters;
+ count -= 1;
+ }
+
+ out[i] = d_filters[d_filtnum]->filter(&in[count]);
+ float diff = d_diff_filters[d_filtnum]->filter(&in[count]);
+ error = out[i] * diff;
+
+ // Run the control loop to update the current phase (k) and tracking rate
+ d_k = d_k + d_alpha*error + d_rate_i + d_rate_f;
+ d_rate_f = d_rate_f + d_beta*error;
+
+ // Keep our rate within a good range
+ d_rate_f = gr_branchless_clip(d_rate_f, d_max_dev);
+
+ i++;
+ count += (int)floor(d_sps);
+
+ if(output_items.size() == 4) {
+ err[i] = error;
+ outrate[i] = d_rate_f;
+ outk[i] = d_k;
+ }
+ }
+ consume_each(count);
+
+ return i;
+}
diff --git a/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_fff.h b/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_fff.h
new file mode 100644
index 000000000..4909d556b
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_fff.h
@@ -0,0 +1,266 @@
+/* -*- 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.
+ */
+
+
+#ifndef INCLUDED_GR_PFB_CLOCK_SYNC_FFF_H
+#define INCLUDED_GR_PFB_CLOCK_SYNC_FFF_H
+
+#include <gr_core_api.h>
+#include <gr_block.h>
+
+class gr_pfb_clock_sync_fff;
+typedef boost::shared_ptr<gr_pfb_clock_sync_fff> gr_pfb_clock_sync_fff_sptr;
+GR_CORE_API gr_pfb_clock_sync_fff_sptr gr_make_pfb_clock_sync_fff (double sps, float gain,
+ const std::vector<float> &taps,
+ unsigned int filter_size=32,
+ float init_phase=0,
+ float max_rate_deviation=1.5);
+
+class gr_fir_fff;
+
+/*!
+ * \class gr_pfb_clock_sync_fff
+ *
+ * \brief Timing synchronizer using polyphase filterbanks
+ *
+ * \ingroup filter_blk
+ * \ingroup pfb_blk
+ *
+ * This block performs timing synchronization for PAM signals by
+ * minimizing the derivative of the filtered signal, which in turn
+ * maximizes the SNR and minimizes ISI.
+ *
+ * This approach works by setting up two filterbanks; one filterbank
+ * contains the signal's pulse shaping matched filter (such as a root
+ * raised cosine filter), where each branch of the filterbank contains
+ * a different phase of the filter. The second filterbank contains
+ * the derivatives of the filters in the first filterbank. Thinking of
+ * this in the time domain, the first filterbank contains filters that
+ * have a sinc shape to them. We want to align the output signal to be
+ * sampled at exactly the peak of the sinc shape. The derivative of
+ * the sinc contains a zero at the maximum point of the sinc (sinc(0)
+ * = 1, sinc(0)' = 0). Furthermore, the region around the zero point
+ * is relatively linear. We make use of this fact to generate the
+ * error signal.
+ *
+ * If the signal out of the derivative filters is d_i[n] for the ith
+ * filter, and the output of the matched filter is x_i[n], we
+ * calculate the error as: e[n] = (Re{x_i[n]} * Re{d_i[n]} +
+ * Im{x_i[n]} * Im{d_i[n]}) / 2.0 This equation averages the error in
+ * the real and imaginary parts. There are two reasons we multiply by
+ * the signal itself. First, if the symbol could be positive or
+ * negative going, but we want the error term to always tell us to go
+ * in the same direction depending on which side of the zero point we
+ * are on. The sign of x_i[n] adjusts the error term to do
+ * this. Second, the magnitude of x_i[n] scales the error term
+ * depending on the symbol's amplitude, so larger signals give us a
+ * stronger error term because we have more confidence in that
+ * symbol's value. Using the magnitude of x_i[n] instead of just the
+ * sign is especially good for signals with low SNR.
+ *
+ * The error signal, e[n], gives us a value proportional to how far
+ * away from the zero point we are in the derivative signal. We want
+ * to drive this value to zero, so we set up a second order loop. We
+ * have two variables for this loop; d_k is the filter number in the
+ * filterbank we are on and d_rate is the rate which we travel through
+ * the filters in the steady state. That is, due to the natural clock
+ * differences between the transmitter and receiver, d_rate represents
+ * that difference and would traverse the filter phase paths to keep
+ * the receiver locked. Thinking of this as a second-order PLL, the
+ * d_rate is the frequency and d_k is the phase. So we update d_rate
+ * and d_k using the standard loop equations based on two error
+ * signals, d_alpha and d_beta. We have these two values set based on
+ * each other for a critically damped system, so in the block
+ * constructor, we just ask for "gain," which is d_alpha while d_beta
+ * is equal to (gain^2)/4.
+ *
+ * The block's parameters are:
+ *
+ * \li \p sps: The clock sync block needs to know the number of samples per
+ * symbol, because it defaults to return a single point representing
+ * the symbol. The sps can be any positive real number and does not
+ * need to be an integer.
+ *
+ * \li \p loop_bw: The loop bandwidth is used to set the gain of the
+ * inner control loop (see:
+ * http://gnuradio.squarespace.com/blog/2011/8/13/control-loop-gain-values.html).
+ * This should be set small (a value of around 2pi/100 is suggested in
+ * that blog post as the step size for the number of radians around
+ * the unit circle to move relative to the error).
+ *
+ * \li \p taps: One of the most important parameters for this block is
+ * the taps of the filter. One of the benefits of this algorithm is
+ * that you can put the matched filter in here as the taps, so you get
+ * both the matched filter and sample timing correction in one go. So
+ * create your normal matched filter. For a typical digital
+ * modulation, this is a root raised cosine filter. The number of taps
+ * of this filter is based on how long you expect the channel to be;
+ * that is, how many symbols do you want to combine to get the current
+ * symbols energy back (there's probably a better way of stating
+ * that). It's usually 5 to 10 or so. That gives you your filter, but
+ * now we need to think about it as a filter with different phase
+ * profiles in each filter. So take this number of taps and multiply
+ * it by the number of filters. This is the number you would use to
+ * create your prototype filter. When you use this in the PFB
+ * filerbank, it segments these taps into the filterbanks in such a
+ * way that each bank now represents the filter at different phases,
+ * equally spaced at 2pi/N, where N is the number of filters.
+ *
+ * \li \p filter_size (default=32): The number of filters can also be
+ * set and defaults to 32. With 32 filters, you get a good enough
+ * resolution in the phase to produce very small, almost unnoticeable,
+ * ISI. Going to 64 filters can reduce this more, but after that
+ * there is very little gained for the extra complexity.
+ *
+ * \li \p init_phase (default=0): The initial phase is another
+ * settable parameter and refers to the filter path the algorithm
+ * initially looks at (i.e., d_k starts at init_phase). This value
+ * defaults to zero, but it might be useful to start at a different
+ * phase offset, such as the mid-point of the filters.
+ *
+ * \li \p max_rate_deviation (default=1.5): The next parameter is the
+ * max_rate_devitation, which defaults to 1.5. This is how far we
+ * allow d_rate to swing, positive or negative, from 0. Constraining
+ * the rate can help keep the algorithm from walking too far away to
+ * lock during times when there is no signal.
+ *
+ * \li \p osps: note that unlike the ccf version of this algorithm,
+ * this block does \a not have a setting for the number of output
+ * samples per symbol. This is mostly because it should not be
+ * necessary as the reason for having multiple output sps is to
+ * perform equalization and the equalizers will take in complex
+ * numbers in order to do magnitude and phase correction.
+ */
+
+class GR_CORE_API gr_pfb_clock_sync_fff : public gr_block
+{
+ private:
+ /*!
+ * Build the polyphase filterbank timing synchronizer.
+ * \param sps (double) The number of samples per second in the incoming signal
+ * \param gain (float) The alpha gain of the control loop; beta = (gain^2)/4 by default.
+ * \param taps (vector<int>) The filter taps.
+ * \param filter_size (uint) The number of filters in the filterbank (default = 32).
+ * \param init_phase (float) The initial phase to look at, or which filter to start
+ * with (default = 0).
+ * \param max_rate_deviation (float) Distance from 0 d_rate can get (default = 1.5).
+ *
+ */
+ friend GR_CORE_API gr_pfb_clock_sync_fff_sptr gr_make_pfb_clock_sync_fff (double sps, float gain,
+ const std::vector<float> &taps,
+ unsigned int filter_size,
+ float init_phase,
+ float max_rate_deviation);
+
+ bool d_updated;
+ double d_sps;
+ double d_sample_num;
+ float d_alpha;
+ float d_beta;
+ int d_nfilters;
+ std::vector<gr_fir_fff*> d_filters;
+ std::vector<gr_fir_fff*> d_diff_filters;
+ std::vector< std::vector<float> > d_taps;
+ std::vector< std::vector<float> > d_dtaps;
+ float d_k;
+ float d_rate;
+ float d_rate_i;
+ float d_rate_f;
+ float d_max_dev;
+ int d_filtnum;
+ int d_taps_per_filter;
+
+ /*!
+ * Build the polyphase filterbank timing synchronizer.
+ */
+ gr_pfb_clock_sync_fff (double sps, float gain,
+ const std::vector<float> &taps,
+ unsigned int filter_size,
+ float init_phase,
+ float max_rate_deviation);
+
+ void create_diff_taps(const std::vector<float> &newtaps,
+ std::vector<float> &difftaps);
+
+public:
+ ~gr_pfb_clock_sync_fff ();
+
+ /*!
+ * Resets the filterbank's filter taps with the new prototype filter
+ */
+ void set_taps (const std::vector<float> &taps,
+ std::vector< std::vector<float> > &ourtaps,
+ std::vector<gr_fir_fff*> &ourfilter);
+
+ /*!
+ * Returns the taps of the matched filter
+ */
+ std::vector<float> channel_taps(int channel);
+
+ /*!
+ * Returns the taps in the derivative filter
+ */
+ std::vector<float> diff_channel_taps(int channel);
+
+ /*!
+ * Print all of the filterbank taps to screen.
+ */
+ void print_taps();
+
+ /*!
+ * Print all of the filterbank taps of the derivative filter to screen.
+ */
+ void print_diff_taps();
+
+ /*!
+ * Set the gain value alpha for the control loop
+ */
+ void set_alpha(float alpha)
+ {
+ d_alpha = alpha;
+ }
+
+ /*!
+ * Set the gain value beta for the control loop
+ */
+ void set_beta(float beta)
+ {
+ d_beta = beta;
+ }
+
+ /*!
+ * Set the maximum deviation from 0 d_rate can have
+ */
+ void set_max_rate_deviation(float m)
+ {
+ d_max_dev = m;
+ }
+
+ bool check_topology(int ninputs, int noutputs);
+
+ int general_work (int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif
diff --git a/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_fff.i b/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_fff.i
new file mode 100644
index 000000000..754af1a87
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_fff.i
@@ -0,0 +1,54 @@
+/* -*- 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,pfb_clock_sync_fff);
+
+gr_pfb_clock_sync_fff_sptr gr_make_pfb_clock_sync_fff (double sps, float gain,
+ const std::vector<float> &taps,
+ unsigned int filter_size=32,
+ float init_phase=0,
+ float max_rate_deviation=1.5);
+
+class gr_pfb_clock_sync_fff : public gr_block
+{
+ private:
+ gr_pfb_clock_sync_fff (double sps, float gain,
+ const std::vector<float> &taps,
+ unsigned int filter_size,
+ float init_phase,
+ float max_rate_deviation);
+
+ public:
+ ~gr_pfb_clock_sync_fff ();
+
+ void set_taps (const std::vector<float> &taps,
+ std::vector< std::vector<float> > &ourtaps,
+ std::vector<gr_fir_fff*> &ourfilter);
+
+ std::vector<float> channel_taps(int channel);
+ std::vector<float> diff_channel_taps(int channel);
+ void print_taps();
+ void print_diff_taps();
+ void set_alpha(float alpha);
+ void set_beta(float beta);
+ void set_max_rate_deviation(float m);
+};
diff --git a/gnuradio-core/src/lib/filter/gr_pfb_decimator_ccf.cc b/gnuradio-core/src/lib/filter/gr_pfb_decimator_ccf.cc
new file mode 100644
index 000000000..e563daa51
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_pfb_decimator_ccf.cc
@@ -0,0 +1,176 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_pfb_decimator_ccf.h>
+#include <gr_fir_ccf.h>
+#include <gr_fir_util.h>
+#include <gri_fft.h>
+#include <gr_io_signature.h>
+#include <gr_expj.h>
+#include <cstdio>
+
+gr_pfb_decimator_ccf_sptr gr_make_pfb_decimator_ccf (unsigned int decim,
+ const std::vector<float> &taps,
+ unsigned int channel)
+{
+ return gnuradio::get_initial_sptr(new gr_pfb_decimator_ccf (decim, taps, channel));
+}
+
+
+gr_pfb_decimator_ccf::gr_pfb_decimator_ccf (unsigned int decim,
+ const std::vector<float> &taps,
+ unsigned int channel)
+ : gr_sync_block ("pfb_decimator_ccf",
+ gr_make_io_signature (decim, decim, sizeof(gr_complex)),
+ gr_make_io_signature (1, 1, sizeof(gr_complex))),
+ d_updated (false)
+{
+ d_rate = decim;
+ d_filters = std::vector<gr_fir_ccf*>(d_rate);
+ d_chan = channel;
+ d_rotator = new gr_complex[d_rate];
+
+ // Create an FIR filter for each channel and zero out the taps
+ std::vector<float> vtaps(0, d_rate);
+ for(unsigned int i = 0; i < d_rate; i++) {
+ d_filters[i] = gr_fir_util::create_gr_fir_ccf(vtaps);
+ d_rotator[i] = gr_expj(i*2*M_PI*d_chan/d_rate);
+ }
+
+ // Now, actually set the filters' taps
+ set_taps(taps);
+
+ // Create the FFT to handle the output de-spinning of the channels
+ d_fft = new gri_fft_complex (d_rate, false);
+}
+
+gr_pfb_decimator_ccf::~gr_pfb_decimator_ccf ()
+{
+ delete d_fft;
+ for(unsigned int i = 0; i < d_rate; i++) {
+ delete d_filters[i];
+ }
+}
+
+void
+gr_pfb_decimator_ccf::set_taps (const std::vector<float> &taps)
+{
+ unsigned int i,j;
+
+ unsigned int ntaps = taps.size();
+ d_taps_per_filter = (unsigned int)ceil((double)ntaps/(double)d_rate);
+
+ // Create d_numchan vectors to store each channel's taps
+ d_taps.resize(d_rate);
+
+ // Make a vector of the taps plus fill it out with 0's to fill
+ // each polyphase filter with exactly d_taps_per_filter
+ std::vector<float> tmp_taps;
+ tmp_taps = taps;
+ while((float)(tmp_taps.size()) < d_rate*d_taps_per_filter) {
+ tmp_taps.push_back(0.0);
+ }
+
+ // Partition the filter
+ for(i = 0; i < d_rate; i++) {
+ // Each channel uses all d_taps_per_filter with 0's if not enough taps to fill out
+ d_taps[i] = std::vector<float>(d_taps_per_filter, 0);
+ for(j = 0; j < d_taps_per_filter; j++) {
+ d_taps[i][j] = tmp_taps[i + j*d_rate]; // add taps to channels in reverse order
+ }
+
+ // Build a filter for each channel and add it's taps to it
+ d_filters[i]->set_taps(d_taps[i]);
+ }
+
+ // Set the history to ensure enough input items for each filter
+ set_history (d_taps_per_filter);
+
+ d_updated = true;
+}
+
+void
+gr_pfb_decimator_ccf::print_taps()
+{
+ unsigned int i, j;
+ for(i = 0; i < d_rate; i++) {
+ printf("filter[%d]: [", i);
+ for(j = 0; j < d_taps_per_filter; j++) {
+ printf(" %.4e", d_taps[i][j]);
+ }
+ printf("]\n\n");
+ }
+}
+
+#define ROTATEFFT
+
+int
+gr_pfb_decimator_ccf::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ gr_complex *in;
+ gr_complex *out = (gr_complex *) output_items[0];
+
+ if (d_updated) {
+ d_updated = false;
+ return 0; // history requirements may have changed.
+ }
+
+ int i;
+ for(i = 0; i < noutput_items; i++) {
+ // Move through filters from bottom to top
+ out[i] = 0;
+ for(int j = d_rate-1; j >= 0; j--) {
+ // Take in the items from the first input stream to d_rate
+ in = (gr_complex*)input_items[d_rate - 1 - j];
+
+ // Filter current input stream from bottom filter to top
+ // The rotate them by expj(j*k*2pi/M) where M is the number of filters
+ // (the decimation rate) and k is the channel number to extract
+
+ // This is the real math that goes on; we abuse the FFT to do this quickly
+ // for decimation rates > N where N is a small number (~5):
+ // out[i] += d_filters[j]->filter(&in[i])*gr_expj(j*d_chan*2*M_PI/d_rate);
+#ifdef ROTATEFFT
+ d_fft->get_inbuf()[j] = d_filters[j]->filter(&in[i]);
+#else
+ out[i] += d_filters[j]->filter(&in[i])*d_rotator[i];
+#endif
+ }
+
+#ifdef ROTATEFFT
+ // Perform the FFT to do the complex multiply despinning for all channels
+ d_fft->execute();
+
+ // Select only the desired channel out
+ out[i] = d_fft->get_outbuf()[d_chan];
+#endif
+
+ }
+
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/filter/gr_pfb_decimator_ccf.h b/gnuradio-core/src/lib/filter/gr_pfb_decimator_ccf.h
new file mode 100644
index 000000000..a2b347ae2
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_pfb_decimator_ccf.h
@@ -0,0 +1,150 @@
+/* -*- 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.
+ */
+
+
+#ifndef INCLUDED_GR_PFB_DECIMATOR_CCF_H
+#define INCLUDED_GR_PFB_DECIMATOR_CCF_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+
+class gr_pfb_decimator_ccf;
+typedef boost::shared_ptr<gr_pfb_decimator_ccf> gr_pfb_decimator_ccf_sptr;
+GR_CORE_API gr_pfb_decimator_ccf_sptr gr_make_pfb_decimator_ccf (unsigned int decim,
+ const std::vector<float> &taps,
+ unsigned int channel=0);
+
+class gr_fir_ccf;
+class gri_fft_complex;
+
+/*!
+ * \class gr_pfb_decimator_ccf
+ * \brief Polyphase filterbank bandpass decimator with gr_complex
+ * input, gr_complex output and float taps
+ *
+ * \ingroup filter_blk
+ * \ingroup pfb_blk
+ *
+ * This block takes in a signal stream and performs interger down-
+ * sampling (decimation) with a polyphase filterbank. The first input
+ * is the integer specifying how much to decimate by. The second
+ * input is a vector (Python list) of floating-point taps of the
+ * prototype filter. The third input specifies the channel to extract.
+ * By default, the zeroth channel is used, which is the baseband
+ * channel (first Nyquist zone).
+ *
+ * The <EM>channel</EM> parameter specifies which channel to use since
+ * this class is capable of bandpass decimation. Given a complex input
+ * stream at a sampling rate of <EM>fs</EM> and a decimation rate of
+ * <EM>decim</EM>, the input frequency domain is split into
+ * <EM>decim</EM> channels that represent the Nyquist zones. Using the
+ * polyphase filterbank, we can select any one of these channels to
+ * decimate.
+ *
+ * The output signal will be the basebanded and decimated signal from
+ * that channel. This concept is very similar to the PFB channelizer
+ * (see #gr_pfb_channelizer_ccf) where only a single channel is
+ * extracted at a time.
+ *
+ * The filter's taps should be based on the sampling rate before
+ * decimation.
+ *
+ * For example, using the GNU Radio's firdes utility to building
+ * filters, we build a low-pass filter with a sampling rate of
+ * <EM>fs</EM>, a 3-dB bandwidth of <EM>BW</EM> and a transition
+ * bandwidth of <EM>TB</EM>. We can also specify the out-of-band
+ * attenuation to use, <EM>ATT</EM>, and the filter window
+ * function (a Blackman-harris window in this case). The first input
+ * is the gain of the filter, which we specify here as unity.
+ *
+ * <B><EM>self._taps = gr.firdes.low_pass_2(1, fs, BW, TB,
+ * attenuation_dB=ATT, window=gr.firdes.WIN_BLACKMAN_hARRIS)</EM></B>
+ *
+ * The PFB decimator code takes the taps generated above and builds a
+ * set of filters. The set contains <EM>decim</EM> number of filters
+ * and each filter contains ceil(taps.size()/decim) number of taps.
+ * Each tap from the filter prototype is sequentially inserted into
+ * the next filter. When all of the input taps are used, the remaining
+ * filters in the filterbank are filled out with 0's to make sure each
+ * filter has the same number of taps.
+ *
+ * The theory behind this block can be found in Chapter 6 of
+ * the following book.
+ *
+ * <B><EM>f. harris, "Multirate Signal Processing for Communication
+ * Systems," Upper Saddle River, NJ: Prentice Hall, Inc. 2004.</EM></B>
+ */
+
+class GR_CORE_API gr_pfb_decimator_ccf : public gr_sync_block
+{
+ private:
+ /*!
+ * Build the polyphase filterbank decimator.
+ * \param decim (unsigned integer) Specifies the decimation rate to use
+ * \param taps (vector/list of floats) The prototype filter to populate the filterbank.
+ * \param channel (unsigned integer) Selects the channel to return [default=0].
+ */
+ friend GR_CORE_API gr_pfb_decimator_ccf_sptr gr_make_pfb_decimator_ccf (unsigned int decim,
+ const std::vector<float> &taps,
+ unsigned int channel);
+
+ std::vector<gr_fir_ccf*> d_filters;
+ std::vector< std::vector<float> > d_taps;
+ gri_fft_complex *d_fft;
+ unsigned int d_rate;
+ unsigned int d_chan;
+ unsigned int d_taps_per_filter;
+ bool d_updated;
+ gr_complex *d_rotator;
+
+ /*!
+ * Build the polyphase filterbank decimator.
+ * \param decim (unsigned integer) Specifies the decimation rate to use
+ * \param taps (vector/list of floats) The prototype filter to populate the filterbank.
+ * \param channel (unsigned integer) Selects the channel to return [default=0].
+ */
+ gr_pfb_decimator_ccf (unsigned int decim,
+ const std::vector<float> &taps,
+ unsigned int channel);
+
+public:
+ ~gr_pfb_decimator_ccf ();
+
+ /*!
+ * Resets the filterbank's filter taps with the new prototype filter
+ * \param taps (vector/list of floats) The prototype filter to populate the filterbank.
+ */
+ void set_taps (const std::vector<float> &taps);
+
+ /*!
+ * Print all of the filterbank taps to screen.
+ */
+ void print_taps();
+
+ //void set_channel (unsigned int channel);
+
+ 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/filter/gr_pfb_decimator_ccf.i b/gnuradio-core/src/lib/filter/gr_pfb_decimator_ccf.i
new file mode 100644
index 000000000..e40d00fa9
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_pfb_decimator_ccf.i
@@ -0,0 +1,41 @@
+/* -*- 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,pfb_decimator_ccf);
+
+gr_pfb_decimator_ccf_sptr gr_make_pfb_decimator_ccf (unsigned int decim,
+ const std::vector<float> &taps,
+ unsigned int channel);
+
+class gr_pfb_decimator_ccf : public gr_sync_block
+{
+ private:
+ gr_pfb_decimator_ccf (unsigned int decim,
+ const std::vector<float> &taps,
+ unsigned int channel);
+
+ public:
+ ~gr_pfb_decimator_ccf ();
+
+ void set_taps (const std::vector<float> &taps);
+ //void set_channel (unsigned int channel);
+};
diff --git a/gnuradio-core/src/lib/filter/gr_pfb_interpolator_ccf.cc b/gnuradio-core/src/lib/filter/gr_pfb_interpolator_ccf.cc
new file mode 100644
index 000000000..9c8e734ea
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_pfb_interpolator_ccf.cc
@@ -0,0 +1,143 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_pfb_interpolator_ccf.h>
+#include <gr_fir_ccf.h>
+#include <gr_fir_util.h>
+#include <gr_io_signature.h>
+#include <cstdio>
+
+gr_pfb_interpolator_ccf_sptr gr_make_pfb_interpolator_ccf (unsigned int interp,
+ const std::vector<float> &taps)
+{
+ return gnuradio::get_initial_sptr(new gr_pfb_interpolator_ccf (interp, taps));
+}
+
+
+gr_pfb_interpolator_ccf::gr_pfb_interpolator_ccf (unsigned int interp,
+ const std::vector<float> &taps)
+ : gr_sync_interpolator ("pfb_interpolator_ccf",
+ gr_make_io_signature (1, 1, sizeof(gr_complex)),
+ gr_make_io_signature (1, 1, sizeof(gr_complex)),
+ interp),
+ d_updated (false)
+{
+ d_rate = interp;
+ d_filters = std::vector<gr_fir_ccf*>(d_rate);
+
+ // Create an FIR filter for each channel and zero out the taps
+ std::vector<float> vtaps(0, d_rate);
+ for(unsigned int i = 0; i < d_rate; i++) {
+ d_filters[i] = gr_fir_util::create_gr_fir_ccf(vtaps);
+ }
+
+ // Now, actually set the filters' taps
+ set_taps(taps);
+}
+
+gr_pfb_interpolator_ccf::~gr_pfb_interpolator_ccf ()
+{
+ for(unsigned int i = 0; i < d_rate; i++) {
+ delete d_filters[i];
+ }
+}
+
+void
+gr_pfb_interpolator_ccf::set_taps (const std::vector<float> &taps)
+{
+ unsigned int i,j;
+
+ unsigned int ntaps = taps.size();
+ d_taps_per_filter = (unsigned int)ceil((double)ntaps/(double)d_rate);
+
+ // Create d_numchan vectors to store each channel's taps
+ //std::vector< std::vector<float> > vtaps(d_rate);
+ d_taps.resize(d_rate);
+
+ // Make a vector of the taps plus fill it out with 0's to fill
+ // each polyphase filter with exactly d_taps_per_filter
+ std::vector<float> tmp_taps;
+ tmp_taps = taps;
+ while((float)(tmp_taps.size()) < d_rate*d_taps_per_filter) {
+ tmp_taps.push_back(0.0);
+ }
+
+ // Partition the filter
+ for(i = 0; i < d_rate; i++) {
+ // Each channel uses all d_taps_per_filter with 0's if not enough taps to fill out
+ d_taps[i] = std::vector<float>(d_taps_per_filter, 0);
+ for(j = 0; j < d_taps_per_filter; j++) {
+ d_taps[i][j] = tmp_taps[i + j*d_rate]; // add taps to channels in reverse order
+ }
+
+ // Build a filter for each channel and add it's taps to it
+ d_filters[i]->set_taps(d_taps[i]);
+ }
+
+ // Set the history to ensure enough input items for each filter
+ set_history (d_taps_per_filter);
+
+ d_updated = true;
+}
+
+void
+gr_pfb_interpolator_ccf::print_taps()
+{
+ unsigned int i, j;
+ for(i = 0; i < d_rate; i++) {
+ printf("filter[%d]: [", i);
+ for(j = 0; j < d_taps_per_filter; j++) {
+ printf(" %.4e", d_taps[i][j]);
+ }
+ printf("]\n\n");
+ }
+}
+
+int
+gr_pfb_interpolator_ccf::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ gr_complex *in = (gr_complex *) input_items[0];
+ gr_complex *out = (gr_complex *) output_items[0];
+
+ if (d_updated) {
+ d_updated = false;
+ return 0; // history requirements may have changed.
+ }
+
+ int i = 0, count = 0;
+
+ while(i < noutput_items) {
+ for(unsigned int j = 0; j < d_rate; j++) {
+ out[i] = d_filters[j]->filter(&in[count]);
+ i++;
+ }
+ count++;
+ }
+
+ return i;
+}
diff --git a/gnuradio-core/src/lib/filter/gr_pfb_interpolator_ccf.h b/gnuradio-core/src/lib/filter/gr_pfb_interpolator_ccf.h
new file mode 100644
index 000000000..aeae86e40
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_pfb_interpolator_ccf.h
@@ -0,0 +1,131 @@
+/* -*- 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.
+ */
+
+
+#ifndef INCLUDED_GR_PFB_INTERPOLATOR_CCF_H
+#define INCLUDED_GR_PFB_INTERPOLATOR_CCF_H
+
+#include <gr_core_api.h>
+#include <gr_sync_interpolator.h>
+
+class gr_pfb_interpolator_ccf;
+typedef boost::shared_ptr<gr_pfb_interpolator_ccf> gr_pfb_interpolator_ccf_sptr;
+GR_CORE_API gr_pfb_interpolator_ccf_sptr gr_make_pfb_interpolator_ccf (unsigned int interp,
+ const std::vector<float> &taps);
+
+class gr_fir_ccf;
+
+/*!
+ * \class gr_pfb_interpolator_ccf
+ * \brief Polyphase filterbank interpolator with gr_complex input,
+ * gr_complex output and float taps
+ *
+ * \ingroup filter_blk
+ * \ingroup pfb_blk
+ *
+ * This block takes in a signal stream and performs interger up-
+ * sampling (interpolation) with a polyphase filterbank. The first
+ * input is the integer specifying how much to interpolate by. The
+ * second input is a vector (Python list) of floating-point taps of
+ * the prototype filter.
+ *
+ * The filter's taps should be based on the interpolation rate
+ * specified. That is, the bandwidth specified is relative to the
+ * bandwidth after interpolation.
+ *
+ * For example, using the GNU Radio's firdes utility to building
+ * filters, we build a low-pass filter with a sampling rate of
+ * <EM>fs</EM>, a 3-dB bandwidth of <EM>BW</EM> and a transition
+ * bandwidth of <EM>TB</EM>. We can also specify the out-of-band
+ * attenuation to use, ATT, and the filter window function (a
+ * Blackman-harris window in this case). The first input is the gain,
+ * which is also specified as the interpolation rate so that the
+ * output levels are the same as the input (this creates an overall
+ * increase in power).
+ *
+ * <B><EM>self._taps = gr.firdes.low_pass_2(interp, interp*fs, BW, TB,
+ * attenuation_dB=ATT, window=gr.firdes.WIN_BLACKMAN_hARRIS)</EM></B>
+ *
+ * The PFB interpolator code takes the taps generated above and builds
+ * a set of filters. The set contains <EM>interp</EM> number of
+ * filters and each filter contains ceil(taps.size()/interp) number of
+ * taps. Each tap from the filter prototype is sequentially inserted
+ * into the next filter. When all of the input taps are used, the
+ * remaining filters in the filterbank are filled out with 0's to make
+ * sure each filter has the same number of taps.
+ *
+ * The theory behind this block can be found in Chapter 7.1 of the
+ * following book.
+ *
+ * <B><EM>f. harris, "Multirate Signal Processing for Communication
+ * Systems</EM>," Upper Saddle River, NJ: Prentice Hall,
+ * Inc. 2004.</EM></B>
+ */
+
+class GR_CORE_API gr_pfb_interpolator_ccf : public gr_sync_interpolator
+{
+ private:
+ /*!
+ * Build the polyphase filterbank interpolator.
+ * \param interp (unsigned integer) Specifies the interpolation rate to use
+ * \param taps (vector/list of floats) The prototype filter to populate the filterbank. The taps
+ * should be generated at the interpolated sampling rate.
+ */
+ friend GR_CORE_API gr_pfb_interpolator_ccf_sptr gr_make_pfb_interpolator_ccf (unsigned int interp,
+ const std::vector<float> &taps);
+
+ std::vector<gr_fir_ccf*> d_filters;
+ std::vector< std::vector<float> > d_taps;
+ unsigned int d_rate;
+ unsigned int d_taps_per_filter;
+ bool d_updated;
+
+ /*!
+ * Construct a Polyphase filterbank interpolator
+ * \param interp (unsigned integer) Specifies the interpolation rate to use
+ * \param taps (vector/list of floats) The prototype filter to populate the filterbank. The taps
+ * should be generated at the interpolated sampling rate.
+ */
+ gr_pfb_interpolator_ccf (unsigned int interp,
+ const std::vector<float> &taps);
+
+public:
+ ~gr_pfb_interpolator_ccf ();
+
+ /*!
+ * Resets the filterbank's filter taps with the new prototype filter
+ * \param taps (vector/list of floats) The prototype filter to populate the filterbank. The taps
+ * should be generated at the interpolated sampling rate.
+ */
+ void set_taps (const std::vector<float> &taps);
+
+ /*!
+ * Print all of the filterbank taps to screen.
+ */
+ void print_taps();
+
+ 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/filter/gr_pfb_interpolator_ccf.i b/gnuradio-core/src/lib/filter/gr_pfb_interpolator_ccf.i
new file mode 100644
index 000000000..427f1b913
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_pfb_interpolator_ccf.i
@@ -0,0 +1,39 @@
+/* -*- 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,pfb_interpolator_ccf);
+
+gr_pfb_interpolator_ccf_sptr gr_make_pfb_interpolator_ccf (unsigned int interp,
+ const std::vector<float> &taps);
+
+class gr_pfb_interpolator_ccf : public gr_sync_interpolator
+{
+ private:
+ gr_pfb_interpolator_ccf (unsigned int interp,
+ const std::vector<float> &taps);
+
+ public:
+ ~gr_pfb_interpolator_ccf ();
+
+ void set_taps (const std::vector<float> &taps);
+ void print_taps();
+};
diff --git a/gnuradio-core/src/lib/filter/gr_pfb_synthesizer_ccf.cc b/gnuradio-core/src/lib/filter/gr_pfb_synthesizer_ccf.cc
new file mode 100644
index 000000000..cd01aaff5
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_pfb_synthesizer_ccf.cc
@@ -0,0 +1,287 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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 <gr_pfb_synthesizer_ccf.h>
+#include <gri_fft.h>
+#include <gr_io_signature.h>
+#include <cstdio>
+#include <cstring>
+
+gr_pfb_synthesizer_ccf_sptr gr_make_pfb_synthesizer_ccf
+ (unsigned int numchans, const std::vector<float> &taps, bool twox)
+{
+ return gr_pfb_synthesizer_ccf_sptr
+ (new gr_pfb_synthesizer_ccf (numchans, taps, twox));
+}
+
+
+gr_pfb_synthesizer_ccf::gr_pfb_synthesizer_ccf
+ (unsigned int numchans, const std::vector<float> &taps, bool twox)
+ : gr_sync_interpolator ("pfb_synthesizer_ccf",
+ gr_make_io_signature (1, numchans, sizeof(gr_complex)),
+ gr_make_io_signature (1, 1, sizeof(gr_complex)),
+ numchans),
+ d_updated (false), d_numchans(numchans), d_state(0)
+{
+ // set up 2x multiplier; if twox==True, set to 2, otherwise to 1
+ d_twox = (twox ? 2 : 1);
+ if(d_numchans % d_twox != 0) {
+ throw std::invalid_argument("gr_pfb_synthesizer_ccf: number of channels must be even for 2x oversampling.\n");
+ }
+
+ d_filters = std::vector<gri_fir_filter_with_buffer_ccf*>(d_twox*d_numchans);
+ d_channel_map.resize(d_twox*d_numchans);
+
+ // Create an FIR filter for each channel and zero out the taps
+ std::vector<float> vtaps(0, d_twox*d_numchans);
+ for(unsigned int i = 0; i < d_twox*d_numchans; i++) {
+ d_filters[i] = new gri_fir_filter_with_buffer_ccf(vtaps);
+ d_channel_map[i] = i;
+ }
+
+ // Now, actually set the filters' taps
+ set_taps(taps);
+
+ // Create the IFFT to handle the input channel rotations
+ d_fft = new gri_fft_complex (d_twox*d_numchans, false);
+ memset(d_fft->get_inbuf(), 0, d_twox*d_numchans*sizeof(gr_complex));
+
+ set_output_multiple(d_numchans);
+}
+
+gr_pfb_synthesizer_ccf::~gr_pfb_synthesizer_ccf ()
+{
+ delete d_fft;
+ for(unsigned int i = 0; i < d_twox*d_numchans; i++) {
+ delete d_filters[i];
+ }
+}
+
+void
+gr_pfb_synthesizer_ccf::set_taps(const std::vector<float> &taps)
+{
+ gruel::scoped_lock guard(d_mutex);
+ if(d_twox == 1)
+ set_taps1(taps);
+ else
+ set_taps2(taps);
+}
+
+void
+gr_pfb_synthesizer_ccf::set_taps1(const std::vector<float> &taps)
+{
+ unsigned int i,j;
+
+ unsigned int ntaps = taps.size();
+ d_taps_per_filter = (unsigned int)ceil((double)ntaps/(double)d_numchans);
+
+ // Create d_numchan vectors to store each channel's taps
+ d_taps.resize(d_numchans);
+
+ // Make a vector of the taps plus fill it out with 0's to fill
+ // each polyphase filter with exactly d_taps_per_filter
+ std::vector<float> tmp_taps;
+ tmp_taps = taps;
+ while((float)(tmp_taps.size()) < d_numchans*d_taps_per_filter) {
+ tmp_taps.push_back(0.0);
+ }
+
+ // Partition the filter
+ for(i = 0; i < d_numchans; i++) {
+ // Each channel uses all d_taps_per_filter with 0's if not enough taps to fill out
+ d_taps[i] = std::vector<float>(d_taps_per_filter, 0);
+ for(j = 0; j < d_taps_per_filter; j++) {
+ d_taps[i][j] = tmp_taps[i + j*d_numchans]; // add taps to channels in reverse order
+ }
+
+ // Build a filter for each channel and add it's taps to it
+ d_filters[i]->set_taps(d_taps[i]);
+ }
+
+ // Set the history to ensure enough input items for each filter
+ set_history (d_taps_per_filter+1);
+
+ d_updated = true;
+}
+
+void
+gr_pfb_synthesizer_ccf::set_taps2 (const std::vector<float> &taps)
+{
+ unsigned int i,j;
+ int state = 0;
+
+ unsigned int ntaps = taps.size();
+ d_taps_per_filter = (unsigned int)ceil((double)ntaps/(double)d_numchans);
+
+ // Create d_numchan vectors to store each channel's taps
+ d_taps.resize(d_twox*d_numchans);
+
+ // Make a vector of the taps plus fill it out with 0's to fill
+ // each polyphase filter with exactly d_taps_per_filter
+ std::vector<float> tmp_taps;
+ tmp_taps = taps;
+ while((float)(tmp_taps.size()) < d_numchans*d_taps_per_filter) {
+ tmp_taps.push_back(0.0);
+ }
+
+ // Partition the filter
+ for(i = 0; i < d_numchans; i++) {
+ // Each channel uses all d_taps_per_filter with 0's if not enough taps to fill out
+ d_taps[i] = std::vector<float>(d_taps_per_filter, 0);
+ d_taps[d_numchans+i] = std::vector<float>(d_taps_per_filter, 0);
+ state = 0;
+ for(j = 0; j < d_taps_per_filter; j++) {
+ // add taps to channels in reverse order
+ // Zero out every other tap
+ if(state == 0) {
+ d_taps[i][j] = tmp_taps[i + j*d_numchans];
+ d_taps[d_numchans + i][j] = 0;
+ state = 1;
+ }
+ else {
+ d_taps[i][j] = 0;
+ d_taps[d_numchans + i][j] = tmp_taps[i + j*d_numchans];
+ state = 0;
+ }
+ }
+
+ // Build a filter for each channel and add it's taps to it
+ d_filters[i]->set_taps(d_taps[i]);
+ d_filters[d_numchans + i]->set_taps(d_taps[d_numchans + i]);
+ }
+
+ // Set the history to ensure enough input items for each filter
+ set_history (d_taps_per_filter+1);
+
+ d_updated = true;
+}
+
+void
+gr_pfb_synthesizer_ccf::print_taps()
+{
+ unsigned int i, j;
+ for(i = 0; i < d_twox*d_numchans; i++) {
+ printf("filter[%d]: [", i);
+ for(j = 0; j < d_taps_per_filter; j++) {
+ printf(" %.4e", d_taps[i][j]);
+ }
+ printf("]\n\n");
+ }
+}
+
+
+std::vector< std::vector<float> >
+gr_pfb_synthesizer_ccf::taps() const
+{
+ return d_taps;
+}
+
+void
+gr_pfb_synthesizer_ccf::set_channel_map(const std::vector<int> &map)
+{
+ gruel::scoped_lock guard(d_mutex);
+
+ if(map.size() > 0) {
+ unsigned int max = (unsigned int)*std::max_element(map.begin(), map.end());
+ unsigned int min = (unsigned int)*std::min_element(map.begin(), map.end());
+ if((max >= d_twox*d_numchans) || (min < 0)) {
+ throw std::invalid_argument("gr_pfb_synthesizer_ccf::set_channel_map: map range out of bounds.\n");
+ }
+ d_channel_map = map;
+
+ // Zero out fft buffer so that unused channels are always 0
+ memset(d_fft->get_inbuf(), 0,d_twox*d_numchans*sizeof(gr_complex));
+ }
+}
+
+std::vector<int>
+gr_pfb_synthesizer_ccf::channel_map() const
+{
+ return d_channel_map;
+}
+
+int
+gr_pfb_synthesizer_ccf::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ gruel::scoped_lock guard(d_mutex);
+
+ gr_complex *in = (gr_complex*) input_items[0];
+ gr_complex *out = (gr_complex *) output_items[0];
+
+ if (d_updated) {
+ d_updated = false;
+ return 0; // history requirements may have changed.
+ }
+
+ unsigned int n, i;
+ size_t ninputs = input_items.size();
+
+ // Algoritm for critically sampled channels
+ if(d_twox == 1) {
+ for(n = 0; n < noutput_items/d_numchans; n++) {
+ for(i = 0; i < ninputs; i++) {
+ in = (gr_complex*)input_items[i];
+ d_fft->get_inbuf()[d_channel_map[i]] = in[n];
+ }
+
+ // spin through IFFT
+ d_fft->execute();
+
+ for(i = 0; i < d_numchans; i++) {
+ out[i] = d_filters[i]->filter(d_fft->get_outbuf()[i]);
+ }
+ out += d_numchans;
+ }
+ }
+
+ // Algorithm for oversampling by 2x
+ else {
+ for(n = 0; n < noutput_items/d_numchans; n++) {
+ for(i = 0; i < ninputs; i++) {
+ in = (gr_complex*)input_items[i];
+ d_fft->get_inbuf()[d_channel_map[i]] = in[n];
+ }
+
+ // spin through IFFT
+ d_fft->execute();
+
+ // Output is sum of two filters, but the input buffer to the filters must be circularly
+ // shifted by numchans every time through, done by using d_state to determine which IFFT
+ // buffer position to pull from.
+ for(i = 0; i < d_numchans; i++) {
+ out[i] = d_filters[i]->filter(d_fft->get_outbuf()[d_state*d_numchans+i]);
+ out[i] += d_filters[d_numchans+i]->filter(d_fft->get_outbuf()[(d_state^1)*d_numchans+i]);
+ }
+ d_state ^= 1;
+
+ out += d_numchans;
+ }
+ }
+
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/filter/gr_pfb_synthesizer_ccf.h b/gnuradio-core/src/lib/filter/gr_pfb_synthesizer_ccf.h
new file mode 100644
index 000000000..9e4f85497
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_pfb_synthesizer_ccf.h
@@ -0,0 +1,147 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+
+#ifndef INCLUDED_GR_PFB_SYNTHESIZER_CCF_H
+#define INCLUDED_GR_PFB_SYNTHESIZER_CCF_H
+
+#include <gr_core_api.h>
+#include <gr_sync_interpolator.h>
+#include <gri_fir_filter_with_buffer_ccf.h>
+#include <gruel/thread.h>
+
+class gr_pfb_synthesizer_ccf;
+typedef boost::shared_ptr<gr_pfb_synthesizer_ccf> gr_pfb_synthesizer_ccf_sptr;
+GR_CORE_API gr_pfb_synthesizer_ccf_sptr gr_make_pfb_synthesizer_ccf
+ (unsigned int numchans, const std::vector<float> &taps, bool twox=false);
+
+class gri_fft_complex;
+
+
+/*!
+ * \class gr_pfb_synthesizer_ccf
+ *
+ * \brief Polyphase synthesis filterbank with
+ * gr_complex input, gr_complex output and float taps
+ *
+ * \ingroup filter_blk
+ * \ingroup pfb_blk
+ */
+
+class GR_CORE_API gr_pfb_synthesizer_ccf : public gr_sync_interpolator
+{
+ private:
+ /*!
+ * Build the polyphase synthesis filterbank.
+ * \param numchans (unsigned integer) Specifies the number of
+ channels <EM>M</EM>
+ * \param taps (vector/list of floats) The prototype filter to
+ populate the filterbank.
+ * \param twox (bool) use 2x oversampling or not (default is no)
+ */
+ friend GR_CORE_API gr_pfb_synthesizer_ccf_sptr gr_make_pfb_synthesizer_ccf
+ (unsigned int numchans, const std::vector<float> &taps, bool twox);
+
+ bool d_updated;
+ unsigned int d_numchans;
+ unsigned int d_taps_per_filter;
+ gri_fft_complex *d_fft;
+ std::vector< gri_fir_filter_with_buffer_ccf*> d_filters;
+ std::vector< std::vector<float> > d_taps;
+ int d_state;
+ std::vector<int> d_channel_map;
+ unsigned int d_twox;
+ gruel::mutex d_mutex; // mutex to protect set/work access
+
+ /*!
+ * \brief Tap setting algorithm for critically sampled channels
+ */
+ void set_taps1(const std::vector<float> &taps);
+
+ /*!
+ * \brief Tap setting algorithm for 2x over-sampled channels
+ */
+ void set_taps2(const std::vector<float> &taps);
+
+ /*!
+ * Build the polyphase synthesis filterbank.
+ * \param numchans (unsigned integer) Specifies the number of
+ channels <EM>M</EM>
+ * \param taps (vector/list of floats) The prototype filter
+ to populate the filterbank.
+ * \param twox (bool) use 2x oversampling or not (default is no)
+ */
+ gr_pfb_synthesizer_ccf (unsigned int numchans,
+ const std::vector<float> &taps,
+ bool twox);
+
+public:
+ ~gr_pfb_synthesizer_ccf ();
+
+ /*!
+ * Resets the filterbank's filter taps with the new prototype filter
+ * \param taps (vector/list of floats) The prototype filter to
+ populate the filterbank.
+ */
+ void set_taps (const std::vector<float> &taps);
+
+ /*!
+ * Print all of the filterbank taps to screen.
+ */
+ void print_taps();
+
+ /*!
+ * Return a vector<vector<>> of the filterbank taps
+ */
+ std::vector<std::vector<float> > taps() const;
+
+ /*!
+ * Set the channel map. Channels are numbers as:
+ * N/2+1 | ... | N-1 | 0 | 1 | 2 | ... | N/2
+ * <------------------- 0 -------------------->
+ * freq
+ *
+ * So input stream 0 goes to channel 0, etc. Setting a new channel
+ * map allows the user to specify where in frequency he/she wants
+ * the input stream to go. This is especially useful to avoid
+ * putting signals into the channels on the edge of the spectrum
+ * which can either wrap around (in the case of odd number of
+ * channels) and be affected by filter rolloff in the transmitter.
+ *
+ * The map must be at least the number of streams being sent to the
+ * block. Less and the algorithm will not have enough data to
+ * properly setup the buffers. Any more channels specified will be
+ * ignored.
+ */
+ void set_channel_map(const std::vector<int> &map);
+
+ /*!
+ * Gets the current channel map.
+ */
+ std::vector<int> channel_map() const;
+
+ 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/filter/gr_pfb_synthesizer_ccf.i b/gnuradio-core/src/lib/filter/gr_pfb_synthesizer_ccf.i
new file mode 100644
index 000000000..c186ae355
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_pfb_synthesizer_ccf.i
@@ -0,0 +1,44 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,pfb_synthesizer_ccf);
+
+gr_pfb_synthesizer_ccf_sptr gr_make_pfb_synthesizer_ccf
+ (unsigned int numchans, const std::vector<float> &taps, bool twox=false);
+
+class gr_pfb_synthesizer_ccf : public gr_sync_interpolator
+{
+ private:
+ gr_pfb_synthesizer_ccf (unsigned int numchans,
+ const std::vector<float> &taps,
+ bool twox=false);
+
+ public:
+ ~gr_pfb_synthesizer_ccf ();
+
+ void set_taps (const std::vector<float> &taps);
+ void print_taps();
+ std::vector< std::vector<float> > taps() const;
+
+ void set_channel_map(const std::vector<int> &map);
+ std::vector<int> channel_map() const;
+};
diff --git a/gnuradio-core/src/lib/filter/gr_rational_resampler_base_XXX.cc.t b/gnuradio-core/src/lib/filter/gr_rational_resampler_base_XXX.cc.t
new file mode 100644
index 000000000..445834dda
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_rational_resampler_base_XXX.cc.t
@@ -0,0 +1,172 @@
+/* -*- 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: This file is automatically generated by
+ * generate_gr_rational_resampler_base_XXX.py Any changes made to this
+ * file will be overwritten.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <@NAME@.h>
+#include <@FIR_TYPE@.h>
+#include <gr_fir_util.h>
+#include <gr_io_signature.h>
+#include <stdexcept>
+#include <iostream>
+
+@SPTR_NAME@
+gr_make_@BASE_NAME@ (unsigned interpolation,
+ unsigned decimation,
+ const std::vector<@TAP_TYPE@> &taps)
+{
+ return gnuradio::get_initial_sptr (new @NAME@ (interpolation, decimation, taps));
+}
+
+@NAME@::@NAME@ (unsigned interpolation, unsigned decimation,
+ const std::vector<@TAP_TYPE@> &taps)
+ : gr_block ("@BASE_NAME@",
+ gr_make_io_signature (1, 1, sizeof (@I_TYPE@)),
+ gr_make_io_signature (1, 1, sizeof (@O_TYPE@))),
+ d_history(1),
+ d_interpolation(interpolation), d_decimation(decimation),
+ d_ctr(0), d_updated(false),
+ d_firs(interpolation)
+{
+ if (interpolation == 0)
+ throw std::out_of_range ("interpolation must be > 0");
+ if (decimation == 0)
+ throw std::out_of_range ("decimation must be > 0");
+
+ set_relative_rate (1.0 * interpolation / decimation);
+ set_output_multiple (1);
+
+ std::vector<@TAP_TYPE@> dummy_taps;
+
+ for (unsigned i = 0; i < interpolation; i++)
+ d_firs[i] = gr_fir_util::create_@FIR_TYPE@ (dummy_taps);
+
+ set_taps (taps);
+ install_taps (d_new_taps);
+}
+
+@NAME@::~@NAME@ ()
+{
+ int interp = interpolation();
+ for (int i = 0; i < interp; i++)
+ delete d_firs[i];
+}
+
+void
+@NAME@::set_taps (const std::vector<@TAP_TYPE@> &taps)
+{
+ d_new_taps = taps;
+ d_updated = true;
+
+ // round up length to a multiple of the interpolation factor
+ int n = taps.size () % interpolation ();
+ if (n > 0){
+ n = interpolation () - n;
+ while (n-- > 0)
+ d_new_taps.insert(d_new_taps.begin(), 0);
+ }
+
+ assert (d_new_taps.size () % interpolation () == 0);
+}
+
+
+void
+@NAME@::install_taps (const std::vector<@TAP_TYPE@> &taps)
+{
+ int nfilters = interpolation ();
+ int nt = taps.size () / nfilters;
+
+ assert (nt * nfilters == (int) taps.size ());
+
+ std::vector< std::vector <@TAP_TYPE@> > xtaps (nfilters);
+
+ for (int n = 0; n < nfilters; n++)
+ xtaps[n].resize (nt);
+
+ for (int i = 0; i < (int) taps.size(); i++)
+ xtaps[i % nfilters][i / nfilters] = taps[i];
+
+ for (int n = 0; n < nfilters; n++)
+ d_firs[n]->set_taps (xtaps[n]);
+
+ set_history (nt);
+ d_updated = false;
+
+#if 0
+ for (int i = 0; i < nfilters; i++){
+ std::cout << "filter[" << i << "] = ";
+ for (int j = 0; j < nt; j++)
+ std::cout << xtaps[i][j] << " ";
+
+ std::cout << "\n";
+ }
+#endif
+
+}
+
+void
+@NAME@::forecast (int noutput_items, gr_vector_int &ninput_items_required)
+{
+ int nreqd = std::max((unsigned)1, (int)((double) (noutput_items+1) * decimation() / interpolation()) + history() - 1);
+ unsigned ninputs = ninput_items_required.size ();
+ for (unsigned i = 0; i < ninputs; i++)
+ ninput_items_required[i] = nreqd;
+}
+
+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)
+{
+ const @I_TYPE@ *in = (const @I_TYPE@ *) input_items[0];
+ @O_TYPE@ *out = (@O_TYPE@ *) output_items[0];
+
+ if (d_updated) {
+ install_taps (d_new_taps);
+ return 0; // history requirement may have increased.
+ }
+
+ unsigned int ctr = d_ctr;
+
+ int i = 0;
+ while (i < noutput_items){
+ out[i++] = d_firs[ctr]->filter(in);
+ ctr += decimation();
+ while (ctr >= interpolation()){
+ ctr -= interpolation();
+ in++;
+ }
+ }
+
+ d_ctr = ctr;
+ consume_each(in - (@I_TYPE@ *) input_items[0]);
+ return i;
+}
diff --git a/gnuradio-core/src/lib/filter/gr_rational_resampler_base_XXX.h.t b/gnuradio-core/src/lib/filter/gr_rational_resampler_base_XXX.h.t
new file mode 100644
index 000000000..3eb85a979
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_rational_resampler_base_XXX.h.t
@@ -0,0 +1,88 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005 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: This file is automatically generated by
+ * generate_gr_rational_resampler_base_XXX.py Any changes made to this
+ * file will be overwritten.
+ */
+
+#ifndef @GUARD_NAME@
+#define @GUARD_NAME@
+
+#include <gr_core_api.h>
+#include <gr_block.h>
+
+class @NAME@;
+typedef boost::shared_ptr<@NAME@> @SPTR_NAME@;
+GR_CORE_API @SPTR_NAME@
+gr_make_@BASE_NAME@ (unsigned interpolation,
+ unsigned decimation,
+ const std::vector<@TAP_TYPE@> &taps);
+
+class @FIR_TYPE@;
+
+/*!
+ * \brief Rational Resampling Polyphase FIR filter with @I_TYPE@ input, @O_TYPE@ output and @TAP_TYPE@ taps
+ * \ingroup filter_blk
+ */
+class GR_CORE_API @NAME@ : public gr_block
+{
+ private:
+ unsigned d_history;
+ unsigned d_interpolation, d_decimation;
+ unsigned d_ctr;
+ std::vector<@TAP_TYPE@> d_new_taps;
+ bool d_updated;
+ std::vector<@FIR_TYPE@ *> d_firs;
+
+ friend GR_CORE_API @SPTR_NAME@
+ gr_make_@BASE_NAME@ (unsigned interpolation, unsigned decimation, const std::vector<@TAP_TYPE@> &taps);
+
+
+ /*!
+ * Construct a FIR filter with the given taps
+ */
+ @NAME@ (unsigned interpolation, unsigned decimation,
+ const std::vector<@TAP_TYPE@> &taps);
+
+ void install_taps (const std::vector<@TAP_TYPE@> &taps);
+
+ public:
+ ~@NAME@ ();
+ unsigned history () const { return d_history; }
+ void set_history (unsigned history) { d_history = history; }
+
+ unsigned interpolation() const { return d_interpolation; }
+ unsigned decimation() const { return d_decimation; }
+
+ void set_taps (const std::vector<@TAP_TYPE@> &taps);
+
+ 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);
+};
+
+
+#endif
diff --git a/gnuradio-core/src/lib/filter/gr_rational_resampler_base_XXX.i.t b/gnuradio-core/src/lib/filter/gr_rational_resampler_base_XXX.i.t
new file mode 100644
index 000000000..1f789b0a3
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_rational_resampler_base_XXX.i.t
@@ -0,0 +1,42 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005 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: This file is automatically generated by
+ * generate_gr_rational_resampler_base_XXX.py Any changes made to this
+ * file will be overwritten.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@);
+
+@SPTR_NAME@ gr_make_@BASE_NAME@ (int interpolation, int decimation, const std::vector<@TAP_TYPE@> &taps);
+
+class @NAME@ : public gr_block
+{
+ private:
+ @NAME@ (int interpolation, int decimation, const std::vector<@TAP_TYPE@> &taps);
+
+ public:
+ ~@NAME@ ();
+
+ void set_taps (const std::vector<@TAP_TYPE@> &taps);
+};
diff --git a/gnuradio-core/src/lib/filter/gr_rotator.h b/gnuradio-core/src/lib/filter/gr_rotator.h
new file mode 100644
index 000000000..e31be6ee6
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_rotator.h
@@ -0,0 +1,54 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2003,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.
+ */
+
+#ifndef _GR_ROTATOR_H_
+#define _GR_ROTATOR_H_
+
+#include <gr_core_api.h>
+#include <gr_complex.h>
+
+class GR_CORE_API gr_rotator {
+ gr_complex d_phase;
+ gr_complex d_phase_incr;
+ unsigned int d_counter;
+
+ public:
+ gr_rotator () : d_phase (1), d_phase_incr (1), d_counter(0) { }
+
+ void set_phase (gr_complex phase) { d_phase = phase / abs(phase); }
+ void set_phase_incr (gr_complex incr) { d_phase_incr = incr / abs(incr); }
+
+ gr_complex rotate (gr_complex in){
+ d_counter++;
+
+ gr_complex z = in * d_phase; // rotate in by phase
+ d_phase *= d_phase_incr; // incr our phase (complex mult == add phases)
+
+ if ((d_counter % 512) == 0)
+ d_phase /= abs(d_phase); // Normalize to ensure multiplication is rotation
+
+ return z;
+ }
+
+};
+
+#endif /* _GR_ROTATOR_H_ */
diff --git a/gnuradio-core/src/lib/filter/gr_sincos.c b/gnuradio-core/src/lib/filter/gr_sincos.c
new file mode 100644
index 000000000..a8d01b0da
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_sincos.c
@@ -0,0 +1,83 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE // ask for GNU extensions if available
+#endif
+
+#include <gr_sincos.h>
+#include <math.h>
+
+// ----------------------------------------------------------------
+
+#if defined (HAVE_SINCOS)
+
+void
+gr_sincos (double x, double *sinx, double *cosx)
+{
+ sincos (x, sinx, cosx);
+}
+
+#else
+
+void
+gr_sincos (double x, double *sinx, double *cosx)
+{
+ *sinx = sin (x);
+ *cosx = cos (x);
+}
+
+#endif
+
+// ----------------------------------------------------------------
+
+#if defined (HAVE_SINCOSF)
+
+void
+gr_sincosf (float x, float *sinx, float *cosx)
+{
+ sincosf (x, sinx, cosx);
+}
+
+#elif defined (HAVE_SINF) && defined (HAVE_COSF)
+
+void
+gr_sincosf (float x, float *sinx, float *cosx)
+{
+ *sinx = sinf (x);
+ *cosx = cosf (x);
+}
+
+#else
+
+void
+gr_sincosf (float x, float *sinx, float *cosx)
+{
+ *sinx = sin (x);
+ *cosx = cos (x);
+}
+
+#endif
diff --git a/gnuradio-core/src/lib/filter/gr_sincos.h b/gnuradio-core/src/lib/filter/gr_sincos.h
new file mode 100644
index 000000000..516f43437
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_sincos.h
@@ -0,0 +1,41 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002,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_SINCOS_H
+#define INCLUDED_GR_SINCOS_H
+
+#include <gr_core_api.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+// compute sine and cosine at the same time
+
+GR_CORE_API void gr_sincos (double x, double *sin, double *cos);
+GR_CORE_API void gr_sincosf (float x, float *sin, float *cos);
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif /* INCLUDED_GR_SINCOS_H */
diff --git a/gnuradio-core/src/lib/filter/gr_single_pole_iir.h b/gnuradio-core/src/lib/filter/gr_single_pole_iir.h
new file mode 100644
index 000000000..d73ee857d
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_single_pole_iir.h
@@ -0,0 +1,191 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002,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.
+ */
+#ifndef _GR_SINGLE_POLE_IIR_H_
+#define _GR_SINGLE_POLE_IIR_H_
+
+#include <gr_core_api.h>
+#include <stdexcept>
+#include <gr_complex.h>
+/*!
+ * \brief class template for single pole IIR filter
+ */
+template<class o_type, class i_type, class tap_type>
+class gr_single_pole_iir {
+public:
+ /*!
+ * \brief construct new single pole IIR with given alpha
+ *
+ * computes y(i) = (1-alpha) * y(i-1) + alpha * x(i)
+ */
+ gr_single_pole_iir (tap_type alpha = 1.0)
+ {
+ d_prev_output = 0;
+ set_taps (alpha);
+ }
+
+ /*!
+ * \brief compute a single output value.
+ * \returns the filtered input value.
+ */
+ o_type filter (const i_type input);
+
+ /*!
+ * \brief compute an array of N output values.
+ * \p input must have n valid entries.
+ */
+ void filterN (o_type output[], const i_type input[], unsigned long n);
+
+ /*!
+ * \brief install \p alpha as the current taps.
+ */
+ void set_taps (tap_type alpha)
+ {
+ if (alpha < 0 || alpha > 1)
+ throw std::out_of_range ("Alpha must be in [0, 1]\n");
+
+ d_alpha = alpha;
+ d_one_minus_alpha = 1.0 - alpha;
+ }
+
+ //! reset state to zero
+ void reset ()
+ {
+ d_prev_output = 0;
+ }
+
+ o_type prev_output () const { return d_prev_output; }
+
+protected:
+ tap_type d_alpha;
+ tap_type d_one_minus_alpha;
+ o_type d_prev_output;
+};
+
+
+//
+// general case. We may want to specialize this
+//
+template<class o_type, class i_type, class tap_type>
+o_type
+gr_single_pole_iir<o_type, i_type, tap_type>::filter (const i_type input)
+{
+ o_type output;
+
+ output = d_alpha * input + d_one_minus_alpha * d_prev_output;
+ d_prev_output = output;
+
+ return (o_type) output;
+}
+
+
+template<class o_type, class i_type, class tap_type>
+void
+gr_single_pole_iir<o_type, i_type, tap_type>::filterN (o_type output[],
+ const i_type input[],
+ unsigned long n)
+{
+ for (unsigned i = 0; i < n; i++)
+ output[i] = filter (input[i]);
+}
+
+
+//
+// Specialized case for gr_complex output and double taps
+// We need to have a gr_complexd type for the calculations and prev_output variable (in stead of double)
+
+template<class i_type>
+class gr_single_pole_iir<gr_complex, i_type, double> {
+public:
+ /*!
+ * \brief construct new single pole IIR with given alpha
+ *
+ * computes y(i) = (1-alpha) * y(i-1) + alpha * x(i)
+ */
+ gr_single_pole_iir (double alpha = 1.0)
+ {
+ d_prev_output = 0;
+ set_taps (alpha);
+ }
+
+ /*!
+ * \brief compute a single output value.
+ * \returns the filtered input value.
+ */
+ gr_complex filter (const i_type input);
+
+ /*!
+ * \brief compute an array of N output values.
+ * \p input must have n valid entries.
+ */
+ void filterN (gr_complex output[], const i_type input[], unsigned long n);
+
+ /*!
+ * \brief install \p alpha as the current taps.
+ */
+ void set_taps (double alpha)
+ {
+ if (alpha < 0 || alpha > 1)
+ throw std::out_of_range ("Alpha must be in [0, 1]\n");
+
+ d_alpha = alpha;
+ d_one_minus_alpha = 1.0 - alpha;
+ }
+
+ //! reset state to zero
+ void reset ()
+ {
+ d_prev_output = 0;
+ }
+
+ gr_complexd prev_output () const { return d_prev_output; }
+
+protected:
+ double d_alpha;
+ double d_one_minus_alpha;
+ gr_complexd d_prev_output;
+};
+
+template< class i_type>
+gr_complex
+gr_single_pole_iir<gr_complex, i_type, double>::filter (const i_type input)
+{
+ gr_complexd output;
+
+ output = d_alpha * (gr_complexd)input + d_one_minus_alpha * d_prev_output;
+ d_prev_output = output;
+
+ return (gr_complex) output;
+}
+
+//Do we need to specialize this, although it is the same as the general case?
+
+template<class i_type>
+void
+gr_single_pole_iir<gr_complex, i_type, double>::filterN (gr_complex output[],
+ const i_type input[],
+ unsigned long n)
+{
+ for (unsigned i = 0; i < n; i++)
+ output[i] = filter (input[i]);
+}
+
+#endif /* _GR_SINGLE_POLE_IIR_H_ */
diff --git a/gnuradio-core/src/lib/filter/gr_single_pole_iir_filter_cc.cc b/gnuradio-core/src/lib/filter/gr_single_pole_iir_filter_cc.cc
new file mode 100644
index 000000000..ae4f654dd
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_single_pole_iir_filter_cc.cc
@@ -0,0 +1,81 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_single_pole_iir_filter_cc.h>
+#include <gr_io_signature.h>
+#include <stdio.h>
+
+
+gr_single_pole_iir_filter_cc_sptr
+gr_make_single_pole_iir_filter_cc (double alpha, unsigned int vlen)
+{
+ return gnuradio::get_initial_sptr(new gr_single_pole_iir_filter_cc(alpha, vlen));
+}
+
+gr_single_pole_iir_filter_cc::gr_single_pole_iir_filter_cc (
+ double alpha, unsigned int vlen)
+ : gr_sync_block ("single_pole_iir_filter_cc",
+ gr_make_io_signature (1, 1, sizeof (gr_complex) * vlen),
+ gr_make_io_signature (1, 1, sizeof (gr_complex) * vlen)),
+ d_vlen(vlen), d_iir(vlen)
+{
+ set_taps(alpha);
+}
+
+gr_single_pole_iir_filter_cc::~gr_single_pole_iir_filter_cc ()
+{
+ // nop
+}
+
+void
+gr_single_pole_iir_filter_cc::set_taps (double alpha)
+{
+ for (unsigned int i = 0; i < d_vlen; i++)
+ d_iir[i].set_taps(alpha);
+}
+
+int
+gr_single_pole_iir_filter_cc::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const gr_complex *in = (const gr_complex *) input_items[0];
+ gr_complex *out = (gr_complex *) output_items[0];
+ unsigned int vlen = d_vlen;
+
+ if (d_vlen == 1){
+ for (int i = 0; i < noutput_items; i++)
+ out[i] = d_iir[0].filter (in[i]);
+ }
+ else {
+ for (int i = 0; i < noutput_items; i++){
+ for (unsigned int j = 0; j < vlen; j++){
+ *out++ = d_iir[j].filter (*in++);
+ }
+ }
+ }
+ return noutput_items;
+};
diff --git a/gnuradio-core/src/lib/filter/gr_single_pole_iir_filter_cc.h b/gnuradio-core/src/lib/filter/gr_single_pole_iir_filter_cc.h
new file mode 100644
index 000000000..13c595826
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_single_pole_iir_filter_cc.h
@@ -0,0 +1,88 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2005,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.
+ */
+
+#ifndef INCLUDED_GR_SINGLE_POLE_IIR_FILTER_CC_H
+#define INCLUDED_GR_SINGLE_POLE_IIR_FILTER_CC_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+#include <gr_single_pole_iir.h>
+#include <gr_complex.h>
+#include <stdexcept>
+
+class gr_single_pole_iir_filter_cc;
+typedef boost::shared_ptr<gr_single_pole_iir_filter_cc> gr_single_pole_iir_filter_cc_sptr;
+
+GR_CORE_API gr_single_pole_iir_filter_cc_sptr
+gr_make_single_pole_iir_filter_cc (double alpha, unsigned int vlen=1);
+
+/*!
+ * \brief single pole IIR filter with complex input, complex output
+ * \ingroup filter_blk
+ *
+ * The input and output satisfy a difference equation of the form
+ \htmlonly
+ \f{
+ y[n] - (1-alpha) y[n-1] = alpha x[n]
+ \f}
+ \endhtmlonly
+
+ \xmlonly
+ y[n] - (1-alpha) y[n-1] = alpha x[n]
+ \endxmlonly
+
+ * with the corresponding rational system function
+ \htmlonly
+ \f{
+ H(z) = \frac{alpha}{1 - (1-alpha) z^{-1}}
+ \f}
+ \endhtmlonly
+
+ \xmlonly
+ H(z) = \ frac{alpha}{1 - (1-alpha) z^{-1}}
+ \endxmlonly
+
+ * Note that some texts define the system function with a + in the denominator.
+ * If you're using that convention, you'll need to negate the feedback tap.
+ */
+class GR_CORE_API gr_single_pole_iir_filter_cc : public gr_sync_block
+{
+ private:
+ friend GR_CORE_API gr_single_pole_iir_filter_cc_sptr
+ gr_make_single_pole_iir_filter_cc (double alpha, unsigned int vlen);
+
+ unsigned int d_vlen;
+ std::vector<gr_single_pole_iir<gr_complex,gr_complex,double> > d_iir;
+
+ gr_single_pole_iir_filter_cc (double alpha, unsigned int vlen);
+
+ public:
+ ~gr_single_pole_iir_filter_cc ();
+
+ void set_taps (double 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/filter/gr_single_pole_iir_filter_cc.i b/gnuradio-core/src/lib/filter/gr_single_pole_iir_filter_cc.i
new file mode 100644
index 000000000..2f1f285de
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_single_pole_iir_filter_cc.i
@@ -0,0 +1,34 @@
+/* -*- 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,single_pole_iir_filter_cc);
+
+gr_single_pole_iir_filter_cc_sptr
+gr_make_single_pole_iir_filter_cc (double alpha, unsigned int vlen=1);
+
+class gr_single_pole_iir_filter_cc : public gr_sync_block
+{
+ public:
+ ~gr_single_pole_iir_filter_cc ();
+
+ void set_taps (double alpha);
+};
diff --git a/gnuradio-core/src/lib/filter/gr_single_pole_iir_filter_ff.cc b/gnuradio-core/src/lib/filter/gr_single_pole_iir_filter_ff.cc
new file mode 100644
index 000000000..047b2ba25
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_single_pole_iir_filter_ff.cc
@@ -0,0 +1,81 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_single_pole_iir_filter_ff.h>
+#include <gr_io_signature.h>
+#include <stdio.h>
+
+
+gr_single_pole_iir_filter_ff_sptr
+gr_make_single_pole_iir_filter_ff (double alpha, unsigned int vlen)
+{
+ return gnuradio::get_initial_sptr(new gr_single_pole_iir_filter_ff(alpha, vlen));
+}
+
+gr_single_pole_iir_filter_ff::gr_single_pole_iir_filter_ff (
+ double alpha, unsigned int vlen)
+ : gr_sync_block ("single_pole_iir_filter_ff",
+ gr_make_io_signature (1, 1, sizeof (float) * vlen),
+ gr_make_io_signature (1, 1, sizeof (float) * vlen)),
+ d_vlen(vlen), d_iir(vlen)
+{
+ set_taps(alpha);
+}
+
+gr_single_pole_iir_filter_ff::~gr_single_pole_iir_filter_ff ()
+{
+ // nop
+}
+
+void
+gr_single_pole_iir_filter_ff::set_taps (double alpha)
+{
+ for (unsigned int i = 0; i < d_vlen; i++)
+ d_iir[i].set_taps(alpha);
+}
+
+int
+gr_single_pole_iir_filter_ff::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const float *in = (const float *) input_items[0];
+ float *out = (float *) output_items[0];
+ unsigned int vlen = d_vlen;
+
+ if (d_vlen == 1){
+ for (int i = 0; i < noutput_items; i++)
+ out[i] = d_iir[0].filter (in[i]);
+ }
+ else {
+ for (int i = 0; i < noutput_items; i++){
+ for (unsigned int j = 0; j < vlen; j++){
+ *out++ = d_iir[j].filter (*in++);
+ }
+ }
+ }
+ return noutput_items;
+};
diff --git a/gnuradio-core/src/lib/filter/gr_single_pole_iir_filter_ff.h b/gnuradio-core/src/lib/filter/gr_single_pole_iir_filter_ff.h
new file mode 100644
index 000000000..8dcdad2c9
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_single_pole_iir_filter_ff.h
@@ -0,0 +1,87 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2005 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_SINGLE_POLE_IIR_FILTER_FF_H
+#define INCLUDED_GR_SINGLE_POLE_IIR_FILTER_FF_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+#include <gr_single_pole_iir.h>
+#include <stdexcept>
+
+class gr_single_pole_iir_filter_ff;
+typedef boost::shared_ptr<gr_single_pole_iir_filter_ff> gr_single_pole_iir_filter_ff_sptr;
+
+GR_CORE_API gr_single_pole_iir_filter_ff_sptr
+gr_make_single_pole_iir_filter_ff (double alpha, unsigned int vlen=1);
+
+/*!
+ * \brief single pole IIR filter with float input, float output
+ * \ingroup filter_blk
+ *
+ * The input and output satisfy a difference equation of the form
+ \htmlonly
+ \f{
+ y[n] - (1-alpha) y[n-1] = alpha x[n]
+ \f}
+ \endhtmlonly
+
+ \xmlonly
+ y[n] - (1-alpha) y[n-1] = alpha x[n]
+ \endxmlonly
+
+ * with the corresponding rational system function
+ \htmlonly
+ \f{
+ H(z) = \frac{alpha}{1 - (1-alpha) z^{-1}}
+ \f}
+ \endhtmlonly
+
+ \xmlonly
+H(z) = \ frac{alpha}{1 - (1-alpha) z^{-1}}
+ \endxmlonly
+
+ * Note that some texts define the system function with a + in the denominator.
+ * If you're using that convention, you'll need to negate the feedback tap.
+ */
+class GR_CORE_API gr_single_pole_iir_filter_ff : public gr_sync_block
+{
+ private:
+ friend GR_CORE_API gr_single_pole_iir_filter_ff_sptr
+ gr_make_single_pole_iir_filter_ff (double alpha, unsigned int vlen);
+
+ unsigned int d_vlen;
+ std::vector<gr_single_pole_iir<float,float,double> > d_iir;
+
+ gr_single_pole_iir_filter_ff (double alpha, unsigned int vlen);
+
+ public:
+ ~gr_single_pole_iir_filter_ff ();
+
+ void set_taps (double 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/filter/gr_single_pole_iir_filter_ff.i b/gnuradio-core/src/lib/filter/gr_single_pole_iir_filter_ff.i
new file mode 100644
index 000000000..a835fabb2
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_single_pole_iir_filter_ff.i
@@ -0,0 +1,34 @@
+/* -*- 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,single_pole_iir_filter_ff);
+
+gr_single_pole_iir_filter_ff_sptr
+gr_make_single_pole_iir_filter_ff (double alpha, unsigned int vlen=1);
+
+class gr_single_pole_iir_filter_ff : public gr_sync_block
+{
+ public:
+ ~gr_single_pole_iir_filter_ff ();
+
+ void set_taps (double alpha);
+};
diff --git a/gnuradio-core/src/lib/filter/gr_vec_types.h b/gnuradio-core/src/lib/filter/gr_vec_types.h
new file mode 100644
index 000000000..2bcec44bf
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_vec_types.h
@@ -0,0 +1,54 @@
+/* Cell single token vector types
+ Copyright (C) 2007 Free Software Foundation, Inc.
+
+ This file 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 2 of the License, or (at your option)
+ any later version.
+
+ This file 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 this file; see the file COPYING. If not, write to the Free
+ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301, USA. */
+
+/* As a special exception, if you include this header file into source files
+ compiled by GCC, this header file does not by itself cause the resulting
+ executable to be covered by the GNU General Public License. This exception
+ does not however invalidate any other reasons why the executable file might be
+ covered by the GNU General Public License. */
+
+/* Single token vector data types for the PowerPC SIMD/Vector Multi-media
+ eXtension */
+
+#ifndef INCLUDED_GR_VEC_TYPES_H
+#define INCLUDED_GR_VEC_TYPES_H
+
+#define qword __vector unsigned char
+
+#define vec_uchar16 __vector unsigned char
+#define vec_char16 __vector signed char
+#define vec_bchar16 __vector bool char
+
+#define vec_ushort8 __vector unsigned short
+#define vec_short8 __vector signed short
+#define vec_bshort8 __vector bool short
+
+#define vec_pixel8 __vector pixel
+
+#define vec_uint4 __vector unsigned int
+#define vec_int4 __vector signed int
+#define vec_bint4 __vector bool int
+
+#define vec_float4 __vector float
+
+#define vec_ullong2 __vector bool char
+#define vec_llong2 __vector bool short
+
+#define vec_double2 __vector bool int
+
+#endif /* INCLUDED_GR_VEC_TYPES_H */
diff --git a/gnuradio-core/src/lib/filter/gri_fft_filter_ccc_generic.cc b/gnuradio-core/src/lib/filter/gri_fft_filter_ccc_generic.cc
new file mode 100644
index 000000000..e958c5061
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gri_fft_filter_ccc_generic.cc
@@ -0,0 +1,184 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gri_fft_filter_ccc_generic.h>
+#include <gri_fft.h>
+#include <volk/volk.h>
+#include <assert.h>
+#include <stdexcept>
+#include <cstdio>
+#include <cstring>
+#include <fftw3.h>
+
+gri_fft_filter_ccc_generic::gri_fft_filter_ccc_generic (int decimation,
+ const std::vector<gr_complex> &taps,
+ int nthreads)
+ : d_fftsize(-1), d_decimation(decimation), d_fwdfft(0), d_invfft(0), d_nthreads(nthreads)
+{
+ set_taps(taps);
+}
+
+gri_fft_filter_ccc_generic::~gri_fft_filter_ccc_generic ()
+{
+ delete d_fwdfft;
+ delete d_invfft;
+ gri_fft_free(d_xformed_taps);
+}
+
+#if 0
+static void
+print_vector_complex(const std::string label, const std::vector<gr_complex> &x)
+{
+ std::cout << label;
+ for (unsigned i = 0; i < x.size(); i++)
+ std::cout << x[i] << " ";
+ std::cout << "\n";
+}
+#endif
+
+
+/*
+ * determines d_ntaps, d_nsamples, d_fftsize, d_xformed_taps
+ */
+int
+gri_fft_filter_ccc_generic::set_taps (const std::vector<gr_complex> &taps)
+{
+ int i = 0;
+ compute_sizes(taps.size());
+
+ d_tail.resize(tailsize());
+ for (i = 0; i < tailsize(); i++)
+ d_tail[i] = 0;
+
+ gr_complex *in = d_fwdfft->get_inbuf();
+ gr_complex *out = d_fwdfft->get_outbuf();
+
+ float scale = 1.0 / d_fftsize;
+
+ // Compute forward xform of taps.
+ // Copy taps into first ntaps slots, then pad with zeros
+ for (i = 0; i < d_ntaps; i++)
+ in[i] = taps[i] * scale;
+
+ for (; i < d_fftsize; i++)
+ in[i] = 0;
+
+ d_fwdfft->execute(); // do the xform
+
+ // now copy output to d_xformed_taps
+ for (i = 0; i < d_fftsize; i++)
+ d_xformed_taps[i] = out[i];
+
+ return d_nsamples;
+}
+
+// determine and set d_ntaps, d_nsamples, d_fftsize
+
+void
+gri_fft_filter_ccc_generic::compute_sizes(int ntaps)
+{
+ int old_fftsize = d_fftsize;
+ d_ntaps = ntaps;
+ d_fftsize = (int) (2 * pow(2.0, ceil(log(double(ntaps)) / log(2.0))));
+ d_nsamples = d_fftsize - d_ntaps + 1;
+
+ if (0)
+ fprintf(stderr, "gri_fft_filter_ccc_generic: ntaps = %d, fftsize = %d, nsamples = %d\n",
+ d_ntaps, d_fftsize, d_nsamples);
+
+ assert(d_fftsize == d_ntaps + d_nsamples -1 );
+
+ if (d_fftsize != old_fftsize){ // compute new plans
+ delete d_fwdfft;
+ delete d_invfft;
+ d_fwdfft = new gri_fft_complex(d_fftsize, true, d_nthreads);
+ d_invfft = new gri_fft_complex(d_fftsize, false, d_nthreads);
+ d_xformed_taps = gri_fft_malloc_complex(d_fftsize);
+ }
+}
+
+void
+gri_fft_filter_ccc_generic::set_nthreads(int n)
+{
+ d_nthreads = n;
+ if(d_fwdfft)
+ d_fwdfft->set_nthreads(n);
+ if(d_invfft)
+ d_invfft->set_nthreads(n);
+}
+
+int
+gri_fft_filter_ccc_generic::nthreads() const
+{
+ return d_nthreads;
+}
+
+int
+gri_fft_filter_ccc_generic::filter (int nitems, const gr_complex *input, gr_complex *output)
+{
+ int dec_ctr = 0;
+ int j = 0;
+ int ninput_items = nitems * d_decimation;
+
+ for (int i = 0; i < ninput_items; i += d_nsamples){
+
+ memcpy(d_fwdfft->get_inbuf(), &input[i], d_nsamples * sizeof(gr_complex));
+
+ for (j = d_nsamples; j < d_fftsize; j++)
+ d_fwdfft->get_inbuf()[j] = 0;
+
+ d_fwdfft->execute(); // compute fwd xform
+
+ gr_complex *a = d_fwdfft->get_outbuf();
+ gr_complex *b = d_xformed_taps;
+ gr_complex *c = d_invfft->get_inbuf();
+
+ volk_32fc_x2_multiply_32fc_a(c, a, b, d_fftsize);
+
+ d_invfft->execute(); // compute inv xform
+
+ // add in the overlapping tail
+
+ for (j = 0; j < tailsize(); j++)
+ d_invfft->get_outbuf()[j] += d_tail[j];
+
+ // copy nsamples to output
+ j = dec_ctr;
+ while (j < d_nsamples) {
+ *output++ = d_invfft->get_outbuf()[j];
+ j += d_decimation;
+ }
+ dec_ctr = (j - d_nsamples);
+
+ // stash the tail
+ memcpy(&d_tail[0], d_invfft->get_outbuf() + d_nsamples,
+ tailsize() * sizeof(gr_complex));
+ }
+
+ assert(dec_ctr == 0);
+
+ return nitems;
+}
diff --git a/gnuradio-core/src/lib/filter/gri_fft_filter_ccc_generic.h b/gnuradio-core/src/lib/filter/gri_fft_filter_ccc_generic.h
new file mode 100644
index 000000000..648c2b8c5
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gri_fft_filter_ccc_generic.h
@@ -0,0 +1,96 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+#ifndef INCLUDED_GRI_FFT_FILTER_CCC_GENERIC_H
+#define INCLUDED_GRI_FFT_FILTER_CCC_GENERIC_H
+
+#include <gr_core_api.h>
+#include <gr_complex.h>
+#include <vector>
+
+class gri_fft_complex;
+
+/*!
+ * \brief Fast FFT filter with gr_complex input, gr_complex output and gr_complex taps
+ * \ingroup filter_blk
+ */
+class GR_CORE_API gri_fft_filter_ccc_generic
+{
+ private:
+ int d_ntaps;
+ int d_nsamples;
+ int d_fftsize; // fftsize = ntaps + nsamples - 1
+ int d_decimation;
+ gri_fft_complex *d_fwdfft; // forward "plan"
+ gri_fft_complex *d_invfft; // inverse "plan"
+ int d_nthreads; // number of FFTW threads to use
+ std::vector<gr_complex> d_tail; // state carried between blocks for overlap-add
+ std::vector<gr_complex> d_new_taps;
+ gr_complex *d_xformed_taps; // Fourier xformed taps
+
+ void compute_sizes(int ntaps);
+ int tailsize() const { return d_ntaps - 1; }
+
+ public:
+ /*!
+ * \brief Construct an FFT filter for complex vectors with the given taps and decimation rate.
+ *
+ * This is the basic implementation for performing FFT filter for fast convolution
+ * in other blocks for complex vectors (such as gr_fft_filter_ccc).
+ * \param decimation The decimation rate of the filter (int)
+ * \param taps The filter taps (complex)
+ * \param nthreads The number of threads for the FFT to use (int)
+ */
+ gri_fft_filter_ccc_generic (int decimation, const std::vector<gr_complex> &taps,
+ int nthreads=1);
+ ~gri_fft_filter_ccc_generic ();
+
+ /*!
+ * \brief Set new taps for the filter.
+ *
+ * Sets new taps and resets the class properties to handle different sizes
+ * \param taps The filter taps (complex)
+ */
+ int set_taps (const std::vector<gr_complex> &taps);
+
+ /*!
+ * \brief Set number of threads to use.
+ */
+ void set_nthreads(int n);
+
+ /*!
+ * \brief Get number of threads being used.
+ */
+ int nthreads() const;
+
+ /*!
+ * \brief Perform the filter operation
+ *
+ * \param nitems The number of items to produce
+ * \param input The input vector to be filtered
+ * \param output The result of the filter operation
+ */
+ int filter (int nitems, const gr_complex *input, gr_complex *output);
+
+};
+
+#endif /* INCLUDED_GRI_FFT_FILTER_CCC_GENERIC_H */
diff --git a/gnuradio-core/src/lib/filter/gri_fft_filter_ccc_sse.cc b/gnuradio-core/src/lib/filter/gri_fft_filter_ccc_sse.cc
new file mode 100644
index 000000000..bfc939869
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gri_fft_filter_ccc_sse.cc
@@ -0,0 +1,186 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gri_fft_filter_ccc_sse.h>
+#include <gri_fft.h>
+#include <assert.h>
+#include <stdexcept>
+#include <cstdio>
+#include <xmmintrin.h>
+#include <fftw3.h>
+
+gri_fft_filter_ccc_sse::gri_fft_filter_ccc_sse (int decimation,
+ const std::vector<gr_complex> &taps)
+ : d_fftsize(-1), d_decimation(decimation), d_fwdfft(0), d_invfft(0)
+{
+ d_xformed_taps = (gr_complex*)fftwf_malloc(1*sizeof(gr_complex));
+ set_taps(taps);
+}
+
+gri_fft_filter_ccc_sse::~gri_fft_filter_ccc_sse ()
+{
+ fftwf_free(d_xformed_taps);
+ delete d_fwdfft;
+ delete d_invfft;
+}
+
+#if 0
+static void
+print_vector_complex(const std::string label, const std::vector<gr_complex> &x)
+{
+ std::cout << label;
+ for (unsigned i = 0; i < x.size(); i++)
+ std::cout << x[i] << " ";
+ std::cout << "\n";
+}
+#endif
+
+
+/*
+ * determines d_ntaps, d_nsamples, d_fftsize, d_xformed_taps
+ */
+int
+gri_fft_filter_ccc_sse::set_taps (const std::vector<gr_complex> &taps)
+{
+ int i = 0;
+ compute_sizes(taps.size());
+
+ d_tail.resize(tailsize());
+ for (i = 0; i < tailsize(); i++)
+ d_tail[i] = 0;
+
+ gr_complex *in = d_fwdfft->get_inbuf();
+ gr_complex *out = d_fwdfft->get_outbuf();
+
+ float scale = 1.0 / d_fftsize;
+
+ // Compute forward xform of taps.
+ // Copy taps into first ntaps slots, then pad with zeros
+ for (i = 0; i < d_ntaps; i++)
+ in[i] = taps[i] * scale;
+
+ for (; i < d_fftsize; i++)
+ in[i] = 0;
+
+ d_fwdfft->execute(); // do the xform
+
+ // now copy output to d_xformed_taps
+ for (i = 0; i < d_fftsize; i++)
+ d_xformed_taps[i] = out[i];
+
+ return d_nsamples;
+}
+
+// determine and set d_ntaps, d_nsamples, d_fftsize
+
+void
+gri_fft_filter_ccc_sse::compute_sizes(int ntaps)
+{
+ int old_fftsize = d_fftsize;
+ d_ntaps = ntaps;
+ d_fftsize = (int) (2 * pow(2.0, ceil(log(ntaps) / log(2))));
+ d_nsamples = d_fftsize - d_ntaps + 1;
+
+ if (0)
+ fprintf(stderr, "gri_fft_filter_ccc_sse: ntaps = %d, fftsize = %d, nsamples = %d\n",
+ d_ntaps, d_fftsize, d_nsamples);
+
+ assert(d_fftsize == d_ntaps + d_nsamples -1 );
+
+ if (d_fftsize != old_fftsize){ // compute new plans
+ delete d_fwdfft;
+ delete d_invfft;
+ d_fwdfft = new gri_fft_complex(d_fftsize, true);
+ d_invfft = new gri_fft_complex(d_fftsize, false);
+
+ fftwf_free(d_xformed_taps);
+ d_xformed_taps = (gr_complex*)fftwf_malloc((d_fftsize)*sizeof(gr_complex));
+ }
+}
+
+int
+gri_fft_filter_ccc_sse::filter (int nitems, const gr_complex *input, gr_complex *output)
+{
+ int dec_ctr = 0;
+ int j = 0;
+ int ninput_items = nitems * d_decimation;
+
+ for (int i = 0; i < ninput_items; i += d_nsamples){
+
+ memcpy(d_fwdfft->get_inbuf(), &input[i], d_nsamples * sizeof(gr_complex));
+
+ for (j = d_nsamples; j < d_fftsize; j++)
+ d_fwdfft->get_inbuf()[j] = 0;
+
+ d_fwdfft->execute(); // compute fwd xform
+
+ float *a = (float*)(d_fwdfft->get_outbuf());
+ float *b = (float*)(&d_xformed_taps[0]);
+ float *c = (float*)(d_invfft->get_inbuf());
+
+ __m128 x0, x1, x2, t0, t1, m;
+ m = _mm_set_ps(-1, 1, -1, 1);
+ for (j = 0; j < 2*d_fftsize; j+=4) { // filter in the freq domain
+ x0 = _mm_load_ps(&a[j]);
+ t0 = _mm_load_ps(&b[j]);
+
+ t1 = _mm_shuffle_ps(t0, t0, _MM_SHUFFLE(3, 3, 1, 1));
+ t0 = _mm_shuffle_ps(t0, t0, _MM_SHUFFLE(2, 2, 0, 0));
+ t1 = _mm_mul_ps(t1, m);
+
+ x1 = _mm_mul_ps(x0, t0);
+ x2 = _mm_mul_ps(x0, t1);
+
+ x2 = _mm_shuffle_ps(x2, x2, _MM_SHUFFLE(2, 3, 0, 1));
+ x2 = _mm_add_ps(x1, x2);
+
+ _mm_store_ps(&c[j], x2);
+ }
+
+ d_invfft->execute(); // compute inv xform
+
+ // add in the overlapping tail
+
+ for (j = 0; j < tailsize(); j++)
+ d_invfft->get_outbuf()[j] += d_tail[j];
+
+ // copy nsamples to output
+ j = dec_ctr;
+ while (j < d_nsamples) {
+ *output++ = d_invfft->get_outbuf()[j];
+ j += d_decimation;
+ }
+ dec_ctr = (j - d_nsamples);
+
+ // stash the tail
+ memcpy(&d_tail[0], d_invfft->get_outbuf() + d_nsamples,
+ tailsize() * sizeof(gr_complex));
+ }
+
+ assert(dec_ctr == 0);
+
+ return nitems;
+}
diff --git a/gnuradio-core/src/lib/filter/gri_fft_filter_ccc_sse.h b/gnuradio-core/src/lib/filter/gri_fft_filter_ccc_sse.h
new file mode 100644
index 000000000..64b8c0c15
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gri_fft_filter_ccc_sse.h
@@ -0,0 +1,83 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+#ifndef INCLUDED_GRI_FFT_FILTER_CCC_SSE_H
+#define INCLUDED_GRI_FFT_FILTER_CCC_SSE_H
+
+#include <gr_core_api.h>
+#include <gr_complex.h>
+#include <vector>
+
+class gri_fft_complex;
+
+/*!
+ * \brief Fast FFT filter with gr_complex input, gr_complex output and gr_complex taps
+ * \ingroup filter_blk
+ */
+class GR_CORE_API gri_fft_filter_ccc_sse
+{
+ private:
+ int d_ntaps;
+ int d_nsamples;
+ int d_fftsize; // fftsize = ntaps + nsamples - 1
+ int d_decimation;
+ gri_fft_complex *d_fwdfft; // forward "plan"
+ gri_fft_complex *d_invfft; // inverse "plan"
+ std::vector<gr_complex> d_tail; // state carried between blocks for overlap-add
+ gr_complex *d_xformed_taps;
+ std::vector<gr_complex> d_new_taps;
+
+ void compute_sizes(int ntaps);
+ int tailsize() const { return d_ntaps - 1; }
+
+ public:
+ /*!
+ * \brief Construct an FFT filter for complex vectors with the given taps and decimation rate.
+ *
+ * This is the basic implementation for performing FFT filter for fast convolution
+ * in other blocks for complex vectors (such as gr_fft_filter_ccc).
+ * \param decimation The decimation rate of the filter (int)
+ * \param taps The filter taps (complex)
+ */
+ gri_fft_filter_ccc_sse (int decimation, const std::vector<gr_complex> &taps);
+ ~gri_fft_filter_ccc_sse ();
+
+ /*!
+ * \brief Set new taps for the filter.
+ *
+ * Sets new taps and resets the class properties to handle different sizes
+ * \param taps The filter taps (complex)
+ */
+ int set_taps (const std::vector<gr_complex> &taps);
+
+ /*!
+ * \brief Perform the filter operation
+ *
+ * \param nitems The number of items to produce
+ * \param input The input vector to be filtered
+ * \param output The result of the filter operation
+ */
+ int filter (int nitems, const gr_complex *input, gr_complex *output);
+
+};
+
+#endif /* INCLUDED_GRI_FFT_FILTER_CCC_SSE_H */
diff --git a/gnuradio-core/src/lib/filter/gri_fft_filter_fff_generic.cc b/gnuradio-core/src/lib/filter/gri_fft_filter_fff_generic.cc
new file mode 100644
index 000000000..c6e923ee1
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gri_fft_filter_fff_generic.cc
@@ -0,0 +1,175 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gri_fft_filter_fff_generic.h>
+#include <gri_fft.h>
+#include <volk/volk.h>
+#include <assert.h>
+#include <stdexcept>
+#include <cstdio>
+#include <cstring>
+
+gri_fft_filter_fff_generic::gri_fft_filter_fff_generic (int decimation,
+ const std::vector<float> &taps,
+ int nthreads)
+ : d_fftsize(-1), d_decimation(decimation), d_fwdfft(0), d_invfft(0), d_nthreads(nthreads)
+{
+ set_taps(taps);
+}
+
+gri_fft_filter_fff_generic::~gri_fft_filter_fff_generic ()
+{
+ delete d_fwdfft;
+ delete d_invfft;
+ gri_fft_free(d_xformed_taps);
+}
+
+/*
+ * determines d_ntaps, d_nsamples, d_fftsize, d_xformed_taps
+ */
+int
+gri_fft_filter_fff_generic::set_taps (const std::vector<float> &taps)
+{
+ int i = 0;
+ compute_sizes(taps.size());
+
+ d_tail.resize(tailsize());
+ for (i = 0; i < tailsize(); i++)
+ d_tail[i] = 0;
+
+ float *in = d_fwdfft->get_inbuf();
+ gr_complex *out = d_fwdfft->get_outbuf();
+
+ float scale = 1.0 / d_fftsize;
+
+ // Compute forward xform of taps.
+ // Copy taps into first ntaps slots, then pad with zeros
+ for (i = 0; i < d_ntaps; i++)
+ in[i] = taps[i] * scale;
+
+ for (; i < d_fftsize; i++)
+ in[i] = 0;
+
+ d_fwdfft->execute(); // do the xform
+
+ // now copy output to d_xformed_taps
+ for (i = 0; i < d_fftsize/2+1; i++)
+ d_xformed_taps[i] = out[i];
+
+ return d_nsamples;
+}
+
+// determine and set d_ntaps, d_nsamples, d_fftsize
+
+void
+gri_fft_filter_fff_generic::compute_sizes(int ntaps)
+{
+ int old_fftsize = d_fftsize;
+ d_ntaps = ntaps;
+ d_fftsize = (int) (2 * pow(2.0, ceil(log(double(ntaps)) / log(2.0))));
+ d_nsamples = d_fftsize - d_ntaps + 1;
+
+ if (0)
+ fprintf(stderr, "gri_fft_filter_fff_generic: ntaps = %d, fftsize = %d, nsamples = %d\n",
+ d_ntaps, d_fftsize, d_nsamples);
+
+ assert(d_fftsize == d_ntaps + d_nsamples -1 );
+
+ if (d_fftsize != old_fftsize){ // compute new plans
+ delete d_fwdfft;
+ delete d_invfft;
+ d_fwdfft = new gri_fft_real_fwd(d_fftsize);
+ d_invfft = new gri_fft_real_rev(d_fftsize);
+ d_xformed_taps = gri_fft_malloc_complex(d_fftsize/2+1);
+ }
+}
+
+void
+gri_fft_filter_fff_generic::set_nthreads(int n)
+{
+ d_nthreads = n;
+ if(d_fwdfft)
+ d_fwdfft->set_nthreads(n);
+ if(d_invfft)
+ d_invfft->set_nthreads(n);
+}
+
+int
+gri_fft_filter_fff_generic::nthreads() const
+{
+ return d_nthreads;
+}
+
+int
+gri_fft_filter_fff_generic::filter (int nitems, const float *input, float *output)
+{
+ int dec_ctr = 0;
+ int j = 0;
+ int ninput_items = nitems * d_decimation;
+
+ for (int i = 0; i < ninput_items; i += d_nsamples){
+
+ memcpy(d_fwdfft->get_inbuf(), &input[i], d_nsamples * sizeof(float));
+
+ for (j = d_nsamples; j < d_fftsize; j++)
+ d_fwdfft->get_inbuf()[j] = 0;
+
+ d_fwdfft->execute(); // compute fwd xform
+
+ gr_complex *a = d_fwdfft->get_outbuf();
+ gr_complex *b = d_xformed_taps;
+ gr_complex *c = d_invfft->get_inbuf();
+
+ volk_32fc_x2_multiply_32fc_a(c, a, b, d_fftsize/2+1);
+
+ d_invfft->execute(); // compute inv xform
+
+ // add in the overlapping tail
+
+ for (j = 0; j < tailsize(); j++)
+ d_invfft->get_outbuf()[j] += d_tail[j];
+
+ // copy nsamples to output
+
+ //memcpy(out, d_invfft->get_outbuf(), d_nsamples * sizeof(float));
+ //out += d_nsamples;
+
+ j = dec_ctr;
+ while (j < d_nsamples) {
+ *output++ = d_invfft->get_outbuf()[j];
+ j += d_decimation;
+ }
+ dec_ctr = (j - d_nsamples);
+
+ // stash the tail
+ memcpy(&d_tail[0], d_invfft->get_outbuf() + d_nsamples,
+ tailsize() * sizeof(float));
+ }
+
+ assert(dec_ctr == 0);
+
+ return nitems;
+}
diff --git a/gnuradio-core/src/lib/filter/gri_fft_filter_fff_generic.h b/gnuradio-core/src/lib/filter/gri_fft_filter_fff_generic.h
new file mode 100644
index 000000000..528bf5dd7
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gri_fft_filter_fff_generic.h
@@ -0,0 +1,94 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+#ifndef INCLUDED_GRI_FFT_FILTER_FFF_GENERIC_H
+#define INCLUDED_GRI_FFT_FILTER_FFF_GENERIC_H
+
+#include <gr_core_api.h>
+#include <gr_complex.h>
+#include <vector>
+
+class gri_fft_real_fwd;
+class gri_fft_real_rev;
+
+class GR_CORE_API gri_fft_filter_fff_generic
+{
+ private:
+ int d_ntaps;
+ int d_nsamples;
+ int d_fftsize; // fftsize = ntaps + nsamples - 1
+ int d_decimation;
+ gri_fft_real_fwd *d_fwdfft; // forward "plan"
+ gri_fft_real_rev *d_invfft; // inverse "plan"
+ int d_nthreads; // number of FFTW threads to use
+ std::vector<float> d_tail; // state carried between blocks for overlap-add
+ std::vector<float> d_new_taps;
+ gr_complex *d_xformed_taps; // Fourier xformed taps
+
+
+ void compute_sizes(int ntaps);
+ int tailsize() const { return d_ntaps - 1; }
+
+ public:
+ /*!
+ * \brief Construct a FFT filter for float vectors with the given taps and decimation rate.
+ *
+ * This is the basic implementation for performing FFT filter for fast convolution
+ * in other blocks for floating point vectors (such as gr_fft_filter_fff).
+ * \param decimation The decimation rate of the filter (int)
+ * \param taps The filter taps (float)
+ * \param nthreads The number of threads for the FFT to use (int)
+ */
+ gri_fft_filter_fff_generic (int decimation, const std::vector<float> &taps,
+ int nthreads=1);
+ ~gri_fft_filter_fff_generic ();
+
+ /*!
+ * \brief Set new taps for the filter.
+ *
+ * Sets new taps and resets the class properties to handle different sizes
+ * \param taps The filter taps (float)
+ */
+ int set_taps (const std::vector<float> &taps);
+
+ /*!
+ * \brief Set number of threads to use.
+ */
+ void set_nthreads(int n);
+
+ /*!
+ * \brief Get number of threads being used.
+ */
+ int nthreads() const;
+
+ /*!
+ * \brief Perform the filter operation
+ *
+ * \param nitems The number of items to produce
+ * \param input The input vector to be filtered
+ * \param output The result of the filter operation
+ */
+ int filter (int nitems, const float *input, float *output);
+
+};
+
+#endif /* INCLUDED_GRI_FFT_FILTER_FFF_GENERIC_H */
diff --git a/gnuradio-core/src/lib/filter/gri_fft_filter_fff_sse.cc b/gnuradio-core/src/lib/filter/gri_fft_filter_fff_sse.cc
new file mode 100644
index 000000000..84fcfa438
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gri_fft_filter_fff_sse.cc
@@ -0,0 +1,184 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gri_fft_filter_fff_sse.h>
+#include <gri_fft.h>
+#include <assert.h>
+#include <stdexcept>
+#include <cstdio>
+#include <xmmintrin.h>
+#include <fftw3.h>
+
+gri_fft_filter_fff_sse::gri_fft_filter_fff_sse (int decimation,
+ const std::vector<float> &taps)
+ : d_fftsize(-1), d_decimation(decimation), d_fwdfft(0), d_invfft(0)
+{
+ d_xformed_taps = (gr_complex*)fftwf_malloc(1*sizeof(gr_complex));
+ set_taps(taps);
+}
+
+gri_fft_filter_fff_sse::~gri_fft_filter_fff_sse ()
+{
+ fftwf_free(d_xformed_taps);
+ delete d_fwdfft;
+ delete d_invfft;
+}
+
+/*
+ * determines d_ntaps, d_nsamples, d_fftsize, d_xformed_taps
+ */
+int
+gri_fft_filter_fff_sse::set_taps (const std::vector<float> &taps)
+{
+ int i = 0;
+ compute_sizes(taps.size());
+
+ d_tail.resize(tailsize());
+ for (i = 0; i < tailsize(); i++)
+ d_tail[i] = 0;
+
+ float *in = d_fwdfft->get_inbuf();
+ gr_complex *out = d_fwdfft->get_outbuf();
+
+ float scale = 1.0 / d_fftsize;
+
+ // Compute forward xform of taps.
+ // Copy taps into first ntaps slots, then pad with zeros
+ for (i = 0; i < d_ntaps; i++)
+ in[i] = taps[i] * scale;
+
+ for (; i < d_fftsize; i++)
+ in[i] = 0;
+
+ d_fwdfft->execute(); // do the xform
+
+ // now copy output to d_xformed_taps
+ for (i = 0; i < d_fftsize/2+1; i++)
+ d_xformed_taps[i] = out[i];
+
+ return d_nsamples;
+}
+
+// determine and set d_ntaps, d_nsamples, d_fftsize
+
+void
+gri_fft_filter_fff_sse::compute_sizes(int ntaps)
+{
+ int old_fftsize = d_fftsize;
+ d_ntaps = ntaps;
+ d_fftsize = (int) (2 * pow(2.0, ceil(log(ntaps) / log(2))));
+ d_nsamples = d_fftsize - d_ntaps + 1;
+
+ if (0)
+ fprintf(stderr, "gri_fft_filter_fff_sse: ntaps = %d, fftsize = %d, nsamples = %d\n",
+ d_ntaps, d_fftsize, d_nsamples);
+
+ assert(d_fftsize == d_ntaps + d_nsamples -1 );
+
+ if (d_fftsize != old_fftsize){ // compute new plans
+ delete d_fwdfft;
+ delete d_invfft;
+ d_fwdfft = new gri_fft_real_fwd(d_fftsize);
+ d_invfft = new gri_fft_real_rev(d_fftsize);
+ //d_xformed_taps.resize(d_fftsize/2+1);
+
+ fftwf_free(d_xformed_taps);
+ d_xformed_taps = (gr_complex*)fftwf_malloc((d_fftsize/2+1)*sizeof(gr_complex));
+ }
+}
+
+int
+gri_fft_filter_fff_sse::filter (int nitems, const float *input, float *output)
+{
+ int dec_ctr = 0;
+ int j = 0;
+ int ninput_items = nitems * d_decimation;
+
+ for (int i = 0; i < ninput_items; i += d_nsamples){
+
+ memcpy(d_fwdfft->get_inbuf(), &input[i], d_nsamples * sizeof(float));
+
+ for (j = d_nsamples; j < d_fftsize; j++)
+ d_fwdfft->get_inbuf()[j] = 0;
+
+ d_fwdfft->execute(); // compute fwd xform
+
+ float *a = (float*)(d_fwdfft->get_outbuf());
+ float *b = (float*)(&d_xformed_taps[0]);
+ float *c = (float*)(d_invfft->get_inbuf());
+
+ __m128 x0, x1, x2, t0, t1, m;
+ m = _mm_set_ps(-1, 1, -1, 1);
+ for (j = 0; j < d_fftsize; j+=4) { // filter in the freq domain
+ x0 = _mm_load_ps(&a[j]);
+ t0 = _mm_load_ps(&b[j]);
+
+ t1 = _mm_shuffle_ps(t0, t0, _MM_SHUFFLE(3, 3, 1, 1));
+ t0 = _mm_shuffle_ps(t0, t0, _MM_SHUFFLE(2, 2, 0, 0));
+ t1 = _mm_mul_ps(t1, m);
+
+ x1 = _mm_mul_ps(x0, t0);
+ x2 = _mm_mul_ps(x0, t1);
+
+ x2 = _mm_shuffle_ps(x2, x2, _MM_SHUFFLE(2, 3, 0, 1));
+ x2 = _mm_add_ps(x1, x2);
+
+ _mm_store_ps(&c[j], x2);
+ }
+
+ // Finish off the last one; do the complex multiply as floats
+ j = d_fftsize/2;
+ c[j] = (a[j] * b[j]) - (a[j+1] * b[j+1]);
+ c[j+1] = (a[j] * b[j+1]) + (a[j+1] * b[j]);
+
+ d_invfft->execute(); // compute inv xform
+
+ // add in the overlapping tail
+
+ for (j = 0; j < tailsize(); j++)
+ d_invfft->get_outbuf()[j] += d_tail[j];
+
+ // copy nsamples to output
+
+ //memcpy(out, d_invfft->get_outbuf(), d_nsamples * sizeof(float));
+ //out += d_nsamples;
+
+ j = dec_ctr;
+ while (j < d_nsamples) {
+ *output++ = d_invfft->get_outbuf()[j];
+ j += d_decimation;
+ }
+ dec_ctr = (j - d_nsamples);
+
+ // stash the tail
+ memcpy(&d_tail[0], d_invfft->get_outbuf() + d_nsamples,
+ tailsize() * sizeof(float));
+ }
+
+ assert(dec_ctr == 0);
+
+ return nitems;
+}
diff --git a/gnuradio-core/src/lib/filter/gri_fft_filter_fff_sse.h b/gnuradio-core/src/lib/filter/gri_fft_filter_fff_sse.h
new file mode 100644
index 000000000..b6086562d
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gri_fft_filter_fff_sse.h
@@ -0,0 +1,82 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+#ifndef INCLUDED_GRI_FFT_FILTER_FFF_SSE_H
+#define INCLUDED_GRI_FFT_FILTER_FFF_SSE_H
+
+#include <gr_core_api.h>
+#include <gr_complex.h>
+#include <vector>
+
+class gri_fft_real_fwd;
+class gri_fft_real_rev;
+
+class GR_CORE_API gri_fft_filter_fff_sse
+{
+ private:
+ int d_ntaps;
+ int d_nsamples;
+ int d_fftsize; // fftsize = ntaps + nsamples - 1
+ int d_decimation;
+ gri_fft_real_fwd *d_fwdfft; // forward "plan"
+ gri_fft_real_rev *d_invfft; // inverse "plan"
+ std::vector<float> d_tail; // state carried between blocks for overlap-add
+ //std::vector<gr_complex> d_xformed_taps; // Fourier xformed taps
+ gr_complex *d_xformed_taps;
+ std::vector<float> d_new_taps;
+
+
+ void compute_sizes(int ntaps);
+ int tailsize() const { return d_ntaps - 1; }
+
+ public:
+ /*!
+ * \brief Construct a FFT filter for float vectors with the given taps and decimation rate.
+ *
+ * This is the basic implementation for performing FFT filter for fast convolution
+ * in other blocks for floating point vectors (such as gr_fft_filter_fff).
+ * \param decimation The decimation rate of the filter (int)
+ * \param taps The filter taps (float)
+ */
+ gri_fft_filter_fff_sse (int decimation, const std::vector<float> &taps);
+ ~gri_fft_filter_fff_sse ();
+
+ /*!
+ * \brief Set new taps for the filter.
+ *
+ * Sets new taps and resets the class properties to handle different sizes
+ * \param taps The filter taps (float)
+ */
+ int set_taps (const std::vector<float> &taps);
+
+ /*!
+ * \brief Perform the filter operation
+ *
+ * \param nitems The number of items to produce
+ * \param input The input vector to be filtered
+ * \param output The result of the filter operation
+ */
+ int filter (int nitems, const float *input, float *output);
+
+};
+
+#endif /* INCLUDED_GRI_FFT_FILTER_FFF_SSE_H */
diff --git a/gnuradio-core/src/lib/filter/gri_fir_filter_with_buffer_XXX.cc.t b/gnuradio-core/src/lib/filter/gri_fir_filter_with_buffer_XXX.cc.t
new file mode 100644
index 000000000..0ae644cc6
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gri_fir_filter_with_buffer_XXX.cc.t
@@ -0,0 +1,121 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <@NAME@.h>
+
+@NAME@::@NAME@(const std::vector<@TAP_TYPE@> &taps)
+{
+ d_buffer = NULL;
+ set_taps(taps);
+}
+
+@NAME@::~@NAME@()
+{
+ if(d_buffer != NULL)
+ free(d_buffer);
+}
+
+void
+@NAME@::set_taps (const std::vector<@TAP_TYPE@> &taps)
+{
+ d_taps = gr_reverse(taps);
+
+ if(d_buffer != NULL) {
+ free(d_buffer);
+ d_buffer = NULL;
+ }
+
+ // FIXME: memalign this to 16-byte boundaries for SIMD later
+ size_t t = sizeof(@I_TYPE@) * 2 * d_taps.size();
+ d_buffer = (@I_TYPE@*)malloc(t);
+ memset(d_buffer, 0x00, t);
+ d_idx = 0;
+}
+
+@O_TYPE@
+@NAME@::filter (@I_TYPE@ input)
+{
+ unsigned int i;
+
+ d_buffer[d_idx] = input;
+ d_buffer[d_idx+ntaps()] = input;
+
+ // using the later for the case when ntaps=0;
+ // profiling shows this doesn't make a difference
+ //d_idx = (d_idx + 1) % ntaps();
+ d_idx++;
+ if(d_idx >= ntaps())
+ d_idx = 0;
+
+ @ACC_TYPE@ out = 0;
+ for(i = 0; i < ntaps(); i++) {
+ out += @INPUT_CAST@ d_buffer[d_idx + i] * d_taps[i];
+ }
+ return (@O_TYPE@)out;
+}
+
+@O_TYPE@
+@NAME@::filter (const @I_TYPE@ input[], unsigned long dec)
+{
+ unsigned int i;
+
+ for(i = 0; i < dec; i++) {
+ d_buffer[d_idx] = input[i];
+ d_buffer[d_idx+ntaps()] = input[i];
+ d_idx++;
+ if(d_idx >= ntaps())
+ d_idx = 0;
+ }
+
+ @ACC_TYPE@ out = 0;
+ for(i = 0; i < ntaps(); i++) {
+ out += @INPUT_CAST@ d_buffer[d_idx + i] * d_taps[i];
+ }
+ return (@O_TYPE@)out;
+}
+
+void
+@NAME@::filterN (@O_TYPE@ output[],
+ const @I_TYPE@ input[],
+ unsigned long n)
+{
+ for(unsigned long i = 0; i < n; i++) {
+ output[i] = filter(input[i]);
+ }
+}
+
+void
+@NAME@::filterNdec (@O_TYPE@ output[],
+ const @I_TYPE@ input[],
+ unsigned long n,
+ unsigned long decimate)
+{
+ unsigned long j = 0;
+ for(unsigned long i = 0; i < n; i++) {
+ output[i] = filter(&input[j], decimate);
+ j += decimate;
+ }
+}
diff --git a/gnuradio-core/src/lib/filter/gri_fir_filter_with_buffer_XXX.h.t b/gnuradio-core/src/lib/filter/gri_fir_filter_with_buffer_XXX.h.t
new file mode 100644
index 000000000..efb314bed
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gri_fir_filter_with_buffer_XXX.h.t
@@ -0,0 +1,132 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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: This file is automatically generated by generate_gri_fir_XXX.py
+ * Any changes made to this file will be overwritten.
+ */
+
+
+#ifndef @GUARD_NAME@
+#define @GUARD_NAME@
+
+#include <gr_core_api.h>
+#include <vector>
+#include <gr_types.h>
+#include <gr_reverse.h>
+#include <string.h>
+#include <cstdio>
+
+/*!
+ * \brief FIR with internal buffer for @I_TYPE@ input,
+ @O_TYPE@ output and @TAP_TYPE@ taps
+ * \ingroup filter
+ *
+ */
+
+class GR_CORE_API @NAME@ {
+
+protected:
+ std::vector<@TAP_TYPE@> d_taps; // reversed taps
+ @I_TYPE@ *d_buffer;
+ unsigned int d_idx;
+
+public:
+
+ // CONSTRUCTORS
+
+ /*!
+ * \brief construct new FIR with given taps.
+ *
+ * Note that taps must be in forward order, e.g., coefficient 0 is
+ * stored in new_taps[0], coefficient 1 is stored in
+ * new_taps[1], etc.
+ */
+ @NAME@ (const std::vector<@TAP_TYPE@> &taps);
+
+ ~@NAME@ ();
+
+ // MANIPULATORS
+
+ /*!
+ * \brief compute a single output value.
+ *
+ * \p input is a single input value of the filter type
+ *
+ * \returns the filtered input value.
+ */
+ @O_TYPE@ filter (@I_TYPE@ input);
+
+
+ /*!
+ * \brief compute a single output value; designed for decimating filters.
+ *
+ * \p input is a single input value of the filter type. The value of dec is the
+ * decimating value of the filter, so input[] must have dec valid values.
+ * The filter pushes dec number of items onto the circ. buffer before computing
+ * a single output.
+ *
+ * \returns the filtered input value.
+ */
+ @O_TYPE@ filter (const @I_TYPE@ input[], unsigned long dec);
+
+ /*!
+ * \brief compute an array of N output values.
+ *
+ * \p input must have (n - 1 + ntaps()) valid entries.
+ * input[0] .. input[n - 1 + ntaps() - 1] are referenced to compute the output values.
+ */
+ void filterN (@O_TYPE@ output[], const @I_TYPE@ input[],
+ unsigned long n);
+
+ /*!
+ * \brief compute an array of N output values, decimating the input
+ *
+ * \p input must have (decimate * (n - 1) + ntaps()) valid entries.
+ * input[0] .. input[decimate * (n - 1) + ntaps() - 1] are referenced to
+ * compute the output values.
+ */
+ void filterNdec (@O_TYPE@ output[], const @I_TYPE@ input[],
+ unsigned long n, unsigned long decimate);
+
+ /*!
+ * \brief install \p new_taps as the current taps.
+ */
+ void set_taps (const std::vector<@TAP_TYPE@> &taps);
+
+ // ACCESSORS
+
+ /*!
+ * \return number of taps in filter.
+ */
+ unsigned ntaps () const { return d_taps.size (); }
+
+ /*!
+ * \return current taps
+ */
+ const std::vector<@TAP_TYPE@> get_taps () const
+ {
+ return gr_reverse(d_taps);
+ }
+};
+
+#endif /* @GUARD_NAME@ */
diff --git a/gnuradio-core/src/lib/filter/gri_goertzel.cc b/gnuradio-core/src/lib/filter/gri_goertzel.cc
new file mode 100644
index 000000000..2fbdd3b13
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gri_goertzel.cc
@@ -0,0 +1,75 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <cmath>
+
+#include <gri_goertzel.h>
+
+gri_goertzel::gri_goertzel(int rate, int len, float freq)
+{
+ gri_setparms(rate, len, freq);
+}
+
+void
+gri_goertzel::gri_setparms(int rate, int len, float freq)
+{
+ d_d1 = 0.0;
+ d_d2 = 0.0;
+
+ float w = 2.0*M_PI*freq/rate;
+ d_wr = 2.0*std::cos(w);
+ d_wi = std::sin(w);
+ d_len = len;
+ d_processed = 0;
+
+}
+
+gr_complex gri_goertzel::batch(float *in)
+{
+ d_d1 = 0.0;
+ d_d2 = 0.0;
+
+ for(int i = 0; i < d_len; i++)
+ input(in[i]);
+
+ return output();
+}
+
+void gri_goertzel::input(const float &input)
+{
+ float y = input + d_wr*d_d1 - d_d2;
+ d_d2 = d_d1;
+ d_d1 = y;
+ d_processed++;
+}
+
+gr_complex gri_goertzel::output()
+{
+ gr_complex out((0.5*d_wr*d_d1-d_d2)/d_len, (d_wi*d_d1)/d_len);
+ d_d1 = 0.0;
+ d_d2 = 0.0;
+ d_processed = 0;
+ return out;
+}
diff --git a/gnuradio-core/src/lib/filter/gri_goertzel.h b/gnuradio-core/src/lib/filter/gri_goertzel.h
new file mode 100644
index 000000000..e28cb21a8
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gri_goertzel.h
@@ -0,0 +1,57 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006,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.
+ */
+
+#ifndef INCLUDED_GRI_GOERTZEL_H
+#define INCLUDED_GRI_GOERTZEL_H
+
+#include <gr_core_api.h>
+#include <gr_types.h>
+
+/*!
+ * \brief Implements Goertzel single-bin DFT calculation
+ * \ingroup misc
+ */
+class GR_CORE_API gri_goertzel
+{
+public:
+ gri_goertzel() {}
+ gri_goertzel(int rate, int len, float freq);
+ void gri_setparms(int rate, int len, float freq);
+
+ // Process a input array
+ gr_complex batch(float *in);
+
+ // Process sample by sample
+ void input(const float &in);
+ gr_complex output();
+ bool ready() const { return d_processed == d_len; }
+
+private:
+ float d_d1;
+ float d_d2;
+ float d_wr;
+ float d_wi;
+ int d_len;
+ int d_processed;
+};
+
+#endif /* INCLUDED_GRI_GOERTZEL_H */
diff --git a/gnuradio-core/src/lib/filter/gri_iir.h b/gnuradio-core/src/lib/filter/gri_iir.h
new file mode 100644
index 000000000..86345f6c0
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gri_iir.h
@@ -0,0 +1,177 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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_GRI_IIR_H
+#define INCLUDED_GRI_IIR_H
+
+#include <gr_core_api.h>
+#include <vector>
+#include <stdexcept>
+
+/*!
+ * \brief base class template for Infinite Impulse Response filter (IIR)
+ */
+template<class i_type, class o_type, class tap_type>
+class gri_iir {
+public:
+ /*!
+ * \brief Construct an IIR with the given taps.
+ *
+ * This filter uses the Direct Form I implementation, where
+ * \p fftaps contains the feed-forward taps, and \p fbtaps the feedback ones.
+ *
+ * \p fftaps and \p fbtaps must have equal numbers of taps
+ *
+ * The input and output satisfy a difference equation of the form
+
+ \f[
+ y[n] - \sum_{k=1}^{M} a_k y[n-k] = \sum_{k=0}^{N} b_k x[n-k]
+ \f]
+
+ * with the corresponding rational system function
+
+ \f[
+ H(z) = \frac{\sum_{k=0}^{N} b_k z^{-k}}{1 - \sum_{k=1}^{M} a_k z^{-k}}
+ \f]
+
+ * Note that some texts define the system function with a + in the denominator.
+ * If you're using that convention, you'll need to negate the feedback taps.
+ */
+ gri_iir (const std::vector<tap_type>& fftaps,
+ const std::vector<tap_type>& fbtaps) throw (std::invalid_argument)
+ {
+ set_taps (fftaps, fbtaps);
+ }
+
+ gri_iir () : d_latest_n(0),d_latest_m(0) { }
+
+ ~gri_iir () {}
+
+ /*!
+ * \brief compute a single output value.
+ * \returns the filtered input value.
+ */
+ o_type filter (const i_type input);
+
+ /*!
+ * \brief compute an array of N output values.
+ * \p input must have N valid entries.
+ */
+ void filter_n (o_type output[], const i_type input[], long n);
+
+ /*!
+ * \return number of taps in filter.
+ */
+ unsigned ntaps_ff () const { return d_fftaps.size (); }
+ unsigned ntaps_fb () const { return d_fbtaps.size (); }
+
+ /*!
+ * \brief install new taps.
+ */
+ void set_taps (const std::vector<tap_type> &fftaps,
+ const std::vector<tap_type> &fbtaps) throw (std::invalid_argument)
+ {
+
+
+ d_latest_n = 0;
+ d_latest_m = 0;
+ d_fftaps = fftaps;
+ d_fbtaps = fbtaps;
+
+ int n = fftaps.size ();
+ int m = fbtaps.size ();
+ d_prev_input.resize (2 * n);
+ d_prev_output.resize (2 * m);
+
+ for (int i = 0; i < 2 * n; i++){
+ d_prev_input[i] = 0;
+ }
+ for (int i = 0; i < 2 * m; i++){
+ d_prev_output[i] = 0;
+ }
+ }
+
+protected:
+ std::vector<tap_type> d_fftaps;
+ std::vector<tap_type> d_fbtaps;
+ int d_latest_n;
+ int d_latest_m;
+ std::vector<tap_type> d_prev_output;
+ std::vector<i_type> d_prev_input;
+};
+
+
+//
+// general case. We may want to specialize this
+//
+template<class i_type, class o_type, class tap_type>
+o_type
+gri_iir<i_type, o_type, tap_type>::filter (const i_type input)
+{
+ tap_type acc;
+ unsigned i = 0;
+ unsigned n = ntaps_ff ();
+ unsigned m = ntaps_fb ();
+
+ if (n == 0)
+ return (o_type) 0;
+
+ int latest_n = d_latest_n;
+ int latest_m = d_latest_m;
+
+ acc = d_fftaps[0] * input;
+ for (i = 1; i < n; i ++)
+ acc += (d_fftaps[i] * d_prev_input[latest_n + i]);
+ for (i = 1; i < m; i ++)
+ acc += (d_fbtaps[i] * d_prev_output[latest_m + i]);
+
+ // store the values twice to avoid having to handle wrap-around in the loop
+ d_prev_output[latest_m] = acc;
+ d_prev_output[latest_m+m] = acc;
+ d_prev_input[latest_n] = input;
+ d_prev_input[latest_n+n] = input;
+
+ latest_n--;
+ latest_m--;
+ if (latest_n < 0)
+ latest_n += n;
+ if (latest_m < 0)
+ latest_m += m;
+
+ d_latest_m = latest_m;
+ d_latest_n = latest_n;
+ return (o_type) acc;
+}
+
+
+template<class i_type, class o_type, class tap_type>
+void
+gri_iir<i_type, o_type, tap_type>::filter_n (o_type output[],
+ const i_type input[],
+ long n)
+{
+ for (int i = 0; i < n; i++)
+ output[i] = filter (input[i]);
+}
+
+#endif /* INCLUDED_GRI_IIR_H */
+
diff --git a/gnuradio-core/src/lib/filter/gri_mmse_fir_interpolator.cc b/gnuradio-core/src/lib/filter/gri_mmse_fir_interpolator.cc
new file mode 100644
index 000000000..52098bf1a
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gri_mmse_fir_interpolator.cc
@@ -0,0 +1,71 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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 <gri_mmse_fir_interpolator.h>
+#include <gr_fir_util.h>
+#include <gr_fir_fff.h>
+#include <assert.h>
+#include <cmath>
+#include "interpolator_taps.h"
+
+gri_mmse_fir_interpolator::gri_mmse_fir_interpolator ()
+{
+ filters.resize (NSTEPS + 1);
+
+ for (int i = 0; i < NSTEPS + 1; i++){
+ std::vector<float> t (&taps[i][0], &taps[i][NTAPS]);
+ filters[i] = gr_fir_util::create_gr_fir_fff (t);
+ }
+}
+
+gri_mmse_fir_interpolator::~gri_mmse_fir_interpolator ()
+{
+ for (int i = 0; i < NSTEPS + 1; i++)
+ delete filters[i];
+}
+
+unsigned
+gri_mmse_fir_interpolator::ntaps () const
+{
+ return NTAPS;
+}
+
+unsigned
+gri_mmse_fir_interpolator::nsteps () const
+{
+ return NSTEPS;
+}
+
+float
+gri_mmse_fir_interpolator::interpolate (const float input[], float mu) const
+{
+ int imu = (int) rint (mu * NSTEPS);
+
+ assert (imu >= 0);
+ assert (imu <= NSTEPS);
+
+ float r = filters[imu]->filter (input);
+ return r;
+}
diff --git a/gnuradio-core/src/lib/filter/gri_mmse_fir_interpolator.h b/gnuradio-core/src/lib/filter/gri_mmse_fir_interpolator.h
new file mode 100644
index 000000000..f479169bc
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gri_mmse_fir_interpolator.h
@@ -0,0 +1,71 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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 _GRI_MMSE_FIR_INTERPOLATOR_H_
+#define _GRI_MMSE_FIR_INTERPOLATOR_H_
+
+#include <gr_core_api.h>
+#include <vector>
+
+class gr_fir_fff;
+
+/*!
+ * \brief Compute intermediate samples between signal samples x(k*Ts)
+ * \ingroup filter_primitive
+ *
+ * This implements a Mininum Mean Squared Error interpolator with 8 taps.
+ * It is suitable for signals where the bandwidth of interest B = 1/(4*Ts)
+ * Where Ts is the time between samples.
+ *
+ * Although mu, the fractional delay, is specified as a float, it is actually
+ * quantized. 0.0 <= mu <= 1.0. That is, mu is quantized in the interpolate
+ * method to 32nd's of a sample.
+ *
+ * For more information, in the GNU Radio source code, see:
+ * \li gnuradio-core/src/gen_interpolator_taps/README
+ * \li gnuradio-core/src/gen_interpolator_taps/praxis.txt
+ */
+
+class GR_CORE_API gri_mmse_fir_interpolator {
+public:
+ gri_mmse_fir_interpolator ();
+ ~gri_mmse_fir_interpolator ();
+
+ unsigned ntaps () const;
+ unsigned nsteps () const;
+
+ /*!
+ * \brief compute a single interpolated output value.
+ * \p input must have ntaps() valid entries.
+ * input[0] .. input[ntaps() - 1] are referenced to compute the output value.
+ *
+ * \p mu must be in the range [0, 1] and specifies the fractional delay.
+ *
+ * \returns the interpolated input value.
+ */
+ float interpolate (const float input[], float mu) const;
+
+protected:
+ std::vector<gr_fir_fff *> filters;
+};
+
+
+#endif /* _GRI_MMSE_FIR_INTERPOLATOR_H_ */
diff --git a/gnuradio-core/src/lib/filter/gri_mmse_fir_interpolator_cc.cc b/gnuradio-core/src/lib/filter/gri_mmse_fir_interpolator_cc.cc
new file mode 100644
index 000000000..174378c22
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gri_mmse_fir_interpolator_cc.cc
@@ -0,0 +1,71 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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 <gri_mmse_fir_interpolator_cc.h>
+#include <gr_fir_util.h>
+#include <gr_fir_ccf.h>
+#include <assert.h>
+#include <cmath>
+#include "interpolator_taps.h"
+
+gri_mmse_fir_interpolator_cc::gri_mmse_fir_interpolator_cc ()
+{
+ filters.resize (NSTEPS + 1);
+
+ for (int i = 0; i < NSTEPS + 1; i++){
+ std::vector<float> t (&taps[i][0], &taps[i][NTAPS]);
+ filters[i] = gr_fir_util::create_gr_fir_ccf (t);
+ }
+}
+
+gri_mmse_fir_interpolator_cc::~gri_mmse_fir_interpolator_cc ()
+{
+ for (int i = 0; i < NSTEPS + 1; i++)
+ delete filters[i];
+}
+
+unsigned
+gri_mmse_fir_interpolator_cc::ntaps () const
+{
+ return NTAPS;
+}
+
+unsigned
+gri_mmse_fir_interpolator_cc::nsteps () const
+{
+ return NSTEPS;
+}
+
+gr_complex
+gri_mmse_fir_interpolator_cc::interpolate (const gr_complex input[], float mu)
+{
+ int imu = (int) rint (mu * NSTEPS);
+
+ assert (imu >= 0);
+ assert (imu <= NSTEPS);
+
+ gr_complex r = filters[imu]->filter (input);
+ return r;
+}
diff --git a/gnuradio-core/src/lib/filter/gri_mmse_fir_interpolator_cc.h b/gnuradio-core/src/lib/filter/gri_mmse_fir_interpolator_cc.h
new file mode 100644
index 000000000..bacd9ed92
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gri_mmse_fir_interpolator_cc.h
@@ -0,0 +1,74 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002,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.
+ */
+#ifndef _GRI_MMSE_FIR_INTERPOLATOR_CC_H_
+#define _GRI_MMSE_FIR_INTERPOLATOR_CC_H_
+
+#include <gr_core_api.h>
+#include <gr_complex.h>
+#include <vector>
+
+class gr_fir_ccf;
+
+/*!
+ * \brief Compute intermediate samples between signal samples x(k*Ts)
+ * \ingroup filter_primitive
+ *
+ * This implements a Mininum Mean Squared Error interpolator with 8 taps.
+ * It is suitable for signals where the bandwidth of interest B = 1/(4*Ts)
+ * Where Ts is the time between samples.
+ *
+ * Although mu, the fractional delay, is specified as a float, it is actually
+ * quantized. 0.0 <= mu <= 1.0. That is, mu is quantized in the interpolate
+ * method to 32nd's of a sample.
+ *
+ * For more information, in the GNU Radio source code, see:
+ * \li gnuradio-core/src/gen_interpolator_taps/README
+ * \li gnuradio-core/src/gen_interpolator_taps/praxis.txt
+ */
+
+class GR_CORE_API gri_mmse_fir_interpolator_cc {
+public:
+ gri_mmse_fir_interpolator_cc ();
+ ~gri_mmse_fir_interpolator_cc ();
+
+ unsigned ntaps () const;
+ unsigned nsteps () const;
+
+ /*!
+ * \brief compute a single interpolated output value.
+ *
+ * \p input must have ntaps() valid entries and be 8-byte aligned.
+ * input[0] .. input[ntaps() - 1] are referenced to compute the output value.
+ * \throws std::invalid_argument if input is not 8-byte aligned.
+ *
+ * \p mu must be in the range [0, 1] and specifies the fractional delay.
+ *
+ * \returns the interpolated input value.
+ */
+ gr_complex interpolate (const gr_complex input[], float mu);
+
+protected:
+ std::vector<gr_fir_ccf *> filters;
+};
+
+
+#endif /* _GRI_MMSE_FIR_INTERPOLATOR_CC_H_ */
diff --git a/gnuradio-core/src/lib/filter/interpolator_taps.h b/gnuradio-core/src/lib/filter/interpolator_taps.h
new file mode 100644
index 000000000..76702b63f
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/interpolator_taps.h
@@ -0,0 +1,141 @@
+/*
+ * This file was machine generated by gen_interpolator_taps.
+ * DO NOT EDIT BY HAND.
+ */
+
+static const int NTAPS = 8;
+static const int NSTEPS = 128;
+
+static const float taps[NSTEPS+1][NTAPS] = {
+ // -4 -3 -2 -1 0 1 2 3 mu
+ { 0.00000e+00, 0.00000e+00, 0.00000e+00, 0.00000e+00, 1.00000e+00, 0.00000e+00, 0.00000e+00, 0.00000e+00 }, // 0/128
+ { -1.54700e-04, 8.53777e-04, -2.76968e-03, 7.89295e-03, 9.98534e-01, -5.41054e-03, 1.24642e-03, -1.98993e-04 }, // 1/128
+ { -3.09412e-04, 1.70888e-03, -5.55134e-03, 1.58840e-02, 9.96891e-01, -1.07209e-02, 2.47942e-03, -3.96391e-04 }, // 2/128
+ { -4.64053e-04, 2.56486e-03, -8.34364e-03, 2.39714e-02, 9.95074e-01, -1.59305e-02, 3.69852e-03, -5.92100e-04 }, // 3/128
+ { -6.18544e-04, 3.42130e-03, -1.11453e-02, 3.21531e-02, 9.93082e-01, -2.10389e-02, 4.90322e-03, -7.86031e-04 }, // 4/128
+ { -7.72802e-04, 4.27773e-03, -1.39548e-02, 4.04274e-02, 9.90917e-01, -2.60456e-02, 6.09305e-03, -9.78093e-04 }, // 5/128
+ { -9.26747e-04, 5.13372e-03, -1.67710e-02, 4.87921e-02, 9.88580e-01, -3.09503e-02, 7.26755e-03, -1.16820e-03 }, // 6/128
+ { -1.08030e-03, 5.98883e-03, -1.95925e-02, 5.72454e-02, 9.86071e-01, -3.57525e-02, 8.42626e-03, -1.35627e-03 }, // 7/128
+ { -1.23337e-03, 6.84261e-03, -2.24178e-02, 6.57852e-02, 9.83392e-01, -4.04519e-02, 9.56876e-03, -1.54221e-03 }, // 8/128
+ { -1.38589e-03, 7.69462e-03, -2.52457e-02, 7.44095e-02, 9.80543e-01, -4.50483e-02, 1.06946e-02, -1.72594e-03 }, // 9/128
+ { -1.53777e-03, 8.54441e-03, -2.80746e-02, 8.31162e-02, 9.77526e-01, -4.95412e-02, 1.18034e-02, -1.90738e-03 }, // 10/128
+ { -1.68894e-03, 9.39154e-03, -3.09033e-02, 9.19033e-02, 9.74342e-01, -5.39305e-02, 1.28947e-02, -2.08645e-03 }, // 11/128
+ { -1.83931e-03, 1.02356e-02, -3.37303e-02, 1.00769e-01, 9.70992e-01, -5.82159e-02, 1.39681e-02, -2.26307e-03 }, // 12/128
+ { -1.98880e-03, 1.10760e-02, -3.65541e-02, 1.09710e-01, 9.67477e-01, -6.23972e-02, 1.50233e-02, -2.43718e-03 }, // 13/128
+ { -2.13733e-03, 1.19125e-02, -3.93735e-02, 1.18725e-01, 9.63798e-01, -6.64743e-02, 1.60599e-02, -2.60868e-03 }, // 14/128
+ { -2.28483e-03, 1.27445e-02, -4.21869e-02, 1.27812e-01, 9.59958e-01, -7.04471e-02, 1.70776e-02, -2.77751e-03 }, // 15/128
+ { -2.43121e-03, 1.35716e-02, -4.49929e-02, 1.36968e-01, 9.55956e-01, -7.43154e-02, 1.80759e-02, -2.94361e-03 }, // 16/128
+ { -2.57640e-03, 1.43934e-02, -4.77900e-02, 1.46192e-01, 9.51795e-01, -7.80792e-02, 1.90545e-02, -3.10689e-03 }, // 17/128
+ { -2.72032e-03, 1.52095e-02, -5.05770e-02, 1.55480e-01, 9.47477e-01, -8.17385e-02, 2.00132e-02, -3.26730e-03 }, // 18/128
+ { -2.86289e-03, 1.60193e-02, -5.33522e-02, 1.64831e-01, 9.43001e-01, -8.52933e-02, 2.09516e-02, -3.42477e-03 }, // 19/128
+ { -3.00403e-03, 1.68225e-02, -5.61142e-02, 1.74242e-01, 9.38371e-01, -8.87435e-02, 2.18695e-02, -3.57923e-03 }, // 20/128
+ { -3.14367e-03, 1.76185e-02, -5.88617e-02, 1.83711e-01, 9.33586e-01, -9.20893e-02, 2.27664e-02, -3.73062e-03 }, // 21/128
+ { -3.28174e-03, 1.84071e-02, -6.15931e-02, 1.93236e-01, 9.28650e-01, -9.53307e-02, 2.36423e-02, -3.87888e-03 }, // 22/128
+ { -3.41815e-03, 1.91877e-02, -6.43069e-02, 2.02814e-01, 9.23564e-01, -9.84679e-02, 2.44967e-02, -4.02397e-03 }, // 23/128
+ { -3.55283e-03, 1.99599e-02, -6.70018e-02, 2.12443e-01, 9.18329e-01, -1.01501e-01, 2.53295e-02, -4.16581e-03 }, // 24/128
+ { -3.68570e-03, 2.07233e-02, -6.96762e-02, 2.22120e-01, 9.12947e-01, -1.04430e-01, 2.61404e-02, -4.30435e-03 }, // 25/128
+ { -3.81671e-03, 2.14774e-02, -7.23286e-02, 2.31843e-01, 9.07420e-01, -1.07256e-01, 2.69293e-02, -4.43955e-03 }, // 26/128
+ { -3.94576e-03, 2.22218e-02, -7.49577e-02, 2.41609e-01, 9.01749e-01, -1.09978e-01, 2.76957e-02, -4.57135e-03 }, // 27/128
+ { -4.07279e-03, 2.29562e-02, -7.75620e-02, 2.51417e-01, 8.95936e-01, -1.12597e-01, 2.84397e-02, -4.69970e-03 }, // 28/128
+ { -4.19774e-03, 2.36801e-02, -8.01399e-02, 2.61263e-01, 8.89984e-01, -1.15113e-01, 2.91609e-02, -4.82456e-03 }, // 29/128
+ { -4.32052e-03, 2.43930e-02, -8.26900e-02, 2.71144e-01, 8.83893e-01, -1.17526e-01, 2.98593e-02, -4.94589e-03 }, // 30/128
+ { -4.44107e-03, 2.50946e-02, -8.52109e-02, 2.81060e-01, 8.77666e-01, -1.19837e-01, 3.05345e-02, -5.06363e-03 }, // 31/128
+ { -4.55932e-03, 2.57844e-02, -8.77011e-02, 2.91006e-01, 8.71305e-01, -1.22047e-01, 3.11866e-02, -5.17776e-03 }, // 32/128
+ { -4.67520e-03, 2.64621e-02, -9.01591e-02, 3.00980e-01, 8.64812e-01, -1.24154e-01, 3.18153e-02, -5.28823e-03 }, // 33/128
+ { -4.78866e-03, 2.71272e-02, -9.25834e-02, 3.10980e-01, 8.58189e-01, -1.26161e-01, 3.24205e-02, -5.39500e-03 }, // 34/128
+ { -4.89961e-03, 2.77794e-02, -9.49727e-02, 3.21004e-01, 8.51437e-01, -1.28068e-01, 3.30021e-02, -5.49804e-03 }, // 35/128
+ { -5.00800e-03, 2.84182e-02, -9.73254e-02, 3.31048e-01, 8.44559e-01, -1.29874e-01, 3.35600e-02, -5.59731e-03 }, // 36/128
+ { -5.11376e-03, 2.90433e-02, -9.96402e-02, 3.41109e-01, 8.37557e-01, -1.31581e-01, 3.40940e-02, -5.69280e-03 }, // 37/128
+ { -5.21683e-03, 2.96543e-02, -1.01915e-01, 3.51186e-01, 8.30432e-01, -1.33189e-01, 3.46042e-02, -5.78446e-03 }, // 38/128
+ { -5.31716e-03, 3.02507e-02, -1.04150e-01, 3.61276e-01, 8.23188e-01, -1.34699e-01, 3.50903e-02, -5.87227e-03 }, // 39/128
+ { -5.41467e-03, 3.08323e-02, -1.06342e-01, 3.71376e-01, 8.15826e-01, -1.36111e-01, 3.55525e-02, -5.95620e-03 }, // 40/128
+ { -5.50931e-03, 3.13987e-02, -1.08490e-01, 3.81484e-01, 8.08348e-01, -1.37426e-01, 3.59905e-02, -6.03624e-03 }, // 41/128
+ { -5.60103e-03, 3.19495e-02, -1.10593e-01, 3.91596e-01, 8.00757e-01, -1.38644e-01, 3.64044e-02, -6.11236e-03 }, // 42/128
+ { -5.68976e-03, 3.24843e-02, -1.12650e-01, 4.01710e-01, 7.93055e-01, -1.39767e-01, 3.67941e-02, -6.18454e-03 }, // 43/128
+ { -5.77544e-03, 3.30027e-02, -1.14659e-01, 4.11823e-01, 7.85244e-01, -1.40794e-01, 3.71596e-02, -6.25277e-03 }, // 44/128
+ { -5.85804e-03, 3.35046e-02, -1.16618e-01, 4.21934e-01, 7.77327e-01, -1.41727e-01, 3.75010e-02, -6.31703e-03 }, // 45/128
+ { -5.93749e-03, 3.39894e-02, -1.18526e-01, 4.32038e-01, 7.69305e-01, -1.42566e-01, 3.78182e-02, -6.37730e-03 }, // 46/128
+ { -6.01374e-03, 3.44568e-02, -1.20382e-01, 4.42134e-01, 7.61181e-01, -1.43313e-01, 3.81111e-02, -6.43358e-03 }, // 47/128
+ { -6.08674e-03, 3.49066e-02, -1.22185e-01, 4.52218e-01, 7.52958e-01, -1.43968e-01, 3.83800e-02, -6.48585e-03 }, // 48/128
+ { -6.15644e-03, 3.53384e-02, -1.23933e-01, 4.62289e-01, 7.44637e-01, -1.44531e-01, 3.86247e-02, -6.53412e-03 }, // 49/128
+ { -6.22280e-03, 3.57519e-02, -1.25624e-01, 4.72342e-01, 7.36222e-01, -1.45004e-01, 3.88454e-02, -6.57836e-03 }, // 50/128
+ { -6.28577e-03, 3.61468e-02, -1.27258e-01, 4.82377e-01, 7.27714e-01, -1.45387e-01, 3.90420e-02, -6.61859e-03 }, // 51/128
+ { -6.34530e-03, 3.65227e-02, -1.28832e-01, 4.92389e-01, 7.19116e-01, -1.45682e-01, 3.92147e-02, -6.65479e-03 }, // 52/128
+ { -6.40135e-03, 3.68795e-02, -1.30347e-01, 5.02377e-01, 7.10431e-01, -1.45889e-01, 3.93636e-02, -6.68698e-03 }, // 53/128
+ { -6.45388e-03, 3.72167e-02, -1.31800e-01, 5.12337e-01, 7.01661e-01, -1.46009e-01, 3.94886e-02, -6.71514e-03 }, // 54/128
+ { -6.50285e-03, 3.75341e-02, -1.33190e-01, 5.22267e-01, 6.92808e-01, -1.46043e-01, 3.95900e-02, -6.73929e-03 }, // 55/128
+ { -6.54823e-03, 3.78315e-02, -1.34515e-01, 5.32164e-01, 6.83875e-01, -1.45993e-01, 3.96678e-02, -6.75943e-03 }, // 56/128
+ { -6.58996e-03, 3.81085e-02, -1.35775e-01, 5.42025e-01, 6.74865e-01, -1.45859e-01, 3.97222e-02, -6.77557e-03 }, // 57/128
+ { -6.62802e-03, 3.83650e-02, -1.36969e-01, 5.51849e-01, 6.65779e-01, -1.45641e-01, 3.97532e-02, -6.78771e-03 }, // 58/128
+ { -6.66238e-03, 3.86006e-02, -1.38094e-01, 5.61631e-01, 6.56621e-01, -1.45343e-01, 3.97610e-02, -6.79588e-03 }, // 59/128
+ { -6.69300e-03, 3.88151e-02, -1.39150e-01, 5.71370e-01, 6.47394e-01, -1.44963e-01, 3.97458e-02, -6.80007e-03 }, // 60/128
+ { -6.71985e-03, 3.90083e-02, -1.40136e-01, 5.81063e-01, 6.38099e-01, -1.44503e-01, 3.97077e-02, -6.80032e-03 }, // 61/128
+ { -6.74291e-03, 3.91800e-02, -1.41050e-01, 5.90706e-01, 6.28739e-01, -1.43965e-01, 3.96469e-02, -6.79662e-03 }, // 62/128
+ { -6.76214e-03, 3.93299e-02, -1.41891e-01, 6.00298e-01, 6.19318e-01, -1.43350e-01, 3.95635e-02, -6.78902e-03 }, // 63/128
+ { -6.77751e-03, 3.94578e-02, -1.42658e-01, 6.09836e-01, 6.09836e-01, -1.42658e-01, 3.94578e-02, -6.77751e-03 }, // 64/128
+ { -6.78902e-03, 3.95635e-02, -1.43350e-01, 6.19318e-01, 6.00298e-01, -1.41891e-01, 3.93299e-02, -6.76214e-03 }, // 65/128
+ { -6.79662e-03, 3.96469e-02, -1.43965e-01, 6.28739e-01, 5.90706e-01, -1.41050e-01, 3.91800e-02, -6.74291e-03 }, // 66/128
+ { -6.80032e-03, 3.97077e-02, -1.44503e-01, 6.38099e-01, 5.81063e-01, -1.40136e-01, 3.90083e-02, -6.71985e-03 }, // 67/128
+ { -6.80007e-03, 3.97458e-02, -1.44963e-01, 6.47394e-01, 5.71370e-01, -1.39150e-01, 3.88151e-02, -6.69300e-03 }, // 68/128
+ { -6.79588e-03, 3.97610e-02, -1.45343e-01, 6.56621e-01, 5.61631e-01, -1.38094e-01, 3.86006e-02, -6.66238e-03 }, // 69/128
+ { -6.78771e-03, 3.97532e-02, -1.45641e-01, 6.65779e-01, 5.51849e-01, -1.36969e-01, 3.83650e-02, -6.62802e-03 }, // 70/128
+ { -6.77557e-03, 3.97222e-02, -1.45859e-01, 6.74865e-01, 5.42025e-01, -1.35775e-01, 3.81085e-02, -6.58996e-03 }, // 71/128
+ { -6.75943e-03, 3.96678e-02, -1.45993e-01, 6.83875e-01, 5.32164e-01, -1.34515e-01, 3.78315e-02, -6.54823e-03 }, // 72/128
+ { -6.73929e-03, 3.95900e-02, -1.46043e-01, 6.92808e-01, 5.22267e-01, -1.33190e-01, 3.75341e-02, -6.50285e-03 }, // 73/128
+ { -6.71514e-03, 3.94886e-02, -1.46009e-01, 7.01661e-01, 5.12337e-01, -1.31800e-01, 3.72167e-02, -6.45388e-03 }, // 74/128
+ { -6.68698e-03, 3.93636e-02, -1.45889e-01, 7.10431e-01, 5.02377e-01, -1.30347e-01, 3.68795e-02, -6.40135e-03 }, // 75/128
+ { -6.65479e-03, 3.92147e-02, -1.45682e-01, 7.19116e-01, 4.92389e-01, -1.28832e-01, 3.65227e-02, -6.34530e-03 }, // 76/128
+ { -6.61859e-03, 3.90420e-02, -1.45387e-01, 7.27714e-01, 4.82377e-01, -1.27258e-01, 3.61468e-02, -6.28577e-03 }, // 77/128
+ { -6.57836e-03, 3.88454e-02, -1.45004e-01, 7.36222e-01, 4.72342e-01, -1.25624e-01, 3.57519e-02, -6.22280e-03 }, // 78/128
+ { -6.53412e-03, 3.86247e-02, -1.44531e-01, 7.44637e-01, 4.62289e-01, -1.23933e-01, 3.53384e-02, -6.15644e-03 }, // 79/128
+ { -6.48585e-03, 3.83800e-02, -1.43968e-01, 7.52958e-01, 4.52218e-01, -1.22185e-01, 3.49066e-02, -6.08674e-03 }, // 80/128
+ { -6.43358e-03, 3.81111e-02, -1.43313e-01, 7.61181e-01, 4.42134e-01, -1.20382e-01, 3.44568e-02, -6.01374e-03 }, // 81/128
+ { -6.37730e-03, 3.78182e-02, -1.42566e-01, 7.69305e-01, 4.32038e-01, -1.18526e-01, 3.39894e-02, -5.93749e-03 }, // 82/128
+ { -6.31703e-03, 3.75010e-02, -1.41727e-01, 7.77327e-01, 4.21934e-01, -1.16618e-01, 3.35046e-02, -5.85804e-03 }, // 83/128
+ { -6.25277e-03, 3.71596e-02, -1.40794e-01, 7.85244e-01, 4.11823e-01, -1.14659e-01, 3.30027e-02, -5.77544e-03 }, // 84/128
+ { -6.18454e-03, 3.67941e-02, -1.39767e-01, 7.93055e-01, 4.01710e-01, -1.12650e-01, 3.24843e-02, -5.68976e-03 }, // 85/128
+ { -6.11236e-03, 3.64044e-02, -1.38644e-01, 8.00757e-01, 3.91596e-01, -1.10593e-01, 3.19495e-02, -5.60103e-03 }, // 86/128
+ { -6.03624e-03, 3.59905e-02, -1.37426e-01, 8.08348e-01, 3.81484e-01, -1.08490e-01, 3.13987e-02, -5.50931e-03 }, // 87/128
+ { -5.95620e-03, 3.55525e-02, -1.36111e-01, 8.15826e-01, 3.71376e-01, -1.06342e-01, 3.08323e-02, -5.41467e-03 }, // 88/128
+ { -5.87227e-03, 3.50903e-02, -1.34699e-01, 8.23188e-01, 3.61276e-01, -1.04150e-01, 3.02507e-02, -5.31716e-03 }, // 89/128
+ { -5.78446e-03, 3.46042e-02, -1.33189e-01, 8.30432e-01, 3.51186e-01, -1.01915e-01, 2.96543e-02, -5.21683e-03 }, // 90/128
+ { -5.69280e-03, 3.40940e-02, -1.31581e-01, 8.37557e-01, 3.41109e-01, -9.96402e-02, 2.90433e-02, -5.11376e-03 }, // 91/128
+ { -5.59731e-03, 3.35600e-02, -1.29874e-01, 8.44559e-01, 3.31048e-01, -9.73254e-02, 2.84182e-02, -5.00800e-03 }, // 92/128
+ { -5.49804e-03, 3.30021e-02, -1.28068e-01, 8.51437e-01, 3.21004e-01, -9.49727e-02, 2.77794e-02, -4.89961e-03 }, // 93/128
+ { -5.39500e-03, 3.24205e-02, -1.26161e-01, 8.58189e-01, 3.10980e-01, -9.25834e-02, 2.71272e-02, -4.78866e-03 }, // 94/128
+ { -5.28823e-03, 3.18153e-02, -1.24154e-01, 8.64812e-01, 3.00980e-01, -9.01591e-02, 2.64621e-02, -4.67520e-03 }, // 95/128
+ { -5.17776e-03, 3.11866e-02, -1.22047e-01, 8.71305e-01, 2.91006e-01, -8.77011e-02, 2.57844e-02, -4.55932e-03 }, // 96/128
+ { -5.06363e-03, 3.05345e-02, -1.19837e-01, 8.77666e-01, 2.81060e-01, -8.52109e-02, 2.50946e-02, -4.44107e-03 }, // 97/128
+ { -4.94589e-03, 2.98593e-02, -1.17526e-01, 8.83893e-01, 2.71144e-01, -8.26900e-02, 2.43930e-02, -4.32052e-03 }, // 98/128
+ { -4.82456e-03, 2.91609e-02, -1.15113e-01, 8.89984e-01, 2.61263e-01, -8.01399e-02, 2.36801e-02, -4.19774e-03 }, // 99/128
+ { -4.69970e-03, 2.84397e-02, -1.12597e-01, 8.95936e-01, 2.51417e-01, -7.75620e-02, 2.29562e-02, -4.07279e-03 }, // 100/128
+ { -4.57135e-03, 2.76957e-02, -1.09978e-01, 9.01749e-01, 2.41609e-01, -7.49577e-02, 2.22218e-02, -3.94576e-03 }, // 101/128
+ { -4.43955e-03, 2.69293e-02, -1.07256e-01, 9.07420e-01, 2.31843e-01, -7.23286e-02, 2.14774e-02, -3.81671e-03 }, // 102/128
+ { -4.30435e-03, 2.61404e-02, -1.04430e-01, 9.12947e-01, 2.22120e-01, -6.96762e-02, 2.07233e-02, -3.68570e-03 }, // 103/128
+ { -4.16581e-03, 2.53295e-02, -1.01501e-01, 9.18329e-01, 2.12443e-01, -6.70018e-02, 1.99599e-02, -3.55283e-03 }, // 104/128
+ { -4.02397e-03, 2.44967e-02, -9.84679e-02, 9.23564e-01, 2.02814e-01, -6.43069e-02, 1.91877e-02, -3.41815e-03 }, // 105/128
+ { -3.87888e-03, 2.36423e-02, -9.53307e-02, 9.28650e-01, 1.93236e-01, -6.15931e-02, 1.84071e-02, -3.28174e-03 }, // 106/128
+ { -3.73062e-03, 2.27664e-02, -9.20893e-02, 9.33586e-01, 1.83711e-01, -5.88617e-02, 1.76185e-02, -3.14367e-03 }, // 107/128
+ { -3.57923e-03, 2.18695e-02, -8.87435e-02, 9.38371e-01, 1.74242e-01, -5.61142e-02, 1.68225e-02, -3.00403e-03 }, // 108/128
+ { -3.42477e-03, 2.09516e-02, -8.52933e-02, 9.43001e-01, 1.64831e-01, -5.33522e-02, 1.60193e-02, -2.86289e-03 }, // 109/128
+ { -3.26730e-03, 2.00132e-02, -8.17385e-02, 9.47477e-01, 1.55480e-01, -5.05770e-02, 1.52095e-02, -2.72032e-03 }, // 110/128
+ { -3.10689e-03, 1.90545e-02, -7.80792e-02, 9.51795e-01, 1.46192e-01, -4.77900e-02, 1.43934e-02, -2.57640e-03 }, // 111/128
+ { -2.94361e-03, 1.80759e-02, -7.43154e-02, 9.55956e-01, 1.36968e-01, -4.49929e-02, 1.35716e-02, -2.43121e-03 }, // 112/128
+ { -2.77751e-03, 1.70776e-02, -7.04471e-02, 9.59958e-01, 1.27812e-01, -4.21869e-02, 1.27445e-02, -2.28483e-03 }, // 113/128
+ { -2.60868e-03, 1.60599e-02, -6.64743e-02, 9.63798e-01, 1.18725e-01, -3.93735e-02, 1.19125e-02, -2.13733e-03 }, // 114/128
+ { -2.43718e-03, 1.50233e-02, -6.23972e-02, 9.67477e-01, 1.09710e-01, -3.65541e-02, 1.10760e-02, -1.98880e-03 }, // 115/128
+ { -2.26307e-03, 1.39681e-02, -5.82159e-02, 9.70992e-01, 1.00769e-01, -3.37303e-02, 1.02356e-02, -1.83931e-03 }, // 116/128
+ { -2.08645e-03, 1.28947e-02, -5.39305e-02, 9.74342e-01, 9.19033e-02, -3.09033e-02, 9.39154e-03, -1.68894e-03 }, // 117/128
+ { -1.90738e-03, 1.18034e-02, -4.95412e-02, 9.77526e-01, 8.31162e-02, -2.80746e-02, 8.54441e-03, -1.53777e-03 }, // 118/128
+ { -1.72594e-03, 1.06946e-02, -4.50483e-02, 9.80543e-01, 7.44095e-02, -2.52457e-02, 7.69462e-03, -1.38589e-03 }, // 119/128
+ { -1.54221e-03, 9.56876e-03, -4.04519e-02, 9.83392e-01, 6.57852e-02, -2.24178e-02, 6.84261e-03, -1.23337e-03 }, // 120/128
+ { -1.35627e-03, 8.42626e-03, -3.57525e-02, 9.86071e-01, 5.72454e-02, -1.95925e-02, 5.98883e-03, -1.08030e-03 }, // 121/128
+ { -1.16820e-03, 7.26755e-03, -3.09503e-02, 9.88580e-01, 4.87921e-02, -1.67710e-02, 5.13372e-03, -9.26747e-04 }, // 122/128
+ { -9.78093e-04, 6.09305e-03, -2.60456e-02, 9.90917e-01, 4.04274e-02, -1.39548e-02, 4.27773e-03, -7.72802e-04 }, // 123/128
+ { -7.86031e-04, 4.90322e-03, -2.10389e-02, 9.93082e-01, 3.21531e-02, -1.11453e-02, 3.42130e-03, -6.18544e-04 }, // 124/128
+ { -5.92100e-04, 3.69852e-03, -1.59305e-02, 9.95074e-01, 2.39714e-02, -8.34364e-03, 2.56486e-03, -4.64053e-04 }, // 125/128
+ { -3.96391e-04, 2.47942e-03, -1.07209e-02, 9.96891e-01, 1.58840e-02, -5.55134e-03, 1.70888e-03, -3.09412e-04 }, // 126/128
+ { -1.98993e-04, 1.24642e-03, -5.41054e-03, 9.98534e-01, 7.89295e-03, -2.76968e-03, 8.53777e-04, -1.54700e-04 }, // 127/128
+ { 0.00000e+00, 0.00000e+00, 0.00000e+00, 1.00000e+00, 0.00000e+00, 0.00000e+00, 0.00000e+00, 0.00000e+00 }, // 128/128
+};
+
diff --git a/gnuradio-core/src/lib/filter/qa_ccomplex_dotprod_x86.cc b/gnuradio-core/src/lib/filter/qa_ccomplex_dotprod_x86.cc
new file mode 100644
index 000000000..0d7b878da
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/qa_ccomplex_dotprod_x86.cc
@@ -0,0 +1,341 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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 <cppunit/TestAssert.h>
+#include <qa_ccomplex_dotprod_x86.h>
+#include <ccomplex_dotprod_x86.h>
+#include <string.h>
+#include <iostream>
+#include <malloc16.h>
+#include <sse_debug.h>
+#include <cmath>
+#include <gr_cpu.h>
+#include <random.h>
+
+using std::cerr;
+
+/// Macro for primitive value comparisons
+#define assertcomplexEqual(expected0,expected1,actual,delta) \
+ CPPUNIT_ASSERT_DOUBLES_EQUAL (expected0, actual[0], delta); \
+ CPPUNIT_ASSERT_DOUBLES_EQUAL (expected1, actual[1], delta);
+
+
+#define MAX_BLKS 10
+#define FLOATS_PER_BLK 4
+
+#define ERR_DELTA (1e-6)
+
+static float
+uniform ()
+{
+ return 2.0 * ((float) random () / RANDOM_MAX - 0.5); // uniformly (-1, 1)
+}
+
+static void
+random_floats (float *buf, unsigned n)
+{
+ for (unsigned i = 0; i < n; i++)
+ buf[i] = rint (uniform () * 32767);
+}
+
+static void
+zero_floats (float *buf, unsigned n)
+{
+ for (unsigned i = 0; i < n; i++)
+ buf[i] = 0.0;
+}
+
+void
+ref_ccomplex_dotprod (const float *input,
+ const float *taps, unsigned n_2_ccomplex_blocks,
+ float *result)
+{
+ float sum0[2] = {0,0};
+ float sum1[2] = {0,0};
+
+ do {
+
+ sum0[0] += input[0] * taps[0] - input[1] * taps[1];
+ sum0[1] += input[0] * taps[1] + input[1] * taps[0];
+ sum1[0] += input[2] * taps[2] - input[3] * taps[3];
+ sum1[1] += input[2] * taps[3] + input[3] * taps[2];
+
+ input += 4;
+ taps += 4;
+
+ } while (--n_2_ccomplex_blocks != 0);
+
+
+ result[0] = sum0[0] + sum1[0];
+ result[1] = sum0[1] + sum1[1];
+}
+
+void
+qa_ccomplex_dotprod_x86::setUp ()
+{
+ taps = (float *) calloc16Align (MAX_BLKS,
+ sizeof (float) * FLOATS_PER_BLK);
+
+ input = (float *) calloc16Align (MAX_BLKS,
+ sizeof (float) * FLOATS_PER_BLK);
+
+ if (taps == 0 || input == 0)
+ abort ();
+}
+
+void
+qa_ccomplex_dotprod_x86::tearDown ()
+{
+ free16Align (taps);
+ free16Align (input);
+ taps = 0;
+ input = 0;
+}
+
+
+void
+qa_ccomplex_dotprod_x86::zb () // "zero both"
+{
+ zero_floats (taps, MAX_BLKS * FLOATS_PER_BLK);
+ zero_floats (input, MAX_BLKS * FLOATS_PER_BLK);
+}
+
+//
+// t1
+//
+
+void
+qa_ccomplex_dotprod_x86::t1_base (ccomplex_dotprod_t ccomplex_dotprod)
+{
+ float result[2];
+
+ // cerr << "Testing dump_xmm_regs\n";
+ // dump_xmm_regs ();
+
+ // test basic cases, 1 block
+
+ zb ();
+ ccomplex_dotprod (input, taps, 1, result);
+ assertcomplexEqual (0.0, 0.0, result, ERR_DELTA);
+
+ // vary each input
+
+ zb ();
+ input[0] = 1.0; taps[0] = 1.0; taps[1] = -1.0;
+ ccomplex_dotprod (input, taps, 1, result);
+ //cerr << result[0] << " " << result[1] << "\n";
+ assertcomplexEqual (1.0, -1.0, result, ERR_DELTA);
+
+ zb ();
+ input[1] = 2.0; taps[0] = 1.0; taps[1] = -1.0;
+ ccomplex_dotprod (input, taps, 1, result);
+ assertcomplexEqual (2.0, 2.0, result, ERR_DELTA);
+
+ zb ();
+ input[2] = 3.0; taps[2] = 1.0; taps[3] = -1.0;
+ ccomplex_dotprod (input, taps, 1, result);
+ assertcomplexEqual (3.0, -3.0, result, ERR_DELTA);
+
+ zb ();
+ input[3] = 4.0; taps[2] = 1.0; taps[3] = -1.0;
+ ccomplex_dotprod (input, taps, 1, result);
+ assertcomplexEqual (4.0, 4.0, result, ERR_DELTA);
+
+ // vary each tap
+
+ zb ();
+ input[0] = 1.0; taps[0] = 0.5; taps[1] = -0.5;
+ ccomplex_dotprod (input, taps, 1, result);
+ assertcomplexEqual (0.5, -0.5, result, ERR_DELTA);
+
+ zb ();
+ input[0] = 1.0; taps[0] = 2.0; taps[1] = -2.0;
+ ccomplex_dotprod (input, taps, 1, result);
+ assertcomplexEqual (2.0, -2.0, result, ERR_DELTA);
+
+ zb ();
+ input[0] = 1.0; taps[0] = 3.0; taps[1] = -3.0;
+ ccomplex_dotprod (input, taps, 1, result);
+ assertcomplexEqual (3.0, -3.0, result, ERR_DELTA);
+
+ zb ();
+ input[0] = 1.0; taps[0] = 4.0; taps[1] = -4.0;
+ ccomplex_dotprod (input, taps, 1, result);
+ assertcomplexEqual (4.0, -4.0, result, ERR_DELTA);
+}
+
+//
+// t2
+//
+void
+qa_ccomplex_dotprod_x86::t2_base (ccomplex_dotprod_t ccomplex_dotprod)
+{
+ float result[2];
+
+ zb ();
+ input[0] = 1.0; input[1] = 3.0; taps[0] = 5.0; taps[1] = -2.0;
+
+ //1*5-3*-2 =11, 1*-2+3*5=13
+
+ ccomplex_dotprod (input, taps, 1, result);
+ assertcomplexEqual (11.0, 13.0, result, ERR_DELTA);
+
+ //7*5-13*-5 =100, 7*-5+13*5=30
+
+ input[2] = 7.0; input[3] = 13.0; taps[2] = 5.0; taps[3] = -5.0;
+
+ ccomplex_dotprod (input, taps, 1, result);
+ assertcomplexEqual (111.0, 43.0, result, ERR_DELTA);
+
+ input[4] = 19; input[5] = -19; taps[4] = 23.0; taps[5] = -23.0;
+
+ //19*23--19*-23 =0, 19*-23+-19*23=-874
+
+ ccomplex_dotprod (input, taps, 2, result);
+ assertcomplexEqual (111.0, -831.0, result, ERR_DELTA);
+
+}
+
+//
+// t3
+//
+void
+qa_ccomplex_dotprod_x86::t3_base (ccomplex_dotprod_t ccomplex_dotprod)
+{
+ srandom (0); // we want reproducibility
+
+ for (unsigned int i = 0; i < 10; i++){
+ random_floats (input, MAX_BLKS * FLOATS_PER_BLK);
+ random_floats (taps, MAX_BLKS * FLOATS_PER_BLK);
+
+ // we use a sloppy error margin because on the x86 architecture,
+ // our reference implementation is using 80 bit floating point
+ // arithmetic, while the SSE version is using 32 bit float point
+ // arithmetic.
+
+ float ref[2];
+ ref_ccomplex_dotprod (input, taps, MAX_BLKS, ref);
+ float calc[2];
+ ccomplex_dotprod (input, taps, MAX_BLKS, calc);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL (ref[0],
+ calc[0],
+ fabs (ref[0]) * 1e-4);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL (ref[1],
+ calc[1],
+ fabs (ref[1]) * 1e-4);
+ }
+}
+
+void
+qa_ccomplex_dotprod_x86::t1_3dnowext ()
+{
+ if (!gr_cpu::has_3dnowext ()){
+ cerr << "No 3DNow!Ext support; not tested\n";
+ }
+ else
+ t1_base (ccomplex_dotprod_3dnowext);
+}
+
+void
+qa_ccomplex_dotprod_x86::t2_3dnowext ()
+{
+ if (!gr_cpu::has_3dnowext ()){
+ cerr << "No 3DNow!Ext support; not tested\n";
+ }
+ else
+ t2_base (ccomplex_dotprod_3dnowext);
+}
+
+void
+qa_ccomplex_dotprod_x86::t3_3dnowext ()
+{
+ if (!gr_cpu::has_3dnowext ()){
+ cerr << "No 3DNow!Ext support; not tested\n";
+ }
+ else
+ t3_base (ccomplex_dotprod_3dnowext);
+}
+
+void
+qa_ccomplex_dotprod_x86::t1_3dnow ()
+{
+ if (!gr_cpu::has_3dnow ()){
+ cerr << "No 3DNow! support; not tested\n";
+ }
+ else
+ t1_base (ccomplex_dotprod_3dnow);
+}
+
+void
+qa_ccomplex_dotprod_x86::t2_3dnow ()
+{
+ if (!gr_cpu::has_3dnow ()){
+ cerr << "No 3DNow! support; not tested\n";
+ }
+ else
+ t2_base (ccomplex_dotprod_3dnow);
+}
+
+void
+qa_ccomplex_dotprod_x86::t3_3dnow ()
+{
+ if (!gr_cpu::has_3dnow ()){
+ cerr << "No 3DNow! support; not tested\n";
+ }
+ else
+ t3_base (ccomplex_dotprod_3dnow);
+}
+
+void
+qa_ccomplex_dotprod_x86::t1_sse ()
+{
+ if (!gr_cpu::has_sse ()){
+ cerr << "No SSE support; not tested\n";
+ }
+ else
+ t1_base (ccomplex_dotprod_sse);
+}
+
+void
+qa_ccomplex_dotprod_x86::t2_sse ()
+{
+ if (!gr_cpu::has_sse ()){
+ cerr << "No SSE support; not tested\n";
+ }
+ else
+ t2_base (ccomplex_dotprod_sse);
+}
+
+void
+qa_ccomplex_dotprod_x86::t3_sse ()
+{
+ if (!gr_cpu::has_sse ()){
+ cerr << "No SSE support; not tested\n";
+ }
+ else
+ t3_base (ccomplex_dotprod_sse);
+}
+
diff --git a/gnuradio-core/src/lib/filter/qa_ccomplex_dotprod_x86.h b/gnuradio-core/src/lib/filter/qa_ccomplex_dotprod_x86.h
new file mode 100644
index 000000000..d24561c72
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/qa_ccomplex_dotprod_x86.h
@@ -0,0 +1,74 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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 _QA_CCOMPLEX_DOTPROD_X86_H_
+#define _QA_CCOMPLEX_DOTPROD_X86_H_
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/TestCase.h>
+
+class qa_ccomplex_dotprod_x86 : public CppUnit::TestCase {
+ public:
+ void setUp ();
+ void tearDown ();
+
+ CPPUNIT_TEST_SUITE (qa_ccomplex_dotprod_x86);
+ CPPUNIT_TEST (t1_3dnowext);
+ CPPUNIT_TEST (t2_3dnowext);
+ CPPUNIT_TEST (t3_3dnowext);
+ CPPUNIT_TEST (t1_3dnow);
+ CPPUNIT_TEST (t2_3dnow);
+ CPPUNIT_TEST (t3_3dnow);
+ CPPUNIT_TEST (t1_sse);
+ CPPUNIT_TEST (t2_sse);
+ CPPUNIT_TEST (t3_sse);
+ CPPUNIT_TEST_SUITE_END ();
+
+ private:
+
+ void t1_3dnowext ();
+ void t2_3dnowext ();
+ void t3_3dnowext ();
+ void t1_3dnow ();
+ void t2_3dnow ();
+ void t3_3dnow ();
+ void t1_sse ();
+ void t2_sse ();
+ void t3_sse ();
+
+
+ typedef void (*ccomplex_dotprod_t)(const float *input,
+ const float *taps,
+ unsigned n_2_ccomplex_blocks,
+ float *result);
+
+ void t1_base (ccomplex_dotprod_t);
+ void t2_base (ccomplex_dotprod_t);
+ void t3_base (ccomplex_dotprod_t);
+
+ void zb ();
+
+ float *taps; // 16-byte aligned
+ float *input; // 16-byte aligned
+};
+
+
+#endif /* _QA_CCOMPLEX_DOTPROD_X86_H_ */
diff --git a/gnuradio-core/src/lib/filter/qa_complex_dotprod_x86.cc b/gnuradio-core/src/lib/filter/qa_complex_dotprod_x86.cc
new file mode 100644
index 000000000..a21b95f63
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/qa_complex_dotprod_x86.cc
@@ -0,0 +1,347 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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 <cppunit/TestAssert.h>
+#include <qa_complex_dotprod_x86.h>
+#include <complex_dotprod_x86.h>
+#include <string.h>
+#include <iostream>
+#include <malloc16.h>
+#include <sse_debug.h>
+#include <cmath>
+#include <gr_cpu.h>
+#include <random.h>
+
+using std::cerr;
+
+/// Macro for primitive value comparisons
+#define assertcomplexEqual(expected0,expected1,actual,delta) \
+ CPPUNIT_ASSERT_DOUBLES_EQUAL (expected0, actual[0], delta); \
+ CPPUNIT_ASSERT_DOUBLES_EQUAL (expected1, actual[1], delta);
+
+
+#define MAX_BLKS 10
+#define FLOATS_PER_BLK 4
+#define SHORTS_PER_BLK 2
+
+#define ERR_DELTA (1e-6)
+
+static float
+uniform ()
+{
+ return 2.0 * ((float) random () / RANDOM_MAX - 0.5); // uniformly (-1, 1)
+}
+
+static void
+random_floats (float *buf, unsigned n)
+{
+ for (unsigned i = 0; i < n; i++)
+ buf[i] = rint (uniform () * 32767);
+}
+
+static void
+zero_floats (float *buf, unsigned n)
+{
+ for (unsigned i = 0; i < n; i++)
+ buf[i] = 0.0;
+}
+
+static void
+random_shorts (short *buf, unsigned n)
+{
+ for (unsigned i = 0; i < n; i++)
+ buf[i] = (short) rint (uniform () * 32767);
+}
+
+static void
+zero_shorts (short *buf, unsigned n)
+{
+ for (unsigned i = 0; i < n; i++)
+ buf[i] = 0;
+}
+
+void
+ref_complex_dotprod (const short *input,
+ const float *taps, unsigned n_2_complex_blocks,
+ float *result)
+{
+ float sum0[2] = {0,0};
+ float sum1[2] = {0,0};
+
+ do {
+
+ sum0[0] += input[0] * taps[0];
+ sum0[1] += input[0] * taps[1];
+ sum1[0] += input[1] * taps[2];
+ sum1[1] += input[1] * taps[3];
+
+ input += 2;
+ taps += 4;
+
+ } while (--n_2_complex_blocks != 0);
+
+
+ result[0] = sum0[0] + sum1[0];
+ result[1] = sum0[1] + sum1[1];
+}
+
+void
+qa_complex_dotprod_x86::setUp ()
+{
+ taps = (float *) calloc16Align (MAX_BLKS,
+ sizeof (float) * FLOATS_PER_BLK);
+
+ input = (short *) calloc16Align (MAX_BLKS,
+ sizeof (short) * SHORTS_PER_BLK);
+
+ if (taps == 0 || input == 0)
+ abort ();
+}
+
+void
+qa_complex_dotprod_x86::tearDown ()
+{
+ free16Align (taps);
+ free16Align (input);
+ taps = 0;
+ input = 0;
+}
+
+
+void
+qa_complex_dotprod_x86::zb () // "zero both"
+{
+ zero_floats (taps, MAX_BLKS * FLOATS_PER_BLK);
+ zero_shorts (input, MAX_BLKS * SHORTS_PER_BLK);
+}
+
+//
+// t1
+//
+
+void
+qa_complex_dotprod_x86::t1_base (complex_dotprod_t complex_dotprod)
+{
+ float result[2];
+
+ // cerr << "Testing dump_xmm_regs\n";
+ // dump_xmm_regs ();
+
+ // test basic cases, 1 block
+
+ zb ();
+ complex_dotprod (input, taps, 1, result);
+ assertcomplexEqual (0.0, 0.0, result, ERR_DELTA);
+
+ // vary each input
+
+ zb ();
+ input[0] = 1; taps[0] = 1.0; taps[1] = -1.0;
+ complex_dotprod (input, taps, 1, result);
+ //cerr << result[0] << " " << result[1] << "\n";
+ assertcomplexEqual (1.0, -1.0, result, ERR_DELTA);
+
+ zb ();
+ input[1] = 2; taps[2] = 1.0; taps[3] = -1.0;
+ complex_dotprod (input, taps, 1, result);
+ assertcomplexEqual (2.0, -2.0, result, ERR_DELTA);
+
+ zb ();
+ input[2] = 3; taps[4] = 1.0; taps[5] = -1.0;
+ complex_dotprod (input, taps, 2, result);
+ assertcomplexEqual (3.0, -3.0, result, ERR_DELTA);
+
+ zb ();
+ input[3] = 4; taps[6] = 1.0; taps[7] = -1.0;
+ complex_dotprod (input, taps, 2, result);
+ assertcomplexEqual (4.0, -4.0, result, ERR_DELTA);
+
+ // vary each tap
+
+ zb ();
+ input[0] = 1; taps[0] = 0.5; taps[1] = -0.5;
+ complex_dotprod (input, taps, 1, result);
+ assertcomplexEqual (0.5, -0.5, result, ERR_DELTA);
+
+ zb ();
+ input[0] = 1; taps[0] = 2.0; taps[1] = -2.0;
+ complex_dotprod (input, taps, 1, result);
+ assertcomplexEqual (2.0, -2.0, result, ERR_DELTA);
+
+ zb ();
+ input[0] = 1; taps[0] = 3.0; taps[1] = -3.0;
+ complex_dotprod (input, taps, 1, result);
+ assertcomplexEqual (3.0, -3.0, result, ERR_DELTA);
+
+ zb ();
+ input[0] = 1; taps[0] = 4.0; taps[1] = -4.0;
+ complex_dotprod (input, taps, 1, result);
+ assertcomplexEqual (4.0, -4.0, result, ERR_DELTA);
+}
+
+//
+// t2
+//
+void
+qa_complex_dotprod_x86::t2_base (complex_dotprod_t complex_dotprod)
+{
+ float result[2];
+
+ zb ();
+ input[0] = 1; taps[0] = 2.0; taps[1] = -2.0;
+ input[1] = 3; taps[2] = 5.0; taps[3] = -5.0;
+ input[2] = 7; taps[4] = 11.0; taps[5] = -11.0;
+ input[3] = 13; taps[6] = 17.0; taps[7] = -17.0;
+
+ complex_dotprod (input, taps, 2, result);
+ assertcomplexEqual (315.0, -315.0, result, ERR_DELTA);
+
+ input[4] = 19; taps[8] = 23.0; taps[9] = -23.0;
+ complex_dotprod (input, taps, 3, result);
+ assertcomplexEqual (752.0, -752.0, result, ERR_DELTA);
+
+}
+
+//
+// t3
+//
+void
+qa_complex_dotprod_x86::t3_base (complex_dotprod_t complex_dotprod)
+{
+ srandom (0); // we want reproducibility
+
+ for (unsigned int i = 0; i < 10; i++){
+ random_shorts (input, MAX_BLKS * SHORTS_PER_BLK);
+ random_floats (taps, MAX_BLKS * FLOATS_PER_BLK);
+
+ // we use a sloppy error margin because on the x86 architecture,
+ // our reference implementation is using 80 bit floating point
+ // arithmetic, while the SSE version is using 32 bit float point
+ // arithmetic.
+
+ float ref[2];
+ ref_complex_dotprod (input, taps, MAX_BLKS, ref);
+ float calc[2];
+ complex_dotprod (input, taps, MAX_BLKS, calc);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL (ref[0],
+ calc[0],
+ fabs (ref[0]) * 1e-4);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL (ref[1],
+ calc[1],
+ fabs (ref[1]) * 1e-4);
+ }
+}
+
+void
+qa_complex_dotprod_x86::t1_3dnowext ()
+{
+ if (!gr_cpu::has_3dnowext ()){
+ cerr << "No 3DNow!Ext support; not tested\n";
+ }
+ else
+ t1_base (complex_dotprod_3dnowext);
+}
+
+void
+qa_complex_dotprod_x86::t2_3dnowext ()
+{
+ if (!gr_cpu::has_3dnowext ()){
+ cerr << "No 3DNow!Ext support; not tested\n";
+ }
+ else
+ t2_base (complex_dotprod_3dnowext);
+}
+
+void
+qa_complex_dotprod_x86::t3_3dnowext ()
+{
+ if (!gr_cpu::has_3dnowext ()){
+ cerr << "No 3DNow!Ext support; not tested\n";
+ }
+ else
+ t3_base (complex_dotprod_3dnowext);
+}
+
+void
+qa_complex_dotprod_x86::t1_3dnow ()
+{
+ if (!gr_cpu::has_3dnow ()){
+ cerr << "No 3DNow! support; not tested\n";
+ }
+ else
+ t1_base (complex_dotprod_3dnow);
+}
+
+void
+qa_complex_dotprod_x86::t2_3dnow ()
+{
+ if (!gr_cpu::has_3dnow ()){
+ cerr << "No 3DNow! support; not tested\n";
+ }
+ else
+ t2_base (complex_dotprod_3dnow);
+}
+
+void
+qa_complex_dotprod_x86::t3_3dnow ()
+{
+ if (!gr_cpu::has_3dnow ()){
+ cerr << "No 3DNow! support; not tested\n";
+ }
+ else
+ t3_base (complex_dotprod_3dnow);
+}
+
+void
+qa_complex_dotprod_x86::t1_sse ()
+{
+ if (!gr_cpu::has_sse ()){
+ cerr << "No SSE support; not tested\n";
+ }
+ else
+ t1_base (complex_dotprod_sse);
+}
+
+void
+qa_complex_dotprod_x86::t2_sse ()
+{
+ if (!gr_cpu::has_sse ()){
+ cerr << "No SSE support; not tested\n";
+ }
+ else
+ t2_base (complex_dotprod_sse);
+}
+
+void
+qa_complex_dotprod_x86::t3_sse ()
+{
+ if (!gr_cpu::has_sse ()){
+ cerr << "No SSE support; not tested\n";
+ }
+ else
+ t3_base (complex_dotprod_sse);
+}
+
diff --git a/gnuradio-core/src/lib/filter/qa_complex_dotprod_x86.h b/gnuradio-core/src/lib/filter/qa_complex_dotprod_x86.h
new file mode 100644
index 000000000..9f9b46039
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/qa_complex_dotprod_x86.h
@@ -0,0 +1,74 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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 _QA_COMPLEX_DOTPROD_X86_H_
+#define _QA_COMPLEX_DOTPROD_X86_H_
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/TestCase.h>
+
+class qa_complex_dotprod_x86 : public CppUnit::TestCase {
+ public:
+ void setUp ();
+ void tearDown ();
+
+ CPPUNIT_TEST_SUITE (qa_complex_dotprod_x86);
+ CPPUNIT_TEST (t1_3dnowext);
+ CPPUNIT_TEST (t2_3dnowext);
+ CPPUNIT_TEST (t3_3dnowext);
+ CPPUNIT_TEST (t1_3dnow);
+ CPPUNIT_TEST (t2_3dnow);
+ CPPUNIT_TEST (t3_3dnow);
+ CPPUNIT_TEST (t1_sse);
+ CPPUNIT_TEST (t2_sse);
+ CPPUNIT_TEST (t3_sse);
+ CPPUNIT_TEST_SUITE_END ();
+
+ private:
+
+ void t1_3dnowext ();
+ void t2_3dnowext ();
+ void t3_3dnowext ();
+ void t1_3dnow ();
+ void t2_3dnow ();
+ void t3_3dnow ();
+ void t1_sse ();
+ void t2_sse ();
+ void t3_sse ();
+
+
+ typedef void (*complex_dotprod_t)(const short *input,
+ const float *taps,
+ unsigned n_2_complex_blocks,
+ float *result);
+
+ void t1_base (complex_dotprod_t);
+ void t2_base (complex_dotprod_t);
+ void t3_base (complex_dotprod_t);
+
+ void zb ();
+
+ float *taps; // 16-byte aligned
+ short *input; // 16-byte aligned
+};
+
+
+#endif /* _QA_COMPLEX_DOTPROD_X86_H_ */
diff --git a/gnuradio-core/src/lib/filter/qa_dotprod.h b/gnuradio-core/src/lib/filter/qa_dotprod.h
new file mode 100644
index 000000000..bd5ba8f3a
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/qa_dotprod.h
@@ -0,0 +1,30 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2003 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 _QA_DOTPROD_H_
+#define _QA_DOTPROD_H_
+
+#include <cppunit/TestSuite.h>
+
+CppUnit::TestSuite *qa_dotprod_suite ();
+
+#endif // _QA_DOTPROD_H_
+
diff --git a/gnuradio-core/src/lib/filter/qa_dotprod_armv7_a.cc b/gnuradio-core/src/lib/filter/qa_dotprod_armv7_a.cc
new file mode 100644
index 000000000..1e1ded7ea
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/qa_dotprod_armv7_a.cc
@@ -0,0 +1,32 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2003,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 "qa_dotprod.h"
+
+CppUnit::TestSuite *
+qa_dotprod_suite ()
+{
+ CppUnit::TestSuite *s = new CppUnit::TestSuite ("dotprod");
+
+ // empty test suite
+
+ return s;
+}
diff --git a/gnuradio-core/src/lib/filter/qa_dotprod_generic.cc b/gnuradio-core/src/lib/filter/qa_dotprod_generic.cc
new file mode 100644
index 000000000..2c49d1d28
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/qa_dotprod_generic.cc
@@ -0,0 +1,32 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2003 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 "qa_dotprod.h"
+
+CppUnit::TestSuite *
+qa_dotprod_suite ()
+{
+ CppUnit::TestSuite *s = new CppUnit::TestSuite ("dotprod");
+
+ // empty test suite
+
+ return s;
+}
diff --git a/gnuradio-core/src/lib/filter/qa_dotprod_powerpc.cc b/gnuradio-core/src/lib/filter/qa_dotprod_powerpc.cc
new file mode 100644
index 000000000..2c49d1d28
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/qa_dotprod_powerpc.cc
@@ -0,0 +1,32 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2003 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 "qa_dotprod.h"
+
+CppUnit::TestSuite *
+qa_dotprod_suite ()
+{
+ CppUnit::TestSuite *s = new CppUnit::TestSuite ("dotprod");
+
+ // empty test suite
+
+ return s;
+}
diff --git a/gnuradio-core/src/lib/filter/qa_dotprod_x86.cc b/gnuradio-core/src/lib/filter/qa_dotprod_x86.cc
new file mode 100644
index 000000000..ec5625f10
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/qa_dotprod_x86.cc
@@ -0,0 +1,37 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2003 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 "qa_dotprod.h"
+#include "qa_float_dotprod_x86.h"
+#include "qa_complex_dotprod_x86.h"
+#include "qa_ccomplex_dotprod_x86.h"
+
+CppUnit::TestSuite *
+qa_dotprod_suite ()
+{
+ CppUnit::TestSuite *s = new CppUnit::TestSuite ("dotprod");
+
+ s->addTest (qa_float_dotprod_x86::suite ());
+ s->addTest (qa_complex_dotprod_x86::suite ());
+ s->addTest (qa_ccomplex_dotprod_x86::suite ());
+
+ return s;
+}
diff --git a/gnuradio-core/src/lib/filter/qa_filter.cc b/gnuradio-core/src/lib/filter/qa_filter.cc
new file mode 100644
index 000000000..629635084
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/qa_filter.cc
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2002,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.
+ */
+
+/*
+ * This class gathers together all the test cases for the gr
+ * directory into a single test suite. As you create new test cases,
+ * add them here.
+ */
+
+#include <qa_filter.h>
+#include <qa_gr_fir_ccf.h>
+#include <qa_gr_fir_fff.h>
+#include <qa_gr_fir_ccc.h>
+#include <qa_gr_fir_fcc.h>
+#include <qa_gr_fir_scc.h>
+#include <qa_gr_firdes.h>
+#include <qa_dotprod.h>
+#include <qa_gri_mmse_fir_interpolator.h>
+#include <qa_gri_mmse_fir_interpolator_cc.h>
+#include <qa_gr_rotator.h>
+#include <qa_gri_fir_filter_with_buffer_ccf.h>
+#include <qa_gri_fir_filter_with_buffer_ccc.h>
+#include <qa_gri_fir_filter_with_buffer_fcc.h>
+#include <qa_gri_fir_filter_with_buffer_fff.h>
+#include <qa_gri_fir_filter_with_buffer_fsf.h>
+#include <qa_gri_fir_filter_with_buffer_scc.h>
+
+CppUnit::TestSuite *
+qa_filter::suite ()
+{
+ CppUnit::TestSuite *s = new CppUnit::TestSuite ("filter");
+
+ s->addTest (qa_dotprod_suite ());
+ s->addTest (qa_gr_fir_fff::suite ());
+ s->addTest (qa_gr_fir_ccc::suite ());
+ s->addTest (qa_gr_fir_fcc::suite ());
+ s->addTest (qa_gr_fir_scc::suite ());
+ s->addTest (qa_gr_fir_ccf::suite ());
+ s->addTest (qa_gri_mmse_fir_interpolator::suite ());
+ s->addTest (qa_gri_mmse_fir_interpolator_cc::suite ());
+ s->addTest (qa_gr_rotator::suite ());
+ s->addTest (qa_gri_fir_filter_with_buffer_ccf::suite ());
+ s->addTest (qa_gri_fir_filter_with_buffer_ccc::suite ());
+ s->addTest (qa_gri_fir_filter_with_buffer_fcc::suite ());
+ s->addTest (qa_gri_fir_filter_with_buffer_fff::suite ());
+ s->addTest (qa_gri_fir_filter_with_buffer_fsf::suite ());
+ s->addTest (qa_gri_fir_filter_with_buffer_scc::suite ());
+
+ return s;
+}
diff --git a/gnuradio-core/src/lib/filter/qa_filter.h b/gnuradio-core/src/lib/filter/qa_filter.h
new file mode 100644
index 000000000..740d05ce4
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/qa_filter.h
@@ -0,0 +1,38 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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 _QA_FILTER_H_
+#define _QA_FILTER_H_
+
+#include <gruel/attributes.h>
+#include <cppunit/TestSuite.h>
+
+//! collect all the tests for the gr directory
+
+class __GR_ATTR_EXPORT qa_filter {
+ public:
+ //! return suite of tests for all of gr directory
+ static CppUnit::TestSuite *suite ();
+};
+
+
+#endif /* _QA_FILTER_H_ */
diff --git a/gnuradio-core/src/lib/filter/qa_float_dotprod_x86.cc b/gnuradio-core/src/lib/filter/qa_float_dotprod_x86.cc
new file mode 100644
index 000000000..f8752d071
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/qa_float_dotprod_x86.cc
@@ -0,0 +1,270 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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 <cppunit/TestAssert.h>
+#include <qa_float_dotprod_x86.h>
+#include <float_dotprod_x86.h>
+#include <string.h>
+#include <iostream>
+#include <malloc16.h>
+#include <sse_debug.h>
+#include <cmath>
+#include <gr_cpu.h>
+#include <random.h>
+
+using std::cerr;
+
+
+#define MAX_BLKS 10
+#define FLOATS_PER_BLK 4
+
+#define ERR_DELTA (1e-6)
+
+
+static void
+random_floats (float *buf, unsigned n)
+{
+ for (unsigned i = 0; i < n; i++)
+ buf[i] = random () - RANDOM_MAX/2;
+}
+
+static void
+zero_floats (float *buf, unsigned n)
+{
+ for (unsigned i = 0; i < n; i++)
+ buf[i] = 0.0;
+}
+
+float
+ref_float_dotprod (const float *input,
+ const float *taps, unsigned n_4_float_blocks)
+{
+ float sum0 = 0;
+ float sum1 = 0;
+ float sum2 = 0;
+ float sum3 = 0;
+
+ do {
+
+ sum0 += input[0] * taps[0];
+ sum1 += input[1] * taps[1];
+ sum2 += input[2] * taps[2];
+ sum3 += input[3] * taps[3];
+
+ input += 4;
+ taps += 4;
+
+ } while (--n_4_float_blocks != 0);
+
+
+ return sum0 + sum1 + sum2 + sum3;
+}
+
+void
+qa_float_dotprod_x86::setUp ()
+{
+ taps = (float *) calloc16Align (MAX_BLKS,
+ sizeof (float) * FLOATS_PER_BLK);
+
+ input = (float *) calloc16Align (MAX_BLKS,
+ sizeof (float) * FLOATS_PER_BLK);
+
+ if (taps == 0 || input == 0)
+ abort ();
+}
+
+void
+qa_float_dotprod_x86::tearDown ()
+{
+ free16Align (taps);
+ free16Align (input);
+ taps = 0;
+ input = 0;
+}
+
+
+void
+qa_float_dotprod_x86::zb () // "zero both"
+{
+ zero_floats (taps, MAX_BLKS * FLOATS_PER_BLK);
+ zero_floats (input, MAX_BLKS * FLOATS_PER_BLK);
+}
+
+//
+// t1
+//
+
+void
+qa_float_dotprod_x86::t1_base (float_dotprod_t float_dotprod)
+{
+
+ // cerr << "Testing dump_xmm_regs\n";
+ // dump_xmm_regs ();
+
+ // test basic cases, 1 block
+
+ zb ();
+ CPPUNIT_ASSERT_DOUBLES_EQUAL (0.0, float_dotprod (input, taps, 1), ERR_DELTA);
+
+ // vary each input
+
+ zb ();
+ input[0] = 0.5; taps[0] = 1.0;
+ CPPUNIT_ASSERT_DOUBLES_EQUAL (0.5, float_dotprod (input, taps, 1), ERR_DELTA);
+
+ zb ();
+ input[1] = 2.0; taps[1] = 1.0;
+ CPPUNIT_ASSERT_DOUBLES_EQUAL (2.0, float_dotprod (input, taps, 1), ERR_DELTA);
+
+ zb ();
+ input[2] = 3.0; taps[2] = 1.0;
+ CPPUNIT_ASSERT_DOUBLES_EQUAL (3.0, float_dotprod (input, taps, 1), ERR_DELTA);
+
+ zb ();
+ input[3] = 4.0; taps[3] = 1.0;
+ CPPUNIT_ASSERT_DOUBLES_EQUAL (4.0, float_dotprod (input, taps, 1), ERR_DELTA);
+
+ // vary each tap
+
+ zb ();
+ input[0] = 1.0; taps[0] = 0.5;
+ CPPUNIT_ASSERT_DOUBLES_EQUAL (0.5, float_dotprod (input, taps, 1), ERR_DELTA);
+
+ zb ();
+ input[0] = 1.0; taps[0] = 2.0;
+ CPPUNIT_ASSERT_DOUBLES_EQUAL (2.0, float_dotprod (input, taps, 1), ERR_DELTA);
+
+ zb ();
+ input[0] = 1.0; taps[0] = 3.0;
+ CPPUNIT_ASSERT_DOUBLES_EQUAL (3.0, float_dotprod (input, taps, 1), ERR_DELTA);
+
+ zb ();
+ input[0] = 1.0; taps[0] = 4.0;
+ CPPUNIT_ASSERT_DOUBLES_EQUAL (4.0, float_dotprod (input, taps, 1), ERR_DELTA);
+}
+
+//
+// t2
+//
+void
+qa_float_dotprod_x86::t2_base (float_dotprod_t float_dotprod)
+{
+ zb ();
+ input[0] = 1.0; taps[0] = 2.0;
+ input[1] = 3.0; taps[1] = 5.0;
+ input[2] = 7.0; taps[2] = 11.0;
+ input[3] = 13.0; taps[3] = 17.0;
+
+ CPPUNIT_ASSERT_DOUBLES_EQUAL (315.0, float_dotprod (input, taps, 1), ERR_DELTA);
+
+ input[4] = 19.0; taps[4] = 23.0;
+ CPPUNIT_ASSERT_DOUBLES_EQUAL (752.0, float_dotprod (input, taps, 2), ERR_DELTA);
+
+}
+
+//
+// t3
+//
+void
+qa_float_dotprod_x86::t3_base (float_dotprod_t float_dotprod)
+{
+ srandom (0); // we want reproducibility
+
+ for (unsigned int i = 0; i < 10; i++){
+ random_floats (input, MAX_BLKS * FLOATS_PER_BLK);
+ random_floats (taps, MAX_BLKS * FLOATS_PER_BLK);
+
+ // we use a sloppy error margin because on the x86 architecture,
+ // our reference implementation is using 80 bit floating point
+ // arithmetic, while the SSE version is using 32 bit float point
+ // arithmetic.
+
+ float ref = ref_float_dotprod (input, taps, MAX_BLKS);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL (ref,
+ float_dotprod (input, taps, MAX_BLKS),
+ fabs (ref) * 1e-4);
+ }
+}
+
+void
+qa_float_dotprod_x86::t1_3dnow ()
+{
+ if (!gr_cpu::has_3dnow ()){
+ cerr << "No 3DNow! support; not tested\n";
+ }
+ else
+ t1_base (float_dotprod_3dnow);
+}
+
+void
+qa_float_dotprod_x86::t2_3dnow ()
+{
+ if (!gr_cpu::has_3dnow ()){
+ cerr << "No 3DNow! support; not tested\n";
+ }
+ else
+ t2_base (float_dotprod_3dnow);
+}
+
+void
+qa_float_dotprod_x86::t3_3dnow ()
+{
+ if (!gr_cpu::has_3dnow ()){
+ cerr << "No 3DNow! support; not tested\n";
+ }
+ else
+ t3_base (float_dotprod_3dnow);
+}
+
+void
+qa_float_dotprod_x86::t1_sse ()
+{
+ if (!gr_cpu::has_sse ()){
+ cerr << "No SSE support; not tested\n";
+ }
+ else
+ t1_base (float_dotprod_sse);
+}
+
+void
+qa_float_dotprod_x86::t2_sse ()
+{
+ if (!gr_cpu::has_sse ()){
+ cerr << "No SSE support; not tested\n";
+ }
+ else
+ t2_base (float_dotprod_sse);
+}
+
+void
+qa_float_dotprod_x86::t3_sse ()
+{
+ if (!gr_cpu::has_sse ()){
+ cerr << "No SSE support; not tested\n";
+ }
+ else
+ t3_base (float_dotprod_sse);
+}
diff --git a/gnuradio-core/src/lib/filter/qa_float_dotprod_x86.h b/gnuradio-core/src/lib/filter/qa_float_dotprod_x86.h
new file mode 100644
index 000000000..38d6104fa
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/qa_float_dotprod_x86.h
@@ -0,0 +1,69 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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 _QA_FLOAT_DOTPROD_X86_H_
+#define _QA_FLOAT_DOTPROD_X86_H_
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/TestCase.h>
+
+class qa_float_dotprod_x86 : public CppUnit::TestCase {
+ public:
+ void setUp ();
+ void tearDown ();
+
+ CPPUNIT_TEST_SUITE (qa_float_dotprod_x86);
+ CPPUNIT_TEST (t1_3dnow);
+ CPPUNIT_TEST (t2_3dnow);
+ CPPUNIT_TEST (t3_3dnow);
+ CPPUNIT_TEST (t1_sse);
+ CPPUNIT_TEST (t2_sse);
+ CPPUNIT_TEST (t3_sse);
+ CPPUNIT_TEST_SUITE_END ();
+
+ private:
+
+ void t1_3dnow ();
+ void t2_3dnow ();
+ void t3_3dnow ();
+ void t1_sse ();
+ void t2_sse ();
+ void t3_sse ();
+
+
+ typedef float (*float_dotprod_t)(const float *input,
+ const float *taps,
+ unsigned n_4_float_blocks);
+
+ void t1_base (float_dotprod_t);
+ void t2_base (float_dotprod_t);
+ void t3_base (float_dotprod_t);
+
+
+ void zb ();
+
+ float *taps; // 16-byte aligned
+ float *input; // 16-byte aligned
+
+};
+
+
+#endif /* _QA_FLOAT_DOTPROD_X86_H_ */
diff --git a/gnuradio-core/src/lib/filter/qa_gr_fir_ccc.cc b/gnuradio-core/src/lib/filter/qa_gr_fir_ccc.cc
new file mode 100644
index 000000000..7474b76e2
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/qa_gr_fir_ccc.cc
@@ -0,0 +1,184 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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.
+ */
+
+/*
+ * FIXME. This code is virtually identical to qa_gr_fir_?CC.cc
+ * Kludge up some kind of macro to handle the minor differences.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <gr_types.h>
+
+typedef gr_complex i_type;
+typedef gr_complex o_type;
+typedef gr_complex tap_type;
+typedef gr_complex acc_type;
+
+
+#include <qa_gr_fir_ccc.h>
+#include <gr_fir_ccc.h>
+#include <gr_fir_util.h>
+#include <string.h>
+#include <iostream>
+#include <cmath>
+#include <gr_types.h>
+#include <cppunit/TestAssert.h>
+#include <random.h>
+#include <malloc16.h>
+#include <string.h>
+
+using std::vector;
+
+#define ERR_DELTA (1e-5)
+
+#define NELEM(x) (sizeof (x) / sizeof (x[0]))
+
+//
+// typedef for something logically "pointer to constructor".
+// there may be a better way, please let me know...
+//
+typedef gr_fir_ccc* (*fir_maker_t)(const std::vector<tap_type> &taps);
+
+
+static float
+uniform ()
+{
+ return 2.0 * ((float) random () / RANDOM_MAX - 0.5); // uniformly (-1, 1)
+}
+
+static void
+random_input (i_type *buf, unsigned n)
+{
+ for (unsigned i = 0; i < n; i++)
+ buf[i] = (i_type) rint (uniform () * 32767);
+}
+
+static void
+random_complex (gr_complex *buf, unsigned n)
+{
+ for (unsigned i = 0; i < n; i++){
+ float re = rint (uniform () * 32767);
+ float im = rint (uniform () * 32767);
+ buf[i] = gr_complex (re, im);
+ }
+}
+
+static o_type
+ref_dotprod (const i_type input[], const tap_type taps[], int ntaps)
+{
+ acc_type sum = 0;
+ for (int i = 0; i < ntaps; i++)
+ sum += input[i] * taps[ntaps - i - 1];
+
+ return sum;
+}
+
+//
+// Test for ntaps in [0,9], and input lengths in [0,17].
+// This ensures that we are building the shifted taps correctly,
+// and exercises all corner cases on input alignment and length.
+//
+
+static void
+test_random_io (fir_maker_t maker)
+{
+ const int MAX_TAPS = 9;
+ const int OUTPUT_LEN = 17;
+ const int INPUT_LEN = MAX_TAPS + OUTPUT_LEN;
+
+ // Our SIMD ccc kernel requires that the complex input be 64-bit (8-byte) aligned.
+ // i_type input[INPUT_LEN];
+ i_type *input = (i_type *)malloc16Align(INPUT_LEN * sizeof(i_type));
+ o_type expected_output[OUTPUT_LEN];
+ o_type actual_output[OUTPUT_LEN];
+ tap_type taps[MAX_TAPS];
+
+
+ srandom (0); // we want reproducibility
+
+ for (int n = 0; n <= MAX_TAPS; n++){
+ for (int ol = 0; ol <= OUTPUT_LEN; ol++){
+
+ // cerr << "@@@ n:ol " << n << ":" << ol << endl;
+
+ // build random test case
+ random_input (input, INPUT_LEN);
+ random_complex (taps, MAX_TAPS);
+
+ // compute expected output values
+ for (int o = 0; o < ol; o++){
+ expected_output[o] = ref_dotprod (&input[o], taps, n);
+ }
+
+ // build filter
+
+ vector<tap_type> f1_taps (&taps[0], &taps[n]);
+ gr_fir_ccc *f1 = maker (f1_taps);
+
+ // zero the output, then do the filtering
+ memset (actual_output, 0, sizeof (actual_output));
+ f1->filterN (actual_output, input, ol);
+
+ // check results
+ //
+ // we use a sloppy error margin because on the x86 architecture,
+ // our reference implementation is using 80 bit floating point
+ // arithmetic, while the SSE version is using 32 bit float point
+ // arithmetic.
+
+ for (int o = 0; o < ol; o++){
+ CPPUNIT_ASSERT_COMPLEXES_EQUAL(expected_output[o],
+ actual_output[o],
+ abs (expected_output[o]) * ERR_DELTA);
+ }
+
+ delete f1;
+ }
+ }
+ free16Align(input);
+}
+
+static void
+for_each (void (*f)(fir_maker_t))
+{
+ std::vector<gr_fir_ccc_info> info;
+ gr_fir_util::get_gr_fir_ccc_info (&info); // get all known ccc implementations
+
+ for (std::vector<gr_fir_ccc_info>::iterator p = info.begin ();
+ p != info.end ();
+ ++p){
+
+ std::cerr << " [" << p->name << "]";
+ f (p->create);
+ }
+
+ std::cerr << std::endl;
+}
+
+void
+qa_gr_fir_ccc::t1 ()
+{
+ for_each (test_random_io);
+}
diff --git a/gnuradio-core/src/lib/filter/qa_gr_fir_ccc.h b/gnuradio-core/src/lib/filter/qa_gr_fir_ccc.h
new file mode 100644
index 000000000..0535e6652
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/qa_gr_fir_ccc.h
@@ -0,0 +1,40 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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 _QA_GR_FIR_CCC_H_
+#define _QA_GR_FIR_CCC_H_
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/TestCase.h>
+
+class qa_gr_fir_ccc : public CppUnit::TestCase {
+
+ CPPUNIT_TEST_SUITE (qa_gr_fir_ccc);
+ CPPUNIT_TEST (t1);
+ CPPUNIT_TEST_SUITE_END ();
+
+ private:
+ void t1 ();
+
+};
+
+
+#endif /* _QA_GR_FIR_CCC_H_ */
diff --git a/gnuradio-core/src/lib/filter/qa_gr_fir_ccf.cc b/gnuradio-core/src/lib/filter/qa_gr_fir_ccf.cc
new file mode 100644
index 000000000..84cb924ae
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/qa_gr_fir_ccf.cc
@@ -0,0 +1,184 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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.
+ */
+
+/*
+ * FIXME. This code is virtually identical to qa_gr_fir_?CC.cc
+ * Kludge up some kind of macro to handle the minor differences.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <gr_types.h>
+
+typedef gr_complex i_type;
+typedef gr_complex o_type;
+typedef float tap_type;
+typedef gr_complex acc_type;
+
+
+#include <qa_gr_fir_ccf.h>
+#include <gr_fir_ccf.h>
+#include <gr_fir_util.h>
+#include <string.h>
+#include <iostream>
+#include <cmath>
+#include <gr_types.h>
+#include <cppunit/TestAssert.h>
+#include <random.h>
+#include <malloc16.h>
+#include <string.h>
+
+using std::vector;
+
+#define ERR_DELTA (1e-5)
+
+#define NELEM(x) (sizeof (x) / sizeof (x[0]))
+
+//
+// typedef for something logically "pointer to constructor".
+// there may be a better way, please let me know...
+//
+typedef gr_fir_ccf* (*fir_maker_t)(const std::vector<tap_type> &taps);
+
+static float
+uniform ()
+{
+ return 2.0 * ((float) random () / RANDOM_MAX - 0.5); // uniformly (-1, 1)
+}
+
+static void
+random_floats (float *buf, unsigned n)
+{
+ for (unsigned i = 0; i < n; i++)
+ buf[i] = (float) rint (uniform () * 32767);
+}
+
+static void
+random_complex (gr_complex *buf, unsigned n)
+{
+ for (unsigned i = 0; i < n; i++){
+ float re = rint (uniform () * 32767);
+ float im = rint (uniform () * 32767);
+ buf[i] = gr_complex (re, im);
+ }
+}
+
+static o_type
+ref_dotprod (const i_type input[], const tap_type taps[], int ntaps)
+{
+ acc_type sum = 0;
+ for (int i = 0; i < ntaps; i++)
+ sum += input[i] * taps[ntaps - i - 1];
+
+ return sum;
+}
+
+//
+// Test for ntaps in [0,9], and input lengths in [0,17].
+// This ensures that we are building the shifted taps correctly,
+// and exercises all corner cases on input alignment and length.
+//
+
+static void
+test_random_io (fir_maker_t maker)
+{
+ const int MAX_TAPS = 9;
+ const int OUTPUT_LEN = 17;
+ const int INPUT_LEN = MAX_TAPS + OUTPUT_LEN;
+
+ // Our SIMD ccc kernel requires that the complex input be 64-bit (8-byte) aligned.
+ //i_type input[INPUT_LEN];
+ i_type *input = (i_type *)malloc16Align(INPUT_LEN * sizeof(i_type));
+ o_type expected_output[OUTPUT_LEN];
+ o_type actual_output[OUTPUT_LEN];
+ tap_type taps[MAX_TAPS];
+
+
+ srandom (0); // we want reproducibility
+
+ for (int n = 0; n <= MAX_TAPS; n++){
+ for (int ol = 0; ol <= OUTPUT_LEN; ol++){
+
+ // cerr << "@@@ n:ol " << n << ":" << ol << endl;
+
+ // build random test case
+ random_complex (input, INPUT_LEN);
+ random_floats (taps, MAX_TAPS);
+
+ // compute expected output values
+ for (int o = 0; o < ol; o++){
+ expected_output[o] = ref_dotprod (&input[o], taps, n);
+ }
+
+ // build filter
+
+ vector<tap_type> f1_taps (&taps[0], &taps[n]);
+ gr_fir_ccf *f1 = maker (f1_taps);
+
+ // zero the output, then do the filtering
+ memset (actual_output, 0, sizeof (actual_output));
+ f1->filterN (actual_output, input, ol);
+
+ // check results
+ //
+ // we use a sloppy error margin because on the x86 architecture,
+ // our reference implementation is using 80 bit floating point
+ // arithmetic, while the SSE version is using 32 bit float point
+ // arithmetic.
+
+ for (int o = 0; o < ol; o++){
+ CPPUNIT_ASSERT_COMPLEXES_EQUAL(expected_output[o], actual_output[o],
+ abs (expected_output[o]) * ERR_DELTA);
+ }
+
+ delete f1;
+ }
+ }
+ free16Align(input);
+}
+
+
+static void
+for_each (void (*f)(fir_maker_t))
+{
+ std::vector<gr_fir_ccf_info> info;
+ gr_fir_util::get_gr_fir_ccf_info (&info); // get all known ccf implementations
+
+ for (std::vector<gr_fir_ccf_info>::iterator p = info.begin ();
+ p != info.end ();
+ ++p){
+
+ std::cerr << " [" << p->name << "]";
+ f (p->create);
+ }
+
+ std::cerr << std::endl;
+}
+
+
+void
+qa_gr_fir_ccf::t1 ()
+{
+ for_each (test_random_io);
+}
diff --git a/gnuradio-core/src/lib/filter/qa_gr_fir_ccf.h b/gnuradio-core/src/lib/filter/qa_gr_fir_ccf.h
new file mode 100644
index 000000000..bda79cc2f
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/qa_gr_fir_ccf.h
@@ -0,0 +1,43 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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 _QA_GR_FIR_CCF_H_
+#define _QA_GR_FIR_CCF_H_
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/TestCase.h>
+
+class qa_gr_fir_ccf : public CppUnit::TestCase {
+
+ CPPUNIT_TEST_SUITE (qa_gr_fir_ccf);
+ CPPUNIT_TEST (t1);
+ CPPUNIT_TEST_SUITE_END ();
+
+ private:
+
+ void t1 ();
+ // void t2 ();
+ // void t3 ();
+
+};
+
+
+#endif /* _QA_GR_FIR_CCF_H_ */
diff --git a/gnuradio-core/src/lib/filter/qa_gr_fir_fcc.cc b/gnuradio-core/src/lib/filter/qa_gr_fir_fcc.cc
new file mode 100644
index 000000000..4c77a5e5c
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/qa_gr_fir_fcc.cc
@@ -0,0 +1,181 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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.
+ */
+
+/*
+ * FIXME. This code is virtually identical to qa_gr_fir_?CC.cc
+ * Kludge up some kind of macro to handle the minor differences.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <gr_types.h>
+
+typedef float i_type;
+typedef gr_complex o_type;
+typedef gr_complex tap_type;
+typedef gr_complex acc_type;
+
+
+#include <qa_gr_fir_fcc.h>
+#include <gr_fir_fcc.h>
+#include <gr_fir_util.h>
+#include <string.h>
+#include <iostream>
+#include <cmath>
+#include <gr_types.h>
+#include <cppunit/TestAssert.h>
+#include <random.h>
+#include <string.h>
+
+using std::vector;
+
+#define ERR_DELTA (1e-5)
+
+#define NELEM(x) (sizeof (x) / sizeof (x[0]))
+
+
+//
+// typedef for something logically "pointer to constructor".
+// there may be a better way, please let me know...
+//
+typedef gr_fir_fcc* (*fir_maker_t)(const std::vector<tap_type> &taps);
+
+
+static float
+uniform ()
+{
+ return 2.0 * ((float) random () / RANDOM_MAX - 0.5); // uniformly (-1, 1)
+}
+
+static void
+random_input (i_type *buf, unsigned n)
+{
+ for (unsigned i = 0; i < n; i++)
+ buf[i] = (i_type) rint (uniform () * 32767);
+}
+
+static void
+random_complex (gr_complex *buf, unsigned n)
+{
+ for (unsigned i = 0; i < n; i++){
+ float re = rint (uniform () * 32767);
+ float im = rint (uniform () * 32767);
+ buf[i] = gr_complex (re, im);
+ }
+}
+
+static o_type
+ref_dotprod (const i_type input[], const tap_type taps[], int ntaps)
+{
+ acc_type sum = 0;
+ for (int i = 0; i < ntaps; i++)
+ sum += input[i] * taps[ntaps - i - 1];
+
+ return sum;
+}
+
+//
+// Test for ntaps in [0,9], and input lengths in [0,17].
+// This ensures that we are building the shifted taps correctly,
+// and exercises all corner cases on input alignment and length.
+//
+
+static void
+test_random_io (fir_maker_t maker)
+{
+ const int MAX_TAPS = 9;
+ const int OUTPUT_LEN = 17;
+ const int INPUT_LEN = MAX_TAPS + OUTPUT_LEN;
+
+ i_type input[INPUT_LEN];
+ o_type expected_output[OUTPUT_LEN];
+ o_type actual_output[OUTPUT_LEN];
+ tap_type taps[MAX_TAPS];
+
+
+ srandom (0); // we want reproducibility
+
+ for (int n = 0; n <= MAX_TAPS; n++){
+ for (int ol = 0; ol <= OUTPUT_LEN; ol++){
+
+ // cerr << "@@@ n:ol " << n << ":" << ol << endl;
+
+ // build random test case
+ random_input (input, INPUT_LEN);
+ random_complex (taps, MAX_TAPS);
+
+ // compute expected output values
+ for (int o = 0; o < ol; o++){
+ expected_output[o] = ref_dotprod (&input[o], taps, n);
+ }
+
+ // build filter
+
+ vector<tap_type> f1_taps (&taps[0], &taps[n]);
+ gr_fir_fcc *f1 = maker (f1_taps);
+
+ // zero the output, then do the filtering
+ memset (actual_output, 0, sizeof (actual_output));
+ f1->filterN (actual_output, input, ol);
+
+ // check results
+ //
+ // we use a sloppy error margin because on the x86 architecture,
+ // our reference implementation is using 80 bit floating point
+ // arithmetic, while the SSE version is using 32 bit float point
+ // arithmetic.
+
+ for (int o = 0; o < ol; o++){
+ CPPUNIT_ASSERT_COMPLEXES_EQUAL(expected_output[o],
+ actual_output[o],
+ abs (expected_output[o]) * ERR_DELTA);
+ }
+
+ delete f1;
+ }
+ }
+}
+
+static void
+for_each (void (*f)(fir_maker_t))
+{
+ std::vector<gr_fir_fcc_info> info;
+ gr_fir_util::get_gr_fir_fcc_info (&info); // get all known fcc implementations
+
+ for (std::vector<gr_fir_fcc_info>::iterator p = info.begin ();
+ p != info.end ();
+ ++p){
+
+ std::cerr << " [" << p->name << "]";
+ f (p->create);
+ }
+
+ std::cerr << std::endl;
+}
+
+void
+qa_gr_fir_fcc::t1 ()
+{
+ for_each (test_random_io);
+}
diff --git a/gnuradio-core/src/lib/filter/qa_gr_fir_fcc.h b/gnuradio-core/src/lib/filter/qa_gr_fir_fcc.h
new file mode 100644
index 000000000..23706fd9c
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/qa_gr_fir_fcc.h
@@ -0,0 +1,40 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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 _QA_GR_FIR_FCC_H_
+#define _QA_GR_FIR_FCC_H_
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/TestCase.h>
+
+class qa_gr_fir_fcc : public CppUnit::TestCase {
+
+ CPPUNIT_TEST_SUITE (qa_gr_fir_fcc);
+ CPPUNIT_TEST (t1);
+ CPPUNIT_TEST_SUITE_END ();
+
+ private:
+
+ void t1 ();
+};
+
+
+#endif /* _QA_GR_FIR_FCC_H_ */
diff --git a/gnuradio-core/src/lib/filter/qa_gr_fir_fff.cc b/gnuradio-core/src/lib/filter/qa_gr_fir_fff.cc
new file mode 100644
index 000000000..80ed67465
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/qa_gr_fir_fff.cc
@@ -0,0 +1,226 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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 <qa_gr_fir_fff.h>
+#include <gr_fir_fff.h>
+#include <gr_fir_util.h>
+#include <string.h>
+#include <iostream>
+#include <cmath>
+#include <cppunit/TestAssert.h>
+#include <random.h>
+#include <string.h>
+
+using std::vector;
+
+typedef float i_type;
+typedef float o_type;
+typedef float tap_type;
+typedef float acc_type;
+
+#define ERR_DELTA (1e-6)
+
+#define NELEM(x) (sizeof (x) / sizeof (x[0]))
+
+
+//
+// typedef for something logically "pointer to constructor".
+// there may be a better way, please let me know...
+//
+typedef gr_fir_fff* (*fir_maker_t)(const std::vector<tap_type> &taps);
+
+
+// ----------------------------------------------------------------
+
+const static i_type input_1[] = {
+ 234, -4, 23, -56, 45, 98, -23, -7
+};
+
+const static tap_type taps_1a[] = {
+ -3
+};
+
+const static o_type expected_1a[] = {
+ -702, 12, -69, 168, -135, -294, 69, 21
+};
+
+const static tap_type taps_1b[] = {
+ -4, 5
+};
+
+const static o_type expected_1b[] = {
+ 1186, -112, 339, -460, -167, 582, -87
+};
+
+// ----------------------------------------------------------------
+
+static void
+test_known_io (fir_maker_t maker)
+{
+ vector<tap_type> t1a (&taps_1a[0], &taps_1a[NELEM (taps_1a)]);
+ vector<tap_type> t1b (&taps_1b[0], &taps_1b[NELEM (taps_1b)]);
+
+ gr_fir_fff *f1 = maker (t1a); // create filter
+ CPPUNIT_ASSERT_EQUAL ((unsigned) 1, f1->ntaps ()); // check ntaps
+
+ // check filter output
+ int n = NELEM (input_1) - f1->ntaps () + 1;
+ for (int i = 0; i < n; i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL (expected_1a[i], f1->filter (&input_1[i]), ERR_DELTA);
+
+ f1->set_taps (t1b); // set new taps
+ CPPUNIT_ASSERT_EQUAL ((unsigned) 2, f1->ntaps ()); // check ntaps
+
+ // check filter output
+ n = NELEM (input_1) - f1->ntaps () + 1;
+ for (int i = 0; i < n; i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL (expected_1b[i], f1->filter (&input_1[i]), ERR_DELTA);
+
+ // test filterN interface
+
+ o_type output[NELEM (expected_1b)];
+ memset (output, 0, sizeof (output));
+
+ f1->filterN (output, input_1, n);
+ for (int i = 0; i < n; i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL (expected_1b[i], output[i], ERR_DELTA);
+
+ delete f1;
+}
+
+//
+// Test for ntaps in [0,9], and input lengths in [0,17].
+// This ensures that we are building the shifted taps correctly,
+// and exercises all corner cases on input alignment and length.
+//
+
+static float
+uniform ()
+{
+ return 2.0 * ((float) random () / RANDOM_MAX - 0.5); // uniformly (-1, 1)
+}
+
+static void
+random_floats (float *buf, unsigned n)
+{
+ for (unsigned i = 0; i < n; i++)
+ buf[i] = rint (uniform () * 32768);
+}
+
+static o_type
+ref_dotprod (const i_type input[], const tap_type taps[], int ntaps)
+{
+ acc_type sum = 0;
+ for (int i = 0; i < ntaps; i++)
+ sum += input[i] * taps[ntaps - i - 1];
+
+ return sum;
+}
+
+static void
+test_random_io (fir_maker_t maker)
+{
+ const int MAX_TAPS = 32;
+ const int OUTPUT_LEN = 17;
+ const int INPUT_LEN = MAX_TAPS + OUTPUT_LEN;
+
+ i_type input[INPUT_LEN];
+ o_type expected_output[OUTPUT_LEN];
+ o_type actual_output[OUTPUT_LEN];
+ tap_type taps[MAX_TAPS];
+
+
+ srandom (0); // we want reproducibility
+
+ for (int n = 0; n <= MAX_TAPS; n++){
+ for (int ol = 0; ol <= OUTPUT_LEN; ol++){
+
+ // cerr << "@@@ n:ol " << n << ":" << ol << endl;
+
+ // build random test case
+ random_floats (input, INPUT_LEN);
+ random_floats (taps, MAX_TAPS);
+
+ // compute expected output values
+ for (int o = 0; o < ol; o++){
+ expected_output[o] = ref_dotprod (&input[o], taps, n);
+ }
+
+ // build filter
+
+ vector<tap_type> f1_taps (&taps[0], &taps[n]);
+ gr_fir_fff *f1 = maker (f1_taps);
+
+ // zero the output, then do the filtering
+ memset (actual_output, 0, sizeof (actual_output));
+ f1->filterN (actual_output, input, ol);
+
+ // check results
+ //
+ // we use a sloppy error margin because on the x86 architecture,
+ // our reference implementation is using 80 bit floating point
+ // arithmetic, while the SSE version is using 32 bit float point
+ // arithmetic.
+
+ for (int o = 0; o < ol; o++){
+ CPPUNIT_ASSERT_DOUBLES_EQUAL (expected_output[o], actual_output[o],
+ fabs (expected_output[o]) * 9e-3);
+ }
+
+ delete f1;
+ }
+ }
+}
+
+
+static void
+for_each (void (*f)(fir_maker_t))
+{
+ std::vector<gr_fir_fff_info> info;
+ gr_fir_util::get_gr_fir_fff_info (&info); // get all known fff implementations
+
+ for (std::vector<gr_fir_fff_info>::iterator p = info.begin ();
+ p != info.end ();
+ ++p){
+
+ std::cerr << " [" << p->name << "]";
+ f (p->create);
+ }
+
+ std::cerr << std::endl;
+}
+
+void
+qa_gr_fir_fff::t1 ()
+{
+ for_each (test_known_io);
+}
+
+void
+qa_gr_fir_fff::t2 ()
+{
+ for_each (test_random_io);
+}
diff --git a/gnuradio-core/src/lib/filter/qa_gr_fir_fff.h b/gnuradio-core/src/lib/filter/qa_gr_fir_fff.h
new file mode 100644
index 000000000..c89672896
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/qa_gr_fir_fff.h
@@ -0,0 +1,43 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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 _QA_GR_FIR_FFF_H_
+#define _QA_GR_FIR_FFF_H_
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/TestCase.h>
+
+class qa_gr_fir_fff : public CppUnit::TestCase {
+
+ CPPUNIT_TEST_SUITE (qa_gr_fir_fff);
+ CPPUNIT_TEST (t1);
+ CPPUNIT_TEST (t2);
+ CPPUNIT_TEST_SUITE_END ();
+
+ private:
+
+ void t1 ();
+ void t2 ();
+
+};
+
+
+#endif /* _QA_GR_FIR_FFF_H_ */
diff --git a/gnuradio-core/src/lib/filter/qa_gr_fir_scc.cc b/gnuradio-core/src/lib/filter/qa_gr_fir_scc.cc
new file mode 100644
index 000000000..3f4a7be2c
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/qa_gr_fir_scc.cc
@@ -0,0 +1,179 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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.
+ */
+
+/*
+ * FIXME. This code is virtually identical to qa_gr_fir_?CC.cc
+ * Kludge up some kind of macro to handle the minor differences.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <gr_types.h>
+
+typedef short i_type;
+typedef gr_complex o_type;
+typedef gr_complex tap_type;
+typedef gr_complex acc_type;
+
+
+#include <qa_gr_fir_scc.h>
+#include <gr_fir_scc.h>
+#include <gr_fir_util.h>
+#include <string.h>
+#include <iostream>
+#include <cmath>
+#include <gr_types.h>
+#include <cppunit/TestAssert.h>
+#include <random.h>
+
+using std::vector;
+
+#define ERR_DELTA (1e-5)
+
+#define NELEM(x) (sizeof (x) / sizeof (x[0]))
+
+//
+// typedef for something logically "pointer to constructor".
+// there may be a better way, please let me know...
+//
+typedef gr_fir_scc* (*fir_maker_t)(const std::vector<tap_type> &taps);
+
+
+static float
+uniform ()
+{
+ return 2.0 * ((float) random () / RANDOM_MAX - 0.5); // uniformly (-1, 1)
+}
+
+static void
+random_input (i_type *buf, unsigned n)
+{
+ for (unsigned i = 0; i < n; i++)
+ buf[i] = (i_type) rint (uniform () * 32767);
+}
+
+static void
+random_complex (gr_complex *buf, unsigned n)
+{
+ for (unsigned i = 0; i < n; i++){
+ float re = rint (uniform () * 32767);
+ float im = rint (uniform () * 32767);
+ buf[i] = gr_complex (re, im);
+ }
+}
+
+static o_type
+ref_dotprod (const i_type input[], const tap_type taps[], int ntaps)
+{
+ acc_type sum = 0;
+ for (int i = 0; i < ntaps; i++)
+ sum += (float) input[i] * taps[ntaps - i - 1];
+
+ return sum;
+}
+
+//
+// Test for ntaps in [0,9], and input lengths in [0,17].
+// This ensures that we are building the shifted taps correctly,
+// and exercises all corner cases on input alignment and length.
+//
+
+static void
+test_random_io (fir_maker_t maker)
+{
+ const int MAX_TAPS = 9;
+ const int OUTPUT_LEN = 17;
+ const int INPUT_LEN = MAX_TAPS + OUTPUT_LEN;
+
+ i_type input[INPUT_LEN];
+ o_type expected_output[OUTPUT_LEN];
+ o_type actual_output[OUTPUT_LEN];
+ tap_type taps[MAX_TAPS];
+
+
+ srandom (0); // we want reproducibility
+
+ for (int n = 0; n <= MAX_TAPS; n++){
+ for (int ol = 0; ol <= OUTPUT_LEN; ol++){
+
+ // cerr << "@@@ n:ol " << n << ":" << ol << endl;
+
+ // build random test case
+ random_input (input, INPUT_LEN);
+ random_complex (taps, MAX_TAPS);
+
+ // compute expected output values
+ for (int o = 0; o < ol; o++){
+ expected_output[o] = ref_dotprod (&input[o], taps, n);
+ }
+
+ // build filter
+
+ vector<tap_type> f1_taps (&taps[0], &taps[n]);
+ gr_fir_scc *f1 = maker (f1_taps);
+
+ // zero the output, then do the filtering
+ memset (actual_output, 0, sizeof (actual_output));
+ f1->filterN (actual_output, input, ol);
+
+ // check results
+ //
+ // we use a sloppy error margin because on the x86 architecture,
+ // our reference implementation is using 80 bit floating point
+ // arithmetic, while the SSE version is using 32 bit float point
+ // arithmetic.
+
+ for (int o = 0; o < ol; o++){
+ CPPUNIT_ASSERT_COMPLEXES_EQUAL(expected_output[o],
+ actual_output[o],
+ abs (expected_output[o]) * ERR_DELTA);
+ }
+
+ delete f1;
+ }
+ }
+}
+
+static void
+for_each (void (*f)(fir_maker_t))
+{
+ std::vector<gr_fir_scc_info> info;
+ gr_fir_util::get_gr_fir_scc_info (&info); // get all known scc implementations
+
+ for (std::vector<gr_fir_scc_info>::iterator p = info.begin ();
+ p != info.end ();
+ ++p){
+
+ std::cerr << " [" << p->name << "]";
+ f (p->create);
+ }
+
+ std::cerr << std::endl;
+}
+
+void
+qa_gr_fir_scc::t1 ()
+{
+ for_each (test_random_io);
+}
diff --git a/gnuradio-core/src/lib/filter/qa_gr_fir_scc.h b/gnuradio-core/src/lib/filter/qa_gr_fir_scc.h
new file mode 100644
index 000000000..4b5ffdae3
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/qa_gr_fir_scc.h
@@ -0,0 +1,40 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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 _QA_GR_FIR_SCC_H_
+#define _QA_GR_FIR_SCC_H_
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/TestCase.h>
+
+class qa_gr_fir_scc : public CppUnit::TestCase {
+
+ CPPUNIT_TEST_SUITE (qa_gr_fir_scc);
+ CPPUNIT_TEST (t1);
+ CPPUNIT_TEST_SUITE_END ();
+
+ private:
+ void t1 ();
+
+};
+
+
+#endif /* _QA_GR_FIR_SCC_H_ */
diff --git a/gnuradio-core/src/lib/filter/qa_gr_rotator.cc b/gnuradio-core/src/lib/filter/qa_gr_rotator.cc
new file mode 100644
index 000000000..b2885a12d
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/qa_gr_rotator.cc
@@ -0,0 +1,75 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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 <gruel/attributes.h>
+#include <cppunit/TestAssert.h>
+#include <qa_gr_rotator.h>
+#include <gr_rotator.h>
+#include <stdio.h>
+#include <cmath>
+#include <gr_expj.h>
+
+
+// error vector magnitude
+__GR_ATTR_UNUSED static float
+error_vector_mag(gr_complex a, gr_complex b)
+{
+ return abs(a-b);
+}
+
+void
+qa_gr_rotator::t1 ()
+{
+ static const unsigned int N = 100000;
+
+ gr_rotator r;
+
+ double phase_incr = 2*M_PI / 1003;
+ double phase = 0;
+
+ // Old code: We increment then return the rotated value, thus we need to start one tick back
+ // r.set_phase(gr_complex(1,0) * conj(gr_expj(phase_incr)));
+
+ r.set_phase(gr_complex(1,0));
+ r.set_phase_incr(gr_expj(phase_incr));
+
+ for (unsigned i = 0; i < N; i++){
+ gr_complex expected = gr_expj(phase);
+ gr_complex actual = r.rotate(gr_complex(1, 0));
+
+#if 0
+ float evm = error_vector_mag(expected, actual);
+ printf("[%6d] expected: (%8.6f, %8.6f) actual: (%8.6f, %8.6f) evm: %8.6f\n",
+ i, expected.real(), expected.imag(), actual.real(), actual.imag(), evm);
+#endif
+
+ CPPUNIT_ASSERT_COMPLEXES_EQUAL(expected, actual, 0.0001);
+
+ phase += phase_incr;
+ if (phase >= 2*M_PI)
+ phase -= 2*M_PI;
+ }
+}
diff --git a/gnuradio-core/src/lib/filter/qa_gr_rotator.h b/gnuradio-core/src/lib/filter/qa_gr_rotator.h
new file mode 100644
index 000000000..739b23f8c
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/qa_gr_rotator.h
@@ -0,0 +1,39 @@
+/* -*- 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.
+ */
+#ifndef _QA_GR_ROTATOR_H_
+#define _QA_GR_ROTATOR_H_
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/TestCase.h>
+
+class qa_gr_rotator : public CppUnit::TestCase {
+
+ CPPUNIT_TEST_SUITE (qa_gr_rotator);
+ CPPUNIT_TEST (t1);
+ CPPUNIT_TEST_SUITE_END ();
+
+ private:
+ void t1 ();
+
+};
+
+#endif /* _QA_GR_ROTATOR_H_ */
diff --git a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccc.cc b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccc.cc
new file mode 100644
index 000000000..cfdbc53eb
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccc.cc
@@ -0,0 +1,161 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <gr_types.h>
+#include <qa_gri_fir_filter_with_buffer_ccc.h>
+#include <gri_fir_filter_with_buffer_ccc.h>
+#include <string.h>
+#include <iostream>
+#include <cmath>
+#include <cppunit/TestAssert.h>
+#include <random.h>
+#include <malloc16.h>
+#include <string.h>
+
+typedef gr_complex i_type;
+typedef gr_complex o_type;
+typedef gr_complex tap_type;
+typedef gr_complex acc_type;
+
+using std::vector;
+
+#define MAX_DATA (32767)
+#define ERR_DELTA (1e-5)
+
+#define NELEM(x) (sizeof (x) / sizeof (x[0]))
+
+static float
+uniform ()
+{
+ return 2.0 * ((float) random () / RANDOM_MAX - 0.5); // uniformly (-1, 1)
+}
+
+static void
+random_complex (gr_complex *buf, unsigned n)
+{
+ for (unsigned i = 0; i < n; i++){
+ float re = rint (uniform () * MAX_DATA);
+ float im = rint (uniform () * MAX_DATA);
+ buf[i] = gr_complex (re, im);
+ }
+}
+
+static o_type
+ref_dotprod (const i_type input[], const tap_type taps[], int ntaps)
+{
+ acc_type sum = 0;
+ for (int i = 0; i < ntaps; i++) {
+ sum += input[i] * taps[i];
+ }
+
+ return sum;
+}
+
+void
+qa_gri_fir_filter_with_buffer_ccc::t1 ()
+{
+ test_decimate(1);
+}
+
+void
+qa_gri_fir_filter_with_buffer_ccc::t2 ()
+{
+ test_decimate(2);
+}
+
+void
+qa_gri_fir_filter_with_buffer_ccc::t3 ()
+{
+ test_decimate(5);
+}
+
+//
+// Test for ntaps in [0,9], and input lengths in [0,17].
+// This ensures that we are building the shifted taps correctly,
+// and exercises all corner cases on input alignment and length.
+//
+void
+qa_gri_fir_filter_with_buffer_ccc::test_decimate(unsigned int decimate)
+{
+ const int MAX_TAPS = 9;
+ const int OUTPUT_LEN = 17;
+ const int INPUT_LEN = MAX_TAPS + OUTPUT_LEN;
+
+ // Mem aligned buffer not really necessary, but why not?
+ i_type *input = (i_type *)malloc16Align(INPUT_LEN * sizeof(i_type));
+ i_type *dline = (i_type*)malloc16Align(INPUT_LEN * sizeof(i_type));
+ o_type expected_output[OUTPUT_LEN];
+ o_type actual_output[OUTPUT_LEN];
+ tap_type taps[MAX_TAPS];
+
+ srandom (0); // we want reproducibility
+ memset(dline, 0, INPUT_LEN*sizeof(i_type));
+
+ for (int n = 0; n <= MAX_TAPS; n++){
+ for (int ol = 0; ol <= OUTPUT_LEN; ol++){
+
+ // cerr << "@@@ n:ol " << n << ":" << ol << endl;
+
+ // build random test case
+ random_complex (input, INPUT_LEN);
+ random_complex (taps, MAX_TAPS);
+
+ // compute expected output values
+ memset(dline, 0, INPUT_LEN*sizeof(i_type));
+ for (int o = 0; o < (int)(ol/decimate); o++){
+ // use an actual delay line for this test
+ for(int dd = 0; dd < (int)decimate; dd++) {
+ for(int oo = INPUT_LEN-1; oo > 0; oo--)
+ dline[oo] = dline[oo-1];
+ dline[0] = input[decimate*o+dd];
+ }
+ expected_output[o] = ref_dotprod (dline, taps, n);
+ }
+
+ // build filter
+ vector<tap_type> f1_taps(&taps[0], &taps[n]);
+ gri_fir_filter_with_buffer_ccc *f1 = new gri_fir_filter_with_buffer_ccc(f1_taps);
+
+ // zero the output, then do the filtering
+ memset (actual_output, 0, sizeof (actual_output));
+ f1->filterNdec (actual_output, input, ol/decimate, decimate);
+
+ // check results
+ //
+ // we use a sloppy error margin because on the x86 architecture,
+ // our reference implementation is using 80 bit floating point
+ // arithmetic, while the SSE version is using 32 bit float point
+ // arithmetic.
+
+ for (int o = 0; o < (int)(ol/decimate); o++){
+ CPPUNIT_ASSERT_COMPLEXES_EQUAL(expected_output[o], actual_output[o],
+ sqrt((float)n)*0.25*MAX_DATA*MAX_DATA * ERR_DELTA);
+ }
+ delete f1;
+ }
+ }
+ free16Align(input);
+}
diff --git a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccc.h b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccc.h
new file mode 100644
index 000000000..c1f2df10c
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccc.h
@@ -0,0 +1,46 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+#ifndef _QA_GRI_FIR_FILTER_WITH_BUFFER_CCC_H_
+#define _QA_GRI_FIR_FILTER_WITH_BUFFER_CCC_H_
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/TestCase.h>
+
+class qa_gri_fir_filter_with_buffer_ccc : public CppUnit::TestCase {
+
+ CPPUNIT_TEST_SUITE (qa_gri_fir_filter_with_buffer_ccc);
+ CPPUNIT_TEST (t1);
+ CPPUNIT_TEST (t2);
+ CPPUNIT_TEST (t3);
+ CPPUNIT_TEST_SUITE_END ();
+
+ private:
+ void test_decimate(unsigned int decimate);
+
+ void t1 ();
+ void t2 ();
+ void t3 ();
+
+};
+
+
+#endif /* _QA_GR_FIR_FILTER_WITH_BUFFER_CCC_H_ */
diff --git a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccf.cc b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccf.cc
new file mode 100644
index 000000000..9a5be0351
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccf.cc
@@ -0,0 +1,167 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <gr_types.h>
+#include <qa_gri_fir_filter_with_buffer_ccf.h>
+#include <gri_fir_filter_with_buffer_ccf.h>
+#include <string.h>
+#include <iostream>
+#include <cmath>
+#include <cppunit/TestAssert.h>
+#include <random.h>
+#include <malloc16.h>
+#include <string.h>
+
+typedef gr_complex i_type;
+typedef gr_complex o_type;
+typedef float tap_type;
+typedef gr_complex acc_type;
+
+using std::vector;
+
+#define ERR_DELTA (1e-5)
+
+#define NELEM(x) (sizeof (x) / sizeof (x[0]))
+
+static float
+uniform ()
+{
+ return 2.0 * ((float) random () / RANDOM_MAX - 0.5); // uniformly (-1, 1)
+}
+
+static void
+random_floats (float *buf, unsigned n)
+{
+ for (unsigned i = 0; i < n; i++)
+ buf[i] = (float) rint (uniform () * 32767);
+}
+
+static void
+random_complex (gr_complex *buf, unsigned n)
+{
+ for (unsigned i = 0; i < n; i++){
+ float re = rint (uniform () * 32767);
+ float im = rint (uniform () * 32767);
+ buf[i] = gr_complex (re, im);
+ }
+}
+
+static o_type
+ref_dotprod (const i_type input[], const tap_type taps[], int ntaps)
+{
+ acc_type sum = 0;
+ for (int i = 0; i < ntaps; i++) {
+ sum += input[i] * taps[i];
+ }
+
+ return sum;
+}
+
+void
+qa_gri_fir_filter_with_buffer_ccf::t1 ()
+{
+ test_decimate(1);
+}
+
+void
+qa_gri_fir_filter_with_buffer_ccf::t2 ()
+{
+ test_decimate(2);
+}
+
+void
+qa_gri_fir_filter_with_buffer_ccf::t3 ()
+{
+ test_decimate(5);
+}
+
+//
+// Test for ntaps in [0,9], and input lengths in [0,17].
+// This ensures that we are building the shifted taps correctly,
+// and exercises all corner cases on input alignment and length.
+//
+void
+qa_gri_fir_filter_with_buffer_ccf::test_decimate (unsigned int decimate)
+{
+ const int MAX_TAPS = 9;
+ const int OUTPUT_LEN = 17;
+ const int INPUT_LEN = MAX_TAPS + OUTPUT_LEN;
+
+ // Mem aligned buffer not really necessary, but why not?
+ i_type *input = (i_type *)malloc16Align(INPUT_LEN * sizeof(i_type));
+ i_type *dline = (i_type*)malloc16Align(INPUT_LEN * sizeof(i_type));
+ o_type expected_output[OUTPUT_LEN];
+ o_type actual_output[OUTPUT_LEN];
+ tap_type taps[MAX_TAPS];
+
+ srandom (0); // we want reproducibility
+ memset(dline, 0, INPUT_LEN*sizeof(i_type));
+
+ for (int n = 0; n <= MAX_TAPS; n++){
+ for (int ol = 0; ol <= OUTPUT_LEN; ol++){
+
+ // cerr << "@@@ n:ol " << n << ":" << ol << endl;
+
+ // build random test case
+ random_complex (input, INPUT_LEN);
+ random_floats (taps, MAX_TAPS);
+
+ // compute expected output values
+ memset(dline, 0, INPUT_LEN*sizeof(i_type));
+ for (int o = 0; o < (int)(ol/decimate); o++){
+ // use an actual delay line for this test
+ for(int dd = 0; dd < (int)decimate; dd++) {
+ for(int oo = INPUT_LEN-1; oo > 0; oo--)
+ dline[oo] = dline[oo-1];
+ dline[0] = input[decimate*o+dd];
+ }
+ expected_output[o] = ref_dotprod (dline, taps, n);
+ }
+
+ // build filter
+ vector<tap_type> f1_taps(&taps[0], &taps[n]);
+ gri_fir_filter_with_buffer_ccf *f1 = new gri_fir_filter_with_buffer_ccf(f1_taps);
+
+ // zero the output, then do the filtering
+ memset (actual_output, 0, sizeof (actual_output));
+ f1->filterNdec (actual_output, input, ol/decimate, decimate);
+
+ // check results
+ //
+ // we use a sloppy error margin because on the x86 architecture,
+ // our reference implementation is using 80 bit floating point
+ // arithmetic, while the SSE version is using 32 bit float point
+ // arithmetic.
+
+ for (int o = 0; o < (int)(ol/decimate); o++){
+ CPPUNIT_ASSERT_COMPLEXES_EQUAL(expected_output[o], actual_output[o],
+ abs (expected_output[o]) * ERR_DELTA);
+ }
+ delete f1;
+ }
+ }
+ free16Align(input);
+}
diff --git a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccf.h b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccf.h
new file mode 100644
index 000000000..686bc8541
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccf.h
@@ -0,0 +1,46 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+#ifndef _QA_GRI_FIR_FILTER_WITH_BUFFER_CCF_H_
+#define _QA_GRI_FIR_FILTER_WITH_BUFFER_CCF_H_
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/TestCase.h>
+
+class qa_gri_fir_filter_with_buffer_ccf : public CppUnit::TestCase {
+
+ CPPUNIT_TEST_SUITE (qa_gri_fir_filter_with_buffer_ccf);
+ CPPUNIT_TEST (t1);
+ CPPUNIT_TEST (t2);
+ CPPUNIT_TEST (t3);
+ CPPUNIT_TEST_SUITE_END ();
+
+ private:
+ void test_decimate(unsigned int decimate);
+
+ void t1 ();
+ void t2 ();
+ void t3 ();
+
+};
+
+
+#endif /* _QA_GR_FIR_FILTER_WITH_BUFFER_CCF_H_ */
diff --git a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fcc.cc b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fcc.cc
new file mode 100644
index 000000000..583697165
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fcc.cc
@@ -0,0 +1,168 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <gr_types.h>
+#include <qa_gri_fir_filter_with_buffer_fcc.h>
+#include <gri_fir_filter_with_buffer_fcc.h>
+#include <string.h>
+#include <iostream>
+#include <cmath>
+#include <cppunit/TestAssert.h>
+#include <random.h>
+#include <malloc16.h>
+#include <string.h>
+
+typedef float i_type;
+typedef gr_complex o_type;
+typedef gr_complex tap_type;
+typedef gr_complex acc_type;
+
+using std::vector;
+
+#define ERR_DELTA (1e-5)
+
+#define NELEM(x) (sizeof (x) / sizeof (x[0]))
+
+static float
+uniform ()
+{
+ return 2.0 * ((float) random () / RANDOM_MAX - 0.5); // uniformly (-1, 1)
+}
+
+static void
+random_floats (float *buf, unsigned n)
+{
+ for (unsigned i = 0; i < n; i++)
+ buf[i] = (float) rint (uniform () * 32767);
+}
+
+static void
+random_complex (gr_complex *buf, unsigned n)
+{
+ for (unsigned i = 0; i < n; i++){
+ float re = rint (uniform () * 32767);
+ float im = rint (uniform () * 32767);
+ buf[i] = gr_complex (re, im);
+ }
+}
+
+static o_type
+ref_dotprod (const i_type input[], const tap_type taps[], int ntaps)
+{
+ acc_type sum = 0;
+ for (int i = 0; i < ntaps; i++) {
+ sum += input[i] * taps[i];
+ }
+
+ return sum;
+}
+
+void
+qa_gri_fir_filter_with_buffer_fcc::t1()
+{
+ test_decimate(1);
+}
+
+void
+qa_gri_fir_filter_with_buffer_fcc::t2()
+{
+ test_decimate(2);
+}
+
+void
+qa_gri_fir_filter_with_buffer_fcc::t3()
+{
+ test_decimate(5);
+}
+
+
+//
+// Test for ntaps in [0,9], and input lengths in [0,17].
+// This ensures that we are building the shifted taps correctly,
+// and exercises all corner cases on input alignment and length.
+//
+void
+qa_gri_fir_filter_with_buffer_fcc::test_decimate(unsigned int decimate)
+{
+ const int MAX_TAPS = 9;
+ const int OUTPUT_LEN = 17;
+ const int INPUT_LEN = MAX_TAPS + OUTPUT_LEN;
+
+ // Mem aligned buffer not really necessary, but why not?
+ i_type *input = (i_type *)malloc16Align(INPUT_LEN * sizeof(i_type));
+ i_type *dline = (i_type*)malloc16Align(INPUT_LEN * sizeof(i_type));
+ o_type expected_output[OUTPUT_LEN];
+ o_type actual_output[OUTPUT_LEN];
+ tap_type taps[MAX_TAPS];
+
+ srandom (0); // we want reproducibility
+ memset(dline, 0, INPUT_LEN*sizeof(i_type));
+
+ for (int n = 0; n <= MAX_TAPS; n++){
+ for (int ol = 0; ol <= OUTPUT_LEN; ol++){
+
+ // cerr << "@@@ n:ol " << n << ":" << ol << endl;
+
+ // build random test case
+ random_floats (input, INPUT_LEN);
+ random_complex (taps, MAX_TAPS);
+
+ // compute expected output values
+ memset(dline, 0, INPUT_LEN*sizeof(i_type));
+ for (int o = 0; o < (int)(ol/decimate); o++){
+ // use an actual delay line for this test
+ for(int dd = 0; dd < (int)decimate; dd++) {
+ for(int oo = INPUT_LEN-1; oo > 0; oo--)
+ dline[oo] = dline[oo-1];
+ dline[0] = input[decimate*o+dd];
+ }
+ expected_output[o] = ref_dotprod (dline, taps, n);
+ }
+
+ // build filter
+ vector<tap_type> f1_taps(&taps[0], &taps[n]);
+ gri_fir_filter_with_buffer_fcc *f1 = new gri_fir_filter_with_buffer_fcc(f1_taps);
+
+ // zero the output, then do the filtering
+ memset (actual_output, 0, sizeof (actual_output));
+ f1->filterNdec (actual_output, input, ol/decimate, decimate);
+
+ // check results
+ //
+ // we use a sloppy error margin because on the x86 architecture,
+ // our reference implementation is using 80 bit floating point
+ // arithmetic, while the SSE version is using 32 bit float point
+ // arithmetic.
+
+ for (int o = 0; o < (int)(ol/decimate); o++){
+ CPPUNIT_ASSERT_COMPLEXES_EQUAL(expected_output[o], actual_output[o],
+ abs (expected_output[o]) * ERR_DELTA);
+ }
+ delete f1;
+ }
+ }
+ free16Align(input);
+}
diff --git a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fcc.h b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fcc.h
new file mode 100644
index 000000000..64eed25d3
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fcc.h
@@ -0,0 +1,46 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+#ifndef _QA_GRI_FIR_FILTER_WITH_BUFFER_FCC_H_
+#define _QA_GRI_FIR_FILTER_WITH_BUFFER_FCC_H_
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/TestCase.h>
+
+class qa_gri_fir_filter_with_buffer_fcc : public CppUnit::TestCase {
+
+ CPPUNIT_TEST_SUITE (qa_gri_fir_filter_with_buffer_fcc);
+ CPPUNIT_TEST (t1);
+ CPPUNIT_TEST (t2);
+ CPPUNIT_TEST (t3);
+ CPPUNIT_TEST_SUITE_END ();
+
+ private:
+ void test_decimate(unsigned int decimate);
+
+ void t1 ();
+ void t2 ();
+ void t3 ();
+
+};
+
+
+#endif /* _QA_GR_FIR_FILTER_WITH_BUFFER_FCC_H_ */
diff --git a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fff.cc b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fff.cc
new file mode 100644
index 000000000..208ae01db
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fff.cc
@@ -0,0 +1,156 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <gr_types.h>
+#include <qa_gri_fir_filter_with_buffer_fff.h>
+#include <gri_fir_filter_with_buffer_fff.h>
+#include <string.h>
+#include <iostream>
+#include <cmath>
+#include <cppunit/TestAssert.h>
+#include <random.h>
+#include <malloc16.h>
+#include <string.h>
+
+typedef float i_type;
+typedef float o_type;
+typedef float tap_type;
+typedef float acc_type;
+
+using std::vector;
+
+#define ERR_DELTA (1e-5)
+
+#define NELEM(x) (sizeof (x) / sizeof (x[0]))
+
+static float
+uniform ()
+{
+ return 2.0 * ((float) random () / RANDOM_MAX - 0.5); // uniformly (-1, 1)
+}
+
+static void
+random_floats (float *buf, unsigned n)
+{
+ for (unsigned i = 0; i < n; i++)
+ buf[i] = (float) rint (uniform () * 32767);
+}
+
+static o_type
+ref_dotprod (const i_type input[], const tap_type taps[], int ntaps)
+{
+ acc_type sum = 0;
+ for (int i = 0; i < ntaps; i++) {
+ sum += input[i] * taps[i];
+ }
+ return sum;
+}
+
+void
+qa_gri_fir_filter_with_buffer_fff::t1 ()
+{
+ test_decimate(1);
+}
+
+void
+qa_gri_fir_filter_with_buffer_fff::t2 ()
+{
+ test_decimate(2);
+}
+
+void
+qa_gri_fir_filter_with_buffer_fff::t3 ()
+{
+ test_decimate(5);
+}
+
+//
+// Test for ntaps in [0,9], and input lengths in [0,17].
+// This ensures that we are building the shifted taps correctly,
+// and exercises all corner cases on input alignment and length.
+//
+void
+qa_gri_fir_filter_with_buffer_fff::test_decimate(unsigned int decimate)
+{
+ const int MAX_TAPS = 9;
+ const int OUTPUT_LEN = 17;
+ const int INPUT_LEN = MAX_TAPS + OUTPUT_LEN;
+
+ // Mem aligned buffer not really necessary, but why not?
+ i_type *input = (i_type *)malloc16Align(INPUT_LEN * sizeof(i_type));
+ i_type *dline = (i_type*)malloc16Align(INPUT_LEN * sizeof(i_type));
+ o_type expected_output[OUTPUT_LEN];
+ o_type actual_output[OUTPUT_LEN];
+ tap_type taps[MAX_TAPS];
+
+ srandom (0); // we want reproducibility
+ memset(dline, 0, INPUT_LEN*sizeof(i_type));
+
+ for (int n = 0; n <= MAX_TAPS; n++){
+ for (int ol = 0; ol <= OUTPUT_LEN; ol++){
+
+ // cerr << "@@@ n:ol " << n << ":" << ol << endl;
+
+ // build random test case
+ random_floats (input, INPUT_LEN);
+ random_floats (taps, MAX_TAPS);
+
+ // compute expected output values
+ memset(dline, 0, INPUT_LEN*sizeof(i_type));
+ for (int o = 0; o < (int)(ol/decimate); o++){
+ // use an actual delay line for this test
+ for(int dd = 0; dd < (int)decimate; dd++) {
+ for(int oo = INPUT_LEN-1; oo > 0; oo--)
+ dline[oo] = dline[oo-1];
+ dline[0] = input[decimate*o+dd];
+ }
+ expected_output[o] = ref_dotprod (dline, taps, n);
+ }
+
+ // build filter
+ vector<tap_type> f1_taps(&taps[0], &taps[n]);
+ gri_fir_filter_with_buffer_fff *f1 = new gri_fir_filter_with_buffer_fff(f1_taps);
+
+ // zero the output, then do the filtering
+ memset (actual_output, 0, sizeof (actual_output));
+ f1->filterNdec (actual_output, input, ol/decimate, decimate);
+
+ // check results
+ //
+ // we use a sloppy error margin because on the x86 architecture,
+ // our reference implementation is using 80 bit floating point
+ // arithmetic, while the SSE version is using 32 bit float point
+ // arithmetic.
+
+ for (int o = 0; o < (int)(ol/decimate); o++){
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(expected_output[o], actual_output[o],
+ fabsf (expected_output[o]) * ERR_DELTA);
+ }
+ delete f1;
+ }
+ }
+ free16Align(input);
+}
diff --git a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fff.h b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fff.h
new file mode 100644
index 000000000..d219ec72d
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fff.h
@@ -0,0 +1,46 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+#ifndef _QA_GRI_FIR_FILTER_WITH_BUFFER_FFF_H_
+#define _QA_GRI_FIR_FILTER_WITH_BUFFER_FFF_H_
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/TestCase.h>
+
+class qa_gri_fir_filter_with_buffer_fff : public CppUnit::TestCase {
+
+ CPPUNIT_TEST_SUITE (qa_gri_fir_filter_with_buffer_fff);
+ CPPUNIT_TEST (t1);
+ CPPUNIT_TEST (t2);
+ CPPUNIT_TEST (t3);
+ CPPUNIT_TEST_SUITE_END ();
+
+ private:
+ void test_decimate(unsigned int decimate);
+
+ void t1 ();
+ void t2 ();
+ void t3 ();
+
+};
+
+
+#endif /* _QA_GR_FIR_FILTER_WITH_BUFFER_FFF_H_ */
diff --git a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fsf.cc b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fsf.cc
new file mode 100644
index 000000000..e2b6fb04f
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fsf.cc
@@ -0,0 +1,147 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <gr_types.h>
+#include <qa_gri_fir_filter_with_buffer_fsf.h>
+#include <gri_fir_filter_with_buffer_fsf.h>
+#include <string.h>
+#include <iostream>
+#include <cmath>
+#include <cppunit/TestAssert.h>
+#include <random.h>
+#include <malloc16.h>
+#include <string.h>
+
+typedef float i_type;
+typedef short o_type;
+typedef float tap_type;
+typedef float acc_type;
+
+using std::vector;
+
+#define NELEM(x) (sizeof (x) / sizeof (x[0]))
+
+static float
+uniform ()
+{
+ return 2.0 * ((float) random () / RANDOM_MAX - 0.5); // uniformly (-1, 1)
+}
+
+static void
+random_floats (float *buf, unsigned n)
+{
+ for (unsigned i = 0; i < n; i++)
+ buf[i] = (float) rint (uniform () * 128);
+}
+
+static o_type
+ref_dotprod (const i_type input[], const tap_type taps[], int ntaps)
+{
+ acc_type sum = 0;
+ for (int i = 0; i < ntaps; i++) {
+ sum += input[i] * taps[i];
+ }
+ return (o_type)sum;
+}
+
+void
+qa_gri_fir_filter_with_buffer_fsf::t1 ()
+{
+ test_decimate(1);
+}
+
+void
+qa_gri_fir_filter_with_buffer_fsf::t2 ()
+{
+ test_decimate(2);
+}
+
+void
+qa_gri_fir_filter_with_buffer_fsf::t3 ()
+{
+ test_decimate(5);
+}
+
+//
+// Test for ntaps in [0,9], and input lengths in [0,17].
+// This ensures that we are building the shifted taps correctly,
+// and exercises all corner cases on input alignment and length.
+//
+void
+qa_gri_fir_filter_with_buffer_fsf::test_decimate (unsigned int decimate)
+{
+ const int MAX_TAPS = 9;
+ const int OUTPUT_LEN = 17;
+ const int INPUT_LEN = MAX_TAPS + OUTPUT_LEN;
+
+ // Mem aligned buffer not really necessary, but why not?
+ i_type *input = (i_type *)malloc16Align(INPUT_LEN * sizeof(i_type));
+ i_type *dline = (i_type*)malloc16Align(INPUT_LEN * sizeof(i_type));
+ o_type expected_output[OUTPUT_LEN];
+ o_type actual_output[OUTPUT_LEN];
+ tap_type taps[MAX_TAPS];
+
+ srandom (0); // we want reproducibility
+ memset(dline, 0, INPUT_LEN*sizeof(i_type));
+
+ for (int n = 0; n <= MAX_TAPS; n++){
+ for (int ol = 0; ol <= OUTPUT_LEN; ol++){
+
+ // cerr << "@@@ n:ol " << n << ":" << ol << endl;
+
+ // build random test case
+ random_floats (input, INPUT_LEN);
+ random_floats (taps, MAX_TAPS);
+
+ // compute expected output values
+ memset(dline, 0, INPUT_LEN*sizeof(i_type));
+ for (int o = 0; o < (int)(ol/decimate); o++){
+ // use an actual delay line for this test
+ for(int dd = 0; dd < (int)decimate; dd++) {
+ for(int oo = INPUT_LEN-1; oo > 0; oo--)
+ dline[oo] = dline[oo-1];
+ dline[0] = input[decimate*o+dd];
+ }
+ expected_output[o] = ref_dotprod (dline, taps, n);
+ }
+
+ // build filter
+ vector<tap_type> f1_taps(&taps[0], &taps[n]);
+ gri_fir_filter_with_buffer_fsf *f1 = new gri_fir_filter_with_buffer_fsf(f1_taps);
+
+ // zero the output, then do the filtering
+ memset (actual_output, 0, sizeof (actual_output));
+ f1->filterNdec (actual_output, input, ol/decimate, decimate);
+
+ // check results
+ for (int o = 0; o < (int)(ol/decimate); o++){
+ CPPUNIT_ASSERT_EQUAL(expected_output[o], actual_output[o]);
+ }
+ delete f1;
+ }
+ }
+ free16Align(input);
+}
diff --git a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fsf.h b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fsf.h
new file mode 100644
index 000000000..70030a072
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fsf.h
@@ -0,0 +1,46 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+#ifndef _QA_GRI_FIR_FILTER_WITH_BUFFER_FSF_H_
+#define _QA_GRI_FIR_FILTER_WITH_BUFFER_FSF_H_
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/TestCase.h>
+
+class qa_gri_fir_filter_with_buffer_fsf : public CppUnit::TestCase {
+
+ CPPUNIT_TEST_SUITE (qa_gri_fir_filter_with_buffer_fsf);
+ CPPUNIT_TEST (t1);
+ CPPUNIT_TEST (t2);
+ CPPUNIT_TEST (t3);
+ CPPUNIT_TEST_SUITE_END ();
+
+ private:
+ void test_decimate(unsigned int decimate);
+
+ void t1 ();
+ void t2 ();
+ void t3 ();
+
+};
+
+
+#endif /* _QA_GR_FIR_FILTER_WITH_BUFFER_FSF_H_ */
diff --git a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_scc.cc b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_scc.cc
new file mode 100644
index 000000000..15f8b1f95
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_scc.cc
@@ -0,0 +1,167 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <gr_types.h>
+#include <qa_gri_fir_filter_with_buffer_scc.h>
+#include <gri_fir_filter_with_buffer_scc.h>
+#include <string.h>
+#include <iostream>
+#include <cmath>
+#include <cppunit/TestAssert.h>
+#include <random.h>
+#include <malloc16.h>
+#include <string.h>
+
+typedef short i_type;
+typedef gr_complex o_type;
+typedef gr_complex tap_type;
+typedef gr_complex acc_type;
+
+using std::vector;
+
+#define ERR_DELTA (1e-5)
+
+#define NELEM(x) (sizeof (x) / sizeof (x[0]))
+
+static float
+uniform ()
+{
+ return 2.0 * ((float) random () / RANDOM_MAX - 0.5); // uniformly (-1, 1)
+}
+
+static void
+random_shorts (short *buf, unsigned n)
+{
+ for (unsigned i = 0; i < n; i++)
+ buf[i] = (short) rint (uniform () * 16384);
+}
+
+static void
+random_complex (gr_complex *buf, unsigned n)
+{
+ for (unsigned i = 0; i < n; i++){
+ float re = rint (uniform () * 32767);
+ float im = rint (uniform () * 32767);
+ buf[i] = gr_complex (re, im);
+ }
+}
+
+static o_type
+ref_dotprod (const i_type input[], const tap_type taps[], int ntaps)
+{
+ acc_type sum = 0;
+ for (int i = 0; i < ntaps; i++) {
+ sum += (float)input[i] * taps[i];
+ }
+
+ return sum;
+}
+
+void
+qa_gri_fir_filter_with_buffer_scc::t1 ()
+{
+ test_decimate(1);
+}
+
+void
+qa_gri_fir_filter_with_buffer_scc::t2 ()
+{
+ test_decimate(2);
+}
+
+void
+qa_gri_fir_filter_with_buffer_scc::t3 ()
+{
+ test_decimate(5);
+}
+
+//
+// Test for ntaps in [0,9], and input lengths in [0,17].
+// This ensures that we are building the shifted taps correctly,
+// and exercises all corner cases on input alignment and length.
+//
+void
+qa_gri_fir_filter_with_buffer_scc::test_decimate (unsigned int decimate)
+{
+ const int MAX_TAPS = 9;
+ const int OUTPUT_LEN = 17;
+ const int INPUT_LEN = MAX_TAPS + OUTPUT_LEN;
+
+ // Mem aligned buffer not really necessary, but why not?
+ i_type *input = (i_type *)malloc16Align(INPUT_LEN * sizeof(i_type));
+ i_type *dline = (i_type*)malloc16Align(INPUT_LEN * sizeof(i_type));
+ o_type expected_output[OUTPUT_LEN];
+ o_type actual_output[OUTPUT_LEN];
+ tap_type taps[MAX_TAPS];
+
+ srandom (0); // we want reproducibility
+ memset(dline, 0, INPUT_LEN*sizeof(i_type));
+
+ for (int n = 0; n <= MAX_TAPS; n++){
+ for (int ol = 0; ol <= OUTPUT_LEN; ol++){
+
+ // cerr << "@@@ n:ol " << n << ":" << ol << endl;
+
+ // build random test case
+ random_shorts (input, INPUT_LEN);
+ random_complex (taps, MAX_TAPS);
+
+ // compute expected output values
+ memset(dline, 0, INPUT_LEN*sizeof(i_type));
+ for (int o = 0; o < (int)(ol/decimate); o++){
+ // use an actual delay line for this test
+ for(int dd = 0; dd < (int)decimate; dd++) {
+ for(int oo = INPUT_LEN-1; oo > 0; oo--)
+ dline[oo] = dline[oo-1];
+ dline[0] = input[decimate*o+dd];
+ }
+ expected_output[o] = ref_dotprod (dline, taps, n);
+ }
+
+ // build filter
+ vector<tap_type> f1_taps(&taps[0], &taps[n]);
+ gri_fir_filter_with_buffer_scc *f1 = new gri_fir_filter_with_buffer_scc(f1_taps);
+
+ // zero the output, then do the filtering
+ memset (actual_output, 0, sizeof (actual_output));
+ f1->filterNdec (actual_output, input, ol/decimate, decimate);
+
+ // check results
+ //
+ // we use a sloppy error margin because on the x86 architecture,
+ // our reference implementation is using 80 bit floating point
+ // arithmetic, while the SSE version is using 32 bit float point
+ // arithmetic.
+
+ for (int o = 0; o < (int)(ol/decimate); o++){
+ CPPUNIT_ASSERT_COMPLEXES_EQUAL(expected_output[o], actual_output[o],
+ abs (expected_output[o]) * ERR_DELTA);
+ }
+ delete f1;
+ }
+ }
+ free16Align(input);
+}
diff --git a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_scc.h b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_scc.h
new file mode 100644
index 000000000..f80056189
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_scc.h
@@ -0,0 +1,46 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+#ifndef _QA_GRI_FIR_FILTER_WITH_BUFFER_SCC_H_
+#define _QA_GRI_FIR_FILTER_WITH_BUFFER_SCC_H_
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/TestCase.h>
+
+class qa_gri_fir_filter_with_buffer_scc : public CppUnit::TestCase {
+
+ CPPUNIT_TEST_SUITE (qa_gri_fir_filter_with_buffer_scc);
+ CPPUNIT_TEST (t1);
+ CPPUNIT_TEST (t2);
+ CPPUNIT_TEST (t3);
+ CPPUNIT_TEST_SUITE_END ();
+
+ private:
+ void test_decimate(unsigned int decimate);
+
+ void t1 ();
+ void t2 ();
+ void t3 ();
+
+};
+
+
+#endif /* _QA_GR_FIR_FILTER_WITH_BUFFER_SCC_H_ */
diff --git a/gnuradio-core/src/lib/filter/qa_gri_mmse_fir_interpolator.cc b/gnuradio-core/src/lib/filter/qa_gri_mmse_fir_interpolator.cc
new file mode 100644
index 000000000..7dca65b9a
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/qa_gri_mmse_fir_interpolator.cc
@@ -0,0 +1,66 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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 <cppunit/TestAssert.h>
+#include <qa_gri_mmse_fir_interpolator.h>
+#include <gri_mmse_fir_interpolator.h>
+#include <stdio.h>
+#include <cmath>
+
+#define NELEM(x) (sizeof (x) / sizeof (x[0]))
+
+
+static float
+test_fcn (double index)
+{
+ return (2 * sin (index * 0.25 * 2 * M_PI + 0.125 * M_PI)
+ + 3 * sin (index * 0.077 * 2 * M_PI + 0.3 * M_PI));
+}
+
+
+void
+qa_gri_mmse_fir_interpolator::t1 ()
+{
+ static const unsigned N = 100;
+ float input[N + 10];
+
+ for (unsigned i = 0; i < NELEM(input); i++)
+ input[i] = test_fcn ((double) i);
+
+ gri_mmse_fir_interpolator intr;
+ float inv_nsteps = 1.0 / intr.nsteps ();
+
+ for (unsigned i = 0; i < N; i++){
+ for (unsigned imu = 0; imu <= intr.nsteps (); imu += 1){
+ float expected = test_fcn ((i + 3) + imu * inv_nsteps);
+ float actual = intr.interpolate (&input[i], imu * inv_nsteps);
+
+ CPPUNIT_ASSERT_DOUBLES_EQUAL (expected, actual, 0.004);
+ // printf ("%9.6f %9.6f %9.6f\n", expected, actual, expected - actual);
+ }
+ }
+}
+
diff --git a/gnuradio-core/src/lib/filter/qa_gri_mmse_fir_interpolator.h b/gnuradio-core/src/lib/filter/qa_gri_mmse_fir_interpolator.h
new file mode 100644
index 000000000..3f4dec7c2
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/qa_gri_mmse_fir_interpolator.h
@@ -0,0 +1,40 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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 _QA_GRI_MMSE_FIR_INTERPOLATOR_H_
+#define _QA_GRI_MMSE_FIR_INTERPOLATOR_H_
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/TestCase.h>
+
+class qa_gri_mmse_fir_interpolator : public CppUnit::TestCase {
+
+ CPPUNIT_TEST_SUITE (qa_gri_mmse_fir_interpolator);
+ CPPUNIT_TEST (t1);
+ CPPUNIT_TEST_SUITE_END ();
+
+ private:
+ void t1 ();
+
+};
+
+
+#endif /* _QA_GRI_MMSE_FIR_INTERPOLATOR_H_ */
diff --git a/gnuradio-core/src/lib/filter/qa_gri_mmse_fir_interpolator_cc.cc b/gnuradio-core/src/lib/filter/qa_gri_mmse_fir_interpolator_cc.cc
new file mode 100644
index 000000000..1f70d7f42
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/qa_gri_mmse_fir_interpolator_cc.cc
@@ -0,0 +1,124 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <gruel/attributes.h>
+#include <cppunit/TestAssert.h>
+#include <qa_gri_mmse_fir_interpolator_cc.h>
+#include <gri_mmse_fir_interpolator_cc.h>
+#include <stdio.h>
+#include <cmath>
+#include <stdexcept>
+#include <unistd.h>
+
+#define NELEM(x) (sizeof (x) / sizeof (x[0]))
+
+
+static float
+test_fcn_sin(double index)
+{
+ return (2 * sin (index * 0.25 * 2 * M_PI + 0.125 * M_PI)
+ + 3 * sin (index * 0.077 * 2 * M_PI + 0.3 * M_PI));
+}
+
+static float
+test_fcn_cos(double index)
+{
+ return (2 * cos (index * 0.25 * 2 * M_PI + 0.125 * M_PI)
+ + 3 * cos (index * 0.077 * 2 * M_PI + 0.3 * M_PI));
+}
+
+static gr_complex
+test_fcn(double index)
+{
+ return gr_complex(test_fcn_cos(index), test_fcn_sin(index));
+}
+
+
+void
+qa_gri_mmse_fir_interpolator_cc::t1()
+{
+ static const unsigned N = 100;
+ __GR_ATTR_ALIGNED(8) gr_complex input[N + 10];
+
+ for (unsigned i = 0; i < NELEM(input); i++)
+ input[i] = test_fcn ((double) i);
+
+ gri_mmse_fir_interpolator_cc intr;
+ float inv_nsteps = 1.0 / intr.nsteps ();
+
+ for (unsigned i = 0; i < N; i++){
+ for (unsigned imu = 0; imu <= intr.nsteps (); imu += 1){
+ gr_complex expected = test_fcn ((i + 3) + imu * inv_nsteps);
+ gr_complex actual = intr.interpolate (&input[i], imu * inv_nsteps);
+
+ CPPUNIT_ASSERT_COMPLEXES_EQUAL (expected, actual, 0.004);
+ // printf ("%9.6f %9.6f %9.6f\n", expected, actual, expected - actual);
+ }
+ }
+}
+
+
+/*
+ * Force bad alignment and confirm that it raises an exception
+ */
+void
+qa_gri_mmse_fir_interpolator_cc::t2_body()
+{
+ static const unsigned N = 100;
+ float float_input[2*(N+10) + 1];
+ gr_complex *input;
+
+ // We require that gr_complex be aligned on an 8-byte boundary.
+ // Ensure that we ARE NOT ;)
+
+ if (((intptr_t) float_input & 0x7) == 0)
+ input = reinterpret_cast<gr_complex *>(&float_input[1]);
+ else
+ input = reinterpret_cast<gr_complex *>(&float_input[0]);
+
+
+ for (unsigned i = 0; i < (N+10); i++)
+ input[i] = test_fcn ((double) i);
+
+ gri_mmse_fir_interpolator_cc intr;
+ float inv_nsteps = 1.0 / intr.nsteps ();
+
+ for (unsigned i = 0; i < N; i++){
+ for (unsigned imu = 0; imu <= intr.nsteps (); imu += 1){
+ gr_complex expected = test_fcn ((i + 3) + imu * inv_nsteps);
+ gr_complex actual = intr.interpolate (&input[i], imu * inv_nsteps);
+
+ CPPUNIT_ASSERT_COMPLEXES_EQUAL (expected, actual, 0.004);
+ // printf ("%9.6f %9.6f %9.6f\n", expected, actual, expected - actual);
+ }
+ }
+}
+
+void
+qa_gri_mmse_fir_interpolator_cc::t2()
+{
+ CPPUNIT_ASSERT_THROW(t2_body(), std::invalid_argument);
+}
diff --git a/gnuradio-core/src/lib/filter/qa_gri_mmse_fir_interpolator_cc.h b/gnuradio-core/src/lib/filter/qa_gri_mmse_fir_interpolator_cc.h
new file mode 100644
index 000000000..6be3d9743
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/qa_gri_mmse_fir_interpolator_cc.h
@@ -0,0 +1,42 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002,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.
+ */
+#ifndef _QA_GRI_MMSE_FIR_INTERPOLATOR_CC_H_
+#define _QA_GRI_MMSE_FIR_INTERPOLATOR_CC_H_
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/TestCase.h>
+
+class qa_gri_mmse_fir_interpolator_cc : public CppUnit::TestCase {
+
+ CPPUNIT_TEST_SUITE(qa_gri_mmse_fir_interpolator_cc);
+ CPPUNIT_TEST(t1);
+ // CPPUNIT_TEST(t2);
+ CPPUNIT_TEST_SUITE_END();
+
+ private:
+ void t1();
+ void t2();
+ void t2_body();
+
+};
+
+#endif /* _QA_GRI_MMSE_FIR_INTERPOLATOR_CC_H_ */
diff --git a/gnuradio-core/src/lib/filter/short_dotprod_generic.c b/gnuradio-core/src/lib/filter/short_dotprod_generic.c
new file mode 100644
index 000000000..49a9c0483
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/short_dotprod_generic.c
@@ -0,0 +1,49 @@
+/* -*- c -*- */
+/*
+ * Copyright 2002 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 "short_dotprod_generic.h"
+
+
+int
+short_dotprod_generic (const short *input,
+ const short *taps, unsigned n_4_short_blocks)
+{
+ int sum0 = 0;
+ int sum1 = 0;
+ int sum2 = 0;
+ int sum3 = 0;
+
+ do {
+
+ sum0 += input[0] * taps[0];
+ sum1 += input[1] * taps[1];
+ sum2 += input[2] * taps[2];
+ sum3 += input[3] * taps[3];
+
+ input += 4;
+ taps += 4;
+
+ } while (--n_4_short_blocks != 0);
+
+
+ return (sum0 + sum1 + sum2 + sum3);
+}
diff --git a/gnuradio-core/src/lib/filter/short_dotprod_generic.h b/gnuradio-core/src/lib/filter/short_dotprod_generic.h
new file mode 100644
index 000000000..e7d977a00
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/short_dotprod_generic.h
@@ -0,0 +1,41 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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 _SHORT_DOTPROD_GENERIC_H_
+#define _SHORT_DOTPROD_GENERIC_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int
+short_dotprod_generic (const short *input,
+ const short *taps, unsigned n_4_short_blocks);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+
+#endif /* _SHORT_DOTPROD_GENERIC_H_ */
diff --git a/gnuradio-core/src/lib/filter/short_dotprod_mmx.S b/gnuradio-core/src/lib/filter/short_dotprod_mmx.S
new file mode 100644
index 000000000..0f6801e4b
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/short_dotprod_mmx.S
@@ -0,0 +1,117 @@
+#
+# Copyright 2002 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.
+#
+
+# SIMD MMX dot product
+# Equivalent to the following C code:
+# long dotprod(signed short *a,signed short *b,int cnt)
+# {
+# long sum = 0;
+# cnt *= 4;
+# while(cnt--)
+# sum += *a++ + *b++;
+# return sum;
+# }
+# a and b should also be 64-bit aligned, or speed will suffer greatly
+# Copyright 1999, Phil Karn KA9Q
+# May be used under the terms of the GNU public license
+
+#include "assembly.h"
+
+
+ .file "short_dotprod_mmx.S"
+// .version "01.01"
+.text
+ .p2align 3
+.globl GLOB_SYMB(short_dotprod_mmx)
+ DEF_FUNC_HEAD(short_dotprod_mmx)
+GLOB_SYMB(short_dotprod_mmx):
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %esi
+ pushl %edi
+ pushl %ecx
+ pushl %ebx
+ movl 8(%ebp),%esi # a
+ movl 12(%ebp),%edi # b
+ movl 16(%ebp),%ecx # cnt
+ pxor %mm0,%mm0 # clear running sum (in two 32-bit halves)
+
+# MMX dot product loop unrolled 4 times, crunching 16 terms per loop
+ .p2align 4
+.Loop1mmx: subl $4,%ecx
+ jl .Loop1Done
+
+ movq (%esi),%mm1 # mm1 = a[3],a[2],a[1],a[0]
+ pmaddwd (%edi),%mm1 # mm1 = b[3]*a[3]+b[2]*a[2],b[1]*a[1]+b[0]*a[0]
+ paddd %mm1,%mm0
+
+ movq 8(%esi),%mm1
+ pmaddwd 8(%edi),%mm1
+ paddd %mm1,%mm0
+
+ movq 16(%esi),%mm1
+ pmaddwd 16(%edi),%mm1
+ paddd %mm1,%mm0
+
+ movq 24(%esi),%mm1
+ addl $32,%esi
+ pmaddwd 24(%edi),%mm1
+ addl $32,%edi
+ paddd %mm1,%mm0
+
+ jmp .Loop1mmx
+.Loop1Done:
+
+ addl $4,%ecx
+
+# MMX dot product loop, not unrolled, crunching 4 terms per loop
+# This could be redone as Duff's Device on the unrolled loop above
+.Loop2: subl $1,%ecx
+ jl .Loop2Done
+
+ movq (%esi),%mm1
+ addl $8,%esi
+ pmaddwd (%edi),%mm1
+ addl $8,%edi
+ paddd %mm1,%mm0
+ jmp .Loop2
+.Loop2Done:
+
+ movd %mm0,%ebx # right-hand word to ebx
+ punpckhdq %mm0,%mm0 # left-hand word to right side of %mm0
+ movd %mm0,%eax
+ addl %ebx,%eax # running sum now in %eax
+ emms # done with MMX
+
+ popl %ebx
+ popl %ecx
+ popl %edi
+ popl %esi
+ movl %ebp,%esp
+ popl %ebp
+ ret
+
+FUNC_TAIL(short_dotprod_mmx)
+ .ident "Hand coded x86 MMX assembly"
+
+#if defined(__linux__) && defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff --git a/gnuradio-core/src/lib/filter/short_dotprod_mmx64.S b/gnuradio-core/src/lib/filter/short_dotprod_mmx64.S
new file mode 100644
index 000000000..bafd0e04e
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/short_dotprod_mmx64.S
@@ -0,0 +1,105 @@
+#
+# Copyright 2002,2005 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.
+#
+
+# SIMD MMX dot product
+# Equivalent to the following C code:
+# long dotprod(signed short *a,signed short *b,int cnt)
+# {
+# long sum = 0;
+# cnt *= 4;
+# while(cnt--)
+# sum += *a++ + *b++;
+# return sum;
+# }
+# a and b should also be 64-bit aligned, or speed will suffer greatly
+# Copyright 1999, Phil Karn KA9Q
+# May be used under the terms of the GNU public license
+
+#include "assembly.h"
+
+
+ .file "short_dotprod_mmx64.S"
+// .version "01.01"
+.text
+ .p2align 3
+.globl GLOB_SYMB(short_dotprod_mmx)
+ DEF_FUNC_HEAD(short_dotprod_mmx)
+GLOB_SYMB(short_dotprod_mmx):
+
+ # a: rdi, b: rsi, cnt: rdx
+
+ pxor %mm0,%mm0 # clear running sum (in two 32-bit halves)
+
+# MMX dot product loop unrolled 4 times, crunching 16 terms per loop
+ .p2align 4
+.Loop1mmx: sub $4,%rdx
+ jl .Loop1Done
+
+ movq (%rdi),%mm1 # mm1 = a[3],a[2],a[1],a[0]
+ pmaddwd (%rsi),%mm1 # mm1 = b[3]*a[3]+b[2]*a[2],b[1]*a[1]+b[0]*a[0]
+ paddd %mm1,%mm0
+
+ movq 8(%rdi),%mm1
+ pmaddwd 8(%rsi),%mm1
+ paddd %mm1,%mm0
+
+ movq 16(%rdi),%mm1
+ pmaddwd 16(%rsi),%mm1
+ paddd %mm1,%mm0
+
+ movq 24(%rdi),%mm1
+ add $32,%rdi
+ pmaddwd 24(%rsi),%mm1
+ add $32,%rsi
+ paddd %mm1,%mm0
+
+ jmp .Loop1mmx
+.Loop1Done:
+
+ add $4,%rdx
+
+# MMX dot product loop, not unrolled, crunching 4 terms per loop
+# This could be redone as Duff's Device on the unrolled loop above
+.Loop2: sub $1,%rdx
+ jl .Loop2Done
+
+ movq (%rdi),%mm1
+ add $8,%rdi
+ pmaddwd (%rsi),%mm1
+ add $8,%rsi
+ paddd %mm1,%mm0
+ jmp .Loop2
+.Loop2Done:
+
+ movd %mm0,%edx # right-hand word to edx
+ punpckhdq %mm0,%mm0 # left-hand word to right side of %mm0
+ movd %mm0,%eax
+ addl %edx,%eax # running sum now in %eax
+ emms # done with MMX
+
+ retq
+
+FUNC_TAIL(short_dotprod_mmx)
+ .ident "Hand coded x86_64 MMX assembly"
+
+#if defined(__linux__) && defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff --git a/gnuradio-core/src/lib/filter/short_dotprod_x86.h b/gnuradio-core/src/lib/filter/short_dotprod_x86.h
new file mode 100644
index 000000000..13d5ae2a3
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/short_dotprod_x86.h
@@ -0,0 +1,44 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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 _SHORT_DOTPROD_X86_H_
+#define _SHORT_DOTPROD_X86_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int
+short_dotprod_mmx (const short *input,
+ const short *taps, unsigned n_4_short_blocks);
+
+int
+short_dotprod_sse2 (const short *input,
+ const short *taps, unsigned n_4_short_blocks);
+
+#ifdef __cplusplus
+}
+#endif
+
+
+
+#endif /* _SHORT_DOTPROD_X86_H_ */
diff --git a/gnuradio-core/src/lib/filter/sse_debug.c b/gnuradio-core/src/lib/filter/sse_debug.c
new file mode 100644
index 000000000..870cc0543
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/sse_debug.c
@@ -0,0 +1,62 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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 <stdio.h>
+#include <sse_debug.h>
+#include <string.h>
+
+void
+format_xmm_regs (FILE *f, struct xmm_regs *r)
+{
+ int i;
+
+ for (i = 0; i < 8; i++){
+ union xmm_register *x = &r->xmm[i];
+ fprintf (f, "xmm%d: %08lx %08lx %08lx %08lx", i,
+ x->ul[0], x->ul[1], x->ul[2], x->ul[3]);
+ fprintf (f, " %12g %12g %12g %12g\n",
+ x->f[0], x->f[1], x->f[2], x->f[3]);
+ }
+}
+
+
+void
+get_xmm_regs (struct xmm_regs *x)
+{
+ asm ("movups %%xmm0,0x00(%0); \n"
+ "movups %%xmm1,0x10(%0); \n"
+ "movups %%xmm2,0x20(%0); \n"
+ "movups %%xmm3,0x30(%0); \n"
+ "movups %%xmm4,0x40(%0); \n"
+ "movups %%xmm5,0x50(%0); \n"
+ "movups %%xmm6,0x60(%0); \n"
+ "movups %%xmm7,0x70(%0); \n" : : "r" (x));
+}
+
+void
+dump_xmm_regs (void)
+{
+ struct xmm_regs r;
+
+ get_xmm_regs (&r);
+ format_xmm_regs (stderr, &r);
+}
+
diff --git a/gnuradio-core/src/lib/filter/sse_debug.h b/gnuradio-core/src/lib/filter/sse_debug.h
new file mode 100644
index 000000000..b19b4e646
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/sse_debug.h
@@ -0,0 +1,48 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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 _SSE_DEBUG_H_
+#define _SSE_DEBUG_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ union xmm_register {
+ unsigned long ul[4];
+ float f[4];
+ };
+
+ struct xmm_regs {
+ union xmm_register xmm[8];
+ };
+
+ // callable from asm, dumps all xmm regs
+ void dump_xmm_regs (void);
+
+ void get_xmm_regs (struct xmm_regs *x);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // _SSE_DEBUG_H_
diff --git a/gnuradio-core/src/lib/filter/sysconfig_armv7_a.cc b/gnuradio-core/src/lib/filter/sysconfig_armv7_a.cc
new file mode 100644
index 000000000..2c415863b
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/sysconfig_armv7_a.cc
@@ -0,0 +1,39 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <gr_fir_sysconfig_armv7_a.h>
+
+gr_fir_sysconfig *
+gr_fir_sysconfig_singleton ()
+{
+ static gr_fir_sysconfig *singleton = 0;
+
+ if (singleton)
+ return singleton;
+
+ singleton = new gr_fir_sysconfig_armv7_a ();
+ return singleton;
+}
diff --git a/gnuradio-core/src/lib/filter/sysconfig_generic.cc b/gnuradio-core/src/lib/filter/sysconfig_generic.cc
new file mode 100644
index 000000000..88508f62b
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/sysconfig_generic.cc
@@ -0,0 +1,35 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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_fir_sysconfig_generic.h>
+
+gr_fir_sysconfig *
+gr_fir_sysconfig_singleton ()
+{
+ static gr_fir_sysconfig *singleton = 0;
+
+ if (singleton)
+ return singleton;
+
+ singleton = new gr_fir_sysconfig_generic ();
+ return singleton;
+}
diff --git a/gnuradio-core/src/lib/filter/sysconfig_powerpc.cc b/gnuradio-core/src/lib/filter/sysconfig_powerpc.cc
new file mode 100644
index 000000000..911beae2a
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/sysconfig_powerpc.cc
@@ -0,0 +1,38 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <gr_fir_sysconfig_powerpc.h>
+
+gr_fir_sysconfig *
+gr_fir_sysconfig_singleton ()
+{
+ static gr_fir_sysconfig *singleton = 0;
+
+ if (singleton)
+ return singleton;
+
+ singleton = new gr_fir_sysconfig_powerpc ();
+ return singleton;
+}
diff --git a/gnuradio-core/src/lib/filter/sysconfig_x86.cc b/gnuradio-core/src/lib/filter/sysconfig_x86.cc
new file mode 100644
index 000000000..582df0ab7
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/sysconfig_x86.cc
@@ -0,0 +1,38 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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 <gr_fir_sysconfig_x86.h>
+
+gr_fir_sysconfig *
+gr_fir_sysconfig_singleton ()
+{
+ static gr_fir_sysconfig *singleton = 0;
+
+ if (singleton)
+ return singleton;
+
+ singleton = new gr_fir_sysconfig_x86 ();
+ return singleton;
+}
diff --git a/gnuradio-core/src/lib/general/CMakeLists.txt b/gnuradio-core/src/lib/general/CMakeLists.txt
new file mode 100644
index 000000000..ce9a80f37
--- /dev/null
+++ b/gnuradio-core/src/lib/general/CMakeLists.txt
@@ -0,0 +1,312 @@
+# Copyright 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.
+
+########################################################################
+# This file included, use CMake directory variables
+########################################################################
+
+########################################################################
+# Handle the generated sine table
+########################################################################
+add_custom_command(
+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/sine_table.h
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/gen_sine_table.py
+ COMMAND ${PYTHON_EXECUTABLE}
+ ${CMAKE_CURRENT_SOURCE_DIR}/gen_sine_table.py >
+ ${CMAKE_CURRENT_BINARY_DIR}/sine_table.h
+)
+
+include(AddFileDependencies)
+ADD_FILE_DEPENDENCIES(${CMAKE_CURRENT_SOURCE_DIR}/gr_fxpt.cc
+ ${CMAKE_CURRENT_BINARY_DIR}/sine_table.h
+)
+
+add_custom_target(general_generated DEPENDS
+ ${CMAKE_CURRENT_BINARY_DIR}/sine_table.h
+)
+
+########################################################################
+# Handle the generated constants
+########################################################################
+execute_process(COMMAND ${PYTHON_EXECUTABLE} -c
+ "import time;print time.strftime('%a, %d %b %Y %H:%M:%S', time.gmtime())"
+ OUTPUT_VARIABLE BUILD_DATE OUTPUT_STRIP_TRAILING_WHITESPACE
+)
+message(STATUS "Loading build date ${BUILD_DATE} into gr_constants...")
+
+message(STATUS "Loading version ${VERSION} into gr_constants...")
+
+#double escape for windows backslash path separators
+string(REPLACE "\\" "\\\\" prefix ${prefix})
+string(REPLACE "\\" "\\\\" SYSCONFDIR ${SYSCONFDIR})
+string(REPLACE "\\" "\\\\" GR_PREFSDIR ${GR_PREFSDIR})
+
+configure_file(
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_constants.cc.in
+ ${CMAKE_CURRENT_BINARY_DIR}/gr_constants.cc
+@ONLY)
+
+list(APPEND gnuradio_core_sources ${CMAKE_CURRENT_BINARY_DIR}/gr_constants.cc)
+
+########################################################################
+# Append gnuradio-core library sources
+########################################################################
+list(APPEND gnuradio_core_sources
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_circular_file.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_count_bits.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_fast_atan2f.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_fft_vcc_fftw.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_fxpt.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_misc.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_random.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_reverse.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/gri_add_const_ss_generic.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/gri_char_to_float.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/gri_control_loop.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/gri_debugger_hook.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/gri_fft.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/gri_float_to_char.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/gri_float_to_int.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/gri_float_to_short.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/gri_float_to_uchar.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/gri_glfsr.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/gri_interleaved_short_to_complex.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/gri_int_to_float.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/gri_short_to_float.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/gri_uchar_to_float.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/malloc16.c
+)
+
+########################################################################
+# Append gnuradio-core test sources
+########################################################################
+list(APPEND test_gnuradio_core_sources
+ ${CMAKE_CURRENT_SOURCE_DIR}/qa_general.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_circular_file.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_cpm.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_firdes.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_fxpt.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_fxpt_nco.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_fxpt_vco.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_math.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/qa_gri_lfsr.cc
+)
+
+########################################################################
+# Install runtime headers
+########################################################################
+install(FILES
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_core_api.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_circular_file.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_constants.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_count_bits.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_expj.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_fft_vcc_fftw.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_fxpt.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_fxpt_nco.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_fxpt_vco.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_log2_const.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_math.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_misc.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_nco.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_random.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_reverse.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_simple_framer_sync.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_test_types.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_vco.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gri_add_const_ss.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gri_agc_cc.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gri_agc_ff.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gri_agc2_cc.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gri_agc2_ff.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gri_char_to_float.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gri_control_loop.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gri_debugger_hook.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gri_fft.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gri_float_to_char.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gri_float_to_int.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gri_float_to_short.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gri_float_to_uchar.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gri_lfsr.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gri_glfsr.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gri_interleaved_short_to_complex.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gri_lfsr_15_1_0.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gri_lfsr_32k.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gri_int_to_float.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gri_short_to_float.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gri_uchar_to_float.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/malloc16.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/random.h
+ DESTINATION ${GR_INCLUDE_DIR}/gnuradio
+ COMPONENT "core_devel"
+)
+
+########################################################################
+# Install swig headers
+########################################################################
+if(ENABLE_PYTHON)
+install(FILES
+ ${CMAKE_CURRENT_SOURCE_DIR}/general.i
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_constants.i
+ ${CMAKE_CURRENT_SOURCE_DIR}/gri_agc_cc.i
+ ${CMAKE_CURRENT_SOURCE_DIR}/gri_agc_ff.i
+ ${CMAKE_CURRENT_SOURCE_DIR}/gri_agc2_cc.i
+ ${CMAKE_CURRENT_SOURCE_DIR}/gri_agc2_ff.i
+ ${CMAKE_CURRENT_SOURCE_DIR}/gri_control_loop.i
+ DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig
+ COMPONENT "core_swig"
+)
+endif(ENABLE_PYTHON)
+
+########################################################################
+# Handle triple-threat files that have cc, h, and i
+########################################################################
+set(gr_core_general_triple_threats
+ complex_vec_test
+ gr_add_ff
+ gr_additive_scrambler_bb
+ gr_agc_cc
+ gr_agc_ff
+ gr_agc2_cc
+ gr_agc2_ff
+ gr_align_on_samplenumbers_ss
+ gr_bin_statistics_f
+ gr_block_gateway
+ gr_bytes_to_syms
+ gr_char_to_float
+ gr_char_to_short
+ gr_check_counting_s
+ gr_check_lfsr_32k_s
+ gr_complex_to_interleaved_short
+ gr_complex_to_xxx
+ gr_conjugate_cc
+ gr_copy
+ gr_cpfsk_bc
+ gr_cpm
+ gr_ctcss_squelch_ff
+ gr_decode_ccsds_27_fb
+ gr_diff_decoder_bb
+ gr_diff_encoder_bb
+ gr_diff_phasor_cc
+ gr_dpll_bb
+ gr_deinterleave
+ gr_delay
+ gr_encode_ccsds_27_bb
+ gr_endian_swap
+ gr_fake_channel_coder_pp
+ gr_feedforward_agc_cc
+ gr_feval
+ gr_fft_vcc
+ gr_fft_vfc
+ gr_firdes
+ gr_float_to_char
+ gr_float_to_complex
+ gr_float_to_int
+ gr_float_to_short
+ gr_float_to_uchar
+ gr_fmdet_cf
+ gr_frequency_modulator_fc
+ gr_framer_sink_1
+ gr_glfsr_source_b
+ gr_glfsr_source_f
+ gr_head
+ gr_int_to_float
+ gr_interleave
+ gr_interleaved_short_to_complex
+ gr_iqcomp_cc
+ gr_keep_one_in_n
+ gr_keep_m_in_n
+ gr_kludge_copy
+ gr_lfsr_32k_source_s
+ gr_map_bb
+ gr_multiply_cc
+ gr_multiply_ff
+ gr_multiply_const_cc
+ gr_multiply_const_ff
+ gr_multiply_conjugate_cc
+ gr_nlog10_ff
+ gr_nop
+ gr_null_sink
+ gr_null_source
+ gr_pa_2x2_phase_combiner
+ gr_packet_sink
+ gr_peak_detector2_fb
+ gr_phase_modulator_fc
+ gr_pll_carriertracking_cc
+ gr_pll_freqdet_cf
+ gr_pll_refout_cc
+ gr_pn_correlator_cc
+ gr_prefs
+ gr_probe_avg_mag_sqrd_c
+ gr_probe_avg_mag_sqrd_cf
+ gr_probe_avg_mag_sqrd_f
+ gr_pwr_squelch_cc
+ gr_pwr_squelch_ff
+ gr_quadrature_demod_cf
+ gr_random_pdu
+ gr_rail_ff
+ gr_regenerate_bb
+ gr_remez
+ gr_rms_cf
+ gr_rms_ff
+ gr_repeat
+ gr_short_to_float
+ gr_short_to_char
+ gr_simple_correlator
+ gr_simple_framer
+ gr_simple_squelch_cc
+ gr_skiphead
+ gr_squelch_base_cc
+ gr_squelch_base_ff
+ gr_stream_mux
+ gr_stream_to_streams
+ gr_stream_to_vector
+ gr_streams_to_stream
+ gr_streams_to_vector
+ gr_stretch_ff
+ gr_test
+ gr_threshold_ff
+ gr_throttle
+ gr_transcendental
+ gr_uchar_to_float
+ gr_vco_f
+ gr_vector_map
+ gr_vector_to_stream
+ gr_vector_to_streams
+ gr_unpack_k_bits_bb
+ gr_pack_k_bits_bb
+ gr_descrambler_bb
+ gr_scrambler_bb
+ gr_probe_density_b
+ gr_annotator_alltoall
+ gr_annotator_1to1
+ gr_annotator_raw
+ gr_burst_tagger
+ gr_correlate_access_code_tag_bb
+ gr_tag_debug
+ gr_message_strobe
+)
+
+foreach(file_tt ${gr_core_general_triple_threats})
+ list(APPEND gnuradio_core_sources ${CMAKE_CURRENT_SOURCE_DIR}/${file_tt}.cc)
+ install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${file_tt}.h DESTINATION ${GR_INCLUDE_DIR}/gnuradio COMPONENT "core_devel")
+ if(ENABLE_PYTHON)
+ install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${file_tt}.i DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig COMPONENT "core_swig")
+ endif(ENABLE_PYTHON)
+endforeach(file_tt ${gr_core_general_triple_threats})
diff --git a/gnuradio-core/src/lib/general/README b/gnuradio-core/src/lib/general/README
new file mode 100644
index 000000000..5fa18d7f6
--- /dev/null
+++ b/gnuradio-core/src/lib/general/README
@@ -0,0 +1,98 @@
+Files beginning with Gr* define classes that inherit from VrSigProc.
+These are high level signal processing modules that can be glued
+together in your signal processing chain.
+
+All the others are either lower level routines which implement the
+functionality of the Gr* modules, but are easier to test (fewer
+dependencies), or they are general purpose.
+
+gr_fir_???.{h,cc}, where ??? are in F, S or C are low level Finite
+Impulse Response Filters. These turn out to be where the bulk of the
+cycles are burned in many applications. The ??? suffix specifies the
+input type, output type and tap type of the arguments. We've
+implemented the most frequently used ones.
+
+[Once upon a time this stuff was done with templates
+(gr_fir<iType,oType,tapType>), but this turned out to be a headache.
+The code appeared to trigger a bug in GCC where we were getting
+multiple definitions of unrelated stuff when we started subclassing
+partially specialized templates. It was also not obvious as to to
+what combinations of iType, oType and tapType actually worked. We're
+now explicit, and the world is a safer place to live...]
+
+The top level routines for FIR filtering are:
+
+ GrFIRfilterFFF : Float input, Float output, Float taps
+ -- general purpose
+
+ GrFIRfilterCCF : Complex input, Complex output, Float taps
+ -- applying real filter to a complex signal
+
+ GrFIRfilterFCC : Float input, Complex output, Complex taps
+ -- applying complex filter to float input
+
+ GrFIRfilterSCC : Short input, Complex output, Complex taps
+ -- applying complex filter to short input. Quantizes complex
+ coefficients to 16 bits and uses MMX or SSE2 as appropriate
+
+
+The combination of down conversion (frequency translation) and channel
+selection (filtering) is performed with:
+
+ GrFreqXlatingFIRfilterSFC : Short input, Float taps, Complex baseband output
+ -- quantizes complex coefficents to 16 bits and uses MMX or
+ SSE2 (128-bit MMX) as appropriate [optimization to be done].
+
+ GrFreqXlatingFIRfilterFFC : Float input, Float taps, Complex baseband output
+ -- 3dnow or SSE as appropriate.
+
+
+[ The stuff described from here down is used to implement the routines
+ above. This info is only relevant to those who are hacking the internals ]
+
+
+A bit of indirection is involved in selecting the fastest
+implementation for any given platform. The lower level classes
+gr_fir_FFF.h, gr_fir_CCF, gr_fir_FCC and gr_fir_SCC have i/o
+signatures similar to the high level clases above. These
+should be considered the abstract base classes that you
+work with. Note that they are not actually abstract (they've got a
+default implementation; this might be considered a bug), but they
+should not be directly instantiated by user code.
+
+Instead of directly instantiating a gr_fir_FFF, for example, your code
+should actually:
+
+ #include <gr_fir_util.h>
+
+ // let the system pick the best implementation for you
+ gr_fir_FFF *filter = gr_fir_util::create_gr_fir_FFF (my_taps);
+
+Clear? The same for all the other gr_fir_XXX's.
+
+
+
+Performance hacking can be done by subclassing the appropriate
+base class. For example, on the x86 platform, there are two
+additional classes derived from gr_fir_FFF, gr_fir_FFF_sse and
+gr_fir_FFF_3dnow. These classes are then made available to the rest
+of the system by virtue of being added to gr_fir_sysconfig_x86.cc,
+along with any guards (CPUID checks) needed to ensure that only
+compatible code is executed on the current hardware.
+
+
+TO DO
+------
+
+* Move all the machine specific code to a subdirectory, then have
+configure symlink to the right directory. This will allow us to build on
+any platform without choking. There is generic code for all routines,
+only the machine dependent speedup will be lacking.
+
+* Add an interface to gr_fir_util that will return a vector of all
+valid constructors with descriptive names for each i/o signature.
+This will allow the test code and benchmarking code to be blissfully
+ignorant of what platform they're running on. The actual building of
+the vectors should be done bottom up through the gr_fir_sysconfig
+hierarchy.
+
diff --git a/gnuradio-core/src/lib/general/atsc_rrc1x.dat b/gnuradio-core/src/lib/general/atsc_rrc1x.dat
new file mode 100644
index 000000000..3dc87bb0b
--- /dev/null
+++ b/gnuradio-core/src/lib/general/atsc_rrc1x.dat
@@ -0,0 +1,57 @@
+/*
+ * FILTER SPECIFICATION FILE
+ * FILTER TYPE:ROOT RAISED COSINE 12H
+ * PASSBAND RIPPLE IN -dB -.0500
+ * STOPBAND RIPPLE IN -dB -50.0000
+ * SYMBOL RATE .538112E+07 HERTZ
+ * ROLLOF FACTOR .115200
+ * SAMPLING FREQUENCY .107622E+08 HERTZ
+ * SAMPLING FREQUENCY .107622E+08 HERTZ
+ */
+ .1821269281208515e-02,
+ -.9323525242507458e-02,
+ -.8581001311540604e-02,
+ .2809949219226837e-02,
+ .9649330750107765e-03,
+ -.4944681189954281e-02,
+ .1624439377337694e-02,
+ .6519509013742209e-02,
+ -.4803944379091263e-02,
+ -.8026130497455597e-02,
+ .8922342676669359e-02,
+ .9611152112483978e-02,
+ -.1463735569268465e-01,
+ -.1107082655653358e-01,
+ .2262782817706466e-01,
+ .1240625558421016e-01,
+ -.3461387194693089e-01,
+ -.1348070800304413e-01,
+ .5474480940029025e-01,
+ .1432673400267959e-01,
+ -.9872047463431954e-01,
+ -.1482593175023794e-01,
+ .3077511447481811e+00,
+ .5007477863691747e+00,
+ .3077511447481811e+00,
+ -.1482593175023794e-01,
+ -.9872047463431954e-01,
+ .1432673400267959e-01,
+ .5474480940029025e-01,
+ -.1348070800304413e-01,
+ -.3461387194693089e-01,
+ .1240625558421016e-01,
+ .2262782817706466e-01,
+ -.1107082655653358e-01,
+ -.1463735569268465e-01,
+ .9611152112483978e-02,
+ .8922342676669359e-02,
+ -.8026130497455597e-02,
+ -.4803944379091263e-02,
+ .6519509013742209e-02,
+ .1624439377337694e-02,
+ -.4944681189954281e-02,
+ .9649330750107765e-03,
+ .2809949219226837e-02,
+ -.8581001311540604e-02,
+ -.9323525242507458e-02,
+ .1821269281208515e-02
diff --git a/gnuradio-core/src/lib/general/atsc_rrc20.dat b/gnuradio-core/src/lib/general/atsc_rrc20.dat
new file mode 100644
index 000000000..94445e96e
--- /dev/null
+++ b/gnuradio-core/src/lib/general/atsc_rrc20.dat
@@ -0,0 +1,101 @@
+ -.1141865178942680e-01,
+ .2192483097314835e-01,
+ -.6814673542976379e-04,
+ -.5894266534596682e-02,
+ -.3580642864108086e-02,
+ .7064016535878182e-03,
+ .3225978463888168e-02,
+ .2832664176821709e-02,
+ .4997388459742069e-03,
+ -.1796286087483168e-02,
+ -.2396093215793371e-02,
+ -.1009003724902868e-02,
+ .1184449531137943e-02,
+ .2406611572951078e-02,
+ .1609810627996922e-02,
+ -.6790305487811565e-03,
+ -.2634476870298386e-02,
+ -.2524725627154112e-02,
+ -.1492514275014401e-03,
+ .2789965830743313e-02,
+ .3848167601972818e-02,
+ .1755146309733391e-02,
+ -.2288600429892540e-02,
+ -.5209952127188444e-02,
+ -.4314901307225227e-02,
+ .3885449841618538e-03,
+ .5747230723500252e-02,
+ .7460035849362612e-02,
+ .3387423232197762e-02,
+ -.4307936877012253e-02,
+ -.1007711654528976e-01,
+ -.8849395904690027e-02,
+ -.1979861408472061e-03,
+ .1040456583723426e-01,
+ .1484309835359454e-01,
+ .8285604882985354e-02,
+ -.6346960552036762e-02,
+ -.1915087224915624e-01,
+ -.1949162455275655e-01,
+ -.4145141225308180e-02,
+ .1850909460335970e-01,
+ .3220130456611514e-01,
+ .2337836893275380e-01,
+ -.7863232865929604e-02,
+ -.4402747144922614e-01,
+ -.5751598253846169e-01,
+ -.2598480274900794e-01,
+ .5246857088059187e-01,
+ .1544690094888210e+00,
+ .2405302016995847e+00,
+ .2741314689628780e+00,
+ .2405302016995847e+00,
+ .1544690094888210e+00,
+ .5246857088059187e-01,
+ -.2598480274900794e-01,
+ -.5751598253846169e-01,
+ -.4402747144922614e-01,
+ -.7863232865929604e-02,
+ .2337836893275380e-01,
+ .3220130456611514e-01,
+ .1850909460335970e-01,
+ -.4145141225308180e-02,
+ -.1949162455275655e-01,
+ -.1915087224915624e-01,
+ -.6346960552036762e-02,
+ .8285604882985354e-02,
+ .1484309835359454e-01,
+ .1040456583723426e-01,
+ -.1979861408472061e-03,
+ -.8849395904690027e-02,
+ -.1007711654528976e-01,
+ -.4307936877012253e-02,
+ .3387423232197762e-02,
+ .7460035849362612e-02,
+ .5747230723500252e-02,
+ .3885449841618538e-03,
+ -.4314901307225227e-02,
+ -.5209952127188444e-02,
+ -.2288600429892540e-02,
+ .1755146309733391e-02,
+ .3848167601972818e-02,
+ .2789965830743313e-02,
+ -.1492514275014401e-03,
+ -.2524725627154112e-02,
+ -.2634476870298386e-02,
+ -.6790305487811565e-03,
+ .1609810627996922e-02,
+ .2406611572951078e-02,
+ .1184449531137943e-02,
+ -.1009003724902868e-02,
+ -.2396093215793371e-02,
+ -.1796286087483168e-02,
+ .4997388459742069e-03,
+ .2832664176821709e-02,
+ .3225978463888168e-02,
+ .7064016535878182e-03,
+ -.3580642864108086e-02,
+ -.5894266534596682e-02,
+ -.6814673542976379e-04,
+ .2192483097314835e-01,
+ -.1141865178942680e-01
diff --git a/gnuradio-core/src/lib/general/atsc_rrc2x.dat b/gnuradio-core/src/lib/general/atsc_rrc2x.dat
new file mode 100644
index 000000000..8eae94d77
--- /dev/null
+++ b/gnuradio-core/src/lib/general/atsc_rrc2x.dat
@@ -0,0 +1,102 @@
+/*
+ * FILTER SPECIFICATION FILE
+ * FILTER TYPE:ROOT RAISED COSINE 12H
+ * PASSBAND RIPPLE IN -dB -.0500
+ * STOPBAND RIPPLE IN -dB -50.0000
+ * SYMBOL RATE .538112E+07 HERTZ
+ * ROLLOF FACTOR .115200
+ * SAMPLING FREQUENCY .215245E+08 HERTZ
+*/
+ .8186036720871925E-03,
+ -.1256920862942934E-02,
+ -.4844595678150654E-02,
+ -.6055080797523260E-02,
+ -.4247304052114487E-02,
+ -.9502284228801727E-03,
+ .1615938264876604E-02,
+ .2120061777532101E-02,
+ .6354246288537979E-03,
+ -.1464351080358028E-02,
+ -.2508673351258040E-02,
+ -.1573510002344847E-02,
+ .8145328611135483E-03,
+ .2996938303112984E-02,
+ .3244197461754084E-02,
+ .1038576476275921E-02,
+ -.2401810139417648E-02,
+ -.4728596191853285E-02,
+ -.4019895102828741E-02,
+ -.2215979620814323E-03,
+ .4481043666601181E-02,
+ .6867439020425081E-02,
+ .4793671425431967E-02,
+ -.1089230179786682E-02,
+ -.7325290236622095E-02,
+ -.9580074809491634E-02,
+ -.5532339215278626E-02,
+ .3166179172694683E-02,
+ .1132524851709604E-01,
+ .1316944882273674E-01,
+ .6192639470100403E-02,
+ -.6509334780275822E-02,
+ -.1730504119768739E-01,
+ -.1832502009347081E-01,
+ -.6741075310856104E-02,
+ .1229691226035357E-01,
+ .2738198731094599E-01,
+ .2702147699892521E-01,
+ .7156732492148876E-02,
+ -.2432488137856126E-01,
+ -.4934547096490860E-01,
+ -.4763523396104574E-01,
+ -.7410581223666668E-02,
+ .6681889295578003E-01,
+ .1538293845951557E+00,
+ .2236228249967098E+00,
+ .2502835178747773E+00,
+ .2236228249967098E+00,
+ .1538293845951557E+00,
+ .6681889295578003E-01,
+ -.7410581223666668E-02,
+ -.4763523396104574E-01,
+ -.4934547096490860E-01,
+ -.2432488137856126E-01,
+ .7156732492148876E-02,
+ .2702147699892521E-01,
+ .2738198731094599E-01,
+ .1229691226035357E-01,
+ -.6741075310856104E-02,
+ -.1832502009347081E-01,
+ -.1730504119768739E-01,
+ -.6509334780275822E-02,
+ .6192639470100403E-02,
+ .1316944882273674E-01,
+ .1132524851709604E-01,
+ .3166179172694683E-02,
+ -.5532339215278626E-02,
+ -.9580074809491634E-02,
+ -.7325290236622095E-02,
+ -.1089230179786682E-02,
+ .4793671425431967E-02,
+ .6867439020425081E-02,
+ .4481043666601181E-02,
+ -.2215979620814323E-03,
+ -.4019895102828741E-02,
+ -.4728596191853285E-02,
+ -.2401810139417648E-02,
+ .1038576476275921E-02,
+ .3244197461754084E-02,
+ .2996938303112984E-02,
+ .8145328611135483E-03,
+ -.1573510002344847E-02,
+ -.2508673351258040E-02,
+ -.1464351080358028E-02,
+ .6354246288537979E-03,
+ .2120061777532101E-02,
+ .1615938264876604E-02,
+ -.9502284228801727E-03,
+ -.4247304052114487E-02,
+ -.6055080797523260E-02,
+ -.4844595678150654E-02,
+ -.1256920862942934E-02,
+ .8186036720871925E-03
diff --git a/gnuradio-core/src/lib/general/complex_vec_test.cc b/gnuradio-core/src/lib/general/complex_vec_test.cc
new file mode 100644
index 000000000..99acc2f35
--- /dev/null
+++ b/gnuradio-core/src/lib/general/complex_vec_test.cc
@@ -0,0 +1,82 @@
+#include <complex_vec_test.h>
+#include <stddef.h>
+
+std::vector<std::complex<float> >
+complex_vec_test0()
+{
+ std::vector<std::complex<float> > r(5);
+
+ for (size_t i = 0; i < r.size(); i++)
+ r[i] = std::complex<float>(i, i);
+
+ return r;
+}
+
+std::vector<std::complex<float> >
+complex_vec_test1(const std::vector<std::complex<float> > &input)
+{
+ std::vector<std::complex<float> > r(input.size());
+
+ for (size_t i = 0; i < input.size(); i++)
+ r[i] = std::complex<float>(input[i].real()+0.5, input[i].imag()-0.5);
+
+ return r;
+}
+
+std::complex<float>
+complex_scalar_test0()
+{
+ return std::complex<float>(5, 5);
+}
+
+std::complex<float>
+complex_scalar_test1(std::complex<float> input)
+{
+ return std::complex<float>(input.real()+0.5, input.imag()-0.5);
+}
+
+
+std::vector<float>
+float_vec_test0()
+{
+ std::vector<float> r(5);
+
+ for (size_t i = 0; i < r.size(); i++)
+ r[i] = (float) i;
+
+ return r;
+}
+
+std::vector<float>
+float_vec_test1(const std::vector<float> &input)
+{
+ std::vector<float> r(input.size());
+
+ for (size_t i = 0; i < input.size(); i++)
+ r[i] = input[i] + 0.5;
+
+ return r;
+}
+
+std::vector<int>
+int_vec_test0()
+{
+ std::vector<int> r(5);
+
+ for (size_t i = 0; i < r.size(); i++)
+ r[i] = (int) i;
+
+ return r;
+}
+
+std::vector<int>
+int_vec_test1(const std::vector<int> &input)
+{
+ std::vector<int> r(input.size());
+
+ for (size_t i = 0; i < input.size(); i++)
+ r[i] = input[i] + 1;
+
+ return r;
+}
+
diff --git a/gnuradio-core/src/lib/general/complex_vec_test.h b/gnuradio-core/src/lib/general/complex_vec_test.h
new file mode 100644
index 000000000..be4de41fb
--- /dev/null
+++ b/gnuradio-core/src/lib/general/complex_vec_test.h
@@ -0,0 +1,28 @@
+#include <gr_core_api.h>
+#include <vector>
+#include <complex>
+
+GR_CORE_API std::vector<std::complex<float> >
+complex_vec_test0();
+
+GR_CORE_API std::vector<std::complex<float> >
+complex_vec_test1(const std::vector<std::complex<float> > &input);
+
+GR_CORE_API std::complex<float>
+complex_scalar_test0();
+
+GR_CORE_API std::complex<float>
+complex_scalar_test1(std::complex<float> input);
+
+GR_CORE_API std::vector<int>
+int_vec_test0();
+
+GR_CORE_API std::vector<int>
+int_vec_test1(const std::vector<int> &input);
+
+GR_CORE_API std::vector<float>
+float_vec_test0();
+
+GR_CORE_API std::vector<float>
+float_vec_test1(const std::vector<float> &input);
+
diff --git a/gnuradio-core/src/lib/general/complex_vec_test.i b/gnuradio-core/src/lib/general/complex_vec_test.i
new file mode 100644
index 000000000..4b95633be
--- /dev/null
+++ b/gnuradio-core/src/lib/general/complex_vec_test.i
@@ -0,0 +1,25 @@
+
+std::vector<std::complex<float> >
+complex_vec_test0();
+
+std::vector<std::complex<float> >
+complex_vec_test1(const std::vector<std::complex<float> > &input);
+
+std::complex<float>
+complex_scalar_test0();
+
+std::complex<float>
+complex_scalar_test1(std::complex<float> input);
+
+std::vector<int>
+int_vec_test0();
+
+std::vector<int>
+int_vec_test1(const std::vector<int> &input);
+
+std::vector<float>
+float_vec_test0();
+
+std::vector<float>
+float_vec_test1(const std::vector<float> &input);
+
diff --git a/gnuradio-core/src/lib/general/gen_sine_table.py b/gnuradio-core/src/lib/general/gen_sine_table.py
new file mode 100755
index 000000000..d7d11eff1
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gen_sine_table.py
@@ -0,0 +1,77 @@
+#!/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.
+#
+
+import math
+import sys
+
+def wrap (x):
+ if x >= 2**31:
+ return x - 2**32
+ return x
+
+def gen_approx_table (f, nentries, min_x, max_x):
+ """return a list of nentries containing tuples of the form:
+ (m, c, abs_error). min_x and max_x specify the domain
+ of the table.
+ """
+ r = []
+ incx = float (max_x - min_x) / nentries
+ for i in range (nentries):
+ a = (i * incx) + min_x
+ b = ((i + 1) * incx) + min_x
+ m = (f(b)-f(a))/(b-a)
+ c = (3*a+b)*(f(a)-f(b))/(4*(b-a)) + (f((a+b)/2) + f(a))/2
+ abs_error = c+m*a-f(a)
+ r.append ((m, c, abs_error))
+ return r
+
+def scaled_sine (x):
+ return math.sin (x * math.pi / 2**31)
+
+def gen_sine_table ():
+ nbits = 10
+ nentries = 2**nbits
+
+ # min_x = -2**31
+ # max_x = 2**31-1
+ min_x = 0
+ max_x = 2**32-1
+ t = gen_approx_table (scaled_sine, nentries, min_x, max_x)
+
+ max_error = 0
+ for e in t:
+ max_error = max (max_error, abs (e[2]))
+
+ # sys.stdout.write ('static const int WORDBITS = 32;\n')
+ # sys.stdout.write ('static const int NBITS = %d;\n' % (nbits,))
+
+ sys.stdout.write (' // max_error = %22.15e\n' % (max_error,))
+
+ # sys.stdout.write ('static const double sine_table[%d][2] = {\n'% (nentries,))
+
+ for e in t:
+ sys.stdout.write (' { %22.15e, %22.15e },\n' % (2 * e[0], e[1]))
+
+ # sys.stdout.write ('};\n')
+
+if __name__ == '__main__':
+ gen_sine_table ()
diff --git a/gnuradio-core/src/lib/general/general.i b/gnuradio-core/src/lib/general/general.i
new file mode 100644
index 000000000..b727bc8a6
--- /dev/null
+++ b/gnuradio-core/src/lib/general/general.i
@@ -0,0 +1,273 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004-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.
+ */
+
+%{
+
+#include <gri_control_loop.h>
+#include <gr_nop.h>
+#include <gr_null_sink.h>
+#include <gr_null_source.h>
+#include <gr_head.h>
+#include <gr_skiphead.h>
+#include <gr_quadrature_demod_cf.h>
+#include <gr_remez.h>
+#include <gr_float_to_complex.h>
+#include <gr_check_counting_s.h>
+#include <gr_lfsr_32k_source_s.h>
+#include <gr_check_lfsr_32k_s.h>
+#include <gr_stream_to_vector.h>
+#include <gr_vector_to_stream.h>
+#include <gr_keep_one_in_n.h>
+#include <gr_keep_m_in_n.h>
+#include <gr_fft_vcc.h>
+#include <gr_fft_vfc.h>
+#include <gr_float_to_int.h>
+#include <gr_float_to_short.h>
+#include <gr_float_to_char.h>
+#include <gr_float_to_uchar.h>
+#include <gr_short_to_float.h>
+#include <gr_short_to_char.h>
+#include <gr_int_to_float.h>
+#include <gr_char_to_float.h>
+#include <gr_char_to_short.h>
+#include <gr_uchar_to_float.h>
+#include <gr_frequency_modulator_fc.h>
+#include <gr_phase_modulator_fc.h>
+#include <gr_bytes_to_syms.h>
+#include <gr_simple_correlator.h>
+#include <gr_simple_framer.h>
+#include <gr_align_on_samplenumbers_ss.h>
+#include <gr_complex_to_xxx.h>
+#include <gr_complex_to_interleaved_short.h>
+#include <gr_interleaved_short_to_complex.h>
+//#include <gr_endianness.h>
+#include <gr_endian_swap.h>
+#include <gr_firdes.h>
+#include <gr_interleave.h>
+#include <gr_deinterleave.h>
+#include <gr_delay.h>
+#include <gr_simple_squelch_cc.h>
+#include <gr_agc_ff.h>
+#include <gr_agc_cc.h>
+#include <gr_agc2_ff.h>
+#include <gr_agc2_cc.h>
+#include <gr_random_pdu.h>
+#include <gr_rms_cf.h>
+#include <gr_rms_ff.h>
+#include <gr_nlog10_ff.h>
+#include <gr_fake_channel_coder_pp.h>
+#include <gr_throttle.h>
+#include <gr_transcendental.h>
+#include <gr_stream_mux.h>
+#include <gr_stream_to_streams.h>
+#include <gr_streams_to_stream.h>
+#include <gr_streams_to_vector.h>
+#include <gr_vector_to_streams.h>
+#include <gr_conjugate_cc.h>
+#include <gr_vco_f.h>
+#include <gr_threshold_ff.h>
+#include <gr_packet_sink.h>
+#include <gr_dpll_bb.h>
+#include <gr_fmdet_cf.h>
+#include <gr_pll_freqdet_cf.h>
+#include <gr_pll_refout_cc.h>
+#include <gr_pll_carriertracking_cc.h>
+#include <gr_pn_correlator_cc.h>
+#include <gr_probe_avg_mag_sqrd_c.h>
+#include <gr_probe_avg_mag_sqrd_cf.h>
+#include <gr_probe_avg_mag_sqrd_f.h>
+#include <gr_regenerate_bb.h>
+#include <gr_pa_2x2_phase_combiner.h>
+#include <gr_kludge_copy.h>
+#include <gr_prefs.h>
+#include <gr_constants.h>
+#include <gr_test_types.h>
+#include <gr_test.h>
+#include <gr_unpack_k_bits_bb.h>
+#include <gr_pack_k_bits_bb.h>
+#include <gr_diff_phasor_cc.h>
+#include <gr_diff_encoder_bb.h>
+#include <gr_diff_decoder_bb.h>
+#include <gr_framer_sink_1.h>
+#include <gr_map_bb.h>
+#include <gr_multiply_cc.h>
+#include <gr_multiply_ff.h>
+#include <gr_multiply_const_cc.h>
+#include <gr_multiply_const_ff.h>
+#include <gr_multiply_conjugate_cc.h>
+#include <gr_feval.h>
+#include <gr_pwr_squelch_cc.h>
+#include <gr_pwr_squelch_ff.h>
+#include <gr_ctcss_squelch_ff.h>
+#include <gr_feedforward_agc_cc.h>
+#include <gr_bin_statistics_f.h>
+#include <gr_glfsr_source_b.h>
+#include <gr_glfsr_source_f.h>
+#include <gr_peak_detector2_fb.h>
+#include <gr_repeat.h>
+#include <gr_cpfsk_bc.h>
+#include <gr_encode_ccsds_27_bb.h>
+#include <gr_decode_ccsds_27_fb.h>
+#include <gr_descrambler_bb.h>
+#include <gr_scrambler_bb.h>
+#include <gr_probe_density_b.h>
+#include <gr_rail_ff.h>
+#include <gr_stretch_ff.h>
+#include <gr_copy.h>
+#include <gr_additive_scrambler_bb.h>
+#include <complex_vec_test.h>
+#include <gr_annotator_alltoall.h>
+#include <gr_annotator_1to1.h>
+#include <gr_annotator_raw.h>
+#include <gr_burst_tagger.h>
+#include <gr_cpm.h>
+#include <gr_correlate_access_code_tag_bb.h>
+#include <gr_add_ff.h>
+#include <gr_vector_map.h>
+#include <gr_tag_debug.h>
+#include <gr_message_strobe.h>
+%}
+
+%include "gri_control_loop.i"
+%include "gr_nop.i"
+%include "gr_null_sink.i"
+%include "gr_null_source.i"
+%include "gr_head.i"
+%include "gr_skiphead.i"
+%include "gr_quadrature_demod_cf.i"
+%include "gr_remez.i"
+%include "gr_float_to_complex.i"
+%include "gr_check_counting_s.i"
+%include "gr_lfsr_32k_source_s.i"
+%include "gr_check_lfsr_32k_s.i"
+%include "gr_stream_to_vector.i"
+%include "gr_vector_to_stream.i"
+%include "gr_keep_one_in_n.i"
+%include "gr_keep_m_in_n.i"
+%include "gr_fft_vcc.i"
+%include "gr_fft_vfc.i"
+%include "gr_float_to_int.i"
+%include "gr_float_to_short.i"
+%include "gr_float_to_char.i"
+%include "gr_float_to_uchar.i"
+%include "gr_short_to_float.i"
+%include "gr_short_to_char.i"
+%include "gr_int_to_float.i"
+%include "gr_char_to_float.i"
+%include "gr_char_to_short.i"
+%include "gr_uchar_to_float.i"
+%include "gr_frequency_modulator_fc.i"
+%include "gr_phase_modulator_fc.i"
+%include "gr_bytes_to_syms.i"
+%include "gr_simple_correlator.i"
+%include "gr_simple_framer.i"
+%include "gr_align_on_samplenumbers_ss.i"
+%include "gr_complex_to_xxx.i"
+%include "gr_complex_to_interleaved_short.i"
+//%include "gr_endianness.i"
+%include "gr_endian_swap.i"
+%include "gr_interleaved_short_to_complex.i"
+%include "gr_firdes.i"
+%include "gr_interleave.i"
+%include "gr_deinterleave.i"
+%include "gr_delay.i"
+%include "gr_simple_squelch_cc.i"
+%include "gr_agc_ff.i"
+%include "gr_agc_cc.i"
+%include "gr_agc2_ff.i"
+%include "gr_agc2_cc.i"
+%include "gr_random_pdu.i"
+%include "gr_rms_cf.i"
+%include "gr_rms_ff.i"
+%include "gr_nlog10_ff.i"
+%include "gr_fake_channel_coder_pp.i"
+%include "gr_throttle.i"
+%include "gr_transcendental.i"
+%include "gr_stream_mux.i"
+%include "gr_stream_to_streams.i"
+%include "gr_streams_to_stream.i"
+%include "gr_streams_to_vector.i"
+%include "gr_vector_to_streams.i"
+%include "gr_conjugate_cc.i"
+%include "gr_vco_f.i"
+%include "gr_threshold_ff.i"
+%include "gr_packet_sink.i"
+%include "gr_dpll_bb.i"
+%include "gr_fmdet_cf.i"
+%include "gr_pll_freqdet_cf.i"
+%include "gr_pll_refout_cc.i"
+%include "gr_pll_carriertracking_cc.i"
+%include "gr_pn_correlator_cc.i"
+%include "gr_probe_avg_mag_sqrd_c.i"
+%include "gr_probe_avg_mag_sqrd_cf.i"
+%include "gr_probe_avg_mag_sqrd_f.i"
+%include "gr_regenerate_bb.i"
+%include "gr_pa_2x2_phase_combiner.i"
+%include "gr_kludge_copy.i"
+%include "gr_prefs.i"
+%include "gr_constants.i"
+%include "gr_test_types.h"
+%include "gr_test.i"
+%include "gr_unpack_k_bits_bb.i"
+%include "gr_pack_k_bits_bb.i"
+%include "gr_diff_phasor_cc.i"
+%include "gr_diff_encoder_bb.i"
+%include "gr_diff_decoder_bb.i"
+%include "gr_framer_sink_1.i"
+%include "gr_map_bb.i"
+%include "gr_multiply_cc.i"
+%include "gr_multiply_ff.i"
+%include "gr_multiply_const_cc.i"
+%include "gr_multiply_const_ff.i"
+%include "gr_multiply_conjugate_cc.i"
+%include "gr_feval.i"
+%include "gr_pwr_squelch_cc.i"
+%include "gr_pwr_squelch_ff.i"
+%include "gr_ctcss_squelch_ff.i"
+%include "gr_feedforward_agc_cc.i"
+%include "gr_bin_statistics_f.i"
+%include "gr_glfsr_source_b.i"
+%include "gr_glfsr_source_f.i"
+%include "gr_peak_detector2_fb.i"
+%include "gr_repeat.i"
+%include "gr_cpfsk_bc.i"
+%include "gr_encode_ccsds_27_bb.i"
+%include "gr_decode_ccsds_27_fb.i"
+%include "gr_descrambler_bb.i"
+%include "gr_scrambler_bb.i"
+%include "gr_probe_density_b.i"
+%include "gr_rail_ff.i"
+%include "gr_stretch_ff.i"
+%include "gr_copy.i"
+%include "gr_additive_scrambler_bb.i"
+%include "complex_vec_test.i"
+%include "gr_annotator_alltoall.i"
+%include "gr_annotator_1to1.i"
+%include "gr_annotator_raw.i"
+%include "gr_burst_tagger.i"
+%include "gr_cpm.i"
+%include "gr_correlate_access_code_tag_bb.i"
+%include "gr_add_ff.i"
+%include "gr_vector_map.i"
+%include "gr_tag_debug.i"
+%include "gr_block_gateway.i"
+%include "gr_message_strobe.i"
diff --git a/gnuradio-core/src/lib/general/general_generated.i b/gnuradio-core/src/lib/general/general_generated.i
new file mode 100644
index 000000000..89b7e1776
--- /dev/null
+++ b/gnuradio-core/src/lib/general/general_generated.i
@@ -0,0 +1,166 @@
+//
+// This file is machine generated. All edits will be overwritten
+//
+%{
+#include <gr_add_cc.h>
+#include <gr_add_const_cc.h>
+#include <gr_add_const_ff.h>
+#include <gr_add_const_ii.h>
+#include <gr_add_const_sf.h>
+#include <gr_add_const_ss.h>
+#include <gr_add_const_vcc.h>
+#include <gr_add_const_vff.h>
+#include <gr_add_const_vii.h>
+#include <gr_add_const_vss.h>
+#include <gr_add_ii.h>
+#include <gr_add_ss.h>
+#include <gr_add_vcc.h>
+#include <gr_add_vff.h>
+#include <gr_add_vii.h>
+#include <gr_add_vss.h>
+#include <gr_chunks_to_symbols_bc.h>
+#include <gr_chunks_to_symbols_bf.h>
+#include <gr_chunks_to_symbols_ic.h>
+#include <gr_chunks_to_symbols_if.h>
+#include <gr_chunks_to_symbols_sc.h>
+#include <gr_chunks_to_symbols_sf.h>
+#include <gr_divide_cc.h>
+#include <gr_divide_ff.h>
+#include <gr_divide_ii.h>
+#include <gr_divide_ss.h>
+#include <gr_multiply_const_ii.h>
+#include <gr_multiply_const_ss.h>
+#include <gr_multiply_const_vcc.h>
+#include <gr_multiply_const_vff.h>
+#include <gr_multiply_const_vii.h>
+#include <gr_multiply_const_vss.h>
+#include <gr_multiply_ii.h>
+#include <gr_multiply_ss.h>
+#include <gr_multiply_vcc.h>
+#include <gr_multiply_vff.h>
+#include <gr_multiply_vii.h>
+#include <gr_multiply_vss.h>
+#include <gr_mute_cc.h>
+#include <gr_mute_ff.h>
+#include <gr_mute_ii.h>
+#include <gr_mute_ss.h>
+#include <gr_noise_source_c.h>
+#include <gr_noise_source_f.h>
+#include <gr_noise_source_i.h>
+#include <gr_noise_source_s.h>
+#include <gr_packed_to_unpacked_bb.h>
+#include <gr_packed_to_unpacked_ii.h>
+#include <gr_packed_to_unpacked_ss.h>
+#include <gr_probe_signal_b.h>
+#include <gr_probe_signal_s.h>
+#include <gr_probe_signal_i.h>
+#include <gr_probe_signal_f.h>
+#include <gr_probe_signal_c.h>
+#include <gr_probe_signal_vb.h>
+#include <gr_probe_signal_vs.h>
+#include <gr_probe_signal_vi.h>
+#include <gr_probe_signal_vf.h>
+#include <gr_probe_signal_vc.h>
+#include <gr_sig_source_c.h>
+#include <gr_sig_source_f.h>
+#include <gr_sig_source_i.h>
+#include <gr_sig_source_s.h>
+#include <gr_sub_cc.h>
+#include <gr_sub_ff.h>
+#include <gr_sub_ii.h>
+#include <gr_sub_ss.h>
+#include <gr_unpacked_to_packed_bb.h>
+#include <gr_unpacked_to_packed_ii.h>
+#include <gr_unpacked_to_packed_ss.h>
+#include <gr_vector_sink_b.h>
+#include <gr_vector_sink_c.h>
+#include <gr_vector_sink_f.h>
+#include <gr_vector_sink_i.h>
+#include <gr_vector_sink_s.h>
+#include <gr_vector_source_b.h>
+#include <gr_vector_source_c.h>
+#include <gr_vector_source_f.h>
+#include <gr_vector_source_i.h>
+#include <gr_vector_source_s.h>
+%}
+
+%include <gr_add_cc.i>
+%include <gr_add_const_cc.i>
+%include <gr_add_const_ff.i>
+%include <gr_add_const_ii.i>
+%include <gr_add_const_sf.i>
+%include <gr_add_const_ss.i>
+%include <gr_add_const_vcc.i>
+%include <gr_add_const_vff.i>
+%include <gr_add_const_vii.i>
+%include <gr_add_const_vss.i>
+%include <gr_add_ii.i>
+%include <gr_add_ss.i>
+%include <gr_add_vcc.i>
+%include <gr_add_vff.i>
+%include <gr_add_vii.i>
+%include <gr_add_vss.i>
+%include <gr_chunks_to_symbols_bc.i>
+%include <gr_chunks_to_symbols_bf.i>
+%include <gr_chunks_to_symbols_ic.i>
+%include <gr_chunks_to_symbols_if.i>
+%include <gr_chunks_to_symbols_sc.i>
+%include <gr_chunks_to_symbols_sf.i>
+%include <gr_divide_cc.i>
+%include <gr_divide_ff.i>
+%include <gr_divide_ii.i>
+%include <gr_divide_ss.i>
+%include <gr_multiply_const_ii.i>
+%include <gr_multiply_const_ss.i>
+%include <gr_multiply_const_vcc.i>
+%include <gr_multiply_const_vff.i>
+%include <gr_multiply_const_vii.i>
+%include <gr_multiply_const_vss.i>
+%include <gr_multiply_ii.i>
+%include <gr_multiply_ss.i>
+%include <gr_multiply_vcc.i>
+%include <gr_multiply_vff.i>
+%include <gr_multiply_vii.i>
+%include <gr_multiply_vss.i>
+%include <gr_mute_cc.i>
+%include <gr_mute_ff.i>
+%include <gr_mute_ii.i>
+%include <gr_mute_ss.i>
+%include <gr_noise_source_c.i>
+%include <gr_noise_source_f.i>
+%include <gr_noise_source_i.i>
+%include <gr_noise_source_s.i>
+%include <gr_packed_to_unpacked_bb.i>
+%include <gr_packed_to_unpacked_ii.i>
+%include <gr_packed_to_unpacked_ss.i>
+%include <gr_probe_signal_b.i>
+%include <gr_probe_signal_s.i>
+%include <gr_probe_signal_i.i>
+%include <gr_probe_signal_f.i>
+%include <gr_probe_signal_c.i>
+%include <gr_probe_signal_vb.i>
+%include <gr_probe_signal_vs.i>
+%include <gr_probe_signal_vi.i>
+%include <gr_probe_signal_vf.i>
+%include <gr_probe_signal_vc.i>
+%include <gr_sig_source_c.i>
+%include <gr_sig_source_f.i>
+%include <gr_sig_source_i.i>
+%include <gr_sig_source_s.i>
+%include <gr_sub_cc.i>
+%include <gr_sub_ff.i>
+%include <gr_sub_ii.i>
+%include <gr_sub_ss.i>
+%include <gr_unpacked_to_packed_bb.i>
+%include <gr_unpacked_to_packed_ii.i>
+%include <gr_unpacked_to_packed_ss.i>
+%include <gr_vector_sink_b.i>
+%include <gr_vector_sink_c.i>
+%include <gr_vector_sink_f.i>
+%include <gr_vector_sink_i.i>
+%include <gr_vector_sink_s.i>
+%include <gr_vector_source_b.i>
+%include <gr_vector_source_c.i>
+%include <gr_vector_source_f.i>
+%include <gr_vector_source_i.i>
+%include <gr_vector_source_s.i>
diff --git a/gnuradio-core/src/lib/general/gr_add_ff.cc b/gnuradio-core/src/lib/general/gr_add_ff.cc
new file mode 100644
index 000000000..5f6676bb7
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_add_ff.cc
@@ -0,0 +1,66 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_add_ff.h>
+#include <gr_io_signature.h>
+#include <volk/volk.h>
+
+gr_add_ff_sptr
+gr_make_add_ff(size_t vlen)
+{
+ return gnuradio::get_initial_sptr(new gr_add_ff(vlen));
+}
+
+gr_add_ff::gr_add_ff (size_t vlen)
+ : gr_sync_block("add_ff",
+ gr_make_io_signature (1, -1, sizeof(float)*vlen),
+ gr_make_io_signature (1, 1, sizeof(float)*vlen)),
+ d_vlen (vlen)
+{
+ const int alignment_multiple =
+ volk_get_alignment() / sizeof(float);
+ set_alignment(std::max(1,alignment_multiple));
+}
+
+int
+gr_add_ff::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ float *out = (float *) output_items[0];
+ int noi = d_vlen*noutput_items;
+
+ memcpy(out, input_items[0], noi*sizeof(float));
+ if(is_unaligned()) {
+ for(size_t i = 1; i < input_items.size(); i++)
+ volk_32f_x2_add_32f_u(out, out, (const float*)input_items[i], noi);
+ }
+ else {
+ for(size_t i = 1; i < input_items.size(); i++)
+ volk_32f_x2_add_32f_a(out, out, (const float*)input_items[i], noi);
+ }
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/general/gr_add_ff.h b/gnuradio-core/src/lib/general/gr_add_ff.h
new file mode 100644
index 000000000..ff5604c97
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_add_ff.h
@@ -0,0 +1,56 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_GR_ADD_FF_H
+#define INCLUDED_GR_ADD_FF_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+
+class gr_add_ff;
+typedef boost::shared_ptr<gr_add_ff> gr_add_ff_sptr;
+
+GR_CORE_API gr_add_ff_sptr
+gr_make_add_ff (size_t vlen=1);
+
+/*!
+ * \brief Add streams of complex values
+ * \ingroup math_blk
+ */
+
+class GR_CORE_API gr_add_ff : public gr_sync_block
+{
+ private:
+ friend GR_CORE_API gr_add_ff_sptr
+ gr_make_add_ff (size_t vlen);
+ gr_add_ff (size_t vlen);
+
+ size_t d_vlen;
+
+ public:
+ virtual int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+
+#endif /* INCLUDED_GR_ADD_FF_H */
diff --git a/gnuradio-core/src/lib/general/gr_add_ff.i b/gnuradio-core/src/lib/general/gr_add_ff.i
new file mode 100644
index 000000000..75a87651f
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_add_ff.i
@@ -0,0 +1,32 @@
+/* -*- 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,add_ff)
+
+gr_add_ff_sptr
+gr_make_add_ff (size_t vlen=1);
+
+class gr_add_ff : public gr_sync_block
+{
+public:
+
+};
diff --git a/gnuradio-core/src/lib/general/gr_additive_scrambler_bb.cc b/gnuradio-core/src/lib/general/gr_additive_scrambler_bb.cc
new file mode 100644
index 000000000..35cbb9572
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_additive_scrambler_bb.cc
@@ -0,0 +1,65 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_additive_scrambler_bb.h>
+#include <gr_io_signature.h>
+
+gr_additive_scrambler_bb_sptr
+gr_make_additive_scrambler_bb(int mask, int seed, int len, int count)
+{
+ return gnuradio::get_initial_sptr(new gr_additive_scrambler_bb(mask, seed, len, count));
+}
+
+gr_additive_scrambler_bb::gr_additive_scrambler_bb(int mask, int seed, int len, int count)
+ : gr_sync_block("additive_scrambler_bb",
+ gr_make_io_signature (1, 1, sizeof (unsigned char)),
+ gr_make_io_signature (1, 1, sizeof (unsigned char))),
+ d_lfsr(mask, seed, len),
+ d_count(count),
+ d_bits(0)
+{
+}
+
+int
+gr_additive_scrambler_bb::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const unsigned char *in = (const unsigned char *) input_items[0];
+ unsigned char *out = (unsigned char *) output_items[0];
+
+ for (int i = 0; i < noutput_items; i++) {
+ out[i] = in[i]^d_lfsr.next_bit();
+ if (d_count > 0) {
+ if (++d_bits == d_count) {
+ d_lfsr.reset();
+ d_bits = 0;
+ }
+ }
+ }
+
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/general/gr_additive_scrambler_bb.h b/gnuradio-core/src/lib/general/gr_additive_scrambler_bb.h
new file mode 100644
index 000000000..1c336306d
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_additive_scrambler_bb.h
@@ -0,0 +1,68 @@
+/* -*- 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.
+ */
+#ifndef INCLUDED_GR_ADDITIVE_SCRAMBLER_BB_H
+#define INCLUDED_GR_ADDITIVE_SCRAMBLER_BB_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+#include "gri_lfsr.h"
+
+class gr_additive_scrambler_bb;
+typedef boost::shared_ptr<gr_additive_scrambler_bb> gr_additive_scrambler_bb_sptr;
+
+GR_CORE_API gr_additive_scrambler_bb_sptr gr_make_additive_scrambler_bb(int mask, int seed, int len, int count=0);
+
+/*!
+ * Scramble an input stream using an LFSR. This block works on the LSB only
+ * of the input data stream, i.e., on an "unpacked binary" stream, and
+ * produces the same format on its output.
+ *
+ * \param mask Polynomial mask for LFSR
+ * \param seed Initial shift register contents
+ * \param len Shift register length
+ * \param count Number of bits after which shift register is reset, 0=never
+ *
+ * The scrambler works by XORing the incoming bit stream by the output of
+ * the LFSR. Optionally, after 'count' bits have been processed, the shift
+ * register is reset to the seed value. This allows processing fixed length
+ * vectors of samples.
+ *
+ * \ingroup coding_blk
+ */
+
+class GR_CORE_API gr_additive_scrambler_bb : public gr_sync_block
+{
+ friend GR_CORE_API gr_additive_scrambler_bb_sptr gr_make_additive_scrambler_bb(int mask, int seed, int len, int count);
+
+ gri_lfsr d_lfsr;
+ int d_count;
+ int d_bits;
+
+ gr_additive_scrambler_bb(int mask, int seed, int len, int count);
+
+public:
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif /* INCLUDED_GR_ADDITIVE_SCRAMBLER_BB_H */
diff --git a/gnuradio-core/src/lib/general/gr_additive_scrambler_bb.i b/gnuradio-core/src/lib/general/gr_additive_scrambler_bb.i
new file mode 100644
index 000000000..acf9e8c47
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_additive_scrambler_bb.i
@@ -0,0 +1,31 @@
+/* -*- 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,additive_scrambler_bb);
+
+gr_additive_scrambler_bb_sptr gr_make_additive_scrambler_bb(int mask, int seed, int len, int count=0);
+
+class gr_additive_scrambler_bb : public gr_sync_block
+{
+private:
+ gr_additive_scrambler_bb(int mask, int seed, int len, int count);
+};
diff --git a/gnuradio-core/src/lib/general/gr_agc2_cc.cc b/gnuradio-core/src/lib/general/gr_agc2_cc.cc
new file mode 100644
index 000000000..5097babc9
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_agc2_cc.cc
@@ -0,0 +1,56 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_agc2_cc.h>
+#include <gr_io_signature.h>
+#include <gri_agc2_cc.h>
+
+gr_agc2_cc_sptr
+gr_make_agc2_cc (float attack_rate, float decay_rate, float reference,
+ float gain, float max_gain)
+{
+ return gnuradio::get_initial_sptr(new gr_agc2_cc (attack_rate, decay_rate, reference, gain, max_gain));
+}
+
+gr_agc2_cc::gr_agc2_cc (float attack_rate, float decay_rate, float reference,
+ float gain, float max_gain)
+ : gr_sync_block ("gr_agc2_cc",
+ gr_make_io_signature (1, 1, sizeof (gr_complex)),
+ gr_make_io_signature (1, 1, sizeof (gr_complex))),
+ gri_agc2_cc (attack_rate, decay_rate, reference, gain, max_gain)
+{
+}
+
+int
+gr_agc2_cc::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const gr_complex *in = (const gr_complex *) input_items[0];
+ gr_complex *out = (gr_complex *) output_items[0];
+ scaleN (out, in, noutput_items);
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/general/gr_agc2_cc.h b/gnuradio-core/src/lib/general/gr_agc2_cc.h
new file mode 100644
index 000000000..54bae1aae
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_agc2_cc.h
@@ -0,0 +1,56 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_GR_AGC2_CC_H
+#define INCLUDED_GR_AGC2_CC_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+#include <gri_agc2_cc.h>
+
+class gr_agc2_cc;
+typedef boost::shared_ptr<gr_agc2_cc> gr_agc2_cc_sptr;
+
+GR_CORE_API gr_agc2_cc_sptr
+gr_make_agc2_cc (float attack_rate = 1e-1, float decay_rate = 1e-2, float reference = 1.0,
+ float gain = 1.0, float max_gain = 0.0);
+/*!
+ * \brief high performance Automatic Gain Control class
+ * \ingroup level_blk
+ *
+ * For Power the absolute value of the complex number is used.
+ */
+
+class GR_CORE_API gr_agc2_cc : public gr_sync_block, public gri_agc2_cc
+{
+ friend GR_CORE_API gr_agc2_cc_sptr gr_make_agc2_cc (float attack_rate, float decay_rate, float reference,
+ float gain, float max_gain);
+ gr_agc2_cc (float attack_rate, float decay_rate, float reference,
+ float gain, float max_gain);
+
+ public:
+ virtual int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif /* INCLUDED_GR_AGC2_CC_H */
diff --git a/gnuradio-core/src/lib/general/gr_agc2_cc.i b/gnuradio-core/src/lib/general/gr_agc2_cc.i
new file mode 100644
index 000000000..6d7b22101
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_agc2_cc.i
@@ -0,0 +1,35 @@
+/* -*- 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,agc2_cc)
+
+%include <gri_agc2_cc.i>
+
+gr_agc2_cc_sptr
+gr_make_agc2_cc (float attack_rate = 1e-1, float decay_rate = 1e-2, float reference = 1.0,
+ float gain = 1.0, float max_gain = 0.0);
+
+class gr_agc2_cc : public gr_sync_block , public gri_agc2_cc
+{
+ gr_agc2_cc (float attack_rate, float decay_rate, float reference,
+ float gain, float max_gain);
+};
diff --git a/gnuradio-core/src/lib/general/gr_agc2_ff.cc b/gnuradio-core/src/lib/general/gr_agc2_ff.cc
new file mode 100644
index 000000000..792ee1c6b
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_agc2_ff.cc
@@ -0,0 +1,57 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_agc2_ff.h>
+#include <gr_io_signature.h>
+#include <gri_agc2_ff.h>
+
+gr_agc2_ff_sptr
+gr_make_agc2_ff (float attack_rate, float decay_rate, float reference,
+ float gain, float max_gain)
+{
+ return gnuradio::get_initial_sptr(new gr_agc2_ff (attack_rate, decay_rate, reference,
+ gain, max_gain));
+}
+
+gr_agc2_ff::gr_agc2_ff (float attack_rate, float decay_rate, float reference,
+ float gain, float max_gain)
+ : gr_sync_block ("gr_agc2_ff",
+ gr_make_io_signature (1, 1, sizeof (float)),
+ gr_make_io_signature (1, 1, sizeof (float)))
+ , gri_agc2_ff (attack_rate, decay_rate, reference, gain, max_gain)
+{
+}
+
+int
+gr_agc2_ff::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const float *in = (const float *) input_items[0];
+ float *out = (float *) output_items[0];
+ scaleN (out, in, noutput_items);
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/general/gr_agc2_ff.h b/gnuradio-core/src/lib/general/gr_agc2_ff.h
new file mode 100644
index 000000000..48529948c
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_agc2_ff.h
@@ -0,0 +1,54 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005,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.
+ */
+
+#ifndef INCLUDED_GR_AGC2_FF_H
+#define INCLUDED_GR_AGC2_FF_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+#include <gri_agc2_ff.h>
+class gr_agc2_ff;
+typedef boost::shared_ptr<gr_agc2_ff> gr_agc2_ff_sptr;
+
+GR_CORE_API gr_agc2_ff_sptr
+gr_make_agc2_ff (float attack_rate = 1e-1, float decay_rate = 1e-2, float reference = 1.0,
+ float gain = 1.0, float max_gain = 0.0);
+/*!
+ * \brief high performance Automatic Gain Control class
+ *
+ * \ingroup level_blk
+ * Power is approximated by absolute value
+ */
+
+class GR_CORE_API gr_agc2_ff : public gr_sync_block, public gri_agc2_ff
+{
+ friend GR_CORE_API gr_agc2_ff_sptr gr_make_agc2_ff (float attack_rate, float decay_rate,
+ float reference, float gain, float max_gain);
+ gr_agc2_ff (float attack_rate, float decay_rate, float reference, float gain, float max_gain);
+
+ public:
+ virtual int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif /* INCLUDED_GR_FLOAT_AGC2_FF_H */
diff --git a/gnuradio-core/src/lib/general/gr_agc2_ff.i b/gnuradio-core/src/lib/general/gr_agc2_ff.i
new file mode 100644
index 000000000..646391aa7
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_agc2_ff.i
@@ -0,0 +1,35 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005,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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,agc2_ff)
+
+%include <gri_agc2_ff.i>
+
+gr_agc2_ff_sptr
+gr_make_agc2_ff (float attack_rate = 1e-1, float decay_rate = 1e-2, float reference = 1.0,
+ float gain = 1.0, float max_gain = 0.0);
+
+class gr_agc2_ff : public gr_sync_block , public gri_agc2_ff
+{
+ gr_agc2_ff (float attack_rate, float decay_rate, float reference,
+ float gain, float max_gain);
+};
diff --git a/gnuradio-core/src/lib/general/gr_agc_cc.cc b/gnuradio-core/src/lib/general/gr_agc_cc.cc
new file mode 100644
index 000000000..e98f3a303
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_agc_cc.cc
@@ -0,0 +1,56 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_agc_cc.h>
+#include <gr_io_signature.h>
+#include <gri_agc_cc.h>
+
+gr_agc_cc_sptr
+gr_make_agc_cc (float rate, float reference,
+ float gain, float max_gain)
+{
+ return gnuradio::get_initial_sptr(new gr_agc_cc (rate, reference, gain, max_gain));
+}
+
+gr_agc_cc::gr_agc_cc (float rate, float reference,
+ float gain, float max_gain)
+ : gr_sync_block ("gr_agc_cc",
+ gr_make_io_signature (1, 1, sizeof (gr_complex)),
+ gr_make_io_signature (1, 1, sizeof (gr_complex))),
+ gri_agc_cc (rate, reference, gain, max_gain)
+{
+}
+
+int
+gr_agc_cc::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const gr_complex *in = (const gr_complex *) input_items[0];
+ gr_complex *out = (gr_complex *) output_items[0];
+ scaleN (out, in, noutput_items);
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/general/gr_agc_cc.h b/gnuradio-core/src/lib/general/gr_agc_cc.h
new file mode 100644
index 000000000..9f35350db
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_agc_cc.h
@@ -0,0 +1,55 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_GR_AGC_CC_H
+#define INCLUDED_GR_AGC_CC_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+#include <gri_agc_cc.h>
+class gr_agc_cc;
+typedef boost::shared_ptr<gr_agc_cc> gr_agc_cc_sptr;
+
+GR_CORE_API gr_agc_cc_sptr
+gr_make_agc_cc (float rate = 1e-4, float reference = 1.0,
+ float gain = 1.0, float max_gain = 0.0);
+/*!
+ * \brief high performance Automatic Gain Control class
+ * \ingroup level_blk
+ *
+ * For Power the absolute value of the complex number is used.
+ */
+
+class GR_CORE_API gr_agc_cc : public gr_sync_block, public gri_agc_cc
+{
+ friend GR_CORE_API gr_agc_cc_sptr gr_make_agc_cc (float rate, float reference,
+ float gain, float max_gain);
+ gr_agc_cc (float rate, float reference,
+ float gain, float max_gain);
+
+ public:
+ virtual int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif /* INCLUDED_GR_AGC_CC_H */
diff --git a/gnuradio-core/src/lib/general/gr_agc_cc.i b/gnuradio-core/src/lib/general/gr_agc_cc.i
new file mode 100644
index 000000000..f942713b0
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_agc_cc.i
@@ -0,0 +1,35 @@
+/* -*- 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,agc_cc)
+
+%include <gri_agc_cc.i>
+
+gr_agc_cc_sptr
+gr_make_agc_cc (float rate = 1e-4, float reference = 1.0,
+ float gain = 1.0, float max_gain = 0.0);
+
+class gr_agc_cc : public gr_sync_block , public gri_agc_cc
+{
+ gr_agc_cc (float rate, float reference,
+ float gain, float max_gain);
+};
diff --git a/gnuradio-core/src/lib/general/gr_agc_ff.cc b/gnuradio-core/src/lib/general/gr_agc_ff.cc
new file mode 100644
index 000000000..6050dc7f0
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_agc_ff.cc
@@ -0,0 +1,54 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_agc_ff.h>
+#include <gr_io_signature.h>
+#include <gri_agc_ff.h>
+
+gr_agc_ff_sptr
+gr_make_agc_ff (float rate, float reference, float gain, float max_gain)
+{
+ return gnuradio::get_initial_sptr(new gr_agc_ff (rate, reference, gain, max_gain));
+}
+
+gr_agc_ff::gr_agc_ff (float rate, float reference, float gain, float max_gain)
+ : gr_sync_block ("gr_agc_ff",
+ gr_make_io_signature (1, 1, sizeof (float)),
+ gr_make_io_signature (1, 1, sizeof (float)))
+ , gri_agc_ff (rate, reference, gain, max_gain)
+{
+}
+
+int
+gr_agc_ff::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const float *in = (const float *) input_items[0];
+ float *out = (float *) output_items[0];
+ scaleN (out, in, noutput_items);
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/general/gr_agc_ff.h b/gnuradio-core/src/lib/general/gr_agc_ff.h
new file mode 100644
index 000000000..dc618213b
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_agc_ff.h
@@ -0,0 +1,55 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005,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.
+ */
+
+#ifndef INCLUDED_GR_AGC_FF_H
+#define INCLUDED_GR_AGC_FF_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+#include <gri_agc_ff.h>
+class gr_agc_ff;
+typedef boost::shared_ptr<gr_agc_ff> gr_agc_ff_sptr;
+
+GR_CORE_API gr_agc_ff_sptr
+gr_make_agc_ff (float rate = 1e-4, float reference = 1.0,
+ float gain = 1.0, float max_gain = 0.0);
+
+/*!
+ * \brief high performance Automatic Gain Control class
+ * \ingroup level_blk
+ *
+ * Power is approximated by absolute value
+ */
+
+class GR_CORE_API gr_agc_ff : public gr_sync_block, public gri_agc_ff
+{
+ friend GR_CORE_API gr_agc_ff_sptr gr_make_agc_ff (float rate, float reference,
+ float gain, float max_gain);
+ gr_agc_ff (float rate, float reference, float gain, float max_gain);
+
+ public:
+ virtual int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif /* INCLUDED_GR_FLOAT_AGC_FF_H */
diff --git a/gnuradio-core/src/lib/general/gr_agc_ff.i b/gnuradio-core/src/lib/general/gr_agc_ff.i
new file mode 100644
index 000000000..03c571e1a
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_agc_ff.i
@@ -0,0 +1,34 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005,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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,agc_ff)
+
+%include <gri_agc_ff.i>
+
+gr_agc_ff_sptr
+gr_make_agc_ff (float rate = 1e-4, float reference = 1.0,
+ float gain = 1.0, float max_gain = 0.0);
+
+class gr_agc_ff : public gr_sync_block , public gri_agc_ff
+{
+ gr_agc_ff (float rate, float reference, float gain, float max_gain);
+};
diff --git a/gnuradio-core/src/lib/general/gr_align_on_samplenumbers_ss.cc b/gnuradio-core/src/lib/general/gr_align_on_samplenumbers_ss.cc
new file mode 100644
index 000000000..472853396
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_align_on_samplenumbers_ss.cc
@@ -0,0 +1,464 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_align_on_samplenumbers_ss.h>
+#include <gr_io_signature.h>
+#include <assert.h>
+#include <stdexcept>
+#include <string.h>
+#include <cstdio>
+
+//define ALIGN_ADVANCED_IMPLEMENTATION to have an alternative implementation of the align algoritm which exactly follows the align_interval spec.
+//It is more resource intensive, less tested and probably not needed
+//define ALIGN_ADVANCED_IMPLEMENTATION
+
+//define DEBUG_TOCONSUME to see debug messages about the synchronisation part of this block
+//define DEBUG_TOCONSUME
+#ifdef DEBUG_TOCONSUME
+#define tcPrintf if(dprint) printf
+#else
+#define tcPrintf //printf
+#endif
+
+#define ePrintf printf
+
+gr_align_on_samplenumbers_ss_sptr
+gr_make_align_on_samplenumbers_ss (int nchan, int align_interval)
+{
+ return gnuradio::get_initial_sptr(new gr_align_on_samplenumbers_ss (nchan,align_interval));
+}
+
+gr_align_on_samplenumbers_ss::gr_align_on_samplenumbers_ss (int nchan,int align_interval)
+ : gr_block ("align_on_samplenumbers_ss",
+ gr_make_io_signature (2, -1, sizeof (short)), //2, -1
+ gr_make_io_signature (2, -1, sizeof (short))), //2,-1
+ d_align_interval (align_interval),
+ d_nchan(nchan),
+ d_ninputs(0)
+{
+ if (d_align_interval<0)
+ set_output_multiple (d_nchan*2);
+ else
+ {
+ set_output_multiple (d_align_interval*d_nchan*2);
+ }
+
+}
+
+gr_align_on_samplenumbers_ss::~gr_align_on_samplenumbers_ss()
+{
+
+}
+void
+gr_align_on_samplenumbers_ss::forecast (int noutput_items, gr_vector_int &ninput_items_required)
+{
+ //assert (0 == noutput_items % d_align_interval);
+ unsigned ninputs = ninput_items_required.size();
+ for (unsigned int i = 0; i < ninputs; i++)
+ ninput_items_required[i] = std::max(noutput_items*d_nchan*2+ history() - 1,1024*d_nchan*2+ history() - 1);//TODO include the diffs found in determine input_items_required
+}
+
+bool
+gr_align_on_samplenumbers_ss::check_topology (int ninputs, int noutputs)
+{
+ bool result=true;
+ if(noutputs!=ninputs)
+ {
+ result=false;
+ ePrintf("gr_align_on_samplenumbers_ss: ERROR noutputs %i != ninputs %i\n",noutputs,ninputs);
+ }
+ if(d_nchan<2)
+ {
+ result=false;
+ ePrintf("gr_align_on_samplenumbers_ss: ERROR nchan %i<2 \n",d_nchan);
+ }
+ if((int)d_ninputs!=ninputs)
+ {
+ //Only resize and reset the status if there really changed something
+ //Don't reset the status if the user just called stop() and start(), although maybe we should.
+ d_state.resize(ninputs);
+ d_ninputs=ninputs;
+ for(unsigned int i=0;i<d_ninputs;i++)
+ {
+ d_state[i].sync_found=false;
+ d_state[i].sync_end_found=false;
+ }
+ d_in_presync=false;
+ }
+ return result;
+}
+
+#ifdef ALIGN_ADVANCED_IMPLEMENTATION
+int
+gr_align_on_samplenumbers_ss::general_work (int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+#ifdef DEBUG_TOCONSUME
+ static int dcount=0;
+ bool dprint=false;
+ dcount++;
+ if(dcount>200)
+ {
+ dcount=0;
+ dprint=true;
+ }
+#endif
+ const size_t item_size = output_signature()->sizeof_stream_item (0);
+ const unsigned ninputs = input_items.size();
+ const unsigned noutputs = output_items.size();
+
+ int align_interval=d_align_interval*2*d_nchan;
+ if(d_align_interval<0)
+ {
+ //align once per noutput_items
+ align_interval=noutput_items;
+ align_interval=align_interval/(2*d_nchan);
+ align_interval=align_interval*(2*d_nchan);
+ }
+
+ int min_ninput_items=noutput_items;//numeric_limits<int>::max();
+ int noutput_items_produced=0;
+ for(unsigned int i=0;i<ninputs;i++)
+ {
+ d_state[i].ninput_items=ninput_items[i];
+ d_state[i].ninput_items_used=0;
+ min_ninput_items=std::min(ninput_items[i],min_ninput_items);
+ }
+ for(int j=0;j<noutput_items-align_interval+1;j+=align_interval)
+ {
+ int common_end;
+ if(min_ninput_items>=align_interval)
+ common_end=align_interval;
+ else
+ {
+ common_end=min_ninput_items/(d_nchan*2);
+ common_end=common_end*(d_nchan*2);
+ }
+ if (common_end<=0) break;
+
+ bool all_diffs_zero=true;
+ //bool sync_found=false;
+ int diff_comp_end_max=0;
+ for(unsigned int i=0;i<ninputs;i++)
+ {
+ unsigned short * uin=&(((unsigned short*)input_items[i])[d_state[i].ninput_items_used]);
+ unsigned int x_high16bits = uin[0];
+ unsigned int x_low16bits = uin[1];
+ d_state[i].ucounter_begin = x_high16bits<<16 | x_low16bits;
+ d_state[i].diff=d_state[0].ucounter_begin-d_state[i].ucounter_begin;//Result is a signed value,Will wrap around on 32 bit boundary
+ int common_last=std::max(common_end-d_nchan*2,0);
+ x_high16bits = uin[d_nchan*2];
+ x_low16bits = uin[d_nchan*2+1];
+ unsigned int ucounter_begin2 = x_high16bits<<16 | x_low16bits;
+#ifdef DEBUG_TOCONSUME
+ if((d_state[i].ucounter_begin+1)!=(ucounter_begin2))
+ if(ucounter_begin2==0)
+ ePrintf("SYNC counters are 0\n");
+ else
+ ePrintf("Error: counter not continuous.\n ucounter_begin[%i]=%i +1 != ucounter_begin2=%i\n",i,d_state[i].ucounter_begin,ucounter_begin2);
+#endif
+ x_high16bits = uin[common_last];
+ x_low16bits = uin[common_last+1];
+ d_state[i].ucounter_end = x_high16bits<<16 | x_low16bits;
+ d_state[i].diff_end=d_state[0].ucounter_end-d_state[i].ucounter_end;//Result is a signed value,Will wrap around on 32 bit boundary
+ d_state[i].diff_comp_end=d_state[i].ucounter_end-d_state[0].ucounter_end;
+ diff_comp_end_max=std::max(d_state[i].diff_comp_end,diff_comp_end_max);
+#ifdef DEBUG_TOCONSUME
+ if(d_state[i].diff>256000000 || d_state[i].diff_end>256000000 || d_state[i].diff_comp_end>256000000)
+ {
+ tcPrintf("diff[%i]=%i diff_end=%i diff_comp_end=%i\n",i,d_state[i].diff,d_state[i].diff_end,d_state[i].diff_comp_end);
+ }
+#endif
+ all_diffs_zero=all_diffs_zero && (0==d_state[i].diff_end);
+ if(d_state[i].ucounter_end<d_state[i].ucounter_begin+(unsigned)(common_last/(d_nchan*2))) //(unsigned)(common_last/(d_nchan*2)))
+ {
+ //printf("sync 1 ");// found ucounter_end[%i]=%i ucounter_begin[%i]=%i \n",i,d_state[i].ucounter_end,i,d_state[i].ucounter_begin);
+ //sync_found=true;//sync_found or 32 bit counter wraparound (0xffffffff -> 0x00000000)
+ if(!d_in_presync)
+ {
+#ifdef DEBUG_TOCONSUME
+ printf("presync START with %i\n",i);
+#endif
+ for(unsigned int k=0;k<ninputs;k++)
+ {
+ d_state[k].sync_found=false;
+ d_state[i].sync_end_found=false;
+ }
+ d_in_presync=true;
+ d_state[i].sync_found=true;
+ } else
+ {
+ //d_in_presync=true;
+#ifdef DEBUG_TOCONSUME
+ if(d_state[i].sync_found)
+ printf("presync CONTINUE with %i\n",i);
+ else
+ printf("presync NEXT with %i\n",i);
+#endif
+ d_state[i].sync_found=true;
+ d_state[i].sync_end_found=false;
+ }
+ } else
+ {
+ if(d_in_presync && d_state[i].sync_found)
+ {
+ d_state[i].sync_end_found=true;
+ bool all_syncs_found=true;
+ for(unsigned int k=0;k<ninputs;k++)
+ all_syncs_found=all_syncs_found && d_state[k].sync_end_found;
+ d_in_presync=!all_syncs_found;
+ if(!d_in_presync)
+ {
+ for(unsigned int k=0;k<ninputs;k++)
+ {
+ d_state[k].sync_found=false;
+ d_state[i].sync_end_found=false;
+ }
+#ifdef DEBUG_TOCONSUME
+ printf("presync END\n");
+#endif
+ }
+ }
+ }
+ }
+ if(d_in_presync || all_diffs_zero)
+ {
+ for(unsigned int i=0;i<ninputs;i++)
+ {
+ memcpy(&(((unsigned short*)output_items[i])[j]),&(((const unsigned short*)input_items[i])[d_state[i].ninput_items_used]),common_end*item_size);
+ //consume(i,common_end);
+ d_state[i].ninput_items-=common_end;
+ d_state[i].ninput_items_used+=common_end;
+ min_ninput_items=std::min(d_state[i].ninput_items,min_ninput_items);
+#ifdef DEBUG_TOCONSUME
+ if(common_end<256)
+ tcPrintf("common_end %i\n",common_end);
+#endif
+ }
+ //min_ninput_items-=common_end;
+ noutput_items_produced+=common_end;
+ //return common_end;
+ } else
+ {
+ //printf("sync 2");
+ for(unsigned int i=0;i<ninputs;i++)
+ {
+ int toconsume=std::min((d_state[i].diff_end+diff_comp_end_max)*d_nchan*2,d_state[i].ninput_items);
+ toconsume=toconsume/(d_nchan*2);
+ toconsume=toconsume*(d_nchan*2);
+ d_state[i].ninput_items-=toconsume;
+ d_state[i].ninput_items_used+=toconsume;
+ min_ninput_items=std::min(d_state[i].ninput_items,min_ninput_items);
+#ifdef DEBUG_TOCONSUME
+ static int toconsume_counter=0;
+ toconsume_counter++;
+ //if(toconsume_counter>10)
+ {
+ tcPrintf("toconsume=%i diff_end[%i]*d_nchan*2=%i diff_comp_end_max*d_nchan*2=%i ninput_items[%i]=%i\n",toconsume,i,d_state[i].diff_end*d_nchan*2,diff_comp_end_max*d_nchan*2,i,ninput_items[i]);
+ toconsume_counter=0;
+ }
+#endif
+ //printf("toconsume[%i]=%i\n",i,toconsume);
+ //consume(i,toconsume);//skip the difference in samplenumber items
+ }
+ //return 0;
+ }
+ }
+ for(unsigned int i=0;i<ninputs;i++)
+ consume(i,d_state[i].ninput_items_used);
+#ifdef DEBUG_TOCONSUME
+ if(noutput_items_produced<256)
+ tcPrintf("noutput_items_produced %i\n",noutput_items_produced);
+#endif
+ return noutput_items_produced;
+}
+
+
+#else /*ALIGN_ADVANCED_IMPLEMENTATION*/
+int
+gr_align_on_samplenumbers_ss::general_work (int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+#ifdef DEBUG_TOCONSUME
+ static int dcount=0;
+ bool dprint=false;
+ dcount++;
+ if(dcount>2000)
+ {
+ dcount=0;
+ dprint=true;
+ }
+#endif
+ const size_t item_size = output_signature()->sizeof_stream_item (0);
+ const unsigned ninputs = input_items.size();
+
+ int common_end=noutput_items;
+ //int diff_min=INT_MAX;
+ //int diff_max=INT_MIN;
+ for(unsigned int i=0;i<ninputs;i++)
+ {
+ unsigned short * uin=(unsigned short*)input_items[i];
+ unsigned int x_high16bits = uin[0];
+ unsigned int x_low16bits = uin[1];
+ d_state[i].ucounter_begin = x_high16bits<<16 | x_low16bits;
+ d_state[i].diff=d_state[0].ucounter_end-d_state[i].ucounter_end;//Result is a signed value,Will wrap around on 32 bit boundary
+ x_high16bits = uin[d_nchan*2];
+ x_low16bits = uin[d_nchan*2+1];
+ unsigned int ucounter_begin2 = x_high16bits<<16 | x_low16bits;
+ if((d_state[i].ucounter_begin+1)!=(ucounter_begin2)){
+ if(ucounter_begin2==0)
+ {
+#ifdef DEBUG_TOCONSUME
+ ePrintf("SYNC counters are 0\n");
+#endif
+ }
+ else
+ {
+ ePrintf("Error: counter not continuous.\n ucounter_begin[%i]=%i +1 != ucounter_begin2=%i\n",i,d_state[i].ucounter_begin,ucounter_begin2);
+ }
+ }
+
+ //diff_comp[i]=ucounter[i]-ucounter[0];
+ //diff_min=std::min(diff[i],diff_min);
+ //diff_max=std::max(diff[i],diff_max);
+ common_end=std::max(std::min(ninput_items[i],common_end),0);
+ }
+ common_end=common_end/(d_nchan*2);
+ common_end=common_end*(d_nchan*2);
+#ifdef DEBUG_TOCONSUME
+ if(common_end<d_nchan*2)
+ {
+ printf(" common_end %i\n",common_end);
+ for(int j=0;j<ninputs;j++)
+ printf("ninput_items[%i]=%i\n",j,ninput_items[j]);
+ }
+#endif
+ bool all_diffs_zero=true;
+ bool sync_found=false;
+ int diff_comp_end_max=0;
+ for(unsigned int i=0;i<ninputs;i++)
+ {
+ unsigned short * uin=(unsigned short*)input_items[i];
+ int common_last=common_end-(d_nchan*2);
+ unsigned int x_high16bits = uin[common_last];
+ unsigned int x_low16bits = uin[common_last+1];
+ d_state[i].ucounter_end = x_high16bits<<16 | x_low16bits;
+ d_state[i].diff_end=d_state[0].ucounter_end-d_state[i].ucounter_end;//Result is a signed value,Will wrap around on 32 bit boundary
+ d_state[i].diff_comp_end=d_state[i].ucounter_end-d_state[0].ucounter_end;
+ //diff_end_min=std::min(diff_end[i],diff_end_min);
+ //diff_end_max=std::max(diff_end[i],diff_end_max);
+ diff_comp_end_max=std::max(d_state[i].diff_comp_end,diff_comp_end_max);
+#ifdef DEBUG_TOCONSUME
+ if(d_state[i].diff_end!=d_state[i].diff)
+ {
+ //samples_lost_or_syncstart=true;
+ printf("Us%i %i %i ",i,d_state[i].diff_end,d_state[i].diff);
+ }
+#endif
+ all_diffs_zero=all_diffs_zero && (0==d_state[i].diff_end);
+ if((d_state[i].ucounter_end<d_state[i].ucounter_begin+(unsigned)(common_last/(d_nchan*2))) || (0==d_state[i].ucounter_end) || (0==d_state[i].ucounter_begin)) //(unsigned)(common_last/(d_nchan*2)))
+ {
+ sync_found=true;//sync_found or 32 bit counter wraparound (0xffffffff -> 0x00000000)
+#ifdef DEBUG_TOCONSUME
+ tcPrintf("SYNC diff_end[%i]=%i ucounter_end[%i]=%i ucounter_begin[%i]=%i \n",i,d_state[i].diff_end,i,d_state[i].ucounter_end,i,d_state[i].ucounter_begin);
+ tcPrintf("ucounter_end=%i < %i = ucounter_begin+(unsigned)(common_last/(d_nchan*2) \n",d_state[i].ucounter_end,d_state[i].ucounter_begin+(unsigned)(common_last/(d_nchan*2)));
+
+ printf("ucounter_end[%i]=%i ucounter_begin[%i]=%i\n",i,d_state[i].ucounter_end,i,d_state[i].ucounter_begin);
+ int expected_sync_position=common_last - d_state[i].ucounter_end*(d_nchan*2);
+ if(0==uin[expected_sync_position] && 0==uin[expected_sync_position+1])
+ {
+ printf("sync found on input %i at position %i \n",i,expected_sync_position);
+ //sync_start[i]=expected_sync_position;
+ } else
+ {
+ printf("sync found on input %i position unclear, expected at %i value there %i\n",i,expected_sync_position,uin[expected_sync_position]<<16 | uin[expected_sync_position+1]);
+ //sync_start[i]=-1;
+ }
+ } else
+ {
+ tcPrintf("NOsync diff_end[%i]=%i ucounter_end[%i]=%i ucounter_begin[%i]=%i \n",i,d_state[i].diff_end,i,d_state[i].ucounter_end,i,d_state[i].ucounter_begin);
+#endif
+ }
+ }
+ bool problem=false;
+ for(unsigned int i=0;i<ninputs;i++)
+ if((d_state[i].diff_end+diff_comp_end_max) >0x4000000)
+ {
+ problem=true;
+ ePrintf("Warning: counter diff greater as 64 Million\n");
+ ePrintf(" You might want to swap master and slave.\n");
+ ePrintf(" i=%i,d_state[i].diff_end+diff_comp_end_max=%i,d_state[i].diff_end=%i,diff_comp_end_max=%i,ucounter[i]=%i,ucounter[0]=%i\n",
+ i,d_state[i].diff_end+diff_comp_end_max,d_state[i].diff_end,diff_comp_end_max,d_state[i].ucounter_end,d_state[0].ucounter_end);
+ //ePrintf(" toconsume=%i\n",toconsume);
+ }
+ if(sync_found || all_diffs_zero || problem)
+ {
+#ifdef DEBUG_TOCONSUME
+ if(all_diffs_zero) tcPrintf("ZERO\n");
+ if(sync_found) tcPrintf("SYNC\n");
+#endif
+ for(unsigned int i=0;i<ninputs;i++)
+ {
+ memcpy(output_items[i],input_items[i],common_end*item_size);
+ consume(i,common_end);
+#ifdef DEBUG_TOCONSUME
+ if(common_end<256)
+ tcPrintf("common_end %i\n",common_end);
+#endif
+ }
+ return common_end;
+ } else
+ {
+ //int minconsume=0;//common_end/(2*d_nchan*2);
+ //min_consume=min_consume*d_nchan*2;
+ for(unsigned int i=0;i<ninputs;i++)
+ {
+ int toconsume=std::min((d_state[i].diff_end+diff_comp_end_max)*d_nchan*2,ninput_items[i]);
+ toconsume=toconsume/(d_nchan*2);
+ toconsume=toconsume*(d_nchan*2);
+#ifdef DEBUG_TOCONSUME
+ //printf("dcount %i\n",dcount);
+ static int toconsume_counter=0;
+ toconsume_counter++;
+ //if(toconsume_counter>10)
+ {
+ tcPrintf("toconsume=%i diff_end[[%i]*d_nchan*2=%i diff_comp_end_max)*d_nchan*2=%i ninput_items[%i]=%i\n",
+ toconsume,i,d_state[i].diff_end*d_nchan*2,diff_comp_end_max*d_nchan*2,i,ninput_items[i]);
+ toconsume_counter=0;
+ }
+#endif
+ consume(i,toconsume);//skip the difference in samplenumber items
+ //printf("toconsume%i %i diff_comp_end_max %i diff_end[[%i] %i\n",i,toconsume,diff_comp_end_max,i,d_state[i].diff_end);
+ }
+ return 0;
+ }
+ return -1;//Should never come here
+}
+#endif /*ALIGN_ADVANCED_IMPLEMENTATION*/
diff --git a/gnuradio-core/src/lib/general/gr_align_on_samplenumbers_ss.h b/gnuradio-core/src/lib/general/gr_align_on_samplenumbers_ss.h
new file mode 100644
index 000000000..1b71a3f4b
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_align_on_samplenumbers_ss.h
@@ -0,0 +1,92 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005 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_ALIGN_ON_SAMPLE_NUMBERS_SS_H
+#define INCLUDED_GR_ALIGN_ON_SAMPLE_NUMBERS_SS_H
+
+#include <gr_core_api.h>
+#include <gr_block.h>
+
+/*!
+ * \brief align several complex short (interleaved short) input channels with corresponding unsigned 32 bit sample_counters (provided as interleaved 16 bit values)
+ * \ingroup misc
+ * \param number of complex_short input channels (including the 32 bit counting channel)
+ * \param align_interval is after how much samples (minimally) the sample-alignement is refreshed. Default is 128.
+ * A bigger value means less processing power but also requests more buffer space, which has a maximum.
+ * Decrease the align_interval if you get an error like:
+ * "sched: <gr_block align_on_samplenumbers_ss (0)> is requesting more input data than we can provide.
+ * ninput_items_required = 32768
+ * max_possible_items_available = 16383
+ * If this is a filter, consider reducing the number of taps."
+ * \ingroup block
+ * Pay attention on how you connect this block.
+ * It expects a minimum of 2 usrp_source_s with nchan number of channels and FPGA_MODE_COUNTING_32BIT enabled.
+ * This means that the first complex_short channel on every input is an interleaved 32 bit counter.
+ * The samples are aligned by dropping samples untill the samplenumbers match.
+ */
+class gr_align_on_samplenumbers_ss;
+typedef boost::shared_ptr<gr_align_on_samplenumbers_ss> gr_align_on_samplenumbers_ss_sptr;
+
+GR_CORE_API gr_align_on_samplenumbers_ss_sptr gr_make_align_on_samplenumbers_ss (int nchan=2, int align_interval=128);
+
+
+
+
+class GR_CORE_API gr_align_on_samplenumbers_ss : public gr_block
+{
+ int d_align_interval;
+ int d_sample_counter;
+ int d_nchan;
+ bool d_in_presync;
+ unsigned int d_ninputs;
+ class GR_CORE_API align_state {
+ public:
+ unsigned int ucounter_end;
+ unsigned int ucounter_begin;
+ int diff;
+ int diff_comp;
+ int diff_end;
+ int diff_comp_end;
+ bool sync_found;
+ bool sync_end_found;
+ int ninput_items;
+ int ninput_items_used;
+ };
+ std::vector<align_state> d_state;
+
+ friend GR_CORE_API gr_align_on_samplenumbers_ss_sptr gr_make_align_on_samplenumbers_ss (int nchan,int align_interval);
+ gr_align_on_samplenumbers_ss (int nchan,int align_interval);
+
+ public:
+ ~gr_align_on_samplenumbers_ss();
+ bool check_topology (int ninputs, int noutputs);
+ 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);
+};
+
+
+#endif /* INCLUDED_GR_ALIGN_ON_SAMPLE_NUMBERS_SS_H */
diff --git a/gnuradio-core/src/lib/general/gr_align_on_samplenumbers_ss.i b/gnuradio-core/src/lib/general/gr_align_on_samplenumbers_ss.i
new file mode 100644
index 000000000..471f74301
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_align_on_samplenumbers_ss.i
@@ -0,0 +1,34 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005 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,align_on_samplenumbers_ss);
+
+gr_align_on_samplenumbers_ss_sptr
+gr_make_align_on_samplenumbers_ss(int nchan=2, int align_interval=128) throw (std::exception);
+
+class gr_align_on_samplenumbers_ss : public gr_block
+{
+ public:
+ ~gr_align_on_samplenumbers_ss ();
+ private:
+ gr_align_on_samplenumbers_ss (int nchan,int align_interval);
+};
diff --git a/gnuradio-core/src/lib/general/gr_annotator_1to1.cc b/gnuradio-core/src/lib/general/gr_annotator_1to1.cc
new file mode 100644
index 000000000..963af9202
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_annotator_1to1.cc
@@ -0,0 +1,107 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_annotator_1to1.h>
+#include <gr_io_signature.h>
+#include <string.h>
+#include <iostream>
+#include <iomanip>
+
+gr_annotator_1to1_sptr
+gr_make_annotator_1to1 (int when, size_t sizeof_stream_item)
+{
+ return gnuradio::get_initial_sptr (new gr_annotator_1to1
+ (when, sizeof_stream_item));
+}
+
+gr_annotator_1to1::gr_annotator_1to1 (int when, size_t sizeof_stream_item)
+ : gr_sync_block ("annotator_1to1",
+ gr_make_io_signature (1, -1, sizeof_stream_item),
+ gr_make_io_signature (1, -1, sizeof_stream_item)),
+ d_itemsize(sizeof_stream_item), d_when((uint64_t)when)
+{
+ set_tag_propagation_policy(TPP_ONE_TO_ONE);
+
+ d_tag_counter = 0;
+ set_relative_rate(1.0);
+}
+
+gr_annotator_1to1::~gr_annotator_1to1 ()
+{
+}
+
+int
+gr_annotator_1to1::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const float *in = (const float*)input_items[0];
+ float *out = (float*)output_items[0];
+
+ std::stringstream str;
+ str << name() << unique_id();
+
+ uint64_t abs_N = 0;
+ int ninputs = input_items.size();
+ for(int i = 0; i < ninputs; i++) {
+ abs_N = nitems_read(i);
+
+ std::vector<gr_tag_t> all_tags;
+ get_tags_in_range(all_tags, i, abs_N, abs_N + noutput_items);
+
+ std::vector<gr_tag_t>::iterator itr;
+ for(itr = all_tags.begin(); itr != all_tags.end(); itr++) {
+ d_stored_tags.push_back(*itr);
+ }
+ }
+
+ // Storing the current noutput_items as the value to the "noutput_items" key
+ pmt::pmt_t srcid = pmt::pmt_string_to_symbol(str.str());
+ pmt::pmt_t key = pmt::pmt_string_to_symbol("seq");
+
+ // Work does nothing to the data stream; just copy all inputs to outputs
+ // Adds a new tag when the number of items read is a multiple of d_when
+ abs_N = nitems_read(0);
+ int noutputs = output_items.size();
+ for(int j = 0; j < noutput_items; j++) {
+ // the min() is a hack to make sure this doesn't segfault if there are a
+ // different number of ins and outs. This is specifically designed to test
+ // the 1-to-1 propagation policy.
+ for(int i = 0; i < std::min(noutputs, ninputs); i++) {
+ if(abs_N % d_when == 0) {
+ pmt::pmt_t value = pmt::pmt_from_uint64(d_tag_counter++);
+ add_item_tag(i, abs_N, key, value, srcid);
+ }
+
+ in = (const float*)input_items[i];
+ out = (float*)output_items[i];
+ out[j] = in[j];
+ }
+ abs_N++;
+ }
+
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/general/gr_annotator_1to1.h b/gnuradio-core/src/lib/general/gr_annotator_1to1.h
new file mode 100644
index 000000000..57e572014
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_annotator_1to1.h
@@ -0,0 +1,75 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+#ifndef INCLUDED_GR_ANNOTATOR_1TO1_H
+#define INCLUDED_GR_ANNOTATOR_1TO1_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+
+class gr_annotator_1to1;
+typedef boost::shared_ptr<gr_annotator_1to1> gr_annotator_1to1_sptr;
+
+// public constructor
+GR_CORE_API gr_annotator_1to1_sptr
+gr_make_annotator_1to1 (int when, size_t sizeof_stream_item);
+
+/*!
+ * \brief 1-to-1 stream annotator testing block. FOR TESTING PURPOSES ONLY.
+ *
+ * This block creates tags to be sent downstream every 10,000 items it sees. The
+ * tags contain the name and ID of the instantiated block, use "seq" as a key,
+ * and have a counter that increments by 1 for every tag produced that is used
+ * as the tag's value. The tags are propagated using the 1-to-1 policy.
+ *
+ * It also stores a copy of all tags it sees flow past it. These tags can be
+ * recalled externally with the data() member.
+ *
+ * This block is only meant for testing and showing how to use the tags.
+ */
+class GR_CORE_API gr_annotator_1to1 : public gr_sync_block
+{
+ public:
+ ~gr_annotator_1to1 ();
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+
+ std::vector<gr_tag_t> data() const
+ {
+ return d_stored_tags;
+ }
+
+protected:
+ gr_annotator_1to1 (int when, size_t sizeof_stream_item);
+
+ private:
+ size_t d_itemsize;
+ uint64_t d_when;
+ uint64_t d_tag_counter;
+ std::vector<gr_tag_t> d_stored_tags;
+
+ friend GR_CORE_API gr_annotator_1to1_sptr
+ gr_make_annotator_1to1 (int when, size_t sizeof_stream_item);
+};
+
+#endif
diff --git a/gnuradio-core/src/lib/general/gr_annotator_1to1.i b/gnuradio-core/src/lib/general/gr_annotator_1to1.i
new file mode 100644
index 000000000..2637b8d27
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_annotator_1to1.i
@@ -0,0 +1,25 @@
+/* -*- c++ -*- */
+/*
+ * 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,annotator_1to1);
+
+%include <gr_annotator_1to1.h>
diff --git a/gnuradio-core/src/lib/general/gr_annotator_alltoall.cc b/gnuradio-core/src/lib/general/gr_annotator_alltoall.cc
new file mode 100644
index 000000000..01bdd3064
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_annotator_alltoall.cc
@@ -0,0 +1,110 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_annotator_alltoall.h>
+#include <gr_io_signature.h>
+#include <string.h>
+#include <iostream>
+#include <iomanip>
+
+gr_annotator_alltoall_sptr
+gr_make_annotator_alltoall (int when, size_t sizeof_stream_item)
+{
+ return gnuradio::get_initial_sptr (new gr_annotator_alltoall
+ (when, sizeof_stream_item));
+}
+
+gr_annotator_alltoall::gr_annotator_alltoall (int when,
+ size_t sizeof_stream_item)
+ : gr_sync_block ("annotator_alltoall",
+ gr_make_io_signature (1, -1, sizeof_stream_item),
+ gr_make_io_signature (1, -1, sizeof_stream_item)),
+ d_itemsize(sizeof_stream_item), d_when((uint64_t)when)
+{
+ set_tag_propagation_policy(TPP_ALL_TO_ALL);
+
+ d_tag_counter = 0;
+}
+
+gr_annotator_alltoall::~gr_annotator_alltoall ()
+{
+}
+
+int
+gr_annotator_alltoall::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const float *in = (const float *) input_items[0];
+ float *out = (float *) output_items[0];
+
+ std::stringstream str;
+ str << name() << unique_id();
+
+ uint64_t abs_N = 0, end_N;
+ int ninputs = input_items.size();
+ for(int i = 0; i < ninputs; i++) {
+ abs_N = nitems_read(i);
+ end_N = abs_N + (uint64_t)(noutput_items);
+
+ std::vector<gr_tag_t> all_tags;
+ get_tags_in_range(all_tags, i, abs_N, end_N);
+
+ std::vector<gr_tag_t>::iterator itr;
+ for(itr = all_tags.begin(); itr != all_tags.end(); itr++) {
+ d_stored_tags.push_back(*itr);
+ }
+ }
+
+ // Source ID and key for any tag that might get applied from this block
+ pmt::pmt_t srcid = pmt::pmt_string_to_symbol(str.str());
+ pmt::pmt_t key = pmt::pmt_string_to_symbol("seq");
+
+ // Work does nothing to the data stream; just copy all inputs to outputs
+ // Adds a new tag when the number of items read is a multiple of d_when
+ abs_N = nitems_written(0);
+ int noutputs = output_items.size();
+
+ for(int j = 0; j < noutput_items; j++) {
+ for(int i = 0; i < noutputs; i++) {
+ if(abs_N % d_when == 0) {
+ pmt::pmt_t value = pmt::pmt_from_uint64(d_tag_counter++);
+ add_item_tag(i, abs_N, key, value, srcid);
+ }
+
+ // Sum all of the inputs together for each output. Just 'cause.
+ out = (float*)output_items[i];
+ out[j] = 0;
+ for(int ins = 0; ins < ninputs; ins++) {
+ in = (const float*)input_items[ins];
+ out[j] += in[j];
+ }
+ }
+ abs_N++;
+ }
+
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/general/gr_annotator_alltoall.h b/gnuradio-core/src/lib/general/gr_annotator_alltoall.h
new file mode 100644
index 000000000..deb5874a4
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_annotator_alltoall.h
@@ -0,0 +1,76 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+#ifndef INCLUDED_GR_ANNOTATOR_ALLTOALL_H
+#define INCLUDED_GR_ANNOTATOR_ALLTOALL_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+
+class gr_annotator_alltoall;
+typedef boost::shared_ptr<gr_annotator_alltoall> gr_annotator_alltoall_sptr;
+
+// public constructor
+GR_CORE_API gr_annotator_alltoall_sptr
+gr_make_annotator_alltoall (int when, size_t sizeof_stream_item);
+
+/*!
+ * \brief All-to-all stream annotator testing block. FOR TESTING PURPOSES ONLY.
+ *
+ * This block creates tags to be sent downstream every 10,000 items it sees. The
+ * tags contain the name and ID of the instantiated block, use "seq" as a key,
+ * and have a counter that increments by 1 for every tag produced that is used
+ * as the tag's value. The tags are propagated using the all-to-all policy.
+ *
+ * It also stores a copy of all tags it sees flow past it. These tags can be
+ * recalled externally with the data() member.
+ *
+ * This block is only meant for testing and showing how to use the tags.
+ */
+class GR_CORE_API gr_annotator_alltoall : public gr_sync_block
+{
+ public:
+ ~gr_annotator_alltoall ();
+
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+
+ std::vector<gr_tag_t> data() const
+ {
+ return d_stored_tags;
+ }
+
+protected:
+ gr_annotator_alltoall (int when, size_t sizeof_stream_item);
+
+ private:
+ size_t d_itemsize;
+ uint64_t d_when;
+ uint64_t d_tag_counter;
+ std::vector<gr_tag_t> d_stored_tags;
+
+ friend GR_CORE_API gr_annotator_alltoall_sptr
+ gr_make_annotator_alltoall (int when, size_t sizeof_stream_item);
+};
+
+#endif
diff --git a/gnuradio-core/src/lib/general/gr_annotator_alltoall.i b/gnuradio-core/src/lib/general/gr_annotator_alltoall.i
new file mode 100644
index 000000000..35190a3d1
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_annotator_alltoall.i
@@ -0,0 +1,25 @@
+/* -*- c++ -*- */
+/*
+ * 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,annotator_alltoall);
+
+%include <gr_annotator_alltoall.h>
diff --git a/gnuradio-core/src/lib/general/gr_annotator_raw.cc b/gnuradio-core/src/lib/general/gr_annotator_raw.cc
new file mode 100644
index 000000000..d3dcce73a
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_annotator_raw.cc
@@ -0,0 +1,106 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_annotator_raw.h>
+#include <gr_io_signature.h>
+#include <string.h>
+#include <iostream>
+#include <iomanip>
+#include <stdexcept>
+
+using namespace pmt;
+
+gr_annotator_raw_sptr
+gr_make_annotator_raw(size_t sizeof_stream_item)
+{
+ return gnuradio::get_initial_sptr(new gr_annotator_raw
+ (sizeof_stream_item));
+}
+
+gr_annotator_raw::gr_annotator_raw(size_t sizeof_stream_item)
+ : gr_sync_block("annotator_raw",
+ gr_make_io_signature(1, 1, sizeof_stream_item),
+ gr_make_io_signature(1, 1, sizeof_stream_item)),
+ d_itemsize(sizeof_stream_item)
+{
+ set_tag_propagation_policy(TPP_ONE_TO_ONE);
+ set_relative_rate(1.0);
+}
+
+void gr_annotator_raw::add_tag(uint64_t offset, pmt_t key, pmt_t val)
+{
+ gruel::scoped_lock l(d_mutex);
+
+ gr_tag_t tag;
+ tag.srcid = pmt::pmt_intern(name());
+ tag.key = key;
+ tag.value = val;
+ tag.offset = offset;
+
+ // add our new tag
+ d_queued_tags.push_back(tag);
+ // make sure our tags are in offset order
+ std::sort(d_queued_tags.begin(), d_queued_tags.end(),
+ gr_tag_t::offset_compare);
+ // make sure we are not adding an item in the past!
+ if(tag.offset > nitems_read(0)) {
+ throw std::runtime_error("gr_annotator_raw::add_tag: item added too far in the past\n.");
+ }
+}
+
+gr_annotator_raw::~gr_annotator_raw()
+{
+}
+
+int
+gr_annotator_raw::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ gruel::scoped_lock l(d_mutex);
+
+ const char *in = (const char*)input_items[0];
+ char *out = (char*)output_items[0];
+
+ uint64_t start_N = nitems_read(0);
+ uint64_t end_N = start_N + (uint64_t)(noutput_items);
+
+ // locate queued tags that fall in this range and insert them when appropriate
+ std::vector<gr_tag_t>::iterator i = d_queued_tags.begin();
+ while( i != d_queued_tags.end() ) {
+ if( (*i).offset >= start_N && (*i).offset < end_N) {
+ add_item_tag(0, (*i).offset,(*i).key, (*i).value, (*i).srcid);
+ i = d_queued_tags.erase(i);
+ }
+ else {
+ break;
+ }
+ }
+
+ // copy data across
+ memcpy(out, in, noutput_items*d_itemsize);
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/general/gr_annotator_raw.h b/gnuradio-core/src/lib/general/gr_annotator_raw.h
new file mode 100644
index 000000000..02d061908
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_annotator_raw.h
@@ -0,0 +1,69 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+#ifndef INCLUDED_GR_ANNOTATOR_RAW_H
+#define INCLUDED_GR_ANNOTATOR_RAW_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+#include <gr_tags.h>
+#include <gruel/thread.h>
+
+class gr_annotator_raw;
+typedef boost::shared_ptr<gr_annotator_raw> gr_annotator_raw_sptr;
+
+// public constructor
+GR_CORE_API gr_annotator_raw_sptr
+gr_make_annotator_raw(size_t sizeof_stream_item);
+
+/*!
+ * \brief raw stream annotator testing block.
+ *
+ * This block creates arbitrary tags to be sent downstream
+ * blocks to be sent are set manually via accessor methods and are sent only once.
+ *
+ * This block is intended for testing of tag related blocks
+ */
+class GR_CORE_API gr_annotator_raw : public gr_sync_block
+{
+ public:
+ ~gr_annotator_raw();
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+
+ // insert a tag to be added
+ void add_tag(uint64_t offset, pmt::pmt_t key, pmt::pmt_t val);
+
+protected:
+ gr_annotator_raw(size_t sizeof_stream_item);
+
+ private:
+ size_t d_itemsize;
+ std::vector<gr_tag_t> d_queued_tags;
+ gruel::mutex d_mutex;
+
+ friend GR_CORE_API gr_annotator_raw_sptr
+ gr_make_annotator_raw(size_t sizeof_stream_item);
+};
+
+#endif
diff --git a/gnuradio-core/src/lib/general/gr_annotator_raw.i b/gnuradio-core/src/lib/general/gr_annotator_raw.i
new file mode 100644
index 000000000..4a58fe7c7
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_annotator_raw.i
@@ -0,0 +1,26 @@
+/* -*- c++ -*- */
+/*
+ * 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,annotator_raw);
+
+%include <gr_tags.i>
+%include <gr_annotator_raw.h>
diff --git a/gnuradio-core/src/lib/general/gr_bin_statistics_f.cc b/gnuradio-core/src/lib/general/gr_bin_statistics_f.cc
new file mode 100644
index 000000000..3938f2b48
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_bin_statistics_f.cc
@@ -0,0 +1,174 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_bin_statistics_f.h>
+#include <gr_io_signature.h>
+#include <string.h>
+
+gr_bin_statistics_f_sptr
+gr_make_bin_statistics_f(unsigned int vlen,
+ gr_msg_queue_sptr msgq,
+ gr_feval_dd *tune,
+ size_t tune_delay,
+ size_t dwell_delay)
+{
+ return gnuradio::get_initial_sptr(new gr_bin_statistics_f(vlen,
+ msgq,
+ tune,
+ tune_delay,
+ dwell_delay));
+}
+
+gr_bin_statistics_f::gr_bin_statistics_f(unsigned int vlen,
+ gr_msg_queue_sptr msgq,
+ gr_feval_dd *tune,
+ size_t tune_delay,
+ size_t dwell_delay)
+ : gr_sync_block("bin_statistics_f",
+ gr_make_io_signature(1, 1, sizeof(float) * vlen),
+ gr_make_io_signature(0, 0, 0)),
+ d_vlen(vlen), d_msgq(msgq), d_tune(tune),
+ d_tune_delay(tune_delay), d_dwell_delay(dwell_delay),
+ d_center_freq(0), d_delay(0),
+ d_max(vlen)
+{
+ enter_init();
+}
+
+gr_bin_statistics_f::~gr_bin_statistics_f()
+{
+ // NOP
+}
+
+void
+gr_bin_statistics_f::enter_init()
+{
+ d_state = ST_INIT;
+ d_delay = 0;
+}
+
+void
+gr_bin_statistics_f::enter_tune_delay()
+{
+ d_state = ST_TUNE_DELAY;
+ d_delay = d_tune_delay;
+ d_center_freq = d_tune->calleval(0);
+}
+
+void
+gr_bin_statistics_f::enter_dwell_delay()
+{
+ d_state = ST_DWELL_DELAY;
+ d_delay = d_dwell_delay;
+ reset_stats();
+}
+
+void
+gr_bin_statistics_f::leave_dwell_delay()
+{
+ send_stats();
+}
+
+int
+gr_bin_statistics_f::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const float *input = (const float *) input_items[0];
+ size_t vlen = d_max.size();
+
+ int n = 0;
+ int t;
+
+ while (n < noutput_items){
+ switch (d_state){
+
+ case ST_INIT:
+ enter_tune_delay();
+ break;
+
+ case ST_TUNE_DELAY:
+ t = std::min(noutput_items - n, int(d_delay));
+ n += t;
+ d_delay -= t;
+ assert(d_delay >= 0);
+ if (d_delay == 0)
+ enter_dwell_delay();
+ break;
+
+ case ST_DWELL_DELAY:
+ t = std::min(noutput_items - n, int(d_delay));
+ for (int i = 0; i < t; i++){
+ accrue_stats(&input[n * vlen]);
+ n++;
+ }
+ d_delay -= t;
+ assert(d_delay >= 0);
+ if (d_delay == 0){
+ leave_dwell_delay();
+ enter_tune_delay();
+ }
+ break;
+
+ default:
+ assert(0);
+ }
+ }
+
+ return noutput_items;
+}
+
+//////////////////////////////////////////////////////////////////////////
+// virtual methods for gathering stats
+//////////////////////////////////////////////////////////////////////////
+
+void
+gr_bin_statistics_f::reset_stats()
+{
+ for (size_t i = 0; i < vlen(); i++){
+ d_max[i] = 0;
+ }
+}
+
+void
+gr_bin_statistics_f::accrue_stats(const float *input)
+{
+ for (size_t i = 0; i < vlen(); i++){
+ d_max[i] = std::max(d_max[i], input[i]); // compute per bin maxima
+ }
+}
+
+void
+gr_bin_statistics_f::send_stats()
+{
+ if (msgq()->full_p()) // if the queue is full, don't block, drop the data...
+ return;
+
+ // build & send a message
+ gr_message_sptr msg = gr_make_message(0, center_freq(), vlen(), vlen() * sizeof(float));
+ memcpy(msg->msg(), &d_max[0], vlen() * sizeof(float));
+ msgq()->insert_tail(msg);
+}
diff --git a/gnuradio-core/src/lib/general/gr_bin_statistics_f.h b/gnuradio-core/src/lib/general/gr_bin_statistics_f.h
new file mode 100644
index 000000000..dd1075909
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_bin_statistics_f.h
@@ -0,0 +1,100 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_GR_BIN_STATISTICS_F_H
+#define INCLUDED_GR_BIN_STATISTICS_F_H
+
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+#include <gr_feval.h>
+#include <gr_message.h>
+#include <gr_msg_queue.h>
+
+class gr_bin_statistics_f;
+typedef boost::shared_ptr<gr_bin_statistics_f> gr_bin_statistics_f_sptr;
+
+
+GR_CORE_API gr_bin_statistics_f_sptr
+gr_make_bin_statistics_f(unsigned int vlen, // vector length
+ gr_msg_queue_sptr msgq,
+ gr_feval_dd *tune, // callback
+ size_t tune_delay, // samples
+ size_t dwell_delay); // samples
+
+/*!
+ * \brief control scanning and record frequency domain statistics
+ * \ingroup sink_blk
+ */
+class GR_CORE_API gr_bin_statistics_f : public gr_sync_block
+{
+ friend GR_CORE_API gr_bin_statistics_f_sptr
+ gr_make_bin_statistics_f(unsigned int vlen, // vector length
+ gr_msg_queue_sptr msgq,
+ gr_feval_dd *tune, // callback
+ size_t tune_delay, // samples
+ size_t dwell_delay); // samples
+
+ enum state_t { ST_INIT, ST_TUNE_DELAY, ST_DWELL_DELAY };
+
+ size_t d_vlen;
+ gr_msg_queue_sptr d_msgq;
+ gr_feval_dd *d_tune;
+ size_t d_tune_delay;
+ size_t d_dwell_delay;
+ double d_center_freq;
+
+ state_t d_state;
+ size_t d_delay; // nsamples remaining to state transition
+
+ gr_bin_statistics_f(unsigned int vlen,
+ gr_msg_queue_sptr msgq,
+ gr_feval_dd *tune,
+ size_t tune_delay,
+ size_t dwell_delay);
+
+ void enter_init();
+ void enter_tune_delay();
+ void enter_dwell_delay();
+ void leave_dwell_delay();
+
+protected:
+ std::vector<float> d_max; // per bin maxima
+
+ size_t vlen() const { return d_vlen; }
+ double center_freq() const { return d_center_freq; }
+ gr_msg_queue_sptr msgq() const { return d_msgq; }
+
+ virtual void reset_stats();
+ virtual void accrue_stats(const float *input);
+ virtual void send_stats();
+
+public:
+ ~gr_bin_statistics_f();
+
+ 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/general/gr_bin_statistics_f.i b/gnuradio-core/src/lib/general/gr_bin_statistics_f.i
new file mode 100644
index 000000000..94a3db69a
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_bin_statistics_f.i
@@ -0,0 +1,47 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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 this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+// Directors are only supported in Python, Java and C#. gr_feval_dd uses directors
+#ifdef SWIGPYTHON
+
+GR_SWIG_BLOCK_MAGIC(gr,bin_statistics_f);
+
+gr_bin_statistics_f_sptr
+gr_make_bin_statistics_f(unsigned int vlen, // vector length
+ gr_msg_queue_sptr msgq,
+ gr_feval_dd *tune, // callback
+ size_t tune_delay, // samples
+ size_t dwell_delay); // samples
+
+
+class gr_bin_statistics_f : public gr_sync_block
+{
+private:
+ gr_bin_statistics_f(unsigned int vlen,
+ gr_msg_queue_sptr msgq,
+ gr_feval_dd *tune,
+ size_t tune_delay,
+ size_t dwell_delay);
+public:
+ ~gr_bin_statistics_f();
+};
+
+#endif
diff --git a/gnuradio-core/src/lib/general/gr_block_gateway.cc b/gnuradio-core/src/lib/general/gr_block_gateway.cc
new file mode 100644
index 000000000..79b42803a
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_block_gateway.cc
@@ -0,0 +1,184 @@
+/*
+ * Copyright 2011-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.
+ */
+
+#include <gr_block_gateway.h>
+#include <gr_io_signature.h>
+#include <iostream>
+#include <boost/bind.hpp>
+
+/***********************************************************************
+ * Helper routines
+ **********************************************************************/
+template <typename OutType, typename InType>
+void copy_pointers(OutType &out, const InType &in){
+ out.resize(in.size());
+ for (size_t i = 0; i < in.size(); i++){
+ out[i] = (void *)(in[i]);
+ }
+}
+
+/***********************************************************************
+ * The gr_block gateway implementation class
+ **********************************************************************/
+class gr_block_gateway_impl : public gr_block_gateway{
+public:
+ gr_block_gateway_impl(
+ gr_feval_ll *handler,
+ const std::string &name,
+ gr_io_signature_sptr in_sig,
+ gr_io_signature_sptr out_sig,
+ const gr_block_gw_work_type work_type,
+ const unsigned factor
+ ):
+ gr_block(name, in_sig, out_sig),
+ _handler(handler),
+ _work_type(work_type)
+ {
+ switch(_work_type){
+ case GR_BLOCK_GW_WORK_GENERAL:
+ _decim = 1; //not relevant, but set anyway
+ _interp = 1; //not relevant, but set anyway
+ break;
+
+ case GR_BLOCK_GW_WORK_SYNC:
+ _decim = 1;
+ _interp = 1;
+ this->set_fixed_rate(true);
+ break;
+
+ case GR_BLOCK_GW_WORK_DECIM:
+ _decim = factor;
+ _interp = 1;
+ break;
+
+ case GR_BLOCK_GW_WORK_INTERP:
+ _decim = 1;
+ _interp = factor;
+ this->set_output_multiple(_interp);
+ break;
+ }
+ }
+
+ /*******************************************************************
+ * Overloads for various scheduler-called functions
+ ******************************************************************/
+ void forecast(
+ int noutput_items,
+ gr_vector_int &ninput_items_required
+ ){
+ switch(_work_type){
+ case GR_BLOCK_GW_WORK_GENERAL:
+ _message.action = gr_block_gw_message_type::ACTION_FORECAST;
+ _message.forecast_args_noutput_items = noutput_items;
+ _message.forecast_args_ninput_items_required = ninput_items_required;
+ _handler->calleval(0);
+ ninput_items_required = _message.forecast_args_ninput_items_required;
+ return;
+
+ default:
+ unsigned ninputs = ninput_items_required.size();
+ for (unsigned i = 0; i < ninputs; i++)
+ ninput_items_required[i] = fixed_rate_noutput_to_ninput(noutput_items);
+ return;
+ }
+ }
+
+ int general_work(
+ int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items
+ ){
+ switch(_work_type){
+ case GR_BLOCK_GW_WORK_GENERAL:
+ _message.action = gr_block_gw_message_type::ACTION_GENERAL_WORK;
+ _message.general_work_args_noutput_items = noutput_items;
+ _message.general_work_args_ninput_items = ninput_items;
+ copy_pointers(_message.general_work_args_input_items, input_items);
+ _message.general_work_args_output_items = output_items;
+ _handler->calleval(0);
+ return _message.general_work_args_return_value;
+
+ default:
+ int r = work (noutput_items, input_items, output_items);
+ if (r > 0) consume_each(r*_decim/_interp);
+ return r;
+ }
+ }
+
+ int work(
+ int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items
+ ){
+ _message.action = gr_block_gw_message_type::ACTION_WORK;
+ _message.work_args_ninput_items = fixed_rate_noutput_to_ninput(noutput_items);
+ if (_message.work_args_ninput_items == 0) return -1;
+ _message.work_args_noutput_items = noutput_items;
+ copy_pointers(_message.work_args_input_items, input_items);
+ _message.work_args_output_items = output_items;
+ _handler->calleval(0);
+ return _message.work_args_return_value;
+ }
+
+ int fixed_rate_noutput_to_ninput(int noutput_items){
+ return (noutput_items*_decim/_interp) + history() - 1;
+ }
+
+ int fixed_rate_ninput_to_noutput(int ninput_items){
+ return std::max(0, ninput_items - (int)history() + 1)*_interp/_decim;
+ }
+
+ bool start(void){
+ _message.action = gr_block_gw_message_type::ACTION_START;
+ _handler->calleval(0);
+ return _message.start_args_return_value;
+ }
+
+ bool stop(void){
+ _message.action = gr_block_gw_message_type::ACTION_STOP;
+ _handler->calleval(0);
+ return _message.stop_args_return_value;
+ }
+
+ gr_block_gw_message_type &gr_block_message(void){
+ return _message;
+ }
+
+private:
+ gr_feval_ll *_handler;
+ gr_block_gw_message_type _message;
+ const gr_block_gw_work_type _work_type;
+ unsigned _decim, _interp;
+};
+
+boost::shared_ptr<gr_block_gateway> gr_make_block_gateway(
+ gr_feval_ll *handler,
+ const std::string &name,
+ gr_io_signature_sptr in_sig,
+ gr_io_signature_sptr out_sig,
+ const gr_block_gw_work_type work_type,
+ const unsigned factor
+){
+ return boost::shared_ptr<gr_block_gateway>(
+ new gr_block_gateway_impl(handler, name, in_sig, out_sig, work_type, factor)
+ );
+}
diff --git a/gnuradio-core/src/lib/general/gr_block_gateway.h b/gnuradio-core/src/lib/general/gr_block_gateway.h
new file mode 100644
index 000000000..2452b1045
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_block_gateway.h
@@ -0,0 +1,264 @@
+/*
+ * Copyright 2011-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 INCLUDED_GRBLOCK_GATEWAY_H
+#define INCLUDED_GRBLOCK_GATEWAY_H
+
+#include <gr_core_api.h>
+#include <gr_block.h>
+#include <gr_feval.h>
+
+/*!
+ * The work type enum tells the gateway what kind of block to implement.
+ * The choices are familiar gnuradio block overloads (sync, decim, interp).
+ */
+enum gr_block_gw_work_type{
+ GR_BLOCK_GW_WORK_GENERAL,
+ GR_BLOCK_GW_WORK_SYNC,
+ GR_BLOCK_GW_WORK_DECIM,
+ GR_BLOCK_GW_WORK_INTERP,
+};
+
+/*!
+ * Shared message structure between python and gateway.
+ * Each action type represents a scheduler-called function.
+ */
+struct gr_block_gw_message_type{
+ enum action_type{
+ ACTION_GENERAL_WORK, //dispatch work
+ ACTION_WORK, //dispatch work
+ ACTION_FORECAST, //dispatch forecast
+ ACTION_START, //dispatch start
+ ACTION_STOP, //dispatch stop
+ };
+
+ action_type action;
+
+ int general_work_args_noutput_items;
+ std::vector<int> general_work_args_ninput_items;
+ std::vector<void *> general_work_args_input_items; //TODO this should be const void*, but swig cant int cast it right
+ std::vector<void *> general_work_args_output_items;
+ int general_work_args_return_value;
+
+ int work_args_ninput_items;
+ int work_args_noutput_items;
+ std::vector<void *> work_args_input_items; //TODO this should be const void*, but swig cant int cast it right
+ std::vector<void *> work_args_output_items;
+ int work_args_return_value;
+
+ int forecast_args_noutput_items;
+ std::vector<int> forecast_args_ninput_items_required;
+
+ bool start_args_return_value;
+
+ bool stop_args_return_value;
+};
+
+/*!
+ * The gateway block which performs all the magic.
+ *
+ * The gateway provides access to all the gr_block routines.
+ * The methods prefixed with gr_block__ are renamed
+ * to class methods without the prefix in python.
+ */
+class GR_CORE_API gr_block_gateway : virtual public gr_block{
+public:
+ //! Provide access to the shared message object
+ virtual gr_block_gw_message_type &gr_block_message(void) = 0;
+
+ long gr_block__unique_id(void) const{
+ return gr_block::unique_id();
+ }
+
+ std::string gr_block__name(void) const{
+ return gr_block::name();
+ }
+
+ unsigned gr_block__history(void) const{
+ return gr_block::history();
+ }
+
+ void gr_block__set_history(unsigned history){
+ return gr_block::set_history(history);
+ }
+
+ void gr_block__set_fixed_rate(bool fixed_rate){
+ return gr_block::set_fixed_rate(fixed_rate);
+ }
+
+ bool gr_block__fixed_rate(void) const{
+ return gr_block::fixed_rate();
+ }
+
+ void gr_block__set_output_multiple(int multiple){
+ return gr_block::set_output_multiple(multiple);
+ }
+
+ int gr_block__output_multiple(void) const{
+ return gr_block::output_multiple();
+ }
+
+ void gr_block__consume(int which_input, int how_many_items){
+ return gr_block::consume(which_input, how_many_items);
+ }
+
+ void gr_block__consume_each(int how_many_items){
+ return gr_block::consume_each(how_many_items);
+ }
+
+ void gr_block__produce(int which_output, int how_many_items){
+ return gr_block::produce(which_output, how_many_items);
+ }
+
+ void gr_block__set_relative_rate(double relative_rate){
+ return gr_block::set_relative_rate(relative_rate);
+ }
+
+ double gr_block__relative_rate(void) const{
+ return gr_block::relative_rate();
+ }
+
+ uint64_t gr_block__nitems_read(unsigned int which_input){
+ return gr_block::nitems_read(which_input);
+ }
+
+ uint64_t gr_block__nitems_written(unsigned int which_output){
+ return gr_block::nitems_written(which_output);
+ }
+
+ gr_block::tag_propagation_policy_t gr_block__tag_propagation_policy(void){
+ return gr_block::tag_propagation_policy();
+ }
+
+ void gr_block__set_tag_propagation_policy(gr_block::tag_propagation_policy_t p){
+ return gr_block::set_tag_propagation_policy(p);
+ }
+
+ void gr_block__add_item_tag(
+ unsigned int which_output, const gr_tag_t &tag
+ ){
+ return gr_block::add_item_tag(which_output, tag);
+ }
+
+ void gr_block__add_item_tag(
+ unsigned int which_output,
+ uint64_t abs_offset,
+ const pmt::pmt_t &key,
+ const pmt::pmt_t &value,
+ const pmt::pmt_t &srcid=pmt::PMT_F
+ ){
+ return gr_block::add_item_tag(which_output, abs_offset, key, value, srcid);
+ }
+
+ std::vector<gr_tag_t> gr_block__get_tags_in_range(
+ unsigned int which_input,
+ uint64_t abs_start,
+ uint64_t abs_end
+ ){
+ std::vector<gr_tag_t> tags;
+ gr_block::get_tags_in_range(tags, which_input, abs_start, abs_end);
+ return tags;
+ }
+
+ std::vector<gr_tag_t> gr_block__get_tags_in_range(
+ unsigned int which_input,
+ uint64_t abs_start,
+ uint64_t abs_end,
+ const pmt::pmt_t &key
+ ){
+ std::vector<gr_tag_t> tags;
+ gr_block::get_tags_in_range(tags, which_input, abs_start, abs_end, key);
+ return tags;
+ }
+
+ /* Message passing interface */
+ void gr_block__message_port_register_in(pmt::pmt_t port_id){
+ gr_block::message_port_register_in(port_id);
+ }
+
+ void gr_block__message_port_register_out(pmt::pmt_t port_id){
+ gr_block::message_port_register_out(port_id);
+ }
+
+ void gr_block__message_port_pub(pmt::pmt_t port_id, pmt::pmt_t msg){
+ gr_block::message_port_pub(port_id, msg);
+ }
+
+ void gr_block__message_port_sub(pmt::pmt_t port_id, pmt::pmt_t target){
+ gr_block::message_port_sub(port_id, target);
+ }
+
+ void gr_block__message_port_unsub(pmt::pmt_t port_id, pmt::pmt_t target){
+ gr_block::message_port_unsub(port_id, target);
+ }
+
+ pmt::pmt_t gr_block__message_ports_in(){
+ return gr_block::message_ports_in();
+ }
+
+ pmt::pmt_t gr_block__message_ports_out(){
+ return gr_block::message_ports_out();
+ }
+
+ void set_msg_handler_feval(pmt::pmt_t which_port, gr_feval_p *msg_handler)
+ {
+ if(msg_queue.find(which_port) == msg_queue.end()){
+ throw std::runtime_error("attempt to set_msg_handler_feval() on bad input message port!");
+ }
+ d_msg_handlers_feval[which_port] = msg_handler;
+ }
+
+protected:
+ typedef std::map<pmt::pmt_t, gr_feval_p *, pmt::pmt_comperator> msg_handlers_feval_t;
+ msg_handlers_feval_t d_msg_handlers_feval;
+
+ void dispatch_msg(pmt::pmt_t which_port, pmt::pmt_t msg){
+ // Is there a handler?
+ if (d_msg_handlers_feval.find(which_port) != d_msg_handlers_feval.end()){
+ d_msg_handlers_feval[which_port]->calleval(msg); // Yes, invoke it.
+ }
+ else {
+ // Pass to generic dispatcher if not found
+ gr_block::dispatch_msg(which_port, msg);
+ }
+ }
+};
+
+/*!
+ * Make a new gateway block.
+ * \param handler the swig director object with callback
+ * \param name the name of the block (Ex: "Shirley")
+ * \param in_sig the input signature for this block
+ * \param out_sig the output signature for this block
+ * \param work_type the type of block overload to implement
+ * \param factor the decimation or interpolation factor
+ * \return a new gateway block
+ */
+GR_CORE_API boost::shared_ptr<gr_block_gateway> gr_make_block_gateway(
+ gr_feval_ll *handler,
+ const std::string &name,
+ gr_io_signature_sptr in_sig,
+ gr_io_signature_sptr out_sig,
+ const gr_block_gw_work_type work_type,
+ const unsigned factor
+);
+
+#endif /* INCLUDED_GRBLOCK_GATEWAY_H */
diff --git a/gnuradio-core/src/lib/general/gr_block_gateway.i b/gnuradio-core/src/lib/general/gr_block_gateway.i
new file mode 100644
index 000000000..8adafdfea
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_block_gateway.i
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2011-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.
+ */
+
+////////////////////////////////////////////////////////////////////////
+// standard includes
+////////////////////////////////////////////////////////////////////////
+%include <gnuradio.i>
+%include <gr_tags.i>
+%include <gr_feval.i>
+
+////////////////////////////////////////////////////////////////////////
+// block headers
+////////////////////////////////////////////////////////////////////////
+%{
+#include <gr_block_gateway.h>
+%}
+
+////////////////////////////////////////////////////////////////////////
+// data type support
+////////////////////////////////////////////////////////////////////////
+%template(int_vector_t) std::vector<int>;
+%template(void_star_vector_t) std::vector<void *>;
+
+////////////////////////////////////////////////////////////////////////
+// block magic
+////////////////////////////////////////////////////////////////////////
+GR_SWIG_BLOCK_MAGIC(gr,block_gateway);
+%include <gr_block_gateway.h>
diff --git a/gnuradio-core/src/lib/general/gr_burst_tagger.cc b/gnuradio-core/src/lib/general/gr_burst_tagger.cc
new file mode 100644
index 000000000..83e84bfa0
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_burst_tagger.cc
@@ -0,0 +1,109 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_burst_tagger.h>
+#include <gr_io_signature.h>
+#include <string.h>
+
+gr_burst_tagger_sptr
+gr_make_burst_tagger(size_t itemsize)
+{
+ return gnuradio::get_initial_sptr(new gr_burst_tagger(itemsize));
+}
+
+gr_burst_tagger::gr_burst_tagger(size_t itemsize)
+ : gr_sync_block ("burst_tagger",
+ gr_make_io_signature2 (2, 2, itemsize, sizeof(short)),
+ gr_make_io_signature (1, 1, itemsize)),
+ d_itemsize(itemsize), d_state(false)
+{
+ std::stringstream str;
+ str << name() << unique_id();
+
+ d_true_key = pmt::pmt_string_to_symbol("burst");
+ d_true_value = pmt::PMT_T;
+
+ d_false_key = pmt::pmt_string_to_symbol("burst");
+ d_false_value = pmt::PMT_F;
+
+ d_id = pmt::pmt_string_to_symbol(str.str());
+}
+
+void
+gr_burst_tagger::set_true_tag (const std::string &key, bool value)
+{
+ d_true_key = pmt::pmt_string_to_symbol(key);
+ if(value == true) {
+ d_true_value = pmt::PMT_T;
+ }
+ else {
+ d_true_value = pmt::PMT_F;
+ }
+}
+
+void
+gr_burst_tagger::set_false_tag (const std::string &key, bool value)
+{
+ d_false_key = pmt::pmt_string_to_symbol(key);
+ if(value == true) {
+ d_false_value = pmt::PMT_T;
+ }
+ else {
+ d_false_value = pmt::PMT_F;
+ }
+}
+
+gr_burst_tagger::~gr_burst_tagger()
+{
+}
+
+int
+gr_burst_tagger::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const char *signal = (const char*)input_items[0];
+ const short *trigger = (const short*)input_items[1];
+ char *out = (char*)output_items[0];
+
+ memcpy(out, signal, noutput_items * d_itemsize);
+
+ for(int i = 0; i < noutput_items; i++) {
+ if(trigger[i] > 0) {
+ if(d_state == false) {
+ d_state = true;
+ add_item_tag(0, nitems_written(0)+i, d_true_key, d_true_value, d_id);
+ }
+ }
+ else {
+ if(d_state == true) {
+ d_state = false;
+ add_item_tag(0, nitems_written(0)+i, d_false_key, d_false_value, d_id);
+ }
+ }
+ }
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/general/gr_burst_tagger.h b/gnuradio-core/src/lib/general/gr_burst_tagger.h
new file mode 100644
index 000000000..9a7898b04
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_burst_tagger.h
@@ -0,0 +1,64 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+#ifndef INCLUDED_GR_BURST_TAGGER_H
+#define INCLUDED_GR_BURST_TAGGER_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+
+class gr_burst_tagger;
+typedef boost::shared_ptr<gr_burst_tagger> gr_burst_tagger_sptr;
+
+GR_CORE_API gr_burst_tagger_sptr gr_make_burst_tagger(size_t itemsize);
+
+/*!
+ * \brief output[i] = input[i]
+ * \ingroup misc_blk
+ *
+ */
+class GR_CORE_API gr_burst_tagger : public gr_sync_block
+{
+ size_t d_itemsize;
+ bool d_state;
+ pmt::pmt_t d_true_key;
+ pmt::pmt_t d_true_value;
+
+ pmt::pmt_t d_false_key;
+ pmt::pmt_t d_false_value;
+
+ pmt::pmt_t d_id;
+
+ friend GR_CORE_API gr_burst_tagger_sptr gr_make_burst_tagger(size_t itemsize);
+ gr_burst_tagger(size_t itemsize);
+
+ public:
+ ~gr_burst_tagger();
+ void set_true_tag (const std::string &key, bool value);
+ void set_false_tag (const std::string &key, bool value);
+
+ 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/general/gr_burst_tagger.i b/gnuradio-core/src/lib/general/gr_burst_tagger.i
new file mode 100644
index 000000000..a5511e48a
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_burst_tagger.i
@@ -0,0 +1,35 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,burst_tagger)
+
+gr_burst_tagger_sptr gr_make_burst_tagger(size_t itemsize);
+
+class gr_burst_tagger : public gr_sync_block
+{
+ private:
+ gr_burst_tagger(size_t itemsize);
+
+ public:
+ void set_true_tag(const std::string &key, bool value);
+ void set_false_tag(const std::string &key, bool value);
+};
diff --git a/gnuradio-core/src/lib/general/gr_bytes_to_syms.cc b/gnuradio-core/src/lib/general/gr_bytes_to_syms.cc
new file mode 100644
index 000000000..7dafa29f9
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_bytes_to_syms.cc
@@ -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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_bytes_to_syms.h>
+#include <gr_io_signature.h>
+#include <assert.h>
+
+static const int BITS_PER_BYTE = 8;
+
+gr_bytes_to_syms_sptr
+gr_make_bytes_to_syms ()
+{
+ return gnuradio::get_initial_sptr(new gr_bytes_to_syms ());
+}
+
+gr_bytes_to_syms::gr_bytes_to_syms ()
+ : gr_sync_interpolator ("bytes_to_syms",
+ gr_make_io_signature (1, 1, sizeof (unsigned char)),
+ gr_make_io_signature (1, 1, sizeof (float)),
+ BITS_PER_BYTE)
+{
+}
+
+int
+gr_bytes_to_syms::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const unsigned char *in = (unsigned char *) input_items[0];
+ float *out = (float *) output_items[0];
+
+ assert (noutput_items % BITS_PER_BYTE == 0);
+
+ for (int i = 0; i < noutput_items / BITS_PER_BYTE; i++){
+ int x = in[i];
+
+ *out++ = (((x >> 7) & 0x1) << 1) - 1;
+ *out++ = (((x >> 6) & 0x1) << 1) - 1;
+ *out++ = (((x >> 5) & 0x1) << 1) - 1;
+ *out++ = (((x >> 4) & 0x1) << 1) - 1;
+ *out++ = (((x >> 3) & 0x1) << 1) - 1;
+ *out++ = (((x >> 2) & 0x1) << 1) - 1;
+ *out++ = (((x >> 1) & 0x1) << 1) - 1;
+ *out++ = (((x >> 0) & 0x1) << 1) - 1;
+ }
+
+ return noutput_items;
+}
+
+
+
diff --git a/gnuradio-core/src/lib/general/gr_bytes_to_syms.h b/gnuradio-core/src/lib/general/gr_bytes_to_syms.h
new file mode 100644
index 000000000..23e5c6b91
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_bytes_to_syms.h
@@ -0,0 +1,61 @@
+/* -*- 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_BYTES_TO_SYMS_H
+#define INCLUDED_GR_BYTES_TO_SYMS_H
+
+#include <gr_core_api.h>
+#include <gr_sync_interpolator.h>
+
+class gr_bytes_to_syms;
+typedef boost::shared_ptr<gr_bytes_to_syms> gr_bytes_to_syms_sptr;
+
+GR_CORE_API gr_bytes_to_syms_sptr gr_make_bytes_to_syms ();
+
+/*!
+ * \brief Convert stream of bytes to stream of +/- 1 symbols
+ * \ingroup converter_blk
+ *
+ * input: stream of bytes; output: stream of float
+ *
+ * This block is deprecated.
+ *
+ * The combination of gr_packed_to_unpacked_bb followed by
+ * gr_chunks_to_symbols_bf or gr_chunks_to_symbols_bc handles the
+ * general case of mapping from a stream of bytes into arbitrary float
+ * or complex symbols.
+ *
+ * \sa gr_packed_to_unpacked_bb, gr_unpacked_to_packed_bb,
+ * \sa gr_chunks_to_symbols_bf, gr_chunks_to_symbols_bc.
+ */
+class GR_CORE_API gr_bytes_to_syms : public gr_sync_interpolator
+{
+ friend GR_CORE_API gr_bytes_to_syms_sptr gr_make_bytes_to_syms ();
+
+ gr_bytes_to_syms ();
+
+ public:
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif /* INCLUDED_GR_BYTES_TO_SYMS_H */
diff --git a/gnuradio-core/src/lib/general/gr_bytes_to_syms.i b/gnuradio-core/src/lib/general/gr_bytes_to_syms.i
new file mode 100644
index 000000000..185e7cd29
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_bytes_to_syms.i
@@ -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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,bytes_to_syms);
+
+gr_bytes_to_syms_sptr gr_make_bytes_to_syms ();
+
+class gr_bytes_to_syms : public gr_sync_interpolator
+{
+ gr_bytes_to_syms ();
+};
diff --git a/gnuradio-core/src/lib/general/gr_char_to_float.cc b/gnuradio-core/src/lib/general/gr_char_to_float.cc
new file mode 100644
index 000000000..f63aa5b16
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_char_to_float.cc
@@ -0,0 +1,72 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_char_to_float.h>
+#include <gr_io_signature.h>
+#include <volk/volk.h>
+
+gr_char_to_float_sptr
+gr_make_char_to_float (size_t vlen, float scale)
+{
+ return gnuradio::get_initial_sptr(new gr_char_to_float (vlen, scale));
+}
+
+gr_char_to_float::gr_char_to_float (size_t vlen, float scale)
+ : gr_sync_block ("gr_char_to_float",
+ gr_make_io_signature (1, 1, sizeof (char)*vlen),
+ gr_make_io_signature (1, 1, sizeof (float)*vlen)),
+ d_vlen(vlen), d_scale(scale)
+{
+ const int alignment_multiple =
+ volk_get_alignment() / sizeof(float);
+ set_alignment(std::max(1,alignment_multiple));
+}
+
+float
+gr_char_to_float::scale() const
+{
+ return d_scale;
+}
+
+void
+gr_char_to_float::set_scale(float scale)
+{
+ d_scale = scale;
+}
+
+int
+gr_char_to_float::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const int8_t *in = (const int8_t *) input_items[0];
+ float *out = (float *) output_items[0];
+
+ // Note: the unaligned benchmarked much faster than the aligned
+ volk_8i_s32f_convert_32f_u(out, in, d_scale, d_vlen*noutput_items);
+
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/general/gr_char_to_float.h b/gnuradio-core/src/lib/general/gr_char_to_float.h
new file mode 100644
index 000000000..5170c618c
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_char_to_float.h
@@ -0,0 +1,70 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005 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_CHAR_TO_FLOAT_H
+#define INCLUDED_GR_CHAR_TO_FLOAT_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+
+class gr_char_to_float;
+typedef boost::shared_ptr<gr_char_to_float> gr_char_to_float_sptr;
+
+GR_CORE_API gr_char_to_float_sptr
+gr_make_char_to_float (size_t vlen=1, float scale=1);
+
+/*!
+ * \brief Convert stream of chars to a stream of float
+ * \ingroup converter_blk
+ *
+ * \param vlen vector length of data streams.
+ * \param scale a scalar divider to change the output signal scale.
+ */
+
+class GR_CORE_API gr_char_to_float : public gr_sync_block
+{
+ private:
+ friend GR_CORE_API gr_char_to_float_sptr
+ gr_make_char_to_float (size_t vlen, float scale);
+ gr_char_to_float (size_t vlen, float scale);
+
+ size_t d_vlen;
+ float d_scale;
+
+ public:
+ /*!
+ * Get the scalar divider value.
+ */
+ float scale() const;
+
+ /*!
+ * Set the scalar divider value.
+ */
+ void set_scale(float scale);
+
+ virtual int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+
+#endif /* INCLUDED_GR_CHAR_TO_FLOAT_H */
diff --git a/gnuradio-core/src/lib/general/gr_char_to_float.i b/gnuradio-core/src/lib/general/gr_char_to_float.i
new file mode 100644
index 000000000..c0b3d75fe
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_char_to_float.i
@@ -0,0 +1,33 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005 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,char_to_float)
+
+gr_char_to_float_sptr
+gr_make_char_to_float (size_t vlen=1, float scale=1);
+
+class gr_char_to_float : public gr_sync_block
+{
+public:
+ float scale() const;
+ void set_scale(float scale);
+};
diff --git a/gnuradio-core/src/lib/general/gr_char_to_short.cc b/gnuradio-core/src/lib/general/gr_char_to_short.cc
new file mode 100644
index 000000000..bb9bd8909
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_char_to_short.cc
@@ -0,0 +1,64 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2011,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 <gr_char_to_short.h>
+#include <gr_io_signature.h>
+#include <volk/volk.h>
+
+gr_char_to_short_sptr
+gr_make_char_to_short (size_t vlen)
+{
+ return gnuradio::get_initial_sptr(new gr_char_to_short (vlen));
+}
+
+gr_char_to_short::gr_char_to_short (size_t vlen)
+ : gr_sync_block ("gr_char_to_short",
+ gr_make_io_signature (1, 1, sizeof (char)*vlen),
+ gr_make_io_signature (1, 1, sizeof (short)*vlen)),
+ d_vlen(vlen)
+{
+ const int alignment_multiple =
+ volk_get_alignment() / sizeof(char);
+ set_alignment(std::max(1,alignment_multiple));
+}
+
+int
+gr_char_to_short::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const int8_t *in = (const int8_t *) input_items[0];
+ int16_t *out = (int16_t *) output_items[0];
+
+ if(is_unaligned()) {
+ volk_8i_convert_16i_u(out, in, d_vlen*noutput_items);
+ }
+ else {
+ volk_8i_convert_16i_a(out, in, d_vlen*noutput_items);
+ }
+
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/general/gr_char_to_short.h b/gnuradio-core/src/lib/general/gr_char_to_short.h
new file mode 100644
index 000000000..7ac5e97b9
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_char_to_short.h
@@ -0,0 +1,58 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2011,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 INCLUDED_GR_CHAR_TO_SHORT_H
+#define INCLUDED_GR_CHAR_TO_SHORT_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+
+class gr_char_to_short;
+typedef boost::shared_ptr<gr_char_to_short> gr_char_to_short_sptr;
+
+GR_CORE_API gr_char_to_short_sptr
+gr_make_char_to_short (size_t vlen=1);
+
+/*!
+ * \brief Convert stream of chars to a stream of float
+ * \ingroup converter_blk
+ *
+ * \param vlen vector length of data streams.
+ */
+
+class GR_CORE_API gr_char_to_short : public gr_sync_block
+{
+ private:
+ friend GR_CORE_API gr_char_to_short_sptr
+ gr_make_char_to_short (size_t vlen);
+ gr_char_to_short (size_t vlen);
+
+ size_t d_vlen;
+
+ public:
+ virtual int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+
+#endif /* INCLUDED_GR_CHAR_TO_SHORT_H */
diff --git a/gnuradio-core/src/lib/general/gr_char_to_short.i b/gnuradio-core/src/lib/general/gr_char_to_short.i
new file mode 100644
index 000000000..a53a0990e
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_char_to_short.i
@@ -0,0 +1,30 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,char_to_short)
+
+gr_char_to_short_sptr gr_make_char_to_short (size_t vlen=1);
+
+class gr_char_to_short : public gr_sync_block
+{
+
+};
diff --git a/gnuradio-core/src/lib/general/gr_check_counting_s.cc b/gnuradio-core/src/lib/general/gr_check_counting_s.cc
new file mode 100644
index 000000000..c3288f481
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_check_counting_s.cc
@@ -0,0 +1,190 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_check_counting_s.h>
+#include <gr_io_signature.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+gr_check_counting_s_sptr
+gr_make_check_counting_s (bool do_32bit)
+{
+ return gnuradio::get_initial_sptr(new gr_check_counting_s (do_32bit));
+}
+
+gr_check_counting_s::gr_check_counting_s (bool do_32bit)
+ : gr_sync_block ("gr_check_counting",
+ gr_make_io_signature (1, 1, sizeof (short)),
+ gr_make_io_signature (0, 0, 0)),
+ d_state(SEARCHING), d_history (0), d_current_count (0), d_current_count_32bit(0),
+ d_total_errors (0), d_total_shorts (0),
+ d_do_32bit(do_32bit)
+{
+ enter_SEARCHING ();
+}
+
+int
+gr_check_counting_s::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ unsigned short *in = (unsigned short *) input_items[0];
+ if(d_do_32bit)
+ return check_32bit(noutput_items,in);
+ else
+ return check_16bit(noutput_items,in);
+}
+
+int
+gr_check_counting_s::check_16bit (int noutput_items,
+ unsigned short * in)
+{
+ for (int i = 0; i < noutput_items; i++){
+ unsigned short x = in[i];
+
+ switch (d_state){
+
+ case SEARCHING:
+ if (x == d_current_count){
+ right ();
+ log_error (d_current_count, x);
+ d_current_count = d_current_count + 1;
+ if (right_three_times ())
+ enter_LOCKED ();
+ }
+ else {
+ wrong ();
+ log_error (d_current_count, x);
+ d_current_count = x + 1;
+ }
+ break;
+
+ case LOCKED:
+ if (x == d_current_count){
+ right ();
+ d_current_count = d_current_count + 1;
+ }
+ else {
+ wrong ();
+ log_error (d_current_count, x);
+ d_current_count = d_current_count + 1;
+ if (wrong_three_times ())
+ enter_SEARCHING ();
+ }
+ break;
+
+ default:
+ abort ();
+ }
+
+ d_total_shorts++;
+ }
+
+ return noutput_items;
+}
+
+int
+gr_check_counting_s::check_32bit (int noutput_items,
+ unsigned short * in)
+{
+
+ for (int i = 0; i < noutput_items-1; i+=2){
+ unsigned int x_high16bits = in[i];
+ unsigned int x_low16bits = in[i+1];
+ unsigned int x = x_high16bits<<16 | x_low16bits;
+
+ switch (d_state){
+
+ case SEARCHING:
+ if (x == d_current_count_32bit){
+ right ();
+ log_error_32bit (d_current_count_32bit, x);
+ d_current_count_32bit = d_current_count_32bit + 1;
+ if (right_three_times ())
+ enter_LOCKED ();
+ }
+ else {
+ wrong ();
+ log_error_32bit (d_current_count_32bit, x);
+ d_current_count_32bit = x + 1;
+ }
+ break;
+
+ case LOCKED:
+ if (x == d_current_count_32bit){
+ right ();
+ d_current_count_32bit = d_current_count_32bit + 1;
+ }
+ else {
+ wrong ();
+ log_error_32bit (d_current_count_32bit, x);
+ d_current_count_32bit = d_current_count_32bit + 1;
+ if (wrong_three_times ())
+ enter_SEARCHING ();
+ }
+ break;
+
+ default:
+ abort ();
+ }
+
+ d_total_shorts++;
+ }
+
+ return noutput_items;
+}
+
+void
+gr_check_counting_s::enter_SEARCHING ()
+{
+ d_state = SEARCHING;
+ fprintf (stdout, "gr_check_counting: enter_SEARCHING at offset %8ld (0x%08lx)\n",
+ d_total_shorts, d_total_shorts);
+}
+
+void
+gr_check_counting_s::enter_LOCKED ()
+{
+ d_state = LOCKED;
+ fprintf (stdout, "gr_check_counting: enter_LOCKED at offset %8ld (0x%08lx)\n",
+ d_total_shorts, d_total_shorts);
+}
+
+void
+gr_check_counting_s::log_error (unsigned short expected, unsigned short actual)
+{
+ fprintf (stdout,
+"gr_check_counting: expected %5d (0x%04x) got %5d (0x%04x) offset %8ld (0x%08lx)\n",
+ expected, expected, actual, actual, d_total_shorts, d_total_shorts);
+}
+
+void
+gr_check_counting_s::log_error_32bit (unsigned int expected, unsigned int actual)
+{
+ fprintf (stdout,
+"gr_check_counting: expected %10d (0x%08x) got %10d (0x%08x) offset %8ld (0x%08lx)\n",
+ expected, expected, actual, actual, d_total_shorts, d_total_shorts);
+}
diff --git a/gnuradio-core/src/lib/general/gr_check_counting_s.h b/gnuradio-core/src/lib/general/gr_check_counting_s.h
new file mode 100644
index 000000000..996fa3259
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_check_counting_s.h
@@ -0,0 +1,89 @@
+/* -*- 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_CHECK_COUNTING_S_H
+#define INCLUDED_GR_CHECK_COUNTING_S_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+
+class gr_check_counting_s;
+typedef boost::shared_ptr<gr_check_counting_s> gr_check_counting_s_sptr;
+
+GR_CORE_API gr_check_counting_s_sptr gr_make_check_counting_s (bool do_32bit=false);
+
+/*!
+ * \brief sink that checks if its input stream consists of a counting sequence.
+ * \param do_32bit expect an interleaved 32 bit counter in stead of 16 bit counter (default false)
+ * \ingroup sink_blk
+ *
+ * This sink is typically used to test the USRP "Counting Mode" or "Counting mode 32 bit".
+ */
+class GR_CORE_API gr_check_counting_s : public gr_sync_block
+{
+ friend GR_CORE_API gr_check_counting_s_sptr gr_make_check_counting_s (bool do_32bit);
+
+ enum state {
+ SEARCHING, // searching for synchronization
+ LOCKED // is locked
+ };
+
+ state d_state;
+ unsigned int d_history; // bitmask of decisions
+ unsigned short d_current_count;
+ unsigned int d_current_count_32bit;
+
+ long d_total_errors;
+ long d_total_shorts;
+ bool d_do_32bit;
+
+ gr_check_counting_s (bool do_32bit);
+
+ void enter_SEARCHING ();
+ void enter_LOCKED ();
+
+ void right (){
+ d_history = (d_history << 1) | 0x1;
+ }
+
+ void wrong (){
+ d_history = (d_history << 1) | 0x0;
+ d_total_errors++;
+ }
+
+ bool right_three_times () { return (d_history & 0x7) == 0x7; }
+ bool wrong_three_times () { return (d_history & 0x7) == 0x0; }
+
+ void log_error (unsigned short expected, unsigned short actual);
+ void log_error_32bit (unsigned int expected, unsigned int actual);
+
+ int check_32bit (int noutput_items, unsigned short * in);
+ int check_16bit (int noutput_items, unsigned short * in);
+
+ public:
+
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+
+#endif /* INCLUDED_GR_CHECK_COUNTING_S_H */
diff --git a/gnuradio-core/src/lib/general/gr_check_counting_s.i b/gnuradio-core/src/lib/general/gr_check_counting_s.i
new file mode 100644
index 000000000..0275dad9d
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_check_counting_s.i
@@ -0,0 +1,31 @@
+/* -*- 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,check_counting_s)
+
+gr_check_counting_s_sptr gr_make_check_counting_s (bool do_32bit=false);
+
+class gr_check_counting_s : public gr_sync_block
+{
+ private:
+ gr_check_counting_s (bool do_32bit);
+};
diff --git a/gnuradio-core/src/lib/general/gr_check_lfsr_32k_s.cc b/gnuradio-core/src/lib/general/gr_check_lfsr_32k_s.cc
new file mode 100644
index 000000000..088b8c38a
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_check_lfsr_32k_s.cc
@@ -0,0 +1,169 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_check_lfsr_32k_s.h>
+#include <gr_io_signature.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+gr_check_lfsr_32k_s_sptr
+gr_make_check_lfsr_32k_s ()
+{
+ return gnuradio::get_initial_sptr(new gr_check_lfsr_32k_s ());
+}
+
+gr_check_lfsr_32k_s::gr_check_lfsr_32k_s ()
+ : gr_sync_block ("gr_check_lfsr_32k",
+ gr_make_io_signature (1, 1, sizeof (short)),
+ gr_make_io_signature (0, 0, 0)),
+ d_state(SEARCHING), d_history (0), d_ntotal (0), d_nright (0),
+ d_runlength (0), d_index(0)
+{
+ gri_lfsr_32k lfsr;
+
+ for (int i = 0; i < BUFSIZE; i++)
+ d_buffer[i] = lfsr.next_short ();
+
+ enter_SEARCHING ();
+}
+
+int
+gr_check_lfsr_32k_s::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ unsigned short *in = (unsigned short *) input_items[0];
+
+ for (int i = 0; i < noutput_items; i++){
+ unsigned short x = in[i];
+ unsigned short expected;
+
+ switch (d_state){
+
+ case MATCH0:
+ if (x == d_buffer[0])
+ enter_MATCH1 ();
+ break;
+
+ case MATCH1:
+ if (x == d_buffer[1])
+ enter_MATCH2 ();
+ else
+ enter_MATCH0 ();
+ break;
+
+ case MATCH2:
+ if (x == d_buffer[2])
+ enter_LOCKED ();
+ else
+ enter_MATCH0 ();
+ break;
+
+ case LOCKED:
+ expected = d_buffer[d_index];
+ d_index = d_index + 1;
+ if (d_index >= BUFSIZE)
+ d_index = 0;
+
+ if (x == expected)
+ right ();
+ else {
+ wrong ();
+ log_error (expected, x);
+ if (wrong_three_times ())
+ enter_SEARCHING ();
+ }
+ break;
+
+ default:
+ abort ();
+ }
+
+ d_ntotal++;
+ }
+
+ return noutput_items;
+}
+
+void
+gr_check_lfsr_32k_s::enter_SEARCHING ()
+{
+ d_state = SEARCHING;
+ wrong (); // reset history
+ wrong ();
+ wrong ();
+
+ d_runlength = 0;
+ d_index = 0; // reset LFSR to beginning
+
+ if (0)
+ fprintf (stdout, "gr_check_lfsr_32k: enter_SEARCHING at offset %8ld (0x%08lx)\n",
+ d_ntotal, d_ntotal);
+
+ enter_MATCH0 ();
+}
+
+void
+gr_check_lfsr_32k_s::enter_MATCH0 ()
+{
+ d_state = MATCH0;
+}
+
+void
+gr_check_lfsr_32k_s::enter_MATCH1 ()
+{
+ d_state = MATCH1;
+}
+
+void
+gr_check_lfsr_32k_s::enter_MATCH2 ()
+{
+ d_state = MATCH2;
+}
+
+void
+gr_check_lfsr_32k_s::enter_LOCKED ()
+{
+ d_state = LOCKED;
+ right (); // setup history
+ right ();
+ right ();
+
+ d_index = 3; // already matched first 3 items
+
+ if (0)
+ fprintf (stdout, "gr_check_lfsr_32k: enter_LOCKED at offset %8ld (0x%08lx)\n",
+ d_ntotal, d_ntotal);
+}
+
+void
+gr_check_lfsr_32k_s::log_error (unsigned short expected, unsigned short actual)
+{
+ if (0)
+ fprintf (stdout,
+ "gr_check_lfsr_32k: expected %5d (0x%04x) got %5d (0x%04x) offset %8ld (0x%08lx)\n",
+ expected, expected, actual, actual, d_ntotal, d_ntotal);
+}
diff --git a/gnuradio-core/src/lib/general/gr_check_lfsr_32k_s.h b/gnuradio-core/src/lib/general/gr_check_lfsr_32k_s.h
new file mode 100644
index 000000000..2f980b427
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_check_lfsr_32k_s.h
@@ -0,0 +1,103 @@
+/* -*- 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_CHECK_LFSR_32K_S_H
+#define INCLUDED_GR_CHECK_LFSR_32K_S_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+#include <gri_lfsr_32k.h>
+
+
+class gr_check_lfsr_32k_s;
+typedef boost::shared_ptr<gr_check_lfsr_32k_s> gr_check_lfsr_32k_s_sptr;
+
+GR_CORE_API gr_check_lfsr_32k_s_sptr gr_make_check_lfsr_32k_s ();
+
+/*!
+ * \brief sink that checks if its input stream consists of a lfsr_32k sequence.
+ * \ingroup sink_blk
+ *
+ * This sink is typically used along with gr_lfsr_32k_source_s to test
+ * the USRP using its digital loopback mode.
+ */
+class GR_CORE_API gr_check_lfsr_32k_s : public gr_sync_block
+{
+ friend GR_CORE_API gr_check_lfsr_32k_s_sptr gr_make_check_lfsr_32k_s ();
+
+ enum state {
+ SEARCHING, // searching for synchronization
+ MATCH0,
+ MATCH1,
+ MATCH2,
+ LOCKED // is locked
+ };
+
+ state d_state;
+ unsigned int d_history; // bitmask of decisions
+
+ long d_ntotal; // total number of shorts
+ long d_nright; // # of correct shorts
+ long d_runlength; // # of correct shorts in a row
+
+ static const int BUFSIZE = 2048 - 1; // ensure pattern isn't packet aligned
+ int d_index;
+ unsigned short d_buffer[BUFSIZE];
+
+
+ gr_check_lfsr_32k_s ();
+
+ void enter_SEARCHING ();
+ void enter_MATCH0 ();
+ void enter_MATCH1 ();
+ void enter_MATCH2 ();
+ void enter_LOCKED ();
+
+ void right (){
+ d_history = (d_history << 1) | 0x1;
+ d_nright++;
+ d_runlength++;
+ }
+
+ void wrong (){
+ d_history = (d_history << 1) | 0x0;
+ d_runlength = 0;
+ }
+
+ bool right_three_times () { return (d_history & 0x7) == 0x7; }
+ bool wrong_three_times () { return (d_history & 0x7) == 0x0; }
+
+ void log_error (unsigned short expected, unsigned short actual);
+
+ public:
+
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+
+ long ntotal () const { return d_ntotal; }
+ long nright () const { return d_nright; }
+ long runlength () const { return d_runlength; }
+
+};
+
+
+#endif /* INCLUDED_GR_CHECK_LFSR_32K_S_H */
diff --git a/gnuradio-core/src/lib/general/gr_check_lfsr_32k_s.i b/gnuradio-core/src/lib/general/gr_check_lfsr_32k_s.i
new file mode 100644
index 000000000..34d4a0b0c
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_check_lfsr_32k_s.i
@@ -0,0 +1,36 @@
+/* -*- 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,check_lfsr_32k_s)
+
+gr_check_lfsr_32k_s_sptr gr_make_check_lfsr_32k_s ();
+
+class gr_check_lfsr_32k_s : public gr_sync_block
+{
+ private:
+ gr_check_lfsr_32k_s ();
+
+public:
+ long ntotal () const;
+ long nright () const;
+ long runlength () const;
+};
diff --git a/gnuradio-core/src/lib/general/gr_circular_file.cc b/gnuradio-core/src/lib/general/gr_circular_file.cc
new file mode 100644
index 000000000..6f710c49b
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_circular_file.cc
@@ -0,0 +1,203 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <gr_circular_file.h>
+
+#include <unistd.h>
+#ifdef HAVE_SYS_MMAN_H
+#include <sys/mman.h>
+#endif
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <assert.h>
+#include <stdlib.h>
+
+#include <algorithm>
+#include <stdio.h>
+#include <string.h>
+
+#ifdef HAVE_IO_H
+#include <io.h>
+#endif
+
+static const int HEADER_SIZE = 4096;
+static const int HEADER_MAGIC = 0xEB021026;
+
+static const int HD_MAGIC = 0;
+static const int HD_HEADER_SIZE = 1; // integer offsets into header
+static const int HD_BUFFER_SIZE = 2;
+static const int HD_BUFFER_BASE = 3;
+static const int HD_BUFFER_CURRENT = 4;
+
+gr_circular_file::gr_circular_file (const char *filename,
+ bool writable, int size)
+ : d_fd (-1), d_header (0), d_buffer (0), d_mapped_size (0), d_bytes_read (0)
+{
+ int mm_prot;
+ if (writable){
+#ifdef HAVE_MMAP
+ mm_prot = PROT_READ | PROT_WRITE;
+#endif
+ d_fd = open (filename, O_CREAT | O_RDWR | O_TRUNC, 0664);
+ if (d_fd < 0){
+ perror (filename);
+ exit (1);
+ }
+#ifdef HAVE_MMAP /* FIXME */
+ if(ftruncate (d_fd, size + HEADER_SIZE) != 0) {
+ perror (filename);
+ exit (1);
+ }
+#endif
+ }
+ else {
+#ifdef HAVE_MMAP
+ mm_prot = PROT_READ;
+#endif
+ d_fd = open (filename, O_RDONLY);
+ if (d_fd < 0){
+ perror (filename);
+ exit (1);
+ }
+ }
+
+ struct stat statbuf;
+ if (fstat (d_fd, &statbuf) < 0){
+ perror (filename);
+ exit (1);
+ }
+
+ if (statbuf.st_size < HEADER_SIZE){
+ fprintf (stderr, "%s: file too small to be circular buffer\n", filename);
+ exit (1);
+ }
+
+ d_mapped_size = statbuf.st_size;
+#ifdef HAVE_MMAP
+ void *p = mmap (0, d_mapped_size, mm_prot, MAP_SHARED, d_fd, 0);
+ if (p == MAP_FAILED){
+ perror ("gr_circular_file: mmap failed");
+ exit (1);
+ }
+
+ d_header = (int *) p;
+#else
+ perror ("gr_circular_file: mmap unsupported by this system");
+ exit (1);
+#endif
+
+ if (writable){ // init header
+
+ if (size < 0){
+ fprintf (stderr, "gr_circular_buffer: size must be > 0 when writable\n");
+ exit (1);
+ }
+
+ d_header[HD_MAGIC] = HEADER_MAGIC;
+ d_header[HD_HEADER_SIZE] = HEADER_SIZE;
+ d_header[HD_BUFFER_SIZE] = size;
+ d_header[HD_BUFFER_BASE] = HEADER_SIZE; // right after header
+ d_header[HD_BUFFER_CURRENT] = 0;
+ }
+
+ // sanity check (the asserts are a bit unforgiving...)
+
+ assert (d_header[HD_MAGIC] == HEADER_MAGIC);
+ assert (d_header[HD_HEADER_SIZE] == HEADER_SIZE);
+ assert (d_header[HD_BUFFER_SIZE] > 0);
+ assert (d_header[HD_BUFFER_BASE] >= d_header[HD_HEADER_SIZE]);
+ assert (d_header[HD_BUFFER_BASE] + d_header[HD_BUFFER_SIZE] <= d_mapped_size);
+ assert (d_header[HD_BUFFER_CURRENT] >= 0 &&
+ d_header[HD_BUFFER_CURRENT] < d_header[HD_BUFFER_SIZE]);
+
+ d_bytes_read = 0;
+ d_buffer = (unsigned char *) d_header + d_header[HD_BUFFER_BASE];
+}
+
+gr_circular_file::~gr_circular_file ()
+{
+#ifdef HAVE_MMAP
+ if (munmap ((char *) d_header, d_mapped_size) < 0){
+ perror ("gr_circular_file: munmap");
+ exit (1);
+ }
+#endif
+ close (d_fd);
+}
+
+bool
+gr_circular_file::write (void *vdata, int nbytes)
+{
+ unsigned char *data = (unsigned char *) vdata;
+ int buffer_size = d_header[HD_BUFFER_SIZE];
+ int buffer_current = d_header[HD_BUFFER_CURRENT];
+
+ while (nbytes > 0){
+ int n = std::min (nbytes, buffer_size - buffer_current);
+ memcpy (d_buffer + buffer_current, data, n);
+
+ buffer_current += n;
+ if (buffer_current >= buffer_size)
+ buffer_current = 0;
+
+ data += n;
+ nbytes -= n;
+ }
+
+ d_header[HD_BUFFER_CURRENT] = buffer_current;
+ return true;
+}
+
+int
+gr_circular_file::read (void *vdata, int nbytes)
+{
+ unsigned char *data = (unsigned char *) vdata;
+ int buffer_current = d_header[HD_BUFFER_CURRENT];
+ int buffer_size = d_header[HD_BUFFER_SIZE];
+ int total = 0;
+
+ nbytes = std::min (nbytes, buffer_size - d_bytes_read);
+
+ while (nbytes > 0){
+ int offset = (buffer_current + d_bytes_read) % buffer_size;
+ int n = std::min (nbytes, buffer_size - offset);
+ memcpy (data, d_buffer + offset, n);
+ data += n;
+ d_bytes_read += n;
+ total += n;
+ nbytes -= n;
+ }
+ return total;
+}
+
+void
+gr_circular_file::reset_read_pointer ()
+{
+ d_bytes_read = 0;
+}
diff --git a/gnuradio-core/src/lib/general/gr_circular_file.h b/gnuradio-core/src/lib/general/gr_circular_file.h
new file mode 100644
index 000000000..ca1f793f3
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_circular_file.h
@@ -0,0 +1,60 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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 _GR_CIRCULAR_FILE_H_
+#define _GR_CIRCULAR_FILE_H_
+
+#include <gr_core_api.h>
+
+/*
+ * writes input data into a circular buffer on disk.
+ *
+ * the file contains a fixed header:
+ * 0x0000: int32 magic (0xEB021026)
+ * 0x0004: int32 size in bytes of header (constant 4096)
+ * 0x0008: int32 size in bytes of circular buffer (not including header)
+ * 0x000C: int32 file offset to beginning of circular buffer
+ * 0x0010: int32 byte offset from beginning of circular buffer to
+ * current start of data
+ *
+ */
+class GR_CORE_API gr_circular_file {
+ int d_fd;
+ int *d_header;
+ unsigned char *d_buffer;
+ int d_mapped_size;
+ int d_bytes_read;
+
+public:
+ gr_circular_file (const char *filename, bool writable = false, int size = 0);
+ ~gr_circular_file ();
+
+ bool write (void *data, int nbytes);
+
+ // returns # of bytes actually read or 0 if end of buffer, or -1 on error.
+ int read (void *data, int nbytes);
+
+ // reset read pointer to beginning of buffer.
+ void reset_read_pointer ();
+};
+
+#endif /* _GR_CIRCULAR_FILE_H_ */ \ No newline at end of file
diff --git a/gnuradio-core/src/lib/general/gr_complex_to_interleaved_short.cc b/gnuradio-core/src/lib/general/gr_complex_to_interleaved_short.cc
new file mode 100644
index 000000000..596c14996
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_complex_to_interleaved_short.cc
@@ -0,0 +1,62 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2005,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_complex_to_interleaved_short.h>
+#include <gr_io_signature.h>
+#include <math.h>
+
+gr_complex_to_interleaved_short_sptr
+gr_make_complex_to_interleaved_short ()
+{
+ return gnuradio::get_initial_sptr(new gr_complex_to_interleaved_short ());
+}
+
+gr_complex_to_interleaved_short::gr_complex_to_interleaved_short ()
+ : gr_sync_interpolator ("gr_complex_to_interleaved_short",
+ gr_make_io_signature (1, 1, sizeof (gr_complex)),
+ gr_make_io_signature (1, 1, sizeof (short)),
+ 2)
+{
+}
+
+int
+gr_complex_to_interleaved_short::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const gr_complex *in = (const gr_complex *) input_items[0];
+ short *out = (short *) output_items[0];
+
+ for (int i = 0; i < noutput_items/2; i++){
+ *out++ = (short) lrintf(in[i].real()); // FIXME saturate?
+ *out++ = (short) lrintf(in[i].imag());
+ }
+
+ return noutput_items;
+}
+
+
+
diff --git a/gnuradio-core/src/lib/general/gr_complex_to_interleaved_short.h b/gnuradio-core/src/lib/general/gr_complex_to_interleaved_short.h
new file mode 100644
index 000000000..66503413f
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_complex_to_interleaved_short.h
@@ -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.
+ */
+
+#ifndef INCLUDED_GR_COMPLEX_TO_INTERLEAVED_SHORT_H
+#define INCLUDED_GR_COMPLEX_TO_INTERLEAVED_SHORT_H
+
+#include <gr_core_api.h>
+#include <gr_sync_interpolator.h>
+
+class gr_complex_to_interleaved_short;
+typedef boost::shared_ptr<gr_complex_to_interleaved_short>
+ gr_complex_to_interleaved_short_sptr;
+
+GR_CORE_API gr_complex_to_interleaved_short_sptr
+gr_make_complex_to_interleaved_short ();
+
+/*!
+ * \brief Convert stream of complex to a stream of interleaved shorts
+ * \ingroup converter_blk
+ */
+
+class GR_CORE_API gr_complex_to_interleaved_short : public gr_sync_interpolator
+{
+ friend GR_CORE_API gr_complex_to_interleaved_short_sptr gr_make_complex_to_interleaved_short ();
+ gr_complex_to_interleaved_short ();
+
+ public:
+ virtual int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif /* INCLUDED_GR_COMPLEX_TO_INTERLEAVED_SHORT_H */
diff --git a/gnuradio-core/src/lib/general/gr_complex_to_interleaved_short.i b/gnuradio-core/src/lib/general/gr_complex_to_interleaved_short.i
new file mode 100644
index 000000000..19c01b7c6
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_complex_to_interleaved_short.i
@@ -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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,complex_to_interleaved_short)
+
+gr_complex_to_interleaved_short_sptr gr_make_complex_to_interleaved_short ();
+
+class gr_complex_to_interleaved_short : public gr_sync_interpolator
+{
+ gr_complex_to_interleaved_short ();
+};
diff --git a/gnuradio-core/src/lib/general/gr_complex_to_xxx.cc b/gnuradio-core/src/lib/general/gr_complex_to_xxx.cc
new file mode 100644
index 000000000..cdf6d7f3a
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_complex_to_xxx.cc
@@ -0,0 +1,280 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2008,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 <gr_complex_to_xxx.h>
+#include <gr_io_signature.h>
+#include <gr_math.h>
+#include <volk/volk.h>
+
+// ----------------------------------------------------------------
+
+gr_complex_to_float_sptr
+gr_make_complex_to_float (unsigned int vlen)
+{
+ return gnuradio::get_initial_sptr(new gr_complex_to_float (vlen));
+}
+
+gr_complex_to_float::gr_complex_to_float (unsigned int vlen)
+ : gr_sync_block ("complex_to_float",
+ gr_make_io_signature (1, 1, sizeof (gr_complex) * vlen),
+ gr_make_io_signature (1, 2, sizeof (float) * vlen)),
+ d_vlen(vlen)
+{
+ const int alignment_multiple =
+ volk_get_alignment() / sizeof(float);
+ set_alignment(std::max(1,alignment_multiple));
+}
+
+int
+gr_complex_to_float::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const gr_complex *in = (const gr_complex *) input_items[0];
+ float *out0 = (float *) output_items[0];
+ float* out1;
+ int noi = noutput_items * d_vlen;
+
+ switch (output_items.size ()){
+ case 1:
+ if(is_unaligned()) {
+ for (int i = 0; i < noi; i++){
+ out0[i] = in[i].real ();
+ }
+ }
+ else {
+ volk_32fc_deinterleave_real_32f_a(out0, in, noi);
+ }
+ break;
+
+ case 2:
+ out1 = (float *) output_items[1];
+ if(is_unaligned()) {
+ for (int i = 0; i < noi; i++){
+ out0[i] = in[i].real ();
+ out1[i] = in[i].imag ();
+ }
+ }
+ else {
+ volk_32fc_deinterleave_32f_x2_a(out0, out1, in, noi);
+ }
+ break;
+
+ default:
+ abort ();
+ }
+
+ return noutput_items;
+}
+
+// ----------------------------------------------------------------
+
+gr_complex_to_real_sptr
+gr_make_complex_to_real (unsigned int vlen)
+{
+ return gnuradio::get_initial_sptr(new gr_complex_to_real (vlen));
+}
+
+gr_complex_to_real::gr_complex_to_real (unsigned int vlen)
+ : gr_sync_block ("complex_to_real",
+ gr_make_io_signature (1, 1, sizeof (gr_complex) * vlen),
+ gr_make_io_signature (1, 1, sizeof (float) * vlen)),
+ d_vlen(vlen)
+{
+ const int alignment_multiple =
+ volk_get_alignment() / sizeof(float);
+ set_alignment(std::max(1,alignment_multiple));
+}
+
+int
+gr_complex_to_real::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const gr_complex *in = (const gr_complex *) input_items[0];
+ float *out = (float *) output_items[0];
+ int noi = noutput_items * d_vlen;
+
+ if(is_unaligned()) {
+ for (int i = 0; i < noi; i++){
+ out[i] = in[i].real ();
+ }
+ }
+ else {
+ volk_32fc_deinterleave_real_32f_a(out, in, noi);
+ }
+
+ return noutput_items;
+}
+
+// ----------------------------------------------------------------
+
+gr_complex_to_imag_sptr
+gr_make_complex_to_imag (unsigned int vlen)
+{
+ return gnuradio::get_initial_sptr(new gr_complex_to_imag (vlen));
+}
+
+gr_complex_to_imag::gr_complex_to_imag (unsigned int vlen)
+ : gr_sync_block ("complex_to_imag",
+ gr_make_io_signature (1, 1, sizeof (gr_complex) * vlen),
+ gr_make_io_signature (1, 1, sizeof (float) * vlen)),
+ d_vlen(vlen)
+{
+ const int alignment_multiple =
+ volk_get_alignment() / sizeof(float);
+ set_alignment(std::max(1,alignment_multiple));
+}
+
+int
+gr_complex_to_imag::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const gr_complex *in = (const gr_complex *) input_items[0];
+ float *out = (float *) output_items[0];
+ int noi = noutput_items * d_vlen;
+
+ if(is_unaligned()) {
+ for (int i = 0; i < noi; i++){
+ out[i] = in[i].imag ();
+ }
+ }
+ else {
+ volk_32fc_deinterleave_imag_32f_a(out, in, noi);
+ }
+
+ return noutput_items;
+}
+
+// ----------------------------------------------------------------
+
+gr_complex_to_mag_sptr
+gr_make_complex_to_mag (unsigned int vlen)
+{
+ return gnuradio::get_initial_sptr(new gr_complex_to_mag (vlen));
+}
+
+gr_complex_to_mag::gr_complex_to_mag (unsigned int vlen)
+ : gr_sync_block ("complex_to_mag",
+ gr_make_io_signature (1, 1, sizeof (gr_complex) * vlen),
+ gr_make_io_signature (1, 1, sizeof (float) * vlen)),
+ d_vlen(vlen)
+{
+ const int alignment_multiple =
+ volk_get_alignment() / sizeof(float);
+ set_alignment(std::max(1,alignment_multiple));
+}
+
+int
+gr_complex_to_mag::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const gr_complex *in = (const gr_complex *) input_items[0];
+ float *out = (float *) output_items[0];
+ int noi = noutput_items * d_vlen;
+
+ // turned out to be faster than aligned/unaligned switching
+ volk_32fc_magnitude_32f_u(out, in, noi);
+
+ return noutput_items;
+}
+
+// ----------------------------------------------------------------
+
+gr_complex_to_mag_squared_sptr
+gr_make_complex_to_mag_squared (unsigned int vlen)
+{
+ return gnuradio::get_initial_sptr(new gr_complex_to_mag_squared (vlen));
+}
+
+gr_complex_to_mag_squared::gr_complex_to_mag_squared (unsigned int vlen)
+ : gr_sync_block ("complex_to_mag_squared",
+ gr_make_io_signature (1, 1, sizeof (gr_complex) * vlen),
+ gr_make_io_signature (1, 1, sizeof (float) * vlen)),
+ d_vlen(vlen)
+{
+ const int alignment_multiple =
+ volk_get_alignment() / sizeof(float);
+ set_alignment(std::max(1,alignment_multiple));
+}
+
+int
+gr_complex_to_mag_squared::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const gr_complex *in = (const gr_complex *) input_items[0];
+ float *out = (float *) output_items[0];
+ int noi = noutput_items * d_vlen;
+
+ if(is_unaligned()) {
+ volk_32fc_magnitude_squared_32f_u(out, in, noi);
+ }
+ else {
+ volk_32fc_magnitude_squared_32f_a(out, in, noi);
+ }
+
+ return noutput_items;
+}
+
+// ----------------------------------------------------------------
+
+gr_complex_to_arg_sptr
+gr_make_complex_to_arg (unsigned int vlen)
+{
+ return gnuradio::get_initial_sptr(new gr_complex_to_arg (vlen));
+}
+
+gr_complex_to_arg::gr_complex_to_arg (unsigned int vlen)
+ : gr_sync_block ("complex_to_arg",
+ gr_make_io_signature (1, 1, sizeof (gr_complex) * vlen),
+ gr_make_io_signature (1, 1, sizeof (float) * vlen)),
+ d_vlen(vlen)
+{
+ const int alignment_multiple =
+ volk_get_alignment() / sizeof(float);
+ set_alignment(std::max(1,alignment_multiple));
+}
+
+int
+gr_complex_to_arg::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const gr_complex *in = (const gr_complex *) input_items[0];
+ float *out = (float *) output_items[0];
+ int noi = noutput_items * d_vlen;
+
+ // The fast_atan2f is faster than Volk
+ for (int i = 0; i < noi; i++){
+ // out[i] = std::arg (in[i]);
+ out[i] = gr_fast_atan2f(in[i]);
+ }
+
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/general/gr_complex_to_xxx.h b/gnuradio-core/src/lib/general/gr_complex_to_xxx.h
new file mode 100644
index 000000000..a2f06ea28
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_complex_to_xxx.h
@@ -0,0 +1,160 @@
+/* -*- 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_COMPLEX_TO_XXX_H
+#define INCLUDED_GR_COMPLEX_TO_XXX_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+#include <gr_complex.h>
+
+class gr_complex_to_float;
+class gr_complex_to_real;
+class gr_complex_to_imag;
+class gr_complex_to_mag;
+class gr_complex_to_mag_squared;
+class gr_complex_to_arg;
+
+typedef boost::shared_ptr<gr_complex_to_float> gr_complex_to_float_sptr;
+typedef boost::shared_ptr<gr_complex_to_real> gr_complex_to_real_sptr;
+typedef boost::shared_ptr<gr_complex_to_imag> gr_complex_to_imag_sptr;
+typedef boost::shared_ptr<gr_complex_to_mag> gr_complex_to_mag_sptr;
+typedef boost::shared_ptr<gr_complex_to_mag_squared> gr_complex_to_mag_squared_sptr;
+typedef boost::shared_ptr<gr_complex_to_arg> gr_complex_to_arg_sptr;
+
+GR_CORE_API gr_complex_to_float_sptr gr_make_complex_to_float (unsigned int vlen=1);
+GR_CORE_API gr_complex_to_real_sptr gr_make_complex_to_real (unsigned int vlen=1);
+GR_CORE_API gr_complex_to_imag_sptr gr_make_complex_to_imag (unsigned int vlen=1);
+GR_CORE_API gr_complex_to_mag_sptr gr_make_complex_to_mag (unsigned int vlen=1);
+GR_CORE_API gr_complex_to_mag_squared_sptr gr_make_complex_to_mag_squared (unsigned int vlen=1);
+GR_CORE_API gr_complex_to_arg_sptr gr_make_complex_to_arg (unsigned int vlen=1);
+
+/*!
+ * \brief convert a stream of gr_complex to 1 or 2 streams of float
+ * \ingroup converter_blk
+ * \param vlen vector len (default 1)
+ */
+class GR_CORE_API gr_complex_to_float : public gr_sync_block
+{
+ friend GR_CORE_API gr_complex_to_float_sptr gr_make_complex_to_float (unsigned int vlen);
+ gr_complex_to_float (unsigned int vlen);
+
+ unsigned int d_vlen;
+
+ public:
+ virtual int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+/*!
+ * \brief complex in, real out (float)
+ * \ingroup converter_blk
+ * \param vlen vector len (default 1)
+ */
+class GR_CORE_API gr_complex_to_real : public gr_sync_block
+{
+ friend GR_CORE_API gr_complex_to_real_sptr gr_make_complex_to_real (unsigned int vlen);
+ gr_complex_to_real (unsigned int vlen);
+
+ unsigned int d_vlen;
+
+ public:
+ virtual int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+/*!
+ * \brief complex in, imaginary out (float)
+ * \ingroup converter_blk
+ * \param vlen vector len (default 1)
+ */
+class GR_CORE_API gr_complex_to_imag : public gr_sync_block
+{
+ friend GR_CORE_API gr_complex_to_imag_sptr gr_make_complex_to_imag (unsigned int vlen);
+ gr_complex_to_imag (unsigned int vlen);
+
+ unsigned int d_vlen;
+
+ public:
+ virtual int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+/*!
+ * \brief complex in, magnitude out (float)
+ * \ingroup converter_blk
+ * \param vlen vector len (default 1)
+ */
+class GR_CORE_API gr_complex_to_mag : public gr_sync_block
+{
+ friend GR_CORE_API gr_complex_to_mag_sptr
+ gr_make_complex_to_mag (unsigned int vlen);
+ gr_complex_to_mag (unsigned int vlen);
+
+ unsigned int d_vlen;
+
+ public:
+ virtual int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+/*!
+ * \brief complex in, magnitude squared out (float)
+ * \ingroup converter_blk
+ * \param vlen vector len (default 1)
+ */
+class GR_CORE_API gr_complex_to_mag_squared : public gr_sync_block
+{
+ friend GR_CORE_API gr_complex_to_mag_squared_sptr gr_make_complex_to_mag_squared (unsigned int vlen);
+ gr_complex_to_mag_squared (unsigned int vlen);
+
+ unsigned int d_vlen;
+
+ public:
+ virtual int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+/*!
+ * \brief complex in, angle out (float)
+ * \ingroup converter_blk
+ * \param vlen vector len (default 1)
+ */
+class GR_CORE_API gr_complex_to_arg : public gr_sync_block
+{
+ friend GR_CORE_API gr_complex_to_arg_sptr gr_make_complex_to_arg (unsigned int vlen);
+ gr_complex_to_arg (unsigned int vlen);
+
+ unsigned int d_vlen;
+
+ public:
+ virtual int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif /* INCLUDED_GR_COMPLEX_TO_XXX_H */
diff --git a/gnuradio-core/src/lib/general/gr_complex_to_xxx.i b/gnuradio-core/src/lib/general/gr_complex_to_xxx.i
new file mode 100644
index 000000000..372b0e8b5
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_complex_to_xxx.i
@@ -0,0 +1,64 @@
+/* -*- 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,complex_to_float);
+gr_complex_to_float_sptr gr_make_complex_to_float (unsigned int vlen=1);
+class gr_complex_to_float : public gr_sync_block
+{
+ gr_complex_to_float (unsigned int vlen);
+};
+
+GR_SWIG_BLOCK_MAGIC(gr,complex_to_real);
+gr_complex_to_real_sptr gr_make_complex_to_real (unsigned int vlen=1);
+class gr_complex_to_real : public gr_sync_block
+{
+ gr_complex_to_real (unsigned int vlen);
+};
+
+GR_SWIG_BLOCK_MAGIC(gr,complex_to_imag);
+gr_complex_to_imag_sptr gr_make_complex_to_imag (unsigned int vlen=1);
+class gr_complex_to_imag : public gr_sync_block
+{
+ gr_complex_to_imag (unsigned int vlen);
+};
+
+GR_SWIG_BLOCK_MAGIC(gr,complex_to_mag);
+gr_complex_to_mag_sptr gr_make_complex_to_mag (unsigned int vlen=1);
+class gr_complex_to_mag : public gr_sync_block
+{
+ gr_complex_to_mag (unsigned int vlen);
+};
+
+GR_SWIG_BLOCK_MAGIC(gr,complex_to_mag_squared);
+gr_complex_to_mag_squared_sptr gr_make_complex_to_mag_squared (unsigned int vlen=1);
+class gr_complex_to_mag_squared : public gr_sync_block
+{
+ gr_complex_to_mag_squared (unsigned int vlen);
+};
+
+GR_SWIG_BLOCK_MAGIC(gr,complex_to_arg);
+gr_complex_to_arg_sptr gr_make_complex_to_arg (unsigned int vlen=1);
+class gr_complex_to_arg : public gr_sync_block
+{
+ gr_complex_to_arg (unsigned int vlen);
+};
+
diff --git a/gnuradio-core/src/lib/general/gr_conjugate_cc.cc b/gnuradio-core/src/lib/general/gr_conjugate_cc.cc
new file mode 100644
index 000000000..94ac3e162
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_conjugate_cc.cc
@@ -0,0 +1,65 @@
+/* -*- 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: this file is machine generated. Edits will be over written
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_conjugate_cc.h>
+#include <gr_io_signature.h>
+#include <volk/volk.h>
+
+gr_conjugate_cc_sptr
+gr_make_conjugate_cc ()
+{
+ return gnuradio::get_initial_sptr(new gr_conjugate_cc ());
+}
+
+gr_conjugate_cc::gr_conjugate_cc ()
+ : gr_sync_block ("conjugate_cc",
+ gr_make_io_signature (1, 1, sizeof (gr_complex)),
+ gr_make_io_signature (1, 1, sizeof (gr_complex)))
+{
+ const int alignment_multiple =
+ volk_get_alignment() / sizeof(gr_complex);
+ set_alignment(std::max(1,alignment_multiple));
+}
+
+int
+gr_conjugate_cc::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ gr_complex *iptr = (gr_complex *) input_items[0];
+ gr_complex *optr = (gr_complex *) output_items[0];
+
+ if(is_unaligned()) {
+ volk_32fc_conjugate_32fc_u(optr, iptr, noutput_items);
+ }
+ else {
+ volk_32fc_conjugate_32fc_a(optr, iptr, noutput_items);
+ }
+
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/general/gr_conjugate_cc.h b/gnuradio-core/src/lib/general/gr_conjugate_cc.h
new file mode 100644
index 000000000..e0a2af716
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_conjugate_cc.h
@@ -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: this file is machine generated. Edits will be over written
+
+#ifndef INCLUDED_GR_CONJUGATE_CC_H
+#define INCLUDED_GR_CONJUGATE_CC_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+
+class gr_conjugate_cc;
+typedef boost::shared_ptr<gr_conjugate_cc> gr_conjugate_cc_sptr;
+
+GR_CORE_API gr_conjugate_cc_sptr gr_make_conjugate_cc ();
+
+/*!
+ * \brief output = complex conjugate of input
+ * \ingroup math_blk
+ */
+class GR_CORE_API gr_conjugate_cc : public gr_sync_block
+{
+ friend GR_CORE_API gr_conjugate_cc_sptr gr_make_conjugate_cc ();
+
+ gr_conjugate_cc ();
+
+ 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/general/gr_conjugate_cc.i b/gnuradio-core/src/lib/general/gr_conjugate_cc.i
new file mode 100644
index 000000000..444ebb1b8
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_conjugate_cc.i
@@ -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: this file is machine generated. Edits will be over written
+
+GR_SWIG_BLOCK_MAGIC(gr,conjugate_cc)
+
+gr_conjugate_cc_sptr gr_make_conjugate_cc ();
+
+class gr_conjugate_cc : public gr_sync_block
+{
+ private:
+ gr_conjugate_cc ();
+};
diff --git a/gnuradio-core/src/lib/general/gr_constants.cc.in b/gnuradio-core/src/lib/general/gr_constants.cc.in
new file mode 100644
index 000000000..b94f254d6
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_constants.cc.in
@@ -0,0 +1,57 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006,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.
+ */
+
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <gr_constants.h>
+
+const std::string
+gr_prefix()
+{
+ return "@prefix@";
+}
+
+const std::string
+gr_sysconfdir()
+{
+ return "@SYSCONFDIR@";
+}
+
+const std::string
+gr_prefsdir()
+{
+ return "@GR_PREFSDIR@";
+}
+
+const std::string
+gr_build_date()
+{
+ return "@BUILD_DATE@";
+}
+
+const std::string
+gr_version()
+{
+ return "@VERSION@";
+}
diff --git a/gnuradio-core/src/lib/general/gr_constants.h b/gnuradio-core/src/lib/general/gr_constants.h
new file mode 100644
index 000000000..00ed9463d
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_constants.h
@@ -0,0 +1,53 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006,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.
+ */
+#ifndef INCLUDED_GR_CONSTANTS_H
+#define INCLUDED_GR_CONSTANTS_H
+
+#include <gr_core_api.h>
+#include <string>
+
+/*!
+ * \brief return ./configure --prefix argument. Typically /usr/local
+ */
+GR_CORE_API const std::string gr_prefix();
+
+/*!
+ * \brief return ./configure --sysconfdir argument. Typically $prefix/etc or /etc
+ */
+GR_CORE_API const std::string gr_sysconfdir();
+
+/*!
+ * \brief return preferences file directory. Typically $sysconfdir/etc/conf.d
+ */
+GR_CORE_API const std::string gr_prefsdir();
+
+/*!
+ * \brief return date/time of build, as set when 'bootstrap' is run
+ */
+GR_CORE_API const std::string gr_build_date();
+
+/*!
+ * \brief return version string defined in configure.ac
+ */
+GR_CORE_API const std::string gr_version();
+
+#endif /* INCLUDED_GR_CONSTANTS_H */
diff --git a/gnuradio-core/src/lib/general/gr_constants.i b/gnuradio-core/src/lib/general/gr_constants.i
new file mode 100644
index 000000000..a5aef1492
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_constants.i
@@ -0,0 +1,13 @@
+/* -*- c++ -*- */
+
+%rename(prefix) gr_prefix;
+%rename(sysconfdir) gr_sysconfdir;
+%rename(prefsdir) gr_prefsdir;
+%rename(build_date) gr_build_date;
+%rename(version) gr_version;
+
+const std::string gr_prefix();
+const std::string gr_sysconfdir();
+const std::string gr_prefsdir();
+const std::string gr_build_date();
+const std::string gr_version();
diff --git a/gnuradio-core/src/lib/general/gr_copy.cc b/gnuradio-core/src/lib/general/gr_copy.cc
new file mode 100644
index 000000000..0a6f721f9
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_copy.cc
@@ -0,0 +1,71 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_copy.h>
+#include <gr_io_signature.h>
+#include <string.h>
+
+gr_copy_sptr
+gr_make_copy(size_t itemsize)
+{
+ return gnuradio::get_initial_sptr(new gr_copy(itemsize));
+}
+
+gr_copy::gr_copy(size_t itemsize)
+ : gr_block ("copy",
+ gr_make_io_signature (1, 1, itemsize),
+ gr_make_io_signature (1, 1, itemsize)),
+ d_itemsize(itemsize),
+ d_enabled(true)
+{
+}
+
+bool
+gr_copy::check_topology(int ninputs, int noutputs)
+{
+ return ninputs == noutputs;
+}
+
+int
+gr_copy::general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const uint8_t *in = (const uint8_t *) input_items[0];
+ uint8_t *out = (uint8_t *) output_items[0];
+
+ int n = std::min<int>(ninput_items[0], noutput_items);
+ int j = 0;
+
+ if (d_enabled) {
+ memcpy(out, in, n*d_itemsize);
+ j = n;
+ }
+
+ consume_each(n);
+ return j;
+}
diff --git a/gnuradio-core/src/lib/general/gr_copy.h b/gnuradio-core/src/lib/general/gr_copy.h
new file mode 100644
index 000000000..b0769fa2b
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_copy.h
@@ -0,0 +1,63 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006,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.
+ */
+
+#ifndef INCLUDED_GR_COPY_H
+#define INCLUDED_GR_COPY_H
+
+#include <gr_core_api.h>
+#include <gr_block.h>
+
+class gr_copy;
+typedef boost::shared_ptr<gr_copy> gr_copy_sptr;
+
+GR_CORE_API gr_copy_sptr gr_make_copy(size_t itemsize);
+
+/*!
+ * \brief output[i] = input[i]
+ * \ingroup misc_blk
+ *
+ * When enabled (default), this block copies its input to its output.
+ * When disabled, this block drops its input on the floor.
+ *
+ */
+class GR_CORE_API gr_copy : public gr_block
+{
+ size_t d_itemsize;
+ bool d_enabled;
+
+ friend GR_CORE_API gr_copy_sptr gr_make_copy(size_t itemsize);
+ gr_copy(size_t itemsize);
+
+ public:
+
+ bool check_topology(int ninputs, int noutputs);
+
+ void set_enabled(bool enable) { d_enabled = enable; }
+ bool enabled() const { return d_enabled;}
+
+ int general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif
diff --git a/gnuradio-core/src/lib/general/gr_copy.i b/gnuradio-core/src/lib/general/gr_copy.i
new file mode 100644
index 000000000..12ddce6aa
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_copy.i
@@ -0,0 +1,36 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006,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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,copy)
+
+gr_copy_sptr gr_make_copy(size_t itemsize);
+
+class gr_copy : public gr_block
+{
+ private:
+ gr_copy(size_t itemsize);
+
+public:
+
+ void set_enabled(bool enabled);
+ bool enabled();
+};
diff --git a/gnuradio-core/src/lib/general/gr_core_api.h b/gnuradio-core/src/lib/general/gr_core_api.h
new file mode 100644
index 000000000..74c802857
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_core_api.h
@@ -0,0 +1,33 @@
+/*
+ * 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.
+ */
+
+#ifndef INCLUDED_GR_CORE_API_H
+#define INCLUDED_GR_CORE_API_H
+
+#include <gruel/attributes.h>
+
+#ifdef gnuradio_core_EXPORTS
+# define GR_CORE_API __GR_ATTR_EXPORT
+#else
+# define GR_CORE_API __GR_ATTR_IMPORT
+#endif
+
+#endif /* INCLUDED_GR_CORE_API_H */
diff --git a/gnuradio-core/src/lib/general/gr_correlate_access_code_tag_bb.cc b/gnuradio-core/src/lib/general/gr_correlate_access_code_tag_bb.cc
new file mode 100644
index 000000000..73ded3c8b
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_correlate_access_code_tag_bb.cc
@@ -0,0 +1,129 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2006,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_correlate_access_code_tag_bb.h>
+#include <gr_io_signature.h>
+#include <stdexcept>
+#include <gr_count_bits.h>
+#include <cstdio>
+#include <iostream>
+
+#define VERBOSE 0
+
+
+gr_correlate_access_code_tag_bb_sptr
+gr_make_correlate_access_code_tag_bb (const std::string &access_code, int threshold, const std::string &tag_name)
+{
+ return gnuradio::get_initial_sptr(new gr_correlate_access_code_tag_bb (access_code, threshold, tag_name));
+}
+
+
+gr_correlate_access_code_tag_bb::gr_correlate_access_code_tag_bb (
+ const std::string &access_code, int threshold, const std::string &tag_name)
+ : gr_sync_block ("correlate_access_code_tag_bb",
+ gr_make_io_signature (1, 1, sizeof(char)),
+ gr_make_io_signature (1, 1, sizeof(char))),
+ d_data_reg(0), d_mask(0),
+ d_threshold(threshold), d_len(0)
+
+{
+ if (!set_access_code(access_code)){
+ fprintf(stderr, "gr_correlate_access_code_tag_bb: access_code is > 64 bits\n");
+ throw std::out_of_range ("access_code is > 64 bits");
+ }
+
+ std::stringstream str;
+ str << name() << unique_id();
+ d_me = pmt::pmt_string_to_symbol(str.str());
+ d_key = pmt::pmt_string_to_symbol(tag_name);
+}
+
+gr_correlate_access_code_tag_bb::~gr_correlate_access_code_tag_bb ()
+{
+}
+
+bool
+gr_correlate_access_code_tag_bb::set_access_code(
+ const std::string &access_code)
+{
+ d_len = access_code.length(); // # of bytes in string
+ if (d_len > 64)
+ return false;
+
+ // set len top bits to 1.
+ d_mask = ((~0ULL) >> (64 - d_len)) << (64 - d_len);
+
+ d_access_code = 0;
+ for (unsigned i=0; i < 64; i++){
+ d_access_code <<= 1;
+ if (i < d_len)
+ d_access_code |= access_code[i] & 1; // look at LSB only
+ }
+
+ return true;
+}
+
+int
+gr_correlate_access_code_tag_bb::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const unsigned char *in = (const unsigned char *) input_items[0];
+ unsigned char *out = (unsigned char *) output_items[0];
+
+ uint64_t abs_out_sample_cnt = nitems_written(0);
+
+ for (int i = 0; i < noutput_items; i++){
+
+ out[i] = in[i];
+
+ // compute hamming distance between desired access code and current data
+ unsigned long long wrong_bits = 0;
+ unsigned int nwrong = d_threshold+1;
+ int new_flag = 0;
+
+ wrong_bits = (d_data_reg ^ d_access_code) & d_mask;
+ nwrong = gr_count_bits64(wrong_bits);
+
+ // test for access code with up to threshold errors
+ new_flag = (nwrong <= d_threshold);
+
+ // shift in new data and new flag
+ d_data_reg = (d_data_reg << 1) | (in[i] & 0x1);
+ if (new_flag) {
+ if(VERBOSE) std::cout << "writing tag at sample " << abs_out_sample_cnt + i << std::endl;
+ add_item_tag(0, //stream ID
+ abs_out_sample_cnt + i - 64 + d_len, //sample
+ d_key, //frame info
+ pmt::pmt_t(), //data (unused)
+ d_me //block src id
+ );
+ }
+ }
+
+ return noutput_items;
+}
+
diff --git a/gnuradio-core/src/lib/general/gr_correlate_access_code_tag_bb.h b/gnuradio-core/src/lib/general/gr_correlate_access_code_tag_bb.h
new file mode 100644
index 000000000..345d3004a
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_correlate_access_code_tag_bb.h
@@ -0,0 +1,87 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005,2006,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.
+ */
+
+#ifndef INCLUDED_gr_correlate_access_code_tag_bb_H
+#define INCLUDED_gr_correlate_access_code_tag_bb_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+#include <string>
+
+class gr_correlate_access_code_tag_bb;
+typedef boost::shared_ptr<gr_correlate_access_code_tag_bb> gr_correlate_access_code_tag_bb_sptr;
+
+/*!
+ * \param access_code is represented with 1 byte per bit, e.g., "010101010111000100"
+ * \param threshold maximum number of bits that may be wrong
+ * \param tag_name key of the tag inserted into the tag stream
+ */
+GR_CORE_API gr_correlate_access_code_tag_bb_sptr
+gr_make_correlate_access_code_tag_bb (const std::string &access_code, int threshold,
+ const std::string &tag_name);
+
+/*!
+ * \brief Examine input for specified access code, one bit at a time.
+ * \ingroup sync_blk
+ *
+ * input: stream of bits, 1 bit per input byte (data in LSB)
+ * output: unaltered stream of bits (plus tags)
+ *
+ * This block annotates the input stream with tags. The tags have key
+ * name [tag_name], specified in the constructor. Used for searching
+ * an input data stream for preambles, etc.
+ */
+class GR_CORE_API gr_correlate_access_code_tag_bb : public gr_sync_block
+{
+ friend GR_CORE_API gr_correlate_access_code_tag_bb_sptr
+ gr_make_correlate_access_code_tag_bb (const std::string &access_code, int threshold,
+ const std::string &tag_name);
+ private:
+ unsigned long long d_access_code; // access code to locate start of packet
+ // access code is left justified in the word
+ unsigned long long d_data_reg; // used to look for access_code
+ unsigned long long d_mask; // masks access_code bits (top N bits are set where
+ // N is the number of bits in the access code)
+ unsigned int d_threshold; // how many bits may be wrong in sync vector
+ unsigned int d_len; //the length of the access code
+
+ pmt::pmt_t d_key, d_me; //d_key is the tag name, d_me is the block name + unique ID
+
+ protected:
+ gr_correlate_access_code_tag_bb(const std::string &access_code, int threshold,
+ const std::string &tag_name);
+
+ public:
+ ~gr_correlate_access_code_tag_bb();
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+
+
+ /*!
+ * \param access_code is represented with 1 byte per bit, e.g., "010101010111000100"
+ */
+ bool set_access_code (const std::string &access_code);
+};
+
+#endif /* INCLUDED_gr_correlate_access_code_tag_bb_H */
diff --git a/gnuradio-core/src/lib/general/gr_correlate_access_code_tag_bb.i b/gnuradio-core/src/lib/general/gr_correlate_access_code_tag_bb.i
new file mode 100644
index 000000000..f7ca4bea7
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_correlate_access_code_tag_bb.i
@@ -0,0 +1,60 @@
+/* -*- 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,correlate_access_code_tag_bb);
+
+/*!
+ * \param access_code is represented with 1 byte per bit, e.g., "010101010111000100"
+ * \param threshold maximum number of bits that may be wrong
+ */
+gr_correlate_access_code_tag_bb_sptr
+gr_make_correlate_access_code_tag_bb (const std::string &access_code, int threshold, const std::string &tag_name)
+ throw(std::out_of_range);
+
+/*!
+ * \brief Examine input for specified access code, one bit at a time.
+ * \ingroup block
+ *
+ * input: stream of bits, 1 bit per input byte (data in LSB)
+ * output: stream of bits, 2 bits per output byte (data in LSB, flag in next higher bit)
+ *
+ * Each output byte contains two valid bits, the data bit, and the
+ * flag bit. The LSB (bit 0) is the data bit, and is the original
+ * input data, delayed 64 bits. Bit 1 is the
+ * flag bit and is 1 if the corresponding data bit is the first data
+ * bit following the access code. Otherwise the flag bit is 0.
+ */
+class gr_correlate_access_code_tag_bb : public gr_sync_block
+{
+ friend gr_correlate_access_code_tag_bb_sptr
+ gr_make_correlate_access_code_tag_bb (const std::string &access_code, int threshold, const std::string &tag_name);
+ protected:
+ gr_correlate_access_code_tag_bb(const std::string &access_code, int threshold, const std::string &tag_name);
+
+ public:
+ ~gr_correlate_access_code_tag_bb();
+
+ /*!
+ * \param access_code is represented with 1 byte per bit, e.g., "010101010111000100"
+ */
+ bool set_access_code (const std::string &access_code);
+};
diff --git a/gnuradio-core/src/lib/general/gr_count_bits.cc b/gnuradio-core/src/lib/general/gr_count_bits.cc
new file mode 100644
index 000000000..4776fe61a
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_count_bits.cc
@@ -0,0 +1,93 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2003 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_count_bits.h>
+
+/*
+ * these are slow and obvious. If you need something faster, fix these
+ */
+
+// return number of set bits in the low 8 bits of x
+unsigned int
+gr_count_bits8 (unsigned int x)
+{
+ int count = 0;
+
+ for (int i = 0; i < 8; i++)
+ if (x & (1 << i))
+ count++;
+
+ return count;
+}
+
+// return number of set bits in the low 16 bits of x
+unsigned int
+gr_count_bits16 (unsigned int x)
+{
+ int count = 0;
+
+ for (int i = 0; i < 16; i++)
+ if (x & (1 << i))
+ count++;
+
+ return count;
+
+}
+
+
+#if 0 // slow and obvious
+
+// return number of set bits in the low 32 bits of x
+unsigned int
+gr_count_bits32 (unsigned int x)
+{
+ int count = 0;
+
+ for (int i = 0; i < 32; i++)
+ if (x & (1 << i))
+ count++;
+
+ return count;
+}
+
+#else // fast and not so obvious
+
+// return number of set bits in the low 32 bits of x
+unsigned int
+gr_count_bits32 (unsigned int x)
+{
+ unsigned res = (x & 0x55555555) + ((x >> 1) & 0x55555555);
+ res = (res & 0x33333333) + ((res >> 2) & 0x33333333);
+ res = (res & 0x0F0F0F0F) + ((res >> 4) & 0x0F0F0F0F);
+ res = (res & 0x00FF00FF) + ((res >> 8) & 0x00FF00FF);
+ return (res & 0x0000FFFF) + ((res >> 16) & 0x0000FFFF);
+}
+
+#endif
+
+
+// return number of set bits in the low 64 bits of x
+unsigned int
+gr_count_bits64 (unsigned long long x)
+{
+ return gr_count_bits32((x >> 32) & 0xffffffff) + gr_count_bits32(x & 0xffffffff);
+}
diff --git a/gnuradio-core/src/lib/general/gr_count_bits.h b/gnuradio-core/src/lib/general/gr_count_bits.h
new file mode 100644
index 000000000..76d0173eb
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_count_bits.h
@@ -0,0 +1,33 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2003 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 _GR_COUNT_BITS_H_
+#define _GR_COUNT_BITS_H_
+
+#include <gr_core_api.h>
+
+GR_CORE_API unsigned int gr_count_bits8(unsigned int x); // return number of set bits in the low 8 bits of x
+GR_CORE_API unsigned int gr_count_bits16(unsigned int x); // return number of set bits in the low 16 bits of x
+GR_CORE_API unsigned int gr_count_bits32(unsigned int x); // return number of set bits in the low 32 bits of x
+GR_CORE_API unsigned int gr_count_bits64(unsigned long long int x);
+
+#endif /* _GR_COUNT_BITS_H_ */
diff --git a/gnuradio-core/src/lib/general/gr_cpfsk_bc.cc b/gnuradio-core/src/lib/general/gr_cpfsk_bc.cc
new file mode 100644
index 000000000..24f0edd5c
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_cpfsk_bc.cc
@@ -0,0 +1,78 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,2010 Free Software Foundation, Inc.
+ *
+ * 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 <gr_cpfsk_bc.h>
+#include <gr_io_signature.h>
+#include <gr_expj.h>
+
+#define M_TWOPI (2*M_PI)
+
+gr_cpfsk_bc_sptr
+gr_make_cpfsk_bc(float k, float ampl, int samples_per_sym)
+{
+ return gnuradio::get_initial_sptr(new gr_cpfsk_bc(k, ampl, samples_per_sym));
+}
+
+gr_cpfsk_bc::gr_cpfsk_bc(float k, float ampl, int samples_per_sym)
+ : gr_sync_interpolator("cpfsk_bc",
+ gr_make_io_signature(1, 1, sizeof(char)),
+ gr_make_io_signature(1, 1, sizeof(gr_complex)),
+ samples_per_sym)
+{
+ d_samples_per_sym = samples_per_sym;
+ d_freq = k*M_PI/samples_per_sym;
+ d_ampl = ampl;
+ d_phase = 0.0;
+}
+
+gr_cpfsk_bc::~gr_cpfsk_bc()
+{
+}
+
+int
+gr_cpfsk_bc::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const char *in = (const char *)input_items[0];
+ gr_complex *out = (gr_complex *)output_items[0];
+
+ for (int i = 0; i < noutput_items/d_samples_per_sym; i++) {
+ for (int j = 0; j < d_samples_per_sym; j++) {
+ if (in[i] == 1)
+ d_phase += d_freq;
+ else
+ d_phase -= d_freq;
+
+ while (d_phase > M_TWOPI)
+ d_phase -= M_TWOPI;
+ while (d_phase < -M_TWOPI)
+ d_phase += M_TWOPI;
+
+ *out++ = gr_expj(d_phase)*d_ampl;
+ }
+ }
+
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/general/gr_cpfsk_bc.h b/gnuradio-core/src/lib/general/gr_cpfsk_bc.h
new file mode 100644
index 000000000..6ad2774b3
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_cpfsk_bc.h
@@ -0,0 +1,64 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008 Free Software Foundation, Inc.
+ *
+ * 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_CPFSK_BC_H
+#define INCLUDED_GR_CPFSK_BC_H
+
+#include <gr_core_api.h>
+#include <gr_sync_interpolator.h>
+
+class gr_cpfsk_bc;
+
+typedef boost::shared_ptr<gr_cpfsk_bc> gr_cpfsk_bc_sptr;
+
+GR_CORE_API gr_cpfsk_bc_sptr gr_make_cpfsk_bc(float k, float ampl, int samples_per_sym);
+
+/*!
+ * \brief Perform continuous phase 2-level frequency shift keying modulation
+ * on an input stream of unpacked bits.
+ * \ingroup modulation_blk
+ *
+ * \param k modulation index
+ * \param ampl output amplitude
+ * \param samples_per_sym number of output samples per input bit
+ */
+
+class GR_CORE_API gr_cpfsk_bc : public gr_sync_interpolator
+{
+private:
+ friend GR_CORE_API gr_cpfsk_bc_sptr gr_make_cpfsk_bc(float k, float ampl, int samples_per_sym);
+
+ gr_cpfsk_bc(float k, float ampl, int samples_per_sym);
+
+ int d_samples_per_sym; // Samples per symbol, square pulse
+ float d_freq; // Modulation index*pi/samples_per_sym
+ float d_ampl; // Output amplitude
+ float d_phase; // Current phase
+
+ public:
+ ~gr_cpfsk_bc();
+
+ void set_amplitude(float amplitude) { d_ampl = amplitude; }
+
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif /* INCLUDED_GR_CPFSK_BC_H */
diff --git a/gnuradio-core/src/lib/general/gr_cpfsk_bc.i b/gnuradio-core/src/lib/general/gr_cpfsk_bc.i
new file mode 100644
index 000000000..b86dfb81b
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_cpfsk_bc.i
@@ -0,0 +1,34 @@
+/* -*- 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,cpfsk_bc);
+
+gr_cpfsk_bc_sptr gr_make_cpfsk_bc(float k, float ampl, int samples_per_sym);
+
+class gr_cpfsk_bc : public gr_sync_interpolator
+{
+private:
+ gr_cpfsk_bc(float k, float ampl, int samples_per_sym);
+
+public:
+ void set_amplitude(float amplitude);
+};
diff --git a/gnuradio-core/src/lib/general/gr_cpm.cc b/gnuradio-core/src/lib/general/gr_cpm.cc
new file mode 100644
index 000000000..32ce6502d
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_cpm.cc
@@ -0,0 +1,218 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2010 Free Software Foundation, Inc.
+ *
+ * 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.
+ */
+
+// Calculate the taps for the CPM phase responses
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <cmath>
+#include <cfloat>
+#include <gr_cpm.h>
+
+//gives us erf on compilers without it
+#include <boost/math/special_functions/erf.hpp>
+namespace bm = boost::math;
+
+#ifndef M_TWOPI
+# define M_TWOPI (2*M_PI)
+#endif
+
+//! Normalised sinc function, sinc(x)=sin(pi*x)/pi*x
+inline double
+sinc(double x)
+{
+ if (x == 0) {
+ return 1.0;
+ }
+
+ return sin(M_PI * x) / (M_PI * x);
+}
+
+
+//! Taps for L-RC CPM (Raised cosine of length L symbols)
+std::vector<float>
+generate_cpm_lrc_taps(unsigned samples_per_sym, unsigned L)
+{
+ std::vector<float> taps(samples_per_sym * L, 1.0/L/samples_per_sym);
+ for (unsigned i = 0; i < samples_per_sym * L; i++) {
+ taps[i] *= 1 - cos(M_TWOPI * i / L / samples_per_sym);
+ }
+
+ return taps;
+}
+
+
+/*! Taps for L-SRC CPM (Spectral raised cosine of length L symbols).
+ *
+ * L-SRC has a time-continuous phase response function of
+ *
+ * g(t) = 1/LT * sinc(2t/LT) * cos(beta * 2pi t / LT) / (1 - (4beta / LT * t)^2)
+ *
+ * which is the Fourier transform of a cos-rolloff function with rolloff
+ * beta, and looks like a sinc-function, multiplied with a rolloff term.
+ * We return the main lobe of the sinc, i.e., everything between the
+ * zero crossings.
+ * The time-discrete IR is thus
+ *
+ * g(k) = 1/Ls * sinc(2k/Ls) * cos(beta * pi k / Ls) / (1 - (4beta / Ls * k)^2)
+ * where k = 0...Ls-1
+ * and s = samples per symbol.
+ */
+std::vector<float>
+generate_cpm_lsrc_taps(unsigned samples_per_sym, unsigned L, double beta)
+{
+ double Ls = (double) L * samples_per_sym;
+ std::vector<double> taps_d(L * samples_per_sym, 0.0);
+ std::vector<float> taps(L * samples_per_sym, 0.0);
+
+ double sum = 0;
+ for (unsigned i = 0; i < samples_per_sym * L; i++) {
+ double k = i - Ls/2; // Causal to acausal
+
+ taps_d[i] = 1.0 / Ls * sinc(2.0 * k / Ls);
+
+ // For k = +/-Ls/4*beta, the rolloff term's cos-function becomes zero
+ // and the whole thing converges to PI/4 (to prove this, use de
+ // l'hopital's rule).
+ if (fabs(fabs(k) - Ls/4/beta) < 2*DBL_EPSILON) {
+ taps_d[i] *= M_PI_4;
+ } else {
+ double tmp = 4.0 * beta * k / Ls;
+ taps_d[i] *= cos(beta * M_TWOPI * k / Ls) / (1 - tmp * tmp);
+ }
+ sum += taps_d[i];
+ }
+ for (unsigned i = 0; i < samples_per_sym * L; i++) {
+ taps[i] = (float) taps_d[i] / sum;
+ }
+
+ return taps;
+}
+
+
+//! Taps for L-REC CPM (Rectangular pulse shape of length L symbols)
+std::vector<float>
+generate_cpm_lrec_taps(unsigned samples_per_sym, unsigned L)
+{
+ return std::vector<float>(samples_per_sym * L, 1.0/L/samples_per_sym);
+}
+
+
+//! Helper function for TFM
+double tfm_g0(double k, double sps)
+{
+ if (fabs(k) < 2 * DBL_EPSILON) {
+ return 1.145393004159143; // 1 + pi^2/48 / sqrt(2)
+ }
+
+ const double pi2_24 = 0.411233516712057; // pi^2/24
+ double f = M_PI * k / sps;
+ return sinc(k/sps) - pi2_24 * (2 * sin(f) - 2*f*cos(f) - f*f*sin(f)) / (f*f*f);
+}
+
+
+//! Taps for TFM CPM (Tamed frequency modulation)
+//
+// See [2, Chapter 2.7.2].
+//
+// [2]: Anderson, Aulin and Sundberg; Digital Phase Modulation
+std::vector<float>
+generate_cpm_tfm_taps(unsigned sps, unsigned L)
+{
+ unsigned causal_shift = sps * L / 2;
+ std::vector<double> taps_d(sps * L, 0.0);
+ std::vector<float> taps(sps * L, 0.0);
+
+ double sum = 0;
+ for (unsigned i = 0; i < sps * L; i++) {
+ double k = (double)(((int)i) - ((int)causal_shift)); // Causal to acausal
+
+ taps_d[i] = tfm_g0(k - sps, sps) +
+ 2 * tfm_g0(k, sps) +
+ tfm_g0(k + sps, sps);
+ sum += taps_d[i];
+ }
+ for (unsigned i = 0; i < sps * L; i++) {
+ taps[i] = (float) taps_d[i] / sum;
+ }
+
+ return taps;
+}
+
+
+//! Taps for Gaussian CPM. Phase response is truncated after \p L symbols.
+// \p bt sets the 3dB-time-bandwidth product.
+//
+// Note: for h = 0.5, this is the phase response for GMSK.
+//
+// This C99-compatible formula for the taps is taken straight
+// from [1, Chapter 9.2.3].
+// A version in Q-notation can be found in [2, Chapter 2.7.2].
+//
+// [1]: Karl-Dirk Kammeyer; Nachrichtenübertragung, 4th Edition.
+// [2]: Anderson, Aulin and Sundberg; Digital Phase Modulation
+//
+std::vector<float>
+generate_cpm_gaussian_taps(unsigned samples_per_sym, unsigned L, double bt)
+{
+ double Ls = (double) L * samples_per_sym;
+ std::vector<double> taps_d(L * samples_per_sym, 0.0);
+ std::vector<float> taps(L * samples_per_sym, 0.0);
+
+ // alpha = sqrt(2/ln(2)) * pi * BT
+ double alpha = 5.336446256636997 * bt;
+ for (unsigned i = 0; i < samples_per_sym * L; i++) {
+ double k = i - Ls/2; // Causal to acausal
+ taps_d[i] = (bm::erf(alpha * (k / samples_per_sym + 0.5)) -
+ bm::erf(alpha * (k / samples_per_sym - 0.5)))
+ * 0.5 / samples_per_sym;
+ taps[i] = (float) taps_d[i];
+ }
+
+ return taps;
+}
+
+
+std::vector<float>
+gr_cpm::phase_response(cpm_type type, unsigned samples_per_sym, unsigned L, double beta)
+{
+ switch (type) {
+ case LRC:
+ return generate_cpm_lrc_taps(samples_per_sym, L);
+
+ case LSRC:
+ return generate_cpm_lsrc_taps(samples_per_sym, L, beta);
+
+ case LREC:
+ return generate_cpm_lrec_taps(samples_per_sym, L);
+
+ case TFM:
+ return generate_cpm_tfm_taps(samples_per_sym, L);
+
+ case GAUSSIAN:
+ return generate_cpm_gaussian_taps(samples_per_sym, L, beta);
+
+ default:
+ return generate_cpm_lrec_taps(samples_per_sym, 1);
+ }
+}
+
diff --git a/gnuradio-core/src/lib/general/gr_cpm.h b/gnuradio-core/src/lib/general/gr_cpm.h
new file mode 100644
index 000000000..ef2ff8414
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_cpm.h
@@ -0,0 +1,81 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2010 Free Software Foundation, Inc.
+ *
+ * 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_CPM_H
+#define INCLUDED_GR_CPM_H
+
+#include <gr_core_api.h>
+#include <vector>
+
+class GR_CORE_API gr_cpm
+{
+ public:
+ enum cpm_type {
+ LRC,
+ LSRC,
+ LREC,
+ TFM,
+ GAUSSIAN,
+ GENERIC = 999
+ };
+
+ /*! \brief Return the taps for an interpolating FIR filter (gr_interp_fir_filter_fff).
+ *
+ * These taps represent the phase response \f$g(k)\f$ for use in a CPM modulator,
+ * see also gr_cpmmod_bc.
+ *
+ * \param type The CPM type (Rectangular, Raised Cosine, Spectral Raised Cosine,
+ * Tamed FM or Gaussian).
+ * \param samples_per_sym Samples per symbol.
+ * \param L The length of the phase response in symbols.
+ * \param beta For Spectral Raised Cosine, this is the rolloff factor. For Gaussian
+ * phase responses, this the 3dB-time-bandwidth product. For all other
+ * cases, it is ignored.
+ *
+ * Output: returns a vector of length \a K = \p samples_per_sym x \p L.
+ * This can be used directly in an interpolating FIR filter such as
+ * gr_interp_fir_filter_fff with interpolation factor \p samples_per_sym.
+ *
+ * All phase responses are normalised s.t. \f$ \sum_{k=0}^{K-1} g(k) = 1\f$; this will cause
+ * a maximum phase change of \f$ h \cdot \pi\f$ between two symbols, where \a h is the
+ * modulation index.
+ *
+ * The following phase responses can be generated:
+ * - LREC: Rectangular phase response.
+ * - LRC: Raised cosine phase response, looks like 1 - cos(x).
+ * - LSRC: Spectral raised cosine. This requires a rolloff factor beta.
+ * The phase response is the Fourier transform of raised cosine
+ * function.
+ * - TFM: Tamed frequency modulation. This scheme minimizes phase change for
+ * rapidly varying input symbols.
+ * - GAUSSIAN: A Gaussian phase response. For a modulation index h = 1/2, this
+ * results in GMSK.
+ *
+ * A short description of all these phase responses can be found in [1].
+ *
+ * [1]: Anderson, Aulin and Sundberg; Digital Phase Modulation
+ */
+ static std::vector<float>
+ phase_response(cpm_type type, unsigned samples_per_sym, unsigned L, double beta=0.3);
+};
+
+#endif /* INCLUDED_GR_CPM_H */
+
diff --git a/gnuradio-core/src/lib/general/gr_cpm.i b/gnuradio-core/src/lib/general/gr_cpm.i
new file mode 100644
index 000000000..6c077687d
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_cpm.i
@@ -0,0 +1,40 @@
+/* -*- C++ -*- */
+/*
+ * Copyright 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.
+ */
+
+%rename(cpm) gr_cpm;
+
+class gr_cpm
+{
+ public:
+ enum cpm_type {
+ LRC,
+ LSRC,
+ LREC,
+ TFM,
+ GAUSSIAN,
+ GENERIC = 999
+ };
+
+ static std::vector<float>
+ phase_response(cpm_type type, unsigned samples_per_sym, unsigned L, double beta=0.3);
+};
+
diff --git a/gnuradio-core/src/lib/general/gr_ctcss_squelch_ff.cc b/gnuradio-core/src/lib/general/gr_ctcss_squelch_ff.cc
new file mode 100644
index 000000000..d31763a6b
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_ctcss_squelch_ff.cc
@@ -0,0 +1,112 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_ctcss_squelch_ff.h>
+
+static float ctcss_tones[] = {
+ 67.0, 71.9, 74.4, 77.0, 79.7, 82.5, 85.4, 88.5, 91.5, 94.8,
+ 97.4, 100.0, 103.5, 107.2, 110.9, 114.8, 118.8, 123.0, 127.3, 131.8,
+ 136.5, 141.3, 146.2, 151.4, 156.7, 162.2, 167.9, 173.8, 179.9, 186.2,
+ 192.8, 203.5, 210.7, 218.1, 225.7, 233.6, 241.8, 250.3
+};
+
+static int max_tone_index = 37;
+
+gr_ctcss_squelch_ff_sptr
+gr_make_ctcss_squelch_ff(int rate, float freq, float level, int len, int ramp, bool gate)
+{
+ return gnuradio::get_initial_sptr(new gr_ctcss_squelch_ff(rate, freq, level, len, ramp, gate));
+}
+
+int gr_ctcss_squelch_ff::find_tone(float freq)
+{
+ for (int i = 0; i <= max_tone_index; i++)
+ if (ctcss_tones[i] == freq) // FIXME: make almost equal
+ return i;
+
+ return -1;
+}
+
+gr_ctcss_squelch_ff::gr_ctcss_squelch_ff(int rate, float freq, float level, int len, int ramp, bool gate) :
+ gr_squelch_base_ff("ctcss_squelch_ff", ramp, gate)
+{
+ d_freq = freq;
+ d_level = level;
+
+ // Default is 100 ms detection time
+ if (len == 0)
+ d_len = (int)(rate/10.0);
+ else
+ d_len = len;
+
+ int i = find_tone(freq);
+
+ // Non-standard tones or edge tones get 2% guard band, otherwise
+ // guards are set at adjacent ctcss tone frequencies
+ float f_l, f_r;
+ if (i == -1 || i == 0)
+ f_l = freq*0.98;
+ else
+ f_l = ctcss_tones[i-1];
+
+ if (i == -1 || i == max_tone_index)
+ f_r = freq*1.02;
+ else
+ f_r = ctcss_tones[i+1];
+
+ d_goertzel_l = gri_goertzel(rate, d_len, f_l);
+ d_goertzel_c = gri_goertzel(rate, d_len, freq);
+ d_goertzel_r = gri_goertzel(rate, d_len, f_r);
+
+ d_mute = true;
+}
+
+std::vector<float> gr_ctcss_squelch_ff::squelch_range() const
+{
+ std::vector<float> r(3);
+ r[0] = 0.0;
+ r[1] = 1.0;
+ r[2] = (r[1]-r[0])/100; // step size
+
+ return r;
+}
+
+void gr_ctcss_squelch_ff::update_state(const float &in)
+{
+ d_goertzel_l.input(in);
+ d_goertzel_c.input(in);
+ d_goertzel_r.input(in);
+
+ float d_out_l, d_out_c, d_out_r;
+ if (d_goertzel_c.ready()) {
+ d_out_l = abs(d_goertzel_l.output());
+ d_out_c = abs(d_goertzel_c.output());
+ d_out_r = abs(d_goertzel_r.output());
+
+ //printf("d_out_l=%f d_out_c=%f d_out_r=%f\n", d_out_l, d_out_c, d_out_r);
+ d_mute = (d_out_c < d_level || d_out_c < d_out_l || d_out_c < d_out_r);
+ }
+}
diff --git a/gnuradio-core/src/lib/general/gr_ctcss_squelch_ff.h b/gnuradio-core/src/lib/general/gr_ctcss_squelch_ff.h
new file mode 100644
index 000000000..ef3d13ba7
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_ctcss_squelch_ff.h
@@ -0,0 +1,68 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_GR_CTCSS_SQUELCH_FF_H
+#define INCLUDED_GR_CTCSS_SQUELCH_FF_H
+
+#include <gr_core_api.h>
+#include <gr_squelch_base_ff.h>
+#include <gri_goertzel.h>
+
+class gr_ctcss_squelch_ff;
+typedef boost::shared_ptr<gr_ctcss_squelch_ff> gr_ctcss_squelch_ff_sptr;
+
+GR_CORE_API gr_ctcss_squelch_ff_sptr
+gr_make_ctcss_squelch_ff(int rate, float freq, float level=0.01, int len=0, int ramp=0, bool gate=false);
+
+/*!
+ * \brief gate or zero output if ctcss tone not present
+ * \ingroup level_blk
+ */
+class GR_CORE_API gr_ctcss_squelch_ff : public gr_squelch_base_ff
+{
+private:
+ float d_freq;
+ float d_level;
+ int d_len;
+ bool d_mute;
+
+ gri_goertzel d_goertzel_l;
+ gri_goertzel d_goertzel_c;
+ gri_goertzel d_goertzel_r;
+
+ friend GR_CORE_API gr_ctcss_squelch_ff_sptr gr_make_ctcss_squelch_ff(int rate, float freq, float level, int len, int ramp, bool gate);
+ gr_ctcss_squelch_ff(int rate, float freq, float level, int len, int ramp, bool gate);
+
+ int find_tone(float freq);
+
+protected:
+ virtual void update_state(const float &in);
+ virtual bool mute() const { return d_mute; }
+
+public:
+ std::vector<float> squelch_range() const;
+ float level() const { return d_level; }
+ void set_level(float level) { d_level = level; }
+ int len() const { return d_len; }
+};
+
+#endif /* INCLUDED_GR_CTCSS_SQUELCH_FF_H */
diff --git a/gnuradio-core/src/lib/general/gr_ctcss_squelch_ff.i b/gnuradio-core/src/lib/general/gr_ctcss_squelch_ff.i
new file mode 100644
index 000000000..b160c5dfd
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_ctcss_squelch_ff.i
@@ -0,0 +1,39 @@
+/* -*- 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,ctcss_squelch_ff);
+
+%include gr_squelch_base_ff.i
+
+gr_ctcss_squelch_ff_sptr
+gr_make_ctcss_squelch_ff(int rate, float freq, float level=0.01, int len=0, int ramp=0, bool gate=false);
+
+class gr_ctcss_squelch_ff : public gr_squelch_base_ff
+{
+ gr_ctcss_squelch_ff(int rate, float freq, float level, int len, int ramp, bool gate);
+
+public:
+ std::vector<float> squelch_range() const;
+ float level() const { return d_level; }
+ void set_level(float level) { d_level = level; }
+ int len() const { return d_len; }
+};
diff --git a/gnuradio-core/src/lib/general/gr_decode_ccsds_27_fb.cc b/gnuradio-core/src/lib/general/gr_decode_ccsds_27_fb.cc
new file mode 100644
index 000000000..319aceeaa
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_decode_ccsds_27_fb.cc
@@ -0,0 +1,86 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,2010 Free Software Foundation, Inc.
+ *
+ * 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 <gr_decode_ccsds_27_fb.h>
+#include <gr_io_signature.h>
+
+gr_decode_ccsds_27_fb_sptr
+gr_make_decode_ccsds_27_fb()
+{
+ return gnuradio::get_initial_sptr(new gr_decode_ccsds_27_fb());
+}
+
+gr_decode_ccsds_27_fb::gr_decode_ccsds_27_fb()
+ : gr_sync_decimator("decode_ccsds_27_fb",
+ gr_make_io_signature(1, 1, sizeof(float)),
+ gr_make_io_signature(1, 1, sizeof(char)),
+ 2*8) // Rate 1/2 code, unpacked to packed translation
+{
+ float RATE = 0.5;
+ float ebn0 = 12.0;
+ float esn0 = RATE*pow(10.0, ebn0/10.0);
+
+ gen_met(d_mettab, 100, esn0, 0.0, 256);
+ viterbi_chunks_init(d_state0);
+}
+
+gr_decode_ccsds_27_fb::~gr_decode_ccsds_27_fb()
+{
+}
+
+int
+gr_decode_ccsds_27_fb::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const float *in = (const float *)input_items[0];
+ unsigned char *out = (unsigned char *)output_items[0];
+
+ for (int i = 0; i < noutput_items*16; i++) {
+ // Translate and clip [-1.0..1.0] to [28..228]
+ float sample = in[i]*100.0+128.0;
+ if (sample > 255.0)
+ sample = 255.0;
+ else if (sample < 0.0)
+ sample = 0.0;
+ unsigned char sym = (unsigned char)(floor(sample));
+
+ d_viterbi_in[d_count % 4] = sym;
+ if ((d_count % 4) == 3) {
+ // Every fourth symbol, perform butterfly operation
+ viterbi_butterfly2(d_viterbi_in, d_mettab, d_state0, d_state1);
+
+ // Every sixteenth symbol, read out a byte
+ if (d_count % 16 == 11) {
+ // long metric =
+ viterbi_get_output(d_state0, out++);
+ // printf("%li\n", *(out-1), metric);
+ }
+ }
+
+ d_count++;
+ }
+
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/general/gr_decode_ccsds_27_fb.h b/gnuradio-core/src/lib/general/gr_decode_ccsds_27_fb.h
new file mode 100644
index 000000000..df8e6f449
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_decode_ccsds_27_fb.h
@@ -0,0 +1,78 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008 Free Software Foundation, Inc.
+ *
+ * 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_DECODE_CCSDS_27_FB_H
+#define INCLUDED_GR_DECODE_CCSDS_27_FB_H
+
+#include <gr_core_api.h>
+#include <gr_sync_decimator.h>
+
+extern "C" {
+#include <viterbi.h>
+}
+
+class gr_decode_ccsds_27_fb;
+
+typedef boost::shared_ptr<gr_decode_ccsds_27_fb> gr_decode_ccsds_27_fb_sptr;
+
+GR_CORE_API gr_decode_ccsds_27_fb_sptr gr_make_decode_ccsds_27_fb();
+
+/*! \brief A rate 1/2, k=7 convolutional decoder for the CCSDS standard
+ * \ingroup ecc
+ *
+ * This block performs soft-decision convolutional decoding using the Viterbi
+ * algorithm.
+ *
+ * The input is a stream of (possibly noise corrupted) floating point values
+ * nominally spanning [-1.0, 1.0], representing the encoded channel symbols
+ * 0 (-1.0) and 1 (1.0), with erased symbols at 0.0.
+ *
+ * The output is MSB first packed bytes of decoded values.
+ *
+ * As a rate 1/2 code, there will be one output byte for every 16 input symbols.
+ *
+ * This block is designed for continuous data streaming, not packetized data.
+ * The first 32 bits out will be zeroes, with the output delayed four bytes
+ * from the corresponding inputs.
+ */
+
+class GR_CORE_API gr_decode_ccsds_27_fb : public gr_sync_decimator
+{
+private:
+ friend GR_CORE_API gr_decode_ccsds_27_fb_sptr gr_make_decode_ccsds_27_fb();
+
+ gr_decode_ccsds_27_fb();
+
+ // Viterbi state
+ int d_mettab[2][256];
+ struct viterbi_state d_state0[64];
+ struct viterbi_state d_state1[64];
+ unsigned char d_viterbi_in[16];
+
+ int d_count;
+
+public:
+ ~gr_decode_ccsds_27_fb();
+
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif /* INCLUDED_GR_DECODE_CCSDS_27_FB_H */
diff --git a/gnuradio-core/src/lib/general/gr_decode_ccsds_27_fb.i b/gnuradio-core/src/lib/general/gr_decode_ccsds_27_fb.i
new file mode 100644
index 000000000..f2e13b593
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_decode_ccsds_27_fb.i
@@ -0,0 +1,31 @@
+/* -*- 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,decode_ccsds_27_fb);
+
+gr_decode_ccsds_27_fb_sptr gr_make_decode_ccsds_27_fb ();
+
+class gr_decode_ccsds_27_fb : public gr_sync_decimator
+{
+private:
+ gr_decode_ccsds_27_fb();
+};
diff --git a/gnuradio-core/src/lib/general/gr_deinterleave.cc b/gnuradio-core/src/lib/general/gr_deinterleave.cc
new file mode 100644
index 000000000..e22db60c1
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_deinterleave.cc
@@ -0,0 +1,78 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_deinterleave.h>
+#include <gr_io_signature.h>
+#include <string.h>
+
+
+gr_deinterleave_sptr
+gr_make_deinterleave (size_t itemsize)
+{
+ return gnuradio::get_initial_sptr(new gr_deinterleave (itemsize));
+}
+
+gr_deinterleave::gr_deinterleave (size_t itemsize)
+ : gr_sync_decimator ("deinterleave",
+ gr_make_io_signature (1, 1, itemsize),
+ gr_make_io_signature (1, gr_io_signature::IO_INFINITE, itemsize),
+ 1),
+ d_itemsize (itemsize)
+{
+}
+
+gr_deinterleave::~gr_deinterleave ()
+{
+ // NOP
+}
+
+bool
+gr_deinterleave::check_topology (int ninputs, int noutputs)
+{
+ set_decimation (noutputs);
+ return true;
+}
+
+int
+gr_deinterleave::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ size_t nchan = output_items.size ();
+ size_t itemsize = d_itemsize;
+ const char *in = (const char *) input_items[0];
+ char **out = (char **) &output_items[0];
+
+ for (int i = 0; i < noutput_items; i++){
+ for (unsigned int n = 0; n < nchan; n++){
+ memcpy (out[n], in, itemsize);
+ out[n] += itemsize;
+ in += itemsize;
+ }
+ }
+
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/general/gr_deinterleave.h b/gnuradio-core/src/lib/general/gr_deinterleave.h
new file mode 100644
index 000000000..0eecc44d1
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_deinterleave.h
@@ -0,0 +1,57 @@
+/* -*- 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_DEINTERLEAVE_H
+#define INCLUDED_GR_DEINTERLEAVE_H
+
+#include <gr_core_api.h>
+#include <gr_sync_decimator.h>
+
+class gr_deinterleave;
+typedef boost::shared_ptr<gr_deinterleave> gr_deinterleave_sptr;
+
+GR_CORE_API gr_deinterleave_sptr gr_make_deinterleave (size_t itemsize);
+
+/*!
+ * \brief deinterleave a single input into N outputs
+ * \ingroup slicedice_blk
+ */
+class GR_CORE_API gr_deinterleave : public gr_sync_decimator
+{
+ friend GR_CORE_API gr_deinterleave_sptr gr_make_deinterleave (size_t itemsize);
+
+ size_t d_itemsize;
+
+ gr_deinterleave (size_t itemsize);
+
+public:
+ ~gr_deinterleave ();
+
+ 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);
+
+};
+
+#endif /* INCLUDED_GR_DEINTERLEAVE_H */
diff --git a/gnuradio-core/src/lib/general/gr_deinterleave.i b/gnuradio-core/src/lib/general/gr_deinterleave.i
new file mode 100644
index 000000000..a70ce6c52
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_deinterleave.i
@@ -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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,deinterleave)
+
+gr_deinterleave_sptr gr_make_deinterleave (size_t itemsize);
+
+class gr_deinterleave : public gr_sync_decimator
+{
+ gr_deinterleave (size_t itemsize);
+};
diff --git a/gnuradio-core/src/lib/general/gr_delay.cc b/gnuradio-core/src/lib/general/gr_delay.cc
new file mode 100644
index 000000000..8f728948d
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_delay.cc
@@ -0,0 +1,129 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007,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 <gr_delay.h>
+#include <gr_io_signature.h>
+#include <string.h>
+
+gr_delay_sptr
+gr_make_delay (size_t itemsize, int delay)
+{
+ return gnuradio::get_initial_sptr(new gr_delay (itemsize, delay));
+}
+
+gr_delay::gr_delay (size_t itemsize, int delay)
+ : gr_block ("delay",
+ gr_make_io_signature (1, -1, itemsize),
+ gr_make_io_signature (1, -1, itemsize)),
+ d_itemsize(itemsize)
+{
+ set_delay(delay);
+ d_delta = 0;
+}
+
+void
+gr_delay::forecast (int noutput_items, gr_vector_int &ninput_items_required)
+{
+ // make sure all inputs have noutput_items available
+ unsigned ninputs = ninput_items_required.size ();
+ for (unsigned i = 0; i < ninputs; i++)
+ ninput_items_required[i] = noutput_items;
+}
+
+void
+gr_delay::set_delay (int d)
+{
+ // only set a new delta if there is a change in the delay; this
+ // protects from quickly-repeated calls to this function that would
+ // end with d_delta=0.
+ if(d != delay()) {
+ gruel::scoped_lock l(d_mutex_delay);
+ int old = delay();
+ set_history(d+1);
+ d_delta += delay() - old;
+ }
+}
+
+int
+gr_delay::general_work (int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ gruel::scoped_lock l(d_mutex_delay);
+ assert(input_items.size() == output_items.size());
+
+ const char *iptr;
+ char *optr;
+ int cons, ret;
+
+ // No change in delay; just memcpy ins to outs
+ if(d_delta == 0) {
+ for(size_t i = 0; i < input_items.size(); i++) {
+ iptr = (const char *) input_items[i];
+ optr = (char *) output_items[i];
+ std::memcpy(optr, iptr, noutput_items*d_itemsize);
+ }
+ cons = noutput_items;
+ ret = noutput_items;
+ }
+
+ // Skip over d_delta items on the input
+ else if(d_delta < 0) {
+ int n_to_copy, n_adj;
+ int delta = -d_delta;
+ n_to_copy = std::max(0, noutput_items-delta);
+ n_adj = std::min(delta, noutput_items);
+ for(size_t i = 0; i < input_items.size(); i++) {
+ iptr = (const char *) input_items[i];
+ optr = (char *) output_items[i];
+ std::memcpy(optr, iptr+delta*d_itemsize, n_to_copy*d_itemsize);
+ }
+ cons = noutput_items;
+ ret = n_to_copy;
+ delta -= n_adj;
+ d_delta = -delta;
+ }
+
+ //produce but not consume (inserts zeros)
+ else { // d_delta > 0
+ int n_from_input, n_padding;
+ n_from_input = std::max(0, noutput_items-d_delta);
+ n_padding = std::min(d_delta, noutput_items);
+ for(size_t i = 0; i < input_items.size(); i++) {
+ iptr = (const char *) input_items[i];
+ optr = (char *) output_items[i];
+ std::memset(optr, 0, n_padding*d_itemsize);
+ std::memcpy(optr, iptr, n_from_input*d_itemsize);
+ }
+ cons = n_from_input;
+ ret = noutput_items;
+ d_delta -= n_padding;
+ }
+
+ consume_each(cons);
+ return ret;
+}
diff --git a/gnuradio-core/src/lib/general/gr_delay.h b/gnuradio-core/src/lib/general/gr_delay.h
new file mode 100644
index 000000000..ed05c47f4
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_delay.h
@@ -0,0 +1,61 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007,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 INCLUDED_GR_DELAY_H
+#define INCLUDED_GR_DELAY_H
+
+#include <gr_core_api.h>
+#include <gr_block.h>
+#include <gruel/thread.h>
+
+class gr_delay;
+typedef boost::shared_ptr<gr_delay> gr_delay_sptr;
+
+GR_CORE_API gr_delay_sptr gr_make_delay (size_t itemsize, int delay);
+
+/*!
+ * \brief delay the input by a certain number of samples
+ * \ingroup misc_blk
+ */
+class GR_CORE_API gr_delay : public gr_block
+{
+ friend GR_CORE_API gr_delay_sptr gr_make_delay (size_t itemsize, int delay);
+
+ gr_delay (size_t itemsize, int delay);
+
+ void forecast (int noutput_items, gr_vector_int &ninput_items_required);
+
+ size_t d_itemsize;
+ int d_delta;
+ gruel::mutex d_mutex_delay;
+
+ public:
+ int delay () const { return history()-1; }
+ void set_delay (int delay);
+
+ int general_work (int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif
diff --git a/gnuradio-core/src/lib/general/gr_delay.i b/gnuradio-core/src/lib/general/gr_delay.i
new file mode 100644
index 000000000..f3d49891d
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_delay.i
@@ -0,0 +1,35 @@
+/* -*- 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,delay)
+
+ gr_delay_sptr gr_make_delay (size_t itemsize, int delay);
+
+class gr_delay : public gr_block
+{
+ private:
+ gr_delay (size_t itemsize, int delay);
+
+ public:
+ int delay() const { return history()-1; }
+ void set_delay (int delay) { set_history(delay+1); }
+};
diff --git a/gnuradio-core/src/lib/general/gr_descrambler_bb.cc b/gnuradio-core/src/lib/general/gr_descrambler_bb.cc
new file mode 100644
index 000000000..b5ae28fa9
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_descrambler_bb.cc
@@ -0,0 +1,56 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_descrambler_bb.h>
+#include <gr_io_signature.h>
+
+gr_descrambler_bb_sptr
+gr_make_descrambler_bb(int mask, int seed, int len)
+{
+ return gnuradio::get_initial_sptr(new gr_descrambler_bb(mask, seed, len));
+}
+
+gr_descrambler_bb::gr_descrambler_bb(int mask, int seed, int len)
+ : gr_sync_block("descrambler_bb",
+ gr_make_io_signature (1, 1, sizeof (unsigned char)),
+ gr_make_io_signature (1, 1, sizeof (unsigned char))),
+ d_lfsr(mask, seed, len)
+{
+}
+
+int
+gr_descrambler_bb::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const unsigned char *in = (const unsigned char *) input_items[0];
+ unsigned char *out = (unsigned char *) output_items[0];
+
+ for (int i = 0; i < noutput_items; i++)
+ out[i] = d_lfsr.next_bit_descramble(in[i]);
+
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/general/gr_descrambler_bb.h b/gnuradio-core/src/lib/general/gr_descrambler_bb.h
new file mode 100644
index 000000000..333593caa
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_descrambler_bb.h
@@ -0,0 +1,60 @@
+/* -*- 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.
+ */
+#ifndef INCLUDED_GR_DESCRAMBLER_BB_H
+#define INCLUDED_GR_DESCRAMBLER_BB_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+#include "gri_lfsr.h"
+
+class gr_descrambler_bb;
+typedef boost::shared_ptr<gr_descrambler_bb> gr_descrambler_bb_sptr;
+
+GR_CORE_API gr_descrambler_bb_sptr gr_make_descrambler_bb(int mask, int seed, int len);
+
+/*!
+ * Descramble an input stream using an LFSR. This block works on the LSB only
+ * of the input data stream, i.e., on an "unpacked binary" stream, and
+ * produces the same format on its output.
+ *
+ * \param mask Polynomial mask for LFSR
+ * \param seed Initial shift register contents
+ * \param len Shift register length
+ *
+ * \ingroup coding_blk
+ */
+
+class GR_CORE_API gr_descrambler_bb : public gr_sync_block
+{
+ friend GR_CORE_API gr_descrambler_bb_sptr gr_make_descrambler_bb(int mask, int seed, int len);
+
+ gri_lfsr d_lfsr;
+
+ gr_descrambler_bb(int mask, int seed, int len);
+
+public:
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif /* INCLUDED_GR_DESCRAMBLER_BB_H */
diff --git a/gnuradio-core/src/lib/general/gr_descrambler_bb.i b/gnuradio-core/src/lib/general/gr_descrambler_bb.i
new file mode 100644
index 000000000..c6cd0a285
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_descrambler_bb.i
@@ -0,0 +1,31 @@
+/* -*- 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,descrambler_bb);
+
+gr_descrambler_bb_sptr gr_make_descrambler_bb(int mask, int seed, int len);
+
+class gr_descrambler_bb : public gr_sync_block
+{
+private:
+ gr_descrambler_bb(int mask, int seed, int len);
+};
diff --git a/gnuradio-core/src/lib/general/gr_diff_decoder_bb.cc b/gnuradio-core/src/lib/general/gr_diff_decoder_bb.cc
new file mode 100644
index 000000000..74324a62e
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_diff_decoder_bb.cc
@@ -0,0 +1,61 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_diff_decoder_bb.h>
+#include <gr_io_signature.h>
+
+gr_diff_decoder_bb_sptr
+gr_make_diff_decoder_bb (unsigned int modulus)
+{
+ return gnuradio::get_initial_sptr(new gr_diff_decoder_bb(modulus));
+}
+
+gr_diff_decoder_bb::gr_diff_decoder_bb (unsigned int modulus)
+ : gr_sync_block ("diff_decoder_bb",
+ gr_make_io_signature (1, 1, sizeof (unsigned char)),
+ gr_make_io_signature (1, 1, sizeof (unsigned char))),
+ d_modulus(modulus)
+{
+ set_history(2); // need to look at two inputs
+}
+
+int
+gr_diff_decoder_bb::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const unsigned char *in = (const unsigned char *) input_items[0];
+ unsigned char *out = (unsigned char *) output_items[0];
+ in += 1; // ensure that in[-1] is valid
+
+ unsigned modulus = d_modulus;
+
+ for (int i = 0; i < noutput_items; i++){
+ out[i] = (in[i] - in[i-1]) % modulus;
+ }
+
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/general/gr_diff_decoder_bb.h b/gnuradio-core/src/lib/general/gr_diff_decoder_bb.h
new file mode 100644
index 000000000..c4ebbc476
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_diff_decoder_bb.h
@@ -0,0 +1,53 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_GR_DIFF_DECODER_BB_H
+#define INCLUDED_GR_DIFF_DECODER_BB_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+
+class gr_diff_decoder_bb;
+typedef boost::shared_ptr<gr_diff_decoder_bb> gr_diff_decoder_bb_sptr;
+
+GR_CORE_API gr_diff_decoder_bb_sptr gr_make_diff_decoder_bb (unsigned int modulus);
+
+/*!
+ * \brief y[0] = (x[0] - x[-1]) % M
+ * \ingroup coding_blk
+ *
+ * Differential decoder
+ */
+class GR_CORE_API gr_diff_decoder_bb : public gr_sync_block
+{
+ friend GR_CORE_API gr_diff_decoder_bb_sptr gr_make_diff_decoder_bb (unsigned int modulus);
+ gr_diff_decoder_bb(unsigned int modulus);
+
+ unsigned int d_modulus;
+
+ 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/general/gr_diff_decoder_bb.i b/gnuradio-core/src/lib/general/gr_diff_decoder_bb.i
new file mode 100644
index 000000000..3dddb17c3
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_diff_decoder_bb.i
@@ -0,0 +1,31 @@
+/* -*- 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,diff_decoder_bb)
+
+gr_diff_decoder_bb_sptr gr_make_diff_decoder_bb (unsigned int modulus);
+
+class gr_diff_decoder_bb : public gr_sync_block
+{
+ private:
+ gr_diff_decoder_bb (unsigned int modulus);
+};
diff --git a/gnuradio-core/src/lib/general/gr_diff_encoder_bb.cc b/gnuradio-core/src/lib/general/gr_diff_encoder_bb.cc
new file mode 100644
index 000000000..98492c746
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_diff_encoder_bb.cc
@@ -0,0 +1,62 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_diff_encoder_bb.h>
+#include <gr_io_signature.h>
+
+gr_diff_encoder_bb_sptr
+gr_make_diff_encoder_bb (unsigned int modulus)
+{
+ return gnuradio::get_initial_sptr(new gr_diff_encoder_bb(modulus));
+}
+
+gr_diff_encoder_bb::gr_diff_encoder_bb (unsigned int modulus)
+ : gr_sync_block ("diff_encoder_bb",
+ gr_make_io_signature (1, 1, sizeof (unsigned char)),
+ gr_make_io_signature (1, 1, sizeof (unsigned char))),
+ d_last_out(0), d_modulus(modulus)
+{
+}
+
+int
+gr_diff_encoder_bb::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const unsigned char *in = (const unsigned char *) input_items[0];
+ unsigned char *out = (unsigned char *) output_items[0];
+
+ unsigned last_out = d_last_out;
+ unsigned modulus = d_modulus;
+
+ for (int i = 0; i < noutput_items; i++){
+ out[i] = (in[i] + last_out) % modulus;
+ last_out = out[i];
+ }
+
+ d_last_out = last_out;
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/general/gr_diff_encoder_bb.h b/gnuradio-core/src/lib/general/gr_diff_encoder_bb.h
new file mode 100644
index 000000000..e98876b70
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_diff_encoder_bb.h
@@ -0,0 +1,54 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_GR_DIFF_ENCODER_BB_H
+#define INCLUDED_GR_DIFF_ENCODER_BB_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+
+class gr_diff_encoder_bb;
+typedef boost::shared_ptr<gr_diff_encoder_bb> gr_diff_encoder_bb_sptr;
+
+GR_CORE_API gr_diff_encoder_bb_sptr gr_make_diff_encoder_bb (unsigned int modulus);
+
+/*!
+ * \brief y[0] = (x[0] + y[-1]) % M
+ * \ingroup coding_blk
+ *
+ * Differential encoder
+ */
+class GR_CORE_API gr_diff_encoder_bb : public gr_sync_block
+{
+ friend GR_CORE_API gr_diff_encoder_bb_sptr gr_make_diff_encoder_bb (unsigned int modulus);
+ gr_diff_encoder_bb(unsigned int modulus);
+
+ unsigned int d_last_out;
+ unsigned int d_modulus;
+
+ 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/general/gr_diff_encoder_bb.i b/gnuradio-core/src/lib/general/gr_diff_encoder_bb.i
new file mode 100644
index 000000000..96dadaca5
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_diff_encoder_bb.i
@@ -0,0 +1,31 @@
+/* -*- 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,diff_encoder_bb)
+
+gr_diff_encoder_bb_sptr gr_make_diff_encoder_bb (unsigned int modulus);
+
+class gr_diff_encoder_bb : public gr_sync_block
+{
+ private:
+ gr_diff_encoder_bb (unsigned int modulus);
+};
diff --git a/gnuradio-core/src/lib/general/gr_diff_phasor_cc.cc b/gnuradio-core/src/lib/general/gr_diff_phasor_cc.cc
new file mode 100644
index 000000000..89fa2041e
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_diff_phasor_cc.cc
@@ -0,0 +1,61 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_diff_phasor_cc.h>
+#include <gr_io_signature.h>
+
+gr_diff_phasor_cc_sptr
+gr_make_diff_phasor_cc ()
+{
+ return gnuradio::get_initial_sptr(new gr_diff_phasor_cc());
+}
+
+gr_diff_phasor_cc::gr_diff_phasor_cc ()
+ : gr_sync_block ("diff_phasor_cc",
+ gr_make_io_signature (1, 1, sizeof (gr_complex)),
+ gr_make_io_signature (1, 1, sizeof (gr_complex)))
+{
+ set_history(2);
+}
+
+
+gr_diff_phasor_cc::~gr_diff_phasor_cc(){}
+
+int
+gr_diff_phasor_cc::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ gr_complex const *in = (const gr_complex *) input_items[0];
+ gr_complex *out = (gr_complex *) output_items[0];
+ in += 1; // ensure that i - 1 is valid.
+
+ for(int i = 0; i < noutput_items; i++){
+ out[i] = in[i] * conj(in[i-1]);
+ }
+
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/general/gr_diff_phasor_cc.h b/gnuradio-core/src/lib/general/gr_diff_phasor_cc.h
new file mode 100644
index 000000000..21c4f616d
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_diff_phasor_cc.h
@@ -0,0 +1,53 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_GR_DIFF_PHASOR_CC_H
+#define INCLUDED_GR_DIFF_PHASOR_CC_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+
+/*!
+ * \brief Please fix my documentation!
+ * \ingroup misc
+ */
+class gr_diff_phasor_cc;
+typedef boost::shared_ptr<gr_diff_phasor_cc> gr_diff_phasor_cc_sptr;
+
+GR_CORE_API gr_diff_phasor_cc_sptr gr_make_diff_phasor_cc ();
+
+
+class GR_CORE_API gr_diff_phasor_cc : public gr_sync_block
+{
+ friend GR_CORE_API gr_diff_phasor_cc_sptr gr_make_diff_phasor_cc ();
+
+ gr_diff_phasor_cc (); //constructor
+
+ public:
+ ~gr_diff_phasor_cc(); //destructor
+
+ 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/general/gr_diff_phasor_cc.i b/gnuradio-core/src/lib/general/gr_diff_phasor_cc.i
new file mode 100644
index 000000000..8aecd5cc7
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_diff_phasor_cc.i
@@ -0,0 +1,34 @@
+/* -*- 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,diff_phasor_cc)
+
+gr_diff_phasor_cc_sptr gr_make_diff_phasor_cc ();
+
+class gr_diff_phasor_cc : public gr_sync_block
+{
+ private:
+ gr_diff_phasor_cc ();
+
+ public:
+ ~gr_diff_phasor_cc();
+};
diff --git a/gnuradio-core/src/lib/general/gr_dpll_bb.cc b/gnuradio-core/src/lib/general/gr_dpll_bb.cc
new file mode 100644
index 000000000..1d5a0d4fd
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_dpll_bb.cc
@@ -0,0 +1,84 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_dpll_bb.h>
+#include <gr_io_signature.h>
+#include <cstdio>
+
+gr_dpll_bb_sptr
+gr_make_dpll_bb (float period, float gain)
+{
+ return gnuradio::get_initial_sptr(new gr_dpll_bb (period, gain));
+}
+
+gr_dpll_bb::gr_dpll_bb (float period, float gain)
+ : gr_sync_block ("dpll_bb",
+ gr_make_io_signature (1, 1, sizeof (char)),
+ gr_make_io_signature (1, 1, sizeof (char))),
+ d_restart(0),d_pulse_phase(0)
+{
+ d_pulse_frequency = 1.0/period;
+ d_gain = gain;
+ d_decision_threshold = 1.0 - 0.5*d_pulse_frequency;
+#if 1
+ fprintf(stderr,"frequency = %f period = %f gain = %f threshold = %f\n",
+ d_pulse_frequency,
+ period,
+ d_gain,
+ d_decision_threshold);
+#endif
+}
+
+int
+gr_dpll_bb::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const char *iptr = (const char *) input_items[0];
+ char *optr = (char *) output_items[0];
+
+ for (int i = 0; i < noutput_items; i++){
+ optr[i]= 0;
+ if(iptr[i] == 1) {
+ if (d_restart == 0) {
+ d_pulse_phase = 1;
+ } else {
+ if (d_pulse_phase > 0.5) d_pulse_phase += d_gain*(1.0-d_pulse_phase);
+ else d_pulse_phase -= d_gain*d_pulse_phase;
+ }
+ d_restart = 3;
+ }
+ if (d_pulse_phase > d_decision_threshold) {
+ d_pulse_phase -= 1.0;
+ if (d_restart > 0) {
+ d_restart -= 1;
+ optr[i] = 1;
+ }
+ }
+ d_pulse_phase += d_pulse_frequency;
+ }
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/general/gr_dpll_bb.h b/gnuradio-core/src/lib/general/gr_dpll_bb.h
new file mode 100644
index 000000000..a7df974fb
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_dpll_bb.h
@@ -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.
+ */
+
+#ifndef INCLUDED_GR_DPLL_BB_H
+#define INCLUDED_GR_DPLL_BB_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+
+class gr_dpll_bb;
+typedef boost::shared_ptr<gr_dpll_bb> gr_dpll_bb_sptr;
+
+GR_CORE_API gr_dpll_bb_sptr gr_make_dpll_bb (float period, float gain);
+
+/*!
+ * \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.
+ */
+class GR_CORE_API gr_dpll_bb : public gr_sync_block
+{
+ friend GR_CORE_API gr_dpll_bb_sptr gr_make_dpll_bb (float period, float gain);
+
+ gr_dpll_bb (float period, float gain);
+
+ private:
+ unsigned char d_restart;
+ float d_pulse_phase, d_pulse_frequency,d_gain,d_decision_threshold;
+
+ 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/general/gr_dpll_bb.i b/gnuradio-core/src/lib/general/gr_dpll_bb.i
new file mode 100644
index 000000000..f31a87374
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_dpll_bb.i
@@ -0,0 +1,31 @@
+/* -*- 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,dpll_bb)
+
+ gr_dpll_bb_sptr gr_make_dpll_bb (float period, float gain);
+
+class gr_dpll_bb : public gr_sync_block
+{
+ private:
+ gr_dpll_bb (float period, float gain);
+};
diff --git a/gnuradio-core/src/lib/general/gr_encode_ccsds_27_bb.cc b/gnuradio-core/src/lib/general/gr_encode_ccsds_27_bb.cc
new file mode 100644
index 000000000..4a92d113a
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_encode_ccsds_27_bb.cc
@@ -0,0 +1,62 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2008,2010 Free Software Foundation, Inc.
+ *
+ * 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 <gr_encode_ccsds_27_bb.h>
+#include <gr_io_signature.h>
+
+extern "C" {
+#include <../viterbi/viterbi.h>
+}
+
+gr_encode_ccsds_27_bb_sptr
+gr_make_encode_ccsds_27_bb()
+{
+ return gnuradio::get_initial_sptr(new gr_encode_ccsds_27_bb());
+}
+
+gr_encode_ccsds_27_bb::gr_encode_ccsds_27_bb()
+ : gr_sync_interpolator("encode_ccsds_27_bb",
+ gr_make_io_signature(1, 1, sizeof(char)),
+ gr_make_io_signature(1, 1, sizeof(char)),
+ 16) // Rate 1/2 code, packed to unpacked conversion
+{
+ d_encstate = 0;
+}
+
+gr_encode_ccsds_27_bb::~gr_encode_ccsds_27_bb()
+{
+}
+
+int
+gr_encode_ccsds_27_bb::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ unsigned char *in = (unsigned char *)input_items[0];
+ unsigned char *out = (unsigned char *)output_items[0];
+
+ d_encstate = encode(out, in, noutput_items/16, d_encstate);
+
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/general/gr_encode_ccsds_27_bb.h b/gnuradio-core/src/lib/general/gr_encode_ccsds_27_bb.h
new file mode 100644
index 000000000..94e9c33f1
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_encode_ccsds_27_bb.h
@@ -0,0 +1,64 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008 Free Software Foundation, Inc.
+ *
+ * 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_ENCODE_CCSDS_27_BB_H
+#define INCLUDED_GR_ENCODE_CCSDS_27_BB_H
+
+#include <gr_core_api.h>
+#include <gr_sync_interpolator.h>
+
+class gr_encode_ccsds_27_bb;
+
+typedef boost::shared_ptr<gr_encode_ccsds_27_bb> gr_encode_ccsds_27_bb_sptr;
+
+GR_CORE_API gr_encode_ccsds_27_bb_sptr gr_make_encode_ccsds_27_bb();
+
+/*! \brief A rate 1/2, k=7 convolutional encoder for the CCSDS standard
+ * \ingroup ecc
+ *
+ * This block performs convolutional encoding using the CCSDS standard
+ * polynomial ("Voyager").
+ *
+ * The input is an MSB first packed stream of bits.
+ *
+ * The output is a stream of symbols 0 or 1 representing the encoded data.
+ *
+ * As a rate 1/2 code, there will be 16 output symbols for every input byte.
+ *
+ * This block is designed for continuous data streaming, not packetized data.
+ * There is no provision to "flush" the encoder.
+ */
+
+class GR_CORE_API gr_encode_ccsds_27_bb : public gr_sync_interpolator
+{
+private:
+ friend GR_CORE_API gr_encode_ccsds_27_bb_sptr gr_make_encode_ccsds_27_bb();
+
+ gr_encode_ccsds_27_bb();
+ unsigned char d_encstate;
+
+ public:
+ ~gr_encode_ccsds_27_bb();
+
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif /* INCLUDED_GR_ENCODE_CCSDS_27_BB_H */
diff --git a/gnuradio-core/src/lib/general/gr_encode_ccsds_27_bb.i b/gnuradio-core/src/lib/general/gr_encode_ccsds_27_bb.i
new file mode 100644
index 000000000..e74e9174a
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_encode_ccsds_27_bb.i
@@ -0,0 +1,31 @@
+/* -*- 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,encode_ccsds_27_bb);
+
+gr_encode_ccsds_27_bb_sptr gr_make_encode_ccsds_27_bb ();
+
+class gr_encode_ccsds_27_bb : public gr_sync_interpolator
+{
+private:
+ gr_encode_ccsds_27_bb();
+};
diff --git a/gnuradio-core/src/lib/general/gr_endian_swap.cc b/gnuradio-core/src/lib/general/gr_endian_swap.cc
new file mode 100644
index 000000000..8bea0ca30
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_endian_swap.cc
@@ -0,0 +1,101 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,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 <gr_endian_swap.h>
+#include <gr_io_signature.h>
+#include <volk/volk.h>
+
+gr_endian_swap_sptr
+gr_make_endian_swap (size_t item_size_bytes)
+{
+ return gnuradio::get_initial_sptr(new gr_endian_swap (item_size_bytes));
+}
+
+gr_endian_swap::gr_endian_swap (size_t item_size_bytes)
+ : gr_sync_block ("gr_endian_swap",
+ gr_make_io_signature (1, 1, item_size_bytes),
+ gr_make_io_signature (1, 1, item_size_bytes))
+{
+ const int alignment_multiple = volk_get_alignment();
+ set_alignment(std::max(1,alignment_multiple));
+}
+
+int
+gr_endian_swap::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const char *in = (const char *) input_items[0];
+ char *out = (char *) output_items[0];
+
+ int nbytes( output_signature()->sizeof_stream_item(0) );
+ if(is_unaligned()) {
+ switch(nbytes){
+ case 1:
+ memcpy(out,in,noutput_items);
+ break;
+ case 2:
+ memcpy(out,in,2*noutput_items);
+ volk_16u_byteswap_u((uint16_t*)out,noutput_items);
+ break;
+ case 4:
+ memcpy(out,in,4*noutput_items);
+ volk_32u_byteswap_u((uint32_t*)out,noutput_items);
+ break;
+ case 8:
+ memcpy(out,in,8*noutput_items);
+ volk_64u_byteswap_u((uint64_t*)out,noutput_items);
+ break;
+ default:
+ throw std::runtime_error("itemsize is not valid for gr_endian_swap!");
+ }
+ } else {
+ switch(nbytes){
+ case 1:
+ memcpy(out,in,noutput_items);
+ break;
+ case 2:
+ memcpy(out,in,2*noutput_items);
+ volk_16u_byteswap_a((uint16_t*)out,noutput_items);
+ break;
+ case 4:
+ memcpy(out,in,4*noutput_items);
+ volk_32u_byteswap_a((uint32_t*)out,noutput_items);
+ break;
+ case 8:
+ memcpy(out,in,8*noutput_items);
+ volk_64u_byteswap_a((uint64_t*)out,noutput_items);
+ break;
+ default:
+ throw std::runtime_error("itemsize is not valid for gr_endian_swap!");
+ }
+ }
+
+ return noutput_items;
+}
+
+
+
diff --git a/gnuradio-core/src/lib/general/gr_endian_swap.h b/gnuradio-core/src/lib/general/gr_endian_swap.h
new file mode 100644
index 000000000..0baa3f338
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_endian_swap.h
@@ -0,0 +1,57 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,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 INCLUDED_GR_ENDIAN_SWAP_H
+#define INCLUDED_GR_ENDIAN_SWAP_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+
+class gr_endian_swap;
+typedef boost::shared_ptr<gr_endian_swap> gr_endian_swap_sptr;
+
+GR_CORE_API gr_endian_swap_sptr
+gr_make_endian_swap (size_t item_size_bytes=1);
+
+/*!
+ * \brief Convert stream of items into thier byte swapped version
+ *
+ * \param item_size_bytes number of bytes per item, 1=no-op,2=uint16_t,4=uint32_t,8=uint64_t
+ */
+
+class GR_CORE_API gr_endian_swap : public gr_sync_block
+{
+ private:
+ friend GR_CORE_API gr_endian_swap_sptr
+ gr_make_endian_swap (size_t item_size_bytes);
+ gr_endian_swap (size_t item_size_bytes);
+
+ size_t item_size_bytes;
+
+ public:
+ virtual int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+
+#endif /* INCLUDED_GR_ENDIAN_SWAP_H */
diff --git a/gnuradio-core/src/lib/general/gr_endian_swap.i b/gnuradio-core/src/lib/general/gr_endian_swap.i
new file mode 100644
index 000000000..6058b9de7
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_endian_swap.i
@@ -0,0 +1,31 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,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,endian_swap)
+
+gr_endian_swap_sptr
+gr_make_endian_swap (size_t bytes_per_item=1);
+
+class gr_endian_swap : public gr_sync_block
+{
+public:
+};
diff --git a/gnuradio-core/src/lib/general/gr_expj.h b/gnuradio-core/src/lib/general/gr_expj.h
new file mode 100644
index 000000000..1d8633242
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_expj.h
@@ -0,0 +1,38 @@
+/* -*- 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.
+ */
+#ifndef INCLUDED_GR_EXPJ_H
+#define INCLUDED_GR_EXPJ_H
+
+#include <gr_core_api.h>
+#include <gr_sincos.h>
+#include <gr_types.h>
+
+static inline gr_complex
+gr_expj(float phase)
+{
+ float t_imag, t_real;
+ gr_sincosf(phase, &t_imag, &t_real);
+ return gr_complex(t_real, t_imag);
+}
+
+
+#endif /* INCLUDED_GR_EXPJ_H */
diff --git a/gnuradio-core/src/lib/general/gr_fake_channel_coder_pp.cc b/gnuradio-core/src/lib/general/gr_fake_channel_coder_pp.cc
new file mode 100644
index 000000000..c1c3883c5
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_fake_channel_coder_pp.cc
@@ -0,0 +1,113 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_fake_channel_coder_pp.h>
+#include <gr_io_signature.h>
+#include <string.h>
+#include <stdexcept>
+#include <string.h>
+
+static const int PAD_VAL = 0xAA;
+
+gr_fake_channel_encoder_pp_sptr
+gr_make_fake_channel_encoder_pp(int input_vlen, int output_vlen)
+{
+ return gnuradio::get_initial_sptr(new gr_fake_channel_encoder_pp(input_vlen,
+ output_vlen));
+}
+
+gr_fake_channel_encoder_pp::gr_fake_channel_encoder_pp(int input_vlen, int output_vlen)
+ : gr_sync_block("fake_channel_encoder_pp",
+ gr_make_io_signature(1, 1, input_vlen * sizeof(unsigned char)),
+ gr_make_io_signature(1, 1, output_vlen * sizeof(unsigned char))),
+ d_input_vlen(input_vlen), d_output_vlen(output_vlen)
+{
+ if (input_vlen <= 0 || output_vlen <= 0 || input_vlen > output_vlen)
+ throw std::invalid_argument("gr_fake_channel_encoder_pp");
+}
+
+gr_fake_channel_encoder_pp::~gr_fake_channel_encoder_pp()
+{
+}
+
+int
+gr_fake_channel_encoder_pp::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const unsigned char *in = (const unsigned char *) input_items[0];
+ unsigned char *out = (unsigned char *) output_items[0];
+ int npad = d_output_vlen - d_input_vlen;
+
+ for (int i = 0; i < noutput_items; i++){
+ memcpy(out, in, d_input_vlen);
+ memset(out + d_input_vlen, PAD_VAL, npad);
+ in += d_input_vlen;
+ out += d_output_vlen;
+ }
+
+ return noutput_items;
+}
+
+// ------------------------------------------------------------------------
+
+gr_fake_channel_decoder_pp_sptr
+gr_make_fake_channel_decoder_pp(int input_vlen, int output_vlen)
+{
+ return gnuradio::get_initial_sptr(new gr_fake_channel_decoder_pp(input_vlen,
+ output_vlen));
+}
+
+gr_fake_channel_decoder_pp::gr_fake_channel_decoder_pp(int input_vlen, int output_vlen)
+ : gr_sync_block("fake_channel_decoder_pp",
+ gr_make_io_signature(1, 1, input_vlen * sizeof(unsigned char)),
+ gr_make_io_signature(1, 1, output_vlen * sizeof(unsigned char))),
+ d_input_vlen(input_vlen), d_output_vlen(output_vlen)
+{
+ if (input_vlen <= 0 || output_vlen <= 0 || output_vlen > input_vlen)
+ throw std::invalid_argument("gr_fake_channel_decoder_pp");
+}
+
+gr_fake_channel_decoder_pp::~gr_fake_channel_decoder_pp()
+{
+}
+
+int
+gr_fake_channel_decoder_pp::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const unsigned char *in = (const unsigned char *) input_items[0];
+ unsigned char *out = (unsigned char *) output_items[0];
+
+ for (int i = 0; i < noutput_items; i++){
+ memcpy(out, in, d_output_vlen);
+ in += d_input_vlen;
+ out += d_output_vlen;
+ }
+
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/general/gr_fake_channel_coder_pp.h b/gnuradio-core/src/lib/general/gr_fake_channel_coder_pp.h
new file mode 100644
index 000000000..45808752d
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_fake_channel_coder_pp.h
@@ -0,0 +1,91 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005 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_FAKE_CHANNEL_CODER_PP_H
+#define INCLUDED_GR_FAKE_CHANNEL_CODER_PP_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+
+class gr_fake_channel_encoder_pp;
+typedef boost::shared_ptr<gr_fake_channel_encoder_pp> gr_fake_channel_encoder_pp_sptr;
+
+GR_CORE_API gr_fake_channel_encoder_pp_sptr
+gr_make_fake_channel_encoder_pp(int input_vlen, int output_vlen);
+
+/*!
+ * \brief pad packet with alternating 1,0 pattern.
+ * \ingroup coding_blk
+ *
+ * input: stream of byte vectors; output: stream of byte vectors
+ */
+class GR_CORE_API gr_fake_channel_encoder_pp : public gr_sync_block
+{
+ int d_input_vlen;
+ int d_output_vlen;
+
+ gr_fake_channel_encoder_pp(int input_vlen, int output_vlen);
+
+ friend GR_CORE_API gr_fake_channel_encoder_pp_sptr
+ gr_make_fake_channel_encoder_pp(int input_vlen, int output_vlen);
+
+public:
+ ~gr_fake_channel_encoder_pp();
+
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+// ------------------------------------------------------------------------
+
+class gr_fake_channel_decoder_pp;
+typedef boost::shared_ptr<gr_fake_channel_decoder_pp> gr_fake_channel_decoder_pp_sptr;
+
+GR_CORE_API gr_fake_channel_decoder_pp_sptr
+gr_make_fake_channel_decoder_pp(int input_vlen, int output_vlen);
+
+/*!
+ * \brief remove fake padding from packet
+ * \ingroup coding_blk
+ *
+ * input: stream of byte vectors; output: stream of byte vectors
+ */
+class GR_CORE_API gr_fake_channel_decoder_pp : public gr_sync_block
+{
+ int d_input_vlen;
+ int d_output_vlen;
+
+ gr_fake_channel_decoder_pp(int input_vlen, int output_vlen);
+
+ friend GR_CORE_API gr_fake_channel_decoder_pp_sptr
+ gr_make_fake_channel_decoder_pp(int input_vlen, int output_vlen);
+
+public:
+ ~gr_fake_channel_decoder_pp();
+
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif /* INCLUDED_GR_FAKE_CHANNEL_CODER_PP_H */
diff --git a/gnuradio-core/src/lib/general/gr_fake_channel_coder_pp.i b/gnuradio-core/src/lib/general/gr_fake_channel_coder_pp.i
new file mode 100644
index 000000000..123c84e47
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_fake_channel_coder_pp.i
@@ -0,0 +1,53 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005 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,fake_channel_encoder_pp)
+
+gr_fake_channel_encoder_pp_sptr
+gr_make_fake_channel_encoder_pp(int input_vlen,
+ int output_vlen
+ ) throw(std::invalid_argument);
+
+class gr_fake_channel_encoder_pp : public gr_sync_block
+{
+ gr_fake_channel_encoder_pp(int input_vlen, int output_vlen);
+
+public:
+ ~gr_fake_channel_encoder_pp();
+};
+
+// ------------------------------------------------------------------------
+
+GR_SWIG_BLOCK_MAGIC(gr,fake_channel_decoder_pp)
+
+gr_fake_channel_decoder_pp_sptr
+gr_make_fake_channel_decoder_pp(int input_vlen,
+ int output_vlen
+ ) throw(std::invalid_argument);
+
+class gr_fake_channel_decoder_pp : public gr_sync_block
+{
+ gr_fake_channel_decoder_pp(int input_vlen, int output_vlen);
+
+public:
+ ~gr_fake_channel_decoder_pp();
+};
diff --git a/gnuradio-core/src/lib/general/gr_fast_atan2f.cc b/gnuradio-core/src/lib/general/gr_fast_atan2f.cc
new file mode 100644
index 000000000..8b7bfea12
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_fast_atan2f.cc
@@ -0,0 +1,199 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005 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_math.h> // declaration is in here
+#include <cmath>
+
+#define REAL float
+
+/***************************************************************************/
+/* Constant definitions */
+/***************************************************************************/
+
+#define TAN_MAP_RES 0.003921569 /* (smallest non-zero value in table) */
+#define RAD_PER_DEG 0.017453293
+#define TAN_MAP_SIZE 256
+
+/* arctangents from 0 to pi/4 radians */
+static REAL
+fast_atan_table[257] = {
+ 0.000000e+00, 3.921549e-03, 7.842976e-03, 1.176416e-02,
+ 1.568499e-02, 1.960533e-02, 2.352507e-02, 2.744409e-02,
+ 3.136226e-02, 3.527947e-02, 3.919560e-02, 4.311053e-02,
+ 4.702413e-02, 5.093629e-02, 5.484690e-02, 5.875582e-02,
+ 6.266295e-02, 6.656816e-02, 7.047134e-02, 7.437238e-02,
+ 7.827114e-02, 8.216752e-02, 8.606141e-02, 8.995267e-02,
+ 9.384121e-02, 9.772691e-02, 1.016096e-01, 1.054893e-01,
+ 1.093658e-01, 1.132390e-01, 1.171087e-01, 1.209750e-01,
+ 1.248376e-01, 1.286965e-01, 1.325515e-01, 1.364026e-01,
+ 1.402496e-01, 1.440924e-01, 1.479310e-01, 1.517652e-01,
+ 1.555948e-01, 1.594199e-01, 1.632403e-01, 1.670559e-01,
+ 1.708665e-01, 1.746722e-01, 1.784728e-01, 1.822681e-01,
+ 1.860582e-01, 1.898428e-01, 1.936220e-01, 1.973956e-01,
+ 2.011634e-01, 2.049255e-01, 2.086818e-01, 2.124320e-01,
+ 2.161762e-01, 2.199143e-01, 2.236461e-01, 2.273716e-01,
+ 2.310907e-01, 2.348033e-01, 2.385093e-01, 2.422086e-01,
+ 2.459012e-01, 2.495869e-01, 2.532658e-01, 2.569376e-01,
+ 2.606024e-01, 2.642600e-01, 2.679104e-01, 2.715535e-01,
+ 2.751892e-01, 2.788175e-01, 2.824383e-01, 2.860514e-01,
+ 2.896569e-01, 2.932547e-01, 2.968447e-01, 3.004268e-01,
+ 3.040009e-01, 3.075671e-01, 3.111252e-01, 3.146752e-01,
+ 3.182170e-01, 3.217506e-01, 3.252758e-01, 3.287927e-01,
+ 3.323012e-01, 3.358012e-01, 3.392926e-01, 3.427755e-01,
+ 3.462497e-01, 3.497153e-01, 3.531721e-01, 3.566201e-01,
+ 3.600593e-01, 3.634896e-01, 3.669110e-01, 3.703234e-01,
+ 3.737268e-01, 3.771211e-01, 3.805064e-01, 3.838825e-01,
+ 3.872494e-01, 3.906070e-01, 3.939555e-01, 3.972946e-01,
+ 4.006244e-01, 4.039448e-01, 4.072558e-01, 4.105574e-01,
+ 4.138496e-01, 4.171322e-01, 4.204054e-01, 4.236689e-01,
+ 4.269229e-01, 4.301673e-01, 4.334021e-01, 4.366272e-01,
+ 4.398426e-01, 4.430483e-01, 4.462443e-01, 4.494306e-01,
+ 4.526070e-01, 4.557738e-01, 4.589307e-01, 4.620778e-01,
+ 4.652150e-01, 4.683424e-01, 4.714600e-01, 4.745676e-01,
+ 4.776654e-01, 4.807532e-01, 4.838312e-01, 4.868992e-01,
+ 4.899573e-01, 4.930055e-01, 4.960437e-01, 4.990719e-01,
+ 5.020902e-01, 5.050985e-01, 5.080968e-01, 5.110852e-01,
+ 5.140636e-01, 5.170320e-01, 5.199904e-01, 5.229388e-01,
+ 5.258772e-01, 5.288056e-01, 5.317241e-01, 5.346325e-01,
+ 5.375310e-01, 5.404195e-01, 5.432980e-01, 5.461666e-01,
+ 5.490251e-01, 5.518738e-01, 5.547124e-01, 5.575411e-01,
+ 5.603599e-01, 5.631687e-01, 5.659676e-01, 5.687566e-01,
+ 5.715357e-01, 5.743048e-01, 5.770641e-01, 5.798135e-01,
+ 5.825531e-01, 5.852828e-01, 5.880026e-01, 5.907126e-01,
+ 5.934128e-01, 5.961032e-01, 5.987839e-01, 6.014547e-01,
+ 6.041158e-01, 6.067672e-01, 6.094088e-01, 6.120407e-01,
+ 6.146630e-01, 6.172755e-01, 6.198784e-01, 6.224717e-01,
+ 6.250554e-01, 6.276294e-01, 6.301939e-01, 6.327488e-01,
+ 6.352942e-01, 6.378301e-01, 6.403565e-01, 6.428734e-01,
+ 6.453808e-01, 6.478788e-01, 6.503674e-01, 6.528466e-01,
+ 6.553165e-01, 6.577770e-01, 6.602282e-01, 6.626701e-01,
+ 6.651027e-01, 6.675261e-01, 6.699402e-01, 6.723452e-01,
+ 6.747409e-01, 6.771276e-01, 6.795051e-01, 6.818735e-01,
+ 6.842328e-01, 6.865831e-01, 6.889244e-01, 6.912567e-01,
+ 6.935800e-01, 6.958943e-01, 6.981998e-01, 7.004964e-01,
+ 7.027841e-01, 7.050630e-01, 7.073330e-01, 7.095943e-01,
+ 7.118469e-01, 7.140907e-01, 7.163258e-01, 7.185523e-01,
+ 7.207701e-01, 7.229794e-01, 7.251800e-01, 7.273721e-01,
+ 7.295557e-01, 7.317307e-01, 7.338974e-01, 7.360555e-01,
+ 7.382053e-01, 7.403467e-01, 7.424797e-01, 7.446045e-01,
+ 7.467209e-01, 7.488291e-01, 7.509291e-01, 7.530208e-01,
+ 7.551044e-01, 7.571798e-01, 7.592472e-01, 7.613064e-01,
+ 7.633576e-01, 7.654008e-01, 7.674360e-01, 7.694633e-01,
+ 7.714826e-01, 7.734940e-01, 7.754975e-01, 7.774932e-01,
+ 7.794811e-01, 7.814612e-01, 7.834335e-01, 7.853983e-01,
+ 7.853983e-01
+ };
+
+
+/*****************************************************************************
+Function: Arc tangent
+
+Syntax: angle = fast_atan2(y, x);
+REAL y y component of input vector
+REAL x x component of input vector
+REAL angle angle of vector (x, y) in radians
+
+Description: This function calculates the angle of the vector (x,y) based
+on a table lookup and linear interpolation. The table uses
+a 256 point table covering -45 to +45 degrees and uses
+symetry to determine the final angle value in the range of
+-180 to 180 degrees. Note that this function uses the small
+angle approximation for values close to zero. This routine
+calculates the arc tangent with an average error of
++/- 0.045 degrees.
+*****************************************************************************/
+
+REAL
+gr_fast_atan2f(REAL y, REAL x)
+{
+ REAL x_abs, y_abs, z;
+ REAL alpha, angle, base_angle;
+ int index;
+
+ /* don't divide by zero! */ // FIXME could get hosed with -0.0
+ if ((y == 0.0) && (x == 0.0))
+ return 0.0;
+
+ /* normalize to +/- 45 degree range */
+ y_abs = fabs(y);
+ x_abs = fabs(x);
+ //z = (y_abs < x_abs ? y_abs / x_abs : x_abs / y_abs);
+ if (y_abs < x_abs)
+ z = y_abs / x_abs;
+ else
+ z = x_abs / y_abs;
+
+ /* when ratio approaches the table resolution, the angle is */
+ /* best approximated with the argument itself... */
+ if (z < TAN_MAP_RES)
+ base_angle = z;
+ else {
+ /* find index and interpolation value */
+ alpha = z * (REAL) TAN_MAP_SIZE - .5;
+ index = (int) alpha;
+ alpha -= (REAL) index;
+ /* determine base angle based on quadrant and */
+ /* add or subtract table value from base angle based on quadrant */
+ base_angle = fast_atan_table[index];
+ base_angle +=
+ (fast_atan_table[index + 1] - fast_atan_table[index]) * alpha;
+ }
+
+ if (x_abs > y_abs) { /* -45 -> 45 or 135 -> 225 */
+ if (x >= 0.0) { /* -45 -> 45 */
+ if (y >= 0.0)
+ angle = base_angle; /* 0 -> 45, angle OK */
+ else
+ angle = -base_angle; /* -45 -> 0, angle = -angle */
+ } else { /* 135 -> 180 or 180 -> -135 */
+ angle = 3.14159265358979323846;
+ if (y >= 0.0)
+ angle -= base_angle; /* 135 -> 180, angle = 180 - angle */
+ else
+ angle = base_angle - angle; /* 180 -> -135, angle = angle - 180 */
+ }
+ } else { /* 45 -> 135 or -135 -> -45 */
+ if (y >= 0.0) { /* 45 -> 135 */
+ angle = 1.57079632679489661923;
+ if (x >= 0.0)
+ angle -= base_angle; /* 45 -> 90, angle = 90 - angle */
+ else
+ angle += base_angle; /* 90 -> 135, angle = 90 + angle */
+ } else { /* -135 -> -45 */
+ angle = -1.57079632679489661923;
+ if (x >= 0.0)
+ angle += base_angle; /* -90 -> -45, angle = -90 + angle */
+ else
+ angle -= base_angle; /* -135 -> -90, angle = -90 - angle */
+ }
+ }
+
+#ifdef ZERO_TO_TWOPI
+ if (angle < 0)
+ return (angle + TWOPI);
+ else
+ return (angle);
+#else
+ return (angle);
+#endif
+}
+
diff --git a/gnuradio-core/src/lib/general/gr_feedforward_agc_cc.cc b/gnuradio-core/src/lib/general/gr_feedforward_agc_cc.cc
new file mode 100644
index 000000000..147b64e9b
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_feedforward_agc_cc.cc
@@ -0,0 +1,91 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_feedforward_agc_cc.h>
+#include <gr_io_signature.h>
+#include <stdexcept>
+
+gr_feedforward_agc_cc_sptr
+gr_make_feedforward_agc_cc(int nsamples, float reference)
+{
+ return gnuradio::get_initial_sptr(new gr_feedforward_agc_cc (nsamples, reference));
+}
+
+gr_feedforward_agc_cc::gr_feedforward_agc_cc (int nsamples, float reference)
+ : gr_sync_block ("gr_feedforward_agc_cc",
+ gr_make_io_signature (1, 1, sizeof (gr_complex)),
+ gr_make_io_signature (1, 1, sizeof (gr_complex))),
+ d_nsamples(nsamples), d_reference(reference)
+{
+ if (nsamples < 1)
+ throw std::invalid_argument("gr_feedforward_agc_cc: nsamples must be >= 1");
+
+ set_history(nsamples);
+}
+
+gr_feedforward_agc_cc::~gr_feedforward_agc_cc()
+{
+}
+
+inline static float
+mag_squared(gr_complex x)
+{
+ return x.real() * x.real() + x.imag() * x.imag();
+}
+
+// approximate sqrt(x^2 + y^2)
+inline static float
+envelope(gr_complex x)
+{
+ float r_abs = std::fabs(x.real());
+ float i_abs = std::fabs(x.imag());
+
+ if (r_abs > i_abs)
+ return r_abs + 0.4 * i_abs;
+ else
+ return i_abs + 0.4 * r_abs;
+}
+
+int
+gr_feedforward_agc_cc::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const gr_complex *in = (const gr_complex *) input_items[0];
+ gr_complex *out = (gr_complex *) output_items[0];
+ int nsamples = d_nsamples;
+ float gain;
+
+ for (int i = 0; i < noutput_items; i++){
+ //float max_env = 1e-12; // avoid divide by zero
+ float max_env = 1e-4; // avoid divide by zero, indirectly set max gain
+ for (int j = 0; j < nsamples; j++)
+ max_env = std::max(max_env, envelope(in[i+j]));
+ gain = d_reference / max_env;
+ out[i] = gain * in[i];
+ }
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/general/gr_feedforward_agc_cc.h b/gnuradio-core/src/lib/general/gr_feedforward_agc_cc.h
new file mode 100644
index 000000000..63e5e4c43
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_feedforward_agc_cc.h
@@ -0,0 +1,57 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_GR_FEEDFORWARD_AGC_CC_H
+#define INCLUDED_GR_FEEDFORWARD_AGC_CC_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+
+class gr_feedforward_agc_cc;
+typedef boost::shared_ptr<gr_feedforward_agc_cc> gr_feedforward_agc_cc_sptr;
+
+GR_CORE_API gr_feedforward_agc_cc_sptr
+gr_make_feedforward_agc_cc(int nsamples, float reference = 1.0);
+
+/*!
+ * \brief Non-causal AGC which computes required gain based on max absolute value over nsamples
+ * \ingroup level_blk
+ */
+class GR_CORE_API gr_feedforward_agc_cc : public gr_sync_block
+{
+ friend GR_CORE_API gr_feedforward_agc_cc_sptr
+ gr_make_feedforward_agc_cc(int nsamples, float reference);
+
+ int d_nsamples;
+ float d_reference;
+
+ gr_feedforward_agc_cc(int nsamples, float reference);
+
+ public:
+ ~gr_feedforward_agc_cc();
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif /* INCLUDED_GR_FEEDFORWARD_AGC_CC_H */
diff --git a/gnuradio-core/src/lib/general/gr_feedforward_agc_cc.i b/gnuradio-core/src/lib/general/gr_feedforward_agc_cc.i
new file mode 100644
index 000000000..1fd5a2c26
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_feedforward_agc_cc.i
@@ -0,0 +1,34 @@
+/* -*- 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,feedforward_agc_cc);
+
+gr_feedforward_agc_cc_sptr
+gr_make_feedforward_agc_cc(int nsamples, float reference = 1.0);
+
+class gr_feedforward_agc_cc : public gr_sync_block
+{
+ gr_feedforward_agc_cc(int nsamples, float reference);
+
+ public:
+ ~gr_feedforward_agc_cc();
+};
diff --git a/gnuradio-core/src/lib/general/gr_feval.cc b/gnuradio-core/src/lib/general/gr_feval.cc
new file mode 100644
index 000000000..89f09984c
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_feval.cc
@@ -0,0 +1,132 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <gr_feval.h>
+
+gr_feval_dd::~gr_feval_dd(){}
+
+double
+gr_feval_dd::eval(double x)
+{
+ return 0;
+}
+
+double
+gr_feval_dd::calleval(double x)
+{
+ return eval(x);
+}
+
+// ----------------------------------------------------------------
+
+gr_feval_cc::~gr_feval_cc(){}
+
+gr_complex
+gr_feval_cc::eval(gr_complex x)
+{
+ return 0;
+}
+
+gr_complex
+gr_feval_cc::calleval(gr_complex x)
+{
+ return eval(x);
+}
+
+// ----------------------------------------------------------------
+
+gr_feval_ll::~gr_feval_ll(){}
+
+long
+gr_feval_ll::eval(long x)
+{
+ return 0;
+}
+
+long
+gr_feval_ll::calleval(long x)
+{
+ return eval(x);
+}
+
+// ----------------------------------------------------------------
+
+gr_feval::~gr_feval(){}
+
+void
+gr_feval::eval(void)
+{
+ // nop
+}
+
+void
+gr_feval::calleval(void)
+{
+ eval();
+}
+
+// ----------------------------------------------------------------
+
+gr_feval_p::~gr_feval_p(){}
+
+void
+gr_feval_p::eval(pmt::pmt_t x)
+{
+ // nop
+}
+
+void
+gr_feval_p::calleval(pmt::pmt_t x)
+{
+ eval(x);
+}
+
+/*
+ * Trivial examples showing C++ (transparently) calling Python
+ */
+double
+gr_feval_dd_example(gr_feval_dd *f, double x)
+{
+ return f->calleval(x);
+}
+
+gr_complex
+gr_feval_cc_example(gr_feval_cc *f, gr_complex x)
+{
+ return f->calleval(x);
+}
+
+long
+gr_feval_ll_example(gr_feval_ll *f, long x)
+{
+ return f->calleval(x);
+}
+
+void
+gr_feval_example(gr_feval *f)
+{
+ f->calleval();
+}
diff --git a/gnuradio-core/src/lib/general/gr_feval.h b/gnuradio-core/src/lib/general/gr_feval.h
new file mode 100644
index 000000000..a9bccfe51
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_feval.h
@@ -0,0 +1,177 @@
+/* -*- 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.
+ */
+#ifndef INCLUDED_GR_FEVAL_H
+#define INCLUDED_GR_FEVAL_H
+
+#include <gr_core_api.h>
+#include <gr_complex.h>
+#include <gruel/pmt.h>
+
+/*!
+ * \brief base class for evaluating a function: double -> double
+ * \ingroup misc
+ *
+ * This class is designed to be subclassed in Python or C++
+ * and is callable from both places. It uses SWIG's
+ * "director" feature to implement the magic.
+ * It's slow. Don't use it in a performance critical path.
+ *
+ * Override eval to define the behavior.
+ * Use calleval to invoke eval (this kludge is required to allow a
+ * python specific "shim" to be inserted.
+ */
+class GR_CORE_API gr_feval_dd
+{
+protected:
+ /*!
+ * \brief override this to define the function
+ */
+ virtual double eval(double x);
+
+public:
+ gr_feval_dd() {}
+ virtual ~gr_feval_dd();
+
+ virtual double calleval(double x); // invoke "eval"
+};
+
+/*!
+ * \brief base class for evaluating a function: complex -> complex
+ * \ingroup misc
+ *
+ * This class is designed to be subclassed in Python or C++
+ * and is callable from both places. It uses SWIG's
+ * "director" feature to implement the magic.
+ * It's slow. Don't use it in a performance critical path.
+ *
+ * Override eval to define the behavior.
+ * Use calleval to invoke eval (this kludge is required to allow a
+ * python specific "shim" to be inserted.
+ */
+class GR_CORE_API gr_feval_cc
+{
+protected:
+ /*!
+ * \brief override this to define the function
+ */
+ virtual gr_complex eval(gr_complex x);
+
+public:
+ gr_feval_cc() {}
+ virtual ~gr_feval_cc();
+
+ virtual gr_complex calleval(gr_complex x); // invoke "eval"
+};
+
+/*!
+ * \brief base class for evaluating a function: long -> long
+ * \ingroup misc
+ *
+ * This class is designed to be subclassed in Python or C++
+ * and is callable from both places. It uses SWIG's
+ * "director" feature to implement the magic.
+ * It's slow. Don't use it in a performance critical path.
+ *
+ * Override eval to define the behavior.
+ * Use calleval to invoke eval (this kludge is required to allow a
+ * python specific "shim" to be inserted.
+ */
+class GR_CORE_API gr_feval_ll
+{
+protected:
+ /*!
+ * \brief override this to define the function
+ */
+ virtual long eval(long x);
+
+public:
+ gr_feval_ll() {}
+ virtual ~gr_feval_ll();
+
+ virtual long calleval(long x); // invoke "eval"
+};
+
+/*!
+ * \brief base class for evaluating a function: void -> void
+ * \ingroup misc
+ *
+ * This class is designed to be subclassed in Python or C++
+ * and is callable from both places. It uses SWIG's
+ * "director" feature to implement the magic.
+ * It's slow. Don't use it in a performance critical path.
+ *
+ * Override eval to define the behavior.
+ * Use calleval to invoke eval (this kludge is required to allow a
+ * python specific "shim" to be inserted.
+ */
+class GR_CORE_API gr_feval
+{
+protected:
+ /*!
+ * \brief override this to define the function
+ */
+ virtual void eval();
+
+public:
+ gr_feval() {}
+ virtual ~gr_feval();
+
+ virtual void calleval(); // invoke "eval"
+};
+
+/*!
+ * \brief base class for evaluating a function: pmt -> void
+ * \ingroup misc
+ *
+ * This class is designed to be subclassed in Python or C++
+ * and is callable from both places. It uses SWIG's
+ * "director" feature to implement the magic.
+ * It's slow. Don't use it in a performance critical path.
+ *
+ * Override eval to define the behavior.
+ * Use calleval to invoke eval (this kludge is required to allow a
+ * python specific "shim" to be inserted.
+ */
+class GR_CORE_API gr_feval_p
+{
+protected:
+ /*!
+ * \brief override this to define the function
+ */
+ virtual void eval(pmt::pmt_t x);
+
+public:
+ gr_feval_p() {}
+ virtual ~gr_feval_p();
+
+ virtual void calleval(pmt::pmt_t x); // invoke "eval"
+};
+
+/*!
+ * \brief trivial examples / test cases showing C++ calling Python code
+ */
+GR_CORE_API double gr_feval_dd_example(gr_feval_dd *f, double x);
+GR_CORE_API gr_complex gr_feval_cc_example(gr_feval_cc *f, gr_complex x);
+GR_CORE_API long gr_feval_ll_example(gr_feval_ll *f, long x);
+GR_CORE_API void gr_feval_example(gr_feval *f);
+
+#endif /* INCLUDED_GR_FEVAL_H */
diff --git a/gnuradio-core/src/lib/general/gr_feval.i b/gnuradio-core/src/lib/general/gr_feval.i
new file mode 100644
index 000000000..c8b7e54da
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_feval.i
@@ -0,0 +1,233 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+
+/*
+ * N.B., this is a _very_ non-standard SWIG .i file
+ *
+ * It contains a bunch of magic that is required to ensure that when
+ * these classes are used as base classes for python code,
+ * everything works when calling back from C++ into Python.
+ *
+ * The gist of the problem is that our C++ code is usually not holding
+ * the Python Global Interpreter Lock (GIL). Thus if we invoke a
+ * "director" method from C++, we'll end up in Python not holding the
+ * GIL. Disaster (SIGSEGV) will result. To avoid this we insert a
+ * "shim" that grabs and releases the GIL.
+ *
+ * If you don't understand SWIG "directors" or the Python GIL,
+ * don't bother trying to understand what's going on in here.
+ *
+ * [We could eliminate a bunch of this hair by requiring SWIG 1.3.29
+ * or later and some additional magic declarations, but many systems
+ * aren't shipping that version yet. Thus we kludge...]
+ */
+
+
+// Directors are only supported in Python, Java and C#
+#ifdef SWIGPYTHON
+%import "pmt_swig.i"
+using namespace pmt;
+
+// Enable SWIG directors for these classes
+%feature("director") gr_py_feval_dd;
+%feature("director") gr_py_feval_cc;
+%feature("director") gr_py_feval_ll;
+%feature("director") gr_py_feval;
+%feature("director") gr_py_feval_p;
+
+%feature("nodirector") gr_py_feval_dd::calleval;
+%feature("nodirector") gr_py_feval_cc::calleval;
+%feature("nodirector") gr_py_feval_ll::calleval;
+%feature("nodirector") gr_py_feval::calleval;
+%feature("nodirector") gr_py_feval_p::calleval;
+
+
+%rename(feval_dd) gr_py_feval_dd;
+%rename(feval_cc) gr_py_feval_cc;
+%rename(feval_ll) gr_py_feval_ll;
+%rename(feval) gr_py_feval;
+%rename(feval_p) gr_py_feval_p;
+
+//%exception {
+// try { $action }
+// catch (Swig::DirectorException &e) { std::cerr << e.getMessage(); SWIG_fail; }
+//}
+
+%{
+
+// class that ensures we acquire and release the Python GIL
+
+class ensure_py_gil_state {
+ PyGILState_STATE d_gstate;
+public:
+ ensure_py_gil_state() { d_gstate = PyGILState_Ensure(); }
+ ~ensure_py_gil_state() { PyGILState_Release(d_gstate); }
+};
+
+%}
+
+/*
+ * These are the real C++ base classes, however we don't want these exposed.
+ */
+%ignore gr_feval_dd;
+class gr_feval_dd
+{
+protected:
+ virtual double eval(double x);
+
+public:
+ gr_feval_dd() {}
+ virtual ~gr_feval_dd();
+
+ virtual double calleval(double x);
+};
+
+%ignore gr_feval_cc;
+class gr_feval_cc
+{
+protected:
+ virtual gr_complex eval(gr_complex x);
+
+public:
+ gr_feval_cc() {}
+ virtual ~gr_feval_cc();
+
+ virtual gr_complex calleval(gr_complex x);
+};
+
+%ignore gr_feval_ll;
+class gr_feval_ll
+{
+protected:
+ virtual long eval(long x);
+
+public:
+ gr_feval_ll() {}
+ virtual ~gr_feval_ll();
+
+ virtual long calleval(long x);
+};
+
+%ignore gr_feval;
+class gr_feval
+{
+protected:
+ virtual void eval();
+
+public:
+ gr_feval() {}
+ virtual ~gr_feval();
+
+ virtual void calleval();
+};
+
+%ignore gr_feval_p;
+class gr_feval_p
+{
+protected:
+ virtual void eval(pmt_t x);
+
+public:
+ gr_feval_p() {}
+ virtual ~gr_feval_p();
+
+ virtual void calleval(pmt_t x);
+};
+
+/*
+ * These are the ones to derive from in Python. They have the magic shim
+ * that ensures that we're holding the Python GIL when we enter Python land...
+ */
+
+%inline %{
+#include <gruel/pmt.h>
+
+class gr_py_feval_dd : public gr_feval_dd
+{
+ public:
+ double calleval(double x)
+ {
+ ensure_py_gil_state _lock;
+ return eval(x);
+ }
+};
+
+class gr_py_feval_cc : public gr_feval_cc
+{
+ public:
+ gr_complex calleval(gr_complex x)
+ {
+ ensure_py_gil_state _lock;
+ return eval(x);
+ }
+};
+
+class gr_py_feval_ll : public gr_feval_ll
+{
+ public:
+ long calleval(long x)
+ {
+ ensure_py_gil_state _lock;
+ return eval(x);
+ }
+};
+
+class gr_py_feval : public gr_feval
+{
+ public:
+ void calleval()
+ {
+ ensure_py_gil_state _lock;
+ eval();
+ }
+};
+
+class gr_py_feval_p : public gr_feval_p
+{
+ public:
+ void calleval(pmt::pmt_t x)
+ {
+ ensure_py_gil_state _lock;
+ eval(x);
+ }
+};
+
+%}
+
+
+
+// examples / test cases
+
+%rename(feval_dd_example) gr_feval_dd_example;
+double gr_feval_dd_example(gr_feval_dd *f, double x);
+
+%rename(feval_cc_example) gr_feval_cc_example;
+gr_complex gr_feval_cc_example(gr_feval_cc *f, gr_complex x);
+
+%rename(feval_ll_example) gr_feval_ll_example;
+long gr_feval_ll_example(gr_feval_ll *f, long x);
+
+%rename(feval_example) gr_feval_example;
+void gr_feval_example(gr_feval *f);
+
+#endif // SWIGPYTHON
diff --git a/gnuradio-core/src/lib/general/gr_fft_vcc.cc b/gnuradio-core/src/lib/general/gr_fft_vcc.cc
new file mode 100644
index 000000000..addcddb64
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_fft_vcc.cc
@@ -0,0 +1,80 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2007,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_fft_vcc.h> // abstract class
+#include <gr_fft_vcc_fftw.h> // concrete class
+#include <gr_io_signature.h>
+#include <gri_fft.h>
+#include <math.h>
+#include <string.h>
+
+gr_fft_vcc_sptr
+gr_make_fft_vcc (int fft_size, bool forward,
+ const std::vector<float> &window,
+ bool shift, int nthreads)
+{
+ return gr_make_fft_vcc_fftw(fft_size, forward,
+ window, shift, nthreads);
+}
+
+gr_fft_vcc::gr_fft_vcc (const std::string &name,
+ int fft_size, bool forward, const std::vector<float> &window,
+ bool shift)
+ : gr_sync_block (name,
+ gr_make_io_signature (1, 1, fft_size * sizeof (gr_complex)),
+ gr_make_io_signature (1, 1, fft_size * sizeof (gr_complex))),
+ d_fft_size(fft_size), d_forward(forward), d_shift(shift)
+{
+ set_window(window);
+}
+
+gr_fft_vcc::~gr_fft_vcc ()
+{
+}
+
+bool
+gr_fft_vcc::set_window(const std::vector<float> &window)
+{
+ if(window.size()==0 || window.size()==d_fft_size) {
+ d_window=window;
+ return true;
+ }
+ else
+ return false;
+}
+
+void
+gr_fft_vcc::set_nthreads(int n)
+{
+ throw std::runtime_error("gr_fft_vcc::set_nthreads not implemented.");
+}
+
+int
+gr_fft_vcc::nthreads() const
+{
+ throw std::runtime_error("gr_fft_vcc::nthreads not implemented.");
+ return 0;
+}
diff --git a/gnuradio-core/src/lib/general/gr_fft_vcc.h b/gnuradio-core/src/lib/general/gr_fft_vcc.h
new file mode 100644
index 000000000..db5690d41
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_fft_vcc.h
@@ -0,0 +1,68 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2007,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.
+ */
+
+#ifndef INCLUDED_GR_FFT_VCC_H
+#define INCLUDED_GR_FFT_VCC_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+
+class gr_fft_vcc;
+typedef boost::shared_ptr<gr_fft_vcc> gr_fft_vcc_sptr;
+
+GR_CORE_API gr_fft_vcc_sptr
+gr_make_fft_vcc (int fft_size, bool forward,
+ const std::vector<float> &window,
+ bool shift=false, int nthreads=1);
+
+/*!
+ * \brief Compute forward or reverse FFT. complex vector in / complex vector out.
+ * \ingroup dft_blk
+ *
+ * Abstract base class
+ */
+class GR_CORE_API gr_fft_vcc : public gr_sync_block
+{
+protected:
+ friend GR_CORE_API gr_fft_vcc_sptr
+ gr_make_fft_vcc (int fft_size, bool forward,
+ const std::vector<float> &window,
+ bool shift);
+
+ unsigned int d_fft_size;
+ std::vector<float> d_window;
+ bool d_forward;
+ bool d_shift;
+
+ gr_fft_vcc (const std::string &name, int fft_size, bool forward,
+ const std::vector<float> &window, bool shift);
+
+ public:
+ ~gr_fft_vcc ();
+
+ virtual void set_nthreads(int n);
+ virtual int nthreads() const;
+
+ bool set_window(const std::vector<float> &window);
+};
+
+#endif /* INCLUDED_GR_FFT_VCC_H */
diff --git a/gnuradio-core/src/lib/general/gr_fft_vcc.i b/gnuradio-core/src/lib/general/gr_fft_vcc.i
new file mode 100644
index 000000000..f9caae7d8
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_fft_vcc.i
@@ -0,0 +1,41 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2007,2008,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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr, fft_vcc)
+
+gr_fft_vcc_sptr
+gr_make_fft_vcc (int fft_size, bool forward,
+ const std::vector<float> &window,
+ bool shift=false, int nthreads=1);
+
+class gr_fft_vcc : public gr_sync_block
+{
+ protected:
+ gr_fft_vcc (int fft_size, bool forward,
+ const std::vector<float> &window,
+ bool shift);
+
+ public:
+ bool set_window(const std::vector<float> &window);
+ void set_nthreads(int n);
+ int nthreads() const;
+};
diff --git a/gnuradio-core/src/lib/general/gr_fft_vcc_fftw.cc b/gnuradio-core/src/lib/general/gr_fft_vcc_fftw.cc
new file mode 100644
index 000000000..891173bcd
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_fft_vcc_fftw.cc
@@ -0,0 +1,130 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2007,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_fft_vcc_fftw.h>
+#include <gr_io_signature.h>
+#include <gri_fft.h>
+#include <math.h>
+#include <string.h>
+
+gr_fft_vcc_sptr
+gr_make_fft_vcc_fftw (int fft_size, bool forward,
+ const std::vector<float> &window,
+ bool shift, int nthreads)
+{
+ return gnuradio::get_initial_sptr(new gr_fft_vcc_fftw
+ (fft_size, forward, window,
+ shift, nthreads));
+}
+
+gr_fft_vcc_fftw::gr_fft_vcc_fftw (int fft_size, bool forward,
+ const std::vector<float> &window,
+ bool shift, int nthreads)
+ : gr_fft_vcc("fft_vcc_fftw", fft_size, forward, window, shift)
+{
+ d_fft = new gri_fft_complex (d_fft_size, forward, nthreads);
+}
+
+gr_fft_vcc_fftw::~gr_fft_vcc_fftw ()
+{
+ delete d_fft;
+}
+
+void
+gr_fft_vcc_fftw::set_nthreads(int n)
+{
+ d_fft->set_nthreads(n);
+}
+
+int
+gr_fft_vcc_fftw::nthreads() const
+{
+ return d_fft->nthreads();
+}
+
+int
+gr_fft_vcc_fftw::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const gr_complex *in = (const gr_complex *) input_items[0];
+ gr_complex *out = (gr_complex *) output_items[0];
+
+ unsigned int input_data_size = input_signature()->sizeof_stream_item (0);
+ unsigned int output_data_size = output_signature()->sizeof_stream_item (0);
+
+ int count = 0;
+
+ while (count++ < noutput_items){
+
+ // copy input into optimally aligned buffer
+
+ if (d_window.size()){
+ gr_complex *dst = d_fft->get_inbuf();
+ if(!d_forward && d_shift){
+ unsigned int offset = (!d_forward && d_shift)?(d_fft_size/2):0;
+ int fft_m_offset = d_fft_size - offset;
+ for (unsigned int i = 0; i < offset; i++) // apply window
+ dst[i+fft_m_offset] = in[i] * d_window[i];
+ for (unsigned int i = offset; i < d_fft_size; i++) // apply window
+ dst[i-offset] = in[i] * d_window[i];
+ } else {
+ for (unsigned int i = 0; i < d_fft_size; i++) // apply window
+ dst[i] = in[i] * d_window[i];
+ }
+ }
+ else {
+ if(!d_forward && d_shift) { // apply an ifft shift on the data
+ gr_complex *dst = d_fft->get_inbuf();
+ unsigned int len = (unsigned int)(floor(d_fft_size/2.0)); // half length of complex array
+ memcpy(&dst[0], &in[len], sizeof(gr_complex)*(d_fft_size - len));
+ memcpy(&dst[d_fft_size - len], &in[0], sizeof(gr_complex)*len);
+ }
+ else {
+ memcpy (d_fft->get_inbuf(), in, input_data_size);
+ }
+ }
+
+ // compute the fft
+ d_fft->execute ();
+
+ // copy result to our output
+ if(d_forward && d_shift) { // apply a fft shift on the data
+ unsigned int len = (unsigned int)(ceil(d_fft_size/2.0));
+ memcpy(&out[0], &d_fft->get_outbuf()[len], sizeof(gr_complex)*(d_fft_size - len));
+ memcpy(&out[d_fft_size - len], &d_fft->get_outbuf()[0], sizeof(gr_complex)*len);
+ }
+ else {
+ memcpy (out, d_fft->get_outbuf (), output_data_size);
+ }
+
+ in += d_fft_size;
+ out += d_fft_size;
+ }
+
+ return noutput_items;
+}
+
diff --git a/gnuradio-core/src/lib/general/gr_fft_vcc_fftw.h b/gnuradio-core/src/lib/general/gr_fft_vcc_fftw.h
new file mode 100644
index 000000000..967ceaefb
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_fft_vcc_fftw.h
@@ -0,0 +1,67 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2007,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.
+ */
+
+#ifndef INCLUDED_GR_FFT_VCC_FFTW_H
+#define INCLUDED_GR_FFT_VCC_FFTW_H
+
+#include <gr_core_api.h>
+#include <gr_fft_vcc.h>
+
+class gri_fft_complex;
+
+GR_CORE_API gr_fft_vcc_sptr
+gr_make_fft_vcc_fftw (int fft_size, bool forward,
+ const std::vector<float> &window,
+ bool shift=false, int nthreads=1);
+
+/*!
+ * \brief Compute forward or reverse FFT. complex vector in / complex vector out.
+ * \ingroup dft_blk
+ *
+ * Concrete class that uses FFTW.
+ */
+class GR_CORE_API gr_fft_vcc_fftw : public gr_fft_vcc
+{
+ friend GR_CORE_API gr_fft_vcc_sptr
+ gr_make_fft_vcc_fftw (int fft_size, bool forward,
+ const std::vector<float> &window,
+ bool shift, int nthreads);
+
+ gri_fft_complex *d_fft;
+
+ gr_fft_vcc_fftw (int fft_size, bool forward,
+ const std::vector<float> &window,
+ bool shift, int nthreads=1);
+
+ public:
+ ~gr_fft_vcc_fftw ();
+
+ void set_nthreads(int n);
+ int nthreads() const;
+
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+
+#endif /* INCLUDED_GR_FFT_VCC_FFTW_H */
diff --git a/gnuradio-core/src/lib/general/gr_fft_vfc.cc b/gnuradio-core/src/lib/general/gr_fft_vfc.cc
new file mode 100644
index 000000000..2396055b9
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_fft_vfc.cc
@@ -0,0 +1,135 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,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 <gr_fft_vfc.h>
+#include <gr_io_signature.h>
+#include <gri_fft.h>
+#include <math.h>
+#include <stdexcept>
+#include <string.h>
+#include <cstdio>
+
+
+// FIXME after this is working, change to use native real to complex fft.
+// It should run twice as fast.
+
+
+
+
+gr_fft_vfc_sptr
+gr_make_fft_vfc (int fft_size, bool forward,
+ const std::vector<float> &window,
+ int nthreads)
+{
+ return gnuradio::get_initial_sptr(new gr_fft_vfc (fft_size, forward,
+ window, nthreads));
+}
+
+gr_fft_vfc::gr_fft_vfc (int fft_size, bool forward,
+ const std::vector<float> &window,
+ int nthreads)
+ : gr_sync_block ("fft_vfc",
+ gr_make_io_signature (1, 1, fft_size * sizeof (float)),
+ gr_make_io_signature (1, 1, fft_size * sizeof (gr_complex))),
+ d_fft_size(fft_size), d_window()
+{
+ if (!forward){
+ fprintf (stderr, "fft_vfc: forward must == true\n");
+ throw std::invalid_argument ("fft_vfc: forward must == true");
+ }
+
+ d_fft = new gri_fft_complex (d_fft_size, forward, nthreads);
+
+ set_window(window);
+}
+
+gr_fft_vfc::~gr_fft_vfc ()
+{
+ delete d_fft;
+}
+
+void
+gr_fft_vfc::set_nthreads(int n)
+{
+ d_fft->set_nthreads(n);
+}
+
+int
+gr_fft_vfc::nthreads() const
+{
+ return d_fft->nthreads();
+}
+
+int
+gr_fft_vfc::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const float *in = (const float *) input_items[0];
+ gr_complex *out = (gr_complex *) output_items[0];
+
+ unsigned int output_data_size = output_signature()->sizeof_stream_item (0);
+
+ int count = 0;
+
+ while (count++ < noutput_items){
+
+ // copy input into optimally aligned buffer
+
+ if (d_window.size()){
+ gr_complex *dst = d_fft->get_inbuf();
+ for (unsigned int i = 0; i < d_fft_size; i++) // apply window
+ dst[i] = in[i] * d_window[i];
+ }
+ else {
+ gr_complex *dst = d_fft->get_inbuf();
+ for (unsigned int i = 0; i < d_fft_size; i++) // float to complex conversion
+ dst[i] = in[i];
+ }
+
+ // compute the fft
+ d_fft->execute ();
+
+ // cpoy result to our output
+ memcpy (out, d_fft->get_outbuf (), output_data_size);
+
+ in += d_fft_size;
+ out += d_fft_size;
+ }
+
+ return noutput_items;
+}
+
+bool
+gr_fft_vfc::set_window(const std::vector<float> &window)
+{
+ if(window.size()==0 || window.size()==d_fft_size) {
+ d_window=window;
+ return true;
+ }
+ else
+ return false;
+}
diff --git a/gnuradio-core/src/lib/general/gr_fft_vfc.h b/gnuradio-core/src/lib/general/gr_fft_vfc.h
new file mode 100644
index 000000000..35b95313d
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_fft_vfc.h
@@ -0,0 +1,72 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,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.
+ */
+
+#ifndef INCLUDED_GR_FFT_VFC_H
+#define INCLUDED_GR_FFT_VFC_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+
+class gri_fft_complex;
+
+class gr_fft_vfc;
+typedef boost::shared_ptr<gr_fft_vfc> gr_fft_vfc_sptr;
+
+GR_CORE_API gr_fft_vfc_sptr
+gr_make_fft_vfc (int fft_size, bool forward,
+ const std::vector<float> &window,
+ int nthreads=1);
+
+/*!
+ * \brief Compute forward FFT. float vector in / complex vector out.
+ * \ingroup dft_blk
+ */
+
+class GR_CORE_API gr_fft_vfc : public gr_sync_block
+{
+ friend GR_CORE_API gr_fft_vfc_sptr
+ gr_make_fft_vfc (int fft_size, bool forward,
+ const std::vector<float> &window,
+ int nthreads);
+
+ unsigned int d_fft_size;
+ std::vector<float> d_window;
+ gri_fft_complex *d_fft;
+
+ gr_fft_vfc (int fft_size, bool forward,
+ const std::vector<float> &window,
+ int nthreads=1);
+
+ public:
+ ~gr_fft_vfc ();
+
+ void set_nthreads(int n);
+ int nthreads() const;
+
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ bool set_window(const std::vector<float> &window);
+};
+
+
+#endif /* INCLUDED_GR_FFT_VFC_H */
diff --git a/gnuradio-core/src/lib/general/gr_fft_vfc.i b/gnuradio-core/src/lib/general/gr_fft_vfc.i
new file mode 100644
index 000000000..d387ae155
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_fft_vfc.i
@@ -0,0 +1,42 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr, fft_vfc)
+
+gr_fft_vfc_sptr
+gr_make_fft_vfc (int fft_size, bool forward,
+ const std::vector<float> &window,
+ int nthreads=1)
+throw(std::exception);
+
+class gr_fft_vfc : public gr_sync_block
+{
+ protected:
+ gr_fft_vfc (int fft_size, bool forward,
+ const std::vector<float> &window,
+ int nthreads=1);
+
+ public:
+ bool set_window(const std::vector<float> &window);
+ void set_nthreads(int n);
+ int nthreads() const;
+};
diff --git a/gnuradio-core/src/lib/general/gr_firdes.cc b/gnuradio-core/src/lib/general/gr_firdes.cc
new file mode 100644
index 000000000..4c7237141
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_firdes.cc
@@ -0,0 +1,840 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002,2007,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <gr_firdes.h>
+#include <stdexcept>
+
+
+using std::vector;
+
+#define IzeroEPSILON 1E-21 /* Max error acceptable in Izero */
+
+static double Izero(double x)
+{
+ double sum, u, halfx, temp;
+ int n;
+
+ sum = u = n = 1;
+ halfx = x/2.0;
+ do {
+ temp = halfx/(double)n;
+ n += 1;
+ temp *= temp;
+ u *= temp;
+ sum += u;
+ } while (u >= IzeroEPSILON*sum);
+ return(sum);
+}
+
+
+//
+// === Low Pass ===
+//
+
+vector<float>
+gr_firdes::low_pass_2(double gain,
+ double sampling_freq, // Hz
+ double cutoff_freq, // Hz BEGINNING of transition band
+ double transition_width, // Hz width of transition band
+ double attenuation_dB, // attenuation dB
+ win_type window_type,
+ double beta) // used only with Kaiser
+{
+ sanity_check_1f (sampling_freq, cutoff_freq, transition_width);
+
+ int ntaps = compute_ntaps_windes (sampling_freq, transition_width,
+ attenuation_dB);
+
+ // construct the truncated ideal impulse response
+ // [sin(x)/x for the low pass case]
+
+ vector<float> taps(ntaps);
+ vector<float> w = window (window_type, ntaps, beta);
+
+ int M = (ntaps - 1) / 2;
+ double fwT0 = 2 * M_PI * cutoff_freq / sampling_freq;
+ for (int n = -M; n <= M; n++){
+ if (n == 0)
+ taps[n + M] = fwT0 / M_PI * w[n + M];
+ else {
+ // a little algebra gets this into the more familiar sin(x)/x form
+ taps[n + M] = sin (n * fwT0) / (n * M_PI) * w[n + M];
+ }
+ }
+
+ // find the factor to normalize the gain, fmax.
+ // For low-pass, gain @ zero freq = 1.0
+
+ double fmax = taps[0 + M];
+ for (int n = 1; n <= M; n++)
+ fmax += 2 * taps[n + M];
+
+ gain /= fmax; // normalize
+
+ for (int i = 0; i < ntaps; i++)
+ taps[i] *= gain;
+
+
+ return taps;
+}
+
+vector<float>
+gr_firdes::low_pass (double gain,
+ double sampling_freq,
+ double cutoff_freq, // Hz center of transition band
+ double transition_width, // Hz width of transition band
+ win_type window_type,
+ double beta) // used only with Kaiser
+{
+ sanity_check_1f (sampling_freq, cutoff_freq, transition_width);
+
+ int ntaps = compute_ntaps (sampling_freq, transition_width,
+ window_type, beta);
+
+ // construct the truncated ideal impulse response
+ // [sin(x)/x for the low pass case]
+
+ vector<float> taps(ntaps);
+ vector<float> w = window (window_type, ntaps, beta);
+
+ int M = (ntaps - 1) / 2;
+ double fwT0 = 2 * M_PI * cutoff_freq / sampling_freq;
+
+ for (int n = -M; n <= M; n++){
+ if (n == 0)
+ taps[n + M] = fwT0 / M_PI * w[n + M];
+ else {
+ // a little algebra gets this into the more familiar sin(x)/x form
+ taps[n + M] = sin (n * fwT0) / (n * M_PI) * w[n + M];
+ }
+ }
+
+ // find the factor to normalize the gain, fmax.
+ // For low-pass, gain @ zero freq = 1.0
+
+ double fmax = taps[0 + M];
+ for (int n = 1; n <= M; n++)
+ fmax += 2 * taps[n + M];
+
+ gain /= fmax; // normalize
+
+ for (int i = 0; i < ntaps; i++)
+ taps[i] *= gain;
+
+ return taps;
+}
+
+
+//
+// === High Pass ===
+//
+
+vector<float>
+gr_firdes::high_pass_2 (double gain,
+ double sampling_freq,
+ double cutoff_freq, // Hz center of transition band
+ double transition_width, // Hz width of transition band
+ double attenuation_dB, // attenuation dB
+ win_type window_type,
+ double beta) // used only with Kaiser
+{
+ sanity_check_1f (sampling_freq, cutoff_freq, transition_width);
+
+ int ntaps = compute_ntaps_windes (sampling_freq, transition_width,
+ attenuation_dB);
+
+ // construct the truncated ideal impulse response times the window function
+
+ vector<float> taps(ntaps);
+ vector<float> w = window (window_type, ntaps, beta);
+
+ int M = (ntaps - 1) / 2;
+ double fwT0 = 2 * M_PI * cutoff_freq / sampling_freq;
+
+ for (int n = -M; n <= M; n++){
+ if (n == 0)
+ taps[n + M] = (1 - (fwT0 / M_PI)) * w[n + M];
+ else {
+ // a little algebra gets this into the more familiar sin(x)/x form
+ taps[n + M] = -sin (n * fwT0) / (n * M_PI) * w[n + M];
+ }
+ }
+
+ // find the factor to normalize the gain, fmax.
+ // For high-pass, gain @ fs/2 freq = 1.0
+
+ double fmax = taps[0 + M];
+ for (int n = 1; n <= M; n++)
+ fmax += 2 * taps[n + M] * cos (n * M_PI);
+
+ gain /= fmax; // normalize
+
+ for (int i = 0; i < ntaps; i++)
+ taps[i] *= gain;
+
+
+ return taps;
+}
+
+
+vector<float>
+gr_firdes::high_pass (double gain,
+ double sampling_freq,
+ double cutoff_freq, // Hz center of transition band
+ double transition_width, // Hz width of transition band
+ win_type window_type,
+ double beta) // used only with Kaiser
+{
+ sanity_check_1f (sampling_freq, cutoff_freq, transition_width);
+
+ int ntaps = compute_ntaps (sampling_freq, transition_width,
+ window_type, beta);
+
+ // construct the truncated ideal impulse response times the window function
+
+ vector<float> taps(ntaps);
+ vector<float> w = window (window_type, ntaps, beta);
+
+ int M = (ntaps - 1) / 2;
+ double fwT0 = 2 * M_PI * cutoff_freq / sampling_freq;
+
+ for (int n = -M; n <= M; n++){
+ if (n == 0)
+ taps[n + M] = (1 - (fwT0 / M_PI)) * w[n + M];
+ else {
+ // a little algebra gets this into the more familiar sin(x)/x form
+ taps[n + M] = -sin (n * fwT0) / (n * M_PI) * w[n + M];
+ }
+ }
+
+ // find the factor to normalize the gain, fmax.
+ // For high-pass, gain @ fs/2 freq = 1.0
+
+ double fmax = taps[0 + M];
+ for (int n = 1; n <= M; n++)
+ fmax += 2 * taps[n + M] * cos (n * M_PI);
+
+ gain /= fmax; // normalize
+
+ for (int i = 0; i < ntaps; i++)
+ taps[i] *= gain;
+
+ return taps;
+}
+
+//
+// === Band Pass ===
+//
+
+vector<float>
+gr_firdes::band_pass_2 (double gain,
+ double sampling_freq,
+ double low_cutoff_freq, // Hz center of transition band
+ double high_cutoff_freq, // Hz center of transition band
+ double transition_width, // Hz width of transition band
+ double attenuation_dB, // attenuation dB
+ win_type window_type,
+ double beta) // used only with Kaiser
+{
+ sanity_check_2f (sampling_freq,
+ low_cutoff_freq,
+ high_cutoff_freq, transition_width);
+
+ int ntaps = compute_ntaps_windes (sampling_freq, transition_width,
+ attenuation_dB);
+
+ vector<float> taps(ntaps);
+ vector<float> w = window (window_type, ntaps, beta);
+
+ int M = (ntaps - 1) / 2;
+ double fwT0 = 2 * M_PI * low_cutoff_freq / sampling_freq;
+ double fwT1 = 2 * M_PI * high_cutoff_freq / sampling_freq;
+
+ for (int n = -M; n <= M; n++){
+ if (n == 0)
+ taps[n + M] = (fwT1 - fwT0) / M_PI * w[n + M];
+ else {
+ taps[n + M] = (sin (n * fwT1) - sin (n * fwT0)) / (n * M_PI) * w[n + M];
+ }
+ }
+
+ // find the factor to normalize the gain, fmax.
+ // For band-pass, gain @ center freq = 1.0
+
+ double fmax = taps[0 + M];
+ for (int n = 1; n <= M; n++)
+ fmax += 2 * taps[n + M] * cos (n * (fwT0 + fwT1) * 0.5);
+
+ gain /= fmax; // normalize
+
+ for (int i = 0; i < ntaps; i++)
+ taps[i] *= gain;
+
+ return taps;
+}
+
+
+vector<float>
+gr_firdes::band_pass (double gain,
+ double sampling_freq,
+ double low_cutoff_freq, // Hz center of transition band
+ double high_cutoff_freq, // Hz center of transition band
+ double transition_width, // Hz width of transition band
+ win_type window_type,
+ double beta) // used only with Kaiser
+{
+ sanity_check_2f (sampling_freq,
+ low_cutoff_freq,
+ high_cutoff_freq, transition_width);
+
+ int ntaps = compute_ntaps (sampling_freq, transition_width,
+ window_type, beta);
+
+ // construct the truncated ideal impulse response times the window function
+
+ vector<float> taps(ntaps);
+ vector<float> w = window (window_type, ntaps, beta);
+
+ int M = (ntaps - 1) / 2;
+ double fwT0 = 2 * M_PI * low_cutoff_freq / sampling_freq;
+ double fwT1 = 2 * M_PI * high_cutoff_freq / sampling_freq;
+
+ for (int n = -M; n <= M; n++){
+ if (n == 0)
+ taps[n + M] = (fwT1 - fwT0) / M_PI * w[n + M];
+ else {
+ taps[n + M] = (sin (n * fwT1) - sin (n * fwT0)) / (n * M_PI) * w[n + M];
+ }
+ }
+
+ // find the factor to normalize the gain, fmax.
+ // For band-pass, gain @ center freq = 1.0
+
+ double fmax = taps[0 + M];
+ for (int n = 1; n <= M; n++)
+ fmax += 2 * taps[n + M] * cos (n * (fwT0 + fwT1) * 0.5);
+
+ gain /= fmax; // normalize
+
+ for (int i = 0; i < ntaps; i++)
+ taps[i] *= gain;
+
+ return taps;
+}
+
+//
+// === Complex Band Pass ===
+//
+
+vector<gr_complex>
+gr_firdes::complex_band_pass_2 (double gain,
+ double sampling_freq,
+ double low_cutoff_freq, // Hz center of transition band
+ double high_cutoff_freq, // Hz center of transition band
+ double transition_width, // Hz width of transition band
+ double attenuation_dB, // attenuation dB
+ win_type window_type,
+ double beta) // used only with Kaiser
+{
+ sanity_check_2f_c (sampling_freq,
+ low_cutoff_freq,
+ high_cutoff_freq, transition_width);
+
+ int ntaps = compute_ntaps_windes (sampling_freq, transition_width,
+ attenuation_dB);
+
+
+
+ vector<gr_complex> taps(ntaps);
+ vector<float> lptaps(ntaps);
+ vector<float> w = window (window_type, ntaps, beta);
+
+ lptaps = low_pass_2(gain,sampling_freq,(high_cutoff_freq - low_cutoff_freq)/2,transition_width,attenuation_dB,window_type,beta);
+
+ gr_complex *optr = &taps[0];
+ float *iptr = &lptaps[0];
+ float freq = M_PI * (high_cutoff_freq + low_cutoff_freq)/sampling_freq;
+ float phase=0;
+ if (lptaps.size() & 01) {
+ phase = - freq * ( lptaps.size() >> 1 );
+ } else phase = - freq/2.0 * ((1 + 2*lptaps.size()) >> 1);
+ for(unsigned int i=0;i<lptaps.size();i++) {
+ *optr++ = gr_complex(*iptr * cos(phase),*iptr * sin(phase));
+ iptr++, phase += freq;
+ }
+
+ return taps;
+}
+
+
+vector<gr_complex>
+gr_firdes::complex_band_pass (double gain,
+ double sampling_freq,
+ double low_cutoff_freq, // Hz center of transition band
+ double high_cutoff_freq, // Hz center of transition band
+ double transition_width, // Hz width of transition band
+ win_type window_type,
+ double beta) // used only with Kaiser
+{
+ sanity_check_2f_c (sampling_freq,
+ low_cutoff_freq,
+ high_cutoff_freq, transition_width);
+
+ int ntaps = compute_ntaps (sampling_freq, transition_width,
+ window_type, beta);
+
+ // construct the truncated ideal impulse response times the window function
+
+ vector<gr_complex> taps(ntaps);
+ vector<float> lptaps(ntaps);
+ vector<float> w = window (window_type, ntaps, beta);
+
+ lptaps = low_pass(gain,sampling_freq,(high_cutoff_freq - low_cutoff_freq)/2,transition_width,window_type,beta);
+
+ gr_complex *optr = &taps[0];
+ float *iptr = &lptaps[0];
+ float freq = M_PI * (high_cutoff_freq + low_cutoff_freq)/sampling_freq;
+ float phase=0;
+ if (lptaps.size() & 01) {
+ phase = - freq * ( lptaps.size() >> 1 );
+ } else phase = - freq/2.0 * ((1 + 2*lptaps.size()) >> 1);
+ for(unsigned int i=0;i<lptaps.size();i++) {
+ *optr++ = gr_complex(*iptr * cos(phase),*iptr * sin(phase));
+ iptr++, phase += freq;
+ }
+
+ return taps;
+}
+
+//
+// === Band Reject ===
+//
+
+vector<float>
+gr_firdes::band_reject_2 (double gain,
+ double sampling_freq,
+ double low_cutoff_freq, // Hz center of transition band
+ double high_cutoff_freq, // Hz center of transition band
+ double transition_width, // Hz width of transition band
+ double attenuation_dB, // attenuation dB
+ win_type window_type,
+ double beta) // used only with Kaiser
+{
+ sanity_check_2f (sampling_freq,
+ low_cutoff_freq,
+ high_cutoff_freq, transition_width);
+
+ int ntaps = compute_ntaps_windes (sampling_freq, transition_width,
+ attenuation_dB);
+
+ // construct the truncated ideal impulse response times the window function
+
+ vector<float> taps(ntaps);
+ vector<float> w = window (window_type, ntaps, beta);
+
+ int M = (ntaps - 1) / 2;
+ double fwT0 = 2 * M_PI * low_cutoff_freq / sampling_freq;
+ double fwT1 = 2 * M_PI * high_cutoff_freq / sampling_freq;
+
+ for (int n = -M; n <= M; n++){
+ if (n == 0)
+ taps[n + M] = 1.0 + ((fwT0 - fwT1) / M_PI * w[n + M]);
+ else {
+ taps[n + M] = (sin (n * fwT0) - sin (n * fwT1)) / (n * M_PI) * w[n + M];
+ }
+ }
+
+ // find the factor to normalize the gain, fmax.
+ // For band-reject, gain @ zero freq = 1.0
+
+ double fmax = taps[0 + M];
+ for (int n = 1; n <= M; n++)
+ fmax += 2 * taps[n + M];
+
+ gain /= fmax; // normalize
+
+ for (int i = 0; i < ntaps; i++)
+ taps[i] *= gain;
+
+ return taps;
+}
+
+vector<float>
+gr_firdes::band_reject (double gain,
+ double sampling_freq,
+ double low_cutoff_freq, // Hz center of transition band
+ double high_cutoff_freq, // Hz center of transition band
+ double transition_width, // Hz width of transition band
+ win_type window_type,
+ double beta) // used only with Kaiser
+{
+ sanity_check_2f (sampling_freq,
+ low_cutoff_freq,
+ high_cutoff_freq, transition_width);
+
+ int ntaps = compute_ntaps (sampling_freq, transition_width,
+ window_type, beta);
+
+ // construct the truncated ideal impulse response times the window function
+
+ vector<float> taps(ntaps);
+ vector<float> w = window (window_type, ntaps, beta);
+
+ int M = (ntaps - 1) / 2;
+ double fwT0 = 2 * M_PI * low_cutoff_freq / sampling_freq;
+ double fwT1 = 2 * M_PI * high_cutoff_freq / sampling_freq;
+
+ for (int n = -M; n <= M; n++){
+ if (n == 0)
+ taps[n + M] = 1.0 + ((fwT0 - fwT1) / M_PI * w[n + M]);
+ else {
+ taps[n + M] = (sin (n * fwT0) - sin (n * fwT1)) / (n * M_PI) * w[n + M];
+ }
+ }
+
+ // find the factor to normalize the gain, fmax.
+ // For band-reject, gain @ zero freq = 1.0
+
+ double fmax = taps[0 + M];
+ for (int n = 1; n <= M; n++)
+ fmax += 2 * taps[n + M];
+
+ gain /= fmax; // normalize
+
+ for (int i = 0; i < ntaps; i++)
+ taps[i] *= gain;
+
+ return taps;
+}
+
+//
+// Hilbert Transform
+//
+
+vector<float>
+gr_firdes::hilbert (unsigned int ntaps,
+ win_type windowtype,
+ double beta)
+{
+ if(!(ntaps & 1))
+ throw std::out_of_range("Hilbert: Must have odd number of taps");
+
+ vector<float> taps(ntaps);
+ vector<float> w = window (windowtype, ntaps, beta);
+ unsigned int h = (ntaps-1)/2;
+ float gain=0;
+ for (unsigned int i = 1; i <= h; i++)
+ {
+ if(i&1)
+ {
+ float x = 1/(float)i;
+ taps[h+i] = x * w[h+i];
+ taps[h-i] = -x * w[h-i];
+ gain = taps[h+i] - gain;
+ }
+ else
+ taps[h+i] = taps[h-i] = 0;
+ }
+ gain = 2 * fabs(gain);
+ for ( unsigned int i = 0; i < ntaps; i++)
+ taps[i] /= gain;
+ return taps;
+}
+
+//
+// Gaussian
+//
+
+vector<float>
+gr_firdes::gaussian (double gain,
+ double spb,
+ double bt,
+ int ntaps)
+{
+
+ vector<float> taps(ntaps);
+ double scale = 0;
+ double dt = 1.0/spb;
+ double s = 1.0/(sqrt(log(2.0)) / (2*M_PI*bt));
+ double t0 = -0.5 * ntaps;
+ double ts;
+ for(int i=0;i<ntaps;i++)
+ {
+ t0++;
+ ts = s*dt*t0;
+ taps[i] = exp(-0.5*ts*ts);
+ scale += taps[i];
+ }
+ for(int i=0;i<ntaps;i++)
+ taps[i] = taps[i] / scale * gain;
+ return taps;
+}
+
+
+//
+// Root Raised Cosine
+//
+
+vector<float>
+gr_firdes::root_raised_cosine (double gain,
+ double sampling_freq,
+ double symbol_rate,
+ double alpha,
+ int ntaps)
+{
+ ntaps |= 1; // ensure that ntaps is odd
+
+ double spb = sampling_freq/symbol_rate; // samples per bit/symbol
+ vector<float> taps(ntaps);
+ double scale = 0;
+ for(int i=0;i<ntaps;i++)
+ {
+ double x1,x2,x3,num,den;
+ double xindx = i - ntaps/2;
+ x1 = M_PI * xindx/spb;
+ x2 = 4 * alpha * xindx / spb;
+ x3 = x2*x2 - 1;
+ if( fabs(x3) >= 0.000001 ) // Avoid Rounding errors...
+ {
+ if( i != ntaps/2 )
+ num = cos((1+alpha)*x1) + sin((1-alpha)*x1)/(4*alpha*xindx/spb);
+ else
+ num = cos((1+alpha)*x1) + (1-alpha) * M_PI / (4*alpha);
+ den = x3 * M_PI;
+ }
+ else
+ {
+ if(alpha==1)
+ {
+ taps[i] = -1;
+ continue;
+ }
+ x3 = (1-alpha)*x1;
+ x2 = (1+alpha)*x1;
+ num = (sin(x2)*(1+alpha)*M_PI
+ - cos(x3)*((1-alpha)*M_PI*spb)/(4*alpha*xindx)
+ + sin(x3)*spb*spb/(4*alpha*xindx*xindx));
+ den = -32 * M_PI * alpha * alpha * xindx/spb;
+ }
+ taps[i] = 4 * alpha * num / den;
+ scale += taps[i];
+ }
+
+ for(int i=0;i<ntaps;i++)
+ taps[i] = taps[i] * gain / scale;
+
+ return taps;
+}
+
+//
+// === Utilities ===
+//
+
+// delta_f / width_factor gives number of taps required.
+static const float width_factor[5] = { // indexed by win_type
+ 3.3, // WIN_HAMMING
+ 3.1, // WIN_HANN
+ 5.5, // WIN_BLACKMAN
+ 2.0, // WIN_RECTANGULAR
+ //5.0 // WIN_KAISER (guesstimate compromise)
+ //2.0 // WIN_KAISER (guesstimate compromise)
+ 10.0 // WIN_KAISER
+};
+
+int
+gr_firdes::compute_ntaps_windes(double sampling_freq,
+ double transition_width, // this is frequency, not relative frequency
+ double attenuation_dB)
+{
+ // Based on formula from Multirate Signal Processing for
+ // Communications Systems, fredric j harris
+ int ntaps = (int)(attenuation_dB*sampling_freq/(22.0*transition_width));
+ if ((ntaps & 1) == 0) // if even...
+ ntaps++; // ...make odd
+ return ntaps;
+}
+
+int
+gr_firdes::compute_ntaps (double sampling_freq,
+ double transition_width,
+ win_type window_type,
+ double beta)
+{
+ // normalized transition width
+ double delta_f = transition_width / sampling_freq;
+
+ // compute number of taps required for given transition width
+ int ntaps = (int) (width_factor[window_type] / delta_f + 0.5);
+ if ((ntaps & 1) == 0) // if even...
+ ntaps++; // ...make odd
+
+ return ntaps;
+}
+
+double gr_firdes::bessi0(double x)
+{
+ double ax,ans;
+ double y;
+
+ ax=fabs(x);
+ if (ax < 3.75)
+ {
+ y=x/3.75;
+ y*=y;
+ ans=1.0+y*(3.5156229+y*(3.0899424+y*(1.2067492
+ +y*(0.2659732+y*(0.360768e-1+y*0.45813e-2)))));
+ }
+ else
+ {
+ y=3.75/ax;
+ ans=(exp(ax)/sqrt(ax))*(0.39894228+y*(0.1328592e-1
+ +y*(0.225319e-2+y*(-0.157565e-2+y*(0.916281e-2
+ +y*(-0.2057706e-1+y*(0.2635537e-1+y*(-0.1647633e-1
+ +y*0.392377e-2))))))));
+ }
+ return ans;
+}
+vector<float>
+gr_firdes::window (win_type type, int ntaps, double beta)
+{
+ vector<float> taps(ntaps);
+ int M = ntaps - 1; // filter order
+
+ switch (type){
+ case WIN_RECTANGULAR:
+ for (int n = 0; n < ntaps; n++)
+ taps[n] = 1;
+
+ case WIN_HAMMING:
+ for (int n = 0; n < ntaps; n++)
+ taps[n] = 0.54 - 0.46 * cos ((2 * M_PI * n) / M);
+ break;
+
+ case WIN_HANN:
+ for (int n = 0; n < ntaps; n++)
+ taps[n] = 0.5 - 0.5 * cos ((2 * M_PI * n) / M);
+ break;
+
+ case WIN_BLACKMAN:
+ for (int n = 0; n < ntaps; n++)
+ taps[n] = 0.42 - 0.50 * cos ((2*M_PI * n) / (M-1)) - 0.08 * cos ((4*M_PI * n) / (M-1));
+ break;
+
+ case WIN_BLACKMAN_hARRIS:
+ for (int n = -ntaps/2; n < ntaps/2; n++)
+ taps[n+ntaps/2] = 0.35875 + 0.48829*cos((2*M_PI * n) / (float)M) +
+ 0.14128*cos((4*M_PI * n) / (float)M) + 0.01168*cos((6*M_PI * n) / (float)M);
+ break;
+
+#if 0
+ case WIN_KAISER:
+ for (int n = 0; n < ntaps; n++)
+ taps[n] = bessi0(beta*sqrt(1.0 - (4.0*n/(M*M))))/bessi0(beta);
+ break;
+#else
+
+ case WIN_KAISER:
+ {
+ double IBeta = 1.0/Izero(beta);
+ double inm1 = 1.0/((double)(ntaps));
+ double temp;
+ //fprintf(stderr, "IBeta = %g; inm1 = %g\n", IBeta, inm1);
+
+ for (int i=0; i<ntaps; i++) {
+ temp = i * inm1;
+ //fprintf(stderr, "temp = %g\n", temp);
+ taps[i] = Izero(beta*sqrt(1.0-temp*temp)) * IBeta;
+ //fprintf(stderr, "taps[%d] = %g\n", i, taps[i]);
+ }
+ }
+ break;
+
+#endif
+ default:
+ throw std::out_of_range ("gr_firdes:window: type out of range");
+ }
+
+ return taps;
+}
+
+void
+gr_firdes::sanity_check_1f (double sampling_freq,
+ double fa, // cutoff freq
+ double transition_width)
+{
+ if (sampling_freq <= 0.0)
+ throw std::out_of_range ("gr_firdes check failed: sampling_freq > 0");
+
+ if (fa <= 0.0 || fa > sampling_freq / 2)
+ throw std::out_of_range ("gr_firdes check failed: 0 < fa <= sampling_freq / 2");
+
+ if (transition_width <= 0)
+ throw std::out_of_range ("gr_dirdes check failed: transition_width > 0");
+}
+
+void
+gr_firdes::sanity_check_2f (double sampling_freq,
+ double fa, // first cutoff freq
+ double fb, // second cutoff freq
+ double transition_width)
+{
+ if (sampling_freq <= 0.0)
+ throw std::out_of_range ("gr_firdes check failed: sampling_freq > 0");
+
+ if (fa <= 0.0 || fa > sampling_freq / 2)
+ throw std::out_of_range ("gr_firdes check failed: 0 < fa <= sampling_freq / 2");
+
+ if (fb <= 0.0 || fb > sampling_freq / 2)
+ throw std::out_of_range ("gr_firdes check failed: 0 < fb <= sampling_freq / 2");
+
+ if (fa > fb)
+ throw std::out_of_range ("gr_firdes check failed: fa <= fb");
+
+ if (transition_width <= 0)
+ throw std::out_of_range ("gr_firdes check failed: transition_width > 0");
+}
+
+void
+gr_firdes::sanity_check_2f_c (double sampling_freq,
+ double fa, // first cutoff freq
+ double fb, // second cutoff freq
+ double transition_width)
+{
+ if (sampling_freq <= 0.0)
+ throw std::out_of_range ("gr_firdes check failed: sampling_freq > 0");
+
+ if (fa < -sampling_freq / 2 || fa > sampling_freq / 2)
+ throw std::out_of_range ("gr_firdes check failed: 0 < fa <= sampling_freq / 2");
+
+ if (fb < -sampling_freq / 2 || fb > sampling_freq / 2)
+ throw std::out_of_range ("gr_firdes check failed: 0 < fb <= sampling_freq / 2");
+
+ if (fa > fb)
+ throw std::out_of_range ("gr_firdes check failed: fa <= fb");
+
+ if (transition_width <= 0)
+ throw std::out_of_range ("gr_firdes check failed: transition_width > 0");
+}
diff --git a/gnuradio-core/src/lib/general/gr_firdes.h b/gnuradio-core/src/lib/general/gr_firdes.h
new file mode 100644
index 000000000..8d98ebe0a
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_firdes.h
@@ -0,0 +1,373 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002,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.
+ */
+
+#ifndef _GR_FIRDES_H_
+#define _GR_FIRDES_H_
+
+#include <gr_core_api.h>
+#include <vector>
+#include <cmath>
+#include <gr_complex.h>
+
+/*!
+ * \brief Finite Impulse Response (FIR) filter design functions.
+ * \ingroup filter_design
+ */
+
+class GR_CORE_API gr_firdes {
+ public:
+
+ enum win_type {
+ WIN_HAMMING = 0, // max attenuation 53 dB
+ WIN_HANN = 1, // max attenuation 44 dB
+ WIN_BLACKMAN = 2, // max attenuation 74 dB
+ WIN_RECTANGULAR = 3,
+ WIN_KAISER = 4, // max attenuation a function of beta, google it
+ WIN_BLACKMAN_hARRIS = 5,
+ WIN_BLACKMAN_HARRIS = 5, // alias for capitalization consistency
+ };
+
+
+ // ... class methods ...
+
+ /*!
+ * \brief use "window method" to design a low-pass FIR filter
+ *
+ * \p gain: overall gain of filter (typically 1.0)
+ * \p sampling_freq: sampling freq (Hz)
+ * \p cutoff_freq: center of transition band (Hz)
+ * \p transition_width: width of transition band (Hz).
+ * The normalized width of the transition
+ * band is what sets the number of taps
+ * required. Narrow --> more taps
+ * \p window_type: What kind of window to use. Determines
+ * maximum attenuation and passband ripple.
+ * \p beta: parameter for Kaiser window
+ */
+ static std::vector<float>
+ low_pass (double gain,
+ double sampling_freq,
+ double cutoff_freq, // Hz center of transition band
+ double transition_width, // Hz width of transition band
+ win_type window = WIN_HAMMING,
+ double beta = 6.76); // used only with Kaiser
+
+ /*!
+ * \brief use "window method" to design a low-pass FIR filter
+ *
+ * \p gain: overall gain of filter (typically 1.0)
+ * \p sampling_freq: sampling freq (Hz)
+ * \p cutoff_freq: center of transition band (Hz)
+ * \p transition_width: width of transition band (Hz).
+ * \p attenuation_dB required stopband attenuation
+ * The normalized width of the transition
+ * band and the required stop band
+ * attenuation is what sets the number of taps
+ * required. Narrow --> more taps
+ * More attenuatin --> more taps
+ * \p window_type: What kind of window to use. Determines
+ * maximum attenuation and passband ripple.
+ * \p beta: parameter for Kaiser window
+ */
+
+ static std::vector<float>
+ low_pass_2 (double gain,
+ double sampling_freq,
+ double cutoff_freq, // Hz beginning transition band
+ double transition_width, // Hz width of transition band
+ double attenuation_dB, // out of band attenuation dB
+ win_type window = WIN_HAMMING,
+ double beta = 6.76); // used only with Kaiser
+
+ /*!
+ * \brief use "window method" to design a high-pass FIR filter
+ *
+ * \p gain: overall gain of filter (typically 1.0)
+ * \p sampling_freq: sampling freq (Hz)
+ * \p cutoff_freq: center of transition band (Hz)
+ * \p transition_width: width of transition band (Hz).
+ * The normalized width of the transition
+ * band is what sets the number of taps
+ * required. Narrow --> more taps
+ * \p window_type: What kind of window to use. Determines
+ * maximum attenuation and passband ripple.
+ * \p beta: parameter for Kaiser window
+ */
+
+ static std::vector<float>
+ high_pass (double gain,
+ double sampling_freq,
+ double cutoff_freq, // Hz center of transition band
+ double transition_width, // Hz width of transition band
+ win_type window = WIN_HAMMING,
+ double beta = 6.76); // used only with Kaiser
+
+ /*!
+ * \brief use "window method" to design a high-pass FIR filter
+ *
+ * \p gain: overall gain of filter (typically 1.0)
+ * \p sampling_freq: sampling freq (Hz)
+ * \p cutoff_freq: center of transition band (Hz)
+ * \p transition_width: width of transition band (Hz).
+ * \p attenuation_dB out of band attenuation
+ * The normalized width of the transition
+ * band and the required stop band
+ * attenuation is what sets the number of taps
+ * required. Narrow --> more taps
+ * More attenuation --> more taps
+ * \p window_type: What kind of window to use. Determines
+ * maximum attenuation and passband ripple.
+ * \p beta: parameter for Kaiser window
+ */
+
+ static std::vector<float>
+ high_pass_2 (double gain,
+ double sampling_freq,
+ double cutoff_freq, // Hz center of transition band
+ double transition_width, // Hz width of transition band
+ double attenuation_dB, // out of band attenuation dB
+ win_type window = WIN_HAMMING,
+ double beta = 6.76); // used only with Kaiser
+
+ /*!
+ * \brief use "window method" to design a band-pass FIR filter
+ *
+ * \p gain: overall gain of filter (typically 1.0)
+ * \p sampling_freq: sampling freq (Hz)
+ * \p low_cutoff_freq: center of transition band (Hz)
+ * \p high_cutoff_freq: center of transition band (Hz)
+ * \p transition_width: width of transition band (Hz).
+ * The normalized width of the transition
+ * band is what sets the number of taps
+ * required. Narrow --> more taps
+ * \p window_type: What kind of window to use. Determines
+ * maximum attenuation and passband ripple.
+ * \p beta: parameter for Kaiser window
+ */
+ static std::vector<float>
+ band_pass (double gain,
+ double sampling_freq,
+ double low_cutoff_freq, // Hz center of transition band
+ double high_cutoff_freq, // Hz center of transition band
+ double transition_width, // Hz width of transition band
+ win_type window = WIN_HAMMING,
+ double beta = 6.76); // used only with Kaiser
+
+ /*!
+ * \brief use "window method" to design a band-pass FIR filter
+ *
+ * \p gain: overall gain of filter (typically 1.0)
+ * \p sampling_freq: sampling freq (Hz)
+ * \p low_cutoff_freq: center of transition band (Hz)
+ * \p high_cutoff_freq: center of transition band (Hz)
+ * \p transition_width: width of transition band (Hz).
+ * \p attenuation_dB out of band attenuation
+ * The normalized width of the transition
+ * band and the required stop band
+ * attenuation is what sets the number of taps
+ * required. Narrow --> more taps
+ * More attenuation --> more taps
+ * \p window_type: What kind of window to use. Determines
+ * maximum attenuation and passband ripple.
+ * \p beta: parameter for Kaiser window
+ */
+
+ static std::vector<float>
+ band_pass_2 (double gain,
+ double sampling_freq,
+ double low_cutoff_freq, // Hz beginning transition band
+ double high_cutoff_freq, // Hz beginning transition band
+ double transition_width, // Hz width of transition band
+ double attenuation_dB, // out of band attenuation dB
+ win_type window = WIN_HAMMING,
+ double beta = 6.76); // used only with Kaiser
+
+ /*!
+ * \brief use "window method" to design a complex band-pass FIR filter
+ *
+ * \p gain: overall gain of filter (typically 1.0)
+ * \p sampling_freq: sampling freq (Hz)
+ * \p low_cutoff_freq: center of transition band (Hz)
+ * \p high_cutoff_freq: center of transition band (Hz)
+ * \p transition_width: width of transition band (Hz).
+ * The normalized width of the transition
+ * band is what sets the number of taps
+ * required. Narrow --> more taps
+ * \p window_type: What kind of window to use. Determines
+ * maximum attenuation and passband ripple.
+ * \p beta: parameter for Kaiser window
+ */
+
+ static std::vector<gr_complex>
+ complex_band_pass (double gain,
+ double sampling_freq,
+ double low_cutoff_freq, // Hz center of transition band
+ double high_cutoff_freq, // Hz center of transition band
+ double transition_width, // Hz width of transition band
+ win_type window = WIN_HAMMING,
+ double beta = 6.76); // used only with Kaiser
+
+ /*!
+ * \brief use "window method" to design a complex band-pass FIR filter
+ *
+ * \p gain: overall gain of filter (typically 1.0)
+ * \p sampling_freq: sampling freq (Hz)
+ * \p low_cutoff_freq: center of transition band (Hz)
+ * \p high_cutoff_freq: center of transition band (Hz)
+ * \p transition_width: width of transition band (Hz).
+ * \p attenuation_dB out of band attenuation
+ * The normalized width of the transition
+ * band and the required stop band
+ * attenuation is what sets the number of taps
+ * required. Narrow --> more taps
+ * More attenuation --> more taps
+ * \p window_type: What kind of window to use. Determines
+ * maximum attenuation and passband ripple.
+ * \p beta: parameter for Kaiser window
+ */
+
+ static std::vector<gr_complex>
+ complex_band_pass_2 (double gain,
+ double sampling_freq,
+ double low_cutoff_freq, // Hz beginning transition band
+ double high_cutoff_freq, // Hz beginning transition band
+ double transition_width, // Hz width of transition band
+ double attenuation_dB, // out of band attenuation dB
+ win_type window = WIN_HAMMING,
+ double beta = 6.76); // used only with Kaiser
+
+ /*!
+ * \brief use "window method" to design a band-reject FIR filter
+ *
+ * \p gain: overall gain of filter (typically 1.0)
+ * \p sampling_freq: sampling freq (Hz)
+ * \p low_cutoff_freq: center of transition band (Hz)
+ * \p high_cutoff_freq: center of transition band (Hz)
+ * \p transition_width: width of transition band (Hz).
+ * The normalized width of the transition
+ * band is what sets the number of taps
+ * required. Narrow --> more taps
+ * \p window_type: What kind of window to use. Determines
+ * maximum attenuation and passband ripple.
+ * \p beta: parameter for Kaiser window
+ */
+
+ static std::vector<float>
+ band_reject (double gain,
+ double sampling_freq,
+ double low_cutoff_freq, // Hz center of transition band
+ double high_cutoff_freq, // Hz center of transition band
+ double transition_width, // Hz width of transition band
+ win_type window = WIN_HAMMING,
+ double beta = 6.76); // used only with Kaiser
+
+ /*!
+ * \brief use "window method" to design a band-reject FIR filter
+ *
+ * \p gain: overall gain of filter (typically 1.0)
+ * \p sampling_freq: sampling freq (Hz)
+ * \p low_cutoff_freq: center of transition band (Hz)
+ * \p high_cutoff_freq: center of transition band (Hz)
+ * \p transition_width: width of transition band (Hz).
+ * \p attenuation_dB out of band attenuation
+ * The normalized width of the transition
+ * band and the required stop band
+ * attenuation is what sets the number of taps
+ * required. Narrow --> more taps
+ * More attenuation --> more taps
+ * \p window_type: What kind of window to use. Determines
+ * maximum attenuation and passband ripple.
+ * \p beta: parameter for Kaiser window
+ */
+
+ static std::vector<float>
+ band_reject_2 (double gain,
+ double sampling_freq,
+ double low_cutoff_freq, // Hz beginning transition band
+ double high_cutoff_freq, // Hz beginning transition band
+ double transition_width, // Hz width of transition band
+ double attenuation_dB, // out of band attenuation dB
+ win_type window = WIN_HAMMING,
+ double beta = 6.76); // used only with Kaiser
+
+ /*!\brief design a Hilbert Transform Filter
+ *
+ * \p ntaps: Number of taps, must be odd
+ * \p window_type: What kind of window to use
+ * \p beta: Only used for Kaiser
+ */
+ static std::vector<float>
+ hilbert (unsigned int ntaps = 19,
+ win_type windowtype = WIN_RECTANGULAR,
+ double beta = 6.76);
+
+ /*!
+ * \brief design a Root Cosine FIR Filter (do we need a window?)
+ *
+ * \p gain: overall gain of filter (typically 1.0)
+ * \p sampling_freq: sampling freq (Hz)
+ * \p symbol rate: symbol rate, must be a factor of sample rate
+ * \p alpha: excess bandwidth factor
+ * \p ntaps: number of taps
+ */
+ static std::vector<float>
+ root_raised_cosine (double gain,
+ double sampling_freq,
+ double symbol_rate, // Symbol rate, NOT bitrate (unless BPSK)
+ double alpha, // Excess Bandwidth Factor
+ int ntaps);
+
+ /*!
+ * \brief design a Gaussian filter
+ *
+ * \p gain: overall gain of filter (typically 1.0)
+ * \p symbols per bit: symbol rate, must be a factor of sample rate
+ * \p ntaps: number of taps
+ */
+ static std::vector<float>
+ gaussian (double gain,
+ double spb,
+ double bt, // Bandwidth to bitrate ratio
+ int ntaps);
+
+ // window functions ...
+ static std::vector<float> window (win_type type, int ntaps, double beta);
+
+private:
+ static double bessi0(double x);
+ static void sanity_check_1f (double sampling_freq, double f1,
+ double transition_width);
+ static void sanity_check_2f (double sampling_freq, double f1, double f2,
+ double transition_width);
+ static void sanity_check_2f_c (double sampling_freq, double f1, double f2,
+ double transition_width);
+
+ static int compute_ntaps (double sampling_freq,
+ double transition_width,
+ win_type window_type, double beta);
+
+ static int compute_ntaps_windes (double sampling_freq,
+ double transition_width,
+ double attenuation_dB);
+};
+
+#endif
diff --git a/gnuradio-core/src/lib/general/gr_firdes.i b/gnuradio-core/src/lib/general/gr_firdes.i
new file mode 100644
index 000000000..0493db617
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_firdes.i
@@ -0,0 +1,360 @@
+/* -*- C++ -*- */
+/*
+ * Copyright 2002,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.
+ */
+
+/*!
+ * \brief Finite Impulse Response (FIR) filter design functions.
+ */
+
+%rename(firdes) gr_firdes;
+
+class gr_firdes {
+ public:
+
+ enum win_type {
+ WIN_HAMMING = 0, // max attenuation 53 dB
+ WIN_HANN = 1, // max attenuation 44 dB
+ WIN_BLACKMAN = 2, // max attenuation 74 dB
+ WIN_RECTANGULAR = 3,
+ WIN_KAISER = 4, // max attenuation variable with beta, google it
+ WIN_BLACKMAN_hARRIS = 5,
+ };
+
+ // ... class methods ...
+
+ /*!
+ * \brief use "window method" to design a low-pass FIR filter
+ *
+ * \p gain: overall gain of filter (typically 1.0)
+ * \p sampling_freq: sampling freq (Hz)
+ * \p cutoff_freq: center of transition band (Hz)
+ * \p transition_width: width of transition band (Hz).
+ * The normalized width of the transition
+ * band is what sets the number of taps
+ * required. Narrow --> more taps
+ * \p window_type: What kind of window to use. Determines
+ * maximum attenuation and passband ripple.
+ * \p beta: parameter for Kaiser window
+ */
+ static std::vector<float>
+ low_pass (double gain,
+ double sampling_freq,
+ double cutoff_freq, // Hz center of transition band
+ double transition_width, // Hz width of transition band
+ win_type window = WIN_HAMMING,
+ double beta = 6.76 // used only with Kaiser
+ ) throw(std::out_of_range);
+
+ /*!
+ * \brief use "window method" to design a low-pass FIR filter
+ * using alternative design criteria
+ * \p gain: overall gain of filter (typically 1.0)
+ * \p sampling_freq: sampling freq (Hz)
+ * \p cutoff_freq: center of transition band (Hz)
+ * \p transition_width: width of transition band (Hz).
+ * \p attenuation_dB out of band attenuation
+ * The normalized width of the transition
+ * band and the required stop band
+ * attenuation is what sets the number of taps
+ * required. Narrow --> more taps
+ * More attenuation --> more taps
+ * \p window_type: What kind of window to use. Determines
+ * maximum attenuation and passband ripple.
+ * \p beta: parameter for Kaiser window
+ */
+ static std::vector<float>
+ low_pass_2 (double gain,
+ double sampling_freq,
+ double cutoff_freq, // Hz center of transition band
+ double transition_width, // Hz width of transition band
+ double attenuation_dB, // out of band attenuation
+ win_type window = WIN_HAMMING,
+ double beta = 6.76 // used only with Kaiser
+ ) throw(std::out_of_range);
+
+ /*!
+ * \brief use "window method" to design a high-pass FIR filter
+ *
+ * \p gain: overall gain of filter (typically 1.0)
+ * \p sampling_freq: sampling freq (Hz)
+ * \p cutoff_freq: center of transition band (Hz)
+ * \p transition_width: width of transition band (Hz).
+ * The normalized width of the transition
+ * band is what sets the number of taps
+ * required. Narrow --> more taps
+ * \p window_type: What kind of window to use. Determines
+ * maximum attenuation and passband ripple.
+ * \p beta: parameter for Kaiser window
+ */
+
+ static std::vector<float>
+ high_pass (double gain,
+ double sampling_freq,
+ double cutoff_freq, // Hz center of transition band
+ double transition_width, // Hz width of transition band
+ win_type window = WIN_HAMMING,
+ double beta = 6.76 // used only with Kaiser
+ ) throw(std::out_of_range);
+
+ /*!
+ * \brief use "window method" to design a high-pass FIR filter
+ *
+ * \p gain: overall gain of filter (typically 1.0)
+ * \p sampling_freq: sampling freq (Hz)
+ * \p cutoff_freq: center of transition band (Hz)
+ * \p transition_width: width of transition band (Hz).
+ * \p attenuation_dB out of band attenuation
+ * The normalized width of the transition
+ * band and the required stop band
+ * attenuation is what sets the number of taps
+ * required. Narrow --> more taps
+ * More attenuation --> more taps
+ * \p window_type: What kind of window to use. Determines
+ * maximum attenuation and passband ripple.
+ * \p beta: parameter for Kaiser window
+ */
+
+ static std::vector<float>
+ high_pass_2 (double gain,
+ double sampling_freq,
+ double cutoff_freq, // Hz center of transition band
+ double transition_width, // Hz width of transition band
+ double attenuation_dB, // out of band attenuation dB
+ win_type window = WIN_HAMMING,
+ double beta = 6.76); // used only with Kaiser
+
+
+ /*!
+ * \brief use "window method" to design a band-pass FIR filter
+ *
+ * \p gain: overall gain of filter (typically 1.0)
+ * \p sampling_freq: sampling freq (Hz)
+ * \p low_cutoff_freq: center of transition band (Hz)
+ * \p high_cutoff_freq: center of transition band (Hz)
+ * \p transition_width: width of transition band (Hz).
+ * The normalized width of the transition
+ * band is what sets the number of taps
+ * required. Narrow --> more taps
+ * \p window_type: What kind of window to use. Determines
+ * maximum attenuation and passband ripple.
+ * \p beta: parameter for Kaiser window
+ */
+
+ static std::vector<float>
+ band_pass (double gain,
+ double sampling_freq,
+ double low_cutoff_freq, // Hz center of transition band
+ double high_cutoff_freq, // Hz center of transition band
+ double transition_width, // Hz width of transition band
+ win_type window = WIN_HAMMING,
+ double beta = 6.76 // used only with Kaiser
+ ) throw(std::out_of_range);
+
+
+ /*!
+ * \brief use "window method" to design a band-pass FIR filter
+ *
+ * \p gain: overall gain of filter (typically 1.0)
+ * \p sampling_freq: sampling freq (Hz)
+ * \p low_cutoff_freq: center of transition band (Hz)
+ * \p high_cutoff_freq: center of transition band (Hz)
+ * \p transition_width: width of transition band (Hz).
+ * \p attenuation_dB out of band attenuation
+ * The normalized width of the transition
+ * band and the required stop band
+ * attenuation is what sets the number of taps
+ * required. Narrow --> more taps
+ * More attenuation --> more taps
+ * \p window_type: What kind of window to use. Determines
+ * maximum attenuation and passband ripple.
+ * \p beta: parameter for Kaiser window
+ */
+
+ static std::vector<float>
+ band_pass_2 (double gain,
+ double sampling_freq,
+ double low_cutoff_freq, // Hz beginning transition band
+ double high_cutoff_freq, // Hz beginning transition band
+ double transition_width, // Hz width of transition band
+ double attenuation_dB, // out of band attenuation dB
+ win_type window = WIN_HAMMING,
+ double beta = 6.76); // used only with Kaiser
+
+ /*!
+ * \brief use "window method" to design a band-pass FIR filter
+ *
+ * \p gain: overall gain of filter (typically 1.0)
+ * \p sampling_freq: sampling freq (Hz)
+ * \p low_cutoff_freq: center of transition band (Hz)
+ * \p high_cutoff_freq: center of transition band (Hz)
+ * \p transition_width: width of transition band (Hz).
+ * The normalized width of the transition
+ * band is what sets the number of taps
+ * required. Narrow --> more taps
+ * \p window_type: What kind of window to use. Determines
+ * maximum attenuation and passband ripple.
+ * \p beta: parameter for Kaiser window
+ */
+
+ static std::vector<gr_complex>
+ complex_band_pass (double gain,
+ double sampling_freq,
+ double low_cutoff_freq, // Hz center of transition band
+ double high_cutoff_freq, // Hz center of transition band
+ double transition_width, // Hz width of transition band
+ win_type window = WIN_HAMMING, // used only with Kaiser
+ double beta = 6.76
+ ) throw(std::out_of_range);
+
+
+ /*!
+ * \brief use "window method" to design a complex band-pass FIR filter
+ *
+ * \p gain: overall gain of filter (typically 1.0)
+ * \p sampling_freq: sampling freq (Hz)
+ * \p low_cutoff_freq: center of transition band (Hz)
+ * \p high_cutoff_freq: center of transition band (Hz)
+ * \p transition_width: width of transition band (Hz).
+ * \p attenuation_dB out of band attenuation
+ * The normalized width of the transition
+ * band and the required stop band
+ * attenuation is what sets the number of taps
+ * required. Narrow --> more taps
+ * More attenuation --> more taps
+ * \p window_type: What kind of window to use. Determines
+ * maximum attenuation and passband ripple.
+ * \p beta: parameter for Kaiser window
+ */
+
+ static std::vector<gr_complex>
+ complex_band_pass_2 (double gain,
+ double sampling_freq,
+ double low_cutoff_freq, // Hz beginning transition band
+ double high_cutoff_freq, // Hz beginning transition band
+ double transition_width, // Hz width of transition band
+ double attenuation_dB, // out of band attenuation dB
+ win_type window = WIN_HAMMING,
+ double beta = 6.76); // used only with Kaiser
+
+ /*!
+ * \brief use "window method" to design a band-reject FIR filter
+ *
+ * \p gain: overall gain of filter (typically 1.0)
+ * \p sampling_freq: sampling freq (Hz)
+ * \p low_cutoff_freq: center of transition band (Hz)
+ * \p high_cutoff_freq: center of transition band (Hz)
+ * \p transition_width: width of transition band (Hz).
+ * The normalized width of the transition
+ * band is what sets the number of taps
+ * required. Narrow --> more taps
+ * \p window_type: What kind of window to use. Determines
+ * maximum attenuation and passband ripple.
+ * \p beta: parameter for Kaiser window
+ */
+
+ static std::vector<float>
+ band_reject (double gain,
+ double sampling_freq,
+ double low_cutoff_freq, // Hz center of transition band
+ double high_cutoff_freq, // Hz center of transition band
+ double transition_width, // Hz width of transition band
+ win_type window = WIN_HAMMING, // used only with Kaiser
+ double beta = 6.76
+ ) throw(std::out_of_range);
+
+
+ /*!
+ * \brief use "window method" to design a band-reject FIR filter
+ *
+ * \p gain: overall gain of filter (typically 1.0)
+ * \p sampling_freq: sampling freq (Hz)
+ * \p low_cutoff_freq: center of transition band (Hz)
+ * \p high_cutoff_freq: center of transition band (Hz)
+ * \p transition_width: width of transition band (Hz).
+ * \p attenuation_dB out of band attenuation
+ * The normalized width of the transition
+ * band and the required stop band
+ * attenuation is what sets the number of taps
+ * required. Narrow --> more taps
+ * More attenuation --> more taps
+ * \p window_type: What kind of window to use. Determines
+ * maximum attenuation and passband ripple.
+ * \p beta: parameter for Kaiser window
+ */
+
+ static std::vector<float>
+ band_reject_2 (double gain,
+ double sampling_freq,
+ double low_cutoff_freq, // Hz beginning transition band
+ double high_cutoff_freq, // Hz beginning transition band
+ double transition_width, // Hz width of transition band
+ double attenuation_dB, // out of band attenuation dB
+ win_type window = WIN_HAMMING,
+ double beta = 6.76); // used only with Kaiser
+
+ /*!\brief design a Hilbert Transform Filter
+ *
+ * \p ntaps: Number of taps, must be odd
+ * \p window_type: What kind of window to use
+ * \p beta: Only used for Kaiser
+ */
+ static std::vector<float>
+ hilbert (unsigned int ntaps = 19,
+ win_type windowtype = WIN_RECTANGULAR,
+ double beta = 6.76
+ ) throw(std::out_of_range);
+
+ /*!
+ * \brief design a Root Cosine FIR Filter (do we need a window?)
+ *
+ * \p gain: overall gain of filter (typically 1.0)
+ * \p sampling_freq: sampling freq (Hz)
+ * \p symbol rate: symbol rate, must be a factor of sample rate
+ * \p alpha: excess bandwidth factor
+ * \p ntaps: number of taps
+ */
+ static std::vector<float>
+ root_raised_cosine (double gain,
+ double sampling_freq,
+ double symbol_rate, // Symbol rate, NOT bitrate (unless BPSK)
+ double alpha, // Excess Bandwidth Factor
+ int ntaps) throw(std::out_of_range);
+
+ /*!
+ * \brief design a Gaussian filter
+ *
+ * \p gain: overall gain of filter (typically 1.0)
+ * \p symbols per bit: symbol rate, must be a factor of sample rate
+ * \p bt: BT bandwidth time product
+ * \p ntaps: number of taps
+ */
+ static std::vector<float>
+ gaussian (double gain,
+ double spb,
+ double bt, // Bandwidth to bitrate ratio
+ int ntaps) throw(std::out_of_range);
+
+ /*!
+ * Return window given type, ntaps and optional beta.
+ */
+ static std::vector<float> gr_firdes::window (win_type type, int ntaps, double beta)
+ throw(std::runtime_error);
+};
diff --git a/gnuradio-core/src/lib/general/gr_float_to_char.cc b/gnuradio-core/src/lib/general/gr_float_to_char.cc
new file mode 100644
index 000000000..d67ded3ea
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_float_to_char.cc
@@ -0,0 +1,79 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,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 <gr_float_to_char.h>
+#include <gr_io_signature.h>
+#include <volk/volk.h>
+
+gr_float_to_char_sptr
+gr_make_float_to_char (size_t vlen, float scale)
+{
+ return gnuradio::get_initial_sptr(new gr_float_to_char (vlen, scale));
+}
+
+gr_float_to_char::gr_float_to_char (size_t vlen, float scale)
+ : gr_sync_block ("gr_float_to_char",
+ gr_make_io_signature (1, 1, sizeof (float)*vlen),
+ gr_make_io_signature (1, 1, sizeof (char)*vlen)),
+ d_vlen(vlen), d_scale(scale)
+{
+ const int alignment_multiple =
+ volk_get_alignment() / sizeof(char);
+ set_alignment(std::max(1,alignment_multiple));
+}
+
+float
+gr_float_to_char::scale() const
+{
+ return d_scale;
+}
+
+void
+gr_float_to_char::set_scale(float scale)
+{
+ d_scale = scale;
+}
+
+int
+gr_float_to_char::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const float *in = (const float *) input_items[0];
+ int8_t *out = (int8_t *) output_items[0];
+
+ if(is_unaligned()) {
+ volk_32f_s32f_convert_8i_u(out, in, d_scale, d_vlen*noutput_items);
+ }
+ else {
+ volk_32f_s32f_convert_8i_a(out, in, d_scale, d_vlen*noutput_items);
+ }
+
+ return noutput_items;
+}
+
+
+
diff --git a/gnuradio-core/src/lib/general/gr_float_to_char.h b/gnuradio-core/src/lib/general/gr_float_to_char.h
new file mode 100644
index 000000000..2df50f18d
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_float_to_char.h
@@ -0,0 +1,70 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,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 INCLUDED_GR_FLOAT_TO_CHAR_H
+#define INCLUDED_GR_FLOAT_TO_CHAR_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+
+class gr_float_to_char;
+typedef boost::shared_ptr<gr_float_to_char> gr_float_to_char_sptr;
+
+GR_CORE_API gr_float_to_char_sptr
+gr_make_float_to_char (size_t vlen=1, float scale=1);
+
+/*!
+ * \brief Convert stream of float to a stream of char
+ * \ingroup converter_blk
+ *
+ * \param vlen vector length of data streams.
+ * \param scale a scalar multiplier to change the output signal scale.
+ */
+
+class GR_CORE_API gr_float_to_char : public gr_sync_block
+{
+ private:
+ friend GR_CORE_API gr_float_to_char_sptr gr_make_float_to_char
+ (size_t vlen, float scale);
+ gr_float_to_char (size_t vlen, float scale);
+
+ size_t d_vlen;
+ float d_scale;
+
+ public:
+ /*!
+ * Get the scalar multiplier value.
+ */
+ float scale() const;
+
+ /*!
+ * Set the scalar multiplier value.
+ */
+ void set_scale(float scale);
+
+ virtual int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+
+#endif /* INCLUDED_GR_FLOAT_TO_CHAR_H */
diff --git a/gnuradio-core/src/lib/general/gr_float_to_char.i b/gnuradio-core/src/lib/general/gr_float_to_char.i
new file mode 100644
index 000000000..b40389ede
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_float_to_char.i
@@ -0,0 +1,33 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,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,float_to_char)
+
+gr_float_to_char_sptr
+gr_make_float_to_char (size_t vlen=1, float scale=1);
+
+class gr_float_to_char : public gr_sync_block
+{
+public:
+ float scale() const;
+ void set_scale(float scale);
+};
diff --git a/gnuradio-core/src/lib/general/gr_float_to_complex.cc b/gnuradio-core/src/lib/general/gr_float_to_complex.cc
new file mode 100644
index 000000000..c68eac8c7
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_float_to_complex.cc
@@ -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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_float_to_complex.h>
+#include <gr_io_signature.h>
+
+gr_float_to_complex_sptr
+gr_make_float_to_complex (size_t vlen)
+{
+ return gnuradio::get_initial_sptr(new gr_float_to_complex (vlen));
+}
+
+gr_float_to_complex::gr_float_to_complex (size_t vlen)
+ : gr_sync_block ("gr_float_to_complex",
+ gr_make_io_signature (1, 2, sizeof (float) * vlen),
+ gr_make_io_signature (1, 1, sizeof (gr_complex) * vlen)),
+ d_vlen (vlen)
+{
+}
+
+int
+gr_float_to_complex::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ float *r = (float *)input_items[0];
+ float *i = (float *)input_items[1];
+ gr_complex *out = (gr_complex *) output_items[0];
+
+ switch (input_items.size ()){
+ case 1:
+ for (size_t j = 0; j < noutput_items*d_vlen; j++)
+ out[j] = gr_complex (r[j], 0);
+ break;
+
+ case 2:
+ for (size_t j = 0; j < noutput_items*d_vlen; j++)
+ out[j] = gr_complex (r[j], i[j]);
+ break;
+
+ default:
+ assert (0);
+ }
+
+ return noutput_items;
+}
+
+
+
diff --git a/gnuradio-core/src/lib/general/gr_float_to_complex.h b/gnuradio-core/src/lib/general/gr_float_to_complex.h
new file mode 100644
index 000000000..628b4a954
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_float_to_complex.h
@@ -0,0 +1,55 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_GR_FLOAT_TO_COMPLEX_H
+#define INCLUDED_GR_FLOAT_TO_COMPLEX_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+#include <gr_complex.h>
+
+class gr_float_to_complex;
+typedef boost::shared_ptr<gr_float_to_complex> gr_float_to_complex_sptr;
+
+GR_CORE_API gr_float_to_complex_sptr
+gr_make_float_to_complex (size_t vlen = 1);
+
+/*!
+ * \brief Convert 1 or 2 streams of float to a stream of gr_complex
+ * \ingroup converter_blk
+ */
+
+class GR_CORE_API gr_float_to_complex : public gr_sync_block
+{
+ friend GR_CORE_API gr_float_to_complex_sptr gr_make_float_to_complex (size_t vlen);
+ gr_float_to_complex (size_t vlen);
+
+ size_t d_vlen;
+
+ public:
+ virtual int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+
+#endif /* INCLUDED_GR_FLOAT_TO_COMPLEX_H */
diff --git a/gnuradio-core/src/lib/general/gr_float_to_complex.i b/gnuradio-core/src/lib/general/gr_float_to_complex.i
new file mode 100644
index 000000000..ed5ad128b
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_float_to_complex.i
@@ -0,0 +1,30 @@
+/* -*- 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,float_to_complex)
+
+gr_float_to_complex_sptr gr_make_float_to_complex (size_t vlen = 1);
+
+class gr_float_to_complex : public gr_sync_block
+{
+ gr_float_to_complex (size_t vlen);
+};
diff --git a/gnuradio-core/src/lib/general/gr_float_to_int.cc b/gnuradio-core/src/lib/general/gr_float_to_int.cc
new file mode 100644
index 000000000..43b851895
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_float_to_int.cc
@@ -0,0 +1,89 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2011,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 <gr_float_to_int.h>
+#include <gr_io_signature.h>
+#include <gri_float_to_int.h>
+#include <volk/volk.h>
+
+gr_float_to_int_sptr
+gr_make_float_to_int (size_t vlen, float scale)
+{
+ return gnuradio::get_initial_sptr(new gr_float_to_int (vlen, scale));
+}
+
+gr_float_to_int::gr_float_to_int (size_t vlen, float scale)
+ : gr_sync_block ("gr_float_to_int",
+ gr_make_io_signature (1, 1, sizeof (float)*vlen),
+ gr_make_io_signature (1, 1, sizeof (int)*vlen)),
+ d_vlen(vlen), d_scale(scale)
+{
+ const int alignment_multiple =
+ volk_get_alignment() / sizeof(int);
+ set_alignment(std::max(1,alignment_multiple));
+}
+
+float
+gr_float_to_int::scale() const
+{
+ return d_scale;
+}
+
+void
+gr_float_to_int::set_scale(float scale)
+{
+ d_scale = scale;
+}
+int
+gr_float_to_int::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ // Disable the Volk for now. There is a problem for large 32-bit ints that
+ // are not properly represented by the precisions of a single float, which
+ // can cause wrapping from large, positive numbers to negative.
+ // In gri_float_to_int, the value is first promoted to a 64-bit
+ // value, clipped, then converted to a float.
+#if 0
+ const float *in = (const float *) input_items[0];
+ int32_t *out = (int32_t *) output_items[0];
+
+ if(is_unaligned()) {
+ volk_32f_s32f_convert_32i_u(out, in, d_scale, d_vlen*noutput_items);
+ }
+ else {
+ volk_32f_s32f_convert_32i_a(out, in, d_scale, d_vlen*noutput_items);
+ }
+#else
+ const float *in = (const float *) input_items[0];
+ int *out = (int *) output_items[0];
+
+ gri_float_to_int (in, out, d_scale, d_vlen*noutput_items);
+
+#endif
+
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/general/gr_float_to_int.h b/gnuradio-core/src/lib/general/gr_float_to_int.h
new file mode 100644
index 000000000..c10ea739d
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_float_to_int.h
@@ -0,0 +1,70 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2011,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 INCLUDED_GR_FLOAT_TO_INT_H
+#define INCLUDED_GR_FLOAT_TO_INT_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+
+class gr_float_to_int;
+typedef boost::shared_ptr<gr_float_to_int> gr_float_to_int_sptr;
+
+GR_CORE_API gr_float_to_int_sptr
+gr_make_float_to_int (size_t vlen=1, float scale=1);
+
+/*!
+ * \brief Convert stream of float to a stream of short
+ * \ingroup converter_blk
+ *
+ * \param vlen vector length of data streams.
+ * \param scale a scalar multiplier to change the output signal scale.
+ */
+
+class GR_CORE_API gr_float_to_int : public gr_sync_block
+{
+ private:
+ friend GR_CORE_API
+ gr_float_to_int_sptr gr_make_float_to_int (size_t vlen, float scale);
+ gr_float_to_int (size_t vlen, float scale);
+
+ size_t d_vlen;
+ float d_scale;
+
+ public:
+ /*!
+ * Get the scalar multiplier value.
+ */
+ float scale() const;
+
+ /*!
+ * Set the scalar multiplier value.
+ */
+ void set_scale(float scale);
+
+ virtual int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+
+#endif /* INCLUDED_GR_FLOAT_TO_INT_H */
diff --git a/gnuradio-core/src/lib/general/gr_float_to_int.i b/gnuradio-core/src/lib/general/gr_float_to_int.i
new file mode 100644
index 000000000..e2a2c53ce
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_float_to_int.i
@@ -0,0 +1,33 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2011,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,float_to_int)
+
+gr_float_to_int_sptr
+gr_make_float_to_int (size_t vlen=1, float scale=1);
+
+class gr_float_to_int : public gr_sync_block
+{
+public:
+ float scale() const;
+ void set_scale(float scale);
+};
diff --git a/gnuradio-core/src/lib/general/gr_float_to_short.cc b/gnuradio-core/src/lib/general/gr_float_to_short.cc
new file mode 100644
index 000000000..ab720168b
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_float_to_short.cc
@@ -0,0 +1,79 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,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 <gr_float_to_short.h>
+#include <gr_io_signature.h>
+#include <volk/volk.h>
+
+gr_float_to_short_sptr
+gr_make_float_to_short (size_t vlen, float scale)
+{
+ return gnuradio::get_initial_sptr(new gr_float_to_short (vlen, scale));
+}
+
+gr_float_to_short::gr_float_to_short (size_t vlen, float scale)
+ : gr_sync_block ("gr_float_to_short",
+ gr_make_io_signature (1, 1, sizeof (float)*vlen),
+ gr_make_io_signature (1, 1, sizeof (short)*vlen)),
+ d_vlen(vlen), d_scale(scale)
+{
+ const int alignment_multiple =
+ volk_get_alignment() / sizeof(short);
+ set_alignment(std::max(1,alignment_multiple));
+}
+
+float
+gr_float_to_short::scale() const
+{
+ return d_scale;
+}
+
+void
+gr_float_to_short::set_scale(float scale)
+{
+ d_scale = scale;
+}
+
+int
+gr_float_to_short::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const float *in = (const float *) input_items[0];
+ short *out = (short *) output_items[0];
+
+ if(is_unaligned()) {
+ volk_32f_s32f_convert_16i_u(out, in, d_scale, d_vlen*noutput_items);
+ }
+ else {
+ volk_32f_s32f_convert_16i_a(out, in, d_scale, d_vlen*noutput_items);
+ }
+
+ return noutput_items;
+}
+
+
+
diff --git a/gnuradio-core/src/lib/general/gr_float_to_short.h b/gnuradio-core/src/lib/general/gr_float_to_short.h
new file mode 100644
index 000000000..9e43804f5
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_float_to_short.h
@@ -0,0 +1,69 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,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 INCLUDED_GR_FLOAT_TO_SHORT_H
+#define INCLUDED_GR_FLOAT_TO_SHORT_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+
+class gr_float_to_short;
+typedef boost::shared_ptr<gr_float_to_short> gr_float_to_short_sptr;
+
+GR_CORE_API gr_float_to_short_sptr
+gr_make_float_to_short (size_t vlen=1, float scale=1);
+
+/*!
+ * \brief Convert stream of float to a stream of short
+ * \ingroup converter_blk
+ *
+ * \param vlen vector length of data streams.
+ * \param scale a scalar multiplier to change the output signal scale.
+ */
+
+class GR_CORE_API gr_float_to_short : public gr_sync_block
+{
+ friend GR_CORE_API
+ gr_float_to_short_sptr gr_make_float_to_short (size_t vlen, float scale);
+ gr_float_to_short (size_t vlen, float scale);
+
+ size_t d_vlen;
+ float d_scale;
+
+ public:
+ /*!
+ * Get the scalar multiplier value.
+ */
+ float scale() const;
+
+ /*!
+ * Set the scalar multiplier value.
+ */
+ void set_scale(float scale);
+
+ virtual int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+
+#endif /* INCLUDED_GR_FLOAT_TO_SHORT_H */
diff --git a/gnuradio-core/src/lib/general/gr_float_to_short.i b/gnuradio-core/src/lib/general/gr_float_to_short.i
new file mode 100644
index 000000000..ea59a388e
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_float_to_short.i
@@ -0,0 +1,33 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,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,float_to_short)
+
+gr_float_to_short_sptr
+gr_make_float_to_short (size_t vlen=1, float scale=1);
+
+class gr_float_to_short : public gr_sync_block
+{
+public:
+ float scale() const;
+ void set_scale(float scale);
+};
diff --git a/gnuradio-core/src/lib/general/gr_float_to_uchar.cc b/gnuradio-core/src/lib/general/gr_float_to_uchar.cc
new file mode 100644
index 000000000..5aec73b71
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_float_to_uchar.cc
@@ -0,0 +1,58 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_float_to_uchar.h>
+#include <gr_io_signature.h>
+#include <gri_float_to_uchar.h>
+
+gr_float_to_uchar_sptr
+gr_make_float_to_uchar ()
+{
+ return gnuradio::get_initial_sptr(new gr_float_to_uchar ());
+}
+
+gr_float_to_uchar::gr_float_to_uchar ()
+ : gr_sync_block ("gr_float_to_uchar",
+ gr_make_io_signature (1, 1, sizeof (float)),
+ gr_make_io_signature (1, 1, sizeof (unsigned char)))
+{
+}
+
+int
+gr_float_to_uchar::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const float *in = (const float *) input_items[0];
+ unsigned char *out = (unsigned char *) output_items[0];
+
+ gri_float_to_uchar (in, out, noutput_items);
+
+ return noutput_items;
+}
+
+
+
diff --git a/gnuradio-core/src/lib/general/gr_float_to_uchar.h b/gnuradio-core/src/lib/general/gr_float_to_uchar.h
new file mode 100644
index 000000000..7fd947048
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_float_to_uchar.h
@@ -0,0 +1,52 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005 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_FLOAT_TO_UCHAR_H
+#define INCLUDED_GR_FLOAT_TO_UCHAR_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+
+class gr_float_to_uchar;
+typedef boost::shared_ptr<gr_float_to_uchar> gr_float_to_uchar_sptr;
+
+GR_CORE_API gr_float_to_uchar_sptr
+gr_make_float_to_uchar ();
+
+/*!
+ * \brief Convert stream of float to a stream of unsigned char
+ * \ingroup converter_blk
+ */
+
+class GR_CORE_API gr_float_to_uchar : public gr_sync_block
+{
+ friend GR_CORE_API gr_float_to_uchar_sptr gr_make_float_to_uchar ();
+ gr_float_to_uchar ();
+
+ public:
+ virtual int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+
+#endif /* INCLUDED_GR_FLOAT_TO_UCHAR_H */
diff --git a/gnuradio-core/src/lib/general/gr_float_to_uchar.i b/gnuradio-core/src/lib/general/gr_float_to_uchar.i
new file mode 100644
index 000000000..b35979213
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_float_to_uchar.i
@@ -0,0 +1,30 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005 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,float_to_uchar)
+
+gr_float_to_uchar_sptr gr_make_float_to_uchar ();
+
+class gr_float_to_uchar : public gr_sync_block
+{
+ gr_float_to_uchar ();
+};
diff --git a/gnuradio-core/src/lib/general/gr_fmdet_cf.cc b/gnuradio-core/src/lib/general/gr_fmdet_cf.cc
new file mode 100644
index 000000000..f02036292
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_fmdet_cf.cc
@@ -0,0 +1,105 @@
+/* -*- 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.
+ */
+
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_fmdet_cf.h>
+#include <gr_io_signature.h>
+#include <math.h>
+#include <gr_math.h>
+
+#define M_TWOPI (2*M_PI)
+
+gr_fmdet_cf_sptr
+gr_make_fmdet_cf (float samplerate, float freq_low, float freq_high, float scl)
+{
+ return gnuradio::get_initial_sptr(new gr_fmdet_cf (samplerate, freq_low, freq_high, scl));
+}
+
+gr_fmdet_cf::gr_fmdet_cf (float samplerate, float freq_low, float freq_high, float scl)
+ : gr_sync_block ("fmdet_cf",
+ gr_make_io_signature (1, 1, sizeof (gr_complex)),
+ gr_make_io_signature (1, 1, sizeof (float))),
+ d_S1(0.1),d_S2(0.1),
+ d_S3(0.1),d_S4(0.1)
+{
+ const float h[]={0.003118678733, -0.012139843428, 0.027270898036, -0.051318579352,
+ 0.090406910552, -0.162926865366, 0.361885392563, 0.000000000000,
+ -0.361885392563, 0.162926865366, -0.090406910552, 0.051318579352,
+ -0.027270898036, 0.012139843428, -0.003118678733};
+
+
+
+
+ float delta;
+ std::vector<float> taps(15);
+
+ d_freqhi = freq_high;
+ d_freqlo = freq_low;
+ delta = (d_freqhi - d_freqlo);
+ d_scl = scl;
+ d_bias = 0.5*scl*(d_freqhi+d_freqlo)/delta;
+ for (int i=0;i<15;i++) taps[i] = h[i];
+ // d_filter = gr_fir_util::create_gr_fir_ccf(taps);
+
+}
+
+int
+gr_fmdet_cf::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const gr_complex *iptr = (gr_complex *) input_items[0];
+ float *optr = (float *) output_items[0];
+ // const gr_complex *scaleiptr = (gr_complex *) input_items[0];
+
+ int size = noutput_items;
+
+ gr_complex Sdot,S0,S1=d_S1,S2=d_S2,S3=d_S3,S4=d_S4;
+ float d_8 = 8.0;
+
+ while (size-- > 0) {
+ S0=*iptr++;
+
+
+ Sdot = d_scl * (-S0+d_8*S1-d_8*S1+S4);
+
+ d_freq = (S2.real()*Sdot.imag()-S2.imag()*Sdot.real())/
+ (S2.real()*S2.real()+S2.imag()*S2.imag());
+
+ S4=S3;
+ S3=S2;
+ S2=S1;
+ S1=S0;
+
+
+ *optr++ = d_freq-d_bias;
+ }
+ d_S1=S1;
+ d_S2=S2;
+ d_S3=S3;
+ d_S4=S4;
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/general/gr_fmdet_cf.h b/gnuradio-core/src/lib/general/gr_fmdet_cf.h
new file mode 100644
index 000000000..f85630f2f
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_fmdet_cf.h
@@ -0,0 +1,63 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_GR_FMDET_CF_H
+#define INCLUDED_GR_FMDET_CF_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+
+class gr_fmdet_cf;
+typedef boost::shared_ptr<gr_fmdet_cf> gr_fmdet_cf_sptr;
+
+GR_CORE_API gr_fmdet_cf_sptr gr_make_fmdet_cf (float samplerate, float freq_low, float freq_high, float scl);
+
+class gr_fir_ccf;
+
+
+/*!
+ * \brief Implements an IQ slope detector
+ *
+ *
+ * input: stream of complex; output: stream of floats
+ *
+ * This implements a limiting slope detector. The limiter is in the
+ * normalization by the magnitude of the sample
+ */
+
+class GR_CORE_API gr_fmdet_cf : public gr_sync_block
+{
+ friend GR_CORE_API gr_fmdet_cf_sptr gr_make_fmdet_cf (float samplerate, float freq_low,
+ float freq_high, float scl);
+
+ gr_complex d_S1,d_S2,d_S3,d_S4;
+ float d_freq,d_freqlo,d_freqhi,d_scl,d_bias;
+ gr_fir_ccf* d_filter;
+ gr_fmdet_cf (float samplerate, float freq_low, float freq_high, float scl);
+
+ 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/general/gr_fmdet_cf.i b/gnuradio-core/src/lib/general/gr_fmdet_cf.i
new file mode 100644
index 000000000..2db596b7a
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_fmdet_cf.i
@@ -0,0 +1,31 @@
+/* -*- 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,fmdet_cf)
+
+gr_fmdet_cf_sptr gr_make_fmdet_cf (float samplerate, float freq_low, float freq_high, float scl);
+
+class gr_fmdet_cf : public gr_sync_block
+{
+ private:
+ gr_fmdet_cf (float samplerate, float freq_low, float freq_high, float scl);
+};
diff --git a/gnuradio-core/src/lib/general/gr_framer_sink_1.cc b/gnuradio-core/src/lib/general/gr_framer_sink_1.cc
new file mode 100644
index 000000000..64a0af6a0
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_framer_sink_1.cc
@@ -0,0 +1,190 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_framer_sink_1.h>
+#include <gr_io_signature.h>
+#include <cstdio>
+#include <stdexcept>
+#include <string.h>
+
+#define VERBOSE 0
+
+inline void
+gr_framer_sink_1::enter_search()
+{
+ if (VERBOSE)
+ fprintf(stderr, "@ enter_search\n");
+
+ d_state = STATE_SYNC_SEARCH;
+}
+
+inline void
+gr_framer_sink_1::enter_have_sync()
+{
+ if (VERBOSE)
+ fprintf(stderr, "@ enter_have_sync\n");
+
+ d_state = STATE_HAVE_SYNC;
+ d_header = 0;
+ d_headerbitlen_cnt = 0;
+}
+
+inline void
+gr_framer_sink_1::enter_have_header(int payload_len, int whitener_offset)
+{
+ if (VERBOSE)
+ fprintf(stderr, "@ enter_have_header (payload_len = %d) (offset = %d)\n", payload_len, whitener_offset);
+
+ d_state = STATE_HAVE_HEADER;
+ d_packetlen = payload_len;
+ d_packet_whitener_offset = whitener_offset;
+ d_packetlen_cnt = 0;
+ d_packet_byte = 0;
+ d_packet_byte_index = 0;
+}
+
+gr_framer_sink_1_sptr
+gr_make_framer_sink_1(gr_msg_queue_sptr target_queue)
+{
+ return gnuradio::get_initial_sptr(new gr_framer_sink_1(target_queue));
+}
+
+
+gr_framer_sink_1::gr_framer_sink_1(gr_msg_queue_sptr target_queue)
+ : gr_sync_block ("framer_sink_1",
+ gr_make_io_signature (1, 1, sizeof(unsigned char)),
+ gr_make_io_signature (0, 0, 0)),
+ d_target_queue(target_queue)
+{
+ enter_search();
+}
+
+gr_framer_sink_1::~gr_framer_sink_1 ()
+{
+}
+
+int
+gr_framer_sink_1::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const unsigned char *in = (const unsigned char *) input_items[0];
+ int count=0;
+
+ if (VERBOSE)
+ fprintf(stderr,">>> Entering state machine\n");
+
+ while (count < noutput_items){
+ switch(d_state) {
+
+ case STATE_SYNC_SEARCH: // Look for flag indicating beginning of pkt
+ if (VERBOSE)
+ fprintf(stderr,"SYNC Search, noutput=%d\n", noutput_items);
+
+ while (count < noutput_items) {
+ if (in[count] & 0x2){ // Found it, set up for header decode
+ enter_have_sync();
+ break;
+ }
+ count++;
+ }
+ break;
+
+ case STATE_HAVE_SYNC:
+ if (VERBOSE)
+ fprintf(stderr,"Header Search bitcnt=%d, header=0x%08x\n",
+ d_headerbitlen_cnt, d_header);
+
+ while (count < noutput_items) { // Shift bits one at a time into header
+ d_header = (d_header << 1) | (in[count++] & 0x1);
+ if (++d_headerbitlen_cnt == HEADERBITLEN) {
+
+ if (VERBOSE)
+ fprintf(stderr, "got header: 0x%08x\n", d_header);
+
+ // we have a full header, check to see if it has been received properly
+ if (header_ok()){
+ int payload_len;
+ int whitener_offset;
+ header_payload(&payload_len, &whitener_offset);
+ enter_have_header(payload_len, whitener_offset);
+
+ if (d_packetlen == 0){ // check for zero-length payload
+ // build a zero-length message
+ // NOTE: passing header field as arg1 is not scalable
+ gr_message_sptr msg =
+ gr_make_message(0, d_packet_whitener_offset, 0, 0);
+
+ d_target_queue->insert_tail(msg); // send it
+ msg.reset(); // free it up
+
+ enter_search();
+ }
+ }
+ else
+ enter_search(); // bad header
+ break; // we're in a new state
+ }
+ }
+ break;
+
+ case STATE_HAVE_HEADER:
+ if (VERBOSE)
+ fprintf(stderr,"Packet Build\n");
+
+ while (count < noutput_items) { // shift bits into bytes of packet one at a time
+ d_packet_byte = (d_packet_byte << 1) | (in[count++] & 0x1);
+ if (d_packet_byte_index++ == 7) { // byte is full so move to next byte
+ d_packet[d_packetlen_cnt++] = d_packet_byte;
+ d_packet_byte_index = 0;
+
+ if (d_packetlen_cnt == d_packetlen){ // packet is filled
+
+ // build a message
+ // NOTE: passing header field as arg1 is not scalable
+ gr_message_sptr msg =
+ gr_make_message(0, d_packet_whitener_offset, 0, d_packetlen_cnt);
+ memcpy(msg->msg(), d_packet, d_packetlen_cnt);
+
+ d_target_queue->insert_tail(msg); // send it
+ msg.reset(); // free it up
+
+ enter_search();
+ break;
+ }
+ }
+ }
+ break;
+
+ default:
+ assert(0);
+
+ } // switch
+
+ } // while
+
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/general/gr_framer_sink_1.h b/gnuradio-core/src/lib/general/gr_framer_sink_1.h
new file mode 100644
index 000000000..93e41745f
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_framer_sink_1.h
@@ -0,0 +1,107 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005,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.
+ */
+
+#ifndef INCLUDED_GR_FRAMER_SINK_1_H
+#define INCLUDED_GR_FRAMER_SINK_1_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+#include <gr_msg_queue.h>
+
+class gr_framer_sink_1;
+typedef boost::shared_ptr<gr_framer_sink_1> gr_framer_sink_1_sptr;
+
+GR_CORE_API gr_framer_sink_1_sptr
+gr_make_framer_sink_1 (gr_msg_queue_sptr target_queue);
+
+/*!
+ * \brief Given a stream of bits and access_code flags, assemble packets.
+ * \ingroup sink_blk
+ *
+ * input: stream of bytes from gr_correlate_access_code_bb
+ * output: none. Pushes assembled packet into target queue
+ *
+ * The framer expects a fixed length header of 2 16-bit shorts
+ * containing the payload length, followed by the payload. If the
+ * 2 16-bit shorts are not identical, this packet is ignored. Better
+ * algs are welcome.
+ *
+ * The input data consists of bytes that have two bits used.
+ * Bit 0, the LSB, contains the data bit.
+ * Bit 1 if set, indicates that the corresponding bit is the
+ * the first bit of the packet. That is, this bit is the first
+ * one after the access code.
+ */
+class GR_CORE_API gr_framer_sink_1 : public gr_sync_block
+{
+ friend GR_CORE_API gr_framer_sink_1_sptr
+ gr_make_framer_sink_1 (gr_msg_queue_sptr target_queue);
+
+ private:
+ enum state_t {STATE_SYNC_SEARCH, STATE_HAVE_SYNC, STATE_HAVE_HEADER};
+
+ static const int MAX_PKT_LEN = 4096;
+ static const int HEADERBITLEN = 32;
+
+ gr_msg_queue_sptr d_target_queue; // where to send the packet when received
+ state_t d_state;
+ unsigned int d_header; // header bits
+ int d_headerbitlen_cnt; // how many so far
+
+ unsigned char d_packet[MAX_PKT_LEN]; // assembled payload
+ unsigned char d_packet_byte; // byte being assembled
+ int d_packet_byte_index; // which bit of d_packet_byte we're working on
+ int d_packetlen; // length of packet
+ int d_packet_whitener_offset; // offset into whitener string to use
+ int d_packetlen_cnt; // how many so far
+
+ protected:
+ gr_framer_sink_1(gr_msg_queue_sptr target_queue);
+
+ void enter_search();
+ void enter_have_sync();
+ void enter_have_header(int payload_len, int whitener_offset);
+
+ bool header_ok()
+ {
+ // confirm that two copies of header info are identical
+ return ((d_header >> 16) ^ (d_header & 0xffff)) == 0;
+ }
+
+ void header_payload(int *len, int *offset)
+ {
+ // header consists of two 16-bit shorts in network byte order
+ // payload length is lower 12 bits
+ // whitener offset is upper 4 bits
+ *len = (d_header >> 16) & 0x0fff;
+ *offset = (d_header >> 28) & 0x000f;
+ }
+
+ public:
+ ~gr_framer_sink_1();
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif /* INCLUDED_GR_FRAMER_SINK_1_H */
diff --git a/gnuradio-core/src/lib/general/gr_framer_sink_1.i b/gnuradio-core/src/lib/general/gr_framer_sink_1.i
new file mode 100644
index 000000000..06281b138
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_framer_sink_1.i
@@ -0,0 +1,35 @@
+/* -*- 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,framer_sink_1);
+
+gr_framer_sink_1_sptr
+gr_make_framer_sink_1(gr_msg_queue_sptr target_queue);
+
+class gr_framer_sink_1 : public gr_sync_block
+{
+ protected:
+ gr_framer_sink_1(gr_msg_queue_sptr target_queue);
+
+ public:
+ ~gr_framer_sink_1();
+};
diff --git a/gnuradio-core/src/lib/general/gr_frequency_modulator_fc.cc b/gnuradio-core/src/lib/general/gr_frequency_modulator_fc.cc
new file mode 100644
index 000000000..5c4daec58
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_frequency_modulator_fc.cc
@@ -0,0 +1,71 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_frequency_modulator_fc.h>
+#include <gr_io_signature.h>
+#include <gr_fxpt.h>
+#include <math.h>
+#include <boost/math/special_functions/trunc.hpp>
+
+
+gr_frequency_modulator_fc_sptr gr_make_frequency_modulator_fc (double sensitivity)
+{
+ return gnuradio::get_initial_sptr(new gr_frequency_modulator_fc (sensitivity));
+}
+
+gr_frequency_modulator_fc::gr_frequency_modulator_fc (double sensitivity)
+ : gr_sync_block ("frequency_modulator_fc",
+ gr_make_io_signature (1, 1, sizeof (float)),
+ gr_make_io_signature (1, 1, sizeof (gr_complex))),
+ d_sensitivity (sensitivity), d_phase (0)
+{
+}
+
+int
+gr_frequency_modulator_fc::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const float *in = (const float *) input_items[0];
+ gr_complex *out = (gr_complex *) output_items[0];
+
+ for (int i = 0; i < noutput_items; i++){
+ d_phase = d_phase + d_sensitivity * in[i];
+
+ while (d_phase > (float)(M_PI))
+ d_phase -= (float)(2.0 * M_PI);
+ while (d_phase < (float)(-M_PI))
+ d_phase += (float)(2.0 * M_PI);
+
+ float oi, oq;
+
+ gr_int32 angle = gr_fxpt::float_to_fixed (d_phase);
+ gr_fxpt::sincos (angle, &oq, &oi);
+ out[i] = gr_complex (oi, oq);
+ }
+
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/general/gr_frequency_modulator_fc.h b/gnuradio-core/src/lib/general/gr_frequency_modulator_fc.h
new file mode 100644
index 000000000..c680e9648
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_frequency_modulator_fc.h
@@ -0,0 +1,59 @@
+/* -*- 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_FREQUENCY_MODULATOR_FC_H
+#define INCLUDED_GR_FREQUENCY_MODULATOR_FC_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+
+class gr_frequency_modulator_fc;
+typedef boost::shared_ptr<gr_frequency_modulator_fc> gr_frequency_modulator_fc_sptr;
+
+GR_CORE_API gr_frequency_modulator_fc_sptr gr_make_frequency_modulator_fc (double sensitivity);
+
+/*!
+ * \brief Frequency modulator block
+ * \ingroup modulation_blk
+ *
+ * float input; complex baseband output
+ */
+class GR_CORE_API gr_frequency_modulator_fc : public gr_sync_block
+{
+ float d_sensitivity;
+ float d_phase;
+
+ friend GR_CORE_API gr_frequency_modulator_fc_sptr
+ gr_make_frequency_modulator_fc (double sensitivity);
+
+ gr_frequency_modulator_fc (double sensitivity);
+
+ public:
+ void set_sensitivity(float sens) { d_sensitivity = sens; }
+ float sensitivity() const { return d_sensitivity; }
+
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif /* INCLUDED_GR_FREQUENCY_MODULATOR_FC_H */
diff --git a/gnuradio-core/src/lib/general/gr_frequency_modulator_fc.i b/gnuradio-core/src/lib/general/gr_frequency_modulator_fc.i
new file mode 100644
index 000000000..9a740583b
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_frequency_modulator_fc.i
@@ -0,0 +1,34 @@
+/* -*- 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,frequency_modulator_fc)
+
+gr_frequency_modulator_fc_sptr gr_make_frequency_modulator_fc (double sensitivity);
+
+class gr_frequency_modulator_fc : public gr_sync_block
+{
+ private:
+ gr_frequency_modulator_fc (double sensitivity);
+public:
+ void set_sensitivity(float sens) { d_sensitivity = sens; }
+ float sensitivity() const { return d_sensitivity; }
+};
diff --git a/gnuradio-core/src/lib/general/gr_fxpt.cc b/gnuradio-core/src/lib/general/gr_fxpt.cc
new file mode 100644
index 000000000..2ea8520e6
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_fxpt.cc
@@ -0,0 +1,35 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_fxpt.h>
+
+const float gr_fxpt::s_sine_table[1 << NBITS][2] = {
+#include "sine_table.h"
+};
+
+const float gr_fxpt::PI = 3.14159265358979323846;
+const float gr_fxpt::TWO_TO_THE_31 = 2147483648.0;
+
diff --git a/gnuradio-core/src/lib/general/gr_fxpt.h b/gnuradio-core/src/lib/general/gr_fxpt.h
new file mode 100644
index 000000000..9de6c0c18
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_fxpt.h
@@ -0,0 +1,104 @@
+/* -*- 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_FXPT_H
+#define INCLUDED_GR_FXPT_H
+
+#include <gr_core_api.h>
+#include <gr_types.h>
+
+/*!
+ * \brief fixed point sine and cosine and friends.
+ * \ingroup misc
+ *
+ * fixed pt radians
+ * --------- --------
+ * -2**31 -pi
+ * 0 0
+ * 2**31-1 pi - epsilon
+ *
+ */
+class GR_CORE_API gr_fxpt
+{
+ static const int WORDBITS = 32;
+ static const int NBITS = 10;
+ static const float s_sine_table[1 << NBITS][2];
+ static const float PI;
+ static const float TWO_TO_THE_31;
+public:
+
+ static gr_int32
+ float_to_fixed (float x)
+ {
+ // Fold x into -PI to PI.
+ int d = (int)floor(x/2/PI+0.5);
+ x -= d*2*PI;
+ // And convert to an integer.
+ return (gr_int32) ((float) x * TWO_TO_THE_31 / PI);
+ }
+
+ static float
+ fixed_to_float (gr_int32 x)
+ {
+ return x * (PI / TWO_TO_THE_31);
+ }
+
+ /*!
+ * \brief Given a fixed point angle x, return float sine (x)
+ */
+ static float
+ sin (gr_int32 x)
+ {
+ gr_uint32 ux = x;
+ int index = ux >> (WORDBITS - NBITS);
+ return s_sine_table[index][0] * (ux >> 1) + s_sine_table[index][1];
+ }
+
+ /*
+ * \brief Given a fixed point angle x, return float cosine (x)
+ */
+ static float
+ cos (gr_int32 x)
+ {
+ gr_uint32 ux = x + 0x40000000;
+ int index = ux >> (WORDBITS - NBITS);
+ return s_sine_table[index][0] * (ux >> 1) + s_sine_table[index][1];
+ }
+
+ /*
+ * \brief Given a fixedpoint angle x, return float cos(x) and sin (x)
+ */
+ static void sincos(gr_int32 x, float *s, float *c)
+ {
+ gr_uint32 ux = x;
+ int sin_index = ux >> (WORDBITS - NBITS);
+ *s = s_sine_table[sin_index][0] * (ux >> 1) + s_sine_table[sin_index][1];
+
+ ux = x + 0x40000000;
+ int cos_index = ux >> (WORDBITS - NBITS);
+ *c = s_sine_table[cos_index][0] * (ux >> 1) + s_sine_table[cos_index][1];
+
+ return;
+ }
+
+};
+
+#endif /* INCLUDED_GR_FXPT_H */
diff --git a/gnuradio-core/src/lib/general/gr_fxpt_nco.h b/gnuradio-core/src/lib/general/gr_fxpt_nco.h
new file mode 100644
index 000000000..9473e6ddb
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_fxpt_nco.h
@@ -0,0 +1,153 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002,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_FXPT_NCO_H
+#define INCLUDED_GR_FXPT_NCO_H
+
+#include <gr_core_api.h>
+#include <gr_fxpt.h>
+#include <gr_complex.h>
+
+/*!
+ * \brief Numerically Controlled Oscillator (NCO)
+ * \ingroup misc
+ */
+class GR_CORE_API gr_fxpt_nco {
+ gr_uint32 d_phase;
+ gr_int32 d_phase_inc;
+
+public:
+ gr_fxpt_nco () : d_phase (0), d_phase_inc (0) {}
+
+ ~gr_fxpt_nco () {}
+
+ // radians
+ void set_phase (float angle) {
+ d_phase = gr_fxpt::float_to_fixed (angle);
+ }
+
+ void adjust_phase (float delta_phase) {
+ d_phase += gr_fxpt::float_to_fixed (delta_phase);
+ }
+
+ // angle_rate is in radians / step
+ void set_freq (float angle_rate){
+ d_phase_inc = gr_fxpt::float_to_fixed (angle_rate);
+ }
+
+ // angle_rate is a delta in radians / step
+ void adjust_freq (float delta_angle_rate)
+ {
+ d_phase_inc += gr_fxpt::float_to_fixed (delta_angle_rate);
+ }
+
+ // increment current phase angle
+
+ void step ()
+ {
+ d_phase += d_phase_inc;
+ }
+
+ void step (int n)
+ {
+ d_phase += d_phase_inc * n;
+ }
+
+ // units are radians / step
+ float get_phase () const { return gr_fxpt::fixed_to_float (d_phase); }
+ float get_freq () const { return gr_fxpt::fixed_to_float (d_phase_inc); }
+
+ // compute sin and cos for current phase angle
+ void sincos (float *sinx, float *cosx) const
+ {
+ *sinx = gr_fxpt::sin (d_phase);
+ *cosx = gr_fxpt::cos (d_phase);
+ }
+
+ // compute cos and sin for a block of phase angles
+ void sincos (gr_complex *output, int noutput_items, double ampl=1.0)
+ {
+ for (int i = 0; i < noutput_items; i++){
+ output[i] = gr_complex(gr_fxpt::cos (d_phase) * ampl, gr_fxpt::sin (d_phase) * ampl);
+ step ();
+ }
+ }
+
+ // compute sin for a block of phase angles
+ void sin (float *output, int noutput_items, double ampl=1.0)
+ {
+ for (int i = 0; i < noutput_items; i++){
+ output[i] = (float)(gr_fxpt::sin (d_phase) * ampl);
+ step ();
+ }
+ }
+
+ // compute cos for a block of phase angles
+ void cos (float *output, int noutput_items, double ampl=1.0)
+ {
+ for (int i = 0; i < noutput_items; i++){
+ output[i] = (float)(gr_fxpt::cos (d_phase) * ampl);
+ step ();
+ }
+ }
+
+ // compute sin for a block of phase angles
+ void sin (short *output, int noutput_items, double ampl=1.0)
+ {
+ for (int i = 0; i < noutput_items; i++){
+ output[i] = (short)(gr_fxpt::sin (d_phase) * ampl);
+ step ();
+ }
+ }
+
+ // compute cos for a block of phase angles
+ void cos (short *output, int noutput_items, double ampl=1.0)
+ {
+ for (int i = 0; i < noutput_items; i++){
+ output[i] = (short)(gr_fxpt::cos (d_phase) * ampl);
+ step ();
+ }
+ }
+
+ // compute sin for a block of phase angles
+ void sin (int *output, int noutput_items, double ampl=1.0)
+ {
+ for (int i = 0; i < noutput_items; i++){
+ output[i] = (int)(gr_fxpt::sin (d_phase) * ampl);
+ step ();
+ }
+ }
+
+ // compute cos for a block of phase angles
+ void cos (int *output, int noutput_items, double ampl=1.0)
+ {
+ for (int i = 0; i < noutput_items; i++){
+ output[i] = (int)(gr_fxpt::cos (d_phase) * ampl);
+ step ();
+ }
+ }
+
+ // compute cos or sin for current phase angle
+ float cos () const { return gr_fxpt::cos (d_phase); }
+ float sin () const { return gr_fxpt::sin (d_phase); }
+};
+
+#endif /* INCLUDED_GR_FXPT_NCO_H */
diff --git a/gnuradio-core/src/lib/general/gr_fxpt_vco.h b/gnuradio-core/src/lib/general/gr_fxpt_vco.h
new file mode 100644
index 000000000..09c649de7
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_fxpt_vco.h
@@ -0,0 +1,73 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002,2004,2005 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_FXPT_VCO_H
+#define INCLUDED_GR_FXPT_VCO_H
+
+#include <gr_core_api.h>
+#include <gr_fxpt.h>
+#include <gr_complex.h>
+
+/*!
+ * \brief Voltage Controlled Oscillator (VCO)
+ * \ingroup misc
+ */
+class GR_CORE_API gr_fxpt_vco {
+ gr_int32 d_phase;
+
+public:
+ gr_fxpt_vco () : d_phase (0) {}
+
+ ~gr_fxpt_vco () {}
+
+ // radians
+ void set_phase (float angle) {
+ d_phase = gr_fxpt::float_to_fixed (angle);
+ }
+
+ void adjust_phase (float delta_phase) {
+ d_phase += gr_fxpt::float_to_fixed (delta_phase);
+ }
+
+ float get_phase () const { return gr_fxpt::fixed_to_float (d_phase); }
+
+ // compute sin and cos for current phase angle
+ void sincos (float *sinx, float *cosx) const
+ {
+ *sinx = gr_fxpt::sin (d_phase);
+ *cosx = gr_fxpt::cos (d_phase);
+ }
+
+ // compute a block at a time
+ void cos (float *output, const float *input, int noutput_items, float k, float ampl = 1.0)
+ {
+ for (int i = 0; i < noutput_items; i++){
+ output[i] = (float)(gr_fxpt::cos (d_phase) * ampl);
+ adjust_phase(input[i] * k);
+ }
+ }
+
+ // compute cos or sin for current phase angle
+ float cos () const { return gr_fxpt::cos (d_phase); }
+ float sin () const { return gr_fxpt::sin (d_phase); }
+};
+
+#endif /* INCLUDED_GR_FXPT_VCO_H */
diff --git a/gnuradio-core/src/lib/general/gr_glfsr_source_b.cc b/gnuradio-core/src/lib/general/gr_glfsr_source_b.cc
new file mode 100644
index 000000000..fcfeb80dc
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_glfsr_source_b.cc
@@ -0,0 +1,84 @@
+/* -*- 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.
+ */
+
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <gr_glfsr_source_b.h>
+#include <gri_glfsr.h>
+#include <gr_io_signature.h>
+#include <stdexcept>
+
+gr_glfsr_source_b_sptr
+gr_make_glfsr_source_b(int degree, bool repeat, int mask, int seed)
+{
+ return gnuradio::get_initial_sptr(new gr_glfsr_source_b(degree, repeat, mask, seed));
+}
+
+gr_glfsr_source_b::gr_glfsr_source_b(int degree, bool repeat, int mask, int seed)
+ : gr_sync_block ("glfsr_source_b",
+ gr_make_io_signature (0, 0, 0),
+ gr_make_io_signature (1, 1, sizeof(unsigned char))),
+ d_repeat(repeat),
+ d_index(0)
+{
+ if (degree < 1 || degree > 32)
+ throw std::runtime_error("gr_glfsr_source_b: degree must be between 1 and 32 inclusive");
+ d_length = (unsigned int)((1ULL << degree)-1);
+
+ if (mask == 0)
+ mask = gri_glfsr::glfsr_mask(degree);
+ d_glfsr = new gri_glfsr(mask, seed);
+}
+
+gr_glfsr_source_b::~gr_glfsr_source_b()
+{
+ delete d_glfsr;
+}
+
+int
+gr_glfsr_source_b::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ char *out = (char *) output_items[0];
+ if ((d_index > d_length) && d_repeat == false)
+ return -1; /* once through the sequence */
+
+ int i;
+ for (i = 0; i < noutput_items; i++) {
+ out[i] = d_glfsr->next_bit();
+ d_index++;
+ if (d_index > d_length && d_repeat == false)
+ break;
+ }
+
+ return i;
+}
+
+int
+gr_glfsr_source_b::mask() const
+{
+ return d_glfsr->mask();
+}
diff --git a/gnuradio-core/src/lib/general/gr_glfsr_source_b.h b/gnuradio-core/src/lib/general/gr_glfsr_source_b.h
new file mode 100644
index 000000000..7549a76b3
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_glfsr_source_b.h
@@ -0,0 +1,66 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_GR_GLFSR_SOURCE_B_H
+#define INCLUDED_GR_GLFSR_SOURCE_B_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+
+class gri_glfsr;
+
+class gr_glfsr_source_b;
+typedef boost::shared_ptr<gr_glfsr_source_b> gr_glfsr_source_b_sptr;
+
+GR_CORE_API gr_glfsr_source_b_sptr gr_make_glfsr_source_b(int degree, bool repeat=true, int mask=0, int seed=1);
+
+/*!
+ * \brief Galois LFSR pseudo-random source
+ * \ingroup source_blk
+ */
+class GR_CORE_API gr_glfsr_source_b : public gr_sync_block
+{
+ private:
+ friend GR_CORE_API gr_glfsr_source_b_sptr
+ gr_make_glfsr_source_b(int degree, bool repeat, int mask, int seed);
+
+ gri_glfsr *d_glfsr;
+
+ bool d_repeat;
+ unsigned int d_index;
+ unsigned int d_length;
+
+ gr_glfsr_source_b(int degree, bool repeat, int mask, int seed);
+
+ public:
+
+ ~gr_glfsr_source_b();
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+
+ unsigned int period() const { return d_length; }
+ int mask() const;
+};
+
+#endif /* INCLUDED_GR_GLFSR_SOURCE_B_H */
diff --git a/gnuradio-core/src/lib/general/gr_glfsr_source_b.i b/gnuradio-core/src/lib/general/gr_glfsr_source_b.i
new file mode 100644
index 000000000..ffdd52ddb
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_glfsr_source_b.i
@@ -0,0 +1,37 @@
+/* -*- 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,glfsr_source_b);
+
+gr_glfsr_source_b_sptr
+gr_make_glfsr_source_b(int degree, bool repeat=true, int mask=0, int seed=1)
+ throw (std::runtime_error);
+
+class gr_glfsr_source_b : public gr_sync_block
+{
+protected:
+ gr_glfsr_source_b(int degree, bool repeat, int mask, int seed);
+
+public:
+ unsigned int period() const;
+ int mask() const;
+};
diff --git a/gnuradio-core/src/lib/general/gr_glfsr_source_f.cc b/gnuradio-core/src/lib/general/gr_glfsr_source_f.cc
new file mode 100644
index 000000000..a9efc8a70
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_glfsr_source_f.cc
@@ -0,0 +1,84 @@
+/* -*- 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.
+ */
+
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <gr_glfsr_source_f.h>
+#include <gri_glfsr.h>
+#include <gr_io_signature.h>
+#include <stdexcept>
+
+gr_glfsr_source_f_sptr
+gr_make_glfsr_source_f(int degree, bool repeat, int mask, int seed)
+{
+ return gnuradio::get_initial_sptr(new gr_glfsr_source_f(degree, repeat, mask, seed));
+}
+
+gr_glfsr_source_f::gr_glfsr_source_f(int degree, bool repeat, int mask, int seed)
+ : gr_sync_block ("glfsr_source_f",
+ gr_make_io_signature (0, 0, 0),
+ gr_make_io_signature (1, 1, sizeof(float))),
+ d_repeat(repeat),
+ d_index(0)
+{
+ if (degree < 1 || degree > 32)
+ throw std::runtime_error("gr_glfsr_source_f: degree must be between 1 and 32 inclusive");
+ d_length = (unsigned int)((1ULL << degree)-1);
+
+ if (mask == 0)
+ mask = gri_glfsr::glfsr_mask(degree);
+ d_glfsr = new gri_glfsr(mask, seed);
+}
+
+gr_glfsr_source_f::~gr_glfsr_source_f()
+{
+ delete d_glfsr;
+}
+
+int
+gr_glfsr_source_f::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ float *out = (float *) output_items[0];
+ if ((d_index > d_length) && d_repeat == false)
+ return -1; /* once through the sequence */
+
+ int i;
+ for (i = 0; i < noutput_items; i++) {
+ out[i] = (float)d_glfsr->next_bit()*2.0-1.0;
+ d_index++;
+ if (d_index > d_length && d_repeat == false)
+ break;
+ }
+
+ return i;
+}
+
+int
+gr_glfsr_source_f::mask() const
+{
+ return d_glfsr->mask();
+}
diff --git a/gnuradio-core/src/lib/general/gr_glfsr_source_f.h b/gnuradio-core/src/lib/general/gr_glfsr_source_f.h
new file mode 100644
index 000000000..3549e3e5d
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_glfsr_source_f.h
@@ -0,0 +1,66 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_GR_GLFSR_SOURCE_F_H
+#define INCLUDED_GR_GLFSR_SOURCE_F_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+
+class gri_glfsr;
+
+class gr_glfsr_source_f;
+typedef boost::shared_ptr<gr_glfsr_source_f> gr_glfsr_source_f_sptr;
+
+GR_CORE_API gr_glfsr_source_f_sptr gr_make_glfsr_source_f(int degree, bool repeat=true, int mask=0, int seed=1);
+
+/*!
+ * \brief Galois LFSR pseudo-random source generating float outputs -1.0 - 1.0
+ * \ingroup source_blk
+ */
+class GR_CORE_API gr_glfsr_source_f : public gr_sync_block
+{
+ private:
+ friend GR_CORE_API gr_glfsr_source_f_sptr
+ gr_make_glfsr_source_f(int degree, bool repeat, int mask, int seed);
+
+ gri_glfsr *d_glfsr;
+
+ bool d_repeat;
+ unsigned int d_index;
+ unsigned int d_length;
+
+ gr_glfsr_source_f(int degree, bool repeat, int mask, int seed);
+
+ public:
+
+ ~gr_glfsr_source_f();
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+
+ unsigned int period() const { return d_length; }
+ int mask() const;
+};
+
+#endif /* INCLUDED_GR_GLFSR_SOURCE_F_H */
diff --git a/gnuradio-core/src/lib/general/gr_glfsr_source_f.i b/gnuradio-core/src/lib/general/gr_glfsr_source_f.i
new file mode 100644
index 000000000..2f84387c2
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_glfsr_source_f.i
@@ -0,0 +1,37 @@
+/* -*- 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,glfsr_source_f);
+
+gr_glfsr_source_f_sptr
+gr_make_glfsr_source_f(int degree, bool repeat=true, int mask=0, int seed=1)
+ throw (std::runtime_error);
+
+class gr_glfsr_source_f : public gr_sync_block
+{
+protected:
+ gr_glfsr_source_f(int degree, bool repeat, int mask, int seed);
+
+public:
+ unsigned int period() const;
+ int mask() const;
+};
diff --git a/gnuradio-core/src/lib/general/gr_head.cc b/gnuradio-core/src/lib/general/gr_head.cc
new file mode 100644
index 000000000..cb07c84dd
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_head.cc
@@ -0,0 +1,61 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <gr_head.h>
+#include <gr_io_signature.h>
+#include <string.h>
+
+gr_head::gr_head (size_t sizeof_stream_item, unsigned long long nitems)
+ : gr_sync_block ("head",
+ gr_make_io_signature (1, 1, sizeof_stream_item),
+ gr_make_io_signature (1, 1, sizeof_stream_item)),
+ d_nitems (nitems), d_ncopied_items (0)
+{
+}
+
+gr_head_sptr
+gr_make_head (size_t sizeof_stream_item, unsigned long long nitems)
+{
+ return gnuradio::get_initial_sptr(new gr_head (sizeof_stream_item, nitems));
+}
+
+int
+gr_head::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ if (d_ncopied_items >= d_nitems)
+ return -1; // Done!
+
+ unsigned n = std::min (d_nitems - d_ncopied_items, (unsigned long long) noutput_items);
+
+ if (n == 0)
+ return 0;
+
+ memcpy (output_items[0], input_items[0], n * input_signature()->sizeof_stream_item (0));
+ d_ncopied_items += n;
+
+ return n;
+}
diff --git a/gnuradio-core/src/lib/general/gr_head.h b/gnuradio-core/src/lib/general/gr_head.h
new file mode 100644
index 000000000..48415892d
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_head.h
@@ -0,0 +1,61 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2009,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 INCLUDED_GR_HEAD_H
+#define INCLUDED_GR_HEAD_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+#include <stddef.h> // size_t
+
+class gr_head;
+typedef boost::shared_ptr<gr_head> gr_head_sptr;
+
+/*!
+ * \brief copies the first N items to the output then signals done
+ * \ingroup slicedice_blk
+ *
+ * Useful for building test cases
+ */
+
+class GR_CORE_API gr_head : public gr_sync_block
+{
+ friend GR_CORE_API gr_head_sptr gr_make_head (size_t sizeof_stream_item, unsigned long long nitems);
+ gr_head (size_t sizeof_stream_item, unsigned long long nitems);
+
+ unsigned long long d_nitems;
+ unsigned long long d_ncopied_items;
+
+ public:
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+
+ void reset() { d_ncopied_items = 0; }
+ void set_length(int nitems) { d_nitems = nitems; }
+};
+
+GR_CORE_API gr_head_sptr
+gr_make_head (size_t sizeof_stream_item, unsigned long long nitems);
+
+
+#endif /* INCLUDED_GR_HEAD_H */
diff --git a/gnuradio-core/src/lib/general/gr_head.i b/gnuradio-core/src/lib/general/gr_head.i
new file mode 100644
index 000000000..11f3331d4
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_head.i
@@ -0,0 +1,33 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2009,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,head);
+
+gr_head_sptr gr_make_head(size_t sizeof_stream_item, unsigned long long nitems);
+
+class gr_head : public gr_block {
+ gr_head();
+public:
+ void reset();
+ void set_length(int nitems);
+};
+
diff --git a/gnuradio-core/src/lib/general/gr_int_to_float.cc b/gnuradio-core/src/lib/general/gr_int_to_float.cc
new file mode 100644
index 000000000..a7fb24dc6
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_int_to_float.cc
@@ -0,0 +1,67 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2011,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 <gr_int_to_float.h>
+#include <gr_io_signature.h>
+#include <volk/volk.h>
+
+gr_int_to_float_sptr
+gr_make_int_to_float (size_t vlen, float scale)
+{
+ return gnuradio::get_initial_sptr(new gr_int_to_float (vlen, scale));
+}
+
+gr_int_to_float::gr_int_to_float (size_t vlen, float scale)
+ : gr_sync_block ("gr_int_to_float",
+ gr_make_io_signature (1, 1, sizeof (int32_t)*vlen),
+ gr_make_io_signature (1, 1, sizeof (float)*vlen)),
+ d_vlen(vlen), d_scale(scale)
+{
+ const int alignment_multiple =
+ volk_get_alignment() / sizeof(float);
+ set_alignment(std::max(1,alignment_multiple));
+}
+
+int
+gr_int_to_float::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const int32_t *in = (const int32_t *) input_items[0];
+ float *out = (float *) output_items[0];
+
+ if(is_unaligned()) {
+ volk_32i_s32f_convert_32f_u(out, in, d_scale, d_vlen*noutput_items);
+ }
+ else {
+ volk_32i_s32f_convert_32f_a(out, in, d_scale, d_vlen*noutput_items);
+ }
+
+ return noutput_items;
+}
+
+
+
diff --git a/gnuradio-core/src/lib/general/gr_int_to_float.h b/gnuradio-core/src/lib/general/gr_int_to_float.h
new file mode 100644
index 000000000..6200c5be7
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_int_to_float.h
@@ -0,0 +1,70 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2011,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 INCLUDED_GR_INT_TO_FLOAT_H
+#define INCLUDED_GR_INT_TO_FLOAT_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+
+class gr_int_to_float;
+typedef boost::shared_ptr<gr_int_to_float> gr_int_to_float_sptr;
+
+GR_CORE_API gr_int_to_float_sptr
+gr_make_int_to_float (size_t vlen=1, float scale=1);
+
+/*!
+ * \brief Convert stream of int to a stream of float
+ * \ingroup converter_blk
+ *
+ * \param vlen vector length of data streams.
+ * \param scale a scalar divider to change the output signal scale.
+ */
+
+class GR_CORE_API gr_int_to_float : public gr_sync_block
+{
+ private:
+ friend GR_CORE_API gr_int_to_float_sptr
+ gr_make_int_to_float (size_t vlen, float scale);
+ gr_int_to_float (size_t vlen, float scale);
+
+ size_t d_vlen;
+ float d_scale;
+
+ public:
+ /*!
+ * Get the scalar divider value.
+ */
+ float scale() const;
+
+ /*!
+ * Set the scalar divider value.
+ */
+ void set_scale(float scale);
+
+ virtual int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+
+#endif /* INCLUDED_GR_INT_TO_FLOAT_H */
diff --git a/gnuradio-core/src/lib/general/gr_int_to_float.i b/gnuradio-core/src/lib/general/gr_int_to_float.i
new file mode 100644
index 000000000..f3781ac8a
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_int_to_float.i
@@ -0,0 +1,32 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2011,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,int_to_float)
+
+gr_int_to_float_sptr
+gr_make_int_to_float (size_t vlen=1, float scale=1);
+
+class gr_int_to_float : public gr_sync_block
+{
+ float scale() const;
+ void set_scale(float scale);
+};
diff --git a/gnuradio-core/src/lib/general/gr_interleave.cc b/gnuradio-core/src/lib/general/gr_interleave.cc
new file mode 100644
index 000000000..5d572871e
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_interleave.cc
@@ -0,0 +1,77 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_interleave.h>
+#include <gr_io_signature.h>
+#include <string.h>
+
+
+gr_interleave_sptr
+gr_make_interleave (size_t itemsize)
+{
+ return gnuradio::get_initial_sptr(new gr_interleave (itemsize));
+}
+
+gr_interleave::gr_interleave (size_t itemsize)
+ : gr_sync_interpolator ("interleave",
+ gr_make_io_signature (1, gr_io_signature::IO_INFINITE, itemsize),
+ gr_make_io_signature (1, 1, itemsize),
+ 1),
+ d_itemsize (itemsize)
+{
+}
+
+gr_interleave::~gr_interleave ()
+{
+ // NOP
+}
+
+bool
+gr_interleave::check_topology (int ninputs, int noutputs)
+{
+ set_interpolation (ninputs);
+ return true;
+}
+
+int
+gr_interleave::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ size_t nchan = input_items.size ();
+ size_t itemsize = d_itemsize;
+ const char **in = (const char **) &input_items[0];
+ char *out = (char *) output_items[0];
+
+ for (int i = 0; i < noutput_items; i += nchan){
+ for (unsigned int n = 0; n < nchan; n++){
+ memcpy (out, in[n], itemsize);
+ out += itemsize;
+ in[n] += itemsize;
+ }
+ }
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/general/gr_interleave.h b/gnuradio-core/src/lib/general/gr_interleave.h
new file mode 100644
index 000000000..3b0202d00
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_interleave.h
@@ -0,0 +1,57 @@
+/* -*- 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_INTERLEAVE_H
+#define INCLUDED_GR_INTERLEAVE_H
+
+#include <gr_core_api.h>
+#include <gr_sync_interpolator.h>
+
+class gr_interleave;
+typedef boost::shared_ptr<gr_interleave> gr_interleave_sptr;
+
+GR_CORE_API gr_interleave_sptr gr_make_interleave (size_t itemsize);
+
+/*!
+ * \brief interleave N inputs to a single output
+ * \ingroup slicedice_blk
+ */
+class GR_CORE_API gr_interleave : public gr_sync_interpolator
+{
+ friend GR_CORE_API gr_interleave_sptr gr_make_interleave (size_t itemsize);
+
+ size_t d_itemsize;
+
+ gr_interleave (size_t itemsize);
+
+public:
+ ~gr_interleave ();
+
+ 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);
+
+};
+
+#endif /* INCLUDED_GR_INTERLEAVE_H */
diff --git a/gnuradio-core/src/lib/general/gr_interleave.i b/gnuradio-core/src/lib/general/gr_interleave.i
new file mode 100644
index 000000000..09a57c886
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_interleave.i
@@ -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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,interleave)
+
+gr_interleave_sptr gr_make_interleave (size_t itemsize);
+
+class gr_interleave : public gr_sync_interpolator
+{
+ gr_interleave (size_t itemsize);
+};
diff --git a/gnuradio-core/src/lib/general/gr_interleaved_short_to_complex.cc b/gnuradio-core/src/lib/general/gr_interleaved_short_to_complex.cc
new file mode 100644
index 000000000..e7d375a35
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_interleaved_short_to_complex.cc
@@ -0,0 +1,59 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_interleaved_short_to_complex.h>
+#include <gr_io_signature.h>
+#include <gri_interleaved_short_to_complex.h>
+
+gr_interleaved_short_to_complex_sptr
+gr_make_interleaved_short_to_complex ()
+{
+ return gnuradio::get_initial_sptr(new gr_interleaved_short_to_complex ());
+}
+
+gr_interleaved_short_to_complex::gr_interleaved_short_to_complex ()
+ : gr_sync_decimator ("gr_interleaved_short_to_complex",
+ gr_make_io_signature (1, 1, sizeof (short)),
+ gr_make_io_signature (1, 1, sizeof (gr_complex)),
+ 2)
+{
+}
+
+int
+gr_interleaved_short_to_complex::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const short *in = (const short *) input_items[0];
+ gr_complex *out = (gr_complex *) output_items[0];
+
+ gri_interleaved_short_to_complex (in, out, 2 * noutput_items);
+
+ return noutput_items;
+}
+
+
+
diff --git a/gnuradio-core/src/lib/general/gr_interleaved_short_to_complex.h b/gnuradio-core/src/lib/general/gr_interleaved_short_to_complex.h
new file mode 100644
index 000000000..159d107b3
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_interleaved_short_to_complex.h
@@ -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.
+ */
+
+#ifndef INCLUDED_GR_INTERLEAVED_SHORT_TO_COMPLEX_H
+#define INCLUDED_GR_INTERLEAVED_SHORT_TO_COMPLEX_H
+
+#include <gr_core_api.h>
+#include <gr_sync_decimator.h>
+
+class gr_interleaved_short_to_complex;
+typedef boost::shared_ptr<gr_interleaved_short_to_complex>
+ gr_interleaved_short_to_complex_sptr;
+
+GR_CORE_API gr_interleaved_short_to_complex_sptr
+gr_make_interleaved_short_to_complex ();
+
+/*!
+ * \brief Convert stream of interleaved shorts to a stream of complex
+ * \ingroup converter_blk
+ */
+
+class GR_CORE_API gr_interleaved_short_to_complex : public gr_sync_decimator
+{
+ friend GR_CORE_API gr_interleaved_short_to_complex_sptr gr_make_interleaved_short_to_complex ();
+ gr_interleaved_short_to_complex ();
+
+ public:
+ virtual int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif /* INCLUDED_GR_INTERLEAVED_SHORT_TO_COMPLEX_H */
diff --git a/gnuradio-core/src/lib/general/gr_interleaved_short_to_complex.i b/gnuradio-core/src/lib/general/gr_interleaved_short_to_complex.i
new file mode 100644
index 000000000..797710550
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_interleaved_short_to_complex.i
@@ -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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,interleaved_short_to_complex)
+
+gr_interleaved_short_to_complex_sptr gr_make_interleaved_short_to_complex ();
+
+class gr_interleaved_short_to_complex : public gr_sync_decimator
+{
+ gr_interleaved_short_to_complex ();
+};
diff --git a/gnuradio-core/src/lib/general/gr_iqcomp_cc.cc b/gnuradio-core/src/lib/general/gr_iqcomp_cc.cc
new file mode 100644
index 000000000..599b25b72
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_iqcomp_cc.cc
@@ -0,0 +1,62 @@
+/* -*- 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.
+ */
+
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_iqcomp_cc.h>
+#include <gr_io_signature.h>
+
+gr_iqcomp_cc_sptr
+gr_make_iqcomp_cc (float mu)
+{
+ return gnuradio::get_initial_sptr(new gr_iqcomp_cc (mu));
+}
+
+gr_iqcomp_cc::gr_iqcomp_cc (float mu)
+ : gr_sync_block ("iqcomp_cc",
+ gr_make_io_signature (1, 1, sizeof (gr_complex)),
+ gr_make_io_signature (1, 1, sizeof (gr_complex))),
+ d_mu (mu)
+{
+ d_wi=0.0;
+ d_wq=0.0;
+}
+
+int
+gr_iqcomp_cc::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const gr_complex *iptr = (gr_complex *) input_items[0];
+ // gr_complex *optr = (gr_complex *) output_items[0];
+
+ for(int i = 0 ; i < noutput_items ; i++) {
+ float i_out = iptr[i].real() - iptr[i].imag() * d_wq;
+ float q_out = iptr[i].imag() - iptr[i].real() * d_wi;
+ d_wi += d_mu * q_out * iptr[i].real();
+ d_wq += d_mu * i_out * iptr[i].imag();
+ }
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/general/gr_iqcomp_cc.h b/gnuradio-core/src/lib/general/gr_iqcomp_cc.h
new file mode 100644
index 000000000..2f5a44ebf
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_iqcomp_cc.h
@@ -0,0 +1,55 @@
+/* -*- 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_IQCOMP_CC_H
+#define INCLUDED_GR_IQCOMP_CC_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+
+class gr_iqcomp_cc;
+typedef boost::shared_ptr<gr_iqcomp_cc> gr_iqcomp_cc_sptr;
+
+GR_CORE_API gr_iqcomp_cc_sptr gr_make_iqcomp_cc (float mu);
+
+/*!
+ * \brief
+ * \ingroup misc_blk
+ */
+class GR_CORE_API gr_iqcomp_cc : public gr_sync_block
+{
+ friend GR_CORE_API gr_iqcomp_cc_sptr gr_make_iqcomp_cc (float mu);
+
+ float d_mu, d_wi, d_wq;
+ gr_iqcomp_cc (float mu);
+
+ public:
+ float mu () const { return d_mu; }
+ void set_mu (float mu) { d_mu = mu; }
+
+ 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/general/gr_iqcomp_cc.i b/gnuradio-core/src/lib/general/gr_iqcomp_cc.i
new file mode 100644
index 000000000..5cca59dd5
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_iqcomp_cc.i
@@ -0,0 +1,36 @@
+/* -*- 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.
+ */
+
+
+GR_SWIG_BLOCK_MAGIC(gr,iqcomp_cc)
+
+gr_iqcomp_cc_sptr gr_make_iqcomp_cc (float mu);
+
+class gr_iqcomp_cc : public gr_sync_block
+{
+ private:
+ gr_iqcomp_cc (float mu);
+
+ public:
+ float mu () const { return d_mu; }
+ void set_mu (float mu) { d_mu = mu; }
+};
diff --git a/gnuradio-core/src/lib/general/gr_keep_m_in_n.cc b/gnuradio-core/src/lib/general/gr_keep_m_in_n.cc
new file mode 100644
index 000000000..1becbfa11
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_keep_m_in_n.cc
@@ -0,0 +1,98 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_keep_m_in_n.h>
+#include <gr_io_signature.h>
+#include <string.h>
+#include <stdio.h>
+
+gr_keep_m_in_n_sptr
+gr_make_keep_m_in_n(size_t item_size, int m, int n, int offset)
+{
+ return gnuradio::get_initial_sptr(new gr_keep_m_in_n(item_size, m, n, offset));
+}
+
+
+/*
+*
+* offset = 0, starts with 0th item
+* offset = 1, starts with 1st item, etc...
+*
+* we take m items out of each n
+*/
+gr_keep_m_in_n::gr_keep_m_in_n(size_t item_size, int m, int n, int offset)
+ : gr_block("keep_m_in_n",
+ gr_make_io_signature(1, 1, item_size),
+ gr_make_io_signature(1, 1, item_size)),
+ d_n(n),
+ d_m(m),
+ d_offset(offset),
+ d_itemsize(item_size)
+{
+ // sanity checking
+ assert(d_m > 0);
+ assert(d_n > 0);
+ assert(d_m <= d_n);
+ assert(d_offset <= (d_n-d_m));
+
+ set_output_multiple(m);
+}
+
+
+void
+gr_keep_m_in_n::forecast(int noutput_items, gr_vector_int &ninput_items_required)
+{
+ ninput_items_required[0] = d_n*(noutput_items/d_m);
+}
+
+void
+gr_keep_m_in_n::set_offset(int offset)
+{
+ d_offset = offset;
+}
+
+int
+gr_keep_m_in_n::general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ uint8_t* out = (uint8_t*)output_items[0];
+ const uint8_t* in = (const uint8_t*)input_items[0];
+
+ // iterate over data blocks of size {n, input : m, output}
+ int blks = std::min(noutput_items/d_m, ninput_items[0]/d_n);
+ for(int i=0; i<blks; i++) {
+ // set up copy pointers
+ const uint8_t* iptr = &in[(i*d_n + d_offset)*d_itemsize];
+ uint8_t* optr = &out[i*d_m*d_itemsize];
+ // perform copy
+ memcpy( optr, iptr, d_m*d_itemsize );
+ }
+
+ consume_each(d_n);
+ return d_m;
+}
diff --git a/gnuradio-core/src/lib/general/gr_keep_m_in_n.h b/gnuradio-core/src/lib/general/gr_keep_m_in_n.h
new file mode 100644
index 000000000..c6bf40ecf
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_keep_m_in_n.h
@@ -0,0 +1,67 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_GR_KEEP_M_IN_N_H
+#define INCLUDED_GR_KEEP_M_IN_N_H
+
+#include <gr_core_api.h>
+#include <gr_block.h>
+
+class gr_keep_m_in_n;
+typedef boost::shared_ptr<gr_keep_m_in_n> gr_keep_m_in_n_sptr;
+
+GR_CORE_API gr_keep_m_in_n_sptr
+gr_make_keep_m_in_n (size_t item_size, int m, int n, int offset);
+
+
+/*!
+ * \brief decimate a stream, keeping one item out of every n.
+ * \ingroup slicedice_blk
+ */
+class GR_CORE_API gr_keep_m_in_n : public gr_block
+{
+ friend GR_CORE_API gr_keep_m_in_n_sptr
+ gr_make_keep_m_in_n (size_t item_size, int m, int n, int offset);
+
+ int d_n;
+ int d_m;
+ int d_count;
+ int d_offset;
+ int d_itemsize;
+
+ protected:
+ gr_keep_m_in_n (size_t item_size, int m, int n, int offset);
+ void forecast (int noutput_items, gr_vector_int &ninput_items_required);
+
+ public:
+ 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_offset(int offset);
+ void set_n(int n){ d_n = n; }
+ void set_m(int m){ d_m = m; }
+
+};
+
+#endif /* INCLUDED_GR_KEEP_M_IN_N_H */
diff --git a/gnuradio-core/src/lib/general/gr_keep_m_in_n.i b/gnuradio-core/src/lib/general/gr_keep_m_in_n.i
new file mode 100644
index 000000000..f280c0248
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_keep_m_in_n.i
@@ -0,0 +1,35 @@
+/* -*- 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,keep_m_in_n)
+
+gr_keep_m_in_n_sptr
+gr_make_keep_m_in_n (size_t itemsize, int m, int n, int offset);
+
+class gr_keep_m_in_n : public gr_sync_block
+{
+ protected:
+ gr_keep_m_in_n (size_t itemsize, int m, int n, int offset);
+ public:
+ void set_offset(int offset);
+
+};
diff --git a/gnuradio-core/src/lib/general/gr_keep_one_in_n.cc b/gnuradio-core/src/lib/general/gr_keep_one_in_n.cc
new file mode 100644
index 000000000..fbba9e91c
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_keep_one_in_n.cc
@@ -0,0 +1,105 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_keep_one_in_n.h>
+#include <gr_io_signature.h>
+#include <string.h>
+
+gr_keep_one_in_n_sptr
+gr_make_keep_one_in_n (size_t item_size, int n)
+{
+ return gnuradio::get_initial_sptr(new gr_keep_one_in_n (item_size, n));
+}
+
+gr_keep_one_in_n::gr_keep_one_in_n (size_t item_size, int n)
+ : gr_block ("keep_one_in_n",
+ gr_make_io_signature (1, 1, item_size),
+ gr_make_io_signature (1, 1, item_size)),
+ d_count(n)
+{
+ // To avoid bad behavior with using set_relative_rate in this block with
+ // VERY large values of n, we will keep track of things ourselves. Using
+ // this to turn off automatic tag propagation, which will be handled
+ // locally in general_work().
+ set_tag_propagation_policy(TPP_DONT);
+
+ set_n(n);
+}
+
+void
+gr_keep_one_in_n::set_n(int n)
+{
+ if (n < 1)
+ n = 1;
+
+ d_n = n;
+ d_count = n;
+
+ // keep our internal understanding of the relative rate of this block
+ // don't set the relative rate, though, and we will handle our own
+ // tag propagation.
+ d_decim_rate = 1.0/(float)d_n;
+}
+
+int
+gr_keep_one_in_n::general_work (int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const char *in = (const char *) input_items[0];
+ char *out = (char *) output_items[0];
+
+ size_t item_size = input_signature ()->sizeof_stream_item (0);
+ int ni = 0;
+ int no = 0;
+
+ while (ni < ninput_items[0] && no < noutput_items){
+ d_count--;
+ if (d_count <= 0){
+ memcpy (out, in, item_size); // copy 1 item
+ out += item_size;
+ no++;
+ d_count = d_n;
+ }
+ in += item_size;
+ ni++;
+ }
+
+ // Because we have set TPP_DONT, we have to propagate the tags here manually.
+ // Adjustment of the tag sample value is done using the float d_decim_rate.
+ std::vector<gr_tag_t> tags;
+ std::vector<gr_tag_t>::iterator t;
+ get_tags_in_range(tags, 0, nitems_read(0), nitems_read(0)+ni);
+ for(t = tags.begin(); t != tags.end(); t++) {
+ gr_tag_t new_tag = *t;
+ new_tag.offset *= d_decim_rate;
+ add_item_tag(0, new_tag);
+ }
+
+ consume_each (ni);
+ return no;
+}
diff --git a/gnuradio-core/src/lib/general/gr_keep_one_in_n.h b/gnuradio-core/src/lib/general/gr_keep_one_in_n.h
new file mode 100644
index 000000000..f37475204
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_keep_one_in_n.h
@@ -0,0 +1,62 @@
+/* -*- 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_KEEP_ONE_IN_N_H
+#define INCLUDED_GR_KEEP_ONE_IN_N_H
+
+#include <gr_core_api.h>
+#include <gr_sync_decimator.h>
+
+class gr_keep_one_in_n;
+typedef boost::shared_ptr<gr_keep_one_in_n> gr_keep_one_in_n_sptr;
+
+GR_CORE_API gr_keep_one_in_n_sptr
+gr_make_keep_one_in_n (size_t item_size, int n);
+
+
+/*!
+ * \brief decimate a stream, keeping one item out of every n.
+ * \ingroup slicedice_blk
+ */
+class GR_CORE_API gr_keep_one_in_n : public gr_block
+{
+ friend GR_CORE_API gr_keep_one_in_n_sptr
+ gr_make_keep_one_in_n (size_t item_size, int n);
+
+ int d_n;
+ int d_count;
+ float d_decim_rate;
+
+ protected:
+ gr_keep_one_in_n (size_t item_size, int n);
+
+ public:
+ 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_n(int n);
+
+};
+
+#endif /* INCLUDED_GR_KEEP_ONE_IN_N_H */
diff --git a/gnuradio-core/src/lib/general/gr_keep_one_in_n.i b/gnuradio-core/src/lib/general/gr_keep_one_in_n.i
new file mode 100644
index 000000000..534098cde
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_keep_one_in_n.i
@@ -0,0 +1,35 @@
+/* -*- 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,keep_one_in_n)
+
+gr_keep_one_in_n_sptr
+gr_make_keep_one_in_n (size_t itemsize, int n);
+
+class gr_keep_one_in_n : public gr_block
+{
+ protected:
+ gr_keep_one_in_n (size_t itemsize, int n);
+
+ public:
+ void set_n(int n);
+};
diff --git a/gnuradio-core/src/lib/general/gr_kludge_copy.cc b/gnuradio-core/src/lib/general/gr_kludge_copy.cc
new file mode 100644
index 000000000..f6a8d8af6
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_kludge_copy.cc
@@ -0,0 +1,64 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_kludge_copy.h>
+#include <gr_io_signature.h>
+#include <string.h>
+
+gr_kludge_copy_sptr
+gr_make_kludge_copy(size_t itemsize)
+{
+ return gnuradio::get_initial_sptr(new gr_kludge_copy(itemsize));
+}
+
+gr_kludge_copy::gr_kludge_copy(size_t itemsize)
+ : gr_sync_block ("kludge_copy",
+ gr_make_io_signature (1, -1, itemsize),
+ gr_make_io_signature (1, -1, itemsize)),
+ d_itemsize(itemsize)
+{
+}
+
+bool
+gr_kludge_copy::check_topology(int ninputs, int noutputs)
+{
+ return ninputs == noutputs;
+}
+
+int
+gr_kludge_copy::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const float **in = (const float **) &input_items[0];
+ float **out = (float **) &output_items[0];
+
+ int ninputs = input_items.size();
+ for (int i = 0; i < ninputs; i++){
+ memcpy(out[i], in[i], noutput_items * d_itemsize);
+ }
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/general/gr_kludge_copy.h b/gnuradio-core/src/lib/general/gr_kludge_copy.h
new file mode 100644
index 000000000..0bcf14469
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_kludge_copy.h
@@ -0,0 +1,56 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_GR_KLUDGE_COPY_H
+#define INCLUDED_GR_KLUDGE_COPY_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+
+class gr_kludge_copy;
+typedef boost::shared_ptr<gr_kludge_copy> gr_kludge_copy_sptr;
+
+GR_CORE_API gr_kludge_copy_sptr gr_make_kludge_copy(size_t itemsize);
+
+/*!
+ * \brief output[i] = input[i]
+ * \ingroup misc_blk
+ *
+ * This is a short term kludge to work around a problem with the hierarchical block impl.
+ */
+class GR_CORE_API gr_kludge_copy : public gr_sync_block
+{
+ size_t d_itemsize;
+
+ friend GR_CORE_API gr_kludge_copy_sptr gr_make_kludge_copy(size_t itemsize);
+ gr_kludge_copy(size_t itemsize);
+
+ public:
+
+ bool check_topology(int ninputs, int noutputs);
+
+ 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/general/gr_kludge_copy.i b/gnuradio-core/src/lib/general/gr_kludge_copy.i
new file mode 100644
index 000000000..7ff2b5736
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_kludge_copy.i
@@ -0,0 +1,31 @@
+/* -*- 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,kludge_copy)
+
+gr_kludge_copy_sptr gr_make_kludge_copy(size_t itemsize);
+
+class gr_kludge_copy : public gr_sync_block
+{
+ private:
+ gr_kludge_copy(size_t itemsize);
+};
diff --git a/gnuradio-core/src/lib/general/gr_lfsr_32k_source_s.cc b/gnuradio-core/src/lib/general/gr_lfsr_32k_source_s.cc
new file mode 100644
index 000000000..c9a874248
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_lfsr_32k_source_s.cc
@@ -0,0 +1,70 @@
+/* -*- 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.
+ */
+
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <gr_lfsr_32k_source_s.h>
+#include <gr_io_signature.h>
+#include <stdexcept>
+
+
+gr_lfsr_32k_source_s_sptr
+gr_make_lfsr_32k_source_s ()
+{
+ return gnuradio::get_initial_sptr(new gr_lfsr_32k_source_s ());
+}
+
+
+gr_lfsr_32k_source_s::gr_lfsr_32k_source_s ()
+ : gr_sync_block ("lfsr_32k_source_s",
+ gr_make_io_signature (0, 0, 0),
+ gr_make_io_signature (1, 1, sizeof (short))),
+ d_index (0)
+{
+ gri_lfsr_32k lfsr;
+
+ for (int i = 0; i < BUFSIZE; i++)
+ d_buffer[i] = lfsr.next_short ();
+}
+
+int
+gr_lfsr_32k_source_s::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ short *out = (short *) output_items[0];
+ short *buf = d_buffer;
+ int index = d_index;
+
+ for (int i = 0; i < noutput_items; i++){
+ out[i] = buf[index];
+ // index = (index + 1) & (BUFSIZE - 1);
+ index = index + 1;
+ if (index >= BUFSIZE)
+ index = 0;
+ }
+
+ d_index = index;
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/general/gr_lfsr_32k_source_s.h b/gnuradio-core/src/lib/general/gr_lfsr_32k_source_s.h
new file mode 100644
index 000000000..db107652a
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_lfsr_32k_source_s.h
@@ -0,0 +1,61 @@
+/* -*- 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_LFSR_32K_SOURCE_S_H
+#define INCLUDED_GR_LFSR_32K_SOURCE_S_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+#include <gri_lfsr_32k.h>
+
+class gr_lfsr_32k_source_s;
+typedef boost::shared_ptr<gr_lfsr_32k_source_s> gr_lfsr_32k_source_s_sptr;
+
+GR_CORE_API gr_lfsr_32k_source_s_sptr gr_make_lfsr_32k_source_s ();
+
+/*!
+ * \brief LFSR pseudo-random source with period of 2^15 bits (2^11 shorts)
+ * \ingroup source_blk
+ *
+ * This source is typically used along with gr_check_lfsr_32k_s to test
+ * the USRP using its digital loopback mode.
+ */
+class GR_CORE_API gr_lfsr_32k_source_s : public gr_sync_block
+{
+ friend GR_CORE_API gr_lfsr_32k_source_s_sptr gr_make_lfsr_32k_source_s ();
+
+
+ static const int BUFSIZE = 2048 - 1; // ensure pattern isn't packet aligned
+ int d_index;
+ short d_buffer[BUFSIZE];
+
+ gr_lfsr_32k_source_s ();
+
+ public:
+
+ 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/general/gr_lfsr_32k_source_s.i b/gnuradio-core/src/lib/general/gr_lfsr_32k_source_s.i
new file mode 100644
index 000000000..c2dc1c61b
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_lfsr_32k_source_s.i
@@ -0,0 +1,31 @@
+/* -*- 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,lfsr_32k_source_s);
+
+gr_lfsr_32k_source_s_sptr gr_make_lfsr_32k_source_s ();
+
+class gr_lfsr_32k_source_s : public gr_sync_block
+{
+ private:
+ gr_lfsr_32k_source_s ();
+};
diff --git a/gnuradio-core/src/lib/general/gr_log2_const.h b/gnuradio-core/src/lib/general/gr_log2_const.h
new file mode 100644
index 000000000..40afcf8b8
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_log2_const.h
@@ -0,0 +1,47 @@
+/* -*- 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.
+ */
+
+
+/*
+ * a bit of template hackery...
+ */
+#ifndef INCLUDED_GR_LOG2_CONST_H
+#define INCLUDED_GR_LOG2_CONST_H
+
+#include <gr_core_api.h>
+#include <assert.h>
+
+template<unsigned int k> static inline int gr_log2_const() { assert(0); return 0; }
+
+template<> inline int gr_log2_const<1>() { return 0; }
+template<> inline int gr_log2_const<2>() { return 1; }
+template<> inline int gr_log2_const<4>() { return 2; }
+template<> inline int gr_log2_const<8>() { return 3; }
+template<> inline int gr_log2_const<16>() { return 4; }
+template<> inline int gr_log2_const<32>() { return 5; }
+template<> inline int gr_log2_const<64>() { return 6; }
+template<> inline int gr_log2_const<128>() { return 7; }
+template<> inline int gr_log2_const<256>() { return 8; }
+template<> inline int gr_log2_const<512>() { return 9; }
+template<> inline int gr_log2_const<1024>(){ return 10; }
+
+#endif /* INCLUDED_GR_LOG2_CONST_H */
diff --git a/gnuradio-core/src/lib/general/gr_map_bb.cc b/gnuradio-core/src/lib/general/gr_map_bb.cc
new file mode 100644
index 000000000..7deb8971a
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_map_bb.cc
@@ -0,0 +1,61 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_map_bb.h>
+#include <gr_io_signature.h>
+
+gr_map_bb_sptr
+gr_make_map_bb (const std::vector<int> &map)
+{
+ return gnuradio::get_initial_sptr(new gr_map_bb (map));
+}
+
+gr_map_bb::gr_map_bb (const std::vector<int> &map)
+ : gr_sync_block ("map_bb",
+ gr_make_io_signature (1, 1, sizeof (unsigned char)),
+ gr_make_io_signature (1, 1, sizeof (unsigned char)))
+{
+ for (int i = 0; i < 0x100; i++)
+ d_map[i] = i;
+
+ unsigned int size = std::min((size_t) 0x100, map.size());
+ for (unsigned int i = 0; i < size; i++)
+ d_map[i] = map[i];
+}
+
+int
+gr_map_bb::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const unsigned char *in = (const unsigned char *) input_items[0];
+ unsigned char *out = (unsigned char *) output_items[0];
+
+ for (int i = 0; i < noutput_items; i++)
+ out[i] = d_map[in[i]];
+
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/general/gr_map_bb.h b/gnuradio-core/src/lib/general/gr_map_bb.h
new file mode 100644
index 000000000..0a2f5a45f
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_map_bb.h
@@ -0,0 +1,52 @@
+/* -*- 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.
+ */
+#ifndef INCLUDED_GR_MAP_BB_H
+#define INCLUDED_GR_MAP_BB_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+
+class gr_map_bb;
+typedef boost::shared_ptr<gr_map_bb> gr_map_bb_sptr;
+
+GR_CORE_API gr_map_bb_sptr gr_make_map_bb(const std::vector<int> &map);
+
+/*!
+ * \brief output[i] = map[input[i]]
+ * \ingroup coding_blk
+ */
+
+class GR_CORE_API gr_map_bb : public gr_sync_block
+{
+ friend GR_CORE_API gr_map_bb_sptr gr_make_map_bb(const std::vector<int> &map);
+
+ unsigned char d_map[0x100];
+
+ gr_map_bb(const std::vector<int> &map);
+
+public:
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif /* INCLUDED_GR_MAP_BB_H */
diff --git a/gnuradio-core/src/lib/general/gr_map_bb.i b/gnuradio-core/src/lib/general/gr_map_bb.i
new file mode 100644
index 000000000..9c8bff644
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_map_bb.i
@@ -0,0 +1,32 @@
+/* -*- 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,map_bb);
+
+gr_map_bb_sptr gr_make_map_bb (const std::vector<int> &map);
+
+class gr_map_bb : public gr_sync_block
+{
+ private:
+ gr_map_bb (const std::vector<int> &map);
+};
+
diff --git a/gnuradio-core/src/lib/general/gr_math.h b/gnuradio-core/src/lib/general/gr_math.h
new file mode 100644
index 000000000..b9a802da8
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_math.h
@@ -0,0 +1,209 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2003,2005,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.
+ */
+
+/*
+ * mathematical odds and ends.
+ */
+
+#ifndef _GR_MATH_H_
+#define _GR_MATH_H_
+
+#include <gr_core_api.h>
+#include <gr_complex.h>
+
+static inline bool
+gr_is_power_of_2(long x)
+{
+ return x != 0 && (x & (x-1)) == 0;
+}
+
+/*!
+ * \brief Fast arc tangent using table lookup and linear interpolation
+ * \ingroup misc
+ *
+ * \param y component of input vector
+ * \param x component of input vector
+ * \returns float angle angle of vector (x, y) in radians
+ *
+ * This function calculates the angle of the vector (x,y) based on a
+ * table lookup and linear interpolation. The table uses a 256 point
+ * table covering -45 to +45 degrees and uses symetry to determine the
+ * final angle value in the range of -180 to 180 degrees. Note that
+ * this function uses the small angle approximation for values close
+ * to zero. This routine calculates the arc tangent with an average
+ * error of +/- 0.045 degrees.
+ */
+GR_CORE_API float gr_fast_atan2f(float y, float x);
+
+static inline float gr_fast_atan2f(gr_complex z)
+{
+ return gr_fast_atan2f(z.imag(), z.real());
+}
+
+/* This bounds x by +/- clip without a branch */
+static inline float gr_branchless_clip(float x, float clip)
+{
+ float x1 = fabsf(x+clip);
+ float x2 = fabsf(x-clip);
+ x1 -= x2;
+ return 0.5*x1;
+}
+
+static inline float gr_clip(float x, float clip)
+{
+ float y = x;
+ if(x > clip)
+ y = clip;
+ else if(x < -clip)
+ y = -clip;
+ return y;
+}
+
+// Slicer Functions
+static inline unsigned int gr_binary_slicer(float x)
+{
+ if(x >= 0)
+ return 1;
+ else
+ return 0;
+}
+
+static inline unsigned int gr_quad_45deg_slicer(float r, float i)
+{
+ unsigned int ret = 0;
+ if((r >= 0) && (i >= 0))
+ ret = 0;
+ else if((r < 0) && (i >= 0))
+ ret = 1;
+ else if((r < 0) && (i < 0))
+ ret = 2;
+ else
+ ret = 3;
+ return ret;
+}
+
+static inline unsigned int gr_quad_0deg_slicer(float r, float i)
+{
+ unsigned int ret = 0;
+ if(fabsf(r) > fabsf(i)) {
+ if(r > 0)
+ ret = 0;
+ else
+ ret = 2;
+ }
+ else {
+ if(i > 0)
+ ret = 1;
+ else
+ ret = 3;
+ }
+
+ return ret;
+}
+
+static inline unsigned int gr_quad_45deg_slicer(gr_complex x)
+{
+ return gr_quad_45deg_slicer(x.real(), x.imag());
+}
+
+static inline unsigned int gr_quad_0deg_slicer(gr_complex x)
+{
+ return gr_quad_0deg_slicer(x.real(), x.imag());
+}
+
+// Branchless Slicer Functions
+static inline unsigned int gr_branchless_binary_slicer(float x)
+{
+ return (x >= 0);
+}
+
+static inline unsigned int gr_branchless_quad_0deg_slicer(float r, float i)
+{
+ unsigned int ret = 0;
+ ret = (fabsf(r) > fabsf(i)) * (((r < 0) << 0x1)); // either 0 (00) or 2 (10)
+ ret |= (fabsf(i) > fabsf(r)) * (((i < 0) << 0x1) | 0x1); // either 1 (01) or 3 (11)
+
+ return ret;
+}
+
+static inline unsigned int gr_branchless_quad_0deg_slicer(gr_complex x)
+{
+ return gr_branchless_quad_0deg_slicer(x.real(), x.imag());
+}
+
+static inline unsigned int gr_branchless_quad_45deg_slicer(float r, float i)
+{
+ char ret = (r <= 0);
+ ret |= ((i <= 0) << 1);
+ return (ret ^ ((ret & 0x2) >> 0x1));
+}
+
+static inline unsigned int gr_branchless_quad_45deg_slicer(gr_complex x)
+{
+ return gr_branchless_quad_45deg_slicer(x.real(), x.imag());
+}
+
+/*!
+ * \param x any value
+ * \param pow2 must be a power of 2
+ * \returns \p x rounded down to a multiple of \p pow2.
+ */
+static inline size_t
+gr_p2_round_down(size_t x, size_t pow2)
+{
+ return x & -pow2;
+}
+
+/*!
+ * \param x any value
+ * \param pow2 must be a power of 2
+ * \returns \p x rounded up to a multiple of \p pow2.
+ */
+static inline size_t
+gr_p2_round_up(size_t x, size_t pow2)
+{
+ return gr_p2_round_down(x + pow2 - 1, pow2);
+}
+
+/*!
+ * \param x any value
+ * \param pow2 must be a power of 2
+ * \returns \p x modulo \p pow2.
+ */
+static inline size_t
+gr_p2_modulo(size_t x, size_t pow2)
+{
+ return x & (pow2 - 1);
+}
+
+/*!
+ * \param x any value
+ * \param pow2 must be a power of 2
+ * \returns \p pow2 - (\p x modulo \p pow2).
+ */
+static inline size_t
+gr_p2_modulo_neg(size_t x, size_t pow2)
+{
+ return pow2 - gr_p2_modulo(x, pow2);
+}
+
+#endif /* _GR_MATH_H_ */
diff --git a/gnuradio-core/src/lib/general/gr_message_strobe.cc b/gnuradio-core/src/lib/general/gr_message_strobe.cc
new file mode 100644
index 000000000..6a9f807d1
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_message_strobe.cc
@@ -0,0 +1,75 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_message_strobe.h>
+#include <gr_io_signature.h>
+#include <cstdio>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <stdexcept>
+#include <string.h>
+#include <iostream>
+
+// public constructor that returns a shared_ptr
+
+gr_message_strobe_sptr
+gr_make_message_strobe (pmt::pmt_t msg, float period_ms)
+{
+ return gnuradio::get_initial_sptr(new gr_message_strobe(msg, period_ms));
+}
+
+gr_message_strobe::gr_message_strobe (pmt::pmt_t msg, float period_ms)
+ : gr_block("message_strobe",
+ gr_make_io_signature(0, 0, 0),
+ gr_make_io_signature(0, 0, 0)),
+ d_finished(false),
+ d_period_ms(period_ms),
+ d_msg(msg)
+{
+ message_port_register_out(pmt::mp("strobe"));
+ d_thread = boost::shared_ptr<boost::thread>(new boost::thread(boost::bind(&gr_message_strobe::run, this)));
+
+ message_port_register_in(pmt::mp("set_msg"));
+ set_msg_handler(pmt::mp("set_msg"), boost::bind(&gr_message_strobe::set_msg, this, _1));
+}
+
+gr_message_strobe::~gr_message_strobe()
+{
+ d_finished = true;
+ d_thread->interrupt();
+ d_thread->join();
+}
+
+void gr_message_strobe::run(){
+ while(!d_finished) {
+ boost::this_thread::sleep(boost::posix_time::milliseconds(d_period_ms));
+ if(d_finished){ return; }
+
+ message_port_pub( pmt::mp("strobe"), d_msg );
+ }
+}
diff --git a/gnuradio-core/src/lib/general/gr_message_strobe.h b/gnuradio-core/src/lib/general/gr_message_strobe.h
new file mode 100644
index 000000000..89046ffc0
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_message_strobe.h
@@ -0,0 +1,62 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_GR_MESSAGE_STROBE_H
+#define INCLUDED_GR_MESSAGE_STROBE_H
+
+#include <gr_core_api.h>
+#include <gr_block.h>
+#include <gr_message.h>
+#include <gr_msg_queue.h>
+
+class gr_message_strobe;
+typedef boost::shared_ptr<gr_message_strobe> gr_message_strobe_sptr;
+
+GR_CORE_API gr_message_strobe_sptr gr_make_message_strobe (pmt::pmt_t msg, float period_ms);
+
+/*!
+ * \brief Send message at defined interval
+ * \ingroup msg_blk
+ */
+class GR_CORE_API gr_message_strobe : public gr_block
+{
+ private:
+ friend GR_CORE_API gr_message_strobe_sptr
+ gr_make_message_strobe(pmt::pmt_t msg, float period_ms);
+
+ boost::shared_ptr<boost::thread> d_thread;
+ bool d_finished;
+ float d_period_ms;
+ pmt::pmt_t d_msg;
+
+ void run();
+
+ protected:
+ gr_message_strobe (pmt::pmt_t msg, float period_ms);
+
+ public:
+ ~gr_message_strobe ();
+
+ void set_msg(pmt::pmt_t msg){ d_msg = msg; }
+};
+
+#endif /* INCLUDED_GR_MESSAGE_STROBE_H */
diff --git a/gnuradio-core/src/lib/general/gr_message_strobe.i b/gnuradio-core/src/lib/general/gr_message_strobe.i
new file mode 100644
index 000000000..490aa8e8a
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_message_strobe.i
@@ -0,0 +1,30 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005 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,message_strobe);
+
+%{
+#include <gr_message_strobe.h>
+%}
+
+%include "gr_message_strobe.h"
+
diff --git a/gnuradio-core/src/lib/general/gr_misc.cc b/gnuradio-core/src/lib/general/gr_misc.cc
new file mode 100644
index 000000000..1ed2a03d7
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_misc.cc
@@ -0,0 +1,65 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005 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 <gr_misc.h>
+
+unsigned int
+gr_rounduppow2(unsigned int n)
+{
+ int i;
+ for (i=0;((n-1)>>i) != 0;i++)
+ ;
+ return 1<<i;
+}
+
+// ----------------------------------------------------------------
+
+void
+gr_zero_vector(std::vector<float> &v)
+{
+ for(unsigned int i=0; i < v.size(); i++)
+ v[i] = 0;
+}
+
+void
+gr_zero_vector(std::vector<double> &v)
+{
+ for(unsigned int i=0; i < v.size(); i++)
+ v[i] = 0;
+}
+
+void
+gr_zero_vector(std::vector<int> &v)
+{
+ for(unsigned int i=0; i < v.size(); i++)
+ v[i] = 0;
+}
+
+void
+gr_zero_vector(std::vector<gr_complex> &v)
+{
+ for(unsigned int i=0; i < v.size(); i++)
+ v[i] = 0;
+}
diff --git a/gnuradio-core/src/lib/general/gr_misc.h b/gnuradio-core/src/lib/general/gr_misc.h
new file mode 100644
index 000000000..0c790e90c
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_misc.h
@@ -0,0 +1,39 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005 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_MISC_H
+#define INCLUDED_GR_MISC_H
+
+#include <gr_core_api.h>
+#include <gr_types.h>
+
+GR_CORE_API unsigned int
+gr_rounduppow2(unsigned int n);
+
+// FIXME should be template
+GR_CORE_API void gr_zero_vector(std::vector<float> &v);
+GR_CORE_API void gr_zero_vector(std::vector<double> &v);
+GR_CORE_API void gr_zero_vector(std::vector<int> &v);
+GR_CORE_API void gr_zero_vector(std::vector<gr_complex> &v);
+
+
+#endif /* INCLUDED_GR_MISC_H */
diff --git a/gnuradio-core/src/lib/general/gr_multiply_cc.cc b/gnuradio-core/src/lib/general/gr_multiply_cc.cc
new file mode 100644
index 000000000..4a3751419
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_multiply_cc.cc
@@ -0,0 +1,69 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_multiply_cc.h>
+#include <gr_io_signature.h>
+#include <volk/volk.h>
+
+gr_multiply_cc_sptr
+gr_make_multiply_cc (size_t vlen)
+{
+ return gnuradio::get_initial_sptr(new gr_multiply_cc (vlen));
+}
+
+gr_multiply_cc::gr_multiply_cc (size_t vlen)
+ : gr_sync_block ("gr_multiply_cc",
+ gr_make_io_signature (1, -1, sizeof (gr_complex)*vlen),
+ gr_make_io_signature (1, 1, sizeof (gr_complex)*vlen)),
+ d_vlen(vlen)
+{
+ const int alignment_multiple =
+ volk_get_alignment() / sizeof(gr_complex);
+ set_alignment(std::max(1,alignment_multiple));
+}
+
+int
+gr_multiply_cc::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ gr_complex *out = (gr_complex *) output_items[0];
+ int noi = d_vlen*noutput_items;
+
+ memcpy(out, input_items[0], noi*sizeof(gr_complex));
+ if(is_unaligned()) {
+ for(size_t i = 1; i < input_items.size(); i++)
+ volk_32fc_x2_multiply_32fc_u(out, out, (gr_complex*)input_items[i], noi);
+ }
+ else {
+ for(size_t i = 1; i < input_items.size(); i++)
+ volk_32fc_x2_multiply_32fc_a(out, out, (gr_complex*)input_items[i], noi);
+ }
+ return noutput_items;
+}
+
+
+
diff --git a/gnuradio-core/src/lib/general/gr_multiply_cc.h b/gnuradio-core/src/lib/general/gr_multiply_cc.h
new file mode 100644
index 000000000..d25935b4c
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_multiply_cc.h
@@ -0,0 +1,56 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_GR_MULTIPLY_CC_H
+#define INCLUDED_GR_MULTIPLY_CC_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+
+class gr_multiply_cc;
+typedef boost::shared_ptr<gr_multiply_cc> gr_multiply_cc_sptr;
+
+GR_CORE_API gr_multiply_cc_sptr
+gr_make_multiply_cc (size_t vlen=1);
+
+/*!
+ * \brief Multiply streams of complex values
+ * \ingroup math_blk
+ */
+
+class GR_CORE_API gr_multiply_cc : public gr_sync_block
+{
+ private:
+ friend GR_CORE_API gr_multiply_cc_sptr
+ gr_make_multiply_cc (size_t vlen);
+ gr_multiply_cc (size_t vlen);
+
+ size_t d_vlen;
+
+ public:
+ virtual int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+
+#endif /* INCLUDED_GR_MULTIPLY_CC_H */
diff --git a/gnuradio-core/src/lib/general/gr_multiply_cc.i b/gnuradio-core/src/lib/general/gr_multiply_cc.i
new file mode 100644
index 000000000..f0faa3594
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_multiply_cc.i
@@ -0,0 +1,32 @@
+/* -*- 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,multiply_cc)
+
+gr_multiply_cc_sptr
+gr_make_multiply_cc (size_t vlen=1);
+
+class gr_multiply_cc : public gr_sync_block
+{
+public:
+
+};
diff --git a/gnuradio-core/src/lib/general/gr_multiply_conjugate_cc.cc b/gnuradio-core/src/lib/general/gr_multiply_conjugate_cc.cc
new file mode 100644
index 000000000..0c5fb4a92
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_multiply_conjugate_cc.cc
@@ -0,0 +1,69 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_multiply_conjugate_cc.h>
+#include <gr_io_signature.h>
+#include <volk/volk.h>
+
+gr_multiply_conjugate_cc_sptr
+gr_make_multiply_conjugate_cc (size_t vlen)
+{
+ return gnuradio::get_initial_sptr(new gr_multiply_conjugate_cc (vlen));
+}
+
+gr_multiply_conjugate_cc::gr_multiply_conjugate_cc (size_t vlen)
+ : gr_sync_block ("gr_multiply_conjugate_cc",
+ gr_make_io_signature (2, 2, sizeof (gr_complex)*vlen),
+ gr_make_io_signature (1, 1, sizeof (gr_complex)*vlen)),
+ d_vlen(vlen)
+{
+ const int alignment_multiple =
+ volk_get_alignment() / sizeof(gr_complex);
+ set_alignment(std::max(1,alignment_multiple));
+}
+
+int
+gr_multiply_conjugate_cc::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ gr_complex *in0 = (gr_complex *) input_items[0];
+ gr_complex *in1 = (gr_complex *) input_items[1];
+ gr_complex *out = (gr_complex *) output_items[0];
+ int noi = d_vlen*noutput_items;
+
+ if(is_unaligned()) {
+ volk_32fc_x2_multiply_conjugate_32fc_u(out, in0, in1, noi);
+ }
+ else {
+ volk_32fc_x2_multiply_conjugate_32fc_a(out, in0, in1, noi);
+ }
+
+ return noutput_items;
+}
+
+
+
diff --git a/gnuradio-core/src/lib/general/gr_multiply_conjugate_cc.h b/gnuradio-core/src/lib/general/gr_multiply_conjugate_cc.h
new file mode 100644
index 000000000..826e28771
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_multiply_conjugate_cc.h
@@ -0,0 +1,57 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_GR_MULTIPLY_CONJUGATE_CC_H
+#define INCLUDED_GR_MULTIPLY_CONJUGATE_CC_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+
+class gr_multiply_conjugate_cc;
+typedef boost::shared_ptr<gr_multiply_conjugate_cc>
+gr_multiply_conjugate_cc_sptr;
+
+GR_CORE_API gr_multiply_conjugate_cc_sptr
+gr_make_multiply_conjugate_cc (size_t vlen=1);
+
+/*!
+ * \brief Multiplies a stream by the conjugate of the second stream
+ * \ingroup math_blk
+ */
+
+class GR_CORE_API gr_multiply_conjugate_cc : public gr_sync_block
+{
+ private:
+ friend GR_CORE_API gr_multiply_conjugate_cc_sptr
+ gr_make_multiply_conjugate_cc (size_t vlen);
+ gr_multiply_conjugate_cc (size_t vlen);
+
+ size_t d_vlen;
+
+ public:
+ virtual int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+
+#endif /* INCLUDED_GR_MULTIPLY_CONJUGATE_CC_H */
diff --git a/gnuradio-core/src/lib/general/gr_multiply_conjugate_cc.i b/gnuradio-core/src/lib/general/gr_multiply_conjugate_cc.i
new file mode 100644
index 000000000..e7979dbcd
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_multiply_conjugate_cc.i
@@ -0,0 +1,32 @@
+/* -*- 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,multiply_conjugate_cc)
+
+gr_multiply_conjugate_cc_sptr
+gr_make_multiply_conjugate_cc (size_t vlen=1);
+
+class gr_multiply_conjugate_cc : public gr_sync_block
+{
+public:
+
+};
diff --git a/gnuradio-core/src/lib/general/gr_multiply_const_cc.cc b/gnuradio-core/src/lib/general/gr_multiply_const_cc.cc
new file mode 100644
index 000000000..bd4511937
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_multiply_const_cc.cc
@@ -0,0 +1,80 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_multiply_const_cc.h>
+#include <gr_io_signature.h>
+#include <volk/volk.h>
+
+gr_multiply_const_cc_sptr
+gr_make_multiply_const_cc (gr_complex k, size_t vlen)
+{
+ return gnuradio::get_initial_sptr(new gr_multiply_const_cc (k, vlen));
+}
+
+gr_multiply_const_cc::gr_multiply_const_cc (gr_complex k, size_t vlen)
+ : gr_sync_block ("gr_multiply_const_cc",
+ gr_make_io_signature (1, 1, sizeof (gr_complex)*vlen),
+ gr_make_io_signature (1, 1, sizeof (gr_complex)*vlen)),
+ d_k(k), d_vlen(vlen)
+{
+ const int alignment_multiple =
+ volk_get_alignment() / sizeof(gr_complex);
+ set_alignment(std::max(1,alignment_multiple));
+}
+
+gr_complex
+gr_multiply_const_cc::k() const
+{
+ return d_k;
+}
+
+void
+gr_multiply_const_cc::set_k(gr_complex k)
+{
+ d_k = k;
+}
+
+int
+gr_multiply_const_cc::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const gr_complex *in = (const gr_complex *) input_items[0];
+ gr_complex *out = (gr_complex *) output_items[0];
+ int noi = d_vlen*noutput_items;
+
+ if(is_unaligned()) {
+ volk_32fc_s32fc_multiply_32fc_u(out, in, d_k, noi);
+ }
+ else {
+ volk_32fc_s32fc_multiply_32fc_a(out, in, d_k, noi);
+ }
+
+ return noutput_items;
+}
+
+
+
diff --git a/gnuradio-core/src/lib/general/gr_multiply_const_cc.h b/gnuradio-core/src/lib/general/gr_multiply_const_cc.h
new file mode 100644
index 000000000..97962abc7
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_multiply_const_cc.h
@@ -0,0 +1,60 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_GR_MULTIPLY_CONST_CC_H
+#define INCLUDED_GR_MULTIPLY_CONST_CC_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+
+class gr_multiply_const_cc;
+typedef boost::shared_ptr<gr_multiply_const_cc> gr_multiply_const_cc_sptr;
+
+GR_CORE_API gr_multiply_const_cc_sptr
+gr_make_multiply_const_cc (gr_complex k, size_t vlen=1);
+
+/*!
+ * \brief Multiply stream of complex values with a constant \p k
+ * \ingroup math_blk
+ */
+
+class GR_CORE_API gr_multiply_const_cc : public gr_sync_block
+{
+ private:
+ friend GR_CORE_API gr_multiply_const_cc_sptr
+ gr_make_multiply_const_cc (gr_complex k, size_t vlen);
+ gr_multiply_const_cc (gr_complex k, size_t vlen);
+
+ gr_complex d_k;
+ size_t d_vlen;
+
+ public:
+ gr_complex k() const;
+ void set_k(gr_complex k);
+
+ virtual int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+
+#endif /* INCLUDED_GR_MULTIPLY_CONST_CC_H */
diff --git a/gnuradio-core/src/lib/general/gr_multiply_const_cc.i b/gnuradio-core/src/lib/general/gr_multiply_const_cc.i
new file mode 100644
index 000000000..c2f3cbed3
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_multiply_const_cc.i
@@ -0,0 +1,33 @@
+/* -*- 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,multiply_const_cc)
+
+gr_multiply_const_cc_sptr
+gr_make_multiply_const_cc (gr_complex k, size_t vlen=1);
+
+class gr_multiply_const_cc : public gr_sync_block
+{
+public:
+ gr_complex k() const;
+ void set_k(gr_complex k);
+};
diff --git a/gnuradio-core/src/lib/general/gr_multiply_const_ff.cc b/gnuradio-core/src/lib/general/gr_multiply_const_ff.cc
new file mode 100644
index 000000000..16ba39df9
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_multiply_const_ff.cc
@@ -0,0 +1,80 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_multiply_const_ff.h>
+#include <gr_io_signature.h>
+#include <volk/volk.h>
+
+gr_multiply_const_ff_sptr
+gr_make_multiply_const_ff (float k, size_t vlen)
+{
+ return gnuradio::get_initial_sptr(new gr_multiply_const_ff (k, vlen));
+}
+
+gr_multiply_const_ff::gr_multiply_const_ff (float k, size_t vlen)
+ : gr_sync_block ("gr_multiply_const_ff",
+ gr_make_io_signature (1, 1, sizeof (float)*vlen),
+ gr_make_io_signature (1, 1, sizeof (float)*vlen)),
+ d_k(k), d_vlen(vlen)
+{
+ const int alignment_multiple =
+ volk_get_alignment() / sizeof(float);
+ set_alignment(std::max(1,alignment_multiple));
+}
+
+float
+gr_multiply_const_ff::k() const
+{
+ return d_k;
+}
+
+void
+gr_multiply_const_ff::set_k(float k)
+{
+ d_k = k;
+}
+
+int
+gr_multiply_const_ff::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const float *in = (const float *) input_items[0];
+ float *out = (float *) output_items[0];
+ int noi = d_vlen*noutput_items;
+
+ if(is_unaligned()) {
+ volk_32f_s32f_multiply_32f_u(out, in, d_k, noi);
+ }
+ else {
+ volk_32f_s32f_multiply_32f_a(out, in, d_k, noi);
+ }
+
+ return noutput_items;
+}
+
+
+
diff --git a/gnuradio-core/src/lib/general/gr_multiply_const_ff.h b/gnuradio-core/src/lib/general/gr_multiply_const_ff.h
new file mode 100644
index 000000000..fac73f88a
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_multiply_const_ff.h
@@ -0,0 +1,60 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_GR_MULTIPLY_CONST_FF_H
+#define INCLUDED_GR_MULTIPLY_CONST_FF_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+
+class gr_multiply_const_ff;
+typedef boost::shared_ptr<gr_multiply_const_ff> gr_multiply_const_ff_sptr;
+
+GR_CORE_API gr_multiply_const_ff_sptr
+gr_make_multiply_const_ff (float k, size_t vlen=1);
+
+/*!
+ * \brief Multiply stream of float values with a constant \p k
+ * \ingroup math_blk
+ */
+
+class GR_CORE_API gr_multiply_const_ff : public gr_sync_block
+{
+ private:
+ friend GR_CORE_API gr_multiply_const_ff_sptr
+ gr_make_multiply_const_ff (float k, size_t vlen);
+ gr_multiply_const_ff (float k, size_t vlen);
+
+ float d_k;
+ size_t d_vlen;
+
+ public:
+ float k() const;
+ void set_k(float k);
+
+ virtual int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+
+#endif /* INCLUDED_GR_MULTIPLY_CONST_FF_H */
diff --git a/gnuradio-core/src/lib/general/gr_multiply_const_ff.i b/gnuradio-core/src/lib/general/gr_multiply_const_ff.i
new file mode 100644
index 000000000..343f67cd2
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_multiply_const_ff.i
@@ -0,0 +1,33 @@
+/* -*- 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,multiply_const_ff)
+
+gr_multiply_const_ff_sptr
+gr_make_multiply_const_ff (float k, size_t vlen=1);
+
+class gr_multiply_const_ff : public gr_sync_block
+{
+public:
+ float k() const;
+ void set_k(float k);
+};
diff --git a/gnuradio-core/src/lib/general/gr_multiply_ff.cc b/gnuradio-core/src/lib/general/gr_multiply_ff.cc
new file mode 100644
index 000000000..bb7bd0755
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_multiply_ff.cc
@@ -0,0 +1,69 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_multiply_ff.h>
+#include <gr_io_signature.h>
+#include <volk/volk.h>
+
+gr_multiply_ff_sptr
+gr_make_multiply_ff (size_t vlen)
+{
+ return gnuradio::get_initial_sptr(new gr_multiply_ff (vlen));
+}
+
+gr_multiply_ff::gr_multiply_ff (size_t vlen)
+ : gr_sync_block ("gr_multiply_ff",
+ gr_make_io_signature (1, -1, sizeof (float)*vlen),
+ gr_make_io_signature (1, 1, sizeof (float)*vlen)),
+ d_vlen(vlen)
+{
+ const int alignment_multiple =
+ volk_get_alignment() / sizeof(float);
+ set_alignment(std::max(1,alignment_multiple));
+}
+
+int
+gr_multiply_ff::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ float *out = (float *) output_items[0];
+ int noi = d_vlen*noutput_items;
+
+ memcpy(out, input_items[0], noi*sizeof(float));
+ if(is_unaligned()) {
+ for(size_t i = 1; i < input_items.size(); i++)
+ volk_32f_x2_multiply_32f_u(out, out, (const float*)input_items[i], noi);
+ }
+ else {
+ for(size_t i = 1; i < input_items.size(); i++)
+ volk_32f_x2_multiply_32f_a(out, out, (const float*)input_items[i], noi);
+ }
+ return noutput_items;
+}
+
+
+
diff --git a/gnuradio-core/src/lib/general/gr_multiply_ff.h b/gnuradio-core/src/lib/general/gr_multiply_ff.h
new file mode 100644
index 000000000..ed628385c
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_multiply_ff.h
@@ -0,0 +1,56 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_GR_MULTIPLY_FF_H
+#define INCLUDED_GR_MULTIPLY_FF_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+
+class gr_multiply_ff;
+typedef boost::shared_ptr<gr_multiply_ff> gr_multiply_ff_sptr;
+
+GR_CORE_API gr_multiply_ff_sptr
+gr_make_multiply_ff (size_t vlen=1);
+
+/*!
+ * \brief Multiply streams of complex values
+ * \ingroup math_blk
+ */
+
+class GR_CORE_API gr_multiply_ff : public gr_sync_block
+{
+ private:
+ friend GR_CORE_API gr_multiply_ff_sptr
+ gr_make_multiply_ff (size_t vlen);
+ gr_multiply_ff (size_t vlen);
+
+ size_t d_vlen;
+
+ public:
+ virtual int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+
+#endif /* INCLUDED_GR_MULTIPLY_FF_H */
diff --git a/gnuradio-core/src/lib/general/gr_multiply_ff.i b/gnuradio-core/src/lib/general/gr_multiply_ff.i
new file mode 100644
index 000000000..e5fdea348
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_multiply_ff.i
@@ -0,0 +1,32 @@
+/* -*- 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,multiply_ff)
+
+gr_multiply_ff_sptr
+gr_make_multiply_ff (size_t vlen=1);
+
+class gr_multiply_ff : public gr_sync_block
+{
+public:
+
+};
diff --git a/gnuradio-core/src/lib/general/gr_nco.h b/gnuradio-core/src/lib/general/gr_nco.h
new file mode 100644
index 000000000..fb51106aa
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_nco.h
@@ -0,0 +1,198 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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 _GR_NCO_H_
+#define _GR_NCO_H_
+
+
+#include <vector>
+#include <gr_sincos.h>
+#include <cmath>
+#include <gr_complex.h>
+
+/*!
+ * \brief base class template for Numerically Controlled Oscillator (NCO)
+ * \ingroup misc
+ */
+
+
+//FIXME Eventually generalize this to fixed point
+
+template<class o_type, class i_type>
+class gr_nco {
+public:
+ gr_nco () : phase (0), phase_inc(0) {}
+
+ virtual ~gr_nco () {}
+
+ // radians
+ void set_phase (double angle) {
+ phase = angle;
+ }
+
+ void adjust_phase (double delta_phase) {
+ phase += delta_phase;
+ }
+
+
+ // angle_rate is in radians / step
+ void set_freq (double angle_rate){
+ phase_inc = angle_rate;
+ }
+
+ // angle_rate is a delta in radians / step
+ void adjust_freq (double delta_angle_rate)
+ {
+ phase_inc += delta_angle_rate;
+ }
+
+ // increment current phase angle
+
+ void step ()
+ {
+ phase += phase_inc;
+ if (fabs (phase) > M_PI){
+
+ while (phase > M_PI)
+ phase -= 2*M_PI;
+
+ while (phase < -M_PI)
+ phase += 2*M_PI;
+ }
+ }
+
+ void step (int n)
+ {
+ phase += phase_inc * n;
+ if (fabs (phase) > M_PI){
+
+ while (phase > M_PI)
+ phase -= 2*M_PI;
+
+ while (phase < -M_PI)
+ phase += 2*M_PI;
+ }
+ }
+
+ // units are radians / step
+ double get_phase () const { return phase; }
+ double get_freq () const { return phase_inc; }
+
+ // compute sin and cos for current phase angle
+ void sincos (float *sinx, float *cosx) const;
+
+ // compute cos or sin for current phase angle
+ float cos () const { return std::cos (phase); }
+ float sin () const { return std::sin (phase); }
+
+ // compute a block at a time
+ void sin (float *output, int noutput_items, double ampl = 1.0);
+ void cos (float *output, int noutput_items, double ampl = 1.0);
+ void sincos (gr_complex *output, int noutput_items, double ampl = 1.0);
+ void sin (short *output, int noutput_items, double ampl = 1.0);
+ void cos (short *output, int noutput_items, double ampl = 1.0);
+ void sin (int *output, int noutput_items, double ampl = 1.0);
+ void cos (int *output, int noutput_items, double ampl = 1.0);
+
+protected:
+ double phase;
+ double phase_inc;
+};
+
+template<class o_type, class i_type>
+void
+gr_nco<o_type,i_type>::sincos (float *sinx, float *cosx) const
+{
+ gr_sincosf (phase, sinx, cosx);
+}
+
+template<class o_type, class i_type>
+void
+gr_nco<o_type,i_type>::sin (float *output, int noutput_items, double ampl)
+{
+ for (int i = 0; i < noutput_items; i++){
+ output[i] = (float)(sin () * ampl);
+ step ();
+ }
+}
+
+template<class o_type, class i_type>
+void
+gr_nco<o_type,i_type>::cos (float *output, int noutput_items, double ampl)
+{
+ for (int i = 0; i < noutput_items; i++){
+ output[i] = (float)(cos () * ampl);
+ step ();
+ }
+}
+
+template<class o_type, class i_type>
+void
+gr_nco<o_type,i_type>::sin (short *output, int noutput_items, double ampl)
+{
+ for (int i = 0; i < noutput_items; i++){
+ output[i] = (short)(sin() * ampl);
+ step ();
+ }
+}
+
+template<class o_type, class i_type>
+void
+gr_nco<o_type,i_type>::cos (short *output, int noutput_items, double ampl)
+{
+ for (int i = 0; i < noutput_items; i++){
+ output[i] = (short)(cos () * ampl);
+ step ();
+ }
+}
+
+template<class o_type, class i_type>
+void
+gr_nco<o_type,i_type>::sin (int *output, int noutput_items, double ampl)
+{
+ for (int i = 0; i < noutput_items; i++){
+ output[i] = (int)(sin () * ampl);
+ step ();
+ }
+}
+
+template<class o_type, class i_type>
+void
+gr_nco<o_type,i_type>::cos (int *output, int noutput_items, double ampl)
+{
+ for (int i = 0; i < noutput_items; i++){
+ output[i] = (int)(cos () * ampl);
+ step ();
+ }
+}
+
+template<class o_type, class i_type>
+void
+gr_nco<o_type,i_type>::sincos (gr_complex *output, int noutput_items, double ampl)
+{
+ for (int i = 0; i < noutput_items; i++){
+ float cosx, sinx;
+ sincos (&sinx, &cosx);
+ output[i] = gr_complex(cosx * ampl, sinx * ampl);
+ step ();
+ }
+}
+#endif /* _NCO_H_ */
diff --git a/gnuradio-core/src/lib/general/gr_nlog10_ff.cc b/gnuradio-core/src/lib/general/gr_nlog10_ff.cc
new file mode 100644
index 000000000..24cfe25fb
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_nlog10_ff.cc
@@ -0,0 +1,64 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_nlog10_ff.h>
+#include <gr_io_signature.h>
+#include <algorithm>
+
+gr_nlog10_ff_sptr
+gr_make_nlog10_ff (float n, unsigned vlen, float k)
+{
+ return gnuradio::get_initial_sptr(new gr_nlog10_ff(n, vlen, k));
+}
+
+gr_nlog10_ff::gr_nlog10_ff(float n, unsigned vlen, float k)
+ : gr_sync_block("nlog10_ff",
+ gr_make_io_signature(1, 1, sizeof(float) * vlen),
+ gr_make_io_signature(1, 1, sizeof(float) * vlen)),
+ d_vlen(vlen), d_n(n), d_k(k)
+{
+}
+
+gr_nlog10_ff::~gr_nlog10_ff()
+{
+}
+
+int
+gr_nlog10_ff::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const float *in = (const float *) input_items[0];
+ float *out = (float *) output_items[0];
+ int noi = noutput_items * d_vlen;
+ float n = d_n;
+ float k = d_k;
+
+ for (int i = 0; i < noi; i++)
+ out[i] = n * log10(std::max(in[i], (float) 1e-18)) + k;
+
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/general/gr_nlog10_ff.h b/gnuradio-core/src/lib/general/gr_nlog10_ff.h
new file mode 100644
index 000000000..cfeba3fee
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_nlog10_ff.h
@@ -0,0 +1,56 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005 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_NLOG10_FF_H
+#define INCLUDED_GR_NLOG10_FF_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+
+class gr_nlog10_ff;
+typedef boost::shared_ptr<gr_nlog10_ff> gr_nlog10_ff_sptr;
+
+GR_CORE_API gr_nlog10_ff_sptr gr_make_nlog10_ff (float n=1.0, unsigned vlen=1, float k=0);
+
+/*!
+ * \brief output = n*log10(input) + k
+ * \ingroup math_blk
+ */
+class GR_CORE_API gr_nlog10_ff : public gr_sync_block
+{
+ friend GR_CORE_API gr_nlog10_ff_sptr gr_make_nlog10_ff (float n, unsigned vlen, float k);
+
+ unsigned int d_vlen;
+ float d_n;
+ float d_k;
+
+ gr_nlog10_ff (float n, unsigned vlen, float k);
+
+public:
+ ~gr_nlog10_ff();
+
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+
+#endif /* INCLUDED_GR_NLOG10_FF_H */
diff --git a/gnuradio-core/src/lib/general/gr_nlog10_ff.i b/gnuradio-core/src/lib/general/gr_nlog10_ff.i
new file mode 100644
index 000000000..73da59793
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_nlog10_ff.i
@@ -0,0 +1,33 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005 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,nlog10_ff);
+
+gr_nlog10_ff_sptr gr_make_nlog10_ff (float n=1.0, unsigned vlen=1, float k=0);
+
+class gr_nlog10_ff : public gr_sync_block
+{
+ gr_nlog10_ff (float n, unsigned vlen, float k);
+
+public:
+ ~gr_nlog10_ff();
+};
diff --git a/gnuradio-core/src/lib/general/gr_nop.cc b/gnuradio-core/src/lib/general/gr_nop.cc
new file mode 100644
index 000000000..edfe1d76d
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_nop.cc
@@ -0,0 +1,66 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <gr_nop.h>
+#include <gr_io_signature.h>
+#include <boost/bind.hpp>
+
+gr_nop_sptr
+gr_make_nop (size_t sizeof_stream_item)
+{
+ return gnuradio::get_initial_sptr (new gr_nop (sizeof_stream_item));
+}
+
+gr_nop::gr_nop (size_t sizeof_stream_item)
+ : gr_block ("nop",
+ gr_make_io_signature (0, -1, sizeof_stream_item),
+ gr_make_io_signature (0, -1, sizeof_stream_item)),
+ d_nmsgs_recvd(0)
+{
+ // Arrange to have count_received_msgs called when messages are received.
+ message_port_register_in(pmt::mp("port"));
+ set_msg_handler(pmt::mp("port"), boost::bind(&gr_nop::count_received_msgs, this, _1));
+}
+
+// Trivial message handler that just counts them.
+// (N.B., This feature is used in qa_set_msg_handler)
+void
+gr_nop::count_received_msgs(pmt::pmt_t msg)
+{
+ d_nmsgs_recvd++;
+}
+
+int
+gr_nop::general_work (int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ // eat any input that's available
+ for (unsigned i = 0; i < ninput_items.size (); i++)
+ consume (i, ninput_items[i]);
+
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/general/gr_nop.h b/gnuradio-core/src/lib/general/gr_nop.h
new file mode 100644
index 000000000..e0d59280f
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_nop.h
@@ -0,0 +1,61 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_GR_NOP_H
+#define INCLUDED_GR_NOP_H
+
+#include <gr_core_api.h>
+#include <gr_block.h>
+#include <stddef.h> // size_t
+
+class gr_nop;
+typedef boost::shared_ptr<gr_nop> gr_nop_sptr;
+
+GR_CORE_API gr_nop_sptr
+gr_make_nop (size_t sizeof_stream_item);
+
+/*!
+ * \brief Does nothing. Used for testing only.
+ * \ingroup misc_blk
+ */
+class GR_CORE_API gr_nop : public gr_block
+{
+ friend GR_CORE_API gr_nop_sptr gr_make_nop (size_t sizeof_stream_item);
+ gr_nop (size_t sizeof_stream_item);
+
+protected:
+ int d_nmsgs_recvd;
+
+ // Method that just counts any received messages.
+ void count_received_msgs(pmt::pmt_t msg);
+
+ public:
+ 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);
+
+ int nmsgs_received() const { return d_nmsgs_recvd; }
+
+};
+
+#endif /* INCLUDED_GR_NOP_H */
diff --git a/gnuradio-core/src/lib/general/gr_nop.i b/gnuradio-core/src/lib/general/gr_nop.i
new file mode 100644
index 000000000..977a15d18
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_nop.i
@@ -0,0 +1,31 @@
+/* -*- 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,nop)
+
+gr_nop_sptr gr_make_nop (size_t sizeof_stream_item);
+
+class gr_nop : public gr_block {
+private:
+ gr_nop (size_t sizeof_stream_item);
+};
+
diff --git a/gnuradio-core/src/lib/general/gr_null_sink.cc b/gnuradio-core/src/lib/general/gr_null_sink.cc
new file mode 100644
index 000000000..183665502
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_null_sink.cc
@@ -0,0 +1,49 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_null_sink.h>
+#include <gr_io_signature.h>
+
+gr_null_sink::gr_null_sink (size_t sizeof_stream_item)
+ : gr_sync_block ("null_sink",
+ gr_make_io_signature (1, 1, sizeof_stream_item),
+ gr_make_io_signature (0, 0, 0))
+{
+}
+
+gr_null_sink_sptr
+gr_make_null_sink (size_t sizeof_stream_item)
+{
+ return gnuradio::get_initial_sptr (new gr_null_sink (sizeof_stream_item));
+}
+
+int
+gr_null_sink::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/general/gr_null_sink.h b/gnuradio-core/src/lib/general/gr_null_sink.h
new file mode 100644
index 000000000..737429329
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_null_sink.h
@@ -0,0 +1,53 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_GR_NULL_SINK_H
+#define INCLUDED_GR_NULL_SINK_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+#include <stddef.h> // size_t
+
+class gr_null_sink;
+typedef boost::shared_ptr<gr_null_sink> gr_null_sink_sptr;
+
+GR_CORE_API gr_null_sink_sptr
+gr_make_null_sink (size_t sizeof_stream_item);
+
+/*!
+ * \brief Bit bucket
+ * \ingroup sink_blk
+ */
+class GR_CORE_API gr_null_sink : public gr_sync_block
+{
+ friend GR_CORE_API gr_null_sink_sptr gr_make_null_sink (size_t sizeof_stream_item);
+ gr_null_sink (size_t sizeof_stream_item);
+
+ public:
+
+ virtual int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+
+};
+
+#endif /* INCLUDED_GR_NULL_SINK_H */
diff --git a/gnuradio-core/src/lib/general/gr_null_sink.i b/gnuradio-core/src/lib/general/gr_null_sink.i
new file mode 100644
index 000000000..80411f9b7
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_null_sink.i
@@ -0,0 +1,31 @@
+/* -*- 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,null_sink)
+
+gr_null_sink_sptr gr_make_null_sink (size_t sizeof_stream_item);
+
+class gr_null_sink : public gr_sync_block {
+private:
+ gr_null_sink (size_t sizeof_stream_item);
+};
+
diff --git a/gnuradio-core/src/lib/general/gr_null_source.cc b/gnuradio-core/src/lib/general/gr_null_source.cc
new file mode 100644
index 000000000..1ad5c351d
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_null_source.cc
@@ -0,0 +1,52 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_null_source.h>
+#include <gr_io_signature.h>
+#include <string.h>
+
+gr_null_source::gr_null_source (size_t sizeof_stream_item)
+ : gr_sync_block ("null_source",
+ gr_make_io_signature (0, 0, 0),
+ gr_make_io_signature (1, 1, sizeof_stream_item))
+{
+}
+
+gr_null_source_sptr
+gr_make_null_source (size_t sizeof_stream_item)
+{
+ return gnuradio::get_initial_sptr (new gr_null_source (sizeof_stream_item));
+}
+
+int
+gr_null_source::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ void *optr = (void *) output_items[0];
+ memset (optr, 0, noutput_items * output_signature()->sizeof_stream_item (0));
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/general/gr_null_source.h b/gnuradio-core/src/lib/general/gr_null_source.h
new file mode 100644
index 000000000..1c64e8bd9
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_null_source.h
@@ -0,0 +1,52 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_GR_NULL_SOURCE_H
+#define INCLUDED_GR_NULL_SOURCE_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+
+class gr_null_source;
+typedef boost::shared_ptr<gr_null_source> gr_null_source_sptr;
+
+GR_CORE_API gr_null_source_sptr
+gr_make_null_source (size_t sizeof_stream_item);
+
+/*!
+ * \brief A source of zeros.
+ * \ingroup source_blk
+ */
+class GR_CORE_API gr_null_source : public gr_sync_block
+{
+ friend GR_CORE_API gr_null_source_sptr gr_make_null_source (size_t sizeof_stream_item);
+
+ gr_null_source (size_t sizeof_stream_item);
+
+ public:
+ virtual int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+
+};
+
+#endif /* INCLUDED_GR_NULL_SOURCE_H */
diff --git a/gnuradio-core/src/lib/general/gr_null_source.i b/gnuradio-core/src/lib/general/gr_null_source.i
new file mode 100644
index 000000000..120a59999
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_null_source.i
@@ -0,0 +1,31 @@
+/* -*- 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,null_source)
+
+gr_null_source_sptr gr_make_null_source (size_t sizeof_stream_item);
+
+class gr_null_source : public gr_sync_block {
+private:
+ gr_null_source (size_t sizeof_stream_item);
+};
+
diff --git a/gnuradio-core/src/lib/general/gr_ofdm_bpsk_demapper.cc b/gnuradio-core/src/lib/general/gr_ofdm_bpsk_demapper.cc
new file mode 100644
index 000000000..2b718e5ce
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_ofdm_bpsk_demapper.cc
@@ -0,0 +1,97 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_ofdm_bpsk_demapper.h>
+#include <gr_io_signature.h>
+
+gr_ofdm_bpsk_demapper_sptr
+gr_make_ofdm_bpsk_demapper (unsigned int occupied_carriers)
+{
+ return gnuradio::get_initial_sptr(new gr_ofdm_bpsk_demapper (occupied_carriers));
+}
+
+gr_ofdm_bpsk_demapper::gr_ofdm_bpsk_demapper (unsigned occupied_carriers)
+ : gr_block ("ofdm_bpsk_demapper",
+ gr_make_io_signature (1, 1, sizeof(gr_complex)*occupied_carriers),
+ gr_make_io_signature (1, 1, sizeof(unsigned char))),
+ d_occupied_carriers(occupied_carriers),
+ d_byte_offset(0), d_partial_byte(0)
+{
+}
+
+gr_ofdm_bpsk_demapper::~gr_ofdm_bpsk_demapper(void)
+{
+}
+
+unsigned char gr_ofdm_bpsk_demapper::slicer(gr_complex x)
+{
+ return (unsigned char)(x.real() > 0 ? 1 : 0);
+}
+
+void
+gr_ofdm_bpsk_demapper::forecast (int noutput_items, gr_vector_int &ninput_items_required)
+{
+ unsigned ninputs = ninput_items_required.size ();
+ for (unsigned i = 0; i < ninputs; i++)
+ ninput_items_required[i] = 1;
+}
+
+int
+gr_ofdm_bpsk_demapper::general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const gr_complex *in = (const gr_complex *)input_items[0];
+ unsigned char *out = (unsigned char *) output_items[0];
+
+ unsigned int i=0, bytes_produced=0;
+
+ while(i < d_occupied_carriers) {
+
+ while((d_byte_offset < 8) && (i < d_occupied_carriers)) {
+ //fprintf(stderr, "%f+j%f\n", in[i].real(), in[i].imag());
+ d_partial_byte |= slicer(in[i++]) << (d_byte_offset++);
+ }
+
+ if(d_byte_offset == 8) {
+ out[bytes_produced++] = d_partial_byte;
+ d_byte_offset = 0;
+ d_partial_byte = 0;
+ }
+ }
+
+#if 0
+printf("demod out: ");
+ for(i = 0; i < bytes_produced; i++) {
+ printf("%4x", out[i]);
+ }
+ printf(" \tlen: %d\n", i);
+#endif
+
+ consume_each(1);
+ return bytes_produced;
+}
diff --git a/gnuradio-core/src/lib/general/gr_ofdm_bpsk_demapper.h b/gnuradio-core/src/lib/general/gr_ofdm_bpsk_demapper.h
new file mode 100644
index 000000000..d69d427ed
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_ofdm_bpsk_demapper.h
@@ -0,0 +1,69 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_GR_OFDM_BPSK_DEMAPPER_H
+#define INCLUDED_GR_OFDM_BPSK_DEMAPPER_H
+
+
+#include <gr_core_api.h>
+#include <gr_block.h>
+#include <vector>
+
+class gr_ofdm_bpsk_demapper;
+typedef boost::shared_ptr<gr_ofdm_bpsk_demapper> gr_ofdm_bpsk_demapper_sptr;
+
+GR_CORE_API gr_ofdm_bpsk_demapper_sptr
+gr_make_ofdm_bpsk_demapper (unsigned int occupied_carriers);
+
+
+/*!
+ * \brief take a vector of complex constellation points in from an FFT
+ * and demodulate to a stream of bits. Simple BPSK version.
+ * \ingroup ofdm_blk
+ */
+class GR_CORE_API gr_ofdm_bpsk_demapper : public gr_block
+{
+ friend GR_CORE_API gr_ofdm_bpsk_demapper_sptr
+ gr_make_ofdm_bpsk_demapper (unsigned int occupied_carriers);
+
+ protected:
+ gr_ofdm_bpsk_demapper (unsigned int occupied_carriers);
+
+ private:
+ unsigned char slicer(gr_complex x);
+
+ unsigned int d_occupied_carriers;
+ unsigned int d_byte_offset;
+ unsigned char d_partial_byte;
+
+ void forecast(int noutput_items, gr_vector_int &ninput_items_required);
+
+ public:
+ ~gr_ofdm_bpsk_demapper(void);
+ int general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+
+#endif
diff --git a/gnuradio-core/src/lib/general/gr_ofdm_bpsk_demapper.i b/gnuradio-core/src/lib/general/gr_ofdm_bpsk_demapper.i
new file mode 100644
index 000000000..e58a4e40c
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_ofdm_bpsk_demapper.i
@@ -0,0 +1,40 @@
+/* -*- 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.
+ */
+
+#include <vector>
+
+GR_SWIG_BLOCK_MAGIC(gr,ofdm_bpsk_demapper)
+
+gr_ofdm_bpsk_demapper_sptr
+gr_make_ofdm_bpsk_demapper (unsigned int occupied_carriers);
+
+class gr_ofdm_bpsk_demapper : public gr_sync_decimator
+{
+ protected:
+ gr_ofdm_bpsk_demapper (unsigned int occupied_carriers);
+
+ public:
+ int general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
diff --git a/gnuradio-core/src/lib/general/gr_ofdm_frame_sink2.cc b/gnuradio-core/src/lib/general/gr_ofdm_frame_sink2.cc
new file mode 100644
index 000000000..eb1232756
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_ofdm_frame_sink2.cc
@@ -0,0 +1,374 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007,2008,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_ofdm_frame_sink2.h>
+#include <gr_io_signature.h>
+#include <gr_expj.h>
+#include <gr_math.h>
+#include <math.h>
+#include <cstdio>
+#include <stdexcept>
+#include <iostream>
+#include <string.h>
+#include <gr_constellation.h>
+
+#define VERBOSE 0
+
+inline void
+gr_ofdm_frame_sink2::enter_search()
+{
+ if (VERBOSE)
+ fprintf(stderr, "@ enter_search\n");
+
+ d_state = STATE_SYNC_SEARCH;
+
+}
+
+inline void
+gr_ofdm_frame_sink2::enter_have_sync()
+{
+ if (VERBOSE)
+ fprintf(stderr, "@ enter_have_sync\n");
+
+ d_state = STATE_HAVE_SYNC;
+
+ // clear state of demapper
+ d_byte_offset = 0;
+ d_partial_byte = 0;
+
+ d_header = 0;
+ d_headerbytelen_cnt = 0;
+
+ // Resetting PLL
+ d_freq = 0.0;
+ d_phase = 0.0;
+ fill(d_dfe.begin(), d_dfe.end(), gr_complex(1.0,0.0));
+}
+
+inline void
+gr_ofdm_frame_sink2::enter_have_header()
+{
+ d_state = STATE_HAVE_HEADER;
+
+ // header consists of two 16-bit shorts in network byte order
+ // payload length is lower 12 bits
+ // whitener offset is upper 4 bits
+ d_packetlen = (d_header >> 16) & 0x0fff;
+ d_packet_whitener_offset = (d_header >> 28) & 0x000f;
+ d_packetlen_cnt = 0;
+
+ if (VERBOSE)
+ fprintf(stderr, "@ enter_have_header (payload_len = %d) (offset = %d)\n",
+ d_packetlen, d_packet_whitener_offset);
+}
+
+
+unsigned int gr_ofdm_frame_sink2::demapper(const gr_complex *in,
+ unsigned char *out)
+{
+ unsigned int i=0, bytes_produced=0;
+ gr_complex carrier;
+
+ carrier=gr_expj(d_phase);
+
+ gr_complex accum_error = 0.0;
+ //while(i < d_occupied_carriers) {
+ while(i < d_subcarrier_map.size()) {
+ if(d_nresid > 0) {
+ d_partial_byte |= d_resid;
+ d_byte_offset += d_nresid;
+ d_nresid = 0;
+ d_resid = 0;
+ }
+
+ //while((d_byte_offset < 8) && (i < d_occupied_carriers)) {
+ while((d_byte_offset < 8) && (i < d_subcarrier_map.size())) {
+ //gr_complex sigrot = in[i]*carrier*d_dfe[i];
+ gr_complex sigrot = in[d_subcarrier_map[i]]*carrier*d_dfe[i];
+
+ if(d_derotated_output != NULL){
+ d_derotated_output[i] = sigrot;
+ }
+
+ unsigned char bits = d_constell->decision_maker(&sigrot);
+
+ gr_complex closest_sym = d_constell->points()[bits];
+
+ accum_error += sigrot * conj(closest_sym);
+
+ // FIX THE FOLLOWING STATEMENT
+ if (norm(sigrot)> 0.001) d_dfe[i] += d_eq_gain*(closest_sym/sigrot-d_dfe[i]);
+
+ i++;
+
+ if((8 - d_byte_offset) >= d_nbits) {
+ d_partial_byte |= bits << (d_byte_offset);
+ d_byte_offset += d_nbits;
+ }
+ else {
+ d_nresid = d_nbits-(8-d_byte_offset);
+ int mask = ((1<<(8-d_byte_offset))-1);
+ d_partial_byte |= (bits & mask) << d_byte_offset;
+ d_resid = bits >> (8-d_byte_offset);
+ d_byte_offset += (d_nbits - d_nresid);
+ }
+ //printf("demod symbol: %.4f + j%.4f bits: %x partial_byte: %x byte_offset: %d resid: %x nresid: %d\n",
+ // in[i-1].real(), in[i-1].imag(), bits, d_partial_byte, d_byte_offset, d_resid, d_nresid);
+ }
+
+ if(d_byte_offset == 8) {
+ //printf("demod byte: %x \n\n", d_partial_byte);
+ out[bytes_produced++] = d_partial_byte;
+ d_byte_offset = 0;
+ d_partial_byte = 0;
+ }
+ }
+ //std::cerr << "accum_error " << accum_error << std::endl;
+
+ float angle = arg(accum_error);
+
+ d_freq = d_freq - d_freq_gain*angle;
+ d_phase = d_phase + d_freq - d_phase_gain*angle;
+ if (d_phase >= 2*M_PI) d_phase -= 2*M_PI;
+ if (d_phase <0) d_phase += 2*M_PI;
+
+ //if(VERBOSE)
+ // std::cerr << angle << "\t" << d_freq << "\t" << d_phase << "\t" << std::endl;
+
+ return bytes_produced;
+}
+
+
+gr_ofdm_frame_sink2_sptr
+gr_make_ofdm_frame_sink2(gr_constellation_sptr constell,
+ gr_msg_queue_sptr target_queue, unsigned int occupied_carriers,
+ float phase_gain, float freq_gain)
+{
+ return gnuradio::get_initial_sptr(new gr_ofdm_frame_sink2(constell,
+ target_queue, occupied_carriers,
+ phase_gain, freq_gain));
+}
+
+
+gr_ofdm_frame_sink2::gr_ofdm_frame_sink2(gr_constellation_sptr constell,
+ gr_msg_queue_sptr target_queue, unsigned int occupied_carriers,
+ float phase_gain, float freq_gain)
+ : gr_sync_block ("ofdm_frame_sink2",
+ gr_make_io_signature2 (2, 2, sizeof(gr_complex)*occupied_carriers, sizeof(char)),
+ gr_make_io_signature (1, 1, sizeof(gr_complex)*occupied_carriers)),
+ d_constell(constell),
+ d_target_queue(target_queue), d_occupied_carriers(occupied_carriers),
+ d_byte_offset(0), d_partial_byte(0),
+ d_resid(0), d_nresid(0),d_phase(0),d_freq(0),d_phase_gain(phase_gain),d_freq_gain(freq_gain),
+ d_eq_gain(0.05)
+{
+ if (d_constell->dimensionality() != 1)
+ throw std::runtime_error ("This receiver only works with constellations of dimension 1.");
+
+ std::string carriers = "FE7F";
+
+ // A bit hacky to fill out carriers to occupied_carriers length
+ int diff = (d_occupied_carriers - 4*carriers.length());
+ while(diff > 7) {
+ carriers.insert(0, "f");
+ carriers.insert(carriers.length(), "f");
+ diff -= 8;
+ }
+
+ // if there's extras left to be processed
+ // divide remaining to put on either side of current map
+ // all of this is done to stick with the concept of a carrier map string that
+ // can be later passed by the user, even though it'd be cleaner to just do this
+ // on the carrier map itself
+ int diff_left=0;
+ int diff_right=0;
+
+ // dictionary to convert from integers to ascii hex representation
+ char abc[16] = {'0', '1', '2', '3', '4', '5', '6', '7',
+ '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
+ if(diff > 0) {
+ char c[2] = {0,0};
+
+ diff_left = (int)ceil((float)diff/2.0f); // number of carriers to put on the left side
+ c[0] = abc[(1 << diff_left) - 1]; // convert to bits and move to ASCI integer
+ carriers.insert(0, c);
+
+ diff_right = diff - diff_left; // number of carriers to put on the right side
+ c[0] = abc[0xF^((1 << diff_right) - 1)]; // convert to bits and move to ASCI integer
+ carriers.insert(carriers.length(), c);
+ }
+
+ // It seemed like such a good idea at the time...
+ // because we are only dealing with the occupied_carriers
+ // at this point, the diff_left in the following compensates
+ // for any offset from the 0th carrier introduced
+ unsigned int i,j,k;
+ for(i = 0; i < (d_occupied_carriers/4)+diff_left; i++) {
+ char c = carriers[i];
+ for(j = 0; j < 4; j++) {
+ k = (strtol(&c, NULL, 16) >> (3-j)) & 0x1;
+ if(k) {
+ d_subcarrier_map.push_back(4*i + j - diff_left);
+ }
+ }
+ }
+
+ // make sure we stay in the limit currently imposed by the occupied_carriers
+ if(d_subcarrier_map.size() > d_occupied_carriers) {
+ throw std::invalid_argument("gr_ofdm_mapper_bcv: subcarriers allocated exceeds size of occupied carriers");
+ }
+
+ d_bytes_out = new unsigned char[d_occupied_carriers];
+ d_dfe.resize(occupied_carriers);
+ fill(d_dfe.begin(), d_dfe.end(), gr_complex(1.0,0.0));
+
+ d_nbits = d_constell->bits_per_symbol();
+
+ enter_search();
+}
+
+gr_ofdm_frame_sink2::~gr_ofdm_frame_sink2 ()
+{
+ delete [] d_bytes_out;
+}
+
+
+int
+gr_ofdm_frame_sink2::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const gr_complex *in = (const gr_complex *) input_items[0];
+ const char *sig = (const char *) input_items[1];
+ unsigned int j = 0;
+ unsigned int bytes=0;
+
+ // If the output is connected, send it the derotated symbols
+ if(output_items.size() >= 1)
+ d_derotated_output = (gr_complex *)output_items[0];
+ else
+ d_derotated_output = NULL;
+
+ if (VERBOSE)
+ fprintf(stderr,">>> Entering state machine\n");
+
+ switch(d_state) {
+
+ case STATE_SYNC_SEARCH: // Look for flag indicating beginning of pkt
+ if (VERBOSE)
+ fprintf(stderr,"SYNC Search, noutput=%d\n", noutput_items);
+
+ if (sig[0]) { // Found it, set up for header decode
+ enter_have_sync();
+ }
+ break;
+
+ case STATE_HAVE_SYNC:
+ // only demod after getting the preamble signal; otherwise, the
+ // equalizer taps will screw with the PLL performance
+ bytes = demapper(&in[0], d_bytes_out);
+
+ if (VERBOSE) {
+ if(sig[0])
+ printf("ERROR -- Found SYNC in HAVE_SYNC\n");
+ fprintf(stderr,"Header Search bitcnt=%d, header=0x%08x\n",
+ d_headerbytelen_cnt, d_header);
+ }
+
+ j = 0;
+ while(j < bytes) {
+ d_header = (d_header << 8) | (d_bytes_out[j] & 0xFF);
+ j++;
+
+ if (++d_headerbytelen_cnt == HEADERBYTELEN) {
+
+ if (VERBOSE)
+ fprintf(stderr, "got header: 0x%08x\n", d_header);
+
+ // we have a full header, check to see if it has been received properly
+ if (header_ok()){
+ enter_have_header();
+
+ if (VERBOSE)
+ printf("\nPacket Length: %d\n", d_packetlen);
+
+ while((j < bytes) && (d_packetlen_cnt < d_packetlen)) {
+ d_packet[d_packetlen_cnt++] = d_bytes_out[j++];
+ }
+
+ if(d_packetlen_cnt == d_packetlen) {
+ gr_message_sptr msg =
+ gr_make_message(0, d_packet_whitener_offset, 0, d_packetlen);
+ memcpy(msg->msg(), d_packet, d_packetlen_cnt);
+ d_target_queue->insert_tail(msg); // send it
+ msg.reset(); // free it up
+
+ enter_search();
+ }
+ }
+ else {
+ enter_search(); // bad header
+ }
+ }
+ }
+ break;
+
+ case STATE_HAVE_HEADER:
+ bytes = demapper(&in[0], d_bytes_out);
+
+ if (VERBOSE) {
+ if(sig[0])
+ printf("ERROR -- Found SYNC in HAVE_HEADER at %d, length of %d\n", d_packetlen_cnt, d_packetlen);
+ fprintf(stderr,"Packet Build\n");
+ }
+
+ j = 0;
+ while(j < bytes) {
+ d_packet[d_packetlen_cnt++] = d_bytes_out[j++];
+
+ if (d_packetlen_cnt == d_packetlen){ // packet is filled
+ // build a message
+ // NOTE: passing header field as arg1 is not scalable
+ gr_message_sptr msg =
+ gr_make_message(0, d_packet_whitener_offset, 0, d_packetlen_cnt);
+ memcpy(msg->msg(), d_packet, d_packetlen_cnt);
+
+ d_target_queue->insert_tail(msg); // send it
+ msg.reset(); // free it up
+
+ enter_search();
+ break;
+ }
+ }
+ break;
+
+ default:
+ assert(0);
+
+ } // switch
+
+ return 1;
+}
diff --git a/gnuradio-core/src/lib/general/gr_ofdm_frame_sink2.h b/gnuradio-core/src/lib/general/gr_ofdm_frame_sink2.h
new file mode 100644
index 000000000..a743e8c5a
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_ofdm_frame_sink2.h
@@ -0,0 +1,121 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007,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.
+ */
+
+#ifndef INCLUDED_GR_OFDM_FRAME_SINK2_H
+#define INCLUDED_GR_OFDM_FRAME_SINK2_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+#include <gr_msg_queue.h>
+#include <gr_constellation.h>
+
+class gr_ofdm_frame_sink2;
+typedef boost::shared_ptr<gr_ofdm_frame_sink2> gr_ofdm_frame_sink2_sptr;
+
+GR_CORE_API gr_ofdm_frame_sink2_sptr
+gr_make_ofdm_frame_sink2 (gr_constellation_sptr constell,
+ gr_msg_queue_sptr target_queue, unsigned int occupied_tones,
+ float phase_gain=0.25, float freq_gain=0.25*0.25/4.0);
+
+/*!
+ * \brief Takes an OFDM symbol in, demaps it into bits of 0's and 1's, packs
+ * them into packets, and sends to to a message queue sink.
+ * \ingroup sink_blk
+ * \ingroup ofdm_blk
+ *
+ * NOTE: The mod input parameter simply chooses a pre-defined demapper/slicer. Eventually,
+ * we want to be able to pass in a reference to an object to do the demapping and slicing
+ * for a given modulation type.
+ */
+class GR_CORE_API gr_ofdm_frame_sink2 : public gr_sync_block
+{
+ friend GR_CORE_API gr_ofdm_frame_sink2_sptr
+ gr_make_ofdm_frame_sink2 (gr_constellation_sptr constell,
+ gr_msg_queue_sptr target_queue, unsigned int occupied_tones,
+ float phase_gain, float freq_gain);
+
+ private:
+ enum state_t {STATE_SYNC_SEARCH, STATE_HAVE_SYNC, STATE_HAVE_HEADER};
+
+ static const int MAX_PKT_LEN = 4096;
+ static const int HEADERBYTELEN = 4;
+
+ gr_msg_queue_sptr d_target_queue; // where to send the packet when received
+ state_t d_state;
+ unsigned int d_header; // header bits
+ int d_headerbytelen_cnt; // how many so far
+
+ unsigned char *d_bytes_out; // hold the current bytes produced by the demapper
+
+ unsigned int d_occupied_carriers;
+ unsigned int d_byte_offset;
+ unsigned int d_partial_byte;
+
+ unsigned char d_packet[MAX_PKT_LEN]; // assembled payload
+ int d_packetlen; // length of packet
+ int d_packet_whitener_offset; // offset into whitener string to use
+ int d_packetlen_cnt; // how many so far
+
+ gr_complex * d_derotated_output; // Pointer to output stream to send deroated symbols out
+
+ gr_constellation_sptr d_constell;
+ std::vector<gr_complex> d_dfe;
+ unsigned int d_nbits;
+
+ unsigned char d_resid;
+ unsigned int d_nresid;
+ float d_phase;
+ float d_freq;
+ float d_phase_gain;
+ float d_freq_gain;
+ float d_eq_gain;
+
+ std::vector<int> d_subcarrier_map;
+
+ protected:
+ gr_ofdm_frame_sink2(gr_constellation_sptr constell,
+ gr_msg_queue_sptr target_queue, unsigned int occupied_tones,
+ float phase_gain, float freq_gain);
+
+ void enter_search();
+ void enter_have_sync();
+ void enter_have_header();
+
+ bool header_ok()
+ {
+ // confirm that two copies of header info are identical
+ return ((d_header >> 16) ^ (d_header & 0xffff)) == 0;
+ }
+
+ unsigned char slicer(const gr_complex x);
+ unsigned int demapper(const gr_complex *in,
+ unsigned char *out);
+
+ public:
+ ~gr_ofdm_frame_sink2();
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif /* INCLUDED_GR_OFDM_FRAME_SINK2_H */
diff --git a/gnuradio-core/src/lib/general/gr_ofdm_frame_sink2.i b/gnuradio-core/src/lib/general/gr_ofdm_frame_sink2.i
new file mode 100644
index 000000000..8c04d1e16
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_ofdm_frame_sink2.i
@@ -0,0 +1,39 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007,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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,ofdm_frame_sink2);
+
+gr_ofdm_frame_sink2_sptr
+gr_make_ofdm_frame_sink2(gr_constellation_sptr constell,
+ gr_msg_queue_sptr target_queue, unsigned int occupied_tones,
+ float phase_gain=0.25, float freq_gain=0.25*0.25/4);
+
+class gr_ofdm_frame_sink2 : public gr_sync_block
+{
+ protected:
+ gr_ofdm_frame_sink2(gr_constellation_sptr constell,
+ gr_msg_queue_sptr target_queue, unsigned int occupied_tones,
+ float phase_gain, float freq_gain);
+
+ public:
+ ~gr_ofdm_frame_sink2();
+};
diff --git a/gnuradio-core/src/lib/general/gr_pa_2x2_phase_combiner.cc b/gnuradio-core/src/lib/general/gr_pa_2x2_phase_combiner.cc
new file mode 100644
index 000000000..318753672
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_pa_2x2_phase_combiner.cc
@@ -0,0 +1,74 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_pa_2x2_phase_combiner.h>
+#include <gr_io_signature.h>
+
+gr_pa_2x2_phase_combiner_sptr
+gr_make_pa_2x2_phase_combiner()
+{
+ return gnuradio::get_initial_sptr(new gr_pa_2x2_phase_combiner());
+}
+
+gr_pa_2x2_phase_combiner::gr_pa_2x2_phase_combiner ()
+ : gr_sync_block ("pa_2x2_phase_combiner",
+ gr_make_io_signature (1, 1, NM * sizeof (gr_complex)),
+ gr_make_io_signature (1, 1, sizeof (float)))
+{
+ set_theta(0);
+}
+
+void
+gr_pa_2x2_phase_combiner::set_theta(float theta)
+{
+ d_theta = theta;
+ gr_complex j = gr_complex(0,1);
+ d_phase[0] = exp(j * (float) (M_PI * (sin(theta) + cos(theta))));
+ d_phase[1] = exp(j * (float) (M_PI * cos(theta)));
+ d_phase[2] = exp(j * (float) (M_PI * sin(theta)));
+ d_phase[3] = exp(j * (float) 0.0);
+}
+
+int
+gr_pa_2x2_phase_combiner::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const gr_complex *in = (const gr_complex *) input_items[0];
+ gr_complex *out = (gr_complex *) output_items[0];
+
+ for (int i = 0; i < noutput_items; i++){
+ gr_complex acc = 0;
+ acc += in[0] * d_phase[0];
+ acc += in[1] * d_phase[1];
+ acc += in[2] * d_phase[2];
+ acc += in[3] * d_phase[3];
+ out[i] = acc;
+ in += 4;
+ }
+
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/general/gr_pa_2x2_phase_combiner.h b/gnuradio-core/src/lib/general/gr_pa_2x2_phase_combiner.h
new file mode 100644
index 000000000..d430d154f
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_pa_2x2_phase_combiner.h
@@ -0,0 +1,63 @@
+/* -*- 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.
+ */
+#ifndef INCLUDED_GR_PA_2X2_PHASE_COMBINER_H
+#define INCLUDED_GR_PA_2X2_PHASE_COMBINER_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+
+class gr_pa_2x2_phase_combiner;
+typedef boost::shared_ptr<gr_pa_2x2_phase_combiner> gr_pa_2x2_phase_combiner_sptr;
+
+GR_CORE_API gr_pa_2x2_phase_combiner_sptr gr_make_pa_2x2_phase_combiner ();
+
+/*!
+ * \brief pa_2x2 phase combiner
+ * \ingroup misc_blk
+ *
+ * Anntenas are arranged like this:
+ *
+ * 2 3
+ * 0 1
+ *
+ * dx and dy are lambda/2.
+ */
+class GR_CORE_API gr_pa_2x2_phase_combiner : public gr_sync_block
+{
+ static const int NM = 4;
+
+ float d_theta;
+ gr_complex d_phase[NM];
+
+ gr_pa_2x2_phase_combiner ();
+ friend GR_CORE_API gr_pa_2x2_phase_combiner_sptr gr_make_pa_2x2_phase_combiner();
+
+ public:
+ float theta() const { return d_theta; }
+ void set_theta(float theta);
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif /* INCLUDED_GR_PA_2X2_PHASE_COMBINER_H */
diff --git a/gnuradio-core/src/lib/general/gr_pa_2x2_phase_combiner.i b/gnuradio-core/src/lib/general/gr_pa_2x2_phase_combiner.i
new file mode 100644
index 000000000..2cd373a5e
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_pa_2x2_phase_combiner.i
@@ -0,0 +1,34 @@
+/* -*- 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,pa_2x2_phase_combiner)
+
+gr_pa_2x2_phase_combiner_sptr gr_make_pa_2x2_phase_combiner();
+
+class gr_pa_2x2_phase_combiner : public gr_sync_block
+{
+ gr_pa_2x2_phase_combiner();
+
+ public:
+ float theta() const;
+ void set_theta(float theta);
+};
diff --git a/gnuradio-core/src/lib/general/gr_pack_k_bits_bb.cc b/gnuradio-core/src/lib/general/gr_pack_k_bits_bb.cc
new file mode 100644
index 000000000..0ea0c9e38
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_pack_k_bits_bb.cc
@@ -0,0 +1,69 @@
+/* -*- 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.
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_pack_k_bits_bb.h>
+#include <gr_io_signature.h>
+#include <stdexcept>
+#include <iostream>
+
+gr_pack_k_bits_bb_sptr gr_make_pack_k_bits_bb(unsigned k)
+{
+ return gnuradio::get_initial_sptr(new gr_pack_k_bits_bb(k));
+}
+
+
+gr_pack_k_bits_bb::gr_pack_k_bits_bb (unsigned k)
+ : gr_sync_decimator("pack_k_bits_bb",
+ gr_make_io_signature (1, 1, sizeof(unsigned char)),
+ gr_make_io_signature (1, 1, sizeof(unsigned char)),
+ k),
+ d_k (k)
+{
+ if (d_k == 0)
+ throw std::out_of_range("interpolation must be > 0");
+}
+
+gr_pack_k_bits_bb::~gr_pack_k_bits_bb()
+{
+}
+
+int
+gr_pack_k_bits_bb::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const unsigned char *in = (const unsigned char *)input_items[0];
+ unsigned char *out = (unsigned char *)output_items[0];
+
+ for(int i = 0; i < noutput_items; i++) {
+ out[i] = 0x00;
+ for(unsigned int j = 0; j < d_k; j++) {
+ out[i] |= (0x01 & in[i*d_k+j])<<(d_k-j-1);
+ }
+ }
+
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/general/gr_pack_k_bits_bb.h b/gnuradio-core/src/lib/general/gr_pack_k_bits_bb.h
new file mode 100644
index 000000000..8e1508c78
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_pack_k_bits_bb.h
@@ -0,0 +1,56 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_GR_PACK_K_BITS_BB_H
+#define INCLUDED_GR_PACK_K_BITS_BB_H
+
+#include <gr_core_api.h>
+#include <gr_sync_decimator.h>
+
+class gr_pack_k_bits_bb;
+typedef boost::shared_ptr<gr_pack_k_bits_bb> gr_pack_k_bits_bb_sptr;
+GR_CORE_API gr_pack_k_bits_bb_sptr gr_make_pack_k_bits_bb (unsigned k);
+
+class gr_pack_k_bits_bb;
+
+/*!
+ * \brief Converts a stream of bytes with 1 bit in the LSB to a byte with k relevent bits.
+ * \ingroup converter_blk
+ */
+class GR_CORE_API gr_pack_k_bits_bb : public gr_sync_decimator
+{
+ private:
+ friend GR_CORE_API gr_pack_k_bits_bb_sptr gr_make_pack_k_bits_bb (unsigned k);
+
+ gr_pack_k_bits_bb (unsigned k);
+
+ unsigned d_k; // number of relevent bits to pack from k input bytes
+
+ public:
+ ~gr_pack_k_bits_bb ();
+
+ 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/general/gr_pack_k_bits_bb.i b/gnuradio-core/src/lib/general/gr_pack_k_bits_bb.i
new file mode 100644
index 000000000..6ae2095ec
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_pack_k_bits_bb.i
@@ -0,0 +1,34 @@
+/* -*- 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,pack_k_bits_bb)
+
+gr_pack_k_bits_bb_sptr gr_make_pack_k_bits_bb (int k) throw(std::exception);
+
+class gr_pack_k_bits_bb : public gr_sync_decimator
+{
+ private:
+ gr_pack_k_bits_bb (int k);
+
+ public:
+ ~gr_pack_k_bits_bb ();
+};
diff --git a/gnuradio-core/src/lib/general/gr_packet_sink.cc b/gnuradio-core/src/lib/general/gr_packet_sink.cc
new file mode 100644
index 000000000..19a8c5fc2
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_packet_sink.cc
@@ -0,0 +1,207 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_packet_sink.h>
+#include <gr_io_signature.h>
+#include <cstdio>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <stdexcept>
+#include <gr_count_bits.h>
+#include <string.h>
+
+#define VERBOSE 0
+
+static const int DEFAULT_THRESHOLD = 12; // detect access code with up to DEFAULT_THRESHOLD bits wrong
+
+inline void
+gr_packet_sink::enter_search()
+{
+ if (VERBOSE)
+ fprintf(stderr, "@ enter_search\n");
+
+ d_state = STATE_SYNC_SEARCH;
+ d_shift_reg = 0;
+}
+
+inline void
+gr_packet_sink::enter_have_sync()
+{
+ if (VERBOSE)
+ fprintf(stderr, "@ enter_have_sync\n");
+
+ d_state = STATE_HAVE_SYNC;
+ d_header = 0;
+ d_headerbitlen_cnt = 0;
+}
+
+inline void
+gr_packet_sink::enter_have_header(int payload_len)
+{
+ if (VERBOSE)
+ fprintf(stderr, "@ enter_have_header (payload_len = %d)\n", payload_len);
+
+ d_state = STATE_HAVE_HEADER;
+ d_packetlen = payload_len;
+ d_packetlen_cnt = 0;
+ d_packet_byte = 0;
+ d_packet_byte_index = 0;
+}
+
+gr_packet_sink_sptr
+gr_make_packet_sink (const std::vector<unsigned char>& sync_vector,
+ gr_msg_queue_sptr target_queue, int threshold)
+{
+ return gnuradio::get_initial_sptr(new gr_packet_sink (sync_vector, target_queue, threshold));
+}
+
+
+gr_packet_sink::gr_packet_sink (const std::vector<unsigned char>& sync_vector,
+ gr_msg_queue_sptr target_queue, int threshold)
+ : gr_sync_block ("packet_sink",
+ gr_make_io_signature (1, 1, sizeof(float)),
+ gr_make_io_signature (0, 0, 0)),
+ d_target_queue(target_queue), d_threshold(threshold == -1 ? DEFAULT_THRESHOLD : threshold)
+{
+ d_sync_vector = 0;
+ for(int i=0;i<8;i++){
+ d_sync_vector <<= 8;
+ d_sync_vector |= sync_vector[i];
+ }
+
+ enter_search();
+}
+
+gr_packet_sink::~gr_packet_sink ()
+{
+}
+
+int
+gr_packet_sink::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ float *inbuf = (float *) input_items[0];
+ int count=0;
+
+ if (VERBOSE)
+ fprintf(stderr,">>> Entering state machine\n"),fflush(stderr);
+
+ while (count<noutput_items) {
+ switch(d_state) {
+
+ case STATE_SYNC_SEARCH: // Look for sync vector
+ if (VERBOSE)
+ fprintf(stderr,"SYNC Search, noutput=%d\n",noutput_items),fflush(stderr);
+
+ while (count < noutput_items) {
+ if(slice(inbuf[count++]))
+ d_shift_reg = (d_shift_reg << 1) | 1;
+ else
+ d_shift_reg = d_shift_reg << 1;
+
+ // Compute popcnt of putative sync vector
+ if(gr_count_bits64 (d_shift_reg ^ d_sync_vector) <= d_threshold) {
+ // Found it, set up for header decode
+ enter_have_sync();
+ break;
+ }
+ }
+ break;
+
+ case STATE_HAVE_SYNC:
+ if (VERBOSE)
+ fprintf(stderr,"Header Search bitcnt=%d, header=0x%08x\n", d_headerbitlen_cnt, d_header),
+ fflush(stderr);
+
+ while (count < noutput_items) { // Shift bits one at a time into header
+ if(slice(inbuf[count++]))
+ d_header = (d_header << 1) | 1;
+ else
+ d_header = d_header << 1;
+
+ if (++d_headerbitlen_cnt == HEADERBITLEN) {
+
+ if (VERBOSE)
+ fprintf(stderr, "got header: 0x%08x\n", d_header);
+
+ // we have a full header, check to see if it has been received properly
+ if (header_ok()){
+ int payload_len = header_payload_len();
+ if (payload_len <= MAX_PKT_LEN) // reasonable?
+ enter_have_header(payload_len); // yes.
+ else
+ enter_search(); // no.
+ }
+ else
+ enter_search(); // no.
+ break; // we're in a new state
+ }
+ }
+ break;
+
+ case STATE_HAVE_HEADER:
+ if (VERBOSE)
+ fprintf(stderr,"Packet Build\n"),fflush(stderr);
+
+ while (count < noutput_items) { // shift bits into bytes of packet one at a time
+ if(slice(inbuf[count++]))
+ d_packet_byte = (d_packet_byte << 1) | 1;
+ else
+ d_packet_byte = d_packet_byte << 1;
+
+ if (d_packet_byte_index++ == 7) { // byte is full so move to next byte
+ d_packet[d_packetlen_cnt++] = d_packet_byte;
+ d_packet_byte_index = 0;
+
+ if (d_packetlen_cnt == d_packetlen){ // packet is filled
+
+ // build a message
+ gr_message_sptr msg = gr_make_message(0, 0, 0, d_packetlen_cnt);
+ memcpy(msg->msg(), d_packet, d_packetlen_cnt);
+
+ d_target_queue->insert_tail(msg); // send it
+ msg.reset(); // free it up
+
+ enter_search();
+ break;
+ }
+ }
+ }
+ break;
+
+ default:
+ assert(0);
+
+ } // switch
+
+ } // while
+
+ return noutput_items;
+}
+
diff --git a/gnuradio-core/src/lib/general/gr_packet_sink.h b/gnuradio-core/src/lib/general/gr_packet_sink.h
new file mode 100644
index 000000000..b4cb0b0f6
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_packet_sink.h
@@ -0,0 +1,112 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005 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_PACKET_SINK_H
+#define INCLUDED_GR_PACKET_SINK_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+#include <gr_msg_queue.h>
+
+class gr_packet_sink;
+typedef boost::shared_ptr<gr_packet_sink> gr_packet_sink_sptr;
+
+GR_CORE_API gr_packet_sink_sptr
+gr_make_packet_sink (const std::vector<unsigned char>& sync_vector,
+ gr_msg_queue_sptr target_queue,
+ int threshold = -1 // -1 -> use default
+ );
+/*!
+ * \brief process received bits looking for packet sync, header, and process bits into packet
+ * \ingroup sink_blk
+ */
+class GR_CORE_API gr_packet_sink : public gr_sync_block
+{
+ friend GR_CORE_API gr_packet_sink_sptr
+ gr_make_packet_sink (const std::vector<unsigned char>& sync_vector,
+ gr_msg_queue_sptr target_queue,
+ int threshold);
+
+ private:
+ enum state_t {STATE_SYNC_SEARCH, STATE_HAVE_SYNC, STATE_HAVE_HEADER};
+
+ static const int MAX_PKT_LEN = 4096;
+ static const int HEADERBITLEN = 32;
+
+ gr_msg_queue_sptr d_target_queue; // where to send the packet when received
+ unsigned long long d_sync_vector; // access code to locate start of packet
+ unsigned int d_threshold; // how many bits may be wrong in sync vector
+
+ state_t d_state;
+
+ unsigned long long d_shift_reg; // used to look for sync_vector
+
+ unsigned int d_header; // header bits
+ int d_headerbitlen_cnt; // how many so far
+
+ unsigned char d_packet[MAX_PKT_LEN]; // assembled payload
+ unsigned char d_packet_byte; // byte being assembled
+ int d_packet_byte_index; // which bit of d_packet_byte we're working on
+ int d_packetlen; // length of packet
+ int d_packetlen_cnt; // how many so far
+
+ protected:
+ gr_packet_sink(const std::vector<unsigned char>& sync_vector,
+ gr_msg_queue_sptr target_queue,
+ int threshold);
+
+ void enter_search();
+ void enter_have_sync();
+ void enter_have_header(int payload_len);
+
+ int slice(float x) { return x > 0 ? 1 : 0; }
+
+ bool header_ok()
+ {
+ // confirm that two copies of header info are identical
+ return ((d_header >> 16) ^ (d_header & 0xffff)) == 0;
+ }
+
+ int header_payload_len()
+ {
+ // header consists of two 16-bit shorts in network byte order
+ int t = (d_header >> 16) & 0xffff;
+ return t;
+ }
+
+ public:
+ ~gr_packet_sink();
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+
+
+ //! return true if we detect carrier
+ bool carrier_sensed() const
+ {
+ return d_state != STATE_SYNC_SEARCH;
+ }
+
+};
+
+#endif /* INCLUDED_GR_PACKET_SINK_H */
diff --git a/gnuradio-core/src/lib/general/gr_packet_sink.i b/gnuradio-core/src/lib/general/gr_packet_sink.i
new file mode 100644
index 000000000..d1290f9d3
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_packet_sink.i
@@ -0,0 +1,41 @@
+/* -*- 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,packet_sink)
+
+gr_packet_sink_sptr
+gr_make_packet_sink (const std::vector<unsigned char>& sync_vector,
+ gr_msg_queue_sptr target_queue,
+ int threshold = -1 // -1 -> use default
+ );
+
+class gr_packet_sink : public gr_sync_block
+{
+ protected:
+ gr_packet_sink (const std::vector<unsigned char>& sync_vector,
+ gr_msg_queue_sptr target_queue,
+ int threshold);
+ public:
+ ~gr_packet_sink ();
+
+ bool carrier_sensed() const;
+};
diff --git a/gnuradio-core/src/lib/general/gr_peak_detector2_fb.cc b/gnuradio-core/src/lib/general/gr_peak_detector2_fb.cc
new file mode 100644
index 000000000..a4179a8c2
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_peak_detector2_fb.cc
@@ -0,0 +1,107 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_peak_detector2_fb.h>
+#include <gr_io_signature.h>
+#include <string.h>
+
+gr_peak_detector2_fb_sptr
+gr_make_peak_detector2_fb (float threshold_factor_rise,
+ int look_ahead, float alpha)
+{
+ return gnuradio::get_initial_sptr(new gr_peak_detector2_fb (threshold_factor_rise,
+ look_ahead, alpha));
+}
+
+gr_peak_detector2_fb::gr_peak_detector2_fb (float threshold_factor_rise,
+ int look_ahead, float alpha)
+ : gr_sync_block ("peak_detector2_fb",
+ gr_make_io_signature (1, 1, sizeof(float)),
+ gr_make_io_signature2 (1, 2, sizeof(char), sizeof(float))),
+ d_threshold_factor_rise(threshold_factor_rise),
+ d_look_ahead(look_ahead), d_alpha(alpha), d_avg(0.0f), d_found(false)
+{
+}
+
+int
+gr_peak_detector2_fb::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items) {
+ float *iptr = (float *) input_items[0];
+ char *optr = (char *) output_items[0];
+
+ assert(noutput_items >= 2);
+
+ memset(optr, 0, noutput_items*sizeof(char));
+
+ for (int i = 0; i < noutput_items; i++) {
+
+ if (!d_found) {
+ // Have not yet detected presence of peak
+ if (iptr[i] > d_avg * (1.0f + d_threshold_factor_rise)) {
+ d_found = true;
+ d_look_ahead_remaining = d_look_ahead;
+ d_peak_val = -(float)INFINITY;
+ }
+ else {
+ d_avg = d_alpha*iptr[i] + (1.0f - d_alpha)*d_avg;
+ }
+ }
+ else {
+ // Detected presence of peak
+ if (iptr[i] > d_peak_val) {
+ d_peak_val = iptr[i];
+ d_peak_ind = i;
+ }
+ else if (d_look_ahead_remaining <= 0) {
+ optr[d_peak_ind] = 1;
+ d_found = false;
+ d_avg = iptr[i];
+ }
+
+ // Have not yet located peak, loop and keep searching.
+ d_look_ahead_remaining--;
+ }
+
+ // Every iteration of the loop, write debugging signal out if
+ // connected:
+ if (output_items.size() == 2) {
+ float *sigout = (float *) output_items[1];
+ sigout[i] = d_avg;
+ }
+ } // loop
+
+ if (!d_found)
+ return noutput_items;
+
+ // else if detected presence, keep searching during the next call to work.
+ int tmp = d_peak_ind;
+ d_peak_ind = 1;
+
+ return tmp - 1;
+}
+
+
diff --git a/gnuradio-core/src/lib/general/gr_peak_detector2_fb.h b/gnuradio-core/src/lib/general/gr_peak_detector2_fb.h
new file mode 100644
index 000000000..665a6b882
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_peak_detector2_fb.h
@@ -0,0 +1,109 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_gr_peak_detector2_FB_H
+#define INCLUDED_gr_peak_detector2_FB_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+
+class gr_peak_detector2_fb;
+typedef boost::shared_ptr<gr_peak_detector2_fb> gr_peak_detector2_fb_sptr;
+
+GR_CORE_API gr_peak_detector2_fb_sptr gr_make_peak_detector2_fb (float threshold_factor_rise = 7,
+ int look_ahead = 1000,
+ 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. A separate debug output may be connected, to
+ * view the internal EWMA described below.
+ *
+ * \param threshold_factor_rise The threshold factor determins when a peak
+ * is present. An EWMA average of the signal is calculated and when the
+ * value of the signal goes over threshold_factor_rise*average, we
+ * call the peak.
+ * \param look_ahead The look-ahead value is used when the threshold is
+ * found to locate the peak within this range.
+ * \param alpha The gain value of a single-pole moving average filter
+ */
+
+class GR_CORE_API gr_peak_detector2_fb : public gr_sync_block
+{
+ friend GR_CORE_API gr_peak_detector2_fb_sptr
+ gr_make_peak_detector2_fb (float threshold_factor_rise, int look_ahead, float alpha);
+
+ gr_peak_detector2_fb (float threshold_factor_rise, int look_ahead, float alpha);
+
+private:
+ float d_threshold_factor_rise;
+ int d_look_ahead;
+ int d_look_ahead_remaining;
+ int d_peak_ind;
+ float d_peak_val;
+ float d_alpha;
+ float d_avg;
+ bool 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 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_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 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_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/general/gr_peak_detector2_fb.i b/gnuradio-core/src/lib/general/gr_peak_detector2_fb.i
new file mode 100644
index 000000000..ec7227e69
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_peak_detector2_fb.i
@@ -0,0 +1,45 @@
+/* -*- 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.
+ */
+
+
+GR_SWIG_BLOCK_MAGIC(gr,peak_detector2_fb)
+
+ gr_peak_detector2_fb_sptr gr_make_peak_detector2_fb (float threshold_factor_rise = 7,
+ int look_ahead = 1000,
+ float alpha=0.001);
+
+class gr_peak_detector2_fb : public gr_sync_block
+{
+private:
+ gr_peak_detector2_fb (float threshold_factor_rise, int look_ahead, float alpha);
+
+public:
+ void set_threshold_factor_rise(float thr) { d_threshold_factor_rise = 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; }
+ int look_ahead() { return d_look_ahead; }
+ float alpha() { return d_avg_alpha; }
+};
+
+
diff --git a/gnuradio-core/src/lib/general/gr_phase_modulator_fc.cc b/gnuradio-core/src/lib/general/gr_phase_modulator_fc.cc
new file mode 100644
index 000000000..fb05c85a5
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_phase_modulator_fc.cc
@@ -0,0 +1,62 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_phase_modulator_fc.h>
+#include <gr_io_signature.h>
+#include <gr_sincos.h>
+#include <math.h>
+
+
+gr_phase_modulator_fc_sptr gr_make_phase_modulator_fc (double sensitivity)
+{
+ return gnuradio::get_initial_sptr(new gr_phase_modulator_fc (sensitivity));
+}
+
+gr_phase_modulator_fc::gr_phase_modulator_fc (double sensitivity)
+ : gr_sync_block ("phase_modulator_fc",
+ gr_make_io_signature (1, 1, sizeof (float)),
+ gr_make_io_signature (1, 1, sizeof (gr_complex))),
+ d_sensitivity (sensitivity), d_phase (0)
+{
+}
+
+int
+gr_phase_modulator_fc::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const float *in = (const float *) input_items[0];
+ gr_complex *out = (gr_complex *) output_items[0];
+
+ for (int i = 0; i < noutput_items; i++){
+ d_phase = d_sensitivity * in[i];
+ float oi, oq;
+ gr_sincosf (d_phase, &oq, &oi);
+ out[i] = gr_complex (oi, oq);
+ }
+
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/general/gr_phase_modulator_fc.h b/gnuradio-core/src/lib/general/gr_phase_modulator_fc.h
new file mode 100644
index 000000000..07f3b82d4
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_phase_modulator_fc.h
@@ -0,0 +1,56 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005,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.
+ */
+
+#ifndef INCLUDED_GR_PHASE_MODULATOR_FC_H
+#define INCLUDED_GR_PHASE_MODULATOR_FC_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+
+class gr_phase_modulator_fc;
+typedef boost::shared_ptr<gr_phase_modulator_fc> gr_phase_modulator_fc_sptr;
+
+GR_CORE_API gr_phase_modulator_fc_sptr gr_make_phase_modulator_fc (double sensitivity);
+
+/*!
+ * \brief Phase modulator block
+ * \ingroup modulation_blk
+ * output=complex(cos(in*sensitivity),sin(in*sensitivity))
+ */
+class GR_CORE_API gr_phase_modulator_fc : public gr_sync_block
+{
+ double d_sensitivity;
+ double d_phase;
+
+ friend GR_CORE_API gr_phase_modulator_fc_sptr
+ gr_make_phase_modulator_fc (double sensitivity);
+
+ gr_phase_modulator_fc (double sensitivity);
+
+ public:
+
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif /* INCLUDED_GR_PHASE_MODULATOR_FC_H */
diff --git a/gnuradio-core/src/lib/general/gr_phase_modulator_fc.i b/gnuradio-core/src/lib/general/gr_phase_modulator_fc.i
new file mode 100644
index 000000000..c1816c647
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_phase_modulator_fc.i
@@ -0,0 +1,31 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005,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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,phase_modulator_fc)
+
+gr_phase_modulator_fc_sptr gr_make_phase_modulator_fc (double sensitivity);
+
+class gr_phase_modulator_fc : public gr_sync_block
+{
+ private:
+ gr_phase_modulator_fc (double sensitivity);
+};
diff --git a/gnuradio-core/src/lib/general/gr_pll_carriertracking_cc.cc b/gnuradio-core/src/lib/general/gr_pll_carriertracking_cc.cc
new file mode 100644
index 000000000..b7b1291a3
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_pll_carriertracking_cc.cc
@@ -0,0 +1,120 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_pll_carriertracking_cc.h>
+#include <gr_io_signature.h>
+#include <gr_sincos.h>
+#include <math.h>
+#include <gr_math.h>
+
+#ifndef M_TWOPI
+#define M_TWOPI (2.0f*M_PI)
+#endif
+
+gr_pll_carriertracking_cc_sptr
+gr_make_pll_carriertracking_cc (float loop_bw, float max_freq, float min_freq)
+{
+ return gnuradio::get_initial_sptr(new gr_pll_carriertracking_cc (loop_bw, max_freq, min_freq));
+}
+
+gr_pll_carriertracking_cc::gr_pll_carriertracking_cc (float loop_bw,
+ float max_freq,
+ float min_freq)
+ : gr_sync_block ("pll_carriertracking_cc",
+ gr_make_io_signature (1, 1, sizeof (gr_complex)),
+ gr_make_io_signature (1, 1, sizeof (gr_complex))),
+ gri_control_loop(loop_bw, max_freq, min_freq),
+ d_locksig(0), d_lock_threshold(0), d_squelch_enable(false)
+{
+}
+
+float
+gr_pll_carriertracking_cc::mod_2pi (float in)
+{
+ if(in>M_PI)
+ return in-M_TWOPI;
+ else if(in<-M_PI)
+ return in+M_TWOPI;
+ else
+ return in;
+}
+
+float
+gr_pll_carriertracking_cc::phase_detector(gr_complex sample,float ref_phase)
+{
+ float sample_phase;
+ // sample_phase = atan2(sample.imag(),sample.real());
+ sample_phase = gr_fast_atan2f(sample.imag(),sample.real());
+ return mod_2pi(sample_phase-ref_phase);
+}
+
+bool
+gr_pll_carriertracking_cc::lock_detector(void)
+{
+ return (fabsf(d_locksig) > d_lock_threshold);
+}
+
+bool
+gr_pll_carriertracking_cc::squelch_enable(bool set_squelch)
+{
+ return d_squelch_enable = set_squelch;
+}
+
+float
+gr_pll_carriertracking_cc::set_lock_threshold(float threshold)
+{
+ return d_lock_threshold = threshold;
+}
+
+int
+gr_pll_carriertracking_cc::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const gr_complex *iptr = (gr_complex *) input_items[0];
+ gr_complex *optr = (gr_complex *) output_items[0];
+
+ float error;
+ float t_imag, t_real;
+
+ for (int i = 0; i < noutput_items; i++){
+ gr_sincosf(d_phase, &t_imag, &t_real);
+ optr[i] = iptr[i] * gr_complex(t_real, -t_imag);
+
+ error = phase_detector(iptr[i],d_phase);
+
+ advance_loop(error);
+ phase_wrap();
+ frequency_limit();
+
+ d_locksig = d_locksig * (1.0 - d_alpha) + \
+ d_alpha*(iptr[i].real() * t_real + iptr[i].imag() * t_imag);
+
+ if ((d_squelch_enable) && !lock_detector())
+ optr[i] = 0;
+ }
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/general/gr_pll_carriertracking_cc.h b/gnuradio-core/src/lib/general/gr_pll_carriertracking_cc.h
new file mode 100644
index 000000000..b3bc5ddd0
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_pll_carriertracking_cc.h
@@ -0,0 +1,74 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2006,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.
+ */
+
+#ifndef INCLUDED_GR_PLL_CARRIERTRACKING_CC_H
+#define INCLUDED_GR_PLL_CARRIERTRACKING_CC_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+#include <gri_control_loop.h>
+
+class gr_pll_carriertracking_cc;
+typedef boost::shared_ptr<gr_pll_carriertracking_cc> gr_pll_carriertracking_cc_sptr;
+
+GR_CORE_API gr_pll_carriertracking_cc_sptr gr_make_pll_carriertracking_cc (float loop_bw,
+ float max_freq,
+ float min_freq);
+/*!
+ * \brief Implements a PLL which locks to the input frequency and outputs the
+ * input signal mixed with that carrier.
+ * \ingroup sync_blk
+ *
+ * input: stream of complex; output: stream of complex
+ *
+ * This PLL locks onto a [possibly noisy] reference carrier on
+ * the input and outputs that signal, downconverted to DC
+ *
+ * All settings max_freq and min_freq are in terms of radians per sample,
+ * NOT HERTZ. The loop bandwidth determins the lock range and should be set
+ * around pi/200 -- 2pi/100.
+ * \sa gr_pll_freqdet_cf, gr_pll_carriertracking_cc
+ */
+
+class GR_CORE_API gr_pll_carriertracking_cc : public gr_sync_block, public gri_control_loop
+{
+ friend GR_CORE_API gr_pll_carriertracking_cc_sptr gr_make_pll_carriertracking_cc (float loop_bw,
+ float max_freq,
+ float min_freq);
+
+ float d_locksig,d_lock_threshold;
+ bool d_squelch_enable;
+ gr_pll_carriertracking_cc (float loop_bw, float max_freq, float min_freq);
+
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+private:
+ float mod_2pi (float in);
+ float phase_detector(gr_complex sample,float ref_phase);
+public:
+ bool lock_detector(void);
+ bool squelch_enable(bool);
+ float set_lock_threshold(float);
+};
+
+#endif
diff --git a/gnuradio-core/src/lib/general/gr_pll_carriertracking_cc.i b/gnuradio-core/src/lib/general/gr_pll_carriertracking_cc.i
new file mode 100644
index 000000000..a20adf7e2
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_pll_carriertracking_cc.i
@@ -0,0 +1,39 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005,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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,pll_carriertracking_cc);
+
+gr_pll_carriertracking_cc_sptr
+gr_make_pll_carriertracking_cc (float loop_bw,
+ float max_freq,
+ float min_freq);
+
+class gr_pll_carriertracking_cc : public gr_sync_block, public gri_control_loop
+{
+ private:
+ gr_pll_carriertracking_cc (float loop_bw, float max_freq, float min_freq);
+ public:
+ bool lock_detector(void);
+ bool squelch_enable(bool);
+ float set_lock_threshold(float);
+
+};
diff --git a/gnuradio-core/src/lib/general/gr_pll_freqdet_cf.cc b/gnuradio-core/src/lib/general/gr_pll_freqdet_cf.cc
new file mode 100644
index 000000000..f80f4ed07
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_pll_freqdet_cf.cc
@@ -0,0 +1,90 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_pll_freqdet_cf.h>
+#include <gr_io_signature.h>
+#include <math.h>
+#include <gr_math.h>
+
+#ifndef M_TWOPI
+#define M_TWOPI (2.0f*M_PI)
+#endif
+
+gr_pll_freqdet_cf_sptr
+gr_make_pll_freqdet_cf (float loop_bw, float max_freq, float min_freq)
+{
+ return gnuradio::get_initial_sptr(new gr_pll_freqdet_cf (loop_bw, max_freq, min_freq));
+}
+
+gr_pll_freqdet_cf::gr_pll_freqdet_cf (float loop_bw, float max_freq, float min_freq)
+ : gr_sync_block ("pll_freqdet_cf",
+ gr_make_io_signature (1, 1, sizeof (gr_complex)),
+ gr_make_io_signature (1, 1, sizeof (float))),
+ gri_control_loop(loop_bw, max_freq, min_freq)
+{
+}
+
+float
+gr_pll_freqdet_cf::mod_2pi (float in)
+{
+ if(in>M_PI)
+ return in-M_TWOPI;
+ else if(in<-M_PI)
+ return in+M_TWOPI;
+ else
+ return in;
+}
+
+float
+gr_pll_freqdet_cf::phase_detector(gr_complex sample,float ref_phase)
+{
+ float sample_phase;
+ sample_phase = gr_fast_atan2f(sample.imag(),sample.real());
+ return mod_2pi(sample_phase-ref_phase);
+}
+
+int
+gr_pll_freqdet_cf::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const gr_complex *iptr = (gr_complex *) input_items[0];
+ float *optr = (float *) output_items[0];
+
+ float error;
+ int size = noutput_items;
+
+ while (size-- > 0) {
+ *optr++ = d_freq;
+
+ error = phase_detector(*iptr++,d_phase);
+
+ advance_loop(error);
+ phase_wrap();
+ frequency_limit();
+ }
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/general/gr_pll_freqdet_cf.h b/gnuradio-core/src/lib/general/gr_pll_freqdet_cf.h
new file mode 100644
index 000000000..3dfc8d709
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_pll_freqdet_cf.h
@@ -0,0 +1,67 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,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.
+ */
+
+#ifndef INCLUDED_GR_PLL_FREQDET_CF_H
+#define INCLUDED_GR_PLL_FREQDET_CF_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+#include <gri_control_loop.h>
+
+class gr_pll_freqdet_cf;
+typedef boost::shared_ptr<gr_pll_freqdet_cf> gr_pll_freqdet_cf_sptr;
+
+GR_CORE_API gr_pll_freqdet_cf_sptr gr_make_pll_freqdet_cf (float loop_bw,
+ float max_freq,
+ float min_freq);
+/*!
+ * \brief Implements a PLL which locks to the input frequency and outputs
+ * an estimate of that frequency. Useful for FM Demod.
+ * \ingroup sync_blk
+ *
+ * input: stream of complex; output: stream of floats
+ *
+ * This PLL locks onto a [possibly noisy] reference carrier on
+ * the input and outputs an estimate of that frequency in radians per sample.
+ * All settings max_freq and min_freq are in terms of radians per sample,
+ * NOT HERTZ. The loop bandwidth determins the lock range and should be set
+ * around pi/200 -- 2pi/100.
+ * \sa gr_pll_refout_cc, gr_pll_carriertracking_cc
+ */
+
+class GR_CORE_API gr_pll_freqdet_cf : public gr_sync_block, public gri_control_loop
+{
+ friend GR_CORE_API gr_pll_freqdet_cf_sptr gr_make_pll_freqdet_cf (float loop_bw,
+ float max_freq,
+ float min_freq);
+
+ float mod_2pi (float in);
+ gr_pll_freqdet_cf (float loop_bw, float max_freq, float min_freq);
+
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+private:
+ float phase_detector(gr_complex sample,float ref_phase);
+};
+
+#endif
diff --git a/gnuradio-core/src/lib/general/gr_pll_freqdet_cf.i b/gnuradio-core/src/lib/general/gr_pll_freqdet_cf.i
new file mode 100644
index 000000000..87e515adb
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_pll_freqdet_cf.i
@@ -0,0 +1,33 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005,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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,pll_freqdet_cf)
+
+ gr_pll_freqdet_cf_sptr gr_make_pll_freqdet_cf (float loop_bw,
+ float max_freq,
+ float min_freq);
+
+class gr_pll_freqdet_cf : public gr_sync_block, public gri_control_loop
+{
+ private:
+ gr_pll_freqdet_cf (float loop_bw, float max_freq, float min_freq);
+};
diff --git a/gnuradio-core/src/lib/general/gr_pll_refout_cc.cc b/gnuradio-core/src/lib/general/gr_pll_refout_cc.cc
new file mode 100644
index 000000000..9f95c3f64
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_pll_refout_cc.cc
@@ -0,0 +1,93 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_pll_refout_cc.h>
+#include <gr_io_signature.h>
+#include <gr_sincos.h>
+#include <math.h>
+#include <gr_math.h>
+
+#ifndef M_TWOPI
+#define M_TWOPI (2.0f*M_PI)
+#endif
+
+gr_pll_refout_cc_sptr
+gr_make_pll_refout_cc (float loop_bw, float max_freq, float min_freq)
+{
+ return gnuradio::get_initial_sptr(new gr_pll_refout_cc (loop_bw, max_freq, min_freq));
+}
+
+gr_pll_refout_cc::gr_pll_refout_cc (float loop_bw, float max_freq, float min_freq)
+ : gr_sync_block ("pll_refout_cc",
+ gr_make_io_signature (1, 1, sizeof (gr_complex)),
+ gr_make_io_signature (1, 1, sizeof (gr_complex))),
+ gri_control_loop(loop_bw, max_freq, min_freq)
+{
+}
+
+float
+gr_pll_refout_cc::mod_2pi (float in)
+{
+ if(in>M_PI)
+ return in-M_TWOPI;
+ else if(in<-M_PI)
+ return in+M_TWOPI;
+ else
+ return in;
+}
+
+float
+gr_pll_refout_cc::phase_detector(gr_complex sample,float ref_phase)
+{
+ float sample_phase;
+ sample_phase = gr_fast_atan2f(sample.imag(),sample.real());
+ return mod_2pi(sample_phase-ref_phase);
+}
+
+int
+gr_pll_refout_cc::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const gr_complex *iptr = (gr_complex *) input_items[0];
+ gr_complex *optr = (gr_complex *) output_items[0];
+
+ float error;
+ float t_imag, t_real;
+ int size = noutput_items;
+
+ while (size-- > 0) {
+ gr_sincosf(d_phase,&t_imag,&t_real);
+ *optr++ = gr_complex(t_real,t_imag);
+
+ error = phase_detector(*iptr++,d_phase);
+
+ advance_loop(error);
+ phase_wrap();
+ frequency_limit();
+ }
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/general/gr_pll_refout_cc.h b/gnuradio-core/src/lib/general/gr_pll_refout_cc.h
new file mode 100644
index 000000000..ef5cd31e2
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_pll_refout_cc.h
@@ -0,0 +1,65 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,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.
+ */
+
+#ifndef INCLUDED_GR_PLL_REFOUT_CC_H
+#define INCLUDED_GR_PLL_REFOUT_CC_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+#include <gri_control_loop.h>
+
+class gr_pll_refout_cc;
+typedef boost::shared_ptr<gr_pll_refout_cc> gr_pll_refout_cc_sptr;
+
+GR_CORE_API gr_pll_refout_cc_sptr gr_make_pll_refout_cc (float loop_bw,
+ float max_freq, float min_freq);
+/*!
+ * \brief Implements a PLL which locks to the input frequency and outputs a carrier
+ * \ingroup sync_blk
+ *
+ * input: stream of complex; output: stream of complex
+ *
+ * This PLL locks onto a [possibly noisy] reference carrier on
+ * the input and outputs a clean version which is phase and frequency
+ * aligned to it.
+ *
+ * All settings max_freq and min_freq are in terms of radians per sample,
+ * NOT HERTZ. The loop bandwidth determins the lock range and should be set
+ * around pi/200 -- 2pi/100.
+ * \sa gr_pll_freqdet_cf, gr_pll_carriertracking_cc
+ */
+class GR_CORE_API gr_pll_refout_cc : public gr_sync_block, public gri_control_loop
+{
+ friend GR_CORE_API gr_pll_refout_cc_sptr gr_make_pll_refout_cc (float loop_bw,
+ float max_freq, float min_freq);
+
+ gr_pll_refout_cc (float loop_bw, float max_freq, float min_freq);
+
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+private:
+ float mod_2pi (float in);
+ float phase_detector(gr_complex sample, float ref_phase);
+};
+
+#endif
diff --git a/gnuradio-core/src/lib/general/gr_pll_refout_cc.i b/gnuradio-core/src/lib/general/gr_pll_refout_cc.i
new file mode 100644
index 000000000..630c0444f
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_pll_refout_cc.i
@@ -0,0 +1,32 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005,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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,pll_refout_cc)
+
+gr_pll_refout_cc_sptr gr_make_pll_refout_cc (float loop_bw,
+ float max_freq, float min_freq);
+
+class gr_pll_refout_cc : public gr_sync_block, public gri_control_loop
+{
+ private:
+ gr_pll_refout_cc (float loop_bw, float max_freq, float min_freq);
+};
diff --git a/gnuradio-core/src/lib/general/gr_pn_correlator_cc.cc b/gnuradio-core/src/lib/general/gr_pn_correlator_cc.cc
new file mode 100644
index 000000000..818e48c34
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_pn_correlator_cc.cc
@@ -0,0 +1,77 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_pn_correlator_cc.h>
+#include <gr_io_signature.h>
+
+gr_pn_correlator_cc_sptr
+gr_make_pn_correlator_cc(int degree, int mask, int seed)
+{
+ return gnuradio::get_initial_sptr(new gr_pn_correlator_cc(degree, mask, seed));
+}
+
+gr_pn_correlator_cc::gr_pn_correlator_cc(int degree, int mask, int seed)
+ : gr_sync_decimator ("pn_correlator_cc",
+ gr_make_io_signature (1, 1, sizeof(gr_complex)),
+ gr_make_io_signature (1, 1, sizeof(gr_complex)),
+ (unsigned int)((1ULL << degree)-1)) // PN code length
+{
+ d_len = (unsigned int)((1ULL << degree)-1);
+ if (mask == 0)
+ mask = gri_glfsr::glfsr_mask(degree);
+ d_reference = new gri_glfsr(mask, seed);
+ for (int i = 0; i < d_len; i++) // initialize to last value in sequence
+ d_pn = 2.0*d_reference->next_bit()-1.0;
+}
+
+gr_pn_correlator_cc::~gr_pn_correlator_cc()
+{
+ delete d_reference;
+}
+
+int
+gr_pn_correlator_cc::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const gr_complex *in = (const gr_complex *) input_items[0];
+ gr_complex *out = (gr_complex *) output_items[0];
+ gr_complex sum;
+
+ for (int i = 0; i < noutput_items; i++) {
+ sum = 0.0;
+
+ for (int j = 0; j < d_len; j++) {
+ if (j != 0) // retard PN generator one sample per period
+ d_pn = 2.0*d_reference->next_bit()-1.0; // no conditionals
+ sum += *in++ * d_pn;
+ }
+
+ *out++ = sum*gr_complex(1.0/d_len, 0.0);
+ }
+
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/general/gr_pn_correlator_cc.h b/gnuradio-core/src/lib/general/gr_pn_correlator_cc.h
new file mode 100644
index 000000000..69bd2c502
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_pn_correlator_cc.h
@@ -0,0 +1,62 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_GR_PN_CORRELATOR_CC_H
+#define INCLUDED_GR_PN_CORRELATOR_CC_H
+
+#include <gr_core_api.h>
+#include <gr_sync_decimator.h>
+#include <gri_glfsr.h>
+
+class gr_pn_correlator_cc;
+typedef boost::shared_ptr<gr_pn_correlator_cc> gr_pn_correlator_cc_sptr;
+
+GR_CORE_API gr_pn_correlator_cc_sptr
+gr_make_pn_correlator_cc(int degree, int mask=0, int seed=1);
+/*!
+ * \brief PN code sequential search correlator
+ *
+ * \ingroup sync_blk
+ * Receives complex baseband signal, outputs complex correlation against
+ * reference PN code, one sample per PN code period
+ */
+
+class GR_CORE_API gr_pn_correlator_cc : public gr_sync_decimator
+{
+ friend GR_CORE_API gr_pn_correlator_cc_sptr gr_make_pn_correlator_cc(int degree, int mask, int seed);
+
+ int d_len;
+ float d_pn;
+ gri_glfsr *d_reference;
+
+ protected:
+ gr_pn_correlator_cc(int degree, int mask, int seed);
+
+ public:
+ virtual int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+
+ ~gr_pn_correlator_cc();
+};
+
+#endif /* INCLUDED_GR_PN_CORRELATOR_CC_H */
diff --git a/gnuradio-core/src/lib/general/gr_pn_correlator_cc.i b/gnuradio-core/src/lib/general/gr_pn_correlator_cc.i
new file mode 100644
index 000000000..e992f33a7
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_pn_correlator_cc.i
@@ -0,0 +1,32 @@
+/* -*- 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,pn_correlator_cc)
+
+gr_pn_correlator_cc_sptr
+gr_make_pn_correlator_cc(int degree, int mask=0, int seed=1);
+
+class gr_pn_correlator_cc : public gr_sync_decimator
+{
+ protected:
+ gr_pn_correlator_cc();
+};
diff --git a/gnuradio-core/src/lib/general/gr_prefs.cc b/gnuradio-core/src/lib/general/gr_prefs.cc
new file mode 100644
index 000000000..9705eed4f
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_prefs.cc
@@ -0,0 +1,229 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <gr_prefs.h>
+#include <gr_sys_paths.h>
+#include <gr_constants.h>
+#include <algorithm>
+
+#include <boost/filesystem/operations.hpp>
+#include <boost/filesystem/path.hpp>
+#include <boost/filesystem/fstream.hpp>
+namespace fs = boost::filesystem;
+
+/*
+ * Stub implementations
+ */
+
+static gr_prefs s_default_singleton;
+static gr_prefs *s_singleton = &s_default_singleton;
+
+gr_prefs *
+gr_prefs::singleton()
+{
+ return s_singleton;
+}
+
+void
+gr_prefs::set_singleton(gr_prefs *p)
+{
+ s_singleton = p;
+}
+
+gr_prefs::gr_prefs()
+{
+ _read_files();
+}
+
+gr_prefs::~gr_prefs()
+{
+ // nop
+}
+
+std::vector<std::string>
+gr_prefs::_sys_prefs_filenames()
+{
+ std::vector<std::string> fnames;
+
+ fs::path dir = gr_prefsdir();
+ if(!fs::is_directory(dir))
+ return fnames;
+
+ fs::directory_iterator diritr(dir);
+ while(diritr != fs::directory_iterator()) {
+ fs::path p = *diritr++;
+ fnames.push_back(p.string());
+ }
+ std::sort(fnames.begin(), fnames.end());
+
+ // Find if there is a ~/.gnuradio/config file and add this to the
+ // beginning of the file list to override any preferences in the
+ // installed path config files.
+ fs::path homedir = fs::path(gr_appdata_path());
+ homedir = homedir/".gnuradio/config.conf";
+ if(fs::exists(homedir)) {
+ fnames.insert(fnames.begin(), homedir.string());
+ }
+
+ return fnames;
+}
+
+void
+gr_prefs::_read_files()
+{
+ std::vector<std::string> filenames = _sys_prefs_filenames();
+ std::vector<std::string>::iterator sitr;
+ char tmp[1024];
+ for(sitr = filenames.begin(); sitr != filenames.end(); sitr++) {
+ fs::ifstream fin(*sitr);
+ while(!fin.eof()) {
+ fin.getline(tmp, 1024);
+ std::string t(tmp);
+ // ignore empty lines or lines of just comments
+ if((t.size() > 0) && (t[0] != '#')) {
+ // remove any comments in the line
+ size_t hash = t.find("#");
+
+ // Use hash marks at the end of each segment as a delimiter
+ d_configs += t.substr(0, hash) + '#';
+ }
+ }
+ fin.close();
+ }
+
+ // Remove all whitespace
+ d_configs.erase(std::remove_if(d_configs.begin(), d_configs.end(), ::isspace), d_configs.end());
+}
+
+bool
+gr_prefs::has_section(const std::string &section)
+{
+ size_t t = d_configs.find("[" + section + "]#");
+ return t != std::string::npos;
+}
+
+bool
+gr_prefs::has_option(const std::string &section, const std::string &option)
+{
+ if(has_section(section)) {
+ size_t sec = d_configs.find("[" + section + "]#");
+ size_t opt = d_configs.find("#" + option + "=", sec);
+ return opt != std::string::npos;
+ }
+ else {
+ return false;
+ }
+}
+
+const std::string
+gr_prefs::get_string(const std::string &section, const std::string &option,
+ const std::string &default_val)
+{
+ std::stringstream envname;
+ std::string secname=section, optname=option;
+
+ std::transform(section.begin(), section.end(), secname.begin(), ::toupper);
+ std::transform(option.begin(), option.end(), optname.begin(), ::toupper);
+ envname << "GR_CONF_" << secname << "_" << optname;
+
+ char *v = getenv(envname.str().c_str());
+ if(v) {
+ return std::string(v);
+ }
+
+ if(has_option(section, option)) {
+ std::string optname = "#" + option + "=";
+ size_t sec = d_configs.find("[" + section + "]#");
+ size_t opt = d_configs.find(optname, sec);
+
+ size_t start = opt + optname.size();
+ size_t end = d_configs.find("#", start);
+ size_t len = end - start;
+
+ return d_configs.substr(start, len);
+ }
+ else {
+ return default_val;
+ }
+}
+
+bool
+gr_prefs::get_bool(const std::string &section, const std::string &option, bool default_val)
+{
+ if(has_option(section, option)) {
+ std::string str = get_string(section, option, "");
+ if(str == "") {
+ return default_val;
+ }
+ std::transform(str.begin(), str.end(), str.begin(), ::tolower);
+ if((str == "true") || (str == "on") || (str == "1"))
+ return true;
+ else if((str == "false") || (str == "off") || (str == "0"))
+ return false;
+ else
+ return default_val;
+ }
+ else {
+ return default_val;
+ }
+}
+
+long
+gr_prefs::get_long(const std::string &section, const std::string &option, long default_val)
+{
+ if(has_option(section, option)) {
+ std::string str = get_string(section, option, "");
+ if(str == "") {
+ return default_val;
+ }
+ std::stringstream sstr(str);
+ long n;
+ sstr >> n;
+ return n;
+ }
+ else {
+ return default_val;
+ }
+}
+
+double
+gr_prefs::get_double(const std::string &section, const std::string &option, double default_val)
+{
+ if(has_option(section, option)) {
+ std::string str = get_string(section, option, "");
+ if(str == "") {
+ return default_val;
+ }
+ std::stringstream sstr(str);
+ double n;
+ sstr >> n;
+ return n;
+ }
+ else {
+ return default_val;
+ }
+}
+
diff --git a/gnuradio-core/src/lib/general/gr_prefs.h b/gnuradio-core/src/lib/general/gr_prefs.h
new file mode 100644
index 000000000..dc2745d16
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_prefs.h
@@ -0,0 +1,94 @@
+/* -*- 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.
+ */
+#ifndef INCLUDED_GR_PREFS_H
+#define INCLUDED_GR_PREFS_H
+
+#include <gr_core_api.h>
+#include <string>
+#include <gruel/thread.h>
+
+/*!
+ * \brief Base class for representing user preferences a la windows INI files.
+ * \ingroup misc
+ *
+ * The real implementation is in Python, and is accessable from C++
+ * via the magic of SWIG directors.
+ */
+
+class GR_CORE_API gr_prefs
+{
+public:
+ static gr_prefs *singleton();
+ static void set_singleton(gr_prefs *p);
+
+ gr_prefs();
+ virtual ~gr_prefs();
+
+ /*!
+ * \brief Does \p section exist?
+ */
+ virtual bool has_section(const std::string &section);
+
+ /*!
+ * \brief Does \p option exist?
+ */
+ virtual bool has_option(const std::string &section, const std::string &option);
+
+ /*!
+ * \brief If option exists return associated value; else default_val.
+ */
+ virtual const std::string get_string(const std::string &section,
+ const std::string &option,
+ const std::string &default_val);
+
+ /*!
+ * \brief If option exists and value can be converted to bool, return it; else default_val.
+ */
+ virtual bool get_bool(const std::string &section,
+ const std::string &option,
+ bool default_val);
+
+ /*!
+ * \brief If option exists and value can be converted to long, return it; else default_val.
+ */
+ virtual long get_long(const std::string &section,
+ const std::string &option,
+ long default_val);
+
+ /*!
+ * \brief If option exists and value can be converted to double, return it; else default_val.
+ */
+ virtual double get_double(const std::string &section,
+ const std::string &option,
+ double default_val);
+
+ protected:
+ virtual std::vector<std::string> _sys_prefs_filenames();
+ virtual void _read_files();
+
+ private:
+ gruel::mutex d_mutex;
+ std::string d_configs;
+};
+
+
+#endif /* INCLUDED_GR_PREFS_H */
diff --git a/gnuradio-core/src/lib/general/gr_prefs.i b/gnuradio-core/src/lib/general/gr_prefs.i
new file mode 100644
index 000000000..b21d47f3b
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_prefs.i
@@ -0,0 +1,69 @@
+/* -*- 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.
+ */
+
+class gr_prefs
+{
+public:
+ static gr_prefs *singleton();
+ static void set_singleton(gr_prefs *p);
+
+ virtual ~gr_prefs();
+
+ /*!
+ * \brief Does \p section exist?
+ */
+ virtual bool has_section(const std::string &section);
+
+ /*!
+ * \brief Does \p option exist?
+ */
+ virtual bool has_option(const std::string &section, const std::string &option);
+
+ /*!
+ * \brief If option exists return associated value; else default_val.
+ */
+ virtual const std::string get_string(const std::string &section,
+ const std::string &option,
+ const std::string &default_val);
+
+ /*!
+ * \brief If option exists and value can be converted to bool, return it; else default_val.
+ */
+ virtual bool get_bool(const std::string &section,
+ const std::string &option,
+ bool default_val);
+
+ /*!
+ * \brief If option exists and value can be converted to long, return it; else default_val.
+ */
+ virtual long get_long(const std::string &section,
+ const std::string &option,
+ long default_val);
+
+ /*!
+ * \brief If option exists and value can be converted to double, return it; else default_val.
+ */
+ virtual double get_double(const std::string &section,
+ const std::string &option,
+ double default_val);
+};
+
diff --git a/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_c.cc b/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_c.cc
new file mode 100644
index 000000000..6430d2753
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_c.cc
@@ -0,0 +1,84 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+#include <gr_probe_avg_mag_sqrd_c.h>
+#include <gr_io_signature.h>
+#include <cmath>
+
+gr_probe_avg_mag_sqrd_c_sptr
+gr_make_probe_avg_mag_sqrd_c(double threshold_db, double alpha)
+{
+ return gnuradio::get_initial_sptr(new gr_probe_avg_mag_sqrd_c(threshold_db, alpha));
+}
+
+gr_probe_avg_mag_sqrd_c::gr_probe_avg_mag_sqrd_c (double threshold_db, double alpha)
+ : gr_sync_block ("probe_avg_mag_sqrd_c",
+ gr_make_io_signature(1, 1, sizeof(gr_complex)),
+ gr_make_io_signature(0, 0, 0)),
+ d_iir(alpha), d_unmuted(false), d_level(0)
+{
+ set_threshold (threshold_db);
+}
+
+gr_probe_avg_mag_sqrd_c::~gr_probe_avg_mag_sqrd_c()
+{
+}
+
+
+int
+gr_probe_avg_mag_sqrd_c::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const gr_complex *in = (const gr_complex *) input_items[0];
+
+ for (int i = 0; i < noutput_items; i++){
+ double mag_sqrd = in[i].real()*in[i].real() + in[i].imag()*in[i].imag();
+ d_iir.filter(mag_sqrd); // computed for side effect: prev_output()
+ }
+
+ d_unmuted = d_iir.prev_output() >= d_threshold;
+ d_level = d_iir.prev_output();
+ return noutput_items;
+}
+
+double
+gr_probe_avg_mag_sqrd_c::threshold() const
+{
+ return 10 * std::log10(d_threshold);
+}
+
+void
+gr_probe_avg_mag_sqrd_c::set_threshold(double decibels)
+{
+ // convert to absolute threshold (mag squared)
+ d_threshold = std::pow(10.0, decibels/10);
+}
+
+void
+gr_probe_avg_mag_sqrd_c::set_alpha(double alpha)
+{
+ d_iir.set_taps(alpha);
+}
diff --git a/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_c.h b/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_c.h
new file mode 100644
index 000000000..2811677cf
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_c.h
@@ -0,0 +1,75 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005,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.
+ */
+#ifndef INCLUDED_GR_PROBE_AVG_MAG_SQRD_C_H
+#define INCLUDED_GR_PROBE_AVG_MAG_SQRD_C_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+#include <gr_single_pole_iir.h>
+
+class gr_probe_avg_mag_sqrd_c;
+typedef boost::shared_ptr<gr_probe_avg_mag_sqrd_c> gr_probe_avg_mag_sqrd_c_sptr;
+
+GR_CORE_API gr_probe_avg_mag_sqrd_c_sptr
+gr_make_probe_avg_mag_sqrd_c (double threshold_db, double alpha = 0.0001);
+
+/*!
+ * \brief compute avg magnitude squared.
+ * \ingroup sink_blk
+ *
+ * input: gr_complex
+ *
+ * Compute a running average of the magnitude squared of the the input.
+ * The level and indication as to whether the level exceeds threshold
+ * can be retrieved with the level and unmuted accessors.
+ */
+class GR_CORE_API gr_probe_avg_mag_sqrd_c : public gr_sync_block
+{
+ double d_threshold;
+ gr_single_pole_iir<double,double,double> d_iir;
+ bool d_unmuted;
+ double d_level;
+
+ friend GR_CORE_API gr_probe_avg_mag_sqrd_c_sptr
+ gr_make_probe_avg_mag_sqrd_c (double threshold_db, double alpha);
+
+ gr_probe_avg_mag_sqrd_c (double threshold_db, double alpha);
+
+public:
+ ~gr_probe_avg_mag_sqrd_c ();
+
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+
+ // ACCESSORS
+ bool unmuted () const { return d_unmuted; }
+ double level () const { return d_level; }
+
+ double threshold() const;
+
+ // SETTERS
+ void set_alpha (double alpha);
+ void set_threshold (double decibels);
+};
+
+#endif /* INCLUDED_GR_PROBE_AVG_MAG_SQRD_C_H */
diff --git a/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_c.i b/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_c.i
new file mode 100644
index 000000000..bce244c12
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_c.i
@@ -0,0 +1,36 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005 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,probe_avg_mag_sqrd_c);
+
+gr_probe_avg_mag_sqrd_c_sptr
+gr_make_probe_avg_mag_sqrd_c (double threshold_db, double alpha = 0.0001);
+
+class gr_probe_avg_mag_sqrd_c : public gr_sync_block
+{
+public:
+ bool unmuted () const { return d_unmuted; }
+ double level () const { return d_level; }
+ void set_alpha (double alpha);
+ void set_threshold (double decibels);
+ double threshold();
+};
diff --git a/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_cf.cc b/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_cf.cc
new file mode 100644
index 000000000..b5946283b
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_cf.cc
@@ -0,0 +1,86 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+#include <gr_probe_avg_mag_sqrd_cf.h>
+#include <gr_io_signature.h>
+#include <cmath>
+
+gr_probe_avg_mag_sqrd_cf_sptr
+gr_make_probe_avg_mag_sqrd_cf(double threshold_db, double alpha)
+{
+ return gnuradio::get_initial_sptr(new gr_probe_avg_mag_sqrd_cf(threshold_db, alpha));
+}
+
+gr_probe_avg_mag_sqrd_cf::gr_probe_avg_mag_sqrd_cf (double threshold_db, double alpha)
+ : gr_sync_block ("probe_avg_mag_sqrd_cf",
+ gr_make_io_signature(1, 1, sizeof(gr_complex)),
+ gr_make_io_signature(1, 1, sizeof(float))),
+ d_iir(alpha), d_unmuted(false), d_level(0)
+{
+ set_threshold (threshold_db);
+}
+
+gr_probe_avg_mag_sqrd_cf::~gr_probe_avg_mag_sqrd_cf()
+{
+}
+
+
+int
+gr_probe_avg_mag_sqrd_cf::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const gr_complex *in = (const gr_complex *) input_items[0];
+ float *out = (float *) output_items[0];
+
+ for (int i = 0; i < noutput_items; i++){
+ out[i] = d_iir.prev_output();
+ double mag_sqrd = in[i].real()*in[i].real() + in[i].imag()*in[i].imag();
+ d_iir.filter(mag_sqrd); // computed for side effect: prev_output()
+ }
+
+ d_unmuted = d_iir.prev_output() >= d_threshold;
+ d_level = d_iir.prev_output();
+ return noutput_items;
+}
+
+double
+gr_probe_avg_mag_sqrd_cf::threshold() const
+{
+ return 10 * std::log10(d_threshold);
+}
+
+void
+gr_probe_avg_mag_sqrd_cf::set_threshold(double decibels)
+{
+ // convert to absolute threshold (mag squared)
+ d_threshold = std::pow(10.0, decibels/10);
+}
+
+void
+gr_probe_avg_mag_sqrd_cf::set_alpha(double alpha)
+{
+ d_iir.set_taps(alpha);
+}
diff --git a/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_cf.h b/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_cf.h
new file mode 100644
index 000000000..bb5d1ebf9
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_cf.h
@@ -0,0 +1,77 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005,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.
+ */
+#ifndef INCLUDED_GR_PROBE_AVG_MAG_SQRD_CF_H
+#define INCLUDED_GR_PROBE_AVG_MAG_SQRD_CF_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+#include <gr_single_pole_iir.h>
+
+class gr_probe_avg_mag_sqrd_cf;
+typedef boost::shared_ptr<gr_probe_avg_mag_sqrd_cf> gr_probe_avg_mag_sqrd_cf_sptr;
+
+GR_CORE_API gr_probe_avg_mag_sqrd_cf_sptr
+gr_make_probe_avg_mag_sqrd_cf (double threshold_db, double alpha = 0.0001);
+
+/*!
+ * \brief compute avg magnitude squared.
+ * \ingroup sink_blk
+ *
+ * input: gr_complex
+ * output: gr_float
+ *
+ * Compute a running average of the magnitude squared of the the input.
+ * The level and indication as to whether the level exceeds threshold
+ * can be retrieved with the level and unmuted accessors.
+ *
+ */
+class GR_CORE_API gr_probe_avg_mag_sqrd_cf : public gr_sync_block
+{
+ double d_threshold;
+ gr_single_pole_iir<double,double,double> d_iir;
+ bool d_unmuted;
+ double d_level;
+
+ friend GR_CORE_API gr_probe_avg_mag_sqrd_cf_sptr
+ gr_make_probe_avg_mag_sqrd_cf (double threshold_db, double alpha);
+
+ gr_probe_avg_mag_sqrd_cf (double threshold_db, double alpha);
+
+public:
+ ~gr_probe_avg_mag_sqrd_cf ();
+
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+
+ // ACCESSORS
+ bool unmuted () const { return d_unmuted; }
+ double level () const { return d_level; }
+
+ double threshold() const;
+
+ // SETTERS
+ void set_alpha (double alpha);
+ void set_threshold (double decibels);
+};
+
+#endif /* INCLUDED_GR_PROBE_AVG_MAG_SQRD_CF_H */
diff --git a/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_cf.i b/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_cf.i
new file mode 100644
index 000000000..bf76d973b
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_cf.i
@@ -0,0 +1,36 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005 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,probe_avg_mag_sqrd_cf);
+
+gr_probe_avg_mag_sqrd_cf_sptr
+gr_make_probe_avg_mag_sqrd_cf (double threshold_db, double alpha = 0.0001);
+
+class gr_probe_avg_mag_sqrd_cf : public gr_sync_block
+{
+public:
+ bool unmuted () const { return d_unmuted; }
+ double level () const { return d_level; }
+ void set_alpha (double alpha);
+ void set_threshold (double decibels);
+ double threshold();
+};
diff --git a/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_f.cc b/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_f.cc
new file mode 100644
index 000000000..4ed40743f
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_f.cc
@@ -0,0 +1,84 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+#include <gr_probe_avg_mag_sqrd_f.h>
+#include <gr_io_signature.h>
+#include <cmath>
+
+gr_probe_avg_mag_sqrd_f_sptr
+gr_make_probe_avg_mag_sqrd_f(double threshold_db, double alpha)
+{
+ return gnuradio::get_initial_sptr(new gr_probe_avg_mag_sqrd_f(threshold_db, alpha));
+}
+
+gr_probe_avg_mag_sqrd_f::gr_probe_avg_mag_sqrd_f (double threshold_db, double alpha)
+ : gr_sync_block ("probe_avg_mag_sqrd_f",
+ gr_make_io_signature(1, 1, sizeof(float)),
+ gr_make_io_signature(0, 0, 0)),
+ d_iir(alpha), d_unmuted(false), d_level(0)
+{
+ set_threshold (threshold_db);
+}
+
+gr_probe_avg_mag_sqrd_f::~gr_probe_avg_mag_sqrd_f()
+{
+}
+
+
+int
+gr_probe_avg_mag_sqrd_f::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const float *in = (const float *) input_items[0];
+
+ for (int i = 0; i < noutput_items; i++){
+ double mag_sqrd = in[i]*in[i];
+ d_iir.filter(mag_sqrd); // computed for side effect: prev_output()
+ }
+
+ d_unmuted = d_iir.prev_output() >= d_threshold;
+ d_level = d_iir.prev_output();
+ return noutput_items;
+}
+
+double
+gr_probe_avg_mag_sqrd_f::threshold() const
+{
+ return 10 * std::log10(d_threshold);
+}
+
+void
+gr_probe_avg_mag_sqrd_f::set_threshold(double decibels)
+{
+ // convert to absolute threshold (mag sqrd)
+ d_threshold = std::pow(10.0, decibels/10);
+}
+
+void
+gr_probe_avg_mag_sqrd_f::set_alpha(double alpha)
+{
+ d_iir.set_taps(alpha);
+}
diff --git a/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_f.h b/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_f.h
new file mode 100644
index 000000000..b2efcc64e
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_f.h
@@ -0,0 +1,75 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005 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_PROBE_AVG_MAG_SQRD_F_H
+#define INCLUDED_GR_PROBE_AVG_MAG_SQRD_F_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+#include <gr_single_pole_iir.h>
+
+class gr_probe_avg_mag_sqrd_f;
+typedef boost::shared_ptr<gr_probe_avg_mag_sqrd_f> gr_probe_avg_mag_sqrd_f_sptr;
+
+GR_CORE_API gr_probe_avg_mag_sqrd_f_sptr
+gr_make_probe_avg_mag_sqrd_f (double threshold_db, double alpha = 0.0001);
+
+/*!
+ * \brief compute avg magnitude squared.
+ * \ingroup sink_blk
+ *
+ * input: float
+ *
+ * Compute a running average of the magnitude squared of the the input.
+ * The level and indication as to whether the level exceeds threshold
+ * can be retrieved with the level and unmuted accessors.
+ */
+class GR_CORE_API gr_probe_avg_mag_sqrd_f : public gr_sync_block
+{
+ double d_threshold;
+ gr_single_pole_iir<double,double,double> d_iir;
+ bool d_unmuted;
+ double d_level;
+
+ friend GR_CORE_API gr_probe_avg_mag_sqrd_f_sptr
+ gr_make_probe_avg_mag_sqrd_f (double threshold_db, double alpha);
+
+ gr_probe_avg_mag_sqrd_f (double threshold_db, double alpha);
+
+public:
+ ~gr_probe_avg_mag_sqrd_f ();
+
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+
+ // ACCESSORS
+ bool unmuted () const { return d_unmuted; }
+ double level () const { return d_level; }
+
+ double threshold() const;
+
+ // SETTERS
+ void set_alpha (double alpha);
+ void set_threshold (double decibels);
+};
+
+#endif /* INCLUDED_GR_PROBE_AVG_MAG_SQRD_F_H */
diff --git a/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_f.i b/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_f.i
new file mode 100644
index 000000000..1c63ae8e9
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_f.i
@@ -0,0 +1,36 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005 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,probe_avg_mag_sqrd_f);
+
+gr_probe_avg_mag_sqrd_f_sptr
+gr_make_probe_avg_mag_sqrd_f (double threshold_db, double alpha = 0.0001);
+
+class gr_probe_avg_mag_sqrd_f : public gr_sync_block
+{
+public:
+ bool unmuted () const { return d_unmuted; }
+ double level () const { return d_level; }
+ double threshold() const;
+ void set_alpha (double alpha);
+ void set_threshold (double decibels);
+};
diff --git a/gnuradio-core/src/lib/general/gr_probe_density_b.cc b/gnuradio-core/src/lib/general/gr_probe_density_b.cc
new file mode 100644
index 000000000..31661780a
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_probe_density_b.cc
@@ -0,0 +1,68 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,2010 Free Software Foundation, Inc.
+ *
+ * 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 <gr_probe_density_b.h>
+#include <gr_io_signature.h>
+#include <stdexcept>
+#include <iostream>
+
+gr_probe_density_b_sptr
+gr_make_probe_density_b(double alpha)
+{
+ return gnuradio::get_initial_sptr(new gr_probe_density_b(alpha));
+}
+
+gr_probe_density_b::gr_probe_density_b(double alpha)
+ : gr_sync_block("density_b",
+ gr_make_io_signature(1, 1, sizeof(char)),
+ gr_make_io_signature(0, 0, 0))
+{
+ set_alpha(alpha);
+ d_density = 1.0;
+}
+
+gr_probe_density_b::~gr_probe_density_b()
+{
+}
+
+int
+gr_probe_density_b::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const char *in = (const char *)input_items[0];
+
+ for (int i = 0; i < noutput_items; i++)
+ d_density = d_alpha*(double)in[i] + d_beta*d_density;
+
+ return noutput_items;
+}
+
+void
+gr_probe_density_b::set_alpha(double alpha)
+{
+ d_alpha = alpha;
+ d_beta = 1.0-d_alpha;
+}
+
diff --git a/gnuradio-core/src/lib/general/gr_probe_density_b.h b/gnuradio-core/src/lib/general/gr_probe_density_b.h
new file mode 100644
index 000000000..ab84a63a9
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_probe_density_b.h
@@ -0,0 +1,73 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008 Free Software Foundation, Inc.
+ *
+ * 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_PROBE_DENSITY_B_H
+#define INCLUDED_GR_PROBE_DENSITY_B_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+
+class gr_probe_density_b;
+
+typedef boost::shared_ptr<gr_probe_density_b> gr_probe_density_b_sptr;
+
+GR_CORE_API gr_probe_density_b_sptr gr_make_probe_density_b(double alpha);
+
+/*!
+ * This block maintains a running average of the input stream and
+ * makes it available as an accessor function. The input stream
+ * is type unsigned char.
+ *
+ * If you send this block a stream of unpacked bytes, it will tell
+ * you what the bit density is.
+ *
+ * \param alpha Average filter constant
+ *
+ */
+
+class GR_CORE_API gr_probe_density_b : public gr_sync_block
+{
+private:
+ friend GR_CORE_API gr_probe_density_b_sptr gr_make_probe_density_b(double alpha);
+
+ double d_alpha;
+ double d_beta;
+ double d_density;
+
+ gr_probe_density_b(double alpha);
+
+public:
+ ~gr_probe_density_b();
+
+ /*!
+ * \brief Returns the current density value
+ */
+ double density() const { return d_density; }
+
+ /*!
+ * \brief Set the average filter constant
+ */
+ void set_alpha(double alpha);
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif /* INCLUDED_GR_PROBE_DENSITY_B_H */
diff --git a/gnuradio-core/src/lib/general/gr_probe_density_b.i b/gnuradio-core/src/lib/general/gr_probe_density_b.i
new file mode 100644
index 000000000..ca65708af
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_probe_density_b.i
@@ -0,0 +1,36 @@
+/* -*- 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,probe_density_b);
+
+gr_probe_density_b_sptr gr_make_probe_density_b(double alpha);
+
+class gr_probe_density_b : public gr_sync_block
+{
+public:
+ double density() const;
+
+ void set_alpha(double alpha);
+
+private:
+ gr_probe_density_b();
+};
diff --git a/gnuradio-core/src/lib/general/gr_pwr_squelch_cc.cc b/gnuradio-core/src/lib/general/gr_pwr_squelch_cc.cc
new file mode 100644
index 000000000..90eab13eb
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_pwr_squelch_cc.cc
@@ -0,0 +1,55 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_pwr_squelch_cc.h>
+
+gr_pwr_squelch_cc_sptr
+gr_make_pwr_squelch_cc(double threshold, double alpha, int ramp, bool gate)
+{
+ return gnuradio::get_initial_sptr(new gr_pwr_squelch_cc(threshold, alpha, ramp, gate));
+}
+
+gr_pwr_squelch_cc::gr_pwr_squelch_cc(double threshold, double alpha, int ramp, bool gate) :
+ gr_squelch_base_cc("pwr_squelch_cc", ramp, gate),
+ d_iir(alpha)
+{
+ set_threshold(threshold);
+}
+
+std::vector<float> gr_pwr_squelch_cc::squelch_range() const
+{
+ std::vector<float> r(3);
+ r[0] = -50.0; // min FIXME
+ r[1] = +50.0; // max FIXME
+ r[2] = (r[1] - r[0]) / 100; // step size
+
+ return r;
+}
+
+void gr_pwr_squelch_cc::update_state(const gr_complex &in)
+{
+ d_pwr = d_iir.filter(in.real()*in.real()+in.imag()*in.imag());
+}
diff --git a/gnuradio-core/src/lib/general/gr_pwr_squelch_cc.h b/gnuradio-core/src/lib/general/gr_pwr_squelch_cc.h
new file mode 100644
index 000000000..b2b4624f5
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_pwr_squelch_cc.h
@@ -0,0 +1,63 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_GR_PWR_SQUELCH_CC_H
+#define INCLUDED_GR_PWR_SQUELCH_CC_H
+
+#include <gr_core_api.h>
+#include <cmath>
+#include <gr_squelch_base_cc.h>
+#include <gr_single_pole_iir.h>
+
+class gr_pwr_squelch_cc;
+typedef boost::shared_ptr<gr_pwr_squelch_cc> gr_pwr_squelch_cc_sptr;
+
+GR_CORE_API gr_pwr_squelch_cc_sptr
+gr_make_pwr_squelch_cc(double db, double alpha = 0.0001, int ramp=0, bool gate=false);
+
+/*!
+ * \brief gate or zero output when input power below threshold
+ * \ingroup level_blk
+ */
+class GR_CORE_API gr_pwr_squelch_cc : public gr_squelch_base_cc
+{
+private:
+ double d_threshold;
+ double d_pwr;
+ gr_single_pole_iir<double,double,double> d_iir;
+
+ friend GR_CORE_API gr_pwr_squelch_cc_sptr gr_make_pwr_squelch_cc(double db, double alpha, int ramp, bool gate);
+ gr_pwr_squelch_cc(double db, double alpha, int ramp, bool gate);
+
+protected:
+ virtual void update_state(const gr_complex &in);
+ virtual bool mute() const { return d_pwr < d_threshold; }
+
+public:
+ std::vector<float> squelch_range() const;
+
+ double threshold() const { return 10*log10(d_threshold); }
+ void set_threshold(double db) { d_threshold = std::pow(10.0, db/10); }
+ void set_alpha(double alpha) { d_iir.set_taps(alpha); }
+};
+
+#endif /* INCLUDED_GR_PWR_SQUELCH_CC_H */
diff --git a/gnuradio-core/src/lib/general/gr_pwr_squelch_cc.i b/gnuradio-core/src/lib/general/gr_pwr_squelch_cc.i
new file mode 100644
index 000000000..c8cafd7aa
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_pwr_squelch_cc.i
@@ -0,0 +1,42 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006,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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,pwr_squelch_cc);
+
+// retrieve info on the base class, without generating wrappers since
+// the base class has a pure virual method.
+%import "gr_squelch_base_cc.i"
+
+gr_pwr_squelch_cc_sptr
+gr_make_pwr_squelch_cc(double db, double alpha=0.0001, int ramp=0, bool gate=false);
+
+class gr_pwr_squelch_cc : public gr_squelch_base_cc
+{
+private:
+ gr_pwr_squelch_cc(double db, double alpha, int ramp, bool gate);
+
+public:
+ double threshold() const { return 10*log10(d_threshold); }
+ void set_threshold(double db) { d_threshold = std::pow(10.0, db/10); }
+ void set_alpha(double alpha) { d_iir.set_taps(alpha); }
+ std::vector<float> squelch_range() const;
+};
diff --git a/gnuradio-core/src/lib/general/gr_pwr_squelch_ff.cc b/gnuradio-core/src/lib/general/gr_pwr_squelch_ff.cc
new file mode 100644
index 000000000..cfa867243
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_pwr_squelch_ff.cc
@@ -0,0 +1,55 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_pwr_squelch_ff.h>
+
+gr_pwr_squelch_ff_sptr
+gr_make_pwr_squelch_ff(double threshold, double alpha, int ramp, bool gate)
+{
+ return gnuradio::get_initial_sptr(new gr_pwr_squelch_ff(threshold, alpha, ramp, gate));
+}
+
+gr_pwr_squelch_ff::gr_pwr_squelch_ff(double threshold, double alpha, int ramp, bool gate) :
+ gr_squelch_base_ff("pwr_squelch_ff", ramp, gate),
+ d_iir(alpha)
+{
+ set_threshold(threshold);
+}
+
+std::vector<float> gr_pwr_squelch_ff::squelch_range() const
+{
+ std::vector<float> r(3);
+ r[0] = -50.0; // min FIXME
+ r[1] = +50.0; // max FIXME
+ r[2] = (r[1] - r[0]) / 100; // step size
+
+ return r;
+}
+
+void gr_pwr_squelch_ff::update_state(const float &in)
+{
+ d_pwr = d_iir.filter(in*in);
+}
diff --git a/gnuradio-core/src/lib/general/gr_pwr_squelch_ff.h b/gnuradio-core/src/lib/general/gr_pwr_squelch_ff.h
new file mode 100644
index 000000000..d5148c409
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_pwr_squelch_ff.h
@@ -0,0 +1,63 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_GR_PWR_SQUELCH_FF_H
+#define INCLUDED_GR_PWR_SQUELCH_FF_H
+
+#include <gr_core_api.h>
+#include <cmath>
+#include <gr_squelch_base_ff.h>
+#include <gr_single_pole_iir.h>
+
+class gr_pwr_squelch_ff;
+typedef boost::shared_ptr<gr_pwr_squelch_ff> gr_pwr_squelch_ff_sptr;
+
+GR_CORE_API gr_pwr_squelch_ff_sptr
+gr_make_pwr_squelch_ff(double db, double alpha = 0.0001, int ramp=0, bool gate=false);
+
+/*!
+ * \brief gate or zero output when input power below threshold
+ * \ingroup level_blk
+ */
+class GR_CORE_API gr_pwr_squelch_ff : public gr_squelch_base_ff
+{
+private:
+ double d_threshold;
+ double d_pwr;
+ gr_single_pole_iir<double,double,double> d_iir;
+
+ friend GR_CORE_API gr_pwr_squelch_ff_sptr gr_make_pwr_squelch_ff(double db, double alpha, int ramp, bool gate);
+ gr_pwr_squelch_ff(double db, double alpha, int ramp, bool gate);
+
+protected:
+ virtual void update_state(const float &in);
+ virtual bool mute() const { return d_pwr < d_threshold; }
+
+public:
+ std::vector<float> squelch_range() const;
+
+ double threshold() const { return 10*log10(d_threshold); }
+ void set_threshold(double db) { d_threshold = std::pow(10.0, db/10); }
+ void set_alpha(double alpha) { d_iir.set_taps(alpha); }
+};
+
+#endif /* INCLUDED_GR_PWR_SQUELCH_FF_H */
diff --git a/gnuradio-core/src/lib/general/gr_pwr_squelch_ff.i b/gnuradio-core/src/lib/general/gr_pwr_squelch_ff.i
new file mode 100644
index 000000000..2682f2758
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_pwr_squelch_ff.i
@@ -0,0 +1,42 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006,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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,pwr_squelch_ff);
+
+// retrieve info on the base class, without generating wrappers since
+// the base class has a pure virual method.
+%import "gr_squelch_base_ff.i"
+
+gr_pwr_squelch_ff_sptr
+gr_make_pwr_squelch_ff(double db, double alpha=0.0001, int ramp=0, bool gate=false);
+
+class gr_pwr_squelch_ff : public gr_squelch_base_ff
+{
+private:
+ gr_pwr_squelch_ff(double db, double alpha, int ramp, bool gate);
+
+public:
+ double threshold() const { return 10*log10(d_threshold); }
+ void set_threshold(double db) { d_threshold = std::pow(10.0, db/10); }
+ void set_alpha(double alpha) { d_iir.set_taps(alpha); }
+ std::vector<float> squelch_range() const;
+};
diff --git a/gnuradio-core/src/lib/general/gr_quadrature_demod_cf.cc b/gnuradio-core/src/lib/general/gr_quadrature_demod_cf.cc
new file mode 100644
index 000000000..fa0958276
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_quadrature_demod_cf.cc
@@ -0,0 +1,62 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2005,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_quadrature_demod_cf.h>
+#include <gr_io_signature.h>
+#include <gr_math.h>
+
+gr_quadrature_demod_cf::gr_quadrature_demod_cf (float gain)
+ : gr_sync_block ("quadrature_demod_cf",
+ gr_make_io_signature (1, 1, sizeof (gr_complex)),
+ gr_make_io_signature (1, 1, sizeof (float))),
+ d_gain (gain)
+{
+ set_history (2); // we need to look at the previous value
+}
+
+gr_quadrature_demod_cf_sptr
+gr_make_quadrature_demod_cf (float gain)
+{
+ return gnuradio::get_initial_sptr(new gr_quadrature_demod_cf (gain));
+}
+
+int
+gr_quadrature_demod_cf::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ gr_complex *in = (gr_complex *) input_items[0];
+ float *out = (float *) output_items[0];
+ in++; // ensure that in[-1] is valid
+
+ for (int i = 0; i < noutput_items; i++){
+ gr_complex product = in[i] * conj (in[i-1]);
+ // out[i] = d_gain * arg (product);
+ out[i] = d_gain * gr_fast_atan2f(imag(product), real(product));
+ }
+
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/general/gr_quadrature_demod_cf.h b/gnuradio-core/src/lib/general/gr_quadrature_demod_cf.h
new file mode 100644
index 000000000..9f5976c97
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_quadrature_demod_cf.h
@@ -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.
+ */
+
+#ifndef INCLUDED_GR_QUADRATURE_DEMOD_CF_H
+#define INCLUDED_GR_QUADRATURE_DEMOD_CF_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+
+class gr_quadrature_demod_cf;
+typedef boost::shared_ptr<gr_quadrature_demod_cf> gr_quadrature_demod_cf_sptr;
+GR_CORE_API gr_quadrature_demod_cf_sptr gr_make_quadrature_demod_cf (float gain);
+
+/*!
+ * \brief quadrature demodulator: complex in, float out
+ * \ingroup demodulation_blk
+ *
+ * This can be used to demod FM, FSK, GMSK, etc.
+ * The input is complex baseband.
+ */
+class GR_CORE_API gr_quadrature_demod_cf : public gr_sync_block
+{
+ friend GR_CORE_API gr_quadrature_demod_cf_sptr gr_make_quadrature_demod_cf (float gain);
+ gr_quadrature_demod_cf (float gain);
+
+ float d_gain;
+
+ public:
+ void set_gain(float gain) { d_gain = gain; }
+ float gain() const { return d_gain; }
+
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif /* INCLUDED_GR_QUADRATURE_DEMOD_CF_H */
diff --git a/gnuradio-core/src/lib/general/gr_quadrature_demod_cf.i b/gnuradio-core/src/lib/general/gr_quadrature_demod_cf.i
new file mode 100644
index 000000000..4c9168e64
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_quadrature_demod_cf.i
@@ -0,0 +1,34 @@
+/* -*- 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC (gr, quadrature_demod_cf)
+
+gr_quadrature_demod_cf_sptr gr_make_quadrature_demod_cf (float gain);
+
+class gr_quadrature_demod_cf : public gr_sync_block
+{
+ gr_quadrature_demod_cf (float gain);
+
+public:
+ void set_gain(float gain) { d_gain = gain; }
+ float gain() const { return d_gain; }
+};
diff --git a/gnuradio-core/src/lib/general/gr_rail_ff.cc b/gnuradio-core/src/lib/general/gr_rail_ff.cc
new file mode 100644
index 000000000..cd33c10d3
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_rail_ff.cc
@@ -0,0 +1,62 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_rail_ff.h>
+#include <gr_io_signature.h>
+
+gr_rail_ff_sptr
+gr_make_rail_ff(float lo, float hi)
+{
+ return gnuradio::get_initial_sptr(new gr_rail_ff(lo, hi));
+}
+
+gr_rail_ff::gr_rail_ff(float lo, float hi)
+ : gr_sync_block("rail_ff",
+ gr_make_io_signature(1, 1, sizeof(float)),
+ gr_make_io_signature(1, 1, sizeof(float))),
+ d_lo(lo), d_hi(hi)
+{
+}
+
+int
+gr_rail_ff::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const float *in = (const float *) input_items[0];
+ float *out = (float *) output_items[0];
+
+ for (int i = 0; i < noutput_items; i++) {
+ if (in[i] < d_lo)
+ out[i] = d_lo;
+ else if (in[i] > d_hi)
+ out[i] = d_hi;
+ else
+ out[i] = in[i];
+ }
+
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/general/gr_rail_ff.h b/gnuradio-core/src/lib/general/gr_rail_ff.h
new file mode 100644
index 000000000..29db5b1fa
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_rail_ff.h
@@ -0,0 +1,57 @@
+/* -*- 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_RAIL_FF_H_
+# define INCLUDED_GR_RAIL_FF_H_
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+
+/*!
+ * \brief clips input values to min, max
+ * \ingroup misc
+ */
+
+class gr_rail_ff;
+typedef boost::shared_ptr<gr_rail_ff> gr_rail_ff_sptr;
+
+GR_CORE_API gr_rail_ff_sptr gr_make_rail_ff(float lo, float hi);
+
+class GR_CORE_API gr_rail_ff : public gr_sync_block
+{
+ friend GR_CORE_API gr_rail_ff_sptr gr_make_rail_ff (float lo, float hi);
+
+ float d_lo, d_hi; // the constant
+ gr_rail_ff(float lo, float hi);
+
+ public:
+ float lo() const { return d_lo; }
+ void set_lo(float lo) { d_lo = lo; }
+ float hi() const { return d_hi; }
+ void set_hi(float hi) { d_hi = hi; }
+
+ 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/general/gr_rail_ff.i b/gnuradio-core/src/lib/general/gr_rail_ff.i
new file mode 100644
index 000000000..bdc453516
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_rail_ff.i
@@ -0,0 +1,30 @@
+/* -*- 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 this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,rail_ff);
+
+gr_rail_ff_sptr gr_make_rail_ff(float lo, float hi);
+
+class gr_rail_ff : public gr_sync_block
+{
+private:
+ gr_rail_ff(float lo, float hi);
+};
diff --git a/gnuradio-core/src/lib/general/gr_random.cc b/gnuradio-core/src/lib/general/gr_random.cc
new file mode 100644
index 000000000..323839acc
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_random.cc
@@ -0,0 +1,183 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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.
+ */
+
+/*
+ * Copyright 1997 Massachusetts Institute of Technology
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of M.I.T. not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. M.I.T. makes no representations about the
+ * suitability of this software for any purpose. It is provided "as is"
+ * without express or implied warranty.
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <math.h>
+#include <gr_random.h>
+
+#define IA 16807
+#define IM 2147483647
+#define AM (1.0/IM)
+#define IQ 127773
+#define IR 2836
+#define NDIV (1+(IM-1)/NTAB)
+#define EPS 1.2e-7
+#define RNMX (1.0-EPS)
+
+
+gr_random::gr_random (long seed)
+{
+ reseed (seed);
+}
+
+void
+gr_random::reseed (long seed)
+{
+ d_seed = seed;
+ d_iy = 0;
+ for (int i = 0; i < NTAB; i++)
+ d_iv[i] = 0;
+ d_iset = 0;
+ d_gset = 0;
+}
+
+/*
+ * This looks like it returns a uniform random deviate between 0.0 and 1.0
+ * It looks similar to code from "Numerical Recipes in C".
+ */
+float gr_random::ran1()
+{
+ int j;
+ long k;
+ float temp;
+
+ if (d_seed <= 0 || !d_iy) {
+ if (-d_seed < 1)
+ d_seed=1;
+ else
+ d_seed = -d_seed;
+ for (j=NTAB+7;j>=0;j--) {
+ k=d_seed/IQ;
+ d_seed=IA*(d_seed-k*IQ)-IR*k;
+ if (d_seed < 0)
+ d_seed += IM;
+ if (j < NTAB)
+ d_iv[j] = d_seed;
+ }
+ d_iy=d_iv[0];
+ }
+ k=(d_seed)/IQ;
+ d_seed=IA*(d_seed-k*IQ)-IR*k;
+ if (d_seed < 0)
+ d_seed += IM;
+ j=d_iy/NDIV;
+ d_iy=d_iv[j];
+ d_iv[j] = d_seed;
+ temp=AM * d_iy;
+ if (temp > RNMX)
+ temp = RNMX;
+ return temp;
+}
+
+/*
+ * Returns a normally distributed deviate with zero mean and variance 1.
+ * Also looks like it's from "Numerical Recipes in C".
+ */
+float gr_random::gasdev()
+{
+ float fac,rsq,v1,v2;
+ d_iset = 1 - d_iset;
+ if (d_iset) {
+ do {
+ v1=2.0*ran1()-1.0;
+ v2=2.0*ran1()-1.0;
+ rsq=v1*v1+v2*v2;
+ } while (rsq >= 1.0 || rsq == 0.0);
+ fac= sqrt(-2.0*log(rsq)/rsq);
+ d_gset=v1*fac;
+ return v2*fac;
+ }
+ return d_gset;
+}
+
+/*
+ * Copied from The KC7WW / OH2BNS Channel Simulator
+ * FIXME Need to check how good this is at some point
+ */
+
+float gr_random::laplacian()
+{
+ float z = ran1();
+ if (z < 0.5)
+ return log(2.0 * z) / M_SQRT2;
+ else
+ return -log(2.0 * (1.0 - z)) / M_SQRT2;
+}
+
+/*
+ * Copied from The KC7WW / OH2BNS Channel Simulator
+ * FIXME Need to check how good this is at some point
+ */
+
+ // 5 => scratchy, 8 => Geiger
+
+float gr_random::impulse(float factor = 5)
+{
+ float z = -M_SQRT2 * log(ran1());
+ if (fabsf(z) <= factor)
+ return 0.0;
+ else
+ return z;
+}
+
+/*
+ * Complex rayleigh is really gaussian I and gaussian Q
+ * It can also be generated by real rayleigh magnitude and
+ * uniform random angle
+ * Adapted from The KC7WW / OH2BNS Channel Simulator
+ * FIXME Need to check how good this is at some point
+ */
+
+gr_complex gr_random::rayleigh_complex()
+{
+ return gr_complex(gasdev(),gasdev());
+}
+
+/* Other option
+ mag = rayleigh();
+ ang = 2.0 * M_PI * RNG();
+ *Rx = rxx * cos(z);
+ *Iy = rxx * sin(z);
+*/
+
+
+float gr_random::rayleigh()
+{
+ return sqrt(-2.0 * log(ran1()));
+}
diff --git a/gnuradio-core/src/lib/general/gr_random.h b/gnuradio-core/src/lib/general/gr_random.h
new file mode 100644
index 000000000..96a8f4418
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_random.h
@@ -0,0 +1,65 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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_RANDOM_H
+#define INCLUDED_GR_RANDOM_H
+
+#include <gr_core_api.h>
+#include <gr_complex.h>
+
+/*!
+ * \brief pseudo random number generator
+ * \ingroup math_blk
+ */
+class GR_CORE_API gr_random {
+protected:
+ static const int NTAB = 32;
+ long d_seed;
+ long d_iy;
+ long d_iv[NTAB];
+ int d_iset;
+ float d_gset;
+
+
+public:
+ gr_random (long seed=3021);
+
+ void reseed (long seed);
+
+ /*!
+ * \brief uniform random deviate in the range [0.0, 1.0)
+ */
+ float ran1 ();
+
+ /*!
+ * \brief normally distributed deviate with zero mean and variance 1
+ */
+ float gasdev ();
+
+ float laplacian ();
+ float impulse (float factor);
+ float rayleigh ();
+ gr_complex rayleigh_complex ();
+};
+
+#endif /* INCLUDED_GR_RANDOM_H */
+
diff --git a/gnuradio-core/src/lib/general/gr_random_pdu.cc b/gnuradio-core/src/lib/general/gr_random_pdu.cc
new file mode 100644
index 000000000..6d8c13614
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_random_pdu.cc
@@ -0,0 +1,84 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_random_pdu.h>
+#include <gr_io_signature.h>
+#include <cstdio>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <stdexcept>
+#include <string.h>
+#include <iostream>
+#include <vector>
+
+// public constructor that returns a shared_ptr
+
+gr_random_pdu_sptr
+gr_make_random_pdu (int items_min, int items_max)
+{
+ return gnuradio::get_initial_sptr(new gr_random_pdu(items_min, items_max));
+}
+
+gr_random_pdu::gr_random_pdu (int items_min, int items_max)
+ : gr_block("random_pdu",
+ gr_make_io_signature(0, 0, 0),
+ gr_make_io_signature(0, 0, 0)),
+ urange(items_min, items_max),
+ brange(0, 255),
+ rvar(rng, urange),
+ bvar(rng, brange)
+{
+ message_port_register_out(pmt::mp("pdus"));
+ message_port_register_in(pmt::mp("generate"));
+ set_msg_handler(pmt::mp("generate"), boost::bind(&gr_random_pdu::generate_pdu, this, _1));
+}
+
+bool gr_random_pdu::start(){
+ output_random();
+ return true;
+}
+
+void gr_random_pdu::output_random(){
+
+ // pick a random vector length
+ int len = rvar();
+
+ // fill it with random bytes
+ std::vector<unsigned char> vec;
+ for(int i=0; i<len; i++){
+ vec.push_back((unsigned char) bvar());
+ }
+
+ // send the vector
+ pmt::pmt_t vecpmt( pmt::pmt_make_blob( &vec[0], len ) );
+ pmt::pmt_t pdu( pmt::pmt_cons( pmt::PMT_NIL, vecpmt ) );
+ message_port_pub( pmt::mp("pdus"), pdu );
+
+ std::cout << "sending new random vector of length " << len << "\n";
+}
+
diff --git a/gnuradio-core/src/lib/general/gr_random_pdu.h b/gnuradio-core/src/lib/general/gr_random_pdu.h
new file mode 100644
index 000000000..e6457d21b
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_random_pdu.h
@@ -0,0 +1,64 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_GR_RANDOM_PDU_H
+#define INCLUDED_GR_RANDOM_PDU_H
+
+#include <gr_core_api.h>
+#include <gr_block.h>
+#include <gr_message.h>
+#include <gr_msg_queue.h>
+
+#include <boost/random.hpp>
+#include <boost/generator_iterator.hpp>
+
+class gr_random_pdu;
+typedef boost::shared_ptr<gr_random_pdu> gr_random_pdu_sptr;
+
+GR_CORE_API gr_random_pdu_sptr gr_make_random_pdu (int mintime, int maxtime);
+
+/*!
+ * \brief Send message at defined interval
+ * \ingroup msg_blk
+ */
+class GR_CORE_API gr_random_pdu : public gr_block
+{
+ private:
+ friend GR_CORE_API gr_random_pdu_sptr
+ gr_make_random_pdu(int mintime, int maxtime);
+
+ void output_random();
+
+ boost::mt19937 rng;
+ boost::uniform_int<> urange;
+ boost::uniform_int<> brange;
+ boost::variate_generator< boost::mt19937, boost::uniform_int<> > rvar; // pdu length
+ boost::variate_generator< boost::mt19937, boost::uniform_int<> > bvar; // pdu contents
+
+ public:
+ gr_random_pdu (int, int);
+ bool start();
+ void generate_pdu(pmt::pmt_t msg){ output_random(); }
+ void generate_pdu(){ output_random(); }
+};
+
+#endif /* INCLUDED_GR_RANDOM_PDU_H */
diff --git a/gnuradio-core/src/lib/general/gr_random_pdu.i b/gnuradio-core/src/lib/general/gr_random_pdu.i
new file mode 100644
index 000000000..045a33060
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_random_pdu.i
@@ -0,0 +1,30 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005 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,random_pdu);
+
+%{
+#include <gr_random_pdu.h>
+%}
+
+%include "gr_random_pdu.h"
+
diff --git a/gnuradio-core/src/lib/general/gr_regenerate_bb.cc b/gnuradio-core/src/lib/general/gr_regenerate_bb.cc
new file mode 100644
index 000000000..c96cf247d
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_regenerate_bb.cc
@@ -0,0 +1,90 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_regenerate_bb.h>
+#include <gr_io_signature.h>
+
+gr_regenerate_bb_sptr
+gr_make_regenerate_bb (int period, unsigned int max_regen)
+{
+ return gnuradio::get_initial_sptr(new gr_regenerate_bb (period, max_regen));
+}
+
+gr_regenerate_bb::gr_regenerate_bb (int period, unsigned int max_regen)
+ : gr_sync_block ("regenerate_bb",
+ gr_make_io_signature (1, 1, sizeof (char)),
+ gr_make_io_signature (1, 1, sizeof (char))),
+ d_period(period),
+ d_countdown(0),
+ d_max_regen(max_regen),
+ d_regen_count(max_regen)
+{
+}
+
+void gr_regenerate_bb::set_max_regen(unsigned int regen)
+{
+ d_max_regen = regen;
+ d_countdown = 0;
+ d_regen_count = d_max_regen;
+}
+
+void gr_regenerate_bb::set_period(int period)
+{
+ d_period = period;
+ d_countdown = 0;
+ d_regen_count = d_max_regen;
+}
+
+int
+gr_regenerate_bb::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const char *iptr = (const char *) input_items[0];
+ char *optr = (char *) output_items[0];
+
+ for (int i = 0; i < noutput_items; i++){
+ optr[i] = 0;
+
+ if(d_regen_count < d_max_regen) {
+ d_countdown--;
+
+ if(d_countdown == 0) {
+ optr[i] = 1;
+ d_countdown = d_period;
+ d_regen_count++;
+ }
+ }
+
+ if(iptr[i] == 1) {
+ d_countdown = d_period;
+ optr[i] = 1;
+ d_regen_count = 0;
+ }
+
+ }
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/general/gr_regenerate_bb.h b/gnuradio-core/src/lib/general/gr_regenerate_bb.h
new file mode 100644
index 000000000..e820db69e
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_regenerate_bb.h
@@ -0,0 +1,76 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_GR_REGENERATE_BB_H
+#define INCLUDED_GR_REGENERATE_BB_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+
+class gr_regenerate_bb;
+typedef boost::shared_ptr<gr_regenerate_bb> gr_regenerate_bb_sptr;
+
+GR_CORE_API gr_regenerate_bb_sptr gr_make_regenerate_bb (int period, unsigned int max_regen=500);
+
+/*!
+ * \brief Detect the peak of a signal and repeat every period samples
+ * \ingroup level_blk
+ *
+ * If a peak is detected, this block outputs a 1 repeated every period samples
+ * until reset by detection of another 1 on the input or stopped after max_regen
+ * regenerations have occurred.
+ *
+ * Note that if max_regen=(-1)/ULONG_MAX then the regeneration will run forever.
+ */
+class GR_CORE_API gr_regenerate_bb : public gr_sync_block
+{
+ /*!
+ * \brief Make a regenerate block
+ * \param period The number of samples between regenerations
+ * \param max_regen The maximum number of regenerations to perform; if set to
+ * ULONG_MAX, it will regenerate continuously.
+ */
+ friend GR_CORE_API gr_regenerate_bb_sptr gr_make_regenerate_bb (int period, unsigned int max_regen);
+
+ gr_regenerate_bb (int period, unsigned int max_regen);
+
+ private:
+ int d_period;
+ int d_countdown;
+ unsigned int d_max_regen;
+ unsigned int d_regen_count;
+
+ public:
+ /*! \brief Reset the maximum regeneration count; this will reset the current regen.
+ */
+ void set_max_regen(unsigned int regen);
+
+ /*! \brief Reset the period of regenerations; this will reset the current regen.
+ */
+ void set_period(int period);
+
+ 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/general/gr_regenerate_bb.i b/gnuradio-core/src/lib/general/gr_regenerate_bb.i
new file mode 100644
index 000000000..064b0a278
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_regenerate_bb.i
@@ -0,0 +1,38 @@
+/* -*- 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,regenerate_bb)
+
+gr_regenerate_bb_sptr gr_make_regenerate_bb (int period, unsigned int max_regen=500);
+
+class gr_regenerate_bb : public gr_sync_block
+{
+ private:
+ gr_regenerate_bb (int period, unsigned int max_regen);
+
+public:
+ void set_max_regen(unsigned int regen);
+
+ /*! \brief Reset the period of regenerations; this will reset the current regen.
+ */
+ void set_period(int period);
+};
diff --git a/gnuradio-core/src/lib/general/gr_remez.cc b/gnuradio-core/src/lib/general/gr_remez.cc
new file mode 100644
index 000000000..db4789e43
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_remez.cc
@@ -0,0 +1,1033 @@
+/**************************************************************************
+ * Parks-McClellan algorithm for FIR filter design (C version)
+ *-------------------------------------------------
+ * Copyright (c) 1995,1998 Jake Janovetz (janovetz@uiuc.edu)
+ * Copyright (c) 2004 Free Software Foundation, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Foundation, Inc., 51 Franklin Street, Boston, MA 02110-1301 USA
+ *
+ *
+ * Sep 1999 - Paul Kienzle (pkienzle@cs.indiana.edu)
+ * Modified for use in octave as a replacement for the matlab function
+ * remez.mex. In particular, magnitude responses are required for all
+ * band edges rather than one per band, griddensity is a parameter,
+ * and errors are returned rather than printed directly.
+ * Mar 2000 - Kai Habel (kahacjde@linux.zrz.tu-berlin.de)
+ * Change: ColumnVector x=arg(i).vector_value();
+ * to: ColumnVector x(arg(i).vector_value());
+ * There appear to be some problems with the routine Search. See comments
+ * therein [search for PAK:]. I haven't looked closely at the rest
+ * of the code---it may also have some problems.
+ *************************************************************************/
+
+/*
+ * This code was extracted from octave.sf.net, and wrapped with
+ * GNU Radio glue.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+#include <gr_remez.h>
+#include <cmath>
+#include <assert.h>
+#include <iostream>
+
+
+#ifndef LOCAL_BUFFER
+#include <vector>
+#define LOCAL_BUFFER(T, buf, size) \
+ std::vector<T> buf ## _vector (size); \
+ T *buf = &(buf ## _vector[0])
+#endif
+
+
+#define CONST const
+#define BANDPASS 1
+#define DIFFERENTIATOR 2
+#define HILBERT 3
+
+#define NEGATIVE 0
+#define POSITIVE 1
+
+#define Pi 3.14159265358979323846
+#define Pi2 (2*Pi)
+
+#define GRIDDENSITY 16
+#define MAXITERATIONS 40
+
+/*******************
+ * CreateDenseGrid
+ *=================
+ * Creates the dense grid of frequencies from the specified bands.
+ * Also creates the Desired Frequency Response function (D[]) and
+ * the Weight function (W[]) on that dense grid
+ *
+ *
+ * INPUT:
+ * ------
+ * int r - 1/2 the number of filter coefficients
+ * int numtaps - Number of taps in the resulting filter
+ * int numband - Number of bands in user specification
+ * double bands[] - User-specified band edges [2*numband]
+ * double des[] - Desired response per band [2*numband]
+ * double weight[] - Weight per band [numband]
+ * int symmetry - Symmetry of filter - used for grid check
+ * int griddensity
+ *
+ * OUTPUT:
+ * -------
+ * int gridsize - Number of elements in the dense frequency grid
+ * double Grid[] - Frequencies (0 to 0.5) on the dense grid [gridsize]
+ * double D[] - Desired response on the dense grid [gridsize]
+ * double W[] - Weight function on the dense grid [gridsize]
+ *******************/
+
+static void
+CreateDenseGrid (int r, int numtaps, int numband, const double bands[],
+ const double des[], const double weight[], int gridsize,
+ double Grid[], double D[], double W[],
+ int symmetry, int griddensity)
+{
+ int i, j, k, band;
+ double delf, lowf, highf, grid0;
+
+ delf = 0.5/(griddensity*r);
+
+/*
+ * For differentiator, hilbert,
+ * symmetry is odd and Grid[0] = max(delf, bands[0])
+ */
+ grid0 = (symmetry == NEGATIVE) && (delf > bands[0]) ? delf : bands[0];
+
+ j=0;
+ for (band=0; band < numband; band++)
+ {
+ lowf = (band==0 ? grid0 : bands[2*band]);
+ highf = bands[2*band + 1];
+ k = (int)((highf - lowf)/delf + 0.5); /* .5 for rounding */
+ for (i=0; i<k; i++)
+ {
+ D[j] = des[2*band] + i*(des[2*band+1]-des[2*band])/(k-1);
+ W[j] = weight[band];
+ Grid[j] = lowf;
+ lowf += delf;
+ j++;
+ }
+ Grid[j-1] = highf;
+ }
+
+/*
+ * Similar to above, if odd symmetry, last grid point can't be .5
+ * - but, if there are even taps, leave the last grid point at .5
+ */
+ if ((symmetry == NEGATIVE) &&
+ (Grid[gridsize-1] > (0.5 - delf)) &&
+ (numtaps % 2))
+ {
+ Grid[gridsize-1] = 0.5-delf;
+ }
+}
+
+
+/********************
+ * InitialGuess
+ *==============
+ * Places Extremal Frequencies evenly throughout the dense grid.
+ *
+ *
+ * INPUT:
+ * ------
+ * int r - 1/2 the number of filter coefficients
+ * int gridsize - Number of elements in the dense frequency grid
+ *
+ * OUTPUT:
+ * -------
+ * int Ext[] - Extremal indexes to dense frequency grid [r+1]
+ ********************/
+
+static void
+InitialGuess (int r, int Ext[], int gridsize)
+{
+ int i;
+
+ for (i=0; i<=r; i++)
+ Ext[i] = i * (gridsize-1) / r;
+}
+
+
+/***********************
+ * CalcParms
+ *===========
+ *
+ *
+ * INPUT:
+ * ------
+ * int r - 1/2 the number of filter coefficients
+ * int Ext[] - Extremal indexes to dense frequency grid [r+1]
+ * double Grid[] - Frequencies (0 to 0.5) on the dense grid [gridsize]
+ * double D[] - Desired response on the dense grid [gridsize]
+ * double W[] - Weight function on the dense grid [gridsize]
+ *
+ * OUTPUT:
+ * -------
+ * double ad[] - 'b' in Oppenheim & Schafer [r+1]
+ * double x[] - [r+1]
+ * double y[] - 'C' in Oppenheim & Schafer [r+1]
+ ***********************/
+
+static void
+CalcParms (int r, int Ext[], double Grid[], double D[], double W[],
+ double ad[], double x[], double y[])
+{
+ int i, j, k, ld;
+ double sign, xi, delta, denom, numer;
+
+/*
+ * Find x[]
+ */
+ for (i=0; i<=r; i++)
+ x[i] = cos(Pi2 * Grid[Ext[i]]);
+
+/*
+ * Calculate ad[] - Oppenheim & Schafer eq 7.132
+ */
+ ld = (r-1)/15 + 1; /* Skips around to avoid round errors */
+ for (i=0; i<=r; i++)
+ {
+ denom = 1.0;
+ xi = x[i];
+ for (j=0; j<ld; j++)
+ {
+ for (k=j; k<=r; k+=ld)
+ if (k != i)
+ denom *= 2.0*(xi - x[k]);
+ }
+ if (fabs(denom)<0.00001)
+ denom = 0.00001;
+ ad[i] = 1.0/denom;
+ }
+
+/*
+ * Calculate delta - Oppenheim & Schafer eq 7.131
+ */
+ numer = denom = 0;
+ sign = 1;
+ for (i=0; i<=r; i++)
+ {
+ numer += ad[i] * D[Ext[i]];
+ denom += sign * ad[i]/W[Ext[i]];
+ sign = -sign;
+ }
+ delta = numer/denom;
+ sign = 1;
+
+/*
+ * Calculate y[] - Oppenheim & Schafer eq 7.133b
+ */
+ for (i=0; i<=r; i++)
+ {
+ y[i] = D[Ext[i]] - sign * delta/W[Ext[i]];
+ sign = -sign;
+ }
+}
+
+
+/*********************
+ * ComputeA
+ *==========
+ * Using values calculated in CalcParms, ComputeA calculates the
+ * actual filter response at a given frequency (freq). Uses
+ * eq 7.133a from Oppenheim & Schafer.
+ *
+ *
+ * INPUT:
+ * ------
+ * double freq - Frequency (0 to 0.5) at which to calculate A
+ * int r - 1/2 the number of filter coefficients
+ * double ad[] - 'b' in Oppenheim & Schafer [r+1]
+ * double x[] - [r+1]
+ * double y[] - 'C' in Oppenheim & Schafer [r+1]
+ *
+ * OUTPUT:
+ * -------
+ * Returns double value of A[freq]
+ *********************/
+
+static double
+ComputeA (double freq, int r, double ad[], double x[], double y[])
+{
+ int i;
+ double xc, c, denom, numer;
+
+ denom = numer = 0;
+ xc = cos(Pi2 * freq);
+ for (i=0; i<=r; i++)
+ {
+ c = xc - x[i];
+ if (fabs(c) < 1.0e-7)
+ {
+ numer = y[i];
+ denom = 1;
+ break;
+ }
+ c = ad[i]/c;
+ denom += c;
+ numer += c*y[i];
+ }
+ return numer/denom;
+}
+
+
+/************************
+ * CalcError
+ *===========
+ * Calculates the Error function from the desired frequency response
+ * on the dense grid (D[]), the weight function on the dense grid (W[]),
+ * and the present response calculation (A[])
+ *
+ *
+ * INPUT:
+ * ------
+ * int r - 1/2 the number of filter coefficients
+ * double ad[] - [r+1]
+ * double x[] - [r+1]
+ * double y[] - [r+1]
+ * int gridsize - Number of elements in the dense frequency grid
+ * double Grid[] - Frequencies on the dense grid [gridsize]
+ * double D[] - Desired response on the dense grid [gridsize]
+ * double W[] - Weight function on the desnse grid [gridsize]
+ *
+ * OUTPUT:
+ * -------
+ * double E[] - Error function on dense grid [gridsize]
+ ************************/
+
+static void
+CalcError (int r, double ad[], double x[], double y[],
+ int gridsize, double Grid[],
+ double D[], double W[], double E[])
+{
+ int i;
+ double A;
+
+ for (i=0; i<gridsize; i++)
+ {
+ A = ComputeA(Grid[i], r, ad, x, y);
+ E[i] = W[i] * (D[i] - A);
+ }
+}
+
+/************************
+ * Search
+ *========
+ * Searches for the maxima/minima of the error curve. If more than
+ * r+1 extrema are found, it uses the following heuristic (thanks
+ * Chris Hanson):
+ * 1) Adjacent non-alternating extrema deleted first.
+ * 2) If there are more than one excess extrema, delete the
+ * one with the smallest error. This will create a non-alternation
+ * condition that is fixed by 1).
+ * 3) If there is exactly one excess extremum, delete the smaller
+ * of the first/last extremum
+ *
+ *
+ * INPUT:
+ * ------
+ * int r - 1/2 the number of filter coefficients
+ * int Ext[] - Indexes to Grid[] of extremal frequencies [r+1]
+ * int gridsize - Number of elements in the dense frequency grid
+ * double E[] - Array of error values. [gridsize]
+ * OUTPUT:
+ * -------
+ * int Ext[] - New indexes to extremal frequencies [r+1]
+ ************************/
+static int
+Search (int r, int Ext[],
+ int gridsize, double E[])
+{
+ int i, j, k, l, extra; /* Counters */
+ int up, alt;
+ int *foundExt; /* Array of found extremals */
+
+/*
+ * Allocate enough space for found extremals.
+ */
+ foundExt = (int *)malloc((2*r) * sizeof(int));
+ k = 0;
+
+/*
+ * Check for extremum at 0.
+ */
+ if (((E[0]>0.0) && (E[0]>E[1])) ||
+ ((E[0]<0.0) && (E[0]<E[1])))
+ foundExt[k++] = 0;
+
+/*
+ * Check for extrema inside dense grid
+ */
+ for (i=1; i<gridsize-1; i++)
+ {
+ if (((E[i]>=E[i-1]) && (E[i]>E[i+1]) && (E[i]>0.0)) ||
+ ((E[i]<=E[i-1]) && (E[i]<E[i+1]) && (E[i]<0.0))) {
+ // PAK: we sometimes get too many extremal frequencies
+ if (k >= 2*r) return -3;
+ foundExt[k++] = i;
+ }
+ }
+
+/*
+ * Check for extremum at 0.5
+ */
+ j = gridsize-1;
+ if (((E[j]>0.0) && (E[j]>E[j-1])) ||
+ ((E[j]<0.0) && (E[j]<E[j-1]))) {
+ if (k >= 2*r) return -3;
+ foundExt[k++] = j;
+ }
+
+ // PAK: we sometimes get not enough extremal frequencies
+ if (k < r+1) return -2;
+
+
+/*
+ * Remove extra extremals
+ */
+ extra = k - (r+1);
+ assert(extra >= 0);
+
+ while (extra > 0)
+ {
+ if (E[foundExt[0]] > 0.0)
+ up = 1; /* first one is a maxima */
+ else
+ up = 0; /* first one is a minima */
+
+ l=0;
+ alt = 1;
+ for (j=1; j<k; j++)
+ {
+ if (fabs(E[foundExt[j]]) < fabs(E[foundExt[l]]))
+ l = j; /* new smallest error. */
+ if ((up) && (E[foundExt[j]] < 0.0))
+ up = 0; /* switch to a minima */
+ else if ((!up) && (E[foundExt[j]] > 0.0))
+ up = 1; /* switch to a maxima */
+ else
+ {
+ alt = 0;
+ // PAK: break now and you will delete the smallest overall
+ // extremal. If you want to delete the smallest of the
+ // pair of non-alternating extremals, then you must do:
+ //
+ // if (fabs(E[foundExt[j]]) < fabs(E[foundExt[j-1]])) l=j;
+ // else l=j-1;
+ break; /* Ooops, found two non-alternating */
+ } /* extrema. Delete smallest of them */
+ } /* if the loop finishes, all extrema are alternating */
+
+/*
+ * If there's only one extremal and all are alternating,
+ * delete the smallest of the first/last extremals.
+ */
+ if ((alt) && (extra == 1))
+ {
+ if (fabs(E[foundExt[k-1]]) < fabs(E[foundExt[0]]))
+ /* Delete last extremal */
+ l = k-1;
+ // PAK: changed from l = foundExt[k-1];
+ else
+ /* Delete first extremal */
+ l = 0;
+ // PAK: changed from l = foundExt[0];
+ }
+
+ for (j=l; j<k-1; j++) /* Loop that does the deletion */
+ {
+ foundExt[j] = foundExt[j+1];
+ assert(foundExt[j]<gridsize);
+ }
+ k--;
+ extra--;
+ }
+
+ for (i=0; i<=r; i++)
+ {
+ assert(foundExt[i]<gridsize);
+ Ext[i] = foundExt[i]; /* Copy found extremals to Ext[] */
+ }
+
+ free(foundExt);
+ return 0;
+}
+
+
+/*********************
+ * FreqSample
+ *============
+ * Simple frequency sampling algorithm to determine the impulse
+ * response h[] from A's found in ComputeA
+ *
+ *
+ * INPUT:
+ * ------
+ * int N - Number of filter coefficients
+ * double A[] - Sample points of desired response [N/2]
+ * int symmetry - Symmetry of desired filter
+ *
+ * OUTPUT:
+ * -------
+ * double h[] - Impulse Response of final filter [N]
+ *********************/
+static void
+FreqSample (int N, double A[], double h[], int symm)
+{
+ int n, k;
+ double x, val, M;
+
+ M = (N-1.0)/2.0;
+ if (symm == POSITIVE)
+ {
+ if (N%2)
+ {
+ for (n=0; n<N; n++)
+ {
+ val = A[0];
+ x = Pi2 * (n - M)/N;
+ for (k=1; k<=M; k++)
+ val += 2.0 * A[k] * cos(x*k);
+ h[n] = val/N;
+ }
+ }
+ else
+ {
+ for (n=0; n<N; n++)
+ {
+ val = A[0];
+ x = Pi2 * (n - M)/N;
+ for (k=1; k<=(N/2-1); k++)
+ val += 2.0 * A[k] * cos(x*k);
+ h[n] = val/N;
+ }
+ }
+ }
+ else
+ {
+ if (N%2)
+ {
+ for (n=0; n<N; n++)
+ {
+ val = 0;
+ x = Pi2 * (n - M)/N;
+ for (k=1; k<=M; k++)
+ val += 2.0 * A[k] * sin(x*k);
+ h[n] = val/N;
+ }
+ }
+ else
+ {
+ for (n=0; n<N; n++)
+ {
+ val = A[N/2] * sin(Pi * (n - M));
+ x = Pi2 * (n - M)/N;
+ for (k=1; k<=(N/2-1); k++)
+ val += 2.0 * A[k] * sin(x*k);
+ h[n] = val/N;
+ }
+ }
+ }
+}
+
+/*******************
+ * isDone
+ *========
+ * Checks to see if the error function is small enough to consider
+ * the result to have converged.
+ *
+ * INPUT:
+ * ------
+ * int r - 1/2 the number of filter coeffiecients
+ * int Ext[] - Indexes to extremal frequencies [r+1]
+ * double E[] - Error function on the dense grid [gridsize]
+ *
+ * OUTPUT:
+ * -------
+ * Returns 1 if the result converged
+ * Returns 0 if the result has not converged
+ ********************/
+
+static bool
+isDone (int r, int Ext[], double E[])
+{
+ int i;
+ double min, max, current;
+
+ min = max = fabs(E[Ext[0]]);
+ for (i=1; i<=r; i++)
+ {
+ current = fabs(E[Ext[i]]);
+ if (current < min)
+ min = current;
+ if (current > max)
+ max = current;
+ }
+ return (((max-min)/max) < 0.0001);
+}
+
+/********************
+ * remez
+ *=======
+ * Calculates the optimal (in the Chebyshev/minimax sense)
+ * FIR filter impulse response given a set of band edges,
+ * the desired reponse on those bands, and the weight given to
+ * the error in those bands.
+ *
+ * INPUT:
+ * ------
+ * int numtaps - Number of filter coefficients
+ * int numband - Number of bands in filter specification
+ * double bands[] - User-specified band edges [2 * numband]
+ * double des[] - User-specified band responses [2 * numband]
+ * double weight[] - User-specified error weights [numband]
+ * int type - Type of filter
+ *
+ * OUTPUT:
+ * -------
+ * double h[] - Impulse response of final filter [numtaps]
+ * returns - true on success, false on failure to converge
+ ********************/
+
+static int
+remez (double h[], int numtaps,
+ int numband, const double bands[],
+ const double des[], const double weight[],
+ int type, int griddensity)
+{
+ double *Grid, *W, *D, *E;
+ int i, iter, gridsize, r, *Ext;
+ double *taps, c;
+ double *x, *y, *ad;
+ int symmetry;
+
+ if (type == BANDPASS)
+ symmetry = POSITIVE;
+ else
+ symmetry = NEGATIVE;
+
+ r = numtaps/2; /* number of extrema */
+ if ((numtaps%2) && (symmetry == POSITIVE))
+ r++;
+
+/*
+ * Predict dense grid size in advance for memory allocation
+ * .5 is so we round up, not truncate
+ */
+ gridsize = 0;
+ for (i=0; i<numband; i++)
+ {
+ gridsize += (int)(2*r*griddensity*(bands[2*i+1] - bands[2*i]) + .5);
+ }
+ if (symmetry == NEGATIVE)
+ {
+ gridsize--;
+ }
+
+/*
+ * Dynamically allocate memory for arrays with proper sizes
+ */
+ Grid = (double *)malloc(gridsize * sizeof(double));
+ D = (double *)malloc(gridsize * sizeof(double));
+ W = (double *)malloc(gridsize * sizeof(double));
+ E = (double *)malloc(gridsize * sizeof(double));
+ Ext = (int *)malloc((r+1) * sizeof(int));
+ taps = (double *)malloc((r+1) * sizeof(double));
+ x = (double *)malloc((r+1) * sizeof(double));
+ y = (double *)malloc((r+1) * sizeof(double));
+ ad = (double *)malloc((r+1) * sizeof(double));
+
+/*
+ * Create dense frequency grid
+ */
+ CreateDenseGrid(r, numtaps, numband, bands, des, weight,
+ gridsize, Grid, D, W, symmetry, griddensity);
+ InitialGuess(r, Ext, gridsize);
+
+/*
+ * For Differentiator: (fix grid)
+ */
+ if (type == DIFFERENTIATOR)
+ {
+ for (i=0; i<gridsize; i++)
+ {
+/* D[i] = D[i]*Grid[i]; */
+ if (D[i] > 0.0001)
+ W[i] = W[i]/Grid[i];
+ }
+ }
+
+/*
+ * For odd or Negative symmetry filters, alter the
+ * D[] and W[] according to Parks McClellan
+ */
+ if (symmetry == POSITIVE)
+ {
+ if (numtaps % 2 == 0)
+ {
+ for (i=0; i<gridsize; i++)
+ {
+ c = cos(Pi * Grid[i]);
+ D[i] /= c;
+ W[i] *= c;
+ }
+ }
+ }
+ else
+ {
+ if (numtaps % 2)
+ {
+ for (i=0; i<gridsize; i++)
+ {
+ c = sin(Pi2 * Grid[i]);
+ D[i] /= c;
+ W[i] *= c;
+ }
+ }
+ else
+ {
+ for (i=0; i<gridsize; i++)
+ {
+ c = sin(Pi * Grid[i]);
+ D[i] /= c;
+ W[i] *= c;
+ }
+ }
+ }
+
+/*
+ * Perform the Remez Exchange algorithm
+ */
+ for (iter=0; iter<MAXITERATIONS; iter++)
+ {
+ CalcParms(r, Ext, Grid, D, W, ad, x, y);
+ CalcError(r, ad, x, y, gridsize, Grid, D, W, E);
+ int err = Search(r, Ext, gridsize, E);
+ if (err) return err;
+ for(int i=0; i <= r; i++) assert(Ext[i]<gridsize);
+ if (isDone(r, Ext, E))
+ break;
+ }
+
+ CalcParms(r, Ext, Grid, D, W, ad, x, y);
+
+/*
+ * Find the 'taps' of the filter for use with Frequency
+ * Sampling. If odd or Negative symmetry, fix the taps
+ * according to Parks McClellan
+ */
+ for (i=0; i<=numtaps/2; i++)
+ {
+ if (symmetry == POSITIVE)
+ {
+ if (numtaps%2)
+ c = 1;
+ else
+ c = cos(Pi * (double)i/numtaps);
+ }
+ else
+ {
+ if (numtaps%2)
+ c = sin(Pi2 * (double)i/numtaps);
+ else
+ c = sin(Pi * (double)i/numtaps);
+ }
+ taps[i] = ComputeA((double)i/numtaps, r, ad, x, y)*c;
+ }
+
+/*
+ * Frequency sampling design with calculated taps
+ */
+ FreqSample(numtaps, taps, h, symmetry);
+
+/*
+ * Delete allocated memory
+ */
+ free(Grid);
+ free(W);
+ free(D);
+ free(E);
+ free(Ext);
+ free(x);
+ free(y);
+ free(ad);
+ return iter<MAXITERATIONS?0:-1;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//
+// GNU Radio interface
+//
+//////////////////////////////////////////////////////////////////////////////
+
+
+static void
+punt (const std::string msg)
+{
+ std::cerr << msg << '\n';
+ throw std::runtime_error (msg);
+}
+
+std::vector<double>
+gr_remez (int order,
+ const std::vector<double> &arg_bands,
+ const std::vector<double> &arg_response,
+ const std::vector<double> &arg_weight,
+ const std::string filter_type,
+ int grid_density
+ ) throw (std::runtime_error)
+{
+ int numtaps = order + 1;
+ if (numtaps < 4)
+ punt ("gr_remez: number of taps must be >= 3");
+
+ int numbands = arg_bands.size () / 2;
+ LOCAL_BUFFER (double, bands, numbands * 2);
+ if (numbands < 1 || arg_bands.size () % 2 == 1)
+ punt ("gr_remez: must have an even number of band edges");
+
+ for (unsigned int i = 1; i < arg_bands.size (); i++){
+ if (arg_bands[i] < arg_bands[i-1])
+ punt ("gr_remez: band edges must be nondecreasing");
+ }
+
+ if (arg_bands[0] < 0 || arg_bands[arg_bands.size () - 1] > 1)
+ punt ("gr_remez: band edges must be in the range [0,1]");
+
+ // Divide by 2 to fit with the implementation that uses a
+ // sample rate of [0, 0.5] instead of [0, 1.0]
+ for (int i = 0; i < 2 * numbands; i++)
+ bands[i] = arg_bands[i] / 2;
+
+ LOCAL_BUFFER (double, response, numbands * 2);
+ if (arg_response.size () != arg_bands.size ())
+ punt ("gr_remez: must have one response magnitude for each band edge");
+
+ for (int i = 0; i < 2 * numbands; i++)
+ response[i] = arg_response[i];
+
+ LOCAL_BUFFER (double, weight, numbands);
+ for (int i = 0; i < numbands; i++)
+ weight[i] = 1.0;
+
+ if (arg_weight.size () != 0){
+ if ((int) arg_weight.size () != numbands)
+ punt ("gr_remez: need one weight for each band [=length(band)/2]");
+ for (int i = 0; i < numbands; i++)
+ weight[i] = arg_weight [i];
+ }
+
+ int itype = 0;
+ if (filter_type == "bandpass")
+ itype = BANDPASS;
+ else if (filter_type == "differentiator")
+ itype = DIFFERENTIATOR;
+ else if (filter_type == "hilbert")
+ itype = HILBERT;
+ else
+ punt ("gr_remez: unknown ftype '" + filter_type + "'");
+
+ if (grid_density < 16)
+ punt ("gr_remez: grid_density is too low; must be >= 16");
+
+ LOCAL_BUFFER (double, coeff, numtaps + 5); // FIXME why + 5?
+ int err = remez (coeff, numtaps, numbands,
+ bands, response, weight, itype, grid_density);
+
+ if (err == -1)
+ punt ("gr_remez: failed to converge");
+
+ if (err == -2)
+ punt ("gr_remez: insufficient extremals -- cannot continue");
+
+ if (err == -3)
+ punt ("gr_remez: too many extremals -- cannot continue");
+
+ return std::vector<double> (&coeff[0], &coeff[numtaps]);
+}
+
+
+
+#if 0
+/* == Octave interface starts here ====================================== */
+
+DEFUN_DLD (remez, args, ,
+ "b = remez(n, f, a [, w] [, ftype] [, griddensity])\n\
+Parks-McClellan optimal FIR filter design.\n\
+n gives the number of taps in the returned filter\n\
+f gives frequency at the band edges [ b1 e1 b2 e2 b3 e3 ...]\n\
+a gives amplitude at the band edges [ a(b1) a(e1) a(b2) a(e2) ...]\n\
+w gives weighting applied to each band\n\
+ftype is 'bandpass', 'hilbert' or 'differentiator'\n\
+griddensity determines how accurately the filter will be\n\
+ constructed. The minimum value is 16, but higher numbers are\n\
+ slower to compute.\n\
+\n\
+Frequency is in the range (0, 1), with 1 being the nyquist frequency")
+{
+ octave_value_list retval;
+ int i;
+
+ int nargin = args.length();
+ if (nargin < 3 || nargin > 6) {
+ print_usage("remez");
+ return retval;
+ }
+
+ int numtaps = NINT (args(0).double_value()) + 1; // #coeff = filter order+1
+ if (numtaps < 4) {
+ error("remez: number of taps must be an integer greater than 3");
+ return retval;
+ }
+
+ ColumnVector o_bands(args(1).vector_value());
+ int numbands = o_bands.length()/2;
+ OCTAVE_LOCAL_BUFFER(double, bands, numbands*2);
+ if (numbands < 1 || o_bands.length()%2 == 1) {
+ error("remez: must have an even number of band edges");
+ return retval;
+ }
+ for (i=1; i < o_bands.length(); i++) {
+ if (o_bands(i)<o_bands(i-1)) {
+ error("band edges must be nondecreasing");
+ return retval;
+ }
+ }
+ if (o_bands(0) < 0 || o_bands(1) > 1) {
+ error("band edges must be in the range [0,1]");
+ return retval;
+ }
+ for(i=0; i < 2*numbands; i++) bands[i] = o_bands(i)/2.0;
+
+ ColumnVector o_response(args(2).vector_value());
+ OCTAVE_LOCAL_BUFFER (double, response, numbands*2);
+ if (o_response.length() != o_bands.length()) {
+ error("remez: must have one response magnitude for each band edge");
+ return retval;
+ }
+ for(i=0; i < 2*numbands; i++) response[i] = o_response(i);
+
+ std::string stype = std::string("bandpass");
+ int density = 16;
+ OCTAVE_LOCAL_BUFFER (double, weight, numbands);
+ for (i=0; i < numbands; i++) weight[i] = 1.0;
+ if (nargin > 3) {
+ if (args(3).is_real_matrix()) {
+ ColumnVector o_weight(args(3).vector_value());
+ if (o_weight.length() != numbands) {
+ error("remez: need one weight for each band [=length(band)/2]");
+ return retval;
+ }
+ for (i=0; i < numbands; i++) weight[i] = o_weight(i);
+ }
+ else if (args(3).is_string())
+ stype = args(3).string_value();
+ else if (args(3).is_real_scalar())
+ density = NINT(args(3).double_value());
+ else {
+ error("remez: incorrect argument list");
+ return retval;
+ }
+ }
+ if (nargin > 4) {
+ if (args(4).is_string() && !args(3).is_string())
+ stype = args(4).string_value();
+ else if (args(4).is_real_scalar() && !args(3).is_real_scalar())
+ density = NINT(args(4).double_value());
+ else {
+ error("remez: incorrect argument list");
+ return retval;
+ }
+ }
+ if (nargin > 5) {
+ if (args(5).is_real_scalar()
+ && !args(4).is_real_scalar()
+ && !args(3).is_real_scalar())
+ density = NINT(args(4).double_value());
+ else {
+ error("remez: incorrect argument list");
+ return retval;
+ }
+ }
+
+ int itype;
+ if (stype == "bandpass")
+ itype = BANDPASS;
+ else if (stype == "differentiator")
+ itype = DIFFERENTIATOR;
+ else if (stype == "hilbert")
+ itype = HILBERT;
+ else {
+ error("remez: unknown ftype '%s'", stype.data());
+ return retval;
+ }
+
+ if (density < 16) {
+ error("remez: griddensity is too low; must be greater than 16");
+ return retval;
+ }
+
+ OCTAVE_LOCAL_BUFFER (double, coeff, numtaps+5);
+ int err = remez(coeff,numtaps,numbands,bands,response,weight,itype,density);
+
+ if (err == -1)
+ warning("remez: -- failed to converge -- returned filter may be bad.");
+ else if (err == -2) {
+ error("remez: insufficient extremals--cannot continue");
+ return retval;
+ }
+ else if (err == -3) {
+ error("remez: too many extremals--cannot continue");
+ return retval;
+ }
+
+ ColumnVector h(numtaps);
+ while(numtaps--) h(numtaps) = coeff[numtaps];
+
+ return octave_value(h);
+}
+
+/*
+%!test
+%! b = [
+%! 0.0415131831103279
+%! 0.0581639884202646
+%! -0.0281579212691008
+%! -0.0535575358002337
+%! -0.0617245915143180
+%! 0.0507753178978075
+%! 0.2079018331396460
+%! 0.3327160895375440
+%! 0.3327160895375440
+%! 0.2079018331396460
+%! 0.0507753178978075
+%! -0.0617245915143180
+%! -0.0535575358002337
+%! -0.0281579212691008
+%! 0.0581639884202646
+%! 0.0415131831103279];
+%! assert(remez(15,[0,0.3,0.4,1],[1,1,0,0]),b,1e-14);
+
+ */
+
+#endif
diff --git a/gnuradio-core/src/lib/general/gr_remez.h b/gnuradio-core/src/lib/general/gr_remez.h
new file mode 100644
index 000000000..d875b8822
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_remez.h
@@ -0,0 +1,65 @@
+/* -*- 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_REMEZ_H
+#define INCLUDED_GR_REMEZ_H
+
+#include <gr_core_api.h>
+#include <gr_types.h>
+#include <string>
+#include <stdexcept>
+
+/*!
+ * \brief Parks-McClellan FIR filter design.
+ *
+ * \ingroup filter_design
+ *
+ * Calculates the optimal (in the Chebyshev/minimax sense) FIR filter
+ * inpulse reponse given a set of band edges, the desired reponse on
+ * those bands, and the weight given to the error in those bands.
+ *
+ * \param order filter order (number of taps in the returned filter - 1)
+ * \param bands frequency at the band edges [ b1 e1 b2 e2 b3 e3 ...]
+ * \param ampl desired amplitude at the band edges [ a(b1) a(e1) a(b2) a(e2) ...]
+ * \param error_weight weighting applied to each band (usually 1)
+ * \param filter_type one of "bandpass", "hilbert" or "differentiator"
+ * \param grid_density determines how accurately the filter will be constructed. \
+ * The minimum value is 16; higher values are slower to compute.
+ *
+ * Frequency is in the range [0, 1], with 1 being the Nyquist frequency (Fs/2)
+ *
+ * \returns vector of computed taps
+ *
+ * \throws std::runtime_error if args are invalid or calculation fails to converge.
+ */
+
+GR_CORE_API std::vector<double>
+gr_remez (int order,
+ const std::vector<double> &bands,
+ const std::vector<double> &ampl,
+ const std::vector<double> &error_weight,
+ const std::string filter_type = "bandpass",
+ int grid_density = 16
+ ) throw (std::runtime_error);
+
+
+#endif /* INCLUDED_GR_REMEZ_H */
diff --git a/gnuradio-core/src/lib/general/gr_remez.i b/gnuradio-core/src/lib/general/gr_remez.i
new file mode 100644
index 000000000..fe3eea20d
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_remez.i
@@ -0,0 +1,32 @@
+/* -*- 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.
+ */
+
+%rename(remez) gr_remez;
+
+std::vector<double>
+gr_remez (int order,
+ const std::vector<double> &bands,
+ const std::vector<double> &ampl,
+ const std::vector<double> &error_weight,
+ const std::string filter_type = "bandpass",
+ int grid_density = 16
+ ) throw (std::runtime_error);
diff --git a/gnuradio-core/src/lib/general/gr_repeat.cc b/gnuradio-core/src/lib/general/gr_repeat.cc
new file mode 100644
index 000000000..2fa82cd94
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_repeat.cc
@@ -0,0 +1,69 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_repeat.h>
+#include <gr_io_signature.h>
+#include <string.h>
+
+gr_repeat_sptr
+gr_make_repeat(size_t itemsize, int interp)
+{
+ return gnuradio::get_initial_sptr(new gr_repeat(itemsize, interp));
+}
+
+gr_repeat::gr_repeat(size_t itemsize, int interp)
+ : gr_sync_interpolator("extend",
+ gr_make_io_signature(1, 1, itemsize),
+ gr_make_io_signature(1, 1, itemsize),
+ interp),
+ d_interp(interp),
+ d_itemsize(itemsize)
+{
+}
+
+gr_repeat::~gr_repeat()
+{
+}
+
+int
+gr_repeat::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const char *in = (const char *) input_items[0];
+ char *out = (char *)output_items[0];
+
+ for (int i = 0; i < noutput_items/d_interp; i++) {
+ for (int j = 0; j < d_interp; j++) {
+ memcpy(out, in, d_itemsize);
+ out += d_itemsize;
+ }
+
+ in += d_itemsize;
+ }
+
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/general/gr_repeat.h b/gnuradio-core/src/lib/general/gr_repeat.h
new file mode 100644
index 000000000..548ca79f4
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_repeat.h
@@ -0,0 +1,57 @@
+/* -*- 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.
+ */
+#ifndef INCLUDED_GR_REPEAT_H
+#define INCLUDED_GR_REPEAT_H
+
+#include <gr_core_api.h>
+#include <gr_sync_interpolator.h>
+
+class gr_repeat;
+
+typedef boost::shared_ptr<gr_repeat> gr_repeat_sptr;
+
+GR_CORE_API gr_repeat_sptr gr_make_repeat(size_t itemsize, int interp);
+
+/*!
+ * \brief Repeat a sample 'interp' times in output stream
+ * \ingroup misc_blk
+ */
+
+class GR_CORE_API gr_repeat : public gr_sync_interpolator
+{
+private:
+ friend GR_CORE_API gr_repeat_sptr gr_make_repeat(size_t itemsize, int interp);
+
+ gr_repeat(size_t itemsize, int interp);
+
+ int d_interp;
+ int d_itemsize;
+
+ public:
+ ~gr_repeat();
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif /* INCLUDED_GR_REPEAT_H */
diff --git a/gnuradio-core/src/lib/general/gr_repeat.i b/gnuradio-core/src/lib/general/gr_repeat.i
new file mode 100644
index 000000000..c657a4906
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_repeat.i
@@ -0,0 +1,11 @@
+/* -*- c++ -*- */
+
+GR_SWIG_BLOCK_MAGIC(gr,repeat);
+
+gr_repeat_sptr gr_make_repeat(size_t itemsize, int interp);
+
+class gr_repeat : public gr_sync_interpolator
+{
+private:
+ gr_repeat();
+};
diff --git a/gnuradio-core/src/lib/general/gr_reverse.cc b/gnuradio-core/src/lib/general/gr_reverse.cc
new file mode 100644
index 000000000..08c588cb5
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_reverse.cc
@@ -0,0 +1,60 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005 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 <gr_reverse.h>
+
+
+std::vector<float>
+gr_reverse (const std::vector<float> &taps)
+{
+ int size = taps.size ();
+ std::vector<float> new_taps(size);
+
+ if (size == 0)
+ return new_taps;
+
+ for (int i = 0; i < size; i++)
+ new_taps[i] = taps[size - i - 1];
+
+ return new_taps;
+}
+
+
+std::vector<gr_complex>
+gr_reverse (const std::vector<gr_complex> &taps)
+{
+ int size = taps.size ();
+ std::vector<gr_complex> new_taps(size);
+
+ if (size == 0)
+ return new_taps;
+
+ for (int i = 0; i < size; i++)
+ new_taps[i] = taps[size - i - 1];
+
+ return new_taps;
+}
+
diff --git a/gnuradio-core/src/lib/general/gr_reverse.h b/gnuradio-core/src/lib/general/gr_reverse.h
new file mode 100644
index 000000000..15bf3cb73
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_reverse.h
@@ -0,0 +1,34 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005 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_REVERSE_H
+#define INCLUDED_GR_REVERSE_H
+
+#include <gr_core_api.h>
+#include <vector>
+#include <gr_complex.h>
+
+// reverse the order of taps
+std::vector<float> gr_reverse (const std::vector<float> &taps);
+std::vector<gr_complex> gr_reverse (const std::vector<gr_complex> &taps);
+
+
+#endif /* INCLUDED_GR_REVERSE_H */
diff --git a/gnuradio-core/src/lib/general/gr_rms_cf.cc b/gnuradio-core/src/lib/general/gr_rms_cf.cc
new file mode 100644
index 000000000..44eb2221e
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_rms_cf.cc
@@ -0,0 +1,71 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+#include <gr_rms_cf.h>
+#include <gr_io_signature.h>
+#include <cmath>
+
+gr_rms_cf_sptr
+gr_make_rms_cf(double alpha)
+{
+ return gnuradio::get_initial_sptr(new gr_rms_cf(alpha));
+}
+
+gr_rms_cf::gr_rms_cf (double alpha)
+ : gr_sync_block ("rms_cf",
+ gr_make_io_signature(1, 1, sizeof(gr_complex)),
+ gr_make_io_signature(1, 1, sizeof(float))),
+ d_iir(alpha)
+{
+
+}
+
+gr_rms_cf::~gr_rms_cf()
+{
+}
+
+
+int
+gr_rms_cf::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const gr_complex *in = (const gr_complex *) input_items[0];
+ float *out = (float *) output_items[0];
+
+ for (int i = 0; i < noutput_items; i++){
+ double mag_sqrd = in[i].real()*in[i].real() + in[i].imag()*in[i].imag();
+ double f = d_iir.filter(mag_sqrd);
+ out[i] = sqrt(f);
+ }
+
+ return noutput_items;
+}
+
+void
+gr_rms_cf::set_alpha(double alpha)
+{
+ d_iir.set_taps(alpha);
+}
diff --git a/gnuradio-core/src/lib/general/gr_rms_cf.h b/gnuradio-core/src/lib/general/gr_rms_cf.h
new file mode 100644
index 000000000..9e701aa6a
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_rms_cf.h
@@ -0,0 +1,61 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005 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_RMS_CF_H
+#define INCLUDED_GR_RMS_CF_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+#include <gr_single_pole_iir.h>
+
+class gr_rms_cf;
+typedef boost::shared_ptr<gr_rms_cf> gr_rms_cf_sptr;
+
+GR_CORE_API gr_rms_cf_sptr
+gr_make_rms_cf (double alpha = 0.0001);
+
+/*!
+ * \brief RMS average power
+ * \ingroup math_blk
+ */
+class GR_CORE_API gr_rms_cf : public gr_sync_block
+{
+ gr_single_pole_iir<double,double,double> d_iir;
+ bool d_unmuted;
+
+ friend GR_CORE_API gr_rms_cf_sptr
+ gr_make_rms_cf (double alpha);
+
+ gr_rms_cf (double alpha);
+
+public:
+ ~gr_rms_cf ();
+
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+
+ bool unmuted () const { return d_unmuted; }
+
+ void set_alpha (double alpha);
+};
+
+#endif /* INCLUDED_GR_RMS_CF_H */
diff --git a/gnuradio-core/src/lib/general/gr_rms_cf.i b/gnuradio-core/src/lib/general/gr_rms_cf.i
new file mode 100644
index 000000000..a668200ee
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_rms_cf.i
@@ -0,0 +1,33 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005 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,rms_cf);
+
+gr_rms_cf_sptr
+gr_make_rms_cf (double alpha = 0.0001);
+
+class gr_rms_cf : public gr_sync_block
+{
+public:
+ bool unmuted () const { return d_unmuted; }
+ void set_alpha (double alpha);
+};
diff --git a/gnuradio-core/src/lib/general/gr_rms_ff.cc b/gnuradio-core/src/lib/general/gr_rms_ff.cc
new file mode 100644
index 000000000..233f419cd
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_rms_ff.cc
@@ -0,0 +1,71 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+#include <gr_rms_ff.h>
+#include <gr_io_signature.h>
+#include <cmath>
+
+gr_rms_ff_sptr
+gr_make_rms_ff(double alpha)
+{
+ return gnuradio::get_initial_sptr(new gr_rms_ff(alpha));
+}
+
+gr_rms_ff::gr_rms_ff (double alpha)
+ : gr_sync_block ("rms_ff",
+ gr_make_io_signature(1, 1, sizeof(float)),
+ gr_make_io_signature(1, 1, sizeof(float))),
+ d_iir(alpha)
+{
+
+}
+
+gr_rms_ff::~gr_rms_ff()
+{
+}
+
+
+int
+gr_rms_ff::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const float *in = (const float *) input_items[0];
+ float *out = (float *) output_items[0];
+
+ for (int i = 0; i < noutput_items; i++){
+ double mag_sqrd = in[i]*in[i];
+ double f = d_iir.filter(mag_sqrd);
+ out[i] = sqrt(f);
+ }
+
+ return noutput_items;
+}
+
+void
+gr_rms_ff::set_alpha(double alpha)
+{
+ d_iir.set_taps(alpha);
+}
diff --git a/gnuradio-core/src/lib/general/gr_rms_ff.h b/gnuradio-core/src/lib/general/gr_rms_ff.h
new file mode 100644
index 000000000..30cf7f9d9
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_rms_ff.h
@@ -0,0 +1,61 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005 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_RMS_FF_H
+#define INCLUDED_GR_RMS_FF_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+#include <gr_single_pole_iir.h>
+
+class gr_rms_ff;
+typedef boost::shared_ptr<gr_rms_ff> gr_rms_ff_sptr;
+
+GR_CORE_API gr_rms_ff_sptr
+gr_make_rms_ff (double alpha = 0.0001);
+
+/*!
+ * \brief RMS average power
+ * \ingroup math_blk
+ */
+class GR_CORE_API gr_rms_ff : public gr_sync_block
+{
+ gr_single_pole_iir<double,double,double> d_iir;
+ bool d_unmuted;
+
+ friend GR_CORE_API gr_rms_ff_sptr
+ gr_make_rms_ff (double alpha);
+
+ gr_rms_ff (double alpha);
+
+public:
+ ~gr_rms_ff ();
+
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+
+ bool unmuted () const { return d_unmuted; }
+
+ void set_alpha (double alpha);
+};
+
+#endif /* INCLUDED_GR_RMS_FF_H */
diff --git a/gnuradio-core/src/lib/general/gr_rms_ff.i b/gnuradio-core/src/lib/general/gr_rms_ff.i
new file mode 100644
index 000000000..00b03f5d4
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_rms_ff.i
@@ -0,0 +1,33 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005 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,rms_ff);
+
+gr_rms_ff_sptr
+gr_make_rms_ff (double alpha = 0.0001);
+
+class gr_rms_ff : public gr_sync_block
+{
+public:
+ bool unmuted () const { return d_unmuted; }
+ void set_alpha (double alpha);
+};
diff --git a/gnuradio-core/src/lib/general/gr_scrambler_bb.cc b/gnuradio-core/src/lib/general/gr_scrambler_bb.cc
new file mode 100644
index 000000000..31eb19207
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_scrambler_bb.cc
@@ -0,0 +1,56 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_scrambler_bb.h>
+#include <gr_io_signature.h>
+
+gr_scrambler_bb_sptr
+gr_make_scrambler_bb(int mask, int seed, int len)
+{
+ return gnuradio::get_initial_sptr(new gr_scrambler_bb(mask, seed, len));
+}
+
+gr_scrambler_bb::gr_scrambler_bb(int mask, int seed, int len)
+ : gr_sync_block("scrambler_bb",
+ gr_make_io_signature (1, 1, sizeof (unsigned char)),
+ gr_make_io_signature (1, 1, sizeof (unsigned char))),
+ d_lfsr(mask, seed, len)
+{
+}
+
+int
+gr_scrambler_bb::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const unsigned char *in = (const unsigned char *) input_items[0];
+ unsigned char *out = (unsigned char *) output_items[0];
+
+ for (int i = 0; i < noutput_items; i++)
+ out[i] = d_lfsr.next_bit_scramble(in[i]);
+
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/general/gr_scrambler_bb.h b/gnuradio-core/src/lib/general/gr_scrambler_bb.h
new file mode 100644
index 000000000..edb429e0a
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_scrambler_bb.h
@@ -0,0 +1,60 @@
+/* -*- 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.
+ */
+#ifndef INCLUDED_GR_SCRAMBLER_BB_H
+#define INCLUDED_GR_SCRAMBLER_BB_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+#include "gri_lfsr.h"
+
+class gr_scrambler_bb;
+typedef boost::shared_ptr<gr_scrambler_bb> gr_scrambler_bb_sptr;
+
+GR_CORE_API gr_scrambler_bb_sptr gr_make_scrambler_bb(int mask, int seed, int len);
+
+/*!
+ * Scramble an input stream using an LFSR. This block works on the LSB only
+ * of the input data stream, i.e., on an "unpacked binary" stream, and
+ * produces the same format on its output.
+ *
+ * \param mask Polynomial mask for LFSR
+ * \param seed Initial shift register contents
+ * \param len Shift register length
+ *
+ * \ingroup coding_blk
+ */
+
+class GR_CORE_API gr_scrambler_bb : public gr_sync_block
+{
+ friend GR_CORE_API gr_scrambler_bb_sptr gr_make_scrambler_bb(int mask, int seed, int len);
+
+ gri_lfsr d_lfsr;
+
+ gr_scrambler_bb(int mask, int seed, int len);
+
+public:
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif /* INCLUDED_GR_SCRAMBLER_BB_H */
diff --git a/gnuradio-core/src/lib/general/gr_scrambler_bb.i b/gnuradio-core/src/lib/general/gr_scrambler_bb.i
new file mode 100644
index 000000000..a7ef7b364
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_scrambler_bb.i
@@ -0,0 +1,31 @@
+/* -*- 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,scrambler_bb);
+
+gr_scrambler_bb_sptr gr_make_scrambler_bb(int mask, int seed, int len);
+
+class gr_scrambler_bb : public gr_sync_block
+{
+private:
+ gr_scrambler_bb(int mask, int seed, int len);
+};
diff --git a/gnuradio-core/src/lib/general/gr_short_to_char.cc b/gnuradio-core/src/lib/general/gr_short_to_char.cc
new file mode 100644
index 000000000..8c146a351
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_short_to_char.cc
@@ -0,0 +1,67 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2011,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 <gr_short_to_char.h>
+#include <gr_io_signature.h>
+#include <volk/volk.h>
+
+gr_short_to_char_sptr
+gr_make_short_to_char (size_t vlen)
+{
+ return gnuradio::get_initial_sptr(new gr_short_to_char (vlen));
+}
+
+gr_short_to_char::gr_short_to_char (size_t vlen)
+ : gr_sync_block ("gr_short_to_char",
+ gr_make_io_signature (1, 1, sizeof (short)*vlen),
+ gr_make_io_signature (1, 1, sizeof (char)*vlen)),
+ d_vlen(vlen)
+{
+ const int alignment_multiple =
+ volk_get_alignment() / sizeof(char);
+ set_alignment(std::max(1,alignment_multiple));
+}
+
+int
+gr_short_to_char::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const int16_t *in = (const int16_t *) input_items[0];
+ int8_t *out = (int8_t *) output_items[0];
+
+ if(is_unaligned()) {
+ volk_16i_convert_8i_u(out, in, d_vlen*noutput_items);
+ }
+ else {
+ volk_16i_convert_8i_a(out, in, d_vlen*noutput_items);
+ }
+
+ return noutput_items;
+}
+
+
+
diff --git a/gnuradio-core/src/lib/general/gr_short_to_char.h b/gnuradio-core/src/lib/general/gr_short_to_char.h
new file mode 100644
index 000000000..bf96211c7
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_short_to_char.h
@@ -0,0 +1,58 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2011,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 INCLUDED_GR_SHORT_TO_CHAR_H
+#define INCLUDED_GR_SHORT_TO_CHAR_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+
+class gr_short_to_char;
+typedef boost::shared_ptr<gr_short_to_char> gr_short_to_char_sptr;
+
+GR_CORE_API gr_short_to_char_sptr
+gr_make_short_to_char (size_t vlen=1);
+
+/*!
+ * \brief Convert stream of short to a stream of float
+ * \ingroup converter_blk
+ *
+ * \param vlen vector length of data streams.
+ */
+
+class GR_CORE_API gr_short_to_char : public gr_sync_block
+{
+ private:
+ friend GR_CORE_API gr_short_to_char_sptr
+ gr_make_short_to_char (size_t vlen);
+ gr_short_to_char (size_t vlen);
+
+ size_t d_vlen;
+
+ public:
+ virtual int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+
+#endif /* INCLUDED_GR_SHORT_TO_CHAR_H */
diff --git a/gnuradio-core/src/lib/general/gr_short_to_char.i b/gnuradio-core/src/lib/general/gr_short_to_char.i
new file mode 100644
index 000000000..7389ed10b
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_short_to_char.i
@@ -0,0 +1,31 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2011,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,short_to_char)
+
+gr_short_to_char_sptr
+gr_make_short_to_char (size_t vlen=1);
+
+class gr_short_to_char : public gr_sync_block
+{
+
+};
diff --git a/gnuradio-core/src/lib/general/gr_short_to_float.cc b/gnuradio-core/src/lib/general/gr_short_to_float.cc
new file mode 100644
index 000000000..093d6024f
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_short_to_float.cc
@@ -0,0 +1,78 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,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 <gr_short_to_float.h>
+#include <gr_io_signature.h>
+#include <volk/volk.h>
+
+gr_short_to_float_sptr
+gr_make_short_to_float (size_t vlen, float scale)
+{
+ return gnuradio::get_initial_sptr(new gr_short_to_float (vlen, scale));
+}
+
+gr_short_to_float::gr_short_to_float (size_t vlen, float scale)
+ : gr_sync_block ("gr_short_to_float",
+ gr_make_io_signature (1, 1, sizeof (short)*vlen),
+ gr_make_io_signature (1, 1, sizeof (float)*vlen)),
+ d_vlen(vlen), d_scale(scale)
+{
+ const int alignment_multiple =
+ volk_get_alignment() / sizeof(float);
+ set_alignment(std::max(1,alignment_multiple));
+}
+
+float
+gr_short_to_float::scale() const
+{
+ return d_scale;
+}
+
+void
+gr_short_to_float::set_scale(float scale)
+{
+ d_scale = scale;
+}
+
+int
+gr_short_to_float::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const short *in = (const short *) input_items[0];
+ float *out = (float *) output_items[0];
+
+ if(is_unaligned()) {
+ volk_16i_s32f_convert_32f_u(out, in, d_scale, d_vlen*noutput_items);
+ }
+ else {
+ volk_16i_s32f_convert_32f_a(out, in, d_scale, d_vlen*noutput_items);
+ }
+ return noutput_items;
+}
+
+
+
diff --git a/gnuradio-core/src/lib/general/gr_short_to_float.h b/gnuradio-core/src/lib/general/gr_short_to_float.h
new file mode 100644
index 000000000..362549e70
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_short_to_float.h
@@ -0,0 +1,70 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,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 INCLUDED_GR_SHORT_TO_FLOAT_H
+#define INCLUDED_GR_SHORT_TO_FLOAT_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+
+class gr_short_to_float;
+typedef boost::shared_ptr<gr_short_to_float> gr_short_to_float_sptr;
+
+GR_CORE_API gr_short_to_float_sptr
+gr_make_short_to_float (size_t vlen=1, float scale=1);
+
+/*!
+ * \brief Convert stream of short to a stream of float
+ * \ingroup converter_blk
+ *
+ * \param vlen vector length of data streams.
+ * \param scale a scalar divider to change the output signal scale.
+ */
+
+class GR_CORE_API gr_short_to_float : public gr_sync_block
+{
+ private:
+ friend GR_CORE_API gr_short_to_float_sptr
+ gr_make_short_to_float (size_t vlen, float scale);
+ gr_short_to_float (size_t vlen, float scale);
+
+ size_t d_vlen;
+ float d_scale;
+
+ public:
+ /*!
+ * Get the scalar divider value.
+ */
+ float scale() const;
+
+ /*!
+ * Set the scalar divider value.
+ */
+ void set_scale(float scale);
+
+ virtual int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+
+#endif /* INCLUDED_GR_SHORT_TO_FLOAT_H */
diff --git a/gnuradio-core/src/lib/general/gr_short_to_float.i b/gnuradio-core/src/lib/general/gr_short_to_float.i
new file mode 100644
index 000000000..e781e292c
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_short_to_float.i
@@ -0,0 +1,33 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,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,short_to_float)
+
+gr_short_to_float_sptr
+gr_make_short_to_float (size_t vlen=1, float scale=1);
+
+class gr_short_to_float : public gr_sync_block
+{
+public:
+ float scale() const;
+ void set_scale(float scale);
+};
diff --git a/gnuradio-core/src/lib/general/gr_simple_correlator.cc b/gnuradio-core/src/lib/general/gr_simple_correlator.cc
new file mode 100644
index 000000000..b9209e74f
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_simple_correlator.cc
@@ -0,0 +1,237 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_simple_correlator.h>
+#include <gr_simple_framer_sync.h>
+#include <gr_io_signature.h>
+#include <assert.h>
+#include <stdexcept>
+#include <gr_count_bits.h>
+#include <string.h>
+#include <cstdio>
+
+
+static const int THRESHOLD = 3;
+
+gr_simple_correlator_sptr
+gr_make_simple_correlator (int payload_bytesize)
+{
+ return gnuradio::get_initial_sptr(new gr_simple_correlator (payload_bytesize));
+}
+
+gr_simple_correlator::gr_simple_correlator (int payload_bytesize)
+ : gr_block ("simple_correlator",
+ gr_make_io_signature (1, 1, sizeof (float)),
+ gr_make_io_signature (1, 1, sizeof (unsigned char))),
+ d_payload_bytesize (payload_bytesize),
+ d_state (ST_LOOKING), d_osi (0),
+ d_bblen ((payload_bytesize + GRSF_PAYLOAD_OVERHEAD) * GRSF_BITS_PER_BYTE),
+ d_bitbuf (new unsigned char [d_bblen]),
+ d_pktbuf (new unsigned char [d_bblen/GRSF_BITS_PER_BYTE]),
+ d_bbi (0)
+{
+ d_avbi = 0;
+ d_accum = 0.0;
+ d_avg = 0.0;
+ for (int i = 0; i < AVG_PERIOD; i++)
+ d_avgbuf[i] = 0.0;
+
+#ifdef DEBUG_SIMPLE_CORRELATOR
+ d_debug_fp = fopen("corr.log", "w");
+#endif
+ enter_looking ();
+
+}
+
+gr_simple_correlator::~gr_simple_correlator ()
+{
+#ifdef DEBUG_SIMPLE_CORRELATOR
+ fclose(d_debug_fp);
+#endif
+ delete [] d_bitbuf;
+ delete [] d_pktbuf;
+}
+
+
+void
+gr_simple_correlator::enter_looking ()
+{
+ fflush (stdout);
+ // fprintf (stderr, ">>> enter_looking\n");
+ d_state = ST_LOOKING;
+ for (int i = 0; i < OVERSAMPLE; i++)
+ d_shift_reg[i] = 0;
+ d_osi = 0;
+
+ d_avbi = 0;
+ d_avg = d_avg * 0.5;
+ d_accum = 0;
+ for (int i = 0; i < AVG_PERIOD; i++)
+ d_avgbuf[i] = 0.0;
+}
+
+void
+gr_simple_correlator::enter_under_threshold ()
+{
+ fflush (stdout);
+ // fprintf (stderr, ">>> enter_under_threshold\n");
+ d_state = ST_UNDER_THRESHOLD;
+ d_transition_osi = d_osi;
+}
+
+void
+gr_simple_correlator::enter_locked ()
+{
+ d_state = ST_LOCKED;
+ int delta = sub_index (d_osi, d_transition_osi);
+ d_center_osi = add_index (d_transition_osi, delta/2);
+ d_center_osi = add_index (d_center_osi, 3); // FIXME
+ d_bbi = 0;
+ fflush (stdout);
+ // fprintf (stderr, ">>> enter_locked d_center_osi = %d\n", d_center_osi);
+
+ d_avg = std::max(-1.0, std::min(1.0, d_accum * (1.0/AVG_PERIOD)));
+ // fprintf(stderr, ">>> enter_locked d_avg = %g\n", d_avg);
+}
+
+static void
+packit (unsigned char *pktbuf, const unsigned char *bitbuf, int bitcount)
+{
+ for (int i = 0; i < bitcount; i += 8){
+ int t = bitbuf[i+0] & 0x1;
+ t = (t << 1) | (bitbuf[i+1] & 0x1);
+ t = (t << 1) | (bitbuf[i+2] & 0x1);
+ t = (t << 1) | (bitbuf[i+3] & 0x1);
+ t = (t << 1) | (bitbuf[i+4] & 0x1);
+ t = (t << 1) | (bitbuf[i+5] & 0x1);
+ t = (t << 1) | (bitbuf[i+6] & 0x1);
+ t = (t << 1) | (bitbuf[i+7] & 0x1);
+ *pktbuf++ = t;
+ }
+}
+
+void
+gr_simple_correlator::update_avg(float x)
+{
+ d_accum -= d_avgbuf[d_avbi];
+ d_avgbuf[d_avbi] = x;
+ d_accum += x;
+ d_avbi = (d_avbi + 1) & (AVG_PERIOD-1);
+}
+
+
+int
+gr_simple_correlator::general_work (int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const float *in = (const float *) input_items[0];
+ unsigned char *out = (unsigned char *) output_items[0];
+
+
+ int n = 0;
+ int nin = ninput_items[0];
+ int decision;
+ int hamming_dist;
+
+#ifdef DEBUG_SIMPLE_CORRELATOR
+ struct debug_data {
+ float raw_data;
+ float sampled;
+ float enter_locked;
+ } debug_data;
+#endif
+
+ while (n < nin){
+
+#ifdef DEBUG_SIMPLE_CORRELATOR
+ debug_data.raw_data = in[n];
+ debug_data.sampled = 0.0;
+ debug_data.enter_locked = 0.0;
+#endif
+
+ switch (d_state){
+
+ case ST_LOCKED:
+ if (d_osi == d_center_osi){
+
+#ifdef DEBUG_SIMPLE_CORRELATOR
+ debug_data.sampled = 1.0;
+#endif
+ decision = slice (in[n]);
+
+ d_bitbuf[d_bbi] = decision;
+ d_bbi++;
+ if (d_bbi >= d_bblen){
+ // printf ("got whole packet\n");
+ packit (d_pktbuf, d_bitbuf, d_bbi);
+ printf ("seqno %3d\n", d_pktbuf[0]);
+ memcpy (out, &d_pktbuf[GRSF_PAYLOAD_OVERHEAD], d_payload_bytesize);
+ enter_looking ();
+ consume_each (n + 1);
+ return d_payload_bytesize;
+ }
+ }
+ break;
+
+ case ST_LOOKING:
+ case ST_UNDER_THRESHOLD:
+ update_avg(in[n]);
+ decision = slice (in[n]);
+ d_shift_reg[d_osi] = (d_shift_reg[d_osi] << 1) | decision;
+
+ hamming_dist = gr_count_bits64 (d_shift_reg[d_osi] ^ GRSF_SYNC);
+ // printf ("%2d %d\n", hamming_dist, d_osi);
+
+ if (d_state == ST_LOOKING && hamming_dist <= THRESHOLD){
+ // We're seeing a good PN code, remember location
+ enter_under_threshold ();
+ }
+ else if (d_state == ST_UNDER_THRESHOLD && hamming_dist > THRESHOLD){
+ // no longer seeing good PN code, compute center of goodness
+ enter_locked ();
+#ifdef DEBUG_SIMPLE_CORRELATOR
+ debug_data.enter_locked = 1.0;
+#endif
+ }
+ break;
+
+ default:
+ assert (0);
+ }
+
+#ifdef DEBUG_SIMPLE_CORRELATOR
+ fwrite(&debug_data, sizeof (debug_data), 1, d_debug_fp);
+#endif
+
+ d_osi = add_index (d_osi, 1);
+ n++;
+ }
+
+ consume_each (n);
+ return 0;
+}
diff --git a/gnuradio-core/src/lib/general/gr_simple_correlator.h b/gnuradio-core/src/lib/general/gr_simple_correlator.h
new file mode 100644
index 000000000..37d00c125
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_simple_correlator.h
@@ -0,0 +1,111 @@
+/* -*- 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_SIMPLE_CORRELATOR_H
+#define INCLUDED_GR_SIMPLE_CORRELATOR_H
+
+#include <gr_core_api.h>
+#include <gr_block.h>
+#include <assert.h>
+
+//#define DEBUG_SIMPLE_CORRELATOR
+
+class gr_simple_correlator;
+typedef boost::shared_ptr<gr_simple_correlator> gr_simple_correlator_sptr;
+
+GR_CORE_API gr_simple_correlator_sptr gr_make_simple_correlator (int payload_bytesize);
+
+/*!
+ * \brief inverse of gr_simple_framer (more or less)
+ * \ingroup sync_blk
+ */
+class GR_CORE_API gr_simple_correlator : public gr_block
+{
+ static const int OVERSAMPLE = 8;
+ enum state_t { ST_LOOKING, ST_UNDER_THRESHOLD, ST_LOCKED };
+
+ int d_payload_bytesize;
+ state_t d_state;
+ unsigned int d_osi; // over sample index [0,OVERSAMPLE-1]
+ unsigned int d_transition_osi; // first index where Hamming dist < thresh
+ unsigned int d_center_osi; // center of bit
+ unsigned long long int d_shift_reg[OVERSAMPLE];
+ int d_bblen; // length of bitbuf
+ unsigned char *d_bitbuf; // demodulated bits
+ unsigned char *d_pktbuf; // temp packet buf
+ int d_bbi; // bitbuf index
+
+ static const int AVG_PERIOD = 512; // must be power of 2 (for freq offset correction)
+ int d_avbi;
+ float d_avgbuf[AVG_PERIOD];
+ float d_avg;
+ float d_accum;
+
+#ifdef DEBUG_SIMPLE_CORRELATOR
+ FILE *d_debug_fp; // binary log file
+#endif
+
+ friend GR_CORE_API gr_simple_correlator_sptr gr_make_simple_correlator (int payload_bytesize);
+ gr_simple_correlator (int payload_bytesize);
+
+
+ inline int slice (float x)
+ {
+ return x >= d_avg ? 1 : 0;
+ }
+
+ void update_avg(float x);
+
+ void enter_locked ();
+ void enter_under_threshold ();
+ void enter_looking ();
+
+ static int add_index (int a, int b)
+ {
+ int t = a + b;
+ if (t >= OVERSAMPLE)
+ t -= OVERSAMPLE;
+ assert (t >= 0 && t < OVERSAMPLE);
+ return t;
+ }
+
+ static int sub_index (int a, int b)
+ {
+ int t = a - b;
+ if (t < 0)
+ t += OVERSAMPLE;
+ assert (t >= 0 && t < OVERSAMPLE);
+ return t;
+ }
+
+
+ public:
+ ~gr_simple_correlator ();
+
+ int general_work (int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+
+#endif /* INCLUDED_GR_SIMPLE_CORRELATOR_H */
diff --git a/gnuradio-core/src/lib/general/gr_simple_correlator.i b/gnuradio-core/src/lib/general/gr_simple_correlator.i
new file mode 100644
index 000000000..24d133072
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_simple_correlator.i
@@ -0,0 +1,31 @@
+/* -*- 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,simple_correlator);
+
+gr_simple_correlator_sptr gr_make_simple_correlator (int payload_bytesize);
+
+class gr_simple_correlator : public gr_block
+{
+ private:
+ gr_simple_correlator (int payload_bytesize);
+};
diff --git a/gnuradio-core/src/lib/general/gr_simple_framer.cc b/gnuradio-core/src/lib/general/gr_simple_framer.cc
new file mode 100644
index 000000000..506603bb7
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_simple_framer.cc
@@ -0,0 +1,101 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_simple_framer.h>
+#include <gr_simple_framer_sync.h>
+#include <gr_io_signature.h>
+#include <assert.h>
+#include <stdexcept>
+#include <string.h>
+
+
+gr_simple_framer_sptr
+gr_make_simple_framer (int payload_bytesize)
+{
+ return gnuradio::get_initial_sptr(new gr_simple_framer (payload_bytesize));
+}
+
+gr_simple_framer::gr_simple_framer (int payload_bytesize)
+ : gr_block ("simple_framer",
+ gr_make_io_signature (1, 1, sizeof (unsigned char)),
+ gr_make_io_signature (1, 1, sizeof (unsigned char))),
+ d_seqno (0), d_payload_bytesize (payload_bytesize),
+ d_input_block_size (payload_bytesize),
+ d_output_block_size (payload_bytesize + GRSF_OVERHEAD)
+{
+ set_output_multiple (d_output_block_size);
+}
+
+void
+gr_simple_framer::forecast (int noutput_items, gr_vector_int &ninput_items_required)
+{
+ assert (noutput_items % d_output_block_size == 0);
+
+ int nblocks = noutput_items / d_output_block_size;
+ int input_required = nblocks * d_input_block_size;
+
+ unsigned ninputs = ninput_items_required.size();
+ for (unsigned int i = 0; i < ninputs; i++)
+ ninput_items_required[i] = input_required;
+}
+
+int
+gr_simple_framer::general_work (int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const unsigned char *in = (const unsigned char *) input_items[0];
+ unsigned char *out = (unsigned char *) output_items[0];
+
+ int n = 0;
+ int nblocks = 0;
+
+ memset (out, 0x55, noutput_items);
+
+ while (n < noutput_items){
+ out[0] = (GRSF_SYNC >> 56) & 0xff;
+ out[1] = (GRSF_SYNC >> 48) & 0xff;
+ out[2] = (GRSF_SYNC >> 40) & 0xff;
+ out[3] = (GRSF_SYNC >> 32) & 0xff;
+ out[4] = (GRSF_SYNC >> 24) & 0xff;
+ out[5] = (GRSF_SYNC >> 16) & 0xff;
+ out[6] = (GRSF_SYNC >> 8) & 0xff;
+ out[7] = (GRSF_SYNC >> 0) & 0xff;
+ out[8] = d_seqno++;
+
+ memcpy (&out[9], in, d_input_block_size);
+ in += d_input_block_size;
+ out += d_output_block_size;
+ n += d_output_block_size;
+ nblocks++;
+ }
+
+ assert (n == noutput_items);
+
+ consume_each (nblocks * d_input_block_size);
+ return n;
+}
diff --git a/gnuradio-core/src/lib/general/gr_simple_framer.h b/gnuradio-core/src/lib/general/gr_simple_framer.h
new file mode 100644
index 000000000..76a4b7bab
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_simple_framer.h
@@ -0,0 +1,59 @@
+/* -*- 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_SIMPLE_FRAMER_H
+#define INCLUDED_GR_SIMPLE_FRAMER_H
+
+#include <gr_core_api.h>
+#include <gr_block.h>
+
+class gr_simple_framer;
+typedef boost::shared_ptr<gr_simple_framer> gr_simple_framer_sptr;
+
+GR_CORE_API gr_simple_framer_sptr gr_make_simple_framer (int payload_bytesize);
+
+/*!
+ * \brief add sync field, seq number and command field to payload
+ * \ingroup sync_blk
+ */
+class GR_CORE_API gr_simple_framer : public gr_block
+{
+ int d_seqno;
+ int d_payload_bytesize;
+ int d_input_block_size; // bytes
+ int d_output_block_size; // bytes
+
+ friend GR_CORE_API gr_simple_framer_sptr gr_make_simple_framer (int payload_bytesize);
+ gr_simple_framer (int payload_bytesize);
+
+ 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);
+};
+
+
+#endif /* INCLUDED_GR_SIMPLE_FRAMER_H */
diff --git a/gnuradio-core/src/lib/general/gr_simple_framer.i b/gnuradio-core/src/lib/general/gr_simple_framer.i
new file mode 100644
index 000000000..c13ead87b
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_simple_framer.i
@@ -0,0 +1,31 @@
+/* -*- 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,simple_framer);
+
+gr_simple_framer_sptr gr_make_simple_framer (int payload_bytesize);
+
+class gr_simple_framer : public gr_block
+{
+ private:
+ gr_simple_framer (int payload_bytesize);
+};
diff --git a/gnuradio-core/src/lib/general/gr_simple_framer_sync.h b/gnuradio-core/src/lib/general/gr_simple_framer_sync.h
new file mode 100644
index 000000000..66173be42
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_simple_framer_sync.h
@@ -0,0 +1,51 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2005 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_SIMPLE_FRAMER_SYNC_H
+#define INCLUDED_GR_SIMPLE_FRAMER_SYNC_H
+
+/*!
+ * \brief Here are a couple of maximum length sequences (m-sequences) that were generated by the
+ * the "mseq" matlab/octave code downloaded from:
+ * <a href="http://www.mathworks.com/matlabcentral/fileexchange/990">http://www.mathworks.com/matlabcentral/fileexchange/990</a>
+ *
+ * <pre>
+ * 31-bit m-sequence:
+ * 0110100100001010111011000111110
+ * 0x690AEC76 (padded on right with a zero)
+ *
+ * 63-bit m-sequence:
+ * 101011001101110110100100111000101111001010001100001000001111110
+ * 0xACDDA4E2F28C20FC (padded on right with a zero)
+ * </pre>
+ */
+
+static const unsigned long long GRSF_SYNC = 0xacdda4e2f28c20fcULL;
+
+static const int GRSF_BITS_PER_BYTE = 8;
+static const int GRSF_SYNC_OVERHEAD = sizeof(GRSF_SYNC);
+static const int GRSF_PAYLOAD_OVERHEAD = 1; // 1 byte seqno
+static const int GRSF_TAIL_PAD = 1; // one byte trailing padding
+static const int GRSF_OVERHEAD = GRSF_SYNC_OVERHEAD + GRSF_PAYLOAD_OVERHEAD + GRSF_TAIL_PAD;
+
+
+#endif /* INCLUDED_GR_SIMPLE_FRAMER_SYNC_H */
diff --git a/gnuradio-core/src/lib/general/gr_simple_squelch_cc.cc b/gnuradio-core/src/lib/general/gr_simple_squelch_cc.cc
new file mode 100644
index 000000000..5d90a3da4
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_simple_squelch_cc.cc
@@ -0,0 +1,99 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+#include <gr_simple_squelch_cc.h>
+#include <gr_io_signature.h>
+#include <cmath>
+
+gr_simple_squelch_cc_sptr
+gr_make_simple_squelch_cc(double threshold_db, double alpha)
+{
+ return gnuradio::get_initial_sptr(new gr_simple_squelch_cc(threshold_db, alpha));
+}
+
+gr_simple_squelch_cc::gr_simple_squelch_cc (double threshold_db, double alpha)
+ : gr_sync_block ("simple_squelch_cc",
+ gr_make_io_signature(1, 1, sizeof(gr_complex)),
+ gr_make_io_signature(1, 1, sizeof(gr_complex))),
+ d_iir(alpha), d_unmuted(false)
+{
+ set_threshold (threshold_db);
+}
+
+gr_simple_squelch_cc::~gr_simple_squelch_cc()
+{
+}
+
+
+int
+gr_simple_squelch_cc::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const gr_complex *in = (const gr_complex *) input_items[0];
+ gr_complex *out = (gr_complex *) output_items[0];
+
+ for (int i = 0; i < noutput_items; i++){
+ double mag_sqrd = in[i].real()*in[i].real() + in[i].imag()*in[i].imag();
+ double f = d_iir.filter(mag_sqrd);
+ if (f >= d_threshold)
+ out[i] = in[i];
+ else
+ out[i] = 0;
+ }
+
+ d_unmuted = d_iir.prev_output() >= d_threshold;
+ return noutput_items;
+}
+
+void
+gr_simple_squelch_cc::set_threshold(double decibels)
+{
+ // convert to absolute threshold (mag squared)
+ d_threshold = std::pow(10.0, decibels/10);
+}
+
+double
+gr_simple_squelch_cc::threshold() const
+{
+ return 10 * log10(d_threshold);
+}
+
+void
+gr_simple_squelch_cc::set_alpha(double alpha)
+{
+ d_iir.set_taps(alpha);
+}
+
+std::vector<float>
+gr_simple_squelch_cc::squelch_range() const
+{
+ std::vector<float> r(3);
+ r[0] = -50.0; // min FIXME
+ r[1] = +50.0; // max FIXME
+ r[2] = (r[1] - r[0]) / 100; // step size
+
+ return r;
+}
diff --git a/gnuradio-core/src/lib/general/gr_simple_squelch_cc.h b/gnuradio-core/src/lib/general/gr_simple_squelch_cc.h
new file mode 100644
index 000000000..4bf62c7ec
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_simple_squelch_cc.h
@@ -0,0 +1,67 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005 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_SIMPLE_SQUELCH_CC_H
+#define INCLUDED_GR_SIMPLE_SQUELCH_CC_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+#include <gr_single_pole_iir.h>
+
+class gr_simple_squelch_cc;
+typedef boost::shared_ptr<gr_simple_squelch_cc> gr_simple_squelch_cc_sptr;
+
+GR_CORE_API gr_simple_squelch_cc_sptr
+gr_make_simple_squelch_cc (double threshold_db, double alpha = 0.0001);
+
+/*!
+ * \brief simple squelch block based on average signal power and threshold in dB.
+ * \ingroup level_blk
+ */
+class GR_CORE_API gr_simple_squelch_cc : public gr_sync_block
+{
+ double d_threshold;
+ gr_single_pole_iir<double,double,double> d_iir;
+ bool d_unmuted;
+
+ friend GR_CORE_API gr_simple_squelch_cc_sptr
+ gr_make_simple_squelch_cc (double threshold_db, double alpha);
+
+ gr_simple_squelch_cc (double threshold_db, double alpha);
+
+public:
+ ~gr_simple_squelch_cc ();
+
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+
+ bool unmuted () const { return d_unmuted; }
+
+ void set_alpha (double alpha);
+ void set_threshold (double decibels);
+
+ double threshold() const;
+ std::vector<float> squelch_range() const;
+
+};
+
+#endif /* INCLUDED_GR_SIMPLE_SQUELCH_CC_H */
diff --git a/gnuradio-core/src/lib/general/gr_simple_squelch_cc.i b/gnuradio-core/src/lib/general/gr_simple_squelch_cc.i
new file mode 100644
index 000000000..17b469e15
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_simple_squelch_cc.i
@@ -0,0 +1,37 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005 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,simple_squelch_cc);
+
+gr_simple_squelch_cc_sptr
+gr_make_simple_squelch_cc (double threshold_db, double alpha = 0.0001);
+
+class gr_simple_squelch_cc : public gr_sync_block
+{
+public:
+ bool unmuted () const { return d_unmuted; }
+ void set_alpha (double alpha);
+ void set_threshold (double decibels);
+
+ double threshold() const;
+ std::vector<float> squelch_range() const;
+};
diff --git a/gnuradio-core/src/lib/general/gr_skiphead.cc b/gnuradio-core/src/lib/general/gr_skiphead.cc
new file mode 100644
index 000000000..7b441bea9
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_skiphead.cc
@@ -0,0 +1,83 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <gr_skiphead.h>
+#include <gr_io_signature.h>
+#include <string.h>
+
+gr_skiphead::gr_skiphead (size_t itemsize, uint64_t nitems_to_skip)
+ : gr_block ("skiphead",
+ gr_make_io_signature(1, 1, itemsize),
+ gr_make_io_signature(1, 1, itemsize)),
+ d_nitems_to_skip(nitems_to_skip), d_nitems(0)
+{
+}
+
+gr_skiphead_sptr
+gr_make_skiphead (size_t itemsize, uint64_t nitems_to_skip)
+{
+ return gnuradio::get_initial_sptr(new gr_skiphead (itemsize, nitems_to_skip));
+}
+
+int
+gr_skiphead::general_work(int noutput_items,
+ gr_vector_int &ninput_items_,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const char *in = (const char *) input_items[0];
+ char *out = (char *) output_items[0];
+
+ int ninput_items = std::min(ninput_items_[0], noutput_items);
+ int ii = 0; // input index
+
+ while (ii < ninput_items){
+
+ uint64_t ni_total = ii + d_nitems; // total items processed so far
+ if (ni_total < d_nitems_to_skip){ // need to skip some more
+
+ int n_to_skip = (int) std::min(d_nitems_to_skip - ni_total,
+ (uint64_t)(ninput_items - ii));
+ ii += n_to_skip;
+ }
+
+ else { // nothing left to skip. copy away
+
+ int n_to_copy = ninput_items - ii;
+ if (n_to_copy > 0){
+ size_t itemsize = output_signature()->sizeof_stream_item(0);
+ memcpy(out, in + (ii*itemsize), n_to_copy*itemsize);
+ }
+
+ d_nitems += ninput_items;
+ consume_each(ninput_items);
+ return n_to_copy;
+ }
+ }
+
+ d_nitems += ninput_items;
+ consume_each(ninput_items);
+ return 0;
+}
diff --git a/gnuradio-core/src/lib/general/gr_skiphead.h b/gnuradio-core/src/lib/general/gr_skiphead.h
new file mode 100644
index 000000000..899b40f27
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_skiphead.h
@@ -0,0 +1,60 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005 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_SKIPHEAD_H
+#define INCLUDED_GR_SKIPHEAD_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+#include <stddef.h> // size_t
+
+class gr_skiphead;
+typedef boost::shared_ptr<gr_skiphead> gr_skiphead_sptr;
+
+GR_CORE_API gr_skiphead_sptr
+gr_make_skiphead (size_t itemsize, uint64_t nitems_to_skip);
+
+
+/*!
+ * \brief skips the first N items, from then on copies items to the output
+ * \ingroup slicedice_blk
+ *
+ * Useful for building test cases and sources which have metadata or junk at the start
+ */
+
+class GR_CORE_API gr_skiphead : public gr_block
+{
+ friend GR_CORE_API gr_skiphead_sptr gr_make_skiphead (size_t itemsize, uint64_t nitems_to_skip);
+ gr_skiphead (size_t itemsize, uint64_t nitems_to_skip);
+
+ uint64_t d_nitems_to_skip;
+ uint64_t d_nitems; // total items seen
+
+ public:
+
+ int general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif /* INCLUDED_GR_SKIPHEAD_H */
diff --git a/gnuradio-core/src/lib/general/gr_skiphead.i b/gnuradio-core/src/lib/general/gr_skiphead.i
new file mode 100644
index 000000000..3246db970
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_skiphead.i
@@ -0,0 +1,30 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005,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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,skiphead);
+
+gr_skiphead_sptr gr_make_skiphead (size_t itemsize, uint64_t nitems_to_skip);
+
+class gr_skiphead : public gr_block {
+ friend gr_skiphead_sptr gr_make_skiphead (size_t itemsize, uint64_t nitems_to_skip);
+ gr_skiphead (size_t itemsize, uint64_t nitems_to_skip);
+};
diff --git a/gnuradio-core/src/lib/general/gr_squelch_base_cc.cc b/gnuradio-core/src/lib/general/gr_squelch_base_cc.cc
new file mode 100644
index 000000000..b32a0a695
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_squelch_base_cc.cc
@@ -0,0 +1,93 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_squelch_base_cc.h>
+#include <gr_io_signature.h>
+
+gr_squelch_base_cc::gr_squelch_base_cc(const char *name, int ramp, bool gate) :
+ gr_block(name,
+ gr_make_io_signature(1, 1, sizeof(gr_complex)),
+ gr_make_io_signature(1, 1, sizeof(gr_complex)))
+{
+ set_ramp(ramp);
+ set_gate(gate);
+ d_state = ST_MUTED;
+ d_envelope = d_ramp ? 0.0 : 1.0;
+ d_ramped = 0;
+}
+
+int gr_squelch_base_cc::general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const gr_complex *in = (const gr_complex *) input_items[0];
+ gr_complex *out = (gr_complex *) output_items[0];
+
+ int j = 0;
+
+ for (int i = 0; i < noutput_items; i++) {
+ update_state(in[i]);
+
+ // Adjust envelope based on current state
+ switch(d_state) {
+ case ST_MUTED:
+ if (!mute())
+ d_state = d_ramp ? ST_ATTACK : ST_UNMUTED; // If not ramping, go straight to unmuted
+ break;
+
+ case ST_UNMUTED:
+ if (mute())
+ d_state = d_ramp ? ST_DECAY : ST_MUTED; // If not ramping, go straight to muted
+ break;
+
+ case ST_ATTACK:
+ d_envelope = 0.5-std::cos(M_PI*(++d_ramped)/d_ramp)/2.0; // FIXME: precalculate window for speed
+ if (d_ramped >= d_ramp) { // use >= in case d_ramp is set to lower value elsewhere
+ d_state = ST_UNMUTED;
+ d_envelope = 1.0;
+ }
+ break;
+
+ case ST_DECAY:
+ d_envelope = 0.5-std::cos(M_PI*(--d_ramped)/d_ramp)/2.0; // FIXME: precalculate window for speed
+ if (d_ramped == 0.0)
+ d_state = ST_MUTED;
+ break;
+ };
+
+ // If unmuted, copy input times envelope to output
+ // Otherwise, if not gating, copy zero to output
+ if (d_state != ST_MUTED)
+ out[j++] = in[i]*gr_complex(d_envelope, 0.0);
+ else
+ if (!d_gate)
+ out[j++] = 0.0;
+ }
+
+ consume_each(noutput_items); // Use all the inputs
+ return j; // But only report outputs copied
+}
diff --git a/gnuradio-core/src/lib/general/gr_squelch_base_cc.h b/gnuradio-core/src/lib/general/gr_squelch_base_cc.h
new file mode 100644
index 000000000..f1814473f
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_squelch_base_cc.h
@@ -0,0 +1,59 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_GR_SQUELCH_BASE_CC_H
+#define INCLUDED_GR_SQUELCH_BASE_CC_H
+
+#include <gr_core_api.h>
+#include <gr_block.h>
+
+class GR_CORE_API gr_squelch_base_cc : public gr_block
+{
+private:
+ int d_ramp;
+ int d_ramped;
+ bool d_gate;
+ double d_envelope;
+ enum { ST_MUTED, ST_ATTACK, ST_UNMUTED, ST_DECAY } d_state;
+
+protected:
+ virtual void update_state(const gr_complex &sample) {};
+ virtual bool mute() const { return false; };
+
+public:
+ gr_squelch_base_cc(const char *name, int ramp, bool gate);
+
+ int ramp() const { return d_ramp; }
+ void set_ramp(int ramp) { d_ramp = ramp; }
+ bool gate() const { return d_gate; }
+ void set_gate(bool gate) { d_gate = gate; }
+ bool unmuted() const { return (d_state == ST_UNMUTED || d_state == ST_ATTACK); }
+
+ virtual std::vector<float> squelch_range() const = 0;
+
+ int general_work (int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif /* INCLUDED_GR_SQUELCH_BASE_CC_H */
diff --git a/gnuradio-core/src/lib/general/gr_squelch_base_cc.i b/gnuradio-core/src/lib/general/gr_squelch_base_cc.i
new file mode 100644
index 000000000..6501b7d2b
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_squelch_base_cc.i
@@ -0,0 +1,40 @@
+/* -*- 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.
+ */
+
+#include <gr_block.h>
+
+class gr_squelch_base_cc : public gr_block
+{
+private:
+ enum { ST_MUTED, ST_ATTACK, ST_UNMUTED, ST_DECAY } d_state;
+
+public:
+ gr_squelch_base_cc(const char *name, int ramp, bool gate);
+
+ int ramp() const { return d_ramp; }
+ void set_ramp(int ramp) { d_ramp = ramp; }
+ bool gate() const { return d_gate; }
+ void set_gate(bool gate) { d_gate = gate; }
+ bool unmuted() const { return (d_state == ST_UNMUTED || d_state == ST_ATTACK); }
+
+ virtual std::vector<float> squelch_range() const = 0;
+};
diff --git a/gnuradio-core/src/lib/general/gr_squelch_base_ff.cc b/gnuradio-core/src/lib/general/gr_squelch_base_ff.cc
new file mode 100644
index 000000000..4bf8cff97
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_squelch_base_ff.cc
@@ -0,0 +1,93 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_squelch_base_ff.h>
+#include <gr_io_signature.h>
+
+gr_squelch_base_ff::gr_squelch_base_ff(const char *name, int ramp, bool gate) :
+ gr_block(name,
+ gr_make_io_signature(1, 1, sizeof(float)),
+ gr_make_io_signature(1, 1, sizeof(float)))
+{
+ set_ramp(ramp);
+ set_gate(gate);
+ d_state = ST_MUTED;
+ d_envelope = d_ramp ? 0.0 : 1.0;
+ d_ramped = 0;
+}
+
+int gr_squelch_base_ff::general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const float *in = (const float *) input_items[0];
+ float *out = (float *) output_items[0];
+
+ int j = 0;
+
+ for (int i = 0; i < noutput_items; i++) {
+ update_state(in[i]);
+
+ // Adjust envelope based on current state
+ switch(d_state) {
+ case ST_MUTED:
+ if (!mute())
+ d_state = d_ramp ? ST_ATTACK : ST_UNMUTED; // If not ramping, go straight to unmuted
+ break;
+
+ case ST_UNMUTED:
+ if (mute())
+ d_state = d_ramp ? ST_DECAY : ST_MUTED; // If not ramping, go straight to muted
+ break;
+
+ case ST_ATTACK:
+ d_envelope = 0.5-std::cos(M_PI*(++d_ramped)/d_ramp)/2.0; // FIXME: precalculate window for speed
+ if (d_ramped >= d_ramp) { // use >= in case d_ramp is set to lower value elsewhere
+ d_state = ST_UNMUTED;
+ d_envelope = 1.0;
+ }
+ break;
+
+ case ST_DECAY:
+ d_envelope = 0.5-std::cos(M_PI*(--d_ramped)/d_ramp)/2.0; // FIXME: precalculate window for speed
+ if (d_ramped == 0.0)
+ d_state = ST_MUTED;
+ break;
+ };
+
+ // If unmuted, copy input times envelope to output
+ // Otherwise, if not gating, copy zero to output
+ if (d_state != ST_MUTED)
+ out[j++] = in[i]*d_envelope;
+ else
+ if (!d_gate)
+ out[j++] = 0.0;
+ }
+
+ consume_each(noutput_items); // Use all the inputs
+ return j; // But only report outputs copied
+}
diff --git a/gnuradio-core/src/lib/general/gr_squelch_base_ff.h b/gnuradio-core/src/lib/general/gr_squelch_base_ff.h
new file mode 100644
index 000000000..eb52635b4
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_squelch_base_ff.h
@@ -0,0 +1,59 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_GR_SQUELCH_BASE_FF_H
+#define INCLUDED_GR_SQUELCH_BASE_FF_H
+
+#include <gr_core_api.h>
+#include <gr_block.h>
+
+class GR_CORE_API gr_squelch_base_ff : public gr_block
+{
+private:
+ int d_ramp;
+ int d_ramped;
+ bool d_gate;
+ double d_envelope;
+ enum { ST_MUTED, ST_ATTACK, ST_UNMUTED, ST_DECAY } d_state;
+
+protected:
+ virtual void update_state(const float &sample) {};
+ virtual bool mute() const { return false; };
+
+public:
+ gr_squelch_base_ff(const char *name, int ramp, bool gate);
+
+ int ramp() const { return d_ramp; }
+ void set_ramp(int ramp) { d_ramp = ramp; }
+ bool gate() const { return d_gate; }
+ void set_gate(bool gate) { d_gate = gate; }
+ bool unmuted() const { return (d_state == ST_UNMUTED || d_state == ST_ATTACK); }
+
+ virtual std::vector<float> squelch_range() const = 0;
+
+ int general_work (int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif /* INCLUDED_GR_SQUELCH_BASE_FF_H */
diff --git a/gnuradio-core/src/lib/general/gr_squelch_base_ff.i b/gnuradio-core/src/lib/general/gr_squelch_base_ff.i
new file mode 100644
index 000000000..a4e5c7115
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_squelch_base_ff.i
@@ -0,0 +1,40 @@
+/* -*- 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.
+ */
+
+#include <gr_block.h>
+
+class gr_squelch_base_ff : public gr_block
+{
+private:
+ enum { ST_MUTED, ST_ATTACK, ST_UNMUTED, ST_DECAY } d_state;
+
+public:
+ gr_squelch_base_ff(const char *name, int ramp, bool gate);
+
+ int ramp() const { return d_ramp; }
+ void set_ramp(int ramp) { d_ramp = ramp; }
+ bool gate() const { return d_gate; }
+ void set_gate(bool gate) { d_gate = gate; }
+ bool unmuted() const { return (d_state == ST_UNMUTED || d_state == ST_ATTACK); }
+
+ virtual std::vector<float> squelch_range() const = 0;
+};
diff --git a/gnuradio-core/src/lib/general/gr_stream_mux.cc b/gnuradio-core/src/lib/general/gr_stream_mux.cc
new file mode 100644
index 000000000..978d960b2
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_stream_mux.cc
@@ -0,0 +1,124 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_stream_mux.h>
+#include <gr_io_signature.h>
+#include <string.h>
+#include <cstdio>
+
+#define VERBOSE 0
+
+gr_stream_mux_sptr
+gr_make_stream_mux (size_t itemsize, const std::vector<int> &lengths)
+{
+ return gnuradio::get_initial_sptr(new gr_stream_mux (itemsize, lengths));
+}
+
+gr_stream_mux::gr_stream_mux (size_t itemsize, const std::vector<int> &lengths)
+ : gr_block ("stream_mux",
+ gr_make_io_signature (1, -1, itemsize),
+ gr_make_io_signature (1, 1, itemsize)),
+ d_itemsize(itemsize),
+ d_stream(0),
+ d_residual(0),
+ d_lengths(lengths)
+{
+ if(d_lengths[d_stream] == 0) {
+ increment_stream();
+ }
+ d_residual = d_lengths[d_stream];
+}
+
+gr_stream_mux::~gr_stream_mux(void)
+{
+}
+
+void
+gr_stream_mux::forecast (int noutput_items, gr_vector_int &ninput_items_required)
+{
+ unsigned ninputs = ninput_items_required.size ();
+ for (unsigned i = 0; i < ninputs; i++)
+ ninput_items_required[i] = (d_lengths[i] == 0 ? 0 : 1);
+}
+
+void gr_stream_mux::increment_stream()
+{
+ do {
+ d_stream = (d_stream+1) % d_lengths.size();
+ } while(d_lengths[d_stream] == 0);
+
+ d_residual = d_lengths[d_stream];
+}
+
+int
+gr_stream_mux::general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ char *out = (char *) output_items[0];
+ const char *in;
+ int out_index = 0;
+ std::vector<int> input_index(d_lengths.size(), 0);
+
+ if(VERBOSE) {
+ printf("mux: nouput_items: %d d_stream: %d\n", noutput_items, d_stream);
+ for(size_t i = 0; i < d_lengths.size(); i++)
+ printf("\tninput_items[%zu]: %d\n", i, ninput_items[i]);
+ }
+
+ while (1) {
+ int r = std::min(noutput_items - out_index,
+ std::min(d_residual,
+ ninput_items[d_stream] - input_index[d_stream]));
+ if(VERBOSE) {
+ printf("mux: r=%d\n", r);
+ printf("\tnoutput_items - out_index: %d\n",
+ noutput_items - out_index);
+ printf("\td_residual: %d\n",
+ d_residual);
+ printf("\tninput_items[d_stream] - input_index[d_stream]: %d\n",
+ ninput_items[d_stream] - input_index[d_stream]);
+ }
+
+ if(r <= 0) {
+ return out_index;
+ }
+
+ in = (const char *) input_items[d_stream] + input_index[d_stream]*d_itemsize;
+
+ memcpy(&out[out_index*d_itemsize], in, r*d_itemsize);
+ out_index += r;
+ input_index[d_stream] += r;
+ d_residual -= r;
+
+ consume(d_stream, r);
+
+ if(d_residual == 0) {
+ increment_stream();
+ }
+ }
+}
diff --git a/gnuradio-core/src/lib/general/gr_stream_mux.h b/gnuradio-core/src/lib/general/gr_stream_mux.h
new file mode 100644
index 000000000..742bf082d
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_stream_mux.h
@@ -0,0 +1,93 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_GR_STREAM_MUX_H
+#define INCLUDED_GR_STREAM_MUX_H
+
+
+#include <gr_core_api.h>
+#include <gr_block.h>
+#include <vector>
+
+/*!
+ * \brief Creates a stream muxing block to multiplex many streams into
+ * one with a specified format.
+ * \ingroup converter_blk
+ *
+ * \param itemsize the item size of the stream
+ * \param length a vector (list/tuple) specifying the number of
+ * items from each stream the mux together.
+ * Warning: this requires that at least as many items
+ * per stream are available or the system will wait
+ * indefinitely for the items.
+ *
+ */
+class gr_stream_mux;
+typedef boost::shared_ptr<gr_stream_mux> gr_stream_mux_sptr;
+
+
+
+GR_CORE_API gr_stream_mux_sptr
+gr_make_stream_mux (size_t itemsize, const std::vector<int> &lengths);
+
+
+/*!
+ * \brief Stream muxing block to multiplex many streams into
+ * one with a specified format.
+ *
+ * Muxes N streams together producing an output stream that
+ * contains N0 items from the first stream, N1 items from the second,
+ * etc. and repeats:
+ *
+ * [N0, N1, N2, ..., Nm, N0, N1, ...]
+ */
+
+class GR_CORE_API gr_stream_mux : public gr_block
+{
+ friend GR_CORE_API gr_stream_mux_sptr
+ gr_make_stream_mux (size_t itemsize, const std::vector<int> &lengths);
+
+ protected:
+ gr_stream_mux (size_t itemsize, const std::vector<int> &lengths);
+
+ private:
+ size_t d_itemsize;
+ unsigned int d_stream; // index of currently selected stream
+ int d_residual; // number if items left to put into current stream
+ gr_vector_int d_lengths; // number if items to pack per stream
+
+ void increment_stream();
+
+ public:
+ ~gr_stream_mux(void);
+
+ 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);
+
+};
+
+
+#endif
diff --git a/gnuradio-core/src/lib/general/gr_stream_mux.i b/gnuradio-core/src/lib/general/gr_stream_mux.i
new file mode 100644
index 000000000..7cc116a23
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_stream_mux.i
@@ -0,0 +1,42 @@
+/* -*- 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.
+ */
+
+#include <vector>
+
+GR_SWIG_BLOCK_MAGIC(gr,stream_mux)
+
+gr_stream_mux_sptr
+gr_make_stream_mux (size_t itemsize,
+ const std::vector<int> &lengths);
+
+class gr_stream_mux : public gr_block
+{
+ protected:
+ gr_make_stream_mux (size_t itemsize,
+ const std::vector<int> &lengths);
+
+ public:
+ int general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
diff --git a/gnuradio-core/src/lib/general/gr_stream_to_streams.cc b/gnuradio-core/src/lib/general/gr_stream_to_streams.cc
new file mode 100644
index 000000000..de72adb1d
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_stream_to_streams.cc
@@ -0,0 +1,66 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_stream_to_streams.h>
+#include <gr_io_signature.h>
+#include <string.h>
+
+gr_stream_to_streams_sptr
+gr_make_stream_to_streams (size_t item_size, size_t nstreams)
+{
+ return gnuradio::get_initial_sptr(new gr_stream_to_streams (item_size, nstreams));
+}
+
+gr_stream_to_streams::gr_stream_to_streams (size_t item_size, size_t nstreams)
+ : gr_sync_decimator ("stream_to_streams",
+ gr_make_io_signature (1, 1, item_size),
+ gr_make_io_signature (nstreams,
+ nstreams, item_size),
+ nstreams)
+{
+}
+
+int
+gr_stream_to_streams::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ size_t item_size = output_signature()->sizeof_stream_item (0);
+
+ const char *in = (const char *) input_items[0];
+ char **outv = (char **) &output_items[0];
+ int nstreams = output_items.size();
+
+ for (int i = 0; i < noutput_items; i++){
+ for (int j = 0; j < nstreams; j++){
+ memcpy(outv[j], in, item_size);
+ outv[j] += item_size;
+ in += item_size;
+ }
+ }
+
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/general/gr_stream_to_streams.h b/gnuradio-core/src/lib/general/gr_stream_to_streams.h
new file mode 100644
index 000000000..117f57bf5
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_stream_to_streams.h
@@ -0,0 +1,56 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005 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_STREAM_TO_STREAMS_H
+#define INCLUDED_GR_STREAM_TO_STREAMS_H
+
+#include <gr_core_api.h>
+#include <gr_sync_decimator.h>
+
+class gr_stream_to_streams;
+typedef boost::shared_ptr<gr_stream_to_streams> gr_stream_to_streams_sptr;
+
+GR_CORE_API gr_stream_to_streams_sptr
+gr_make_stream_to_streams (size_t item_size, size_t nstreams);
+
+
+/*!
+ * \brief convert a stream of items into a N streams of items
+ * \ingroup slicedice_blk
+ *
+ * Converts a stream of N items into N streams of 1 item.
+ * Repeat ad infinitum.
+ */
+class GR_CORE_API gr_stream_to_streams : public gr_sync_decimator
+{
+ friend GR_CORE_API gr_stream_to_streams_sptr
+ gr_make_stream_to_streams (size_t item_size, size_t nstreams);
+
+ protected:
+ gr_stream_to_streams (size_t item_size, size_t nstreams);
+
+ public:
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif /* INCLUDED_GR_STREAM_TO_STREAMS_H */
diff --git a/gnuradio-core/src/lib/general/gr_stream_to_streams.i b/gnuradio-core/src/lib/general/gr_stream_to_streams.i
new file mode 100644
index 000000000..4d324372e
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_stream_to_streams.i
@@ -0,0 +1,34 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2005 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,stream_to_streams)
+
+gr_stream_to_streams_sptr
+gr_make_stream_to_streams (size_t itemsize, size_t nstreams);
+
+class gr_stream_to_streams : public gr_sync_decimator
+{
+ protected:
+ gr_stream_to_streams (size_t itemsize, size_t nstreams);
+
+ public:
+};
diff --git a/gnuradio-core/src/lib/general/gr_stream_to_vector.cc b/gnuradio-core/src/lib/general/gr_stream_to_vector.cc
new file mode 100644
index 000000000..d38cdd434
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_stream_to_vector.cc
@@ -0,0 +1,58 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2005,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_stream_to_vector.h>
+#include <gr_io_signature.h>
+#include <string.h>
+
+gr_stream_to_vector_sptr
+gr_make_stream_to_vector (size_t item_size, size_t nitems_per_block)
+{
+ return gnuradio::get_initial_sptr(new gr_stream_to_vector (item_size, nitems_per_block));
+}
+
+gr_stream_to_vector::gr_stream_to_vector (size_t item_size, size_t nitems_per_block)
+ : gr_sync_decimator ("stream_to_vector",
+ gr_make_io_signature (1, 1, item_size),
+ gr_make_io_signature (1, 1, item_size * nitems_per_block),
+ nitems_per_block)
+{
+}
+
+int
+gr_stream_to_vector::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ size_t block_size = output_signature()->sizeof_stream_item (0);
+
+ const char *in = (const char *) input_items[0];
+ char *out = (char *) output_items[0];
+
+ memcpy (out, in, noutput_items * block_size);
+
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/general/gr_stream_to_vector.h b/gnuradio-core/src/lib/general/gr_stream_to_vector.h
new file mode 100644
index 000000000..362349965
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_stream_to_vector.h
@@ -0,0 +1,55 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_GR_STREAM_TO_VECTOR_H
+#define INCLUDED_GR_STREAM_TO_VECTOR_H
+
+#include <gr_core_api.h>
+#include <gr_sync_decimator.h>
+
+class gr_stream_to_vector;
+typedef boost::shared_ptr<gr_stream_to_vector> gr_stream_to_vector_sptr;
+
+GR_CORE_API gr_stream_to_vector_sptr
+gr_make_stream_to_vector (size_t item_size, size_t nitems_per_block);
+
+
+/*!
+ * \brief convert a stream of items into a stream of blocks containing nitems_per_block
+ * \ingroup slicedice_blk
+ */
+class GR_CORE_API gr_stream_to_vector : public gr_sync_decimator
+{
+ friend GR_CORE_API gr_stream_to_vector_sptr
+ gr_make_stream_to_vector (size_t item_size, size_t nitems_per_block);
+
+ protected:
+ gr_stream_to_vector (size_t item_size, size_t nitems_per_block);
+
+ public:
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+
+#endif /* INCLUDED_GR_STREAM_TO_VECTOR_H */
diff --git a/gnuradio-core/src/lib/general/gr_stream_to_vector.i b/gnuradio-core/src/lib/general/gr_stream_to_vector.i
new file mode 100644
index 000000000..ef867012a
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_stream_to_vector.i
@@ -0,0 +1,34 @@
+/* -*- 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,stream_to_vector)
+
+gr_stream_to_vector_sptr
+gr_make_stream_to_vector (size_t itemsize, size_t nitems_per_block);
+
+class gr_stream_to_vector : public gr_sync_decimator
+{
+ protected:
+ gr_stream_to_vector (size_t itemsize, size_t nitems_per_block);
+
+ public:
+};
diff --git a/gnuradio-core/src/lib/general/gr_streams_to_stream.cc b/gnuradio-core/src/lib/general/gr_streams_to_stream.cc
new file mode 100644
index 000000000..8bce74722
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_streams_to_stream.cc
@@ -0,0 +1,68 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_streams_to_stream.h>
+#include <gr_io_signature.h>
+#include <string.h>
+
+gr_streams_to_stream_sptr
+gr_make_streams_to_stream (size_t item_size, size_t nstreams)
+{
+ return gnuradio::get_initial_sptr(new gr_streams_to_stream (item_size, nstreams));
+}
+
+gr_streams_to_stream::gr_streams_to_stream (size_t item_size, size_t nstreams)
+ : gr_sync_interpolator ("streams_to_stream",
+ gr_make_io_signature (nstreams, nstreams, item_size),
+ gr_make_io_signature (1, 1, item_size),
+ nstreams)
+{
+}
+
+int
+gr_streams_to_stream::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ size_t item_size = output_signature()->sizeof_stream_item (0);
+
+ const char **inv = (const char **) &input_items[0];
+ char *out = (char *) output_items[0];
+ int nstreams = input_items.size();
+
+ assert (noutput_items % nstreams == 0);
+ int ni = noutput_items / nstreams;
+
+ for (int i = 0; i < ni; i++){
+ for (int j = 0; j < nstreams; j++){
+ memcpy(out, inv[j], item_size);
+ out += item_size;
+ inv[j] += item_size;
+ }
+ }
+
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/general/gr_streams_to_stream.h b/gnuradio-core/src/lib/general/gr_streams_to_stream.h
new file mode 100644
index 000000000..f63683767
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_streams_to_stream.h
@@ -0,0 +1,56 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005 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_STREAMS_TO_STREAM_H
+#define INCLUDED_GR_STREAMS_TO_STREAM_H
+
+#include <gr_core_api.h>
+#include <gr_sync_interpolator.h>
+
+class gr_streams_to_stream;
+typedef boost::shared_ptr<gr_streams_to_stream> gr_streams_to_stream_sptr;
+
+GR_CORE_API gr_streams_to_stream_sptr
+gr_make_streams_to_stream (size_t item_size, size_t nstreams);
+
+
+/*!
+ * \brief Convert N streams of 1 item into a 1 stream of N items
+ * \ingroup slicedice_blk
+ *
+ * Convert N streams of 1 item into 1 stream of N items.
+ * Repeat ad infinitum.
+ */
+class GR_CORE_API gr_streams_to_stream : public gr_sync_interpolator
+{
+ friend GR_CORE_API gr_streams_to_stream_sptr
+ gr_make_streams_to_stream (size_t item_size, size_t nstreams);
+
+ protected:
+ gr_streams_to_stream (size_t item_size, size_t nstreams);
+
+ public:
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif /* INCLUDED_GR_STREAMS_TO_STREAM_H */
diff --git a/gnuradio-core/src/lib/general/gr_streams_to_stream.i b/gnuradio-core/src/lib/general/gr_streams_to_stream.i
new file mode 100644
index 000000000..a09ded071
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_streams_to_stream.i
@@ -0,0 +1,34 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2005 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,streams_to_stream)
+
+gr_streams_to_stream_sptr
+gr_make_streams_to_stream (size_t itemsize, size_t nstreams);
+
+class gr_streams_to_stream : public gr_sync_interpolator
+{
+ protected:
+ gr_streams_to_stream (size_t itemsize, size_t nstreams);
+
+ public:
+};
diff --git a/gnuradio-core/src/lib/general/gr_streams_to_vector.cc b/gnuradio-core/src/lib/general/gr_streams_to_vector.cc
new file mode 100644
index 000000000..cf862ca95
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_streams_to_vector.cc
@@ -0,0 +1,64 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2005,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_streams_to_vector.h>
+#include <gr_io_signature.h>
+#include <string.h>
+
+gr_streams_to_vector_sptr
+gr_make_streams_to_vector (size_t item_size, size_t nstreams)
+{
+ return gnuradio::get_initial_sptr(new gr_streams_to_vector (item_size, nstreams));
+}
+
+gr_streams_to_vector::gr_streams_to_vector (size_t item_size, size_t nstreams)
+ : gr_sync_block ("streams_to_vector",
+ gr_make_io_signature (nstreams, nstreams, item_size),
+ gr_make_io_signature (1, 1, nstreams * item_size))
+{
+}
+
+int
+gr_streams_to_vector::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ size_t item_size = input_signature()->sizeof_stream_item(0);
+ int nstreams = input_items.size();
+
+ const char **inv = (const char **) &input_items[0];
+ char *out = (char *) output_items[0];
+
+ for (int i = 0; i < noutput_items; i++){
+ for (int j = 0; j < nstreams; j++){
+ memcpy(out, inv[j], item_size);
+ inv[j] += item_size;
+ out += item_size;
+ }
+ }
+
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/general/gr_streams_to_vector.h b/gnuradio-core/src/lib/general/gr_streams_to_vector.h
new file mode 100644
index 000000000..1df289099
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_streams_to_vector.h
@@ -0,0 +1,54 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2005 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_STREAMS_TO_VECTOR_H
+#define INCLUDED_GR_STREAMS_TO_VECTOR_H
+
+#include <gr_core_api.h>
+#include <gr_sync_interpolator.h>
+
+class gr_streams_to_vector;
+typedef boost::shared_ptr<gr_streams_to_vector> gr_streams_to_vector_sptr;
+
+GR_CORE_API gr_streams_to_vector_sptr
+gr_make_streams_to_vector (size_t item_size, size_t nstreams);
+
+
+/*!
+ * \brief convert N streams of items to 1 stream of vector length N
+ * \ingroup slicedice_blk
+ */
+class GR_CORE_API gr_streams_to_vector : public gr_sync_block
+{
+ friend GR_CORE_API gr_streams_to_vector_sptr
+ gr_make_streams_to_vector (size_t item_size, size_t nstreams);
+
+ protected:
+ gr_streams_to_vector (size_t item_size, size_t nstreams);
+
+ public:
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif /* INCLUDED_GR_STREAMS_TO_VECTOR_H */
diff --git a/gnuradio-core/src/lib/general/gr_streams_to_vector.i b/gnuradio-core/src/lib/general/gr_streams_to_vector.i
new file mode 100644
index 000000000..4d5eca45e
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_streams_to_vector.i
@@ -0,0 +1,34 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2005 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,streams_to_vector)
+
+gr_streams_to_vector_sptr
+gr_make_streams_to_vector (size_t itemsize, size_t nstreams);
+
+class gr_streams_to_vector : public gr_sync_block
+{
+ protected:
+ gr_streams_to_vector (size_t itemsize, size_t nstreams);
+
+ public:
+};
diff --git a/gnuradio-core/src/lib/general/gr_stretch_ff.cc b/gnuradio-core/src/lib/general/gr_stretch_ff.cc
new file mode 100644
index 000000000..e89eadf8b
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_stretch_ff.cc
@@ -0,0 +1,74 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_stretch_ff.h>
+#include <gr_io_signature.h>
+
+gr_stretch_ff_sptr
+gr_make_stretch_ff(float lo, size_t vlen)
+{
+ return gnuradio::get_initial_sptr(new gr_stretch_ff(lo, vlen));
+}
+
+gr_stretch_ff::gr_stretch_ff(float lo, size_t vlen)
+ : gr_sync_block("stretch_ff",
+ gr_make_io_signature(1, 1, vlen * sizeof(float)),
+ gr_make_io_signature(1, 1, vlen * sizeof(float))),
+ d_lo(lo), d_vlen(vlen)
+{
+}
+
+int
+gr_stretch_ff::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const float *in = (const float *) input_items[0];
+ float *out = (float *) output_items[0];
+
+ for (int count = 0; count < noutput_items; count++) {
+ float vmax = in[0] - d_lo;
+
+ for (unsigned int i = 1; i < d_vlen; i++) {
+ float vtmp = in[i] - d_lo;
+ if (vtmp > vmax)
+ vmax = vtmp;
+ }
+
+ if (vmax != 0.0)
+ for (unsigned int i = 0; i < d_vlen; i++)
+ out[i] = d_lo * (1.0 - (in[i] - d_lo) / vmax);
+ else
+ for (unsigned int i = 0; i < d_vlen; i++)
+ out[i] = in[i];
+
+ in += d_vlen;
+ out += d_vlen;
+ }
+
+ return noutput_items;
+}
+
diff --git a/gnuradio-core/src/lib/general/gr_stretch_ff.h b/gnuradio-core/src/lib/general/gr_stretch_ff.h
new file mode 100644
index 000000000..f592c94a7
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_stretch_ff.h
@@ -0,0 +1,60 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_GR_STRETCH_FF_H_
+# define INCLUDED_GR_STRETCH_FF_H_
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+
+/*!
+ * \brief adjust y-range of an input vector by mapping to range
+ * (max-of-input, stipulated-min). Primarily for spectral signature
+ * matching by normalizing spectrum dynamic ranges.
+ * \ingroup misc_blk
+ */
+
+
+class gr_stretch_ff;
+typedef boost::shared_ptr<gr_stretch_ff> gr_stretch_ff_sptr;
+
+GR_CORE_API gr_stretch_ff_sptr gr_make_stretch_ff(float lo, size_t vlen);
+
+class GR_CORE_API gr_stretch_ff : public gr_sync_block
+{
+ friend GR_CORE_API gr_stretch_ff_sptr gr_make_stretch_ff(float lo, size_t vlen);
+
+ float d_lo; // the constant
+ size_t d_vlen;
+ gr_stretch_ff(float lo, size_t vlen);
+
+ public:
+ float lo() const { return d_lo; }
+ void set_lo(float lo) { d_lo = lo; }
+ size_t vlen() const { return d_vlen; }
+
+ 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/general/gr_stretch_ff.i b/gnuradio-core/src/lib/general/gr_stretch_ff.i
new file mode 100644
index 000000000..81366655e
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_stretch_ff.i
@@ -0,0 +1,31 @@
+/* -*- 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 this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,stretch_ff);
+
+gr_stretch_ff_sptr gr_make_stretch_ff(float lo, size_t vlen);
+
+class gr_stretch_ff : public gr_sync_block
+{
+private:
+ gr_stretch_ff(float lo, size_t vlen);
+};
+
diff --git a/gnuradio-core/src/lib/general/gr_tag_debug.cc b/gnuradio-core/src/lib/general/gr_tag_debug.cc
new file mode 100644
index 000000000..ecf1b65e1
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_tag_debug.cc
@@ -0,0 +1,104 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_tag_debug.h>
+#include <gr_io_signature.h>
+#include <iostream>
+#include <iomanip>
+
+gr_tag_debug_sptr
+gr_make_tag_debug(size_t sizeof_stream_item, const std::string &name)
+{
+ return gnuradio::get_initial_sptr
+ (new gr_tag_debug(sizeof_stream_item, name));
+}
+
+gr_tag_debug::gr_tag_debug(size_t sizeof_stream_item, const std::string &name)
+ : gr_sync_block("tag_debug",
+ gr_make_io_signature(1, -1, sizeof_stream_item),
+ gr_make_io_signature(0, 0, 0)),
+ d_name(name), d_display(true)
+{
+}
+
+std::vector<gr_tag_t>
+gr_tag_debug::current_tags()
+{
+ gruel::scoped_lock l(d_mutex);
+ return d_tags;
+}
+
+void
+gr_tag_debug::set_display(bool d)
+{
+ gruel::scoped_lock l(d_mutex);
+ d_display = d;
+}
+
+int
+gr_tag_debug::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ gruel::scoped_lock l(d_mutex);
+
+ std::stringstream sout;
+ if(d_display) {
+ sout << std::endl
+ << "----------------------------------------------------------------------";
+ sout << std::endl << "Tag Debug: " << d_name << std::endl;
+ }
+
+ uint64_t abs_N, end_N;
+ for(size_t i = 0; i < input_items.size(); i++) {
+ abs_N = nitems_read(i);
+ end_N = abs_N + (uint64_t)(noutput_items);
+
+ d_tags.clear();
+ get_tags_in_range(d_tags, i, abs_N, end_N);
+
+ if(d_display) {
+ sout << "Input Stream: " << std::setw(2) << std::setfill('0') << i << std::setfill(' ') << std::endl;
+ for(d_tags_itr = d_tags.begin(); d_tags_itr != d_tags.end(); d_tags_itr++) {
+ sout << std::setw(10) << "Offset: " << d_tags_itr->offset
+ << std::setw(10) << "Source: " << (pmt::pmt_is_symbol(d_tags_itr->srcid) ? pmt::pmt_symbol_to_string(d_tags_itr->srcid) : "n/a")
+ << std::setw(10) << "Key: " << pmt::pmt_symbol_to_string(d_tags_itr->key)
+ << std::setw(10) << "Value: ";
+ sout << d_tags_itr->value << std::endl;
+ }
+ }
+ }
+
+ if(d_display) {
+ sout << "----------------------------------------------------------------------";
+ sout << std::endl;
+
+ if(d_tags.size() > 0)
+ std::cout << sout.str();
+ }
+
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/general/gr_tag_debug.h b/gnuradio-core/src/lib/general/gr_tag_debug.h
new file mode 100644
index 000000000..57578884a
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_tag_debug.h
@@ -0,0 +1,85 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_GR_TAG_DEBUG_H
+#define INCLUDED_GR_TAG_DEBUG_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+#include <gruel/thread.h>
+#include <stddef.h>
+
+class gr_tag_debug;
+typedef boost::shared_ptr<gr_tag_debug> gr_tag_debug_sptr;
+
+GR_CORE_API gr_tag_debug_sptr
+gr_make_tag_debug(size_t sizeof_stream_item, const std::string &name);
+
+/*!
+ * \brief Bit bucket that prints out any tag received.
+ * \ingroup sink_blk
+ *
+ * This block collects all tags sent to it on all input ports and
+ * displays them to stdout in a formatted way. The \p name parameter
+ * is used to identify which debug sink generated the tag, so when
+ * connecting a block to this debug sink, an appropriate name is
+ * something that identifies the input block.
+ *
+ * This block otherwise acts as a NULL sink in that items from the
+ * input stream are ignored. It is designed to be able to attach to
+ * any block and watch all tags streaming out of that block for
+ * debugging purposes.
+ *
+ * The tags from the last call to this work function are stored and
+ * can be retrieved using the function 'current_tags'.
+ */
+class GR_CORE_API gr_tag_debug : public gr_sync_block
+{
+ private:
+ friend GR_CORE_API gr_tag_debug_sptr
+ gr_make_tag_debug(size_t sizeof_stream_item, const std::string &name);
+ gr_tag_debug(size_t sizeof_stream_item, const std::string &name);
+
+ std::string d_name;
+ std::vector<gr_tag_t> d_tags;
+ std::vector<gr_tag_t>::iterator d_tags_itr;
+ bool d_display;
+ gruel::mutex d_mutex;
+
+ public:
+ /*!
+ * \brief Returns a vector of gr_tag_t items as of the last call to
+ * work.
+ */
+ std::vector<gr_tag_t> current_tags();
+
+ /*!
+ * \brief Set the display of tags to stdout on/off.
+ */
+ void set_display(bool d);
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif /* INCLUDED_GR_TAG_DEBUG_H */
diff --git a/gnuradio-core/src/lib/general/gr_tag_debug.i b/gnuradio-core/src/lib/general/gr_tag_debug.i
new file mode 100644
index 000000000..3af1bdcfe
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_tag_debug.i
@@ -0,0 +1,35 @@
+/* -*- 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,tag_debug)
+
+%include <gr_tags.i>
+
+gr_tag_debug_sptr
+gr_make_tag_debug(size_t sizeof_stream_item, const std::string &name);
+
+class gr_tag_debug : public gr_sync_block
+{
+public:
+ std::vector<gr_tag_t> current_tags();
+ void set_display(bool d);
+};
diff --git a/gnuradio-core/src/lib/general/gr_test.cc b/gnuradio-core/src/lib/general/gr_test.cc
new file mode 100644
index 000000000..cd5ef8361
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_test.cc
@@ -0,0 +1,177 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_test.h>
+#include <gr_io_signature.h>
+#include <stdexcept>
+#include <iostream>
+#include <string.h>
+
+gr_test_sptr gr_make_test (const std::string &name,
+ int min_inputs, int max_inputs, unsigned int sizeof_input_item,
+ int min_outputs, int max_outputs, unsigned int sizeof_output_item,
+ unsigned int history,unsigned int output_multiple,double relative_rate,
+ bool fixed_rate,gr_consume_type_t cons_type, gr_produce_type_t prod_type)
+{
+ return gnuradio::get_initial_sptr(new gr_test (name, min_inputs,max_inputs,sizeof_input_item,
+ min_outputs,max_outputs,sizeof_output_item,
+ history,output_multiple,relative_rate,fixed_rate,cons_type, prod_type));
+}
+
+ gr_test::gr_test (const std::string &name,int min_inputs, int max_inputs, unsigned int sizeof_input_item,
+ int min_outputs, int max_outputs, unsigned int sizeof_output_item,
+ unsigned int history,unsigned int output_multiple,double relative_rate,
+ bool fixed_rate,gr_consume_type_t cons_type, gr_produce_type_t prod_type): gr_block (name,
+ gr_make_io_signature (min_inputs, max_inputs, sizeof_input_item),
+ gr_make_io_signature (min_outputs, max_outputs, sizeof_output_item)),
+ d_sizeof_input_item(sizeof_input_item),
+ d_sizeof_output_item(sizeof_output_item),
+ d_check_topology(true),
+ d_consume_type(cons_type),
+ d_min_consume(0),
+ d_max_consume(0),
+ d_produce_type(prod_type),
+ d_min_produce(0),
+ d_max_produce(0)
+ {
+ set_history(history);
+ set_output_multiple(output_multiple);
+ set_relative_rate(relative_rate);
+ set_fixed_rate(fixed_rate);
+ }
+
+int
+gr_test::general_work (int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ //touch all inputs and outputs to detect segfaults
+ unsigned ninputs = input_items.size ();
+ unsigned noutputs= output_items.size();
+ for (unsigned i = 0; i < ninputs; i++)
+ {
+ char * in=(char *)input_items[i];
+ if (ninput_items[i]< (int)(noutput_items+history()))
+ {
+ std::cerr << "ERROR: ninput_items[" << i << "] < noutput_items+history()" << std::endl;
+ std::cerr << "ninput_items[" << i << "] = " << ninput_items[i] << std::endl;
+ std::cerr << "noutput_items+history() = " << noutput_items+history() << std::endl;
+ std::cerr << "noutput_items = " << noutput_items << std::endl;
+ std::cerr << "history() = " << history() << std::endl;
+ throw std::runtime_error ("gr_test");
+ } else
+ {
+ for (int j=0;j<ninput_items[i];j++)
+ {
+ //Touch every available input_item
+ //We use a class variable to avoid the compiler to optimize this away
+ for(unsigned int k=0;k<d_sizeof_input_item;k++)
+ d_temp= in[j*d_sizeof_input_item+k];
+ }
+ switch (d_consume_type)
+ {
+ case CONSUME_NOUTPUT_ITEMS:
+ consume(i,noutput_items);
+ break;
+ case CONSUME_NOUTPUT_ITEMS_LIMIT_MAX:
+ consume(i,std::min(noutput_items,d_max_consume));
+ break;
+ case CONSUME_NOUTPUT_ITEMS_LIMIT_MIN:
+ consume(i,std::min(std::max(noutput_items,d_min_consume),ninput_items[i]));
+ break;
+ case CONSUME_ALL_AVAILABLE:
+ consume(i,ninput_items[i]);
+ break;
+ case CONSUME_ALL_AVAILABLE_LIMIT_MAX:
+ consume(i,std::min(ninput_items[i],d_max_consume));
+ break;
+/* //This could result in segfault, uncomment if you want to test this
+ case CONSUME_ALL_AVAILABLE_LIMIT_MIN:
+ consume(i,std::max(ninput_items[i],d_max_consume));
+ break;*/
+ case CONSUME_ZERO:
+ consume(i,0);
+ break;
+ case CONSUME_ONE:
+ consume(i,1);
+ break;
+ case CONSUME_MINUS_ONE:
+ consume(i,-1);
+ break;
+ default:
+ consume(i,noutput_items);
+ }
+ }
+ }
+ for (unsigned i = 0; i < noutputs; i++)
+ {
+ char * out=(char *)output_items[i];
+ {
+ for (int j=0;j<noutput_items;j++)
+ {
+ //Touch every available output_item
+ for(unsigned int k=0;k<d_sizeof_output_item;k++)
+ out[j*d_sizeof_input_item+k]=0;
+ }
+ }
+ }
+ //Now copy input to output until max ninputs or max noutputs is reached
+ int common_nports=std::min(ninputs,noutputs);
+ if(d_sizeof_output_item==d_sizeof_input_item)
+ for (int i = 0; i < common_nports; i++)
+ {
+ memcpy(output_items[i],input_items[i],noutput_items*d_sizeof_input_item);
+ }
+ int noutput_items_produced=0;
+ switch (d_produce_type){
+ case PRODUCE_NOUTPUT_ITEMS:
+ noutput_items_produced=noutput_items;
+ break;
+ case PRODUCE_NOUTPUT_ITEMS_LIMIT_MAX:
+ noutput_items_produced=std::min(noutput_items,d_max_produce);
+ break;
+/* //This could result in segfault, uncomment if you want to test this
+ case PRODUCE_NOUTPUT_ITEMS_LIMIT_MIN:
+ noutput_items_produced=std::max(noutput_items,d_min_produce);
+ break;*/
+ case PRODUCE_ZERO:
+ noutput_items_produced=0;
+ break;
+ case PRODUCE_ONE:
+ noutput_items_produced=1;
+ break;
+ case PRODUCE_MINUS_ONE:
+ noutput_items_produced=-1;
+ break;
+ default:
+ noutput_items_produced=noutput_items;
+ }
+ return noutput_items_produced;
+ }
+
+
+
diff --git a/gnuradio-core/src/lib/general/gr_test.h b/gnuradio-core/src/lib/general/gr_test.h
new file mode 100644
index 000000000..caeba4c51
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_test.h
@@ -0,0 +1,195 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_GR_TEST_H
+#define INCLUDED_GR_TEST_H
+
+#include <gr_core_api.h>
+#include <gr_block.h>
+#include <string>
+#include "gr_test_types.h"
+
+class gr_test;
+typedef boost::shared_ptr<gr_test> gr_test_sptr;
+
+// public constructor
+GR_CORE_API gr_test_sptr gr_make_test (const std::string &name=std::string("gr_test"),
+ int min_inputs=1, int max_inputs=1, unsigned int sizeof_input_item=1,
+ int min_outputs=1, int max_outputs=1, unsigned int sizeof_output_item=1,
+ unsigned int history=1,unsigned int output_multiple=1,double relative_rate=1.0,
+ bool fixed_rate=true,gr_consume_type_t cons_type=CONSUME_NOUTPUT_ITEMS, gr_produce_type_t prod_type=PRODUCE_NOUTPUT_ITEMS);
+
+/*!
+ * \brief Test class for testing runtime system (setting up buffers and such.)
+ * \ingroup misc
+ *
+ * This block does not do any usefull actual data processing.
+ * It just exposes setting all standard block parameters using the contructor or public methods.
+ *
+ * This block can be usefull when testing the runtime system.
+ * You can force this block to have a large history, decimation
+ * factor and/or large output_multiple.
+ * The runtime system should detect this and create large enough buffers
+ * all through the signal chain.
+ */
+class GR_CORE_API gr_test : public gr_block {
+
+ public:
+
+ ~gr_test (){}
+
+int general_work (int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ // ----------------------------------------------------------------
+ // override these to define your behavior
+ // ----------------------------------------------------------------
+
+ /*!
+ * \brief Estimate input requirements given output request
+ *
+ * \param noutput_items number of output items to produce
+ * \param ninput_items_required number of input items required on each input stream
+ *
+ * Given a request to product \p noutput_items, estimate the number of
+ * data items required on each input stream. The estimate doesn't have
+ * to be exact, but should be close.
+ */
+ void forecast (int noutput_items,
+ gr_vector_int &ninput_items_required)
+ {
+ unsigned ninputs = ninput_items_required.size ();
+ for (unsigned i = 0; i < ninputs; i++)
+ ninput_items_required[i] = (int)((double)noutput_items / relative_rate()) + (int)history();
+ }
+
+
+ /*!
+ * \brief Force check topology to return true or false.
+ *
+ * \param check_topology value to return when check_topology is called (true or false)
+ * default check_topology returns true
+ *
+ */
+ void set_check_topology (bool check_topology){ d_check_topology=check_topology;}
+
+ /*!
+ * \brief Confirm that ninputs and noutputs is an acceptable combination.
+ *
+ * \param ninputs number of input streams connected
+ * \param noutputs number of output streams connected
+ *
+ * \returns true if this is a valid configuration for this block.
+ *
+ * This function is called by the runtime system whenever the
+ * topology changes. Most classes do not need to override this.
+ * This check is in addition to the constraints specified by the input
+ * and output gr_io_signatures.
+ */
+ bool check_topology (int ninputs, int noutputs) { return d_check_topology;}
+
+ // ----------------------------------------------------------------
+ /*
+ * The following two methods provide special case info to the
+ * scheduler in the event that a block has a fixed input to output
+ * ratio. gr_sync_block, gr_sync_decimator and gr_sync_interpolator
+ * override these. If you're fixed rate, subclass one of those.
+ */
+ /*!
+ * \brief Given ninput samples, return number of output samples that will be produced.
+ * N.B. this is only defined if fixed_rate returns true.
+ * Generally speaking, you don't need to override this.
+ */
+ int fixed_rate_ninput_to_noutput(int ninput) { return (int)((double)ninput/relative_rate()); }
+
+ /*!
+ * \brief Given noutput samples, return number of input samples required to produce noutput.
+ * N.B. this is only defined if fixed_rate returns true.
+ */
+ int fixed_rate_noutput_to_ninput(int noutput) { return (int)((double)noutput*relative_rate()); }
+
+ /*!
+ * \brief Set if fixed rate should return true.
+ * N.B. This is normally a private method but we make it available here as public.
+ */
+ void set_fixed_rate_public(bool fixed_rate){ set_fixed_rate(fixed_rate);}
+
+ /*!
+ * \brief Set the consume pattern.
+ *
+ * \param cons_type which consume pattern to use
+ */
+ void set_consume_type (gr_consume_type_t cons_type) { d_consume_type=cons_type;}
+
+ /*!
+ * \brief Set the consume limit.
+ *
+ * \param limit min or maximum items to consume (depending on consume_type)
+ */
+ void set_consume_limit (unsigned int limit) { d_min_consume=limit; d_max_consume=limit;}
+
+ /*!
+ * \brief Set the produce pattern.
+ *
+ * \param prod_type which produce pattern to use
+ */
+ void set_produce_type (gr_produce_type_t prod_type) { d_produce_type=prod_type;}
+
+ /*!
+ * \brief Set the produce limit.
+ *
+ * \param limit min or maximum items to produce (depending on produce_type)
+ */
+ void set_produce_limit (unsigned int limit) { d_min_produce=limit; d_max_produce=limit;}
+
+ // ----------------------------------------------------------------------------
+
+
+
+ protected:
+ unsigned int d_sizeof_input_item;
+ unsigned int d_sizeof_output_item;
+ bool d_check_topology;
+ char d_temp;
+ gr_consume_type_t d_consume_type;
+ int d_min_consume;
+ int d_max_consume;
+ gr_produce_type_t d_produce_type;
+ int d_min_produce;
+ int d_max_produce;
+ gr_test (const std::string &name,int min_inputs, int max_inputs, unsigned int sizeof_input_item,
+ int min_outputs, int max_outputs, unsigned int sizeof_output_item,
+ unsigned int history,unsigned int output_multiple,double relative_rate,
+ bool fixed_rate,gr_consume_type_t cons_type, gr_produce_type_t prod_type);
+
+
+
+ friend GR_CORE_API gr_test_sptr gr_make_test (const std::string &name,int min_inputs, int max_inputs, unsigned int sizeof_input_item,
+ int min_outputs, int max_outputs, unsigned int sizeof_output_item,
+ unsigned int history,unsigned int output_multiple,double relative_rate,
+ bool fixed_rate,gr_consume_type_t cons_type, gr_produce_type_t prod_type);
+};
+
+
+
+#endif /* INCLUDED_GR_TEST_H */
diff --git a/gnuradio-core/src/lib/general/gr_test.i b/gnuradio-core/src/lib/general/gr_test.i
new file mode 100644
index 000000000..d81025011
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_test.i
@@ -0,0 +1,64 @@
+/* -*- 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,test);
+
+
+class gr_test;
+typedef boost::shared_ptr<gr_test> gr_test_sptr;
+
+
+// public constructor
+gr_test_sptr gr_make_test (const std::string &name=std::string("gr_test"),
+ int min_inputs=1, int max_inputs=1, unsigned int sizeof_input_item=1,
+ int min_outputs=1, int max_outputs=1, unsigned int sizeof_output_item=1,
+ unsigned int history=1,unsigned int output_multiple=1,double relative_rate=1.0,
+ bool fixed_rate=true,gr_consume_type_t cons_type=CONSUME_NOUTPUT_ITEMS, gr_produce_type_t prod_type=PRODUCE_NOUTPUT_ITEMS);
+
+
+class gr_test : public gr_block {
+
+ public:
+
+ ~gr_test ();
+ void forecast (int noutput_items,
+ gr_vector_int &ninput_items_required);
+ void set_check_topology (bool check_topology);
+ bool check_topology (int ninputs, int noutputs);
+ int fixed_rate_ninput_to_noutput(int ninput);
+ int fixed_rate_noutput_to_ninput(int noutput);
+ void set_fixed_rate_public(bool fixed_rate);
+ void set_consume_type (gr_consume_type_t cons_type);
+ void set_consume_limit (unsigned int limit);
+ void set_produce_type (gr_produce_type_t prod_type);
+ void set_produce_limit (unsigned int limit);
+
+ protected:
+ gr_test (const std::string &name,int min_inputs, int max_inputs, unsigned int sizeof_input_item,
+ int min_outputs, int max_outputs, unsigned int sizeof_output_item,
+ unsigned int history,unsigned int output_multiple,double relative_rate,
+ bool fixed_rate,gr_consume_type_t cons_type, gr_produce_type_t prod_type);
+
+};
+
+
+
diff --git a/gnuradio-core/src/lib/general/gr_test_types.h b/gnuradio-core/src/lib/general/gr_test_types.h
new file mode 100644
index 000000000..04f38f7b2
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_test_types.h
@@ -0,0 +1,46 @@
+/* -*- 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.
+ */
+#ifndef INCLUDED_GR_TEST_TYPES_H
+#define INCLUDED_GR_TEST_TYPES_H
+
+typedef enum {
+ CONSUME_NOUTPUT_ITEMS=0,
+ CONSUME_NOUTPUT_ITEMS_LIMIT_MAX=1,
+ CONSUME_NOUTPUT_ITEMS_LIMIT_MIN=2,
+ CONSUME_ALL_AVAILABLE=3,
+ CONSUME_ALL_AVAILABLE_LIMIT_MAX=4,
+ /*CONSUME_ALL_AVAILABLE_LIMIT_MIN=5,*/
+ CONSUME_ZERO=6,
+ CONSUME_ONE=7,
+ CONSUME_MINUS_ONE=8
+ } gr_consume_type_t;
+
+typedef enum {
+ PRODUCE_NOUTPUT_ITEMS=0,
+ PRODUCE_NOUTPUT_ITEMS_LIMIT_MAX=1,
+ /*PRODUCE_NOUTPUT_ITEMS_LIMIT_MIN=2,*/
+ PRODUCE_ZERO=6,
+ PRODUCE_ONE=7,
+ PRODUCE_MINUS_ONE=8
+ } gr_produce_type_t;
+
+#endif /* INCLUDED_GR_TEST_TYPES_H */
diff --git a/gnuradio-core/src/lib/general/gr_threshold_ff.cc b/gnuradio-core/src/lib/general/gr_threshold_ff.cc
new file mode 100644
index 000000000..952613151
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_threshold_ff.cc
@@ -0,0 +1,67 @@
+/* -*- 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: this file is machine generated. Edits will be over written
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_threshold_ff.h>
+#include <gr_io_signature.h>
+
+gr_threshold_ff_sptr
+gr_make_threshold_ff (float lo, float hi, float initial_state)
+{
+ return gnuradio::get_initial_sptr(new gr_threshold_ff (lo, hi, initial_state));
+}
+
+gr_threshold_ff::gr_threshold_ff (float lo, float hi, float initial_state)
+ : gr_sync_block ("threshold_ff",
+ gr_make_io_signature (1, 1, sizeof (float)),
+ gr_make_io_signature (1, 1, sizeof (float))),
+ d_lo (lo), d_hi (hi), d_last_state (initial_state)
+{
+}
+
+int
+gr_threshold_ff::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const float *in = (const float *) input_items[0];
+ float *out = (float *) output_items[0];
+
+
+ for(int i=0; i<noutput_items; i++) {
+ if (in[i] > d_hi) {
+ out[i] = 1.0;
+ d_last_state = 1.0;
+ } else if (in[i] < d_lo) {
+ out[i] = 0.0;
+ d_last_state = 0.0;
+ } else
+ out[i] = d_last_state;
+ }
+
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/general/gr_threshold_ff.h b/gnuradio-core/src/lib/general/gr_threshold_ff.h
new file mode 100644
index 000000000..678f8b1d2
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_threshold_ff.h
@@ -0,0 +1,59 @@
+/* -*- 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_THRESHOLD_FF_H
+#define INCLUDED_GR_THRESHOLD_FF_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+
+class gr_threshold_ff;
+typedef boost::shared_ptr<gr_threshold_ff> gr_threshold_ff_sptr;
+
+GR_CORE_API gr_threshold_ff_sptr gr_make_threshold_ff (float lo, float hi, float initial_state=0);
+
+/*!
+ * \brief Please fix my documentation
+ * \ingroup misc_blk
+ */
+class GR_CORE_API gr_threshold_ff : public gr_sync_block
+{
+ friend GR_CORE_API gr_threshold_ff_sptr gr_make_threshold_ff (float lo, float hi, float initial_state);
+
+ float d_lo,d_hi; // the constant
+ float d_last_state;
+ gr_threshold_ff (float lo, float hi, float initial_state);
+
+ public:
+ float lo () const { return d_lo; }
+ void set_lo (float lo) { d_lo = lo; }
+ float hi () const { return d_hi; }
+ void set_hi (float hi) { d_hi = hi; }
+ float last_state () const { return d_last_state; }
+ void set_last_state (float last_state) { d_last_state = last_state; }
+
+ 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/general/gr_threshold_ff.i b/gnuradio-core/src/lib/general/gr_threshold_ff.i
new file mode 100644
index 000000000..7584feea8
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_threshold_ff.i
@@ -0,0 +1,39 @@
+/* -*- 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,threshold_ff);
+
+gr_threshold_ff_sptr gr_make_threshold_ff (float lo, float hi, float initial_state=0);
+
+class gr_threshold_ff : public gr_sync_block
+{
+ private:
+ gr_threshold_ff (float lo, float hi, float initial_state);
+
+ public:
+ float lo () const { return d_lo; }
+ void set_lo (float lo) { d_lo = lo; }
+ float hi () const { return d_hi; }
+ void set_hi (float hi) { d_hi = hi; }
+ float last_state () const { return d_last_state; }
+ void set_last_state (float last_state) { d_last_state = last_state; }
+};
diff --git a/gnuradio-core/src/lib/general/gr_throttle.cc b/gnuradio-core/src/lib/general/gr_throttle.cc
new file mode 100644
index 000000000..040ab5220
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_throttle.cc
@@ -0,0 +1,89 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005-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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_throttle.h>
+#include <gr_io_signature.h>
+#include <cstring>
+#include <boost/thread/thread.hpp>
+
+class gr_throttle_impl : public gr_throttle{
+public:
+ gr_throttle_impl(size_t itemsize):
+ gr_sync_block("throttle",
+ gr_make_io_signature(1, 1, itemsize),
+ gr_make_io_signature(1, 1, itemsize)),
+ d_itemsize(itemsize)
+ {
+ /* NOP */
+ }
+
+ void set_sample_rate(double rate){
+ //changing the sample rate performs a reset of state params
+ d_start = boost::get_system_time();
+ d_total_samples = 0;
+ d_samps_per_tick = rate/boost::posix_time::time_duration::ticks_per_second();
+ d_samps_per_us = rate/1e6;
+ }
+
+ int work (
+ int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items
+ ){
+ //calculate the expected number of samples to have passed through
+ boost::system_time now = boost::get_system_time();
+ boost::int64_t ticks = (now - d_start).ticks();
+ uint64_t expected_samps = uint64_t(d_samps_per_tick*ticks);
+
+ //if the expected samples was less, we need to throttle back
+ if (d_total_samples > expected_samps){
+ boost::this_thread::sleep(boost::posix_time::microseconds(
+ long((d_total_samples - expected_samps)/d_samps_per_us)
+ ));
+ }
+
+ //copy all samples output[i] <= input[i]
+ const char *in = (const char *) input_items[0];
+ char *out = (char *) output_items[0];
+ std::memcpy(out, in, noutput_items * d_itemsize);
+ d_total_samples += noutput_items;
+ return noutput_items;
+ }
+
+private:
+ boost::system_time d_start;
+ size_t d_itemsize;
+ uint64_t d_total_samples;
+ double d_samps_per_tick, d_samps_per_us;
+};
+
+gr_throttle::sptr
+gr_make_throttle(size_t itemsize, double samples_per_sec)
+{
+ gr_throttle::sptr throttle(new gr_throttle_impl(itemsize));
+ throttle->set_sample_rate(samples_per_sec);
+ return throttle;
+}
diff --git a/gnuradio-core/src/lib/general/gr_throttle.h b/gnuradio-core/src/lib/general/gr_throttle.h
new file mode 100644
index 000000000..876d6d826
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_throttle.h
@@ -0,0 +1,50 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005-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.
+ */
+#ifndef INCLUDED_GR_THROTTLE_H
+#define INCLUDED_GR_THROTTLE_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+
+/*!
+ * \brief throttle flow of samples such that the average rate does not exceed samples_per_sec.
+ * \ingroup misc_blk
+ *
+ * input: one stream of itemsize; output: one stream of itemsize
+ *
+ * N.B. this should only be used in GUI apps where there is no other
+ * rate limiting block. It is not intended nor effective at precisely
+ * controlling the rate of samples. That should be controlled by a
+ * source or sink tied to sample clock. E.g., a USRP or audio card.
+ */
+class GR_CORE_API gr_throttle : virtual public gr_sync_block
+{
+public:
+ typedef boost::shared_ptr<gr_throttle> sptr;
+
+ //! Sets the sample rate in samples per second
+ virtual void set_sample_rate(double rate) = 0;
+};
+
+GR_CORE_API gr_throttle::sptr gr_make_throttle(size_t itemsize, double samples_per_sec);
+
+#endif /* INCLUDED_GR_THROTTLE_H */
diff --git a/gnuradio-core/src/lib/general/gr_throttle.i b/gnuradio-core/src/lib/general/gr_throttle.i
new file mode 100644
index 000000000..5ba32de6e
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_throttle.i
@@ -0,0 +1,29 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005-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.
+ */
+
+%{
+#include <gr_throttle.h>
+%}
+
+GR_SWIG_BLOCK_MAGIC(gr,throttle);
+
+%include <gr_throttle.h>
diff --git a/gnuradio-core/src/lib/general/gr_transcendental.cc b/gnuradio-core/src/lib/general/gr_transcendental.cc
new file mode 100644
index 000000000..c1482491b
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_transcendental.cc
@@ -0,0 +1,153 @@
+/*
+ * Copyright 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.
+ */
+
+#include <gr_transcendental.h>
+#include <gr_io_signature.h>
+#include <stdexcept>
+#include <complex> //complex math
+#include <cmath> //real math
+#include <map>
+
+/***********************************************************************
+ * work function creation and registration
+ **********************************************************************/
+typedef int(*work_fcn_type)(int, gr_vector_const_void_star &, gr_vector_void_star &);
+struct map_val_type{
+ work_fcn_type work_fcn;
+ size_t io_size;
+};
+typedef std::map<std::string, map_val_type> map_type;
+
+//construct map on first use idiom
+static map_type &get_map(void){
+ static map_type map;
+ return map;
+}
+
+//static initialization of this object registers a function
+struct gr_transcendental_registrant{
+ gr_transcendental_registrant(
+ const std::string &key,
+ const work_fcn_type &work_fcn,
+ const size_t io_size
+ ){
+ map_val_type val;
+ val.work_fcn = work_fcn;
+ val.io_size = io_size;
+ get_map()[key] = val;
+ }
+};
+
+//macro to create a work function and register it
+#define REGISTER_FUNCTION(__fcn__, __type__, __key__) \
+ static int __key__ ## _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]; \
+ __type__ *out = (__type__ *) output_items[0]; \
+ for (size_t i = 0; i < size_t(noutput_items); i++){ \
+ out[i] = std::__fcn__(in[i]); \
+ } \
+ return noutput_items; \
+ } \
+ gr_transcendental_registrant __key__ ## _registrant(#__key__, &__key__ ## _work, sizeof(__type__));
+
+//register work functions for real types
+#define REGISTER_REAL_FUNCTIONS(__fcn__) \
+ REGISTER_FUNCTION(__fcn__, float, __fcn__ ## _float) \
+ REGISTER_FUNCTION(__fcn__, double, __fcn__ ## _double)
+
+//register work functions for complex types
+#define REGISTER_COMPLEX_FUNCTIONS(__fcn__) \
+ REGISTER_FUNCTION(__fcn__, std::complex<float>, __fcn__ ## _complex_float) \
+ REGISTER_FUNCTION(__fcn__, std::complex<double>, __fcn__ ## _complex_double)
+
+//register both complex and real
+#define REGISTER_FUNCTIONS(__fcn__) \
+ REGISTER_REAL_FUNCTIONS(__fcn__) \
+ REGISTER_COMPLEX_FUNCTIONS(__fcn__)
+
+//create and register transcendental work functions
+REGISTER_FUNCTIONS(cos)
+REGISTER_FUNCTIONS(sin)
+REGISTER_FUNCTIONS(tan)
+REGISTER_REAL_FUNCTIONS(acos)
+REGISTER_REAL_FUNCTIONS(asin)
+REGISTER_REAL_FUNCTIONS(atan)
+REGISTER_FUNCTIONS(cosh)
+REGISTER_FUNCTIONS(sinh)
+REGISTER_FUNCTIONS(tanh)
+REGISTER_FUNCTIONS(exp)
+REGISTER_FUNCTIONS(log)
+REGISTER_FUNCTIONS(log10)
+REGISTER_FUNCTIONS(sqrt)
+
+/***********************************************************************
+ * implementation block simply calls into the function pointer
+ **********************************************************************/
+class gr_transcendental_impl : public gr_transcendental{
+public:
+ gr_transcendental_impl(
+ const work_fcn_type &work_fcn, const size_t io_size
+ ):
+ gr_sync_block(
+ "transcendental",
+ gr_make_io_signature(1, 1, io_size),
+ gr_make_io_signature(1, 1, io_size)
+ ),
+ _work_fcn(work_fcn)
+ {
+ // NOP
+ }
+
+ int work(
+ int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items
+ ){
+ return _work_fcn(noutput_items, input_items, output_items);
+ }
+
+private:
+ const work_fcn_type &_work_fcn;
+};
+
+/***********************************************************************
+ * factory function to make transcendental block
+ **********************************************************************/
+gr_transcendental::sptr gr_make_transcendental(
+ const std::string &name,
+ const std::string &type
+){
+ //search for an entry in the map
+ const std::string key = name + "_" + type;
+ const bool has_key = get_map().count(key) != 0;
+ if (!has_key) throw std::runtime_error(
+ "could not find transcendental function for " + key
+ );
+
+ //make a new block with found work function
+ return gr_transcendental::sptr(new gr_transcendental_impl(
+ get_map()[key].work_fcn, get_map()[key].io_size
+ ));
+}
diff --git a/gnuradio-core/src/lib/general/gr_transcendental.h b/gnuradio-core/src/lib/general/gr_transcendental.h
new file mode 100644
index 000000000..9841a53e9
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_transcendental.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright 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.
+ */
+
+#ifndef INCLUDED_GR_TRANSCENDENTAL_H
+#define INCLUDED_GR_TRANSCENDENTAL_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+#include <string>
+
+/*!
+ * \brief A block that performs various transcendental math operations.
+ *
+ * Possible function names can be found in the cmath library.
+ * IO may be either complex or real, double or single precision.
+ *
+ * Possible type strings: float, double, complex_float, complex_double
+ *
+ * output[i] = trans_fcn(input[i])
+ */
+class GR_CORE_API gr_transcendental : virtual public gr_sync_block{
+public:
+ typedef boost::shared_ptr<gr_transcendental> sptr;
+};
+
+GR_CORE_API gr_transcendental::sptr gr_make_transcendental(
+ const std::string &name,
+ const std::string &type = "float"
+);
+
+#endif /* INCLUDED_GR_TRANSCENDENTAL_H */
diff --git a/gnuradio-core/src/lib/general/gr_transcendental.i b/gnuradio-core/src/lib/general/gr_transcendental.i
new file mode 100644
index 000000000..6acdb10b7
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_transcendental.i
@@ -0,0 +1,33 @@
+/*
+ * Copyright 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.
+ */
+
+////////////////////////////////////////////////////////////////////////
+// block headers
+////////////////////////////////////////////////////////////////////////
+%{
+#include <gr_transcendental.h>
+%}
+
+////////////////////////////////////////////////////////////////////////
+// block magic
+////////////////////////////////////////////////////////////////////////
+GR_SWIG_BLOCK_MAGIC(gr,transcendental)
+%include <gr_transcendental.h>
diff --git a/gnuradio-core/src/lib/general/gr_uchar_to_float.cc b/gnuradio-core/src/lib/general/gr_uchar_to_float.cc
new file mode 100644
index 000000000..981a93440
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_uchar_to_float.cc
@@ -0,0 +1,55 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_uchar_to_float.h>
+#include <gr_io_signature.h>
+#include <gri_uchar_to_float.h>
+
+gr_uchar_to_float_sptr
+gr_make_uchar_to_float ()
+{
+ return gnuradio::get_initial_sptr(new gr_uchar_to_float ());
+}
+
+gr_uchar_to_float::gr_uchar_to_float ()
+ : gr_sync_block ("gr_uchar_to_float",
+ gr_make_io_signature (1, 1, sizeof (unsigned char)),
+ gr_make_io_signature (1, 1, sizeof (float)))
+{
+}
+
+int
+gr_uchar_to_float::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const unsigned char *in = (const unsigned char *) input_items[0];
+ float *out = (float *) output_items[0];
+
+ gri_uchar_to_float (in, out, noutput_items);
+
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/general/gr_uchar_to_float.h b/gnuradio-core/src/lib/general/gr_uchar_to_float.h
new file mode 100644
index 000000000..c02601cca
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_uchar_to_float.h
@@ -0,0 +1,52 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005 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_UCHAR_TO_FLOAT_H
+#define INCLUDED_GR_UCHAR_TO_FLOAT_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+
+class gr_uchar_to_float;
+typedef boost::shared_ptr<gr_uchar_to_float> gr_uchar_to_float_sptr;
+
+GR_CORE_API gr_uchar_to_float_sptr
+gr_make_uchar_to_float ();
+
+/*!
+ * \brief Convert stream of unsigned chars to a stream of float
+ * \ingroup converter_blk
+ */
+
+class GR_CORE_API gr_uchar_to_float : public gr_sync_block
+{
+ friend GR_CORE_API gr_uchar_to_float_sptr gr_make_uchar_to_float ();
+ gr_uchar_to_float ();
+
+ public:
+ virtual int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+
+#endif /* INCLUDED_GR_UCHAR_TO_FLOAT_H */
diff --git a/gnuradio-core/src/lib/general/gr_uchar_to_float.i b/gnuradio-core/src/lib/general/gr_uchar_to_float.i
new file mode 100644
index 000000000..b6cc35329
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_uchar_to_float.i
@@ -0,0 +1,30 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005 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,uchar_to_float)
+
+gr_uchar_to_float_sptr gr_make_uchar_to_float ();
+
+class gr_uchar_to_float : public gr_sync_block
+{
+ gr_uchar_to_float ();
+};
diff --git a/gnuradio-core/src/lib/general/gr_unpack_k_bits_bb.cc b/gnuradio-core/src/lib/general/gr_unpack_k_bits_bb.cc
new file mode 100644
index 000000000..00b88e972
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_unpack_k_bits_bb.cc
@@ -0,0 +1,70 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005,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.
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_unpack_k_bits_bb.h>
+#include <gr_io_signature.h>
+#include <stdexcept>
+#include <iostream>
+
+gr_unpack_k_bits_bb_sptr gr_make_unpack_k_bits_bb (unsigned k)
+{
+ return gnuradio::get_initial_sptr(new gr_unpack_k_bits_bb (k));
+}
+
+
+gr_unpack_k_bits_bb::gr_unpack_k_bits_bb (unsigned k)
+ : gr_sync_interpolator ("unpack_k_bits_bb",
+ gr_make_io_signature (1, 1, sizeof (unsigned char)),
+ gr_make_io_signature (1, 1, sizeof (unsigned char)),
+ k),
+ d_k (k)
+{
+ if (d_k == 0)
+ throw std::out_of_range ("interpolation must be > 0");
+}
+
+gr_unpack_k_bits_bb::~gr_unpack_k_bits_bb ()
+{
+}
+
+int
+gr_unpack_k_bits_bb::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const unsigned char *in = (const unsigned char *) input_items[0];
+ unsigned char *out = (unsigned char *) output_items[0];
+
+ int n = 0;
+ for (unsigned int i = 0; i < noutput_items/d_k; i++){
+ unsigned int t = in[i];
+ for (int j = d_k - 1; j >= 0; j--)
+ out[n++] = (t >> j) & 0x01;
+ }
+
+ assert(n == noutput_items);
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/general/gr_unpack_k_bits_bb.h b/gnuradio-core/src/lib/general/gr_unpack_k_bits_bb.h
new file mode 100644
index 000000000..c3ea28d3f
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_unpack_k_bits_bb.h
@@ -0,0 +1,56 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_GR_UNPACK_K_BITS_BB_H
+#define INCLUDED_GR_UNPACK_K_BITS_BB_H
+
+#include <gr_core_api.h>
+#include <gr_sync_interpolator.h>
+
+class gr_unpack_k_bits_bb;
+typedef boost::shared_ptr<gr_unpack_k_bits_bb> gr_unpack_k_bits_bb_sptr;
+GR_CORE_API gr_unpack_k_bits_bb_sptr gr_make_unpack_k_bits_bb (unsigned k);
+
+class gr_unpack_k_bits_bb;
+
+/*!
+ * \brief Converts a byte with k relevent bits to k output bytes with 1 bit in the LSB.
+ * \ingroup converter_blk
+ */
+class GR_CORE_API gr_unpack_k_bits_bb : public gr_sync_interpolator
+{
+ private:
+ friend GR_CORE_API gr_unpack_k_bits_bb_sptr gr_make_unpack_k_bits_bb (unsigned k);
+
+ gr_unpack_k_bits_bb (unsigned k);
+
+ unsigned d_k; // number of relevent bits to unpack into k output bytes
+
+ public:
+ ~gr_unpack_k_bits_bb ();
+
+ 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/general/gr_unpack_k_bits_bb.i b/gnuradio-core/src/lib/general/gr_unpack_k_bits_bb.i
new file mode 100644
index 000000000..de0f4b33e
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_unpack_k_bits_bb.i
@@ -0,0 +1,34 @@
+/* -*- 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,unpack_k_bits_bb)
+
+gr_unpack_k_bits_bb_sptr gr_make_unpack_k_bits_bb (int k) throw(std::exception);
+
+class gr_unpack_k_bits_bb : public gr_sync_interpolator
+{
+ private:
+ gr_unpack_k_bits_bb (int k);
+
+ public:
+ ~gr_unpack_k_bits_bb ();
+};
diff --git a/gnuradio-core/src/lib/general/gr_vco.h b/gnuradio-core/src/lib/general/gr_vco.h
new file mode 100644
index 000000000..3ceaf15dd
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_vco.h
@@ -0,0 +1,94 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005 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 _GR_VCO_H_
+#define _GR_VCO_H_
+
+
+#include <vector>
+#include <gr_sincos.h>
+#include <cmath>
+#include <gr_complex.h>
+
+/*!
+ * \brief base class template for Voltage Controlled Oscillator (VCO)
+ * \ingroup misc
+ */
+
+//FIXME Eventually generalize this to fixed point
+
+template<class o_type, class i_type>
+class gr_vco {
+public:
+ gr_vco () : d_phase (0) {}
+
+ virtual ~gr_vco () {}
+
+ // radians
+ void set_phase (double angle) {
+ d_phase = angle;
+ }
+
+ void adjust_phase (double delta_phase) {
+ d_phase += delta_phase;
+ if (fabs (d_phase) > M_PI){
+
+ while (d_phase > M_PI)
+ d_phase -= 2*M_PI;
+
+ while (d_phase < -M_PI)
+ d_phase += 2*M_PI;
+ }
+ }
+
+ double get_phase () const { return d_phase; }
+
+ // compute sin and cos for current phase angle
+ void sincos (float *sinx, float *cosx) const;
+
+ // compute cos or sin for current phase angle
+ float cos () const { return std::cos (d_phase); }
+ float sin () const { return std::sin (d_phase); }
+
+ // compute a block at a time
+ void cos (float *output, const float *input, int noutput_items, double k, double ampl = 1.0);
+
+protected:
+ double d_phase;
+};
+
+template<class o_type, class i_type>
+void
+gr_vco<o_type,i_type>::sincos (float *sinx, float *cosx) const
+{
+ gr_sincosf (d_phase, sinx, cosx);
+}
+
+template<class o_type, class i_type>
+void
+gr_vco<o_type,i_type>::cos (float *output, const float *input, int noutput_items, double k, double ampl)
+{
+ for (int i = 0; i < noutput_items; i++){
+ output[i] = cos() * ampl;
+ adjust_phase(input[i] * k);
+ }
+}
+#endif /* _GR_VCO_H_ */
diff --git a/gnuradio-core/src/lib/general/gr_vco_f.cc b/gnuradio-core/src/lib/general/gr_vco_f.cc
new file mode 100644
index 000000000..0899bc77e
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_vco_f.cc
@@ -0,0 +1,58 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_vco_f.h>
+#include <gr_io_signature.h>
+#include <math.h>
+
+gr_vco_f_sptr
+gr_make_vco_f(double sampling_rate, double sensitivity, double amplitude)
+{
+ return gnuradio::get_initial_sptr(new gr_vco_f(sampling_rate, sensitivity, amplitude));
+}
+
+
+gr_vco_f::gr_vco_f(double sampling_rate, double sensitivity, double amplitude)
+ : gr_sync_block("vco_f",
+ gr_make_io_signature(1, 1, sizeof(float)),
+ gr_make_io_signature(1, 1, sizeof(float))),
+ d_sampling_rate(sampling_rate), d_sensitivity(sensitivity), d_amplitude(amplitude),
+ d_k(d_sensitivity/d_sampling_rate)
+{
+}
+
+int
+gr_vco_f::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const float *input = (const float *)input_items[0];
+ float *output = (float *)output_items[0];
+
+ d_vco.cos(output, input, noutput_items, d_k, d_amplitude);
+
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/general/gr_vco_f.h b/gnuradio-core/src/lib/general/gr_vco_f.h
new file mode 100644
index 000000000..83f6a9773
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_vco_f.h
@@ -0,0 +1,75 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005 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_VCO_F_H
+#define INCLUDED_GR_VCO_F_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+#include <gr_fxpt_vco.h>
+
+/*!
+ * \brief VCO - Voltage controlled oscillator
+ * \ingroup misc
+ *
+ * \param sampling_rate sampling rate (Hz)
+ * \param sensitivity units are radians/sec/volt
+ * \param amplitude output amplitude
+ */
+class gr_vco_f;
+typedef boost::shared_ptr<gr_vco_f> gr_vco_f_sptr;
+
+
+GR_CORE_API gr_vco_f_sptr gr_make_vco_f(double sampling_rate, double sensitivity, double amplitude);
+
+/*!
+ * \brief VCO - Voltage controlled oscillator
+ * \ingroup modulator_blk
+ *
+ * input: float stream of control voltages; output: float oscillator output
+ */
+class GR_CORE_API gr_vco_f : public gr_sync_block
+{
+ friend GR_CORE_API gr_vco_f_sptr gr_make_vco_f(double sampling_rate, double sensitivity, double amplitude);
+
+ /*!
+ * \brief VCO - Voltage controlled oscillator
+ *
+ * \param sampling_rate sampling rate (Hz)
+ * \param sensitivity units are radians/sec/volt
+ * \param amplitude output amplitude
+ */
+ gr_vco_f(double sampling_rate, double sensitivity, double amplitude);
+
+ double d_sampling_rate;
+ double d_sensitivity;
+ double d_amplitude;
+ double d_k;
+ gr_fxpt_vco d_vco;
+
+public:
+
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif /* INCLUDED_GR_VCO_F_H */
diff --git a/gnuradio-core/src/lib/general/gr_vco_f.i b/gnuradio-core/src/lib/general/gr_vco_f.i
new file mode 100644
index 000000000..8ecf31411
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_vco_f.i
@@ -0,0 +1,38 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005 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,vco_f);
+
+/*!
+ * \brief VCO - Voltage controlled oscillator
+ *
+ * \param sampling_rate sampling rate (Hz)
+ * \param sensitivity units are radians/sec/volt
+ * \param amplitude output amplitude
+ */
+gr_vco_f_sptr gr_make_vco_f(double sampling_rate, double sensitivity, double amplitude);
+
+
+class gr_vco_f : public gr_sync_block {
+ private:
+ gr_vco_f(double sampling_rate, double sensitivity, double amplitude);
+};
diff --git a/gnuradio-core/src/lib/general/gr_vector_map.cc b/gnuradio-core/src/lib/general/gr_vector_map.cc
new file mode 100644
index 000000000..2a13efb06
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_vector_map.cc
@@ -0,0 +1,117 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_vector_map.h>
+#include <gr_io_signature.h>
+#include <string.h>
+
+std::vector<int>
+get_in_sizeofs(size_t item_size, std::vector<size_t> in_vlens)
+{
+ std::vector<int> in_sizeofs;
+ for(unsigned int i = 0; i < in_vlens.size(); i++) {
+ in_sizeofs.push_back(in_vlens[i]*item_size);
+ }
+ return in_sizeofs;
+}
+
+std::vector<int>
+get_out_sizeofs(size_t item_size,
+ std::vector< std::vector< std::vector<size_t> > > mapping)
+{
+ std::vector<int> out_sizeofs;
+ for(unsigned int i = 0; i < mapping.size(); i++) {
+ out_sizeofs.push_back(mapping[i].size()*item_size);
+ }
+ return out_sizeofs;
+}
+
+gr_vector_map_sptr
+gr_make_vector_map (size_t item_size, std::vector<size_t> in_vlens,
+ std::vector< std::vector< std::vector<size_t> > > mapping)
+{
+ return gnuradio::get_initial_sptr(new gr_vector_map(item_size,
+ in_vlens,
+ mapping));
+}
+
+gr_vector_map::gr_vector_map(size_t item_size, std::vector<size_t> in_vlens,
+ std::vector< std::vector< std::vector<size_t> > > mapping)
+ : gr_sync_block("vector_map",
+ gr_make_io_signaturev(in_vlens.size(), in_vlens.size(),
+ get_in_sizeofs(item_size, in_vlens)),
+ gr_make_io_signaturev(mapping.size(), mapping.size(),
+ get_out_sizeofs(item_size, mapping))),
+ d_item_size(item_size), d_in_vlens(in_vlens)
+{
+ set_mapping(mapping);
+}
+
+void
+gr_vector_map::set_mapping(std::vector< std::vector< std::vector<size_t> > > mapping) {
+ // Make sure the contents of the mapping vectors are possible.
+ for(unsigned int i=0; i<mapping.size(); i++) {
+ for(unsigned int j=0; j<mapping[i].size(); j++) {
+ if(mapping[i][j].size() != 2) {
+ throw std::runtime_error("Mapping must be of the form (out_mapping_stream1, out_mapping_stream2, ...), where out_mapping_stream1 is of the form (mapping_element1, mapping_element2, ...), where mapping_element1 is of the form (input_stream, input_element). This error is raised because a mapping_element vector does not contain exactly 2 items.");
+ }
+ unsigned int s = mapping[i][j][0];
+ unsigned int index = mapping[i][j][1];
+ if(s >= d_in_vlens.size()) {
+ throw std::runtime_error("Stream numbers in mapping must be less than the number of input streams.");
+ }
+ if((index < 0) || (index >= d_in_vlens[s])) {
+ throw std::runtime_error ("Indices in mapping must be greater than 0 and less than the input vector lengths.");
+ }
+ }
+ }
+ gruel::scoped_lock guard(d_mutex);
+ d_mapping = mapping;
+}
+
+int
+gr_vector_map::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const char **inv = (const char **) &input_items[0];
+ char **outv = (char **) &output_items[0];
+
+ for(unsigned int n = 0; n < (unsigned int)(noutput_items); n++) {
+ for(unsigned int i = 0; i < d_mapping.size(); i++) {
+ unsigned int out_vlen = d_mapping[i].size();
+ for(unsigned int j = 0; j < out_vlen; j++) {
+ unsigned int s = d_mapping[i][j][0];
+ unsigned int k = d_mapping[i][j][1];
+ memcpy(outv[i] + out_vlen*d_item_size*n +
+ d_item_size*j, inv[s] + d_in_vlens[s]*d_item_size*n +
+ k*d_item_size, d_item_size);
+ }
+ }
+ }
+
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/general/gr_vector_map.h b/gnuradio-core/src/lib/general/gr_vector_map.h
new file mode 100644
index 000000000..f5492b1e3
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_vector_map.h
@@ -0,0 +1,83 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_GR_VECTOR_MAP_H
+#define INCLUDED_GR_VECTOR_MAP_H
+
+#include <vector>
+#include <gr_core_api.h>
+#include <gr_sync_interpolator.h>
+#include <gruel/thread.h>
+
+class gr_vector_map;
+typedef boost::shared_ptr<gr_vector_map> gr_vector_map_sptr;
+
+GR_CORE_API gr_vector_map_sptr
+gr_make_vector_map (size_t item_size, std::vector<size_t> in_vlens,
+ std::vector< std::vector< std::vector<size_t> > > mapping);
+
+/*!
+ * \brief Maps elements from a set of input vectors to a set of output vectors.
+ *
+ * If in[i] is the input vector in the i'th stream then the output
+ * vector in the j'th stream is:
+ *
+ * out[j][k] = in[mapping[j][k][0]][mapping[j][k][1]]
+ *
+ * That is mapping is of the form (out_stream1_mapping,
+ * out_stream2_mapping, ...) and out_stream1_mapping is of the form
+ * (element1_mapping, element2_mapping, ...) and element1_mapping is
+ * of the form (in_stream, in_element).
+ *
+ * \param item_size (integer) size of vector elements
+ *
+ * \param in_vlens (vector of integers) number of elements in each
+ * input vector
+ *
+ * \param mapping (vector of vectors of vectors of integers) how to
+ * map elements from input to output vectors
+ *
+ * \ingroup slicedice_blk
+ */
+class GR_CORE_API gr_vector_map : public gr_sync_block
+{
+ friend GR_CORE_API gr_vector_map_sptr
+ gr_make_vector_map(size_t item_size, std::vector<size_t> in_vlens,
+ std::vector< std::vector< std::vector<size_t> > > mapping);
+ size_t d_item_size;
+ std::vector<size_t> d_in_vlens;
+ std::vector< std::vector< std::vector<size_t> > > d_mapping;
+ gruel::mutex d_mutex; // mutex to protect set/work access
+
+ protected:
+ gr_vector_map(size_t item_size, std::vector<size_t> in_vlens,
+ std::vector< std::vector< std::vector<size_t> > > mapping);
+
+ public:
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+
+ void set_mapping(std::vector< std::vector< std::vector<size_t> > > mapping);
+};
+
+#endif /* INCLUDED_GR_VECTOR_MAP_H */
diff --git a/gnuradio-core/src/lib/general/gr_vector_map.i b/gnuradio-core/src/lib/general/gr_vector_map.i
new file mode 100644
index 000000000..e9fa3f27e
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_vector_map.i
@@ -0,0 +1,28 @@
+/* -*- 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr, vector_map);
+
+%template() std::vector<size_t>;
+%template() std::vector< std::vector< std::vector<size_t> > >;
+
+%include "gr_vector_map.h"
diff --git a/gnuradio-core/src/lib/general/gr_vector_to_stream.cc b/gnuradio-core/src/lib/general/gr_vector_to_stream.cc
new file mode 100644
index 000000000..621b7ec58
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_vector_to_stream.cc
@@ -0,0 +1,58 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_vector_to_stream.h>
+#include <gr_io_signature.h>
+#include <string.h>
+
+gr_vector_to_stream_sptr
+gr_make_vector_to_stream (size_t item_size, size_t nitems_per_block)
+{
+ return gnuradio::get_initial_sptr(new gr_vector_to_stream (item_size, nitems_per_block));
+}
+
+gr_vector_to_stream::gr_vector_to_stream (size_t item_size, size_t nitems_per_block)
+ : gr_sync_interpolator ("vector_to_stream",
+ gr_make_io_signature (1, 1, item_size * nitems_per_block),
+ gr_make_io_signature (1, 1, item_size),
+ nitems_per_block)
+{
+}
+
+int
+gr_vector_to_stream::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ size_t block_size = output_signature()->sizeof_stream_item (0);
+
+ const char *in = (const char *) input_items[0];
+ char *out = (char *) output_items[0];
+
+ memcpy (out, in, noutput_items * block_size);
+
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/general/gr_vector_to_stream.h b/gnuradio-core/src/lib/general/gr_vector_to_stream.h
new file mode 100644
index 000000000..9fc8030f5
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_vector_to_stream.h
@@ -0,0 +1,54 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2005,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.
+ */
+
+#ifndef INCLUDED_GR_VECTOR_TO_STREAM_H
+#define INCLUDED_GR_VECTOR_TO_STREAM_H
+
+#include <gr_core_api.h>
+#include <gr_sync_interpolator.h>
+
+class gr_vector_to_stream;
+typedef boost::shared_ptr<gr_vector_to_stream> gr_vector_to_stream_sptr;
+
+GR_CORE_API gr_vector_to_stream_sptr
+gr_make_vector_to_stream (size_t item_size, size_t nitems_per_block);
+
+
+/*!
+ * \brief convert a stream of blocks of nitems_per_block items into a stream of items
+ * \ingroup slicedice_blk
+ */
+class GR_CORE_API gr_vector_to_stream : public gr_sync_interpolator
+{
+ friend GR_CORE_API gr_vector_to_stream_sptr
+ gr_make_vector_to_stream (size_t item_size, size_t nitems_per_block);
+
+ protected:
+ gr_vector_to_stream (size_t item_size, size_t nitems_per_block);
+
+ public:
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif /* INCLUDED_GR_VECTOR_TO_STREAM_H */
diff --git a/gnuradio-core/src/lib/general/gr_vector_to_stream.i b/gnuradio-core/src/lib/general/gr_vector_to_stream.i
new file mode 100644
index 000000000..99776eeb8
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_vector_to_stream.i
@@ -0,0 +1,34 @@
+/* -*- 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,vector_to_stream)
+
+gr_vector_to_stream_sptr
+gr_make_vector_to_stream (size_t itemsize, size_t nitems_per_block);
+
+class gr_vector_to_stream : public gr_sync_decimator
+{
+ protected:
+ gr_vector_to_stream (size_t itemsize, size_t nitems_per_block);
+
+ public:
+};
diff --git a/gnuradio-core/src/lib/general/gr_vector_to_streams.cc b/gnuradio-core/src/lib/general/gr_vector_to_streams.cc
new file mode 100644
index 000000000..7ab352a4f
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_vector_to_streams.cc
@@ -0,0 +1,64 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2005,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_vector_to_streams.h>
+#include <gr_io_signature.h>
+#include <string.h>
+
+gr_vector_to_streams_sptr
+gr_make_vector_to_streams (size_t item_size, size_t nstreams)
+{
+ return gnuradio::get_initial_sptr(new gr_vector_to_streams (item_size, nstreams));
+}
+
+gr_vector_to_streams::gr_vector_to_streams (size_t item_size, size_t nstreams)
+ : gr_sync_block ("vector_to_streams",
+ gr_make_io_signature (1, 1, nstreams * item_size),
+ gr_make_io_signature (nstreams, nstreams, item_size))
+{
+}
+
+int
+gr_vector_to_streams::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ size_t item_size = output_signature()->sizeof_stream_item(0);
+ int nstreams = output_items.size();
+
+ const char *in = (const char *) input_items[0];
+ char **outv = (char **) &output_items[0];
+
+ for (int i = 0; i < noutput_items; i++){
+ for (int j = 0; j < nstreams; j++){
+ memcpy(outv[j], in, item_size);
+ outv[j] += item_size;
+ in += item_size;
+ }
+ }
+
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/general/gr_vector_to_streams.h b/gnuradio-core/src/lib/general/gr_vector_to_streams.h
new file mode 100644
index 000000000..8db423053
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_vector_to_streams.h
@@ -0,0 +1,54 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2005 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_VECTOR_TO_STREAMS_H
+#define INCLUDED_GR_VECTOR_TO_STREAMS_H
+
+#include <gr_core_api.h>
+#include <gr_sync_interpolator.h>
+
+class gr_vector_to_streams;
+typedef boost::shared_ptr<gr_vector_to_streams> gr_vector_to_streams_sptr;
+
+GR_CORE_API gr_vector_to_streams_sptr
+gr_make_vector_to_streams (size_t item_size, size_t nstreams);
+
+
+/*!
+ * \brief Convert 1 stream of vectors of length N to N streams of items
+ * \ingroup slicedice_blk
+ */
+class GR_CORE_API gr_vector_to_streams : public gr_sync_block
+{
+ friend GR_CORE_API gr_vector_to_streams_sptr
+ gr_make_vector_to_streams (size_t item_size, size_t nstreams);
+
+ protected:
+ gr_vector_to_streams (size_t item_size, size_t nstreams);
+
+ public:
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif /* INCLUDED_GR_VECTOR_TO_STREAMS_H */
diff --git a/gnuradio-core/src/lib/general/gr_vector_to_streams.i b/gnuradio-core/src/lib/general/gr_vector_to_streams.i
new file mode 100644
index 000000000..d4123135b
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_vector_to_streams.i
@@ -0,0 +1,34 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2005 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,vector_to_streams)
+
+gr_vector_to_streams_sptr
+gr_make_vector_to_streams (size_t itemsize, size_t nstreams);
+
+class gr_vector_to_streams : public gr_sync_block
+{
+ protected:
+ gr_vector_to_streams (size_t itemsize, size_t nstreams);
+
+ public:
+};
diff --git a/gnuradio-core/src/lib/general/gri_add_const_ss.h b/gnuradio-core/src/lib/general/gri_add_const_ss.h
new file mode 100644
index 000000000..7433ee41b
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gri_add_const_ss.h
@@ -0,0 +1,36 @@
+/* -*- 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_GRI_ADD_CONST_SS_H
+#define INCLUDED_GRI_ADD_CONST_SS_H
+
+/*!
+ * \brief Low-level, high-speed add_const_ss primitive
+ *
+ * copy src to dst adding konst
+ */
+
+void
+gri_add_const_ss (short *dst, const short *src, int nshorts, short konst);
+
+
+#endif /* _INCLUDED_GRI_ADD_CONST_SS_H_ */
diff --git a/gnuradio-core/src/lib/general/gri_add_const_ss_generic.cc b/gnuradio-core/src/lib/general/gri_add_const_ss_generic.cc
new file mode 100644
index 000000000..3b5ee1824
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gri_add_const_ss_generic.cc
@@ -0,0 +1,49 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gri_add_const_ss.h>
+
+void
+gri_add_const_ss (short *dst, const short *src, int nshorts, short konst)
+{
+ static const int STRIDE = 8;
+
+ int i;
+
+ for (i = 0; i < nshorts - (STRIDE - 1); i += STRIDE){
+ dst[i + 0] = src[i + 0] + konst;
+ dst[i + 1] = src[i + 1] + konst;
+ dst[i + 2] = src[i + 2] + konst;
+ dst[i + 3] = src[i + 3] + konst;
+ dst[i + 4] = src[i + 4] + konst;
+ dst[i + 5] = src[i + 5] + konst;
+ dst[i + 6] = src[i + 6] + konst;
+ dst[i + 7] = src[i + 7] + konst;
+ }
+
+ for (; i < nshorts; i++)
+ dst[i] = src[i] + konst;
+}
diff --git a/gnuradio-core/src/lib/general/gri_agc2_cc.h b/gnuradio-core/src/lib/general/gri_agc2_cc.h
new file mode 100644
index 000000000..55aa19b9a
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gri_agc2_cc.h
@@ -0,0 +1,91 @@
+/* -*- 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.
+ */
+
+#ifndef _GRI_AGC2_CC_H_
+#define _GRI_AGC2_CC_H_
+
+#include <gr_core_api.h>
+#include <math.h>
+
+/*!
+ * \brief high performance Automatic Gain Control class
+ *
+ * For Power the absolute value of the complex number is used.
+ */
+class GR_CORE_API gri_agc2_cc {
+
+ public:
+ gri_agc2_cc (float attack_rate = 1e-1, float decay_rate = 1e-2, float reference = 1.0,
+ float gain = 1.0, float max_gain = 0.0)
+ : _attack_rate(attack_rate), _decay_rate(decay_rate), _reference(reference),
+ _gain(gain), _max_gain(max_gain) {};
+
+ float decay_rate () const { return _decay_rate; }
+ float attack_rate () const { return _attack_rate; }
+ float reference () const { return _reference; }
+ float gain () const { return _gain; }
+ float max_gain() const { return _max_gain; }
+
+ void set_decay_rate (float rate) { _decay_rate = rate; }
+ void set_attack_rate (float rate) { _attack_rate = rate; }
+ void set_reference (float reference) { _reference = reference; }
+ void set_gain (float gain) { _gain = gain; }
+ void set_max_gain(float max_gain) { _max_gain = max_gain; }
+
+ gr_complex scale (gr_complex input){
+ gr_complex output = input * _gain;
+
+ float tmp = -_reference + sqrt(output.real()*output.real() +
+ output.imag()*output.imag());
+ float rate = _decay_rate;
+ if((tmp) > _gain)
+ rate = _attack_rate;
+ _gain -= tmp*rate;
+
+#if 0
+ fprintf(stdout, "rate = %f\ttmp = %f\t gain = %f\n", rate, tmp, _gain);
+#endif
+
+ // Not sure about this; will blow up if _gain < 0 (happens when rates are too high),
+ // but is this the solution?
+ if (_gain < 0.0)
+ _gain = 10e-5;
+
+ if (_max_gain > 0.0 && _gain > _max_gain)
+ _gain = _max_gain;
+ return output;
+ }
+
+ void scaleN (gr_complex output[], const gr_complex input[], unsigned n){
+ for (unsigned i = 0; i < n; i++)
+ output[i] = scale (input[i]);
+ }
+
+ protected:
+ float _attack_rate; // attack rate for fast changing signals
+ float _decay_rate; // decay rate for slow changing signals
+ float _reference; // reference value
+ float _gain; // current gain
+ float _max_gain; // max allowable gain
+};
+
+#endif /* _GRI_AGC2_CC_H_ */
diff --git a/gnuradio-core/src/lib/general/gri_agc2_cc.i b/gnuradio-core/src/lib/general/gri_agc2_cc.i
new file mode 100644
index 000000000..08716c6ed
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gri_agc2_cc.i
@@ -0,0 +1,47 @@
+/* -*- 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.
+ */
+
+#include <math.h>
+
+/*!
+ * \brief high performance Automatic Gain Control class with attack and decay rates
+ *
+ * For Power the absolute value of the complex number is used.
+ */
+
+
+class gri_agc2_cc {
+
+ public:
+ gri_agc2_cc (float attack_rate = 1e-1, float decay_rate = 1e-2, float reference = 1.0,
+ float gain = 1.0, float max_gain = 0.0);
+ float decay_rate ();
+ float attack_rate ();
+ float reference ();
+ float gain ();
+ float max_gain ();
+ void set_decay_rate (float rate);
+ void set_attack_rate (float rate);
+ void set_reference (float reference);
+ void set_gain (float gain);
+ void set_max_gain(float max_gain);
+ };
diff --git a/gnuradio-core/src/lib/general/gri_agc2_ff.h b/gnuradio-core/src/lib/general/gri_agc2_ff.h
new file mode 100644
index 000000000..a8b46bec5
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gri_agc2_ff.h
@@ -0,0 +1,90 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002,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.
+ */
+
+#ifndef _GRI_AGC2_FF_H_
+#define _GRI_AGC2_FF_H_
+
+#include <gr_core_api.h>
+#include <math.h>
+
+/*!
+ * \brief high performance Automatic Gain Control class with attack and decay rate
+ *
+ * Power is approximated by absolute value
+ */
+
+class GR_CORE_API gri_agc2_ff {
+
+ public:
+ gri_agc2_ff (float attack_rate = 1e-1, float decay_rate = 1e-2, float reference = 1.0,
+ float gain = 1.0, float max_gain = 0.0)
+ : _attack_rate(attack_rate), _decay_rate(decay_rate), _reference(reference),
+ _gain(gain), _max_gain(max_gain) {};
+
+ float attack_rate () const { return _attack_rate; }
+ float decay_rate () const { return _decay_rate; }
+ float reference () const { return _reference; }
+ float gain () const { return _gain; }
+ float max_gain () const { return _max_gain; }
+
+ void set_attack_rate (float rate) { _attack_rate = rate; }
+ void set_decay_rate (float rate) { _decay_rate = rate; }
+ void set_reference (float reference) { _reference = reference; }
+ void set_gain (float gain) { _gain = gain; }
+ void set_max_gain (float max_gain) { _max_gain = max_gain; }
+
+ float scale (float input){
+ float output = input * _gain;
+
+ float tmp = (fabsf(output)) - _reference;
+ float rate = _decay_rate;
+ if(fabsf(tmp) > _gain)
+ rate = _attack_rate;
+ _gain -= tmp*rate;
+
+#if 0
+ fprintf(stdout, "rate = %f\ttmp = %f\t gain = %f\n", rate, tmp, _gain);
+#endif
+
+ // Not sure about this
+ if (_gain < 0.0)
+ _gain = 10e-5;
+
+ if (_max_gain > 0.0 && _gain > _max_gain)
+ _gain = _max_gain;
+ return output;
+ }
+
+ void scaleN (float output[], const float input[], unsigned n){
+ for (unsigned i = 0; i < n; i++)
+ output[i] = scale (input[i]);
+ }
+
+ protected:
+ float _attack_rate; // attack_rate for fast changing signals
+ float _decay_rate; // decay rate for slow changing signals
+ float _reference; // reference value
+ float _gain; // current gain
+ float _max_gain; // maximum gain
+};
+
+#endif /* _GRI_AGC2_FF_H_ */
diff --git a/gnuradio-core/src/lib/general/gri_agc2_ff.i b/gnuradio-core/src/lib/general/gri_agc2_ff.i
new file mode 100644
index 000000000..9f97d8f0d
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gri_agc2_ff.i
@@ -0,0 +1,47 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005,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.
+ */
+
+#include <math.h>
+
+/*!
+ * \brief high performance Automatic Gain Control class
+ *
+ * Power is approximated by absolute value
+ */
+
+
+class gri_agc2_ff {
+
+ public:
+ gri_agc2_ff (float attack_rate = 1e-1, float decay_rate = 1e-2,
+ float reference = 1.0, float gain = 1.0, float max_gain = 0.0);
+ float attack_rate ();
+ float decay_rate ();
+ float reference ();
+ float gain ();
+ float max_gain ();
+ void set_attack_rate (float rate);
+ void set_decay_rate (float rate);
+ void set_reference (float reference);
+ void set_gain (float gain);
+ void set_max_gain (float max_gain);
+ };
diff --git a/gnuradio-core/src/lib/general/gri_agc_cc.h b/gnuradio-core/src/lib/general/gri_agc_cc.h
new file mode 100644
index 000000000..90edc5dcd
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gri_agc_cc.h
@@ -0,0 +1,75 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_GRI_AGC_CC_H
+#define INCLUDED_GRI_AGC_CC_H
+
+#include <gr_core_api.h>
+#include <math.h>
+
+/*!
+ * \brief high performance Automatic Gain Control class
+ *
+ * For Power the absolute value of the complex number is used.
+ */
+
+class GR_CORE_API gri_agc_cc {
+
+ public:
+ gri_agc_cc (float rate = 1e-4, float reference = 1.0,
+ float gain = 1.0, float max_gain = 0.0)
+ : _rate(rate), _reference(reference),
+ _gain(gain), _max_gain(max_gain) {};
+
+ float rate () const { return _rate; }
+ float reference () const { return _reference; }
+ float gain () const { return _gain; }
+ float max_gain() const { return _max_gain; }
+
+ void set_rate (float rate) { _rate = rate; }
+ void set_reference (float reference) { _reference = reference; }
+ void set_gain (float gain) { _gain = gain; }
+ void set_max_gain(float max_gain) { _max_gain = max_gain; }
+
+ gr_complex scale (gr_complex input){
+ gr_complex output = input * _gain;
+
+ _gain += _rate * (_reference - sqrt(output.real()*output.real() +
+ output.imag()*output.imag()));
+ if (_max_gain > 0.0 && _gain > _max_gain)
+ _gain = _max_gain;
+ return output;
+ }
+
+ void scaleN (gr_complex output[], const gr_complex input[], unsigned n){
+ for (unsigned i = 0; i < n; i++)
+ output[i] = scale (input[i]);
+ }
+
+ protected:
+ float _rate; // adjustment rate
+ float _reference; // reference value
+ float _gain; // current gain
+ float _max_gain; // max allowable gain
+};
+
+#endif /* INCLUDED_GRI_AGC_CC_H */
diff --git a/gnuradio-core/src/lib/general/gri_agc_cc.i b/gnuradio-core/src/lib/general/gri_agc_cc.i
new file mode 100644
index 000000000..d3dd9b61b
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gri_agc_cc.i
@@ -0,0 +1,41 @@
+/* -*- 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.
+ */
+
+#include <math.h>
+
+/*!
+ * \brief high performance Automatic Gain Control class
+ *
+ * For Power the absolute value of the complex number is used.
+ */
+
+
+class gri_agc_cc {
+
+ public:
+ gri_agc_cc (float rate = 1e-4, float reference = 1.0,
+ float gain = 1.0, float max_gain = 0.0);
+ float rate ();
+ float reference ();
+ float gain ();
+ float max_gain ();
+ };
diff --git a/gnuradio-core/src/lib/general/gri_agc_ff.h b/gnuradio-core/src/lib/general/gri_agc_ff.h
new file mode 100644
index 000000000..1c233c746
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gri_agc_ff.h
@@ -0,0 +1,72 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002,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.
+ */
+
+#ifndef INCLUDED_GRI_AGC_FF_H
+#define INCLUDED_GRI_AGC_FF_H
+
+#include <gr_core_api.h>
+#include <math.h>
+
+/*!
+ * \brief high performance Automatic Gain Control class
+ *
+ * Power is approximated by absolute value
+ */
+class GR_CORE_API gri_agc_ff {
+
+ public:
+ gri_agc_ff (float rate = 1e-4, float reference = 1.0,
+ float gain = 1.0, float max_gain = 0.0)
+ : _rate(rate), _reference(reference), _gain(gain), _max_gain(max_gain) {};
+
+ float rate () const { return _rate; }
+ float reference () const { return _reference; }
+ float gain () const { return _gain; }
+ float max_gain () const { return _max_gain; }
+
+ void set_rate (float rate) { _rate = rate; }
+ void set_reference (float reference) { _reference = reference; }
+ void set_gain (float gain) { _gain = gain; }
+ void set_max_gain (float max_gain) { _max_gain = max_gain; }
+
+ float scale (float input){
+ float output = input * _gain;
+ _gain += (_reference - fabsf (output)) * _rate;
+ if (_max_gain > 0.0 && _gain > _max_gain)
+ _gain = _max_gain;
+ return output;
+ }
+
+ void scaleN (float output[], const float input[], unsigned n){
+ for (unsigned i = 0; i < n; i++)
+ output[i] = scale (input[i]);
+ }
+
+ protected:
+ float _rate; // adjustment rate
+ float _reference; // reference value
+ float _gain; // current gain
+ float _max_gain; // maximum gain
+};
+
+#endif /* INCLUDED_GRI_AGC_FF_H */
+
diff --git a/gnuradio-core/src/lib/general/gri_agc_ff.i b/gnuradio-core/src/lib/general/gri_agc_ff.i
new file mode 100644
index 000000000..df4acf7af
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gri_agc_ff.i
@@ -0,0 +1,36 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005,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.
+ */
+
+#include <math.h>
+
+/*!
+ * \brief high performance Automatic Gain Control class
+ *
+ * Power is approximated by absolute value
+ */
+
+class gri_agc_ff {
+
+ public:
+ gri_agc_ff (float rate = 1e-4, float reference = 1.0,
+ float gain = 1.0, float max_gain = 0.0);
+};
diff --git a/gnuradio-core/src/lib/general/gri_char_to_float.cc b/gnuradio-core/src/lib/general/gri_char_to_float.cc
new file mode 100644
index 000000000..fd9a6636a
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gri_char_to_float.cc
@@ -0,0 +1,40 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005 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 <gri_char_to_float.h>
+
+void
+gri_char_to_float (const char *in, float *out, int nsamples)
+{
+ while (nsamples >= 4){
+ out[0] = in[0];
+ out[1] = in[1];
+ out[2] = in[2];
+ out[3] = in[3];
+ out += 4;
+ in += 4;
+ nsamples -= 4;
+ }
+
+ while (nsamples-- > 0)
+ *out++ = *in++;
+}
diff --git a/gnuradio-core/src/lib/general/gri_char_to_float.h b/gnuradio-core/src/lib/general/gri_char_to_float.h
new file mode 100644
index 000000000..8bd3bfde7
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gri_char_to_float.h
@@ -0,0 +1,34 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005 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_GRI_CHAR_TO_FLOAT_H
+#define INCLUDED_GRI_CHAR_TO_FLOAT_H
+
+#include <gr_core_api.h>
+
+/*
+ * convert array of chars to floats
+ */
+GR_CORE_API void gri_char_to_float (const char *in, float *out, int nsamples);
+
+
+#endif /* INCLUDED_GRI_CHAR_TO_FLOAT_H */ \ No newline at end of file
diff --git a/gnuradio-core/src/lib/general/gri_control_loop.cc b/gnuradio-core/src/lib/general/gri_control_loop.cc
new file mode 100644
index 000000000..bb3c4a326
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gri_control_loop.cc
@@ -0,0 +1,210 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gri_control_loop.h>
+#include <gr_math.h>
+#include <stdexcept>
+
+#define M_TWOPI (2.0f*M_PI)
+
+gri_control_loop::gri_control_loop(float loop_bw,
+ float max_freq, float min_freq)
+ : d_phase(0), d_freq(0), d_max_freq(max_freq), d_min_freq(min_freq)
+{
+ // Set the damping factor for a critically damped system
+ d_damping = sqrtf(2.0f)/2.0f;
+
+ // Set the bandwidth, which will then call update_gains()
+ set_loop_bandwidth(loop_bw);
+}
+
+gri_control_loop::~gri_control_loop()
+{
+}
+
+void
+gri_control_loop::update_gains()
+{
+ float denom = (1.0 + 2.0*d_damping*d_loop_bw + d_loop_bw*d_loop_bw);
+ d_alpha = (4*d_damping*d_loop_bw) / denom;
+ d_beta = (4*d_loop_bw*d_loop_bw) / denom;
+}
+
+void
+gri_control_loop::advance_loop(float error)
+{
+ d_freq = d_freq + d_beta * error;
+ d_phase = d_phase + d_freq + d_alpha * error;
+}
+
+
+void
+gri_control_loop::phase_wrap()
+{
+ while(d_phase>M_TWOPI)
+ d_phase -= M_TWOPI;
+ while(d_phase<-M_TWOPI)
+ d_phase += M_TWOPI;
+}
+
+void
+gri_control_loop::frequency_limit()
+{
+ if (d_freq > d_max_freq)
+ d_freq = d_max_freq;
+ else if (d_freq < d_min_freq)
+ d_freq = d_min_freq;
+}
+
+/*******************************************************************
+ SET FUNCTIONS
+*******************************************************************/
+
+void
+gri_control_loop::set_loop_bandwidth(float bw)
+{
+ if(bw < 0) {
+ throw std::out_of_range ("gri_control_loop: invalid bandwidth. Must be >= 0.");
+ }
+
+ d_loop_bw = bw;
+ update_gains();
+}
+
+void
+gri_control_loop::set_damping_factor(float df)
+{
+ if(df < 0 || df > 1.0) {
+ throw std::out_of_range ("gri_control_loop: invalid damping factor. Must be in [0,1].");
+ }
+
+ d_damping = df;
+ update_gains();
+}
+
+void
+gri_control_loop::set_alpha(float alpha)
+{
+ if(alpha < 0 || alpha > 1.0) {
+ throw std::out_of_range ("gri_control_loop: invalid alpha. Must be in [0,1].");
+ }
+ d_alpha = alpha;
+}
+
+void
+gri_control_loop::set_beta(float beta)
+{
+ if(beta < 0 || beta > 1.0) {
+ throw std::out_of_range ("gri_control_loop: invalid beta. Must be in [0,1].");
+ }
+ d_beta = beta;
+}
+
+void
+gri_control_loop::set_frequency(float freq)
+{
+ if(freq > d_max_freq)
+ d_freq = d_min_freq;
+ else if(freq < d_min_freq)
+ d_freq = d_max_freq;
+ else
+ d_freq = freq;
+}
+
+void
+gri_control_loop::set_phase(float phase)
+{
+ d_phase = phase;
+ while(d_phase>M_TWOPI)
+ d_phase -= M_TWOPI;
+ while(d_phase<-M_TWOPI)
+ d_phase += M_TWOPI;
+}
+
+void
+gri_control_loop::set_max_freq(float freq)
+{
+ d_max_freq = freq;
+}
+
+void
+gri_control_loop::set_min_freq(float freq)
+{
+ d_min_freq = freq;
+}
+
+/*******************************************************************
+ GET FUNCTIONS
+*******************************************************************/
+
+
+float
+gri_control_loop::get_loop_bandwidth() const
+{
+ return d_loop_bw;
+}
+
+float
+gri_control_loop::get_damping_factor() const
+{
+ return d_damping;
+}
+
+float
+gri_control_loop::get_alpha() const
+{
+ return d_alpha;
+}
+
+float
+gri_control_loop::get_beta() const
+{
+ return d_beta;
+}
+
+float
+gri_control_loop::get_frequency() const
+{
+ return d_freq;
+}
+
+float
+gri_control_loop::get_phase() const
+{
+ return d_phase;
+}
+
+float
+gri_control_loop::get_max_freq() const
+{
+ return d_max_freq;
+}
+
+float
+gri_control_loop::get_min_freq() const
+{
+ return d_min_freq;
+}
diff --git a/gnuradio-core/src/lib/general/gri_control_loop.h b/gnuradio-core/src/lib/general/gri_control_loop.h
new file mode 100644
index 000000000..304857ac7
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gri_control_loop.h
@@ -0,0 +1,230 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+#ifndef GRI_CONTROL_LOOP
+#define GRI_CONTROL_LOOP
+
+#include <gr_core_api.h>
+
+class GR_CORE_API gri_control_loop
+{
+ protected:
+ float d_phase, d_freq;
+ float d_max_freq, d_min_freq;
+ float d_damping, d_loop_bw;
+ float d_alpha, d_beta;
+
+ public:
+ gri_control_loop(float loop_bw, float max_freq, float min_freq);
+ virtual ~gri_control_loop();
+
+ /*! \brief update the system gains from the loop bandwidth and damping factor
+ *
+ * This function updates the system gains based on the loop
+ * bandwidth and damping factor of the system.
+ * These two factors can be set separately through their own
+ * set functions.
+ */
+ void update_gains();
+
+ /*! \brief update the system gains from the loop bandwidth and damping factor
+ *
+ * This function updates the system gains based on the loop
+ * bandwidth and damping factor of the system.
+ * These two factors can be set separately through their own
+ * set functions.
+ */
+ void advance_loop(float error);
+
+ /*! \brief Keep the phase between -2pi and 2pi
+ *
+ * This function keeps the phase between -2pi and 2pi. If the phase
+ * is greater than 2pi by d, it wraps around to be -2pi+d; similarly if
+ * it is less than -2pi by d, it wraps around to 2pi-d.
+ *
+ * This function should be called after advance_loop to keep the phase
+ * in a good operating region. It is set as a separate method in case
+ * another way is desired as this is fairly heavy-handed.
+ */
+ void phase_wrap();
+
+ /*! \brief Keep the frequency between d_min_freq and d_max_freq
+ *
+ * This function keeps the frequency between d_min_freq and d_max_freq.
+ * If the frequency is greater than d_max_freq, it is set to d_max_freq.
+ * If the frequency is less than d_min_freq, it is set to d_min_freq.
+ *
+ * This function should be called after advance_loop to keep the frequency
+ * in the specified region. It is set as a separate method in case
+ * another way is desired as this is fairly heavy-handed.
+ */
+ void frequency_limit();
+
+ /*******************************************************************
+ SET FUNCTIONS
+ *******************************************************************/
+
+ /*!
+ * \brief Set the loop bandwidth
+ *
+ * Set the loop filter's bandwidth to \p bw. This should be between
+ * 2*pi/200 and 2*pi/100 (in rads/samp). It must also be a positive
+ * number.
+ *
+ * When a new damping factor is set, the gains, alpha and beta, of the loop
+ * are recalculated by a call to update_gains().
+ *
+ * \param bw (float) new bandwidth
+ *
+ */
+ void set_loop_bandwidth(float bw);
+
+ /*!
+ * \brief Set the loop damping factor
+ *
+ * Set the loop filter's damping factor to \p df. The damping factor
+ * should be sqrt(2)/2.0 for critically damped systems.
+ * Set it to anything else only if you know what you are doing. It must
+ * be a number between 0 and 1.
+ *
+ * When a new damping factor is set, the gains, alpha and beta, of the loop
+ * are recalculated by a call to update_gains().
+ *
+ * \param df (float) new damping factor
+ *
+ */
+ void set_damping_factor(float df);
+
+ /*!
+ * \brief Set the loop gain alpha
+ *
+ * Set's the loop filter's alpha gain parameter.
+ *
+ * This value should really only be set by adjusting the loop bandwidth
+ * and damping factor.
+ *
+ * \param alpha (float) new alpha gain
+ *
+ */
+ void set_alpha(float alpha);
+
+ /*!
+ * \brief Set the loop gain beta
+ *
+ * Set's the loop filter's beta gain parameter.
+ *
+ * This value should really only be set by adjusting the loop bandwidth
+ * and damping factor.
+ *
+ * \param beta (float) new beta gain
+ *
+ */
+ void set_beta(float beta);
+
+ /*!
+ * \brief Set the control loop's frequency.
+ *
+ * Set's the control loop's frequency. While this is normally updated by the
+ * inner loop of the algorithm, it could be useful to manually initialize,
+ * set, or reset this under certain circumstances.
+ *
+ * \param freq (float) new frequency
+ *
+ */
+ void set_frequency(float freq);
+
+ /*!
+ * \brief Set the control loop's phase.
+ *
+ * Set's the control loop's phase. While this is normally updated by the
+ * inner loop of the algorithm, it could be useful to manually initialize,
+ * set, or reset this under certain circumstances.
+ *
+ * \param phase (float) new phase
+ *
+ */
+ void set_phase(float phase);
+
+ /*!
+ * \brief Set the control loop's maximum frequency.
+ *
+ * Set the maximum frequency the control loop can track.
+ *
+ * \param freq (float) new max frequency
+ */
+ void set_max_freq(float freq);
+
+ /*!
+ * \brief Set the control loop's minimum frequency.
+ *
+ * Set the minimum frequency the control loop can track.
+ *
+ * \param freq (float) new min frequency
+ */
+ void set_min_freq(float freq);
+
+ /*******************************************************************
+ GET FUNCTIONS
+ *******************************************************************/
+
+ /*!
+ * \brief Returns the loop bandwidth
+ */
+ float get_loop_bandwidth() const;
+
+ /*!
+ * \brief Returns the loop damping factor
+ */
+ float get_damping_factor() const;
+
+ /*!
+ * \brief Returns the loop gain alpha
+ */
+ float get_alpha() const;
+
+ /*!
+ * \brief Returns the loop gain beta
+ */
+ float get_beta() const;
+
+ /*!
+ * \brief Get the control loop's frequency estimate
+ */
+ float get_frequency() const;
+
+ /*!
+ * \brief Get the control loop's phase estimate
+ */
+ float get_phase() const;
+
+ /*!
+ * \brief Get the control loop's maximum frequency.
+ */
+ float get_max_freq() const;
+
+ /*!
+ * \brief Get the control loop's minimum frequency.
+ */
+ float get_min_freq() const;
+};
+
+#endif /* GRI_CONTROL_LOOP */
diff --git a/gnuradio-core/src/lib/general/gri_control_loop.i b/gnuradio-core/src/lib/general/gri_control_loop.i
new file mode 100644
index 000000000..8a23207e5
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gri_control_loop.i
@@ -0,0 +1,57 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+
+class gri_control_loop
+{
+ public:
+ gri_control_loop(float loop_bw, float max_freq, float min_freq);
+ virtual ~gri_control_loop();
+
+ void update_gains();
+ void advance_loop(float error);
+ void phase_wrap();
+ void frequency_limit();
+
+ /*******************************************************************
+ SET FUNCTIONS
+ *******************************************************************/
+
+ void set_loop_bandwidth(float bw);
+ void set_damping_factor(float df);
+ void set_alpha(float alpha);
+ void set_beta(float beta);
+ void set_frequency(float freq);
+ void set_phase(float phase);
+
+
+ /*******************************************************************
+ GET FUNCTIONS
+ *******************************************************************/
+
+ float get_loop_bandwidth() const;
+ float get_damping_factor() const;
+ float get_alpha() const;
+ float get_beta() const;
+ float get_frequency() const;
+ float get_phase() const;
+};
diff --git a/gnuradio-core/src/lib/general/gri_debugger_hook.cc b/gnuradio-core/src/lib/general/gri_debugger_hook.cc
new file mode 100644
index 000000000..d9270c435
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gri_debugger_hook.cc
@@ -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.
+ */
+
+#include <gri_debugger_hook.h>
+
+void
+gri_debugger_hook ()
+{
+ // nop. set a breakpoint here
+}
diff --git a/gnuradio-core/src/lib/general/gri_debugger_hook.h b/gnuradio-core/src/lib/general/gri_debugger_hook.h
new file mode 100644
index 000000000..c871c7bf6
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gri_debugger_hook.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_GRI_DEBUGGER_HOOK_H
+#define INCLUDED_GRI_DEBUGGER_HOOK_H
+
+#include <gr_core_api.h>
+
+GR_CORE_API void gri_debugger_hook ();
+
+#endif /* INCLUDED_GRI_DEBUGGER_HOOK_H */ \ No newline at end of file
diff --git a/gnuradio-core/src/lib/general/gri_fft.cc b/gnuradio-core/src/lib/general/gri_fft.cc
new file mode 100644
index 000000000..68e7e6951
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gri_fft.cc
@@ -0,0 +1,330 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2003,2008,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.
+ */
+
+#include <gri_fft.h>
+#include <gr_sys_paths.h>
+#include <fftw3.h>
+
+#ifdef _MSC_VER //http://www.fftw.org/install/windows.html#DLLwisdom
+static void my_fftw_write_char(char c, void *f) { fputc(c, (FILE *) f); }
+#define fftw_export_wisdom_to_file(f) fftw_export_wisdom(my_fftw_write_char, (void*) (f))
+#define fftwf_export_wisdom_to_file(f) fftwf_export_wisdom(my_fftw_write_char, (void*) (f))
+#define fftwl_export_wisdom_to_file(f) fftwl_export_wisdom(my_fftw_write_char, (void*) (f))
+
+static int my_fftw_read_char(void *f) { return fgetc((FILE *) f); }
+#define fftw_import_wisdom_from_file(f) fftw_import_wisdom(my_fftw_read_char, (void*) (f))
+#define fftwf_import_wisdom_from_file(f) fftwf_import_wisdom(my_fftw_read_char, (void*) (f))
+#define fftwl_import_wisdom_from_file(f) fftwl_import_wisdom(my_fftw_read_char, (void*) (f))
+#endif //_MSC_VER
+
+#include <gr_complex.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+#include <cassert>
+#include <stdexcept>
+
+#include <boost/filesystem/operations.hpp>
+#include <boost/filesystem/path.hpp>
+namespace fs = boost::filesystem;
+
+gr_complex *
+gri_fft_malloc_complex(int size)
+{
+ return (gr_complex*)fftwf_malloc(sizeof(gr_complex)*size);
+}
+
+float *
+gri_fft_malloc_float(int size)
+{
+ return (float*)fftwf_malloc(sizeof(float)*size);
+}
+
+void
+gri_fft_free(void *b)
+{
+ fftwf_free(b);
+}
+
+boost::mutex &
+gri_fft_planner::mutex()
+{
+ static boost::mutex s_planning_mutex;
+
+ return s_planning_mutex;
+}
+
+static const char *
+wisdom_filename ()
+{
+ static fs::path path;
+ path = fs::path(gr_appdata_path()) / ".gr_fftw_wisdom";
+ return path.string().c_str();
+}
+
+static void
+gri_fftw_import_wisdom ()
+{
+ const char *filename = wisdom_filename ();
+ FILE *fp = fopen (filename, "r");
+ if (fp != 0){
+ int r = fftwf_import_wisdom_from_file (fp);
+ fclose (fp);
+ if (!r){
+ fprintf (stderr, "gri_fftw: can't import wisdom from %s\n", filename);
+ }
+ }
+}
+
+static void
+gri_fftw_config_threading (int nthreads)
+{
+ static int fftw_threads_inited = 0;
+
+#ifdef FFTW3F_THREADS
+ if (fftw_threads_inited == 0)
+ {
+ fftw_threads_inited = 1;
+ fftwf_init_threads();
+ }
+
+ fftwf_plan_with_nthreads(nthreads);
+#endif
+}
+
+static void
+gri_fftw_export_wisdom ()
+{
+ const char *filename = wisdom_filename ();
+ FILE *fp = fopen (filename, "w");
+ if (fp != 0){
+ fftwf_export_wisdom_to_file (fp);
+ fclose (fp);
+ }
+ else {
+ fprintf (stderr, "gri_fftw: ");
+ perror (filename);
+ }
+}
+
+// ----------------------------------------------------------------
+
+gri_fft_complex::gri_fft_complex (int fft_size, bool forward, int nthreads)
+{
+ // Hold global mutex during plan construction and destruction.
+ gri_fft_planner::scoped_lock lock(gri_fft_planner::mutex());
+
+ assert (sizeof (fftwf_complex) == sizeof (gr_complex));
+
+ if (fft_size <= 0)
+ throw std::out_of_range ("gri_fftw: invalid fft_size");
+
+ d_fft_size = fft_size;
+ d_inbuf = (gr_complex *) fftwf_malloc (sizeof (gr_complex) * inbuf_length ());
+ if (d_inbuf == 0)
+ throw std::runtime_error ("fftwf_malloc");
+
+ d_outbuf = (gr_complex *) fftwf_malloc (sizeof (gr_complex) * outbuf_length ());
+ if (d_outbuf == 0){
+ fftwf_free (d_inbuf);
+ throw std::runtime_error ("fftwf_malloc");
+ }
+
+ d_nthreads = nthreads;
+ gri_fftw_config_threading (nthreads);
+ gri_fftw_import_wisdom (); // load prior wisdom from disk
+
+ d_plan = fftwf_plan_dft_1d (fft_size,
+ reinterpret_cast<fftwf_complex *>(d_inbuf),
+ reinterpret_cast<fftwf_complex *>(d_outbuf),
+ forward ? FFTW_FORWARD : FFTW_BACKWARD,
+ FFTW_MEASURE);
+
+ if (d_plan == NULL) {
+ fprintf(stderr, "gri_fft_complex: error creating plan\n");
+ throw std::runtime_error ("fftwf_plan_dft_1d failed");
+ }
+ gri_fftw_export_wisdom (); // store new wisdom to disk
+}
+
+gri_fft_complex::~gri_fft_complex ()
+{
+ // Hold global mutex during plan construction and destruction.
+ gri_fft_planner::scoped_lock lock(gri_fft_planner::mutex());
+
+ fftwf_destroy_plan ((fftwf_plan) d_plan);
+ fftwf_free (d_inbuf);
+ fftwf_free (d_outbuf);
+}
+
+void
+gri_fft_complex::set_nthreads(int n)
+{
+ if (n <= 0)
+ throw std::out_of_range ("gri_fftw: invalid number of threads");
+ d_nthreads = n;
+
+#ifdef FFTW3F_THREADS
+ fftwf_plan_with_nthreads(d_nthreads);
+#endif
+}
+
+void
+gri_fft_complex::execute ()
+{
+ fftwf_execute ((fftwf_plan) d_plan);
+}
+
+// ----------------------------------------------------------------
+
+gri_fft_real_fwd::gri_fft_real_fwd (int fft_size, int nthreads)
+{
+ // Hold global mutex during plan construction and destruction.
+ gri_fft_planner::scoped_lock lock(gri_fft_planner::mutex());
+
+ assert (sizeof (fftwf_complex) == sizeof (gr_complex));
+
+ if (fft_size <= 0)
+ throw std::out_of_range ("gri_fftw: invalid fft_size");
+
+ d_fft_size = fft_size;
+ d_inbuf = (float *) fftwf_malloc (sizeof (float) * inbuf_length ());
+ if (d_inbuf == 0)
+ throw std::runtime_error ("fftwf_malloc");
+
+ d_outbuf = (gr_complex *) fftwf_malloc (sizeof (gr_complex) * outbuf_length ());
+ if (d_outbuf == 0){
+ fftwf_free (d_inbuf);
+ throw std::runtime_error ("fftwf_malloc");
+ }
+
+ d_nthreads = nthreads;
+ gri_fftw_config_threading (nthreads);
+ gri_fftw_import_wisdom (); // load prior wisdom from disk
+
+ d_plan = fftwf_plan_dft_r2c_1d (fft_size,
+ d_inbuf,
+ reinterpret_cast<fftwf_complex *>(d_outbuf),
+ FFTW_MEASURE);
+
+ if (d_plan == NULL) {
+ fprintf(stderr, "gri_fft_real_fwd: error creating plan\n");
+ throw std::runtime_error ("fftwf_plan_dft_r2c_1d failed");
+ }
+ gri_fftw_export_wisdom (); // store new wisdom to disk
+}
+
+gri_fft_real_fwd::~gri_fft_real_fwd ()
+{
+ // Hold global mutex during plan construction and destruction.
+ gri_fft_planner::scoped_lock lock(gri_fft_planner::mutex());
+
+ fftwf_destroy_plan ((fftwf_plan) d_plan);
+ fftwf_free (d_inbuf);
+ fftwf_free (d_outbuf);
+}
+
+void
+gri_fft_real_fwd::set_nthreads(int n)
+{
+ if (n <= 0)
+ throw std::out_of_range ("gri_fftw: invalid number of threads");
+ d_nthreads = n;
+
+#ifdef FFTW3F_THREADS
+ fftwf_plan_with_nthreads(d_nthreads);
+#endif
+}
+
+void
+gri_fft_real_fwd::execute ()
+{
+ fftwf_execute ((fftwf_plan) d_plan);
+}
+
+// ----------------------------------------------------------------
+
+gri_fft_real_rev::gri_fft_real_rev (int fft_size, int nthreads)
+{
+ // Hold global mutex during plan construction and destruction.
+ gri_fft_planner::scoped_lock lock(gri_fft_planner::mutex());
+
+ assert (sizeof (fftwf_complex) == sizeof (gr_complex));
+
+ if (fft_size <= 0)
+ throw std::out_of_range ("gri_fftw: invalid fft_size");
+
+ d_fft_size = fft_size;
+ d_inbuf = (gr_complex *) fftwf_malloc (sizeof (gr_complex) * inbuf_length ());
+ if (d_inbuf == 0)
+ throw std::runtime_error ("fftwf_malloc");
+
+ d_outbuf = (float *) fftwf_malloc (sizeof (float) * outbuf_length ());
+ if (d_outbuf == 0){
+ fftwf_free (d_inbuf);
+ throw std::runtime_error ("fftwf_malloc");
+ }
+
+ d_nthreads = nthreads;
+ gri_fftw_config_threading (nthreads);
+ gri_fftw_import_wisdom (); // load prior wisdom from disk
+
+ // FIXME If there's ever a chance that the planning functions
+ // will be called in multiple threads, we've got to ensure single
+ // threaded access. They are not thread-safe.
+ d_plan = fftwf_plan_dft_c2r_1d (fft_size,
+ reinterpret_cast<fftwf_complex *>(d_inbuf),
+ d_outbuf,
+ FFTW_MEASURE);
+
+ if (d_plan == NULL) {
+ fprintf(stderr, "gri_fft_real_rev: error creating plan\n");
+ throw std::runtime_error ("fftwf_plan_dft_c2r_1d failed");
+ }
+ gri_fftw_export_wisdom (); // store new wisdom to disk
+}
+
+gri_fft_real_rev::~gri_fft_real_rev ()
+{
+ fftwf_destroy_plan ((fftwf_plan) d_plan);
+ fftwf_free (d_inbuf);
+ fftwf_free (d_outbuf);
+}
+
+void
+gri_fft_real_rev::set_nthreads(int n)
+{
+ if (n <= 0)
+ throw std::out_of_range ("gri_fftw: invalid number of threads");
+ d_nthreads = n;
+
+#ifdef FFTW3F_THREADS
+ fftwf_plan_with_nthreads(d_nthreads);
+#endif
+}
+
+void
+gri_fft_real_rev::execute ()
+{
+ fftwf_execute ((fftwf_plan) d_plan);
+}
+
diff --git a/gnuradio-core/src/lib/general/gri_fft.h b/gnuradio-core/src/lib/general/gri_fft.h
new file mode 100644
index 000000000..65e9d046e
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gri_fft.h
@@ -0,0 +1,185 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2003,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.
+ */
+#ifndef _GRI_FFT_H_
+#define _GRI_FFT_H_
+
+/*
+ * Wrappers for FFTW single precision 1d dft
+ */
+
+#include <gr_core_api.h>
+#include <gr_complex.h>
+#include <boost/thread.hpp>
+
+/*! \brief Helper function for allocating complex fft buffers
+ */
+gr_complex* gri_fft_malloc_complex(int size);
+
+/*! \brief Helper function for allocating float fft buffers
+ */
+float* gri_fft_malloc_float(int size);
+
+/*! \brief Helper function for freeing fft buffers
+ */
+void gri_fft_free(void *b);
+
+
+/*!
+ * \brief Export reference to planner mutex for those apps that
+ * want to use FFTW w/o using the gri_fftw* classes.
+ */
+class GR_CORE_API gri_fft_planner {
+public:
+ typedef boost::mutex::scoped_lock scoped_lock;
+ /*!
+ * Return reference to planner mutex
+ */
+ static boost::mutex &mutex();
+};
+
+/*!
+ * \brief FFT: complex in, complex out
+ * \ingroup misc
+ */
+class GR_CORE_API gri_fft_complex {
+ int d_fft_size;
+ int d_nthreads;
+ gr_complex *d_inbuf;
+ gr_complex *d_outbuf;
+ void *d_plan;
+
+public:
+ gri_fft_complex (int fft_size, bool forward = true, int nthreads=1);
+ virtual ~gri_fft_complex ();
+
+ /*
+ * These return pointers to buffers owned by gri_fft_complex into which
+ * input and output take place. It's done this way in order to
+ * ensure optimal alignment for SIMD instructions.
+ */
+ gr_complex *get_inbuf () const { return d_inbuf; }
+ gr_complex *get_outbuf () const { return d_outbuf; }
+
+ int inbuf_length () const { return d_fft_size; }
+ int outbuf_length () const { return d_fft_size; }
+
+ /*!
+ * Set the number of threads to use for caclulation.
+ */
+ void set_nthreads(int n);
+
+ /*!
+ * Get the number of threads being used by FFTW
+ */
+ int nthreads() const { return d_nthreads; }
+
+ /*!
+ * compute FFT. The input comes from inbuf, the output is placed in outbuf.
+ */
+ void execute ();
+};
+
+/*!
+ * \brief FFT: real in, complex out
+ * \ingroup misc
+ */
+class GR_CORE_API gri_fft_real_fwd {
+ int d_fft_size;
+ int d_nthreads;
+ float *d_inbuf;
+ gr_complex *d_outbuf;
+ void *d_plan;
+
+public:
+ gri_fft_real_fwd (int fft_size, int nthreads=1);
+ virtual ~gri_fft_real_fwd ();
+
+ /*
+ * These return pointers to buffers owned by gri_fft_real_fwd into
+ * which input and output take place. It's done this way in order
+ * to ensure optimal alignment for SIMD instructions.
+ */
+ float *get_inbuf () const { return d_inbuf; }
+ gr_complex *get_outbuf () const { return d_outbuf; }
+
+ int inbuf_length () const { return d_fft_size; }
+ int outbuf_length () const { return d_fft_size / 2 + 1; }
+
+ /*!
+ * Set the number of threads to use for caclulation.
+ */
+ void set_nthreads(int n);
+
+ /*!
+ * Get the number of threads being used by FFTW
+ */
+ int nthreads() const { return d_nthreads; }
+
+ /*!
+ * compute FFT. The input comes from inbuf, the output is placed in outbuf.
+ */
+ void execute ();
+};
+
+/*!
+ * \brief FFT: complex in, float out
+ * \ingroup misc
+ */
+class GR_CORE_API gri_fft_real_rev {
+ int d_fft_size;
+ int d_nthreads;
+ gr_complex *d_inbuf;
+ float *d_outbuf;
+ void *d_plan;
+
+public:
+ gri_fft_real_rev (int fft_size, int nthreads=1);
+ virtual ~gri_fft_real_rev ();
+
+ /*
+ * These return pointers to buffers owned by gri_fft_real_rev into
+ * which input and output take place. It's done this way in order
+ * to ensure optimal alignment for SIMD instructions.
+ */
+ gr_complex *get_inbuf () const { return d_inbuf; }
+ float *get_outbuf () const { return d_outbuf; }
+
+ int inbuf_length () const { return d_fft_size / 2 + 1; }
+ int outbuf_length () const { return d_fft_size; }
+
+ /*!
+ * Set the number of threads to use for caclulation.
+ */
+ void set_nthreads(int n);
+
+ /*!
+ * Get the number of threads being used by FFTW
+ */
+ int nthreads() const { return d_nthreads; }
+
+ /*!
+ * compute FFT. The input comes from inbuf, the output is placed in outbuf.
+ */
+ void execute ();
+};
+
+#endif
diff --git a/gnuradio-core/src/lib/general/gri_float_to_char.cc b/gnuradio-core/src/lib/general/gri_float_to_char.cc
new file mode 100644
index 000000000..3e779b0e7
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gri_float_to_char.cc
@@ -0,0 +1,46 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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
+
+#define _ISOC9X_SOURCE
+#include <gri_float_to_char.h>
+#include <math.h>
+
+static const int MIN_CHAR = -128;
+static const int MAX_CHAR = 127;
+
+
+void
+gri_float_to_char (const float *in, char *out, int nsamples)
+{
+ for (int i = 0; i < nsamples; i++){
+ long int r = (long int) rint (in[i]);
+ if (r < MIN_CHAR)
+ r = MIN_CHAR;
+ else if (r > MAX_CHAR)
+ r = MAX_CHAR;
+ out[i] = r;
+ }
+}
diff --git a/gnuradio-core/src/lib/general/gri_float_to_char.h b/gnuradio-core/src/lib/general/gri_float_to_char.h
new file mode 100644
index 000000000..172a7da65
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gri_float_to_char.h
@@ -0,0 +1,33 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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_GRI_FLOAT_TO_CHAR_H
+#define INCLUDED_GRI_FLOAT_TO_CHAR_H
+
+#include <gr_core_api.h>
+
+/*!
+ * convert array of floats to chars with rounding and saturation.
+ */
+GR_CORE_API void gri_float_to_char (const float *in, char *out, int nsamples);
+
+#endif /* INCLUDED_GRI_FLOAT_TO_CHAR_H */
diff --git a/gnuradio-core/src/lib/general/gri_float_to_int.cc b/gnuradio-core/src/lib/general/gri_float_to_int.cc
new file mode 100644
index 000000000..525ea675d
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gri_float_to_int.cc
@@ -0,0 +1,47 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#define _ISOC9X_SOURCE
+#include <gri_float_to_int.h>
+#include <math.h>
+#include <stdint.h>
+
+static const int64_t MAX_INT = 2147483647; // (2^31)-1
+static const int64_t MIN_INT = -2147483647; // -(2^31)-1
+
+
+void
+gri_float_to_int (const float *in, int *out, float scale, int nsamples)
+{
+ for (int i = 0; i < nsamples; i++){
+ int64_t r = llrintf(scale * in[i]);
+ if (r < MIN_INT)
+ r = MIN_INT;
+ else if (r > MAX_INT)
+ r = MAX_INT;
+ out[i] = static_cast<int>(r);
+ }
+}
diff --git a/gnuradio-core/src/lib/general/gri_float_to_int.h b/gnuradio-core/src/lib/general/gri_float_to_int.h
new file mode 100644
index 000000000..84f72a420
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gri_float_to_int.h
@@ -0,0 +1,33 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+#ifndef INCLUDED_GRI_FLOAT_TO_INT_H
+#define INCLUDED_GRI_FLOAT_TO_INT_H
+
+#include <gr_core_api.h>
+
+/*!
+ * convert array of floats to int with rounding and saturation.
+ */
+GR_CORE_API void gri_float_to_int (const float *in, int *out, float scale, int nsamples);
+
+#endif /* INCLUDED_GRI_FLOAT_TO_INT_H */
diff --git a/gnuradio-core/src/lib/general/gri_float_to_short.cc b/gnuradio-core/src/lib/general/gri_float_to_short.cc
new file mode 100644
index 000000000..4508e37a7
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gri_float_to_short.cc
@@ -0,0 +1,46 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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
+
+#define _ISOC9X_SOURCE
+#include <gri_float_to_short.h>
+#include <math.h>
+
+static const int MIN_SHORT = -32768;
+static const int MAX_SHORT = 32767;
+
+
+void
+gri_float_to_short (const float *in, short *out, int nsamples)
+{
+ for (int i = 0; i < nsamples; i++){
+ long int r = (long int) rint (in[i]);
+ if (r < MIN_SHORT)
+ r = MIN_SHORT;
+ else if (r > MAX_SHORT)
+ r = MAX_SHORT;
+ out[i] = r;
+ }
+}
diff --git a/gnuradio-core/src/lib/general/gri_float_to_short.h b/gnuradio-core/src/lib/general/gri_float_to_short.h
new file mode 100644
index 000000000..b9cdf685b
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gri_float_to_short.h
@@ -0,0 +1,33 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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_GRI_FLOAT_TO_SHORT_H
+#define INCLUDED_GRI_FLOAT_TO_SHORT_H
+
+#include <gr_core_api.h>
+
+/*!
+ * convert array of floats to shorts with rounding and saturation.
+ */
+GR_CORE_API void gri_float_to_short (const float *in, short *out, int nsamples);
+
+#endif /* INCLUDED_GRI_FLOAT_TO_SHORT_H */
diff --git a/gnuradio-core/src/lib/general/gri_float_to_uchar.cc b/gnuradio-core/src/lib/general/gri_float_to_uchar.cc
new file mode 100644
index 000000000..9ea42a31b
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gri_float_to_uchar.cc
@@ -0,0 +1,46 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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
+
+#define _ISOC9X_SOURCE
+#include <gri_float_to_uchar.h>
+#include <math.h>
+
+static const int MIN_UCHAR = 0;
+static const int MAX_UCHAR = 255;
+
+
+void
+gri_float_to_uchar (const float *in, unsigned char *out, int nsamples)
+{
+ for (int i = 0; i < nsamples; i++){
+ long int r = (long int) rint (in[i]);
+ if (r < MIN_UCHAR)
+ r = MIN_UCHAR;
+ else if (r > MAX_UCHAR)
+ r = MAX_UCHAR;
+ out[i] = r;
+ }
+}
diff --git a/gnuradio-core/src/lib/general/gri_float_to_uchar.h b/gnuradio-core/src/lib/general/gri_float_to_uchar.h
new file mode 100644
index 000000000..e24b1973f
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gri_float_to_uchar.h
@@ -0,0 +1,33 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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_GRI_FLOAT_TO_UCHAR_H
+#define INCLUDED_GRI_FLOAT_TO_UCHAR_H
+
+#include <gr_core_api.h>
+
+/*!
+ * convert array of floats to unsigned chars with rounding and saturation.
+ */
+GR_CORE_API void gri_float_to_uchar (const float *in, unsigned char *out, int nsamples);
+
+#endif /* INCLUDED_GRI_FLOAT_TO_UCHAR_H */
diff --git a/gnuradio-core/src/lib/general/gri_glfsr.cc b/gnuradio-core/src/lib/general/gri_glfsr.cc
new file mode 100644
index 000000000..ba6951882
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gri_glfsr.cc
@@ -0,0 +1,67 @@
+/* -*- 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.
+ */
+
+#include <gri_glfsr.h>
+#include <stdexcept>
+
+static int s_polynomial_masks[] = {
+ 0x00000000,
+ 0x00000001, // x^1 + 1
+ 0x00000003, // x^2 + x^1 + 1
+ 0x00000005, // x^3 + x^1 + 1
+ 0x00000009, // x^4 + x^1 + 1
+ 0x00000012, // x^5 + x^2 + 1
+ 0x00000021, // x^6 + x^1 + 1
+ 0x00000041, // x^7 + x^1 + 1
+ 0x0000008E, // x^8 + x^4 + x^3 + x^2 + 1
+ 0x00000108, // x^9 + x^4 + 1
+ 0x00000204, // x^10 + x^4 + 1
+ 0x00000402, // x^11 + x^2 + 1
+ 0x00000829, // x^12 + x^6 + x^4 + x^1 + 1
+ 0x0000100D, // x^13 + x^4 + x^3 + x^1 + 1
+ 0x00002015, // x^14 + x^5 + x^3 + x^1 + 1
+ 0x00004001, // x^15 + x^1 + 1
+ 0x00008016, // x^16 + x^5 + x^3 + x^2 + 1
+ 0x00010004, // x^17 + x^3 + 1
+ 0x00020013, // x^18 + x^5 + x^2 + x^1 + 1
+ 0x00040013, // x^19 + x^5 + x^2 + x^1 + 1
+ 0x00080004, // x^20 + x^3 + 1
+ 0x00100002, // x^21 + x^2 + 1
+ 0x00200001, // x^22 + x^1 + 1
+ 0x00400010, // x^23 + x^5 + 1
+ 0x0080000D, // x^24 + x^4 + x^3 + x^1 + 1
+ 0x01000004, // x^25 + x^3 + 1
+ 0x02000023, // x^26 + x^6 + x^2 + x^1 + 1
+ 0x04000013, // x^27 + x^5 + x^2 + x^1 + 1
+ 0x08000004, // x^28 + x^3 + 1
+ 0x10000002, // x^29 + x^2 + 1
+ 0x20000029, // x^30 + x^4 + x^1 + 1
+ 0x40000004, // x^31 + x^3 + 1
+ 0x80000057 // x^32 + x^7 + x^5 + x^3 + x^2 + x^1 + 1
+};
+
+int gri_glfsr::glfsr_mask(int degree)
+{
+ if (degree < 1 || degree > 32)
+ throw std::runtime_error("gri_glfsr::glfsr_mask(): degree must be between 1 and 32 inclusive");
+ return s_polynomial_masks[degree];
+}
diff --git a/gnuradio-core/src/lib/general/gri_glfsr.h b/gnuradio-core/src/lib/general/gri_glfsr.h
new file mode 100644
index 000000000..9aae2d9f1
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gri_glfsr.h
@@ -0,0 +1,57 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_GRI_GLFSR_H
+#define INCLUDED_GRI_GLFSR_H
+
+#include <gr_core_api.h>
+
+/*!
+ * \brief Galois Linear Feedback Shift Register using specified polynomial mask
+ * \ingroup misc
+ *
+ * Generates a maximal length pseudo-random sequence of length 2^degree-1
+ */
+
+class GR_CORE_API gri_glfsr
+{
+ private:
+ int d_shift_register;
+ int d_mask;
+
+ public:
+
+ gri_glfsr(int mask, int seed) { d_shift_register = seed; d_mask = mask; }
+ static int glfsr_mask(int degree);
+
+ unsigned char next_bit() {
+ unsigned char bit = d_shift_register & 1;
+ d_shift_register >>= 1;
+ if (bit)
+ d_shift_register ^= d_mask;
+ return bit;
+ }
+
+ int mask() const { return d_mask; }
+};
+
+#endif /* INCLUDED_GRI_GLFSR_H */ \ No newline at end of file
diff --git a/gnuradio-core/src/lib/general/gri_int_to_float.cc b/gnuradio-core/src/lib/general/gri_int_to_float.cc
new file mode 100644
index 000000000..91da08897
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gri_int_to_float.cc
@@ -0,0 +1,37 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#define _ISOC9X_SOURCE
+#include <gri_int_to_float.h>
+#include <math.h>
+
+void
+gri_int_to_float (const int *in, float *out, int nsamples)
+{
+ for (int i = 0; i < nsamples; i++){
+ out[i] = static_cast<float>(in[i]);
+ }
+}
diff --git a/gnuradio-core/src/lib/general/gri_int_to_float.h b/gnuradio-core/src/lib/general/gri_int_to_float.h
new file mode 100644
index 000000000..4b08b7c6b
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gri_int_to_float.h
@@ -0,0 +1,34 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+#ifndef INCLUDED_GRI_INT_TO_FLOAT_H
+#define INCLUDED_GRI_INT_TO_FLOAT_H
+
+#include <gr_core_api.h>
+
+/*
+ * convert array of ints to floats
+ */
+GR_CORE_API void gri_int_to_float (const int *in, float *out, int nsamples);
+
+
+#endif /* INCLUDED_GRI_INT_TO_FLOAT_H */
diff --git a/gnuradio-core/src/lib/general/gri_interleaved_short_to_complex.cc b/gnuradio-core/src/lib/general/gri_interleaved_short_to_complex.cc
new file mode 100644
index 000000000..7d0af0fc7
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gri_interleaved_short_to_complex.cc
@@ -0,0 +1,39 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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 <gri_interleaved_short_to_complex.h>
+#include <assert.h>
+
+void
+gri_interleaved_short_to_complex (const short *in,
+ gr_complex *out, int nsamples)
+{
+ assert (nsamples % 2 == 0);
+
+ for (int i = 0; i < nsamples/2; i++){
+ out[i] = gr_complex (in[i*2 + 0], in[i*2 + 1]);
+ }
+}
diff --git a/gnuradio-core/src/lib/general/gri_interleaved_short_to_complex.h b/gnuradio-core/src/lib/general/gri_interleaved_short_to_complex.h
new file mode 100644
index 000000000..8d8a0d16e
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gri_interleaved_short_to_complex.h
@@ -0,0 +1,38 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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_GRI_INTERLEAVED_SHORT_TO_COMPLEX_H
+#define INCLUDED_GRI_INTERLEAVED_SHORT_TO_COMPLEX_H
+
+#include <gr_core_api.h>
+#include <gr_complex.h>
+
+/*
+ * convert array of interleaved shorts to complex.
+ * the shorts contains real, imaginary, real, imaginary...
+ * nsamples is the number of shorts; it must be even.
+ */
+GR_CORE_API void gri_interleaved_short_to_complex (const short *in, gr_complex *out, int nsamples);
+
+#endif /* INCLUDED_GRI_INTERLEAVED_SHORT_TO_COMPLEX_H */
+
+
diff --git a/gnuradio-core/src/lib/general/gri_lfsr.h b/gnuradio-core/src/lib/general/gri_lfsr.h
new file mode 100644
index 000000000..420236077
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gri_lfsr.h
@@ -0,0 +1,152 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_GRI_LFSR_H
+#define INCLUDED_GRI_LFSR_H
+
+#include <gr_core_api.h>
+#include <stdexcept>
+#include <stdint.h>
+
+/*!
+ * \brief Fibonacci Linear Feedback Shift Register using specified polynomial mask
+ * \ingroup misc
+ *
+ * Generates a maximal length pseudo-random sequence of length 2^degree-1
+ *
+ * Constructor: gri_lfsr(int mask, int seed, int reg_len);
+ *
+ * mask - polynomial coefficients representing the locations
+ * of feedback taps from a shift register which are xor'ed
+ * together to form the new high order bit.
+ *
+ * Some common masks might be:
+ * x^4 + x^3 + x^0 = 0x19
+ * x^5 + x^3 + x^0 = 0x29
+ * x^6 + x^5 + x^0 = 0x61
+ *
+ * seed - the initialization vector placed into the register
+ * durring initialization. Low order bit corresponds
+ * to x^0 coefficient -- the first to be shifted as output.
+ *
+ * reg_len - specifies the length of the feedback shift register
+ * to be used. Durring each iteration, the register
+ * is rightshifted one and the new bit is placed in bit reg_len.
+ * reg_len should generally be at least order(mask) + 1
+ *
+ *
+ * see http://en.wikipedia.org/wiki/Linear_feedback_shift_register
+ * for more explanation.
+ *
+ *
+ *
+ * next_bit() - Standard LFSR operation
+ *
+ * Perform one cycle of the LFSR. The output bit is taken from
+ * the shift register LSB. The shift register MSB is assigned from
+ * the modulo 2 sum of the masked shift register.
+ *
+ * next_bit_scramble(unsigned char input) - Scramble an input stream
+ *
+ * Perform one cycle of the LFSR. The output bit is taken from
+ * the shift register LSB. The shift register MSB is assigned from
+ * the modulo 2 sum of the masked shift register and the input LSB.
+ *
+ * next_bit_descramble(unsigned char input) - Descramble an input stream
+ *
+ * Perform one cycle of the LFSR. The output bit is taken from
+ * the modulo 2 sum of the masked shift register and the input LSB.
+ * The shift register MSB is assigned from the LSB of the input.
+ *
+ * See http://en.wikipedia.org/wiki/Scrambler for operation of these
+ * last two functions (see multiplicative scrambler.)
+ *
+ */
+
+class GR_CORE_API gri_lfsr
+{
+ private:
+ uint32_t d_shift_register;
+ uint32_t d_mask;
+ uint32_t d_seed;
+ uint32_t d_shift_register_length; // less than 32
+
+ static uint32_t
+ popCount(uint32_t x)
+ {
+ uint32_t r = x - ((x >> 1) & 033333333333)
+ - ((x >> 2) & 011111111111);
+ return ((r + (r >> 3)) & 030707070707) % 63;
+ }
+
+ public:
+
+ gri_lfsr(uint32_t mask, uint32_t seed, uint32_t reg_len)
+ : d_shift_register(seed),
+ d_mask(mask),
+ d_seed(seed),
+ d_shift_register_length(reg_len)
+ {
+ if (reg_len > 31)
+ throw std::invalid_argument("reg_len must be <= 31");
+ }
+
+ unsigned char next_bit() {
+ unsigned char output = d_shift_register & 1;
+ unsigned char newbit = popCount( d_shift_register & d_mask )%2;
+ d_shift_register = ((d_shift_register>>1) | (newbit<<d_shift_register_length));
+ return output;
+ }
+
+ unsigned char next_bit_scramble(unsigned char input) {
+ unsigned char output = d_shift_register & 1;
+ unsigned char newbit = (popCount( d_shift_register & d_mask )%2)^(input & 1);
+ d_shift_register = ((d_shift_register>>1) | (newbit<<d_shift_register_length));
+ return output;
+ }
+
+ unsigned char next_bit_descramble(unsigned char input) {
+ unsigned char output = (popCount( d_shift_register & d_mask )%2)^(input & 1);
+ unsigned char newbit = input & 1;
+ d_shift_register = ((d_shift_register>>1) | (newbit<<d_shift_register_length));
+ return output;
+ }
+
+ /*!
+ * Reset shift register to initial seed value
+ */
+ void reset() { d_shift_register = d_seed; }
+
+ /*!
+ * Rotate the register through x number of bits
+ * where we are just throwing away the results to get queued up correctly
+ */
+ void pre_shift(int num){
+ for(int i=0; i<num; i++){
+ next_bit();
+ }
+ }
+
+ int mask() const { return d_mask; }
+};
+
+#endif /* INCLUDED_GRI_LFSR_H */
diff --git a/gnuradio-core/src/lib/general/gri_lfsr_15_1_0.h b/gnuradio-core/src/lib/general/gri_lfsr_15_1_0.h
new file mode 100644
index 000000000..578739f7e
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gri_lfsr_15_1_0.h
@@ -0,0 +1,60 @@
+/* -*- 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_GRI_LFSR_15_1_0_H
+#define INCLUDED_GRI_LFSR_15_1_0_H
+
+#include <gr_core_api.h>
+
+/*!
+ * \brief Linear Feedback Shift Register using primitive polynomial x^15 + x + 1
+ * \ingroup misc
+ *
+ * Generates a maximal length pseudo-random sequence of length 2^15 - 1 bits.
+ */
+
+class GR_CORE_API gri_lfsr_15_1_0 {
+ unsigned long d_sr; // shift register
+
+ public:
+
+ gri_lfsr_15_1_0 () { reset (); }
+
+ void reset () { d_sr = 0x7fff; }
+
+ int next_bit (){
+ d_sr = ((((d_sr >> 1) ^ d_sr) & 0x1) << 14) | (d_sr >> 1);
+ return d_sr & 0x1;
+ }
+
+ int next_byte (){
+ int v = 0;
+ for (int i = 0; i < 8; i++){
+ v >>= 1;
+ if (next_bit ())
+ v |= 0x80;
+ }
+ return v;
+ }
+};
+
+#endif /* INCLUDED_GRI_LFSR_15_1_0_H */ \ No newline at end of file
diff --git a/gnuradio-core/src/lib/general/gri_lfsr_32k.h b/gnuradio-core/src/lib/general/gri_lfsr_32k.h
new file mode 100644
index 000000000..e84512b9a
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gri_lfsr_32k.h
@@ -0,0 +1,80 @@
+/* -*- 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_GRI_LFSR_32k_H
+#define INCLUDED_GRI_LFSR_32k_H
+
+#include <gr_core_api.h>
+#include <gri_lfsr_15_1_0.h>
+
+/*!
+ * \brief generate pseudo-random sequence of length 32768 bits.
+ * \ingroup misc
+ *
+ * This is based on gri_lfsr_15_1_0 with an extra 0 added at the end
+ * of the sequence.
+ */
+
+class GR_CORE_API gri_lfsr_32k {
+ gri_lfsr_15_1_0 d_lfsr;
+ unsigned int d_count;
+
+ public:
+ gri_lfsr_32k () { reset (); }
+
+ void reset (){
+ d_lfsr.reset ();
+ d_count = 0;
+ }
+
+ int next_bit (){
+ if (d_count == 32767){
+ d_count = 0;
+ return 0;
+ }
+ d_count++;
+ return d_lfsr.next_bit ();
+ }
+
+ int next_byte (){
+ int v = 0;
+ for (int i = 0; i < 8; i++){
+ v >>= 1;
+ if (next_bit ())
+ v |= 0x80;
+ }
+ return v;
+ }
+
+ int next_short (){
+ int v = 0;
+ for (int i = 0; i < 16; i++){
+ v >>= 1;
+ if (next_bit ())
+ v |= 0x8000;
+ }
+ return v;
+ }
+
+};
+
+#endif /* INCLUDED_GRI_LFSR_32k_H */
diff --git a/gnuradio-core/src/lib/general/gri_short_to_float.cc b/gnuradio-core/src/lib/general/gri_short_to_float.cc
new file mode 100644
index 000000000..d5d0e786e
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gri_short_to_float.cc
@@ -0,0 +1,40 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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 <gri_short_to_float.h>
+
+void
+gri_short_to_float (const short *in, float *out, int nsamples)
+{
+ while (nsamples >= 4){
+ out[0] = in[0];
+ out[1] = in[1];
+ out[2] = in[2];
+ out[3] = in[3];
+ out += 4;
+ in += 4;
+ nsamples -= 4;
+ }
+
+ while (nsamples-- > 0)
+ *out++ = *in++;
+}
diff --git a/gnuradio-core/src/lib/general/gri_short_to_float.h b/gnuradio-core/src/lib/general/gri_short_to_float.h
new file mode 100644
index 000000000..2ffdbb45b
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gri_short_to_float.h
@@ -0,0 +1,34 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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_GRI_SHORT_TO_FLOAT_H
+#define INCLUDED_GRI_SHORT_TO_FLOAT_H
+
+#include <gr_core_api.h>
+
+/*
+ * convert array of shorts to floats
+ */
+GR_CORE_API void gri_short_to_float (const short *in, float *out, int nsamples);
+
+
+#endif /* INCLUDED_GRI_SHORT_TO_FLOAT_H */ \ No newline at end of file
diff --git a/gnuradio-core/src/lib/general/gri_uchar_to_float.cc b/gnuradio-core/src/lib/general/gri_uchar_to_float.cc
new file mode 100644
index 000000000..91f3e7336
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gri_uchar_to_float.cc
@@ -0,0 +1,40 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005 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 <gri_uchar_to_float.h>
+
+void
+gri_uchar_to_float (const unsigned char *in, float *out, int nsamples)
+{
+ while (nsamples >= 4){
+ out[0] = in[0];
+ out[1] = in[1];
+ out[2] = in[2];
+ out[3] = in[3];
+ out += 4;
+ in += 4;
+ nsamples -= 4;
+ }
+
+ while (nsamples-- > 0)
+ *out++ = *in++;
+}
diff --git a/gnuradio-core/src/lib/general/gri_uchar_to_float.h b/gnuradio-core/src/lib/general/gri_uchar_to_float.h
new file mode 100644
index 000000000..633c5d4ce
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gri_uchar_to_float.h
@@ -0,0 +1,34 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005 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_GRI_UCHAR_TO_FLOAT_H
+#define INCLUDED_GRI_UCHAR_TO_FLOAT_H
+
+#include <gr_core_api.h>
+
+/*
+ * convert array of unsigned chars to floats
+ */
+GR_CORE_API void gri_uchar_to_float (const unsigned char *in, float *out, int nsamples);
+
+
+#endif /* INCLUDED_GRI_UCHAR_TO_FLOAT_H */ \ No newline at end of file
diff --git a/gnuradio-core/src/lib/general/malloc16.c b/gnuradio-core/src/lib/general/malloc16.c
new file mode 100644
index 000000000..2cc6135e7
--- /dev/null
+++ b/gnuradio-core/src/lib/general/malloc16.c
@@ -0,0 +1,46 @@
+/* Wrapper functions for malloc/free that force 16-byte alignment
+ * See http://perso.club-internet.fr/matmac/sourcesc.htm
+
+ * Copyright 2001 Phil Karn, KA9Q
+ * May be used under the terms of the GNU Public License (GPL)
+ */
+
+#include "malloc16.h"
+#include <string.h>
+
+void *malloc16Align(int size){
+ void *p;
+ void **p1;
+
+ if((p = malloc(size+31)) == NULL)
+ return NULL;
+
+ /* Round up to next 16-byte boundary */
+ p1 = (void **)(((long)p + 31) & (~15));
+
+ /* Stash actual start of block just before ptr we return */
+ p1[-1] = p;
+
+ /* Return 16-byte aligned address */
+ return (void *)p1;
+}
+
+void *calloc16Align(size_t nmemb,size_t size){
+ int nbytes;
+ void *p;
+
+ nbytes = nmemb*size;
+ if((p = malloc16Align(nbytes)) == NULL)
+ return NULL;
+
+ memset(p,0,nbytes);
+ return p;
+}
+
+void free16Align(void *p){
+
+ if(p != NULL){
+ /* Retrieve pointer to actual start of block and free it */
+ free(((void **)p)[-1]);
+ }
+}
diff --git a/gnuradio-core/src/lib/general/malloc16.h b/gnuradio-core/src/lib/general/malloc16.h
new file mode 100644
index 000000000..eaa32c625
--- /dev/null
+++ b/gnuradio-core/src/lib/general/malloc16.h
@@ -0,0 +1,37 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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_core_api.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdlib.h>
+
+GR_CORE_API void *malloc16Align(int size);
+GR_CORE_API void *calloc16Align(size_t nmemb,size_t size);
+GR_CORE_API void free16Align(void *p);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/gnuradio-core/src/lib/general/qa_general.cc b/gnuradio-core/src/lib/general/qa_general.cc
new file mode 100644
index 000000000..26b21983e
--- /dev/null
+++ b/gnuradio-core/src/lib/general/qa_general.cc
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2002 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 class gathers together all the test cases for the gr
+ * directory into a single test suite. As you create new test cases,
+ * add them here.
+ */
+
+#include <qa_general.h>
+#include <qa_gr_firdes.h>
+#include <qa_gr_circular_file.h>
+#include <qa_gr_cpm.h>
+#include <qa_gr_fxpt.h>
+#include <qa_gr_fxpt_nco.h>
+#include <qa_gr_fxpt_vco.h>
+#include <qa_gr_math.h>
+#include <qa_gri_lfsr.h>
+
+CppUnit::TestSuite *
+qa_general::suite ()
+{
+ CppUnit::TestSuite *s = new CppUnit::TestSuite ("general");
+
+ s->addTest (qa_gr_firdes::suite ());
+ s->addTest (qa_gr_circular_file::suite ());
+ s->addTest (qa_gr_cpm::suite ());
+ s->addTest (qa_gr_fxpt::suite ());
+ s->addTest (qa_gr_fxpt_nco::suite ());
+ s->addTest (qa_gr_fxpt_vco::suite ());
+ s->addTest (qa_gr_math::suite ());
+ s->addTest (qa_gri_lfsr::suite ());
+
+ return s;
+}
diff --git a/gnuradio-core/src/lib/general/qa_general.h b/gnuradio-core/src/lib/general/qa_general.h
new file mode 100644
index 000000000..bf52cddc1
--- /dev/null
+++ b/gnuradio-core/src/lib/general/qa_general.h
@@ -0,0 +1,38 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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 _QA_GENERAL_H_
+#define _QA_GENERAL_H_
+
+#include <gruel/attributes.h>
+#include <cppunit/TestSuite.h>
+
+//! collect all the tests for the gr directory
+
+class __GR_ATTR_EXPORT qa_general {
+ public:
+ //! return suite of tests for all of gr directory
+ static CppUnit::TestSuite *suite ();
+};
+
+
+#endif /* _QA_GENERAL_H_ */
diff --git a/gnuradio-core/src/lib/general/qa_gr_circular_file.cc b/gnuradio-core/src/lib/general/qa_gr_circular_file.cc
new file mode 100644
index 000000000..243e44784
--- /dev/null
+++ b/gnuradio-core/src/lib/general/qa_gr_circular_file.cc
@@ -0,0 +1,72 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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 <qa_gr_circular_file.h>
+#include <gr_circular_file.h>
+#include <cppunit/TestAssert.h>
+#include <iostream>
+#include <stdio.h>
+#include <unistd.h>
+
+static const char *test_file = "qa_gr_circular_file.data";
+static const int BUFFER_SIZE = 8192;
+static const int NWRITE = 8192 * 9 / 8;
+
+void
+qa_gr_circular_file::t1 ()
+{
+#ifdef HAVE_MMAP
+ gr_circular_file *cf_writer;
+ gr_circular_file *cf_reader;
+
+ // write the data...
+
+ cf_writer = new gr_circular_file (test_file, true, BUFFER_SIZE * sizeof (short));
+
+ short sd;
+ for (int i = 0; i < NWRITE; i++){
+ sd = i;
+ cf_writer->write (&sd, sizeof (sd));
+ }
+
+ delete cf_writer;
+
+ // now read it back...
+
+ cf_reader = new gr_circular_file (test_file);
+ for (int i = 0; i < BUFFER_SIZE; i++){
+ int n = cf_reader->read (&sd, sizeof (sd));
+ CPPUNIT_ASSERT_EQUAL ((int) sizeof (sd), n);
+ CPPUNIT_ASSERT_EQUAL (NWRITE - BUFFER_SIZE + i, (int) sd);
+ }
+
+ int n = cf_reader->read (&sd, sizeof (sd));
+ CPPUNIT_ASSERT_EQUAL (0, n);
+
+ delete cf_reader;
+ unlink (test_file);
+#endif // HAVE_MMAP
+}
+
diff --git a/gnuradio-core/src/lib/general/qa_gr_circular_file.h b/gnuradio-core/src/lib/general/qa_gr_circular_file.h
new file mode 100644
index 000000000..df35ab077
--- /dev/null
+++ b/gnuradio-core/src/lib/general/qa_gr_circular_file.h
@@ -0,0 +1,40 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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 _QA_GR_CIRCULAR_FILE_H_
+#define _QA_GR_CIRCULAR_FILE_H_
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/TestCase.h>
+
+class qa_gr_circular_file : public CppUnit::TestCase {
+
+ CPPUNIT_TEST_SUITE (qa_gr_circular_file);
+ CPPUNIT_TEST (t1);
+ CPPUNIT_TEST_SUITE_END ();
+
+ private:
+ void t1 ();
+
+};
+
+
+#endif /* _QA_GR_CIRCULAR_FILE_H_ */
diff --git a/gnuradio-core/src/lib/general/qa_gr_cpm.cc b/gnuradio-core/src/lib/general/qa_gr_cpm.cc
new file mode 100644
index 000000000..ee3e2bdea
--- /dev/null
+++ b/gnuradio-core/src/lib/general/qa_gr_cpm.cc
@@ -0,0 +1,140 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+#include <qa_gr_cpm.h>
+#include <gr_cpm.h>
+#include <cppunit/TestAssert.h>
+
+const double DELTA = 1e-5;
+const int L = 5;
+const int samples_per_sym = 4;
+const float taps_lrc[20] = {
+ 0, 0.002447174185242, 0.009549150281253, 0.020610737385376,
+ 0.034549150281253, 0.050000000000000, 0.065450849718747, 0.079389262614624,
+ 0.090450849718747, 0.097552825814758, 0.100000000000000, 0.097552825814758,
+ 0.090450849718747, 0.079389262614624, 0.065450849718747, 0.050000000000000,
+ 0.034549150281253, 0.020610737385376, 0.009549150281253, 0.002447174185242
+};
+
+
+const float taps_lsrc[20] = { // beta = 0.2
+ 0.000000000000000, 0.009062686687436, 0.019517618142920, 0.030875041875917,
+ 0.042552315421249, 0.053912556756416, 0.064308860403517, 0.073130584159352,
+ 0.079847961304114, 0.084051371489937, 0.085482007518284, 0.084051371489937,
+ 0.079847961304114, 0.073130584159352, 0.064308860403517, 0.053912556756416,
+ 0.042552315421249, 0.030875041875917, 0.019517618142920, 0.009062686687436
+};
+
+
+const float taps_tfm[20] = {
+ -0.003946522220317, -0.005147757690530, -0.003171631690177, 0.003959659609805,
+ 0.017498721302356, 0.037346982678383, 0.062251889790391, 0.087364237065604,
+ 0.110049050955117, 0.125677762224511, 0.132288693729399, 0.125677762224511,
+ 0.110049050955117, 0.087364237065604, 0.062251889790391, 0.037346982678383,
+ 0.017498721302356, 0.003959659609805, -0.003171631690177, -0.005147757690530
+};
+
+
+const float taps_gaussian[20] = { // BT = 0.3
+ 0.000000743866524, 0.000009286258371, 0.000085441834550, 0.000581664421923,
+ 0.002945540765422, 0.011178079812344, 0.032117220937421, 0.070841188736816,
+ 0.122053715366673, 0.167389736919915, 0.185594670675172, 0.167389736919915,
+ 0.122053715366673, 0.070841188736816, 0.032117220937421, 0.011178079812344,
+ 0.002945540765422, 0.000581664421923, 0.000085441834550, 0.000009286258371
+};
+
+
+// Check LREC phase response
+void
+qa_gr_cpm::t1 ()
+{
+ std::vector<float> taps(gr_cpm::phase_response(gr_cpm::LREC, samples_per_sym, L));
+
+ for (int i = 0; i < L * samples_per_sym; i++) {
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(taps[i], 0.05, DELTA);
+ }
+}
+
+
+// Check LRC phase response
+void
+qa_gr_cpm::t2 ()
+{
+ std::vector<float> taps(gr_cpm::phase_response(gr_cpm::LRC, samples_per_sym, L));
+ float sum = 0;
+
+ for (int i = 0; i < L * samples_per_sym; i++) {
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(taps[i], taps_lrc[i], DELTA);
+ sum += taps[i];
+ }
+
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(sum, 1.0, DELTA);
+}
+
+
+// Check LSRC phase response
+void
+qa_gr_cpm::t3 ()
+{
+ std::vector<float> taps(gr_cpm::phase_response(gr_cpm::LSRC, samples_per_sym, L, 0.2));
+ float sum = 0;
+
+ for (int i = 0; i < L * samples_per_sym; i++) {
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(taps[i], taps_lsrc[i], DELTA);
+ sum += taps[i];
+ }
+
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(sum, 1.0, DELTA);
+}
+
+
+// Check the TFM phase response
+void
+qa_gr_cpm::t4 ()
+{
+ std::vector<float> taps(gr_cpm::phase_response(gr_cpm::TFM, samples_per_sym, L));
+ float sum = 0;
+
+ for (int i = 0; i < L * samples_per_sym; i++) {
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(taps[i], taps_tfm[i], DELTA);
+ sum += taps[i];
+ }
+
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(sum, 1.0, DELTA);
+}
+
+
+// Check the Gaussian phase response
+void
+qa_gr_cpm::t5 ()
+{
+ std::vector<float> taps(gr_cpm::phase_response(gr_cpm::GAUSSIAN, samples_per_sym, L, 0.3));
+ float sum = 0;
+
+ for (int i = 0; i < L * samples_per_sym; i++) {
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(taps[i], taps_gaussian[i], DELTA);
+ sum += taps[i];
+ }
+
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(sum, 1.0, DELTA);
+}
+
diff --git a/gnuradio-core/src/lib/general/qa_gr_cpm.h b/gnuradio-core/src/lib/general/qa_gr_cpm.h
new file mode 100644
index 000000000..2f46b42a7
--- /dev/null
+++ b/gnuradio-core/src/lib/general/qa_gr_cpm.h
@@ -0,0 +1,49 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+#ifndef _QA_GR_CPM_H
+#define _QA_GR_CPM_H
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/TestCase.h>
+
+class qa_gr_cpm : public CppUnit::TestCase {
+
+ CPPUNIT_TEST_SUITE (qa_gr_cpm);
+ CPPUNIT_TEST (t1);
+ CPPUNIT_TEST (t2);
+ CPPUNIT_TEST (t3);
+ CPPUNIT_TEST (t4);
+ CPPUNIT_TEST (t5);
+ CPPUNIT_TEST_SUITE_END ();
+
+ private:
+ void t1 ();
+ void t2 ();
+ void t3 ();
+ void t4 ();
+ void t5 ();
+
+};
+
+
+#endif /* _QA_GR_CPM_H */
+
diff --git a/gnuradio-core/src/lib/general/qa_gr_firdes.cc b/gnuradio-core/src/lib/general/qa_gr_firdes.cc
new file mode 100644
index 000000000..877b4bd56
--- /dev/null
+++ b/gnuradio-core/src/lib/general/qa_gr_firdes.cc
@@ -0,0 +1,618 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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 <qa_gr_firdes.h>
+#include <gr_firdes.h>
+#include <cppunit/TestAssert.h>
+#include <gr_complex.h>
+#include <string.h>
+#include <iostream>
+#include <iomanip>
+#include <stdio.h>
+
+#define NELEM(x) (sizeof (x) / sizeof (x[0]))
+
+using std::vector;
+
+#if 0
+static void
+print_taps (std::ostream &s, vector<float> &v)
+{
+
+ for (unsigned int i = 0; i < v.size (); i++){
+ printf ("tap[%2d] = %16.7e\n", i, v[i]);
+ }
+}
+#endif
+
+static void
+check_symmetry (vector<float> &v)
+{
+ int n = v.size ();
+ int m = n / 2;
+
+ for (int i = 0; i < m; i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL (v[i], v[n - i - 1], 1e-9);
+}
+
+const static float t1_exp[53] = {
+ -9.0525491e-04,
+ 2.0713841e-04,
+ 1.2388536e-03,
+ 2.9683491e-04,
+ -1.7744775e-03,
+ -1.3599906e-03,
+ 2.2031884e-03,
+ 3.2744040e-03,
+ -1.8868084e-03,
+ -5.9935520e-03,
+ 6.4301129e-18,
+ 8.9516686e-03,
+ 4.2178580e-03,
+ -1.0998557e-02,
+ -1.1173409e-02,
+ 1.0455756e-02,
+ 2.0686293e-02,
+ -5.2032238e-03,
+ -3.1896964e-02,
+ -7.4998410e-03,
+ 4.3362070e-02,
+ 3.2502845e-02,
+ -5.3328082e-02,
+ -8.5621715e-02,
+ 6.0117975e-02,
+ 3.1128189e-01,
+ 4.3769023e-01,
+ 3.1128189e-01,
+ 6.0117975e-02,
+ -8.5621715e-02,
+ -5.3328082e-02,
+ 3.2502845e-02,
+ 4.3362070e-02,
+ -7.4998410e-03,
+ -3.1896964e-02,
+ -5.2032238e-03,
+ 2.0686293e-02,
+ 1.0455756e-02,
+ -1.1173409e-02,
+ -1.0998557e-02,
+ 4.2178580e-03,
+ 8.9516686e-03,
+ 6.4301129e-18,
+ -5.9935520e-03,
+ -1.8868084e-03,
+ 3.2744040e-03,
+ 2.2031884e-03,
+ -1.3599906e-03,
+ -1.7744775e-03,
+ 2.9683491e-04,
+ 1.2388536e-03,
+ 2.0713841e-04,
+ -9.0525491e-04
+};
+
+const static float t2_exp[53] = {
+ 9.0380036e-04,
+ -2.0680559e-04,
+ -1.2368630e-03,
+ -2.9635796e-04,
+ 1.7716263e-03,
+ 1.3578053e-03,
+ -2.1996482e-03,
+ -3.2691427e-03,
+ 1.8837767e-03,
+ 5.9839217e-03,
+ -6.4197810e-18,
+ -8.9372853e-03,
+ -4.2110807e-03,
+ 1.0980885e-02,
+ 1.1155456e-02,
+ -1.0438956e-02,
+ -2.0653054e-02,
+ 5.1948633e-03,
+ 3.1845711e-02,
+ 7.4877902e-03,
+ -4.3292396e-02,
+ -3.2450620e-02,
+ 5.3242393e-02,
+ 8.5484132e-02,
+ -6.0021374e-02,
+ -3.1078172e-01,
+ 5.6184036e-01,
+ -3.1078172e-01,
+ -6.0021374e-02,
+ 8.5484132e-02,
+ 5.3242393e-02,
+ -3.2450620e-02,
+ -4.3292396e-02,
+ 7.4877902e-03,
+ 3.1845711e-02,
+ 5.1948633e-03,
+ -2.0653054e-02,
+ -1.0438956e-02,
+ 1.1155456e-02,
+ 1.0980885e-02,
+ -4.2110807e-03,
+ -8.9372853e-03,
+ -6.4197810e-18,
+ 5.9839217e-03,
+ 1.8837767e-03,
+ -3.2691427e-03,
+ -2.1996482e-03,
+ 1.3578053e-03,
+ 1.7716263e-03,
+ -2.9635796e-04,
+ -1.2368630e-03,
+ -2.0680559e-04,
+ 9.0380036e-04
+};
+
+const static float t3_exp[107] = {
+ -1.8970841e-06,
+ -7.1057165e-04,
+ 5.4005696e-04,
+ 4.6233178e-04,
+ 2.0572044e-04,
+ 3.5209916e-04,
+ -1.4098573e-03,
+ 1.1279077e-04,
+ -6.2994129e-04,
+ 1.1450432e-03,
+ 1.3637283e-03,
+ -6.4360141e-04,
+ 3.6509900e-04,
+ -3.2864159e-03,
+ 7.0192874e-04,
+ 3.7524730e-04,
+ 2.0256115e-03,
+ 3.0641893e-03,
+ -3.6618244e-03,
+ 7.5592739e-05,
+ -5.5586505e-03,
+ 2.3849572e-03,
+ 4.0114378e-03,
+ 1.6636450e-03,
+ 4.7835698e-03,
+ -1.0191196e-02,
+ -3.8158931e-04,
+ -5.5551580e-03,
+ 5.3901658e-03,
+ 1.1366769e-02,
+ -3.0000482e-03,
+ 4.9341680e-03,
+ -2.0093076e-02,
+ 5.5752542e-17,
+ 1.2093617e-03,
+ 8.6089745e-03,
+ 2.2382140e-02,
+ -1.6854567e-02,
+ 1.6913920e-03,
+ -3.1222520e-02,
+ 3.2711059e-03,
+ 2.2604836e-02,
+ 8.1451107e-03,
+ 3.7583180e-02,
+ -5.2293688e-02,
+ -8.0551542e-03,
+ -4.0092729e-02,
+ 1.5582236e-02,
+ 9.7452506e-02,
+ -1.6183170e-02,
+ 8.3281815e-02,
+ -2.8196752e-01,
+ -1.0965768e-01,
+ 5.2867508e-01,
+ -1.0965768e-01,
+ -2.8196752e-01,
+ 8.3281815e-02,
+ -1.6183170e-02,
+ 9.7452506e-02,
+ 1.5582236e-02,
+ -4.0092729e-02,
+ -8.0551542e-03,
+ -5.2293688e-02,
+ 3.7583180e-02,
+ 8.1451107e-03,
+ 2.2604836e-02,
+ 3.2711059e-03,
+ -3.1222520e-02,
+ 1.6913920e-03,
+ -1.6854567e-02,
+ 2.2382140e-02,
+ 8.6089745e-03,
+ 1.2093617e-03,
+ 5.5752542e-17,
+ -2.0093076e-02,
+ 4.9341680e-03,
+ -3.0000482e-03,
+ 1.1366769e-02,
+ 5.3901658e-03,
+ -5.5551580e-03,
+ -3.8158931e-04,
+ -1.0191196e-02,
+ 4.7835698e-03,
+ 1.6636450e-03,
+ 4.0114378e-03,
+ 2.3849572e-03,
+ -5.5586505e-03,
+ 7.5592739e-05,
+ -3.6618244e-03,
+ 3.0641893e-03,
+ 2.0256115e-03,
+ 3.7524730e-04,
+ 7.0192874e-04,
+ -3.2864159e-03,
+ 3.6509900e-04,
+ -6.4360141e-04,
+ 1.3637283e-03,
+ 1.1450432e-03,
+ -6.2994129e-04,
+ 1.1279077e-04,
+ -1.4098573e-03,
+ 3.5209916e-04,
+ 2.0572044e-04,
+ 4.6233178e-04,
+ 5.4005696e-04,
+ -7.1057165e-04,
+ -1.8970841e-06
+};
+
+
+const static float t4_exp[] = { // low pass
+ 0.001059958362,
+0.0002263929928,
+-0.001277606934,
+-0.0009675776237,
+ 0.001592264394,
+ 0.00243603508,
+-0.001451682881,
+-0.004769335967,
+5.281541594e-18,
+ 0.007567512803,
+ 0.003658855334,
+-0.009761494584,
+ -0.01011830103,
+ 0.009636915289,
+ 0.0193619132,
+-0.004935568199,
+ -0.03060629964,
+-0.007267376408,
+ 0.04236677289,
+ 0.03197422624,
+ -0.05274848267,
+ -0.0850463286,
+ 0.05989059806,
+ 0.31065014,
+ 0.4370569289,
+ 0.31065014,
+ 0.05989059806,
+ -0.0850463286,
+ -0.05274848267,
+ 0.03197422624,
+ 0.04236677289,
+-0.007267376408,
+ -0.03060629964,
+-0.004935568199,
+ 0.0193619132,
+ 0.009636915289,
+ -0.01011830103,
+-0.009761494584,
+ 0.003658855334,
+ 0.007567512803,
+5.281541594e-18,
+-0.004769335967,
+-0.001451682881,
+ 0.00243603508,
+ 0.001592264394,
+-0.0009675776237,
+-0.001277606934,
+0.0002263929928,
+ 0.001059958362,
+};
+
+
+const static float t5_exp[] = { //high pass
+-0.001062123571,
+-0.0002268554381,
+ 0.001280216733,
+ 0.000969554123,
+-0.001595516922,
+-0.002441011136,
+ 0.001454648213,
+ 0.004779078532,
+-5.292330097e-18,
+-0.007582970895,
+ -0.00366632943,
+ 0.009781434201,
+ 0.01013896987,
+-0.009656600654,
+ -0.01940146461,
+ 0.004945650231,
+ 0.03066881932,
+ 0.00728222169,
+ -0.04245331511,
+ -0.03203954175,
+ 0.05285623297,
+ 0.08522006124,
+ -0.06001294032,
+ -0.3112847209,
+ 0.5630782247,
+ -0.3112847209,
+ -0.06001294032,
+ 0.08522006124,
+ 0.05285623297,
+ -0.03203954175,
+ -0.04245331511,
+ 0.00728222169,
+ 0.03066881932,
+ 0.004945650231,
+ -0.01940146461,
+-0.009656600654,
+ 0.01013896987,
+ 0.009781434201,
+ -0.00366632943,
+-0.007582970895,
+-5.292330097e-18,
+ 0.004779078532,
+ 0.001454648213,
+-0.002441011136,
+-0.001595516922,
+ 0.000969554123,
+ 0.001280216733,
+-0.0002268554381,
+-0.001062123571,
+};
+
+const static float t6_exp[] = { // bandpass
+0.0002809273137,
+-0.001047327649,
+7.936541806e-05,
+-0.0004270860809,
+0.0007595835486,
+0.0008966081077,
+-0.0004236323002,
+0.0002423936094,
+-0.002212299034,
+0.0004807534278,
+0.0002620361629,
+ 0.001443728455,
+ 0.002229931997,
+-0.002720607212,
+5.731141573e-05,
+-0.004297634587,
+ 0.001878833398,
+ 0.003217151389,
+ 0.001357055153,
+ 0.003965090029,
+-0.008576190099,
+-0.0003257228818,
+-0.004805727862,
+ 0.004721920472,
+ 0.01007549558,
+-0.002688719891,
+ 0.004467967432,
+ -0.01837076992,
+5.119658377e-17,
+ 0.001125075156,
+ 0.008071650751,
+ 0.02113764361,
+ -0.01602453552,
+ 0.001618095324,
+ -0.03004053794,
+ 0.003163811285,
+ 0.0219683405,
+ 0.007950295694,
+ 0.03682873398,
+ -0.05142467469,
+ -0.00794606097,
+ -0.03965795785,
+ 0.01544955093,
+ 0.09681399167,
+ -0.01610304788,
+ 0.08297294378,
+ -0.2811714709,
+ -0.1094062924,
+ 0.5275565982,
+ -0.1094062924,
+ -0.2811714709,
+ 0.08297294378,
+ -0.01610304788,
+ 0.09681399167,
+ 0.01544955093,
+ -0.03965795785,
+ -0.00794606097,
+ -0.05142467469,
+ 0.03682873398,
+ 0.007950295694,
+ 0.0219683405,
+ 0.003163811285,
+ -0.03004053794,
+ 0.001618095324,
+ -0.01602453552,
+ 0.02113764361,
+ 0.008071650751,
+ 0.001125075156,
+5.119658377e-17,
+ -0.01837076992,
+ 0.004467967432,
+-0.002688719891,
+ 0.01007549558,
+ 0.004721920472,
+-0.004805727862,
+-0.0003257228818,
+-0.008576190099,
+ 0.003965090029,
+ 0.001357055153,
+ 0.003217151389,
+ 0.001878833398,
+-0.004297634587,
+5.731141573e-05,
+-0.002720607212,
+ 0.002229931997,
+ 0.001443728455,
+0.0002620361629,
+0.0004807534278,
+-0.002212299034,
+0.0002423936094,
+-0.0004236323002,
+0.0008966081077,
+0.0007595835486,
+-0.0004270860809,
+7.936541806e-05,
+-0.001047327649,
+0.0002809273137,
+};
+
+void
+qa_gr_firdes::t1 ()
+{
+ vector<float> taps =
+ gr_firdes::low_pass ( 1.0,
+ 8000,
+ 1750,
+ 500,
+ gr_firdes::WIN_HAMMING);
+
+ // cout << "ntaps: " << taps.size () << endl;
+ // print_taps (cout, taps);
+
+ CPPUNIT_ASSERT_EQUAL (NELEM (t1_exp), taps.size ());
+ for (unsigned int i = 0; i < taps.size (); i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL (t1_exp[i], taps[i], 1e-9);
+
+ check_symmetry (taps);
+}
+
+void
+qa_gr_firdes::t2 ()
+{
+ vector<float> taps =
+ gr_firdes::high_pass ( 1.0,
+ 8000,
+ 1750,
+ 500,
+ gr_firdes::WIN_HAMMING);
+
+ // cout << "ntaps: " << taps.size () << endl;
+ // print_taps (cout, taps);
+
+ CPPUNIT_ASSERT_EQUAL (NELEM (t2_exp), taps.size ());
+
+ for (unsigned int i = 0; i < taps.size (); i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL (t2_exp[i], taps[i], 1e-9);
+
+ check_symmetry (taps);
+}
+
+void
+qa_gr_firdes::t3 ()
+{
+ vector<float> taps =
+ gr_firdes::band_pass ( 1.0,
+ 20e6,
+ 5.75e6 - (5.28e6/2),
+ 5.75e6 + (5.28e6/2),
+ 0.62e6,
+ gr_firdes::WIN_HAMMING);
+
+ // cout << "ntaps: " << taps.size () << endl;
+ // print_taps (cout, taps);
+
+ CPPUNIT_ASSERT_EQUAL (NELEM (t3_exp), taps.size ());
+
+ for (unsigned int i = 0; i < taps.size (); i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL (t3_exp[i], taps[i], 1e-7);
+
+ check_symmetry (taps);
+}
+
+void
+qa_gr_firdes::t4 ()
+{
+ vector<float> taps =
+ gr_firdes::low_pass_2 ( 1.0,
+ 8000,
+ 1750,
+ 500,
+ 66,
+ gr_firdes::WIN_HAMMING);
+
+ // std::cout << "ntaps: " << taps.size () << std::endl;
+ // print_taps (std::cout, taps);
+
+ CPPUNIT_ASSERT_EQUAL (NELEM (t4_exp), taps.size ());
+ for (unsigned int i = 0; i < taps.size (); i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL (t4_exp[i], taps[i], 1e-9);
+
+
+ check_symmetry (taps);
+}
+
+void
+qa_gr_firdes::t5 ()
+{
+ vector<float> taps =
+ gr_firdes::high_pass_2 ( 1.0,
+ 8000,
+ 1750,
+ 500,
+ 66,
+ gr_firdes::WIN_HAMMING);
+
+ // std::cout << "ntaps: " << taps.size () << std::endl;
+ // print_taps (std::cout, taps);
+
+ CPPUNIT_ASSERT_EQUAL (NELEM (t5_exp), taps.size ());
+
+ for (unsigned int i = 0; i < taps.size (); i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL (t5_exp[i], taps[i], 1e-9);
+
+ check_symmetry (taps);
+}
+
+void
+qa_gr_firdes::t6 ()
+{
+ vector<float> taps =
+ gr_firdes::band_pass_2 ( 1.0,
+ 20e6,
+ 5.75e6 - (5.28e6/2),
+ 5.75e6 + (5.28e6/2),
+ 0.62e6,
+ 66,
+ gr_firdes::WIN_HAMMING);
+
+ // std::cout << "ntaps: " << taps.size () << std::endl;
+ // print_taps (std::cout, taps);
+
+ CPPUNIT_ASSERT_EQUAL (NELEM (t6_exp), taps.size ());
+
+ for (unsigned int i = 0; i < taps.size (); i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL (t6_exp[i], taps[i], 1e-7);
+
+ check_symmetry (taps);
+}
+
+void
+qa_gr_firdes::t7 ()
+{
+}
diff --git a/gnuradio-core/src/lib/general/qa_gr_firdes.h b/gnuradio-core/src/lib/general/qa_gr_firdes.h
new file mode 100644
index 000000000..98cee99b9
--- /dev/null
+++ b/gnuradio-core/src/lib/general/qa_gr_firdes.h
@@ -0,0 +1,52 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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 _QA_GR_FIRDES_H_
+#define _QA_GR_FIRDES_H_
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/TestCase.h>
+
+class qa_gr_firdes : public CppUnit::TestCase {
+
+ CPPUNIT_TEST_SUITE (qa_gr_firdes);
+ CPPUNIT_TEST (t1);
+ CPPUNIT_TEST (t2);
+ CPPUNIT_TEST (t3);
+ CPPUNIT_TEST (t4);
+ CPPUNIT_TEST (t5);
+ CPPUNIT_TEST (t6);
+ CPPUNIT_TEST (t7);
+ CPPUNIT_TEST_SUITE_END ();
+
+ private:
+ void t1 ();
+ void t2 ();
+ void t3 ();
+ void t4 ();
+ void t5 ();
+ void t6 ();
+ void t7 ();
+
+};
+
+
+#endif /* _QA_GR_FIRDES_H_ */
diff --git a/gnuradio-core/src/lib/general/qa_gr_fxpt.cc b/gnuradio-core/src/lib/general/qa_gr_fxpt.cc
new file mode 100644
index 000000000..7eac0d896
--- /dev/null
+++ b/gnuradio-core/src/lib/general/qa_gr_fxpt.cc
@@ -0,0 +1,103 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <qa_gr_fxpt.h>
+#include <gr_fxpt.h>
+#include <cppunit/TestAssert.h>
+#include <iostream>
+#include <stdio.h>
+#include <unistd.h>
+#include <math.h>
+
+static const float SIN_COS_TOLERANCE = 1e-5;
+
+void
+qa_gr_fxpt::t0 ()
+{
+ CPPUNIT_ASSERT_DOUBLES_EQUAL (M_PI/2, gr_fxpt::fixed_to_float (0x40000000), SIN_COS_TOLERANCE);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL (0.0, gr_fxpt::fixed_to_float (0x00000000), SIN_COS_TOLERANCE);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL (-M_PI, gr_fxpt::fixed_to_float (0x80000000), SIN_COS_TOLERANCE);
+
+ if (0){
+ /*
+ * These are disabled because of some precision issues.
+ *
+ * Different compilers seem to have different opinions on whether
+ * the calulations are done single or double (or extended)
+ * precision. Any of the answers are fine for our real purpose, but
+ * sometimes the answer is off by a few bits at the bottom.
+ * Hence, the disabled check.
+ */
+ CPPUNIT_ASSERT_EQUAL ((gr_int32) 0x40000000, gr_fxpt::float_to_fixed (M_PI/2));
+ CPPUNIT_ASSERT_EQUAL ((gr_int32) 0, gr_fxpt::float_to_fixed (0));
+ CPPUNIT_ASSERT_EQUAL ((gr_int32) 0x80000000, gr_fxpt::float_to_fixed (-M_PI));
+ }
+}
+
+void
+qa_gr_fxpt::t1 ()
+{
+
+ CPPUNIT_ASSERT_DOUBLES_EQUAL ( 0, gr_fxpt::sin (0x00000000), SIN_COS_TOLERANCE);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL ( 0.707106781, gr_fxpt::sin (0x20000000), SIN_COS_TOLERANCE);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL ( 1, gr_fxpt::sin (0x40000000), SIN_COS_TOLERANCE);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL ( 0.707106781, gr_fxpt::sin (0x60000000), SIN_COS_TOLERANCE);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL ( 0, gr_fxpt::sin (0x7fffffff), SIN_COS_TOLERANCE);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL ( 0, gr_fxpt::sin (0x80000000), SIN_COS_TOLERANCE);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL ( 0, gr_fxpt::sin (0x80000001), SIN_COS_TOLERANCE);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL (-1, gr_fxpt::sin (-0x40000000), SIN_COS_TOLERANCE);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL (-0.707106781, gr_fxpt::sin (-0x20000000), SIN_COS_TOLERANCE);
+
+
+ for (float p = -M_PI; p < M_PI; p += 2 * M_PI / 3600){
+ float expected = sin (p);
+ float actual = gr_fxpt::sin (gr_fxpt::float_to_fixed (p));
+ CPPUNIT_ASSERT_DOUBLES_EQUAL (expected, actual, SIN_COS_TOLERANCE);
+ }
+}
+
+void
+qa_gr_fxpt::t2 ()
+{
+ for (float p = -M_PI; p < M_PI; p += 2 * M_PI / 3600){
+ float expected = cos (p);
+ float actual = gr_fxpt::cos (gr_fxpt::float_to_fixed (p));
+ CPPUNIT_ASSERT_DOUBLES_EQUAL (expected, actual, SIN_COS_TOLERANCE);
+ }
+}
+
+void
+qa_gr_fxpt::t3 ()
+{
+ for (float p = -M_PI; p < M_PI; p += 2 * M_PI / 3600){
+ float expected_sin = sin (p);
+ float expected_cos = cos (p);
+ float actual_sin;
+ float actual_cos;
+ gr_fxpt::sincos (gr_fxpt::float_to_fixed (p), &actual_sin, &actual_cos);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL (expected_sin, actual_sin, SIN_COS_TOLERANCE);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL (expected_cos, actual_cos, SIN_COS_TOLERANCE);
+ }
+}
diff --git a/gnuradio-core/src/lib/general/qa_gr_fxpt.h b/gnuradio-core/src/lib/general/qa_gr_fxpt.h
new file mode 100644
index 000000000..72211563e
--- /dev/null
+++ b/gnuradio-core/src/lib/general/qa_gr_fxpt.h
@@ -0,0 +1,48 @@
+/* -*- 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_QA_GR_FXPT_H
+#define INCLUDED_QA_GR_FXPT_H
+
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/TestCase.h>
+
+class qa_gr_fxpt : public CppUnit::TestCase {
+
+ CPPUNIT_TEST_SUITE (qa_gr_fxpt);
+ CPPUNIT_TEST (t0);
+ CPPUNIT_TEST (t1);
+ CPPUNIT_TEST (t2);
+ CPPUNIT_TEST (t3);
+ CPPUNIT_TEST_SUITE_END ();
+
+ private:
+ void t0 ();
+ void t1 ();
+ void t2 ();
+ void t3 ();
+
+};
+
+#endif /* INCLUDED_QA_GR_FXPT_H */
+
+
diff --git a/gnuradio-core/src/lib/general/qa_gr_fxpt_nco.cc b/gnuradio-core/src/lib/general/qa_gr_fxpt_nco.cc
new file mode 100644
index 000000000..6f208eac8
--- /dev/null
+++ b/gnuradio-core/src/lib/general/qa_gr_fxpt_nco.cc
@@ -0,0 +1,119 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <qa_gr_fxpt_nco.h>
+#include <gr_fxpt_nco.h>
+#include <gr_nco.h>
+#include <cppunit/TestAssert.h>
+#include <iostream>
+#include <stdio.h>
+#include <unistd.h>
+#include <math.h>
+
+static const float SIN_COS_TOLERANCE = 1e-5;
+
+//static const float SIN_COS_FREQ = 5003;
+static const float SIN_COS_FREQ = 4096;
+
+static const int SIN_COS_BLOCK_SIZE = 100000;
+
+static double max_d(double a, double b)
+{
+ return fabs(a) > fabs(b) ? a : b;
+}
+
+void
+qa_gr_fxpt_nco::t0 ()
+{
+ gr_nco<float,float> ref_nco;
+ gr_fxpt_nco new_nco;
+ double max_error = 0, max_phase_error = 0;
+
+ ref_nco.set_freq ((float)(2 * M_PI / SIN_COS_FREQ));
+ new_nco.set_freq ((float)(2 * M_PI / SIN_COS_FREQ));
+
+ CPPUNIT_ASSERT_DOUBLES_EQUAL (ref_nco.get_freq(), new_nco.get_freq(), SIN_COS_TOLERANCE);
+
+ for (int i = 0; i < SIN_COS_BLOCK_SIZE; i++){
+ float ref_sin = ref_nco.sin ();
+ float new_sin = new_nco.sin ();
+ //printf ("i = %6d\n", i);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL (ref_sin, new_sin, SIN_COS_TOLERANCE);
+
+ max_error = max_d (max_error, ref_sin-new_sin);
+
+ float ref_cos = ref_nco.cos ();
+ float new_cos = new_nco.cos ();
+ CPPUNIT_ASSERT_DOUBLES_EQUAL (ref_cos, new_cos, SIN_COS_TOLERANCE);
+
+ max_error = max_d (max_error, ref_cos-new_cos);
+
+ ref_nco.step ();
+ new_nco.step ();
+
+ CPPUNIT_ASSERT_DOUBLES_EQUAL (ref_nco.get_phase(), new_nco.get_phase(), SIN_COS_TOLERANCE);
+
+ max_phase_error = max_d (max_phase_error, ref_nco.get_phase()-new_nco.get_phase());
+ }
+ // printf ("Fxpt max error %.9f, max phase error %.9f\n", max_error, max_phase_error);
+}
+
+void
+qa_gr_fxpt_nco::t1 ()
+{
+ gr_nco<float,float> ref_nco;
+ gr_fxpt_nco new_nco;
+ gr_complex ref_block[SIN_COS_BLOCK_SIZE];
+ gr_complex new_block[SIN_COS_BLOCK_SIZE];
+ double max_error = 0;
+
+ ref_nco.set_freq ((float)(2 * M_PI / SIN_COS_FREQ));
+ new_nco.set_freq ((float)(2 * M_PI / SIN_COS_FREQ));
+
+ CPPUNIT_ASSERT_DOUBLES_EQUAL (ref_nco.get_freq(), new_nco.get_freq(), SIN_COS_TOLERANCE);
+
+ ref_nco.sincos ((gr_complex*)ref_block, SIN_COS_BLOCK_SIZE);
+ new_nco.sincos ((gr_complex*)new_block, SIN_COS_BLOCK_SIZE);
+
+ for (int i = 0; i < SIN_COS_BLOCK_SIZE; i++){
+ CPPUNIT_ASSERT_DOUBLES_EQUAL (ref_block[i].real(), new_block[i].real(), SIN_COS_TOLERANCE);
+ max_error = max_d (max_error, ref_block[i].real()-new_block[i].real());
+
+ CPPUNIT_ASSERT_DOUBLES_EQUAL (ref_block[i].imag(), new_block[i].imag(), SIN_COS_TOLERANCE);
+ max_error = max_d (max_error, ref_block[i].imag()-new_block[i].imag());
+ }
+ CPPUNIT_ASSERT_DOUBLES_EQUAL (ref_nco.get_phase(), new_nco.get_phase(), SIN_COS_TOLERANCE);
+ // printf ("Fxpt max error %.9f, max phase error %.9f\n", max_error, max_phase_error);
+}
+
+void
+qa_gr_fxpt_nco::t2 ()
+{
+}
+
+void
+qa_gr_fxpt_nco::t3 ()
+{
+}
diff --git a/gnuradio-core/src/lib/general/qa_gr_fxpt_nco.h b/gnuradio-core/src/lib/general/qa_gr_fxpt_nco.h
new file mode 100644
index 000000000..8998922bb
--- /dev/null
+++ b/gnuradio-core/src/lib/general/qa_gr_fxpt_nco.h
@@ -0,0 +1,48 @@
+/* -*- 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_QA_GR_FXPT_NCO_H
+#define INCLUDED_QA_GR_FXPT_NCO_H
+
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/TestCase.h>
+
+class qa_gr_fxpt_nco : public CppUnit::TestCase {
+
+ CPPUNIT_TEST_SUITE (qa_gr_fxpt_nco);
+ CPPUNIT_TEST (t0);
+ CPPUNIT_TEST (t1);
+ CPPUNIT_TEST (t2);
+ CPPUNIT_TEST (t3);
+ CPPUNIT_TEST_SUITE_END ();
+
+ private:
+ void t0 ();
+ void t1 ();
+ void t2 ();
+ void t3 ();
+
+};
+
+#endif /* INCLUDED_QA_GR_FXPT_NCO_H */
+
+
diff --git a/gnuradio-core/src/lib/general/qa_gr_fxpt_vco.cc b/gnuradio-core/src/lib/general/qa_gr_fxpt_vco.cc
new file mode 100644
index 000000000..5b6993a30
--- /dev/null
+++ b/gnuradio-core/src/lib/general/qa_gr_fxpt_vco.cc
@@ -0,0 +1,110 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2005 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 <qa_gr_fxpt_vco.h>
+#include <gr_fxpt_vco.h>
+#include <gr_vco.h>
+#include <cppunit/TestAssert.h>
+#include <iostream>
+#include <stdio.h>
+#include <unistd.h>
+#include <math.h>
+
+static const float SIN_COS_TOLERANCE = 1e-5;
+
+static const float SIN_COS_K = 0.42;
+static const float SIN_COS_AMPL = 0.8;
+
+static const int SIN_COS_BLOCK_SIZE = 100000;
+
+static double max_d(double a, double b)
+{
+ return fabs(a) > fabs(b) ? a : b;
+}
+
+void
+qa_gr_fxpt_vco::t0 ()
+{
+ gr_vco<float,float> ref_vco;
+ gr_fxpt_vco new_vco;
+ double max_error = 0, max_phase_error = 0;
+ float input[SIN_COS_BLOCK_SIZE];
+
+ for (int i = 0; i < SIN_COS_BLOCK_SIZE; i++){
+ input[i] = sin(double(i));
+ }
+
+ for (int i = 0; i < SIN_COS_BLOCK_SIZE; i++){
+ float ref_cos = ref_vco.cos ();
+ float new_cos = new_vco.cos ();
+ CPPUNIT_ASSERT_DOUBLES_EQUAL (ref_cos, new_cos, SIN_COS_TOLERANCE);
+
+ max_error = max_d (max_error, ref_cos-new_cos);
+
+ ref_vco.adjust_phase (input[i]);
+ new_vco.adjust_phase (input[i]);
+
+ CPPUNIT_ASSERT_DOUBLES_EQUAL (ref_vco.get_phase(), new_vco.get_phase(), SIN_COS_TOLERANCE);
+
+ max_phase_error = max_d (max_phase_error, ref_vco.get_phase()-new_vco.get_phase());
+ }
+ // printf ("Fxpt max error %.9f, max phase error %.9f\n", max_error, max_phase_error);
+}
+
+
+void
+qa_gr_fxpt_vco::t1 ()
+{
+ gr_vco<float,float> ref_vco;
+ gr_fxpt_vco new_vco;
+ float ref_block[SIN_COS_BLOCK_SIZE];
+ float new_block[SIN_COS_BLOCK_SIZE];
+ float input[SIN_COS_BLOCK_SIZE];
+ double max_error = 0;
+
+ for (int i = 0; i < SIN_COS_BLOCK_SIZE; i++){
+ input[i] = sin(double(i));
+ }
+
+ ref_vco.cos (ref_block, input, SIN_COS_BLOCK_SIZE, SIN_COS_K, SIN_COS_AMPL);
+ new_vco.cos (new_block, input, SIN_COS_BLOCK_SIZE, SIN_COS_K, SIN_COS_AMPL);
+
+ for (int i = 0; i < SIN_COS_BLOCK_SIZE; i++){
+ CPPUNIT_ASSERT_DOUBLES_EQUAL (ref_block[i], new_block[i], SIN_COS_TOLERANCE);
+ max_error = max_d (max_error, ref_block[i]-new_block[i]);
+ }
+ CPPUNIT_ASSERT_DOUBLES_EQUAL (ref_vco.get_phase(), new_vco.get_phase(), SIN_COS_TOLERANCE);
+ // printf ("Fxpt max error %.9f, max phase error %.9f\n", max_error, ref_vco.get_phase()-new_vco.get_phase());
+}
+
+void
+qa_gr_fxpt_vco::t2 ()
+{
+}
+
+void
+qa_gr_fxpt_vco::t3 ()
+{
+}
diff --git a/gnuradio-core/src/lib/general/qa_gr_fxpt_vco.h b/gnuradio-core/src/lib/general/qa_gr_fxpt_vco.h
new file mode 100644
index 000000000..fab8022e3
--- /dev/null
+++ b/gnuradio-core/src/lib/general/qa_gr_fxpt_vco.h
@@ -0,0 +1,48 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2005 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_QA_GR_FXPT_VCO_H
+#define INCLUDED_QA_GR_FXPT_VCO_H
+
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/TestCase.h>
+
+class qa_gr_fxpt_vco : public CppUnit::TestCase {
+
+ CPPUNIT_TEST_SUITE (qa_gr_fxpt_vco);
+ CPPUNIT_TEST (t0);
+ CPPUNIT_TEST (t1);
+ CPPUNIT_TEST (t2);
+ CPPUNIT_TEST (t3);
+ CPPUNIT_TEST_SUITE_END ();
+
+ private:
+ void t0 ();
+ void t1 ();
+ void t2 ();
+ void t3 ();
+
+};
+
+#endif /* INCLUDED_QA_GR_FXPT_VCO_H */
+
+
diff --git a/gnuradio-core/src/lib/general/qa_gr_math.cc b/gnuradio-core/src/lib/general/qa_gr_math.cc
new file mode 100644
index 000000000..74d51b536
--- /dev/null
+++ b/gnuradio-core/src/lib/general/qa_gr_math.cc
@@ -0,0 +1,105 @@
+/*
+ * 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.
+ */
+
+#include <gr_math.h>
+#include <qa_gr_math.h>
+#include <cppunit/TestAssert.h>
+#include <stdio.h>
+
+void
+qa_gr_math::test_binary_slicer1 ()
+{
+ float x[5] = {-1, -0.5, 0, 0.5, 1.0};
+ unsigned int z[5] = {0, 0, 1, 1, 1};
+ unsigned int y;
+
+ //printf("\nBinary\n");
+ for (unsigned int i = 0; i < 5; i++) {
+ y = gr_binary_slicer(x[i]);
+ //printf("in: %f out: %d desired: %d\n", x[i], y, z[i]);
+
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(y, z[i], 1e-9);
+ }
+
+ //printf("\nBranchless Binary\n");
+ for (unsigned int i = 0; i < 5; i++) {
+ y = gr_branchless_binary_slicer(x[i]);
+ //printf("in: %f out: %d desired: %d\n", x[i], y, z[i]);
+
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(y, z[i], 1e-9);
+ }
+}
+
+void
+qa_gr_math::test_quad_0deg_slicer1 ()
+{
+ gr_complex x[4] = {gr_complex(1, 0),
+ gr_complex(0, 1),
+ gr_complex(-1, 0),
+ gr_complex(0, -1)};
+
+ unsigned int z[4] = {0, 1, 2, 3};
+ unsigned int y;
+
+ //printf("\nQuad0\n");
+ for (unsigned int i = 0; i < 4; i++) {
+ y = gr_quad_0deg_slicer(x[i]);
+ //printf("in: %.4f+j%.4f out: %d desired: %d\n", x[i].real(), x[i].imag(), y, z[i]);
+
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(y, z[i], 1e-9);
+ }
+
+ //printf("\nBranchless Quad0\n");
+ for (unsigned int i = 0; i < 4; i++) {
+ y = gr_branchless_quad_0deg_slicer(x[i]);
+ //printf("in: %.4f+j%.4f out: %d desired: %d\n", x[i].real(), x[i].imag(), y, z[i]);
+
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(y, z[i], 1e-9);
+ }
+}
+
+void
+qa_gr_math::test_quad_45deg_slicer1 ()
+{
+ gr_complex x[4] = {gr_complex(0.707, 0.707),
+ gr_complex(-0.707, 0.707),
+ gr_complex(-0.707, -0.707),
+ gr_complex(0.707, -0.707)};
+
+ unsigned int z[4] = {0, 1, 2, 3};
+ unsigned int y;
+
+ //printf("\nQuad45\n");
+ for (unsigned int i = 0; i < 4; i++) {
+ y = gr_quad_45deg_slicer(x[i]);
+ //printf("in: %.4f+j%.4f out: %d desired: %d\n", x[i].real(), x[i].imag(), y, z[i]);
+
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(y, z[i], 1e-9);
+ }
+
+ //printf("\nBranchless Quad45\n");
+ for (unsigned int i = 0; i < 4; i++) {
+ y = gr_branchless_quad_45deg_slicer(x[i]);
+ //printf("in: %.4f+j%.4f out: %d desired: %d\n", x[i].real(), x[i].imag(), y, z[i]);
+
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(y, z[i], 1e-9);
+ }
+}
diff --git a/gnuradio-core/src/lib/general/qa_gr_math.h b/gnuradio-core/src/lib/general/qa_gr_math.h
new file mode 100644
index 000000000..86858c03d
--- /dev/null
+++ b/gnuradio-core/src/lib/general/qa_gr_math.h
@@ -0,0 +1,42 @@
+/* -*- 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.
+ */
+#ifndef _QA_GR_MATH_H_
+#define _QA_GR_MATH_H_
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/TestCase.h>
+
+class qa_gr_math : public CppUnit::TestCase {
+
+ CPPUNIT_TEST_SUITE(qa_gr_math);
+ CPPUNIT_TEST(test_binary_slicer1);
+ CPPUNIT_TEST(test_quad_0deg_slicer1);
+ CPPUNIT_TEST(test_quad_45deg_slicer1);
+ CPPUNIT_TEST_SUITE_END();
+
+ private:
+ void test_binary_slicer1();
+ void test_quad_0deg_slicer1();
+ void test_quad_45deg_slicer1();
+};
+
+#endif /* _QA_GR_MATH_H_ */
diff --git a/gnuradio-core/src/lib/general/qa_gri_lfsr.cc b/gnuradio-core/src/lib/general/qa_gri_lfsr.cc
new file mode 100644
index 000000000..87d610df6
--- /dev/null
+++ b/gnuradio-core/src/lib/general/qa_gri_lfsr.cc
@@ -0,0 +1,142 @@
+/*
+ * 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.
+ */
+
+#include <gri_lfsr.h>
+#include <qa_gri_lfsr.h>
+#include <cppunit/TestAssert.h>
+#include <stdio.h>
+#include <string.h>
+#include <vector>
+
+void
+qa_gri_lfsr::test_lfsr ()
+{
+ int mask = 0x19;
+ int seed = 0x01;
+ int length = 5;
+
+ gri_lfsr lfsr1(mask,seed,length);
+ gri_lfsr lfsr2(mask,seed,length);
+
+ unsigned char expected[] = {1, 0, 1, 1, 0, 1, 0, 1, 0, 0};
+
+ for(unsigned int i=0; i<31; i++){
+ lfsr1.next_bit();
+ }
+
+ // test that after one lfsr cycle we still match out uncycled lfsr
+ for (unsigned int i = 0; i < 41; i++) {
+ CPPUNIT_ASSERT_EQUAL((int) lfsr1.next_bit(), (int) lfsr2.next_bit());
+ }
+
+ // test the known correct values at the given shift offset
+ for(unsigned int i=0; i<10; i++){
+ CPPUNIT_ASSERT_EQUAL((int) lfsr1.next_bit(), (int) expected[i]);
+ }
+
+ // test for register length too long
+ CPPUNIT_ASSERT_THROW(gri_lfsr(mask, seed, 32), std::invalid_argument);
+}
+
+void
+qa_gri_lfsr::test_scrambler()
+{
+ // CCSDS 7-bit scrambler
+ int mask = 0x8A;
+ int seed = 0x7F;
+ int length = 7;
+
+ gri_lfsr scrambler(mask, seed, length);
+
+ // Impulse (1 and 126 more zeroes)
+ unsigned char src[] =
+ { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0 }; // flush bits
+
+ // Impulse response (including leading bits)
+ unsigned char expected[] =
+ { 1, 1, 1, 1, 1, 1, 1,
+ 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0,
+ 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1,
+ 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1,
+ 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0,
+ 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0, 0,
+ 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0,
+ 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0,
+ 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, };
+
+ int len = sizeof(src);
+ std::vector<unsigned char> actual(len);
+
+ for (int i = 0; i < len; i++)
+ actual[i] = scrambler.next_bit_scramble(src[i]);
+
+ CPPUNIT_ASSERT(memcmp(expected, &actual[0], len) == 0);
+}
+
+void
+qa_gri_lfsr::test_descrambler()
+{
+ // CCSDS 7-bit scrambler
+ int mask = 0x8A;
+ int seed = 0x7F;
+ int length = 7;
+
+ gri_lfsr descrambler(mask, seed, length);
+
+ // Scrambled sequence (impulse response)
+ unsigned char src[] =
+ { 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0,
+ 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1,
+ 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1,
+ 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0,
+ 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0, 0,
+ 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0,
+ 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0,
+ 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0 };
+
+ // Original (garbage while synchronizing, them impulse)
+ unsigned char expected[] =
+ { 0, 1, 0, 0, 1, 0,
+ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0 };
+
+ int len = sizeof(src);
+ std::vector<unsigned char> actual(len);
+
+ for (int i = 0; i < len; i++)
+ actual[i] = descrambler.next_bit_descramble(src[i]);
+
+ CPPUNIT_ASSERT(memcmp(expected, &actual[0], len) == 0);
+}
diff --git a/gnuradio-core/src/lib/general/qa_gri_lfsr.h b/gnuradio-core/src/lib/general/qa_gri_lfsr.h
new file mode 100644
index 000000000..e91843bbb
--- /dev/null
+++ b/gnuradio-core/src/lib/general/qa_gri_lfsr.h
@@ -0,0 +1,42 @@
+/* -*- 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.
+ */
+#ifndef _QA_GRI_LFSR_H_
+#define _QA_GRI_LFSR_H_
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/TestCase.h>
+
+class qa_gri_lfsr : public CppUnit::TestCase {
+
+ CPPUNIT_TEST_SUITE(qa_gri_lfsr);
+ CPPUNIT_TEST(test_lfsr);
+ CPPUNIT_TEST(test_scrambler);
+ CPPUNIT_TEST(test_descrambler);
+ CPPUNIT_TEST_SUITE_END();
+
+ private:
+ void test_lfsr();
+ void test_scrambler();
+ void test_descrambler();
+};
+
+#endif /* _QA_GRI_LFSR_H_ */
diff --git a/gnuradio-core/src/lib/general/random.h b/gnuradio-core/src/lib/general/random.h
new file mode 100644
index 000000000..c643c3e42
--- /dev/null
+++ b/gnuradio-core/src/lib/general/random.h
@@ -0,0 +1,38 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2003, 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.
+ */
+
+#ifndef _RANDOM_H_
+#define _RANDOM_H_
+
+// While rand(3) specifies RAND_MAX, random(3) says that the output
+// ranges from 0 to 2^31-1 but does not specify a macro to denote
+// this. We define RANDOM_MAX for cleanliness. We must omit the
+// definition for systems that have made the same choice. (Note that
+// random(3) is from 4.2BSD, and not specified by POSIX.)
+
+#ifndef RANDOM_MAX
+static const int RANDOM_MAX = 2147483647; // 2^31-1
+#endif /* RANDOM_MAX */
+
+#include <stdlib.h>
+
+#endif // _RANDOM_H_
diff --git a/gnuradio-core/src/lib/general/sine_table.h b/gnuradio-core/src/lib/general/sine_table.h
new file mode 100644
index 000000000..69834943b
--- /dev/null
+++ b/gnuradio-core/src/lib/general/sine_table.h
@@ -0,0 +1,1025 @@
+ // max_error = 2.353084136763606e-06
+ { 2.925817799165007e-09, 7.219194364267018e-09 },
+ { 2.925707643778599e-09, 2.526699001579799e-07 },
+ { 2.925487337153070e-09, 1.191140162167675e-06 },
+ { 2.925156887582842e-09, 3.284585035595589e-06 },
+ { 2.924716307509151e-09, 6.994872605695784e-06 },
+ { 2.924165613519592e-09, 1.278374920658798e-05 },
+ { 2.923504826347475e-09, 2.111280464718590e-05 },
+ { 2.922733970871080e-09, 3.244343744537165e-05 },
+ { 2.921853076112655e-09, 4.723682007436170e-05 },
+ { 2.920862175237416e-09, 6.595386421935634e-05 },
+ { 2.919761305552202e-09, 8.905518605213658e-05 },
+ { 2.918550508504146e-09, 1.170010715193098e-04 },
+ { 2.917229829679050e-09, 1.502514416517192e-04 },
+ { 2.915799318799769e-09, 1.892658178912071e-04 },
+ { 2.914259029724184e-09, 2.345032874456615e-04 },
+ { 2.912609020443340e-09, 2.864224686607020e-04 },
+ { 2.910849353079123e-09, 3.454814764261432e-04 },
+ { 2.908980093882049e-09, 4.121378876027343e-04 },
+ { 2.907001313228646e-09, 4.868487064877691e-04 },
+ { 2.904913085618902e-09, 5.700703303049837e-04 },
+ { 2.902715489673383e-09, 6.622585147355725e-04 },
+ { 2.900408608130373e-09, 7.638683394782519e-04 },
+ { 2.897992527842612e-09, 8.753541738578119e-04 },
+ { 2.895467339774186e-09, 9.971696424604937e-04 },
+ { 2.892833138996999e-09, 1.129767590823255e-03 },
+ { 2.890090024687216e-09, 1.273600051161478e-03 },
+ { 2.887238100121550e-09, 1.429118208142094e-03 },
+ { 2.884277472673313e-09, 1.596772364709564e-03 },
+ { 2.881208253808507e-09, 1.777011907950626e-03 },
+ { 2.878030559081432e-09, 1.970285275029487e-03 },
+ { 2.874744508130554e-09, 2.177039919152579e-03 },
+ { 2.871350224673798e-09, 2.397722275614272e-03 },
+ { 2.867847836504030e-09, 2.632777727878843e-03 },
+ { 2.864237475484149e-09, 2.882650573737405e-03 },
+ { 2.860519277542297e-09, 3.147783991507308e-03 },
+ { 2.856693382666432e-09, 3.428620006328931e-03 },
+ { 2.852759934899389e-09, 3.725599456482154e-03 },
+ { 2.848719082333207e-09, 4.039161959812243e-03 },
+ { 2.844570977103752e-09, 4.369745880190706e-03 },
+ { 2.840315775384800e-09, 4.717788294077374e-03 },
+ { 2.835953637382310e-09, 5.083724957128360e-03 },
+ { 2.831484727328322e-09, 5.467990270896617e-03 },
+ { 2.826909213474759e-09, 5.871017249604038e-03 },
+ { 2.822227268087134e-09, 6.293237486988512e-03 },
+ { 2.817439067438018e-09, 6.735081123237729e-03 },
+ { 2.812544791800534e-09, 7.196976811989608e-03 },
+ { 2.807544625441273e-09, 7.679351687456759e-03 },
+ { 2.802438756613836e-09, 8.182631331563162e-03 },
+ { 2.797227377551135e-09, 8.707239741274575e-03 },
+ { 2.791910684458716e-09, 9.253599295902304e-03 },
+ { 2.786488877507140e-09, 9.822130724578715e-03 },
+ { 2.780962160824228e-09, 1.041325307382490e-02 },
+ { 2.775330742487884e-09, 1.102738367513773e-02 },
+ { 2.769594834517682e-09, 1.166493811278924e-02 },
+ { 2.763754652867477e-09, 1.232633019159818e-02 },
+ { 2.757810417416620e-09, 1.301197190494069e-02 },
+ { 2.751762351962413e-09, 1.372227340270610e-02 },
+ { 2.745610684210923e-09, 1.445764295952962e-02 },
+ { 2.739355645769094e-09, 1.521848694296229e-02 },
+ { 2.732997472135539e-09, 1.600520978188769e-02 },
+ { 2.726536402691907e-09, 1.681821393496225e-02 },
+ { 2.719972680693777e-09, 1.765789985920713e-02 },
+ { 2.713306553261610e-09, 1.852466597868779e-02 },
+ { 2.706538271371373e-09, 1.941890865333146e-02 },
+ { 2.699668089844909e-09, 2.034102214787814e-02 },
+ { 2.692696267340880e-09, 2.129139860085272e-02 },
+ { 2.685623066344263e-09, 2.227042799383416e-02 },
+ { 2.678448753157212e-09, 2.327849812064098e-02 },
+ { 2.671173597888530e-09, 2.431599455681316e-02 },
+ { 2.663797874443630e-09, 2.538330062913108e-02 },
+ { 2.656321860514457e-09, 2.648079738524795e-02 },
+ { 2.648745837568575e-09, 2.760886356354952e-02 },
+ { 2.641070090839117e-09, 2.876787556300114e-02 },
+ { 2.633294909313421e-09, 2.995820741329835e-02 },
+ { 2.625420585722845e-09, 3.118023074495535e-02 },
+ { 2.617447416531143e-09, 3.243431475972608e-02 },
+ { 2.609375701923643e-09, 3.372082620101990e-02 },
+ { 2.601205745795833e-09, 3.504012932452527e-02 },
+ { 2.592937855741933e-09, 3.639258586895711e-02 },
+ { 2.584572343043400e-09, 3.777855502693250e-02 },
+ { 2.576109522656942e-09, 3.919839341605197e-02 },
+ { 2.567549713203028e-09, 4.065245505002102e-02 },
+ { 2.558893236953688e-09, 4.214109131001403e-02 },
+ { 2.550140419820252e-09, 4.366465091617666e-02 },
+ { 2.541291591341445e-09, 4.522347989919473e-02 },
+ { 2.532347084670572e-09, 4.681792157215026e-02 },
+ { 2.523307236563343e-09, 4.844831650239501e-02 },
+ { 2.514172387364900e-09, 5.011500248369893e-02 },
+ { 2.504942880997064e-09, 5.181831450849345e-02 },
+ { 2.495619064945627e-09, 5.355858474024022e-02 },
+ { 2.486201290246928e-09, 5.533614248606705e-02 },
+ { 2.476689911475047e-09, 5.715131416942842e-02 },
+ { 2.467085286727668e-09, 5.900442330315692e-02 },
+ { 2.457387777613798e-09, 6.089579046229943e-02 },
+ { 2.447597749239101e-09, 6.282573325755320e-02 },
+ { 2.437715570192557e-09, 6.479456630859221e-02 },
+ { 2.427741612532542e-09, 6.680260121764925e-02 },
+ { 2.417676251773166e-09, 6.885014654319160e-02 },
+ { 2.407519866869294e-09, 7.093750777401114e-02 },
+ { 2.397272840203310e-09, 7.306498730310884e-02 },
+ { 2.386935557569868e-09, 7.523288440214027e-02 },
+ { 2.376508408161815e-09, 7.744149519577415e-02 },
+ { 2.365991784555363e-09, 7.969111263635709e-02 },
+ { 2.355386082695641e-09, 8.198202647865405e-02 },
+ { 2.344691701881232e-09, 8.431452325495814e-02 },
+ { 2.333909044749407e-09, 8.668888625021409e-02 },
+ { 2.323038517261246e-09, 8.910539547731611e-02 },
+ { 2.312080528685971e-09, 9.156432765274414e-02 },
+ { 2.301035491585642e-09, 9.406595617227698e-02 },
+ { 2.289903821799651e-09, 9.661055108691619e-02 },
+ { 2.278685938428940e-09, 9.919837907903295e-02 },
+ { 2.267382263820762e-09, 1.018297034385580e-01 },
+ { 2.255993223551837e-09, 1.045047840397028e-01 },
+ { 2.244519246413220e-09, 1.072238773174577e-01 },
+ { 2.232960764393620e-09, 1.099872362446146e-01 },
+ { 2.221318212663309e-09, 1.127951103088245e-01 },
+ { 2.209592029557811e-09, 1.156477454898748e-01 },
+ { 2.197782656561395e-09, 1.185453842371912e-01 },
+ { 2.185890538290176e-09, 1.214882654476019e-01 },
+ { 2.173916122475606e-09, 1.244766244431883e-01 },
+ { 2.161859859947797e-09, 1.275106929493488e-01 },
+ { 2.149722204618256e-09, 1.305906990731841e-01 },
+ { 2.137503613462743e-09, 1.337168672820376e-01 },
+ { 2.125204546504321e-09, 1.368894183821595e-01 },
+ { 2.112825466795944e-09, 1.401085694976751e-01 },
+ { 2.100366840402933e-09, 1.433745340497602e-01 },
+ { 2.087829136385612e-09, 1.466875217359607e-01 },
+ { 2.075212826781308e-09, 1.500477385098620e-01 },
+ { 2.062518386587093e-09, 1.534553865607503e-01 },
+ { 2.049746293741359e-09, 1.569106642937665e-01 },
+ { 2.036897029106193e-09, 1.604137663100403e-01 },
+ { 2.023971076449323e-09, 1.639648833871233e-01 },
+ { 2.010968922425217e-09, 1.675642024598467e-01 },
+ { 1.997891056557933e-09, 1.712119066008896e-01 },
+ { 1.984737971221581e-09, 1.749081750021970e-01 },
+ { 1.971510161622434e-09, 1.786531829561379e-01 },
+ { 1.958208125780130e-09, 1.824471018371070e-01 },
+ { 1.944832364508511e-09, 1.862900990834311e-01 },
+ { 1.931383381397782e-09, 1.901823381790926e-01 },
+ { 1.917861682794392e-09, 1.941239786363039e-01 },
+ { 1.904267777782611e-09, 1.981151759777950e-01 },
+ { 1.890602178165317e-09, 2.021560817195309e-01 },
+ { 1.876865398444616e-09, 2.062468433536743e-01 },
+ { 1.863057955802572e-09, 2.103876043317229e-01 },
+ { 1.849180370081465e-09, 2.145785040479915e-01 },
+ { 1.835233163764673e-09, 2.188196778231083e-01 },
+ { 1.821216861956509e-09, 2.231112568880342e-01 },
+ { 1.807131992362945e-09, 2.274533683680190e-01 },
+ { 1.792979085271234e-09, 2.318461352671018e-01 },
+ { 1.778758673530482e-09, 2.362896764525300e-01 },
+ { 1.764471292530943e-09, 2.407841066397789e-01 },
+ { 1.750117480184598e-09, 2.453295363773890e-01 },
+ { 1.735697776904342e-09, 2.499260720324433e-01 },
+ { 1.721212725583874e-09, 2.545738157760434e-01 },
+ { 1.706662871577097e-09, 2.592728655691494e-01 },
+ { 1.692048762677849e-09, 2.640233151485341e-01 },
+ { 1.677370949099090e-09, 2.688252540131204e-01 },
+ { 1.662629983452104e-09, 2.736787674105404e-01 },
+ { 1.647826420726167e-09, 2.785839363237506e-01 },
+ { 1.632960818266680e-09, 2.835408374583758e-01 },
+ { 1.618033735755429e-09, 2.885495432295704e-01 },
+ { 1.603045735188609e-09, 2.936101217498361e-01 },
+ { 1.587997380855918e-09, 2.987226368167127e-01 },
+ { 1.572889239319430e-09, 3.038871479007593e-01 },
+ { 1.557721879392051e-09, 3.091037101339017e-01 },
+ { 1.542495872116447e-09, 3.143723742978435e-01 },
+ { 1.527211790743024e-09, 3.196931868130269e-01 },
+ { 1.511870210708909e-09, 3.250661897274744e-01 },
+ { 1.496471709615926e-09, 3.304914207062036e-01 },
+ { 1.481016867208896e-09, 3.359689130207621e-01 },
+ { 1.465506265353924e-09, 3.414986955389885e-01 },
+ { 1.449940488016384e-09, 3.470807927151147e-01 },
+ { 1.434320121238994e-09, 3.527152245800635e-01 },
+ { 1.418645753119802e-09, 3.584020067320109e-01 },
+ { 1.402917973789838e-09, 3.641411503272979e-01 },
+ { 1.387137375391042e-09, 3.699326620714776e-01 },
+ { 1.371304552054134e-09, 3.757765442106153e-01 },
+ { 1.355420099875958e-09, 3.816727945230153e-01 },
+ { 1.339484616897137e-09, 3.876214063110671e-01 },
+ { 1.323498703079580e-09, 3.936223683933865e-01 },
+ { 1.307462960283922e-09, 3.996756650972121e-01 },
+ { 1.291377992246768e-09, 4.057812762511174e-01 },
+ { 1.275244404558188e-09, 4.119391771778626e-01 },
+ { 1.259062804638585e-09, 4.181493386877248e-01 },
+ { 1.242833801715929e-09, 4.244117270719281e-01 },
+ { 1.226558006803155e-09, 4.307263040962509e-01 },
+ { 1.210236032674760e-09, 4.370930269951803e-01 },
+ { 1.193868493843725e-09, 4.435118484661861e-01 },
+ { 1.177456006538695e-09, 4.499827166641340e-01 },
+ { 1.160999188680582e-09, 4.565055751961679e-01 },
+ { 1.144498659859216e-09, 4.630803631168164e-01 },
+ { 1.127955041310214e-09, 4.697070149232604e-01 },
+ { 1.111368955891417e-09, 4.763854605510119e-01 },
+ { 1.094741028059551e-09, 4.831156253697562e-01 },
+ { 1.078071883846871e-09, 4.898974301794375e-01 },
+ { 1.061362150836978e-09, 4.967307912069362e-01 },
+ { 1.044612458142151e-09, 5.036156201023686e-01 },
+ { 1.027823436378632e-09, 5.105518239364775e-01 },
+ { 1.010995717643647e-09, 5.175393051975563e-01 },
+ { 9.941299354913699e-10, 5.245779617890562e-01 },
+ { 9.772267249089968e-10, 5.316676870274011e-01 },
+ { 9.602867222926046e-10, 5.388083696401416e-01 },
+ { 9.433105654240147e-10, 5.459998937639375e-01 },
+ { 9.262988934458084e-10, 5.532421389435711e-01 },
+ { 9.092523468378193e-10, 5.605349801305876e-01 },
+ { 8.921715673928355e-10, 5.678782876825250e-01 },
+ { 8.750571981926701e-10, 5.752719273622372e-01 },
+ { 8.579098835836508e-10, 5.827157603377209e-01 },
+ { 8.407302691522673e-10, 5.902096431821322e-01 },
+ { 8.235190017016133e-10, 5.977534278737073e-01 },
+ { 8.062767292259225e-10, 6.053469617967722e-01 },
+ { 7.890041008871165e-10, 6.129900877421282e-01 },
+ { 7.717017669898175e-10, 6.206826439083659e-01 },
+ { 7.543703789572603e-10, 6.284244639030392e-01 },
+ { 7.370105893063053e-10, 6.362153767444958e-01 },
+ { 7.196230516231919e-10, 6.440552068636356e-01 },
+ { 7.022084205389746e-10, 6.519437741060674e-01 },
+ { 6.847673517046416e-10, 6.598808937346672e-01 },
+ { 6.673005017664976e-10, 6.678663764322770e-01 },
+ { 6.498085283416530e-10, 6.759000283046127e-01 },
+ { 6.322920899929834e-10, 6.839816508836737e-01 },
+ { 6.147518462045659e-10, 6.921110411311926e-01 },
+ { 5.971884573565851e-10, 7.002879914425926e-01 },
+ { 5.796025847007168e-10, 7.085122896509806e-01 },
+ { 5.619948903351406e-10, 7.167837190315758e-01 },
+ { 5.443660371796048e-10, 7.251020583063744e-01 },
+ { 5.267166889504394e-10, 7.334670816491009e-01 },
+ { 5.090475101356742e-10, 7.418785586903696e-01 },
+ { 4.913591659698399e-10, 7.503362545232619e-01 },
+ { 4.736523224091392e-10, 7.588399297089872e-01 },
+ { 4.559276461062478e-10, 7.673893402829834e-01 },
+ { 4.381858043851147e-10, 7.759842377612828e-01 },
+ { 4.204274652161870e-10, 7.846243691469355e-01 },
+ { 4.026532971908398e-10, 7.933094769370790e-01 },
+ { 3.848639694963359e-10, 8.020392991300200e-01 },
+ { 3.670601518910503e-10, 8.108135692324444e-01 },
+ { 3.492425146784233e-10, 8.196320162675177e-01 },
+ { 3.314117286825031e-10, 8.284943647824689e-01 },
+ { 3.135684652223755e-10, 8.374003348569865e-01 },
+ { 2.957133960867535e-10, 8.463496421118015e-01 },
+ { 2.778471935089361e-10, 8.553419977173513e-01 },
+ { 2.599705301412391e-10, 8.643771084029740e-01 },
+ { 2.420840790301135e-10, 8.734546764660205e-01 },
+ { 2.241885135902046e-10, 8.825743997817682e-01 },
+ { 2.062845075795238e-10, 8.917359718130367e-01 },
+ { 1.883727350736140e-10, 9.009390816205823e-01 },
+ { 1.704538704408269e-10, 9.101834138731877e-01 },
+ { 1.525285883160648e-10, 9.194686488588080e-01 },
+ { 1.345975635762696e-10, 9.287944624950824e-01 },
+ { 1.166614713141648e-10, 9.381605263410157e-01 },
+ { 9.872098681369190e-11, 9.475665076080466e-01 },
+ { 8.077678552380464e-11, 9.570120691722380e-01 },
+ { 6.282954303364090e-11, 9.664968695860140e-01 },
+ { 4.487993504668797e-11, 9.760205630906909e-01 },
+ { 2.692863735553042e-11, 9.855827996289697e-01 },
+ { 8.976325816439114e-12, 9.951832248577780e-01 },
+ { -8.976323676304494e-12, 1.004821480161519e+00 },
+ { -2.692863521550168e-11, 1.014497202665280e+00 },
+ { -4.487993290681805e-11, 1.024210025248670e+00 },
+ { -6.282954089398273e-11, 1.033959576559617e+00 },
+ { -8.077678338451706e-11, 1.043745481028715e+00 },
+ { -9.872098467477489e-11, 1.053567358883467e+00 },
+ { -1.166614691757772e-10, 1.063424826163223e+00 },
+ { -1.345975614383584e-10, 1.073317494734013e+00 },
+ { -1.525285861788948e-10, 1.083244972303963e+00 },
+ { -1.704538683042922e-10, 1.093206862438572e+00 },
+ { -1.883727329379793e-10, 1.103202764576806e+00 },
+ { -2.062845054446831e-10, 1.113232274046796e+00 },
+ { -2.241885114563697e-10, 1.123294982082432e+00 },
+ { -2.420840768973375e-10, 1.133390475839767e+00 },
+ { -2.599705280096278e-10, 1.143518338413855e+00 },
+ { -2.778471913784365e-10, 1.153678148855860e+00 },
+ { -2.957133939575774e-10, 1.163869482190458e+00 },
+ { -3.135684630945758e-10, 1.174091909433296e+00 },
+ { -3.314117265561857e-10, 1.184344997608959e+00 },
+ { -3.492425125535882e-10, 1.194628309769018e+00 },
+ { -3.670601497678034e-10, 1.204941405010466e+00 },
+ { -3.848639673748360e-10, 1.215283838494269e+00 },
+ { -4.026532950710339e-10, 1.225655161464298e+00 },
+ { -4.204274630982869e-10, 1.236054921266445e+00 },
+ { -4.381858022691734e-10, 1.246482661367958e+00 },
+ { -4.559276439922654e-10, 1.256937921377146e+00 },
+ { -4.736523202972214e-10, 1.267420237063216e+00 },
+ { -4.913591638600925e-10, 1.277929140376502e+00 },
+ { -5.090475080282032e-10, 1.288464159468706e+00 },
+ { -5.267166868452449e-10, 1.299024818713528e+00 },
+ { -5.443660350768455e-10, 1.309610638727845e+00 },
+ { -5.619948882348695e-10, 1.320221136392390e+00 },
+ { -5.796025826029868e-10, 1.330855824873457e+00 },
+ { -5.971884552615020e-10, 1.341514213644420e+00 },
+ { -6.147518441122357e-10, 1.352195808507556e+00 },
+ { -6.322920879034590e-10, 1.362900111616144e+00 },
+ { -6.498085262549874e-10, 1.373626621496939e+00 },
+ { -6.673004996827436e-10, 1.384374833072571e+00 },
+ { -6.847673496239581e-10, 1.395144237684605e+00 },
+ { -7.022084184613616e-10, 1.405934323116231e+00 },
+ { -7.196230495488082e-10, 1.416744573616104e+00 },
+ { -7.370105872352039e-10, 1.427574469921397e+00 },
+ { -7.543703768894941e-10, 1.438423489281758e+00 },
+ { -7.717017649255453e-10, 1.449291105483472e+00 },
+ { -7.890040988262324e-10, 1.460176788873383e+00 },
+ { -8.062767271686383e-10, 1.471080006383765e+00 },
+ { -8.235189996479819e-10, 1.482000221556656e+00 },
+ { -8.407302671024475e-10, 1.492936894569018e+00 },
+ { -8.579098815375368e-10, 1.503889482257845e+00 },
+ { -8.750571961505266e-10, 1.514857438145604e+00 },
+ { -8.921715653546624e-10, 1.525840212465756e+00 },
+ { -9.092523448036167e-10, 1.536837252188703e+00 },
+ { -9.262988914157881e-10, 1.547848001047890e+00 },
+ { -9.433105633981766e-10, 1.558871899565883e+00 },
+ { -9.602867202711075e-10, 1.569908385081254e+00 },
+ { -9.772267228916820e-10, 1.580956891774897e+00 },
+ { -9.941299334786078e-10, 1.592016850697478e+00 },
+ { -1.010995715635332e-09, 1.603087689796053e+00 },
+ { -1.027823434374870e-09, 1.614168833942028e+00 },
+ { -1.044612456143047e-09, 1.625259704958335e+00 },
+ { -1.061362148842745e-09, 1.636359721647526e+00 },
+ { -1.078071881857297e-09, 1.647468299819543e+00 },
+ { -1.094741026074900e-09, 1.658584852320419e+00 },
+ { -1.111368953911690e-09, 1.669708789060341e+00 },
+ { -1.127955039335462e-09, 1.680839517042381e+00 },
+ { -1.144498657889600e-09, 1.691976440391624e+00 },
+ { -1.160999186716154e-09, 1.703118960383971e+00 },
+ { -1.177456004579561e-09, 1.714266475475616e+00 },
+ { -1.193868491889832e-09, 1.725418381332405e+00 },
+ { -1.210236030726319e-09, 1.736574070859850e+00 },
+ { -1.226558004860220e-09, 1.747732934232508e+00 },
+ { -1.242833799778447e-09, 1.758894358924547e+00 },
+ { -1.259062802706714e-09, 1.770057729740021e+00 },
+ { -1.275244402631982e-09, 1.781222428842935e+00 },
+ { -1.291377990326492e-09, 1.792387835788660e+00 },
+ { -1.307462958369363e-09, 1.803553327553897e+00 },
+ { -1.323498701170897e-09, 1.814718278568759e+00 },
+ { -1.339484614994490e-09, 1.825882060747428e+00 },
+ { -1.355420097979292e-09, 1.837044043519582e+00 },
+ { -1.371304550163662e-09, 1.848203593862598e+00 },
+ { -1.387137373506711e-09, 1.859360076332671e+00 },
+ { -1.402917971911754e-09, 1.870512853097495e+00 },
+ { -1.418645751248018e-09, 1.881661283967967e+00 },
+ { -1.434320119373722e-09, 1.892804726431080e+00 },
+ { -1.449940486157623e-09, 1.903942535681972e+00 },
+ { -1.465506263501516e-09, 1.915074064656886e+00 },
+ { -1.481016865363264e-09, 1.926198664066737e+00 },
+ { -1.496471707776859e-09, 1.937315682428795e+00 },
+ { -1.511870208876724e-09, 1.948424466101625e+00 },
+ { -1.527211788917509e-09, 1.959524359317042e+00 },
+ { -1.542495870297867e-09, 1.970614704215133e+00 },
+ { -1.557721877580406e-09, 1.981694840876775e+00 },
+ { -1.572889237514880e-09, 1.992764107358707e+00 },
+ { -1.587997379058514e-09, 2.003821839726753e+00 },
+ { -1.603045733398246e-09, 2.014867372090665e+00 },
+ { -1.618033733972424e-09, 2.025900036638798e+00 },
+ { -1.632960816490822e-09, 2.036919163671778e+00 },
+ { -1.647826418957721e-09, 2.047924081638631e+00 },
+ { -1.662629981691070e-09, 2.058914117170269e+00 },
+ { -1.677370947345626e-09, 2.069888595116115e+00 },
+ { -1.692048760931849e-09, 2.080846838577820e+00 },
+ { -1.706662869838827e-09, 2.091788168946183e+00 },
+ { -1.721212723853279e-09, 2.102711905935372e+00 },
+ { -1.735697775181424e-09, 2.113617367619504e+00 },
+ { -1.750117478469621e-09, 2.124503870468520e+00 },
+ { -1.764471290823748e-09, 2.135370729383332e+00 },
+ { -1.778758671831281e-09, 2.146217257733207e+00 },
+ { -1.792979083579974e-09, 2.157042767390815e+00 },
+ { -1.807131990679890e-09, 2.167846568770014e+00 },
+ { -1.821216860281448e-09, 2.178627970860822e+00 },
+ { -1.835233162097977e-09, 2.189386281268046e+00 },
+ { -1.849180368423027e-09, 2.200120806246095e+00 },
+ { -1.863057954152340e-09, 2.210830850737588e+00 },
+ { -1.876865396802907e-09, 2.221515718409926e+00 },
+ { -1.890602176531920e-09, 2.232174711691990e+00 },
+ { -1.904267776157843e-09, 2.242807131812679e+00 },
+ { -1.917861681178094e-09, 2.253412278837029e+00 },
+ { -1.931383379790273e-09, 2.263989451705295e+00 },
+ { -1.944832362909578e-09, 2.274537948269257e+00 },
+ { -1.958208124189984e-09, 2.285057065331676e+00 },
+ { -1.971510160041235e-09, 2.295546098682665e+00 },
+ { -1.984737969649064e-09, 2.306004343138794e+00 },
+ { -1.997891054994522e-09, 2.316431092581699e+00 },
+ { -2.010968920870647e-09, 2.326825639994779e+00 },
+ { -2.023971074903858e-09, 2.337187277503834e+00 },
+ { -2.036897027569834e-09, 2.347515296413520e+00 },
+ { -2.049746292214264e-09, 2.357808987247877e+00 },
+ { -2.062518385069210e-09, 2.368067639787542e+00 },
+ { -2.075212825272584e-09, 2.378290543109652e+00 },
+ { -2.087829134886364e-09, 2.388476985626922e+00 },
+ { -2.100366838912949e-09, 2.398626255125417e+00 },
+ { -2.112825465315542e-09, 2.408737638805759e+00 },
+ { -2.125204545033289e-09, 2.418810423320288e+00 },
+ { -2.137503612001452e-09, 2.428843894814472e+00 },
+ { -2.149722203166389e-09, 2.438837338964302e+00 },
+ { -2.161859858505829e-09, 2.448790041018174e+00 },
+ { -2.173916121043380e-09, 2.458701285834241e+00 },
+ { -2.185890536867478e-09, 2.468570357921585e+00 },
+ { -2.197782655148702e-09, 2.478396541480230e+00 },
+ { -2.209592028154913e-09, 2.488179120439544e+00 },
+ { -2.221318211270522e-09, 2.497917378500214e+00 },
+ { -2.232960763010574e-09, 2.507610599172123e+00 },
+ { -2.244519245040444e-09, 2.517258065817044e+00 },
+ { -2.255993222189014e-09, 2.526859061686102e+00 },
+ { -2.267382262468209e-09, 2.536412869962689e+00 },
+ { -2.278685937086658e-09, 2.545918773800664e+00 },
+ { -2.289903820467374e-09, 2.555376056366064e+00 },
+ { -2.301035490263848e-09, 2.564784000877677e+00 },
+ { -2.312080527374447e-09, 2.574141890646339e+00 },
+ { -2.323038515960257e-09, 2.583449009117307e+00 },
+ { -2.333909043458635e-09, 2.592704639909166e+00 },
+ { -2.344691700601153e-09, 2.601908066856634e+00 },
+ { -2.355386081425938e-09, 2.611058574048749e+00 },
+ { -2.365991783296513e-09, 2.620155445872768e+00 },
+ { -2.376508406913500e-09, 2.629197967052127e+00 },
+ { -2.386935556332088e-09, 2.638185422689490e+00 },
+ { -2.397272838976436e-09, 2.647117098307332e+00 },
+ { -2.407519865653114e-09, 2.655992279887846e+00 },
+ { -2.417676250567891e-09, 2.664810253915885e+00 },
+ { -2.427741611338014e-09, 2.673570307418169e+00 },
+ { -2.437715569009093e-09, 2.682271728006635e+00 },
+ { -2.447597748066437e-09, 2.690913803917100e+00 },
+ { -2.457387776452357e-09, 2.699495824053297e+00 },
+ { -2.467085285577292e-09, 2.708017078025636e+00 },
+ { -2.476689910335470e-09, 2.716476856194105e+00 },
+ { -2.486201289118733e-09, 2.724874449709689e+00 },
+ { -2.495619063828443e-09, 2.733209150554255e+00 },
+ { -2.504942879891263e-09, 2.741480251583985e+00 },
+ { -2.514172386270163e-09, 2.749687046568741e+00 },
+ { -2.523307235480146e-09, 2.757828830235740e+00 },
+ { -2.532347083598520e-09, 2.765904898308531e+00 },
+ { -2.541291590280960e-09, 2.773914547551261e+00 },
+ { -2.550140418771202e-09, 2.781857075807392e+00 },
+ { -2.558893235915887e-09, 2.789731782043156e+00 },
+ { -2.567549712176927e-09, 2.797537966388929e+00 },
+ { -2.576109521642196e-09, 2.805274930179221e+00 },
+ { -2.584572342040407e-09, 2.812941975996573e+00 },
+ { -2.592937854750428e-09, 2.820538407710556e+00 },
+ { -2.601205744816134e-09, 2.828063530521908e+00 },
+ { -2.609375700955458e-09, 2.835516651001539e+00 },
+ { -2.617447415574869e-09, 2.842897077134583e+00 },
+ { -2.625420584778350e-09, 2.850204118359573e+00 },
+ { -2.633294908380520e-09, 2.857437085611509e+00 },
+ { -2.641070089918234e-09, 2.864595291363663e+00 },
+ { -2.648745836659391e-09, 2.871678049666939e+00 },
+ { -2.656321859617343e-09, 2.878684676194483e+00 },
+ { -2.663797873558322e-09, 2.885614488280000e+00 },
+ { -2.671173597015318e-09, 2.892466804962122e+00 },
+ { -2.678448752295859e-09, 2.899240947023252e+00 },
+ { -2.685623065495139e-09, 2.905936237033475e+00 },
+ { -2.692696266503800e-09, 2.912551999389617e+00 },
+ { -2.699668089019767e-09, 2.919087560358171e+00 },
+ { -2.706538270558513e-09, 2.925542248116882e+00 },
+ { -2.713306552460767e-09, 2.931915392794031e+00 },
+ { -2.719972679905295e-09, 2.938206326512581e+00 },
+ { -2.726536401915442e-09, 2.944414383428562e+00 },
+ { -2.732997471371516e-09, 2.950538899775061e+00 },
+ { -2.739355645017194e-09, 2.956579213900666e+00 },
+ { -2.745610683471516e-09, 2.962534666313284e+00 },
+ { -2.751762351235315e-09, 2.968404599718795e+00 },
+ { -2.757810416701751e-09, 2.974188359063684e+00 },
+ { -2.763754652165128e-09, 2.979885291576143e+00 },
+ { -2.769594833827588e-09, 2.985494746805227e+00 },
+ { -2.775330741810390e-09, 2.991016076664491e+00 },
+ { -2.780962160159068e-09, 2.996448635469842e+00 },
+ { -2.786488876854607e-09, 3.001791779983262e+00 },
+ { -2.791910683818570e-09, 3.007044869450794e+00 },
+ { -2.797227376923695e-09, 3.012207265645876e+00 },
+ { -2.802438755998943e-09, 3.017278332907412e+00 },
+ { -2.807544624838820e-09, 3.022257438182037e+00 },
+ { -2.812544791210840e-09, 3.027143951064684e+00 },
+ { -2.817439066860792e-09, 3.031937243837070e+00 },
+ { -2.822227267522746e-09, 3.036636691510884e+00 },
+ { -2.826909212922864e-09, 3.041241671864994e+00 },
+ { -2.831484726789317e-09, 3.045751565488710e+00 },
+ { -2.835953636855826e-09, 3.050165755818853e+00 },
+ { -2.840315774871260e-09, 3.054483629182857e+00 },
+ { -2.844570976602957e-09, 3.058704574835744e+00 },
+ { -2.848719081844986e-09, 3.062827985002047e+00 },
+ { -2.852759934424164e-09, 3.066853254915581e+00 },
+ { -2.856693382203833e-09, 3.070779782857041e+00 },
+ { -2.860519277092708e-09, 3.074606970196721e+00 },
+ { -2.864237475047239e-09, 3.078334221430809e+00 },
+ { -2.867847836080156e-09, 3.081960944223928e+00 },
+ { -2.871350224262603e-09, 3.085486549445314e+00 },
+ { -2.874744507732462e-09, 3.088910451211251e+00 },
+ { -2.878030558696270e-09, 3.092232066921130e+00 },
+ { -2.881208253436038e-09, 3.095450817298478e+00 },
+ { -2.884277472313999e-09, 3.098566126429974e+00 },
+ { -2.887238099774968e-09, 3.101577421802070e+00 },
+ { -2.890090024353816e-09, 3.104484134342861e+00 },
+ { -2.892833138676371e-09, 3.107285698457308e+00 },
+ { -2.895467339466766e-09, 3.109981552069083e+00 },
+ { -2.897992527547963e-09, 3.112571136655481e+00 },
+ { -2.900408607848946e-09, 3.115053897289195e+00 },
+ { -2.902715489404992e-09, 3.117429282673042e+00 },
+ { -2.904913085363323e-09, 3.119696745180238e+00 },
+ { -2.907001312986328e-09, 3.121855740892224e+00 },
+ { -2.908980093652563e-09, 3.123905729634218e+00 },
+ { -2.910849352862924e-09, 3.125846175016163e+00 },
+ { -2.912609020239985e-09, 3.127676544466606e+00 },
+ { -2.914259029534118e-09, 3.129396309273659e+00 },
+ { -2.915799318622574e-09, 3.131004944618667e+00 },
+ { -2.917229829515169e-09, 3.132501929616775e+00 },
+ { -2.918550508353347e-09, 3.133886747350606e+00 },
+ { -2.919761305414294e-09, 3.135158884909254e+00 },
+ { -2.920862175112829e-09, 3.136317833424958e+00 },
+ { -2.921853076000972e-09, 3.137363088107359e+00 },
+ { -2.922733970772719e-09, 3.138294148283254e+00 },
+ { -2.923504826262027e-09, 3.139110517429204e+00 },
+ { -2.924165613447473e-09, 3.139811703211207e+00 },
+ { -2.924716307449950e-09, 3.140397217517018e+00 },
+ { -2.925156887536978e-09, 3.140866576495489e+00 },
+ { -2.925487337120335e-09, 3.141219300588825e+00 },
+ { -2.925707643758784e-09, 3.141454914570261e+00 },
+ { -2.925817799158535e-09, 3.141572947579352e+00 },
+ { -2.925817799171455e-09, 3.141572933154836e+00 },
+ { -2.925707643798390e-09, 3.141454409272987e+00 },
+ { -2.925487337185779e-09, 3.141216918378770e+00 },
+ { -2.925156887628892e-09, 3.140860007424112e+00 },
+ { -2.924716307568119e-09, 3.140383227898687e+00 },
+ { -2.924165613591896e-09, 3.139786135867868e+00 },
+ { -2.923504826432903e-09, 3.139068292003385e+00 },
+ { -2.922733970969412e-09, 3.138229261619561e+00 },
+ { -2.921853076224321e-09, 3.137268614707029e+00 },
+ { -2.920862175361976e-09, 3.136185925964038e+00 },
+ { -2.919761305690083e-09, 3.134980774833275e+00 },
+ { -2.918550508654911e-09, 3.133652745531368e+00 },
+ { -2.917229829843137e-09, 3.132201427085629e+00 },
+ { -2.915799318976726e-09, 3.130626413363146e+00 },
+ { -2.914259029914435e-09, 3.128927303107136e+00 },
+ { -2.912609020646661e-09, 3.127103699965947e+00 },
+ { -2.910849353295315e-09, 3.125155212527586e+00 },
+ { -2.908980094111509e-09, 3.123081454351802e+00 },
+ { -2.907001313470937e-09, 3.120882043999591e+00 },
+ { -2.904913085874448e-09, 3.118556605068443e+00 },
+ { -2.902715489941767e-09, 3.116104766219928e+00 },
+ { -2.900408608411958e-09, 3.113526161214776e+00 },
+ { -2.897992528137022e-09, 3.110820428940251e+00 },
+ { -2.895467340081818e-09, 3.107987213444579e+00 },
+ { -2.892833139317615e-09, 3.105026163964191e+00 },
+ { -2.890090025020589e-09, 3.101936934956479e+00 },
+ { -2.887238100468092e-09, 3.098719186130021e+00 },
+ { -2.884277473032614e-09, 3.095372582472161e+00 },
+ { -2.881208254180937e-09, 3.091896794282404e+00 },
+ { -2.878030559466594e-09, 3.088291497198199e+00 },
+ { -2.874744508528832e-09, 3.084556372228054e+00 },
+ { -2.871350225084755e-09, 3.080691105776848e+00 },
+ { -2.867847836928063e-09, 3.076695389678615e+00 },
+ { -2.864237475921086e-09, 3.072568921221621e+00 },
+ { -2.860519277991847e-09, 3.068311403179147e+00 },
+ { -2.856693383129018e-09, 3.063922543837792e+00 },
+ { -2.852759935374575e-09, 3.059402057023109e+00 },
+ { -2.848719082821403e-09, 3.054749662130841e+00 },
+ { -2.844570977604520e-09, 3.049965084150782e+00 },
+ { -2.840315775898525e-09, 3.045048053697736e+00 },
+ { -2.835953637908582e-09, 3.039998307034967e+00 },
+ { -2.831484727867511e-09, 3.034815586104635e+00 },
+ { -2.826909214026628e-09, 3.029499638550941e+00 },
+ { -2.822227268651470e-09, 3.024050217748861e+00 },
+ { -2.817439068015245e-09, 3.018467082830179e+00 },
+ { -2.812544792390175e-09, 3.012749998707001e+00 },
+ { -2.807544626043751e-09, 3.006898736100911e+00 },
+ { -2.802438757228650e-09, 3.000913071564665e+00 },
+ { -2.797227378178760e-09, 2.994792787510961e+00 },
+ { -2.791910685098702e-09, 2.988537672233504e+00 },
+ { -2.786488878159805e-09, 2.982147519935565e+00 },
+ { -2.780962161489413e-09, 2.975622130750641e+00 },
+ { -2.775330743165298e-09, 2.968961310769028e+00 },
+ { -2.769594835207775e-09, 2.962164872061613e+00 },
+ { -2.763754653569747e-09, 2.955232632701135e+00 },
+ { -2.757810418131543e-09, 2.948164416789036e+00 },
+ { -2.751762352689432e-09, 2.940960054474719e+00 },
+ { -2.745610684950541e-09, 2.933619381982341e+00 },
+ { -2.739355646520809e-09, 2.926142241629213e+00 },
+ { -2.732997472899722e-09, 2.918528481852205e+00 },
+ { -2.726536403468318e-09, 2.910777957226018e+00 },
+ { -2.719972681482232e-09, 2.902890528487386e+00 },
+ { -2.713306554062453e-09, 2.894866062556452e+00 },
+ { -2.706538272184154e-09, 2.886704432555728e+00 },
+ { -2.699668090670078e-09, 2.878405517834426e+00 },
+ { -2.692696268177908e-09, 2.869969203985464e+00 },
+ { -2.685623067193599e-09, 2.861395382869544e+00 },
+ { -2.678448754018380e-09, 2.852683952631486e+00 },
+ { -2.671173598761847e-09, 2.843834817723832e+00 },
+ { -2.663797875328991e-09, 2.834847888922988e+00 },
+ { -2.656321861411517e-09, 2.825723083350459e+00 },
+ { -2.648745838477759e-09, 2.816460324492298e+00 },
+ { -2.641070091759922e-09, 2.807059542215146e+00 },
+ { -2.633294910246296e-09, 2.797520672788269e+00 },
+ { -2.625420586667340e-09, 2.787843658897949e+00 },
+ { -2.617447417487602e-09, 2.778028449668942e+00 },
+ { -2.609375702891616e-09, 2.768075000678399e+00 },
+ { -2.601205746775692e-09, 2.757983273976943e+00 },
+ { -2.592937856733464e-09, 2.747753238101915e+00 },
+ { -2.584572344046340e-09, 2.737384868096553e+00 },
+ { -2.576109523671634e-09, 2.726878145526201e+00 },
+ { -2.567549714229129e-09, 2.716233058492422e+00 },
+ { -2.558893237991435e-09, 2.705449601651722e+00 },
+ { -2.550140420869302e-09, 2.694527776227857e+00 },
+ { -2.541291592402089e-09, 2.683467590030445e+00 },
+ { -2.532347085742440e-09, 2.672269057466213e+00 },
+ { -2.523307237646751e-09, 2.660932199557362e+00 },
+ { -2.514172388459584e-09, 2.649457043952206e+00 },
+ { -2.504942882102813e-09, 2.637843624941622e+00 },
+ { -2.495619066062810e-09, 2.626091983472908e+00 },
+ { -2.486201291375123e-09, 2.614202167160335e+00 },
+ { -2.476689912614465e-09, 2.602174230302269e+00 },
+ { -2.467085287878098e-09, 2.590008233889805e+00 },
+ { -2.457387778775451e-09, 2.577704245623143e+00 },
+ { -2.447597750411553e-09, 2.565262339920002e+00 },
+ { -2.437715571376127e-09, 2.552682597931055e+00 },
+ { -2.427741613727123e-09, 2.539965107548168e+00 },
+ { -2.417676252978335e-09, 2.527109963417675e+00 },
+ { -2.407519868085581e-09, 2.514117266951687e+00 },
+ { -2.397272841430131e-09, 2.500987126335739e+00 },
+ { -2.386935558807595e-09, 2.487719656543254e+00 },
+ { -2.376508409410024e-09, 2.474314979341178e+00 },
+ { -2.365991785814531e-09, 2.460773223303822e+00 },
+ { -2.355386083965131e-09, 2.447094523817833e+00 },
+ { -2.344691703161363e-09, 2.433279023095734e+00 },
+ { -2.333909046040126e-09, 2.419326870180582e+00 },
+ { -2.323038518562289e-09, 2.405238220956597e+00 },
+ { -2.312080529997549e-09, 2.391013238157397e+00 },
+ { -2.301035492907384e-09, 2.376652091371587e+00 },
+ { -2.289903823131822e-09, 2.362154957053137e+00 },
+ { -2.278685939771276e-09, 2.347522018525197e+00 },
+ { -2.267382265173420e-09, 2.332753465990296e+00 },
+ { -2.255993224914501e-09, 2.317849496533128e+00 },
+ { -2.244519247786155e-09, 2.302810314130351e+00 },
+ { -2.232960765776561e-09, 2.287636129652823e+00 },
+ { -2.221318214056095e-09, 2.272327160873552e+00 },
+ { -2.209592030960763e-09, 2.256883632472565e+00 },
+ { -2.197782657974034e-09, 2.241305776039511e+00 },
+ { -2.185890539712767e-09, 2.225593830081461e+00 },
+ { -2.173916123907886e-09, 2.209748040023618e+00 },
+ { -2.161859861389976e-09, 2.193768658216360e+00 },
+ { -2.149722206070124e-09, 2.177655943935795e+00 },
+ { -2.137503614923981e-09, 2.161410163388424e+00 },
+ { -2.125204547975352e-09, 2.145031589714984e+00 },
+ { -2.112825468276292e-09, 2.128520502989477e+00 },
+ { -2.100366841892917e-09, 2.111877190225612e+00 },
+ { -2.087829137884807e-09, 2.095101945374541e+00 },
+ { -2.075212828290086e-09, 2.078195069329960e+00 },
+ { -2.062518388104923e-09, 2.061156869925600e+00 },
+ { -2.049746295268559e-09, 2.043987661939897e+00 },
+ { -2.036897030642658e-09, 2.026687767092888e+00 },
+ { -2.023971077994576e-09, 2.009257514048162e+00 },
+ { -2.010968923979840e-09, 1.991697238413571e+00 },
+ { -1.997891058121344e-09, 1.974007282737320e+00 },
+ { -1.984737972794098e-09, 1.956187996511354e+00 },
+ { -1.971510163203686e-09, 1.938239736166060e+00 },
+ { -1.958208127370276e-09, 1.920162865072273e+00 },
+ { -1.944832366107339e-09, 1.901957753535934e+00 },
+ { -1.931383383005451e-09, 1.883624778799427e+00 },
+ { -1.917861684410531e-09, 1.865164325035177e+00 },
+ { -1.904267779407432e-09, 1.846576783346324e+00 },
+ { -1.890602179798714e-09, 1.827862551760622e+00 },
+ { -1.876865400086483e-09, 1.809022035228338e+00 },
+ { -1.863057957452539e-09, 1.790055645617624e+00 },
+ { -1.849180371740008e-09, 1.770963801711725e+00 },
+ { -1.835233165431475e-09, 1.751746929201178e+00 },
+ { -1.821216863631569e-09, 1.732405460681919e+00 },
+ { -1.807131994045840e-09, 1.712939835648088e+00 },
+ { -1.792979086962494e-09, 1.693350500488565e+00 },
+ { -1.778758675229683e-09, 1.673637908477153e+00 },
+ { -1.764471294238191e-09, 1.653802519770021e+00 },
+ { -1.750117481899733e-09, 1.633844801396848e+00 },
+ { -1.735697778626995e-09, 1.613765227254186e+00 },
+ { -1.721212727314574e-09, 1.593564278099856e+00 },
+ { -1.706662873315474e-09, 1.573242441540939e+00 },
+ { -1.692048764423848e-09, 1.552800212030258e+00 },
+ { -1.677370950852395e-09, 1.532238090855187e+00 },
+ { -1.662629985213192e-09, 1.511556586131055e+00 },
+ { -1.647826422494560e-09, 1.490756212788764e+00 },
+ { -1.632960820042537e-09, 1.469837492568651e+00 },
+ { -1.618033737538645e-09, 1.448800954008929e+00 },
+ { -1.603045736978760e-09, 1.427647132435469e+00 },
+ { -1.587997382653428e-09, 1.406376569953373e+00 },
+ { -1.572889241124034e-09, 1.384989815432507e+00 },
+ { -1.557721881203696e-09, 1.363487424499449e+00 },
+ { -1.542495873934815e-09, 1.341869959524515e+00 },
+ { -1.527211792568486e-09, 1.320137989611176e+00 },
+ { -1.511870212541253e-09, 1.298292090581491e+00 },
+ { -1.496471711454994e-09, 1.276332844965754e+00 },
+ { -1.481016869054634e-09, 1.254260841988828e+00 },
+ { -1.465506267206068e-09, 1.232076677556547e+00 },
+ { -1.449940489875303e-09, 1.209780954243628e+00 },
+ { -1.434320123104372e-09, 1.187374281276747e+00 },
+ { -1.418645754991533e-09, 1.164857274523495e+00 },
+ { -1.402917975667710e-09, 1.142230556475749e+00 },
+ { -1.387137377275425e-09, 1.119494756236361e+00 },
+ { -1.371304553944712e-09, 1.096650509501278e+00 },
+ { -1.355420101772623e-09, 1.073698458546610e+00 },
+ { -1.339484618799891e-09, 1.050639252211352e+00 },
+ { -1.323498704988051e-09, 1.027473545880543e+00 },
+ { -1.307462962198534e-09, 1.004202001471034e+00 },
+ { -1.291377994167204e-09, 9.808252874104182e-01 },
+ { -1.275244406484394e-09, 9.573440786237052e-01 },
+ { -1.259062806570190e-09, 9.337590565128454e-01 },
+ { -1.242833803653464e-09, 9.100709089414796e-01 },
+ { -1.226558008746195e-09, 8.862803302125812e-01 },
+ { -1.210236034623253e-09, 8.623880210538113e-01 },
+ { -1.193868495797618e-09, 8.383946885959868e-01 },
+ { -1.177456008497777e-09, 8.143010463544786e-01 },
+ { -1.160999190645010e-09, 7.901078142102129e-01 },
+ { -1.144498661828833e-09, 7.658157183877095e-01 },
+ { -1.127955043284965e-09, 7.414254914366063e-01 },
+ { -1.111368957870986e-09, 7.169378722095157e-01 },
+ { -1.094741030044308e-09, 6.923536058430697e-01 },
+ { -1.078071885836393e-09, 6.676734437331688e-01 },
+ { -1.061362152831423e-09, 6.428981435165511e-01 },
+ { -1.044612460141255e-09, 6.180284690466404e-01 },
+ { -1.027823438382183e-09, 5.930651903718045e-01 },
+ { -1.010995719652015e-09, 5.680090837138436e-01 },
+ { -9.941299375042378e-10, 5.428609314418970e-01 },
+ { -9.772267269262058e-10, 5.176215220520872e-01 },
+ { -9.602867243141016e-10, 4.922916501421032e-01 },
+ { -9.433105674499058e-10, 4.668721163885412e-01 },
+ { -9.262988954758817e-10, 4.413637275202624e-01 },
+ { -9.092523488719689e-10, 4.157672962958654e-01 },
+ { -8.921715694311144e-10, 3.900836414778084e-01 },
+ { -8.750572002347607e-10, 3.643135878065193e-01 },
+ { -8.579098856296589e-10, 3.384579659762392e-01 },
+ { -8.407302712022458e-10, 3.125176126069478e-01 },
+ { -8.235190037551917e-10, 2.864933702193017e-01 },
+ { -8.062767312831008e-10, 2.603860872080448e-01 },
+ { -7.890041029479477e-10, 2.341966178147619e-01 },
+ { -7.717017690542486e-10, 2.079258220999725e-01 },
+ { -7.543703810250266e-10, 1.815745659161734e-01 },
+ { -7.370105913774597e-10, 1.551437208801425e-01 },
+ { -7.196230536974697e-10, 1.286341643433767e-01 },
+ { -7.022084226165876e-10, 1.020467793657360e-01 },
+ { -6.847673537853251e-10, 7.538245468350446e-02 },
+ { -6.673005038502516e-10, 4.864208468284503e-02 },
+ { -6.498085304282128e-10, 2.182656936863137e-02 },
+ { -6.322920920826137e-10, -5.063185663820913e-03 },
+ { -6.147518482969490e-10, -3.202626926150343e-02 },
+ { -5.971884594516681e-10, -5.906176474160862e-02 },
+ { -5.796025867984469e-10, -8.616874992366363e-02 },
+ { -5.619948924353588e-10, -1.133462971605448e-01 },
+ { -5.443660392823640e-10, -1.405934733692621e-01 },
+ { -5.267166910556339e-10, -1.679093400638023e-01 },
+ { -5.090475122431451e-10, -1.952929533862739e-01 },
+ { -4.913591680795342e-10, -2.227433641394564e-01 },
+ { -4.736523245210571e-10, -2.502596178194491e-01 },
+ { -4.559276482202303e-10, -2.778407546490776e-01 },
+ { -4.381858065011618e-10, -3.054858096104932e-01 },
+ { -4.204274673340870e-10, -3.331938124792702e-01 },
+ { -4.026532993105397e-10, -3.609637878577768e-01 },
+ { -3.848639716178888e-10, -3.887947552098022e-01 },
+ { -3.670601540142443e-10, -4.166857288948674e-01 },
+ { -3.492425168032583e-10, -4.446357182029681e-01 },
+ { -3.314117308088734e-10, -4.726437273896633e-01 },
+ { -3.135684673501752e-10, -5.007087557112619e-01 },
+ { -2.957133982159296e-10, -5.288297974607742e-01 },
+ { -2.778471956393828e-10, -5.570058420037128e-01 },
+ { -2.599705322729564e-10, -5.852358738143247e-01 },
+ { -2.420840811628366e-10, -6.135188725122560e-01 },
+ { -2.241885157240923e-10, -6.418538128986450e-01 },
+ { -2.062845097142585e-10, -6.702396649949099e-01 },
+ { -1.883727372093546e-10, -6.986753940779493e-01 },
+ { -1.704538725773087e-10, -7.271599607197149e-01 },
+ { -1.525285904532877e-10, -7.556923208240308e-01 },
+ { -1.345975657140748e-10, -7.842714256651911e-01 },
+ { -1.166614734526054e-10, -8.128962219265712e-01 },
+ { -9.872098895260891e-11, -8.415656517393372e-01 },
+ { -8.077678766314517e-11, -8.702786527215916e-01 },
+ { -6.282954517324612e-11, -8.990341580176152e-01 },
+ { -4.487993718655790e-11, -9.278310963373758e-01 },
+ { -2.692863949561210e-11, -9.566683919968972e-01 },
+ { -8.976327956520795e-12, -9.855449649582175e-01 },
+ { 8.976321536169872e-12, -1.014459730869357e+00 },
+ { 2.692863307547294e-11, -1.043411601105914e+00 },
+ { 4.487993076694813e-11, -1.072399482811314e+00 },
+ { 6.282953875437751e-11, -1.101422278938424e+00 },
+ { 8.077678124517653e-11, -1.130478888291020e+00 },
+ { 9.872098253591082e-11, -1.159568205565684e+00 },
+ { 1.166614670373367e-10, -1.188689121393192e+00 },
+ { 1.345975593005002e-10, -1.217840522381901e+00 },
+ { 1.525285840416718e-10, -1.247021291159495e+00 },
+ { 1.704538661678104e-10, -1.276230306415868e+00 },
+ { 1.883727308022916e-10, -1.305466442946703e+00 },
+ { 2.062845033098954e-10, -1.334728571696106e+00 },
+ { 2.241885093225349e-10, -1.364015559800721e+00 },
+ { 2.420840747645085e-10, -1.393326270633325e+00 },
+ { 2.599705258779635e-10, -1.422659563847049e+00 },
+ { 2.778471892479898e-10, -1.452014295419243e+00 },
+ { 2.957133918284542e-10, -1.481389317696831e+00 },
+ { 3.135684609667761e-10, -1.510783479440191e+00 },
+ { 3.314117244297624e-10, -1.540195625869043e+00 },
+ { 3.492425104288060e-10, -1.569624598707558e+00 },
+ { 3.670601476445565e-10, -1.599069236228850e+00 },
+ { 3.848639652533361e-10, -1.628528373302631e+00 },
+ { 4.026532929512281e-10, -1.658000841439269e+00 },
+ { 4.204274609803869e-10, -1.687485468837799e+00 },
+ { 4.381858001531792e-10, -1.716981080430596e+00 },
+ { 4.559276418782829e-10, -1.746486497931567e+00 },
+ { 4.736523181853565e-10, -1.776000539882225e+00 },
+ { 4.913591617503452e-10, -1.805522021699094e+00 },
+ { 5.090475059206794e-10, -1.835049755721194e+00 },
+ { 5.267166847401562e-10, -1.864582551257262e+00 },
+ { 5.443660329740862e-10, -1.894119214633676e+00 },
+ { 5.619948861345454e-10, -1.923658549242818e+00 },
+ { 5.796025805053097e-10, -1.953199355591180e+00 },
+ { 5.971884531664190e-10, -1.982740431347091e+00 },
+ { 6.147518420199055e-10, -2.012280571390674e+00 },
+ { 6.322920858139346e-10, -2.041818567861395e+00 },
+ { 6.498085241682158e-10, -2.071353210208005e+00 },
+ { 6.673004975990425e-10, -2.100883285238127e+00 },
+ { 6.847673475432746e-10, -2.130407577166309e+00 },
+ { 7.022084163838545e-10, -2.159924867664933e+00 },
+ { 7.196230474743716e-10, -2.189433935913779e+00 },
+ { 7.370105851640495e-10, -2.218933558650552e+00 },
+ { 7.543703748217808e-10, -2.248422510220072e+00 },
+ { 7.717017628611672e-10, -2.277899562625407e+00 },
+ { 7.890040967654542e-10, -2.307363485579104e+00 },
+ { 8.062767251113011e-10, -2.336813046552684e+00 },
+ { 8.235189975944034e-10, -2.366247010829556e+00 },
+ { 8.407302650525749e-10, -2.395664141553858e+00 },
+ { 8.579098794915287e-10, -2.425063199784153e+00 },
+ { 8.750571941082773e-10, -2.454442944543319e+00 },
+ { 8.921715633164894e-10, -2.483802132872044e+00 },
+ { 9.092523427695200e-10, -2.513139519878584e+00 },
+ { 9.262988893857148e-10, -2.542453858792682e+00 },
+ { 9.433105613723914e-10, -2.571743901017465e+00 },
+ { 9.602867182493987e-10, -2.601008396180870e+00 },
+ { 9.772267208744730e-10, -2.630246092190425e+00 },
+ { 9.941299314658458e-10, -2.659455735283526e+00 },
+ { 1.010995713627070e-09, -2.688636070081818e+00 },
+ { 1.027823432371055e-09, -2.717785839644439e+00 },
+ { 1.044612454143997e-09, -2.746903785521352e+00 },
+ { 1.061362146848353e-09, -2.775988647805256e+00 },
+ { 1.078071879867828e-09, -2.805039165187255e+00 },
+ { 1.094741024090249e-09, -2.834054075009077e+00 },
+ { 1.111368951931856e-09, -2.863032113318052e+00 },
+ { 1.127955037360817e-09, -2.891972014920939e+00 },
+ { 1.144498655920037e-09, -2.920872513436805e+00 },
+ { 1.160999184751779e-09, -2.949732341353290e+00 },
+ { 1.177456002620215e-09, -2.978550230079517e+00 },
+ { 1.193868489936097e-09, -3.007324910002949e+00 },
+ { 1.210236028777826e-09, -3.036055110540183e+00 },
+ { 1.226558002917232e-09, -3.064739560196251e+00 },
+ { 1.242833797841123e-09, -3.093376986616735e+00 },
+ { 1.259062800774685e-09, -3.121966116643377e+00 },
+ { 1.275244400705935e-09, -3.150505676371791e+00 },
+ { 1.291377988406056e-09, -3.178994391202159e+00 },
+ { 1.307462956454857e-09, -3.207430985899192e+00 },
+ { 1.323498699262108e-09, -3.235814184645077e+00 },
+ { 1.339484613091842e-09, -3.264142711097884e+00 },
+ { 1.355420096082785e-09, -3.292415288443373e+00 },
+ { 1.371304548273191e-09, -3.320630639454825e+00 },
+ { 1.387137371622433e-09, -3.348787486547389e+00 },
+ { 1.402917970033511e-09, -3.376884551834256e+00 },
+ { 1.418645749376393e-09, -3.404920557184582e+00 },
+ { 1.434320117508396e-09, -3.432894224276359e+00 },
+ { 1.449940484298756e-09, -3.460804274656981e+00 },
+ { 1.465506261649108e-09, -3.488649429796768e+00 },
+ { 1.481016863517580e-09, -3.516428411149154e+00 },
+ { 1.496471705937951e-09, -3.544139940202303e+00 },
+ { 1.511870207044433e-09, -3.571782738540999e+00 },
+ { 1.527211787092206e-09, -3.599355527901174e+00 },
+ { 1.542495868479076e-09, -3.626857030226671e+00 },
+ { 1.557721875768920e-09, -3.654285967729458e+00 },
+ { 1.572889235710329e-09, -3.681641062941412e+00 },
+ { 1.587997377261005e-09, -3.708921038776707e+00 },
+ { 1.603045731607830e-09, -3.736124618586623e+00 },
+ { 1.618033732189314e-09, -3.763250526218862e+00 },
+ { 1.632960814715177e-09, -3.790297486071938e+00 },
+ { 1.647826417189275e-09, -3.817264223155802e+00 },
+ { 1.662629979930247e-09, -3.844149463148589e+00 },
+ { 1.677370945591844e-09, -3.870951932452996e+00 },
+ { 1.692048759186008e-09, -3.897670358257890e+00 },
+ { 1.706662868100504e-09, -3.924303468590212e+00 },
+ { 1.721212722122685e-09, -3.950849992378278e+00 },
+ { 1.735697773458400e-09, -3.977308659506432e+00 },
+ { 1.750117476754591e-09, -4.003678200876669e+00 },
+ { 1.764471289116712e-09, -4.029957348461003e+00 },
+ { 1.778758670132079e-09, -4.056144835364877e+00 },
+ { 1.792979081888926e-09, -4.082239395882965e+00 },
+ { 1.807131988996465e-09, -4.108239765556996e+00 },
+ { 1.821216858606652e-09, -4.134144681236933e+00 },
+ { 1.835233160431175e-09, -4.159952881133585e+00 },
+ { 1.849180366764537e-09, -4.185663104882633e+00 },
+ { 1.863057952502055e-09, -4.211274093599509e+00 },
+ { 1.876865395161145e-09, -4.236784589940537e+00 },
+ { 1.890602174898734e-09, -4.262193338157148e+00 },
+ { 1.904267774533022e-09, -4.287499084158302e+00 },
+ { 1.917861679562008e-09, -4.312700575567174e+00 },
+ { 1.931383378182392e-09, -4.337796561778708e+00 },
+ { 1.944832361310856e-09, -4.362785794021793e+00 },
+ { 1.958208122599839e-09, -4.387667025411434e+00 },
+ { 1.971510158459931e-09, -4.412439011013396e+00 },
+ { 1.984737968076495e-09, -4.437100507898339e+00 },
+ { 1.997891053431005e-09, -4.461650275204912e+00 },
+ { 2.010968919316289e-09, -4.486087074191693e+00 },
+ { 2.023971073358447e-09, -4.510409668301784e+00 },
+ { 2.036897026033634e-09, -4.534616823217992e+00 },
+ { 2.049746290686799e-09, -4.558707306921882e+00 },
+ { 2.062518383551274e-09, -4.582679889754607e+00 },
+ { 2.075212823764071e-09, -4.606533344469879e+00 },
+ { 2.087829133387063e-09, -4.630266446298172e+00 },
+ { 2.100366837422912e-09, -4.653877973001258e+00 },
+ { 2.112825463835087e-09, -4.677366704934605e+00 },
+ { 2.125204543562522e-09, -4.700731425099899e+00 },
+ { 2.137503610540056e-09, -4.723970919208608e+00 },
+ { 2.149722201714786e-09, -4.747083975738060e+00 },
+ { 2.161859857063438e-09, -4.770069385989595e+00 },
+ { 2.173916119610994e-09, -4.792925944149308e+00 },
+ { 2.185890535445098e-09, -4.815652447340950e+00 },
+ { 2.197782653735957e-09, -4.838247695689436e+00 },
+ { 2.209592026751962e-09, -4.860710492376411e+00 },
+ { 2.221318209877576e-09, -4.883039643700314e+00 },
+ { 2.232960761627846e-09, -4.905233959130168e+00 },
+ { 2.244519243667616e-09, -4.927292251368517e+00 },
+ { 2.255993220826402e-09, -4.949213336406265e+00 },
+ { 2.267382261115285e-09, -4.970996033581527e+00 },
+ { 2.278685935744269e-09, -4.992639165639563e+00 },
+ { 2.289903819135414e-09, -5.014141558784778e+00 },
+ { 2.301035488942000e-09, -5.035502042744443e+00 },
+ { 2.312080526062763e-09, -5.056719450823151e+00 },
+ { 2.323038514659161e-09, -5.077792619963239e+00 },
+ { 2.333909042168180e-09, -5.098720390796817e+00 },
+ { 2.344691699320969e-09, -5.119501607709159e+00 },
+ { 2.355386080156553e-09, -5.140135118892792e+00 },
+ { 2.365991782037187e-09, -5.160619776404897e+00 },
+ { 2.376508405665132e-09, -5.180954436227641e+00 },
+ { 2.386935555094626e-09, -5.201137958319343e+00 },
+ { 2.397272837749508e-09, -5.221169206676762e+00 },
+ { 2.407519864436774e-09, -5.241047049389645e+00 },
+ { 2.417676249362563e-09, -5.260770358700167e+00 },
+ { 2.427741610143750e-09, -5.280338011053974e+00 },
+ { 2.437715567825576e-09, -5.299748887163106e+00 },
+ { 2.447597746894037e-09, -5.319001872058887e+00 },
+ { 2.457387775290440e-09, -5.338095855149190e+00 },
+ { 2.467085284426756e-09, -5.357029730277389e+00 },
+ { 2.476689909196263e-09, -5.375802395772283e+00 },
+ { 2.486201287990485e-09, -5.394412754510426e+00 },
+ { 2.495619062711154e-09, -5.412859713968929e+00 },
+ { 2.504942878785408e-09, -5.431142186284682e+00 },
+ { 2.514172385175743e-09, -5.449259088303476e+00 },
+ { 2.523307234396791e-09, -5.467209341642627e+00 },
+ { 2.532347082526785e-09, -5.484991872743321e+00 },
+ { 2.541291589219998e-09, -5.502605612925014e+00 },
+ { 2.550140417722072e-09, -5.520049498445633e+00 },
+ { 2.558893234878378e-09, -5.537322470548212e+00 },
+ { 2.567549711150773e-09, -5.554423475524196e+00 },
+ { 2.576109520627371e-09, -5.571351464763084e+00 },
+ { 2.584572341037361e-09, -5.588105394812198e+00 },
+ { 2.592937853759161e-09, -5.604684227423386e+00 },
+ { 2.601205743836355e-09, -5.621086929615246e+00 },
+ { 2.609375699987564e-09, -5.637312473723475e+00 },
+ { 2.617447414618146e-09, -5.653359837454964e+00 },
+ { 2.625420583833750e-09, -5.669228003945694e+00 },
+ { 2.633294907447937e-09, -5.684915961806963e+00 },
+ { 2.641070088997271e-09, -5.700422705186584e+00 },
+ { 2.648745835750128e-09, -5.715747233817712e+00 },
+ { 2.656321858720176e-09, -5.730888553077074e+00 },
+ { 2.663797872673252e-09, -5.745845674030161e+00 },
+ { 2.671173596142054e-09, -5.760617613492118e+00 },
+ { 2.678448751434797e-09, -5.775203394076705e+00 },
+ { 2.685623064645538e-09, -5.789602044248679e+00 },
+ { 2.692696265666640e-09, -5.803812598380606e+00 },
+ { 2.699668088194915e-09, -5.817834096797069e+00 },
+ { 2.706538269745573e-09, -5.831665585834668e+00 },
+ { 2.713306551659817e-09, -5.845306117889361e+00 },
+ { 2.719972679116734e-09, -5.858754751472542e+00 },
+ { 2.726536401139295e-09, -5.872010551255358e+00 },
+ { 2.732997470607439e-09, -5.885072588127400e+00 },
+ { 2.739355644265558e-09, -5.897939939244211e+00 },
+ { 2.745610682731633e-09, -5.910611688078208e+00 },
+ { 2.751762350508137e-09, -5.923086924473290e+00 },
+ { 2.757810415987146e-09, -5.935364744687794e+00 },
+ { 2.763754651462700e-09, -5.947444251452243e+00 },
+ { 2.769594833137415e-09, -5.959324554015538e+00 },
+ { 2.775330741132843e-09, -5.971004768198829e+00 },
+ { 2.780962159494174e-09, -5.982484016437981e+00 },
+ { 2.786488876202047e-09, -5.993761427840588e+00 },
+ { 2.791910683178690e-09, -6.004836138231525e+00 },
+ { 2.797227376295779e-09, -6.015707290202086e+00 },
+ { 2.802438755383971e-09, -6.026374033162623e+00 },
+ { 2.807544624236659e-09, -6.036835523383457e+00 },
+ { 2.812544790621093e-09, -6.047090924050914e+00 },
+ { 2.817439066283459e-09, -6.057139405311101e+00 },
+ { 2.822227266958278e-09, -6.066980144322601e+00 },
+ { 2.826909212371261e-09, -6.076612325295799e+00 },
+ { 2.831484726250221e-09, -6.086035139548830e+00 },
+ { 2.835953636329660e-09, -6.095247785550617e+00 },
+ { 2.840315774357203e-09, -6.104249468967751e+00 },
+ { 2.844570976102082e-09, -6.113039402715685e+00 },
+ { 2.848719081357095e-09, -6.121616806996519e+00 },
+ { 2.852759933948860e-09, -6.129980909353977e+00 },
+ { 2.856693381741114e-09, -6.138130944714082e+00 },
+ { 2.860519276643053e-09, -6.146066155436312e+00 },
+ { 2.864237474610633e-09, -6.153785791350256e+00 },
+ { 2.867847835656203e-09, -6.161289109809551e+00 },
+ { 2.871350223851726e-09, -6.168575375732642e+00 },
+ { 2.874744507333867e-09, -6.175643861647406e+00 },
+ { 2.878030558310989e-09, -6.182493847739853e+00 },
+ { 2.881208253063899e-09, -6.189124621889823e+00 },
+ { 2.884277471954592e-09, -6.195535479723423e+00 },
+ { 2.887238099428306e-09, -6.201725724651554e+00 },
+ { 2.890090024020323e-09, -6.207694667918394e+00 },
+ { 2.892833138356060e-09, -6.213441628635915e+00 },
+ { 2.895467339159240e-09, -6.218965933835304e+00 },
+ { 2.897992527253659e-09, -6.224266918505075e+00 },
+ { 2.900408607567016e-09, -6.229343925633495e+00 },
+ { 2.902715489136496e-09, -6.234196306254763e+00 },
+ { 2.904913085108075e-09, -6.238823419482017e+00 },
+ { 2.907001312743911e-09, -6.243224632557377e+00 },
+ { 2.908980093422997e-09, -6.247399320887848e+00 },
+ { 2.910849352646620e-09, -6.251346868091392e+00 },
+ { 2.912609020036956e-09, -6.255066666028537e+00 },
+ { 2.914259029343965e-09, -6.258558114851525e+00 },
+ { 2.915799318445710e-09, -6.261820623039620e+00 },
+ { 2.917229829350759e-09, -6.264853607438842e+00 },
+ { 2.918550508202463e-09, -6.267656493305673e+00 },
+ { 2.919761305276718e-09, -6.270228714337005e+00 },
+ { 2.920862174988150e-09, -6.272569712717951e+00 },
+ { 2.921853075889193e-09, -6.274678939154603e+00 },
+ { 2.922733970674264e-09, -6.276555852917634e+00 },
+ { 2.923504826176907e-09, -6.278199921870962e+00 },
+ { 2.924165613375264e-09, -6.279610622518139e+00 },
+ { 2.924716307391075e-09, -6.280787440034993e+00 },
+ { 2.925156887490598e-09, -6.281729868306345e+00 },
+ { 2.925487337087508e-09, -6.282437409966992e+00 },
+ { 2.925707643739298e-09, -6.282909576428774e+00 },
+ { 2.925817799151970e-09, -6.283145887925411e+00 },
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@ ();
+};
diff --git a/gnuradio-core/src/lib/gnuradio-config-info.cc b/gnuradio-core/src/lib/gnuradio-config-info.cc
new file mode 100644
index 000000000..d3e6454fd
--- /dev/null
+++ b/gnuradio-core/src/lib/gnuradio-config-info.cc
@@ -0,0 +1,72 @@
+/* -*- 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.
+ */
+
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <gr_constants.h>
+#include <boost/program_options.hpp>
+#include <iostream>
+
+namespace po = boost::program_options;
+
+int
+main(int argc, char **argv)
+{
+ po::options_description desc("Program options: gnuradio [options]");
+ po::variables_map vm;
+
+ desc.add_options()
+ ("help,h", "print help message")
+ ("prefix", "print gnuradio installation prefix")
+ ("sysconfdir", "print gnuradio system configuration directory")
+ ("prefsdir", "print gnuradio preferences directory")
+ ("builddate", "print gnuradio build date (RFC2822 format)")
+ ("version,v", "print gnuradio version")
+ ;
+
+ po::store(po::parse_command_line(argc, argv, desc), vm);
+ po::notify(vm);
+
+ if (vm.size() == 0 || vm.count("help")) {
+ std::cout << desc << std::endl;
+ return 1;
+ }
+
+ if (vm.count("prefix"))
+ std::cout << gr_prefix() << std::endl;
+
+ if (vm.count("sysconfdir"))
+ std::cout << gr_sysconfdir() << std::endl;
+
+ if (vm.count("prefsdir"))
+ std::cout << gr_prefsdir() << std::endl;
+
+ if (vm.count("builddate"))
+ std::cout << gr_build_date() << std::endl;
+
+ if (vm.count("version"))
+ std::cout << gr_version() << std::endl;
+
+ return 0;
+}
diff --git a/gnuradio-core/src/lib/hier/CMakeLists.txt b/gnuradio-core/src/lib/hier/CMakeLists.txt
new file mode 100644
index 000000000..192dd5939
--- /dev/null
+++ b/gnuradio-core/src/lib/hier/CMakeLists.txt
@@ -0,0 +1,42 @@
+# 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_directories(${CMAKE_CURRENT_SOURCE_DIR})
+
+list(APPEND gnuradio_core_sources
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_channel_model.cc
+)
+
+install(FILES
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_channel_model.h
+ DESTINATION ${GR_INCLUDE_DIR}/gnuradio
+ COMPONENT "core_devel"
+)
+
+if(ENABLE_PYTHON)
+ install(FILES
+ ${CMAKE_CURRENT_SOURCE_DIR}/hier.i
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_channel_model.i
+ DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig
+ COMPONENT "core_swig"
+ )
+endif(ENABLE_PYTHON)
diff --git a/gnuradio-core/src/lib/hier/gr_channel_model.cc b/gnuradio-core/src/lib/hier/gr_channel_model.cc
new file mode 100644
index 000000000..7da357809
--- /dev/null
+++ b/gnuradio-core/src/lib/hier/gr_channel_model.cc
@@ -0,0 +1,126 @@
+/*
+ * 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_channel_model.h>
+#include <gr_io_signature.h>
+#include <gr_sig_source_f.h>
+#include <iostream>
+
+// Shared pointer constructor
+gr_channel_model_sptr
+gr_make_channel_model(double noise_voltage,
+ double frequency_offset,
+ double epsilon,
+ const std::vector<gr_complex> &taps,
+ double noise_seed)
+{
+ return gnuradio::get_initial_sptr(new gr_channel_model(noise_voltage,
+ frequency_offset,
+ epsilon,
+ taps,
+ noise_seed));
+}
+
+// Hierarchical block constructor
+gr_channel_model::gr_channel_model(double noise_voltage,
+ double frequency_offset,
+ double epsilon,
+ const std::vector<gr_complex> &taps,
+ double noise_seed)
+ : gr_hier_block2("gr_channel_model",
+ gr_make_io_signature(1, 1, sizeof(gr_complex)),
+ gr_make_io_signature(1, 1, sizeof(gr_complex)))
+{
+ d_taps = taps;
+ while(d_taps.size() < 2) {
+ d_taps.push_back(0);
+ }
+
+ d_timing_offset = gr_make_fractional_interpolator_cc(0, epsilon);
+
+ d_multipath = gr_make_fir_filter_ccc(1, d_taps);
+
+ d_noise_adder = gr_make_add_cc();
+ d_noise = gr_make_fastnoise_source_c(GR_GAUSSIAN, noise_voltage, noise_seed, 1024*8);
+ d_freq_offset = gr_make_sig_source_c(1, GR_SIN_WAVE, frequency_offset, 1.0, 0.0);
+ d_mixer_offset = gr_make_multiply_cc();
+
+ connect(self(), 0, d_timing_offset, 0);
+ connect(d_timing_offset, 0, d_multipath, 0);
+ connect(d_multipath, 0, d_mixer_offset, 0);
+ connect(d_freq_offset, 0, d_mixer_offset, 1);
+ connect(d_mixer_offset, 0, d_noise_adder, 1);
+ connect(d_noise, 0, d_noise_adder, 0);
+ connect(d_noise_adder, 0, self(), 0);
+}
+
+void
+gr_channel_model::set_noise_voltage(double noise_voltage)
+{
+ d_noise->set_amplitude(noise_voltage);
+}
+
+void
+gr_channel_model::set_frequency_offset(double frequency_offset)
+{
+ d_freq_offset->set_frequency(frequency_offset);
+}
+
+void
+gr_channel_model::set_taps(const std::vector<gr_complex> &taps)
+{
+ d_taps = taps;
+ while(d_taps.size() < 2) {
+ d_taps.push_back(0);
+ }
+ d_multipath->set_taps(d_taps);
+}
+
+void
+gr_channel_model::set_timing_offset(double epsilon)
+{
+ d_timing_offset->set_interp_ratio(epsilon);
+}
+
+
+double
+gr_channel_model::noise_voltage() const
+{
+ return d_noise->amplitude();
+}
+
+double
+gr_channel_model::frequency_offset() const
+{
+ return d_freq_offset->frequency();
+}
+
+std::vector<gr_complex>
+gr_channel_model::taps() const
+{
+ return d_multipath->taps();
+}
+
+double
+gr_channel_model::timing_offset() const
+{
+ return d_timing_offset->interp_ratio();
+}
diff --git a/gnuradio-core/src/lib/hier/gr_channel_model.h b/gnuradio-core/src/lib/hier/gr_channel_model.h
new file mode 100644
index 000000000..5796a6db2
--- /dev/null
+++ b/gnuradio-core/src/lib/hier/gr_channel_model.h
@@ -0,0 +1,79 @@
+/*
+ * 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_core_api.h>
+#include <gr_top_block.h>
+#include <gr_fractional_interpolator_cc.h>
+#include <gr_sig_source_c.h>
+#include <gr_fir_filter_ccc.h>
+#include <gr_add_cc.h>
+#include <gr_fastnoise_source_c.h>
+#include <gr_multiply_cc.h>
+
+class gr_channel_model;
+typedef boost::shared_ptr<gr_channel_model> gr_channel_model_sptr;
+
+
+GR_CORE_API gr_channel_model_sptr gr_make_channel_model(double noise_voltage=0.0,
+ double frequency_offset=0.0,
+ double epsilon=1.0,
+ const std::vector<gr_complex> &taps=std::vector<gr_complex>(1, 1),
+ double noise_seed=0);
+
+/*!
+ * \brief channel simulator
+ * \ingroup misc_blk
+ */
+class GR_CORE_API gr_channel_model : public gr_hier_block2
+{
+ private:
+ gr_channel_model(double noise_voltage,
+ double frequency_offset,
+ double epsilon,
+ const std::vector<gr_complex> &taps,
+ double noise_seed);
+
+ friend GR_CORE_API gr_channel_model_sptr gr_make_channel_model(double noise_voltage,
+ double frequency_offset,
+ double epsilon,
+ const std::vector<gr_complex> &taps,
+ double noise_seed);
+
+ gr_fractional_interpolator_cc_sptr d_timing_offset;
+ gr_sig_source_c_sptr d_freq_offset;
+ gr_fir_filter_ccc_sptr d_multipath;
+ gr_add_cc_sptr d_noise_adder;
+ gr_fastnoise_source_c_sptr d_noise;
+ gr_multiply_cc_sptr d_mixer_offset;
+
+ std::vector<gr_complex> d_taps;
+
+ public:
+ void set_noise_voltage(double noise_voltage);
+ void set_frequency_offset(double frequency_offset);
+ void set_taps(const std::vector<gr_complex> &taps);
+ void set_timing_offset(double epsilon);
+
+ double noise_voltage() const;
+ double frequency_offset() const;
+ std::vector<gr_complex> taps() const;
+ double timing_offset() const;
+};
diff --git a/gnuradio-core/src/lib/hier/gr_channel_model.i b/gnuradio-core/src/lib/hier/gr_channel_model.i
new file mode 100644
index 000000000..9aa6ebf5b
--- /dev/null
+++ b/gnuradio-core/src/lib/hier/gr_channel_model.i
@@ -0,0 +1,50 @@
+/* -*- 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,channel_model)
+
+gr_channel_model_sptr gr_make_channel_model(double noise_voltage=0.0,
+ double frequency_offset=0.0,
+ double epsilon=1.0,
+ const std::vector<gr_complex> &taps=std::vector<gr_complex>(1, 1),
+ double noise_seed=0);
+
+class gr_channel_model : public gr_hier_block2
+{
+ private:
+ gr_channel_model(double noise_voltage,
+ double frequency_offset,
+ double epsilon,
+ const std::vector<gr_complex> &taps,
+ double noise_seed);
+
+ public:
+ void set_noise_voltage(double noise_voltage);
+ void set_frequency_offset(double frequency_offset);
+ void set_taps(const std::vector<gr_complex> &taps);
+ void set_timing_offset(double epsilon);
+
+ double noise_voltage() const;
+ double frequency_offset() const;
+ std::vector<gr_complex> taps() const;
+ double timing_offset() const;
+};
diff --git a/gnuradio-core/src/lib/hier/hier.i b/gnuradio-core/src/lib/hier/hier.i
new file mode 100644
index 000000000..82044415e
--- /dev/null
+++ b/gnuradio-core/src/lib/hier/hier.i
@@ -0,0 +1,32 @@
+/* -*- 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.
+ */
+
+%{
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_channel_model.h>
+%}
+
+%include "gr_channel_model.i"
+
diff --git a/gnuradio-core/src/lib/io/CMakeLists.txt b/gnuradio-core/src/lib/io/CMakeLists.txt
new file mode 100644
index 000000000..59ca06b5a
--- /dev/null
+++ b/gnuradio-core/src/lib/io/CMakeLists.txt
@@ -0,0 +1,118 @@
+# 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
+########################################################################
+
+########################################################################
+# Append gnuradio-core library sources
+########################################################################
+list(APPEND gnuradio_core_sources
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_histo_sink_f.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_oscope_guts.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_oscope_sink_f.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_oscope_sink_x.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/i2c.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/i2c_bitbang.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/i2c_bbio.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/i2c_bbio_pp.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/microtune_4702.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/microtune_4937.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/microtune_xxxx.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/ppio_ppdev.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/gri_wavfile.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_pdu.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_stream_pdu_base.cc
+)
+
+########################################################################
+# Install runtime headers
+########################################################################
+install(FILES
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_histo_sink_f.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_oscope_guts.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_oscope_sink_f.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_oscope_sink_x.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_trigger_mode.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/i2c.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/i2c_bitbang.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/i2c_bbio.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/i2c_bbio_pp.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/microtune_4702.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/microtune_4937.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/microtune_eval_board_defs.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/microtune_xxxx.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/ppio_ppdev.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gri_wavfile.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_pdu.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_stream_pdu_base.h
+ DESTINATION ${GR_INCLUDE_DIR}/gnuradio
+ COMPONENT "core_devel"
+)
+
+########################################################################
+# Install swig headers
+########################################################################
+if(ENABLE_PYTHON)
+install(FILES
+ ${CMAKE_CURRENT_SOURCE_DIR}/io.i
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_histo_sink.i
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_oscope_sink.i
+ DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig
+ COMPONENT "core_swig"
+)
+endif(ENABLE_PYTHON)
+
+########################################################################
+# Handle triple-threat files that have cc, h, and i
+########################################################################
+set(gr_core_io_triple_threats
+ gr_file_sink
+ gr_file_sink_base
+ gr_file_source
+ gr_file_descriptor_sink
+ gr_file_descriptor_source
+ gr_message_debug
+ gr_message_sink
+ gr_message_source
+ gr_message_burst_source
+ gr_pdu_to_tagged_stream
+ microtune_xxxx_eval_board
+ microtune_4702_eval_board
+ microtune_4937_eval_board
+ ppio
+ sdr_1000
+ gr_udp_sink
+ gr_udp_source
+ gr_wavfile_source
+ gr_wavfile_sink
+ gr_tagged_file_sink
+ gr_tagged_stream_to_pdu
+ gr_tuntap_pdu
+ gr_socket_pdu
+)
+
+foreach(file_tt ${gr_core_io_triple_threats})
+ list(APPEND gnuradio_core_sources ${CMAKE_CURRENT_SOURCE_DIR}/${file_tt}.cc)
+ install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${file_tt}.h DESTINATION ${GR_INCLUDE_DIR}/gnuradio COMPONENT "core_devel")
+ if(ENABLE_PYTHON)
+ install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${file_tt}.i DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig COMPONENT "core_swig")
+ endif(ENABLE_PYTHON)
+endforeach(file_tt ${gr_core_io_triple_threats})
diff --git a/gnuradio-core/src/lib/io/gr_file_descriptor_sink.cc b/gnuradio-core/src/lib/io/gr_file_descriptor_sink.cc
new file mode 100644
index 000000000..099d46dbd
--- /dev/null
+++ b/gnuradio-core/src/lib/io/gr_file_descriptor_sink.cc
@@ -0,0 +1,87 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_file_descriptor_sink.h>
+#include <gr_io_signature.h>
+#include <cstdio>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <stdexcept>
+#include <stdio.h>
+
+#ifdef HAVE_IO_H
+#include <io.h>
+#endif
+
+gr_file_descriptor_sink::gr_file_descriptor_sink (size_t itemsize, int fd)
+ : gr_sync_block ("file_descriptor_sink",
+ gr_make_io_signature (1, 1, itemsize),
+ gr_make_io_signature (0, 0, 0)),
+ d_itemsize (itemsize), d_fd (fd)
+{
+}
+
+gr_file_descriptor_sink_sptr
+gr_make_file_descriptor_sink (size_t itemsize, int fd)
+{
+ return gnuradio::get_initial_sptr(new gr_file_descriptor_sink (itemsize, fd));
+}
+
+gr_file_descriptor_sink::~gr_file_descriptor_sink ()
+{
+ close (d_fd);
+}
+
+int
+gr_file_descriptor_sink::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ char *inbuf = (char *) input_items[0];
+ unsigned long byte_size = noutput_items * d_itemsize;
+
+ while (byte_size > 0){
+ ssize_t r;
+
+ r = write (d_fd, inbuf, byte_size);
+ if (r == -1){
+ if (errno == EINTR)
+ continue;
+ else {
+ perror ("gr_file_descriptor_sink");
+ return -1; // indicate we're done
+ }
+ }
+ else {
+ byte_size -= r;
+ inbuf += r;
+ }
+ }
+
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/io/gr_file_descriptor_sink.h b/gnuradio-core/src/lib/io/gr_file_descriptor_sink.h
new file mode 100644
index 000000000..3b1c1167f
--- /dev/null
+++ b/gnuradio-core/src/lib/io/gr_file_descriptor_sink.h
@@ -0,0 +1,59 @@
+/* -*- 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_FILE_DESCRIPTOR_SINK_H
+#define INCLUDED_GR_FILE_DESCRIPTOR_SINK_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+
+class gr_file_descriptor_sink;
+typedef boost::shared_ptr<gr_file_descriptor_sink> gr_file_descriptor_sink_sptr;
+
+GR_CORE_API gr_file_descriptor_sink_sptr gr_make_file_descriptor_sink (size_t itemsize, int fd);
+
+/*!
+ * \brief Write stream to file descriptor.
+ * \ingroup sink_blk
+ */
+
+class GR_CORE_API gr_file_descriptor_sink : public gr_sync_block
+{
+ friend GR_CORE_API gr_file_descriptor_sink_sptr gr_make_file_descriptor_sink (size_t itemsize, int fd);
+
+ private:
+ size_t d_itemsize;
+ int d_fd;
+
+ protected:
+ gr_file_descriptor_sink (size_t itemsize, int fd);
+
+ public:
+ ~gr_file_descriptor_sink ();
+
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+
+#endif /* INCLUDED_GR_FILE_DESCRIPTOR_SINK_H */
diff --git a/gnuradio-core/src/lib/io/gr_file_descriptor_sink.i b/gnuradio-core/src/lib/io/gr_file_descriptor_sink.i
new file mode 100644
index 000000000..2c256e44d
--- /dev/null
+++ b/gnuradio-core/src/lib/io/gr_file_descriptor_sink.i
@@ -0,0 +1,35 @@
+/* -*- 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,file_descriptor_sink)
+
+gr_file_descriptor_sink_sptr
+gr_make_file_descriptor_sink (size_t itemsize, int fd);
+
+class gr_file_descriptor_sink : public gr_sync_block
+{
+ protected:
+ gr_file_descriptor_sink (size_t itemsize, int fd);
+
+ public:
+ ~gr_file_descriptor_sink ();
+};
diff --git a/gnuradio-core/src/lib/io/gr_file_descriptor_source.cc b/gnuradio-core/src/lib/io/gr_file_descriptor_source.cc
new file mode 100644
index 000000000..a63abf96b
--- /dev/null
+++ b/gnuradio-core/src/lib/io/gr_file_descriptor_source.cc
@@ -0,0 +1,151 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2005 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 <gr_file_descriptor_source.h>
+#include <gr_io_signature.h>
+#include <cstdio>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <stdexcept>
+#include <stdio.h>
+#include <string.h>
+
+#ifdef HAVE_IO_H
+#include <io.h>
+#endif
+
+gr_file_descriptor_source::gr_file_descriptor_source (size_t itemsize,
+ int fd,
+ bool repeat)
+ : gr_sync_block ("file_descriptor_source",
+ gr_make_io_signature (0, 0, 0),
+ gr_make_io_signature (1, 1, itemsize)),
+ d_itemsize (itemsize), d_fd (fd), d_repeat (repeat),
+ d_residue (new unsigned char[itemsize]), d_residue_len (0)
+{
+}
+
+// public constructor that returns a shared_ptr
+
+gr_file_descriptor_source_sptr
+gr_make_file_descriptor_source (size_t itemsize, int fd, bool repeat)
+{
+ return gr_file_descriptor_source_sptr (
+ new gr_file_descriptor_source (itemsize, fd, repeat));
+}
+
+gr_file_descriptor_source::~gr_file_descriptor_source ()
+{
+ close (d_fd);
+ delete [] d_residue;
+}
+
+int
+gr_file_descriptor_source::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ assert (noutput_items > 0);
+
+ char *o = (char *) output_items[0];
+ int nread = 0;
+
+ while (1){
+ int r = read_items (o, noutput_items - nread);
+ if (r == -1){
+ if (errno == EINTR)
+ continue;
+ else {
+ perror ("file_descriptor_source[read]");
+ return -1;
+ }
+ }
+ else if (r == 0){ // end of file
+ if (!d_repeat)
+ break;
+ else {
+ flush_residue ();
+ if (lseek (d_fd, 0, SEEK_SET) == -1){
+ perror ("file_descriptor_source[lseek]");
+ return -1;
+ }
+ }
+ }
+ else {
+ o += r * d_itemsize;
+ nread += r;
+ break;
+ }
+ }
+
+ if (nread == 0) // EOF
+ return -1;
+
+ return nread;
+}
+
+int
+gr_file_descriptor_source::read_items (char *buf, int nitems)
+{
+ assert (nitems > 0);
+ assert (d_residue_len < d_itemsize);
+
+ int nbytes_read = 0;
+
+ if (d_residue_len > 0){
+ memcpy (buf, d_residue, d_residue_len);
+ nbytes_read = d_residue_len;
+ d_residue_len = 0;
+ }
+
+ int r = read (d_fd, buf + nbytes_read, nitems * d_itemsize - nbytes_read);
+ if (r <= 0){
+ handle_residue (buf, nbytes_read);
+ return r;
+ }
+
+ r = handle_residue (buf, r + nbytes_read);
+
+ if (r == 0) // block until we get something
+ return read_items (buf, nitems);
+
+ return r;
+}
+
+int
+gr_file_descriptor_source::handle_residue (char *buf, int nbytes_read)
+{
+ assert (nbytes_read >= 0);
+ int nitems_read = nbytes_read / d_itemsize;
+ d_residue_len = nbytes_read % d_itemsize;
+ if (d_residue_len > 0){
+ // fprintf (stderr, "handle_residue: %d\n", d_residue_len);
+ memcpy (d_residue, buf + nbytes_read - d_residue_len, d_residue_len);
+ }
+ return nitems_read;
+}
diff --git a/gnuradio-core/src/lib/io/gr_file_descriptor_source.h b/gnuradio-core/src/lib/io/gr_file_descriptor_source.h
new file mode 100644
index 000000000..ebabd81ed
--- /dev/null
+++ b/gnuradio-core/src/lib/io/gr_file_descriptor_source.h
@@ -0,0 +1,68 @@
+/* -*- 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_FILE_DESCRIPTOR_SOURCE_H
+#define INCLUDED_GR_FILE_DESCRIPTOR_SOURCE_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+
+class gr_file_descriptor_source;
+typedef boost::shared_ptr<gr_file_descriptor_source> gr_file_descriptor_source_sptr;
+
+GR_CORE_API gr_file_descriptor_source_sptr
+gr_make_file_descriptor_source (size_t itemsize, int fd, bool repeat = false);
+
+/*!
+ * \brief Read stream from file descriptor.
+ * \ingroup source_blk
+ */
+
+class GR_CORE_API gr_file_descriptor_source : public gr_sync_block
+{
+ friend GR_CORE_API gr_file_descriptor_source_sptr
+ gr_make_file_descriptor_source (size_t itemsize, int fd, bool repeat);
+ private:
+ size_t d_itemsize;
+ int d_fd;
+ bool d_repeat;
+
+ unsigned char *d_residue;
+ unsigned long d_residue_len;
+
+ protected:
+ gr_file_descriptor_source (size_t itemsize, int fd, bool repeat);
+
+ int read_items (char *buf, int nitems);
+ int handle_residue (char *buf, int nbytes_read);
+ void flush_residue () { d_residue_len = 0; }
+
+
+ public:
+ ~gr_file_descriptor_source ();
+
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif /* INCLUDED_GR_FILE_DESCRIPTOR_SOURCE_H */
diff --git a/gnuradio-core/src/lib/io/gr_file_descriptor_source.i b/gnuradio-core/src/lib/io/gr_file_descriptor_source.i
new file mode 100644
index 000000000..3ca082522
--- /dev/null
+++ b/gnuradio-core/src/lib/io/gr_file_descriptor_source.i
@@ -0,0 +1,35 @@
+/* -*- 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,file_descriptor_source)
+
+gr_file_descriptor_source_sptr
+gr_make_file_descriptor_source (size_t itemsize, int fd, bool repeat=false);
+
+class gr_file_descriptor_source : public gr_sync_block
+{
+ protected:
+ gr_file_descriptor_source (size_t itemsize, int fd, bool repeat);
+
+ public:
+ ~gr_file_descriptor_source ();
+};
diff --git a/gnuradio-core/src/lib/io/gr_file_sink.cc b/gnuradio-core/src/lib/io/gr_file_sink.cc
new file mode 100644
index 000000000..10c8360cb
--- /dev/null
+++ b/gnuradio-core/src/lib/io/gr_file_sink.cc
@@ -0,0 +1,84 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2006,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_file_sink.h>
+#include <gr_io_signature.h>
+#include <stdexcept>
+
+
+gr_file_sink_sptr
+gr_make_file_sink (size_t itemsize, const char *filename)
+{
+ return gnuradio::get_initial_sptr(new gr_file_sink (itemsize, filename));
+}
+
+gr_file_sink::gr_file_sink(size_t itemsize, const char *filename)
+ : gr_sync_block ("file_sink",
+ gr_make_io_signature(1, 1, itemsize),
+ gr_make_io_signature(0, 0, 0)),
+ gr_file_sink_base(filename, true),
+ d_itemsize(itemsize)
+{
+}
+
+gr_file_sink::~gr_file_sink ()
+{
+}
+
+int
+gr_file_sink::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ char *inbuf = (char*)input_items[0];
+ int nwritten = 0;
+
+ do_update(); // update d_fp is reqd
+
+ if(!d_fp)
+ return noutput_items; // drop output on the floor
+
+ while(nwritten < noutput_items) {
+ int count = fwrite(inbuf, d_itemsize, noutput_items - nwritten, d_fp);
+ if(count == 0) {
+ if(ferror(d_fp)) {
+ std::stringstream s;
+ s << "file_sink write failed with error " << fileno(d_fp) << std::endl;
+ throw std::runtime_error(s.str());
+ }
+ else { // is EOF
+ break;
+ }
+ }
+ nwritten += count;
+ inbuf += count * d_itemsize;
+ }
+
+ if(d_unbuffered)
+ fflush (d_fp);
+
+ return nwritten;
+}
diff --git a/gnuradio-core/src/lib/io/gr_file_sink.h b/gnuradio-core/src/lib/io/gr_file_sink.h
new file mode 100644
index 000000000..e40ec9ab8
--- /dev/null
+++ b/gnuradio-core/src/lib/io/gr_file_sink.h
@@ -0,0 +1,58 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,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.
+ */
+
+#ifndef INCLUDED_GR_FILE_SINK_H
+#define INCLUDED_GR_FILE_SINK_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+#include <gr_file_sink_base.h>
+
+class gr_file_sink;
+typedef boost::shared_ptr<gr_file_sink> gr_file_sink_sptr;
+
+GR_CORE_API gr_file_sink_sptr gr_make_file_sink(size_t itemsize, const char *filename);
+
+/*!
+ * \brief Write stream to file.
+ * \ingroup sink_blk
+ */
+
+class GR_CORE_API gr_file_sink : public gr_sync_block, public gr_file_sink_base
+{
+ friend GR_CORE_API gr_file_sink_sptr gr_make_file_sink(size_t itemsize, const char *filename);
+
+ private:
+ size_t d_itemsize;
+
+ protected:
+ gr_file_sink(size_t itemsize, const char *filename);
+
+ public:
+ ~gr_file_sink();
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif /* INCLUDED_GR_FILE_SINK_H */
diff --git a/gnuradio-core/src/lib/io/gr_file_sink.i b/gnuradio-core/src/lib/io/gr_file_sink.i
new file mode 100644
index 000000000..47ab9e964
--- /dev/null
+++ b/gnuradio-core/src/lib/io/gr_file_sink.i
@@ -0,0 +1,45 @@
+/* -*- 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,file_sink)
+
+gr_file_sink_sptr
+gr_make_file_sink (size_t itemsize, const char *filename);
+
+class gr_file_sink : public gr_sync_block, public gr_file_sink_base
+{
+ protected:
+ gr_file_sink (size_t itemsize, const char *filename);
+
+ public:
+ ~gr_file_sink ();
+
+ /*!
+ * \brief open filename and begin output to it.
+ */
+ bool open(const char *filename);
+
+ /*!
+ * \brief close current output file.
+ */
+ void close();
+};
diff --git a/gnuradio-core/src/lib/io/gr_file_sink_base.cc b/gnuradio-core/src/lib/io/gr_file_sink_base.cc
new file mode 100644
index 000000000..d0aca418e
--- /dev/null
+++ b/gnuradio-core/src/lib/io/gr_file_sink_base.cc
@@ -0,0 +1,125 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2006,2007,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_file_sink_base.h>
+#include <cstdio>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <stdexcept>
+#include <stdio.h>
+#include <gruel/thread.h>
+
+// win32 (mingw/msvc) specific
+#ifdef HAVE_IO_H
+#include <io.h>
+#endif
+#ifdef O_BINARY
+#define OUR_O_BINARY O_BINARY
+#else
+#define OUR_O_BINARY 0
+#endif
+
+// should be handled via configure
+#ifdef O_LARGEFILE
+#define OUR_O_LARGEFILE O_LARGEFILE
+#else
+#define OUR_O_LARGEFILE 0
+#endif
+
+gr_file_sink_base::gr_file_sink_base(const char *filename, bool is_binary)
+ : d_fp(0), d_new_fp(0), d_updated(false), d_is_binary(is_binary)
+{
+ if (!open(filename))
+ throw std::runtime_error ("can't open file");
+}
+
+gr_file_sink_base::~gr_file_sink_base ()
+{
+ close();
+ if (d_fp){
+ fclose(d_fp);
+ d_fp = 0;
+ }
+}
+
+bool
+gr_file_sink_base::open(const char *filename)
+{
+ gruel::scoped_lock guard(d_mutex); // hold mutex for duration of this function
+
+ // we use the open system call to get access to the O_LARGEFILE flag.
+ int fd;
+ if ((fd = ::open (filename,
+ O_WRONLY|O_CREAT|O_TRUNC|OUR_O_LARGEFILE|OUR_O_BINARY,
+ 0664)) < 0){
+ perror (filename);
+ return false;
+ }
+ if (d_new_fp){ // if we've already got a new one open, close it
+ fclose(d_new_fp);
+ d_new_fp = 0;
+ }
+
+ if ((d_new_fp = fdopen (fd, d_is_binary ? "wb" : "w")) == NULL){
+ perror (filename);
+ ::close(fd); // don't leak file descriptor if fdopen fails.
+ }
+
+ d_updated = true;
+ return d_new_fp != 0;
+}
+
+void
+gr_file_sink_base::close()
+{
+ gruel::scoped_lock guard(d_mutex); // hold mutex for duration of this function
+
+ if (d_new_fp){
+ fclose(d_new_fp);
+ d_new_fp = 0;
+ }
+ d_updated = true;
+}
+
+void
+gr_file_sink_base::do_update()
+{
+ if (d_updated){
+ gruel::scoped_lock guard(d_mutex); // hold mutex for duration of this block
+ if (d_fp)
+ fclose(d_fp);
+ d_fp = d_new_fp; // install new file pointer
+ d_new_fp = 0;
+ d_updated = false;
+ }
+}
+
+void
+gr_file_sink_base::set_unbuffered(bool unbuffered)
+{
+ d_unbuffered = unbuffered;
+}
diff --git a/gnuradio-core/src/lib/io/gr_file_sink_base.h b/gnuradio-core/src/lib/io/gr_file_sink_base.h
new file mode 100644
index 000000000..8a70cee76
--- /dev/null
+++ b/gnuradio-core/src/lib/io/gr_file_sink_base.h
@@ -0,0 +1,75 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2007,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.
+ */
+
+#ifndef INCLUDED_GR_FILE_SINK_BASE_H
+#define INCLUDED_GR_FILE_SINK_BASE_H
+
+#include <gr_core_api.h>
+#include <boost/thread.hpp>
+#include <cstdio>
+
+/*!
+ * \brief Common base class for file sinks
+ */
+class GR_CORE_API gr_file_sink_base
+{
+ protected:
+ FILE *d_fp; // current FILE pointer
+ FILE *d_new_fp; // new FILE pointer
+ bool d_updated; // is there a new FILE pointer?
+ bool d_is_binary;
+ boost::mutex d_mutex;
+ bool d_unbuffered;
+
+ protected:
+ gr_file_sink_base(const char *filename, bool is_binary);
+
+ public:
+ ~gr_file_sink_base();
+
+ /*!
+ * \brief Open filename and begin output to it.
+ */
+ bool open(const char *filename);
+
+ /*!
+ * \brief Close current output file.
+ *
+ * Closes current output file and ignores any output until
+ * open is called to connect to another file.
+ */
+ void close();
+
+ /*!
+ * \brief if we've had an update, do it now.
+ */
+ void do_update();
+
+
+ /*!
+ * \brief turn on unbuffered writes for slower outputs
+ */
+ void set_unbuffered(bool unbuffered);
+};
+
+
+#endif /* INCLUDED_GR_FILE_SINK_BASE_H */
diff --git a/gnuradio-core/src/lib/io/gr_file_sink_base.i b/gnuradio-core/src/lib/io/gr_file_sink_base.i
new file mode 100644
index 000000000..993dba277
--- /dev/null
+++ b/gnuradio-core/src/lib/io/gr_file_sink_base.i
@@ -0,0 +1,51 @@
+/* -*- 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 this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+class gr_file_sink_base
+{
+ protected:
+ gr_file_sink_base(const char *filename, bool is_binary);
+
+ public:
+ ~gr_file_sink_base();
+
+ /*!
+ * \brief Open filename and begin output to it.
+ */
+ bool open(const char *filename);
+
+ /*!
+ * \brief Close current output file.
+ *
+ * Closes current output file and ignores any output until
+ * open is called to connect to another file.
+ */
+ void close();
+
+ /*!
+ * \brief if we've had an update, do it now.
+ */
+ void do_update();
+
+ /*!
+ *\brief turn on unbuffered mode for slow outputs
+ */
+ void set_unbuffered(bool unbuffered);
+};
diff --git a/gnuradio-core/src/lib/io/gr_file_source.cc b/gnuradio-core/src/lib/io/gr_file_source.cc
new file mode 100644
index 000000000..6da7abac2
--- /dev/null
+++ b/gnuradio-core/src/lib/io/gr_file_source.cc
@@ -0,0 +1,192 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gruel/thread.h>
+#include <gr_file_source.h>
+#include <gr_io_signature.h>
+#include <cstdio>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <stdexcept>
+#include <stdio.h>
+
+// win32 (mingw/msvc) specific
+#ifdef HAVE_IO_H
+#include <io.h>
+#endif
+#ifdef O_BINARY
+#define OUR_O_BINARY O_BINARY
+#else
+#define OUR_O_BINARY 0
+#endif
+// should be handled via configure
+#ifdef O_LARGEFILE
+#define OUR_O_LARGEFILE O_LARGEFILE
+#else
+#define OUR_O_LARGEFILE 0
+#endif
+
+gr_file_source::gr_file_source(size_t itemsize, const char *filename, bool repeat)
+ : gr_sync_block("file_source",
+ gr_make_io_signature (0, 0, 0),
+ gr_make_io_signature (1, 1, itemsize)),
+ d_itemsize(itemsize), d_fp(0), d_new_fp (0), d_repeat(repeat),
+ d_updated(false)
+{
+ open(filename, repeat);
+}
+
+// public constructor that returns a shared_ptr
+
+gr_file_source_sptr
+gr_make_file_source (size_t itemsize, const char *filename, bool repeat)
+{
+ return gnuradio::get_initial_sptr(new gr_file_source (itemsize, filename, repeat));
+}
+
+gr_file_source::~gr_file_source ()
+{
+ close();
+ if(d_fp) {
+ fclose(d_fp);
+ d_fp = 0;
+ }
+}
+
+int
+gr_file_source::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ char *o = (char *) output_items[0];
+ int i;
+ int size = noutput_items;
+
+ do_update(); // update d_fp is reqd
+ if(d_fp == NULL)
+ throw std::runtime_error("work with file not open");
+
+ gruel::scoped_lock lock(fp_mutex); // hold for the rest of this function
+ while (size) {
+ i = fread(o, d_itemsize, size, (FILE *) d_fp);
+
+ size -= i;
+ o += i * d_itemsize;
+
+ if (size == 0) // done
+ break;
+
+ if (i > 0) // short read, try again
+ continue;
+
+ // We got a zero from fread. This is either EOF or error. In
+ // any event, if we're in repeat mode, seek back to the beginning
+ // of the file and try again, else break
+
+ if (!d_repeat)
+ break;
+
+ if (fseek ((FILE *) d_fp, 0, SEEK_SET) == -1) {
+ std::stringstream s;
+ s << "[" << __FILE__ << "]" << " fseek failed" << std::endl;
+ throw std::runtime_error(s.str());
+ }
+ }
+
+ if (size > 0){ // EOF or error
+ if (size == noutput_items) // we didn't read anything; say we're done
+ return -1;
+ return noutput_items - size; // else return partial result
+ }
+
+ return noutput_items;
+}
+
+bool
+gr_file_source::seek (long seek_point, int whence)
+{
+ // obtain exclusive access for duration of this function
+ gruel::scoped_lock lock(fp_mutex);
+ return fseek((FILE *) d_fp, seek_point * d_itemsize, whence) == 0;
+}
+
+void
+gr_file_source::open(const char *filename, bool repeat)
+{
+ // obtain exclusive access for duration of this function
+ gruel::scoped_lock lock(fp_mutex);
+
+ int fd;
+
+ // we use "open" to use to the O_LARGEFILE flag
+ if((fd = ::open(filename, O_RDONLY | OUR_O_LARGEFILE | OUR_O_BINARY)) < 0) {
+ perror(filename);
+ throw std::runtime_error("can't open file");
+ }
+
+ if(d_new_fp) {
+ fclose(d_new_fp);
+ d_new_fp = 0;
+ }
+
+ if((d_new_fp = fdopen (fd, "rb")) == NULL) {
+ perror(filename);
+ ::close(fd); // don't leak file descriptor if fdopen fails
+ throw std::runtime_error("can't open file");
+ }
+
+ d_updated = true;
+ d_repeat = repeat;
+}
+
+void
+gr_file_source::close()
+{
+ // obtain exclusive access for duration of this function
+ gruel::scoped_lock lock(fp_mutex);
+
+ if(d_new_fp != NULL) {
+ fclose(d_new_fp);
+ d_new_fp = NULL;
+ }
+ d_updated = true;
+}
+
+void
+gr_file_source::do_update()
+{
+ if(d_updated) {
+ gruel::scoped_lock lock(fp_mutex); // hold while in scope
+
+ if(d_fp)
+ fclose(d_fp);
+
+ d_fp = d_new_fp; // install new file pointer
+ d_new_fp = 0;
+ d_updated = false;
+ }
+}
diff --git a/gnuradio-core/src/lib/io/gr_file_source.h b/gnuradio-core/src/lib/io/gr_file_source.h
new file mode 100644
index 000000000..0478fba04
--- /dev/null
+++ b/gnuradio-core/src/lib/io/gr_file_source.h
@@ -0,0 +1,107 @@
+/* -*- 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_FILE_SOURCE_H
+#define INCLUDED_GR_FILE_SOURCE_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+#include <boost/thread/mutex.hpp>
+
+class gr_file_source;
+typedef boost::shared_ptr<gr_file_source> gr_file_source_sptr;
+
+GR_CORE_API gr_file_source_sptr
+gr_make_file_source (size_t itemsize, const char *filename, bool repeat = false);
+
+/*!
+ * \brief Read stream from file
+ * \ingroup source_blk
+ */
+
+class GR_CORE_API gr_file_source : public gr_sync_block
+{
+ private:
+ size_t d_itemsize;
+ FILE *d_fp;
+ FILE *d_new_fp;
+ bool d_repeat;
+ bool d_updated;
+
+ protected:
+ gr_file_source(size_t itemsize, const char *filename, bool repeat);
+
+ void do_update();
+
+ boost::mutex fp_mutex;
+
+ public:
+ /*!
+ * \brief Create a file source.
+ *
+ * Opens \p filename as a source of items into a flowgraph. The data
+ * is expected to be in binary format, item after item. The \p
+ * itemsize of the block determines the conversion from bits to
+ * items.
+ *
+ * If \p repeat is turned on, the file will repeat the file after
+ * it's reached the end.
+ *
+ * \param itemsize the size of each item in the file, in bytes
+ * \param filename name of the file to source from
+ * \param repeat repeat file from start
+ */
+ friend GR_CORE_API gr_file_source_sptr
+ gr_make_file_source(size_t itemsize,
+ const char *filename,
+ bool repeat);
+
+ ~gr_file_source();
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+
+ /*!
+ * \brief Seek file to \p seek_point relative to \p whence
+ *
+ * \param seek_point sample offset in file
+ * \param whence one of SEEK_SET, SEEK_CUR, SEEK_END (man fseek)
+ */
+ bool seek(long seek_point, int whence);
+
+ /*!
+ * \brief Opens a new file.
+ *
+ * \param filename name of the file to source from
+ * \param repeat repeat file from start
+ */
+ void open(const char *filename, bool repeat);
+
+ /*!
+ * \brief Close the file handle.
+ */
+ void close();
+
+};
+
+#endif /* INCLUDED_GR_FILE_SOURCE_H */
diff --git a/gnuradio-core/src/lib/io/gr_file_source.i b/gnuradio-core/src/lib/io/gr_file_source.i
new file mode 100644
index 000000000..e71cef0d1
--- /dev/null
+++ b/gnuradio-core/src/lib/io/gr_file_source.i
@@ -0,0 +1,45 @@
+/* -*- 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.
+ */
+
+
+%constant int SEEK_SET = 0; /* Seek from beginning of file. */
+%constant int SEEK_CUR = 1; /* Seek from current position. */
+%constant int SEEK_END = 2; /* Seek from end of file. */
+
+
+GR_SWIG_BLOCK_MAGIC(gr,file_source)
+
+gr_file_source_sptr
+gr_make_file_source (size_t itemsize, const char *filename, bool repeat=false);
+
+class gr_file_source : public gr_sync_block
+{
+ protected:
+ gr_file_source (size_t itemsize, const char *filename, bool repeat);
+
+ public:
+ ~gr_file_source ();
+
+ bool seek (long seek_point, int whence);
+ void open (const char *filename, bool repeat);
+ void close();
+};
diff --git a/gnuradio-core/src/lib/io/gr_histo_sink.i b/gnuradio-core/src/lib/io/gr_histo_sink.i
new file mode 100644
index 000000000..14079e190
--- /dev/null
+++ b/gnuradio-core/src/lib/io/gr_histo_sink.i
@@ -0,0 +1,39 @@
+/* -*- 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.
+ */
+
+
+GR_SWIG_BLOCK_MAGIC(gr,histo_sink_f)
+
+gr_histo_sink_f_sptr gr_make_histo_sink_f (gr_msg_queue_sptr msgq);
+
+class gr_histo_sink_f : public gr_sync_block
+{
+public:
+ ~gr_histo_sink_f (void);
+
+ unsigned int get_frame_size(void);
+ unsigned int get_num_bins(void);
+
+ void set_frame_size(unsigned int frame_size);
+ void set_num_bins(unsigned int num_bins);
+
+};
diff --git a/gnuradio-core/src/lib/io/gr_histo_sink_f.cc b/gnuradio-core/src/lib/io/gr_histo_sink_f.cc
new file mode 100644
index 000000000..fc0c12ce6
--- /dev/null
+++ b/gnuradio-core/src/lib/io/gr_histo_sink_f.cc
@@ -0,0 +1,165 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2009,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_histo_sink_f.h>
+#include <gr_io_signature.h>
+#include <boost/math/special_functions/round.hpp>
+
+static float get_clean_num(float num){
+ if (num == 0) return 0;
+ /* extract sign and exponent from num */
+ int sign = (num < 0) ? -1 : 1; num = fabs(num);
+ float exponent = floor(log10(num));
+ /* search for closest number with base 1, 2, 5, 10 */
+ float closest_num = 10*pow(10, exponent);
+ if (fabs(num - 1*pow(10, exponent)) < fabs(num - closest_num))
+ closest_num = 1*pow(10, exponent);
+ if (fabs(num - 2*pow(10, exponent)) < fabs(num - closest_num))
+ closest_num = 2*pow(10, exponent);
+ if (fabs(num - 5*pow(10, exponent)) < fabs(num - closest_num))
+ closest_num = 5*pow(10, exponent);
+ return sign*closest_num;
+}
+
+gr_histo_sink_f_sptr
+gr_make_histo_sink_f (gr_msg_queue_sptr msgq)
+{
+ return gnuradio::get_initial_sptr(new gr_histo_sink_f (msgq));
+}
+
+gr_histo_sink_f::gr_histo_sink_f (gr_msg_queue_sptr msgq)
+ : gr_sync_block ("histo_sink_f", gr_make_io_signature (1, 1, sizeof (float)), gr_make_io_signature (0, 0, 0)),
+ d_msgq (msgq), d_num_bins(11), d_frame_size(1000), d_sample_count(0), d_bins(NULL), d_samps(NULL)
+{
+ //allocate arrays and clear
+ set_num_bins(d_num_bins);
+ set_frame_size(d_frame_size);
+}
+
+gr_histo_sink_f::~gr_histo_sink_f (void)
+{
+ delete [] d_samps;
+ delete [] d_bins;
+}
+
+int
+gr_histo_sink_f::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const float *in = (const float *) input_items[0];
+ gruel::scoped_lock guard(d_mutex); // hold mutex for duration of this function
+ for (unsigned int i = 0; i < (unsigned int)noutput_items; i++){
+ d_samps[d_sample_count] = in[i];
+ d_sample_count++;
+ /* processed a frame? */
+ if (d_sample_count == d_frame_size){
+ send_frame();
+ clear();
+ }
+ }
+ return noutput_items;
+}
+
+void
+gr_histo_sink_f::send_frame(void){
+ /* output queue full, drop the data */
+ if (d_msgq->full_p()) return;
+ /* find the minimum and maximum */
+ float minimum = d_samps[0];
+ float maximum = d_samps[0];
+ for (unsigned int i = 0; i < d_frame_size; i++){
+ if (d_samps[i] < minimum) minimum = d_samps[i];
+ if (d_samps[i] > maximum) maximum = d_samps[i];
+ }
+ minimum = get_clean_num(minimum);
+ maximum = get_clean_num(maximum);
+ if (minimum == maximum || minimum > maximum) return; //useless data or screw up?
+ /* load the bins */
+ int index;
+ float bin_width = (maximum - minimum)/(d_num_bins-1);
+ for (unsigned int i = 0; i < d_sample_count; i++){
+ index = boost::math::iround((d_samps[i] - minimum)/bin_width);
+ /* ensure the index range in case a small floating point error is involed */
+ if (index < 0) index = 0;
+ if (index >= (int)d_num_bins) index = d_num_bins-1;
+ d_bins[index]++;
+ }
+ /* Build a message to hold the output records */
+ gr_message_sptr msg = gr_make_message(0, minimum, maximum, d_num_bins*sizeof(float));
+ float *out = (float *)msg->msg(); // get pointer to raw message buffer
+ /* normalize the bins and put into message */
+ for (unsigned int i = 0; i < d_num_bins; i++){
+ out[i] = ((float)d_bins[i])/d_frame_size;
+ }
+ /* send the message */
+ d_msgq->handle(msg);
+}
+
+void
+gr_histo_sink_f::clear(void){
+ d_sample_count = 0;
+ /* zero the bins */
+ for (unsigned int i = 0; i < d_num_bins; i++){
+ d_bins[i] = 0;
+ }
+}
+
+/**************************************************
+ * Getters
+ **************************************************/
+unsigned int
+gr_histo_sink_f::get_frame_size(void){
+ return d_frame_size;
+}
+
+unsigned int
+gr_histo_sink_f::get_num_bins(void){
+ return d_num_bins;
+}
+
+/**************************************************
+ * Setters
+ **************************************************/
+void
+gr_histo_sink_f::set_frame_size(unsigned int frame_size){
+ gruel::scoped_lock guard(d_mutex); // hold mutex for duration of this function
+ d_frame_size = frame_size;
+ /* allocate a new sample array */
+ delete [] d_samps;
+ d_samps = new float[d_frame_size];
+ clear();
+}
+
+void
+gr_histo_sink_f::set_num_bins(unsigned int num_bins){
+ gruel::scoped_lock guard(d_mutex); // hold mutex for duration of this function
+ d_num_bins = num_bins;
+ /* allocate a new bin array */
+ delete [] d_bins;
+ d_bins = new unsigned int[d_num_bins];
+ clear();
+}
diff --git a/gnuradio-core/src/lib/io/gr_histo_sink_f.h b/gnuradio-core/src/lib/io/gr_histo_sink_f.h
new file mode 100644
index 000000000..934066ba2
--- /dev/null
+++ b/gnuradio-core/src/lib/io/gr_histo_sink_f.h
@@ -0,0 +1,71 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_GR_HISTO_SINK_F_H
+#define INCLUDED_GR_HISTO_SINK_F_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+#include <gr_msg_queue.h>
+#include <gruel/thread.h>
+
+class gr_histo_sink_f;
+typedef boost::shared_ptr<gr_histo_sink_f> gr_histo_sink_f_sptr;
+
+GR_CORE_API gr_histo_sink_f_sptr gr_make_histo_sink_f (gr_msg_queue_sptr msgq);
+
+/*!
+ * \brief Histogram module.
+ * \ingroup sink_blk
+ */
+class GR_CORE_API gr_histo_sink_f : public gr_sync_block
+{
+private:
+ gr_msg_queue_sptr d_msgq;
+ unsigned int d_num_bins;
+ unsigned int d_frame_size;
+ unsigned int d_sample_count;
+ unsigned int *d_bins;
+ float *d_samps;
+ gruel::mutex d_mutex;
+
+ friend GR_CORE_API gr_histo_sink_f_sptr gr_make_histo_sink_f (gr_msg_queue_sptr msgq);
+ gr_histo_sink_f (gr_msg_queue_sptr msgq);
+ void send_frame(void);
+ void clear(void);
+
+public:
+ ~gr_histo_sink_f (void);
+
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+
+ unsigned int get_frame_size(void);
+ unsigned int get_num_bins(void);
+
+ void set_frame_size(unsigned int frame_size);
+ void set_num_bins(unsigned int num_bins);
+
+};
+
+#endif /* INCLUDED_GR_HISTO_SINK_F_H */
diff --git a/gnuradio-core/src/lib/io/gr_message_burst_source.cc b/gnuradio-core/src/lib/io/gr_message_burst_source.cc
new file mode 100644
index 000000000..e9e2dfd4d
--- /dev/null
+++ b/gnuradio-core/src/lib/io/gr_message_burst_source.cc
@@ -0,0 +1,144 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_message_burst_source.h>
+#include <gr_io_signature.h>
+#include <cstdio>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <stdexcept>
+#include <string.h>
+#include <gr_tags.h>
+
+// public constructor that returns a shared_ptr
+
+gr_message_burst_source_sptr
+gr_make_message_burst_source(size_t itemsize, int msgq_limit)
+{
+ return gnuradio::get_initial_sptr(new gr_message_burst_source(itemsize, msgq_limit));
+}
+
+// public constructor that takes existing message queue
+gr_message_burst_source_sptr
+gr_make_message_burst_source(size_t itemsize, gr_msg_queue_sptr msgq)
+{
+ return gnuradio::get_initial_sptr(new gr_message_burst_source(itemsize, msgq));
+}
+
+gr_message_burst_source::gr_message_burst_source (size_t itemsize, int msgq_limit)
+ : gr_sync_block("message_burst_source",
+ gr_make_io_signature(0, 0, 0),
+ gr_make_io_signature(1, 1, itemsize)),
+ d_itemsize(itemsize), d_msgq(gr_make_msg_queue(msgq_limit)), d_msg_offset(0), d_eof(false)
+{
+ std::stringstream id;
+ id << name() << unique_id();
+ d_me = pmt::pmt_string_to_symbol(id.str());
+}
+
+gr_message_burst_source::gr_message_burst_source (size_t itemsize, gr_msg_queue_sptr msgq)
+ : gr_sync_block("message_burst_source",
+ gr_make_io_signature(0, 0, 0),
+ gr_make_io_signature(1, 1, itemsize)),
+ d_itemsize(itemsize), d_msgq(msgq), d_msg_offset(0), d_eof(false)
+{
+ std::stringstream id;
+ id << name() << unique_id();
+ d_me = pmt::pmt_string_to_symbol(id.str());
+}
+
+gr_message_burst_source::~gr_message_burst_source()
+{
+}
+
+int
+gr_message_burst_source::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ char *out = (char *) output_items[0];
+ int nn = 0;
+
+ uint64_t abs_sample_count = nitems_written(0);
+
+ while (nn < noutput_items){
+ if (d_msg){
+ //
+ // Consume whatever we can from the current message
+ //
+
+ int mm = std::min(noutput_items - nn, (int)((d_msg->length() - d_msg_offset) / d_itemsize));
+ memcpy (out, &(d_msg->msg()[d_msg_offset]), mm * d_itemsize);
+
+ nn += mm;
+ out += mm * d_itemsize;
+ d_msg_offset += mm * d_itemsize;
+ assert(d_msg_offset <= d_msg->length());
+
+ if (d_msg_offset == d_msg->length()){
+ if (d_msg->type() == 1) // type == 1 sets EOF
+ d_eof = true;
+ d_msg.reset();
+ //tag end of burst
+ add_item_tag(0, //stream ID
+ abs_sample_count+nn-1, //sample number
+ pmt::pmt_string_to_symbol("tx_eob"),
+ pmt::pmt_from_bool(1),
+ d_me //block src id
+ );
+ }
+ }
+ else {
+ //
+ // No current message
+ //
+ if (d_msgq->empty_p() && nn > 0){ // no more messages in the queue, return what we've got
+ break;
+ }
+
+ if (d_eof)
+ return -1;
+
+ d_msg = d_msgq->delete_head(); // block, waiting for a message
+ d_msg_offset = 0;
+ //tag start of burst
+ add_item_tag(0, //stream ID
+ abs_sample_count+nn, //sample number
+ pmt::pmt_string_to_symbol("tx_sob"),
+ pmt::pmt_from_bool(1),
+ d_me //block src id
+ );
+
+
+ if ((d_msg->length() % d_itemsize) != 0)
+ throw std::runtime_error("msg length is not a multiple of d_itemsize");
+ }
+ }
+
+ return nn;
+}
diff --git a/gnuradio-core/src/lib/io/gr_message_burst_source.h b/gnuradio-core/src/lib/io/gr_message_burst_source.h
new file mode 100644
index 000000000..63e220113
--- /dev/null
+++ b/gnuradio-core/src/lib/io/gr_message_burst_source.h
@@ -0,0 +1,71 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_GR_MESSAGE_BURST_SOURCE_H
+#define INCLUDED_GR_MESSAGE_BURST_SOURCE_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+#include <gr_message.h>
+#include <gr_msg_queue.h>
+
+class gr_message_burst_source;
+typedef boost::shared_ptr<gr_message_burst_source> gr_message_burst_source_sptr;
+
+GR_CORE_API gr_message_burst_source_sptr gr_make_message_burst_source (size_t itemsize, int msgq_limit=0);
+GR_CORE_API gr_message_burst_source_sptr gr_make_message_burst_source (size_t itemsize, gr_msg_queue_sptr msgq);
+
+/*!
+ * \brief Turn received messages into a stream and tag them for UHD to send.
+ * \ingroup source_blk
+ */
+class GR_CORE_API gr_message_burst_source : public gr_sync_block
+{
+ private:
+ size_t d_itemsize;
+ gr_msg_queue_sptr d_msgq;
+ gr_message_sptr d_msg;
+ unsigned d_msg_offset;
+ bool d_eof;
+
+ pmt::pmt_t d_me;
+
+ friend GR_CORE_API gr_message_burst_source_sptr
+ gr_make_message_burst_source(size_t itemsize, int msgq_limit);
+ friend GR_CORE_API gr_message_burst_source_sptr
+ gr_make_message_burst_source(size_t itemsize, gr_msg_queue_sptr msgq);
+
+ protected:
+ gr_message_burst_source (size_t itemsize, int msgq_limit);
+ gr_message_burst_source (size_t itemsize, gr_msg_queue_sptr msgq);
+
+ public:
+ ~gr_message_burst_source ();
+
+ gr_msg_queue_sptr msgq() const { return d_msgq; }
+
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif /* INCLUDED_gr_message_burst_source_H */
diff --git a/gnuradio-core/src/lib/io/gr_message_burst_source.i b/gnuradio-core/src/lib/io/gr_message_burst_source.i
new file mode 100644
index 000000000..f7ad840c2
--- /dev/null
+++ b/gnuradio-core/src/lib/io/gr_message_burst_source.i
@@ -0,0 +1,38 @@
+/* -*- 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,message_burst_source);
+
+gr_message_burst_source_sptr gr_make_message_burst_source (size_t itemsize, int msgq_limit=0);
+gr_message_burst_source_sptr gr_make_message_burst_source (size_t itemsize, gr_msg_queue_sptr msgq);
+
+class gr_message_burst_source : public gr_sync_block
+{
+ protected:
+ gr_message_burst_source (size_t itemsize, int msgq_limit);
+ gr_message_burst_source (size_t itemsize, gr_msg_queue_sptr msgq);
+
+ public:
+ ~gr_message_burst_source ();
+
+ gr_msg_queue_sptr msgq() const;
+};
diff --git a/gnuradio-core/src/lib/io/gr_message_debug.cc b/gnuradio-core/src/lib/io/gr_message_debug.cc
new file mode 100644
index 000000000..9eb1bb639
--- /dev/null
+++ b/gnuradio-core/src/lib/io/gr_message_debug.cc
@@ -0,0 +1,120 @@
+/* -*- 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 <gr_message_debug.h>
+#include <gr_io_signature.h>
+#include <cstdio>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <stdexcept>
+#include <string.h>
+#include <iostream>
+
+// public constructor that returns a shared_ptr
+
+gr_message_debug_sptr
+gr_make_message_debug ()
+{
+ return gnuradio::get_initial_sptr(new gr_message_debug());
+}
+
+void
+gr_message_debug::print(pmt::pmt_t msg)
+{
+ std::cout << "******* MESSAGE DEBUG PRINT ********\n";
+ pmt::pmt_print(msg);
+ std::cout << "************************************\n";
+}
+
+void
+gr_message_debug::store(pmt::pmt_t msg)
+{
+ gruel::scoped_lock guard(d_mutex);
+ d_messages.push_back(msg);
+}
+
+void
+gr_message_debug::print_pdu(pmt::pmt_t pdu)
+{
+ pmt::pmt_t meta = pmt::pmt_car(pdu);
+ pmt::pmt_t vector = pmt::pmt_cdr(pdu);
+ std::cout << "* MESSAGE DEBUG PRINT PDU VERBOSE *\n";
+ pmt::pmt_print(meta);
+ size_t len = pmt::pmt_length(vector);
+ std::cout << "pdu_length = " << len << std::endl;
+ std::cout << "contents = " << std::endl;
+ size_t offset(0);
+ const uint8_t* d = (const uint8_t*) pmt_uniform_vector_elements(vector, offset);
+ for(size_t i=0; i<len; i+=16){
+ printf("%04x: ", ((unsigned int)i));
+ for(size_t j=i; j<std::min(i+16,len); j++){
+ printf("%02x ",d[j] );
+ }
+
+ std::cout << std::endl;
+ }
+
+ std::cout << "***********************************\n";
+}
+
+int
+gr_message_debug::num_messages()
+{
+ return (int)d_messages.size();
+}
+
+pmt::pmt_t
+gr_message_debug::get_message(int i)
+{
+ gruel::scoped_lock guard(d_mutex);
+
+ if((size_t)i >= d_messages.size()) {
+ throw std::runtime_error("gr_message_debug: index for message out of bounds.\n");
+ }
+
+ return d_messages[i];
+}
+
+gr_message_debug::gr_message_debug()
+ : gr_block("message_debug",
+ gr_make_io_signature(0, 0, 0),
+ gr_make_io_signature(0, 0, 0))
+{
+ message_port_register_in(pmt::mp("print"));
+ set_msg_handler(pmt::mp("print"), boost::bind(&gr_message_debug::print, this, _1));
+
+ message_port_register_in(pmt::mp("store"));
+ set_msg_handler(pmt::mp("store"), boost::bind(&gr_message_debug::store, this, _1));
+
+ message_port_register_in(pmt::mp("print_pdu"));
+ set_msg_handler(pmt::mp("print_pdu"), boost::bind(&gr_message_debug::print_pdu, this, _1));
+}
+
+gr_message_debug::~gr_message_debug()
+{
+}
diff --git a/gnuradio-core/src/lib/io/gr_message_debug.h b/gnuradio-core/src/lib/io/gr_message_debug.h
new file mode 100644
index 000000000..f1374e806
--- /dev/null
+++ b/gnuradio-core/src/lib/io/gr_message_debug.h
@@ -0,0 +1,114 @@
+/* -*- 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 INCLUDED_GR_MESSAGE_DEBUG_H
+#define INCLUDED_GR_MESSAGE_DEBUG_H
+
+#include <gr_core_api.h>
+#include <gr_block.h>
+#include <gr_message.h>
+#include <gr_msg_queue.h>
+#include <gruel/thread.h>
+
+class gr_message_debug;
+typedef boost::shared_ptr<gr_message_debug> gr_message_debug_sptr;
+
+GR_CORE_API gr_message_debug_sptr gr_make_message_debug();
+
+/*!
+ * \brief Print received messages to stdout
+ * \ingroup sink_blk
+ */
+class GR_CORE_API gr_message_debug : public gr_block
+{
+ private:
+ friend GR_CORE_API gr_message_debug_sptr
+ gr_make_message_debug();
+
+ /*!
+ * \brief Messages received in this port are printed to stdout.
+ *
+ * This port receives messages from the scheduler's message handling
+ * mechanism and prints it to stdout. This message handler function
+ * is only meant to be used by the scheduler to handle messages
+ * posted to port 'print'.
+ *
+ * \param msg A pmt message passed from the scheduler's message handling.
+ */
+ void print(pmt::pmt_t msg);
+
+ /*!
+ * \brief PDU formatted messages received in this port are printed to stdout.
+ *
+ * This port receives messages from the scheduler's message handling
+ * mechanism and prints it to stdout. This message handler function
+ * is only meant to be used by the scheduler to handle messages
+ * posted to port 'print'.
+ *
+ * \param pdu A PDU message passed from the scheduler's message handling.
+ */
+ void print_pdu(pmt::pmt_t pdu);
+
+ /*!
+ * \brief Messages received in this port are stored in a vector.
+ *
+ * This port receives messages from the scheduler's message handling
+ * mechanism and stores it in a vector. Messages can be retrieved
+ * later using the 'get_message' function. This message handler
+ * function is only meant to be used by the scheduler to handle
+ * messages posted to port 'store'.
+ *
+ * \param msg A pmt message passed from the scheduler's message handling.
+ */
+ void store(pmt::pmt_t msg);
+
+ gruel::mutex d_mutex;
+ std::vector<pmt::pmt_t> d_messages;
+
+ protected:
+ gr_message_debug ();
+
+ public:
+ ~gr_message_debug ();
+
+ /*!
+ * \brief Reports the number of messages received by this block.
+ */
+ int num_messages();
+
+ /*!
+ * \brief Get a message (as a PMT) from the message vector at index \p i.
+ *
+ * Messages passed to the 'store' port will be stored in a
+ * vector. This function retrieves those messages by index. They are
+ * index in order of when they were received (all messages are just
+ * pushed onto the back of a vector). This is mostly useful in
+ * debugging message passing graphs and in QA code.
+ *
+ * \param i The index in the vector for the message to retrieve.
+ *
+ * \return a message at index \p i as a pmt_t.
+ */
+ pmt::pmt_t get_message(int i);
+};
+
+#endif /* INCLUDED_GR_MESSAGE_DEBUG_H */
diff --git a/gnuradio-core/src/lib/io/gr_message_debug.i b/gnuradio-core/src/lib/io/gr_message_debug.i
new file mode 100644
index 000000000..65d3bfc4a
--- /dev/null
+++ b/gnuradio-core/src/lib/io/gr_message_debug.i
@@ -0,0 +1,30 @@
+/* -*- 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,message_debug);
+
+%{
+#include <gr_message_debug.h>
+%}
+
+%include "gr_message_debug.h"
+
diff --git a/gnuradio-core/src/lib/io/gr_message_sink.cc b/gnuradio-core/src/lib/io/gr_message_sink.cc
new file mode 100644
index 000000000..ae0b5c764
--- /dev/null
+++ b/gnuradio-core/src/lib/io/gr_message_sink.cc
@@ -0,0 +1,79 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_message_sink.h>
+#include <gr_io_signature.h>
+#include <cstdio>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <stdexcept>
+#include <string.h>
+
+
+// public constructor that returns a shared_ptr
+
+gr_message_sink_sptr
+gr_make_message_sink (size_t itemsize, gr_msg_queue_sptr msgq, bool dont_block)
+{
+ return gnuradio::get_initial_sptr(new gr_message_sink(itemsize, msgq, dont_block));
+}
+
+gr_message_sink::gr_message_sink (size_t itemsize, gr_msg_queue_sptr msgq, bool dont_block)
+ : gr_sync_block("message_sink",
+ gr_make_io_signature(1, 1, itemsize),
+ gr_make_io_signature(0, 0, 0)),
+ d_itemsize(itemsize), d_msgq(msgq), d_dont_block(dont_block)
+{
+}
+
+gr_message_sink::~gr_message_sink()
+{
+}
+
+int
+gr_message_sink::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const char *in = (const char *) input_items[0];
+
+ // if we'd block, drop the data on the floor and say everything is OK
+ if (d_dont_block && d_msgq->full_p())
+ return noutput_items;
+
+ // build a message to hold whatever we've got
+ gr_message_sptr msg = gr_make_message(0, // msg type
+ d_itemsize, // arg1 for other end
+ noutput_items, // arg2 for other end (redundant)
+ noutput_items * d_itemsize); // len of msg
+ memcpy(msg->msg(), in, noutput_items * d_itemsize);
+
+ d_msgq->handle(msg); // send it
+
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/io/gr_message_sink.h b/gnuradio-core/src/lib/io/gr_message_sink.h
new file mode 100644
index 000000000..84005694a
--- /dev/null
+++ b/gnuradio-core/src/lib/io/gr_message_sink.h
@@ -0,0 +1,63 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005 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_MESSAGE_SINK_H
+#define INCLUDED_GR_MESSAGE_SINK_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+#include <gr_message.h>
+#include <gr_msg_queue.h>
+
+class gr_message_sink;
+typedef boost::shared_ptr<gr_message_sink> gr_message_sink_sptr;
+
+GR_CORE_API gr_message_sink_sptr gr_make_message_sink (size_t itemsize,
+ gr_msg_queue_sptr msgq,
+ bool dont_block);
+
+/*!
+ * \brief Gather received items into messages and insert into msgq
+ * \ingroup sink_blk
+ */
+class GR_CORE_API gr_message_sink : public gr_sync_block
+{
+ private:
+ size_t d_itemsize;
+ gr_msg_queue_sptr d_msgq;
+ bool d_dont_block;
+
+ friend GR_CORE_API gr_message_sink_sptr
+ gr_make_message_sink(size_t itemsize, gr_msg_queue_sptr msgq, bool dont_block);
+
+ protected:
+ gr_message_sink (size_t itemsize, gr_msg_queue_sptr msgq, bool dont_block);
+
+ public:
+ ~gr_message_sink ();
+
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif /* INCLUDED_GR_MESSAGE_SINK_H */
diff --git a/gnuradio-core/src/lib/io/gr_message_sink.i b/gnuradio-core/src/lib/io/gr_message_sink.i
new file mode 100644
index 000000000..8415cbd66
--- /dev/null
+++ b/gnuradio-core/src/lib/io/gr_message_sink.i
@@ -0,0 +1,36 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005 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,message_sink);
+
+gr_message_sink_sptr gr_make_message_sink (size_t itemsize,
+ gr_msg_queue_sptr msgq,
+ bool dont_block);
+
+class gr_message_sink : public gr_sync_block
+{
+ protected:
+ gr_message_sink (size_t itemsize, gr_msg_queue_sptr msgq, bool dont_block);
+
+ public:
+ ~gr_message_sink ();
+};
diff --git a/gnuradio-core/src/lib/io/gr_message_source.cc b/gnuradio-core/src/lib/io/gr_message_source.cc
new file mode 100644
index 000000000..fb3da89a8
--- /dev/null
+++ b/gnuradio-core/src/lib/io/gr_message_source.cc
@@ -0,0 +1,120 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_message_source.h>
+#include <gr_io_signature.h>
+#include <cstdio>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <stdexcept>
+#include <string.h>
+
+
+// public constructor that returns a shared_ptr
+
+gr_message_source_sptr
+gr_make_message_source(size_t itemsize, int msgq_limit)
+{
+ return gnuradio::get_initial_sptr(new gr_message_source(itemsize, msgq_limit));
+}
+
+// public constructor that takes existing message queue
+gr_message_source_sptr
+gr_make_message_source(size_t itemsize, gr_msg_queue_sptr msgq)
+{
+ return gnuradio::get_initial_sptr(new gr_message_source(itemsize, msgq));
+}
+
+gr_message_source::gr_message_source (size_t itemsize, int msgq_limit)
+ : gr_sync_block("message_source",
+ gr_make_io_signature(0, 0, 0),
+ gr_make_io_signature(1, 1, itemsize)),
+ d_itemsize(itemsize), d_msgq(gr_make_msg_queue(msgq_limit)), d_msg_offset(0), d_eof(false)
+{
+}
+
+gr_message_source::gr_message_source (size_t itemsize, gr_msg_queue_sptr msgq)
+ : gr_sync_block("message_source",
+ gr_make_io_signature(0, 0, 0),
+ gr_make_io_signature(1, 1, itemsize)),
+ d_itemsize(itemsize), d_msgq(msgq), d_msg_offset(0), d_eof(false)
+{
+}
+
+gr_message_source::~gr_message_source()
+{
+}
+
+int
+gr_message_source::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ char *out = (char *) output_items[0];
+ int nn = 0;
+
+ while (nn < noutput_items){
+ if (d_msg){
+ //
+ // Consume whatever we can from the current message
+ //
+ int mm = std::min(noutput_items - nn, (int)((d_msg->length() - d_msg_offset) / d_itemsize));
+ memcpy (out, &(d_msg->msg()[d_msg_offset]), mm * d_itemsize);
+
+ nn += mm;
+ out += mm * d_itemsize;
+ d_msg_offset += mm * d_itemsize;
+ assert(d_msg_offset <= d_msg->length());
+
+ if (d_msg_offset == d_msg->length()){
+ if (d_msg->type() == 1) // type == 1 sets EOF
+ d_eof = true;
+ d_msg.reset();
+ }
+ }
+ else {
+ //
+ // No current message
+ //
+ if (d_msgq->empty_p() && nn > 0){ // no more messages in the queue, return what we've got
+ break;
+ }
+
+ if (d_eof)
+ return -1;
+
+ d_msg = d_msgq->delete_head(); // block, waiting for a message
+ d_msg_offset = 0;
+
+ if ((d_msg->length() % d_itemsize) != 0)
+ throw std::runtime_error("msg length is not a multiple of d_itemsize");
+ }
+ }
+
+ return nn;
+}
diff --git a/gnuradio-core/src/lib/io/gr_message_source.h b/gnuradio-core/src/lib/io/gr_message_source.h
new file mode 100644
index 000000000..c510d1775
--- /dev/null
+++ b/gnuradio-core/src/lib/io/gr_message_source.h
@@ -0,0 +1,69 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005 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_MESSAGE_SOURCE_H
+#define INCLUDED_GR_MESSAGE_SOURCE_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+#include <gr_message.h>
+#include <gr_msg_queue.h>
+
+class gr_message_source;
+typedef boost::shared_ptr<gr_message_source> gr_message_source_sptr;
+
+GR_CORE_API gr_message_source_sptr gr_make_message_source (size_t itemsize, int msgq_limit=0);
+GR_CORE_API gr_message_source_sptr gr_make_message_source (size_t itemsize, gr_msg_queue_sptr msgq);
+
+/*!
+ * \brief Turn received messages into a stream
+ * \ingroup source_blk
+ */
+class GR_CORE_API gr_message_source : public gr_sync_block
+{
+ private:
+ size_t d_itemsize;
+ gr_msg_queue_sptr d_msgq;
+ gr_message_sptr d_msg;
+ unsigned d_msg_offset;
+ bool d_eof;
+
+ friend GR_CORE_API gr_message_source_sptr
+ gr_make_message_source(size_t itemsize, int msgq_limit);
+ friend GR_CORE_API gr_message_source_sptr
+ gr_make_message_source(size_t itemsize, gr_msg_queue_sptr msgq);
+
+ protected:
+ gr_message_source (size_t itemsize, int msgq_limit);
+ gr_message_source (size_t itemsize, gr_msg_queue_sptr msgq);
+
+ public:
+ ~gr_message_source ();
+
+ gr_msg_queue_sptr msgq() const { return d_msgq; }
+
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif /* INCLUDED_GR_MESSAGE_SOURCE_H */
diff --git a/gnuradio-core/src/lib/io/gr_message_source.i b/gnuradio-core/src/lib/io/gr_message_source.i
new file mode 100644
index 000000000..9ee9157e8
--- /dev/null
+++ b/gnuradio-core/src/lib/io/gr_message_source.i
@@ -0,0 +1,38 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005 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,message_source);
+
+gr_message_source_sptr gr_make_message_source (size_t itemsize, int msgq_limit=0);
+gr_message_source_sptr gr_make_message_source (size_t itemsize, gr_msg_queue_sptr msgq);
+
+class gr_message_source : public gr_sync_block
+{
+ protected:
+ gr_message_source (size_t itemsize, int msgq_limit);
+ gr_message_source (size_t itemsize, gr_msg_queue_sptr msgq);
+
+ public:
+ ~gr_message_source ();
+
+ gr_msg_queue_sptr msgq() const;
+};
diff --git a/gnuradio-core/src/lib/io/gr_oscope_guts.cc b/gnuradio-core/src/lib/io/gr_oscope_guts.cc
new file mode 100644
index 000000000..a5ea3002a
--- /dev/null
+++ b/gnuradio-core/src/lib/io/gr_oscope_guts.cc
@@ -0,0 +1,437 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2003,2005 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 <gr_oscope_guts.h>
+#include <stdexcept>
+#include <stdio.h>
+#include <algorithm>
+#include <unistd.h>
+#include <math.h>
+#include <assert.h>
+
+/*
+ * Bad performance if it's large, and flaky triggering if it's too small
+ */
+static const int OUTPUT_RECORD_SIZE = 1024; // Must be power of 2
+
+/*
+ * For (slow-updated) STRIPCHART triggering, we make the record size larger, since we
+ * potentially want to be able to "see" hours of data. This works as long as the
+ * update rates to a STRIPCHART are low, which they generally are--that's rather what
+ * a stripchart is all about!
+ */
+static const int SCHART_MULT = 8;
+
+
+static inline int
+wrap_bi (int buffer_index, int mx) // wrap buffer index
+{
+ return buffer_index & (mx - 1);
+}
+
+static inline int
+incr_bi (int buffer_index, int mx) // increment buffer index
+{
+ return wrap_bi (buffer_index + 1, mx);
+}
+
+static inline int
+decr_bi (int buffer_index, int mx) // decrement buffer index
+{
+ return wrap_bi (buffer_index - 1, mx);
+}
+
+gr_oscope_guts::gr_oscope_guts (double sample_rate, gr_msg_queue_sptr msgq)
+ : d_nchannels (1),
+ d_msgq (msgq),
+ d_trigger_mode (gr_TRIG_MODE_AUTO),
+ d_trigger_slope (gr_TRIG_SLOPE_POS),
+ d_trigger_channel (0),
+ d_sample_rate (sample_rate),
+ d_update_rate (20),
+ d_trigger_level (0),
+ d_obi (0),
+ d_state (HOLD_OFF),
+ d_decimator_count (0),
+ d_decimator_count_init (1),
+ d_hold_off_count (0),
+ d_hold_off_count_init (OUTPUT_RECORD_SIZE/2-1),
+ d_pre_trigger_count (0),
+ d_post_trigger_count (0),
+ d_post_trigger_count_init (OUTPUT_RECORD_SIZE/2)
+{
+ for (int i = 0; i < MAX_CHANNELS; i++)
+ d_buffer[i] = 0;
+
+ for (int i = 0; i < MAX_CHANNELS; i++){
+ d_buffer[i] = new float [OUTPUT_RECORD_SIZE*SCHART_MULT];
+ for (int j = 0; j < OUTPUT_RECORD_SIZE*SCHART_MULT; j++)
+ d_buffer[i][j] = 0.0;
+ }
+
+ // be sure buffer is full before first write
+ enter_hold_off ();
+ update_rate_or_decimation_changed ();
+}
+
+gr_oscope_guts::~gr_oscope_guts ()
+{
+ for (int i = 0; i < MAX_CHANNELS; i++)
+ delete [] d_buffer[i];
+}
+
+// MANIPULATORS
+
+// \p channel_data points to nchannels float values. These are the values
+// for each channel at this sample time.
+
+void
+gr_oscope_guts::process_sample (const float *channel_data)
+{
+ d_decimator_count--;
+ if (d_decimator_count > 0)
+ return;
+
+ d_decimator_count = d_decimator_count_init;
+
+ if (d_trigger_mode != gr_TRIG_MODE_STRIPCHART)
+ {
+ for (int i = 0; i < d_nchannels; i++)
+ d_buffer[i][d_obi] = channel_data[i]; // copy data into buffer
+
+ switch (d_state){
+ case HOLD_OFF:
+ d_hold_off_count--;
+ if (d_hold_off_count <= 0)
+ enter_look_for_trigger ();
+ break;
+
+ case LOOK_FOR_TRIGGER:
+ if (found_trigger ())
+ enter_post_trigger ();
+ break;
+
+ case POST_TRIGGER:
+ d_post_trigger_count--;
+ if (d_post_trigger_count <= 0){
+ write_output_records ();
+ enter_hold_off ();
+ }
+ break;
+
+ default:
+ assert (0);
+ }
+
+ d_obi = incr_bi (d_obi, OUTPUT_RECORD_SIZE);
+ }
+ else
+ {
+ for (int i = 0; i < d_nchannels; i++)
+ {
+ for (int j = (OUTPUT_RECORD_SIZE*SCHART_MULT)-1; j > 0; j--)
+ {
+ d_buffer[i][j] = d_buffer[i][j-1];
+ }
+ d_buffer[i][0] = channel_data[i];
+ }
+ d_trigger_off = 0;
+ write_output_records();
+ }
+}
+
+/*
+ * Functions called on state entry
+ */
+
+void
+gr_oscope_guts::enter_hold_off ()
+{
+ d_state = HOLD_OFF;
+ d_hold_off_count = d_hold_off_count_init;
+}
+
+void
+gr_oscope_guts::enter_look_for_trigger ()
+{
+ d_pre_trigger_count = 0;
+ d_state = LOOK_FOR_TRIGGER;
+}
+
+void
+gr_oscope_guts::enter_post_trigger ()
+{
+ d_state = POST_TRIGGER;
+ d_post_trigger_count = d_post_trigger_count_init;
+ //ensure that the trigger offset is no more than than half a sample
+ if (d_trigger_off > .5) d_trigger_off -= 1;
+ else d_post_trigger_count--;
+}
+
+// ----------------------------------------------------------------
+// returns true if trigger found
+
+bool
+gr_oscope_guts::found_trigger ()
+{
+ int mx = d_trigger_mode == gr_TRIG_MODE_STRIPCHART ? OUTPUT_RECORD_SIZE*SCHART_MULT :
+ OUTPUT_RECORD_SIZE;
+
+ float prev_sample = d_buffer[d_trigger_channel][decr_bi(d_obi, mx)];
+ float new_sample = d_buffer[d_trigger_channel][d_obi];
+
+ switch (d_trigger_mode){
+
+ case gr_TRIG_MODE_AUTO: //too many samples without a trigger
+ d_pre_trigger_count++;
+ if (d_pre_trigger_count > OUTPUT_RECORD_SIZE/2) return true;
+
+ case gr_TRIG_MODE_NORM: //look for trigger
+ switch (d_trigger_slope){
+
+ case gr_TRIG_SLOPE_POS: //trigger point in pos slope?
+ if (new_sample < d_trigger_level || prev_sample >= d_trigger_level) return false;
+ break;
+
+ case gr_TRIG_SLOPE_NEG: //trigger point in neg slope?
+ if (new_sample > d_trigger_level || prev_sample <= d_trigger_level) return false;
+ break;
+ }
+
+ //calculate the trigger offset in % sample
+ d_trigger_off = (d_trigger_level - prev_sample)/(new_sample - prev_sample);
+ return true;
+
+ case gr_TRIG_MODE_FREE: //free run mode, always trigger
+ d_trigger_off = 0;
+ return true;
+
+ default:
+ assert (0);
+ return false;
+ }
+}
+
+// ----------------------------------------------------------------
+// write output records (duh!)
+
+void
+gr_oscope_guts::write_output_records ()
+{
+ int mx;
+
+ mx = d_trigger_mode == gr_TRIG_MODE_STRIPCHART ?
+ OUTPUT_RECORD_SIZE*SCHART_MULT : OUTPUT_RECORD_SIZE;
+
+ // if the output queue if full, drop the data like its hot.
+ if (d_msgq->full_p())
+ return;
+ // Build a message to hold the output records
+ gr_message_sptr msg =
+ gr_make_message(0, // msg type
+ d_nchannels, // arg1 for other side
+ mx, // arg2 for other side
+ ((d_nchannels * mx) + 1) * sizeof(float)); // sizeof payload
+
+ float *out = (float *)msg->msg(); // get pointer to raw message buffer
+
+ for (int ch = 0; ch < d_nchannels; ch++){
+ // note that d_obi + 1 points at the oldest sample in the buffer
+ for (int i = 0; i < mx; i++){
+ out[i] = d_buffer[ch][wrap_bi(d_obi + 1 + i, mx)];
+ }
+ out += mx;
+ }
+ //Set the last sample as the trigger offset:
+ // The non gl scope sink will not look at this last sample.
+ // The gl scope sink will use this last sample as an offset.
+ out[0] = d_trigger_off;
+ d_msgq->handle(msg); // send the msg
+}
+
+// ----------------------------------------------------------------
+
+bool
+gr_oscope_guts::set_update_rate (double update_rate)
+{
+ d_update_rate = std::min (std::max (1./10., update_rate), d_sample_rate);
+ update_rate_or_decimation_changed ();
+ return true;
+}
+
+bool
+gr_oscope_guts::set_decimation_count (int decimator_count)
+{
+ decimator_count = std::max (1, decimator_count);
+ d_decimator_count_init = decimator_count;
+ update_rate_or_decimation_changed ();
+ return true;
+}
+
+bool
+gr_oscope_guts::set_sample_rate(double sample_rate)
+{
+ d_sample_rate = sample_rate;
+ return set_update_rate(update_rate());
+}
+
+
+void
+gr_oscope_guts::update_rate_or_decimation_changed ()
+{
+ d_hold_off_count_init =
+ (int) rint (d_sample_rate / d_update_rate / d_decimator_count_init);
+}
+
+bool
+gr_oscope_guts::set_trigger_channel (int channel)
+{
+ if (channel >= 0 && channel < d_nchannels){
+ d_trigger_channel = channel;
+ trigger_changed ();
+ return true;
+ }
+
+ return false;
+}
+
+bool
+gr_oscope_guts::set_trigger_mode (gr_trigger_mode mode)
+{
+ d_trigger_mode = mode;
+ trigger_changed ();
+ return true;
+}
+
+bool
+gr_oscope_guts::set_trigger_slope (gr_trigger_slope slope)
+{
+ d_trigger_slope = slope;
+ trigger_changed ();
+ return true;
+}
+
+bool
+gr_oscope_guts::set_trigger_level (double trigger_level)
+{
+ d_trigger_level = trigger_level;
+ trigger_changed ();
+ return true;
+}
+
+bool
+gr_oscope_guts::set_trigger_level_auto ()
+{
+ // find the level 1/2 way between the min and the max
+
+ float min_v = d_buffer[d_trigger_channel][0];
+ float max_v = d_buffer[d_trigger_channel][0];
+
+ for (int i = 1; i < OUTPUT_RECORD_SIZE; i++){
+ min_v = std::min (min_v, d_buffer[d_trigger_channel][i]);
+ max_v = std::max (max_v, d_buffer[d_trigger_channel][i]);
+ }
+ return set_trigger_level((min_v + max_v) * 0.5);
+}
+
+bool
+gr_oscope_guts::set_num_channels(int nchannels)
+{
+ if (nchannels > 0 && nchannels <= MAX_CHANNELS){
+ d_nchannels = nchannels;
+ return true;
+ }
+ return false;
+}
+
+
+void
+gr_oscope_guts::trigger_changed ()
+{
+ enter_look_for_trigger ();
+}
+
+// ACCESSORS
+
+int
+gr_oscope_guts::num_channels () const
+{
+ return d_nchannels;
+}
+
+double
+gr_oscope_guts::sample_rate () const
+{
+ return d_sample_rate;
+}
+
+double
+gr_oscope_guts::update_rate () const
+{
+ return d_update_rate;
+}
+
+int
+gr_oscope_guts::get_decimation_count () const
+{
+ return d_decimator_count_init;
+}
+
+int
+gr_oscope_guts::get_trigger_channel () const
+{
+ return d_trigger_channel;
+}
+
+gr_trigger_mode
+gr_oscope_guts::get_trigger_mode () const
+{
+ return d_trigger_mode;
+}
+
+gr_trigger_slope
+gr_oscope_guts::get_trigger_slope () const
+{
+ return d_trigger_slope;
+}
+
+double
+gr_oscope_guts::get_trigger_level () const
+{
+ return d_trigger_level;
+}
+
+int
+gr_oscope_guts::get_samples_per_output_record () const
+{
+ int mx;
+
+ mx = OUTPUT_RECORD_SIZE;
+ if (d_trigger_mode == gr_TRIG_MODE_STRIPCHART)
+ {
+ mx = OUTPUT_RECORD_SIZE*SCHART_MULT;
+ }
+ return mx;
+}
diff --git a/gnuradio-core/src/lib/io/gr_oscope_guts.h b/gnuradio-core/src/lib/io/gr_oscope_guts.h
new file mode 100644
index 000000000..bc9513c7e
--- /dev/null
+++ b/gnuradio-core/src/lib/io/gr_oscope_guts.h
@@ -0,0 +1,123 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2003,2005 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_OSCOPE_GUTS_H
+#define INCLUDED_GR_OSCOPE_GUTS_H
+
+#include <gr_core_api.h>
+#include <gr_trigger_mode.h>
+#include <gr_msg_queue.h>
+
+/*!
+ * \brief guts of oscilloscope trigger and buffer module
+ *
+ * This module processes sets of samples provided the \p process_sample
+ * method. When appropriate given the updateRate, sampleRate and
+ * trigger conditions, process_sample will periodically write output
+ * records of captured data to output_fd. For each trigger event,
+ * nchannels records will be written. Each record consists of
+ * get_samples_per_output_record binary floats. The trigger instant
+ * occurs at the 1/2 way point in the buffer. Thus, output records
+ * consist of 50% pre-trigger data and 50% post-trigger data.
+ */
+
+class GR_CORE_API gr_oscope_guts {
+public:
+ static const int MAX_CHANNELS = 8;
+private:
+ enum scope_state { HOLD_OFF, LOOK_FOR_TRIGGER, POST_TRIGGER };
+
+ int d_nchannels; // how many channels
+ gr_msg_queue_sptr d_msgq; // message queue we stuff output records into
+ gr_trigger_mode d_trigger_mode;
+ gr_trigger_slope d_trigger_slope;
+ int d_trigger_channel; // which channel to watch for trigger condition
+ double d_sample_rate; // input sample rate in Hz
+ double d_update_rate; // approx freq to produce an output record (Hz)
+ double d_trigger_level;
+
+ int d_obi; // output buffer index
+ float *d_buffer[MAX_CHANNELS];
+
+ scope_state d_state;
+ int d_decimator_count;
+ int d_decimator_count_init;
+ int d_hold_off_count;
+ int d_hold_off_count_init;
+ int d_pre_trigger_count;
+ int d_post_trigger_count;
+ int d_post_trigger_count_init;
+ float d_trigger_off; //%sample trigger is off
+
+ // NOT IMPLEMENTED
+ gr_oscope_guts (const gr_oscope_guts &rhs); // no copy constructor
+ gr_oscope_guts &operator= (const gr_oscope_guts &rhs); // no assignment operator
+
+ void trigger_changed ();
+ void update_rate_or_decimation_changed ();
+ bool found_trigger (); // returns true if found
+ void write_output_records ();
+
+ void enter_hold_off (); // called on state entry
+ void enter_look_for_trigger ();
+ void enter_post_trigger ();
+
+public:
+ // CREATORS
+ gr_oscope_guts (double sample_rate, gr_msg_queue_sptr msgq);
+ ~gr_oscope_guts ();
+
+ // MANIPULATORS
+
+ /*!
+ * \p channel_data points to nchannels float values. These are the values
+ * for each channel at this sample time.
+ */
+ void process_sample (const float *channel_data);
+
+ bool set_update_rate (double update_rate);
+ bool set_decimation_count (int decimation_count);
+ bool set_trigger_channel (int channel);
+ bool set_trigger_mode (gr_trigger_mode mode);
+ bool set_trigger_slope (gr_trigger_slope slope);
+ bool set_trigger_level (double trigger_level);
+ bool set_trigger_level_auto (); // set to 50% level
+ bool set_sample_rate(double sample_rate);
+ bool set_num_channels(int nchannels);
+
+
+ // ACCESSORS
+ int num_channels () const;
+ double sample_rate () const;
+ double update_rate () const;
+ int get_decimation_count () const;
+ int get_trigger_channel () const;
+ gr_trigger_mode get_trigger_mode () const;
+ gr_trigger_slope get_trigger_slope () const;
+ double get_trigger_level () const;
+
+ // # of samples written to each output record.
+ int get_samples_per_output_record () const;
+};
+
+#endif /* INCLUDED_GR_OSCOPE_GUTS_H */
diff --git a/gnuradio-core/src/lib/io/gr_oscope_sink.i b/gnuradio-core/src/lib/io/gr_oscope_sink.i
new file mode 100644
index 000000000..3d7072ed4
--- /dev/null
+++ b/gnuradio-core/src/lib/io/gr_oscope_sink.i
@@ -0,0 +1,77 @@
+/* -*- 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_trigger_mode.h
+
+// GR_SWIG_BLOCK_MAGIC(gr,oscope_sink_x)
+
+%ignore gr_oscope_sink_x;
+class gr_oscope_sink_x : public gr_sync_block
+{
+ protected:
+ gr_oscope_sink_x (const std::string name,
+ gr_io_signature_sptr input_sig,
+ double sample_rate);
+
+ public:
+ ~gr_oscope_sink_x ();
+
+ bool set_update_rate (double update_rate);
+ bool set_decimation_count (int decimation_count);
+ bool set_trigger_channel (int channel);
+ bool set_trigger_mode (gr_trigger_mode mode);
+ bool set_trigger_slope (gr_trigger_slope slope);
+ bool set_trigger_level (double trigger_level);
+ bool set_trigger_level_auto (); // set to 50% level
+ bool set_sample_rate(double sample_rate);
+
+ // ACCESSORS
+ int num_channels () const;
+ double sample_rate () const;
+ double update_rate () const;
+ int get_decimation_count () const;
+ int get_trigger_channel () const;
+ gr_trigger_mode get_trigger_mode () const;
+ gr_trigger_slope get_trigger_slope () const;
+ double get_trigger_level () const;
+
+ // # of samples written to each output record.
+ int get_samples_per_output_record () const;
+};
+
+// ----------------------------------------------------------------
+
+GR_SWIG_BLOCK_MAGIC(gr,oscope_sink_f)
+
+gr_oscope_sink_f_sptr
+gr_make_oscope_sink_f (double sample_rate, gr_msg_queue_sptr msgq);
+
+class gr_oscope_sink_f : public gr_oscope_sink_x
+{
+private:
+ gr_oscope_sink_f (double sample_rate, gr_msg_queue_sptr msgq);
+
+public:
+ ~gr_oscope_sink_f ();
+};
+
+// ----------------------------------------------------------------
diff --git a/gnuradio-core/src/lib/io/gr_oscope_sink_f.cc b/gnuradio-core/src/lib/io/gr_oscope_sink_f.cc
new file mode 100644
index 000000000..493a25e81
--- /dev/null
+++ b/gnuradio-core/src/lib/io/gr_oscope_sink_f.cc
@@ -0,0 +1,78 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2003,2004,2005,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_oscope_sink_f.h>
+#include <gr_io_signature.h>
+#include <gr_oscope_guts.h>
+
+
+gr_oscope_sink_f_sptr
+gr_make_oscope_sink_f (double sampling_rate, gr_msg_queue_sptr msgq)
+{
+ return gnuradio::get_initial_sptr(new gr_oscope_sink_f (sampling_rate, msgq));
+}
+
+
+gr_oscope_sink_f::gr_oscope_sink_f (double sampling_rate, gr_msg_queue_sptr msgq)
+ : gr_oscope_sink_x ("oscope_sink_f",
+ gr_make_io_signature (1, gr_oscope_guts::MAX_CHANNELS, sizeof (float)),
+ sampling_rate),
+ d_msgq(msgq)
+{
+ d_guts = new gr_oscope_guts (d_sampling_rate, d_msgq);
+}
+
+
+bool
+gr_oscope_sink_f::check_topology (int ninputs, int noutputs)
+{
+ return d_guts->set_num_channels(ninputs);
+}
+
+
+gr_oscope_sink_f::~gr_oscope_sink_f ()
+{
+}
+
+int
+gr_oscope_sink_f::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ int ni = input_items.size ();
+ float tmp[gr_oscope_guts::MAX_CHANNELS];
+
+ for (int i = 0; i < noutput_items; i++){
+
+ // FIXME for now, copy the data. Fix later if reqd
+ for (int ch = 0; ch < ni; ch++)
+ tmp[ch] = ((const float *) input_items[ch])[i];
+
+ d_guts->process_sample (tmp);
+ }
+
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/io/gr_oscope_sink_f.h b/gnuradio-core/src/lib/io/gr_oscope_sink_f.h
new file mode 100644
index 000000000..8d434d2bc
--- /dev/null
+++ b/gnuradio-core/src/lib/io/gr_oscope_sink_f.h
@@ -0,0 +1,63 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2003,2004,2005 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_OSCOPE_SINK_F_H
+#define INCLUDED_GR_OSCOPE_SINK_F_H
+
+#include <gr_core_api.h>
+#include <gr_oscope_sink_x.h>
+#include <gr_msg_queue.h>
+
+class gr_oscope_sink_f;
+typedef boost::shared_ptr<gr_oscope_sink_x> gr_oscope_sink_f_sptr;
+
+GR_CORE_API gr_oscope_sink_f_sptr gr_make_oscope_sink_f (double sampling_rate, gr_msg_queue_sptr msgq);
+
+
+/*!
+ * \brief Building block for python oscilloscope module.
+ * \ingroup sink_blk
+ *
+ * Accepts multiple float streams.
+ */
+class GR_CORE_API gr_oscope_sink_f : public gr_oscope_sink_x
+{
+private:
+ friend GR_CORE_API gr_oscope_sink_f_sptr
+ gr_make_oscope_sink_f (double sampling_rate, gr_msg_queue_sptr msgq);
+
+ gr_oscope_sink_f (double sampling_rate, gr_msg_queue_sptr msgq);
+
+ gr_msg_queue_sptr d_msgq;
+
+ public:
+ ~gr_oscope_sink_f ();
+
+ 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);
+};
+
+#endif /* INCLUDED_GR_OSCOPE_SINK_F_H */
+
diff --git a/gnuradio-core/src/lib/io/gr_oscope_sink_x.cc b/gnuradio-core/src/lib/io/gr_oscope_sink_x.cc
new file mode 100644
index 000000000..9580dbf6a
--- /dev/null
+++ b/gnuradio-core/src/lib/io/gr_oscope_sink_x.cc
@@ -0,0 +1,156 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2003,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_oscope_sink_x.h>
+#include <gr_io_signature.h>
+#include <gr_oscope_guts.h>
+
+
+gr_oscope_sink_x::gr_oscope_sink_x (const std::string name,
+ gr_io_signature_sptr input_sig,
+ double sampling_rate)
+ : gr_sync_block (name, input_sig, gr_make_io_signature (0, 0, 0)),
+ d_sampling_rate (sampling_rate), d_guts (0)
+{
+}
+
+gr_oscope_sink_x::~gr_oscope_sink_x ()
+{
+ delete d_guts;
+}
+
+// ----------------------------------------------------------------
+
+bool
+gr_oscope_sink_x::set_update_rate (double update_rate)
+{
+ return d_guts->set_update_rate (update_rate);
+}
+
+bool
+gr_oscope_sink_x::set_decimation_count (int decimation_count)
+{
+ return d_guts->set_decimation_count (decimation_count);
+}
+
+bool
+gr_oscope_sink_x::set_trigger_channel (int channel)
+{
+ return d_guts->set_trigger_channel (channel);
+}
+
+bool
+gr_oscope_sink_x::set_trigger_mode (gr_trigger_mode mode)
+{
+ return d_guts->set_trigger_mode (mode);
+}
+
+bool
+gr_oscope_sink_x::set_trigger_slope (gr_trigger_slope slope)
+{
+ return d_guts->set_trigger_slope (slope);
+}
+
+bool
+gr_oscope_sink_x::set_trigger_level (double trigger_level)
+{
+ return d_guts->set_trigger_level (trigger_level);
+}
+
+
+bool
+gr_oscope_sink_x::set_trigger_level_auto ()
+{
+ return d_guts->set_trigger_level_auto ();
+}
+
+bool
+gr_oscope_sink_x::set_sample_rate (double sample_rate)
+{
+ return d_guts->set_sample_rate (sample_rate);
+}
+
+bool
+gr_oscope_sink_x::set_num_channels (int nchannels)
+{
+ return d_guts->set_num_channels (nchannels);
+}
+
+// ACCESSORS
+
+int
+gr_oscope_sink_x::num_channels () const
+{
+ return d_guts->num_channels ();
+}
+
+double
+gr_oscope_sink_x::sample_rate () const
+{
+ return d_guts->sample_rate ();
+}
+
+double
+gr_oscope_sink_x::update_rate () const
+{
+ return d_guts->update_rate ();
+}
+
+int
+gr_oscope_sink_x::get_decimation_count () const
+{
+ return d_guts->get_decimation_count ();
+}
+
+int
+gr_oscope_sink_x::get_trigger_channel () const
+{
+ return d_guts->get_trigger_channel ();
+}
+
+gr_trigger_mode
+gr_oscope_sink_x::get_trigger_mode () const
+{
+ return d_guts->get_trigger_mode ();
+}
+
+gr_trigger_slope
+gr_oscope_sink_x::get_trigger_slope () const
+{
+ return d_guts->get_trigger_slope ();
+}
+
+double
+gr_oscope_sink_x::get_trigger_level () const
+{
+ return d_guts->get_trigger_level ();
+}
+
+int
+gr_oscope_sink_x::get_samples_per_output_record () const
+{
+ return d_guts->get_samples_per_output_record ();
+}
diff --git a/gnuradio-core/src/lib/io/gr_oscope_sink_x.h b/gnuradio-core/src/lib/io/gr_oscope_sink_x.h
new file mode 100644
index 000000000..153d0937a
--- /dev/null
+++ b/gnuradio-core/src/lib/io/gr_oscope_sink_x.h
@@ -0,0 +1,77 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2003,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_OSCOPE_SINK_X_H
+#define INCLUDED_GR_OSCOPE_SINK_X_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+#include <gr_trigger_mode.h>
+
+class gr_oscope_guts;
+
+/*!
+ * \brief Abstract class for python oscilloscope module.
+ * \ingroup sink_blk
+ *
+ * Don't instantiate this. Use gr_oscope_sink_f or gr_oscope_sink_c instead.
+ */
+class GR_CORE_API gr_oscope_sink_x : public gr_sync_block
+{
+protected:
+ double d_sampling_rate;
+ gr_oscope_guts *d_guts;
+
+ gr_oscope_sink_x (const std::string name,
+ gr_io_signature_sptr input_sig,
+ double sampling_rate);
+
+public:
+ ~gr_oscope_sink_x ();
+
+ bool set_update_rate (double update_rate);
+ bool set_decimation_count (int decimation_count);
+ bool set_trigger_channel (int channel);
+ bool set_trigger_mode (gr_trigger_mode mode);
+ bool set_trigger_slope (gr_trigger_slope slope);
+ bool set_trigger_level (double trigger_level);
+ bool set_trigger_level_auto (); // set to 50% level
+ bool set_sample_rate(double sample_rate);
+ bool set_num_channels (int nchannels);
+
+
+ // ACCESSORS
+ int num_channels () const;
+ double sample_rate () const;
+ double update_rate () const;
+ int get_decimation_count () const;
+ int get_trigger_channel () const;
+ gr_trigger_mode get_trigger_mode () const;
+ gr_trigger_slope get_trigger_slope () const;
+ double get_trigger_level () const;
+
+ // # of samples written to each output record.
+ int get_samples_per_output_record () const;
+
+};
+
+#endif /* INCLUDED_GR_OSCOPE_SINK_X_H */
diff --git a/gnuradio-core/src/lib/io/gr_pdu.cc b/gnuradio-core/src/lib/io/gr_pdu.cc
new file mode 100644
index 000000000..302fd7b9b
--- /dev/null
+++ b/gnuradio-core/src/lib/io/gr_pdu.cc
@@ -0,0 +1,79 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_pdu.h>
+
+size_t
+gr_pdu_itemsize(gr_pdu_vector_type type){
+ switch(type){
+ case pdu_byte:
+ return 1;
+ case pdu_float:
+ return sizeof(float);
+ case pdu_complex:
+ return sizeof(gr_complex);
+ default:
+ throw std::runtime_error("bad type!");
+ }
+}
+
+bool
+gr_pdu_type_matches(gr_pdu_vector_type type, pmt::pmt_t v){
+ switch(type){
+ case pdu_byte:
+ return pmt::pmt_is_u8vector(v);
+ case pdu_float:
+ return pmt::pmt_is_f32vector(v);
+ case pdu_complex:
+ return pmt::pmt_is_c32vector(v);
+ default:
+ throw std::runtime_error("bad type!");
+ }
+}
+
+pmt::pmt_t
+gr_pdu_make_vector(gr_pdu_vector_type type, const uint8_t* buf, size_t items){
+ switch(type){
+ case pdu_byte:
+ return pmt::pmt_init_u8vector(items, buf);
+ case pdu_float:
+ return pmt::pmt_init_f32vector(items, (const float*)buf);
+ case pdu_complex:
+ return pmt::pmt_init_c32vector(items, (const gr_complex*)buf);
+ default:
+ throw std::runtime_error("bad type!");
+ }
+}
+
+gr_pdu_vector_type type_from_pmt(pmt::pmt_t vector){
+ if(pmt_is_u8vector(vector))
+ return pdu_byte;
+ if(pmt_is_f32vector(vector))
+ return pdu_float;
+ if(pmt_is_c32vector(vector))
+ return pdu_complex;
+ throw std::runtime_error("bad type!");
+}
diff --git a/gnuradio-core/src/lib/io/gr_pdu.h b/gnuradio-core/src/lib/io/gr_pdu.h
new file mode 100644
index 000000000..a5ae87db7
--- /dev/null
+++ b/gnuradio-core/src/lib/io/gr_pdu.h
@@ -0,0 +1,39 @@
+/* -*- 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.
+ */
+
+#ifndef GR_PDU_H
+#define GR_PDU_H
+
+#include <gr_complex.h>
+#include <gruel/pmt.h>
+
+#define pdu_port_id pmt::mp("pdus")
+#define pdu_length_tag pmt::mp("pdu_length")
+
+enum gr_pdu_vector_type { pdu_byte, pdu_float, pdu_complex };
+
+size_t gr_pdu_itemsize(gr_pdu_vector_type type);
+bool gr_pdu_type_matches(gr_pdu_vector_type type, pmt::pmt_t v);
+pmt::pmt_t gr_pdu_make_vector(gr_pdu_vector_type type, const uint8_t* buf, size_t items);
+gr_pdu_vector_type type_from_pmt(pmt::pmt_t vector);
+
+#endif
diff --git a/gnuradio-core/src/lib/io/gr_pdu.i b/gnuradio-core/src/lib/io/gr_pdu.i
new file mode 100644
index 000000000..ada3a63a7
--- /dev/null
+++ b/gnuradio-core/src/lib/io/gr_pdu.i
@@ -0,0 +1,30 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005 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_pdu.h>
+%}
+
+enum gr_pdu_vector_type { pdu_byte, pdu_float, pdu_complex };
+
+
+
diff --git a/gnuradio-core/src/lib/io/gr_pdu_to_tagged_stream.cc b/gnuradio-core/src/lib/io/gr_pdu_to_tagged_stream.cc
new file mode 100644
index 000000000..5c319dc39
--- /dev/null
+++ b/gnuradio-core/src/lib/io/gr_pdu_to_tagged_stream.cc
@@ -0,0 +1,132 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_pdu_to_tagged_stream.h>
+#include <gr_io_signature.h>
+#include <cstdio>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <stdexcept>
+#include <string.h>
+
+
+// public constructor that returns a shared_ptr
+
+gr_pdu_to_tagged_stream_sptr
+gr_make_pdu_to_tagged_stream(gr_pdu_vector_type t)
+{
+ return gnuradio::get_initial_sptr(new gr_pdu_to_tagged_stream(t));
+}
+
+gr_pdu_to_tagged_stream::gr_pdu_to_tagged_stream (gr_pdu_vector_type t)
+ : gr_sync_block("pdu_to_tagged_stream",
+ gr_make_io_signature(0, 0, 0),
+ gr_make_io_signature(1, 1, gr_pdu_itemsize(t))),
+ d_vectortype(t), d_itemsize(gr_pdu_itemsize(t))
+{
+ message_port_register_in(pdu_port_id);
+}
+
+gr_pdu_to_tagged_stream::~gr_pdu_to_tagged_stream()
+{
+}
+
+int
+gr_pdu_to_tagged_stream::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ char *out = (char *) output_items[0];
+ int nout = 0;
+
+ // if we have remaining output, send it
+ if(d_remain.size() > 0){
+ nout = std::min((size_t)d_remain.size()/d_itemsize, (size_t)noutput_items);
+ memcpy(out, &d_remain[0], nout*d_itemsize);
+ d_remain.erase( d_remain.begin(), d_remain.begin()+nout);
+ noutput_items -= nout;
+ out += nout*d_itemsize;
+ }
+
+ // if we have space for at least one item output as much as we can
+ if(noutput_items > 0){
+
+ // grab a message if one exists
+ //pmt::pmt_t msg( delete_head_nowait( pdu_port_id ) );
+ pmt::pmt_t msg( delete_head_blocking( pdu_port_id ) );
+ if(msg.get() == NULL ){
+ return nout;
+ }
+
+ // make sure type is valid
+ if(!pmt::pmt_is_pair(msg)){
+ throw std::runtime_error("received a malformed pdu message!");
+ }
+
+// printf("got a msg\n");
+// pmt::pmt_print(msg);
+
+ // grab the components of the pdu message
+ pmt::pmt_t meta(pmt::pmt_car(msg)); // make sure this is NIL || Dict ?
+ pmt::pmt_t vect(pmt::pmt_cdr(msg)); // make sure this is a vector?
+
+ // compute offset for output tag
+ uint64_t offset = nitems_written(0) + nout;
+
+ // add a tag for pdu length
+ add_item_tag(0, offset, pdu_length_tag, pmt::pmt_from_long( pmt::pmt_length(vect) ), pmt::mp(alias()));
+
+ // if we recieved metadata add it as tags
+ if( !pmt_eq(meta, pmt::PMT_NIL) ){
+ pmt::pmt_t pair(pmt::pmt_dict_keys( meta ));
+ while( !pmt_eq(pair, pmt::PMT_NIL) ){
+ pmt::pmt_t k(pmt::pmt_cdr(pair));
+ pmt::pmt_t v(pmt::pmt_dict_ref(meta, k, pmt::PMT_NIL));
+ add_item_tag(0, offset, k, v, pmt::mp(alias()));
+ }
+ }
+
+ // copy vector output
+ size_t ncopy = std::min((size_t)noutput_items, (size_t)pmt::pmt_length(vect));
+ size_t nsave = pmt::pmt_length(vect) - ncopy;
+
+ // copy output
+ size_t io(0);
+ nout += ncopy;
+ memcpy(out, pmt_uniform_vector_elements(vect,io), ncopy*d_itemsize);
+
+ // save leftover items if needed for next work call
+ if(nsave > 0){
+ d_remain.resize(nsave*d_itemsize, 0);
+ memcpy(&d_remain[0], pmt_uniform_vector_elements(vect,ncopy), nsave*d_itemsize);
+ }
+
+ }
+
+ return nout;
+}
diff --git a/gnuradio-core/src/lib/io/gr_pdu_to_tagged_stream.h b/gnuradio-core/src/lib/io/gr_pdu_to_tagged_stream.h
new file mode 100644
index 000000000..3105a3d38
--- /dev/null
+++ b/gnuradio-core/src/lib/io/gr_pdu_to_tagged_stream.h
@@ -0,0 +1,63 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_GR_PDU_TO_TAGGED_STREAM_H
+#define INCLUDED_GR_PDU_TO_TAGGED_STREAM_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+#include <gr_message.h>
+#include <gr_msg_queue.h>
+#include <gr_pdu.h>
+
+class gr_pdu_to_tagged_stream;
+typedef boost::shared_ptr<gr_pdu_to_tagged_stream> gr_pdu_to_tagged_stream_sptr;
+
+GR_CORE_API gr_pdu_to_tagged_stream_sptr gr_make_pdu_to_tagged_stream (gr_pdu_vector_type t);
+
+/*!
+ * \brief Turn received messages into a stream
+ * \ingroup source_blk
+ */
+class GR_CORE_API gr_pdu_to_tagged_stream : public gr_sync_block
+{
+ private:
+ gr_pdu_vector_type d_vectortype;
+ size_t d_itemsize;
+ std::vector<uint8_t> d_remain;
+
+ friend GR_CORE_API gr_pdu_to_tagged_stream_sptr
+ gr_make_pdu_to_tagged_stream(gr_pdu_vector_type t);
+
+ protected:
+ gr_pdu_to_tagged_stream (gr_pdu_vector_type t);
+
+ public:
+ ~gr_pdu_to_tagged_stream ();
+
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+
+};
+
+#endif /* INCLUDED_GR_PDU_TO_TAGGED_SOURCE_H */
diff --git a/gnuradio-core/src/lib/io/gr_pdu_to_tagged_stream.i b/gnuradio-core/src/lib/io/gr_pdu_to_tagged_stream.i
new file mode 100644
index 000000000..ec760b309
--- /dev/null
+++ b/gnuradio-core/src/lib/io/gr_pdu_to_tagged_stream.i
@@ -0,0 +1,31 @@
+/* -*- 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,pdu_to_tagged_stream);
+
+%{
+#include <gr_pdu_to_tagged_stream.h>
+%}
+
+%include <gr_pdu_to_tagged_stream.h>
+
+
diff --git a/gnuradio-core/src/lib/io/gr_socket_pdu.cc b/gnuradio-core/src/lib/io/gr_socket_pdu.cc
new file mode 100644
index 000000000..bb374b300
--- /dev/null
+++ b/gnuradio-core/src/lib/io/gr_socket_pdu.cc
@@ -0,0 +1,157 @@
+/* -*- 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.
+ */
+
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_socket_pdu.h>
+#include <gr_io_signature.h>
+#include <cstdio>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <stdexcept>
+#include <string.h>
+#include <iostream>
+#include <gr_pdu.h>
+#include <boost/format.hpp>
+
+// public constructor that returns a shared_ptr
+gr_socket_pdu_sptr
+gr_make_socket_pdu (std::string type, std::string addr, std::string port, int MTU)
+{
+ return gnuradio::get_initial_sptr(new gr_socket_pdu(type,addr,port,MTU));
+}
+
+gr_socket_pdu::gr_socket_pdu (std::string type, std::string addr, std::string port, int MTU)
+ : gr_stream_pdu_base(MTU)
+{
+
+ if( (type == "TCP_SERVER") || (type == "TCP_CLIENT")){
+ boost::asio::ip::tcp::resolver resolver(_io_service);
+ boost::asio::ip::tcp::resolver::query query(boost::asio::ip::tcp::v4(), addr, port);
+ _tcp_endpoint = *resolver.resolve(query);
+ }
+ if( (type == "UDP_SERVER") || (type == "UDP_CLIENT")){
+ boost::asio::ip::udp::resolver resolver(_io_service);
+ boost::asio::ip::udp::resolver::query query(boost::asio::ip::udp::v4(), addr, port);
+ if( (type == "UDP_SERVER") ){
+ _udp_endpoint = *resolver.resolve(query);
+ } else {
+ _udp_endpoint_other = *resolver.resolve(query);
+ }
+ }
+
+ // register ports
+ message_port_register_out(pmt::mp("pdus"));
+ message_port_register_in(pmt::mp("pdus"));
+
+ // set up socketry
+ if (type == "TCP_SERVER"){
+ _acceptor_tcp.reset(new boost::asio::ip::tcp::acceptor(_io_service, _tcp_endpoint));
+ _acceptor_tcp->set_option(boost::asio::ip::tcp::acceptor::reuse_address(true));
+ start_tcp_accept();
+ // bind tcp server send handler
+ set_msg_handler(pmt::mp("pdus"), boost::bind(&gr_socket_pdu::tcp_server_send, this, _1));
+ } else if(type =="TCP_CLIENT"){
+ boost::system::error_code error = boost::asio::error::host_not_found;
+ _tcp_socket.reset(new boost::asio::ip::tcp::socket(_io_service));
+ _tcp_socket->connect(_tcp_endpoint, error);
+ if(error){
+ throw boost::system::system_error(error);
+ }
+ set_msg_handler(pmt::mp("pdus"), boost::bind(&gr_socket_pdu::tcp_client_send, this, _1));
+ _tcp_socket->async_read_some(
+ boost::asio::buffer(rxbuf),
+ boost::bind(&gr_socket_pdu::handle_tcp_read, this, boost::asio::placeholders::error, boost::asio::placeholders::bytes_transferred));
+
+ } else if(type =="UDP_SERVER"){
+ _udp_socket.reset(new boost::asio::ip::udp::socket(_io_service, _udp_endpoint));
+ _udp_socket->async_receive_from( boost::asio::buffer(rxbuf), _udp_endpoint_other,
+ boost::bind(&gr_socket_pdu::handle_udp_read, this,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred));
+ set_msg_handler(pmt::mp("pdus"), boost::bind(&gr_socket_pdu::udp_send, this, _1));
+ } else if(type =="UDP_CLIENT"){
+ _udp_socket.reset(new boost::asio::ip::udp::socket(_io_service, _udp_endpoint));
+ _udp_socket->async_receive_from( boost::asio::buffer(rxbuf), _udp_endpoint_other,
+ boost::bind(&gr_socket_pdu::handle_udp_read, this,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred));
+ set_msg_handler(pmt::mp("pdus"), boost::bind(&gr_socket_pdu::udp_send, this, _1));
+ } else {
+ throw std::runtime_error("unknown socket type!");
+ }
+
+ // start thread for io_service
+ d_thread = boost::shared_ptr<boost::thread>(new boost::thread(boost::bind(&gr_socket_pdu::run_io_service, this)));
+ d_started = true;
+}
+
+void tcp_connection::handle_read(const boost::system::error_code& error/*error*/, size_t bytes_transferred)
+ {
+ if(!error)
+ {
+ pmt::pmt_t vector = pmt::pmt_init_u8vector(bytes_transferred, (const uint8_t*)&buf[0]);
+ pmt::pmt_t pdu = pmt::pmt_cons( pmt::PMT_NIL, vector);
+
+ d_block->message_port_pub( pmt::mp("pdus"), pdu );
+
+ socket_.async_read_some(
+ boost::asio::buffer(buf),
+ boost::bind(&tcp_connection::handle_read, this, boost::asio::placeholders::error, boost::asio::placeholders::bytes_transferred));
+
+ } else {
+ std::cout << "error occurred\n";
+ }
+
+ }
+
+
+void gr_socket_pdu::tcp_server_send(pmt::pmt_t msg){
+ pmt::pmt_t vector = pmt::pmt_cdr(msg);
+ for(size_t i=0; i<d_tcp_connections.size(); i++){
+ d_tcp_connections[i]->send(vector);
+ }
+}
+
+void gr_socket_pdu::tcp_client_send(pmt::pmt_t msg){
+ pmt::pmt_t vector = pmt::pmt_cdr(msg);
+ size_t len = pmt::pmt_length(vector);
+ size_t offset(0);
+ boost::array<char, 10000> txbuf;
+ memcpy(&txbuf[0], pmt::pmt_uniform_vector_elements(vector, offset), len);
+ _tcp_socket->send(boost::asio::buffer(txbuf,len));
+}
+
+void gr_socket_pdu::udp_send(pmt::pmt_t msg){
+ pmt::pmt_t vector = pmt::pmt_cdr(msg);
+ size_t len = pmt::pmt_length(vector);
+ size_t offset(0);
+ boost::array<char, 10000> txbuf;
+ memcpy(&txbuf[0], pmt::pmt_uniform_vector_elements(vector, offset), len);
+ if(_udp_endpoint_other.address().to_string() != "0.0.0.0")
+ _udp_socket->send_to(boost::asio::buffer(txbuf,len), _udp_endpoint_other);
+}
diff --git a/gnuradio-core/src/lib/io/gr_socket_pdu.h b/gnuradio-core/src/lib/io/gr_socket_pdu.h
new file mode 100644
index 000000000..2fedb317d
--- /dev/null
+++ b/gnuradio-core/src/lib/io/gr_socket_pdu.h
@@ -0,0 +1,203 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_GR_SOCKET_PDU_H
+#define INCLUDED_GR_SOCKET_PDU_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+#include <gr_message.h>
+#include <gr_msg_queue.h>
+#include <gr_stream_pdu_base.h>
+#include <boost/array.hpp>
+#include <boost/asio.hpp>
+#include <iostream>
+
+class gr_socket_pdu;
+typedef boost::shared_ptr<gr_socket_pdu> gr_socket_pdu_sptr;
+
+GR_CORE_API gr_socket_pdu_sptr gr_make_socket_pdu (std::string type, std::string addr, std::string port, int MTU=10000);
+
+class tcp_connection
+ : public boost::enable_shared_from_this<tcp_connection>
+{
+public:
+ typedef boost::shared_ptr<tcp_connection> pointer;
+ gr_socket_pdu *d_block;
+ boost::array<char, 10000> buf;
+
+ static pointer create(boost::asio::io_service& io_service)
+ {
+ return pointer(new tcp_connection(io_service));
+ }
+
+ boost::asio::ip::tcp::socket& socket()
+ {
+ return socket_;
+ }
+
+ void start(gr_socket_pdu* parent)
+ {
+ d_block = parent;
+// message_ = "connected to gr_socket_pdu\n";
+// boost::asio::async_write(socket_, boost::asio::buffer(message_),
+// boost::bind(&tcp_connection::handle_write, shared_from_this(),
+// boost::asio::placeholders::error,
+// boost::asio::placeholders::bytes_transferred));
+
+ socket_.async_read_some(
+ boost::asio::buffer(buf),
+ boost::bind(&tcp_connection::handle_read, this, boost::asio::placeholders::error, boost::asio::placeholders::bytes_transferred));
+ }
+ void send(pmt::pmt_t vector){
+ size_t len = pmt::pmt_length(vector);
+ size_t offset(0);
+ boost::array<char, 10000> txbuf;
+ memcpy(&txbuf[0], pmt::pmt_uniform_vector_elements(vector, offset), len);
+ boost::asio::async_write(socket_, boost::asio::buffer(txbuf, len),
+ boost::bind(&tcp_connection::handle_write, shared_from_this(),
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred));
+ }
+
+ ~tcp_connection(){
+// std::cout << "tcp_connection destroyed\n";
+ }
+
+private:
+ tcp_connection(boost::asio::io_service& io_service)
+ : socket_(io_service)
+ {
+ }
+
+ void handle_read(const boost::system::error_code& error/*error*/, size_t bytes_transferred);
+
+ void handle_write(const boost::system::error_code& /*error*/,
+ size_t /*bytes_transferred*/)
+ {
+ }
+
+ boost::asio::ip::tcp::socket socket_;
+ std::string message_;
+};
+
+
+/*!
+ * \brief Gather received items into messages and insert into msgq
+ * \ingroup sink_blk
+ */
+class GR_CORE_API gr_socket_pdu : public gr_stream_pdu_base
+{
+ private:
+ friend GR_CORE_API gr_socket_pdu_sptr
+ gr_make_socket_pdu(std::string type, std::string addr, std::string port, int MTU);
+
+ boost::asio::io_service _io_service;
+
+ boost::array<char, 10000> rxbuf;
+
+ // tcp specific
+ boost::asio::ip::tcp::endpoint _tcp_endpoint;
+
+ // specific to tcp server
+ boost::shared_ptr<boost::asio::ip::tcp::acceptor> _acceptor_tcp;
+ std::vector<tcp_connection::pointer> d_tcp_connections;
+ void tcp_server_send(pmt::pmt_t msg);
+ void tcp_client_send(pmt::pmt_t msg);
+ void udp_send(pmt::pmt_t msg);
+
+ // specific to tcp client
+ boost::shared_ptr<boost::asio::ip::tcp::socket> _tcp_socket;
+
+ // specific to udp client/server
+ boost::asio::ip::udp::endpoint _udp_endpoint;
+ boost::asio::ip::udp::endpoint _udp_endpoint_other;
+ boost::shared_ptr<boost::asio::ip::udp::socket> _udp_socket;
+
+ void handle_receive(const boost::system::error_code& error, std::size_t ){
+ }
+
+ void start_tcp_accept(){
+ tcp_connection::pointer new_connection =
+ tcp_connection::create(_acceptor_tcp->get_io_service());
+
+ _acceptor_tcp->async_accept(new_connection->socket(),
+ boost::bind(&gr_socket_pdu::handle_tcp_accept, this, new_connection,
+ boost::asio::placeholders::error));
+ }
+
+ void handle_tcp_accept(tcp_connection::pointer new_connection, const boost::system::error_code& error){
+ if (!error)
+ {
+ new_connection->start(this);
+ d_tcp_connections.push_back(new_connection);
+ start_tcp_accept();
+ } else {
+ std::cout << error << std::endl;
+ }
+ }
+
+ void run_io_service(){
+ _io_service.run();
+ }
+
+ void handle_udp_read(const boost::system::error_code& error/*error*/, size_t bytes_transferred){
+ if(!error){
+ pmt::pmt_t vector = pmt::pmt_init_u8vector(bytes_transferred, (const uint8_t*)&rxbuf[0]);
+ pmt::pmt_t pdu = pmt::pmt_cons( pmt::PMT_NIL, vector);
+
+ message_port_pub( pmt::mp("pdus"), pdu );
+
+ _udp_socket->async_receive_from( boost::asio::buffer(rxbuf), _udp_endpoint_other,
+ boost::bind(&gr_socket_pdu::handle_udp_read, this,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred));
+ } else {
+ throw boost::system::system_error(error);
+// std::cout << "error occurred\n";
+ }
+ }
+ void handle_tcp_read(const boost::system::error_code& error/*error*/, size_t bytes_transferred){
+ if(!error)
+ {
+ pmt::pmt_t vector = pmt::pmt_init_u8vector(bytes_transferred, (const uint8_t*)&rxbuf[0]);
+ pmt::pmt_t pdu = pmt::pmt_cons( pmt::PMT_NIL, vector);
+
+ message_port_pub( pmt::mp("pdus"), pdu );
+
+ _tcp_socket->async_read_some(
+ boost::asio::buffer(rxbuf),
+ boost::bind(&gr_socket_pdu::handle_tcp_read, this, boost::asio::placeholders::error, boost::asio::placeholders::bytes_transferred));
+
+ } else {
+ //std::cout << "error occurred\n";
+ throw boost::system::system_error(error);
+ }
+ }
+
+ protected:
+ gr_socket_pdu (std::string type, std::string addr, std::string port, int MTU=10000);
+ public:
+ ~gr_socket_pdu () {}
+};
+
+#endif /* INCLUDED_GR_TUNTAP_PDU_H */
diff --git a/gnuradio-core/src/lib/io/gr_socket_pdu.i b/gnuradio-core/src/lib/io/gr_socket_pdu.i
new file mode 100644
index 000000000..3e20b63e2
--- /dev/null
+++ b/gnuradio-core/src/lib/io/gr_socket_pdu.i
@@ -0,0 +1,33 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005 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,socket_pdu);
+
+%ignore tcp_connection;
+
+%{
+#include <gr_socket_pdu.h>
+%}
+
+%include "gr_stream_pdu_base.h"
+%include "gr_socket_pdu.h"
+
diff --git a/gnuradio-core/src/lib/io/gr_stream_pdu_base.cc b/gnuradio-core/src/lib/io/gr_stream_pdu_base.cc
new file mode 100644
index 000000000..7250c33e5
--- /dev/null
+++ b/gnuradio-core/src/lib/io/gr_stream_pdu_base.cc
@@ -0,0 +1,123 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <ciso646>
+#include <gr_stream_pdu_base.h>
+#include <gr_io_signature.h>
+#include <cstdio>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <stdexcept>
+#include <string.h>
+#include <iostream>
+#include <gr_pdu.h>
+#include <boost/asio.hpp>
+#include <boost/format.hpp>
+
+#ifdef HAVE_IO_H
+#include <io.h>
+#endif
+
+static const long timeout_us = 100*1000; //100ms
+
+gr_stream_pdu_base::gr_stream_pdu_base (int MTU)
+ : gr_sync_block("stream_pdu_base",
+ gr_make_io_signature(0, 0, 0),
+ gr_make_io_signature(0, 0, 0)),
+ d_finished(false), d_started(false), d_fd(-1)
+{
+ // reserve space for rx buffer
+ d_rxbuf.resize(MTU,0);
+}
+
+gr_stream_pdu_base::~gr_stream_pdu_base()
+{
+ stop_rxthread();
+}
+
+void gr_stream_pdu_base::stop_rxthread(){
+ d_finished = true;
+ if(d_started){
+ d_thread->interrupt();
+ d_thread->join();
+ }
+ }
+
+void gr_stream_pdu_base::start_rxthread(pmt::pmt_t _rxport){
+ rxport = _rxport;
+ d_thread = boost::shared_ptr<boost::thread>(new boost::thread(boost::bind(&gr_stream_pdu_base::run, this)));
+ d_started = true;
+ }
+
+void gr_stream_pdu_base::run(){
+ while(!d_finished) {
+ if(not wait_ready()){ continue; }
+ const int result = read( d_fd, &d_rxbuf[0], d_rxbuf.size() );
+ if(result <= 0){ throw std::runtime_error("gr_stream_pdu_base, bad socket read!"); }
+ pmt::pmt_t vector = pmt::pmt_init_u8vector(result, &d_rxbuf[0]);
+ pmt::pmt_t pdu = pmt::pmt_cons( pmt::PMT_NIL, vector);
+ message_port_pub(rxport, pdu);
+ }
+}
+
+void gr_stream_pdu_base::send(pmt::pmt_t msg){
+ pmt::pmt_t vector = pmt::pmt_cdr(msg);
+ size_t offset(0);
+ size_t itemsize(gr_pdu_itemsize(type_from_pmt(vector)));
+ int len( pmt::pmt_length(vector)*itemsize );
+
+ const int rv = write(d_fd, pmt::pmt_uniform_vector_elements(vector, offset), len);
+ if(rv != len){
+ std::cerr << boost::format("WARNING: gr_stream_pdu_base::send(pdu) write failed! (d_fd=%d, len=%d, rv=%d)")
+ % d_fd % len % rv << std::endl;
+ }
+}
+
+int
+gr_stream_pdu_base::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ throw std::runtime_error("should not be called.\n");
+ return 0;
+}
+
+bool gr_stream_pdu_base::wait_ready(){
+ //setup timeval for timeout
+ timeval tv;
+ tv.tv_sec = 0;
+ tv.tv_usec = timeout_us;
+
+ //setup rset for timeout
+ fd_set rset;
+ FD_ZERO(&rset);
+ FD_SET(d_fd, &rset);
+
+ //call select with timeout on receive socket
+ return ::select(d_fd+1, &rset, NULL, NULL, &tv) > 0;
+}
diff --git a/gnuradio-core/src/lib/io/gr_stream_pdu_base.h b/gnuradio-core/src/lib/io/gr_stream_pdu_base.h
new file mode 100644
index 000000000..35bacf523
--- /dev/null
+++ b/gnuradio-core/src/lib/io/gr_stream_pdu_base.h
@@ -0,0 +1,59 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_GR_STREAM_PDU_BASE_H
+#define INCLUDED_GR_STREAM_PDU_BASE_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+#include <gr_message.h>
+#include <gr_msg_queue.h>
+
+/*!
+ * \brief Gather received items into messages and insert into msgq
+ * \ingroup sink_blk
+ */
+class GR_CORE_API gr_stream_pdu_base : public gr_sync_block
+{
+ public:
+ boost::shared_ptr<boost::thread> d_thread;
+ bool d_finished;
+ bool d_started;
+ std::vector<uint8_t> d_rxbuf;
+ void run();
+ int d_fd;
+ gr_stream_pdu_base (int MTU=10000);
+ ~gr_stream_pdu_base ();
+ void send(pmt::pmt_t msg);
+ bool wait_ready();
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ void start_rxthread(pmt::pmt_t _rxport);
+ void stop_rxthread();
+ private:
+ pmt::pmt_t rxport;
+};
+
+typedef boost::shared_ptr<gr_stream_pdu_base> gr_stream_pdu_base_sptr;
+
+#endif /* INCLUDED_GR_TUNTAP_PDU_H */
diff --git a/gnuradio-core/src/lib/io/gr_tagged_file_sink.cc b/gnuradio-core/src/lib/io/gr_tagged_file_sink.cc
new file mode 100644
index 000000000..6d642088e
--- /dev/null
+++ b/gnuradio-core/src/lib/io/gr_tagged_file_sink.cc
@@ -0,0 +1,216 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_tagged_file_sink.h>
+#include <gr_io_signature.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <stdexcept>
+#include <iostream>
+
+#ifdef HAVE_IO_H
+#include <io.h>
+#endif
+
+#ifdef O_BINARY
+#define OUR_O_BINARY O_BINARY
+#else
+#define OUR_O_BINARY 0
+#endif
+
+// should be handled via configure
+#ifdef O_LARGEFILE
+#define OUR_O_LARGEFILE O_LARGEFILE
+#else
+#define OUR_O_LARGEFILE 0
+#endif
+
+
+gr_tagged_file_sink::gr_tagged_file_sink (size_t itemsize, double samp_rate)
+ : gr_sync_block ("tagged_file_sink",
+ gr_make_io_signature (1, 1, itemsize),
+ gr_make_io_signature (0, 0, 0)),
+ d_itemsize (itemsize), d_n(0), d_sample_rate(samp_rate)
+{
+ d_state = NOT_IN_BURST;
+ d_last_N = 0;
+ d_timeval = 0;
+}
+
+gr_tagged_file_sink_sptr
+gr_make_tagged_file_sink (size_t itemsize, double samp_rate)
+{
+ return gnuradio::get_initial_sptr(new gr_tagged_file_sink (itemsize, samp_rate));
+}
+
+gr_tagged_file_sink::~gr_tagged_file_sink ()
+{
+}
+
+int
+gr_tagged_file_sink::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ char *inbuf = (char *) input_items[0];
+
+ uint64_t start_N = nitems_read(0);
+ uint64_t end_N = start_N + (uint64_t)(noutput_items);
+ pmt::pmt_t bkey = pmt::pmt_string_to_symbol("burst");
+ //pmt::pmt_t tkey = pmt::pmt_string_to_symbol("time"); // use gr_tags::key_time
+
+ std::vector<gr_tag_t> all_tags;
+ get_tags_in_range(all_tags, 0, start_N, end_N);
+
+ std::sort(all_tags.begin(), all_tags.end(), gr_tag_t::offset_compare);
+
+ std::vector<gr_tag_t>::iterator vitr = all_tags.begin();
+
+ int idx = 0, idx_stop = 0;
+ while(idx < noutput_items) {
+ if(d_state == NOT_IN_BURST) {
+ while(vitr != all_tags.end()) {
+ if((pmt::pmt_eqv((*vitr).key, bkey)) &&
+ pmt::pmt_is_true((*vitr).value)) {
+
+ uint64_t N = (*vitr).offset;
+ idx = (int)(N - start_N);
+
+ //std::cout << std::endl << "Found start of burst: "
+ // << idx << ", " << N << std::endl;
+
+ // Find time burst occurred by getting latest time tag and extrapolating
+ // to new time based on sample rate of this block.
+ std::vector<gr_tag_t> time_tags;
+ //get_tags_in_range(time_tags, 0, d_last_N, N, gr_tags::key_time);
+ get_tags_in_range(time_tags, 0, d_last_N, N,
+ pmt::pmt_string_to_symbol("time"));
+ if(time_tags.size() > 0) {
+ const gr_tag_t tag = time_tags[time_tags.size()-1];
+
+ uint64_t time_nitems = tag.offset;
+
+ // Get time based on last time tag from USRP
+ pmt::pmt_t time = tag.value;
+ int tsecs = pmt::pmt_to_long(pmt::pmt_tuple_ref(time, 0));
+ double tfrac = pmt::pmt_to_double(pmt::pmt_tuple_ref(time, 1));
+
+ // Get new time from last time tag + difference in time to when
+ // burst tag occured based on the sample rate
+ double delta = (double)(N - time_nitems) / d_sample_rate;
+ d_timeval = (double)tsecs + tfrac + delta;
+
+ //std::cout.setf(std::ios::fixed, std::ios::floatfield);
+ //std::cout.precision(8);
+ //std::cout << "Time found: " << (double)tsecs + tfrac << std::endl;
+ //std::cout << " time: " << d_timeval << std::endl;
+ //std::cout << " time at N = " << time_nitems << " burst N = " << N << std::endl;
+ }
+ else {
+ // if no time tag, use last seen tag and update time based on
+ // sample rate of the block
+ d_timeval += (double)(N - d_last_N) / d_sample_rate;
+ //std::cout << "Time not found" << std::endl;
+ //std::cout << " time: " << d_timeval << std::endl;
+ }
+ d_last_N = N;
+
+ std::stringstream filename;
+ filename.setf(std::ios::fixed, std::ios::floatfield);
+ filename.precision(8);
+ filename << "file" << unique_id() << "_" << d_n << "_" << d_timeval << ".dat";
+ d_n++;
+
+ int fd;
+ if ((fd = ::open (filename.str().c_str(),
+ O_WRONLY|O_CREAT|O_TRUNC|OUR_O_LARGEFILE|OUR_O_BINARY,
+ 0664)) < 0){
+ perror (filename.str().c_str());
+ return -1;
+ }
+
+ // FIXME:
+ //if ((d_handle = fdopen (fd, d_is_binary ? "wb" : "w")) == NULL){
+ if ((d_handle = fdopen (fd, "wb")) == NULL){
+ perror (filename.str().c_str());
+ ::close(fd); // don't leak file descriptor if fdopen fails.
+ }
+
+ //std::cout << "Created new file: " << filename.str() << std::endl;
+
+ d_state = IN_BURST;
+ break;
+ }
+
+ vitr++;
+ }
+ if(d_state == NOT_IN_BURST)
+ return noutput_items;
+ }
+ else { // In burst
+ while(vitr != all_tags.end()) {
+ if((pmt::pmt_eqv((*vitr).key, bkey)) &&
+ pmt::pmt_is_false((*vitr).value)) {
+ uint64_t N = (*vitr).offset;
+ idx_stop = (int)N - start_N;
+
+ //std::cout << "Found end of burst: "
+ // << idx_stop << ", " << N << std::endl;
+
+ int count = fwrite (&inbuf[d_itemsize*idx], d_itemsize,
+ idx_stop-idx, d_handle);
+ if (count == 0) {
+ if(ferror(d_handle)) {
+ perror("gr_tagged_file_sink: error writing file");
+ }
+ }
+ idx = idx_stop;
+ d_state = NOT_IN_BURST;
+ vitr++;
+ fclose(d_handle);
+ break;
+ }
+ else {
+ vitr++;
+ }
+ }
+ if(d_state == IN_BURST) {
+ int count = fwrite (&inbuf[d_itemsize*idx], d_itemsize,
+ noutput_items-idx, d_handle);
+ if (count == 0) {
+ if(ferror(d_handle)) {
+ perror("gr_tagged_file_sink: error writing file");
+ }
+ }
+ idx = noutput_items;
+ }
+ }
+ }
+
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/io/gr_tagged_file_sink.h b/gnuradio-core/src/lib/io/gr_tagged_file_sink.h
new file mode 100644
index 000000000..d6f931a67
--- /dev/null
+++ b/gnuradio-core/src/lib/io/gr_tagged_file_sink.h
@@ -0,0 +1,72 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+#ifndef INCLUDED_GR_TAGGED_FILE_SINK_H
+#define INCLUDED_GR_TAGGED_FILE_SINK_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+#include <cstdio> // for FILE
+
+class gr_tagged_file_sink;
+typedef boost::shared_ptr<gr_tagged_file_sink> gr_tagged_file_sink_sptr;
+
+GR_CORE_API gr_tagged_file_sink_sptr gr_make_tagged_file_sink (size_t itemsize,
+ double samp_rate);
+
+/*!
+ * \brief Write stream to file descriptor.
+ * \ingroup sink_blk
+ */
+
+class GR_CORE_API gr_tagged_file_sink : public gr_sync_block
+{
+ friend GR_CORE_API gr_tagged_file_sink_sptr gr_make_tagged_file_sink (size_t itemsize,
+ double samp_rate);
+
+ private:
+ enum {
+ NOT_IN_BURST = 0,
+ IN_BURST
+ };
+
+ size_t d_itemsize;
+ int d_state;
+ FILE *d_handle;
+ int d_n;
+ double d_sample_rate;
+ uint64_t d_last_N;
+ double d_timeval;
+
+ protected:
+ gr_tagged_file_sink (size_t itemsize, double samp_rate);
+
+ public:
+ ~gr_tagged_file_sink ();
+
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+
+#endif /* INCLUDED_GR_TAGGED_FILE_SINK_H */
diff --git a/gnuradio-core/src/lib/io/gr_tagged_file_sink.i b/gnuradio-core/src/lib/io/gr_tagged_file_sink.i
new file mode 100644
index 000000000..2f2596e12
--- /dev/null
+++ b/gnuradio-core/src/lib/io/gr_tagged_file_sink.i
@@ -0,0 +1,35 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,tagged_file_sink)
+
+gr_tagged_file_sink_sptr
+gr_make_tagged_file_sink (size_t itemsize, double samp_rate);
+
+class gr_tagged_file_sink : public gr_sync_block
+{
+ protected:
+ gr_tagged_file_sink (size_t itemsize, double samp_rate);
+
+ public:
+ ~gr_tagged_file_sink ();
+};
diff --git a/gnuradio-core/src/lib/io/gr_tagged_stream_to_pdu.cc b/gnuradio-core/src/lib/io/gr_tagged_stream_to_pdu.cc
new file mode 100644
index 000000000..8211b7672
--- /dev/null
+++ b/gnuradio-core/src/lib/io/gr_tagged_stream_to_pdu.cc
@@ -0,0 +1,137 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_tagged_stream_to_pdu.h>
+#include <gr_io_signature.h>
+#include <cstdio>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <stdexcept>
+#include <string.h>
+
+// public constructor that returns a shared_ptr
+
+gr_tagged_stream_to_pdu_sptr
+gr_make_tagged_stream_to_pdu(gr_pdu_vector_type t)
+{
+ return gnuradio::get_initial_sptr(new gr_tagged_stream_to_pdu(t));
+}
+
+gr_tagged_stream_to_pdu::gr_tagged_stream_to_pdu (gr_pdu_vector_type t)
+ : gr_sync_block("tagged_stream_to_pdu",
+ gr_make_io_signature(1, 1, gr_pdu_itemsize(t)),
+ gr_make_io_signature(0, 0, 0)),
+ d_vectortype(t), d_itemsize(gr_pdu_itemsize(t)), d_inpdu(false),
+ d_pdu_meta(pmt::PMT_NIL), d_pdu_vector(pmt::PMT_NIL)
+{
+ message_port_register_out(pdu_port_id);
+}
+
+gr_tagged_stream_to_pdu::~gr_tagged_stream_to_pdu()
+{
+ printf("destructor running\n");
+}
+
+int
+gr_tagged_stream_to_pdu::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const uint8_t *in = (const uint8_t*) input_items[0];
+ uint64_t abs_N = nitems_read(0);
+
+ // if we are not in a pdu already, start a new one
+ if(!d_inpdu){
+ get_tags_in_range(d_tags, 0, abs_N, abs_N+1);
+ bool found_length_tag(false);
+ for(d_tags_itr = d_tags.begin(); (d_tags_itr != d_tags.end()) && (!found_length_tag); d_tags_itr++){
+ if( pmt::pmt_equal( (*d_tags_itr).key, pdu_length_tag ) ){
+ if( (*d_tags_itr).offset != abs_N ){
+ throw std::runtime_error("expected next pdu length tag on a different item...");
+ }
+ found_length_tag = true;
+ d_pdu_length = pmt::pmt_to_long( (*d_tags_itr).value );
+ d_pdu_remain = d_pdu_length;
+ d_pdu_meta = pmt::pmt_make_dict();
+ break;
+ } // if have length tag
+ } // iter over tags
+ if(!found_length_tag){
+ throw std::runtime_error("tagged stream does not contain a pdu_length tag!");
+ }
+ }
+
+ size_t ncopy = std::min((size_t)noutput_items, d_pdu_remain);
+
+ // copy any tags in this range into our meta object
+ get_tags_in_range(d_tags, 0, abs_N, abs_N+ncopy);
+ for(d_tags_itr = d_tags.begin(); d_tags_itr != d_tags.end(); d_tags_itr++){
+ if( ! pmt_equal( (*d_tags_itr).key, pdu_length_tag ) ){
+ d_pdu_meta = pmt_dict_add(d_pdu_meta, (*d_tags_itr).key, (*d_tags_itr).value);
+ }
+ }
+
+ // copy samples for this vector into either a pmt or our save buffer
+ if(ncopy == d_pdu_remain){ // we will send this pdu
+ if(d_save.size() == 0){
+ d_pdu_vector = gr_pdu_make_vector(d_vectortype, in, ncopy);
+ send_message();
+ } else {
+ size_t oldsize = d_save.size();
+ d_save.resize((oldsize + ncopy)*d_itemsize, 0);
+ memcpy( &d_save[oldsize*d_itemsize], in, ncopy*d_itemsize );
+ d_pdu_vector = gr_pdu_make_vector(d_vectortype, &d_save[0], d_pdu_length);
+ send_message();
+ d_save.clear();
+ }
+ } else {
+ d_inpdu = true;
+ size_t oldsize = d_save.size();
+ d_save.resize( (oldsize+ncopy)*d_itemsize );
+ memcpy( &d_save[oldsize*d_itemsize], in, ncopy*d_itemsize );
+ d_pdu_remain -= ncopy;
+ }
+
+ return ncopy;
+}
+
+void gr_tagged_stream_to_pdu::send_message(){
+
+ if(pmt::pmt_length(d_pdu_vector) != d_pdu_length){
+ throw std::runtime_error("msg length not correct");
+ }
+
+ pmt::pmt_t msg = pmt::pmt_cons( d_pdu_meta, d_pdu_vector );
+ message_port_pub( pdu_port_id, msg );
+
+ d_pdu_meta = pmt::PMT_NIL;
+ d_pdu_vector = pmt::PMT_NIL;
+ d_pdu_length = 0;
+ d_pdu_remain = 0;
+ d_inpdu = false;
+}
diff --git a/gnuradio-core/src/lib/io/gr_tagged_stream_to_pdu.h b/gnuradio-core/src/lib/io/gr_tagged_stream_to_pdu.h
new file mode 100644
index 000000000..c3fff3581
--- /dev/null
+++ b/gnuradio-core/src/lib/io/gr_tagged_stream_to_pdu.h
@@ -0,0 +1,76 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_GR_TAGGED_STREAM_TO_PDU_H
+#define INCLUDED_GR_TAGGED_STREAM_TO_PDU_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+#include <gr_message.h>
+#include <gr_msg_queue.h>
+#include <gr_pdu.h>
+
+class gr_tagged_stream_to_pdu;
+typedef boost::shared_ptr<gr_tagged_stream_to_pdu> gr_tagged_stream_to_pdu_sptr;
+
+GR_CORE_API gr_tagged_stream_to_pdu_sptr gr_make_tagged_stream_to_pdu (gr_pdu_vector_type t);
+
+/*!
+ * \brief Turn received messages into a stream
+ * \ingroup source_blk
+ */
+class GR_CORE_API gr_tagged_stream_to_pdu : public gr_sync_block
+{
+ private:
+ gr_pdu_vector_type d_vectortype;
+ size_t d_itemsize;
+
+ std::vector<uint8_t> d_save;
+
+ std::vector<gr_tag_t> d_tags;
+ std::vector<gr_tag_t>::iterator d_tags_itr;
+
+ bool d_inpdu;
+
+ size_t d_pdu_length;
+ size_t d_pdu_remain;
+ pmt::pmt_t d_pdu_meta;
+ pmt::pmt_t d_pdu_vector;
+
+ friend GR_CORE_API gr_tagged_stream_to_pdu_sptr
+ gr_make_tagged_stream_to_pdu(gr_pdu_vector_type t);
+
+ protected:
+ gr_tagged_stream_to_pdu (gr_pdu_vector_type t);
+
+ public:
+ ~gr_tagged_stream_to_pdu ();
+
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+
+ void send_message();
+
+};
+
+#endif /* INCLUDED_GR_PDU_TO_TAGGED_SOURCE_H */
diff --git a/gnuradio-core/src/lib/io/gr_tagged_stream_to_pdu.i b/gnuradio-core/src/lib/io/gr_tagged_stream_to_pdu.i
new file mode 100644
index 000000000..f12987b74
--- /dev/null
+++ b/gnuradio-core/src/lib/io/gr_tagged_stream_to_pdu.i
@@ -0,0 +1,31 @@
+/* -*- 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,tagged_stream_to_pdu);
+
+%{
+#include <gr_tagged_stream_to_pdu.h>
+%}
+
+%include <gr_tagged_stream_to_pdu.h>
+
+
diff --git a/gnuradio-core/src/lib/io/gr_trigger_mode.h b/gnuradio-core/src/lib/io/gr_trigger_mode.h
new file mode 100644
index 000000000..be131686b
--- /dev/null
+++ b/gnuradio-core/src/lib/io/gr_trigger_mode.h
@@ -0,0 +1,38 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2003,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_TRIGGER_MODE_H
+#define INCLUDED_GR_TRIGGER_MODE_H
+
+enum gr_trigger_mode {
+ gr_TRIG_MODE_FREE,
+ gr_TRIG_MODE_AUTO,
+ gr_TRIG_MODE_NORM,
+ gr_TRIG_MODE_STRIPCHART,
+};
+
+enum gr_trigger_slope {
+ gr_TRIG_SLOPE_POS,
+ gr_TRIG_SLOPE_NEG,
+};
+
+#endif /* INCLUDED_GR_TRIGGER_MODE_H */
diff --git a/gnuradio-core/src/lib/io/gr_tuntap_pdu.cc b/gnuradio-core/src/lib/io/gr_tuntap_pdu.cc
new file mode 100644
index 000000000..8dd4b18a1
--- /dev/null
+++ b/gnuradio-core/src/lib/io/gr_tuntap_pdu.cc
@@ -0,0 +1,145 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_tuntap_pdu.h>
+#include <gr_io_signature.h>
+#include <cstdio>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <stdexcept>
+#include <string.h>
+#include <iostream>
+#include <gr_pdu.h>
+#include <boost/format.hpp>
+
+#if (defined(linux) || defined(__linux) || defined(__linux__))
+
+#include <sys/ioctl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
+#include <arpa/inet.h>
+#include <linux/if.h>
+
+
+// public constructor that returns a shared_ptr
+
+gr_tuntap_pdu_sptr
+gr_make_tuntap_pdu (std::string dev, int MTU)
+{
+ return gnuradio::get_initial_sptr(new gr_tuntap_pdu(dev, MTU));
+}
+
+gr_tuntap_pdu::gr_tuntap_pdu (std::string dev, int MTU)
+ : gr_stream_pdu_base(MTU)
+{
+
+ // make the tuntap
+ char dev_cstr[1024];
+ memset(dev_cstr, 0x00, 1024);
+ strncpy(dev_cstr, dev.c_str(), std::min(sizeof(dev_cstr), dev.size()));
+ d_fd = tun_alloc(dev_cstr);
+ if(d_fd <= 0){
+ throw std::runtime_error("TunTap make: tun_alloc failed (are you running as root?)");
+ }
+
+ std::cout << boost::format(
+ "Allocated virtual ethernet interface: %s\n"
+ "You must now use ifconfig to set its IP address. E.g.,\n"
+ " $ sudo ifconfig %s 192.168.200.1\n"
+ "Be sure to use a different address in the same subnet for each machine.\n"
+ ) % dev % dev << std::endl;
+
+ // set up output message port
+ message_port_register_out(pmt::mp("pdus"));
+ start_rxthread(pmt::mp("pdus"));
+
+ // set up input message port
+ message_port_register_in(pmt::mp("pdus"));
+ set_msg_handler(pmt::mp("pdus"), boost::bind(&gr_tuntap_pdu::send, this, _1));
+}
+
+
+int gr_tuntap_pdu::tun_alloc(char *dev, int flags) {
+ struct ifreq ifr;
+ int fd, err;
+ const char *clonedev = "/dev/net/tun";
+
+ /* Arguments taken by the function:
+ *
+ * char *dev: the name of an interface (or '\0'). MUST have enough
+ * space to hold the interface name if '\0' is passed
+ * int flags: interface flags (eg, IFF_TUN etc.)
+ */
+
+ /* open the clone device */
+ if( (fd = open(clonedev, O_RDWR)) < 0 ) {
+ return fd;
+ }
+
+ /* preparation of the struct ifr, of type "struct ifreq" */
+ memset(&ifr, 0, sizeof(ifr));
+
+ ifr.ifr_flags = flags; /* IFF_TUN or IFF_TAP, plus maybe IFF_NO_PI */
+
+ if (*dev) {
+ /* if a device name was specified, put it in the structure; otherwise,
+ * the kernel will try to allocate the "next" device of the
+ * specified type */
+ strncpy(ifr.ifr_name, dev, IFNAMSIZ);
+ }
+
+ /* try to create the device */
+ if( (err = ioctl(fd, TUNSETIFF, (void *) &ifr)) < 0 ) {
+ close(fd);
+ return err;
+ }
+
+ /* if the operation was successful, write back the name of the
+ * interface to the variable "dev", so the caller can know
+ * it. Note that the caller MUST reserve space in *dev (see calling
+ * code below) */
+ strcpy(dev, ifr.ifr_name);
+
+ /* this is the special file descriptor that the caller will use to talk
+ * with the virtual interface */
+ return fd;
+}
+
+#else //if not linux
+
+gr_block_sptr
+gr_make_tuntap_pdu(std::string dev, int MTU)
+{
+ gr_block_sptr rv;
+ throw std::runtime_error("tuntap only implemented on linux");
+ return rv;
+}
+
+#endif
diff --git a/gnuradio-core/src/lib/io/gr_tuntap_pdu.h b/gnuradio-core/src/lib/io/gr_tuntap_pdu.h
new file mode 100644
index 000000000..18c83f42b
--- /dev/null
+++ b/gnuradio-core/src/lib/io/gr_tuntap_pdu.h
@@ -0,0 +1,74 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_GR_TUNTAP_PDU_H
+#define INCLUDED_GR_TUNTAP_PDU_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+#include <gr_message.h>
+#include <gr_msg_queue.h>
+#include <gr_stream_pdu_base.h>
+
+#if (defined(linux) || defined(__linux) || defined(__linux__))
+
+#include <linux/if_tun.h>
+
+class gr_tuntap_pdu;
+typedef boost::shared_ptr<gr_tuntap_pdu> gr_tuntap_pdu_sptr;
+
+GR_CORE_API gr_tuntap_pdu_sptr gr_make_tuntap_pdu (std::string dev, int MTU=10000);
+
+/*!
+ * \brief Gather received items into messages and insert into msgq
+ * \ingroup sink_blk
+ */
+class GR_CORE_API gr_tuntap_pdu : public gr_stream_pdu_base
+{
+ private:
+ friend GR_CORE_API gr_tuntap_pdu_sptr
+ gr_make_tuntap_pdu(std::string dev, int MTU);
+ int tun_alloc(char* dev, int flags = IFF_TAP | IFF_NO_PI);
+ std::string d_dev;
+ protected:
+ gr_tuntap_pdu (std::string dev, int MTU=10000);
+
+ public:
+ ~gr_tuntap_pdu () {}
+
+};
+
+#else // if not linux
+
+class gr_tuntap_pdu
+{
+private:
+ gr_tuntap_pdu() {};
+public:
+ ~gr_tuntap_pdu() {};
+};
+
+GR_CORE_API gr_block_sptr gr_make_tuntap_pdu (std::string dev, int MTU=0);
+
+#endif
+
+#endif /* INCLUDED_GR_TUNTAP_PDU_H */
diff --git a/gnuradio-core/src/lib/io/gr_tuntap_pdu.i b/gnuradio-core/src/lib/io/gr_tuntap_pdu.i
new file mode 100644
index 000000000..589bbc385
--- /dev/null
+++ b/gnuradio-core/src/lib/io/gr_tuntap_pdu.i
@@ -0,0 +1,30 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005 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,tuntap_pdu);
+
+%{
+#include <gr_tuntap_pdu.h>
+%}
+
+%include "gr_tuntap_pdu.h"
+
diff --git a/gnuradio-core/src/lib/io/gr_udp_sink.cc b/gnuradio-core/src/lib/io/gr_udp_sink.cc
new file mode 100644
index 000000000..6b1d34ef7
--- /dev/null
+++ b/gnuradio-core/src/lib/io/gr_udp_sink.cc
@@ -0,0 +1,304 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007,2008,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.
+ */
+
+#include <boost/asio.hpp>
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+#include <gr_udp_sink.h>
+#include <gr_io_signature.h>
+#include <stdexcept>
+#include <errno.h>
+#include <stdio.h>
+#include <string.h>
+#if defined(HAVE_NETDB_H)
+#include <netdb.h>
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h> //usually included by <netdb.h>?
+#endif
+typedef void* optval_t;
+#elif defined(HAVE_WINDOWS_H)
+// if not posix, assume winsock
+#define USING_WINSOCK
+#include <winsock2.h>
+#include <ws2tcpip.h>
+#define SHUT_RDWR 2
+typedef char* optval_t;
+#endif
+
+#include <gruel/thread.h>
+
+#define SNK_VERBOSE 0
+
+static int is_error( int perr )
+{
+ // Compare error to posix error code; return nonzero if match.
+#if defined(USING_WINSOCK)
+#define ENOPROTOOPT 109
+#define ECONNREFUSED 111
+ // All codes to be checked for must be defined below
+ int werr = WSAGetLastError();
+ switch( werr ) {
+ case WSAETIMEDOUT:
+ return( perr == EAGAIN );
+ case WSAENOPROTOOPT:
+ return( perr == ENOPROTOOPT );
+ case WSAECONNREFUSED:
+ return( perr == ECONNREFUSED );
+ default:
+ fprintf(stderr,"gr_udp_source/is_error: unknown error %d\n", perr );
+ throw std::runtime_error("internal error");
+ }
+ return 0;
+#else
+ return( perr == errno );
+#endif
+}
+
+static void report_error( const char *msg1, const char *msg2 )
+{
+ // Deal with errors, both posix and winsock
+#if defined(USING_WINSOCK)
+ int werr = WSAGetLastError();
+ fprintf(stderr, "%s: winsock error %d\n", msg1, werr );
+#else
+ perror(msg1);
+#endif
+ if( msg2 != NULL )
+ throw std::runtime_error(msg2);
+ return;
+}
+
+gr_udp_sink::gr_udp_sink (size_t itemsize,
+ const char *host, unsigned short port,
+ int payload_size, bool eof)
+ : gr_sync_block ("udp_sink",
+ gr_make_io_signature (1, 1, itemsize),
+ gr_make_io_signature (0, 0, 0)),
+ d_itemsize (itemsize), d_payload_size(payload_size), d_eof(eof),
+ d_socket(-1), d_connected(false)
+{
+#if defined(USING_WINSOCK) // for Windows (with MinGW)
+ // initialize winsock DLL
+ WSADATA wsaData;
+ int iResult = WSAStartup( MAKEWORD(2,2), &wsaData );
+ if( iResult != NO_ERROR ) {
+ report_error( "gr_udp_source WSAStartup", "can't open socket" );
+ }
+#endif
+
+ // create socket
+ d_socket = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
+ if(d_socket == -1) {
+ report_error("socket open","can't open socket");
+ }
+
+ // Don't wait when shutting down
+ linger lngr;
+ lngr.l_onoff = 1;
+ lngr.l_linger = 0;
+ if(setsockopt(d_socket, SOL_SOCKET, SO_LINGER, (optval_t)&lngr, sizeof(linger)) == -1) {
+ if( !is_error(ENOPROTOOPT) ) { // no SO_LINGER for SOCK_DGRAM on Windows
+ report_error("SO_LINGER","can't set socket option SO_LINGER");
+ }
+ }
+
+ // Get the destination address
+ connect(host, port);
+}
+
+// public constructor that returns a shared_ptr
+
+gr_udp_sink_sptr
+gr_make_udp_sink (size_t itemsize,
+ const char *host, unsigned short port,
+ int payload_size, bool eof)
+{
+ return gnuradio::get_initial_sptr(new gr_udp_sink (itemsize,
+ host, port,
+ payload_size, eof));
+}
+
+gr_udp_sink::~gr_udp_sink ()
+{
+ if (d_connected)
+ disconnect();
+
+ if (d_socket != -1){
+ shutdown(d_socket, SHUT_RDWR);
+#if defined(USING_WINSOCK)
+ closesocket(d_socket);
+#else
+ ::close(d_socket);
+#endif
+ d_socket = -1;
+ }
+
+#if defined(USING_WINSOCK) // for Windows (with MinGW)
+ // free winsock resources
+ WSACleanup();
+#endif
+}
+
+int
+gr_udp_sink::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const char *in = (const char *) input_items[0];
+ ssize_t r=0, bytes_sent=0, bytes_to_send=0;
+ ssize_t total_size = noutput_items*d_itemsize;
+
+ #if SNK_VERBOSE
+ printf("Entered udp_sink\n");
+ #endif
+
+ gruel::scoped_lock guard(d_mutex); // protect d_socket
+
+ while(bytes_sent < total_size) {
+ bytes_to_send = std::min((ssize_t)d_payload_size, (total_size-bytes_sent));
+
+ if(d_connected) {
+ r = send(d_socket, (in+bytes_sent), bytes_to_send, 0);
+ if(r == -1) { // error on send command
+ if( is_error(ECONNREFUSED) )
+ r = bytes_to_send; // discard data until receiver is started
+ else {
+ report_error("udp_sink",NULL); // there should be no error case where
+ return -1; // this function should not exit immediately
+ }
+ }
+ }
+ else
+ r = bytes_to_send; // discarded for lack of connection
+ bytes_sent += r;
+
+ #if SNK_VERBOSE
+ printf("\tbyte sent: %d bytes\n", r);
+ #endif
+ }
+
+ #if SNK_VERBOSE
+ printf("Sent: %d bytes (noutput_items: %d)\n", bytes_sent, noutput_items);
+ #endif
+
+ return noutput_items;
+}
+
+void gr_udp_sink::connect( const char *host, unsigned short port )
+{
+ if(d_connected)
+ disconnect();
+
+ if(host != NULL ) {
+ // Get the destination address
+ struct addrinfo *ip_dst;
+ struct addrinfo hints;
+ memset( (void*)&hints, 0, sizeof(hints) );
+ hints.ai_family = AF_INET;
+ hints.ai_socktype = SOCK_DGRAM;
+ hints.ai_protocol = IPPROTO_UDP;
+ char port_str[12];
+ sprintf( port_str, "%d", port );
+
+ // FIXME leaks if report_error throws below
+ int ret = getaddrinfo( host, port_str, &hints, &ip_dst );
+ if( ret != 0 )
+ report_error("gr_udp_source/getaddrinfo",
+ "can't initialize destination socket" );
+
+ // don't need d_mutex lock when !d_connected
+ if(::connect(d_socket, ip_dst->ai_addr, ip_dst->ai_addrlen) == -1) {
+ report_error("socket connect","can't connect to socket");
+ }
+ d_connected = true;
+
+ freeaddrinfo(ip_dst);
+ }
+
+ return;
+}
+
+void gr_udp_sink::disconnect()
+{
+ if(!d_connected)
+ return;
+
+ #if SNK_VERBOSE
+ printf("gr_udp_sink disconnecting\n");
+ #endif
+
+ gruel::scoped_lock guard(d_mutex); // protect d_socket from work()
+
+ // Send a few zero-length packets to signal receiver we are done
+ if(d_eof) {
+ int i;
+ for( i = 0; i < 3; i++ )
+ (void) send( d_socket, NULL, 0, 0 ); // ignore errors
+ }
+
+ // Sending EOF can produce ERRCONNREFUSED errors that won't show up
+ // until the next send or recv, which might confuse us if it happens
+ // on a new connection. The following does a nonblocking recv to
+ // clear any such errors.
+ timeval timeout;
+ timeout.tv_sec = 0; // zero time for immediate return
+ timeout.tv_usec = 0;
+ fd_set readfds;
+ FD_ZERO(&readfds);
+ FD_SET(d_socket, &readfds);
+ int r = select(FD_SETSIZE, &readfds, NULL, NULL, &timeout);
+ if(r < 0) {
+ #if SNK_VERBOSE
+ report_error("udp_sink/select",NULL);
+ #endif
+ }
+ else if(r > 0) { // call recv() to get error return
+ r = recv(d_socket, (char*)&readfds, sizeof(readfds), 0);
+ if(r < 0) {
+ #if SNK_VERBOSE
+ report_error("udp_sink/recv",NULL);
+ #endif
+ }
+ }
+
+ // Since I can't find any way to disconnect a datagram socket in Cygwin,
+ // we just leave it connected but disable sending.
+#if 0
+ // zeroed address structure should reset connection
+ struct sockaddr addr;
+ memset( (void*)&addr, 0, sizeof(addr) );
+ // addr.sa_family = AF_UNSPEC; // doesn't work on Cygwin
+ // addr.sa_family = AF_INET; // doesn't work on Cygwin
+
+ if(::connect(d_socket, &addr, sizeof(addr)) == -1)
+ report_error("socket connect","can't connect to socket");
+#endif
+
+ d_connected = false;
+
+ return;
+}
diff --git a/gnuradio-core/src/lib/io/gr_udp_sink.h b/gnuradio-core/src/lib/io/gr_udp_sink.h
new file mode 100644
index 000000000..bf042a6d1
--- /dev/null
+++ b/gnuradio-core/src/lib/io/gr_udp_sink.h
@@ -0,0 +1,112 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007,2008,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.
+ */
+
+#ifndef INCLUDED_GR_UDP_SINK_H
+#define INCLUDED_GR_UDP_SINK_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+#include <gruel/thread.h>
+
+class gr_udp_sink;
+typedef boost::shared_ptr<gr_udp_sink> gr_udp_sink_sptr;
+
+GR_CORE_API gr_udp_sink_sptr
+gr_make_udp_sink (size_t itemsize,
+ const char *host, unsigned short port,
+ int payload_size=1472, bool eof=true);
+
+/*!
+ * \brief Write stream to an UDP socket.
+ * \ingroup sink_blk
+ *
+ * \param itemsize The size (in bytes) of the item datatype
+ * \param host The name or IP address of the receiving host; use
+ * NULL or None for no connection
+ * \param port Destination port to connect to on receiving host
+ * \param payload_size UDP payload size by default set to 1472 =
+ * (1500 MTU - (8 byte UDP header) - (20 byte IP header))
+ * \param eof Send zero-length packet on disconnect
+ */
+
+class GR_CORE_API gr_udp_sink : public gr_sync_block
+{
+ friend GR_CORE_API gr_udp_sink_sptr gr_make_udp_sink (size_t itemsize,
+ const char *host,
+ unsigned short port,
+ int payload_size, bool eof);
+ private:
+ size_t d_itemsize;
+
+ int d_payload_size; // maximum transmission unit (packet length)
+ bool d_eof; // send zero-length packet on disconnect
+ int d_socket; // handle to socket
+ bool d_connected; // are we connected?
+ gruel::mutex d_mutex; // protects d_socket and d_connected
+
+ protected:
+ /*!
+ * \brief UDP Sink Constructor
+ *
+ * \param itemsize The size (in bytes) of the item datatype
+ * \param host The name or IP address of the receiving host; use
+ * NULL or None for no connection
+ * \param port Destination port to connect to on receiving host
+ * \param payload_size UDP payload size by default set to
+ * 1472 = (1500 MTU - (8 byte UDP header) - (20 byte IP header))
+ * \param eof Send zero-length packet on disconnect
+ */
+ gr_udp_sink (size_t itemsize,
+ const char *host, unsigned short port,
+ int payload_size, bool eof);
+
+ public:
+ ~gr_udp_sink ();
+
+ /*! \brief return the PAYLOAD_SIZE of the socket */
+ int payload_size() { return d_payload_size; }
+
+ /*! \brief Change the connection to a new destination
+ *
+ * \param host The name or IP address of the receiving host; use
+ * NULL or None to break the connection without closing
+ * \param port Destination port to connect to on receiving host
+ *
+ * Calls disconnect() to terminate any current connection first.
+ */
+ void connect( const char *host, unsigned short port );
+
+ /*! \brief Send zero-length packet (if eof is requested) then stop sending
+ *
+ * Zero-byte packets can be interpreted as EOF by gr_udp_source. Note that
+ * disconnect occurs automatically when the sink is destroyed, but not when
+ * its top_block stops.*/
+ void disconnect();
+
+ // should we export anything else?
+
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif /* INCLUDED_GR_UDP_SINK_H */
diff --git a/gnuradio-core/src/lib/io/gr_udp_sink.i b/gnuradio-core/src/lib/io/gr_udp_sink.i
new file mode 100644
index 000000000..ba7043937
--- /dev/null
+++ b/gnuradio-core/src/lib/io/gr_udp_sink.i
@@ -0,0 +1,46 @@
+/* -*- 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.
+ */
+
+
+GR_SWIG_BLOCK_MAGIC(gr,udp_sink)
+
+gr_udp_sink_sptr
+gr_make_udp_sink (size_t itemsize,
+ const char *host, unsigned short port,
+ int payload_size=1472, bool eof=true) throw (std::runtime_error);
+
+class gr_udp_sink : public gr_sync_block
+{
+ protected:
+ gr_udp_sink (size_t itemsize,
+ const char *host, unsigned short port,
+ int payload_size, bool eof)
+ throw (std::runtime_error);
+
+ public:
+ ~gr_udp_sink ();
+
+ int payload_size() { return d_payload_size; }
+ void connect( const char *host, unsigned short port );
+ void disconnect();
+
+};
diff --git a/gnuradio-core/src/lib/io/gr_udp_source.cc b/gnuradio-core/src/lib/io/gr_udp_source.cc
new file mode 100644
index 000000000..eca8e89d0
--- /dev/null
+++ b/gnuradio-core/src/lib/io/gr_udp_source.cc
@@ -0,0 +1,374 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007,2008,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+#include <gr_udp_source.h>
+#include <gr_io_signature.h>
+#include <stdexcept>
+#include <errno.h>
+#include <stdio.h>
+#include <string.h>
+
+#if defined(HAVE_NETDB_H)
+#include <netdb.h>
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+typedef void* optval_t;
+
+// ntohs() on FreeBSD may require both netinet/in.h and arpa/inet.h, in order
+#if defined(HAVE_NETINET_IN_H)
+#include <netinet/in.h>
+#endif
+#if defined(HAVE_ARPA_INET_H)
+#include <arpa/inet.h>
+#endif
+
+#elif defined(HAVE_WINDOWS_H)
+// if not posix, assume winsock
+#define USING_WINSOCK
+#include <winsock2.h>
+#include <ws2tcpip.h>
+#define SHUT_RDWR 2
+typedef char* optval_t;
+#endif
+
+#define USE_SELECT 1 // non-blocking receive on all platforms
+#define USE_RCV_TIMEO 0 // non-blocking receive on all but Cygwin
+#define SRC_VERBOSE 0
+
+static int is_error( int perr )
+{
+ // Compare error to posix error code; return nonzero if match.
+#if defined(USING_WINSOCK)
+#define ENOPROTOOPT 109
+ // All codes to be checked for must be defined below
+ int werr = WSAGetLastError();
+ switch( werr ) {
+ case WSAETIMEDOUT:
+ return( perr == EAGAIN );
+ case WSAENOPROTOOPT:
+ return( perr == ENOPROTOOPT );
+ default:
+ fprintf(stderr,"gr_udp_source/is_error: unknown error %d\n", perr );
+ throw std::runtime_error("internal error");
+ }
+ return 0;
+#else
+ return( perr == errno );
+#endif
+}
+
+static void report_error( const char *msg1, const char *msg2 )
+{
+ // Deal with errors, both posix and winsock
+#if defined(USING_WINSOCK)
+ int werr = WSAGetLastError();
+ fprintf(stderr, "%s: winsock error %d\n", msg1, werr );
+#else
+ perror(msg1);
+#endif
+ if( msg2 != NULL )
+ throw std::runtime_error(msg2);
+ return;
+}
+
+gr_udp_source::gr_udp_source(size_t itemsize, const char *host,
+ unsigned short port, int payload_size,
+ bool eof, bool wait)
+ : gr_sync_block ("udp_source",
+ gr_make_io_signature(0, 0, 0),
+ gr_make_io_signature(1, 1, itemsize)),
+ d_itemsize(itemsize), d_payload_size(payload_size),
+ d_eof(eof), d_wait(wait), d_socket(-1), d_residual(0), d_temp_offset(0)
+{
+ int ret = 0;
+
+#if defined(USING_WINSOCK) // for Windows (with MinGW)
+ // initialize winsock DLL
+ WSADATA wsaData;
+ int iResult = WSAStartup( MAKEWORD(2,2), &wsaData );
+ if( iResult != NO_ERROR ) {
+ report_error( "gr_udp_source WSAStartup", "can't open socket" );
+ }
+#endif
+
+ // Set up the address stucture for the source address and port numbers
+ // Get the source IP address from the host name
+ struct addrinfo *ip_src; // store the source IP address to use
+ struct addrinfo hints;
+ memset( (void*)&hints, 0, sizeof(hints) );
+ hints.ai_family = AF_INET;
+ hints.ai_socktype = SOCK_DGRAM;
+ hints.ai_protocol = IPPROTO_UDP;
+ hints.ai_flags = AI_PASSIVE;
+ char port_str[12];
+ sprintf( port_str, "%d", port );
+
+ // FIXME leaks if report_error throws below
+ ret = getaddrinfo( host, port_str, &hints, &ip_src );
+ if( ret != 0 )
+ report_error("gr_udp_source/getaddrinfo",
+ "can't initialize source socket" );
+
+ // FIXME leaks if report_error throws below
+ d_temp_buff = new char[d_payload_size]; // allow it to hold up to payload_size bytes
+
+ // create socket
+ d_socket = socket(ip_src->ai_family, ip_src->ai_socktype,
+ ip_src->ai_protocol);
+ if(d_socket == -1) {
+ report_error("socket open","can't open socket");
+ }
+
+ // Turn on reuse address
+ int opt_val = 1;
+ if(setsockopt(d_socket, SOL_SOCKET, SO_REUSEADDR, (optval_t)&opt_val, sizeof(int)) == -1) {
+ report_error("SO_REUSEADDR","can't set socket option SO_REUSEADDR");
+ }
+
+ // Don't wait when shutting down
+ linger lngr;
+ lngr.l_onoff = 1;
+ lngr.l_linger = 0;
+ if(setsockopt(d_socket, SOL_SOCKET, SO_LINGER, (optval_t)&lngr, sizeof(linger)) == -1) {
+ if( !is_error(ENOPROTOOPT) ) { // no SO_LINGER for SOCK_DGRAM on Windows
+ report_error("SO_LINGER","can't set socket option SO_LINGER");
+ }
+ }
+
+#if USE_RCV_TIMEO
+ // Set a timeout on the receive function to not block indefinitely
+ // This value can (and probably should) be changed
+ // Ignored on Cygwin
+#if defined(USING_WINSOCK)
+ DWORD timeout = 1000; // milliseconds
+#else
+ timeval timeout;
+ timeout.tv_sec = 1;
+ timeout.tv_usec = 0;
+#endif
+ if(setsockopt(d_socket, SOL_SOCKET, SO_RCVTIMEO, (optval_t)&timeout, sizeof(timeout)) == -1) {
+ report_error("SO_RCVTIMEO","can't set socket option SO_RCVTIMEO");
+ }
+#endif // USE_RCV_TIMEO
+
+ // bind socket to an address and port number to listen on
+ if(bind (d_socket, ip_src->ai_addr, ip_src->ai_addrlen) == -1) {
+ report_error("socket bind","can't bind socket");
+ }
+ freeaddrinfo(ip_src);
+
+}
+
+gr_udp_source_sptr
+gr_make_udp_source (size_t itemsize, const char *ipaddr,
+ unsigned short port, int payload_size, bool eof, bool wait)
+{
+ return gnuradio::get_initial_sptr(new gr_udp_source (itemsize, ipaddr,
+ port, payload_size, eof, wait));
+}
+
+gr_udp_source::~gr_udp_source ()
+{
+ delete [] d_temp_buff;
+
+ if (d_socket != -1){
+ shutdown(d_socket, SHUT_RDWR);
+#if defined(USING_WINSOCK)
+ closesocket(d_socket);
+#else
+ ::close(d_socket);
+#endif
+ d_socket = -1;
+ }
+
+#if defined(USING_WINSOCK) // for Windows (with MinGW)
+ // free winsock resources
+ WSACleanup();
+#endif
+}
+
+int
+gr_udp_source::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ char *out = (char *) output_items[0];
+ ssize_t r=0, nbytes=0, bytes_received=0;
+ ssize_t total_bytes = (ssize_t)(d_itemsize*noutput_items);
+
+ #if SRC_VERBOSE
+ printf("\nEntered udp_source\n");
+ #endif
+
+ // Remove items from temp buffer if they are in there
+ if(d_residual) {
+ nbytes = std::min(d_residual, total_bytes);
+ memcpy(out, d_temp_buff+d_temp_offset, nbytes);
+ bytes_received = nbytes;
+
+ #if SRC_VERBOSE
+ printf("\tTemp buff size: %d offset: %d (bytes_received: %d) (noutput_items: %d)\n",
+ d_residual, d_temp_offset, bytes_received, noutput_items);
+ #endif
+
+ // Increment pointer
+ out += bytes_received;
+
+ // Update indexing of amount of bytes left in the buffer
+ d_residual -= nbytes;
+ d_temp_offset += nbytes;
+
+ // Return now with what we've got.
+ assert(nbytes % d_itemsize == 0);
+ return nbytes/d_itemsize;
+ }
+
+ while(1) {
+ // get the data into our output buffer and record the number of bytes
+
+#if USE_SELECT
+ // RCV_TIMEO doesn't work on all systems (e.g., Cygwin)
+ // use select() instead of, or in addition to RCV_TIMEO
+ fd_set readfds;
+ timeval timeout;
+ timeout.tv_sec = 1; // Init timeout each iteration. Select can modify it.
+ timeout.tv_usec = 0;
+ FD_ZERO(&readfds);
+ FD_SET(d_socket, &readfds);
+ r = select(FD_SETSIZE, &readfds, NULL, NULL, &timeout);
+ if(r < 0) {
+ report_error("udp_source/select",NULL);
+ return -1;
+ }
+ else if(r == 0 ) { // timed out
+ if( d_wait ) {
+ // Allow boost thread interrupt, then try again
+ //boost::this_thread::interruption_point();
+ //continue;
+ return 0;
+ }
+ else
+ return -1;
+ }
+#endif // USE_SELECT
+
+ // This is a non-blocking call with a timeout set in the constructor
+ r = recv(d_socket, d_temp_buff, d_payload_size, 0); // get the entire payload or the what's available
+
+ // If r > 0, round it down to a multiple of d_itemsize
+ // (If sender is broken, don't propagate problem)
+ if (r > 0)
+ r = (r/d_itemsize) * d_itemsize;
+
+ // Check if there was a problem; forget it if the operation just timed out
+ if(r == -1) {
+ if( is_error(EAGAIN) ) { // handle non-blocking call timeout
+ #if SRC_VERBOSE
+ printf("UDP receive timed out\n");
+ #endif
+
+ if( d_wait ) {
+ // Allow boost thread interrupt, then try again
+ //boost::this_thread::interruption_point();
+ //continue;
+ return 0;
+ }
+ else
+ return -1;
+ }
+ else {
+ report_error("udp_source/recv",NULL);
+ return -1;
+ }
+ }
+ else if(r==0) {
+ if(d_eof) {
+ // zero-length packet interpreted as EOF
+
+ #if SNK_VERBOSE
+ printf("\tzero-length packet received; returning EOF\n");
+ #endif
+
+ return -1;
+ }
+ else{
+ // do we need to allow boost thread interrupt?
+ boost::this_thread::interruption_point();
+ continue;
+ }
+ }
+ else {
+ // Calculate the number of bytes we can take from the buffer in this call
+ nbytes = std::min(r, total_bytes-bytes_received);
+
+ // adjust the total number of bytes we have to round down to nearest integer of an itemsize
+ nbytes -= ((bytes_received+nbytes) % d_itemsize);
+
+ // copy the number of bytes we want to look at here
+ memcpy(out, d_temp_buff, nbytes);
+
+ d_residual = r - nbytes; // save the number of bytes stored
+ d_temp_offset=nbytes; // reset buffer index
+
+ // keep track of the total number of bytes received
+ bytes_received += nbytes;
+
+ // increment the pointer
+ out += nbytes;
+
+ // Immediately return when data comes in
+ break;
+ }
+
+ #if SNK_VERBOSE
+ printf("\tbytes received: %d bytes (nbytes: %d)\n", bytes, nbytes);
+ #endif
+ }
+
+ #if SRC_VERBOSE
+ printf("Total Bytes Received: %d (bytes_received / noutput_items = %d / %d)\n",
+ bytes_received, bytes_received, noutput_items);
+ #endif
+
+ // bytes_received is already set to some integer multiple of itemsize
+ return bytes_received/d_itemsize;
+}
+
+// Return port number of d_socket
+int gr_udp_source::get_port(void)
+{
+ sockaddr_in name;
+ socklen_t len = sizeof(name);
+ int ret = getsockname( d_socket, (sockaddr*)&name, &len );
+ if( ret ) {
+ report_error("gr_udp_source/getsockname",NULL);
+ return -1;
+ }
+ return ntohs(name.sin_port);
+}
diff --git a/gnuradio-core/src/lib/io/gr_udp_source.h b/gnuradio-core/src/lib/io/gr_udp_source.h
new file mode 100644
index 000000000..56dcb3c0a
--- /dev/null
+++ b/gnuradio-core/src/lib/io/gr_udp_source.h
@@ -0,0 +1,110 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007,2008,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.
+ */
+
+#ifndef INCLUDED_GR_UDP_SOURCE_H
+#define INCLUDED_GR_UDP_SOURCE_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+#include <gruel/thread.h>
+
+class gr_udp_source;
+typedef boost::shared_ptr<gr_udp_source> gr_udp_source_sptr;
+
+GR_CORE_API gr_udp_source_sptr gr_make_udp_source(size_t itemsize, const char *host,
+ unsigned short port,
+ int payload_size=1472,
+ bool eof=true, bool wait=true);
+
+/*!
+ * \brief Read stream from an UDP socket.
+ * \ingroup source_blk
+ *
+ * \param itemsize The size (in bytes) of the item datatype
+ * \param host The name or IP address of the receiving host; can be
+ * NULL, None, or "0.0.0.0" to allow reading from any
+ * interface on the host
+ * \param port The port number on which to receive data; use 0 to
+ * have the system assign an unused port number
+ * \param payload_size UDP payload size by default set to 1472 =
+ * (1500 MTU - (8 byte UDP header) - (20 byte IP header))
+ * \param eof Interpret zero-length packet as EOF (default: true)
+ * \param wait Wait for data if not immediately available
+ * (default: true)
+ *
+*/
+
+class GR_CORE_API gr_udp_source : public gr_sync_block
+{
+ friend GR_CORE_API gr_udp_source_sptr gr_make_udp_source(size_t itemsize,
+ const char *host,
+ unsigned short port,
+ int payload_size,
+ bool eof, bool wait);
+
+ private:
+ size_t d_itemsize;
+ int d_payload_size; // maximum transmission unit (packet length)
+ bool d_eof; // zero-length packet is EOF
+ bool d_wait; // wait if data if not immediately available
+ int d_socket; // handle to socket
+ char *d_temp_buff; // hold buffer between calls
+ ssize_t d_residual; // hold information about number of bytes stored in the temp buffer
+ size_t d_temp_offset; // point to temp buffer location offset
+
+ protected:
+ /*!
+ * \brief UDP Source Constructor
+ *
+ * \param itemsize The size (in bytes) of the item datatype
+ * \param host The name or IP address of the receiving host; can be
+ * NULL, None, or "0.0.0.0" to allow reading from any
+ * interface on the host
+ * \param port The port number on which to receive data; use 0 to
+ * have the system assign an unused port number
+ * \param payload_size UDP payload size by default set to 1472 =
+ * (1500 MTU - (8 byte UDP header) - (20 byte IP header))
+ * \param eof Interpret zero-length packet as EOF (default: true)
+ * \param wait Wait for data if not immediately available
+ * (default: true)
+ */
+ gr_udp_source(size_t itemsize, const char *host, unsigned short port,
+ int payload_size, bool eof, bool wait);
+
+ public:
+ ~gr_udp_source();
+
+ /*! \brief return the PAYLOAD_SIZE of the socket */
+ int payload_size() { return d_payload_size; }
+
+ /*! \brief return the port number of the socket */
+ int get_port();
+
+ // should we export anything else?
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+
+#endif /* INCLUDED_GR_UDP_SOURCE_H */
diff --git a/gnuradio-core/src/lib/io/gr_udp_source.i b/gnuradio-core/src/lib/io/gr_udp_source.i
new file mode 100644
index 000000000..18823a356
--- /dev/null
+++ b/gnuradio-core/src/lib/io/gr_udp_source.i
@@ -0,0 +1,41 @@
+/* -*- 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,udp_source)
+
+gr_udp_source_sptr
+gr_make_udp_source (size_t itemsize, const char *host,
+ unsigned short port, int payload_size=1472,
+ bool eof=true, bool wait=true) throw (std::runtime_error);
+
+class gr_udp_source : public gr_sync_block
+{
+ protected:
+ gr_udp_source (size_t itemsize, const char *host,
+ unsigned short port, int payload_size, bool eof, bool wait) throw (std::runtime_error);
+
+ public:
+ ~gr_udp_source ();
+
+ int payload_size() { return d_payload_size; }
+ int get_port();
+};
diff --git a/gnuradio-core/src/lib/io/gr_wavfile_sink.cc b/gnuradio-core/src/lib/io/gr_wavfile_sink.cc
new file mode 100644
index 000000000..8526032f6
--- /dev/null
+++ b/gnuradio-core/src/lib/io/gr_wavfile_sink.cc
@@ -0,0 +1,280 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2006,2007,2008,2009,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_wavfile_sink.h>
+#include <gr_io_signature.h>
+#include <gri_wavfile.h>
+#include <stdexcept>
+#include <climits>
+#include <cstring>
+#include <cmath>
+#include <fcntl.h>
+#include <gruel/thread.h>
+#include <boost/math/special_functions/round.hpp>
+
+// win32 (mingw/msvc) specific
+#ifdef HAVE_IO_H
+#include <io.h>
+#endif
+#ifdef O_BINARY
+#define OUR_O_BINARY O_BINARY
+#else
+#define OUR_O_BINARY 0
+#endif
+
+// should be handled via configure
+#ifdef O_LARGEFILE
+#define OUR_O_LARGEFILE O_LARGEFILE
+#else
+#define OUR_O_LARGEFILE 0
+#endif
+
+
+gr_wavfile_sink_sptr
+gr_make_wavfile_sink(const char *filename,
+ int n_channels,
+ unsigned int sample_rate,
+ int bits_per_sample)
+{
+ return gnuradio::get_initial_sptr(new gr_wavfile_sink (filename,
+ n_channels,
+ sample_rate,
+ bits_per_sample));
+}
+
+gr_wavfile_sink::gr_wavfile_sink(const char *filename,
+ int n_channels,
+ unsigned int sample_rate,
+ int bits_per_sample)
+ : gr_sync_block ("wavfile_sink",
+ gr_make_io_signature(1, n_channels, sizeof(float)),
+ gr_make_io_signature(0, 0, 0)),
+ d_sample_rate(sample_rate), d_nchans(n_channels),
+ d_fp(0), d_new_fp(0), d_updated(false)
+{
+ if (bits_per_sample != 8 && bits_per_sample != 16) {
+ throw std::runtime_error("Invalid bits per sample (supports 8 and 16)");
+ }
+ d_bytes_per_sample = bits_per_sample / 8;
+ d_bytes_per_sample_new = d_bytes_per_sample;
+
+ if (!open(filename)) {
+ throw std::runtime_error ("can't open file");
+ }
+
+ if (bits_per_sample == 8) {
+ d_max_sample_val = 0xFF;
+ d_min_sample_val = 0;
+ d_normalize_fac = d_max_sample_val/2;
+ d_normalize_shift = 1;
+ } else {
+ d_max_sample_val = 0x7FFF;
+ d_min_sample_val = -0x7FFF;
+ d_normalize_fac = d_max_sample_val;
+ d_normalize_shift = 0;
+ if (bits_per_sample != 16) {
+ fprintf(stderr, "Invalid bits per sample value requested, using 16");
+ }
+ }
+}
+
+
+bool
+gr_wavfile_sink::open(const char* filename)
+{
+ gruel::scoped_lock guard(d_mutex);
+
+ // we use the open system call to get access to the O_LARGEFILE flag.
+ int fd;
+ if ((fd = ::open (filename,
+ O_WRONLY|O_CREAT|O_TRUNC|OUR_O_LARGEFILE|OUR_O_BINARY,
+ 0664)) < 0){
+ perror (filename);
+ return false;
+ }
+
+ if (d_new_fp) { // if we've already got a new one open, close it
+ fclose(d_new_fp);
+ d_new_fp = 0;
+ }
+
+ if ((d_new_fp = fdopen (fd, "wb")) == NULL) {
+ perror (filename);
+ ::close(fd); // don't leak file descriptor if fdopen fails.
+ return false;
+ }
+ d_updated = true;
+
+ if (!gri_wavheader_write(d_new_fp,
+ d_sample_rate,
+ d_nchans,
+ d_bytes_per_sample_new)) {
+ fprintf(stderr, "[%s] could not write to WAV file\n", __FILE__);
+ exit(-1);
+ }
+
+ return true;
+}
+
+
+void
+gr_wavfile_sink::close()
+{
+ gruel::scoped_lock guard(d_mutex);
+
+ if (!d_fp)
+ return;
+
+ close_wav();
+}
+
+void gr_wavfile_sink::close_wav()
+{
+ unsigned int byte_count = d_sample_count * d_bytes_per_sample;
+
+ gri_wavheader_complete(d_fp, byte_count);
+
+ fclose(d_fp);
+ d_fp = NULL;
+}
+
+
+gr_wavfile_sink::~gr_wavfile_sink ()
+{
+ if (d_new_fp) {
+ fclose(d_new_fp);
+ }
+
+ close();
+}
+
+
+int
+gr_wavfile_sink::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ float **in = (float **) &input_items[0];
+ int n_in_chans = input_items.size();
+
+ short int sample_buf_s;
+
+ int nwritten;
+
+ gruel::scoped_lock guard(d_mutex); // hold mutex for duration of this block
+ do_update(); // update: d_fp is reqd
+ if (!d_fp) // drop output on the floor
+ return noutput_items;
+
+ for (nwritten = 0; nwritten < noutput_items; nwritten++) {
+ for (int chan = 0; chan < d_nchans; chan++) {
+ // Write zeros to channels which are in the WAV file
+ // but don't have any inputs here
+ if (chan < n_in_chans) {
+ sample_buf_s =
+ convert_to_short(in[chan][nwritten]);
+ } else {
+ sample_buf_s = 0;
+ }
+
+ gri_wav_write_sample(d_fp, sample_buf_s, d_bytes_per_sample);
+
+ if (feof(d_fp) || ferror(d_fp)) {
+ fprintf(stderr, "[%s] file i/o error\n", __FILE__);
+ close();
+ exit(-1);
+ }
+ d_sample_count++;
+ }
+ }
+
+ return nwritten;
+}
+
+
+short int
+gr_wavfile_sink::convert_to_short(float sample)
+{
+ sample += d_normalize_shift;
+ sample *= d_normalize_fac;
+ if (sample > d_max_sample_val) {
+ sample = d_max_sample_val;
+ } else if (sample < d_min_sample_val) {
+ sample = d_min_sample_val;
+ }
+
+ return (short int) boost::math::iround(sample);
+}
+
+
+void
+gr_wavfile_sink::set_bits_per_sample(int bits_per_sample)
+{
+ gruel::scoped_lock guard(d_mutex);
+ if (bits_per_sample == 8 || bits_per_sample == 16) {
+ d_bytes_per_sample_new = bits_per_sample / 8;
+ }
+}
+
+
+void
+gr_wavfile_sink::set_sample_rate(unsigned int sample_rate)
+{
+ gruel::scoped_lock guard(d_mutex);
+ d_sample_rate = sample_rate;
+}
+
+
+void
+gr_wavfile_sink::do_update()
+{
+ if (!d_updated) {
+ return;
+ }
+
+ if (d_fp) {
+ close_wav();
+ }
+
+ d_fp = d_new_fp; // install new file pointer
+ d_new_fp = 0;
+ d_sample_count = 0;
+ d_bytes_per_sample = d_bytes_per_sample_new;
+
+ if (d_bytes_per_sample == 1) {
+ d_max_sample_val = UCHAR_MAX;
+ d_min_sample_val = 0;
+ d_normalize_fac = d_max_sample_val/2;
+ d_normalize_shift = 1;
+ } else if (d_bytes_per_sample == 2) {
+ d_max_sample_val = SHRT_MAX;
+ d_min_sample_val = SHRT_MIN;
+ d_normalize_fac = d_max_sample_val;
+ d_normalize_shift = 0;
+ }
+
+ d_updated = false;
+}
diff --git a/gnuradio-core/src/lib/io/gr_wavfile_sink.h b/gnuradio-core/src/lib/io/gr_wavfile_sink.h
new file mode 100644
index 000000000..162151b7a
--- /dev/null
+++ b/gnuradio-core/src/lib/io/gr_wavfile_sink.h
@@ -0,0 +1,138 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+#ifndef INCLUDED_GR_WAVFILE_SINK_H
+#define INCLUDED_GR_WAVFILE_SINK_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+#include <gr_file_sink_base.h>
+#include <boost/thread.hpp>
+
+class gr_wavfile_sink;
+typedef boost::shared_ptr<gr_wavfile_sink> gr_wavfile_sink_sptr;
+
+/*
+ * \p filename The .wav file to be opened
+ * \p n_channels Number of channels (2 = stereo or I/Q output)
+ * \p sample_rate Sample rate [S/s]
+ * \p bits_per_sample 16 or 8 bit, default is 16
+ */
+GR_CORE_API gr_wavfile_sink_sptr
+gr_make_wavfile_sink (const char *filename,
+ int n_channels,
+ unsigned int sample_rate,
+ int bits_per_sample = 16);
+
+/*!
+ * \brief Write stream to a Microsoft PCM (.wav) file.
+ *
+ * Values must be floats within [-1;1].
+ * Check gr_make_wavfile_sink() for extra info.
+ *
+ * \ingroup sink_blk
+ */
+class GR_CORE_API gr_wavfile_sink : public gr_sync_block
+{
+private:
+ friend GR_CORE_API gr_wavfile_sink_sptr gr_make_wavfile_sink (const char *filename,
+ int n_channels,
+ unsigned int sample_rate,
+ int bits_per_sample);
+
+ gr_wavfile_sink(const char *filename,
+ int n_channels,
+ unsigned int sample_rate,
+ int bits_per_sample);
+
+ unsigned d_sample_rate;
+ int d_nchans;
+ unsigned d_sample_count;
+ int d_bytes_per_sample;
+ int d_bytes_per_sample_new;
+ int d_max_sample_val;
+ int d_min_sample_val;
+ int d_normalize_shift;
+ int d_normalize_fac;
+
+ FILE *d_fp;
+ FILE *d_new_fp;
+ bool d_updated;
+ boost::mutex d_mutex;
+
+ /*!
+ * \brief Convert a sample value within [-1;+1] to a corresponding
+ * short integer value
+ */
+ short convert_to_short(float sample);
+
+ /*!
+ * \brief If any file changes have occurred, update now. This is called
+ * internally by work() and thus doesn't usually need to be called by
+ * hand.
+ */
+ void do_update();
+
+ /*!
+ * \brief Writes information to the WAV header which is not available
+ * a-priori (chunk size etc.) and closes the file. Not thread-safe and
+ * assumes d_fp is a valid file pointer, should thus only be called by
+ * other methods.
+ */
+ void close_wav();
+
+public:
+ ~gr_wavfile_sink ();
+
+ /*!
+ * \brief Opens a new file and writes a WAV header. Thread-safe.
+ */
+ bool open(const char* filename);
+
+ /*!
+ * \brief Closes the currently active file and completes the WAV
+ * header. Thread-safe.
+ */
+ void close();
+
+ /*!
+ * \brief Set the sample rate. This will not affect the WAV file
+ * currently opened. Any following open() calls will use this new
+ * sample rate.
+ */
+ void set_sample_rate(unsigned int sample_rate);
+
+ /*!
+ * \brief Set bits per sample. This will not affect the WAV file
+ * currently opened (see set_sample_rate()). If the value is neither
+ * 8 nor 16, the call is ignored and the current value is kept.
+ */
+ void set_bits_per_sample(int bits_per_sample);
+
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+
+};
+
+#endif /* INCLUDED_GR_WAVFILE_SINK_H */
diff --git a/gnuradio-core/src/lib/io/gr_wavfile_sink.i b/gnuradio-core/src/lib/io/gr_wavfile_sink.i
new file mode 100644
index 000000000..48d1130bd
--- /dev/null
+++ b/gnuradio-core/src/lib/io/gr_wavfile_sink.i
@@ -0,0 +1,47 @@
+/* -*- 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.
+ */
+
+
+GR_SWIG_BLOCK_MAGIC(gr,wavfile_sink);
+
+gr_wavfile_sink_sptr
+gr_make_wavfile_sink (const char *filename,
+ int n_channels,
+ unsigned int sample_rate,
+ int bits_per_sample = 16) throw (std::runtime_error);
+
+class gr_wavfile_sink : public gr_sync_block
+{
+protected:
+ gr_wavfile_sink(const char *filename,
+ int n_channels,
+ unsigned int sample_rate,
+ int bits_per_sample) throw (std::runtime_error);
+
+public:
+ ~gr_wavfile_sink ();
+ bool open(const char* filename);
+ void close();
+ void set_sample_rate(unsigned int sample_rate);
+ void set_bits_per_sample(int bits_per_sample);
+};
+
diff --git a/gnuradio-core/src/lib/io/gr_wavfile_source.cc b/gnuradio-core/src/lib/io/gr_wavfile_source.cc
new file mode 100644
index 000000000..c8372868b
--- /dev/null
+++ b/gnuradio-core/src/lib/io/gr_wavfile_source.cc
@@ -0,0 +1,171 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_wavfile_source.h>
+#include <gr_io_signature.h>
+#include <gri_wavfile.h>
+#include <sys/types.h>
+#include <fcntl.h>
+#include <stdexcept>
+
+// win32 (mingw/msvc) specific
+#ifdef HAVE_IO_H
+#include <io.h>
+#endif
+#ifdef O_BINARY
+#define OUR_O_BINARY O_BINARY
+#else
+#define OUR_O_BINARY 0
+#endif
+// should be handled via configure
+#ifdef O_LARGEFILE
+#define OUR_O_LARGEFILE O_LARGEFILE
+#else
+#define OUR_O_LARGEFILE 0
+#endif
+
+
+gr_wavfile_source_sptr
+gr_make_wavfile_source (const char *filename, bool repeat)
+{
+ return gnuradio::get_initial_sptr(new gr_wavfile_source (filename, repeat));
+}
+
+
+gr_wavfile_source::gr_wavfile_source (const char *filename, bool repeat)
+ : gr_sync_block ("wavfile_source",
+ gr_make_io_signature (0, 0, 0),
+ gr_make_io_signature (1, 2, sizeof(float))),
+ d_fp(NULL), d_repeat(repeat),
+ d_sample_rate(1), d_nchans(1), d_bytes_per_sample(2), d_first_sample_pos(0),
+ d_samples_per_chan(0), d_sample_idx(0)
+{
+ // we use "open" to use to the O_LARGEFILE flag
+
+ int fd;
+ if ((fd = open (filename, O_RDONLY | OUR_O_LARGEFILE | OUR_O_BINARY)) < 0) {
+ perror (filename);
+ throw std::runtime_error ("can't open file");
+ }
+
+ if ((d_fp = fdopen (fd, "rb")) == NULL) {
+ perror (filename);
+ throw std::runtime_error ("can't open file");
+ }
+
+ // Scan headers, check file validity
+ if (!gri_wavheader_parse(d_fp,
+ d_sample_rate,
+ d_nchans,
+ d_bytes_per_sample,
+ d_first_sample_pos,
+ d_samples_per_chan)) {
+ throw std::runtime_error("is not a valid wav file");
+ }
+
+ if (d_samples_per_chan == 0) {
+ throw std::runtime_error("WAV file does not contain any samples");
+ }
+
+ if (d_bytes_per_sample == 1) {
+ d_normalize_fac = 128;
+ d_normalize_shift = 1;
+ } else {
+ d_normalize_fac = 0x7FFF;
+ d_normalize_shift = 0;
+ }
+
+ // Re-set the output signature
+ set_output_signature(gr_make_io_signature(1, d_nchans, sizeof(float)));
+}
+
+
+gr_wavfile_source::~gr_wavfile_source ()
+{
+ fclose(d_fp);
+}
+
+
+int
+gr_wavfile_source::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ float **out = (float **) &output_items[0];
+ int n_out_chans = output_items.size();
+
+ int i;
+ short sample;
+
+ for (i = 0; i < noutput_items; i++) {
+ if (d_sample_idx >= d_samples_per_chan) {
+ if (!d_repeat) {
+ // if nothing was read at all, say we're done.
+ return i ? i : -1;
+ }
+
+ if (fseek (d_fp, d_first_sample_pos, SEEK_SET) == -1) {
+ fprintf(stderr, "[%s] fseek failed\n", __FILE__);
+ exit(-1);
+ }
+
+ d_sample_idx = 0;
+ }
+
+ for (int chan = 0; chan < d_nchans; chan++) {
+ sample = gri_wav_read_sample(d_fp, d_bytes_per_sample);
+
+ if (chan < n_out_chans) {
+ out[chan][i] = convert_to_float(sample);
+ }
+ }
+
+ d_sample_idx++;
+
+ // OK, EOF is not necessarily an error. But we're not going to
+ // deal with handling corrupt wav files, so if they give us any
+ // trouble they won't be processed. Serves them bloody right.
+ if (feof(d_fp) || ferror(d_fp)) {
+ if (i == 0) {
+ fprintf(stderr, "[%s] WAV file has corrupted header or i/o error\n", __FILE__);
+ return -1;
+ }
+ return i;
+ }
+ }
+
+ return noutput_items;
+}
+
+
+float
+gr_wavfile_source::convert_to_float(short int sample)
+{
+ float sample_out = (float) sample;
+ sample_out /= d_normalize_fac;
+ sample_out -= d_normalize_shift;
+ return sample_out;
+}
diff --git a/gnuradio-core/src/lib/io/gr_wavfile_source.h b/gnuradio-core/src/lib/io/gr_wavfile_source.h
new file mode 100644
index 000000000..02e6e3678
--- /dev/null
+++ b/gnuradio-core/src/lib/io/gr_wavfile_source.h
@@ -0,0 +1,95 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_GR_WAVFILE_SOURCE_H
+#define INCLUDED_GR_WAVFILE_SOURCE_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+#include <cstdio> // for FILE
+
+class gr_wavfile_source;
+typedef boost::shared_ptr<gr_wavfile_source> gr_wavfile_source_sptr;
+
+GR_CORE_API gr_wavfile_source_sptr
+gr_make_wavfile_source (const char *filename, bool repeat = false);
+
+/*!
+ * \brief Read stream from a Microsoft PCM (.wav) file, output floats
+ *
+ * Unless otherwise called, values are within [-1;1].
+ * Check gr_make_wavfile_source() for extra info.
+ *
+ * \ingroup source_blk
+ */
+
+class GR_CORE_API gr_wavfile_source : public gr_sync_block
+{
+private:
+ friend GR_CORE_API gr_wavfile_source_sptr gr_make_wavfile_source (const char *filename,
+ bool repeat);
+ gr_wavfile_source(const char *filename, bool repeat);
+
+ FILE *d_fp;
+ bool d_repeat;
+
+ unsigned d_sample_rate;
+ int d_nchans;
+ int d_bytes_per_sample;
+ int d_first_sample_pos;
+ unsigned d_samples_per_chan;
+ unsigned d_sample_idx;
+ int d_normalize_shift;
+ int d_normalize_fac;
+
+ /*!
+ * \brief Convert an integer sample value to a float value within [-1;1]
+ */
+ float convert_to_float(short int sample);
+
+public:
+ ~gr_wavfile_source ();
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+
+ /*!
+ * \brief Read the sample rate as specified in the wav file header
+ */
+ unsigned int sample_rate() const { return d_sample_rate; };
+
+ /*!
+ * \brief Return the number of bits per sample as specified in the wav
+ * file header. Only 8 or 16 bit are supported here.
+ */
+ int bits_per_sample() const { return d_bytes_per_sample * 8; };
+
+ /*!
+ * \brief Return the number of channels in the wav file as specified in
+ * the wav file header. This is also the max number of outputs you can
+ * have.
+ */
+ int channels() const { return d_nchans; };
+};
+
+#endif /* INCLUDED_GR_WAVFILE_SOURCE_H */
diff --git a/gnuradio-core/src/lib/io/gr_wavfile_source.i b/gnuradio-core/src/lib/io/gr_wavfile_source.i
new file mode 100644
index 000000000..5af2224f1
--- /dev/null
+++ b/gnuradio-core/src/lib/io/gr_wavfile_source.i
@@ -0,0 +1,42 @@
+/* -*- 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,wavfile_source);
+
+gr_wavfile_source_sptr
+gr_make_wavfile_source (const char *filename,
+ bool repeat = false) throw (std::runtime_error);
+
+class gr_wavfile_source : public gr_sync_block
+{
+private:
+ gr_wavfile_source(const char *filename,
+ bool repeat) throw (std::runtime_error);
+
+public:
+ ~gr_wavfile_source();
+
+ unsigned int sample_rate();
+ int bits_per_sample();
+ int channels();
+};
+
diff --git a/gnuradio-core/src/lib/io/gri_wavfile.cc b/gnuradio-core/src/lib/io/gri_wavfile.cc
new file mode 100644
index 000000000..277e6b7b0
--- /dev/null
+++ b/gnuradio-core/src/lib/io/gri_wavfile.cc
@@ -0,0 +1,251 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gri_wavfile.h>
+#include <cstring>
+#include <stdint.h>
+#include <boost/detail/endian.hpp> //BOOST_BIG_ENDIAN
+
+# define VALID_COMPRESSION_TYPE 0x0001
+
+// Basically, this is the opposite of htonx() and ntohx()
+// Define host to/from worknet (little endian) short and long
+#ifdef BOOST_BIG_ENDIAN
+
+ static inline uint16_t __gri_wav_bs16(uint16_t x)
+ {
+ return (x>>8) | (x<<8);
+ }
+
+ static inline uint32_t __gri_wav_bs32(uint32_t x)
+ {
+ return (uint32_t(__gri_wav_bs16(uint16_t(x&0xfffful)))<<16) | (__gri_wav_bs16(uint16_t(x>>16)));
+ }
+
+ #define htowl(x) __gri_wav_bs32(x)
+ #define wtohl(x) __gri_wav_bs32(x)
+ #define htows(x) __gri_wav_bs16(x)
+ #define wtohs(x) __gri_wav_bs16(x)
+
+#else
+
+ #define htowl(x) uint32_t(x)
+ #define wtohl(x) uint32_t(x)
+ #define htows(x) uint16_t(x)
+ #define wtohs(x) uint16_t(x)
+
+#endif // BOOST_BIG_ENDIAN
+
+// WAV files are always little-endian, so we need some byte switching macros
+static inline uint32_t host_to_wav(uint32_t x) { return htowl(x); }
+static inline uint16_t host_to_wav(uint16_t x) { return htows(x); }
+static inline int16_t host_to_wav(int16_t x) { return htows(x); }
+static inline uint32_t wav_to_host(uint32_t x) { return wtohl(x); }
+static inline uint16_t wav_to_host(uint16_t x) { return wtohs(x); }
+static inline int16_t wav_to_host(int16_t x) { return wtohs(x); }
+
+bool
+gri_wavheader_parse(FILE *fp,
+ unsigned int &sample_rate_o,
+ int &nchans_o,
+ int &bytes_per_sample_o,
+ int &first_sample_pos_o,
+ unsigned int &samples_per_chan_o)
+{
+ // _o variables take return values
+ char str_buf[8] = {0};
+
+ uint32_t file_size;
+ uint32_t fmt_hdr_skip;
+ uint16_t compression_type;
+ uint16_t nchans;
+ uint32_t sample_rate;
+ uint32_t avg_bytes_per_sec;
+ uint16_t block_align;
+ uint16_t bits_per_sample;
+ uint32_t chunk_size;
+
+ size_t fresult;
+
+ fresult = fread(str_buf, 1, 4, fp);
+ if (fresult != 4 || strncmp(str_buf, "RIFF", 4) || feof(fp)) {
+ return false;
+ }
+
+ fresult = fread(&file_size, 1, 4, fp);
+
+ fresult = fread(str_buf, 1, 8, fp);
+ if (fresult != 8 || strncmp(str_buf, "WAVEfmt ", 8) || feof(fp)) {
+ return false;
+ }
+
+ fresult = fread(&fmt_hdr_skip, 1, 4, fp);
+
+ fresult = fread(&compression_type, 1, 2, fp);
+ if (wav_to_host(compression_type) != VALID_COMPRESSION_TYPE) {
+ return false;
+ }
+
+ fresult = fread(&nchans, 1, 2, fp);
+ fresult = fread(&sample_rate, 1, 4, fp);
+ fresult = fread(&avg_bytes_per_sec, 1, 4, fp);
+ fresult = fread(&block_align, 1, 2, fp);
+ fresult = fread(&bits_per_sample, 1, 2, fp);
+
+ if (ferror(fp)) {
+ return false;
+ }
+
+ fmt_hdr_skip = wav_to_host(fmt_hdr_skip);
+ nchans = wav_to_host(nchans);
+ sample_rate = wav_to_host(sample_rate);
+ bits_per_sample = wav_to_host(bits_per_sample);
+
+ if (bits_per_sample != 8 && bits_per_sample != 16) {
+ return false;
+ }
+
+ fmt_hdr_skip -= 16;
+ if (fmt_hdr_skip) {
+ fseek(fp, fmt_hdr_skip, SEEK_CUR);
+ }
+
+ // data chunk
+ fresult = fread(str_buf, 1, 4, fp);
+ if (strncmp(str_buf, "data", 4)) {
+ return false;
+ }
+
+ fresult = fread(&chunk_size, 1, 4, fp);
+ if (ferror(fp)) {
+ return false;
+ }
+
+ // More byte swapping
+ chunk_size = wav_to_host(chunk_size);
+
+ // Output values
+ sample_rate_o = (unsigned) sample_rate;
+ nchans_o = (int) nchans;
+ bytes_per_sample_o = (int) (bits_per_sample / 8);
+ first_sample_pos_o = (int) ftell(fp);
+ samples_per_chan_o = (unsigned) (chunk_size / (bytes_per_sample_o * nchans));
+ return true;
+}
+
+
+short int
+gri_wav_read_sample(FILE *fp, int bytes_per_sample)
+{
+ int16_t buf_16bit;
+
+ if(!fread(&buf_16bit, bytes_per_sample, 1, fp)) {
+ return 0;
+ }
+ if(bytes_per_sample == 1) {
+ return (short) buf_16bit;
+ }
+ return (short)wav_to_host(buf_16bit);
+}
+
+
+bool
+gri_wavheader_write(FILE *fp,
+ unsigned int sample_rate,
+ int nchans,
+ int bytes_per_sample)
+{
+ const int header_len = 44;
+ char wav_hdr[header_len] = "RIFF\0\0\0\0WAVEfmt \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0data\0\0\0";
+ uint16_t nchans_f = (uint16_t) nchans;
+ uint32_t sample_rate_f = (uint32_t) sample_rate;
+ uint16_t block_align = bytes_per_sample * nchans;
+ uint32_t avg_bytes = sample_rate * block_align;
+ uint16_t bits_per_sample = bytes_per_sample * 8;
+
+ nchans_f = host_to_wav(nchans_f);
+ sample_rate_f = host_to_wav(sample_rate_f);
+ block_align = host_to_wav(block_align);
+ avg_bytes = host_to_wav(avg_bytes);
+ bits_per_sample = host_to_wav(bits_per_sample);
+
+ wav_hdr[16] = 0x10; // no extra bytes
+ wav_hdr[20] = 0x01; // no compression
+ memcpy((void *) (wav_hdr + 22), (void *) &nchans_f, 2);
+ memcpy((void *) (wav_hdr + 24), (void *) &sample_rate_f, 4);
+ memcpy((void *) (wav_hdr + 28), (void *) &avg_bytes, 4);
+ memcpy((void *) (wav_hdr + 32), (void *) &block_align, 2);
+ memcpy((void *) (wav_hdr + 34), (void *) &bits_per_sample, 2);
+
+ fwrite(&wav_hdr, 1, header_len, fp);
+ if (ferror(fp)) {
+ return false;
+ }
+
+ return true;
+}
+
+
+void
+gri_wav_write_sample(FILE *fp, short int sample, int bytes_per_sample)
+{
+ void *data_ptr;
+ unsigned char buf_8bit;
+ int16_t buf_16bit;
+
+ if (bytes_per_sample == 1) {
+ buf_8bit = (unsigned char) sample;
+ data_ptr = (void *) &buf_8bit;
+ } else {
+ buf_16bit = host_to_wav((int16_t) sample);
+ data_ptr = (void *) &buf_16bit;
+ }
+
+ fwrite(data_ptr, 1, bytes_per_sample, fp);
+}
+
+
+bool
+gri_wavheader_complete(FILE *fp, unsigned int byte_count)
+{
+ uint32_t chunk_size = (uint32_t) byte_count;
+ chunk_size = host_to_wav(chunk_size);
+
+ fseek(fp, 40, SEEK_SET);
+ fwrite(&chunk_size, 1, 4, fp);
+
+ chunk_size = (uint32_t) byte_count + 36; // fmt chunk and data header
+ chunk_size = host_to_wav(chunk_size);
+ fseek(fp, 4, SEEK_SET);
+
+ fwrite(&chunk_size, 1, 4, fp);
+
+ if (ferror(fp)) {
+ return false;
+ }
+
+ return true;
+}
diff --git a/gnuradio-core/src/lib/io/gri_wavfile.h b/gnuradio-core/src/lib/io/gri_wavfile.h
new file mode 100644
index 000000000..16280e34a
--- /dev/null
+++ b/gnuradio-core/src/lib/io/gri_wavfile.h
@@ -0,0 +1,96 @@
+/* -*- 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.
+ */
+
+// This file stores all the RIFF file type knowledge for the gr_wavfile_*
+// blocks.
+
+#include <gr_core_api.h>
+#include <cstdio>
+
+/*!
+ * \brief Read signal information from a given WAV file.
+ *
+ * \param[in] fp File pointer to an opened, empty file.
+ * \param[out] sample_rate Stores the sample rate [S/s]
+ * \param[out] nchans Number of channels
+ * \param[out] bytes_per_sample Bytes per sample, can either be 1 or 2 (corresponding o
+ * 8 or 16 bit samples, respectively)
+ * \param[out] first_sample_pos Number of the first byte containing a sample. Use this
+ * with fseek() to jump from the end of the file to the
+ * first sample when in repeat mode.
+ * \param[out] samples_per_chan Number of samples per channel
+ * \return True on a successful read, false if the file could not be read or is
+ * not a valid WAV file.
+ */
+bool
+gri_wavheader_parse(FILE *fp,
+ unsigned int &sample_rate,
+ int &nchans,
+ int &bytes_per_sample,
+ int &first_sample_pos,
+ unsigned int &samples_per_chan);
+
+
+/*!
+ * \brief Read one sample from an open WAV file at the current position.
+ *
+ * Takes care of endianness.
+ */
+short int
+gri_wav_read_sample(FILE *fp, int bytes_per_sample);
+
+
+/*!
+ * \brief Write a valid RIFF file header
+ *
+ * Note: Some header values are kept blank because they're usually not known
+ * a-priori (file and chunk lengths). Use gri_wavheader_complete() to fill
+ * these in.
+ */
+bool
+gri_wavheader_write(FILE *fp,
+ unsigned int sample_rate,
+ int nchans,
+ int bytes_per_sample);
+
+/*!
+ * \brief Write one sample to an open WAV file at the current position.
+ *
+ * Takes care of endianness.
+ */
+void
+gri_wav_write_sample(FILE *fp, short int sample, int bytes_per_sample);
+
+
+/*!
+ * \brief Complete a WAV header
+ *
+ * Note: The stream position is changed during this function. If anything
+ * needs to be written to the WAV file after calling this function (which
+ * shouldn't happen), you need to fseek() to the end of the file (or
+ * whereever).
+ *
+ * \param[in] fp File pointer to an open WAV file with a blank header
+ * \param[in] byte_count Length of all samples written to the file in bytes.
+ */
+bool
+gri_wavheader_complete(FILE *fp, unsigned int byte_count);
diff --git a/gnuradio-core/src/lib/io/i2c.cc b/gnuradio-core/src/lib/io/i2c.cc
new file mode 100644
index 000000000..02dd47b53
--- /dev/null
+++ b/gnuradio-core/src/lib/io/i2c.cc
@@ -0,0 +1,28 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2001,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 "i2c.h"
+
+i2c::~i2c ()
+{
+ // NOP
+}
diff --git a/gnuradio-core/src/lib/io/i2c.h b/gnuradio-core/src/lib/io/i2c.h
new file mode 100644
index 000000000..6b7f25a29
--- /dev/null
+++ b/gnuradio-core/src/lib/io/i2c.h
@@ -0,0 +1,49 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2001,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_I2C_H
+#define INCLUDED_I2C_H
+
+#include <gr_core_api.h>
+#include <boost/shared_ptr.hpp>
+
+class i2c;
+typedef boost::shared_ptr<i2c> i2c_sptr;
+
+/*!
+ * \brief abstract class for controlling i2c bus
+ */
+class GR_CORE_API i2c {
+ public:
+
+ i2c () {}
+ virtual ~i2c ();
+
+ //! \returns true iff successful
+ virtual bool write (int addr, const unsigned char *buf, int nbytes) = 0;
+
+ //! \returns number of bytes read or -1 if error
+ virtual int read (int addr, unsigned char *buf, int max_bytes) = 0;
+};
+
+#endif /* INCLUDED_I2C_H */
+
diff --git a/gnuradio-core/src/lib/io/i2c_bbio.cc b/gnuradio-core/src/lib/io/i2c_bbio.cc
new file mode 100644
index 000000000..ddd00290d
--- /dev/null
+++ b/gnuradio-core/src/lib/io/i2c_bbio.cc
@@ -0,0 +1,29 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2001,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 "i2c_bbio.h"
+
+i2c_bbio::~i2c_bbio ()
+{
+ // NOP
+}
+
diff --git a/gnuradio-core/src/lib/io/i2c_bbio.h b/gnuradio-core/src/lib/io/i2c_bbio.h
new file mode 100644
index 000000000..6bf47b9cd
--- /dev/null
+++ b/gnuradio-core/src/lib/io/i2c_bbio.h
@@ -0,0 +1,51 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2001,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_I2C_BBIO_H
+#define INCLUDED_I2C_BBIO_H
+
+#include <gr_core_api.h>
+#include <boost/shared_ptr.hpp>
+
+class i2c_bbio;
+typedef boost::shared_ptr<i2c_bbio> i2c_bbio_sptr;
+
+
+/*!
+ * \brief abstract class that implements bit banging i/o for i2c bus.
+ * \ingroup base
+ */
+class GR_CORE_API i2c_bbio {
+ public:
+
+ i2c_bbio () {}
+ virtual ~i2c_bbio ();
+
+ virtual void set_scl (bool state) = 0;
+ virtual void set_sda (bool state) = 0;
+ virtual bool get_sda () = 0;
+
+ virtual void lock () = 0;
+ virtual void unlock () = 0;
+};
+
+#endif /* INCLUDED_I2C_BBIO_H */
diff --git a/gnuradio-core/src/lib/io/i2c_bbio_pp.cc b/gnuradio-core/src/lib/io/i2c_bbio_pp.cc
new file mode 100644
index 000000000..382bb6b37
--- /dev/null
+++ b/gnuradio-core/src/lib/io/i2c_bbio_pp.cc
@@ -0,0 +1,87 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2001,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 "i2c_bbio_pp.h"
+#include "microtune_eval_board_defs.h"
+
+i2c_bbio_pp::i2c_bbio_pp (ppio_sptr pp)
+{
+ d_pp = pp;
+ d_pp->lock ();
+ d_pp->write_control (d_pp->read_control () & ~UT_CP_MUST_BE_ZERO); // output, no interrupts
+ d_pp->unlock ();
+}
+
+i2c_bbio_sptr
+make_i2c_bbio_pp (ppio_sptr pp)
+{
+ return i2c_bbio_sptr (new i2c_bbio_pp (pp));
+}
+
+void
+i2c_bbio_pp::set_scl (bool state)
+{
+ int r = d_pp->read_control();
+
+ if (!state){ // active low
+ d_pp->write_control (r | UT_CP_TUNER_SCL);
+ }
+ else {
+ d_pp->write_control (r & ~UT_CP_TUNER_SCL);
+ }
+ d_pp->read_control (); // use for 1us delay
+ d_pp->read_control (); // use for 1us delay
+}
+
+void
+i2c_bbio_pp::set_sda (bool state)
+{
+ int r = d_pp->read_data ();
+
+ if (!state){ // active low
+ d_pp->write_data (r | UT_DP_TUNER_SDA_OUT);
+ }
+ else {
+ d_pp->write_data (r & ~UT_DP_TUNER_SDA_OUT);
+ }
+ d_pp->read_data (); // use for 1us delay
+ d_pp->read_data (); // use for 1us delay
+}
+
+bool
+i2c_bbio_pp::get_sda ()
+{
+ int r = d_pp->read_status ();
+ return (r & UT_SP_TUNER_SDA_IN) == 0; // eval board has an inverter on it
+}
+
+void
+i2c_bbio_pp::lock ()
+{
+ d_pp->lock ();
+}
+
+void
+i2c_bbio_pp::unlock ()
+{
+ d_pp->unlock ();
+}
diff --git a/gnuradio-core/src/lib/io/i2c_bbio_pp.h b/gnuradio-core/src/lib/io/i2c_bbio_pp.h
new file mode 100644
index 000000000..2391bc1fc
--- /dev/null
+++ b/gnuradio-core/src/lib/io/i2c_bbio_pp.h
@@ -0,0 +1,57 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2001,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_I2C_BBIO_PP_H
+#define INCLUDED_I2C_BBIO_PP_H
+
+#include <gr_core_api.h>
+#include "i2c_bbio.h"
+#include "ppio.h"
+
+/*!
+ * \brief concrete class that bit bangs eval board i2c bus using parallel port
+ *
+ * \ingroup base
+ * This class talks to the i2c bus on the microtune eval board using
+ * the parallel port. This works for both the 4937 and 4702 boards.
+ */
+class GR_CORE_API i2c_bbio_pp : public i2c_bbio {
+ friend GR_CORE_API i2c_bbio_sptr make_i2c_bbio_pp (ppio_sptr pp);
+ i2c_bbio_pp (ppio_sptr pp);
+
+ public:
+
+ virtual void set_scl (bool state);
+ virtual void set_sda (bool state);
+ virtual bool get_sda ();
+
+ virtual void lock ();
+ virtual void unlock ();
+
+ private:
+ ppio_sptr d_pp;
+};
+
+GR_CORE_API i2c_bbio_sptr make_i2c_bbio_pp (ppio_sptr pp);
+
+
+#endif /* INCLUDED_I2C_BBIO_PP_H */
diff --git a/gnuradio-core/src/lib/io/i2c_bitbang.cc b/gnuradio-core/src/lib/io/i2c_bitbang.cc
new file mode 100644
index 000000000..eb801c68f
--- /dev/null
+++ b/gnuradio-core/src/lib/io/i2c_bitbang.cc
@@ -0,0 +1,144 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2001,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 "i2c_bitbang.h"
+
+i2c_bitbang::i2c_bitbang (i2c_bbio_sptr io)
+{
+ d_io = io;
+ d_io->lock ();
+
+ stop (); // get bus in known state
+
+ d_io->unlock ();
+}
+
+i2c_sptr
+make_i2c_bitbang (i2c_bbio_sptr io)
+{
+ return i2c_sptr (new i2c_bitbang (io));
+}
+
+
+// start:
+// entry: SCL = 1, SDA = 1
+// exit: SCL = 0, SDA = 0
+
+void
+i2c_bitbang::start ()
+{
+ set_sda (1);
+ set_scl (1);
+ set_sda (0); // SDA high -> low while SCL high
+ set_scl (0);
+}
+
+
+// stop:
+// entry: SCL = X, SDA = X
+// exit: SCL = 1, SDA = 1
+
+void
+i2c_bitbang::stop ()
+{
+ set_scl (0);
+ set_sda (0);
+ set_scl (1);
+ set_sda (1); // SDA low -> high while SCL high
+}
+
+
+// write_bit:
+// entry: SCL = 0, SDA = X
+// exit: SCL = 0, SDA = X
+
+void
+i2c_bitbang::write_bit (bool bit)
+{
+ set_sda (bit);
+ set_scl (1);
+ set_scl (0);
+}
+
+
+// write_byte:
+// entry: SCL = 0, SDA = X
+// exit: SCL = 0, SDA = 1
+
+bool
+i2c_bitbang::write_byte (char t)
+{
+ int i;
+ bool ack_bit;
+
+ for (i = 0; i < 8; i++){
+ write_bit (t & 0x80);
+ t <<= 1;
+ }
+
+ // clock #9. This is the ACK bit.
+
+ set_sda (1); // tristate SDA
+ set_scl (1);
+ ack_bit = get_sda (); // slave should pull SDA line low
+ set_scl (0);
+
+ return ack_bit == 0;
+}
+
+
+// write: the high level entry point...
+// entry: SCL = 1, SDA = 1
+// exit: SCL = 1, SDA = 1
+
+bool
+i2c_bitbang::write (int addr, const unsigned char *buf, int nbytes)
+{
+ bool ok = true;
+
+ d_io->lock ();
+ start ();
+ ok = write_byte ((addr << 1) | 0); // addr plus "read opcode"
+
+ for (int i = 0; i < nbytes; i++)
+ ok &= write_byte (buf[i]);
+
+ stop ();
+ d_io->unlock ();
+ return ok;
+}
+
+
+// read: the high level entry point...
+// entry: SCL = 1, SDA = 1
+// exit: SCL = 1, SDA = 1
+
+int
+i2c_bitbang::read (int addr, unsigned char *buf, int max_bytes)
+{
+ d_io->lock ();
+
+ // FIXME
+
+ d_io->unlock ();
+ return -1;
+}
diff --git a/gnuradio-core/src/lib/io/i2c_bitbang.h b/gnuradio-core/src/lib/io/i2c_bitbang.h
new file mode 100644
index 000000000..1d6fe5044
--- /dev/null
+++ b/gnuradio-core/src/lib/io/i2c_bitbang.h
@@ -0,0 +1,65 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2001,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_I2C_BITBANG_H
+#define INCLUDED_I2C_BITBANG_H
+
+#include <gr_core_api.h>
+#include <i2c.h>
+#include <i2c_bbio.h>
+
+/*!
+ * \brief class for controlling i2c bus
+ * \ingroup base
+ */
+class GR_CORE_API i2c_bitbang : public i2c {
+ friend GR_CORE_API i2c_sptr make_i2c_bitbang (i2c_bbio_sptr io);
+ i2c_bitbang (i2c_bbio_sptr io);
+
+ public:
+ ~i2c_bitbang () {}
+
+ //! \returns true iff successful
+ bool write (int addr, const unsigned char *buf, int nbytes);
+
+ //! \returns number of bytes read or -1 if error
+ int read (int addr, unsigned char *buf, int max_bytes);
+
+
+private:
+ void start ();
+ void stop ();
+ void write_bit (bool bit);
+ bool write_byte (char byte);
+
+ void set_sda (bool bit) { d_io->set_sda (bit); }
+ void set_scl (bool bit) { d_io->set_scl (bit); }
+ bool get_sda () { return d_io->get_sda (); }
+
+ i2c_bbio_sptr d_io;
+};
+
+GR_CORE_API i2c_sptr make_i2c_bitbang (i2c_bbio_sptr io);
+
+#endif /* INCLUDED_I2C_BITBANG_H */
+
+
diff --git a/gnuradio-core/src/lib/io/io.i b/gnuradio-core/src/lib/io/io.i
new file mode 100644
index 000000000..e2de4eb97
--- /dev/null
+++ b/gnuradio-core/src/lib/io/io.i
@@ -0,0 +1,83 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,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.
+ */
+
+%{
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_file_sink.h>
+#include <gr_file_source.h>
+#include <gr_file_descriptor_sink.h>
+#include <gr_file_descriptor_source.h>
+#include <gr_histo_sink_f.h>
+#include <microtune_4702_eval_board.h>
+#include <microtune_4937_eval_board.h>
+#include <sdr_1000.h>
+#include <gr_oscope_sink_x.h>
+#include <gr_oscope_sink_f.h>
+#include <ppio.h>
+#include <gr_message_source.h>
+#include <gr_message_burst_source.h>
+#include <gr_message_sink.h>
+#include <gr_udp_sink.h>
+#include <gr_udp_source.h>
+#include <gr_wavfile_sink.h>
+#include <gr_wavfile_source.h>
+#include <gr_tagged_file_sink.h>
+#include <gr_pdu_to_tagged_stream.h>
+#include <gr_tagged_stream_to_pdu.h>
+#include <gr_message_debug.h>
+#include <gr_pdu.h>
+#include <gr_tuntap_pdu.h>
+#include <gr_socket_pdu.h>
+%}
+
+%include "gr_file_sink_base.i"
+%include "gr_file_sink.i"
+%include "gr_file_source.i"
+%include "gr_file_descriptor_sink.i"
+%include "gr_file_descriptor_source.i"
+%include "gr_histo_sink.i"
+%include "microtune_xxxx_eval_board.i"
+%include "microtune_4702_eval_board.i"
+%include "microtune_4937_eval_board.i"
+%include "sdr_1000.i"
+%include "gr_oscope_sink.i"
+%include "ppio.i"
+%include "gr_message_source.i"
+%include "gr_message_burst_source.i"
+%include "gr_message_sink.i"
+%include "gr_udp_sink.i"
+%include "gr_udp_source.i"
+%include "gr_wavfile_sink.i"
+%include "gr_wavfile_source.i"
+%include "gr_tagged_file_sink.i"
+%include "gr_pdu_to_tagged_stream.i"
+%include "gr_tagged_stream_to_pdu.i"
+%include "gr_message_debug.i"
+%include "gr_pdu.i"
+%include "gr_tuntap_pdu.i"
+%include "gr_socket_pdu.i"
+
+
diff --git a/gnuradio-core/src/lib/io/microtune_4702.cc b/gnuradio-core/src/lib/io/microtune_4702.cc
new file mode 100644
index 000000000..3ec072d51
--- /dev/null
+++ b/gnuradio-core/src/lib/io/microtune_4702.cc
@@ -0,0 +1,183 @@
+/* -*- c++-*- */
+/*
+ * Copyright 2001,2003,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 "microtune_4702.h"
+#include <stdlib.h>
+#include <stdio.h>
+#include "i2c.h"
+
+static const double FIRST_IF = 36.00e6;
+
+// The tuner internally has 3 bands: VHF Low, VHF High & UHF.
+// These are the recommened boundaries
+static const double VHF_High_takeover = 174e6;
+static const double UHF_takeover = 470e6;
+
+static int PLL_I2C_ADDR = 0x60;
+
+static unsigned char
+control_byte_1 (bool prescaler, int reference_divisor)
+{
+ int c = 0x80;
+ //Note: Last two divider bits (bits 2 and 3 of this byte) determined later
+ if (prescaler)
+ c |= 0x10;
+
+ switch (reference_divisor){
+ case 2:
+ c |= 0x00; break;
+ case 4:
+ c |= 0x01; break;
+ case 8:
+ c |= 0x02; break;
+ case 16:
+ c |= 0x03; break;
+ case 32:
+ c |= 0x04; break;
+ case 64:
+ c |= 0x05; break;
+ case 128:
+ c |= 0x06; break;
+ case 256:
+ c |= 0x07; break;
+ case 24:
+ c |= 0x08; break;
+ case 5:
+ c |= 0x09; break;
+ case 10:
+ c |= 0x0A; break;
+ case 20:
+ c |= 0x0B; break;
+ case 40:
+ c |= 0x0C; break;
+ case 80:
+ c |= 0x0D; break;
+ case 160:
+ c |= 0x0E; break;
+ case 320:
+ c |= 0x0F; break;
+ default:
+ abort ();
+ }
+ return c;
+}
+
+static unsigned char
+control_byte_2 (double target_freq)
+{
+ int c;
+
+ if (target_freq < VHF_High_takeover) // VHF low
+ c = 0x8E;
+
+ else if (target_freq < UHF_takeover){ // VHF high
+ c = 0x05;
+ if (target_freq < 390e6)
+ c |= 0x40;
+ else
+ c |= 0x80;
+ }
+ else { // UHF
+ c = 0x03;
+ if (target_freq < 750e6)
+ c |= 0x80;
+ else
+ c |= 0xC0;
+ }
+
+ return c;
+}
+
+
+microtune_4702::microtune_4702 (i2c_sptr i2c, int i2c_addr)
+{
+ d_i2c = i2c;
+ d_i2c_addr = i2c_addr;
+ d_reference_divider = 320;
+ d_prescaler = false;
+}
+
+microtune_4702::~microtune_4702 ()
+{
+ // nop
+}
+
+/*!
+ * \brief select RF frequency to be tuned to output frequency.
+ * \p target_freq is the requested frequency in Hz, \p actual_freq
+ * is set to the actual frequency tuned. It takes about 100 ms
+ * for the PLL to settle.
+ *
+ * \returns true iff sucessful.
+ */
+bool
+microtune_4702::set_RF_freq (double target_freq, double *p_actual_freq)
+{
+ unsigned char buf[4];
+
+ double target_f_osc = target_freq + FIRST_IF;
+
+ double f_ref = 4e6 / d_reference_divider;
+
+ //int divisor = (int) ((target_f_osc + (f_ref * 4)) / (f_ref * 8));
+
+ long int divisor = (long int) (target_f_osc / f_ref);
+ double actual_freq = (f_ref * divisor) - FIRST_IF;
+ if (p_actual_freq != 0)
+ *p_actual_freq = actual_freq;
+
+ if ((divisor & ~0x1ffff) != 0) // >17 bit divisor
+ return false;
+
+ buf[0] = ((divisor & 0x07f00) >> 8) & 0xff; // DB1
+ buf[1] = divisor & 0xff; // DB2
+ buf[2] = control_byte_1 (d_prescaler, d_reference_divider);
+ buf[2] = buf[2] | (((divisor & 0x18000) >> 10) & 0xff);
+ buf[3] = control_byte_2 (target_freq);
+
+ printf ("%x\n", PLL_I2C_ADDR);
+//#if 0
+ printf ("set_RF_freq: target: %g MHz actual: %g MHz %02x %02x %02x %02x\n",
+ target_freq/1e6, actual_freq/1e6, buf[0], buf[1], buf[2], buf[3]);
+//#endif
+
+ return d_i2c->write (d_i2c_addr, buf, sizeof (buf));
+}
+
+/*!
+ * \returns true iff PLL is locked
+ */
+bool
+microtune_4702::pll_locked_p ()
+{
+ // FIXME
+ return true;
+}
+
+/*!
+ * \returns the output frequency of the tuner in Hz.
+ */
+double
+microtune_4702::get_output_freq ()
+{
+ return FIRST_IF;
+}
diff --git a/gnuradio-core/src/lib/io/microtune_4702.h b/gnuradio-core/src/lib/io/microtune_4702.h
new file mode 100644
index 000000000..ccc66db71
--- /dev/null
+++ b/gnuradio-core/src/lib/io/microtune_4702.h
@@ -0,0 +1,71 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2001,2003 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_MICROTUNE_4702_H
+#define INCLUDED_MICROTUNE_4702_H
+
+#include <gr_core_api.h>
+#include <microtune_xxxx.h>
+
+/*!
+ * \brief class for controlling microtune 4702 tuner module
+ * \ingroup hardware
+ */
+
+class GR_CORE_API microtune_4702 : public microtune_xxxx {
+public:
+ microtune_4702 (i2c_sptr i2c, int i2c_addr);
+
+ virtual ~microtune_4702 ();
+
+ /*!
+ * \brief select RF frequency to be tuned to output frequency.
+ * \p freq is the requested frequency in Hz, \p actual_freq
+ * is set to the actual frequency tuned. It takes about 100 ms
+ * for the PLL to settle.
+ *
+ * \returns true iff sucessful.
+ */
+ bool set_RF_freq (double freq, double *actual_freq);
+
+ /*!
+ * \returns true iff PLL is locked
+ */
+ bool pll_locked_p ();
+
+ /*!
+ * \returns the output frequency of the tuner in Hz.
+ */
+ double get_output_freq ();
+
+ private:
+
+ i2c_sptr d_i2c;
+ int d_i2c_addr;
+ int d_reference_divider;
+ bool d_prescaler; /* if set, higher charge pump current:
+ faster tuning, worse phase noise
+ for distance < 10kHz to the carrier */
+};
+
+#endif /* INCLUDED_MICROTUNE_4702_H */
+
diff --git a/gnuradio-core/src/lib/io/microtune_4702_eval_board.cc b/gnuradio-core/src/lib/io/microtune_4702_eval_board.cc
new file mode 100644
index 000000000..f6c68726b
--- /dev/null
+++ b/gnuradio-core/src/lib/io/microtune_4702_eval_board.cc
@@ -0,0 +1,88 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2001,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 "microtune_4702_eval_board.h"
+#include "microtune_eval_board_defs.h"
+#include "ppio.h"
+#include "microtune_4702.h"
+
+static const int TUNER_I2C_ADDR = 0x60;
+
+microtune_4702_eval_board::microtune_4702_eval_board (int which_pp)
+ : microtune_xxxx_eval_board (which_pp)
+{
+ d_tuner = new microtune_4702 (d_i2c, TUNER_I2C_ADDR);
+}
+
+microtune_4702_eval_board::~microtune_4702_eval_board ()
+{
+ // default is OK
+}
+
+static const float RF_MIN_V = 1.0; // RF AGC control voltages
+static const float RF_MAX_V = 4.0;
+static const float IF_MIN_V = 2.0; // IF AGC control voltages
+static const float IF_MAX_V = 4.0;
+
+static const float MIN_AGC = 0; // bottom of synthetic range
+static const float MAX_AGC = 1000; // top of synthetic range
+
+static const float CUTOVER_POINT = 667;
+
+
+// linear is in the range MIN_AGC to MAX_AGC
+
+static float
+linear_to_RF_AGC_voltage (float linear)
+{
+ if (linear >= CUTOVER_POINT)
+ return RF_MAX_V;
+
+ float slope = (RF_MAX_V - RF_MIN_V) / CUTOVER_POINT;
+ return RF_MIN_V + linear * slope;
+}
+
+static float
+linear_to_IF_AGC_voltage (float linear)
+{
+ if (linear < CUTOVER_POINT)
+ return IF_MIN_V;
+
+ float slope = (IF_MAX_V - IF_MIN_V) / (MAX_AGC - CUTOVER_POINT);
+ return IF_MIN_V + (linear - CUTOVER_POINT) * slope;
+}
+
+void
+microtune_4702_eval_board::set_AGC (float v)
+{
+ if (v < MIN_AGC)
+ v = MIN_AGC;
+
+ if (v > MAX_AGC)
+ v = MAX_AGC;
+
+ float rf_agc_voltage = linear_to_RF_AGC_voltage (v);
+ float if_agc_voltage = linear_to_IF_AGC_voltage (v);
+
+ set_RF_AGC_voltage (rf_agc_voltage);
+ set_IF_AGC_voltage (if_agc_voltage);
+}
diff --git a/gnuradio-core/src/lib/io/microtune_4702_eval_board.h b/gnuradio-core/src/lib/io/microtune_4702_eval_board.h
new file mode 100644
index 000000000..d866a4b94
--- /dev/null
+++ b/gnuradio-core/src/lib/io/microtune_4702_eval_board.h
@@ -0,0 +1,49 @@
+/* -*- C++ -*- */
+/*
+ * Copyright 2001,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_MICROTUNE_4702_EVAL_BOARD_H
+#define INCLUDED_MICROTUNE_4702_EVAL_BOARD_H
+
+#include <gr_core_api.h>
+#include "microtune_xxxx_eval_board.h"
+
+/*!
+ * \brief control microtune 4702 eval board
+ * \ingroup hardware
+ */
+
+class GR_CORE_API microtune_4702_eval_board : public microtune_xxxx_eval_board {
+public:
+ microtune_4702_eval_board (int which_pp = 0);
+ ~microtune_4702_eval_board ();
+
+ /*!
+ * \brief set RF and IF AGC levels together (scale [0, 1000])
+ *
+ * This provides a simple linear interface for adjusting both
+ * the RF and IF gain in consort. This is the easy to use interface.
+ * 0 corresponds to minimum gain. 1000 corresponds to maximum gain.
+ */
+ virtual void set_AGC (float value_0_1000);
+};
+
+#endif /* INCLUDED_MICROTUNE_4702_EVAL_BOARD_H */
diff --git a/gnuradio-core/src/lib/io/microtune_4702_eval_board.i b/gnuradio-core/src/lib/io/microtune_4702_eval_board.i
new file mode 100644
index 000000000..fc085a975
--- /dev/null
+++ b/gnuradio-core/src/lib/io/microtune_4702_eval_board.i
@@ -0,0 +1,36 @@
+/* -*- C++ -*- */
+/*
+ * Copyright 2001,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.
+ */
+
+class microtune_4702_eval_board : public microtune_xxxx_eval_board {
+public:
+ microtune_4702_eval_board (int which_pp = 0);
+ ~microtune_4702_eval_board ();
+
+ /*!
+ * \brief set RF and IF AGC levels together (scale [0, 1000])
+ *
+ * This provides a simple linear interface for adjusting both
+ * the RF and IF gain in consort. This is the easy to use interface.
+ * 0 corresponds to minimum gain. 1000 corresponds to maximum gain.
+ */
+ virtual void set_AGC (float value_0_1000);
+};
diff --git a/gnuradio-core/src/lib/io/microtune_4937.cc b/gnuradio-core/src/lib/io/microtune_4937.cc
new file mode 100644
index 000000000..72ddd4bb6
--- /dev/null
+++ b/gnuradio-core/src/lib/io/microtune_4937.cc
@@ -0,0 +1,146 @@
+/* -*- c++-*- */
+/*
+ * Copyright 2001,2003 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 "microtune_4937.h"
+#include <stdlib.h>
+#include <stdio.h>
+#include <i2c.h>
+
+static const double first_IF = 43.75e6;
+
+// The tuner internally has 3 bands: VHF Low, VHF High & UHF.
+// These are the recommened boundaries
+static const double VHF_High_takeover = 158e6;
+static const double UHF_takeover = 464e6;
+
+
+static unsigned char
+control_byte_1 (bool fast_tuning_p, int reference_divisor)
+{
+ int c = 0x88;
+
+ if (fast_tuning_p)
+ c |= 0x40;
+
+ switch (reference_divisor){
+ case 512:
+ c |= 0x3 << 1; break;
+ case 640:
+ c |= 0x0 << 1; break;
+ case 1024:
+ c |= 0x1 << 1; break;
+ default:
+ abort ();
+ }
+ return c;
+}
+
+static unsigned char
+control_byte_2 (double target_freq, bool shutdown_tx_PGA)
+{
+ int c;
+
+ if (target_freq < VHF_High_takeover) // VHF low
+ c = 0xa0;
+ else if (target_freq < UHF_takeover) // VHF high
+ c = 0x90;
+ else // UHF
+ c = 0x30;
+
+ if (shutdown_tx_PGA)
+ c |= 0x08;
+
+ return c;
+}
+
+microtune_4937::microtune_4937 (i2c_sptr i2c, int i2c_addr)
+{
+ d_i2c = i2c;
+ d_i2c_addr = i2c_addr;
+ d_reference_divider = 640;
+ d_fast_tuning_p = false;
+}
+
+microtune_4937::~microtune_4937 ()
+{
+ // nop
+}
+
+/*!
+ * \brief select RF frequency to be tuned to output frequency.
+ * \p target_freq is the requested frequency in Hz, \p actual_freq
+ * is set to the actual frequency tuned. It takes about 100 ms
+ * for the PLL to settle.
+ *
+ * \returns true iff sucessful.
+ */
+bool
+microtune_4937::set_RF_freq (double target_freq, double *p_actual_freq)
+{
+ unsigned char buf[4];
+
+ double target_f_osc = target_freq + first_IF;
+
+ double f_ref = 4e6 / d_reference_divider;
+
+ // f_osc = f_ref * 8 * divisor
+ // divisor = f_osc / (f_ref * 8)
+
+ int divisor = (int) ((target_f_osc + (f_ref * 4)) / (f_ref * 8));
+ double actual_freq = (f_ref * 8 * divisor) - first_IF;
+ if (p_actual_freq != 0)
+ *p_actual_freq = actual_freq;
+
+ if ((divisor & ~0x7fff) != 0) // 15 bit divisor
+ return false;
+
+ buf[0] = (divisor >> 8) & 0xff; // DB1
+ buf[1] = divisor & 0xff; // DB2
+ buf[2] = control_byte_1 (d_fast_tuning_p, d_reference_divider);
+ buf[3] = control_byte_2 (target_freq, true);
+
+#if 0
+ printf ("set_RF_freq: target: %g MHz actual: %g MHz %02x %02x %02x %02x\n",
+ target_freq/1e6, actual_freq/1e6, buf[0], buf[1], buf[2], buf[3]);
+#endif
+
+ return d_i2c->write (d_i2c_addr, buf, 4);
+}
+
+/*!
+ * \returns true iff PLL is locked
+ */
+bool
+microtune_4937::pll_locked_p ()
+{
+ // FIXME
+ return true;
+}
+
+/*!
+ * \returns the output frequency of the tuner in Hz.
+ */
+double
+microtune_4937::get_output_freq ()
+{
+ return 5.75e6; // 3x7702
+}
diff --git a/gnuradio-core/src/lib/io/microtune_4937.h b/gnuradio-core/src/lib/io/microtune_4937.h
new file mode 100644
index 000000000..be8657c95
--- /dev/null
+++ b/gnuradio-core/src/lib/io/microtune_4937.h
@@ -0,0 +1,68 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2001,2003 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_MICROTUNE_4937_H
+#define INCLUDED_MICROTUNE_4937_H
+
+#include <gr_core_api.h>
+#include <microtune_xxxx.h>
+
+/*!
+ * \brief class for controlling microtune 4937 tuner module
+ * \ingroup hardware
+ */
+class GR_CORE_API microtune_4937 : public microtune_xxxx {
+public:
+ microtune_4937 (i2c_sptr i2c, int i2c_addr = 0x61);
+ virtual ~microtune_4937 ();
+
+ /*!
+ * \brief select RF frequency to be tuned to output frequency.
+ * \p freq is the requested frequency in Hz, \p actual_freq
+ * is set to the actual frequency tuned. It takes about 100 ms
+ * for the PLL to settle.
+ *
+ * \returns true iff sucessful.
+ */
+ bool set_RF_freq (double freq, double *actual_freq);
+
+ /*!
+ * \returns true iff PLL is locked
+ */
+ bool pll_locked_p ();
+
+ /*!
+ * \returns the output frequency (IF center freq) of the tuner in Hz.
+ */
+ double get_output_freq ();
+
+ private:
+
+ i2c_sptr d_i2c;
+ int d_i2c_addr;
+ int d_reference_divider;
+ bool d_fast_tuning_p; /* if set, higher charge pump current:
+ faster tuning, worse phase noise
+ for distance < 10kHz to the carrier */
+};
+
+#endif /* INCLUDED_MICROTUNE_4937_H */
diff --git a/gnuradio-core/src/lib/io/microtune_4937_eval_board.cc b/gnuradio-core/src/lib/io/microtune_4937_eval_board.cc
new file mode 100644
index 000000000..a25b8addf
--- /dev/null
+++ b/gnuradio-core/src/lib/io/microtune_4937_eval_board.cc
@@ -0,0 +1,97 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2001,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 "microtune_4937_eval_board.h"
+#include "microtune_eval_board_defs.h"
+#include "ppio.h"
+#include "microtune_4937.h"
+
+static const int TUNER_I2C_ADDR = 0x61;
+
+microtune_4937_eval_board::microtune_4937_eval_board (int which_pp)
+ : microtune_xxxx_eval_board (which_pp)
+{
+ d_tuner = new microtune_4937 (d_i2c, TUNER_I2C_ADDR);
+
+ // disable upstream amplifier
+ d_ppio->lock ();
+ int t = d_ppio->read_data ();
+ t &= ~(UT_DP_TX_ENABLE | UT_DP_TX_SDA | UT_DP_TX_SCL);
+ t |= UT_DP_TX_AS;
+ d_ppio->write_data (t);
+ d_ppio->unlock ();
+}
+
+microtune_4937_eval_board::~microtune_4937_eval_board ()
+{
+ // Default action is OK
+}
+
+
+static const float RF_MIN_V = 1.5; // RF AGC control voltages
+static const float RF_MAX_V = 4.0;
+static const float IF_MIN_V = 2.0; // IF AGC control voltages
+static const float IF_MAX_V = 4.0;
+
+static const float MIN_AGC = 0; // bottom of synthetic range
+static const float MAX_AGC = 1000; // top of synthetic range
+
+static const float CUTOVER_POINT = 667;
+
+
+// linear is in the range MIN_AGC to MAX_AGC
+
+static float
+linear_to_RF_AGC_voltage (float linear)
+{
+ if (linear >= CUTOVER_POINT)
+ return RF_MAX_V;
+
+ float slope = (RF_MAX_V - RF_MIN_V) / CUTOVER_POINT;
+ return RF_MIN_V + linear * slope;
+}
+
+static float
+linear_to_IF_AGC_voltage (float linear)
+{
+ if (linear < CUTOVER_POINT)
+ return IF_MIN_V;
+
+ float slope = (IF_MAX_V - IF_MIN_V) / (MAX_AGC - CUTOVER_POINT);
+ return IF_MIN_V + (linear - CUTOVER_POINT) * slope;
+}
+
+void
+microtune_4937_eval_board::set_AGC (float v)
+{
+ if (v < MIN_AGC)
+ v = MIN_AGC;
+
+ if (v > MAX_AGC)
+ v = MAX_AGC;
+
+ float rf_agc_voltage = linear_to_RF_AGC_voltage (v);
+ float if_agc_voltage = linear_to_IF_AGC_voltage (v);
+
+ set_RF_AGC_voltage (rf_agc_voltage);
+ set_IF_AGC_voltage (if_agc_voltage);
+}
diff --git a/gnuradio-core/src/lib/io/microtune_4937_eval_board.h b/gnuradio-core/src/lib/io/microtune_4937_eval_board.h
new file mode 100644
index 000000000..3abd9084e
--- /dev/null
+++ b/gnuradio-core/src/lib/io/microtune_4937_eval_board.h
@@ -0,0 +1,50 @@
+/* -*- C++ -*- */
+/*
+ * Copyright 2001,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_MICROTUNE_4937_EVAL_BOARD_H
+#define INCLUDED_MICROTUNE_4937_EVAL_BOARD_H
+
+#include <gr_core_api.h>
+#include "microtune_xxxx_eval_board.h"
+
+/*!
+ * \brief control microtune 4937 eval board
+ * \ingroup hardware
+ */
+
+class GR_CORE_API microtune_4937_eval_board : public microtune_xxxx_eval_board {
+public:
+ microtune_4937_eval_board (int which_pp = 0);
+ ~microtune_4937_eval_board ();
+
+ /*!
+ * \brief set RF and IF AGC levels together (scale [0, 1000])
+ *
+ * This provides a simple linear interface for adjusting both
+ * the RF and IF gain in consort. This is the easy to use interface.
+ * 0 corresponds to minimum gain. 1000 corresponds to maximum gain.
+ */
+ virtual void set_AGC (float value_0_1000);
+};
+
+
+#endif /* INCLUDED_MICROTUNE_4937_EVAL_BOARD_H */
diff --git a/gnuradio-core/src/lib/io/microtune_4937_eval_board.i b/gnuradio-core/src/lib/io/microtune_4937_eval_board.i
new file mode 100644
index 000000000..e261416f7
--- /dev/null
+++ b/gnuradio-core/src/lib/io/microtune_4937_eval_board.i
@@ -0,0 +1,36 @@
+/* -*- C++ -*- */
+/*
+ * Copyright 2001,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.
+ */
+
+class microtune_4937_eval_board : public microtune_xxxx_eval_board {
+public:
+ microtune_4937_eval_board (int which_pp = 0);
+ ~microtune_4937_eval_board ();
+
+ /*!
+ * \brief set RF and IF AGC levels together (scale [0, 1000])
+ *
+ * This provides a simple linear interface for adjusting both
+ * the RF and IF gain in consort. This is the easy to use interface.
+ * 0 corresponds to minimum gain. 1000 corresponds to maximum gain.
+ */
+ virtual void set_AGC (float value_0_1000);
+};
diff --git a/gnuradio-core/src/lib/io/microtune_eval_board.i b/gnuradio-core/src/lib/io/microtune_eval_board.i
new file mode 100644
index 000000000..f77ef47b4
--- /dev/null
+++ b/gnuradio-core/src/lib/io/microtune_eval_board.i
@@ -0,0 +1,95 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2003 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.
+ */
+
+/*
+ * SWIG interface defs for Microtune 4937 and eval board with Eric's daughterboard
+ */
+
+/*!
+ * \brief abstract class for controlling microtune 4937 tuner module
+ */
+class microtune_4937 {
+public:
+ microtune_4937 ();
+
+ virtual ~microtune_4937 ();
+
+ // returns actual freq or 0 if error (easier interface for SWIG)
+ double set_RF_freq (double freq);
+
+ /*!
+ * \returns true iff PLL is locked
+ */
+ bool pll_locked_p ();
+
+ /*!
+ * \returns the output frequency (IF center freq) of the tuner in Hz.
+ */
+ double get_output_freq ();
+
+
+ private:
+ //! \returns true iff successful
+ virtual bool i2c_write (int addr, const unsigned char *buf, int nbytes) = 0;
+
+ //! \returns number of bytes read or -1 if error
+ virtual int i2c_read (int addr, unsigned char *buf, int max_bytes) = 0;
+
+ int d_reference_divider;
+ bool d_fast_tuning_p; /* if set, higher charge pump current:
+ faster tuning, worse phase noise
+ for distance < 10kHz to the carrier */
+};
+
+/*!
+ * \brief concrete class for controlling microtune 4937 eval board attached to parallel port
+ */
+class microtune_eval_board : public microtune_4937 {
+public:
+ microtune_eval_board (int which_pp = 0);
+ ~microtune_eval_board ();
+
+ //! is the eval board present?
+ bool board_present_p ();
+
+ /*!
+ * \brief set RF and IF AGC control voltages ([0, 5] volts)
+ */
+ void set_RF_AGC_voltage (float volts);
+ void set_IF_AGC_voltage (float volts);
+
+ /*!
+ * \brief set RF and IF AGC levels together (scale [0, 1000])
+ *
+ * This provides a simple linear interface for adjusting both
+ * the RF and IF gain in consort. This is the easy to use interface.
+ * 0 corresponds to minimum gain. 1000 corresponds to maximum gain.
+ */
+ void set_AGC (float value_0_1000);
+
+private:
+ //! \returns true iff successful
+ virtual bool i2c_write (int addr, const unsigned char *buf, int nbytes);
+
+ //! \returns number of bytes read or -1 if error
+ virtual int i2c_read (int addr, unsigned char *buf, int max_bytes);
+};
diff --git a/gnuradio-core/src/lib/io/microtune_eval_board_defs.h b/gnuradio-core/src/lib/io/microtune_eval_board_defs.h
new file mode 100644
index 000000000..61c52364f
--- /dev/null
+++ b/gnuradio-core/src/lib/io/microtune_eval_board_defs.h
@@ -0,0 +1,71 @@
+/* -*-C-*-
+*******************************************************************************
+*
+* File: microtune_eval_board_defs.h
+* Description: defines for parallel port control of eval board
+*
+*******************************************************************************
+*/
+
+/*
+ * Copyright 2001 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 _MICROTUNE_EVAL_BOARD_DEFS_H_
+#define _MICROTUNE_EVAL_BOARD_DEFS_H_
+
+/*
+ * The Microtune 4937DI5 cable modem tuner eval board is controlled
+ * by bit banging the PC parallel port. This file defines the relevant
+ * bits.
+ *
+ * The parallel port has an 8 bit data port (output),
+ * an 8 bit control port (output) and
+ * an 8 bit status port (input).
+ *
+ * Not all bits of the control and status ports may be arbitrarily used.
+ */
+
+
+// parallel port data port constants (output)
+
+static const int UT_DP_TX_SDA = 0x01; // upstream control bus
+static const int UT_DP_TX_SCL = 0x02; // upstream control bus
+static const int UT_DP_TX_AS = 0x04; // upstream control bus
+static const int UT_DP_TX_ENABLE = 0x08; // upstream h/w enable
+// bits 4,5,6 not used
+static const int UT_DP_TUNER_SDA_OUT = 0x80; // tuner i2c bus data
+
+// parallel port control port constants (output)
+
+static const int UT_CP_TUNER_SCL = 0x08; // tuner i2c bus clock
+static const int UT_CP_MUST_BE_ZERO = 0xf0; // must be zero
+
+// parallel port status port constants (input)
+
+// bits 0,1,2 not used
+static const int UT_SP_TUNER_SCL_LOOP_BACK= 0x08; // inverted SCL loop back
+static const int UT_SP_SHOULD_BE_ZERO = 0x10; // reads as zero
+static const int UT_SP_SHOULD_BE_ONE = 0x20; // reads as one
+// bit 6 not used
+static const int UT_SP_TUNER_SDA_IN = 0x80;
+
+
+#endif /* _MICROTUNE_EVAL_BOARD_DEFS_H_ */
diff --git a/gnuradio-core/src/lib/io/microtune_xxxx.cc b/gnuradio-core/src/lib/io/microtune_xxxx.cc
new file mode 100644
index 000000000..3d55f534a
--- /dev/null
+++ b/gnuradio-core/src/lib/io/microtune_xxxx.cc
@@ -0,0 +1,41 @@
+/* -*- c++-*- */
+/*
+ * Copyright 2001,2003,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 "microtune_xxxx.h"
+
+microtune_xxxx::~microtune_xxxx ()
+{
+ // nop
+}
+
+double
+microtune_xxxx::set_RF_freq (double target_freq)
+{
+ double actual_freq = 0.0;
+
+ if (set_RF_freq (target_freq, &actual_freq))
+ return actual_freq;
+
+ return 0.0;
+}
+
+
diff --git a/gnuradio-core/src/lib/io/microtune_xxxx.h b/gnuradio-core/src/lib/io/microtune_xxxx.h
new file mode 100644
index 000000000..b2646d39f
--- /dev/null
+++ b/gnuradio-core/src/lib/io/microtune_xxxx.h
@@ -0,0 +1,66 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2001,2003,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_MICROTUNE_XXXX_H
+#define INCLUDED_MICROTUNE_XXXX_H
+
+#include <gr_core_api.h>
+#include <boost/shared_ptr.hpp>
+
+class i2c;
+typedef boost::shared_ptr<i2c> i2c_sptr;
+
+/*!
+ * \brief abstract class for controlling microtune {4937,4702} tuner modules
+ * \ingroup base
+ */
+class GR_CORE_API microtune_xxxx {
+public:
+ microtune_xxxx () {}
+ virtual ~microtune_xxxx ();
+
+ /*!
+ * \brief select RF frequency to be tuned to output frequency.
+ * \p freq is the requested frequency in Hz, \p actual_freq
+ * is set to the actual frequency tuned. It takes about 100 ms
+ * for the PLL to settle.
+ *
+ * \returns true iff sucessful.
+ */
+ virtual bool set_RF_freq (double freq, double *actual_freq) = 0;
+
+ // returns actual freq or 0 if error (easier interface for SWIG)
+ double set_RF_freq (double freq);
+
+ /*!
+ * \returns true iff PLL is locked
+ */
+ virtual bool pll_locked_p () = 0;
+
+ /*!
+ * \returns the output frequency (IF center freq) of the tuner in Hz.
+ */
+ virtual double get_output_freq () = 0;
+
+};
+
+#endif /* INCLUDED_MICROTUNE_XXXX_H */
diff --git a/gnuradio-core/src/lib/io/microtune_xxxx_eval_board.cc b/gnuradio-core/src/lib/io/microtune_xxxx_eval_board.cc
new file mode 100644
index 000000000..35600ff06
--- /dev/null
+++ b/gnuradio-core/src/lib/io/microtune_xxxx_eval_board.cc
@@ -0,0 +1,144 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2001,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "microtune_xxxx_eval_board.h"
+#include "microtune_eval_board_defs.h"
+#include "microtune_xxxx.h"
+#include "ppio.h"
+#include "i2c_bitbang.h"
+#include "i2c_bbio_pp.h"
+#include <cmath>
+
+static int AGC_DAC_I2C_ADDR = 0x2C;
+
+microtune_xxxx_eval_board::microtune_xxxx_eval_board (int which_pp)
+{
+ d_ppio = make_ppio (which_pp);
+ d_i2c = make_i2c_bitbang (make_i2c_bbio_pp (d_ppio));
+ d_tuner = 0;
+}
+
+microtune_xxxx_eval_board::~microtune_xxxx_eval_board ()
+{
+ delete d_tuner;
+ d_tuner = 0;
+}
+
+
+//! is the eval board present?
+bool
+microtune_xxxx_eval_board::board_present_p ()
+{
+ bool result = true;
+ d_ppio->lock ();
+
+ int t = d_ppio->read_status ();
+ if ((t & UT_SP_SHOULD_BE_ZERO) != 0
+ || (t & UT_SP_SHOULD_BE_ONE) != UT_SP_SHOULD_BE_ONE)
+ result = false;
+
+ // could also see if SCL is looped back or not, but that seems like overkill
+
+ d_ppio->unlock ();
+ return result;
+}
+
+/*
+ * ----------------------------------------------------------------
+ * AGC stuff
+ *
+ * We're using a MAX518 8-bit 5V dual dac for setting the AGC's
+ * ----------------------------------------------------------------
+ */
+void
+microtune_xxxx_eval_board::write_dac (int which, int value)
+{
+ unsigned char cmd[2];
+ cmd[0] = which & 1;
+ cmd[1] = value;
+ d_i2c->write (AGC_DAC_I2C_ADDR, cmd, sizeof (cmd));
+}
+
+void
+microtune_xxxx_eval_board::write_both_dacs (int value0, int value1)
+{
+ unsigned char cmd[4];
+ cmd[0] = 0;
+ cmd[1] = value0;
+ cmd[2] = 1;
+ cmd[3] = value1;
+ d_i2c->write (AGC_DAC_I2C_ADDR, cmd, sizeof (cmd));
+}
+
+static int scale_volts (float volts)
+{
+ int n;
+ n = (int) rint (volts * (256 / 5.0));
+ if (n < 0)
+ n = 0;
+ if (n > 255)
+ n = 255;
+
+ return n;
+}
+
+void
+microtune_xxxx_eval_board::set_RF_AGC_voltage (float volts)
+{
+ write_dac (0, scale_volts (volts));
+}
+
+void
+microtune_xxxx_eval_board::set_IF_AGC_voltage (float volts)
+{
+ write_dac (1, scale_volts (volts));
+}
+
+// delegate to tuner
+
+bool
+microtune_xxxx_eval_board::set_RF_freq (double freq, double *actual_freq)
+{
+ return d_tuner->set_RF_freq (freq, actual_freq);
+}
+
+double
+microtune_xxxx_eval_board::set_RF_freq (double freq)
+{
+ return d_tuner->set_RF_freq (freq);
+}
+
+bool
+microtune_xxxx_eval_board::pll_locked_p ()
+{
+ return d_tuner->pll_locked_p ();
+}
+
+double
+microtune_xxxx_eval_board::get_output_freq ()
+{
+ return d_tuner->get_output_freq ();
+}
diff --git a/gnuradio-core/src/lib/io/microtune_xxxx_eval_board.h b/gnuradio-core/src/lib/io/microtune_xxxx_eval_board.h
new file mode 100644
index 000000000..7fd784ade
--- /dev/null
+++ b/gnuradio-core/src/lib/io/microtune_xxxx_eval_board.h
@@ -0,0 +1,98 @@
+/* -*- C++ -*- */
+/*
+ * Copyright 2001,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_MICROTUNE_XXXX_EVAL_BOARD_H
+#define INCLUDED_MICROTUNE_XXXX_EVAL_BOARD_H
+
+#include <gr_core_api.h>
+#include <boost/shared_ptr.hpp>
+
+class microtune_xxxx;
+
+class ppio;
+typedef boost::shared_ptr<ppio> ppio_sptr;
+
+class i2c;
+typedef boost::shared_ptr<i2c> i2c_sptr;
+
+/*!
+ * \brief abstract class for controlling microtune xxxx eval board
+ * \ingroup hardware
+ */
+class GR_CORE_API microtune_xxxx_eval_board {
+public:
+ microtune_xxxx_eval_board (int which_pp = 0);
+ virtual ~microtune_xxxx_eval_board ();
+
+ //! is the eval board present?
+ bool board_present_p ();
+
+ /*!
+ * \brief set RF and IF AGC control voltages ([0, 5] volts)
+ */
+ void set_RF_AGC_voltage (float volts);
+ void set_IF_AGC_voltage (float volts);
+
+ /*!
+ * \brief set RF and IF AGC levels together (scale [0, 1000])
+ *
+ * This provides a simple linear interface for adjusting both
+ * the RF and IF gain in consort. This is the easy to use interface.
+ * 0 corresponds to minimum gain. 1000 corresponds to maximum gain.
+ */
+ virtual void set_AGC (float value_0_1000) = 0;
+
+ /*!
+ * \brief select RF frequency to be tuned to output frequency.
+ * \p freq is the requested frequency in Hz, \p actual_freq
+ * is set to the actual frequency tuned. It takes about 100 ms
+ * for the PLL to settle.
+ *
+ * \returns true iff sucessful.
+ */
+ bool set_RF_freq (double freq, double *actual_freq);
+
+ // returns actual freq or 0 if error (easier interface for SWIG)
+ double set_RF_freq (double freq);
+
+ /*!
+ * \returns true iff PLL is locked
+ */
+ bool pll_locked_p ();
+
+ /*!
+ * \returns the output frequency (IF center freq) of the tuner in Hz.
+ */
+ double get_output_freq ();
+
+
+private:
+ void write_dac (int which, int value);
+ void write_both_dacs (int val0, int val1);
+
+protected:
+ ppio_sptr d_ppio;
+ i2c_sptr d_i2c;
+ microtune_xxxx *d_tuner;
+};
+
+#endif /* INCLUDED_MICROTUNE_XXXX_EVAL_BOARD_H */
diff --git a/gnuradio-core/src/lib/io/microtune_xxxx_eval_board.i b/gnuradio-core/src/lib/io/microtune_xxxx_eval_board.i
new file mode 100644
index 000000000..8a8a59742
--- /dev/null
+++ b/gnuradio-core/src/lib/io/microtune_xxxx_eval_board.i
@@ -0,0 +1,58 @@
+/* -*- 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.
+ */
+
+class microtune_xxxx_eval_board {
+public:
+ microtune_xxxx_eval_board (int which_pp = 0);
+ virtual ~microtune_xxxx_eval_board ();
+
+ //! is the eval board present?
+ bool board_present_p ();
+
+ /*!
+ * \brief set RF and IF AGC control voltages ([0, 5] volts)
+ */
+ void set_RF_AGC_voltage (float volts);
+ void set_IF_AGC_voltage (float volts);
+
+ /*!
+ * \brief set RF and IF AGC levels together (scale [0, 1000])
+ *
+ * This provides a simple linear interface for adjusting both
+ * the RF and IF gain in consort. This is the easy to use interface.
+ * 0 corresponds to minimum gain. 1000 corresponds to maximum gain.
+ */
+ virtual void set_AGC (float value_0_1000) = 0;
+
+ // returns actual freq or 0 if error (easier interface for SWIG)
+ double set_RF_freq (double freq);
+
+ /*!
+ * \returns true iff PLL is locked
+ */
+ bool pll_locked_p ();
+
+ /*!
+ * \returns the output frequency (IF center freq) of the tuner in Hz.
+ */
+ double get_output_freq ();
+};
diff --git a/gnuradio-core/src/lib/io/ppio.cc b/gnuradio-core/src/lib/io/ppio.cc
new file mode 100644
index 000000000..a5edc539c
--- /dev/null
+++ b/gnuradio-core/src/lib/io/ppio.cc
@@ -0,0 +1,39 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2003 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 <ppio.h>
+#include <ppio_ppdev.h>
+
+ppio::~ppio ()
+{
+}
+
+// Factory method.
+//
+// Right now, we've only got one subclass we like. If there were more,
+// we'd instantiate the "right one" here.
+
+ppio_sptr
+make_ppio (int which_pp)
+{
+ return make_ppio_ppdev (which_pp);
+}
diff --git a/gnuradio-core/src/lib/io/ppio.h b/gnuradio-core/src/lib/io/ppio.h
new file mode 100644
index 000000000..d99f7bf79
--- /dev/null
+++ b/gnuradio-core/src/lib/io/ppio.h
@@ -0,0 +1,63 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2001,2003 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_PPIO_H
+#define INCLUDED_PPIO_H
+
+#include <gr_core_api.h>
+#include <boost/shared_ptr.hpp>
+
+class ppio;
+typedef boost::shared_ptr<ppio> ppio_sptr;
+
+
+/*!
+ * \brief abstract class that provides low level access to parallel port bits
+ * \ingroup hardware
+ */
+
+class GR_CORE_API ppio {
+ public:
+ ppio () {}
+ virtual ~ppio ();
+
+ virtual void write_data (unsigned char v) = 0;
+ virtual unsigned char read_data () = 0;
+ virtual void write_control (unsigned char v) = 0;
+ virtual unsigned char read_control () = 0;
+ virtual unsigned char read_status () = 0;
+
+ virtual void lock () = 0;
+ virtual void unlock () = 0;
+};
+
+/*!
+ * \brief Factory method.
+ *
+ * Split out from class to make life easier for SWIG
+ */
+
+GR_CORE_API ppio_sptr make_ppio (int which_pp);
+
+
+#endif /* INCLUDED_PPIO_H */
+
diff --git a/gnuradio-core/src/lib/io/ppio.i b/gnuradio-core/src/lib/io/ppio.i
new file mode 100644
index 000000000..6b95dcf88
--- /dev/null
+++ b/gnuradio-core/src/lib/io/ppio.i
@@ -0,0 +1,48 @@
+/* -*- 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.
+ */
+
+class ppio;
+typedef boost::shared_ptr<ppio> ppio_sptr;
+
+%template(ppio_sptr) boost::shared_ptr<ppio>;
+
+/*!
+ * \brief abstract class that provides low level access to parallel port bits
+ */
+
+class ppio {
+ public:
+ ppio () {}
+ virtual ~ppio ();
+
+ virtual void write_data (unsigned char v) = 0;
+ virtual unsigned char read_data () = 0;
+ virtual void write_control (unsigned char v) = 0;
+ virtual unsigned char read_control () = 0;
+ virtual unsigned char read_status () = 0;
+
+ virtual void lock () = 0;
+ virtual void unlock () = 0;
+};
+
+
+ppio_sptr make_ppio (int which_pp);
diff --git a/gnuradio-core/src/lib/io/ppio_ppdev.cc b/gnuradio-core/src/lib/io/ppio_ppdev.cc
new file mode 100644
index 000000000..f52845958
--- /dev/null
+++ b/gnuradio-core/src/lib/io/ppio_ppdev.cc
@@ -0,0 +1,321 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2001,2003,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <ppio_ppdev.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <iostream>
+#include <errno.h>
+#include <stdio.h>
+#include <stdexcept>
+#if defined(HAVE_LINUX_PPDEV_H)
+#include <sys/ioctl.h>
+#include <linux/ppdev.h>
+#include <linux/parport.h>
+#include <sstream>
+#elif defined(HAVE_DEV_PPBUS_PPI_H)
+#include <sys/ioctl.h>
+#include <dev/ppbus/ppi.h>
+#include <dev/ppbus/ppbconf.h>
+#include <sstream>
+#else
+// #warn "ppio_ppdev is not functional on this platform"
+#endif
+
+// These control port bits are active low.
+// We toggle them so that this weirdness doesn't get get propagated
+// through our interface.
+
+static int CP_ACTIVE_LOW_BITS = 0x0B;
+
+// These status port bits are active low.
+// We toggle them so that this weirdness doesn't get get propagated
+// through our interface.
+
+static int SP_ACTIVE_LOW_BITS = 0x80;
+
+#if defined(HAVE_LINUX_PPDEV_H)
+
+// The real Linux code...
+
+ppio_ppdev::ppio_ppdev (int which)
+{
+ std::ostringstream filename;
+ filename << "/dev/parport" << which;
+ const char *c_filename = filename.str().c_str();
+
+ if ((d_fd = open (c_filename, O_RDWR)) < 0){
+ int my_errno = errno;
+ perror (c_filename);
+ if (my_errno == ENOENT){
+ std::cerr << "Does the device file " << c_filename << " exist?\n";
+ std::cerr << "If not, as root execute: \n";
+ std::cerr << " # mknod " << c_filename << " c 99 0\n";
+ std::cerr << " # chmod 666 " << c_filename << std::endl;
+ }
+ throw std::runtime_error ("open");
+ }
+
+ int mode = IEEE1284_MODE_COMPAT;
+ if (ioctl (d_fd, PPSETMODE, &mode) != 0){
+ perror ("ppio_ppdev: PPSETMODE");
+ close (d_fd);
+ throw std::runtime_error ("PPSETMODE");
+ }
+}
+
+ppio_ppdev::~ppio_ppdev ()
+{
+ close (d_fd);
+}
+
+
+void
+ppio_ppdev::write_data (unsigned char v)
+{
+ if (ioctl (d_fd, PPWDATA, &v) != 0){
+ perror ("ppio_ppdev: PPWDATA");
+ throw std::runtime_error ("PPWDATA");
+ }
+}
+
+unsigned char
+ppio_ppdev::read_data ()
+{
+ unsigned char v;
+
+ if (ioctl (d_fd, PPRDATA, &v) != 0){
+ perror ("ppio_ppdev: PPRDATA");
+ throw std::runtime_error ("PPRDATA");
+ }
+ return v;
+}
+
+void
+ppio_ppdev::write_control (unsigned char v)
+{
+ unsigned char ctrl = v ^ CP_ACTIVE_LOW_BITS;
+ if (ioctl (d_fd, PPWCONTROL, &ctrl) != 0){
+ perror ("ppio_ppdev: PPWCONTROL");
+ throw std::runtime_error ("PPWCONTROL");
+ }
+}
+
+unsigned char
+ppio_ppdev::read_control ()
+{
+ unsigned char ctrl;
+ if (ioctl (d_fd, PPRCONTROL, &ctrl) != 0){
+ perror ("ppio_ppdev: PPRCONTROL");
+ throw std::runtime_error ("PPRCONTROL");
+ }
+
+ return ctrl ^ CP_ACTIVE_LOW_BITS;
+}
+
+unsigned char
+ppio_ppdev::read_status ()
+{
+ unsigned char status;
+ if (ioctl (d_fd, PPRSTATUS, &status) != 0){
+ perror ("ppio_ppdev: PPRSTATUS");
+ throw std::runtime_error ("PPRSTATUS");
+ }
+
+ return status ^ SP_ACTIVE_LOW_BITS;
+}
+
+void
+ppio_ppdev::lock ()
+{
+ if (ioctl (d_fd, PPCLAIM) != 0){
+ perror ("ppio_ppdev: PPCLAIM");
+ throw std::runtime_error ("PPCLAIM");
+ }
+}
+
+void
+ppio_ppdev::unlock ()
+{
+ if (ioctl (d_fd, PPRELEASE) != 0){
+ perror ("ppio_ppdev: PPRELEASE");
+ throw std::runtime_error ("PPRELEASE");
+ }
+}
+
+#elif defined(HAVE_DEV_PPBUS_PPI_H)
+
+// The real FreeBSD code... (Could work on other BSDs as well)
+
+ppio_ppdev::ppio_ppdev (int which)
+{
+ std::ostringstream filename;
+ filename << "/dev/ppi" << which;
+ const char *c_filename = filename.str().c_str();
+ if ((d_fd = open (c_filename, O_RDWR)) < 0){
+ int my_errno = errno;
+ perror (c_filename);
+ throw std::runtime_error ("open");
+ }
+
+#if 0
+ int mode = IEEE1284_MODE_COMPAT;
+ if (ioctl (d_fd, PPSETMODE, &mode) != 0){
+ perror ("ppio_ppdev: PPSETMODE");
+ close (d_fd);
+ throw std::runtime_error ("PPSETMODE");
+ }
+#endif
+}
+
+ppio_ppdev::~ppio_ppdev ()
+{
+ close (d_fd);
+}
+
+
+void
+ppio_ppdev::write_data (unsigned char v)
+{
+ if (ioctl (d_fd, PPISDATA, &v) != 0){
+ perror ("ppio_ppdev: PPISDATA");
+ throw std::runtime_error ("PPISDATA");
+ }
+}
+
+unsigned char
+ppio_ppdev::read_data ()
+{
+ unsigned char v;
+
+ if (ioctl (d_fd, PPIGDATA, &v) != 0){
+ perror ("ppio_ppdev: PPIGDATA");
+ throw std::runtime_error ("PPIGDATA");
+ }
+ return v;
+}
+
+void
+ppio_ppdev::write_control (unsigned char v)
+{
+ unsigned char ctrl = v ^ CP_ACTIVE_LOW_BITS;
+ if (ioctl (d_fd, PPISCTRL, &ctrl) != 0){
+ perror ("ppio_ppdev: PPISCTRL");
+ throw std::runtime_error ("PPISCTRL");
+ }
+}
+
+unsigned char
+ppio_ppdev::read_control ()
+{
+ unsigned char ctrl;
+ if (ioctl (d_fd, PPIGCTRL, &ctrl) != 0){
+ perror ("ppio_ppdev: PPIGCTRL");
+ throw std::runtime_error ("PPIGCTRL");
+ }
+
+ return ctrl ^ CP_ACTIVE_LOW_BITS;
+}
+
+unsigned char
+ppio_ppdev::read_status ()
+{
+ unsigned char status;
+ if (ioctl (d_fd, PPIGSTATUS, &status) != 0){
+ perror ("ppio_ppdev: PPIGSTATUS");
+ throw std::runtime_error ("PPIGSTATUS");
+ }
+ return status ^ SP_ACTIVE_LOW_BITS;
+}
+
+void
+ppio_ppdev::lock ()
+{
+}
+
+void
+ppio_ppdev::unlock ()
+{
+}
+#else
+/* Apparently, non real code */
+
+ppio_ppdev::ppio_ppdev (int which)
+{
+ std::cerr << "ppio_ppdev: Not implemented on this platform\n";
+ throw std::runtime_error ("not implmeneted");
+}
+
+ppio_ppdev::~ppio_ppdev ()
+{
+}
+
+void
+ppio_ppdev::write_data (unsigned char v)
+{
+}
+
+unsigned char
+ppio_ppdev::read_data ()
+{
+ return 0;
+}
+
+void
+ppio_ppdev::write_control (unsigned char v)
+{
+}
+
+unsigned char
+ppio_ppdev::read_control ()
+{
+ return 0;
+}
+
+unsigned char
+ppio_ppdev::read_status ()
+{
+ return 0;
+}
+
+void
+ppio_ppdev::lock ()
+{
+}
+
+void
+ppio_ppdev::unlock ()
+{
+}
+
+#endif
+
+ppio_ppdev_sptr
+make_ppio_ppdev (int which)
+{
+ return ppio_ppdev_sptr (new ppio_ppdev (which));
+}
diff --git a/gnuradio-core/src/lib/io/ppio_ppdev.h b/gnuradio-core/src/lib/io/ppio_ppdev.h
new file mode 100644
index 000000000..1f86d7e04
--- /dev/null
+++ b/gnuradio-core/src/lib/io/ppio_ppdev.h
@@ -0,0 +1,62 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2001,2003 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_PPIO_PPDEV_H
+#define INCLUDED_PPIO_PPDEV_H
+
+#include <gr_core_api.h>
+#include <ppio.h>
+
+class ppio_ppdev;
+typedef boost::shared_ptr<ppio_ppdev> ppio_ppdev_sptr;
+
+/*!
+ * \brief access to parallel port bits using the linux ppdev interface
+ * \ingroup hardware
+ */
+
+class GR_CORE_API ppio_ppdev : public ppio {
+ friend GR_CORE_API ppio_ppdev_sptr make_ppio_ppdev (int which = 0);
+ ppio_ppdev (int which = 0);
+
+ public:
+ virtual ~ppio_ppdev ();
+
+ virtual void write_data (unsigned char v);
+ virtual unsigned char read_data ();
+ virtual void write_control (unsigned char v);
+ virtual unsigned char read_control ();
+ virtual unsigned char read_status ();
+
+ virtual void lock ();
+ virtual void unlock ();
+
+ private:
+ int d_fd;
+};
+
+ppio_ppdev_sptr
+make_ppio_ppdev (int which);
+
+
+#endif /* INCLUDED_PPIO_PPDEV_H */
+
diff --git a/gnuradio-core/src/lib/io/sdr_1000.cc b/gnuradio-core/src/lib/io/sdr_1000.cc
new file mode 100644
index 000000000..a8c2555e0
--- /dev/null
+++ b/gnuradio-core/src/lib/io/sdr_1000.cc
@@ -0,0 +1,65 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2003 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 <sdr_1000.h>
+#include <ppio.h>
+
+sdr_1000_base::sdr_1000_base (int which_pp)
+{
+ d_ppio = make_ppio (which_pp);
+ d_shadow[0] = 0;
+ d_shadow[1] = 0;
+ d_shadow[2] = 0;
+ d_shadow[3] = 0;
+ reset ();
+}
+
+sdr_1000_base::~sdr_1000_base ()
+{
+}
+
+void
+sdr_1000_base::reset ()
+{
+ d_ppio->lock ();
+ d_ppio->write_control (0x0F);
+ d_ppio->unlock ();
+ write_latch (L_EXT, 0x00, 0xff);
+ write_latch (L_BAND, 0x00, 0xff);
+ write_latch (L_DDS0, 0x80, 0xff); // hold DDS in reset
+ write_latch (L_DDS1, 0x00, 0xff);
+}
+
+
+void
+sdr_1000_base::write_latch (int which, int value, int mask)
+{
+ if (!(0 <= which && which <= 3))
+ return;
+
+ d_ppio->lock ();
+ d_shadow[which] = (d_shadow[which] & ~mask) | (value & mask);
+ d_ppio->write_data (d_shadow[which]);
+ d_ppio->write_control (0x0F ^ (1 << which));
+ d_ppio->write_control (0x0F);
+ d_ppio->unlock ();
+}
diff --git a/gnuradio-core/src/lib/io/sdr_1000.h b/gnuradio-core/src/lib/io/sdr_1000.h
new file mode 100644
index 000000000..c00608a3a
--- /dev/null
+++ b/gnuradio-core/src/lib/io/sdr_1000.h
@@ -0,0 +1,53 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2003,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_SDR_1000_H
+#define INCLUDED_SDR_1000_H
+
+#include <gr_core_api.h>
+#include <boost/shared_ptr.hpp>
+
+class ppio;
+typedef boost::shared_ptr<ppio> ppio_sptr;
+
+
+enum { L_EXT = 0, L_BAND = 1, L_DDS0 = 2, L_DDS1 = 3 };
+
+/*!
+ * \brief Very low level interface to SDR 1000 xcvr hardware
+ * \sa sdr_1000.py for a higher level interface.
+ * \ingroup hardware
+ */
+class GR_CORE_API sdr_1000_base {
+ ppio_sptr d_ppio;
+ int d_shadow[4]; // shadow latches
+
+public:
+
+ sdr_1000_base (int which_pp);
+ ~sdr_1000_base ();
+
+ void reset ();
+ void write_latch (int which, int value, int mask);
+};
+
+#endif /* INCLUDED_SDR_1000_H */
diff --git a/gnuradio-core/src/lib/io/sdr_1000.i b/gnuradio-core/src/lib/io/sdr_1000.i
new file mode 100644
index 000000000..c9b1ef560
--- /dev/null
+++ b/gnuradio-core/src/lib/io/sdr_1000.i
@@ -0,0 +1,36 @@
+/* -*- 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.
+ */
+
+const int L_EXT = 0;
+const int L_BAND = 1;
+const int L_DDS0 = 2;
+const int L_DDS1 = 3;
+
+class sdr_1000_base {
+public:
+
+ sdr_1000_base (int which_pp);
+ ~sdr_1000_base ();
+
+ void reset ();
+ void write_latch (int which, int value, int mask);
+};
diff --git a/gnuradio-core/src/lib/missing/CMakeLists.txt b/gnuradio-core/src/lib/missing/CMakeLists.txt
new file mode 100644
index 000000000..85267ee48
--- /dev/null
+++ b/gnuradio-core/src/lib/missing/CMakeLists.txt
@@ -0,0 +1,32 @@
+# Copyright 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.
+
+########################################################################
+# This file included, use CMake directory variables
+########################################################################
+
+list(APPEND gnuradio_core_sources
+ ${CMAKE_CURRENT_SOURCE_DIR}/bug_work_around_8.cc
+)
+
+if(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)")
+ list(APPEND gnuradio_core_sources
+ ${CMAKE_CURRENT_SOURCE_DIR}/posix_memalign.cc
+ )
+endif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)")
diff --git a/gnuradio-core/src/lib/missing/bug_work_around_8.cc b/gnuradio-core/src/lib/missing/bug_work_around_8.cc
new file mode 100644
index 000000000..5e431a210
--- /dev/null
+++ b/gnuradio-core/src/lib/missing/bug_work_around_8.cc
@@ -0,0 +1,3 @@
+// if libmisc has no sources, it doesn't get built correctly
+#include <gruel/attributes.h>
+static int gr_bug_work_around_8 __GR_ATTR_UNUSED;
diff --git a/gnuradio-core/src/lib/missing/getopt.c b/gnuradio-core/src/lib/missing/getopt.c
new file mode 100644
index 000000000..69c7c16f7
--- /dev/null
+++ b/gnuradio-core/src/lib/missing/getopt.c
@@ -0,0 +1,733 @@
+/* Getopt for GNU.
+ NOTE: getopt is now part of the C library, so if you don't know what
+ "Keep this file name-space clean" means, talk to roland@gnu.ai.mit.edu
+ before changing it!
+
+ Copyright (C) 1987, 88, 89, 90, 91, 92, 1993
+ Free Software Foundation, Inc.
+
+ This program 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.
+
+ This program 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 this program; if not, write to the Free Software
+ Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+
+/* NOTE!!! AIX requires this to be the first thing in the file.
+ Do not put ANYTHING before it! */
+#if !defined (__GNUC__) && defined (_AIX)
+ #pragma alloca
+#endif
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#ifdef __GNUC__
+#define alloca __builtin_alloca
+#else /* not __GNUC__ */
+#if defined (HAVE_ALLOCA_H) || (defined(sparc) && (defined(sun) || (!defined(USG) && !defined(SVR4) && !defined(__svr4__))))
+#include <alloca.h>
+#else
+#ifndef _AIX
+char *alloca ();
+#endif
+#endif /* alloca.h */
+#endif /* not __GNUC__ */
+
+#if !__STDC__ && !defined(const) && IN_GCC
+#define const
+#endif
+
+/* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>. */
+#ifndef _NO_PROTO
+#define _NO_PROTO
+#endif
+
+#include <stdio.h>
+
+/* Comment out all this code if we are using the GNU C Library, and are not
+ actually compiling the library itself. This code is part of the GNU C
+ Library, but also included in many other GNU distributions. Compiling
+ and linking in this code is a waste when using the GNU C library
+ (especially if it is a shared library). Rather than having every GNU
+ program understand `configure --with-gnu-libc' and omit the object files,
+ it is simpler to just do this in the source for each such file. */
+
+#if defined (_LIBC) || !defined (__GNU_LIBRARY__)
+
+
+/* This needs to come after some library #include
+ to get __GNU_LIBRARY__ defined. */
+#ifdef __GNU_LIBRARY__
+#undef alloca
+/* Don't include stdlib.h for non-GNU C libraries because some of them
+ contain conflicting prototypes for getopt. */
+#include <stdlib.h>
+#else /* Not GNU C library. */
+#define __alloca alloca
+#endif /* GNU C library. */
+
+/* If GETOPT_COMPAT is defined, `+' as well as `--' can introduce a
+ long-named option. Because this is not POSIX.2 compliant, it is
+ being phased out. */
+/* #define GETOPT_COMPAT */
+
+/* This version of `getopt' appears to the caller like standard Unix `getopt'
+ but it behaves differently for the user, since it allows the user
+ to intersperse the options with the other arguments.
+
+ As `getopt' works, it permutes the elements of ARGV so that,
+ when it is done, all the options precede everything else. Thus
+ all application programs are extended to handle flexible argument order.
+
+ Setting the environment variable POSIXLY_CORRECT disables permutation.
+ Then the behavior is completely standard.
+
+ GNU application programs can use a third alternative mode in which
+ they can distinguish the relative order of options and other arguments. */
+
+#include "getopt.h"
+
+/* For communication from `getopt' to the caller.
+ When `getopt' finds an option that takes an argument,
+ the argument value is returned here.
+ Also, when `ordering' is RETURN_IN_ORDER,
+ each non-option ARGV-element is returned here. */
+
+char *optarg = 0;
+
+/* Index in ARGV of the next element to be scanned.
+ This is used for communication to and from the caller
+ and for communication between successive calls to `getopt'.
+
+ On entry to `getopt', zero means this is the first call; initialize.
+
+ When `getopt' returns EOF, this is the index of the first of the
+ non-option elements that the caller should itself scan.
+
+ Otherwise, `optind' communicates from one call to the next
+ how much of ARGV has been scanned so far. */
+
+/* XXX 1003.2 says this must be 1 before any call. */
+int optind = 0;
+
+/* The next char to be scanned in the option-element
+ in which the last option character we returned was found.
+ This allows us to pick up the scan where we left off.
+
+ If this is zero, or a null string, it means resume the scan
+ by advancing to the next ARGV-element. */
+
+static char *nextchar;
+
+/* Callers store zero here to inhibit the error message
+ for unrecognized options. */
+
+int opterr = 1;
+
+/* Set to an option character which was unrecognized.
+ This must be initialized on some systems to avoid linking in the
+ system's own getopt implementation. */
+
+int optopt = '?';
+
+/* Describe how to deal with options that follow non-option ARGV-elements.
+
+ If the caller did not specify anything,
+ the default is REQUIRE_ORDER if the environment variable
+ POSIXLY_CORRECT is defined, PERMUTE otherwise.
+
+ REQUIRE_ORDER means don't recognize them as options;
+ stop option processing when the first non-option is seen.
+ This is what Unix does.
+ This mode of operation is selected by either setting the environment
+ variable POSIXLY_CORRECT, or using `+' as the first character
+ of the list of option characters.
+
+ PERMUTE is the default. We permute the contents of ARGV as we scan,
+ so that eventually all the non-options are at the end. This allows options
+ to be given in any order, even with programs that were not written to
+ expect this.
+
+ RETURN_IN_ORDER is an option available to programs that were written
+ to expect options and other ARGV-elements in any order and that care about
+ the ordering of the two. We describe each non-option ARGV-element
+ as if it were the argument of an option with character code 1.
+ Using `-' as the first character of the list of option characters
+ selects this mode of operation.
+
+ The special argument `--' forces an end of option-scanning regardless
+ of the value of `ordering'. In the case of RETURN_IN_ORDER, only
+ `--' can cause `getopt' to return EOF with `optind' != ARGC. */
+
+static enum
+{
+ REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER
+} ordering;
+
+#ifdef __GNU_LIBRARY__
+/* We want to avoid inclusion of string.h with non-GNU libraries
+ because there are many ways it can cause trouble.
+ On some systems, it contains special magic macros that don't work
+ in GCC. */
+#include <string.h>
+#define my_index strchr
+#define my_bcopy(src, dst, n) memcpy ((dst), (src), (n))
+#else
+
+/* Avoid depending on library functions or files
+ whose names are inconsistent. */
+
+char *getenv ();
+
+static char *
+my_index (str, chr)
+ const char *str;
+ int chr;
+{
+ while (*str)
+ {
+ if (*str == chr)
+ return (char *) str;
+ str++;
+ }
+ return 0;
+}
+
+static void
+my_bcopy (from, to, size)
+ const char *from;
+ char *to;
+ int size;
+{
+ int i;
+ for (i = 0; i < size; i++)
+ to[i] = from[i];
+}
+#endif /* GNU C library. */
+
+/* Handle permutation of arguments. */
+
+/* Describe the part of ARGV that contains non-options that have
+ been skipped. `first_nonopt' is the index in ARGV of the first of them;
+ `last_nonopt' is the index after the last of them. */
+
+static int first_nonopt;
+static int last_nonopt;
+
+/* Exchange two adjacent subsequences of ARGV.
+ One subsequence is elements [first_nonopt,last_nonopt)
+ which contains all the non-options that have been skipped so far.
+ The other is elements [last_nonopt,optind), which contains all
+ the options processed since those non-options were skipped.
+
+ `first_nonopt' and `last_nonopt' are relocated so that they describe
+ the new indices of the non-options in ARGV after they are moved. */
+
+static void
+exchange (argv)
+ char **argv;
+{
+ int nonopts_size = (last_nonopt - first_nonopt) * sizeof (char *);
+ char **temp = (char **) __alloca (nonopts_size);
+
+ /* Interchange the two blocks of data in ARGV. */
+
+ my_bcopy ((char *) &argv[first_nonopt], (char *) temp, nonopts_size);
+ my_bcopy ((char *) &argv[last_nonopt], (char *) &argv[first_nonopt],
+ (optind - last_nonopt) * sizeof (char *));
+ my_bcopy ((char *) temp,
+ (char *) &argv[first_nonopt + optind - last_nonopt],
+ nonopts_size);
+
+ /* Update records for the slots the non-options now occupy. */
+
+ first_nonopt += (optind - last_nonopt);
+ last_nonopt = optind;
+}
+
+/* Scan elements of ARGV (whose length is ARGC) for option characters
+ given in OPTSTRING.
+
+ If an element of ARGV starts with '-', and is not exactly "-" or "--",
+ then it is an option element. The characters of this element
+ (aside from the initial '-') are option characters. If `getopt'
+ is called repeatedly, it returns successively each of the option characters
+ from each of the option elements.
+
+ If `getopt' finds another option character, it returns that character,
+ updating `optind' and `nextchar' so that the next call to `getopt' can
+ resume the scan with the following option character or ARGV-element.
+
+ If there are no more option characters, `getopt' returns `EOF'.
+ Then `optind' is the index in ARGV of the first ARGV-element
+ that is not an option. (The ARGV-elements have been permuted
+ so that those that are not options now come last.)
+
+ OPTSTRING is a string containing the legitimate option characters.
+ If an option character is seen that is not listed in OPTSTRING,
+ return '?' after printing an error message. If you set `opterr' to
+ zero, the error message is suppressed but we still return '?'.
+
+ If a char in OPTSTRING is followed by a colon, that means it wants an arg,
+ so the following text in the same ARGV-element, or the text of the following
+ ARGV-element, is returned in `optarg'. Two colons mean an option that
+ wants an optional arg; if there is text in the current ARGV-element,
+ it is returned in `optarg', otherwise `optarg' is set to zero.
+
+ If OPTSTRING starts with `-' or `+', it requests different methods of
+ handling the non-option ARGV-elements.
+ See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above.
+
+ Long-named options begin with `--' instead of `-'.
+ Their names may be abbreviated as long as the abbreviation is unique
+ or is an exact match for some defined option. If they have an
+ argument, it follows the option name in the same ARGV-element, separated
+ from the option name by a `=', or else the in next ARGV-element.
+ When `getopt' finds a long-named option, it returns 0 if that option's
+ `flag' field is nonzero, the value of the option's `val' field
+ if the `flag' field is zero.
+
+ The elements of ARGV aren't really const, because we permute them.
+ But we pretend they're const in the prototype to be compatible
+ with other systems.
+
+ LONGOPTS is a vector of `struct option' terminated by an
+ element containing a name which is zero.
+
+ LONGIND returns the index in LONGOPT of the long-named option found.
+ It is only valid when a long-named option has been found by the most
+ recent call.
+
+ If LONG_ONLY is nonzero, '-' as well as '--' can introduce
+ long-named options. */
+
+int
+_getopt_internal (argc, argv, optstring, longopts, longind, long_only)
+ int argc;
+ char *const *argv;
+ const char *optstring;
+ const struct option *longopts;
+ int *longind;
+ int long_only;
+{
+ int option_index;
+
+ optarg = 0;
+
+ /* Initialize the internal data when the first call is made.
+ Start processing options with ARGV-element 1 (since ARGV-element 0
+ is the program name); the sequence of previously skipped
+ non-option ARGV-elements is empty. */
+
+ if (optind == 0)
+ {
+ first_nonopt = last_nonopt = optind = 1;
+
+ nextchar = NULL;
+
+ /* Determine how to handle the ordering of options and nonoptions. */
+
+ if (optstring[0] == '-')
+ {
+ ordering = RETURN_IN_ORDER;
+ ++optstring;
+ }
+ else if (optstring[0] == '+')
+ {
+ ordering = REQUIRE_ORDER;
+ ++optstring;
+ }
+ else if (getenv ("POSIXLY_CORRECT") != NULL)
+ ordering = REQUIRE_ORDER;
+ else
+ ordering = PERMUTE;
+ }
+
+ if (nextchar == NULL || *nextchar == '\0')
+ {
+ if (ordering == PERMUTE)
+ {
+ /* If we have just processed some options following some non-options,
+ exchange them so that the options come first. */
+
+ if (first_nonopt != last_nonopt && last_nonopt != optind)
+ exchange ((char **) argv);
+ else if (last_nonopt != optind)
+ first_nonopt = optind;
+
+ /* Now skip any additional non-options
+ and extend the range of non-options previously skipped. */
+
+ while (optind < argc
+ && (argv[optind][0] != '-' || argv[optind][1] == '\0')
+#ifdef GETOPT_COMPAT
+ && (longopts == NULL
+ || argv[optind][0] != '+' || argv[optind][1] == '\0')
+#endif /* GETOPT_COMPAT */
+ )
+ optind++;
+ last_nonopt = optind;
+ }
+
+ /* Special ARGV-element `--' means premature end of options.
+ Skip it like a null option,
+ then exchange with previous non-options as if it were an option,
+ then skip everything else like a non-option. */
+
+ if (optind != argc && !strcmp (argv[optind], "--"))
+ {
+ optind++;
+
+ if (first_nonopt != last_nonopt && last_nonopt != optind)
+ exchange ((char **) argv);
+ else if (first_nonopt == last_nonopt)
+ first_nonopt = optind;
+ last_nonopt = argc;
+
+ optind = argc;
+ }
+
+ /* If we have done all the ARGV-elements, stop the scan
+ and back over any non-options that we skipped and permuted. */
+
+ if (optind == argc)
+ {
+ /* Set the next-arg-index to point at the non-options
+ that we previously skipped, so the caller will digest them. */
+ if (first_nonopt != last_nonopt)
+ optind = first_nonopt;
+ return EOF;
+ }
+
+ /* If we have come to a non-option and did not permute it,
+ either stop the scan or describe it to the caller and pass it by. */
+
+ if ((argv[optind][0] != '-' || argv[optind][1] == '\0')
+#ifdef GETOPT_COMPAT
+ && (longopts == NULL
+ || argv[optind][0] != '+' || argv[optind][1] == '\0')
+#endif /* GETOPT_COMPAT */
+ )
+ {
+ if (ordering == REQUIRE_ORDER)
+ return EOF;
+ optarg = argv[optind++];
+ return 1;
+ }
+
+ /* We have found another option-ARGV-element.
+ Start decoding its characters. */
+
+ nextchar = (argv[optind] + 1
+ + (longopts != NULL && argv[optind][1] == '-'));
+ }
+
+ if (longopts != NULL
+ && ((argv[optind][0] == '-'
+ && (argv[optind][1] == '-' || long_only))
+#ifdef GETOPT_COMPAT
+ || argv[optind][0] == '+'
+#endif /* GETOPT_COMPAT */
+ ))
+ {
+ const struct option *p;
+ char *s = nextchar;
+ int exact = 0;
+ int ambig = 0;
+ const struct option *pfound = NULL;
+ int indfound;
+
+ while (*s && *s != '=')
+ s++;
+
+ /* Test all options for either exact match or abbreviated matches. */
+ for (p = longopts, option_index = 0; p->name;
+ p++, option_index++)
+ if (!strncmp (p->name, nextchar, s - nextchar))
+ {
+ if (s - nextchar == strlen (p->name))
+ {
+ /* Exact match found. */
+ pfound = p;
+ indfound = option_index;
+ exact = 1;
+ break;
+ }
+ else if (pfound == NULL)
+ {
+ /* First nonexact match found. */
+ pfound = p;
+ indfound = option_index;
+ }
+ else
+ /* Second nonexact match found. */
+ ambig = 1;
+ }
+
+ if (ambig && !exact)
+ {
+ if (opterr)
+ fprintf (stderr, "%s: option `%s' is ambiguous\n",
+ argv[0], argv[optind]);
+ nextchar += strlen (nextchar);
+ optind++;
+ return '?';
+ }
+
+ if (pfound != NULL)
+ {
+ option_index = indfound;
+ optind++;
+ if (*s)
+ {
+ /* Don't test has_arg with >, because some C compilers don't
+ allow it to be used on enums. */
+ if (pfound->has_arg)
+ optarg = s + 1;
+ else
+ {
+ if (opterr)
+ {
+ if (argv[optind - 1][1] == '-')
+ /* --option */
+ fprintf (stderr,
+ "%s: option `--%s' doesn't allow an argument\n",
+ argv[0], pfound->name);
+ else
+ /* +option or -option */
+ fprintf (stderr,
+ "%s: option `%c%s' doesn't allow an argument\n",
+ argv[0], argv[optind - 1][0], pfound->name);
+ }
+ nextchar += strlen (nextchar);
+ return '?';
+ }
+ }
+ else if (pfound->has_arg == 1)
+ {
+ if (optind < argc)
+ optarg = argv[optind++];
+ else
+ {
+ if (opterr)
+ fprintf (stderr, "%s: option `%s' requires an argument\n",
+ argv[0], argv[optind - 1]);
+ nextchar += strlen (nextchar);
+ return optstring[0] == ':' ? ':' : '?';
+ }
+ }
+ nextchar += strlen (nextchar);
+ if (longind != NULL)
+ *longind = option_index;
+ if (pfound->flag)
+ {
+ *(pfound->flag) = pfound->val;
+ return 0;
+ }
+ return pfound->val;
+ }
+ /* Can't find it as a long option. If this is not getopt_long_only,
+ or the option starts with '--' or is not a valid short
+ option, then it's an error.
+ Otherwise interpret it as a short option. */
+ if (!long_only || argv[optind][1] == '-'
+#ifdef GETOPT_COMPAT
+ || argv[optind][0] == '+'
+#endif /* GETOPT_COMPAT */
+ || my_index (optstring, *nextchar) == NULL)
+ {
+ if (opterr)
+ {
+ if (argv[optind][1] == '-')
+ /* --option */
+ fprintf (stderr, "%s: unrecognized option `--%s'\n",
+ argv[0], nextchar);
+ else
+ /* +option or -option */
+ fprintf (stderr, "%s: unrecognized option `%c%s'\n",
+ argv[0], argv[optind][0], nextchar);
+ }
+ nextchar = (char *) "";
+ optind++;
+ return '?';
+ }
+ }
+
+ /* Look at and handle the next option-character. */
+
+ {
+ char c = *nextchar++;
+ char *temp = my_index (optstring, c);
+
+ /* Increment `optind' when we start to process its last character. */
+ if (*nextchar == '\0')
+ ++optind;
+
+ if (temp == NULL || c == ':')
+ {
+ if (opterr)
+ {
+#if 0
+ if (c < 040 || c >= 0177)
+ fprintf (stderr, "%s: unrecognized option, character code 0%o\n",
+ argv[0], c);
+ else
+ fprintf (stderr, "%s: unrecognized option `-%c'\n", argv[0], c);
+#else
+ /* 1003.2 specifies the format of this message. */
+ fprintf (stderr, "%s: illegal option -- %c\n", argv[0], c);
+#endif
+ }
+ optopt = c;
+ return '?';
+ }
+ if (temp[1] == ':')
+ {
+ if (temp[2] == ':')
+ {
+ /* This is an option that accepts an argument optionally. */
+ if (*nextchar != '\0')
+ {
+ optarg = nextchar;
+ optind++;
+ }
+ else
+ optarg = 0;
+ nextchar = NULL;
+ }
+ else
+ {
+ /* This is an option that requires an argument. */
+ if (*nextchar != '\0')
+ {
+ optarg = nextchar;
+ /* If we end this ARGV-element by taking the rest as an arg,
+ we must advance to the next element now. */
+ optind++;
+ }
+ else if (optind == argc)
+ {
+ if (opterr)
+ {
+#if 0
+ fprintf (stderr, "%s: option `-%c' requires an argument\n",
+ argv[0], c);
+#else
+ /* 1003.2 specifies the format of this message. */
+ fprintf (stderr, "%s: option requires an argument -- %c\n",
+ argv[0], c);
+#endif
+ }
+ optopt = c;
+ if (optstring[0] == ':')
+ c = ':';
+ else
+ c = '?';
+ }
+ else
+ /* We already incremented `optind' once;
+ increment it again when taking next ARGV-elt as argument. */
+ optarg = argv[optind++];
+ nextchar = NULL;
+ }
+ }
+ return c;
+ }
+}
+
+#ifdef GETOPT
+int
+getopt (argc, argv, optstring)
+ int argc;
+ char *const *argv;
+ const char *optstring;
+{
+ return _getopt_internal (argc, argv, optstring,
+ (const struct option *) 0,
+ (int *) 0,
+ 0);
+}
+#endif
+
+#endif /* _LIBC or not __GNU_LIBRARY__. */
+
+#ifdef TEST
+
+/* Compile with -DTEST to make an executable for use in testing
+ the above definition of `getopt'. */
+
+int
+main (argc, argv)
+ int argc;
+ char **argv;
+{
+ int c;
+ int digit_optind = 0;
+
+ while (1)
+ {
+ int this_option_optind = optind ? optind : 1;
+
+ c = getopt (argc, argv, "abc:d:0123456789");
+ if (c == EOF)
+ break;
+
+ switch (c)
+ {
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ if (digit_optind != 0 && digit_optind != this_option_optind)
+ printf ("digits occur in two different argv-elements.\n");
+ digit_optind = this_option_optind;
+ printf ("option %c\n", c);
+ break;
+
+ case 'a':
+ printf ("option a\n");
+ break;
+
+ case 'b':
+ printf ("option b\n");
+ break;
+
+ case 'c':
+ printf ("option c with value `%s'\n", optarg);
+ break;
+
+ case '?':
+ break;
+
+ default:
+ printf ("?? getopt returned character code 0%o ??\n", c);
+ }
+ }
+
+ if (optind < argc)
+ {
+ printf ("non-option ARGV-elements: ");
+ while (optind < argc)
+ printf ("%s ", argv[optind++]);
+ printf ("\n");
+ }
+
+ exit (0);
+}
+
+#endif /* TEST */
diff --git a/gnuradio-core/src/lib/missing/getopt.h b/gnuradio-core/src/lib/missing/getopt.h
new file mode 100644
index 000000000..067908147
--- /dev/null
+++ b/gnuradio-core/src/lib/missing/getopt.h
@@ -0,0 +1,129 @@
+/* Declarations for getopt.
+ Copyright (C) 1989, 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
+
+ This program 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.
+
+ This program 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 this program; if not, write to the Free Software
+ Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+
+#ifndef _GETOPT_H
+#define _GETOPT_H 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* For communication from `getopt' to the caller.
+ When `getopt' finds an option that takes an argument,
+ the argument value is returned here.
+ Also, when `ordering' is RETURN_IN_ORDER,
+ each non-option ARGV-element is returned here. */
+
+extern char *optarg;
+
+/* Index in ARGV of the next element to be scanned.
+ This is used for communication to and from the caller
+ and for communication between successive calls to `getopt'.
+
+ On entry to `getopt', zero means this is the first call; initialize.
+
+ When `getopt' returns EOF, this is the index of the first of the
+ non-option elements that the caller should itself scan.
+
+ Otherwise, `optind' communicates from one call to the next
+ how much of ARGV has been scanned so far. */
+
+extern int optind;
+
+/* Callers store zero here to inhibit the error message `getopt' prints
+ for unrecognized options. */
+
+extern int opterr;
+
+/* Set to an option character which was unrecognized. */
+
+extern int optopt;
+
+/* Describe the long-named options requested by the application.
+ The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector
+ of `struct option' terminated by an element containing a name which is
+ zero.
+
+ The field `has_arg' is:
+ no_argument (or 0) if the option does not take an argument,
+ required_argument (or 1) if the option requires an argument,
+ optional_argument (or 2) if the option takes an optional argument.
+
+ If the field `flag' is not NULL, it points to a variable that is set
+ to the value given in the field `val' when the option is found, but
+ left unchanged if the option is not found.
+
+ To have a long-named option do something other than set an `int' to
+ a compiled-in constant, such as set a value from `optarg', set the
+ option's `flag' field to zero and its `val' field to a nonzero
+ value (the equivalent single-letter option character, if there is
+ one). For long options that have a zero `flag' field, `getopt'
+ returns the contents of the `val' field. */
+
+struct option
+{
+#if __STDC__
+ const char *name;
+#else
+ char *name;
+#endif
+ /* has_arg can't be an enum because some compilers complain about
+ type mismatches in all the code that assumes it is an int. */
+ int has_arg;
+ int *flag;
+ int val;
+};
+
+/* Names for the values of the `has_arg' field of `struct option'. */
+
+#define no_argument 0
+#define required_argument 1
+#define optional_argument 2
+
+#if __STDC__
+#if defined(__GNU_LIBRARY__)
+/* Many other libraries have conflicting prototypes for getopt, with
+ differences in the consts, in stdlib.h. To avoid compilation
+ errors, only prototype getopt for the GNU C library. */
+extern int getopt (int argc, char *const *argv, const char *shortopts);
+#else /* not __GNU_LIBRARY__ */
+extern int getopt ();
+#endif /* not __GNU_LIBRARY__ */
+extern int getopt_long (int argc, char *const *argv, const char *shortopts,
+ const struct option *longopts, int *longind);
+extern int getopt_long_only (int argc, char *const *argv,
+ const char *shortopts,
+ const struct option *longopts, int *longind);
+
+/* Internal only. Users should not call this directly. */
+extern int _getopt_internal (int argc, char *const *argv,
+ const char *shortopts,
+ const struct option *longopts, int *longind,
+ int long_only);
+#else /* not __STDC__ */
+extern int getopt ();
+extern int getopt_long ();
+extern int getopt_long_only ();
+
+extern int _getopt_internal ();
+#endif /* not __STDC__ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _GETOPT_H */
diff --git a/gnuradio-core/src/lib/missing/gettimeofday.c b/gnuradio-core/src/lib/missing/gettimeofday.c
new file mode 100644
index 000000000..a53e47ed9
--- /dev/null
+++ b/gnuradio-core/src/lib/missing/gettimeofday.c
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2003 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 <config.h>
+
+#ifdef HAVE_WINDOWS_H
+#include <windows.h>
+#endif
+#ifdef HAVE_WINBASE_H
+# include <winbase.h>
+#endif
+
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+
+/*
+ * broken implementation for WIN32.
+ * FIXME: usec precision
+ */
+int gettimeofday(struct timeval *tv, struct timezone *tz)
+{
+ if (tv) {
+ time_t tm;
+
+ time(&tm);
+ tv->tv_sec = tm;
+ tv->tv_usec = 0;
+ }
+ return 0;
+}
+
diff --git a/gnuradio-core/src/lib/missing/posix_memalign.cc b/gnuradio-core/src/lib/missing/posix_memalign.cc
new file mode 100644
index 000000000..aaeff7804
--- /dev/null
+++ b/gnuradio-core/src/lib/missing/posix_memalign.cc
@@ -0,0 +1,114 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "posix_memalign.h"
+
+#ifdef HAVE_MALLOC_H
+// for Cygwin valloc () prototype
+#include <malloc.h>
+#endif
+
+#ifndef HAVE_POSIX_MEMALIGN
+
+/* emulate posix_memalign functionality, to some degree */
+
+#include <errno.h>
+#include "gr_pagesize.h"
+
+int posix_memalign
+(void **memptr, size_t alignment, size_t size)
+{
+ /* emulate posix_memalign functionality, to some degree */
+
+ /* make sure the return handle is valid; return "bad address" if not valid */
+ if (memptr == 0)
+ return (EFAULT);
+ *memptr = (void*) 0;
+
+ /* make sure 'alignment' is a power of 2
+ * and multiple of sizeof (void*)
+ */
+
+ /* make sure 'alignment' is a multiple of sizeof (void*) */
+ if ((alignment % sizeof (void*)) != 0)
+ return (EINVAL);
+
+ /* make sure 'alignment' is a power of 2 */
+ if ((alignment & (alignment - 1)) != 0)
+ return (EINVAL);
+
+ /* good alignment */
+
+#if (ALIGNED_MALLOC != 0)
+
+ /* if 'malloc' is known to be aligned, and the desired 'alignment'
+ * matches is <= that provided by 'malloc', then use 'malloc'. This
+ * works on, e.g., Darwin 8 & 9: for which malloc is 16-byte aligned.
+ */
+ size_t am = (size_t) ALIGNED_MALLOC;
+ if (alignment <= am) {
+ /* make sure ALIGNED_MALLOC is a power of 2, to guarantee that the
+ * alignment is correct (since 'alignment' must be a power of 2).
+ */
+ if ((am & (am - 1)) != 0)
+ return (EINVAL);
+ /* good malloc alignment */
+ *memptr = malloc (size);
+ }
+
+#endif /* (ALIGNED_MALLOC != 0) */
+#ifdef HAVE_VALLOC
+
+ if (*memptr == (void*) 0) {
+ /* try valloc if it exists */
+ /* cheap and easy way to make sure alignment is met, so long as it
+ * is <= pagesize () */
+ if (alignment <= (size_t) gr_pagesize ()) {
+ *memptr = valloc (size);
+ }
+ }
+
+#endif /* HAVE_VALLOC */
+
+#if (ALIGNED_MALLOC == 0) && !defined (HAVE_VALLOC)
+ /* no posix_memalign, valloc, and malloc isn't known to be aligned
+ * (enough for the input arguments); no idea what to do.
+ */
+
+#error gnuradio-core/src/libmissing/posix_memalign.cc: Cannot find a way to alloc aligned memory.
+
+#endif
+
+ /* if the pointer wasn't allocated properly, return that there was
+ * not enough memory to allocate; otherwise, return OK (0).
+ */
+ if (*memptr == (void*) 0)
+ return (ENOMEM);
+ else
+ return (0);
+};
+
+#endif /* ! HAVE_POSIX_MEMALIGN */
diff --git a/gnuradio-core/src/lib/missing/posix_memalign.h b/gnuradio-core/src/lib/missing/posix_memalign.h
new file mode 100644
index 000000000..ea79ced2e
--- /dev/null
+++ b/gnuradio-core/src/lib/missing/posix_memalign.h
@@ -0,0 +1,42 @@
+/* -*- 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.
+ */
+
+#ifndef _POSIX_MEMALIGN_H_
+#define _POSIX_MEMALIGN_H_
+
+#include <stdlib.h>
+
+#ifndef HAVE_POSIX_MEMALIGN
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern int posix_memalign (void** memptr, size_t alignment, size_t size);
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif /* ! HAVE_POSIX_MEMALIGN */
+
+#endif /* _POSIX_MEMALIGN_H_ */
diff --git a/gnuradio-core/src/lib/missing/usleep.c b/gnuradio-core/src/lib/missing/usleep.c
new file mode 100644
index 000000000..b1d7dad47
--- /dev/null
+++ b/gnuradio-core/src/lib/missing/usleep.c
@@ -0,0 +1,67 @@
+/* Copyright (C) 1992 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 3 of the
+License, or (at your option) any later version.
+
+The GNU C Library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB. If
+not, write to the Free Software Foundation, Inc., 675 Mass Ave,
+Cambridge, MA 02139, USA. */
+
+#include <config.h>
+
+#ifndef HAVE_USLEEP
+
+#include <sys/types.h>
+#include <sys/time.h>
+
+#ifdef HAVE_SYS_SELECT_H
+# include <sys/select.h>
+#endif
+
+#ifdef HAVE_WINDOWS_H
+#include <windows.h>
+#endif
+#ifdef HAVE_WINBASE_H
+# include <winbase.h>
+#endif
+
+#ifdef apollo
+# include <apollo/base.h>
+# include <apollo/time.h>
+ static time_$clock_t DomainTime100mS =
+ {
+ 0, 100000/4
+ };
+ static status_$t DomainStatus;
+#endif
+
+/* Sleep USECONDS microseconds, or until a previously set timer goes off. */
+int
+usleep (unsigned long useconds)
+{
+#ifdef apollo
+ /* The usleep function does not work under the SYS5.3 environment.
+ Use the Domain/OS time_$wait call instead. */
+ time_$wait (time_$relative, DomainTime100mS, &DomainStatus);
+#elif defined(HAVE_SSLEEP) /* Win32 */
+ Sleep( useconds/1000 );
+#else
+ struct timeval delay;
+
+ delay.tv_sec = 0;
+ delay.tv_usec = useconds;
+ select (0, 0, 0, 0, &delay);
+#endif
+ return 0;
+}
+
+#endif /* !HAVE_USLEEP */
diff --git a/gnuradio-core/src/lib/reed-solomon/CMakeLists.txt b/gnuradio-core/src/lib/reed-solomon/CMakeLists.txt
new file mode 100644
index 000000000..f073249f6
--- /dev/null
+++ b/gnuradio-core/src/lib/reed-solomon/CMakeLists.txt
@@ -0,0 +1,62 @@
+# 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
+########################################################################
+#MSVC workaround: we cant have dynamically sized arrays.
+#So ifdef a max array bounds that is larger than NN and NROOTS
+#Its a bit of a hack, but if you look at the code, its so full of ifdefs,
+#and lacks optimization where it should be pre-allocating these arrays.
+if(MSVC)
+ set_source_files_properties(
+ ${CMAKE_CURRENT_SOURCE_DIR}/exercise.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/decode_rs.c
+ PROPERTIES COMPILE_DEFINITIONS "MAX_ARRAY=256;"
+ )
+endif(MSVC)
+
+set(gr_core_rs_sources
+ ${CMAKE_CURRENT_SOURCE_DIR}/encode_rs.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/decode_rs.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/init_rs.c
+)
+
+########################################################################
+# Setup sources and includes
+########################################################################
+list(APPEND gnuradio_core_sources ${gr_core_rs_sources})
+
+install(
+ FILES ${CMAKE_CURRENT_SOURCE_DIR}/rs.h
+ DESTINATION ${GR_INCLUDE_DIR}/gnuradio
+ COMPONENT "core_devel"
+)
+
+########################################################################
+# Register unit tests
+########################################################################
+if(ENABLE_TESTING)
+add_executable(gr_core_rstest
+ ${gr_core_rs_sources}
+ ${CMAKE_CURRENT_SOURCE_DIR}/rstest.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/exercise.c
+)
+add_test(gr-core-reed-solomon-test gr_core_rstest)
+endif(ENABLE_TESTING)
diff --git a/gnuradio-core/src/lib/reed-solomon/Makefile.in.karn b/gnuradio-core/src/lib/reed-solomon/Makefile.in.karn
new file mode 100644
index 000000000..8550b4158
--- /dev/null
+++ b/gnuradio-core/src/lib/reed-solomon/Makefile.in.karn
@@ -0,0 +1,99 @@
+# Copyright 2002 Phil Karn, KA9Q
+# May be used under the terms of the GNU General Public License (GPL)
+# @configure_input@
+srcdir = @srcdir@
+prefix = @prefix@
+exec_prefix=@exec_prefix@
+VPATH = @srcdir@
+CC=@CC@
+
+CFLAGS=@CFLAGS@ @ARCH_OPTION@ -Wall
+
+LIB= encode_rs_char.o encode_rs_int.o encode_rs_8.o \
+ decode_rs_char.o decode_rs_int.o decode_rs_8.o \
+ init_rs_char.o init_rs_int.o ccsds_tab.o \
+ encode_rs_ccsds.o decode_rs_ccsds.o ccsds_tal.o
+
+all: librs.a librs.so.@SO_VERSION@
+
+test: rstest
+ ./rstest
+
+rstest: rstest.o exercise_int.o exercise_char.o exercise_8.o exercise_ccsds.o \
+ librs.a
+ gcc -g -o $@ $^
+
+install: all
+ install -D -m 644 -p librs.a librs.so.@SO_VERSION@ @libdir@
+ (cd @libdir@;ln -f -s librs.so.@SO_VERSION@ librs.so)
+ ldconfig
+ install -m 644 -p rs.h @includedir@
+ install -m 644 rs.3 @mandir@/man3
+
+librs.a: $(LIB)
+ ar rv $@ $^
+
+librs.so.@SO_VERSION@: librs.a
+ gcc -shared -Xlinker -soname=librs.so.@SO_NAME@ -o $@ -Wl,-whole-archive $^ -Wl,-no-whole-archive -lc
+
+encode_rs_char.o: encode_rs.c
+ gcc $(CFLAGS) -c -o $@ $^
+
+encode_rs_int.o: encode_rs.c
+ gcc -DBIGSYM=1 $(CFLAGS) -c -o $@ $^
+
+encode_rs_8.o: encode_rs.c
+ gcc -DFIXED=1 $(CFLAGS) -c -o $@ $^
+
+decode_rs_char.o: decode_rs.c
+ gcc $(CFLAGS) -c -o $@ $^
+
+decode_rs_int.o: decode_rs.c
+ gcc -DBIGSYM=1 $(CFLAGS) -c -o $@ $^
+
+decode_rs_8.o: decode_rs.c
+ gcc -DFIXED=1 $(CFLAGS) -c -o $@ $^
+
+init_rs_char.o: init_rs.c
+ gcc $(CFLAGS) -c -o $@ $^
+
+init_rs_int.o: init_rs.c
+ gcc -DBIGSYM=1 $(CFLAGS) -c -o $@ $^
+
+ccsds_tab.o: ccsds_tab.c
+
+ccsds_tab.c: gen_ccsds
+ ./gen_ccsds > ccsds_tab.c
+
+gen_ccsds: gen_ccsds.o init_rs_char.o
+ gcc -o $@ $^
+
+gen_ccsds.o: gen_ccsds.c
+ gcc $(CFLAGS) -c -o $@ $^
+
+ccsds_tal.o: ccsds_tal.c
+
+ccsds_tal.c: gen_ccsds_tal
+ ./gen_ccsds_tal > ccsds_tal.c
+
+exercise_char.o: exercise.c
+ gcc $(CFLAGS) -c -o $@ $^
+
+exercise_int.o: exercise.c
+ gcc -DBIGSYM=1 $(CFLAGS) -c -o $@ $^
+
+exercise_8.o: exercise.c
+ gcc -DFIXED=1 $(CFLAGS) -c -o $@ $^
+
+exercise_ccsds.o: exercise.c
+ gcc -DCCSDS=1 $(CFLAGS) -c -o $@ $^
+
+
+clean:
+ rm -f *.o *.a ccsds_tab.c ccsds_tal.c gen_ccsds gen_ccsds_tal \
+ rstest librs.so.@SO_VERSION@
+
+distclean: clean
+ rm -f config.log config.cache config.status config.h makefile
+
+
diff --git a/gnuradio-core/src/lib/reed-solomon/README b/gnuradio-core/src/lib/reed-solomon/README
new file mode 100644
index 000000000..341832dbd
--- /dev/null
+++ b/gnuradio-core/src/lib/reed-solomon/README
@@ -0,0 +1,5 @@
+This code is from http://people.qualcomm.com/karn/code/fec
+It is based on reed-soloman-3.1.1 (1 Jan 2002).
+
+I has been converted to use automake, to better integrate with GNU
+Radio's build strategy.
diff --git a/gnuradio-core/src/lib/reed-solomon/README.karn b/gnuradio-core/src/lib/reed-solomon/README.karn
new file mode 100644
index 000000000..f30644ffe
--- /dev/null
+++ b/gnuradio-core/src/lib/reed-solomon/README.karn
@@ -0,0 +1,22 @@
+This package implements a general purpose Reed-Solomon encoding and decoding
+facility. See the rs.3 man page for details.
+
+To install, simply do the following after extracting this tarball into
+an empty directory:
+
+./configure
+make
+make install
+
+The command "make test" runs a battery of encode/decode tests using a
+variety of RS codes using random data and random errors. Each test
+should pass with an "OK"; if any fail, please let me know so I can
+track down the problem.
+
+Phil Karn (karn@ka9q.net) 1 Jan 2002
+
+Copyright 2002, Phil Karn, KA9Q
+This software may be used under the terms of the GNU General Public License (GPL).
+
+
+
diff --git a/gnuradio-core/src/lib/reed-solomon/ccsds.h b/gnuradio-core/src/lib/reed-solomon/ccsds.h
new file mode 100644
index 000000000..0f2bde618
--- /dev/null
+++ b/gnuradio-core/src/lib/reed-solomon/ccsds.h
@@ -0,0 +1 @@
+extern unsigned char Taltab[],Tal1tab[];
diff --git a/gnuradio-core/src/lib/reed-solomon/char.h b/gnuradio-core/src/lib/reed-solomon/char.h
new file mode 100644
index 000000000..7b2030a0b
--- /dev/null
+++ b/gnuradio-core/src/lib/reed-solomon/char.h
@@ -0,0 +1,57 @@
+/* Include file to configure the RS codec for character symbols
+ *
+ * Copyright 2002, Phil Karn, KA9Q
+ * May be used under the terms of the GNU General Public License (GPL)
+ */
+
+#define DTYPE unsigned char
+
+#include <gr_core_api.h>
+
+/* Reed-Solomon codec control block */
+struct rs {
+ unsigned int mm; /* Bits per symbol */
+ unsigned int nn; /* Symbols per block (= (1<<mm)-1) */
+ unsigned char *alpha_to; /* log lookup table */
+ unsigned char *index_of; /* Antilog lookup table */
+ unsigned char *genpoly; /* Generator polynomial */
+ unsigned int nroots; /* Number of generator roots = number of parity symbols */
+ unsigned char fcr; /* First consecutive root, index form */
+ unsigned char prim; /* Primitive element, index form */
+ unsigned char iprim; /* prim-th root of 1, index form */
+};
+
+static inline unsigned int modnn(struct rs *rs, unsigned int x){
+ while (x >= rs->nn) {
+ x -= rs->nn;
+ x = (x >> rs->mm) + (x & rs->nn);
+ }
+ return x;
+}
+#define MODNN(x) modnn(rs,x)
+
+#define MM (rs->mm)
+#define NN (rs->nn)
+#define ALPHA_TO (rs->alpha_to)
+#define INDEX_OF (rs->index_of)
+#define GENPOLY (rs->genpoly)
+#define NROOTS (rs->nroots)
+#define FCR (rs->fcr)
+#define PRIM (rs->prim)
+#define IPRIM (rs->iprim)
+#define A0 (NN)
+
+#define ENCODE_RS encode_rs_char
+#define DECODE_RS decode_rs_char
+#define INIT_RS init_rs_char
+#define FREE_RS free_rs_char
+
+GR_CORE_API void ENCODE_RS(void *p,DTYPE *data,DTYPE *parity);
+GR_CORE_API int DECODE_RS(void *p,DTYPE *data,int *eras_pos,int no_eras);
+GR_CORE_API void *INIT_RS(unsigned int symsize,unsigned int gfpoly,unsigned int fcr,
+ unsigned int prim,unsigned int nroots);
+GR_CORE_API void FREE_RS(void *p);
+
+
+
+
diff --git a/gnuradio-core/src/lib/reed-solomon/decode_rs.c b/gnuradio-core/src/lib/reed-solomon/decode_rs.c
new file mode 100644
index 000000000..f9438cf26
--- /dev/null
+++ b/gnuradio-core/src/lib/reed-solomon/decode_rs.c
@@ -0,0 +1,270 @@
+/* Reed-Solomon decoder
+ * Copyright 2002 Phil Karn, KA9Q
+ * May be used under the terms of the GNU General Public License (GPL)
+ */
+
+#ifdef DEBUG
+#include <stdio.h>
+#endif
+
+#include <string.h>
+
+#define NULL ((void *)0)
+#define min(a,b) ((a) < (b) ? (a) : (b))
+
+#ifdef FIXED
+#include "fixed.h"
+#elif defined(BIGSYM)
+#include "int.h"
+#else
+#include "char.h"
+#endif
+
+int DECODE_RS(
+#ifndef FIXED
+void *p,
+#endif
+DTYPE *data, int *eras_pos, int no_eras){
+
+#ifndef FIXED
+ struct rs *rs = (struct rs *)p;
+#endif
+ int deg_lambda, el, deg_omega;
+ int i, j, r, k;
+#ifdef MAX_ARRAY
+ DTYPE u,q,tmp,num1,num2,den,discr_r;
+ DTYPE lambda[MAX_ARRAY], s[MAX_ARRAY]; /* Err+Eras Locator poly
+ * and syndrome poly */
+ DTYPE b[MAX_ARRAY], t[MAX_ARRAY], omega[MAX_ARRAY];
+ DTYPE root[MAX_ARRAY], reg[MAX_ARRAY], loc[MAX_ARRAY];
+#else
+ DTYPE u,q,tmp,num1,num2,den,discr_r;
+ DTYPE lambda[NROOTS+1], s[NROOTS]; /* Err+Eras Locator poly
+ * and syndrome poly */
+ DTYPE b[NROOTS+1], t[NROOTS+1], omega[NROOTS+1];
+ DTYPE root[NROOTS], reg[NROOTS+1], loc[NROOTS];
+#endif
+ int syn_error, count;
+
+ /* form the syndromes; i.e., evaluate data(x) at roots of g(x) */
+ for(i=0;(unsigned int)i<NROOTS;i++)
+ s[i] = data[0];
+
+ for(j=1;(unsigned int)j<NN;j++){
+ for(i=0;(unsigned int)i<NROOTS;i++){
+ if(s[i] == 0){
+ s[i] = data[j];
+ } else {
+ s[i] = data[j] ^ ALPHA_TO[MODNN(INDEX_OF[s[i]] + (FCR+i)*PRIM)];
+ }
+ }
+ }
+
+ /* Convert syndromes to index form, checking for nonzero condition */
+ syn_error = 0;
+ for(i=0;(unsigned int)i<NROOTS;i++){
+ syn_error |= s[i];
+ s[i] = INDEX_OF[s[i]];
+ }
+
+ if (!syn_error) {
+ /* if syndrome is zero, data[] is a codeword and there are no
+ * errors to correct. So return data[] unmodified
+ */
+ count = 0;
+ goto finish;
+ }
+ memset(&lambda[1],0,NROOTS*sizeof(lambda[0]));
+ lambda[0] = 1;
+
+ if (no_eras > 0) {
+ /* Init lambda to be the erasure locator polynomial */
+ lambda[1] = ALPHA_TO[MODNN(PRIM*(NN-1-eras_pos[0]))];
+ for (i = 1; i < no_eras; i++) {
+ u = MODNN(PRIM*(NN-1-eras_pos[i]));
+ for (j = i+1; j > 0; j--) {
+ tmp = INDEX_OF[lambda[j - 1]];
+ if(tmp != A0)
+ lambda[j] ^= ALPHA_TO[MODNN(u + tmp)];
+ }
+ }
+
+#if DEBUG >= 1
+ /* Test code that verifies the erasure locator polynomial just constructed
+ Needed only for decoder debugging. */
+
+ /* find roots of the erasure location polynomial */
+ for(i=1;i<=no_eras;i++)
+ reg[i] = INDEX_OF[lambda[i]];
+
+ count = 0;
+ for (i = 1,k=IPRIM-1; i <= NN; i++,k = MODNN(k+IPRIM)) {
+ q = 1;
+ for (j = 1; j <= no_eras; j++)
+ if (reg[j] != A0) {
+ reg[j] = MODNN(reg[j] + j);
+ q ^= ALPHA_TO[reg[j]];
+ }
+ if (q != 0)
+ continue;
+ /* store root and error location number indices */
+ root[count] = i;
+ loc[count] = k;
+ count++;
+ }
+ if (count != no_eras) {
+ printf("count = %d no_eras = %d\n lambda(x) is WRONG\n",count,no_eras);
+ count = -1;
+ goto finish;
+ }
+#if DEBUG >= 2
+ printf("\n Erasure positions as determined by roots of Eras Loc Poly:\n");
+ for (i = 0; i < count; i++)
+ printf("%d ", loc[i]);
+ printf("\n");
+#endif
+#endif
+ }
+ for(i=0;(unsigned int)i<NROOTS+1;i++)
+ b[i] = INDEX_OF[lambda[i]];
+
+ /*
+ * Begin Berlekamp-Massey algorithm to determine error+erasure
+ * locator polynomial
+ */
+ r = no_eras;
+ el = no_eras;
+ while ((unsigned int)(++r) <= NROOTS) { /* r is the step number */
+ /* Compute discrepancy at the r-th step in poly-form */
+ discr_r = 0;
+ for (i = 0; i < r; i++){
+ if ((lambda[i] != 0) && (s[r-i-1] != A0)) {
+ discr_r ^= ALPHA_TO[MODNN(INDEX_OF[lambda[i]] + s[r-i-1])];
+ }
+ }
+ discr_r = INDEX_OF[discr_r]; /* Index form */
+ if (discr_r == A0) {
+ /* 2 lines below: B(x) <-- x*B(x) */
+ memmove(&b[1],b,NROOTS*sizeof(b[0]));
+ b[0] = A0;
+ } else {
+ /* 7 lines below: T(x) <-- lambda(x) - discr_r*x*b(x) */
+ t[0] = lambda[0];
+ for (i = 0 ; (unsigned int)i < NROOTS; i++) {
+ if(b[i] != A0)
+ t[i+1] = lambda[i+1] ^ ALPHA_TO[MODNN(discr_r + b[i])];
+ else
+ t[i+1] = lambda[i+1];
+ }
+ if (2 * el <= r + no_eras - 1) {
+ el = r + no_eras - el;
+ /*
+ * 2 lines below: B(x) <-- inv(discr_r) *
+ * lambda(x)
+ */
+ for (i = 0; (unsigned int)i <= NROOTS; i++)
+ b[i] = (lambda[i] == 0) ? A0 : MODNN(INDEX_OF[lambda[i]] - discr_r + NN);
+ } else {
+ /* 2 lines below: B(x) <-- x*B(x) */
+ memmove(&b[1],b,NROOTS*sizeof(b[0]));
+ b[0] = A0;
+ }
+ memcpy(lambda,t,(NROOTS+1)*sizeof(t[0]));
+ }
+ }
+
+ /* Convert lambda to index form and compute deg(lambda(x)) */
+ deg_lambda = 0;
+ for(i=0;(unsigned int)i<NROOTS+1;i++){
+ lambda[i] = INDEX_OF[lambda[i]];
+ if(lambda[i] != A0)
+ deg_lambda = i;
+ }
+ /* Find roots of the error+erasure locator polynomial by Chien search */
+ memcpy(&reg[1],&lambda[1],NROOTS*sizeof(reg[0]));
+ count = 0; /* Number of roots of lambda(x) */
+ for (i = 1,k=IPRIM-1; (unsigned int)i <= NN; i++,k = MODNN(k+IPRIM)) {
+ q = 1; /* lambda[0] is always 0 */
+ for (j = deg_lambda; j > 0; j--){
+ if (reg[j] != A0) {
+ reg[j] = MODNN(reg[j] + j);
+ q ^= ALPHA_TO[reg[j]];
+ }
+ }
+ if (q != 0)
+ continue; /* Not a root */
+ /* store root (index-form) and error location number */
+#if DEBUG>=2
+ printf("count %d root %d loc %d\n",count,i,k);
+#endif
+ root[count] = i;
+ loc[count] = k;
+ /* If we've already found max possible roots,
+ * abort the search to save time
+ */
+ if(++count == deg_lambda)
+ break;
+ }
+ if (deg_lambda != count) {
+ /*
+ * deg(lambda) unequal to number of roots => uncorrectable
+ * error detected
+ */
+ count = -1;
+ goto finish;
+ }
+ /*
+ * Compute err+eras evaluator poly omega(x) = s(x)*lambda(x) (modulo
+ * x**NROOTS). in index form. Also find deg(omega).
+ */
+ deg_omega = 0;
+ for (i = 0; (unsigned int)i < NROOTS;i++){
+ tmp = 0;
+ j = (deg_lambda < i) ? deg_lambda : i;
+ for(;j >= 0; j--){
+ if ((s[i - j] != A0) && (lambda[j] != A0))
+ tmp ^= ALPHA_TO[MODNN(s[i - j] + lambda[j])];
+ }
+ if(tmp != 0)
+ deg_omega = i;
+ omega[i] = INDEX_OF[tmp];
+ }
+ omega[NROOTS] = A0;
+
+ /*
+ * Compute error values in poly-form. num1 = omega(inv(X(l))), num2 =
+ * inv(X(l))**(FCR-1) and den = lambda_pr(inv(X(l))) all in poly-form
+ */
+ for (j = count-1; j >=0; j--) {
+ num1 = 0;
+ for (i = deg_omega; i >= 0; i--) {
+ if (omega[i] != A0)
+ num1 ^= ALPHA_TO[MODNN(omega[i] + i * root[j])];
+ }
+ num2 = ALPHA_TO[MODNN(root[j] * (FCR - 1) + NN)];
+ den = 0;
+
+ /* lambda[i+1] for i even is the formal derivative lambda_pr of lambda[i] */
+ for (i = (int)min((unsigned int)deg_lambda,NROOTS-1) & ~1; i >= 0; i -=2) {
+ if(lambda[i+1] != A0)
+ den ^= ALPHA_TO[MODNN(lambda[i+1] + i * root[j])];
+ }
+ if (den == 0) {
+#if DEBUG >= 1
+ printf("\n ERROR: denominator = 0\n");
+#endif
+ count = -1;
+ goto finish;
+ }
+ /* Apply error to data */
+ if (num1 != 0) {
+ data[loc[j]] ^= ALPHA_TO[MODNN(INDEX_OF[num1] + INDEX_OF[num2] + NN - INDEX_OF[den])];
+ }
+ }
+ finish:
+ if(eras_pos != NULL){
+ for(i=0;i<count;i++)
+ eras_pos[i] = loc[i];
+ }
+ return count;
+}
diff --git a/gnuradio-core/src/lib/reed-solomon/decode_rs_ccsds.c b/gnuradio-core/src/lib/reed-solomon/decode_rs_ccsds.c
new file mode 100644
index 000000000..2543d3a64
--- /dev/null
+++ b/gnuradio-core/src/lib/reed-solomon/decode_rs_ccsds.c
@@ -0,0 +1,27 @@
+/* This function wraps around the fixed 8-bit decoder, performing the
+ * basis transformations necessary to meet the CCSDS standard
+ *
+ * Copyright 2002, Phil Karn, KA9Q
+ * May be used under the terms of the GNU General Public License (GPL)
+ */
+#define FIXED 1
+#include "fixed.h"
+#include "ccsds.h"
+
+int decode_rs_ccsds(unsigned char *data,int *eras_pos,int no_eras){
+ int i,r;
+ unsigned char cdata[NN];
+
+ /* Convert data from dual basis to conventional */
+ for(i=0;i<NN;i++)
+ cdata[i] = Tal1tab[data[i]];
+
+ r = decode_rs_8(cdata,eras_pos,no_eras);
+
+ if(r > 0){
+ /* Convert from conventional to dual basis */
+ for(i=0;i<NN;i++)
+ data[i] = Taltab[cdata[i]];
+ }
+ return r;
+}
diff --git a/gnuradio-core/src/lib/reed-solomon/encode_rs.c b/gnuradio-core/src/lib/reed-solomon/encode_rs.c
new file mode 100644
index 000000000..cd31f32c6
--- /dev/null
+++ b/gnuradio-core/src/lib/reed-solomon/encode_rs.c
@@ -0,0 +1,47 @@
+/* Reed-Solomon encoder
+ * Copyright 2002, Phil Karn, KA9Q
+ * May be used under the terms of the GNU General Public License (GPL)
+ */
+#include <string.h>
+
+#ifdef FIXED
+#include "fixed.h"
+#elif defined(BIGSYM)
+#include "int.h"
+#else
+#include "char.h"
+#endif
+
+void ENCODE_RS(
+#ifndef FIXED
+void *p,
+#endif
+DTYPE *data, DTYPE *bb){
+#ifndef FIXED
+ struct rs *rs = (struct rs *)p;
+#endif
+ unsigned int i, j;
+ DTYPE feedback;
+
+ memset(bb,0,NROOTS*sizeof(DTYPE));
+
+ for(i=0;i<NN-NROOTS;i++){
+ feedback = INDEX_OF[data[i] ^ bb[0]];
+ if(feedback != A0){ /* feedback term is non-zero */
+#ifdef UNNORMALIZED
+ /* This line is unnecessary when GENPOLY[NROOTS] is unity, as it must
+ * always be for the polynomials constructed by init_rs()
+ */
+ feedback = MODNN(NN - GENPOLY[NROOTS] + feedback);
+#endif
+ for(j=1;j<NROOTS;j++)
+ bb[j] ^= ALPHA_TO[MODNN(feedback + GENPOLY[NROOTS-j])];
+ }
+ /* Shift */
+ memmove(&bb[0],&bb[1],sizeof(DTYPE)*(NROOTS-1));
+ if(feedback != A0)
+ bb[NROOTS-1] = ALPHA_TO[MODNN(feedback + GENPOLY[0])];
+ else
+ bb[NROOTS-1] = 0;
+ }
+}
diff --git a/gnuradio-core/src/lib/reed-solomon/encode_rs_ccsds.c b/gnuradio-core/src/lib/reed-solomon/encode_rs_ccsds.c
new file mode 100644
index 000000000..a748b3468
--- /dev/null
+++ b/gnuradio-core/src/lib/reed-solomon/encode_rs_ccsds.c
@@ -0,0 +1,24 @@
+/* This function wraps around the fixed 8-bit encoder, performing the
+ * basis transformations necessary to meet the CCSDS standard
+ *
+ * Copyright 2002, Phil Karn, KA9Q
+ * May be used under the terms of the GNU General Public License (GPL)
+ */
+#define FIXED
+#include "fixed.h"
+#include "ccsds.h"
+
+void encode_rs_ccsds(unsigned char *data,unsigned char *parity){
+ int i;
+ unsigned char cdata[NN-NROOTS];
+
+ /* Convert data from dual basis to conventional */
+ for(i=0;i<NN-NROOTS;i++)
+ cdata[i] = Tal1tab[data[i]];
+
+ encode_rs_8(cdata,parity);
+
+ /* Convert parity from conventional to dual basis */
+ for(i=0;i<NN-NROOTS;i++)
+ parity[i] = Taltab[parity[i]];
+}
diff --git a/gnuradio-core/src/lib/reed-solomon/exercise.c b/gnuradio-core/src/lib/reed-solomon/exercise.c
new file mode 100644
index 000000000..de33a6bff
--- /dev/null
+++ b/gnuradio-core/src/lib/reed-solomon/exercise.c
@@ -0,0 +1,134 @@
+/* Exercise an RS codec a specified number of times using random
+ * data and error patterns
+ *
+ * Copyright 2002 Phil Karn, KA9Q
+ * May be used under the terms of the GNU General Public License (GPL)
+ */
+#define FLAG_ERASURE 1 /* Randomly flag 50% of errors as erasures */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#ifdef FIXED
+#include "fixed.h"
+#define EXERCISE exercise_8
+#elif defined(CCSDS)
+#include "fixed.h"
+#include "ccsds.h"
+#define EXERCISE exercise_ccsds
+#elif defined(BIGSYM)
+#include "int.h"
+#define EXERCISE exercise_int
+#else
+#include "char.h"
+#define EXERCISE exercise_char
+#endif
+
+#ifdef FIXED
+#define PRINTPARM printf("(255,223):");
+#elif defined(CCSDS)
+#define PRINTPARM printf("CCSDS (255,223):");
+#else
+#define PRINTPARM printf("(%d,%d):",rs->nn,rs->nn-rs->nroots);
+#endif
+
+/* Exercise the RS codec passed as an argument */
+int EXERCISE(
+#if !defined(CCSDS) && !defined(FIXED)
+void *p,
+#endif
+int trials){
+#if !defined(CCSDS) && !defined(FIXED)
+ struct rs *rs = (struct rs *)p;
+#endif
+#if MAX_ARRAY
+ DTYPE block[MAX_ARRAY],tblock[MAX_ARRAY];
+ unsigned int i;
+ int errors;
+ int errlocs[MAX_ARRAY];
+ int derrlocs[MAX_ARRAY];
+#else
+ DTYPE block[NN],tblock[NN];
+ unsigned int i;
+ int errors;
+ int errlocs[NN];
+ int derrlocs[NROOTS];
+#endif
+ int derrors;
+ int errval,errloc;
+ int erasures;
+ int decoder_errors = 0;
+
+ while(trials-- != 0){
+ /* Test up to the error correction capacity of the code */
+ for(errors=0;(unsigned int)errors <= NROOTS/2;errors++){
+
+ /* Load block with random data and encode */
+ for(i=0;i<NN-NROOTS;i++)
+ block[i] = random() & NN;
+
+#if defined(CCSDS) || defined(FIXED)
+ ENCODE_RS(&block[0],&block[NN-NROOTS]);
+#else
+ ENCODE_RS(rs,&block[0],&block[NN-NROOTS]);
+#endif
+
+ /* Make temp copy, seed with errors */
+ memcpy(tblock,block,sizeof(tblock));
+ memset(errlocs,0,sizeof(errlocs));
+ memset(derrlocs,0,sizeof(derrlocs));
+ erasures=0;
+ for(i=0;i<(unsigned int)errors;i++){
+ do {
+ errval = random() & NN;
+ } while(errval == 0); /* Error value must be nonzero */
+
+ do {
+ errloc = random() % NN;
+ } while(errlocs[errloc] != 0); /* Must not choose the same location twice */
+
+ errlocs[errloc] = 1;
+
+#if FLAG_ERASURE
+ if(random() & 1) /* 50-50 chance */
+ derrlocs[erasures++] = errloc;
+#endif
+ tblock[errloc] ^= errval;
+ }
+
+ /* Decode the errored block */
+#if defined(CCSDS) || defined(FIXED)
+ derrors = DECODE_RS(tblock,derrlocs,erasures);
+#else
+ derrors = DECODE_RS(rs,tblock,derrlocs,erasures);
+#endif
+
+ if(derrors != errors){
+ PRINTPARM
+ printf(" decoder says %d errors, true number is %d\n",derrors,errors);
+ decoder_errors++;
+ }
+ for(i=0;i<(unsigned int)derrors;i++){
+ if(errlocs[derrlocs[i]] == 0){
+ PRINTPARM
+ printf(" decoder indicates error in location %d without error\n",i);
+ decoder_errors++;
+ }
+ }
+ if(memcmp(tblock,block,sizeof(tblock)) != 0){
+ PRINTPARM
+ printf(" uncorrected errors! output ^ input:");
+ decoder_errors++;
+ for(i=0;i<NN;i++)
+ printf(" %02x",tblock[i] ^ block[i]);
+ printf("\n");
+ }
+ }
+ }
+ return decoder_errors;
+}
diff --git a/gnuradio-core/src/lib/reed-solomon/fixed.h b/gnuradio-core/src/lib/reed-solomon/fixed.h
new file mode 100644
index 000000000..30091e7bf
--- /dev/null
+++ b/gnuradio-core/src/lib/reed-solomon/fixed.h
@@ -0,0 +1,40 @@
+/* Configure the RS codec with fixed parameters for CCSDS standard
+ * (255,223) code over GF(256). Note: the conventional basis is still
+ * used; the dual-basis mappings are performed in [en|de]code_rs_ccsds.c
+ *
+ * Copyright 2002 Phil Karn, KA9Q
+ * May be used under the terms of the GNU General Public License (GPL)
+ */
+#define DTYPE unsigned char
+
+#include <gr_core_api.h>
+
+static inline int mod255(int x){
+ while (x >= 255) {
+ x -= 255;
+ x = (x >> 8) + (x & 255);
+ }
+ return x;
+}
+#define MODNN(x) mod255(x)
+
+extern unsigned char CCSDS_alpha_to[];
+extern unsigned char CCSDS_index_of[];
+extern unsigned char CCSDS_poly[];
+
+#define MM 8
+#define NN 255
+#define ALPHA_TO CCSDS_alpha_to
+#define INDEX_OF CCSDS_index_of
+#define GENPOLY CCSDS_poly
+#define NROOTS 32
+#define FCR 112
+#define PRIM 11
+#define IPRIM 116
+#define A0 (NN)
+
+#define ENCODE_RS encode_rs_8
+#define DECODE_RS decode_rs_8
+
+GR_CORE_API void ENCODE_RS(DTYPE *data,DTYPE *parity);
+GR_CORE_API int DECODE_RS(DTYPE *data, int *eras_pos, int no_eras); \ No newline at end of file
diff --git a/gnuradio-core/src/lib/reed-solomon/gen_ccsds.c b/gnuradio-core/src/lib/reed-solomon/gen_ccsds.c
new file mode 100644
index 000000000..1e4e4f536
--- /dev/null
+++ b/gnuradio-core/src/lib/reed-solomon/gen_ccsds.c
@@ -0,0 +1,34 @@
+/* Generate tables for CCSDS code
+ * Copyright 2002 Phil Karn, KA9Q
+ * May be used under the terms of the GNU General Public License (GPL)
+ */
+#include <stdio.h>
+#include "char.h"
+
+int main(){
+ struct rs *rs;
+ int i;
+
+ rs = init_rs_char(8,0x187,112,11,32); /* CCSDS standard */
+ printf("unsigned char CCSDS_alpha_to[] = {");
+ for(i=0;i<256;i++){
+ if((i % 16) == 0)
+ printf("\n");
+ printf("0x%02x,",rs->alpha_to[i]);
+ }
+ printf("\n};\n\nunsigned char CCSDS_index_of[] = {");
+ for(i=0;i<256;i++){
+ if((i % 16) == 0)
+ printf("\n");
+ printf("%3d,",rs->index_of[i]);
+ }
+ printf("\n};\n\nunsigned char CCSDS_poly[] = {");
+ for(i=0;i<33;i++){
+ if((i % 16) == 0)
+ printf("\n");
+
+ printf("%3d,",rs->genpoly[i]);
+ }
+ printf("\n};\n");
+ exit(0);
+}
diff --git a/gnuradio-core/src/lib/reed-solomon/gen_ccsds_tal.c b/gnuradio-core/src/lib/reed-solomon/gen_ccsds_tal.c
new file mode 100644
index 000000000..9dde18917
--- /dev/null
+++ b/gnuradio-core/src/lib/reed-solomon/gen_ccsds_tal.c
@@ -0,0 +1,50 @@
+/* Conversion lookup tables from conventional alpha to Berlekamp's
+ * dual-basis representation. Used in the CCSDS version only.
+ * taltab[] -- convert conventional to dual basis
+ * tal1tab[] -- convert dual basis to conventional
+
+ * Note: the actual RS encoder/decoder works with the conventional basis.
+ * So data is converted from dual to conventional basis before either
+ * encoding or decoding and then converted back.
+ *
+ * Copyright 2002 Phil Karn, KA9Q
+ * May be used under the terms of the GNU General Public License (GPL)
+ */
+#include <stdio.h>
+unsigned char Taltab[256],Tal1tab[256];
+
+static unsigned char tal[] = { 0x8d, 0xef, 0xec, 0x86, 0xfa, 0x99, 0xaf, 0x7b };
+
+/* Generate conversion lookup tables between conventional alpha representation
+ * (@**7, @**6, ...@**0)
+ * and Berlekamp's dual basis representation
+ * (l0, l1, ...l7)
+ */
+int main(){
+ int i,j,k;
+
+ for(i=0;i<256;i++){/* For each value of input */
+ Taltab[i] = 0;
+ for(j=0;j<8;j++) /* for each column of matrix */
+ for(k=0;k<8;k++){ /* for each row of matrix */
+ if(i & (1<<k))
+ Taltab[i] ^= tal[7-k] & (1<<j);
+ }
+ Tal1tab[Taltab[i]] = i;
+ }
+ printf("unsigned char Taltab[] = {\n");
+ for(i=0;i<256;i++){
+ if((i % 16) == 0)
+ printf("\n");
+ printf("0x%02x,",Taltab[i]);
+ }
+ printf("\n};\n\nunsigned char Tal1tab[] = {");
+ for(i=0;i<256;i++){
+ if((i % 16) == 0)
+ printf("\n");
+ printf("0x%02x,",Tal1tab[i]);
+ }
+ printf("\n};\n");
+ exit(0);
+}
+
diff --git a/gnuradio-core/src/lib/reed-solomon/init_rs.c b/gnuradio-core/src/lib/reed-solomon/init_rs.c
new file mode 100644
index 000000000..4ec77cd72
--- /dev/null
+++ b/gnuradio-core/src/lib/reed-solomon/init_rs.c
@@ -0,0 +1,129 @@
+/* Initialize a RS codec
+ *
+ * Copyright 2002 Phil Karn, KA9Q
+ * May be used under the terms of the GNU General Public License (GPL)
+ */
+#include <stdlib.h>
+
+#ifdef CCSDS
+#include "ccsds.h"
+#elif defined(BIGSYM)
+#include "int.h"
+#else
+#include "char.h"
+#endif
+
+#define NULL ((void *)0)
+
+void FREE_RS(void *p){
+ struct rs *rs = (struct rs *)p;
+
+ free(rs->alpha_to);
+ free(rs->index_of);
+ free(rs->genpoly);
+ free(rs);
+}
+
+/* Initialize a Reed-Solomon codec
+ * symsize = symbol size, bits (1-8)
+ * gfpoly = Field generator polynomial coefficients
+ * fcr = first root of RS code generator polynomial, index form
+ * prim = primitive element to generate polynomial roots
+ * nroots = RS code generator polynomial degree (number of roots)
+ */
+void *INIT_RS(unsigned int symsize,unsigned int gfpoly,unsigned fcr,unsigned prim,
+ unsigned int nroots){
+ struct rs *rs;
+ int sr,root,iprim;
+ unsigned int i, j;
+
+ if(symsize > 8*sizeof(DTYPE))
+ return NULL; /* Need version with ints rather than chars */
+
+ if(fcr >= (1u<<symsize))
+ return NULL;
+ if(prim == 0 || prim >= (1u<<symsize))
+ return NULL;
+ if(nroots >= (1u<<symsize))
+ return NULL; /* Can't have more roots than symbol values! */
+
+ rs = (struct rs *)calloc(1,sizeof(struct rs));
+ rs->mm = symsize;
+ rs->nn = (1<<symsize)-1;
+
+ rs->alpha_to = (DTYPE *)malloc(sizeof(DTYPE)*(rs->nn+1));
+ if(rs->alpha_to == NULL){
+ free(rs);
+ return NULL;
+ }
+ rs->index_of = (DTYPE *)malloc(sizeof(DTYPE)*(rs->nn+1));
+ if(rs->index_of == NULL){
+ free(rs->alpha_to);
+ free(rs);
+ return NULL;
+ }
+
+ /* Generate Galois field lookup tables */
+ rs->index_of[0] = A0; /* log(zero) = -inf */
+ rs->alpha_to[A0] = 0; /* alpha**-inf = 0 */
+ sr = 1;
+ for(i=0;i<rs->nn;i++){
+ rs->index_of[sr] = i;
+ rs->alpha_to[i] = sr;
+ sr <<= 1;
+ if(sr & (1<<symsize))
+ sr ^= gfpoly;
+ sr &= rs->nn;
+ }
+ if(sr != 1){
+ /* field generator polynomial is not primitive! */
+ free(rs->alpha_to);
+ free(rs->index_of);
+ free(rs);
+ return NULL;
+ }
+
+ /* Form RS code generator polynomial from its roots */
+ rs->genpoly = (DTYPE *)malloc(sizeof(DTYPE)*(nroots+1));
+ if(rs->genpoly == NULL){
+ free(rs->alpha_to);
+ free(rs->index_of);
+ free(rs);
+ return NULL;
+ }
+ rs->fcr = fcr;
+ rs->prim = prim;
+ rs->nroots = nroots;
+
+ /* Find prim-th root of 1, used in decoding */
+ for(iprim=1;(iprim % prim) != 0;iprim += rs->nn)
+ ;
+ rs->iprim = iprim / prim;
+
+ rs->genpoly[0] = 1;
+ for (i = 0,root=fcr*prim; i < nroots; i++,root += prim) {
+ rs->genpoly[i+1] = 1;
+
+ /* Multiply rs->genpoly[] by @**(root + x) */
+ for (j = i; j > 0; j--){
+ if (rs->genpoly[j] != 0)
+ rs->genpoly[j] = rs->genpoly[j-1] ^ rs->alpha_to[modnn(rs,rs->index_of[rs->genpoly[j]] + root)];
+ else
+ rs->genpoly[j] = rs->genpoly[j-1];
+ }
+ /* rs->genpoly[0] can never be zero */
+ rs->genpoly[0] = rs->alpha_to[modnn(rs,rs->index_of[rs->genpoly[0]] + root)];
+ }
+ /* convert rs->genpoly[] to index form for quicker encoding */
+ for (i = 0; i <= nroots; i++)
+ rs->genpoly[i] = rs->index_of[rs->genpoly[i]];
+
+#if 0
+ printf ("genpoly:\n");
+ for (i = nroots; i >= 0; i--){
+ printf (" %3d*X^%d\n", rs->alpha_to[rs->genpoly[i]], i);
+ }
+#endif
+
+ return rs;
+}
diff --git a/gnuradio-core/src/lib/reed-solomon/int.h b/gnuradio-core/src/lib/reed-solomon/int.h
new file mode 100644
index 000000000..403d68757
--- /dev/null
+++ b/gnuradio-core/src/lib/reed-solomon/int.h
@@ -0,0 +1,55 @@
+/* Include file to configure the RS codec for integer symbols
+ *
+ * Copyright 2002, Phil Karn, KA9Q
+ * May be used under the terms of the GNU General Public License (GPL)
+ */
+#define DTYPE int
+
+#include <gr_core_api.h>
+
+/* Reed-Solomon codec control block */
+struct GR_CORE_API rs {
+ unsigned int mm; /* Bits per symbol */
+ unsigned int nn; /* Symbols per block (= (1<<mm)-1) */
+ int *alpha_to; /* log lookup table */
+ int *index_of; /* Antilog lookup table */
+ int *genpoly; /* Generator polynomial */
+ unsigned int nroots; /* Number of generator roots = number of parity symbols */
+ unsigned int fcr; /* First consecutive root, index form */
+ unsigned int prim; /* Primitive element, index form */
+ unsigned int iprim; /* prim-th root of 1, index form */
+};
+
+static inline int modnn(struct rs *rs,int x){
+ while (x >= rs->nn) {
+ x -= rs->nn;
+ x = (x >> rs->mm) + (x & rs->nn);
+ }
+ return x;
+}
+#define MODNN(x) modnn(rs,x)
+
+#define MM (rs->mm)
+#define NN (rs->nn)
+#define ALPHA_TO (rs->alpha_to)
+#define INDEX_OF (rs->index_of)
+#define GENPOLY (rs->genpoly)
+#define NROOTS (rs->nroots)
+#define FCR (rs->fcr)
+#define PRIM (rs->prim)
+#define IPRIM (rs->iprim)
+#define A0 (NN)
+
+#define ENCODE_RS encode_rs_int
+#define DECODE_RS decode_rs_int
+#define INIT_RS init_rs_int
+#define FREE_RS free_rs_int
+
+GR_CORE_API void ENCODE_RS(void *p,DTYPE *data,DTYPE *parity);
+GR_CORE_API int DECODE_RS(void *p,DTYPE *data,int *eras_pos,int no_eras);
+void *INIT_RS(unsigned int symsize,unsigned int gfpoly,unsigned int fcr,
+ unsigned int prim,unsigned int nroots);
+GR_CORE_API void FREE_RS(void *p);
+
+
+
diff --git a/gnuradio-core/src/lib/reed-solomon/rs.3 b/gnuradio-core/src/lib/reed-solomon/rs.3
new file mode 100644
index 000000000..c3953ce57
--- /dev/null
+++ b/gnuradio-core/src/lib/reed-solomon/rs.3
@@ -0,0 +1,170 @@
+.TH REED-SOLOMON 3
+.SH NAME
+init_rs_int, encode_rs_int, decode_rs_int, free_rs_int,
+init_rs_char, encode_rs_char, decode_rs_char, free_rs_char,
+encode_rs_8, decode_rs_8, encode_rs_ccsds, decode_rs_ccsds
+.SH SYNOPSIS
+.nf
+.ft B
+#include "rs.h"
+
+void *init_rs_int(unsigned int symsize,unsigned int gfpoly,unsigned fcr,
+unsigned prim,unsigned int nroots);
+void encode_rs_int(void *rs,int *data,int *parity);
+int decode_rs_int(void *rs,int *data,int *eras_pos,int no_eras);
+void free_rs_int(void *rs);
+
+void *init_rs_char(unsigned int symsize,unsigned int gfpoly,unsigned fcr,
+unsigned prim,unsigned int nroots);
+void encode_rs_char(void *rs,unsigned char *data,unsigned char *parity);
+int decode_rs_char(void *rs,unsigned char *data,int *eras_pos,int no_eras);
+void free_rs_char(void *rs);
+
+void encode_rs_8(unsigned char *data,unsigned char *parity);
+int decode_rs_8(unsigned char *data,int *eras_pos,int no_eras);
+
+void encode_rs_ccsds(unsigned char *data,unsigned char *parity);
+int decode_rs_ccsds(unsigned char *data,int *eras_pos,int no_eras);
+
+unsigned char Taltab[256];
+unsigned char Tal1tab[256];
+
+.fi
+
+.SH DESCRIPTION
+These functions implement Reed-Solomon error control encoding and
+decoding. For optimal performance in a variety of applications, three
+sets of functions are supplied. To access these functions, add "-lrs"
+to your linker command line.
+
+The functions with names ending in "_int" handle data in integer arrays,
+permitting arbitrarily large codewords limited only by machine
+resources.
+
+The functions with names ending in "_char" take unsigned char arrays and can
+handle codes with symbols of 8 bits or less (i.e., with codewords of
+255 symbols or less).
+
+\fBencode_rs_8\fR and \fBdecode_rs_8\fR implement a specific
+(255,223) code with 8-bit symbols specified by the CCSDS:
+a field generator of 1 + X + X^2 + X^7 + X^8 and a code
+generator with first consecutive root = 112 and a primitive element of
+11. These functions use the conventional
+polynomial form, \fBnot\fR the dual-basis specified in
+the CCSDS standard, to represent symbols.
+
+For full CCSDS compatibility, \fBencode_rs_ccsds\fR and
+\fBdecode_rs_ccsds\fR are provided. These functions use two lookup
+tables, \fBTaltab\fR to convert from conventional to dual-basis, and
+\fBTal1tab\fR to perform the inverse mapping from dual-basis to
+conventional form, before and after calls to \fBencode_rs_8\fR
+and \fBdecode_rs_8\fR.
+
+The _8 and _ccsds functions do not require initialization.
+To use the general purpose RS encoder or decoder (i.e.,
+the _char or _int versions), the user must first
+call \fBinit_rs_int\fR or \fBinit_rs_char\fR as appropriate. The
+arguments are as follows:
+
+\fBsymsize\fR gives the symbol size in bits, up to 8 for \fBinit_rs_char\fR
+or 32 for \fBinit_rs_int\fR on a machine with 32-bit ints (though such a
+huge code would exhaust memory limits on a 32-bit machine). The resulting
+Reed-Solomon code word will have 2^\fBsymsize\fR - 1 symbols,
+each containing \fBsymsize\fR bits.
+
+\fBgfpoly\fR gives the extended Galois field generator polynomial coefficients,
+with the 0th coefficient in the low order bit. The polynomial
+\fImust\fR be primitive; if not, the call will fail and NULL will be
+returned.
+
+\fBfcr\fR gives, in index form, the first consecutive root of the
+Reed Solomon code generator polynomial.
+
+\fBprim\fR gives, in index form, the primitive element in the Galois field
+used to generate the Reed Solomon code generator polynomial.
+
+\fBnroots\fR gives the number of roots in the Reed Solomon code
+generator polynomial. This equals the number of parity symbols
+per code block.
+
+The resulting Reed-Solomon code has parameters (N,K), where
+N = 2^\fBsymsize\fR-1 and K = N-\fBnroots\fR.
+
+The \fBencode_rs_char\fR and \fBencode_rs_int\fR functions accept
+the pointer returned by \fBinit_rs_char\fR or
+\fBinit_rs_int\fR, respectively, to
+encode a block of data using the specified code.
+The input data array is expected to
+contain K symbols (of \fBsymsize\fR bits each, right justified
+in each char or int) and \fBnroots\fR parity symbols will be placed
+into the \fBparity\fR array, right justified.
+
+The \fBdecode_rs_char\fR and \fBdecode_rs_int\fR functions correct
+the errors in a Reed-Solomon codeword up to the capability of the code.
+An optional list of "erased" symbol indices may be given in the \fBeras_pos\fR
+array to assist the decoder; this parameter may be NULL if no erasures
+are given. The number of erased symbols must be given in the \fBno_eras\fR
+parameter.
+
+To maximize performance, the encode and decode functions perform no
+"sanity checking" of their inputs. Decoder failure may result if
+\fBeras_pos\fR contains duplicate entries, and both encoder and
+decoder will fail if an input symbol exceeds its allowable range.
+(Symbol range overflow cannot occur with the _8 or _ccsds functions,
+or with the _char functions when 8-bit symbols are specified.)
+
+The decoder corrects the symbols "in place", returning the number
+of symbols in error. If the codeword is uncorrectable, -1 is returned
+and the data block is unchanged. If \fBeras_pos\fR is non-null, it is
+used to return a list of corrected symbol positions, in no particular
+order. This means that the
+array passed through this parameter \fImust\fR have at least \fBnroots\fR
+elements to prevent a possible buffer overflow.
+
+The \fBfree_rs_int\fR and \fBfree_rs_char\fR functions free the internal
+space allocated by the \fBinit_rs_int\fR and \fBinit_rs_char\fR functions,
+respecitively.
+
+The functions \fBencode_rs_8\fR and \fBdecode_rs_8\fR do not have
+corresponding \fBinit\fR and \fBfree\fR, nor do they take the
+\fBrs\fR argument accepted by the other functions as their parameters
+are statically compiled. These functions implement a code
+equivalent to calling
+
+\fBinit_rs_char\fR(8,0x187,112,11,32);
+
+and using the resulting pointer with \fBencode_rs_char\fR and
+\fBdecode_rs_char\fR.
+
+.SH RETURN VALUES
+\fBinit_rs_int\fR and \fBinit_rs_char\fR return a pointer to an internal
+control structure that must be passed to the corresponding encode, decode
+and free functions. These functions return NULL on error.
+
+The decode functions return a count of corrected
+symbols, or -1 if the block was uncorrectible.
+
+.SH AUTHOR
+Phil Karn, KA9Q (karn@ka9q.net), based heavily on earlier work by Robert
+Morelos-Zaragoza (rober@spectra.eng.hawaii.edu) and Hari Thirumoorthy
+(harit@spectra.eng.hawaii.edu).
+
+.SH COPYRIGHT
+Copyright 2002, Phil Karn, KA9Q. May be used under the terms of the
+GNU General Public License (GPL).
+
+.SH SEE ALSO
+CCSDS 101.0-B-5: Telemetry Channel Coding.
+http://www.ccsds.org/documents/pdf/CCSDS-101.0-B-5.pdf
+
+.SH NOTE
+CCSDS chose the "dual basis" symbol representation because it
+simplified the implementation of a Reed-Solomon encoder in dedicated
+hardware. However, this approach holds no advantages for a software
+implementation on a general purpose computer, so use of the dual basis
+is recommended only if compatibility with the CCSDS standard is needed,
+e.g., to decode data from an existing spacecraft using the CCSDS
+standard. If you just want a fast (255,223) RS codec without needing
+to interoperate with a CCSDS standard code, use \fBencode_rs_8\fR
+and \fBdecode_rs_8\fR.
+
diff --git a/gnuradio-core/src/lib/reed-solomon/rs.h b/gnuradio-core/src/lib/reed-solomon/rs.h
new file mode 100644
index 000000000..97e78769e
--- /dev/null
+++ b/gnuradio-core/src/lib/reed-solomon/rs.h
@@ -0,0 +1,31 @@
+#include <gr_core_api.h>
+/* User include file for the Reed-Solomon codec
+ * Copyright 2002, Phil Karn KA9Q
+ * May be used under the terms of the GNU General Public License (GPL)
+ */
+
+/* General purpose RS codec, 8-bit symbols */
+GR_CORE_API void encode_rs_char(void *rs,unsigned char *data,unsigned char *parity);
+GR_CORE_API int decode_rs_char(void *rs,unsigned char *data,int *eras_pos,
+ int no_eras);
+GR_CORE_API void *init_rs_char(unsigned int symsize,unsigned int gfpoly,
+ unsigned int fcr,unsigned int prim,unsigned int nroots);
+GR_CORE_API void free_rs_char(void *rs);
+
+/* General purpose RS codec, integer symbols */
+GR_CORE_API void encode_rs_int(void *rs,int *data,int *parity);
+GR_CORE_API int decode_rs_int(void *rs,int *data,int *eras_pos,int no_eras);
+GR_CORE_API void *init_rs_int(unsigned int symsize,unsigned int gfpoly,unsigned int fcr,
+ unsigned int prim,unsigned int nroots);
+GR_CORE_API void free_rs_int(void *rs);
+
+/* CCSDS standard (255,223) RS codec with conventional (*not* dual-basis)
+ * symbol representation
+ */
+GR_CORE_API void encode_rs_8(unsigned char *data,unsigned char *parity);
+GR_CORE_API int decode_rs_8(unsigned char *data,int *eras_pos,int no_eras);
+
+/* Tables to map from conventional->dual (Taltab) and
+ * dual->conventional (Tal1tab) bases
+ */
+extern unsigned char Taltab[],Tal1tab[];
diff --git a/gnuradio-core/src/lib/reed-solomon/rstest.c b/gnuradio-core/src/lib/reed-solomon/rstest.c
new file mode 100644
index 000000000..d8fc5448a
--- /dev/null
+++ b/gnuradio-core/src/lib/reed-solomon/rstest.c
@@ -0,0 +1,117 @@
+/* Test the Reed-Solomon codecs
+ * for various block sizes and with random data and random error patterns
+ *
+ * Copyright 2002 Phil Karn, KA9Q
+ * May be used under the terms of the GNU General Public License (GPL)
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include "rs.h"
+
+int exercise_char(void *,int);
+
+#ifdef ALL_VERSIONS
+int exercise_int(void *,int);
+int exercise_8(int);
+int exercise_ccsds(int);
+#endif
+
+struct {
+ int symsize;
+ int genpoly;
+ int fcs;
+ int prim;
+ int nroots;
+ int ntrials;
+} Tab[] = {
+ {2, 0x7, 1, 1, 1, 10 },
+ {3, 0xb, 1, 1, 2, 10 },
+ {4, 0x13, 1, 1, 4, 10 },
+ {5, 0x25, 1, 1, 6, 10 },
+ {6, 0x43, 1, 1, 8, 10 },
+ {7, 0x89, 1, 1, 10, 10 },
+ {8, 0x11d, 1, 1, 32, 10 },
+ {8, 0x187, 112,11, 32, 10 }, /* Duplicates CCSDS codec */
+#ifdef ALL_VESIONS
+ {9, 0x211, 1, 1, 32, 10 },
+ {10,0x409, 1, 1, 32, 10 },
+ {11,0x805, 1, 1, 32, 10 },
+ {12,0x1053, 1, 1, 32, 5 },
+ {13,0x201b, 1, 1, 32, 2 },
+ {14,0x4443, 1, 1, 32, 1 },
+ {15,0x8003, 1, 1, 32, 1 },
+ {16,0x1100b, 1, 1, 32, 1 },
+#endif
+ {0, 0, 0, 0, 0},
+};
+
+int main(){
+ void *handle;
+ int errs,terrs;
+ int i;
+
+ terrs = 0;
+ srandom(time(NULL));
+
+#ifdef ALL_VERSIONS
+ printf("Testing fixed (255,223) RS codec...");
+ fflush(stdout);
+ errs = exercise_8(10);
+ terrs += errs;
+ if(errs == 0){
+ printf("OK\n");
+ }
+ printf("Testing CCSDS standard (255,223) RS codec...");
+ fflush(stdout);
+ errs = exercise_ccsds(10);
+ terrs += errs;
+ if(errs == 0){
+ printf("OK\n");
+ }
+#endif
+
+ for(i=0;Tab[i].symsize != 0;i++){
+ int nn,kk;
+
+ nn = (1<<Tab[i].symsize) - 1;
+ kk = nn - Tab[i].nroots;
+ printf("Testing (%d,%d) RS codec...",nn,kk);
+ fflush(stdout);
+ if(Tab[i].symsize <= 8){
+ if((handle = init_rs_char(Tab[i].symsize,Tab[i].genpoly,Tab[i].fcs,Tab[i].prim,Tab[i].nroots)) == NULL){
+ printf("init_rs_char failed!\n");
+ continue;
+ }
+ errs = exercise_char(handle,Tab[i].ntrials);
+ } else {
+#ifdef ALL_VERSIONS
+ if((handle = init_rs_int(Tab[i].symsize,Tab[i].genpoly,Tab[i].fcs,Tab[i].prim,Tab[i].nroots)) == NULL){
+ printf("init_rs_int failed!\n");
+ continue;
+ }
+ errs = exercise_int(handle,Tab[i].ntrials);
+#else
+ printf ("init_rs_init support is not enabled\n");
+ exit (1);
+#endif
+
+ }
+ terrs += errs;
+ if(errs == 0){
+ printf("OK\n");
+ }
+ free_rs_char(handle);
+ }
+ if(terrs == 0)
+ printf("All codec tests passed!\n");
+
+ exit(0);
+}
+
+
diff --git a/gnuradio-core/src/lib/runtime/CMakeLists.txt b/gnuradio-core/src/lib/runtime/CMakeLists.txt
new file mode 100644
index 000000000..5f2c317c4
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/CMakeLists.txt
@@ -0,0 +1,187 @@
+# Copyright 2010-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.
+
+########################################################################
+# This file included, use CMake directory variables
+########################################################################
+
+########################################################################
+# Control availability of vmcircbuf methods.
+# For now, only allows disabling of shm methods, which cause uncatchable
+# segmentation faults on Cygwin with gcc 4.x (x <= 5)
+# Usage:
+# GR_VMCIRCBUF()
+#
+# Will set TRY_SHM_VMCIRCBUF to 1 by default except on Windows machines.
+# Can manually set with -DTRY_SHM_VMCIRCBUF=0|1
+########################################################################
+
+ if(WIN32)
+ OPTION(TRY_SHM_VMCIRCBUF "Try SHM VMCIRCBUF" OFF)
+ else(WIN32)
+ OPTION(TRY_SHM_VMCIRCBUF "Try SHM VMCIRCBUF" ON)
+ endif(WIN32)
+
+ message(STATUS "TRY_SHM_VMCIRCBUF set to ${TRY_SHM_VMCIRCBUF}.")
+
+ if(TRY_SHM_VMCIRCBUF)
+ add_definitions( -DTRY_SHM_VMCIRCBUF )
+ endif(TRY_SHM_VMCIRCBUF)
+
+########################################################################
+# Append gnuradio-core library sources
+########################################################################
+list(APPEND gnuradio_core_sources
+ #${CMAKE_CURRENT_SOURCE_DIR}/gr_basic_block.cc
+ #${CMAKE_CURRENT_SOURCE_DIR}/gr_flowgraph.cc
+ #${CMAKE_CURRENT_SOURCE_DIR}/gr_flat_flowgraph.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_block.cc
+ #${CMAKE_CURRENT_SOURCE_DIR}/gr_block_detail.cc
+ #${CMAKE_CURRENT_SOURCE_DIR}/gr_block_executor.cc
+ #${CMAKE_CURRENT_SOURCE_DIR}/gr_block_registry.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_hier_block2.cc
+ #${CMAKE_CURRENT_SOURCE_DIR}/gr_hier_block2_detail.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_buffer.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_dispatcher.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_error_handler.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_io_signature.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_local_sighandler.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_message.cc
+ #${CMAKE_CURRENT_SOURCE_DIR}/gr_msg_accepter.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_msg_handler.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_msg_queue.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_pagesize.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_preferences.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_realtime.cc
+ #${CMAKE_CURRENT_SOURCE_DIR}/gr_scheduler.cc
+ #${CMAKE_CURRENT_SOURCE_DIR}/gr_scheduler_sts.cc
+ #${CMAKE_CURRENT_SOURCE_DIR}/gr_scheduler_tpb.cc
+ #${CMAKE_CURRENT_SOURCE_DIR}/gr_single_threaded_scheduler.cc
+ #${CMAKE_CURRENT_SOURCE_DIR}/gr_sptr_magic.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_sync_block.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_sync_decimator.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_sync_interpolator.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_sys_paths.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_top_block.cc
+ #${CMAKE_CURRENT_SOURCE_DIR}/gr_top_block_impl.cc
+ #${CMAKE_CURRENT_SOURCE_DIR}/gr_tpb_detail.cc
+ #${CMAKE_CURRENT_SOURCE_DIR}/gr_tpb_thread_body.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_vmcircbuf.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_vmcircbuf_mmap_shm_open.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_vmcircbuf_mmap_tmpfile.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_vmcircbuf_createfilemapping.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_vmcircbuf_sysv_shm.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_select_handler.cc
+)
+
+########################################################################
+# Append gnuradio-core test sources
+########################################################################
+list(APPEND test_gnuradio_core_sources
+ ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_block.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_hier_block2.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_hier_block2_derived.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_buffer.cc
+ #${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_flowgraph.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_top_block.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_io_signature.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_vmcircbuf.cc
+ #${CMAKE_CURRENT_SOURCE_DIR}/qa_block_tags.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/qa_runtime.cc
+ #${CMAKE_CURRENT_SOURCE_DIR}/qa_set_msg_handler.cc
+)
+
+########################################################################
+# Install runtime headers
+########################################################################
+install(FILES
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_basic_block.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_flowgraph.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_flat_flowgraph.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_block.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_block_detail.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_block_executor.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_block_registry.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_hier_block2.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_hier_block2_detail.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_buffer.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_complex.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_dispatcher.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_error_handler.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_io_signature.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_local_sighandler.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_message.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_msg_accepter.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_msg_handler.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_msg_queue.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_pagesize.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_preferences.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_realtime.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_runtime_types.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_scheduler.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_scheduler_sts.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_scheduler_tpb.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_select_handler.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_single_threaded_scheduler.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_sptr_magic.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_sync_block.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_sync_decimator.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_sync_interpolator.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_top_block.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_top_block_impl.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_tpb_detail.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_tpb_thread_body.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_timer.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_sys_paths.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_types.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_unittests.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_vmcircbuf.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_tags.h
+ DESTINATION ${GR_INCLUDE_DIR}/gnuradio
+ COMPONENT "core_devel"
+)
+
+########################################################################
+# Install swig headers
+########################################################################
+if(ENABLE_PYTHON)
+install(FILES
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_basic_block.i
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_block.i
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_block_detail.i
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_hier_block2.i
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_buffer.i
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_dispatcher.i
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_error_handler.i
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_io_signature.i
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_message.i
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_msg_handler.i
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_msg_queue.i
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_realtime.i
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_single_threaded_scheduler.i
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_sync_block.i
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_sync_decimator.i
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_sync_interpolator.i
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_tags.i
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_top_block.i
+ ${CMAKE_CURRENT_SOURCE_DIR}/runtime.i
+ DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig
+ COMPONENT "core_swig"
+)
+endif(ENABLE_PYTHON)
diff --git a/gnuradio-core/src/lib/runtime/gr_basic_block.cc b/gnuradio-core/src/lib/runtime/gr_basic_block.cc
new file mode 100644
index 000000000..6ff57a1d6
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_basic_block.cc
@@ -0,0 +1,227 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006,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 <gr_basic_block.h>
+#include <gr_block_registry.h>
+#include <stdexcept>
+#include <sstream>
+#include <iostream>
+
+using namespace pmt;
+
+static long s_next_id = 0;
+static long s_ncurrently_allocated = 0;
+
+long
+gr_basic_block_ncurrently_allocated()
+{
+ return s_ncurrently_allocated;
+}
+
+gr_basic_block::gr_basic_block(const std::string &name,
+ gr_io_signature_sptr input_signature,
+ gr_io_signature_sptr output_signature)
+ : d_name(name),
+ d_input_signature(input_signature),
+ d_output_signature(output_signature),
+ d_unique_id(s_next_id++),
+ d_symbolic_id(global_block_registry.block_register(this)),
+ d_symbol_name(global_block_registry.register_symbolic_name(this)),
+ d_color(WHITE),
+ message_subscribers(pmt::pmt_make_dict())
+{
+ s_ncurrently_allocated++;
+}
+
+gr_basic_block::~gr_basic_block()
+{
+ s_ncurrently_allocated--;
+ global_block_registry.block_unregister(this);
+}
+
+gr_basic_block_sptr
+gr_basic_block::to_basic_block()
+{
+ return shared_from_this();
+}
+
+void
+gr_basic_block::set_block_alias(std::string name)
+{
+ global_block_registry.register_symbolic_name(this, name);
+}
+
+// ** Message passing interface **
+
+// - register a new input message port
+void
+gr_basic_block::message_port_register_in(pmt::pmt_t port_id)
+{
+ if(!pmt::pmt_is_symbol(port_id)) {
+ throw std::runtime_error("message_port_register_in: bad port id");
+ }
+ msg_queue[port_id] = msg_queue_t();
+ msg_queue_ready[port_id] = boost::shared_ptr<boost::condition_variable>(new boost::condition_variable());
+}
+
+pmt::pmt_t
+gr_basic_block::message_ports_in()
+{
+ pmt::pmt_t port_names = pmt::pmt_make_vector(msg_queue.size(), pmt::PMT_NIL);
+ msg_queue_map_itr itr = msg_queue.begin();
+ for(size_t i = 0; i < msg_queue.size(); i++) {
+ pmt::pmt_vector_set(port_names, i, (*itr).first);
+ itr++;
+ }
+ return port_names;
+}
+
+// - register a new output message port
+void
+gr_basic_block::message_port_register_out(pmt::pmt_t port_id)
+{
+ if(!pmt::pmt_is_symbol(port_id)) {
+ throw std::runtime_error("message_port_register_out: bad port id");
+ }
+ if(pmt::pmt_dict_has_key(message_subscribers, port_id)) {
+ throw std::runtime_error("message_port_register_out: port already in use");
+ }
+ message_subscribers = pmt::pmt_dict_add(message_subscribers, port_id, pmt::PMT_NIL);
+}
+
+pmt::pmt_t
+gr_basic_block::message_ports_out()
+{
+ size_t len = pmt::pmt_length(message_subscribers);
+ pmt::pmt_t port_names = pmt::pmt_make_vector(len, pmt::PMT_NIL);
+ pmt::pmt_t keys = pmt::pmt_dict_keys(message_subscribers);
+ for(size_t i = 0; i < len; i++) {
+ pmt::pmt_vector_set(port_names, i, pmt::pmt_nth(i, keys));
+ }
+ return port_names;
+}
+
+// - publish a message on a message port
+void gr_basic_block::message_port_pub(pmt::pmt_t port_id, pmt::pmt_t msg)
+{
+ if(!pmt::pmt_dict_has_key(message_subscribers, port_id)) {
+ throw std::runtime_error("port does not exist");
+ }
+
+ pmt::pmt_t currlist = pmt::pmt_dict_ref(message_subscribers, port_id, pmt::PMT_NIL);
+ // iterate through subscribers on port
+ while(pmt::pmt_is_pair(currlist)) {
+ pmt::pmt_t target = pmt::pmt_car(currlist);
+
+ pmt::pmt_t block = pmt::pmt_car(target);
+ pmt::pmt_t port = pmt::pmt_cdr(target);
+
+ currlist = pmt::pmt_cdr(currlist);
+ gr_basic_block_sptr blk = global_block_registry.block_lookup(block);
+ //blk->post(msg);
+ blk->post(port, msg);
+ }
+}
+
+// - subscribe to a message port
+void
+gr_basic_block::message_port_sub(pmt::pmt_t port_id, pmt::pmt_t target){
+ if(!pmt::pmt_dict_has_key(message_subscribers, port_id)){
+ std::stringstream ss;
+ ss << "Port does not exist: \"" << pmt::pmt_write_string(port_id) << "\" on block: " << pmt::pmt_write_string(target) << std::endl;
+ throw std::runtime_error(ss.str());
+ }
+ pmt::pmt_t currlist = pmt::pmt_dict_ref(message_subscribers,port_id,pmt::PMT_NIL);
+
+ // ignore re-adds of the same target
+ if(!pmt::pmt_list_has(currlist, target))
+ message_subscribers = pmt::pmt_dict_add(message_subscribers,port_id,pmt::pmt_list_add(currlist,target));
+}
+
+void
+gr_basic_block::message_port_unsub(pmt::pmt_t port_id, pmt::pmt_t target){
+ if(!pmt::pmt_dict_has_key(message_subscribers, port_id)){
+ std::stringstream ss;
+ ss << "Port does not exist: \"" << pmt::pmt_write_string(port_id) << "\" on block: " << pmt::pmt_write_string(target) << std::endl;
+ throw std::runtime_error(ss.str());
+ }
+
+ // ignore unsubs of unknown targets
+ pmt::pmt_t currlist = pmt::pmt_dict_ref(message_subscribers,port_id,pmt::PMT_NIL);
+ message_subscribers = pmt::pmt_dict_add(message_subscribers,port_id,pmt::pmt_list_rm(currlist,target));
+}
+
+void
+gr_basic_block::_post(pmt_t which_port, pmt_t msg)
+{
+ insert_tail(which_port, msg);
+}
+
+void
+gr_basic_block::insert_tail(pmt::pmt_t which_port, pmt::pmt_t msg)
+{
+ gruel::scoped_lock guard(mutex);
+
+ if( (msg_queue.find(which_port) == msg_queue.end()) || (msg_queue_ready.find(which_port) == msg_queue_ready.end())){
+ std::cout << "target port = " << pmt::pmt_symbol_to_string(which_port) << std::endl;
+ throw std::runtime_error("attempted to insert_tail on invalid queue!");
+ }
+
+ msg_queue[which_port].push_back(msg);
+ msg_queue_ready[which_port]->notify_one();
+
+ // wake up thread if BLKD_IN or BLKD_OUT
+ global_block_registry.notify_blk(alias());
+}
+
+pmt_t
+gr_basic_block::delete_head_nowait(pmt::pmt_t which_port)
+{
+ gruel::scoped_lock guard(mutex);
+
+ if (empty_p(which_port)){
+ return pmt::pmt_t();
+ }
+
+ pmt_t m(msg_queue[which_port].front());
+ msg_queue[which_port].pop_front();
+
+ return m;
+}
+
+pmt_t
+gr_basic_block::delete_head_blocking(pmt::pmt_t which_port)
+{
+ gruel::scoped_lock guard(mutex);
+
+ while (empty_p(which_port)){
+ msg_queue_ready[which_port]->wait(guard);
+ }
+
+ pmt_t m(msg_queue[which_port].front());
+ msg_queue[which_port].pop_front();
+ return m;
+}
diff --git a/gnuradio-core/src/lib/runtime/gr_basic_block.h b/gnuradio-core/src/lib/runtime/gr_basic_block.h
new file mode 100644
index 000000000..024159c4c
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_basic_block.h
@@ -0,0 +1,299 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006,2008,2009,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.
+ */
+
+#ifndef INCLUDED_GR_BASIC_BLOCK_H
+#define INCLUDED_GR_BASIC_BLOCK_H
+
+#include <gr_core_api.h>
+#include <gr_runtime_types.h>
+#include <gr_sptr_magic.h>
+#include <boost/enable_shared_from_this.hpp>
+#include <boost/function.hpp>
+#include <gr_msg_accepter.h>
+#include <string>
+#include <deque>
+#include <map>
+#include <gr_io_signature.h>
+#include <gruel/thread.h>
+#include <boost/foreach.hpp>
+#include <boost/thread/condition_variable.hpp>
+#include <iostream>
+
+/*!
+ * \brief The abstract base class for all signal processing blocks.
+ * \ingroup internal
+ *
+ * Basic blocks are the bare abstraction of an entity that has a name,
+ * a set of inputs and outputs, and a message queue. These are never instantiated
+ * directly; rather, this is the abstract parent class of both gr_hier_block,
+ * which is a recursive container, and gr_block, which implements actual
+ * signal processing functions.
+ */
+
+class GR_CORE_API gr_basic_block : public gr_msg_accepter, public boost::enable_shared_from_this<gr_basic_block>
+{
+ typedef boost::function<void(pmt::pmt_t)> msg_handler_t;
+
+ private:
+
+ //msg_handler_t d_msg_handler;
+ typedef std::map<pmt::pmt_t , msg_handler_t, pmt::pmt_comperator> d_msg_handlers_t;
+ d_msg_handlers_t d_msg_handlers;
+
+ typedef std::deque<pmt::pmt_t> msg_queue_t;
+ typedef std::map<pmt::pmt_t, msg_queue_t, pmt::pmt_comperator> msg_queue_map_t;
+ typedef std::map<pmt::pmt_t, msg_queue_t, pmt::pmt_comperator>::iterator msg_queue_map_itr;
+ std::map<pmt::pmt_t, boost::shared_ptr<boost::condition_variable>, pmt::pmt_comperator> msg_queue_ready;
+
+ gruel::mutex mutex; //< protects all vars
+
+ protected:
+ friend class gr_flowgraph;
+ friend class gr_flat_flowgraph; // TODO: will be redundant
+ friend class gr_tpb_thread_body;
+
+ enum vcolor { WHITE, GREY, BLACK };
+
+ std::string d_name;
+ gr_io_signature_sptr d_input_signature;
+ gr_io_signature_sptr d_output_signature;
+ long d_unique_id;
+ long d_symbolic_id;
+ std::string d_symbol_name;
+ std::string d_symbol_alias;
+ vcolor d_color;
+ msg_queue_map_t msg_queue;
+
+ gr_basic_block(void){} //allows pure virtual interface sub-classes
+
+ //! Protected constructor prevents instantiation by non-derived classes
+ gr_basic_block(const std::string &name,
+ gr_io_signature_sptr input_signature,
+ gr_io_signature_sptr output_signature);
+
+ //! may only be called during constructor
+ void set_input_signature(gr_io_signature_sptr iosig) {
+ d_input_signature = iosig;
+ }
+
+ //! may only be called during constructor
+ void set_output_signature(gr_io_signature_sptr iosig) {
+ d_output_signature = iosig;
+ }
+
+ /*!
+ * \brief Allow the flowgraph to set for sorting and partitioning
+ */
+ void set_color(vcolor color) { d_color = color; }
+ vcolor color() const { return d_color; }
+
+ /*!
+ * \brief Tests if there is a handler attached to port \p which_port
+ */
+ bool has_msg_handler(pmt::pmt_t which_port) {
+ return (d_msg_handlers.find(which_port) != d_msg_handlers.end());
+ }
+
+ /*
+ * This function is called by the runtime system to dispatch messages.
+ *
+ * The thread-safety guarantees mentioned in set_msg_handler are implemented
+ * by the callers of this method.
+ */
+ virtual void dispatch_msg(pmt::pmt_t which_port, pmt::pmt_t msg)
+ {
+ // AA Update this
+ if(has_msg_handler(which_port)) { // Is there a handler?
+ d_msg_handlers[which_port](msg); // Yes, invoke it.
+ }
+ }
+
+ // Message passing interface
+ pmt::pmt_t message_subscribers;
+
+ public:
+ virtual ~gr_basic_block();
+ long unique_id() const { return d_unique_id; }
+ long symbolic_id() const { return d_symbolic_id; }
+ std::string name() const { return d_name; }
+ std::string symbol_name() const { return d_symbol_name; }
+ gr_io_signature_sptr input_signature() const { return d_input_signature; }
+ gr_io_signature_sptr output_signature() const { return d_output_signature; }
+ gr_basic_block_sptr to_basic_block(); // Needed for Python type coercion
+ bool alias_set() { return !d_symbol_alias.empty(); }
+ std::string alias(){ return alias_set()?d_symbol_alias:symbol_name(); }
+ pmt::pmt_t alias_pmt(){ return pmt::pmt_intern(alias()); }
+ void set_block_alias(std::string name);
+
+ // ** Message passing interface **
+ void message_port_register_in(pmt::pmt_t port_id);
+ void message_port_register_out(pmt::pmt_t port_id);
+ void message_port_pub(pmt::pmt_t port_id, pmt::pmt_t msg);
+ void message_port_sub(pmt::pmt_t port_id, pmt::pmt_t target);
+ void message_port_unsub(pmt::pmt_t port_id, pmt::pmt_t target);
+
+ virtual bool message_port_is_hier(pmt::pmt_t port_id) { (void) port_id; std::cout << "is_hier\n"; return false; }
+ virtual bool message_port_is_hier_in(pmt::pmt_t port_id) { (void) port_id; std::cout << "is_hier_in\n"; return false; }
+ virtual bool message_port_is_hier_out(pmt::pmt_t port_id) { (void) port_id; std::cout << "is_hier_out\n"; return false; }
+
+ /*!
+ * \brief Get input message port names.
+ *
+ * Returns the available input message ports for a block. The
+ * return object is a PMT vector that is filled with PMT symbols.
+ */
+ pmt::pmt_t message_ports_in();
+
+ /*!
+ * \brief Get output message port names.
+ *
+ * Returns the available output message ports for a block. The
+ * return object is a PMT vector that is filled with PMT symbols.
+ */
+ pmt::pmt_t message_ports_out();
+
+ /*!
+ * Accept msg, place in queue, arrange for thread to be awakened if it's not already.
+ */
+ void _post(pmt::pmt_t which_port, pmt::pmt_t msg);
+
+ //! is the queue empty?
+ //bool empty_p(const pmt::pmt_t &which_port) const { return msg_queue[which_port].empty(); }
+ bool empty_p(pmt::pmt_t which_port) {
+ if(msg_queue.find(which_port) == msg_queue.end())
+ throw std::runtime_error("port does not exist!");
+ return msg_queue[which_port].empty();
+ }
+ bool empty_p() {
+ bool rv = true;
+ BOOST_FOREACH(msg_queue_map_t::value_type &i, msg_queue) {
+ rv &= msg_queue[i.first].empty();
+ }
+ return rv;
+ }
+
+ //! How many messages in the queue?
+ size_t nmsgs(pmt::pmt_t which_port) {
+ if(msg_queue.find(which_port) == msg_queue.end())
+ throw std::runtime_error("port does not exist!");
+ return msg_queue[which_port].size();
+ }
+
+ //| Acquires and release the mutex
+ void insert_tail( pmt::pmt_t which_port, pmt::pmt_t msg);
+ /*!
+ * \returns returns pmt at head of queue or pmt_t() if empty.
+ */
+ pmt::pmt_t delete_head_nowait( pmt::pmt_t which_port);
+
+ /*!
+ * \returns returns pmt at head of queue or pmt_t() if empty.
+ */
+ pmt::pmt_t delete_head_blocking( pmt::pmt_t which_port);
+
+ msg_queue_t::iterator get_iterator(pmt::pmt_t which_port){
+ return msg_queue[which_port].begin();
+ }
+
+ void erase_msg(pmt::pmt_t which_port, msg_queue_t::iterator it){
+ msg_queue[which_port].erase(it);
+ }
+
+ virtual bool has_msg_port(pmt::pmt_t which_port){
+ if(msg_queue.find(which_port) != msg_queue.end()){
+ return true;
+ }
+ if(pmt::pmt_dict_has_key(message_subscribers, which_port)){
+ return true;
+ }
+ return false;
+ }
+
+
+ /*!
+ * \brief Confirm that ninputs and noutputs is an acceptable combination.
+ *
+ * \param ninputs number of input streams connected
+ * \param noutputs number of output streams connected
+ *
+ * \returns true if this is a valid configuration for this block.
+ *
+ * This function is called by the runtime system whenever the
+ * topology changes. Most classes do not need to override this.
+ * This check is in addition to the constraints specified by the input
+ * and output gr_io_signatures.
+ */
+ virtual bool check_topology(int ninputs, int noutputs) { (void) ninputs; (void) noutputs; return true; }
+
+ /*!
+ * \brief Set the callback that is fired when messages are available.
+ *
+ * \p msg_handler can be any kind of function pointer or function object
+ * that has the signature:
+ * <pre>
+ * void msg_handler(pmt::pmt msg);
+ * </pre>
+ *
+ * (You may want to use boost::bind to massage your callable into the
+ * correct form. See gr_nop.{h,cc} for an example that sets up a class
+ * method as the callback.)
+ *
+ * Blocks that desire to handle messages must call this method in their
+ * constructors to register the handler that will be invoked when messages
+ * are available.
+ *
+ * If the block inherits from gr_block, the runtime system will ensure that
+ * msg_handler is called in a thread-safe manner, such that work and
+ * msg_handler will never be called concurrently. This allows msg_handler
+ * to update state variables without having to worry about thread-safety
+ * issues with work, general_work or another invocation of msg_handler.
+ *
+ * If the block inherits from gr_hier_block2, the runtime system will
+ * ensure that no reentrant calls are made to msg_handler.
+ */
+ //template <typename T> void set_msg_handler(T msg_handler){
+ // d_msg_handler = msg_handler_t(msg_handler);
+ //}
+ template <typename T> void set_msg_handler(pmt::pmt_t which_port, T msg_handler){
+ if(msg_queue.find(which_port) == msg_queue.end()){
+ throw std::runtime_error("attempt to set_msg_handler() on bad input message port!"); }
+ d_msg_handlers[which_port] = msg_handler_t(msg_handler);
+ }
+};
+
+inline bool operator<(gr_basic_block_sptr lhs, gr_basic_block_sptr rhs)
+{
+ return lhs->unique_id() < rhs->unique_id();
+}
+
+typedef std::vector<gr_basic_block_sptr> gr_basic_block_vector_t;
+typedef std::vector<gr_basic_block_sptr>::iterator gr_basic_block_viter_t;
+
+GR_CORE_API long gr_basic_block_ncurrently_allocated();
+
+inline std::ostream &operator << (std::ostream &os, gr_basic_block_sptr basic_block)
+{
+ os << basic_block->name() << "(" << basic_block->unique_id() << ")";
+ return os;
+}
+
+#endif /* INCLUDED_GR_BASIC_BLOCK_H */
diff --git a/gnuradio-core/src/lib/runtime/gr_basic_block.i b/gnuradio-core/src/lib/runtime/gr_basic_block.i
new file mode 100644
index 000000000..91f3d2cfc
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_basic_block.i
@@ -0,0 +1,62 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+class gr_basic_block;
+typedef boost::shared_ptr<gr_basic_block> gr_basic_block_sptr;
+%template(gr_basic_block_sptr) boost::shared_ptr<gr_basic_block>;
+%import "pmt_swig.i"
+using namespace pmt;
+
+// support vectors of these...
+namespace std {
+ %template(x_vector_gr_basic_block_sptr) vector<gr_basic_block_sptr>;
+};
+
+class gr_basic_block
+{
+protected:
+ gr_basic_block();
+
+public:
+ virtual ~gr_basic_block();
+ std::string name() const;
+ std::string symbol_name() const;
+ gr_io_signature_sptr input_signature() const;
+ gr_io_signature_sptr output_signature() const;
+ long unique_id() const;
+ gr_basic_block_sptr to_basic_block();
+ bool check_topology (int ninputs, int noutputs);
+ std::string alias();
+ void set_block_alias(std::string name);
+ void _post(pmt_t which_port, pmt_t msg);
+ pmt_t message_ports_in();
+ pmt_t message_ports_out();
+};
+
+%rename(block_ncurrently_allocated) gr_basic_block_ncurrently_allocated;
+long gr_basic_block_ncurrently_allocated();
+
+#ifdef SWIGPYTHON
+%pythoncode %{
+gr_basic_block_sptr.__repr__ = lambda self: "<gr_basic_block %s (%d)>" % (self.name(), self.unique_id ())
+%}
+#endif
diff --git a/gnuradio-core/src/lib/runtime/gr_block.cc b/gnuradio-core/src/lib/runtime/gr_block.cc
new file mode 100644
index 000000000..443ac8f64
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_block.cc
@@ -0,0 +1,459 @@
+/*
+ * Copyright 2012-2013 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 "pmx_helper.hpp"
+#include <gr_block.h>
+#include <boost/foreach.hpp>
+#include <iostream>
+#include <boost/detail/atomic_count.hpp>
+
+static boost::detail::atomic_count unique_id_pool(0);
+
+gr_block::gr_block(void)
+{
+ //NOP
+}
+
+gr_block::gr_block(
+ const std::string &name,
+ gr_io_signature_sptr input_signature,
+ gr_io_signature_sptr output_signature
+):
+ gras::Block(name),
+ _unique_id(++unique_id_pool),
+ _name(name)
+{
+ //this initializes private vars, order matters
+ this->set_fixed_rate(false);
+ this->set_output_multiple(1);
+ this->set_history(1);
+ this->set_relative_rate(1.0);
+ this->set_decimation(1);
+ this->set_interpolation(1);
+ this->set_tag_propagation_policy(TPP_ALL_TO_ALL);
+ this->set_input_signature(input_signature);
+ this->set_output_signature(output_signature);
+}
+
+gr_io_signature_sptr gr_block::input_signature(void) const
+{
+ return _in_sig;
+}
+
+gr_io_signature_sptr gr_block::output_signature(void) const
+{
+ return _out_sig;
+}
+
+void gr_block::set_input_signature(gr_io_signature_sptr sig)
+{
+ for (size_t i = 0; i < sig->sizeof_stream_items().size(); i++)
+ {
+ this->input_config(i).item_size = sig->sizeof_stream_items().at(i);
+ }
+ _in_sig = sig;
+}
+
+void gr_block::set_output_signature(gr_io_signature_sptr sig)
+{
+ for (size_t i = 0; i < sig->sizeof_stream_items().size(); i++)
+ {
+ this->output_config(i).item_size = sig->sizeof_stream_items().at(i);
+ }
+ _out_sig = sig;
+}
+
+gr_block::~gr_block(void)
+{
+ //NOP
+}
+
+void gr_block::notify_active(void)
+{
+ this->start();
+}
+
+bool gr_block::start(void)
+{
+ return true;
+}
+
+void gr_block::notify_inactive(void)
+{
+ this->stop();
+}
+
+bool gr_block::stop(void)
+{
+ return true;
+}
+
+void gr_block::notify_topology(const size_t num_inputs, const size_t num_outputs)
+{
+ _num_outputs = num_outputs;
+ _fcast_ninput_items.resize(num_inputs);
+ _work_ninput_items.resize(num_inputs);
+ this->check_topology(num_inputs, num_outputs);
+}
+
+bool gr_block::check_topology(int, int)
+{
+ return true;
+}
+
+void gr_block::work(
+ const InputItems &input_items,
+ const OutputItems &output_items
+){
+ _work_io_ptr_mask = 0;
+ #define REALLY_BIG size_t(1 << 30)
+ const size_t num_inputs = input_items.size();
+ const size_t num_outputs = output_items.size();
+
+ //------------------------------------------------------------------
+ //-- initialize input buffers before work
+ //------------------------------------------------------------------
+ size_t num_input_items = input_items.min();
+ if (_enable_fixed_rate) num_input_items -= _input_history_items;
+ for (size_t i = 0; i < num_inputs; i++)
+ {
+ _work_ninput_items[i] = input_items[i].size();
+ _work_io_ptr_mask |= ptrdiff_t(input_items.vec()[i]);
+ if GRAS_UNLIKELY(_enable_fixed_rate and input_items[i].size() <= _input_history_items)
+ {
+ return this->mark_input_fail(i);
+ }
+ }
+
+ //------------------------------------------------------------------
+ //-- initialize output buffers before work
+ //------------------------------------------------------------------
+ size_t num_output_items = output_items.min();
+ num_output_items /= _output_multiple_items;
+ num_output_items *= _output_multiple_items;
+ for (size_t i = 0; i < num_outputs; i++)
+ {
+ _work_io_ptr_mask |= ptrdiff_t(output_items.vec()[i]);
+ }
+
+ //------------------------------------------------------------------
+ //-- calculate the work_noutput_items given:
+ //-- min of num_input_items
+ //-- min of num_output_items
+ //-- relative rate and output multiple items
+ //------------------------------------------------------------------
+ size_t work_noutput_items = num_output_items;
+ if (num_inputs and (_enable_fixed_rate or not num_outputs))
+ {
+ size_t calc_output_items = size_t(num_input_items*_relative_rate);
+ calc_output_items += _output_multiple_items-1;
+ calc_output_items /= _output_multiple_items;
+ calc_output_items *= _output_multiple_items;
+ if (calc_output_items and calc_output_items < work_noutput_items)
+ work_noutput_items = calc_output_items;
+ }
+
+ //------------------------------------------------------------------
+ //-- forecast
+ //------------------------------------------------------------------
+ if (num_inputs or num_outputs)
+ {
+ forecast_again_you_jerk:
+ _fcast_ninput_items = _work_ninput_items; //init for NOP case
+ this->forecast(work_noutput_items, _fcast_ninput_items);
+ for (size_t i = 0; i < input_items.size(); i++)
+ {
+ if GRAS_LIKELY(_fcast_ninput_items[i] <= _work_ninput_items[i]) continue;
+
+ //handle the case of forecast failing
+ if GRAS_UNLIKELY(work_noutput_items <= _output_multiple_items)
+ {
+ return this->mark_input_fail(i);
+ }
+
+ work_noutput_items = work_noutput_items/2; //backoff regime
+ work_noutput_items += _output_multiple_items-1;
+ work_noutput_items /= _output_multiple_items;
+ work_noutput_items *= _output_multiple_items;
+ goto forecast_again_you_jerk;
+ }
+ }
+
+ const int work_ret = this->general_work(
+ work_noutput_items,
+ _work_ninput_items,
+ const_cast<InputItems &>(input_items).vec(),
+ const_cast<OutputItems &>(output_items).vec()
+ );
+
+ if GRAS_LIKELY(work_ret > 0) for (size_t i = 0; i < num_outputs; i++)
+ {
+ this->produce(i, work_ret);
+ }
+
+ if GRAS_UNLIKELY(work_ret == -1) this->mark_done();
+}
+
+static inline unsigned long long myullround(const double x)
+{
+ return (unsigned long long)(x + 0.5);
+}
+
+void gr_block::propagate_tags(const size_t which_input, const gras::TagIter &iter)
+{
+ switch (_tag_prop_policy)
+ {
+ case TPP_DONT: break; //well that was ez
+ case TPP_ALL_TO_ALL:
+ for (size_t out_i = 0; out_i < _num_outputs; out_i++)
+ {
+ BOOST_FOREACH(gras::Tag t, iter)
+ {
+ t.offset = myullround(t.offset * _relative_rate);
+ this->post_output_tag(out_i, t);
+ }
+ }
+ break;
+ case TPP_ONE_TO_ONE:
+ if (which_input < _num_outputs)
+ {
+ BOOST_FOREACH(gras::Tag t, iter)
+ {
+ t.offset = myullround(t.offset * _relative_rate);
+ this->post_output_tag(which_input, t);
+ }
+ }
+ break;
+ };
+}
+
+void gr_block::forecast(int noutput_items, std::vector<int> &ninputs_req)
+{
+ for (size_t i = 0; i < ninputs_req.size(); i++)
+ {
+ ninputs_req[i] = fixed_rate_noutput_to_ninput(noutput_items);
+ }
+}
+
+int gr_block::general_work(
+ int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items
+){
+ throw std::runtime_error("gr_block subclasses must overload general_work!");
+}
+
+void gr_block::set_alignment(const size_t)
+{
+ //TODO
+ //probably dont need this since buffers always start aligned
+ //and therefore alignment is always re-acheived
+}
+
+size_t gr_block::fixed_rate_noutput_to_ninput(const size_t noutput_items)
+{
+ return ((decimation()*noutput_items)/interpolation()) + _input_history_items;
+}
+
+void gr_block::set_interpolation(const size_t interp)
+{
+ _interp = interp;
+ this->set_relative_rate(1.0*interp);
+ this->set_output_multiple(interp);
+}
+
+void gr_block::set_decimation(const size_t decim)
+{
+ _decim = decim;
+ this->set_relative_rate(1.0/decim);
+}
+
+unsigned gr_block::history(void) const
+{
+ //implement off-by-one history compat
+ return _input_history_items+1;
+}
+
+void gr_block::set_history(unsigned history)
+{
+ //implement off-by-one history compat
+ if (history == 0) history++;
+ _input_history_items = history-1;
+ this->input_config(0).preload_items = _input_history_items;
+ this->commit_config();
+}
+
+void gr_block::set_fixed_rate(const bool fixed_rate)
+{
+ _enable_fixed_rate = fixed_rate;
+}
+
+bool gr_block::fixed_rate(void) const
+{
+ return _enable_fixed_rate;
+}
+
+void gr_block::_update_input_reserve(void)
+{
+ /*!
+ * Set an input reserve for fixed rate blocks.
+ *
+ * FIXME: Also do this when output multiple is large,
+ * This makes gr-trellis pass under conditions where not fixed rate set,
+ * but the output multiple is so large that default input isnt sufficient.
+ */
+ if (_enable_fixed_rate or _output_multiple_items > 1024)
+ {
+ const size_t reserve = size_t(0.5 + _output_multiple_items/_relative_rate);
+ if (reserve) this->input_config(0).reserve_items = reserve;
+ }
+}
+
+void gr_block::set_output_multiple(const size_t multiple)
+{
+ _output_multiple_items = multiple;
+ this->output_config(0).reserve_items = multiple;
+ this->_update_input_reserve();
+}
+
+size_t gr_block::output_multiple(void) const
+{
+ return _output_multiple_items;
+}
+
+void gr_block::set_relative_rate(double relative_rate)
+{
+ _relative_rate = relative_rate;
+ this->_update_input_reserve();
+}
+
+double gr_block::relative_rate(void) const
+{
+ return _relative_rate;
+}
+
+int gr_block::max_noutput_items(void) const
+{
+ return this->output_config(0).maximum_items;
+}
+
+void gr_block::set_max_noutput_items(int max_items)
+{
+ this->output_config(0).maximum_items = max_items;
+}
+
+void gr_block::unset_max_noutput_items(void)
+{
+ this->set_max_noutput_items(0);
+}
+
+bool gr_block::is_set_max_noutput_items(void) const
+{
+ return this->max_noutput_items() != 0;
+}
+
+static gr_tag_t Tag2gr_tag(const gras::Tag &tag)
+{
+ gr_tag_t t;
+ t.offset = tag.offset;
+ const gras::StreamTag &st = tag.object.as<gras::StreamTag>();
+ t.key = pmt::pmc_to_pmt(st.key);
+ t.value = pmt::pmc_to_pmt(st.val);
+ t.srcid = pmt::pmc_to_pmt(st.src);
+ return t;
+}
+
+static gras::Tag gr_tag2Tag(const gr_tag_t &tag)
+{
+ return gras::Tag
+ (
+ tag.offset,
+ PMC_M(gras::StreamTag(
+ pmt::pmt_to_pmc(tag.key),
+ pmt::pmt_to_pmc(tag.value),
+ pmt::pmt_to_pmc(tag.srcid)
+ ))
+ );
+}
+
+void gr_block::add_item_tag(
+ const size_t which_output, const gr_tag_t &tag
+){
+ this->post_output_tag(which_output, gr_tag2Tag(tag));
+}
+
+void gr_block::add_item_tag(
+ const size_t which_output,
+ uint64_t abs_offset,
+ const pmt::pmt_t &key,
+ const pmt::pmt_t &value,
+ const pmt::pmt_t &srcid
+){
+ gr_tag_t t;
+ t.offset = abs_offset;
+ t.key = key;
+ t.value = value;
+ t.srcid = srcid;
+ this->add_item_tag(which_output, t);
+}
+
+void gr_block::get_tags_in_range(
+ std::vector<gr_tag_t> &tags,
+ const size_t which_input,
+ uint64_t abs_start,
+ uint64_t abs_end,
+ const pmt::pmt_t &key
+){
+ tags.clear();
+ BOOST_FOREACH(const gras::Tag &tag, this->get_input_tags(which_input))
+ {
+ if (tag.offset >= abs_start and tag.offset <= abs_end)
+ {
+ gr_tag_t t = Tag2gr_tag(tag);
+ if (not key or pmt::pmt_equal(t.key, key)) tags.push_back(t);
+ }
+ }
+}
+
+gr_block::tag_propagation_policy_t gr_block::tag_propagation_policy(void)
+{
+ return _tag_prop_policy;
+}
+
+void gr_block::set_tag_propagation_policy(gr_block::tag_propagation_policy_t p)
+{
+ _tag_prop_policy = p;
+}
+
+gras::BufferQueueSptr gr_block::input_buffer_allocator(const size_t, const gras::SBufferConfig &config)
+{
+ if (_input_history_items)
+ {
+ return gras::BufferQueue::make_circ(config, 32/*many*/);
+ }
+ return gras::BufferQueueSptr();
+}
+
+gras::BufferQueueSptr gr_block::output_buffer_allocator(const size_t which, const gras::SBufferConfig &config)
+{
+ return gras::Block::output_buffer_allocator(which, config);
+}
diff --git a/gnuradio-core/src/lib/runtime/gr_block.h b/gnuradio-core/src/lib/runtime/gr_block.h
new file mode 100644
index 000000000..bd085100b
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_block.h
@@ -0,0 +1,437 @@
+/*
+ * Copyright 2012-2013 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_GNURADIO_GR_BLOCK_H
+#define INCLUDED_GNURADIO_GR_BLOCK_H
+
+#include <gr_core_api.h>
+#include <gras/block.hpp>
+#include <gr_io_signature.h>
+#include <gr_types.h>
+#include <gr_tags.h>
+#include <string>
+#include <deque>
+#include <map>
+#include <boost/foreach.hpp>
+#include <gruel/thread.h>
+#include <gr_sptr_magic.h>
+
+struct GR_CORE_API gr_block : gras::Block
+{
+
+ gr_block(void);
+
+ gr_block(
+ const std::string &name,
+ gr_io_signature_sptr input_signature,
+ gr_io_signature_sptr output_signature
+ );
+
+ long unique_id(void) const{return _unique_id;}
+ std::string name(void) const{return _name;}
+ long _unique_id;
+ std::string _name;
+
+ virtual ~gr_block(void);
+
+ gr_io_signature_sptr input_signature(void) const;
+ gr_io_signature_sptr output_signature(void) const;
+
+ void set_input_signature(gr_io_signature_sptr sig);
+ void set_output_signature(gr_io_signature_sptr sig);
+
+ virtual bool check_topology(int ninputs, int noutputs);
+
+ //! Overload me! I am the forecast
+ virtual void forecast(int, std::vector<int> &);
+
+ //! Return options for the work call
+ enum
+ {
+ WORK_CALLED_PRODUCE = -2,
+ WORK_DONE = -1
+ };
+
+ /*!
+ * \brief compute output items from input items
+ *
+ * \param noutput_items number of output items to write on each output stream
+ * \param ninput_items number of input items available on each input stream
+ * \param input_items vector of pointers to the input items, one entry per input stream
+ * \param output_items vector of pointers to the output items, one entry per output stream
+ *
+ * \returns number of items actually written to each output stream, or -1 on EOF.
+ * It is OK to return a value less than noutput_items. -1 <= return value <= noutput_items
+ *
+ * general_work must call consume or consume_each to indicate how many items
+ * were consumed on each input stream.
+ */
+ 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
+ );
+
+ virtual bool start(void);
+ virtual bool stop(void);
+
+ //! Call during work to consume items
+ void consume_each(const int how_many_items);
+
+ void consume(const size_t i, const int how_many_items);
+
+ void produce(const size_t o, const int how_many_items);
+
+ //! Get absolute count of all items consumed on the given input port
+ uint64_t nitems_read(const size_t which_input = 0);
+
+ //! Get absolute count of all items produced on the given output port
+ uint64_t nitems_written(const size_t which_output = 0);
+
+ void add_item_tag(
+ const size_t which_output, const gr_tag_t &tag
+ );
+
+ void add_item_tag(
+ const size_t which_output,
+ uint64_t abs_offset,
+ const pmt::pmt_t &key,
+ const pmt::pmt_t &value,
+ const pmt::pmt_t &srcid=pmt::PMT_F
+ );
+
+ void get_tags_in_range(
+ std::vector<gr_tag_t> &tags,
+ const size_t which_input,
+ uint64_t abs_start,
+ uint64_t abs_end,
+ const pmt::pmt_t &key = pmt::pmt_t()
+ );
+
+ void set_alignment(const size_t alignment);
+
+ bool is_unaligned(void);
+
+ size_t fixed_rate_noutput_to_ninput(const size_t noutput_items);
+
+ size_t interpolation(void) const;
+
+ void set_interpolation(const size_t);
+
+ size_t decimation(void) const;
+
+ void set_decimation(const size_t);
+
+ int max_noutput_items(void) const;
+
+ void set_max_noutput_items(int);
+
+ void unset_max_noutput_items(void);
+
+ bool is_set_max_noutput_items(void) const;
+
+ /*******************************************************************
+ * Deal with input and output port configuration
+ ******************************************************************/
+
+ unsigned history(void) const;
+
+ void set_history(unsigned history);
+
+ /*!
+ * Enable fixed rate logic.
+ * When enabled, relative rate is assumed to be set,
+ * and forecast is automatically called.
+ * Also, consume will be called automatically.
+ */
+ void set_fixed_rate(const bool fixed_rate);
+
+ //! Get the fixed rate setting
+ bool fixed_rate(void) const;
+
+ /*!
+ * The relative rate can be thought of as interpolation/decimation.
+ * In other words, relative rate is the ratio of output items to input items.
+ */
+ void set_relative_rate(const double relative_rate);
+
+ //! Get the relative rate setting
+ double relative_rate(void) const;
+
+ /*!
+ * The output multiple setting controls work output buffer sizes.
+ * Buffers will be number of items modulo rounted to the multiple.
+ */
+ void set_output_multiple(const size_t multiple);
+
+ //! Get the output multiple setting
+ size_t output_multiple(void) const;
+
+ /*******************************************************************
+ * Deal with tag handling and tag configuration
+ ******************************************************************/
+
+ enum tag_propagation_policy_t
+ {
+ TPP_DONT = 0,
+ TPP_ALL_TO_ALL = 1,
+ TPP_ONE_TO_ONE = 2
+ };
+
+ tag_propagation_policy_t tag_propagation_policy(void);
+
+ void set_tag_propagation_policy(tag_propagation_policy_t p);
+
+ ///////////// TODO //////////////////////
+ void set_max_output_buffer(long){}
+ void set_max_output_buffer(int, long){}
+ long max_output_buffer(size_t){return 0;}
+ void set_min_output_buffer(long){}
+ void set_min_output_buffer(int, long){}
+ long min_output_buffer(size_t){return 0;}
+
+ ///////////// ALIAS stuff - is it used? //////////////////////
+ std::string d_symbol_alias;
+ std::string d_symbol_name;
+ std::string symbol_name() const { return d_symbol_name; }
+ bool alias_set() { return !d_symbol_alias.empty(); }
+ std::string alias(){ return alias_set()?d_symbol_alias:symbol_name(); }
+ pmt::pmt_t alias_pmt(){ return pmt::pmt_intern(alias()); }
+ void set_block_alias(std::string name){d_symbol_alias = name;}
+
+ ///////////// MSG stuff not implemented //////////////////////
+ typedef std::deque<pmt::pmt_t> msg_queue_t;
+ typedef std::map<pmt::pmt_t, msg_queue_t, pmt::pmt_comperator> msg_queue_map_t;
+ typedef std::map<pmt::pmt_t, msg_queue_t, pmt::pmt_comperator>::iterator msg_queue_map_itr;
+ msg_queue_map_t msg_queue;
+ pmt::pmt_t message_subscribers;
+
+ typedef boost::function<void(pmt::pmt_t)> msg_handler_t;
+ typedef std::map<pmt::pmt_t , msg_handler_t, pmt::pmt_comperator> d_msg_handlers_t;
+ d_msg_handlers_t d_msg_handlers;
+
+ template <typename T> void set_msg_handler(pmt::pmt_t which_port, T msg_handler){}
+
+ void message_port_register_in(pmt::pmt_t /*port_id*/){}
+ void message_port_register_out(pmt::pmt_t /*port_id*/){}
+ void message_port_pub(pmt::pmt_t /*port_id*/, pmt::pmt_t /*msg*/){}
+ void message_port_sub(pmt::pmt_t /*port_id*/, pmt::pmt_t /*target*/){}
+ void message_port_unsub(pmt::pmt_t /*port_id*/, pmt::pmt_t /*target*/){}
+
+ virtual bool message_port_is_hier(pmt::pmt_t port_id) { (void) port_id; /*std::cout << "is_hier\n";*/ return false; }
+ virtual bool message_port_is_hier_in(pmt::pmt_t port_id) { (void) port_id; /*std::cout << "is_hier_in\n";*/ return false; }
+ virtual bool message_port_is_hier_out(pmt::pmt_t port_id) { (void) port_id; /*std::cout << "is_hier_out\n";*/ return false; }
+
+ /*!
+ * \brief Get input message port names.
+ *
+ * Returns the available input message ports for a block. The
+ * return object is a PMT vector that is filled with PMT symbols.
+ */
+ pmt::pmt_t message_ports_in(){return pmt::PMT_NIL;}
+
+ /*!
+ * \brief Get output message port names.
+ *
+ * Returns the available output message ports for a block. The
+ * return object is a PMT vector that is filled with PMT symbols.
+ */
+ pmt::pmt_t message_ports_out(){return pmt::PMT_NIL;}
+
+ //! is the queue empty?
+ bool empty_p(pmt::pmt_t which_port) {
+ if(msg_queue.find(which_port) == msg_queue.end())
+ throw std::runtime_error("port does not exist!");
+ return msg_queue[which_port].empty();
+ }
+ bool empty_p() {
+ bool rv = true;
+ BOOST_FOREACH(msg_queue_map_t::value_type &i, msg_queue){ rv &= msg_queue[i.first].empty(); }
+ return rv;
+ }
+
+ //| Acquires and release the mutex
+ void insert_tail( pmt::pmt_t /*which_port*/, pmt::pmt_t /*msg*/){}
+ /*!
+ * \returns returns pmt at head of queue or pmt_t() if empty.
+ */
+ pmt::pmt_t delete_head_nowait( pmt::pmt_t /*which_port*/){return pmt::PMT_NIL;}
+
+ /*!
+ * \returns returns pmt at head of queue or pmt_t() if empty.
+ */
+ pmt::pmt_t delete_head_blocking( pmt::pmt_t /*which_port*/){return pmt::PMT_NIL;}
+
+ msg_queue_t::iterator get_iterator(pmt::pmt_t which_port){
+ return msg_queue[which_port].begin();
+ }
+
+ void erase_msg(pmt::pmt_t which_port, msg_queue_t::iterator it){
+ msg_queue[which_port].erase(it);
+ }
+
+ virtual bool has_msg_port(pmt::pmt_t which_port){
+ if(msg_queue.find(which_port) != msg_queue.end()){
+ return true;
+ }
+ if(pmt::pmt_dict_has_key(message_subscribers, which_port)){
+ return true;
+ }
+ return false;
+ }
+
+ /*!
+ * \brief Tests if there is a handler attached to port \p which_port
+ */
+ bool has_msg_handler(pmt::pmt_t which_port) {
+ return (d_msg_handlers.find(which_port) != d_msg_handlers.end());
+ }
+
+ /*
+ * This function is called by the runtime system to dispatch messages.
+ *
+ * The thread-safety guarantees mentioned in set_msg_handler are implemented
+ * by the callers of this method.
+ */
+ virtual void dispatch_msg(pmt::pmt_t which_port, pmt::pmt_t msg)
+ {
+ // AA Update this
+ if(has_msg_handler(which_port)) { // Is there a handler?
+ d_msg_handlers[which_port](msg); // Yes, invoke it.
+ }
+ }
+
+ /*! Used by block's setters and work functions to make
+ * setting/resetting of parameters thread-safe.
+ *
+ * Used by calling gruel::scoped_lock l(d_setlock);
+ */
+ gruel::mutex d_setlock;
+
+ // ----------------------------------------------------------------------------
+ // Functions to handle thread affinity
+ std::vector<int> d_affinity; // thread affinity proc. mask
+
+ /*!
+ * \brief Set the thread's affinity to processor core \p n.
+ *
+ * \param mask a vector of unsigned ints of the core numbers available to this block.
+ */
+ void set_processor_affinity(const std::vector<int> &mask){d_affinity=mask;}
+
+ /*!
+ * \brief Remove processor affinity to a specific core.
+ */
+ void unset_processor_affinity(){}
+
+ /*!
+ * \brief Get the current processor affinity.
+ */
+ std::vector<int> processor_affinity() { return d_affinity; }
+
+ ///////////////// private vars //////////////////////
+
+ gr_vector_int _work_ninput_items;
+ gr_vector_int _fcast_ninput_items;
+ size_t _num_outputs;
+ ptrdiff_t _work_io_ptr_mask;
+ size_t _output_multiple_items;
+ double _relative_rate;
+ bool _enable_fixed_rate;
+ size_t _input_history_items;
+ tag_propagation_policy_t _tag_prop_policy;
+ size_t _interp, _decim;
+ gr_io_signature_sptr _in_sig, _out_sig;
+
+ ///////////////// the Block overloads //////////////////////
+
+ //! implements work -> calls general work
+ void work(const InputItems &, const OutputItems &);
+
+ //! notifications of new topological commits
+ void notify_topology(const size_t, const size_t);
+
+ //! start notification
+ void notify_active(void);
+
+ //! stop notification
+ void notify_inactive(void);
+
+ //! implements tag_propagation_policy()
+ virtual void propagate_tags(const size_t, const gras::TagIter &);
+
+ void _update_input_reserve(void);
+
+ gras::BufferQueueSptr input_buffer_allocator(const size_t, const gras::SBufferConfig &);
+ gras::BufferQueueSptr output_buffer_allocator(const size_t, const gras::SBufferConfig &);
+
+};
+
+typedef boost::shared_ptr<gr_block> gr_block_sptr;
+
+GRAS_FORCE_INLINE void gr_block::consume_each(const int how_many_items)
+{
+ if GRAS_UNLIKELY(how_many_items < 0) return;
+ gras::Block::consume(size_t(how_many_items));
+}
+
+GRAS_FORCE_INLINE void gr_block::consume(const size_t i, const int how_many_items)
+{
+ if GRAS_UNLIKELY(how_many_items < 0) return;
+ gras::Block::consume(i, size_t(how_many_items));
+}
+
+GRAS_FORCE_INLINE void gr_block::produce(const size_t o, const int how_many_items)
+{
+ if GRAS_UNLIKELY(how_many_items < 0) return;
+ gras::Block::produce(o, size_t(how_many_items));
+}
+
+GRAS_FORCE_INLINE uint64_t gr_block::nitems_read(const size_t which_input)
+{
+ return Block::get_consumed(which_input);
+}
+
+GRAS_FORCE_INLINE uint64_t gr_block::nitems_written(const size_t which_output)
+{
+ return Block::get_produced(which_output);
+}
+
+GRAS_FORCE_INLINE size_t gr_block::interpolation(void) const
+{
+ return _interp;
+}
+
+GRAS_FORCE_INLINE size_t gr_block::decimation(void) const
+{
+ return _decim;
+}
+
+GRAS_FORCE_INLINE bool gr_block::is_unaligned(void)
+{
+ //TODO
+ //probably dont need this since volk dispatcher checks alignment
+ //32 byte aligned is good enough for you
+ return (_work_io_ptr_mask & ptrdiff_t(GRAS_MAX_ALIGNMENT-1)) != 0;
+}
+
+#endif /*INCLUDED_GNURADIO_GR_BLOCK_H*/
diff --git a/gnuradio-core/src/lib/runtime/gr_block.i b/gnuradio-core/src/lib/runtime/gr_block.i
new file mode 100644
index 000000000..a53489f9a
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_block.i
@@ -0,0 +1,93 @@
+/* -*- 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.
+ */
+
+%include <gr_basic_block.i>
+
+class gr_block;
+typedef boost::shared_ptr<gr_block> gr_block_sptr;
+%template(gr_block_sptr) boost::shared_ptr<gr_block>;
+
+// support vectors of these...
+namespace std {
+ %template(x_vector_gr_block_sptr) vector<gr_block_sptr>;
+};
+
+class gr_block : public gr_basic_block {
+ protected:
+ gr_block (const std::string &name,
+ gr_io_signature_sptr input_signature,
+ gr_io_signature_sptr output_signature);
+
+ public:
+
+ virtual ~gr_block ();
+
+ unsigned history () const;
+
+ int output_multiple () const;
+ double relative_rate () const;
+
+ bool start();
+ bool stop();
+
+ uint64_t nitems_read(unsigned int which_input);
+ uint64_t nitems_written(unsigned int which_output);
+
+ // Methods to manage the block's max_noutput_items size.
+ int max_noutput_items();
+ void set_max_noutput_items(int m);
+ void unset_max_noutput_items();
+ bool is_set_max_noutput_items();
+
+ // Methods to manage block's min/max buffer sizes.
+ long max_output_buffer(int i);
+ void set_max_output_buffer(long max_output_buffer);
+ void set_max_output_buffer(int port, long max_output_buffer);
+ long min_output_buffer(int i);
+ void set_min_output_buffer(long min_output_buffer);
+ void set_min_output_buffer(int port, long min_output_buffer);
+
+ // Methods to access performance counters
+ float pc_noutput_items();
+ float pc_noutput_items_var();
+ float pc_nproduced();
+ float pc_nproduced_var();
+ float pc_input_buffers_full(int which);
+ float pc_input_buffers_full_var(int which);
+ std::vector<float> pc_input_buffers_full();
+ std::vector<float> pc_input_buffers_full_var();
+ float pc_output_buffers_full(int which);
+ float pc_output_buffers_full_var(int which);
+ std::vector<float> pc_output_buffers_full();
+ std::vector<float> pc_output_buffers_full_var();
+ float pc_work_time();
+ float pc_work_time_var();
+
+ // Methods to manage processor affinity.
+ void set_processor_affinity(const std::vector<int> &mask);
+ void unset_processor_affinity();
+ std::vector<int> processor_affinity();
+
+ // internal use
+ gr_block_detail_sptr detail () const { return d_detail; }
+ void set_detail (gr_block_detail_sptr detail) { d_detail = detail; }
+};
diff --git a/gnuradio-core/src/lib/runtime/gr_block_detail.cc b/gnuradio-core/src/lib/runtime/gr_block_detail.cc
new file mode 100644
index 000000000..4922ea083
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_block_detail.cc
@@ -0,0 +1,414 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_block_detail.h>
+#include <gr_buffer.h>
+#include <iostream>
+
+using namespace pmt;
+
+static long s_ncurrently_allocated = 0;
+
+long
+gr_block_detail_ncurrently_allocated ()
+{
+ return s_ncurrently_allocated;
+}
+
+gr_block_detail::gr_block_detail (unsigned int ninputs, unsigned int noutputs)
+ : d_produce_or(0),
+ d_ninputs (ninputs), d_noutputs (noutputs),
+ d_input (ninputs), d_output (noutputs),
+ d_done (false),
+ d_avg_noutput_items(0),
+ d_var_noutput_items(0),
+ d_avg_nproduced(0),
+ d_var_nproduced(0),
+ d_avg_input_buffers_full(ninputs, 0),
+ d_var_input_buffers_full(ninputs, 0),
+ d_avg_output_buffers_full(noutputs, 0),
+ d_var_output_buffers_full(noutputs, 0),
+ d_avg_work_time(0),
+ d_var_work_time(0),
+ d_pc_counter(0)
+{
+ s_ncurrently_allocated++;
+}
+
+gr_block_detail::~gr_block_detail ()
+{
+ // should take care of itself
+ s_ncurrently_allocated--;
+}
+
+void
+gr_block_detail::set_input (unsigned int which, gr_buffer_reader_sptr reader)
+{
+ if (which >= d_ninputs)
+ throw std::invalid_argument ("gr_block_detail::set_input");
+
+ d_input[which] = reader;
+}
+
+void
+gr_block_detail::set_output (unsigned int which, gr_buffer_sptr buffer)
+{
+ if (which >= d_noutputs)
+ throw std::invalid_argument ("gr_block_detail::set_output");
+
+ d_output[which] = buffer;
+}
+
+gr_block_detail_sptr
+gr_make_block_detail (unsigned int ninputs, unsigned int noutputs)
+{
+ return gr_block_detail_sptr (new gr_block_detail (ninputs, noutputs));
+}
+
+void
+gr_block_detail::set_done (bool done)
+{
+ d_done = done;
+ for (unsigned int i = 0; i < d_noutputs; i++)
+ d_output[i]->set_done (done);
+
+ for (unsigned int i = 0; i < d_ninputs; i++)
+ d_input[i]->set_done (done);
+}
+
+void
+gr_block_detail::consume (int which_input, int how_many_items)
+{
+ if (how_many_items > 0) {
+ input (which_input)->update_read_pointer (how_many_items);
+ }
+}
+
+
+void
+gr_block_detail::consume_each (int how_many_items)
+{
+ if (how_many_items > 0) {
+ for (int i = 0; i < ninputs (); i++) {
+ d_input[i]->update_read_pointer (how_many_items);
+ }
+ }
+}
+
+void
+gr_block_detail::produce (int which_output, int how_many_items)
+{
+ if (how_many_items > 0){
+ d_output[which_output]->update_write_pointer (how_many_items);
+ d_produce_or |= how_many_items;
+ }
+}
+
+void
+gr_block_detail::produce_each (int how_many_items)
+{
+ if (how_many_items > 0) {
+ for (int i = 0; i < noutputs (); i++) {
+ d_output[i]->update_write_pointer (how_many_items);
+ }
+ d_produce_or |= how_many_items;
+ }
+}
+
+
+uint64_t
+gr_block_detail::nitems_read(unsigned int which_input)
+{
+ if(which_input >= d_ninputs)
+ throw std::invalid_argument ("gr_block_detail::n_input_items");
+ return d_input[which_input]->nitems_read();
+}
+
+uint64_t
+gr_block_detail::nitems_written(unsigned int which_output)
+{
+ if(which_output >= d_noutputs)
+ throw std::invalid_argument ("gr_block_detail::n_output_items");
+ return d_output[which_output]->nitems_written();
+}
+
+void
+gr_block_detail::add_item_tag(unsigned int which_output, const gr_tag_t &tag)
+{
+ if(!pmt_is_symbol(tag.key)) {
+ throw pmt_wrong_type("gr_block_detail::add_item_tag key", tag.key);
+ }
+ else {
+ // Add tag to gr_buffer's deque tags
+ d_output[which_output]->add_item_tag(tag);
+ }
+}
+
+void
+gr_block_detail::remove_item_tag(unsigned int which_input, const gr_tag_t &tag)
+{
+ if(!pmt_is_symbol(tag.key)) {
+ throw pmt_wrong_type("gr_block_detail::add_item_tag key", tag.key);
+ }
+ else {
+ // Add tag to gr_buffer's deque tags
+ d_input[which_input]->buffer()->remove_item_tag(tag);
+ }
+}
+
+void
+gr_block_detail::get_tags_in_range(std::vector<gr_tag_t> &v,
+ unsigned int which_input,
+ uint64_t abs_start,
+ uint64_t abs_end)
+{
+ // get from gr_buffer_reader's deque of tags
+ d_input[which_input]->get_tags_in_range(v, abs_start, abs_end);
+}
+
+void
+gr_block_detail::get_tags_in_range(std::vector<gr_tag_t> &v,
+ unsigned int which_input,
+ uint64_t abs_start,
+ uint64_t abs_end,
+ const pmt_t &key)
+{
+ std::vector<gr_tag_t> found_items;
+
+ v.resize(0);
+
+ // get from gr_buffer_reader's deque of tags
+ d_input[which_input]->get_tags_in_range(found_items, abs_start, abs_end);
+
+ // Filter further by key name
+ pmt_t itemkey;
+ std::vector<gr_tag_t>::iterator itr;
+ for(itr = found_items.begin(); itr != found_items.end(); itr++) {
+ itemkey = (*itr).key;
+ if(pmt_eqv(key, itemkey)) {
+ v.push_back(*itr);
+ }
+ }
+}
+
+void
+gr_block_detail::set_processor_affinity(const std::vector<int> &mask)
+{
+ if(threaded) {
+ try {
+ gruel::thread_bind_to_processor(thread, mask);
+ }
+ catch (std::runtime_error e) {
+ std::cerr << "set_processor_affinity: invalid mask." << std::endl;;
+ }
+ }
+}
+
+void
+gr_block_detail::unset_processor_affinity()
+{
+ if(threaded) {
+ gruel::thread_unbind(thread);
+ }
+}
+
+void
+gr_block_detail::start_perf_counters()
+{
+ d_start_of_work = gruel::high_res_timer_now();
+}
+
+void
+gr_block_detail::stop_perf_counters(int noutput_items, int nproduced)
+{
+ d_end_of_work = gruel::high_res_timer_now();
+ gruel::high_res_timer_type diff = d_end_of_work - d_start_of_work;
+
+ if(d_pc_counter == 0) {
+ d_avg_work_time = diff;
+ d_var_work_time = 0;
+ d_avg_nproduced = nproduced;
+ d_var_nproduced = 0;
+ d_avg_noutput_items = noutput_items;
+ d_var_noutput_items = 0;
+ for(size_t i=0; i < d_input.size(); i++) {
+ float pfull = static_cast<float>(d_input[i]->items_available()) /
+ static_cast<float>(d_input[i]->max_possible_items_available());
+ d_avg_input_buffers_full[i] = pfull;
+ d_var_input_buffers_full[i] = 0;
+ }
+ for(size_t i=0; i < d_output.size(); i++) {
+ gruel::scoped_lock guard(*d_output[i]->mutex());
+ float pfull = 1.0f - static_cast<float>(d_output[i]->space_available()) /
+ static_cast<float>(d_output[i]->bufsize());
+ d_avg_output_buffers_full[i] = pfull;
+ d_var_output_buffers_full[i] = 0;
+ }
+ }
+ else {
+ float d = diff - d_avg_work_time;
+ d_avg_work_time = d_avg_work_time + d/d_pc_counter;
+ d_var_work_time = d_var_work_time + d*d;
+
+ d = nproduced - d_avg_nproduced;
+ d_avg_nproduced = d_avg_nproduced + d/d_pc_counter;
+ d_var_nproduced = d_var_nproduced + d*d;
+
+ d = noutput_items - d_avg_noutput_items;
+ d_avg_noutput_items = d_avg_noutput_items + d/d_pc_counter;
+ d_var_noutput_items = d_var_noutput_items + d*d;
+
+ for(size_t i=0; i < d_input.size(); i++) {
+ float pfull = static_cast<float>(d_input[i]->items_available()) /
+ static_cast<float>(d_input[i]->max_possible_items_available());
+
+ d = pfull - d_avg_input_buffers_full[i];
+ d_avg_input_buffers_full[i] = d_avg_input_buffers_full[i] + d/d_pc_counter;
+ d_var_input_buffers_full[i] = d_var_input_buffers_full[i] + d*d;
+ }
+
+ for(size_t i=0; i < d_output.size(); i++) {
+ gruel::scoped_lock guard(*d_output[i]->mutex());
+ float pfull = 1.0f - static_cast<float>(d_output[i]->space_available()) /
+ static_cast<float>(d_output[i]->bufsize());
+
+ d = pfull - d_avg_output_buffers_full[i];
+ d_avg_output_buffers_full[i] = d_avg_output_buffers_full[i] + d/d_pc_counter;
+ d_var_output_buffers_full[i] = d_var_output_buffers_full[i] + d*d;
+ }
+ }
+
+ d_pc_counter++;
+}
+
+void
+gr_block_detail::reset_perf_counters()
+{
+ d_pc_counter = 0;
+}
+
+float
+gr_block_detail::pc_noutput_items()
+{
+ return d_avg_noutput_items;
+}
+
+float
+gr_block_detail::pc_nproduced()
+{
+ return d_avg_nproduced;
+}
+
+float
+gr_block_detail::pc_input_buffers_full(size_t which)
+{
+ if(which < d_avg_input_buffers_full.size())
+ return d_avg_input_buffers_full[which];
+ else
+ return 0;
+}
+
+std::vector<float>
+gr_block_detail::pc_input_buffers_full()
+{
+ return d_avg_input_buffers_full;
+}
+
+float
+gr_block_detail::pc_output_buffers_full(size_t which)
+{
+ if(which < d_avg_output_buffers_full.size())
+ return d_avg_output_buffers_full[which];
+ else
+ return 0;
+}
+
+std::vector<float>
+gr_block_detail::pc_output_buffers_full()
+{
+ return d_avg_output_buffers_full;
+}
+
+float
+gr_block_detail::pc_work_time()
+{
+ return d_avg_work_time;
+}
+
+
+float
+gr_block_detail::pc_noutput_items_var()
+{
+ return d_var_noutput_items/(d_pc_counter-1);
+}
+
+float
+gr_block_detail::pc_nproduced_var()
+{
+ return d_var_nproduced/(d_pc_counter-1);
+}
+
+float
+gr_block_detail::pc_input_buffers_full_var(size_t which)
+{
+ if(which < d_avg_input_buffers_full.size())
+ return d_var_input_buffers_full[which]/(d_pc_counter-1);
+ else
+ return 0;
+}
+
+std::vector<float>
+gr_block_detail::pc_input_buffers_full_var()
+{
+ std::vector<float> var(d_avg_input_buffers_full.size(), 0);
+ for(size_t i = 0; i < d_avg_input_buffers_full.size(); i++)
+ var[i] = d_avg_input_buffers_full[i]/(d_pc_counter-1);
+ return var;
+}
+
+float
+gr_block_detail::pc_output_buffers_full_var(size_t which)
+{
+ if(which < d_avg_output_buffers_full.size())
+ return d_var_output_buffers_full[which]/(d_pc_counter-1);
+ else
+ return 0;
+}
+
+std::vector<float>
+gr_block_detail::pc_output_buffers_full_var()
+{
+ std::vector<float> var(d_avg_output_buffers_full.size(), 0);
+ for(size_t i = 0; i < d_avg_output_buffers_full.size(); i++)
+ var[i] = d_avg_output_buffers_full[i]/(d_pc_counter-1);
+ return var;
+}
+
+float
+gr_block_detail::pc_work_time_var()
+{
+ return d_var_work_time/(d_pc_counter-1);
+}
diff --git a/gnuradio-core/src/lib/runtime/gr_block_detail.h b/gnuradio-core/src/lib/runtime/gr_block_detail.h
new file mode 100644
index 000000000..15d85135a
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_block_detail.h
@@ -0,0 +1,235 @@
+/* -*- 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 detail.
+ *
+ * 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_BLOCK_DETAIL_H
+#define INCLUDED_GR_BLOCK_DETAIL_H
+
+#include <gr_core_api.h>
+#include <gr_runtime_types.h>
+#include <gr_tpb_detail.h>
+#include <gr_tags.h>
+#include <gruel/high_res_timer.h>
+#include <stdexcept>
+
+/*!
+ * \brief Implementation details to support the signal processing abstraction
+ * \ingroup internal
+ *
+ * This class contains implementation detail that should be "out of sight"
+ * of almost all users of GNU Radio. This decoupling also means that
+ * we can make changes to the guts without having to recompile everything.
+ */
+class GR_CORE_API gr_block_detail {
+ public:
+ ~gr_block_detail ();
+
+ int ninputs () const { return d_ninputs; }
+ int noutputs () const { return d_noutputs; }
+ bool sink_p () const { return d_noutputs == 0; }
+ bool source_p () const { return d_ninputs == 0; }
+
+ void set_done (bool done);
+ bool done () const { return d_done; }
+
+ void set_input (unsigned int which, gr_buffer_reader_sptr reader);
+ gr_buffer_reader_sptr input (unsigned int which)
+ {
+ if (which >= d_ninputs)
+ throw std::invalid_argument ("gr_block_detail::input");
+ return d_input[which];
+ }
+
+ void set_output (unsigned int which, gr_buffer_sptr buffer);
+ gr_buffer_sptr output (unsigned int which)
+ {
+ if (which >= d_noutputs)
+ throw std::invalid_argument ("gr_block_detail::output");
+ return d_output[which];
+ }
+
+ /*!
+ * \brief Tell the scheduler \p how_many_items of input stream \p which_input were consumed.
+ */
+ void consume (int which_input, int how_many_items);
+
+ /*!
+ * \brief Tell the scheduler \p how_many_items were consumed on each input stream.
+ */
+ void consume_each (int how_many_items);
+
+ /*!
+ * \brief Tell the scheduler \p how_many_items were produced on output stream \p which_output.
+ */
+ void produce (int which_output, int how_many_items);
+
+ /*!
+ * \brief Tell the scheduler \p how_many_items were produced on each output stream.
+ */
+ void produce_each (int how_many_items);
+
+ // Return the number of items read on input stream which_input
+ uint64_t nitems_read(unsigned int which_input);
+
+ // Return the number of items written on output stream which_output
+ uint64_t nitems_written(unsigned int which_output);
+
+
+ /*!
+ * \brief Adds a new tag to the given output stream.
+ *
+ * Calls gr_buffer::add_item_tag(),
+ * which appends the tag onto its deque.
+ *
+ * \param which_output an integer of which output stream to attach the tag
+ * \param tag the tag object to add
+ */
+ void add_item_tag(unsigned int which_output, const gr_tag_t &tag);
+
+ /*!
+ * \brief Removes a tag from the given input stream.
+ *
+ * Calls gr_buffer::remove_item_tag(), which removes the tag from its deque.
+ *
+ * \param which_input an integer of which input stream to remove the tag from
+ * \param tag the tag object to add
+ */
+ void remove_item_tag(unsigned int which_input, const gr_tag_t &tag);
+
+ /*!
+ * \brief Given a [start,end), returns a vector of all tags in the range.
+ *
+ * Pass-through function to gr_buffer_reader to get a vector of tags
+ * in given range. Range of counts is from start to end-1.
+ *
+ * Tags are tuples of:
+ * (item count, source id, key, value)
+ *
+ * \param v a vector reference to return tags into
+ * \param which_input an integer of which input stream to pull from
+ * \param abs_start a uint64 count of the start of the range of interest
+ * \param abs_end a uint64 count of the end of the range of interest
+ */
+ void get_tags_in_range(std::vector<gr_tag_t> &v,
+ unsigned int which_input,
+ uint64_t abs_start,
+ uint64_t abs_end);
+
+ /*!
+ * \brief Given a [start,end), returns a vector of all tags in the range
+ * with a given key.
+ *
+ * Calls get_tags_in_range(which_input, abs_start, abs_end) to get a vector of
+ * tags from the buffers. This function then provides a secondary filter to
+ * the tags to extract only tags with the given 'key'.
+ *
+ * Tags are tuples of:
+ * (item count, source id, key, value)
+ *
+ * \param v a vector reference to return tags into
+ * \param which_input an integer of which input stream to pull from
+ * \param abs_start a uint64 count of the start of the range of interest
+ * \param abs_end a uint64 count of the end of the range of interest
+ * \param key a PMT symbol to select only tags of this key
+ */
+ void get_tags_in_range(std::vector<gr_tag_t> &v,
+ unsigned int which_input,
+ uint64_t abs_start,
+ uint64_t abs_end,
+ const pmt::pmt_t &key);
+
+ /*!
+ * \brief Set core affinity of block to the cores in the vector mask.
+ *
+ * \param mask a vector of ints of the core numbers available to this block.
+ */
+ void set_processor_affinity(const std::vector<int> &mask);
+
+ /*!
+ * \brief Unset core affinity.
+ */
+ void unset_processor_affinity();
+
+ bool threaded; // set if thread is currently running.
+ gruel::gr_thread_t thread; // portable thread handle
+
+ void start_perf_counters();
+ void stop_perf_counters(int noutput_items, int nproduced);
+ void reset_perf_counters();
+
+ // Calls to get performance counter items
+ float pc_noutput_items();
+ float pc_nproduced();
+ float pc_input_buffers_full(size_t which);
+ std::vector<float> pc_input_buffers_full();
+ float pc_output_buffers_full(size_t which);
+ std::vector<float> pc_output_buffers_full();
+ float pc_work_time();
+
+ float pc_noutput_items_var();
+ float pc_nproduced_var();
+ float pc_input_buffers_full_var(size_t which);
+ std::vector<float> pc_input_buffers_full_var();
+ float pc_output_buffers_full_var(size_t which);
+ std::vector<float> pc_output_buffers_full_var();
+ float pc_work_time_var();
+
+ gr_tpb_detail d_tpb; // used by thread-per-block scheduler
+ int d_produce_or;
+
+ // ----------------------------------------------------------------------------
+
+ private:
+ unsigned int d_ninputs;
+ unsigned int d_noutputs;
+ std::vector<gr_buffer_reader_sptr> d_input;
+ std::vector<gr_buffer_sptr> d_output;
+ bool d_done;
+
+ // Performance counters
+ float d_avg_noutput_items;
+ float d_var_noutput_items;
+ float d_avg_nproduced;
+ float d_var_nproduced;
+ std::vector<float> d_avg_input_buffers_full;
+ std::vector<float> d_var_input_buffers_full;
+ std::vector<float> d_avg_output_buffers_full;
+ std::vector<float> d_var_output_buffers_full;
+ gruel::high_res_timer_type d_start_of_work, d_end_of_work;
+ float d_avg_work_time;
+ float d_var_work_time;
+ float d_pc_counter;
+
+ gr_block_detail (unsigned int ninputs, unsigned int noutputs);
+
+ friend struct gr_tpb_detail;
+
+ friend GR_CORE_API gr_block_detail_sptr
+ gr_make_block_detail (unsigned int ninputs, unsigned int noutputs);
+};
+
+GR_CORE_API gr_block_detail_sptr
+gr_make_block_detail (unsigned int ninputs, unsigned int noutputs);
+
+GR_CORE_API long
+gr_block_detail_ncurrently_allocated ();
+
+#endif /* INCLUDED_GR_BLOCK_DETAIL_H */
diff --git a/gnuradio-core/src/lib/runtime/gr_block_detail.i b/gnuradio-core/src/lib/runtime/gr_block_detail.i
new file mode 100644
index 000000000..74ff46360
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_block_detail.i
@@ -0,0 +1,66 @@
+/* -*- 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.
+ */
+
+class gr_block_detail;
+typedef boost::shared_ptr<gr_block_detail> gr_block_detail_sptr;
+%template(gr_block_detail_sptr) boost::shared_ptr<gr_block_detail>;
+%rename(block_detail) gr_make_block_detail;
+%ignore gr_block_detail;
+
+gr_block_detail_sptr gr_make_block_detail (unsigned int ninputs, unsigned int noutputs);
+
+class gr_block_detail {
+ public:
+
+ ~gr_block_detail ();
+
+ int ninputs () const { return d_ninputs; }
+ int noutputs () const { return d_noutputs; }
+ bool sink_p () const { return d_noutputs == 0; }
+ bool source_p () const { return d_ninputs == 0; }
+
+ void set_input (unsigned int which, gr_buffer_reader_sptr reader);
+ gr_buffer_reader_sptr input (unsigned int which)
+ {
+ if (which >= d_ninputs)
+ throw std::invalid_argument ("gr_block_detail::input");
+ return d_input[which];
+ }
+
+ void set_output (unsigned int which, gr_buffer_sptr buffer);
+ gr_buffer_sptr output (unsigned int which)
+ {
+ if (which >= d_noutputs)
+ throw std::invalid_argument ("gr_block_detail::output");
+ return d_output[which];
+ }
+
+ // ----------------------------------------------------------------------------
+
+ private:
+ gr_block_detail (unsigned int ninputs, unsigned int noutputs);
+
+};
+
+
+%rename(block_detail_ncurrently_allocated) gr_block_detail_ncurrently_allocated;
+long gr_block_detail_ncurrently_allocated ();
diff --git a/gnuradio-core/src/lib/runtime/gr_block_executor.cc b/gnuradio-core/src/lib/runtime/gr_block_executor.cc
new file mode 100644
index 000000000..e070f3c50
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_block_executor.cc
@@ -0,0 +1,487 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2008,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_block_executor.h>
+#include <gr_block.h>
+#include <gr_block_detail.h>
+#include <gr_buffer.h>
+#include <gr_prefs.h>
+#include <boost/thread.hpp>
+#include <boost/format.hpp>
+#include <iostream>
+#include <limits>
+#include <assert.h>
+#include <stdio.h>
+
+// must be defined to either 0 or 1
+#define ENABLE_LOGGING 0
+
+#if (ENABLE_LOGGING)
+#define LOG(x) do { x; } while(0)
+#else
+#define LOG(x) do {;} while(0)
+#endif
+
+static int which_scheduler = 0;
+
+inline static unsigned int
+round_up (unsigned int n, unsigned int multiple)
+{
+ return ((n + multiple - 1) / multiple) * multiple;
+}
+
+inline static unsigned int
+round_down (unsigned int n, unsigned int multiple)
+{
+ return (n / multiple) * multiple;
+}
+
+//
+// Return minimum available write space in all our downstream buffers
+// or -1 if we're output blocked and the output we're blocked
+// on is done.
+//
+static int
+min_available_space (gr_block_detail *d, int output_multiple, int min_noutput_items)
+{
+ int min_space = std::numeric_limits<int>::max();
+ if (min_noutput_items == 0)
+ min_noutput_items = 1;
+ for (int i = 0; i < d->noutputs (); i++){
+ gruel::scoped_lock guard(*d->output(i)->mutex());
+ int avail_n = round_down(d->output(i)->space_available(), output_multiple);
+ int best_n = round_down(d->output(i)->bufsize()/2, output_multiple);
+ if (best_n < min_noutput_items)
+ throw std::runtime_error("Buffer too small for min_noutput_items");
+ int n = std::min(avail_n, best_n);
+ if (n < min_noutput_items){ // We're blocked on output.
+ if (d->output(i)->done()){ // Downstream is done, therefore we're done.
+ return -1;
+ }
+ return 0;
+ }
+ min_space = std::min (min_space, n);
+ }
+ return min_space;
+}
+
+static bool
+propagate_tags(gr_block::tag_propagation_policy_t policy, gr_block_detail *d,
+ const std::vector<uint64_t> &start_nitems_read, double rrate,
+ std::vector<gr_tag_t> &rtags)
+{
+ // Move tags downstream
+ // if a sink, we don't need to move downstream
+ if(d->sink_p()) {
+ return true;
+ }
+
+ switch(policy) {
+ case gr_block::TPP_DONT:
+ return true;
+ break;
+ case gr_block::TPP_ALL_TO_ALL:
+ // every tag on every input propogates to everyone downstream
+ for(int i = 0; i < d->ninputs(); i++) {
+ d->get_tags_in_range(rtags, i, start_nitems_read[i],
+ d->nitems_read(i));
+
+ std::vector<gr_tag_t>::iterator t;
+ if(rrate == 1.0) {
+ for(t = rtags.begin(); t != rtags.end(); t++) {
+ for(int o = 0; o < d->noutputs(); o++)
+ d->output(o)->add_item_tag(*t);
+ }
+ }
+ else {
+ for(t = rtags.begin(); t != rtags.end(); t++) {
+ gr_tag_t new_tag = *t;
+ new_tag.offset *= rrate;
+ for(int o = 0; o < d->noutputs(); o++)
+ d->output(o)->add_item_tag(new_tag);
+ }
+ }
+ }
+ break;
+ case gr_block::TPP_ONE_TO_ONE:
+ // tags from input i only go to output i
+ // this requires d->ninputs() == d->noutputs; this is checked when this
+ // type of tag-propagation system is selected in gr_block_detail
+ if(d->ninputs() == d->noutputs()) {
+ for(int i = 0; i < d->ninputs(); i++) {
+ d->get_tags_in_range(rtags, i, start_nitems_read[i],
+ d->nitems_read(i));
+
+ std::vector<gr_tag_t>::iterator t;
+ for(t = rtags.begin(); t != rtags.end(); t++) {
+ gr_tag_t new_tag = *t;
+ new_tag.offset *= rrate;
+ d->output(i)->add_item_tag(new_tag);
+ }
+ }
+ }
+ else {
+ std::cerr << "Error: gr_block_executor: propagation_policy 'ONE-TO-ONE' requires ninputs == noutputs" << std::endl;
+ return false;
+ }
+
+ break;
+ default:
+ return true;
+ }
+ return true;
+}
+
+gr_block_executor::gr_block_executor (gr_block_sptr block, int max_noutput_items)
+ : d_block(block), d_log(0), d_max_noutput_items(max_noutput_items)
+{
+ if (ENABLE_LOGGING){
+ std::string name = str(boost::format("sst-%03d.log") % which_scheduler++);
+ d_log = new std::ofstream(name.c_str());
+ std::unitbuf(*d_log); // make it unbuffered...
+ *d_log << "gr_block_executor: "
+ << d_block << std::endl;
+ }
+
+#ifdef GR_PERFORMANCE_COUNTERS
+ gr_prefs *prefs = gr_prefs::singleton();
+ d_use_pc = prefs->get_bool("PerfCounters", "on", false);
+#endif /* GR_PERFORMANCE_COUNTERS */
+
+ d_block->start(); // enable any drivers, etc.
+}
+
+gr_block_executor::~gr_block_executor ()
+{
+ if (ENABLE_LOGGING)
+ delete d_log;
+
+ d_block->stop(); // stop any drivers, etc.
+}
+
+gr_block_executor::state
+gr_block_executor::run_one_iteration()
+{
+ int noutput_items;
+ int max_items_avail;
+ int max_noutput_items = d_max_noutput_items;
+ int new_alignment=0;
+ int alignment_state=-1;
+
+ gr_block *m = d_block.get();
+ gr_block_detail *d = m->detail().get();
+
+ LOG(*d_log << std::endl << m);
+
+ if (d->done()){
+ assert(0);
+ return DONE;
+ }
+
+ if (d->source_p ()){
+ d_ninput_items_required.resize (0);
+ d_ninput_items.resize (0);
+ d_input_items.resize (0);
+ d_input_done.resize(0);
+ d_output_items.resize (d->noutputs ());
+ d_start_nitems_read.resize(0);
+
+ // determine the minimum available output space
+ noutput_items = min_available_space (d, m->output_multiple (), m->min_noutput_items ());
+ noutput_items = std::min(noutput_items, max_noutput_items);
+ LOG(*d_log << " source\n noutput_items = " << noutput_items << std::endl);
+ if (noutput_items == -1) // we're done
+ goto were_done;
+
+ if (noutput_items == 0){ // we're output blocked
+ LOG(*d_log << " BLKD_OUT\n");
+ return BLKD_OUT;
+ }
+
+ goto setup_call_to_work; // jump to common code
+ }
+
+ else if (d->sink_p ()){
+ d_ninput_items_required.resize (d->ninputs ());
+ d_ninput_items.resize (d->ninputs ());
+ d_input_items.resize (d->ninputs ());
+ d_input_done.resize(d->ninputs());
+ d_output_items.resize (0);
+ d_start_nitems_read.resize(d->ninputs());
+ LOG(*d_log << " sink\n");
+
+ max_items_avail = 0;
+ for (int i = 0; i < d->ninputs (); i++){
+ {
+ /*
+ * Acquire the mutex and grab local copies of items_available and done.
+ */
+ gruel::scoped_lock guard(*d->input(i)->mutex());
+ d_ninput_items[i] = d->input(i)->items_available();
+ d_input_done[i] = d->input(i)->done();
+ }
+
+ LOG(*d_log << " d_ninput_items[" << i << "] = " << d_ninput_items[i] << std::endl);
+ LOG(*d_log << " d_input_done[" << i << "] = " << d_input_done[i] << std::endl);
+
+ if (d_ninput_items[i] < m->output_multiple() && d_input_done[i])
+ goto were_done;
+
+ max_items_avail = std::max (max_items_avail, d_ninput_items[i]);
+ }
+
+ // take a swag at how much output we can sink
+ noutput_items = (int) (max_items_avail * m->relative_rate ());
+ noutput_items = round_down (noutput_items, m->output_multiple ());
+ noutput_items = std::min(noutput_items, max_noutput_items);
+ LOG(*d_log << " max_items_avail = " << max_items_avail << std::endl);
+ LOG(*d_log << " noutput_items = " << noutput_items << std::endl);
+
+ if (noutput_items == 0){ // we're blocked on input
+ LOG(*d_log << " BLKD_IN\n");
+ return BLKD_IN;
+ }
+
+ goto try_again; // Jump to code shared with regular case.
+ }
+
+ else {
+ // do the regular thing
+ d_ninput_items_required.resize (d->ninputs ());
+ d_ninput_items.resize (d->ninputs ());
+ d_input_items.resize (d->ninputs ());
+ d_input_done.resize(d->ninputs());
+ d_output_items.resize (d->noutputs ());
+ d_start_nitems_read.resize(d->ninputs());
+
+ max_items_avail = 0;
+ for (int i = 0; i < d->ninputs (); i++){
+ {
+ /*
+ * Acquire the mutex and grab local copies of items_available and done.
+ */
+ gruel::scoped_lock guard(*d->input(i)->mutex());
+ d_ninput_items[i] = d->input(i)->items_available ();
+ d_input_done[i] = d->input(i)->done();
+ }
+ max_items_avail = std::max (max_items_avail, d_ninput_items[i]);
+ }
+
+ // determine the minimum available output space
+ noutput_items = min_available_space (d, m->output_multiple (), m->min_noutput_items ());
+ if (ENABLE_LOGGING){
+ *d_log << " regular ";
+ if (m->relative_rate() >= 1.0)
+ *d_log << "1:" << m->relative_rate() << std::endl;
+ else
+ *d_log << 1.0/m->relative_rate() << ":1\n";
+ *d_log << " max_items_avail = " << max_items_avail << std::endl;
+ *d_log << " noutput_items = " << noutput_items << std::endl;
+ }
+ if (noutput_items == -1) // we're done
+ goto were_done;
+
+ if (noutput_items == 0){ // we're output blocked
+ LOG(*d_log << " BLKD_OUT\n");
+ return BLKD_OUT;
+ }
+
+ try_again:
+ if (m->fixed_rate()){
+ // try to work it forward starting with max_items_avail.
+ // We want to try to consume all the input we've got.
+ int reqd_noutput_items = m->fixed_rate_ninput_to_noutput(max_items_avail);
+
+ // only test this if we specifically set the output_multiple
+ if(m->output_multiple_set())
+ reqd_noutput_items = round_down(reqd_noutput_items, m->output_multiple());
+
+ if (reqd_noutput_items > 0 && reqd_noutput_items <= noutput_items)
+ noutput_items = reqd_noutput_items;
+
+ // if we need this many outputs, overrule the max_noutput_items setting
+ max_noutput_items = std::max(m->output_multiple(), max_noutput_items);
+ }
+ noutput_items = std::min(noutput_items, max_noutput_items);
+
+ // Check if we're still unaligned; use up items until we're
+ // aligned again. Otherwise, make sure we set the alignment
+ // requirement.
+ if(!m->output_multiple_set()) {
+ if(m->is_unaligned()) {
+ // When unaligned, don't just set noutput_items to the remaining
+ // samples to meet alignment; this causes too much overhead in
+ // requiring a premature call back here. Set the maximum amount
+ // of samples to handle unalignment and get us back aligned.
+ if(noutput_items >= m->unaligned()) {
+ noutput_items = round_up(noutput_items, m->alignment()) \
+ - (m->alignment() - m->unaligned());
+ new_alignment = 0;
+ }
+ else {
+ new_alignment = m->unaligned() - noutput_items;
+ }
+ alignment_state = 0;
+ }
+ else if(noutput_items < m->alignment()) {
+ // if we don't have enough for an aligned call, keep track of
+ // misalignment, set unaligned flag, and proceed.
+ new_alignment = m->alignment() - noutput_items;
+ m->set_unaligned(new_alignment);
+ m->set_is_unaligned(true);
+ alignment_state = 1;
+ }
+ else {
+ // enough to round down to the nearest alignment and process.
+ noutput_items = round_down(noutput_items, m->alignment());
+ m->set_is_unaligned(false);
+ alignment_state = 2;
+ }
+ }
+
+ // ask the block how much input they need to produce noutput_items
+ m->forecast (noutput_items, d_ninput_items_required);
+
+ // See if we've got sufficient input available
+
+ int i;
+ for (i = 0; i < d->ninputs (); i++)
+ if (d_ninput_items_required[i] > d_ninput_items[i]) // not enough
+ break;
+
+ if (i < d->ninputs ()){ // not enough input on input[i]
+ // if we can, try reducing the size of our output request
+ if (noutput_items > m->output_multiple ()){
+ noutput_items /= 2;
+ noutput_items = round_up (noutput_items, m->output_multiple ());
+ goto try_again;
+ }
+
+ // We're blocked on input
+ LOG(*d_log << " BLKD_IN\n");
+ if (d_input_done[i]) // If the upstream block is done, we're done
+ goto were_done;
+
+ // Is it possible to ever fulfill this request?
+ if (d_ninput_items_required[i] > d->input(i)->max_possible_items_available ()){
+ // Nope, never going to happen...
+ std::cerr << "\nsched: <gr_block " << m->name()
+ << " (" << m->unique_id() << ")>"
+ << " is requesting more input data\n"
+ << " than we can provide.\n"
+ << " ninput_items_required = "
+ << d_ninput_items_required[i] << "\n"
+ << " max_possible_items_available = "
+ << d->input(i)->max_possible_items_available() << "\n"
+ << " If this is a filter, consider reducing the number of taps.\n";
+ goto were_done;
+ }
+
+ // If we were made unaligned in this round but return here without
+ // processing; reset the unalignment claim before next entry.
+ if(alignment_state == 1) {
+ m->set_unaligned(0);
+ m->set_is_unaligned(false);
+ }
+ return BLKD_IN;
+ }
+
+ // We've got enough data on each input to produce noutput_items.
+ // Finish setting up the call to work.
+
+ for (int i = 0; i < d->ninputs (); i++)
+ d_input_items[i] = d->input(i)->read_pointer();
+
+ setup_call_to_work:
+
+ d->d_produce_or = 0;
+ for (int i = 0; i < d->noutputs (); i++)
+ d_output_items[i] = d->output(i)->write_pointer();
+
+ // determine where to start looking for new tags
+ for (int i = 0; i < d->ninputs(); i++)
+ d_start_nitems_read[i] = d->nitems_read(i);
+
+#ifdef GR_PERFORMANCE_COUNTERS
+ if(d_use_pc)
+ d->start_perf_counters();
+#endif /* GR_PERFORMANCE_COUNTERS */
+
+ // Do the actual work of the block
+ int n = m->general_work (noutput_items, d_ninput_items,
+ d_input_items, d_output_items);
+
+#ifdef GR_PERFORMANCE_COUNTERS
+ if(d_use_pc)
+ d->stop_perf_counters(noutput_items, n);
+#endif /* GR_PERFORMANCE_COUNTERS */
+
+ LOG(*d_log << " general_work: noutput_items = " << noutput_items
+ << " result = " << n << std::endl);
+
+ // Adjust number of unaligned items left to process
+ if(m->is_unaligned()) {
+ m->set_unaligned(new_alignment);
+ m->set_is_unaligned(m->unaligned() != 0);
+ }
+
+ if(!propagate_tags(m->tag_propagation_policy(), d,
+ d_start_nitems_read, m->relative_rate(),
+ d_returned_tags))
+ goto were_done;
+
+ if (n == gr_block::WORK_DONE)
+ goto were_done;
+
+ if (n != gr_block::WORK_CALLED_PRODUCE)
+ d->produce_each (n); // advance write pointers
+
+ if (d->d_produce_or > 0) // block produced something
+ return READY;
+
+ // We didn't produce any output even though we called general_work.
+ // We have (most likely) consumed some input.
+
+ /*
+ // If this is a source, it's broken.
+ if (d->source_p()){
+ std::cerr << "gr_block_executor: source " << m
+ << " produced no output. We're marking it DONE.\n";
+ // FIXME maybe we ought to raise an exception...
+ goto were_done;
+ }
+ */
+
+ // Have the caller try again...
+ return READY_NO_OUTPUT;
+ }
+ assert (0);
+
+ were_done:
+ LOG(*d_log << " were_done\n");
+ d->set_done (true);
+ return DONE;
+}
diff --git a/gnuradio-core/src/lib/runtime/gr_block_executor.h b/gnuradio-core/src/lib/runtime/gr_block_executor.h
new file mode 100644
index 000000000..fb7f9c269
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_block_executor.h
@@ -0,0 +1,78 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_GR_BLOCK_EXECUTOR_H
+#define INCLUDED_GR_BLOCK_EXECUTOR_H
+
+#include <gr_core_api.h>
+#include <gr_runtime_types.h>
+#include <fstream>
+#include <gr_tags.h>
+
+//class gr_block_executor;
+//typedef boost::shared_ptr<gr_block_executor> gr_block_executor_sptr;
+
+
+/*!
+ * \brief Manage the execution of a single block.
+ * \ingroup internal
+ */
+
+class GR_CORE_API gr_block_executor {
+protected:
+ gr_block_sptr d_block; // The block we're trying to run
+ std::ofstream *d_log;
+
+ // These are allocated here so we don't have to on each iteration
+
+ gr_vector_int d_ninput_items_required;
+ gr_vector_int d_ninput_items;
+ gr_vector_const_void_star d_input_items;
+ std::vector<bool> d_input_done;
+ gr_vector_void_star d_output_items;
+ std::vector<uint64_t> d_start_nitems_read; //stores where tag counts are before work
+ std::vector<gr_tag_t> d_returned_tags;
+ int d_max_noutput_items;
+
+#ifdef GR_PERFORMANCE_COUNTERS
+ bool d_use_pc;
+#endif /* GR_PERFORMANCE_COUNTERS */
+
+ public:
+ gr_block_executor(gr_block_sptr block, int max_noutput_items=100000);
+ ~gr_block_executor ();
+
+ enum state {
+ READY, // We made progress; everything's cool.
+ READY_NO_OUTPUT, // We consumed some input, but produced no output.
+ BLKD_IN, // no progress; we're blocked waiting for input data.
+ BLKD_OUT, // no progress; we're blocked waiting for output buffer space.
+ DONE, // we're done; don't call me again.
+ };
+
+ /*
+ * \brief Run one iteration.
+ */
+ state run_one_iteration();
+};
+
+#endif /* INCLUDED_GR_BLOCK_EXECUTOR_H */
diff --git a/gnuradio-core/src/lib/runtime/gr_block_registry.cc b/gnuradio-core/src/lib/runtime/gr_block_registry.cc
new file mode 100644
index 000000000..ff23d97eb
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_block_registry.cc
@@ -0,0 +1,76 @@
+#include <gr_basic_block.h>
+#include <gr_block_registry.h>
+#include <gr_tpb_detail.h>
+#include <gr_block_detail.h>
+#include <gr_block.h>
+#include <stdio.h>
+
+gr_block_registry global_block_registry;
+
+gr_block_registry::gr_block_registry(){
+ d_ref_map = pmt::pmt_make_dict();
+}
+
+long gr_block_registry::block_register(gr_basic_block* block){
+ if(d_map.find(block->name()) == d_map.end()){
+ d_map[block->name()] = blocksubmap_t();
+ d_map[block->name()][0] = block;
+ return 0;
+ } else {
+ for(size_t i=0; i<=d_map[block->name()].size(); i++){
+ if(d_map[block->name()].find(i) == d_map[block->name()].end()){
+ d_map[block->name()][i] = block;
+ return i;
+ }
+ }
+ }
+ throw std::runtime_error("should not reach this");
+}
+
+void gr_block_registry::block_unregister(gr_basic_block* block){
+ d_map[block->name()].erase( d_map[block->name()].find(block->symbolic_id()));
+ d_ref_map = pmt::pmt_dict_delete(d_ref_map, pmt::pmt_intern(block->symbol_name()));
+ if(block->alias_set()){
+ d_ref_map = pmt::pmt_dict_delete(d_ref_map, pmt::pmt_intern(block->alias()));
+ }
+}
+
+std::string gr_block_registry::register_symbolic_name(gr_basic_block* block){
+ std::stringstream ss;
+ ss << block->name() << block->symbolic_id();
+ //std::cout << "register_symbolic_name: " << ss.str() << std::endl;
+ register_symbolic_name(block, ss.str());
+ return ss.str();
+}
+
+void gr_block_registry::register_symbolic_name(gr_basic_block* block, std::string name){
+ if(pmt_dict_has_key(d_ref_map, pmt::pmt_intern(name))){
+ throw std::runtime_error("symbol already exists, can not re-use!");
+ }
+ d_ref_map = pmt_dict_add(d_ref_map, pmt::pmt_intern(name), pmt::pmt_make_any(block));
+}
+
+gr_basic_block_sptr gr_block_registry::block_lookup(pmt::pmt_t symbol){
+ pmt::pmt_t ref = pmt_dict_ref(d_ref_map, symbol, pmt::PMT_NIL);
+ if(pmt::pmt_eq(ref, pmt::PMT_NIL)){
+ throw std::runtime_error("block lookup failed! block not found!");
+ }
+ gr_basic_block* blk = boost::any_cast<gr_basic_block*>( pmt::pmt_any_ref(ref) );
+ return blk->shared_from_this();
+}
+
+
+void gr_block_registry::register_primitive(std::string blk, gr_block* ref){
+ primitive_map[blk] = ref;
+}
+
+void gr_block_registry::unregister_primitive(std::string blk){
+ primitive_map.erase(primitive_map.find(blk));
+}
+
+void gr_block_registry::notify_blk(std::string blk){
+ if(primitive_map.find(blk) == primitive_map.end()){ return; }
+ if(primitive_map[blk]->detail().get())
+ primitive_map[blk]->detail()->d_tpb.notify_msg();
+}
+
diff --git a/gnuradio-core/src/lib/runtime/gr_block_registry.h b/gnuradio-core/src/lib/runtime/gr_block_registry.h
new file mode 100644
index 000000000..3a9d9868f
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_block_registry.h
@@ -0,0 +1,43 @@
+#ifndef GR_BLOCK_REGISTRY_H
+#define GR_BLOCK_REGISTRY_H
+
+#include <map>
+#include <gr_basic_block.h>
+
+#ifndef GR_BASIC_BLOCK_H
+class gr_basic_block;
+class gr_block;
+#endif
+
+class gr_block_registry {
+ public:
+ gr_block_registry();
+
+ long block_register(gr_basic_block* block);
+ void block_unregister(gr_basic_block* block);
+
+ std::string register_symbolic_name(gr_basic_block* block);
+ void register_symbolic_name(gr_basic_block* block, std::string name);
+
+ gr_basic_block_sptr block_lookup(pmt::pmt_t symbol);
+
+ void register_primitive(std::string blk, gr_block* ref);
+ void unregister_primitive(std::string blk);
+ void notify_blk(std::string blk);
+
+ private:
+
+ //typedef std::map< long, gr_basic_block_sptr > blocksubmap_t;
+ typedef std::map< long, gr_basic_block* > blocksubmap_t;
+ typedef std::map< std::string, blocksubmap_t > blockmap_t;
+
+ blockmap_t d_map;
+ pmt::pmt_t d_ref_map;
+ std::map< std::string, gr_block*> primitive_map;
+
+};
+
+extern gr_block_registry global_block_registry;
+
+#endif
+
diff --git a/gnuradio-core/src/lib/runtime/gr_buffer.cc b/gnuradio-core/src/lib/runtime/gr_buffer.cc
new file mode 100644
index 000000000..369959d65
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_buffer.cc
@@ -0,0 +1,347 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_buffer.h>
+#include <gr_vmcircbuf.h>
+#include <gr_math.h>
+#include <stdexcept>
+#include <iostream>
+#include <assert.h>
+#include <algorithm>
+#include <boost/math/common_factor_rt.hpp>
+
+static long s_buffer_count = 0; // counts for debugging storage mgmt
+static long s_buffer_reader_count = 0;
+
+// ----------------------------------------------------------------------------
+// Notes on storage management
+//
+// Pretty much all the fundamental classes are now using the
+// shared_ptr stuff for automatic reference counting. To ensure that
+// no mistakes are made, we make the constructors for classes private,
+// and then provide a free factory function that returns a smart
+// pointer to the desired class.
+//
+// gr_buffer and gr_buffer_reader are no exceptions. However, they
+// both want pointers to each other, and unless we do something, we'll
+// never delete any of them because of the circular structure.
+// They'll always have a reference count of at least one. We could
+// use boost::weak_ptr's from gr_buffer to gr_buffer_reader but that
+// introduces it's own problems. (gr_buffer_reader's destructor needs
+// to call gr_buffer::drop_reader, but has no easy way to get a
+// shared_ptr to itself.)
+//
+// Instead, we solve this problem by having gr_buffer hold a raw
+// pointer to gr_buffer_reader in its d_reader vector.
+// gr_buffer_reader's destructor calls gr_buffer::drop_reader, so
+// we're never left with an dangling pointer. gr_buffer_reader still
+// has a shared_ptr to the buffer ensuring that the buffer doesn't go
+// away under it. However, when the reference count of a
+// gr_buffer_reader goes to zero, we can successfully reclaim it.
+// ----------------------------------------------------------------------------
+
+
+/*
+ * Compute the minimum number of buffer items that work (i.e.,
+ * address space wrap-around works). To work is to satisfy this
+ * contraint for integer buffer_size and k:
+ *
+ * type_size * nitems == k * page_size
+ */
+static long
+minimum_buffer_items (long type_size, long page_size)
+{
+ return page_size / boost::math::gcd (type_size, page_size);
+}
+
+
+gr_buffer::gr_buffer (int nitems, size_t sizeof_item, gr_block_sptr link)
+ : d_base (0), d_bufsize (0), d_vmcircbuf (0),
+ d_sizeof_item (sizeof_item), d_link(link),
+ d_write_index (0), d_abs_write_offset(0), d_done (false),
+ d_last_min_items_read(0)
+{
+ if (!allocate_buffer (nitems, sizeof_item))
+ throw std::bad_alloc ();
+
+ s_buffer_count++;
+}
+
+gr_buffer_sptr
+gr_make_buffer (int nitems, size_t sizeof_item, gr_block_sptr link)
+{
+ return gr_buffer_sptr (new gr_buffer (nitems, sizeof_item, link));
+}
+
+gr_buffer::~gr_buffer ()
+{
+ delete d_vmcircbuf;
+ assert (d_readers.size() == 0);
+ s_buffer_count--;
+}
+
+/*!
+ * sets d_vmcircbuf, d_base, d_bufsize.
+ * returns true iff successful.
+ */
+bool
+gr_buffer::allocate_buffer (int nitems, size_t sizeof_item)
+{
+ int orig_nitems = nitems;
+
+ // Any buffersize we come up with must be a multiple of min_nitems.
+
+ int granularity = gr_vmcircbuf_sysconfig::granularity ();
+ int min_nitems = minimum_buffer_items (sizeof_item, granularity);
+
+ // Round-up nitems to a multiple of min_nitems.
+
+ if (nitems % min_nitems != 0)
+ nitems = ((nitems / min_nitems) + 1) * min_nitems;
+
+ // If we rounded-up a whole bunch, give the user a heads up.
+ // This only happens if sizeof_item is not a power of two.
+
+ if (nitems > 2 * orig_nitems && nitems * (int) sizeof_item > granularity){
+ std::cerr << "gr_buffer::allocate_buffer: warning: tried to allocate\n"
+ << " " << orig_nitems << " items of size "
+ << sizeof_item << ". Due to alignment requirements\n"
+ << " " << nitems << " were allocated. If this isn't OK, consider padding\n"
+ << " your structure to a power-of-two bytes.\n"
+ << " On this platform, our allocation granularity is " << granularity << " bytes.\n";
+ }
+
+ d_bufsize = nitems;
+ d_vmcircbuf = gr_vmcircbuf_sysconfig::make (d_bufsize * d_sizeof_item);
+ if (d_vmcircbuf == 0){
+ std::cerr << "gr_buffer::allocate_buffer: failed to allocate buffer of size "
+ << d_bufsize * d_sizeof_item / 1024 << " KB\n";
+ return false;
+ }
+
+ d_base = (char *) d_vmcircbuf->pointer_to_first_copy ();
+ return true;
+}
+
+
+int
+gr_buffer::space_available ()
+{
+ if (d_readers.empty ())
+ return d_bufsize - 1; // See comment below
+
+ else {
+
+ // Find out the maximum amount of data available to our readers
+
+ int most_data = d_readers[0]->items_available ();
+ uint64_t min_items_read = d_readers[0]->nitems_read();
+ for (size_t i = 1; i < d_readers.size (); i++) {
+ most_data = std::max (most_data, d_readers[i]->items_available ());
+ min_items_read = std::min(min_items_read, d_readers[i]->nitems_read());
+ }
+
+ if(min_items_read != d_last_min_items_read) {
+ prune_tags(d_last_min_items_read);
+ d_last_min_items_read = min_items_read;
+ }
+
+ // The -1 ensures that the case d_write_index == d_read_index is
+ // unambiguous. It indicates that there is no data for the reader
+
+ return d_bufsize - most_data - 1;
+ }
+}
+
+void *
+gr_buffer::write_pointer ()
+{
+ return &d_base[d_write_index * d_sizeof_item];
+}
+
+void
+gr_buffer::update_write_pointer (int nitems)
+{
+ gruel::scoped_lock guard(*mutex());
+ d_write_index = index_add (d_write_index, nitems);
+ d_abs_write_offset += nitems;
+}
+
+void
+gr_buffer::set_done (bool done)
+{
+ gruel::scoped_lock guard(*mutex());
+ d_done = done;
+}
+
+gr_buffer_reader_sptr
+gr_buffer_add_reader (gr_buffer_sptr buf, int nzero_preload, gr_block_sptr link)
+{
+ if (nzero_preload < 0)
+ throw std::invalid_argument("gr_buffer_add_reader: nzero_preload must be >= 0");
+
+ gr_buffer_reader_sptr r (new gr_buffer_reader (buf,
+ buf->index_sub(buf->d_write_index,
+ nzero_preload),
+ link));
+ buf->d_readers.push_back (r.get ());
+
+ return r;
+}
+
+void
+gr_buffer::drop_reader (gr_buffer_reader *reader)
+{
+ // isn't C++ beautiful... GAG!
+
+ std::vector<gr_buffer_reader *>::iterator result =
+ std::find (d_readers.begin (), d_readers.end (), reader);
+
+ if (result == d_readers.end ())
+ throw std::invalid_argument ("gr_buffer::drop_reader"); // we didn't find it...
+
+ d_readers.erase (result);
+}
+
+void
+gr_buffer::add_item_tag(const gr_tag_t &tag)
+{
+ gruel::scoped_lock guard(*mutex());
+ d_item_tags.push_back(tag);
+}
+
+void
+gr_buffer::remove_item_tag(const gr_tag_t &tag)
+{
+ gruel::scoped_lock guard(*mutex());
+ for (std::deque<gr_tag_t>::iterator it = d_item_tags.begin(); it != d_item_tags.end(); ++it) {
+ if (*it == tag) {
+ d_item_tags.erase(it);
+ break;
+ }
+ }
+}
+
+void
+gr_buffer::prune_tags(uint64_t max_time)
+{
+ /* NOTE: this function _should_ lock the mutex before editing
+ d_item_tags. In practice, this function is only called at
+ runtime by min_available_space in gr_block_executor.cc,
+ which locks the mutex itself.
+
+ If this function is used elsewhere, remember to lock the
+ buffer's mutex al la the scoped_lock line below.
+ */
+ //gruel::scoped_lock guard(*mutex());
+ std::deque<gr_tag_t>::iterator itr = d_item_tags.begin();
+
+ uint64_t item_time;
+
+ // Since tags are not guarenteed to be in any particular order,
+ // we need to erase here instead of pop_front. An erase in the
+ // middle invalidates all iterators; so this resets the iterator
+ // to find more. Mostly, we wil be erasing from the front and
+ // therefore lose little time this way.
+ while(itr != d_item_tags.end()) {
+ item_time = (*itr).offset;
+ if(item_time < max_time) {
+ d_item_tags.erase(itr);
+ itr = d_item_tags.begin();
+ }
+ else
+ itr++;
+ }
+}
+
+long
+gr_buffer_ncurrently_allocated ()
+{
+ return s_buffer_count;
+}
+
+// ----------------------------------------------------------------------------
+
+gr_buffer_reader::gr_buffer_reader(gr_buffer_sptr buffer, unsigned int read_index,
+ gr_block_sptr link)
+ : d_buffer(buffer), d_read_index(read_index), d_abs_read_offset(0), d_link(link)
+{
+ s_buffer_reader_count++;
+}
+
+gr_buffer_reader::~gr_buffer_reader ()
+{
+ d_buffer->drop_reader(this);
+ s_buffer_reader_count--;
+}
+
+int
+gr_buffer_reader::items_available () const
+{
+ return d_buffer->index_sub (d_buffer->d_write_index, d_read_index);
+}
+
+const void *
+gr_buffer_reader::read_pointer ()
+{
+ return &d_buffer->d_base[d_read_index * d_buffer->d_sizeof_item];
+}
+
+void
+gr_buffer_reader::update_read_pointer (int nitems)
+{
+ gruel::scoped_lock guard(*mutex());
+ d_read_index = d_buffer->index_add (d_read_index, nitems);
+ d_abs_read_offset += nitems;
+}
+
+void
+gr_buffer_reader::get_tags_in_range(std::vector<gr_tag_t> &v,
+ uint64_t abs_start,
+ uint64_t abs_end)
+{
+ gruel::scoped_lock guard(*mutex());
+
+ v.resize(0);
+ std::deque<gr_tag_t>::iterator itr = d_buffer->get_tags_begin();
+
+ uint64_t item_time;
+ while(itr != d_buffer->get_tags_end()) {
+ item_time = (*itr).offset;
+
+ if((item_time >= abs_start) && (item_time < abs_end)) {
+ v.push_back(*itr);
+ }
+
+ itr++;
+ }
+}
+
+long
+gr_buffer_reader_ncurrently_allocated ()
+{
+ return s_buffer_reader_count;
+}
diff --git a/gnuradio-core/src/lib/runtime/gr_buffer.h b/gnuradio-core/src/lib/runtime/gr_buffer.h
new file mode 100644
index 000000000..28ea97726
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_buffer.h
@@ -0,0 +1,309 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2009,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.
+ */
+
+#ifndef INCLUDED_GR_BUFFER_H
+#define INCLUDED_GR_BUFFER_H
+
+#include <gr_core_api.h>
+#include <gr_runtime_types.h>
+#include <boost/weak_ptr.hpp>
+#include <gruel/thread.h>
+#include <gr_tags.h>
+#include <deque>
+
+class gr_vmcircbuf;
+
+/*!
+ * \brief Allocate a buffer that holds at least \p nitems of size \p sizeof_item.
+ *
+ * The total size of the buffer will be rounded up to a system
+ * dependent boundary. This is typically the system page size, but
+ * under MS windows is 64KB.
+ *
+ * \param nitems is the minimum number of items the buffer will hold.
+ * \param sizeof_item is the size of an item in bytes.
+ * \param link is the block that writes to this buffer.
+ */
+GR_CORE_API gr_buffer_sptr gr_make_buffer (int nitems, size_t sizeof_item, gr_block_sptr link=gr_block_sptr());
+
+
+/*!
+ * \brief Single writer, multiple reader fifo.
+ * \ingroup internal
+ */
+class GR_CORE_API gr_buffer {
+ public:
+
+ virtual ~gr_buffer ();
+
+ /*!
+ * \brief return number of items worth of space available for writing
+ */
+ int space_available ();
+
+ /*!
+ * \brief return size of this buffer in items
+ */
+ int bufsize() const { return d_bufsize; }
+
+ /*!
+ * \brief return pointer to write buffer.
+ *
+ * The return value points at space that can hold at least
+ * space_available() items.
+ */
+ void *write_pointer ();
+
+ /*!
+ * \brief tell buffer that we wrote \p nitems into it
+ */
+ void update_write_pointer (int nitems);
+
+ void set_done (bool done);
+ bool done () const { return d_done; }
+
+ /*!
+ * \brief Return the block that writes to this buffer.
+ */
+ gr_block_sptr link() { return gr_block_sptr(d_link); }
+
+ size_t nreaders() const { return d_readers.size(); }
+ gr_buffer_reader* reader(size_t index) { return d_readers[index]; }
+
+ gruel::mutex *mutex() { return &d_mutex; }
+
+ uint64_t nitems_written() { return d_abs_write_offset; }
+
+ size_t get_sizeof_item() { return d_sizeof_item; }
+
+ /*!
+ * \brief Adds a new tag to the buffer.
+ *
+ * \param tag the new tag
+ */
+ void add_item_tag(const gr_tag_t &tag);
+
+ /*!
+ * \brief Removes an existing tag from the buffer.
+ *
+ * If no such tag is found, does nothing.
+ *
+ * \param tag the tag that needs to be removed
+ */
+ void remove_item_tag(const gr_tag_t &tag);
+
+ /*!
+ * \brief Removes all tags before \p max_time from buffer
+ *
+ * \param max_time the time (item number) to trim up until.
+ */
+ void prune_tags(uint64_t max_time);
+
+ std::deque<gr_tag_t>::iterator get_tags_begin() { return d_item_tags.begin(); }
+ std::deque<gr_tag_t>::iterator get_tags_end() { return d_item_tags.end(); }
+
+ // -------------------------------------------------------------------------
+
+ private:
+
+ friend class gr_buffer_reader;
+ friend GR_CORE_API gr_buffer_sptr gr_make_buffer (int nitems, size_t sizeof_item, gr_block_sptr link);
+ friend GR_CORE_API gr_buffer_reader_sptr gr_buffer_add_reader (gr_buffer_sptr buf, int nzero_preload, gr_block_sptr link);
+
+ protected:
+ char *d_base; // base address of buffer
+ unsigned int d_bufsize; // in items
+ private:
+ gr_vmcircbuf *d_vmcircbuf;
+ size_t d_sizeof_item; // in bytes
+ std::vector<gr_buffer_reader *> d_readers;
+ boost::weak_ptr<gr_block> d_link; // block that writes to this buffer
+
+ //
+ // The mutex protects d_write_index, d_abs_write_offset, d_done, d_item_tags
+ // and the d_read_index's and d_abs_read_offset's in the buffer readers.
+ //
+ gruel::mutex d_mutex;
+ unsigned int d_write_index; // in items [0,d_bufsize)
+ uint64_t d_abs_write_offset; // num items written since the start
+ bool d_done;
+ std::deque<gr_tag_t> d_item_tags;
+ uint64_t d_last_min_items_read;
+
+ unsigned
+ index_add (unsigned a, unsigned b)
+ {
+ unsigned s = a + b;
+
+ if (s >= d_bufsize)
+ s -= d_bufsize;
+
+ assert (s < d_bufsize);
+ return s;
+ }
+
+ unsigned
+ index_sub (unsigned a, unsigned b)
+ {
+ int s = a - b;
+
+ if (s < 0)
+ s += d_bufsize;
+
+ assert ((unsigned) s < d_bufsize);
+ return s;
+ }
+
+ virtual bool allocate_buffer (int nitems, size_t sizeof_item);
+
+ /*!
+ * \brief constructor is private. Use gr_make_buffer to create instances.
+ *
+ * Allocate a buffer that holds at least \p nitems of size \p sizeof_item.
+ *
+ * \param nitems is the minimum number of items the buffer will hold.
+ * \param sizeof_item is the size of an item in bytes.
+ * \param link is the block that writes to this buffer.
+ *
+ * The total size of the buffer will be rounded up to a system
+ * dependent boundary. This is typically the system page size, but
+ * under MS windows is 64KB.
+ */
+ gr_buffer (int nitems, size_t sizeof_item, gr_block_sptr link);
+
+ /*!
+ * \brief disassociate \p reader from this buffer
+ */
+ void drop_reader (gr_buffer_reader *reader);
+
+};
+
+/*!
+ * \brief Create a new gr_buffer_reader and attach it to buffer \p buf
+ * \param buf is the buffer the \p gr_buffer_reader reads from.
+ * \param nzero_preload -- number of zero items to "preload" into buffer.
+ * \param link is the block that reads from the buffer using this gr_buffer_reader.
+ */
+GR_CORE_API gr_buffer_reader_sptr
+gr_buffer_add_reader (gr_buffer_sptr buf, int nzero_preload, gr_block_sptr link=gr_block_sptr());
+
+//! returns # of gr_buffers currently allocated
+GR_CORE_API long gr_buffer_ncurrently_allocated ();
+
+
+// ---------------------------------------------------------------------------
+
+/*!
+ * \brief How we keep track of the readers of a gr_buffer.
+ * \ingroup internal
+ */
+
+class GR_CORE_API gr_buffer_reader {
+ public:
+
+ ~gr_buffer_reader ();
+
+ /*!
+ * \brief Return number of items available for reading.
+ */
+ int items_available () const;
+
+ /*!
+ * \brief Return buffer this reader reads from.
+ */
+ gr_buffer_sptr buffer () const { return d_buffer; }
+
+
+ /*!
+ * \brief Return maximum number of items that could ever be available for reading.
+ * This is used as a sanity check in the scheduler to avoid looping forever.
+ */
+ int max_possible_items_available () const { return d_buffer->d_bufsize - 1; }
+
+ /*!
+ * \brief return pointer to read buffer.
+ *
+ * The return value points to items_available() number of items
+ */
+ const void *read_pointer ();
+
+ /*
+ * \brief tell buffer we read \p items from it
+ */
+ void update_read_pointer (int nitems);
+
+ void set_done (bool done) { d_buffer->set_done (done); }
+ bool done () const { return d_buffer->done (); }
+
+ gruel::mutex *mutex() { return d_buffer->mutex(); }
+
+
+ uint64_t nitems_read() { return d_abs_read_offset; }
+
+ size_t get_sizeof_item() { return d_buffer->get_sizeof_item(); }
+
+ /*!
+ * \brief Return the block that reads via this reader.
+ *
+ */
+ gr_block_sptr link() { return gr_block_sptr(d_link); }
+
+
+ /*!
+ * \brief Given a [start,end), returns a vector all tags in the range.
+ *
+ * Get a vector of tags in given range. Range of counts is from start to end-1.
+ *
+ * Tags are tuples of:
+ * (item count, source id, key, value)
+ *
+ * \param v a vector reference to return tags into
+ * \param abs_start a uint64 count of the start of the range of interest
+ * \param abs_end a uint64 count of the end of the range of interest
+ */
+ void get_tags_in_range(std::vector<gr_tag_t> &v,
+ uint64_t abs_start,
+ uint64_t abs_end);
+
+ // -------------------------------------------------------------------------
+
+ private:
+
+ friend class gr_buffer;
+ friend GR_CORE_API gr_buffer_reader_sptr
+ gr_buffer_add_reader (gr_buffer_sptr buf, int nzero_preload, gr_block_sptr link);
+
+
+ gr_buffer_sptr d_buffer;
+ unsigned int d_read_index; // in items [0,d->buffer.d_bufsize)
+ uint64_t d_abs_read_offset; // num items seen since the start
+ boost::weak_ptr<gr_block> d_link; // block that reads via this buffer reader
+
+ //! constructor is private. Use gr_buffer::add_reader to create instances
+ gr_buffer_reader (gr_buffer_sptr buffer, unsigned int read_index, gr_block_sptr link);
+};
+
+//! returns # of gr_buffer_readers currently allocated
+GR_CORE_API long gr_buffer_reader_ncurrently_allocated ();
+
+
+#endif /* INCLUDED_GR_BUFFER_H */
diff --git a/gnuradio-core/src/lib/runtime/gr_buffer.i b/gnuradio-core/src/lib/runtime/gr_buffer.i
new file mode 100644
index 000000000..390a94e05
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_buffer.i
@@ -0,0 +1,63 @@
+/* -*- 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.
+ */
+
+class gr_buffer;
+typedef boost::shared_ptr<gr_buffer> gr_buffer_sptr;
+%template(gr_buffer_sptr) boost::shared_ptr<gr_buffer>;
+%rename(buffer) gr_make_buffer;
+%ignore gr_buffer;
+
+gr_buffer_sptr gr_make_buffer (int nitems, size_t sizeof_item, gr_block_sptr link);
+
+class gr_buffer {
+ public:
+ ~gr_buffer ();
+
+ private:
+ gr_buffer (int nitems, size_t sizeof_item, gr_block_sptr link);
+};
+
+
+class gr_buffer_reader;
+typedef boost::shared_ptr<gr_buffer_reader> gr_buffer_reader_sptr;
+%template(gr_buffer_reader_sptr) boost::shared_ptr<gr_buffer_reader>;
+%ignore gr_buffer_reader;
+
+%rename(buffer_add_reader) gr_buffer_add_reader;
+gr_buffer_reader_sptr gr_buffer_add_reader (gr_buffer_sptr buf, int nzero_preload, gr_block_sptr link);
+
+class gr_buffer_reader {
+ public:
+ ~gr_buffer_reader ();
+
+ private:
+ friend class gr_buffer;
+ gr_buffer_reader (gr_buffer_sptr buffer, unsigned int read_index, gr_block_sptr link);
+};
+
+
+%rename(buffer_ncurrently_allocated) gr_buffer_ncurrently_allocated;
+long gr_buffer_ncurrently_allocated ();
+
+%rename(buffer_reader_ncurrently_allocated) gr_buffer_reader_ncurrently_allocated;
+long gr_buffer_reader_ncurrently_allocated ();
+
diff --git a/gnuradio-core/src/lib/runtime/gr_complex.h b/gnuradio-core/src/lib/runtime/gr_complex.h
new file mode 100644
index 000000000..58d1525b4
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_complex.h
@@ -0,0 +1,46 @@
+/* -*- 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_COMPLEX_H
+#define INCLUDED_GR_COMPLEX_H
+
+#include <complex>
+typedef std::complex<float> gr_complex;
+typedef std::complex<double> gr_complexd;
+
+
+inline bool is_complex (gr_complex x) { (void) x; return true;}
+inline bool is_complex (gr_complexd x) { (void) x; return true;}
+inline bool is_complex (float x) { (void) x; return false;}
+inline bool is_complex (double x) { (void) x; return false;}
+inline bool is_complex (int x) { (void) x; return false;}
+inline bool is_complex (char x) { (void) x; return false;}
+inline bool is_complex (short x) { (void) x; return false;}
+
+
+// this doesn't really belong here, but there are worse places for it...
+
+#define CPPUNIT_ASSERT_COMPLEXES_EQUAL(expected,actual,delta) \
+ CPPUNIT_ASSERT_DOUBLES_EQUAL (expected.real(), actual.real(), delta); \
+ CPPUNIT_ASSERT_DOUBLES_EQUAL (expected.imag(), actual.imag(), delta);
+
+#endif /* INCLUDED_GR_COMPLEX_H */
+
diff --git a/gnuradio-core/src/lib/runtime/gr_dispatcher.cc b/gnuradio-core/src/lib/runtime/gr_dispatcher.cc
new file mode 100644
index 000000000..96ebe9ad8
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_dispatcher.cc
@@ -0,0 +1,193 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005 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 <gr_dispatcher.h>
+#include <math.h>
+#include <errno.h>
+#include <stdio.h>
+
+#ifdef HAVE_SELECT
+# ifdef HAVE_SYS_SELECT_H
+# include <sys/select.h>
+# else
+# ifdef HAVE_SYS_TIME_H
+# include <sys/time.h>
+# endif
+# ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+# endif
+# ifdef HAVE_UNISTD_H
+# include <unistd.h>
+# endif
+# endif
+#endif
+
+
+static gr_dispatcher_sptr s_singleton;
+
+gr_dispatcher_sptr
+gr_make_dispatcher()
+{
+ return gr_dispatcher_sptr(new gr_dispatcher());
+}
+
+gr_dispatcher_sptr
+gr_dispatcher_singleton()
+{
+ if (s_singleton)
+ return s_singleton;
+
+ s_singleton = gr_make_dispatcher();
+ return s_singleton;
+}
+
+#if !defined(HAVE_SELECT) // Stub it out
+
+gr_dispatcher::gr_dispatcher()
+{
+}
+
+gr_dispatcher::~gr_dispatcher()
+{
+}
+
+bool
+gr_dispatcher::add_handler(gr_select_handler_sptr handler)
+{
+ return true;
+}
+
+bool
+gr_dispatcher::del_handler(gr_select_handler_sptr handler)
+{
+ return true;
+}
+
+bool
+gr_dispatcher::del_handler(gr_select_handler *handler)
+{
+ return true;
+}
+
+void
+gr_dispatcher::loop(double timeout)
+{
+}
+
+#else // defined(HAVE_SELECT)
+
+gr_dispatcher::gr_dispatcher()
+ : d_handler(FD_SETSIZE), d_max_index(-1)
+{
+}
+
+gr_dispatcher::~gr_dispatcher()
+{
+}
+
+bool
+gr_dispatcher::add_handler(gr_select_handler_sptr handler)
+{
+ int fd = handler->fd();
+ if (fd < 0 || fd >= FD_SETSIZE)
+ return false;
+
+ d_max_index = std::max(d_max_index, fd);
+ d_handler[fd] = handler;
+ return true;
+}
+
+bool
+gr_dispatcher::del_handler(gr_select_handler_sptr handler)
+{
+ return del_handler(handler.get());
+}
+
+bool
+gr_dispatcher::del_handler(gr_select_handler *handler)
+{
+ int fd = handler->fd();
+ if (fd < 0 || fd >= FD_SETSIZE)
+ return false;
+
+ d_handler[fd].reset();
+
+ if (fd == d_max_index){
+ int i;
+ for (i = fd - 1; i >= 0 && !d_handler[i]; i--)
+ ;
+ d_max_index = i;
+ }
+ return true;
+}
+
+
+void
+gr_dispatcher::loop(double timeout)
+{
+ struct timeval master;
+ struct timeval tmp;
+ fd_set rd_set;
+ fd_set wr_set;
+
+ double secs = floor (timeout);
+ master.tv_sec = (long) secs;
+ master.tv_usec = (long) ((timeout - secs) * 1e6);
+
+ while (d_max_index >= 0){
+ FD_ZERO(&rd_set);
+ FD_ZERO(&wr_set);
+
+ for (int i = 0; i <= d_max_index; i++){
+ if (d_handler[i] && d_handler[i]->readable())
+ FD_SET(i, &rd_set);
+ if (d_handler[i] && d_handler[i]->writable())
+ FD_SET(i, &wr_set);
+ }
+
+ tmp = master;
+ int retval = select(d_max_index+1, &rd_set, &wr_set, 0, &tmp);
+ if (retval == 0) // timed out with nothing ready
+ continue;
+ if (retval < 0){
+ if (errno == EINTR)
+ continue;
+ perror ("gr_dispatcher/select");
+ return;
+ }
+
+ for (int i = 0; i <= d_max_index; i++){
+ if (FD_ISSET(i, &rd_set))
+ if (d_handler[i])
+ d_handler[i]->handle_read();
+ if (FD_ISSET(i, &wr_set))
+ if (d_handler[i])
+ d_handler[i]->handle_write();
+ }
+ }
+}
+
+#endif
diff --git a/gnuradio-core/src/lib/runtime/gr_dispatcher.h b/gnuradio-core/src/lib/runtime/gr_dispatcher.h
new file mode 100644
index 000000000..72a0b0176
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_dispatcher.h
@@ -0,0 +1,69 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005 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_DISPATCHER_H
+#define INCLUDED_GR_DISPATCHER_H
+
+#include <gr_core_api.h>
+#include <gr_select_handler.h>
+#include <vector>
+
+class gr_dispatcher;
+typedef boost::shared_ptr<gr_dispatcher> gr_dispatcher_sptr;
+
+GR_CORE_API gr_dispatcher_sptr gr_dispatcher_singleton();
+GR_CORE_API gr_dispatcher_sptr gr_make_dispatcher();
+
+/*!
+ * \brief invoke callbacks based on select.
+ * \ingroup internal
+ *
+ * \sa gr_select_handler
+ */
+class GR_CORE_API gr_dispatcher
+{
+ gr_dispatcher();
+ friend GR_CORE_API gr_dispatcher_sptr gr_make_dispatcher();
+
+ std::vector<gr_select_handler_sptr> d_handler;
+ int d_max_index;
+
+public:
+ ~gr_dispatcher();
+
+ bool add_handler(gr_select_handler_sptr handler);
+ bool del_handler(gr_select_handler_sptr handler);
+ bool del_handler(gr_select_handler *handler);
+
+ /*!
+ * \brief Event dispatching loop.
+ *
+ * Enter a polling loop that only terminates after all gr_select_handlers
+ * have been removed. \p timeout sets the timeout parameter to the select()
+ * call, measured in seconds.
+ *
+ * \param timeout maximum number of seconds to block in select.
+ */
+ void loop(double timeout=10);
+};
+
+#endif /* INCLUDED_GR_DISPATCHER_H */
diff --git a/gnuradio-core/src/lib/runtime/gr_dispatcher.i b/gnuradio-core/src/lib/runtime/gr_dispatcher.i
new file mode 100644
index 000000000..28737cd31
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_dispatcher.i
@@ -0,0 +1,55 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005 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.
+ */
+
+class gr_dispatcher;
+typedef boost::shared_ptr<gr_dispatcher> gr_dispatcher_sptr;
+%template(gr_dispatcher_sptr) boost::shared_ptr<gr_dispatcher>;
+
+%rename(dispatcher) gr_make_dispatcher;
+gr_dispatcher_sptr gr_make_dispatcher();
+
+%rename(dispatcher_singleton) gr_dispatcher_singleton;
+gr_dispatcher_sptr gr_dispatcher_singleton();
+
+/*!
+ * \brief invoke callbacks based on select.
+ *
+ * \sa gr_select_handler
+ */
+class gr_dispatcher
+{
+ gr_dispatcher();
+
+public:
+ ~gr_dispatcher();
+
+ /*!
+ * \brief Event dispatching loop.
+ *
+ * Enter a polling loop that only terminates after all gr_select_handlers
+ * have been removed. \p timeout sets the timeout parameter to the select()
+ * call, measured in seconds.
+ *
+ * \param timeout maximum number of seconds to block in select.
+ */
+ void loop(double timeout=10);
+};
diff --git a/gnuradio-core/src/lib/runtime/gr_error_handler.cc b/gnuradio-core/src/lib/runtime/gr_error_handler.cc
new file mode 100644
index 000000000..448682966
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_error_handler.cc
@@ -0,0 +1,244 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005 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 code is based on error.cc from the "Click Modular Router".
+ * Original copyright follows:
+ */
+/*
+ * error.{cc,hh} -- flexible classes for error reporting
+ * Eddie Kohler
+ *
+ * Copyright (c) 1999-2000 Massachusetts Institute of Technology
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, subject to the conditions
+ * listed in the Click LICENSE file. These conditions include: you must
+ * preserve this copyright notice, and you cannot mention the copyright
+ * holders in advertising related to the Software without their permission.
+ * The Software is provided WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED. This
+ * notice is a summary of the Click LICENSE file; the license in that file is
+ * legally binding.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_error_handler.h>
+#include <assert.h>
+#include <stdexcept>
+#include <unistd.h>
+
+#ifdef HAVE_IO_H
+#include <io.h>
+#endif
+
+static gr_error_handler *s_default_handler = 0;
+static gr_error_handler *s_silent_handler = 0;
+
+bool
+gr_error_handler::has_default_handler()
+{
+ return s_default_handler != 0;
+}
+
+void
+gr_error_handler::set_default_handler(gr_error_handler *errh)
+{
+ s_default_handler = errh;
+}
+
+gr_error_handler *
+gr_error_handler::default_handler()
+{
+ assert (s_default_handler != 0);
+ return s_default_handler;
+}
+
+gr_error_handler *
+gr_error_handler::silent_handler()
+{
+ assert (s_silent_handler != 0);
+ return s_silent_handler;
+}
+
+// ----------------------------------------------------------------
+
+gr_error_handler::~gr_error_handler()
+{
+ // nop
+}
+
+void
+gr_error_handler::debug(const char *format, ...)
+{
+ va_list val;
+ va_start(val, format);
+ verror(ERR_DEBUG, format, val);
+ va_end(val);
+}
+
+void
+gr_error_handler::message(const char *format, ...)
+{
+ va_list val;
+ va_start(val, format);
+ verror(ERR_MESSAGE, format, val);
+ va_end(val);
+}
+
+void
+gr_error_handler::warning(const char *format, ...)
+{
+ va_list val;
+ va_start(val, format);
+ verror(ERR_WARNING, format, val);
+ va_end(val);
+}
+
+void
+gr_error_handler::error(const char *format, ...)
+{
+ va_list val;
+ va_start(val, format);
+ verror(ERR_ERROR, format, val);
+ va_end(val);
+}
+
+void
+gr_error_handler::fatal(const char *format, ...)
+{
+ va_list val;
+ va_start(val, format);
+ verror(ERR_FATAL, format, val);
+ va_end(val);
+}
+
+void
+gr_error_handler::verror(seriousness s, const char *format, va_list val)
+{
+ std::string text = make_text(s, format, val);
+ handle_text(s, text);
+ count_error(s);
+}
+
+void
+gr_error_handler::verror_text(seriousness s, const std::string &text)
+{
+ // text is already made
+ handle_text(s, text);
+ count_error(s);
+}
+
+std::string
+gr_error_handler::make_text(seriousness s, const char *format, va_list val)
+{
+ char text_buf[4096];
+ vsnprintf(text_buf, sizeof(text_buf), format, val);
+ text_buf[sizeof(text_buf)-1] = 0;
+ return text_buf;
+}
+
+// ----------------------------------------------------------------
+
+void
+gr_base_error_handler::count_error(seriousness s)
+{
+ if (s < ERR_WARNING)
+ /* do nothing */;
+ else if (s < ERR_ERROR)
+ d_nwarnings++;
+ else
+ d_nerrors++;
+}
+
+// ----------------------------------------------------------------
+
+gr_file_error_handler::gr_file_error_handler(FILE *file)
+ : d_file(file), d_fd(-1)
+{
+}
+
+gr_file_error_handler::gr_file_error_handler(int file_descriptor)
+{
+ d_fd = dup(file_descriptor); // so we can fclose it
+ if (d_fd == -1){
+ perror("gr_file_error_handler:dup");
+ throw std::invalid_argument("gr_file_error_handler:dup");
+ }
+ d_file = fdopen(d_fd, "w");
+ if (d_file == 0){
+ perror("gr_file_error_handler:fdopen");
+ throw std::invalid_argument("gr_file_error_handler:fdopen");
+ }
+}
+
+gr_file_error_handler::~gr_file_error_handler()
+{
+ if (d_fd != -1){
+ fclose(d_file);
+ }
+}
+
+void
+gr_file_error_handler::handle_text(seriousness s, const std::string &text)
+{
+ if (text.length() <= 0)
+ return;
+
+ fwrite(text.data(), 1, text.length(), d_file);
+ if (text[text.length()-1] != '\n')
+ fwrite("\n", 1, 1, d_file);
+
+ if (d_fd != -1)
+ fflush(d_file); // keep synced with any other users of fd
+}
+
+
+// ----------------------------------------------------------------
+// static error handlers
+//
+
+class gr_silent_error_handler : public gr_base_error_handler
+{
+public:
+ gr_silent_error_handler() {}
+ void handle_text(seriousness s, const std::string &str);
+};
+
+void
+gr_silent_error_handler::handle_text(seriousness s, const std::string &str)
+{
+ // nop
+}
+
+class force_init {
+public:
+ force_init()
+ {
+ s_default_handler = new gr_file_error_handler(stdout);
+ s_silent_handler = new gr_silent_error_handler();
+ }
+};
+
+static force_init kludge;
diff --git a/gnuradio-core/src/lib/runtime/gr_error_handler.h b/gnuradio-core/src/lib/runtime/gr_error_handler.h
new file mode 100644
index 000000000..569c01c45
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_error_handler.h
@@ -0,0 +1,117 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005 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 code is based on error.hh from the "Click Modular Router".
+ * Original copyright follows:
+ */
+/*
+ * error.{cc,hh} -- flexible classes for error reporting
+ * Eddie Kohler
+ *
+ * Copyright (c) 1999-2000 Massachusetts Institute of Technology
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, subject to the conditions
+ * listed in the Click LICENSE file. These conditions include: you must
+ * preserve this copyright notice, and you cannot mention the copyright
+ * holders in advertising related to the Software without their permission.
+ * The Software is provided WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED. This
+ * notice is a summary of the Click LICENSE file; the license in that file is
+ * legally binding.
+ */
+
+#ifndef INCLUDED_GR_ERROR_HANDLER_H
+#define INCLUDED_GR_ERROR_HANDLER_H
+
+#include <gr_core_api.h>
+#include <stdarg.h>
+#include <string>
+#include <cstdio> // for FILE
+
+/*!
+ * \brief abstract error handler
+ * \ingroup base
+ */
+class GR_CORE_API gr_error_handler {
+public:
+ enum seriousness {
+ ERR_DEBUG = 0x00000000,
+ ERR_MESSAGE = 0x00010000,
+ ERR_WARNING = 0x00020000,
+ ERR_ERROR = 0x00030000,
+ ERR_FATAL = 0x00040000
+ };
+
+ gr_error_handler() {}
+ virtual ~gr_error_handler();
+
+ static gr_error_handler *default_handler();
+ static gr_error_handler *silent_handler();
+
+ static bool has_default_handler();
+ static void set_default_handler(gr_error_handler *errh);
+
+ void debug(const char *format, ...);
+ void message(const char *format, ...);
+ void warning(const char *format, ...);
+ void error(const char *format, ...);
+ void fatal(const char *format, ...);
+
+ virtual int nwarnings() const = 0;
+ virtual int nerrors() const = 0;
+ virtual void reset_counts() = 0;
+
+ void verror(seriousness s, const char *format, va_list);
+ void verror_text(seriousness s, const std::string &text);
+
+protected:
+ virtual void count_error(seriousness s) = 0;
+ virtual void handle_text(seriousness s, const std::string &str) = 0;
+ std::string make_text(seriousness s, const char *format, va_list);
+};
+
+
+class GR_CORE_API gr_base_error_handler : public gr_error_handler {
+ int d_nwarnings;
+ int d_nerrors;
+
+public:
+ gr_base_error_handler() : d_nwarnings(0), d_nerrors(0) {}
+ int nwarnings() const { return d_nwarnings; }
+ int nerrors() const { return d_nerrors; }
+ void reset_counts() { d_nwarnings = d_nerrors = 0; }
+ void count_error(seriousness s);
+};
+
+class GR_CORE_API gr_file_error_handler : public gr_base_error_handler {
+ FILE *d_file;
+ int d_fd;
+public:
+ gr_file_error_handler(FILE *file);
+ gr_file_error_handler(int file_descriptor);
+ ~gr_file_error_handler();
+
+ void handle_text(seriousness s, const std::string &str);
+};
+
+#endif /* INCLUDED_GR_ERROR_HANDLER_H */
diff --git a/gnuradio-core/src/lib/runtime/gr_error_handler.i b/gnuradio-core/src/lib/runtime/gr_error_handler.i
new file mode 100644
index 000000000..072394a72
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_error_handler.i
@@ -0,0 +1,69 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005 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.
+ */
+
+%rename(error_handler) gr_error_handler;
+%rename(file_error_handler) gr_file_error_handler;
+
+class gr_error_handler {
+public:
+ enum seriousness {
+ ERR_DEBUG = 0x00000000,
+ ERR_MESSAGE = 0x00010000,
+ ERR_WARNING = 0x00020000,
+ ERR_ERROR = 0x00030000,
+ ERR_FATAL = 0x00040000
+ };
+
+ gr_error_handler() {}
+ virtual ~gr_error_handler();
+
+ static gr_error_handler *default_handler();
+ static gr_error_handler *silent_handler();
+
+ static bool has_default_handler();
+ static void set_default_handler(gr_error_handler *errh);
+
+ virtual int nwarnings() const = 0;
+ virtual int nerrors() const = 0;
+ virtual void reset_counts() = 0;
+
+ void verror_text(seriousness s, const std::string &text);
+};
+
+%ignore gr_base_error_handler;
+class gr_base_error_handler : public gr_error_handler {
+ int d_nwarnings;
+ int d_nerrors;
+
+public:
+ gr_base_error_handler() : d_nwarnings(0), d_nerrors(0) {}
+ int nwarnings() const { return d_nwarnings; }
+ int nerrors() const { return d_nerrors; }
+ void reset_counts() { d_nwarnings = d_nerrors = 0; }
+ void count_error(seriousness s);
+};
+
+class gr_file_error_handler : public gr_base_error_handler {
+public:
+ gr_file_error_handler(int file_descriptor);
+ ~gr_file_error_handler();
+};
diff --git a/gnuradio-core/src/lib/runtime/gr_flat_flowgraph.cc b/gnuradio-core/src/lib/runtime/gr_flat_flowgraph.cc
new file mode 100644
index 000000000..9294a5dca
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_flat_flowgraph.cc
@@ -0,0 +1,403 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_flat_flowgraph.h>
+#include <gr_block_detail.h>
+#include <gr_io_signature.h>
+#include <gr_buffer.h>
+#include <volk/volk.h>
+#include <iostream>
+#include <map>
+#include <boost/format.hpp>
+
+#define GR_FLAT_FLOWGRAPH_DEBUG 0
+
+// 32Kbyte buffer size between blocks
+#define GR_FIXED_BUFFER_SIZE (32*(1L<<10))
+
+static const unsigned int s_fixed_buffer_size = GR_FIXED_BUFFER_SIZE;
+
+gr_flat_flowgraph_sptr
+gr_make_flat_flowgraph()
+{
+ return gr_flat_flowgraph_sptr(new gr_flat_flowgraph());
+}
+
+gr_flat_flowgraph::gr_flat_flowgraph()
+{
+}
+
+gr_flat_flowgraph::~gr_flat_flowgraph()
+{
+}
+
+void
+gr_flat_flowgraph::setup_connections()
+{
+ gr_basic_block_vector_t blocks = calc_used_blocks();
+
+ // Assign block details to blocks
+ for (gr_basic_block_viter_t p = blocks.begin(); p != blocks.end(); p++)
+ cast_to_block_sptr(*p)->set_detail(allocate_block_detail(*p));
+
+ // Connect inputs to outputs for each block
+ for(gr_basic_block_viter_t p = blocks.begin(); p != blocks.end(); p++) {
+ connect_block_inputs(*p);
+
+ gr_block_sptr block = cast_to_block_sptr(*p);
+ block->set_unaligned(0);
+ block->set_is_unaligned(false);
+ }
+
+ // Connect message ports connetions
+ for(gr_msg_edge_viter_t i = d_msg_edges.begin(); i != d_msg_edges.end(); i++){
+ if(GR_FLAT_FLOWGRAPH_DEBUG)
+ std::cout << boost::format("flat_fg connecting msg primitives: (%s, %s)->(%s, %s)\n") %
+ i->src().block() % i->src().port() %
+ i->dst().block() % i->dst().port();
+ i->src().block()->message_port_sub( i->src().port(), pmt::pmt_cons(i->dst().block()->alias_pmt(), i->dst().port()) );
+ }
+
+}
+
+gr_block_detail_sptr
+gr_flat_flowgraph::allocate_block_detail(gr_basic_block_sptr block)
+{
+ int ninputs = calc_used_ports(block, true).size();
+ int noutputs = calc_used_ports(block, false).size();
+ gr_block_detail_sptr detail = gr_make_block_detail(ninputs, noutputs);
+
+ gr_block_sptr grblock = cast_to_block_sptr(block);
+ if(!grblock)
+ throw std::runtime_error("allocate_block_detail found non-gr_block");
+
+ if (GR_FLAT_FLOWGRAPH_DEBUG)
+ std::cout << "Creating block detail for " << block << std::endl;
+
+ for (int i = 0; i < noutputs; i++) {
+ grblock->expand_minmax_buffer(i);
+
+ gr_buffer_sptr buffer = allocate_buffer(block, i);
+ if (GR_FLAT_FLOWGRAPH_DEBUG)
+ std::cout << "Allocated buffer for output " << block << ":" << i << std::endl;
+ detail->set_output(i, buffer);
+
+ // Update the block's max_output_buffer based on what was actually allocated.
+ grblock->set_max_output_buffer(i, buffer->bufsize());
+ }
+
+ return detail;
+}
+
+gr_buffer_sptr
+gr_flat_flowgraph::allocate_buffer(gr_basic_block_sptr block, int port)
+{
+ gr_block_sptr grblock = cast_to_block_sptr(block);
+ if (!grblock)
+ throw std::runtime_error("allocate_buffer found non-gr_block");
+ int item_size = block->output_signature()->sizeof_stream_item(port);
+
+ // *2 because we're now only filling them 1/2 way in order to
+ // increase the available parallelism when using the TPB scheduler.
+ // (We're double buffering, where we used to single buffer)
+ int nitems = s_fixed_buffer_size * 2 / item_size;
+
+ // Make sure there are at least twice the output_multiple no. of items
+ if (nitems < 2*grblock->output_multiple()) // Note: this means output_multiple()
+ nitems = 2*grblock->output_multiple(); // can't be changed by block dynamically
+
+ // If any downstream blocks are decimators and/or have a large output_multiple,
+ // ensure we have a buffer at least twice their decimation factor*output_multiple
+ gr_basic_block_vector_t blocks = calc_downstream_blocks(block, port);
+
+ // limit buffer size if indicated
+ if(grblock->max_output_buffer(port) > 0) {
+// std::cout << "constraining output items to " << block->max_output_buffer(port) << "\n";
+ nitems = std::min((long)nitems, (long)grblock->max_output_buffer(port));
+ nitems -= nitems%grblock->output_multiple();
+ if( nitems < 1 )
+ throw std::runtime_error("problems allocating a buffer with the given max output buffer constraint!");
+ }
+ else if(grblock->min_output_buffer(port) > 0) {
+ nitems = std::max((long)nitems, (long)grblock->min_output_buffer(port));
+ nitems -= nitems%grblock->output_multiple();
+ if( nitems < 1 )
+ throw std::runtime_error("problems allocating a buffer with the given min output buffer constraint!");
+ }
+
+ for (gr_basic_block_viter_t p = blocks.begin(); p != blocks.end(); p++) {
+ gr_block_sptr dgrblock = cast_to_block_sptr(*p);
+ if (!dgrblock)
+ throw std::runtime_error("allocate_buffer found non-gr_block");
+
+ double decimation = (1.0/dgrblock->relative_rate());
+ int multiple = dgrblock->output_multiple();
+ int history = dgrblock->history();
+ nitems = std::max(nitems, static_cast<int>(2*(decimation*multiple+history)));
+ }
+
+// std::cout << "gr_make_buffer(" << nitems << ", " << item_size << ", " << grblock << "\n";
+ return gr_make_buffer(nitems, item_size, grblock);
+}
+
+void
+gr_flat_flowgraph::connect_block_inputs(gr_basic_block_sptr block)
+{
+ gr_block_sptr grblock = cast_to_block_sptr(block);
+ if (!grblock)
+ throw std::runtime_error("connect_block_inputs found non-gr_block");
+
+ // Get its detail and edges that feed into it
+ gr_block_detail_sptr detail = grblock->detail();
+ gr_edge_vector_t in_edges = calc_upstream_edges(block);
+
+ // For each edge that feeds into it
+ for (gr_edge_viter_t e = in_edges.begin(); e != in_edges.end(); e++) {
+ // Set the buffer reader on the destination port to the output
+ // buffer on the source port
+ int dst_port = e->dst().port();
+ int src_port = e->src().port();
+ gr_basic_block_sptr src_block = e->src().block();
+ gr_block_sptr src_grblock = cast_to_block_sptr(src_block);
+ if (!src_grblock)
+ throw std::runtime_error("connect_block_inputs found non-gr_block");
+ gr_buffer_sptr src_buffer = src_grblock->detail()->output(src_port);
+
+ if (GR_FLAT_FLOWGRAPH_DEBUG)
+ std::cout << "Setting input " << dst_port << " from edge " << (*e) << std::endl;
+
+ detail->set_input(dst_port, gr_buffer_add_reader(src_buffer, grblock->history()-1, grblock));
+ }
+}
+
+void
+gr_flat_flowgraph::merge_connections(gr_flat_flowgraph_sptr old_ffg)
+{
+ // Allocate block details if needed. Only new blocks that aren't pruned out
+ // by flattening will need one; existing blocks still in the new flowgraph will
+ // already have one.
+ for (gr_basic_block_viter_t p = d_blocks.begin(); p != d_blocks.end(); p++) {
+ gr_block_sptr block = cast_to_block_sptr(*p);
+
+ if (!block->detail()) {
+ if (GR_FLAT_FLOWGRAPH_DEBUG)
+ std::cout << "merge: allocating new detail for block " << (*p) << std::endl;
+ block->set_detail(allocate_block_detail(block));
+ }
+ else
+ if (GR_FLAT_FLOWGRAPH_DEBUG)
+ std::cout << "merge: reusing original detail for block " << (*p) << std::endl;
+ }
+
+ // Calculate the old edges that will be going away, and clear the buffer readers
+ // on the RHS.
+ for (gr_edge_viter_t old_edge = old_ffg->d_edges.begin(); old_edge != old_ffg->d_edges.end(); old_edge++) {
+ if (GR_FLAT_FLOWGRAPH_DEBUG)
+ std::cout << "merge: testing old edge " << (*old_edge) << "...";
+
+ gr_edge_viter_t new_edge;
+ for (new_edge = d_edges.begin(); new_edge != d_edges.end(); new_edge++)
+ if (new_edge->src() == old_edge->src() &&
+ new_edge->dst() == old_edge->dst())
+ break;
+
+ if (new_edge == d_edges.end()) { // not found in new edge list
+ if (GR_FLAT_FLOWGRAPH_DEBUG)
+ std::cout << "not in new edge list" << std::endl;
+ // zero the buffer reader on RHS of old edge
+ gr_block_sptr block(cast_to_block_sptr(old_edge->dst().block()));
+ int port = old_edge->dst().port();
+ block->detail()->set_input(port, gr_buffer_reader_sptr());
+ }
+ else {
+ if (GR_FLAT_FLOWGRAPH_DEBUG)
+ std::cout << "found in new edge list" << std::endl;
+ }
+ }
+
+ // Now connect inputs to outputs, reusing old buffer readers if they exist
+ for (gr_basic_block_viter_t p = d_blocks.begin(); p != d_blocks.end(); p++) {
+ gr_block_sptr block = cast_to_block_sptr(*p);
+
+ if (GR_FLAT_FLOWGRAPH_DEBUG)
+ std::cout << "merge: merging " << (*p) << "...";
+
+ if (old_ffg->has_block_p(*p)) {
+ // Block exists in old flow graph
+ if (GR_FLAT_FLOWGRAPH_DEBUG)
+ std::cout << "used in old flow graph" << std::endl;
+ gr_block_detail_sptr detail = block->detail();
+
+ // Iterate through the inputs and see what needs to be done
+ int ninputs = calc_used_ports(block, true).size(); // Might be different now
+ for (int i = 0; i < ninputs; i++) {
+ if (GR_FLAT_FLOWGRAPH_DEBUG)
+ std::cout << "Checking input " << block << ":" << i << "...";
+ gr_edge edge = calc_upstream_edge(*p, i);
+
+ // Fish out old buffer reader and see if it matches correct buffer from edge list
+ gr_block_sptr src_block = cast_to_block_sptr(edge.src().block());
+ gr_block_detail_sptr src_detail = src_block->detail();
+ gr_buffer_sptr src_buffer = src_detail->output(edge.src().port());
+ gr_buffer_reader_sptr old_reader;
+ if (i < detail->ninputs()) // Don't exceed what the original detail has
+ old_reader = detail->input(i);
+
+ // If there's a match, use it
+ if (old_reader && (src_buffer == old_reader->buffer())) {
+ if (GR_FLAT_FLOWGRAPH_DEBUG)
+ std::cout << "matched, reusing" << std::endl;
+ }
+ else {
+ if (GR_FLAT_FLOWGRAPH_DEBUG)
+ std::cout << "needs a new reader" << std::endl;
+
+ // Create new buffer reader and assign
+ detail->set_input(i, gr_buffer_add_reader(src_buffer, block->history()-1, block));
+ }
+ }
+ }
+ else {
+ // Block is new, it just needs buffer readers at this point
+ if (GR_FLAT_FLOWGRAPH_DEBUG)
+ std::cout << "new block" << std::endl;
+ connect_block_inputs(block);
+
+ // Make sure all buffers are aligned
+ setup_buffer_alignment(block);
+ }
+
+ // Now deal with the fact that the block details might have changed numbers of
+ // inputs and outputs vs. in the old flowgraph.
+ }
+}
+
+void
+gr_flat_flowgraph::setup_buffer_alignment(gr_block_sptr block)
+{
+ const int alignment = volk_get_alignment();
+ for(int i = 0; i < block->detail()->ninputs(); i++) {
+ void *r = (void*)block->detail()->input(i)->read_pointer();
+ unsigned long int ri = (unsigned long int)r % alignment;
+ //std::cerr << "reader: " << r << " alignment: " << ri << std::endl;
+ if(ri != 0) {
+ size_t itemsize = block->detail()->input(i)->get_sizeof_item();
+ block->detail()->input(i)->update_read_pointer(alignment-ri/itemsize);
+ }
+ block->set_unaligned(0);
+ block->set_is_unaligned(false);
+ }
+
+ for(int i = 0; i < block->detail()->noutputs(); i++) {
+ void *w = (void*)block->detail()->output(i)->write_pointer();
+ unsigned long int wi = (unsigned long int)w % alignment;
+ //std::cerr << "writer: " << w << " alignment: " << wi << std::endl;
+ if(wi != 0) {
+ size_t itemsize = block->detail()->output(i)->get_sizeof_item();
+ block->detail()->output(i)->update_write_pointer(alignment-wi/itemsize);
+ }
+ block->set_unaligned(0);
+ block->set_is_unaligned(false);
+ }
+}
+
+void gr_flat_flowgraph::dump()
+{
+ for (gr_edge_viter_t e = d_edges.begin(); e != d_edges.end(); e++)
+ std::cout << " edge: " << (*e) << std::endl;
+
+ for (gr_basic_block_viter_t p = d_blocks.begin(); p != d_blocks.end(); p++) {
+ std::cout << " block: " << (*p) << std::endl;
+ gr_block_detail_sptr detail = cast_to_block_sptr(*p)->detail();
+ std::cout << " detail @" << detail << ":" << std::endl;
+
+ int ni = detail->ninputs();
+ int no = detail->noutputs();
+ for (int i = 0; i < no; i++) {
+ gr_buffer_sptr buffer = detail->output(i);
+ std::cout << " output " << i << ": " << buffer << std::endl;
+ }
+
+ for (int i = 0; i < ni; i++) {
+ gr_buffer_reader_sptr reader = detail->input(i);
+ std::cout << " reader " << i << ": " << reader
+ << " reading from buffer=" << reader->buffer() << std::endl;
+ }
+ }
+
+}
+
+gr_block_vector_t
+gr_flat_flowgraph::make_block_vector(gr_basic_block_vector_t &blocks)
+{
+ gr_block_vector_t result;
+ for (gr_basic_block_viter_t p = blocks.begin(); p != blocks.end(); p++) {
+ result.push_back(cast_to_block_sptr(*p));
+ }
+
+ return result;
+}
+
+
+void gr_flat_flowgraph::clear_endpoint(const gr_msg_endpoint &e, bool is_src){
+ for(size_t i=0; i<d_msg_edges.size(); i++){
+ if(is_src){
+ if(d_msg_edges[i].src() == e){
+ d_msg_edges.erase(d_msg_edges.begin() + i);
+ i--;
+ }
+ } else {
+ if(d_msg_edges[i].dst() == e){
+ d_msg_edges.erase(d_msg_edges.begin() + i);
+ i--;
+ }
+ }
+ }
+}
+
+void gr_flat_flowgraph::replace_endpoint(const gr_msg_endpoint &e, const gr_msg_endpoint &r, bool is_src){
+ size_t n_replr(0);
+ if(GR_FLAT_FLOWGRAPH_DEBUG)
+ std::cout << boost::format("gr_flat_flowgraph::replace_endpoint( %s, %s, %d )\n") % e.block()% r.block()% is_src;
+ for(size_t i=0; i<d_msg_edges.size(); i++){
+ if(is_src){
+ if(d_msg_edges[i].src() == e){
+ if(GR_FLAT_FLOWGRAPH_DEBUG)
+ std::cout << boost::format("gr_flat_flowgraph::replace_endpoint() flattening to ( %s, %s )\n") % r.block()% d_msg_edges[i].dst().block();
+ d_msg_edges.push_back( gr_msg_edge(r, d_msg_edges[i].dst() ) );
+ n_replr++;
+ }
+ } else {
+ if(d_msg_edges[i].dst() == e){
+ if(GR_FLAT_FLOWGRAPH_DEBUG)
+ std::cout << boost::format("gr_flat_flowgraph::replace_endpoint() flattening to ( %s, %s )\n") % r.block()% d_msg_edges[i].dst().block();
+ d_msg_edges.push_back( gr_msg_edge(d_msg_edges[i].src(), r ) );
+ n_replr++;
+ }
+ }
+ }
+}
+
diff --git a/gnuradio-core/src/lib/runtime/gr_flat_flowgraph.h b/gnuradio-core/src/lib/runtime/gr_flat_flowgraph.h
new file mode 100644
index 000000000..5c8268d7d
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_flat_flowgraph.h
@@ -0,0 +1,80 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006,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.
+ */
+
+#ifndef INCLUDED_GR_FLAT_FLOWGRAPH_H
+#define INCLUDED_GR_FLAT_FLOWGRAPH_H
+
+#include <gr_core_api.h>
+#include <gr_flowgraph.h>
+#include <gr_block.h>
+
+// Create a shared pointer to a heap allocated gr_flat_flowgraph
+// (types defined in gr_runtime_types.h)
+GR_CORE_API gr_flat_flowgraph_sptr gr_make_flat_flowgraph();
+
+/*!
+ *\brief Class specializing gr_flat_flowgraph that has all nodes
+ * as gr_blocks, with no hierarchy
+ * \ingroup internal
+ */
+class GR_CORE_API gr_flat_flowgraph : public gr_flowgraph
+{
+public:
+ friend GR_CORE_API gr_flat_flowgraph_sptr gr_make_flat_flowgraph();
+
+ // Destruct an arbitrary gr_flat_flowgraph
+ ~gr_flat_flowgraph();
+
+ // Wire gr_blocks together in new flat_flowgraph
+ void setup_connections();
+
+ // Merge applicable connections from existing flat flowgraph
+ void merge_connections(gr_flat_flowgraph_sptr sfg);
+
+ void dump();
+
+ /*!
+ * Make a vector of gr_block from a vector of gr_basic_block
+ */
+ static gr_block_vector_t make_block_vector(gr_basic_block_vector_t &blocks);
+
+ void replace_endpoint(const gr_msg_endpoint &e, const gr_msg_endpoint &r, bool is_src);
+ void clear_endpoint(const gr_msg_endpoint &e, bool is_src);
+
+private:
+ gr_flat_flowgraph();
+
+ gr_block_detail_sptr allocate_block_detail(gr_basic_block_sptr block);
+ gr_buffer_sptr allocate_buffer(gr_basic_block_sptr block, int port);
+ void connect_block_inputs(gr_basic_block_sptr block);
+
+ /* When reusing a flowgraph's blocks, this call makes sure all of the
+ * buffer's are aligned at the machine's alignment boundary and tells
+ * the blocks that they are aligned.
+ *
+ * Called from both setup_connections and merge_connections for
+ * start and restarts.
+ */
+ void setup_buffer_alignment(gr_block_sptr block);
+};
+
+#endif /* INCLUDED_GR_FLAT_FLOWGRAPH_H */
diff --git a/gnuradio-core/src/lib/runtime/gr_flowgraph.cc b/gnuradio-core/src/lib/runtime/gr_flowgraph.cc
new file mode 100644
index 000000000..63a208480
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_flowgraph.cc
@@ -0,0 +1,515 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_flowgraph.h>
+#include <gr_io_signature.h>
+#include <stdexcept>
+#include <sstream>
+#include <iterator>
+
+#define GR_FLOWGRAPH_DEBUG 0
+
+gr_edge::~gr_edge()
+{
+}
+
+gr_flowgraph_sptr gr_make_flowgraph()
+{
+ return gr_flowgraph_sptr(new gr_flowgraph());
+}
+
+gr_flowgraph::gr_flowgraph()
+{
+}
+
+gr_flowgraph::~gr_flowgraph()
+{
+}
+
+// FIXME: move to libgruel as a utility function
+template<class T>
+static
+std::vector<T>
+unique_vector(std::vector<T> v)
+{
+ std::vector<T> result;
+ std::insert_iterator<std::vector<T> > inserter(result, result.begin());
+
+ sort(v.begin(), v.end());
+ unique_copy(v.begin(), v.end(), inserter);
+ return result;
+}
+
+void
+gr_flowgraph::connect(const gr_endpoint &src, const gr_endpoint &dst)
+{
+ check_valid_port(src.block()->output_signature(), src.port());
+ check_valid_port(dst.block()->input_signature(), dst.port());
+ check_dst_not_used(dst);
+ check_type_match(src, dst);
+
+ // All ist klar, Herr Kommisar
+ d_edges.push_back(gr_edge(src,dst));
+}
+
+void
+gr_flowgraph::disconnect(const gr_endpoint &src, const gr_endpoint &dst)
+{
+ for (gr_edge_viter_t p = d_edges.begin(); p != d_edges.end(); p++) {
+ if (src == p->src() && dst == p->dst()) {
+ d_edges.erase(p);
+ return;
+ }
+ }
+
+ std::stringstream msg;
+ msg << "cannot disconnect edge " << gr_edge(src, dst) << ", not found";
+ throw std::invalid_argument(msg.str());
+}
+
+void
+gr_flowgraph::validate()
+{
+ d_blocks = calc_used_blocks();
+
+ for (gr_basic_block_viter_t p = d_blocks.begin(); p != d_blocks.end(); p++) {
+ std::vector<int> used_ports;
+ int ninputs, noutputs;
+
+ if (GR_FLOWGRAPH_DEBUG)
+ std::cout << "Validating block: " << (*p) << std::endl;
+
+ used_ports = calc_used_ports(*p, true); // inputs
+ ninputs = used_ports.size();
+ check_contiguity(*p, used_ports, true); // inputs
+
+ used_ports = calc_used_ports(*p, false); // outputs
+ noutputs = used_ports.size();
+ check_contiguity(*p, used_ports, false); // outputs
+
+ if (!((*p)->check_topology(ninputs, noutputs))) {
+ std::stringstream msg;
+ msg << "check topology failed on " << (*p)
+ << " using ninputs=" << ninputs
+ << ", noutputs=" << noutputs;
+ throw std::runtime_error(msg.str());
+ }
+ }
+}
+
+void
+gr_flowgraph::clear()
+{
+ // Boost shared pointers will deallocate as needed
+ d_blocks.clear();
+ d_edges.clear();
+}
+
+void
+gr_flowgraph::check_valid_port(gr_io_signature_sptr sig, int port)
+{
+ std::stringstream msg;
+
+ if (port < 0) {
+ msg << "negative port number " << port << " is invalid";
+ throw std::invalid_argument(msg.str());
+ }
+
+ int max = sig->max_streams();
+ if (max != gr_io_signature::IO_INFINITE && port >= max) {
+ msg << "port number " << port << " exceeds max of ";
+ if (max == 0)
+ msg << "(none)";
+ else
+ msg << max-1;
+ throw std::invalid_argument(msg.str());
+ }
+}
+
+void
+gr_flowgraph::check_valid_port(const gr_msg_endpoint &e)
+{
+ if (GR_FLOWGRAPH_DEBUG)
+ std::cout << "check_valid_port( " << e.block() << ", " << e.port() << ")\n";
+
+ if(!e.block()->has_msg_port(e.port()))
+ throw std::invalid_argument("invalid msg port in connect() or disconnect()");
+}
+
+void
+gr_flowgraph::check_dst_not_used(const gr_endpoint &dst)
+{
+ // A destination is in use if it is already on the edge list
+ for (gr_edge_viter_t p = d_edges.begin(); p != d_edges.end(); p++)
+ if (p->dst() == dst) {
+ std::stringstream msg;
+ msg << "destination already in use by edge " << (*p);
+ throw std::invalid_argument(msg.str());
+ }
+}
+
+void
+gr_flowgraph::check_type_match(const gr_endpoint &src, const gr_endpoint &dst)
+{
+ int src_size = src.block()->output_signature()->sizeof_stream_item(src.port());
+ int dst_size = dst.block()->input_signature()->sizeof_stream_item(dst.port());
+
+ if (src_size != dst_size) {
+ std::stringstream msg;
+ msg << "itemsize mismatch: " << src << " using " << src_size
+ << ", " << dst << " using " << dst_size;
+ throw std::invalid_argument(msg.str());
+ }
+}
+
+gr_basic_block_vector_t
+gr_flowgraph::calc_used_blocks()
+{
+ gr_basic_block_vector_t tmp;
+
+ // make sure free standing message blocks are included
+ for (gr_msg_edge_viter_t p = d_msg_edges.begin(); p != d_msg_edges.end(); p++) {
+// for now only blocks receiving messages get a thread context - uncomment to allow senders to also obtain one
+// tmp.push_back(p->src().block());
+ tmp.push_back(p->dst().block());
+ }
+
+ // Collect all blocks in the edge list
+ for (gr_edge_viter_t p = d_edges.begin(); p != d_edges.end(); p++) {
+ tmp.push_back(p->src().block());
+ tmp.push_back(p->dst().block());
+ }
+
+ return unique_vector<gr_basic_block_sptr>(tmp);
+}
+
+std::vector<int>
+gr_flowgraph::calc_used_ports(gr_basic_block_sptr block, bool check_inputs)
+{
+ std::vector<int> tmp;
+
+ // Collect all seen ports
+ gr_edge_vector_t edges = calc_connections(block, check_inputs);
+ for (gr_edge_viter_t p = edges.begin(); p != edges.end(); p++) {
+ if (check_inputs == true)
+ tmp.push_back(p->dst().port());
+ else
+ tmp.push_back(p->src().port());
+ }
+
+ return unique_vector<int>(tmp);
+}
+
+gr_edge_vector_t
+gr_flowgraph::calc_connections(gr_basic_block_sptr block, bool check_inputs)
+{
+ gr_edge_vector_t result;
+
+ for (gr_edge_viter_t p = d_edges.begin(); p != d_edges.end(); p++) {
+ if (check_inputs) {
+ if (p->dst().block() == block)
+ result.push_back(*p);
+ }
+ else {
+ if (p->src().block() == block)
+ result.push_back(*p);
+ }
+ }
+
+ return result; // assumes no duplicates
+}
+
+void
+gr_flowgraph::check_contiguity(gr_basic_block_sptr block,
+ const std::vector<int> &used_ports,
+ bool check_inputs)
+{
+ std::stringstream msg;
+
+ gr_io_signature_sptr sig =
+ check_inputs ? block->input_signature() : block->output_signature();
+
+ int nports = used_ports.size();
+ int min_ports = sig->min_streams();
+ int max_ports = sig->max_streams();
+
+ if (nports == 0 && min_ports == 0)
+ return;
+
+ if (nports < min_ports) {
+ msg << block << ": insufficient connected "
+ << (check_inputs ? "input ports " : "output ports ")
+ << "(" << min_ports << " needed, " << nports << " connected)";
+ throw std::runtime_error(msg.str());
+ }
+
+ if (nports > max_ports && max_ports != gr_io_signature::IO_INFINITE) {
+ msg << block << ": too many connected "
+ << (check_inputs ? "input ports " : "output ports ")
+ << "(" << max_ports << " allowed, " << nports << " connected)";
+ throw std::runtime_error(msg.str());
+ }
+
+ if (used_ports[nports-1]+1 != nports) {
+ for (int i = 0; i < nports; i++) {
+ if (used_ports[i] != i) {
+ msg << block << ": missing connection "
+ << (check_inputs ? "to input port " : "from output port ")
+ << i;
+ throw std::runtime_error(msg.str());
+ }
+ }
+ }
+}
+
+gr_basic_block_vector_t
+gr_flowgraph::calc_downstream_blocks(gr_basic_block_sptr block, int port)
+{
+ gr_basic_block_vector_t tmp;
+
+ for (gr_edge_viter_t p = d_edges.begin(); p != d_edges.end(); p++)
+ if (p->src() == gr_endpoint(block, port))
+ tmp.push_back(p->dst().block());
+
+ return unique_vector<gr_basic_block_sptr>(tmp);
+}
+
+gr_basic_block_vector_t
+gr_flowgraph::calc_downstream_blocks(gr_basic_block_sptr block)
+{
+ gr_basic_block_vector_t tmp;
+
+ for (gr_edge_viter_t p = d_edges.begin(); p != d_edges.end(); p++)
+ if (p->src().block() == block)
+ tmp.push_back(p->dst().block());
+
+ return unique_vector<gr_basic_block_sptr>(tmp);
+}
+
+gr_edge_vector_t
+gr_flowgraph::calc_upstream_edges(gr_basic_block_sptr block)
+{
+ gr_edge_vector_t result;
+
+ for (gr_edge_viter_t p = d_edges.begin(); p != d_edges.end(); p++)
+ if (p->dst().block() == block)
+ result.push_back(*p);
+
+ return result; // Assume no duplicates
+}
+
+bool
+gr_flowgraph::has_block_p(gr_basic_block_sptr block)
+{
+ gr_basic_block_viter_t result;
+ result = std::find(d_blocks.begin(), d_blocks.end(), block);
+ return (result != d_blocks.end());
+}
+
+gr_edge
+gr_flowgraph::calc_upstream_edge(gr_basic_block_sptr block, int port)
+{
+ gr_edge result;
+
+ for (gr_edge_viter_t p = d_edges.begin(); p != d_edges.end(); p++) {
+ if (p->dst() == gr_endpoint(block, port)) {
+ result = (*p);
+ break;
+ }
+ }
+
+ return result;
+}
+
+std::vector<gr_basic_block_vector_t>
+gr_flowgraph::partition()
+{
+ std::vector<gr_basic_block_vector_t> result;
+ gr_basic_block_vector_t blocks = calc_used_blocks();
+ gr_basic_block_vector_t graph;
+
+ while (blocks.size() > 0) {
+ graph = calc_reachable_blocks(blocks[0], blocks);
+ assert(graph.size());
+ result.push_back(topological_sort(graph));
+
+ for (gr_basic_block_viter_t p = graph.begin(); p != graph.end(); p++)
+ blocks.erase(find(blocks.begin(), blocks.end(), *p));
+ }
+
+ return result;
+}
+
+gr_basic_block_vector_t
+gr_flowgraph::calc_reachable_blocks(gr_basic_block_sptr block, gr_basic_block_vector_t &blocks)
+{
+ gr_basic_block_vector_t result;
+
+ // Mark all blocks as unvisited
+ for (gr_basic_block_viter_t p = blocks.begin(); p != blocks.end(); p++)
+ (*p)->set_color(gr_basic_block::WHITE);
+
+ // Recursively mark all reachable blocks
+ reachable_dfs_visit(block, blocks);
+
+ // Collect all the blocks that have been visited
+ for (gr_basic_block_viter_t p = blocks.begin(); p != blocks.end(); p++)
+ if ((*p)->color() == gr_basic_block::BLACK)
+ result.push_back(*p);
+
+ return result;
+}
+
+// Recursively mark all reachable blocks from given block and block list
+void
+gr_flowgraph::reachable_dfs_visit(gr_basic_block_sptr block, gr_basic_block_vector_t &blocks)
+{
+ // Mark the current one as visited
+ block->set_color(gr_basic_block::BLACK);
+
+ // Recurse into adjacent vertices
+ gr_basic_block_vector_t adjacent = calc_adjacent_blocks(block, blocks);
+
+ for (gr_basic_block_viter_t p = adjacent.begin(); p != adjacent.end(); p++)
+ if ((*p)->color() == gr_basic_block::WHITE)
+ reachable_dfs_visit(*p, blocks);
+}
+
+// Return a list of block adjacent to a given block along any edge
+gr_basic_block_vector_t
+gr_flowgraph::calc_adjacent_blocks(gr_basic_block_sptr block, gr_basic_block_vector_t &blocks)
+{
+ gr_basic_block_vector_t tmp;
+
+ // Find any blocks that are inputs or outputs
+ for (gr_edge_viter_t p = d_edges.begin(); p != d_edges.end(); p++) {
+ if (p->src().block() == block)
+ tmp.push_back(p->dst().block());
+ if (p->dst().block() == block)
+ tmp.push_back(p->src().block());
+ }
+
+ return unique_vector<gr_basic_block_sptr>(tmp);
+}
+
+gr_basic_block_vector_t
+gr_flowgraph::topological_sort(gr_basic_block_vector_t &blocks)
+{
+ gr_basic_block_vector_t tmp;
+ gr_basic_block_vector_t result;
+ tmp = sort_sources_first(blocks);
+
+ // Start 'em all white
+ for (gr_basic_block_viter_t p = tmp.begin(); p != tmp.end(); p++)
+ (*p)->set_color(gr_basic_block::WHITE);
+
+ for (gr_basic_block_viter_t p = tmp.begin(); p != tmp.end(); p++) {
+ if ((*p)->color() == gr_basic_block::WHITE)
+ topological_dfs_visit(*p, result);
+ }
+
+ reverse(result.begin(), result.end());
+ return result;
+}
+
+gr_basic_block_vector_t
+gr_flowgraph::sort_sources_first(gr_basic_block_vector_t &blocks)
+{
+ gr_basic_block_vector_t sources, nonsources, result;
+
+ for (gr_basic_block_viter_t p = blocks.begin(); p != blocks.end(); p++) {
+ if (source_p(*p))
+ sources.push_back(*p);
+ else
+ nonsources.push_back(*p);
+ }
+
+ for (gr_basic_block_viter_t p = sources.begin(); p != sources.end(); p++)
+ result.push_back(*p);
+
+ for (gr_basic_block_viter_t p = nonsources.begin(); p != nonsources.end(); p++)
+ result.push_back(*p);
+
+ return result;
+}
+
+bool
+gr_flowgraph::source_p(gr_basic_block_sptr block)
+{
+ return (calc_upstream_edges(block).size() == 0);
+}
+
+void
+gr_flowgraph::topological_dfs_visit(gr_basic_block_sptr block, gr_basic_block_vector_t &output)
+{
+ block->set_color(gr_basic_block::GREY);
+ gr_basic_block_vector_t blocks(calc_downstream_blocks(block));
+
+ for (gr_basic_block_viter_t p = blocks.begin(); p != blocks.end(); p++) {
+ switch ((*p)->color()) {
+ case gr_basic_block::WHITE:
+ topological_dfs_visit(*p, output);
+ break;
+
+ case gr_basic_block::GREY:
+ throw std::runtime_error("flow graph has loops!");
+
+ case gr_basic_block::BLACK:
+ continue;
+
+ default:
+ throw std::runtime_error("invalid color on block!");
+ }
+ }
+
+ block->set_color(gr_basic_block::BLACK);
+ output.push_back(block);
+}
+
+void gr_flowgraph::connect(const gr_msg_endpoint &src, const gr_msg_endpoint &dst){
+ check_valid_port(src);
+ check_valid_port(dst);
+ for (gr_msg_edge_viter_t p = d_msg_edges.begin(); p != d_msg_edges.end(); p++) {
+ if(p->src() == src && p->dst() == dst){
+ throw std::runtime_error("connect called on already connected edge!");
+ }
+ }
+ d_msg_edges.push_back(gr_msg_edge(src,dst));
+}
+
+void gr_flowgraph::disconnect(const gr_msg_endpoint &src, const gr_msg_endpoint &dst){
+ check_valid_port(src);
+ check_valid_port(dst);
+ for (gr_msg_edge_viter_t p = d_msg_edges.begin(); p != d_msg_edges.end(); p++) {
+ if(p->src() == src && p->dst() == dst){
+ d_msg_edges.erase(p);
+ return;
+ }
+ }
+ throw std::runtime_error("disconnect called on non-connected edge!");
+}
+
+
diff --git a/gnuradio-core/src/lib/runtime/gr_flowgraph.h b/gnuradio-core/src/lib/runtime/gr_flowgraph.h
new file mode 100644
index 000000000..bef70f626
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_flowgraph.h
@@ -0,0 +1,251 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006,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.
+ */
+
+#ifndef INCLUDED_GR_FLOWGRAPH_H
+#define INCLUDED_GR_FLOWGRAPH_H
+
+#include <gr_core_api.h>
+#include <gr_basic_block.h>
+#include <iostream>
+
+/*!
+ * \brief Class representing a specific input or output graph endpoint
+ * \ingroup internal
+ */
+class GR_CORE_API gr_endpoint
+{
+private:
+ gr_basic_block_sptr d_basic_block;
+ int d_port;
+
+public:
+ gr_endpoint() : d_basic_block(), d_port(0) { }
+ gr_endpoint(gr_basic_block_sptr block, int port) { d_basic_block = block; d_port = port; }
+ gr_basic_block_sptr block() const { return d_basic_block; }
+ int port() const { return d_port; }
+
+ bool operator==(const gr_endpoint &other) const;
+};
+
+inline bool gr_endpoint::operator==(const gr_endpoint &other) const
+{
+ return (d_basic_block == other.d_basic_block &&
+ d_port == other.d_port);
+}
+
+class GR_CORE_API gr_msg_endpoint
+{
+private:
+ gr_basic_block_sptr d_basic_block;
+ pmt::pmt_t d_port;
+ bool d_is_hier;
+public:
+ gr_msg_endpoint() : d_basic_block(), d_port(pmt::PMT_NIL) { }
+ gr_msg_endpoint(gr_basic_block_sptr block, pmt::pmt_t port, bool is_hier=false){ d_basic_block = block; d_port = port; d_is_hier = is_hier;}
+ gr_basic_block_sptr block() const { return d_basic_block; }
+ pmt::pmt_t port() const { return d_port; }
+ bool is_hier() const { return d_is_hier; }
+ void set_hier(bool h) { d_is_hier = h; }
+
+ bool operator==(const gr_msg_endpoint &other) const;
+
+};
+
+inline bool gr_msg_endpoint::operator==(const gr_msg_endpoint &other) const
+{
+ return (d_basic_block == other.d_basic_block &&
+ pmt::pmt_equal(d_port, other.d_port));
+}
+
+
+// Hold vectors of gr_endpoint objects
+typedef std::vector<gr_endpoint> gr_endpoint_vector_t;
+typedef std::vector<gr_endpoint>::iterator gr_endpoint_viter_t;
+
+/*!
+ *\brief Class representing a connection between to graph endpoints
+ *
+ */
+class GR_CORE_API gr_edge
+{
+public:
+ gr_edge() : d_src(), d_dst() { };
+ gr_edge(const gr_endpoint &src, const gr_endpoint &dst) : d_src(src), d_dst(dst) { }
+ ~gr_edge();
+
+ const gr_endpoint &src() const { return d_src; }
+ const gr_endpoint &dst() const { return d_dst; }
+
+private:
+ gr_endpoint d_src;
+ gr_endpoint d_dst;
+};
+
+
+// Hold vectors of gr_edge objects
+typedef std::vector<gr_edge> gr_edge_vector_t;
+typedef std::vector<gr_edge>::iterator gr_edge_viter_t;
+
+
+/*!
+ *\brief Class representing a msg connection between to graph msg endpoints
+ *
+ */
+class GR_CORE_API gr_msg_edge
+{
+public:
+ gr_msg_edge() : d_src(), d_dst() { };
+ gr_msg_edge(const gr_msg_endpoint &src, const gr_msg_endpoint &dst) : d_src(src), d_dst(dst) { }
+ ~gr_msg_edge() {}
+
+ const gr_msg_endpoint &src() const { return d_src; }
+ const gr_msg_endpoint &dst() const { return d_dst; }
+
+private:
+ gr_msg_endpoint d_src;
+ gr_msg_endpoint d_dst;
+};
+
+// Hold vectors of gr_edge objects
+typedef std::vector<gr_msg_edge> gr_msg_edge_vector_t;
+typedef std::vector<gr_msg_edge>::iterator gr_msg_edge_viter_t;
+
+// Create a shared pointer to a heap allocated flowgraph
+// (types defined in gr_runtime_types.h)
+GR_CORE_API gr_flowgraph_sptr gr_make_flowgraph();
+
+/*!
+ * \brief Class representing a directed, acyclic graph of basic blocks
+ * \ingroup internal
+ */
+class GR_CORE_API gr_flowgraph
+{
+public:
+ friend GR_CORE_API gr_flowgraph_sptr gr_make_flowgraph();
+
+ // Destruct an arbitrary flowgraph
+ ~gr_flowgraph();
+
+ // Connect two endpoints
+ void connect(const gr_endpoint &src, const gr_endpoint &dst);
+
+ // Disconnect two endpoints
+ void disconnect(const gr_endpoint &src, const gr_endpoint &dst);
+
+ // Connect an output port to an input port (convenience)
+ void connect(gr_basic_block_sptr src_block, int src_port,
+ gr_basic_block_sptr dst_block, int dst_port);
+
+ // Disconnect an input port from an output port (convenience)
+ void disconnect(gr_basic_block_sptr src_block, int src_port,
+ gr_basic_block_sptr dst_block, int dst_port);
+
+ // Connect two msg endpoints
+ void connect(const gr_msg_endpoint &src, const gr_msg_endpoint &dst);
+
+ // Disconnect two msg endpoints
+ void disconnect(const gr_msg_endpoint &src, const gr_msg_endpoint &dst);
+
+ // Validate connectivity, raise exception if invalid
+ void validate();
+
+ // Clear existing flowgraph
+ void clear();
+
+ // Return vector of edges
+ const gr_edge_vector_t &edges() const { return d_edges; }
+
+ // Return vector of msg edges
+ const gr_msg_edge_vector_t &msg_edges() const { return d_msg_edges; }
+
+ // Return vector of connected blocks
+ gr_basic_block_vector_t calc_used_blocks();
+
+ // Return toplogically sorted vector of blocks. All the sources come first.
+ gr_basic_block_vector_t topological_sort(gr_basic_block_vector_t &blocks);
+
+ // Return vector of vectors of disjointly connected blocks, topologically
+ // sorted.
+ std::vector<gr_basic_block_vector_t> partition();
+
+protected:
+ gr_basic_block_vector_t d_blocks;
+ gr_edge_vector_t d_edges;
+ gr_msg_edge_vector_t d_msg_edges;
+
+ gr_flowgraph();
+ std::vector<int> calc_used_ports(gr_basic_block_sptr block, bool check_inputs);
+ gr_basic_block_vector_t calc_downstream_blocks(gr_basic_block_sptr block, int port);
+ gr_edge_vector_t calc_upstream_edges(gr_basic_block_sptr block);
+ bool has_block_p(gr_basic_block_sptr block);
+ gr_edge calc_upstream_edge(gr_basic_block_sptr block, int port);
+
+private:
+
+ void check_valid_port(gr_io_signature_sptr sig, int port);
+ void check_valid_port(const gr_msg_endpoint &e);
+ void check_dst_not_used(const gr_endpoint &dst);
+ void check_type_match(const gr_endpoint &src, const gr_endpoint &dst);
+ gr_edge_vector_t calc_connections(gr_basic_block_sptr block, bool check_inputs); // false=use outputs
+ void check_contiguity(gr_basic_block_sptr block, const std::vector<int> &used_ports, bool check_inputs);
+
+ gr_basic_block_vector_t calc_downstream_blocks(gr_basic_block_sptr block);
+ gr_basic_block_vector_t calc_reachable_blocks(gr_basic_block_sptr block, gr_basic_block_vector_t &blocks);
+ void reachable_dfs_visit(gr_basic_block_sptr block, gr_basic_block_vector_t &blocks);
+ gr_basic_block_vector_t calc_adjacent_blocks(gr_basic_block_sptr block, gr_basic_block_vector_t &blocks);
+ gr_basic_block_vector_t sort_sources_first(gr_basic_block_vector_t &blocks);
+ bool source_p(gr_basic_block_sptr block);
+ void topological_dfs_visit(gr_basic_block_sptr block, gr_basic_block_vector_t &output);
+};
+
+// Convenience functions
+inline
+void gr_flowgraph::connect(gr_basic_block_sptr src_block, int src_port,
+ gr_basic_block_sptr dst_block, int dst_port)
+{
+ connect(gr_endpoint(src_block, src_port),
+ gr_endpoint(dst_block, dst_port));
+}
+
+inline
+void gr_flowgraph::disconnect(gr_basic_block_sptr src_block, int src_port,
+ gr_basic_block_sptr dst_block, int dst_port)
+{
+ disconnect(gr_endpoint(src_block, src_port),
+ gr_endpoint(dst_block, dst_port));
+}
+
+inline std::ostream&
+operator <<(std::ostream &os, const gr_endpoint endp)
+{
+ os << endp.block() << ":" << endp.port();
+ return os;
+}
+
+inline std::ostream&
+operator <<(std::ostream &os, const gr_edge edge)
+{
+ os << edge.src() << "->" << edge.dst();
+ return os;
+}
+
+#endif /* INCLUDED_GR_FLOWGRAPH_H */
diff --git a/gnuradio-core/src/lib/runtime/gr_hier_block2.cc b/gnuradio-core/src/lib/runtime/gr_hier_block2.cc
new file mode 100644
index 000000000..04eb60fc6
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_hier_block2.cc
@@ -0,0 +1,77 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006,2007,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_hier_block2.h>
+#include <boost/detail/atomic_count.hpp>
+
+static boost::detail::atomic_count unique_id_pool(0);
+
+
+gr_hier_block2::gr_hier_block2(void)
+{
+ //NOP
+}
+
+gr_hier_block2::gr_hier_block2(
+ const std::string &name,
+ gr_io_signature_sptr input_signature,
+ gr_io_signature_sptr output_signature
+):
+ gras::HierBlock(name),
+ _unique_id(++unique_id_pool),
+ _name(name)
+{
+ this->set_input_signature(input_signature);
+ this->set_output_signature(output_signature);
+}
+
+gr_hier_block2_sptr gr_make_hier_block2(
+ const std::string &name,
+ gr_io_signature_sptr input_signature,
+ gr_io_signature_sptr output_signature
+){
+ return gr_hier_block2_sptr(new gr_hier_block2(name, input_signature, output_signature));
+}
+
+gr_io_signature_sptr gr_hier_block2::input_signature(void) const
+{
+ return _in_sig;
+}
+
+gr_io_signature_sptr gr_hier_block2::output_signature(void) const
+{
+ return _out_sig;
+}
+
+void gr_hier_block2::set_input_signature(gr_io_signature_sptr sig)
+{
+ _in_sig = sig;
+}
+
+void gr_hier_block2::set_output_signature(gr_io_signature_sptr sig)
+{
+ _out_sig = sig;
+}
diff --git a/gnuradio-core/src/lib/runtime/gr_hier_block2.h b/gnuradio-core/src/lib/runtime/gr_hier_block2.h
new file mode 100644
index 000000000..d393c42cb
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_hier_block2.h
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2012-2013 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_GNURADIO_GR_HIER_BLOCK2_H
+#define INCLUDED_GNURADIO_GR_HIER_BLOCK2_H
+
+#include <gr_core_api.h>
+#include <gras/hier_block.hpp>
+#include <gr_io_signature.h>
+
+struct GR_CORE_API gr_hier_block2 : gras::HierBlock
+{
+
+ gr_hier_block2(void);
+
+ gr_hier_block2(
+ const std::string &name,
+ gr_io_signature_sptr input_signature,
+ gr_io_signature_sptr output_signature
+ );
+
+ long unique_id(void) const{return _unique_id;}
+ std::string name(void) const{return _name;}
+ long _unique_id;
+ std::string _name;
+
+ const gr_hier_block2 &self(void) const
+ {
+ return *this;
+ }
+
+ gr_io_signature_sptr input_signature(void) const;
+ gr_io_signature_sptr output_signature(void) const;
+
+ void set_input_signature(gr_io_signature_sptr sig);
+ void set_output_signature(gr_io_signature_sptr sig);
+
+ inline void lock(void){}
+
+ inline void unlock(void){this->commit();}
+
+ gr_io_signature_sptr _in_sig, _out_sig;
+};
+
+typedef boost::shared_ptr<gr_hier_block2> gr_hier_block2_sptr;
+
+GR_CORE_API gr_hier_block2_sptr gr_make_hier_block2(
+ const std::string &name,
+ gr_io_signature_sptr input_signature,
+ gr_io_signature_sptr output_signature
+);
+
+#endif /*INCLUDED_GNURADIO_GR_HIER_BLOCK2_H*/
diff --git a/gnuradio-core/src/lib/runtime/gr_hier_block2.i b/gnuradio-core/src/lib/runtime/gr_hier_block2.i
new file mode 100644
index 000000000..a857394ca
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_hier_block2.i
@@ -0,0 +1,88 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005,2006,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.
+ */
+
+%include <gr_basic_block.i>
+
+class gr_hier_block2;
+typedef boost::shared_ptr<gr_hier_block2> gr_hier_block2_sptr;
+%template(gr_hier_block2_sptr) boost::shared_ptr<gr_hier_block2>;
+
+// Hack to have a Python shim implementation of gr.hier_block2
+// that instantiates one of these and passes through calls
+%rename(hier_block2_swig) gr_make_hier_block2;
+gr_hier_block2_sptr gr_make_hier_block2(const std::string name,
+ gr_io_signature_sptr input_signature,
+ gr_io_signature_sptr output_signature)
+ throw (std::runtime_error);
+
+// Rename connect and disconnect so that we can more easily build a
+// better interface in scripting land.
+%rename(primitive_connect) gr_hier_block2::connect;
+%rename(primitive_disconnect) gr_hier_block2::disconnect;
+%rename(primitive_msg_connect) gr_hier_block2::msg_connect;
+%rename(primitive_msg_disconnect) gr_hier_block2::msg_disconnect;
+%rename(primitive_message_port_register_hier_in) gr_hier_block2::message_port_register_hier_in;
+%rename(primitive_message_port_register_hier_out) gr_hier_block2::message_port_register_hier_out;
+
+class gr_hier_block2 : public gr_basic_block
+{
+private:
+ gr_hier_block2(const std::string name,
+ gr_io_signature_sptr input_signature,
+ gr_io_signature_sptr output_signature);
+
+public:
+ ~gr_hier_block2 ();
+
+ void connect(gr_basic_block_sptr block)
+ throw (std::invalid_argument);
+ void connect(gr_basic_block_sptr src, int src_port,
+ gr_basic_block_sptr dst, int dst_port)
+ throw (std::invalid_argument);
+ void msg_connect(gr_basic_block_sptr src, pmt::pmt_t srcport,
+ gr_basic_block_sptr dst, pmt::pmt_t dstport)
+ throw (std::runtime_error);
+ void msg_connect(gr_basic_block_sptr src, std::string srcport,
+ gr_basic_block_sptr dst, std::string dstport)
+ throw (std::runtime_error);
+ void msg_disconnect(gr_basic_block_sptr src, pmt::pmt_t srcport,
+ gr_basic_block_sptr dst, pmt::pmt_t dstport)
+ throw (std::runtime_error);
+ void msg_disconnect(gr_basic_block_sptr src, std::string srcport,
+ gr_basic_block_sptr dst, std::string dstport)
+ throw (std::runtime_error);
+
+ void disconnect(gr_basic_block_sptr block)
+ throw (std::invalid_argument);
+ void disconnect(gr_basic_block_sptr src, int src_port,
+ gr_basic_block_sptr dst, int dst_port)
+ throw (std::invalid_argument);
+ void disconnect_all();
+ void lock();
+ void unlock();
+
+ void message_port_register_hier_in(pmt::pmt_t port_id);
+ void message_port_register_hier_out(pmt::pmt_t port_id);
+
+
+ gr_hier_block2_sptr to_hier_block2(); // Needed for Python type coercion
+};
diff --git a/gnuradio-core/src/lib/runtime/gr_hier_block2_detail.cc b/gnuradio-core/src/lib/runtime/gr_hier_block2_detail.cc
new file mode 100644
index 000000000..add6da024
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_hier_block2_detail.cc
@@ -0,0 +1,615 @@
+/*
+ * Copyright 2006,2007,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_hier_block2_detail.h>
+#include <gr_io_signature.h>
+#include <stdexcept>
+#include <sstream>
+#include <boost/format.hpp>
+
+#define GR_HIER_BLOCK2_DETAIL_DEBUG 0
+
+gr_hier_block2_detail::gr_hier_block2_detail(gr_hier_block2 *owner) :
+ d_owner(owner),
+ d_parent_detail(0),
+ d_fg(gr_make_flowgraph())
+{
+ int min_inputs = owner->input_signature()->min_streams();
+ int max_inputs = owner->input_signature()->max_streams();
+ int min_outputs = owner->output_signature()->min_streams();
+ int max_outputs = owner->output_signature()->max_streams();
+
+ if (max_inputs == gr_io_signature::IO_INFINITE ||
+ max_outputs == gr_io_signature::IO_INFINITE ||
+ (min_inputs != max_inputs) ||(min_outputs != max_outputs) ) {
+ std::stringstream msg;
+ msg << "Hierarchical blocks do not yet support arbitrary or"
+ << " variable numbers of inputs or outputs (" << d_owner->name() << ")";
+ throw std::runtime_error(msg.str());
+ }
+
+ d_inputs = std::vector<gr_endpoint_vector_t>(max_inputs);
+ d_outputs = gr_endpoint_vector_t(max_outputs);
+}
+
+
+gr_hier_block2_detail::~gr_hier_block2_detail()
+{
+ d_owner = 0; // Don't use delete, we didn't allocate
+}
+
+void
+gr_hier_block2_detail::connect(gr_basic_block_sptr block)
+{
+ std::stringstream msg;
+
+ // Check if duplicate
+ if (std::find(d_blocks.begin(), d_blocks.end(), block) != d_blocks.end()) {
+ msg << "Block " << block << " already connected.";
+ throw std::invalid_argument(msg.str());
+ }
+
+ // Check if has inputs or outputs
+ if (block->input_signature()->max_streams() != 0 ||
+ block->output_signature()->max_streams() != 0) {
+ msg << "Block " << block << " must not have any input or output ports";
+ throw std::invalid_argument(msg.str());
+ }
+
+ gr_hier_block2_sptr hblock(cast_to_hier_block2_sptr(block));
+
+ if (hblock && hblock.get() != d_owner) {
+ if (GR_HIER_BLOCK2_DETAIL_DEBUG)
+ std::cout << "connect: block is hierarchical, setting parent to " << this << std::endl;
+ hblock->d_detail->d_parent_detail = this;
+ }
+
+ d_blocks.push_back(block);
+}
+
+void
+gr_hier_block2_detail::connect(gr_basic_block_sptr src, int src_port,
+ gr_basic_block_sptr dst, int dst_port)
+{
+ std::stringstream msg;
+
+ if (GR_HIER_BLOCK2_DETAIL_DEBUG)
+ std::cout << "connecting: " << gr_endpoint(src, src_port)
+ << " -> " << gr_endpoint(dst, dst_port) << std::endl;
+
+ if (src.get() == dst.get())
+ throw std::invalid_argument("connect: src and destination blocks cannot be the same");
+
+ gr_hier_block2_sptr src_block(cast_to_hier_block2_sptr(src));
+ gr_hier_block2_sptr dst_block(cast_to_hier_block2_sptr(dst));
+
+ if (src_block && src.get() != d_owner) {
+ if (GR_HIER_BLOCK2_DETAIL_DEBUG)
+ std::cout << "connect: src is hierarchical, setting parent to " << this << std::endl;
+ src_block->d_detail->d_parent_detail = this;
+ }
+
+ if (dst_block && dst.get() != d_owner) {
+ if (GR_HIER_BLOCK2_DETAIL_DEBUG)
+ std::cout << "connect: dst is hierarchical, setting parent to " << this << std::endl;
+ dst_block->d_detail->d_parent_detail = this;
+ }
+
+ // Connections to block inputs or outputs
+ int max_port;
+ if (src.get() == d_owner) {
+ max_port = src->input_signature()->max_streams();
+ if ((max_port != -1 && (src_port >= max_port)) || src_port < 0) {
+ msg << "source port " << src_port << " out of range for " << src;
+ throw std::invalid_argument(msg.str());
+ }
+
+ return connect_input(src_port, dst_port, dst);
+ }
+
+ if (dst.get() == d_owner) {
+ max_port = dst->output_signature()->max_streams();
+ if ((max_port != -1 && (dst_port >= max_port)) || dst_port < 0) {
+ msg << "destination port " << dst_port << " out of range for " << dst;
+ throw std::invalid_argument(msg.str());
+ }
+
+ return connect_output(dst_port, src_port, src);
+ }
+
+ // Internal connections
+ d_fg->connect(src, src_port, dst, dst_port);
+
+ // TODO: connects to NC
+}
+
+void
+gr_hier_block2_detail::msg_connect(gr_basic_block_sptr src, pmt::pmt_t srcport,
+ gr_basic_block_sptr dst, pmt::pmt_t dstport)
+{
+ if (GR_HIER_BLOCK2_DETAIL_DEBUG)
+ std::cout << "connecting message port..." << std::endl;
+
+ // register the subscription
+// this is done later...
+// src->message_port_sub(srcport, pmt::pmt_cons(dst->alias_pmt(), dstport));
+
+ // add block uniquely to list to internal blocks
+ if (std::find(d_blocks.begin(), d_blocks.end(), dst) == d_blocks.end()){
+ d_blocks.push_back(src);
+ d_blocks.push_back(dst);
+ }
+
+ bool hier_out = (d_owner == src.get()) && src->message_port_is_hier_out(srcport);;
+ bool hier_in = (d_owner == dst.get()) && dst->message_port_is_hier_in(dstport);
+
+ gr_hier_block2_sptr src_block(cast_to_hier_block2_sptr(src));
+ gr_hier_block2_sptr dst_block(cast_to_hier_block2_sptr(dst));
+
+ if (src_block && src.get() != d_owner) {
+ if (GR_HIER_BLOCK2_DETAIL_DEBUG)
+ std::cout << "connect: src is hierarchical, setting parent to " << this << std::endl;
+ src_block->d_detail->d_parent_detail = this;
+ }
+
+ if (dst_block && dst.get() != d_owner) {
+ if (GR_HIER_BLOCK2_DETAIL_DEBUG)
+ std::cout << "connect: dst is hierarchical, setting parent to " << this << std::endl;
+ dst_block->d_detail->d_parent_detail = this;
+ }
+
+ // add edge for this message connection
+ if(GR_HIER_BLOCK2_DETAIL_DEBUG)
+ std::cout << boost::format("connect( (%s, %s, %d), (%s, %s, %d) )\n") %
+ src % srcport % hier_out %
+ dst % dstport % hier_in;
+ d_fg->connect( gr_msg_endpoint(src, srcport, hier_out), gr_msg_endpoint(dst, dstport, hier_in));
+}
+
+void
+gr_hier_block2_detail::msg_disconnect(gr_basic_block_sptr src, pmt::pmt_t srcport,
+ gr_basic_block_sptr dst, pmt::pmt_t dstport)
+{
+ if (GR_HIER_BLOCK2_DETAIL_DEBUG)
+ std::cout << "disconnecting message port..." << std::endl;
+
+ // unregister the subscription - if already subscribed
+ src->message_port_unsub(srcport, pmt::pmt_cons(dst->alias_pmt(), dstport));
+
+ // remove edge for this message connection
+ bool hier_out = (d_owner == src.get()) && src->message_port_is_hier_out(srcport);;
+ bool hier_in = (d_owner == dst.get()) && dst->message_port_is_hier_in(dstport);
+ d_fg->disconnect( gr_msg_endpoint(src, srcport, hier_out), gr_msg_endpoint(dst, dstport, hier_in));
+}
+
+void
+gr_hier_block2_detail::disconnect(gr_basic_block_sptr block)
+{
+ // Check on singleton list
+ for (gr_basic_block_viter_t p = d_blocks.begin(); p != d_blocks.end(); p++) {
+ if (*p == block) {
+ d_blocks.erase(p);
+
+ gr_hier_block2_sptr hblock(cast_to_hier_block2_sptr(block));
+ if (block && block.get() != d_owner) {
+ if (GR_HIER_BLOCK2_DETAIL_DEBUG)
+ std::cout << "disconnect: block is hierarchical, clearing parent" << std::endl;
+ hblock->d_detail->d_parent_detail = 0;
+ }
+
+ return;
+ }
+ }
+
+ // Otherwise find all edges containing block
+ gr_edge_vector_t edges, tmp = d_fg->edges();
+ gr_edge_vector_t::iterator p;
+ for (p = tmp.begin(); p != tmp.end(); p++) {
+ if ((*p).src().block() == block || (*p).dst().block() == block) {
+ edges.push_back(*p);
+
+ if (GR_HIER_BLOCK2_DETAIL_DEBUG)
+ std::cout << "disconnect: block found in edge " << (*p) << std::endl;
+ }
+ }
+
+ if (edges.size() == 0) {
+ std::stringstream msg;
+ msg << "cannot disconnect block " << block << ", not found";
+ throw std::invalid_argument(msg.str());
+ }
+
+ for (p = edges.begin(); p != edges.end(); p++) {
+ disconnect((*p).src().block(), (*p).src().port(),
+ (*p).dst().block(), (*p).dst().port());
+ }
+}
+
+void
+gr_hier_block2_detail::disconnect(gr_basic_block_sptr src, int src_port,
+ gr_basic_block_sptr dst, int dst_port)
+{
+ if (GR_HIER_BLOCK2_DETAIL_DEBUG)
+ std::cout << "disconnecting: " << gr_endpoint(src, src_port)
+ << " -> " << gr_endpoint(dst, dst_port) << std::endl;
+
+ if (src.get() == dst.get())
+ throw std::invalid_argument("disconnect: source and destination blocks cannot be the same");
+
+ gr_hier_block2_sptr src_block(cast_to_hier_block2_sptr(src));
+ gr_hier_block2_sptr dst_block(cast_to_hier_block2_sptr(dst));
+
+ if (src_block && src.get() != d_owner) {
+ if (GR_HIER_BLOCK2_DETAIL_DEBUG)
+ std::cout << "disconnect: src is hierarchical, clearing parent" << std::endl;
+ src_block->d_detail->d_parent_detail = 0;
+ }
+
+ if (dst_block && dst.get() != d_owner) {
+ if (GR_HIER_BLOCK2_DETAIL_DEBUG)
+ std::cout << "disconnect: dst is hierarchical, clearing parent" << std::endl;
+ dst_block->d_detail->d_parent_detail = 0;
+ }
+
+ if (src.get() == d_owner)
+ return disconnect_input(src_port, dst_port, dst);
+
+ if (dst.get() == d_owner)
+ return disconnect_output(dst_port, src_port, src);
+
+ // Internal connections
+ d_fg->disconnect(src, src_port, dst, dst_port);
+}
+
+void
+gr_hier_block2_detail::connect_input(int my_port, int port, gr_basic_block_sptr block)
+{
+ std::stringstream msg;
+
+ if (my_port < 0 || my_port >= (signed)d_inputs.size()) {
+ msg << "input port " << my_port << " out of range for " << block;
+ throw std::invalid_argument(msg.str());
+ }
+
+ gr_endpoint_vector_t &endps = d_inputs[my_port];
+ gr_endpoint endp(block, port);
+
+ gr_endpoint_viter_t p = std::find(endps.begin(), endps.end(), endp);
+ if (p != endps.end()) {
+ msg << "external input port " << my_port << " already wired to " << endp;
+ throw std::invalid_argument(msg.str());
+ }
+
+ endps.push_back(endp);
+}
+
+void
+gr_hier_block2_detail::connect_output(int my_port, int port, gr_basic_block_sptr block)
+{
+ std::stringstream msg;
+
+ if (my_port < 0 || my_port >= (signed)d_outputs.size()) {
+ msg << "output port " << my_port << " out of range for " << block;
+ throw std::invalid_argument(msg.str());
+ }
+
+ if (d_outputs[my_port].block()) {
+ msg << "external output port " << my_port << " already connected from "
+ << d_outputs[my_port];
+ throw std::invalid_argument(msg.str());
+ }
+
+ d_outputs[my_port] = gr_endpoint(block, port);
+}
+
+void
+gr_hier_block2_detail::disconnect_input(int my_port, int port, gr_basic_block_sptr block)
+{
+ std::stringstream msg;
+
+ if (my_port < 0 || my_port >= (signed)d_inputs.size()) {
+ msg << "input port number " << my_port << " out of range for " << block;
+ throw std::invalid_argument(msg.str());
+ }
+
+ gr_endpoint_vector_t &endps = d_inputs[my_port];
+ gr_endpoint endp(block, port);
+
+ gr_endpoint_viter_t p = std::find(endps.begin(), endps.end(), endp);
+ if (p == endps.end()) {
+ msg << "external input port " << my_port << " not connected to " << endp;
+ throw std::invalid_argument(msg.str());
+ }
+
+ endps.erase(p);
+}
+
+void
+gr_hier_block2_detail::disconnect_output(int my_port, int port, gr_basic_block_sptr block)
+{
+ std::stringstream msg;
+
+ if (my_port < 0 || my_port >= (signed)d_outputs.size()) {
+ msg << "output port number " << my_port << " out of range for " << block;
+ throw std::invalid_argument(msg.str());
+ }
+
+ if (d_outputs[my_port].block() != block) {
+ msg << "block " << block << " not assigned to output "
+ << my_port << ", can't disconnect";
+ throw std::invalid_argument(msg.str());
+ }
+
+ d_outputs[my_port] = gr_endpoint();
+}
+
+gr_endpoint_vector_t
+gr_hier_block2_detail::resolve_port(int port, bool is_input)
+{
+ std::stringstream msg;
+
+ if (GR_HIER_BLOCK2_DETAIL_DEBUG)
+ std::cout << "Resolving port " << port << " as an "
+ << (is_input ? "input" : "output")
+ << " of " << d_owner->name() << std::endl;
+
+ gr_endpoint_vector_t result;
+
+ if (is_input) {
+ if (port < 0 || port >= (signed)d_inputs.size()) {
+ msg << "resolve_port: hierarchical block '" << d_owner->name()
+ << "': input " << port << " is out of range";
+ throw std::runtime_error(msg.str());
+ }
+
+ if (d_inputs[port].empty()) {
+ msg << "resolve_port: hierarchical block '" << d_owner->name()
+ << "': input " << port << " is not connected internally";
+ throw std::runtime_error(msg.str());
+ }
+
+ gr_endpoint_vector_t &endps = d_inputs[port];
+ gr_endpoint_viter_t p;
+ for (p = endps.begin(); p != endps.end(); p++) {
+ gr_endpoint_vector_t tmp = resolve_endpoint(*p, true);
+ std::copy(tmp.begin(), tmp.end(), back_inserter(result));
+ }
+ }
+ else {
+ if (port < 0 || port >= (signed)d_outputs.size()) {
+ msg << "resolve_port: hierarchical block '" << d_owner->name()
+ << "': output " << port << " is out of range";
+ throw std::runtime_error(msg.str());
+ }
+
+ if (d_outputs[port] == gr_endpoint()) {
+ msg << "resolve_port: hierarchical block '" << d_owner->name()
+ << "': output " << port << " is not connected internally";
+ throw std::runtime_error(msg.str());
+ }
+
+ result = resolve_endpoint(d_outputs[port], false);
+ }
+
+ if (result.empty()) {
+ msg << "resolve_port: hierarchical block '" << d_owner->name()
+ << "': unable to resolve "
+ << (is_input ? "input port " : "output port ")
+ << port;
+ throw std::runtime_error(msg.str());
+ }
+
+ return result;
+}
+
+void
+gr_hier_block2_detail::disconnect_all()
+{
+ d_fg->clear();
+ d_blocks.clear();
+ d_inputs.clear();
+ d_outputs.clear();
+}
+
+gr_endpoint_vector_t
+gr_hier_block2_detail::resolve_endpoint(const gr_endpoint &endp, bool is_input) const
+{
+ std::stringstream msg;
+ gr_endpoint_vector_t result;
+
+ // Check if endpoint is a leaf node
+ if (cast_to_block_sptr(endp.block())) {
+ if (GR_HIER_BLOCK2_DETAIL_DEBUG)
+ std::cout << "Block " << endp.block() << " is a leaf node, returning." << std::endl;
+ result.push_back(endp);
+ return result;
+ }
+
+ // Check if endpoint is a hierarchical block
+ gr_hier_block2_sptr hier_block2(cast_to_hier_block2_sptr(endp.block()));
+ if (hier_block2) {
+ if (GR_HIER_BLOCK2_DETAIL_DEBUG)
+ std::cout << "Resolving endpoint " << endp << " as an "
+ << (is_input ? "input" : "output")
+ << ", recursing" << std::endl;
+ return hier_block2->d_detail->resolve_port(endp.port(), is_input);
+ }
+
+ msg << "unable to resolve" << (is_input ? " input " : " output ")
+ << "endpoint " << endp;
+ throw std::runtime_error(msg.str());
+}
+
+void
+gr_hier_block2_detail::flatten_aux(gr_flat_flowgraph_sptr sfg) const
+{
+ if (GR_HIER_BLOCK2_DETAIL_DEBUG)
+ std::cout << " ** Flattening " << d_owner->name() << std::endl;
+
+ // Add my edges to the flow graph, resolving references to actual endpoints
+ gr_edge_vector_t edges = d_fg->edges();
+ gr_msg_edge_vector_t msg_edges = d_fg->msg_edges();
+ gr_edge_viter_t p;
+ gr_msg_edge_viter_t q,u;
+
+ if (GR_HIER_BLOCK2_DETAIL_DEBUG)
+ std::cout << "Flattening stream connections: " << std::endl;
+
+ for (p = edges.begin(); p != edges.end(); p++) {
+ if (GR_HIER_BLOCK2_DETAIL_DEBUG)
+ std::cout << "Flattening edge " << (*p) << std::endl;
+
+ gr_endpoint_vector_t src_endps = resolve_endpoint(p->src(), false);
+ gr_endpoint_vector_t dst_endps = resolve_endpoint(p->dst(), true);
+
+ gr_endpoint_viter_t s, d;
+ for (s = src_endps.begin(); s != src_endps.end(); s++) {
+ for (d = dst_endps.begin(); d != dst_endps.end(); d++) {
+ if (GR_HIER_BLOCK2_DETAIL_DEBUG)
+ std::cout << (*s) << "->" << (*d) << std::endl;
+ sfg->connect(*s, *d);
+ }
+ }
+ }
+
+ // loop through flattening hierarchical connections
+ if (GR_HIER_BLOCK2_DETAIL_DEBUG)
+ std::cout << "Flattening msg connections: " << std::endl;
+
+
+ std::vector<std::pair<gr_msg_endpoint, bool> > resolved_endpoints;
+ for(q = msg_edges.begin(); q != msg_edges.end(); q++) {
+ if (GR_HIER_BLOCK2_DETAIL_DEBUG)
+ std::cout << boost::format(" flattening edge ( %s, %s, %d) -> ( %s, %s, %d)\n") % q->src().block() % q->src().port() % q->src().is_hier() % q->dst().block() % q->dst().port() % q->dst().is_hier();
+
+ bool normal_connection = true;
+
+ // resolve existing connections to hier ports
+ if(q->dst().is_hier()){
+ if (GR_HIER_BLOCK2_DETAIL_DEBUG)
+ std::cout << boost::format(" resolve hier output (%s, %s)") % q->dst().block() % q->dst().port() << std::endl;
+ sfg->replace_endpoint( q->dst(), q->src(), true );
+ resolved_endpoints.push_back(std::pair<gr_msg_endpoint, bool>(q->dst(),true));
+ normal_connection = false;
+ }
+
+ if(q->src().is_hier()){
+ if (GR_HIER_BLOCK2_DETAIL_DEBUG)
+ std::cout << boost::format(" resolve hier input (%s, %s)") % q->src().block() % q->src().port() << std::endl;
+ sfg->replace_endpoint( q->src(), q->dst(), false );
+ resolved_endpoints.push_back(std::pair<gr_msg_endpoint, bool>(q->src(),false));
+ normal_connection = false;
+ }
+
+ // propogate non hier connections through
+ if(normal_connection){
+ sfg->connect( q->src(), q->dst() );
+ }
+ }
+ for(std::vector<std::pair<gr_msg_endpoint, bool> >::iterator it = resolved_endpoints.begin(); it != resolved_endpoints.end(); it++){
+ sfg->clear_endpoint( (*it).first, (*it).second );
+ }
+
+/* // connect primitive edges in the new fg
+ for(q = msg_edges.begin(); q != msg_edges.end(); q++) {
+ if( (!q->src().is_hier()) && (!q->dst().is_hier()) ){
+ sfg->connect( q->src(), q->dst() );
+ } else {
+ std::cout << "not connecting hier connection!" << std::endl;
+ }
+ }*/
+
+ // Construct unique list of blocks used either in edges, inputs,
+ // outputs, or by themselves. I still hate STL.
+ gr_basic_block_vector_t blocks; // unique list of used blocks
+ gr_basic_block_vector_t tmp = d_fg->calc_used_blocks();
+
+ // First add the list of singleton blocks
+ std::vector<gr_basic_block_sptr>::const_iterator b; // Because flatten_aux is const
+ for (b = d_blocks.begin(); b != d_blocks.end(); b++)
+ tmp.push_back(*b);
+
+ // Now add the list of connected input blocks
+ std::stringstream msg;
+ for (unsigned int i = 0; i < d_inputs.size(); i++) {
+ if (d_inputs[i].size() == 0) {
+ msg << "In hierarchical block " << d_owner->name() << ", input " << i
+ << " is not connected internally";
+ throw std::runtime_error(msg.str());
+ }
+
+ for (unsigned int j = 0; j < d_inputs[i].size(); j++)
+ tmp.push_back(d_inputs[i][j].block());
+ }
+
+ for (unsigned int i = 0; i < d_outputs.size(); i++) {
+ gr_basic_block_sptr blk = d_outputs[i].block();
+ if (!blk) {
+ msg << "In hierarchical block " << d_owner->name() << ", output " << i
+ << " is not connected internally";
+ throw std::runtime_error(msg.str());
+ }
+ tmp.push_back(blk);
+ }
+ sort(tmp.begin(), tmp.end());
+
+ std::insert_iterator<gr_basic_block_vector_t> inserter(blocks, blocks.begin());
+ unique_copy(tmp.begin(), tmp.end(), inserter);
+
+ // Recurse hierarchical children
+ for (gr_basic_block_viter_t p = blocks.begin(); p != blocks.end(); p++) {
+ gr_hier_block2_sptr hier_block2(cast_to_hier_block2_sptr(*p));
+ if (hier_block2 && (hier_block2.get() != d_owner)) {
+ if (GR_HIER_BLOCK2_DETAIL_DEBUG)
+ std::cout << "flatten_aux: recursing into hierarchical block " << hier_block2 << std::endl;
+ hier_block2->d_detail->flatten_aux(sfg);
+ }
+ }
+}
+
+void
+gr_hier_block2_detail::lock()
+{
+ if (GR_HIER_BLOCK2_DETAIL_DEBUG)
+ std::cout << "lock: entered in " << this << std::endl;
+
+ if (d_parent_detail)
+ d_parent_detail->lock();
+ else
+ d_owner->lock();
+}
+
+void
+gr_hier_block2_detail::unlock()
+{
+ if (GR_HIER_BLOCK2_DETAIL_DEBUG)
+ std::cout << "unlock: entered in " << this << std::endl;
+
+ if (d_parent_detail)
+ d_parent_detail->unlock();
+ else
+ d_owner->unlock();
+}
+
diff --git a/gnuradio-core/src/lib/runtime/gr_hier_block2_detail.h b/gnuradio-core/src/lib/runtime/gr_hier_block2_detail.h
new file mode 100644
index 000000000..b38dae301
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_hier_block2_detail.h
@@ -0,0 +1,74 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006,2007,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.
+ */
+#ifndef INCLUDED_GR_HIER_BLOCK2_DETAIL_H
+#define INCLUDED_GR_HIER_BLOCK2_DETAIL_H
+
+#include <gr_core_api.h>
+#include <gr_hier_block2.h>
+#include <gr_flat_flowgraph.h>
+#include <boost/utility.hpp>
+
+/*!
+ * \ingroup internal
+ */
+class GR_CORE_API gr_hier_block2_detail : boost::noncopyable
+{
+public:
+ gr_hier_block2_detail(gr_hier_block2 *owner);
+ ~gr_hier_block2_detail();
+
+ void connect(gr_basic_block_sptr block);
+ void connect(gr_basic_block_sptr src, int src_port,
+ gr_basic_block_sptr dst, int dst_port);
+ void msg_connect(gr_basic_block_sptr src, pmt::pmt_t srcport,
+ gr_basic_block_sptr dst, pmt::pmt_t dstport);
+ void msg_disconnect(gr_basic_block_sptr src, pmt::pmt_t srcport,
+ gr_basic_block_sptr dst, pmt::pmt_t dstport);
+ void disconnect(gr_basic_block_sptr block);
+ void disconnect(gr_basic_block_sptr, int src_port,
+ gr_basic_block_sptr, int dst_port);
+ void disconnect_all();
+ void lock();
+ void unlock();
+ void flatten_aux(gr_flat_flowgraph_sptr sfg) const;
+
+private:
+
+ // Private implementation data
+ gr_hier_block2 *d_owner;
+ gr_hier_block2_detail *d_parent_detail;
+ gr_flowgraph_sptr d_fg;
+ std::vector<gr_endpoint_vector_t> d_inputs; // Multiple internal endpoints per external input
+ gr_endpoint_vector_t d_outputs; // Single internal endpoint per external output
+ gr_basic_block_vector_t d_blocks;
+
+
+ void connect_input(int my_port, int port, gr_basic_block_sptr block);
+ void connect_output(int my_port, int port, gr_basic_block_sptr block);
+ void disconnect_input(int my_port, int port, gr_basic_block_sptr block);
+ void disconnect_output(int my_port, int port, gr_basic_block_sptr block);
+
+ gr_endpoint_vector_t resolve_port(int port, bool is_input);
+ gr_endpoint_vector_t resolve_endpoint(const gr_endpoint &endp, bool is_input) const;
+};
+
+#endif /* INCLUDED_GR_HIER_BLOCK2_DETAIL_H */
diff --git a/gnuradio-core/src/lib/runtime/gr_io_signature.cc b/gnuradio-core/src/lib/runtime/gr_io_signature.cc
new file mode 100644
index 000000000..6ac9acd17
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_io_signature.cc
@@ -0,0 +1,112 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <gr_io_signature.h>
+#include <stdexcept>
+#include <iostream>
+
+gr_io_signature_sptr
+gr_make_io_signaturev(int min_streams, int max_streams,
+ const std::vector<int> &sizeof_stream_items)
+{
+ return gr_io_signature_sptr (new gr_io_signature (min_streams, max_streams,
+ sizeof_stream_items));
+}
+
+gr_io_signature_sptr
+gr_make_io_signature(int min_streams, int max_streams,
+ int sizeof_stream_item)
+{
+ std::vector<int> sizeof_items(1);
+ sizeof_items[0] = sizeof_stream_item;
+ return gr_make_io_signaturev(min_streams, max_streams, sizeof_items);
+}
+
+gr_io_signature_sptr
+gr_make_io_signature2(int min_streams, int max_streams,
+ int sizeof_stream_item1,
+ int sizeof_stream_item2)
+{
+ std::vector<int> sizeof_items(2);
+ sizeof_items[0] = sizeof_stream_item1;
+ sizeof_items[1] = sizeof_stream_item2;
+ return gr_make_io_signaturev(min_streams, max_streams, sizeof_items);
+}
+
+gr_io_signature_sptr
+gr_make_io_signature3(int min_streams, int max_streams,
+ int sizeof_stream_item1,
+ int sizeof_stream_item2,
+ int sizeof_stream_item3)
+{
+ std::vector<int> sizeof_items(3);
+ sizeof_items[0] = sizeof_stream_item1;
+ sizeof_items[1] = sizeof_stream_item2;
+ sizeof_items[2] = sizeof_stream_item3;
+ return gr_make_io_signaturev(min_streams, max_streams, sizeof_items);
+}
+
+// ------------------------------------------------------------------------
+
+
+gr_io_signature::gr_io_signature (int min_streams, int max_streams,
+ const std::vector<int> &sizeof_stream_items)
+{
+ if (min_streams < 0
+ || (max_streams != IO_INFINITE && max_streams < min_streams))
+ throw std::invalid_argument ("gr_io_signature(1)");
+
+ if (sizeof_stream_items.size() < 1)
+ throw std::invalid_argument("gr_io_signature(2)");
+
+ for (size_t i = 0; i < sizeof_stream_items.size(); i++){
+ if (max_streams != 0 && sizeof_stream_items[i] < 1)
+ throw std::invalid_argument("gr_io_signature(3)");
+ }
+
+ d_min_streams = min_streams;
+ d_max_streams = max_streams;
+ d_sizeof_stream_item = sizeof_stream_items;
+}
+
+gr_io_signature::~gr_io_signature ()
+{
+}
+
+int
+gr_io_signature::sizeof_stream_item (int _index) const
+{
+ if (_index < 0)
+ throw std::invalid_argument ("gr_io_signature::sizeof_stream_item");
+
+ size_t index = _index;
+ return d_sizeof_stream_item[std::min(index, d_sizeof_stream_item.size() - 1)];
+}
+
+std::vector<int>
+gr_io_signature::sizeof_stream_items() const
+{
+ return d_sizeof_stream_item;
+}
diff --git a/gnuradio-core/src/lib/runtime/gr_io_signature.h b/gnuradio-core/src/lib/runtime/gr_io_signature.h
new file mode 100644
index 000000000..fd1825797
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_io_signature.h
@@ -0,0 +1,117 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,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.
+ */
+
+#ifndef INCLUDED_IO_SIGNATURE_H
+#define INCLUDED_IO_SIGNATURE_H
+
+#include <gr_core_api.h>
+#include <gr_runtime_types.h>
+
+/*!
+ * \brief Create an i/o signature
+ *
+ * \ingroup internal
+ * \param min_streams specify minimum number of streams (>= 0)
+ * \param max_streams specify maximum number of streams (>= min_streams or -1 -> infinite)
+ * \param sizeof_stream_item specify the size of the items in each stream
+ */
+GR_CORE_API gr_io_signature_sptr
+gr_make_io_signature(int min_streams, int max_streams,
+ int sizeof_stream_item);
+
+/*!
+ * \brief Create an i/o signature
+ *
+ * \param min_streams specify minimum number of streams (>= 0)
+ * \param max_streams specify maximum number of streams (>= min_streams or -1 -> infinite)
+ * \param sizeof_stream_item1 specify the size of the items in the first stream
+ * \param sizeof_stream_item2 specify the size of the items in the second and subsequent streams
+ */
+GR_CORE_API gr_io_signature_sptr
+gr_make_io_signature2(int min_streams, int max_streams,
+ int sizeof_stream_item1,
+ int sizeof_stream_item2
+ );
+
+/*!
+ * \brief Create an i/o signature
+ *
+ * \param min_streams specify minimum number of streams (>= 0)
+ * \param max_streams specify maximum number of streams (>= min_streams or -1 -> infinite)
+ * \param sizeof_stream_item1 specify the size of the items in the first stream
+ * \param sizeof_stream_item2 specify the size of the items in the second stream
+ * \param sizeof_stream_item3 specify the size of the items in the third and subsequent streams
+ */
+GR_CORE_API gr_io_signature_sptr
+gr_make_io_signature3(int min_streams, int max_streams,
+ int sizeof_stream_item1,
+ int sizeof_stream_item2,
+ int sizeof_stream_item3
+ );
+
+/*!
+ * \brief Create an i/o signature
+ *
+ * \param min_streams specify minimum number of streams (>= 0)
+ * \param max_streams specify maximum number of streams (>= min_streams or -1 -> infinite)
+ * \param sizeof_stream_items specify the size of the items in the streams
+ *
+ * If there are more streams than there are entries in sizeof_stream_items, the
+ * value of the last entry in sizeof_stream_items is used for the missing values.
+ * sizeof_stream_items must contain at least 1 entry.
+ */
+GR_CORE_API gr_io_signature_sptr
+gr_make_io_signaturev(int min_streams, int max_streams,
+ const std::vector<int> &sizeof_stream_items);
+
+
+/*!
+ * \brief i/o signature for input and output ports.
+ * \brief misc
+ */
+class GR_CORE_API gr_io_signature {
+ int d_min_streams;
+ int d_max_streams;
+ std::vector<int> d_sizeof_stream_item;
+
+ gr_io_signature(int min_streams, int max_streams,
+ const std::vector<int> &sizeof_stream_items);
+
+ friend GR_CORE_API gr_io_signature_sptr
+ gr_make_io_signaturev(int min_streams,
+ int max_streams,
+ const std::vector<int> &sizeof_stream_items);
+
+ public:
+
+ static const int IO_INFINITE = -1;
+
+ ~gr_io_signature ();
+
+ int min_streams () const { return d_min_streams; }
+ int max_streams () const { return d_max_streams; }
+ int sizeof_stream_item (int index) const;
+ std::vector<int> sizeof_stream_items() const;
+};
+
+
+#endif /* INCLUDED_IO_SIGNATURE_H */
diff --git a/gnuradio-core/src/lib/runtime/gr_io_signature.i b/gnuradio-core/src/lib/runtime/gr_io_signature.i
new file mode 100644
index 000000000..fe1707e41
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_io_signature.i
@@ -0,0 +1,73 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2005,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.
+ */
+
+class gr_io_signature;
+typedef boost::shared_ptr<gr_io_signature> gr_io_signature_sptr;
+%template(gr_io_signature_sptr) boost::shared_ptr<gr_io_signature>;
+
+%rename(io_signature) gr_make_io_signature;
+%rename(io_signature2) gr_make_io_signature2;
+%rename(io_signature3) gr_make_io_signature3;
+%rename(io_signaturev) gr_make_io_signaturev;
+
+
+gr_io_signature_sptr
+gr_make_io_signature(int min_streams, int max_streams,
+ int sizeof_stream_item);
+
+gr_io_signature_sptr
+gr_make_io_signature2(int min_streams, int max_streams,
+ int sizeof_stream_item1,
+ int sizeof_stream_item2
+ );
+gr_io_signature_sptr
+gr_make_io_signature3(int min_streams, int max_streams,
+ int sizeof_stream_item1,
+ int sizeof_stream_item2,
+ int sizeof_stream_item3
+ );
+gr_io_signature_sptr
+gr_make_io_signaturev(int min_streams, int max_streams,
+ const std::vector<int> &sizeof_stream_items);
+
+
+class gr_io_signature {
+ gr_io_signature (int min_streams, int max_streams, int sizeof_stream_item);
+
+ friend gr_io_signature_sptr
+ gr_make_io_signaturev(int min_streams,
+ int max_streams,
+ const std::vector<int> &sizeof_stream_item);
+
+ public:
+
+ // disabled. Suspected bug in SWIG 1.3.24
+ // static const int IO_INFINITE = -1;
+
+ ~gr_io_signature ();
+
+ int min_streams () const { return d_min_streams; }
+ int max_streams () const { return d_max_streams; }
+ int sizeof_stream_item (int index) const;
+ std::vector<int> sizeof_stream_items() const;
+};
+
diff --git a/gnuradio-core/src/lib/runtime/gr_local_sighandler.cc b/gnuradio-core/src/lib/runtime/gr_local_sighandler.cc
new file mode 100644
index 000000000..fb31742e1
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_local_sighandler.cc
@@ -0,0 +1,187 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_local_sighandler.h>
+#include <stdexcept>
+#include <stdio.h>
+#include <string.h>
+
+
+gr_local_sighandler::gr_local_sighandler (int signum,
+ void (*new_handler)(int))
+ : d_signum (signum)
+{
+#ifdef HAVE_SIGACTION
+ struct sigaction new_action;
+ memset (&new_action, 0, sizeof (new_action));
+
+ new_action.sa_handler = new_handler;
+ sigemptyset (&new_action.sa_mask);
+ new_action.sa_flags = 0;
+
+ if (sigaction (d_signum, &new_action, &d_old_action) < 0){
+ perror ("sigaction (install new)");
+ throw std::runtime_error ("sigaction");
+ }
+#endif
+}
+
+gr_local_sighandler::~gr_local_sighandler ()
+{
+#ifdef HAVE_SIGACTION
+ if (sigaction (d_signum, &d_old_action, 0) < 0){
+ perror ("sigaction (restore old)");
+ throw std::runtime_error ("sigaction");
+ }
+#endif
+}
+
+void
+gr_local_sighandler::throw_signal (int signum)
+{
+ throw gr_signal (signum);
+}
+
+/*
+ * Semi-hideous way to may a signal number into a signal name
+ */
+
+#define SIGNAME(x) case x: return #x
+
+std::string
+gr_signal::name () const
+{
+ char tmp[128];
+
+ switch (signal ()){
+#ifdef SIGHUP
+ SIGNAME (SIGHUP);
+#endif
+#ifdef SIGINT
+ SIGNAME (SIGINT);
+#endif
+#ifdef SIGQUIT
+ SIGNAME (SIGQUIT);
+#endif
+#ifdef SIGILL
+ SIGNAME (SIGILL);
+#endif
+#ifdef SIGTRAP
+ SIGNAME (SIGTRAP);
+#endif
+#ifdef SIGABRT
+ SIGNAME (SIGABRT);
+#endif
+#ifdef SIGBUS
+ SIGNAME (SIGBUS);
+#endif
+#ifdef SIGFPE
+ SIGNAME (SIGFPE);
+#endif
+#ifdef SIGKILL
+ SIGNAME (SIGKILL);
+#endif
+#ifdef SIGUSR1
+ SIGNAME (SIGUSR1);
+#endif
+#ifdef SIGSEGV
+ SIGNAME (SIGSEGV);
+#endif
+#ifdef SIGUSR2
+ SIGNAME (SIGUSR2);
+#endif
+#ifdef SIGPIPE
+ SIGNAME (SIGPIPE);
+#endif
+#ifdef SIGALRM
+ SIGNAME (SIGALRM);
+#endif
+#ifdef SIGTERM
+ SIGNAME (SIGTERM);
+#endif
+#ifdef SIGSTKFLT
+ SIGNAME (SIGSTKFLT);
+#endif
+#ifdef SIGCHLD
+ SIGNAME (SIGCHLD);
+#endif
+#ifdef SIGCONT
+ SIGNAME (SIGCONT);
+#endif
+#ifdef SIGSTOP
+ SIGNAME (SIGSTOP);
+#endif
+#ifdef SIGTSTP
+ SIGNAME (SIGTSTP);
+#endif
+#ifdef SIGTTIN
+ SIGNAME (SIGTTIN);
+#endif
+#ifdef SIGTTOU
+ SIGNAME (SIGTTOU);
+#endif
+#ifdef SIGURG
+ SIGNAME (SIGURG);
+#endif
+#ifdef SIGXCPU
+ SIGNAME (SIGXCPU);
+#endif
+#ifdef SIGXFSZ
+ SIGNAME (SIGXFSZ);
+#endif
+#ifdef SIGVTALRM
+ SIGNAME (SIGVTALRM);
+#endif
+#ifdef SIGPROF
+ SIGNAME (SIGPROF);
+#endif
+#ifdef SIGWINCH
+ SIGNAME (SIGWINCH);
+#endif
+#ifdef SIGIO
+ SIGNAME (SIGIO);
+#endif
+#ifdef SIGPWR
+ SIGNAME (SIGPWR);
+#endif
+#ifdef SIGSYS
+ SIGNAME (SIGSYS);
+#endif
+ default:
+#if defined (HAVE_SNPRINTF)
+#if defined (SIGRTMIN) && defined (SIGRTMAX)
+ if (signal () >= SIGRTMIN && signal () <= SIGRTMAX){
+ snprintf (tmp, sizeof (tmp), "SIGRTMIN + %d", signal ());
+ return tmp;
+ }
+#endif
+ snprintf (tmp, sizeof (tmp), "SIGNAL %d", signal ());
+ return tmp;
+#else
+ return "Unknown signal";
+#endif
+ }
+}
diff --git a/gnuradio-core/src/lib/runtime/gr_local_sighandler.h b/gnuradio-core/src/lib/runtime/gr_local_sighandler.h
new file mode 100644
index 000000000..a30e2c13a
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_local_sighandler.h
@@ -0,0 +1,65 @@
+/* -*- 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_LOCAL_SIGHANDLER_H
+#define INCLUDED_GR_LOCAL_SIGHANDLER_H
+
+#ifdef HAVE_SIGNAL_H
+#include <signal.h>
+#endif
+
+#include <gr_core_api.h>
+#include <string>
+
+/*!
+ * \brief Get and set signal handler.
+ *
+ * \ingroup internal
+ * Constructor installs new handler, destructor reinstalls
+ * original value.
+ */
+class GR_CORE_API gr_local_sighandler {
+ int d_signum;
+#ifdef HAVE_SIGACTION
+ struct sigaction d_old_action;
+#endif
+public:
+ gr_local_sighandler (int signum, void (*new_handler)(int));
+ ~gr_local_sighandler ();
+
+ /* throw gr_signal (signum) */
+ static void throw_signal (int signum);
+};
+
+/*!
+ * \brief Representation of signal.
+ */
+class GR_CORE_API gr_signal
+{
+ int d_signum;
+public:
+ gr_signal (int signum) : d_signum (signum) {}
+ int signal () const { return d_signum; }
+ std::string name () const;
+};
+
+#endif /* INCLUDED_GR_LOCAL_SIGHANDLER_H */
diff --git a/gnuradio-core/src/lib/runtime/gr_message.cc b/gnuradio-core/src/lib/runtime/gr_message.cc
new file mode 100644
index 000000000..a99dcd765
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_message.cc
@@ -0,0 +1,78 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005 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 <gr_message.h>
+#include <assert.h>
+#include <string.h>
+
+static long s_ncurrently_allocated = 0;
+
+gr_message_sptr
+gr_make_message (long type, double arg1, double arg2, size_t length)
+{
+ return gr_message_sptr (new gr_message (type, arg1, arg2, length));
+}
+
+gr_message_sptr
+gr_make_message_from_string(const std::string s, long type, double arg1, double arg2)
+{
+ gr_message_sptr m = gr_make_message(type, arg1, arg2, s.size());
+ memcpy(m->msg(), s.data(), s.size());
+ return m;
+}
+
+
+gr_message::gr_message (long type, double arg1, double arg2, size_t length)
+ : d_type(type), d_arg1(arg1), d_arg2(arg2)
+{
+ if (length == 0)
+ d_buf_start = d_msg_start = d_msg_end = d_buf_end = 0;
+ else {
+ d_buf_start = new unsigned char [length];
+ d_msg_start = d_buf_start;
+ d_msg_end = d_buf_end = d_buf_start + length;
+ }
+ s_ncurrently_allocated++;
+}
+
+gr_message::~gr_message ()
+{
+ assert (d_next == 0);
+ delete [] d_buf_start;
+ d_msg_start = d_msg_end = d_buf_end = 0;
+ s_ncurrently_allocated--;
+}
+
+std::string
+gr_message::to_string() const
+{
+ return std::string((char *)d_msg_start, length());
+}
+
+long
+gr_message_ncurrently_allocated ()
+{
+ return s_ncurrently_allocated;
+}
diff --git a/gnuradio-core/src/lib/runtime/gr_message.h b/gnuradio-core/src/lib/runtime/gr_message.h
new file mode 100644
index 000000000..d386ca009
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_message.h
@@ -0,0 +1,91 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005 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_MESSAGE_H
+#define INCLUDED_GR_MESSAGE_H
+
+#include <gr_core_api.h>
+#include <gr_types.h>
+#include <string>
+
+class gr_message;
+typedef boost::shared_ptr<gr_message> gr_message_sptr;
+
+/*!
+ * \brief public constructor for gr_message
+ */
+GR_CORE_API gr_message_sptr
+gr_make_message(long type = 0, double arg1 = 0, double arg2 = 0, size_t length = 0);
+
+GR_CORE_API gr_message_sptr
+gr_make_message_from_string(const std::string s, long type = 0, double arg1 = 0, double arg2 = 0);
+
+/*!
+ * \brief Message class.
+ *
+ * \ingroup misc
+ * The ideas and method names for adjustable message length were
+ * lifted from the click modular router "Packet" class.
+ */
+class GR_CORE_API gr_message {
+ gr_message_sptr d_next; // link field for msg queue
+ long d_type; // type of the message
+ double d_arg1; // optional arg1
+ double d_arg2; // optional arg2
+
+ unsigned char *d_buf_start; // start of allocated buffer
+ unsigned char *d_msg_start; // where the msg starts
+ unsigned char *d_msg_end; // one beyond end of msg
+ unsigned char *d_buf_end; // one beyond end of allocated buffer
+
+ gr_message (long type, double arg1, double arg2, size_t length);
+
+ friend GR_CORE_API gr_message_sptr
+ gr_make_message (long type, double arg1, double arg2, size_t length);
+
+ friend GR_CORE_API gr_message_sptr
+ gr_make_message_from_string (const std::string s, long type, double arg1, double arg2);
+
+ friend class gr_msg_queue;
+
+ unsigned char *buf_data() const { return d_buf_start; }
+ size_t buf_len() const { return d_buf_end - d_buf_start; }
+
+public:
+ ~gr_message ();
+
+ long type() const { return d_type; }
+ double arg1() const { return d_arg1; }
+ double arg2() const { return d_arg2; }
+
+ void set_type(long type) { d_type = type; }
+ void set_arg1(double arg1) { d_arg1 = arg1; }
+ void set_arg2(double arg2) { d_arg2 = arg2; }
+
+ unsigned char *msg() const { return d_msg_start; }
+ size_t length() const { return d_msg_end - d_msg_start; }
+ std::string to_string() const;
+
+};
+
+GR_CORE_API long gr_message_ncurrently_allocated ();
+
+#endif /* INCLUDED_GR_MESSAGE_H */
diff --git a/gnuradio-core/src/lib/runtime/gr_message.i b/gnuradio-core/src/lib/runtime/gr_message.i
new file mode 100644
index 000000000..356bba5b5
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_message.i
@@ -0,0 +1,65 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005 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.
+ */
+
+class gr_message;
+typedef boost::shared_ptr<gr_message> gr_message_sptr;
+%template(gr_message_sptr) boost::shared_ptr<gr_message>;
+
+%rename(message_from_string) gr_make_message_from_string;
+gr_message_sptr
+gr_make_message_from_string(const std::string s, long type = 0, double arg1 = 0, double arg2 = 0);
+
+%rename(message) gr_make_message;
+gr_message_sptr
+gr_make_message(long type = 0, double arg1 = 0, double arg2 = 0, size_t length = 0);
+
+/*!
+ * \brief Message.
+ *
+ * The ideas and method names for adjustable message length were
+ * lifted from the click modular router "Packet" class.
+ */
+class gr_message {
+ gr_message (long type, double arg1, double arg2, size_t length);
+
+ unsigned char *buf_data() const { return d_buf_start; }
+ size_t buf_len() const { return d_buf_end - d_buf_start; }
+
+public:
+ ~gr_message ();
+
+ long type() const { return d_type; }
+ double arg1() const { return d_arg1; }
+ double arg2() const { return d_arg2; }
+
+ void set_type(long type) { d_type = type; }
+ void set_arg1(double arg1) { d_arg1 = arg1; }
+ void set_arg2(double arg2) { d_arg2 = arg2; }
+
+ size_t length() const;
+ std::string to_string() const;
+
+};
+
+%rename(message_ncurrently_allocated) gr_message_ncurrently_allocated;
+long gr_message_ncurrently_allocated();
+
diff --git a/gnuradio-core/src/lib/runtime/gr_msg_accepter.cc b/gnuradio-core/src/lib/runtime/gr_msg_accepter.cc
new file mode 100644
index 000000000..93d5fb20e
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_msg_accepter.cc
@@ -0,0 +1,59 @@
+/* -*- 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 this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <gr_msg_accepter.h>
+#include <gr_block.h>
+#include <gr_block_detail.h>
+#include <gr_hier_block2.h>
+#include <stdexcept>
+
+using namespace pmt;
+
+gr_msg_accepter::gr_msg_accepter()
+{
+}
+
+gr_msg_accepter::~gr_msg_accepter()
+{
+ // NOP, required as virtual destructor
+}
+
+void
+gr_msg_accepter::post(pmt_t which_port, pmt_t msg)
+{
+ // Notify derived class, handled case by case
+ gr_block *p = dynamic_cast<gr_block *>(this);
+ if (p) {
+ p->_post(which_port,msg);
+ return;
+ }
+ gr_hier_block2 *p2 = dynamic_cast<gr_hier_block2 *>(this);
+ if (p2){
+ // FIXME do the right thing
+ return;
+ }
+
+ throw std::runtime_error("unknown derived class");
+}
diff --git a/gnuradio-core/src/lib/runtime/gr_msg_accepter.h b/gnuradio-core/src/lib/runtime/gr_msg_accepter.h
new file mode 100644
index 000000000..a497ba6e7
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_msg_accepter.h
@@ -0,0 +1,43 @@
+/* -*- 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 this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef INCLUDED_GR_MSG_ACCEPTER_H
+#define INCLUDED_GR_MSG_ACCEPTER_H
+
+#include <gr_core_api.h>
+#include <gruel/msg_accepter.h>
+#include <gruel/pmt.h>
+
+/*!
+ * \brief Accepts messages and inserts them into a message queue, then notifies
+ * subclass gr_basic_block there is a message pending.
+ */
+class GR_CORE_API gr_msg_accepter : public gruel::msg_accepter
+{
+public:
+ gr_msg_accepter();
+ ~gr_msg_accepter();
+
+ void post(pmt::pmt_t which_port, pmt::pmt_t msg);
+
+};
+
+#endif /* INCLUDED_GR_MSG_ACCEPTER_H */
diff --git a/gnuradio-core/src/lib/runtime/gr_msg_handler.cc b/gnuradio-core/src/lib/runtime/gr_msg_handler.cc
new file mode 100644
index 000000000..0f9349708
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_msg_handler.cc
@@ -0,0 +1,30 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005 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 <gr_msg_handler.h>
+
+gr_msg_handler::~gr_msg_handler ()
+{
+}
diff --git a/gnuradio-core/src/lib/runtime/gr_msg_handler.h b/gnuradio-core/src/lib/runtime/gr_msg_handler.h
new file mode 100644
index 000000000..57e8a95d6
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_msg_handler.h
@@ -0,0 +1,43 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005 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_MSG_HANDLER_H
+#define INCLUDED_GR_MSG_HANDLER_H
+
+#include <gr_core_api.h>
+#include <gr_message.h>
+
+class gr_msg_handler;
+typedef boost::shared_ptr<gr_msg_handler> gr_msg_handler_sptr;
+
+/*!
+ * \brief abstract class of message handlers
+ * \ingroup base
+ */
+class GR_CORE_API gr_msg_handler {
+public:
+ virtual ~gr_msg_handler ();
+
+ //! handle \p msg
+ virtual void handle (gr_message_sptr msg) = 0;
+};
+
+#endif /* INCLUDED_GR_MSG_HANDLER_H */
diff --git a/gnuradio-core/src/lib/runtime/gr_msg_handler.i b/gnuradio-core/src/lib/runtime/gr_msg_handler.i
new file mode 100644
index 000000000..f493dac1b
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_msg_handler.i
@@ -0,0 +1,32 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005 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.
+ */
+
+/*!
+ * \brief abstract class of message handlers
+ */
+class gr_msg_handler {
+public:
+ virtual ~gr_msg_handler () = 0;
+
+ //! handle \p msg
+ virtual void handle (gr_message_sptr msg) = 0;
+};
diff --git a/gnuradio-core/src/lib/runtime/gr_msg_queue.cc b/gnuradio-core/src/lib/runtime/gr_msg_queue.cc
new file mode 100644
index 000000000..0cf046771
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_msg_queue.cc
@@ -0,0 +1,125 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+#include <gr_msg_queue.h>
+#include <stdexcept>
+
+gr_msg_queue_sptr
+gr_make_msg_queue(unsigned int limit)
+{
+ return gr_msg_queue_sptr (new gr_msg_queue(limit));
+}
+
+gr_msg_queue::gr_msg_queue(unsigned int limit)
+ : d_not_empty(), d_not_full(),
+ /*d_head(0), d_tail(0),*/ d_count(0), d_limit(limit)
+{
+}
+
+gr_msg_queue::~gr_msg_queue()
+{
+ flush ();
+}
+
+void
+gr_msg_queue::insert_tail(gr_message_sptr msg)
+{
+ if (msg->d_next)
+ throw std::invalid_argument("gr_msg_queue::insert_tail: msg already in queue");
+
+ gruel::scoped_lock guard(d_mutex);
+
+ while (full_p())
+ d_not_full.wait(guard);
+
+ if (d_tail == 0){
+ d_tail = d_head = msg;
+ //msg->d_next = 0;
+ msg->d_next.reset();
+ }
+ else {
+ d_tail->d_next = msg;
+ d_tail = msg;
+ //msg->d_next = 0;
+ msg->d_next.reset();
+ }
+ d_count++;
+ d_not_empty.notify_one();
+}
+
+gr_message_sptr
+gr_msg_queue::delete_head()
+{
+ gruel::scoped_lock guard(d_mutex);
+ gr_message_sptr m;
+
+ while ((m = d_head) == 0)
+ d_not_empty.wait(guard);
+
+ d_head = m->d_next;
+ if (d_head == 0){
+ //d_tail = 0;
+ d_tail.reset();
+ }
+
+ d_count--;
+ // m->d_next = 0;
+ m->d_next.reset();
+ d_not_full.notify_one();
+ return m;
+}
+
+gr_message_sptr
+gr_msg_queue::delete_head_nowait()
+{
+ gruel::scoped_lock guard(d_mutex);
+ gr_message_sptr m;
+
+ if ((m = d_head) == 0){
+ //return 0;
+ return gr_message_sptr();
+ }
+
+ d_head = m->d_next;
+ if (d_head == 0){
+ //d_tail = 0;
+ d_tail.reset();
+ }
+
+ d_count--;
+ //m->d_next = 0;
+ m->d_next.reset();
+ d_not_full.notify_one();
+ return m;
+}
+
+void
+gr_msg_queue::flush()
+{
+ gr_message_sptr m;
+
+ while ((m = delete_head_nowait ()) != 0)
+ ;
+}
diff --git a/gnuradio-core/src/lib/runtime/gr_msg_queue.h b/gnuradio-core/src/lib/runtime/gr_msg_queue.h
new file mode 100644
index 000000000..86440bbb0
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_msg_queue.h
@@ -0,0 +1,92 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005,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.
+ */
+#ifndef INCLUDED_GR_MSG_QUEUE_H
+#define INCLUDED_GR_MSG_QUEUE_H
+
+#include <gr_core_api.h>
+#include <gr_msg_handler.h>
+#include <gruel/thread.h>
+
+class gr_msg_queue;
+typedef boost::shared_ptr<gr_msg_queue> gr_msg_queue_sptr;
+
+GR_CORE_API gr_msg_queue_sptr gr_make_msg_queue(unsigned int limit=0);
+
+/*!
+ * \brief thread-safe message queue
+ * \ingroup misc
+ */
+class GR_CORE_API gr_msg_queue : public gr_msg_handler {
+
+ gruel::mutex d_mutex;
+ gruel::condition_variable d_not_empty;
+ gruel::condition_variable d_not_full;
+ gr_message_sptr d_head;
+ gr_message_sptr d_tail;
+ unsigned int d_count; // # of messages in queue.
+ unsigned int d_limit; // max # of messages in queue. 0 -> unbounded
+
+public:
+ gr_msg_queue(unsigned int limit);
+ ~gr_msg_queue();
+
+ //! Generic msg_handler method: insert the message.
+ void handle(gr_message_sptr msg) { insert_tail (msg); }
+
+ /*!
+ * \brief Insert message at tail of queue.
+ * \param msg message
+ *
+ * Block if queue if full.
+ */
+ void insert_tail(gr_message_sptr msg);
+
+ /*!
+ * \brief Delete message from head of queue and return it.
+ * Block if no message is available.
+ */
+ gr_message_sptr delete_head();
+
+ /*!
+ * \brief If there's a message in the q, delete it and return it.
+ * If no message is available, return 0.
+ */
+ gr_message_sptr delete_head_nowait();
+
+ //! Delete all messages from the queue
+ void flush();
+
+ //! is the queue empty?
+ bool empty_p() const { return d_count == 0; }
+
+ //! is the queue full?
+ bool full_p() const { return d_limit != 0 && d_count >= d_limit; }
+
+ //! return number of messages in queue
+ unsigned int count() const { return d_count; }
+
+ //! return limit on number of message in queue. 0 -> unbounded
+ unsigned int limit() const { return d_limit; }
+
+};
+
+#endif /* INCLUDED_GR_MSG_QUEUE_H */
diff --git a/gnuradio-core/src/lib/runtime/gr_msg_queue.i b/gnuradio-core/src/lib/runtime/gr_msg_queue.i
new file mode 100644
index 000000000..65cbe782b
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_msg_queue.i
@@ -0,0 +1,107 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005,2009,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.
+ */
+
+class gr_msg_queue;
+typedef boost::shared_ptr<gr_msg_queue> gr_msg_queue_sptr;
+%template(gr_msg_queue_sptr) boost::shared_ptr<gr_msg_queue>;
+
+%rename(msg_queue) gr_make_msg_queue;
+gr_msg_queue_sptr gr_make_msg_queue(unsigned limit=0);
+
+/*!
+ * \brief thread-safe message queue
+ */
+%ignore gr_msg_queue;
+class gr_msg_queue : public gr_msg_handler {
+public:
+ gr_msg_queue(unsigned int limit);
+ ~gr_msg_queue();
+
+ //! Generic msg_handler method: insert the message.
+ //void handle(gr_message_sptr msg) { insert_tail (msg); }
+
+ /*!
+ * \brief Insert message at tail of queue.
+ * \param msg message
+ *
+ * Block if queue if full.
+ */
+ //void insert_tail(gr_message_sptr msg);
+
+ /*!
+ * \brief Delete message from head of queue and return it.
+ * Block if no message is available.
+ */
+ //gr_message_sptr delete_head();
+
+ /*!
+ * \brief If there's a message in the q, delete it and return it.
+ * If no message is available, return 0.
+ */
+ gr_message_sptr delete_head_nowait();
+
+ //! is the queue empty?
+ bool empty_p() const;
+
+ //! is the queue full?
+ bool full_p() const;
+
+ //! return number of messages in queue
+ unsigned int count() const;
+
+ //! Delete all messages from the queue
+ void flush();
+};
+
+/*
+ * The following kludge-o-rama releases the Python global interpreter
+ * lock around these potentially blocking calls. We don't want
+ * libgnuradio-core to be dependent on Python, thus we create these
+ * functions that serve as replacements for the normal C++ delete_head
+ * and insert_tail methods. The %pythoncode smashes these new C++
+ * functions into the gr.msg_queue wrapper class, so that everything
+ * appears normal. (An evil laugh is heard in the distance...)
+ */
+#ifdef SWIGPYTHON
+%inline %{
+ gr_message_sptr gr_py_msg_queue__delete_head(gr_msg_queue_sptr q) {
+ gr_message_sptr msg;
+ GR_PYTHON_BLOCKING_CODE(
+ msg = q->delete_head();
+ )
+ return msg;
+ }
+
+ void gr_py_msg_queue__insert_tail(gr_msg_queue_sptr q, gr_message_sptr msg) {
+ GR_PYTHON_BLOCKING_CODE(
+ q->insert_tail(msg);
+ )
+ }
+%}
+
+// smash in new python delete_head and insert_tail methods...
+%pythoncode %{
+gr_msg_queue_sptr.delete_head = gr_py_msg_queue__delete_head
+gr_msg_queue_sptr.insert_tail = gr_py_msg_queue__insert_tail
+gr_msg_queue_sptr.handle = gr_py_msg_queue__insert_tail
+%}
+#endif // SWIGPYTHON
diff --git a/gnuradio-core/src/lib/runtime/gr_pagesize.cc b/gnuradio-core/src/lib/runtime/gr_pagesize.cc
new file mode 100644
index 000000000..e31e05ca7
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_pagesize.cc
@@ -0,0 +1,56 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2003 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 <gr_pagesize.h>
+#include <unistd.h>
+#include <stdio.h>
+
+#if defined(_WIN32) && defined(HAVE_GETPAGESIZE)
+extern "C" size_t getpagesize(void);
+#endif
+
+int
+gr_pagesize ()
+{
+ static int s_pagesize = -1;
+
+ if (s_pagesize == -1){
+#if defined(HAVE_GETPAGESIZE)
+ s_pagesize = getpagesize ();
+#elif defined (HAVE_SYSCONF)
+ s_pagesize = sysconf (_SC_PAGESIZE);
+ if (s_pagesize == -1){
+ perror ("_SC_PAGESIZE");
+ s_pagesize = 4096;
+ }
+#else
+ fprintf (stderr, "gr_pagesize: no info; setting pagesize = 4096\n");
+ s_pagesize = 4096;
+#endif
+ }
+ return s_pagesize;
+}
+
diff --git a/gnuradio-core/src/lib/runtime/gr_pagesize.h b/gnuradio-core/src/lib/runtime/gr_pagesize.h
new file mode 100644
index 000000000..3e2daa925
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_pagesize.h
@@ -0,0 +1,34 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2003 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 _GR_PAGESIZE_H_
+#define _GR_PAGESIZE_H_
+
+#include <gr_core_api.h>
+
+/*!
+ * \brief return the page size in bytes
+ */
+
+GR_CORE_API int gr_pagesize ();
+
+
+#endif /* _GR_PAGESIZE_H_ */ \ No newline at end of file
diff --git a/gnuradio-core/src/lib/runtime/gr_preferences.cc b/gnuradio-core/src/lib/runtime/gr_preferences.cc
new file mode 100644
index 000000000..a0f561660
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_preferences.cc
@@ -0,0 +1,108 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2003,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_preferences.h>
+#include <gr_sys_paths.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <string.h>
+
+#include <boost/filesystem/operations.hpp>
+#include <boost/filesystem/path.hpp>
+namespace fs = boost::filesystem;
+
+/*
+ * The simplest thing that could possibly work:
+ * the key is the filename; the value is the file contents.
+ */
+
+static const char *
+pathname (const char *key)
+{
+ static fs::path path;
+ path = fs::path(gr_appdata_path()) / ".gnuradio" / "prefs" / key;
+ return path.string().c_str();
+}
+
+static void
+ensure_dir_path ()
+{
+ fs::path path = fs::path(gr_appdata_path()) / ".gnuradio";
+ if (!fs::is_directory(path)) fs::create_directory(path);
+
+ path = path / "prefs";
+ if (!fs::is_directory(path)) fs::create_directory(path);
+}
+
+const char *
+gr_preferences::get (const char *key)
+{
+ static char buf[1024];
+
+ FILE *fp = fopen (pathname (key), "r");
+ if (fp == 0) {
+ perror (pathname (key));
+ return 0;
+ }
+
+ memset (buf, 0, sizeof (buf));
+ size_t ret = fread (buf, 1, sizeof (buf) - 1, fp);
+ if(ret == 0) {
+ if(ferror(fp) != 0) {
+ perror (pathname (key));
+ fclose (fp);
+ return 0;
+ }
+ }
+ fclose (fp);
+ return buf;
+}
+
+void
+gr_preferences::set (const char *key, const char *value)
+{
+ ensure_dir_path ();
+
+ FILE *fp = fopen (pathname (key), "w");
+ if (fp == 0){
+ perror (pathname (key));
+ return;
+ }
+
+ size_t ret = fwrite (value, 1, strlen (value), fp);
+ if(ret == 0) {
+ if(ferror(fp) != 0) {
+ perror (pathname (key));
+ fclose (fp);
+ return;
+ }
+ }
+ fclose (fp);
+};
diff --git a/gnuradio-core/src/lib/runtime/gr_preferences.h b/gnuradio-core/src/lib/runtime/gr_preferences.h
new file mode 100644
index 000000000..bfcc0424b
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_preferences.h
@@ -0,0 +1,34 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2003 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 _GR_PREFERENCES_H_
+#define _GR_PREFERENCES_H_
+
+#include <gr_core_api.h>
+
+class GR_CORE_API gr_preferences {
+ public:
+ static const char *get (const char *key);
+ static void set (const char *key, const char *value);
+};
+
+#endif /* _GR_PREFERENCES_H_ */ \ No newline at end of file
diff --git a/gnuradio-core/src/lib/runtime/gr_realtime.cc b/gnuradio-core/src/lib/runtime/gr_realtime.cc
new file mode 100644
index 000000000..75b497999
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_realtime.cc
@@ -0,0 +1,32 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006,2007,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <gr_realtime.h>
+
+gr_rt_status_t
+gr_enable_realtime_scheduling()
+{
+ return gruel::enable_realtime_scheduling();
+}
diff --git a/gnuradio-core/src/lib/runtime/gr_realtime.h b/gnuradio-core/src/lib/runtime/gr_realtime.h
new file mode 100644
index 000000000..fe6549039
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_realtime.h
@@ -0,0 +1,37 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_GR_REALTIME_H
+#define INCLUDED_GR_REALTIME_H
+
+#include <gr_core_api.h>
+#include <gruel/realtime.h>
+
+typedef gruel::rt_status_t gr_rt_status_t;
+
+/*!
+ * \brief If possible, enable high-priority "real time" scheduling.
+ * \ingroup misc
+ */
+GR_CORE_API gr_rt_status_t gr_enable_realtime_scheduling();
+
+#endif /* INCLUDED_GR_REALTIME_H */
diff --git a/gnuradio-core/src/lib/runtime/gr_realtime.i b/gnuradio-core/src/lib/runtime/gr_realtime.i
new file mode 100644
index 000000000..1051d3e2b
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_realtime.i
@@ -0,0 +1,44 @@
+/* -*- 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.
+ */
+
+%rename(enable_realtime_scheduling) gr_enable_realtime_scheduling;
+
+// NOTE: This is duplicated from gruel/src/include/gruel/gr_realtime.h,
+// and must be kept in sync with it. This is the least evil workaround
+// for allowing 3rd party code builds to work when GNU Radio is
+// installed from binary packages into the standard system directories.
+// Otherwise, they can't find #include <gruel/gr_realtime.h>, since
+// pkg-config strips -I/usr/include from the --cflags path.
+
+namespace gruel {
+
+ typedef enum {
+ RT_OK = 0,
+ RT_NOT_IMPLEMENTED,
+ RT_NO_PRIVS,
+ RT_OTHER_ERROR
+ } rt_status_t;
+
+}
+
+typedef gruel::rt_status_t gr_rt_status_t;
+gr_rt_status_t gr_enable_realtime_scheduling();
diff --git a/gnuradio-core/src/lib/runtime/gr_runtime_types.h b/gnuradio-core/src/lib/runtime/gr_runtime_types.h
new file mode 100644
index 000000000..0d6149288
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_runtime_types.h
@@ -0,0 +1,56 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,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.
+ */
+
+#ifndef INCLUDED_GR_RUNTIME_TYPES_H
+#define INCLUDED_GR_RUNTIME_TYPES_H
+
+#include <gr_core_api.h>
+#include <gr_types.h>
+
+/*
+ * typedefs for smart pointers we use throughout the runtime system
+ */
+
+class gr_basic_block;
+class gr_block;
+class gr_block_detail;
+class gr_hier_block2;
+class gr_io_signature;
+class gr_buffer;
+class gr_buffer_reader;
+class gr_flowgraph;
+class gr_flat_flowgraph;
+class gr_top_block;
+class gr_top_block_detail;
+
+typedef boost::shared_ptr<gr_basic_block> gr_basic_block_sptr;
+typedef boost::shared_ptr<gr_block> gr_block_sptr;
+typedef boost::shared_ptr<gr_block_detail> gr_block_detail_sptr;
+typedef boost::shared_ptr<gr_hier_block2> gr_hier_block2_sptr;
+typedef boost::shared_ptr<gr_io_signature> gr_io_signature_sptr;
+typedef boost::shared_ptr<gr_buffer> gr_buffer_sptr;
+typedef boost::shared_ptr<gr_buffer_reader> gr_buffer_reader_sptr;
+typedef boost::shared_ptr<gr_flowgraph> gr_flowgraph_sptr;
+typedef boost::shared_ptr<gr_flat_flowgraph> gr_flat_flowgraph_sptr;
+typedef boost::shared_ptr<gr_top_block> gr_top_block_sptr;
+
+#endif /* INCLUDED_GR_RUNTIME_TYPES_H */
diff --git a/gnuradio-core/src/lib/runtime/gr_scheduler.cc b/gnuradio-core/src/lib/runtime/gr_scheduler.cc
new file mode 100644
index 000000000..c691f5d99
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_scheduler.cc
@@ -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 this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <gr_scheduler.h>
+
+gr_scheduler::gr_scheduler(gr_flat_flowgraph_sptr ffg, int max_noutput_items)
+{
+}
+
+gr_scheduler::~gr_scheduler()
+{
+}
diff --git a/gnuradio-core/src/lib/runtime/gr_scheduler.h b/gnuradio-core/src/lib/runtime/gr_scheduler.h
new file mode 100644
index 000000000..6d130327f
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_scheduler.h
@@ -0,0 +1,65 @@
+/* -*- 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 this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef INCLUDED_GR_SCHEDULER_H
+#define INCLUDED_GR_SCHEDULER_H
+
+#include <gr_core_api.h>
+#include <boost/utility.hpp>
+#include <gr_block.h>
+#include <gr_flat_flowgraph.h>
+
+
+class gr_scheduler;
+typedef boost::shared_ptr<gr_scheduler> gr_scheduler_sptr;
+
+
+/*!
+ * \brief Abstract scheduler that takes a flattened flow graph and runs it.
+ *
+ * Preconditions: details, buffers and buffer readers have been assigned.
+ */
+class GR_CORE_API gr_scheduler : boost::noncopyable
+{
+
+public:
+ /*!
+ * \brief Construct a scheduler and begin evaluating the graph.
+ *
+ * The scheduler will continue running until all blocks until they
+ * report that they are done or the stop method is called.
+ */
+ gr_scheduler(gr_flat_flowgraph_sptr ffg, int max_noutput_items);
+
+ virtual ~gr_scheduler();
+
+ /*!
+ * \brief Tell the scheduler to stop executing.
+ */
+ virtual void stop() = 0;
+
+ /*!
+ * \brief Block until the graph is done.
+ */
+ virtual void wait() = 0;
+};
+
+#endif /* INCLUDED_GR_SCHEDULER_H */
diff --git a/gnuradio-core/src/lib/runtime/gr_scheduler_sts.cc b/gnuradio-core/src/lib/runtime/gr_scheduler_sts.cc
new file mode 100644
index 000000000..2c96def6d
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_scheduler_sts.cc
@@ -0,0 +1,87 @@
+/* -*- 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 this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <gr_scheduler_sts.h>
+#include <gr_single_threaded_scheduler.h>
+#include <gruel/thread_body_wrapper.h>
+
+class sts_container
+{
+ gr_block_vector_t d_blocks;
+
+public:
+
+ sts_container(gr_block_vector_t blocks)
+ : d_blocks(blocks) {}
+
+ void operator()()
+ {
+ gr_make_single_threaded_scheduler(d_blocks)->run();
+ }
+};
+
+
+gr_scheduler_sptr
+gr_scheduler_sts::make(gr_flat_flowgraph_sptr ffg, int max_noutput_items)
+{
+ return gr_scheduler_sptr(new gr_scheduler_sts(ffg, max_noutput_items));
+}
+
+gr_scheduler_sts::gr_scheduler_sts(gr_flat_flowgraph_sptr ffg, int max_noutput_items)
+ : gr_scheduler(ffg, max_noutput_items)
+{
+ // Split the flattened flow graph into discrete partitions, each
+ // of which is topologically sorted.
+
+ std::vector<gr_basic_block_vector_t> graphs = ffg->partition();
+
+ // For each partition, create a thread to evaluate it using
+ // an instance of the gr_single_threaded_scheduler
+
+ for (std::vector<gr_basic_block_vector_t>::iterator p = graphs.begin();
+ p != graphs.end(); p++) {
+
+ gr_block_vector_t blocks = gr_flat_flowgraph::make_block_vector(*p);
+ d_threads.create_thread(
+ gruel::thread_body_wrapper<sts_container>(sts_container(blocks),
+ "single-threaded-scheduler"));
+ }
+}
+
+gr_scheduler_sts::~gr_scheduler_sts()
+{
+ stop();
+}
+
+void
+gr_scheduler_sts::stop()
+{
+ d_threads.interrupt_all();
+}
+
+void
+gr_scheduler_sts::wait()
+{
+ d_threads.join_all();
+}
diff --git a/gnuradio-core/src/lib/runtime/gr_scheduler_sts.h b/gnuradio-core/src/lib/runtime/gr_scheduler_sts.h
new file mode 100644
index 000000000..011874ec0
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_scheduler_sts.h
@@ -0,0 +1,63 @@
+/* -*- 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 this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+#ifndef INCLUDED_GR_SCHEDULER_STS_H
+#define INCLUDED_GR_SCHEDULER_STS_H
+
+#include <gr_core_api.h>
+#include <gr_scheduler.h>
+#include <gruel/thread_group.h>
+
+/*!
+ * \brief Concrete scheduler that uses the single_threaded_scheduler
+ */
+class GR_CORE_API gr_scheduler_sts : public gr_scheduler
+{
+ gruel::thread_group d_threads;
+
+protected:
+ /*!
+ * \brief Construct a scheduler and begin evaluating the graph.
+ *
+ * The scheduler will continue running until all blocks until they
+ * report that they are done or the stop method is called.
+ */
+ gr_scheduler_sts(gr_flat_flowgraph_sptr ffg, int max_noutput_items);
+
+public:
+ static gr_scheduler_sptr make(gr_flat_flowgraph_sptr ffg, int max_noutput_items);
+
+ ~gr_scheduler_sts();
+
+ /*!
+ * \brief Tell the scheduler to stop executing.
+ */
+ void stop();
+
+ /*!
+ * \brief Block until the graph is done.
+ */
+ void wait();
+};
+
+
+
+
+#endif /* INCLUDED_GR_SCHEDULER_STS_H */
diff --git a/gnuradio-core/src/lib/runtime/gr_scheduler_tpb.cc b/gnuradio-core/src/lib/runtime/gr_scheduler_tpb.cc
new file mode 100644
index 000000000..2824eb1b3
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_scheduler_tpb.cc
@@ -0,0 +1,103 @@
+/* -*- 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 this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <gr_scheduler_tpb.h>
+#include <gr_tpb_thread_body.h>
+#include <gruel/thread_body_wrapper.h>
+#include <sstream>
+
+/*
+ * You know, a lambda expression would be sooo much easier...
+ */
+class tpb_container
+{
+ gr_block_sptr d_block;
+ int d_max_noutput_items;
+
+public:
+ tpb_container(gr_block_sptr block, int max_noutput_items)
+ : d_block(block), d_max_noutput_items(max_noutput_items) {}
+
+ void operator()()
+ {
+ gr_tpb_thread_body body(d_block, d_max_noutput_items);
+ }
+};
+
+
+gr_scheduler_sptr
+gr_scheduler_tpb::make(gr_flat_flowgraph_sptr ffg, int max_noutput_items)
+{
+ return gr_scheduler_sptr(new gr_scheduler_tpb(ffg, max_noutput_items));
+}
+
+gr_scheduler_tpb::gr_scheduler_tpb(gr_flat_flowgraph_sptr ffg, int max_noutput_items)
+ : gr_scheduler(ffg, max_noutput_items)
+{
+ // Get a topologically sorted vector of all the blocks in use.
+ // Being topologically sorted probably isn't going to matter, but
+ // there's a non-zero chance it might help...
+
+ gr_basic_block_vector_t used_blocks = ffg->calc_used_blocks();
+ used_blocks = ffg->topological_sort(used_blocks);
+ gr_block_vector_t blocks = gr_flat_flowgraph::make_block_vector(used_blocks);
+
+ // Ensure that the done flag is clear on all blocks
+
+ for (size_t i = 0; i < blocks.size(); i++){
+ blocks[i]->detail()->set_done(false);
+ }
+
+ // Fire off a thead for each block
+
+ for (size_t i = 0; i < blocks.size(); i++){
+ std::stringstream name;
+ name << "thread-per-block[" << i << "]: " << blocks[i];
+
+ // If set, use internal value instead of global value
+ if(blocks[i]->is_set_max_noutput_items())
+ max_noutput_items = blocks[i]->max_noutput_items();
+
+ d_threads.create_thread(
+ gruel::thread_body_wrapper<tpb_container>(tpb_container(blocks[i], max_noutput_items),
+ name.str()));
+ }
+}
+
+gr_scheduler_tpb::~gr_scheduler_tpb()
+{
+ stop();
+}
+
+void
+gr_scheduler_tpb::stop()
+{
+ d_threads.interrupt_all();
+}
+
+void
+gr_scheduler_tpb::wait()
+{
+ d_threads.join_all();
+}
diff --git a/gnuradio-core/src/lib/runtime/gr_scheduler_tpb.h b/gnuradio-core/src/lib/runtime/gr_scheduler_tpb.h
new file mode 100644
index 000000000..a9b3abcfa
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_scheduler_tpb.h
@@ -0,0 +1,61 @@
+/* -*- 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 this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+#ifndef INCLUDED_GR_SCHEDULER_TPB_H
+#define INCLUDED_GR_SCHEDULER_TPB_H
+
+#include <gr_core_api.h>
+#include <gr_scheduler.h>
+#include <gruel/thread_group.h>
+
+/*!
+ * \brief Concrete scheduler that uses a kernel thread-per-block
+ */
+class GR_CORE_API gr_scheduler_tpb : public gr_scheduler
+{
+ gruel::thread_group d_threads;
+
+protected:
+ /*!
+ * \brief Construct a scheduler and begin evaluating the graph.
+ *
+ * The scheduler will continue running until all blocks until they
+ * report that they are done or the stop method is called.
+ */
+ gr_scheduler_tpb(gr_flat_flowgraph_sptr ffg, int max_noutput_items);
+
+public:
+ static gr_scheduler_sptr make(gr_flat_flowgraph_sptr ffg, int max_noutput_items=100000);
+
+ ~gr_scheduler_tpb();
+
+ /*!
+ * \brief Tell the scheduler to stop executing.
+ */
+ void stop();
+
+ /*!
+ * \brief Block until the graph is done.
+ */
+ void wait();
+};
+
+
+#endif /* INCLUDED_GR_SCHEDULER_TPB_H */
diff --git a/gnuradio-core/src/lib/runtime/gr_select_handler.cc b/gnuradio-core/src/lib/runtime/gr_select_handler.cc
new file mode 100644
index 000000000..0fc86354a
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_select_handler.cc
@@ -0,0 +1,36 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005 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 <gr_select_handler.h>
+
+gr_select_handler::gr_select_handler(int fd)
+ : d_fd(fd)
+{
+}
+
+gr_select_handler::~gr_select_handler()
+{
+}
diff --git a/gnuradio-core/src/lib/runtime/gr_select_handler.h b/gnuradio-core/src/lib/runtime/gr_select_handler.h
new file mode 100644
index 000000000..c4c359213
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_select_handler.h
@@ -0,0 +1,85 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005 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_SELECT_HANDLER_H
+#define INCLUDED_GR_SELECT_HANDLER_H
+
+#include <gr_core_api.h>
+#include <boost/shared_ptr.hpp>
+
+class gr_select_handler;
+typedef boost::shared_ptr<gr_select_handler> gr_select_handler_sptr;
+
+
+/*!
+ * \brief Abstract handler for select based notification.
+ * \ingroup base
+ *
+ * \sa gr_dispatcher
+ */
+class GR_CORE_API gr_select_handler
+{
+ int d_fd;
+
+protected:
+ gr_select_handler(int file_descriptor);
+
+public:
+ virtual ~gr_select_handler();
+
+ int fd() const { return d_fd; }
+ int file_descriptor() const { return d_fd; }
+
+ /*!
+ * \brief Called when file_descriptor is readable.
+ *
+ * Called when the dispatcher detects that file_descriptor can
+ * be read without blocking.
+ */
+ virtual void handle_read() = 0;
+
+ /*!
+ * \brief Called when file_descriptor is writable.
+ *
+ * Called when dispatcher detects that file descriptor can be
+ * written without blocking.
+ */
+ virtual void handle_write() = 0;
+
+ /*!
+ * Called each time around the dispatcher loop to determine whether
+ * this handler's file descriptor should be added to the list on which
+ * read events can occur. The default method returns true, indicating
+ * that by default, all handlers are interested in read events.
+ */
+ virtual bool readable() { return true; }
+
+ /*!
+ * Called each time around the dispatcher loop to determine whether
+ * this handler's file descriptor should be added to the list on which
+ * write events can occur. The default method returns true, indicating
+ * that by default, all handlers are interested in write events.
+ */
+ virtual bool writable() { return true; }
+};
+
+#endif /* INCLUDED_GR_SELECT_HANDLER_H */
diff --git a/gnuradio-core/src/lib/runtime/gr_single_threaded_scheduler.cc b/gnuradio-core/src/lib/runtime/gr_single_threaded_scheduler.cc
new file mode 100644
index 000000000..1bb9e9b0a
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_single_threaded_scheduler.cc
@@ -0,0 +1,364 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_single_threaded_scheduler.h>
+#include <gr_block.h>
+#include <gr_block_detail.h>
+#include <gr_buffer.h>
+#include <boost/thread.hpp>
+#include <boost/format.hpp>
+#include <iostream>
+#include <limits>
+#include <assert.h>
+#include <stdio.h>
+
+// must be defined to either 0 or 1
+#define ENABLE_LOGGING 0
+
+#if (ENABLE_LOGGING)
+#define LOG(x) do { x; } while(0)
+#else
+#define LOG(x) do {;} while(0)
+#endif
+
+static int which_scheduler = 0;
+
+gr_single_threaded_scheduler_sptr
+gr_make_single_threaded_scheduler (const std::vector<gr_block_sptr> &blocks)
+{
+ return
+ gr_single_threaded_scheduler_sptr (new gr_single_threaded_scheduler (blocks));
+}
+
+gr_single_threaded_scheduler::gr_single_threaded_scheduler (
+ const std::vector<gr_block_sptr> &blocks)
+ : d_blocks (blocks), d_enabled (true), d_log(0)
+{
+ if (ENABLE_LOGGING){
+ std::string name = str(boost::format("sst-%d.log") % which_scheduler++);
+ d_log = new std::ofstream(name.c_str());
+ *d_log << "gr_single_threaded_scheduler: "
+ << d_blocks.size ()
+ << " blocks\n";
+ }
+}
+
+gr_single_threaded_scheduler::~gr_single_threaded_scheduler ()
+{
+ if (ENABLE_LOGGING)
+ delete d_log;
+}
+
+void
+gr_single_threaded_scheduler::run ()
+{
+ // d_enabled = true; // KLUDGE
+ main_loop ();
+}
+
+void
+gr_single_threaded_scheduler::stop ()
+{
+ if (0)
+ std::cout << "gr_singled_threaded_scheduler::stop() "
+ << this << std::endl;
+ d_enabled = false;
+}
+
+inline static unsigned int
+round_up (unsigned int n, unsigned int multiple)
+{
+ return ((n + multiple - 1) / multiple) * multiple;
+}
+
+inline static unsigned int
+round_down (unsigned int n, unsigned int multiple)
+{
+ return (n / multiple) * multiple;
+}
+
+//
+// Return minimum available write space in all our downstream buffers
+// or -1 if we're output blocked and the output we're blocked
+// on is done.
+//
+static int
+min_available_space (gr_block_detail *d, int output_multiple)
+{
+ int min_space = std::numeric_limits<int>::max();
+
+ for (int i = 0; i < d->noutputs (); i++){
+ int n = round_down (d->output(i)->space_available (), output_multiple);
+ if (n == 0){ // We're blocked on output.
+ if (d->output(i)->done()){ // Downstream is done, therefore we're done.
+ return -1;
+ }
+ return 0;
+ }
+ min_space = std::min (min_space, n);
+ }
+ return min_space;
+}
+
+void
+gr_single_threaded_scheduler::main_loop ()
+{
+ static const int DEFAULT_CAPACITY = 16;
+
+ int noutput_items;
+ gr_vector_int ninput_items_required (DEFAULT_CAPACITY);
+ gr_vector_int ninput_items (DEFAULT_CAPACITY);
+ gr_vector_const_void_star input_items (DEFAULT_CAPACITY);
+ gr_vector_void_star output_items (DEFAULT_CAPACITY);
+ unsigned int bi;
+ unsigned int nalive;
+ int max_items_avail;
+ bool made_progress_last_pass;
+ bool making_progress;
+
+ for (unsigned i = 0; i < d_blocks.size (); i++)
+ d_blocks[i]->detail()->set_done (false); // reset any done flags
+
+ for (unsigned i = 0; i < d_blocks.size (); i++) // enable any drivers, etc.
+ d_blocks[i]->start();
+
+
+ bi = 0;
+ made_progress_last_pass = true;
+ making_progress = false;
+
+ // Loop while there are still blocks alive
+
+ nalive = d_blocks.size ();
+ while (d_enabled && nalive > 0){
+
+ if (boost::this_thread::interruption_requested())
+ break;
+
+ gr_block *m = d_blocks[bi].get ();
+ gr_block_detail *d = m->detail().get ();
+
+ LOG(*d_log << std::endl << m);
+
+ if (d->done ())
+ goto next_block;
+
+ if (d->source_p ()){
+ // Invoke sources as a last resort. As long as the previous pass
+ // made progress, don't call a source.
+ if (made_progress_last_pass){
+ LOG(*d_log << " Skipping source\n");
+ goto next_block;
+ }
+
+ ninput_items_required.resize (0);
+ ninput_items.resize (0);
+ input_items.resize (0);
+ output_items.resize (d->noutputs ());
+
+ // determine the minimum available output space
+ noutput_items = min_available_space (d, m->output_multiple ());
+ LOG(*d_log << " source\n noutput_items = " << noutput_items << std::endl);
+ if (noutput_items == -1) // we're done
+ goto were_done;
+
+ if (noutput_items == 0){ // we're output blocked
+ LOG(*d_log << " BLKD_OUT\n");
+ goto next_block;
+ }
+
+ goto setup_call_to_work; // jump to common code
+ }
+
+ else if (d->sink_p ()){
+ ninput_items_required.resize (d->ninputs ());
+ ninput_items.resize (d->ninputs ());
+ input_items.resize (d->ninputs ());
+ output_items.resize (0);
+ LOG(*d_log << " sink\n");
+
+ max_items_avail = 0;
+ for (int i = 0; i < d->ninputs (); i++){
+ ninput_items[i] = d->input(i)->items_available();
+ //if (ninput_items[i] == 0 && d->input(i)->done())
+ if (ninput_items[i] < m->output_multiple() && d->input(i)->done())
+ goto were_done;
+
+ max_items_avail = std::max (max_items_avail, ninput_items[i]);
+ }
+
+ // take a swag at how much output we can sink
+ noutput_items = (int) (max_items_avail * m->relative_rate ());
+ noutput_items = round_down (noutput_items, m->output_multiple ());
+ LOG(*d_log << " max_items_avail = " << max_items_avail << std::endl);
+ LOG(*d_log << " noutput_items = " << noutput_items << std::endl);
+
+ if (noutput_items == 0){ // we're blocked on input
+ LOG(*d_log << " BLKD_IN\n");
+ goto next_block;
+ }
+
+ goto try_again; // Jump to code shared with regular case.
+ }
+
+ else {
+ // do the regular thing
+ ninput_items_required.resize (d->ninputs ());
+ ninput_items.resize (d->ninputs ());
+ input_items.resize (d->ninputs ());
+ output_items.resize (d->noutputs ());
+
+ max_items_avail = 0;
+ for (int i = 0; i < d->ninputs (); i++){
+ ninput_items[i] = d->input(i)->items_available ();
+ max_items_avail = std::max (max_items_avail, ninput_items[i]);
+ }
+
+ // determine the minimum available output space
+ noutput_items = min_available_space (d, m->output_multiple ());
+ if (ENABLE_LOGGING){
+ *d_log << " regular ";
+ if (m->relative_rate() >= 1.0)
+ *d_log << "1:" << m->relative_rate() << std::endl;
+ else
+ *d_log << 1.0/m->relative_rate() << ":1\n";
+ *d_log << " max_items_avail = " << max_items_avail << std::endl;
+ *d_log << " noutput_items = " << noutput_items << std::endl;
+ }
+ if (noutput_items == -1) // we're done
+ goto were_done;
+
+ if (noutput_items == 0){ // we're output blocked
+ LOG(*d_log << " BLKD_OUT\n");
+ goto next_block;
+ }
+
+#if 0
+ // Compute best estimate of noutput_items that we can really use.
+ noutput_items =
+ std::min ((unsigned) noutput_items,
+ std::max ((unsigned) m->output_multiple(),
+ round_up ((unsigned) (max_items_avail * m->relative_rate()),
+ m->output_multiple ())));
+
+ LOG(*d_log << " revised noutput_items = " << noutput_items << std::endl);
+#endif
+
+ try_again:
+ if (m->fixed_rate()){
+ // try to work it forward starting with max_items_avail.
+ // We want to try to consume all the input we've got.
+ int reqd_noutput_items = m->fixed_rate_ninput_to_noutput(max_items_avail);
+ reqd_noutput_items = round_up(reqd_noutput_items, m->output_multiple());
+ if (reqd_noutput_items > 0 && reqd_noutput_items <= noutput_items)
+ noutput_items = reqd_noutput_items;
+ }
+
+ // ask the block how much input they need to produce noutput_items
+ m->forecast (noutput_items, ninput_items_required);
+
+ // See if we've got sufficient input available
+
+ int i;
+ for (i = 0; i < d->ninputs (); i++)
+ if (ninput_items_required[i] > ninput_items[i]) // not enough
+ break;
+
+ if (i < d->ninputs ()){ // not enough input on input[i]
+ // if we can, try reducing the size of our output request
+ if (noutput_items > m->output_multiple ()){
+ noutput_items /= 2;
+ noutput_items = round_up (noutput_items, m->output_multiple ());
+ goto try_again;
+ }
+
+ // We're blocked on input
+ LOG(*d_log << " BLKD_IN\n");
+ if (d->input(i)->done()) // If the upstream block is done, we're done
+ goto were_done;
+
+ // Is it possible to ever fulfill this request?
+ if (ninput_items_required[i] > d->input(i)->max_possible_items_available ()){
+ // Nope, never going to happen...
+ std::cerr << "\nsched: <gr_block " << m->name()
+ << " (" << m->unique_id() << ")>"
+ << " is requesting more input data\n"
+ << " than we can provide.\n"
+ << " ninput_items_required = "
+ << ninput_items_required[i] << "\n"
+ << " max_possible_items_available = "
+ << d->input(i)->max_possible_items_available() << "\n"
+ << " If this is a filter, consider reducing the number of taps.\n";
+ goto were_done;
+ }
+
+ goto next_block;
+ }
+
+ // We've got enough data on each input to produce noutput_items.
+ // Finish setting up the call to work.
+
+ for (int i = 0; i < d->ninputs (); i++)
+ input_items[i] = d->input(i)->read_pointer();
+
+ setup_call_to_work:
+
+ for (int i = 0; i < d->noutputs (); i++)
+ output_items[i] = d->output(i)->write_pointer();
+
+ // Do the actual work of the block
+ int n = m->general_work (noutput_items, ninput_items,
+ input_items, output_items);
+ LOG(*d_log << " general_work: noutput_items = " << noutput_items
+ << " result = " << n << std::endl);
+
+ if (n == -1) // block is done
+ goto were_done;
+
+ d->produce_each (n); // advance write pointers
+ if (n > 0)
+ making_progress = true;
+
+ goto next_block;
+ }
+ assert (0);
+
+ were_done:
+ LOG(*d_log << " were_done\n");
+ d->set_done (true);
+ nalive--;
+
+ next_block:
+ if (++bi >= d_blocks.size ()){
+ bi = 0;
+ made_progress_last_pass = making_progress;
+ making_progress = false;
+ }
+ }
+
+ for (unsigned i = 0; i < d_blocks.size (); i++) // disable any drivers, etc.
+ d_blocks[i]->stop();
+}
diff --git a/gnuradio-core/src/lib/runtime/gr_single_threaded_scheduler.h b/gnuradio-core/src/lib/runtime/gr_single_threaded_scheduler.h
new file mode 100644
index 000000000..3a95c7194
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_single_threaded_scheduler.h
@@ -0,0 +1,62 @@
+/* -*- 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_SINGLE_THREADED_SCHEDULER_H
+#define INCLUDED_GR_SINGLE_THREADED_SCHEDULER_H
+
+#include <gr_core_api.h>
+#include <gr_runtime_types.h>
+#include <fstream>
+
+class gr_single_threaded_scheduler;
+typedef boost::shared_ptr<gr_single_threaded_scheduler> gr_single_threaded_scheduler_sptr;
+
+
+/*!
+ * \brief Simple scheduler for stream computations.
+ * \ingroup internal
+ */
+
+class GR_CORE_API gr_single_threaded_scheduler {
+ public:
+ ~gr_single_threaded_scheduler ();
+
+ void run ();
+ void stop ();
+
+ private:
+ const std::vector<gr_block_sptr> d_blocks;
+ volatile bool d_enabled;
+ std::ofstream *d_log;
+
+ gr_single_threaded_scheduler (const std::vector<gr_block_sptr> &blocks);
+
+ void main_loop ();
+
+ friend GR_CORE_API gr_single_threaded_scheduler_sptr
+ gr_make_single_threaded_scheduler (const std::vector<gr_block_sptr> &blocks);
+};
+
+GR_CORE_API gr_single_threaded_scheduler_sptr
+gr_make_single_threaded_scheduler (const std::vector<gr_block_sptr> &blocks);
+
+#endif /* INCLUDED_GR_SINGLE_THREADED_SCHEDULER_H */
diff --git a/gnuradio-core/src/lib/runtime/gr_single_threaded_scheduler.i b/gnuradio-core/src/lib/runtime/gr_single_threaded_scheduler.i
new file mode 100644
index 000000000..7305cc9ad
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_single_threaded_scheduler.i
@@ -0,0 +1,54 @@
+/* -*- 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_runtime.h>
+
+class gr_single_threaded_scheduler;
+typedef boost::shared_ptr<gr_single_threaded_scheduler> gr_single_threaded_scheduler_sptr;
+%template(gr_single_threaded_scheduler_sptr) boost::shared_ptr<gr_single_threaded_scheduler>;
+%rename(single_threaded_scheduler) gr_make_single_threaded_scheduler;
+%ignore gr_single_threaded_scheduler;
+
+gr_single_threaded_scheduler_sptr
+gr_make_single_threaded_scheduler (const std::vector<gr_block_sptr> &modules);
+
+class gr_single_threaded_scheduler {
+ public:
+ ~gr_single_threaded_scheduler ();
+
+ // void run ();
+ void stop ();
+
+ private:
+ gr_single_threaded_scheduler (const std::vector<gr_block_sptr> &modules);
+};
+
+#ifdef SWIGPYTHON
+%inline %{
+ void sts_pyrun (gr_single_threaded_scheduler_sptr s) {
+ Py_BEGIN_ALLOW_THREADS; // release global interpreter lock
+ s->run ();
+ Py_END_ALLOW_THREADS; // acquire global interpreter lock
+ }
+%}
+#endif
+
diff --git a/gnuradio-core/src/lib/runtime/gr_sptr_magic.cc b/gnuradio-core/src/lib/runtime/gr_sptr_magic.cc
new file mode 100644
index 000000000..7fdadf24a
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_sptr_magic.cc
@@ -0,0 +1,72 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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 this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <gr_sptr_magic.h>
+#include <gr_hier_block2.h>
+#include <map>
+#include <stdexcept>
+
+
+#include <gruel/thread.h>
+
+namespace gnuradio {
+
+ static gruel::mutex s_mutex;
+ typedef std::map<gr_basic_block*, gr_basic_block_sptr> sptr_map;
+ static sptr_map s_map;
+
+ void
+ detail::sptr_magic::create_and_stash_initial_sptr(gr_hier_block2 *p)
+ {
+ gr_basic_block_sptr sptr(p);
+ gruel::scoped_lock guard(s_mutex);
+ s_map.insert(sptr_map::value_type(static_cast<gr_basic_block *>(p), sptr));
+ }
+
+
+ gr_basic_block_sptr
+ detail::sptr_magic::fetch_initial_sptr(gr_basic_block *p)
+ {
+ /*
+ * If p isn't a subclass of gr_hier_block2, just create the
+ * shared ptr and return it.
+ */
+ gr_hier_block2 *hb2 = dynamic_cast<gr_hier_block2 *>(p);
+ if (!hb2){
+ return gr_basic_block_sptr(p);
+ }
+
+ /*
+ * p is a subclass of gr_hier_block2, thus we've already created the shared pointer
+ * and stashed it away. Fish it out and return it.
+ */
+ gruel::scoped_lock guard(s_mutex);
+ sptr_map::iterator pos = s_map.find(static_cast<gr_basic_block *>(p));
+ if (pos == s_map.end())
+ throw std::invalid_argument("gr_sptr_magic: invalid pointer!");
+
+ gr_basic_block_sptr sptr = pos->second;
+ s_map.erase(pos);
+ return sptr;
+ }
+};
diff --git a/gnuradio-core/src/lib/runtime/gr_sptr_magic.h b/gnuradio-core/src/lib/runtime/gr_sptr_magic.h
new file mode 100644
index 000000000..d9c7f26c4
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_sptr_magic.h
@@ -0,0 +1,52 @@
+/* -*- 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 this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+#ifndef INCLUDED_GR_SPTR_MAGIC_H
+#define INCLUDED_GR_SPTR_MAGIC_H
+
+#include <gr_core_api.h>
+#include <boost/shared_ptr.hpp>
+
+class gr_basic_block;
+class gr_hier_block2;
+
+namespace gnuradio {
+
+ namespace detail {
+
+ class GR_CORE_API sptr_magic {
+ public:
+ static boost::shared_ptr<gr_basic_block> fetch_initial_sptr(gr_basic_block *p);
+ static void create_and_stash_initial_sptr(gr_hier_block2 *p);
+ };
+ };
+
+ /*
+ * \brief New! Improved! Standard method to get/create the boost::shared_ptr for a block.
+ */
+ template<class T>
+ boost::shared_ptr<T>
+ get_initial_sptr(T *p)
+ {
+ return boost::shared_ptr<T>(p);//return boost::dynamic_pointer_cast<T, gr_basic_block>(detail::sptr_magic::fetch_initial_sptr(p));
+ }
+};
+
+#endif /* INCLUDED_GR_SPTR_MAGIC_H */
diff --git a/gnuradio-core/src/lib/runtime/gr_sync_block.cc b/gnuradio-core/src/lib/runtime/gr_sync_block.cc
new file mode 100644
index 000000000..3c79e630d
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_sync_block.cc
@@ -0,0 +1,55 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_sync_block.h>
+
+gr_sync_block::gr_sync_block(void)
+{
+ //NOP
+}
+
+gr_sync_block::gr_sync_block(
+ const std::string &name,
+ gr_io_signature_sptr input_signature,
+ gr_io_signature_sptr output_signature
+):
+ gr_block(name, input_signature, output_signature)
+{
+ this->set_fixed_rate(true);
+}
+
+gr_sync_block::~gr_sync_block(void)
+{
+ //NOP
+}
+
+int gr_sync_block::work(
+ int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items
+){
+ throw std::runtime_error("gr_block subclasses must overload general_work!");
+}
diff --git a/gnuradio-core/src/lib/runtime/gr_sync_block.h b/gnuradio-core/src/lib/runtime/gr_sync_block.h
new file mode 100644
index 000000000..0f3daccf2
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_sync_block.h
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2012-2013 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_GNURADIO_GR_SYNC_BLOCK_H
+#define INCLUDED_GNURADIO_GR_SYNC_BLOCK_H
+
+#include <gr_block.h>
+
+struct GR_CORE_API gr_sync_block : public gr_block
+{
+ gr_sync_block(void);
+
+ gr_sync_block(
+ const std::string &name,
+ gr_io_signature_sptr input_signature,
+ gr_io_signature_sptr output_signature
+ );
+
+ virtual ~gr_sync_block(void);
+
+ //! implements work -> calls work
+ int general_work(
+ int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items
+ );
+
+ /*!
+ * \brief just like gr_block::general_work, only this arranges to call consume_each for you
+ *
+ * The user must override work to define the signal processing code
+ */
+ virtual int work(
+ int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items
+ );
+
+};
+
+GRAS_FORCE_INLINE int gr_sync_block::general_work(
+ int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items
+){
+ const int work_ret = this->work(noutput_items, input_items, output_items);
+ if (work_ret > 0)
+ {
+ this->consume_each((decimation()*size_t(work_ret))/interpolation());
+ }
+ return work_ret;
+}
+
+#endif /*INCLUDED_GNURADIO_GR_SYNC_BLOCK_H*/
diff --git a/gnuradio-core/src/lib/runtime/gr_sync_block.i b/gnuradio-core/src/lib/runtime/gr_sync_block.i
new file mode 100644
index 000000000..d3e1bb957
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_sync_block.i
@@ -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.
+ */
+class gr_sync_block : public gr_block
+{
+ protected:
+
+ gr_sync_block (const std::string &name,
+ gr_io_signature_sptr input_signature,
+ gr_io_signature_sptr output_signature);
+};
diff --git a/gnuradio-core/src/lib/runtime/gr_sync_decimator.cc b/gnuradio-core/src/lib/runtime/gr_sync_decimator.cc
new file mode 100644
index 000000000..a39c53b09
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_sync_decimator.cc
@@ -0,0 +1,48 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_sync_decimator.h>
+
+gr_sync_decimator::gr_sync_decimator(void)
+{
+ //NOP
+}
+
+gr_sync_decimator::gr_sync_decimator(
+ const std::string &name,
+ gr_io_signature_sptr input_signature,
+ gr_io_signature_sptr output_signature,
+ const size_t decim_rate
+):
+ gr_sync_block(name, input_signature, output_signature)
+{
+ this->set_decimation(decim_rate);
+}
+
+gr_sync_decimator::~gr_sync_decimator(void)
+{
+ //NOP
+}
diff --git a/gnuradio-core/src/lib/runtime/gr_sync_decimator.h b/gnuradio-core/src/lib/runtime/gr_sync_decimator.h
new file mode 100644
index 000000000..32edfd78e
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_sync_decimator.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2012-2013 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_GNURADIO_GR_SYNC_DECIMATOR_H
+#define INCLUDED_GNURADIO_GR_SYNC_DECIMATOR_H
+
+#include <gr_sync_block.h>
+
+struct GR_CORE_API gr_sync_decimator : gr_sync_block
+{
+
+ gr_sync_decimator(void);
+
+ gr_sync_decimator(
+ const std::string &name,
+ gr_io_signature_sptr input_signature,
+ gr_io_signature_sptr output_signature,
+ const size_t decim_rate
+ );
+
+ virtual ~gr_sync_decimator(void);
+
+};
+
+#endif /*INCLUDED_GNURADIO_GR_SYNC_DECIMATOR_H*/
diff --git a/gnuradio-core/src/lib/runtime/gr_sync_decimator.i b/gnuradio-core/src/lib/runtime/gr_sync_decimator.i
new file mode 100644
index 000000000..af4574b19
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_sync_decimator.i
@@ -0,0 +1,31 @@
+/* -*- 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.
+ */
+
+class gr_sync_decimator : public gr_sync_block
+{
+ protected:
+
+ gr_sync_decimator (const std::string &name,
+ gr_io_signature_sptr input_signature,
+ gr_io_signature_sptr output_signature,
+ unsigned decimation);
+};
diff --git a/gnuradio-core/src/lib/runtime/gr_sync_interpolator.cc b/gnuradio-core/src/lib/runtime/gr_sync_interpolator.cc
new file mode 100644
index 000000000..17f60e613
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_sync_interpolator.cc
@@ -0,0 +1,48 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_sync_interpolator.h>
+
+gr_sync_interpolator::gr_sync_interpolator(void)
+{
+ //NOP
+}
+
+gr_sync_interpolator::gr_sync_interpolator(
+ const std::string &name,
+ gr_io_signature_sptr input_signature,
+ gr_io_signature_sptr output_signature,
+ const size_t interp_rate
+):
+ gr_sync_block(name, input_signature, output_signature)
+{
+ this->set_interpolation(interp_rate);
+}
+
+gr_sync_interpolator::~gr_sync_interpolator(void)
+{
+ //NOP
+}
diff --git a/gnuradio-core/src/lib/runtime/gr_sync_interpolator.h b/gnuradio-core/src/lib/runtime/gr_sync_interpolator.h
new file mode 100644
index 000000000..81c17c18e
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_sync_interpolator.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2012-2013 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_GNURADIO_GR_SYNC_INTERPOLATOR_H
+#define INCLUDED_GNURADIO_GR_SYNC_INTERPOLATOR_H
+
+#include <gr_sync_block.h>
+
+struct GR_CORE_API gr_sync_interpolator : gr_sync_block
+{
+
+ gr_sync_interpolator(void);
+
+ gr_sync_interpolator(
+ const std::string &name,
+ gr_io_signature_sptr input_signature,
+ gr_io_signature_sptr output_signature,
+ const size_t interp_rate
+ );
+
+ virtual ~gr_sync_interpolator(void);
+
+};
+
+#endif /*INCLUDED_GNURADIO_GR_SYNC_INTERPOLATOR_H*/
diff --git a/gnuradio-core/src/lib/runtime/gr_sync_interpolator.i b/gnuradio-core/src/lib/runtime/gr_sync_interpolator.i
new file mode 100644
index 000000000..6f8b08252
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_sync_interpolator.i
@@ -0,0 +1,31 @@
+/* -*- 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.
+ */
+
+class gr_sync_interpolator : public gr_sync_block
+{
+ protected:
+
+ gr_sync_interpolator (const std::string &name,
+ gr_io_signature_sptr input_signature,
+ gr_io_signature_sptr output_signature,
+ unsigned interpolation);
+};
diff --git a/gnuradio-core/src/lib/runtime/gr_sys_paths.cc b/gnuradio-core/src/lib/runtime/gr_sys_paths.cc
new file mode 100644
index 000000000..b4918af33
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_sys_paths.cc
@@ -0,0 +1,55 @@
+/*
+ * Copyright 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.
+ */
+
+#include <gr_sys_paths.h>
+#include <cstdlib> //getenv
+#include <cstdio> //P_tmpdir (maybe)
+
+const char *gr_tmp_path(){
+ const char *path;
+
+ //first case, try TMP environment variable
+ path = getenv("TMP");
+ if (path) return path;
+
+ //second case, try P_tmpdir when its defined
+ #ifdef P_tmpdir
+ if (P_tmpdir) return P_tmpdir;
+ #endif /*P_tmpdir*/
+
+ //fall-through case, nothing worked
+ return "/tmp";
+}
+
+const char *gr_appdata_path(){
+ const char *path;
+
+ //first case, try HOME environment variable (unix)
+ path = getenv("HOME");
+ if (path) return path;
+
+ //second case, try APPDATA environment variable (windows)
+ path = getenv("APPDATA");
+ if (path) return path;
+
+ //fall-through case, nothing worked
+ return gr_tmp_path();
+}
diff --git a/gnuradio-core/src/lib/runtime/gr_sys_paths.h b/gnuradio-core/src/lib/runtime/gr_sys_paths.h
new file mode 100644
index 000000000..bd51ebdf9
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_sys_paths.h
@@ -0,0 +1,33 @@
+/*
+ * Copyright 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.
+ */
+
+#ifndef _GR_SYS_PATHS_H_
+#define _GR_SYS_PATHS_H_
+
+#include <gr_core_api.h>
+
+//! directory to create temporary files
+GR_CORE_API const char *gr_tmp_path();
+
+//! directory to store application data
+GR_CORE_API const char *gr_appdata_path();
+
+#endif /* _GR_SYS_PATHS_H_ */
diff --git a/gnuradio-core/src/lib/runtime/gr_tags.h b/gnuradio-core/src/lib/runtime/gr_tags.h
new file mode 100644
index 000000000..a9ca90235
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_tags.h
@@ -0,0 +1,55 @@
+/*
+ * Copyright 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.
+ */
+
+#ifndef INCLUDED_GR_TAGS_H
+#define INCLUDED_GR_TAGS_H
+
+#include <gr_core_api.h>
+#include <gruel/pmt.h>
+
+struct GR_CORE_API gr_tag_t{
+
+ //! the item \p tag occurred at (as a uint64_t)
+ uint64_t offset;
+
+ //! the key of \p tag (as a PMT symbol)
+ pmt::pmt_t key;
+
+ //! the value of \p tag (as a PMT)
+ pmt::pmt_t value;
+
+ //! the source ID of \p tag (as a PMT)
+ pmt::pmt_t srcid;
+
+ //! Comparison function to test which tag, \p x or \p y, came first in time
+ static inline bool offset_compare(
+ const gr_tag_t &x, const gr_tag_t &y
+ ){
+ return x.offset < y.offset;
+ }
+
+ inline bool operator == (const gr_tag_t &t) const
+ {
+ return (t.key == key) && (t.value == value) && (t.srcid == srcid) && (t.offset == offset);
+ }
+};
+
+#endif /*INCLUDED_GR_TAGS_H*/
diff --git a/gnuradio-core/src/lib/runtime/gr_tags.i b/gnuradio-core/src/lib/runtime/gr_tags.i
new file mode 100644
index 000000000..f2ee69ce8
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_tags.i
@@ -0,0 +1,32 @@
+/*
+ * Copyright 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.
+ */
+
+%{
+#include <gr_tags.h>
+%}
+
+%import <pmt_swig.i> //for pmt support
+
+%include <gr_tags.h>
+
+//gives support for a vector of tags (get tags in range)
+%include "std_vector.i"
+%template(tags_vector_t) std::vector<gr_tag_t>;
diff --git a/gnuradio-core/src/lib/runtime/gr_timer.h b/gnuradio-core/src/lib/runtime/gr_timer.h
new file mode 100644
index 000000000..e0b4cc437
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_timer.h
@@ -0,0 +1,84 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005 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_TIMER_H
+#define INCLUDED_GR_TIMER_H
+
+#include <gr_core_api.h>
+#include <gr_types.h>
+
+class gr_timer;
+
+typedef boost::shared_ptr<gr_timer> gr_timer_sptr;
+
+GR_CORE_API typedef void (*gr_timer_hook)(gr_timer *, void *);
+
+/*!
+ * \brief create a timeout.
+ *
+ * \ingroup misc
+ * gr_timer_hook is called when timer fires.
+ */
+GR_CORE_API gr_timer_sptr gr_make_timer (gr_timer_hook, void *);
+
+/*!
+ * \brief implement timeouts
+ */
+class GR_CORE_API gr_timer {
+ double d_expiry;
+ double d_period;
+ gr_timer_hook d_hook;
+ void *d_hook_arg;
+
+ friend GR_CORE_API gr_timer_sptr gr_make_timer (gr_timer_hook, void *);
+
+ gr_timer (...);
+
+public:
+ ~gr_timer ();
+
+ //! return absolute current time (seconds since the epoc).
+ static double now ();
+
+ /*!
+ * \brief schedule timer to fire at abs_when
+ * \param abs_when absolute time in seconds since the epoc.
+ */
+ void schedule_at (double abs_when);
+
+ /*!
+ * \brief schedule timer to fire rel_when seconds from now.
+ * \param rel_when relative time in seconds from now.
+ */
+ void schedule_after (double rel_when); // relative time in seconds
+
+ /*!
+ * \brief schedule a periodic timeout.
+ * \param abs_when absolute time to fire first time
+ * \param period time between firings
+ */
+ void schedule_periodic (double abs_when, double period);
+
+ //! cancel timer
+ void unschedule ();
+};
+
+#endif /* INCLUDED_GR_TIMER_H */
diff --git a/gnuradio-core/src/lib/runtime/gr_top_block.cc b/gnuradio-core/src/lib/runtime/gr_top_block.cc
new file mode 100644
index 000000000..fa090b4ef
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_top_block.cc
@@ -0,0 +1,95 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <unistd.h>
+#include <gr_top_block.h>
+#include <boost/detail/atomic_count.hpp>
+
+static boost::detail::atomic_count unique_id_pool(0);
+
+gr_top_block::gr_top_block(void):
+ //cannot make a null top block, use name constructor
+ gras::TopBlock("top"),
+ _unique_id(++unique_id_pool),
+ _name("top")
+{
+ //NOP
+}
+
+gr_top_block::gr_top_block(const std::string &name):
+ gras::TopBlock(name),
+ _unique_id(++unique_id_pool),
+ _name(name)
+{
+ //NOP
+}
+
+gr_top_block_sptr gr_make_top_block(const std::string &name)
+{
+ return gr_top_block_sptr(new gr_top_block(name));
+}
+
+void gr_top_block::start(const size_t max_items)
+{
+ this->set_max_noutput_items(max_items);
+ this->start();
+}
+
+void gr_top_block::run(const size_t max_items)
+{
+ this->set_max_noutput_items(max_items);
+ this->run();
+}
+
+int gr_top_block::max_noutput_items(void) const
+{
+ return this->global_config().maximum_output_items;
+}
+
+void gr_top_block::set_max_noutput_items(int max_items)
+{
+ this->global_config().maximum_output_items = max_items;
+}
+
+void gr_top_block::run(void)
+{
+ gras::TopBlock::run();
+}
+
+void gr_top_block::start(void)
+{
+ gras::TopBlock::start();
+}
+
+void gr_top_block::stop(void)
+{
+ gras::TopBlock::stop();
+}
+
+void gr_top_block::wait(void)
+{
+ gras::TopBlock::wait();
+}
diff --git a/gnuradio-core/src/lib/runtime/gr_top_block.h b/gnuradio-core/src/lib/runtime/gr_top_block.h
new file mode 100644
index 000000000..4e4becd1f
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_top_block.h
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2012-2013 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_GNURADIO_GR_TOP_BLOCK_H
+#define INCLUDED_GNURADIO_GR_TOP_BLOCK_H
+
+#include <gr_core_api.h>
+#include <gras/top_block.hpp>
+#include <gr_hier_block2.h>
+
+struct GR_CORE_API gr_top_block : gras::TopBlock
+{
+
+ gr_top_block(void);
+
+ gr_top_block(const std::string &name);
+
+ long unique_id(void) const{return _unique_id;}
+ std::string name(void) const{return _name;}
+ long _unique_id;
+ std::string _name;
+
+ void start(const size_t max_items);
+
+ void run(const size_t max_items);
+
+ int max_noutput_items(void) const;
+
+ void set_max_noutput_items(int max_items);
+
+ void run(void);
+
+ virtual void start(void);
+
+ virtual void stop(void);
+
+ virtual void wait(void);
+
+ inline void lock(void){}
+
+ inline void unlock(void){this->commit();}
+
+};
+
+typedef boost::shared_ptr<gr_top_block> gr_top_block_sptr;
+
+GR_CORE_API gr_top_block_sptr gr_make_top_block(const std::string &name);
+
+#endif /*INCLUDED_GNURADIO_GR_TOP_BLOCK_H*/
diff --git a/gnuradio-core/src/lib/runtime/gr_top_block.i b/gnuradio-core/src/lib/runtime/gr_top_block.i
new file mode 100644
index 000000000..6ae4c65a9
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_top_block.i
@@ -0,0 +1,73 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007,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.
+ */
+
+class gr_top_block;
+typedef boost::shared_ptr<gr_top_block> gr_top_block_sptr;
+%template(gr_top_block_sptr) boost::shared_ptr<gr_top_block>;
+
+// Hack to have a Python shim implementation of gr.top_block
+// that instantiates one of these and passes through calls
+%rename(top_block_swig) gr_make_top_block;
+gr_top_block_sptr gr_make_top_block(const std::string name)
+ throw (std::logic_error);
+
+class gr_top_block : public gr_hier_block2
+{
+private:
+ gr_top_block(const std::string &name);
+
+public:
+ ~gr_top_block();
+
+ void start(int max_noutput_items=100000) throw (std::runtime_error);
+ void stop();
+ //void wait();
+ //void run() throw (std::runtime_error);
+ void lock();
+ void unlock() throw (std::runtime_error);
+ void dump();
+
+ int max_noutput_items();
+ void set_max_noutput_items(int nmax);
+
+ gr_top_block_sptr to_top_block(); // Needed for Python type coercion
+};
+
+#ifdef SWIGPYTHON
+
+%inline %{
+void top_block_run_unlocked(gr_top_block_sptr r) throw (std::runtime_error)
+{
+ Py_BEGIN_ALLOW_THREADS; // release global interpreter lock
+ r->run();
+ Py_END_ALLOW_THREADS; // acquire global interpreter lock
+}
+
+void top_block_wait_unlocked(gr_top_block_sptr r) throw (std::runtime_error)
+{
+ Py_BEGIN_ALLOW_THREADS; // release global interpreter lock
+ r->wait();
+ Py_END_ALLOW_THREADS; // acquire global interpreter lock
+}
+%}
+
+#endif
diff --git a/gnuradio-core/src/lib/runtime/gr_top_block_impl.cc b/gnuradio-core/src/lib/runtime/gr_top_block_impl.cc
new file mode 100644
index 000000000..4a3694163
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_top_block_impl.cc
@@ -0,0 +1,195 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_top_block.h>
+#include <gr_top_block_impl.h>
+#include <gr_flat_flowgraph.h>
+#include <gr_scheduler_sts.h>
+#include <gr_scheduler_tpb.h>
+
+#include <stdexcept>
+#include <iostream>
+#include <string.h>
+#include <unistd.h>
+#include <stdlib.h>
+
+#define GR_TOP_BLOCK_IMPL_DEBUG 0
+
+
+typedef gr_scheduler_sptr (*scheduler_maker)(gr_flat_flowgraph_sptr ffg,
+ int max_noutput_items);
+
+static struct scheduler_table {
+ const char *name;
+ scheduler_maker f;
+} scheduler_table[] = {
+ { "TPB", gr_scheduler_tpb::make }, // first entry is default
+ { "STS", gr_scheduler_sts::make }
+};
+
+static gr_scheduler_sptr
+make_scheduler(gr_flat_flowgraph_sptr ffg, int max_noutput_items)
+{
+ static scheduler_maker factory = 0;
+
+ if (factory == 0){
+ char *v = getenv("GR_SCHEDULER");
+ if (!v)
+ factory = scheduler_table[0].f; // use default
+ else {
+ for (size_t i = 0; i < sizeof(scheduler_table)/sizeof(scheduler_table[0]); i++){
+ if (strcmp(v, scheduler_table[i].name) == 0){
+ factory = scheduler_table[i].f;
+ break;
+ }
+ }
+ if (factory == 0){
+ std::cerr << "warning: Invalid GR_SCHEDULER environment variable value \""
+ << v << "\". Using \"" << scheduler_table[0].name << "\"\n";
+ factory = scheduler_table[0].f;
+ }
+ }
+ }
+ return factory(ffg, max_noutput_items);
+}
+
+
+gr_top_block_impl::gr_top_block_impl(gr_top_block *owner)
+ : d_owner(owner), d_ffg(),
+ d_state(IDLE), d_lock_count(0)
+{
+}
+
+gr_top_block_impl::~gr_top_block_impl()
+{
+ d_owner = 0;
+}
+
+void
+gr_top_block_impl::start(int max_noutput_items)
+{
+ gruel::scoped_lock l(d_mutex);
+
+ d_max_noutput_items = max_noutput_items;
+
+ if (d_state != IDLE)
+ throw std::runtime_error("top_block::start: top block already running or wait() not called after previous stop()");
+
+ if (d_lock_count > 0)
+ throw std::runtime_error("top_block::start: can't start with flow graph locked");
+
+ // Create new flat flow graph by flattening hierarchy
+ d_ffg = d_owner->flatten();
+
+ // Validate new simple flow graph and wire it up
+ d_ffg->validate();
+ d_ffg->setup_connections();
+
+ d_scheduler = make_scheduler(d_ffg, d_max_noutput_items);
+ d_state = RUNNING;
+}
+
+void
+gr_top_block_impl::stop()
+{
+ if (d_scheduler)
+ d_scheduler->stop();
+}
+
+
+void
+gr_top_block_impl::wait()
+{
+ if (d_scheduler)
+ d_scheduler->wait();
+
+ d_state = IDLE;
+}
+
+// N.B. lock() and unlock() cannot be called from a flow graph thread or
+// deadlock will occur when reconfiguration happens
+void
+gr_top_block_impl::lock()
+{
+ gruel::scoped_lock lock(d_mutex);
+ d_lock_count++;
+}
+
+void
+gr_top_block_impl::unlock()
+{
+ gruel::scoped_lock lock(d_mutex);
+
+ if (d_lock_count <= 0){
+ d_lock_count = 0; // fix it, then complain
+ throw std::runtime_error("unpaired unlock() call");
+ }
+
+ d_lock_count--;
+ if (d_lock_count > 0 || d_state == IDLE) // nothing to do
+ return;
+
+ restart();
+}
+
+/*
+ * restart is called with d_mutex held
+ */
+void
+gr_top_block_impl::restart()
+{
+ stop(); // Stop scheduler and wait for completion
+ wait();
+
+ // Create new simple flow graph
+ gr_flat_flowgraph_sptr new_ffg = d_owner->flatten();
+ new_ffg->validate(); // check consistency, sanity, etc
+ new_ffg->merge_connections(d_ffg); // reuse buffers, etc
+ d_ffg = new_ffg;
+
+ // Create a new scheduler to execute it
+ d_scheduler = make_scheduler(d_ffg, d_max_noutput_items);
+ d_state = RUNNING;
+}
+
+void
+gr_top_block_impl::dump()
+{
+ if (d_ffg)
+ d_ffg->dump();
+}
+
+int
+gr_top_block_impl::max_noutput_items()
+{
+ return d_max_noutput_items;
+}
+
+void
+gr_top_block_impl::set_max_noutput_items(int nmax)
+{
+ d_max_noutput_items = nmax;
+}
diff --git a/gnuradio-core/src/lib/runtime/gr_top_block_impl.h b/gnuradio-core/src/lib/runtime/gr_top_block_impl.h
new file mode 100644
index 000000000..f55c3f021
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_top_block_impl.h
@@ -0,0 +1,85 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007,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.
+ */
+
+#ifndef INCLUDED_GR_TOP_BLOCK_IMPL_H
+#define INCLUDED_GR_TOP_BLOCK_IMPL_H
+
+#include <gr_core_api.h>
+#include <gr_scheduler.h>
+#include <gruel/thread.h>
+
+/*!
+ *\brief Abstract implementation details of gr_top_block
+ * \ingroup internal
+ *
+ * The actual implementation of gr_top_block. Separate class allows
+ * decoupling of changes from dependent classes.
+ *
+ */
+class GR_CORE_API gr_top_block_impl
+{
+public:
+ gr_top_block_impl(gr_top_block *owner);
+ ~gr_top_block_impl();
+
+ // Create and start scheduler threads
+ void start(int max_noutput_items=100000);
+
+ // Signal scheduler threads to stop
+ void stop();
+
+ // Wait for scheduler threads to exit
+ void wait();
+
+ // Lock the top block to allow reconfiguration
+ void lock();
+
+ // Unlock the top block at end of reconfiguration
+ void unlock();
+
+ // Dump the flowgraph to stdout
+ void dump();
+
+ // Get the number of max noutput_items in the flowgraph
+ int max_noutput_items();
+
+ // Set the maximum number of noutput_items in the flowgraph
+ void set_max_noutput_items(int nmax);
+
+protected:
+
+ enum tb_state { IDLE, RUNNING };
+
+ gr_top_block *d_owner;
+ gr_flat_flowgraph_sptr d_ffg;
+ gr_scheduler_sptr d_scheduler;
+
+ gruel::mutex d_mutex; // protects d_state and d_lock_count
+ tb_state d_state;
+ int d_lock_count;
+ int d_max_noutput_items;
+
+private:
+ void restart();
+};
+
+#endif /* INCLUDED_GR_TOP_BLOCK_IMPL_H */
diff --git a/gnuradio-core/src/lib/runtime/gr_tpb_detail.cc b/gnuradio-core/src/lib/runtime/gr_tpb_detail.cc
new file mode 100644
index 000000000..46eb6bbe0
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_tpb_detail.cc
@@ -0,0 +1,70 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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 this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <gr_tpb_detail.h>
+#include <gr_block.h>
+#include <gr_block_detail.h>
+#include <gr_buffer.h>
+
+using namespace pmt;
+
+/*
+ * We assume that no worker threads are ever running when the
+ * graph structure is being manipulated, thus it's safe for us to poke
+ * around in our neighbors w/o holding any locks.
+ */
+
+void
+gr_tpb_detail::notify_upstream(gr_block_detail *d)
+{
+ // For each of our inputs, tell the guy upstream that we've consumed
+ // some input, and that he most likely has more output buffer space
+ // available.
+
+ for (size_t i = 0; i < d->d_input.size(); i++){
+ // Can you say, "pointer chasing?"
+ d->d_input[i]->buffer()->link()->detail()->d_tpb.set_output_changed();
+ }
+}
+
+void
+gr_tpb_detail::notify_downstream(gr_block_detail *d)
+{
+ // For each of our outputs, tell the guys downstream that they have
+ // new input available.
+
+ for (size_t i = 0; i < d->d_output.size(); i++){
+ gr_buffer_sptr buf = d->d_output[i];
+ for (size_t j = 0, k = buf->nreaders(); j < k; j++)
+ buf->reader(j)->link()->detail()->d_tpb.set_input_changed();
+ }
+}
+
+void
+gr_tpb_detail::notify_neighbors(gr_block_detail *d)
+{
+ notify_downstream(d);
+ notify_upstream(d);
+}
+
diff --git a/gnuradio-core/src/lib/runtime/gr_tpb_detail.h b/gnuradio-core/src/lib/runtime/gr_tpb_detail.h
new file mode 100644
index 000000000..69feb6007
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_tpb_detail.h
@@ -0,0 +1,89 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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 this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+#ifndef INCLUDED_GR_TPB_DETAIL_H
+#define INCLUDED_GR_TPB_DETAIL_H
+
+#include <gr_core_api.h>
+#include <gruel/thread.h>
+#include <deque>
+#include <gruel/pmt.h>
+
+class gr_block_detail;
+
+/*!
+ * \brief used by thread-per-block scheduler
+ */
+struct GR_CORE_API gr_tpb_detail {
+
+ gruel::mutex mutex; //< protects all vars
+ bool input_changed;
+ gruel::condition_variable input_cond;
+ bool output_changed;
+ gruel::condition_variable output_cond;
+
+public:
+ gr_tpb_detail()
+ : input_changed(false), output_changed(false) { }
+
+ //! Called by us to tell all our upstream blocks that their output may have changed.
+ void notify_upstream(gr_block_detail *d);
+
+ //! Called by us to tell all our downstream blocks that their input may have changed.
+ void notify_downstream(gr_block_detail *d);
+
+ //! Called by us to notify both upstream and downstream
+ void notify_neighbors(gr_block_detail *d);
+
+ //! Called by pmt msg posters
+ void notify_msg(){
+ input_cond.notify_one();
+ output_cond.notify_one();
+ }
+
+ //! Called by us
+ void clear_changed()
+ {
+ gruel::scoped_lock guard(mutex);
+ input_changed = false;
+ output_changed = false;
+ }
+
+private:
+
+ //! Used by notify_downstream
+ void set_input_changed()
+ {
+ gruel::scoped_lock guard(mutex);
+ input_changed = true;
+ input_cond.notify_one();
+ }
+
+ //! Used by notify_upstream
+ void set_output_changed()
+ {
+ gruel::scoped_lock guard(mutex);
+ output_changed = true;
+ output_cond.notify_one();
+ }
+
+};
+
+#endif /* INCLUDED_GR_TPB_DETAIL_H */
diff --git a/gnuradio-core/src/lib/runtime/gr_tpb_thread_body.cc b/gnuradio-core/src/lib/runtime/gr_tpb_thread_body.cc
new file mode 100644
index 000000000..679fd1512
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_tpb_thread_body.cc
@@ -0,0 +1,151 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,2009,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 this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <gr_tpb_thread_body.h>
+#include <gr_prefs.h>
+#include <iostream>
+#include <boost/thread.hpp>
+#include <gruel/pmt.h>
+#include <boost/foreach.hpp>
+
+using namespace pmt;
+
+gr_tpb_thread_body::gr_tpb_thread_body(gr_block_sptr block, int max_noutput_items)
+ : d_exec(block, max_noutput_items)
+{
+ //std::cerr << "gr_tpb_thread_body: " << block << std::endl;
+
+ gr_block_detail *d = block->detail().get();
+ gr_block_executor::state s;
+ pmt_t msg;
+
+ d->threaded = true;
+ d->thread = gruel::get_current_thread_id();
+
+ gr_prefs *p = gr_prefs::singleton();
+ size_t max_nmsgs = static_cast<size_t>(p->get_long("DEFAULT", "max_messages", 100));
+
+ // Set thread affinity if it was set before fg was started.
+ if(block->processor_affinity().size() > 0) {
+ gruel::thread_bind_to_processor(d->thread, block->processor_affinity());
+ }
+
+ while (1){
+ boost::this_thread::interruption_point();
+
+ // handle any queued up messages
+ //BOOST_FOREACH( pmt::pmt_t port, block->msg_queue.keys() )
+
+ BOOST_FOREACH( gr_basic_block::msg_queue_map_t::value_type &i, block->msg_queue )
+ {
+ // Check if we have a message handler attached before getting
+ // any messages. This is mostly a protection for the unknown
+ // startup sequence of the threads.
+ if(block->has_msg_handler(i.first)) {
+ while ((msg = block->delete_head_nowait(i.first))){
+ block->dispatch_msg(i.first,msg);
+ }
+ }
+ else {
+ // If we don't have a handler but are building up messages,
+ // prune the queue from the front to keep memory in check.
+ if(block->nmsgs(i.first) > max_nmsgs)
+ msg = block->delete_head_nowait(i.first);
+ }
+ }
+
+ d->d_tpb.clear_changed();
+ // run one iteration if we are a connected stream block
+ if(d->noutputs() >0 || d->ninputs()>0){
+ s = d_exec.run_one_iteration();
+ } else {
+ s = gr_block_executor::BLKD_IN;
+ }
+
+ switch(s){
+ case gr_block_executor::READY: // Tell neighbors we made progress.
+ d->d_tpb.notify_neighbors(d);
+ break;
+
+ case gr_block_executor::READY_NO_OUTPUT: // Notify upstream only
+ d->d_tpb.notify_upstream(d);
+ break;
+
+ case gr_block_executor::DONE: // Game over.
+ d->d_tpb.notify_neighbors(d);
+ return;
+
+ case gr_block_executor::BLKD_IN: // Wait for input.
+ {
+ gruel::scoped_lock guard(d->d_tpb.mutex);
+ while (!d->d_tpb.input_changed){
+
+ // wait for input or message
+ while(!d->d_tpb.input_changed && block->empty_p())
+ d->d_tpb.input_cond.wait(guard);
+
+ // handle all pending messages
+ BOOST_FOREACH( gr_basic_block::msg_queue_map_t::value_type &i, block->msg_queue )
+ {
+ while ((msg = block->delete_head_nowait(i.first))){
+ guard.unlock(); // release lock while processing msg
+ block->dispatch_msg(i.first, msg);
+ guard.lock();
+ }
+ }
+ }
+ }
+ break;
+
+
+ case gr_block_executor::BLKD_OUT: // Wait for output buffer space.
+ {
+ gruel::scoped_lock guard(d->d_tpb.mutex);
+ while (!d->d_tpb.output_changed){
+
+ // wait for output room or message
+ while(!d->d_tpb.output_changed && block->empty_p())
+ d->d_tpb.output_cond.wait(guard);
+
+ // handle all pending messages
+ BOOST_FOREACH( gr_basic_block::msg_queue_map_t::value_type &i, block->msg_queue )
+ {
+ while ((msg = block->delete_head_nowait(i.first))){
+ guard.unlock(); // release lock while processing msg
+ block->dispatch_msg(i.first,msg);
+ guard.lock();
+ }
+ }
+ }
+ }
+ break;
+
+ default:
+ assert(0);
+ }
+ }
+}
+
+gr_tpb_thread_body::~gr_tpb_thread_body()
+{
+}
diff --git a/gnuradio-core/src/lib/runtime/gr_tpb_thread_body.h b/gnuradio-core/src/lib/runtime/gr_tpb_thread_body.h
new file mode 100644
index 000000000..f920663a2
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_tpb_thread_body.h
@@ -0,0 +1,46 @@
+/* -*- 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 this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+#ifndef INCLUDED_GR_TPB_THREAD_BODY_H
+#define INCLUDED_GR_TPB_THREAD_BODY_H
+
+#include <gr_core_api.h>
+#include <gr_block_executor.h>
+#include <gr_block.h>
+#include <gr_block_detail.h>
+
+/*!
+ * \brief The body of each thread-per-block thread.
+ *
+ * One of these is instantiated in its own thread for each block. The
+ * constructor turns into the main loop which returns when the block is
+ * done or is interrupted.
+ */
+
+class GR_CORE_API gr_tpb_thread_body {
+ gr_block_executor d_exec;
+
+public:
+ gr_tpb_thread_body(gr_block_sptr block, int max_noutput_items=100000);
+ ~gr_tpb_thread_body();
+};
+
+
+#endif /* INCLUDED_GR_TPB_THREAD_BODY_H */
diff --git a/gnuradio-core/src/lib/runtime/gr_types.h b/gnuradio-core/src/lib/runtime/gr_types.h
new file mode 100644
index 000000000..b7c297d61
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_types.h
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2012-2013 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_GRNURADIO_TYPES_H
+#define INCLUDED_GRNURADIO_TYPES_H
+
+// this section is to satisfy swig includes for gras.i
+// since gras.i includes gr_types.h, we only have to edit this file
+#include <gras/element.hpp>
+#include <gras/block.hpp>
+#include <gras/top_block.hpp>
+#include <gras/hier_block.hpp>
+
+// and gnuradio apparently needs its own typedefs for stdint...
+#ifdef __cplusplus
+
+#include <boost/cstdint.hpp>
+typedef boost::int16_t gr_int16;
+typedef boost::int32_t gr_int32;
+typedef boost::int64_t gr_int64;
+typedef boost::uint16_t gr_uint16;
+typedef boost::uint32_t gr_uint32;
+typedef boost::uint64_t gr_uint64;
+
+typedef std::vector<int> gr_vector_int;
+typedef std::vector<unsigned int> gr_vector_uint;
+typedef std::vector<float> gr_vector_float;
+typedef std::vector<double> gr_vector_double;
+typedef std::vector<void *> gr_vector_void_star;
+typedef std::vector<const void *> gr_vector_const_void_star;
+
+#include <complex>
+typedef std::complex<float> gr_complex;
+typedef std::complex<double> gr_complexd;
+
+#endif
+
+#endif /* INCLUDED_GRNURADIO_TYPES_H */
diff --git a/gnuradio-core/src/lib/runtime/gr_unittests.h b/gnuradio-core/src/lib/runtime/gr_unittests.h
new file mode 100644
index 000000000..9fbf228cd
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_unittests.h
@@ -0,0 +1,43 @@
+/* -*- c++ -*- */
+/*
+ * 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_core_api.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <string>
+
+#include <boost/filesystem/operations.hpp>
+#include <boost/filesystem/path.hpp>
+
+static std::string get_unittest_path(const std::string &filename){
+ boost::filesystem::path path = boost::filesystem::current_path() / ".unittests";
+ if (!boost::filesystem::is_directory(path)) boost::filesystem::create_directory(path);
+ return (path / filename).string();
+}
diff --git a/gnuradio-core/src/lib/runtime/gr_vmcircbuf.cc b/gnuradio-core/src/lib/runtime/gr_vmcircbuf.cc
new file mode 100644
index 000000000..522d9515d
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_vmcircbuf.cc
@@ -0,0 +1,295 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2003 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 <gr_vmcircbuf.h>
+#include <assert.h>
+#include <stdexcept>
+#include <gr_preferences.h>
+#include <stdio.h>
+#include <string.h>
+#include <gr_local_sighandler.h>
+#include <vector>
+#include <boost/format.hpp>
+
+// all the factories we know about
+#include <gr_vmcircbuf_createfilemapping.h>
+#include <gr_vmcircbuf_sysv_shm.h>
+#include <gr_vmcircbuf_mmap_shm_open.h>
+#include <gr_vmcircbuf_mmap_tmpfile.h>
+
+static const char *FACTORY_PREF_KEY = "gr_vmcircbuf_default_factory";
+
+gr_vmcircbuf::~gr_vmcircbuf ()
+{
+}
+
+gr_vmcircbuf_factory::~gr_vmcircbuf_factory ()
+{
+}
+
+// ----------------------------------------------------------------
+
+static gr_vmcircbuf_factory *s_default_factory = 0;
+
+gr_vmcircbuf_factory *
+gr_vmcircbuf_sysconfig::get_default_factory ()
+{
+ if (s_default_factory)
+ return s_default_factory;
+
+ bool verbose = false;
+
+ std::vector<gr_vmcircbuf_factory *> all = all_factories ();
+
+ const char *name = gr_preferences::get (FACTORY_PREF_KEY);
+
+ if (name){
+ for (unsigned int i = 0; i < all.size (); i++){
+ if (strcmp (name, all[i]->name ()) == 0){
+ s_default_factory = all[i];
+ if (verbose)
+ fprintf (stderr, "gr_vmcircbuf_sysconfig: using %s\n",
+ s_default_factory->name ());
+ return s_default_factory;
+ }
+ }
+ }
+
+ // either we don't have a default, or the default named is not in our
+ // list of factories. Find the first factory that works.
+
+ if (verbose)
+ fprintf (stderr, "gr_vmcircbuf_sysconfig: finding a working factory...\n");
+
+ for (unsigned int i = 0; i < all.size (); i++){
+ if (test_factory (all[i], verbose)){
+ set_default_factory (all[i]);
+ return s_default_factory;
+ }
+ }
+
+ // We're screwed!
+
+ fprintf (stderr, "gr_vmcircbuf_sysconfig: unable to find a working factory!\n");
+ throw std::runtime_error ("gr_vmcircbuf_sysconfig");
+}
+
+std::vector<gr_vmcircbuf_factory *>
+gr_vmcircbuf_sysconfig::all_factories ()
+{
+ std::vector<gr_vmcircbuf_factory *> result;
+
+ result.push_back (gr_vmcircbuf_createfilemapping_factory::singleton ());
+#ifdef TRY_SHM_VMCIRCBUF
+ result.push_back (gr_vmcircbuf_sysv_shm_factory::singleton ());
+ result.push_back (gr_vmcircbuf_mmap_shm_open_factory::singleton ());
+#endif
+ result.push_back (gr_vmcircbuf_mmap_tmpfile_factory::singleton ());
+
+ return result;
+}
+
+void
+gr_vmcircbuf_sysconfig::set_default_factory (gr_vmcircbuf_factory *f)
+{
+ gr_preferences::set (FACTORY_PREF_KEY, f->name ());
+ s_default_factory = f;
+}
+
+
+// ------------------------------------------------------------------------
+// test code for vmcircbuf factories
+// ------------------------------------------------------------------------
+
+static void
+init_buffer (gr_vmcircbuf *c, int counter, int size)
+{
+ unsigned int *p = (unsigned int *) c->pointer_to_first_copy ();
+ for (unsigned int i = 0; i < size / sizeof (int); i++)
+ p[i] = counter + i;
+}
+
+static bool
+check_mapping (gr_vmcircbuf *c, int counter, int size, const char *msg, bool verbose)
+{
+ bool ok = true;
+
+ if (verbose)
+ fprintf (stderr, "... %s", msg);
+
+ unsigned int *p1 = (unsigned int *) c->pointer_to_first_copy ();
+ unsigned int *p2 = (unsigned int *) c->pointer_to_second_copy ();
+
+ // fprintf (stderr, "p1 = %p, p2 = %p\n", p1, p2);
+
+ for (unsigned int i = 0; i < size / sizeof (int); i++){
+ if (p1[i] != counter + i){
+ ok = false;
+ if (verbose)
+ fprintf (stderr, " p1[%d] == %u, expected %u\n", i, p1[i], counter + i);
+ break;
+ }
+ if (p2[i] != counter + i){
+ if (verbose)
+ fprintf (stderr, " p2[%d] == %u, expected %u\n", i, p2[i], counter + i);
+ ok = false;
+ break;
+ }
+ }
+
+ if (ok && verbose){
+ fprintf (stderr, " OK\n");
+ }
+ return ok;
+}
+
+static const char *
+memsize (int size)
+{
+ static std::string buf;
+ if (size >= (1 << 20)){
+ buf = str(boost::format("%dMB") % (size / (1 << 20)));
+ }
+ else if (size >= (1 << 10)){
+ buf = str(boost::format("%dKB") % (size / (1 << 10)));
+ }
+ else {
+ buf = str(boost::format("%d") % size);
+ }
+ return buf.c_str();
+}
+
+static bool
+test_a_bunch (gr_vmcircbuf_factory *factory, int n, int size, int *start_ptr, bool verbose)
+{
+ bool ok = true;
+ std::vector<int> counter(n);
+ std::vector<gr_vmcircbuf *> c(n);
+ int cum_size = 0;
+
+ for (int i = 0; i < n; i++){
+ counter[i] = *start_ptr;
+ *start_ptr += size;
+ if ((c[i] = factory->make (size)) == 0){
+ if (verbose)
+ fprintf (stderr,
+ "Failed to allocate gr_vmcircbuf number %d of size %d (cum = %s)\n",
+ i + 1, size, memsize (cum_size));
+ return false;
+ }
+ init_buffer (c[i], counter[i], size);
+ cum_size += size;
+ }
+
+ for (int i = 0; i < n; i++){
+ std::string msg = str(boost::format("test_a_bunch_%dx%s[%d]") % n % memsize (size) % i);
+ ok &= check_mapping (c[i], counter[i], size, msg.c_str(), verbose);
+ }
+
+ for (int i = 0; i < n; i++){
+ delete c[i];
+ c[i] = 0;
+ }
+
+ return ok;
+}
+
+static bool
+standard_tests (gr_vmcircbuf_factory *f, int verbose)
+{
+ if (verbose >= 1)
+ fprintf (stderr, "Testing %s...\n", f->name ());
+
+ bool v = verbose >= 2;
+ int granularity = f->granularity ();
+ int start = 0;
+ bool ok = true;
+
+ ok &= test_a_bunch (f, 1, 1 * granularity, &start, v); // 1 x 4KB = 4KB
+
+ if (ok){
+ ok &= test_a_bunch (f, 64, 4 * granularity, &start, v); // 64 x 16KB = 1MB
+ ok &= test_a_bunch (f, 4, 4 * (1L << 20), &start, v); // 4 x 4MB = 16MB
+// ok &= test_a_bunch (f, 256, 256 * (1L << 10), &start, v); // 256 x 256KB = 64MB
+ }
+
+ if (verbose >= 1)
+ fprintf (stderr, "....... %s: %s", f->name (), ok ? "OK\n" : "Doesn't work\n");
+
+ return ok;
+}
+
+bool
+gr_vmcircbuf_sysconfig::test_factory (gr_vmcircbuf_factory *f, int verbose)
+{
+ // Install local signal handlers for SIGSEGV and SIGBUS.
+ // If something goes wrong, these signals may be invoked.
+
+#ifdef SIGSEGV
+ gr_local_sighandler sigsegv (SIGSEGV, gr_local_sighandler::throw_signal);
+#endif
+#ifdef SIGBUS
+ gr_local_sighandler sigbus (SIGBUS, gr_local_sighandler::throw_signal);
+#endif
+#ifdef SIGSYS
+ gr_local_sighandler sigsys (SIGSYS, gr_local_sighandler::throw_signal);
+#endif
+
+ try {
+ return standard_tests (f, verbose);
+ }
+ catch (gr_signal &sig){
+ if (verbose){
+ fprintf (stderr, "....... %s: %s", f->name (), "Doesn't work\n");
+ fprintf (stderr,
+ "gr_vmcircbuf_factory::test_factory (%s): caught %s\n",
+ f->name (), sig.name().c_str());
+ return false;
+ }
+ }
+ catch (...){
+ if (verbose){
+ fprintf (stderr, "....... %s: %s", f->name (), "Doesn't work\n");
+ fprintf (stderr,
+ "gr_vmcircbuf_factory::test_factory (%s): some kind of uncaught exception\n",
+ f->name ());
+ }
+ return false;
+ }
+ return false; // never gets here. shut compiler up.
+}
+
+bool
+gr_vmcircbuf_sysconfig::test_all_factories (int verbose)
+{
+ bool ok = false;
+
+ std::vector<gr_vmcircbuf_factory *> all = all_factories ();
+
+ for (unsigned int i = 0; i < all.size (); i++)
+ ok |= test_factory (all[i], verbose);
+
+ return ok;
+}
diff --git a/gnuradio-core/src/lib/runtime/gr_vmcircbuf.h b/gnuradio-core/src/lib/runtime/gr_vmcircbuf.h
new file mode 100644
index 000000000..45c6f969c
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_vmcircbuf.h
@@ -0,0 +1,122 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2003 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 _GR_VMCIRCBUF_H_
+#define _GR_VMCIRCBUF_H_
+
+#include <gr_core_api.h>
+#include <vector>
+
+/*!
+ * \brief abstract class to implement doubly mapped virtual memory circular buffers
+ * \ingroup internal
+ */
+class GR_CORE_API gr_vmcircbuf {
+ protected:
+ int d_size;
+ char *d_base;
+
+ // CREATORS
+ gr_vmcircbuf (int size) : d_size (size), d_base (0) {};
+
+ public:
+ virtual ~gr_vmcircbuf ();
+
+ // ACCESSORS
+ void *pointer_to_first_copy () const { return d_base; }
+ void *pointer_to_second_copy () const { return d_base + d_size; }
+};
+
+/*!
+ * \brief abstract factory for creating circular buffers
+ */
+class GR_CORE_API gr_vmcircbuf_factory {
+ protected:
+ gr_vmcircbuf_factory () {};
+ virtual ~gr_vmcircbuf_factory ();
+
+ public:
+
+ /*!
+ * \brief return name of this factory
+ */
+ virtual const char *name () const = 0;
+
+ /*!
+ * \brief return granularity of mapping, typically equal to page size
+ */
+ virtual int granularity () = 0;
+
+ /*!
+ * \brief return a gr_vmcircbuf, or 0 if unable.
+ *
+ * Call this to create a doubly mapped circular buffer.
+ */
+ virtual gr_vmcircbuf *make (int size) = 0;
+};
+
+/*
+ * \brief pulls together all implementations of gr_vmcircbuf
+ */
+class GR_CORE_API gr_vmcircbuf_sysconfig {
+ public:
+
+ /*
+ * \brief return the single instance of the default factory.
+ *
+ * returns the default factory to use if it's already defined,
+ * else find the first working factory and use it.
+ */
+ static gr_vmcircbuf_factory *get_default_factory ();
+
+
+ static int granularity () { return get_default_factory()->granularity(); }
+ static gr_vmcircbuf *make (int size) { return get_default_factory()->make(size); }
+
+
+ // N.B. not all factories are guaranteed to work.
+ // It's too hard to check everything at config time, so we check at runtime
+ static std::vector<gr_vmcircbuf_factory *> all_factories ();
+
+ // make this factory the default
+ static void set_default_factory (gr_vmcircbuf_factory *f);
+
+ /*!
+ * \brief Does this factory really work?
+ *
+ * verbose = 0: silent
+ * verbose = 1: names of factories tested and results
+ * verbose = 2: all intermediate results
+ */
+ static bool test_factory (gr_vmcircbuf_factory *f, int verbose);
+
+ /*!
+ * \brief Test all factories, return true if at least one of them works
+ * verbose = 0: silent
+ * verbose = 1: names of factories tested and results
+ * verbose = 2: all intermediate results
+ */
+ static bool test_all_factories (int verbose);
+};
+
+
+#endif /* _GR_VMCIRCBUF_H_ */
diff --git a/gnuradio-core/src/lib/runtime/gr_vmcircbuf_createfilemapping.cc b/gnuradio-core/src/lib/runtime/gr_vmcircbuf_createfilemapping.cc
new file mode 100644
index 000000000..1b4d9700a
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_vmcircbuf_createfilemapping.cc
@@ -0,0 +1,204 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2003,2005,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+#include <stdexcept>
+#include <assert.h>
+#include <unistd.h>
+#include <fcntl.h>
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_MMAN_H
+#include <sys/mman.h>
+#endif
+#include <errno.h>
+#include <stdio.h>
+#include <gr_pagesize.h>
+#include <gr_vmcircbuf_createfilemapping.h>
+#include <boost/format.hpp>
+
+#ifdef HAVE_CREATEFILEMAPPING
+// Print Windows error (could/should be global?)
+static void
+werror( char *where, DWORD last_error )
+{
+ char buf[1024];
+
+ FormatMessage( FORMAT_MESSAGE_FROM_SYSTEM,
+ NULL,
+ last_error,
+ 0, // default language
+ buf,
+ sizeof(buf)/sizeof(TCHAR), // buffer size
+ NULL );
+ fprintf( stderr, "%s: Error %d: %s", where, last_error, buf );
+ return;
+}
+#endif
+
+
+gr_vmcircbuf_createfilemapping::gr_vmcircbuf_createfilemapping (int size)
+ : gr_vmcircbuf (size)
+{
+#if !defined(HAVE_CREATEFILEMAPPING)
+ fprintf (stderr, "%s: createfilemapping is not available\n",__FUNCTION__);
+ throw std::runtime_error ("gr_vmcircbuf_createfilemapping");
+#else
+ static int s_seg_counter = 0;
+
+ if (size <= 0 || (size % gr_pagesize ()) != 0){
+ fprintf (stderr, "gr_vmcircbuf_createfilemapping: invalid size = %d\n", size);
+ throw std::runtime_error ("gr_vmcircbuf_createfilemapping");
+ }
+
+ std::string seg_name = str(boost::format("/gnuradio-%d-%d") % getpid () % s_seg_counter);
+
+ d_handle = CreateFileMapping(INVALID_HANDLE_VALUE, // use paging file
+ NULL, // default security
+ PAGE_READWRITE, // read/write access
+ 0, // max. object size
+ size, // buffer size
+ seg_name.c_str()); // name of mapping object
+
+ s_seg_counter++;
+ if (d_handle == NULL || d_handle == INVALID_HANDLE_VALUE){
+ std::string msg = str(boost::format(
+ "gr_vmcircbuf_mmap_createfilemapping: CreateFileMapping [%s]") %
+ seg_name );
+ werror((char *) msg.c_str(), GetLastError() );
+ throw std::runtime_error ("gr_vmcircbuf_mmap_createfilemapping");
+ }
+
+ // Allocate virtual memory of the needed size, then free it so we can use it
+ LPVOID first_tmp;
+ first_tmp = VirtualAlloc( NULL, 2*size, MEM_RESERVE, PAGE_NOACCESS );
+ if (first_tmp == NULL){
+ werror( "gr_vmcircbuf_mmap_createfilemapping: VirtualAlloc", GetLastError());
+ CloseHandle(d_handle); // cleanup
+ throw std::runtime_error ("gr_vmcircbuf_mmap_createfilemapping");
+ }
+
+ if (VirtualFree(first_tmp, 0, MEM_RELEASE) == 0){
+ werror( "gr_vmcircbuf_mmap_createfilemapping: VirtualFree", GetLastError());
+ CloseHandle(d_handle); // cleanup
+ throw std::runtime_error ("gr_vmcircbuf_mmap_createfilemapping");
+ }
+
+ d_first_copy = MapViewOfFileEx((HANDLE)d_handle, // handle to map object
+ FILE_MAP_WRITE, // read/write permission
+ 0,
+ 0,
+ size,
+ first_tmp);
+ if (d_first_copy != first_tmp){
+ werror( "gr_vmcircbuf_mmap_createfilemapping: MapViewOfFileEx(1)", GetLastError());
+ CloseHandle(d_handle); // cleanup
+ throw std::runtime_error ("gr_vmcircbuf_mmap_createfilemapping");
+ }
+
+ d_second_copy = MapViewOfFileEx((HANDLE)d_handle, // handle to map object
+ FILE_MAP_WRITE, // read/write permission
+ 0,
+ 0,
+ size,
+ (char *)first_tmp + size);//(LPVOID) ((char *)d_first_copy + size));
+
+ if (d_second_copy != (char *)first_tmp + size){
+ werror( "gr_vmcircbuf_mmap_createfilemapping: MapViewOfFileEx(2)", GetLastError());
+ UnmapViewOfFile(d_first_copy);
+ CloseHandle(d_handle); // cleanup
+ throw std::runtime_error ("gr_vmcircbuf_mmap_createfilemapping");
+ }
+
+#ifdef DEBUG
+ fprintf (stderr,"gr_vmcircbuf_mmap_createfilemapping: contiguous? mmap %p %p %p %p\n",
+ (char *)d_first_copy, (char *)d_second_copy, size, (char *)d_first_copy + size);
+#endif
+
+ // Now remember the important stuff
+ d_base = (char *) d_first_copy;
+ d_size = size;
+#endif /*HAVE_CREATEFILEMAPPING*/
+}
+
+gr_vmcircbuf_createfilemapping::~gr_vmcircbuf_createfilemapping ()
+{
+#ifdef HAVE_CREATEFILEMAPPING
+ if (UnmapViewOfFile(d_first_copy) == 0)
+ {
+ werror("gr_vmcircbuf_createfilemapping: UnmapViewOfFile(d_first_copy)", GetLastError());
+ }
+ d_base=NULL;
+ if (UnmapViewOfFile(d_second_copy) == 0)
+ {
+ werror("gr_vmcircbuf_createfilemapping: UnmapViewOfFile(d_second_copy)", GetLastError());
+ }
+ //d_second=NULL;
+ CloseHandle(d_handle);
+#endif
+}
+
+// ----------------------------------------------------------------
+// The factory interface
+// ----------------------------------------------------------------
+
+
+gr_vmcircbuf_factory *gr_vmcircbuf_createfilemapping_factory::s_the_factory = 0;
+
+gr_vmcircbuf_factory *
+gr_vmcircbuf_createfilemapping_factory::singleton ()
+{
+ if (s_the_factory)
+ return s_the_factory;
+ s_the_factory = new gr_vmcircbuf_createfilemapping_factory ();
+ return s_the_factory;
+}
+
+int
+gr_vmcircbuf_createfilemapping_factory::granularity ()
+{
+#ifdef HAVE_CREATEFILEMAPPING
+ // return 65536;//TODO, check, is this needed or can we just use gr_pagesize()
+ SYSTEM_INFO system_info;
+ GetSystemInfo(&system_info);
+ //fprintf(stderr,"win32 AllocationGranularity %p\n",(int)system_info.dwAllocationGranularity);
+ return (int)system_info.dwAllocationGranularity;
+#else
+ return gr_pagesize ();
+#endif
+}
+
+gr_vmcircbuf *
+gr_vmcircbuf_createfilemapping_factory::make (int size)
+{
+ try
+ {
+ return new gr_vmcircbuf_createfilemapping (size);
+ }
+ catch (...)
+ {
+ return 0;
+ }
+}
diff --git a/gnuradio-core/src/lib/runtime/gr_vmcircbuf_createfilemapping.h b/gnuradio-core/src/lib/runtime/gr_vmcircbuf_createfilemapping.h
new file mode 100644
index 000000000..5ef31f5c6
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_vmcircbuf_createfilemapping.h
@@ -0,0 +1,76 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2003,2005 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 _GR_VMCIRCBUF_CREATEFILEMAPPING_H_
+#define _GR_VMCIRCBUF_CREATEFILEMAPPING_H_
+
+#include <gr_core_api.h>
+#include <gr_vmcircbuf.h>
+
+#ifdef HAVE_CREATEFILEMAPPING
+#include <windows.h>
+#endif
+/*!
+ * \brief concrete class to implement circular buffers with mmap and shm_open
+ * \ingroup internal
+ */
+class GR_CORE_API gr_vmcircbuf_createfilemapping : public gr_vmcircbuf
+{
+ public:
+ // CREATORS
+ gr_vmcircbuf_createfilemapping (int size);
+ virtual ~gr_vmcircbuf_createfilemapping ();
+#ifdef HAVE_CREATEFILEMAPPING
+ private:
+ HANDLE d_handle;
+ LPVOID d_first_copy;
+ LPVOID d_second_copy;
+#endif
+};
+
+/*!
+ * \brief concrete factory for circular buffers built using mmap and shm_open
+ */
+class GR_CORE_API gr_vmcircbuf_createfilemapping_factory : public gr_vmcircbuf_factory
+{
+ private:
+ static gr_vmcircbuf_factory *s_the_factory;
+
+ public:
+ static gr_vmcircbuf_factory *singleton ();
+
+ virtual const char *name () const { return "gr_vmcircbuf_createfilemapping_factory"; }
+
+ /*!
+ * \brief return granularity of mapping, typically equal to page size
+ */
+ virtual int granularity ();
+
+ /*!
+ * \brief return a gr_vmcircbuf, or 0 if unable.
+ *
+ * Call this to create a doubly mapped circular buffer.
+ */
+ virtual gr_vmcircbuf *make (int size);
+};
+
+#endif /* _GR_VMCIRCBUF_CREATEFILEMAPPING_H_ */
diff --git a/gnuradio-core/src/lib/runtime/gr_vmcircbuf_mmap_shm_open.cc b/gnuradio-core/src/lib/runtime/gr_vmcircbuf_mmap_shm_open.cc
new file mode 100644
index 000000000..3d170081d
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_vmcircbuf_mmap_shm_open.cc
@@ -0,0 +1,205 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2003,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+#include <gr_vmcircbuf_mmap_shm_open.h>
+#include <stdexcept>
+#include <assert.h>
+#include <unistd.h>
+#include <fcntl.h>
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_MMAN_H
+#include <sys/mman.h>
+#endif
+#include <errno.h>
+#include <stdio.h>
+#include <gr_pagesize.h>
+#include <gr_sys_paths.h>
+
+
+gr_vmcircbuf_mmap_shm_open::gr_vmcircbuf_mmap_shm_open (int size)
+ : gr_vmcircbuf (size)
+{
+#if !defined(HAVE_MMAP) || !defined(HAVE_SHM_OPEN)
+ fprintf (stderr, "gr_vmcircbuf_mmap_shm_open: mmap or shm_open is not available\n");
+ throw std::runtime_error ("gr_vmcircbuf_mmap_shm_open");
+#else
+ static int s_seg_counter = 0;
+
+ if (size <= 0 || (size % gr_pagesize ()) != 0){
+ fprintf (stderr, "gr_vmcircbuf_mmap_shm_open: invalid size = %d\n", size);
+ throw std::runtime_error ("gr_vmcircbuf_mmap_shm_open");
+ }
+
+ int shm_fd = -1;
+ char seg_name[1024];
+ static bool portable_format = true;
+
+ // open a new named shared memory segment
+
+ while (1){
+ if (portable_format){
+
+ // This is the POSIX recommended "portable format".
+ // Of course the "portable format" doesn't work on some systems...
+
+ snprintf (seg_name, sizeof (seg_name),
+ "/gnuradio-%d-%d", getpid (), s_seg_counter);
+ }
+ else {
+
+ // Where the "portable format" doesn't work, we try building
+ // a full filesystem pathname pointing into a suitable temporary directory.
+
+ snprintf (seg_name, sizeof (seg_name),
+ "%s/gnuradio-%d-%d", gr_tmp_path (), getpid (), s_seg_counter);
+ }
+
+ shm_fd = shm_open (seg_name, O_RDWR | O_CREAT | O_EXCL, 0600);
+ if (shm_fd == -1 && errno == EACCES && portable_format){
+ portable_format = false;
+ continue; // try again using "non-portable format"
+ }
+
+ s_seg_counter++;
+
+ if (shm_fd == -1){
+ if (errno == EEXIST) // Named segment already exists (shouldn't happen). Try again
+ continue;
+
+ char msg[1024];
+ snprintf (msg, sizeof (msg), "gr_vmcircbuf_mmap_shm_open: shm_open [%s]", seg_name);
+ perror (msg);
+ throw std::runtime_error ("gr_vmcircbuf_mmap_shm_open");
+ }
+ break;
+ }
+
+ // We've got a new shared memory segment fd open.
+ // Now set it's length to 2x what we really want and mmap it in.
+
+ if (ftruncate (shm_fd, (off_t) 2 * size) == -1){
+ close (shm_fd); // cleanup
+ perror ("gr_vmcircbuf_mmap_shm_open: ftruncate (1)");
+ throw std::runtime_error ("gr_vmcircbuf_mmap_shm_open");
+ }
+
+ void *first_copy = mmap (0, 2 * size,
+ PROT_READ | PROT_WRITE, MAP_SHARED,
+ shm_fd, (off_t) 0);
+
+ if (first_copy == MAP_FAILED){
+ close (shm_fd); // cleanup
+ perror ("gr_vmcircbuf_mmap_shm_open: mmap (1)");
+ throw std::runtime_error ("gr_vmcircbuf_mmap_shm_open");
+ }
+
+ // unmap the 2nd half
+ if (munmap ((char *) first_copy + size, size) == -1){
+ close (shm_fd); // cleanup
+ perror ("gr_vmcircbuf_mmap_shm_open: munmap (1)");
+ throw std::runtime_error ("gr_vmcircbuf_mmap_shm_open");
+ }
+
+ // map the first half into the now available hole where the
+ // second half used to be.
+
+ void *second_copy = mmap ((char *) first_copy + size, size,
+ PROT_READ | PROT_WRITE, MAP_SHARED,
+ shm_fd, (off_t) 0);
+
+ if (second_copy == MAP_FAILED){
+ close (shm_fd); // cleanup
+ perror ("gr_vmcircbuf_mmap_shm_open: mmap (2)");
+ throw std::runtime_error ("gr_vmcircbuf_mmap_shm_open");
+ }
+
+#if 0 // OS/X doesn't allow you to resize the segment
+
+ // cut the shared memory segment down to size
+ if (ftruncate (shm_fd, (off_t) size) == -1){
+ close (shm_fd); // cleanup
+ perror ("gr_vmcircbuf_mmap_shm_open: ftruncate (2)");
+ throw std::runtime_error ("gr_vmcircbuf_mmap_shm_open");
+ }
+#endif
+
+ close (shm_fd); // fd no longer needed. The mapping is retained.
+
+ if (shm_unlink (seg_name) == -1){ // unlink the seg_name.
+ perror ("gr_vmcircbuf_mmap_shm_open: shm_unlink");
+ throw std::runtime_error ("gr_vmcircbuf_mmap_shm_open");
+ }
+
+ // Now remember the important stuff
+
+ d_base = (char *) first_copy;
+ d_size = size;
+#endif
+}
+
+gr_vmcircbuf_mmap_shm_open::~gr_vmcircbuf_mmap_shm_open ()
+{
+#if defined(HAVE_MMAP)
+ if (munmap (d_base, 2 * d_size) == -1){
+ perror ("gr_vmcircbuf_mmap_shm_open: munmap (2)");
+ }
+#endif
+}
+
+// ----------------------------------------------------------------
+// The factory interface
+// ----------------------------------------------------------------
+
+
+gr_vmcircbuf_factory *gr_vmcircbuf_mmap_shm_open_factory::s_the_factory = 0;
+
+gr_vmcircbuf_factory *
+gr_vmcircbuf_mmap_shm_open_factory::singleton ()
+{
+ if (s_the_factory)
+ return s_the_factory;
+
+ s_the_factory = new gr_vmcircbuf_mmap_shm_open_factory ();
+ return s_the_factory;
+}
+
+int
+gr_vmcircbuf_mmap_shm_open_factory::granularity ()
+{
+ return gr_pagesize ();
+}
+
+gr_vmcircbuf *
+gr_vmcircbuf_mmap_shm_open_factory::make (int size)
+{
+ try {
+ return new gr_vmcircbuf_mmap_shm_open (size);
+ }
+ catch (...){
+ return 0;
+ }
+}
diff --git a/gnuradio-core/src/lib/runtime/gr_vmcircbuf_mmap_shm_open.h b/gnuradio-core/src/lib/runtime/gr_vmcircbuf_mmap_shm_open.h
new file mode 100644
index 000000000..bcbbbac42
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_vmcircbuf_mmap_shm_open.h
@@ -0,0 +1,67 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2003 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 _GR_VMCIRCBUF_MMAP_SHM_OPEN_H_
+#define _GR_VMCIRCBUF_MMAP_SHM_OPEN_H_
+
+#include <gr_core_api.h>
+#include <gr_vmcircbuf.h>
+
+/*!
+ * \brief concrete class to implement circular buffers with mmap and shm_open
+ * \ingroup internal
+ */
+class GR_CORE_API gr_vmcircbuf_mmap_shm_open : public gr_vmcircbuf {
+ public:
+
+ // CREATORS
+
+ gr_vmcircbuf_mmap_shm_open (int size);
+ virtual ~gr_vmcircbuf_mmap_shm_open ();
+};
+
+/*!
+ * \brief concrete factory for circular buffers built using mmap and shm_open
+ */
+class GR_CORE_API gr_vmcircbuf_mmap_shm_open_factory : public gr_vmcircbuf_factory {
+ private:
+ static gr_vmcircbuf_factory *s_the_factory;
+
+ public:
+ static gr_vmcircbuf_factory *singleton ();
+
+ virtual const char *name () const { return "gr_vmcircbuf_mmap_shm_open_factory"; }
+
+ /*!
+ * \brief return granularity of mapping, typically equal to page size
+ */
+ virtual int granularity ();
+
+ /*!
+ * \brief return a gr_vmcircbuf, or 0 if unable.
+ *
+ * Call this to create a doubly mapped circular buffer.
+ */
+ virtual gr_vmcircbuf *make (int size);
+};
+
+#endif /* _GR_VMCIRCBUF_MMAP_SHM_OPEN_H_ */
diff --git a/gnuradio-core/src/lib/runtime/gr_vmcircbuf_mmap_tmpfile.cc b/gnuradio-core/src/lib/runtime/gr_vmcircbuf_mmap_tmpfile.cc
new file mode 100644
index 000000000..35de64699
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_vmcircbuf_mmap_tmpfile.cc
@@ -0,0 +1,197 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2003,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+#include <gr_vmcircbuf_mmap_tmpfile.h>
+#include <stdexcept>
+#include <assert.h>
+#include <unistd.h>
+#include <stdlib.h>
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_MMAN_H
+#include <sys/mman.h>
+#endif
+#include <fcntl.h>
+#include <errno.h>
+#include <stdio.h>
+#include <string.h>
+#include <gr_pagesize.h>
+#include <gr_sys_paths.h>
+
+gr_vmcircbuf_mmap_tmpfile::gr_vmcircbuf_mmap_tmpfile (int size)
+ : gr_vmcircbuf (size)
+{
+#if !defined(HAVE_MMAP)
+ fprintf (stderr, "gr_vmcircbuf_mmap_tmpfile: mmap or mkstemp is not available\n");
+ throw std::runtime_error ("gr_vmcircbuf_mmap_tmpfile");
+#else
+
+ if (size <= 0 || (size % gr_pagesize ()) != 0){
+ fprintf (stderr, "gr_vmcircbuf_mmap_tmpfile: invalid size = %d\n", size);
+ throw std::runtime_error ("gr_vmcircbuf_mmap_tmpfile");
+ }
+
+ int seg_fd = -1;
+ char seg_name[1024];
+
+ static int s_seg_counter = 0;
+
+
+ // open a temporary file that we'll map in a bit later
+
+ while (1){
+ snprintf (seg_name, sizeof (seg_name),
+ "%s/gnuradio-%d-%d-XXXXXX", gr_tmp_path (), getpid (), s_seg_counter);
+ s_seg_counter++;
+
+ seg_fd = open (seg_name, O_RDWR | O_CREAT | O_EXCL, 0600);
+ if (seg_fd == -1){
+ if (errno == EEXIST) // File already exists (shouldn't happen). Try again
+ continue;
+
+ char msg[1024];
+ snprintf (msg, sizeof (msg),
+ "gr_vmcircbuf_mmap_tmpfile: open [%s]", seg_name);
+ perror (msg);
+ throw std::runtime_error ("gr_vmcircbuf_mmap_tmpfile");
+ }
+ break;
+ }
+
+ if (unlink (seg_name) == -1){
+ perror ("gr_vmcircbuf_mmap_tmpfile: unlink");
+ throw std::runtime_error ("gr_vmcircbuf_mmap_tmpfile");
+ }
+
+ // We've got a valid file descriptor to a tmp file.
+ // Now set it's length to 2x what we really want and mmap it in.
+
+ if (ftruncate (seg_fd, (off_t) 2 * size) == -1){
+ close (seg_fd); // cleanup
+ perror ("gr_vmcircbuf_mmap_tmpfile: ftruncate (1)");
+ throw std::runtime_error ("gr_vmcircbuf_mmap_tmpfile");
+ }
+
+ void *first_copy = mmap (0, 2 * size,
+ PROT_READ | PROT_WRITE, MAP_SHARED,
+ seg_fd, (off_t) 0);
+
+ if (first_copy == MAP_FAILED){
+ close (seg_fd); // cleanup
+ perror ("gr_vmcircbuf_mmap_tmpfile: mmap (1)");
+ throw std::runtime_error ("gr_vmcircbuf_mmap_tmpfile");
+ }
+
+ // unmap the 2nd half
+ if (munmap ((char *) first_copy + size, size) == -1){
+ close (seg_fd); // cleanup
+ perror ("gr_vmcircbuf_mmap_tmpfile: munmap (1)");
+ throw std::runtime_error ("gr_vmcircbuf_mmap_tmpfile");
+ }
+
+ // map the first half into the now available hole where the
+ // second half used to be.
+
+ void *second_copy = mmap ((char *) first_copy + size, size,
+ PROT_READ | PROT_WRITE, MAP_SHARED,
+ seg_fd, (off_t) 0);
+
+ if (second_copy == MAP_FAILED){
+ munmap(first_copy, size); // cleanup
+ close (seg_fd);
+ perror ("gr_vmcircbuf_mmap_tmpfile: mmap (2)");
+ throw std::runtime_error ("gr_vmcircbuf_mmap_tmpfile");
+ }
+
+ // check for contiguity
+ if ((char *) second_copy != (char *) first_copy + size){
+ munmap(first_copy, size); // cleanup
+ munmap(second_copy, size);
+ close (seg_fd);
+ perror ("gr_vmcircbuf_mmap_tmpfile: non-contiguous second copy");
+ throw std::runtime_error ("gr_vmcircbuf_mmap_tmpfile");
+ }
+
+ // cut the tmp file down to size
+ if (ftruncate (seg_fd, (off_t) size) == -1){
+ munmap(first_copy, size); // cleanup
+ munmap(second_copy, size);
+ close (seg_fd);
+ perror ("gr_vmcircbuf_mmap_tmpfile: ftruncate (2)");
+ throw std::runtime_error ("gr_vmcircbuf_mmap_tmpfile");
+ }
+
+ close (seg_fd); // fd no longer needed. The mapping is retained.
+
+ // Now remember the important stuff
+
+ d_base = (char *) first_copy;
+ d_size = size;
+#endif
+}
+
+gr_vmcircbuf_mmap_tmpfile::~gr_vmcircbuf_mmap_tmpfile ()
+{
+#if defined(HAVE_MMAP)
+ if (munmap (d_base, 2 * d_size) == -1){
+ perror ("gr_vmcircbuf_mmap_tmpfile: munmap (2)");
+ }
+#endif
+}
+
+// ----------------------------------------------------------------
+// The factory interface
+// ----------------------------------------------------------------
+
+
+gr_vmcircbuf_factory *gr_vmcircbuf_mmap_tmpfile_factory::s_the_factory = 0;
+
+gr_vmcircbuf_factory *
+gr_vmcircbuf_mmap_tmpfile_factory::singleton ()
+{
+ if (s_the_factory)
+ return s_the_factory;
+
+ s_the_factory = new gr_vmcircbuf_mmap_tmpfile_factory ();
+ return s_the_factory;
+}
+
+int
+gr_vmcircbuf_mmap_tmpfile_factory::granularity ()
+{
+ return gr_pagesize ();
+}
+
+gr_vmcircbuf *
+gr_vmcircbuf_mmap_tmpfile_factory::make (int size)
+{
+ try {
+ return new gr_vmcircbuf_mmap_tmpfile (size);
+ }
+ catch (...){
+ return 0;
+ }
+}
diff --git a/gnuradio-core/src/lib/runtime/gr_vmcircbuf_mmap_tmpfile.h b/gnuradio-core/src/lib/runtime/gr_vmcircbuf_mmap_tmpfile.h
new file mode 100644
index 000000000..28ff31490
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_vmcircbuf_mmap_tmpfile.h
@@ -0,0 +1,67 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2003 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 _GR_VMCIRCBUF_MMAP_TMPFILE_H_
+#define _GR_VMCIRCBUF_MMAP_TMPFILE_H_
+
+#include <gr_core_api.h>
+#include <gr_vmcircbuf.h>
+
+/*!
+ * \brief concrete class to implement circular buffers with mmap and shm_open
+ * \ingroup internal
+ */
+class GR_CORE_API gr_vmcircbuf_mmap_tmpfile : public gr_vmcircbuf {
+ public:
+
+ // CREATORS
+
+ gr_vmcircbuf_mmap_tmpfile (int size);
+ virtual ~gr_vmcircbuf_mmap_tmpfile ();
+};
+
+/*!
+ * \brief concrete factory for circular buffers built using mmap and shm_open
+ */
+class GR_CORE_API gr_vmcircbuf_mmap_tmpfile_factory : public gr_vmcircbuf_factory {
+ private:
+ static gr_vmcircbuf_factory *s_the_factory;
+
+ public:
+ static gr_vmcircbuf_factory *singleton ();
+
+ virtual const char *name () const { return "gr_vmcircbuf_mmap_tmpfile_factory"; }
+
+ /*!
+ * \brief return granularity of mapping, typically equal to page size
+ */
+ virtual int granularity ();
+
+ /*!
+ * \brief return a gr_vmcircbuf, or 0 if unable.
+ *
+ * Call this to create a doubly mapped circular buffer.
+ */
+ virtual gr_vmcircbuf *make (int size);
+};
+
+#endif /* _GR_VMCIRCBUF_MMAP_TMPFILE_H_ */
diff --git a/gnuradio-core/src/lib/runtime/gr_vmcircbuf_sysv_shm.cc b/gnuradio-core/src/lib/runtime/gr_vmcircbuf_sysv_shm.cc
new file mode 100644
index 000000000..d9cf75e70
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_vmcircbuf_sysv_shm.cc
@@ -0,0 +1,194 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2003 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 <gr_vmcircbuf_sysv_shm.h>
+#include <stdexcept>
+#include <assert.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <fcntl.h>
+#ifdef HAVE_SYS_IPC_H
+#include <sys/ipc.h>
+#endif
+#ifdef HAVE_SYS_SHM_H
+#include <sys/shm.h>
+#endif
+#include <errno.h>
+#include <stdio.h>
+#include <gr_pagesize.h>
+
+
+gr_vmcircbuf_sysv_shm::gr_vmcircbuf_sysv_shm (int size)
+ : gr_vmcircbuf (size)
+{
+#if !defined(HAVE_SYS_SHM_H)
+ fprintf (stderr, "gr_vmcircbuf_sysv_shm: sysv shared memory is not available\n");
+ throw std::runtime_error ("gr_vmcircbuf_sysv_shm");
+#else
+
+ int pagesize = gr_pagesize();
+
+ if (size <= 0 || (size % pagesize) != 0){
+ fprintf (stderr, "gr_vmcircbuf_sysv_shm: invalid size = %d\n", size);
+ throw std::runtime_error ("gr_vmcircbuf_sysv_shm");
+ }
+
+ int shmid_guard = -1;
+ int shmid1 = -1;
+ int shmid2 = -1;
+
+ // We use this as a guard page. We'll map it read-only on both ends of the buffer.
+ // Ideally we'd map it no access, but I don't think that's possible with SysV
+ if ((shmid_guard = shmget (IPC_PRIVATE, pagesize, IPC_CREAT | 0400)) == -1){
+ perror ("gr_vmcircbuf_sysv_shm: shmget (0)");
+ throw std::runtime_error ("gr_vmcircbuf_sysv_shm");
+ }
+
+ if ((shmid2 = shmget (IPC_PRIVATE, 2 * size + 2 * pagesize, IPC_CREAT | 0700)) == -1){
+ perror ("gr_vmcircbuf_sysv_shm: shmget (1)");
+ shmctl (shmid_guard, IPC_RMID, 0);
+ throw std::runtime_error ("gr_vmcircbuf_sysv_shm");
+ }
+
+ if ((shmid1 = shmget (IPC_PRIVATE, size, IPC_CREAT | 0700)) == -1){
+ perror ("gr_vmcircbuf_sysv_shm: shmget (2)");
+ shmctl (shmid_guard, IPC_RMID, 0);
+ shmctl (shmid2, IPC_RMID, 0);
+ throw std::runtime_error ("gr_vmcircbuf_sysv_shm");
+ }
+
+ void *first_copy = shmat (shmid2, 0, 0);
+ if (first_copy == (void *) -1){
+ perror ("gr_vmcircbuf_sysv_shm: shmat (1)");
+ shmctl (shmid_guard, IPC_RMID, 0);
+ shmctl (shmid2, IPC_RMID, 0);
+ shmctl (shmid1, IPC_RMID, 0);
+ throw std::runtime_error ("gr_vmcircbuf_sysv_shm");
+ }
+
+ shmctl (shmid2, IPC_RMID, 0);
+
+ // There may be a race between our detach and attach.
+ //
+ // If the system allocates all shared memory segments at the same
+ // virtual addresses in all processes and if the system allocates
+ // some other segment to first_copy or first_copoy + size between
+ // our detach and attach, the attaches below could fail [I've never
+ // seen it fail for this reason].
+
+ shmdt (first_copy);
+
+ // first read-only guard page
+ if (shmat (shmid_guard, first_copy, SHM_RDONLY) == (void *) -1){
+ perror ("gr_vmcircbuf_sysv_shm: shmat (2)");
+ shmctl (shmid_guard, IPC_RMID, 0);
+ shmctl (shmid1, IPC_RMID, 0);
+ throw std::runtime_error ("gr_vmcircbuf_sysv_shm");
+ }
+
+ // first copy
+ if (shmat (shmid1, (char *) first_copy + pagesize, 0) == (void *) -1){
+ perror ("gr_vmcircbuf_sysv_shm: shmat (3)");
+ shmctl (shmid_guard, IPC_RMID, 0);
+ shmctl (shmid1, IPC_RMID, 0);
+ shmdt (first_copy);
+ throw std::runtime_error ("gr_vmcircbuf_sysv_shm");
+ }
+
+ // second copy
+ if (shmat (shmid1, (char *) first_copy + pagesize + size, 0) == (void *) -1){
+ perror ("gr_vmcircbuf_sysv_shm: shmat (4)");
+ shmctl (shmid_guard, IPC_RMID, 0);
+ shmctl (shmid1, IPC_RMID, 0);
+ shmdt ((char *)first_copy + pagesize);
+ throw std::runtime_error ("gr_vmcircbuf_sysv_shm");
+ }
+
+ // second read-only guard page
+ if (shmat (shmid_guard, (char *) first_copy + pagesize + 2 * size, SHM_RDONLY) == (void *) -1){
+ perror ("gr_vmcircbuf_sysv_shm: shmat (5)");
+ shmctl (shmid_guard, IPC_RMID, 0);
+ shmctl (shmid1, IPC_RMID, 0);
+ shmdt (first_copy);
+ shmdt ((char *)first_copy + pagesize);
+ shmdt ((char *)first_copy + pagesize + size);
+ throw std::runtime_error ("gr_vmcircbuf_sysv_shm");
+ }
+
+ shmctl (shmid1, IPC_RMID, 0);
+ shmctl (shmid_guard, IPC_RMID, 0);
+
+ // Now remember the important stuff
+
+ d_base = (char *) first_copy + pagesize;
+ d_size = size;
+#endif
+}
+
+gr_vmcircbuf_sysv_shm::~gr_vmcircbuf_sysv_shm ()
+{
+#if defined(HAVE_SYS_SHM_H)
+ if (shmdt (d_base - gr_pagesize()) == -1
+ || shmdt (d_base) == -1
+ || shmdt (d_base + d_size) == -1
+ || shmdt (d_base + 2 * d_size) == -1){
+ perror ("gr_vmcircbuf_sysv_shm: shmdt (2)");
+ }
+#endif
+}
+
+// ----------------------------------------------------------------
+// The factory interface
+// ----------------------------------------------------------------
+
+
+gr_vmcircbuf_factory *gr_vmcircbuf_sysv_shm_factory::s_the_factory = 0;
+
+gr_vmcircbuf_factory *
+gr_vmcircbuf_sysv_shm_factory::singleton ()
+{
+ if (s_the_factory)
+ return s_the_factory;
+
+ s_the_factory = new gr_vmcircbuf_sysv_shm_factory ();
+ return s_the_factory;
+}
+
+int
+gr_vmcircbuf_sysv_shm_factory::granularity ()
+{
+ return gr_pagesize ();
+}
+
+gr_vmcircbuf *
+gr_vmcircbuf_sysv_shm_factory::make (int size)
+{
+ try {
+ return new gr_vmcircbuf_sysv_shm (size);
+ }
+ catch (...){
+ return 0;
+ }
+}
diff --git a/gnuradio-core/src/lib/runtime/gr_vmcircbuf_sysv_shm.h b/gnuradio-core/src/lib/runtime/gr_vmcircbuf_sysv_shm.h
new file mode 100644
index 000000000..9f5c04f0d
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_vmcircbuf_sysv_shm.h
@@ -0,0 +1,67 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2003 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 _GR_VMCIRCBUF_SYSV_SHM_H_
+#define _GR_VMCIRCBUF_SYSV_SHM_H_
+
+#include <gr_core_api.h>
+#include <gr_vmcircbuf.h>
+
+/*!
+ * \brief concrete class to implement circular buffers with mmap and shm_open
+ * \ingroup internal
+ */
+class GR_CORE_API gr_vmcircbuf_sysv_shm : public gr_vmcircbuf {
+ public:
+
+ // CREATORS
+
+ gr_vmcircbuf_sysv_shm (int size);
+ virtual ~gr_vmcircbuf_sysv_shm ();
+};
+
+/*!
+ * \brief concrete factory for circular buffers built using mmap and shm_open
+ */
+class GR_CORE_API gr_vmcircbuf_sysv_shm_factory : public gr_vmcircbuf_factory {
+ private:
+ static gr_vmcircbuf_factory *s_the_factory;
+
+ public:
+ static gr_vmcircbuf_factory *singleton ();
+
+ virtual const char *name () const { return "gr_vmcircbuf_sysv_shm_factory"; }
+
+ /*!
+ * \brief return granularity of mapping, typically equal to page size
+ */
+ virtual int granularity ();
+
+ /*!
+ * \brief return a gr_vmcircbuf, or 0 if unable.
+ *
+ * Call this to create a doubly mapped circular buffer.
+ */
+ virtual gr_vmcircbuf *make (int size);
+};
+
+#endif /* _GR_VMCIRCBUF_SYSV_SHM_H_ */
diff --git a/gnuradio-core/src/lib/runtime/pmx_helper.hpp b/gnuradio-core/src/lib/runtime/pmx_helper.hpp
new file mode 100644
index 000000000..44cc2997c
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/pmx_helper.hpp
@@ -0,0 +1,268 @@
+/*
+ * Copyright 2012-2013 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_LIBGRAS_PMX_HELPER_HPP
+#define INCLUDED_LIBGRAS_PMX_HELPER_HPP
+
+#include <PMC/PMC.hpp>
+#include <PMC/Containers.hpp>
+#include <gruel/pmt.h>
+#include <boost/foreach.hpp>
+
+namespace pmt
+{
+
+inline pmt_t pmc_to_pmt(const PMCC &p)
+{
+ //the container is null
+ if (not p) return pmt::pmt_t();
+
+ #define decl_pmc_to_pmt(type, conv) if (p.is<type >()) return conv(p.as<type >())
+
+ //bool
+ decl_pmc_to_pmt(bool, pmt_from_bool);
+
+ //string
+ decl_pmc_to_pmt(std::string, pmt_string_to_symbol);
+
+ //numeric types
+ decl_pmc_to_pmt(int8_t, pmt_from_long);
+ decl_pmc_to_pmt(int16_t, pmt_from_long);
+ decl_pmc_to_pmt(int32_t, pmt_from_long);
+ decl_pmc_to_pmt(uint8_t, pmt_from_long);
+ decl_pmc_to_pmt(uint16_t, pmt_from_long);
+ decl_pmc_to_pmt(uint32_t, pmt_from_long);
+ decl_pmc_to_pmt(int64_t, pmt_from_uint64);
+ decl_pmc_to_pmt(uint64_t, pmt_from_uint64);
+ decl_pmc_to_pmt(float, pmt_from_double);
+ decl_pmc_to_pmt(double, pmt_from_double);
+ #define pmt_from_complex(x) pmt_make_rectangular((x).real(), (x).imag())
+ decl_pmc_to_pmt(std::complex<float>, pmt_from_complex);
+ decl_pmc_to_pmt(std::complex<double>, pmt_from_complex);
+
+ //pair container
+ if (p.is<PMCPair>())
+ {
+ const PMCPair &pr = p.as<PMCPair>();
+ return pmt_cons(pmc_to_pmt(pr.first), pmc_to_pmt(pr.second));
+ }
+
+ //fucking tuples
+/*
+for i in range(11):
+ args = list()
+ for j in range(i):
+ args.append('pmc_to_pmt(p.as<PMCTuple<%d> >()[%d])'%(i, j))
+ print ' if (p.is<PMCTuple<%d> >())'%i
+ print ' return pmt_make_tuple(%s);'%(', '.join(args),)
+*/
+ if (p.is<PMCTuple<0> >())
+ return pmt_make_tuple();
+ if (p.is<PMCTuple<1> >())
+ return pmt_make_tuple(pmc_to_pmt(p.as<PMCTuple<1> >()[0]));
+ if (p.is<PMCTuple<2> >())
+ return pmt_make_tuple(pmc_to_pmt(p.as<PMCTuple<2> >()[0]), pmc_to_pmt(p.as<PMCTuple<2> >()[1]));
+ if (p.is<PMCTuple<3> >())
+ return pmt_make_tuple(pmc_to_pmt(p.as<PMCTuple<3> >()[0]), pmc_to_pmt(p.as<PMCTuple<3> >()[1]), pmc_to_pmt(p.as<PMCTuple<3> >()[2]));
+ if (p.is<PMCTuple<4> >())
+ return pmt_make_tuple(pmc_to_pmt(p.as<PMCTuple<4> >()[0]), pmc_to_pmt(p.as<PMCTuple<4> >()[1]), pmc_to_pmt(p.as<PMCTuple<4> >()[2]), pmc_to_pmt(p.as<PMCTuple<4> >()[3]));
+ if (p.is<PMCTuple<5> >())
+ return pmt_make_tuple(pmc_to_pmt(p.as<PMCTuple<5> >()[0]), pmc_to_pmt(p.as<PMCTuple<5> >()[1]), pmc_to_pmt(p.as<PMCTuple<5> >()[2]), pmc_to_pmt(p.as<PMCTuple<5> >()[3]), pmc_to_pmt(p.as<PMCTuple<5> >()[4]));
+ if (p.is<PMCTuple<6> >())
+ return pmt_make_tuple(pmc_to_pmt(p.as<PMCTuple<6> >()[0]), pmc_to_pmt(p.as<PMCTuple<6> >()[1]), pmc_to_pmt(p.as<PMCTuple<6> >()[2]), pmc_to_pmt(p.as<PMCTuple<6> >()[3]), pmc_to_pmt(p.as<PMCTuple<6> >()[4]), pmc_to_pmt(p.as<PMCTuple<6> >()[5]));
+ if (p.is<PMCTuple<7> >())
+ return pmt_make_tuple(pmc_to_pmt(p.as<PMCTuple<7> >()[0]), pmc_to_pmt(p.as<PMCTuple<7> >()[1]), pmc_to_pmt(p.as<PMCTuple<7> >()[2]), pmc_to_pmt(p.as<PMCTuple<7> >()[3]), pmc_to_pmt(p.as<PMCTuple<7> >()[4]), pmc_to_pmt(p.as<PMCTuple<7> >()[5]), pmc_to_pmt(p.as<PMCTuple<7> >()[6]));
+ if (p.is<PMCTuple<8> >())
+ return pmt_make_tuple(pmc_to_pmt(p.as<PMCTuple<8> >()[0]), pmc_to_pmt(p.as<PMCTuple<8> >()[1]), pmc_to_pmt(p.as<PMCTuple<8> >()[2]), pmc_to_pmt(p.as<PMCTuple<8> >()[3]), pmc_to_pmt(p.as<PMCTuple<8> >()[4]), pmc_to_pmt(p.as<PMCTuple<8> >()[5]), pmc_to_pmt(p.as<PMCTuple<8> >()[6]), pmc_to_pmt(p.as<PMCTuple<8> >()[7]));
+ if (p.is<PMCTuple<9> >())
+ return pmt_make_tuple(pmc_to_pmt(p.as<PMCTuple<9> >()[0]), pmc_to_pmt(p.as<PMCTuple<9> >()[1]), pmc_to_pmt(p.as<PMCTuple<9> >()[2]), pmc_to_pmt(p.as<PMCTuple<9> >()[3]), pmc_to_pmt(p.as<PMCTuple<9> >()[4]), pmc_to_pmt(p.as<PMCTuple<9> >()[5]), pmc_to_pmt(p.as<PMCTuple<9> >()[6]), pmc_to_pmt(p.as<PMCTuple<9> >()[7]), pmc_to_pmt(p.as<PMCTuple<9> >()[8]));
+ if (p.is<PMCTuple<10> >())
+ return pmt_make_tuple(pmc_to_pmt(p.as<PMCTuple<10> >()[0]), pmc_to_pmt(p.as<PMCTuple<10> >()[1]), pmc_to_pmt(p.as<PMCTuple<10> >()[2]), pmc_to_pmt(p.as<PMCTuple<10> >()[3]), pmc_to_pmt(p.as<PMCTuple<10> >()[4]), pmc_to_pmt(p.as<PMCTuple<10> >()[5]), pmc_to_pmt(p.as<PMCTuple<10> >()[6]), pmc_to_pmt(p.as<PMCTuple<10> >()[7]), pmc_to_pmt(p.as<PMCTuple<10> >()[8]), pmc_to_pmt(p.as<PMCTuple<10> >()[9]));
+
+ //vector container
+ if (p.is<PMCList>())
+ {
+ const PMCList &l = p.as<PMCList>();
+ pmt_t v = pmt_make_vector(l.size(), pmt_t());
+ for (size_t i = 0; i < l.size(); i++)
+ {
+ pmt_vector_set(v, i, pmc_to_pmt(l[i]));
+ }
+ return v;
+ }
+
+ //numeric arrays
+ #define decl_pmc_to_pmt_numeric_array(type, suffix) \
+ if (p.is<std::vector<type> >()) return pmt_init_ ## suffix ## vector(p.as<std::vector<type> >().size(), &p.as<std::vector<type> >()[0])
+ decl_pmc_to_pmt_numeric_array(uint8_t, u8);
+ decl_pmc_to_pmt_numeric_array(uint16_t, u16);
+ decl_pmc_to_pmt_numeric_array(uint32_t, u32);
+ decl_pmc_to_pmt_numeric_array(uint64_t, u64);
+ decl_pmc_to_pmt_numeric_array(int8_t, s8);
+ decl_pmc_to_pmt_numeric_array(int16_t, s16);
+ decl_pmc_to_pmt_numeric_array(int32_t, s32);
+ decl_pmc_to_pmt_numeric_array(int64_t, s64);
+ decl_pmc_to_pmt_numeric_array(float, f32);
+ decl_pmc_to_pmt_numeric_array(double, f64);
+ decl_pmc_to_pmt_numeric_array(std::complex<float>, c32);
+ decl_pmc_to_pmt_numeric_array(std::complex<double>, c64);
+
+ //dictionary container
+ if (p.is<PMCDict>())
+ {
+ const PMCDict &m = p.as<PMCDict>();
+ pmt_t d = pmt_make_dict();
+ BOOST_FOREACH(const PMCPair &pr, m)
+ {
+ d = pmt_dict_add(d, pmc_to_pmt(pr.first), pmc_to_pmt(pr.second));
+ }
+ return d;
+ }
+
+ //set container
+ if (p.is<PMCSet>())
+ {
+ const PMCSet &s = p.as<PMCSet>();
+ pmt_t l = PMT_NIL;
+ BOOST_FOREACH(const PMCC &elem, s)
+ {
+ l = pmt_list_add(l, pmc_to_pmt(elem));
+ }
+ return l;
+ }
+
+ //is it already a pmt?
+ if (p.is<pmt_t>()) return p.as<pmt_t>();
+
+ //backup plan... boost::any
+ return pmt_make_any(p);
+
+}
+
+inline PMCC pmt_to_pmc(const pmt_t &p)
+{
+ //if the container null?
+ if (not p) return PMC();
+
+ #define decl_pmt_to_pmc(check, conv) if (check(p)) return PMC_M(conv(p))
+
+ //bool
+ decl_pmt_to_pmc(pmt_is_bool, pmt_to_bool);
+
+ //string (do object interning for strings)
+ decl_pmt_to_pmc(pmt_is_symbol, pmt_symbol_to_string).intern();
+
+ //numeric types
+ decl_pmt_to_pmc(pmt_is_integer, pmt_to_long);
+ decl_pmt_to_pmc(pmt_is_uint64, pmt_to_uint64);
+ decl_pmt_to_pmc(pmt_is_real, pmt_to_double);
+ decl_pmt_to_pmc(pmt_is_complex, pmt_to_complex);
+
+ //is it a boost any holding a PMCC?
+ if (pmt_is_any(p))
+ {
+ const boost::any a = pmt_any_ref(p);
+ if (a.type() == typeid(PMCC)) return boost::any_cast<PMCC>(a);
+ }
+
+ //pair container
+ if (pmt_is_pair(p))
+ {
+ PMCPair pr(pmt_to_pmc(pmt_car(p)), pmt_to_pmc(pmt_cdr(p)));
+ return PMC_M(pr);
+ }
+
+ //fucking tuples
+ #define decl_pmt_to_pmc_tuple(n) \
+ if (pmt_is_tuple(p) and pmt_length(p) == n) \
+ { \
+ PMCTuple<n> t; \
+ for (size_t i = 0; i < n; i++) t[i] = pmt_to_pmc(pmt_tuple_ref(p, i)); \
+ return PMC_M(t); \
+ }
+ decl_pmt_to_pmc_tuple(0);
+ decl_pmt_to_pmc_tuple(1);
+ decl_pmt_to_pmc_tuple(2);
+ decl_pmt_to_pmc_tuple(3);
+ decl_pmt_to_pmc_tuple(4);
+ decl_pmt_to_pmc_tuple(5);
+ decl_pmt_to_pmc_tuple(6);
+ decl_pmt_to_pmc_tuple(7);
+ decl_pmt_to_pmc_tuple(8);
+ decl_pmt_to_pmc_tuple(9);
+ decl_pmt_to_pmc_tuple(10);
+
+ //vector container
+ if (pmt_is_vector(p))
+ {
+ PMCList l(pmt_length(p));
+ for (size_t i = 0; i < l.size(); i++)
+ {
+ l[i] = pmt_to_pmc(pmt_vector_ref(p, i));
+ }
+ return PMC_M(l);
+ }
+
+ //numeric arrays
+ #define decl_pmt_to_pmc_numeric_array(type, suffix) \
+ if (pmt_is_ ## suffix ## vector(p)) \
+ { \
+ size_t n; const type* i = pmt_ ## suffix ## vector_elements(p, n); \
+ return PMC_M(std::vector<type>(i, i+n)); \
+ }
+ decl_pmt_to_pmc_numeric_array(uint8_t, u8);
+ decl_pmt_to_pmc_numeric_array(uint16_t, u16);
+ decl_pmt_to_pmc_numeric_array(uint32_t, u32);
+ decl_pmt_to_pmc_numeric_array(uint64_t, u64);
+ decl_pmt_to_pmc_numeric_array(int8_t, s8);
+ decl_pmt_to_pmc_numeric_array(int16_t, s16);
+ decl_pmt_to_pmc_numeric_array(int32_t, s32);
+ decl_pmt_to_pmc_numeric_array(int64_t, s64);
+ decl_pmt_to_pmc_numeric_array(float, f32);
+ decl_pmt_to_pmc_numeric_array(double, f64);
+ decl_pmt_to_pmc_numeric_array(std::complex<float>, c32);
+ decl_pmt_to_pmc_numeric_array(std::complex<double>, c64);
+
+ //dictionary container
+ if (pmt_is_dict(p))
+ {
+ PMCDict m;
+ pmt_t items = pmt_dict_items(p);
+ for (size_t i = 0; i < pmt_length(items); i++)
+ {
+ pmt_t item = pmt_nth(i, items);
+ PMCC key = pmt_to_pmc(pmt_car(item));
+ PMCC val = pmt_to_pmc(pmt_cdr(item));
+ m[key] = val;
+ }
+ return PMC_M(m);
+ }
+
+ //set container
+ //FIXME no pmt_is_list...
+
+ //backup plan... store the pmt
+ return PMC_M(p);
+}
+
+}
+
+#endif /*INCLUDED_LIBGRAS_PMX_HELPER_HPP*/
diff --git a/gnuradio-core/src/lib/runtime/qa_block_tags.cc b/gnuradio-core/src/lib/runtime/qa_block_tags.cc
new file mode 100644
index 000000000..d6b1065e3
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/qa_block_tags.cc
@@ -0,0 +1,450 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <qa_block_tags.h>
+#include <gr_block.h>
+#include <gr_top_block.h>
+#include <gr_null_source.h>
+#include <gr_null_sink.h>
+#include <gr_head.h>
+#include <gr_annotator_alltoall.h>
+#include <gr_annotator_1to1.h>
+#include <gr_keep_one_in_n.h>
+#include <gr_firdes.h>
+#include <gr_tags.h>
+
+
+// ----------------------------------------------------------------
+
+using namespace pmt;
+
+// set to 1 to turn on debug output
+// The debug output fully checks that the tags seen are what are expected. While
+// this behavior currently works with our implementation, there is no guarentee
+// that the tags will be coming in this specific order, so it's dangerous to
+// rely on this as a test of the tag system working. We would really want to
+// tags we know we should see and then test that they all occur once, but in no
+// particular order.
+#define QA_TAGS_DEBUG 0
+
+void
+qa_block_tags::t0 ()
+{
+ unsigned int N = 1000;
+ gr_top_block_sptr tb = gr_make_top_block("top");
+ gr_block_sptr src (gr_make_null_source(sizeof(int)));
+ gr_block_sptr head (gr_make_head(sizeof(int), N));
+ gr_block_sptr snk (gr_make_null_sink(sizeof(int)));
+
+ tb->connect(src, 0, head, 0);
+ tb->connect(head, 0, snk, 0);
+
+ //CPPUNIT_ASSERT_THROW(src->nitems_read(0), std::runtime_error);
+ //CPPUNIT_ASSERT_THROW(src->nitems_written(0), std::runtime_error);
+ CPPUNIT_ASSERT_EQUAL(src->nitems_read(0), (uint64_t)0);
+ CPPUNIT_ASSERT_EQUAL(src->nitems_written(0), (uint64_t)0);
+
+ tb->run();
+
+ CPPUNIT_ASSERT_THROW(src->nitems_read(0), std::invalid_argument);
+ CPPUNIT_ASSERT(src->nitems_written(0) >= N);
+ CPPUNIT_ASSERT_EQUAL(snk->nitems_read(0), (uint64_t)1000);
+ CPPUNIT_ASSERT_THROW(snk->nitems_written(0), std::invalid_argument);
+}
+
+
+void
+qa_block_tags::t1 ()
+{
+ int N = 40000;
+ gr_top_block_sptr tb = gr_make_top_block("top");
+ gr_block_sptr src (gr_make_null_source(sizeof(int)));
+ gr_block_sptr head (gr_make_head(sizeof(int), N));
+ gr_annotator_alltoall_sptr ann0 (gr_make_annotator_alltoall(10000, sizeof(int)));
+ gr_annotator_alltoall_sptr ann1 (gr_make_annotator_alltoall(10000, sizeof(int)));
+ gr_annotator_alltoall_sptr ann2 (gr_make_annotator_alltoall(10000, sizeof(int)));
+ gr_annotator_alltoall_sptr ann3 (gr_make_annotator_alltoall(10000, sizeof(int)));
+ gr_annotator_alltoall_sptr ann4 (gr_make_annotator_alltoall(10000, sizeof(int)));
+ gr_block_sptr snk0 (gr_make_null_sink(sizeof(int)));
+ gr_block_sptr snk1 (gr_make_null_sink(sizeof(int)));
+
+ tb->connect(src, 0, head, 0);
+ tb->connect(head, 0, ann0, 0);
+
+ tb->connect(ann0, 0, ann1, 0);
+ tb->connect(ann0, 1, ann2, 0);
+ tb->connect(ann1, 0, ann3, 0);
+ tb->connect(ann2, 0, ann4, 0);
+
+ tb->connect(ann3, 0, snk0, 0);
+ tb->connect(ann4, 0, snk1, 0);
+
+ tb->run();
+
+ std::vector<gr_tag_t> tags0 = ann0->data();
+ std::vector<gr_tag_t> tags3 = ann3->data();
+ std::vector<gr_tag_t> tags4 = ann4->data();
+
+ // The first annotator does not receive any tags from the null sink upstream
+ CPPUNIT_ASSERT_EQUAL(tags0.size(), (size_t)0);
+ CPPUNIT_ASSERT_EQUAL(tags3.size(), (size_t)8);
+ CPPUNIT_ASSERT_EQUAL(tags4.size(), (size_t)8);
+
+#if QA_TAGS_DEBUG
+ // Kludge together the tags that we know should result from the above graph
+ std::stringstream str0, str1, str2;
+ str0 << ann0->name() << ann0->unique_id();
+ str1 << ann1->name() << ann1->unique_id();
+ str2 << ann2->name() << ann2->unique_id();
+
+ pmt_t expected_tags3[8];
+ expected_tags3[0] = mp(pmt_from_uint64(0), mp(str1.str()), mp("seq"), mp(0));
+ expected_tags3[1] = mp(pmt_from_uint64(0), mp(str0.str()), mp("seq"), mp(0));
+ expected_tags3[2] = mp(pmt_from_uint64(10000), mp(str1.str()), mp("seq"), mp(1));
+ expected_tags3[3] = mp(pmt_from_uint64(10000), mp(str0.str()), mp("seq"), mp(2));
+ expected_tags3[4] = mp(pmt_from_uint64(20000), mp(str1.str()), mp("seq"), mp(2));
+ expected_tags3[5] = mp(pmt_from_uint64(20000), mp(str0.str()), mp("seq"), mp(4));
+ expected_tags3[6] = mp(pmt_from_uint64(30000), mp(str1.str()), mp("seq"), mp(3));
+ expected_tags3[7] = mp(pmt_from_uint64(30000), mp(str0.str()), mp("seq"), mp(6));
+
+ pmt_t expected_tags4[8];
+ expected_tags4[0] = mp(pmt_from_uint64(0), mp(str2.str()), mp("seq"), mp(0));
+ expected_tags4[1] = mp(pmt_from_uint64(0), mp(str0.str()), mp("seq"), mp(1));
+ expected_tags4[2] = mp(pmt_from_uint64(10000), mp(str2.str()), mp("seq"), mp(1));
+ expected_tags4[3] = mp(pmt_from_uint64(10000), mp(str0.str()), mp("seq"), mp(3));
+ expected_tags4[4] = mp(pmt_from_uint64(20000), mp(str2.str()), mp("seq"), mp(2));
+ expected_tags4[5] = mp(pmt_from_uint64(20000), mp(str0.str()), mp("seq"), mp(5));
+ expected_tags4[6] = mp(pmt_from_uint64(30000), mp(str2.str()), mp("seq"), mp(3));
+ expected_tags4[7] = mp(pmt_from_uint64(30000), mp(str0.str()), mp("seq"), mp(7));
+
+ std::cout << std::endl << "qa_block_tags::t1" << std::endl;
+
+ // For annotator 3, we know it gets tags from ann0 and ann1, test this
+ for(size_t i = 0; i < tags3.size(); i++) {
+ std::cout << "tags3[" << i << "] = " << tags3[i] << "\t\t" << expected_tags3[i] << std::endl;
+ CPPUNIT_ASSERT_EQUAL(pmt_write_string(tags3[i]), pmt_write_string(expected_tags3[i]));
+ }
+
+ // For annotator 4, we know it gets tags from ann0 and ann2, test this
+ std::cout << std::endl;
+ for(size_t i = 0; i < tags4.size(); i++) {
+ std::cout << "tags4[" << i << "] = " << tags4[i] << "\t\t" << expected_tags4[i] << std::endl;
+ CPPUNIT_ASSERT_EQUAL(pmt_write_string(tags4[i]), pmt_write_string(expected_tags4[i]));
+ }
+#endif
+}
+
+void
+qa_block_tags::t2 ()
+{
+ int N = 40000;
+ gr_top_block_sptr tb = gr_make_top_block("top");
+ gr_block_sptr src (gr_make_null_source(sizeof(int)));
+ gr_block_sptr head (gr_make_head(sizeof(int), N));
+ gr_annotator_alltoall_sptr ann0 (gr_make_annotator_alltoall(10000, sizeof(int)));
+ gr_annotator_alltoall_sptr ann1 (gr_make_annotator_alltoall(10000, sizeof(int)));
+ gr_annotator_alltoall_sptr ann2 (gr_make_annotator_alltoall(10000, sizeof(int)));
+ gr_annotator_alltoall_sptr ann3 (gr_make_annotator_alltoall(10000, sizeof(int)));
+ gr_annotator_alltoall_sptr ann4 (gr_make_annotator_alltoall(10000, sizeof(int)));
+ gr_block_sptr snk0 (gr_make_null_sink(sizeof(int)));
+ gr_block_sptr snk1 (gr_make_null_sink(sizeof(int)));
+ gr_block_sptr snk2 (gr_make_null_sink(sizeof(int)));
+
+ tb->connect(src, 0, head, 0);
+ tb->connect(head, 0, ann0, 0);
+
+ tb->connect(ann0, 0, ann1, 0);
+ tb->connect(ann0, 1, ann1, 1);
+ tb->connect(ann1, 0, ann2, 0);
+ tb->connect(ann1, 1, ann3, 0);
+ tb->connect(ann1, 2, ann4, 0);
+
+ tb->connect(ann2, 0, snk0, 0);
+ tb->connect(ann3, 0, snk1, 0);
+ tb->connect(ann4, 0, snk2, 0);
+
+ tb->run();
+
+ std::vector<gr_tag_t> tags0 = ann0->data();
+ std::vector<gr_tag_t> tags1 = ann1->data();
+ std::vector<gr_tag_t> tags2 = ann2->data();
+ std::vector<gr_tag_t> tags3 = ann4->data();
+ std::vector<gr_tag_t> tags4 = ann4->data();
+
+ // The first annotator does not receive any tags from the null sink upstream
+ CPPUNIT_ASSERT_EQUAL(tags0.size(), (size_t)0);
+ CPPUNIT_ASSERT_EQUAL(tags1.size(), (size_t)8);
+
+ // Make sure the rest all have 12 tags
+ CPPUNIT_ASSERT_EQUAL(tags2.size(), (size_t)12);
+ CPPUNIT_ASSERT_EQUAL(tags3.size(), (size_t)12);
+ CPPUNIT_ASSERT_EQUAL(tags4.size(), (size_t)12);
+
+
+#if QA_TAGS_DEBUG
+ // Kludge together the tags that we know should result from the above graph
+ std::stringstream str0, str1;
+ str0 << ann0->name() << ann0->unique_id();
+ str1 << ann1->name() << ann1->unique_id();
+
+ pmt_t expected_tags2[12];
+ expected_tags2[0] = mp(pmt_from_uint64(0), mp(str1.str()), mp("seq"), mp(0));
+ expected_tags2[1] = mp(pmt_from_uint64(0), mp(str0.str()), mp("seq"), mp(0));
+ expected_tags2[2] = mp(pmt_from_uint64(0), mp(str0.str()), mp("seq"), mp(1));
+ expected_tags2[3] = mp(pmt_from_uint64(10000), mp(str1.str()), mp("seq"), mp(3));
+ expected_tags2[4] = mp(pmt_from_uint64(10000), mp(str0.str()), mp("seq"), mp(2));
+ expected_tags2[5] = mp(pmt_from_uint64(10000), mp(str0.str()), mp("seq"), mp(3));
+ expected_tags2[6] = mp(pmt_from_uint64(20000), mp(str1.str()), mp("seq"), mp(6));
+ expected_tags2[7] = mp(pmt_from_uint64(20000), mp(str0.str()), mp("seq"), mp(4));
+ expected_tags2[8] = mp(pmt_from_uint64(20000), mp(str0.str()), mp("seq"), mp(5));
+ expected_tags2[9] = mp(pmt_from_uint64(30000), mp(str1.str()), mp("seq"), mp(9));
+ expected_tags2[10] = mp(pmt_from_uint64(30000), mp(str0.str()), mp("seq"), mp(6));
+ expected_tags2[11] = mp(pmt_from_uint64(30000), mp(str0.str()), mp("seq"), mp(7));
+
+ pmt_t expected_tags4[12];
+ expected_tags4[0] = mp(pmt_from_uint64(0), mp(str1.str()), mp("seq"), mp(2));
+ expected_tags4[1] = mp(pmt_from_uint64(0), mp(str0.str()), mp("seq"), mp(0));
+ expected_tags4[2] = mp(pmt_from_uint64(0), mp(str0.str()), mp("seq"), mp(1));
+ expected_tags4[3] = mp(pmt_from_uint64(10000), mp(str1.str()), mp("seq"), mp(5));
+ expected_tags4[4] = mp(pmt_from_uint64(10000), mp(str0.str()), mp("seq"), mp(2));
+ expected_tags4[5] = mp(pmt_from_uint64(10000), mp(str0.str()), mp("seq"), mp(3));
+ expected_tags4[6] = mp(pmt_from_uint64(20000), mp(str1.str()), mp("seq"), mp(8));
+ expected_tags4[7] = mp(pmt_from_uint64(20000), mp(str0.str()), mp("seq"), mp(4));
+ expected_tags4[8] = mp(pmt_from_uint64(20000), mp(str0.str()), mp("seq"), mp(5));
+ expected_tags4[9] = mp(pmt_from_uint64(30000), mp(str1.str()), mp("seq"), mp(11));
+ expected_tags4[10] = mp(pmt_from_uint64(30000), mp(str0.str()), mp("seq"), mp(6));
+ expected_tags4[11] = mp(pmt_from_uint64(30000), mp(str0.str()), mp("seq"), mp(7));
+
+ std::cout << std::endl << "qa_block_tags::t2" << std::endl;
+
+ // For annotator[2-4], we know it gets tags from ann0 and ann1
+ // but the tags from the different outputs of ann1 are different for each.
+ // Just testing ann2 and ann4; if they are correct it would be
+ // inconceivable for ann3 to have it wrong.
+ for(size_t i = 0; i < tags2.size(); i++) {
+ std::cout << "tags2[" << i << "] = " << tags2[i] << "\t\t" << expected_tags2[i] << std::endl;
+ CPPUNIT_ASSERT_EQUAL(pmt_write_string(tags2[i]), pmt_write_string(expected_tags2[i]));
+ }
+
+ std::cout << std::endl;
+ for(size_t i = 0; i < tags4.size(); i++) {
+ std::cout << "tags2[" << i << "] = " << tags4[i] << "\t\t" << expected_tags4[i] << std::endl;
+ CPPUNIT_ASSERT_EQUAL(pmt_write_string(tags4[i]), pmt_write_string(expected_tags4[i]));
+ }
+#endif
+}
+
+
+void
+qa_block_tags::t3 ()
+{
+ int N = 40000;
+ gr_top_block_sptr tb = gr_make_top_block("top");
+ gr_block_sptr src (gr_make_null_source(sizeof(int)));
+ gr_block_sptr head (gr_make_head(sizeof(int), N));
+ gr_annotator_1to1_sptr ann0 (gr_make_annotator_1to1(10000, sizeof(int)));
+ gr_annotator_alltoall_sptr ann1 (gr_make_annotator_alltoall(10000, sizeof(int)));
+ gr_annotator_alltoall_sptr ann2 (gr_make_annotator_alltoall(10000, sizeof(int)));
+ gr_annotator_1to1_sptr ann3 (gr_make_annotator_1to1(10000, sizeof(int)));
+ gr_annotator_1to1_sptr ann4 (gr_make_annotator_1to1(10000, sizeof(int)));
+ gr_block_sptr snk0 (gr_make_null_sink(sizeof(int)));
+ gr_block_sptr snk1 (gr_make_null_sink(sizeof(int)));
+
+ tb->connect(src, 0, head, 0);
+ tb->connect(head, 0, ann0, 0);
+ tb->connect(head, 0, ann0, 1);
+
+ tb->connect(ann0, 0, ann1, 0);
+ tb->connect(ann0, 1, ann2, 0);
+ tb->connect(ann1, 0, ann3, 0);
+ tb->connect(ann2, 0, ann4, 0);
+
+ tb->connect(ann3, 0, snk0, 0);
+ tb->connect(ann4, 0, snk1, 0);
+
+ tb->run();
+
+
+ std::vector<gr_tag_t> tags0 = ann0->data();
+ std::vector<gr_tag_t> tags3 = ann3->data();
+ std::vector<gr_tag_t> tags4 = ann4->data();
+
+ // The first annotator does not receive any tags from the null sink upstream
+ CPPUNIT_ASSERT_EQUAL(tags0.size(), (size_t)0);
+ CPPUNIT_ASSERT_EQUAL(tags3.size(), (size_t)8);
+ CPPUNIT_ASSERT_EQUAL(tags4.size(), (size_t)8);
+
+#if QA_TAGS_DEBUG
+ // Kludge together the tags that we know should result from the above graph
+ std::stringstream str0, str1, str2;
+ str0 << ann0->name() << ann0->unique_id();
+ str1 << ann1->name() << ann1->unique_id();
+ str2 << ann2->name() << ann2->unique_id();
+
+ pmt_t expected_tags3[8];
+ expected_tags3[0] = mp(pmt_from_uint64(0), mp(str1.str()), mp("seq"), mp(0));
+ expected_tags3[1] = mp(pmt_from_uint64(0), mp(str0.str()), mp("seq"), mp(0));
+ expected_tags3[2] = mp(pmt_from_uint64(10000), mp(str1.str()), mp("seq"), mp(1));
+ expected_tags3[3] = mp(pmt_from_uint64(10000), mp(str0.str()), mp("seq"), mp(2));
+ expected_tags3[4] = mp(pmt_from_uint64(20000), mp(str1.str()), mp("seq"), mp(2));
+ expected_tags3[5] = mp(pmt_from_uint64(20000), mp(str0.str()), mp("seq"), mp(4));
+ expected_tags3[6] = mp(pmt_from_uint64(30000), mp(str1.str()), mp("seq"), mp(3));
+ expected_tags3[7] = mp(pmt_from_uint64(30000), mp(str0.str()), mp("seq"), mp(6));
+
+ pmt_t expected_tags4[8];
+ expected_tags4[0] = mp(pmt_from_uint64(0), mp(str2.str()), mp("seq"), mp(0));
+ expected_tags4[1] = mp(pmt_from_uint64(0), mp(str0.str()), mp("seq"), mp(1));
+ expected_tags4[2] = mp(pmt_from_uint64(10000), mp(str2.str()), mp("seq"), mp(1));
+ expected_tags4[3] = mp(pmt_from_uint64(10000), mp(str0.str()), mp("seq"), mp(3));
+ expected_tags4[4] = mp(pmt_from_uint64(20000), mp(str2.str()), mp("seq"), mp(2));
+ expected_tags4[5] = mp(pmt_from_uint64(20000), mp(str0.str()), mp("seq"), mp(5));
+ expected_tags4[6] = mp(pmt_from_uint64(30000), mp(str2.str()), mp("seq"), mp(3));
+ expected_tags4[7] = mp(pmt_from_uint64(30000), mp(str0.str()), mp("seq"), mp(7));
+
+ std::cout << std::endl << "qa_block_tags::t3" << std::endl;
+
+ // For annotator 3, we know it gets tags from ann0 and ann1, test this
+ for(size_t i = 0; i < tags3.size(); i++) {
+ std::cout << "tags3[" << i << "] = " << tags3[i] << "\t\t" << expected_tags3[i] << std::endl;
+ CPPUNIT_ASSERT_EQUAL(pmt_write_string(tags3[i]), pmt_write_string(expected_tags3[i]));
+ }
+
+ // For annotator 4, we know it gets tags from ann0 and ann2, test this
+ std::cout << std::endl;
+ for(size_t i = 0; i < tags4.size(); i++) {
+ std::cout << "tags4[" << i << "] = " << tags4[i] << "\t\t" << expected_tags4[i] << std::endl;
+ CPPUNIT_ASSERT_EQUAL(pmt_write_string(tags4[i]), pmt_write_string(expected_tags4[i]));
+ }
+#endif
+}
+
+
+void
+qa_block_tags::t4 ()
+{
+ int N = 40000;
+ gr_top_block_sptr tb = gr_make_top_block("top");
+ gr_block_sptr src (gr_make_null_source(sizeof(int)));
+ gr_block_sptr head (gr_make_head(sizeof(int), N));
+ gr_annotator_1to1_sptr ann0 (gr_make_annotator_1to1(10000, sizeof(int)));
+ gr_annotator_1to1_sptr ann1 (gr_make_annotator_1to1(10000, sizeof(int)));
+ gr_annotator_1to1_sptr ann2 (gr_make_annotator_1to1(10000, sizeof(int)));
+ gr_block_sptr snk0 (gr_make_null_sink(sizeof(int)));
+ gr_block_sptr snk1 (gr_make_null_sink(sizeof(int)));
+
+ // using 1-to-1 tag propagation without having equal number of
+ // ins and outs. Make sure this works; will just exit run early.
+ tb->connect(src, 0, head, 0);
+ tb->connect(head, 0, ann0, 0);
+ tb->connect(ann0, 0, ann1, 0);
+ tb->connect(ann0, 1, ann2, 0);
+ tb->connect(ann1, 0, snk0, 0);
+ tb->connect(ann2, 0, snk1, 0);
+
+ std::cerr << std::endl
+ << "NOTE: This is supposed to produce an error from gr_block_executor"
+ << std::endl;
+ tb->run();
+}
+
+
+void
+qa_block_tags::t5 ()
+{
+ int N = 40000;
+ gr_top_block_sptr tb = gr_make_top_block("top");
+ gr_block_sptr src (gr_make_null_source(sizeof(float)));
+ gr_block_sptr head (gr_make_head(sizeof(float), N));
+ gr_annotator_alltoall_sptr ann0 (gr_make_annotator_alltoall(10000, sizeof(float)));
+ gr_annotator_alltoall_sptr ann1 (gr_make_annotator_alltoall(10000, sizeof(float)));
+ gr_annotator_alltoall_sptr ann2 (gr_make_annotator_alltoall(1000, sizeof(float)));
+ gr_block_sptr snk0 (gr_make_null_sink(sizeof(float)));
+
+ // Rate change blocks
+ gr_keep_one_in_n_sptr dec10 (gr_make_keep_one_in_n(sizeof(float), 10));
+
+ tb->connect(src, 0, head, 0);
+ tb->connect(head, 0, ann0, 0);
+ tb->connect(ann0, 0, ann1, 0);
+ tb->connect(ann1, 0, dec10, 0);
+ tb->connect(dec10, 0, ann2, 0);
+ tb->connect(ann2, 0, snk0, 0);
+
+ tb->run();
+
+ std::vector<gr_tag_t> tags0 = ann0->data();
+ std::vector<gr_tag_t> tags1 = ann1->data();
+ std::vector<gr_tag_t> tags2 = ann2->data();
+
+ // The first annotator does not receive any tags from the null sink upstream
+ CPPUNIT_ASSERT_EQUAL(tags0.size(), (size_t)0);
+ CPPUNIT_ASSERT_EQUAL(tags1.size(), (size_t)4);
+ CPPUNIT_ASSERT_EQUAL(tags2.size(), (size_t)8);
+
+
+#if QA_TAGS_DEBUG
+ // Kludge together the tags that we know should result from the above graph
+ std::stringstream str0, str1, str2;
+ str0 << ann0->name() << ann0->unique_id();
+ str1 << ann1->name() << ann1->unique_id();
+ str2 << ann2->name() << ann2->unique_id();
+
+ pmt_t expected_tags1[5];
+ expected_tags1[0] = mp(pmt_from_uint64(0), mp(str0.str()), mp("seq"), mp(0));
+ expected_tags1[1] = mp(pmt_from_uint64(10000), mp(str0.str()), mp("seq"), mp(1));
+ expected_tags1[2] = mp(pmt_from_uint64(20000), mp(str0.str()), mp("seq"), mp(2));
+ expected_tags1[3] = mp(pmt_from_uint64(30000), mp(str0.str()), mp("seq"), mp(3));
+
+ pmt_t expected_tags2[10];
+ expected_tags2[0] = mp(pmt_from_uint64(0), mp(str1.str()), mp("seq"), mp(0));
+ expected_tags2[1] = mp(pmt_from_uint64(0), mp(str0.str()), mp("seq"), mp(0));
+ expected_tags2[2] = mp(pmt_from_uint64(1000), mp(str1.str()), mp("seq"), mp(1));
+ expected_tags2[3] = mp(pmt_from_uint64(1000), mp(str0.str()), mp("seq"), mp(1));
+ expected_tags2[4] = mp(pmt_from_uint64(2000), mp(str1.str()), mp("seq"), mp(2));
+ expected_tags2[5] = mp(pmt_from_uint64(2000), mp(str0.str()), mp("seq"), mp(2));
+ expected_tags2[6] = mp(pmt_from_uint64(3000), mp(str1.str()), mp("seq"), mp(3));
+ expected_tags2[7] = mp(pmt_from_uint64(3000), mp(str0.str()), mp("seq"), mp(3));
+ expected_tags2[8] = mp(pmt_from_uint64(4000), mp(str1.str()), mp("seq"), mp(4));
+ expected_tags2[9] = mp(pmt_from_uint64(4000), mp(str0.str()), mp("seq"), mp(4));
+
+ std::cout << std::endl << "qa_block_tags::t5" << std::endl;
+
+ // annotator 1 gets tags from annotator 0
+ std::cout << "tags1.size(): " << tags1.size() << std::endl;
+ for(size_t i = 0; i < tags1.size(); i++) {
+ std::cout << "tags1[" << i << "] = " << tags1[i] << "\t\t" << expected_tags1[i] << std::endl;
+ CPPUNIT_ASSERT_EQUAL(pmt_write_string(tags1[i]), pmt_write_string(expected_tags1[i]));
+ }
+
+ // annotator 2 gets tags from annotators 0 and 1
+ std::cout << std::endl;
+ std::cout << "tags2.size(): " << tags2.size() << std::endl;
+ for(size_t i = 0; i < tags2.size(); i++) {
+ std::cout << "tags2[" << i << "] = " << tags2[i] << "\t\t" << expected_tags2[i] << std::endl;
+ CPPUNIT_ASSERT_EQUAL(pmt_write_string(tags2[i]), pmt_write_string(expected_tags2[i]));
+ }
+#endif
+}
+
diff --git a/gnuradio-core/src/lib/runtime/qa_block_tags.h b/gnuradio-core/src/lib/runtime/qa_block_tags.h
new file mode 100644
index 000000000..6b7e5975d
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/qa_block_tags.h
@@ -0,0 +1,52 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+#ifndef INCLUDED_QA_BLOCK_TAGS_H
+#define INCLUDED_QA_BLOCK_TAGS_H
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/TestCase.h>
+#include <stdexcept>
+
+class qa_block_tags : public CppUnit::TestCase {
+
+ CPPUNIT_TEST_SUITE (qa_block_tags);
+ CPPUNIT_TEST (t0);
+ CPPUNIT_TEST (t1);
+ CPPUNIT_TEST (t2);
+ CPPUNIT_TEST (t3);
+ CPPUNIT_TEST (t4);
+ CPPUNIT_TEST (t5);
+ CPPUNIT_TEST_SUITE_END ();
+
+ private:
+ void t0 ();
+ void t1 ();
+ void t2 ();
+ void t3 ();
+ void t4 ();
+ void t5 ();
+
+};
+
+
+#endif /* INCLUDED_QA_BLOCK_TAGS_H */
diff --git a/gnuradio-core/src/lib/runtime/qa_gr_block.cc b/gnuradio-core/src/lib/runtime/qa_gr_block.cc
new file mode 100644
index 000000000..aeab5b74a
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/qa_gr_block.cc
@@ -0,0 +1,88 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <qa_gr_block.h>
+#include <gr_block.h>
+#include <gr_io_signature.h>
+#include <gr_null_sink.h>
+#include <gr_null_source.h>
+
+
+// ----------------------------------------------------------------
+
+
+void
+qa_gr_block::t0 ()
+{
+ // test creation of sources
+ gr_block_sptr src1 (gr_make_null_source (sizeof (int)));
+ CPPUNIT_ASSERT_EQUAL (std::string ("null_source"), src1->name ());
+ CPPUNIT_ASSERT_EQUAL (0, src1->input_signature()->max_streams ());
+ CPPUNIT_ASSERT_EQUAL (1, src1->output_signature()->min_streams ());
+ CPPUNIT_ASSERT_EQUAL (1, src1->output_signature()->max_streams ());
+ CPPUNIT_ASSERT_EQUAL ((int) sizeof(int),
+ src1->output_signature()->sizeof_stream_item (0));
+
+ gr_block_sptr src2 (gr_make_null_source (sizeof (short)));
+ CPPUNIT_ASSERT_EQUAL (std::string ("null_source"), src2->name ());
+ CPPUNIT_ASSERT_EQUAL (0, src2->input_signature()->max_streams ());
+ CPPUNIT_ASSERT_EQUAL (1, src2->output_signature()->min_streams ());
+ CPPUNIT_ASSERT_EQUAL (1, src2->output_signature()->max_streams ());
+ CPPUNIT_ASSERT_EQUAL ((int) sizeof (short),
+ src2->output_signature()->sizeof_stream_item (0));
+}
+
+
+void
+qa_gr_block::t1 ()
+{
+ // test creation of sinks
+ gr_block_sptr dst1 (gr_make_null_sink (sizeof (int)));
+ CPPUNIT_ASSERT_EQUAL (std::string ("null_sink"), dst1->name ());
+ CPPUNIT_ASSERT_EQUAL (1, dst1->input_signature()->min_streams ());
+ CPPUNIT_ASSERT_EQUAL (1, dst1->input_signature()->max_streams ());
+ CPPUNIT_ASSERT_EQUAL ((int) sizeof (int),
+ dst1->input_signature()->sizeof_stream_item (0));
+
+ CPPUNIT_ASSERT_EQUAL (0, dst1->output_signature()->max_streams ());
+
+ gr_block_sptr dst2 (gr_make_null_sink (sizeof (short)));
+ CPPUNIT_ASSERT_EQUAL (std::string ("null_sink"), dst2->name ());
+ CPPUNIT_ASSERT_EQUAL (1, dst2->input_signature()->min_streams ());
+ CPPUNIT_ASSERT_EQUAL (1, dst2->input_signature()->max_streams ());
+ CPPUNIT_ASSERT_EQUAL ((int) sizeof (short),
+ dst2->input_signature()->sizeof_stream_item (0));
+ CPPUNIT_ASSERT_EQUAL (0, dst2->output_signature()->max_streams ());
+}
+
+void
+qa_gr_block::t2 ()
+{
+}
+
+void
+qa_gr_block::t3 ()
+{
+}
diff --git a/gnuradio-core/src/lib/runtime/qa_gr_block.h b/gnuradio-core/src/lib/runtime/qa_gr_block.h
new file mode 100644
index 000000000..14c7c40d1
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/qa_gr_block.h
@@ -0,0 +1,48 @@
+/* -*- 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_QA_GR_BLOCK_H
+#define INCLUDED_QA_GR_BLOCK_H
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/TestCase.h>
+#include <stdexcept>
+
+class qa_gr_block : public CppUnit::TestCase {
+
+ CPPUNIT_TEST_SUITE (qa_gr_block);
+ CPPUNIT_TEST (t0);
+ CPPUNIT_TEST (t1);
+ CPPUNIT_TEST (t2);
+ CPPUNIT_TEST (t3);
+ CPPUNIT_TEST_SUITE_END ();
+
+ private:
+ void t0 ();
+ void t1 ();
+ void t2 ();
+ void t3 ();
+
+};
+
+
+#endif /* INCLUDED_QA_GR_BLOCK_H */
diff --git a/gnuradio-core/src/lib/runtime/qa_gr_buffer.cc b/gnuradio-core/src/lib/runtime/qa_gr_buffer.cc
new file mode 100644
index 000000000..c74baf398
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/qa_gr_buffer.cc
@@ -0,0 +1,307 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <qa_gr_buffer.h>
+#include <gr_buffer.h>
+#include <cppunit/TestAssert.h>
+#include <stdlib.h>
+#include <gr_random.h>
+
+static void
+leak_check (void f ())
+{
+ long buffer_count = gr_buffer_ncurrently_allocated ();
+ long buffer_reader_count = gr_buffer_reader_ncurrently_allocated ();
+
+ f ();
+
+ CPPUNIT_ASSERT_EQUAL (buffer_reader_count, gr_buffer_reader_ncurrently_allocated ());
+ CPPUNIT_ASSERT_EQUAL (buffer_count, gr_buffer_ncurrently_allocated ());
+}
+
+
+// ----------------------------------------------------------------------------
+// test single writer, no readers...
+//
+
+static void
+t0_body ()
+{
+ int nitems = 4000 / sizeof (int);
+ int counter = 0;
+
+ gr_buffer_sptr buf(gr_make_buffer(nitems, sizeof (int), gr_block_sptr()));
+
+ int last_sa;
+ int sa;
+
+ sa = buf->space_available ();
+ CPPUNIT_ASSERT (sa > 0);
+ last_sa = sa;
+
+ for (int i = 0; i < 5; i++){
+ sa = buf->space_available ();
+ CPPUNIT_ASSERT_EQUAL (last_sa, sa);
+ last_sa = sa;
+
+ int *p = (int *) buf->write_pointer ();
+ CPPUNIT_ASSERT (p != 0);
+
+ for (int j = 0; j < sa; j++)
+ *p++ = counter++;
+
+ buf->update_write_pointer (sa);
+ }
+}
+
+// ----------------------------------------------------------------------------
+// test single writer, single reader
+//
+
+static void
+t1_body ()
+ {
+ int nitems = 4000 / sizeof (int);
+ int write_counter = 0;
+ int read_counter = 0;
+
+ gr_buffer_sptr buf(gr_make_buffer(nitems, sizeof (int), gr_block_sptr()));
+ gr_buffer_reader_sptr r1 (gr_buffer_add_reader (buf, 0, gr_block_sptr()));
+
+
+ int sa;
+
+ // write 1/3 of buffer
+
+ sa = buf->space_available ();
+ CPPUNIT_ASSERT (sa > 0);
+
+ int *p = (int *) buf->write_pointer ();
+ CPPUNIT_ASSERT (p != 0);
+
+ for (int j = 0; j < sa/3; j++){
+ *p++ = write_counter++;
+ }
+ buf->update_write_pointer (sa/3);
+
+
+ // write the next 1/3 (1/2 of what's left)
+
+ sa = buf->space_available ();
+ CPPUNIT_ASSERT (sa > 0);
+
+ p = (int *) buf->write_pointer ();
+ CPPUNIT_ASSERT (p != 0);
+
+ for (int j = 0; j < sa/2; j++){
+ *p++ = write_counter++;
+ }
+ buf->update_write_pointer (sa/2);
+
+
+ // check that we can read it OK
+
+ int ia = r1->items_available ();
+ CPPUNIT_ASSERT_EQUAL (write_counter, ia);
+
+ int *rp = (int *) r1->read_pointer ();
+ CPPUNIT_ASSERT (rp != 0);
+
+ for (int i = 0; i < ia/2; i++){
+ CPPUNIT_ASSERT_EQUAL (read_counter, *rp);
+ read_counter++;
+ rp++;
+ }
+ r1->update_read_pointer (ia/2);
+
+ // read the rest
+
+ ia = r1->items_available ();
+ rp = (int *) r1->read_pointer ();
+ CPPUNIT_ASSERT (rp != 0);
+
+ for (int i = 0; i < ia; i++){
+ CPPUNIT_ASSERT_EQUAL (read_counter, *rp);
+ read_counter++;
+ rp++;
+ }
+ r1->update_read_pointer (ia);
+}
+
+// ----------------------------------------------------------------------------
+// single writer, single reader: check wrap-around
+//
+
+static void
+t2_body ()
+{
+ // 64K is the largest granularity we've seen so far (MS windows file mapping).
+ // This allows a bit of "white box testing"
+
+ int nitems = (64 * (1L << 10)) / sizeof (int); // 64K worth of ints
+
+ gr_buffer_sptr buf(gr_make_buffer (nitems, sizeof (int), gr_block_sptr()));
+ gr_buffer_reader_sptr r1 (gr_buffer_add_reader (buf, 0, gr_block_sptr()));
+
+ int read_counter = 0;
+ int write_counter = 0;
+ int n;
+ int *wp = 0;
+ int *rp = 0;
+
+ // Write 3/4 of buffer
+
+ n = (int) (buf->space_available () * 0.75);
+ wp = (int *) buf->write_pointer ();
+
+ for (int i = 0; i < n; i++)
+ *wp++ = write_counter++;
+ buf->update_write_pointer (n);
+
+ // Now read it all
+
+ int m = r1->items_available ();
+ CPPUNIT_ASSERT_EQUAL (n, m);
+ rp = (int *) r1->read_pointer ();
+
+ for (int i = 0; i < m; i++){
+ CPPUNIT_ASSERT_EQUAL (read_counter, *rp);
+ read_counter++;
+ rp++;
+ }
+ r1->update_read_pointer (m);
+
+ // Now write as much as we can.
+ // This will wrap around the buffer
+
+ n = buf->space_available ();
+ CPPUNIT_ASSERT_EQUAL (nitems - 1, n); // white box test
+ wp = (int *) buf->write_pointer ();
+
+ for (int i = 0; i < n; i++)
+ *wp++ = write_counter++;
+ buf->update_write_pointer (n);
+
+ // now read it all
+
+ m = r1->items_available ();
+ CPPUNIT_ASSERT_EQUAL (n, m);
+ rp = (int *) r1->read_pointer ();
+
+ for (int i = 0; i < m; i++){
+ CPPUNIT_ASSERT_EQUAL (read_counter, *rp);
+ read_counter++;
+ rp++;
+ }
+ r1->update_read_pointer (m);
+
+}
+
+// ----------------------------------------------------------------------------
+// single writer, N readers, randomized order and lengths
+// ----------------------------------------------------------------------------
+
+static void
+t3_body ()
+{
+ int nitems = (64 * (1L << 10)) / sizeof (int);
+
+ static const int N = 5;
+ gr_buffer_sptr buf(gr_make_buffer(nitems, sizeof (int), gr_block_sptr()));
+ gr_buffer_reader_sptr reader[N];
+ int read_counter[N];
+ int write_counter = 0;
+ gr_random random;
+
+ for (int i = 0; i < N; i++){
+ read_counter[i] = 0;
+ reader[i] = gr_buffer_add_reader (buf, 0, gr_block_sptr());
+ }
+
+ for (int lc = 0; lc < 1000; lc++){
+
+ // write some
+
+ int n = (int) (buf->space_available () * random.ran1 ());
+ int *wp = (int *) buf->write_pointer ();
+
+ for (int i = 0; i < n; i++)
+ *wp++ = write_counter++;
+
+ buf->update_write_pointer (n);
+
+ // pick a random reader and read some
+
+ int r = (int) (N * random.ran1 ());
+ CPPUNIT_ASSERT (0 <= r && r < N);
+
+ int m = reader[r]->items_available ();
+ int *rp = (int *) reader[r]->read_pointer ();
+
+ for (int i = 0; i < m; i++){
+ CPPUNIT_ASSERT_EQUAL (read_counter[r], *rp);
+ read_counter[r]++;
+ rp++;
+ }
+ reader[r]->update_read_pointer (m);
+ }
+}
+
+
+// ----------------------------------------------------------------------------
+
+void
+qa_gr_buffer::t0 ()
+{
+ leak_check (t0_body);
+}
+
+void
+qa_gr_buffer::t1 ()
+{
+ leak_check (t1_body);
+}
+
+void
+qa_gr_buffer::t2 ()
+{
+ leak_check (t2_body);
+}
+
+void
+qa_gr_buffer::t3 ()
+{
+ leak_check (t3_body);
+}
+
+void
+qa_gr_buffer::t4 ()
+{
+}
+
+void
+qa_gr_buffer::t5 ()
+{
+}
diff --git a/gnuradio-core/src/lib/runtime/qa_gr_buffer.h b/gnuradio-core/src/lib/runtime/qa_gr_buffer.h
new file mode 100644
index 000000000..2937c24b6
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/qa_gr_buffer.h
@@ -0,0 +1,53 @@
+/* -*- 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_QA_GR_BUFFER_H
+#define INCLUDED_QA_GR_BUFFER_H
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/TestCase.h>
+
+class qa_gr_buffer : public CppUnit::TestCase {
+
+ CPPUNIT_TEST_SUITE (qa_gr_buffer);
+ CPPUNIT_TEST (t0);
+ CPPUNIT_TEST (t1);
+ CPPUNIT_TEST (t2);
+ CPPUNIT_TEST (t3);
+ CPPUNIT_TEST (t4);
+ CPPUNIT_TEST (t5);
+ CPPUNIT_TEST_SUITE_END ();
+
+
+ private:
+
+ void t0 ();
+ void t1 ();
+ void t2 ();
+ void t3 ();
+ void t4 ();
+ void t5 ();
+};
+
+
+
+#endif /* INCLUDED_QA_GR_BUFFER_H */
diff --git a/gnuradio-core/src/lib/runtime/qa_gr_flowgraph.cc b/gnuradio-core/src/lib/runtime/qa_gr_flowgraph.cc
new file mode 100644
index 000000000..cce83cb0a
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/qa_gr_flowgraph.cc
@@ -0,0 +1,245 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <qa_gr_flowgraph.h>
+#include <gr_flowgraph.h>
+#include <gr_nop.h>
+#include <gr_null_source.h>
+#include <gr_null_sink.h>
+
+void qa_gr_flowgraph::t0()
+{
+ gr_flowgraph_sptr fg = gr_make_flowgraph();
+
+ CPPUNIT_ASSERT(fg);
+}
+
+void qa_gr_flowgraph::t1_connect()
+{
+ gr_flowgraph_sptr fg = gr_make_flowgraph();
+
+ gr_block_sptr nop1 = gr_make_nop(sizeof(int));
+ gr_block_sptr nop2 = gr_make_nop(sizeof(int));
+
+ fg->connect(nop1, 0, nop2, 0);
+}
+
+void qa_gr_flowgraph::t2_connect_invalid_src_port_neg()
+{
+ gr_flowgraph_sptr fg = gr_make_flowgraph();
+
+ gr_block_sptr nop1 = gr_make_nop(sizeof(int));
+ gr_block_sptr nop2 = gr_make_nop(sizeof(int));
+
+ CPPUNIT_ASSERT_THROW(fg->connect(nop1, -1, nop2, 0), std::invalid_argument);
+}
+
+void qa_gr_flowgraph::t3_connect_src_port_exceeds()
+{
+ gr_flowgraph_sptr fg = gr_make_flowgraph();
+
+ gr_block_sptr src = gr_make_null_source(sizeof(int));
+ gr_block_sptr dst = gr_make_null_sink(sizeof(int));
+
+ CPPUNIT_ASSERT_THROW(fg->connect(src, 1, dst, 0), std::invalid_argument);
+}
+
+void qa_gr_flowgraph::t4_connect_invalid_dst_port_neg()
+{
+ gr_flowgraph_sptr fg = gr_make_flowgraph();
+
+ gr_block_sptr nop1 = gr_make_nop(sizeof(int));
+ gr_block_sptr nop2 = gr_make_nop(sizeof(int));
+
+ CPPUNIT_ASSERT_THROW(fg->connect(nop1, 0, nop2, -1), std::invalid_argument);
+}
+
+void qa_gr_flowgraph::t5_connect_dst_port_exceeds()
+{
+ gr_flowgraph_sptr fg = gr_make_flowgraph();
+
+ gr_block_sptr src = gr_make_null_source(sizeof(int));
+ gr_block_sptr dst = gr_make_null_sink(sizeof(int));
+
+ CPPUNIT_ASSERT_THROW(fg->connect(src, 0, dst, 1), std::invalid_argument);
+}
+
+void qa_gr_flowgraph::t6_connect_dst_in_use()
+{
+ gr_flowgraph_sptr fg = gr_make_flowgraph();
+
+ gr_block_sptr src1 = gr_make_null_source(sizeof(int));
+ gr_block_sptr src2 = gr_make_null_source(sizeof(int));
+ gr_block_sptr dst = gr_make_null_sink(sizeof(int));
+
+ fg->connect(src1, 0, dst, 0);
+ CPPUNIT_ASSERT_THROW(fg->connect(src2, 0, dst, 0), std::invalid_argument);
+}
+
+void qa_gr_flowgraph::t7_connect_one_src_two_dst()
+{
+ gr_flowgraph_sptr fg = gr_make_flowgraph();
+
+ gr_block_sptr src = gr_make_null_source(sizeof(int));
+ gr_block_sptr dst1 = gr_make_null_sink(sizeof(int));
+ gr_block_sptr dst2 = gr_make_null_sink(sizeof(int));
+
+ fg->connect(src, 0, dst1, 0);
+ fg->connect(src, 0, dst2, 0);
+}
+
+void qa_gr_flowgraph::t8_connect_type_mismatch()
+{
+ gr_flowgraph_sptr fg = gr_make_flowgraph();
+
+ gr_block_sptr nop1 = gr_make_nop(sizeof(char));
+ gr_block_sptr nop2 = gr_make_nop(sizeof(int));
+
+ CPPUNIT_ASSERT_THROW(fg->connect(nop1, 0, nop2, 0), std::invalid_argument);
+}
+
+void qa_gr_flowgraph::t9_disconnect()
+{
+ gr_flowgraph_sptr fg = gr_make_flowgraph();
+
+ gr_block_sptr nop1 = gr_make_nop(sizeof(int));
+ gr_block_sptr nop2 = gr_make_nop(sizeof(int));
+
+ fg->connect(nop1, 0, nop2, 0);
+ fg->disconnect(nop1, 0, nop2, 0);
+}
+
+void qa_gr_flowgraph::t10_disconnect_unconnected_block()
+{
+ gr_flowgraph_sptr fg = gr_make_flowgraph();
+
+ gr_block_sptr nop1 = gr_make_nop(sizeof(int));
+ gr_block_sptr nop2 = gr_make_nop(sizeof(int));
+ gr_block_sptr nop3 = gr_make_nop(sizeof(int));
+
+ fg->connect(nop1, 0, nop2, 0);
+ CPPUNIT_ASSERT_THROW(fg->disconnect(nop1, 0, nop3, 0), std::invalid_argument);
+}
+
+void qa_gr_flowgraph::t11_disconnect_unconnected_port()
+{
+ gr_flowgraph_sptr fg = gr_make_flowgraph();
+
+ gr_block_sptr nop1 = gr_make_nop(sizeof(int));
+ gr_block_sptr nop2 = gr_make_nop(sizeof(int));
+
+ fg->connect(nop1, 0, nop2, 0);
+ CPPUNIT_ASSERT_THROW(fg->disconnect(nop1, 0, nop2, 1), std::invalid_argument);
+}
+
+void qa_gr_flowgraph::t12_validate()
+{
+ gr_flowgraph_sptr fg = gr_make_flowgraph();
+
+ gr_block_sptr nop1 = gr_make_nop(sizeof(int));
+ gr_block_sptr nop2 = gr_make_nop(sizeof(int));
+
+ fg->connect(nop1, 0, nop2, 0);
+ fg->validate();
+}
+
+void qa_gr_flowgraph::t13_validate_missing_input_assignment()
+{
+ gr_flowgraph_sptr fg = gr_make_flowgraph();
+
+ gr_block_sptr nop1 = gr_make_nop(sizeof(int));
+ gr_block_sptr nop2 = gr_make_nop(sizeof(int));
+
+ fg->connect(nop1, 0, nop2, 0);
+ fg->connect(nop1, 0, nop2, 2);
+ CPPUNIT_ASSERT_THROW(fg->validate(), std::runtime_error);
+}
+
+void qa_gr_flowgraph::t14_validate_missing_output_assignment()
+{
+ gr_flowgraph_sptr fg = gr_make_flowgraph();
+
+ gr_block_sptr nop1 = gr_make_nop(sizeof(int));
+ gr_block_sptr nop2 = gr_make_nop(sizeof(int));
+
+ fg->connect(nop1, 0, nop2, 0);
+ fg->connect(nop1, 2, nop2, 1);
+ CPPUNIT_ASSERT_THROW(fg->validate(), std::runtime_error);
+}
+
+void qa_gr_flowgraph::t15_clear()
+{
+ gr_flowgraph_sptr fg = gr_make_flowgraph();
+
+ gr_block_sptr nop1 = gr_make_nop(sizeof(int));
+ gr_block_sptr nop2 = gr_make_nop(sizeof(int));
+
+ fg->connect(nop1, 0, nop2, 0);
+
+ CPPUNIT_ASSERT(fg->edges().size() == 1);
+ CPPUNIT_ASSERT(fg->calc_used_blocks().size() == 2);
+
+ fg->clear();
+
+ CPPUNIT_ASSERT(fg->edges().size() == 0);
+ CPPUNIT_ASSERT(fg->calc_used_blocks().size() == 0);
+}
+
+void qa_gr_flowgraph::t16_partition()
+{
+ gr_flowgraph_sptr fg = gr_make_flowgraph();
+
+ gr_block_sptr nop11 = gr_make_nop(sizeof(int));
+ gr_block_sptr nop12 = gr_make_nop(sizeof(int));
+ gr_block_sptr nop13 = gr_make_nop(sizeof(int));
+ gr_block_sptr nop14 = gr_make_nop(sizeof(int));
+
+ gr_block_sptr nop21 = gr_make_nop(sizeof(int));
+ gr_block_sptr nop22 = gr_make_nop(sizeof(int));
+ gr_block_sptr nop23 = gr_make_nop(sizeof(int));
+
+ gr_block_sptr nop31 = gr_make_nop(sizeof(int));
+ gr_block_sptr nop32 = gr_make_nop(sizeof(int));
+
+ // Build disjoint graph #1
+ fg->connect(nop11, 0, nop12, 0);
+ fg->connect(nop12, 0, nop13, 0);
+ fg->connect(nop13, 0, nop14, 0);
+
+ // Build disjoint graph #2
+ fg->connect(nop21, 0, nop22, 0);
+ fg->connect(nop22, 0, nop23, 0);
+
+ // Build disjoint graph #3
+ fg->connect(nop31, 0, nop32, 0);
+
+ std::vector<gr_basic_block_vector_t> graphs = fg->partition();
+
+ CPPUNIT_ASSERT(graphs.size() == 3);
+ CPPUNIT_ASSERT(graphs[0].size() == 4);
+ CPPUNIT_ASSERT(graphs[1].size() == 3);
+ CPPUNIT_ASSERT(graphs[2].size() == 2);
+}
diff --git a/gnuradio-core/src/lib/runtime/qa_gr_flowgraph.h b/gnuradio-core/src/lib/runtime/qa_gr_flowgraph.h
new file mode 100644
index 000000000..2c2686f71
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/qa_gr_flowgraph.h
@@ -0,0 +1,75 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_QA_GR_FLOWGRAPH_H
+#define INCLUDED_QA_GR_FLOWGRAPH_H
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/TestCase.h>
+#include <stdexcept>
+
+class qa_gr_flowgraph : public CppUnit::TestCase
+{
+ CPPUNIT_TEST_SUITE(qa_gr_flowgraph);
+
+ CPPUNIT_TEST(t0);
+ CPPUNIT_TEST(t1_connect);
+ CPPUNIT_TEST(t2_connect_invalid_src_port_neg);
+ CPPUNIT_TEST(t3_connect_src_port_exceeds);
+ CPPUNIT_TEST(t4_connect_invalid_dst_port_neg);
+ CPPUNIT_TEST(t5_connect_dst_port_exceeds);
+ CPPUNIT_TEST(t6_connect_dst_in_use);
+ CPPUNIT_TEST(t7_connect_one_src_two_dst);
+ CPPUNIT_TEST(t8_connect_type_mismatch);
+ CPPUNIT_TEST(t9_disconnect);
+ CPPUNIT_TEST(t10_disconnect_unconnected_block);
+ CPPUNIT_TEST(t11_disconnect_unconnected_port);
+ CPPUNIT_TEST(t12_validate);
+ CPPUNIT_TEST(t13_validate_missing_input_assignment);
+ CPPUNIT_TEST(t14_validate_missing_output_assignment);
+ CPPUNIT_TEST(t15_clear);
+ CPPUNIT_TEST(t16_partition);
+
+ CPPUNIT_TEST_SUITE_END();
+
+private:
+
+ void t0();
+ void t1_connect();
+ void t2_connect_invalid_src_port_neg();
+ void t3_connect_src_port_exceeds();
+ void t4_connect_invalid_dst_port_neg();
+ void t5_connect_dst_port_exceeds();
+ void t6_connect_dst_in_use();
+ void t7_connect_one_src_two_dst();
+ void t8_connect_type_mismatch();
+ void t9_disconnect();
+ void t10_disconnect_unconnected_block();
+ void t11_disconnect_unconnected_port();
+ void t12_validate();
+ void t13_validate_missing_input_assignment();
+ void t14_validate_missing_output_assignment();
+ void t15_clear();
+ void t16_partition();
+};
+
+#endif /* INCLUDED_QA_GR_FLOWGRAPH_H */
diff --git a/gnuradio-core/src/lib/runtime/qa_gr_hier_block2.cc b/gnuradio-core/src/lib/runtime/qa_gr_hier_block2.cc
new file mode 100644
index 000000000..9844d3381
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/qa_gr_hier_block2.cc
@@ -0,0 +1,57 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <qa_gr_hier_block2.h>
+#include <gr_hier_block2.h>
+#include <gr_io_signature.h>
+#include <gr_null_source.h>
+#include <gr_null_sink.h>
+
+void qa_gr_hier_block2::test_make()
+{
+ gr_hier_block2_sptr src1(gr_make_hier_block2("test",
+ gr_make_io_signature(1, 1, 1 * sizeof(int)),
+ gr_make_io_signature(1, 1, 1 * sizeof(int))));
+
+ CPPUNIT_ASSERT(src1);
+ CPPUNIT_ASSERT_EQUAL(std::string("test"), src1->name());
+
+ CPPUNIT_ASSERT_EQUAL(1 * (int) sizeof(int),
+ src1->input_signature()->sizeof_stream_item(0));
+
+ CPPUNIT_ASSERT_EQUAL(1, src1->input_signature()->min_streams());
+ CPPUNIT_ASSERT_EQUAL(1, src1->input_signature()->max_streams());
+
+
+ CPPUNIT_ASSERT_EQUAL(1 * (int) sizeof(int),
+ src1->output_signature()->sizeof_stream_item(0));
+
+ CPPUNIT_ASSERT_EQUAL(1, src1->output_signature()->min_streams());
+ CPPUNIT_ASSERT_EQUAL(1, src1->output_signature()->max_streams());
+
+}
+
+
diff --git a/gnuradio-core/src/lib/runtime/qa_gr_hier_block2.h b/gnuradio-core/src/lib/runtime/qa_gr_hier_block2.h
new file mode 100644
index 000000000..653cd2725
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/qa_gr_hier_block2.h
@@ -0,0 +1,42 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_QA_GR_HIER_BLOCK2_H
+#define INCLUDED_QA_GR_HIER_BLOCK2_H
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/TestCase.h>
+#include <stdexcept>
+
+class qa_gr_hier_block2 : public CppUnit::TestCase
+{
+ CPPUNIT_TEST_SUITE(qa_gr_hier_block2);
+
+ CPPUNIT_TEST(test_make);
+
+ CPPUNIT_TEST_SUITE_END();
+
+private:
+ void test_make();
+};
+
+#endif /* INCLUDED_QA_GR_HIER_BLOCK2_H */
diff --git a/gnuradio-core/src/lib/runtime/qa_gr_hier_block2_derived.cc b/gnuradio-core/src/lib/runtime/qa_gr_hier_block2_derived.cc
new file mode 100644
index 000000000..060c4e244
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/qa_gr_hier_block2_derived.cc
@@ -0,0 +1,87 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <qa_gr_hier_block2_derived.h>
+#include <gr_top_block.h>
+#include <gr_io_signature.h>
+#include <gr_null_source.h>
+#include <gr_null_sink.h>
+#include <gr_head.h>
+#include <gr_kludge_copy.h>
+
+// Declare a test C++ hierarchical block
+
+class gr_derived_block;
+typedef boost::shared_ptr<gr_derived_block> gr_derived_block_sptr;
+gr_derived_block_sptr gr_make_derived_block();
+
+class gr_derived_block : public gr_hier_block2
+{
+private:
+ friend gr_derived_block_sptr gr_make_derived_block();
+ gr_derived_block();
+
+public:
+ ~gr_derived_block();
+};
+
+
+gr_derived_block_sptr
+gr_make_derived_block()
+{
+ return gnuradio::get_initial_sptr(new gr_derived_block());
+}
+
+gr_derived_block::gr_derived_block()
+ : gr_hier_block2("gr_derived_block",
+ gr_make_io_signature(1, 1, sizeof(int)), // Input signature
+ gr_make_io_signature(1, 1, sizeof(int))) // Output signature
+{
+ gr_block_sptr copy(gr_make_kludge_copy(sizeof(int)));
+
+ connect(self(), 0, copy, 0);
+ connect(copy, 0, self(), 0);
+}
+
+gr_derived_block::~gr_derived_block()
+{
+}
+
+void qa_gr_hier_block2_derived::test_1()
+{
+ gr_top_block_sptr tb(gr_make_top_block("test"));
+
+ gr_block_sptr src(gr_make_null_source(sizeof(int)));
+ gr_block_sptr head(gr_make_head(sizeof(int), 1000));
+ gr_derived_block_sptr blk(gr_make_derived_block());
+ gr_block_sptr dst(gr_make_null_sink(sizeof(int)));
+
+ tb->connect(src, 0, head, 0);
+ tb->connect(head, 0, blk, 0);
+ tb->connect(blk, 0, dst, 0);
+
+ tb->run();
+}
diff --git a/gnuradio-core/src/lib/runtime/qa_gr_hier_block2_derived.h b/gnuradio-core/src/lib/runtime/qa_gr_hier_block2_derived.h
new file mode 100644
index 000000000..8e0a1880c
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/qa_gr_hier_block2_derived.h
@@ -0,0 +1,41 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006,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.
+ */
+
+#ifndef INCLUDED_QA_GR_HIER_BLOCK2_DERIVED_H
+#define INCLUDED_QA_GR_HIER_BLOCK2_DERIVED_H
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/TestCase.h>
+#include <stdexcept>
+
+// Declare a QA test case
+class qa_gr_hier_block2_derived : public CppUnit::TestCase
+{
+ CPPUNIT_TEST_SUITE(qa_gr_hier_block2_derived);
+ CPPUNIT_TEST(test_1);
+ CPPUNIT_TEST_SUITE_END();
+
+private:
+ void test_1();
+};
+
+#endif /* INCLUDED_QA_GR_HIER_BLOCK2_DERIVED_H */
diff --git a/gnuradio-core/src/lib/runtime/qa_gr_io_signature.cc b/gnuradio-core/src/lib/runtime/qa_gr_io_signature.cc
new file mode 100644
index 000000000..c1737ffb8
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/qa_gr_io_signature.cc
@@ -0,0 +1,64 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <qa_gr_io_signature.h>
+#include <gr_io_signature.h>
+
+void
+qa_gr_io_signature::t0 ()
+{
+ gr_make_io_signature (1, 1, sizeof (int));
+}
+
+void
+qa_gr_io_signature::t1 ()
+{
+ gr_make_io_signature (3, 1, sizeof (int)); // throws std::invalid_argument
+}
+
+void
+qa_gr_io_signature::t2 ()
+{
+ gr_io_signature_sptr p =
+ gr_make_io_signature (3, gr_io_signature::IO_INFINITE, sizeof (int));
+
+ CPPUNIT_ASSERT_EQUAL (p->min_streams (), 3);
+ CPPUNIT_ASSERT_EQUAL (p->sizeof_stream_item (0), (int) sizeof (int));
+}
+
+void
+qa_gr_io_signature::t3 ()
+{
+ gr_io_signature_sptr p =
+ gr_make_io_signature3 (0, 5, 1, 2, 3);
+
+ CPPUNIT_ASSERT_EQUAL (p->min_streams (), 0);
+ CPPUNIT_ASSERT_EQUAL (p->max_streams (), 5);
+ CPPUNIT_ASSERT_EQUAL (p->sizeof_stream_item(0), 1);
+ CPPUNIT_ASSERT_EQUAL (p->sizeof_stream_item(1), 2);
+ CPPUNIT_ASSERT_EQUAL (p->sizeof_stream_item(2), 3);
+ CPPUNIT_ASSERT_EQUAL (p->sizeof_stream_item(3), 3);
+ CPPUNIT_ASSERT_EQUAL (p->sizeof_stream_item(4), 3);
+}
diff --git a/gnuradio-core/src/lib/runtime/qa_gr_io_signature.h b/gnuradio-core/src/lib/runtime/qa_gr_io_signature.h
new file mode 100644
index 000000000..9cd6bb524
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/qa_gr_io_signature.h
@@ -0,0 +1,46 @@
+/* -*- 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_QA_GR_IO_SIGNATURE_H
+#define INCLUDED_QA_GR_IO_SIGNATURE_H
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/TestCase.h>
+#include <stdexcept>
+
+class qa_gr_io_signature : public CppUnit::TestCase {
+
+ CPPUNIT_TEST_SUITE (qa_gr_io_signature);
+ CPPUNIT_TEST (t0);
+ CPPUNIT_TEST_EXCEPTION (t1, std::invalid_argument);
+ CPPUNIT_TEST (t2);
+ CPPUNIT_TEST (t3);
+ CPPUNIT_TEST_SUITE_END ();
+
+ private:
+ void t0 ();
+ void t1 ();
+ void t2 ();
+ void t3 ();
+};
+
+#endif /* INCLUDED_QA_GR_IO_SIGNATURE_H */
diff --git a/gnuradio-core/src/lib/runtime/qa_gr_top_block.cc b/gnuradio-core/src/lib/runtime/qa_gr_top_block.cc
new file mode 100644
index 000000000..6bbc9ceb8
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/qa_gr_top_block.cc
@@ -0,0 +1,285 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <qa_gr_top_block.h>
+#include <gr_top_block.h>
+#include <gr_head.h>
+#include <gr_nop.h>
+#include <gr_null_source.h>
+#include <gr_null_sink.h>
+#include <iostream>
+
+#define VERBOSE 0
+
+void qa_gr_top_block::t0()
+{
+ if (VERBOSE) std::cout << "qa_gr_top_block::t0()\n";
+
+ gr_top_block_sptr tb = gr_make_top_block("top");
+
+ CPPUNIT_ASSERT(tb);
+}
+
+void qa_gr_top_block::t1_run()
+{
+ if (VERBOSE) std::cout << "qa_gr_top_block::t1()\n";
+
+ gr_top_block_sptr tb = gr_make_top_block("top");
+
+ gr_block_sptr src = gr_make_null_source(sizeof(int));
+ gr_block_sptr head = gr_make_head(sizeof(int), 100000);
+ gr_block_sptr dst = gr_make_null_sink(sizeof(int));
+
+ tb->connect(src, 0, head, 0);
+ tb->connect(head, 0, dst, 0);
+ tb->run();
+}
+
+void qa_gr_top_block::t2_start_stop_wait()
+{
+ if (VERBOSE) std::cout << "qa_gr_top_block::t2()\n";
+
+ gr_top_block_sptr tb = gr_make_top_block("top");
+
+ gr_block_sptr src = gr_make_null_source(sizeof(int));
+ gr_block_sptr head = gr_make_head(sizeof(int), 100000);
+ gr_block_sptr dst = gr_make_null_sink(sizeof(int));
+
+ tb->connect(src, 0, head, 0);
+ tb->connect(head, 0, dst, 0);
+
+ tb->start();
+ tb->stop();
+ tb->wait();
+}
+
+void qa_gr_top_block::t3_lock_unlock()
+{
+ if (VERBOSE) std::cout << "qa_gr_top_block::t3()\n";
+
+ gr_top_block_sptr tb = gr_make_top_block("top");
+
+ gr_block_sptr src = gr_make_null_source(sizeof(int));
+ gr_block_sptr dst = gr_make_null_sink(sizeof(int));
+
+ tb->connect(src, 0, dst, 0);
+
+ tb->start();
+
+ tb->lock();
+ tb->unlock();
+
+ tb->stop();
+ tb->wait();
+}
+
+void qa_gr_top_block::t4_reconfigure()
+{
+ if (VERBOSE) std::cout << "qa_gr_top_block::t4()\n";
+
+ gr_top_block_sptr tb = gr_make_top_block("top");
+
+ gr_block_sptr src = gr_make_null_source(sizeof(int));
+ gr_block_sptr head = gr_make_head(sizeof(int), 100000);
+ gr_block_sptr dst = gr_make_null_sink(sizeof(int));
+
+ // Start infinite flowgraph
+ tb->connect(src, 0, dst, 0);
+ tb->start();
+
+ // Reconfigure with gr_head in the middle
+ tb->lock();
+ tb->disconnect(src, 0, dst, 0);
+ tb->connect(src, 0, head, 0);
+ tb->connect(head, 0, dst, 0);
+ tb->unlock();
+
+ // Wait for flowgraph to end on its own
+ tb->wait();
+}
+
+
+void qa_gr_top_block::t5_max_noutputs()
+{
+ if (VERBOSE) std::cout << "qa_gr_top_block::t5()\n";
+
+ gr_top_block_sptr tb = gr_make_top_block("top");
+
+ gr_block_sptr src = gr_make_null_source(sizeof(int));
+ gr_block_sptr head = gr_make_head(sizeof(int), 100000);
+ gr_block_sptr dst = gr_make_null_sink(sizeof(int));
+
+ // Start infinite flowgraph
+ tb->connect(src, 0, head, 0);
+ tb->connect(head, 0, dst, 0);
+ tb->start(100);
+ tb->wait();
+}
+
+void qa_gr_top_block::t6_reconfig_max_noutputs()
+{
+ if (VERBOSE) std::cout << "qa_gr_top_block::t6()\n";
+
+ gr_top_block_sptr tb = gr_make_top_block("top");
+
+ gr_block_sptr src = gr_make_null_source(sizeof(int));
+ gr_block_sptr head = gr_make_head(sizeof(int), 100000);
+ gr_block_sptr dst = gr_make_null_sink(sizeof(int));
+
+ // Start infinite flowgraph
+ tb->connect(src, 0, dst, 0);
+ tb->start(100);
+
+ // Reconfigure with gr_head in the middle
+ tb->lock();
+ tb->disconnect(src, 0, dst, 0);
+ tb->connect(src, 0, head, 0);
+ tb->connect(head, 0, dst, 0);
+ tb->set_max_noutput_items(1000);
+ head->set_max_noutput_items(500);
+ tb->unlock();
+
+ // Wait for flowgraph to end on its own
+ tb->wait();
+}
+
+void qa_gr_top_block::t7_max_noutputs_per_block()
+{
+ if (VERBOSE) std::cout << "qa_gr_top_block::t7()\n";
+
+ gr_top_block_sptr tb = gr_make_top_block("top");
+
+ gr_block_sptr src = gr_make_null_source(sizeof(int));
+ gr_block_sptr head = gr_make_head(sizeof(int), 100000);
+ gr_block_sptr dst = gr_make_null_sink(sizeof(int));
+
+ head->set_max_noutput_items(100);
+
+ // Start infinite flowgraph
+ tb->connect(src, 0, head, 0);
+ tb->connect(head, 0, dst, 0);
+ tb->start();
+ tb->wait();
+}
+
+void qa_gr_top_block::t8_reconfig_max_noutputs_per_block()
+{
+ if (VERBOSE) std::cout << "qa_gr_top_block::t8()\n";
+
+ gr_top_block_sptr tb = gr_make_top_block("top");
+
+ gr_block_sptr src = gr_make_null_source(sizeof(int));
+ gr_block_sptr head = gr_make_head(sizeof(int), 100000);
+ gr_block_sptr dst = gr_make_null_sink(sizeof(int));
+
+ head->set_max_noutput_items(99);
+
+ // Start infinite flowgraph
+ tb->connect(src, 0, dst, 0);
+ tb->start(201);
+
+ // Reconfigure with gr_head in the middle
+ tb->lock();
+ tb->disconnect(src, 0, dst, 0);
+ tb->connect(src, 0, head, 0);
+ tb->connect(head, 0, dst, 0);
+ tb->set_max_noutput_items(1023);
+ head->set_max_noutput_items(513);
+ tb->unlock();
+
+ // Wait for flowgraph to end on its own
+ tb->wait();
+}
+
+void qa_gr_top_block::t9_max_output_buffer()
+{
+ if (VERBOSE) std::cout << "qa_gr_top_block::t9()\n";
+
+ gr_top_block_sptr tb = gr_make_top_block("top");
+
+ gr_block_sptr src = gr_make_null_source(sizeof(int));
+ gr_block_sptr head = gr_make_head(sizeof(int), 100000);
+ gr_block_sptr dst = gr_make_null_sink(sizeof(int));
+
+ head->set_max_output_buffer(1024);
+
+ // Start infinite flowgraph
+ tb->connect(src, 0, head, 0);
+ tb->connect(head, 0, dst, 0);
+ tb->start();
+ tb->wait();
+}
+
+void qa_gr_top_block::t10_reconfig_max_output_buffer()
+{
+ if (VERBOSE) std::cout << "qa_gr_top_block::t10()\n";
+
+ gr_top_block_sptr tb = gr_make_top_block("top");
+
+ gr_block_sptr src = gr_make_null_source(sizeof(int));
+ gr_block_sptr head = gr_make_head(sizeof(int), 100000);
+ gr_block_sptr dst = gr_make_null_sink(sizeof(int));
+
+ head->set_max_output_buffer(1000);
+
+ // Start infinite flowgraph
+ tb->connect(src, 0, dst, 0);
+ tb->start(201);
+
+ // Reconfigure with gr_head in the middle
+ tb->lock();
+ gr_block_sptr nop = gr_make_nop(sizeof(int));
+ nop->set_max_output_buffer(4000);
+ tb->disconnect(src, 0, dst, 0);
+ tb->connect(src, 0, head, 0);
+ tb->connect(head, 0, nop, 0);
+ tb->connect(nop, 0, dst, 0);
+ tb->unlock();
+
+ // Wait for flowgraph to end on its own
+ tb->wait();
+}
+
+void qa_gr_top_block::t11_set_block_affinity()
+{
+ gr_top_block_sptr tb = gr_make_top_block("top");
+ gr_block_sptr src (gr_make_null_source(sizeof(float)));
+ gr_block_sptr snk (gr_make_null_sink(sizeof(float)));
+
+ std::vector<int> set(1, 0), ret;
+ src->set_processor_affinity(set);
+
+ tb->connect(src, 0, snk, 0);
+ tb->start();
+ tb->stop();
+ tb->wait();
+
+ ret = src->processor_affinity();
+
+ // We only set the core affinity to 0 because we always know at
+ // least one thread core exists to use.
+ CPPUNIT_ASSERT_EQUAL(set[0], ret[0]);
+}
diff --git a/gnuradio-core/src/lib/runtime/qa_gr_top_block.h b/gnuradio-core/src/lib/runtime/qa_gr_top_block.h
new file mode 100644
index 000000000..634eeab1f
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/qa_gr_top_block.h
@@ -0,0 +1,66 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_QA_GR_TOP_BLOCK_H
+#define INCLUDED_QA_GR_TOP_BLOCK_H
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/TestCase.h>
+#include <stdexcept>
+
+class qa_gr_top_block : public CppUnit::TestCase
+{
+ CPPUNIT_TEST_SUITE(qa_gr_top_block);
+
+ CPPUNIT_TEST(t0);
+ CPPUNIT_TEST(t1_run);
+ CPPUNIT_TEST(t2_start_stop_wait);
+ CPPUNIT_TEST(t3_lock_unlock);
+ CPPUNIT_TEST(t4_reconfigure); // triggers 'join never returns' bug
+ CPPUNIT_TEST(t5_max_noutputs);
+ CPPUNIT_TEST(t6_reconfig_max_noutputs);
+ CPPUNIT_TEST(t7_max_noutputs_per_block);
+ CPPUNIT_TEST(t8_reconfig_max_noutputs_per_block);
+ CPPUNIT_TEST(t9_max_output_buffer);
+ CPPUNIT_TEST(t10_reconfig_max_output_buffer);
+ CPPUNIT_TEST(t11_set_block_affinity);
+
+ CPPUNIT_TEST_SUITE_END();
+
+private:
+
+ void t0();
+ void t1_run();
+ void t2_start_stop_wait();
+ void t3_lock_unlock();
+ void t4_reconfigure();
+ void t5_max_noutputs();
+ void t6_reconfig_max_noutputs();
+ void t7_max_noutputs_per_block();
+ void t8_reconfig_max_noutputs_per_block();
+ void t9_max_output_buffer();
+ void t10_reconfig_max_output_buffer();
+ void t11_set_block_affinity();
+
+};
+
+#endif /* INCLUDED_QA_GR_TOP_BLOCK_H */
diff --git a/gnuradio-core/src/lib/runtime/qa_gr_vmcircbuf.cc b/gnuradio-core/src/lib/runtime/qa_gr_vmcircbuf.cc
new file mode 100644
index 000000000..e3b36d882
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/qa_gr_vmcircbuf.cc
@@ -0,0 +1,40 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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 <qa_gr_vmcircbuf.h>
+#include <cppunit/TestAssert.h>
+#include <gr_vmcircbuf.h>
+#include <stdio.h>
+
+void
+qa_gr_vmcircbuf::test_all ()
+{
+ int verbose = 1; // summary
+
+ bool ok = gr_vmcircbuf_sysconfig::test_all_factories (verbose);
+
+ CPPUNIT_ASSERT_EQUAL (true, ok);
+}
diff --git a/gnuradio-core/src/lib/runtime/qa_gr_vmcircbuf.h b/gnuradio-core/src/lib/runtime/qa_gr_vmcircbuf.h
new file mode 100644
index 000000000..3576660d5
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/qa_gr_vmcircbuf.h
@@ -0,0 +1,39 @@
+/* -*- 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 _QA_GR_VMCIRCBUF_H_
+#define _QA_GR_VMCIRCBUF_H_
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/TestCase.h>
+
+class qa_gr_vmcircbuf : public CppUnit::TestCase {
+
+ CPPUNIT_TEST_SUITE (qa_gr_vmcircbuf);
+ CPPUNIT_TEST (test_all);
+ CPPUNIT_TEST_SUITE_END ();
+
+ private:
+ void test_all ();
+};
+
+
+#endif /* _QA_GR_VMCIRCBUF_H_ */
diff --git a/gnuradio-core/src/lib/runtime/qa_runtime.cc b/gnuradio-core/src/lib/runtime/qa_runtime.cc
new file mode 100644
index 000000000..9091d5c00
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/qa_runtime.cc
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2002,2007,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 class gathers together all the test cases for the gr
+ * directory into a single test suite. As you create new test cases,
+ * add them here.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <qa_runtime.h>
+#include <qa_gr_vmcircbuf.h>
+#include <qa_gr_io_signature.h>
+#include <qa_gr_block.h>
+#include <qa_gr_flowgraph.h>
+#include <qa_gr_top_block.h>
+#include <qa_gr_hier_block2.h>
+#include <qa_gr_hier_block2_derived.h>
+#include <qa_gr_buffer.h>
+#include <qa_block_tags.h>
+#include <qa_set_msg_handler.h>
+
+CppUnit::TestSuite *
+qa_runtime::suite ()
+{
+ CppUnit::TestSuite *s = new CppUnit::TestSuite ("runtime");
+
+ s->addTest (qa_gr_vmcircbuf::suite ());
+ s->addTest (qa_gr_io_signature::suite ());
+ s->addTest (qa_gr_block::suite ());
+ //s->addTest (qa_gr_flowgraph::suite ());
+ s->addTest (qa_gr_top_block::suite ());
+ s->addTest (qa_gr_hier_block2::suite ());
+ s->addTest (qa_gr_hier_block2_derived::suite ());
+ s->addTest (qa_gr_buffer::suite ());
+ //s->addTest (qa_block_tags::suite ());
+ //s->addTest (qa_set_msg_handler::suite ());
+
+ return s;
+}
diff --git a/gnuradio-core/src/lib/runtime/qa_runtime.h b/gnuradio-core/src/lib/runtime/qa_runtime.h
new file mode 100644
index 000000000..da71cbd0f
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/qa_runtime.h
@@ -0,0 +1,38 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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 _QA_RUNTIME_H_
+#define _QA_RUNTIME_H_
+
+#include <gruel/attributes.h>
+#include <cppunit/TestSuite.h>
+
+//! collect all the tests for the runtime directory
+
+class __GR_ATTR_EXPORT qa_runtime {
+ public:
+ //! return suite of tests for all of runtime directory
+ static CppUnit::TestSuite *suite ();
+};
+
+
+#endif /* _QA_RUNTIME_H_ */
diff --git a/gnuradio-core/src/lib/runtime/qa_set_msg_handler.cc b/gnuradio-core/src/lib/runtime/qa_set_msg_handler.cc
new file mode 100644
index 000000000..c84a219bd
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/qa_set_msg_handler.cc
@@ -0,0 +1,81 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <qa_set_msg_handler.h>
+#include <gr_top_block.h>
+#include <gr_head.h>
+#include <gr_null_source.h>
+#include <gr_null_sink.h>
+#include <gr_nop.h>
+#include <gruel/msg_passing.h>
+#include <iostream>
+#include <boost/thread/thread.hpp>
+
+
+#define VERBOSE 0
+
+using namespace pmt;
+
+/*
+ * The gr_nop block has been instrumented so that it counts
+ * the number of messages sent to it. We use this feature
+ * to confirm that gr_nop's call to set_msg_handler is working
+ * correctly.
+ */
+
+void qa_set_msg_handler::t0()
+{
+ static const int NMSGS = 10;
+
+ if (VERBOSE) std::cout << "qa_set_msg_handler::t0()\n";
+
+ gr_top_block_sptr tb = gr_make_top_block("top");
+
+ gr_block_sptr src = gr_make_null_source(sizeof(int));
+ gr_nop_sptr nop = gr_make_nop(sizeof(int));
+ gr_block_sptr dst = gr_make_null_sink(sizeof(int));
+
+ tb->connect(src, 0, nop, 0);
+ tb->connect(nop, 0, dst, 0);
+
+ // Must start graph before sending messages
+ tb->start();
+
+ // Send them...
+ pmt_t port(pmt_intern("port"));
+ for (int i = 0; i < NMSGS; i++){
+ send(nop, port, mp(mp("example-msg"), mp(i)));
+ }
+
+ // Give the messages a chance to be processed
+ boost::this_thread::sleep(boost::posix_time::milliseconds(100));
+
+ tb->stop();
+ tb->wait();
+
+ // Confirm that the nop block received the right number of messages.
+ CPPUNIT_ASSERT_EQUAL(NMSGS, nop->nmsgs_received());
+}
diff --git a/gnuradio-core/src/lib/runtime/qa_set_msg_handler.h b/gnuradio-core/src/lib/runtime/qa_set_msg_handler.h
new file mode 100644
index 000000000..60277a12c
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/qa_set_msg_handler.h
@@ -0,0 +1,43 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007,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.
+ */
+
+#ifndef INCLUDED_QA_SET_MSG_HANDLER_H
+#define INCLUDED_QA_SET_MSG_HANDLER_H
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/TestCase.h>
+#include <stdexcept>
+
+class qa_set_msg_handler : public CppUnit::TestCase
+{
+ CPPUNIT_TEST_SUITE(qa_set_msg_handler);
+
+ CPPUNIT_TEST(t0);
+
+ CPPUNIT_TEST_SUITE_END();
+
+private:
+
+ void t0();
+};
+
+#endif /* INCLUDED_QA_SET_MSG_HANDLER_H */
diff --git a/gnuradio-core/src/lib/runtime/runtime.i b/gnuradio-core/src/lib/runtime/runtime.i
new file mode 100644
index 000000000..64c28c8e1
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/runtime.i
@@ -0,0 +1,123 @@
+/*
+ * Copyright 2012-2013 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.
+ */
+
+#define GR_CORE_API
+
+//not here to fight you swig, reference() is ambigi with shared ptr, but whatevs
+%ignore gri_agc_cc::reference();
+%ignore gri_agc2_ff::reference();
+%ignore gri_agc2_cc::reference();
+
+//someone forgot about d_detail
+%ignore gr_block::d_setlock;
+
+//dont export work overloads
+%ignore general_work;
+%ignore work;
+%ignore forecast;
+
+%{
+
+#include <gras/block.hpp>
+#include <gras/hier_block.hpp>
+#include <gras/top_block.hpp>
+#include <gr_block.h>
+#include <gr_top_block.h>
+#include <gr_hier_block2.h>
+#include <gr_message.h>
+#include <gr_msg_handler.h>
+#include <gr_msg_queue.h>
+#include <gr_sync_block.h>
+#include <gr_sync_decimator.h>
+#include <gr_sync_interpolator.h>
+
+%}
+
+//const size types used by blocks in python
+%constant int sizeof_char = sizeof(char);
+%constant int sizeof_short = sizeof(short);
+%constant int sizeof_int = sizeof(int);
+%constant int sizeof_float = sizeof(float);
+%constant int sizeof_double = sizeof(double);
+%constant int sizeof_gr_complex = sizeof(gr_complex);
+
+%include <gr_message.i>
+%include <gr_msg_handler.i>
+%include <gr_msg_queue.i>
+%include <gr_swig_block_magic.i>
+%include <gr_io_signature.i>
+
+#ifdef SW_RUNTIME
+
+%import <gras/block.i>
+%include <gr_block.h>
+%include <gr_hier_block2.h>
+%include <gr_top_block.h>
+%include <gr_sync_block.h>
+%include <gr_sync_decimator.h>
+%include <gr_sync_interpolator.h>
+
+#else
+
+//the bare minimum block inheritance interface to make things work but keep swig cxx file size down
+%include <gras/gras.hpp>
+%import <gras/element.i>
+namespace gras
+{
+ struct Block : gras::Element{};
+ struct HierBlock : gras::Element{};
+}
+struct gr_hier_block2 : gras::HierBlock{};
+struct gr_block : gras::Block
+{
+ gr_io_signature_sptr input_signature(void) const;
+ gr_io_signature_sptr output_signature(void) const;
+
+ unsigned history () const;
+
+ int output_multiple () const;
+ double relative_rate () const;
+
+ bool start();
+ bool stop();
+
+ uint64_t nitems_read(unsigned int which_input);
+ uint64_t nitems_written(unsigned int which_output);
+
+ // Methods to manage the block's max_noutput_items size.
+ int max_noutput_items();
+ void set_max_noutput_items(int m);
+ void unset_max_noutput_items();
+ bool is_set_max_noutput_items();
+
+ // Methods to manage block's min/max buffer sizes.
+ long max_output_buffer(int i);
+ void set_max_output_buffer(long max_output_buffer);
+ void set_max_output_buffer(int port, long max_output_buffer);
+ long min_output_buffer(int i);
+ void set_min_output_buffer(long min_output_buffer);
+ void set_min_output_buffer(int port, long min_output_buffer);
+};
+struct gr_sync_block : gr_block{};
+struct gr_sync_interpolator : gr_sync_block{};
+struct gr_sync_decimator : gr_sync_block{};
+
+#endif
diff --git a/gnuradio-core/src/lib/runtime/test_shared_block_ptr.cc b/gnuradio-core/src/lib/runtime/test_shared_block_ptr.cc
new file mode 100644
index 000000000..bb4e86322
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/test_shared_block_ptr.cc
@@ -0,0 +1,53 @@
+/* -*- 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_shared_block_sptr.h>
+#include <gr_vector_source_i.h>
+
+gr_block_sptr
+foo (gr_vector_source_i_sptr s)
+{
+ return gr_block_sptr (s);
+}
+
+typedef gr_shared_block_sptr<gr_vector_source_i> gr_vector_source_i_ptrX;
+//typedef boost::shared_ptr<gr_vector_source_i> gr_vector_source_i_ptrX;
+
+gr_vector_source_i_ptrX
+bar (gr_vector_source_i *s)
+{
+ return gr_vector_source_i_ptrX (s);
+}
+
+gr_block_sptr
+baz_1 (gr_vector_source_i_ptrX s)
+{
+ return gr_block_sptr (s);
+}
+
+#if 0
+gr_block_sptr
+baz_2 (gr_vector_source_i_ptrX s)
+{
+ return s.block_sptr ();
+}
+#endif
diff --git a/gnuradio-core/src/lib/swig/CMakeLists.txt b/gnuradio-core/src/lib/swig/CMakeLists.txt
new file mode 100644
index 000000000..d8a64cc0f
--- /dev/null
+++ b/gnuradio-core/src/lib/swig/CMakeLists.txt
@@ -0,0 +1,88 @@
+# 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.
+
+########################################################################
+include(GrPython)
+include(GrSwig)
+
+set(GR_SWIG_INCLUDE_DIRS
+ ${CMAKE_CURRENT_BINARY_DIR}
+ ${GNURADIO_CORE_SWIG_INCLUDE_DIRS}
+ ${GRUEL_INCLUDE_DIRS}
+ ${Boost_INCLUDE_DIRS}
+)
+set(GR_SWIG_LIBRARIES gnuradio-core)
+
+link_directories(${Boost_LIBRARY_DIRS})
+
+########################################################################
+# Build and install the swig targets
+########################################################################
+# ----------------------------------------------------------------
+# We've split the previously monstrous gnuradio_corethon into 6
+# smaller pieces. This reduces compile time coupling and creates
+# smaller pieces for the compiler to digest. prior to this change, on
+# X86_64, g++'s resident set size was 650MB!
+# ----------------------------------------------------------------
+
+set(GR_SWIG_TARGET_DEPS general_generated gengen_generated filter_generated pmt_swig)
+
+foreach(what runtime general gengen filter io hier)
+ SET(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/${what}_swig_doc.i)
+ SET(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../${what} ${CMAKE_CURRENT_BINARY_DIR}/../${what})
+ GR_SWIG_MAKE(gnuradio_core_${what} gnuradio_core_${what}.i)
+ GR_SWIG_INSTALL(
+ TARGETS gnuradio_core_${what}
+ DESTINATION ${GR_PYTHON_DIR}/gnuradio/gr
+ COMPONENT "core_python"
+ )
+ install(
+ FILES
+ gnuradio_core_${what}.i
+ ${CMAKE_CURRENT_BINARY_DIR}/${what}_swig_doc.i
+ DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig
+ COMPONENT "core_swig"
+ )
+ list(APPEND core_swig_deps ${SWIG_MODULE_gnuradio_core_${what}_REAL_NAME})
+endforeach(what)
+
+add_custom_target(core_swig DEPENDS ${core_swig_deps})
+
+########################################################################
+# Install various files
+########################################################################
+install(FILES
+ gnuradio.i
+ gr_swig_block_magic.i
+ gr_shared_ptr.i
+ DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig
+ COMPONENT "core_swig"
+)
+
+GR_PYTHON_INSTALL(
+ FILES gnuradio_core.py
+ DESTINATION ${GR_PYTHON_DIR}/gnuradio/gr
+ COMPONENT "core_python"
+)
+
+install(
+ FILES ${CMAKE_CURRENT_SOURCE_DIR}/gnuradio_swig_bug_workaround.h
+ DESTINATION ${GR_INCLUDE_DIR}/gnuradio
+ COMPONENT "core_swig"
+)
diff --git a/gnuradio-core/src/lib/swig/gen-swig-bug-fix b/gnuradio-core/src/lib/swig/gen-swig-bug-fix
new file mode 100755
index 000000000..5e9f82e7d
--- /dev/null
+++ b/gnuradio-core/src/lib/swig/gen-swig-bug-fix
@@ -0,0 +1,111 @@
+#!/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.
+#
+
+import sys
+import re
+
+def write_header (f):
+ f.write ('''/* -*- 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_GNURADIO_SWIG_BUG_WORKAROUND_H
+#define INCLUDED_GNURADIO_SWIG_BUG_WORKAROUND_H
+
+/*
+ * This include files works around a bug in SWIG 1.3.21 and 22
+ * where it fails to emit these declarations when doing
+ * %import "gnuradio.i"
+ */
+
+''')
+
+def write_trailer (f):
+ f.write ('''
+#endif /* INCLUDED_GNURADIO_SWIG_BUG_WORKAROUND_H */
+''')
+
+def doit (input, output):
+ re_RULES_BEGIN = re.compile ('RULES \(BEGIN\)')
+ re_RULES_END = re.compile ('RULES \(END\)')
+ re_RETURN = re.compile ('^\s*return')
+ re_NOT_ID = re.compile ('[^a-zA-Z0-9_]')
+ words = {}
+
+ write_header (output)
+ for line in input:
+ if re_RULES_BEGIN.search (line):
+ break
+
+ for line in input:
+ if re_RULES_END.search (line):
+ break
+ if not re_RETURN.match (line):
+ continue
+ line = re_NOT_ID.sub (' ', line)
+ line = re.sub (' +', ' ', line)
+ for w in line.split (' '):
+ words[w] = 1
+
+ for w in ('', 'return', 'void', 'x'):
+ del words[w]
+
+ wl = words.keys()
+ wl.sort ()
+ for w in wl:
+ output.write ('class ' + w + ';\n')
+
+ write_trailer (output)
+
+
+def main ():
+ if len (sys.argv) != 3:
+ sys.stderr.write ("usage: %s gnuradio_swig_python.cc gnuradio_swig_bug_workaround.h\n"
+ % (sys.argv[0],))
+ sys.exit (1)
+ input_filename = sys.argv[1]
+ output_filename = sys.argv[2]
+ input = open (input_filename, "r")
+ output = open (output_filename, "w")
+ doit (input, output)
+
+if __name__ == '__main__':
+ main ()
+
diff --git a/gnuradio-core/src/lib/swig/gnuradio.i b/gnuradio-core/src/lib/swig/gnuradio.i
new file mode 100644
index 000000000..bf23bbbb2
--- /dev/null
+++ b/gnuradio-core/src/lib/swig/gnuradio.i
@@ -0,0 +1,91 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2003,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.
+ */
+
+%pythoncode %{
+import gras
+%}
+
+// Disable warning about base class types
+#pragma SWIG nowarn=401
+
+////////////////////////////////////////////////////////////////////////
+// gnuradio.i
+// SWIG interface definition
+////////////////////////////////////////////////////////////////////////
+
+%include <gruel_common.i>
+
+////////////////////////////////////////////////////////////////////////
+// Headers
+
+%{
+#include "gnuradio_swig_bug_workaround.h" // mandatory bug fix
+#include <gr_types.h>
+#include <stddef.h> // size_t
+#include <complex>
+%}
+
+%feature("autodoc","1");
+
+// local file
+%include <gr_shared_ptr.i>
+%include <gr_types.h>
+%include <std_complex.i>
+%include <std_vector.i>
+%include <stl.i>
+%include <std_except.i>
+
+typedef std::complex<float> gr_complex;
+typedef std::complex<double> gr_complexd;
+typedef unsigned long long uint64_t;
+typedef long long int64_t;
+
+
+// instantiate the required template specializations
+
+namespace std {
+ %template() vector<unsigned char>;
+ %template() vector<char>;
+ %template() vector<short>;
+ %template() vector<int>;
+ %template() vector<float>;
+ %template() vector<double>;
+ // %template() std::complex<float>;
+
+ %template() vector< std::complex<float> >;
+ %template() vector< std::vector< unsigned char > >;
+ %template() vector< std::vector< char > >;
+ %template() vector< std::vector< short > >;
+ %template() vector< std::vector< int > >;
+ %template() vector< std::vector< float > >;
+ %template() vector< std::vector< double > >;
+ %template() vector< std::vector< std::complex<float> > >;
+};
+
+////////////////////////////////////////////////////////////////////////
+
+#ifndef SW_RUNTIME
+// import runtime.i for all but sw_runtime, since it needs to %include
+%import <runtime.i>
+#endif
+
+////////////////////////////////////////////////////////////////////////
diff --git a/gnuradio-core/src/lib/swig/gnuradio_core.py b/gnuradio-core/src/lib/swig/gnuradio_core.py
new file mode 100644
index 000000000..23de74077
--- /dev/null
+++ b/gnuradio-core/src/lib/swig/gnuradio_core.py
@@ -0,0 +1,28 @@
+#
+# Copyright 2006,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 this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+
+# This file implements the old gnuradio_core namespace
+
+from gnuradio_core_runtime import *
+from gnuradio_core_general import *
+from gnuradio_core_gengen import *
+from gnuradio_core_filter import *
+from gnuradio_core_io import *
+from gnuradio_core_hier import *
diff --git a/gnuradio-core/src/lib/swig/gnuradio_core_filter.i b/gnuradio-core/src/lib/swig/gnuradio_core_filter.i
new file mode 100644
index 000000000..e9a44e54b
--- /dev/null
+++ b/gnuradio-core/src/lib/swig/gnuradio_core_filter.i
@@ -0,0 +1,32 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006,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 this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+%include "filter_swig_doc.i"
+
+#ifndef SWIGIMPORTED
+%module(directors="1") gnuradio_core_filter
+#endif
+
+ //%feature("autodoc", "1"); // generate python docstrings
+
+%include "gnuradio.i" // the common stuff
+
+%include "filter.i"
diff --git a/gnuradio-core/src/lib/swig/gnuradio_core_general.i b/gnuradio-core/src/lib/swig/gnuradio_core_general.i
new file mode 100644
index 000000000..33f97815e
--- /dev/null
+++ b/gnuradio-core/src/lib/swig/gnuradio_core_general.i
@@ -0,0 +1,54 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006,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 this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+%include "general_swig_doc.i"
+
+#define GR_CORE_API
+
+#ifndef SWIGIMPORTED
+%module(directors="1") gnuradio_core_general
+#endif
+
+ //%feature("autodoc", "1"); // generate python docstrings
+
+%include "gnuradio.i" // the common stuff
+
+%include "general.i"
+
+ // Simple test case for complex input and output
+%inline
+%{
+ std::complex<float> complexf_add_2j(std::complex<float> x)
+ {
+ return std::complex<float>(x.real(), x.imag() + 2);
+ }
+
+ std::complex<double> complexd_add_2j(std::complex<double> x)
+ {
+ return std::complex<double>(x.real(), x.imag() + 2);
+ }
+
+ std::complex<float> complexf_add_x_2j(float x, std::complex<float> y)
+ {
+ return std::complex<float>(x + y.real(), y.imag() + 2);
+ }
+
+%}
diff --git a/gnuradio-core/src/lib/swig/gnuradio_core_gengen.i b/gnuradio-core/src/lib/swig/gnuradio_core_gengen.i
new file mode 100644
index 000000000..b90a5bab3
--- /dev/null
+++ b/gnuradio-core/src/lib/swig/gnuradio_core_gengen.i
@@ -0,0 +1,32 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006,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 this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+%include "gengen_swig_doc.i"
+
+#ifndef SWIGIMPORTED
+%module(directors="1") gnuradio_core_gengen
+#endif
+
+ //%feature("autodoc", "1"); // generate python docstrings
+
+%include "gnuradio.i" // the common stuff
+
+%include "gengen.i"
diff --git a/gnuradio-core/src/lib/swig/gnuradio_core_hier.i b/gnuradio-core/src/lib/swig/gnuradio_core_hier.i
new file mode 100644
index 000000000..141d9b163
--- /dev/null
+++ b/gnuradio-core/src/lib/swig/gnuradio_core_hier.i
@@ -0,0 +1,32 @@
+/* -*- 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 this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+%include "hier_swig_doc.i"
+
+#ifndef SWIGIMPORTED
+%module(directors="1") gnuradio_hier_hier
+#endif
+
+ //%feature("autodoc", "1"); // generate python docstrings
+
+%include "gnuradio.i" // the common stuff
+
+%include "hier.i"
diff --git a/gnuradio-core/src/lib/swig/gnuradio_core_io.i b/gnuradio-core/src/lib/swig/gnuradio_core_io.i
new file mode 100644
index 000000000..522b12b34
--- /dev/null
+++ b/gnuradio-core/src/lib/swig/gnuradio_core_io.i
@@ -0,0 +1,32 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006,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 this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+%include "io_swig_doc.i"
+
+#ifndef SWIGIMPORTED
+%module(directors="1") gnuradio_core_io
+#endif
+
+ //%feature("autodoc", "1"); // generate python docstrings
+
+%include "gnuradio.i" // the common stuff
+
+%include "io.i"
diff --git a/gnuradio-core/src/lib/swig/gnuradio_core_runtime.i b/gnuradio-core/src/lib/swig/gnuradio_core_runtime.i
new file mode 100644
index 000000000..fb311d226
--- /dev/null
+++ b/gnuradio-core/src/lib/swig/gnuradio_core_runtime.i
@@ -0,0 +1,34 @@
+/* -*- 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.
+ */
+
+%include "runtime_swig_doc.i"
+
+#ifndef SWIGIMPORTED
+%module(directors="1") gnuradio_core_runtime
+#endif
+
+ //%feature("autodoc", "1"); // generate python docstrings
+
+#define SW_RUNTIME
+%include "gnuradio.i" // the common stuff
+
+%include "runtime.i"
diff --git a/gnuradio-core/src/lib/swig/gnuradio_swig_bug_workaround.h b/gnuradio-core/src/lib/swig/gnuradio_swig_bug_workaround.h
new file mode 100644
index 000000000..1994f0660
--- /dev/null
+++ b/gnuradio-core/src/lib/swig/gnuradio_swig_bug_workaround.h
@@ -0,0 +1,45 @@
+/* -*- 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_GNURADIO_SWIG_BUG_WORKAROUND_H
+#define INCLUDED_GNURADIO_SWIG_BUG_WORKAROUND_H
+
+/*
+ * This include files works around a bug in SWIG 1.3.21 and 22
+ * where it fails to emit these declarations when doing
+ * %import "gnuradio.i"
+ */
+
+class gr_base_error_handler;
+class gr_basic_block;
+class gr_block;
+class gr_error_handler;
+class gr_file_error_handler;
+class gr_hier_block2;
+class gr_msg_handler;
+class gr_msg_queue;
+class gr_sync_block;
+class gr_sync_decimator;
+class gr_sync_interpolator;
+class gr_top_block;
+
+#endif /* INCLUDED_GNURADIO_SWIG_BUG_WORKAROUND_H */
diff --git a/gnuradio-core/src/lib/swig/gr_shared_ptr.i b/gnuradio-core/src/lib/swig/gr_shared_ptr.i
new file mode 100644
index 000000000..323d33ad7
--- /dev/null
+++ b/gnuradio-core/src/lib/swig/gr_shared_ptr.i
@@ -0,0 +1,43 @@
+//
+// shared_ptr
+//
+// An enhanced relative of scoped_ptr with reference counted copy semantics.
+// The object pointed to is deleted when the last shared_ptr pointing to it
+// is destroyed or reset.
+//
+
+//
+// This is highly hacked up version of boost::shared_ptr
+// We just need enough to get SWIG to "do the right thing" and
+// generate "Smart Pointer" code.
+//
+
+namespace boost {
+
+template<class T> class shared_ptr
+{
+public:
+
+ shared_ptr()
+ {
+ }
+
+ shared_ptr (T * p)
+ {
+ }
+
+
+ T * operator-> () // never throws
+ {
+ return px;
+ }
+
+
+private:
+
+ T * px; // contained pointer
+ int pn;
+
+}; // shared_ptr
+
+}; \ No newline at end of file
diff --git a/gnuradio-core/src/lib/swig/gr_swig_block_magic.i b/gnuradio-core/src/lib/swig/gr_swig_block_magic.i
new file mode 100644
index 000000000..4016ae772
--- /dev/null
+++ b/gnuradio-core/src/lib/swig/gr_swig_block_magic.i
@@ -0,0 +1,50 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,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.
+ */
+
+%define GR_SWIG_BLOCK_MAGIC(PKG, BASE_NAME)
+_GR_SWIG_BLOCK_MAGIC_HELPER(PKG, BASE_NAME, PKG ## _ ## BASE_NAME)
+%enddef
+
+%define _GR_SWIG_BLOCK_MAGIC_HELPER_COMMON(PKG, BASE_NAME, FULL_NAME)
+class FULL_NAME;
+typedef boost::shared_ptr<FULL_NAME> FULL_NAME ## _sptr;
+%template(FULL_NAME ## _sptr) boost::shared_ptr<FULL_NAME>;
+%rename(BASE_NAME) PKG ## _make_ ## BASE_NAME;
+%ignore FULL_NAME;
+%enddef
+
+#ifdef SWIGPYTHON
+%define _GR_SWIG_BLOCK_MAGIC_HELPER(PKG, BASE_NAME, FULL_NAME)
+_GR_SWIG_BLOCK_MAGIC_HELPER_COMMON(PKG, BASE_NAME, FULL_NAME)
+%pythoncode %{
+FULL_NAME ## _sptr.__repr__ = lambda self: "<gr_block %s (%d)>" % (self.name(), self.unique_id ())
+%}
+%enddef
+#endif
+
+%define GR_SWIG_BLOCK_MAGIC2(PKG, BASE_NAME)
+%template(BASE_NAME ## _sptr) boost::shared_ptr<gr:: ## PKG ## :: ## BASE_NAME>;
+%pythoncode %{
+BASE_NAME ## _sptr.__repr__ = lambda self: "<gr_block %s (%d)>" % (self.name(), self.unique_id())
+BASE_NAME = BASE_NAME.make;
+%}
+%enddef
diff --git a/gnuradio-core/src/lib/viterbi/CMakeLists.txt b/gnuradio-core/src/lib/viterbi/CMakeLists.txt
new file mode 100644
index 000000000..add5c77e8
--- /dev/null
+++ b/gnuradio-core/src/lib/viterbi/CMakeLists.txt
@@ -0,0 +1,63 @@
+# 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
+########################################################################
+
+set(viterbi_sources
+ ${CMAKE_CURRENT_SOURCE_DIR}/metrics.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/tab.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/viterbi.c
+)
+
+########################################################################
+# define missing erf function with C linkage (hack for metrics.c)
+########################################################################
+if(MSVC)
+file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/boost_math_erf.cc "
+#include <boost/math/special_functions/erf.hpp>
+extern \"C\" double erf(double x){
+ return boost::math::erf(x);
+}
+")
+list(APPEND viterbi_sources ${CMAKE_CURRENT_BINARY_DIR}/boost_math_erf.cc)
+endif(MSVC)
+
+########################################################################
+# Append gnuradio-core library sources
+########################################################################
+list(APPEND gnuradio_core_sources ${viterbi_sources})
+
+########################################################################
+# Install runtime headers
+########################################################################
+install(
+ FILES ${CMAKE_CURRENT_SOURCE_DIR}/viterbi.h
+ DESTINATION ${GR_INCLUDE_DIR}/gnuradio
+ COMPONENT "core_devel"
+)
+
+########################################################################
+# Create some text executables (not registered tests)
+# Its not much to build so the sources are just re-listed,
+# rather than create a new library just for these two apps.
+########################################################################
+#ADD_EXECUTABLE(viterbi_encode ${CMAKE_CURRENT_SOURCE_DIR}/encode.cc ${viterbi_sources})
+#ADD_EXECUTABLE(viterbi_decode ${CMAKE_CURRENT_SOURCE_DIR}/decode.cc ${viterbi_sources})
diff --git a/gnuradio-core/src/lib/viterbi/decode.cc b/gnuradio-core/src/lib/viterbi/decode.cc
new file mode 100644
index 000000000..368e69713
--- /dev/null
+++ b/gnuradio-core/src/lib/viterbi/decode.cc
@@ -0,0 +1,88 @@
+/* -*- 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.
+ */
+
+/*
+ * This is a minimal example demonstrating how to call the Viterbi decoder
+ * in continuous streaming mode. It accepts data on stdin and writes to
+ * stdout.
+ *
+ */
+
+extern "C" {
+#include "viterbi.h"
+}
+
+#include <cstdio>
+#include <cmath>
+
+#define MAXCHUNKSIZE 4096
+#define MAXENCSIZE MAXCHUNKSIZE*16
+
+int main()
+{
+ unsigned char data[MAXCHUNKSIZE];
+ signed char syms[MAXENCSIZE];
+ int count = 0;
+
+ // Initialize metric table
+ int mettab[2][256];
+ int amp = 100;
+ float RATE=0.5;
+ float ebn0 = 12.0;
+ float esn0 = RATE*pow(10.0, ebn0/10);
+ gen_met(mettab, amp, esn0, 0.0, 4);
+
+ // Initialize decoder state
+ struct viterbi_state state0[64];
+ struct viterbi_state state1[64];
+ unsigned char viterbi_in[16];
+ viterbi_chunks_init(state0);
+
+ while (!feof(stdin)) {
+ unsigned int n = fread(syms, 1, MAXENCSIZE, stdin);
+ unsigned char *out = data;
+
+ for (unsigned int i = 0; i < n; i++) {
+
+ // FIXME: This implements hard decoding by slicing the input stream
+ unsigned char sym = syms[i] > 0 ? -amp : amp;
+
+ // Write the symbol to the decoder input
+ viterbi_in[count % 4] = sym;
+
+ // Every four symbols, perform the butterfly2 operation
+ if ((count % 4) == 3) {
+ viterbi_butterfly2(viterbi_in, mettab, state0, state1);
+
+ // Every sixteen symbols, perform the readback operation
+ if ((count > 64) && (count % 16) == 11) {
+ viterbi_get_output(state0, out);
+ fwrite(out++, 1, 1, stdout);
+ }
+ }
+
+ count++;
+ }
+ }
+
+ return 0;
+}
diff --git a/gnuradio-core/src/lib/viterbi/encode.cc b/gnuradio-core/src/lib/viterbi/encode.cc
new file mode 100644
index 000000000..83a85fcac
--- /dev/null
+++ b/gnuradio-core/src/lib/viterbi/encode.cc
@@ -0,0 +1,54 @@
+/* -*- 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.
+ */
+
+/*
+ * This is a minimal example demonstrating how to call the ECC encoder
+ * in continuous streaming mode. It accepts data on stdin and writes to
+ * stdout.
+ *
+ * FIXME: This does not flush the final bits out of the encoder.
+ *
+ */
+
+extern "C" {
+#include "viterbi.h"
+}
+
+#include <cstdio>
+
+#define MAXCHUNKSIZE 4096
+#define MAXENCSIZE MAXCHUNKSIZE*16
+
+int main()
+{
+ unsigned char encoder_state = 0;
+ unsigned char data[MAXCHUNKSIZE];
+ unsigned char syms[MAXENCSIZE];
+
+ while (!feof(stdin)) {
+ unsigned int n = fread(data, 1, MAXCHUNKSIZE, stdin);
+ encoder_state = encode(syms, data, n, encoder_state);
+ fwrite(syms, 1, n*16, stdout);
+ }
+
+ return 0;
+}
diff --git a/gnuradio-core/src/lib/viterbi/metrics.c b/gnuradio-core/src/lib/viterbi/metrics.c
new file mode 100644
index 000000000..0d91c301f
--- /dev/null
+++ b/gnuradio-core/src/lib/viterbi/metrics.c
@@ -0,0 +1,126 @@
+/*
+ * Copyright 1995 Phil Karn, KA9Q
+ * 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.
+ */
+
+/*
+ * Generate metric tables for a soft-decision convolutional decoder
+ * assuming gaussian noise on a PSK channel.
+ *
+ * Works from "first principles" by evaluating the normal probability
+ * function and then computing the log-likelihood function
+ * for every possible received symbol value
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+/* Symbols are offset-binary, with 128 corresponding to an erased (no
+ * information) symbol
+ */
+#define OFFSET 128
+
+#include <stdlib.h>
+#include <math.h>
+
+//declare erf in case it was missing in math.h and provided for by the build system
+extern double erf(double x);
+
+/* Normal function integrated from -Inf to x. Range: 0-1 */
+#define normal(x) (0.5 + 0.5*erf((x)/M_SQRT2))
+
+/* Logarithm base 2 */
+#define gr_log2(x) (log(x)*M_LOG2E)
+
+/* Generate log-likelihood metrics for 8-bit soft quantized channel
+ * assuming AWGN and BPSK
+ */
+void
+gen_met(int mettab[2][256], /* Metric table, [sent sym][rx symbol] */
+ int amp, /* Signal amplitude, units */
+ double esn0, /* Es/N0 ratio in dB */
+ double bias, /* Metric bias; 0 for viterbi, rate for sequential */
+ int scale) /* Scale factor */
+{
+ double noise;
+ int s,bit;
+ double metrics[2][256];
+ double p0,p1;
+
+ /* Es/N0 as power ratio */
+ esn0 = pow(10.,esn0/10);
+
+ noise = 0.5/esn0; /* only half the noise for BPSK */
+ noise = sqrt(noise); /* noise/signal Voltage ratio */
+
+ /* Zero is a special value, since this sample includes all
+ * lower samples that were clipped to this value, i.e., it
+ * takes the whole lower tail of the curve
+ */
+ p1 = normal(((0-OFFSET+0.5)/amp - 1)/noise); /* P(s|1) */
+
+ /* Prob of this value occurring for a 0-bit */ /* P(s|0) */
+ p0 = normal(((0-OFFSET+0.5)/amp + 1)/noise);
+ metrics[0][0] = gr_log2(2*p0/(p1+p0)) - bias;
+ metrics[1][0] = gr_log2(2*p1/(p1+p0)) - bias;
+
+ for(s=1;s<255;s++){
+ /* P(s|1), prob of receiving s given 1 transmitted */
+ p1 = normal(((s-OFFSET+0.5)/amp - 1)/noise) -
+ normal(((s-OFFSET-0.5)/amp - 1)/noise);
+
+ /* P(s|0), prob of receiving s given 0 transmitted */
+ p0 = normal(((s-OFFSET+0.5)/amp + 1)/noise) -
+ normal(((s-OFFSET-0.5)/amp + 1)/noise);
+
+#ifdef notdef
+ printf("P(%d|1) = %lg, P(%d|0) = %lg\n",s,p1,s,p0);
+#endif
+ metrics[0][s] = gr_log2(2*p0/(p1+p0)) - bias;
+ metrics[1][s] = gr_log2(2*p1/(p1+p0)) - bias;
+ }
+ /* 255 is also a special value */
+ /* P(s|1) */
+ p1 = 1 - normal(((255-OFFSET-0.5)/amp - 1)/noise);
+ /* P(s|0) */
+ p0 = 1 - normal(((255-OFFSET-0.5)/amp + 1)/noise);
+
+ metrics[0][255] = gr_log2(2*p0/(p1+p0)) - bias;
+ metrics[1][255] = gr_log2(2*p1/(p1+p0)) - bias;
+#ifdef notdef
+ /* The probability of a raw symbol error is the probability
+ * that a 1-bit would be received as a sample with value
+ * 0-128. This is the offset normal curve integrated from -Inf to 0.
+ */
+ printf("symbol Pe = %lg\n",normal(-1/noise));
+#endif
+ for(bit=0;bit<2;bit++){
+ for(s=0;s<256;s++){
+ /* Scale and round to nearest integer */
+ mettab[bit][s] = floor(metrics[bit][s] * scale + 0.5);
+#ifdef notdef
+ printf("metrics[%d][%d] = %lg, mettab = %d\n",
+ bit,s,metrics[bit][s],mettab[bit][s]);
+#endif
+ }
+ }
+}
diff --git a/gnuradio-core/src/lib/viterbi/tab.c b/gnuradio-core/src/lib/viterbi/tab.c
new file mode 100644
index 000000000..1c135acfe
--- /dev/null
+++ b/gnuradio-core/src/lib/viterbi/tab.c
@@ -0,0 +1,57 @@
+/*
+ * Copyright 1995 Phil Karn, KA9Q
+ * 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.
+ */
+
+/* 8-bit parity lookup table, generated by partab.c */
+unsigned char Partab[] = {
+ 0, 1, 1, 0, 1, 0, 0, 1,
+ 1, 0, 0, 1, 0, 1, 1, 0,
+ 1, 0, 0, 1, 0, 1, 1, 0,
+ 0, 1, 1, 0, 1, 0, 0, 1,
+ 1, 0, 0, 1, 0, 1, 1, 0,
+ 0, 1, 1, 0, 1, 0, 0, 1,
+ 0, 1, 1, 0, 1, 0, 0, 1,
+ 1, 0, 0, 1, 0, 1, 1, 0,
+ 1, 0, 0, 1, 0, 1, 1, 0,
+ 0, 1, 1, 0, 1, 0, 0, 1,
+ 0, 1, 1, 0, 1, 0, 0, 1,
+ 1, 0, 0, 1, 0, 1, 1, 0,
+ 0, 1, 1, 0, 1, 0, 0, 1,
+ 1, 0, 0, 1, 0, 1, 1, 0,
+ 1, 0, 0, 1, 0, 1, 1, 0,
+ 0, 1, 1, 0, 1, 0, 0, 1,
+ 1, 0, 0, 1, 0, 1, 1, 0,
+ 0, 1, 1, 0, 1, 0, 0, 1,
+ 0, 1, 1, 0, 1, 0, 0, 1,
+ 1, 0, 0, 1, 0, 1, 1, 0,
+ 0, 1, 1, 0, 1, 0, 0, 1,
+ 1, 0, 0, 1, 0, 1, 1, 0,
+ 1, 0, 0, 1, 0, 1, 1, 0,
+ 0, 1, 1, 0, 1, 0, 0, 1,
+ 0, 1, 1, 0, 1, 0, 0, 1,
+ 1, 0, 0, 1, 0, 1, 1, 0,
+ 1, 0, 0, 1, 0, 1, 1, 0,
+ 0, 1, 1, 0, 1, 0, 0, 1,
+ 1, 0, 0, 1, 0, 1, 1, 0,
+ 0, 1, 1, 0, 1, 0, 0, 1,
+ 0, 1, 1, 0, 1, 0, 0, 1,
+ 1, 0, 0, 1, 0, 1, 1, 0,
+};
diff --git a/gnuradio-core/src/lib/viterbi/viterbi.c b/gnuradio-core/src/lib/viterbi/viterbi.c
new file mode 100644
index 000000000..fc8886603
--- /dev/null
+++ b/gnuradio-core/src/lib/viterbi/viterbi.c
@@ -0,0 +1,355 @@
+/*
+ * Copyright 1995 Phil Karn, KA9Q
+ * 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.
+ */
+
+/*
+ * Viterbi decoder for K=7 rate=1/2 convolutional code
+ * Some modifications from original Karn code by Matt Ettus
+ */
+
+#include "viterbi.h"
+
+/* The two generator polynomials for the NASA Standard K=7 code.
+ * Since these polynomials are known to be optimal for this constraint
+ * length there is not much point in changing them. But if you do, you
+ * will have to regenerate the BUTTERFLY macro calls in viterbi()
+ */
+#define POLYA 0x6d
+#define POLYB 0x4f
+
+/* The basic Viterbi decoder operation, called a "butterfly"
+ * operation because of the way it looks on a trellis diagram. Each
+ * butterfly involves an Add-Compare-Select (ACS) operation on the two nodes
+ * where the 0 and 1 paths from the current node merge at the next step of
+ * the trellis.
+ *
+ * The code polynomials are assumed to have 1's on both ends. Given a
+ * function encode_state() that returns the two symbols for a given
+ * encoder state in the low two bits, such a code will have the following
+ * identities for even 'n' < 64:
+ *
+ * encode_state(n) = encode_state(n+65)
+ * encode_state(n+1) = encode_state(n+64) = (3 ^ encode_state(n))
+ *
+ * Any convolutional code you would actually want to use will have
+ * these properties, so these assumptions aren't too limiting.
+ *
+ * Doing this as a macro lets the compiler evaluate at compile time the
+ * many expressions that depend on the loop index and encoder state and
+ * emit them as immediate arguments.
+ * This makes an enormous difference on register-starved machines such
+ * as the Intel x86 family where evaluating these expressions at runtime
+ * would spill over into memory.
+ */
+#define BUTTERFLY(i,sym) { \
+ int m0,m1;\
+\
+ /* ACS for 0 branch */\
+ m0 = state[i].metric + mets[sym]; /* 2*i */\
+ m1 = state[i+32].metric + mets[3^sym]; /* 2*i + 64 */\
+ if(m0 > m1){\
+ next[2*i].metric = m0;\
+ next[2*i].path = state[i].path << 1;\
+ } else {\
+ next[2*i].metric = m1;\
+ next[2*i].path = (state[i+32].path << 1)|1;\
+ }\
+ /* ACS for 1 branch */\
+ m0 = state[i].metric + mets[3^sym]; /* 2*i + 1 */\
+ m1 = state[i+32].metric + mets[sym]; /* 2*i + 65 */\
+ if(m0 > m1){\
+ next[2*i+1].metric = m0;\
+ next[2*i+1].path = state[i].path << 1;\
+ } else {\
+ next[2*i+1].metric = m1;\
+ next[2*i+1].path = (state[i+32].path << 1)|1;\
+ }\
+}
+
+extern unsigned char Partab[]; /* Parity lookup table */
+
+/* Convolutionally encode data into binary symbols */
+unsigned char
+encode(unsigned char *symbols,
+ unsigned char *data,
+ unsigned int nbytes,
+ unsigned char encstate)
+{
+ int i;
+
+ while(nbytes-- != 0){
+ for(i=7;i>=0;i--){
+ encstate = (encstate << 1) | ((*data >> i) & 1);
+ *symbols++ = Partab[encstate & POLYA];
+ *symbols++ = Partab[encstate & POLYB];
+ }
+ data++;
+ }
+
+ return encstate;
+}
+
+/* Viterbi decoder */
+int
+viterbi(unsigned long *metric, /* Final path metric (returned value) */
+ unsigned char *data, /* Decoded output data */
+ unsigned char *symbols, /* Raw deinterleaved input symbols */
+ unsigned int nbits, /* Number of output bits */
+ int mettab[2][256] /* Metric table, [sent sym][rx symbol] */
+ ){
+ unsigned int bitcnt = 0;
+ int mets[4];
+ long bestmetric;
+ int beststate,i;
+ struct viterbi_state state0[64],state1[64],*state,*next;
+
+ state = state0;
+ next = state1;
+
+ /* Initialize starting metrics to prefer 0 state */
+ state[0].metric = 0;
+ for(i=1;i<64;i++)
+ state[i].metric = -999999;
+ state[0].path = 0;
+
+ for(bitcnt = 0;bitcnt < nbits;bitcnt++){
+ /* Read input symbol pair and compute all possible branch
+ * metrics
+ */
+ mets[0] = mettab[0][symbols[0]] + mettab[0][symbols[1]];
+ mets[1] = mettab[0][symbols[0]] + mettab[1][symbols[1]];
+ mets[2] = mettab[1][symbols[0]] + mettab[0][symbols[1]];
+ mets[3] = mettab[1][symbols[0]] + mettab[1][symbols[1]];
+ symbols += 2;
+
+ /* These macro calls were generated by genbut.c */
+ BUTTERFLY(0,0);
+ BUTTERFLY(1,1);
+ BUTTERFLY(2,3);
+ BUTTERFLY(3,2);
+ BUTTERFLY(4,3);
+ BUTTERFLY(5,2);
+ BUTTERFLY(6,0);
+ BUTTERFLY(7,1);
+ BUTTERFLY(8,0);
+ BUTTERFLY(9,1);
+ BUTTERFLY(10,3);
+ BUTTERFLY(11,2);
+ BUTTERFLY(12,3);
+ BUTTERFLY(13,2);
+ BUTTERFLY(14,0);
+ BUTTERFLY(15,1);
+ BUTTERFLY(16,2);
+ BUTTERFLY(17,3);
+ BUTTERFLY(18,1);
+ BUTTERFLY(19,0);
+ BUTTERFLY(20,1);
+ BUTTERFLY(21,0);
+ BUTTERFLY(22,2);
+ BUTTERFLY(23,3);
+ BUTTERFLY(24,2);
+ BUTTERFLY(25,3);
+ BUTTERFLY(26,1);
+ BUTTERFLY(27,0);
+ BUTTERFLY(28,1);
+ BUTTERFLY(29,0);
+ BUTTERFLY(30,2);
+ BUTTERFLY(31,3);
+
+ /* Swap current and next states */
+ if(bitcnt & 1){
+ state = state0;
+ next = state1;
+ } else {
+ state = state1;
+ next = state0;
+ }
+ // ETTUS
+ //if(bitcnt > nbits-7){
+ /* In tail, poison non-zero nodes */
+ //for(i=1;i<64;i += 2)
+ // state[i].metric = -9999999;
+ //}
+ /* Produce output every 8 bits once path memory is full */
+ if((bitcnt % 8) == 5 && bitcnt > 32){
+ /* Find current best path */
+ bestmetric = state[0].metric;
+ beststate = 0;
+ for(i=1;i<64;i++){
+ if(state[i].metric > bestmetric){
+ bestmetric = state[i].metric;
+ beststate = i;
+ }
+ }
+#ifdef notdef
+ printf("metrics[%d] = %d state = %lx\n",beststate,
+ state[beststate].metric,state[beststate].path);
+#endif
+ *data++ = state[beststate].path >> 24;
+ }
+
+ }
+ /* Output remaining bits from 0 state */
+ // ETTUS Find best state instead
+ bestmetric = state[0].metric;
+ beststate = 0;
+ for(i=1;i<64;i++){
+ if(state[i].metric > bestmetric){
+ bestmetric = state[i].metric;
+ beststate = i;
+ }
+ }
+ if((i = bitcnt % 8) != 6)
+ state[beststate].path <<= 6-i;
+
+ *data++ = state[beststate].path >> 24;
+ *data++ = state[beststate].path >> 16;
+ *data++ = state[beststate].path >> 8;
+ *data = state[beststate].path;
+ //printf ("BS = %d\tBSM = %d\tM0 = %d\n",beststate,state[beststate].metric,state[0].metric);
+ *metric = state[beststate].metric;
+ return 0;
+}
+
+
+void
+viterbi_chunks_init(struct viterbi_state* state) {
+ // Initialize starting metrics to prefer 0 state
+ int i;
+ state[0].metric = 0;
+ state[0].path = 0;
+ for(i=1;i<64;i++)
+ state[i].metric = -999999;
+}
+
+void
+viterbi_butterfly8(unsigned char *symbols, int mettab[2][256], struct viterbi_state *state0, struct viterbi_state *state1)
+{
+ unsigned int bitcnt;
+ int mets[4];
+
+ struct viterbi_state *state, *next;
+ state = state0;
+ next = state1;
+ // Operate on 16 symbols (8 bits) at a time
+ for(bitcnt = 0;bitcnt < 8;bitcnt++){
+ // Read input symbol pair and compute all possible branch metrics
+ mets[0] = mettab[0][symbols[0]] + mettab[0][symbols[1]];
+ mets[1] = mettab[0][symbols[0]] + mettab[1][symbols[1]];
+ mets[2] = mettab[1][symbols[0]] + mettab[0][symbols[1]];
+ mets[3] = mettab[1][symbols[0]] + mettab[1][symbols[1]];
+ symbols += 2;
+
+ // These macro calls were generated by genbut.c
+ BUTTERFLY(0,0);BUTTERFLY(1,1);BUTTERFLY(2,3);BUTTERFLY(3,2);
+ BUTTERFLY(4,3);BUTTERFLY(5,2);BUTTERFLY(6,0);BUTTERFLY(7,1);
+ BUTTERFLY(8,0);BUTTERFLY(9,1);BUTTERFLY(10,3);BUTTERFLY(11,2);
+ BUTTERFLY(12,3);BUTTERFLY(13,2);BUTTERFLY(14,0);BUTTERFLY(15,1);
+ BUTTERFLY(16,2);BUTTERFLY(17,3);BUTTERFLY(18,1);BUTTERFLY(19,0);
+ BUTTERFLY(20,1);BUTTERFLY(21,0);BUTTERFLY(22,2);BUTTERFLY(23,3);
+ BUTTERFLY(24,2);BUTTERFLY(25,3);BUTTERFLY(26,1);BUTTERFLY(27,0);
+ BUTTERFLY(28,1);BUTTERFLY(29,0);BUTTERFLY(30,2);BUTTERFLY(31,3);
+
+ // Swap current and next states
+ if(bitcnt & 1){
+ state = state0;
+ next = state1;
+ } else {
+ state = state1;
+ next = state0;
+ }
+ }
+}
+
+void
+viterbi_butterfly2(unsigned char *symbols, int mettab[2][256], struct viterbi_state *state0, struct viterbi_state *state1)
+{
+ //unsigned int bitcnt;
+ int mets[4];
+
+ struct viterbi_state *state, *next;
+ state = state0;
+ next = state1;
+ // Operate on 4 symbols (2 bits) at a time
+
+ // Read input symbol pair and compute all possible branch metrics
+ mets[0] = mettab[0][symbols[0]] + mettab[0][symbols[1]];
+ mets[1] = mettab[0][symbols[0]] + mettab[1][symbols[1]];
+ mets[2] = mettab[1][symbols[0]] + mettab[0][symbols[1]];
+ mets[3] = mettab[1][symbols[0]] + mettab[1][symbols[1]];
+
+ // These macro calls were generated by genbut.c
+ BUTTERFLY(0,0);BUTTERFLY(1,1);BUTTERFLY(2,3);BUTTERFLY(3,2);
+ BUTTERFLY(4,3);BUTTERFLY(5,2);BUTTERFLY(6,0);BUTTERFLY(7,1);
+ BUTTERFLY(8,0);BUTTERFLY(9,1);BUTTERFLY(10,3);BUTTERFLY(11,2);
+ BUTTERFLY(12,3);BUTTERFLY(13,2);BUTTERFLY(14,0);BUTTERFLY(15,1);
+ BUTTERFLY(16,2);BUTTERFLY(17,3);BUTTERFLY(18,1);BUTTERFLY(19,0);
+ BUTTERFLY(20,1);BUTTERFLY(21,0);BUTTERFLY(22,2);BUTTERFLY(23,3);
+ BUTTERFLY(24,2);BUTTERFLY(25,3);BUTTERFLY(26,1);BUTTERFLY(27,0);
+ BUTTERFLY(28,1);BUTTERFLY(29,0);BUTTERFLY(30,2);BUTTERFLY(31,3);
+
+ state = state1;
+ next = state0;
+
+ // Read input symbol pair and compute all possible branch metrics
+ mets[0] = mettab[0][symbols[2]] + mettab[0][symbols[3]];
+ mets[1] = mettab[0][symbols[2]] + mettab[1][symbols[3]];
+ mets[2] = mettab[1][symbols[2]] + mettab[0][symbols[3]];
+ mets[3] = mettab[1][symbols[2]] + mettab[1][symbols[3]];
+
+ // These macro calls were generated by genbut.c
+ BUTTERFLY(0,0);BUTTERFLY(1,1);BUTTERFLY(2,3);BUTTERFLY(3,2);
+ BUTTERFLY(4,3);BUTTERFLY(5,2);BUTTERFLY(6,0);BUTTERFLY(7,1);
+ BUTTERFLY(8,0);BUTTERFLY(9,1);BUTTERFLY(10,3);BUTTERFLY(11,2);
+ BUTTERFLY(12,3);BUTTERFLY(13,2);BUTTERFLY(14,0);BUTTERFLY(15,1);
+ BUTTERFLY(16,2);BUTTERFLY(17,3);BUTTERFLY(18,1);BUTTERFLY(19,0);
+ BUTTERFLY(20,1);BUTTERFLY(21,0);BUTTERFLY(22,2);BUTTERFLY(23,3);
+ BUTTERFLY(24,2);BUTTERFLY(25,3);BUTTERFLY(26,1);BUTTERFLY(27,0);
+ BUTTERFLY(28,1);BUTTERFLY(29,0);BUTTERFLY(30,2);BUTTERFLY(31,3);
+}
+
+unsigned char
+viterbi_get_output(struct viterbi_state *state, unsigned char *outbuf) {
+ // Produce output every 8 bits once path memory is full
+ // if((bitcnt % 8) == 5 && bitcnt > 32) {
+
+ // Find current best path
+ unsigned int i,beststate;
+ int bestmetric;
+
+ bestmetric = state[0].metric;
+ beststate = 0;
+ for(i=1;i<64;i++)
+ if(state[i].metric > bestmetric) {
+ bestmetric = state[i].metric;
+ beststate = i;
+ }
+ *outbuf = state[beststate].path >> 24;
+ return bestmetric;
+}
+
+
+//printf ("BS = %d\tBSM = %d\tM0 = %d\n",beststate,state[beststate].metric,state[0].metric);
+// In tail, poison non-zero nodes
+//if(bits_out > packet_size-7)
+// for(i=1;i<64;i += 2)
+// state[i].metric = -9999999;
+
diff --git a/gnuradio-core/src/lib/viterbi/viterbi.h b/gnuradio-core/src/lib/viterbi/viterbi.h
new file mode 100644
index 000000000..bcdbe116d
--- /dev/null
+++ b/gnuradio-core/src/lib/viterbi/viterbi.h
@@ -0,0 +1,53 @@
+/*
+ * 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.
+ */
+
+/* The path memory for each state is 32 bits. This is slightly shorter
+ * than we'd like for K=7, especially since we chain back every 8 bits.
+ * But it fits so nicely into a 32-bit machine word...
+ */
+
+#include <gr_core_api.h>
+
+struct viterbi_state {
+ unsigned long path; /* Decoded path to this state */
+ long metric; /* Cumulative metric to this state */
+};
+
+GR_CORE_API
+int gen_met(int mettab[2][256], /* Metric table */
+ int amp, /* Signal amplitude */
+ double esn0, /* Es/N0 ratio in dB */
+ double bias, /* Metric bias */
+ int scale); /* Scale factor */
+
+GR_CORE_API unsigned char
+encode(unsigned char *symbols, unsigned char *data,
+ unsigned int nbytes,unsigned char encstate);
+
+GR_CORE_API void
+viterbi_chunks_init(struct viterbi_state* state);
+
+ GR_CORE_API void
+viterbi_butterfly2(unsigned char *symbols, int mettab[2][256],
+ struct viterbi_state *state0, struct viterbi_state *state1);
+
+GR_CORE_API unsigned char
+viterbi_get_output(struct viterbi_state *state, unsigned char *outbuf);
diff --git a/gnuradio-core/src/python/bin/microtune.py b/gnuradio-core/src/python/bin/microtune.py
new file mode 100755
index 000000000..fbe743f39
--- /dev/null
+++ b/gnuradio-core/src/python/bin/microtune.py
@@ -0,0 +1,42 @@
+#!/usr/bin/env python
+# -*- Python -*-
+
+from gnuradio import gr
+from gnuradio.eng_option import eng_option
+from gnuradio.wxgui import stdgui, fftsink
+from optparse import OptionParser
+from gnuradio import eng_notation
+
+
+def main ():
+ parser = OptionParser (option_class=eng_option)
+ parser.add_option ("-g", "--gain", type="eng_float", default=-1,
+ help="set front end gain to GAIN [0,1000]")
+ parser.add_option ("-f", "--freq", type="eng_float", default=-1,
+ help="set front end center frequency to FREQ")
+ parser.add_option ("-t", "--type", type="string", default="4937",
+ help="select eval board type {4937 or 4702}")
+ parser.add_option ("-p", "--port", type="int", default=0,
+ help="parallel port eval board is attached to")
+ (options, args) = parser.parse_args ()
+
+ if options.type == "4937":
+ front_end = gr.microtune_4937_eval_board (options.port)
+ elif options.type == "4702":
+ front_end = gr.microtune_4702_eval_board (options.port)
+ else:
+ raise RuntimeError, "Invalid board type. Must be either -t 4937 or -t 4702"
+
+ if options.gain != -1:
+ front_end.set_AGC (options.gain)
+
+ if options.freq != -1:
+ if options.freq < 1e6:
+ options.freq = options.freq * 1e6
+
+ actual = front_end.set_RF_freq (options.freq)
+ print "microtune: actual freq = %s" % (eng_notation.num_to_str (actual),)
+
+
+if __name__ == '__main__':
+ main ()
diff --git a/gnuradio-core/src/python/build_utils.py b/gnuradio-core/src/python/build_utils.py
new file mode 100644
index 000000000..cf58a9763
--- /dev/null
+++ b/gnuradio-core/src/python/build_utils.py
@@ -0,0 +1,226 @@
+#
+# Copyright 2004,2009,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.
+#
+
+"""Misc utilities used at build time
+"""
+
+import re, os, os.path
+from build_utils_codes import *
+
+
+# set srcdir to the directory that contains Makefile.am
+try:
+ srcdir = os.environ['srcdir']
+except KeyError, e:
+ srcdir = "."
+srcdir = srcdir + '/'
+
+# set do_makefile to either true or false dependeing on the environment
+try:
+ if os.environ['do_makefile'] == '0':
+ do_makefile = False
+ else:
+ do_makefile = True
+except KeyError, e:
+ do_makefile = False
+
+# set do_sources to either true or false dependeing on the environment
+try:
+ if os.environ['do_sources'] == '0':
+ do_sources = False
+ else:
+ do_sources = True
+except KeyError, e:
+ do_sources = True
+
+name_dict = {}
+
+def log_output_name (name):
+ (base, ext) = os.path.splitext (name)
+ ext = ext[1:] # drop the leading '.'
+
+ entry = name_dict.setdefault (ext, [])
+ entry.append (name)
+
+def open_and_log_name (name, dir):
+ global do_sources
+ if do_sources:
+ f = open (name, dir)
+ else:
+ f = None
+ log_output_name (name)
+ return f
+
+def expand_template (d, template_filename, extra = ""):
+ '''Given a dictionary D and a TEMPLATE_FILENAME, expand template into output file
+ '''
+ global do_sources
+ output_extension = extract_extension (template_filename)
+ template = open_src (template_filename, 'r')
+ output_name = d['NAME'] + extra + '.' + output_extension
+ log_output_name (output_name)
+ if do_sources:
+ output = open (output_name, 'w')
+ do_substitution (d, template, output)
+ output.close ()
+ template.close ()
+
+def output_glue (dirname):
+ output_makefile_fragment ()
+ output_ifile_include (dirname)
+
+def output_makefile_fragment ():
+ global do_makefile
+ if not do_makefile:
+ return
+# overwrite the source, which must be writable; this should have been
+# checked for beforehand in the top-level Makefile.gen.gen .
+ f = open (os.path.join (os.environ.get('gendir', os.environ.get('srcdir', '.')), 'Makefile.gen'), 'w')
+ f.write ('#\n# This file is machine generated. All edits will be overwritten\n#\n')
+ output_subfrag (f, 'h')
+ output_subfrag (f, 'i')
+ output_subfrag (f, 'cc')
+ f.close ()
+
+def output_ifile_include (dirname):
+ global do_sources
+ if do_sources:
+ f = open ('%s_generated.i' % (dirname,), 'w')
+ f.write ('//\n// This file is machine generated. All edits will be overwritten\n//\n')
+ files = name_dict.setdefault ('i', [])
+ files.sort ()
+ f.write ('%{\n')
+ for file in files:
+ f.write ('#include <%s>\n' % (file[0:-1] + 'h',))
+ f.write ('%}\n\n')
+ for file in files:
+ f.write ('%%include <%s>\n' % (file,))
+
+def output_subfrag (f, ext):
+ files = name_dict.setdefault (ext, [])
+ files.sort ()
+ f.write ("GENERATED_%s =" % (ext.upper ()))
+ for file in files:
+ f.write (" \\\n\t%s" % (file,))
+ f.write ("\n\n")
+
+def extract_extension (template_name):
+ # template name is something like: GrFIRfilterXXX.h.t
+ # we return everything between the penultimate . and .t
+ mo = re.search (r'\.([a-z]+)\.t$', template_name)
+ if not mo:
+ raise ValueError, "Incorrectly formed template_name '%s'" % (template_name,)
+ return mo.group (1)
+
+def open_src (name, mode):
+ global srcdir
+ return open (os.path.join (srcdir, name), mode)
+
+def do_substitution (d, in_file, out_file):
+ def repl (match_obj):
+ key = match_obj.group (1)
+ # print key
+ return d[key]
+
+ inp = in_file.read ()
+ out = re.sub (r"@([a-zA-Z0-9_]+)@", repl, inp)
+ out_file.write (out)
+
+
+
+copyright = '''/* -*- c++ -*- */
+/*
+ * Copyright 2003,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.
+ */
+'''
+
+def is_complex (code3):
+ if i_code (code3) == 'c' or o_code (code3) == 'c':
+ return '1'
+ else:
+ return '0'
+
+
+def standard_dict (name, code3, package='gr'):
+ d = {}
+ d['NAME'] = name
+ d['NAME_IMPL'] = name+'_impl'
+ d['GUARD_NAME'] = 'INCLUDED_%s_%s_H' % (package.upper(), name.upper())
+ d['GUARD_NAME_IMPL'] = 'INCLUDED_%s_%s_IMPL_H' % (package.upper(), name.upper())
+ d['BASE_NAME'] = re.sub ('^' + package + '_', '', name)
+ d['SPTR_NAME'] = '%s_sptr' % name
+ d['WARNING'] = 'WARNING: this file is machine generated. Edits will be overwritten'
+ d['COPYRIGHT'] = copyright
+ d['TYPE'] = i_type (code3)
+ d['I_TYPE'] = i_type (code3)
+ d['O_TYPE'] = o_type (code3)
+ d['TAP_TYPE'] = tap_type (code3)
+ d['IS_COMPLEX'] = is_complex (code3)
+ return d
+
+
+def standard_dict2 (name, code3, package):
+ d = {}
+ d['NAME'] = name
+ d['BASE_NAME'] = name
+ d['GUARD_NAME'] = 'INCLUDED_%s_%s_H' % (package.upper(), name.upper())
+ d['WARNING'] = 'WARNING: this file is machine generated. Edits will be overwritten'
+ d['COPYRIGHT'] = copyright
+ d['TYPE'] = i_type (code3)
+ d['I_TYPE'] = i_type (code3)
+ d['O_TYPE'] = o_type (code3)
+ d['TAP_TYPE'] = tap_type (code3)
+ d['IS_COMPLEX'] = is_complex (code3)
+ return d
+
+def standard_impl_dict2 (name, code3, package):
+ d = {}
+ d['NAME'] = name
+ d['IMPL_NAME'] = name
+ d['BASE_NAME'] = name.rstrip("impl").rstrip("_")
+ d['GUARD_NAME'] = 'INCLUDED_%s_%s_H' % (package.upper(), name.upper())
+ d['WARNING'] = 'WARNING: this file is machine generated. Edits will be overwritten'
+ d['COPYRIGHT'] = copyright
+ d['FIR_TYPE'] = "fir_filter_" + code3
+ d['CFIR_TYPE'] = "fir_filter_" + code3[0:2] + 'c'
+ d['TYPE'] = i_type (code3)
+ d['I_TYPE'] = i_type (code3)
+ d['O_TYPE'] = o_type (code3)
+ d['TAP_TYPE'] = tap_type (code3)
+ d['IS_COMPLEX'] = is_complex (code3)
+ return d
diff --git a/gnuradio-core/src/python/build_utils_codes.py b/gnuradio-core/src/python/build_utils_codes.py
new file mode 100644
index 000000000..9ea96baae
--- /dev/null
+++ b/gnuradio-core/src/python/build_utils_codes.py
@@ -0,0 +1,52 @@
+#
+# 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.
+#
+
+def i_code (code3):
+ return code3[0]
+
+def o_code (code3):
+ if len (code3) >= 2:
+ return code3[1]
+ else:
+ return code3[0]
+
+def tap_code (code3):
+ if len (code3) >= 3:
+ return code3[2]
+ else:
+ return code3[0]
+
+def i_type (code3):
+ return char_to_type[i_code (code3)]
+
+def o_type (code3):
+ return char_to_type[o_code (code3)]
+
+def tap_type (code3):
+ return char_to_type[tap_code (code3)]
+
+
+char_to_type = {}
+char_to_type['s'] = 'short'
+char_to_type['i'] = 'int'
+char_to_type['f'] = 'float'
+char_to_type['c'] = 'gr_complex'
+char_to_type['b'] = 'unsigned char'
diff --git a/gnuradio-core/src/python/gnuradio/CMakeLists.txt b/gnuradio-core/src/python/gnuradio/CMakeLists.txt
new file mode 100644
index 000000000..bf696e0d3
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/CMakeLists.txt
@@ -0,0 +1,38 @@
+# 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.
+
+include(GrPython)
+
+add_subdirectory(gr)
+add_subdirectory(gru)
+add_subdirectory(gruimpl)
+add_subdirectory(blks2)
+add_subdirectory(blks2impl)
+
+GR_PYTHON_INSTALL(FILES
+ __init__.py
+ eng_notation.py
+ eng_option.py
+ gr_unittest.py
+ gr_xmlrunner.py
+ optfir.py
+ window.py
+ DESTINATION ${GR_PYTHON_DIR}/gnuradio
+ COMPONENT "core_python"
+)
diff --git a/gnuradio-core/src/python/gnuradio/__init__.py b/gnuradio-core/src/python/gnuradio/__init__.py
new file mode 100644
index 000000000..a4917cf64
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/__init__.py
@@ -0,0 +1 @@
+# make this a package
diff --git a/gnuradio-core/src/python/gnuradio/blks2/CMakeLists.txt b/gnuradio-core/src/python/gnuradio/blks2/CMakeLists.txt
new file mode 100644
index 000000000..83d11dd83
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/blks2/CMakeLists.txt
@@ -0,0 +1,26 @@
+# 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.
+
+include(GrPython)
+
+GR_PYTHON_INSTALL(
+ FILES __init__.py
+ DESTINATION ${GR_PYTHON_DIR}/gnuradio/blks2
+ COMPONENT "core_python"
+)
diff --git a/gnuradio-core/src/python/gnuradio/blks2/__init__.py b/gnuradio-core/src/python/gnuradio/blks2/__init__.py
new file mode 100644
index 000000000..2dfdc77f4
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/blks2/__init__.py
@@ -0,0 +1,37 @@
+#
+# Copyright 2005 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.
+#
+
+import glob
+import os.path
+
+# Semi-hideous kludge to import everything in the blksimpl2 directory
+# into the gnuradio.blks2 namespace. This keeps us from having to remember
+# to manually update this file.
+
+for p in __path__:
+ filenames = glob.glob (os.path.join (p, "..", "blks2impl", "*.py"))
+ for f in filenames:
+ f = os.path.basename(f).lower()
+ f = f[:-3]
+ if f == '__init__':
+ continue
+ # print f
+ exec "from gnuradio.blks2impl.%s import *" % (f,)
diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/CMakeLists.txt b/gnuradio-core/src/python/gnuradio/blks2impl/CMakeLists.txt
new file mode 100644
index 000000000..61fcdda42
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/blks2impl/CMakeLists.txt
@@ -0,0 +1,45 @@
+# 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.
+
+include(GrPython)
+
+GR_PYTHON_INSTALL(FILES
+ __init__.py
+ am_demod.py
+ channel_model.py
+ filterbank.py
+ fm_demod.py
+ fm_emph.py
+ logpwrfft.py
+ nbfm_rx.py
+ nbfm_tx.py
+ pfb_arb_resampler.py
+ pfb_channelizer.py
+ pfb_decimator.py
+ pfb_interpolator.py
+ rational_resampler.py
+ standard_squelch.py
+ stream_to_vector_decimator.py
+ wfm_rcv.py
+ wfm_rcv_fmdet.py
+ wfm_rcv_pll.py
+ wfm_tx.py
+ DESTINATION ${GR_PYTHON_DIR}/gnuradio/blks2impl
+ COMPONENT "core_python"
+)
diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/__init__.py b/gnuradio-core/src/python/gnuradio/blks2impl/__init__.py
new file mode 100644
index 000000000..a4917cf64
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/blks2impl/__init__.py
@@ -0,0 +1 @@
+# make this a package
diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/am_demod.py b/gnuradio-core/src/python/gnuradio/blks2impl/am_demod.py
new file mode 100644
index 000000000..68d024565
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/blks2impl/am_demod.py
@@ -0,0 +1,75 @@
+#
+# Copyright 2006,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.
+#
+
+from gnuradio import gr, optfir
+
+class am_demod_cf(gr.hier_block2):
+ """
+ Generalized AM demodulation block with audio filtering.
+
+ This block demodulates a band-limited, complex down-converted AM
+ channel into the the original baseband signal, applying low pass
+ filtering to the audio output. It produces a float stream in the
+ range [-1.0, +1.0].
+
+ @param channel_rate: incoming sample rate of the AM baseband
+ @type sample_rate: integer
+ @param audio_decim: input to output decimation rate
+ @type audio_decim: integer
+ @param audio_pass: audio low pass filter passband frequency
+ @type audio_pass: float
+ @param audio_stop: audio low pass filter stop frequency
+ @type audio_stop: float
+ """
+ def __init__(self, channel_rate, audio_decim, audio_pass, audio_stop):
+ gr.hier_block2.__init__(self, "am_demod_cf",
+ gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature
+ gr.io_signature(1, 1, gr.sizeof_float)) # Input signature
+
+ MAG = gr.complex_to_mag()
+ DCR = gr.add_const_ff(-1.0)
+
+ audio_taps = optfir.low_pass(0.5, # Filter gain
+ channel_rate, # Sample rate
+ audio_pass, # Audio passband
+ audio_stop, # Audio stopband
+ 0.1, # Passband ripple
+ 60) # Stopband attenuation
+ LPF = gr.fir_filter_fff(audio_decim, audio_taps)
+
+ self.connect(self, MAG, DCR, LPF, self)
+
+class demod_10k0a3e_cf(am_demod_cf):
+ """
+ AM demodulation block, 10 KHz channel.
+
+ This block demodulates an AM channel conformant to 10K0A3E emission
+ standards, such as broadcast band AM transmissions.
+
+ @param channel_rate: incoming sample rate of the AM baseband
+ @type sample_rate: integer
+ @param audio_decim: input to output decimation rate
+ @type audio_decim: integer
+ """
+ def __init__(self, channel_rate, audio_decim):
+ am_demod_cf.__init__(self, channel_rate, audio_decim,
+ 5000, # Audio passband
+ 5500) # Audio stopband
diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/channel_model.py b/gnuradio-core/src/python/gnuradio/blks2impl/channel_model.py
new file mode 100644
index 000000000..e5cd471df
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/blks2impl/channel_model.py
@@ -0,0 +1,26 @@
+#!/usr/bin/env python
+#
+# 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.
+#
+
+from gnuradio import gr
+
+# This block is now a C++ hierarchical block, gr.channel_model
+channel_model = gr.channel_model
diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/digital_voice.py.real b/gnuradio-core/src/python/gnuradio/blks2impl/digital_voice.py.real
new file mode 100644
index 000000000..6ec66825c
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/blks2impl/digital_voice.py.real
@@ -0,0 +1,102 @@
+#!/usr/bin/env python
+#
+# Copyright 2005 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.
+#
+
+"""
+Digital voice Tx and Rx using GSM 13kbit vocoder and GMSK.
+
+Runs channel at 32kbit/sec. Currently uses fake channel coding,
+but there's room for a rate 1/2 coder.
+"""
+
+from gnuradio import gr, gru
+from gnuradio.blksimpl.gmsk import gmsk_mod, gmsk_demod
+
+from gnuradio.vocoder import gsm_full_rate
+
+# Size of gsm full rate speech encoder output packet in bytes
+
+GSM_FRAME_SIZE = 33
+
+# Size of packet in bytes that we send to GMSK modulator:
+#
+# Target: 256kS/sec air rate.
+#
+# 256kS 1 sym 1 bit 1 byte 0.020 sec 80 bytes
+# ---- * ----- * ----- * ------ * --------- = --------
+# sec 8 S 1 sym 8 bits frame frame
+#
+# gr_simple_framer add 10 bytes of overhead.
+
+AIR_FRAME_SIZE = 70
+
+
+class digital_voice_tx(gr.hier_block):
+ """
+ Hierarchical block for digital voice tranmission.
+
+ The input is 8kS/sec floating point audio in the range [-1,+1]
+ The output is 256kS/sec GMSK modulated complex baseband signal in the range [-1,+1].
+ """
+ def __init__(self, fg):
+ samples_per_symbol = 8
+ symbol_rate = 32000
+ bt = 0.3 # Gaussian filter bandwidth * symbol time
+
+ src_scale = gr.multiply_const_ff(32767)
+ f2s = gr.float_to_short()
+ voice_coder = gsm_full_rate.encode_sp()
+
+ channel_coder = gr.fake_channel_encoder_pp(GSM_FRAME_SIZE, AIR_FRAME_SIZE)
+ p2s = gr.parallel_to_serial(gr.sizeof_char, AIR_FRAME_SIZE)
+
+ mod = gmsk_mod(fg, sps=samples_per_symbol,
+ symbol_rate=symbol_rate, bt=bt,
+ p_size=AIR_FRAME_SIZE)
+
+ fg.connect(src_scale, f2s, voice_coder, channel_coder, p2s, mod)
+ gr.hier_block.__init__(self, fg, src_scale, mod)
+
+
+class digital_voice_rx(gr.hier_block):
+ """
+ Hierarchical block for digital voice reception.
+
+ The input is 256kS/sec GMSK modulated complex baseband signal.
+ The output is 8kS/sec floating point audio in the range [-1,+1]
+ """
+ def __init__(self, fg):
+ samples_per_symbol = 8
+ symbol_rate = 32000
+
+ demod = gmsk_demod(fg, sps=samples_per_symbol,
+ symbol_rate=symbol_rate,
+ p_size=AIR_FRAME_SIZE)
+
+ s2p = gr.serial_to_parallel(gr.sizeof_char, AIR_FRAME_SIZE)
+ channel_decoder = gr.fake_channel_decoder_pp(AIR_FRAME_SIZE, GSM_FRAME_SIZE)
+
+ voice_decoder = gsm_full_rate.decode_ps()
+ s2f = gr.short_to_float ()
+ sink_scale = gr.multiply_const_ff(1.0/32767.)
+
+ fg.connect(demod, s2p, channel_decoder, voice_decoder, s2f, sink_scale)
+ gr.hier_block.__init__(self, fg, demod, sink_scale)
diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/filterbank.py b/gnuradio-core/src/python/gnuradio/blks2impl/filterbank.py
new file mode 100644
index 000000000..08f1d450b
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/blks2impl/filterbank.py
@@ -0,0 +1,169 @@
+#
+# Copyright 2005,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.
+#
+
+import sys
+from gnuradio import gr, gru
+
+def _generate_synthesis_taps(mpoints):
+ return [] # FIXME
+
+
+def _split_taps(taps, mpoints):
+ assert (len(taps) % mpoints) == 0
+ result = [list() for x in range(mpoints)]
+ for i in xrange(len(taps)):
+ (result[i % mpoints]).append(taps[i])
+ return [tuple(x) for x in result]
+
+
+class synthesis_filterbank(gr.hier_block2):
+ """
+ Uniformly modulated polyphase DFT filter bank: synthesis
+
+ See http://cnx.org/content/m10424/latest
+ """
+ def __init__(self, mpoints, taps=None):
+ """
+ Takes M complex streams in, produces single complex stream out
+ that runs at M times the input sample rate
+
+ @param mpoints: number of freq bins/interpolation factor/subbands
+ @param taps: filter taps for subband filter
+
+ The channel spacing is equal to the input sample rate.
+ The total bandwidth and output sample rate are equal the input
+ sample rate * nchannels.
+
+ Output stream to frequency mapping:
+
+ channel zero is at zero frequency.
+
+ if mpoints is odd:
+
+ Channels with increasing positive frequencies come from
+ channels 1 through (N-1)/2.
+
+ Channel (N+1)/2 is the maximum negative frequency, and
+ frequency increases through N-1 which is one channel lower
+ than the zero frequency.
+
+ if mpoints is even:
+
+ Channels with increasing positive frequencies come from
+ channels 1 through (N/2)-1.
+
+ Channel (N/2) is evenly split between the max positive and
+ negative bins.
+
+ Channel (N/2)+1 is the maximum negative frequency, and
+ frequency increases through N-1 which is one channel lower
+ than the zero frequency.
+
+ Channels near the frequency extremes end up getting cut
+ off by subsequent filters and therefore have diminished
+ utility.
+ """
+ item_size = gr.sizeof_gr_complex
+ gr.hier_block2.__init__(self, "synthesis_filterbank",
+ gr.io_signature(mpoints, mpoints, item_size), # Input signature
+ gr.io_signature(1, 1, item_size)) # Output signature
+
+
+ if taps is None:
+ taps = _generate_synthesis_taps(mpoints)
+
+ # pad taps to multiple of mpoints
+ r = len(taps) % mpoints
+ if r != 0:
+ taps = taps + (mpoints - r) * (0,)
+
+ # split in mpoints separate set of taps
+ sub_taps = _split_taps(taps, mpoints)
+
+ self.ss2v = gr.streams_to_vector(item_size, mpoints)
+ self.ifft = gr.fft_vcc(mpoints, False, [])
+ self.v2ss = gr.vector_to_streams(item_size, mpoints)
+ # mpoints filters go in here...
+ self.ss2s = gr.streams_to_stream(item_size, mpoints)
+
+ for i in range(mpoints):
+ self.connect((self, i), (self.ss2v, i))
+
+ self.connect(self.ss2v, self.ifft, self.v2ss)
+
+ # build mpoints fir filters...
+ for i in range(mpoints):
+ f = gr.fft_filter_ccc(1, sub_taps[i])
+ self.connect((self.v2ss, i), f)
+ self.connect(f, (self.ss2s, i))
+
+ self.connect(self.ss2s, self)
+
+class analysis_filterbank(gr.hier_block2):
+ """
+ Uniformly modulated polyphase DFT filter bank: analysis
+
+ See http://cnx.org/content/m10424/latest
+ """
+ def __init__(self, mpoints, taps=None):
+ """
+ Takes 1 complex stream in, produces M complex streams out
+ that runs at 1/M times the input sample rate
+
+ @param mpoints: number of freq bins/interpolation factor/subbands
+ @param taps: filter taps for subband filter
+
+ Same channel to frequency mapping as described above.
+ """
+ item_size = gr.sizeof_gr_complex
+ gr.hier_block2.__init__(self, "analysis_filterbank",
+ gr.io_signature(1, 1, item_size), # Input signature
+ gr.io_signature(mpoints, mpoints, item_size)) # Output signature
+
+ if taps is None:
+ taps = _generate_synthesis_taps(mpoints)
+
+ # pad taps to multiple of mpoints
+ r = len(taps) % mpoints
+ if r != 0:
+ taps = taps + (mpoints - r) * (0,)
+
+ # split in mpoints separate set of taps
+ sub_taps = _split_taps(taps, mpoints)
+
+ # print >> sys.stderr, "mpoints =", mpoints, "len(sub_taps) =", len(sub_taps)
+
+ self.s2ss = gr.stream_to_streams(item_size, mpoints)
+ # filters here
+ self.ss2v = gr.streams_to_vector(item_size, mpoints)
+ self.fft = gr.fft_vcc(mpoints, True, [])
+ self.v2ss = gr.vector_to_streams(item_size, mpoints)
+
+ self.connect(self, self.s2ss)
+
+ # build mpoints fir filters...
+ for i in range(mpoints):
+ f = gr.fft_filter_ccc(1, sub_taps[mpoints-i-1])
+ self.connect((self.s2ss, i), f)
+ self.connect(f, (self.ss2v, i))
+ self.connect((self.v2ss, i), (self, i))
+
+ self.connect(self.ss2v, self.fft, self.v2ss)
diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/fm_demod.py b/gnuradio-core/src/python/gnuradio/blks2impl/fm_demod.py
new file mode 100644
index 000000000..6bc0d7ed0
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/blks2impl/fm_demod.py
@@ -0,0 +1,111 @@
+#
+# Copyright 2006,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.
+#
+
+from gnuradio import gr, optfir
+from gnuradio.blks2impl.fm_emph import fm_deemph
+from math import pi
+
+class fm_demod_cf(gr.hier_block2):
+ """
+ Generalized FM demodulation block with deemphasis and audio
+ filtering.
+
+ This block demodulates a band-limited, complex down-converted FM
+ channel into the the original baseband signal, optionally applying
+ deemphasis. Low pass filtering is done on the resultant signal. It
+ produces an output float strem in the range of [-1.0, +1.0].
+
+ @param channel_rate: incoming sample rate of the FM baseband
+ @type sample_rate: integer
+ @param deviation: maximum FM deviation (default = 5000)
+ @type deviation: float
+ @param audio_decim: input to output decimation rate
+ @type audio_decim: integer
+ @param audio_pass: audio low pass filter passband frequency
+ @type audio_pass: float
+ @param audio_stop: audio low pass filter stop frequency
+ @type audio_stop: float
+ @param gain: gain applied to audio output (default = 1.0)
+ @type gain: float
+ @param tau: deemphasis time constant (default = 75e-6), specify 'None'
+ to prevent deemphasis
+ """
+ def __init__(self, channel_rate, audio_decim, deviation,
+ audio_pass, audio_stop, gain=1.0, tau=75e-6):
+ gr.hier_block2.__init__(self, "fm_demod_cf",
+ gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature
+ gr.io_signature(1, 1, gr.sizeof_float)) # Output signature
+
+ k = channel_rate/(2*pi*deviation)
+ QUAD = gr.quadrature_demod_cf(k)
+
+ audio_taps = optfir.low_pass(gain, # Filter gain
+ channel_rate, # Sample rate
+ audio_pass, # Audio passband
+ audio_stop, # Audio stopband
+ 0.1, # Passband ripple
+ 60) # Stopband attenuation
+ LPF = gr.fir_filter_fff(audio_decim, audio_taps)
+
+ if tau is not None:
+ DEEMPH = fm_deemph(channel_rate, tau)
+ self.connect(self, QUAD, DEEMPH, LPF, self)
+ else:
+ self.connect(self, QUAD, LPF, self)
+
+class demod_20k0f3e_cf(fm_demod_cf):
+ """
+ NBFM demodulation block, 20 KHz channels
+
+ This block demodulates a complex, downconverted, narrowband FM
+ channel conforming to 20K0F3E emission standards, outputting
+ floats in the range [-1.0, +1.0].
+
+ @param sample_rate: incoming sample rate of the FM baseband
+ @type sample_rate: integer
+ @param audio_decim: input to output decimation rate
+ @type audio_decim: integer
+ """
+ def __init__(self, channel_rate, audio_decim):
+ fm_demod_cf.__init__(self, channel_rate, audio_decim,
+ 5000, # Deviation
+ 3000, # Audio passband frequency
+ 4500) # Audio stopband frequency
+
+class demod_200kf3e_cf(fm_demod_cf):
+ """
+ WFM demodulation block, mono.
+
+ This block demodulates a complex, downconverted, wideband FM
+ channel conforming to 200KF3E emission standards, outputting
+ floats in the range [-1.0, +1.0].
+
+ @param sample_rate: incoming sample rate of the FM baseband
+ @type sample_rate: integer
+ @param audio_decim: input to output decimation rate
+ @type audio_decim: integer
+ """
+ def __init__(self, channel_rate, audio_decim):
+ fm_demod_cf.__init__(self, channel_rate, audio_decim,
+ 75000, # Deviation
+ 15000, # Audio passband
+ 16000, # Audio stopband
+ 20.0) # Audio gain
diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/fm_emph.py b/gnuradio-core/src/python/gnuradio/blks2impl/fm_emph.py
new file mode 100644
index 000000000..fc3f2d60d
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/blks2impl/fm_emph.py
@@ -0,0 +1,151 @@
+#
+# Copyright 2005,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.
+#
+
+from gnuradio import gr
+import math
+
+
+#
+# 1
+# H(s) = -------
+# 1 + s
+#
+# tau is the RC time constant.
+# critical frequency: w_p = 1/tau
+#
+# We prewarp and use the bilinear z-transform to get our IIR coefficients.
+# See "Digital Signal Processing: A Practical Approach" by Ifeachor and Jervis
+#
+
+class fm_deemph(gr.hier_block2):
+ """
+ FM Deemphasis IIR filter.
+ """
+
+
+ def __init__(self, fs, tau=75e-6):
+ """
+ @param fs: sampling frequency in Hz
+ @type fs: float
+ @param tau: Time constant in seconds (75us in US, 50us in EUR)
+ @type tau: float
+ """
+ gr.hier_block2.__init__(self, "fm_deemph",
+ gr.io_signature(1, 1, gr.sizeof_float), # Input signature
+ gr.io_signature(1, 1, gr.sizeof_float)) # Output signature
+
+ w_p = 1/tau
+ w_pp = math.tan (w_p / (fs * 2)) # prewarped analog freq
+
+ a1 = (w_pp - 1)/(w_pp + 1)
+ b0 = w_pp/(1 + w_pp)
+ b1 = b0
+
+ btaps = [b0, b1]
+ ataps = [1, a1]
+
+ if 0:
+ print "btaps =", btaps
+ print "ataps =", ataps
+ global plot1
+ plot1 = gru.gnuplot_freqz (gru.freqz (btaps, ataps), fs, True)
+
+ deemph = gr.iir_filter_ffd(btaps, ataps)
+ self.connect(self, deemph, self)
+
+#
+# 1 + s*t1
+# H(s) = ----------
+# 1 + s*t2
+#
+# I think this is the right transfer function.
+#
+#
+# This fine ASCII rendition is based on Figure 5-15
+# in "Digital and Analog Communication Systems", Leon W. Couch II
+#
+#
+# R1
+# +-----||------+
+# | |
+# o------+ +-----+--------o
+# | C1 | |
+# +----/\/\/\/--+ \
+# /
+# \ R2
+# /
+# \
+# |
+# o--------------------------+--------o
+#
+# f1 = 1/(2*pi*t1) = 1/(2*pi*R1*C)
+#
+# 1 R1 + R2
+# f2 = ------- = ------------
+# 2*pi*t2 2*pi*R1*R2*C
+#
+# t1 is 75us in US, 50us in EUR
+# f2 should be higher than our audio bandwidth.
+#
+#
+# The Bode plot looks like this:
+#
+#
+# /----------------
+# /
+# / <-- slope = 20dB/decade
+# /
+# -------------/
+# f1 f2
+#
+# We prewarp and use the bilinear z-transform to get our IIR coefficients.
+# See "Digital Signal Processing: A Practical Approach" by Ifeachor and Jervis
+#
+
+class fm_preemph(gr.hier_block2):
+ """
+ FM Preemphasis IIR filter.
+ """
+ def __init__(self, fs, tau=75e-6):
+ """
+ @param fs: sampling frequency in Hz
+ @type fs: float
+ @param tau: Time constant in seconds (75us in US, 50us in EUR)
+ @type tau: float
+ """
+
+ gr.hier_block2.__init__(self, "fm_deemph",
+ gr.io_signature(1, 1, gr.sizeof_float), # Input signature
+ gr.io_signature(1, 1, gr.sizeof_float)) # Output signature
+
+ # FIXME make this compute the right answer
+
+ btaps = [1]
+ ataps = [1]
+
+ if 0:
+ print "btaps =", btaps
+ print "ataps =", ataps
+ global plot2
+ plot2 = gru.gnuplot_freqz (gru.freqz (btaps, ataps), fs, True)
+
+ preemph = gr.iir_filter_ffd(btaps, ataps)
+ self.connect(self, preemph, self)
diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/logpwrfft.py b/gnuradio-core/src/python/gnuradio/blks2impl/logpwrfft.py
new file mode 100644
index 000000000..6f7fc520f
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/blks2impl/logpwrfft.py
@@ -0,0 +1,155 @@
+#
+# 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.
+#
+
+from gnuradio import gr, window
+from stream_to_vector_decimator import stream_to_vector_decimator
+import math
+
+class _logpwrfft_base(gr.hier_block2):
+ """
+ Create a log10(abs(fft)) stream chain, with real or complex input.
+ """
+
+ def __init__(self, sample_rate, fft_size, ref_scale, frame_rate, avg_alpha, average, win=None):
+ """
+ Create an log10(abs(fft)) stream chain.
+ Provide access to the setting the filter and sample rate.
+ @param sample_rate Incoming stream sample rate
+ @param fft_size Number of FFT bins
+ @param ref_scale Sets 0 dB value input amplitude
+ @param frame_rate Output frame rate
+ @param avg_alpha FFT averaging (over time) constant [0.0-1.0]
+ @param average Whether to average [True, False]
+ @param win the window taps generation function
+ """
+ gr.hier_block2.__init__(self, self._name,
+ gr.io_signature(1, 1, self._item_size), # Input signature
+ gr.io_signature(1, 1, gr.sizeof_float*fft_size)) # Output signature
+
+ self._sd = stream_to_vector_decimator(item_size=self._item_size,
+ sample_rate=sample_rate,
+ vec_rate=frame_rate,
+ vec_len=fft_size)
+
+ if win is None: win = window.blackmanharris
+ fft_window = win(fft_size)
+ fft = self._fft_block[0](fft_size, True, fft_window)
+ window_power = sum(map(lambda x: x*x, fft_window))
+
+ c2magsq = gr.complex_to_mag_squared(fft_size)
+ self._avg = gr.single_pole_iir_filter_ff(1.0, fft_size)
+ self._log = gr.nlog10_ff(10, fft_size,
+ -20*math.log10(fft_size) # Adjust for number of bins
+ -10*math.log10(window_power/fft_size) # Adjust for windowing loss
+ -20*math.log10(ref_scale/2)) # Adjust for reference scale
+ self.connect(self, self._sd, fft, c2magsq, self._avg, self._log, self)
+
+ self._average = average
+ self._avg_alpha = avg_alpha
+ self.set_avg_alpha(avg_alpha)
+ self.set_average(average)
+
+ def set_decimation(self, decim):
+ """
+ Set the decimation on stream decimator.
+ @param decim the new decimation
+ """
+ self._sd.set_decimation(decim)
+
+ def set_vec_rate(self, vec_rate):
+ """
+ Set the vector rate on stream decimator.
+ @param vec_rate the new vector rate
+ """
+ self._sd.set_vec_rate(vec_rate)
+
+ def set_sample_rate(self, sample_rate):
+ """
+ Set the new sampling rate
+ @param sample_rate the new rate
+ """
+ self._sd.set_sample_rate(sample_rate)
+
+ def set_average(self, average):
+ """
+ Set the averaging filter on/off.
+ @param average true to set averaging on
+ """
+ self._average = average
+ if self._average:
+ self._avg.set_taps(self._avg_alpha)
+ else:
+ self._avg.set_taps(1.0)
+
+ def set_avg_alpha(self, avg_alpha):
+ """
+ Set the average alpha and set the taps if average was on.
+ @param avg_alpha the new iir filter tap
+ """
+ self._avg_alpha = avg_alpha
+ self.set_average(self._average)
+
+ def sample_rate(self):
+ """
+ Return the current sample rate.
+ """
+ return self._sd.sample_rate()
+
+ def decimation(self):
+ """
+ Return the current decimation.
+ """
+ return self._sd.decimation()
+
+ def frame_rate(self):
+ """
+ Return the current frame rate.
+ """
+ return self._sd.frame_rate()
+
+ def average(self):
+ """
+ Return whether or not averaging is being performed.
+ """
+ return self._average
+
+ def avg_alpha(self):
+ """
+ Return averaging filter constant.
+ """
+ return self._avg_alpha
+
+class logpwrfft_f(_logpwrfft_base):
+ """
+ Create an fft block chain, with real input.
+ """
+ _name = "logpwrfft_f"
+ _item_size = gr.sizeof_float
+ _fft_block = (gr.fft_vfc, )
+
+class logpwrfft_c(_logpwrfft_base):
+ """
+ Create an fft block chain, with complex input.
+ """
+ _name = "logpwrfft_c"
+ _item_size = gr.sizeof_gr_complex
+ _fft_block = (gr.fft_vcc, )
+
diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/nbfm_rx.py b/gnuradio-core/src/python/gnuradio/blks2impl/nbfm_rx.py
new file mode 100644
index 000000000..8bcb47ae1
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/blks2impl/nbfm_rx.py
@@ -0,0 +1,88 @@
+#
+# Copyright 2005 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.
+#
+
+import math
+from gnuradio import gr, optfir
+from gnuradio.blks2impl.fm_emph import fm_deemph
+#from gnuradio.blks2impl.standard_squelch import standard_squelch
+
+class nbfm_rx(gr.hier_block2):
+ def __init__(self, audio_rate, quad_rate, tau=75e-6, max_dev=5e3):
+ """
+ Narrow Band FM Receiver.
+
+ Takes a single complex baseband input stream and produces a single
+ float output stream of audio sample in the range [-1, +1].
+
+ @param audio_rate: sample rate of audio stream, >= 16k
+ @type audio_rate: integer
+ @param quad_rate: sample rate of output stream
+ @type quad_rate: integer
+ @param tau: preemphasis time constant (default 75e-6)
+ @type tau: float
+ @param max_dev: maximum deviation in Hz (default 5e3)
+ @type max_dev: float
+
+ quad_rate must be an integer multiple of audio_rate.
+
+ Exported sub-blocks (attributes):
+ squelch
+ quad_demod
+ deemph
+ audio_filter
+ """
+
+ gr.hier_block2.__init__(self, "nbfm_rx",
+ gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature
+ gr.io_signature(1, 1, gr.sizeof_float)) # Output signature
+
+ # FIXME audio_rate and quad_rate ought to be exact rationals
+ audio_rate = int(audio_rate)
+ quad_rate = int(quad_rate)
+
+ if quad_rate % audio_rate != 0:
+ raise ValueError, "quad_rate is not an integer multiple of audio_rate"
+
+ squelch_threshold = 20 # dB
+ #self.squelch = gr.simple_squelch_cc(squelch_threshold, 0.001)
+
+ # FM Demodulator input: complex; output: float
+ k = quad_rate/(2*math.pi*max_dev)
+ self.quad_demod = gr.quadrature_demod_cf(k)
+
+ # FM Deemphasis IIR filter
+ self.deemph = fm_deemph (quad_rate, tau=tau)
+
+ # compute FIR taps for audio filter
+ audio_decim = quad_rate // audio_rate
+ audio_taps = gr.firdes.low_pass (1.0, # gain
+ quad_rate, # sampling rate
+ 2.7e3, # Audio LPF cutoff
+ 0.5e3, # Transition band
+ gr.firdes.WIN_HAMMING) # filter type
+
+ print "len(audio_taps) =", len(audio_taps)
+
+ # Decimating audio filter
+ # input: float; output: float; taps: float
+ self.audio_filter = gr.fir_filter_fff(audio_decim, audio_taps)
+
+ self.connect(self, self.quad_demod, self.deemph, self.audio_filter, self)
diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/nbfm_tx.py b/gnuradio-core/src/python/gnuradio/blks2impl/nbfm_tx.py
new file mode 100644
index 000000000..839cf6784
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/blks2impl/nbfm_tx.py
@@ -0,0 +1,92 @@
+#
+# Copyright 2005 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.
+#
+
+import math
+from gnuradio import gr, optfir
+from gnuradio.blks2impl.fm_emph import fm_preemph
+
+#from gnuradio import ctcss
+
+class nbfm_tx(gr.hier_block2):
+ def __init__(self, audio_rate, quad_rate, tau=75e-6, max_dev=5e3):
+ """
+ Narrow Band FM Transmitter.
+
+ Takes a single float input stream of audio samples in the range [-1,+1]
+ and produces a single FM modulated complex baseband output.
+
+ @param audio_rate: sample rate of audio stream, >= 16k
+ @type audio_rate: integer
+ @param quad_rate: sample rate of output stream
+ @type quad_rate: integer
+ @param tau: preemphasis time constant (default 75e-6)
+ @type tau: float
+ @param max_dev: maximum deviation in Hz (default 5e3)
+ @type max_dev: float
+
+ quad_rate must be an integer multiple of audio_rate.
+ """
+
+ gr.hier_block2.__init__(self, "nbfm_tx",
+ gr.io_signature(1, 1, gr.sizeof_float), # Input signature
+ gr.io_signature(1, 1, gr.sizeof_gr_complex)) # Output signature
+
+ # FIXME audio_rate and quad_rate ought to be exact rationals
+ audio_rate = int(audio_rate)
+ quad_rate = int(quad_rate)
+
+ if quad_rate % audio_rate != 0:
+ raise ValueError, "quad_rate is not an integer multiple of audio_rate"
+
+
+ do_interp = audio_rate != quad_rate
+
+ if do_interp:
+ interp_factor = quad_rate / audio_rate
+ interp_taps = optfir.low_pass (interp_factor, # gain
+ quad_rate, # Fs
+ 4500, # passband cutoff
+ 7000, # stopband cutoff
+ 0.1, # passband ripple dB
+ 40) # stopband atten dB
+
+ #print "len(interp_taps) =", len(interp_taps)
+ self.interpolator = gr.interp_fir_filter_fff (interp_factor, interp_taps)
+
+ self.preemph = fm_preemph (quad_rate, tau=tau)
+
+ k = 2 * math.pi * max_dev / quad_rate
+ self.modulator = gr.frequency_modulator_fc (k)
+
+ if do_interp:
+ self.connect (self, self.interpolator, self.preemph, self.modulator, self)
+ else:
+ self.connect(self, self.preemph, self.modulator, self)
+
+
+class ctcss_gen_f(gr.hier_block2):
+ def __init__(self, sample_rate, tone_freq):
+ gr.hier_block2.__init__(self, "ctcss_gen_f",
+ gr.io_signature(0, 0, 0), # Input signature
+ gr.io_signature(1, 1, gr.sizeof_float)) # Output signature
+
+ self.plgen = gr.sig_source_f(sample_rate, gr.GR_SIN_WAVE, tone_freq, 0.1, 0.0)
+ self.connect(self.plgen, self)
diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/pfb_arb_resampler.py b/gnuradio-core/src/python/gnuradio/blks2impl/pfb_arb_resampler.py
new file mode 100644
index 000000000..e83c327fc
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/blks2impl/pfb_arb_resampler.py
@@ -0,0 +1,128 @@
+#!/usr/bin/env python
+#
+# 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.
+#
+
+from gnuradio import gr, optfir
+
+class pfb_arb_resampler_ccf(gr.hier_block2):
+ '''
+ Convenience wrapper for the polyphase filterbank arbitrary resampler.
+
+ The block takes a single complex stream in and outputs a single complex
+ stream out. As such, it requires no extra glue to handle the input/output
+ streams. This block is provided to be consistent with the interface to the
+ other PFB block.
+ '''
+ def __init__(self, rate, taps=None, flt_size=32, atten=100):
+ gr.hier_block2.__init__(self, "pfb_arb_resampler_ccf",
+ gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature
+ gr.io_signature(1, 1, gr.sizeof_gr_complex)) # Output signature
+
+ self._rate = rate
+ self._size = flt_size
+
+ if taps is not None:
+ self._taps = taps
+ else:
+ # Create a filter that covers the full bandwidth of the input signal
+ bw = 0.4
+ tb = 0.2
+ ripple = 0.1
+ #self._taps = gr.firdes.low_pass_2(self._size, self._size, bw, tb, atten)
+ made = False
+ while not made:
+ try:
+ self._taps = optfir.low_pass(self._size, self._size, bw, bw+tb, ripple, atten)
+ made = True
+ except RuntimeError:
+ ripple += 0.01
+ made = False
+ print("Warning: set ripple to %.4f dB. If this is a problem, adjust the attenuation or create your own filter taps." % (ripple))
+
+ # Build in an exit strategy; if we've come this far, it ain't working.
+ if(ripple >= 1.0):
+ raise RuntimeError("optfir could not generate an appropriate filter.")
+
+ self.pfb = gr.pfb_arb_resampler_ccf(self._rate, self._taps, self._size)
+ #print "PFB has %d taps\n" % (len(self._taps),)
+
+ self.connect(self, self.pfb)
+ self.connect(self.pfb, self)
+
+ # Note -- set_taps not implemented in base class yet
+ def set_taps(self, taps):
+ self.pfb.set_taps(taps)
+
+ def set_rate(self, rate):
+ self.pfb.set_rate(rate)
+
+
+class pfb_arb_resampler_fff(gr.hier_block2):
+ '''
+ Convenience wrapper for the polyphase filterbank arbitrary resampler.
+
+ The block takes a single float stream in and outputs a single float
+ stream out. As such, it requires no extra glue to handle the input/output
+ streams. This block is provided to be consistent with the interface to the
+ other PFB block.
+ '''
+ def __init__(self, rate, taps=None, flt_size=32, atten=100):
+ gr.hier_block2.__init__(self, "pfb_arb_resampler_fff",
+ gr.io_signature(1, 1, gr.sizeof_float), # Input signature
+ gr.io_signature(1, 1, gr.sizeof_float)) # Output signature
+
+ self._rate = rate
+ self._size = flt_size
+
+ if taps is not None:
+ self._taps = taps
+ else:
+ # Create a filter that covers the full bandwidth of the input signal
+ bw = 0.4
+ tb = 0.2
+ ripple = 0.1
+ #self._taps = gr.firdes.low_pass_2(self._size, self._size, bw, tb, atten)
+ made = False
+ while not made:
+ try:
+ self._taps = optfir.low_pass(self._size, self._size, bw, bw+tb, ripple, atten)
+ made = True
+ except RuntimeError:
+ ripple += 0.01
+ made = False
+ print("Warning: set ripple to %.4f dB. If this is a problem, adjust the attenuation or create your own filter taps." % (ripple))
+
+ # Build in an exit strategy; if we've come this far, it ain't working.
+ if(ripple >= 1.0):
+ raise RuntimeError("optfir could not generate an appropriate filter.")
+
+ self.pfb = gr.pfb_arb_resampler_fff(self._rate, self._taps, self._size)
+ #print "PFB has %d taps\n" % (len(self._taps),)
+
+ self.connect(self, self.pfb)
+ self.connect(self.pfb, self)
+
+ # Note -- set_taps not implemented in base class yet
+ def set_taps(self, taps):
+ self.pfb.set_taps(taps)
+
+ def set_rate(self, rate):
+ self.pfb.set_rate(rate)
diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/pfb_channelizer.py b/gnuradio-core/src/python/gnuradio/blks2impl/pfb_channelizer.py
new file mode 100644
index 000000000..4bbe1bec6
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/blks2impl/pfb_channelizer.py
@@ -0,0 +1,73 @@
+#!/usr/bin/env python
+#
+# 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.
+#
+
+from gnuradio import gr, optfir
+
+class pfb_channelizer_ccf(gr.hier_block2):
+ '''
+ Make a Polyphase Filter channelizer (complex in, complex out, floating-point taps)
+
+ This simplifies the interface by allowing a single input stream to connect to this block.
+ It will then output a stream for each channel.
+ '''
+ def __init__(self, numchans, taps=None, oversample_rate=1, atten=100):
+ gr.hier_block2.__init__(self, "pfb_channelizer_ccf",
+ gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature
+ gr.io_signature(numchans, numchans, gr.sizeof_gr_complex)) # Output signature
+
+ self._nchans = numchans
+ self._oversample_rate = oversample_rate
+
+ if taps is not None:
+ self._taps = taps
+ else:
+ # Create a filter that covers the full bandwidth of the input signal
+ bw = 0.4
+ tb = 0.2
+ ripple = 0.1
+ made = False
+ while not made:
+ try:
+ self._taps = optfir.low_pass(1, self._nchans, bw, bw+tb, ripple, atten)
+ made = True
+ except RuntimeError:
+ ripple += 0.01
+ made = False
+ print("Warning: set ripple to %.4f dB. If this is a problem, adjust the attenuation or create your own filter taps." % (ripple))
+
+ # Build in an exit strategy; if we've come this far, it ain't working.
+ if(ripple >= 1.0):
+ raise RuntimeError("optfir could not generate an appropriate filter.")
+
+ self.s2ss = gr.stream_to_streams(gr.sizeof_gr_complex, self._nchans)
+ self.pfb = gr.pfb_channelizer_ccf(self._nchans, self._taps,
+ self._oversample_rate)
+ self.connect(self, self.s2ss)
+
+ for i in xrange(self._nchans):
+ self.connect((self.s2ss,i), (self.pfb,i))
+ self.connect((self.pfb,i), (self,i))
+
+ def set_channel_map(self, newmap):
+ self.pfb.set_channel_map(newmap)
+
+
diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/pfb_decimator.py b/gnuradio-core/src/python/gnuradio/blks2impl/pfb_decimator.py
new file mode 100644
index 000000000..adcdfe9ba
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/blks2impl/pfb_decimator.py
@@ -0,0 +1,69 @@
+#!/usr/bin/env python
+#
+# 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.
+#
+
+from gnuradio import gr, optfir
+
+class pfb_decimator_ccf(gr.hier_block2):
+ '''
+ Make a Polyphase Filter decimator (complex in, complex out, floating-point taps)
+
+ This simplifies the interface by allowing a single input stream to connect to this block.
+ It will then output a stream that is the decimated output stream.
+ '''
+ def __init__(self, decim, taps=None, channel=0, atten=100):
+ gr.hier_block2.__init__(self, "pfb_decimator_ccf",
+ gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature
+ gr.io_signature(1, 1, gr.sizeof_gr_complex)) # Output signature
+
+ self._decim = decim
+ self._channel = channel
+
+ if taps is not None:
+ self._taps = taps
+ else:
+ # Create a filter that covers the full bandwidth of the input signal
+ bw = 0.4
+ tb = 0.2
+ ripple = 0.1
+ made = False
+ while not made:
+ try:
+ self._taps = optfir.low_pass(1, self._decim, bw, bw+tb, ripple, atten)
+ made = True
+ except RuntimeError:
+ ripple += 0.01
+ made = False
+ print("Warning: set ripple to %.4f dB. If this is a problem, adjust the attenuation or create your own filter taps." % (ripple))
+
+ # Build in an exit strategy; if we've come this far, it ain't working.
+ if(ripple >= 1.0):
+ raise RuntimeError("optfir could not generate an appropriate filter.")
+
+ self.s2ss = gr.stream_to_streams(gr.sizeof_gr_complex, self._decim)
+ self.pfb = gr.pfb_decimator_ccf(self._decim, self._taps, self._channel)
+
+ self.connect(self, self.s2ss)
+
+ for i in xrange(self._decim):
+ self.connect((self.s2ss,i), (self.pfb,i))
+
+ self.connect(self.pfb, self)
diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/pfb_interpolator.py b/gnuradio-core/src/python/gnuradio/blks2impl/pfb_interpolator.py
new file mode 100644
index 000000000..5492dfcac
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/blks2impl/pfb_interpolator.py
@@ -0,0 +1,70 @@
+#!/usr/bin/env python
+#
+# 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.
+#
+
+from gnuradio import gr, optfir
+
+class pfb_interpolator_ccf(gr.hier_block2):
+ '''
+ Make a Polyphase Filter interpolator (complex in, complex out, floating-point taps)
+
+ The block takes a single complex stream in and outputs a single complex
+ stream out. As such, it requires no extra glue to handle the input/output
+ streams. This block is provided to be consistent with the interface to the
+ other PFB block.
+ '''
+ def __init__(self, interp, taps=None, atten=100):
+ gr.hier_block2.__init__(self, "pfb_interpolator_ccf",
+ gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature
+ gr.io_signature(1, 1, gr.sizeof_gr_complex)) # Output signature
+
+ self._interp = interp
+ self._taps = taps
+
+ if taps is not None:
+ self._taps = taps
+ else:
+ # Create a filter that covers the full bandwidth of the input signal
+ bw = 0.4
+ tb = 0.2
+ ripple = 0.99
+ made = False
+ while not made:
+ try:
+ self._taps = optfir.low_pass(self._interp, self._interp, bw, bw+tb, ripple, atten)
+ made = True
+ except RuntimeError:
+ ripple += 0.01
+ made = False
+ print("Warning: set ripple to %.4f dB. If this is a problem, adjust the attenuation or create your own filter taps." % (ripple))
+
+ # Build in an exit strategy; if we've come this far, it ain't working.
+ if(ripple >= 1.0):
+ raise RuntimeError("optfir could not generate an appropriate filter.")
+
+ self.pfb = gr.pfb_interpolator_ccf(self._interp, self._taps)
+
+ self.connect(self, self.pfb)
+ self.connect(self.pfb, self)
+
+
+
+
diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/rational_resampler.py b/gnuradio-core/src/python/gnuradio/blks2impl/rational_resampler.py
new file mode 100644
index 000000000..eea12af95
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/blks2impl/rational_resampler.py
@@ -0,0 +1,131 @@
+#
+# Copyright 2005,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.
+#
+
+from gnuradio import gr, gru
+
+_plot = None
+
+def design_filter(interpolation, decimation, fractional_bw):
+ """
+ Given the interpolation rate, decimation rate and a fractional bandwidth,
+ design a set of taps.
+
+ @param interpolation: interpolation factor
+ @type interpolation: integer > 0
+ @param decimation: decimation factor
+ @type decimation: integer > 0
+ @param fractional_bw: fractional bandwidth in (0, 0.5) 0.4 works well.
+ @type fractional_bw: float
+ @returns: sequence of numbers
+ """
+
+ if fractional_bw >= 0.5 or fractional_bw <= 0:
+ raise ValueError, "Invalid fractional_bandwidth, must be in (0, 0.5)"
+
+ beta = 5.0
+ trans_width = 0.5 - fractional_bw
+ mid_transition_band = 0.5 - trans_width/2
+
+ taps = gr.firdes.low_pass(interpolation, # gain
+ 1, # Fs
+ mid_transition_band/interpolation, # trans mid point
+ trans_width/interpolation, # transition width
+ gr.firdes.WIN_KAISER,
+ beta # beta
+ )
+
+ return taps
+
+
+
+class _rational_resampler_base(gr.hier_block2):
+ """
+ base class for all rational resampler variants.
+ """
+ def __init__(self, resampler_base,
+ interpolation, decimation, taps=None, fractional_bw=None):
+ """
+ Rational resampling polyphase FIR filter.
+
+ Either taps or fractional_bw may be specified, but not both.
+ If neither is specified, a reasonable default, 0.4, is used as
+ the fractional_bw.
+
+ @param interpolation: interpolation factor
+ @type interpolation: integer > 0
+ @param decimation: decimation factor
+ @type decimation: integer > 0
+ @param taps: optional filter coefficients
+ @type taps: sequence
+ @param fractional_bw: fractional bandwidth in (0, 0.5), measured at final freq (use 0.4)
+ @type fractional_bw: float
+ """
+
+ if not isinstance(interpolation, int) or interpolation < 1:
+ raise ValueError, "interpolation must be an integer >= 1"
+
+ if not isinstance(decimation, int) or decimation < 1:
+ raise ValueError, "decimation must be an integer >= 1"
+
+ if taps is None and fractional_bw is None:
+ fractional_bw = 0.4
+
+ d = gru.gcd(interpolation, decimation)
+ interpolation = interpolation // d
+ decimation = decimation // d
+
+ if taps is None:
+ taps = design_filter(interpolation, decimation, fractional_bw)
+
+ resampler = resampler_base(interpolation, decimation, taps)
+ gr.hier_block2.__init__(self, "rational_resampler",
+ gr.io_signature(1, 1, resampler.input_signature().sizeof_stream_item(0)),
+ gr.io_signature(1, 1, resampler.output_signature().sizeof_stream_item(0)))
+
+ self.connect(self, resampler, self)
+
+
+class rational_resampler_fff(_rational_resampler_base):
+ def __init__(self, interpolation, decimation, taps=None, fractional_bw=None):
+ """
+ Rational resampling polyphase FIR filter with
+ float input, float output and float taps.
+ """
+ _rational_resampler_base.__init__(self, gr.rational_resampler_base_fff,
+ interpolation, decimation, taps, fractional_bw)
+
+class rational_resampler_ccf(_rational_resampler_base):
+ def __init__(self, interpolation, decimation, taps=None, fractional_bw=None):
+ """
+ Rational resampling polyphase FIR filter with
+ complex input, complex output and float taps.
+ """
+ _rational_resampler_base.__init__(self, gr.rational_resampler_base_ccf,
+ interpolation, decimation, taps, fractional_bw)
+
+class rational_resampler_ccc(_rational_resampler_base):
+ def __init__(self, interpolation, decimation, taps=None, fractional_bw=None):
+ """
+ Rational resampling polyphase FIR filter with
+ complex input, complex output and complex taps.
+ """
+ _rational_resampler_base.__init__(self, gr.rational_resampler_base_ccc,
+ interpolation, decimation, taps, fractional_bw)
diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/standard_squelch.py b/gnuradio-core/src/python/gnuradio/blks2impl/standard_squelch.py
new file mode 100644
index 000000000..bd7fb535a
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/blks2impl/standard_squelch.py
@@ -0,0 +1,76 @@
+#
+# Copyright 2005,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.
+#
+
+import math
+from gnuradio import gr, optfir
+
+class standard_squelch(gr.hier_block2):
+ def __init__(self, audio_rate):
+ gr.hier_block2.__init__(self, "standard_squelch",
+ gr.io_signature(1, 1, gr.sizeof_float), # Input signature
+ gr.io_signature(1, 1, gr.sizeof_float)) # Output signature
+
+ self.input_node = gr.add_const_ff(0) # FIXME kludge
+
+ self.low_iir = gr.iir_filter_ffd((0.0193,0,-0.0193),(1,1.9524,-0.9615))
+ self.low_square = gr.multiply_ff()
+ self.low_smooth = gr.single_pole_iir_filter_ff(1/(0.01*audio_rate)) # 100ms time constant
+
+ self.hi_iir = gr.iir_filter_ffd((0.0193,0,-0.0193),(1,1.3597,-0.9615))
+ self.hi_square = gr.multiply_ff()
+ self.hi_smooth = gr.single_pole_iir_filter_ff(1/(0.01*audio_rate))
+
+ self.sub = gr.sub_ff();
+ self.add = gr.add_ff();
+ self.gate = gr.threshold_ff(0.3,0.43,0)
+ self.squelch_lpf = gr.single_pole_iir_filter_ff(1/(0.01*audio_rate))
+
+ self.div = gr.divide_ff()
+ self.squelch_mult = gr.multiply_ff()
+
+ self.connect (self, self.input_node)
+ self.connect (self.input_node, (self.squelch_mult, 0))
+
+ self.connect (self.input_node,self.low_iir)
+ self.connect (self.low_iir,(self.low_square,0))
+ self.connect (self.low_iir,(self.low_square,1))
+ self.connect (self.low_square,self.low_smooth,(self.sub,0))
+ self.connect (self.low_smooth, (self.add,0))
+
+ self.connect (self.input_node,self.hi_iir)
+ self.connect (self.hi_iir,(self.hi_square,0))
+ self.connect (self.hi_iir,(self.hi_square,1))
+ self.connect (self.hi_square,self.hi_smooth,(self.sub,1))
+ self.connect (self.hi_smooth, (self.add,1))
+
+ self.connect (self.sub, (self.div, 0))
+ self.connect (self.add, (self.div, 1))
+ self.connect (self.div, self.gate, self.squelch_lpf, (self.squelch_mult,1))
+ self.connect (self.squelch_mult, self)
+
+ def set_threshold(self, threshold):
+ self.gate.set_hi(threshold)
+
+ def threshold(self):
+ return self.gate.hi()
+
+ def squelch_range(self):
+ return (0.0, 1.0, 1.0/100)
diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/stream_to_vector_decimator.py b/gnuradio-core/src/python/gnuradio/blks2impl/stream_to_vector_decimator.py
new file mode 100644
index 000000000..8f75729c9
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/blks2impl/stream_to_vector_decimator.py
@@ -0,0 +1,93 @@
+#
+# 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.
+#
+
+from gnuradio import gr
+
+class stream_to_vector_decimator(gr.hier_block2):
+ """
+ Convert the stream to a vector, decimate the vector stream to achieve the vector rate.
+ """
+
+ def __init__(self, item_size, sample_rate, vec_rate, vec_len):
+ """
+ Create the block chain.
+ @param item_size the number of bytes per sample
+ @param sample_rate the rate of incoming samples
+ @param vec_rate the rate of outgoing vectors (same units as sample_rate)
+ @param vec_len the length of the outgoing vectors in items
+ """
+ self._vec_rate = vec_rate
+ self._vec_len = vec_len
+ self._sample_rate = sample_rate
+
+ gr.hier_block2.__init__(self, "stream_to_vector_decimator",
+ gr.io_signature(1, 1, item_size), # Input signature
+ gr.io_signature(1, 1, item_size*vec_len)) # Output signature
+
+ s2v = gr.stream_to_vector(item_size, vec_len)
+ self.one_in_n = gr.keep_one_in_n(item_size*vec_len, 1)
+ self._update_decimator()
+ self.connect(self, s2v, self.one_in_n, self)
+
+ def set_sample_rate(self, sample_rate):
+ """
+ Set the new sampling rate and update the decimator.
+ @param sample_rate the new rate
+ """
+ self._sample_rate = sample_rate
+ self._update_decimator()
+
+ def set_vec_rate(self, vec_rate):
+ """
+ Set the new vector rate and update the decimator.
+ @param vec_rate the new rate
+ """
+ self._vec_rate = vec_rate
+ self._update_decimator()
+
+ def set_decimation(self, decim):
+ """
+ Set the decimation parameter directly.
+ @param decim the new decimation
+ """
+ self._decim = max(1, int(round(decim)))
+ self.one_in_n.set_n(self._decim)
+
+ def _update_decimator(self):
+ self.set_decimation(self._sample_rate/self._vec_len/self._vec_rate)
+
+ def decimation(self):
+ """
+ Returns the actual decimation.
+ """
+ return self._decim
+
+ def sample_rate(self):
+ """
+ Returns configured sample rate.
+ """
+ return self._sample_rate
+
+ def frame_rate(self):
+ """
+ Returns actual frame rate
+ """
+ return self._sample_rate/self._vec_len/self._decim
diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/wfm_rcv.py b/gnuradio-core/src/python/gnuradio/blks2impl/wfm_rcv.py
new file mode 100644
index 000000000..d1cbcf912
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/blks2impl/wfm_rcv.py
@@ -0,0 +1,69 @@
+#
+# Copyright 2005,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.
+#
+
+from gnuradio import gr
+from gnuradio.blks2impl.fm_emph import fm_deemph
+import math
+
+class wfm_rcv(gr.hier_block2):
+ def __init__ (self, quad_rate, audio_decimation):
+ """
+ Hierarchical block for demodulating a broadcast FM signal.
+
+ The input is the downconverted complex baseband signal (gr_complex).
+ The output is the demodulated audio (float).
+
+ @param quad_rate: input sample rate of complex baseband input.
+ @type quad_rate: float
+ @param audio_decimation: how much to decimate quad_rate to get to audio.
+ @type audio_decimation: integer
+ """
+ gr.hier_block2.__init__(self, "wfm_rcv",
+ gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature
+ gr.io_signature(1, 1, gr.sizeof_float)) # Output signature
+
+ volume = 20.
+
+ max_dev = 75e3
+ fm_demod_gain = quad_rate/(2*math.pi*max_dev)
+ audio_rate = quad_rate / audio_decimation
+
+
+ # We assign to self so that outsiders can grab the demodulator
+ # if they need to. E.g., to plot its output.
+ #
+ # input: complex; output: float
+ self.fm_demod = gr.quadrature_demod_cf (fm_demod_gain)
+
+ # input: float; output: float
+ self.deemph = fm_deemph (audio_rate)
+
+ # compute FIR filter taps for audio filter
+ width_of_transition_band = audio_rate / 32
+ audio_coeffs = gr.firdes.low_pass (1.0, # gain
+ quad_rate, # sampling rate
+ audio_rate/2 - width_of_transition_band,
+ width_of_transition_band,
+ gr.firdes.WIN_HAMMING)
+ # input: float; output: float
+ self.audio_filter = gr.fir_filter_fff (audio_decimation, audio_coeffs)
+
+ self.connect (self, self.fm_demod, self.audio_filter, self.deemph, self)
diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/wfm_rcv_fmdet.py b/gnuradio-core/src/python/gnuradio/blks2impl/wfm_rcv_fmdet.py
new file mode 100755
index 000000000..e229bcc2e
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/blks2impl/wfm_rcv_fmdet.py
@@ -0,0 +1,216 @@
+#
+# Copyright 2005,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.
+#
+
+from gnuradio import gr
+from gnuradio.blks2impl.fm_emph import fm_deemph
+import math
+
+class wfm_rcv_fmdet(gr.hier_block2):
+ def __init__ (self, demod_rate, audio_decimation):
+ """
+ Hierarchical block for demodulating a broadcast FM signal.
+
+ The input is the downconverted complex baseband signal
+ (gr_complex). The output is two streams of the demodulated
+ audio (float) 0=Left, 1=Right.
+
+ @param demod_rate: input sample rate of complex baseband input.
+ @type demod_rate: float
+ @param audio_decimation: how much to decimate demod_rate to get to audio.
+ @type audio_decimation: integer
+ """
+ gr.hier_block2.__init__(self, "wfm_rcv_fmdet",
+ gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature
+ gr.io_signature(2, 2, gr.sizeof_float)) # Output signature
+ lowfreq = -125e3/demod_rate
+ highfreq = 125e3/demod_rate
+ audio_rate = demod_rate / audio_decimation
+
+ # We assign to self so that outsiders can grab the demodulator
+ # if they need to. E.g., to plot its output.
+ #
+ # input: complex; output: float
+
+ self.fm_demod = gr.fmdet_cf (demod_rate, lowfreq, highfreq, 0.05)
+
+ # input: float; output: float
+ self.deemph_Left = fm_deemph (audio_rate)
+ self.deemph_Right = fm_deemph (audio_rate)
+
+ # compute FIR filter taps for audio filter
+ width_of_transition_band = audio_rate / 32
+ audio_coeffs = gr.firdes.low_pass (1.0 , # gain
+ demod_rate, # sampling rate
+ 15000 ,
+ width_of_transition_band,
+ gr.firdes.WIN_HAMMING)
+
+ # input: float; output: float
+ self.audio_filter = gr.fir_filter_fff (audio_decimation, audio_coeffs)
+ if 1:
+ # Pick off the stereo carrier/2 with this filter. It
+ # attenuated 10 dB so apply 10 dB gain We pick off the
+ # negative frequency half because we want to base band by
+ # it!
+ ## NOTE THIS WAS HACKED TO OFFSET INSERTION LOSS DUE TO
+ ## DEEMPHASIS
+
+ stereo_carrier_filter_coeffs = gr.firdes.complex_band_pass(10.0,
+ demod_rate,
+ -19020,
+ -18980,
+ width_of_transition_band,
+ gr.firdes.WIN_HAMMING)
+
+ #print "len stereo carrier filter = ",len(stereo_carrier_filter_coeffs)
+ #print "stereo carrier filter ", stereo_carrier_filter_coeffs
+ #print "width of transition band = ",width_of_transition_band, " audio rate = ", audio_rate
+
+ # Pick off the double side band suppressed carrier
+ # Left-Right audio. It is attenuated 10 dB so apply 10 dB
+ # gain
+
+ stereo_dsbsc_filter_coeffs = gr.firdes.complex_band_pass(20.0,
+ demod_rate,
+ 38000-15000/2,
+ 38000+15000/2,
+ width_of_transition_band,
+ gr.firdes.WIN_HAMMING)
+ #print "len stereo dsbsc filter = ",len(stereo_dsbsc_filter_coeffs)
+ #print "stereo dsbsc filter ", stereo_dsbsc_filter_coeffs
+
+ # construct overlap add filter system from coefficients
+ # for stereo carrier
+ self.stereo_carrier_filter = gr.fir_filter_fcc(audio_decimation,
+ stereo_carrier_filter_coeffs)
+
+ # carrier is twice the picked off carrier so arrange to do
+ # a commplex multiply
+ self.stereo_carrier_generator = gr.multiply_cc();
+
+ # Pick off the rds signal
+ stereo_rds_filter_coeffs = gr.firdes.complex_band_pass(30.0,
+ demod_rate,
+ 57000 - 1500,
+ 57000 + 1500,
+ width_of_transition_band,
+ gr.firdes.WIN_HAMMING)
+ #print "len stereo dsbsc filter = ",len(stereo_dsbsc_filter_coeffs)
+ #print "stereo dsbsc filter ", stereo_dsbsc_filter_coeffs
+ # construct overlap add filter system from coefficients for stereo carrier
+
+ self.rds_signal_filter = gr.fir_filter_fcc(audio_decimation,
+ stereo_rds_filter_coeffs)
+ self.rds_carrier_generator = gr.multiply_cc();
+ self.rds_signal_generator = gr.multiply_cc();
+ self_rds_signal_processor = gr.null_sink(gr.sizeof_gr_complex);
+
+ loop_bw = 2*math.pi/100.0
+ max_freq = -2.0*math.pi*18990/audio_rate;
+ min_freq = -2.0*math.pi*19010/audio_rate;
+ self.stereo_carrier_pll_recovery = gr.pll_refout_cc(loop_bw,
+ max_freq,
+ min_freq);
+
+ #self.stereo_carrier_pll_recovery.squelch_enable(False)
+ ##pll_refout does not have squelch yet, so disabled for
+ #now
+
+ # set up mixer (multiplier) to get the L-R signal at
+ # baseband
+
+ self.stereo_basebander = gr.multiply_cc();
+
+ # pick off the real component of the basebanded L-R
+ # signal. The imaginary SHOULD be zero
+
+ self.LmR_real = gr.complex_to_real();
+ self.Make_Left = gr.add_ff();
+ self.Make_Right = gr.sub_ff();
+
+ self.stereo_dsbsc_filter = gr.fir_filter_fcc(audio_decimation,
+ stereo_dsbsc_filter_coeffs)
+
+
+ if 1:
+
+ # send the real signal to complex filter to pick off the
+ # carrier and then to one side of a multiplier
+ self.connect (self, self.fm_demod, self.stereo_carrier_filter,
+ self.stereo_carrier_pll_recovery,
+ (self.stereo_carrier_generator,0))
+
+ # send the already filtered carrier to the otherside of the carrier
+ # the resulting signal from this multiplier is the carrier
+ # with correct phase but at -38000 Hz.
+ self.connect (self.stereo_carrier_pll_recovery, (self.stereo_carrier_generator,1))
+
+ # send the new carrier to one side of the mixer (multiplier)
+ self.connect (self.stereo_carrier_generator, (self.stereo_basebander,0))
+
+ # send the demphasized audio to the DSBSC pick off filter, the complex
+ # DSBSC signal at +38000 Hz is sent to the other side of the mixer/multiplier
+ # the result is BASEBANDED DSBSC with phase zero!
+ self.connect (self.fm_demod,self.stereo_dsbsc_filter, (self.stereo_basebander,1))
+
+ # Pick off the real part since the imaginary is
+ # theoretically zero and then to one side of a summer
+ self.connect (self.stereo_basebander, self.LmR_real, (self.Make_Left,0))
+
+ #take the same real part of the DSBSC baseband signal and
+ #send it to negative side of a subtracter
+ self.connect (self.LmR_real,(self.Make_Right,1))
+
+ # Make rds carrier by taking the squared pilot tone and
+ # multiplying by pilot tone
+ self.connect (self.stereo_basebander,(self.rds_carrier_generator,0))
+ self.connect (self.stereo_carrier_pll_recovery,(self.rds_carrier_generator,1))
+
+ # take signal, filter off rds, send into mixer 0 channel
+ self.connect (self.fm_demod,self.rds_signal_filter,(self.rds_signal_generator,0))
+
+ # take rds_carrier_generator output and send into mixer 1
+ # channel
+ self.connect (self.rds_carrier_generator,(self.rds_signal_generator,1))
+
+ # send basebanded rds signal and send into "processor"
+ # which for now is a null sink
+ self.connect (self.rds_signal_generator,self_rds_signal_processor)
+
+
+ if 1:
+ # pick off the audio, L+R that is what we used to have and
+ # send it to the summer
+ self.connect(self.fm_demod, self.audio_filter, (self.Make_Left, 1))
+
+ # take the picked off L+R audio and send it to the PLUS
+ # side of the subtractor
+ self.connect(self.audio_filter,(self.Make_Right, 0))
+
+ # The result of Make_Left gets (L+R) + (L-R) and results in 2*L
+ # The result of Make_Right gets (L+R) - (L-R) and results in 2*R
+ self.connect(self.Make_Left , self.deemph_Left, (self, 0))
+ self.connect(self.Make_Right, self.deemph_Right, (self, 1))
+
+ # NOTE: mono support will require variable number of outputs in hier_block2s
+ # See ticket:174 in Trac database
+ #else:
+ # self.connect (self.fm_demod, self.audio_filter, self)
diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/wfm_rcv_pll.py b/gnuradio-core/src/python/gnuradio/blks2impl/wfm_rcv_pll.py
new file mode 100644
index 000000000..d4ce6d223
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/blks2impl/wfm_rcv_pll.py
@@ -0,0 +1,190 @@
+#
+# Copyright 2005,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.
+#
+
+from gnuradio import gr
+from gnuradio.blks2impl.fm_emph import fm_deemph
+import math
+
+class wfm_rcv_pll(gr.hier_block2):
+ def __init__ (self, demod_rate, audio_decimation):
+ """
+ Hierarchical block for demodulating a broadcast FM signal.
+
+ The input is the downconverted complex baseband signal (gr_complex).
+ The output is two streams of the demodulated audio (float) 0=Left, 1=Right.
+
+ @param demod_rate: input sample rate of complex baseband input.
+ @type demod_rate: float
+ @param audio_decimation: how much to decimate demod_rate to get to audio.
+ @type audio_decimation: integer
+ """
+ gr.hier_block2.__init__(self, "wfm_rcv_pll",
+ gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature
+ gr.io_signature(2, 2, gr.sizeof_float)) # Output signature
+ bandwidth = 250e3
+ audio_rate = demod_rate / audio_decimation
+
+
+ # We assign to self so that outsiders can grab the demodulator
+ # if they need to. E.g., to plot its output.
+ #
+ # input: complex; output: float
+ loop_bw = 2*math.pi/100.0
+ max_freq = 2.0*math.pi*90e3/demod_rate
+ self.fm_demod = gr.pll_freqdet_cf (loop_bw, max_freq,-max_freq)
+
+ # input: float; output: float
+ self.deemph_Left = fm_deemph (audio_rate)
+ self.deemph_Right = fm_deemph (audio_rate)
+
+ # compute FIR filter taps for audio filter
+ width_of_transition_band = audio_rate / 32
+ audio_coeffs = gr.firdes.low_pass (1.0 , # gain
+ demod_rate, # sampling rate
+ 15000 ,
+ width_of_transition_band,
+ gr.firdes.WIN_HAMMING)
+ # input: float; output: float
+ self.audio_filter = gr.fir_filter_fff (audio_decimation, audio_coeffs)
+ if 1:
+ # Pick off the stereo carrier/2 with this filter. It attenuated 10 dB so apply 10 dB gain
+ # We pick off the negative frequency half because we want to base band by it!
+ ## NOTE THIS WAS HACKED TO OFFSET INSERTION LOSS DUE TO DEEMPHASIS
+
+ stereo_carrier_filter_coeffs = gr.firdes.complex_band_pass(10.0,
+ demod_rate,
+ -19020,
+ -18980,
+ width_of_transition_band,
+ gr.firdes.WIN_HAMMING)
+
+ #print "len stereo carrier filter = ",len(stereo_carrier_filter_coeffs)
+ #print "stereo carrier filter ", stereo_carrier_filter_coeffs
+ #print "width of transition band = ",width_of_transition_band, " audio rate = ", audio_rate
+
+ # Pick off the double side band suppressed carrier Left-Right audio. It is attenuated 10 dB so apply 10 dB gain
+
+ stereo_dsbsc_filter_coeffs = gr.firdes.complex_band_pass(20.0,
+ demod_rate,
+ 38000-15000/2,
+ 38000+15000/2,
+ width_of_transition_band,
+ gr.firdes.WIN_HAMMING)
+ #print "len stereo dsbsc filter = ",len(stereo_dsbsc_filter_coeffs)
+ #print "stereo dsbsc filter ", stereo_dsbsc_filter_coeffs
+ # construct overlap add filter system from coefficients for stereo carrier
+
+ self.stereo_carrier_filter = gr.fir_filter_fcc(audio_decimation, stereo_carrier_filter_coeffs)
+
+ # carrier is twice the picked off carrier so arrange to do a commplex multiply
+
+ self.stereo_carrier_generator = gr.multiply_cc();
+
+ # Pick off the rds signal
+
+ stereo_rds_filter_coeffs = gr.firdes.complex_band_pass(30.0,
+ demod_rate,
+ 57000 - 1500,
+ 57000 + 1500,
+ width_of_transition_band,
+ gr.firdes.WIN_HAMMING)
+ #print "len stereo dsbsc filter = ",len(stereo_dsbsc_filter_coeffs)
+ #print "stereo dsbsc filter ", stereo_dsbsc_filter_coeffs
+ # construct overlap add filter system from coefficients for stereo carrier
+
+ self.rds_signal_filter = gr.fir_filter_fcc(audio_decimation, stereo_rds_filter_coeffs)
+
+
+
+
+
+
+ self.rds_carrier_generator = gr.multiply_cc();
+ self.rds_signal_generator = gr.multiply_cc();
+ self_rds_signal_processor = gr.null_sink(gr.sizeof_gr_complex);
+
+
+
+ loop_bw = 2*math.pi/100.0
+ max_freq = -2.0*math.pi*18990/audio_rate;
+ min_freq = -2.0*math.pi*19010/audio_rate;
+
+ self.stereo_carrier_pll_recovery = gr.pll_refout_cc(loop_bw, max_freq, min_freq);
+ #self.stereo_carrier_pll_recovery.squelch_enable(False) #pll_refout does not have squelch yet, so disabled for now
+
+
+ # set up mixer (multiplier) to get the L-R signal at baseband
+
+ self.stereo_basebander = gr.multiply_cc();
+
+ # pick off the real component of the basebanded L-R signal. The imaginary SHOULD be zero
+
+ self.LmR_real = gr.complex_to_real();
+ self.Make_Left = gr.add_ff();
+ self.Make_Right = gr.sub_ff();
+
+ self.stereo_dsbsc_filter = gr.fir_filter_fcc(audio_decimation, stereo_dsbsc_filter_coeffs)
+
+
+ if 1:
+
+ # send the real signal to complex filter to pick off the carrier and then to one side of a multiplier
+ self.connect (self, self.fm_demod,self.stereo_carrier_filter,self.stereo_carrier_pll_recovery, (self.stereo_carrier_generator,0))
+ # send the already filtered carrier to the otherside of the carrier
+ self.connect (self.stereo_carrier_pll_recovery, (self.stereo_carrier_generator,1))
+ # the resulting signal from this multiplier is the carrier with correct phase but at -38000 Hz.
+
+ # send the new carrier to one side of the mixer (multiplier)
+ self.connect (self.stereo_carrier_generator, (self.stereo_basebander,0))
+ # send the demphasized audio to the DSBSC pick off filter, the complex
+ # DSBSC signal at +38000 Hz is sent to the other side of the mixer/multiplier
+ self.connect (self.fm_demod,self.stereo_dsbsc_filter, (self.stereo_basebander,1))
+ # the result is BASEBANDED DSBSC with phase zero!
+
+ # Pick off the real part since the imaginary is theoretically zero and then to one side of a summer
+ self.connect (self.stereo_basebander, self.LmR_real, (self.Make_Left,0))
+ #take the same real part of the DSBSC baseband signal and send it to negative side of a subtracter
+ self.connect (self.LmR_real,(self.Make_Right,1))
+
+ # Make rds carrier by taking the squared pilot tone and multiplying by pilot tone
+ self.connect (self.stereo_basebander,(self.rds_carrier_generator,0))
+ self.connect (self.stereo_carrier_pll_recovery,(self.rds_carrier_generator,1))
+ # take signal, filter off rds, send into mixer 0 channel
+ self.connect (self.fm_demod,self.rds_signal_filter,(self.rds_signal_generator,0))
+ # take rds_carrier_generator output and send into mixer 1 channel
+ self.connect (self.rds_carrier_generator,(self.rds_signal_generator,1))
+ # send basebanded rds signal and send into "processor" which for now is a null sink
+ self.connect (self.rds_signal_generator,self_rds_signal_processor)
+
+
+ if 1:
+ # pick off the audio, L+R that is what we used to have and send it to the summer
+ self.connect(self.fm_demod, self.audio_filter, (self.Make_Left, 1))
+ # take the picked off L+R audio and send it to the PLUS side of the subtractor
+ self.connect(self.audio_filter,(self.Make_Right, 0))
+ # The result of Make_Left gets (L+R) + (L-R) and results in 2*L
+ # The result of Make_Right gets (L+R) - (L-R) and results in 2*R
+ self.connect(self.Make_Left , self.deemph_Left, (self, 0))
+ self.connect(self.Make_Right, self.deemph_Right, (self, 1))
+ # NOTE: mono support will require variable number of outputs in hier_block2s
+ # See ticket:174 in Trac database
+ #else:
+ # self.connect (self.fm_demod, self.audio_filter, self)
diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/wfm_tx.py b/gnuradio-core/src/python/gnuradio/blks2impl/wfm_tx.py
new file mode 100644
index 000000000..3fcf98f89
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/blks2impl/wfm_tx.py
@@ -0,0 +1,79 @@
+#
+# Copyright 2005,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.
+#
+
+import math
+from gnuradio import gr, optfir
+from gnuradio.blks2impl.fm_emph import fm_preemph
+
+class wfm_tx(gr.hier_block2):
+ def __init__(self, audio_rate, quad_rate, tau=75e-6, max_dev=75e3):
+ """
+ Wide Band FM Transmitter.
+
+ Takes a single float input stream of audio samples in the range [-1,+1]
+ and produces a single FM modulated complex baseband output.
+
+ @param audio_rate: sample rate of audio stream, >= 16k
+ @type audio_rate: integer
+ @param quad_rate: sample rate of output stream
+ @type quad_rate: integer
+ @param tau: preemphasis time constant (default 75e-6)
+ @type tau: float
+ @param max_dev: maximum deviation in Hz (default 75e3)
+ @type max_dev: float
+
+ quad_rate must be an integer multiple of audio_rate.
+ """
+ gr.hier_block2.__init__(self, "wfm_tx",
+ gr.io_signature(1, 1, gr.sizeof_float), # Input signature
+ gr.io_signature(1, 1, gr.sizeof_gr_complex)) # Output signature
+
+ # FIXME audio_rate and quad_rate ought to be exact rationals
+ audio_rate = int(audio_rate)
+ quad_rate = int(quad_rate)
+
+ if quad_rate % audio_rate != 0:
+ raise ValueError, "quad_rate is not an integer multiple of audio_rate"
+
+
+ do_interp = audio_rate != quad_rate
+
+ if do_interp:
+ interp_factor = quad_rate / audio_rate
+ interp_taps = optfir.low_pass (interp_factor, # gain
+ quad_rate, # Fs
+ 16000, # passband cutoff
+ 18000, # stopband cutoff
+ 0.1, # passband ripple dB
+ 40) # stopband atten dB
+
+ print "len(interp_taps) =", len(interp_taps)
+ self.interpolator = gr.interp_fir_filter_fff (interp_factor, interp_taps)
+
+ self.preemph = fm_preemph (quad_rate, tau=tau)
+
+ k = 2 * math.pi * max_dev / quad_rate
+ self.modulator = gr.frequency_modulator_fc (k)
+
+ if do_interp:
+ self.connect (self, self.interpolator, self.preemph, self.modulator, self)
+ else:
+ self.connect(self, self.preemph, self.modulator, self)
diff --git a/gnuradio-core/src/python/gnuradio/eng_notation.py b/gnuradio-core/src/python/gnuradio/eng_notation.py
new file mode 100644
index 000000000..c552a45f5
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/eng_notation.py
@@ -0,0 +1,71 @@
+#
+# Copyright 2003 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.
+#
+
+scale_factor = {}
+scale_factor['E'] = 1e18
+scale_factor['P'] = 1e15
+scale_factor['T'] = 1e12
+scale_factor['G'] = 1e9
+scale_factor['M'] = 1e6
+scale_factor['k'] = 1e3
+scale_factor['m'] = 1e-3
+scale_factor['u'] = 1e-6
+scale_factor['n'] = 1e-9
+scale_factor['p'] = 1e-12
+scale_factor['f'] = 1e-15
+scale_factor['a'] = 1e-18
+
+def num_to_str (n):
+ '''Convert a number to a string in engineering notation. E.g., 5e-9 -> 5n'''
+ m = abs(n)
+ if m >= 1e9:
+ return "%gG" % (n * 1e-9)
+ elif m >= 1e6:
+ return "%gM" % (n * 1e-6)
+ elif m >= 1e3:
+ return "%gk" % (n * 1e-3)
+ elif m >= 1:
+ return "%g" % (n)
+ elif m >= 1e-3:
+ return "%gm" % (n * 1e3)
+ elif m >= 1e-6:
+ return "%gu" % (n * 1e6) # where's that mu when you need it (unicode?)
+ elif m >= 1e-9:
+ return "%gn" % (n * 1e9)
+ elif m >= 1e-12:
+ return "%gp" % (n * 1e12)
+ elif m >= 1e-15:
+ return "%gf" % (n * 1e15)
+ else:
+ return "%g" % (n)
+
+
+def str_to_num (value):
+ '''Convert a string in engineering notation to a number. E.g., '15m' -> 15e-3'''
+ try:
+ scale = 1.0
+ suffix = value[-1]
+ if scale_factor.has_key (suffix):
+ return float (value[0:-1]) * scale_factor[suffix]
+ return float (value)
+ except:
+ raise RuntimeError (
+ "Invalid engineering notation value: %r" % (value,))
diff --git a/gnuradio-core/src/python/gnuradio/eng_option.py b/gnuradio-core/src/python/gnuradio/eng_option.py
new file mode 100644
index 000000000..02e9b0b6d
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/eng_option.py
@@ -0,0 +1,62 @@
+#
+# 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.
+#
+
+'''Add support for engineering notation to optparse.OptionParser'''
+
+from copy import copy
+from optparse import Option, OptionValueError
+import eng_notation
+
+def check_eng_float (option, opt, value):
+ try:
+ return eng_notation.str_to_num(value)
+ except:
+ raise OptionValueError (
+ "option %s: invalid engineering notation value: %r" % (opt, value))
+
+def check_intx (option, opt, value):
+ try:
+ return int (value, 0)
+ except:
+ raise OptionValueError (
+ "option %s: invalid integer value: %r" % (opt, value))
+
+def check_subdev (option, opt, value):
+ """
+ Value has the form: (A|B)(:0|1)?
+
+ @returns a 2-tuple (0|1, 0|1)
+ """
+ d = { 'A' : (0, 0), 'A:0' : (0, 0), 'A:1' : (0, 1), 'A:2' : (0, 2),
+ 'B' : (1, 0), 'B:0' : (1, 0), 'B:1' : (1, 1), 'B:2' : (1, 2) }
+ try:
+ return d[value.upper()]
+ except:
+ raise OptionValueError(
+ "option %s: invalid subdev: '%r', must be one of %s" % (opt, value, ', '.join(sorted(d.keys()))))
+
+class eng_option (Option):
+ TYPES = Option.TYPES + ("eng_float", "intx", "subdev")
+ TYPE_CHECKER = copy (Option.TYPE_CHECKER)
+ TYPE_CHECKER["eng_float"] = check_eng_float
+ TYPE_CHECKER["intx"] = check_intx
+ TYPE_CHECKER["subdev"] = check_subdev
+
diff --git a/gnuradio-core/src/python/gnuradio/gr/CMakeLists.txt b/gnuradio-core/src/python/gnuradio/gr/CMakeLists.txt
new file mode 100644
index 000000000..da22a5f98
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/CMakeLists.txt
@@ -0,0 +1,49 @@
+# Copyright 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.
+
+########################################################################
+include(GrPython)
+
+GR_PYTHON_INSTALL(FILES
+ __init__.py
+ exceptions.py
+ gateway.py
+ gr_threading.py
+ gr_threading_23.py
+ gr_threading_24.py
+ hier_block2.py
+ prefs.py
+ tag_utils.py
+ top_block.py
+ pubsub.py
+ DESTINATION ${GR_PYTHON_DIR}/gnuradio/gr
+ COMPONENT "core_python"
+)
+
+########################################################################
+# Handle the unit tests
+########################################################################
+if(ENABLE_TESTING)
+include(GrTest)
+file(GLOB py_qa_test_files "qa_*.py")
+foreach(py_qa_test_file ${py_qa_test_files})
+ get_filename_component(py_qa_test_name ${py_qa_test_file} NAME_WE)
+ GR_ADD_TEST(${py_qa_test_name} ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} ${py_qa_test_file})
+endforeach(py_qa_test_file)
+endif(ENABLE_TESTING)
diff --git a/gnuradio-core/src/python/gnuradio/gr/__init__.py b/gnuradio-core/src/python/gnuradio/gr/__init__.py
new file mode 100644
index 000000000..768d88595
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/__init__.py
@@ -0,0 +1,116 @@
+#
+# Copyright 2003-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.
+#
+
+# The presence of this file turns this directory into a Python package
+
+# This is the main GNU Radio python module.
+# We pull the swig output and the other modules into the gnuradio.gr namespace
+
+from gnuradio_core import *
+from exceptions import *
+#from hier_block2 import *
+#from top_block import *
+from gateway import basic_block, sync_block, decim_block, interp_block
+from tag_utils import tag_to_python, tag_to_pmt
+
+import gras
+
+RT_OK = 0
+RT_NOT_IMPLEMENTED = 1
+RT_NO_PRIVS = 2
+RT_OTHER_ERROR = 3
+
+
+def enable_realtime_scheduling():
+ """
+ This call is for backward compat purposes.
+ See gras/thread_pool.hpp for greater options.
+ """
+
+ #any prio greater than 0 means realtime scheduling
+ prio_value = 0.5
+
+ #test that prio
+ if not gras.ThreadPool.test_thread_priority(prio_value):
+ return RT_NO_PRIVS
+
+ #create a new thread pool with thread priority set
+ config = gras.ThreadPoolConfig()
+ config.thread_priority = prio_value
+ tp = gras.ThreadPool(config)
+ tp.set_active()
+
+ return RT_OK
+
+class top_block(gras.TopBlock):
+ def __init__(self, name="Top"):
+ gras.TopBlock.__init__(self, name)
+
+ def lock(self):
+ pass
+
+ def unlock(self):
+ self.commit()
+
+ def start(self, *args):
+ if args: self.global_config().maximum_output_items = args[0]
+ gras.TopBlock.start(self)
+
+ def run(self, *args):
+ if args: self.global_config().maximum_output_items = args[0]
+ gras.TopBlock.run(self)
+
+class hier_block2(gras.HierBlock):
+ def __init__(self, name="Hier", in_sig=None, out_sig=None):
+ gras.HierBlock.__init__(self, name)
+
+ self.__in_sig = in_sig
+ self.__out_sig = out_sig
+
+ #backwards compatible silliness
+ import weakref
+ self._hb = weakref.proxy(self)
+
+ def lock(self):
+ pass
+
+ def unlock(self):
+ self.commit()
+
+ def input_signature(self): return self.__in_sig
+ def output_signature(self): return self.__out_sig
+
+# create a couple of aliases
+serial_to_parallel = stream_to_vector
+parallel_to_serial = vector_to_stream
+
+# Force the preference database to be initialized
+prefs = gr_prefs.singleton
+
+#alias old gr_add_vXX and gr_multiply_vXX
+add_vcc = add_cc
+add_vff = add_ff
+add_vii = add_ii
+add_vss = add_ss
+multiply_vcc = multiply_cc
+multiply_vff = multiply_ff
+multiply_vii = multiply_ii
+multiply_vss = multiply_ss
diff --git a/gnuradio-core/src/python/gnuradio/gr/benchmark_filters.py b/gnuradio-core/src/python/gnuradio/gr/benchmark_filters.py
new file mode 100755
index 000000000..4fc10b721
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/benchmark_filters.py
@@ -0,0 +1,75 @@
+#!/usr/bin/env python
+#
+# Copyright 2005,2006,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.
+#
+
+import time
+import random
+from optparse import OptionParser
+from gnuradio import gr
+from gnuradio.eng_option import eng_option
+
+def make_random_complex_tuple(L):
+ result = []
+ for x in range(L):
+ result.append(complex(random.uniform(-1000,1000),
+ random.uniform(-1000,1000)))
+ return tuple(result)
+
+def benchmark(name, creator, dec, ntaps, total_test_size, block_size):
+ block_size = 32768
+
+ tb = gr.top_block()
+ taps = make_random_complex_tuple(ntaps)
+ src = gr.vector_source_c(make_random_complex_tuple(block_size), True)
+ head = gr.head(gr.sizeof_gr_complex, int(total_test_size))
+ op = creator(dec, taps)
+ dst = gr.null_sink(gr.sizeof_gr_complex)
+ tb.connect(src, head, op, dst)
+ start = time.time()
+ tb.run()
+ stop = time.time()
+ delta = stop - start
+ print "%16s: taps: %4d input: %4g, time: %6.3f taps/sec: %10.4g" % (
+ name, ntaps, total_test_size, delta, ntaps*total_test_size/delta)
+
+def main():
+ parser = OptionParser(option_class=eng_option)
+ parser.add_option("-n", "--ntaps", type="int", default=256)
+ parser.add_option("-t", "--total-input-size", type="eng_float", default=40e6)
+ parser.add_option("-b", "--block-size", type="intx", default=50000)
+ parser.add_option("-d", "--decimation", type="int", default=1)
+ (options, args) = parser.parse_args()
+ if len(args) != 0:
+ parser.print_help()
+ sys.exit(1)
+
+ ntaps = options.ntaps
+ total_input_size = options.total_input_size
+ block_size = options.block_size
+ dec = options.decimation
+
+ benchmark("gr.fir_filter_ccc", gr.fir_filter_ccc,
+ dec, ntaps, total_input_size, block_size)
+ benchmark("gr.fft_filter_ccc", gr.fft_filter_ccc,
+ dec, ntaps, total_input_size, block_size)
+
+if __name__ == '__main__':
+ main()
diff --git a/gnuradio-core/src/python/gnuradio/gr/exceptions.py b/gnuradio-core/src/python/gnuradio/gr/exceptions.py
new file mode 100644
index 000000000..dba04750b
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/exceptions.py
@@ -0,0 +1,27 @@
+#
+# 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.
+
+class NotDAG (Exception):
+ """Not a directed acyclic graph"""
+ pass
+
+class CantHappen (Exception):
+ """Can't happen"""
+ pass
diff --git a/gnuradio-core/src/python/gnuradio/gr/gateway.py b/gnuradio-core/src/python/gnuradio/gr/gateway.py
new file mode 100644
index 000000000..53fda17a4
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/gateway.py
@@ -0,0 +1,246 @@
+#
+# Copyright 2011-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.
+#
+
+import gnuradio_core as gr_core
+from gnuradio_core import io_signature, io_signaturev
+from gnuradio_core import gr_block_gw_message_type
+from gnuradio_core import block_gateway
+import numpy
+
+########################################################################
+# Magic to turn pointers into numpy arrays
+# http://docs.scipy.org/doc/numpy/reference/arrays.interface.html
+########################################################################
+def pointer_to_ndarray(addr, dtype, nitems):
+ class array_like:
+ __array_interface__ = {
+ 'data' : (int(addr), False),
+ 'typestr' : dtype.base.str,
+ 'descr' : dtype.base.descr,
+ 'shape' : (nitems,) + dtype.shape,
+ 'strides' : None,
+ 'version' : 3
+ }
+ return numpy.asarray(array_like()).view(dtype.base)
+
+########################################################################
+# Handler that does callbacks from C++
+########################################################################
+class gateway_handler(gr_core.feval_ll):
+
+ #dont put a constructor, it wont work
+
+ def init(self, callback):
+ self._callback = callback
+
+ def eval(self, arg):
+ try: self._callback()
+ except Exception as ex:
+ print("handler caught exception: %s"%ex)
+ import traceback; traceback.print_exc()
+ raise ex
+ return 0
+
+########################################################################
+# Handler that does callbacks from C++
+########################################################################
+class msg_handler(gr_core.feval_p):
+
+ #dont put a constructor, it wont work
+
+ def init(self, callback):
+ self._callback = callback
+
+ def eval(self, arg):
+ try: self._callback(arg)
+ except Exception as ex:
+ print("handler caught exception: %s"%ex)
+ import traceback; traceback.print_exc()
+ raise ex
+ return 0
+
+########################################################################
+# The guts that make this into a gr block
+########################################################################
+class gateway_block(object):
+
+ def __init__(self, name, in_sig, out_sig, work_type, factor):
+
+ #ensure that the sigs are iterable dtypes
+ def sig_to_dtype_sig(sig):
+ if sig is None: sig = ()
+ return map(numpy.dtype, sig)
+ self.__in_sig = sig_to_dtype_sig(in_sig)
+ self.__out_sig = sig_to_dtype_sig(out_sig)
+
+ #cache the ranges to iterate when dispatching work
+ self.__in_indexes = range(len(self.__in_sig))
+ self.__out_indexes = range(len(self.__out_sig))
+
+ #convert the signatures into gr.io_signatures
+ def sig_to_gr_io_sigv(sig):
+ if not len(sig): return io_signature(0, 0, 0)
+ return io_signaturev(len(sig), len(sig), [s.itemsize for s in sig])
+ gr_in_sig = sig_to_gr_io_sigv(self.__in_sig)
+ gr_out_sig = sig_to_gr_io_sigv(self.__out_sig)
+
+ #create internal gateway block
+ self.__handler = gateway_handler()
+ self.__handler.init(self.__gr_block_handle)
+ self.__gateway = block_gateway(
+ self.__handler, name, gr_in_sig, gr_out_sig, work_type, factor)
+ self.__message = self.__gateway.gr_block_message()
+
+ #dict to keep references to all message handlers
+ self.__msg_handlers = {}
+
+ #register gr_block functions
+ prefix = 'gr_block__'
+ for attr in [x for x in dir(self.__gateway) if x.startswith(prefix)]:
+ setattr(self, attr.replace(prefix, ''), getattr(self.__gateway, attr))
+ self.pop_msg_queue = lambda: gr_core.gr_block_gw_pop_msg_queue_safe(self.__gateway)
+
+ #gras version of the to_basic_block()
+ def to_element(self): return self.__gateway.to_element()
+
+ def to_basic_block(self):
+ """
+ Makes this block connectable by hier/top block python
+ """
+ return self.__gateway.to_basic_block()
+
+ def __gr_block_handle(self):
+ """
+ Dispatch tasks according to the action type specified in the message.
+ """
+ if self.__message.action == gr_block_gw_message_type.ACTION_GENERAL_WORK:
+ self.__message.general_work_args_return_value = self.general_work(
+
+ input_items=[pointer_to_ndarray(
+ self.__message.general_work_args_input_items[i],
+ self.__in_sig[i],
+ self.__message.general_work_args_ninput_items[i]
+ ) for i in self.__in_indexes],
+
+ output_items=[pointer_to_ndarray(
+ self.__message.general_work_args_output_items[i],
+ self.__out_sig[i],
+ self.__message.general_work_args_noutput_items
+ ) for i in self.__out_indexes],
+ )
+
+ elif self.__message.action == gr_block_gw_message_type.ACTION_WORK:
+ self.__message.work_args_return_value = self.work(
+
+ input_items=[pointer_to_ndarray(
+ self.__message.work_args_input_items[i],
+ self.__in_sig[i],
+ self.__message.work_args_ninput_items
+ ) for i in self.__in_indexes],
+
+ output_items=[pointer_to_ndarray(
+ self.__message.work_args_output_items[i],
+ self.__out_sig[i],
+ self.__message.work_args_noutput_items
+ ) for i in self.__out_indexes],
+ )
+
+ elif self.__message.action == gr_block_gw_message_type.ACTION_FORECAST:
+ self.forecast(
+ noutput_items=self.__message.forecast_args_noutput_items,
+ ninput_items_required=self.__message.forecast_args_ninput_items_required,
+ )
+
+ elif self.__message.action == gr_block_gw_message_type.ACTION_START:
+ self.__message.start_args_return_value = self.start()
+
+ elif self.__message.action == gr_block_gw_message_type.ACTION_STOP:
+ self.__message.stop_args_return_value = self.stop()
+
+ def forecast(self, noutput_items, ninput_items_required):
+ """
+ forecast is only called from a general block
+ this is the default implementation
+ """
+ for ninput_item in ninput_items_required:
+ ninput_item = noutput_items + self.history() - 1;
+ return
+
+ def general_work(self, *args, **kwargs):
+ """general work to be overloaded in a derived class"""
+ raise NotImplementedError("general work not implemented")
+
+ def work(self, *args, **kwargs):
+ """work to be overloaded in a derived class"""
+ raise NotImplementedError("work not implemented")
+
+ def start(self): return True
+ def stop(self): return True
+
+ def set_msg_handler(self, which_port, handler_func):
+ handler = msg_handler()
+ handler.init(handler_func)
+ self.__gateway.set_msg_handler_feval(which_port, handler)
+ # Save handler object in class so it's not garbage collected
+ self.__msg_handlers[which_port] = handler
+
+########################################################################
+# Wrappers for the user to inherit from
+########################################################################
+class basic_block(gateway_block):
+ def __init__(self, name, in_sig, out_sig):
+ gateway_block.__init__(self,
+ name=name,
+ in_sig=in_sig,
+ out_sig=out_sig,
+ work_type=gr_core.GR_BLOCK_GW_WORK_GENERAL,
+ factor=1, #not relevant factor
+ )
+
+class sync_block(gateway_block):
+ def __init__(self, name, in_sig, out_sig):
+ gateway_block.__init__(self,
+ name=name,
+ in_sig=in_sig,
+ out_sig=out_sig,
+ work_type=gr_core.GR_BLOCK_GW_WORK_SYNC,
+ factor=1,
+ )
+
+class decim_block(gateway_block):
+ def __init__(self, name, in_sig, out_sig, decim):
+ gateway_block.__init__(self,
+ name=name,
+ in_sig=in_sig,
+ out_sig=out_sig,
+ work_type=gr_core.GR_BLOCK_GW_WORK_DECIM,
+ factor=decim,
+ )
+
+class interp_block(gateway_block):
+ def __init__(self, name, in_sig, out_sig, interp):
+ gateway_block.__init__(self,
+ name=name,
+ in_sig=in_sig,
+ out_sig=out_sig,
+ work_type=gr_core.GR_BLOCK_GW_WORK_INTERP,
+ factor=interp,
+ )
diff --git a/gnuradio-core/src/python/gnuradio/gr/gr_threading.py b/gnuradio-core/src/python/gnuradio/gr/gr_threading.py
new file mode 100644
index 000000000..5d6f0fdaf
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/gr_threading.py
@@ -0,0 +1,35 @@
+#
+# Copyright 2005 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 sys import version_info as _version_info
+
+# import patched version of standard threading module
+
+if _version_info[0:2] == (2, 3):
+ #print "Importing gr_threading_23"
+ from gr_threading_23 import *
+elif _version_info[0:2] == (2, 4):
+ #print "Importing gr_threading_24"
+ from gr_threading_24 import *
+else:
+ # assume the patch was applied...
+ #print "Importing system provided threading"
+ from threading import *
diff --git a/gnuradio-core/src/python/gnuradio/gr/gr_threading_23.py b/gnuradio-core/src/python/gnuradio/gr/gr_threading_23.py
new file mode 100644
index 000000000..dee8034c1
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/gr_threading_23.py
@@ -0,0 +1,724 @@
+"""Thread module emulating a subset of Java's threading model."""
+
+# This started life as the threading.py module of Python 2.3
+# It's been patched to fix a problem with join, where a KeyboardInterrupt
+# caused a lock to be left in the acquired state.
+
+import sys as _sys
+
+try:
+ import thread
+except ImportError:
+ del _sys.modules[__name__]
+ raise
+
+from StringIO import StringIO as _StringIO
+from time import time as _time, sleep as _sleep
+from traceback import print_exc as _print_exc
+
+# Rename some stuff so "from threading import *" is safe
+__all__ = ['activeCount', 'Condition', 'currentThread', 'enumerate', 'Event',
+ 'Lock', 'RLock', 'Semaphore', 'BoundedSemaphore', 'Thread',
+ 'Timer', 'setprofile', 'settrace']
+
+_start_new_thread = thread.start_new_thread
+_allocate_lock = thread.allocate_lock
+_get_ident = thread.get_ident
+ThreadError = thread.error
+del thread
+
+
+# Debug support (adapted from ihooks.py).
+# All the major classes here derive from _Verbose. We force that to
+# be a new-style class so that all the major classes here are new-style.
+# This helps debugging (type(instance) is more revealing for instances
+# of new-style classes).
+
+_VERBOSE = False
+
+if __debug__:
+
+ class _Verbose(object):
+
+ def __init__(self, verbose=None):
+ if verbose is None:
+ verbose = _VERBOSE
+ self.__verbose = verbose
+
+ def _note(self, format, *args):
+ if self.__verbose:
+ format = format % args
+ format = "%s: %s\n" % (
+ currentThread().getName(), format)
+ _sys.stderr.write(format)
+
+else:
+ # Disable this when using "python -O"
+ class _Verbose(object):
+ def __init__(self, verbose=None):
+ pass
+ def _note(self, *args):
+ pass
+
+# Support for profile and trace hooks
+
+_profile_hook = None
+_trace_hook = None
+
+def setprofile(func):
+ global _profile_hook
+ _profile_hook = func
+
+def settrace(func):
+ global _trace_hook
+ _trace_hook = func
+
+# Synchronization classes
+
+Lock = _allocate_lock
+
+def RLock(*args, **kwargs):
+ return _RLock(*args, **kwargs)
+
+class _RLock(_Verbose):
+
+ def __init__(self, verbose=None):
+ _Verbose.__init__(self, verbose)
+ self.__block = _allocate_lock()
+ self.__owner = None
+ self.__count = 0
+
+ def __repr__(self):
+ return "<%s(%s, %d)>" % (
+ self.__class__.__name__,
+ self.__owner and self.__owner.getName(),
+ self.__count)
+
+ def acquire(self, blocking=1):
+ me = currentThread()
+ if self.__owner is me:
+ self.__count = self.__count + 1
+ if __debug__:
+ self._note("%s.acquire(%s): recursive success", self, blocking)
+ return 1
+ rc = self.__block.acquire(blocking)
+ if rc:
+ self.__owner = me
+ self.__count = 1
+ if __debug__:
+ self._note("%s.acquire(%s): initial succes", self, blocking)
+ else:
+ if __debug__:
+ self._note("%s.acquire(%s): failure", self, blocking)
+ return rc
+
+ def release(self):
+ me = currentThread()
+ assert self.__owner is me, "release() of un-acquire()d lock"
+ self.__count = count = self.__count - 1
+ if not count:
+ self.__owner = None
+ self.__block.release()
+ if __debug__:
+ self._note("%s.release(): final release", self)
+ else:
+ if __debug__:
+ self._note("%s.release(): non-final release", self)
+
+ # Internal methods used by condition variables
+
+ def _acquire_restore(self, (count, owner)):
+ self.__block.acquire()
+ self.__count = count
+ self.__owner = owner
+ if __debug__:
+ self._note("%s._acquire_restore()", self)
+
+ def _release_save(self):
+ if __debug__:
+ self._note("%s._release_save()", self)
+ count = self.__count
+ self.__count = 0
+ owner = self.__owner
+ self.__owner = None
+ self.__block.release()
+ return (count, owner)
+
+ def _is_owned(self):
+ return self.__owner is currentThread()
+
+
+def Condition(*args, **kwargs):
+ return _Condition(*args, **kwargs)
+
+class _Condition(_Verbose):
+
+ def __init__(self, lock=None, verbose=None):
+ _Verbose.__init__(self, verbose)
+ if lock is None:
+ lock = RLock()
+ self.__lock = lock
+ # Export the lock's acquire() and release() methods
+ self.acquire = lock.acquire
+ self.release = lock.release
+ # If the lock defines _release_save() and/or _acquire_restore(),
+ # these override the default implementations (which just call
+ # release() and acquire() on the lock). Ditto for _is_owned().
+ try:
+ self._release_save = lock._release_save
+ except AttributeError:
+ pass
+ try:
+ self._acquire_restore = lock._acquire_restore
+ except AttributeError:
+ pass
+ try:
+ self._is_owned = lock._is_owned
+ except AttributeError:
+ pass
+ self.__waiters = []
+
+ def __repr__(self):
+ return "<Condition(%s, %d)>" % (self.__lock, len(self.__waiters))
+
+ def _release_save(self):
+ self.__lock.release() # No state to save
+
+ def _acquire_restore(self, x):
+ self.__lock.acquire() # Ignore saved state
+
+ def _is_owned(self):
+ # Return True if lock is owned by currentThread.
+ # This method is called only if __lock doesn't have _is_owned().
+ if self.__lock.acquire(0):
+ self.__lock.release()
+ return False
+ else:
+ return True
+
+ def wait(self, timeout=None):
+ currentThread() # for side-effect
+ assert self._is_owned(), "wait() of un-acquire()d lock"
+ waiter = _allocate_lock()
+ waiter.acquire()
+ self.__waiters.append(waiter)
+ saved_state = self._release_save()
+ try: # restore state no matter what (e.g., KeyboardInterrupt)
+ if timeout is None:
+ waiter.acquire()
+ if __debug__:
+ self._note("%s.wait(): got it", self)
+ else:
+ # Balancing act: We can't afford a pure busy loop, so we
+ # have to sleep; but if we sleep the whole timeout time,
+ # we'll be unresponsive. The scheme here sleeps very
+ # little at first, longer as time goes on, but never longer
+ # than 20 times per second (or the timeout time remaining).
+ endtime = _time() + timeout
+ delay = 0.0005 # 500 us -> initial delay of 1 ms
+ while True:
+ gotit = waiter.acquire(0)
+ if gotit:
+ break
+ remaining = endtime - _time()
+ if remaining <= 0:
+ break
+ delay = min(delay * 2, remaining, .05)
+ _sleep(delay)
+ if not gotit:
+ if __debug__:
+ self._note("%s.wait(%s): timed out", self, timeout)
+ try:
+ self.__waiters.remove(waiter)
+ except ValueError:
+ pass
+ else:
+ if __debug__:
+ self._note("%s.wait(%s): got it", self, timeout)
+ finally:
+ self._acquire_restore(saved_state)
+
+ def notify(self, n=1):
+ currentThread() # for side-effect
+ assert self._is_owned(), "notify() of un-acquire()d lock"
+ __waiters = self.__waiters
+ waiters = __waiters[:n]
+ if not waiters:
+ if __debug__:
+ self._note("%s.notify(): no waiters", self)
+ return
+ self._note("%s.notify(): notifying %d waiter%s", self, n,
+ n!=1 and "s" or "")
+ for waiter in waiters:
+ waiter.release()
+ try:
+ __waiters.remove(waiter)
+ except ValueError:
+ pass
+
+ def notifyAll(self):
+ self.notify(len(self.__waiters))
+
+
+def Semaphore(*args, **kwargs):
+ return _Semaphore(*args, **kwargs)
+
+class _Semaphore(_Verbose):
+
+ # After Tim Peters' semaphore class, but not quite the same (no maximum)
+
+ def __init__(self, value=1, verbose=None):
+ assert value >= 0, "Semaphore initial value must be >= 0"
+ _Verbose.__init__(self, verbose)
+ self.__cond = Condition(Lock())
+ self.__value = value
+
+ def acquire(self, blocking=1):
+ rc = False
+ self.__cond.acquire()
+ while self.__value == 0:
+ if not blocking:
+ break
+ if __debug__:
+ self._note("%s.acquire(%s): blocked waiting, value=%s",
+ self, blocking, self.__value)
+ self.__cond.wait()
+ else:
+ self.__value = self.__value - 1
+ if __debug__:
+ self._note("%s.acquire: success, value=%s",
+ self, self.__value)
+ rc = True
+ self.__cond.release()
+ return rc
+
+ def release(self):
+ self.__cond.acquire()
+ self.__value = self.__value + 1
+ if __debug__:
+ self._note("%s.release: success, value=%s",
+ self, self.__value)
+ self.__cond.notify()
+ self.__cond.release()
+
+
+def BoundedSemaphore(*args, **kwargs):
+ return _BoundedSemaphore(*args, **kwargs)
+
+class _BoundedSemaphore(_Semaphore):
+ """Semaphore that checks that # releases is <= # acquires"""
+ def __init__(self, value=1, verbose=None):
+ _Semaphore.__init__(self, value, verbose)
+ self._initial_value = value
+
+ def release(self):
+ if self._Semaphore__value >= self._initial_value:
+ raise ValueError, "Semaphore released too many times"
+ return _Semaphore.release(self)
+
+
+def Event(*args, **kwargs):
+ return _Event(*args, **kwargs)
+
+class _Event(_Verbose):
+
+ # After Tim Peters' event class (without is_posted())
+
+ def __init__(self, verbose=None):
+ _Verbose.__init__(self, verbose)
+ self.__cond = Condition(Lock())
+ self.__flag = False
+
+ def isSet(self):
+ return self.__flag
+
+ def set(self):
+ self.__cond.acquire()
+ try:
+ self.__flag = True
+ self.__cond.notifyAll()
+ finally:
+ self.__cond.release()
+
+ def clear(self):
+ self.__cond.acquire()
+ try:
+ self.__flag = False
+ finally:
+ self.__cond.release()
+
+ def wait(self, timeout=None):
+ self.__cond.acquire()
+ try:
+ if not self.__flag:
+ self.__cond.wait(timeout)
+ finally:
+ self.__cond.release()
+
+# Helper to generate new thread names
+_counter = 0
+def _newname(template="Thread-%d"):
+ global _counter
+ _counter = _counter + 1
+ return template % _counter
+
+# Active thread administration
+_active_limbo_lock = _allocate_lock()
+_active = {}
+_limbo = {}
+
+
+# Main class for threads
+
+class Thread(_Verbose):
+
+ __initialized = False
+
+ def __init__(self, group=None, target=None, name=None,
+ args=(), kwargs={}, verbose=None):
+ assert group is None, "group argument must be None for now"
+ _Verbose.__init__(self, verbose)
+ self.__target = target
+ self.__name = str(name or _newname())
+ self.__args = args
+ self.__kwargs = kwargs
+ self.__daemonic = self._set_daemon()
+ self.__started = False
+ self.__stopped = False
+ self.__block = Condition(Lock())
+ self.__initialized = True
+
+ def _set_daemon(self):
+ # Overridden in _MainThread and _DummyThread
+ return currentThread().isDaemon()
+
+ def __repr__(self):
+ assert self.__initialized, "Thread.__init__() was not called"
+ status = "initial"
+ if self.__started:
+ status = "started"
+ if self.__stopped:
+ status = "stopped"
+ if self.__daemonic:
+ status = status + " daemon"
+ return "<%s(%s, %s)>" % (self.__class__.__name__, self.__name, status)
+
+ def start(self):
+ assert self.__initialized, "Thread.__init__() not called"
+ assert not self.__started, "thread already started"
+ if __debug__:
+ self._note("%s.start(): starting thread", self)
+ _active_limbo_lock.acquire()
+ _limbo[self] = self
+ _active_limbo_lock.release()
+ _start_new_thread(self.__bootstrap, ())
+ self.__started = True
+ _sleep(0.000001) # 1 usec, to let the thread run (Solaris hack)
+
+ def run(self):
+ if self.__target:
+ self.__target(*self.__args, **self.__kwargs)
+
+ def __bootstrap(self):
+ try:
+ self.__started = True
+ _active_limbo_lock.acquire()
+ _active[_get_ident()] = self
+ del _limbo[self]
+ _active_limbo_lock.release()
+ if __debug__:
+ self._note("%s.__bootstrap(): thread started", self)
+
+ if _trace_hook:
+ self._note("%s.__bootstrap(): registering trace hook", self)
+ _sys.settrace(_trace_hook)
+ if _profile_hook:
+ self._note("%s.__bootstrap(): registering profile hook", self)
+ _sys.setprofile(_profile_hook)
+
+ try:
+ self.run()
+ except SystemExit:
+ if __debug__:
+ self._note("%s.__bootstrap(): raised SystemExit", self)
+ except:
+ if __debug__:
+ self._note("%s.__bootstrap(): unhandled exception", self)
+ s = _StringIO()
+ _print_exc(file=s)
+ _sys.stderr.write("Exception in thread %s:\n%s\n" %
+ (self.getName(), s.getvalue()))
+ else:
+ if __debug__:
+ self._note("%s.__bootstrap(): normal return", self)
+ finally:
+ self.__stop()
+ try:
+ self.__delete()
+ except:
+ pass
+
+ def __stop(self):
+ self.__block.acquire()
+ self.__stopped = True
+ self.__block.notifyAll()
+ self.__block.release()
+
+ def __delete(self):
+ _active_limbo_lock.acquire()
+ del _active[_get_ident()]
+ _active_limbo_lock.release()
+
+ def join(self, timeout=None):
+ assert self.__initialized, "Thread.__init__() not called"
+ assert self.__started, "cannot join thread before it is started"
+ assert self is not currentThread(), "cannot join current thread"
+ if __debug__:
+ if not self.__stopped:
+ self._note("%s.join(): waiting until thread stops", self)
+ self.__block.acquire()
+ try:
+ if timeout is None:
+ while not self.__stopped:
+ self.__block.wait()
+ if __debug__:
+ self._note("%s.join(): thread stopped", self)
+ else:
+ deadline = _time() + timeout
+ while not self.__stopped:
+ delay = deadline - _time()
+ if delay <= 0:
+ if __debug__:
+ self._note("%s.join(): timed out", self)
+ break
+ self.__block.wait(delay)
+ else:
+ if __debug__:
+ self._note("%s.join(): thread stopped", self)
+ finally:
+ self.__block.release()
+
+ def getName(self):
+ assert self.__initialized, "Thread.__init__() not called"
+ return self.__name
+
+ def setName(self, name):
+ assert self.__initialized, "Thread.__init__() not called"
+ self.__name = str(name)
+
+ def isAlive(self):
+ assert self.__initialized, "Thread.__init__() not called"
+ return self.__started and not self.__stopped
+
+ def isDaemon(self):
+ assert self.__initialized, "Thread.__init__() not called"
+ return self.__daemonic
+
+ def setDaemon(self, daemonic):
+ assert self.__initialized, "Thread.__init__() not called"
+ assert not self.__started, "cannot set daemon status of active thread"
+ self.__daemonic = daemonic
+
+# The timer class was contributed by Itamar Shtull-Trauring
+
+def Timer(*args, **kwargs):
+ return _Timer(*args, **kwargs)
+
+class _Timer(Thread):
+ """Call a function after a specified number of seconds:
+
+ t = Timer(30.0, f, args=[], kwargs={})
+ t.start()
+ t.cancel() # stop the timer's action if it's still waiting
+ """
+
+ def __init__(self, interval, function, args=[], kwargs={}):
+ Thread.__init__(self)
+ self.interval = interval
+ self.function = function
+ self.args = args
+ self.kwargs = kwargs
+ self.finished = Event()
+
+ def cancel(self):
+ """Stop the timer if it hasn't finished yet"""
+ self.finished.set()
+
+ def run(self):
+ self.finished.wait(self.interval)
+ if not self.finished.isSet():
+ self.function(*self.args, **self.kwargs)
+ self.finished.set()
+
+# Special thread class to represent the main thread
+# This is garbage collected through an exit handler
+
+class _MainThread(Thread):
+
+ def __init__(self):
+ Thread.__init__(self, name="MainThread")
+ self._Thread__started = True
+ _active_limbo_lock.acquire()
+ _active[_get_ident()] = self
+ _active_limbo_lock.release()
+ import atexit
+ atexit.register(self.__exitfunc)
+
+ def _set_daemon(self):
+ return False
+
+ def __exitfunc(self):
+ self._Thread__stop()
+ t = _pickSomeNonDaemonThread()
+ if t:
+ if __debug__:
+ self._note("%s: waiting for other threads", self)
+ while t:
+ t.join()
+ t = _pickSomeNonDaemonThread()
+ if __debug__:
+ self._note("%s: exiting", self)
+ self._Thread__delete()
+
+def _pickSomeNonDaemonThread():
+ for t in enumerate():
+ if not t.isDaemon() and t.isAlive():
+ return t
+ return None
+
+
+# Dummy thread class to represent threads not started here.
+# These aren't garbage collected when they die,
+# nor can they be waited for.
+# Their purpose is to return *something* from currentThread().
+# They are marked as daemon threads so we won't wait for them
+# when we exit (conform previous semantics).
+
+class _DummyThread(Thread):
+
+ def __init__(self):
+ Thread.__init__(self, name=_newname("Dummy-%d"))
+ self._Thread__started = True
+ _active_limbo_lock.acquire()
+ _active[_get_ident()] = self
+ _active_limbo_lock.release()
+
+ def _set_daemon(self):
+ return True
+
+ def join(self, timeout=None):
+ assert False, "cannot join a dummy thread"
+
+
+# Global API functions
+
+def currentThread():
+ try:
+ return _active[_get_ident()]
+ except KeyError:
+ ##print "currentThread(): no current thread for", _get_ident()
+ return _DummyThread()
+
+def activeCount():
+ _active_limbo_lock.acquire()
+ count = len(_active) + len(_limbo)
+ _active_limbo_lock.release()
+ return count
+
+def enumerate():
+ _active_limbo_lock.acquire()
+ active = _active.values() + _limbo.values()
+ _active_limbo_lock.release()
+ return active
+
+# Create the main thread object
+
+_MainThread()
+
+
+# Self-test code
+
+def _test():
+
+ class BoundedQueue(_Verbose):
+
+ def __init__(self, limit):
+ _Verbose.__init__(self)
+ self.mon = RLock()
+ self.rc = Condition(self.mon)
+ self.wc = Condition(self.mon)
+ self.limit = limit
+ self.queue = []
+
+ def put(self, item):
+ self.mon.acquire()
+ while len(self.queue) >= self.limit:
+ self._note("put(%s): queue full", item)
+ self.wc.wait()
+ self.queue.append(item)
+ self._note("put(%s): appended, length now %d",
+ item, len(self.queue))
+ self.rc.notify()
+ self.mon.release()
+
+ def get(self):
+ self.mon.acquire()
+ while not self.queue:
+ self._note("get(): queue empty")
+ self.rc.wait()
+ item = self.queue.pop(0)
+ self._note("get(): got %s, %d left", item, len(self.queue))
+ self.wc.notify()
+ self.mon.release()
+ return item
+
+ class ProducerThread(Thread):
+
+ def __init__(self, queue, quota):
+ Thread.__init__(self, name="Producer")
+ self.queue = queue
+ self.quota = quota
+
+ def run(self):
+ from random import random
+ counter = 0
+ while counter < self.quota:
+ counter = counter + 1
+ self.queue.put("%s.%d" % (self.getName(), counter))
+ _sleep(random() * 0.00001)
+
+
+ class ConsumerThread(Thread):
+
+ def __init__(self, queue, count):
+ Thread.__init__(self, name="Consumer")
+ self.queue = queue
+ self.count = count
+
+ def run(self):
+ while self.count > 0:
+ item = self.queue.get()
+ print item
+ self.count = self.count - 1
+
+ NP = 3
+ QL = 4
+ NI = 5
+
+ Q = BoundedQueue(QL)
+ P = []
+ for i in range(NP):
+ t = ProducerThread(Q, NI)
+ t.setName("Producer-%d" % (i+1))
+ P.append(t)
+ C = ConsumerThread(Q, NI*NP)
+ for t in P:
+ t.start()
+ _sleep(0.000001)
+ C.start()
+ for t in P:
+ t.join()
+ C.join()
+
+if __name__ == '__main__':
+ _test()
diff --git a/gnuradio-core/src/python/gnuradio/gr/gr_threading_24.py b/gnuradio-core/src/python/gnuradio/gr/gr_threading_24.py
new file mode 100644
index 000000000..8539bfc04
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/gr_threading_24.py
@@ -0,0 +1,793 @@
+"""Thread module emulating a subset of Java's threading model."""
+
+# This started life as the threading.py module of Python 2.4
+# It's been patched to fix a problem with join, where a KeyboardInterrupt
+# caused a lock to be left in the acquired state.
+
+import sys as _sys
+
+try:
+ import thread
+except ImportError:
+ del _sys.modules[__name__]
+ raise
+
+from time import time as _time, sleep as _sleep
+from traceback import format_exc as _format_exc
+from collections import deque
+
+# Rename some stuff so "from threading import *" is safe
+__all__ = ['activeCount', 'Condition', 'currentThread', 'enumerate', 'Event',
+ 'Lock', 'RLock', 'Semaphore', 'BoundedSemaphore', 'Thread',
+ 'Timer', 'setprofile', 'settrace', 'local']
+
+_start_new_thread = thread.start_new_thread
+_allocate_lock = thread.allocate_lock
+_get_ident = thread.get_ident
+ThreadError = thread.error
+del thread
+
+
+# Debug support (adapted from ihooks.py).
+# All the major classes here derive from _Verbose. We force that to
+# be a new-style class so that all the major classes here are new-style.
+# This helps debugging (type(instance) is more revealing for instances
+# of new-style classes).
+
+_VERBOSE = False
+
+if __debug__:
+
+ class _Verbose(object):
+
+ def __init__(self, verbose=None):
+ if verbose is None:
+ verbose = _VERBOSE
+ self.__verbose = verbose
+
+ def _note(self, format, *args):
+ if self.__verbose:
+ format = format % args
+ format = "%s: %s\n" % (
+ currentThread().getName(), format)
+ _sys.stderr.write(format)
+
+else:
+ # Disable this when using "python -O"
+ class _Verbose(object):
+ def __init__(self, verbose=None):
+ pass
+ def _note(self, *args):
+ pass
+
+# Support for profile and trace hooks
+
+_profile_hook = None
+_trace_hook = None
+
+def setprofile(func):
+ global _profile_hook
+ _profile_hook = func
+
+def settrace(func):
+ global _trace_hook
+ _trace_hook = func
+
+# Synchronization classes
+
+Lock = _allocate_lock
+
+def RLock(*args, **kwargs):
+ return _RLock(*args, **kwargs)
+
+class _RLock(_Verbose):
+
+ def __init__(self, verbose=None):
+ _Verbose.__init__(self, verbose)
+ self.__block = _allocate_lock()
+ self.__owner = None
+ self.__count = 0
+
+ def __repr__(self):
+ return "<%s(%s, %d)>" % (
+ self.__class__.__name__,
+ self.__owner and self.__owner.getName(),
+ self.__count)
+
+ def acquire(self, blocking=1):
+ me = currentThread()
+ if self.__owner is me:
+ self.__count = self.__count + 1
+ if __debug__:
+ self._note("%s.acquire(%s): recursive success", self, blocking)
+ return 1
+ rc = self.__block.acquire(blocking)
+ if rc:
+ self.__owner = me
+ self.__count = 1
+ if __debug__:
+ self._note("%s.acquire(%s): initial succes", self, blocking)
+ else:
+ if __debug__:
+ self._note("%s.acquire(%s): failure", self, blocking)
+ return rc
+
+ def release(self):
+ me = currentThread()
+ assert self.__owner is me, "release() of un-acquire()d lock"
+ self.__count = count = self.__count - 1
+ if not count:
+ self.__owner = None
+ self.__block.release()
+ if __debug__:
+ self._note("%s.release(): final release", self)
+ else:
+ if __debug__:
+ self._note("%s.release(): non-final release", self)
+
+ # Internal methods used by condition variables
+
+ def _acquire_restore(self, (count, owner)):
+ self.__block.acquire()
+ self.__count = count
+ self.__owner = owner
+ if __debug__:
+ self._note("%s._acquire_restore()", self)
+
+ def _release_save(self):
+ if __debug__:
+ self._note("%s._release_save()", self)
+ count = self.__count
+ self.__count = 0
+ owner = self.__owner
+ self.__owner = None
+ self.__block.release()
+ return (count, owner)
+
+ def _is_owned(self):
+ return self.__owner is currentThread()
+
+
+def Condition(*args, **kwargs):
+ return _Condition(*args, **kwargs)
+
+class _Condition(_Verbose):
+
+ def __init__(self, lock=None, verbose=None):
+ _Verbose.__init__(self, verbose)
+ if lock is None:
+ lock = RLock()
+ self.__lock = lock
+ # Export the lock's acquire() and release() methods
+ self.acquire = lock.acquire
+ self.release = lock.release
+ # If the lock defines _release_save() and/or _acquire_restore(),
+ # these override the default implementations (which just call
+ # release() and acquire() on the lock). Ditto for _is_owned().
+ try:
+ self._release_save = lock._release_save
+ except AttributeError:
+ pass
+ try:
+ self._acquire_restore = lock._acquire_restore
+ except AttributeError:
+ pass
+ try:
+ self._is_owned = lock._is_owned
+ except AttributeError:
+ pass
+ self.__waiters = []
+
+ def __repr__(self):
+ return "<Condition(%s, %d)>" % (self.__lock, len(self.__waiters))
+
+ def _release_save(self):
+ self.__lock.release() # No state to save
+
+ def _acquire_restore(self, x):
+ self.__lock.acquire() # Ignore saved state
+
+ def _is_owned(self):
+ # Return True if lock is owned by currentThread.
+ # This method is called only if __lock doesn't have _is_owned().
+ if self.__lock.acquire(0):
+ self.__lock.release()
+ return False
+ else:
+ return True
+
+ def wait(self, timeout=None):
+ assert self._is_owned(), "wait() of un-acquire()d lock"
+ waiter = _allocate_lock()
+ waiter.acquire()
+ self.__waiters.append(waiter)
+ saved_state = self._release_save()
+ try: # restore state no matter what (e.g., KeyboardInterrupt)
+ if timeout is None:
+ waiter.acquire()
+ if __debug__:
+ self._note("%s.wait(): got it", self)
+ else:
+ # Balancing act: We can't afford a pure busy loop, so we
+ # have to sleep; but if we sleep the whole timeout time,
+ # we'll be unresponsive. The scheme here sleeps very
+ # little at first, longer as time goes on, but never longer
+ # than 20 times per second (or the timeout time remaining).
+ endtime = _time() + timeout
+ delay = 0.0005 # 500 us -> initial delay of 1 ms
+ while True:
+ gotit = waiter.acquire(0)
+ if gotit:
+ break
+ remaining = endtime - _time()
+ if remaining <= 0:
+ break
+ delay = min(delay * 2, remaining, .05)
+ _sleep(delay)
+ if not gotit:
+ if __debug__:
+ self._note("%s.wait(%s): timed out", self, timeout)
+ try:
+ self.__waiters.remove(waiter)
+ except ValueError:
+ pass
+ else:
+ if __debug__:
+ self._note("%s.wait(%s): got it", self, timeout)
+ finally:
+ self._acquire_restore(saved_state)
+
+ def notify(self, n=1):
+ assert self._is_owned(), "notify() of un-acquire()d lock"
+ __waiters = self.__waiters
+ waiters = __waiters[:n]
+ if not waiters:
+ if __debug__:
+ self._note("%s.notify(): no waiters", self)
+ return
+ self._note("%s.notify(): notifying %d waiter%s", self, n,
+ n!=1 and "s" or "")
+ for waiter in waiters:
+ waiter.release()
+ try:
+ __waiters.remove(waiter)
+ except ValueError:
+ pass
+
+ def notifyAll(self):
+ self.notify(len(self.__waiters))
+
+
+def Semaphore(*args, **kwargs):
+ return _Semaphore(*args, **kwargs)
+
+class _Semaphore(_Verbose):
+
+ # After Tim Peters' semaphore class, but not quite the same (no maximum)
+
+ def __init__(self, value=1, verbose=None):
+ assert value >= 0, "Semaphore initial value must be >= 0"
+ _Verbose.__init__(self, verbose)
+ self.__cond = Condition(Lock())
+ self.__value = value
+
+ def acquire(self, blocking=1):
+ rc = False
+ self.__cond.acquire()
+ while self.__value == 0:
+ if not blocking:
+ break
+ if __debug__:
+ self._note("%s.acquire(%s): blocked waiting, value=%s",
+ self, blocking, self.__value)
+ self.__cond.wait()
+ else:
+ self.__value = self.__value - 1
+ if __debug__:
+ self._note("%s.acquire: success, value=%s",
+ self, self.__value)
+ rc = True
+ self.__cond.release()
+ return rc
+
+ def release(self):
+ self.__cond.acquire()
+ self.__value = self.__value + 1
+ if __debug__:
+ self._note("%s.release: success, value=%s",
+ self, self.__value)
+ self.__cond.notify()
+ self.__cond.release()
+
+
+def BoundedSemaphore(*args, **kwargs):
+ return _BoundedSemaphore(*args, **kwargs)
+
+class _BoundedSemaphore(_Semaphore):
+ """Semaphore that checks that # releases is <= # acquires"""
+ def __init__(self, value=1, verbose=None):
+ _Semaphore.__init__(self, value, verbose)
+ self._initial_value = value
+
+ def release(self):
+ if self._Semaphore__value >= self._initial_value:
+ raise ValueError, "Semaphore released too many times"
+ return _Semaphore.release(self)
+
+
+def Event(*args, **kwargs):
+ return _Event(*args, **kwargs)
+
+class _Event(_Verbose):
+
+ # After Tim Peters' event class (without is_posted())
+
+ def __init__(self, verbose=None):
+ _Verbose.__init__(self, verbose)
+ self.__cond = Condition(Lock())
+ self.__flag = False
+
+ def isSet(self):
+ return self.__flag
+
+ def set(self):
+ self.__cond.acquire()
+ try:
+ self.__flag = True
+ self.__cond.notifyAll()
+ finally:
+ self.__cond.release()
+
+ def clear(self):
+ self.__cond.acquire()
+ try:
+ self.__flag = False
+ finally:
+ self.__cond.release()
+
+ def wait(self, timeout=None):
+ self.__cond.acquire()
+ try:
+ if not self.__flag:
+ self.__cond.wait(timeout)
+ finally:
+ self.__cond.release()
+
+# Helper to generate new thread names
+_counter = 0
+def _newname(template="Thread-%d"):
+ global _counter
+ _counter = _counter + 1
+ return template % _counter
+
+# Active thread administration
+_active_limbo_lock = _allocate_lock()
+_active = {}
+_limbo = {}
+
+
+# Main class for threads
+
+class Thread(_Verbose):
+
+ __initialized = False
+ # Need to store a reference to sys.exc_info for printing
+ # out exceptions when a thread tries to use a global var. during interp.
+ # shutdown and thus raises an exception about trying to perform some
+ # operation on/with a NoneType
+ __exc_info = _sys.exc_info
+
+ def __init__(self, group=None, target=None, name=None,
+ args=(), kwargs={}, verbose=None):
+ assert group is None, "group argument must be None for now"
+ _Verbose.__init__(self, verbose)
+ self.__target = target
+ self.__name = str(name or _newname())
+ self.__args = args
+ self.__kwargs = kwargs
+ self.__daemonic = self._set_daemon()
+ self.__started = False
+ self.__stopped = False
+ self.__block = Condition(Lock())
+ self.__initialized = True
+ # sys.stderr is not stored in the class like
+ # sys.exc_info since it can be changed between instances
+ self.__stderr = _sys.stderr
+
+ def _set_daemon(self):
+ # Overridden in _MainThread and _DummyThread
+ return currentThread().isDaemon()
+
+ def __repr__(self):
+ assert self.__initialized, "Thread.__init__() was not called"
+ status = "initial"
+ if self.__started:
+ status = "started"
+ if self.__stopped:
+ status = "stopped"
+ if self.__daemonic:
+ status = status + " daemon"
+ return "<%s(%s, %s)>" % (self.__class__.__name__, self.__name, status)
+
+ def start(self):
+ assert self.__initialized, "Thread.__init__() not called"
+ assert not self.__started, "thread already started"
+ if __debug__:
+ self._note("%s.start(): starting thread", self)
+ _active_limbo_lock.acquire()
+ _limbo[self] = self
+ _active_limbo_lock.release()
+ _start_new_thread(self.__bootstrap, ())
+ self.__started = True
+ _sleep(0.000001) # 1 usec, to let the thread run (Solaris hack)
+
+ def run(self):
+ if self.__target:
+ self.__target(*self.__args, **self.__kwargs)
+
+ def __bootstrap(self):
+ try:
+ self.__started = True
+ _active_limbo_lock.acquire()
+ _active[_get_ident()] = self
+ del _limbo[self]
+ _active_limbo_lock.release()
+ if __debug__:
+ self._note("%s.__bootstrap(): thread started", self)
+
+ if _trace_hook:
+ self._note("%s.__bootstrap(): registering trace hook", self)
+ _sys.settrace(_trace_hook)
+ if _profile_hook:
+ self._note("%s.__bootstrap(): registering profile hook", self)
+ _sys.setprofile(_profile_hook)
+
+ try:
+ self.run()
+ except SystemExit:
+ if __debug__:
+ self._note("%s.__bootstrap(): raised SystemExit", self)
+ except:
+ if __debug__:
+ self._note("%s.__bootstrap(): unhandled exception", self)
+ # If sys.stderr is no more (most likely from interpreter
+ # shutdown) use self.__stderr. Otherwise still use sys (as in
+ # _sys) in case sys.stderr was redefined since the creation of
+ # self.
+ if _sys:
+ _sys.stderr.write("Exception in thread %s:\n%s\n" %
+ (self.getName(), _format_exc()))
+ else:
+ # Do the best job possible w/o a huge amt. of code to
+ # approximate a traceback (code ideas from
+ # Lib/traceback.py)
+ exc_type, exc_value, exc_tb = self.__exc_info()
+ try:
+ print>>self.__stderr, (
+ "Exception in thread " + self.getName() +
+ " (most likely raised during interpreter shutdown):")
+ print>>self.__stderr, (
+ "Traceback (most recent call last):")
+ while exc_tb:
+ print>>self.__stderr, (
+ ' File "%s", line %s, in %s' %
+ (exc_tb.tb_frame.f_code.co_filename,
+ exc_tb.tb_lineno,
+ exc_tb.tb_frame.f_code.co_name))
+ exc_tb = exc_tb.tb_next
+ print>>self.__stderr, ("%s: %s" % (exc_type, exc_value))
+ # Make sure that exc_tb gets deleted since it is a memory
+ # hog; deleting everything else is just for thoroughness
+ finally:
+ del exc_type, exc_value, exc_tb
+ else:
+ if __debug__:
+ self._note("%s.__bootstrap(): normal return", self)
+ finally:
+ self.__stop()
+ try:
+ self.__delete()
+ except:
+ pass
+
+ def __stop(self):
+ self.__block.acquire()
+ self.__stopped = True
+ self.__block.notifyAll()
+ self.__block.release()
+
+ def __delete(self):
+ "Remove current thread from the dict of currently running threads."
+
+ # Notes about running with dummy_thread:
+ #
+ # Must take care to not raise an exception if dummy_thread is being
+ # used (and thus this module is being used as an instance of
+ # dummy_threading). dummy_thread.get_ident() always returns -1 since
+ # there is only one thread if dummy_thread is being used. Thus
+ # len(_active) is always <= 1 here, and any Thread instance created
+ # overwrites the (if any) thread currently registered in _active.
+ #
+ # An instance of _MainThread is always created by 'threading'. This
+ # gets overwritten the instant an instance of Thread is created; both
+ # threads return -1 from dummy_thread.get_ident() and thus have the
+ # same key in the dict. So when the _MainThread instance created by
+ # 'threading' tries to clean itself up when atexit calls this method
+ # it gets a KeyError if another Thread instance was created.
+ #
+ # This all means that KeyError from trying to delete something from
+ # _active if dummy_threading is being used is a red herring. But
+ # since it isn't if dummy_threading is *not* being used then don't
+ # hide the exception.
+
+ _active_limbo_lock.acquire()
+ try:
+ try:
+ del _active[_get_ident()]
+ except KeyError:
+ if 'dummy_threading' not in _sys.modules:
+ raise
+ finally:
+ _active_limbo_lock.release()
+
+ def join(self, timeout=None):
+ assert self.__initialized, "Thread.__init__() not called"
+ assert self.__started, "cannot join thread before it is started"
+ assert self is not currentThread(), "cannot join current thread"
+ if __debug__:
+ if not self.__stopped:
+ self._note("%s.join(): waiting until thread stops", self)
+ self.__block.acquire()
+ try:
+ if timeout is None:
+ while not self.__stopped:
+ self.__block.wait()
+ if __debug__:
+ self._note("%s.join(): thread stopped", self)
+ else:
+ deadline = _time() + timeout
+ while not self.__stopped:
+ delay = deadline - _time()
+ if delay <= 0:
+ if __debug__:
+ self._note("%s.join(): timed out", self)
+ break
+ self.__block.wait(delay)
+ else:
+ if __debug__:
+ self._note("%s.join(): thread stopped", self)
+ finally:
+ self.__block.release()
+
+ def getName(self):
+ assert self.__initialized, "Thread.__init__() not called"
+ return self.__name
+
+ def setName(self, name):
+ assert self.__initialized, "Thread.__init__() not called"
+ self.__name = str(name)
+
+ def isAlive(self):
+ assert self.__initialized, "Thread.__init__() not called"
+ return self.__started and not self.__stopped
+
+ def isDaemon(self):
+ assert self.__initialized, "Thread.__init__() not called"
+ return self.__daemonic
+
+ def setDaemon(self, daemonic):
+ assert self.__initialized, "Thread.__init__() not called"
+ assert not self.__started, "cannot set daemon status of active thread"
+ self.__daemonic = daemonic
+
+# The timer class was contributed by Itamar Shtull-Trauring
+
+def Timer(*args, **kwargs):
+ return _Timer(*args, **kwargs)
+
+class _Timer(Thread):
+ """Call a function after a specified number of seconds:
+
+ t = Timer(30.0, f, args=[], kwargs={})
+ t.start()
+ t.cancel() # stop the timer's action if it's still waiting
+ """
+
+ def __init__(self, interval, function, args=[], kwargs={}):
+ Thread.__init__(self)
+ self.interval = interval
+ self.function = function
+ self.args = args
+ self.kwargs = kwargs
+ self.finished = Event()
+
+ def cancel(self):
+ """Stop the timer if it hasn't finished yet"""
+ self.finished.set()
+
+ def run(self):
+ self.finished.wait(self.interval)
+ if not self.finished.isSet():
+ self.function(*self.args, **self.kwargs)
+ self.finished.set()
+
+# Special thread class to represent the main thread
+# This is garbage collected through an exit handler
+
+class _MainThread(Thread):
+
+ def __init__(self):
+ Thread.__init__(self, name="MainThread")
+ self._Thread__started = True
+ _active_limbo_lock.acquire()
+ _active[_get_ident()] = self
+ _active_limbo_lock.release()
+ import atexit
+ atexit.register(self.__exitfunc)
+
+ def _set_daemon(self):
+ return False
+
+ def __exitfunc(self):
+ self._Thread__stop()
+ t = _pickSomeNonDaemonThread()
+ if t:
+ if __debug__:
+ self._note("%s: waiting for other threads", self)
+ while t:
+ t.join()
+ t = _pickSomeNonDaemonThread()
+ if __debug__:
+ self._note("%s: exiting", self)
+ self._Thread__delete()
+
+def _pickSomeNonDaemonThread():
+ for t in enumerate():
+ if not t.isDaemon() and t.isAlive():
+ return t
+ return None
+
+
+# Dummy thread class to represent threads not started here.
+# These aren't garbage collected when they die,
+# nor can they be waited for.
+# Their purpose is to return *something* from currentThread().
+# They are marked as daemon threads so we won't wait for them
+# when we exit (conform previous semantics).
+
+class _DummyThread(Thread):
+
+ def __init__(self):
+ Thread.__init__(self, name=_newname("Dummy-%d"))
+ self._Thread__started = True
+ _active_limbo_lock.acquire()
+ _active[_get_ident()] = self
+ _active_limbo_lock.release()
+
+ def _set_daemon(self):
+ return True
+
+ def join(self, timeout=None):
+ assert False, "cannot join a dummy thread"
+
+
+# Global API functions
+
+def currentThread():
+ try:
+ return _active[_get_ident()]
+ except KeyError:
+ ##print "currentThread(): no current thread for", _get_ident()
+ return _DummyThread()
+
+def activeCount():
+ _active_limbo_lock.acquire()
+ count = len(_active) + len(_limbo)
+ _active_limbo_lock.release()
+ return count
+
+def enumerate():
+ _active_limbo_lock.acquire()
+ active = _active.values() + _limbo.values()
+ _active_limbo_lock.release()
+ return active
+
+# Create the main thread object
+
+_MainThread()
+
+# get thread-local implementation, either from the thread
+# module, or from the python fallback
+
+try:
+ from thread import _local as local
+except ImportError:
+ from _threading_local import local
+
+
+# Self-test code
+
+def _test():
+
+ class BoundedQueue(_Verbose):
+
+ def __init__(self, limit):
+ _Verbose.__init__(self)
+ self.mon = RLock()
+ self.rc = Condition(self.mon)
+ self.wc = Condition(self.mon)
+ self.limit = limit
+ self.queue = deque()
+
+ def put(self, item):
+ self.mon.acquire()
+ while len(self.queue) >= self.limit:
+ self._note("put(%s): queue full", item)
+ self.wc.wait()
+ self.queue.append(item)
+ self._note("put(%s): appended, length now %d",
+ item, len(self.queue))
+ self.rc.notify()
+ self.mon.release()
+
+ def get(self):
+ self.mon.acquire()
+ while not self.queue:
+ self._note("get(): queue empty")
+ self.rc.wait()
+ item = self.queue.popleft()
+ self._note("get(): got %s, %d left", item, len(self.queue))
+ self.wc.notify()
+ self.mon.release()
+ return item
+
+ class ProducerThread(Thread):
+
+ def __init__(self, queue, quota):
+ Thread.__init__(self, name="Producer")
+ self.queue = queue
+ self.quota = quota
+
+ def run(self):
+ from random import random
+ counter = 0
+ while counter < self.quota:
+ counter = counter + 1
+ self.queue.put("%s.%d" % (self.getName(), counter))
+ _sleep(random() * 0.00001)
+
+
+ class ConsumerThread(Thread):
+
+ def __init__(self, queue, count):
+ Thread.__init__(self, name="Consumer")
+ self.queue = queue
+ self.count = count
+
+ def run(self):
+ while self.count > 0:
+ item = self.queue.get()
+ print item
+ self.count = self.count - 1
+
+ NP = 3
+ QL = 4
+ NI = 5
+
+ Q = BoundedQueue(QL)
+ P = []
+ for i in range(NP):
+ t = ProducerThread(Q, NI)
+ t.setName("Producer-%d" % (i+1))
+ P.append(t)
+ C = ConsumerThread(Q, NI*NP)
+ for t in P:
+ t.start()
+ _sleep(0.000001)
+ C.start()
+ for t in P:
+ t.join()
+ C.join()
+
+if __name__ == '__main__':
+ _test()
diff --git a/gnuradio-core/src/python/gnuradio/gr/hier_block2.py b/gnuradio-core/src/python/gnuradio/gr/hier_block2.py
new file mode 100644
index 000000000..b95782238
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/hier_block2.py
@@ -0,0 +1,129 @@
+#
+# Copyright 2006,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.
+#
+
+from gnuradio_core import hier_block2_swig
+try:
+ import pmt
+except ImportError:
+ from gruel import pmt
+
+#
+# This hack forces a 'has-a' relationship to look like an 'is-a' one.
+#
+# It allows Python classes to subclass this one, while passing through
+# method calls to the C++ class shared pointer from SWIG.
+#
+# It also allows us to intercept method calls if needed
+#
+class hier_block2(object):
+ """
+ Python wrapper around the C++ hierarchical block implementation.
+ Provides convenience functions and allows proper Python subclassing.
+ """
+
+ def __init__(self, name, input_signature, output_signature):
+ """
+ Create a hierarchical block with a given name and I/O signatures.
+ """
+ self._hb = hier_block2_swig(name, input_signature, output_signature)
+
+ def __getattr__(self, name):
+ """
+ Pass-through member requests to the C++ object.
+ """
+ if not hasattr(self, "_hb"):
+ raise RuntimeError("hier_block2: invalid state--did you forget to call gr.hier_block2.__init__ in a derived class?")
+ return getattr(self._hb, name)
+
+ def connect(self, *points):
+ """
+ Connect two or more block endpoints. An endpoint is either a (block, port)
+ tuple or a block instance. In the latter case, the port number is assumed
+ to be zero.
+
+ To connect the hierarchical block external inputs or outputs to internal block
+ inputs or outputs, use 'self' in the connect call.
+
+ If multiple arguments are provided, connect will attempt to wire them in series,
+ interpreting the endpoints as inputs or outputs as appropriate.
+ """
+
+ if len (points) < 1:
+ raise ValueError, ("connect requires at least one endpoint; %d provided." % (len (points),))
+ else:
+ if len(points) == 1:
+ self._hb.primitive_connect(points[0].to_basic_block())
+ else:
+ for i in range (1, len (points)):
+ self._connect(points[i-1], points[i])
+
+ def _connect(self, src, dst):
+ (src_block, src_port) = self._coerce_endpoint(src)
+ (dst_block, dst_port) = self._coerce_endpoint(dst)
+ self._hb.primitive_connect(src_block.to_basic_block(), src_port,
+ dst_block.to_basic_block(), dst_port)
+
+ def _coerce_endpoint(self, endp):
+ if hasattr(endp, 'to_basic_block'):
+ return (endp, 0)
+ else:
+ if hasattr(endp, "__getitem__") and len(endp) == 2:
+ return endp # Assume user put (block, port)
+ else:
+ raise ValueError("unable to coerce endpoint")
+
+ def disconnect(self, *points):
+ """
+ Disconnect two endpoints in the flowgraph.
+
+ To disconnect the hierarchical block external inputs or outputs to internal block
+ inputs or outputs, use 'self' in the connect call.
+
+ If more than two arguments are provided, they are disconnected successively.
+ """
+
+ if len (points) < 1:
+ raise ValueError, ("disconnect requires at least one endpoint; %d provided." % (len (points),))
+ else:
+ if len (points) == 1:
+ self._hb.primitive_disconnect(points[0].to_basic_block())
+ else:
+ for i in range (1, len (points)):
+ self._disconnect(points[i-1], points[i])
+
+ def _disconnect(self, src, dst):
+ (src_block, src_port) = self._coerce_endpoint(src)
+ (dst_block, dst_port) = self._coerce_endpoint(dst)
+ self._hb.primitive_disconnect(src_block.to_basic_block(), src_port,
+ dst_block.to_basic_block(), dst_port)
+
+ def msg_connect(self, src, srcport, dst, dstport):
+ self.primitive_msg_connect(src.to_basic_block(), srcport, dst.to_basic_block(), dstport);
+
+ def msg_disconnect(self, src, srcport, dst, dstport):
+ self.primitive_msg_disconnect(src.to_basic_block(), srcport, dst.to_basic_block(), dstport);
+
+ def message_port_register_hier_in(self, portname):
+ self.primitive_message_port_register_hier_in(pmt.pmt_intern(portname));
+
+ def message_port_register_hier_out(self, portname):
+ self.primitive_message_port_register_hier_out(pmt.pmt_intern(portname));
+
diff --git a/gnuradio-core/src/python/gnuradio/gr/prefs.py b/gnuradio-core/src/python/gnuradio/gr/prefs.py
new file mode 100644
index 000000000..25fa8cd6a
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/prefs.py
@@ -0,0 +1,127 @@
+#
+# Copyright 2006,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.
+#
+
+import gnuradio_core as gsp
+_prefs_base = gsp.gr_prefs
+
+
+import ConfigParser
+import os
+import os.path
+import sys
+import glob
+
+
+def _user_prefs_filename():
+ return os.path.expanduser('~/.gnuradio/config.conf')
+
+def _sys_prefs_dirname():
+ return gsp.prefsdir()
+
+def _bool(x):
+ """
+ Try to coerce obj to a True or False
+ """
+ if isinstance(x, bool):
+ return x
+ if isinstance(x, (float, int)):
+ return bool(x)
+ raise TypeError, x
+
+
+class _prefs(_prefs_base):
+ """
+ Derive our 'real class' from the stubbed out base class that has support
+ for SWIG directors. This allows C++ code to magically and transparently
+ invoke the methods in this python class.
+ """
+ def __init__(self):
+ _prefs_base.__init__(self)
+ self.cp = ConfigParser.RawConfigParser()
+ self.__getattr__ = lambda self, name: getattr(self.cp, name)
+
+ def _sys_prefs_filenames(self):
+ dir = _sys_prefs_dirname()
+ try:
+ fnames = glob.glob(os.path.join(dir, '*.conf'))
+ except (IOError, OSError):
+ return []
+ fnames.sort()
+ return fnames
+
+ def _read_files(self):
+ filenames = self._sys_prefs_filenames()
+ filenames.append(_user_prefs_filename())
+ #print "filenames: ", filenames
+ self.cp.read(filenames)
+
+ # ----------------------------------------------------------------
+ # These methods override the C++ virtual methods of the same name
+ # ----------------------------------------------------------------
+ def has_section(self, section):
+ return self.cp.has_section(section)
+
+ def has_option(self, section, option):
+ return self.cp.has_option(section, option)
+
+ def get_string(self, section, option, default_val):
+ try:
+ return self.cp.get(section, option)
+ except:
+ return default_val
+
+ def get_bool(self, section, option, default_val):
+ try:
+ return self.cp.getboolean(section, option)
+ except:
+ return default_val
+
+ def get_long(self, section, option, default_val):
+ try:
+ return self.cp.getint(section, option)
+ except:
+ return default_val
+
+ def get_double(self, section, option, default_val):
+ try:
+ return self.cp.getfloat(section, option)
+ except:
+ return default_val
+ # ----------------------------------------------------------------
+ # End override of C++ virtual methods
+ # ----------------------------------------------------------------
+
+
+_prefs_db = _prefs()
+
+# if GR_DONT_LOAD_PREFS is set, don't load them.
+# (make check uses this to avoid interactions.)
+if os.getenv("GR_DONT_LOAD_PREFS", None) is None:
+ _prefs_db._read_files()
+
+
+_prefs_base.set_singleton(_prefs_db) # tell C++ what instance to use
+
+def prefs():
+ """
+ Return the global preference data base
+ """
+ return _prefs_db
diff --git a/gnuradio-core/src/python/gnuradio/gr/pubsub.py b/gnuradio-core/src/python/gnuradio/gr/pubsub.py
new file mode 100644
index 000000000..90568418f
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/pubsub.py
@@ -0,0 +1,153 @@
+#!/usr/bin/env python
+#
+# Copyright 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.
+#
+
+"""
+Abstract GNU Radio publisher/subscriber interface
+
+This is a proof of concept implementation, will likely change significantly.
+"""
+
+class pubsub(dict):
+ def __init__(self):
+ self._publishers = { }
+ self._subscribers = { }
+ self._proxies = { }
+
+ def __missing__(self, key, value=None):
+ dict.__setitem__(self, key, value)
+ self._publishers[key] = None
+ self._subscribers[key] = []
+ self._proxies[key] = None
+
+ def __setitem__(self, key, val):
+ if not self.has_key(key):
+ self.__missing__(key, val)
+ elif self._proxies[key] is not None:
+ (p, newkey) = self._proxies[key]
+ p[newkey] = val
+ else:
+ dict.__setitem__(self, key, val)
+ for sub in self._subscribers[key]:
+ # Note this means subscribers will get called in the thread
+ # context of the 'set' caller.
+ sub(val)
+
+ def __getitem__(self, key):
+ if not self.has_key(key): self.__missing__(key)
+ if self._proxies[key] is not None:
+ (p, newkey) = self._proxies[key]
+ return p[newkey]
+ elif self._publishers[key] is not None:
+ return self._publishers[key]()
+ else:
+ return dict.__getitem__(self, key)
+
+ def publish(self, key, publisher):
+ if not self.has_key(key): self.__missing__(key)
+ if self._proxies[key] is not None:
+ (p, newkey) = self._proxies[key]
+ p.publish(newkey, publisher)
+ else:
+ self._publishers[key] = publisher
+
+ def subscribe(self, key, subscriber):
+ if not self.has_key(key): self.__missing__(key)
+ if self._proxies[key] is not None:
+ (p, newkey) = self._proxies[key]
+ p.subscribe(newkey, subscriber)
+ else:
+ self._subscribers[key].append(subscriber)
+
+ def unpublish(self, key):
+ if self._proxies[key] is not None:
+ (p, newkey) = self._proxies[key]
+ p.unpublish(newkey)
+ else:
+ self._publishers[key] = None
+
+ def unsubscribe(self, key, subscriber):
+ if self._proxies[key] is not None:
+ (p, newkey) = self._proxies[key]
+ p.unsubscribe(newkey, subscriber)
+ else:
+ self._subscribers[key].remove(subscriber)
+
+ def proxy(self, key, p, newkey=None):
+ if not self.has_key(key): self.__missing__(key)
+ if newkey is None: newkey = key
+ self._proxies[key] = (p, newkey)
+
+ def unproxy(self, key):
+ self._proxies[key] = None
+
+# Test code
+if __name__ == "__main__":
+ import sys
+ o = pubsub()
+
+ # Non-existent key gets auto-created with None value
+ print "Auto-created key 'foo' value:", o['foo']
+
+ # Add some subscribers
+ # First is a bare function
+ def print_len(x):
+ print "len=%i" % (len(x), )
+ o.subscribe('foo', print_len)
+
+ # The second is a class member function
+ class subber(object):
+ def __init__(self, param):
+ self._param = param
+ def printer(self, x):
+ print self._param, `x`
+ s = subber('param')
+ o.subscribe('foo', s.printer)
+
+ # The third is a lambda function
+ o.subscribe('foo', lambda x: sys.stdout.write('val='+`x`+'\n'))
+
+ # Update key 'foo', will notify subscribers
+ print "Updating 'foo' with three subscribers:"
+ o['foo'] = 'bar';
+
+ # Remove first subscriber
+ o.unsubscribe('foo', print_len)
+
+ # Update now will only trigger second and third subscriber
+ print "Updating 'foo' after removing a subscriber:"
+ o['foo'] = 'bar2';
+
+ # Publish a key as a function, in this case, a lambda function
+ o.publish('baz', lambda : 42)
+ print "Published value of 'baz':", o['baz']
+
+ # Unpublish the key
+ o.unpublish('baz')
+
+ # This will return None, as there is no publisher
+ print "Value of 'baz' with no publisher:", o['baz']
+
+ # Set 'baz' key, it gets cached
+ o['baz'] = 'bazzz'
+
+ # Now will return cached value, since no provider
+ print "Cached value of 'baz' after being set:", o['baz']
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_add_and_friends.py b/gnuradio-core/src/python/gnuradio/gr/qa_add_and_friends.py
new file mode 100755
index 000000000..7ccbbe8ad
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_add_and_friends.py
@@ -0,0 +1,163 @@
+#!/usr/bin/env python
+#
+# Copyright 2004,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.
+#
+
+from gnuradio import gr, gr_unittest
+
+class test_add_and_friends (gr_unittest.TestCase):
+
+ def setUp (self):
+ self.tb = gr.top_block ()
+
+ def tearDown (self):
+ self.tb = None
+
+ def help_ii (self, src_data, exp_data, op):
+ for s in zip (range (len (src_data)), src_data):
+ src = gr.vector_source_i (s[1])
+ self.tb.connect (src, (op, s[0]))
+ dst = gr.vector_sink_i ()
+ self.tb.connect (op, dst)
+ self.tb.run ()
+ result_data = dst.data ()
+ self.assertEqual (exp_data, result_data)
+
+ def help_ff (self, src_data, exp_data, op):
+ for s in zip (range (len (src_data)), src_data):
+ src = gr.vector_source_f (s[1])
+ self.tb.connect (src, (op, s[0]))
+ dst = gr.vector_sink_f ()
+ self.tb.connect (op, dst)
+ self.tb.run ()
+ result_data = dst.data ()
+ self.assertEqual (exp_data, result_data)
+
+ def help_cc (self, src_data, exp_data, op):
+ for s in zip (range (len (src_data)), src_data):
+ src = gr.vector_source_c (s[1])
+ self.tb.connect (src, (op, s[0]))
+ dst = gr.vector_sink_c ()
+ self.tb.connect (op, dst)
+ self.tb.run ()
+ result_data = dst.data ()
+ self.assertEqual (exp_data, result_data)
+
+ def test_add_const_ii (self):
+ src_data = (1, 2, 3, 4, 5)
+ expected_result = (6, 7, 8, 9, 10)
+ op = gr.add_const_ii (5)
+ self.help_ii ((src_data,), expected_result, op)
+
+ def test_add_const_cc (self):
+ src_data = (1, 2, 3, 4, 5)
+ expected_result = (1+5j, 2+5j, 3+5j, 4+5j, 5+5j)
+ op = gr.add_const_cc (5j)
+ self.help_cc ((src_data,), expected_result, op)
+
+ def test_mult_const_ii (self):
+ src_data = (-1, 0, 1, 2, 3)
+ expected_result = (-5, 0, 5, 10, 15)
+ op = gr.multiply_const_ii (5)
+ self.help_ii ((src_data,), expected_result, op)
+
+ def test_mult_const_ff (self):
+ src_data = (-1, 0, 1, 2, 3)
+ expected_result = (-5, 0, 5, 10, 15)
+ op = gr.multiply_const_cc (5)
+ self.help_cc ((src_data,), expected_result, op)
+
+ def test_mult_const_cc (self):
+ src_data = (-1-1j, 0+0j, 1+1j, 2+2j, 3+3j)
+ expected_result = (-5-5j, 0+0j, 5+5j, 10+10j, 15+15j)
+ op = gr.multiply_const_cc (5)
+ self.help_cc ((src_data,), expected_result, op)
+
+ def test_mult_const_cc2 (self):
+ src_data = (-1-1j, 0+0j, 1+1j, 2+2j, 3+3j)
+ expected_result = (-3-7j, 0+0j, 3+7j, 6+14j, 9+21j)
+ op = gr.multiply_const_cc (5+2j)
+ self.help_cc ((src_data,), expected_result, op)
+
+ def test_add_ii (self):
+ src1_data = (1, 2, 3, 4, 5)
+ src2_data = (8, -3, 4, 8, 2)
+ expected_result = (9, -1, 7, 12, 7)
+ op = gr.add_ii ()
+ self.help_ii ((src1_data, src2_data),
+ expected_result, op)
+
+ def test_mult_ii (self):
+ src1_data = (1, 2, 3, 4, 5)
+ src2_data = (8, -3, 4, 8, 2)
+ expected_result = (8, -6, 12, 32, 10)
+ op = gr.multiply_ii ()
+ self.help_ii ((src1_data, src2_data),
+ expected_result, op)
+
+ def test_mult_ff (self):
+ src1_data = (1, 2, 3, 4, 5)
+ src2_data = (8, -3, 4, 8, 2)
+ expected_result = (8, -6, 12, 32, 10)
+ op = gr.multiply_ff ()
+ self.help_ff ((src1_data, src2_data),
+ expected_result, op)
+
+ def test_mult_cc (self):
+ src1_data = (1+1j, 2+2j, 3+3j, 4+4j, 5+5j)
+ src2_data = (8, -3, 4, 8, 2)
+ expected_result = (8+8j, -6-6j, 12+12j, 32+32j, 10+10j)
+ op = gr.multiply_cc ()
+ self.help_cc ((src1_data, src2_data),
+ expected_result, op)
+
+ def test_sub_ii_1 (self):
+ src1_data = (1, 2, 3, 4, 5)
+ expected_result = (-1, -2, -3, -4, -5)
+ op = gr.sub_ii ()
+ self.help_ii ((src1_data,),
+ expected_result, op)
+
+ def test_sub_ii_2 (self):
+ src1_data = (1, 2, 3, 4, 5)
+ src2_data = (8, -3, 4, 8, 2)
+ expected_result = (-7, 5, -1, -4, 3)
+ op = gr.sub_ii ()
+ self.help_ii ((src1_data, src2_data),
+ expected_result, op)
+
+ def test_div_ff_1 (self):
+ src1_data = (1, 2, 4, -8)
+ expected_result = (1, 0.5, 0.25, -.125)
+ op = gr.divide_ff ()
+ self.help_ff ((src1_data,),
+ expected_result, op)
+
+ def test_div_ff_2 (self):
+ src1_data = ( 5, 9, -15, 1024)
+ src2_data = (10, 3, -5, 64)
+ expected_result = (0.5, 3, 3, 16)
+ op = gr.divide_ff ()
+ self.help_ff ((src1_data, src2_data),
+ expected_result, op)
+
+
+if __name__ == '__main__':
+ gr_unittest.run(test_add_and_friends, "test_add_and_friends.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_add_v_and_friends.py b/gnuradio-core/src/python/gnuradio/gr/qa_add_v_and_friends.py
new file mode 100755
index 000000000..c8df47b39
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_add_v_and_friends.py
@@ -0,0 +1,353 @@
+#!/usr/bin/env python
+#
+# Copyright 2004,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.
+#
+
+from gnuradio import gr, gr_unittest
+
+class test_add_v_and_friends(gr_unittest.TestCase):
+
+ def setUp(self):
+ self.tb = gr.top_block()
+
+ def tearDown(self):
+ self.tb = None
+
+ def help_ss(self, size, src_data, exp_data, op):
+ for s in zip(range (len (src_data)), src_data):
+ src = gr.vector_source_s(s[1])
+ srcv = gr.stream_to_vector(gr.sizeof_short, size)
+ self.tb.connect(src, srcv)
+ self.tb.connect(srcv, (op, s[0]))
+ rhs = gr.vector_to_stream(gr.sizeof_short, size)
+ dst = gr.vector_sink_s()
+ self.tb.connect(op, rhs, dst)
+ self.tb.run()
+ result_data = dst.data()
+ self.assertEqual(exp_data, result_data)
+
+ def help_ii(self, size, src_data, exp_data, op):
+ for s in zip(range (len (src_data)), src_data):
+ src = gr.vector_source_i(s[1])
+ srcv = gr.stream_to_vector(gr.sizeof_int, size)
+ self.tb.connect(src, srcv)
+ self.tb.connect(srcv, (op, s[0]))
+ rhs = gr.vector_to_stream(gr.sizeof_int, size)
+ dst = gr.vector_sink_i()
+ self.tb.connect(op, rhs, dst)
+ self.tb.run()
+ result_data = dst.data()
+ self.assertEqual(exp_data, result_data)
+
+ def help_ff(self, size, src_data, exp_data, op):
+ for s in zip(range (len (src_data)), src_data):
+ src = gr.vector_source_f(s[1])
+ srcv = gr.stream_to_vector(gr.sizeof_float, size)
+ self.tb.connect(src, srcv)
+ self.tb.connect(srcv, (op, s[0]))
+ rhs = gr.vector_to_stream(gr.sizeof_float, size)
+ dst = gr.vector_sink_f()
+ self.tb.connect(op, rhs, dst)
+ self.tb.run()
+ result_data = dst.data()
+ self.assertEqual(exp_data, result_data)
+
+ def help_cc(self, size, src_data, exp_data, op):
+ for s in zip(range (len (src_data)), src_data):
+ src = gr.vector_source_c(s[1])
+ srcv = gr.stream_to_vector(gr.sizeof_gr_complex, size)
+ self.tb.connect(src, srcv)
+ self.tb.connect(srcv, (op, s[0]))
+ rhs = gr.vector_to_stream(gr.sizeof_gr_complex, size)
+ dst = gr.vector_sink_c()
+ self.tb.connect(op, rhs, dst)
+ self.tb.run()
+ result_data = dst.data()
+ self.assertEqual(exp_data, result_data)
+
+ def help_const_ss(self, src_data, exp_data, op):
+ src = gr.vector_source_s(src_data)
+ srcv = gr.stream_to_vector(gr.sizeof_short, len(src_data))
+ rhs = gr.vector_to_stream(gr.sizeof_short, len(src_data))
+ dst = gr.vector_sink_s()
+ self.tb.connect(src, srcv, op, rhs, dst)
+ self.tb.run()
+ result_data = dst.data()
+ self.assertEqual(exp_data, result_data)
+
+ def help_const_ii(self, src_data, exp_data, op):
+ src = gr.vector_source_i(src_data)
+ srcv = gr.stream_to_vector(gr.sizeof_int, len(src_data))
+ rhs = gr.vector_to_stream(gr.sizeof_int, len(src_data))
+ dst = gr.vector_sink_i()
+ self.tb.connect(src, srcv, op, rhs, dst)
+ self.tb.run()
+ result_data = dst.data()
+ self.assertEqual(exp_data, result_data)
+
+ def help_const_ff(self, src_data, exp_data, op):
+ src = gr.vector_source_f(src_data)
+ srcv = gr.stream_to_vector(gr.sizeof_float, len(src_data))
+ rhs = gr.vector_to_stream(gr.sizeof_float, len(src_data))
+ dst = gr.vector_sink_f()
+ self.tb.connect(src, srcv, op, rhs, dst)
+ self.tb.run()
+ result_data = dst.data()
+ self.assertEqual(exp_data, result_data)
+
+ def help_const_cc(self, src_data, exp_data, op):
+ src = gr.vector_source_c(src_data)
+ srcv = gr.stream_to_vector(gr.sizeof_gr_complex, len(src_data))
+ rhs = gr.vector_to_stream(gr.sizeof_gr_complex, len(src_data))
+ dst = gr.vector_sink_c()
+ self.tb.connect(src, srcv, op, rhs, dst)
+ self.tb.run()
+ result_data = dst.data()
+ self.assertEqual(exp_data, result_data)
+
+
+ def test_add_vss_one(self):
+ src1_data = (1,)
+ src2_data = (2,)
+ src3_data = (3,)
+ expected_result = (6,)
+ op = gr.add_vss(1)
+ self.help_ss(1, (src1_data, src2_data, src3_data), expected_result, op)
+
+ def test_add_vss_five(self):
+ src1_data = (1, 2, 3, 4, 5)
+ src2_data = (6, 7, 8, 9, 10)
+ src3_data = (11, 12, 13, 14, 15)
+ expected_result = (18, 21, 24, 27, 30)
+ op = gr.add_vss(5)
+ self.help_ss(5, (src1_data, src2_data, src3_data), expected_result, op)
+
+ def test_add_vii_one(self):
+ src1_data = (1,)
+ src2_data = (2,)
+ src3_data = (3,)
+ expected_result = (6,)
+ op = gr.add_vii(1)
+ self.help_ii(1, (src1_data, src2_data, src3_data), expected_result, op)
+
+ def test_add_vii_five(self):
+ src1_data = (1, 2, 3, 4, 5)
+ src2_data = (6, 7, 8, 9, 10)
+ src3_data = (11, 12, 13, 14, 15)
+ expected_result = (18, 21, 24, 27, 30)
+ op = gr.add_vii(5)
+ self.help_ii(5, (src1_data, src2_data, src3_data), expected_result, op)
+
+ def test_add_vff_one(self):
+ src1_data = (1.0,)
+ src2_data = (2.0,)
+ src3_data = (3.0,)
+ expected_result = (6.0,)
+ op = gr.add_vff(1)
+ self.help_ff(1, (src1_data, src2_data, src3_data), expected_result, op)
+
+ def test_add_vff_five(self):
+ src1_data = (1.0, 2.0, 3.0, 4.0, 5.0)
+ src2_data = (6.0, 7.0, 8.0, 9.0, 10.0)
+ src3_data = (11.0, 12.0, 13.0, 14.0, 15.0)
+ expected_result = (18.0, 21.0, 24.0, 27.0, 30.0)
+ op = gr.add_vff(5)
+ self.help_ff(5, (src1_data, src2_data, src3_data), expected_result, op)
+
+ def test_add_vcc_one(self):
+ src1_data = (1.0+2.0j,)
+ src2_data = (3.0+4.0j,)
+ src3_data = (5.0+6.0j,)
+ expected_result = (9.0+12j,)
+ op = gr.add_vcc(1)
+ self.help_cc(1, (src1_data, src2_data, src3_data), expected_result, op)
+
+ def test_add_vcc_five(self):
+ src1_data = (1.0+2.0j, 3.0+4.0j, 5.0+6.0j, 7.0+8.0j, 9.0+10.0j)
+ src2_data = (11.0+12.0j, 13.0+14.0j, 15.0+16.0j, 17.0+18.0j, 19.0+20.0j)
+ src3_data = (21.0+22.0j, 23.0+24.0j, 25.0+26.0j, 27.0+28.0j, 29.0+30.0j)
+ expected_result = (33.0+36.0j, 39.0+42.0j, 45.0+48.0j, 51.0+54.0j, 57.0+60.0j)
+ op = gr.add_vcc(5)
+ self.help_cc(5, (src1_data, src2_data, src3_data), expected_result, op)
+
+ def test_add_const_vss_one(self):
+ src_data = (1,)
+ op = gr.add_const_vss((2,))
+ exp_data = (3,)
+ self.help_const_ss(src_data, exp_data, op)
+
+ def test_add_const_vss_five(self):
+ src_data = (1, 2, 3, 4, 5)
+ op = gr.add_const_vss((6, 7, 8, 9, 10))
+ exp_data = (7, 9, 11, 13, 15)
+ self.help_const_ss(src_data, exp_data, op)
+
+ def test_add_const_vii_one(self):
+ src_data = (1,)
+ op = gr.add_const_vii((2,))
+ exp_data = (3,)
+ self.help_const_ii(src_data, exp_data, op)
+
+ def test_add_const_vii_five(self):
+ src_data = (1, 2, 3, 4, 5)
+ op = gr.add_const_vii((6, 7, 8, 9, 10))
+ exp_data = (7, 9, 11, 13, 15)
+ self.help_const_ii(src_data, exp_data, op)
+
+ def test_add_const_vff_one(self):
+ src_data = (1.0,)
+ op = gr.add_const_vff((2.0,))
+ exp_data = (3.0,)
+ self.help_const_ff(src_data, exp_data, op)
+
+ def test_add_const_vff_five(self):
+ src_data = (1.0, 2.0, 3.0, 4.0, 5.0)
+ op = gr.add_const_vff((6.0, 7.0, 8.0, 9.0, 10.0))
+ exp_data = (7.0, 9.0, 11.0, 13.0, 15.0)
+ self.help_const_ff(src_data, exp_data, op)
+
+ def test_add_const_vcc_one(self):
+ src_data = (1.0+2.0j,)
+ op = gr.add_const_vcc((2.0+3.0j,))
+ exp_data = (3.0+5.0j,)
+ self.help_const_cc(src_data, exp_data, op)
+
+ def test_add_const_vcc_five(self):
+ src_data = (1.0+2.0j, 3.0+4.0j, 5.0+6.0j, 7.0+8.0j, 9.0+10.0j)
+ op = gr.add_const_vcc((11.0+12.0j, 13.0+14.0j, 15.0+16.0j, 17.0+18.0j, 19.0+20.0j))
+ exp_data = (12.0+14.0j, 16.0+18.0j, 20.0+22.0j, 24.0+26.0j, 28.0+30.0j)
+ self.help_const_cc(src_data, exp_data, op)
+
+
+ def test_multiply_vss_one(self):
+ src1_data = (1,)
+ src2_data = (2,)
+ src3_data = (3,)
+ expected_result = (6,)
+ op = gr.multiply_vss(1)
+ self.help_ss(1, (src1_data, src2_data, src3_data), expected_result, op)
+
+ def test_multiply_vss_five(self):
+ src1_data = (1, 2, 3, 4, 5)
+ src2_data = (6, 7, 8, 9, 10)
+ src3_data = (11, 12, 13, 14, 15)
+ expected_result = (66, 168, 312, 504, 750)
+ op = gr.multiply_vss(5)
+ self.help_ss(5, (src1_data, src2_data, src3_data), expected_result, op)
+
+ def test_multiply_vii_one(self):
+ src1_data = (1,)
+ src2_data = (2,)
+ src3_data = (3,)
+ expected_result = (6,)
+ op = gr.multiply_vii(1)
+ self.help_ii(1, (src1_data, src2_data, src3_data), expected_result, op)
+
+ def test_multiply_vii_five(self):
+ src1_data = (1, 2, 3, 4, 5)
+ src2_data = (6, 7, 8, 9, 10)
+ src3_data = (11, 12, 13, 14, 15)
+ expected_result = (66, 168, 312, 504, 750)
+ op = gr.multiply_vii(5)
+ self.help_ii(5, (src1_data, src2_data, src3_data), expected_result, op)
+
+ def test_multiply_vff_one(self):
+ src1_data = (1.0,)
+ src2_data = (2.0,)
+ src3_data = (3.0,)
+ expected_result = (6.0,)
+ op = gr.multiply_vff(1)
+ self.help_ff(1, (src1_data, src2_data, src3_data), expected_result, op)
+
+ def test_multiply_vff_five(self):
+ src1_data = (1.0, 2.0, 3.0, 4.0, 5.0)
+ src2_data = (6.0, 7.0, 8.0, 9.0, 10.0)
+ src3_data = (11.0, 12.0, 13.0, 14.0, 15.0)
+ expected_result = (66.0, 168.0, 312.0, 504.0, 750.0)
+ op = gr.multiply_vff(5)
+ self.help_ff(5, (src1_data, src2_data, src3_data), expected_result, op)
+
+ def test_multiply_vcc_one(self):
+ src1_data = (1.0+2.0j,)
+ src2_data = (3.0+4.0j,)
+ src3_data = (5.0+6.0j,)
+ expected_result = (-85+20j,)
+ op = gr.multiply_vcc(1)
+ self.help_cc(1, (src1_data, src2_data, src3_data), expected_result, op)
+
+ def test_multiply_vcc_five(self):
+ src1_data = (1.0+2.0j, 3.0+4.0j, 5.0+6.0j, 7.0+8.0j, 9.0+10.0j)
+ src2_data = (11.0+12.0j, 13.0+14.0j, 15.0+16.0j, 17.0+18.0j, 19.0+20.0j)
+ src3_data = (21.0+22.0j, 23.0+24.0j, 25.0+26.0j, 27.0+28.0j, 29.0+30.0j)
+ expected_result = (-1021.0+428.0j, -2647.0+1754.0j, -4945.0+3704.0j, -8011.0+6374.0j, -11941.0+9860.0j)
+ op = gr.multiply_vcc(5)
+ self.help_cc(5, (src1_data, src2_data, src3_data), expected_result, op)
+
+ def test_multiply_const_vss_one(self):
+ src_data = (2,)
+ op = gr.multiply_const_vss((3,))
+ exp_data = (6,)
+ self.help_const_ss(src_data, exp_data, op)
+
+ def test_multiply_const_vss_five(self):
+ src_data = (1, 2, 3, 4, 5)
+ op = gr.multiply_const_vss((6, 7, 8, 9, 10))
+ exp_data = (6, 14, 24, 36, 50)
+ self.help_const_ss(src_data, exp_data, op)
+
+ def test_multiply_const_vii_one(self):
+ src_data = (2,)
+ op = gr.multiply_const_vii((3,))
+ exp_data = (6,)
+ self.help_const_ii(src_data, exp_data, op)
+
+ def test_multiply_const_vii_five(self):
+ src_data = (1, 2, 3, 4, 5)
+ op = gr.multiply_const_vii((6, 7, 8, 9, 10))
+ exp_data = (6, 14, 24, 36, 50)
+ self.help_const_ii(src_data, exp_data, op)
+
+ def test_multiply_const_vff_one(self):
+ src_data = (2.0,)
+ op = gr.multiply_const_vff((3.0,))
+ exp_data = (6.0,)
+ self.help_const_ff(src_data, exp_data, op)
+
+ def test_multiply_const_vff_five(self):
+ src_data = (1.0, 2.0, 3.0, 4.0, 5.0)
+ op = gr.multiply_const_vff((6.0, 7.0, 8.0, 9.0, 10.0))
+ exp_data = (6.0, 14.0, 24.0, 36.0, 50.0)
+ self.help_const_ff(src_data, exp_data, op)
+
+ def test_multiply_const_vcc_one(self):
+ src_data = (1.0+2.0j,)
+ op = gr.multiply_const_vcc((2.0+3.0j,))
+ exp_data = (-4.0+7.0j,)
+ self.help_const_cc(src_data, exp_data, op)
+
+ def test_multiply_const_vcc_five(self):
+ src_data = (1.0+2.0j, 3.0+4.0j, 5.0+6.0j, 7.0+8.0j, 9.0+10.0j)
+ op = gr.multiply_const_vcc((11.0+12.0j, 13.0+14.0j, 15.0+16.0j, 17.0+18.0j, 19.0+20.0j))
+ exp_data = (-13.0+34.0j, -17.0+94.0j, -21.0+170.0j, -25.0+262.0j, -29.0+370.0j)
+ self.help_const_cc(src_data, exp_data, op)
+
+
+if __name__ == '__main__':
+ gr_unittest.run(test_add_v_and_friends, "test_add_v_and_friends.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_affinity.py b/gnuradio-core/src/python/gnuradio/gr/qa_affinity.py
new file mode 100644
index 000000000..7b3ca6ed6
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_affinity.py
@@ -0,0 +1,49 @@
+#!/usr/bin/env python
+#
+# Copyright 2013 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 gnuradio import gr, gr_unittest
+
+class test_affinity(gr_unittest.TestCase):
+
+ def setUp(self):
+ self.tb = gr.top_block()
+
+ def tearDown(self):
+ self.tb = None
+
+ def test_000(self):
+ # Just run some data through and make sure it doesn't puke.
+ src_data = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
+
+ src = gr.vector_source_f(src_data)
+ snk = gr.vector_sink_f()
+
+ src.set_processor_affinity([0,])
+ self.tb.connect(src, snk)
+ self.tb.run()
+
+ a = src.processor_affinity()
+
+ self.assertEqual((0,), a)
+
+if __name__ == '__main__':
+ gr_unittest.run(test_affinity, "test_affinity.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_agc.py b/gnuradio-core/src/python/gnuradio/gr/qa_agc.py
new file mode 100755
index 000000000..9fd633576
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_agc.py
@@ -0,0 +1,433 @@
+#!/usr/bin/env python
+#
+# Copyright 2004,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.
+#
+
+from gnuradio import gr, gr_unittest
+import math
+
+test_output = False
+
+class test_agc (gr_unittest.TestCase):
+
+ def setUp (self):
+ self.tb = gr.top_block ()
+
+ def tearDown (self):
+ self.tb = None
+
+
+ def test_001(self):
+ ''' Test the complex AGC loop (single rate input) '''
+ tb = self.tb
+
+ expected_result = (
+ (100.000244140625+7.2191943445432116e-07j),
+ (72.892257690429688+52.959323883056641j),
+ (25.089065551757812+77.216217041015625j),
+ (-22.611061096191406+69.589706420898438j),
+ (-53.357715606689453+38.766635894775391j),
+ (-59.458671569824219+3.4792964243024471e-07j),
+ (-43.373462677001953-31.512666702270508j),
+ (-14.94139289855957-45.984889984130859j),
+ (13.478158950805664-41.48150634765625j),
+ (31.838506698608398-23.132022857666016j),
+ (35.519271850585938-3.1176801940091536e-07j),
+ (25.942903518676758+18.848621368408203j),
+ (8.9492912292480469+27.5430908203125j),
+ (-8.0852642059326172+24.883890151977539j),
+ (-19.131628036499023+13.899936676025391j),
+ (-21.383295059204102+3.1281737733479531e-07j),
+ (-15.650330543518066-11.370632171630859j),
+ (-5.4110145568847656-16.65339469909668j),
+ (4.9008159637451172-15.083160400390625j),
+ (11.628337860107422-8.4484796524047852j),
+ (13.036135673522949-2.288476110834381e-07j),
+ (9.5726661682128906+6.954948902130127j),
+ (3.3216962814331055+10.223132133483887j),
+ (-3.0204284191131592+9.2959251403808594j),
+ (-7.1977195739746094+5.2294478416442871j),
+ (-8.1072216033935547+1.8976157889483147e-07j),
+ (-5.9838657379150391-4.3475332260131836j),
+ (-2.0879747867584229-6.4261269569396973j),
+ (1.9100792407989502-5.8786196708679199j),
+ (4.5814824104309082-3.3286411762237549j),
+ (5.1967458724975586-1.3684227440080576e-07j),
+ (3.8647139072418213+2.8078789710998535j),
+ (1.3594740629196167+4.1840314865112305j),
+ (-1.2544282674789429+3.8607344627380371j),
+ (-3.0366206169128418+2.2062335014343262j),
+ (-3.4781389236450195+1.1194014604143376e-07j),
+ (-2.6133756637573242-1.8987287282943726j),
+ (-0.9293016791343689-2.8600969314575195j),
+ (0.86727333068847656-2.6691930294036865j),
+ (2.1243946552276611-1.5434627532958984j),
+ (2.4633183479309082-8.6486437567145913e-08j),
+ (1.8744727373123169+1.3618841171264648j),
+ (0.67528903484344482+2.0783262252807617j),
+ (-0.63866174221038818+1.965599536895752j),
+ (-1.5857341289520264+1.152103066444397j),
+ (-1.8640764951705933+7.6355092915036948e-08j),
+ (-1.4381576776504517-1.0448826551437378j),
+ (-0.52529704570770264-1.6166983842849731j),
+ (0.50366902351379395-1.5501341819763184j),
+ (1.26766037940979-0.92100900411605835j))
+
+ sampling_freq = 100
+ src1 = gr.sig_source_c (sampling_freq, gr.GR_SIN_WAVE,
+ sampling_freq * 0.10, 100.0)
+ dst1 = gr.vector_sink_c ()
+ head = gr.head (gr.sizeof_gr_complex, int (5*sampling_freq * 0.10))
+
+ agc = gr.agc_cc(1e-3, 1, 1, 1000)
+
+ tb.connect (src1, head)
+ tb.connect (head, agc)
+ tb.connect (agc, dst1)
+
+ if test_output == True:
+ tb.connect (agc, gr.file_sink(gr.sizeof_gr_complex, "test_agc_cc.dat"))
+
+ tb.run ()
+ dst_data = dst1.data ()
+ self.assertComplexTuplesAlmostEqual (expected_result, dst_data, 4)
+
+ def test_002(self):
+ ''' Test the floating point AGC loop (single rate input) '''
+ tb = self.tb
+
+ expected_result = (
+ 7.2191943445432116e-07,
+ 58.837181091308594,
+ 89.700050354003906,
+ 81.264183044433594,
+ 45.506141662597656,
+ 4.269894304798072e-07,
+ -42.948936462402344,
+ -65.50335693359375,
+ -59.368724822998047,
+ -33.261005401611328,
+ -4.683740257860336e-07,
+ 31.423542022705078,
+ 47.950984954833984,
+ 43.485683441162109,
+ 24.378345489501953,
+ 5.7254135299444897e-07,
+ -23.062990188598633,
+ -35.218441009521484,
+ -31.964075088500977,
+ -17.934831619262695,
+ -5.0591745548445033e-07,
+ 16.998210906982422,
+ 25.982204437255859,
+ 23.606258392333984,
+ 13.260685920715332,
+ 4.9936483037527069e-07,
+ -12.59880542755127,
+ -19.28221321105957,
+ -17.54347038269043,
+ -9.8700437545776367,
+ -4.188150626305287e-07,
+ 9.4074573516845703,
+ 14.422011375427246,
+ 13.145503044128418,
+ 7.41046142578125,
+ 3.8512698097292741e-07,
+ -7.0924453735351562,
+ -10.896408081054688,
+ -9.9552040100097656,
+ -5.6262712478637695,
+ -3.1982864356905338e-07,
+ 5.4131259918212891,
+ 8.3389215469360352,
+ 7.6409502029418945,
+ 4.3320145606994629,
+ 2.882407841298118e-07,
+ -4.194943904876709,
+ -6.4837145805358887,
+ -5.9621825218200684,
+ -3.3931560516357422)
+
+ sampling_freq = 100
+ src1 = gr.sig_source_f (sampling_freq, gr.GR_SIN_WAVE,
+ sampling_freq * 0.10, 100.0)
+ dst1 = gr.vector_sink_f ()
+ head = gr.head (gr.sizeof_float, int (5*sampling_freq * 0.10))
+
+ agc = gr.agc_ff(1e-3, 1, 1, 1000)
+
+ tb.connect (src1, head)
+ tb.connect (head, agc)
+ tb.connect (agc, dst1)
+
+ if test_output == True:
+ tb.connect (agc, gr.file_sink(gr.sizeof_float, "test_agc_ff.dat"))
+
+ tb.run ()
+ dst_data = dst1.data ()
+ self.assertFloatTuplesAlmostEqual (expected_result, dst_data, 4)
+
+ def test_003(self):
+ ''' Test the complex AGC loop (attack and decay rate inputs) '''
+ tb = self.tb
+
+ expected_result = \
+ ((100.000244140625+7.2191943445432116e-07j),
+ (0.80881959199905396+0.58764183521270752j),
+ (0.30894950032234192+0.95084899663925171j),
+ (-0.30895623564720154+0.95086973905563354j),
+ (-0.80887287855148315+0.58768033981323242j),
+ (-0.99984413385391235+5.850709250410091e-09j),
+ (-0.80889981985092163-0.58770018815994263j),
+ (-0.30897706747055054-0.95093393325805664j),
+ (0.30898112058639526-0.95094609260559082j),
+ (0.80893135070800781-0.58772283792495728j),
+ (0.99990922212600708-8.7766354184282136e-09j),
+ (0.80894720554351807+0.58773452043533325j),
+ (0.30899339914321899+0.95098406076431274j),
+ (-0.30899572372436523+0.95099133253097534j),
+ (-0.80896598100662231+0.58774799108505249j),
+ (-0.99994778633117676+1.4628290578855285e-08j),
+ (-0.80897533893585205-0.58775502443313599j),
+ (-0.30900305509567261-0.95101380348205566j),
+ (0.30900448560714722-0.95101797580718994j),
+ (0.80898630619049072-0.58776277303695679j),
+ (0.99997037649154663-1.7554345532744264e-08j),
+ (0.80899184942245483+0.58776694536209106j),
+ (0.30900871753692627+0.95103120803833008j),
+ (-0.30900952219963074+0.95103377103805542j),
+ (-0.8089984655380249+0.58777159452438354j),
+ (-0.99998390674591064+2.3406109050938539e-08j),
+ (-0.809001624584198-0.58777409791946411j),
+ (-0.30901208519935608-0.95104163885116577j),
+ (0.30901262164115906-0.95104306936264038j),
+ (0.80900543928146362-0.587776780128479j),
+ (0.99999171495437622-2.6332081404234486e-08j),
+ (0.80900734663009644+0.58777821063995361j),
+ (0.30901408195495605+0.95104765892028809j),
+ (-0.30901429057121277+0.95104855298995972j),
+ (-0.80900967121124268+0.58777981996536255j),
+ (-0.99999648332595825+3.2183805842578295e-08j),
+ (-0.80901080369949341-0.58778077363967896j),
+ (-0.30901527404785156-0.95105135440826416j),
+ (0.30901545286178589-0.95105189085006714j),
+ (0.80901217460632324-0.58778166770935059j),
+ (0.99999916553497314-3.5109700036173308e-08j),
+ (0.809012770652771+0.58778214454650879j),
+ (0.30901595950126648+0.9510534405708313j),
+ (-0.30901598930358887+0.95105385780334473j),
+ (-0.80901366472244263+0.58778274059295654j),
+ (-1.0000008344650269+4.0961388947380328e-08j),
+ (-0.8090139627456665-0.58778303861618042j),
+ (-0.30901634693145752-0.95105475187301636j),
+ (0.30901640653610229-0.95105493068695068j),
+ (0.80901449918746948-0.5877833366394043j))
+
+ sampling_freq = 100
+ src1 = gr.sig_source_c (sampling_freq, gr.GR_SIN_WAVE,
+ sampling_freq * 0.10, 100)
+ dst1 = gr.vector_sink_c ()
+ head = gr.head (gr.sizeof_gr_complex, int (5*sampling_freq * 0.10))
+
+ agc = gr.agc2_cc(1e-2, 1e-3, 1, 1, 1000)
+
+ tb.connect (src1, head)
+ tb.connect (head, agc)
+ tb.connect (agc, dst1)
+
+ if test_output == True:
+ tb.connect (agc, gr.file_sink(gr.sizeof_gr_complex, "test_agc2_cc.dat"))
+
+ tb.run ()
+ dst_data = dst1.data ()
+ self.assertComplexTuplesAlmostEqual (expected_result, dst_data, 4)
+
+ def test_004(self):
+ ''' Test the floating point AGC loop (attack and decay rate inputs) '''
+ tb = self.tb
+
+ expected_result = \
+ (7.2191943445432116e-07,
+ 58.837181091308594,
+ 40.194305419921875,
+ 2.9183335304260254,
+ 0.67606079578399658,
+ 8.6260438791896377e-09,
+ -1.4542514085769653,
+ -1.9210131168365479,
+ -1.0450780391693115,
+ -0.61939650774002075,
+ -1.2590258613442984e-08,
+ 1.4308931827545166,
+ 1.9054338932037354,
+ 1.0443156957626343,
+ 0.61937344074249268,
+ 2.0983527804219193e-08,
+ -1.4308838844299316,
+ -1.9054274559020996,
+ -1.0443152189254761,
+ -0.61937344074249268,
+ -2.5180233009791664e-08,
+ 1.4308837652206421,
+ 1.9054274559020996,
+ 1.0443154573440552,
+ 0.61937344074249268,
+ 3.3573645197293445e-08,
+ -1.4308838844299316,
+ -1.9054274559020996,
+ -1.0443152189254761,
+ -0.61937350034713745,
+ -3.7770352179222755e-08,
+ 1.4308837652206421,
+ 1.9054274559020996,
+ 1.0443154573440552,
+ 0.61937350034713745,
+ 4.6163762590367696e-08,
+ -1.4308838844299316,
+ -1.9054274559020996,
+ -1.0443153381347656,
+ -0.61937344074249268,
+ -5.0360466019583328e-08,
+ 1.4308837652206421,
+ 1.9054274559020996,
+ 1.0443155765533447,
+ 0.61937344074249268,
+ 5.8753879983441948e-08,
+ -1.4308837652206421,
+ -1.9054274559020996,
+ -1.0443153381347656,
+ -0.61937344074249268)
+
+ sampling_freq = 100
+ src1 = gr.sig_source_f (sampling_freq, gr.GR_SIN_WAVE,
+ sampling_freq * 0.10, 100)
+ dst1 = gr.vector_sink_f ()
+ head = gr.head (gr.sizeof_float, int (5*sampling_freq * 0.10))
+
+ agc = gr.agc2_ff(1e-2, 1e-3, 1, 1, 1000)
+
+ tb.connect (src1, head)
+ tb.connect (head, agc)
+ tb.connect (agc, dst1)
+
+ if test_output == True:
+ tb.connect (agc, gr.file_sink(gr.sizeof_float, "test_agc2_ff.dat"))
+
+ tb.run ()
+ dst_data = dst1.data ()
+ self.assertFloatTuplesAlmostEqual (expected_result, dst_data, 4)
+
+
+ def test_005(self):
+ ''' Test the complex AGC loop (attack and decay rate inputs) '''
+ tb = self.tb
+
+ expected_result = \
+ ((100.000244140625+7.2191943445432116e-07j),
+ (0.80881959199905396+0.58764183521270752j),
+ (0.30894950032234192+0.95084899663925171j),
+ (-0.30895623564720154+0.95086973905563354j),
+ (-0.80887287855148315+0.58768033981323242j),
+ (-0.99984413385391235+5.850709250410091e-09j),
+ (-0.80889981985092163-0.58770018815994263j),
+ (-0.30897706747055054-0.95093393325805664j),
+ (0.30898112058639526-0.95094609260559082j),
+ (0.80893135070800781-0.58772283792495728j),
+ (0.99990922212600708-8.7766354184282136e-09j),
+ (0.80894720554351807+0.58773452043533325j),
+ (0.30899339914321899+0.95098406076431274j),
+ (-0.30899572372436523+0.95099133253097534j),
+ (-0.80896598100662231+0.58774799108505249j),
+ (-0.99994778633117676+1.4628290578855285e-08j),
+ (-0.80897533893585205-0.58775502443313599j),
+ (-0.30900305509567261-0.95101380348205566j),
+ (0.30900448560714722-0.95101797580718994j),
+ (0.80898630619049072-0.58776277303695679j),
+ (0.99997037649154663-1.7554345532744264e-08j),
+ (0.80899184942245483+0.58776694536209106j),
+ (0.30900871753692627+0.95103120803833008j),
+ (-0.30900952219963074+0.95103377103805542j),
+ (-0.8089984655380249+0.58777159452438354j),
+ (-0.99998390674591064+2.3406109050938539e-08j),
+ (-0.809001624584198-0.58777409791946411j),
+ (-0.30901208519935608-0.95104163885116577j),
+ (0.30901262164115906-0.95104306936264038j),
+ (0.80900543928146362-0.587776780128479j),
+ (0.99999171495437622-2.6332081404234486e-08j),
+ (0.80900734663009644+0.58777821063995361j),
+ (0.30901408195495605+0.95104765892028809j),
+ (-0.30901429057121277+0.95104855298995972j),
+ (-0.80900967121124268+0.58777981996536255j),
+ (-0.99999648332595825+3.2183805842578295e-08j),
+ (-0.80901080369949341-0.58778077363967896j),
+ (-0.30901527404785156-0.95105135440826416j),
+ (0.30901545286178589-0.95105189085006714j),
+ (0.80901217460632324-0.58778166770935059j),
+ (0.99999916553497314-3.5109700036173308e-08j),
+ (0.809012770652771+0.58778214454650879j),
+ (0.30901595950126648+0.9510534405708313j),
+ (-0.30901598930358887+0.95105385780334473j),
+ (-0.80901366472244263+0.58778274059295654j),
+ (-1.0000008344650269+4.0961388947380328e-08j),
+ (-0.8090139627456665-0.58778303861618042j),
+ (-0.30901634693145752-0.95105475187301636j),
+ (0.30901640653610229-0.95105493068695068j),
+ (0.80901449918746948-0.5877833366394043j))
+
+ sampling_freq = 100
+ src1 = gr.sig_source_c (sampling_freq, gr.GR_SIN_WAVE,
+ sampling_freq * 0.10, 100)
+ dst1 = gr.vector_sink_c ()
+ head = gr.head (gr.sizeof_gr_complex, int (5*sampling_freq * 0.10))
+
+ agc = gr.agc2_cc(1e-2, 1e-3, 1, 1, 1000)
+
+ tb.connect (src1, head)
+ tb.connect (head, agc)
+ tb.connect (agc, dst1)
+
+ if test_output == True:
+ tb.connect (agc, gr.file_sink(gr.sizeof_gr_complex, "test_agc2_cc.dat"))
+
+ tb.run ()
+ dst_data = dst1.data ()
+ self.assertComplexTuplesAlmostEqual (expected_result, dst_data, 4)
+
+
+ def test_100(self): # FIXME needs work
+ ''' Test complex feedforward agc with constant input '''
+ input_data = 16*(0.0,) + 64*(1.0,) + 64*(0.0,)
+ expected_result = ()
+
+ src = gr.vector_source_c(input_data)
+ agc = gr.feedforward_agc_cc(16, 2.0)
+ dst = gr.vector_sink_c ()
+ self.tb.connect (src, agc, dst)
+
+ if test_output == True:
+ self.tb.connect (agc, gr.file_sink(gr.sizeof_gr_complex, "test_feedforward_cc.dat"))
+
+ self.tb.run ()
+ dst_data = dst.data ()
+ #self.assertComplexTuplesAlmostEqual (expected_result, dst_data, 4)
+
+
+if __name__ == '__main__':
+ gr_unittest.run(test_agc, "test_agc.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_argmax.py b/gnuradio-core/src/python/gnuradio/gr/qa_argmax.py
new file mode 100644
index 000000000..564eb620b
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_argmax.py
@@ -0,0 +1,77 @@
+#!/usr/bin/env python
+#
+# 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.
+#
+
+from gnuradio import gr, gr_unittest
+import math
+
+
+class test_arg_max (gr_unittest.TestCase):
+
+ def setUp (self):
+ self.tb = gr.top_block ()
+
+
+ def tearDown (self):
+ self.tb = None
+
+
+ def test_001(self):
+ tb = self.tb
+
+ src1_data = (0,0.2,-0.3,0,12,0)
+ src2_data = (0,0.0,3.0,0,10,0)
+ src3_data = (0,0.0,3.0,0,1,0)
+
+ src1 = gr.vector_source_f (src1_data)
+ s2v1 = gr.stream_to_vector(gr.sizeof_float, len(src1_data))
+ tb.connect( src1, s2v1 )
+
+ src2 = gr.vector_source_f (src2_data)
+ s2v2 = gr.stream_to_vector(gr.sizeof_float, len(src1_data))
+ tb.connect( src2, s2v2 )
+
+ src3 = gr.vector_source_f (src3_data)
+ s2v3 = gr.stream_to_vector(gr.sizeof_float, len(src1_data))
+ tb.connect( src3, s2v3 )
+
+ dst1 = gr.vector_sink_s ()
+ dst2 = gr.vector_sink_s ()
+ argmax = gr.argmax_fs (len(src1_data))
+
+ tb.connect (s2v1, (argmax, 0))
+ tb.connect (s2v2, (argmax, 1))
+ tb.connect (s2v3, (argmax, 2))
+
+ tb.connect ((argmax,0), dst1)
+ tb.connect ((argmax,1), dst2)
+
+ tb.run ()
+ index = dst1.data ()
+ source = dst2.data ()
+ self.assertEqual ( index, (4,))
+ self.assertEqual ( source, (0,))
+
+
+
+if __name__ == '__main__':
+ gr_unittest.run(test_arg_max, "test_arg_max.xml")
+
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_bin_statistics.py b/gnuradio-core/src/python/gnuradio/gr/qa_bin_statistics.py
new file mode 100755
index 000000000..8a6dd9056
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_bin_statistics.py
@@ -0,0 +1,230 @@
+#!/usr/bin/env python
+#
+# Copyright 2006,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.
+#
+
+from gnuradio import gr, gr_unittest
+import random
+import struct
+
+#import os
+#print "pid =", os.getpid()
+#raw_input("Attach gdb and press return...")
+
+"""
+Note: The QA tests below have been disabled by renaming them from test_*
+to xtest_*. See ticket:199 on http://gnuradio.org/trac/ticket/199
+"""
+
+class counter(gr.feval_dd):
+ def __init__(self, step_size=1):
+ gr.feval_dd.__init__(self)
+ self.step_size = step_size
+ self.count = 0
+
+ def eval(self, input):
+ #print "eval: self.count =", self.count
+ t = self.count
+ self.count = self.count + self.step_size
+ return t
+
+
+class counter3(gr.feval_dd):
+ def __init__(self, f, step_size):
+ gr.feval_dd.__init__(self)
+ self.f = f
+ self.step_size = step_size
+ self.count = 0
+
+ def eval(self, input):
+ try:
+ #print "eval: self.count =", self.count
+ t = self.count
+ self.count = self.count + self.step_size
+ self.f(self.count)
+ except Exception, e:
+ print "Exception: ", e
+ return t
+
+def foobar3(new_t):
+ #print "foobar3: new_t =", new_t
+ pass
+
+
+class counter4(gr.feval_dd):
+ def __init__(self, obj_instance, step_size):
+ gr.feval_dd.__init__(self)
+ self.obj_instance = obj_instance
+ self.step_size = step_size
+ self.count = 0
+
+ def eval(self, input):
+ try:
+ #print "eval: self.count =", self.count
+ t = self.count
+ self.count = self.count + self.step_size
+ self.obj_instance.foobar4(self.count)
+ except Exception, e:
+ print "Exception: ", e
+ return t
+
+
+class parse_msg(object):
+ def __init__(self, msg):
+ self.center_freq = msg.arg1()
+ self.vlen = int(msg.arg2())
+ assert(msg.length() == self.vlen * gr.sizeof_float)
+ self.data = struct.unpack('%df' % (self.vlen,), msg.to_string())
+
+# FIXME: see ticket:199
+class xtest_bin_statistics(gr_unittest.TestCase):
+
+ def setUp(self):
+ self.tb = gr.top_block ()
+
+ def tearDown(self):
+ self.tb = None
+
+ def xtest_001(self):
+ vlen = 4
+ tune = counter(1)
+ tune_delay = 0
+ dwell_delay = 1
+ msgq = gr.msg_queue()
+
+ src_data = tuple([float(x) for x in
+ ( 1, 2, 3, 4,
+ 5, 6, 7, 8,
+ 9, 10, 11, 12,
+ 13, 14, 15, 16
+ )])
+
+ expected_results = tuple([float(x) for x in
+ ( 1, 2, 3, 4,
+ 5, 6, 7, 8,
+ 9, 10, 11, 12,
+ 13, 14, 15, 16
+ )])
+
+ src = gr.vector_source_f(src_data, False)
+ s2v = gr.stream_to_vector(gr.sizeof_float, vlen)
+ stats = gr.bin_statistics_f(vlen, msgq, tune, tune_delay, dwell_delay)
+ self.tb.connect(src, s2v, stats)
+ self.tb.run()
+ self.assertEqual(4, msgq.count())
+ for i in range(4):
+ m = parse_msg(msgq.delete_head())
+ #print "m =", m.center_freq, m.data
+ self.assertEqual(expected_results[vlen*i:vlen*i + vlen], m.data)
+
+ def xtest_002(self):
+ vlen = 4
+ tune = counter(1)
+ tune_delay = 1
+ dwell_delay = 2
+ msgq = gr.msg_queue()
+
+ src_data = tuple([float(x) for x in
+ ( 1, 2, 3, 4,
+ 9, 6, 11, 8,
+ 5, 10, 7, 12,
+ 13, 14, 15, 16
+ )])
+
+ expected_results = tuple([float(x) for x in
+ ( 9, 10, 11, 12)])
+
+ src = gr.vector_source_f(src_data, False)
+ s2v = gr.stream_to_vector(gr.sizeof_float, vlen)
+ stats = gr.bin_statistics_f(vlen, msgq, tune, tune_delay, dwell_delay)
+ self.tb.connect(src, s2v, stats)
+ self.tb.run()
+ self.assertEqual(1, msgq.count())
+ for i in range(1):
+ m = parse_msg(msgq.delete_head())
+ #print "m =", m.center_freq, m.data
+ self.assertEqual(expected_results[vlen*i:vlen*i + vlen], m.data)
+
+
+
+ def xtest_003(self):
+ vlen = 4
+ tune = counter3(foobar3, 1)
+ tune_delay = 1
+ dwell_delay = 2
+ msgq = gr.msg_queue()
+
+ src_data = tuple([float(x) for x in
+ ( 1, 2, 3, 4,
+ 9, 6, 11, 8,
+ 5, 10, 7, 12,
+ 13, 14, 15, 16
+ )])
+
+ expected_results = tuple([float(x) for x in
+ ( 9, 10, 11, 12)])
+
+ src = gr.vector_source_f(src_data, False)
+ s2v = gr.stream_to_vector(gr.sizeof_float, vlen)
+ stats = gr.bin_statistics_f(vlen, msgq, tune, tune_delay, dwell_delay)
+ self.tb.connect(src, s2v, stats)
+ self.tb.run()
+ self.assertEqual(1, msgq.count())
+ for i in range(1):
+ m = parse_msg(msgq.delete_head())
+ #print "m =", m.center_freq, m.data
+ self.assertEqual(expected_results[vlen*i:vlen*i + vlen], m.data)
+
+
+ def foobar4(self, new_t):
+ #print "foobar4: new_t =", new_t
+ pass
+
+ def xtest_004(self):
+ vlen = 4
+ tune = counter4(self, 1)
+ tune_delay = 1
+ dwell_delay = 2
+ msgq = gr.msg_queue()
+
+ src_data = tuple([float(x) for x in
+ ( 1, 2, 3, 4,
+ 9, 6, 11, 8,
+ 5, 10, 7, 12,
+ 13, 14, 15, 16
+ )])
+
+ expected_results = tuple([float(x) for x in
+ ( 9, 10, 11, 12)])
+
+ src = gr.vector_source_f(src_data, False)
+ s2v = gr.stream_to_vector(gr.sizeof_float, vlen)
+ stats = gr.bin_statistics_f(vlen, msgq, tune, tune_delay, dwell_delay)
+ self.tb.connect(src, s2v, stats)
+ self.tb.run()
+ self.assertEqual(1, msgq.count())
+ for i in range(1):
+ m = parse_msg(msgq.delete_head())
+ #print "m =", m.center_freq, m.data
+ self.assertEqual(expected_results[vlen*i:vlen*i + vlen], m.data)
+
+
+if __name__ == '__main__':
+ gr_unittest.run(xtest_bin_statistics, "test_bin_statistics.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_block_gateway.py b/gnuradio-core/src/python/gnuradio/gr/qa_block_gateway.py
new file mode 100644
index 000000000..911879f6f
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_block_gateway.py
@@ -0,0 +1,235 @@
+#
+# Copyright 2011-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.
+#
+
+from gnuradio import gr, gr_unittest
+import pmt
+import numpy
+
+class add_2_f32_1_f32(gr.sync_block):
+ def __init__(self):
+ gr.sync_block.__init__(
+ self,
+ name = "add 2 f32",
+ in_sig = [numpy.float32, numpy.float32],
+ out_sig = [numpy.float32],
+ )
+
+ def work(self, input_items, output_items):
+ output_items[0][:] = input_items[0] + input_items[1]
+ return len(output_items[0])
+
+class add_2_fc32_1_fc32(gr.sync_block):
+ def __init__(self):
+ gr.sync_block.__init__(
+ self,
+ name = "add 2 fc32",
+ in_sig = [numpy.complex64, numpy.complex64],
+ out_sig = [numpy.complex64],
+ )
+
+ def work(self, input_items, output_items):
+ output_items[0][:] = input_items[0] + input_items[1]
+ return len(output_items[0])
+
+class convolve(gr.sync_block):
+ """
+ A demonstration using block history to properly perform a convolution.
+ """
+ def __init__(self):
+ gr.sync_block.__init__(
+ self,
+ name = "convolve",
+ in_sig = [numpy.float32],
+ out_sig = [numpy.float32]
+ )
+ self._taps = [1, 0, 0, 0]
+ self.set_history(len(self._taps))
+
+ def work(self, input_items, output_items):
+ output_items[0][:] = numpy.convolve(input_items[0], self._taps, mode='valid')
+ return len(output_items[0])
+
+class decim2x(gr.decim_block):
+ def __init__(self):
+ gr.decim_block.__init__(
+ self,
+ name = "decim2x",
+ in_sig = [numpy.float32],
+ out_sig = [numpy.float32],
+ decim = 2
+ )
+
+ def work(self, input_items, output_items):
+ output_items[0][:] = input_items[0][::2]
+ return len(output_items[0])
+
+class interp2x(gr.interp_block):
+ def __init__(self):
+ gr.interp_block.__init__(
+ self,
+ name = "interp2x",
+ in_sig = [numpy.float32],
+ out_sig = [numpy.float32],
+ interp = 2
+ )
+
+ def work(self, input_items, output_items):
+ output_items[0][1::2] = input_items[0]
+ output_items[0][::2] = input_items[0]
+ return len(output_items[0])
+
+class tag_source(gr.sync_block):
+ def __init__(self):
+ gr.sync_block.__init__(
+ self,
+ name = "tag source",
+ in_sig = None,
+ out_sig = [numpy.float32],
+ )
+
+ def work(self, input_items, output_items):
+ num_output_items = len(output_items[0])
+
+ #put code here to fill the output items...
+
+ #make a new tag on the middle element every time work is called
+ count = self.nitems_written(0) + num_output_items/2
+ key = pmt.pmt_string_to_symbol("example_key")
+ value = pmt.pmt_string_to_symbol("example_value")
+ self.add_item_tag(0, count, key, value)
+
+ return num_output_items
+
+class tag_sink(gr.sync_block):
+ def __init__(self):
+ gr.sync_block.__init__(
+ self,
+ name = "tag sink",
+ in_sig = [numpy.float32],
+ out_sig = None,
+ )
+ self.key = None
+
+ def work(self, input_items, output_items):
+ num_input_items = len(input_items[0])
+
+ #put code here to process the input items...
+
+ #print all the tags received in this work call
+ nread = self.nitems_read(0)
+ tags = self.get_tags_in_range(0, nread, nread+num_input_items)
+ for tag in tags:
+ #print tag.offset
+ #print pmt.pmt_symbol_to_string(tag.key)
+ #print pmt.pmt_symbol_to_string(tag.value)
+ self.key = pmt.pmt_symbol_to_string(tag.key)
+
+ return num_input_items
+
+class fc32_to_f32_2(gr.sync_block):
+ def __init__(self):
+ gr.sync_block.__init__(
+ self,
+ name = "fc32_to_f32_2",
+ in_sig = [numpy.complex64],
+ out_sig = [(numpy.float32, 2)],
+ )
+
+ def work(self, input_items, output_items):
+ output_items[0][::,0] = numpy.real(input_items[0])
+ output_items[0][::,1] = numpy.imag(input_items[0])
+ return len(output_items[0])
+
+class test_block_gateway(gr_unittest.TestCase):
+
+ def test_add_f32(self):
+ tb = gr.top_block()
+ src0 = gr.vector_source_f([1, 3, 5, 7, 9], False)
+ src1 = gr.vector_source_f([0, 2, 4, 6, 8], False)
+ adder = add_2_f32_1_f32()
+ sink = gr.vector_sink_f()
+ tb.connect((src0, 0), (adder, 0))
+ tb.connect((src1, 0), (adder, 1))
+ tb.connect(adder, sink)
+ tb.run()
+ self.assertEqual(sink.data(), (1, 5, 9, 13, 17))
+
+ def test_add_fc32(self):
+ tb = gr.top_block()
+ src0 = gr.vector_source_c([1, 3j, 5, 7j, 9], False)
+ src1 = gr.vector_source_c([0, 2j, 4, 6j, 8], False)
+ adder = add_2_fc32_1_fc32()
+ sink = gr.vector_sink_c()
+ tb.connect((src0, 0), (adder, 0))
+ tb.connect((src1, 0), (adder, 1))
+ tb.connect(adder, sink)
+ tb.run()
+ self.assertEqual(sink.data(), (1, 5j, 9, 13j, 17))
+
+ def test_convolve(self):
+ tb = gr.top_block()
+ src = gr.vector_source_f([1, 2, 3, 4, 5, 6, 7, 8], False)
+ cv = convolve()
+ sink = gr.vector_sink_f()
+ tb.connect(src, cv, sink)
+ tb.run()
+ self.assertEqual(sink.data(), (1, 2, 3, 4, 5, 6, 7, 8))
+
+ def test_decim2x(self):
+ tb = gr.top_block()
+ src = gr.vector_source_f([1, 2, 3, 4, 5, 6, 7, 8], False)
+ d2x = decim2x()
+ sink = gr.vector_sink_f()
+ tb.connect(src, d2x, sink)
+ tb.run()
+ self.assertEqual(sink.data(), (1, 3, 5, 7))
+
+ def test_interp2x(self):
+ tb = gr.top_block()
+ src = gr.vector_source_f([1, 3, 5, 7, 9], False)
+ i2x = interp2x()
+ sink = gr.vector_sink_f()
+ tb.connect(src, i2x, sink)
+ tb.run()
+ self.assertEqual(sink.data(), (1, 1, 3, 3, 5, 5, 7, 7, 9, 9))
+
+ def test_tags(self):
+ src = tag_source()
+ sink = tag_sink()
+ head = gr.head(gr.sizeof_float, 50000) #should be enough items to get a tag through
+ tb = gr.top_block()
+ tb.connect(src, head, sink)
+ tb.run()
+ self.assertEqual(sink.key, "example_key")
+
+ def test_fc32_to_f32_2(self):
+ tb = gr.top_block()
+ src = gr.vector_source_c([1+2j, 3+4j, 5+6j, 7+8j, 9+10j], False)
+ convert = fc32_to_f32_2()
+ v2s = gr.vector_to_stream(gr.sizeof_float, 2)
+ sink = gr.vector_sink_f()
+ tb.connect(src, convert, v2s, sink)
+ tb.run()
+ self.assertEqual(sink.data(), (1, 2, 3, 4, 5, 6, 7, 8, 9, 10))
+
+if __name__ == '__main__':
+ gr_unittest.run(test_block_gateway, "test_block_gateway.xml")
+
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_boolean_operators.py b/gnuradio-core/src/python/gnuradio/gr/qa_boolean_operators.py
new file mode 100755
index 000000000..d7d134dcb
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_boolean_operators.py
@@ -0,0 +1,162 @@
+#!/usr/bin/env python
+#
+# Copyright 2004,2007,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.
+#
+
+from gnuradio import gr, gr_unittest
+
+class test_boolean_operators (gr_unittest.TestCase):
+
+ def setUp (self):
+ self.tb = gr.top_block ()
+
+ def tearDown (self):
+ self.tb = None
+
+ def help_ss (self, src_data, exp_data, op):
+ for s in zip (range (len (src_data)), src_data):
+ src = gr.vector_source_s (s[1])
+ self.tb.connect (src, (op, s[0]))
+ dst = gr.vector_sink_s ()
+ self.tb.connect (op, dst)
+ self.tb.run ()
+ result_data = dst.data ()
+ self.assertEqual (exp_data, result_data)
+
+ def help_bb (self, src_data, exp_data, op):
+ for s in zip (range (len (src_data)), src_data):
+ src = gr.vector_source_b (s[1])
+ self.tb.connect (src, (op, s[0]))
+ dst = gr.vector_sink_b ()
+ self.tb.connect (op, dst)
+ self.tb.run ()
+ result_data = dst.data ()
+ self.assertEqual (exp_data, result_data)
+
+ def help_ii (self, src_data, exp_data, op):
+ for s in zip (range (len (src_data)), src_data):
+ src = gr.vector_source_i (s[1])
+ self.tb.connect (src, (op, s[0]))
+ dst = gr.vector_sink_i ()
+ self.tb.connect (op, dst)
+ self.tb.run ()
+ result_data = dst.data ()
+ self.assertEqual (exp_data, result_data)
+
+ def test_xor_ss (self):
+ src1_data = (1, 2, 3, 0x5004, 0x1150)
+ src2_data = (8, 2, 1 , 0x0508, 0x1105)
+ expected_result = (9, 0, 2, 0x550C, 0x0055)
+ op = gr.xor_ss ()
+ self.help_ss ((src1_data, src2_data),
+ expected_result, op)
+
+ def test_xor_bb (self):
+ src1_data = (1, 2, 3, 4, 0x50)
+ src2_data = (8, 2, 1 , 8, 0x05)
+ expected_result = (9, 0, 2, 0xC, 0x55)
+ op = gr.xor_bb ()
+ self.help_bb ((src1_data, src2_data),
+ expected_result, op)
+
+
+ def test_xor_ii (self):
+ src1_data = (1, 2, 3, 0x5000004, 0x11000050)
+ src2_data = (8, 2, 1 , 0x0500008, 0x11000005)
+ expected_result = (9, 0, 2, 0x550000C, 0x00000055)
+ op = gr.xor_ii ()
+ self.help_ii ((src1_data, src2_data),
+ expected_result, op)
+
+ def test_and_ss (self):
+ src1_data = (1, 2, 3, 0x5004, 0x1150)
+ src2_data = (8, 2, 1 , 0x0508, 0x1105)
+ expected_result = (0, 2, 1, 0x0000, 0x1100)
+ op = gr.and_ss ()
+ self.help_ss ((src1_data, src2_data),
+ expected_result, op)
+
+ def test_and_bb (self):
+ src1_data = (1, 2, 2, 3, 0x04, 0x50)
+ src2_data = (8, 2, 2, 1, 0x08, 0x05)
+ src3_data = (8, 2, 1, 1, 0x08, 0x05)
+ expected_result = (0, 2, 0, 1, 0x00, 0x00)
+ op = gr.and_bb ()
+ self.help_bb ((src1_data, src2_data, src3_data),
+ expected_result, op)
+
+ def test_and_ii (self):
+ src1_data = (1, 2, 3, 0x50005004, 0x11001150)
+ src2_data = (8, 2, 1 , 0x05000508, 0x11001105)
+ expected_result = (0, 2, 1, 0x00000000, 0x11001100)
+ op = gr.and_ii ()
+ self.help_ii ((src1_data, src2_data),
+ expected_result, op)
+
+ def test_or_ss (self):
+ src1_data = (1, 2, 3, 0x5004, 0x1150)
+ src2_data = (8, 2, 1 , 0x0508, 0x1105)
+ expected_result = (9, 2, 3, 0x550C, 0x1155)
+ op = gr.or_ss ()
+ self.help_ss ((src1_data, src2_data),
+ expected_result, op)
+
+ def test_or_bb (self):
+ src1_data = (1, 2, 2, 3, 0x04, 0x50)
+ src2_data = (8, 2, 2, 1 , 0x08, 0x05)
+ src3_data = (8, 2, 1, 1 , 0x08, 0x05)
+ expected_result = (9, 2, 3, 3, 0x0C, 0x55)
+ op = gr.or_bb ()
+ self.help_bb ((src1_data, src2_data, src3_data),
+ expected_result, op)
+
+ def test_or_ii (self):
+ src1_data = (1, 2, 3, 0x50005004, 0x11001150)
+ src2_data = (8, 2, 1 , 0x05000508, 0x11001105)
+ expected_result = (9, 2, 3, 0x5500550C, 0x11001155)
+ op = gr.or_ii ()
+ self.help_ii ((src1_data, src2_data),
+ expected_result, op)
+
+ def test_not_ss (self):
+ src1_data = (1, 2, 3, 0x5004, 0x1150)
+ expected_result = (~1, ~2, ~3, ~0x5004, ~0x1150)
+ op = gr.not_ss ()
+ self.help_ss ((((src1_data),)),
+ expected_result, op)
+
+ def test_not_bb (self):
+ src1_data = (1, 2, 2, 3, 0x04, 0x50)
+ expected_result = (0xFE, 0xFD, 0xFD, 0xFC, 0xFB, 0xAF)
+ op = gr.not_bb ()
+ self.help_bb (((src1_data), ),
+ expected_result, op)
+
+ def test_not_ii (self):
+ src1_data = (1, 2, 3, 0x50005004, 0x11001150)
+ expected_result = (~1 , ~2, ~3, ~0x50005004, ~0x11001150)
+ op = gr.not_ii ()
+ self.help_ii (((src1_data),),
+ expected_result, op)
+
+
+
+if __name__ == '__main__':
+ gr_unittest.run(test_boolean_operators, "test_boolean_operators.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_complex_to_xxx.py b/gnuradio-core/src/python/gnuradio/gr/qa_complex_to_xxx.py
new file mode 100755
index 000000000..946c0d7f8
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_complex_to_xxx.py
@@ -0,0 +1,142 @@
+#!/usr/bin/env python
+#
+# Copyright 2004,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.
+#
+
+from gnuradio import gr, gr_unittest
+import math
+
+class test_complex_ops (gr_unittest.TestCase):
+
+ def setUp (self):
+ self.tb = gr.top_block ()
+
+ def tearDown (self):
+ self.tb = None
+
+ def test_complex_to_float_1 (self):
+ src_data = (0, 1, -1, 3+4j, -3-4j, -3+4j)
+ expected_result = (0, 1, -1, 3, -3, -3)
+ src = gr.vector_source_c (src_data)
+ op = gr.complex_to_float ()
+ dst = gr.vector_sink_f ()
+ self.tb.connect (src, op)
+ self.tb.connect (op, dst)
+ self.tb.run () # run the graph and wait for it to finish
+ actual_result = dst.data () # fetch the contents of the sink
+ self.assertFloatTuplesAlmostEqual (expected_result, actual_result)
+
+ def test_complex_to_float_2 (self):
+ src_data = (0, 1, -1, 3+4j, -3-4j, -3+4j)
+ expected_result0 = (0, 1, -1, 3, -3, -3)
+ expected_result1 = (0, 0, 0, 4, -4, 4)
+ src = gr.vector_source_c (src_data)
+ op = gr.complex_to_float ()
+ dst0 = gr.vector_sink_f ()
+ dst1 = gr.vector_sink_f ()
+ self.tb.connect (src, op)
+ self.tb.connect ((op, 0), dst0)
+ self.tb.connect ((op, 1), dst1)
+ self.tb.run ()
+ actual_result = dst0.data ()
+ self.assertFloatTuplesAlmostEqual (expected_result0, actual_result)
+ actual_result = dst1.data ()
+ self.assertFloatTuplesAlmostEqual (expected_result1, actual_result)
+
+ def test_complex_to_real (self):
+ src_data = (0, 1, -1, 3+4j, -3-4j, -3+4j)
+ expected_result = (0, 1, -1, 3, -3, -3)
+ src = gr.vector_source_c (src_data)
+ op = gr.complex_to_real ()
+ dst = gr.vector_sink_f ()
+ self.tb.connect (src, op)
+ self.tb.connect (op, dst)
+ self.tb.run ()
+ actual_result = dst.data ()
+ self.assertFloatTuplesAlmostEqual (expected_result, actual_result)
+
+ def test_complex_to_imag (self):
+ src_data = (0, 1, -1, 3+4j, -3-4j, -3+4j)
+ expected_result = (0, 0, 0, 4, -4, 4)
+ src = gr.vector_source_c (src_data)
+ op = gr.complex_to_imag ()
+ dst = gr.vector_sink_f ()
+ self.tb.connect (src, op)
+ self.tb.connect (op, dst)
+ self.tb.run ()
+ actual_result = dst.data ()
+ self.assertFloatTuplesAlmostEqual (expected_result, actual_result,5)
+
+ def test_complex_to_mag (self):
+ src_data = (0, 1, -1, 3+4j, -3-4j, -3+4j)
+ expected_result = (0, 1, 1, 5, 5, 5)
+ src = gr.vector_source_c (src_data)
+ op = gr.complex_to_mag ()
+ dst = gr.vector_sink_f ()
+ self.tb.connect (src, op)
+ self.tb.connect (op, dst)
+ self.tb.run ()
+ actual_result = dst.data ()
+ self.assertFloatTuplesAlmostEqual (expected_result, actual_result,5)
+
+ def test_complex_to_mag_squared (self):
+ src_data = (0, 1, -1, 3+4j, -3-4j, -3+4j)
+ expected_result = (0, 1, 1, 25, 25, 25)
+ src = gr.vector_source_c (src_data)
+ op = gr.complex_to_mag_squared ()
+ dst = gr.vector_sink_f ()
+ self.tb.connect (src, op)
+ self.tb.connect (op, dst)
+ self.tb.run ()
+ actual_result = dst.data ()
+ self.assertFloatTuplesAlmostEqual (expected_result, actual_result,5)
+
+ def test_complex_to_arg (self):
+ pi = math.pi
+ input_data = (0, pi/6, pi/4, pi/2, 3*pi/4, 7*pi/8,
+ -pi/6, -pi/4, -pi/2, -3*pi/4, -7*pi/8)
+
+ expected_result = (0.0, # 0
+ 0.52382522821426392, # pi/6
+ 0.78539806604385376, # pi/4
+ 1.5707963705062866, # pi/2
+ 2.3561947345733643, # 3pi/4
+ 2.7491819858551025, # 7pi/8
+ -0.52382522821426392, # -pi/6
+ -0.78539806604385376, # -pi/4
+ -1.5707963705062866, # -pi/2
+ -2.3561947345733643, # -3pi/4
+ -2.7491819858551025) # -7pi/8
+
+ src_data = tuple ([math.cos (x) + math.sin (x) * 1j for x in input_data])
+ src = gr.vector_source_c (src_data)
+ op = gr.complex_to_arg ()
+ dst = gr.vector_sink_f ()
+ self.tb.connect (src, op)
+ self.tb.connect (op, dst)
+ self.tb.run ()
+ actual_result = dst.data ()
+
+ self.assertFloatTuplesAlmostEqual (expected_result, actual_result, 3)
+
+
+if __name__ == '__main__':
+ gr_unittest.run(test_complex_ops, "test_complex_ops.xml")
+
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_conjugate.py b/gnuradio-core/src/python/gnuradio/gr/qa_conjugate.py
new file mode 100644
index 000000000..17fa891e2
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_conjugate.py
@@ -0,0 +1,53 @@
+#!/usr/bin/env python
+#
+# 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.
+#
+
+from gnuradio import gr, gr_unittest
+
+class test_conjugate (gr_unittest.TestCase):
+
+ def setUp (self):
+ self.tb = gr.top_block ()
+
+ def tearDown (self):
+ self.tb = None
+
+ def test_000 (self):
+ src_data = (-2-2j, -1-1j, -2+2j, -1+1j,
+ 2-2j, 1-1j, 2+2j, 1+1j,
+ 0+0j)
+
+ exp_data = (-2+2j, -1+1j, -2-2j, -1-1j,
+ 2+2j, 1+1j, 2-2j, 1-1j,
+ 0-0j)
+
+ src = gr.vector_source_c(src_data)
+ op = gr.conjugate_cc ()
+ dst = gr.vector_sink_c ()
+
+ self.tb.connect(src, op)
+ self.tb.connect(op, dst)
+ self.tb.run()
+ result_data = dst.data ()
+ self.assertEqual (exp_data, result_data)
+
+if __name__ == '__main__':
+ gr_unittest.run(test_conjugate, "test_conjugate.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_copy.py b/gnuradio-core/src/python/gnuradio/gr/qa_copy.py
new file mode 100755
index 000000000..68c8e451f
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_copy.py
@@ -0,0 +1,58 @@
+#!/usr/bin/env python
+#
+# 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.
+#
+
+from gnuradio import gr, gr_unittest
+
+class test_copy(gr_unittest.TestCase):
+
+ def setUp (self):
+ self.tb = gr.top_block ()
+
+ def tearDown (self):
+ self.tb = None
+
+ def test_copy (self):
+ src_data = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
+ expected_result = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
+ src = gr.vector_source_b(src_data)
+ op = gr.copy(gr.sizeof_char)
+ dst = gr.vector_sink_b()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ dst_data = dst.data()
+ self.assertEqual(expected_result, dst_data)
+
+ def test_copy_drop (self):
+ src_data = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
+ expected_result = ()
+ src = gr.vector_source_b(src_data)
+ op = gr.copy(gr.sizeof_char)
+ op.set_enabled(False)
+ dst = gr.vector_sink_b()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ dst_data = dst.data()
+ self.assertEqual(expected_result, dst_data)
+
+
+if __name__ == '__main__':
+ gr_unittest.run(test_copy, "test_copy.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_dc_blocker.py b/gnuradio-core/src/python/gnuradio/gr/qa_dc_blocker.py
new file mode 100755
index 000000000..175735867
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_dc_blocker.py
@@ -0,0 +1,108 @@
+#!/usr/bin/env python
+#
+# Copyright 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.
+#
+
+from gnuradio import gr, gr_unittest
+
+class test_dc_blocker(gr_unittest.TestCase):
+
+ def setUp (self):
+ self.tb = gr.top_block ()
+
+ def tearDown (self):
+ self.tb = None
+
+ def test_001(self):
+ ''' Test impulse response - long form, cc '''
+ src_data = [1,] + 100*[0,]
+ expected_result = ((-0.02072429656982422+0j), (-0.02081298828125+0j),
+ (0.979156494140625+0j), (-0.02081298828125+0j),
+ (-0.02072429656982422+0j))
+
+ src = gr.vector_source_c(src_data)
+ op = gr.dc_blocker_cc(32, True)
+ dst = gr.vector_sink_c()
+
+ self.tb.connect (src, op, dst)
+ self.tb.run()
+
+ # only test samples around 2D-2
+ result_data = dst.data()[60:65]
+ self.assertComplexTuplesAlmostEqual (expected_result, result_data)
+
+ def test_002(self):
+ ''' Test impulse response - short form, cc '''
+ src_data = [1,] + 100*[0,]
+ expected_result = ((-0.029296875+0j), (-0.0302734375+0j),
+ (0.96875+0j), (-0.0302734375+0j),
+ (-0.029296875+0j))
+
+ src = gr.vector_source_c(src_data)
+ op = gr.dc_blocker_cc(32, False)
+ dst = gr.vector_sink_c()
+
+ self.tb.connect (src, op, dst)
+ self.tb.run()
+
+ # only test samples around D-1
+ result_data = dst.data()[29:34]
+ self.assertComplexTuplesAlmostEqual (expected_result, result_data)
+
+
+ def test_003(self):
+ ''' Test impulse response - long form, ff '''
+ src_data = [1,] + 100*[0,]
+ expected_result = ((-0.02072429656982422), (-0.02081298828125),
+ (0.979156494140625), (-0.02081298828125),
+ (-0.02072429656982422))
+
+ src = gr.vector_source_f(src_data)
+ op = gr.dc_blocker_ff(32, True)
+ dst = gr.vector_sink_f()
+
+ self.tb.connect (src, op, dst)
+ self.tb.run()
+
+ # only test samples around 2D-2
+ result_data = dst.data()[60:65]
+ self.assertFloatTuplesAlmostEqual (expected_result, result_data)
+
+ def test_004(self):
+ ''' Test impulse response - short form, ff '''
+ src_data = [1,] + 100*[0,]
+ expected_result = ((-0.029296875), (-0.0302734375),
+ (0.96875), (-0.0302734375),
+ (-0.029296875))
+
+ src = gr.vector_source_f(src_data)
+ op = gr.dc_blocker_ff(32, False)
+ dst = gr.vector_sink_f()
+
+ self.tb.connect (src, op, dst)
+ self.tb.run()
+
+ # only test samples around D-1
+ result_data = dst.data()[29:34]
+ self.assertFloatTuplesAlmostEqual (expected_result, result_data)
+
+if __name__ == '__main__':
+ gr_unittest.run(test_dc_blocker, "test_dc_blocker.xml")
+
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_delay.py b/gnuradio-core/src/python/gnuradio/gr/qa_delay.py
new file mode 100755
index 000000000..0d0bc1330
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_delay.py
@@ -0,0 +1,65 @@
+#!/usr/bin/env python
+#
+# Copyright 2004,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.
+#
+
+from gnuradio import gr, gr_unittest
+import math
+
+class test_delay (gr_unittest.TestCase):
+
+ def setUp (self):
+ self.tb = gr.top_block ()
+
+ def tearDown (self):
+ self.tb = None
+
+ def test_000 (self):
+ delta_t = 0
+ tb = self.tb
+ src_data = [float(x) for x in range(0, 100)]
+ expected_result = tuple(delta_t*[0.0] + src_data)
+
+ src = gr.vector_source_f(src_data)
+ op = gr.delay(gr.sizeof_float, delta_t)
+ dst = gr.vector_sink_f ()
+
+ tb.connect (src, op, dst)
+ tb.run ()
+ dst_data = dst.data ()
+ self.assertEqual (expected_result, dst_data)
+
+ def test_010 (self):
+ delta_t = 10
+ tb = self.tb
+ src_data = [float(x) for x in range(0, 100)]
+ expected_result = tuple(delta_t*[0.0] + src_data)
+
+ src = gr.vector_source_f(src_data)
+ op = gr.delay(gr.sizeof_float, delta_t)
+ dst = gr.vector_sink_f ()
+
+ tb.connect (src, op, dst)
+ tb.run ()
+ dst_data = dst.data ()
+ self.assertEqual (expected_result, dst_data)
+
+if __name__ == '__main__':
+ gr_unittest.run(test_delay, "test_delay.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_diff_encoder.py b/gnuradio-core/src/python/gnuradio/gr/qa_diff_encoder.py
new file mode 100755
index 000000000..c1fe2a700
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_diff_encoder.py
@@ -0,0 +1,86 @@
+#!/usr/bin/env python
+#
+# Copyright 2006,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.
+#
+
+from gnuradio import gr, gr_unittest
+import math
+import random
+
+def make_random_int_tuple(L, min, max):
+ result = []
+ for x in range(L):
+ result.append(random.randint(min, max))
+ return tuple(result)
+
+
+class test_diff_encoder (gr_unittest.TestCase):
+
+ def setUp (self):
+ self.tb = gr.top_block ()
+
+ def tearDown (self):
+ self.tb = None
+
+ def test_diff_encdec_000(self):
+ random.seed(0)
+ modulus = 2
+ src_data = make_random_int_tuple(1000, 0, modulus-1)
+ expected_result = src_data
+ src = gr.vector_source_b(src_data)
+ enc = gr.diff_encoder_bb(modulus)
+ dec = gr.diff_decoder_bb(modulus)
+ dst = gr.vector_sink_b()
+ self.tb.connect(src, enc, dec, dst)
+ self.tb.run() # run the graph and wait for it to finish
+ actual_result = dst.data() # fetch the contents of the sink
+ self.assertEqual(expected_result, actual_result)
+
+ def test_diff_encdec_001(self):
+ random.seed(0)
+ modulus = 4
+ src_data = make_random_int_tuple(1000, 0, modulus-1)
+ expected_result = src_data
+ src = gr.vector_source_b(src_data)
+ enc = gr.diff_encoder_bb(modulus)
+ dec = gr.diff_decoder_bb(modulus)
+ dst = gr.vector_sink_b()
+ self.tb.connect(src, enc, dec, dst)
+ self.tb.run() # run the graph and wait for it to finish
+ actual_result = dst.data() # fetch the contents of the sink
+ self.assertEqual(expected_result, actual_result)
+
+ def test_diff_encdec_002(self):
+ random.seed(0)
+ modulus = 8
+ src_data = make_random_int_tuple(40000, 0, modulus-1)
+ expected_result = src_data
+ src = gr.vector_source_b(src_data)
+ enc = gr.diff_encoder_bb(modulus)
+ dec = gr.diff_decoder_bb(modulus)
+ dst = gr.vector_sink_b()
+ self.tb.connect(src, enc, dec, dst)
+ self.tb.run() # run the graph and wait for it to finish
+ actual_result = dst.data() # fetch the contents of the sink
+ self.assertEqual(expected_result, actual_result)
+
+if __name__ == '__main__':
+ gr_unittest.run(test_diff_encoder, "test_diff_encoder.xml")
+
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_diff_phasor_cc.py b/gnuradio-core/src/python/gnuradio/gr/qa_diff_phasor_cc.py
new file mode 100755
index 000000000..41f96aa61
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_diff_phasor_cc.py
@@ -0,0 +1,50 @@
+#!/usr/bin/env python
+#
+# Copyright 2004,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.
+#
+
+from gnuradio import gr, gr_unittest
+import math
+
+class test_diff_phasor (gr_unittest.TestCase):
+
+ def setUp (self):
+ self.tb = gr.top_block ()
+
+ def tearDown (self):
+ self.tb = None
+
+ def test_diff_phasor_cc (self):
+ src_data = (0+0j, 1+0j, -1+0j, 3+4j, -3-4j, -3+4j)
+ expected_result = (0+0j, 0+0j, -1+0j, -3-4j, -25+0j, -7-24j)
+ src = gr.vector_source_c (src_data)
+ op = gr.diff_phasor_cc ()
+ dst = gr.vector_sink_c ()
+ self.tb.connect (src, op)
+ self.tb.connect (op, dst)
+ self.tb.run () # run the graph and wait for it to finish
+ actual_result = dst.data () # fetch the contents of the sink
+ self.assertComplexTuplesAlmostEqual (expected_result, actual_result)
+
+
+
+if __name__ == '__main__':
+ gr_unittest.run(test_diff_phasor, "test_diff_phasor.xml")
+
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_ecc_ccsds_27.py b/gnuradio-core/src/python/gnuradio/gr/qa_ecc_ccsds_27.py
new file mode 100755
index 000000000..29122ff3e
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_ecc_ccsds_27.py
@@ -0,0 +1,50 @@
+#!/usr/bin/env python
+#
+# Copyright 2004,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.
+#
+
+from gnuradio import gr, gr_unittest
+
+class test_ccsds_27 (gr_unittest.TestCase):
+
+ def setUp (self):
+ self.tb = gr.top_block ()
+
+ def tearDown (self):
+ self.tb = None
+
+ def xtest_ccsds_27 (self):
+ src_data = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
+ expected = (0, 0, 0, 0, 1, 2, 3, 4, 5, 6)
+ src = gr.vector_source_b(src_data)
+ enc = gr.encode_ccsds_27_bb()
+ b2f = gr.char_to_float()
+ add = gr.add_const_ff(-0.5)
+ mul = gr.multiply_const_ff(2.0)
+ dec = gr.decode_ccsds_27_fb()
+ dst = gr.vector_sink_b()
+ self.tb.connect(src, enc, b2f, add, mul, dec, dst)
+ self.tb.run()
+ dst_data = dst.data()
+ self.assertEqual(expected, dst_data)
+
+
+if __name__ == '__main__':
+ gr_unittest.run(test_ccsds_27, "test_ccsds_27.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_endian_swap.py b/gnuradio-core/src/python/gnuradio/gr/qa_endian_swap.py
new file mode 100644
index 000000000..4d2555cc4
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_endian_swap.py
@@ -0,0 +1,66 @@
+#!/usr/bin/env python
+#
+# Copyright 2011,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.
+#
+
+from gnuradio import gr, gr_unittest
+import ctypes
+
+class test_endian_swap (gr_unittest.TestCase):
+
+ def setUp (self):
+ self.tb = gr.top_block ()
+
+ def tearDown (self):
+ self.tb = None
+
+ def test_001(self):
+
+ src_data = [1,2,3,4]
+ expected_result = [256, 512, 768, 1024];
+
+ src = gr.vector_source_s(src_data)
+ op = gr.endian_swap(2)
+ dst = gr.vector_sink_s()
+
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ result_data = list(dst.data())
+
+ self.assertEqual(expected_result, result_data)
+
+ def test_002(self):
+
+ src_data = [1,2,3,4]
+ expected_result = [16777216, 33554432, 50331648, 67108864];
+
+ src = gr.vector_source_i(src_data)
+ op = gr.endian_swap(4)
+ dst = gr.vector_sink_i()
+
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ result_data = list(dst.data())
+
+ self.assertEqual(expected_result, result_data)
+
+if __name__ == '__main__':
+ gr_unittest.run(test_endian_swap, "test_endian_swap.xml")
+
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_feval.py b/gnuradio-core/src/python/gnuradio/gr/qa_feval.py
new file mode 100755
index 000000000..9018e12f3
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_feval.py
@@ -0,0 +1,110 @@
+#!/usr/bin/env python
+#
+# Copyright 2006,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.
+#
+
+from gnuradio import gr, gr_unittest
+
+class my_add2_dd(gr.feval_dd):
+ def eval(self, x):
+ return x + 2
+
+class my_add2_ll(gr.feval_ll):
+ def eval(self, x):
+ return x + 2
+
+class my_add2_cc(gr.feval_cc):
+ def eval(self, x):
+ return x + (2 - 2j)
+
+class my_feval(gr.feval):
+ def __init__(self):
+ gr.feval.__init__(self)
+ self.fired = False
+ def eval(self):
+ self.fired = True
+
+class test_feval(gr_unittest.TestCase):
+
+ def test_dd_1(self):
+ f = my_add2_dd()
+ src_data = (0.0, 1.0, 2.0, 3.0, 4.0)
+ expected_result = (2.0, 3.0, 4.0, 5.0, 6.0)
+ # this is all in python...
+ actual_result = tuple([f.eval(x) for x in src_data])
+ self.assertEqual(expected_result, actual_result)
+
+ def test_dd_2(self):
+ f = my_add2_dd()
+ src_data = (0.0, 1.0, 2.0, 3.0, 4.0)
+ expected_result = (2.0, 3.0, 4.0, 5.0, 6.0)
+ # this is python -> C++ -> python and back again...
+ actual_result = tuple([gr.feval_dd_example(f, x) for x in src_data])
+ self.assertEqual(expected_result, actual_result)
+
+
+ def test_ll_1(self):
+ f = my_add2_ll()
+ src_data = (0, 1, 2, 3, 4)
+ expected_result = (2, 3, 4, 5, 6)
+ # this is all in python...
+ actual_result = tuple([f.eval(x) for x in src_data])
+ self.assertEqual(expected_result, actual_result)
+
+ def test_ll_2(self):
+ f = my_add2_ll()
+ src_data = (0, 1, 2, 3, 4)
+ expected_result = (2, 3, 4, 5, 6)
+ # this is python -> C++ -> python and back again...
+ actual_result = tuple([gr.feval_ll_example(f, x) for x in src_data])
+ self.assertEqual(expected_result, actual_result)
+
+
+ def test_cc_1(self):
+ f = my_add2_cc()
+ src_data = (0+1j, 2+3j, 4+5j, 6+7j)
+ expected_result = (2-1j, 4+1j, 6+3j, 8+5j)
+ # this is all in python...
+ actual_result = tuple([f.eval(x) for x in src_data])
+ self.assertEqual(expected_result, actual_result)
+
+ def test_cc_2(self):
+ f = my_add2_cc()
+ src_data = (0+1j, 2+3j, 4+5j, 6+7j)
+ expected_result = (2-1j, 4+1j, 6+3j, 8+5j)
+ # this is python -> C++ -> python and back again...
+ actual_result = tuple([gr.feval_cc_example(f, x) for x in src_data])
+ self.assertEqual(expected_result, actual_result)
+
+ def test_void_1(self):
+ # this is all in python
+ f = my_feval()
+ f.eval()
+ self.assertEqual(True, f.fired)
+
+ def test_void_2(self):
+ # this is python -> C++ -> python and back again
+ f = my_feval()
+ gr.feval_example(f)
+ self.assertEqual(True, f.fired)
+
+
+if __name__ == '__main__':
+ gr_unittest.run(test_feval, "test_feval.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_fft.py b/gnuradio-core/src/python/gnuradio/gr/qa_fft.py
new file mode 100755
index 000000000..693d0e67c
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_fft.py
@@ -0,0 +1,212 @@
+#!/usr/bin/env python
+#
+# 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 this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+
+from gnuradio import gr, gr_unittest
+import sys
+import random
+
+primes = (2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,
+ 59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,
+ 137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,
+ 227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311)
+
+
+class test_fft(gr_unittest.TestCase):
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def assert_fft_ok2(self, expected_result, result_data):
+ expected_result = expected_result[:len(result_data)]
+ self.assertComplexTuplesAlmostEqual2 (expected_result, result_data,
+ abs_eps=1e-9, rel_eps=4e-4)
+
+ def assert_fft_float_ok2(self, expected_result, result_data, abs_eps=1e-9, rel_eps=4e-4):
+ expected_result = expected_result[:len(result_data)]
+ self.assertFloatTuplesAlmostEqual2 (expected_result, result_data,
+ abs_eps, rel_eps)
+
+ def test_001(self):
+ tb = gr.top_block()
+ fft_size = 32
+ src_data = tuple([complex(primes[2*i], primes[2*i+1]) for i in range(fft_size)])
+
+ expected_result = ((4377+4516j),
+ (-1706.1268310546875+1638.4256591796875j),
+ (-915.2083740234375+660.69427490234375j),
+ (-660.370361328125+381.59600830078125j),
+ (-499.96044921875+238.41630554199219j),
+ (-462.26748657226562+152.88948059082031j),
+ (-377.98440551757812+77.5928955078125j),
+ (-346.85821533203125+47.152004241943359j),
+ (-295+20j),
+ (-286.33609008789062-22.257017135620117j),
+ (-271.52999877929688-33.081821441650391j),
+ (-224.6358642578125-67.019538879394531j),
+ (-244.24473571777344-91.524826049804688j),
+ (-203.09068298339844-108.54627227783203j),
+ (-198.45195007324219-115.90768432617188j),
+ (-182.97744750976562-128.12318420410156j),
+ (-167-180j),
+ (-130.33688354492188-173.83778381347656j),
+ (-141.19784545898438-190.28807067871094j),
+ (-111.09677124023438-214.48896789550781j),
+ (-70.039543151855469-242.41630554199219j),
+ (-68.960540771484375-228.30015563964844j),
+ (-53.049201965332031-291.47097778320312j),
+ (-28.695289611816406-317.64553833007812j),
+ (57-300j),
+ (45.301143646240234-335.69509887695312j),
+ (91.936195373535156-373.32437133789062j),
+ (172.09465026855469-439.275146484375j),
+ (242.24473571777344-504.47515869140625j),
+ (387.81732177734375-666.6788330078125j),
+ (689.48553466796875-918.2142333984375j),
+ (1646.539306640625-1694.1956787109375j))
+
+ src = gr.vector_source_c(src_data)
+ s2v = gr.stream_to_vector(gr.sizeof_gr_complex, fft_size)
+ fft = gr.fft_vcc(fft_size, True, [], False)
+ v2s = gr.vector_to_stream(gr.sizeof_gr_complex, fft_size)
+ dst = gr.vector_sink_c()
+ tb.connect(src, s2v, fft, v2s, dst)
+ tb.run()
+ result_data = dst.data()
+ #print 'expected:', expected_result
+ #print 'results: ', result_data
+ #self.assertComplexTuplesAlmostEqual (expected_result, result_data, 5)
+ self.assert_fft_ok2(expected_result, result_data)
+
+ def test_002(self):
+ tb = gr.top_block()
+ fft_size = 32
+
+ tmp_data = ((4377+4516j),
+ (-1706.1268310546875+1638.4256591796875j),
+ (-915.2083740234375+660.69427490234375j),
+ (-660.370361328125+381.59600830078125j),
+ (-499.96044921875+238.41630554199219j),
+ (-462.26748657226562+152.88948059082031j),
+ (-377.98440551757812+77.5928955078125j),
+ (-346.85821533203125+47.152004241943359j),
+ (-295+20j),
+ (-286.33609008789062-22.257017135620117j),
+ (-271.52999877929688-33.081821441650391j),
+ (-224.6358642578125-67.019538879394531j),
+ (-244.24473571777344-91.524826049804688j),
+ (-203.09068298339844-108.54627227783203j),
+ (-198.45195007324219-115.90768432617188j),
+ (-182.97744750976562-128.12318420410156j),
+ (-167-180j),
+ (-130.33688354492188-173.83778381347656j),
+ (-141.19784545898438-190.28807067871094j),
+ (-111.09677124023438-214.48896789550781j),
+ (-70.039543151855469-242.41630554199219j),
+ (-68.960540771484375-228.30015563964844j),
+ (-53.049201965332031-291.47097778320312j),
+ (-28.695289611816406-317.64553833007812j),
+ (57-300j),
+ (45.301143646240234-335.69509887695312j),
+ (91.936195373535156-373.32437133789062j),
+ (172.09465026855469-439.275146484375j),
+ (242.24473571777344-504.47515869140625j),
+ (387.81732177734375-666.6788330078125j),
+ (689.48553466796875-918.2142333984375j),
+ (1646.539306640625-1694.1956787109375j))
+
+ src_data = tuple([x/fft_size for x in tmp_data])
+
+ expected_result = tuple([complex(primes[2*i], primes[2*i+1]) for i in range(fft_size)])
+
+ src = gr.vector_source_c(src_data)
+ s2v = gr.stream_to_vector(gr.sizeof_gr_complex, fft_size)
+ fft = gr.fft_vcc(fft_size, False, [], False)
+ v2s = gr.vector_to_stream(gr.sizeof_gr_complex, fft_size)
+ dst = gr.vector_sink_c()
+ tb.connect(src, s2v, fft, v2s, dst)
+ tb.run()
+ result_data = dst.data()
+ #print 'expected:', expected_result
+ #print 'results: ', result_data
+ #self.assertComplexTuplesAlmostEqual (expected_result, result_data, 5)
+ self.assert_fft_ok2(expected_result, result_data)
+
+ def test_003(self):
+ # Same test as above, only use 2 threads
+
+ tb = gr.top_block()
+ fft_size = 32
+
+ tmp_data = ((4377+4516j),
+ (-1706.1268310546875+1638.4256591796875j),
+ (-915.2083740234375+660.69427490234375j),
+ (-660.370361328125+381.59600830078125j),
+ (-499.96044921875+238.41630554199219j),
+ (-462.26748657226562+152.88948059082031j),
+ (-377.98440551757812+77.5928955078125j),
+ (-346.85821533203125+47.152004241943359j),
+ (-295+20j),
+ (-286.33609008789062-22.257017135620117j),
+ (-271.52999877929688-33.081821441650391j),
+ (-224.6358642578125-67.019538879394531j),
+ (-244.24473571777344-91.524826049804688j),
+ (-203.09068298339844-108.54627227783203j),
+ (-198.45195007324219-115.90768432617188j),
+ (-182.97744750976562-128.12318420410156j),
+ (-167-180j),
+ (-130.33688354492188-173.83778381347656j),
+ (-141.19784545898438-190.28807067871094j),
+ (-111.09677124023438-214.48896789550781j),
+ (-70.039543151855469-242.41630554199219j),
+ (-68.960540771484375-228.30015563964844j),
+ (-53.049201965332031-291.47097778320312j),
+ (-28.695289611816406-317.64553833007812j),
+ (57-300j),
+ (45.301143646240234-335.69509887695312j),
+ (91.936195373535156-373.32437133789062j),
+ (172.09465026855469-439.275146484375j),
+ (242.24473571777344-504.47515869140625j),
+ (387.81732177734375-666.6788330078125j),
+ (689.48553466796875-918.2142333984375j),
+ (1646.539306640625-1694.1956787109375j))
+
+ src_data = tuple([x/fft_size for x in tmp_data])
+
+ expected_result = tuple([complex(primes[2*i], primes[2*i+1]) for i in range(fft_size)])
+
+ nthreads = 2
+
+ src = gr.vector_source_c(src_data)
+ s2v = gr.stream_to_vector(gr.sizeof_gr_complex, fft_size)
+ fft = gr.fft_vcc(fft_size, False, [], False, nthreads)
+ v2s = gr.vector_to_stream(gr.sizeof_gr_complex, fft_size)
+ dst = gr.vector_sink_c()
+ tb.connect(src, s2v, fft, v2s, dst)
+ tb.run()
+ result_data = dst.data()
+ self.assert_fft_ok2(expected_result, result_data)
+
+if __name__ == '__main__':
+ gr_unittest.run(test_fft, "test_fft.xml")
+
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_fft_filter.py b/gnuradio-core/src/python/gnuradio/gr/qa_fft_filter.py
new file mode 100755
index 000000000..c0aadc306
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_fft_filter.py
@@ -0,0 +1,383 @@
+#!/usr/bin/env python
+#
+# Copyright 2004,2005,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.
+#
+
+from gnuradio import gr, gr_unittest
+import sys
+import random
+
+def make_random_complex_tuple(L):
+ result = []
+ for x in range(L):
+ result.append(complex(random.uniform(-1000,1000),
+ random.uniform(-1000,1000)))
+ return tuple(result)
+
+def make_random_float_tuple(L):
+ result = []
+ for x in range(L):
+ result.append(float(int(random.uniform(-1000,1000))))
+ return tuple(result)
+
+
+def reference_filter_ccc(dec, taps, input):
+ """
+ compute result using conventional fir filter
+ """
+ tb = gr.top_block()
+ #src = gr.vector_source_c(((0,) * (len(taps) - 1)) + input)
+ src = gr.vector_source_c(input)
+ op = gr.fir_filter_ccc(dec, taps)
+ dst = gr.vector_sink_c()
+ tb.connect(src, op, dst)
+ tb.run()
+ return dst.data()
+
+def reference_filter_fff(dec, taps, input):
+ """
+ compute result using conventional fir filter
+ """
+ tb = gr.top_block()
+ #src = gr.vector_source_f(((0,) * (len(taps) - 1)) + input)
+ src = gr.vector_source_f(input)
+ op = gr.fir_filter_fff(dec, taps)
+ dst = gr.vector_sink_f()
+ tb.connect(src, op, dst)
+ tb.run()
+ return dst.data()
+
+
+def print_complex(x):
+ for i in x:
+ i = complex(i)
+ sys.stdout.write("(%6.3f,%6.3fj), " % (i.real, i.imag))
+ sys.stdout.write('\n')
+
+
+class test_fft_filter(gr_unittest.TestCase):
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def assert_fft_ok2(self, expected_result, result_data):
+ expected_result = expected_result[:len(result_data)]
+ self.assertComplexTuplesAlmostEqual2 (expected_result, result_data,
+ abs_eps=1e-9, rel_eps=4e-4)
+
+ def assert_fft_float_ok2(self, expected_result, result_data, abs_eps=1e-9, rel_eps=4e-4):
+ expected_result = expected_result[:len(result_data)]
+ self.assertFloatTuplesAlmostEqual2 (expected_result, result_data,
+ abs_eps, rel_eps)
+
+ #def test_ccc_000(self):
+ # self.assertRaises (RuntimeError, gr.fft_filter_ccc, 2, (1,))
+
+ def test_ccc_001(self):
+ tb = gr.top_block()
+ src_data = (0,1,2,3,4,5,6,7)
+ taps = (1,)
+ expected_result = tuple([complex(x) for x in (0,1,2,3,4,5,6,7)])
+ src = gr.vector_source_c(src_data)
+ op = gr.fft_filter_ccc(1, taps)
+ dst = gr.vector_sink_c()
+ tb.connect(src, op, dst)
+ tb.run()
+ result_data = dst.data()
+ #print 'expected:', expected_result
+ #print 'results: ', result_data
+ self.assertComplexTuplesAlmostEqual (expected_result, result_data, 5)
+
+
+ def test_ccc_002(self):
+ # Test nthreads
+ tb = gr.top_block()
+ src_data = (0,1,2,3,4,5,6,7)
+ taps = (2,)
+ nthreads = 2
+ expected_result = tuple([2 * complex(x) for x in (0,1,2,3,4,5,6,7)])
+ src = gr.vector_source_c(src_data)
+ op = gr.fft_filter_ccc(1, taps, nthreads)
+ dst = gr.vector_sink_c()
+ tb.connect(src, op, dst)
+ tb.run()
+ result_data = dst.data()
+ #print 'expected:', expected_result
+ #print 'results: ', result_data
+ self.assertComplexTuplesAlmostEqual (expected_result, result_data, 5)
+
+ def test_ccc_003(self):
+ tb = gr.top_block()
+ src_data = (0,1,2,3,4,5,6,7)
+ taps = (2,)
+ expected_result = tuple([2 * complex(x) for x in (0,1,2,3,4,5,6,7)])
+ src = gr.vector_source_c(src_data)
+ op = gr.fft_filter_ccc(1, taps)
+ dst = gr.vector_sink_c()
+ tb.connect(src, op, dst)
+ tb.run()
+ result_data = dst.data()
+ #print 'expected:', expected_result
+ #print 'results: ', result_data
+ self.assertComplexTuplesAlmostEqual (expected_result, result_data, 5)
+
+
+ def test_ccc_004(self):
+ random.seed(0)
+ for i in xrange(25):
+ # sys.stderr.write("\n>>> Loop = %d\n" % (i,))
+ src_len = 4*1024
+ src_data = make_random_complex_tuple(src_len)
+ ntaps = int(random.uniform(2, 1000))
+ taps = make_random_complex_tuple(ntaps)
+ expected_result = reference_filter_ccc(1, taps, src_data)
+
+ src = gr.vector_source_c(src_data)
+ op = gr.fft_filter_ccc(1, taps)
+ dst = gr.vector_sink_c()
+ tb = gr.top_block()
+ tb.connect(src, op, dst)
+ tb.run()
+ result_data = dst.data()
+ del tb
+
+ self.assert_fft_ok2(expected_result, result_data)
+
+ def test_ccc_005(self):
+ random.seed(0)
+ for i in xrange(25):
+ # sys.stderr.write("\n>>> Loop = %d\n" % (i,))
+ dec = i + 1
+ src_len = 4*1024
+ src_data = make_random_complex_tuple(src_len)
+ ntaps = int(random.uniform(2, 100))
+ taps = make_random_complex_tuple(ntaps)
+ expected_result = reference_filter_ccc(dec, taps, src_data)
+
+ src = gr.vector_source_c(src_data)
+ op = gr.fft_filter_ccc(dec, taps)
+ dst = gr.vector_sink_c()
+ tb = gr.top_block()
+ tb.connect(src, op, dst)
+ tb.run()
+ del tb
+ result_data = dst.data()
+
+ self.assert_fft_ok2(expected_result, result_data)
+
+ def test_ccc_006(self):
+ # Test decimating with nthreads=2
+ random.seed(0)
+ nthreads = 2
+ for i in xrange(25):
+ # sys.stderr.write("\n>>> Loop = %d\n" % (i,))
+ dec = i + 1
+ src_len = 4*1024
+ src_data = make_random_complex_tuple(src_len)
+ ntaps = int(random.uniform(2, 100))
+ taps = make_random_complex_tuple(ntaps)
+ expected_result = reference_filter_ccc(dec, taps, src_data)
+
+ src = gr.vector_source_c(src_data)
+ op = gr.fft_filter_ccc(dec, taps, nthreads)
+ dst = gr.vector_sink_c()
+ tb = gr.top_block()
+ tb.connect(src, op, dst)
+ tb.run()
+ del tb
+ result_data = dst.data()
+
+ self.assert_fft_ok2(expected_result, result_data)
+
+ # ----------------------------------------------------------------
+ # test _fff version
+ # ----------------------------------------------------------------
+
+ def test_fff_001(self):
+ tb = gr.top_block()
+ src_data = (0,1,2,3,4,5,6,7)
+ taps = (1,)
+ expected_result = tuple([float(x) for x in (0,1,2,3,4,5,6,7)])
+ src = gr.vector_source_f(src_data)
+ op = gr.fft_filter_fff(1, taps)
+ dst = gr.vector_sink_f()
+ tb.connect(src, op, dst)
+ tb.run()
+ result_data = dst.data()
+ #print 'expected:', expected_result
+ #print 'results: ', result_data
+ self.assertFloatTuplesAlmostEqual (expected_result, result_data, 5)
+
+
+ def test_fff_002(self):
+ tb = gr.top_block()
+ src_data = (0,1,2,3,4,5,6,7)
+ taps = (2,)
+ expected_result = tuple([2 * float(x) for x in (0,1,2,3,4,5,6,7)])
+ src = gr.vector_source_f(src_data)
+ op = gr.fft_filter_fff(1, taps)
+ dst = gr.vector_sink_f()
+ tb.connect(src, op, dst)
+ tb.run()
+ result_data = dst.data()
+ #print 'expected:', expected_result
+ #print 'results: ', result_data
+ self.assertFloatTuplesAlmostEqual (expected_result, result_data, 5)
+
+ def test_fff_003(self):
+ # Test 02 with nthreads
+ tb = gr.top_block()
+ src_data = (0,1,2,3,4,5,6,7)
+ taps = (2,)
+ nthreads = 2
+ expected_result = tuple([2 * float(x) for x in (0,1,2,3,4,5,6,7)])
+ src = gr.vector_source_f(src_data)
+ op = gr.fft_filter_fff(1, taps, nthreads)
+ dst = gr.vector_sink_f()
+ tb.connect(src, op, dst)
+ tb.run()
+ result_data = dst.data()
+ self.assertFloatTuplesAlmostEqual (expected_result, result_data, 5)
+
+ def xtest_fff_004(self):
+ random.seed(0)
+ for i in xrange(25):
+ sys.stderr.write("\n>>> Loop = %d\n" % (i,))
+ src_len = 4096
+ src_data = make_random_float_tuple(src_len)
+ ntaps = int(random.uniform(2, 1000))
+ taps = make_random_float_tuple(ntaps)
+ expected_result = reference_filter_fff(1, taps, src_data)
+
+ src = gr.vector_source_f(src_data)
+ op = gr.fft_filter_fff(1, taps)
+ dst = gr.vector_sink_f()
+ tb = gr.top_block()
+ tb.connect(src, op, dst)
+ tb.run()
+ result_data = dst.data()
+
+ #print "src_len =", src_len, " ntaps =", ntaps
+ try:
+ self.assert_fft_float_ok2(expected_result, result_data, abs_eps=1.0)
+ except:
+ expected = open('expected', 'w')
+ for x in expected_result:
+ expected.write(`x` + '\n')
+ actual = open('actual', 'w')
+ for x in result_data:
+ actual.write(`x` + '\n')
+ raise
+
+ def xtest_fff_005(self):
+ random.seed(0)
+ for i in xrange(25):
+ sys.stderr.write("\n>>> Loop = %d\n" % (i,))
+ src_len = 4*1024
+ src_data = make_random_float_tuple(src_len)
+ ntaps = int(random.uniform(2, 1000))
+ taps = make_random_float_tuple(ntaps)
+ expected_result = reference_filter_fff(1, taps, src_data)
+
+ src = gr.vector_source_f(src_data)
+ op = gr.fft_filter_fff(1, taps)
+ dst = gr.vector_sink_f()
+ tb = gr.top_block()
+ tb.connect(src, op, dst)
+ tb.run()
+ result_data = dst.data()
+
+ self.assert_fft_float_ok2(expected_result, result_data, abs_eps=2.0)
+
+ def xtest_fff_006(self):
+ random.seed(0)
+ for i in xrange(25):
+ sys.stderr.write("\n>>> Loop = %d\n" % (i,))
+ dec = i + 1
+ src_len = 4*1024
+ src_data = make_random_float_tuple(src_len)
+ ntaps = int(random.uniform(2, 100))
+ taps = make_random_float_tuple(ntaps)
+ expected_result = reference_filter_fff(dec, taps, src_data)
+
+ src = gr.vector_source_f(src_data)
+ op = gr.fft_filter_fff(dec, taps)
+ dst = gr.vector_sink_f()
+ tb = gr.top_block()
+ tb.connect(src, op, dst)
+ tb.run()
+ result_data = dst.data()
+
+ self.assert_fft_float_ok2(expected_result, result_data)
+
+ def xtest_fff_007(self):
+ # test decimation with nthreads
+ random.seed(0)
+ nthreads = 2
+ for i in xrange(25):
+ sys.stderr.write("\n>>> Loop = %d\n" % (i,))
+ dec = i + 1
+ src_len = 4*1024
+ src_data = make_random_float_tuple(src_len)
+ ntaps = int(random.uniform(2, 100))
+ taps = make_random_float_tuple(ntaps)
+ expected_result = reference_filter_fff(dec, taps, src_data)
+
+ src = gr.vector_source_f(src_data)
+ op = gr.fft_filter_fff(dec, taps, nthreads)
+ dst = gr.vector_sink_f()
+ tb = gr.top_block()
+ tb.connect(src, op, dst)
+ tb.run()
+ result_data = dst.data()
+
+ self.assert_fft_float_ok2(expected_result, result_data)
+
+ def test_fff_get0(self):
+ random.seed(0)
+ for i in xrange(25):
+ ntaps = int(random.uniform(2, 100))
+ taps = make_random_float_tuple(ntaps)
+
+ op = gr.fft_filter_fff(1, taps)
+ result_data = op.taps()
+ #print result_data
+
+ self.assertEqual(taps, result_data)
+
+ def test_ccc_get0(self):
+ random.seed(0)
+ for i in xrange(25):
+ ntaps = int(random.uniform(2, 100))
+ taps = make_random_complex_tuple(ntaps)
+
+ op = gr.fft_filter_ccc(1, taps)
+ result_data = op.taps()
+ #print result_data
+
+ self.assertComplexTuplesAlmostEqual(taps, result_data, 4)
+
+
+if __name__ == '__main__':
+ gr_unittest.run(test_fft_filter, "test_fft_filter.xml")
+
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_filter_delay_fc.py b/gnuradio-core/src/python/gnuradio/gr/qa_filter_delay_fc.py
new file mode 100755
index 000000000..8d325fc3e
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_filter_delay_fc.py
@@ -0,0 +1,317 @@
+#!/usr/bin/env python
+#
+# Copyright 2004,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.
+#
+
+from gnuradio import gr, gr_unittest
+import math
+
+class test_filter_delay_fc (gr_unittest.TestCase):
+
+ def setUp (self):
+ self.tb = gr.top_block ()
+
+ def tearDown (self):
+ self.tb = None
+
+ def test_001_filter_delay_one_input (self):
+
+ # expected result
+ expected_result = ( -1.4678005338941702e-11j,
+ -0.0011950774351134896j,
+ -0.0019336787518113852j,
+ -0.0034673355985432863j,
+ -0.0036765895783901215j,
+ -0.004916108213365078j,
+ -0.0042778430506587029j,
+ -0.006028641015291214j,
+ -0.005476709920912981j,
+ -0.0092810001224279404j,
+ -0.0095402700826525688j,
+ -0.016060983762145042j,
+ -0.016446959227323532j,
+ -0.02523401565849781j,
+ -0.024382550269365311j,
+ -0.035477779805660248j,
+ -0.033021725714206696j,
+ -0.048487484455108643j,
+ -0.04543270543217659j,
+ -0.069477587938308716j,
+ -0.066984444856643677j,
+ -0.10703597217798233j,
+ -0.10620346665382385j,
+ -0.1852707713842392j,
+ -0.19357112050056458j,
+ (7.2191945754696007e-09 -0.50004088878631592j),
+ (0.58778399229049683 -0.6155126690864563j),
+ (0.95105588436126709 -0.12377222627401352j),
+ (0.95105588436126709 +0.41524654626846313j),
+ (0.5877838134765625 +0.91611981391906738j),
+ (5.8516356205018383e-09 +1.0670661926269531j),
+ (-0.5877840518951416 +0.87856143712997437j),
+ (-0.95105588436126709 +0.35447561740875244j),
+ (-0.95105588436126709 -0.26055556535720825j),
+ (-0.5877838134765625 -0.77606213092803955j),
+ (-8.7774534307527574e-09 -0.96460390090942383j),
+ (0.58778399229049683 -0.78470128774642944j),
+ (0.95105588436126709 -0.28380891680717468j),
+ (0.95105588436126709 +0.32548999786376953j),
+ (0.5877838134765625 +0.82514488697052002j),
+ (1.4629089051254596e-08 +1.0096219778060913j),
+ (-0.5877840518951416 +0.81836479902267456j),
+ (-0.95105588436126709 +0.31451958417892456j),
+ (-0.95105588436126709 -0.3030143678188324j),
+ (-0.5877838134765625 -0.80480599403381348j),
+ (-1.7554906861505515e-08 -0.99516552686691284j),
+ (0.58778399229049683 -0.80540722608566284j),
+ (0.95105582475662231 -0.30557557940483093j),
+ (0.95105588436126709 +0.31097668409347534j),
+ (0.5877838134765625 +0.81027895212173462j),
+ (2.3406542482007353e-08 +1.0000816583633423j),
+ (-0.5877840518951416 +0.80908381938934326j),
+ (-0.95105588436126709 +0.30904293060302734j),
+ (-0.95105588436126709 -0.30904296040534973j),
+ (-0.5877838134765625 -0.80908387899398804j),
+ (-2.6332360292258272e-08 -1.0000815391540527j),
+ (0.58778399229049683 -0.80908381938934326j),
+ (0.95105582475662231 -0.30904299020767212j),
+ (0.95105588436126709 +0.30904293060302734j),
+ (0.5877838134765625 +0.80908381938934326j),
+ (3.218399768911695e-08 +1.0000815391540527j))
+
+ tb = self.tb
+
+ sampling_freq = 100
+
+ ntaps = 51
+ src1 = gr.sig_source_f (sampling_freq, gr.GR_SIN_WAVE,
+ sampling_freq * 0.10, 1.0)
+ head = gr.head (gr.sizeof_float, int (ntaps + sampling_freq * 0.10))
+ dst2 = gr.vector_sink_c ()
+
+ # calculate taps
+ taps = gr.firdes_hilbert (ntaps)
+ hd = gr.filter_delay_fc (taps)
+
+ tb.connect (src1, head)
+ tb.connect (head, hd)
+ tb.connect (hd,dst2)
+
+ tb.run ()
+
+ # get output
+ result_data = dst2.data ()
+ self.assertComplexTuplesAlmostEqual (expected_result, result_data, 5)
+
+ def test_002_filter_delay_two_inputs (self):
+
+ # giving the same signal to both the inputs should fetch the same results
+ # as above
+
+ # expected result
+ expected_result = ( -1.4678005338941702e-11j,
+ -0.0011950774351134896j,
+ -0.0019336787518113852j,
+ -0.0034673355985432863j,
+ -0.0036765895783901215j,
+ -0.004916108213365078j,
+ -0.0042778430506587029j,
+ -0.006028641015291214j,
+ -0.005476709920912981j,
+ -0.0092810001224279404j,
+ -0.0095402700826525688j,
+ -0.016060983762145042j,
+ -0.016446959227323532j,
+ -0.02523401565849781j,
+ -0.024382550269365311j,
+ -0.035477779805660248j,
+ -0.033021725714206696j,
+ -0.048487484455108643j,
+ -0.04543270543217659j,
+ -0.069477587938308716j,
+ -0.066984444856643677j,
+ -0.10703597217798233j,
+ -0.10620346665382385j,
+ -0.1852707713842392j,
+ -0.19357112050056458j,
+ (7.2191945754696007e-09 -0.50004088878631592j),
+ (0.58778399229049683 -0.6155126690864563j),
+ (0.95105588436126709 -0.12377222627401352j),
+ (0.95105588436126709 +0.41524654626846313j),
+ (0.5877838134765625 +0.91611981391906738j),
+ (5.8516356205018383e-09 +1.0670661926269531j),
+ (-0.5877840518951416 +0.87856143712997437j),
+ (-0.95105588436126709 +0.35447561740875244j),
+ (-0.95105588436126709 -0.26055556535720825j),
+ (-0.5877838134765625 -0.77606213092803955j),
+ (-8.7774534307527574e-09 -0.96460390090942383j),
+ (0.58778399229049683 -0.78470128774642944j),
+ (0.95105588436126709 -0.28380891680717468j),
+ (0.95105588436126709 +0.32548999786376953j),
+ (0.5877838134765625 +0.82514488697052002j),
+ (1.4629089051254596e-08 +1.0096219778060913j),
+ (-0.5877840518951416 +0.81836479902267456j),
+ (-0.95105588436126709 +0.31451958417892456j),
+ (-0.95105588436126709 -0.3030143678188324j),
+ (-0.5877838134765625 -0.80480599403381348j),
+ (-1.7554906861505515e-08 -0.99516552686691284j),
+ (0.58778399229049683 -0.80540722608566284j),
+ (0.95105582475662231 -0.30557557940483093j),
+ (0.95105588436126709 +0.31097668409347534j),
+ (0.5877838134765625 +0.81027895212173462j),
+ (2.3406542482007353e-08 +1.0000816583633423j),
+ (-0.5877840518951416 +0.80908381938934326j),
+ (-0.95105588436126709 +0.30904293060302734j),
+ (-0.95105588436126709 -0.30904296040534973j),
+ (-0.5877838134765625 -0.80908387899398804j),
+ (-2.6332360292258272e-08 -1.0000815391540527j),
+ (0.58778399229049683 -0.80908381938934326j),
+ (0.95105582475662231 -0.30904299020767212j),
+ (0.95105588436126709 +0.30904293060302734j),
+ (0.5877838134765625 +0.80908381938934326j),
+ (3.218399768911695e-08 +1.0000815391540527j))
+
+
+ tb = self.tb
+
+ sampling_freq = 100
+ ntaps = 51
+ src1 = gr.sig_source_f (sampling_freq, gr.GR_SIN_WAVE,
+ sampling_freq * 0.10, 1.0)
+ head = gr.head (gr.sizeof_float, int (ntaps + sampling_freq * 0.10))
+ dst2 = gr.vector_sink_c ()
+
+
+ # calculate taps
+ taps = gr.firdes_hilbert (ntaps)
+ hd = gr.filter_delay_fc (taps)
+
+ tb.connect (src1, head)
+ tb.connect (head, (hd,0))
+ tb.connect (head, (hd,1))
+ tb.connect (hd,dst2)
+ tb.run ()
+
+ # get output
+ result_data = dst2.data ()
+
+ self.assertComplexTuplesAlmostEqual (expected_result, result_data, 5)
+
+
+ def test_003_filter_delay_two_inputs (self):
+
+ # give two different inputs
+
+ # expected result
+ expected_result = ( -0.0020331963896751404j,
+ -0.0016448829555884004j,
+ -0.0032375147566199303j,
+ -0.0014826074475422502j,
+ -0.0033034090884029865j,
+ -0.00051144487224519253j,
+ -0.0043686260469257832j,
+ -0.0010198024101555347j,
+ -0.0082517862319946289j,
+ -0.003456643782556057j,
+ -0.014193611219525337j,
+ -0.005875137634575367j,
+ -0.020293503999710083j,
+ -0.0067503536120057106j,
+ -0.026798896491527557j,
+ -0.0073488112539052963j,
+ -0.037041611969470978j,
+ -0.010557252913713455j,
+ -0.055669989436864853j,
+ -0.018332764506340027j,
+ -0.089904911816120148j,
+ -0.033361352980136871j,
+ -0.16902604699134827j,
+ -0.074318811297416687j,
+ -0.58429563045501709j,
+ (7.2191945754696007e-09 -0.35892376303672791j),
+ (0.58778399229049683 +0.63660913705825806j),
+ (0.95105588436126709 +0.87681591510772705j),
+ (0.95105588436126709 +0.98705857992172241j),
+ (0.5877838134765625 +0.55447429418563843j),
+ (5.8516356205018383e-09 +0.026006083935499191j),
+ (-0.5877840518951416 -0.60616838932037354j),
+ (-0.95105588436126709 -0.9311758279800415j),
+ (-0.95105588436126709 -0.96169203519821167j),
+ (-0.5877838134765625 -0.57292771339416504j),
+ (-8.7774534307527574e-09 -0.0073488391935825348j),
+ (0.58778399229049683 +0.59720659255981445j),
+ (0.95105588436126709 +0.94438445568084717j),
+ (0.95105588436126709 +0.95582199096679688j),
+ (0.5877838134765625 +0.58196049928665161j),
+ (1.4629089051254596e-08 +0.0026587247848510742j),
+ (-0.5877840518951416 -0.59129220247268677j),
+ (-0.95105588436126709 -0.94841635227203369j),
+ (-0.95105588436126709 -0.95215457677841187j),
+ (-0.5877838134765625 -0.58535969257354736j),
+ (-1.7554906861505515e-08 -0.00051158666610717773j),
+ (0.58778399229049683 +0.58867418766021729j),
+ (0.95105582475662231 +0.94965213537216187j),
+ (0.95105588436126709 +0.95050644874572754j),
+ (0.5877838134765625 +0.58619076013565063j),
+ (2.3406542482007353e-08 +1.1920928955078125e-07j),
+ (-0.5877840518951416 -0.58783555030822754j),
+ (-0.95105588436126709 -0.95113480091094971j),
+ (-0.95105588436126709 -0.95113474130630493j),
+ (-0.5877838134765625 -0.58783555030822754j),
+ (-2.6332360292258272e-08 -8.1956386566162109e-08j),
+ (0.58778399229049683 +0.58783555030822754j),
+ (0.95105582475662231 +0.95113474130630493j),
+ (0.95105588436126709 +0.95113474130630493j),
+ (0.5877838134765625 +0.58783560991287231j),
+ (3.218399768911695e-08 +1.1920928955078125e-07j))
+
+ tb = self.tb
+
+ sampling_freq = 100
+ ntaps = 51
+
+ src1 = gr.sig_source_f (sampling_freq, gr.GR_SIN_WAVE,sampling_freq * 0.10, 1.0)
+ src2 = gr.sig_source_f (sampling_freq, gr.GR_COS_WAVE,sampling_freq * 0.10, 1.0)
+
+ head1 = gr.head (gr.sizeof_float, int (ntaps + sampling_freq * 0.10))
+ head2 = gr.head (gr.sizeof_float, int (ntaps + sampling_freq * 0.10))
+
+ taps = gr.firdes_hilbert (ntaps)
+ hd = gr.filter_delay_fc (taps)
+
+ dst2 = gr.vector_sink_c ()
+
+ tb.connect (src1, head1)
+ tb.connect (src2, head2)
+
+ tb.connect (head1, (hd,0))
+ tb.connect (head2, (hd,1))
+ tb.connect (hd, dst2)
+
+ tb.run ()
+
+ # get output
+ result_data = dst2.data ()
+
+ self.assertComplexTuplesAlmostEqual (expected_result, result_data, 5)
+
+
+if __name__ == '__main__':
+ gr_unittest.run(test_filter_delay_fc, "test_filter_delay_fc.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_float_to_char.py b/gnuradio-core/src/python/gnuradio/gr/qa_float_to_char.py
new file mode 100755
index 000000000..057e297f9
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_float_to_char.py
@@ -0,0 +1,82 @@
+#!/usr/bin/env python
+#
+# Copyright 2011,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.
+#
+
+from gnuradio import gr, gr_unittest
+class test_float_to_char (gr_unittest.TestCase):
+
+ def setUp (self):
+ self.tb = gr.top_block ()
+
+ def tearDown (self):
+ self.tb = None
+
+ def test_001(self):
+
+ src_data = (0.0, 1.1, 2.2, 3.3, 4.4, 5.5, -1.1, -2.2, -3.3)
+ expected_result = [0, 1, 2, 3, 4, 5, 255, 254, 253]
+ src = gr.vector_source_f(src_data)
+ op = gr.float_to_char()
+ dst = gr.vector_sink_b()
+
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ result_data = list(dst.data())
+
+ self.assertEqual(expected_result, result_data)
+
+ def test_002(self):
+
+ src_data = ( 126.0, 127.0, 128.0)
+ expected_result = [ 126, 127, 127 ]
+
+ src = gr.vector_source_f(src_data)
+ op = gr.float_to_char()
+ # Note: vector_sink_b returns uchar
+ dst = gr.vector_sink_b()
+
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ result_data = list(dst.data())
+
+ self.assertEqual(expected_result, result_data)
+
+ def test_003(self):
+
+ scale = 2
+ vlen = 3
+ src_data = (0.0, 1.1, 2.2, 3.3, 4.4, 5.5, -1.1, -2.2, -3.3)
+ expected_result = [0, 2, 4, 6, 8, 11, 254, 252, 250]
+ src = gr.vector_source_f(src_data)
+ s2v = gr.stream_to_vector(gr.sizeof_float, vlen)
+ op = gr.float_to_char(vlen, scale)
+ v2s = gr.vector_to_stream(gr.sizeof_char, vlen)
+ dst = gr.vector_sink_b()
+
+ self.tb.connect(src, s2v, op, v2s, dst)
+ self.tb.run()
+ result_data = list(dst.data())
+
+ self.assertEqual(expected_result, result_data)
+
+if __name__ == '__main__':
+ gr_unittest.run(test_float_to_char, "test_float_to_char.xml")
+
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_float_to_int.py b/gnuradio-core/src/python/gnuradio/gr/qa_float_to_int.py
new file mode 100755
index 000000000..5c7a412d2
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_float_to_int.py
@@ -0,0 +1,85 @@
+#!/usr/bin/env python
+#
+# Copyright 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.
+#
+
+from gnuradio import gr, gr_unittest
+
+class test_float_to_int (gr_unittest.TestCase):
+
+ def setUp (self):
+ self.tb = gr.top_block ()
+
+ def tearDown (self):
+ self.tb = None
+
+ def test_001(self):
+
+ src_data = (0.0, 1.1, 2.2, 3.3, 4.4, 5.5, -1.1, -2.2, -3.3, -4.4, -5.5)
+ expected_result = [0, 1, 2, 3, 4, 6, -1, -2, -3, -4, -6]
+
+ src = gr.vector_source_f(src_data)
+ op = gr.float_to_int()
+ dst = gr.vector_sink_i()
+
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ result_data = list(dst.data())
+
+ self.assertEqual(expected_result, result_data)
+
+ def test_002(self):
+
+ src_data = ( 2147483647, 2147483648, 2200000000,
+ -2147483648, -2147483649, -2200000000)
+ expected_result = [ 2147483647, 2147483647, 2147483647,
+ -2147483647, -2147483647, -2147483647]
+ src = gr.vector_source_f(src_data)
+ op = gr.float_to_int()
+ dst = gr.vector_sink_i()
+
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ result_data = list(dst.data())
+
+ self.assertEqual(expected_result, result_data)
+
+
+ def test_003(self):
+
+ scale = 2
+ vlen = 3
+ src_data = (0.0, 1.1, 2.2, 3.3, 4.4, 5.5, -1.1, -2.2, -3.3)
+ expected_result = [0, 2, 4, 7, 9, 11, -2, -4, -7,]
+ src = gr.vector_source_f(src_data)
+ s2v = gr.stream_to_vector(gr.sizeof_float, vlen)
+ op = gr.float_to_int(vlen, scale)
+ v2s = gr.vector_to_stream(gr.sizeof_int, vlen)
+ dst = gr.vector_sink_i()
+
+ self.tb.connect(src, s2v, op, v2s, dst)
+ self.tb.run()
+ result_data = list(dst.data())
+
+ self.assertEqual(expected_result, result_data)
+
+if __name__ == '__main__':
+ gr_unittest.run(test_float_to_int, "test_float_to_int.xml")
+
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_float_to_short.py b/gnuradio-core/src/python/gnuradio/gr/qa_float_to_short.py
new file mode 100755
index 000000000..3f8b66975
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_float_to_short.py
@@ -0,0 +1,86 @@
+#!/usr/bin/env python
+#
+# Copyright 2011,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.
+#
+
+from gnuradio import gr, gr_unittest
+import ctypes
+
+class test_float_to_short (gr_unittest.TestCase):
+
+ def setUp (self):
+ self.tb = gr.top_block ()
+
+ def tearDown (self):
+ self.tb = None
+
+ def test_001(self):
+
+ src_data = (0.0, 1.1, 2.2, 3.3, 4.4, 5.5, -1.1, -2.2, -3.3, -4.4, -5.5)
+ expected_result = [0, 1, 2, 3, 4, 6, -1, -2, -3, -4, -6]
+
+ src = gr.vector_source_f(src_data)
+ op = gr.float_to_short()
+ dst = gr.vector_sink_s()
+
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ result_data = list(dst.data())
+
+ self.assertEqual(expected_result, result_data)
+
+ def test_002(self):
+
+ src_data = ( 32766, 32767, 32768,
+ -32767, -32768, -32769)
+ expected_result = [ 32766, 32767, 32767,
+ -32767, -32768, -32768 ]
+
+ src = gr.vector_source_f(src_data)
+ op = gr.float_to_short()
+ dst = gr.vector_sink_s()
+
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ result_data = list(dst.data())
+
+ self.assertEqual(expected_result, result_data)
+
+ def test_003(self):
+
+ scale = 2
+ vlen = 3
+ src_data = (0.0, 1.1, 2.2, 3.3, 4.4, 5.5, -1.1, -2.2, -3.3)
+ expected_result = [0, 2, 4, 7, 9, 11, -2, -4, -7]
+ src = gr.vector_source_f(src_data)
+ s2v = gr.stream_to_vector(gr.sizeof_float, vlen)
+ op = gr.float_to_short(vlen, scale)
+ v2s = gr.vector_to_stream(gr.sizeof_short, vlen)
+ dst = gr.vector_sink_s()
+
+ self.tb.connect(src, s2v, op, v2s, dst)
+ self.tb.run()
+ result_data = list(dst.data())
+
+ self.assertEqual(expected_result, result_data)
+
+if __name__ == '__main__':
+ gr_unittest.run(test_float_to_short, "test_float_to_short.xml")
+
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_float_to_uchar.py b/gnuradio-core/src/python/gnuradio/gr/qa_float_to_uchar.py
new file mode 100755
index 000000000..831bed93e
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_float_to_uchar.py
@@ -0,0 +1,64 @@
+#!/usr/bin/env python
+#
+# Copyright 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.
+#
+
+from gnuradio import gr, gr_unittest
+import ctypes
+
+class test_float_to_uchar (gr_unittest.TestCase):
+
+ def setUp (self):
+ self.tb = gr.top_block ()
+
+ def tearDown (self):
+ self.tb = None
+
+ def test_001(self):
+
+ src_data = (0.0, 1.1, 2.2, 3.3, 4.4, 5.5, -1.1, -2.2, -3.3, -4.4, -5.5)
+ expected_result = [0, 1, 2, 3, 4, 6, 0, 0, 0, 0, 0]
+ src = gr.vector_source_f(src_data)
+ op = gr.float_to_uchar()
+ dst = gr.vector_sink_b()
+
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ result_data = list(dst.data())
+
+ self.assertEqual(expected_result, result_data)
+
+ def test_002(self):
+
+ src_data = ( 254.0, 255.0, 256.0)
+ expected_result = [ 254, 255, 255 ]
+ src = gr.vector_source_f(src_data)
+ op = gr.float_to_uchar()
+ dst = gr.vector_sink_b()
+
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ result_data = list(dst.data())
+
+ self.assertEqual(expected_result, result_data)
+
+if __name__ == '__main__':
+ gr_unittest.run(test_float_to_uchar, "test_float_to_uchar.xml")
+
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_fractional_interpolator.py b/gnuradio-core/src/python/gnuradio/gr/qa_fractional_interpolator.py
new file mode 100755
index 000000000..e19bb28f3
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_fractional_interpolator.py
@@ -0,0 +1,38 @@
+#!/usr/bin/env python
+#
+# 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.
+#
+
+from gnuradio import gr, gr_unittest
+
+class test_fractional_resampler (gr_unittest.TestCase):
+
+ def setUp(self):
+ self.tb = gr.top_block()
+
+ def tearDown(self):
+ self.tb = None
+
+ def test_000_make(self):
+ op = gr.fractional_interpolator_ff(0.0, 1.0)
+ op2 = gr.fractional_interpolator_cc(0.0, 1.0)
+
+if __name__ == '__main__':
+ gr_unittest.run(test_fractional_resampler, "test_fractional_resampler.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_frequency_modulator.py b/gnuradio-core/src/python/gnuradio/gr/qa_frequency_modulator.py
new file mode 100755
index 000000000..23459fff3
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_frequency_modulator.py
@@ -0,0 +1,56 @@
+#!/usr/bin/env python
+#
+# Copyright 2004,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.
+#
+
+from gnuradio import gr, gr_unittest
+import math
+
+def sincos(x):
+ return math.cos(x) + math.sin(x) * 1j
+
+
+class test_frequency_modulator (gr_unittest.TestCase):
+
+ def setUp (self):
+ self.tb = gr.top_block ()
+
+ def tearDown (self):
+ self.tb = None
+
+ def test_fm_001 (self):
+ pi = math.pi
+ sensitivity = pi/4
+ src_data = (1.0/4, 1.0/2, 1.0/4, -1.0/4, -1.0/2, -1/4.0)
+ running_sum = (pi/16, 3*pi/16, pi/4, 3*pi/16, pi/16, 0)
+ expected_result = tuple ([sincos (x) for x in running_sum])
+ src = gr.vector_source_f (src_data)
+ op = gr.frequency_modulator_fc (sensitivity)
+ dst = gr.vector_sink_c ()
+ self.tb.connect (src, op)
+ self.tb.connect (op, dst)
+ self.tb.run ()
+ result_data = dst.data ()
+ self.assertComplexTuplesAlmostEqual (expected_result, result_data, 5)
+
+
+if __name__ == '__main__':
+ gr_unittest.run(test_frequency_modulator, "test_frequency_modulator.xml")
+
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_fsk_stuff.py b/gnuradio-core/src/python/gnuradio/gr/qa_fsk_stuff.py
new file mode 100755
index 000000000..95b8c0664
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_fsk_stuff.py
@@ -0,0 +1,75 @@
+#!/usr/bin/env python
+#
+# Copyright 2004,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.
+#
+
+from gnuradio import gr, gr_unittest
+import math
+
+def sincos(x):
+ return math.cos(x) + math.sin(x) * 1j
+
+class test_bytes_to_syms (gr_unittest.TestCase):
+
+ def setUp (self):
+ self.tb = gr.top_block ()
+
+ def tearDown (self):
+ self.tb = None
+
+ def test_bytes_to_syms_001 (self):
+ src_data = (0x01, 0x80, 0x03)
+ expected_result = (-1, -1, -1, -1, -1, -1, -1, +1,
+ +1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, +1, +1)
+ src = gr.vector_source_b (src_data)
+ op = gr.bytes_to_syms ()
+ dst = gr.vector_sink_f ()
+ self.tb.connect (src, op)
+ self.tb.connect (op, dst)
+ self.tb.run ()
+ result_data = dst.data ()
+ self.assertEqual (expected_result, result_data)
+
+ def test_simple_framer (self):
+ src_data = (0x00, 0x11, 0x22, 0x33,
+ 0x44, 0x55, 0x66, 0x77,
+ 0x88, 0x99, 0xaa, 0xbb,
+ 0xcc, 0xdd, 0xee, 0xff)
+
+ expected_result = (
+ 0xac, 0xdd, 0xa4, 0xe2, 0xf2, 0x8c, 0x20, 0xfc, 0x00, 0x00, 0x11, 0x22, 0x33, 0x55,
+ 0xac, 0xdd, 0xa4, 0xe2, 0xf2, 0x8c, 0x20, 0xfc, 0x01, 0x44, 0x55, 0x66, 0x77, 0x55,
+ 0xac, 0xdd, 0xa4, 0xe2, 0xf2, 0x8c, 0x20, 0xfc, 0x02, 0x88, 0x99, 0xaa, 0xbb, 0x55,
+ 0xac, 0xdd, 0xa4, 0xe2, 0xf2, 0x8c, 0x20, 0xfc, 0x03, 0xcc, 0xdd, 0xee, 0xff, 0x55)
+
+ src = gr.vector_source_b (src_data)
+ op = gr.simple_framer (4)
+ dst = gr.vector_sink_b ()
+ self.tb.connect (src, op)
+ self.tb.connect (op, dst)
+ self.tb.run ()
+ result_data = dst.data ()
+ self.assertEqual (expected_result, result_data)
+
+
+if __name__ == '__main__':
+ gr_unittest.run(test_bytes_to_syms, "test_bytes_to_syms.xml")
+
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_glfsr_source.py b/gnuradio-core/src/python/gnuradio/gr/qa_glfsr_source.py
new file mode 100755
index 000000000..161e4a5cc
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_glfsr_source.py
@@ -0,0 +1,94 @@
+#!/usr/bin/env python
+#
+# 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.
+#
+
+from gnuradio import gr, gr_unittest
+
+class test_glfsr_source(gr_unittest.TestCase):
+
+ def setUp (self):
+ self.tb = gr.top_block ()
+
+ def tearDown (self):
+ self.tb = None
+
+ def test_000_make_b(self):
+ src = gr.glfsr_source_b(16)
+ self.assertEquals(src.mask(), 0x8016)
+ self.assertEquals(src.period(), 2**16-1)
+
+ def test_001_degree_b(self):
+ self.assertRaises(RuntimeError,
+ lambda: gr.glfsr_source_b(0))
+ self.assertRaises(RuntimeError,
+ lambda: gr.glfsr_source_b(33))
+
+ def test_002_correlation_b(self):
+ for degree in range(1,11): # Higher degrees take too long to correlate
+ src = gr.glfsr_source_b(degree, False)
+ b2f = gr.chunks_to_symbols_bf((-1.0,1.0), 1)
+ dst = gr.vector_sink_f()
+ del self.tb # Discard existing top block
+ self.tb = gr.top_block()
+ self.tb.connect(src, b2f, dst)
+ self.tb.run()
+ self.tb.disconnect_all()
+ actual_result = dst.data()
+ R = auto_correlate(actual_result)
+ self.assertEqual(R[0], float(len(R))) # Auto-correlation peak at origin
+ for i in range(len(R)-1):
+ self.assertEqual(R[i+1], -1.0) # Auto-correlation minimum everywhere else
+
+ def test_003_make_f(self):
+ src = gr.glfsr_source_f(16)
+ self.assertEquals(src.mask(), 0x8016)
+ self.assertEquals(src.period(), 2**16-1)
+
+ def test_004_degree_f(self):
+ self.assertRaises(RuntimeError,
+ lambda: gr.glfsr_source_f(0))
+ self.assertRaises(RuntimeError,
+ lambda: gr.glfsr_source_f(33))
+ def test_005_correlation_f(self):
+ for degree in range(1,11): # Higher degrees take too long to correlate
+ src = gr.glfsr_source_f(degree, False)
+ dst = gr.vector_sink_f()
+ del self.tb # Discard existing top block
+ self.tb = gr.top_block()
+ self.tb.connect(src, dst)
+ self.tb.run()
+
+ actual_result = dst.data()
+ R = auto_correlate(actual_result)
+ self.assertEqual(R[0], float(len(R))) # Auto-correlation peak at origin
+ for i in range(len(R)-1):
+ self.assertEqual(R[i+1], -1.0) # Auto-correlation minimum everywhere else
+
+def auto_correlate(data):
+ l = len(data)
+ R = [0,]*l
+ for lag in range(l):
+ for i in range(l):
+ R[lag] += data[i]*data[i-lag]
+ return R
+
+if __name__ == '__main__':
+ gr_unittest.run(test_glfsr_source, "test_glfsr_source.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_goertzel.py b/gnuradio-core/src/python/gnuradio/gr/qa_goertzel.py
new file mode 100755
index 000000000..77f1b5f89
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_goertzel.py
@@ -0,0 +1,64 @@
+#!/usr/bin/env python
+#
+# Copyright 2006,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.
+#
+
+from gnuradio import gr, gr_unittest
+from math import pi, cos
+
+class test_goertzel(gr_unittest.TestCase):
+
+ def setUp(self):
+ self.tb = gr.top_block()
+
+ def tearDown(self):
+ self.tb = None
+
+ def make_tone_data(self, rate, freq):
+ return [cos(2*pi*x*freq/rate) for x in range(rate)]
+
+ def transform(self, src_data, rate, freq):
+ src = gr.vector_source_f(src_data, False)
+ dft = gr.goertzel_fc(rate, rate, freq)
+ dst = gr.vector_sink_c()
+ self.tb.connect(src, dft, dst)
+ self.tb.run()
+ return dst.data()
+
+ def test_001(self): # Measure single tone magnitude
+ rate = 8000
+ freq = 100
+ bin = freq
+ src_data = self.make_tone_data(rate, freq)
+ expected_result = 0.5
+ actual_result = abs(self.transform(src_data, rate, bin)[0])
+ self.assertAlmostEqual(expected_result, actual_result, places=4)
+
+ def test_002(self): # Measure off frequency magnitude
+ rate = 8000
+ freq = 100
+ bin = freq/2
+ src_data = self.make_tone_data(rate, freq)
+ expected_result = 0.0
+ actual_result = abs(self.transform(src_data, rate, bin)[0])
+ self.assertAlmostEqual(expected_result, actual_result, places=4)
+
+if __name__ == '__main__':
+ gr_unittest.run(test_goertzel, "test_goertzel.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_head.py b/gnuradio-core/src/python/gnuradio/gr/qa_head.py
new file mode 100755
index 000000000..d7cb354dc
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_head.py
@@ -0,0 +1,47 @@
+#!/usr/bin/env python
+#
+# Copyright 2004,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.
+#
+
+from gnuradio import gr, gr_unittest
+
+class test_head (gr_unittest.TestCase):
+
+ def setUp (self):
+ self.tb = gr.top_block ()
+
+ def tearDown (self):
+ self.tb = None
+
+ def test_head (self):
+ src_data = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
+ expected_result = (1, 2, 3, 4)
+ src1 = gr.vector_source_i (src_data)
+ op = gr.head (gr.sizeof_int, 4)
+ dst1 = gr.vector_sink_i ()
+ self.tb.connect (src1, op)
+ self.tb.connect (op, dst1)
+ self.tb.run ()
+ dst_data = dst1.data ()
+ self.assertEqual (expected_result, dst_data)
+
+
+if __name__ == '__main__':
+ gr_unittest.run(test_head, "test_head.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_hier_block2.py b/gnuradio-core/src/python/gnuradio/gr/qa_hier_block2.py
new file mode 100755
index 000000000..3132d91b0
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_hier_block2.py
@@ -0,0 +1,369 @@
+#!/usr/bin/env python
+
+from gnuradio import gr, gr_unittest
+
+class test_hier_block2(gr_unittest.TestCase):
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def test_001_make(self):
+ hblock = gr.hier_block2("test_block",
+ gr.io_signature(1,1,gr.sizeof_int),
+ gr.io_signature(1,1,gr.sizeof_int))
+ self.assertEqual("test_block", hblock.name())
+ self.assertEqual(1, hblock.input_signature().max_streams())
+ self.assertEqual(1, hblock.output_signature().min_streams())
+ self.assertEqual(1, hblock.output_signature().max_streams())
+ self.assertEqual(gr.sizeof_int, hblock.output_signature().sizeof_stream_item(0))
+
+ def test_002_connect_input(self):
+ hblock = gr.hier_block2("test_block",
+ gr.io_signature(1,1,gr.sizeof_int),
+ gr.io_signature(1,1,gr.sizeof_int))
+ nop1 = gr.nop(gr.sizeof_int)
+ hblock.connect(hblock, nop1)
+
+ def test_004_connect_output(self):
+ hblock = gr.hier_block2("test_block",
+ gr.io_signature(1,1,gr.sizeof_int),
+ gr.io_signature(1,1,gr.sizeof_int))
+ nop1 = gr.nop(gr.sizeof_int)
+ hblock.connect(nop1, hblock)
+
+ def test_005_connect_output_in_use(self):
+ hblock = gr.hier_block2("test_block",
+ gr.io_signature(1,1,gr.sizeof_int),
+ gr.io_signature(1,1,gr.sizeof_int))
+ nop1 = gr.nop(gr.sizeof_int)
+ nop2 = gr.nop(gr.sizeof_int)
+ hblock.connect(nop1, hblock)
+ self.assertRaises(ValueError,
+ lambda: hblock.connect(nop2, hblock))
+
+ def test_006_connect_invalid_src_port_neg(self):
+ hblock = gr.hier_block2("test_block",
+ gr.io_signature(1,1,gr.sizeof_int),
+ gr.io_signature(1,1,gr.sizeof_int))
+ nop1 = gr.nop(gr.sizeof_int)
+ self.assertRaises(ValueError,
+ lambda: hblock.connect((hblock, -1), nop1))
+
+ def test_005_connect_invalid_src_port_exceeds(self):
+ hblock = gr.hier_block2("test_block",
+ gr.io_signature(1,1,gr.sizeof_int),
+ gr.io_signature(1,1,gr.sizeof_int))
+ nop1 = gr.nop(gr.sizeof_int)
+ self.assertRaises(ValueError,
+ lambda: hblock.connect((hblock, 1), nop1))
+
+ def test_007_connect_invalid_dst_port_neg(self):
+ hblock = gr.hier_block2("test_block",
+ gr.io_signature(1,1,gr.sizeof_int),
+ gr.io_signature(1,1,gr.sizeof_int))
+ nop1 = gr.nop(gr.sizeof_int)
+ nop2 = gr.nop(gr.sizeof_int)
+ self.assertRaises(ValueError,
+ lambda: hblock.connect(nop1, (nop2, -1)))
+
+ def test_008_connect_invalid_dst_port_exceeds(self):
+ hblock = gr.hier_block2("test_block",
+ gr.io_signature(1,1,gr.sizeof_int),
+ gr.io_signature(1,1,gr.sizeof_int))
+ nop1 = gr.null_sink(gr.sizeof_int)
+ nop2 = gr.null_sink(gr.sizeof_int)
+ self.assertRaises(ValueError,
+ lambda: hblock.connect(nop1, (nop2, 1)))
+
+ def test_009_check_topology(self):
+ hblock = gr.top_block("test_block")
+ hblock.check_topology(0, 0)
+
+ def test_010_run(self):
+ expected = (1.0, 2.0, 3.0, 4.0)
+ hblock = gr.top_block("test_block")
+ src = gr.vector_source_f(expected, False)
+ sink1 = gr.vector_sink_f()
+ sink2 = gr.vector_sink_f()
+ hblock.connect(src, sink1)
+ hblock.connect(src, sink2)
+ hblock.run()
+ actual1 = sink1.data()
+ actual2 = sink2.data()
+ self.assertEquals(expected, actual1)
+ self.assertEquals(expected, actual2)
+
+ def test_012_disconnect_input(self):
+ hblock = gr.hier_block2("test_block",
+ gr.io_signature(1,1,gr.sizeof_int),
+ gr.io_signature(1,1,gr.sizeof_int))
+ nop1 = gr.nop(gr.sizeof_int)
+ hblock.connect(hblock, nop1)
+ hblock.disconnect(hblock, nop1)
+
+ def test_013_disconnect_input_not_connected(self):
+ hblock = gr.hier_block2("test_block",
+ gr.io_signature(1,1,gr.sizeof_int),
+ gr.io_signature(1,1,gr.sizeof_int))
+ nop1 = gr.nop(gr.sizeof_int)
+ nop2 = gr.nop(gr.sizeof_int)
+ hblock.connect(hblock, nop1)
+ self.assertRaises(ValueError,
+ lambda: hblock.disconnect(hblock, nop2))
+
+ def test_014_disconnect_input_neg(self):
+ hblock = gr.hier_block2("test_block",
+ gr.io_signature(1,1,gr.sizeof_int),
+ gr.io_signature(1,1,gr.sizeof_int))
+ nop1 = gr.nop(gr.sizeof_int)
+ hblock.connect(hblock, nop1)
+ self.assertRaises(ValueError,
+ lambda: hblock.disconnect((hblock, -1), nop1))
+
+ def test_015_disconnect_input_exceeds(self):
+ hblock = gr.hier_block2("test_block",
+ gr.io_signature(1,1,gr.sizeof_int),
+ gr.io_signature(1,1,gr.sizeof_int))
+ nop1 = gr.nop(gr.sizeof_int)
+ hblock.connect(hblock, nop1)
+ self.assertRaises(ValueError,
+ lambda: hblock.disconnect((hblock, 1), nop1))
+
+ def test_016_disconnect_output(self):
+ hblock = gr.hier_block2("test_block",
+ gr.io_signature(1,1,gr.sizeof_int),
+ gr.io_signature(1,1,gr.sizeof_int))
+ nop1 = gr.nop(gr.sizeof_int)
+ hblock.connect(nop1, hblock)
+ hblock.disconnect(nop1, hblock)
+
+ def test_017_disconnect_output_not_connected(self):
+ hblock = gr.hier_block2("test_block",
+ gr.io_signature(1,1,gr.sizeof_int),
+ gr.io_signature(1,1,gr.sizeof_int))
+ nop1 = gr.nop(gr.sizeof_int)
+ nop2 = gr.nop(gr.sizeof_int)
+ hblock.connect(nop1, hblock)
+ self.assertRaises(ValueError,
+ lambda: hblock.disconnect(nop2, hblock))
+
+ def test_018_disconnect_output_neg(self):
+ hblock = gr.hier_block2("test_block",
+ gr.io_signature(1,1,gr.sizeof_int),
+ gr.io_signature(1,1,gr.sizeof_int))
+ nop1 = gr.nop(gr.sizeof_int)
+ hblock.connect(hblock, nop1)
+ self.assertRaises(ValueError,
+ lambda: hblock.disconnect(nop1, (hblock, -1)))
+
+ def test_019_disconnect_output_exceeds(self):
+ hblock = gr.hier_block2("test_block",
+ gr.io_signature(1,1,gr.sizeof_int),
+ gr.io_signature(1,1,gr.sizeof_int))
+ nop1 = gr.nop(gr.sizeof_int)
+ hblock.connect(nop1, hblock)
+ self.assertRaises(ValueError,
+ lambda: hblock.disconnect(nop1, (hblock, 1)))
+
+ def test_020_run(self):
+ hblock = gr.top_block("test_block")
+ data = (1.0, 2.0, 3.0, 4.0)
+ src = gr.vector_source_f(data, False)
+ dst = gr.vector_sink_f()
+ hblock.connect(src, dst)
+ hblock.run()
+ self.assertEquals(data, dst.data())
+
+ def test_021_connect_single(self):
+ hblock = gr.top_block("test_block")
+ blk = gr.hier_block2("block",
+ gr.io_signature(0, 0, 0),
+ gr.io_signature(0, 0, 0))
+ hblock.connect(blk)
+
+ def test_022_connect_single_with_ports(self):
+ hblock = gr.top_block("test_block")
+ blk = gr.hier_block2("block",
+ gr.io_signature(1, 1, 1),
+ gr.io_signature(1, 1, 1))
+ self.assertRaises(ValueError,
+ lambda: hblock.connect(blk))
+
+ def test_023_connect_single_twice(self):
+ hblock = gr.top_block("test_block")
+ blk = gr.hier_block2("block",
+ gr.io_signature(0, 0, 0),
+ gr.io_signature(0, 0, 0))
+ hblock.connect(blk)
+ self.assertRaises(ValueError,
+ lambda: hblock.connect(blk))
+
+ def test_024_disconnect_single(self):
+ hblock = gr.top_block("test_block")
+ blk = gr.hier_block2("block",
+ gr.io_signature(0, 0, 0),
+ gr.io_signature(0, 0, 0))
+ hblock.connect(blk)
+ hblock.disconnect(blk)
+
+ def test_025_disconnect_single_not_connected(self):
+ hblock = gr.top_block("test_block")
+ blk = gr.hier_block2("block",
+ gr.io_signature(0, 0, 0),
+ gr.io_signature(0, 0, 0))
+ self.assertRaises(ValueError,
+ lambda: hblock.disconnect(blk))
+
+ def test_026_run_single(self):
+ expected_data = (1.0,)
+ tb = gr.top_block("top_block")
+ hb = gr.hier_block2("block",
+ gr.io_signature(0, 0, 0),
+ gr.io_signature(0, 0, 0))
+ src = gr.vector_source_f(expected_data)
+ dst = gr.vector_sink_f()
+ hb.connect(src, dst)
+ tb.connect(hb)
+ tb.run()
+ self.assertEquals(expected_data, dst.data())
+
+ def test_027a_internally_unconnected_input(self):
+ tb = gr.top_block()
+ hb = gr.hier_block2("block",
+ gr.io_signature(1, 1, 1),
+ gr.io_signature(1, 1, 1))
+ hsrc = gr.vector_source_b([1,])
+ hb.connect(hsrc, hb) # wire output internally
+ src = gr.vector_source_b([1, ])
+ dst = gr.vector_sink_b()
+ tb.connect(src, hb, dst) # hb's input is not connected internally
+ self.assertRaises(RuntimeError,
+ lambda: tb.run())
+
+ def test_027b_internally_unconnected_output(self):
+ tb = gr.top_block()
+
+ hb = gr.hier_block2("block",
+ gr.io_signature(1, 1, 1),
+ gr.io_signature(1, 1, 1))
+ hdst = gr.vector_sink_b()
+ hb.connect(hb, hdst) # wire input internally
+ src = gr.vector_source_b([1, ])
+ dst = gr.vector_sink_b()
+ tb.connect(src, hb, dst) # hb's output is not connected internally
+ self.assertRaises(RuntimeError,
+ lambda: tb.run())
+
+ def test_027c_fully_unconnected_output(self):
+ tb = gr.top_block()
+ hb = gr.hier_block2("block",
+ gr.io_signature(1, 1, 1),
+ gr.io_signature(1, 1, 1))
+ hsrc = gr.vector_sink_b()
+ hb.connect(hb, hsrc) # wire input internally
+ src = gr.vector_source_b([1, ])
+ dst = gr.vector_sink_b()
+ tb.connect(src, hb) # hb's output is not connected internally or externally
+ self.assertRaises(RuntimeError,
+ lambda: tb.run())
+
+ def test_027d_fully_unconnected_input(self):
+ tb = gr.top_block()
+ hb = gr.hier_block2("block",
+ gr.io_signature(1, 1, 1),
+ gr.io_signature(1, 1, 1))
+ hdst = gr.vector_source_b([1,])
+ hb.connect(hdst, hb) # wire output internally
+ dst = gr.vector_sink_b()
+ tb.connect(hb, dst) # hb's input is not connected internally or externally
+ self.assertRaises(RuntimeError,
+ lambda: tb.run())
+
+ def test_028_singleton_reconfigure(self):
+ tb = gr.top_block()
+ hb = gr.hier_block2("block",
+ gr.io_signature(0, 0, 0), gr.io_signature(0, 0, 0))
+ src = gr.vector_source_b([1, ])
+ dst = gr.vector_sink_b()
+ hb.connect(src, dst)
+ tb.connect(hb) # Singleton connect
+ tb.lock()
+ tb.disconnect_all()
+ tb.connect(src, dst)
+ tb.unlock()
+
+ def test_029_singleton_disconnect(self):
+ tb = gr.top_block()
+ src = gr.vector_source_b([1, ])
+ dst = gr.vector_sink_b()
+ tb.connect(src, dst)
+ tb.disconnect(src) # Singleton disconnect
+ tb.connect(src, dst)
+ tb.run()
+ self.assertEquals(dst.data(), (1,))
+
+ def test_030_nested_input(self):
+ tb = gr.top_block()
+ src = gr.vector_source_b([1,])
+ hb1 = gr.hier_block2("hb1",
+ gr.io_signature(1, 1, gr.sizeof_char),
+ gr.io_signature(0, 0, 0))
+ hb2 = gr.hier_block2("hb2",
+ gr.io_signature(1, 1, gr.sizeof_char),
+ gr.io_signature(0, 0, 0))
+ dst = gr.vector_sink_b()
+ tb.connect(src, hb1)
+ hb1.connect(hb1, hb2)
+ hb2.connect(hb2, gr.kludge_copy(gr.sizeof_char), dst)
+ tb.run()
+ self.assertEquals(dst.data(), (1,))
+
+ def test_031_multiple_internal_inputs(self):
+ tb = gr.top_block()
+ src = gr.vector_source_f([1.0,])
+ hb = gr.hier_block2("hb",
+ gr.io_signature(1, 1, gr.sizeof_float),
+ gr.io_signature(1, 1, gr.sizeof_float))
+ m1 = gr.multiply_const_ff(1.0)
+ m2 = gr.multiply_const_ff(2.0)
+ add = gr.add_ff()
+ hb.connect(hb, m1) # m1 is connected to hb external input #0
+ hb.connect(hb, m2) # m2 is also connected to hb external input #0
+ hb.connect(m1, (add, 0))
+ hb.connect(m2, (add, 1))
+ hb.connect(add, hb) # add is connected to hb external output #0
+ dst = gr.vector_sink_f()
+ tb.connect(src, hb, dst)
+ tb.run()
+ self.assertEquals(dst.data(), (3.0,))
+
+ def test_032_nested_multiple_internal_inputs(self):
+ tb = gr.top_block()
+ src = gr.vector_source_f([1.0,])
+ hb = gr.hier_block2("hb",
+ gr.io_signature(1, 1, gr.sizeof_float),
+ gr.io_signature(1, 1, gr.sizeof_float))
+ hb2 = gr.hier_block2("hb",
+ gr.io_signature(1, 1, gr.sizeof_float),
+ gr.io_signature(1, 1, gr.sizeof_float))
+
+ m1 = gr.multiply_const_ff(1.0)
+ m2 = gr.multiply_const_ff(2.0)
+ add = gr.add_ff()
+ hb2.connect(hb2, m1) # m1 is connected to hb2 external input #0
+ hb2.connect(hb2, m2) # m2 is also connected to hb2 external input #0
+ hb2.connect(m1, (add, 0))
+ hb2.connect(m2, (add, 1))
+ hb2.connect(add, hb2) # add is connected to hb2 external output #0
+ hb.connect(hb, hb2, hb) # hb as hb2 as nested internal block
+ dst = gr.vector_sink_f()
+ tb.connect(src, hb, dst)
+ tb.run()
+ self.assertEquals(dst.data(), (3.0,))
+
+
+if __name__ == "__main__":
+ gr_unittest.run(test_hier_block2, "test_hier_block2.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_hilbert.py b/gnuradio-core/src/python/gnuradio/gr/qa_hilbert.py
new file mode 100755
index 000000000..27d01092b
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_hilbert.py
@@ -0,0 +1,116 @@
+#!/usr/bin/env python
+#
+# Copyright 2004,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.
+#
+
+from gnuradio import gr, gr_unittest
+import math
+
+class test_hilbert (gr_unittest.TestCase):
+
+ def setUp (self):
+ self.tb = gr.top_block ()
+
+ def tearDown (self):
+ self.tb = None
+
+ def test_hilbert (self):
+ tb = self.tb
+ ntaps = 51
+ sampling_freq = 100
+
+ expected_result = ( -1.4678005338941702e-11j,
+ -0.0011950774351134896j,
+ -0.0019336787518113852j,
+ -0.0034673355985432863j,
+ -0.0036765895783901215j,
+ -0.004916108213365078j,
+ -0.0042778430506587029j,
+ -0.006028641015291214j,
+ -0.005476709920912981j,
+ -0.0092810001224279404j,
+ -0.0095402700826525688j,
+ -0.016060983762145042j,
+ -0.016446959227323532j,
+ -0.02523401565849781j,
+ -0.024382550269365311j,
+ -0.035477779805660248j,
+ -0.033021725714206696j,
+ -0.048487484455108643j,
+ -0.04543270543217659j,
+ -0.069477587938308716j,
+ -0.066984444856643677j,
+ -0.10703597217798233j,
+ -0.10620346665382385j,
+ -0.1852707713842392j,
+ -0.19357112050056458j,
+ (7.2191945754696007e-09 -0.50004088878631592j),
+ (0.58778399229049683 -0.6155126690864563j),
+ (0.95105588436126709 -0.12377222627401352j),
+ (0.95105588436126709 +0.41524654626846313j),
+ (0.5877838134765625 +0.91611981391906738j),
+ (5.8516356205018383e-09 +1.0670661926269531j),
+ (-0.5877840518951416 +0.87856143712997437j),
+ (-0.95105588436126709 +0.35447561740875244j),
+ (-0.95105588436126709 -0.26055556535720825j),
+ (-0.5877838134765625 -0.77606213092803955j),
+ (-8.7774534307527574e-09 -0.96460390090942383j),
+ (0.58778399229049683 -0.78470128774642944j),
+ (0.95105588436126709 -0.28380891680717468j),
+ (0.95105588436126709 +0.32548999786376953j),
+ (0.5877838134765625 +0.82514488697052002j),
+ (1.4629089051254596e-08 +1.0096219778060913j),
+ (-0.5877840518951416 +0.81836479902267456j),
+ (-0.95105588436126709 +0.31451958417892456j),
+ (-0.95105588436126709 -0.3030143678188324j),
+ (-0.5877838134765625 -0.80480599403381348j),
+ (-1.7554906861505515e-08 -0.99516552686691284j),
+ (0.58778399229049683 -0.80540722608566284j),
+ (0.95105582475662231 -0.30557557940483093j),
+ (0.95105588436126709 +0.31097668409347534j),
+ (0.5877838134765625 +0.81027895212173462j),
+ (2.3406542482007353e-08 +1.0000816583633423j),
+ (-0.5877840518951416 +0.80908381938934326j),
+ (-0.95105588436126709 +0.30904293060302734j),
+ (-0.95105588436126709 -0.30904296040534973j),
+ (-0.5877838134765625 -0.80908387899398804j),
+ (-2.6332360292258272e-08 -1.0000815391540527j),
+ (0.58778399229049683 -0.80908381938934326j),
+ (0.95105582475662231 -0.30904299020767212j),
+ (0.95105588436126709 +0.30904293060302734j),
+ (0.5877838134765625 +0.80908381938934326j),
+ (3.218399768911695e-08 +1.0000815391540527j))
+
+
+ src1 = gr.sig_source_f (sampling_freq, gr.GR_SIN_WAVE,
+ sampling_freq * 0.10, 1.0)
+
+ head = gr.head (gr.sizeof_float, int (ntaps + sampling_freq * 0.10))
+ hilb = gr.hilbert_fc (ntaps)
+ dst1 = gr.vector_sink_c ()
+ tb.connect (src1, head)
+ tb.connect (head, hilb)
+ tb.connect (hilb, dst1)
+ tb.run ()
+ dst_data = dst1.data ()
+ self.assertComplexTuplesAlmostEqual (expected_result, dst_data, 5)
+
+if __name__ == '__main__':
+ gr_unittest.run(test_hilbert, "test_hilbert.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_iir.py b/gnuradio-core/src/python/gnuradio/gr/qa_iir.py
new file mode 100755
index 000000000..06b8d767e
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_iir.py
@@ -0,0 +1,159 @@
+#!/usr/bin/env python
+#
+# Copyright 2004,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.
+#
+
+from gnuradio import gr, gr_unittest
+
+class test_iir (gr_unittest.TestCase):
+
+ def setUp (self):
+ self.tb = gr.top_block ()
+
+ def tearDown (self):
+ self.tb = None
+
+ def test_iir_direct_001 (self):
+ src_data = (1, 2, 3, 4, 5, 6, 7, 8)
+ fftaps = ()
+ fbtaps = ()
+ expected_result = (0, 0, 0, 0, 0, 0, 0, 0)
+ src = gr.vector_source_f (src_data)
+ op = gr.iir_filter_ffd (fftaps, fbtaps)
+ dst = gr.vector_sink_f ()
+ self.tb.connect (src, op)
+ self.tb.connect (op, dst)
+ self.tb.run ()
+ result_data = dst.data ()
+ self.assertFloatTuplesAlmostEqual (expected_result, result_data)
+
+ def test_iir_direct_002 (self):
+ src_data = (1, 2, 3, 4, 5, 6, 7, 8)
+ fftaps = (2,)
+ fbtaps = (0,)
+ expected_result = (2, 4, 6, 8, 10, 12, 14, 16)
+ src = gr.vector_source_f (src_data)
+ op = gr.iir_filter_ffd (fftaps, fbtaps)
+ dst = gr.vector_sink_f ()
+ self.tb.connect (src, op)
+ self.tb.connect (op, dst)
+ self.tb.run ()
+ result_data = dst.data ()
+ self.assertFloatTuplesAlmostEqual (expected_result, result_data)
+
+ def test_iir_direct_003 (self):
+ src_data = (1, 2, 3, 4, 5, 6, 7, 8)
+ fftaps = (2, 11)
+ fbtaps = (0, 0)
+ expected_result = (2, 15, 28, 41, 54, 67, 80, 93)
+ src = gr.vector_source_f (src_data)
+ op = gr.iir_filter_ffd (fftaps, fbtaps)
+ dst = gr.vector_sink_f ()
+ self.tb.connect (src, op)
+ self.tb.connect (op, dst)
+ self.tb.run ()
+ result_data = dst.data ()
+ self.assertFloatTuplesAlmostEqual (expected_result, result_data)
+
+ def test_iir_direct_004 (self):
+ src_data = (1, 2, 3, 4, 5, 6, 7, 8)
+ fftaps = (2, 11)
+ fbtaps = (0, -1)
+ expected_result = (2, 13, 15, 26, 28, 39, 41, 52)
+ src = gr.vector_source_f (src_data)
+ op = gr.iir_filter_ffd (fftaps, fbtaps)
+ dst = gr.vector_sink_f ()
+ self.tb.connect (src, op)
+ self.tb.connect (op, dst)
+ self.tb.run ()
+ result_data = dst.data ()
+ self.assertFloatTuplesAlmostEqual (expected_result, result_data)
+
+ def test_iir_direct_005 (self):
+ src_data = (1, 2, 3, 4, 5, 6, 7, 8)
+ fftaps = (2, 11, 0)
+ fbtaps = (0, -1, 3)
+ expected_result = (2, 13, 21, 59, 58, 186, 68, 583)
+ src = gr.vector_source_f (src_data)
+ op = gr.iir_filter_ffd (fftaps, fbtaps)
+ dst = gr.vector_sink_f ()
+ self.tb.connect (src, op)
+ self.tb.connect (op, dst)
+ self.tb.run ()
+ result_data = dst.data ()
+ self.assertFloatTuplesAlmostEqual (expected_result, result_data)
+
+ def test_iir_direct_006 (self):
+ src_data = (1, 2, 3, 4, 5, 6, 7, 8)
+ expected_result = (2, 13, 21, 59, 58, 186, 68, 583)
+ fftaps = (2, 1)
+ fbtaps = (0, -1)
+ src = gr.vector_source_f (src_data)
+ op = gr.iir_filter_ffd (fftaps, fbtaps)
+ fftaps = (2, 11, 0)
+ fbtaps = (0, -1, 3)
+ op.set_taps (fftaps, fbtaps)
+ dst = gr.vector_sink_f ()
+ self.tb.connect (src, op)
+ self.tb.connect (op, dst)
+ self.tb.run ()
+ result_data = dst.data ()
+ self.assertFloatTuplesAlmostEqual (expected_result, result_data)
+
+ def test_iir_direct_007 (self):
+ src_data = (1, 2, 3, 4, 5, 6, 7, 8)
+ expected_result = (2,2,5,5,8,8,11,11)
+ fftaps = (2, 1)
+ fbtaps = (0, -1)
+ src = gr.vector_source_f (src_data)
+ op = gr.iir_filter_ffd (fftaps, fbtaps)
+ fftaps = (2,0,1)
+ fbtaps = (0, -1)
+ op.set_taps (fftaps, fbtaps)
+ dst = gr.vector_sink_f ()
+ self.tb.connect (src, op)
+ self.tb.connect (op, dst)
+ self.tb.run ()
+ result_data = dst.data ()
+ self.assertFloatTuplesAlmostEqual (expected_result, result_data)
+
+ def test_iir_direct_008 (self):
+ src_data = (1, 2, 3, 4, 5, 6, 7, 8)
+ expected_result = (2,4,4,10,18,14,26,56)
+ fftaps = (2,)
+ fbtaps = (0, 1)
+ src = gr.vector_source_f (src_data)
+ op = gr.iir_filter_ffd (fftaps, fbtaps)
+ fftaps_data = (1)
+ fbtaps = (0,0, -1,3)
+ op.set_taps (fftaps, fbtaps)
+ dst = gr.vector_sink_f ()
+ self.tb.connect (src, op)
+ self.tb.connect (op, dst)
+ self.tb.run ()
+ result_data = dst.data ()
+ self.assertFloatTuplesAlmostEqual (expected_result, result_data)
+
+
+
+
+if __name__ == '__main__':
+ gr_unittest.run(test_iir, "test_iir.xml")
+
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_int_to_float.py b/gnuradio-core/src/python/gnuradio/gr/qa_int_to_float.py
new file mode 100755
index 000000000..7536b3820
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_int_to_float.py
@@ -0,0 +1,69 @@
+#!/usr/bin/env python
+#
+# Copyright 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.
+#
+
+from gnuradio import gr, gr_unittest
+
+class test_int_to_float (gr_unittest.TestCase):
+
+ def setUp (self):
+ self.tb = gr.top_block ()
+
+ def tearDown (self):
+ self.tb = None
+
+ def test_001(self):
+
+ src_data = (0, 1, 2, 3, 4, 5, -1, -2, -3, -4, -5)
+ expected_result = [float(s) for s in src_data]
+ src = gr.vector_source_i(src_data)
+ op = gr.int_to_float()
+ dst = gr.vector_sink_f()
+
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ result_data = dst.data()
+
+ self.assertFloatTuplesAlmostEqual(expected_result, result_data)
+
+ def test_002(self):
+
+ vlen = 3
+ src_data = ( 65000, 65001, 65002, 65003, 65004, 65005,
+ -65001, -65002, -65003)
+ expected_result = [ 65000.0, 65001.0, 65002.0,
+ 65003.0, 65004.0, 65005.0,
+ -65001.0, -65002.0, -65003.0]
+ src = gr.vector_source_i(src_data)
+ s2v = gr.stream_to_vector(gr.sizeof_int, vlen)
+ op = gr.int_to_float(vlen)
+ v2s = gr.vector_to_stream(gr.sizeof_float, vlen)
+ dst = gr.vector_sink_f()
+
+ self.tb.connect(src, s2v, op, v2s, dst)
+ self.tb.run()
+ result_data = list(dst.data())
+
+ self.assertEqual(expected_result, result_data)
+
+if __name__ == '__main__':
+ gr_unittest.run(test_int_to_float, "test_int_to_float.xml")
+
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_integrate.py b/gnuradio-core/src/python/gnuradio/gr/qa_integrate.py
new file mode 100755
index 000000000..ddb1310b6
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_integrate.py
@@ -0,0 +1,75 @@
+#!/usr/bin/env python
+#
+# 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.
+#
+
+from gnuradio import gr, gr_unittest
+import math
+
+class test_integrate (gr_unittest.TestCase):
+
+ def setUp (self):
+ self.tb = gr.top_block ()
+
+ def tearDown (self):
+ self.tb = None
+
+ def test_000_ss(self):
+ src_data = (1, 2, 3, 4, 5, 6)
+ dst_data = (6, 15)
+ src = gr.vector_source_s(src_data)
+ itg = gr.integrate_ss(3)
+ dst = gr.vector_sink_s()
+ self.tb.connect(src, itg, dst)
+ self.tb.run()
+ self.assertEqual(dst_data, dst.data())
+
+ def test_001_ii(self):
+ src_data = (1, 2, 3, 4, 5, 6)
+ dst_data = (6, 15)
+ src = gr.vector_source_i(src_data)
+ itg = gr.integrate_ii(3)
+ dst = gr.vector_sink_i()
+ self.tb.connect(src, itg, dst)
+ self.tb.run()
+ self.assertEqual(dst_data, dst.data())
+
+ def test_002_ff(self):
+ src_data = [1.0, 2.0, 3.0, 4.0, 5.0, 6.0]
+ dst_data = [6.0, 15.0]
+ src = gr.vector_source_f(src_data)
+ itg = gr.integrate_ff(3)
+ dst = gr.vector_sink_f()
+ self.tb.connect(src, itg, dst)
+ self.tb.run()
+ self.assertFloatTuplesAlmostEqual(dst_data, dst.data(), 6)
+
+ def test_003_cc(self):
+ src_data = [1.0+1.0j, 2.0+2.0j, 3.0+3.0j, 4.0+4.0j, 5.0+5.0j, 6.0+6.0j]
+ dst_data = [6.0+6.0j, 15.0+15.0j]
+ src = gr.vector_source_c(src_data)
+ itg = gr.integrate_cc(3)
+ dst = gr.vector_sink_c()
+ self.tb.connect(src, itg, dst)
+ self.tb.run()
+ self.assertComplexTuplesAlmostEqual(dst_data, dst.data(), 6)
+
+if __name__ == '__main__':
+ gr_unittest.run(test_integrate, "test_integrate.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_interleave.py b/gnuradio-core/src/python/gnuradio/gr/qa_interleave.py
new file mode 100755
index 000000000..1ff178251
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_interleave.py
@@ -0,0 +1,81 @@
+#!/usr/bin/env python
+#
+# Copyright 2004,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.
+#
+
+from gnuradio import gr, gr_unittest
+import math
+
+class test_interleave (gr_unittest.TestCase):
+
+ def setUp (self):
+ self.tb = gr.top_block ()
+
+ def tearDown (self):
+ self.tb = None
+
+ def test_int_001 (self):
+ lenx = 64
+ src0 = gr.vector_source_f (range (0, lenx, 4))
+ src1 = gr.vector_source_f (range (1, lenx, 4))
+ src2 = gr.vector_source_f (range (2, lenx, 4))
+ src3 = gr.vector_source_f (range (3, lenx, 4))
+ op = gr.interleave (gr.sizeof_float)
+ dst = gr.vector_sink_f ()
+
+ self.tb.connect (src0, (op, 0))
+ self.tb.connect (src1, (op, 1))
+ self.tb.connect (src2, (op, 2))
+ self.tb.connect (src3, (op, 3))
+ self.tb.connect (op, dst)
+ self.tb.run ()
+ expected_result = tuple (range (lenx))
+ result_data = dst.data ()
+ self.assertFloatTuplesAlmostEqual (expected_result, result_data)
+
+ def test_deint_001 (self):
+ lenx = 64
+ src = gr.vector_source_f (range (lenx))
+ op = gr.deinterleave (gr.sizeof_float)
+ dst0 = gr.vector_sink_f ()
+ dst1 = gr.vector_sink_f ()
+ dst2 = gr.vector_sink_f ()
+ dst3 = gr.vector_sink_f ()
+
+ self.tb.connect (src, op)
+ self.tb.connect ((op, 0), dst0)
+ self.tb.connect ((op, 1), dst1)
+ self.tb.connect ((op, 2), dst2)
+ self.tb.connect ((op, 3), dst3)
+ self.tb.run ()
+
+ expected_result0 = tuple (range (0, lenx, 4))
+ expected_result1 = tuple (range (1, lenx, 4))
+ expected_result2 = tuple (range (2, lenx, 4))
+ expected_result3 = tuple (range (3, lenx, 4))
+
+ self.assertFloatTuplesAlmostEqual (expected_result0, dst0.data ())
+ self.assertFloatTuplesAlmostEqual (expected_result1, dst1.data ())
+ self.assertFloatTuplesAlmostEqual (expected_result2, dst2.data ())
+ self.assertFloatTuplesAlmostEqual (expected_result3, dst3.data ())
+
+if __name__ == '__main__':
+ gr_unittest.run(test_interleave, "test_interleave.xml")
+
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_interp_fir_filter.py b/gnuradio-core/src/python/gnuradio/gr/qa_interp_fir_filter.py
new file mode 100755
index 000000000..9bd9977c7
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_interp_fir_filter.py
@@ -0,0 +1,54 @@
+#!/usr/bin/env python
+#
+# Copyright 2004,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.
+#
+
+from gnuradio import gr, gr_unittest
+import math
+
+class test_interp_fir_filter (gr_unittest.TestCase):
+
+ def setUp (self):
+ self.tb = gr.top_block ()
+
+ def tearDown (self):
+ self.tb = None
+
+ def test_fff (self):
+ taps = [1, 10, 100, 1000, 10000]
+ src_data = (0, 2, 3, 5, 7, 11, 13, 17)
+ interpolation = 3
+ xr = (0,0,0,0,2,20,200,2003,20030,300,3005,30050,500,5007,50070,700,7011,70110,1100,11013,110130,1300,13017,130170)
+ expected_result = tuple ([float (x) for x in xr])
+
+ src = gr.vector_source_f (src_data)
+ op = gr.interp_fir_filter_fff (interpolation, taps)
+ dst = gr.vector_sink_f ()
+ self.tb.connect (src, op)
+ self.tb.connect (op, dst)
+ self.tb.run ()
+ result_data = dst.data ()
+ L = min(len(result_data), len(expected_result))
+ self.assertEqual (expected_result[0:L], result_data[0:L])
+
+
+if __name__ == '__main__':
+ gr_unittest.run(test_interp_fir_filter, "test_interp_fir_filter.xml")
+
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_keep_m_in_n.py b/gnuradio-core/src/python/gnuradio/gr/qa_keep_m_in_n.py
new file mode 100755
index 000000000..922671d02
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_keep_m_in_n.py
@@ -0,0 +1,58 @@
+#!/usr/bin/env python
+#
+# 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 this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+
+from gnuradio import gr, gr_unittest
+import sys
+import random
+
+class test_keep_m_in_n(gr_unittest.TestCase):
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def test_001(self):
+ self.maxDiff = None;
+ tb = gr.top_block()
+ src = gr.vector_source_b( range(0,100) )
+
+ # itemsize, M, N, offset
+ km2 = gr.keep_m_in_n( 1, 1, 2, 0 );
+ km3 = gr.keep_m_in_n( 1, 1, 3, 1 );
+ km7 = gr.keep_m_in_n( 1, 1, 7, 2 );
+ snk2 = gr.vector_sink_b();
+ snk3 = gr.vector_sink_b();
+ snk7 = gr.vector_sink_b();
+ tb.connect(src,km2,snk2);
+ tb.connect(src,km3,snk3);
+ tb.connect(src,km7,snk7);
+ tb.run();
+
+ self.assertEqual(range(0,100,2), list(snk2.data()));
+ self.assertEqual(range(1,100,3), list(snk3.data()));
+ self.assertEqual(range(2,100,7), list(snk7.data()));
+
+
+if __name__ == '__main__':
+ gr_unittest.run(test_keep_m_in_n, "test_keep_m_in_n.xml")
+
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_kludge_copy.py b/gnuradio-core/src/python/gnuradio/gr/qa_kludge_copy.py
new file mode 100755
index 000000000..2a3aa44b1
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_kludge_copy.py
@@ -0,0 +1,91 @@
+#!/usr/bin/env python
+#
+# Copyright 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.
+#
+
+from gnuradio import gr, gr_unittest
+import math
+import random
+
+
+class test_kludge_copy(gr_unittest.TestCase):
+
+ def setUp(self):
+ self.tb = gr.top_block()
+ self.rng = random.Random()
+ self.rng.seed(0)
+
+ def tearDown(self):
+ del self.tb
+ del self.rng
+
+ def make_random_int_tuple(self, L):
+ result = []
+ for x in range(L):
+ result.append(self.rng.randint(int(-1e9), int(+1e9)))
+ return tuple(result)
+
+
+ def test_001(self):
+ # 1 input stream; 1 output stream
+ src0_data = self.make_random_int_tuple(16000)
+ src0 = gr.vector_source_i(src0_data)
+ op = gr.kludge_copy(gr.sizeof_int)
+ dst0 = gr.vector_sink_i()
+ self.tb.connect(src0, op, dst0)
+ self.tb.run()
+ dst0_data = dst0.data()
+ self.assertEqual(src0_data, dst0_data)
+
+ def test_002(self):
+ # 2 input streams; 2 output streams
+ src0_data = self.make_random_int_tuple(16000)
+ src1_data = self.make_random_int_tuple(16000)
+ src0 = gr.vector_source_i(src0_data)
+ src1 = gr.vector_source_i(src1_data)
+ op = gr.kludge_copy(gr.sizeof_int)
+ dst0 = gr.vector_sink_i()
+ dst1 = gr.vector_sink_i()
+ self.tb.connect(src0, (op, 0), dst0)
+ self.tb.connect(src1, (op, 1), dst1)
+ self.tb.run()
+ dst0_data = dst0.data()
+ dst1_data = dst1.data()
+ self.assertEqual(src0_data, dst0_data)
+ self.assertEqual(src1_data, dst1_data)
+
+ # Note: this is disabled due to triggering bug in ticket:181
+ # It only occurs with new top block code
+ def xtest_003(self):
+ # number of input streams != number of output streams
+ src0_data = self.make_random_int_tuple(16000)
+ src1_data = self.make_random_int_tuple(16000)
+ src0 = gr.vector_source_i(src0_data)
+ src1 = gr.vector_source_i(src1_data)
+ op = gr.kludge_copy(gr.sizeof_int)
+ dst0 = gr.vector_sink_i()
+ dst1 = gr.vector_sink_i()
+ self.tb.connect(src0, (op, 0), dst0)
+ self.tb.connect(src1, (op, 1))
+ self.assertRaises(ValueError, self.tb.run)
+
+if __name__ == '__main__':
+ gr_unittest.run(test_kludge_copy, "test_kludge_copy.xml")
+
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_kludged_imports.py b/gnuradio-core/src/python/gnuradio/gr/qa_kludged_imports.py
new file mode 100755
index 000000000..39b5d781e
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_kludged_imports.py
@@ -0,0 +1,43 @@
+#!/usr/bin/env python
+#
+# Copyright 2005,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.
+#
+
+from gnuradio import gr, gr_unittest
+
+class test_kludged_imports (gr_unittest.TestCase):
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def test_blks_import(self):
+ # make sure that this somewhat magic import works
+ from gnuradio import blks2
+
+ def test_gru_import(self):
+ # make sure that this somewhat magic import works
+ from gnuradio import gru
+
+
+if __name__ == '__main__':
+ gr_unittest.run(test_kludged_imports, "test_kludged_imports.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_max.py b/gnuradio-core/src/python/gnuradio/gr/qa_max.py
new file mode 100755
index 000000000..f962df457
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_max.py
@@ -0,0 +1,70 @@
+#!/usr/bin/env python
+#
+# 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.
+#
+
+from gnuradio import gr, gr_unittest
+import math
+
+
+class test_max (gr_unittest.TestCase):
+
+ def setUp (self):
+ self.tb = gr.top_block ()
+
+
+ def tearDown (self):
+ self.tb = None
+
+
+ def test_001(self):
+
+ src_data = (0,0.2,-0.3,0,12,0)
+ expected_result = (float(max(src_data)), )
+
+ src = gr.vector_source_f(src_data)
+ s2v = gr.stream_to_vector(gr.sizeof_float, len(src_data))
+ op = gr.max_ff( len(src_data) )
+ dst = gr.vector_sink_f()
+
+
+ self.tb.connect(src, s2v, op, dst)
+ self.tb.run()
+ result_data = dst.data()
+ self.assertEqual(expected_result, result_data)
+
+ def test_002(self):
+
+ src_data=(-100,-99,-98,-97,-96,-1)
+ expected_result = (float(max(src_data)), )
+
+ src = gr.vector_source_f(src_data)
+ s2v = gr.stream_to_vector(gr.sizeof_float, len(src_data))
+ op = gr.max_ff( len(src_data) )
+ dst = gr.vector_sink_f()
+
+ self.tb.connect(src, s2v, op, dst)
+ self.tb.run()
+ result_data = dst.data()
+ self.assertEqual(expected_result, result_data)
+
+if __name__ == '__main__':
+ gr_unittest.run(test_max, "test_max.xml")
+
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_message.py b/gnuradio-core/src/python/gnuradio/gr/qa_message.py
new file mode 100755
index 000000000..4cef39bd7
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_message.py
@@ -0,0 +1,131 @@
+#!/usr/bin/env python
+#
+# 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.
+#
+
+from gnuradio import gr, gr_unittest
+
+
+def all_counts ():
+ return (gr.block_ncurrently_allocated (),
+ gr.block_detail_ncurrently_allocated (),
+ gr.buffer_ncurrently_allocated (),
+ gr.buffer_reader_ncurrently_allocated (),
+ gr.message_ncurrently_allocated ())
+
+
+class test_message (gr_unittest.TestCase):
+
+ def setUp (self):
+ self.msgq = gr.msg_queue ()
+
+ def tearDown (self):
+ self.msgq = None
+
+ def leak_check (self, fct):
+ begin = all_counts ()
+ fct ()
+ # tear down early so we can check for leaks
+ self.tearDown ()
+ end = all_counts ()
+ self.assertEqual (begin, end)
+
+ def test_100 (self):
+ msg = gr.message (0, 1.5, 2.3)
+ self.assertEquals (0, msg.type())
+ self.assertAlmostEqual (1.5, msg.arg1())
+ self.assertAlmostEqual (2.3, msg.arg2())
+ self.assertEquals (0, msg.length())
+
+ def test_101 (self):
+ s = 'This is a test'
+ msg = gr.message_from_string(s)
+ self.assertEquals(s, msg.to_string())
+
+ def test_200 (self):
+ self.leak_check (self.body_200)
+
+ def body_200 (self):
+ self.msgq.insert_tail (gr.message (0))
+ self.assertEquals (1, self.msgq.count())
+ self.msgq.insert_tail (gr.message (1))
+ self.assertEquals (2, self.msgq.count())
+ msg0 = self.msgq.delete_head ()
+ self.assertEquals (0, msg0.type())
+ msg1 = self.msgq.delete_head ()
+ self.assertEquals (1, msg1.type())
+ self.assertEquals (0, self.msgq.count())
+
+ def test_201 (self):
+ self.leak_check (self.body_201)
+
+ def body_201 (self):
+ self.msgq.insert_tail (gr.message (0))
+ self.assertEquals (1, self.msgq.count())
+ self.msgq.insert_tail (gr.message (1))
+ self.assertEquals (2, self.msgq.count())
+
+ def test_202 (self):
+ self.leak_check (self.body_202)
+
+ def body_202 (self):
+ # global msg
+ msg = gr.message (666)
+
+ def test_300(self):
+ input_data = (0,1,2,3,4,5,6,7,8,9)
+ src = gr.vector_source_b(input_data)
+ dst = gr.vector_sink_b()
+ tb = gr.top_block()
+ tb.connect(src, dst)
+ tb.run()
+ self.assertEquals(input_data, dst.data())
+
+ def test_301(self):
+ # Use itemsize, limit constructor
+ src = gr.message_source(gr.sizeof_char)
+ dst = gr.vector_sink_b()
+ tb = gr.top_block()
+ tb.connect(src, dst)
+ src.msgq().insert_tail(gr.message_from_string('01234'))
+ src.msgq().insert_tail(gr.message_from_string('5'))
+ src.msgq().insert_tail(gr.message_from_string(''))
+ src.msgq().insert_tail(gr.message_from_string('6789'))
+ src.msgq().insert_tail(gr.message(1)) # send EOF
+ tb.run()
+ self.assertEquals(tuple(map(ord, '0123456789')), dst.data())
+
+ def test_302(self):
+ # Use itemsize, msgq constructor
+ msgq = gr.msg_queue()
+ src = gr.message_source(gr.sizeof_char, msgq)
+ dst = gr.vector_sink_b()
+ tb = gr.top_block()
+ tb.connect(src, dst)
+ src.msgq().insert_tail(gr.message_from_string('01234'))
+ src.msgq().insert_tail(gr.message_from_string('5'))
+ src.msgq().insert_tail(gr.message_from_string(''))
+ src.msgq().insert_tail(gr.message_from_string('6789'))
+ src.msgq().insert_tail(gr.message(1)) # send EOF
+ tb.run()
+ self.assertEquals(tuple(map(ord, '0123456789')), dst.data())
+
+if __name__ == '__main__':
+ gr_unittest.run(test_message, "test_message.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_multiply_conjugate.py b/gnuradio-core/src/python/gnuradio/gr/qa_multiply_conjugate.py
new file mode 100644
index 000000000..1601a109e
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_multiply_conjugate.py
@@ -0,0 +1,57 @@
+#!/usr/bin/env python
+#
+# 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.
+#
+
+from gnuradio import gr, gr_unittest
+
+class test_multiply_conjugate (gr_unittest.TestCase):
+
+ def setUp (self):
+ self.tb = gr.top_block ()
+
+ def tearDown (self):
+ self.tb = None
+
+ def test_000 (self):
+ src_data0 = (-2-2j, -1-1j, -2+2j, -1+1j,
+ 2-2j, 1-1j, 2+2j, 1+1j,
+ 0+0j)
+ src_data1 = (-3-3j, -4-4j, -3+3j, -4+4j,
+ 3-3j, 4-4j, 3+3j, 4+4j,
+ 0+0j)
+
+ exp_data = (12+0j, 8+0j, 12+0j, 8+0j,
+ 12+0j, 8+0j, 12+0j, 8+0j,
+ 0+0j)
+ src0 = gr.vector_source_c(src_data0)
+ src1 = gr.vector_source_c(src_data1)
+ op = gr.multiply_conjugate_cc ()
+ dst = gr.vector_sink_c ()
+
+ self.tb.connect(src0, (op,0))
+ self.tb.connect(src1, (op,1))
+ self.tb.connect(op, dst)
+ self.tb.run()
+ result_data = dst.data ()
+ self.assertEqual (exp_data, result_data)
+
+if __name__ == '__main__':
+ gr_unittest.run(test_multiply_conjugate, "test_multiply_conjugate.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_mute.py b/gnuradio-core/src/python/gnuradio/gr/qa_mute.py
new file mode 100755
index 000000000..afdfdfe13
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_mute.py
@@ -0,0 +1,89 @@
+#!/usr/bin/env python
+#
+# Copyright 2004,2005,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.
+#
+
+from gnuradio import gr, gr_unittest
+
+class test_mute (gr_unittest.TestCase):
+
+ def setUp (self):
+ self.tb = gr.top_block ()
+
+ def tearDown (self):
+ self.tb = None
+
+ def help_ii (self, src_data, exp_data, op):
+ for s in zip (range (len (src_data)), src_data):
+ src = gr.vector_source_i (s[1])
+ self.tb.connect (src, (op, s[0]))
+ dst = gr.vector_sink_i ()
+ self.tb.connect (op, dst)
+ self.tb.run ()
+ result_data = dst.data ()
+ self.assertEqual (exp_data, result_data)
+
+ def help_ff (self, src_data, exp_data, op):
+ for s in zip (range (len (src_data)), src_data):
+ src = gr.vector_source_f (s[1])
+ self.tb.connect (src, (op, s[0]))
+ dst = gr.vector_sink_f ()
+ self.tb.connect (op, dst)
+ self.tb.run ()
+ result_data = dst.data ()
+ self.assertEqual (exp_data, result_data)
+
+ def help_cc (self, src_data, exp_data, op):
+ for s in zip (range (len (src_data)), src_data):
+ src = gr.vector_source_c (s[1])
+ self.tb.connect (src, (op, s[0]))
+ dst = gr.vector_sink_c ()
+ self.tb.connect (op, dst)
+ self.tb.run ()
+ result_data = dst.data ()
+ self.assertEqual (exp_data, result_data)
+
+ def test_unmute_ii(self):
+ src_data = (1, 2, 3, 4, 5)
+ expected_result = (1, 2, 3, 4, 5)
+ op = gr.mute_ii (False)
+ self.help_ii ((src_data,), expected_result, op)
+
+ def test_mute_ii(self):
+ src_data = (1, 2, 3, 4, 5)
+ expected_result = (0, 0, 0, 0, 0)
+ op = gr.mute_ii (True)
+ self.help_ii ((src_data,), expected_result, op)
+
+ def test_unmute_cc (self):
+ src_data = (1+5j, 2+5j, 3+5j, 4+5j, 5+5j)
+ expected_result = (1+5j, 2+5j, 3+5j, 4+5j, 5+5j)
+ op = gr.mute_cc (False)
+ self.help_cc ((src_data,), expected_result, op)
+
+ def test_unmute_cc (self):
+ src_data = (1+5j, 2+5j, 3+5j, 4+5j, 5+5j)
+ expected_result = (0+0j, 0+0j, 0+0j, 0+0j, 0+0j)
+ op = gr.mute_cc (True)
+ self.help_cc ((src_data,), expected_result, op)
+
+
+if __name__ == '__main__':
+ gr_unittest.run(test_mute, "test_mute.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_nlog10.py b/gnuradio-core/src/python/gnuradio/gr/qa_nlog10.py
new file mode 100755
index 000000000..a87ed87ee
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_nlog10.py
@@ -0,0 +1,47 @@
+#!/usr/bin/env python
+#
+# Copyright 2005,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.
+#
+
+from gnuradio import gr, gr_unittest
+
+class test_nlog10(gr_unittest.TestCase):
+
+ def setUp (self):
+ self.tb = gr.top_block ()
+
+ def tearDown (self):
+ self.tb = None
+
+ def test_001(self):
+ src_data = (-10, 0, 10, 100, 1000, 10000, 100000)
+ expected_result = (-180, -180, 10, 20, 30, 40, 50)
+ src = gr.vector_source_f(src_data)
+ op = gr.nlog10_ff(10)
+ dst = gr.vector_sink_f()
+ self.tb.connect (src, op, dst)
+ self.tb.run()
+ result_data = dst.data()
+ self.assertFloatTuplesAlmostEqual (expected_result, result_data)
+
+
+if __name__ == '__main__':
+ gr_unittest.run(test_nlog10, "test_nlog10.xml")
+
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_noise.py b/gnuradio-core/src/python/gnuradio/gr/qa_noise.py
new file mode 100755
index 000000000..e87519150
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_noise.py
@@ -0,0 +1,51 @@
+#!/usr/bin/env python
+#
+# 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.
+#
+
+from gnuradio import gr, gr_unittest
+
+class test_noise_source(gr_unittest.TestCase):
+
+ def setUp (self):
+ self.tb = gr.top_block ()
+
+ def tearDown (self):
+ self.tb = None
+
+ def test_001(self):
+ # Just confirm that we can instantiate a noise source
+ op = gr.noise_source_f(gr.GR_GAUSSIAN, 10, 10)
+
+ def test_002(self):
+ # Test get methods
+ set_type = gr.GR_GAUSSIAN
+ set_ampl = 10
+ op = gr.noise_source_f(set_type, set_ampl, 10)
+ get_type = op.type()
+ get_ampl = op.amplitude()
+
+ self.assertEqual(get_type, set_type)
+ self.assertEqual(get_ampl, set_ampl)
+
+
+if __name__ == '__main__':
+ gr_unittest.run(test_noise_source, "test_noise_source.xml")
+
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_pack_k_bits.py b/gnuradio-core/src/python/gnuradio/gr/qa_pack_k_bits.py
new file mode 100755
index 000000000..25fc5e9fc
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_pack_k_bits.py
@@ -0,0 +1,67 @@
+#!/usr/bin/env python
+#
+# Copyright 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.
+#
+
+from gnuradio import gr, gr_unittest
+import random
+
+class test_pack(gr_unittest.TestCase):
+
+ def setUp(self):
+ self.tb = gr.top_block ()
+
+ def tearDown(self):
+ self.tb = None
+
+ def test_001(self):
+ src_data = (1,0,1,1,0,1,1,0)
+ expected_results = (1,0,1,1,0,1,1,0)
+ src = gr.vector_source_b(src_data,False)
+ op = gr.pack_k_bits_bb(1)
+ dst = gr.vector_sink_b()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ self.assertEqual(expected_results, dst.data())
+
+ def test_002(self):
+ src_data = (1,0,1,1,0,0,0,1)
+ expected_results = ( 2, 3, 0, 1)
+ src = gr.vector_source_b(src_data,False)
+ op = gr.pack_k_bits_bb(2)
+ dst = gr.vector_sink_b()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ #self.assertEqual(expected_results, dst.data())
+ self.assertEqual(expected_results, dst.data())
+
+ def test_003(self):
+ src_data = expected_results = map(lambda x: random.randint(0,3), range(10));
+ src = gr.vector_source_b( src_data );
+ pack = gr.pack_k_bits_bb(2);
+ unpack = gr.unpack_k_bits_bb(2);
+ snk = gr.vector_sink_b();
+ self.tb.connect(src,unpack,pack,snk);
+ self.tb.run()
+ self.assertEqual(list(expected_results), list(snk.data()));
+
+if __name__ == '__main__':
+ gr_unittest.run(test_pack, "test_pack.xml")
+
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_packed_to_unpacked.py b/gnuradio-core/src/python/gnuradio/gr/qa_packed_to_unpacked.py
new file mode 100755
index 000000000..08accd0ad
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_packed_to_unpacked.py
@@ -0,0 +1,405 @@
+#!/usr/bin/env python
+#
+# Copyright 2005,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.
+#
+
+from gnuradio import gr, gr_unittest
+import random
+
+class test_packing(gr_unittest.TestCase):
+
+ def setUp(self):
+ self.tb = gr.top_block ()
+
+ def tearDown(self):
+ self.tb = None
+
+ def test_001(self):
+ """
+ Test stream_to_streams.
+ """
+ src_data = (0x80,)
+ expected_results = (1,0,0,0,0,0,0,0)
+ src = gr.vector_source_b(src_data,False)
+ op = gr.packed_to_unpacked_bb(1, gr.GR_MSB_FIRST)
+ self.tb.connect(src, op)
+
+ dst = gr.vector_sink_b()
+ self.tb.connect(op, dst)
+
+ self.tb.run()
+
+ self.assertEqual(expected_results, dst.data())
+
+ def test_002(self):
+ """
+ Test stream_to_streams.
+ """
+ src_data = (0x80,)
+ expected_results = (0,0,0,0,0,0,0, 1)
+ src = gr.vector_source_b(src_data,False)
+ op = gr.packed_to_unpacked_bb(1, gr.GR_LSB_FIRST)
+ self.tb.connect(src, op)
+
+ dst = gr.vector_sink_b()
+ self.tb.connect(op, dst)
+
+ self.tb.run()
+
+ self.assertEqual(expected_results, dst.data())
+
+ def test_003(self):
+ """
+ Test stream_to_streams.
+ """
+ src_data = (0x11,)
+ expected_results = (4, 2)
+ src = gr.vector_source_b(src_data,False)
+ op = gr.packed_to_unpacked_bb(3, gr.GR_LSB_FIRST)
+ self.tb.connect(src, op)
+
+ dst = gr.vector_sink_b()
+ self.tb.connect(op, dst)
+
+ self.tb.run()
+
+ self.assertEqual(expected_results, dst.data())
+
+ def test_004(self):
+ """
+ Test stream_to_streams.
+ """
+ src_data = (0x11,)
+ expected_results = (0, 4)
+ src = gr.vector_source_b(src_data,False)
+ op = gr.packed_to_unpacked_bb(3, gr.GR_MSB_FIRST)
+ self.tb.connect(src, op)
+
+ dst = gr.vector_sink_b()
+ self.tb.connect(op, dst)
+
+ self.tb.run()
+
+ self.assertEqual(expected_results, dst.data())
+
+ def test_005(self):
+ """
+ Test stream_to_streams.
+ """
+ src_data = (1,0,0,0,0,0,1,0,0,1,0,1,1,0,1,0)
+ expected_results = (0x82,0x5a)
+ src = gr.vector_source_b(src_data,False)
+ op = gr.unpacked_to_packed_bb(1, gr.GR_MSB_FIRST)
+ self.tb.connect(src, op)
+
+ dst = gr.vector_sink_b()
+ self.tb.connect(op, dst)
+
+ self.tb.run()
+
+ self.assertEqual(expected_results, dst.data())
+
+ def test_006(self):
+ """
+ Test stream_to_streams.
+ """
+ src_data = (0,1,0,0,0,0,0,1,0,1,0,1,1,0,1,0)
+ expected_results = (0x82,0x5a)
+ src = gr.vector_source_b(src_data,False)
+ op = gr.unpacked_to_packed_bb(1, gr.GR_LSB_FIRST)
+ self.tb.connect(src, op)
+
+ dst = gr.vector_sink_b()
+ self.tb.connect(op, dst)
+
+ self.tb.run()
+
+ self.assertEqual(expected_results, dst.data())
+
+
+ def test_007(self):
+ """
+ Test stream_to_streams.
+ """
+ src_data = (4, 2, 0,0,0)
+ expected_results = (0x11,)
+ src = gr.vector_source_b(src_data,False)
+ op = gr.unpacked_to_packed_bb(3, gr.GR_LSB_FIRST)
+ self.tb.connect(src, op)
+
+ dst = gr.vector_sink_b()
+ self.tb.connect(op, dst)
+
+ self.tb.run()
+
+ self.assertEqual(expected_results, dst.data())
+
+ def test_008(self):
+ """
+ Test stream_to_streams.
+ """
+ src_data = (0, 4, 2,0,0)
+ expected_results = (0x11,)
+ src = gr.vector_source_b(src_data,False)
+ op = gr.unpacked_to_packed_bb(3, gr.GR_MSB_FIRST)
+ self.tb.connect(src, op)
+
+ dst = gr.vector_sink_b()
+ self.tb.connect(op, dst)
+
+ self.tb.run()
+
+ self.assertEqual(expected_results, dst.data())
+
+ def test_009(self):
+ """
+ Test stream_to_streams.
+ """
+
+ random.seed(0)
+ src_data = []
+ for i in xrange(202):
+ src_data.append((random.randint(0,255)))
+ src_data = tuple(src_data)
+ expected_results = src_data
+
+ src = gr.vector_source_b(tuple(src_data),False)
+ op1 = gr.packed_to_unpacked_bb(3, gr.GR_MSB_FIRST)
+ op2 = gr.unpacked_to_packed_bb(3, gr.GR_MSB_FIRST)
+ self.tb.connect(src, op1, op2)
+
+ dst = gr.vector_sink_b()
+ self.tb.connect(op2, dst)
+
+ self.tb.run()
+
+ self.assertEqual(expected_results[0:201], dst.data())
+
+ def test_010(self):
+ """
+ Test stream_to_streams.
+ """
+
+ random.seed(0)
+ src_data = []
+ for i in xrange(56):
+ src_data.append((random.randint(0,255)))
+ src_data = tuple(src_data)
+ expected_results = src_data
+ src = gr.vector_source_b(tuple(src_data),False)
+ op1 = gr.packed_to_unpacked_bb(7, gr.GR_MSB_FIRST)
+ op2 = gr.unpacked_to_packed_bb(7, gr.GR_MSB_FIRST)
+ self.tb.connect(src, op1, op2)
+ dst = gr.vector_sink_b()
+ self.tb.connect(op2, dst)
+
+ self.tb.run()
+ self.assertEqual(expected_results[0:201], dst.data())
+
+ def test_011(self):
+ """
+ Test stream_to_streams.
+ """
+
+ random.seed(0)
+ src_data = []
+ for i in xrange(56):
+ src_data.append((random.randint(0,255)))
+ src_data = tuple(src_data)
+ expected_results = src_data
+ src = gr.vector_source_b(tuple(src_data),False)
+ op1 = gr.packed_to_unpacked_bb(7, gr.GR_LSB_FIRST)
+ op2 = gr.unpacked_to_packed_bb(7, gr.GR_LSB_FIRST)
+ self.tb.connect(src, op1, op2)
+ dst = gr.vector_sink_b()
+ self.tb.connect(op2, dst)
+
+ self.tb.run()
+ self.assertEqual(expected_results[0:201], dst.data())
+
+
+ # tests on shorts
+
+ def test_100a(self):
+ """
+ test short version
+ """
+ random.seed(0)
+ src_data = []
+ for i in xrange(100):
+ src_data.append((random.randint(-2**15,2**15-1)))
+ src_data = tuple(src_data)
+ expected_results = src_data
+ src = gr.vector_source_s(tuple(src_data),False)
+ op1 = gr.packed_to_unpacked_ss(1, gr.GR_MSB_FIRST)
+ op2 = gr.unpacked_to_packed_ss(1, gr.GR_MSB_FIRST)
+ self.tb.connect(src, op1, op2)
+ dst = gr.vector_sink_s()
+ self.tb.connect(op2, dst)
+
+ self.tb.run()
+ self.assertEqual(expected_results, dst.data())
+
+ def test_100b(self):
+ """
+ test short version
+ """
+ random.seed(0)
+ src_data = []
+ for i in xrange(100):
+ src_data.append((random.randint(-2**15,2**15-1)))
+ src_data = tuple(src_data)
+ expected_results = src_data
+ src = gr.vector_source_s(tuple(src_data),False)
+ op1 = gr.packed_to_unpacked_ss(1, gr.GR_LSB_FIRST)
+ op2 = gr.unpacked_to_packed_ss(1, gr.GR_LSB_FIRST)
+ self.tb.connect(src, op1, op2)
+ dst = gr.vector_sink_s()
+ self.tb.connect(op2, dst)
+
+ self.tb.run()
+ self.assertEqual(expected_results, dst.data())
+
+ def test_101a(self):
+ """
+ test short version
+ """
+ random.seed(0)
+ src_data = []
+ for i in xrange(100):
+ src_data.append((random.randint(-2**15,2**15-1)))
+ src_data = tuple(src_data)
+ expected_results = src_data
+ src = gr.vector_source_s(tuple(src_data),False)
+ op1 = gr.packed_to_unpacked_ss(8, gr.GR_MSB_FIRST)
+ op2 = gr.unpacked_to_packed_ss(8, gr.GR_MSB_FIRST)
+ self.tb.connect(src, op1, op2)
+ dst = gr.vector_sink_s()
+ self.tb.connect(op2, dst)
+
+ self.tb.run()
+ self.assertEqual(expected_results, dst.data())
+
+ def test_101b(self):
+ """
+ test short version
+ """
+ random.seed(0)
+ src_data = []
+ for i in xrange(100):
+ src_data.append((random.randint(-2**15,2**15-1)))
+ src_data = tuple(src_data)
+ expected_results = src_data
+ src = gr.vector_source_s(tuple(src_data),False)
+ op1 = gr.packed_to_unpacked_ss(8, gr.GR_LSB_FIRST)
+ op2 = gr.unpacked_to_packed_ss(8, gr.GR_LSB_FIRST)
+ self.tb.connect(src, op1, op2)
+ dst = gr.vector_sink_s()
+ self.tb.connect(op2, dst)
+
+ self.tb.run()
+ self.assertEqual(expected_results, dst.data())
+
+ # tests on ints
+
+ def test_200a(self):
+ """
+ test int version
+ """
+ random.seed(0)
+ src_data = []
+ for i in xrange(100):
+ src_data.append((random.randint(-2**31,2**31-1)))
+ src_data = tuple(src_data)
+ expected_results = src_data
+ src = gr.vector_source_i(tuple(src_data),False)
+ op1 = gr.packed_to_unpacked_ii(1, gr.GR_MSB_FIRST)
+ op2 = gr.unpacked_to_packed_ii(1, gr.GR_MSB_FIRST)
+ self.tb.connect(src, op1, op2)
+ dst = gr.vector_sink_i()
+ self.tb.connect(op2, dst)
+
+ self.tb.run()
+ self.assertEqual(expected_results, dst.data())
+
+ def test_200b(self):
+ """
+ test int version
+ """
+ random.seed(0)
+ src_data = []
+ for i in xrange(100):
+ src_data.append((random.randint(-2**31,2**31-1)))
+ src_data = tuple(src_data)
+ expected_results = src_data
+ src = gr.vector_source_i(tuple(src_data),False)
+ op1 = gr.packed_to_unpacked_ii(1, gr.GR_LSB_FIRST)
+ op2 = gr.unpacked_to_packed_ii(1, gr.GR_LSB_FIRST)
+ self.tb.connect(src, op1, op2)
+ dst = gr.vector_sink_i()
+ self.tb.connect(op2, dst)
+
+ self.tb.run()
+ self.assertEqual(expected_results, dst.data())
+
+ def test_201a(self):
+ """
+ test int version
+ """
+ random.seed(0)
+ src_data = []
+ for i in xrange(100):
+ src_data.append((random.randint(-2**31,2**31-1)))
+ src_data = tuple(src_data)
+ expected_results = src_data
+ src = gr.vector_source_i(tuple(src_data),False)
+ op1 = gr.packed_to_unpacked_ii(8, gr.GR_MSB_FIRST)
+ op2 = gr.unpacked_to_packed_ii(8, gr.GR_MSB_FIRST)
+ self.tb.connect(src, op1, op2)
+ dst = gr.vector_sink_i()
+ self.tb.connect(op2, dst)
+
+ self.tb.run()
+ self.assertEqual(expected_results, dst.data())
+
+ def test_201b(self):
+ """
+ test int version
+ """
+ random.seed(0)
+ src_data = []
+ for i in xrange(100):
+ src_data.append((random.randint(-2**31,2**31-1)))
+ src_data = tuple(src_data)
+ expected_results = src_data
+ src = gr.vector_source_i(tuple(src_data),False)
+ op1 = gr.packed_to_unpacked_ii(8, gr.GR_LSB_FIRST)
+ op2 = gr.unpacked_to_packed_ii(8, gr.GR_LSB_FIRST)
+ self.tb.connect(src, op1, op2)
+ dst = gr.vector_sink_i()
+ self.tb.connect(op2, dst)
+
+ self.tb.run()
+ self.assertEqual(expected_results, dst.data())
+
+
+if __name__ == '__main__':
+ gr_unittest.run(test_packing, "test_packing.xml")
+
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_pdu.py b/gnuradio-core/src/python/gnuradio/gr/qa_pdu.py
new file mode 100755
index 000000000..098aabb4a
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_pdu.py
@@ -0,0 +1,109 @@
+#!/usr/bin/env python
+#
+# 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.
+#
+
+from gnuradio import gr, gr_unittest
+import pmt
+import time
+
+class test_pdu(gr_unittest.TestCase):
+
+ def setUp(self):
+ self.tb = gr.top_block()
+
+ def tearDown(self):
+ self.tb = None
+
+ def test_000(self):
+ # Just run some data through and make sure it doesn't puke.
+ src_data = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
+
+ src = gr.pdu_to_tagged_stream(gr.pdu_byte)
+ snk3 = gr.tagged_stream_to_pdu(gr.pdu_byte)
+ snk2 = gr.vector_sink_b()
+ snk = gr.tag_debug(1, "test")
+
+ dbg = gr.message_debug()
+
+ # Test that the right number of ports exist.
+ pi = dbg.message_ports_in()
+ po = dbg.message_ports_out()
+ self.assertEqual(pmt.pmt_length(pi), 3)
+ self.assertEqual(pmt.pmt_length(po), 0)
+
+ pi = snk3.message_ports_in()
+ po = snk3.message_ports_out()
+ self.assertEqual(pmt.pmt_length(pi), 0)
+ self.assertEqual(pmt.pmt_length(po), 1)
+
+ #print "Message Debug input ports: "
+ #pmt.pmt_print(pi)
+ #print "Message Debug output ports: "
+ #pmt.pmt_print(po)
+
+ #print "Stream to PDU input ports: "
+ #pmt.pmt_print(pi)
+ #print "Stream to PDU output ports: "
+ #pmt.pmt_print(po)
+
+ self.tb.connect(src, snk)
+ self.tb.connect(src, snk2)
+ self.tb.connect(src, snk3)
+
+ self.tb.msg_connect(snk3, "pdus", dbg, "store")
+ self.tb.start()
+
+ # make our reference and message pmts
+ port = pmt.pmt_intern("pdus")
+ msg = pmt.pmt_cons( pmt.PMT_NIL, pmt.pmt_make_u8vector(16, 0xFF) )
+
+ #print "printing port & msg"
+ #pmt.pmt_print(port)
+ #pmt.pmt_print(msg)
+
+ # post the message
+ src.to_basic_block()._post( port, msg )
+
+ while(dbg.num_messages() < 1):
+ time.sleep(0.1)
+ self.tb.stop()
+ self.tb.wait()
+
+ # Get the vector of data from the vector sink
+ result_data = snk2.data()
+
+ # Get the vector of data from the message sink
+ # Convert the message PMT as a pair into its vector
+ result_msg = dbg.get_message(0)
+ msg_vec = pmt.pmt_cdr(result_msg)
+ pmt.pmt_print(msg_vec)
+
+ # Convert the PMT vector into a Python list
+ msg_data = []
+ for i in xrange(16):
+ msg_data.append(pmt.pmt_u8vector_ref(msg_vec, i))
+
+ actual_data = 16*[0xFF,]
+ self.assertEqual(actual_data, list(result_data))
+ self.assertEqual(actual_data, msg_data)
+
+if __name__ == '__main__':
+ gr_unittest.run(test_pdu, "test_pdu.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_pipe_fittings.py b/gnuradio-core/src/python/gnuradio/gr/qa_pipe_fittings.py
new file mode 100755
index 000000000..1f24062b1
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_pipe_fittings.py
@@ -0,0 +1,143 @@
+#!/usr/bin/env python
+#
+# Copyright 2005,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.
+#
+
+from gnuradio import gr, gr_unittest
+
+if 0:
+ import os
+ print "pid =", os.getpid()
+ raw_input("Attach, then press Enter to continue")
+
+
+def calc_expected_result(src_data, n):
+ assert (len(src_data) % n) == 0
+ result = [list() for x in range(n)]
+ #print "len(result) =", len(result)
+ for i in xrange(len(src_data)):
+ (result[i % n]).append(src_data[i])
+ return [tuple(x) for x in result]
+
+
+class test_pipe_fittings(gr_unittest.TestCase):
+
+ def setUp(self):
+ self.tb = gr.top_block ()
+
+ def tearDown(self):
+ self.tb = None
+
+ def test_001(self):
+ """
+ Test stream_to_streams.
+ """
+ n = 8
+ src_len = n * 8
+ src_data = range(src_len)
+
+ expected_results = calc_expected_result(src_data, n)
+ #print "expected results: ", expected_results
+ src = gr.vector_source_i(src_data)
+ op = gr.stream_to_streams(gr.sizeof_int, n)
+ self.tb.connect(src, op)
+
+ dsts = []
+ for i in range(n):
+ dst = gr.vector_sink_i()
+ self.tb.connect((op, i), (dst, 0))
+ dsts.append(dst)
+
+ self.tb.run()
+
+ for d in range(n):
+ self.assertEqual(expected_results[d], dsts[d].data())
+
+ def test_002(self):
+ """
+ Test streams_to_stream (using stream_to_streams).
+ """
+ n = 8
+ src_len = n * 8
+ src_data = tuple(range(src_len))
+ expected_results = src_data
+
+ src = gr.vector_source_i(src_data)
+ op1 = gr.stream_to_streams(gr.sizeof_int, n)
+ op2 = gr.streams_to_stream(gr.sizeof_int, n)
+ dst = gr.vector_sink_i()
+
+ self.tb.connect(src, op1)
+ for i in range(n):
+ self.tb.connect((op1, i), (op2, i))
+ self.tb.connect(op2, dst)
+
+ self.tb.run()
+ self.assertEqual(expected_results, dst.data())
+
+ def test_003(self):
+ """
+ Test streams_to_vector (using stream_to_streams & vector_to_stream).
+ """
+ n = 8
+ src_len = n * 8
+ src_data = tuple(range(src_len))
+ expected_results = src_data
+
+ src = gr.vector_source_i(src_data)
+ op1 = gr.stream_to_streams(gr.sizeof_int, n)
+ op2 = gr.streams_to_vector(gr.sizeof_int, n)
+ op3 = gr.vector_to_stream(gr.sizeof_int, n)
+ dst = gr.vector_sink_i()
+
+ self.tb.connect(src, op1)
+ for i in range(n):
+ self.tb.connect((op1, i), (op2, i))
+ self.tb.connect(op2, op3, dst)
+
+ self.tb.run()
+ self.assertEqual(expected_results, dst.data())
+
+ def test_004(self):
+ """
+ Test vector_to_streams.
+ """
+ n = 8
+ src_len = n * 8
+ src_data = tuple(range(src_len))
+ expected_results = src_data
+
+ src = gr.vector_source_i(src_data)
+ op1 = gr.stream_to_vector(gr.sizeof_int, n)
+ op2 = gr.vector_to_streams(gr.sizeof_int, n)
+ op3 = gr.streams_to_stream(gr.sizeof_int, n)
+ dst = gr.vector_sink_i()
+
+ self.tb.connect(src, op1, op2)
+ for i in range(n):
+ self.tb.connect((op2, i), (op3, i))
+ self.tb.connect(op3, dst)
+
+ self.tb.run()
+ self.assertEqual(expected_results, dst.data())
+
+if __name__ == '__main__':
+ gr_unittest.run(test_pipe_fittings, "test_pipe_fittings.xml")
+
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_pll_carriertracking.py b/gnuradio-core/src/python/gnuradio/gr/qa_pll_carriertracking.py
new file mode 100755
index 000000000..8964db53d
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_pll_carriertracking.py
@@ -0,0 +1,156 @@
+#!/usr/bin/env python
+#
+# Copyright 2004,2007,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.
+#
+
+from gnuradio import gr, gr_unittest
+import math
+
+class test_pll_carriertracking (gr_unittest.TestCase):
+
+ def setUp (self):
+ self.tb = gr.top_block()
+
+ def tearDown (self):
+ self.tb = None
+
+ def test_pll_carriertracking (self):
+ expected_result = ((1.00000238419+7.21919457547e-09j),
+ (0.998025715351+0.062790453434j),
+ (0.992777824402+0.119947694242j),
+ (0.985192835331+0.171441286802j),
+ (0.976061582565+0.217501848936j),
+ (0.966034710407+0.258409559727j),
+ (0.95565611124+0.294477283955j),
+ (0.945357382298+0.326030552387j),
+ (0.935475051403+0.353395611048j),
+ (0.926258146763+0.376889169216j),
+ (0.917895197868+0.39681750536j),
+ (0.910515546799+0.413470208645j),
+ (0.904196679592+0.427117019892j),
+ (0.898972511292+0.438006043434j),
+ (0.894769787788+0.446523308754j),
+ (0.891652584076+0.452715367079j),
+ (0.8895829916+0.456773489714j),
+ (0.888502895832+0.458873122931j),
+ (0.888343691826+0.459175437689j),
+ (0.889035582542+0.457833081484j),
+ (0.890497922897+0.454985737801j),
+ (0.892645597458+0.450762689114j),
+ (0.895388305187+0.445282936096j),
+ (0.898648142815+0.438664674759j),
+ (0.902342617512+0.431016951799j),
+ (0.906392872334+0.422441422939j),
+ (0.910642921925+0.413191765547j),
+ (0.915039420128+0.403358519077j),
+ (0.919594764709+0.392864197493j),
+ (0.92425006628+0.381792247295j),
+ (0.928944349289+0.370217680931j),
+ (0.933634519577+0.358220815659j),
+ (0.938279032707+0.345874190331j),
+ (0.942840516567+0.333247303963j),
+ (0.947280526161+0.32040438056j),
+ (0.951574921608+0.307409763336j),
+ (0.955703914165+0.294323593378j),
+ (0.959648966789+0.281201630831j),
+ (0.963392794132+0.268095195293j),
+ (0.966880619526+0.255221515894j),
+ (0.970162451267+0.242447137833j),
+ (0.973235487938+0.229809194803j),
+ (0.97609680891+0.217341512442j),
+ (0.978744983673+0.20507311821j),
+ (0.981189727783+0.193033605814j),
+ (0.983436584473+0.181248426437j),
+ (0.985490739346+0.169738590717j),
+ (0.987353682518+0.158523857594j),
+ (0.989041447639+0.147622272372j),
+ (0.990563035011+0.137049794197j),
+ (0.991928339005+0.126818582416j),
+ (0.993117690086+0.117111675441j),
+ (0.994156062603+0.107930034399j),
+ (0.995076179504+0.0990980416536j),
+ (0.995887458324+0.0906178802252j),
+ (0.996591091156+0.0824909061193j),
+ (0.997202515602+0.0747182965279j),
+ (0.997730851173+0.0672992765903j),
+ (0.998185396194+0.0602316558361j),
+ (0.99856698513+0.0535135567188j),
+ (0.998885989189+0.0471420884132j),
+ (0.99915266037+0.0411129891872j),
+ (0.999372899532+0.0354214012623j),
+ (0.999548316002+0.0300626158714j),
+ (0.999680638313+0.0252036750317j),
+ (0.999784469604+0.020652115345j),
+ (0.999865531921+0.0163950324059j),
+ (0.999923825264+0.0124222636223j),
+ (0.999960243702+0.00872156023979j),
+ (0.999983668327+0.00528120994568j),
+ (0.999997138977+0.00209015607834j),
+ (1.00000119209-0.00086285173893j),
+ (0.999992132187-0.00358882546425j),
+ (0.999979138374-0.00609711557627j),
+ (0.999963641167-0.00839691981673j),
+ (0.999947249889-0.0104993218556j),
+ (0.999924004078-0.0122378543019j),
+ (0.999904811382-0.0136305987835j),
+ (0.999888062477-0.0148707330227j),
+ (0.9998742342-0.0159679055214j),
+ (0.999856114388-0.0169314742088j),
+ (0.999839782715-0.0177700817585j),
+ (0.999826967716-0.0184917747974j),
+ (0.999818325043-0.0191045701504j),
+ (0.999807476997-0.0196143388748j),
+ (0.999797284603-0.0200265944004j),
+ (0.999791204929-0.0203481912613j),
+ (0.99978852272-0.0205836892128j),
+ (0.99978530407-0.0207380950451j),
+ (0.999785065651-0.0206423997879j),
+ (0.999787807465-0.0204866230488j),
+ (0.999794304371-0.0202808082104j),
+ (0.999800384045-0.0200312435627j),
+ (0.999803245068-0.0197458267212j),
+ (0.9998087883-0.0194311738014j),
+ (0.999816894531-0.0190933048725j),
+ (0.999825954437-0.0187371373177j),
+ (0.999829888344-0.0183679759502j),
+ (0.999835848808-0.017987690866j),
+ (0.999844014645-0.0176006518304j))
+
+ sampling_freq = 10e3
+ freq = sampling_freq / 100
+
+ loop_bw = math.pi/100.0
+ maxf = 1
+ minf = -1
+
+ src = gr.sig_source_c (sampling_freq, gr.GR_COS_WAVE, freq, 1.0)
+ pll = gr.pll_carriertracking_cc(loop_bw, maxf, minf)
+ head = gr.head (gr.sizeof_gr_complex, int (freq))
+ dst = gr.vector_sink_c ()
+
+ self.tb.connect (src, pll, head)
+ self.tb.connect (head, dst)
+
+ self.tb.run ()
+ dst_data = dst.data ()
+ self.assertComplexTuplesAlmostEqual (expected_result, dst_data, 5)
+
+if __name__ == '__main__':
+ gr_unittest.run(test_pll_carriertracking, "test_pll_carriertracking.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_pll_freqdet.py b/gnuradio-core/src/python/gnuradio/gr/qa_pll_freqdet.py
new file mode 100755
index 000000000..219e9b84b
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_pll_freqdet.py
@@ -0,0 +1,160 @@
+#!/usr/bin/env python
+#
+# Copyright 2004,2007,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.
+#
+
+from gnuradio import gr, gr_unittest
+import math
+
+class test_pll_freqdet (gr_unittest.TestCase):
+
+ def setUp (self):
+ self.tb = gr.top_block()
+
+ def tearDown (self):
+ self.tb = None
+
+ def test_pll_freqdet (self):
+ expected_result = (0.0,
+ 4.33888922882e-08,
+ 0.367369994515,
+ 1.08135249597,
+ 2.10983253908,
+ 3.42221529438,
+ 4.98940390402,
+ 6.78379190842,
+ 8.77923286024,
+ 10.9510106794,
+ 13.2758363182,
+ 15.7317829127,
+ 18.2982902299,
+ 20.9561068599,
+ 23.6755271122,
+ 26.452952094,
+ 29.2731265301,
+ 32.1219053479,
+ 34.9862418188,
+ 37.8540971414,
+ 40.7144315483,
+ 43.5571390869,
+ 46.3730179743,
+ 49.1537231663,
+ 51.8917218889,
+ 54.58026103,
+ 57.2015358514,
+ 59.7513664199,
+ 62.2380533124,
+ 64.657612252,
+ 67.006640002,
+ 69.2822432184,
+ 71.4820384499,
+ 73.6041047056,
+ 75.6469478817,
+ 77.6094829742,
+ 79.4909866472,
+ 81.2911031615,
+ 83.0097850853,
+ 84.6355598352,
+ 86.1820937186,
+ 87.6504420946,
+ 89.0418441206,
+ 90.3577286819,
+ 91.5996432431,
+ 92.7692775646,
+ 93.8684162704,
+ 94.8989269904,
+ 95.8627662892,
+ 96.7619381633,
+ 97.598505899,
+ 98.362769679,
+ 99.0579904444,
+ 99.6992633875,
+ 100.288805948,
+ 100.828805921,
+ 101.321421457,
+ 101.76878699,
+ 102.17300138,
+ 102.536116055,
+ 102.860158727,
+ 103.147085962,
+ 103.398830608,
+ 103.617254366,
+ 103.792467691,
+ 103.939387906,
+ 104.060030865,
+ 104.15631756,
+ 104.230085975,
+ 104.283067372,
+ 104.316933727,
+ 104.333238432,
+ 104.333440018,
+ 104.318914008,
+ 104.290941063,
+ 104.250742554,
+ 104.187634452,
+ 104.103822339,
+ 104.013227468,
+ 103.916810336,
+ 103.815448432,
+ 103.709936239,
+ 103.600997093,
+ 103.489283183,
+ 103.375351833,
+ 103.259712936,
+ 103.142828952,
+ 103.025091195,
+ 102.90686726,
+ 102.776726069,
+ 102.648078982,
+ 102.521459607,
+ 102.397294831,
+ 102.275999684,
+ 102.157882471,
+ 102.043215927,
+ 101.93218978,
+ 101.824958181,
+ 101.72159228,
+ 101.622151366)
+
+ sampling_freq = 10e3
+ freq = sampling_freq / 100
+
+ loop_bw = math.pi/100.0
+ maxf = 1
+ minf = -1
+
+ src = gr.sig_source_c (sampling_freq, gr.GR_COS_WAVE, freq, 1.0)
+ pll = gr.pll_freqdet_cf(loop_bw, maxf, minf)
+ head = gr.head (gr.sizeof_float, int (freq))
+ dst = gr.vector_sink_f ()
+
+ self.tb.connect (src, pll, head)
+ self.tb.connect (head, dst)
+
+ self.tb.run ()
+ dst_data = dst.data ()
+
+ # convert it from normalized frequency to absolute frequency (Hz)
+ dst_data = [i*(sampling_freq/(2*math.pi)) for i in dst_data]
+
+ self.assertFloatTuplesAlmostEqual (expected_result, dst_data, 3)
+
+if __name__ == '__main__':
+ gr_unittest.run(test_pll_freqdet, "test_pll_freqdet.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_pll_refout.py b/gnuradio-core/src/python/gnuradio/gr/qa_pll_refout.py
new file mode 100755
index 000000000..f319f6381
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_pll_refout.py
@@ -0,0 +1,156 @@
+#!/usr/bin/env python
+#
+# 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.
+#
+
+from gnuradio import gr, gr_unittest
+import math
+
+class test_pll_refout (gr_unittest.TestCase):
+
+ def setUp (self):
+ self.tb = gr.top_block()
+
+ def tearDown (self):
+ self.tb = None
+
+ def test_pll_refout (self):
+ expected_result = ((1+0j),
+ (1+6.4087357643e-10j),
+ (0.999985277653+0.00542619498447j),
+ (0.999868750572+0.0162021834403j),
+ (0.99948567152+0.0320679470897j),
+ (0.99860727787+0.0527590736747j),
+ (0.996953129768+0.0780025869608j),
+ (0.994203746319+0.107512556016j),
+ (0.990011692047+0.140985429287j),
+ (0.984013140202+0.178095817566j),
+ (0.975838363171+0.218493551016j),
+ (0.965121984482+0.261800557375j),
+ (0.95151245594+0.307610183954j),
+ (0.934681296349+0.355486690998j),
+ (0.914401650429+0.404808044434j),
+ (0.890356600285+0.455263823271j),
+ (0.862329125404+0.506348133087j),
+ (0.830152392387+0.557536482811j),
+ (0.793714106083+0.608290970325j),
+ (0.752960026264+0.658066213131j),
+ (0.707896590233+0.706316053867j),
+ (0.658591926098+0.752500295639j),
+ (0.605175673962+0.796091973782j),
+ (0.547837555408+0.836584687233j),
+ (0.48682525754+0.873499393463j),
+ (0.42244040966+0.906390726566j),
+ (0.355197101831+0.934791445732j),
+ (0.285494059324+0.958380460739j),
+ (0.213591173291+0.976923108101j),
+ (0.139945343137+0.990159213543j),
+ (0.065038472414+0.997882783413j),
+ (-0.0106285437942+0.999943494797j),
+ (-0.0865436866879+0.996248066425j),
+ (-0.162189796567+0.986759603024j),
+ (-0.23705175519+0.971496999264j),
+ (-0.310622543097+0.950533330441j),
+ (-0.38240903616+0.923993110657j),
+ (-0.451937526464+0.89204955101j),
+ (-0.518758952618+0.854920566082j),
+ (-0.582311093807+0.812966048717j),
+ (-0.642372369766+0.76639264822j),
+ (-0.698591887951+0.715520322323j),
+ (-0.750654160976+0.660695314407j),
+ (-0.798280358315+0.602286040783j),
+ (-0.841228663921+0.540679454803j),
+ (-0.87929558754+0.476276367903j),
+ (-0.912315964699+0.409486919641j),
+ (-0.940161883831+0.340728074312j),
+ (-0.962742805481+0.270418733358j),
+ (-0.980004072189+0.198977485299j),
+ (-0.991925954819+0.126818284392j),
+ (-0.99851256609+0.0545223206282j),
+ (-0.999846458435-0.0175215266645j),
+ (-0.996021270752-0.0891158208251j),
+ (-0.987133920193-0.159895718098j),
+ (-0.973306238651-0.2295101583j),
+ (-0.954683184624-0.297624111176j),
+ (-0.931430280209-0.363919824362j),
+ (-0.903732538223-0.428097635508j),
+ (-0.871792256832-0.489875763655j),
+ (-0.835827112198-0.548992812634j),
+ (-0.796068251133-0.605206847191j),
+ (-0.752758979797-0.658296227455j),
+ (-0.706152498722-0.70805978775j),
+ (-0.656641483307-0.754202902317j),
+ (-0.604367733002-0.79670548439j),
+ (-0.549597978592-0.835429251194j),
+ (-0.492602348328-0.870254516602j),
+ (-0.433654457331-0.901079237461j),
+ (-0.373029649258-0.927819430828j),
+ (-0.31100410223-0.950408577919j),
+ (-0.247853919864-0.968797445297j),
+ (-0.183855071664-0.982953369617j),
+ (-0.119282215834-0.992860376835j),
+ (-0.0544078871608-0.998518764973j),
+ (0.0104992967099-0.999944865704j),
+ (0.0749994292855-0.997183561325j),
+ (0.138844624162-0.990314185619j),
+ (0.201967850327-0.979392170906j),
+ (0.264124274254-0.964488625526j),
+ (0.325075358152-0.945688128471j),
+ (0.3845885396-0.92308807373j),
+ (0.442438393831-0.89679890871j),
+ (0.498407125473-0.866943061352j),
+ (0.552284479141-0.833655714989j),
+ (0.603869199753-0.797083437443j),
+ (0.652970373631-0.757383465767j),
+ (0.69940674305-0.714723825455j),
+ (0.743007957935-0.66928255558j),
+ (0.78350687027-0.62138313055j),
+ (0.820889055729-0.571087777615j),
+ (0.855021059513-0.51859331131j),
+ (0.885780930519-0.46410369873j),
+ (0.913058102131-0.407829582691j),
+ (0.936754107475-0.349988251925j),
+ (0.956783294678-0.290801793337j),
+ (0.973072886467-0.230497643352j),
+ (0.985563337803-0.169307261705j),
+ (0.9942086339-0.1074674353j),
+ (0.9989772439-0.0452152714133j))
+
+ sampling_freq = 10e3
+ freq = sampling_freq / 100
+
+ loop_bw = math.pi/100.0
+ maxf = 1
+ minf = -1
+
+ src = gr.sig_source_c (sampling_freq, gr.GR_COS_WAVE, freq, 1.0)
+ pll = gr.pll_refout_cc(loop_bw, maxf, minf)
+ head = gr.head (gr.sizeof_gr_complex, int (freq))
+ dst = gr.vector_sink_c ()
+
+ self.tb.connect (src, pll, head)
+ self.tb.connect (head, dst)
+
+ self.tb.run ()
+ dst_data = dst.data ()
+ self.assertComplexTuplesAlmostEqual (expected_result, dst_data, 4)
+
+if __name__ == '__main__':
+ gr_unittest.run(test_pll_refout, "test_pll_refout.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_pn_correlator_cc.py b/gnuradio-core/src/python/gnuradio/gr/qa_pn_correlator_cc.py
new file mode 100755
index 000000000..6a62a6997
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_pn_correlator_cc.py
@@ -0,0 +1,50 @@
+#!/usr/bin/env python
+#
+# 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.
+#
+
+from gnuradio import gr, gr_unittest
+
+class test_pn_correlator_cc(gr_unittest.TestCase):
+
+ def setUp(self):
+ self.tb = gr.top_block ()
+
+ def tearDown(self):
+ self.tb = None
+
+ def test_000_make(self):
+ c = gr.pn_correlator_cc(10)
+
+ def test_001_correlate(self):
+ degree = 10
+ length = 2**degree-1
+ src = gr.glfsr_source_f(degree)
+ head = gr.head(gr.sizeof_float, length*length)
+ f2c = gr.float_to_complex()
+ corr = gr.pn_correlator_cc(degree)
+ dst = gr.vector_sink_c()
+ self.tb.connect(src, head, f2c, corr, dst)
+ self.tb.run()
+ data = dst.data()
+ self.assertEqual(data[-1], (1.0+0j))
+
+if __name__ == '__main__':
+ gr_unittest.run(test_pn_correlator_cc, "test_pn_correlator_cc.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_probe_signal.py b/gnuradio-core/src/python/gnuradio/gr/qa_probe_signal.py
new file mode 100644
index 000000000..4e10afdb6
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_probe_signal.py
@@ -0,0 +1,67 @@
+#!/usr/bin/env python
+#
+# 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.
+#
+
+import time
+
+from gnuradio import gr, gr_unittest
+
+class test_probe_signal (gr_unittest.TestCase):
+
+ def setUp (self):
+ self.tb = gr.top_block()
+
+ def tearDown (self):
+ self.tb = None
+
+ def test_001(self):
+
+ value = 12.3
+ repeats = 100
+ src_data = [value] * repeats
+
+ src = gr.vector_source_f(src_data)
+ dst = gr.probe_signal_f()
+
+ self.tb.connect(src, dst)
+ self.tb.run()
+ output = dst.level()
+ self.assertAlmostEqual(value, output, places=6)
+
+ def test_002(self):
+
+ vector_length = 10
+ repeats = 10
+ value = [0.5+i for i in range(0, vector_length)]
+ src_data = value * repeats
+
+ src = gr.vector_source_f(src_data)
+ s2v = gr.stream_to_vector(gr.sizeof_float, vector_length)
+ dst = gr.probe_signal_vf(vector_length)
+
+ self.tb.connect(src, s2v, dst)
+ self.tb.run()
+ output = dst.level()
+ self.assertEqual(len(output), vector_length)
+ self.assertAlmostEqual(value[3], output[3], places=6)
+
+if __name__ == '__main__':
+ gr_unittest.run(test_probe_signal, "test_probe_signal.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_python_message_passing.py b/gnuradio-core/src/python/gnuradio/gr/qa_python_message_passing.py
new file mode 100644
index 000000000..06bb96947
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_python_message_passing.py
@@ -0,0 +1,123 @@
+#!/usr/bin/env python
+#
+# Copyright 2013 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 gnuradio import gr, gr_unittest
+try: import pmt
+except: from gruel import pmt
+import numpy
+import time
+
+# Simple block to generate messages
+class message_generator(gr.sync_block):
+ def __init__(self, msg_list, msg_interval):
+ gr.sync_block.__init__(
+ self,
+ name = "message generator",
+ in_sig = [numpy.float32],
+ out_sig = None
+ )
+ self.msg_list = msg_list
+ self.msg_interval = msg_interval
+ self.msg_ctr = 0
+ self.message_port_register_out(pmt.pmt_intern('out_port'))
+
+
+ def work(self, input_items, output_items):
+ inLen = len(input_items[0])
+ while self.msg_ctr < len(self.msg_list) and \
+ (self.msg_ctr * self.msg_interval) < \
+ (self.nitems_read(0) + inLen):
+ self.message_port_pub(pmt.pmt_intern('out_port'),
+ self.msg_list[self.msg_ctr])
+ self.msg_ctr += 1
+ return inLen
+
+# Simple block to consume messages
+class message_consumer(gr.sync_block):
+ def __init__(self):
+ gr.sync_block.__init__(
+ self,
+ name = "message consumer",
+ in_sig = None,
+ out_sig = None
+ )
+ self.msg_list = []
+ self.message_port_register_in(pmt.pmt_intern('in_port'))
+ self.set_msg_handler(pmt.pmt_intern('in_port'),
+ self.handle_msg)
+
+ def handle_msg(self, msg):
+ # Create a new PMT from long value and put in list
+ self.msg_list.append(pmt.pmt_from_long(pmt.pmt_to_long(msg)))
+
+class test_python_message_passing(gr_unittest.TestCase):
+
+ def setUp(self):
+ self.tb = gr.top_block()
+
+ def tearDown(self):
+ self.tb = None
+
+ def test_000(self):
+ num_msgs = 10
+ msg_interval = 1000
+ msg_list = []
+ for i in range(num_msgs):
+ msg_list.append(pmt.pmt_from_long(i))
+
+ # Create vector source with dummy data to trigger messages
+ src_data = []
+ for i in range(num_msgs*msg_interval):
+ src_data.append(float(i))
+ src = gr.vector_source_f(src_data, False)
+ msg_gen = message_generator(msg_list, msg_interval)
+ msg_cons = message_consumer()
+
+ # Connect vector source to message gen
+ self.tb.connect(src, msg_gen)
+
+ # Connect message generator to message consumer
+ self.tb.msg_connect(msg_gen, 'out_port', msg_cons, 'in_port')
+
+ # Verify that the messgae port query functions work
+ self.assertEqual(pmt.pmt_symbol_to_string(pmt.pmt_vector_ref(
+ msg_gen.message_ports_out(), 0)), 'out_port')
+ self.assertEqual(pmt.pmt_symbol_to_string(pmt.pmt_vector_ref(
+ msg_cons.message_ports_in(), 0)), 'in_port')
+
+ # Run to verify message passing
+ self.tb.start()
+
+ # Wait for all messages to be sent
+ while msg_gen.msg_ctr < num_msgs:
+ time.sleep(0.5)
+ self.tb.stop()
+ self.tb.wait()
+
+ # Verify that the message consumer got all the messages
+ self.assertEqual(num_msgs, len(msg_cons.msg_list))
+ for i in range(num_msgs):
+ self.assertTrue(pmt.pmt_equal(msg_list[i], msg_cons.msg_list[i]))
+
+if __name__ == '__main__':
+ gr_unittest.run(test_python_message_passing,
+ 'test_python_message_passing.xml')
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_rational_resampler.py b/gnuradio-core/src/python/gnuradio/gr/qa_rational_resampler.py
new file mode 100755
index 000000000..cc963d757
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_rational_resampler.py
@@ -0,0 +1,298 @@
+#!/usr/bin/env python
+#
+# Copyright 2005,2006,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.
+#
+
+from gnuradio import gr, gr_unittest
+from gnuradio import blks2
+import math
+import random
+import sys
+
+#import os
+#print os.getpid()
+#raw_input('Attach with gdb, then press Enter: ')
+
+
+def random_floats(n):
+ r = []
+ for x in xrange(n):
+ r.append(float(random.randint(-32768, 32768)))
+ return tuple(r)
+
+
+def reference_dec_filter(src_data, decim, taps):
+ tb = gr.top_block()
+ src = gr.vector_source_f(src_data)
+ op = gr.fir_filter_fff(decim, taps)
+ dst = gr.vector_sink_f()
+ tb.connect(src, op, dst)
+ tb.run()
+ result_data = dst.data()
+ tb = None
+ return result_data
+
+def reference_interp_filter(src_data, interp, taps):
+ tb = gr.top_block()
+ src = gr.vector_source_f(src_data)
+ op = gr.interp_fir_filter_fff(interp, taps)
+ dst = gr.vector_sink_f()
+ tb.connect(src, op, dst)
+ tb.run()
+ result_data = dst.data()
+ tb = None
+ return result_data
+
+def reference_interp_dec_filter(src_data, interp, decim, taps):
+ tb = gr.top_block()
+ src = gr.vector_source_f(src_data)
+ up = gr.interp_fir_filter_fff(interp, (1,))
+ dn = gr.fir_filter_fff(decim, taps)
+ dst = gr.vector_sink_f()
+ tb.connect(src, up, dn, dst)
+ tb.run()
+ result_data = dst.data()
+ tb = None
+ return result_data
+
+
+class test_rational_resampler (gr_unittest.TestCase):
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ #
+ # test the gr.rational_resampler_base primitives...
+ #
+
+ def test_000_1_to_1(self):
+ taps = (-4, 5)
+ src_data = (234, -4, 23, -56, 45, 98, -23, -7)
+ xr = (-936, 1186, -112, 339, -460, -167, 582)
+ expected_result = tuple([float(x) for x in xr])
+
+ tb = gr.top_block()
+ src = gr.vector_source_f(src_data)
+ op = gr.rational_resampler_base_fff(1, 1, taps)
+ dst = gr.vector_sink_f()
+ tb.connect(src, op)
+ tb.connect(op, dst)
+ tb.run()
+ result_data = dst.data()
+ self.assertEqual(expected_result, result_data)
+
+ def test_001_interp(self):
+ taps = [1, 10, 100, 1000, 10000]
+ src_data = (0, 2, 3, 5, 7, 11, 13, 17)
+ interpolation = 3
+ xr = (0,0,0,0,2,20,200,2003,20030,300,3005,30050,500,5007,50070,700,7011,70110,1100,11013,110130,1300,13017,130170,1700.0,17000.0,170000.0)
+ expected_result = tuple([float(x) for x in xr])
+
+ tb = gr.top_block()
+ src = gr.vector_source_f(src_data)
+ op = gr.rational_resampler_base_fff(interpolation, 1, taps)
+ dst = gr.vector_sink_f()
+ tb.connect(src, op)
+ tb.connect(op, dst)
+ tb.run()
+ result_data = dst.data()
+ self.assertEqual(expected_result, result_data)
+
+ def test_002_interp(self):
+ taps = random_floats(31)
+ #src_data = random_floats(10000) # FIXME the 10k case fails!
+ src_data = random_floats(1000)
+ interpolation = 3
+
+ expected_result = reference_interp_filter(src_data, interpolation, taps)
+
+ tb = gr.top_block()
+ src = gr.vector_source_f(src_data)
+ op = gr.rational_resampler_base_fff(interpolation, 1, taps)
+ dst = gr.vector_sink_f()
+ tb.connect(src, op)
+ tb.connect(op, dst)
+ tb.run()
+ result_data = dst.data()
+
+ L1 = len(result_data)
+ L2 = len(expected_result)
+ L = min(L1, L2)
+ if False:
+ sys.stderr.write('delta = %2d: ntaps = %d interp = %d ilen = %d\n' %
+ (L2 - L1, len(taps), interpolation, len(src_data)))
+ sys.stderr.write(' len(result_data) = %d len(expected_result) = %d\n' %
+ (len(result_data), len(expected_result)))
+ #self.assertEqual(expected_result[0:L], result_data[0:L])
+ # FIXME check first 3 answers
+ self.assertEqual(expected_result[3:L], result_data[3:L])
+
+ def test_003_interp(self):
+ taps = random_floats(31)
+ src_data = random_floats(10000)
+ decimation = 3
+
+ expected_result = reference_dec_filter(src_data, decimation, taps)
+
+ tb = gr.top_block()
+ src = gr.vector_source_f(src_data)
+ op = gr.rational_resampler_base_fff(1, decimation, taps)
+ dst = gr.vector_sink_f()
+ tb.connect(src, op)
+ tb.connect(op, dst)
+ tb.run()
+ result_data = dst.data()
+
+ L1 = len(result_data)
+ L2 = len(expected_result)
+ L = min(L1, L2)
+ if False:
+ sys.stderr.write('delta = %2d: ntaps = %d decim = %d ilen = %d\n' %
+ (L2 - L1, len(taps), decimation, len(src_data)))
+ sys.stderr.write(' len(result_data) = %d len(expected_result) = %d\n' %
+ (len(result_data), len(expected_result)))
+ self.assertEqual(expected_result[0:L], result_data[0:L])
+
+ # FIXME disabled. Triggers hang on SuSE 10.0
+ def xtest_004_decim_random_vals(self):
+ MAX_TAPS = 9
+ MAX_DECIM = 7
+ OUTPUT_LEN = 9
+
+ random.seed(0) # we want reproducibility
+
+ for ntaps in xrange(1, MAX_TAPS + 1):
+ for decim in xrange(1, MAX_DECIM+1):
+ for ilen in xrange(ntaps + decim, ntaps + OUTPUT_LEN*decim):
+ src_data = random_floats(ilen)
+ taps = random_floats(ntaps)
+ expected_result = reference_dec_filter(src_data, decim, taps)
+
+ tb = gr.top_block()
+ src = gr.vector_source_f(src_data)
+ op = gr.rational_resampler_base_fff(1, decim, taps)
+ dst = gr.vector_sink_f()
+ tb.connect(src, op, dst)
+ tb.run()
+ tb = None
+ result_data = dst.data()
+ L1 = len(result_data)
+ L2 = len(expected_result)
+ L = min(L1, L2)
+ if False:
+ sys.stderr.write('delta = %2d: ntaps = %d decim = %d ilen = %d\n' % (L2 - L1, ntaps, decim, ilen))
+ sys.stderr.write(' len(result_data) = %d len(expected_result) = %d\n' %
+ (len(result_data), len(expected_result)))
+ self.assertEqual(expected_result[0:L], result_data[0:L])
+
+
+ # FIXME disabled. Triggers hang on SuSE 10.0
+ def xtest_005_interp_random_vals(self):
+ MAX_TAPS = 9
+ MAX_INTERP = 7
+ INPUT_LEN = 9
+
+ random.seed(0) # we want reproducibility
+
+ for ntaps in xrange(1, MAX_TAPS + 1):
+ for interp in xrange(1, MAX_INTERP+1):
+ for ilen in xrange(ntaps, ntaps + INPUT_LEN):
+ src_data = random_floats(ilen)
+ taps = random_floats(ntaps)
+ expected_result = reference_interp_filter(src_data, interp, taps)
+
+ tb = gr.top_block()
+ src = gr.vector_source_f(src_data)
+ op = gr.rational_resampler_base_fff(interp, 1, taps)
+ dst = gr.vector_sink_f()
+ tb.connect(src, op, dst)
+ tb.run()
+ tb = None
+ result_data = dst.data()
+ L1 = len(result_data)
+ L2 = len(expected_result)
+ L = min(L1, L2)
+ #if True or abs(L1-L2) > 1:
+ if False:
+ sys.stderr.write('delta = %2d: ntaps = %d interp = %d ilen = %d\n' % (L2 - L1, ntaps, interp, ilen))
+ #sys.stderr.write(' len(result_data) = %d len(expected_result) = %d\n' %
+ # (len(result_data), len(expected_result)))
+ #self.assertEqual(expected_result[0:L], result_data[0:L])
+ # FIXME check first ntaps+1 answers
+ self.assertEqual(expected_result[ntaps+1:L], result_data[ntaps+1:L])
+
+
+ def test_006_interp_decim(self):
+ taps = (0,1,0,0)
+ src_data = range(10000)
+ interp = 3
+ decimation = 2
+
+ expected_result = reference_interp_dec_filter(src_data, interp, decimation, taps)
+
+ tb = gr.top_block()
+ src = gr.vector_source_f(src_data)
+ op = gr.rational_resampler_base_fff(interp, decimation, taps)
+ dst = gr.vector_sink_f()
+ tb.connect(src, op)
+ tb.connect(op, dst)
+ tb.run()
+ result_data = dst.data()
+
+ L1 = len(result_data)
+ L2 = len(expected_result)
+ L = min(L1, L2)
+ if False:
+ sys.stderr.write('delta = %2d: ntaps = %d decim = %d ilen = %d\n' %
+ (L2 - L1, len(taps), decimation, len(src_data)))
+ sys.stderr.write(' len(result_data) = %d len(expected_result) = %d\n' %
+ (len(result_data), len(expected_result)))
+ self.assertEqual(expected_result[1:L], result_data[1:L])
+
+ #
+ # test the blks2.rational_resampler_??? primitives...
+ #
+
+ def test_101_interp(self):
+ taps = [1, 10, 100, 1000, 10000]
+ src_data = (0, 2, 3, 5, 7, 11, 13, 17)
+ interpolation = 3
+ xr = (0,0,0,0,2,20,200,2003,20030,300,3005,30050,500,5007,50070,700,7011,70110,1100,11013,110130,1300,13017,130170,1700.0,17000.0,170000.0)
+ expected_result = tuple([float(x) for x in xr])
+
+ tb = gr.top_block()
+ src = gr.vector_source_f(src_data)
+ op = blks2.rational_resampler_fff(interpolation, 1, taps=taps)
+ dst = gr.vector_sink_f()
+ tb.connect(src, op)
+ tb.connect(op, dst)
+ tb.run()
+ result_data = dst.data()
+ self.assertEqual(expected_result, result_data)
+
+
+if __name__ == '__main__':
+ pass
+ # FIXME: Disabled, see ticket:210
+ # gr_unittest.run(test_rational_resampler, "test_rational_resampler.xml")
+
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_regenerate.py b/gnuradio-core/src/python/gnuradio/gr/qa_regenerate.py
new file mode 100755
index 000000000..5aca03b77
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_regenerate.py
@@ -0,0 +1,90 @@
+#!/usr/bin/env python
+#
+# 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.
+#
+
+from gnuradio import gr, gr_unittest
+import math
+
+class test_regenerate (gr_unittest.TestCase):
+
+ def setUp (self):
+ self.tb = gr.top_block ()
+
+ def tearDown (self):
+ self.tb = None
+
+ def test_regen1 (self):
+ tb = self.tb
+
+ data = [0, 0, 0,
+ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
+
+ expected_result = (0, 0, 0,
+ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
+
+
+ src = gr.vector_source_b(data, False)
+ regen = gr.regenerate_bb(5, 2)
+ dst = gr.vector_sink_b()
+
+ tb.connect (src, regen)
+ tb.connect (regen, dst)
+ tb.run ()
+
+ dst_data = dst.data ()
+
+ self.assertEqual (expected_result, dst_data)
+
+ def test_regen2 (self):
+ tb = self.tb
+
+ data = 200*[0,]
+ data[9] = 1
+ data[99] = 1
+
+ expected_result = 200*[0,]
+ expected_result[9] = 1
+ expected_result[19] = 1
+ expected_result[29] = 1
+ expected_result[39] = 1
+
+ expected_result[99] = 1
+ expected_result[109] = 1
+ expected_result[119] = 1
+ expected_result[129] = 1
+
+ src = gr.vector_source_b(data, False)
+ regen = gr.regenerate_bb(10, 3)
+ dst = gr.vector_sink_b()
+
+ tb.connect (src, regen)
+ tb.connect (regen, dst)
+ tb.run ()
+
+ dst_data = dst.data ()
+
+ self.assertEqual (tuple(expected_result), dst_data)
+
+
+if __name__ == '__main__':
+ gr_unittest.run(test_regenerate, "test_regenerate.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_repeat.py b/gnuradio-core/src/python/gnuradio/gr/qa_repeat.py
new file mode 100755
index 000000000..116f37115
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_repeat.py
@@ -0,0 +1,48 @@
+#!/usr/bin/env python
+#
+# 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.
+#
+
+from gnuradio import gr, gr_unittest
+import math
+
+class test_repeat (gr_unittest.TestCase):
+
+ def setUp (self):
+ self.tb = gr.top_block ()
+
+ def tearDown (self):
+ self.tb = None
+
+ def test_001_float(self):
+ src_data = [n*1.0 for n in range(100)];
+ dst_data = []
+ for n in range(100):
+ dst_data += [1.0*n, 1.0*n, 1.0*n]
+
+ src = gr.vector_source_f(src_data)
+ rpt = gr.repeat(gr.sizeof_float, 3)
+ dst = gr.vector_sink_f()
+ self.tb.connect(src, rpt, dst)
+ self.tb.run()
+ self.assertFloatTuplesAlmostEqual(dst_data, dst.data(), 6)
+
+if __name__ == '__main__':
+ gr_unittest.run(test_repeat, "test_repeat.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_scrambler.py b/gnuradio-core/src/python/gnuradio/gr/qa_scrambler.py
new file mode 100755
index 000000000..5fe89bdc7
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_scrambler.py
@@ -0,0 +1,64 @@
+#!/usr/bin/env python
+#
+# 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.
+#
+
+from gnuradio import gr, gr_unittest
+
+class test_scrambler(gr_unittest.TestCase):
+
+ def setUp (self):
+ self.tb = gr.top_block()
+
+ def tearDown(self):
+ self.tb = None
+
+ def test_scrambler_descrambler(self):
+ src_data = (1,)*1000
+ src = gr.vector_source_b(src_data, False)
+ scrambler = gr.scrambler_bb(0x8a, 0x7F, 7) # CCSDS 7-bit scrambler
+ descrambler = gr.descrambler_bb(0x8a, 0x7F, 7)
+ dst = gr.vector_sink_b()
+ self.tb.connect(src, scrambler, descrambler, dst)
+ self.tb.run()
+ self.assertEqual(tuple(src_data[:-8]), dst.data()[8:]) # skip garbage during synchronization
+
+ def test_additive_scrambler(self):
+ src_data = (1,)*1000
+ src = gr.vector_source_b(src_data, False)
+ scrambler = gr.additive_scrambler_bb(0x8a, 0x7f, 7)
+ descrambler = gr.additive_scrambler_bb(0x8a, 0x7f, 7)
+ dst = gr.vector_sink_b()
+ self.tb.connect(src, scrambler, descrambler, dst)
+ self.tb.run()
+ self.assertEqual(src_data, dst.data())
+
+ def test_additive_scrambler_reset(self):
+ src_data = (1,)*1000
+ src = gr.vector_source_b(src_data, False)
+ scrambler = gr.additive_scrambler_bb(0x8a, 0x7f, 7, 100)
+ descrambler = gr.additive_scrambler_bb(0x8a, 0x7f, 7, 100)
+ dst = gr.vector_sink_b()
+ self.tb.connect(src, scrambler, descrambler, dst)
+ self.tb.run()
+ self.assertEqual(src_data, dst.data())
+
+if __name__ == '__main__':
+ gr_unittest.run(test_scrambler, "test_scrambler.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_short_to_char.py b/gnuradio-core/src/python/gnuradio/gr/qa_short_to_char.py
new file mode 100755
index 000000000..490b149c7
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_short_to_char.py
@@ -0,0 +1,69 @@
+#!/usr/bin/env python
+#
+# Copyright 2011,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.
+#
+
+from gnuradio import gr, gr_unittest
+import ctypes
+
+class test_short_to_char (gr_unittest.TestCase):
+
+ def setUp (self):
+ self.tb = gr.top_block ()
+
+ def tearDown (self):
+ self.tb = None
+
+ def test_001(self):
+
+ src_data = range(0, 32767, 32767/127)
+ src_data = [int(s) for s in src_data]
+ expected_result = range(0, 128)
+ src = gr.vector_source_s(src_data)
+ op = gr.short_to_char()
+ dst = gr.vector_sink_b()
+
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ result_data = list(dst.data())
+
+ self.assertEqual(expected_result, result_data)
+
+ def test_002(self):
+
+ vlen = 3
+ src_data = range(0, 32400, 32767/127)
+ src_data = [int(s) for s in src_data]
+ expected_result = range(0, 126)
+ src = gr.vector_source_s(src_data)
+ s2v = gr.stream_to_vector(gr.sizeof_short, vlen)
+ op = gr.short_to_char(vlen)
+ v2s = gr.vector_to_stream(gr.sizeof_char, vlen)
+ dst = gr.vector_sink_b()
+
+ self.tb.connect(src, s2v, op, v2s, dst)
+ self.tb.run()
+ result_data = list(dst.data())
+
+ self.assertEqual(expected_result, result_data)
+
+if __name__ == '__main__':
+ gr_unittest.run(test_short_to_char, "test_short_to_char.xml")
+
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_short_to_float.py b/gnuradio-core/src/python/gnuradio/gr/qa_short_to_float.py
new file mode 100755
index 000000000..130f034ec
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_short_to_float.py
@@ -0,0 +1,70 @@
+#!/usr/bin/env python
+#
+# Copyright 2011,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.
+#
+
+from gnuradio import gr, gr_unittest
+import ctypes
+
+class test_short_to_float (gr_unittest.TestCase):
+
+ def setUp (self):
+ self.tb = gr.top_block ()
+
+ def tearDown (self):
+ self.tb = None
+
+ def test_001(self):
+
+ src_data = (0, 1, 2, 3, 4, 5, -1, -2, -3, -4, -5)
+ expected_result = [ 0.0, 1.0, 2.0, 3.0, 4.0, 5.0,
+ -1.0, -2.0, -3.0, -4.0, -5.0]
+
+ src = gr.vector_source_s(src_data)
+ op = gr.short_to_float()
+ dst = gr.vector_sink_f()
+
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ result_data = list(dst.data())
+
+ self.assertEqual(expected_result, result_data)
+
+ def test_002(self):
+
+ vlen = 3
+ src_data = (0, 1, 2, 3, 4, 5, -1, -2, -3)
+ expected_result = [0.0, 1.0, 2.0, 3.0, 4.0,
+ 5.0, -1.0, -2.0, -3.0]
+ src = gr.vector_source_s(src_data)
+ s2v = gr.stream_to_vector(gr.sizeof_short, vlen)
+ op = gr.short_to_float(vlen)
+ v2s = gr.vector_to_stream(gr.sizeof_float, vlen)
+ dst = gr.vector_sink_f()
+
+ self.tb.connect(src, s2v, op, v2s, dst)
+ self.tb.run()
+ result_data = list(dst.data())
+
+ self.assertEqual(expected_result, result_data)
+
+if __name__ == '__main__':
+ gr_unittest.run(test_short_to_float, "test_short_to_float.xml")
+
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_sig_source.py b/gnuradio-core/src/python/gnuradio/gr/qa_sig_source.py
new file mode 100755
index 000000000..122b169b7
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_sig_source.py
@@ -0,0 +1,157 @@
+#!/usr/bin/env python
+#
+# Copyright 2004,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.
+#
+
+from gnuradio import gr, gr_unittest
+import math
+
+class test_sig_source (gr_unittest.TestCase):
+
+ def setUp (self):
+ self.tb = gr.top_block ()
+
+ def tearDown (self):
+ self.tb = None
+
+ def test_const_f (self):
+ tb = self.tb
+ expected_result = (1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5)
+ src1 = gr.sig_source_f (1e6, gr.GR_CONST_WAVE, 0, 1.5)
+ op = gr.head (gr.sizeof_float, 10)
+ dst1 = gr.vector_sink_f ()
+ tb.connect (src1, op)
+ tb.connect (op, dst1)
+ tb.run ()
+ dst_data = dst1.data ()
+ self.assertEqual (expected_result, dst_data)
+
+ def test_const_i (self):
+ tb = self.tb
+ expected_result = (1, 1, 1, 1)
+ src1 = gr.sig_source_i (1e6, gr.GR_CONST_WAVE, 0, 1)
+ op = gr.head (gr.sizeof_int, 4)
+ dst1 = gr.vector_sink_i ()
+ tb.connect (src1, op)
+ tb.connect (op, dst1)
+ tb.run ()
+ dst_data = dst1.data ()
+ self.assertEqual (expected_result, dst_data)
+
+ def test_sine_f (self):
+ tb = self.tb
+ sqrt2 = math.sqrt(2) / 2
+ expected_result = (0, sqrt2, 1, sqrt2, 0, -sqrt2, -1, -sqrt2, 0)
+ src1 = gr.sig_source_f (8, gr.GR_SIN_WAVE, 1.0, 1.0)
+ op = gr.head (gr.sizeof_float, 9)
+ dst1 = gr.vector_sink_f ()
+ tb.connect (src1, op)
+ tb.connect (op, dst1)
+ tb.run ()
+ dst_data = dst1.data ()
+ self.assertFloatTuplesAlmostEqual (expected_result, dst_data, 5)
+
+ def test_cosine_f (self):
+ tb = self.tb
+ sqrt2 = math.sqrt(2) / 2
+ expected_result = (1, sqrt2, 0, -sqrt2, -1, -sqrt2, 0, sqrt2, 1)
+ src1 = gr.sig_source_f (8, gr.GR_COS_WAVE, 1.0, 1.0)
+ op = gr.head (gr.sizeof_float, 9)
+ dst1 = gr.vector_sink_f ()
+ tb.connect (src1, op)
+ tb.connect (op, dst1)
+ tb.run ()
+ dst_data = dst1.data ()
+ self.assertFloatTuplesAlmostEqual (expected_result, dst_data, 5)
+
+ def test_sqr_c (self):
+ tb = self.tb #arg6 is a bit before -PI/2
+ expected_result = (1j, 1j, 0, 0, 1, 1, 1+0j, 1+1j, 1j)
+ src1 = gr.sig_source_c (8, gr.GR_SQR_WAVE, 1.0, 1.0)
+ op = gr.head (gr.sizeof_gr_complex, 9)
+ dst1 = gr.vector_sink_c ()
+ tb.connect (src1, op)
+ tb.connect (op, dst1)
+ tb.run ()
+ dst_data = dst1.data ()
+ self.assertEqual (expected_result, dst_data)
+
+ def test_tri_c (self):
+ tb = self.tb
+ expected_result = (1+.5j, .75+.75j, .5+1j, .25+.75j, 0+.5j, .25+.25j, .5+0j, .75+.25j, 1+.5j)
+ src1 = gr.sig_source_c (8, gr.GR_TRI_WAVE, 1.0, 1.0)
+ op = gr.head (gr.sizeof_gr_complex, 9)
+ dst1 = gr.vector_sink_c ()
+ tb.connect (src1, op)
+ tb.connect (op, dst1)
+ tb.run ()
+ dst_data = dst1.data ()
+ self.assertComplexTuplesAlmostEqual (expected_result, dst_data, 5)
+
+ def test_saw_c (self):
+ tb = self.tb
+ expected_result = (.5+.25j, .625+.375j, .75+.5j, .875+.625j, 0+.75j, .125+.875j, .25+1j, .375+.125j, .5+.25j)
+ src1 = gr.sig_source_c (8, gr.GR_SAW_WAVE, 1.0, 1.0)
+ op = gr.head (gr.sizeof_gr_complex, 9)
+ dst1 = gr.vector_sink_c ()
+ tb.connect (src1, op)
+ tb.connect (op, dst1)
+ tb.run ()
+ dst_data = dst1.data ()
+ self.assertComplexTuplesAlmostEqual (expected_result, dst_data, 5)
+
+ def test_sqr_f (self):
+ tb = self.tb
+ expected_result = (0, 0, 0, 0, 1, 1, 1, 1, 0)
+ src1 = gr.sig_source_f (8, gr.GR_SQR_WAVE, 1.0, 1.0)
+ op = gr.head (gr.sizeof_float, 9)
+ dst1 = gr.vector_sink_f ()
+ tb.connect (src1, op)
+ tb.connect (op, dst1)
+ tb.run ()
+ dst_data = dst1.data ()
+ self.assertEqual (expected_result, dst_data)
+
+ def test_tri_f (self):
+ tb = self.tb
+ expected_result = (1, .75, .5, .25, 0, .25, .5, .75, 1)
+ src1 = gr.sig_source_f (8, gr.GR_TRI_WAVE, 1.0, 1.0)
+ op = gr.head (gr.sizeof_float, 9)
+ dst1 = gr.vector_sink_f ()
+ tb.connect (src1, op)
+ tb.connect (op, dst1)
+ tb.run ()
+ dst_data = dst1.data ()
+ self.assertFloatTuplesAlmostEqual (expected_result, dst_data, 5)
+
+ def test_saw_f (self):
+ tb = self.tb
+ expected_result = (.5, .625, .75, .875, 0, .125, .25, .375, .5)
+ src1 = gr.sig_source_f (8, gr.GR_SAW_WAVE, 1.0, 1.0)
+ op = gr.head (gr.sizeof_float, 9)
+ dst1 = gr.vector_sink_f ()
+ tb.connect (src1, op)
+ tb.connect (op, dst1)
+ tb.run ()
+ dst_data = dst1.data ()
+ self.assertFloatTuplesAlmostEqual (expected_result, dst_data, 5)
+
+if __name__ == '__main__':
+ gr_unittest.run(test_sig_source, "test_sig_source.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_single_pole_iir.py b/gnuradio-core/src/python/gnuradio/gr/qa_single_pole_iir.py
new file mode 100755
index 000000000..bfe2d8fc8
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_single_pole_iir.py
@@ -0,0 +1,72 @@
+#!/usr/bin/env python
+#
+# Copyright 2005,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.
+#
+
+from gnuradio import gr, gr_unittest
+
+class test_single_pole_iir(gr_unittest.TestCase):
+
+ def setUp (self):
+ self.tb = gr.top_block ()
+
+ def tearDown (self):
+ self.tb = None
+
+ def test_001(self):
+ src_data = (0, 1000, 2000, 3000, 4000, 5000)
+ expected_result = src_data
+ src = gr.vector_source_f(src_data)
+ op = gr.single_pole_iir_filter_ff (1.0)
+ dst = gr.vector_sink_f()
+ self.tb.connect (src, op, dst)
+ self.tb.run()
+ result_data = dst.data()
+ self.assertFloatTuplesAlmostEqual (expected_result, result_data)
+
+ def test_002(self):
+ src_data = (0, 1000, 2000, 3000, 4000, 5000)
+ expected_result = (0, 125, 359.375, 689.453125, 1103.271484, 1590.36255)
+ src = gr.vector_source_f(src_data)
+ op = gr.single_pole_iir_filter_ff (0.125)
+ dst = gr.vector_sink_f()
+ self.tb.connect (src, op, dst)
+ self.tb.run()
+ result_data = dst.data()
+ self.assertFloatTuplesAlmostEqual (expected_result, result_data, 3)
+
+ def test_003(self):
+ block_size = 2
+ src_data = (0, 1000, 2000, 3000, 4000, 5000)
+ expected_result = (0, 125, 250, 484.375, 718.75, 1048.828125)
+ src = gr.vector_source_f(src_data)
+ s2p = gr.serial_to_parallel(gr.sizeof_float, block_size)
+ op = gr.single_pole_iir_filter_ff (0.125, block_size)
+ p2s = gr.parallel_to_serial(gr.sizeof_float, block_size)
+ dst = gr.vector_sink_f()
+ self.tb.connect (src, s2p, op, p2s, dst)
+ self.tb.run()
+ result_data = dst.data()
+ self.assertFloatTuplesAlmostEqual (expected_result, result_data, 3)
+
+
+if __name__ == '__main__':
+ gr_unittest.run(test_single_pole_iir, "test_single_pole_iir.xml")
+
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_single_pole_iir_cc.py b/gnuradio-core/src/python/gnuradio/gr/qa_single_pole_iir_cc.py
new file mode 100755
index 000000000..353df1bc0
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_single_pole_iir_cc.py
@@ -0,0 +1,72 @@
+#!/usr/bin/env python
+#
+# Copyright 2005,2006,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.
+#
+
+from gnuradio import gr, gr_unittest
+
+class test_single_pole_iir_cc(gr_unittest.TestCase):
+
+ def setUp (self):
+ self.tb = gr.top_block ()
+
+ def tearDown (self):
+ self.tb = None
+
+ def test_001(self):
+ src_data = (0+0j, 1000+1000j, 2000+2000j, 3000+3000j, 4000+4000j, 5000+5000j)
+ expected_result = src_data
+ src = gr.vector_source_c(src_data)
+ op = gr.single_pole_iir_filter_cc (1.0)
+ dst = gr.vector_sink_c()
+ self.tb.connect (src, op, dst)
+ self.tb.run()
+ result_data = dst.data()
+ self.assertComplexTuplesAlmostEqual (expected_result, result_data)
+
+ def test_002(self):
+ src_data = (complex(0,0), complex(1000,-1000), complex(2000,-2000), complex(3000,-3000), complex(4000,-4000), complex(5000,-5000))
+ expected_result = (complex(0,0), complex(125,-125), complex(359.375,-359.375), complex(689.453125,-689.453125), complex(1103.271484,-1103.271484), complex(1590.36255,-1590.36255))
+ src = gr.vector_source_c(src_data)
+ op = gr.single_pole_iir_filter_cc (0.125)
+ dst = gr.vector_sink_c()
+ self.tb.connect (src, op, dst)
+ self.tb.run()
+ result_data = dst.data()
+ self.assertComplexTuplesAlmostEqual (expected_result, result_data, 3)
+
+ def test_003(self):
+ block_size = 2
+ src_data = (complex(0,0), complex(1000,-1000), complex(2000,-2000), complex(3000,-3000), complex(4000,-4000), complex(5000,-5000))
+ expected_result = (complex(0,0), complex(125,-125), complex(250,-250), complex(484.375,-484.375), complex(718.75,-718.75), complex(1048.828125,-1048.828125))
+ src = gr.vector_source_c(src_data)
+ s2p = gr.serial_to_parallel(gr.sizeof_gr_complex, block_size)
+ op = gr.single_pole_iir_filter_cc (0.125, block_size)
+ p2s = gr.parallel_to_serial(gr.sizeof_gr_complex, block_size)
+ dst = gr.vector_sink_c()
+ self.tb.connect (src, s2p, op, p2s, dst)
+ self.tb.run()
+ result_data = dst.data()
+ self.assertComplexTuplesAlmostEqual (expected_result, result_data, 3)
+
+
+if __name__ == '__main__':
+ gr_unittest.run(test_single_pole_iir_cc, "test_single_pole_iir_cc.xml")
+
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_skiphead.py b/gnuradio-core/src/python/gnuradio/gr/qa_skiphead.py
new file mode 100755
index 000000000..1e730398c
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_skiphead.py
@@ -0,0 +1,102 @@
+#!/usr/bin/env python
+#
+# 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.
+#
+
+from gnuradio import gr, gr_unittest
+
+class test_skiphead (gr_unittest.TestCase):
+
+ def setUp(self):
+ self.tb = gr.top_block ()
+ self.src_data = [int(x) for x in range(65536)]
+
+ def tearDown(self):
+ self.tb = None
+
+ def test_skip_0(self):
+ skip_cnt = 0
+ expected_result = tuple(self.src_data[skip_cnt:])
+ src1 = gr.vector_source_i (self.src_data)
+ op = gr.skiphead (gr.sizeof_int, skip_cnt)
+ dst1 = gr.vector_sink_i ()
+ self.tb.connect (src1, op, dst1)
+ self.tb.run ()
+ dst_data = dst1.data ()
+ self.assertEqual (expected_result, dst_data)
+
+ def test_skip_1(self):
+ skip_cnt = 1
+ expected_result = tuple(self.src_data[skip_cnt:])
+ src1 = gr.vector_source_i (self.src_data)
+ op = gr.skiphead (gr.sizeof_int, skip_cnt)
+ dst1 = gr.vector_sink_i ()
+ self.tb.connect (src1, op, dst1)
+ self.tb.run ()
+ dst_data = dst1.data ()
+ self.assertEqual (expected_result, dst_data)
+
+ def test_skip_1023(self):
+ skip_cnt = 1023
+ expected_result = tuple(self.src_data[skip_cnt:])
+ src1 = gr.vector_source_i (self.src_data)
+ op = gr.skiphead (gr.sizeof_int, skip_cnt)
+ dst1 = gr.vector_sink_i ()
+ self.tb.connect (src1, op, dst1)
+ self.tb.run ()
+ dst_data = dst1.data ()
+ self.assertEqual (expected_result, dst_data)
+
+ def test_skip_6339(self):
+ skip_cnt = 6339
+ expected_result = tuple(self.src_data[skip_cnt:])
+ src1 = gr.vector_source_i (self.src_data)
+ op = gr.skiphead (gr.sizeof_int, skip_cnt)
+ dst1 = gr.vector_sink_i ()
+ self.tb.connect (src1, op, dst1)
+ self.tb.run ()
+ dst_data = dst1.data ()
+ self.assertEqual (expected_result, dst_data)
+
+ def test_skip_12678(self):
+ skip_cnt = 12678
+ expected_result = tuple(self.src_data[skip_cnt:])
+ src1 = gr.vector_source_i (self.src_data)
+ op = gr.skiphead (gr.sizeof_int, skip_cnt)
+ dst1 = gr.vector_sink_i ()
+ self.tb.connect (src1, op, dst1)
+ self.tb.run ()
+ dst_data = dst1.data ()
+ self.assertEqual (expected_result, dst_data)
+
+ def test_skip_all(self):
+ skip_cnt = len(self.src_data)
+ expected_result = tuple(self.src_data[skip_cnt:])
+ src1 = gr.vector_source_i (self.src_data)
+ op = gr.skiphead (gr.sizeof_int, skip_cnt)
+ dst1 = gr.vector_sink_i ()
+ self.tb.connect (src1, op, dst1)
+ self.tb.run ()
+ dst_data = dst1.data ()
+ self.assertEqual (expected_result, dst_data)
+
+
+if __name__ == '__main__':
+ gr_unittest.run(test_skiphead, "test_skiphead.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_stream_mux.py b/gnuradio-core/src/python/gnuradio/gr/qa_stream_mux.py
new file mode 100755
index 000000000..779d0b25e
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_stream_mux.py
@@ -0,0 +1,168 @@
+#!/usr/bin/env python
+#
+# Copyright 2004,2005,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.
+#
+
+from gnuradio import gr, gr_unittest
+
+class test_stream_mux (gr_unittest.TestCase):
+
+ def setUp (self):
+ self.tb = gr.top_block ()
+
+ def tearDown (self):
+ self.tb = None
+
+ def help_stream_2ff(self, N, stream_sizes):
+ v0 = gr.vector_source_f(N*[1,], False)
+ v1 = gr.vector_source_f(N*[2,], False)
+
+ mux = gr.stream_mux(gr.sizeof_float, stream_sizes)
+
+ dst = gr.vector_sink_f ()
+
+ self.tb.connect (v0, (mux,0))
+ self.tb.connect (v1, (mux,1))
+ self.tb.connect (mux, dst)
+ self.tb.run ()
+
+ return dst.data ()
+
+ def help_stream_ramp_2ff(self, N, stream_sizes):
+ r1 = range(N)
+ r2 = range(N)
+ r2.reverse()
+
+ v0 = gr.vector_source_f(r1, False)
+ v1 = gr.vector_source_f(r2, False)
+
+ mux = gr.stream_mux(gr.sizeof_float, stream_sizes)
+
+ dst = gr.vector_sink_f ()
+
+ self.tb.connect (v0, (mux,0))
+ self.tb.connect (v1, (mux,1))
+ self.tb.connect (mux, dst)
+ self.tb.run ()
+
+ return dst.data ()
+
+ def test_stream_2NN_ff(self):
+ N = 40
+ stream_sizes = [10, 10]
+ result_data = self.help_stream_2ff(N, stream_sizes)
+
+ exp_data = (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
+ 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0,
+ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
+ 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0,
+ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
+ 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0,
+ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
+ 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0)
+ self.assertEqual (exp_data, result_data)
+
+ def test_stream_ramp_2NN_ff(self):
+ N = 40
+ stream_sizes = [10, 10]
+ result_data = self.help_stream_ramp_2ff(N, stream_sizes)
+
+ exp_data = ( 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0,
+ 39.0, 38.0, 37.0, 36.0, 35.0, 34.0, 33.0, 32.0, 31.0, 30.0,
+ 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0,
+ 29.0, 28.0, 27.0, 26.0, 25.0, 24.0, 23.0, 22.0, 21.0, 20.0,
+ 20.0, 21.0, 22.0, 23.0, 24.0, 25.0, 26.0, 27.0, 28.0, 29.0,
+ 19.0, 18.0, 17.0, 16.0, 15.0, 14.0, 13.0, 12.0, 11.0, 10.0,
+ 30.0, 31.0, 32.0, 33.0, 34.0, 35.0, 36.0, 37.0, 38.0, 39.0,
+ 9.0, 8.0, 7.0, 6.0, 5.0, 4.0, 3.0, 2.0, 1.0, 0.0)
+ self.assertEqual (exp_data, result_data)
+
+ def test_stream_2NM_ff(self):
+ N = 40
+ stream_sizes = [7, 9]
+ self.help_stream_2ff(N, stream_sizes)
+
+ result_data = self.help_stream_2ff(N, stream_sizes)
+
+ exp_data = (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
+ 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0,
+ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
+ 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0,
+ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
+ 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0,
+ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
+ 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0,
+ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
+ 2.0, 2.0, 2.0, 2.0)
+
+ self.assertEqual (exp_data, result_data)
+
+
+ def test_stream_2MN_ff(self):
+ N = 37
+ stream_sizes = [7, 9]
+ self.help_stream_2ff(N, stream_sizes)
+
+ result_data = self.help_stream_2ff(N, stream_sizes)
+
+ exp_data = (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
+ 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0,
+ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
+ 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0,
+ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
+ 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0,
+ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
+ 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0,
+ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
+ 2.0)
+
+ self.assertEqual (exp_data, result_data)
+
+ def test_stream_2N0_ff(self):
+ N = 30
+ stream_sizes = [7, 0]
+ self.help_stream_2ff(N, stream_sizes)
+
+ result_data = self.help_stream_2ff(N, stream_sizes)
+
+ exp_data = (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
+ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
+ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
+ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
+ 1.0, 1.0)
+
+ self.assertEqual (exp_data, result_data)
+
+ def test_stream_20N_ff(self):
+ N = 30
+ stream_sizes = [0, 9]
+ self.help_stream_2ff(N, stream_sizes)
+
+ result_data = self.help_stream_2ff(N, stream_sizes)
+
+ exp_data = (2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0,
+ 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0,
+ 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0,
+ 2.0, 2.0, 2.0)
+
+ self.assertEqual (exp_data, result_data)
+
+if __name__ == '__main__':
+ gr_unittest.run(test_stream_mux, "test_stream_mux.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_tag_debug.py b/gnuradio-core/src/python/gnuradio/gr/qa_tag_debug.py
new file mode 100755
index 000000000..81babca04
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_tag_debug.py
@@ -0,0 +1,43 @@
+#!/usr/bin/env python
+#
+# 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.
+#
+
+from gnuradio import gr, gr_unittest
+
+class test_tag_debug(gr_unittest.TestCase):
+
+ def setUp(self):
+ self.tb = gr.top_block()
+
+ def tearDown(self):
+ self.tb = None
+
+ def test_001(self):
+ # Just run some data through and make sure it doesn't puke.
+ src_data = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
+ src = gr.vector_source_i(src_data)
+ op = gr.tag_debug(gr.sizeof_int, "tag QA")
+ self.tb.connect(src, op)
+ self.tb.run()
+ x = op.current_tags()
+
+if __name__ == '__main__':
+ gr_unittest.run(test_tag_debug, "test_tag_debug.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_tag_utils.py b/gnuradio-core/src/python/gnuradio/gr/qa_tag_utils.py
new file mode 100755
index 000000000..ca1184979
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_tag_utils.py
@@ -0,0 +1,55 @@
+#!/usr/bin/env python
+#
+# 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.
+#
+
+from gnuradio import gr, gr_unittest
+import tag_utils
+
+try:
+ import pmt_swig as pmt
+except ImportError:
+ import pmt
+
+class test_tag_utils (gr_unittest.TestCase):
+
+ def setUp (self):
+ self.tb = gr.top_block ()
+
+
+ def tearDown (self):
+ self.tb = None
+
+ def test_001(self):
+ t = gr.gr_tag_t()
+ t.offset = 10
+ t.key = pmt.pmt_string_to_symbol('key')
+ t.value = pmt.pmt_from_long(23)
+ t.srcid = pmt.pmt_from_bool(False)
+ pt = tag_utils.tag_to_python(t)
+ self.assertEqual(pt.key, 'key')
+ self.assertEqual(pt.value, 23)
+ self.assertEqual(pt.offset, 10)
+
+
+if __name__ == '__main__':
+ print 'hi'
+ gr_unittest.run(test_tag_utils, "test_tag_utils.xml")
+
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_udp_sink_source.py b/gnuradio-core/src/python/gnuradio/gr/qa_udp_sink_source.py
new file mode 100755
index 000000000..0a719990e
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_udp_sink_source.py
@@ -0,0 +1,99 @@
+#!/usr/bin/env python
+#
+# 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.
+#
+
+from gnuradio import gr, gr_unittest
+from threading import Timer
+
+class test_udp_sink_source(gr_unittest.TestCase):
+
+ def setUp(self):
+ self.tb_snd = gr.top_block()
+ self.tb_rcv = gr.top_block()
+
+ def tearDown(self):
+ self.tb_rcv = None
+ self.tb_snd = None
+
+ def test_001(self):
+ port = 65500
+
+ n_data = 16
+ src_data = [float(x) for x in range(n_data)]
+ expected_result = tuple(src_data)
+ src = gr.vector_source_f(src_data)
+ udp_snd = gr.udp_sink( gr.sizeof_float, 'localhost', port )
+ self.tb_snd.connect( src, udp_snd )
+
+ udp_rcv = gr.udp_source( gr.sizeof_float, 'localhost', port )
+ dst = gr.vector_sink_f()
+ self.tb_rcv.connect( udp_rcv, dst )
+
+ self.tb_rcv.start()
+ self.tb_snd.run()
+ udp_snd.disconnect()
+ self.timeout = False
+ q = Timer(3.0,self.stop_rcv)
+ q.start()
+ self.tb_rcv.wait()
+ q.cancel()
+
+ result_data = dst.data()
+ self.assertEqual(expected_result, result_data)
+ self.assert_(not self.timeout)
+
+ def test_002(self):
+ udp_rcv = gr.udp_source( gr.sizeof_float, '0.0.0.0', 0, eof=False )
+ rcv_port = udp_rcv.get_port()
+
+ udp_snd = gr.udp_sink( gr.sizeof_float, '127.0.0.1', 65500 )
+ udp_snd.connect( 'localhost', rcv_port )
+
+ n_data = 16
+ src_data = [float(x) for x in range(n_data)]
+ expected_result = tuple(src_data)
+ src = gr.vector_source_f(src_data)
+ dst = gr.vector_sink_f()
+
+ self.tb_snd.connect( src, udp_snd )
+ self.tb_rcv.connect( udp_rcv, dst )
+
+ self.tb_rcv.start()
+ self.tb_snd.run()
+ udp_snd.disconnect()
+ self.timeout = False
+ q = Timer(3.0,self.stop_rcv)
+ q.start()
+ self.tb_rcv.wait()
+ q.cancel()
+
+ result_data = dst.data()
+ self.assertEqual(expected_result, result_data)
+ self.assert_(self.timeout) # source ignores EOF?
+
+ def stop_rcv(self):
+ self.timeout = True
+ self.tb_rcv.stop()
+ #print "tb_rcv stopped by Timer"
+
+if __name__ == '__main__':
+ gr_unittest.run(test_udp_sink_source, "test_udp_sink_source.xml")
+
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_unpack_k_bits.py b/gnuradio-core/src/python/gnuradio/gr/qa_unpack_k_bits.py
new file mode 100755
index 000000000..bb4e7733d
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_unpack_k_bits.py
@@ -0,0 +1,57 @@
+#!/usr/bin/env python
+#
+# Copyright 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.
+#
+
+from gnuradio import gr, gr_unittest
+import random
+
+class test_unpack(gr_unittest.TestCase):
+
+ def setUp(self):
+ self.tb = gr.top_block ()
+
+ def tearDown(self):
+ self.tb = None
+
+ def test_001(self):
+ src_data = (1,0,1,1,0,1,1,0)
+ expected_results = (1,0,1,1,0,1,1,0)
+ src = gr.vector_source_b(src_data,False)
+ op = gr.unpack_k_bits_bb(1)
+ dst = gr.vector_sink_b()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ self.assertEqual(expected_results, dst.data())
+
+ def test_002(self):
+ src_data = ( 2, 3, 0, 1)
+ expected_results = (1,0,1,1,0,0,0,1)
+ src = gr.vector_source_b(src_data,False)
+ op = gr.unpack_k_bits_bb(2)
+ dst = gr.vector_sink_b()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ self.assertEqual(expected_results, dst.data())
+
+
+if __name__ == '__main__':
+ gr_unittest.run(test_unpack, "test_unpack.xml")
+
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_vector_insert.py b/gnuradio-core/src/python/gnuradio/gr/qa_vector_insert.py
new file mode 100755
index 000000000..acc06dfde
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_vector_insert.py
@@ -0,0 +1,58 @@
+#!/usr/bin/env python
+#
+# 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.
+#
+
+from gnuradio import gr, gr_unittest
+import math
+
+class test_vector_insert(gr_unittest.TestCase):
+
+ def setUp (self):
+ self.tb = gr.top_block ()
+
+ def tearDown (self):
+ self.tb = None
+
+ def test_001(self):
+ src_data = [float(x) for x in range(16)]
+ expected_result = tuple(src_data)
+
+ period = 9177;
+ offset = 0;
+
+ src = gr.null_source(1)
+ head = gr.head(1, 10000000);
+ ins = gr.vector_insert_b([1], period, offset);
+ dst = gr.vector_sink_b()
+
+ self.tb.connect(src, head, ins, dst)
+ self.tb.run()
+ result_data = dst.data()
+
+ for i in range(10000):
+ if(i%period == offset):
+ self.assertEqual(1, result_data[i])
+ else:
+ self.assertEqual(0, result_data[i])
+
+if __name__ == '__main__':
+ gr_unittest.run(test_vector_insert, "test_vector_insert.xml")
+
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_vector_map.py b/gnuradio-core/src/python/gnuradio/gr/qa_vector_map.py
new file mode 100644
index 000000000..12f4be589
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_vector_map.py
@@ -0,0 +1,105 @@
+#!/usr/bin/env python
+#
+# 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.
+#
+
+from gnuradio import gr, gr_unittest
+import math
+
+class test_vector_map(gr_unittest.TestCase):
+
+ def setUp (self):
+ self.tb = gr.top_block()
+
+ def tearDown (self):
+ self.tb = None
+
+ def test_reversing(self):
+ # Chunk data in blocks of N and reverse the block contents.
+ N = 5
+ src_data = range(0, 20)
+ expected_result = []
+ for i in range(N-1, len(src_data), N):
+ for j in range(0, N):
+ expected_result.append(1.0*(i-j))
+ mapping = [list(reversed([(0, i) for i in range(0, N)]))]
+ src = gr.vector_source_f(src_data, False, N)
+ vmap = gr.vector_map(gr.sizeof_float, (N, ), mapping)
+ dst = gr.vector_sink_f(N)
+ self.tb.connect(src, vmap, dst)
+ self.tb.run()
+ result_data = list(dst.data())
+ self.assertEqual(expected_result, result_data)
+
+ def test_vector_to_streams(self):
+ # Split an input vector into N streams.
+ N = 5
+ M = 20
+ src_data = range(0, M)
+ expected_results = []
+ for n in range(0, N):
+ expected_results.append(range(n, M, N))
+ mapping = [[(0, n)] for n in range(0, N)]
+ src = gr.vector_source_f(src_data, False, N)
+ vmap = gr.vector_map(gr.sizeof_float, (N, ), mapping)
+ dsts = [gr.vector_sink_f(1) for n in range(0, N)]
+ self.tb.connect(src, vmap)
+ for n in range(0, N):
+ self.tb.connect((vmap, n), dsts[n])
+ self.tb.run()
+ for n in range(0, N):
+ result_data = list(dsts[n].data())
+ self.assertEqual(expected_results[n], result_data)
+
+ def test_interleaving(self):
+ # Takes 3 streams (a, b and c)
+ # Outputs 2 streams.
+ # First (d) is interleaving of a and b.
+ # Second (e) is interleaving of a and b and c. c is taken in
+ # chunks of 2 which are reversed.
+ A = (1, 2, 3, 4, 5)
+ B = (11, 12, 13, 14, 15)
+ C = (99, 98, 97, 96, 95, 94, 93, 92, 91, 90)
+ expected_D = (1, 11, 2, 12, 3, 13, 4, 14, 5, 15)
+ expected_E = (1, 11, 98, 99, 2, 12, 96, 97, 3, 13, 94, 95,
+ 4, 14, 92, 93, 5, 15, 90, 91)
+ mapping = [[(0, 0), (1, 0)], # mapping to produce D
+ [(0, 0), (1, 0), (2, 1), (2, 0)], # mapping to produce E
+ ]
+ srcA = gr.vector_source_f(A, False, 1)
+ srcB = gr.vector_source_f(B, False, 1)
+ srcC = gr.vector_source_f(C, False, 2)
+ vmap = gr.vector_map(gr.sizeof_int, (1, 1, 2), mapping)
+ dstD = gr.vector_sink_f(2)
+ dstE = gr.vector_sink_f(4)
+ self.tb.connect(srcA, (vmap, 0))
+ self.tb.connect(srcB, (vmap, 1))
+ self.tb.connect(srcC, (vmap, 2))
+ self.tb.connect((vmap, 0), dstD)
+ self.tb.connect((vmap, 1), dstE)
+ self.tb.run()
+ self.assertEqual(expected_D, dstD.data())
+ self.assertEqual(expected_E, dstE.data())
+
+
+
+if __name__ == '__main__':
+ gr_unittest.run(test_vector_map, "test_vector_map.xml")
+
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_vector_sink_source.py b/gnuradio-core/src/python/gnuradio/gr/qa_vector_sink_source.py
new file mode 100755
index 000000000..64cbbe72a
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_vector_sink_source.py
@@ -0,0 +1,65 @@
+#!/usr/bin/env python
+#
+# 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.
+#
+
+from gnuradio import gr, gr_unittest
+import math
+
+class test_vector_sink_source(gr_unittest.TestCase):
+
+ def setUp (self):
+ self.tb = gr.top_block ()
+
+ def tearDown (self):
+ self.tb = None
+
+ def test_001(self):
+ src_data = [float(x) for x in range(16)]
+ expected_result = tuple(src_data)
+
+ src = gr.vector_source_f(src_data)
+ dst = gr.vector_sink_f()
+
+ self.tb.connect(src, dst)
+ self.tb.run()
+ result_data = dst.data()
+ self.assertEqual(expected_result, result_data)
+
+ def test_002(self):
+ src_data = [float(x) for x in range(16)]
+ expected_result = tuple(src_data)
+
+ src = gr.vector_source_f(src_data, False, 2)
+ dst = gr.vector_sink_f(2)
+
+ self.tb.connect(src, dst)
+ self.tb.run()
+ result_data = dst.data()
+ self.assertEqual(expected_result, result_data)
+
+ def test_003(self):
+ src_data = [float(x) for x in range(16)]
+ expected_result = tuple(src_data)
+ self.assertRaises(ValueError, lambda : gr.vector_source_f(src_data, False, 3))
+
+if __name__ == '__main__':
+ gr_unittest.run(test_vector_sink_source, "test_vector_sink_source.xml")
+
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_wavefile.py b/gnuradio-core/src/python/gnuradio/gr/qa_wavefile.py
new file mode 100755
index 000000000..3b9a3eb20
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_wavefile.py
@@ -0,0 +1,69 @@
+#!/usr/bin/env python
+#
+# 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.
+#
+
+from gnuradio import gr, gr_unittest
+
+import os
+from os.path import getsize
+
+g_in_file = os.path.join (os.getenv ("srcdir"), "test_16bit_1chunk.wav")
+
+class test_wavefile(gr_unittest.TestCase):
+
+ def setUp (self):
+ self.tb = gr.top_block ()
+
+ def tearDown (self):
+ self.tb = None
+
+ def test_001_checkwavread (self):
+ wf = gr.wavfile_source(g_in_file)
+ self.assertEqual(wf.sample_rate(), 8000)
+
+ def test_002_checkwavcopy (self):
+ infile = g_in_file
+ outfile = "test_out.wav"
+
+ wf_in = gr.wavfile_source(infile)
+ wf_out = gr.wavfile_sink(outfile,
+ wf_in.channels(),
+ wf_in.sample_rate(),
+ wf_in.bits_per_sample())
+ self.tb.connect(wf_in, wf_out)
+ self.tb.run()
+ wf_out.close()
+
+ self.assertEqual(getsize(infile), getsize(outfile))
+
+ in_f = file(infile, 'rb')
+ out_f = file(outfile, 'rb')
+
+ in_data = in_f.read()
+ out_data = out_f.read()
+ out_f.close()
+ os.remove(outfile)
+
+ self.assertEqual(in_data, out_data)
+
+
+if __name__ == '__main__':
+ gr_unittest.run(test_wavefile, "test_wavefile.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/tag_utils.py b/gnuradio-core/src/python/gnuradio/gr/tag_utils.py
new file mode 100644
index 000000000..923718fc9
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/tag_utils.py
@@ -0,0 +1,54 @@
+#
+# Copyright 2003-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.
+#
+""" Conversion tools between stream tags and Python objects """
+
+try: import pmt
+except: from gruel import pmt
+
+from gnuradio_core import gr_tag_t
+
+class PythonTag(object):
+ " Python container for tags "
+ def __init__(self):
+ self.offset = None
+ self.key = None
+ self.value = None
+ self.srcid = None
+
+def tag_to_python(tag):
+ """ Convert a stream tag to a Python-readable object """
+ newtag = PythonTag()
+ newtag.offset = tag.offset
+ newtag.key = pmt.to_python(tag.key)
+ newtag.value = pmt.to_python(tag.value)
+ newtag.srcid = pmt.to_python(tag.srcid)
+ return newtag
+
+def tag_to_pmt(tag):
+ """ Convert a Python-readable object to a stream tag """
+ newtag = gr_tag_t()
+ newtag.offset = tag.offset
+ newtag.key = pmt.to_python(tag.key)
+ newtag.value = pmt.from_python(tag.value)
+ newtag.srcid = pmt.from_python(tag.srcid)
+ return newtag
+
+
diff --git a/gnuradio-core/src/python/gnuradio/gr/test_16bit_1chunk.wav b/gnuradio-core/src/python/gnuradio/gr/test_16bit_1chunk.wav
new file mode 100644
index 000000000..0fe12a7a1
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/test_16bit_1chunk.wav
Binary files differ
diff --git a/gnuradio-core/src/python/gnuradio/gr/top_block.py b/gnuradio-core/src/python/gnuradio/gr/top_block.py
new file mode 100644
index 000000000..dc1f443aa
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/top_block.py
@@ -0,0 +1,165 @@
+#
+# 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.
+#
+
+from gnuradio_core import top_block_swig, \
+ top_block_wait_unlocked, top_block_run_unlocked
+
+#import gnuradio.gr.gr_threading as _threading
+import gr_threading as _threading
+
+
+#
+# There is no problem that can't be solved with an additional
+# level of indirection...
+#
+# This kludge allows ^C to interrupt top_block.run and top_block.wait
+#
+# The problem that we are working around is that Python only services
+# signals (e.g., KeyboardInterrupt) in its main thread. If the main
+# thread is blocked in our C++ version of wait, even though Python's
+# SIGINT handler fires, and even though there may be other python
+# threads running, no one will know. Thus instead of directly waiting
+# in the thread that calls wait (which is likely to be the Python main
+# thread), we create a separate thread that does the blocking wait,
+# and then use the thread that called wait to do a slow poll of an
+# event queue. That thread, which is executing "wait" below is
+# interruptable, and if it sees a KeyboardInterrupt, executes a stop
+# on the top_block, then goes back to waiting for it to complete.
+# This ensures that the unlocked wait that was in progress (in the
+# _top_block_waiter thread) can complete, release its mutex and back
+# out. If we don't do that, we are never able to clean up, and nasty
+# things occur like leaving the USRP transmitter sending a carrier.
+#
+# See also top_block.wait (below), which uses this class to implement
+# the interruptable wait.
+#
+class _top_block_waiter(_threading.Thread):
+ def __init__(self, tb):
+ _threading.Thread.__init__(self)
+ self.setDaemon(1)
+ self.tb = tb
+ self.event = _threading.Event()
+ self.start()
+
+ def run(self):
+ top_block_wait_unlocked(self.tb)
+ self.event.set()
+
+ def wait(self):
+ try:
+ while not self.event.isSet():
+ self.event.wait(0.100)
+ except KeyboardInterrupt:
+ self.tb.stop()
+ self.wait()
+
+
+#
+# This hack forces a 'has-a' relationship to look like an 'is-a' one.
+#
+# It allows Python classes to subclass this one, while passing through
+# method calls to the C++ class shared pointer from SWIG.
+#
+# It also allows us to intercept method calls if needed.
+#
+# This allows the 'run_locked' methods, which are defined in gr_top_block.i,
+# to release the Python global interpreter lock before calling the actual
+# method in gr_top_block
+#
+class top_block(object):
+ def __init__(self, name="top_block"):
+ self._tb = top_block_swig(name)
+
+ def __getattr__(self, name):
+ if not hasattr(self, "_tb"):
+ raise RuntimeError("top_block: invalid state--did you forget to call gr.top_block.__init__ in a derived class?")
+ return getattr(self._tb, name)
+
+ def start(self, max_noutput_items=100000):
+ self._tb.start(max_noutput_items)
+
+ def stop(self):
+ self._tb.stop()
+
+ def run(self, max_noutput_items=100000):
+ self.start(max_noutput_items)
+ self.wait()
+
+ def wait(self):
+ _top_block_waiter(self._tb).wait()
+
+
+ # FIXME: these are duplicated from hier_block2.py; they should really be implemented
+ # in the original C++ class (gr_hier_block2), then they would all be inherited here
+
+ def connect(self, *points):
+ '''connect requires one or more arguments that can be coerced to endpoints.
+ If more than two arguments are provided, they are connected together successively.
+ '''
+ if len (points) < 1:
+ raise ValueError, ("connect requires at least one endpoint; %d provided." % (len (points),))
+ else:
+ if len(points) == 1:
+ self._tb.primitive_connect(points[0].to_basic_block())
+ else:
+ for i in range (1, len (points)):
+ self._connect(points[i-1], points[i])
+
+ def msg_connect(self, src, srcport, dst, dstport):
+ self.primitive_msg_connect(src.to_basic_block(), srcport, dst.to_basic_block(), dstport);
+
+ def msg_disconnect(self, src, srcport, dst, dstport):
+ self.primitive_msg_disconnect(src.to_basic_block(), srcport, dst.to_basic_block(), dstport);
+
+ def _connect(self, src, dst):
+ (src_block, src_port) = self._coerce_endpoint(src)
+ (dst_block, dst_port) = self._coerce_endpoint(dst)
+ self._tb.primitive_connect(src_block.to_basic_block(), src_port,
+ dst_block.to_basic_block(), dst_port)
+
+ def _coerce_endpoint(self, endp):
+ if hasattr(endp, 'to_basic_block'):
+ return (endp, 0)
+ else:
+ if hasattr(endp, "__getitem__") and len(endp) == 2:
+ return endp # Assume user put (block, port)
+ else:
+ raise ValueError("unable to coerce endpoint")
+
+ def disconnect(self, *points):
+ '''disconnect requires one or more arguments that can be coerced to endpoints.
+ If more than two arguments are provided, they are disconnected successively.
+ '''
+ if len (points) < 1:
+ raise ValueError, ("disconnect requires at least one endpoint; %d provided." % (len (points),))
+ else:
+ if len(points) == 1:
+ self._tb.primitive_disconnect(points[0].to_basic_block())
+ else:
+ for i in range (1, len (points)):
+ self._disconnect(points[i-1], points[i])
+
+ def _disconnect(self, src, dst):
+ (src_block, src_port) = self._coerce_endpoint(src)
+ (dst_block, dst_port) = self._coerce_endpoint(dst)
+ self._tb.primitive_disconnect(src_block.to_basic_block(), src_port,
+ dst_block.to_basic_block(), dst_port)
+
diff --git a/gnuradio-core/src/python/gnuradio/gr_unittest.py b/gnuradio-core/src/python/gnuradio/gr_unittest.py
new file mode 100755
index 000000000..e4510a6eb
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr_unittest.py
@@ -0,0 +1,167 @@
+#!/usr/bin/env python
+#
+# 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.
+#
+
+import unittest
+import gr_xmlrunner
+import sys, os, stat
+
+class TestCase(unittest.TestCase):
+ """A subclass of unittest.TestCase that adds additional assertions
+
+ Adds new methods assertComplexAlmostEqual,
+ assertComplexTuplesAlmostEqual and assertFloatTuplesAlmostEqual
+ """
+
+ def assertComplexAlmostEqual (self, first, second, places=7, msg=None):
+ """Fail if the two complex objects are unequal as determined by their
+ difference rounded to the given number of decimal places
+ (default 7) and comparing to zero.
+
+ Note that decimal places (from zero) is usually not the same
+ as significant digits (measured from the most signficant digit).
+ """
+ if round(second.real-first.real, places) != 0:
+ raise self.failureException, \
+ (msg or '%s != %s within %s places' % (`first`, `second`, `places` ))
+ if round(second.imag-first.imag, places) != 0:
+ raise self.failureException, \
+ (msg or '%s != %s within %s places' % (`first`, `second`, `places` ))
+
+ def assertComplexAlmostEqual2 (self, ref, x, abs_eps=1e-12, rel_eps=1e-6, msg=None):
+ """
+ Fail if the two complex objects are unequal as determined by...
+ """
+ if abs(ref - x) < abs_eps:
+ return
+
+ if abs(ref) > abs_eps:
+ if abs(ref-x)/abs(ref) > rel_eps:
+ raise self.failureException, \
+ (msg or '%s != %s rel_error = %s rel_limit = %s' % (
+ `ref`, `x`, abs(ref-x)/abs(ref), `rel_eps` ))
+ else:
+ raise self.failureException, \
+ (msg or '%s != %s rel_error = %s rel_limit = %s' % (
+ `ref`, `x`, abs(ref-x)/abs(ref), `rel_eps` ))
+
+
+
+ def assertComplexTuplesAlmostEqual (self, a, b, places=7, msg=None):
+ self.assertEqual (len(a), len(b))
+ for i in xrange (len(a)):
+ self.assertComplexAlmostEqual (a[i], b[i], places, msg)
+
+ def assertComplexTuplesAlmostEqual2 (self, ref, x,
+ abs_eps=1e-12, rel_eps=1e-6, msg=None):
+ self.assertEqual (len(ref), len(x))
+ for i in xrange (len(ref)):
+ try:
+ self.assertComplexAlmostEqual2 (ref[i], x[i], abs_eps, rel_eps, msg)
+ except self.failureException, e:
+ #sys.stderr.write("index = %d " % (i,))
+ #sys.stderr.write("%s\n" % (e,))
+ raise
+
+ def assertFloatTuplesAlmostEqual (self, a, b, places=7, msg=None):
+ self.assertEqual (len(a), len(b))
+ for i in xrange (len(a)):
+ self.assertAlmostEqual (a[i], b[i], places, msg)
+
+
+ def assertFloatTuplesAlmostEqual2 (self, ref, x,
+ abs_eps=1e-12, rel_eps=1e-6, msg=None):
+ self.assertEqual (len(ref), len(x))
+ for i in xrange (len(ref)):
+ try:
+ self.assertComplexAlmostEqual2 (ref[i], x[i], abs_eps, rel_eps, msg)
+ except self.failureException, e:
+ #sys.stderr.write("index = %d " % (i,))
+ #sys.stderr.write("%s\n" % (e,))
+ raise
+
+
+TestResult = unittest.TestResult
+TestSuite = unittest.TestSuite
+FunctionTestCase = unittest.FunctionTestCase
+TestLoader = unittest.TestLoader
+TextTestRunner = unittest.TextTestRunner
+TestProgram = unittest.TestProgram
+main = TestProgram
+
+def run(PUT, filename=None):
+ '''
+ Runs the unittest on a TestCase and produces an optional XML report
+ PUT: the program under test and should be a gr_unittest.TestCase
+ filename: an optional filename to save the XML report of the tests
+ this will live in ./.unittests/python
+ '''
+
+ # Run this is given a file name
+ if(filename is not None):
+ basepath = "./.unittests"
+ path = basepath + "/python"
+
+ if not os.path.exists(basepath):
+ os.makedirs(basepath, 0750)
+
+ xmlrunner = None
+ # only proceed if .unittests is writable
+ st = os.stat(basepath)[stat.ST_MODE]
+ if(st & stat.S_IWUSR > 0):
+ # Test if path exists; if not, build it
+ if not os.path.exists(path):
+ os.makedirs(path, 0750)
+
+ # Just for safety: make sure we can write here, too
+ st = os.stat(path)[stat.ST_MODE]
+ if(st & stat.S_IWUSR > 0):
+ # Create an XML runner to filename
+ fout = file(path+"/"+filename, "w")
+ xmlrunner = gr_xmlrunner.XMLTestRunner(fout)
+
+ txtrunner = TextTestRunner(verbosity=1)
+
+ # Run the test; runner also creates XML output file
+ # FIXME: make xmlrunner output to screen so we don't have to do run and main
+ suite = TestLoader().loadTestsFromTestCase(PUT)
+
+ # use the xmlrunner if we can write the the directory
+ if(xmlrunner is not None):
+ xmlrunner.run(suite)
+
+ main()
+
+ # This will run and fail make check if problem
+ # but does not output to screen.
+ #main(testRunner = xmlrunner)
+
+ else:
+ # If no filename is given, just run the test
+ main()
+
+
+##############################################################################
+# Executing this module from the command line
+##############################################################################
+
+if __name__ == "__main__":
+ main(module=None)
diff --git a/gnuradio-core/src/python/gnuradio/gr_xmlrunner.py b/gnuradio-core/src/python/gnuradio/gr_xmlrunner.py
new file mode 100644
index 000000000..31298197f
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr_xmlrunner.py
@@ -0,0 +1,387 @@
+"""
+XML Test Runner for PyUnit
+"""
+
+# Written by Sebastian Rittau <srittau@jroger.in-berlin.de> and placed in
+# the Public Domain. With contributions by Paolo Borelli and others.
+# Added to GNU Radio Oct. 3, 2010
+
+__version__ = "0.1"
+
+import os.path
+import re
+import sys
+import time
+import traceback
+import unittest
+from xml.sax.saxutils import escape
+
+try:
+ from StringIO import StringIO
+except ImportError:
+ from io import StringIO
+
+
+class _TestInfo(object):
+
+ """Information about a particular test.
+
+ Used by _XMLTestResult.
+
+ """
+
+ def __init__(self, test, time):
+ (self._class, self._method) = test.id().rsplit(".", 1)
+ self._time = time
+ self._error = None
+ self._failure = None
+
+ @staticmethod
+ def create_success(test, time):
+ """Create a _TestInfo instance for a successful test."""
+ return _TestInfo(test, time)
+
+ @staticmethod
+ def create_failure(test, time, failure):
+ """Create a _TestInfo instance for a failed test."""
+ info = _TestInfo(test, time)
+ info._failure = failure
+ return info
+
+ @staticmethod
+ def create_error(test, time, error):
+ """Create a _TestInfo instance for an erroneous test."""
+ info = _TestInfo(test, time)
+ info._error = error
+ return info
+
+ def print_report(self, stream):
+ """Print information about this test case in XML format to the
+ supplied stream.
+
+ """
+ stream.write(' <testcase classname="%(class)s" name="%(method)s" time="%(time).4f">' % \
+ {
+ "class": self._class,
+ "method": self._method,
+ "time": self._time,
+ })
+ if self._failure is not None:
+ self._print_error(stream, 'failure', self._failure)
+ if self._error is not None:
+ self._print_error(stream, 'error', self._error)
+ stream.write('</testcase>\n')
+
+ def _print_error(self, stream, tagname, error):
+ """Print information from a failure or error to the supplied stream."""
+ text = escape(str(error[1]))
+ stream.write('\n')
+ stream.write(' <%s type="%s">%s\n' \
+ % (tagname, _clsname(error[0]), text))
+ tb_stream = StringIO()
+ traceback.print_tb(error[2], None, tb_stream)
+ stream.write(escape(tb_stream.getvalue()))
+ stream.write(' </%s>\n' % tagname)
+ stream.write(' ')
+
+
+def _clsname(cls):
+ return cls.__module__ + "." + cls.__name__
+
+
+class _XMLTestResult(unittest.TestResult):
+
+ """A test result class that stores result as XML.
+
+ Used by XMLTestRunner.
+
+ """
+
+ def __init__(self, classname):
+ unittest.TestResult.__init__(self)
+ self._test_name = classname
+ self._start_time = None
+ self._tests = []
+ self._error = None
+ self._failure = None
+
+ def startTest(self, test):
+ unittest.TestResult.startTest(self, test)
+ self._error = None
+ self._failure = None
+ self._start_time = time.time()
+
+ def stopTest(self, test):
+ time_taken = time.time() - self._start_time
+ unittest.TestResult.stopTest(self, test)
+ if self._error:
+ info = _TestInfo.create_error(test, time_taken, self._error)
+ elif self._failure:
+ info = _TestInfo.create_failure(test, time_taken, self._failure)
+ else:
+ info = _TestInfo.create_success(test, time_taken)
+ self._tests.append(info)
+
+ def addError(self, test, err):
+ unittest.TestResult.addError(self, test, err)
+ self._error = err
+
+ def addFailure(self, test, err):
+ unittest.TestResult.addFailure(self, test, err)
+ self._failure = err
+
+ def print_report(self, stream, time_taken, out, err):
+ """Prints the XML report to the supplied stream.
+
+ The time the tests took to perform as well as the captured standard
+ output and standard error streams must be passed in.a
+
+ """
+ stream.write('<testsuite errors="%(e)d" failures="%(f)d" ' % \
+ { "e": len(self.errors), "f": len(self.failures) })
+ stream.write('name="%(n)s" tests="%(t)d" time="%(time).3f">\n' % \
+ {
+ "n": self._test_name,
+ "t": self.testsRun,
+ "time": time_taken,
+ })
+ for info in self._tests:
+ info.print_report(stream)
+ stream.write(' <system-out><![CDATA[%s]]></system-out>\n' % out)
+ stream.write(' <system-err><![CDATA[%s]]></system-err>\n' % err)
+ stream.write('</testsuite>\n')
+
+
+class XMLTestRunner(object):
+
+ """A test runner that stores results in XML format compatible with JUnit.
+
+ XMLTestRunner(stream=None) -> XML test runner
+
+ The XML file is written to the supplied stream. If stream is None, the
+ results are stored in a file called TEST-<module>.<class>.xml in the
+ current working directory (if not overridden with the path property),
+ where <module> and <class> are the module and class name of the test class.
+
+ """
+
+ def __init__(self, stream=None):
+ self._stream = stream
+ self._path = "."
+
+ def run(self, test):
+ """Run the given test case or test suite."""
+ class_ = test.__class__
+ classname = class_.__module__ + "." + class_.__name__
+ if self._stream == None:
+ filename = "TEST-%s.xml" % classname
+ stream = file(os.path.join(self._path, filename), "w")
+ stream.write('<?xml version="1.0" encoding="utf-8"?>\n')
+ else:
+ stream = self._stream
+
+ result = _XMLTestResult(classname)
+ start_time = time.time()
+
+ fss = _fake_std_streams()
+ fss.__enter__()
+ try:
+ test(result)
+ try:
+ out_s = sys.stdout.getvalue()
+ except AttributeError:
+ out_s = ""
+ try:
+ err_s = sys.stderr.getvalue()
+ except AttributeError:
+ err_s = ""
+ finally:
+ fss.__exit__(None, None, None)
+
+ time_taken = time.time() - start_time
+ result.print_report(stream, time_taken, out_s, err_s)
+ if self._stream is None:
+ stream.close()
+
+ return result
+
+ def _set_path(self, path):
+ self._path = path
+
+ path = property(lambda self: self._path, _set_path, None,
+ """The path where the XML files are stored.
+
+ This property is ignored when the XML file is written to a file
+ stream.""")
+
+
+class _fake_std_streams(object):
+
+ def __enter__(self):
+ self._orig_stdout = sys.stdout
+ self._orig_stderr = sys.stderr
+ #sys.stdout = StringIO()
+ #sys.stderr = StringIO()
+
+ def __exit__(self, exc_type, exc_val, exc_tb):
+ sys.stdout = self._orig_stdout
+ sys.stderr = self._orig_stderr
+
+
+class XMLTestRunnerTest(unittest.TestCase):
+
+ def setUp(self):
+ self._stream = StringIO()
+
+ def _try_test_run(self, test_class, expected):
+
+ """Run the test suite against the supplied test class and compare the
+ XML result against the expected XML string. Fail if the expected
+ string doesn't match the actual string. All time attributes in the
+ expected string should have the value "0.000". All error and failure
+ messages are reduced to "Foobar".
+
+ """
+
+ runner = XMLTestRunner(self._stream)
+ runner.run(unittest.makeSuite(test_class))
+
+ got = self._stream.getvalue()
+ # Replace all time="X.YYY" attributes by time="0.000" to enable a
+ # simple string comparison.
+ got = re.sub(r'time="\d+\.\d+"', 'time="0.000"', got)
+ # Likewise, replace all failure and error messages by a simple "Foobar"
+ # string.
+ got = re.sub(r'(?s)<failure (.*?)>.*?</failure>', r'<failure \1>Foobar</failure>', got)
+ got = re.sub(r'(?s)<error (.*?)>.*?</error>', r'<error \1>Foobar</error>', got)
+ # And finally Python 3 compatibility.
+ got = got.replace('type="builtins.', 'type="exceptions.')
+
+ self.assertEqual(expected, got)
+
+ def test_no_tests(self):
+ """Regression test: Check whether a test run without any tests
+ matches a previous run.
+
+ """
+ class TestTest(unittest.TestCase):
+ pass
+ self._try_test_run(TestTest, """<testsuite errors="0" failures="0" name="unittest.TestSuite" tests="0" time="0.000">
+ <system-out><![CDATA[]]></system-out>
+ <system-err><![CDATA[]]></system-err>
+</testsuite>
+""")
+
+ def test_success(self):
+ """Regression test: Check whether a test run with a successful test
+ matches a previous run.
+
+ """
+ class TestTest(unittest.TestCase):
+ def test_foo(self):
+ pass
+ self._try_test_run(TestTest, """<testsuite errors="0" failures="0" name="unittest.TestSuite" tests="1" time="0.000">
+ <testcase classname="__main__.TestTest" name="test_foo" time="0.000"></testcase>
+ <system-out><![CDATA[]]></system-out>
+ <system-err><![CDATA[]]></system-err>
+</testsuite>
+""")
+
+ def test_failure(self):
+ """Regression test: Check whether a test run with a failing test
+ matches a previous run.
+
+ """
+ class TestTest(unittest.TestCase):
+ def test_foo(self):
+ self.assert_(False)
+ self._try_test_run(TestTest, """<testsuite errors="0" failures="1" name="unittest.TestSuite" tests="1" time="0.000">
+ <testcase classname="__main__.TestTest" name="test_foo" time="0.000">
+ <failure type="exceptions.AssertionError">Foobar</failure>
+ </testcase>
+ <system-out><![CDATA[]]></system-out>
+ <system-err><![CDATA[]]></system-err>
+</testsuite>
+""")
+
+ def test_error(self):
+ """Regression test: Check whether a test run with a erroneous test
+ matches a previous run.
+
+ """
+ class TestTest(unittest.TestCase):
+ def test_foo(self):
+ raise IndexError()
+ self._try_test_run(TestTest, """<testsuite errors="1" failures="0" name="unittest.TestSuite" tests="1" time="0.000">
+ <testcase classname="__main__.TestTest" name="test_foo" time="0.000">
+ <error type="exceptions.IndexError">Foobar</error>
+ </testcase>
+ <system-out><![CDATA[]]></system-out>
+ <system-err><![CDATA[]]></system-err>
+</testsuite>
+""")
+
+ def test_stdout_capture(self):
+ """Regression test: Check whether a test run with output to stdout
+ matches a previous run.
+
+ """
+ class TestTest(unittest.TestCase):
+ def test_foo(self):
+ sys.stdout.write("Test\n")
+ self._try_test_run(TestTest, """<testsuite errors="0" failures="0" name="unittest.TestSuite" tests="1" time="0.000">
+ <testcase classname="__main__.TestTest" name="test_foo" time="0.000"></testcase>
+ <system-out><![CDATA[Test
+]]></system-out>
+ <system-err><![CDATA[]]></system-err>
+</testsuite>
+""")
+
+ def test_stderr_capture(self):
+ """Regression test: Check whether a test run with output to stderr
+ matches a previous run.
+
+ """
+ class TestTest(unittest.TestCase):
+ def test_foo(self):
+ sys.stderr.write("Test\n")
+ self._try_test_run(TestTest, """<testsuite errors="0" failures="0" name="unittest.TestSuite" tests="1" time="0.000">
+ <testcase classname="__main__.TestTest" name="test_foo" time="0.000"></testcase>
+ <system-out><![CDATA[]]></system-out>
+ <system-err><![CDATA[Test
+]]></system-err>
+</testsuite>
+""")
+
+ class NullStream(object):
+ """A file-like object that discards everything written to it."""
+ def write(self, buffer):
+ pass
+
+ def test_unittests_changing_stdout(self):
+ """Check whether the XMLTestRunner recovers gracefully from unit tests
+ that change stdout, but don't change it back properly.
+
+ """
+ class TestTest(unittest.TestCase):
+ def test_foo(self):
+ sys.stdout = XMLTestRunnerTest.NullStream()
+
+ runner = XMLTestRunner(self._stream)
+ runner.run(unittest.makeSuite(TestTest))
+
+ def test_unittests_changing_stderr(self):
+ """Check whether the XMLTestRunner recovers gracefully from unit tests
+ that change stderr, but don't change it back properly.
+
+ """
+ class TestTest(unittest.TestCase):
+ def test_foo(self):
+ sys.stderr = XMLTestRunnerTest.NullStream()
+
+ runner = XMLTestRunner(self._stream)
+ runner.run(unittest.makeSuite(TestTest))
+
+
+if __name__ == "__main__":
+ unittest.main()
diff --git a/gnuradio-core/src/python/gnuradio/gru/CMakeLists.txt b/gnuradio-core/src/python/gnuradio/gru/CMakeLists.txt
new file mode 100644
index 000000000..1c50989d9
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gru/CMakeLists.txt
@@ -0,0 +1,26 @@
+# 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.
+
+include(GrPython)
+
+GR_PYTHON_INSTALL(
+ FILES __init__.py
+ DESTINATION ${GR_PYTHON_DIR}/gnuradio/gru
+ COMPONENT "core_python"
+)
diff --git a/gnuradio-core/src/python/gnuradio/gru/__init__.py b/gnuradio-core/src/python/gnuradio/gru/__init__.py
new file mode 100644
index 000000000..c24439ff5
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gru/__init__.py
@@ -0,0 +1,37 @@
+#
+# Copyright 2005 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.
+#
+
+import glob
+import os.path
+
+# Semi-hideous kludge to import everything in the gruimpl directory
+# into the gnuradio.gru namespace. This keeps us from having to remember
+# to manually update this file.
+
+for p in __path__:
+ filenames = glob.glob (os.path.join (p, "..", "gruimpl", "*.py"))
+ for f in filenames:
+ f = os.path.basename(f).lower()
+ f = f[:-3]
+ if f == '__init__':
+ continue
+ # print f
+ exec "from gnuradio.gruimpl.%s import *" % (f,)
diff --git a/gnuradio-core/src/python/gnuradio/gruimpl/CMakeLists.txt b/gnuradio-core/src/python/gnuradio/gruimpl/CMakeLists.txt
new file mode 100644
index 000000000..7d48f3512
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gruimpl/CMakeLists.txt
@@ -0,0 +1,38 @@
+# 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.
+
+include(GrPython)
+
+GR_PYTHON_INSTALL(FILES
+ __init__.py
+ freqz.py
+ gnuplot_freqz.py
+ hexint.py
+ listmisc.py
+ mathmisc.py
+ lmx2306.py
+ msgq_runner.py
+ os_read_exactly.py
+ sdr_1000.py
+ seq_with_cursor.py
+ socket_stuff.py
+ daemon.py
+ DESTINATION ${GR_PYTHON_DIR}/gnuradio/gruimpl
+ COMPONENT "core_python"
+)
diff --git a/gnuradio-core/src/python/gnuradio/gruimpl/__init__.py b/gnuradio-core/src/python/gnuradio/gruimpl/__init__.py
new file mode 100644
index 000000000..a4917cf64
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gruimpl/__init__.py
@@ -0,0 +1 @@
+# make this a package
diff --git a/gnuradio-core/src/python/gnuradio/gruimpl/daemon.py b/gnuradio-core/src/python/gnuradio/gruimpl/daemon.py
new file mode 100644
index 000000000..e04702152
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gruimpl/daemon.py
@@ -0,0 +1,102 @@
+#
+# 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.
+#
+import os, sys, signal
+
+# Turn application into a background daemon process.
+#
+# When this function returns:
+#
+# 1) The calling process is disconnected from its controlling terminal
+# and will not exit when the controlling session exits
+# 2) If a pidfile name is provided, it is created and the new pid is
+# written into it.
+# 3) If a logfile name is provided, it is opened and stdout/stderr are
+# redirected to it.
+# 4) The process current working directory is changed to '/' to avoid
+# pinning any filesystem mounts.
+# 5) The process umask is set to 0111.
+#
+# The return value is the new pid.
+#
+# To create GNU Radio applications that operate as daemons, add a call to this
+# function after all initialization but just before calling gr.top_block.run()
+# or .start().
+#
+# Daemonized GNU Radio applications may be stopped by sending them a
+# SIGINT, SIGKILL, or SIGTERM, e.g., using 'kill pid' from the command line.
+#
+# If your application uses gr.top_block.run(), the flowgraph will be stopped
+# and the function will return. You should allow your daemon program to exit
+# at this point.
+#
+# If your application uses gr.top_block.start(), you are responsible for hooking
+# the Python signal handler (see 'signal' module) and calling gr.top_block.stop()
+# on your top block, and otherwise causing your daemon process to exit.
+#
+
+def daemonize(pidfile=None, logfile=None):
+ # fork() into background
+ try:
+ pid = os.fork()
+ except OSError, e:
+ raise Exception, "%s [%d]" % (e.strerror, e.errno)
+
+ if pid == 0: # First child of first fork()
+ # Become session leader of new session
+ os.setsid()
+
+ # fork() into background again
+ try:
+ pid = os.fork()
+ except OSError, e:
+ raise Exception, "%s [%d]" % (e.strerror, e.errno)
+
+ if pid != 0:
+ os._exit(0) # Second child of second fork()
+
+ else: # Second child of first fork()
+ os._exit(0)
+
+ os.umask(0111)
+
+ # Write pid
+ pid = os.getpid()
+ if pidfile is not None:
+ open(pidfile, 'w').write('%d\n'%pid)
+
+ # Redirect streams
+ if logfile is not None:
+ lf = open(logfile, 'a+')
+ sys.stdout = lf
+ sys.stderr = lf
+
+ # Prevent pinning any filesystem mounts
+ os.chdir('/')
+
+ # Tell caller what pid to send future signals to
+ return pid
+
+if __name__ == "__main__":
+ import time
+ daemonize()
+ print "Hello, world, from daemon process."
+ time.sleep(20)
+ print "Goodbye, world, from daemon process."
diff --git a/gnuradio-core/src/python/gnuradio/gruimpl/freqz.py b/gnuradio-core/src/python/gnuradio/gruimpl/freqz.py
new file mode 100644
index 000000000..60dca64a5
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gruimpl/freqz.py
@@ -0,0 +1,344 @@
+#!/usr/bin/env python
+#
+# Copyright 2005,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.
+#
+
+# This code lifted from various parts of www.scipy.org -eb 2005-01-24
+
+# Copyright (c) 2001, 2002 Enthought, Inc.
+#
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# a. Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+# b. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# c. Neither the name of the Enthought nor the names of its contributors
+# may be used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+# DAMAGE.
+#
+
+__all__ = ['freqz']
+
+import numpy
+from numpy import *
+Num=numpy
+
+def atleast_1d(*arys):
+ """ Force a sequence of arrays to each be at least 1D.
+
+ Description:
+ Force an array to be at least 1D. If an array is 0D, the
+ array is converted to a single row of values. Otherwise,
+ the array is unaltered.
+ Arguments:
+ *arys -- arrays to be converted to 1 or more dimensional array.
+ Returns:
+ input array converted to at least 1D array.
+ """
+ res = []
+ for ary in arys:
+ ary = asarray(ary)
+ if len(ary.shape) == 0:
+ result = numpy.array([ary[0]])
+ else:
+ result = ary
+ res.append(result)
+ if len(res) == 1:
+ return res[0]
+ else:
+ return res
+
+
+def polyval(p,x):
+ """Evaluate the polynomial p at x. If x is a polynomial then composition.
+
+ Description:
+
+ If p is of length N, this function returns the value:
+ p[0]*(x**N-1) + p[1]*(x**N-2) + ... + p[N-2]*x + p[N-1]
+
+ x can be a sequence and p(x) will be returned for all elements of x.
+ or x can be another polynomial and the composite polynomial p(x) will be
+ returned.
+ """
+ p = asarray(p)
+ if isinstance(x,poly1d):
+ y = 0
+ else:
+ x = asarray(x)
+ y = numpy.zeros(x.shape,x.typecode())
+ for i in range(len(p)):
+ y = x * y + p[i]
+ return y
+
+class poly1d:
+ """A one-dimensional polynomial class.
+
+ p = poly1d([1,2,3]) constructs the polynomial x**2 + 2 x + 3
+
+ p(0.5) evaluates the polynomial at the location
+ p.r is a list of roots
+ p.c is the coefficient array [1,2,3]
+ p.order is the polynomial order (after leading zeros in p.c are removed)
+ p[k] is the coefficient on the kth power of x (backwards from
+ sequencing the coefficient array.
+
+ polynomials can be added, substracted, multplied and divided (returns
+ quotient and remainder).
+ asarray(p) will also give the coefficient array, so polynomials can
+ be used in all functions that accept arrays.
+ """
+ def __init__(self, c_or_r, r=0):
+ if isinstance(c_or_r,poly1d):
+ for key in c_or_r.__dict__.keys():
+ self.__dict__[key] = c_or_r.__dict__[key]
+ return
+ if r:
+ c_or_r = poly(c_or_r)
+ c_or_r = atleast_1d(c_or_r)
+ if len(c_or_r.shape) > 1:
+ raise ValueError, "Polynomial must be 1d only."
+ c_or_r = trim_zeros(c_or_r, trim='f')
+ if len(c_or_r) == 0:
+ c_or_r = numpy.array([0])
+ self.__dict__['coeffs'] = c_or_r
+ self.__dict__['order'] = len(c_or_r) - 1
+
+ def __array__(self,t=None):
+ if t:
+ return asarray(self.coeffs,t)
+ else:
+ return asarray(self.coeffs)
+
+ def __coerce__(self,other):
+ return None
+
+ def __repr__(self):
+ vals = repr(self.coeffs)
+ vals = vals[6:-1]
+ return "poly1d(%s)" % vals
+
+ def __len__(self):
+ return self.order
+
+ def __str__(self):
+ N = self.order
+ thestr = "0"
+ for k in range(len(self.coeffs)):
+ coefstr ='%.4g' % abs(self.coeffs[k])
+ if coefstr[-4:] == '0000':
+ coefstr = coefstr[:-5]
+ power = (N-k)
+ if power == 0:
+ if coefstr != '0':
+ newstr = '%s' % (coefstr,)
+ else:
+ if k == 0:
+ newstr = '0'
+ else:
+ newstr = ''
+ elif power == 1:
+ if coefstr == '0':
+ newstr = ''
+ elif coefstr == '1':
+ newstr = 'x'
+ else:
+ newstr = '%s x' % (coefstr,)
+ else:
+ if coefstr == '0':
+ newstr = ''
+ elif coefstr == '1':
+ newstr = 'x**%d' % (power,)
+ else:
+ newstr = '%s x**%d' % (coefstr, power)
+
+ if k > 0:
+ if newstr != '':
+ if self.coeffs[k] < 0:
+ thestr = "%s - %s" % (thestr, newstr)
+ else:
+ thestr = "%s + %s" % (thestr, newstr)
+ elif (k == 0) and (newstr != '') and (self.coeffs[k] < 0):
+ thestr = "-%s" % (newstr,)
+ else:
+ thestr = newstr
+ return _raise_power(thestr)
+
+
+ def __call__(self, val):
+ return polyval(self.coeffs, val)
+
+ def __mul__(self, other):
+ if isscalar(other):
+ return poly1d(self.coeffs * other)
+ else:
+ other = poly1d(other)
+ return poly1d(polymul(self.coeffs, other.coeffs))
+
+ def __rmul__(self, other):
+ if isscalar(other):
+ return poly1d(other * self.coeffs)
+ else:
+ other = poly1d(other)
+ return poly1d(polymul(self.coeffs, other.coeffs))
+
+ def __add__(self, other):
+ other = poly1d(other)
+ return poly1d(polyadd(self.coeffs, other.coeffs))
+
+ def __radd__(self, other):
+ other = poly1d(other)
+ return poly1d(polyadd(self.coeffs, other.coeffs))
+
+ def __pow__(self, val):
+ if not isscalar(val) or int(val) != val or val < 0:
+ raise ValueError, "Power to non-negative integers only."
+ res = [1]
+ for k in range(val):
+ res = polymul(self.coeffs, res)
+ return poly1d(res)
+
+ def __sub__(self, other):
+ other = poly1d(other)
+ return poly1d(polysub(self.coeffs, other.coeffs))
+
+ def __rsub__(self, other):
+ other = poly1d(other)
+ return poly1d(polysub(other.coeffs, self.coeffs))
+
+ def __div__(self, other):
+ if isscalar(other):
+ return poly1d(self.coeffs/other)
+ else:
+ other = poly1d(other)
+ return map(poly1d,polydiv(self.coeffs, other.coeffs))
+
+ def __rdiv__(self, other):
+ if isscalar(other):
+ return poly1d(other/self.coeffs)
+ else:
+ other = poly1d(other)
+ return map(poly1d,polydiv(other.coeffs, self.coeffs))
+
+ def __setattr__(self, key, val):
+ raise ValueError, "Attributes cannot be changed this way."
+
+ def __getattr__(self, key):
+ if key in ['r','roots']:
+ return roots(self.coeffs)
+ elif key in ['c','coef','coefficients']:
+ return self.coeffs
+ elif key in ['o']:
+ return self.order
+ else:
+ return self.__dict__[key]
+
+ def __getitem__(self, val):
+ ind = self.order - val
+ if val > self.order:
+ return 0
+ if val < 0:
+ return 0
+ return self.coeffs[ind]
+
+ def __setitem__(self, key, val):
+ ind = self.order - key
+ if key < 0:
+ raise ValueError, "Does not support negative powers."
+ if key > self.order:
+ zr = numpy.zeros(key-self.order,self.coeffs.typecode())
+ self.__dict__['coeffs'] = numpy.concatenate((zr,self.coeffs))
+ self.__dict__['order'] = key
+ ind = 0
+ self.__dict__['coeffs'][ind] = val
+ return
+
+ def integ(self, m=1, k=0):
+ return poly1d(polyint(self.coeffs,m=m,k=k))
+
+ def deriv(self, m=1):
+ return poly1d(polyder(self.coeffs,m=m))
+
+def freqz(b, a, worN=None, whole=0, plot=None):
+ """Compute frequency response of a digital filter.
+
+ Description:
+
+ Given the numerator (b) and denominator (a) of a digital filter compute
+ its frequency response.
+
+ jw -jw -jmw
+ jw B(e) b[0] + b[1]e + .... + b[m]e
+ H(e) = ---- = ------------------------------------
+ jw -jw -jnw
+ A(e) a[0] + a[2]e + .... + a[n]e
+
+ Inputs:
+
+ b, a --- the numerator and denominator of a linear filter.
+ worN --- If None, then compute at 512 frequencies around the unit circle.
+ If a single integer, the compute at that many frequencies.
+ Otherwise, compute the response at frequencies given in worN
+ whole -- Normally, frequencies are computed from 0 to pi (upper-half of
+ unit-circle. If whole is non-zero compute frequencies from 0
+ to 2*pi.
+
+ Outputs: (h,w)
+
+ h -- The frequency response.
+ w -- The frequencies at which h was computed.
+ """
+ b, a = map(atleast_1d, (b,a))
+ if whole:
+ lastpoint = 2*pi
+ else:
+ lastpoint = pi
+ if worN is None:
+ N = 512
+ w = Num.arange(0,lastpoint,lastpoint/N)
+ elif isinstance(worN, types.IntType):
+ N = worN
+ w = Num.arange(0,lastpoint,lastpoint/N)
+ else:
+ w = worN
+ w = atleast_1d(w)
+ zm1 = exp(-1j*w)
+ h = polyval(b[::-1], zm1) / polyval(a[::-1], zm1)
+ # if not plot is None:
+ # plot(w, h)
+ return h, w
diff --git a/gnuradio-core/src/python/gnuradio/gruimpl/gnuplot_freqz.py b/gnuradio-core/src/python/gnuradio/gruimpl/gnuplot_freqz.py
new file mode 100755
index 000000000..defc47b59
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gruimpl/gnuplot_freqz.py
@@ -0,0 +1,82 @@
+#!/usr/bin/env python
+#
+# Copyright 2005,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.
+#
+
+__all__ = ['gnuplot_freqz']
+
+import tempfile
+import os
+import math
+import numpy
+
+from gnuradio import gr
+from gnuradio.gruimpl.freqz import freqz
+
+
+def gnuplot_freqz (hw, Fs=None, logfreq=False):
+
+ """hw is a tuple of the form (h, w) where h is sequence of complex
+ freq responses, and w is a sequence of corresponding frequency
+ points. Plot the frequency response using gnuplot. If Fs is
+ provide, use it as the sampling frequency, else use 2*pi.
+
+ Returns a handle to the gnuplot graph. When the handle is reclaimed
+ the graph is torn down."""
+
+ data_file = tempfile.NamedTemporaryFile ()
+ cmd_file = os.popen ('gnuplot', 'w')
+
+ h, w = hw
+ ampl = 20 * numpy.log10 (numpy.absolute (h) + 1e-9)
+ phase = map (lambda x: math.atan2 (x.imag, x.real), h)
+
+ if Fs:
+ w *= (Fs/(2*math.pi))
+
+ for freq, a, ph in zip (w, ampl, phase):
+ data_file.write ("%g\t%g\t%g\n" % (freq, a, ph))
+
+ data_file.flush ()
+
+ cmd_file.write ("set grid\n")
+ if logfreq:
+ cmd_file.write ("set logscale x\n")
+ else:
+ cmd_file.write ("unset logscale x\n")
+ cmd_file.write ("plot '%s' using 1:2 with lines\n" % (data_file.name,))
+ cmd_file.flush ()
+
+ return (cmd_file, data_file)
+
+
+def test_plot ():
+ sample_rate = 2.0e6
+ taps = gr.firdes.low_pass (1.0, # gain
+ sample_rate, # sampling rate
+ 200e3, # low pass cutoff freq
+ 100e3, # width of trans. band
+ gr.firdes.WIN_HAMMING)
+ # print len (taps)
+ return gnuplot_freqz (freqz (taps, 1), sample_rate)
+
+if __name__ == '__main__':
+ handle = test_plot ()
+ raw_input ('Press Enter to continue: ')
diff --git a/gnuradio-core/src/python/gnuradio/gruimpl/hexint.py b/gnuradio-core/src/python/gnuradio/gruimpl/hexint.py
new file mode 100644
index 000000000..0fb5ecde0
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gruimpl/hexint.py
@@ -0,0 +1,44 @@
+#
+# Copyright 2005 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.
+#
+
+def hexint(mask):
+ """
+ Convert unsigned masks into signed ints.
+
+ This allows us to use hex constants like 0xf0f0f0f2 when talking to
+ our hardware and not get screwed by them getting treated as python
+ longs.
+ """
+ if mask >= 2**31:
+ return int(mask-2**32)
+ return mask
+
+def hexshort(mask):
+ """
+ Convert unsigned masks into signed shorts.
+
+ This allows us to use hex constants like 0x8000 when talking to
+ our hardware and not get screwed by them getting treated as python
+ longs.
+ """
+ if mask >= 2**15:
+ return int(mask-2**16)
+ return mask
diff --git a/gnuradio-core/src/python/gnuradio/gruimpl/listmisc.py b/gnuradio-core/src/python/gnuradio/gruimpl/listmisc.py
new file mode 100644
index 000000000..9e70eb863
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gruimpl/listmisc.py
@@ -0,0 +1,29 @@
+#
+# Copyright 2005 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.
+#
+
+def list_reverse(x):
+ """
+ Return a copy of x that is reverse order.
+ """
+ r = list(x)
+ r.reverse()
+ return r
+
diff --git a/gnuradio-core/src/python/gnuradio/gruimpl/lmx2306.py b/gnuradio-core/src/python/gnuradio/gruimpl/lmx2306.py
new file mode 100755
index 000000000..aa4efc3e9
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gruimpl/lmx2306.py
@@ -0,0 +1,186 @@
+#!/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.
+#
+
+'''Control National LMX2306 based frequency synthesizer'''
+
+from gnuradio import gr
+from gnuradio import eng_notation
+from gnuradio.eng_option import eng_option
+from optparse import OptionParser
+
+# bottom two bits of 21 bit word select which register to program
+
+R_REG = 0x0
+AB_REG = 0x1
+F_REG = 0x2
+
+F_counter_reset = (1 << 2)
+F_phase_detector_polarity = (1 << 7)
+
+F_LD_tri_state = (0 << 4)
+F_LD_R_divider_output = (4 << 4)
+F_LD_N_divider_output = (2 << 4)
+F_LD_serial_data_output = (6 << 4)
+F_LD_digital_lock_detect = (1 << 4)
+F_LD_open_drain = (5 << 4)
+F_LD_high = (3 << 4)
+F_LD_low = (7 << 4)
+
+# F_default = F_LD_digital_lock_detect | F_phase_detector_polarity
+F_default = F_LD_open_drain | F_phase_detector_polarity
+
+#
+# 4 control pins:
+# CE always high
+# LE load enable. When LE goes high, data stored in the shift register
+# is loaded into one of the three registers
+# CLK data is clocked in on the rising edge
+# DATA single data bit. Entered MSB first
+
+DB_CLK = (1 << 0)
+DB_DATA = (1 << 1)
+DB_LE = (1 << 2)
+DB_CE = (1 << 3)
+
+class lmx2306 (object):
+ '''Control the National LMX2306 PLL'''
+ __slots__ = ['pp', 'shadow', 'fosc', 'r', 'step_size', 'verbose']
+ def __init__ (self, fosc, step_size, which_pp = 0):
+ '''FOSC is the frequency of the reference oscillator,
+ STEP_SIZE is the step between valid frequencies,
+ WHICH_PP specifies which parallel port to use
+ '''
+ self.pp = gr.make_ppio (which_pp)
+ self.shadow = DB_CE
+ self.pp.lock ()
+ self.pp.write_data (self.shadow)
+ self.pp.unlock ()
+ self.verbose = False
+ self._set_fosc (fosc)
+ self._set_step (step_size)
+
+
+ def program (self, r, a, b):
+ if self.verbose:
+ print "lmx2306: r = %d a = %d b = %d" % (r, a, b)
+ self.pp.lock ()
+ self._write_word (F_REG | F_default | F_counter_reset)
+ self._write_word (R_REG | ((r & 0x3fff) << 2))
+ self._write_word (AB_REG | ((a & 0x1f) << 2) | ((b & 0x1fff) << 7))
+ self._write_word (F_REG | F_default)
+ self.pp.unlock ()
+
+ def set_freq (self, freq):
+ '''Set the PLL frequency to FREQ
+
+ Return the actual freq value set. It will be rounded down to a
+ multiple of step_size
+ '''
+ divisor = int (freq / self.step_size)
+ actual = divisor * self.step_size
+ (a, b) = self._compute_ab (divisor)
+ self.program (self.r, a, b)
+ return actual
+
+ # ----------------------------------------------------------------
+
+ def _set_fosc (self, ref_oscillator_freq):
+ self.fosc = ref_oscillator_freq
+
+ def _set_step (self, step_size):
+ r = int (self.fosc / step_size)
+ if r * step_size != self.fosc:
+ raise ValueError, "step_size is not a factor of self.fosc"
+ if r < 3 or r > 16383:
+ raise ValueError, "r is out of range"
+ self.r = r
+ self.step_size = step_size
+
+ def _compute_ab (self, divisor):
+ b = divisor / 8
+ a = divisor - (b * 8)
+ if b < 3 or b > 8191 or a > b:
+ raise ValueError, "Invalid divisor"
+ return (a, b)
+
+ def _write_word (self, w):
+ for i in range(21):
+ if w & (1 << 20):
+ self._set_DATA_1 ()
+ else:
+ self._set_DATA_0 ()
+ w = (w << 1) & 0x0ffffff
+ self._set_CLK_1 ()
+ self._set_CLK_0 ()
+ self._set_LE_1 ()
+ self._set_LE_0 ()
+
+ def _set_LE_0 (self):
+ self.shadow = self.shadow & ~DB_LE
+ self.pp.write_data (self.shadow)
+
+ def _set_LE_1 (self):
+ self.shadow = self.shadow | DB_LE
+ self.pp.write_data (self.shadow)
+
+ def _set_CLK_0 (self):
+ self.shadow = self.shadow & ~DB_CLK
+ self.pp.write_data (self.shadow)
+
+ def _set_CLK_1 (self):
+ self.shadow = self.shadow | DB_CLK
+ self.pp.write_data (self.shadow)
+
+ def _set_DATA_0 (self):
+ self.shadow = self.shadow & ~DB_DATA
+ self.pp.write_data (self.shadow)
+
+ def _set_DATA_1 (self):
+ self.shadow = self.shadow | DB_DATA
+ self.pp.write_data (self.shadow)
+
+if __name__ == '__main__':
+ parser = OptionParser (option_class=eng_option)
+ parser.add_option ("-o", "--fosc", type="eng_float", default=32e6,
+ help="set reference oscillator freq to FREQ", metavar="FREQ")
+ parser.add_option ("-s", "--step-size", type="eng_float", default=10e3,
+ help="set the frequency step size to STEP_SIZE")
+ parser.add_option ("-f", "--freq", type="eng_float", default=430e6,
+ help="set VCO frequency to FREQ")
+ parser.add_option ("-v", "--verbose", action="store_true", default=False)
+ (options, args) = parser.parse_args ()
+
+ if options.verbose:
+ print "fosc = %s step = %s fvco = %s" % (
+ eng_notation.num_to_str (options.fosc),
+ eng_notation.num_to_str (options.step_size),
+ eng_notation.num_to_str (options.freq))
+
+ lmx = lmx2306 (options.fosc, options.step_size)
+ lmx.verbose = options.verbose
+
+ actual = lmx.set_freq (options.freq)
+
+ if options.verbose:
+ print "fvco_actual = %s delta = %s" % (
+ eng_notation.num_to_str (actual),
+ eng_notation.num_to_str (options.freq - actual))
diff --git a/gnuradio-core/src/python/gnuradio/gruimpl/mathmisc.py b/gnuradio-core/src/python/gnuradio/gruimpl/mathmisc.py
new file mode 100644
index 000000000..7e6f23a34
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gruimpl/mathmisc.py
@@ -0,0 +1,33 @@
+#
+# Copyright 2005 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.
+#
+
+import math
+
+def gcd(a,b):
+ while b:
+ a,b = b, a % b
+ return a
+
+def lcm(a,b):
+ return a * b / gcd(a, b)
+
+def log2(x):
+ return math.log(x)/math.log(2)
diff --git a/gnuradio-core/src/python/gnuradio/gruimpl/msgq_runner.py b/gnuradio-core/src/python/gnuradio/gruimpl/msgq_runner.py
new file mode 100644
index 000000000..767a74a71
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gruimpl/msgq_runner.py
@@ -0,0 +1,82 @@
+#
+# 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.
+#
+
+"""
+Convenience class for dequeuing messages from a gr.msg_queue and
+invoking a callback.
+
+Creates a Python thread that does a blocking read on the supplied
+gr.msg_queue, then invokes callback each time a msg is received.
+
+If the msg type is not 0, then it is treated as a signal to exit
+its loop.
+
+If the callback raises an exception, and the runner was created
+with 'exit_on_error' equal to True, then the runner will store the
+exception and exit its loop, otherwise the exception is ignored.
+
+To get the exception that the callback raised, if any, call
+exit_error() on the object.
+
+To manually stop the runner, call stop() on the object.
+
+To determine if the runner has exited, call exited() on the object.
+"""
+
+from gnuradio import gr
+import gnuradio.gr.gr_threading as _threading
+
+class msgq_runner(_threading.Thread):
+
+ def __init__(self, msgq, callback, exit_on_error=False):
+ _threading.Thread.__init__(self)
+
+ self._msgq = msgq
+ self._callback = callback
+ self._exit_on_error = exit_on_error
+ self._done = False
+ self._exited = False
+ self._exit_error = None
+ self.setDaemon(1)
+ self.start()
+
+ def run(self):
+ while not self._done:
+ msg = self._msgq.delete_head()
+ if msg.type() != 0:
+ self.stop()
+ else:
+ try:
+ self._callback(msg)
+ except Exception, e:
+ if self._exit_on_error:
+ self._exit_error = e
+ self.stop()
+ self._exited = True
+
+ def stop(self):
+ self._done = True
+
+ def exited(self):
+ return self._exited
+
+ def exit_error(self):
+ return self._exit_error
diff --git a/gnuradio-core/src/python/gnuradio/gruimpl/os_read_exactly.py b/gnuradio-core/src/python/gnuradio/gruimpl/os_read_exactly.py
new file mode 100644
index 000000000..40b053770
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gruimpl/os_read_exactly.py
@@ -0,0 +1,36 @@
+#
+# Copyright 2005 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.
+#
+
+import os
+
+def os_read_exactly(file_descriptor, nbytes):
+ """
+ Replacement for os.read that blocks until it reads exactly nbytes.
+
+ """
+ s = ''
+ while nbytes > 0:
+ sbuf = os.read(file_descriptor, nbytes)
+ if not(sbuf):
+ return ''
+ nbytes -= len(sbuf)
+ s = s + sbuf
+ return s
diff --git a/gnuradio-core/src/python/gnuradio/gruimpl/sdr_1000.py b/gnuradio-core/src/python/gnuradio/gruimpl/sdr_1000.py
new file mode 100644
index 000000000..5192a7155
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gruimpl/sdr_1000.py
@@ -0,0 +1,84 @@
+#
+# Copyright 2003,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 gnuradio import gr
+
+class sdr_1000 (gr.sdr_1000_base):
+ "Control the DDS on the SDR-1000"
+ def __init__(self, pport = 0):
+ gr.sdr_1000_base.__init__(self, pport)
+ self.write_latch (3, 0x00, 0xC0) # Reset low, WRS/ low
+ self.write_reg (0x20, 0x40)
+
+ def write_reg(self, addr, data):
+ self.write_latch (3, addr & 0x3f, 0x3f)
+ self.write_latch (2, data, 0xff)
+ self.write_latch (3, 0x40, 0x40)
+ self.write_latch (3, 0x00, 0x40)
+
+ def set_freq(self, freq):
+ self.set_band (freq)
+ ftw = freq / 200e6;
+ for i in xrange(6):
+ word = int(ftw * 256)
+ ftw = ftw*256 - word
+ # print (('%d [%02x]') % (i, word))
+ self.write_reg (4+i, word)
+
+ def set_band (self, freq):
+ if freq <= 2.25e6:
+ band = 0
+ elif freq <= 5.5e6:
+ band = 1
+ elif freq <= 11e6:
+ band = 3 # due to wiring mistake on board
+ elif freq <= 22e6:
+ band = 2 # due to wiring mistake on board
+ elif freq <= 37.5e6:
+ band = 4
+ else:
+ band = 5
+
+ self.write_latch (1, 1 << band, 0x3f)
+
+ def set_bit (self, reg, bit, state):
+ val = 0x00
+ if state: val = 1<<bit
+ self.write_latch (reg, val, 1<<bit)
+
+ def set_tx (self, on = 1):
+ self.set_bit(1, 6, on)
+
+ def set_rx (self):
+ self.set_bit(1, 6, 0)
+
+ def set_gain (self, high):
+ self.set_bit(0, 7, high)
+
+ def set_mute (self, mute = 1):
+ self.set_bit(1, 7, mute)
+
+ def set_unmute (self):
+ self.set_bit(1, 7, 0)
+
+ def set_external_pin (self, pin, on = 1):
+ assert (pin < 8 and pin > 0), "Out of range 1..7"
+ self.set_bit(0, pin-1, on)
diff --git a/gnuradio-core/src/python/gnuradio/gruimpl/seq_with_cursor.py b/gnuradio-core/src/python/gnuradio/gruimpl/seq_with_cursor.py
new file mode 100644
index 000000000..def3299b6
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gruimpl/seq_with_cursor.py
@@ -0,0 +1,77 @@
+#
+# Copyright 2003,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.
+#
+
+# misc utilities
+
+import types
+import exceptions
+
+class seq_with_cursor (object):
+ __slots__ = [ 'items', 'index' ]
+
+ def __init__ (self, items, initial_index = None, initial_value = None):
+ assert len (items) > 0, "seq_with_cursor: len (items) == 0"
+ self.items = items
+ self.set_index (initial_index)
+ if initial_value is not None:
+ self.set_index_by_value(initial_value)
+
+ def set_index (self, initial_index):
+ if initial_index is None:
+ self.index = len (self.items) / 2
+ elif initial_index >= 0 and initial_index < len (self.items):
+ self.index = initial_index
+ else:
+ raise exceptions.ValueError
+
+ def set_index_by_value(self, v):
+ """
+ Set index to the smallest value such that items[index] >= v.
+ If there is no such item, set index to the maximum value.
+ """
+ self.set_index(0) # side effect!
+ cv = self.current()
+ more = True
+ while cv < v and more:
+ cv, more = self.next() # side effect!
+
+ def next (self):
+ new_index = self.index + 1
+ if new_index < len (self.items):
+ self.index = new_index
+ return self.items[new_index], True
+ else:
+ return self.items[self.index], False
+
+ def prev (self):
+ new_index = self.index - 1
+ if new_index >= 0:
+ self.index = new_index
+ return self.items[new_index], True
+ else:
+ return self.items[self.index], False
+
+ def current (self):
+ return self.items[self.index]
+
+ def get_seq (self):
+ return self.items[:] # copy of items
+
diff --git a/gnuradio-core/src/python/gnuradio/gruimpl/socket_stuff.py b/gnuradio-core/src/python/gnuradio/gruimpl/socket_stuff.py
new file mode 100644
index 000000000..329fd2ed3
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gruimpl/socket_stuff.py
@@ -0,0 +1,56 @@
+#
+# Copyright 2005 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.
+#
+
+# random socket related stuff
+
+import socket
+import os
+import sys
+
+def tcp_connect_or_die(sock_addr):
+ """
+ @param sock_addr: (host, port) to connect to
+ @type sock_addr: tuple
+ @returns: socket or exits
+ """
+ s = socket.socket (socket.AF_INET, socket.SOCK_STREAM)
+ try:
+ s.connect(sock_addr)
+ except socket.error, err:
+ sys.stderr.write('Failed to connect to %s: %s\n' %
+ (sock_addr, os.strerror (err.args[0]),))
+ sys.exit(1)
+ return s
+
+def udp_connect_or_die(sock_addr):
+ """
+ @param sock_addr: (host, port) to connect to
+ @type sock_addr: tuple
+ @returns: socket or exits
+ """
+ s = socket.socket (socket.AF_INET, socket.SOCK_DGRAM)
+ try:
+ s.connect(sock_addr)
+ except socket.error, err:
+ sys.stderr.write('Failed to connect to %s: %s\n' %
+ (sock_addr, os.strerror (err.args[0]),))
+ sys.exit(1)
+ return s
diff --git a/gnuradio-core/src/python/gnuradio/optfir.py b/gnuradio-core/src/python/gnuradio/optfir.py
new file mode 100644
index 000000000..bbf9ead74
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/optfir.py
@@ -0,0 +1,341 @@
+#
+# Copyright 2004,2005,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.
+#
+
+'''
+Routines for designing optimal FIR filters.
+
+For a great intro to how all this stuff works, see section 6.6 of
+"Digital Signal Processing: A Practical Approach", Emmanuael C. Ifeachor
+and Barrie W. Jervis, Adison-Wesley, 1993. ISBN 0-201-54413-X.
+'''
+
+import math, cmath
+from gnuradio import gr
+
+remez = gr.remez
+
+# ----------------------------------------------------------------
+
+## Builds a low pass filter.
+# @param gain Filter gain in the passband (linear)
+# @param Fs Sampling rate (sps)
+# @param freq1 End of pass band (in Hz)
+# @param freq2 Start of stop band (in Hz)
+# @param passband_ripple_db Pass band ripple in dB (should be small, < 1)
+# @param stopband_atten_db Stop band attenuation in dB (should be large, >= 60)
+# @param nextra_taps Extra taps to use in the filter (default=2)
+def low_pass (gain, Fs, freq1, freq2, passband_ripple_db, stopband_atten_db,
+ nextra_taps=2):
+ passband_dev = passband_ripple_to_dev (passband_ripple_db)
+ stopband_dev = stopband_atten_to_dev (stopband_atten_db)
+ desired_ampls = (gain, 0)
+ (n, fo, ao, w) = remezord ([freq1, freq2], desired_ampls,
+ [passband_dev, stopband_dev], Fs)
+ # The remezord typically under-estimates the filter order, so add 2 taps by default
+ taps = gr.remez (n + nextra_taps, fo, ao, w, "bandpass")
+ return taps
+
+## Builds a band pass filter.
+# @param gain Filter gain in the passband (linear)
+# @param Fs Sampling rate (sps)
+# @param freq_sb1 End of stop band (in Hz)
+# @param freq_pb1 Start of pass band (in Hz)
+# @param freq_pb2 End of pass band (in Hz)
+# @param freq_sb2 Start of stop band (in Hz)
+# @param passband_ripple_db Pass band ripple in dB (should be small, < 1)
+# @param stopband_atten_db Stop band attenuation in dB (should be large, >= 60)
+# @param nextra_taps Extra taps to use in the filter (default=2)
+def band_pass (gain, Fs, freq_sb1, freq_pb1, freq_pb2, freq_sb2,
+ passband_ripple_db, stopband_atten_db,
+ nextra_taps=2):
+ passband_dev = passband_ripple_to_dev (passband_ripple_db)
+ stopband_dev = stopband_atten_to_dev (stopband_atten_db)
+ desired_ampls = (0, gain, 0)
+ desired_freqs = [freq_sb1, freq_pb1, freq_pb2, freq_sb2]
+ desired_ripple = [stopband_dev, passband_dev, stopband_dev]
+ (n, fo, ao, w) = remezord (desired_freqs, desired_ampls,
+ desired_ripple, Fs)
+ # The remezord typically under-estimates the filter order, so add 2 taps by default
+ taps = gr.remez (n + nextra_taps, fo, ao, w, "bandpass")
+ return taps
+
+
+## Builds a band pass filter with complex taps by making an LPF and
+# spinning it up to the right center frequency
+# @param gain Filter gain in the passband (linear)
+# @param Fs Sampling rate (sps)
+# @param freq_sb1 End of stop band (in Hz)
+# @param freq_pb1 Start of pass band (in Hz)
+# @param freq_pb2 End of pass band (in Hz)
+# @param freq_sb2 Start of stop band (in Hz)
+# @param passband_ripple_db Pass band ripple in dB (should be small, < 1)
+# @param stopband_atten_db Stop band attenuation in dB (should be large, >= 60)
+# @param nextra_taps Extra taps to use in the filter (default=2)
+def complex_band_pass (gain, Fs, freq_sb1, freq_pb1, freq_pb2, freq_sb2,
+ passband_ripple_db, stopband_atten_db,
+ nextra_taps=2):
+ center_freq = (freq_pb2 + freq_pb1) / 2.0
+ lp_pb = (freq_pb2 - center_freq)/1.0
+ lp_sb = freq_sb2 - center_freq
+ lptaps = low_pass(gain, Fs, lp_pb, lp_sb, passband_ripple_db,
+ stopband_atten_db, nextra_taps)
+ spinner = [cmath.exp(2j*cmath.pi*center_freq/Fs*i) for i in xrange(len(lptaps))]
+ taps = [s*t for s,t in zip(spinner, lptaps)]
+ return taps
+
+
+## Builds a band reject filter
+# spinning it up to the right center frequency
+# @param gain Filter gain in the passband (linear)
+# @param Fs Sampling rate (sps)
+# @param freq_pb1 End of pass band (in Hz)
+# @param freq_sb1 Start of stop band (in Hz)
+# @param freq_sb2 End of stop band (in Hz)
+# @param freq_pb2 Start of pass band (in Hz)
+# @param passband_ripple_db Pass band ripple in dB (should be small, < 1)
+# @param stopband_atten_db Stop band attenuation in dB (should be large, >= 60)
+# @param nextra_taps Extra taps to use in the filter (default=2)
+def band_reject (gain, Fs, freq_pb1, freq_sb1, freq_sb2, freq_pb2,
+ passband_ripple_db, stopband_atten_db,
+ nextra_taps=2):
+ passband_dev = passband_ripple_to_dev (passband_ripple_db)
+ stopband_dev = stopband_atten_to_dev (stopband_atten_db)
+ desired_ampls = (gain, 0, gain)
+ desired_freqs = [freq_pb1, freq_sb1, freq_sb2, freq_pb2]
+ desired_ripple = [passband_dev, stopband_dev, passband_dev]
+ (n, fo, ao, w) = remezord (desired_freqs, desired_ampls,
+ desired_ripple, Fs)
+ # Make sure we use an odd number of taps
+ if((n+nextra_taps)%2 == 1):
+ n += 1
+ # The remezord typically under-estimates the filter order, so add 2 taps by default
+ taps = gr.remez (n + nextra_taps, fo, ao, w, "bandpass")
+ return taps
+
+
+## Builds a high pass filter.
+# @param gain Filter gain in the passband (linear)
+# @param Fs Sampling rate (sps)
+# @param freq1 End of stop band (in Hz)
+# @param freq2 Start of pass band (in Hz)
+# @param passband_ripple_db Pass band ripple in dB (should be small, < 1)
+# @param stopband_atten_db Stop band attenuation in dB (should be large, >= 60)
+# @param nextra_taps Extra taps to use in the filter (default=2)
+def high_pass (gain, Fs, freq1, freq2, passband_ripple_db, stopband_atten_db,
+ nextra_taps=2):
+ passband_dev = passband_ripple_to_dev (passband_ripple_db)
+ stopband_dev = stopband_atten_to_dev (stopband_atten_db)
+ desired_ampls = (0, 1)
+ (n, fo, ao, w) = remezord ([freq1, freq2], desired_ampls,
+ [stopband_dev, passband_dev], Fs)
+ # For a HPF, we need to use an odd number of taps
+ # In gr.remez, ntaps = n+1, so n must be even
+ if((n+nextra_taps)%2 == 1):
+ n += 1
+
+ # The remezord typically under-estimates the filter order, so add 2 taps by default
+ taps = gr.remez (n + nextra_taps, fo, ao, w, "bandpass")
+ return taps
+
+# ----------------------------------------------------------------
+
+def stopband_atten_to_dev (atten_db):
+ """Convert a stopband attenuation in dB to an absolute value"""
+ return 10**(-atten_db/20)
+
+def passband_ripple_to_dev (ripple_db):
+ """Convert passband ripple spec expressed in dB to an absolute value"""
+ return (10**(ripple_db/20)-1)/(10**(ripple_db/20)+1)
+
+# ----------------------------------------------------------------
+
+def remezord (fcuts, mags, devs, fsamp = 2):
+ '''
+ FIR order estimator (lowpass, highpass, bandpass, mulitiband).
+
+ (n, fo, ao, w) = remezord (f, a, dev)
+ (n, fo, ao, w) = remezord (f, a, dev, fs)
+
+ (n, fo, ao, w) = remezord (f, a, dev) finds the approximate order,
+ normalized frequency band edges, frequency band amplitudes, and
+ weights that meet input specifications f, a, and dev, to use with
+ the remez command.
+
+ * f is a sequence of frequency band edges (between 0 and Fs/2, where
+ Fs is the sampling frequency), and a is a sequence specifying the
+ desired amplitude on the bands defined by f. The length of f is
+ twice the length of a, minus 2. The desired function is
+ piecewise constant.
+
+ * dev is a sequence the same size as a that specifies the maximum
+ allowable deviation or ripples between the frequency response
+ and the desired amplitude of the output filter, for each band.
+
+ Use remez with the resulting order n, frequency sequence fo,
+ amplitude response sequence ao, and weights w to design the filter b
+ which approximately meets the specifications given by remezord
+ input parameters f, a, and dev:
+
+ b = remez (n, fo, ao, w)
+
+ (n, fo, ao, w) = remezord (f, a, dev, Fs) specifies a sampling frequency Fs.
+
+ Fs defaults to 2 Hz, implying a Nyquist frequency of 1 Hz. You can
+ therefore specify band edges scaled to a particular applications
+ sampling frequency.
+
+ In some cases remezord underestimates the order n. If the filter
+ does not meet the specifications, try a higher order such as n+1
+ or n+2.
+ '''
+ # get local copies
+ fcuts = fcuts[:]
+ mags = mags[:]
+ devs = devs[:]
+
+ for i in range (len (fcuts)):
+ fcuts[i] = float (fcuts[i]) / fsamp
+
+ nf = len (fcuts)
+ nm = len (mags)
+ nd = len (devs)
+ nbands = nm
+
+ if nm != nd:
+ raise ValueError, "Length of mags and devs must be equal"
+
+ if nf != 2 * (nbands - 1):
+ raise ValueError, "Length of f must be 2 * len (mags) - 2"
+
+ for i in range (len (mags)):
+ if mags[i] != 0: # if not stopband, get relative deviation
+ devs[i] = devs[i] / mags[i]
+
+ # separate the passband and stopband edges
+ f1 = fcuts[0::2]
+ f2 = fcuts[1::2]
+
+ n = 0
+ min_delta = 2
+ for i in range (len (f1)):
+ if f2[i] - f1[i] < min_delta:
+ n = i
+ min_delta = f2[i] - f1[i]
+
+ if nbands == 2:
+ # lowpass or highpass case (use formula)
+ l = lporder (f1[n], f2[n], devs[0], devs[1])
+ else:
+ # bandpass or multipass case
+ # try different lowpasses and take the worst one that
+ # goes through the BP specs
+ l = 0
+ for i in range (1, nbands-1):
+ l1 = lporder (f1[i-1], f2[i-1], devs[i], devs[i-1])
+ l2 = lporder (f1[i], f2[i], devs[i], devs[i+1])
+ l = max (l, l1, l2)
+
+ n = int (math.ceil (l)) - 1 # need order, not length for remez
+
+ # cook up remez compatible result
+ ff = [0] + fcuts + [1]
+ for i in range (1, len (ff) - 1):
+ ff[i] *= 2
+
+ aa = []
+ for a in mags:
+ aa = aa + [a, a]
+
+ max_dev = max (devs)
+ wts = [1] * len(devs)
+ for i in range (len (wts)):
+ wts[i] = max_dev / devs[i]
+
+ return (n, ff, aa, wts)
+
+# ----------------------------------------------------------------
+
+def lporder (freq1, freq2, delta_p, delta_s):
+ '''
+ FIR lowpass filter length estimator. freq1 and freq2 are
+ normalized to the sampling frequency. delta_p is the passband
+ deviation (ripple), delta_s is the stopband deviation (ripple).
+
+ Note, this works for high pass filters too (freq1 > freq2), but
+ doesnt work well if the transition is near f == 0 or f == fs/2
+
+ From Herrmann et al (1973), Practical design rules for optimum
+ finite impulse response filters. Bell System Technical J., 52, 769-99
+ '''
+ df = abs (freq2 - freq1)
+ ddp = math.log10 (delta_p)
+ dds = math.log10 (delta_s)
+
+ a1 = 5.309e-3
+ a2 = 7.114e-2
+ a3 = -4.761e-1
+ a4 = -2.66e-3
+ a5 = -5.941e-1
+ a6 = -4.278e-1
+
+ b1 = 11.01217
+ b2 = 0.5124401
+
+ t1 = a1 * ddp * ddp
+ t2 = a2 * ddp
+ t3 = a4 * ddp * ddp
+ t4 = a5 * ddp
+
+ dinf=((t1 + t2 + a3) * dds) + (t3 + t4 + a6)
+ ff = b1 + b2 * (ddp - dds)
+ n = dinf / df - ff * df + 1
+ return n
+
+
+def bporder (freq1, freq2, delta_p, delta_s):
+ '''
+ FIR bandpass filter length estimator. freq1 and freq2 are
+ normalized to the sampling frequency. delta_p is the passband
+ deviation (ripple), delta_s is the stopband deviation (ripple).
+
+ From Mintzer and Liu (1979)
+ '''
+ df = abs (freq2 - freq1)
+ ddp = math.log10 (delta_p)
+ dds = math.log10 (delta_s)
+
+ a1 = 0.01201
+ a2 = 0.09664
+ a3 = -0.51325
+ a4 = 0.00203
+ a5 = -0.57054
+ a6 = -0.44314
+
+ t1 = a1 * ddp * ddp
+ t2 = a2 * ddp
+ t3 = a4 * ddp * ddp
+ t4 = a5 * ddp
+
+ cinf = dds * (t1 + t2 + a3) + t3 + t4 + a6
+ ginf = -14.6 * math.log10 (delta_p / delta_s) - 16.9
+ n = cinf / df + ginf * df + 1
+ return n
+
diff --git a/gnuradio-core/src/python/gnuradio/window.py b/gnuradio-core/src/python/gnuradio/window.py
new file mode 100644
index 000000000..4a1d0c516
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/window.py
@@ -0,0 +1,180 @@
+#
+# Copyright 2004,2005,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.
+#
+
+'''
+Routines for designing window functions.
+'''
+
+import math
+from gnuradio import gr
+
+def izero(x):
+ izeroepsilon = 1e-21
+ halfx = x/2.0
+ accum = u = n = 1
+ while 1:
+ temp = halfx/n
+ n += 1
+ temp *= temp
+ u *= temp
+ accum += u
+ if u >= IzeroEPSILON*sum:
+ break
+ return accum
+
+def midm1(fft_size):
+ return (fft_size - 1)/2
+
+def midp1(fft_size):
+ return (fft_size+1)/2
+
+def freq(fft_size):
+ return 2.0*math.pi/fft_size
+
+def rate(fft_size):
+ return 1.0/(fft_size >> 1)
+
+def expn(fft_size):
+ math.log(2.0)/(midn(fft_size) + 1.0)
+
+def hamming(fft_size):
+ window = []
+ for index in xrange(fft_size):
+ window.append(0.54 - 0.46 * math.cos (2 * math.pi / fft_size * index)) # Hamming window
+ return window
+
+def hanning(fft_size):
+ window = []
+ for index in xrange(fft_size):
+ window.append(0.5 - 0.5 * math.cos (2 * math.pi / fft_size * index)) # von Hann window
+ return window
+
+def welch(fft_size):
+ window = [0 for i in range(fft_size)]
+ j = fft_size-1
+ for index in xrange(midn(fft_size)+1):
+ window[j] = window[index] = (1.0 - math.sqrt((index - midm1(fft_size)) / midp1(fft_size)))
+ j -= 1
+ return window
+
+def parzen(fft_size):
+ window = [0 for i in range(fft_size)]
+ j = fft_size-1
+ for index in xrange(midn(fft_size)+1):
+ window[j] = window[index] = (1.0 - math.abs((index - midm1(fft_size)) / midp1(fft_size)))
+ j -= 1
+ return window
+
+def bartlett(fft_size):
+ mfrq = freq(fft_size)
+ angle = 0
+ window = [0 for i in range(fft_size)]
+ j = fft_size-1
+ for index in xrange(midn(fft_size)+1):
+ window[j] = window[index] = angle
+ angle += freq
+ j -= 1
+ return window
+
+def blackman2(fft_size):
+ mfrq = freq(fft_size)
+ angle = 0
+ window = [0 for i in range(fft_size)]
+ j = fft_size-1
+ for index in xrange(midn(fft_size)+1):
+ cx = math.cos(angle)
+ window[j] = window[index] = (.34401 + (cx * (-.49755 + (cx * .15844))))
+ angle += freq
+ j -= 1
+ return window
+
+def blackman3(fft_size):
+ mfrq = freq(fft_size)
+ angle = 0
+ window = [0 for i in range(fft_size)]
+ j = fft_size-1
+ for index in xrange(midn(fft_size)+1):
+ cx = math.cos(angle)
+ window[j] = window[index] = (.21747 + (cx * (-.45325 + (cx * (.28256 - (cx * .04672))))))
+ angle += freq
+ j -= 1
+ return window
+
+def blackman4(fft_size):
+ mfrq = freq(fft_size)
+ angle = 0
+ window = [0 for i in range(fft_size)]
+ j = fft_size-1
+ for index in xrange(midn(fft_size)+1):
+ cx = math.cos(angle)
+ window[j] = window[index] = (.084037 + (cx * (-.29145 + (cx * (.375696 + (cx * (-.20762 + (cx * .041194))))))))
+ angle += freq
+ j -= 1
+ return window
+
+def exponential(fft_size):
+ expsum = 1.0
+ window = [0 for i in range(fft_size)]
+ j = fft_size-1
+ for index in xrange(midn(fft_size)+1):
+ window[j] = window[i] = (expsum - 1.0)
+ expsum *= expn(fft_size)
+ j -= 1
+ return window
+
+def riemann(fft_size):
+ sr1 = freq(fft_size)
+ window = [0 for i in range(fft_size)]
+ j = fft_size-1
+ for index in xrange(midn(fft_size)):
+ if index == midn(fft_size):
+ window[index] = window[j] = 1.0
+ else:
+ cx = sr1*midn(fft_size) - index
+ window[index] = window[j] = math.sin(cx)/cx
+ j -= 1
+ return window
+
+def kaiser(fft_size,beta):
+ ibeta = 1.0/izero(beta)
+ inm1 = 1.0/(fft_size)
+ window = [0 for i in range(fft_size)]
+ for index in xrange(fft_size):
+ window[index] = izero(beta*math.sqrt(1.0 - (index * inm1)*(index * inm1))) * ibeta
+ return window
+
+# Closure to generate functions to create cos windows
+
+def coswindow(coeffs):
+ def closure(fft_size):
+ window = [0] * fft_size
+ #print list(enumerate(coeffs))
+ for w_index in range(fft_size):
+ for (c_index, coeff) in enumerate(coeffs):
+ window[w_index] += (-1)**c_index * coeff * math.cos(2.0*c_index*math.pi*(w_index+0.5)/(fft_size-1))
+ return window
+ return closure
+
+blackmanharris = coswindow((0.35875,0.48829,0.14128,0.01168))
+nuttall = coswindow((0.3635819,0.4891775,0.1365995,0.0106411)) # Wikipedia calls this Blackman-Nuttall
+nuttall_cfd = coswindow((0.355768,0.487396,0.144232,0.012604)) # Wikipedia calls this Nuttall, continuous first deriv
+flattop = coswindow((1.0,1.93,1.29,0.388,0.032)) # Flat top window, coeffs from Wikipedia
+rectangular = lambda fft_size: [1]*fft_size
diff --git a/gnuradio-core/src/tests/CMakeLists.txt b/gnuradio-core/src/tests/CMakeLists.txt
new file mode 100644
index 000000000..dbd52f05c
--- /dev/null
+++ b/gnuradio-core/src/tests/CMakeLists.txt
@@ -0,0 +1,72 @@
+# Copyright 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.
+
+########################################################################
+include(GrMiscUtils) #check n def
+GR_CHECK_HDR_N_DEF(sys/resource.h HAVE_SYS_RESOURCE_H)
+
+########################################################################
+# Setup the include and linker paths
+########################################################################
+include_directories(
+ ${GNURADIO_CORE_INCLUDE_DIRS}
+ ${GRUEL_INCLUDE_DIRS}
+ ${Boost_INCLUDE_DIRS}
+ ${CPPUNIT_INCLUDE_DIRS}
+)
+
+link_directories(
+ ${Boost_LIBRARY_DIRS}
+ ${CPPUNIT_LIBRARY_DIRS}
+)
+
+########################################################################
+# Build benchmarks and non-registered tests
+########################################################################
+set(tests_not_run #single source per test
+ benchmark_dotprod_fff.cc
+ benchmark_dotprod_fsf.cc
+ benchmark_dotprod_ccf.cc
+ benchmark_dotprod_fcc.cc
+ benchmark_dotprod_scc.cc
+ benchmark_dotprod_ccc.cc
+ benchmark_nco.cc
+ benchmark_vco.cc
+ test_runtime.cc
+ test_general.cc
+ test_filter.cc
+ #test_atsc.cc
+ test_vmcircbuf.cc
+)
+
+foreach(test_not_run_src ${tests_not_run})
+ get_filename_component(name ${test_not_run_src} NAME_WE)
+ add_executable(${name} ${test_not_run_src})
+ target_link_libraries(${name} test-gnuradio-core)
+endforeach(test_not_run_src)
+
+########################################################################
+# Build the test-all test to end all tests
+# Set the test environment so the build libs will be found under MSVC.
+########################################################################
+include(GrTest)
+list(APPEND GR_TEST_TARGET_DEPS test-gnuradio-core)
+add_executable(gr_core_test_all test_all.cc)
+target_link_libraries(gr_core_test_all test-gnuradio-core)
+GR_ADD_TEST(gr-core-test-all gr_core_test_all)
diff --git a/gnuradio-core/src/tests/benchmark_dotprod b/gnuradio-core/src/tests/benchmark_dotprod
new file mode 100755
index 000000000..82f3b5c3f
--- /dev/null
+++ b/gnuradio-core/src/tests/benchmark_dotprod
@@ -0,0 +1,46 @@
+#!/bin/sh
+#
+# 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 this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+
+DIR=.
+
+tests="
+benchmark_dotprod_fff
+benchmark_dotprod_ccf
+benchmark_dotprod_ccc
+benchmark_dotprod_fcc
+benchmark_dotprod_scc
+benchmark_dotprod_fsf
+"
+
+echo "uname -a"
+uname -a
+
+if test -e /proc/cpuinfo
+then
+ cat /proc/cpuinfo
+fi
+
+for t in $tests
+do
+ echo
+ echo "$t":
+ $DIR/$t
+done
diff --git a/gnuradio-core/src/tests/benchmark_dotprod_ccc.cc b/gnuradio-core/src/tests/benchmark_dotprod_ccc.cc
new file mode 100644
index 000000000..8ef26a40d
--- /dev/null
+++ b/gnuradio-core/src/tests/benchmark_dotprod_ccc.cc
@@ -0,0 +1,151 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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 <stdio.h>
+#include <sys/time.h>
+#ifdef HAVE_SYS_RESOURCE_H
+#include <sys/resource.h>
+#endif
+#include <unistd.h>
+#include <gr_fir_util.h>
+#include <gr_fir_ccc.h>
+#include <random.h>
+
+#define TOTAL_TEST_SIZE (40 * 1000 * 1000L)
+#define NTAPS 256
+#define BLOCK_SIZE (50 * 1000) /* fits in cache */
+
+#if ((TOTAL_TEST_SIZE % BLOCK_SIZE) != 0)
+#error "TOTAL_TEST_SIZE % BLOCK_SIZE must equal 0"
+#endif
+
+typedef gr_fir_ccc* (*fir_maker_t)(const std::vector<gr_complex> &taps);
+typedef gr_fir_ccc filter_t;
+
+
+static double
+timeval_to_double (const struct timeval *tv)
+{
+ return (double) tv->tv_sec + (double) tv->tv_usec * 1e-6;
+}
+
+
+static void
+benchmark (fir_maker_t filter_maker, const char *implementation_name)
+{
+ int i;
+ gr_complex coeffs[NTAPS];
+ //gr_complex input[BLOCK_SIZE + NTAPS]; // not always 16-bit aligned
+ gr_complex *input = new gr_complex[BLOCK_SIZE + NTAPS];
+ long n;
+ gr_complex result;
+#ifdef HAVE_SYS_RESOURCE_H
+ struct rusage rusage_start;
+ struct rusage rusage_stop;
+#else
+ double clock_start;
+ double clock_end;
+#endif
+
+
+ // setup coefficients and input data
+
+ for (i = 0; i < NTAPS; i++)
+ coeffs[i] = gr_complex(random() - RANDOM_MAX/2, random() - RANDOM_MAX/2);
+
+ for (i = 0; i < BLOCK_SIZE + NTAPS; i++)
+ input[i] = gr_complex(random() - RANDOM_MAX/2, random() - RANDOM_MAX/2);
+
+ std::vector<gr_complex> taps (&coeffs[0], &coeffs[NTAPS]);
+ filter_t *f = filter_maker (taps);
+
+ // get starting CPU usage
+#ifdef HAVE_SYS_RESOURCE_H
+ if (getrusage (RUSAGE_SELF, &rusage_start) < 0){
+ perror ("getrusage");
+ exit (1);
+ }
+#else
+ clock_start= (double) clock() / CLOCKS_PER_SEC;
+#endif
+ // do the actual work
+
+ for (n = 0; n < TOTAL_TEST_SIZE; n += BLOCK_SIZE){
+ int j;
+ for (j = 0; j < BLOCK_SIZE; j++){
+ result = f->filter ((gr_complex*)&input[j]);
+ }
+ }
+
+ // get ending CPU usage
+#ifdef HAVE_SYS_RESOURCE_H
+ if (getrusage (RUSAGE_SELF, &rusage_stop) < 0){
+ perror ("getrusage");
+ exit (1);
+ }
+
+ // compute results
+
+ double user =
+ timeval_to_double (&rusage_stop.ru_utime)
+ - timeval_to_double (&rusage_start.ru_utime);
+
+ double sys =
+ timeval_to_double (&rusage_stop.ru_stime)
+ - timeval_to_double (&rusage_start.ru_stime);
+
+ double total = user + sys;
+#else
+ clock_end = (double) clock() / CLOCKS_PER_SEC;
+ double total = clock_end - clock_start;
+#endif
+
+ double macs = NTAPS * (double) TOTAL_TEST_SIZE;
+
+ printf ("%10s: taps: %4d input: %4g cpu: %6.3f taps/sec: %10.4g \n",
+ implementation_name, NTAPS, (double) TOTAL_TEST_SIZE, total, macs / total);
+
+ delete f;
+ delete [] input;
+}
+
+static void
+do_all ()
+{
+ std::vector<gr_fir_ccc_info> info;
+ gr_fir_util::get_gr_fir_ccc_info (&info); // get all known CCC implementations
+
+ for (std::vector<gr_fir_ccc_info>::iterator p = info.begin ();
+ p != info.end () ;
+ ++p){
+ benchmark (p->create, p->name);
+ }
+}
+
+int
+main (int argc, char **argv)
+{
+ do_all ();
+ return 0;
+}
diff --git a/gnuradio-core/src/tests/benchmark_dotprod_ccf.cc b/gnuradio-core/src/tests/benchmark_dotprod_ccf.cc
new file mode 100644
index 000000000..ed3c49165
--- /dev/null
+++ b/gnuradio-core/src/tests/benchmark_dotprod_ccf.cc
@@ -0,0 +1,153 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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 <stdio.h>
+#include <sys/time.h>
+#ifdef HAVE_SYS_RESOURCE_H
+#include <sys/resource.h>
+#endif
+#include <unistd.h>
+#include <gr_fir_util.h>
+#include <gr_fir_ccf.h>
+#include <random.h>
+
+#define TOTAL_TEST_SIZE (40 * 1000 * 1000L)
+#define NTAPS 256
+#define BLOCK_SIZE (50 * 1000) /* fits in cache */
+
+#if ((TOTAL_TEST_SIZE % BLOCK_SIZE) != 0)
+#error "TOTAL_TEST_SIZE % BLOCK_SIZE must equal 0"
+#endif
+
+typedef gr_fir_ccf* (*fir_maker_t)(const std::vector<float> &taps);
+typedef gr_fir_ccf filter_t;
+
+
+static double
+timeval_to_double (const struct timeval *tv)
+{
+ return (double) tv->tv_sec + (double) tv->tv_usec * 1e-6;
+}
+
+
+static void
+benchmark (fir_maker_t filter_maker, const char *implementation_name)
+{
+ int i;
+ float coeffs[NTAPS];
+ //gr_complex input[BLOCK_SIZE + NTAPS]; // not always 16-bit aligned
+ gr_complex *input = new gr_complex[BLOCK_SIZE + NTAPS];
+ long n;
+ gr_complex result;
+#ifdef HAVE_SYS_RESOURCE_H
+ struct rusage rusage_start;
+ struct rusage rusage_stop;
+#else
+ double clock_start;
+ double clock_end;
+#endif
+
+ // setup coefficients and input data
+
+ for (i = 0; i < NTAPS; i++)
+ coeffs[i] = random() - RANDOM_MAX/2;
+
+ for (i = 0; i < BLOCK_SIZE + NTAPS; i++)
+ input[i] = gr_complex(random() - RANDOM_MAX/2, random() - RANDOM_MAX/2);
+
+ std::vector<float> taps (&coeffs[0], &coeffs[NTAPS]);
+ filter_t *f = filter_maker (taps);
+
+ // get starting CPU usage
+
+#ifdef HAVE_SYS_RESOURCE_H
+ if (getrusage (RUSAGE_SELF, &rusage_start) < 0){
+ perror ("getrusage");
+ exit (1);
+ }
+#else
+ clock_start= (double) clock() / CLOCKS_PER_SEC;
+#endif
+
+ // do the actual work
+
+ for (n = 0; n < TOTAL_TEST_SIZE; n += BLOCK_SIZE){
+ int j;
+ for (j = 0; j < BLOCK_SIZE; j++){
+ result = f->filter (&input[j]);
+ }
+ }
+
+ // get ending CPU usage
+
+#ifdef HAVE_SYS_RESOURCE_H
+ if (getrusage (RUSAGE_SELF, &rusage_stop) < 0){
+ perror ("getrusage");
+ exit (1);
+ }
+
+ // compute results
+
+ double user =
+ timeval_to_double (&rusage_stop.ru_utime)
+ - timeval_to_double (&rusage_start.ru_utime);
+
+ double sys =
+ timeval_to_double (&rusage_stop.ru_stime)
+ - timeval_to_double (&rusage_start.ru_stime);
+
+ double total = user + sys;
+#else
+ clock_end= (double) clock() / CLOCKS_PER_SEC;
+ double total = clock_end - clock_start;
+#endif
+
+ double macs = NTAPS * (double) TOTAL_TEST_SIZE;
+
+ printf ("%10s: taps: %4d input: %4g cpu: %6.3f taps/sec: %10.4g \n",
+ implementation_name, NTAPS, (double) TOTAL_TEST_SIZE, total, macs / total);
+
+ delete f;
+ delete [] input;
+}
+
+static void
+do_all ()
+{
+ std::vector<gr_fir_ccf_info> info;
+ gr_fir_util::get_gr_fir_ccf_info (&info); // get all known CCF implementations
+
+ for (std::vector<gr_fir_ccf_info>::iterator p = info.begin ();
+ p != info.end () ;
+ ++p){
+ benchmark (p->create, p->name);
+ }
+}
+
+int
+main (int argc, char **argv)
+{
+ do_all ();
+ return 0;
+}
diff --git a/gnuradio-core/src/tests/benchmark_dotprod_fcc.cc b/gnuradio-core/src/tests/benchmark_dotprod_fcc.cc
new file mode 100644
index 000000000..e9eeee43a
--- /dev/null
+++ b/gnuradio-core/src/tests/benchmark_dotprod_fcc.cc
@@ -0,0 +1,152 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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 <stdio.h>
+#include <sys/time.h>
+#ifdef HAVE_SYS_RESOURCE_H
+#include <sys/resource.h>
+#endif
+#include <unistd.h>
+#include <gr_fir_util.h>
+#include <gr_fir_fcc.h>
+#include <random.h>
+
+#define TOTAL_TEST_SIZE (40 * 1000 * 1000L)
+#define NTAPS 256
+#define BLOCK_SIZE (50 * 1000) /* fits in cache */
+
+#if ((TOTAL_TEST_SIZE % BLOCK_SIZE) != 0)
+#error "TOTAL_TEST_SIZE % BLOCK_SIZE must equal 0"
+#endif
+
+typedef gr_fir_fcc* (*fir_maker_t)(const std::vector<gr_complex> &taps);
+typedef gr_fir_fcc filter_t;
+
+
+static double
+timeval_to_double (const struct timeval *tv)
+{
+ return (double) tv->tv_sec + (double) tv->tv_usec * 1e-6;
+}
+
+
+static void
+benchmark (fir_maker_t filter_maker, const char *implementation_name)
+{
+ int i;
+ gr_complex coeffs[NTAPS];
+ float input[BLOCK_SIZE + NTAPS];
+ long n;
+ gr_complex result;
+#ifdef HAVE_SYS_RESOURCE_H
+ struct rusage rusage_start;
+ struct rusage rusage_stop;
+#else
+ double clock_start;
+ double clock_end;
+#endif
+
+
+
+ // setup coefficients and input data
+
+ for (i = 0; i < NTAPS; i++)
+ coeffs[i] = gr_complex(random() - RANDOM_MAX/2, random() - RANDOM_MAX/2);
+
+ for (i = 0; i < BLOCK_SIZE + NTAPS; i++)
+ input[i] = random() - RANDOM_MAX/2;
+
+ std::vector<gr_complex> taps (&coeffs[0], &coeffs[NTAPS]);
+ filter_t *f = filter_maker (taps);
+
+ // get starting CPU usage
+#ifdef HAVE_SYS_RESOURCE_H
+ if (getrusage (RUSAGE_SELF, &rusage_start) < 0){
+ perror ("getrusage");
+ exit (1);
+ }
+#else
+ clock_start = (double) clock() * (1000000. / CLOCKS_PER_SEC);
+#endif
+
+ // do the actual work
+
+ for (n = 0; n < TOTAL_TEST_SIZE; n += BLOCK_SIZE){
+ int j;
+ for (j = 0; j < BLOCK_SIZE; j++){
+ result = f->filter (&input[j]);
+ }
+ }
+
+ // get ending CPU usage
+
+#ifdef HAVE_SYS_RESOURCE_H
+ if (getrusage (RUSAGE_SELF, &rusage_stop) < 0){
+ perror ("getrusage");
+ exit (1);
+ }
+
+ // compute results
+
+ double user =
+ timeval_to_double (&rusage_stop.ru_utime)
+ - timeval_to_double (&rusage_start.ru_utime);
+
+ double sys =
+ timeval_to_double (&rusage_stop.ru_stime)
+ - timeval_to_double (&rusage_start.ru_stime);
+
+ double total = user + sys;
+#else
+ clock_end= (double) clock() * (1000000. / CLOCKS_PER_SEC);
+ double total = clock_end - clock_start;
+#endif
+
+ double macs = NTAPS * (double) TOTAL_TEST_SIZE;
+
+ printf ("%10s: taps: %4d input: %4g cpu: %6.3f taps/sec: %10.4g \n",
+ implementation_name, NTAPS, (double) TOTAL_TEST_SIZE, total, macs / total);
+
+ delete f;
+}
+
+static void
+do_all ()
+{
+ std::vector<gr_fir_fcc_info> info;
+ gr_fir_util::get_gr_fir_fcc_info (&info); // get all known FCC implementations
+
+ for (std::vector<gr_fir_fcc_info>::iterator p = info.begin ();
+ p != info.end () ;
+ ++p){
+ benchmark (p->create, p->name);
+ }
+}
+
+int
+main (int argc, char **argv)
+{
+ do_all ();
+ return 0;
+}
diff --git a/gnuradio-core/src/tests/benchmark_dotprod_fff.cc b/gnuradio-core/src/tests/benchmark_dotprod_fff.cc
new file mode 100644
index 000000000..56e064506
--- /dev/null
+++ b/gnuradio-core/src/tests/benchmark_dotprod_fff.cc
@@ -0,0 +1,148 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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 <stdio.h>
+#include <sys/time.h>
+#ifdef HAVE_SYS_RESOURCE_H
+#include <sys/resource.h>
+#endif
+
+#include <unistd.h>
+#include <gr_fir_util.h>
+#include <gr_fir_fff.h>
+#include <random.h>
+
+#define TOTAL_TEST_SIZE (40 * 1000 * 1000L)
+#define NTAPS 256
+#define BLOCK_SIZE (50 * 1000) /* fits in cache */
+
+#if ((TOTAL_TEST_SIZE % BLOCK_SIZE) != 0)
+#error "TOTAL_TEST_SIZE % BLOCK_SIZE must equal 0"
+#endif
+
+typedef gr_fir_fff* (*fir_maker_t)(const std::vector<float> &taps);
+typedef gr_fir_fff filter_t;
+
+
+static double
+timeval_to_double (const struct timeval *tv)
+{
+ return (double) tv->tv_sec + (double) tv->tv_usec * 1e-6;
+}
+
+
+static void
+benchmark (fir_maker_t filter_maker, const char *implementation_name)
+{
+ int i;
+ float coeffs[NTAPS];
+ float input[BLOCK_SIZE + NTAPS];
+ long n;
+ float result;
+#ifdef HAVE_SYS_RESOURCE_H
+ struct rusage rusage_start;
+ struct rusage rusage_stop;
+#else
+ double clock_start;
+ double clock_end;
+#endif
+ // setup coefficients and input data
+
+ for (i = 0; i < NTAPS; i++)
+ coeffs[i] = random() - RANDOM_MAX/2;
+
+ for (i = 0; i < BLOCK_SIZE + NTAPS; i++)
+ input[i] = random() - RANDOM_MAX/2;
+
+ std::vector<float> taps (&coeffs[0], &coeffs[NTAPS]);
+ filter_t *f = filter_maker (taps);
+
+ // get starting CPU usage
+#ifdef HAVE_SYS_RESOURCE_H
+ if (getrusage (RUSAGE_SELF, &rusage_start) < 0){
+ perror ("getrusage");
+ exit (1);
+ }
+#else
+ clock_start = (double) clock() * (1000000. / CLOCKS_PER_SEC);
+#endif
+ // do the actual work
+
+ for (n = 0; n < TOTAL_TEST_SIZE; n += BLOCK_SIZE){
+ int j;
+ for (j = 0; j < BLOCK_SIZE; j++){
+ result = f->filter (&input[j]);
+ }
+ }
+
+ // get ending CPU usage
+#ifdef HAVE_SYS_RESOURCE_H
+ if (getrusage (RUSAGE_SELF, &rusage_stop) < 0){
+ perror ("getrusage");
+ exit (1);
+ }
+
+ // compute results
+
+ double user =
+ timeval_to_double (&rusage_stop.ru_utime)
+ - timeval_to_double (&rusage_start.ru_utime);
+
+ double sys =
+ timeval_to_double (&rusage_stop.ru_stime)
+ - timeval_to_double (&rusage_start.ru_stime);
+
+ double total = user + sys;
+#else
+ clock_end = (double) clock () * (1000000. / CLOCKS_PER_SEC);
+ double total = clock_end -clock_start;
+#endif
+ double macs = NTAPS * (double) TOTAL_TEST_SIZE;
+
+ printf ("%10s: taps: %4d input: %4g cpu: %6.3f taps/sec: %10.4g \n",
+ implementation_name, NTAPS, (double) TOTAL_TEST_SIZE, total, macs / total);
+
+ delete f;
+}
+
+static void
+do_all ()
+{
+ std::vector<gr_fir_fff_info> info;
+ gr_fir_util::get_gr_fir_fff_info (&info); // get all known FFF implementations
+
+ for (std::vector<gr_fir_fff_info>::iterator p = info.begin ();
+ p != info.end ();
+ ++p){
+
+ benchmark (p->create, p->name);
+ }
+}
+
+int
+main (int argc, char **argv)
+{
+ do_all ();
+ return 0;
+}
diff --git a/gnuradio-core/src/tests/benchmark_dotprod_fsf.cc b/gnuradio-core/src/tests/benchmark_dotprod_fsf.cc
new file mode 100644
index 000000000..a254a8eab
--- /dev/null
+++ b/gnuradio-core/src/tests/benchmark_dotprod_fsf.cc
@@ -0,0 +1,151 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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 <stdio.h>
+#include <sys/time.h>
+#ifdef HAVE_SYS_RESOURCE_H
+#include <sys/resource.h>
+#endif
+#include <unistd.h>
+#include <gr_fir_util.h>
+#include <gr_fir_fsf.h>
+#include <random.h>
+
+#define TOTAL_TEST_SIZE (40 * 1000 * 1000L)
+#define NTAPS 256
+#define BLOCK_SIZE (50 * 1000) /* fits in cache */
+
+#if ((TOTAL_TEST_SIZE % BLOCK_SIZE) != 0)
+#error "TOTAL_TEST_SIZE % BLOCK_SIZE must equal 0"
+#endif
+
+typedef gr_fir_fsf* (*fir_maker_t)(const std::vector<float> &taps);
+typedef gr_fir_fsf filter_t;
+
+
+static double
+timeval_to_double (const struct timeval *tv)
+{
+ return (double) tv->tv_sec + (double) tv->tv_usec * 1e-6;
+}
+
+
+static void
+benchmark (fir_maker_t filter_maker, const char *implementation_name)
+{
+ int i;
+ float coeffs[NTAPS];
+ float input[BLOCK_SIZE + NTAPS];
+ long n;
+ short result;
+#ifdef HAVE_SYS_RESOURCE_H
+ struct rusage rusage_start;
+ struct rusage rusage_stop;
+#else
+ double clock_start;
+ double clock_end;
+#endif
+
+ // setup coefficients and input data
+
+ for (i = 0; i < NTAPS; i++)
+ coeffs[i] = random() - RANDOM_MAX/2;
+
+ for (i = 0; i < BLOCK_SIZE + NTAPS; i++)
+ input[i] = random() - RANDOM_MAX/2;
+
+ std::vector<float> taps (&coeffs[0], &coeffs[NTAPS]);
+ filter_t *f = filter_maker (taps);
+
+ // get starting CPU usage
+#ifdef HAVE_SYS_RESOURCE_H
+ if (getrusage (RUSAGE_SELF, &rusage_start) < 0){
+ perror ("getrusage");
+ exit (1);
+ }
+#else
+ clock_start= (double) clock() * (1000000. / CLOCKS_PER_SEC);
+#endif
+
+ // do the actual work
+
+ for (n = 0; n < TOTAL_TEST_SIZE; n += BLOCK_SIZE){
+ int j;
+ for (j = 0; j < BLOCK_SIZE; j++){
+ result = f->filter (&input[j]);
+ }
+ }
+
+ // get ending CPU usage
+
+#ifdef HAVE_SYS_RESOURCE_H
+ if (getrusage (RUSAGE_SELF, &rusage_stop) < 0){
+ perror ("getrusage");
+ exit (1);
+ }
+
+ // compute results
+
+ double user =
+ timeval_to_double (&rusage_stop.ru_utime)
+ - timeval_to_double (&rusage_start.ru_utime);
+
+ double sys =
+ timeval_to_double (&rusage_stop.ru_stime)
+ - timeval_to_double (&rusage_start.ru_stime);
+
+ double total = user + sys;
+#else
+ clock_end= (double) clock() * (1000000. / CLOCKS_PER_SEC);
+ double total = clock_end - clock_start;
+#endif
+
+ double macs = NTAPS * (double) TOTAL_TEST_SIZE;
+
+ printf ("%10s: taps: %4d input: %4g cpu: %6.3f taps/sec: %10.4g \n",
+ implementation_name, NTAPS, (double) TOTAL_TEST_SIZE, total, macs / total);
+
+ delete f;
+}
+
+static void
+do_all ()
+{
+ std::vector<gr_fir_fsf_info> info;
+ gr_fir_util::get_gr_fir_fsf_info (&info); // get all known FFF implementations
+
+ for (std::vector<gr_fir_fsf_info>::iterator p = info.begin ();
+ p != info.end ();
+ ++p){
+
+ benchmark (p->create, p->name);
+ }
+}
+
+int
+main (int argc, char **argv)
+{
+ do_all ();
+ return 0;
+}
diff --git a/gnuradio-core/src/tests/benchmark_dotprod_scc.cc b/gnuradio-core/src/tests/benchmark_dotprod_scc.cc
new file mode 100644
index 000000000..9a65bb4c6
--- /dev/null
+++ b/gnuradio-core/src/tests/benchmark_dotprod_scc.cc
@@ -0,0 +1,151 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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 <stdio.h>
+#include <sys/time.h>
+#ifdef HAVE_SYS_RESOURCE_H
+#include <sys/resource.h>
+#endif
+#include <unistd.h>
+#include <gr_fir_util.h>
+#include <gr_fir_scc.h>
+#include <random.h>
+
+#define TOTAL_TEST_SIZE (40 * 1000 * 1000L)
+#define NTAPS 256
+#define BLOCK_SIZE (50 * 1000) /* fits in cache */
+
+#if ((TOTAL_TEST_SIZE % BLOCK_SIZE) != 0)
+#error "TOTAL_TEST_SIZE % BLOCK_SIZE must equal 0"
+#endif
+
+typedef gr_fir_scc* (*fir_maker_t)(const std::vector<gr_complex> &taps);
+typedef gr_fir_scc filter_t;
+
+
+static double
+timeval_to_double (const struct timeval *tv)
+{
+ return (double) tv->tv_sec + (double) tv->tv_usec * 1e-6;
+}
+
+
+static void
+benchmark (fir_maker_t filter_maker, const char *implementation_name)
+{
+ int i;
+ gr_complex coeffs[NTAPS];
+ short input[BLOCK_SIZE + NTAPS];
+ long n;
+ gr_complex result;
+#ifdef HAVE_SYS_RESOURCE_H
+ struct rusage rusage_start;
+ struct rusage rusage_stop;
+#else
+ double clock_start;
+ double clock_end;
+#endif
+
+
+ // setup coefficients and input data
+
+ for (i = 0; i < NTAPS; i++)
+ coeffs[i] = gr_complex(random() - RANDOM_MAX/2, random() - RANDOM_MAX/2);
+
+ for (i = 0; i < BLOCK_SIZE + NTAPS; i++)
+ input[i] = random() - RANDOM_MAX/2;
+
+ std::vector<gr_complex> taps (&coeffs[0], &coeffs[NTAPS]);
+ filter_t *f = filter_maker (taps);
+
+ // get starting CPU usage
+
+#ifdef HAVE_SYS_RESOURCE_H
+ if (getrusage (RUSAGE_SELF, &rusage_start) < 0){
+ perror ("getrusage");
+ exit (1);
+ }
+#else
+ clock_start = (double) clock() * (1000000. / CLOCKS_PER_SEC);
+#endif
+
+ // do the actual work
+
+ for (n = 0; n < TOTAL_TEST_SIZE; n += BLOCK_SIZE){
+ int j;
+ for (j = 0; j < BLOCK_SIZE; j++){
+ result = f->filter (&input[j]);
+ }
+ }
+
+ // get ending CPU usage
+#ifdef HAVE_SYS_RESOURCE_H
+ if (getrusage (RUSAGE_SELF, &rusage_stop) < 0){
+ perror ("getrusage");
+ exit (1);
+ }
+
+ // compute results
+
+ double user =
+ timeval_to_double (&rusage_stop.ru_utime)
+ - timeval_to_double (&rusage_start.ru_utime);
+
+ double sys =
+ timeval_to_double (&rusage_stop.ru_stime)
+ - timeval_to_double (&rusage_start.ru_stime);
+
+ double total = user + sys;
+#else
+ clock_end= (double) clock () * (1000000. / CLOCKS_PER_SEC);
+ double total = clock_end -clock_start;
+#endif
+
+ double macs = NTAPS * (double) TOTAL_TEST_SIZE;
+
+ printf ("%10s: taps: %4d input: %4g cpu: %6.3f taps/sec: %10.4g \n",
+ implementation_name, NTAPS, (double) TOTAL_TEST_SIZE, total, macs / total);
+
+ delete f;
+}
+
+static void
+do_all ()
+{
+ std::vector<gr_fir_scc_info> info;
+ gr_fir_util::get_gr_fir_scc_info (&info); // get all known SCC implementations
+
+ for (std::vector<gr_fir_scc_info>::iterator p = info.begin ();
+ p != info.end () ;
+ ++p){
+ benchmark (p->create, p->name);
+ }
+}
+
+int
+main (int argc, char **argv)
+{
+ do_all ();
+ return 0;
+}
diff --git a/gnuradio-core/src/tests/benchmark_nco.cc b/gnuradio-core/src/tests/benchmark_nco.cc
new file mode 100644
index 000000000..20d53e410
--- /dev/null
+++ b/gnuradio-core/src/tests/benchmark_nco.cc
@@ -0,0 +1,220 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002,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.
+ */
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+#include <stdio.h>
+#include <sys/time.h>
+#ifdef HAVE_SYS_RESOURCE_H
+#include <sys/resource.h>
+#endif
+#include <unistd.h>
+#include <gr_nco.h>
+#include <gr_fxpt_nco.h>
+#include <string.h>
+
+#define ITERATIONS 20000000
+#define BLOCK_SIZE (10 * 1000) // fits in cache
+
+#define FREQ 5003.123
+
+static double
+timeval_to_double (const struct timeval *tv)
+{
+ return (double) tv->tv_sec + (double) tv->tv_usec * 1e-6;
+}
+
+
+static void
+benchmark (void test (float *x, float *y), const char *implementation_name)
+{
+#ifdef HAVE_SYS_RESOURCE_H
+ struct rusage rusage_start;
+ struct rusage rusage_stop;
+#else
+ double clock_start;
+ double clock_end;
+#endif
+ float output[2*BLOCK_SIZE];
+ float *x = &output[0], *y = &output[BLOCK_SIZE];
+
+ // touch memory
+ memset(output, 0, 2*BLOCK_SIZE*sizeof(float));
+
+ // get starting CPU usage
+#ifdef HAVE_SYS_RESOURCE_H
+ if (getrusage (RUSAGE_SELF, &rusage_start) < 0){
+ perror ("getrusage");
+ exit (1);
+ }
+#else
+ clock_start = (double) clock() * (1000000. / CLOCKS_PER_SEC);
+#endif
+ // do the actual work
+
+ test (x, y);
+
+ // get ending CPU usage
+
+#ifdef HAVE_SYS_RESOURCE_H
+ if (getrusage (RUSAGE_SELF, &rusage_stop) < 0){
+ perror ("getrusage");
+ exit (1);
+ }
+
+ // compute results
+
+ double user =
+ timeval_to_double (&rusage_stop.ru_utime)
+ - timeval_to_double (&rusage_start.ru_utime);
+
+ double sys =
+ timeval_to_double (&rusage_stop.ru_stime)
+ - timeval_to_double (&rusage_start.ru_stime);
+
+ double total = user + sys;
+#else
+ clock_end = (double) clock () * (1000000. / CLOCKS_PER_SEC);
+ double total = clock_end - clock_start;
+#endif
+
+ printf ("%18s: cpu: %6.3f steps/sec: %10.3e\n",
+ implementation_name, total, ITERATIONS / total);
+}
+
+// ----------------------------------------------------------------
+// Don't compare the _vec with other functions since memory store's
+// are involved.
+
+void basic_sincos_vec (float *x, float *y)
+{
+ gr_nco<float,float> nco;
+
+ nco.set_freq (2 * M_PI / FREQ);
+
+ for (int i = 0; i < ITERATIONS/BLOCK_SIZE; i++){
+ for (int j = 0; j < BLOCK_SIZE; j++){
+ nco.sincos (&x[2*j+1], &x[2*j]);
+ nco.step ();
+ }
+ }
+}
+
+void native_sincos_vec (float *x, float *y)
+{
+ gr_nco<float,float> nco;
+
+ nco.set_freq (2 * M_PI / FREQ);
+
+ for (int i = 0; i < ITERATIONS/BLOCK_SIZE; i++){
+ nco.sincos ((gr_complex*)x, BLOCK_SIZE);
+ }
+}
+
+void fxpt_sincos_vec (float *x, float *y)
+{
+ gr_fxpt_nco nco;
+
+ nco.set_freq (2 * M_PI / FREQ);
+
+ for (int i = 0; i < ITERATIONS/BLOCK_SIZE; i++){
+ nco.sincos ((gr_complex*)x, BLOCK_SIZE);
+ }
+}
+
+// ----------------------------------------------------------------
+
+void native_sincos (float *x, float *y)
+{
+ gr_nco<float,float> nco;
+
+ nco.set_freq (2 * M_PI / FREQ);
+
+ for (int i = 0; i < ITERATIONS; i++){
+ nco.sincos (x, y);
+ nco.step ();
+ }
+}
+
+void fxpt_sincos (float *x, float *y)
+{
+ gr_fxpt_nco nco;
+
+ nco.set_freq (2 * M_PI / FREQ);
+
+ for (int i = 0; i < ITERATIONS; i++){
+ nco.sincos (x, y);
+ nco.step ();
+ }
+}
+
+// ----------------------------------------------------------------
+
+void native_sin (float *x, float *y)
+{
+ gr_nco<float,float> nco;
+
+ nco.set_freq (2 * M_PI / FREQ);
+
+ for (int i = 0; i < ITERATIONS; i++){
+ *x = nco.sin ();
+ nco.step ();
+ }
+}
+
+void fxpt_sin (float *x, float *y)
+{
+ gr_fxpt_nco nco;
+
+ nco.set_freq (2 * M_PI / FREQ);
+
+ for (int i = 0; i < ITERATIONS; i++){
+ *x = nco.sin ();
+ nco.step ();
+ }
+}
+
+// ----------------------------------------------------------------
+
+void nop_fct (float *x, float *y)
+{
+}
+
+void nop_loop (float *x, float *y)
+{
+ for (int i = 0; i < ITERATIONS; i++){
+ nop_fct (x, y);
+ }
+}
+
+int
+main (int argc, char **argv)
+{
+ benchmark (nop_loop, "nop loop");
+ benchmark (native_sin, "native sine");
+ benchmark (fxpt_sin, "fxpt sine");
+ benchmark (native_sincos, "native sin/cos");
+ benchmark (fxpt_sincos, "fxpt sin/cos");
+ benchmark (basic_sincos_vec, "basic sin/cos vec");
+ benchmark (native_sincos_vec, "native sin/cos vec");
+ benchmark (fxpt_sincos_vec, "fxpt sin/cos vec");
+}
diff --git a/gnuradio-core/src/tests/benchmark_vco.cc b/gnuradio-core/src/tests/benchmark_vco.cc
new file mode 100644
index 000000000..3a6ade78c
--- /dev/null
+++ b/gnuradio-core/src/tests/benchmark_vco.cc
@@ -0,0 +1,167 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002,2004,2005 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 <stdio.h>
+#include <sys/time.h>
+#ifdef HAVE_SYS_RESOURCE_H
+#include <sys/resource.h>
+#endif
+#include <unistd.h>
+#include <gr_vco.h>
+#include <gr_fxpt_vco.h>
+#include <string.h>
+
+#define ITERATIONS 5000000
+#define BLOCK_SIZE (10 * 1000) // fits in cache
+
+#define FREQ 5003.123
+#define K 4.9999999
+#define AMPLITUDE 2.444444444
+
+
+static double
+timeval_to_double (const struct timeval *tv)
+{
+ return (double) tv->tv_sec + (double) tv->tv_usec * 1e-6;
+}
+
+
+static void
+benchmark (void test (float *x, const float *y), const char *implementation_name)
+{
+#ifdef HAVE_SYS_RESOURCE_H
+ struct rusage rusage_start;
+ struct rusage rusage_stop;
+#else
+ double clock_start;
+ double clock_end;
+#endif
+ float output[BLOCK_SIZE];
+ float input[BLOCK_SIZE];
+
+ // touch memory
+ memset(output, 0, BLOCK_SIZE*sizeof(float));
+ for (int i = 0; i<BLOCK_SIZE; i++)
+ input[i] = sin(double(i));
+
+ // get starting CPU usage
+#ifdef HAVE_SYS_RESOURCE_H
+ if (getrusage (RUSAGE_SELF, &rusage_start) < 0){
+ perror ("getrusage");
+ exit (1);
+ }
+#else
+ clock_start = (double) clock() * (1000000. / CLOCKS_PER_SEC);
+#endif
+ // do the actual work
+
+ test (output, input);
+
+ // get ending CPU usage
+
+#ifdef HAVE_SYS_RESOURCE_H
+ if (getrusage (RUSAGE_SELF, &rusage_stop) < 0){
+ perror ("getrusage");
+ exit (1);
+ }
+
+ // compute results
+
+ double user =
+ timeval_to_double (&rusage_stop.ru_utime)
+ - timeval_to_double (&rusage_start.ru_utime);
+
+ double sys =
+ timeval_to_double (&rusage_stop.ru_stime)
+ - timeval_to_double (&rusage_start.ru_stime);
+
+ double total = user + sys;
+#else
+ clock_end = (double) clock () * (1000000. / CLOCKS_PER_SEC);
+ double total = clock_end - clock_start;
+#endif
+
+ printf ("%18s: cpu: %6.3f steps/sec: %10.3e\n",
+ implementation_name, total, ITERATIONS / total);
+}
+
+// ----------------------------------------------------------------
+
+void basic_vco (float *output, const float *input)
+{
+ double phase = 0;
+
+ for (int j = 0; j < ITERATIONS/BLOCK_SIZE; j++){
+ for (int i = 0; i < BLOCK_SIZE; i++){
+ output[i] = cos(phase) * AMPLITUDE;
+ phase += input[i] * K;
+
+ while (phase > 2 * M_PI)
+ phase -= 2 * M_PI;
+
+ while (phase < -2 * M_PI)
+ phase += 2 * M_PI;
+ }
+ }
+}
+
+void native_vco (float *output, const float *input)
+{
+ gr_vco<float,float> vco;
+
+ for (int j = 0; j < ITERATIONS/BLOCK_SIZE; j++){
+ vco.cos(output, input, BLOCK_SIZE, K, AMPLITUDE);
+ }
+ }
+
+void fxpt_vco (float *output, const float *input)
+{
+ gr_fxpt_vco vco;
+
+ for (int j = 0; j < ITERATIONS/BLOCK_SIZE; j++){
+ vco.cos(output, input, BLOCK_SIZE, K, AMPLITUDE);
+ }
+}
+
+// ----------------------------------------------------------------
+
+void nop_fct (float *x, const float *y)
+{
+}
+
+void nop_loop (float *x, const float *y)
+{
+ for (int i = 0; i < ITERATIONS; i++){
+ nop_fct (x, y);
+ }
+}
+
+int
+main (int argc, char **argv)
+{
+ benchmark (nop_loop, "nop loop");
+ benchmark (basic_vco, "basic vco");
+ benchmark (native_vco, "native vco");
+ benchmark (fxpt_vco, "fxpt vco");
+}
diff --git a/gnuradio-core/src/tests/nco_results b/gnuradio-core/src/tests/nco_results
new file mode 100644
index 000000000..5bdf5dd1c
--- /dev/null
+++ b/gnuradio-core/src/tests/nco_results
@@ -0,0 +1,48 @@
+================================================================
+These are on a 1.4 GHz Pentium M using g++ 3.4.1
+================================================================
+
+Default compiler options -O2
+
+ nop loop: cpu: 0.015 steps/sec: 6.668e+08
+ native sine: cpu: 0.900 steps/sec: 1.111e+07
+ fxpt sine: cpu: 0.281 steps/sec: 3.559e+07
+ native sin/cos: cpu: 1.138 steps/sec: 8.789e+06
+ fxpt sin/cos: cpu: 0.550 steps/sec: 1.818e+07
+
+-O2 -march=pentium-m -fomit-frame-pointer
+
+ nop loop: cpu: 0.015 steps/sec: 6.668e+08
+ native sine: cpu: 0.903 steps/sec: 1.108e+07
+ fxpt sine: cpu: 0.271 steps/sec: 3.691e+07
+ native sin/cos: cpu: 1.092 steps/sec: 9.159e+06
+ fxpt sin/cos: cpu: 0.542 steps/sec: 1.845e+07
+
+Inlined fxpt::sin & cos
+-O2 -march=pentium-m -fomit-frame-pointer
+
+ nop loop: cpu: 0.015 steps/sec: 6.668e+08
+ native sine: cpu: 0.904 steps/sec: 1.106e+07
+ fxpt sine: cpu: 0.187 steps/sec: 5.348e+07
+ native sin/cos: cpu: 1.091 steps/sec: 9.167e+06
+ fxpt sin/cos: cpu: 0.373 steps/sec: 2.681e+07
+
+================================================================
+These are on a 1.5 GHz Athon MP 1800+
+================================================================
+
+Default compiler options: -O2
+
+ nop loop: cpu: 0.013 steps/sec: 7.693e+08
+ native sine: cpu: 0.733 steps/sec: 1.364e+07
+ fxpt sine: cpu: 0.210 steps/sec: 4.763e+07
+ native sin/cos: cpu: 1.183 steps/sec: 8.454e+06
+ fxpt sin/cos: cpu: 0.420 steps/sec: 2.381e+07
+
+-O2 -fomit-frame-pointer -march=athlon-mp
+
+ nop loop: cpu: 0.013 steps/sec: 7.693e+08
+ native sine: cpu: 0.679 steps/sec: 1.473e+07
+ fxpt sine: cpu: 0.200 steps/sec: 5.001e+07
+ native sin/cos: cpu: 1.147 steps/sec: 8.720e+06
+ fxpt sin/cos: cpu: 0.444 steps/sec: 2.253e+07
diff --git a/gnuradio-core/src/tests/test_all.cc b/gnuradio-core/src/tests/test_all.cc
new file mode 100644
index 000000000..8a1423e9e
--- /dev/null
+++ b/gnuradio-core/src/tests/test_all.cc
@@ -0,0 +1,50 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002,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.
+ */
+
+#include <cppunit/TextTestRunner.h>
+#include <cppunit/XmlOutputter.h>
+
+#include <gr_unittests.h>
+#include <qa_runtime.h>
+#include <qa_general.h>
+#include <qa_filter.h>
+// #include <qa_atsc.h>
+
+// FIXME add atsc back in.
+
+int
+main (int argc, char **argv)
+{
+ CppUnit::TextTestRunner runner;
+ std::ofstream xmlfile(get_unittest_path("gnuradio_core_all.xml").c_str());
+ CppUnit::XmlOutputter *xmlout = new CppUnit::XmlOutputter(&runner.result(), xmlfile);
+
+ runner.addTest (qa_runtime::suite ());
+ runner.addTest (qa_general::suite ());
+ runner.addTest (qa_filter::suite ());
+ // runner.addTest (qa_atsc::suite ());
+ runner.setOutputter(xmlout);
+
+ bool was_successful = runner.run ("", false);
+
+ return was_successful ? 0 : 1;
+}
diff --git a/gnuradio-core/src/tests/test_atsc.cc b/gnuradio-core/src/tests/test_atsc.cc
new file mode 100644
index 000000000..d99bccce5
--- /dev/null
+++ b/gnuradio-core/src/tests/test_atsc.cc
@@ -0,0 +1,42 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002,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.
+ */
+
+#include <cppunit/TextTestRunner.h>
+#include <cppunit/XmlOutputter.h>
+
+#include <gr_unittests.h>
+#include <qa_atsc.h>
+
+int
+main (int argc, char **argv)
+{
+ CppUnit::TextTestRunner runner;
+ std::ofstream xmlfile(get_unittest_path("gnuradio_core_atsc.xml").c_str());
+ CppUnit::XmlOutputter *xmlout = new CppUnit::XmlOutputter(&runner.result(), xmlfile);
+
+ runner.addTest (qa_atsc::suite ());
+ runner.setOutputter(xmlout);
+
+ bool was_successful = runner.run ("", false);
+
+ return was_successful ? 0 : 1;
+}
diff --git a/gnuradio-core/src/tests/test_buffers.py b/gnuradio-core/src/tests/test_buffers.py
new file mode 100755
index 000000000..b867c727c
--- /dev/null
+++ b/gnuradio-core/src/tests/test_buffers.py
@@ -0,0 +1,136 @@
+#!/usr/bin/env python
+#
+# 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.
+#
+
+from gnuradio import gr, gru
+from gnuradio import audio
+from gnuradio.eng_option import eng_option
+from optparse import OptionParser
+
+import time
+import sys
+
+# Test script to test setting up the buffers using gr_test
+# For very large buffers it will fail when you hit the circbuf memory limit.
+# On linux this limit is shmmax, it will fail when it tries to create a buffer > shmmax.
+# With a 2.6 or later kernel you can set the shmmax limit manually in a root console
+#show current shmmax limit
+#$ cat /proc/sys/kernel/shmmax
+#33554432
+
+#set shmmax limit manually to 300MB
+#echo 300000000 >/proc/sys/kernel/shmmax
+
+#show new shmmax limit
+#$ cat /proc/sys/kernel/shmmax
+#300000000
+
+class my_graph(gr.top_block):
+
+ def __init__(self, seconds,history,output_multiple):
+ gr.top_block.__init__(self)
+
+ parser = OptionParser(option_class=eng_option)
+ parser.add_option("-O", "--audio-output", type="string", default="",
+ help="pcm output device name. E.g., hw:0,0 or /dev/dsp")
+ parser.add_option("-r", "--sample-rate", type="eng_float", default=48000,
+ help="set sample rate to RATE (48000)")
+ (options, args) = parser.parse_args ()
+ if len(args) != 0:
+ parser.print_help()
+ raise SystemExit, 1
+
+ sample_rate = int(options.sample_rate)
+ ampl = 0.1
+
+ src0 = gr.sig_source_f (sample_rate, gr.GR_SIN_WAVE, 350, ampl)
+
+ nsamples=int(sample_rate * seconds) #1 seconds
+ # gr.test (const std::string &name=std::string("gr_test"),
+ # int min_inputs=1, int max_inputs=1, unsigned int sizeof_input_item=1,
+ # int min_outputs=1, int max_outputs=1, unsigned int sizeof_output_item=1,
+ # unsigned int history=1,unsigned int output_multiple=1,double relative_rate=1.0,
+ # bool fixed_rate=true,gr_consume_type_t cons_type=CONSUME_NOUTPUT_ITEMS, gr_produce_type_t prod_type=PRODUCE_NOUTPUT_ITEMS);
+ name="gr_test"
+ min_inputs=1
+ max_inputs=1
+ sizeof_input_item=gr.sizeof_float
+ min_outputs=1
+ max_outputs=1
+ sizeof_output_item=gr.sizeof_float
+ #history=1 # problems start at 8150
+ #output_multiple=1 #problems start at 8000 in combination with large history
+ relative_rate=1.0
+ fixed_rate=True
+ consume_type=gr.CONSUME_NOUTPUT_ITEMS
+ produce_type=gr.PRODUCE_NOUTPUT_ITEMS
+ test = gr.test(name, min_inputs,max_inputs,sizeof_input_item,
+ min_outputs,max_outputs,sizeof_output_item,
+ history,output_multiple,relative_rate,
+ fixed_rate, consume_type,produce_type)
+ #test = gr.test("gr_test",1,1,gr.sizeof_float,
+ # 1,1,gr.sizeof_float,
+ # 1,1,1.0,
+ # True, gr.CONSUME_NOUTPUT_ITEMS,gr.PRODUCE_NOUTPUT_ITEMS)
+ #unsigned int history=1,unsigned int output_multiple=1,double relative_rate=1.0,
+ #bool fixed_rate=false
+ dst = audio.sink (sample_rate, options.audio_output)
+ head= gr.head(gr.sizeof_float, nsamples)
+
+ self.connect (src0,test,head,(dst, 0))
+
+
+if __name__ == '__main__':
+
+ seconds=5.0
+ output_multiple=1
+ for history in (1,1000,8000,8100,8150,8175,8190,8191,8192,8193,8194,8195,9000,10000,100000,1000000,10000000): #,100000000):
+ sys.stdout.flush()
+ sys.stderr.flush()
+ print 'Test with history=', history, 'output_multiple=',output_multiple
+ sys.stdout.flush()
+ sys.stderr.flush()
+ succeed=True
+ starttime=time.time()
+ try:
+ my_graph(seconds,history,output_multiple).run()
+ except KeyboardInterrupt:
+ pass
+ except:
+ print "\nAn exception has terminated the graph."
+ exception=True
+ succeed=False
+ sys.stdout.flush()
+ sys.stderr.flush()
+ if succeed:
+ print ''
+ endtime=time.time()
+ duration=endtime - starttime
+ if (duration < 0.5*seconds) and (succeed):
+ print "A problem has terminated the graph."
+ succeed=False
+ if (duration > 1.5*seconds) and (succeed):
+ print "Something slowed the graph down considerably."
+ succeed=False
+
+ print 'The test result was:' , succeed
+ print 'Test duration' , duration
+ print ''
diff --git a/gnuradio-core/src/tests/test_filter.cc b/gnuradio-core/src/tests/test_filter.cc
new file mode 100644
index 000000000..8b17034c6
--- /dev/null
+++ b/gnuradio-core/src/tests/test_filter.cc
@@ -0,0 +1,42 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002,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.
+ */
+
+#include <cppunit/TextTestRunner.h>
+#include <cppunit/XmlOutputter.h>
+
+#include <gr_unittests.h>
+#include <qa_filter.h>
+
+int
+main (int argc, char **argv)
+{
+ CppUnit::TextTestRunner runner;
+ std::ofstream xmlfile(get_unittest_path("gnuradio_core_filter.xml").c_str());
+ CppUnit::XmlOutputter *xmlout = new CppUnit::XmlOutputter(&runner.result(), xmlfile);
+
+ runner.addTest (qa_filter::suite ());
+ runner.setOutputter(xmlout);
+
+ bool was_successful = runner.run ("", false);
+
+ return was_successful ? 0 : 1;
+}
diff --git a/gnuradio-core/src/tests/test_general.cc b/gnuradio-core/src/tests/test_general.cc
new file mode 100644
index 000000000..32fac1b35
--- /dev/null
+++ b/gnuradio-core/src/tests/test_general.cc
@@ -0,0 +1,42 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002,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.
+ */
+
+#include <cppunit/TextTestRunner.h>
+#include <cppunit/XmlOutputter.h>
+
+#include <gr_unittests.h>
+#include <qa_general.h>
+
+int
+main (int argc, char **argv)
+{
+ CppUnit::TextTestRunner runner;
+ std::ofstream xmlfile(get_unittest_path("gnuradio_core_general.xml").c_str());
+ CppUnit::XmlOutputter *xmlout = new CppUnit::XmlOutputter(&runner.result(), xmlfile);
+
+ runner.addTest (qa_general::suite ());
+ runner.setOutputter(xmlout);
+
+ bool was_successful = runner.run ("", false);
+
+ return was_successful ? 0 : 1;
+}
diff --git a/gnuradio-core/src/tests/test_runtime.cc b/gnuradio-core/src/tests/test_runtime.cc
new file mode 100644
index 000000000..bd5378332
--- /dev/null
+++ b/gnuradio-core/src/tests/test_runtime.cc
@@ -0,0 +1,42 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002,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.
+ */
+
+#include <cppunit/TextTestRunner.h>
+#include <cppunit/XmlOutputter.h>
+
+#include <gr_unittests.h>
+#include <qa_runtime.h>
+
+int
+main (int argc, char **argv)
+{
+ CppUnit::TextTestRunner runner;
+ std::ofstream xmlfile(get_unittest_path("gnuradio_core_runtime.xml").c_str());
+ CppUnit::XmlOutputter *xmlout = new CppUnit::XmlOutputter(&runner.result(), xmlfile);
+
+ runner.addTest (qa_runtime::suite ());
+ runner.setOutputter(xmlout);
+
+ bool was_successful = runner.run ("", false);
+
+ return was_successful ? 0 : 1;
+}
diff --git a/gnuradio-core/src/tests/test_vmcircbuf.cc b/gnuradio-core/src/tests/test_vmcircbuf.cc
new file mode 100644
index 000000000..ee24b6d62
--- /dev/null
+++ b/gnuradio-core/src/tests/test_vmcircbuf.cc
@@ -0,0 +1,44 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2003 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_vmcircbuf.h>
+#include <stdio.h>
+
+int
+main (int argc, char **argv)
+{
+ int verbose = 1; // summary
+
+ if (argc > 1)
+ verbose = 2; // extra chatty
+
+ bool ok = gr_vmcircbuf_sysconfig::test_all_factories (verbose);
+
+ if (ok){
+ fprintf (stdout, "test_vmcircbuf: OK. We've got at least one workable solution\n");
+ return 0;
+ }
+ else {
+ fprintf (stdout, "test_vmcircbuf: NOT OK. We don't have a workable solution\n");
+ return 1;
+ }
+}
diff --git a/gnuradio-core/src/utils/cic_comp_taps.m b/gnuradio-core/src/utils/cic_comp_taps.m
new file mode 100644
index 000000000..9ae5cb167
--- /dev/null
+++ b/gnuradio-core/src/utils/cic_comp_taps.m
@@ -0,0 +1,45 @@
+#
+# 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.
+#
+
+# See Altera Application Note AN455
+#
+# R = decimation factor, 8-256
+# Fc = passband (one-sided) cutoff frequency
+# L = number of taps
+
+function taps = cic_comp_taps(R, Fc, L)
+ M = 1; %% Differential delay
+ N = 4; %% Number of stages
+ B = 18; %% Coeffi. Bit-width
+ Fs = 64e6; %% (High) Sampling freq in Hz before decimation
+ Fo = R*Fc/Fs; %% Normalized Cutoff freq; 0<Fo<=0.5/M;
+ p = 2e3; %% Granularity
+ s = 0.25/p; %% Step size
+ fp = [0:s:Fo]; %% Pass band frequency samples
+ fs = (Fo+s):s:0.5; %% Stop band frequency samples
+ f = [fp fs]*2; %% Normalized frequency samples; 0<=f<=1
+ Mp = ones(1,length(fp)); %% Pass band response; Mp(1)=1
+ Mp(2:end) = abs( M*R*sin(pi*fp(2:end)/R)./sin(pi*M*fp(2:end))).^N;
+ Mf = [Mp zeros(1,length(fs))];
+ f(end) = 1;
+ h = fir2(L,f,Mf); %% Filter length L+1
+ taps = h/sum(h); %% Floating point coefficients
+endfunction
diff --git a/gnuradio-core/src/utils/cool.m b/gnuradio-core/src/utils/cool.m
new file mode 100644
index 000000000..f8b8a5cea
--- /dev/null
+++ b/gnuradio-core/src/utils/cool.m
@@ -0,0 +1,50 @@
+%% Copyright (C) 1999,2000 Kai Habel
+%%
+%% This program 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 of the License, or
+%% (at your option) any later version.
+%%
+%% This program 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 this program; if not, write to the Free Software
+%% Foundation, Inc., 51 Franklin Street, Boston, MA 02110-1301 USA
+
+%% -*- texinfo -*-
+%% @deftypefn {Function File} {} cool (@var{n})
+%% Create color colormap.
+%% (cyan to magenta)
+%% The argument @var{n} should be a scalar. If it
+%% is omitted, the length of the current colormap or 64 is assumed.
+%% @end deftypefn
+%% @seealso{colormap}
+
+%% Author: Kai Habel <kai.habel@gmx.de>
+
+function map = cool (number)
+
+ if (nargin == 0)
+ number = rows (colormap);
+ elseif (nargin == 1)
+ if (! is_scalar (number))
+ error ("cool: argument must be a scalar");
+ end
+ else
+ usage ("cool (number)");
+ end
+
+ if (number == 1)
+ map = [0, 1, 1];
+ elseif (number > 1)
+ r = (0:number - 1)' ./ (number - 1);
+ g = 1 - r;
+ b = ones (number, 1);
+ map = [r, g, b];
+ else
+ map = [];
+ end
+
diff --git a/gnuradio-core/src/utils/db_width.m b/gnuradio-core/src/utils/db_width.m
new file mode 100644
index 000000000..e9c64cc79
--- /dev/null
+++ b/gnuradio-core/src/utils/db_width.m
@@ -0,0 +1,35 @@
+%
+% Copyright 2001 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.
+
+%% find the N-dB width of the given filter
+%% E.g., to find the 3-dB width, use width = db_width (taps, -3.0)
+%% the result is normalized to nyquist == 1
+
+function width = db_width (taps, db)
+ [H,w] = freqz (taps, 1, 4096);
+ Habs = abs(H);
+ max_H = max(Habs);
+ min_H = min(Habs);
+ threshold = max_H * 10^(db/20);
+ if (min_H > threshold)
+ error ("The %g dB point is never reached", db);
+ end
+ above = Habs >= threshold;
+ width = sum(above) / length (above);
diff --git a/gnuradio-core/src/utils/filter_tools.m b/gnuradio-core/src/utils/filter_tools.m
new file mode 100644
index 000000000..552791e33
--- /dev/null
+++ b/gnuradio-core/src/utils/filter_tools.m
@@ -0,0 +1,42 @@
+%
+% Copyright 2001 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.
+%
+%% equivalent to the C++ code in VrComplexFIRfilter::buildFilterComplex
+
+1;
+
+%% hamming window, nothing fancy
+
+function taps = build_filter_complex_lp (gain, ntaps)
+
+ taps = gain * (0.54 - 0.46 * cos (2 * pi * (0:ntaps-1)' / (ntaps-1)));
+
+end
+
+%% old_taps describes a low pass filter, convert it to bandpass
+%% centered at center_freq. center_freq is normalized to Fs (sampling freq)
+
+function new_taps = freq_shift_filter (old_taps, center_freq)
+
+ ntaps = length(old_taps);
+
+ new_taps = exp (j*2*pi*center_freq*(0:ntaps-1)') .* old_taps;
+
+end
diff --git a/gnuradio-core/src/utils/is_complex.m b/gnuradio-core/src/utils/is_complex.m
new file mode 100644
index 000000000..4700467b1
--- /dev/null
+++ b/gnuradio-core/src/utils/is_complex.m
@@ -0,0 +1,24 @@
+#
+# 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.
+#
+
+function p = is_complex (x)
+ p = any (imag (x) != 0);
+endfunction;
diff --git a/gnuradio-core/src/utils/lp_to_bp.m b/gnuradio-core/src/utils/lp_to_bp.m
new file mode 100644
index 000000000..4e73f6cc7
--- /dev/null
+++ b/gnuradio-core/src/utils/lp_to_bp.m
@@ -0,0 +1,27 @@
+#
+# Copyright 2002 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.
+#
+
+## transform low pass coefficients into bandpass coefficients
+
+function bp_taps = lp_to_bp (lp_taps, center_freq, sampling_freq)
+ arg = 2 * pi * center_freq / sampling_freq;
+ bp_taps = lp_taps .* exp (j*arg*(0:length(lp_taps)-1)');
+endfunction
diff --git a/gnuradio-core/src/utils/partition-cascaded-decimating-filters.scm b/gnuradio-core/src/utils/partition-cascaded-decimating-filters.scm
new file mode 100644
index 000000000..6ae7877f9
--- /dev/null
+++ b/gnuradio-core/src/utils/partition-cascaded-decimating-filters.scm
@@ -0,0 +1,67 @@
+;; Estimate the total work (ntaps * sampling rate) for two cascaded
+;; decimating low pass filters.
+;;
+;; The basic assumption is that the number of taps required in any
+;; section is inversely proportional to the normalized transition width
+;; for that section.
+;;
+;; FS is the input sampling frequency
+;; F1 is the cutoff frequency
+;; F2 is the far edge of the transition band
+;; DEC1 is the decimation factor for the first filter
+;; DEC2 is the decimation factor for the 2nd filter
+;;
+;; The total decimation factor is DEC1 * DEC2. Therefore,
+;; the output rate of the filter is FS / (DEC1 * DEC2)
+
+(require 'common-list-functions)
+(require 'factor)
+
+
+
+(define (work2 fs f1 f2 dec1 dec2)
+ (+ (work1 fs f1 (/ fs (* 2 dec1)) dec1)
+ (work1 (/ fs dec1) f1 f2 dec2)))
+
+
+;; work for a single section
+
+(define (work1 fs f1 f2 dec)
+ (/ (* fs (/ fs (- f2 f1))) dec))
+
+
+;; return the max integer dec such that fs/(2*dec) >= f2
+
+(define (max-dec fs f2)
+ (inexact->exact (floor (/ fs (* 2 f2)))))
+
+
+;; `adjoin' returns the adjoint of the element OBJ and the list LST.
+;; That is, if OBJ is in LST, `adjoin' returns LST, otherwise, it returns
+;; `(cons OBJ LST)'.
+
+(define (adjoin-equal obj lst)
+ (if (member obj lst) lst (cons obj lst)))
+
+
+;;; not quite right
+
+(define (permute lst)
+ (let ((result '()))
+ (define (aux set head)
+ (if (null? set)
+ (set! result (cons head result))
+ (for-each (lambda (x)
+ (aux (set-difference set (list x))
+ (cons x head)))
+ set)))
+ (aux lst '())
+ result))
+
+;; `extract-nth' returns the Nth element of LST consed on to the
+;; list resulting from splicing out the Nth element of LST.
+;; Indexing is 0 based.
+
+(define (extract-nth n lst)
+ lst)
+
diff --git a/gnuradio-core/src/utils/permute.scm b/gnuradio-core/src/utils/permute.scm
new file mode 100644
index 000000000..23ddfc999
--- /dev/null
+++ b/gnuradio-core/src/utils/permute.scm
@@ -0,0 +1,27 @@
+(require 'common-list-functions)
+
+
+(define (permute lst)
+ (define (aux set head)
+ (cond ((null? set) head)
+ (else
+ (map (lambda (x)
+ (aux (set-difference set (list x))
+ (cons x head)))
+ set))))
+ (aux lst '()))
+
+(define (permute-2 lst)
+ (let ((result '()))
+ (define (aux set head)
+ (if (null? set)
+ (set! result (cons head result))
+ (for-each (lambda (x)
+ (aux (set-difference set (list x))
+ (cons x head)))
+ set)))
+ (aux lst '())
+ result))
+
+
+
diff --git a/gnuradio-core/src/utils/plot_cic_decimator_response.m b/gnuradio-core/src/utils/plot_cic_decimator_response.m
new file mode 100644
index 000000000..8f06aeafe
--- /dev/null
+++ b/gnuradio-core/src/utils/plot_cic_decimator_response.m
@@ -0,0 +1,44 @@
+#
+# 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.
+#
+
+function plot_cic_decimator_response (R, N, M)
+ ## R = decimation rate
+ ## N = number of stages (4)
+ ## M = 1
+ gain = (R*M)^N
+ npoints = 1024;
+ w = 0:1/npoints:1-1/npoints;
+ w = w * 1 * pi;
+ ## w = w * R;
+ length(w);
+ num = sin (w*R*M/2);
+ length (num);
+ ## H = sin (w*R*M/2) ./ sin (w/2)
+ denom = sin(w/2);
+ length (denom);
+ H = (num ./ denom) .^ N;
+ H(1) = gain;
+ H = H ./ gain;
+ plot (R*w/(2*pi), 10 * log10 (H));
+ ## plot (R*w/(2*pi), H);
+endfunction
+
+
diff --git a/gnuradio-core/src/utils/plot_freq_response.m b/gnuradio-core/src/utils/plot_freq_response.m
new file mode 100644
index 000000000..335c51d62
--- /dev/null
+++ b/gnuradio-core/src/utils/plot_freq_response.m
@@ -0,0 +1,36 @@
+#
+# Copyright 2001 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.
+#
+
+function plot_freq_response (b,...)
+ if (nargin == 1)
+ ## Response of an FIR filter
+ a = 1;
+ elseif (nargin == 2)
+ ## response of an IIR filter
+ a = va_arg ();
+ endif
+
+ [H,w] = freqz (b,a);
+ plot (w/(2*pi), abs(H));
+ grid;
+ xlabel ('Normalized Frequency (Fs == 1)');
+ ylabel ('Magnitude (linear)');
+endfunction
diff --git a/gnuradio-core/src/utils/plot_freq_response_db.m b/gnuradio-core/src/utils/plot_freq_response_db.m
new file mode 100644
index 000000000..10ce7d6e1
--- /dev/null
+++ b/gnuradio-core/src/utils/plot_freq_response_db.m
@@ -0,0 +1,39 @@
+#
+# Copyright 2001 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.
+#
+
+function plot_freq_response_db (b,...)
+ if (nargin == 1)
+ ## Response of an FIR filter
+ a = 1;
+ elseif (nargin == 2)
+ ## response of an IIR filter
+ a = va_arg ();
+ endif
+
+ [H,w] = freqz (b,a);
+
+ grid;
+ xlabel ('Normalized Frequency (Fs == 1)');
+ ylabel ('Magnitude Squared (dB)');
+ abs = abs(H);
+# plot (w/(2*pi), 20 * log10 (abs/max(abs)));
+ plot (w/(2*pi), 20 * log10 (abs));
+endfunction
diff --git a/gnuradio-core/src/utils/plot_freq_response_phase.m b/gnuradio-core/src/utils/plot_freq_response_phase.m
new file mode 100644
index 000000000..591bd5b94
--- /dev/null
+++ b/gnuradio-core/src/utils/plot_freq_response_phase.m
@@ -0,0 +1,38 @@
+#
+# Copyright 2001 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.
+#
+
+function plot_freq_response_db (b,...)
+ if (nargin == 1)
+ ## Response of an FIR filter
+ a = 1;
+ elseif (nargin == 2)
+ ## response of an IIR filter
+ a = va_arg ();
+ endif
+
+ [H,w] = freqz (b,a);
+
+ grid;
+ xlabel ('Normalized Frequency (Fs == 1)');
+ ylabel ('Phase (radians)');
+ abs = abs(H);
+ plot (w/(2*pi), atan2(imag(H), real(H)))
+endfunction
diff --git a/gnuradio-core/src/utils/plotfft.m b/gnuradio-core/src/utils/plotfft.m
new file mode 100644
index 000000000..20a2efd4c
--- /dev/null
+++ b/gnuradio-core/src/utils/plotfft.m
@@ -0,0 +1,40 @@
+#
+# Copyright 2001 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.
+#
+
+function plotfft (data, sample_rate)
+
+ if (nargin == 1)
+ sample_rate = 1.0;
+ endif;
+
+ if ((m = nargchk (1,2,nargin)))
+ usage (m);
+ endif;
+
+ len = length(data);
+ s = fft (data.*kaiser(len, 5));
+
+ incr = sample_rate/len;
+ min_x = -sample_rate/2;
+ max_x = sample_rate/2 - incr;
+ plot (min_x:incr:max_x, abs(fftshift(s)));
+
+endfunction
diff --git a/gnuradio-core/src/utils/plotfftavgk.m b/gnuradio-core/src/utils/plotfftavgk.m
new file mode 100644
index 000000000..c82c540f3
--- /dev/null
+++ b/gnuradio-core/src/utils/plotfftavgk.m
@@ -0,0 +1,61 @@
+#
+# Copyright 2002 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.
+#
+
+function plotfftavgk_db (all_data, k, sample_rate)
+
+ if (nargin == 2)
+ sample_rate = 1.0;
+ endif;
+
+ if ((m = nargchk (2,3,nargin)))
+ usage (m);
+ endif;
+
+ ## len = 1024;
+ len = 8192;
+ ##window = ones (len, 1);
+ window = kaiser (len, 5);
+
+ s = zeros (len,1);
+
+ count = min (100, floor (length (all_data)/len));
+
+ for i = 0:count-1;
+ data = all_data((k+i)*len + 1 : (k+i+1)*len);
+ s = s + abs (fft (data.*window));
+ endfor;
+
+ s = s ./ count;
+
+ incr = sample_rate/len;
+ min_x = -sample_rate/2;
+ max_x = sample_rate/2 - incr;
+
+ x = min_x:incr:max_x;
+ ## y = 20 * log10(fftshift(s));
+ y = (fftshift(s));
+ plot (x, y);
+
+ i = find (y == max(y))
+ x(i)
+ y(i)
+
+endfunction
diff --git a/gnuradio-core/src/utils/plotfftavgk_db.m b/gnuradio-core/src/utils/plotfftavgk_db.m
new file mode 100644
index 000000000..73cee140d
--- /dev/null
+++ b/gnuradio-core/src/utils/plotfftavgk_db.m
@@ -0,0 +1,73 @@
+#
+# Copyright 2001 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.
+#
+
+function plotfftavgk_db (all_data, k, sample_rate)
+
+ if (nargin == 2)
+ sample_rate = 1.0;
+ endif;
+
+ if ((m = nargchk (2,3,nargin)))
+ usage (m);
+ endif;
+
+ len = 1024;
+ ## len = 8192;
+ ##window = ones (len, 1);
+ #window = kaiser (len, 5);
+ window = hanning (len);
+
+ s = zeros (len,1);
+
+ count = min (100, floor (length (all_data)/len));
+
+ for i = 0:count-1;
+ data = all_data((k+i)*len + 1 : (k+i+1)*len);
+ s = s + abs (fft (data.*window));
+ endfor;
+
+ s = s ./ count;
+
+ incr = sample_rate/len;
+
+ if is_complex (all_data);
+ min_x = -sample_rate/2;
+ max_x = sample_rate/2 - incr;
+
+ x = min_x:incr:max_x;
+ y = 20 * log10(fftshift(s));
+ plot (x, y);
+ else
+ min_x = 0
+ max_x = sample_rate/2 - incr;
+
+ x = min_x:incr:max_x;
+ y = 20 * log10(s(1:len/2));
+ plot (x, y);
+
+ endif;
+
+
+ i = find (y == max(y))
+ x(i)
+ y(i)
+
+endfunction
diff --git a/gnuradio-core/src/utils/plotfftk.m b/gnuradio-core/src/utils/plotfftk.m
new file mode 100644
index 000000000..df2bf3aca
--- /dev/null
+++ b/gnuradio-core/src/utils/plotfftk.m
@@ -0,0 +1,41 @@
+#
+# Copyright 2001 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.
+#
+
+function plotfftk (all_data, k, sample_rate)
+
+ if (nargin == 2)
+ sample_rate = 1.0;
+ endif;
+
+ if ((m = nargchk (2,3,nargin)))
+ usage (m);
+ endif;
+
+ len = 1024;
+ data = all_data(k*len + 1 : (k+1)*len);
+ s = fft (data.*kaiser(len, 5));
+
+ incr = sample_rate/len;
+ min_x = -sample_rate/2;
+ max_x = sample_rate/2 - incr;
+ plot (min_x:incr:max_x, abs(fftshift(s)));
+
+endfunction
diff --git a/gnuradio-core/src/utils/plotfftk_db.m b/gnuradio-core/src/utils/plotfftk_db.m
new file mode 100644
index 000000000..b2c85412f
--- /dev/null
+++ b/gnuradio-core/src/utils/plotfftk_db.m
@@ -0,0 +1,43 @@
+#
+# Copyright 2001 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.
+#
+
+function plotfftk_db (all_data, k, sample_rate)
+
+ if (nargin == 2)
+ sample_rate = 1.0;
+ endif;
+
+ if ((m = nargchk (2,3,nargin)))
+ usage (m);
+ endif;
+
+ len = 1024;
+ data = all_data(k*len + 1 : (k+1)*len);
+ ## s = fft (data.*kaiser(len, 5));
+ ## s = fft (data.*hamming(len));
+ s = fft (data.*hanning(len));
+
+ incr = sample_rate/len;
+ min_x = -sample_rate/2;
+ max_x = sample_rate/2 - incr;
+ plot (min_x:incr:max_x, 20 * log10(abs(fftshift(s))));
+
+endfunction
diff --git a/gnuradio-core/src/utils/put_markers.m b/gnuradio-core/src/utils/put_markers.m
new file mode 100644
index 000000000..1244d31aa
--- /dev/null
+++ b/gnuradio-core/src/utils/put_markers.m
@@ -0,0 +1,32 @@
+#
+# Copyright 2002 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.
+#
+
+function put_markers (y)
+
+ if (nargin == 0)
+ y = 25;
+ endif;
+
+ hold on;
+ plot (3.06e6, y, '@');
+ plot (8.44e6, y, '@');
+
+endfunction
diff --git a/gnuradio-core/src/utils/rainbow.m b/gnuradio-core/src/utils/rainbow.m
new file mode 100644
index 000000000..35fab19b8
--- /dev/null
+++ b/gnuradio-core/src/utils/rainbow.m
@@ -0,0 +1,53 @@
+## Copyright (C) 1999,2000 Kai Habel
+##
+## This program 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 of the License, or
+## (at your option) any later version.
+##
+## This program 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 this program; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin Street, Boston, MA 02110-1301 USA
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {} rainbow (@var{n})
+## Create color colormap.
+## (red through yellow, green, cyan,blue,magenta to red)
+## The argument @var{n} should be a scalar. If it
+## is omitted, the length of the current colormap or 64 is assumed.
+## @end deftypefn
+## @seealso{colormap}
+
+## Author: Kai Habel <kai.habel@gmx.de>
+
+## 2001-09-13 Paul Kienzle <pkienzle@users.sf.net>
+## * renamed to rainbow for use with tk_octave
+## * remove reference to __current_color_map__
+
+function map = rainbow (number)
+
+ if (nargin == 0)
+ number = length(colormap);
+ elseif (nargin == 1)
+ if (! is_scalar (number))
+ error ("rainbow: argument must be a scalar");
+ endif
+ else
+ usage ("rainbow (number)");
+ endif
+
+ if (number == 1)
+ map = [1, 0, 0];
+ elseif (number > 1)
+ h = linspace (0, 1, number)';
+ map = hsv2rgb ([h, ones(number, 1), ones(number, 1)]);
+ else
+ map = [];
+ endif
+
+endfunction
diff --git a/gnuradio-core/src/utils/read_char_binary.m b/gnuradio-core/src/utils/read_char_binary.m
new file mode 100644
index 000000000..029cea783
--- /dev/null
+++ b/gnuradio-core/src/utils/read_char_binary.m
@@ -0,0 +1,45 @@
+%
+% Copyright 2001 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.
+%
+
+function v = read_char_binary (filename, count)
+
+ %% usage: read_char (filename, [count])
+ %%
+ %% open filename and return the contents, treating them as
+ %% signed short integers
+ %%
+
+ m = nargchk (1,2,nargin);
+ if (m)
+ usage (m);
+ end
+
+ if (nargin < 2)
+ count = Inf;
+ end
+
+ f = fopen (filename, 'rb');
+ if (f < 0)
+ v = 0;
+ else
+ v = fread (f, count, 'char');
+ fclose (f);
+ end
diff --git a/gnuradio-core/src/utils/read_complex_binary.m b/gnuradio-core/src/utils/read_complex_binary.m
new file mode 100644
index 000000000..eb81f0fa0
--- /dev/null
+++ b/gnuradio-core/src/utils/read_complex_binary.m
@@ -0,0 +1,48 @@
+%
+% Copyright 2001 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.
+%
+
+function v = read_complex_binary (filename, count)
+
+ %% usage: read_complex_binary (filename, [count])
+ %%
+ %% open filename and return the contents as a column vector,
+ %% treating them as 32 bit complex numbers
+ %%
+
+ m = nargchk (1,2,nargin);
+ if (m)
+ usage (m);
+ end
+
+ if (nargin < 2)
+ count = Inf;
+ end
+
+ f = fopen (filename, 'rb');
+ if (f < 0)
+ v = 0;
+ else
+ t = fread (f, [2, count], 'float');
+ fclose (f);
+ v = t(1,:) + t(2,:)*i;
+ [r, c] = size (v);
+ v = reshape (v, c, r);
+ end
diff --git a/gnuradio-core/src/utils/read_cshort_binary.m b/gnuradio-core/src/utils/read_cshort_binary.m
new file mode 100644
index 000000000..149b6ca88
--- /dev/null
+++ b/gnuradio-core/src/utils/read_cshort_binary.m
@@ -0,0 +1,46 @@
+%
+% Copyright 2001,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.
+%
+
+function cv = read_cshort_binary (filename, count)
+
+ %% usage: read_cshort_binary (filename, [count])
+ %%
+ %% open filename and return the contents, treating them as
+ %% signed short integers
+ %%
+
+ m = nargchk (1,2,nargin);
+ if (m)
+ usage (m);
+ end
+
+ if (nargin < 2)
+ count = Inf;
+ end
+
+ f = fopen (filename, 'rb');
+ if (f < 0)
+ cv = 0;
+ else
+ v = fread (f, count, 'short');
+ fclose (f);
+ cv = v(1:2:end)+v(2:2:end)*j;
+ end
diff --git a/gnuradio-core/src/utils/read_float_binary.m b/gnuradio-core/src/utils/read_float_binary.m
new file mode 100644
index 000000000..d27d09b9c
--- /dev/null
+++ b/gnuradio-core/src/utils/read_float_binary.m
@@ -0,0 +1,45 @@
+%
+% Copyright 2001 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.
+%
+
+function v = read_float_binary (filename, count)
+
+ %% usage: read_float_binary (filename, [count])
+ %%
+ %% open filename and return the contents, treating them as
+ %% 32 bit floats
+ %%
+
+ m = nargchk (1,2,nargin);
+ if (m)
+ usage (m);
+ end
+
+ if (nargin < 2)
+ count = Inf;
+ end
+
+ f = fopen (filename, 'rb');
+ if (f < 0)
+ v = 0;
+ else
+ v = fread (f, count, 'float');
+ fclose (f);
+ end
diff --git a/gnuradio-core/src/utils/read_int_binary.m b/gnuradio-core/src/utils/read_int_binary.m
new file mode 100644
index 000000000..cd83bb663
--- /dev/null
+++ b/gnuradio-core/src/utils/read_int_binary.m
@@ -0,0 +1,46 @@
+%
+% Copyright 2001,2002 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.
+%
+
+function v = read_int_binary (filename, count)
+
+ %% usage: read_int_binary (filename, [count])
+ %%
+ %% open filename and return the contents, treating them as
+ %% signed integers
+ %%
+
+ m = nargchk (1,2,nargin);
+ if (m)
+ usage (m);
+ end
+
+ if (nargin < 2)
+ count = Inf;
+ end
+
+ f = fopen (filename, 'rb');
+ if (f < 0)
+ v = 0;
+ else
+ v = fread (f, count, 'int');
+ fclose (f);
+ end
+end
diff --git a/gnuradio-core/src/utils/read_short_binary.m b/gnuradio-core/src/utils/read_short_binary.m
new file mode 100644
index 000000000..7b42f5e2b
--- /dev/null
+++ b/gnuradio-core/src/utils/read_short_binary.m
@@ -0,0 +1,45 @@
+%
+% Copyright 2001 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.
+%
+
+function v = read_short_binary (filename, count)
+
+ %% usage: read_short_binary (filename, [count])
+ %%
+ %% open filename and return the contents, treating them as
+ %% signed short integers
+ %%
+
+ m = nargchk (1,2,nargin);
+ if (m)
+ usage (m);
+ end
+
+ if (nargin < 2)
+ count = Inf;
+ end
+
+ f = fopen (filename, 'rb');
+ if (f < 0)
+ v = 0;
+ else
+ v = fread (f, count, 'short');
+ fclose (f);
+ end
diff --git a/gnuradio-core/src/utils/read_xambi.m b/gnuradio-core/src/utils/read_xambi.m
new file mode 100644
index 000000000..5adb94264
--- /dev/null
+++ b/gnuradio-core/src/utils/read_xambi.m
@@ -0,0 +1,46 @@
+#
+# Copyright 2001,2005 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.
+#
+
+function v = read_xambi (filename)
+
+ ## usage: read_xambi (filename)
+ ##
+ ## read binary cross-ambiguity data from radar tools.
+ ## The file has an 8 float header, the first word of which specifies
+ ## the number of doppler bins.
+ ## returns a matrix
+
+ if ((m = nargchk (1,1,nargin)))
+ usage (m);
+ endif;
+
+ f = fopen (filename, "rb");
+ if (f < 0)
+ v = 0;
+ else
+ header = fread(f, 8, "float");
+ ndoppler_bins = header(1)
+ min_doppler = header(2)
+ max_doppler = header(3)
+ v = fread (f, [ndoppler_bins, Inf], "float");
+ fclose (f);
+ endif;
+endfunction;
diff --git a/gnuradio-core/src/utils/runsum.m b/gnuradio-core/src/utils/runsum.m
new file mode 100644
index 000000000..0f530b015
--- /dev/null
+++ b/gnuradio-core/src/utils/runsum.m
@@ -0,0 +1,9 @@
+function r = runsum(x)
+ len = length(x);
+ r = zeros (1, len);
+ r(1) = x(1);
+ for i = 2:len;
+ r(i) = r(i-1) + x(i);
+ endfor;
+endfunction;
+
diff --git a/gnuradio-core/src/utils/single_pole_iir.m b/gnuradio-core/src/utils/single_pole_iir.m
new file mode 100644
index 000000000..12e21f2ac
--- /dev/null
+++ b/gnuradio-core/src/utils/single_pole_iir.m
@@ -0,0 +1,25 @@
+#
+# Copyright 2002 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.
+#
+
+function [b, a] = single_pole_iir (alpha)
+ b = [alpha];
+ a = [1, alpha - 1];
+endfunction \ No newline at end of file
diff --git a/gnuradio-core/src/utils/split_vect.m b/gnuradio-core/src/utils/split_vect.m
new file mode 100644
index 000000000..aef5c5c38
--- /dev/null
+++ b/gnuradio-core/src/utils/split_vect.m
@@ -0,0 +1,15 @@
+% split vector into packets
+
+function y = split_vect(vect,N)
+ Z = floor(max(size(vect))/N);
+ y = [];
+ if(size(vect)(1)>size(vect)(2))
+ v = vect';
+ else
+ v = vect;
+ end
+ for i=1:Z
+ y(i,1:N) = v((i-1)*N+1:i*N);
+ end
+end
+
diff --git a/gnuradio-core/src/utils/write_float_binary.m b/gnuradio-core/src/utils/write_float_binary.m
new file mode 100644
index 000000000..79414878b
--- /dev/null
+++ b/gnuradio-core/src/utils/write_float_binary.m
@@ -0,0 +1,40 @@
+#
+# Copyright 2001 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.
+#
+
+function v = write_float_binary (data, filename)
+
+ ## usage: write_float_binary (data, filename)
+ ##
+ ## open filename and write data to it as 32 bit floats
+ ##
+
+ if ((m = nargchk (2,2,nargin)))
+ usage (m);
+ endif;
+
+ f = fopen (filename, "wb");
+ if (f < 0)
+ v = 0;
+ else
+ v = fwrite (f, data, "float");
+ fclose (f);
+ endif;
+endfunction;
diff --git a/gnuradio-core/src/utils/write_short_binary.m b/gnuradio-core/src/utils/write_short_binary.m
new file mode 100644
index 000000000..72b3c408e
--- /dev/null
+++ b/gnuradio-core/src/utils/write_short_binary.m
@@ -0,0 +1,40 @@
+#
+# Copyright 2001 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.
+#
+
+function v = write_short_binary (data, filename)
+
+ ## usage: write_short_binary (data, filename)
+ ##
+ ## open filename and write data to it as 16 bit shorts
+ ##
+
+ if ((m = nargchk (2,2,nargin)))
+ usage (m);
+ endif;
+
+ f = fopen (filename, "wb");
+ if (f < 0)
+ v = 0;
+ else
+ v = fwrite (f, data, "short");
+ fclose (f);
+ endif;
+endfunction;
diff --git a/gr-blocks/CMakeLists.txt b/gr-blocks/CMakeLists.txt
new file mode 100644
index 000000000..7e2f43562
--- /dev/null
+++ b/gr-blocks/CMakeLists.txt
@@ -0,0 +1,105 @@
+# 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.
+
+########################################################################
+# Setup dependencies
+########################################################################
+include(GrBoost)
+
+########################################################################
+# Register component
+########################################################################
+include(GrComponent)
+GR_REGISTER_COMPONENT("gr-blocks" ENABLE_GR_BLOCKS
+ Boost_FOUND
+ ENABLE_GR_CORE
+)
+
+GR_SET_GLOBAL(GR_BLOCKS_INCLUDE_DIRS
+ ${CMAKE_CURRENT_SOURCE_DIR}/lib
+ ${CMAKE_CURRENT_SOURCE_DIR}/include
+)
+
+########################################################################
+# Begin conditional configuration
+########################################################################
+if(ENABLE_GR_BLOCKS)
+
+########################################################################
+# Setup CPack components
+########################################################################
+include(GrPackage)
+CPACK_SET(CPACK_COMPONENT_GROUP_BLOCKS_DESCRIPTION "GNU Radio Basic Blocks")
+
+CPACK_COMPONENT("blocks_runtime"
+ GROUP "Blocks"
+ DISPLAY_NAME "Runtime"
+ DESCRIPTION "Runtime"
+ DEPENDS "core_runtime"
+)
+
+CPACK_COMPONENT("blocks_devel"
+ GROUP "Blocks"
+ DISPLAY_NAME "Development"
+ DESCRIPTION "C++ headers, package config, import libraries"
+ DEPENDS "core_devel"
+)
+
+CPACK_COMPONENT("blocks_python"
+ GROUP "Blocks"
+ DISPLAY_NAME "Python"
+ DESCRIPTION "Python modules for runtime; GRC xml files"
+ DEPENDS "core_python;blocks_runtime"
+)
+
+CPACK_COMPONENT("blocks_swig"
+ GROUP "Blocks"
+ DISPLAY_NAME "SWIG"
+ DESCRIPTION "SWIG development .i files"
+ DEPENDS "core_swig;blocks_python;blocks_devel"
+)
+
+########################################################################
+# Add subdirectories
+########################################################################
+add_subdirectory(include/blocks)
+add_subdirectory(lib)
+if(ENABLE_PYTHON)
+ add_subdirectory(python)
+ add_subdirectory(swig)
+ add_subdirectory(grc)
+ add_subdirectory(doc)
+ add_subdirectory(examples)
+endif(ENABLE_PYTHON)
+
+########################################################################
+# Create Pkg Config File
+########################################################################
+configure_file(
+ ${CMAKE_CURRENT_SOURCE_DIR}/gnuradio-blocks.pc.in
+ ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-blocks.pc
+@ONLY)
+
+install(
+ FILES ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-blocks.pc
+ DESTINATION ${GR_LIBRARY_DIR}/pkgconfig
+ COMPONENT "blocks_devel"
+)
+
+endif(ENABLE_GR_BLOCKS)
diff --git a/gr-blocks/doc/CMakeLists.txt b/gr-blocks/doc/CMakeLists.txt
new file mode 100644
index 000000000..c1397804b
--- /dev/null
+++ b/gr-blocks/doc/CMakeLists.txt
@@ -0,0 +1,23 @@
+# 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.
+
+install(
+ FILES README.blocks
+ DESTINATION ${GR_PKG_DOC_DIR}
+)
diff --git a/gr-blocks/doc/README.blocks b/gr-blocks/doc/README.blocks
new file mode 100644
index 000000000..418a06825
--- /dev/null
+++ b/gr-blocks/doc/README.blocks
@@ -0,0 +1,12 @@
+This is the gr-blocks package. It contains the basic blocks that are
+widely used in many different types of flowgraphs. To use these blocks,
+the Python namespace is in gnuradio.blocks, which would be normally
+imported as:
+
+ from gnuradio import blocks
+
+See the Doxygen documentation for details about the blocks available
+in this package. A quick listing of the details can be found in Python
+after importing by using:
+
+ help(blocks)
diff --git a/gr-blocks/doc/blocks.dox b/gr-blocks/doc/blocks.dox
new file mode 100644
index 000000000..110dcb677
--- /dev/null
+++ b/gr-blocks/doc/blocks.dox
@@ -0,0 +1,23 @@
+/*! \page page_digital Digital Modulation
+
+\section Introduction
+This is the gr-digital package. It contains all of the digital
+modulation blocks, utilities, and examples. To use the digital blocks,
+the Python namespaces is in gnuradio.digital, which would be normally
+imported as:
+
+\code
+ from gnuradio import digital
+\endcode
+
+See the Doxygen documentation for details about the blocks available
+in this package. The relevant blocks are listed in the \ref digital group.
+
+A quick listing of the details can be found in Python after importing
+by using:
+
+\code
+ help(digital)
+\endcode
+
+*/
diff --git a/gr-blocks/examples/CMakeLists.txt b/gr-blocks/examples/CMakeLists.txt
new file mode 100644
index 000000000..79535daa0
--- /dev/null
+++ b/gr-blocks/examples/CMakeLists.txt
@@ -0,0 +1,20 @@
+# 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.
+
+add_subdirectory(metadata)
diff --git a/gr-blocks/examples/metadata/CMakeLists.txt b/gr-blocks/examples/metadata/CMakeLists.txt
new file mode 100644
index 000000000..53a54b9d5
--- /dev/null
+++ b/gr-blocks/examples/metadata/CMakeLists.txt
@@ -0,0 +1,30 @@
+# 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.
+
+include(GrPython)
+
+install(
+ FILES
+ file_metadata_sink.grc
+ file_metadata_source.grc
+ file_metadata_vector_sink.grc
+ file_metadata_vector_source.grc
+ DESTINATION ${GR_PKG_DATA_DIR}/examples/metadata
+ COMPONENT "core_python"
+)
diff --git a/gr-blocks/examples/metadata/file_metadata_sink.grc b/gr-blocks/examples/metadata/file_metadata_sink.grc
new file mode 100644
index 000000000..198b0725f
--- /dev/null
+++ b/gr-blocks/examples/metadata/file_metadata_sink.grc
@@ -0,0 +1,951 @@
+<?xml version='1.0' encoding='ASCII'?>
+<flow_graph>
+ <timestamp>Fri Dec 14 17:09:06 2012</timestamp>
+ <block>
+ <key>options</key>
+ <param>
+ <key>id</key>
+ <value>file_metadata_sink</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>title</key>
+ <value></value>
+ </param>
+ <param>
+ <key>author</key>
+ <value></value>
+ </param>
+ <param>
+ <key>description</key>
+ <value></value>
+ </param>
+ <param>
+ <key>window_size</key>
+ <value>1280, 1024</value>
+ </param>
+ <param>
+ <key>generate_options</key>
+ <value>qt_gui</value>
+ </param>
+ <param>
+ <key>category</key>
+ <value>Custom</value>
+ </param>
+ <param>
+ <key>run_options</key>
+ <value>prompt</value>
+ </param>
+ <param>
+ <key>run</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>max_nouts</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>realtime_scheduling</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(10, 10)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>gr_sig_source_x</key>
+ <param>
+ <key>id</key>
+ <value>gr_sig_source_x_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>False</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>complex</value>
+ </param>
+ <param>
+ <key>samp_rate</key>
+ <value>samp_rate</value>
+ </param>
+ <param>
+ <key>waveform</key>
+ <value>gr.GR_COS_WAVE</value>
+ </param>
+ <param>
+ <key>freq</key>
+ <value>1000</value>
+ </param>
+ <param>
+ <key>amp</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>offset</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(57, 140)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable_qtgui_range</key>
+ <param>
+ <key>id</key>
+ <value>qt_samp_rate</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>label</key>
+ <value></value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>samp_rate</value>
+ </param>
+ <param>
+ <key>start</key>
+ <value>200000</value>
+ </param>
+ <param>
+ <key>stop</key>
+ <value>5000000</value>
+ </param>
+ <param>
+ <key>step</key>
+ <value>200000</value>
+ </param>
+ <param>
+ <key>widget</key>
+ <value>counter_slider</value>
+ </param>
+ <param>
+ <key>orient</key>
+ <value>Qt.Horizontal</value>
+ </param>
+ <param>
+ <key>min_len</key>
+ <value>200</value>
+ </param>
+ <param>
+ <key>gui_hint</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(330, 259)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable</key>
+ <param>
+ <key>id</key>
+ <value>samp_rate</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>200000</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(208, 11)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>uhd_usrp_source</key>
+ <param>
+ <key>id</key>
+ <value>uhd_usrp_source_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>fc32</value>
+ </param>
+ <param>
+ <key>otw</key>
+ <value></value>
+ </param>
+ <param>
+ <key>stream_args</key>
+ <value></value>
+ </param>
+ <param>
+ <key>dev_addr</key>
+ <value>addr=192.168.11.2</value>
+ </param>
+ <param>
+ <key>sync</key>
+ <value></value>
+ </param>
+ <param>
+ <key>clock_rate</key>
+ <value>0.0</value>
+ </param>
+ <param>
+ <key>num_mboards</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>clock_source0</key>
+ <value></value>
+ </param>
+ <param>
+ <key>time_source0</key>
+ <value></value>
+ </param>
+ <param>
+ <key>sd_spec0</key>
+ <value></value>
+ </param>
+ <param>
+ <key>clock_source1</key>
+ <value></value>
+ </param>
+ <param>
+ <key>time_source1</key>
+ <value></value>
+ </param>
+ <param>
+ <key>sd_spec1</key>
+ <value></value>
+ </param>
+ <param>
+ <key>clock_source2</key>
+ <value></value>
+ </param>
+ <param>
+ <key>time_source2</key>
+ <value></value>
+ </param>
+ <param>
+ <key>sd_spec2</key>
+ <value></value>
+ </param>
+ <param>
+ <key>clock_source3</key>
+ <value></value>
+ </param>
+ <param>
+ <key>time_source3</key>
+ <value></value>
+ </param>
+ <param>
+ <key>sd_spec3</key>
+ <value></value>
+ </param>
+ <param>
+ <key>clock_source4</key>
+ <value></value>
+ </param>
+ <param>
+ <key>time_source4</key>
+ <value></value>
+ </param>
+ <param>
+ <key>sd_spec4</key>
+ <value></value>
+ </param>
+ <param>
+ <key>clock_source5</key>
+ <value></value>
+ </param>
+ <param>
+ <key>time_source5</key>
+ <value></value>
+ </param>
+ <param>
+ <key>sd_spec5</key>
+ <value></value>
+ </param>
+ <param>
+ <key>clock_source6</key>
+ <value></value>
+ </param>
+ <param>
+ <key>time_source6</key>
+ <value></value>
+ </param>
+ <param>
+ <key>sd_spec6</key>
+ <value></value>
+ </param>
+ <param>
+ <key>clock_source7</key>
+ <value></value>
+ </param>
+ <param>
+ <key>time_source7</key>
+ <value></value>
+ </param>
+ <param>
+ <key>sd_spec7</key>
+ <value></value>
+ </param>
+ <param>
+ <key>nchan</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>samp_rate</key>
+ <value>qt_samp_rate</value>
+ </param>
+ <param>
+ <key>center_freq0</key>
+ <value>98.9e6</value>
+ </param>
+ <param>
+ <key>gain0</key>
+ <value>30</value>
+ </param>
+ <param>
+ <key>ant0</key>
+ <value></value>
+ </param>
+ <param>
+ <key>bw0</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>center_freq1</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>gain1</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>ant1</key>
+ <value></value>
+ </param>
+ <param>
+ <key>bw1</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>center_freq2</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>gain2</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>ant2</key>
+ <value></value>
+ </param>
+ <param>
+ <key>bw2</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>center_freq3</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>gain3</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>ant3</key>
+ <value></value>
+ </param>
+ <param>
+ <key>bw3</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>center_freq4</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>gain4</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>ant4</key>
+ <value></value>
+ </param>
+ <param>
+ <key>bw4</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>center_freq5</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>gain5</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>ant5</key>
+ <value></value>
+ </param>
+ <param>
+ <key>bw5</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>center_freq6</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>gain6</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>ant6</key>
+ <value></value>
+ </param>
+ <param>
+ <key>bw6</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>center_freq7</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>gain7</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>ant7</key>
+ <value></value>
+ </param>
+ <param>
+ <key>bw7</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>center_freq8</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>gain8</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>ant8</key>
+ <value></value>
+ </param>
+ <param>
+ <key>bw8</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>center_freq9</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>gain9</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>ant9</key>
+ <value></value>
+ </param>
+ <param>
+ <key>bw9</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>center_freq10</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>gain10</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>ant10</key>
+ <value></value>
+ </param>
+ <param>
+ <key>bw10</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>center_freq11</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>gain11</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>ant11</key>
+ <value></value>
+ </param>
+ <param>
+ <key>bw11</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>center_freq12</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>gain12</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>ant12</key>
+ <value></value>
+ </param>
+ <param>
+ <key>bw12</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>center_freq13</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>gain13</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>ant13</key>
+ <value></value>
+ </param>
+ <param>
+ <key>bw13</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>center_freq14</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>gain14</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>ant14</key>
+ <value></value>
+ </param>
+ <param>
+ <key>bw14</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>center_freq15</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>gain15</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>ant15</key>
+ <value></value>
+ </param>
+ <param>
+ <key>bw15</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>center_freq16</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>gain16</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>ant16</key>
+ <value></value>
+ </param>
+ <param>
+ <key>bw16</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>center_freq17</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>gain17</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>ant17</key>
+ <value></value>
+ </param>
+ <param>
+ <key>bw17</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>center_freq18</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>gain18</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>ant18</key>
+ <value></value>
+ </param>
+ <param>
+ <key>bw18</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>center_freq19</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>gain19</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>ant19</key>
+ <value></value>
+ </param>
+ <param>
+ <key>bw19</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>center_freq20</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>gain20</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>ant20</key>
+ <value></value>
+ </param>
+ <param>
+ <key>bw20</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>center_freq21</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>gain21</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>ant21</key>
+ <value></value>
+ </param>
+ <param>
+ <key>bw21</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>center_freq22</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>gain22</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>ant22</key>
+ <value></value>
+ </param>
+ <param>
+ <key>bw22</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>center_freq23</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>gain23</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>ant23</key>
+ <value></value>
+ </param>
+ <param>
+ <key>bw23</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>center_freq24</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>gain24</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>ant24</key>
+ <value></value>
+ </param>
+ <param>
+ <key>bw24</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>center_freq25</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>gain25</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>ant25</key>
+ <value></value>
+ </param>
+ <param>
+ <key>bw25</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>center_freq26</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>gain26</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>ant26</key>
+ <value></value>
+ </param>
+ <param>
+ <key>bw26</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>center_freq27</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>gain27</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>ant27</key>
+ <value></value>
+ </param>
+ <param>
+ <key>bw27</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>center_freq28</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>gain28</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>ant28</key>
+ <value></value>
+ </param>
+ <param>
+ <key>bw28</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>center_freq29</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>gain29</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>ant29</key>
+ <value></value>
+ </param>
+ <param>
+ <key>bw29</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>center_freq30</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>gain30</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>ant30</key>
+ <value></value>
+ </param>
+ <param>
+ <key>bw30</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>center_freq31</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>gain31</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>ant31</key>
+ <value></value>
+ </param>
+ <param>
+ <key>bw31</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(53, 269)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>gr_head</key>
+ <param>
+ <key>id</key>
+ <value>gr_head_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>complex</value>
+ </param>
+ <param>
+ <key>num_items</key>
+ <value>20000000</value>
+ </param>
+ <param>
+ <key>vlen</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(309, 172)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>blocks_file_meta_sink</key>
+ <param>
+ <key>id</key>
+ <value>blocks_file_meta_sink_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>file</key>
+ <value>/tmp/metadat_file.out</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>complex</value>
+ </param>
+ <param>
+ <key>samp_rate</key>
+ <value>samp_rate</value>
+ </param>
+ <param>
+ <key>rel_rate</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>vlen</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>max_seg_size</key>
+ <value>1000000</value>
+ </param>
+ <param>
+ <key>extra_dict</key>
+ <value>""</value>
+ </param>
+ <param>
+ <key>detached</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>unbuffered</key>
+ <value>False</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(569, 124)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <connection>
+ <source_block_id>gr_sig_source_x_0</source_block_id>
+ <sink_block_id>gr_head_0</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>uhd_usrp_source_0</source_block_id>
+ <sink_block_id>gr_head_0</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>gr_head_0</source_block_id>
+ <sink_block_id>blocks_file_meta_sink_0</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+</flow_graph>
diff --git a/gr-blocks/examples/metadata/file_metadata_source.grc b/gr-blocks/examples/metadata/file_metadata_source.grc
new file mode 100644
index 000000000..23757881b
--- /dev/null
+++ b/gr-blocks/examples/metadata/file_metadata_source.grc
@@ -0,0 +1,350 @@
+<?xml version='1.0' encoding='ASCII'?>
+<flow_graph>
+ <timestamp>Fri Dec 14 17:08:09 2012</timestamp>
+ <block>
+ <key>options</key>
+ <param>
+ <key>id</key>
+ <value>file_metadata_source</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>title</key>
+ <value></value>
+ </param>
+ <param>
+ <key>author</key>
+ <value></value>
+ </param>
+ <param>
+ <key>description</key>
+ <value></value>
+ </param>
+ <param>
+ <key>window_size</key>
+ <value>1280, 1024</value>
+ </param>
+ <param>
+ <key>generate_options</key>
+ <value>qt_gui</value>
+ </param>
+ <param>
+ <key>category</key>
+ <value>Custom</value>
+ </param>
+ <param>
+ <key>run_options</key>
+ <value>prompt</value>
+ </param>
+ <param>
+ <key>run</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>max_nouts</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>realtime_scheduling</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(10, 10)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable</key>
+ <param>
+ <key>id</key>
+ <value>samp_rate</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>200000</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(208, 11)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>gr_tag_debug</key>
+ <param>
+ <key>id</key>
+ <value>gr_tag_debug_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>complex</value>
+ </param>
+ <param>
+ <key>name</key>
+ <value>Test</value>
+ </param>
+ <param>
+ <key>num_inputs</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>vlen</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>display</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(561, 290)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>analog_agc2_xx</key>
+ <param>
+ <key>id</key>
+ <value>analog_agc2_xx_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>complex</value>
+ </param>
+ <param>
+ <key>attack_rate</key>
+ <value>1e-1</value>
+ </param>
+ <param>
+ <key>decay_rate</key>
+ <value>1e-2</value>
+ </param>
+ <param>
+ <key>reference</key>
+ <value>1.0</value>
+ </param>
+ <param>
+ <key>gain</key>
+ <value>1.0</value>
+ </param>
+ <param>
+ <key>max_gain</key>
+ <value>0.0</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(561, 82)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>qtgui_time_sink_x</key>
+ <param>
+ <key>id</key>
+ <value>qtgui_time_sink_x_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>complex</value>
+ </param>
+ <param>
+ <key>name</key>
+ <value>QT GUI Plot</value>
+ </param>
+ <param>
+ <key>size</key>
+ <value>1024</value>
+ </param>
+ <param>
+ <key>bw</key>
+ <value>samp_rate</value>
+ </param>
+ <param>
+ <key>nconnections</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>gui_hint</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(776, 98)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>gr_file_sink</key>
+ <param>
+ <key>id</key>
+ <value>gr_file_sink_1</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>file</key>
+ <value>/tmp/received_data.out</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>complex</value>
+ </param>
+ <param>
+ <key>vlen</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>unbuffered</key>
+ <value>False</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(564, 215)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>gr_throttle</key>
+ <param>
+ <key>id</key>
+ <value>gr_throttle_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>complex</value>
+ </param>
+ <param>
+ <key>samples_per_second</key>
+ <value>samp_rate</value>
+ </param>
+ <param>
+ <key>vlen</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(322, 222)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>blocks_file_meta_source</key>
+ <param>
+ <key>id</key>
+ <value>blocks_file_meta_source_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>complex</value>
+ </param>
+ <param>
+ <key>file</key>
+ <value>/tmp/metadat_file.out</value>
+ </param>
+ <param>
+ <key>repeat</key>
+ <value>False</value>
+ </param>
+ <param>
+ <key>detached</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>hdr_file</key>
+ <value></value>
+ </param>
+ <param>
+ <key>vlen</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(50, 198)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <connection>
+ <source_block_id>gr_throttle_0</source_block_id>
+ <sink_block_id>gr_file_sink_1</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>gr_throttle_0</source_block_id>
+ <sink_block_id>gr_tag_debug_0</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>gr_throttle_0</source_block_id>
+ <sink_block_id>analog_agc2_xx_0</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>analog_agc2_xx_0</source_block_id>
+ <sink_block_id>qtgui_time_sink_x_0</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>blocks_file_meta_source_0</source_block_id>
+ <sink_block_id>gr_throttle_0</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+</flow_graph>
diff --git a/gr-blocks/examples/metadata/file_metadata_vector_sink.grc b/gr-blocks/examples/metadata/file_metadata_vector_sink.grc
new file mode 100644
index 000000000..05b7cbc92
--- /dev/null
+++ b/gr-blocks/examples/metadata/file_metadata_vector_sink.grc
@@ -0,0 +1,219 @@
+<?xml version='1.0' encoding='ASCII'?>
+<flow_graph>
+ <timestamp>Fri Dec 14 17:08:29 2012</timestamp>
+ <block>
+ <key>options</key>
+ <param>
+ <key>id</key>
+ <value>file_metadata_vector_sink</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>title</key>
+ <value></value>
+ </param>
+ <param>
+ <key>author</key>
+ <value></value>
+ </param>
+ <param>
+ <key>description</key>
+ <value></value>
+ </param>
+ <param>
+ <key>window_size</key>
+ <value>1280, 1024</value>
+ </param>
+ <param>
+ <key>generate_options</key>
+ <value>no_gui</value>
+ </param>
+ <param>
+ <key>category</key>
+ <value>Custom</value>
+ </param>
+ <param>
+ <key>run_options</key>
+ <value>run</value>
+ </param>
+ <param>
+ <key>run</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>max_nouts</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>realtime_scheduling</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(10, 10)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable</key>
+ <param>
+ <key>id</key>
+ <value>samp_rate</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>200000</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(208, 11)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>gr_vector_source_x</key>
+ <param>
+ <key>id</key>
+ <value>gr_vector_source_x_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>complex</value>
+ </param>
+ <param>
+ <key>vector</key>
+ <value>10*[0,1,2,3,4,5,6,7,8,9]</value>
+ </param>
+ <param>
+ <key>repeat</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>vlen</key>
+ <value>10</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(67, 100)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>gr_head</key>
+ <param>
+ <key>id</key>
+ <value>gr_head_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>complex</value>
+ </param>
+ <param>
+ <key>num_items</key>
+ <value>10010000</value>
+ </param>
+ <param>
+ <key>vlen</key>
+ <value>10</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(325, 108)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>blocks_file_meta_sink</key>
+ <param>
+ <key>id</key>
+ <value>blocks_file_meta_sink_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>file</key>
+ <value>/tmp/metadat_vector.out</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>complex</value>
+ </param>
+ <param>
+ <key>samp_rate</key>
+ <value>samp_rate</value>
+ </param>
+ <param>
+ <key>rel_rate</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>vlen</key>
+ <value>10</value>
+ </param>
+ <param>
+ <key>max_seg_size</key>
+ <value>1000000</value>
+ </param>
+ <param>
+ <key>extra_dict</key>
+ <value>""</value>
+ </param>
+ <param>
+ <key>detached</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>unbuffered</key>
+ <value>False</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(544, 60)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <connection>
+ <source_block_id>gr_vector_source_x_0</source_block_id>
+ <sink_block_id>gr_head_0</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>gr_head_0</source_block_id>
+ <sink_block_id>blocks_file_meta_sink_0</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+</flow_graph>
diff --git a/gr-blocks/examples/metadata/file_metadata_vector_source.grc b/gr-blocks/examples/metadata/file_metadata_vector_source.grc
new file mode 100644
index 000000000..d52257e06
--- /dev/null
+++ b/gr-blocks/examples/metadata/file_metadata_vector_source.grc
@@ -0,0 +1,338 @@
+<?xml version='1.0' encoding='ASCII'?>
+<flow_graph>
+ <timestamp>Fri Dec 14 17:11:02 2012</timestamp>
+ <block>
+ <key>options</key>
+ <param>
+ <key>id</key>
+ <value>file_metadata_vector_source</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>title</key>
+ <value></value>
+ </param>
+ <param>
+ <key>author</key>
+ <value></value>
+ </param>
+ <param>
+ <key>description</key>
+ <value></value>
+ </param>
+ <param>
+ <key>window_size</key>
+ <value>1280, 1024</value>
+ </param>
+ <param>
+ <key>generate_options</key>
+ <value>qt_gui</value>
+ </param>
+ <param>
+ <key>category</key>
+ <value>Custom</value>
+ </param>
+ <param>
+ <key>run_options</key>
+ <value>prompt</value>
+ </param>
+ <param>
+ <key>run</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>max_nouts</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>realtime_scheduling</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(10, 10)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable</key>
+ <param>
+ <key>id</key>
+ <value>samp_rate</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>200000</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(208, 11)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>gr_file_sink</key>
+ <param>
+ <key>id</key>
+ <value>gr_file_sink_1</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>file</key>
+ <value>/tmp/received_data.out</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>complex</value>
+ </param>
+ <param>
+ <key>vlen</key>
+ <value>10</value>
+ </param>
+ <param>
+ <key>unbuffered</key>
+ <value>False</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(564, 215)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>gr_tag_debug</key>
+ <param>
+ <key>id</key>
+ <value>gr_tag_debug_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>complex</value>
+ </param>
+ <param>
+ <key>name</key>
+ <value>Test</value>
+ </param>
+ <param>
+ <key>num_inputs</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>vlen</key>
+ <value>10</value>
+ </param>
+ <param>
+ <key>display</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(563, 298)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>qtgui_time_sink_x</key>
+ <param>
+ <key>id</key>
+ <value>qtgui_time_sink_x_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>complex</value>
+ </param>
+ <param>
+ <key>name</key>
+ <value>QT GUI Plot</value>
+ </param>
+ <param>
+ <key>size</key>
+ <value>1024</value>
+ </param>
+ <param>
+ <key>bw</key>
+ <value>samp_rate</value>
+ </param>
+ <param>
+ <key>nconnections</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>gui_hint</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(746, 116)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>blocks_vector_to_stream</key>
+ <param>
+ <key>id</key>
+ <value>blocks_vector_to_stream_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>complex</value>
+ </param>
+ <param>
+ <key>num_items</key>
+ <value>10</value>
+ </param>
+ <param>
+ <key>vlen</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(526, 132)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>gr_throttle</key>
+ <param>
+ <key>id</key>
+ <value>gr_throttle_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>complex</value>
+ </param>
+ <param>
+ <key>samples_per_second</key>
+ <value>samp_rate</value>
+ </param>
+ <param>
+ <key>vlen</key>
+ <value>10</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(322, 223)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>blocks_file_meta_source</key>
+ <param>
+ <key>id</key>
+ <value>blocks_file_meta_source_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>complex</value>
+ </param>
+ <param>
+ <key>file</key>
+ <value>/tmp/metadat_vector.out</value>
+ </param>
+ <param>
+ <key>repeat</key>
+ <value>False</value>
+ </param>
+ <param>
+ <key>detached</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>hdr_file</key>
+ <value></value>
+ </param>
+ <param>
+ <key>vlen</key>
+ <value>10</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(42, 199)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <connection>
+ <source_block_id>gr_throttle_0</source_block_id>
+ <sink_block_id>gr_file_sink_1</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>gr_throttle_0</source_block_id>
+ <sink_block_id>gr_tag_debug_0</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>blocks_vector_to_stream_0</source_block_id>
+ <sink_block_id>qtgui_time_sink_x_0</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>gr_throttle_0</source_block_id>
+ <sink_block_id>blocks_vector_to_stream_0</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>blocks_file_meta_source_0</source_block_id>
+ <sink_block_id>gr_throttle_0</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+</flow_graph>
diff --git a/gr-blocks/gnuradio-blocks.pc.in b/gr-blocks/gnuradio-blocks.pc.in
new file mode 100644
index 000000000..c24564157
--- /dev/null
+++ b/gr-blocks/gnuradio-blocks.pc.in
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: gnuradio-blocks
+Description: GNU Radio basic block library
+Requires: gnuradio-core
+Version: @LIBVER@
+Libs: -L${libdir} -lgnuradio-blocks
+Cflags: -I${includedir}
diff --git a/gr-blocks/grc/CMakeLists.txt b/gr-blocks/grc/CMakeLists.txt
new file mode 100644
index 000000000..ed66d9e3b
--- /dev/null
+++ b/gr-blocks/grc/CMakeLists.txt
@@ -0,0 +1,22 @@
+# 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.
+
+########################################################################
+file(GLOB xml_files "*.xml")
+install(FILES ${xml_files} DESTINATION ${GRC_BLOCKS_DIR} COMPONENT "blocks_python")
diff --git a/gr-blocks/grc/blocks_add_const_vxx.xml b/gr-blocks/grc/blocks_add_const_vxx.xml
new file mode 100644
index 000000000..96303acef
--- /dev/null
+++ b/gr-blocks/grc/blocks_add_const_vxx.xml
@@ -0,0 +1,67 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Add Const Block:
+## all types, 1 output, 1 input & const
+###################################################
+ -->
+<block>
+ <name>Add Const</name>
+ <key>blocks_add_const_vxx</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.add_const_v$(type.fcn)($const)</make>
+ <callback>set_k($const)</callback>
+ <param>
+ <name>IO Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>const_type:complex_vector</opt>
+ <opt>fcn:cc</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>const_type:real_vector</opt>
+ <opt>fcn:ff</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>const_type:int_vector</opt>
+ <opt>fcn:ii</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>const_type:int_vector</opt>
+ <opt>fcn:ss</opt>
+ </option>
+ </param>
+ <param>
+ <name>Constant</name>
+ <key>const</key>
+ <value>0</value>
+ <type>$type.const_type</type>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>len($const) == $vlen</check>
+ <check>$vlen &gt; 0</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </source>
+</block>
diff --git a/gr-blocks/grc/blocks_add_xx.xml b/gr-blocks/grc/blocks_add_xx.xml
new file mode 100644
index 000000000..951dff5e5
--- /dev/null
+++ b/gr-blocks/grc/blocks_add_xx.xml
@@ -0,0 +1,63 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Add Block:
+## all types, 1 output, 2 to inf inputs
+###################################################
+ -->
+<block>
+ <name>Add</name>
+ <key>blocks_add_xx</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.add_v$(type.fcn)($vlen)</make>
+ <param>
+ <name>IO Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>fcn:cc</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>fcn:ff</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>fcn:ii</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>fcn:ss</opt>
+ </option>
+ </param>
+ <param>
+ <name>Num Inputs</name>
+ <key>num_inputs</key>
+ <value>2</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$num_inputs &gt; 1</check>
+ <check>$vlen &gt; 0</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ <nports>$num_inputs</nports>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </source>
+</block>
diff --git a/gr-blocks/grc/blocks_and_const_xx.xml b/gr-blocks/grc/blocks_and_const_xx.xml
new file mode 100644
index 000000000..d0abbfe51
--- /dev/null
+++ b/gr-blocks/grc/blocks_and_const_xx.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+## And Const Block:
+## all types, 1 output, 1 input & const
+###################################################
+ -->
+<block>
+ <name>And Const</name>
+ <key>blocks_and_const_xx</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.and_const_$(type.fcn)($const)</make>
+ <callback>set_k($const)</callback>
+ <param>
+ <name>IO Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>fcn:ii</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>fcn:ss</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>fcn:bb</opt>
+ </option>
+ </param>
+ <param>
+ <name>Constant</name>
+ <key>const</key>
+ <value>0</value>
+ <type>int</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ </source>
+</block>
diff --git a/gr-blocks/grc/blocks_and_xx.xml b/gr-blocks/grc/blocks_and_xx.xml
new file mode 100644
index 000000000..317a0f645
--- /dev/null
+++ b/gr-blocks/grc/blocks_and_xx.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Logical And Block
+###################################################
+ -->
+<block>
+ <name>And</name>
+ <key>blocks_and_xx</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.and_$(type.fcn)()</make>
+ <param>
+ <name>IO Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>fcn:ii</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>fcn:ss</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>fcn:bb</opt>
+ </option>
+ </param>
+ <param>
+ <name>Num Inputs</name>
+ <key>num_inputs</key>
+ <value>2</value>
+ <type>int</type>
+ </param>
+ <check>$num_inputs &gt;= 2</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <nports>$num_inputs</nports>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ </source>
+</block>
diff --git a/gr-blocks/grc/blocks_block_tree.xml b/gr-blocks/grc/blocks_block_tree.xml
new file mode 100644
index 000000000..0077ec948
--- /dev/null
+++ b/gr-blocks/grc/blocks_block_tree.xml
@@ -0,0 +1,111 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+<!--
+###################################################
+##Block Tree for gr-blocks.
+###################################################
+ -->
+<cat>
+ <name></name> <!-- Blank for Root Name -->
+ <cat>
+ <name>Sources (New)</name>
+ <block>blocks_file_source</block>
+ <block>blocks_file_meta_source</block>
+ </cat>
+ <cat>
+ <name>Sinks (New)</name>
+ <block>blocks_file_meta_sink</block>
+ </cat>
+ <cat>
+ <name>Math Operations (New) </name>
+ <block>blocks_add_xx</block>
+ <block>blocks_add_const_vxx</block>
+ <block>blocks_divide_xx</block>
+ <block>blocks_multiply_xx</block>
+ <block>blocks_multiply_const_vxx</block>
+ <block>blocks_multiply_conjugate_cc</block>
+ <block>blocks_sub_xx</block>
+ <block>blocks_conjugate_cc</block>
+ <block>blocks_integrate_xx</block>
+ <block>blocks_nlog10_ff</block>
+ <block>blocks_rms_xx</block>
+ <block>blocks_transcendental</block>
+ </cat>
+ <cat>
+ <name>Boolean Operations (New) </name>
+ <block>blocks_and_xx</block>
+ <block>blocks_and_const_xx</block>
+ <block>blocks_not_xx</block>
+ <block>blocks_or_xx</block>
+ <block>blocks_xor_xx</block>
+ </cat>
+ <cat>
+ <name>Stream Type Conversions (New) </name>
+ <block>blocks_char_to_float</block>
+ <block>blocks_char_to_short</block>
+ <block>blocks_complex_to_interleaved_short</block>
+ <block>blocks_complex_to_float</block>
+ <block>blocks_complex_to_imag</block>
+ <block>blocks_complex_to_real</block>
+ <block>blocks_complex_to_mag</block>
+ <block>blocks_complex_to_mag_squared</block>
+ <block>blocks_complex_to_arg</block>
+ <block>blocks_float_to_char</block>
+ <block>blocks_float_to_complex</block>
+ <block>blocks_float_to_int</block>
+ <block>blocks_float_to_short</block>
+ <block>blocks_float_to_uchar</block>
+ <block>blocks_int_to_float</block>
+ <block>blocks_interleaved_short_to_complex</block>
+ <block>blocks_short_to_char</block>
+ <block>blocks_short_to_float</block>
+ <block>blocks_uchar_to_float</block>
+ </cat>
+ <cat>
+ <name>Stream Operations (New) </name>
+ <block>blocks_delay</block>
+ <block>blocks_packed_to_unpacked_xx</block>
+ <block>blocks_unpacked_to_packed_xx</block>
+ <block>blocks_deinterleave</block>
+ <block>blocks_interleave</block>
+ <block>blocks_keep_m_in_n</block>
+ <block>blocks_keep_one_in_n</block>
+ <block>blocks_repeat</block>
+ <block>blocks_stream_mux</block>
+ <block>blocks_stream_to_streams</block>
+ <block>blocks_stream_to_vector</block>
+ <block>blocks_streams_to_stream</block>
+ <block>blocks_streams_to_vector</block>
+ <block>blocks_vector_to_stream</block>
+ <block>blocks_vector_to_streams</block>
+ <block>blocks_peak_detector2_fb</block>
+ <block>blocks_regenerate_bb</block>
+ <block>blocks_stretch_ff</block>
+ <block>blocks_threshold_ff</block>
+ </cat>
+ <cat>
+ <name>Misc (New) </name>
+ <block>blocks_throttle</block>
+ </cat>
+</cat>
diff --git a/gr-blocks/grc/blocks_char_to_float.xml b/gr-blocks/grc/blocks_char_to_float.xml
new file mode 100644
index 000000000..5d367d719
--- /dev/null
+++ b/gr-blocks/grc/blocks_char_to_float.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Char to Float:
+###################################################
+ -->
+<block>
+ <name>Char To Float</name>
+ <key>blocks_char_to_float</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.char_to_float($vlen, $scale)</make>
+ <callback>set_scale($scale)</callback>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Scale</name>
+ <key>scale</key>
+ <value>1</value>
+ <type>real</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>byte</type>
+ <vlen>$vlen</vlen>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>float</type>
+ <vlen>$vlen</vlen>
+ </source>
+</block>
diff --git a/gr-blocks/grc/blocks_char_to_short.xml b/gr-blocks/grc/blocks_char_to_short.xml
new file mode 100644
index 000000000..b19fdb46a
--- /dev/null
+++ b/gr-blocks/grc/blocks_char_to_short.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Char to Short:
+###################################################
+ -->
+<block>
+ <name>Char To Short</name>
+ <key>blocks_char_to_short</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.char_to_short($vlen)</make>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>byte</type>
+ <vlen>$vlen</vlen>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>short</type>
+ <vlen>$vlen</vlen>
+ </source>
+</block>
diff --git a/gr-blocks/grc/blocks_complex_to_arg.xml b/gr-blocks/grc/blocks_complex_to_arg.xml
new file mode 100644
index 000000000..83140501d
--- /dev/null
+++ b/gr-blocks/grc/blocks_complex_to_arg.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Complex to Arg
+###################################################
+ -->
+<block>
+ <name>Complex to Arg</name>
+ <key>blocks_complex_to_arg</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.complex_to_arg($vlen)</make>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$vlen &gt; 0</check>
+ <sink>
+ <name>in</name>
+ <type>complex</type>
+ <vlen>$vlen</vlen>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>float</type>
+ <vlen>$vlen</vlen>
+ </source>
+</block>
diff --git a/gr-blocks/grc/blocks_complex_to_float.xml b/gr-blocks/grc/blocks_complex_to_float.xml
new file mode 100644
index 000000000..7acf3fccb
--- /dev/null
+++ b/gr-blocks/grc/blocks_complex_to_float.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Complex to Float:
+## one or two output streams
+###################################################
+ -->
+<block>
+ <name>Complex To Float</name>
+ <key>blocks_complex_to_float</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.complex_to_float($vlen)</make>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$vlen &gt; 0</check>
+ <sink>
+ <name>in</name>
+ <type>complex</type>
+ <vlen>$vlen</vlen>
+ </sink>
+ <source>
+ <name>re</name>
+ <type>float</type>
+ <vlen>$vlen</vlen>
+ </source>
+ <source>
+ <name>im</name>
+ <type>float</type>
+ <vlen>$vlen</vlen>
+ <optional>1</optional>
+ </source>
+</block>
diff --git a/gr-blocks/grc/blocks_complex_to_imag.xml b/gr-blocks/grc/blocks_complex_to_imag.xml
new file mode 100644
index 000000000..cb2c2019f
--- /dev/null
+++ b/gr-blocks/grc/blocks_complex_to_imag.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Complex to Imaginary
+###################################################
+ -->
+<block>
+ <name>Complex to Imag</name>
+ <key>blocks_complex_to_imag</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.complex_to_imag($vlen)</make>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$vlen &gt; 0</check>
+ <sink>
+ <name>in</name>
+ <type>complex</type>
+ <vlen>$vlen</vlen>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>float</type>
+ <vlen>$vlen</vlen>
+ </source>
+</block>
diff --git a/gr-blocks/grc/blocks_complex_to_interleaved_short.xml b/gr-blocks/grc/blocks_complex_to_interleaved_short.xml
new file mode 100644
index 000000000..43b55f32a
--- /dev/null
+++ b/gr-blocks/grc/blocks_complex_to_interleaved_short.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Complex to Interleaved Short:
+###################################################
+ -->
+<block>
+ <name>Complex To IShort</name>
+ <key>blocks_complex_to_interleaved_short</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.complex_to_interleaved_short()</make>
+ <sink>
+ <name>in</name>
+ <type>complex</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>short</type>
+ </source>
+</block>
diff --git a/gr-blocks/grc/blocks_complex_to_mag.xml b/gr-blocks/grc/blocks_complex_to_mag.xml
new file mode 100644
index 000000000..2aa4faee7
--- /dev/null
+++ b/gr-blocks/grc/blocks_complex_to_mag.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Complex to Magnitude
+###################################################
+ -->
+<block>
+ <name>Complex to Mag</name>
+ <key>blocks_complex_to_mag</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.complex_to_mag($vlen)</make>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$vlen &gt; 0</check>
+ <sink>
+ <name>in</name>
+ <type>complex</type>
+ <vlen>$vlen</vlen>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>float</type>
+ <vlen>$vlen</vlen>
+ </source>
+</block>
diff --git a/gr-blocks/grc/blocks_complex_to_mag_squared.xml b/gr-blocks/grc/blocks_complex_to_mag_squared.xml
new file mode 100644
index 000000000..ee2270fec
--- /dev/null
+++ b/gr-blocks/grc/blocks_complex_to_mag_squared.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Complex to Magnitude Squared
+###################################################
+ -->
+<block>
+ <name>Complex to Mag^2</name>
+ <key>blocks_complex_to_mag_squared</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.complex_to_mag_squared($vlen)</make>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$vlen &gt; 0</check>
+ <sink>
+ <name>in</name>
+ <type>complex</type>
+ <vlen>$vlen</vlen>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>float</type>
+ <vlen>$vlen</vlen>
+ </source>
+</block>
diff --git a/gr-blocks/grc/blocks_complex_to_real.xml b/gr-blocks/grc/blocks_complex_to_real.xml
new file mode 100644
index 000000000..6737f1da3
--- /dev/null
+++ b/gr-blocks/grc/blocks_complex_to_real.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Complex to Real:
+## one or two output streams
+###################################################
+ -->
+<block>
+ <name>Complex To Real</name>
+ <key>blocks_complex_to_real</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.complex_to_real($vlen)</make>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$vlen &gt; 0</check>
+ <sink>
+ <name>in</name>
+ <type>complex</type>
+ <vlen>$vlen</vlen>
+ </sink>
+ <source>
+ <name>re</name>
+ <type>float</type>
+ <vlen>$vlen</vlen>
+ </source>
+</block>
diff --git a/gr-blocks/grc/blocks_conjugate_cc.xml b/gr-blocks/grc/blocks_conjugate_cc.xml
new file mode 100644
index 000000000..152f797b2
--- /dev/null
+++ b/gr-blocks/grc/blocks_conjugate_cc.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Complex Conjugate
+###################################################
+ -->
+<block>
+ <name>Complex Conjugate</name>
+ <key>blocks_conjugate_cc</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.conjugate_cc()</make>
+ <sink>
+ <name>in</name>
+ <type>complex</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>complex</type>
+ </source>
+</block>
diff --git a/gr-blocks/grc/blocks_deinterleave.xml b/gr-blocks/grc/blocks_deinterleave.xml
new file mode 100644
index 000000000..103091324
--- /dev/null
+++ b/gr-blocks/grc/blocks_deinterleave.xml
@@ -0,0 +1,67 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Deinterleave
+###################################################
+ -->
+<block>
+ <name>Deinterleave</name>
+ <key>blocks_deinterleave</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.deinterleave($type.size*$vlen)</make>
+ <param>
+ <name>IO Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>size:blocks.sizeof_blocks_complex</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>size:blocks.sizeof_float</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>size:blocks.sizeof_int</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>size:blocks.sizeof_short</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>size:blocks.sizeof_char</opt>
+ </option>
+ </param>
+ <param>
+ <name>Num Streams</name>
+ <key>num_streams</key>
+ <value>2</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$num_streams &gt; 0</check>
+ <check>$vlen &gt;= 1</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ <nports>$num_streams</nports>
+ </source>
+</block>
diff --git a/gr-blocks/grc/blocks_delay.xml b/gr-blocks/grc/blocks_delay.xml
new file mode 100644
index 000000000..a7c48c4dc
--- /dev/null
+++ b/gr-blocks/grc/blocks_delay.xml
@@ -0,0 +1,75 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Delay
+###################################################
+ -->
+<block>
+ <name>Delay</name>
+ <key>blocks_delay</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.delay($type.size*$vlen, $delay)</make>
+ <callback>set_dly($delay)</callback>
+ <param>
+ <name>Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>size:gr.sizeof_gr_complex</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>size:gr.sizeof_float</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>size:gr.sizeof_int</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>size:gr.sizeof_short</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>size:gr.sizeof_char</opt>
+ </option>
+ </param>
+ <param>
+ <name>Delay</name>
+ <key>delay</key>
+ <value>0</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Num Ports</name>
+ <key>num_ports</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$num_ports &gt; 0</check>
+ <check>$vlen &gt; 0</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ <nports>$num_ports</nports>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ <nports>$num_ports</nports>
+ </source>
+</block>
diff --git a/gr-blocks/grc/blocks_divide_XX.xml b/gr-blocks/grc/blocks_divide_XX.xml
new file mode 100644
index 000000000..d784d305d
--- /dev/null
+++ b/gr-blocks/grc/blocks_divide_XX.xml
@@ -0,0 +1,63 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Divide Block:
+## all types, 1 output, 2 to inf inputs
+###################################################
+ -->
+<block>
+ <name>Divide</name>
+ <key>blocks_divide_xx</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.divide_$(type.fcn)($vlen)</make>
+ <param>
+ <name>IO Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>fcn:cc</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>fcn:ff</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>fcn:ii</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>fcn:ss</opt>
+ </option>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Num Inputs</name>
+ <key>num_inputs</key>
+ <value>2</value>
+ <type>int</type>
+ </param>
+ <check>$vlen &gt; 0</check>
+ <check>$num_inputs &gt;= 2</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ <nports>$num_inputs</nports>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </source>
+</block>
diff --git a/gr-blocks/grc/blocks_file_meta_sink.xml b/gr-blocks/grc/blocks_file_meta_sink.xml
new file mode 100644
index 000000000..f6490d507
--- /dev/null
+++ b/gr-blocks/grc/blocks_file_meta_sink.xml
@@ -0,0 +1,124 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##File Meta Sink
+###################################################
+ -->
+<block>
+ <name>File Meta Sink</name>
+ <key>blocks_file_meta_sink</key>
+ <import>from gnuradio import gr, blocks</import>
+ <make>blocks.file_meta_sink($type.size*$vlen, $file, $samp_rate, $rel_rate, $type.dtype, $type.cplx, $max_seg_size, $extra_dict, $detached)
+self.$(id).set_unbuffered($unbuffered)</make>
+ <callback>set_unbuffered($unbuffered)</callback>
+ <callback>open($file)</callback>
+ <param>
+ <name>File</name>
+ <key>file</key>
+ <value></value>
+ <type>file_save</type>
+ </param>
+ <param>
+ <name>Input Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>size:gr.sizeof_gr_complex</opt>
+ <opt>dtype:blocks.GR_FILE_FLOAT</opt>
+ <opt>cplx:True</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>size:gr.sizeof_float</opt>
+ <opt>dtype:blocks.GR_FILE_FLOAT</opt>
+ <opt>cplx:False</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>size:gr.sizeof_int</opt>
+ <opt>dtype:blocks.GR_FILE_INT</opt>
+ <opt>cplx:False</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>size:gr.sizeof_short</opt>
+ <opt>dtype:blocks.GR_FILE_SHORT</opt>
+ <opt>cplx:False</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>size:gr.sizeof_char</opt>
+ <opt>dtype:blocks.GR_FILE_BYTE</opt>
+ <opt>cplx:False</opt>
+ </option>
+ </param>
+ <param>
+ <name>Sample Rate</name>
+ <key>samp_rate</key>
+ <value>samp_rate</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Relative Rate Change</name>
+ <key>rel_rate</key>
+ <value>1</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Max Seg. Size</name>
+ <key>max_seg_size</key>
+ <value>1000000</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Extra Dict.</name>
+ <key>extra_dict</key>
+ <value>""</value>
+ <type>string</type>
+ </param>
+ <param>
+ <name>Detached</name>
+ <key>detached</key>
+ <value>False</value>
+ <type>bool</type>
+ <option>
+ <name>Off</name>
+ <key>False</key>
+ </option>
+ <option>
+ <name>On</name>
+ <key>True</key>
+ </option>
+ </param> <param>
+ <name>Unbuffered</name>
+ <key>unbuffered</key>
+ <value>False</value>
+ <type>bool</type>
+ <option>
+ <name>Off</name>
+ <key>False</key>
+ </option>
+ <option>
+ <name>On</name>
+ <key>True</key>
+ </option>
+ </param>
+ <check>$vlen &gt; 0</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </sink>
+</block>
diff --git a/gr-blocks/grc/blocks_file_meta_source.xml b/gr-blocks/grc/blocks_file_meta_source.xml
new file mode 100644
index 000000000..aa7e34955
--- /dev/null
+++ b/gr-blocks/grc/blocks_file_meta_source.xml
@@ -0,0 +1,94 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##File Source
+###################################################
+ -->
+<block>
+ <name>File Meta Source</name>
+ <key>blocks_file_meta_source</key>
+ <import>from gnuradio import gr, blocks</import>
+ <make>blocks.file_meta_source($file, $repeat, $detached, $hdr_file)</make>
+ <callback>open($file, $repeat)</callback>
+ <param>
+ <name>Output Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>size:gr.sizeof_gr_complex</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>size:gr.sizeof_float</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>size:gr.sizeof_int</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>size:gr.sizeof_short</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>size:gr.sizeof_char</opt>
+ </option>
+ </param>
+ <param>
+ <name>File</name>
+ <key>file</key>
+ <value></value>
+ <type>file_open</type>
+ </param>
+ <param>
+ <name>Repeat</name>
+ <key>repeat</key>
+ <value>True</value>
+ <type>enum</type>
+ <option>
+ <name>Yes</name>
+ <key>True</key>
+ </option>
+ <option>
+ <name>No</name>
+ <key>False</key>
+ </option>
+ </param>
+ <param>
+ <name>Detached Header</name>
+ <key>detached</key>
+ <value>False</value>
+ <type>enum</type>
+ <option>
+ <name>Yes</name>
+ <key>True</key>
+ </option>
+ <option>
+ <name>No</name>
+ <key>False</key>
+ </option>
+ </param>
+ <param>
+ <name>Header File</name>
+ <key>hdr_file</key>
+ <value></value>
+ <type>file_open</type>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </source>
+</block>
diff --git a/gr-blocks/grc/blocks_file_source.xml b/gr-blocks/grc/blocks_file_source.xml
new file mode 100644
index 000000000..7ac573f2d
--- /dev/null
+++ b/gr-blocks/grc/blocks_file_source.xml
@@ -0,0 +1,75 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##File Source
+###################################################
+ -->
+<block>
+ <name>File Source</name>
+ <key>blocks_file_source</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.file_source($type.size*$vlen, $file, $repeat)</make>
+ <callback>open($file, $repeat)</callback>
+ <param>
+ <name>File</name>
+ <key>file</key>
+ <value></value>
+ <type>file_open</type>
+ </param>
+ <param>
+ <name>Output Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>size:gr.sizeof_gr_complex</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>size:gr.sizeof_float</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>size:gr.sizeof_int</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>size:gr.sizeof_short</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>size:gr.sizeof_char</opt>
+ </option>
+ </param>
+ <param>
+ <name>Repeat</name>
+ <key>repeat</key>
+ <value>True</value>
+ <type>enum</type>
+ <option>
+ <name>Yes</name>
+ <key>True</key>
+ </option>
+ <option>
+ <name>No</name>
+ <key>False</key>
+ </option>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$vlen &gt; 0</check>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </source>
+</block>
diff --git a/gr-blocks/grc/blocks_float_to_char.xml b/gr-blocks/grc/blocks_float_to_char.xml
new file mode 100644
index 000000000..e3854fc4e
--- /dev/null
+++ b/gr-blocks/grc/blocks_float_to_char.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Float to Char:
+###################################################
+ -->
+<block>
+ <name>Float To Char</name>
+ <key>blocks_float_to_char</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.float_to_char($vlen, $scale)</make>
+ <callback>set_scale($scale)</callback>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Scale</name>
+ <key>scale</key>
+ <value>1</value>
+ <type>real</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>float</type>
+ <vlen>$vlen</vlen>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>byte</type>
+ <vlen>$vlen</vlen>
+ </source>
+</block>
diff --git a/gr-blocks/grc/blocks_float_to_complex.xml b/gr-blocks/grc/blocks_float_to_complex.xml
new file mode 100644
index 000000000..6120d5887
--- /dev/null
+++ b/gr-blocks/grc/blocks_float_to_complex.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Float to Complex:
+## one or two input streams
+###################################################
+ -->
+<block>
+ <name>Float To Complex</name>
+ <key>blocks_float_to_complex</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.float_to_complex($vlen)</make>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$vlen &gt; 0</check>
+ <sink>
+ <name>re</name>
+ <type>float</type>
+ <vlen>$vlen</vlen>
+ </sink>
+ <sink>
+ <name>im</name>
+ <type>float</type>
+ <vlen>$vlen</vlen>
+ <optional>1</optional>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>complex</type>
+ <vlen>$vlen</vlen>
+ </source>
+</block>
diff --git a/gr-blocks/grc/blocks_float_to_int.xml b/gr-blocks/grc/blocks_float_to_int.xml
new file mode 100644
index 000000000..0ff5d9cdf
--- /dev/null
+++ b/gr-blocks/grc/blocks_float_to_int.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Float to Int:
+###################################################
+ -->
+<block>
+ <name>Float To Int</name>
+ <key>blocks_float_to_int</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.float_to_int($vlen, $scale)</make>
+ <callback>set_scale($scale)</callback>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Scale</name>
+ <key>scale</key>
+ <value>1</value>
+ <type>real</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>float</type>
+ <vlen>$vlen</vlen>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>int</type>
+ <vlen>$vlen</vlen>
+ </source>
+</block>
diff --git a/gr-blocks/grc/blocks_float_to_short.xml b/gr-blocks/grc/blocks_float_to_short.xml
new file mode 100644
index 000000000..986e68ec4
--- /dev/null
+++ b/gr-blocks/grc/blocks_float_to_short.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Float to Short:
+###################################################
+ -->
+<block>
+ <name>Float To Short</name>
+ <key>blocks_float_to_short</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.float_to_short($vlen, $scale)</make>
+ <callback>set_scale($scale)</callback>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Scale</name>
+ <key>scale</key>
+ <value>1</value>
+ <type>real</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>float</type>
+ <vlen>$vlen</vlen>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>short</type>
+ <vlen>$vlen</vlen>
+ </source>
+</block>
diff --git a/gr-blocks/grc/blocks_float_uchar.xml b/gr-blocks/grc/blocks_float_uchar.xml
new file mode 100644
index 000000000..d190eafcf
--- /dev/null
+++ b/gr-blocks/grc/blocks_float_uchar.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Float to Unsigned Char:
+###################################################
+ -->
+<block>
+ <name>Float To UChar</name>
+ <key>blocks_float_to_uchar</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.float_to_uchar()</make>
+ <sink>
+ <name>in</name>
+ <type>float</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>byte</type>
+ </source>
+</block>
diff --git a/gr-blocks/grc/blocks_int_to_float.xml b/gr-blocks/grc/blocks_int_to_float.xml
new file mode 100644
index 000000000..2bb25d8be
--- /dev/null
+++ b/gr-blocks/grc/blocks_int_to_float.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Int to Float:
+###################################################
+ -->
+<block>
+ <name>Int To Float</name>
+ <key>blocks_int_to_float</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.int_to_float($vlen, $scale)</make>
+ <callback>set_scale($scale)</callback>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Scale</name>
+ <key>scale</key>
+ <value>1</value>
+ <type>real</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>int</type>
+ <vlen>$vlen</vlen>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>float</type>
+ <vlen>$vlen</vlen>
+ </source>
+</block>
diff --git a/gr-blocks/grc/blocks_integrate_xx.xml b/gr-blocks/grc/blocks_integrate_xx.xml
new file mode 100644
index 000000000..13c2ec3c8
--- /dev/null
+++ b/gr-blocks/grc/blocks_integrate_xx.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Integrate
+###################################################
+ -->
+<block>
+ <name>Integrate</name>
+ <key>blocks_integrate_xx</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.integrate_$(type.fcn)($decim)</make>
+ <param>
+ <name>IO Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>fcn:cc</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>fcn:ff</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>fcn:ii</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>fcn:ss</opt>
+ </option>
+ </param>
+ <param>
+ <name>Decimation</name>
+ <key>decim</key>
+ <type>int</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ </source>
+</block>
diff --git a/gr-blocks/grc/blocks_interleave.xml b/gr-blocks/grc/blocks_interleave.xml
new file mode 100644
index 000000000..f01a3be6d
--- /dev/null
+++ b/gr-blocks/grc/blocks_interleave.xml
@@ -0,0 +1,67 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Interleave
+###################################################
+ -->
+<block>
+ <name>Interleave</name>
+ <key>blocks_interleave</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.interleave($type.size*$vlen)</make>
+ <param>
+ <name>IO Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>size:gr.sizeof_gr_complex</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>size:gr.sizeof_float</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>size:gr.sizeof_int</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>size:gr.sizeof_short</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>size:gr.sizeof_char</opt>
+ </option>
+ </param>
+ <param>
+ <name>Num Streams</name>
+ <key>num_streams</key>
+ <value>2</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$num_streams &gt; 0</check>
+ <check>$vlen &gt;= 1</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ <nports>$num_streams</nports>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </source>
+</block>
diff --git a/gr-blocks/grc/blocks_interleaved_short_to_complex.xml b/gr-blocks/grc/blocks_interleaved_short_to_complex.xml
new file mode 100644
index 000000000..e44113e74
--- /dev/null
+++ b/gr-blocks/grc/blocks_interleaved_short_to_complex.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Interleaved Short to Complex:
+###################################################
+ -->
+<block>
+ <name>IShort To Complex</name>
+ <key>blocks_interleaved_short_to_complex</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.interleaved_short_to_complex()</make>
+ <sink>
+ <name>in</name>
+ <type>short</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>complex</type>
+ </source>
+</block>
diff --git a/gr-blocks/grc/blocks_keep_m_in_n.xml b/gr-blocks/grc/blocks_keep_m_in_n.xml
new file mode 100644
index 000000000..9e861749b
--- /dev/null
+++ b/gr-blocks/grc/blocks_keep_m_in_n.xml
@@ -0,0 +1,76 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Keep M in N
+###################################################
+ -->
+<block>
+ <name>Keep M in N</name>
+ <key>blocks_keep_m_in_n</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.keep_m_in_n($type.size, $m, $n, $offset)</make>
+ <callback>set_offset($offset)</callback>
+ <callback>set_m($m)</callback>
+ <callback>set_n($n)</callback>
+ <param>
+ <name>Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>size:gr.sizeof_gr_complex</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>size:gr.sizeof_float</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>size:gr.sizeof_int</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>size:gr.sizeof_short</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>size:gr.sizeof_char</opt>
+ </option>
+ </param>
+ <param>
+ <name>M</name>
+ <key>m</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>N</name>
+ <key>n</key>
+ <value>2</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>initial offset</name>
+ <key>offset</key>
+ <value>0</value>
+ <type>int</type>
+ </param>
+ <check>$n &gt; 0</check>
+ <check>$m &gt; 0</check>
+ <check>$m &lt; $n</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <vlen>1</vlen>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ <vlen>1</vlen>
+ </source>
+</block>
diff --git a/gr-blocks/grc/blocks_keep_one_in_n.xml b/gr-blocks/grc/blocks_keep_one_in_n.xml
new file mode 100644
index 000000000..4289a984f
--- /dev/null
+++ b/gr-blocks/grc/blocks_keep_one_in_n.xml
@@ -0,0 +1,67 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Keep 1 in N
+###################################################
+ -->
+<block>
+ <name>Keep 1 in N</name>
+ <key>blocks_keep_one_in_n</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.keep_one_in_n($type.size*$vlen, $n)</make>
+ <callback>set_n($n)</callback>
+ <param>
+ <name>Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>size:gr.sizeof_gr_complex</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>size:gr.sizeof_float</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>size:gr.sizeof_int</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>size:gr.sizeof_short</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>size:gr.sizeof_char</opt>
+ </option>
+ </param>
+ <param>
+ <name>N</name>
+ <key>n</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$n &gt; 0</check>
+ <check>$vlen &gt; 0</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </source>
+</block>
diff --git a/gr-blocks/grc/blocks_multiply_conjugate_cc.xml b/gr-blocks/grc/blocks_multiply_conjugate_cc.xml
new file mode 100644
index 000000000..cf0acf4d8
--- /dev/null
+++ b/gr-blocks/grc/blocks_multiply_conjugate_cc.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Multiply Conjugate Block:
+## 2 complex inputs, 1 complex output
+###################################################
+ -->
+<block>
+ <name>Multiply Conjugate</name>
+ <key>blocks_multiply_conjugate_cc</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.multiply_conjugate_cc($vlen)</make>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$vlen &gt; 0</check>
+ <sink>
+ <name>in0</name>
+ <type>complex</type>
+ <vlen>$vlen</vlen>
+ </sink>
+ <sink>
+ <name>in1</name>
+ <type>complex</type>
+ <vlen>$vlen</vlen>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>complex</type>
+ <vlen>$vlen</vlen>
+ </source>
+</block>
diff --git a/gr-blocks/grc/blocks_multiply_const_vxx.xml b/gr-blocks/grc/blocks_multiply_const_vxx.xml
new file mode 100644
index 000000000..6162621d3
--- /dev/null
+++ b/gr-blocks/grc/blocks_multiply_const_vxx.xml
@@ -0,0 +1,67 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Multiply Const Block:
+## all types, 1 output, 1 input & const
+###################################################
+ -->
+<block>
+ <name>Multiply Const</name>
+ <key>blocks_multiply_const_vxx</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.multiply_const_v$(type.fcn)($const)</make>
+ <callback>set_k($const)</callback>
+ <param>
+ <name>IO Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>const_type:complex_vector</opt>
+ <opt>fcn:cc</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>const_type:real_vector</opt>
+ <opt>fcn:ff</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>const_type:int_vector</opt>
+ <opt>fcn:ii</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>const_type:int_vector</opt>
+ <opt>fcn:ss</opt>
+ </option>
+ </param>
+ <param>
+ <name>Constant</name>
+ <key>const</key>
+ <value>0</value>
+ <type>$type.const_type</type>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>len($const) == $vlen</check>
+ <check>$vlen &gt; 0</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </source>
+</block>
diff --git a/gr-blocks/grc/blocks_multiply_xx.xml b/gr-blocks/grc/blocks_multiply_xx.xml
new file mode 100644
index 000000000..15f024142
--- /dev/null
+++ b/gr-blocks/grc/blocks_multiply_xx.xml
@@ -0,0 +1,63 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Multiply Block:
+## all types, 1 output, 2 to inf inputs
+###################################################
+ -->
+<block>
+ <name>Multiply</name>
+ <key>blocks_multiply_xx</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.multiply_v$(type.fcn)($vlen)</make>
+ <param>
+ <name>IO Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>fcn:cc</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>fcn:ff</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>fcn:ii</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>fcn:ss</opt>
+ </option>
+ </param>
+ <param>
+ <name>Num Inputs</name>
+ <key>num_inputs</key>
+ <value>2</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$num_inputs &gt; 1</check>
+ <check>$vlen &gt; 0</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ <nports>$num_inputs</nports>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </source>
+</block>
diff --git a/gr-blocks/grc/blocks_nlog10_ff.xml b/gr-blocks/grc/blocks_nlog10_ff.xml
new file mode 100644
index 000000000..884f4a444
--- /dev/null
+++ b/gr-blocks/grc/blocks_nlog10_ff.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Log10 Block:
+## float in/ float out
+###################################################
+ -->
+<block>
+ <name>Log10</name>
+ <key>blocks_nlog10_ff</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.nlog10_ff($n, $vlen, $k)</make>
+ <param>
+ <name>n</name>
+ <key>n</key>
+ <value>1</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>k</name>
+ <key>k</key>
+ <value>0</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$vlen >= 1</check>
+ <sink>
+ <name>in</name>
+ <type>float</type>
+ <vlen>$vlen</vlen>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>float</type>
+ <vlen>$vlen</vlen>
+ </source>
+</block>
diff --git a/gr-blocks/grc/blocks_not_xx.xml b/gr-blocks/grc/blocks_not_xx.xml
new file mode 100644
index 000000000..fe8916d8b
--- /dev/null
+++ b/gr-blocks/grc/blocks_not_xx.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Logical Not Block
+###################################################
+ -->
+<block>
+ <name>Not</name>
+ <key>blocks_not_xx</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.not_$(type.fcn)()</make>
+ <param>
+ <name>IO Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>fcn:ii</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>fcn:ss</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>fcn:bb</opt>
+ </option>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ </source>
+</block>
diff --git a/gr-blocks/grc/blocks_or_xx.xml b/gr-blocks/grc/blocks_or_xx.xml
new file mode 100644
index 000000000..400c09389
--- /dev/null
+++ b/gr-blocks/grc/blocks_or_xx.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Logical Or Block
+###################################################
+ -->
+<block>
+ <name>Or</name>
+ <key>blocks_or_xx</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.or_$(type.fcn)()</make>
+ <param>
+ <name>IO Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>fcn:ii</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>fcn:ss</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>fcn:bb</opt>
+ </option>
+ </param>
+ <param>
+ <name>Num Inputs</name>
+ <key>num_inputs</key>
+ <value>2</value>
+ <type>int</type>
+ </param>
+ <check>$num_inputs &gt;= 2</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <nports>$num_inputs</nports>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ </source>
+</block>
diff --git a/gr-blocks/grc/blocks_packed_to_unpacked_xx.xml b/gr-blocks/grc/blocks_packed_to_unpacked_xx.xml
new file mode 100644
index 000000000..b236a38db
--- /dev/null
+++ b/gr-blocks/grc/blocks_packed_to_unpacked_xx.xml
@@ -0,0 +1,68 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Packed to Unpacked
+###################################################
+ -->
+<block>
+ <name>Packed to Unpacked</name>
+ <key>blocks_packed_to_unpacked_xx</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.packed_to_unpacked_$(type.fcn)($bits_per_chunk, $endianness)</make>
+ <param>
+ <name>Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>fcn:ii</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>fcn:ss</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>fcn:bb</opt>
+ </option>
+ </param>
+ <param>
+ <name>Bits per Chunk</name>
+ <key>bits_per_chunk</key>
+ <value>2</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Endianness</name>
+ <key>endianness</key>
+ <type>int</type>
+ <option>
+ <name>MSB</name>
+ <key>gr.GR_MSB_FIRST</key>
+ </option>
+ <option>
+ <name>LSB</name>
+ <key>gr.GR_LSB_FIRST</key>
+ </option>
+ </param>
+ <param>
+ <name>Num Ports</name>
+ <key>num_ports</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$num_ports &gt; 0</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <nports>$num_ports</nports>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ <nports>$num_ports</nports>
+ </source>
+</block>
diff --git a/gr-blocks/grc/blocks_patterned_interleaver.xml b/gr-blocks/grc/blocks_patterned_interleaver.xml
new file mode 100644
index 000000000..8dd0fac41
--- /dev/null
+++ b/gr-blocks/grc/blocks_patterned_interleaver.xml
@@ -0,0 +1,66 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Vector to Stream
+###################################################
+ -->
+<block>
+ <name>Patterned Interleaver</name>
+ <key>blocks_patterned_interleaver</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.patterned_interleaver($type.size*$vlen, $pattern)</make>
+ <param>
+ <name>IO Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>size:gr.sizeof_gr_complex</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>size:gr.sizeof_float</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>size:gr.sizeof_int</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>size:gr.sizeof_short</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>size:gr.sizeof_char</opt>
+ </option>
+ </param>
+ <param>
+ <name>Pattern</name>
+ <key>pattern</key>
+ <value>[0,0,1,2]</value>
+ <type>int_vector</type>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$vlen &gt;= 1</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ <nports>1+max($pattern)</nports>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </source>
+</block>
diff --git a/gr-blocks/grc/blocks_peak_detector2_fb.xml b/gr-blocks/grc/blocks_peak_detector2_fb.xml
new file mode 100644
index 000000000..584e7a1fb
--- /dev/null
+++ b/gr-blocks/grc/blocks_peak_detector2_fb.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Peak Detector2
+###################################################
+ -->
+<block>
+ <name>Peak Detector2</name>
+ <key>blocks_peak_detector2_fb</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.peak_detector2_fb($threshold_factor_rise, $look_ahead, $alpha)</make>
+ <callback>set_threshold_factor_rise($threshold_factor_rise)</callback>
+ <callback>set_look_ahead($look_ahead)</callback>
+ <callback>set_alpha($alpha)</callback>
+ <param>
+ <name>TH Factor Rise</name>
+ <key>threshold_factor_rise</key>
+ <value>7</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Look Ahead</name>
+ <key>look_ahead</key>
+ <value>1000</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Alpha</name>
+ <key>alpha</key>
+ <value>0.001</value>
+ <type>real</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>float</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>byte</type>
+ </source>
+</block>
diff --git a/gr-blocks/grc/blocks_regenerate_bb.xml b/gr-blocks/grc/blocks_regenerate_bb.xml
new file mode 100644
index 000000000..bbee53387
--- /dev/null
+++ b/gr-blocks/grc/blocks_regenerate_bb.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Regenerate Block:
+## char in/ char out
+###################################################
+ -->
+<block>
+ <name>Regenerate</name>
+ <key>blocks_regenerate_bb</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.regenerate_bb($period, $max_regen)</make>
+ <param>
+ <name>Period</name>
+ <key>period</key>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Max Regen Count</name>
+ <key>max_regen</key>
+ <value>500</value>
+ <type>int</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>byte</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>byte</type>
+ </source>
+</block>
diff --git a/gr-blocks/grc/blocks_repeat.xml b/gr-blocks/grc/blocks_repeat.xml
new file mode 100644
index 000000000..c6c17c990
--- /dev/null
+++ b/gr-blocks/grc/blocks_repeat.xml
@@ -0,0 +1,64 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Repeat
+###################################################
+ -->
+<block>
+ <name>Repeat</name>
+ <key>blocks_repeat</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.repeat($type.size*$vlen, $interp)</make>
+ <param>
+ <name>Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>size:gr.sizeof_gr_complex</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>size:gr.sizeof_float</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>size:gr.sizeof_int</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>size:gr.sizeof_short</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>size:gr.sizeof_char</opt>
+ </option>
+ </param>
+ <param>
+ <name>Interpolation</name>
+ <key>interp</key>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$vlen &gt; 0</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </source>
+</block>
diff --git a/gr-blocks/grc/blocks_rms_xx.xml b/gr-blocks/grc/blocks_rms_xx.xml
new file mode 100644
index 000000000..0ae09139a
--- /dev/null
+++ b/gr-blocks/grc/blocks_rms_xx.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##RMS
+###################################################
+ -->
+<block>
+ <name>RMS</name>
+ <key>blocks_rms_xx</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.rms_$(type.fcn)f($alpha)</make>
+ <callback>set_alpha($alpha)</callback>
+ <param>
+ <name>Input Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>fcn:c</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>fcn:f</opt>
+ </option>
+ </param>
+ <param>
+ <name>Alpha</name>
+ <key>alpha</key>
+ <value>0.0001</value>
+ <type>real</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>float</type>
+ </source>
+</block>
diff --git a/gr-blocks/grc/blocks_short_to_char.xml b/gr-blocks/grc/blocks_short_to_char.xml
new file mode 100644
index 000000000..1951333d1
--- /dev/null
+++ b/gr-blocks/grc/blocks_short_to_char.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Short to char:
+###################################################
+ -->
+<block>
+ <name>Short To Char</name>
+ <key>blocks_short_to_char</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.short_to_char($vlen)</make>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>short</type>
+ <vlen>$vlen</vlen>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>byte</type>
+ <vlen>$vlen</vlen>
+ </source>
+</block>
diff --git a/gr-blocks/grc/blocks_short_to_float.xml b/gr-blocks/grc/blocks_short_to_float.xml
new file mode 100644
index 000000000..23ea019bc
--- /dev/null
+++ b/gr-blocks/grc/blocks_short_to_float.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Short to Float:
+###################################################
+ -->
+<block>
+ <name>Short To Float</name>
+ <key>blocks_short_to_float</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.short_to_float($vlen, $scale)</make>
+ <callback>set_scale($scale)</callback>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Scale</name>
+ <key>scale</key>
+ <value>1</value>
+ <type>real</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>short</type>
+ <vlen>$vlen</vlen>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>float</type>
+ <vlen>$vlen</vlen>
+ </source>
+</block>
diff --git a/gr-blocks/grc/blocks_stream_mux.xml b/gr-blocks/grc/blocks_stream_mux.xml
new file mode 100644
index 000000000..5e56a65d9
--- /dev/null
+++ b/gr-blocks/grc/blocks_stream_mux.xml
@@ -0,0 +1,75 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Stream Mux:
+## all types, many inputs, only one output
+###################################################
+ -->
+<block>
+ <name>Stream Mux</name>
+ <key>blocks_stream_mux</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.stream_mux($type.size*$vlen, $lengths)</make>
+ <param>
+ <name>Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>size:gr.sizeof_gr_complex</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>size:gr.sizeof_float</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>size:gr.sizeof_int</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>size:gr.sizeof_short</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>size:gr.sizeof_char</opt>
+ </option>
+ </param>
+ <param>
+ <name>Lengths</name>
+ <key>lengths</key>
+ <value>1, 1</value>
+ <type>int_vector</type>
+ </param>
+ <param>
+ <name>Num Inputs</name>
+ <key>num_inputs</key>
+ <value>2</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$num_inputs &gt; 0</check>
+ <check>$num_inputs == len($lengths)</check>
+ <check>$vlen &gt; 0</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ <nports>$num_inputs</nports>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </source>
+</block>
diff --git a/gr-blocks/grc/blocks_stream_to_streams.xml b/gr-blocks/grc/blocks_stream_to_streams.xml
new file mode 100644
index 000000000..c164e477b
--- /dev/null
+++ b/gr-blocks/grc/blocks_stream_to_streams.xml
@@ -0,0 +1,67 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Stream to Streams
+###################################################
+ -->
+<block>
+ <name>Stream to Streams</name>
+ <key>blocks_stream_to_streams</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.stream_to_streams($type.size*$vlen, $num_streams)</make>
+ <param>
+ <name>IO Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>size:gr.sizeof_gr_complex</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>size:gr.sizeof_float</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>size:gr.sizeof_int</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>size:gr.sizeof_short</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>size:gr.sizeof_char</opt>
+ </option>
+ </param>
+ <param>
+ <name>Num Streams</name>
+ <key>num_streams</key>
+ <value>2</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$num_streams &gt; 0</check>
+ <check>$vlen &gt;= 1</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ <nports>$num_streams</nports>
+ </source>
+</block>
diff --git a/gr-blocks/grc/blocks_stream_to_vector.xml b/gr-blocks/grc/blocks_stream_to_vector.xml
new file mode 100644
index 000000000..8965dfbfe
--- /dev/null
+++ b/gr-blocks/grc/blocks_stream_to_vector.xml
@@ -0,0 +1,66 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Stream to Vector
+###################################################
+ -->
+<block>
+ <name>Stream to Vector</name>
+ <key>blocks_stream_to_vector</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.stream_to_vector($type.size*$vlen, $num_items)</make>
+ <param>
+ <name>IO Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>size:gr.sizeof_gr_complex</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>size:gr.sizeof_float</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>size:gr.sizeof_int</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>size:gr.sizeof_short</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>size:gr.sizeof_char</opt>
+ </option>
+ </param>
+ <param>
+ <name>Num Items</name>
+ <key>num_items</key>
+ <value>2</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$num_items &gt; 0</check>
+ <check>$vlen &gt;= 1</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ <vlen>$vlen*$num_items</vlen>
+ </source>
+</block>
diff --git a/gr-blocks/grc/blocks_streams_to_stream.xml b/gr-blocks/grc/blocks_streams_to_stream.xml
new file mode 100644
index 000000000..2aa17dbe2
--- /dev/null
+++ b/gr-blocks/grc/blocks_streams_to_stream.xml
@@ -0,0 +1,67 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Streams to Stream
+###################################################
+ -->
+<block>
+ <name>Streams to Stream</name>
+ <key>blocks_streams_to_stream</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.streams_to_stream($type.size*$vlen, $num_streams)</make>
+ <param>
+ <name>IO Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>size:gr.sizeof_gr_complex</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>size:gr.sizeof_float</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>size:gr.sizeof_int</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>size:gr.sizeof_short</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>size:gr.sizeof_char</opt>
+ </option>
+ </param>
+ <param>
+ <name>Num Streams</name>
+ <key>num_streams</key>
+ <value>2</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$num_streams &gt; 0</check>
+ <check>$vlen &gt;= 1</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ <nports>$num_streams</nports>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </source>
+</block>
diff --git a/gr-blocks/grc/blocks_streams_to_vector.xml b/gr-blocks/grc/blocks_streams_to_vector.xml
new file mode 100644
index 000000000..dc371f021
--- /dev/null
+++ b/gr-blocks/grc/blocks_streams_to_vector.xml
@@ -0,0 +1,67 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Streams to Vector
+###################################################
+ -->
+<block>
+ <name>Streams to Vector</name>
+ <key>blocks_streams_to_vector</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.streams_to_vector($type.size*$vlen, $num_streams)</make>
+ <param>
+ <name>IO Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>size:gr.sizeof_gr_complex</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>size:gr.sizeof_float</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>size:gr.sizeof_int</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>size:gr.sizeof_short</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>size:gr.sizeof_char</opt>
+ </option>
+ </param>
+ <param>
+ <name>Num Streams</name>
+ <key>num_streams</key>
+ <value>2</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$num_streams &gt; 0</check>
+ <check>$vlen &gt;= 1</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ <nports>$num_streams</nports>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ <vlen>$vlen*$num_streams</vlen>
+ </source>
+</block>
diff --git a/gr-blocks/grc/blocks_stretch_ff.xml b/gr-blocks/grc/blocks_stretch_ff.xml
new file mode 100644
index 000000000..00a67602b
--- /dev/null
+++ b/gr-blocks/grc/blocks_stretch_ff.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Stretch Block:
+## float in / float out
+###################################################
+ -->
+<block>
+ <name>Stretch</name>
+ <key>blocks_stretch_ff</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.stretch_ff($lo, $vlen)</make>
+ <param>
+ <name>Low</name>
+ <key>lo</key>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Vec. Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>float</type>
+ <vlen>$vlen</vlen>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>float</type>
+ <vlen>$vlen</vlen>
+ </source>
+</block>
diff --git a/gr-blocks/grc/blocks_sub_xx.xml b/gr-blocks/grc/blocks_sub_xx.xml
new file mode 100644
index 000000000..ae01cf74a
--- /dev/null
+++ b/gr-blocks/grc/blocks_sub_xx.xml
@@ -0,0 +1,63 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Subtract Block:
+## all types, 1 output, 2 to inf inputs
+###################################################
+ -->
+<block>
+ <name>Subtract</name>
+ <key>blocks_sub_xx</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.sub_$(type.fcn)($vlen)</make>
+ <param>
+ <name>IO Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>fcn:cc</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>fcn:ff</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>fcn:ii</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>fcn:ss</opt>
+ </option>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Num Inputs</name>
+ <key>num_inputs</key>
+ <value>2</value>
+ <type>int</type>
+ </param>
+ <check>$vlen &gt; 0</check>
+ <check>$num_inputs &gt;= 2</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ <nports>$num_inputs</nports>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </source>
+</block>
diff --git a/gr-blocks/grc/blocks_threshold_ff.xml b/gr-blocks/grc/blocks_threshold_ff.xml
new file mode 100644
index 000000000..0da4157fc
--- /dev/null
+++ b/gr-blocks/grc/blocks_threshold_ff.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Threshold
+###################################################
+ -->
+<block>
+ <name>Threshold</name>
+ <key>blocks_threshold_ff</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.threshold_ff($low, $high, $init)</make>
+ <callback>set_hi($high)</callback>
+ <callback>set_lo($low)</callback>
+ <param>
+ <name>Low</name>
+ <key>low</key>
+ <value>-100</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>High</name>
+ <key>high</key>
+ <value>100</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Initial State</name>
+ <key>init</key>
+ <value>0</value>
+ <type>real</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>float</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>float</type>
+ </source>
+</block>
diff --git a/gr-blocks/grc/blocks_throttle.xml b/gr-blocks/grc/blocks_throttle.xml
new file mode 100644
index 000000000..8293cbde9
--- /dev/null
+++ b/gr-blocks/grc/blocks_throttle.xml
@@ -0,0 +1,67 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Throttle
+###################################################
+ -->
+<block>
+ <name>Throttle</name>
+ <key>blocks_throttle</key>
+ <throttle>1</throttle>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.throttle($type.size*$vlen, $samples_per_second)</make>
+ <callback>set_sample_rate($samples_per_second)</callback>
+ <param>
+ <name>Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>size:gr.sizeof_gr_complex</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>size:gr.sizeof_float</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>size:gr.sizeof_int</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>size:gr.sizeof_short</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>size:gr.sizeof_char</opt>
+ </option>
+ </param>
+ <param>
+ <name>Sample Rate</name>
+ <key>samples_per_second</key>
+ <value>samp_rate</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$vlen &gt; 0</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </source>
+</block>
diff --git a/gr-blocks/grc/blocks_transcendental.xml b/gr-blocks/grc/blocks_transcendental.xml
new file mode 100644
index 000000000..a883a2eef
--- /dev/null
+++ b/gr-blocks/grc/blocks_transcendental.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##transcendental functions
+###################################################
+ -->
+<block>
+ <name>Transcendental</name>
+ <key>blocks_transcendental</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.transcendental($name, "$type")</make>
+ <param>
+ <name>Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex_double</key>
+ <opt>type:complex</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>type:float</opt>
+ </option>
+ </param>
+ <param>
+ <name>Function Name</name>
+ <key>name</key>
+ <value>cos</value>
+ <type>string</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>$type.type</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type.type</type>
+ </source>
+</block>
diff --git a/gr-blocks/grc/blocks_uchar_to_float.xml b/gr-blocks/grc/blocks_uchar_to_float.xml
new file mode 100644
index 000000000..eb2b5505e
--- /dev/null
+++ b/gr-blocks/grc/blocks_uchar_to_float.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Unsigned Char to Float:
+###################################################
+ -->
+<block>
+ <name>UChar To Float</name>
+ <key>blocks_uchar_to_float</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.uchar_to_float()</make>
+ <sink>
+ <name>in</name>
+ <type>byte</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>float</type>
+ </source>
+</block>
diff --git a/gr-blocks/grc/blocks_unpacked_to_packed_xx.xml b/gr-blocks/grc/blocks_unpacked_to_packed_xx.xml
new file mode 100644
index 000000000..d27dc9bfc
--- /dev/null
+++ b/gr-blocks/grc/blocks_unpacked_to_packed_xx.xml
@@ -0,0 +1,68 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Unpacked to Packed
+###################################################
+ -->
+<block>
+ <name>Unpacked to Packed</name>
+ <key>blocks_unpacked_to_packed_xx</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.unpacked_to_packed_$(type.fcn)($bits_per_chunk, $endianness)</make>
+ <param>
+ <name>Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>fcn:ii</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>fcn:ss</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>fcn:bb</opt>
+ </option>
+ </param>
+ <param>
+ <name>Bits per Chunk</name>
+ <key>bits_per_chunk</key>
+ <value>2</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Endianness</name>
+ <key>endianness</key>
+ <type>int</type>
+ <option>
+ <name>MSB</name>
+ <key>gr.GR_MSB_FIRST</key>
+ </option>
+ <option>
+ <name>LSB</name>
+ <key>gr.GR_LSB_FIRST</key>
+ </option>
+ </param>
+ <param>
+ <name>Num Ports</name>
+ <key>num_ports</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$num_ports &gt; 0</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <nports>$num_ports</nports>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ <nports>$num_ports</nports>
+ </source>
+</block>
diff --git a/gr-blocks/grc/blocks_vector_to_stream.xml b/gr-blocks/grc/blocks_vector_to_stream.xml
new file mode 100644
index 000000000..a4a77bef8
--- /dev/null
+++ b/gr-blocks/grc/blocks_vector_to_stream.xml
@@ -0,0 +1,66 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Vector to Stream
+###################################################
+ -->
+<block>
+ <name>Vector to Stream</name>
+ <key>blocks_vector_to_stream</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.vector_to_stream($type.size*$vlen, $num_items)</make>
+ <param>
+ <name>IO Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>size:gr.sizeof_gr_complex</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>size:gr.sizeof_float</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>size:gr.sizeof_int</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>size:gr.sizeof_short</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>size:gr.sizeof_char</opt>
+ </option>
+ </param>
+ <param>
+ <name>Num Items</name>
+ <key>num_items</key>
+ <value>2</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$num_items &gt; 0</check>
+ <check>$vlen &gt;= 1</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <vlen>$vlen*$num_items</vlen>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </source>
+</block>
diff --git a/gr-blocks/grc/blocks_vector_to_streams.xml b/gr-blocks/grc/blocks_vector_to_streams.xml
new file mode 100644
index 000000000..6a246b98d
--- /dev/null
+++ b/gr-blocks/grc/blocks_vector_to_streams.xml
@@ -0,0 +1,67 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Vector to Streams
+###################################################
+ -->
+<block>
+ <name>Vector to Streams</name>
+ <key>blocks_vector_to_streams</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.vector_to_streams($type.size*$vlen, $num_streams)</make>
+ <param>
+ <name>IO Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>size:gr.sizeof_gr_complex</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>size:gr.sizeof_float</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>size:gr.sizeof_int</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>size:gr.sizeof_short</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>size:gr.sizeof_char</opt>
+ </option>
+ </param>
+ <param>
+ <name>Num Streams</name>
+ <key>num_streams</key>
+ <value>2</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$num_streams &gt; 0</check>
+ <check>$vlen &gt;= 1</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <vlen>$vlen*$num_streams</vlen>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ <nports>$num_streams</nports>
+ </source>
+</block>
diff --git a/gr-blocks/grc/blocks_xor_xx.xml b/gr-blocks/grc/blocks_xor_xx.xml
new file mode 100644
index 000000000..d2886a4e0
--- /dev/null
+++ b/gr-blocks/grc/blocks_xor_xx.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Logical Xor Block
+###################################################
+ -->
+<block>
+ <name>Xor</name>
+ <key>blocks_xor_xx</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.xor_$(type.fcn)()</make>
+ <param>
+ <name>IO Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>fcn:ii</opt>
+ </option>
+ <option>
+ <name>Shxort</name>
+ <key>short</key>
+ <opt>fcn:ss</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>fcn:bb</opt>
+ </option>
+ </param>
+ <param>
+ <name>Num Inputs</name>
+ <key>num_inputs</key>
+ <value>2</value>
+ <type>int</type>
+ </param>
+ <check>$num_inputs &gt;= 2</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <nports>$num_inputs</nports>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ </source>
+</block>
diff --git a/gr-blocks/include/blocks/CMakeLists.txt b/gr-blocks/include/blocks/CMakeLists.txt
new file mode 100644
index 000000000..d3c08f6e6
--- /dev/null
+++ b/gr-blocks/include/blocks/CMakeLists.txt
@@ -0,0 +1,150 @@
+# 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.
+
+########################################################################
+# generate helper scripts to expand templated files
+########################################################################
+include(GrPython)
+
+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, 'blocks')
+ build_utils.expand_template(d, inp)
+
+")
+
+macro(expand_h root)
+ #make a list of all the generated files
+ unset(expanded_files_h)
+ foreach(sig ${ARGN})
+ string(REGEX REPLACE "X+" ${sig} name ${root})
+ list(APPEND expanded_files_h ${CMAKE_CURRENT_BINARY_DIR}/${name}.h)
+ endforeach(sig)
+
+ #create a command to generate the files
+ add_custom_command(
+ OUTPUT ${expanded_files_h}
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${root}.h.t
+ COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B}
+ ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py
+ ${root} ${root}.h.t ${ARGN}
+ )
+
+ #install rules for the generated h files
+ list(APPEND generated_includes ${expanded_files_h})
+endmacro(expand_h)
+
+########################################################################
+# Invoke macro to generate various sources
+########################################################################
+expand_h(add_XX ss ii cc)
+expand_h(add_const_XX ss ii ff cc)
+expand_h(add_const_vXX ss ii ff cc)
+expand_h(and_XX bb ss ii)
+expand_h(and_const_XX bb ss ii)
+expand_h(divide_XX ss ii ff cc)
+expand_h(integrate_XX ss ii ff cc)
+expand_h(multiply_XX ss ii)
+expand_h(multiply_const_XX ss ii)
+expand_h(multiply_const_vXX ss ii ff cc)
+expand_h(not_XX bb ss ii)
+expand_h(or_XX bb ss ii)
+expand_h(sub_XX ss ii ff cc)
+expand_h(xor_XX bb ss ii)
+expand_h(packed_to_unpacked_XX bb ss ii)
+expand_h(unpacked_to_packed_XX bb ss ii)
+
+add_custom_target(blocks_generated_includes DEPENDS
+ ${generated_includes}
+)
+
+########################################################################
+# Install header files
+########################################################################
+install(FILES
+ ${generated_includes}
+ api.h
+ count_bits.h
+ log2_const.h
+ add_ff.h
+ char_to_float.h
+ char_to_short.h
+ complex_to_interleaved_short.h
+ complex_to_float.h
+ complex_to_imag.h
+ complex_to_real.h
+ complex_to_mag.h
+ complex_to_mag_squared.h
+ complex_to_arg.h
+ conjugate_cc.h
+ deinterleave.h
+ delay.h
+ file_source.h
+ file_meta_sink.h
+ file_meta_source.h
+ float_to_char.h
+ float_to_complex.h
+ float_to_int.h
+ float_to_short.h
+ float_to_uchar.h
+ int_to_float.h
+ interleave.h
+ interleaved_short_to_complex.h
+ keep_m_in_n.h
+ keep_one_in_n.h
+ multiply_cc.h
+ multiply_ff.h
+ multiply_conjugate_cc.h
+ multiply_const_cc.h
+ multiply_const_ff.h
+ nlog10_ff.h
+ patterned_interleaver.h
+ peak_detector2_fb.h
+ regenerate_bb.h
+ repeat.h
+ rms_cf.h
+ rms_ff.h
+ short_to_char.h
+ short_to_float.h
+ stream_mux.h
+ stream_to_streams.h
+ stream_to_vector.h
+ streams_to_stream.h
+ streams_to_vector.h
+ stretch_ff.h
+ threshold_ff.h
+ throttle.h
+ transcendental.h
+ uchar_to_float.h
+ vector_to_stream.h
+ vector_to_streams.h
+ DESTINATION ${GR_INCLUDE_DIR}/gnuradio/blocks
+ COMPONENT "blocks_devel"
+)
diff --git a/gr-blocks/include/blocks/add_XX.h.t b/gr-blocks/include/blocks/add_XX.h.t
new file mode 100644
index 000000000..607b82066
--- /dev/null
+++ b/gr-blocks/include/blocks/add_XX.h.t
@@ -0,0 +1,53 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2009,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 <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief output = sum (input_0, input_1, ...)
+ * \ingroup math_blk
+ *
+ * Add across all input streams.
+ */
+ class BLOCKS_API @NAME@ : virtual public gr_sync_block
+ {
+ public:
+
+ // gr::blocks::@NAME@::sptr
+ typedef boost::shared_ptr<@NAME@> sptr;
+
+ static sptr make(size_t vlen=1);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* @GUARD_NAME@ */
diff --git a/gr-blocks/include/blocks/add_const_XX.h.t b/gr-blocks/include/blocks/add_const_XX.h.t
new file mode 100644
index 000000000..df968feac
--- /dev/null
+++ b/gr-blocks/include/blocks/add_const_XX.h.t
@@ -0,0 +1,65 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,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 <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief output = input + constant
+ * \ingroup math_blk
+ */
+ class BLOCKS_API @NAME@ : virtual public gr_sync_block
+ {
+ public:
+
+ // gr::blocks::@NAME@::sptr
+ typedef boost::shared_ptr<@NAME@> sptr;
+
+ /*!
+ * \brief Create an instance of @NAME@
+ * \param k additive constant
+ */
+ static sptr make(@O_TYPE@ k);
+
+ /*!
+ * \brief Return additive constant
+ */
+ virtual @O_TYPE@ k() const = 0;
+
+ /*!
+ * \brief Set additive constant
+ */
+ virtual void set_k(@O_TYPE@ k) = 0;
+ };
+
+ }
+}
+
+#endif /* @GUARD_NAME@ */
diff --git a/gr-blocks/include/blocks/add_const_vXX.h.t b/gr-blocks/include/blocks/add_const_vXX.h.t
new file mode 100644
index 000000000..c4cd49fa4
--- /dev/null
+++ b/gr-blocks/include/blocks/add_const_vXX.h.t
@@ -0,0 +1,66 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2006,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.
+ */
+
+// @WARNING@
+
+#ifndef @GUARD_NAME@
+#define @GUARD_NAME@
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief output = input + constant vector
+ * \ingroup math_blk
+ */
+ class BLOCKS_API @NAME@ : virtual public gr_sync_block
+ {
+
+ public:
+
+ // gr::blocks::@NAME@::sptr
+ typedef boost::shared_ptr<@NAME@> sptr;
+
+ /*!
+ * \brief Create an instance of @NAME@
+ * \param k additive constant vector
+ */
+ static sptr make(std::vector<@O_TYPE@> k);
+
+ /*!
+ * \brief Return additive constant vector
+ */
+ virtual std::vector<@O_TYPE@> k() const = 0;
+
+ /*!
+ * \brief Set additive constant vector
+ */
+ virtual void set_k(std::vector<@O_TYPE@> k) = 0;
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* @GUARD_NAME@ */
diff --git a/gr-blocks/include/blocks/add_ff.h b/gr-blocks/include/blocks/add_ff.h
new file mode 100644
index 000000000..1e7350c1b
--- /dev/null
+++ b/gr-blocks/include/blocks/add_ff.h
@@ -0,0 +1,50 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_BLOCKS_ADD_FF_H
+#define INCLUDED_BLOCKS_ADD_FF_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ class BLOCKS_API add_ff : virtual public gr_sync_block
+ {
+ public:
+
+ // gr::blocks::add_ff::sptr
+ typedef boost::shared_ptr<add_ff> sptr;
+
+ /*!
+ * \brief Add streams of float values
+ * \param vlen Vector length
+ * \ingroup math_blk
+ */
+ static sptr make(size_t vlen=1);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_BLOCKS_ADD_FF_H */
diff --git a/gr-blocks/include/blocks/and_XX.h.t b/gr-blocks/include/blocks/and_XX.h.t
new file mode 100644
index 000000000..68ddcc33d
--- /dev/null
+++ b/gr-blocks/include/blocks/and_XX.h.t
@@ -0,0 +1,53 @@
+/* -*- 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 <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief output = input_0 & input_1 & , ... & input_N)
+ * \ingroup math_blk
+ *
+ * bitwise boolean and across all input streams.
+ */
+ class BLOCKS_API @NAME@ : virtual public gr_sync_block
+ {
+ public:
+
+ // gr::blocks::@NAME@::sptr
+ typedef boost::shared_ptr<@NAME@> sptr;
+
+ static sptr make(size_t vlen=1);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* @GUARD_NAME@ */
diff --git a/gr-blocks/include/blocks/and_const_XX.h.t b/gr-blocks/include/blocks/and_const_XX.h.t
new file mode 100644
index 000000000..945a1f48b
--- /dev/null
+++ b/gr-blocks/include/blocks/and_const_XX.h.t
@@ -0,0 +1,68 @@
+/* -*- 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 <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief output_N = input_N & value
+ * \ingroup math_blk
+ *
+ * bitwise boolean and of const to the data stream.
+ */
+ class BLOCKS_API @NAME@ : virtual public gr_sync_block
+ {
+
+ public:
+
+ // gr::blocks::@NAME@::sptr
+ typedef boost::shared_ptr<@NAME@> sptr;
+
+ /*!
+ * \brief Create an instance of @NAME@
+ * \param k AND constant
+ */
+ static sptr make(@O_TYPE@ k);
+
+ /*!
+ * \brief Return AND constant
+ */
+ virtual @O_TYPE@ k() const = 0;
+
+ /*!
+ * \brief Set AND constant
+ */
+ virtual void set_k(@O_TYPE@ k) = 0;
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* @GUARD_NAME@ */
diff --git a/gr-blocks/include/blocks/api.h b/gr-blocks/include/blocks/api.h
new file mode 100644
index 000000000..45fbc0d21
--- /dev/null
+++ b/gr-blocks/include/blocks/api.h
@@ -0,0 +1,33 @@
+/*
+ * 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.
+ */
+
+#ifndef INCLUDED_BLOCKS_API_H
+#define INCLUDED_BLOCKS_API_H
+
+#include <gruel/attributes.h>
+
+#ifdef gnuradio_blocks_EXPORTS
+# define BLOCKS_API __GR_ATTR_EXPORT
+#else
+# define BLOCKS_API __GR_ATTR_IMPORT
+#endif
+
+#endif /* INCLUDED_BLOCKS_API_H */
diff --git a/gr-blocks/include/blocks/char_to_float.h b/gr-blocks/include/blocks/char_to_float.h
new file mode 100644
index 000000000..92a2dbf80
--- /dev/null
+++ b/gr-blocks/include/blocks/char_to_float.h
@@ -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 INCLUDED_BLOCKS_CHAR_TO_FLOAT_H
+#define INCLUDED_BLOCKS_CHAR_TO_FLOAT_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief Convert stream of chars to a stream of float
+ * \ingroup converter_blk
+ *
+ * \param vlen vector length of data streams.
+ * \param scale a scalar divider to change the output signal scale.
+ */
+ class BLOCKS_API char_to_float : virtual public gr_sync_block
+ {
+ public:
+
+ // gr::blocks::char_to_float_ff::sptr
+ typedef boost::shared_ptr<char_to_float> sptr;
+
+ static sptr make(size_t vlen=1, float scale=1.0);
+
+ /*!
+ * Get the scalar divider value.
+ */
+ virtual float scale() const = 0;
+
+ /*!
+ * Set the scalar divider value.
+ */
+ virtual void set_scale(float scale) = 0;
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_BLOCKS_CHAR_TO_FLOAT_H */
diff --git a/gr-blocks/include/blocks/char_to_short.h b/gr-blocks/include/blocks/char_to_short.h
new file mode 100644
index 000000000..e2bb3a859
--- /dev/null
+++ b/gr-blocks/include/blocks/char_to_short.h
@@ -0,0 +1,51 @@
+/* -*- 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 INCLUDED_BLOCKS_CHAR_TO_SHORT_H
+#define INCLUDED_BLOCKS_CHAR_TO_SHORT_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief Convert stream of chars to a stream of short
+ * \ingroup converter_blk
+ *
+ * \param vlen vector length of data streams.
+ */
+ class BLOCKS_API char_to_short : virtual public gr_sync_block
+ {
+ public:
+
+ // gr::blocks::char_to_short_ff::sptr
+ typedef boost::shared_ptr<char_to_short> sptr;
+
+ static sptr make(size_t vlen=1);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_BLOCKS_CHAR_TO_SHORT_H */
diff --git a/gr-blocks/include/blocks/complex_to_arg.h b/gr-blocks/include/blocks/complex_to_arg.h
new file mode 100644
index 000000000..5d38161d4
--- /dev/null
+++ b/gr-blocks/include/blocks/complex_to_arg.h
@@ -0,0 +1,50 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_BLOCKS_COMPLEX_TO_ARG_H
+#define INCLUDED_BLOCKS_COMPLEX_TO_ARG_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief complex in, arg out (float)
+ * \ingroup converter_blk
+ * \param vlen vector len (default 1)
+ */
+ class BLOCKS_API complex_to_arg : virtual public gr_sync_block
+ {
+ public:
+
+ // gr::blocks::complex_to_arg_ff::sptr
+ typedef boost::shared_ptr<complex_to_arg> sptr;
+
+ static sptr make(size_t vlen=1);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_BLOCKS_COMPLEX_TO_ARG_H */
diff --git a/gr-blocks/include/blocks/complex_to_float.h b/gr-blocks/include/blocks/complex_to_float.h
new file mode 100644
index 000000000..322f67b62
--- /dev/null
+++ b/gr-blocks/include/blocks/complex_to_float.h
@@ -0,0 +1,50 @@
+/* -*- 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 INCLUDED_BLOCKS_COMPLEX_TO_FLOAT_H
+#define INCLUDED_BLOCKS_COMPLEX_TO_FLOAT_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief convert a stream of gr_complex to 1 or 2 streams of float
+ * \ingroup converter_blk
+ * \param vlen vector len (default 1)
+ */
+ class BLOCKS_API complex_to_float : virtual public gr_sync_block
+ {
+ public:
+
+ // gr::blocks::complex_to_float_ff::sptr
+ typedef boost::shared_ptr<complex_to_float> sptr;
+
+ static sptr make(size_t vlen=1);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_BLOCKS_COMPLEX_TO_FLOAT_H */
diff --git a/gr-blocks/include/blocks/complex_to_imag.h b/gr-blocks/include/blocks/complex_to_imag.h
new file mode 100644
index 000000000..71353a94a
--- /dev/null
+++ b/gr-blocks/include/blocks/complex_to_imag.h
@@ -0,0 +1,50 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_BLOCKS_COMPLEX_TO_IMAG_H
+#define INCLUDED_BLOCKS_COMPLEX_TO_IMAG_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief complex in, imag out (float)
+ * \ingroup converter_blk
+ * \param vlen vector len (default 1)
+ */
+ class BLOCKS_API complex_to_imag : virtual public gr_sync_block
+ {
+ public:
+
+ // gr::blocks::complex_to_imag_ff::sptr
+ typedef boost::shared_ptr<complex_to_imag> sptr;
+
+ static sptr make(size_t vlen=1);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_BLOCKS_COMPLEX_TO_IMAG_H */
diff --git a/gr-blocks/include/blocks/complex_to_interleaved_short.h b/gr-blocks/include/blocks/complex_to_interleaved_short.h
new file mode 100644
index 000000000..f5e91123c
--- /dev/null
+++ b/gr-blocks/include/blocks/complex_to_interleaved_short.h
@@ -0,0 +1,49 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_BLOCKS_COMPLEX_TO_INTERLEAVED_SHORT_H
+#define INCLUDED_BLOCKS_COMPLEX_TO_INTERLEAVED_SHORT_H
+
+#include <blocks/api.h>
+#include <gr_sync_interpolator.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief Convert stream of complex to a stream of interleaved shorts
+ * \ingroup converter_blk
+ */
+ class BLOCKS_API complex_to_interleaved_short : virtual public gr_sync_interpolator
+ {
+ public:
+
+ // gr::blocks::complex_to_interleaved_short::sptr
+ typedef boost::shared_ptr<complex_to_interleaved_short> sptr;
+
+ static sptr make();
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_BLOCKS_COMPLEX_TO_INTERLEAVED_SHORT_H */
diff --git a/gr-blocks/include/blocks/complex_to_mag.h b/gr-blocks/include/blocks/complex_to_mag.h
new file mode 100644
index 000000000..7e03c1cac
--- /dev/null
+++ b/gr-blocks/include/blocks/complex_to_mag.h
@@ -0,0 +1,50 @@
+/* -*- 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 INCLUDED_BLOCKS_COMPLEX_TO_MAG_H
+#define INCLUDED_BLOCKS_COMPLEX_TO_MAG_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief complex in, magnitude out (float)
+ * \ingroup converter_blk
+ * \param vlen vector len (default 1)
+ */
+ class BLOCKS_API complex_to_mag : virtual public gr_sync_block
+ {
+ public:
+
+ // gr::blocks::complex_to_mag_ff::sptr
+ typedef boost::shared_ptr<complex_to_mag> sptr;
+
+ static sptr make(size_t vlen=1);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_BLOCKS_COMPLEX_TO_MAG_H */
diff --git a/gr-blocks/include/blocks/complex_to_mag_squared.h b/gr-blocks/include/blocks/complex_to_mag_squared.h
new file mode 100644
index 000000000..9e122b4b1
--- /dev/null
+++ b/gr-blocks/include/blocks/complex_to_mag_squared.h
@@ -0,0 +1,50 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_BLOCKS_COMPLEX_TO_MAG_SQUARED_H
+#define INCLUDED_BLOCKS_COMPLEX_TO_MAG_SQUARED_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief complex in, magnitude squared out (float)
+ * \ingroup converter_blk
+ * \param vlen vector len (default 1)
+ */
+ class BLOCKS_API complex_to_mag_squared : virtual public gr_sync_block
+ {
+ public:
+
+ // gr::blocks::complex_to_mag_squared_ff::sptr
+ typedef boost::shared_ptr<complex_to_mag_squared> sptr;
+
+ static sptr make(size_t vlen=1);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_BLOCKS_COMPLEX_TO_MAG_SQUARED_H */
diff --git a/gr-blocks/include/blocks/complex_to_real.h b/gr-blocks/include/blocks/complex_to_real.h
new file mode 100644
index 000000000..a891c2e08
--- /dev/null
+++ b/gr-blocks/include/blocks/complex_to_real.h
@@ -0,0 +1,50 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_BLOCKS_COMPLEX_TO_REAL_H
+#define INCLUDED_BLOCKS_COMPLEX_TO_REAL_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief complex in, real out (float)
+ * \ingroup converter_blk
+ * \param vlen vector len (default 1)
+ */
+ class BLOCKS_API complex_to_real : virtual public gr_sync_block
+ {
+ public:
+
+ // gr::blocks::complex_to_real_ff::sptr
+ typedef boost::shared_ptr<complex_to_real> sptr;
+
+ static sptr make(size_t vlen=1);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_BLOCKS_COMPLEX_TO_REAL_H */
diff --git a/gr-blocks/include/blocks/conjugate_cc.h b/gr-blocks/include/blocks/conjugate_cc.h
new file mode 100644
index 000000000..02297c56e
--- /dev/null
+++ b/gr-blocks/include/blocks/conjugate_cc.h
@@ -0,0 +1,49 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_BLOCKS_CONJUGATE_CC_H
+#define INCLUDED_BLOCKS_CONJUGATE_CC_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief output = complex conjugate of input
+ * \ingroup math_blk
+ */
+ class BLOCKS_API conjugate_cc : virtual public gr_sync_block
+ {
+ public:
+
+ // gr::blocks::conjugate_cc_ff::sptr
+ typedef boost::shared_ptr<conjugate_cc> sptr;
+
+ static sptr make();
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_BLOCKS_CONJUGATE_CC_H */
diff --git a/gr-blocks/include/blocks/count_bits.h b/gr-blocks/include/blocks/count_bits.h
new file mode 100644
index 000000000..ceb882f67
--- /dev/null
+++ b/gr-blocks/include/blocks/count_bits.h
@@ -0,0 +1,46 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2003,2013 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 _GR_COUNT_BITS_H_
+#define _GR_COUNT_BITS_H_
+
+#include <blocks/api.h>
+
+namespace gr {
+ namespace blocks {
+
+ //! return number of set bits in the low 8 bits of x
+ BLOCKS_API unsigned int count_bits8(unsigned int x);
+
+ //! return number of set bits in the low 16 bits of x
+ BLOCKS_API unsigned int count_bits16(unsigned int x);
+
+ //! return number of set bits in the low 32 bits of x
+ BLOCKS_API unsigned int count_bits32(unsigned int x);
+
+ //! return number of set bits in a 64-bit word
+ BLOCKS_API unsigned int count_bits64(unsigned long long int x);
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* _GR_COUNT_BITS_H_ */
diff --git a/gr-blocks/include/blocks/deinterleave.h b/gr-blocks/include/blocks/deinterleave.h
new file mode 100644
index 000000000..24074d2fc
--- /dev/null
+++ b/gr-blocks/include/blocks/deinterleave.h
@@ -0,0 +1,50 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_BLOCKS_DEINTERLEAVE_H
+#define INCLUDED_BLOCKS_DEINTERLEAVE_H
+
+#include <blocks/api.h>
+#include <gr_sync_decimator.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief deinterleave a single input into N outputs
+ * \ingroup slicedice_blk
+ * \param itemsize stream itemsize
+ */
+ class BLOCKS_API deinterleave : virtual public gr_sync_decimator
+ {
+ public:
+
+ // gr::blocks::deinterleave::sptr
+ typedef boost::shared_ptr<deinterleave> sptr;
+
+ static sptr make(size_t itemsize);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_BLOCKS_DEINTERLEAVE_H */
diff --git a/gr-blocks/include/blocks/delay.h b/gr-blocks/include/blocks/delay.h
new file mode 100644
index 000000000..2a59fa0fc
--- /dev/null
+++ b/gr-blocks/include/blocks/delay.h
@@ -0,0 +1,57 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007,2012-2013 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_BLOCKS_DELAY_H
+#define INCLUDED_BLOCKS_DELAY_H
+
+#include <blocks/api.h>
+#include <gr_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief delay the input by a certain number of samples
+ * \ingroup misc_blk
+ */
+ class BLOCKS_API delay : virtual public gr_block
+ {
+ public:
+ // gr::blocks::delay::sptr
+ typedef boost::shared_ptr<delay> sptr;
+
+ /*!
+ * \brief Make a delay block.
+ * \param itemsize size of the data items.
+ * \param delay number of samples to delay stream.
+ */
+ static sptr make(size_t itemsize, int delay);
+
+ virtual int dly() const = 0;
+ virtual void set_dly(int d) = 0;
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_BLOCKS_DELAY_H */
+
diff --git a/gr-blocks/include/blocks/divide_XX.h.t b/gr-blocks/include/blocks/divide_XX.h.t
new file mode 100644
index 000000000..9a382e4a0
--- /dev/null
+++ b/gr-blocks/include/blocks/divide_XX.h.t
@@ -0,0 +1,53 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2009,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 <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief output = input_0 / input_1 / input_x ...)
+ * \ingroup math_blk
+ *
+ * Divide across all input streams.
+ */
+ class BLOCKS_API @NAME@ : virtual public gr_sync_block
+ {
+ public:
+
+ // gr::blocks::@NAME@::sptr
+ typedef boost::shared_ptr<@NAME@> sptr;
+
+ static sptr make(size_t vlen=1);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* @GUARD_NAME@ */
diff --git a/gr-blocks/include/blocks/file_meta_sink.h b/gr-blocks/include/blocks/file_meta_sink.h
new file mode 100644
index 000000000..ef64887cf
--- /dev/null
+++ b/gr-blocks/include/blocks/file_meta_sink.h
@@ -0,0 +1,111 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_BLOCKS_FILE_META_SINK_H
+#define INCLUDED_BLOCKS_FILE_META_SINK_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ const char METADATA_VERSION = 0;
+ const size_t METADATA_HEADER_SIZE = 149;
+
+ enum gr_file_types {
+ GR_FILE_BYTE=0,
+ GR_FILE_CHAR=0,
+ GR_FILE_SHORT=1,
+ GR_FILE_INT,
+ GR_FILE_LONG,
+ GR_FILE_LONG_LONG,
+ GR_FILE_FLOAT,
+ GR_FILE_DOUBLE,
+ };
+
+ /*!
+ * \brief Write stream to file with meta-data headers.
+ * \ingroup sink_blk
+ *
+ * These files represent data as binary information in between
+ * meta-data headers. The headers contain information about the
+ * type of data and properties of the data in the next segment of
+ * samples. The information includes:
+ *
+ * rx_rate (double): sample rate of data.
+ * rx_time (uint64_t, double): time stamp of first sample in segment.
+ * size (uint32_t): item size in bytes.
+ * type (gr_file_types as int32_t): data type.
+ * cplx (bool): Is data complex?
+ * strt (uint64_t): Starting byte of data in this segment.
+ * bytes (uint64_t): Size in bytes of data in this segment.
+ *
+ * Tags can be sent to the file to update the information, which
+ * will create a new header. Headers are found by searching from
+ * the first header (at position 0 in the file) and reading where
+ * the data segment starts plus the data segment size. Following
+ * will either be a new header or EOF.
+ */
+ class BLOCKS_API file_meta_sink : virtual public gr_sync_block
+ {
+ public:
+ // gr::blocks::file_meta_sink::sptr
+ typedef boost::shared_ptr<file_meta_sink> sptr;
+
+ /*!
+ * \brief Create a meta-data file sink.
+ *
+ * \param itemsize (size_t): Size of data type.
+ * \param filename (string): Name of file to write data to.
+ * \param samp_rate (double): Sample rate of data. If sample rate will be
+ * set by a tag, such as rx_tag from a UHD source, this is
+ * basically ignored.
+ * \param relative_rate (double): Rate chance from source of sample
+ * rate tag to sink.
+ * \param type (gr_file_types): Data type (int, float, etc.)
+ * \param complex (bool): If data stream is complex
+ * \param max_segment_size (size_t): Length of a single segment
+ * before the header is repeated (in items).
+ * \param extra_dict (string): a serialized PMT dictionary of extra
+ * information. Currently not supported.
+ * \param detached_header (bool): Set to true to store the header
+ * info in a separate file (named filename.hdr)
+ */
+ static sptr make(size_t itemsize, const std::string &filename,
+ double samp_rate=1, double relative_rate=1,
+ gr_file_types type=GR_FILE_FLOAT, bool complex=true,
+ size_t max_segment_size=1000000,
+ const std::string &extra_dict="",
+ bool detached_header=false);
+
+ virtual bool open(const std::string &filename) = 0;
+ virtual void close() = 0;
+ virtual void do_update() = 0;
+
+ virtual void set_unbuffered(bool unbuffered) = 0;
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_BLOCKS_FILE_META_SINK_H */
diff --git a/gr-blocks/include/blocks/file_meta_source.h b/gr-blocks/include/blocks/file_meta_source.h
new file mode 100644
index 000000000..a992d5243
--- /dev/null
+++ b/gr-blocks/include/blocks/file_meta_source.h
@@ -0,0 +1,81 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_BLOCKS_FILE_META_SOURCE_H
+#define INCLUDED_BLOCKS_FILE_META_SOURCE_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief Reads stream from file with meta-data headers. Headers
+ * are parsed into tags.
+ * \ingroup source_blk
+ *
+ * The information in the metadata headers includes:
+ *
+ * rx_rate (double): sample rate of data.
+ * rx_time (uint64_t, double): time stamp of first sample in segment.
+ * size (uint32_t): item size in bytes.
+ * type (gr_file_types as int32_t): data type.
+ * cplx (bool): Is data complex?
+ * strt (uint64_t): Starting byte of data in this segment.
+ * bytes (uint64_t): Size in bytes of data in this segment.
+ *
+ * Any item inside of the extra header dictionary is ready out and
+ * made into a stream tag.
+ */
+ class BLOCKS_API file_meta_source : virtual public gr_sync_block
+ {
+ public:
+ // gr::blocks::file_meta_source::sptr
+ typedef boost::shared_ptr<file_meta_source> sptr;
+
+ /*!
+ * \brief Create a meta-data file source.
+ *
+ * \param filename (string): Name of file to write data to.
+ * \param repeat (bool): Repeats file when EOF is found.
+ * \param detached_header (bool): Set to true if header
+ * info is stored in a separate file (usually named filename.hdr)
+ * \param hdr_filename (string): Name of detached header file if used.
+ * Defaults to 'filename.hdr' if detached_header is true but this
+ * field is an empty string.
+ */
+ static sptr make(const std::string &filename,
+ bool repeat=false,
+ bool detached_header=false,
+ const std::string &hdr_filename="");
+
+ virtual bool open(const std::string &filename,
+ const std::string &hdr_filename="") = 0;
+ virtual void close() = 0;
+ virtual void do_update() = 0;
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_BLOCKS_FILE_META_SOURCE_H */
diff --git a/gr-blocks/include/blocks/file_source.h b/gr-blocks/include/blocks/file_source.h
new file mode 100644
index 000000000..1a12aa905
--- /dev/null
+++ b/gr-blocks/include/blocks/file_source.h
@@ -0,0 +1,85 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_BLOCKS_FILE_SOURCE_H
+#define INCLUDED_BLOCKS_FILE_SOURCE_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief Read stream from file
+ * \ingroup source_blk
+ */
+ class BLOCKS_API file_source : virtual public gr_sync_block
+ {
+ public:
+
+ // gr::blocks::file_source::sptr
+ typedef boost::shared_ptr<file_source> sptr;
+
+ /*!
+ * \brief Create a file source.
+ *
+ * Opens \p filename as a source of items into a flowgraph. The
+ * data is expected to be in binary format, item after item. The
+ * \p itemsize of the block determines the conversion from bits
+ * to items.
+ *
+ * If \p repeat is turned on, the file will repeat the file after
+ * it's reached the end.
+ *
+ * \param itemsize the size of each item in the file, in bytes
+ * \param filename name of the file to source from
+ * \param repeat repeat file from start
+ */
+ static sptr make(size_t itemsize, const char *filename, bool repeat = false);
+
+ /*!
+ * \brief seek file to \p seek_point relative to \p whence
+ *
+ * \param seek_point sample offset in file
+ * \param whence one of SEEK_SET, SEEK_CUR, SEEK_END (man fseek)
+ */
+ virtual bool seek(long seek_point, int whence) = 0;
+
+ /*!
+ * \brief Opens a new file.
+ *
+ * \param filename name of the file to source from
+ * \param repeat repeat file from start
+ */
+ virtual void open(const char *filename, bool repeat) = 0;
+
+ /*!
+ * \brief Close the file handle.
+ */
+ virtual void close() = 0;
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_BLOCKS_FILE_SOURCE_H */
diff --git a/gr-blocks/include/blocks/float_to_char.h b/gr-blocks/include/blocks/float_to_char.h
new file mode 100644
index 000000000..de9ea85e3
--- /dev/null
+++ b/gr-blocks/include/blocks/float_to_char.h
@@ -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 INCLUDED_BLOCKS_FLOAT_TO_CHAR_H
+#define INCLUDED_BLOCKS_FLOAT_TO_CHAR_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief Convert stream of floats to a stream of char
+ * \ingroup converter_blk
+ *
+ * \param vlen vector length of data streams.
+ * \param scale a scalar multiplier to change the output signal scale.
+ */
+ class BLOCKS_API float_to_char : virtual public gr_sync_block
+ {
+ public:
+
+ // gr::blocks::float_to_char_ff::sptr
+ typedef boost::shared_ptr<float_to_char> sptr;
+
+ static sptr make(size_t vlen=1, float scale=1.0);
+
+ /*!
+ * Get the scalar multiplier value.
+ */
+ virtual float scale() const = 0;
+
+ /*!
+ * Set the scalar multiplier value.
+ */
+ virtual void set_scale(float scale) = 0;
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_BLOCKS_FLOAT_TO_CHAR_H */
diff --git a/gr-blocks/include/blocks/float_to_complex.h b/gr-blocks/include/blocks/float_to_complex.h
new file mode 100644
index 000000000..48c5b6ead
--- /dev/null
+++ b/gr-blocks/include/blocks/float_to_complex.h
@@ -0,0 +1,50 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_BLOCKS_FLOAT_TO_COMPLEX_H
+#define INCLUDED_BLOCKS_FLOAT_TO_COMPLEX_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief one or two floats in, complex out
+ * \ingroup converter_blk
+ * \param vlen vector len (default 1)
+ */
+ class BLOCKS_API float_to_complex : virtual public gr_sync_block
+ {
+ public:
+
+ // gr::blocks::float_to_complex_ff::sptr
+ typedef boost::shared_ptr<float_to_complex> sptr;
+
+ static sptr make(size_t vlen=1);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_BLOCKS_FLOAT_TO_COMPLEX_H */
diff --git a/gr-blocks/include/blocks/float_to_int.h b/gr-blocks/include/blocks/float_to_int.h
new file mode 100644
index 000000000..95c62e516
--- /dev/null
+++ b/gr-blocks/include/blocks/float_to_int.h
@@ -0,0 +1,62 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_BLOCKS_FLOAT_TO_INT_H
+#define INCLUDED_BLOCKS_FLOAT_TO_INT_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief Convert stream of floats to a stream of char
+ * \ingroup converter_blk
+ *
+ * \param vlen vector length of data streams.
+ * \param scale a scalar multiplier to change the output signal scale.
+ */
+ class BLOCKS_API float_to_int : virtual public gr_sync_block
+ {
+ public:
+
+ // gr::blocks::float_to_int_ff::sptr
+ typedef boost::shared_ptr<float_to_int> sptr;
+
+ static sptr make(size_t vlen=1, float scale=1.0);
+
+ /*!
+ * Get the scalar multiplier value.
+ */
+ virtual float scale() const = 0;
+
+ /*!
+ * Set the scalar multiplier value.
+ */
+ virtual void set_scale(float scale) = 0;
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_BLOCKS_FLOAT_TO_INT_H */
diff --git a/gr-blocks/include/blocks/float_to_short.h b/gr-blocks/include/blocks/float_to_short.h
new file mode 100644
index 000000000..5f1ab3f95
--- /dev/null
+++ b/gr-blocks/include/blocks/float_to_short.h
@@ -0,0 +1,62 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_BLOCKS_FLOAT_TO_SHORT_H
+#define INCLUDED_BLOCKS_FLOAT_TO_SHORT_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief Convert stream of floats to a stream of shorts
+ * \ingroup converter_blk
+ *
+ * \param vlen vector length of data streams.
+ * \param scale a scalar multiplier to change the output signal scale.
+ */
+ class BLOCKS_API float_to_short : virtual public gr_sync_block
+ {
+ public:
+
+ // gr::blocks::float_to_short_ff::sptr
+ typedef boost::shared_ptr<float_to_short> sptr;
+
+ static sptr make(size_t vlen=1, float scale=1.0);
+
+ /*!
+ * Get the scalar multiplier value.
+ */
+ virtual float scale() const = 0;
+
+ /*!
+ * Set the scalar multiplier value.
+ */
+ virtual void set_scale(float scale) = 0;
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_BLOCKS_FLOAT_TO_SHORT_H */
diff --git a/gr-blocks/include/blocks/float_to_uchar.h b/gr-blocks/include/blocks/float_to_uchar.h
new file mode 100644
index 000000000..b5d0d08f7
--- /dev/null
+++ b/gr-blocks/include/blocks/float_to_uchar.h
@@ -0,0 +1,49 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_BLOCKS_FLOAT_TO_UCHAR_H
+#define INCLUDED_BLOCKS_FLOAT_TO_UCHAR_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief Convert stream of floats to a stream of unsigned chars
+ * \ingroup converter_blk
+ */
+ class BLOCKS_API float_to_uchar : virtual public gr_sync_block
+ {
+ public:
+
+ // gr::blocks::float_to_uchar_ff::sptr
+ typedef boost::shared_ptr<float_to_uchar> sptr;
+
+ static sptr make();
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_BLOCKS_FLOAT_TO_UCHAR_H */
diff --git a/gr-blocks/include/blocks/int_to_float.h b/gr-blocks/include/blocks/int_to_float.h
new file mode 100644
index 000000000..ebee1c3c9
--- /dev/null
+++ b/gr-blocks/include/blocks/int_to_float.h
@@ -0,0 +1,62 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_BLOCKS_INT_TO_FLOAT_H
+#define INCLUDED_BLOCKS_INT_TO_FLOAT_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief Convert stream of ints to a stream of floats
+ * \ingroup converter_blk
+ *
+ * \param vlen vector length of data streams.
+ * \param scale a scalar divider to change the output signal scale.
+ */
+ class BLOCKS_API int_to_float : virtual public gr_sync_block
+ {
+ public:
+
+ // gr::blocks::int_to_float_ff::sptr
+ typedef boost::shared_ptr<int_to_float> sptr;
+
+ static sptr make(size_t vlen=1, float scale=1.0);
+
+ /*!
+ * Get the scalar divider value.
+ */
+ virtual float scale() const = 0;
+
+ /*!
+ * Set the scalar divider value.
+ */
+ virtual void set_scale(float scale) = 0;
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_BLOCKS_INT_TO_FLOAT_H */
diff --git a/gr-blocks/include/blocks/integrate_XX.h.t b/gr-blocks/include/blocks/integrate_XX.h.t
new file mode 100644
index 000000000..8a313a0ba
--- /dev/null
+++ b/gr-blocks/include/blocks/integrate_XX.h.t
@@ -0,0 +1,51 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2009,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 <blocks/api.h>
+#include <gr_sync_decimator.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief Integrate successive samples and decimate
+ * \ingroup math_blk
+ */
+ class BLOCKS_API @NAME@ : virtual public gr_sync_decimator
+ {
+ public:
+
+ // gr::blocks::@NAME@::sptr
+ typedef boost::shared_ptr<@NAME@> sptr;
+
+ static sptr make(int decim);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* @GUARD_NAME@ */
diff --git a/gr-blocks/include/blocks/interleave.h b/gr-blocks/include/blocks/interleave.h
new file mode 100644
index 000000000..e98d01df9
--- /dev/null
+++ b/gr-blocks/include/blocks/interleave.h
@@ -0,0 +1,50 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_BLOCKS_INTERLEAVE_H
+#define INCLUDED_BLOCKS_INTERLEAVE_H
+
+#include <blocks/api.h>
+#include <gr_sync_interpolator.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief interleave N inputs into a single output
+ * \ingroup slicedice_blk
+ * \param itemsize stream itemsize
+ */
+ class BLOCKS_API interleave : virtual public gr_sync_interpolator
+ {
+ public:
+
+ // gr::blocks::interleave::sptr
+ typedef boost::shared_ptr<interleave> sptr;
+
+ static sptr make(size_t itemsize);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_BLOCKS_INTERLEAVE_H */
diff --git a/gr-blocks/include/blocks/interleaved_short_to_complex.h b/gr-blocks/include/blocks/interleaved_short_to_complex.h
new file mode 100644
index 000000000..40e96fc46
--- /dev/null
+++ b/gr-blocks/include/blocks/interleaved_short_to_complex.h
@@ -0,0 +1,49 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_BLOCKS_INTERLEAVED_SHORT_TO_COMPLEX_H
+#define INCLUDED_BLOCKS_INTERLEAVED_SHORT_TO_COMPLEX_H
+
+#include <blocks/api.h>
+#include <gr_sync_decimator.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief Convert stream of interleaved shorts to a stream of complex
+ * \ingroup converter_blk
+ */
+ class BLOCKS_API interleaved_short_to_complex : virtual public gr_sync_decimator
+ {
+ public:
+
+ // gr::blocks::interleaved_short_to_complex::sptr
+ typedef boost::shared_ptr<interleaved_short_to_complex> sptr;
+
+ static sptr make();
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_BLOCKS_INTERLEAVED_SHORT_TO_COMPLEX_H */
diff --git a/gr-blocks/include/blocks/keep_m_in_n.h b/gr-blocks/include/blocks/keep_m_in_n.h
new file mode 100644
index 000000000..806ec3de5
--- /dev/null
+++ b/gr-blocks/include/blocks/keep_m_in_n.h
@@ -0,0 +1,53 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_BLOCKS_KEEP_M_IN_N_H
+#define INCLUDED_BLOCKS_KEEP_M_IN_N_H
+
+#include <blocks/api.h>
+#include <gr_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief decimate a stream, keeping one item out of every n.
+ * \ingroup slicedice_blk
+ */
+ class BLOCKS_API keep_m_in_n : virtual public gr_block
+ {
+ public:
+
+ // gr::blocks::keep_m_in_n::sptr
+ typedef boost::shared_ptr<keep_m_in_n> sptr;
+
+ static sptr make(size_t itemsize, int m, int n, int offset);
+
+ virtual void set_m(int m) = 0;
+ virtual void set_n(int n) = 0;
+ virtual void set_offset(int offset) = 0;
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_BLOCKS_KEEP_M_IN_N_H */
diff --git a/gr-blocks/include/blocks/keep_one_in_n.h b/gr-blocks/include/blocks/keep_one_in_n.h
new file mode 100644
index 000000000..c48784994
--- /dev/null
+++ b/gr-blocks/include/blocks/keep_one_in_n.h
@@ -0,0 +1,51 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_BLOCKS_KEEP_ONE_IN_N_H
+#define INCLUDED_BLOCKS_KEEP_ONE_IN_N_H
+
+#include <blocks/api.h>
+#include <gr_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief decimate a stream, keeping one item out of every n.
+ * \ingroup slicedice_blk
+ */
+ class BLOCKS_API keep_one_in_n : virtual public gr_block
+ {
+ public:
+
+ // gr::blocks::keep_one_in_n::sptr
+ typedef boost::shared_ptr<keep_one_in_n> sptr;
+
+ static sptr make(size_t itemsize, int n);
+
+ virtual void set_n(int n) = 0;
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_BLOCKS_KEEP_ONE_IN_N_H */
diff --git a/gr-blocks/include/blocks/log2_const.h b/gr-blocks/include/blocks/log2_const.h
new file mode 100644
index 000000000..67d63810f
--- /dev/null
+++ b/gr-blocks/include/blocks/log2_const.h
@@ -0,0 +1,53 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006,2013 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.
+ */
+
+
+/*
+ * a bit of template hackery...
+ */
+#ifndef INCLUDED_BLOCKS_LOG2_CONST_H
+#define INCLUDED_BLOCKS_LOG2_CONST_H
+
+#include <blocks/api.h>
+#include <assert.h>
+
+namespace gr {
+ namespace blocks {
+
+ template<unsigned int k> static inline int log2_const() { assert(0); return 0; }
+
+ template<> inline int log2_const<1>() { return 0; }
+ template<> inline int log2_const<2>() { return 1; }
+ template<> inline int log2_const<4>() { return 2; }
+ template<> inline int log2_const<8>() { return 3; }
+ template<> inline int log2_const<16>() { return 4; }
+ template<> inline int log2_const<32>() { return 5; }
+ template<> inline int log2_const<64>() { return 6; }
+ template<> inline int log2_const<128>() { return 7; }
+ template<> inline int log2_const<256>() { return 8; }
+ template<> inline int log2_const<512>() { return 9; }
+ template<> inline int log2_const<1024>(){ return 10; }
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_BLOCKS_LOG2_CONST_H */
diff --git a/gr-blocks/include/blocks/multiply_XX.h.t b/gr-blocks/include/blocks/multiply_XX.h.t
new file mode 100644
index 000000000..47ed3746c
--- /dev/null
+++ b/gr-blocks/include/blocks/multiply_XX.h.t
@@ -0,0 +1,53 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004, 2009, 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 <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief output = prod (input_0, input_1, ...)
+ * \ingroup math_blk
+ *
+ * Multiply across all input streams.
+ */
+ class BLOCKS_API @NAME@ : virtual public gr_sync_block
+ {
+ public:
+
+ // gr::blocks::@NAME@::sptr
+ typedef boost::shared_ptr<@NAME@> sptr;
+
+ static sptr make(size_t vlen=1);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* @GUARD_NAME@ */
diff --git a/gr-blocks/include/blocks/multiply_cc.h b/gr-blocks/include/blocks/multiply_cc.h
new file mode 100644
index 000000000..559fcda57
--- /dev/null
+++ b/gr-blocks/include/blocks/multiply_cc.h
@@ -0,0 +1,50 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_GR_MULTIPLY_CC_H
+#define INCLUDED_GR_MULTIPLY_CC_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ class BLOCKS_API multiply_cc : virtual public gr_sync_block
+ {
+ public:
+
+ // gr::blocks::multiply_cc::sptr
+ typedef boost::shared_ptr<multiply_cc> sptr;
+
+ /*!
+ * \brief Multiply streams of complex values
+ * \param vlen Vector length
+ * \ingroup math_blk
+ */
+ static sptr make(size_t vlen=1);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_BLOCKS_MULTIPLY_CC_H */
diff --git a/gr-blocks/include/blocks/multiply_conjugate_cc.h b/gr-blocks/include/blocks/multiply_conjugate_cc.h
new file mode 100644
index 000000000..fc587ae2f
--- /dev/null
+++ b/gr-blocks/include/blocks/multiply_conjugate_cc.h
@@ -0,0 +1,50 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_GR_MULTIPLY_CONJUGATE_CC_H
+#define INCLUDED_GR_MULTIPLY_CONJUGATE_CC_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ class BLOCKS_API multiply_conjugate_cc : virtual public gr_sync_block
+ {
+ public:
+
+ // gr::blocks::multiply_conjugate_cc::sptr
+ typedef boost::shared_ptr<multiply_conjugate_cc> sptr;
+
+ /*!
+ * \brief Multiplies a streams by the conjugate of a second stream
+ * \param vlen Vector length
+ * \ingroup math_blk
+ */
+ static sptr make(size_t vlen=1);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_BLOCKS_MULTIPLY_CONJUGATE_CC_H */
diff --git a/gr-blocks/include/blocks/multiply_const_XX.h.t b/gr-blocks/include/blocks/multiply_const_XX.h.t
new file mode 100644
index 000000000..a7cd3a858
--- /dev/null
+++ b/gr-blocks/include/blocks/multiply_const_XX.h.t
@@ -0,0 +1,66 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,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 <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief output = input * constant
+ * \ingroup math_blk
+ */
+ class BLOCKS_API @NAME@ : virtual public gr_sync_block
+ {
+
+ public:
+
+ // gr::blocks::@NAME@::sptr
+ typedef boost::shared_ptr<@NAME@> sptr;
+
+ /*!
+ * \brief Create an instance of @NAME@
+ * \param k multiplicative constant
+ */
+ static sptr make(@O_TYPE@ k);
+
+ /*!
+ * \brief Return multiplicative constant
+ */
+ virtual @O_TYPE@ k() const = 0;
+
+ /*!
+ * \brief Set multiplicative constant
+ */
+ virtual void set_k(@O_TYPE@ k) = 0;
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* @GUARD_NAME */
diff --git a/gr-blocks/include/blocks/multiply_const_cc.h b/gr-blocks/include/blocks/multiply_const_cc.h
new file mode 100644
index 000000000..9572eaec7
--- /dev/null
+++ b/gr-blocks/include/blocks/multiply_const_cc.h
@@ -0,0 +1,67 @@
+/* -*- 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 INCLUDED_MULTIPLY_CONST_CC_H
+#define INCLUDED_MULTIPLY_CONST_CC_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief output = input * complex constant
+ * \ingroup math_blk
+ */
+ class BLOCKS_API multiply_const_cc : virtual public gr_sync_block
+ {
+
+ public:
+
+ // gr::blocks::multiply_const_cc::sptr
+ typedef boost::shared_ptr<multiply_const_cc> sptr;
+
+ /*!
+ * \brief Create an instance of multiply_const_cc
+ * \param k complex multiplicative constant
+ * \param vlen Vector length of incoming stream
+ */
+ static sptr make(gr_complex k, size_t vlen=1);
+
+ /*!
+ * \brief Return complex multiplicative constant
+ */
+ virtual gr_complex k() const = 0;
+
+ /*!
+ * \brief Set complex multiplicative constant
+ */
+ virtual void set_k(gr_complex k) = 0;
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_MULTIPLY_CONST_CC_H */
diff --git a/gr-blocks/include/blocks/multiply_const_ff.h b/gr-blocks/include/blocks/multiply_const_ff.h
new file mode 100644
index 000000000..d2d5e805c
--- /dev/null
+++ b/gr-blocks/include/blocks/multiply_const_ff.h
@@ -0,0 +1,67 @@
+/* -*- 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 INCLUDED_MULTIPLY_CONST_FF_H
+#define INCLUDED_MULTIPLY_CONST_FF_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief output = input * real constant
+ * \ingroup math_blk
+ */
+ class BLOCKS_API multiply_const_ff : virtual public gr_sync_block
+ {
+
+ public:
+
+ // gr::blocks::multiply_const_ff::sptr
+ typedef boost::shared_ptr<multiply_const_ff> sptr;
+
+ /*!
+ * \brief Create an instance of multiply_const_ff
+ * \param k real multiplicative constant
+ * \param vlen Vector length of incoming stream
+ */
+ static sptr make(float k, size_t vlen=1);
+
+ /*!
+ * \brief Return real multiplicative constant
+ */
+ virtual float k() const = 0;
+
+ /*!
+ * \brief Set real multiplicative constant
+ */
+ virtual void set_k(float k) = 0;
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_MULTIPLY_CONST_FF_H */
diff --git a/gr-blocks/include/blocks/multiply_const_vXX.h.t b/gr-blocks/include/blocks/multiply_const_vXX.h.t
new file mode 100644
index 000000000..4cd479f00
--- /dev/null
+++ b/gr-blocks/include/blocks/multiply_const_vXX.h.t
@@ -0,0 +1,66 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2006,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.
+ */
+
+// @WARNING@
+
+#ifndef @GUARD_NAME@
+#define @GUARD_NAME@
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief output = input * constant vector (element-wise)
+ * \ingroup math_blk
+ */
+ class BLOCKS_API @NAME@ : virtual public gr_sync_block
+ {
+
+ public:
+
+ // gr::blocks::@NAME@::sptr
+ typedef boost::shared_ptr<@NAME@> sptr;
+
+ /*!
+ * \brief Create an instance of @NAME@
+ * \param k multiplicative constant vector
+ */
+ static sptr make(std::vector<@O_TYPE@> k);
+
+ /*!
+ * \brief Return multiplicative constant vector
+ */
+ virtual std::vector<@O_TYPE@> k() const = 0;
+
+ /*!
+ * \brief Set multiplicative constant vector
+ */
+ virtual void set_k(std::vector<@O_TYPE@> k) = 0;
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* @GUARD_NAME@ */
diff --git a/gr-blocks/include/blocks/multiply_ff.h b/gr-blocks/include/blocks/multiply_ff.h
new file mode 100644
index 000000000..683b540bb
--- /dev/null
+++ b/gr-blocks/include/blocks/multiply_ff.h
@@ -0,0 +1,50 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_GR_MULTIPLY_FF_H
+#define INCLUDED_GR_MULTIPLY_FF_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ class BLOCKS_API multiply_ff : virtual public gr_sync_block
+ {
+ public:
+
+ // gr::blocks::multiply_ff::sptr
+ typedef boost::shared_ptr<multiply_ff> sptr;
+
+ /*!
+ * \brief Multiply streams of float values
+ * \param vlen Vector length
+ * \ingroup math_blk
+ */
+ static sptr make(size_t vlen=1);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_BLOCKS_MULTIPLY_FF_H */
diff --git a/gr-blocks/include/blocks/nlog10_ff.h b/gr-blocks/include/blocks/nlog10_ff.h
new file mode 100644
index 000000000..cedd620fa
--- /dev/null
+++ b/gr-blocks/include/blocks/nlog10_ff.h
@@ -0,0 +1,55 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_BLOCKS_NLOG10_FF_H
+#define INCLUDED_BLOCKS_NLOG10_FF_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief output = n*log10(input) + k
+ * \ingroup math_blk
+ */
+ class BLOCKS_API nlog10_ff : virtual public gr_sync_block
+ {
+ public:
+
+ // gr::blocks::nlog10_ff::sptr
+ typedef boost::shared_ptr<nlog10_ff> sptr;
+
+ /*!
+ * \brief Make an instance of an nlog10_ff block.
+ * \param n Scalar multiplicative constant
+ * \param vlen Input vector length
+ * \param k Scalar additive constant
+ */
+ static sptr make(float n=1.0, size_t vlen=1, float k=0.0);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_BLOCKS_NLOG10_FF_H */
diff --git a/gr-blocks/include/blocks/not_XX.h.t b/gr-blocks/include/blocks/not_XX.h.t
new file mode 100644
index 000000000..e406c82dc
--- /dev/null
+++ b/gr-blocks/include/blocks/not_XX.h.t
@@ -0,0 +1,53 @@
+/* -*- 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 <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief output = ~input
+ * \ingroup math_blk
+ *
+ * bitwise boolean not of input streams.
+ */
+ class BLOCKS_API @NAME@ : virtual public gr_sync_block
+ {
+ public:
+
+ // gr::blocks::@NAME@::sptr
+ typedef boost::shared_ptr<@NAME@> sptr;
+
+ static sptr make(size_t vlen=1);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* @GUARD_NAME@ */
diff --git a/gr-blocks/include/blocks/or_XX.h.t b/gr-blocks/include/blocks/or_XX.h.t
new file mode 100644
index 000000000..8bc9a080f
--- /dev/null
+++ b/gr-blocks/include/blocks/or_XX.h.t
@@ -0,0 +1,53 @@
+/* -*- 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 <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief output = input_0 | input_1 | , ... | input_N)
+ * \ingroup math_blk
+ *
+ * Bitwise boolean or across all input streams.
+ */
+ class BLOCKS_API @NAME@ : virtual public gr_sync_block
+ {
+ public:
+
+ // gr::blocks::@NAME@::sptr
+ typedef boost::shared_ptr<@NAME@> sptr;
+
+ static sptr make(size_t vlen=1);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* @GUARD_NAME@ */
diff --git a/gr-blocks/include/blocks/packed_to_unpacked_XX.h.t b/gr-blocks/include/blocks/packed_to_unpacked_XX.h.t
new file mode 100644
index 000000000..9ab8b8bdf
--- /dev/null
+++ b/gr-blocks/include/blocks/packed_to_unpacked_XX.h.t
@@ -0,0 +1,73 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006,2013 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 <blocks/api.h>
+#include <gr_block.h>
+#include <gr_endianness.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \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::blocks::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::blocks::packed_to_unpacked_bb, gr::blocks::unpacked_to_packed_bb,
+ * \sa gr::blocks::packed_to_unpacked_ss, gr::blocks::unpacked_to_packed_ss,
+ * \sa gr::blocks::chunks_to_symbols_bf, gr::blocks::chunks_to_symbols_bc.
+ * \sa gr::blocks::chunks_to_symbols_sf, gr::blocks::chunks_to_symbols_sc.
+ */
+ class BLOCKS_API @NAME@ : virtual public gr_block
+ {
+ public:
+ // gr::blocks::@NAME@::sptr
+ typedef boost::shared_ptr<@NAME@> sptr;
+
+ static sptr make(unsigned int bits_per_chunk,
+ gr_endianness_t endianness);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* @GUARD_NAME@ */
diff --git a/gr-blocks/include/blocks/patterned_interleaver.h b/gr-blocks/include/blocks/patterned_interleaver.h
new file mode 100644
index 000000000..cfcdac6e7
--- /dev/null
+++ b/gr-blocks/include/blocks/patterned_interleaver.h
@@ -0,0 +1,23 @@
+#ifndef INCLUDED_BLOCKS_PATTERNED_INTERLEAVER_H
+#define INCLUDED_BLOCKS_PATTERNED_INTERLEAVER_H
+
+#include <blocks/api.h>
+#include <gr_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ class BLOCKS_API patterned_interleaver : virtual public gr_block
+ {
+ public:
+
+ typedef boost::shared_ptr<patterned_interleaver> sptr;
+
+ static sptr make(size_t itemsize, std::vector<int> pattern);
+ };
+
+ }
+}
+
+#endif
+
diff --git a/gr-blocks/include/blocks/peak_detector2_fb.h b/gr-blocks/include/blocks/peak_detector2_fb.h
new file mode 100644
index 000000000..71afc3287
--- /dev/null
+++ b/gr-blocks/include/blocks/peak_detector2_fb.h
@@ -0,0 +1,91 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007,2013 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_PEAK_DETECTOR2_FB_H
+#define INCLUDED_GR_PEAK_DETECTOR2_FB_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \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. A separate debug output may be connected, to view the
+ * internal EWMA described below.
+ *
+ * \param threshold_factor_rise The threshold factor determins
+ * when a peak is present. An EWMA average of the signal is
+ * calculated and when the value of the signal goes over
+ * threshold_factor_rise*average, we call the peak.
+ * \param look_ahead The look-ahead value is used when the
+ * threshold is found to locate the peak within this range.
+ * \param alpha The gain value of a single-pole moving average filter.
+ */
+ class BLOCKS_API peak_detector2_fb : virtual public gr_sync_block
+ {
+ public:
+ // gr::blocks::peak_detector2_fb::sptr
+ typedef boost::shared_ptr<peak_detector2_fb> sptr;
+
+ static sptr make(float threshold_factor_rise=7,
+ int look_ahead=1000, float alpha=0.001);
+
+ /*! \brief Set the threshold factor value for the rise time
+ * \param thr new threshold factor
+ */
+ virtual void set_threshold_factor_rise(float thr) = 0;
+
+ /*! \brief Set the look-ahead factor
+ * \param look new look-ahead factor
+ */
+ virtual void set_look_ahead(int look) = 0;
+
+ /*! \brief Set the running average alpha
+ * \param alpha new alpha for running average
+ */
+ virtual void set_alpha(int alpha) = 0;
+
+ /*! \brief Get the threshold factor value for the rise time
+ * \return threshold factor
+ */
+ virtual float threshold_factor_rise() = 0;
+
+ /*! \brief Get the look-ahead factor value
+ * \return look-ahead factor
+ */
+ virtual int look_ahead() = 0;
+
+ /*! \brief Get the alpha value of the running average
+ * \return alpha
+ */
+ virtual float alpha() = 0;
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_PEAK_DETECTOR2_FB_H */
diff --git a/gr-blocks/include/blocks/regenerate_bb.h b/gr-blocks/include/blocks/regenerate_bb.h
new file mode 100644
index 000000000..3063e70a7
--- /dev/null
+++ b/gr-blocks/include/blocks/regenerate_bb.h
@@ -0,0 +1,80 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007,2013 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_REGENERATE_BB_H
+#define INCLUDED_GR_REGENERATE_BB_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief Detect the peak of a signal and repeat every period samples
+ * \ingroup level_blk
+ *
+ * If a peak is detected, this block outputs a 1 repeated every
+ * period samples until reset by detection of another 1 on the
+ * input or stopped after max_regen regenerations have occurred.
+ *
+ * Note that if max_regen=(-1)/ULONG_MAX then the regeneration
+ * will run forever.
+ */
+ class BLOCKS_API regenerate_bb : virtual public gr_sync_block
+ {
+ public:
+ // gr::blocks::regenerate_bb::sptr
+ typedef boost::shared_ptr<regenerate_bb> sptr;
+
+ /*!
+ * \brief Make a regenerate block
+ * \param period The number of samples between regenerations
+ * \param max_regen The maximum number of regenerations to
+ * perform; if set to ULONG_MAX, it will regenerate
+ * continuously.
+ */
+ static sptr make(int period, unsigned int max_regen=500);
+
+ /*! \brief Reset the maximum regeneration count; this will reset
+ the current regen.
+ */
+ virtual void set_max_regen(unsigned int regen) = 0;
+
+ /*! \brief Reset the period of regenerations; this will reset
+ the current regen.
+ */
+ virtual void set_period(int period) = 0;
+
+ /*! \brief return the maximum regeneration count.
+ */
+ virtual unsigned int max_regen() const = 0;
+
+ /*! \brief return the regeneration period.
+ */
+ virtual int period() const = 0;
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_REGENERATE_BB_H */
diff --git a/gr-blocks/include/blocks/repeat.h b/gr-blocks/include/blocks/repeat.h
new file mode 100644
index 000000000..3f9f8e6fc
--- /dev/null
+++ b/gr-blocks/include/blocks/repeat.h
@@ -0,0 +1,51 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_BLOCKS_REPEAT_H
+#define INCLUDED_BLOCKS_REPEAT_H
+
+#include <blocks/api.h>
+#include <gr_sync_interpolator.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief repeat each input 'interp' times
+ * \ingroup slicedice_blk
+ * \param itemsize stream itemsize
+ * \param interp number of times to repeat
+ */
+ class BLOCKS_API repeat : virtual public gr_sync_interpolator
+ {
+ public:
+
+ // gr::blocks::repeat::sptr
+ typedef boost::shared_ptr<repeat> sptr;
+
+ static sptr make(size_t itemsize, int repeat);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_BLOCKS_REPEAT_H */
diff --git a/gr-blocks/include/blocks/rms_cf.h b/gr-blocks/include/blocks/rms_cf.h
new file mode 100644
index 000000000..e73be6923
--- /dev/null
+++ b/gr-blocks/include/blocks/rms_cf.h
@@ -0,0 +1,54 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005,2013 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_BLOCKS_RMS_CF_H
+#define INCLUDED_BLOCKS_RMS_CF_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief RMS average power
+ * \ingroup math_blk
+ */
+ class BLOCKS_API rms_cf : virtual public gr_sync_block
+ {
+ public:
+ // gr::blocks::rms_cf::sptr
+ typedef boost::shared_ptr<rms_cf> sptr;
+
+ /*!
+ * \brief Make an RMS calc. block.
+ * \param alpha gain for running average filter.
+ */
+ static sptr make(double alpha = 0.0001);
+
+ virtual void set_alpha(double alpha) = 0;
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_BLOCKS_RMS_CF_H */
diff --git a/gr-blocks/include/blocks/rms_ff.h b/gr-blocks/include/blocks/rms_ff.h
new file mode 100644
index 000000000..19fb0016d
--- /dev/null
+++ b/gr-blocks/include/blocks/rms_ff.h
@@ -0,0 +1,53 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005,2013 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_BLOCKS_RMS_FF_H
+#define INCLUDED_BLOCKS_RMS_FF_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief RMS average power
+ * \ingroup math_blk
+ */
+ class BLOCKS_API rms_ff : virtual public gr_sync_block
+ {
+ public:
+ // gr::blocks::rms_ff::sptr
+ typedef boost::shared_ptr<rms_ff> sptr;
+
+ /*!
+ * \brief Make an RMS calc. block.
+ * \param alpha gain for running average filter.
+ */
+ static sptr make(double alpha = 0.0001);
+
+ virtual void set_alpha(double alpha) = 0;
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_BLOCKS_RMS_FF_H */
diff --git a/gr-blocks/include/blocks/short_to_char.h b/gr-blocks/include/blocks/short_to_char.h
new file mode 100644
index 000000000..eeb053b0e
--- /dev/null
+++ b/gr-blocks/include/blocks/short_to_char.h
@@ -0,0 +1,51 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_BLOCKS_SHORT_TO_CHAR_H
+#define INCLUDED_BLOCKS_SHORT_TO_CHAR_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief Convert stream of shorts to a stream of chars
+ * \ingroup converter_blk
+ *
+ * \param vlen vector length of data streams.
+ */
+ class BLOCKS_API short_to_char : virtual public gr_sync_block
+ {
+ public:
+
+ // gr::blocks::short_to_char_ff::sptr
+ typedef boost::shared_ptr<short_to_char> sptr;
+
+ static sptr make(size_t vlen=1);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_BLOCKS_SHORT_TO_CHAR_H */
diff --git a/gr-blocks/include/blocks/short_to_float.h b/gr-blocks/include/blocks/short_to_float.h
new file mode 100644
index 000000000..c26addcd0
--- /dev/null
+++ b/gr-blocks/include/blocks/short_to_float.h
@@ -0,0 +1,62 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_BLOCKS_SHORT_TO_FLOAT_H
+#define INCLUDED_BLOCKS_SHORT_TO_FLOAT_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief Convert stream of shorts to a stream of floats
+ * \ingroup converter_blk
+ *
+ * \param vlen vector length of data streams.
+ * \param scale a scalar divider to change the output signal scale.
+ */
+ class BLOCKS_API short_to_float : virtual public gr_sync_block
+ {
+ public:
+
+ // gr::blocks::short_to_float_ff::sptr
+ typedef boost::shared_ptr<short_to_float> sptr;
+
+ static sptr make(size_t vlen=1, float scale=1.0);
+
+ /*!
+ * Get the scalar divider value.
+ */
+ virtual float scale() const = 0;
+
+ /*!
+ * Set the scalar divider value.
+ */
+ virtual void set_scale(float scale) = 0;
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_BLOCKS_SHORT_TO_FLOAT_H */
diff --git a/gr-blocks/include/blocks/stream_mux.h b/gr-blocks/include/blocks/stream_mux.h
new file mode 100644
index 000000000..58d564f9f
--- /dev/null
+++ b/gr-blocks/include/blocks/stream_mux.h
@@ -0,0 +1,69 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_BLOCKS_STREAM_MUX_H
+#define INCLUDED_BLOCKS_STREAM_MUX_H
+
+#include <blocks/api.h>
+#include <gr_block.h>
+#include <vector>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief Stream muxing block to multiplex many streams into
+ * one with a specified format.
+ *
+ * Muxes N streams together producing an output stream that
+ * contains N0 items from the first stream, N1 items from the second,
+ * etc. and repeats:
+ *
+ * [N0, N1, N2, ..., Nm, N0, N1, ...]
+ */
+ class BLOCKS_API stream_mux : virtual public gr_block
+ {
+ public:
+
+ // gr::blocks::stream_mux::sptr
+ typedef boost::shared_ptr<stream_mux> sptr;
+
+ /*!
+ * \brief Creates a stream muxing block to multiplex many streams into
+ * one with a specified format.
+ * \ingroup converter_blk
+ *
+ * \param itemsize the item size of the stream
+ * \param lengths a vector (list/tuple) specifying the number of
+ * items from each stream the mux together.
+ * Warning: this requires that at least as many items
+ * per stream are available or the system will wait
+ * indefinitely for the items.
+ *
+ */
+ static sptr make(size_t itemsize, const std::vector<int> &lengths);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_BLOCKS_STREAM_MUX_H */
diff --git a/gr-blocks/include/blocks/stream_to_streams.h b/gr-blocks/include/blocks/stream_to_streams.h
new file mode 100644
index 000000000..fc39f1687
--- /dev/null
+++ b/gr-blocks/include/blocks/stream_to_streams.h
@@ -0,0 +1,52 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_BLOCKS_STREAM_TO_STREAMS_H
+#define INCLUDED_BLOCKS_STREAM_TO_STREAMS_H
+
+#include <blocks/api.h>
+#include <gr_sync_decimator.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief convert a stream of items into a N streams of items
+ * \ingroup slicedice_blk
+ *
+ * Converts a stream of N items into N streams of 1 item.
+ * Repeat ad infinitum.
+ */
+ class BLOCKS_API stream_to_streams : virtual public gr_sync_decimator
+ {
+ public:
+
+ // gr::blocks::stream_to_streams::sptr
+ typedef boost::shared_ptr<stream_to_streams> sptr;
+
+ static sptr make(size_t itemsize, size_t nstreams);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_BLOCKS_STREAM_TO_STREAMS_H */
diff --git a/gr-blocks/include/blocks/stream_to_vector.h b/gr-blocks/include/blocks/stream_to_vector.h
new file mode 100644
index 000000000..8311eb350
--- /dev/null
+++ b/gr-blocks/include/blocks/stream_to_vector.h
@@ -0,0 +1,49 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_BLOCKS_STREAM_TO_VECTOR_H
+#define INCLUDED_BLOCKS_STREAM_TO_VECTOR_H
+
+#include <blocks/api.h>
+#include <gr_sync_decimator.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief convert a stream of items into a stream of blocks containing nitems_per_block
+ * \ingroup slicedice_blk
+ */
+ class BLOCKS_API stream_to_vector : virtual public gr_sync_decimator
+ {
+ public:
+
+ // gr::blocks::stream_to_vector::sptr
+ typedef boost::shared_ptr<stream_to_vector> sptr;
+
+ static sptr make(size_t itemsize, size_t nitems_per_block);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_BLOCKS_STREAM_TO_VECTOR_H */
diff --git a/gr-blocks/include/blocks/streams_to_stream.h b/gr-blocks/include/blocks/streams_to_stream.h
new file mode 100644
index 000000000..01dcd1be3
--- /dev/null
+++ b/gr-blocks/include/blocks/streams_to_stream.h
@@ -0,0 +1,52 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_BLOCKS_STREAMS_TO_STREAM_H
+#define INCLUDED_BLOCKS_STREAMS_TO_STREAM_H
+
+#include <blocks/api.h>
+#include <gr_sync_interpolator.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief Convert N streams of 1 item into a 1 stream of N items
+ * \ingroup slicedice_blk
+ *
+ * Convert N streams of 1 item into 1 stream of N items.
+ * Repeat ad infinitum.
+ */
+ class BLOCKS_API streams_to_stream : virtual public gr_sync_interpolator
+ {
+ public:
+
+ // gr::blocks::streams_to_stream::sptr
+ typedef boost::shared_ptr<streams_to_stream> sptr;
+
+ static sptr make(size_t itemsize, size_t nstreams);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_BLOCKS_STREAMS_TO_STREAM_H */
diff --git a/gr-blocks/include/blocks/streams_to_vector.h b/gr-blocks/include/blocks/streams_to_vector.h
new file mode 100644
index 000000000..ad55ac31f
--- /dev/null
+++ b/gr-blocks/include/blocks/streams_to_vector.h
@@ -0,0 +1,49 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_BLOCKS_STREAMS_TO_VECTOR_H
+#define INCLUDED_BLOCKS_STREAMS_TO_VECTOR_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief convert N streams of items to 1 stream of vector length N
+ * \ingroup slicedice_blk
+ */
+ class BLOCKS_API streams_to_vector : virtual public gr_sync_block
+ {
+ public:
+
+ // gr::blocks::streams_to_vector::sptr
+ typedef boost::shared_ptr<streams_to_vector> sptr;
+
+ static sptr make(size_t itemsize, size_t nstreams);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_BLOCKS_STREAMS_TO_VECTOR_H */
diff --git a/gr-blocks/include/blocks/stretch_ff.h b/gr-blocks/include/blocks/stretch_ff.h
new file mode 100644
index 000000000..5f98452a4
--- /dev/null
+++ b/gr-blocks/include/blocks/stretch_ff.h
@@ -0,0 +1,59 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,2013 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_STRETCH_FF_H
+#define INCLUDED_GR_STRETCH_FF_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief adjust y-range of an input vector by mapping to range
+ * (max-of-input, stipulated-min). Primarily for spectral
+ * signature matching by normalizing spectrum dynamic ranges.
+ * \ingroup misc_blk
+ */
+ class BLOCKS_API stretch_ff : virtual public gr_sync_block
+ {
+ public:
+ // gr::blocks::stretch_ff::sptr
+ typedef boost::shared_ptr<stretch_ff> sptr;
+
+ /*!
+ * \brief Make a stretch block.
+ * \param lo Set low value for range.
+ * \param vlen vector length of input stream.
+ */
+ static sptr make(float lo, size_t vlen=1);
+
+ virtual float lo() const = 0;
+ virtual void set_lo(float lo) = 0;
+ virtual size_t vlen() const = 0;
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_STRETCH_FF_H */
diff --git a/gr-blocks/include/blocks/sub_XX.h.t b/gr-blocks/include/blocks/sub_XX.h.t
new file mode 100644
index 000000000..8202ac54b
--- /dev/null
+++ b/gr-blocks/include/blocks/sub_XX.h.t
@@ -0,0 +1,53 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2009,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 <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief output = input_0 - input_1 - ...)
+ * \ingroup math_blk
+ *
+ * Subtract across all input streams.
+ */
+ class BLOCKS_API @NAME@ : virtual public gr_sync_block
+ {
+ public:
+
+ // gr::blocks::@NAME@::sptr
+ typedef boost::shared_ptr<@NAME@> sptr;
+
+ static sptr make(size_t vlen=1);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* @GUARD_NAME@ */
diff --git a/gr-blocks/include/blocks/threshold_ff.h b/gr-blocks/include/blocks/threshold_ff.h
new file mode 100644
index 000000000..900e5c5bd
--- /dev/null
+++ b/gr-blocks/include/blocks/threshold_ff.h
@@ -0,0 +1,66 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2013 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_THRESHOLD_FF_H
+#define INCLUDED_GR_THRESHOLD_FF_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief Output a 1 or zero based on a threshold value.
+ * \ingroup misc_blk
+ *
+ * Test the incoming signal against a threshold. If the signal
+ * excedes the \p hi value, it will output a 1 until the signal
+ * falls below the \p lo value.
+ */
+ class BLOCKS_API threshold_ff : virtual public gr_sync_block
+ {
+ public:
+ // gr::blocks::threshold_ff::sptr
+ typedef boost::shared_ptr<threshold_ff> sptr;
+
+ /* \brief Create a threadshold block.
+ * \param lo Threshold input signal needs to drop below to
+ * change state to 0.
+ * \param hi Threshold input signal needs to rise above to
+ * change state to 1.
+ * \param initial_state Initial state of the block (0 or 1).
+ */
+ static sptr make(float lo, float hi, float initial_state=0);
+
+ virtual float lo () const = 0;
+ virtual void set_lo (float lo) = 0;
+ virtual float hi () const = 0;
+ virtual void set_hi (float hi) = 0;
+ virtual float last_state () const = 0;
+ virtual void set_last_state (float last_state) = 0;
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_THRESHOLD_FF_H */
diff --git a/gr-blocks/include/blocks/throttle.h b/gr-blocks/include/blocks/throttle.h
new file mode 100644
index 000000000..20d8037e1
--- /dev/null
+++ b/gr-blocks/include/blocks/throttle.h
@@ -0,0 +1,62 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005-2011,2013 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_THROTTLE_H
+#define INCLUDED_GR_THROTTLE_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief throttle flow of samples such that the average rate does
+ * not exceed samples_per_sec.
+ * \ingroup misc_blk
+ *
+ * input: one stream of itemsize; output: one stream of itemsize
+ *
+ * N.B. this should only be used in GUI apps where there is no
+ * other rate limiting block. It is not intended nor effective at
+ * precisely controlling the rate of samples. That should be
+ * controlled by a source or sink tied to sample clock. E.g., a
+ * USRP or audio card.
+ */
+ class BLOCKS_API throttle : virtual public gr_sync_block
+ {
+ public:
+ typedef boost::shared_ptr<throttle> sptr;
+
+ static sptr make(size_t itemsize, double samples_per_sec);
+
+ //! Sets the sample rate in samples per second.
+ virtual void set_sample_rate(double rate) = 0;
+
+ //! Get the sample rate in samples per second.
+ virtual double sample_rate() const = 0;
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_THROTTLE_H */
diff --git a/gr-blocks/include/blocks/transcendental.h b/gr-blocks/include/blocks/transcendental.h
new file mode 100644
index 000000000..f8a0d5d80
--- /dev/null
+++ b/gr-blocks/include/blocks/transcendental.h
@@ -0,0 +1,56 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2011,2013 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_TRANSCENDENTAL_H
+#define INCLUDED_GR_TRANSCENDENTAL_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+#include <string>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief A block that performs various transcendental math operations.
+ *
+ * Possible function names can be found in the cmath library. IO
+ * may be either complex or real, double or single precision.
+ *
+ * Possible type strings: float, double, complex_float, complex_double
+ *
+ * output[i] = trans_fcn(input[i])
+ */
+ class BLOCKS_API transcendental : virtual public gr_sync_block
+ {
+ public:
+ // gr::blocks::transcendental::sptr
+ typedef boost::shared_ptr<transcendental> sptr;
+
+ static sptr make(const std::string &name,
+ const std::string &type="float");
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_TRANSCENDENTAL_H */
diff --git a/gr-blocks/include/blocks/uchar_to_float.h b/gr-blocks/include/blocks/uchar_to_float.h
new file mode 100644
index 000000000..033037e49
--- /dev/null
+++ b/gr-blocks/include/blocks/uchar_to_float.h
@@ -0,0 +1,49 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_BLOCKS_UCHAR_TO_FLOAT_H
+#define INCLUDED_BLOCKS_UCHAR_TO_FLOAT_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief Convert stream of unsigned chars to a stream of floats
+ * \ingroup converter_blk
+ */
+ class BLOCKS_API uchar_to_float : virtual public gr_sync_block
+ {
+ public:
+
+ // gr::blocks::uchar_to_float_ff::sptr
+ typedef boost::shared_ptr<uchar_to_float> sptr;
+
+ static sptr make();
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_BLOCKS_UCHAR_TO_FLOAT_H */
diff --git a/gr-blocks/include/blocks/unpacked_to_packed_XX.h.t b/gr-blocks/include/blocks/unpacked_to_packed_XX.h.t
new file mode 100644
index 000000000..749f0e00f
--- /dev/null
+++ b/gr-blocks/include/blocks/unpacked_to_packed_XX.h.t
@@ -0,0 +1,72 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006,2013 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 <blocks/api.h>
+#include <gr_block.h>
+#include <gr_endianness.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \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::blocks::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::blocks::packed_to_unpacked_bb, gr::blocks::unpacked_to_packed_bb,
+ * \sa gr::blocks::packed_to_unpacked_ss, gr::blocks::unpacked_to_packed_ss,
+ * \sa gr::blocks::chunks_to_symbols_bf, gr::blocks::chunks_to_symbols_bc.
+ * \sa gr::blocks::chunks_to_symbols_sf, gr::blocks::chunks_to_symbols_sc.
+ */
+ class BLOCKS_API @NAME@ : virtual public gr_block
+ {
+ public:
+ // gr::blocks::@NAME@::sptr
+ typedef boost::shared_ptr<@NAME@> sptr;
+
+ static sptr make(unsigned int bits_per_chunk,
+ gr_endianness_t endianness);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* @GUARD_NAME@ */
diff --git a/gr-blocks/include/blocks/vector_to_stream.h b/gr-blocks/include/blocks/vector_to_stream.h
new file mode 100644
index 000000000..1e72f6d50
--- /dev/null
+++ b/gr-blocks/include/blocks/vector_to_stream.h
@@ -0,0 +1,49 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_BLOCKS_VECTOR_TO_STREAM_H
+#define INCLUDED_BLOCKS_VECTOR_TO_STREAM_H
+
+#include <blocks/api.h>
+#include <gr_sync_interpolator.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief convert a stream of blocks of nitems_per_block items into a stream of items
+ * \ingroup slicedice_blk
+ */
+ class BLOCKS_API vector_to_stream : virtual public gr_sync_interpolator
+ {
+ public:
+
+ // gr::blocks::vector_to_stream::sptr
+ typedef boost::shared_ptr<vector_to_stream> sptr;
+
+ static sptr make(size_t itemsize, size_t nitems_per_block);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_BLOCKS_VECTOR_TO_STREAM_H */
diff --git a/gr-blocks/include/blocks/vector_to_streams.h b/gr-blocks/include/blocks/vector_to_streams.h
new file mode 100644
index 000000000..1bc075879
--- /dev/null
+++ b/gr-blocks/include/blocks/vector_to_streams.h
@@ -0,0 +1,49 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_BLOCKS_VECTOR_TO_STREAMS_H
+#define INCLUDED_BLOCKS_VECTOR_TO_STREAMS_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief Convert 1 stream of vectors of length N to N streams of items
+ * \ingroup slicedice_blk
+ */
+ class BLOCKS_API vector_to_streams : virtual public gr_sync_block
+ {
+ public:
+
+ // gr::blocks::vector_to_streams::sptr
+ typedef boost::shared_ptr<vector_to_streams> sptr;
+
+ static sptr make(size_t itemsize, size_t nstreams);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_BLOCKS_VECTOR_TO_STREAMS_H */
diff --git a/gr-blocks/include/blocks/xor_XX.h.t b/gr-blocks/include/blocks/xor_XX.h.t
new file mode 100644
index 000000000..ba0c508f6
--- /dev/null
+++ b/gr-blocks/include/blocks/xor_XX.h.t
@@ -0,0 +1,53 @@
+/* -*- 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 <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief output = input_0 ^ input_1 ^ , ... ^ input_N)
+ * \ingroup math_blk
+ *
+ * Bitwise boolean xor across all input streams.
+ */
+ class BLOCKS_API @NAME@ : virtual public gr_sync_block
+ {
+ public:
+
+ // gr::blocks::@NAME@::sptr
+ typedef boost::shared_ptr<@NAME@> sptr;
+
+ static sptr make(size_t vlen=1);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* @GUARD_NAME@ */
diff --git a/gr-blocks/lib/CMakeLists.txt b/gr-blocks/lib/CMakeLists.txt
new file mode 100644
index 000000000..20e3ae4aa
--- /dev/null
+++ b/gr-blocks/lib/CMakeLists.txt
@@ -0,0 +1,201 @@
+# 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.
+
+########################################################################
+# Setup compatibility checks and defines
+########################################################################
+include(${CMAKE_CURRENT_SOURCE_DIR}/ConfigChecks.cmake)
+
+########################################################################
+# generate helper scripts to expand templated files
+########################################################################
+include(GrPython)
+
+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, 'blocks')
+ build_utils.expand_template(d, inp, '_impl')
+")
+
+macro(expand_cc_h_impl root)
+ #make a list of all the generated files
+ unset(expanded_files_cc_impl)
+ unset(expanded_files_h_impl)
+ foreach(sig ${ARGN})
+ string(REGEX REPLACE "X+" ${sig} name ${root})
+ list(APPEND expanded_files_cc_impl ${CMAKE_CURRENT_BINARY_DIR}/${name}_impl.cc)
+ list(APPEND expanded_files_h_impl ${CMAKE_CURRENT_BINARY_DIR}/${name}_impl.h)
+ list(APPEND expanded_files_h ${CMAKE_CURRENT_BINARY_DIR}/../include/${name}.h)
+ endforeach(sig)
+
+ #create a command to generate the _impl.cc files
+ add_custom_command(
+ OUTPUT ${expanded_files_cc_impl}
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${root}_impl.cc.t
+ COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B}
+ ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py
+ ${root} ${root}_impl.cc.t ${ARGN}
+ )
+
+ #create a command to generate the _impl.h files
+ add_custom_command(
+ OUTPUT ${expanded_files_h_impl}
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${root}_impl.h.t
+ COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B}
+ ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py
+ ${root} ${root}_impl.h.t ${ARGN}
+ )
+
+ #make _impl.cc source files depend on headers to force generation
+ set_source_files_properties(${expanded_files_cc_impl}
+ PROPERTIES OBJECT_DEPENDS "${expanded_files_h_impl}"
+ )
+
+ #make _impl.h source files depend on headers to force generation
+ set_source_files_properties(${expanded_files_h_impl}
+ PROPERTIES OBJECT_DEPENDS "${expanded_files_h}"
+ )
+
+ #install rules for the generated cc files
+ list(APPEND generated_sources ${expanded_files_cc_impl})
+endmacro(expand_cc_h_impl)
+
+########################################################################
+# Invoke macro to generate various sources
+########################################################################
+expand_cc_h_impl(add_XX ss ii cc)
+expand_cc_h_impl(add_const_XX ss ii ff cc)
+expand_cc_h_impl(add_const_vXX ss ii ff cc)
+expand_cc_h_impl(and_XX bb ss ii)
+expand_cc_h_impl(and_const_XX bb ss ii)
+expand_cc_h_impl(divide_XX ss ii ff cc)
+expand_cc_h_impl(integrate_XX ss ii ff cc)
+expand_cc_h_impl(multiply_XX ss ii)
+expand_cc_h_impl(multiply_const_XX ss ii)
+expand_cc_h_impl(multiply_const_vXX ss ii ff cc)
+expand_cc_h_impl(not_XX bb ss ii)
+expand_cc_h_impl(or_XX bb ss ii)
+expand_cc_h_impl(sub_XX ss ii ff cc)
+expand_cc_h_impl(xor_XX bb ss ii)
+expand_cc_h_impl(packed_to_unpacked_XX bb ss ii)
+expand_cc_h_impl(unpacked_to_packed_XX bb ss ii)
+
+########################################################################
+# Setup the include and linker paths
+########################################################################
+include_directories(
+ ${CMAKE_CURRENT_SOURCE_DIR}
+ ${CMAKE_CURRENT_BINARY_DIR}
+ ${CMAKE_CURRENT_BINARY_DIR}/../include
+ ${GR_BLOCKS_INCLUDE_DIRS}
+ ${GNURADIO_CORE_INCLUDE_DIRS}
+ ${VOLK_INCLUDE_DIRS}
+ ${GRUEL_INCLUDE_DIRS}
+ ${Boost_INCLUDE_DIRS}
+)
+
+link_directories(${Boost_LIBRARY_DIRS})
+
+########################################################################
+# Setup library
+########################################################################
+list(APPEND gr_blocks_sources
+ ${generated_sources}
+ count_bits.cc
+ add_ff_impl.cc
+ char_to_float_impl.cc
+ char_to_short_impl.cc
+ complex_to_interleaved_short_impl.cc
+ complex_to_float_impl.cc
+ complex_to_real_impl.cc
+ complex_to_imag_impl.cc
+ complex_to_mag_impl.cc
+ complex_to_mag_squared_impl.cc
+ complex_to_arg_impl.cc
+ conjugate_cc_impl.cc
+ deinterleave_impl.cc
+ delay_impl.cc
+ file_source_impl.cc
+ file_meta_sink_impl.cc
+ file_meta_source_impl.cc
+ float_to_char_impl.cc
+ float_to_complex_impl.cc
+ float_array_to_int.cc
+ float_to_int_impl.cc
+ float_to_short_impl.cc
+ float_array_to_uchar.cc
+ float_to_uchar_impl.cc
+ int_to_float_impl.cc
+ interleave_impl.cc
+ interleaved_short_array_to_complex.cc
+ interleaved_short_to_complex_impl.cc
+ keep_m_in_n_impl.cc
+ keep_one_in_n_impl.cc
+ multiply_cc_impl.cc
+ multiply_ff_impl.cc
+ multiply_conjugate_cc_impl.cc
+ multiply_const_cc_impl.cc
+ multiply_const_ff_impl.cc
+ nlog10_ff_impl.cc
+ patterned_interleaver_impl.cc
+ peak_detector2_fb_impl.cc
+ regenerate_bb_impl.cc
+ repeat_impl.cc
+ rms_cf_impl.cc
+ rms_ff_impl.cc
+ short_to_char_impl.cc
+ short_to_float_impl.cc
+ stream_mux_impl.cc
+ stream_to_streams_impl.cc
+ stream_to_vector_impl.cc
+ streams_to_stream_impl.cc
+ streams_to_vector_impl.cc
+ stretch_ff_impl.cc
+ threshold_ff_impl.cc
+ throttle_impl.cc
+ transcendental_impl.cc
+ uchar_array_to_float.cc
+ uchar_to_float_impl.cc
+ vector_to_stream_impl.cc
+ vector_to_streams_impl.cc
+)
+
+list(APPEND blocks_libs
+ gnuradio-core
+ volk
+ ${Boost_LIBRARIES}
+ ${BLOCKS_LIBRARIES}
+)
+
+add_library(gnuradio-blocks SHARED ${gr_blocks_sources})
+add_dependencies(gnuradio-blocks blocks_generated_includes)
+
+target_link_libraries(gnuradio-blocks ${blocks_libs})
+GR_LIBRARY_FOO(gnuradio-blocks RUNTIME_COMPONENT "blocks_runtime" DEVEL_COMPONENT "blocks_devel")
diff --git a/gr-blocks/lib/ConfigChecks.cmake b/gr-blocks/lib/ConfigChecks.cmake
new file mode 100644
index 000000000..72d6d1d8a
--- /dev/null
+++ b/gr-blocks/lib/ConfigChecks.cmake
@@ -0,0 +1,91 @@
+# 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.
+
+########################################################################
+INCLUDE(GrMiscUtils)
+INCLUDE(CheckCXXSourceCompiles)
+
+IF(MSVC) #add this directory for our provided headers
+LIST(APPEND CMAKE_REQUIRED_INCLUDES ${CMAKE_SOURCE_DIR}/msvc)
+ENDIF(MSVC)
+
+GR_CHECK_HDR_N_DEF(netdb.h HAVE_NETDB_H)
+GR_CHECK_HDR_N_DEF(sys/time.h HAVE_SYS_TIME_H)
+GR_CHECK_HDR_N_DEF(sys/types.h HAVE_SYS_TYPES_H)
+GR_CHECK_HDR_N_DEF(sys/select.h HAVE_SYS_SELECT_H)
+GR_CHECK_HDR_N_DEF(sys/socket.h HAVE_SYS_SOCKET_H)
+GR_CHECK_HDR_N_DEF(io.h HAVE_IO_H)
+GR_CHECK_HDR_N_DEF(sys/mman.h HAVE_SYS_MMAN_H)
+GR_CHECK_HDR_N_DEF(sys/ipc.h HAVE_SYS_IPC_H)
+GR_CHECK_HDR_N_DEF(sys/shm.h HAVE_SYS_SHM_H)
+GR_CHECK_HDR_N_DEF(signal.h HAVE_SIGNAL_H)
+GR_CHECK_HDR_N_DEF(netinet/in.h HAVE_NETINET_IN_H)
+GR_CHECK_HDR_N_DEF(arpa/inet.h HAVE_ARPA_INET_H)
+GR_CHECK_HDR_N_DEF(byteswap.h HAVE_BYTESWAP_H)
+GR_CHECK_HDR_N_DEF(linux/ppdev.h HAVE_LINUX_PPDEV_H)
+GR_CHECK_HDR_N_DEF(dev/ppbus/ppi.h HAVE_DEV_PPBUS_PPI_H)
+GR_CHECK_HDR_N_DEF(unistd.h HAVE_UNISTD_H)
+GR_CHECK_HDR_N_DEF(malloc.h HAVE_MALLOC_H)
+
+########################################################################
+CHECK_CXX_SOURCE_COMPILES("
+ #include <sys/select.h>
+ int main(){select(0, 0, 0, 0, 0); return 0;}
+ " HAVE_SELECT
+)
+GR_ADD_COND_DEF(HAVE_SELECT)
+
+########################################################################
+CHECK_INCLUDE_FILE_CXX(windows.h HAVE_WINDOWS_H)
+IF(HAVE_WINDOWS_H)
+ ADD_DEFINITIONS(-DHAVE_WINDOWS_H -DUSING_WINSOCK)
+ MESSAGE(STATUS "Adding windows libs to gr blocks libs...")
+ LIST(APPEND gnuradio_core_libs WS2_32.lib WSock32.lib)
+ENDIF(HAVE_WINDOWS_H)
+
+########################################################################
+CHECK_CXX_SOURCE_COMPILES("
+ #define _GNU_SOURCE
+ #include <math.h>
+ int main(){double x, sin, cos; sincos(x, &sin, &cos); return 0;}
+ " HAVE_SINCOS
+)
+GR_ADD_COND_DEF(HAVE_SINCOS)
+
+CHECK_CXX_SOURCE_COMPILES("
+ #define _GNU_SOURCE
+ #include <math.h>
+ int main(){float x, sin, cos; sincosf(x, &sin, &cos); return 0;}
+ " HAVE_SINCOSF
+)
+GR_ADD_COND_DEF(HAVE_SINCOSF)
+
+CHECK_CXX_SOURCE_COMPILES("
+ #include <math.h>
+ int main(){sinf(0); return 0;}
+ " HAVE_SINF
+)
+GR_ADD_COND_DEF(HAVE_SINF)
+
+CHECK_CXX_SOURCE_COMPILES("
+ #include <math.h>
+ int main(){cosf(0); return 0;}
+ " HAVE_COSF
+)
+GR_ADD_COND_DEF(HAVE_COSF)
diff --git a/gr-blocks/lib/add_XX_impl.cc.t b/gr-blocks/lib/add_XX_impl.cc.t
new file mode 100644
index 000000000..c528e2fbf
--- /dev/null
+++ b/gr-blocks/lib/add_XX_impl.cc.t
@@ -0,0 +1,69 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2009,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.
+ */
+
+// @WARNING@
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <@NAME_IMPL@.h>
+#include <gr_io_signature.h>
+
+namespace gr {
+ namespace blocks {
+
+ @NAME@::sptr @NAME@::make(size_t vlen)
+ {
+ return gnuradio::get_initial_sptr(new @NAME_IMPL@(vlen));
+ }
+
+ @NAME_IMPL@::@NAME_IMPL@(size_t vlen)
+ : gr_sync_block ("@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_IMPL@::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;
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/add_XX_impl.h.t b/gr-blocks/lib/add_XX_impl.h.t
new file mode 100644
index 000000000..a1c486b85
--- /dev/null
+++ b/gr-blocks/lib/add_XX_impl.h.t
@@ -0,0 +1,48 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2009,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_IMPL@
+#define @GUARD_NAME_IMPL@
+
+#include <blocks/@NAME@.h>
+
+namespace gr {
+ namespace blocks {
+
+ class BLOCKS_API @NAME_IMPL@ : public @NAME@
+ {
+ size_t d_vlen;
+
+ public:
+ @NAME_IMPL@(size_t vlen);
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* @GUARD_NAME_IMPL@ */
diff --git a/gr-blocks/lib/add_const_XX_impl.cc.t b/gr-blocks/lib/add_const_XX_impl.cc.t
new file mode 100644
index 000000000..7fa883f4b
--- /dev/null
+++ b/gr-blocks/lib/add_const_XX_impl.cc.t
@@ -0,0 +1,77 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2009,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.
+ */
+
+// @WARNING@
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <@NAME_IMPL@.h>
+#include <gr_io_signature.h>
+
+namespace gr {
+ namespace blocks {
+
+ @NAME@::sptr @NAME@::make(@O_TYPE@ k)
+ {
+ return gnuradio::get_initial_sptr(new @NAME_IMPL@(k));
+ }
+
+ @NAME_IMPL@::@NAME_IMPL@(@O_TYPE@ k)
+ : gr_sync_block ("@NAME@",
+ gr_make_io_signature (1, 1, sizeof (@I_TYPE@)),
+ gr_make_io_signature (1, 1, sizeof (@O_TYPE@))),
+ d_k(k)
+ {
+ }
+
+ int
+ @NAME_IMPL@::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;
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/add_const_XX_impl.h.t b/gr-blocks/lib/add_const_XX_impl.h.t
new file mode 100644
index 000000000..cae5ca813
--- /dev/null
+++ b/gr-blocks/lib/add_const_XX_impl.h.t
@@ -0,0 +1,51 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2009,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_IMPL@
+#define @GUARD_NAME_IMPL@
+
+#include <blocks/@NAME@.h>
+
+namespace gr {
+ namespace blocks {
+
+ class BLOCKS_API @NAME_IMPL@ : public @NAME@
+ {
+ @O_TYPE@ d_k;
+
+ public:
+ @NAME_IMPL@(@O_TYPE@ k);
+
+ @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);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* @GUARD_NAME_IMPL@ */
diff --git a/gr-blocks/lib/add_const_vXX_impl.cc.t b/gr-blocks/lib/add_const_vXX_impl.cc.t
new file mode 100644
index 000000000..da76cfeef
--- /dev/null
+++ b/gr-blocks/lib/add_const_vXX_impl.cc.t
@@ -0,0 +1,66 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2009,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.
+ */
+
+// @WARNING@
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <@NAME_IMPL@.h>
+#include <gr_io_signature.h>
+
+namespace gr {
+ namespace blocks {
+
+ @NAME@::sptr @NAME@::make(std::vector<@O_TYPE@> k)
+ {
+ return gnuradio::get_initial_sptr(new @NAME_IMPL@(k));
+ }
+
+ @NAME_IMPL@::@NAME_IMPL@(std::vector<@O_TYPE@> k)
+ : gr_sync_block ("@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_IMPL@::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 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;
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/add_const_vXX_impl.h.t b/gr-blocks/lib/add_const_vXX_impl.h.t
new file mode 100644
index 000000000..a7a619725
--- /dev/null
+++ b/gr-blocks/lib/add_const_vXX_impl.h.t
@@ -0,0 +1,51 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2006,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.
+ */
+
+// @WARNING@
+
+#ifndef @GUARD_NAME_IMPL@
+#define @GUARD_NAME_IMPL@
+
+#include <blocks/@NAME@.h>
+
+namespace gr {
+ namespace blocks {
+
+ class BLOCKS_API @NAME_IMPL@ : public @NAME@
+ {
+ std::vector<@O_TYPE@> d_k;
+
+ public:
+ @NAME_IMPL@(std::vector<@O_TYPE@> k);
+
+ std::vector<@O_TYPE@> k() const { return d_k; }
+ void set_k(std::vector<@O_TYPE@> k) { d_k = k; }
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* @GUARD_NAME_IMPL@ */
diff --git a/gr-blocks/lib/add_ff_impl.cc b/gr-blocks/lib/add_ff_impl.cc
new file mode 100644
index 000000000..83359ef80
--- /dev/null
+++ b/gr-blocks/lib/add_ff_impl.cc
@@ -0,0 +1,71 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "add_ff_impl.h"
+#include <gr_io_signature.h>
+#include <volk/volk.h>
+
+namespace gr {
+ namespace blocks {
+
+ add_ff::sptr add_ff::make(size_t vlen)
+ {
+ return gnuradio::get_initial_sptr(new add_ff_impl(vlen));
+ }
+
+ add_ff_impl::add_ff_impl(size_t vlen)
+ : gr_sync_block("add_ff",
+ gr_make_io_signature (1, -1, sizeof(float)*vlen),
+ gr_make_io_signature (1, 1, sizeof(float)*vlen)),
+ d_vlen(vlen)
+ {
+ const int alignment_multiple =
+ volk_get_alignment() / sizeof(float);
+ set_alignment(std::max(1, alignment_multiple));
+ }
+
+ int
+ add_ff_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ float *out = (float *) output_items[0];
+ int noi = d_vlen*noutput_items;
+
+ memcpy(out, input_items[0], noi*sizeof(float));
+ if(is_unaligned()) {
+ for(size_t i = 1; i < input_items.size(); i++)
+ volk_32f_x2_add_32f_u(out, out, (const float*)input_items[i], noi);
+ }
+ else {
+ for(size_t i = 1; i < input_items.size(); i++)
+ volk_32f_x2_add_32f_a(out, out, (const float*)input_items[i], noi);
+ }
+ return noutput_items;
+ }
+
+ } /* namespace blocks */
+}/* namespace gr */
diff --git a/gr-blocks/lib/add_ff_impl.h b/gr-blocks/lib/add_ff_impl.h
new file mode 100644
index 000000000..77b90d079
--- /dev/null
+++ b/gr-blocks/lib/add_ff_impl.h
@@ -0,0 +1,47 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_BLOCKS_ADD_FF_IMPL_H
+#define INCLUDED_BLOCKS_ADD_FF_IMPL_H
+
+#include <blocks/add_ff.h>
+
+namespace gr {
+ namespace blocks {
+
+ class BLOCKS_API add_ff_impl : public add_ff
+ {
+ size_t d_vlen;
+
+ public:
+ add_ff_impl(size_t vlen);
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+
+#endif /* INCLUDED_BLOCKS_ADD_FF_IMPL_H */
diff --git a/gr-blocks/lib/and_XX_impl.cc.t b/gr-blocks/lib/and_XX_impl.cc.t
new file mode 100644
index 000000000..3218a8c74
--- /dev/null
+++ b/gr-blocks/lib/and_XX_impl.cc.t
@@ -0,0 +1,69 @@
+/* -*- 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_IMPL@.h>
+#include <gr_io_signature.h>
+
+namespace gr {
+ namespace blocks {
+
+ @NAME@::sptr @NAME@::make(size_t vlen)
+ {
+ return gnuradio::get_initial_sptr(new @NAME_IMPL@(vlen));
+ }
+
+ @NAME_IMPL@::@NAME_IMPL@(size_t vlen)
+ : gr_sync_block ("@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_IMPL@::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;
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/and_XX_impl.h.t b/gr-blocks/lib/and_XX_impl.h.t
new file mode 100644
index 000000000..25f0da0c8
--- /dev/null
+++ b/gr-blocks/lib/and_XX_impl.h.t
@@ -0,0 +1,48 @@
+/* -*- 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_IMPL@
+#define @GUARD_NAME_IMPL@
+
+#include <blocks/@NAME@.h>
+
+namespace gr {
+ namespace blocks {
+
+ class BLOCKS_API @NAME_IMPL@ : public @NAME@
+ {
+ size_t d_vlen;
+
+ public:
+ @NAME_IMPL@(size_t vlen);
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* @GUARD_NAME_IMPL@ */
diff --git a/gr-blocks/lib/and_const_XX_impl.cc.t b/gr-blocks/lib/and_const_XX_impl.cc.t
new file mode 100644
index 000000000..8ff5ac371
--- /dev/null
+++ b/gr-blocks/lib/and_const_XX_impl.cc.t
@@ -0,0 +1,77 @@
+/* -*- 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_IMPL@.h>
+#include <gr_io_signature.h>
+
+namespace gr {
+ namespace blocks {
+
+ @NAME@::sptr @NAME@::make(@O_TYPE@ k)
+ {
+ return gnuradio::get_initial_sptr(new @NAME_IMPL@(k));
+ }
+
+ @NAME_IMPL@::@NAME_IMPL@(@O_TYPE@ k)
+ : gr_sync_block ("@NAME@",
+ gr_make_io_signature (1, 1, sizeof (@I_TYPE@)),
+ gr_make_io_signature (1, 1, sizeof (@O_TYPE@))),
+ d_k(k)
+ {
+ }
+
+ int
+ @NAME_IMPL@::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;
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/and_const_XX_impl.h.t b/gr-blocks/lib/and_const_XX_impl.h.t
new file mode 100644
index 000000000..2c379feb8
--- /dev/null
+++ b/gr-blocks/lib/and_const_XX_impl.h.t
@@ -0,0 +1,51 @@
+/* -*- 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_IMPL@
+#define @GUARD_NAME_IMPL@
+
+#include <blocks/@NAME@.h>
+
+namespace gr {
+ namespace blocks {
+
+ class BLOCKS_API @NAME_IMPL@ : public @NAME@
+ {
+ @O_TYPE@ d_k;
+
+ public:
+ @NAME_IMPL@(@O_TYPE@ k);
+
+ @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);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* @GUARD_NAME_IMPL@ */
diff --git a/gr-blocks/lib/char_to_float_impl.cc b/gr-blocks/lib/char_to_float_impl.cc
new file mode 100644
index 000000000..22c5d2e25
--- /dev/null
+++ b/gr-blocks/lib/char_to_float_impl.cc
@@ -0,0 +1,65 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "char_to_float_impl.h"
+#include <gr_io_signature.h>
+#include <volk/volk.h>
+
+namespace gr {
+ namespace blocks {
+
+ char_to_float::sptr char_to_float::make(size_t vlen, float scale)
+ {
+ return gnuradio::get_initial_sptr(new char_to_float_impl(vlen, scale));
+ }
+
+ char_to_float_impl::char_to_float_impl(size_t vlen, float scale)
+ : gr_sync_block("char_to_float",
+ gr_make_io_signature (1, -1, sizeof(char)*vlen),
+ gr_make_io_signature (1, 1, sizeof(float)*vlen)),
+ d_vlen(vlen), d_scale(scale)
+ {
+ const int alignment_multiple =
+ volk_get_alignment() / sizeof(float);
+ set_alignment(std::max(1, alignment_multiple));
+ }
+
+ int
+ char_to_float_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const int8_t *in = (const int8_t *) input_items[0];
+ float *out = (float *) output_items[0];
+
+ // Note: the unaligned benchmarked much faster than the aligned
+ volk_8i_s32f_convert_32f_u(out, in, d_scale, d_vlen*noutput_items);
+
+ return noutput_items;
+ }
+
+ } /* namespace blocks */
+}/* namespace gr */
diff --git a/gr-blocks/lib/char_to_float_impl.h b/gr-blocks/lib/char_to_float_impl.h
new file mode 100644
index 000000000..620d7e737
--- /dev/null
+++ b/gr-blocks/lib/char_to_float_impl.h
@@ -0,0 +1,51 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_CHAR_TO_FLOAT_IMPL_H
+#define INCLUDED_CHAR_TO_FLOAT_IMPL_H
+
+#include <blocks/char_to_float.h>
+
+namespace gr {
+ namespace blocks {
+
+ class BLOCKS_API char_to_float_impl : public char_to_float
+ {
+ size_t d_vlen;
+ float d_scale;
+
+ public:
+ char_to_float_impl(size_t vlen, float scale);
+
+ virtual float scale() const { return d_scale; }
+ virtual void set_scale(float scale) { d_scale = scale; }
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+
+#endif /* INCLUDED_CHAR_TO_FLOAT_IMPL_H */
diff --git a/gr-blocks/lib/char_to_short_impl.cc b/gr-blocks/lib/char_to_short_impl.cc
new file mode 100644
index 000000000..a86a928b5
--- /dev/null
+++ b/gr-blocks/lib/char_to_short_impl.cc
@@ -0,0 +1,69 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "char_to_short_impl.h"
+#include <gr_io_signature.h>
+#include <volk/volk.h>
+
+namespace gr {
+ namespace blocks {
+
+ char_to_short::sptr char_to_short::make(size_t vlen)
+ {
+ return gnuradio::get_initial_sptr(new char_to_short_impl(vlen));
+ }
+
+ char_to_short_impl::char_to_short_impl(size_t vlen)
+ : gr_sync_block("char_to_short",
+ gr_make_io_signature (1, -1, sizeof(char)*vlen),
+ gr_make_io_signature (1, 1, sizeof(short)*vlen)),
+ d_vlen(vlen)
+ {
+ const int alignment_multiple =
+ volk_get_alignment() / sizeof(short);
+ set_alignment(std::max(1, alignment_multiple));
+ }
+
+ int
+ char_to_short_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const int8_t *in = (const int8_t *) input_items[0];
+ int16_t *out = (int16_t *) output_items[0];
+
+ if(is_unaligned()) {
+ volk_8i_convert_16i_u(out, in, d_vlen*noutput_items);
+ }
+ else {
+ volk_8i_convert_16i_a(out, in, d_vlen*noutput_items);
+ }
+
+ return noutput_items;
+ }
+
+ } /* namespace blocks */
+}/* namespace gr */
diff --git a/gr-blocks/lib/char_to_short_impl.h b/gr-blocks/lib/char_to_short_impl.h
new file mode 100644
index 000000000..efd3ab3a8
--- /dev/null
+++ b/gr-blocks/lib/char_to_short_impl.h
@@ -0,0 +1,47 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_CHAR_TO_SHORT_IMPL_H
+#define INCLUDED_CHAR_TO_SHORT_IMPL_H
+
+#include <blocks/char_to_short.h>
+
+namespace gr {
+ namespace blocks {
+
+ class BLOCKS_API char_to_short_impl : public char_to_short
+ {
+ size_t d_vlen;
+
+ public:
+ char_to_short_impl(size_t vlen);
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+
+#endif /* INCLUDED_CHAR_TO_SHORT_IMPL_H */
diff --git a/gr-blocks/lib/complex_to_arg_impl.cc b/gr-blocks/lib/complex_to_arg_impl.cc
new file mode 100644
index 000000000..87ac9966f
--- /dev/null
+++ b/gr-blocks/lib/complex_to_arg_impl.cc
@@ -0,0 +1,70 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "complex_to_arg_impl.h"
+#include <gr_io_signature.h>
+#include <volk/volk.h>
+#include <gr_math.h>
+
+namespace gr {
+ namespace blocks {
+
+ complex_to_arg::sptr complex_to_arg::make(size_t vlen)
+ {
+ return gnuradio::get_initial_sptr(new complex_to_arg_impl(vlen));
+ }
+
+ complex_to_arg_impl::complex_to_arg_impl(size_t vlen)
+ : gr_sync_block("complex_to_arg",
+ gr_make_io_signature (1, 1, sizeof(gr_complex)*vlen),
+ gr_make_io_signature (1, 1, sizeof(float)*vlen)),
+ d_vlen(vlen)
+ {
+ const int alignment_multiple =
+ volk_get_alignment() / sizeof(float);
+ set_alignment(std::max(1,alignment_multiple));
+ }
+
+ int
+ complex_to_arg_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const gr_complex *in = (const gr_complex *) input_items[0];
+ float *out = (float *) output_items[0];
+ int noi = noutput_items * d_vlen;
+
+ // The fast_atan2f is faster than Volk
+ for (int i = 0; i < noi; i++){
+ // out[i] = std::arg (in[i]);
+ out[i] = gr_fast_atan2f(in[i]);
+ }
+
+ return noutput_items;
+ }
+
+ } /* namespace blocks */
+}/* namespace gr */
diff --git a/gr-blocks/lib/complex_to_arg_impl.h b/gr-blocks/lib/complex_to_arg_impl.h
new file mode 100644
index 000000000..9ccfba05a
--- /dev/null
+++ b/gr-blocks/lib/complex_to_arg_impl.h
@@ -0,0 +1,47 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_COMPLEX_TO_ARG_IMPL_H
+#define INCLUDED_COMPLEX_TO_ARG_IMPL_H
+
+#include <blocks/complex_to_arg.h>
+
+namespace gr {
+ namespace blocks {
+
+ class BLOCKS_API complex_to_arg_impl : public complex_to_arg
+ {
+ size_t d_vlen;
+
+ public:
+ complex_to_arg_impl(size_t vlen);
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+
+#endif /* INCLUDED_COMPLEX_TO_ARG_IMPL_H */
diff --git a/gr-blocks/lib/complex_to_float_impl.cc b/gr-blocks/lib/complex_to_float_impl.cc
new file mode 100644
index 000000000..3c1109de5
--- /dev/null
+++ b/gr-blocks/lib/complex_to_float_impl.cc
@@ -0,0 +1,94 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "complex_to_float_impl.h"
+#include <gr_io_signature.h>
+#include <volk/volk.h>
+
+namespace gr {
+ namespace blocks {
+
+ complex_to_float::sptr complex_to_float::make(size_t vlen)
+ {
+ return gnuradio::get_initial_sptr(new complex_to_float_impl(vlen));
+ }
+
+ complex_to_float_impl::complex_to_float_impl(size_t vlen)
+ : gr_sync_block("complex_to_float",
+ gr_make_io_signature (1, 1, sizeof(gr_complex)*vlen),
+ gr_make_io_signature (1, 2, sizeof(float)*vlen)),
+ d_vlen(vlen)
+ {
+ const int alignment_multiple =
+ volk_get_alignment() / sizeof(float);
+ set_alignment(std::max(1,alignment_multiple));
+ }
+
+ int
+ complex_to_float_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const gr_complex *in = (const gr_complex *) input_items[0];
+ float *out0 = (float *) output_items[0];
+ float* out1;
+ int noi = noutput_items * d_vlen;
+
+ switch (output_items.size ()){
+ case 1:
+ if(is_unaligned()) {
+ for (int i = 0; i < noi; i++){
+ out0[i] = in[i].real ();
+ }
+ }
+ else {
+ volk_32fc_deinterleave_real_32f_a(out0, in, noi);
+ }
+ break;
+
+ case 2:
+ out1 = (float *) output_items[1];
+ if(is_unaligned()) {
+ for (int i = 0; i < noi; i++){
+ out0[i] = in[i].real ();
+ out1[i] = in[i].imag ();
+ }
+ }
+ else {
+ volk_32fc_deinterleave_32f_x2_a(out0, out1, in, noi);
+ }
+ break;
+
+ default:
+ abort ();
+
+ }
+
+ return noutput_items;
+ }
+
+ } /* namespace blocks */
+}/* namespace gr */
diff --git a/gr-blocks/lib/complex_to_float_impl.h b/gr-blocks/lib/complex_to_float_impl.h
new file mode 100644
index 000000000..d90ac28d5
--- /dev/null
+++ b/gr-blocks/lib/complex_to_float_impl.h
@@ -0,0 +1,47 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_COMPLEX_TO_FLOAT_IMPL_H
+#define INCLUDED_COMPLEX_TO_FLOAT_IMPL_H
+
+#include <blocks/complex_to_float.h>
+
+namespace gr {
+ namespace blocks {
+
+ class BLOCKS_API complex_to_float_impl : public complex_to_float
+ {
+ size_t d_vlen;
+
+ public:
+ complex_to_float_impl(size_t vlen);
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+
+#endif /* INCLUDED_COMPLEX_TO_FLOAT_IMPL_H */
diff --git a/gr-blocks/lib/complex_to_imag_impl.cc b/gr-blocks/lib/complex_to_imag_impl.cc
new file mode 100644
index 000000000..760440cc9
--- /dev/null
+++ b/gr-blocks/lib/complex_to_imag_impl.cc
@@ -0,0 +1,72 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "complex_to_imag_impl.h"
+#include <gr_io_signature.h>
+#include <volk/volk.h>
+
+namespace gr {
+ namespace blocks {
+
+ complex_to_imag::sptr complex_to_imag::make(size_t vlen)
+ {
+ return gnuradio::get_initial_sptr(new complex_to_imag_impl(vlen));
+ }
+
+ complex_to_imag_impl::complex_to_imag_impl(size_t vlen)
+ : gr_sync_block("complex_to_imag",
+ gr_make_io_signature (1, 1, sizeof(gr_complex)*vlen),
+ gr_make_io_signature (1, 1, sizeof(float)*vlen)),
+ d_vlen(vlen)
+ {
+ const int alignment_multiple =
+ volk_get_alignment() / sizeof(float);
+ set_alignment(std::max(1,alignment_multiple));
+ }
+
+ int
+ complex_to_imag_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const gr_complex *in = (const gr_complex *) input_items[0];
+ float *out = (float *) output_items[0];
+ int noi = noutput_items * d_vlen;
+
+ if(is_unaligned()) {
+ for (int i = 0; i < noi; i++){
+ out[i] = in[i].imag ();
+ }
+ }
+ else {
+ volk_32fc_deinterleave_imag_32f_a(out, in, noi);
+ }
+
+ return noutput_items;
+ }
+
+ } /* namespace blocks */
+}/* namespace gr */
diff --git a/gr-blocks/lib/complex_to_imag_impl.h b/gr-blocks/lib/complex_to_imag_impl.h
new file mode 100644
index 000000000..e647e6773
--- /dev/null
+++ b/gr-blocks/lib/complex_to_imag_impl.h
@@ -0,0 +1,47 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_COMPLEX_TO_IMAG_IMPL_H
+#define INCLUDED_COMPLEX_TO_IMAG_IMPL_H
+
+#include <blocks/complex_to_imag.h>
+
+namespace gr {
+ namespace blocks {
+
+ class BLOCKS_API complex_to_imag_impl : public complex_to_imag
+ {
+ size_t d_vlen;
+
+ public:
+ complex_to_imag_impl(size_t vlen);
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+
+#endif /* INCLUDED_COMPLEX_TO_IMAG_IMPL_H */
diff --git a/gr-blocks/lib/complex_to_interleaved_short_impl.cc b/gr-blocks/lib/complex_to_interleaved_short_impl.cc
new file mode 100644
index 000000000..2f2ea6e00
--- /dev/null
+++ b/gr-blocks/lib/complex_to_interleaved_short_impl.cc
@@ -0,0 +1,63 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "complex_to_interleaved_short_impl.h"
+#include <gr_io_signature.h>
+
+namespace gr {
+ namespace blocks {
+
+ complex_to_interleaved_short::sptr complex_to_interleaved_short::make()
+ {
+ return gnuradio::get_initial_sptr(new complex_to_interleaved_short_impl());
+ }
+
+ complex_to_interleaved_short_impl::complex_to_interleaved_short_impl()
+ : gr_sync_interpolator("complex_to_interleaved_short",
+ gr_make_io_signature (1, 1, sizeof(gr_complex)),
+ gr_make_io_signature (1, 1, sizeof(short)),
+ 2)
+ {
+ }
+
+ int
+ complex_to_interleaved_short_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const gr_complex *in = (const gr_complex *) input_items[0];
+ short *out = (short *) output_items[0];
+
+ for (int i = 0; i < noutput_items/2; i++){
+ *out++ = (short) lrintf(in[i].real()); // FIXME saturate?
+ *out++ = (short) lrintf(in[i].imag());
+ }
+
+ return noutput_items;
+ }
+
+ } /* namespace blocks */
+}/* namespace gr */
diff --git a/gr-blocks/lib/complex_to_interleaved_short_impl.h b/gr-blocks/lib/complex_to_interleaved_short_impl.h
new file mode 100644
index 000000000..9a09d1ff9
--- /dev/null
+++ b/gr-blocks/lib/complex_to_interleaved_short_impl.h
@@ -0,0 +1,45 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_COMPLEX_TO_INTERLEAVED_SHORT_IMPL_H
+#define INCLUDED_COMPLEX_TO_INTERLEAVED_SHORT_IMPL_H
+
+#include <blocks/complex_to_interleaved_short.h>
+
+namespace gr {
+ namespace blocks {
+
+ class BLOCKS_API complex_to_interleaved_short_impl : public complex_to_interleaved_short
+ {
+ public:
+ complex_to_interleaved_short_impl();
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+
+#endif /* INCLUDED_COMPLEX_TO_INTERLEAVED_SHORT_IMPL_H */
diff --git a/gr-blocks/lib/complex_to_mag_impl.cc b/gr-blocks/lib/complex_to_mag_impl.cc
new file mode 100644
index 000000000..419bc53eb
--- /dev/null
+++ b/gr-blocks/lib/complex_to_mag_impl.cc
@@ -0,0 +1,66 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "complex_to_mag_impl.h"
+#include <gr_io_signature.h>
+#include <volk/volk.h>
+
+namespace gr {
+ namespace blocks {
+
+ complex_to_mag::sptr complex_to_mag::make(size_t vlen)
+ {
+ return gnuradio::get_initial_sptr(new complex_to_mag_impl(vlen));
+ }
+
+ complex_to_mag_impl::complex_to_mag_impl(size_t vlen)
+ : gr_sync_block("complex_to_mag",
+ gr_make_io_signature (1, 1, sizeof(gr_complex)*vlen),
+ gr_make_io_signature (1, 1, sizeof(float)*vlen)),
+ d_vlen(vlen)
+ {
+ const int alignment_multiple =
+ volk_get_alignment() / sizeof(float);
+ set_alignment(std::max(1,alignment_multiple));
+ }
+
+ int
+ complex_to_mag_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const gr_complex *in = (const gr_complex *) input_items[0];
+ float *out = (float *) output_items[0];
+ int noi = noutput_items * d_vlen;
+
+ // turned out to be faster than aligned/unaligned switching
+ volk_32fc_magnitude_32f_u(out, in, noi);
+
+ return noutput_items;
+ }
+
+ } /* namespace blocks */
+}/* namespace gr */
diff --git a/gr-blocks/lib/complex_to_mag_impl.h b/gr-blocks/lib/complex_to_mag_impl.h
new file mode 100644
index 000000000..fe6da3f15
--- /dev/null
+++ b/gr-blocks/lib/complex_to_mag_impl.h
@@ -0,0 +1,47 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_COMPLEX_TO_MAG_IMPL_H
+#define INCLUDED_COMPLEX_TO_MAG_IMPL_H
+
+#include <blocks/complex_to_mag.h>
+
+namespace gr {
+ namespace blocks {
+
+ class BLOCKS_API complex_to_mag_impl : public complex_to_mag
+ {
+ size_t d_vlen;
+
+ public:
+ complex_to_mag_impl(size_t vlen);
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+
+#endif /* INCLUDED_COMPLEX_TO_MAG_IMPL_H */
diff --git a/gr-blocks/lib/complex_to_mag_squared_impl.cc b/gr-blocks/lib/complex_to_mag_squared_impl.cc
new file mode 100644
index 000000000..a3b48b153
--- /dev/null
+++ b/gr-blocks/lib/complex_to_mag_squared_impl.cc
@@ -0,0 +1,70 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "complex_to_mag_squared_impl.h"
+#include <gr_io_signature.h>
+#include <volk/volk.h>
+
+namespace gr {
+ namespace blocks {
+
+ complex_to_mag_squared::sptr complex_to_mag_squared::make(size_t vlen)
+ {
+ return gnuradio::get_initial_sptr(new complex_to_mag_squared_impl(vlen));
+ }
+
+ complex_to_mag_squared_impl::complex_to_mag_squared_impl(size_t vlen)
+ : gr_sync_block("complex_to_mag_squared",
+ gr_make_io_signature (1, 1, sizeof(gr_complex)*vlen),
+ gr_make_io_signature (1, 1, sizeof(float)*vlen)),
+ d_vlen(vlen)
+ {
+ const int alignment_multiple =
+ volk_get_alignment() / sizeof(float);
+ set_alignment(std::max(1,alignment_multiple));
+ }
+
+ int
+ complex_to_mag_squared_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const gr_complex *in = (const gr_complex *) input_items[0];
+ float *out = (float *) output_items[0];
+ int noi = noutput_items * d_vlen;
+
+ if(is_unaligned()) {
+ volk_32fc_magnitude_squared_32f_u(out, in, noi);
+ }
+ else {
+ volk_32fc_magnitude_squared_32f_a(out, in, noi);
+ }
+
+ return noutput_items;
+ }
+
+ } /* namespace blocks */
+}/* namespace gr */
diff --git a/gr-blocks/lib/complex_to_mag_squared_impl.h b/gr-blocks/lib/complex_to_mag_squared_impl.h
new file mode 100644
index 000000000..01851d266
--- /dev/null
+++ b/gr-blocks/lib/complex_to_mag_squared_impl.h
@@ -0,0 +1,47 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_COMPLEX_TO_MAG_SQUARED_IMPL_H
+#define INCLUDED_COMPLEX_TO_MAG_SQUARED_IMPL_H
+
+#include <blocks/complex_to_mag_squared.h>
+
+namespace gr {
+ namespace blocks {
+
+ class BLOCKS_API complex_to_mag_squared_impl : public complex_to_mag_squared
+ {
+ size_t d_vlen;
+
+ public:
+ complex_to_mag_squared_impl(size_t vlen);
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+
+#endif /* INCLUDED_COMPLEX_TO_MAG_SQUARED_IMPL_H */
diff --git a/gr-blocks/lib/complex_to_real_impl.cc b/gr-blocks/lib/complex_to_real_impl.cc
new file mode 100644
index 000000000..6f053b669
--- /dev/null
+++ b/gr-blocks/lib/complex_to_real_impl.cc
@@ -0,0 +1,72 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "complex_to_real_impl.h"
+#include <gr_io_signature.h>
+#include <volk/volk.h>
+
+namespace gr {
+ namespace blocks {
+
+ complex_to_real::sptr complex_to_real::make(size_t vlen)
+ {
+ return gnuradio::get_initial_sptr(new complex_to_real_impl(vlen));
+ }
+
+ complex_to_real_impl::complex_to_real_impl(size_t vlen)
+ : gr_sync_block("complex_to_real",
+ gr_make_io_signature (1, 1, sizeof(gr_complex)*vlen),
+ gr_make_io_signature (1, 1, sizeof(float)*vlen)),
+ d_vlen(vlen)
+ {
+ const int alignment_multiple =
+ volk_get_alignment() / sizeof(float);
+ set_alignment(std::max(1,alignment_multiple));
+ }
+
+ int
+ complex_to_real_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const gr_complex *in = (const gr_complex *) input_items[0];
+ float *out = (float *) output_items[0];
+ int noi = noutput_items * d_vlen;
+
+ if(is_unaligned()) {
+ for (int i = 0; i < noi; i++){
+ out[i] = in[i].real ();
+ }
+ }
+ else {
+ volk_32fc_deinterleave_real_32f_a(out, in, noi);
+ }
+
+ return noutput_items;
+ }
+
+ } /* namespace blocks */
+}/* namespace gr */
diff --git a/gr-blocks/lib/complex_to_real_impl.h b/gr-blocks/lib/complex_to_real_impl.h
new file mode 100644
index 000000000..7d4d4306f
--- /dev/null
+++ b/gr-blocks/lib/complex_to_real_impl.h
@@ -0,0 +1,47 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_COMPLEX_TO_REAL_IMPL_H
+#define INCLUDED_COMPLEX_TO_REAL_IMPL_H
+
+#include <blocks/complex_to_real.h>
+
+namespace gr {
+ namespace blocks {
+
+ class BLOCKS_API complex_to_real_impl : public complex_to_real
+ {
+ size_t d_vlen;
+
+ public:
+ complex_to_real_impl(size_t vlen);
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+
+#endif /* INCLUDED_COMPLEX_TO_REAL_IMPL_H */
diff --git a/gr-blocks/lib/conjugate_cc_impl.cc b/gr-blocks/lib/conjugate_cc_impl.cc
new file mode 100644
index 000000000..3d46bef68
--- /dev/null
+++ b/gr-blocks/lib/conjugate_cc_impl.cc
@@ -0,0 +1,68 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "conjugate_cc_impl.h"
+#include <gr_io_signature.h>
+#include <volk/volk.h>
+
+namespace gr {
+ namespace blocks {
+
+ conjugate_cc::sptr conjugate_cc::make()
+ {
+ return gnuradio::get_initial_sptr(new conjugate_cc_impl());
+ }
+
+ conjugate_cc_impl::conjugate_cc_impl()
+ : gr_sync_block("conjugate_cc",
+ gr_make_io_signature (1, 1, sizeof(gr_complex)),
+ gr_make_io_signature (1, 1, sizeof(gr_complex)))
+ {
+ const int alignment_multiple =
+ volk_get_alignment() / sizeof(gr_complex);
+ set_alignment(std::max(1, alignment_multiple));
+ }
+
+ int
+ conjugate_cc_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ gr_complex *iptr = (gr_complex *) input_items[0];
+ gr_complex *optr = (gr_complex *) output_items[0];
+
+ if(is_unaligned()) {
+ volk_32fc_conjugate_32fc_u(optr, iptr, noutput_items);
+ }
+ else {
+ volk_32fc_conjugate_32fc_a(optr, iptr, noutput_items);
+ }
+
+ return noutput_items;
+ }
+
+ } /* namespace blocks */
+}/* namespace gr */
diff --git a/gr-blocks/lib/conjugate_cc_impl.h b/gr-blocks/lib/conjugate_cc_impl.h
new file mode 100644
index 000000000..448e7b318
--- /dev/null
+++ b/gr-blocks/lib/conjugate_cc_impl.h
@@ -0,0 +1,44 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_CONJUGATE_CC_IMPL_H
+#define INCLUDED_CONJUGATE_CC_IMPL_H
+
+#include <blocks/conjugate_cc.h>
+
+namespace gr {
+ namespace blocks {
+
+ class BLOCKS_API conjugate_cc_impl : public conjugate_cc
+ {
+ public:
+ conjugate_cc_impl();
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_CONJUGATE_CC_IMPL_H */
diff --git a/gr-blocks/lib/count_bits.cc b/gr-blocks/lib/count_bits.cc
new file mode 100644
index 000000000..167396b57
--- /dev/null
+++ b/gr-blocks/lib/count_bits.cc
@@ -0,0 +1,78 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2003,2013 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 <blocks/count_bits.h>
+
+/*
+ * these are slow and obvious. If you need something faster, fix these
+ *
+ * Can probably replace with VOLK's popcount
+ */
+
+namespace gr {
+ namespace blocks {
+
+ unsigned int
+ count_bits8(unsigned int x)
+ {
+ int count = 0;
+
+ for(int i = 0; i < 8; i++) {
+ if(x & (1 << i))
+ count++;
+ }
+
+ return count;
+ }
+
+ unsigned int
+ count_bits16(unsigned int x)
+ {
+ int count = 0;
+
+ for(int i = 0; i < 16; i++) {
+ if(x & (1 << i))
+ count++;
+ }
+
+ return count;
+ }
+
+ unsigned int
+ count_bits32(unsigned int x)
+ {
+ unsigned res = (x & 0x55555555) + ((x >> 1) & 0x55555555);
+ res = (res & 0x33333333) + ((res >> 2) & 0x33333333);
+ res = (res & 0x0F0F0F0F) + ((res >> 4) & 0x0F0F0F0F);
+ res = (res & 0x00FF00FF) + ((res >> 8) & 0x00FF00FF);
+ return (res & 0x0000FFFF) + ((res >> 16) & 0x0000FFFF);
+ }
+
+ unsigned int
+ count_bits64(unsigned long long x)
+ {
+ return count_bits32((x >> 32) & 0xffffffff) + \
+ count_bits32(x & 0xffffffff);
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/deinterleave_impl.cc b/gr-blocks/lib/deinterleave_impl.cc
new file mode 100644
index 000000000..badf4973a
--- /dev/null
+++ b/gr-blocks/lib/deinterleave_impl.cc
@@ -0,0 +1,76 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "deinterleave_impl.h"
+#include <gr_io_signature.h>
+
+namespace gr {
+ namespace blocks {
+
+ deinterleave::sptr deinterleave::make(size_t itemsize)
+ {
+ return gnuradio::get_initial_sptr(new deinterleave_impl(itemsize));
+ }
+
+ deinterleave_impl::deinterleave_impl(size_t itemsize)
+ : gr_sync_decimator("deinterleave",
+ gr_make_io_signature (1, 1, itemsize),
+ gr_make_io_signature (1, gr_io_signature::IO_INFINITE, itemsize),
+ 1),
+ d_itemsize(itemsize)
+ {
+ }
+
+ bool
+ deinterleave_impl::check_topology(int ninputs, int noutputs)
+ {
+ set_decimation(noutputs);
+ return true;
+ }
+
+ int
+ deinterleave_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ size_t nchan = output_items.size();
+ size_t itemsize = d_itemsize;
+ const char *in = (const char *)input_items[0];
+ char **out = (char **)&output_items[0];
+
+ for (int i = 0; i < noutput_items; i++){
+ for (unsigned int n = 0; n < nchan; n++){
+ memcpy(out[n], in, itemsize);
+ out[n] += itemsize;
+ in += itemsize;
+ }
+ }
+
+ return noutput_items;
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/deinterleave_impl.h b/gr-blocks/lib/deinterleave_impl.h
new file mode 100644
index 000000000..762c9d5fe
--- /dev/null
+++ b/gr-blocks/lib/deinterleave_impl.h
@@ -0,0 +1,49 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_DEINTERLEAVE_IMPL_H
+#define INCLUDED_DEINTERLEAVE_IMPL_H
+
+#include <blocks/deinterleave.h>
+
+namespace gr {
+ namespace blocks {
+
+ class BLOCKS_API deinterleave_impl : public deinterleave
+ {
+ size_t d_itemsize;
+
+ public:
+ deinterleave_impl(size_t itemsize);
+
+ bool check_topology(int ninputs, int noutputs);
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+
+#endif /* INCLUDED_DEINTERLEAVE_IMPL_H */
diff --git a/gr-blocks/lib/delay_impl.cc b/gr-blocks/lib/delay_impl.cc
new file mode 100644
index 000000000..67449aca2
--- /dev/null
+++ b/gr-blocks/lib/delay_impl.cc
@@ -0,0 +1,141 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007,2010,2012-2013 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 "delay_impl.h"
+#include <gr_io_signature.h>
+#include <string.h>
+
+namespace gr {
+ namespace blocks {
+
+ delay::sptr
+ delay::make(size_t itemsize, int delay)
+ {
+ return gnuradio::get_initial_sptr
+ (new delay_impl(itemsize, delay));
+ }
+
+ delay_impl::delay_impl(size_t itemsize, int delay)
+ : gr_block("delay",
+ gr_make_io_signature(1, -1, itemsize),
+ gr_make_io_signature(1, -1, itemsize)),
+ d_itemsize(itemsize)
+ {
+ set_dly(delay);
+ d_delta = 0;
+ }
+
+ delay_impl::~delay_impl()
+ {
+ }
+
+ void
+ delay_impl::forecast(int noutput_items,
+ gr_vector_int &ninput_items_required)
+ {
+ // make sure all inputs have noutput_items available
+ unsigned ninputs = ninput_items_required.size();
+ for(unsigned i = 0; i < ninputs; i++)
+ ninput_items_required[i] = noutput_items;
+ }
+
+ void
+ delay_impl::set_dly(int d)
+ {
+ // only set a new delta if there is a change in the delay; this
+ // protects from quickly-repeated calls to this function that
+ // would end with d_delta=0.
+ if(d != dly()) {
+ gruel::scoped_lock l(d_mutex_delay);
+ int old = dly();
+ set_history(d+1);
+ d_delta += dly() - old;
+ }
+ }
+
+ int
+ delay_impl::general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ gruel::scoped_lock l(d_mutex_delay);
+ assert(input_items.size() == output_items.size());
+
+ const char *iptr;
+ char *optr;
+ int cons, ret;
+
+ // No change in delay; just memcpy ins to outs
+ if(d_delta == 0) {
+ for(size_t i = 0; i < input_items.size(); i++) {
+ iptr = (const char *)input_items[i];
+ optr = (char *)output_items[i];
+ std::memcpy(optr, iptr, noutput_items*d_itemsize);
+ }
+ cons = noutput_items;
+ ret = noutput_items;
+ }
+
+ // Skip over d_delta items on the input
+ else if(d_delta < 0) {
+ int n_to_copy, n_adj;
+ int delta = -d_delta;
+ n_to_copy = std::max(0, noutput_items-delta);
+ n_adj = std::min(delta, noutput_items);
+ for(size_t i = 0; i < input_items.size(); i++) {
+ iptr = (const char *) input_items[i];
+ optr = (char *) output_items[i];
+ std::memcpy(optr, iptr+delta*d_itemsize, n_to_copy*d_itemsize);
+ }
+ cons = noutput_items;
+ ret = n_to_copy;
+ delta -= n_adj;
+ d_delta = -delta;
+ }
+
+ //produce but not consume (inserts zeros)
+ else { // d_delta > 0
+ int n_from_input, n_padding;
+ n_from_input = std::max(0, noutput_items-d_delta);
+ n_padding = std::min(d_delta, noutput_items);
+ for(size_t i = 0; i < input_items.size(); i++) {
+ iptr = (const char *) input_items[i];
+ optr = (char *) output_items[i];
+ std::memset(optr, 0, n_padding*d_itemsize);
+ std::memcpy(optr, iptr, n_from_input*d_itemsize);
+ }
+ cons = n_from_input;
+ ret = noutput_items;
+ d_delta -= n_padding;
+ }
+
+ consume_each(cons);
+ return ret;
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/delay_impl.h b/gr-blocks/lib/delay_impl.h
new file mode 100644
index 000000000..56d971b11
--- /dev/null
+++ b/gr-blocks/lib/delay_impl.h
@@ -0,0 +1,58 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007,2012-2013 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_DELAY_IMPL_H
+#define INCLUDED_GR_DELAY_IMPL_H
+
+#include <blocks/delay.h>
+#include <gruel/thread.h>
+
+namespace gr {
+ namespace blocks {
+
+ class delay_impl : public delay
+ {
+ private:
+ void forecast(int noutput_items,
+ gr_vector_int &ninput_items_required);
+
+ size_t d_itemsize;
+ int d_delta;
+ gruel::mutex d_mutex_delay;
+
+ public:
+ delay_impl(size_t itemsize, int delay);
+ ~delay_impl();
+
+ int dly() const { return history()-1; }
+ void set_dly(int d);
+
+ int general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_DELAY_IMPL_H */
diff --git a/gr-blocks/lib/divide_XX_impl.cc.t b/gr-blocks/lib/divide_XX_impl.cc.t
new file mode 100644
index 000000000..223d6ad90
--- /dev/null
+++ b/gr-blocks/lib/divide_XX_impl.cc.t
@@ -0,0 +1,69 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2009,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.
+ */
+
+// @WARNING@
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <@NAME_IMPL@.h>
+#include <gr_io_signature.h>
+
+namespace gr {
+ namespace blocks {
+
+ @NAME@::sptr @NAME@::make(size_t vlen)
+ {
+ return gnuradio::get_initial_sptr(new @NAME_IMPL@(vlen));
+ }
+
+ @NAME_IMPL@::@NAME_IMPL@(size_t vlen)
+ : gr_sync_block ("@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_IMPL@::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;
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/divide_XX_impl.h.t b/gr-blocks/lib/divide_XX_impl.h.t
new file mode 100644
index 000000000..a1c486b85
--- /dev/null
+++ b/gr-blocks/lib/divide_XX_impl.h.t
@@ -0,0 +1,48 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2009,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_IMPL@
+#define @GUARD_NAME_IMPL@
+
+#include <blocks/@NAME@.h>
+
+namespace gr {
+ namespace blocks {
+
+ class BLOCKS_API @NAME_IMPL@ : public @NAME@
+ {
+ size_t d_vlen;
+
+ public:
+ @NAME_IMPL@(size_t vlen);
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* @GUARD_NAME_IMPL@ */
diff --git a/gr-blocks/lib/file_meta_sink_impl.cc b/gr-blocks/lib/file_meta_sink_impl.cc
new file mode 100644
index 000000000..b707bfac4
--- /dev/null
+++ b/gr-blocks/lib/file_meta_sink_impl.cc
@@ -0,0 +1,467 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "file_meta_sink_impl.h"
+#include <gr_io_signature.h>
+#include <cstdio>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <stdexcept>
+#include <stdio.h>
+
+// win32 (mingw/msvc) specific
+#ifdef HAVE_IO_H
+#include <io.h>
+#endif
+#ifdef O_BINARY
+#define OUR_O_BINARY O_BINARY
+#else
+#define OUR_O_BINARY 0
+#endif
+
+// should be handled via configure
+#ifdef O_LARGEFILE
+#define OUR_O_LARGEFILE O_LARGEFILE
+#else
+#define OUR_O_LARGEFILE 0
+#endif
+
+
+namespace gr {
+ namespace blocks {
+
+
+ file_meta_sink::sptr
+ file_meta_sink::make(size_t itemsize, const std::string &filename,
+ double samp_rate, double relative_rate,
+ gr_file_types type, bool complex,
+ size_t max_segment_size,
+ const std::string &extra_dict,
+ bool detached_header)
+ {
+ return gnuradio::get_initial_sptr
+ (new file_meta_sink_impl(itemsize, filename,
+ samp_rate, relative_rate,
+ type, complex,
+ max_segment_size,
+ extra_dict,
+ detached_header));
+ }
+
+ file_meta_sink_impl::file_meta_sink_impl(size_t itemsize,
+ const std::string &filename,
+ double samp_rate, double relative_rate,
+ gr_file_types type, bool complex,
+ size_t max_segment_size,
+ const std::string &extra_dict,
+ bool detached_header)
+ : gr_sync_block("file_meta_sink",
+ gr_make_io_signature(1, 1, itemsize),
+ gr_make_io_signature(0, 0, 0)),
+ d_itemsize(itemsize),
+ d_samp_rate(samp_rate), d_relative_rate(relative_rate),
+ d_max_seg_size(max_segment_size), d_total_seg_size(0),
+ d_updated(false), d_unbuffered(false)
+ {
+ d_fp = 0;
+ d_new_fp = 0;
+ d_hdr_fp = 0;
+ d_new_hdr_fp = 0;
+
+ if(detached_header == true)
+ d_state = STATE_DETACHED;
+ else
+ d_state = STATE_INLINE;
+
+ if(!open(filename))
+ throw std::runtime_error("file_meta_sink: can't open file\n");
+
+ pmt_t timestamp = pmt_make_tuple(pmt_from_uint64(0),
+ pmt_from_double(0));
+
+ // handle extra dictionary
+ d_extra = pmt_make_dict();
+ if(extra_dict.size() > 0) {
+ pmt_t extras = pmt_deserialize_str(extra_dict);
+ pmt_t keys = pmt_dict_keys(extras);
+ pmt_t vals = pmt_dict_values(extras);
+ size_t nitems = pmt_length(keys);
+ for(size_t i = 0; i < nitems; i++) {
+ d_extra = pmt_dict_add(d_extra,
+ pmt_nth(i, keys),
+ pmt_nth(i, vals));
+ }
+ }
+
+ d_extra_size = pmt_serialize_str(d_extra).size();
+
+ d_header = pmt_make_dict();
+ d_header = pmt_dict_add(d_header, mp("version"), mp(METADATA_VERSION));
+ d_header = pmt_dict_add(d_header, mp("rx_rate"), mp(samp_rate));
+ d_header = pmt_dict_add(d_header, mp("rx_time"), timestamp);
+ d_header = pmt_dict_add(d_header, mp("size"), pmt_from_long(d_itemsize));
+ d_header = pmt_dict_add(d_header, mp("type"), pmt_from_long(type));
+ d_header = pmt_dict_add(d_header, mp("cplx"), complex ? PMT_T : PMT_F);
+ d_header = pmt_dict_add(d_header, mp("strt"), pmt_from_uint64(METADATA_HEADER_SIZE+d_extra_size));
+ d_header = pmt_dict_add(d_header, mp("bytes"), pmt_from_uint64(0));
+
+ do_update();
+
+ if(d_state == STATE_DETACHED)
+ write_header(d_hdr_fp, d_header, d_extra);
+ else
+ write_header(d_fp, d_header, d_extra);
+ }
+
+ file_meta_sink_impl::~file_meta_sink_impl()
+ {
+ close();
+
+ if(d_fp) {
+ fclose(d_fp);
+ d_fp = 0;
+ }
+
+ if(d_state == STATE_DETACHED) {
+ if(d_hdr_fp) {
+ fclose(d_hdr_fp);
+ d_hdr_fp = 0;
+ }
+ }
+ }
+
+ bool
+ file_meta_sink_impl::open(const std::string &filename)
+ {
+ bool ret = true;
+ if(d_state == STATE_DETACHED) {
+ std::string s = filename + ".hdr";
+ ret = _open(&d_new_hdr_fp, s.c_str());
+ }
+
+ ret = ret && _open(&d_new_fp, filename.c_str());
+ d_updated = true;
+ return ret;
+ }
+
+ bool
+ file_meta_sink_impl::_open(FILE **fp, const char *filename)
+ {
+ gruel::scoped_lock guard(d_mutex); // hold mutex for duration of this function
+
+ bool ret = true;
+ int fd;
+
+ if((fd = ::open(filename,
+ O_WRONLY|O_CREAT|O_TRUNC|OUR_O_LARGEFILE|OUR_O_BINARY,
+ 0664)) < 0){
+ perror(filename);
+ return false;
+ }
+
+ if(*fp) { // if we've already got a new one open, close it
+ fclose(*fp);
+ fp = 0;
+ }
+
+ if((*fp = fdopen(fd, "wb")) == NULL) {
+ perror(filename);
+ ::close(fd); // don't leak file descriptor if fdopen fails.
+ }
+
+ ret = fp != 0;
+
+ return ret;
+ }
+
+ void
+ file_meta_sink_impl::close()
+ {
+ gruel::scoped_lock guard(d_mutex); // hold mutex for duration of this function
+ update_last_header();
+
+ if(d_state == STATE_DETACHED) {
+ if(d_new_hdr_fp) {
+ fclose(d_new_hdr_fp);
+ d_new_hdr_fp = 0;
+ }
+ }
+
+ if(d_new_fp) {
+ fclose(d_new_fp);
+ d_new_fp = 0;
+ }
+ d_updated = true;
+ }
+
+ void
+ file_meta_sink_impl::do_update()
+ {
+ if(d_updated) {
+ gruel::scoped_lock guard(d_mutex); // hold mutex for duration of this block
+ if(d_state == STATE_DETACHED) {
+ if(d_hdr_fp)
+ fclose(d_hdr_fp);
+ d_hdr_fp = d_new_hdr_fp; // install new file pointer
+ d_new_hdr_fp = 0;
+ }
+
+ if(d_fp)
+ fclose(d_fp);
+ d_fp = d_new_fp; // install new file pointer
+ d_new_fp = 0;
+
+ d_updated = false;
+ }
+ }
+
+ void
+ file_meta_sink_impl::write_header(FILE *fp, pmt_t header, pmt_t extra)
+ {
+ std::string header_str = pmt_serialize_str(header);
+ std::string extra_str = pmt_serialize_str(extra);
+
+ if((header_str.size() != METADATA_HEADER_SIZE) && (extra_str.size() != d_extra_size))
+ throw std::runtime_error("file_meta_sink: header or extras is wrong size.\n");
+
+ size_t nwritten = 0;
+ while(nwritten < header_str.size()) {
+ std::string sub = header_str.substr(nwritten);
+ int count = fwrite(sub.c_str(), sizeof(char), sub.size(), fp);
+ nwritten += count;
+ if((count == 0) && (ferror(fp))) {
+ fclose(fp);
+ throw std::runtime_error("file_meta_sink: error writing header to file.\n");
+ }
+ }
+
+ nwritten = 0;
+ while(nwritten < extra_str.size()) {
+ std::string sub = extra_str.substr(nwritten);
+ int count = fwrite(sub.c_str(), sizeof(char), sub.size(), fp);
+ nwritten += count;
+ if((count == 0) && (ferror(fp))) {
+ fclose(fp);
+ throw std::runtime_error("file_meta_sink: error writing extra to file.\n");
+ }
+ }
+
+ fflush(fp);
+ }
+
+ void
+ file_meta_sink_impl::update_header(pmt_t key, pmt_t value)
+ {
+ // Special handling caveat to transform rate from radio source into
+ // the rate at this sink.
+ if(pmt_eq(key, mp("rx_rate"))) {
+ d_samp_rate = pmt_to_double(value);
+ value = pmt_from_double(d_samp_rate*d_relative_rate);
+ }
+
+ // If the tag is not part of the standard header, we put it into the
+ // extra data, which either updates the current dictionary or adds a
+ // new item.
+ if(pmt_dict_has_key(d_header, key)) {
+ d_header = pmt_dict_add(d_header, key, value);
+ }
+ else {
+ d_extra = pmt_dict_add(d_extra, key, value);
+ d_extra_size = pmt_serialize_str(d_extra).size();
+ }
+ }
+
+ void
+ file_meta_sink_impl::update_last_header()
+ {
+ if(d_state == STATE_DETACHED)
+ update_last_header_detached();
+ else
+ update_last_header_inline();
+ }
+
+ void
+ file_meta_sink_impl::update_last_header_inline()
+ {
+ // Update the last header info with the number of samples this
+ // block represents.
+
+ size_t hdrlen = pmt_to_uint64(pmt_dict_ref(d_header, mp("strt"), PMT_NIL));
+ size_t seg_size = d_itemsize*d_total_seg_size;
+ pmt_t s = pmt_from_uint64(seg_size);
+ update_header(mp("bytes"), s);
+ update_header(mp("strt"), pmt_from_uint64(METADATA_HEADER_SIZE+d_extra_size));
+ fseek(d_fp, -seg_size-hdrlen, SEEK_CUR);
+ write_header(d_fp, d_header, d_extra);
+ fseek(d_fp, seg_size, SEEK_CUR);
+ }
+
+ void
+ file_meta_sink_impl::update_last_header_detached()
+ {
+ // Update the last header info with the number of samples this
+ // block represents.
+ size_t hdrlen = pmt_to_uint64(pmt_dict_ref(d_header, mp("strt"), PMT_NIL));
+ size_t seg_size = d_itemsize*d_total_seg_size;
+ pmt_t s = pmt_from_uint64(seg_size);
+ update_header(mp("bytes"), s);
+ update_header(mp("strt"), pmt_from_uint64(METADATA_HEADER_SIZE+d_extra_size));
+ fseek(d_hdr_fp, -hdrlen, SEEK_CUR);
+ write_header(d_hdr_fp, d_header, d_extra);
+ }
+
+ void
+ file_meta_sink_impl::write_and_update()
+ {
+ // New header, so set current size of chunk to 0 and start of chunk
+ // based on current index + header size.
+ //uint64_t loc = get_last_header_loc();
+ pmt_t s = pmt_from_uint64(0);
+ update_header(mp("bytes"), s);
+
+ // If we have multiple tags on the same offset, this makes
+ // sure we just overwrite the same header each time instead
+ // of creating a new header per tag.
+ s = pmt_from_uint64(METADATA_HEADER_SIZE + d_extra_size);
+ update_header(mp("strt"), s);
+
+ if(d_state == STATE_DETACHED)
+ write_header(d_hdr_fp, d_header, d_extra);
+ else
+ write_header(d_fp, d_header, d_extra);
+ }
+
+ void
+ file_meta_sink_impl::update_rx_time()
+ {
+ pmt_t rx_time = pmt_string_to_symbol("rx_time");
+ pmt_t r = pmt_dict_ref(d_header, rx_time, PMT_NIL);
+ uint64_t secs = pmt_to_uint64(pmt_tuple_ref(r, 0));
+ double fracs = pmt_to_double(pmt_tuple_ref(r, 1));
+ double diff = d_total_seg_size / (d_samp_rate*d_relative_rate);
+
+ //std::cerr << "old secs: " << secs << std::endl;
+ //std::cerr << "old fracs: " << fracs << std::endl;
+ //std::cerr << "seg size: " << d_total_seg_size << std::endl;
+ //std::cerr << "diff: " << diff << std::endl;
+
+ fracs += diff;
+ uint64_t new_secs = static_cast<uint64_t>(fracs);
+ secs += new_secs;
+ fracs -= new_secs;
+
+ //std::cerr << "new secs: " << secs << std::endl;
+ //std::cerr << "new fracs: " << fracs << std::endl << std::endl;
+
+ r = pmt_make_tuple(pmt_from_uint64(secs), pmt_from_double(fracs));
+ d_header = pmt_dict_add(d_header, rx_time, r);
+ }
+
+ int
+ file_meta_sink_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ char *inbuf = (char*)input_items[0];
+ int nwritten = 0;
+
+ do_update(); // update d_fp is reqd
+
+ if(!d_fp)
+ return noutput_items; // drop output on the floor
+
+ uint64_t abs_N = nitems_read(0);
+ uint64_t end_N = abs_N + (uint64_t)(noutput_items);
+ std::vector<gr_tag_t> all_tags;
+ get_tags_in_range(all_tags, 0, abs_N, end_N);
+
+ std::vector<gr_tag_t>::iterator itr;
+ for(itr = all_tags.begin(); itr != all_tags.end(); itr++) {
+ int item_offset = (int)(itr->offset - abs_N);
+
+ // Write date to file up to the next tag location
+ while(nwritten < item_offset) {
+ size_t towrite = std::min(d_max_seg_size - d_total_seg_size,
+ (size_t)(item_offset - nwritten));
+ int count = fwrite(inbuf, d_itemsize, towrite, d_fp);
+ if(count == 0) // FIXME add error handling
+ break;
+ nwritten += count;
+ inbuf += count * d_itemsize;
+
+ d_total_seg_size += count;
+
+ // Only add a new header if we are not at the position of the
+ // next tag
+ if((d_total_seg_size == d_max_seg_size) &&
+ (nwritten < item_offset)) {
+ update_last_header();
+ update_rx_time();
+ write_and_update();
+ d_total_seg_size = 0;
+ }
+ }
+
+ if(d_total_seg_size > 0) {
+ update_last_header();
+ update_header(itr->key, itr->value);
+ write_and_update();
+ d_total_seg_size = 0;
+ }
+ else {
+ update_header(itr->key, itr->value);
+ update_last_header();
+ }
+ }
+
+ // Finish up the rest of the data after tags
+ while(nwritten < noutput_items) {
+ size_t towrite = std::min(d_max_seg_size - d_total_seg_size,
+ (size_t)(noutput_items - nwritten));
+ int count = fwrite(inbuf, d_itemsize, towrite, d_fp);
+ if(count == 0) // FIXME add error handling
+ break;
+ nwritten += count;
+ inbuf += count * d_itemsize;
+
+ d_total_seg_size += count;
+ if(d_total_seg_size == d_max_seg_size) {
+ update_last_header();
+ update_rx_time();
+ write_and_update();
+ d_total_seg_size = 0;
+ }
+ }
+
+ if(d_unbuffered)
+ fflush(d_fp);
+
+ return nwritten;
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/file_meta_sink_impl.h b/gr-blocks/lib/file_meta_sink_impl.h
new file mode 100644
index 000000000..566c997b3
--- /dev/null
+++ b/gr-blocks/lib/file_meta_sink_impl.h
@@ -0,0 +1,96 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_BLOCKS_FILE_META_SINK_IMPL_H
+#define INCLUDED_BLOCKS_FILE_META_SINK_IMPL_H
+
+#include <blocks/file_meta_sink.h>
+#include <gruel/pmt.h>
+#include <gruel/thread.h>
+
+using namespace pmt;
+
+namespace gr {
+ namespace blocks {
+
+ class file_meta_sink_impl : public file_meta_sink
+ {
+ private:
+ enum meta_state_t {
+ STATE_INLINE=0,
+ STATE_DETACHED
+ };
+
+ size_t d_itemsize;
+ double d_samp_rate;
+ double d_relative_rate;
+ size_t d_max_seg_size;
+ size_t d_total_seg_size;
+ pmt_t d_header;
+ pmt_t d_extra;
+ size_t d_extra_size;
+ bool d_updated;
+ bool d_unbuffered;
+
+ boost::mutex d_mutex;
+ FILE *d_new_fp, *d_new_hdr_fp;
+ FILE *d_fp, *d_hdr_fp;
+ meta_state_t d_state;
+
+ protected:
+ void write_header(FILE *fp, pmt_t header, pmt_t extra);
+ void update_header(pmt_t key, pmt_t value);
+ void update_last_header();
+ void update_last_header_inline();
+ void update_last_header_detached();
+ void write_and_update();
+ void update_rx_time();
+
+ bool _open(FILE **fp, const char *filename);
+
+ public:
+ file_meta_sink_impl(size_t itemsize, const std::string &filename,
+ double samp_rate=1, double relative_rate=1,
+ gr_file_types type=GR_FILE_FLOAT, bool complex=true,
+ size_t max_segment_size=1000000,
+ const std::string &extra_dict="",
+ bool detached_header=false);
+ ~file_meta_sink_impl();
+
+ bool open(const std::string &filename);
+ void close();
+ void do_update();
+
+ void set_unbuffered(bool unbuffered)
+ {
+ d_unbuffered = unbuffered;
+ }
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_BLOCKS_FILE_META_SINK_IMPL_H */
diff --git a/gr-blocks/lib/file_meta_source_impl.cc b/gr-blocks/lib/file_meta_source_impl.cc
new file mode 100644
index 000000000..316f5e7d1
--- /dev/null
+++ b/gr-blocks/lib/file_meta_source_impl.cc
@@ -0,0 +1,444 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "file_meta_source_impl.h"
+#include <gr_io_signature.h>
+#include <cstdio>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <stdexcept>
+#include <stdio.h>
+
+// win32 (mingw/msvc) specific
+#ifdef HAVE_IO_H
+#include <io.h>
+#endif
+#ifdef O_BINARY
+#define OUR_O_BINARY O_BINARY
+#else
+#define OUR_O_BINARY 0
+#endif
+
+// should be handled via configure
+#ifdef O_LARGEFILE
+#define OUR_O_LARGEFILE O_LARGEFILE
+#else
+#define OUR_O_LARGEFILE 0
+#endif
+
+
+namespace gr {
+ namespace blocks {
+
+
+ file_meta_source::sptr
+ file_meta_source::make(const std::string &filename,
+ bool repeat,
+ bool detached_header,
+ const std::string &hdr_filename)
+ {
+ return gnuradio::get_initial_sptr
+ (new file_meta_source_impl(filename,
+ repeat,
+ detached_header,
+ hdr_filename));
+ }
+
+ file_meta_source_impl::file_meta_source_impl(const std::string &filename,
+ bool repeat,
+ bool detached_header,
+ const std::string &hdr_filename)
+ : gr_sync_block("file_meta_source",
+ gr_make_io_signature(0, 0, 0),
+ gr_make_io_signature(1, 1, 1)),
+ d_itemsize(0), d_samp_rate(0),
+ d_seg_size(0),
+ d_updated(false), d_repeat(repeat)
+ {
+ d_fp = 0;
+ d_new_fp = 0;
+ d_hdr_fp = 0;
+ d_new_hdr_fp = 0;
+
+ if(detached_header == true) {
+ d_state = STATE_DETACHED;
+ }
+ else
+ d_state = STATE_INLINE;
+
+ if(!open(filename, hdr_filename))
+ throw std::runtime_error("file_meta_source: can't open file\n");
+
+ do_update();
+
+ pmt_t hdr = PMT_NIL, extras = PMT_NIL;
+ if(read_header(hdr, extras)) {
+ parse_header(hdr, 0, d_tags);
+ parse_extras(extras, 0, d_tags);
+ }
+ else
+ throw std::runtime_error("file_meta_source: could not read header.\n");
+
+ // Set output signature based on itemsize info in header
+ set_output_signature(gr_make_io_signature(1, 1, d_itemsize));
+ }
+
+ file_meta_source_impl::~file_meta_source_impl()
+ {
+ close();
+
+ if(d_fp) {
+ fclose(d_fp);
+ d_fp = 0;
+ }
+
+ if(d_state == STATE_DETACHED) {
+ if(d_hdr_fp) {
+ fclose(d_hdr_fp);
+ d_hdr_fp = 0;
+ }
+ }
+ }
+
+ bool
+ file_meta_source_impl::read_header(pmt_t &hdr, pmt_t &extras)
+ {
+ // Select which file handle to read from.
+ FILE *fp;
+ if(d_state == STATE_DETACHED)
+ fp = d_hdr_fp;
+ else
+ fp = d_fp;
+
+ size_t ret;
+ size_t size = 0;
+ std::string str;
+ char *hdr_buffer = new char[METADATA_HEADER_SIZE];
+ while(size < METADATA_HEADER_SIZE) {
+ ret = fread(&hdr_buffer[size], sizeof(char), METADATA_HEADER_SIZE-size, fp);
+ if(ret == 0) {
+ delete [] hdr_buffer;
+ if(feof(fp))
+ return false;
+ else {
+ std::stringstream s;
+ s << "file_meta_source: error occurred extracting header: "
+ << strerror(errno) << std::endl;
+ throw std::runtime_error(s.str());
+ }
+ }
+ size += ret;
+ }
+
+ // Convert to string or the char array gets confused by the \0
+ str.insert(0, hdr_buffer, METADATA_HEADER_SIZE);
+ hdr = pmt_deserialize_str(str);
+ delete [] hdr_buffer;
+
+ uint64_t seg_start, extra_len;
+ pmt_t r, dump;
+ if(pmt_dict_has_key(hdr, pmt_string_to_symbol("strt"))) {
+ r = pmt_dict_ref(hdr, pmt_string_to_symbol("strt"), dump);
+ seg_start = pmt_to_uint64(r);
+ extra_len = seg_start - METADATA_HEADER_SIZE;
+ }
+
+ if(extra_len > 0) {
+ size = 0;
+ hdr_buffer = new char[extra_len];
+ while(size < extra_len) {
+ ret = fread(&hdr_buffer[size], sizeof(char), extra_len-size, fp);
+ if(ret == 0) {
+ delete [] hdr_buffer;
+ if(feof(fp))
+ return false;
+ else {
+ std::stringstream s;
+ s << "file_meta_source: error occurred extracting extras: "
+ << strerror(errno) << std::endl;
+ throw std::runtime_error(s.str());
+ }
+ }
+ size += ret;
+ }
+
+ str.clear();
+ str.insert(0, hdr_buffer, extra_len);
+ extras = pmt_deserialize_str(str);
+ delete [] hdr_buffer;
+ }
+
+ return true;
+ }
+
+ void
+ file_meta_source_impl::parse_header(pmt_t hdr, uint64_t offset,
+ std::vector<gr_tag_t> &tags)
+ {
+ pmt_t r, key;
+
+ // GET SAMPLE RATE
+ key = pmt_string_to_symbol("rx_rate");
+ if(pmt_dict_has_key(hdr, key)) {
+ r = pmt_dict_ref(hdr, key, PMT_NIL);
+ d_samp_rate = pmt_to_double(r);
+
+ gr_tag_t t;
+ t.offset = offset;
+ t.key = key;
+ t.value = r;
+ t.srcid = alias_pmt();
+ tags.push_back(t);
+ }
+ else {
+ throw std::runtime_error("file_meta_source: Could not extract sample rate.\n");
+ }
+
+ // GET TIME STAMP
+ key = pmt_string_to_symbol("rx_time");
+ if(pmt_dict_has_key(hdr, key)) {
+ d_time_stamp = pmt_dict_ref(hdr, key, PMT_NIL);
+
+ gr_tag_t t;
+ t.offset = offset;
+ t.key = key;
+ t.value = d_time_stamp;
+ t.srcid = alias_pmt();
+ tags.push_back(t);
+ }
+ else {
+ throw std::runtime_error("file_meta_source: Could not extract time stamp.\n");
+ }
+
+ // GET ITEM SIZE OF DATA
+ if(pmt_dict_has_key(hdr, pmt_string_to_symbol("size"))) {
+ d_itemsize = pmt_to_long(pmt_dict_ref(hdr, pmt_string_to_symbol("size"), PMT_NIL));
+ }
+ else {
+ throw std::runtime_error("file_meta_source: Could not extract item size.\n");
+ }
+
+ // GET SEGMENT SIZE
+ if(pmt_dict_has_key(hdr, pmt_string_to_symbol("bytes"))) {
+ d_seg_size = pmt_to_uint64(pmt_dict_ref(hdr, pmt_string_to_symbol("bytes"), PMT_NIL));
+
+ // Convert from bytes to items
+ d_seg_size /= d_itemsize;
+ }
+ else {
+ throw std::runtime_error("file_meta_source: Could not extract segment size.\n");
+ }
+ }
+
+ void
+ file_meta_source_impl::parse_extras(pmt_t extras, uint64_t offset,
+ std::vector<gr_tag_t> &tags)
+ {
+ pmt_t item, key, val;
+
+ size_t nitems = pmt_length(extras);
+ for(size_t i = 0; i < nitems; i++) {
+ item = pmt_nth(i, extras);
+ key = pmt_car(item);
+ val = pmt_cdr(item);
+
+ gr_tag_t t;
+ t.offset = offset;
+ t.key = key;
+ t.value = val;
+ t.srcid = alias_pmt();
+ tags.push_back(t);
+ }
+ }
+
+ bool
+ file_meta_source_impl::open(const std::string &filename,
+ const std::string &hdr_filename)
+ {
+ bool ret = true;
+ if(d_state == STATE_DETACHED) {
+ std::string s;
+ if(hdr_filename == "")
+ s = filename + ".hdr";
+ else
+ s = hdr_filename;
+ ret = _open(&d_new_hdr_fp, s.c_str());
+ }
+
+ ret = ret && _open(&d_new_fp, filename.c_str());
+ d_updated = true;
+ return ret;
+ }
+
+ bool
+ file_meta_source_impl::_open(FILE **fp, const char *filename)
+ {
+ gruel::scoped_lock guard(d_mutex); // hold mutex for duration of this function
+
+ bool ret = true;
+ int fd;
+
+ if((fd = ::open(filename,
+ O_RDONLY|OUR_O_LARGEFILE|OUR_O_BINARY)) < 0) {
+ perror(filename);
+ return false;
+ }
+
+ if(*fp) { // if we've already got a new one open, close it
+ fclose(*fp);
+ fp = 0;
+ }
+
+ if((*fp = fdopen(fd, "rb")) == NULL) {
+ perror(filename);
+ ::close(fd); // don't leak file descriptor if fdopen fails.
+ }
+
+ ret = fp != 0;
+
+ return ret;
+ }
+
+ void
+ file_meta_source_impl::close()
+ {
+ gruel::scoped_lock guard(d_mutex); // hold mutex for duration of this function
+ if(d_state == STATE_DETACHED) {
+ if(d_new_hdr_fp) {
+ fclose(d_new_hdr_fp);
+ d_new_hdr_fp = 0;
+ }
+ }
+
+ if(d_new_fp) {
+ fclose(d_new_fp);
+ d_new_fp = 0;
+ }
+ d_updated = true;
+ }
+
+ void
+ file_meta_source_impl::do_update()
+ {
+ if(d_updated) {
+ gruel::scoped_lock guard(d_mutex); // hold mutex for duration of this block
+ if(d_state == STATE_DETACHED) {
+ if(d_hdr_fp)
+ fclose(d_hdr_fp);
+ d_hdr_fp = d_new_hdr_fp; // install new file pointer
+ d_new_hdr_fp = 0;
+ }
+
+ if(d_fp)
+ fclose(d_fp);
+ d_fp = d_new_fp; // install new file pointer
+ d_new_fp = 0;
+
+ d_updated = false;
+ }
+ }
+
+ int
+ file_meta_source_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ // We've reached the end of a segment; parse the next header and get
+ // the new tags to send and set the next segment size.
+ if(d_seg_size == 0) {
+ pmt_t hdr=PMT_NIL, extras=PMT_NIL;
+ if(read_header(hdr, extras)) {
+ parse_header(hdr, nitems_written(0), d_tags);
+ parse_extras(extras, nitems_written(0), d_tags);
+ }
+ else {
+ if(!d_repeat)
+ return -1;
+ else {
+ if(fseek(d_fp, 0, SEEK_SET) == -1) {
+ std::stringstream s;
+ s << "[" << __FILE__ << "]" << " fseek failed" << std::endl;
+ throw std::runtime_error(s.str());
+ }
+ }
+ }
+ }
+
+ char *out = (char*)output_items[0];
+ int i;
+ int seg_size = std::min(noutput_items, (int)d_seg_size);
+ int size = seg_size;
+
+ do_update(); // update d_fp is reqd
+ if(d_fp == NULL)
+ throw std::runtime_error("work with file not open");
+
+ // Push all tags onto the stream and remove them from the vector
+ while(!d_tags.empty()) {
+ add_item_tag(0, d_tags.back());
+ d_tags.pop_back();
+ }
+
+ gruel::scoped_lock lock(d_mutex); // hold for the rest of this function
+ while(size) {
+ i = fread(out, d_itemsize, size, d_fp);
+
+ size -= i;
+ d_seg_size -= i;
+ out += i * d_itemsize;
+
+ if(size == 0) // done
+ break;
+
+ if(i > 0) // short read, try again
+ continue;
+
+ // We got a zero from fread. This is either EOF or error. In
+ // any event, if we're in repeat mode, seek back to the beginning
+ // of the file and try again, else break
+
+ if(!d_repeat)
+ break;
+
+ if(fseek(d_fp, 0, SEEK_SET) == -1) {
+ std::stringstream s;
+ s << "[" << __FILE__ << "]" << " fseek failed" << std::endl;
+ throw std::runtime_error(s.str());
+ }
+ }
+
+ if(size > 0) { // EOF or error
+ if(size == seg_size) // we didn't read anything; say we're done
+ return -1;
+ return seg_size - size; // else return partial result
+ }
+
+ return seg_size;
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/file_meta_source_impl.h b/gr-blocks/lib/file_meta_source_impl.h
new file mode 100644
index 000000000..ca7ddc6e1
--- /dev/null
+++ b/gr-blocks/lib/file_meta_source_impl.h
@@ -0,0 +1,89 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_BLOCKS_FILE_META_SOURCE_IMPL_H
+#define INCLUDED_BLOCKS_FILE_META_SOURCE_IMPL_H
+
+#include <blocks/file_meta_source.h>
+#include <gr_tags.h>
+#include <gruel/pmt.h>
+#include <gruel/thread.h>
+
+#include <blocks/file_meta_sink.h>
+
+using namespace pmt;
+
+namespace gr {
+ namespace blocks {
+
+ class file_meta_source_impl : public file_meta_source
+ {
+ private:
+ enum meta_state_t {
+ STATE_INLINE=0,
+ STATE_DETACHED
+ };
+
+ size_t d_itemsize;
+ double d_samp_rate;
+ pmt_t d_time_stamp;
+ size_t d_seg_size;
+ bool d_updated;
+ bool d_repeat;
+
+ gruel::mutex d_mutex;
+ FILE *d_new_fp, *d_new_hdr_fp;
+ FILE *d_fp, *d_hdr_fp;
+ meta_state_t d_state;
+
+ std::vector<gr_tag_t> d_tags;
+
+ protected:
+ bool _open(FILE **fp, const char *filename);
+ bool read_header(pmt_t &hdr, pmt_t &extras);
+ void parse_header(pmt_t hdr, uint64_t offset,
+ std::vector<gr_tag_t> &tags);
+ void parse_extras(pmt_t extras, uint64_t offset,
+ std::vector<gr_tag_t> &tags);
+
+ public:
+ file_meta_source_impl(const std::string &filename,
+ bool repeat=false,
+ bool detached_header=false,
+ const std::string &hdr_filename="");
+
+ ~file_meta_source_impl();
+
+ bool open(const std::string &filename,
+ const std::string &hdr_filename="");
+ void close();
+ void do_update();
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_BLOCKS_FILE_META_SOURCE_IMPL_H */
diff --git a/gr-blocks/lib/file_source_impl.cc b/gr-blocks/lib/file_source_impl.cc
new file mode 100644
index 000000000..dcbd04210
--- /dev/null
+++ b/gr-blocks/lib/file_source_impl.cc
@@ -0,0 +1,189 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gruel/thread.h>
+#include "file_source_impl.h"
+#include <gr_io_signature.h>
+#include <cstdio>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <stdexcept>
+#include <stdio.h>
+
+// win32 (mingw/msvc) specific
+#ifdef HAVE_IO_H
+#include <io.h>
+#endif
+#ifdef O_BINARY
+#define OUR_O_BINARY O_BINARY
+#else
+#define OUR_O_BINARY 0
+#endif
+// should be handled via configure
+#ifdef O_LARGEFILE
+#define OUR_O_LARGEFILE O_LARGEFILE
+#else
+#define OUR_O_LARGEFILE 0
+#endif
+
+namespace gr {
+ namespace blocks {
+
+ file_source::sptr file_source::make(size_t itemsize, const char *filename, bool repeat)
+ {
+ return gnuradio::get_initial_sptr
+ (new file_source_impl(itemsize, filename, repeat));
+ }
+
+ file_source_impl::file_source_impl(size_t itemsize, const char *filename, bool repeat)
+ : gr_sync_block("file_source",
+ gr_make_io_signature(0, 0, 0),
+ gr_make_io_signature(1, 1, itemsize)),
+ d_itemsize(itemsize), d_fp(0), d_new_fp(0), d_repeat(repeat),
+ d_updated(false)
+ {
+ open(filename, repeat);
+ }
+
+ file_source_impl::~file_source_impl()
+ {
+ fclose ((FILE*)d_fp);
+ }
+
+ bool
+ file_source_impl::seek(long seek_point, int whence)
+ {
+ return fseek((FILE*)d_fp, seek_point *d_itemsize, whence) == 0;
+ }
+
+
+ void
+ file_source_impl::open(const char *filename, bool repeat)
+ {
+ // obtain exclusive access for duration of this function
+ gruel::scoped_lock lock(fp_mutex);
+
+ int fd;
+
+ // we use "open" to use to the O_LARGEFILE flag
+ if((fd = ::open(filename, O_RDONLY | OUR_O_LARGEFILE | OUR_O_BINARY)) < 0) {
+ perror(filename);
+ throw std::runtime_error("can't open file");
+ }
+
+ if(d_new_fp) {
+ fclose(d_new_fp);
+ d_new_fp = 0;
+ }
+
+ if((d_new_fp = fdopen (fd, "rb")) == NULL) {
+ perror(filename);
+ ::close(fd); // don't leak file descriptor if fdopen fails
+ throw std::runtime_error("can't open file");
+ }
+
+ d_updated = true;
+ d_repeat = repeat;
+ }
+
+ void
+ file_source_impl::close()
+ {
+ // obtain exclusive access for duration of this function
+ gruel::scoped_lock lock(fp_mutex);
+
+ if(d_new_fp != NULL) {
+ fclose(d_new_fp);
+ d_new_fp = NULL;
+ }
+ d_updated = true;
+ }
+
+ void
+ file_source_impl::do_update()
+ {
+ if(d_updated) {
+ gruel::scoped_lock lock(fp_mutex); // hold while in scope
+
+ if(d_fp)
+ fclose(d_fp);
+
+ d_fp = d_new_fp; // install new file pointer
+ d_new_fp = 0;
+ d_updated = false;
+ }
+ }
+
+ int
+ file_source_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ char *o = (char*)output_items[0];
+ int i;
+ int size = noutput_items;
+
+ do_update(); // update d_fp is reqd
+ if(d_fp == NULL)
+ throw std::runtime_error("work with file not open");
+
+ gruel::scoped_lock lock(fp_mutex); // hold for the rest of this function
+ while(size) {
+ i = fread(o, d_itemsize, size, (FILE*)d_fp);
+
+ size -= i;
+ o += i * d_itemsize;
+
+ if(size == 0) // done
+ break;
+
+ if(i > 0) // short read, try again
+ continue;
+
+ // We got a zero from fread. This is either EOF or error. In
+ // any event, if we're in repeat mode, seek back to the beginning
+ // of the file and try again, else break
+ if(!d_repeat)
+ break;
+
+ if(fseek ((FILE *) d_fp, 0, SEEK_SET) == -1) {
+ fprintf(stderr, "[%s] fseek failed\n", __FILE__);
+ exit(-1);
+ }
+ }
+
+ if(size > 0) { // EOF or error
+ if(size == noutput_items) // we didn't read anything; say we're done
+ return -1;
+ return noutput_items - size; // else return partial result
+ }
+
+ return noutput_items;
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/file_source_impl.h b/gr-blocks/lib/file_source_impl.h
new file mode 100644
index 000000000..fc7f8053d
--- /dev/null
+++ b/gr-blocks/lib/file_source_impl.h
@@ -0,0 +1,60 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_BLOCKS_FILE_SOURCE_IMPL_H
+#define INCLUDED_BLOCKS_FILE_SOURCE_IMPL_H
+
+#include <blocks/file_source.h>
+#include <boost/thread/mutex.hpp>
+
+namespace gr {
+ namespace blocks {
+
+ class BLOCKS_API file_source_impl : public file_source
+ {
+ private:
+ size_t d_itemsize;
+ FILE *d_fp;
+ FILE *d_new_fp;
+ bool d_repeat;
+ bool d_updated;
+ boost::mutex fp_mutex;
+
+ void do_update();
+
+ public:
+ file_source_impl(size_t itemsize, const char *filename, bool repeat);
+ ~file_source_impl();
+
+ bool seek(long seek_point, int whence);
+ void open(const char *filename, bool repeat);
+ void close();
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_BLOCKS_FILE_SOURCE_IMPL_H */
diff --git a/gr-blocks/lib/float_array_to_int.cc b/gr-blocks/lib/float_array_to_int.cc
new file mode 100644
index 000000000..66b112c06
--- /dev/null
+++ b/gr-blocks/lib/float_array_to_int.cc
@@ -0,0 +1,46 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2011-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
+
+#define _ISOC9X_SOURCE
+#include <float_array_to_int.h>
+#include <math.h>
+#include <stdint.h>
+
+static const int64_t MAX_INT = 2147483647; // (2^31)-1
+static const int64_t MIN_INT = -2147483647; // -(2^31)-1
+
+void
+float_array_to_int(const float *in, int *out, float scale, int nsamples)
+{
+ for (int i = 0; i < nsamples; i++){
+ int64_t r = llrintf(scale * in[i]);
+ if (r < MIN_INT)
+ r = MIN_INT;
+ else if (r > MAX_INT)
+ r = MAX_INT;
+ out[i] = static_cast<int>(r);
+ }
+}
diff --git a/gr-blocks/lib/float_array_to_int.h b/gr-blocks/lib/float_array_to_int.h
new file mode 100644
index 000000000..943736d7e
--- /dev/null
+++ b/gr-blocks/lib/float_array_to_int.h
@@ -0,0 +1,33 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2011-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 INCLUDED_BLOCKS_FLOAT_ARRAY_TO_INT_H
+#define INCLUDED_BLOCKS_FLOAT_ARRAY_TO_INT_H
+
+#include <blocks/api.h>
+
+/*!
+ * convert array of floats to int with rounding and saturation.
+ */
+BLOCKS_API void float_array_to_int (const float *in, int *out, float scale, int nsamples);
+
+#endif /* INCLUDED_BLOCKS_FLOAT_ARRAY_TO_INT_H */
diff --git a/gr-blocks/lib/float_array_to_uchar.cc b/gr-blocks/lib/float_array_to_uchar.cc
new file mode 100644
index 000000000..06688e7b0
--- /dev/null
+++ b/gr-blocks/lib/float_array_to_uchar.cc
@@ -0,0 +1,45 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002,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
+
+#define _ISOC9X_SOURCE
+#include <float_array_to_uchar.h>
+#include <math.h>
+
+static const int MIN_UCHAR = 0;
+static const int MAX_UCHAR = 255;
+
+void
+float_array_to_uchar(const float *in, unsigned char *out, int nsamples)
+{
+ for (int i = 0; i < nsamples; i++){
+ long int r = (long int) rint (in[i]);
+ if (r < MIN_UCHAR)
+ r = MIN_UCHAR;
+ else if (r > MAX_UCHAR)
+ r = MAX_UCHAR;
+ out[i] = r;
+ }
+}
diff --git a/gr-blocks/lib/float_array_to_uchar.h b/gr-blocks/lib/float_array_to_uchar.h
new file mode 100644
index 000000000..defed8e3e
--- /dev/null
+++ b/gr-blocks/lib/float_array_to_uchar.h
@@ -0,0 +1,33 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002,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 INCLUDED_FLOAT_ARRAY_TO_UCHAR_H
+#define INCLUDED_FLOAT_ARRAY_TO_UCHAR_H
+
+#include <blocks/api.h>
+
+/*!
+ * convert array of floats to unsigned chars with rounding and saturation.
+ */
+BLOCKS_API void float_array_to_uchar (const float *in, unsigned char *out, int nsamples);
+
+#endif /* INCLUDED_FLOAT_ARRAY_TO_UCHAR_H */
diff --git a/gr-blocks/lib/float_to_char_impl.cc b/gr-blocks/lib/float_to_char_impl.cc
new file mode 100644
index 000000000..c37522dc9
--- /dev/null
+++ b/gr-blocks/lib/float_to_char_impl.cc
@@ -0,0 +1,69 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "float_to_char_impl.h"
+#include <gr_io_signature.h>
+#include <volk/volk.h>
+
+namespace gr {
+ namespace blocks {
+
+ float_to_char::sptr float_to_char::make(size_t vlen, float scale)
+ {
+ return gnuradio::get_initial_sptr(new float_to_char_impl(vlen, scale));
+ }
+
+ float_to_char_impl::float_to_char_impl(size_t vlen, float scale)
+ : gr_sync_block("float_to_char",
+ gr_make_io_signature (1, 1, sizeof(float)*vlen),
+ gr_make_io_signature (1, 1, sizeof(char)*vlen)),
+ d_vlen(vlen), d_scale(scale)
+ {
+ const int alignment_multiple =
+ volk_get_alignment() / sizeof(char);
+ set_alignment(std::max(1, alignment_multiple));
+ }
+
+ int
+ float_to_char_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const float *in = (const float *) input_items[0];
+ int8_t *out = (int8_t *) output_items[0];
+
+ if(is_unaligned()) {
+ volk_32f_s32f_convert_8i_u(out, in, d_scale, d_vlen*noutput_items);
+ }
+ else {
+ volk_32f_s32f_convert_8i_a(out, in, d_scale, d_vlen*noutput_items);
+ }
+
+ return noutput_items;
+ }
+
+ } /* namespace blocks */
+}/* namespace gr */
diff --git a/gr-blocks/lib/float_to_char_impl.h b/gr-blocks/lib/float_to_char_impl.h
new file mode 100644
index 000000000..2644f3e70
--- /dev/null
+++ b/gr-blocks/lib/float_to_char_impl.h
@@ -0,0 +1,51 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_FLOAT_TO_CHAR_IMPL_H
+#define INCLUDED_FLOAT_TO_CHAR_IMPL_H
+
+#include <blocks/float_to_char.h>
+
+namespace gr {
+ namespace blocks {
+
+ class BLOCKS_API float_to_char_impl : public float_to_char
+ {
+ size_t d_vlen;
+ float d_scale;
+
+ public:
+ float_to_char_impl(size_t vlen, float scale);
+
+ virtual float scale() const { return d_scale; }
+ virtual void set_scale(float scale) { d_scale = scale; }
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+
+#endif /* INCLUDED_FLOAT_TO_CHAR_IMPL_H */
diff --git a/gr-blocks/lib/float_to_complex_impl.cc b/gr-blocks/lib/float_to_complex_impl.cc
new file mode 100644
index 000000000..709aa420c
--- /dev/null
+++ b/gr-blocks/lib/float_to_complex_impl.cc
@@ -0,0 +1,78 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "float_to_complex_impl.h"
+#include <gr_io_signature.h>
+#include <volk/volk.h>
+
+namespace gr {
+ namespace blocks {
+
+ float_to_complex::sptr float_to_complex::make(size_t vlen)
+ {
+ return gnuradio::get_initial_sptr(new float_to_complex_impl(vlen));
+ }
+
+ float_to_complex_impl::float_to_complex_impl(size_t vlen)
+ : gr_sync_block("float_to_complex",
+ gr_make_io_signature (1, 2, sizeof(float)*vlen),
+ gr_make_io_signature (1, 1, sizeof(gr_complex)*vlen)),
+ d_vlen(vlen)
+ {
+ const int alignment_multiple =
+ volk_get_alignment() / sizeof(float);
+ set_alignment(std::max(1,alignment_multiple));
+ }
+
+ int
+ float_to_complex_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ float *r = (float *)input_items[0];
+ float *i = (float *)input_items[1];
+ gr_complex *out = (gr_complex *) output_items[0];
+
+ switch (input_items.size ()){
+ case 1:
+ for (size_t j = 0; j < noutput_items*d_vlen; j++)
+ out[j] = gr_complex (r[j], 0);
+ break;
+
+ case 2:
+ for (size_t j = 0; j < noutput_items*d_vlen; j++)
+ out[j] = gr_complex (r[j], i[j]);
+ break;
+
+ default:
+ assert (0);
+ }
+
+ return noutput_items;
+ }
+
+ } /* namespace blocks */
+}/* namespace gr */
diff --git a/gr-blocks/lib/float_to_complex_impl.h b/gr-blocks/lib/float_to_complex_impl.h
new file mode 100644
index 000000000..859c5bf96
--- /dev/null
+++ b/gr-blocks/lib/float_to_complex_impl.h
@@ -0,0 +1,47 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_FLOAT_TO_COMPLEX_IMPL_H
+#define INCLUDED_FLOAT_TO_COMPLEX_IMPL_H
+
+#include <blocks/float_to_complex.h>
+
+namespace gr {
+ namespace blocks {
+
+ class BLOCKS_API float_to_complex_impl : public float_to_complex
+ {
+ size_t d_vlen;
+
+ public:
+ float_to_complex_impl(size_t vlen);
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+
+#endif /* INCLUDED_FLOAT_TO_COMPLEX_IMPL_H */
diff --git a/gr-blocks/lib/float_to_int_impl.cc b/gr-blocks/lib/float_to_int_impl.cc
new file mode 100644
index 000000000..24218ab68
--- /dev/null
+++ b/gr-blocks/lib/float_to_int_impl.cc
@@ -0,0 +1,83 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "float_to_int_impl.h"
+#include "float_array_to_int.h"
+#include <gr_io_signature.h>
+#include <volk/volk.h>
+
+namespace gr {
+ namespace blocks {
+
+ float_to_int::sptr float_to_int::make(size_t vlen, float scale)
+ {
+ return gnuradio::get_initial_sptr(new float_to_int_impl(vlen, scale));
+ }
+
+ float_to_int_impl::float_to_int_impl(size_t vlen, float scale)
+ : gr_sync_block("float_to_int",
+ gr_make_io_signature (1, 1, sizeof(float)*vlen),
+ gr_make_io_signature (1, 1, sizeof(int)*vlen)),
+ d_vlen(vlen), d_scale(scale)
+ {
+ const int alignment_multiple =
+ volk_get_alignment() / sizeof(int);
+ set_alignment(std::max(1, alignment_multiple));
+ }
+
+ int
+ float_to_int_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ // Disable the Volk for now. There is a problem for large 32-bit ints that
+ // are not properly represented by the precisions of a single float, which
+ // can cause wrapping from large, positive numbers to negative.
+ // In gri_float_to_int, the value is first promoted to a 64-bit
+ // value, clipped, then converted to a float.
+#if 0
+ const float *in = (const float *) input_items[0];
+ int32_t *out = (int32_t *) output_items[0];
+
+ if(is_unaligned()) {
+ volk_32f_s32f_convert_32i_u(out, in, d_scale, d_vlen*noutput_items);
+ }
+ else {
+ volk_32f_s32f_convert_32i_a(out, in, d_scale, d_vlen*noutput_items);
+ }
+#else
+ const float *in = (const float *) input_items[0];
+ int *out = (int *) output_items[0];
+
+ float_array_to_int (in, out, d_scale, d_vlen*noutput_items);
+
+#endif
+
+ return noutput_items;
+ }
+
+ } /* namespace blocks */
+}/* namespace gr */
diff --git a/gr-blocks/lib/float_to_int_impl.h b/gr-blocks/lib/float_to_int_impl.h
new file mode 100644
index 000000000..71775fcb1
--- /dev/null
+++ b/gr-blocks/lib/float_to_int_impl.h
@@ -0,0 +1,51 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_FLOAT_TO_INT_IMPL_H
+#define INCLUDED_FLOAT_TO_INT_IMPL_H
+
+#include <blocks/float_to_int.h>
+
+namespace gr {
+ namespace blocks {
+
+ class BLOCKS_API float_to_int_impl : public float_to_int
+ {
+ size_t d_vlen;
+ float d_scale;
+
+ public:
+ float_to_int_impl(size_t vlen, float scale);
+
+ virtual float scale() const { return d_scale; }
+ virtual void set_scale(float scale) { d_scale = scale; }
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+
+#endif /* INCLUDED_FLOAT_TO_INT_IMPL_H */
diff --git a/gr-blocks/lib/float_to_short_impl.cc b/gr-blocks/lib/float_to_short_impl.cc
new file mode 100644
index 000000000..2807ae192
--- /dev/null
+++ b/gr-blocks/lib/float_to_short_impl.cc
@@ -0,0 +1,69 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "float_to_short_impl.h"
+#include <gr_io_signature.h>
+#include <volk/volk.h>
+
+namespace gr {
+ namespace blocks {
+
+ float_to_short::sptr float_to_short::make(size_t vlen, float scale)
+ {
+ return gnuradio::get_initial_sptr(new float_to_short_impl(vlen, scale));
+ }
+
+ float_to_short_impl::float_to_short_impl(size_t vlen, float scale)
+ : gr_sync_block("float_to_short",
+ gr_make_io_signature (1, 1, sizeof(float)*vlen),
+ gr_make_io_signature (1, 1, sizeof(short)*vlen)),
+ d_vlen(vlen), d_scale(scale)
+ {
+ const int alignment_multiple =
+ volk_get_alignment() / sizeof(short);
+ set_alignment(std::max(1, alignment_multiple));
+ }
+
+ int
+ float_to_short_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const float *in = (const float *) input_items[0];
+ short *out = (short *) output_items[0];
+
+ if(is_unaligned()) {
+ volk_32f_s32f_convert_16i_u(out, in, d_scale, d_vlen*noutput_items);
+ }
+ else {
+ volk_32f_s32f_convert_16i_a(out, in, d_scale, d_vlen*noutput_items);
+ }
+
+ return noutput_items;
+ }
+
+ } /* namespace blocks */
+}/* namespace gr */
diff --git a/gr-blocks/lib/float_to_short_impl.h b/gr-blocks/lib/float_to_short_impl.h
new file mode 100644
index 000000000..5427862b3
--- /dev/null
+++ b/gr-blocks/lib/float_to_short_impl.h
@@ -0,0 +1,51 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_FLOAT_TO_SHORT_IMPL_H
+#define INCLUDED_FLOAT_TO_SHORT_IMPL_H
+
+#include <blocks/float_to_short.h>
+
+namespace gr {
+ namespace blocks {
+
+ class BLOCKS_API float_to_short_impl : public float_to_short
+ {
+ size_t d_vlen;
+ float d_scale;
+
+ public:
+ float_to_short_impl(size_t vlen, float scale);
+
+ virtual float scale() const { return d_scale; }
+ virtual void set_scale(float scale) { d_scale = scale; }
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+
+#endif /* INCLUDED_FLOAT_TO_SHORT_IMPL_H */
diff --git a/gr-blocks/lib/float_to_uchar_impl.cc b/gr-blocks/lib/float_to_uchar_impl.cc
new file mode 100644
index 000000000..22d0527b1
--- /dev/null
+++ b/gr-blocks/lib/float_to_uchar_impl.cc
@@ -0,0 +1,60 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "float_to_uchar_impl.h"
+#include "float_array_to_uchar.h"
+#include <gr_io_signature.h>
+
+namespace gr {
+ namespace blocks {
+
+ float_to_uchar::sptr float_to_uchar::make()
+ {
+ return gnuradio::get_initial_sptr(new float_to_uchar_impl());
+ }
+
+ float_to_uchar_impl::float_to_uchar_impl()
+ : gr_sync_block("float_to_uchar",
+ gr_make_io_signature (1, 1, sizeof(float)),
+ gr_make_io_signature (1, 1, sizeof(unsigned char)))
+ {
+ }
+
+ int
+ float_to_uchar_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const float *in = (const float *)input_items[0];
+ unsigned char *out = (unsigned char *)output_items[0];
+
+ float_array_to_uchar(in, out, noutput_items);
+
+ return noutput_items;
+ }
+
+ } /* namespace blocks */
+}/* namespace gr */
diff --git a/gr-blocks/lib/float_to_uchar_impl.h b/gr-blocks/lib/float_to_uchar_impl.h
new file mode 100644
index 000000000..effd66c5c
--- /dev/null
+++ b/gr-blocks/lib/float_to_uchar_impl.h
@@ -0,0 +1,45 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_FLOAT_TO_UCHAR_IMPL_H
+#define INCLUDED_FLOAT_TO_UCHAR_IMPL_H
+
+#include <blocks/float_to_uchar.h>
+
+namespace gr {
+ namespace blocks {
+
+ class BLOCKS_API float_to_uchar_impl : public float_to_uchar
+ {
+ public:
+ float_to_uchar_impl();
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+
+#endif /* INCLUDED_FLOAT_TO_UCHAR_IMPL_H */
diff --git a/gr-blocks/lib/int_to_float_impl.cc b/gr-blocks/lib/int_to_float_impl.cc
new file mode 100644
index 000000000..0190d7ccb
--- /dev/null
+++ b/gr-blocks/lib/int_to_float_impl.cc
@@ -0,0 +1,68 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "int_to_float_impl.h"
+#include <gr_io_signature.h>
+#include <volk/volk.h>
+
+namespace gr {
+ namespace blocks {
+
+ int_to_float::sptr int_to_float::make(size_t vlen, float scale)
+ {
+ return gnuradio::get_initial_sptr(new int_to_float_impl(vlen, scale));
+ }
+
+ int_to_float_impl::int_to_float_impl(size_t vlen, float scale)
+ : gr_sync_block("int_to_float",
+ gr_make_io_signature (1, 1, sizeof(int32_t)*vlen),
+ gr_make_io_signature (1, 1, sizeof(float)*vlen)),
+ d_vlen(vlen), d_scale(scale)
+ {
+ const int alignment_multiple =
+ volk_get_alignment() / sizeof(float);
+ set_alignment(std::max(1, alignment_multiple));
+ }
+
+ int
+ int_to_float_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const int32_t *in = (const int32_t *) input_items[0];
+ float *out = (float *) output_items[0];
+
+ if(is_unaligned()) {
+ volk_32i_s32f_convert_32f_u(out, in, d_scale, d_vlen*noutput_items);
+ }
+ else {
+ volk_32i_s32f_convert_32f_a(out, in, d_scale, d_vlen*noutput_items);
+ }
+
+ return noutput_items;
+ }
+ } /* namespace blocks */
+}/* namespace gr */
diff --git a/gr-blocks/lib/int_to_float_impl.h b/gr-blocks/lib/int_to_float_impl.h
new file mode 100644
index 000000000..7498a0bb1
--- /dev/null
+++ b/gr-blocks/lib/int_to_float_impl.h
@@ -0,0 +1,51 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_INT_TO_FLOAT_IMPL_H
+#define INCLUDED_INT_TO_FLOAT_IMPL_H
+
+#include <blocks/int_to_float.h>
+
+namespace gr {
+ namespace blocks {
+
+ class BLOCKS_API int_to_float_impl : public int_to_float
+ {
+ size_t d_vlen;
+ float d_scale;
+
+ public:
+ int_to_float_impl(size_t vlen, float scale);
+
+ virtual float scale() const { return d_scale; }
+ virtual void set_scale(float scale) { d_scale = scale; }
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+
+#endif /* INCLUDED_INT_TO_FLOAT_IMPL_H */
diff --git a/gr-blocks/lib/integrate_XX_impl.cc.t b/gr-blocks/lib/integrate_XX_impl.cc.t
new file mode 100644
index 000000000..4c82729e3
--- /dev/null
+++ b/gr-blocks/lib/integrate_XX_impl.cc.t
@@ -0,0 +1,68 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2009,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.
+ */
+
+// @WARNING@
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <@NAME_IMPL@.h>
+#include <gr_io_signature.h>
+
+namespace gr {
+ namespace blocks {
+
+ @NAME@::sptr @NAME@::make(int decim)
+ {
+ return gnuradio::get_initial_sptr(new @NAME_IMPL@(decim));
+ }
+
+ @NAME_IMPL@::@NAME_IMPL@(int decim)
+ : gr_sync_decimator("@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)
+ {
+ }
+
+ int
+ @NAME_IMPL@::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;
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/integrate_XX_impl.h.t b/gr-blocks/lib/integrate_XX_impl.h.t
new file mode 100644
index 000000000..9fc333388
--- /dev/null
+++ b/gr-blocks/lib/integrate_XX_impl.h.t
@@ -0,0 +1,49 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2009,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_IMPL@
+#define @GUARD_NAME_IMPL@
+
+#include <blocks/@NAME@.h>
+
+namespace gr {
+ namespace blocks {
+
+ class BLOCKS_API @NAME_IMPL@ : public @NAME@
+ {
+ int d_decim;
+ int d_count;
+
+ public:
+ @NAME_IMPL@(int decim);
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* @GUARD_NAME_IMPL@ */
diff --git a/gr-blocks/lib/interleave_impl.cc b/gr-blocks/lib/interleave_impl.cc
new file mode 100644
index 000000000..df37ed26d
--- /dev/null
+++ b/gr-blocks/lib/interleave_impl.cc
@@ -0,0 +1,76 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "interleave_impl.h"
+#include <gr_io_signature.h>
+
+namespace gr {
+ namespace blocks {
+
+ interleave::sptr interleave::make(size_t itemsize)
+ {
+ return gnuradio::get_initial_sptr(new interleave_impl(itemsize));
+ }
+
+ interleave_impl::interleave_impl(size_t itemsize)
+ : gr_sync_interpolator("interleave",
+ gr_make_io_signature (1, gr_io_signature::IO_INFINITE, itemsize),
+ gr_make_io_signature (1, 1, itemsize),
+ 1),
+ d_itemsize(itemsize)
+ {
+ }
+
+ bool
+ interleave_impl::check_topology(int ninputs, int noutputs)
+ {
+ set_interpolation(ninputs);
+ return true;
+ }
+
+ int
+ interleave_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ size_t nchan = input_items.size();
+ size_t itemsize = d_itemsize;
+ const char **in = (const char **)&input_items[0];
+ char *out = (char *)output_items[0];
+
+ for (int i = 0; i < noutput_items; i += nchan) {
+ for (unsigned int n = 0; n < nchan; n++) {
+ memcpy (out, in[n], itemsize);
+ out += itemsize;
+ in[n] += itemsize;
+ }
+ }
+
+ return noutput_items;
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/interleave_impl.h b/gr-blocks/lib/interleave_impl.h
new file mode 100644
index 000000000..a02517e3e
--- /dev/null
+++ b/gr-blocks/lib/interleave_impl.h
@@ -0,0 +1,49 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_INTERLEAVE_IMPL_H
+#define INCLUDED_INTERLEAVE_IMPL_H
+
+#include <blocks/interleave.h>
+
+namespace gr {
+ namespace blocks {
+
+ class BLOCKS_API interleave_impl : public interleave
+ {
+ size_t d_itemsize;
+
+ public:
+ interleave_impl(size_t itemsize);
+
+ bool check_topology(int ninputs, int noutputs);
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+
+#endif /* INCLUDED_INTERLEAVE_IMPL_H */
diff --git a/gr-blocks/lib/interleaved_short_array_to_complex.cc b/gr-blocks/lib/interleaved_short_array_to_complex.cc
new file mode 100644
index 000000000..eb6431b7a
--- /dev/null
+++ b/gr-blocks/lib/interleaved_short_array_to_complex.cc
@@ -0,0 +1,39 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002,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 "interleaved_short_array_to_complex.h"
+#include <assert.h>
+
+void
+interleaved_short_array_to_complex (const short *in,
+ gr_complex *out, int nsamples)
+{
+ assert (nsamples % 2 == 0);
+
+ for (int i = 0; i < nsamples/2; i++){
+ out[i] = gr_complex (in[i*2 + 0], in[i*2 + 1]);
+ }
+}
diff --git a/gr-blocks/lib/interleaved_short_array_to_complex.h b/gr-blocks/lib/interleaved_short_array_to_complex.h
new file mode 100644
index 000000000..3f20fdb98
--- /dev/null
+++ b/gr-blocks/lib/interleaved_short_array_to_complex.h
@@ -0,0 +1,36 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_INTERLEAVED_SHORT_ARRAY_TO_COMPLEX_H
+#define INCLUDED_INTERLEAVED_SHORT_ARRAY_TO_COMPLEX_H
+
+#include <blocks/api.h>
+#include <gr_complex.h>
+
+/*
+ * convert array of interleaved shorts to complex.
+ * the shorts contains real, imaginary, real, imaginary...
+ * nsamples is the number of shorts; it must be even.
+ */
+BLOCKS_API void interleaved_short_array_to_complex (const short *in, gr_complex *out, int nsamples);
+
+#endif /* INCLUDED_INTERLEAVED_SHORT_ARRAY_TO_COMPLEX_H */
diff --git a/gr-blocks/lib/interleaved_short_to_complex_impl.cc b/gr-blocks/lib/interleaved_short_to_complex_impl.cc
new file mode 100644
index 000000000..1be6fdc9d
--- /dev/null
+++ b/gr-blocks/lib/interleaved_short_to_complex_impl.cc
@@ -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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "interleaved_short_to_complex_impl.h"
+#include "interleaved_short_array_to_complex.h"
+#include <gr_io_signature.h>
+
+namespace gr {
+ namespace blocks {
+
+ interleaved_short_to_complex::sptr interleaved_short_to_complex::make()
+ {
+ return gnuradio::get_initial_sptr(new interleaved_short_to_complex_impl());
+ }
+
+ interleaved_short_to_complex_impl::interleaved_short_to_complex_impl()
+ : gr_sync_decimator("interleaved_short_to_complex",
+ gr_make_io_signature (1, 1, sizeof(short)),
+ gr_make_io_signature (1, 1, sizeof(gr_complex)),
+ 2)
+ {
+ }
+
+ int
+ interleaved_short_to_complex_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const short *in = (const short *) input_items[0];
+ gr_complex *out = (gr_complex *) output_items[0];
+
+ interleaved_short_array_to_complex (in, out, 2 * noutput_items);
+
+ return noutput_items;
+ }
+
+ } /* namespace blocks */
+}/* namespace gr */
diff --git a/gr-blocks/lib/interleaved_short_to_complex_impl.h b/gr-blocks/lib/interleaved_short_to_complex_impl.h
new file mode 100644
index 000000000..62a1db308
--- /dev/null
+++ b/gr-blocks/lib/interleaved_short_to_complex_impl.h
@@ -0,0 +1,45 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_INTERLEAVED_SHORT_TO_COMPLEX_IMPL_H
+#define INCLUDED_INTERLEAVED_SHORT_TO_COMPLEX_IMPL_H
+
+#include <blocks/interleaved_short_to_complex.h>
+
+namespace gr {
+ namespace blocks {
+
+ class BLOCKS_API interleaved_short_to_complex_impl : public interleaved_short_to_complex
+ {
+ public:
+ interleaved_short_to_complex_impl();
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+
+#endif /* INCLUDED_INTERLEAVED_SHORT_TO_COMPLEX_IMPL_H */
diff --git a/gr-blocks/lib/keep_m_in_n_impl.cc b/gr-blocks/lib/keep_m_in_n_impl.cc
new file mode 100644
index 000000000..312b09c25
--- /dev/null
+++ b/gr-blocks/lib/keep_m_in_n_impl.cc
@@ -0,0 +1,87 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "keep_m_in_n_impl.h"
+#include <gr_io_signature.h>
+
+namespace gr {
+ namespace blocks {
+
+ keep_m_in_n::sptr keep_m_in_n::make(size_t itemsize, int m, int n, int offset)
+ {
+ return gnuradio::get_initial_sptr(new keep_m_in_n_impl(itemsize, m, n, offset));
+ }
+
+ keep_m_in_n_impl::keep_m_in_n_impl(size_t itemsize, int m, int n, int offset)
+ : gr_block("keep_m_in_n",
+ gr_make_io_signature (1, 1, itemsize),
+ gr_make_io_signature (1, 1, itemsize)),
+ d_m(m),
+ d_n(n),
+ d_offset(offset),
+ d_itemsize(itemsize)
+ {
+ // sanity checking
+ assert(d_m > 0);
+ assert(d_n > 0);
+ assert(d_m <= d_n);
+ assert(d_offset <= (d_n-d_m));
+
+ set_output_multiple(m);
+ }
+
+ void
+ keep_m_in_n_impl::forecast(int noutput_items, gr_vector_int &ninput_items_required)
+ {
+ ninput_items_required[0] = d_n*(noutput_items/d_m);
+ }
+
+ int
+ keep_m_in_n_impl::general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ uint8_t* out = (uint8_t*)output_items[0];
+ const uint8_t* in = (const uint8_t*)input_items[0];
+
+ // iterate over data blocks of size {n, input : m, output}
+ int blks = std::min(noutput_items/d_m, ninput_items[0]/d_n);
+
+ for(int i=0; i<blks; i++) {
+ // set up copy pointers
+ const uint8_t* iptr = &in[(i*d_n + d_offset)*d_itemsize];
+ uint8_t* optr = &out[i*d_m*d_itemsize];
+ // perform copy
+ memcpy( optr, iptr, d_m*d_itemsize );
+ }
+
+ consume_each(d_n);
+ return d_m;
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/keep_m_in_n_impl.h b/gr-blocks/lib/keep_m_in_n_impl.h
new file mode 100644
index 000000000..0b8819489
--- /dev/null
+++ b/gr-blocks/lib/keep_m_in_n_impl.h
@@ -0,0 +1,58 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_KEEP_M_IN_N_IMPL_H
+#define INCLUDED_KEEP_M_IN_N_IMPL_H
+
+#include <blocks/keep_m_in_n.h>
+
+namespace gr {
+ namespace blocks {
+
+ class BLOCKS_API keep_m_in_n_impl : public keep_m_in_n
+ {
+ int d_m;
+ int d_n;
+ int d_count;
+ int d_offset;
+ int d_itemsize;
+
+ void forecast(int noutput_items, gr_vector_int &ninput_items_required);
+
+ public:
+ keep_m_in_n_impl(size_t itemsize, int m, int n, int offset);
+
+ 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_m(int m) { d_m = m; }
+ void set_n(int n) { d_n = n; }
+ void set_offset(int offset) { d_offset = offset; }
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+
+#endif /* INCLUDED_KEEP_M_IN_N_IMPL_H */
diff --git a/gr-blocks/lib/keep_one_in_n_impl.cc b/gr-blocks/lib/keep_one_in_n_impl.cc
new file mode 100644
index 000000000..7ab6dc14d
--- /dev/null
+++ b/gr-blocks/lib/keep_one_in_n_impl.cc
@@ -0,0 +1,109 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "keep_one_in_n_impl.h"
+#include <gr_io_signature.h>
+
+namespace gr {
+ namespace blocks {
+
+ keep_one_in_n::sptr keep_one_in_n::make(size_t itemsize, int n)
+ {
+ return gnuradio::get_initial_sptr(new keep_one_in_n_impl(itemsize, n));
+ }
+
+ keep_one_in_n_impl::keep_one_in_n_impl(size_t itemsize, int n)
+ : gr_block("keep_one_in_n",
+ gr_make_io_signature (1, 1, itemsize),
+ gr_make_io_signature (1, 1, itemsize)),
+ d_count(n)
+ {
+ // To avoid bad behavior with using set_relative_rate in this block with
+ // VERY large values of n, we will keep track of things ourselves. Using
+ // this to turn off automatic tag propagation, which will be handled
+ // locally in general_work().
+ set_tag_propagation_policy(TPP_DONT);
+
+ set_n(n);
+ }
+
+ void
+ keep_one_in_n_impl::set_n(int n)
+ {
+ if (n < 1)
+ n = 1;
+
+ d_n = n;
+ d_count = n;
+
+ // keep our internal understanding of the relative rate of this block
+ // don't set the relative rate, though, and we will handle our own
+ // tag propagation.
+ d_decim_rate = 1.0/(float)d_n;
+ }
+
+ int
+ keep_one_in_n_impl::general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const char *in = (const char *) input_items[0];
+ char *out = (char *) output_items[0];
+
+ size_t item_size = input_signature ()->sizeof_stream_item (0);
+ int ni = 0;
+ int no = 0;
+
+ while (ni < ninput_items[0] && no < noutput_items){
+ d_count--;
+ if (d_count <= 0){
+ memcpy (out, in, item_size); // copy 1 item
+ out += item_size;
+ no++;
+ d_count = d_n;
+ }
+ in += item_size;
+ ni++;
+ }
+
+ // Because we have set TPP_DONT, we have to propagate the tags here manually.
+ // Adjustment of the tag sample value is done using the float d_decim_rate.
+ std::vector<gr_tag_t> tags;
+ std::vector<gr_tag_t>::iterator t;
+ get_tags_in_range(tags, 0, nitems_read(0), nitems_read(0)+ni);
+ for(t = tags.begin(); t != tags.end(); t++) {
+ gr_tag_t new_tag = *t;
+ new_tag.offset *= d_decim_rate;
+ add_item_tag(0, new_tag);
+ }
+
+ consume_each (ni);
+ return no;
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/keep_one_in_n_impl.h b/gr-blocks/lib/keep_one_in_n_impl.h
new file mode 100644
index 000000000..1588fb1a6
--- /dev/null
+++ b/gr-blocks/lib/keep_one_in_n_impl.h
@@ -0,0 +1,53 @@
+
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_KEEP_ONE_IN_N_IMPL_H
+#define INCLUDED_KEEP_ONE_IN_N_IMPL_H
+
+#include <blocks/keep_one_in_n.h>
+
+namespace gr {
+ namespace blocks {
+
+ class BLOCKS_API keep_one_in_n_impl : public keep_one_in_n
+ {
+ int d_n;
+ int d_count;
+ float d_decim_rate;
+
+ public:
+ keep_one_in_n_impl(size_t itemsize,int n);
+
+ 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_n(int n);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+
+#endif /* INCLUDED_KEEP_ONE_IN_N_IMPL_H */
diff --git a/gr-blocks/lib/multiply_XX_impl.cc.t b/gr-blocks/lib/multiply_XX_impl.cc.t
new file mode 100644
index 000000000..bda4eac6a
--- /dev/null
+++ b/gr-blocks/lib/multiply_XX_impl.cc.t
@@ -0,0 +1,69 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2009,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.
+ */
+
+// @WARNING@
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <@NAME_IMPL@.h>
+#include <gr_io_signature.h>
+
+namespace gr {
+ namespace blocks {
+
+ @NAME@::sptr @NAME@::make(size_t vlen)
+ {
+ return gnuradio::get_initial_sptr(new @NAME_IMPL@(vlen));
+ }
+
+ @NAME_IMPL@::@NAME_IMPL@(size_t vlen)
+ : gr_sync_block ("@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_IMPL@::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;
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/multiply_XX_impl.h.t b/gr-blocks/lib/multiply_XX_impl.h.t
new file mode 100644
index 000000000..78c62b5e1
--- /dev/null
+++ b/gr-blocks/lib/multiply_XX_impl.h.t
@@ -0,0 +1,47 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2009,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_IMPL@
+#define @GUARD_NAME_IMPL@
+
+#include <blocks/@NAME@.h>
+
+namespace gr {
+ namespace blocks {
+
+ class BLOCKS_API @NAME_IMPL@ : public @NAME@
+ {
+ size_t d_vlen;
+
+ public:
+ @NAME_IMPL@(size_t vlen);
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* @GUARD_NAME_IMPL@ */
diff --git a/gr-blocks/lib/multiply_cc_impl.cc b/gr-blocks/lib/multiply_cc_impl.cc
new file mode 100644
index 000000000..e5160a9d5
--- /dev/null
+++ b/gr-blocks/lib/multiply_cc_impl.cc
@@ -0,0 +1,71 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <multiply_cc_impl.h>
+#include <gr_io_signature.h>
+#include <volk/volk.h>
+
+namespace gr {
+ namespace blocks {
+
+ multiply_cc::sptr multiply_cc::make(size_t vlen)
+ {
+ return gnuradio::get_initial_sptr(new multiply_cc_impl(vlen));
+ }
+
+ multiply_cc_impl::multiply_cc_impl(size_t vlen)
+ : gr_sync_block("multiply_cc",
+ gr_make_io_signature (1, -1, sizeof(gr_complex)*vlen),
+ gr_make_io_signature (1, 1, sizeof(gr_complex)*vlen)),
+ d_vlen(vlen)
+ {
+ const int alignment_multiple =
+ volk_get_alignment() / sizeof(gr_complex);
+ set_alignment(std::max(1, alignment_multiple));
+ }
+
+ int
+ multiply_cc_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ gr_complex *out = (gr_complex *) output_items[0];
+ int noi = d_vlen*noutput_items;
+
+ memcpy(out, input_items[0], noi*sizeof(gr_complex));
+ if(is_unaligned()) {
+ for(size_t i = 1; i < input_items.size(); i++)
+ volk_32fc_x2_multiply_32fc_u(out, out, (gr_complex*)input_items[i], noi);
+ }
+ else {
+ for(size_t i = 1; i < input_items.size(); i++)
+ volk_32fc_x2_multiply_32fc_a(out, out, (gr_complex*)input_items[i], noi);
+ }
+ return noutput_items;
+ }
+
+ } /* namespace blocks */
+}/* namespace gr */
diff --git a/gr-blocks/lib/multiply_cc_impl.h b/gr-blocks/lib/multiply_cc_impl.h
new file mode 100644
index 000000000..1595dc524
--- /dev/null
+++ b/gr-blocks/lib/multiply_cc_impl.h
@@ -0,0 +1,47 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_BLOCKS_MULTIPLY_CC_IMPL_H
+#define INCLUDED_BLOCKS_MULTIPLY_CC_IMPL_H
+
+#include <blocks/multiply_cc.h>
+
+namespace gr {
+ namespace blocks {
+
+ class BLOCKS_API multiply_cc_impl : public multiply_cc
+ {
+ size_t d_vlen;
+
+ public:
+ multiply_cc_impl(size_t vlen);
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+
+#endif /* INCLUDED_BLOCKS_MULTIPLY_CC_IMPL_H */
diff --git a/gr-blocks/lib/multiply_conjugate_cc_impl.cc b/gr-blocks/lib/multiply_conjugate_cc_impl.cc
new file mode 100644
index 000000000..7a4356c45
--- /dev/null
+++ b/gr-blocks/lib/multiply_conjugate_cc_impl.cc
@@ -0,0 +1,71 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <multiply_conjugate_cc_impl.h>
+#include <gr_io_signature.h>
+#include <volk/volk.h>
+
+namespace gr {
+ namespace blocks {
+
+ multiply_conjugate_cc::sptr multiply_conjugate_cc::make(size_t vlen)
+ {
+ return gnuradio::get_initial_sptr(new multiply_conjugate_cc_impl(vlen));
+ }
+
+ multiply_conjugate_cc_impl::multiply_conjugate_cc_impl(size_t vlen)
+ : gr_sync_block("multiply_conjugate_cc",
+ gr_make_io_signature (2, 2, sizeof(gr_complex)*vlen),
+ gr_make_io_signature (1, 1, sizeof(gr_complex)*vlen)),
+ d_vlen(vlen)
+ {
+ const int alignment_multiple =
+ volk_get_alignment() / sizeof(gr_complex);
+ set_alignment(std::max(1, alignment_multiple));
+ }
+
+ int
+ multiply_conjugate_cc_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ gr_complex *in0 = (gr_complex *) input_items[0];
+ gr_complex *in1 = (gr_complex *) input_items[1];
+ gr_complex *out = (gr_complex *) output_items[0];
+ int noi = d_vlen*noutput_items;
+
+ if(is_unaligned()) {
+ volk_32fc_x2_multiply_conjugate_32fc_u(out, in0, in1, noi);
+ }
+ else {
+ volk_32fc_x2_multiply_conjugate_32fc_a(out, in0, in1, noi);
+ }
+
+ return noutput_items;
+ }
+
+ } /* namespace blocks */
+}/* namespace gr */
diff --git a/gr-blocks/lib/multiply_conjugate_cc_impl.h b/gr-blocks/lib/multiply_conjugate_cc_impl.h
new file mode 100644
index 000000000..66e7ec55b
--- /dev/null
+++ b/gr-blocks/lib/multiply_conjugate_cc_impl.h
@@ -0,0 +1,47 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_BLOCKS_MULTIPLY_CONJUGATE_CC_IMPL_H
+#define INCLUDED_BLOCKS_MULTIPLY_CONJUGATE_CC_IMPL_H
+
+#include <blocks/multiply_conjugate_cc.h>
+
+namespace gr {
+ namespace blocks {
+
+ class BLOCKS_API multiply_conjugate_cc_impl : public multiply_conjugate_cc
+ {
+ size_t d_vlen;
+
+ public:
+ multiply_conjugate_cc_impl(size_t vlen);
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+
+#endif /* INCLUDED_BLOCKS_MULTIPLY_CONJUGATE_CC_IMPL_H */
diff --git a/gr-blocks/lib/multiply_const_XX_impl.cc.t b/gr-blocks/lib/multiply_const_XX_impl.cc.t
new file mode 100644
index 000000000..8ca79f6f3
--- /dev/null
+++ b/gr-blocks/lib/multiply_const_XX_impl.cc.t
@@ -0,0 +1,77 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2009,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.
+ */
+
+// @WARNING@
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <@NAME_IMPL@.h>
+#include <gr_io_signature.h>
+
+namespace gr {
+ namespace blocks {
+
+ @NAME@::sptr @NAME@::make(@O_TYPE@ k)
+ {
+ return gnuradio::get_initial_sptr(new @NAME_IMPL@(k));
+ }
+
+ @NAME_IMPL@::@NAME_IMPL@(@O_TYPE@ k)
+ : gr_sync_block ("@NAME@",
+ gr_make_io_signature (1, 1, sizeof (@I_TYPE@)),
+ gr_make_io_signature (1, 1, sizeof (@O_TYPE@))),
+ d_k(k)
+ {
+ }
+
+ int
+ @NAME_IMPL@::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;
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/multiply_const_XX_impl.h.t b/gr-blocks/lib/multiply_const_XX_impl.h.t
new file mode 100644
index 000000000..cae5ca813
--- /dev/null
+++ b/gr-blocks/lib/multiply_const_XX_impl.h.t
@@ -0,0 +1,51 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2009,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_IMPL@
+#define @GUARD_NAME_IMPL@
+
+#include <blocks/@NAME@.h>
+
+namespace gr {
+ namespace blocks {
+
+ class BLOCKS_API @NAME_IMPL@ : public @NAME@
+ {
+ @O_TYPE@ d_k;
+
+ public:
+ @NAME_IMPL@(@O_TYPE@ k);
+
+ @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);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* @GUARD_NAME_IMPL@ */
diff --git a/gr-blocks/lib/multiply_const_cc_impl.cc b/gr-blocks/lib/multiply_const_cc_impl.cc
new file mode 100644
index 000000000..7618150da
--- /dev/null
+++ b/gr-blocks/lib/multiply_const_cc_impl.cc
@@ -0,0 +1,72 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2009,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.
+ */
+
+// @WARNING@
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <multiply_const_cc_impl.h>
+#include <gr_io_signature.h>
+#include <volk/volk.h>
+
+namespace gr {
+ namespace blocks {
+
+ multiply_const_cc::sptr multiply_const_cc::make(gr_complex k, size_t vlen)
+ {
+ return gnuradio::get_initial_sptr(new multiply_const_cc_impl(k, vlen));
+ }
+
+ multiply_const_cc_impl::multiply_const_cc_impl(gr_complex k, size_t vlen)
+ : gr_sync_block ("multiply_const_cc",
+ gr_make_io_signature (1, 1, sizeof (gr_complex)*vlen),
+ gr_make_io_signature (1, 1, sizeof (gr_complex)*vlen)),
+ d_k(k), d_vlen(vlen)
+ {
+ const int alignment_multiple =
+ volk_get_alignment() / sizeof(gr_complex);
+ set_alignment(std::max(1,alignment_multiple));
+ }
+
+ int
+ multiply_const_cc_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const gr_complex *in = (const gr_complex *) input_items[0];
+ gr_complex *out = (gr_complex *) output_items[0];
+ int noi = d_vlen*noutput_items;
+
+ if(is_unaligned()) {
+ volk_32fc_s32fc_multiply_32fc_u(out, in, d_k, noi);
+ }
+ else {
+ volk_32fc_s32fc_multiply_32fc_a(out, in, d_k, noi);
+ }
+
+ return noutput_items;
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/multiply_const_cc_impl.h b/gr-blocks/lib/multiply_const_cc_impl.h
new file mode 100644
index 000000000..81c8cc6da
--- /dev/null
+++ b/gr-blocks/lib/multiply_const_cc_impl.h
@@ -0,0 +1,52 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2009,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 INCLUDED_MULTIPLY_CONST_CC_IMPL_H
+#define INCLUDED_MULTIPLY_CONST_CC_IMPL_H
+
+#include <blocks/multiply_const_cc.h>
+
+namespace gr {
+ namespace blocks {
+
+ class BLOCKS_API multiply_const_cc_impl : public multiply_const_cc
+ {
+ gr_complex d_k;
+ size_t d_vlen;
+
+ public:
+ multiply_const_cc_impl(gr_complex k, size_t vlen);
+
+ gr_complex k() const { return d_k; }
+ void set_k(gr_complex k) { d_k = k; }
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_MULTIPLY_CONST_CC_IMPL_H */
diff --git a/gr-blocks/lib/multiply_const_ff_impl.cc b/gr-blocks/lib/multiply_const_ff_impl.cc
new file mode 100644
index 000000000..e9cd34797
--- /dev/null
+++ b/gr-blocks/lib/multiply_const_ff_impl.cc
@@ -0,0 +1,72 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2009,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.
+ */
+
+// @WARNING@
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <multiply_const_ff_impl.h>
+#include <gr_io_signature.h>
+#include <volk/volk.h>
+
+namespace gr {
+ namespace blocks {
+
+ multiply_const_ff::sptr multiply_const_ff::make(float k, size_t vlen)
+ {
+ return gnuradio::get_initial_sptr(new multiply_const_ff_impl(k, vlen));
+ }
+
+ multiply_const_ff_impl::multiply_const_ff_impl(float k, size_t vlen)
+ : gr_sync_block ("multiply_const_ff",
+ gr_make_io_signature (1, 1, sizeof (float)*vlen),
+ gr_make_io_signature (1, 1, sizeof (float)*vlen)),
+ d_k(k), d_vlen(vlen)
+ {
+ const int alignment_multiple =
+ volk_get_alignment() / sizeof(float);
+ set_alignment(std::max(1,alignment_multiple));
+ }
+
+ int
+ multiply_const_ff_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const float *in = (const float *) input_items[0];
+ float *out = (float *) output_items[0];
+ int noi = d_vlen*noutput_items;
+
+ if(is_unaligned()) {
+ volk_32f_s32f_multiply_32f_u(out, in, d_k, noi);
+ }
+ else {
+ volk_32f_s32f_multiply_32f_a(out, in, d_k, noi);
+ }
+
+ return noutput_items;
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/multiply_const_ff_impl.h b/gr-blocks/lib/multiply_const_ff_impl.h
new file mode 100644
index 000000000..e63a3279a
--- /dev/null
+++ b/gr-blocks/lib/multiply_const_ff_impl.h
@@ -0,0 +1,52 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2009,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 INCLUDED_MULTIPLY_CONST_FF_IMPL_H
+#define INCLUDED_MULTIPLY_CONST_FF_IMPL_H
+
+#include <blocks/multiply_const_ff.h>
+
+namespace gr {
+ namespace blocks {
+
+ class BLOCKS_API multiply_const_ff_impl : public multiply_const_ff
+ {
+ float d_k;
+ size_t d_vlen;
+
+ public:
+ multiply_const_ff_impl(float k, size_t vlen);
+
+ float k() const { return d_k; }
+ void set_k(float k) { d_k = k; }
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_MULTIPLY_CONST_FF_IMPL_H */
diff --git a/gr-blocks/lib/multiply_const_vXX_impl.cc.t b/gr-blocks/lib/multiply_const_vXX_impl.cc.t
new file mode 100644
index 000000000..dd20f2893
--- /dev/null
+++ b/gr-blocks/lib/multiply_const_vXX_impl.cc.t
@@ -0,0 +1,66 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2009,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.
+ */
+
+// @WARNING@
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <@NAME_IMPL@.h>
+#include <gr_io_signature.h>
+
+namespace gr {
+ namespace blocks {
+
+ @NAME@::sptr @NAME@::make(std::vector<@O_TYPE@> k)
+ {
+ return gnuradio::get_initial_sptr(new @NAME_IMPL@(k));
+ }
+
+ @NAME_IMPL@::@NAME_IMPL@(std::vector<@O_TYPE@> k)
+ : gr_sync_block ("@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_IMPL@::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 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;
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/multiply_const_vXX_impl.h.t b/gr-blocks/lib/multiply_const_vXX_impl.h.t
new file mode 100644
index 000000000..a7a619725
--- /dev/null
+++ b/gr-blocks/lib/multiply_const_vXX_impl.h.t
@@ -0,0 +1,51 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2006,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.
+ */
+
+// @WARNING@
+
+#ifndef @GUARD_NAME_IMPL@
+#define @GUARD_NAME_IMPL@
+
+#include <blocks/@NAME@.h>
+
+namespace gr {
+ namespace blocks {
+
+ class BLOCKS_API @NAME_IMPL@ : public @NAME@
+ {
+ std::vector<@O_TYPE@> d_k;
+
+ public:
+ @NAME_IMPL@(std::vector<@O_TYPE@> k);
+
+ std::vector<@O_TYPE@> k() const { return d_k; }
+ void set_k(std::vector<@O_TYPE@> k) { d_k = k; }
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* @GUARD_NAME_IMPL@ */
diff --git a/gr-blocks/lib/multiply_ff_impl.cc b/gr-blocks/lib/multiply_ff_impl.cc
new file mode 100644
index 000000000..6e8f27711
--- /dev/null
+++ b/gr-blocks/lib/multiply_ff_impl.cc
@@ -0,0 +1,71 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <multiply_ff_impl.h>
+#include <gr_io_signature.h>
+#include <volk/volk.h>
+
+namespace gr {
+ namespace blocks {
+
+ multiply_ff::sptr multiply_ff::make(size_t vlen)
+ {
+ return gnuradio::get_initial_sptr(new multiply_ff_impl(vlen));
+ }
+
+ multiply_ff_impl::multiply_ff_impl(size_t vlen)
+ : gr_sync_block("multiply_ff",
+ gr_make_io_signature (1, -1, sizeof(float)*vlen),
+ gr_make_io_signature (1, 1, sizeof(float)*vlen)),
+ d_vlen(vlen)
+ {
+ const int alignment_multiple =
+ volk_get_alignment() / sizeof(float);
+ set_alignment(std::max(1, alignment_multiple));
+ }
+
+ int
+ multiply_ff_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ float *out = (float *) output_items[0];
+ int noi = d_vlen*noutput_items;
+
+ memcpy(out, input_items[0], noi*sizeof(float));
+ if(is_unaligned()) {
+ for(size_t i = 1; i < input_items.size(); i++)
+ volk_32f_x2_multiply_32f_u(out, out, (float*)input_items[i], noi);
+ }
+ else {
+ for(size_t i = 1; i < input_items.size(); i++)
+ volk_32f_x2_multiply_32f_a(out, out, (float*)input_items[i], noi);
+ }
+ return noutput_items;
+ }
+
+ } /* namespace blocks */
+}/* namespace gr */
diff --git a/gr-blocks/lib/multiply_ff_impl.h b/gr-blocks/lib/multiply_ff_impl.h
new file mode 100644
index 000000000..2c5325a98
--- /dev/null
+++ b/gr-blocks/lib/multiply_ff_impl.h
@@ -0,0 +1,47 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_BLOCKS_MULTIPLY_FF_IMPL_H
+#define INCLUDED_BLOCKS_MULTIPLY_FF_IMPL_H
+
+#include <blocks/multiply_ff.h>
+
+namespace gr {
+ namespace blocks {
+
+ class BLOCKS_API multiply_ff_impl : public multiply_ff
+ {
+ size_t d_vlen;
+
+ public:
+ multiply_ff_impl(size_t vlen);
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+
+#endif /* INCLUDED_BLOCKS_MULTIPLY_FF_IMPL_H */
diff --git a/gr-blocks/lib/nlog10_ff_impl.cc b/gr-blocks/lib/nlog10_ff_impl.cc
new file mode 100644
index 000000000..f662b8fd5
--- /dev/null
+++ b/gr-blocks/lib/nlog10_ff_impl.cc
@@ -0,0 +1,64 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "nlog10_ff_impl.h"
+#include <gr_io_signature.h>
+
+namespace gr {
+ namespace blocks {
+
+ nlog10_ff::sptr nlog10_ff::make(float n, size_t vlen, float k)
+ {
+ return gnuradio::get_initial_sptr(new nlog10_ff_impl(n, vlen, k));
+ }
+
+ nlog10_ff_impl::nlog10_ff_impl(float n, size_t vlen, float k)
+ : gr_sync_block("nlog10_ff",
+ gr_make_io_signature (1, 1, sizeof(float)*vlen),
+ gr_make_io_signature (1, 1, sizeof(float)*vlen)),
+ d_n(n), d_vlen(vlen), d_k(k)
+ {
+ }
+
+ int
+ nlog10_ff_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const float *in = (const float *) input_items[0];
+ float *out = (float *) output_items[0];
+ int noi = noutput_items * d_vlen;
+ float n = d_n;
+ float k = d_k;
+
+ for (int i = 0; i < noi; i++)
+ out[i] = n * log10(std::max(in[i], (float) 1e-18)) + k;
+
+ return noutput_items;
+ }
+
+ } /* namespace blocks */
+}/* namespace gr */
diff --git a/gr-blocks/lib/nlog10_ff_impl.h b/gr-blocks/lib/nlog10_ff_impl.h
new file mode 100644
index 000000000..3789bc317
--- /dev/null
+++ b/gr-blocks/lib/nlog10_ff_impl.h
@@ -0,0 +1,49 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_NLOG10_FF_IMPL_H
+#define INCLUDED_NLOG10_FF_IMPL_H
+
+#include <blocks/nlog10_ff.h>
+
+namespace gr {
+ namespace blocks {
+
+ class BLOCKS_API nlog10_ff_impl : public nlog10_ff
+ {
+ float d_n;
+ size_t d_vlen;
+ float d_k;
+
+ public:
+ nlog10_ff_impl(float n, size_t vlen, float k);
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+
+#endif /* INCLUDED_NLOG10_FF_IMPL_H */
diff --git a/gr-blocks/lib/not_XX_impl.cc.t b/gr-blocks/lib/not_XX_impl.cc.t
new file mode 100644
index 000000000..b491a4ccc
--- /dev/null
+++ b/gr-blocks/lib/not_XX_impl.cc.t
@@ -0,0 +1,65 @@
+/* -*- 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_IMPL@.h>
+#include <gr_io_signature.h>
+
+namespace gr {
+ namespace blocks {
+
+ @NAME@::sptr @NAME@::make(size_t vlen)
+ {
+ return gnuradio::get_initial_sptr(new @NAME_IMPL@(vlen));
+ }
+
+ @NAME_IMPL@::@NAME_IMPL@(size_t vlen)
+ : gr_sync_block ("@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_IMPL@::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];
+
+ int noi = noutput_items*d_vlen;
+
+ for (int i = 0; i < noi; i++)
+ *optr++ = ~(inptr[i]);
+
+ return noutput_items;
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/not_XX_impl.h.t b/gr-blocks/lib/not_XX_impl.h.t
new file mode 100644
index 000000000..25f0da0c8
--- /dev/null
+++ b/gr-blocks/lib/not_XX_impl.h.t
@@ -0,0 +1,48 @@
+/* -*- 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_IMPL@
+#define @GUARD_NAME_IMPL@
+
+#include <blocks/@NAME@.h>
+
+namespace gr {
+ namespace blocks {
+
+ class BLOCKS_API @NAME_IMPL@ : public @NAME@
+ {
+ size_t d_vlen;
+
+ public:
+ @NAME_IMPL@(size_t vlen);
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* @GUARD_NAME_IMPL@ */
diff --git a/gr-blocks/lib/or_XX_impl.cc.t b/gr-blocks/lib/or_XX_impl.cc.t
new file mode 100644
index 000000000..15f6fa0b8
--- /dev/null
+++ b/gr-blocks/lib/or_XX_impl.cc.t
@@ -0,0 +1,69 @@
+/* -*- 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_IMPL@.h>
+#include <gr_io_signature.h>
+
+namespace gr {
+ namespace blocks {
+
+ @NAME@::sptr @NAME@::make(size_t vlen)
+ {
+ return gnuradio::get_initial_sptr(new @NAME_IMPL@(vlen));
+ }
+
+ @NAME_IMPL@::@NAME_IMPL@(size_t vlen)
+ : gr_sync_block ("@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_IMPL@::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;
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/or_XX_impl.h.t b/gr-blocks/lib/or_XX_impl.h.t
new file mode 100644
index 000000000..25f0da0c8
--- /dev/null
+++ b/gr-blocks/lib/or_XX_impl.h.t
@@ -0,0 +1,48 @@
+/* -*- 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_IMPL@
+#define @GUARD_NAME_IMPL@
+
+#include <blocks/@NAME@.h>
+
+namespace gr {
+ namespace blocks {
+
+ class BLOCKS_API @NAME_IMPL@ : public @NAME@
+ {
+ size_t d_vlen;
+
+ public:
+ @NAME_IMPL@(size_t vlen);
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* @GUARD_NAME_IMPL@ */
diff --git a/gr-blocks/lib/packed_to_unpacked_XX_impl.cc.t b/gr-blocks/lib/packed_to_unpacked_XX_impl.cc.t
new file mode 100644
index 000000000..4f34d8347
--- /dev/null
+++ b/gr-blocks/lib/packed_to_unpacked_XX_impl.cc.t
@@ -0,0 +1,147 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2013 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_IMPL@.h"
+#include <gr_io_signature.h>
+#include <blocks/log2_const.h>
+#include <assert.h>
+
+namespace gr {
+ namespace blocks {
+
+ static const unsigned int BITS_PER_TYPE = sizeof(@I_TYPE@) * 8;
+ static const unsigned int LOG2_L_TYPE = log2_const<sizeof(@I_TYPE@) * 8>();
+
+ @NAME@::sptr
+ @NAME@::make(unsigned int bits_per_chunk,
+ gr_endianness_t endianness)
+ {
+ return gnuradio::get_initial_sptr
+ (new @NAME_IMPL@(bits_per_chunk, endianness));
+ }
+
+ @NAME_IMPL@::@NAME_IMPL@(unsigned int bits_per_chunk,
+ gr_endianness_t endianness)
+ : gr_block("@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);
+ }
+
+ @NAME_IMPL@::~@NAME_IMPL@()
+ {
+ }
+
+ void
+ @NAME_IMPL@::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_IMPL@::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;
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/packed_to_unpacked_XX_impl.h.t b/gr-blocks/lib/packed_to_unpacked_XX_impl.h.t
new file mode 100644
index 000000000..f83496fa7
--- /dev/null
+++ b/gr-blocks/lib/packed_to_unpacked_XX_impl.h.t
@@ -0,0 +1,59 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006,2013 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_IMPL@
+#define @GUARD_NAME_IMPL@
+
+#include <blocks/@NAME@.h>
+
+namespace gr {
+ namespace blocks {
+
+ class @NAME_IMPL@ : public @NAME@
+ {
+ private:
+ unsigned int d_bits_per_chunk;
+ gr_endianness_t d_endianness;
+ unsigned int d_index;
+
+ public:
+ @NAME_IMPL@(unsigned int bits_per_chunk,
+ gr_endianness_t endianness);
+ ~@NAME_IMPL@();
+
+ 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; }
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* @GUARD_NAME_IMPL@ */
diff --git a/gr-blocks/lib/patterned_interleaver_impl.cc b/gr-blocks/lib/patterned_interleaver_impl.cc
new file mode 100644
index 000000000..437c733a1
--- /dev/null
+++ b/gr-blocks/lib/patterned_interleaver_impl.cc
@@ -0,0 +1,87 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "patterned_interleaver_impl.h"
+#include <gr_io_signature.h>
+
+namespace gr {
+ namespace blocks {
+
+ patterned_interleaver::sptr patterned_interleaver::make(size_t itemsize, std::vector<int> pattern)
+ {
+ return gnuradio::get_initial_sptr(new patterned_interleaver_impl(itemsize, pattern));
+ }
+
+ patterned_interleaver_impl::patterned_interleaver_impl(size_t itemsize, std::vector<int> pattern)
+ : gr_block ("patterned_interleaver",
+ gr_make_io_signature (pattern_max(pattern)+1, pattern_max(pattern)+1, itemsize),
+ gr_make_io_signature (1, 1, itemsize)),
+ d_pattern(pattern), d_counts( pattern_max(pattern)+1, 0), d_itemsize(itemsize)
+ {
+ BOOST_FOREACH( int i, d_pattern)
+ { d_counts[i]++; }
+ set_output_multiple(d_pattern.size());
+ }
+
+ int
+ patterned_interleaver_impl::general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ size_t nblks = noutput_items/d_pattern.size();
+
+ std::vector<const char*> ii;
+ for(size_t i=0; i<input_items.size(); i++){
+ ii.push_back((const char*)input_items[i]);
+ }
+
+ char *oo = (char *) output_items[0];
+
+ for(size_t i=0; i<nblks; i++){
+ for(size_t j=0; j<d_pattern.size(); j++){
+ memcpy(oo, ii[d_pattern[j]], d_itemsize);
+ oo += d_itemsize;
+ ii[d_pattern[j]] += d_itemsize;
+ }
+ }
+
+ for(size_t i=0; i<d_counts.size(); i++){
+ consume(i, d_counts[i]*nblks );
+ }
+ return nblks*d_pattern.size();
+ }
+
+ void patterned_interleaver_impl::forecast (int noutput_items,
+ gr_vector_int &ninput_items_required){
+ int nblks = noutput_items / d_pattern.size();
+ for(size_t i=0; i<ninput_items_required.size(); i++){
+ ninput_items_required[i] = d_counts[i] * nblks;
+ }
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/patterned_interleaver_impl.h b/gr-blocks/lib/patterned_interleaver_impl.h
new file mode 100644
index 000000000..4266c9636
--- /dev/null
+++ b/gr-blocks/lib/patterned_interleaver_impl.h
@@ -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.
+ */
+
+#ifndef INCLUDED_PATTERNED_INTERLEAVER_IMPL_H
+#define INCLUDED_PATTERNED_INTERLEAVER_IMPL_H
+
+#include <blocks/patterned_interleaver.h>
+#include <boost/foreach.hpp>
+
+namespace gr {
+ namespace blocks {
+
+ class BLOCKS_API patterned_interleaver_impl : public patterned_interleaver
+ {
+ public:
+ patterned_interleaver_impl(size_t itemsize, std::vector<int> pattern);
+
+ int general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+
+ int pattern_max(std::vector<int> pattern){
+ int mval(0);
+ BOOST_FOREACH( int i, pattern)
+ { mval = std::max(mval, i); }
+ return mval;
+ }
+
+ void forecast (int noutput_items,
+ gr_vector_int &ninput_items_required);
+
+ std::vector<int> d_pattern;
+ std::vector<int> d_counts;
+ size_t d_itemsize;
+
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif
diff --git a/gr-blocks/lib/peak_detector2_fb_impl.cc b/gr-blocks/lib/peak_detector2_fb_impl.cc
new file mode 100644
index 000000000..0d375c3ba
--- /dev/null
+++ b/gr-blocks/lib/peak_detector2_fb_impl.cc
@@ -0,0 +1,118 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007,2010,2013 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 "peak_detector2_fb_impl.h"
+#include <gr_io_signature.h>
+#include <string.h>
+
+namespace gr {
+ namespace blocks {
+
+ peak_detector2_fb::sptr
+ peak_detector2_fb::make(float threshold_factor_rise,
+ int look_ahead, float alpha)
+ {
+ return gnuradio::get_initial_sptr
+ (new peak_detector2_fb_impl(threshold_factor_rise,
+ look_ahead, alpha));
+ }
+
+ peak_detector2_fb_impl::peak_detector2_fb_impl(float threshold_factor_rise,
+ int look_ahead, float alpha)
+ : gr_sync_block("peak_detector2_fb",
+ gr_make_io_signature(1, 1, sizeof(float)),
+ gr_make_io_signature2(1, 2, sizeof(char), sizeof(float))),
+ d_threshold_factor_rise(threshold_factor_rise),
+ d_look_ahead(look_ahead), d_alpha(alpha), d_avg(0.0f), d_found(false)
+ {
+ }
+
+ peak_detector2_fb_impl::~peak_detector2_fb_impl()
+ {
+ }
+
+ int
+ peak_detector2_fb_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ float *iptr = (float *)input_items[0];
+ char *optr = (char *)output_items[0];
+
+ assert(noutput_items >= 2);
+
+ memset(optr, 0, noutput_items*sizeof(char));
+
+ for(int i = 0; i < noutput_items; i++) {
+ if(!d_found) {
+ // Have not yet detected presence of peak
+ if(iptr[i] > d_avg * (1.0f + d_threshold_factor_rise)) {
+ d_found = true;
+ d_look_ahead_remaining = d_look_ahead;
+ d_peak_val = -(float)INFINITY;
+ }
+ else {
+ d_avg = d_alpha*iptr[i] + (1.0f - d_alpha)*d_avg;
+ }
+ }
+ else {
+ // Detected presence of peak
+ if(iptr[i] > d_peak_val) {
+ d_peak_val = iptr[i];
+ d_peak_ind = i;
+ }
+ else if(d_look_ahead_remaining <= 0) {
+ optr[d_peak_ind] = 1;
+ d_found = false;
+ d_avg = iptr[i];
+ }
+
+ // Have not yet located peak, loop and keep searching.
+ d_look_ahead_remaining--;
+ }
+
+ // Every iteration of the loop, write debugging signal out if
+ // connected:
+ if(output_items.size() == 2) {
+ float *sigout = (float *)output_items[1];
+ sigout[i] = d_avg;
+ }
+ } // loop
+
+ if(!d_found)
+ return noutput_items;
+
+ // else if detected presence, keep searching during the next call to work.
+ int tmp = d_peak_ind;
+ d_peak_ind = 1;
+
+ return tmp - 1;
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+
diff --git a/gr-blocks/lib/peak_detector2_fb_impl.h b/gr-blocks/lib/peak_detector2_fb_impl.h
new file mode 100644
index 000000000..f03dd36a8
--- /dev/null
+++ b/gr-blocks/lib/peak_detector2_fb_impl.h
@@ -0,0 +1,64 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007,2013 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_PEAK_DETECTOR2_FB_IMPL_H
+#define INCLUDED_GR_PEAK_DETECTOR2_FB_IMPL_H
+
+#include <blocks/peak_detector2_fb.h>
+
+namespace gr {
+ namespace blocks {
+
+ class peak_detector2_fb_impl : public peak_detector2_fb
+ {
+ private:
+ float d_threshold_factor_rise;
+ int d_look_ahead;
+ int d_look_ahead_remaining;
+ int d_peak_ind;
+ float d_peak_val;
+ float d_alpha;
+ float d_avg;
+ bool d_found;
+
+ public:
+ peak_detector2_fb_impl(float threshold_factor_rise,
+ int look_ahead, float alpha);
+ ~peak_detector2_fb_impl();
+
+ void set_threshold_factor_rise(float thr) { d_threshold_factor_rise = thr; }
+ void set_look_ahead(int look) { d_look_ahead = look; }
+ void set_alpha(int alpha) { d_alpha = alpha; }
+
+ float threshold_factor_rise() { return d_threshold_factor_rise; }
+ int look_ahead() { return d_look_ahead; }
+ float alpha() { return d_alpha; }
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_PEAK_DETECTOR2_FB_IMPL_H */
diff --git a/gr-blocks/lib/regenerate_bb_impl.cc b/gr-blocks/lib/regenerate_bb_impl.cc
new file mode 100644
index 000000000..4472efb6d
--- /dev/null
+++ b/gr-blocks/lib/regenerate_bb_impl.cc
@@ -0,0 +1,103 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007,2010,2013 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 "regenerate_bb_impl.h"
+#include <gr_io_signature.h>
+
+namespace gr {
+ namespace blocks {
+
+ regenerate_bb::sptr
+ regenerate_bb::make(int period, unsigned int max_regen)
+ {
+ return gnuradio::get_initial_sptr
+ (new regenerate_bb_impl(period, max_regen));
+ }
+
+ regenerate_bb_impl::regenerate_bb_impl(int period, unsigned int max_regen)
+ : gr_sync_block("regenerate_bb",
+ gr_make_io_signature(1, 1, sizeof(char)),
+ gr_make_io_signature(1, 1, sizeof(char))),
+ d_period(period),
+ d_countdown(0),
+ d_max_regen(max_regen),
+ d_regen_count(max_regen)
+ {
+ }
+
+ regenerate_bb_impl::~regenerate_bb_impl()
+ {
+ }
+
+ void
+ regenerate_bb_impl::set_max_regen(unsigned int regen)
+ {
+ d_max_regen = regen;
+ d_countdown = 0;
+ d_regen_count = d_max_regen;
+ }
+
+ void
+ regenerate_bb_impl::set_period(int period)
+ {
+ d_period = period;
+ d_countdown = 0;
+ d_regen_count = d_max_regen;
+ }
+
+ int
+ regenerate_bb_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const char *iptr = (const char *)input_items[0];
+ char *optr = (char *)output_items[0];
+
+ for(int i = 0; i < noutput_items; i++) {
+ optr[i] = 0;
+
+ if(d_regen_count < d_max_regen) {
+ d_countdown--;
+
+ if(d_countdown == 0) {
+ optr[i] = 1;
+ d_countdown = d_period;
+ d_regen_count++;
+ }
+ }
+
+ if(iptr[i] == 1) {
+ d_countdown = d_period;
+ optr[i] = 1;
+ d_regen_count = 0;
+ }
+
+ }
+ return noutput_items;
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/regenerate_bb_impl.h b/gr-blocks/lib/regenerate_bb_impl.h
new file mode 100644
index 000000000..bcfa18391
--- /dev/null
+++ b/gr-blocks/lib/regenerate_bb_impl.h
@@ -0,0 +1,57 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007,2012-2013 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_REGENERATE_BB_H
+#define INCLUDED_GR_REGENERATE_BB_IMPL_H
+
+#include <blocks/regenerate_bb.h>
+
+namespace gr {
+ namespace blocks {
+
+ class regenerate_bb_impl : public regenerate_bb
+ {
+ private:
+ int d_period;
+ int d_countdown;
+ unsigned int d_max_regen;
+ unsigned int d_regen_count;
+
+ public:
+ regenerate_bb_impl(int period, unsigned int max_regen=500);
+ ~regenerate_bb_impl();
+
+ void set_max_regen(unsigned int regen);
+ void set_period(int period);
+
+ unsigned int max_regen() const { return d_max_regen; };
+ int period() const { return d_period; };
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_REGENERATE_BB_IMPL_H */
diff --git a/gr-blocks/lib/repeat_impl.cc b/gr-blocks/lib/repeat_impl.cc
new file mode 100644
index 000000000..939a33b87
--- /dev/null
+++ b/gr-blocks/lib/repeat_impl.cc
@@ -0,0 +1,69 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "repeat_impl.h"
+#include <gr_io_signature.h>
+
+namespace gr {
+ namespace blocks {
+
+ repeat::sptr repeat::make(size_t itemsize, int interp)
+ {
+ return gnuradio::get_initial_sptr(new repeat_impl(itemsize, interp));
+ }
+
+ repeat_impl::repeat_impl(size_t itemsize, int interp)
+ : gr_sync_interpolator("repeat",
+ gr_make_io_signature (1, 1, itemsize),
+ gr_make_io_signature (1, 1, itemsize),
+ interp),
+ d_itemsize(itemsize),
+ d_interp(interp)
+ {
+ }
+
+ int
+ repeat_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const char *in = (const char *) input_items[0];
+ char *out = (char *)output_items[0];
+
+ for (int i = 0; i < noutput_items/d_interp; i++) {
+ for (int j = 0; j < d_interp; j++) {
+ memcpy(out, in, d_itemsize);
+ out += d_itemsize;
+ }
+
+ in += d_itemsize;
+ }
+
+ return noutput_items;
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/repeat_impl.h b/gr-blocks/lib/repeat_impl.h
new file mode 100644
index 000000000..6451d0d98
--- /dev/null
+++ b/gr-blocks/lib/repeat_impl.h
@@ -0,0 +1,47 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_REPEAT_IMPL_H
+#define INCLUDED_REPEAT_IMPL_H
+
+#include <blocks/repeat.h>
+
+namespace gr {
+ namespace blocks {
+
+ class BLOCKS_API repeat_impl : public repeat
+ {
+ size_t d_itemsize;
+ int d_interp;
+
+ public:
+ repeat_impl(size_t itemsize, int d_interp);
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_REPEAT_IMPL_H */
diff --git a/gr-blocks/lib/rms_cf_impl.cc b/gr-blocks/lib/rms_cf_impl.cc
new file mode 100644
index 000000000..d956b45f1
--- /dev/null
+++ b/gr-blocks/lib/rms_cf_impl.cc
@@ -0,0 +1,77 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005,2010,2013 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 "rms_cf_impl.h"
+#include <gr_io_signature.h>
+#include <cmath>
+
+namespace gr {
+ namespace blocks {
+
+ rms_cf::sptr
+ rms_cf::make(double alpha)
+ {
+ return gnuradio::get_initial_sptr
+ (new rms_cf_impl(alpha));
+ }
+
+ rms_cf_impl::rms_cf_impl (double alpha)
+ : gr_sync_block("rms_cf",
+ gr_make_io_signature(1, 1, sizeof(gr_complex)),
+ gr_make_io_signature(1, 1, sizeof(float))),
+ d_iir(alpha)
+ {
+ }
+
+ rms_cf_impl::~rms_cf_impl()
+ {
+ }
+
+ void
+ rms_cf_impl::set_alpha(double alpha)
+ {
+ d_iir.set_taps(alpha);
+ }
+
+ int
+ rms_cf_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const gr_complex *in = (const gr_complex *)input_items[0];
+ float *out = (float *)output_items[0];
+
+ for(int i = 0; i < noutput_items; i++) {
+ double mag_sqrd = in[i].real()*in[i].real() + in[i].imag()*in[i].imag();
+ double f = d_iir.filter(mag_sqrd);
+ out[i] = sqrt(f);
+ }
+
+ return noutput_items;
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/rms_cf_impl.h b/gr-blocks/lib/rms_cf_impl.h
new file mode 100644
index 000000000..438b8549d
--- /dev/null
+++ b/gr-blocks/lib/rms_cf_impl.h
@@ -0,0 +1,56 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005,2013 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_BLOCKS_RMS_CF_IMPL_H
+#define INCLUDED_BLOCKS_RMS_CF_IMPL_H
+
+#include <blocks/rms_cf.h>
+#include <gr_single_pole_iir.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief RMS average power
+ * \ingroup math_blk
+ */
+ class rms_cf_impl : public rms_cf
+ {
+ private:
+ gr_single_pole_iir<double,double,double> d_iir;
+
+ public:
+ rms_cf_impl(double alpha = 0.0001);
+ ~rms_cf_impl();
+
+ void set_alpha(double alpha);
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_BLOCKS_RMS_CF_IMPL_H */
diff --git a/gr-blocks/lib/rms_ff_impl.cc b/gr-blocks/lib/rms_ff_impl.cc
new file mode 100644
index 000000000..2b8cdc34e
--- /dev/null
+++ b/gr-blocks/lib/rms_ff_impl.cc
@@ -0,0 +1,77 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005,2010,2013 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 "rms_ff_impl.h"
+#include <gr_io_signature.h>
+#include <cmath>
+
+namespace gr {
+ namespace blocks {
+
+ rms_ff::sptr
+ rms_ff::make(double alpha)
+ {
+ return gnuradio::get_initial_sptr
+ (new rms_ff_impl(alpha));
+ }
+
+ rms_ff_impl::rms_ff_impl(double alpha)
+ : gr_sync_block("rms_ff",
+ gr_make_io_signature(1, 1, sizeof(float)),
+ gr_make_io_signature(1, 1, sizeof(float))),
+ d_iir(alpha)
+ {
+ }
+
+ rms_ff_impl::~rms_ff_impl()
+ {
+ }
+
+ void
+ rms_ff_impl::set_alpha(double alpha)
+ {
+ d_iir.set_taps(alpha);
+ }
+
+ int
+ rms_ff_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const float *in = (const float *)input_items[0];
+ float *out = (float *)output_items[0];
+
+ for(int i = 0; i < noutput_items; i++) {
+ double mag_sqrd = in[i]*in[i];
+ double f = d_iir.filter(mag_sqrd);
+ out[i] = sqrt(f);
+ }
+
+ return noutput_items;
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/rms_ff_impl.h b/gr-blocks/lib/rms_ff_impl.h
new file mode 100644
index 000000000..82ecbda52
--- /dev/null
+++ b/gr-blocks/lib/rms_ff_impl.h
@@ -0,0 +1,55 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005,2013 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_BLOCKS_RMS_FF_IMPL_H
+#define INCLUDED_BLOCKS_RMS_FF_IMPL_H
+
+#include <blocks/rms_ff.h>
+#include <gr_single_pole_iir.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief RMS average power
+ * \ingroup math_blk
+ */
+ class rms_ff_impl : public rms_ff
+ {
+ private:
+ gr_single_pole_iir<double,double,double> d_iir;
+
+ public:
+ rms_ff_impl(double alpha = 0.0001);
+ ~rms_ff_impl();
+
+ void set_alpha(double alpha);
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_BLOCKS_RMS_FF_IMPL_H */
diff --git a/gr-blocks/lib/short_to_char_impl.cc b/gr-blocks/lib/short_to_char_impl.cc
new file mode 100644
index 000000000..54875a2b3
--- /dev/null
+++ b/gr-blocks/lib/short_to_char_impl.cc
@@ -0,0 +1,69 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "short_to_char_impl.h"
+#include <gr_io_signature.h>
+#include <volk/volk.h>
+
+namespace gr {
+ namespace blocks {
+
+ short_to_char::sptr short_to_char::make(size_t vlen)
+ {
+ return gnuradio::get_initial_sptr(new short_to_char_impl(vlen));
+ }
+
+ short_to_char_impl::short_to_char_impl(size_t vlen)
+ : gr_sync_block("short_to_char",
+ gr_make_io_signature (1, 1, sizeof(short)*vlen),
+ gr_make_io_signature (1, 1, sizeof(char)*vlen)),
+ d_vlen(vlen)
+ {
+ const int alignment_multiple =
+ volk_get_alignment() / sizeof(char);
+ set_alignment(std::max(1, alignment_multiple));
+ }
+
+ int
+ short_to_char_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const int16_t *in = (const int16_t *) input_items[0];
+ int8_t *out = (int8_t *) output_items[0];
+
+ if(is_unaligned()) {
+ volk_16i_convert_8i_u(out, in, d_vlen*noutput_items);
+ }
+ else {
+ volk_16i_convert_8i_a(out, in, d_vlen*noutput_items);
+ }
+
+ return noutput_items;
+ }
+
+ } /* namespace blocks */
+}/* namespace gr */
diff --git a/gr-blocks/lib/short_to_char_impl.h b/gr-blocks/lib/short_to_char_impl.h
new file mode 100644
index 000000000..37474094d
--- /dev/null
+++ b/gr-blocks/lib/short_to_char_impl.h
@@ -0,0 +1,47 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_SHORT_TO_CHAR_IMPL_H
+#define INCLUDED_SHORT_TO_CHAR_IMPL_H
+
+#include <blocks/short_to_char.h>
+
+namespace gr {
+ namespace blocks {
+
+ class BLOCKS_API short_to_char_impl : public short_to_char
+ {
+ size_t d_vlen;
+
+ public:
+ short_to_char_impl(size_t vlen);
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+
+#endif /* INCLUDED_SHORT_TO_CHAR_IMPL_H */
diff --git a/gr-blocks/lib/short_to_float_impl.cc b/gr-blocks/lib/short_to_float_impl.cc
new file mode 100644
index 000000000..618601816
--- /dev/null
+++ b/gr-blocks/lib/short_to_float_impl.cc
@@ -0,0 +1,68 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "short_to_float_impl.h"
+#include <gr_io_signature.h>
+#include <volk/volk.h>
+
+namespace gr {
+ namespace blocks {
+
+ short_to_float::sptr short_to_float::make(size_t vlen, float scale)
+ {
+ return gnuradio::get_initial_sptr(new short_to_float_impl(vlen, scale));
+ }
+
+ short_to_float_impl::short_to_float_impl(size_t vlen, float scale)
+ : gr_sync_block("short_to_float",
+ gr_make_io_signature (1, 1, sizeof(short)*vlen),
+ gr_make_io_signature (1, 1, sizeof(float)*vlen)),
+ d_vlen(vlen), d_scale(scale)
+ {
+ const int alignment_multiple =
+ volk_get_alignment() / sizeof(float);
+ set_alignment(std::max(1, alignment_multiple));
+ }
+
+ int
+ short_to_float_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const short *in = (const short *) input_items[0];
+ float *out = (float *) output_items[0];
+
+ if(is_unaligned()) {
+ volk_16i_s32f_convert_32f_u(out, in, d_scale, d_vlen*noutput_items);
+ }
+ else {
+ volk_16i_s32f_convert_32f_a(out, in, d_scale, d_vlen*noutput_items);
+ }
+ return noutput_items;
+ }
+
+ } /* namespace blocks */
+}/* namespace gr */
diff --git a/gr-blocks/lib/short_to_float_impl.h b/gr-blocks/lib/short_to_float_impl.h
new file mode 100644
index 000000000..c36b42a8c
--- /dev/null
+++ b/gr-blocks/lib/short_to_float_impl.h
@@ -0,0 +1,51 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_SHORT_TO_FLOAT_IMPL_H
+#define INCLUDED_SHORT_TO_FLOAT_IMPL_H
+
+#include <blocks/short_to_float.h>
+
+namespace gr {
+ namespace blocks {
+
+ class BLOCKS_API short_to_float_impl : public short_to_float
+ {
+ size_t d_vlen;
+ float d_scale;
+
+ public:
+ short_to_float_impl(size_t vlen, float scale);
+
+ virtual float scale() const { return d_scale; }
+ virtual void set_scale(float scale) { d_scale = scale; }
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+
+#endif /* INCLUDED_SHORT_TO_FLOAT_IMPL_H */
diff --git a/gr-blocks/lib/stream_mux_impl.cc b/gr-blocks/lib/stream_mux_impl.cc
new file mode 100644
index 000000000..214734c4b
--- /dev/null
+++ b/gr-blocks/lib/stream_mux_impl.cc
@@ -0,0 +1,126 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "stream_mux_impl.h"
+#include <gr_io_signature.h>
+#include <string.h>
+#include <cstdio>
+
+#define VERBOSE 0
+
+namespace gr {
+ namespace blocks {
+
+ stream_mux::sptr stream_mux::make(size_t itemsize, const std::vector<int> &lengths)
+ {
+ return gnuradio::get_initial_sptr(new stream_mux_impl(itemsize, lengths));
+ }
+
+ stream_mux_impl::stream_mux_impl(size_t itemsize, const std::vector<int> &lengths)
+ : gr_block("stream_mux",
+ gr_make_io_signature (1, -1, itemsize),
+ gr_make_io_signature (1, 1, itemsize)),
+ d_itemsize(itemsize),
+ d_stream(0),
+ d_residual(0),
+ d_lengths(lengths)
+ {
+ if(d_lengths[d_stream] == 0) {
+ increment_stream();
+ }
+ d_residual = d_lengths[d_stream];
+ }
+
+ void
+ stream_mux_impl::forecast(int noutput_items, gr_vector_int &ninput_items_required)
+ {
+ unsigned ninputs = ninput_items_required.size ();
+ for (unsigned i = 0; i < ninputs; i++)
+ ninput_items_required[i] = (d_lengths[i] == 0 ? 0 : 1);
+ }
+
+ void
+ stream_mux_impl::increment_stream()
+ {
+ do {
+ d_stream = (d_stream+1) % d_lengths.size();
+ } while(d_lengths[d_stream] == 0);
+
+ d_residual = d_lengths[d_stream];
+ }
+
+
+ int
+ stream_mux_impl::general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ char *out = (char *) output_items[0];
+ const char *in;
+ int out_index = 0;
+ std::vector<int> input_index(d_lengths.size(), 0);
+
+ if(VERBOSE) {
+ printf("mux: nouput_items: %d d_stream: %d\n", noutput_items, d_stream);
+ for(size_t i = 0; i < d_lengths.size(); i++)
+ printf("\tninput_items[%zu]: %d\n", i, ninput_items[i]);
+ }
+
+ while (1) {
+ int r = std::min(noutput_items - out_index,
+ std::min(d_residual,
+ ninput_items[d_stream] - input_index[d_stream]));
+ if(VERBOSE) {
+ printf("mux: r=%d\n", r);
+ printf("\tnoutput_items - out_index: %d\n",
+ noutput_items - out_index);
+ printf("\td_residual: %d\n",
+ d_residual);
+ printf("\tninput_items[d_stream] - input_index[d_stream]: %d\n",
+ ninput_items[d_stream] - input_index[d_stream]);
+ }
+
+ if(r <= 0) {
+ return out_index;
+ }
+
+ in = (const char *) input_items[d_stream] + input_index[d_stream]*d_itemsize;
+
+ memcpy(&out[out_index*d_itemsize], in, r*d_itemsize);
+ out_index += r;
+ input_index[d_stream] += r;
+ d_residual -= r;
+
+ consume(d_stream, r);
+
+ if(d_residual == 0) {
+ increment_stream();
+ }
+ }
+ }
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/stream_mux_impl.h b/gr-blocks/lib/stream_mux_impl.h
new file mode 100644
index 000000000..7b2dac95c
--- /dev/null
+++ b/gr-blocks/lib/stream_mux_impl.h
@@ -0,0 +1,55 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_STREAM_MUX_IMPL_H
+#define INCLUDED_STREAM_MUX_IMPL_H
+
+#include <blocks/stream_mux.h>
+
+namespace gr {
+ namespace blocks {
+
+ class BLOCKS_API stream_mux_impl : public stream_mux
+ {
+ private:
+ size_t d_itemsize;
+ unsigned int d_stream; // index of currently selected stream
+ int d_residual; // number if items left to put into current stream
+ gr_vector_int d_lengths; // number if items to pack per stream
+
+ void increment_stream();
+
+ void forecast(int noutput_items, gr_vector_int &ninput_items_required);
+
+ public:
+ stream_mux_impl(size_t itemsize, const std::vector<int> &lengths);
+
+ int general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_STREAM_MUX_IMPL_H */
diff --git a/gr-blocks/lib/stream_to_streams_impl.cc b/gr-blocks/lib/stream_to_streams_impl.cc
new file mode 100644
index 000000000..9e9052e7d
--- /dev/null
+++ b/gr-blocks/lib/stream_to_streams_impl.cc
@@ -0,0 +1,70 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "stream_to_streams_impl.h"
+#include <gr_io_signature.h>
+#include <string.h>
+
+namespace gr {
+ namespace blocks {
+
+ stream_to_streams::sptr stream_to_streams::make(size_t itemsize, size_t nstreams)
+ {
+ return gnuradio::get_initial_sptr(new stream_to_streams_impl(itemsize, nstreams));
+ }
+
+ stream_to_streams_impl::stream_to_streams_impl(size_t itemsize, size_t nstreams)
+ : gr_sync_decimator("stream_to_streams",
+ gr_make_io_signature (1, 1, itemsize),
+ gr_make_io_signature (nstreams, nstreams, itemsize),
+ nstreams)
+ {
+ }
+
+ int
+ stream_to_streams_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ size_t item_size = output_signature()->sizeof_stream_item(0);
+
+ const char *in = (const char *)input_items[0];
+ char **outv = (char **)&output_items[0];
+ int nstreams = output_items.size();
+
+ for (int i = 0; i < noutput_items; i++) {
+ for (int j = 0; j < nstreams; j++) {
+ memcpy(outv[j], in, item_size);
+ outv[j] += item_size;
+ in += item_size;
+ }
+ }
+
+ return noutput_items;
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/stream_to_streams_impl.h b/gr-blocks/lib/stream_to_streams_impl.h
new file mode 100644
index 000000000..9a96983ff
--- /dev/null
+++ b/gr-blocks/lib/stream_to_streams_impl.h
@@ -0,0 +1,44 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_STREAM_TO_STREAMS_IMPL_H
+#define INCLUDED_STREAM_TO_STREAMS_IMPL_H
+
+#include <blocks/stream_to_streams.h>
+
+namespace gr {
+ namespace blocks {
+
+ class BLOCKS_API stream_to_streams_impl : public stream_to_streams
+ {
+ public:
+ stream_to_streams_impl(size_t itemsize, size_t nstreams);
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_STREAM_TO_STREAMS_IMPL_H */
diff --git a/gr-blocks/lib/stream_to_vector_impl.cc b/gr-blocks/lib/stream_to_vector_impl.cc
new file mode 100644
index 000000000..80ced5a74
--- /dev/null
+++ b/gr-blocks/lib/stream_to_vector_impl.cc
@@ -0,0 +1,62 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "stream_to_vector_impl.h"
+#include <gr_io_signature.h>
+
+namespace gr {
+ namespace blocks {
+
+ stream_to_vector::sptr stream_to_vector::make(size_t itemsize, size_t nitems_per_block)
+ {
+ return gnuradio::get_initial_sptr(new stream_to_vector_impl(itemsize, nitems_per_block));
+ }
+
+ stream_to_vector_impl::stream_to_vector_impl(size_t itemsize, size_t nitems_per_block)
+ : gr_sync_decimator ("stream_to_vector",
+ gr_make_io_signature (1, 1, itemsize),
+ gr_make_io_signature (1, 1, itemsize * nitems_per_block),
+ nitems_per_block)
+ {
+ }
+
+ int
+ stream_to_vector_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ size_t block_size = output_signature()->sizeof_stream_item (0);
+
+ const char *in = (const char *) input_items[0];
+ char *out = (char *) output_items[0];
+
+ memcpy (out, in, noutput_items * block_size);
+
+ return noutput_items;
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/stream_to_vector_impl.h b/gr-blocks/lib/stream_to_vector_impl.h
new file mode 100644
index 000000000..f8031f005
--- /dev/null
+++ b/gr-blocks/lib/stream_to_vector_impl.h
@@ -0,0 +1,44 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_STREAM_TO_VECTOR_IMPL_H
+#define INCLUDED_STREAM_TO_VECTOR_IMPL_H
+
+#include <blocks/stream_to_vector.h>
+
+namespace gr {
+ namespace blocks {
+
+ class BLOCKS_API stream_to_vector_impl : public stream_to_vector
+ {
+ public:
+ stream_to_vector_impl(size_t itemsize, size_t nitems_per_block);
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_STREAM_TO_VECTOR_IMPL_H */
diff --git a/gr-blocks/lib/streams_to_stream_impl.cc b/gr-blocks/lib/streams_to_stream_impl.cc
new file mode 100644
index 000000000..09c593e81
--- /dev/null
+++ b/gr-blocks/lib/streams_to_stream_impl.cc
@@ -0,0 +1,72 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "streams_to_stream_impl.h"
+#include <gr_io_signature.h>
+
+namespace gr {
+ namespace blocks {
+
+ streams_to_stream::sptr streams_to_stream::make(size_t itemsize, size_t nstreams)
+ {
+ return gnuradio::get_initial_sptr(new streams_to_stream_impl(itemsize, nstreams));
+ }
+
+ streams_to_stream_impl::streams_to_stream_impl(size_t itemsize, size_t nstreams)
+ : gr_sync_interpolator ("streams_to_stream",
+ gr_make_io_signature (nstreams, nstreams, itemsize),
+ gr_make_io_signature (1, 1, itemsize),
+ nstreams)
+ {
+ }
+
+ int
+ streams_to_stream_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ size_t itemsize = output_signature()->sizeof_stream_item (0);
+
+ const char **inv = (const char **) &input_items[0];
+ char *out = (char *) output_items[0];
+ int nstreams = input_items.size();
+
+ assert (noutput_items % nstreams == 0);
+ int ni = noutput_items / nstreams;
+
+ for (int i = 0; i < ni; i++){
+ for (int j = 0; j < nstreams; j++){
+ memcpy(out, inv[j], itemsize);
+ out += itemsize;
+ inv[j] += itemsize;
+ }
+ }
+
+ return noutput_items;
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/streams_to_stream_impl.h b/gr-blocks/lib/streams_to_stream_impl.h
new file mode 100644
index 000000000..6f686172c
--- /dev/null
+++ b/gr-blocks/lib/streams_to_stream_impl.h
@@ -0,0 +1,44 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_STREAMS_TO_STREAM_IMPL_H
+#define INCLUDED_STREAMS_TO_STREAM_IMPL_H
+
+#include <blocks/streams_to_stream.h>
+
+namespace gr {
+ namespace blocks {
+
+ class BLOCKS_API streams_to_stream_impl : public streams_to_stream
+ {
+ public:
+ streams_to_stream_impl(size_t itemsize, size_t nstreams);
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_STREAMS_TO_STREAM_IMPL_H */
diff --git a/gr-blocks/lib/streams_to_vector_impl.cc b/gr-blocks/lib/streams_to_vector_impl.cc
new file mode 100644
index 000000000..c524a78e4
--- /dev/null
+++ b/gr-blocks/lib/streams_to_vector_impl.cc
@@ -0,0 +1,68 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "streams_to_vector_impl.h"
+#include <gr_io_signature.h>
+
+namespace gr {
+ namespace blocks {
+
+ streams_to_vector::sptr streams_to_vector::make(size_t itemsize, size_t nstreams)
+ {
+ return gnuradio::get_initial_sptr(new streams_to_vector_impl(itemsize, nstreams));
+ }
+
+ streams_to_vector_impl::streams_to_vector_impl(size_t itemsize, size_t nstreams)
+ : gr_sync_block ("streams_to_vector",
+ gr_make_io_signature (nstreams, nstreams, itemsize),
+ gr_make_io_signature (1, 1, nstreams * itemsize))
+ {
+ }
+
+ int
+ streams_to_vector_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ size_t itemsize = input_signature()->sizeof_stream_item(0);
+ int nstreams = input_items.size();
+
+ const char **inv = (const char **) &input_items[0];
+ char *out = (char *) output_items[0];
+
+ for (int i = 0; i < noutput_items; i++){
+ for (int j = 0; j < nstreams; j++){
+ memcpy(out, inv[j], itemsize);
+ inv[j] += itemsize;
+ out += itemsize;
+ }
+ }
+
+ return noutput_items;
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/streams_to_vector_impl.h b/gr-blocks/lib/streams_to_vector_impl.h
new file mode 100644
index 000000000..4a14e9d4f
--- /dev/null
+++ b/gr-blocks/lib/streams_to_vector_impl.h
@@ -0,0 +1,44 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_STREAMS_TO_VECTOR_IMPL_H
+#define INCLUDED_STREAMS_TO_VECTOR_IMPL_H
+
+#include <blocks/streams_to_vector.h>
+
+namespace gr {
+ namespace blocks {
+
+ class BLOCKS_API streams_to_vector_impl : public streams_to_vector
+ {
+ public:
+ streams_to_vector_impl(size_t itemsize, size_t nstreams);
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_STREAMS_TO_VECTOR_IMPL_H */
diff --git a/gr-blocks/lib/stretch_ff_impl.cc b/gr-blocks/lib/stretch_ff_impl.cc
new file mode 100644
index 000000000..90bbc7ee5
--- /dev/null
+++ b/gr-blocks/lib/stretch_ff_impl.cc
@@ -0,0 +1,84 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,2010,2013 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 "stretch_ff_impl.h"
+#include <gr_io_signature.h>
+
+namespace gr {
+ namespace blocks {
+
+ stretch_ff::sptr
+ stretch_ff::make(float lo, size_t vlen)
+ {
+ return gnuradio::get_initial_sptr
+ (new stretch_ff_impl(lo, vlen));
+ }
+
+ stretch_ff_impl::stretch_ff_impl(float lo, size_t vlen)
+ : gr_sync_block("stretch_ff",
+ gr_make_io_signature(1, 1, vlen * sizeof(float)),
+ gr_make_io_signature(1, 1, vlen * sizeof(float))),
+ d_lo(lo), d_vlen(vlen)
+ {
+ }
+
+ stretch_ff_impl::~stretch_ff_impl()
+ {
+ }
+
+ int
+ stretch_ff_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const float *in = (const float *)input_items[0];
+ float *out = (float *)output_items[0];
+
+ for(int count = 0; count < noutput_items; count++) {
+ float vmax = in[0] - d_lo;
+
+ for(unsigned int i = 1; i < d_vlen; i++) {
+ float vtmp = in[i] - d_lo;
+ if(vtmp > vmax)
+ vmax = vtmp;
+ }
+
+ if(vmax != 0.0)
+ for(unsigned int i = 0; i < d_vlen; i++)
+ out[i] = d_lo * (1.0 - (in[i] - d_lo) / vmax);
+ else
+ for(unsigned int i = 0; i < d_vlen; i++)
+ out[i] = in[i];
+
+ in += d_vlen;
+ out += d_vlen;
+ }
+
+ return noutput_items;
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/stretch_ff_impl.h b/gr-blocks/lib/stretch_ff_impl.h
new file mode 100644
index 000000000..af69d835a
--- /dev/null
+++ b/gr-blocks/lib/stretch_ff_impl.h
@@ -0,0 +1,53 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,2013 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_STRETCH_FF_IMPL_H
+#define INCLUDED_GR_STRETCH_FF_IMPL_H
+
+#include <blocks/stretch_ff.h>
+
+namespace gr {
+ namespace blocks {
+
+ class stretch_ff_impl : public stretch_ff
+ {
+ private:
+ float d_lo; // the constant
+ size_t d_vlen;
+
+ public:
+ stretch_ff_impl(float lo, size_t vlen);
+ ~stretch_ff_impl();
+
+ float lo() const { return d_lo; }
+ void set_lo(float lo) { d_lo = lo; }
+ size_t vlen() const { return d_vlen; }
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_STRETCH_FF_IMPL_H */
diff --git a/gr-blocks/lib/sub_XX_impl.cc.t b/gr-blocks/lib/sub_XX_impl.cc.t
new file mode 100644
index 000000000..35ae31452
--- /dev/null
+++ b/gr-blocks/lib/sub_XX_impl.cc.t
@@ -0,0 +1,69 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2009,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.
+ */
+
+// @WARNING@
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <@NAME_IMPL@.h>
+#include <gr_io_signature.h>
+
+namespace gr {
+ namespace blocks {
+
+ @NAME@::sptr @NAME@::make(size_t vlen)
+ {
+ return gnuradio::get_initial_sptr(new @NAME_IMPL@(vlen));
+ }
+
+ @NAME_IMPL@::@NAME_IMPL@(size_t vlen)
+ : gr_sync_block ("@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_IMPL@::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;
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/sub_XX_impl.h.t b/gr-blocks/lib/sub_XX_impl.h.t
new file mode 100644
index 000000000..a1c486b85
--- /dev/null
+++ b/gr-blocks/lib/sub_XX_impl.h.t
@@ -0,0 +1,48 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2009,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_IMPL@
+#define @GUARD_NAME_IMPL@
+
+#include <blocks/@NAME@.h>
+
+namespace gr {
+ namespace blocks {
+
+ class BLOCKS_API @NAME_IMPL@ : public @NAME@
+ {
+ size_t d_vlen;
+
+ public:
+ @NAME_IMPL@(size_t vlen);
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* @GUARD_NAME_IMPL@ */
diff --git a/gr-blocks/lib/threshold_ff_impl.cc b/gr-blocks/lib/threshold_ff_impl.cc
new file mode 100644
index 000000000..477f2b1c8
--- /dev/null
+++ b/gr-blocks/lib/threshold_ff_impl.cc
@@ -0,0 +1,78 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2010,2013 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 "threshold_ff_impl.h"
+#include <gr_io_signature.h>
+
+namespace gr {
+ namespace blocks {
+
+ threshold_ff::sptr
+ threshold_ff::make(float lo, float hi, float initial_state)
+ {
+ return gnuradio::get_initial_sptr
+ (new threshold_ff_impl(lo, hi, initial_state));
+ }
+
+ threshold_ff_impl::threshold_ff_impl(float lo, float hi,
+ float initial_state)
+ : gr_sync_block("threshold_ff",
+ gr_make_io_signature(1, 1, sizeof(float)),
+ gr_make_io_signature(1, 1, sizeof(float))),
+ d_lo(lo), d_hi(hi), d_last_state(initial_state)
+ {
+ }
+
+ threshold_ff_impl::~threshold_ff_impl()
+ {
+ }
+
+ int
+ threshold_ff_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const float *in = (const float *)input_items[0];
+ float *out = (float *)output_items[0];
+
+ for(int i = 0; i < noutput_items; i++) {
+ if(in[i] > d_hi) {
+ out[i] = 1.0;
+ d_last_state = 1.0;
+ }
+ else if(in[i] < d_lo) {
+ out[i] = 0.0;
+ d_last_state = 0.0;
+ }
+ else
+ out[i] = d_last_state;
+ }
+
+ return noutput_items;
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/threshold_ff_impl.h b/gr-blocks/lib/threshold_ff_impl.h
new file mode 100644
index 000000000..41afaa52a
--- /dev/null
+++ b/gr-blocks/lib/threshold_ff_impl.h
@@ -0,0 +1,57 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2013 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_THRESHOLD_FF_IMPL_H
+#define INCLUDED_GR_THRESHOLD_FF_IMPL_H
+
+#include <blocks/threshold_ff.h>
+
+namespace gr {
+ namespace blocks {
+
+ class threshold_ff_impl : public threshold_ff
+ {
+ private:
+ float d_lo, d_hi; // the constant
+ float d_last_state;
+
+ public:
+ threshold_ff_impl(float lo, float hi,
+ float initial_state=0);
+ ~threshold_ff_impl();
+
+ float lo() const { return d_lo; }
+ void set_lo(float lo) { d_lo = lo; }
+ float hi() const { return d_hi; }
+ void set_hi(float hi) { d_hi = hi; }
+ float last_state() const { return d_last_state; }
+ void set_last_state(float last_state) { d_last_state = last_state; }
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_THRESHOLD_FF_IMPL_H */
diff --git a/gr-blocks/lib/throttle_impl.cc b/gr-blocks/lib/throttle_impl.cc
new file mode 100644
index 000000000..49743e3f2
--- /dev/null
+++ b/gr-blocks/lib/throttle_impl.cc
@@ -0,0 +1,97 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005-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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "throttle_impl.h"
+#include <gr_io_signature.h>
+#include <cstring>
+#include <boost/thread/thread.hpp>
+
+namespace gr {
+ namespace blocks {
+
+ throttle::sptr
+ throttle::make(size_t itemsize, double samples_per_sec)
+ {
+ return gnuradio::get_initial_sptr
+ (new throttle_impl(itemsize, samples_per_sec));
+ }
+
+ throttle_impl::throttle_impl(size_t itemsize,
+ double samples_per_second)
+ : gr_sync_block("throttle",
+ gr_make_io_signature(1, 1, itemsize),
+ gr_make_io_signature(1, 1, itemsize)),
+ d_itemsize(itemsize)
+ {
+ set_sample_rate(samples_per_second);
+ }
+
+ throttle_impl::~throttle_impl()
+ {
+ }
+
+ void
+ throttle_impl::set_sample_rate(double rate)
+ {
+ //changing the sample rate performs a reset of state params
+ d_start = boost::get_system_time();
+ d_total_samples = 0;
+ d_samps_per_tick = rate/boost::posix_time::time_duration::ticks_per_second();
+ d_samps_per_us = rate/1e6;
+ }
+
+ double
+ throttle_impl::sample_rate() const
+ {
+ return d_samps_per_us * 1e6;
+ }
+
+ int
+ throttle_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ //calculate the expected number of samples to have passed through
+ boost::system_time now = boost::get_system_time();
+ boost::int64_t ticks = (now - d_start).ticks();
+ uint64_t expected_samps = uint64_t(d_samps_per_tick*ticks);
+
+ //if the expected samples was less, we need to throttle back
+ if(d_total_samples > expected_samps) {
+ boost::this_thread::sleep(boost::posix_time::microseconds
+ (long((d_total_samples - expected_samps)/d_samps_per_us)));
+ }
+
+ //copy all samples output[i] <= input[i]
+ const char *in = (const char *)input_items[0];
+ char *out = (char *)output_items[0];
+ std::memcpy(out, in, noutput_items * d_itemsize);
+ d_total_samples += noutput_items;
+ return noutput_items;
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/throttle_impl.h b/gr-blocks/lib/throttle_impl.h
new file mode 100644
index 000000000..bce67ae64
--- /dev/null
+++ b/gr-blocks/lib/throttle_impl.h
@@ -0,0 +1,55 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005-2011,2013 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_THROTTLE_IMPL_H
+#define INCLUDED_GR_THROTTLE_IMPL_H
+
+#include <blocks/throttle.h>
+#include <boost/thread/thread.hpp> //d_start
+
+namespace gr {
+ namespace blocks {
+
+ class throttle_impl : public throttle
+ {
+ private:
+ boost::system_time d_start;
+ size_t d_itemsize;
+ uint64_t d_total_samples;
+ double d_samps_per_tick, d_samps_per_us;
+
+ public:
+ throttle_impl(size_t itemsize, double samples_per_sec);
+ ~throttle_impl();
+
+ void set_sample_rate(double rate);
+ double sample_rate() const;
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_THROTTLE_IMPL_H */
diff --git a/gr-blocks/lib/transcendental_impl.cc b/gr-blocks/lib/transcendental_impl.cc
new file mode 100644
index 000000000..725899ca8
--- /dev/null
+++ b/gr-blocks/lib/transcendental_impl.cc
@@ -0,0 +1,150 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2011,2013 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 "transcendental_impl.h"
+#include <gr_io_signature.h>
+#include <stdexcept>
+#include <complex> //complex math
+#include <cmath> //real math
+#include <map>
+
+namespace gr {
+ namespace blocks {
+
+ /***********************************************************************
+ * work function creation and registration
+ **********************************************************************/
+ struct map_val_type
+ {
+ work_fcn_type work_fcn;
+ size_t io_size;
+ };
+ typedef std::map<std::string, map_val_type> map_type;
+
+ //construct map on first use idiom
+ static map_type &
+ get_map(void)
+ {
+ static map_type map;
+ return map;
+ }
+
+ //static initialization of this object registers a function
+ struct transcendental_registrant
+ {
+ transcendental_registrant(const std::string &key,
+ const work_fcn_type &work_fcn,
+ const size_t io_size)
+ {
+ map_val_type val;
+ val.work_fcn = work_fcn;
+ val.io_size = io_size;
+ get_map()[key] = val;
+ }
+ };
+
+ //macro to create a work function and register it
+#define REGISTER_FUNCTION(__fcn__, __type__, __key__) \
+ static int __key__ ## _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]; \
+ __type__ *out = (__type__ *) output_items[0]; \
+ for (size_t i = 0; i < size_t(noutput_items); i++){ \
+ out[i] = std::__fcn__(in[i]); \
+ } \
+ return noutput_items; \
+ } \
+ transcendental_registrant __key__ ## _registrant(#__key__, &__key__ ## _work, sizeof(__type__));
+
+ //register work functions for real types
+#define REGISTER_REAL_FUNCTIONS(__fcn__) \
+ REGISTER_FUNCTION(__fcn__, float, __fcn__ ## _float) \
+ REGISTER_FUNCTION(__fcn__, double, __fcn__ ## _double)
+
+ //register work functions for complex types
+#define REGISTER_COMPLEX_FUNCTIONS(__fcn__) \
+ REGISTER_FUNCTION(__fcn__, std::complex<float>, __fcn__ ## _complex_float) \
+ REGISTER_FUNCTION(__fcn__, std::complex<double>, __fcn__ ## _complex_double)
+
+ //register both complex and real
+#define REGISTER_FUNCTIONS(__fcn__) \
+ REGISTER_REAL_FUNCTIONS(__fcn__) \
+ REGISTER_COMPLEX_FUNCTIONS(__fcn__)
+
+ //create and register transcendental work functions
+ REGISTER_FUNCTIONS(cos)
+ REGISTER_FUNCTIONS(sin)
+ REGISTER_FUNCTIONS(tan)
+ REGISTER_REAL_FUNCTIONS(acos)
+ REGISTER_REAL_FUNCTIONS(asin)
+ REGISTER_REAL_FUNCTIONS(atan)
+ REGISTER_FUNCTIONS(cosh)
+ REGISTER_FUNCTIONS(sinh)
+ REGISTER_FUNCTIONS(tanh)
+ REGISTER_FUNCTIONS(exp)
+ REGISTER_FUNCTIONS(log)
+ REGISTER_FUNCTIONS(log10)
+ REGISTER_FUNCTIONS(sqrt)
+
+
+ transcendental::sptr
+ transcendental::make(const std::string &name,
+ const std::string &type)
+ {
+ //search for an entry in the map
+ const std::string key = name + "_" + type;
+ const bool has_key = get_map().count(key) != 0;
+ if(!has_key)
+ throw std::runtime_error("could not find transcendental function for " + key);
+
+ //make a new block with found work function
+ return gnuradio::get_initial_sptr
+ (new transcendental_impl(get_map()[key].work_fcn, get_map()[key].io_size));
+ }
+
+ transcendental_impl::transcendental_impl(const work_fcn_type &work_fcn,
+ const size_t io_size)
+ : gr_sync_block("transcendental",
+ gr_make_io_signature(1, 1, io_size),
+ gr_make_io_signature(1, 1, io_size)),
+ _work_fcn(work_fcn)
+ {
+ // NOP
+ }
+
+ transcendental_impl::~transcendental_impl()
+ {
+ }
+
+ int
+ transcendental_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ return _work_fcn(noutput_items, input_items, output_items);
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/transcendental_impl.h b/gr-blocks/lib/transcendental_impl.h
new file mode 100644
index 000000000..47055551e
--- /dev/null
+++ b/gr-blocks/lib/transcendental_impl.h
@@ -0,0 +1,51 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2011,2013 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_TRANSCENDENTAL_IMPL_H
+#define INCLUDED_GR_TRANSCENDENTAL_IMPL_H
+
+#include <blocks/transcendental.h>
+
+namespace gr {
+ namespace blocks {
+
+ typedef int(*work_fcn_type)(int, gr_vector_const_void_star &, gr_vector_void_star &);
+
+ class transcendental_impl : public transcendental
+ {
+ private:
+ const work_fcn_type &_work_fcn;
+
+ public:
+ transcendental_impl(const work_fcn_type &work_fcn,
+ const size_t io_size);
+ ~transcendental_impl();
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_TRANSCENDENTAL_IMPL_H */
diff --git a/gr-blocks/lib/uchar_array_to_float.cc b/gr-blocks/lib/uchar_array_to_float.cc
new file mode 100644
index 000000000..90cc0fca3
--- /dev/null
+++ b/gr-blocks/lib/uchar_array_to_float.cc
@@ -0,0 +1,40 @@
+/* -*- 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.
+ */
+
+#include <uchar_array_to_float.h>
+
+void
+uchar_array_to_float (const unsigned char *in, float *out, int nsamples)
+{
+ while (nsamples >= 4){
+ out[0] = in[0];
+ out[1] = in[1];
+ out[2] = in[2];
+ out[3] = in[3];
+ out += 4;
+ in += 4;
+ nsamples -= 4;
+ }
+
+ while (nsamples-- > 0)
+ *out++ = *in++;
+}
diff --git a/gr-blocks/lib/uchar_array_to_float.h b/gr-blocks/lib/uchar_array_to_float.h
new file mode 100644
index 000000000..e6772c2a8
--- /dev/null
+++ b/gr-blocks/lib/uchar_array_to_float.h
@@ -0,0 +1,34 @@
+/* -*- 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 INCLUDED_UCHAR_ARRAY_TO_FLOAT_H
+#define INCLUDED_UCHAR_ARRAY_TO_FLOAT_H
+
+#include <blocks/api.h>
+
+/*
+ * convert array of unsigned chars to floats
+ */
+BLOCKS_API void uchar_array_to_float (const unsigned char *in, float *out, int nsamples);
+
+
+#endif /* INCLUDED_UCHAR_ARRAY_TO_FLOAT_H */
diff --git a/gr-blocks/lib/uchar_to_float_impl.cc b/gr-blocks/lib/uchar_to_float_impl.cc
new file mode 100644
index 000000000..608c05ad4
--- /dev/null
+++ b/gr-blocks/lib/uchar_to_float_impl.cc
@@ -0,0 +1,60 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "uchar_to_float_impl.h"
+#include "uchar_array_to_float.h"
+#include <gr_io_signature.h>
+
+namespace gr {
+ namespace blocks {
+
+ uchar_to_float::sptr uchar_to_float::make()
+ {
+ return gnuradio::get_initial_sptr(new uchar_to_float_impl());
+ }
+
+ uchar_to_float_impl::uchar_to_float_impl()
+ : gr_sync_block("uchar_to_float",
+ gr_make_io_signature (1, 1, sizeof(unsigned char)),
+ gr_make_io_signature (1, 1, sizeof(float)))
+ {
+ }
+
+ int
+ uchar_to_float_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const unsigned char *in = (const unsigned char *) input_items[0];
+ float *out = (float *) output_items[0];
+
+ uchar_array_to_float (in, out, noutput_items);
+
+ return noutput_items;
+ }
+
+ } /* namespace blocks */
+}/* namespace gr */
diff --git a/gr-blocks/lib/uchar_to_float_impl.h b/gr-blocks/lib/uchar_to_float_impl.h
new file mode 100644
index 000000000..250dc2c86
--- /dev/null
+++ b/gr-blocks/lib/uchar_to_float_impl.h
@@ -0,0 +1,45 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_UCHAR_TO_FLOAT_IMPL_H
+#define INCLUDED_UCHAR_TO_FLOAT_IMPL_H
+
+#include <blocks/uchar_to_float.h>
+
+namespace gr {
+ namespace blocks {
+
+ class BLOCKS_API uchar_to_float_impl : public uchar_to_float
+ {
+ public:
+ uchar_to_float_impl();
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+
+#endif /* INCLUDED_UCHAR_TO_FLOAT_IMPL_H */
diff --git a/gr-blocks/lib/unpacked_to_packed_XX_impl.cc.t b/gr-blocks/lib/unpacked_to_packed_XX_impl.cc.t
new file mode 100644
index 000000000..3a7428fd8
--- /dev/null
+++ b/gr-blocks/lib/unpacked_to_packed_XX_impl.cc.t
@@ -0,0 +1,143 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2006,2013 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_IMPL@.h"
+#include <gr_io_signature.h>
+#include <assert.h>
+
+namespace gr {
+ namespace blocks {
+
+ static const unsigned int BITS_PER_TYPE = sizeof(@O_TYPE@) * 8;
+
+ @NAME@::sptr
+ @NAME@::make(unsigned int bits_per_chunk,
+ gr_endianness_t endianness)
+ {
+ return gnuradio::get_initial_sptr
+ (new @NAME_IMPL@(bits_per_chunk, endianness));
+ }
+
+ @NAME_IMPL@::@NAME_IMPL@(unsigned int bits_per_chunk,
+ gr_endianness_t endianness)
+ : gr_block("@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));
+ }
+
+ @NAME_IMPL@::~@NAME_IMPL@()
+ {
+ }
+
+ void
+ @NAME_IMPL@::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_IMPL@::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;
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/unpacked_to_packed_XX_impl.h.t b/gr-blocks/lib/unpacked_to_packed_XX_impl.h.t
new file mode 100644
index 000000000..c8f414c55
--- /dev/null
+++ b/gr-blocks/lib/unpacked_to_packed_XX_impl.h.t
@@ -0,0 +1,59 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006.2013 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_IMPL@
+#define @GUARD_NAME_IMPL@
+
+#include <blocks/@NAME@.h>
+
+namespace gr {
+ namespace blocks {
+
+ class @NAME_IMPL@ : public @NAME@
+ {
+ private:
+ unsigned int d_bits_per_chunk;
+ gr_endianness_t d_endianness;
+ unsigned int d_index;
+
+ public:
+ @NAME_IMPL@(unsigned int bits_per_chunk,
+ gr_endianness_t endianness);
+ ~@NAME_IMPL@();
+
+ 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; }
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* @GUARD_NAME_IMPL@ */
diff --git a/gr-blocks/lib/vector_to_stream_impl.cc b/gr-blocks/lib/vector_to_stream_impl.cc
new file mode 100644
index 000000000..fa833a3ec
--- /dev/null
+++ b/gr-blocks/lib/vector_to_stream_impl.cc
@@ -0,0 +1,62 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "vector_to_stream_impl.h"
+#include <gr_io_signature.h>
+
+namespace gr {
+ namespace blocks {
+
+ vector_to_stream::sptr vector_to_stream::make(size_t itemsize, size_t nitems_per_block)
+ {
+ return gnuradio::get_initial_sptr(new vector_to_stream_impl(itemsize, nitems_per_block));
+ }
+
+ vector_to_stream_impl::vector_to_stream_impl(size_t itemsize, size_t nitems_per_block)
+ : gr_sync_interpolator ("vector_to_stream",
+ gr_make_io_signature (1, 1, itemsize * nitems_per_block),
+ gr_make_io_signature (1, 1, itemsize),
+ nitems_per_block)
+ {
+ }
+
+ int
+ vector_to_stream_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ size_t block_size = output_signature()->sizeof_stream_item (0);
+
+ const char *in = (const char *) input_items[0];
+ char *out = (char *) output_items[0];
+
+ memcpy (out, in, noutput_items * block_size);
+
+ return noutput_items;
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/vector_to_stream_impl.h b/gr-blocks/lib/vector_to_stream_impl.h
new file mode 100644
index 000000000..4128f6090
--- /dev/null
+++ b/gr-blocks/lib/vector_to_stream_impl.h
@@ -0,0 +1,44 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_VECTOR_TO_STREAM_IMPL_H
+#define INCLUDED_VECTOR_TO_STREAM_IMPL_H
+
+#include <blocks/vector_to_stream.h>
+
+namespace gr {
+ namespace blocks {
+
+ class BLOCKS_API vector_to_stream_impl : public vector_to_stream
+ {
+ public:
+ vector_to_stream_impl(size_t itemsize, size_t nitems_per_block);
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_VECTOR_TO_STREAM_IMPL_H */
diff --git a/gr-blocks/lib/vector_to_streams_impl.cc b/gr-blocks/lib/vector_to_streams_impl.cc
new file mode 100644
index 000000000..09d32c5c5
--- /dev/null
+++ b/gr-blocks/lib/vector_to_streams_impl.cc
@@ -0,0 +1,68 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "vector_to_streams_impl.h"
+#include <gr_io_signature.h>
+
+namespace gr {
+ namespace blocks {
+
+ vector_to_streams::sptr vector_to_streams::make(size_t itemsize, size_t nstreams)
+ {
+ return gnuradio::get_initial_sptr(new vector_to_streams_impl(itemsize, nstreams));
+ }
+
+ vector_to_streams_impl::vector_to_streams_impl(size_t itemsize, size_t nstreams)
+ : gr_sync_block ("vector_to_streams",
+ gr_make_io_signature (1, 1, nstreams * itemsize),
+ gr_make_io_signature (nstreams, nstreams, itemsize))
+
+ {
+ }
+
+ int
+ vector_to_streams_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ size_t itemsize = output_signature()->sizeof_stream_item(0);
+ int nstreams = output_items.size();
+
+ const char *in = (const char *) input_items[0];
+ char **outv = (char **) &output_items[0];
+
+ for (int i = 0; i < noutput_items; i++){
+ for (int j = 0; j < nstreams; j++){
+ memcpy(outv[j], in, itemsize);
+ outv[j] += itemsize;
+ in += itemsize;
+ }
+ }
+
+ return noutput_items;
+ }
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/vector_to_streams_impl.h b/gr-blocks/lib/vector_to_streams_impl.h
new file mode 100644
index 000000000..81bcfd076
--- /dev/null
+++ b/gr-blocks/lib/vector_to_streams_impl.h
@@ -0,0 +1,44 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_VECTOR_TO_STREAMS_IMPL_H
+#define INCLUDED_VECTOR_TO_STREAMS_IMPL_H
+
+#include <blocks/vector_to_streams.h>
+
+namespace gr {
+ namespace blocks {
+
+ class BLOCKS_API vector_to_streams_impl : public vector_to_streams
+ {
+ public:
+ vector_to_streams_impl(size_t itemsize, size_t nstreams);
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_VECTOR_TO_STREAMS_IMPL_H */
diff --git a/gr-blocks/lib/xor_XX_impl.cc.t b/gr-blocks/lib/xor_XX_impl.cc.t
new file mode 100644
index 000000000..eea926512
--- /dev/null
+++ b/gr-blocks/lib/xor_XX_impl.cc.t
@@ -0,0 +1,69 @@
+/* -*- 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_IMPL@.h>
+#include <gr_io_signature.h>
+
+namespace gr {
+ namespace blocks {
+
+ @NAME@::sptr @NAME@::make(size_t vlen)
+ {
+ return gnuradio::get_initial_sptr(new @NAME_IMPL@(vlen));
+ }
+
+ @NAME_IMPL@::@NAME_IMPL@(size_t vlen)
+ : gr_sync_block ("@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_IMPL@::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;
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/xor_XX_impl.h.t b/gr-blocks/lib/xor_XX_impl.h.t
new file mode 100644
index 000000000..25f0da0c8
--- /dev/null
+++ b/gr-blocks/lib/xor_XX_impl.h.t
@@ -0,0 +1,48 @@
+/* -*- 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_IMPL@
+#define @GUARD_NAME_IMPL@
+
+#include <blocks/@NAME@.h>
+
+namespace gr {
+ namespace blocks {
+
+ class BLOCKS_API @NAME_IMPL@ : public @NAME@
+ {
+ size_t d_vlen;
+
+ public:
+ @NAME_IMPL@(size_t vlen);
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* @GUARD_NAME_IMPL@ */
diff --git a/gr-blocks/python/CMakeLists.txt b/gr-blocks/python/CMakeLists.txt
new file mode 100644
index 000000000..cab0b956f
--- /dev/null
+++ b/gr-blocks/python/CMakeLists.txt
@@ -0,0 +1,48 @@
+# 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.
+
+########################################################################
+include(GrPython)
+
+GR_PYTHON_INSTALL(
+ FILES
+ __init__.py
+ parse_file_metadata.py
+ DESTINATION ${GR_PYTHON_DIR}/gnuradio/blocks
+ COMPONENT "blocks_python"
+)
+
+########################################################################
+# Handle the unit tests
+########################################################################
+if(ENABLE_TESTING)
+
+list(APPEND GR_TEST_PYTHON_DIRS
+ ${CMAKE_BINARY_DIR}/gr-blocks/python
+ ${CMAKE_BINARY_DIR}/gr-blocks/swig
+)
+list(APPEND GR_TEST_TARGET_DEPS gnuradio-blocks)
+
+include(GrTest)
+file(GLOB py_qa_test_files "qa_*.py")
+foreach(py_qa_test_file ${py_qa_test_files})
+ get_filename_component(py_qa_test_name ${py_qa_test_file} NAME_WE)
+ GR_ADD_TEST(${py_qa_test_name} ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} ${py_qa_test_file})
+endforeach(py_qa_test_file)
+endif(ENABLE_TESTING)
diff --git a/gr-blocks/python/__init__.py b/gr-blocks/python/__init__.py
new file mode 100644
index 000000000..6577d933e
--- /dev/null
+++ b/gr-blocks/python/__init__.py
@@ -0,0 +1,37 @@
+#
+# 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.
+#
+
+'''
+This is the gr-blocks package. This package provides GNU Radio
+processing blocks common to many flowgraphs.
+'''
+
+from blocks_swig import *
+
+#alias old gr_add_vXX and gr_multiply_vXX
+add_vcc = add_cc
+add_vff = add_ff
+add_vii = add_ii
+add_vss = add_ss
+multiply_vcc = multiply_cc
+multiply_vff = multiply_ff
+multiply_vii = multiply_ii
+multiply_vss = multiply_ss
diff --git a/gr-blocks/python/parse_file_metadata.py b/gr-blocks/python/parse_file_metadata.py
new file mode 100644
index 000000000..c8ac2def9
--- /dev/null
+++ b/gr-blocks/python/parse_file_metadata.py
@@ -0,0 +1,193 @@
+#!/usr/bin/env python
+#
+# 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.
+#
+
+import sys
+from gnuradio import gr
+
+try:
+ import pmt
+except ImportError:
+ from gruel import pmt
+
+
+try:
+ import blocks_swig as blocks
+except ImportError:
+ from gnuradio import blocks
+
+'''
+sr Sample rate (samples/second)
+time Time as uint64(secs), double(fractional secs)
+type Type of data (see gr_file_types enum)
+cplx is complex? (True or False)
+strt Start of data (or size of header) in bytes
+size Size of data in bytes
+'''
+
+HEADER_LENGTH = blocks.METADATA_HEADER_SIZE
+
+ftype_to_string = {blocks.GR_FILE_BYTE: "bytes",
+ blocks.GR_FILE_SHORT: "short",
+ blocks.GR_FILE_INT: "int",
+ blocks.GR_FILE_LONG: "long",
+ blocks.GR_FILE_LONG_LONG: "long long",
+ blocks.GR_FILE_FLOAT: "float",
+ blocks.GR_FILE_DOUBLE: "double" }
+
+ftype_to_size = {blocks.GR_FILE_BYTE: gr.sizeof_char,
+ blocks.GR_FILE_SHORT: gr.sizeof_short,
+ blocks.GR_FILE_INT: gr.sizeof_int,
+ blocks.GR_FILE_LONG: gr.sizeof_int,
+ blocks.GR_FILE_LONG_LONG: 2*gr.sizeof_int,
+ blocks.GR_FILE_FLOAT: gr.sizeof_float,
+ blocks.GR_FILE_DOUBLE: gr.sizeof_double}
+
+def parse_header(p, VERBOSE=False):
+ dump = pmt.PMT_NIL
+
+ info = dict()
+
+ if(pmt.pmt_is_dict(p) is False):
+ sys.stderr.write("Header is not a PMT dictionary: invalid or corrupt data file.\n")
+ sys.exit(1)
+
+ # GET FILE FORMAT VERSION NUMBER
+ if(pmt.pmt_dict_has_key(p, pmt.pmt_string_to_symbol("version"))):
+ r = pmt.pmt_dict_ref(p, pmt.pmt_string_to_symbol("version"), dump)
+ version = pmt.pmt_to_long(r)
+ if(VERBOSE):
+ print "Version Number: {0}".format(version)
+ else:
+ sys.stderr.write("Could not find key 'version': invalid or corrupt data file.\n")
+ sys.exit(1)
+
+ # EXTRACT SAMPLE RATE
+ if(pmt.pmt_dict_has_key(p, pmt.pmt_string_to_symbol("rx_rate"))):
+ r = pmt.pmt_dict_ref(p, pmt.pmt_string_to_symbol("rx_rate"), dump)
+ samp_rate = pmt.pmt_to_double(r)
+ info["rx_rate"] = samp_rate
+ if(VERBOSE):
+ print "Sample Rate: {0:.2f} sps".format(samp_rate)
+ else:
+ sys.stderr.write("Could not find key 'sr': invalid or corrupt data file.\n")
+ sys.exit(1)
+
+ # EXTRACT TIME STAMP
+ if(pmt.pmt_dict_has_key(p, pmt.pmt_string_to_symbol("rx_time"))):
+ r = pmt.pmt_dict_ref(p, pmt.pmt_string_to_symbol("rx_time"), dump)
+ pmt_secs = pmt.pmt_tuple_ref(r, 0)
+ pmt_fracs = pmt.pmt_tuple_ref(r, 1)
+ secs = float(pmt.pmt_to_uint64(pmt_secs))
+ fracs = pmt.pmt_to_double(pmt_fracs)
+ t = secs + fracs
+ info["rx_time"] = t
+ if(VERBOSE):
+ print "Seconds: {0:.6f}".format(t)
+ else:
+ sys.stderr.write("Could not find key 'time': invalid or corrupt data file.\n")
+ sys.exit(1)
+
+ # EXTRACT ITEM SIZE
+ if(pmt.pmt_dict_has_key(p, pmt.pmt_string_to_symbol("size"))):
+ r = pmt.pmt_dict_ref(p, pmt.pmt_string_to_symbol("size"), dump)
+ dsize = pmt.pmt_to_long(r)
+ info["size"] = dsize
+ if(VERBOSE):
+ print "Item size: {0}".format(dsize)
+ else:
+ sys.stderr.write("Could not find key 'size': invalid or corrupt data file.\n")
+ sys.exit(1)
+
+ # EXTRACT DATA TYPE
+ if(pmt.pmt_dict_has_key(p, pmt.pmt_string_to_symbol("type"))):
+ r = pmt.pmt_dict_ref(p, pmt.pmt_string_to_symbol("type"), dump)
+ dtype = pmt.pmt_to_long(r)
+ stype = ftype_to_string[dtype]
+ info["type"] = stype
+ if(VERBOSE):
+ print "Data Type: {0} ({1})".format(stype, dtype)
+ else:
+ sys.stderr.write("Could not find key 'type': invalid or corrupt data file.\n")
+ sys.exit(1)
+
+ # EXTRACT COMPLEX
+ if(pmt.pmt_dict_has_key(p, pmt.pmt_string_to_symbol("cplx"))):
+ r = pmt.pmt_dict_ref(p, pmt.pmt_string_to_symbol("cplx"), dump)
+ cplx = pmt.pmt_to_bool(r)
+ info["cplx"] = cplx
+ if(VERBOSE):
+ print "Complex? {0}".format(cplx)
+ else:
+ sys.stderr.write("Could not find key 'cplx': invalid or corrupt data file.\n")
+ sys.exit(1)
+
+ # EXTRACT WHERE CURRENT SEGMENT STARTS
+ if(pmt.pmt_dict_has_key(p, pmt.pmt_string_to_symbol("strt"))):
+ r = pmt.pmt_dict_ref(p, pmt.pmt_string_to_symbol("strt"), dump)
+ seg_start = pmt.pmt_to_uint64(r)
+ info["hdr_len"] = seg_start
+ info["extra_len"] = seg_start - HEADER_LENGTH
+ info["has_extra"] = info["extra_len"] > 0
+ if(VERBOSE):
+ print "Header Length: {0} bytes".format(info["hdr_len"])
+ print "Extra Length: {0}".format((info["extra_len"]))
+ print "Extra Header? {0}".format(info["has_extra"])
+ else:
+ sys.stderr.write("Could not find key 'strt': invalid or corrupt data file.\n")
+ sys.exit(1)
+
+ # EXTRACT SIZE OF DATA
+ if(pmt.pmt_dict_has_key(p, pmt.pmt_string_to_symbol("bytes"))):
+ r = pmt.pmt_dict_ref(p, pmt.pmt_string_to_symbol("bytes"), dump)
+ nbytes = pmt.pmt_to_uint64(r)
+
+ nitems = nbytes/dsize
+ info["nitems"] = nitems
+ info["nbytes"] = nbytes
+
+ if(VERBOSE):
+ print "Size of Data: {0} bytes".format(nbytes)
+ print " {0} items".format(nitems)
+ else:
+ sys.stderr.write("Could not find key 'size': invalid or corrupt data file.\n")
+ sys.exit(1)
+
+ return info
+
+# IF THERE IS EXTRA DATA, PULL OUT THE DICTIONARY AND PARSE IT
+def parse_extra_dict(p, info, VERBOSE=False):
+ if(pmt.pmt_is_dict(p) is False):
+ sys.stderr.write("Extra header is not a PMT dictionary: invalid or corrupt data file.\n")
+ sys.exit(1)
+
+ items = pmt.pmt_dict_items(p)
+ nitems = pmt.pmt_length(items)
+ for i in xrange(nitems):
+ item = pmt.pmt_nth(i, items)
+ key = pmt.pmt_symbol_to_string(pmt.pmt_car(item))
+ val = pmt.pmt_cdr(item)
+ info[key] = val
+ if(VERBOSE):
+ print "{0}: ".format(key)
+ pmt.pmt_print(val)
+
+ return info
diff --git a/gr-blocks/python/qa_add_mult_div_sub.py b/gr-blocks/python/qa_add_mult_div_sub.py
new file mode 100755
index 000000000..0aca03d3f
--- /dev/null
+++ b/gr-blocks/python/qa_add_mult_div_sub.py
@@ -0,0 +1,212 @@
+#!/usr/bin/env python
+#
+# Copyright 2004,2007,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.
+#
+
+from gnuradio import gr, gr_unittest
+import blocks_swig
+
+class test_add_mult_div_sub(gr_unittest.TestCase):
+
+ def setUp(self):
+ self.tb = gr.top_block()
+
+ def tearDown(self):
+ self.tb = None
+
+ def help_ii(self, src_data, exp_data, op):
+ for s in zip(range(len(src_data)), src_data):
+ src = gr.vector_source_i(s[1])
+ self.tb.connect(src, (op, s[0]))
+ dst = gr.vector_sink_i()
+ self.tb.connect(op, dst)
+ self.tb.run()
+ result_data = dst.data()
+ self.assertEqual(exp_data, result_data)
+
+ def help_ss(self, src_data, exp_data, op):
+ for s in zip(range(len(src_data)), src_data):
+ src = gr.vector_source_s(s[1])
+ self.tb.connect(src, (op, s[0]))
+ dst = gr.vector_sink_s()
+ self.tb.connect(op, dst)
+ self.tb.run()
+ result_data = dst.data()
+ self.assertEqual(exp_data, result_data)
+
+ def help_ff(self, src_data, exp_data, op):
+ for s in zip(range(len(src_data)), src_data):
+ src = gr.vector_source_f(s[1])
+ self.tb.connect(src, (op, s[0]))
+ dst = gr.vector_sink_f()
+ self.tb.connect(op, dst)
+ self.tb.run()
+ result_data = dst.data()
+ self.assertEqual(exp_data, result_data)
+
+ def help_cc(self, src_data, exp_data, op):
+ for s in zip(range(len(src_data)), src_data):
+ src = gr.vector_source_c(s[1])
+ self.tb.connect(src, (op, s[0]))
+ dst = gr.vector_sink_c()
+ self.tb.connect(op, dst)
+ self.tb.run()
+ result_data = dst.data()
+ self.assertEqual(exp_data, result_data)
+
+ # add_XX
+
+ def test_add_ss(self):
+ src1_data = (1, 2, 3, 4, 5)
+ src2_data = (8, -3, 4, 8, 2)
+ expected_result = (9, -1, 7, 12, 7)
+ op = blocks_swig.add_ss()
+ self.help_ss((src1_data, src2_data), expected_result, op)
+
+ def test_add_ii(self):
+ src1_data = (1, 2, 3, 4, 5)
+ src2_data = (8, -3, 4, 8, 2)
+ expected_result = (9, -1, 7, 12, 7)
+ op = blocks_swig.add_ii()
+ self.help_ii((src1_data, src2_data), expected_result, op)
+
+ def test_add_ff(self):
+ src1_data = (1.0, 2.0, 3.0, 4.0, 5.0)
+ src2_data = (8.0, -3.0, 4.0, 8.0, 2.0)
+ expected_result = (9.0, -1.0, 7.0, 12.0, 7.0)
+ op = blocks_swig.add_ff()
+ self.help_ff((src1_data, src2_data), expected_result, op)
+
+ def test_add_cc(self):
+ src1_data = (1+1j, 2+2j, 3+3j, 4+4j, 5+5j)
+ src2_data = (8+8j, -3-3j, 4+4j, 8+8j, 2+2j)
+ expected_result = (9+9j, -1-1j, 7+7j, 12+12j, 7+7j)
+ op = blocks_swig.add_cc()
+ self.help_cc((src1_data, src2_data), expected_result, op)
+
+ # add_const_XX
+
+ def test_add_const_ss(self):
+ src_data = (1, 2, 3, 4, 5)
+ expected_result = (6, 7, 8, 9, 10)
+ op = blocks_swig.add_const_ss(5)
+ self.help_ss((src_data,), expected_result, op)
+
+ def test_add_const_ii(self):
+ src_data = (1, 2, 3, 4, 5)
+ expected_result = (6, 7, 8, 9, 10)
+ op = blocks_swig.add_const_ii(5)
+ self.help_ii((src_data,), expected_result, op)
+
+ def test_add_const_ff(self):
+ src_data = (1, 2, 3, 4, 5)
+ expected_result = (6, 7, 8, 9, 10)
+ op = blocks_swig.add_const_ff(5)
+ self.help_ff((src_data,), expected_result, op)
+
+ def test_add_const_cc(self):
+ src_data = (1, 2, 3, 4, 5)
+ expected_result = (1+5j, 2+5j, 3+5j, 4+5j, 5+5j)
+ op = blocks_swig.add_const_cc(5j)
+ self.help_cc((src_data,), expected_result, op)
+
+ # multiply_XX
+
+ def test_multiply_ss(self):
+ src1_data = (1, 2, 3, 4, 5)
+ src2_data = (8, -3, 4, 8, 2)
+ expected_result = (8, -6, 12, 32, 10)
+ op = blocks_swig.multiply_ss()
+ self.help_ss((src1_data, src2_data),
+ expected_result, op)
+
+ def test_multiply_ii(self):
+ src1_data = (1, 2, 3, 4, 5)
+ src2_data = (8, -3, 4, 8, 2)
+ expected_result = (8, -6, 12, 32, 10)
+ op = blocks_swig.multiply_ii()
+ self.help_ii((src1_data, src2_data),
+ expected_result, op)
+
+ def test_multiply_ff(self):
+ src1_data = (1, 2, 3, 4, 5)
+ src2_data = (8, -3, 4, 8, 2)
+ expected_result = (8, -6, 12, 32, 10)
+ op = blocks_swig.multiply_ff()
+ self.help_ff((src1_data, src2_data),
+ expected_result, op)
+
+ def test_multiply_cc(self):
+ src1_data = (1+1j, 2+2j, 3+3j, 4+4j, 5+5j)
+ src2_data = (8, -3, 4, 8, 2)
+ expected_result = (8+8j, -6-6j, 12+12j, 32+32j, 10+10j)
+ op = blocks_swig.multiply_cc()
+ self.help_cc((src1_data, src2_data),
+ expected_result, op)
+
+ # multiply_const_XX
+
+ def test_multiply_const_ss(self):
+ src_data = (-1, 0, 1, 2, 3)
+ expected_result = (-5, 0, 5, 10, 15)
+ op = blocks_swig.multiply_const_ss(5)
+ self.help_ss((src_data,), expected_result, op)
+
+ def test_multiply_const_ii(self):
+ src_data = (-1, 0, 1, 2, 3)
+ expected_result = (-5, 0, 5, 10, 15)
+ op = blocks_swig.multiply_const_ii(5)
+ self.help_ii((src_data,), expected_result, op)
+
+ def test_multiply_const_ff(self):
+ src_data = (-1, 0, 1, 2, 3)
+ expected_result = (-5, 0, 5, 10, 15)
+ op = blocks_swig.multiply_const_ff(5)
+ self.help_ff((src_data,), expected_result, op)
+
+ def test_multiply_const_cc(self):
+ src_data = (-1-1j, 0+0j, 1+1j, 2+2j, 3+3j)
+ expected_result = (-5-5j, 0+0j, 5+5j, 10+10j, 15+15j)
+ op = blocks_swig.multiply_const_cc(5)
+ self.help_cc((src_data,), expected_result, op)
+
+ def test_multiply_const_cc2(self):
+ src_data = (-1-1j, 0+0j, 1+1j, 2+2j, 3+3j)
+ expected_result = (-3-7j, 0+0j, 3+7j, 6+14j, 9+21j)
+ op = blocks_swig.multiply_const_cc(5+2j)
+ self.help_cc((src_data,), expected_result, op)
+
+ def test_sub_ii(self):
+ src1_data = (1, 2, 3, 4, 5)
+ src2_data = (8, -3, 4, 8, 2)
+ expected_result = (-7, 5, -1, -4, 3)
+ op = blocks_swig.sub_ii()
+ self.help_ii((src1_data, src2_data),
+ expected_result, op)
+
+ def test_div_ff(self):
+ src1_data = ( 5, 9, -15, 1024)
+ src2_data = (10, 3, -5, 64)
+ expected_result = (0.5, 3, 3, 16)
+ op = blocks_swig.divide_ff()
+ self.help_ff((src1_data, src2_data), expected_result, op)
+
+if __name__ == '__main__':
+ gr_unittest.run(test_add_mult_div_sub, "test_add_mult_div_sub.xml")
diff --git a/gr-blocks/python/qa_add_mult_v.py b/gr-blocks/python/qa_add_mult_v.py
new file mode 100755
index 000000000..d362cb885
--- /dev/null
+++ b/gr-blocks/python/qa_add_mult_v.py
@@ -0,0 +1,360 @@
+#!/usr/bin/env python
+#
+# Copyright 2004,2007,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.
+#
+
+from gnuradio import gr, gr_unittest
+import blocks_swig
+
+class test_add_mult_v(gr_unittest.TestCase):
+
+ def setUp(self):
+ self.tb = gr.top_block()
+
+ def tearDown(self):
+ self.tb = None
+
+ def help_ss(self, size, src_data, exp_data, op):
+ for s in zip(range (len (src_data)), src_data):
+ src = gr.vector_source_s(s[1])
+ srcv = gr.stream_to_vector(gr.sizeof_short, size)
+ self.tb.connect(src, srcv)
+ self.tb.connect(srcv, (op, s[0]))
+ rhs = gr.vector_to_stream(gr.sizeof_short, size)
+ dst = gr.vector_sink_s()
+ self.tb.connect(op, rhs, dst)
+ self.tb.run()
+ result_data = dst.data()
+ self.assertEqual(exp_data, result_data)
+
+ def help_ii(self, size, src_data, exp_data, op):
+ for s in zip(range (len (src_data)), src_data):
+ src = gr.vector_source_i(s[1])
+ srcv = gr.stream_to_vector(gr.sizeof_int, size)
+ self.tb.connect(src, srcv)
+ self.tb.connect(srcv, (op, s[0]))
+ rhs = gr.vector_to_stream(gr.sizeof_int, size)
+ dst = gr.vector_sink_i()
+ self.tb.connect(op, rhs, dst)
+ self.tb.run()
+ result_data = dst.data()
+ self.assertEqual(exp_data, result_data)
+
+ def help_ff(self, size, src_data, exp_data, op):
+ for s in zip(range (len (src_data)), src_data):
+ src = gr.vector_source_f(s[1])
+ srcv = gr.stream_to_vector(gr.sizeof_float, size)
+ self.tb.connect(src, srcv)
+ self.tb.connect(srcv, (op, s[0]))
+ rhs = gr.vector_to_stream(gr.sizeof_float, size)
+ dst = gr.vector_sink_f()
+ self.tb.connect(op, rhs, dst)
+ self.tb.run()
+ result_data = dst.data()
+ self.assertEqual(exp_data, result_data)
+
+ def help_cc(self, size, src_data, exp_data, op):
+ for s in zip(range (len (src_data)), src_data):
+ src = gr.vector_source_c(s[1])
+ srcv = gr.stream_to_vector(gr.sizeof_gr_complex, size)
+ self.tb.connect(src, srcv)
+ self.tb.connect(srcv, (op, s[0]))
+ rhs = gr.vector_to_stream(gr.sizeof_gr_complex, size)
+ dst = gr.vector_sink_c()
+ self.tb.connect(op, rhs, dst)
+ self.tb.run()
+ result_data = dst.data()
+ self.assertEqual(exp_data, result_data)
+
+ def help_const_ss(self, src_data, exp_data, op):
+ src = gr.vector_source_s(src_data)
+ srcv = gr.stream_to_vector(gr.sizeof_short, len(src_data))
+ rhs = gr.vector_to_stream(gr.sizeof_short, len(src_data))
+ dst = gr.vector_sink_s()
+ self.tb.connect(src, srcv, op, rhs, dst)
+ self.tb.run()
+ result_data = dst.data()
+ self.assertEqual(exp_data, result_data)
+
+ def help_const_ii(self, src_data, exp_data, op):
+ src = gr.vector_source_i(src_data)
+ srcv = gr.stream_to_vector(gr.sizeof_int, len(src_data))
+ rhs = gr.vector_to_stream(gr.sizeof_int, len(src_data))
+ dst = gr.vector_sink_i()
+ self.tb.connect(src, srcv, op, rhs, dst)
+ self.tb.run()
+ result_data = dst.data()
+ self.assertEqual(exp_data, result_data)
+
+ def help_const_ff(self, src_data, exp_data, op):
+ src = gr.vector_source_f(src_data)
+ srcv = gr.stream_to_vector(gr.sizeof_float, len(src_data))
+ rhs = gr.vector_to_stream(gr.sizeof_float, len(src_data))
+ dst = gr.vector_sink_f()
+ self.tb.connect(src, srcv, op, rhs, dst)
+ self.tb.run()
+ result_data = dst.data()
+ self.assertEqual(exp_data, result_data)
+
+ def help_const_cc(self, src_data, exp_data, op):
+ src = gr.vector_source_c(src_data)
+ srcv = gr.stream_to_vector(gr.sizeof_gr_complex, len(src_data))
+ rhs = gr.vector_to_stream(gr.sizeof_gr_complex, len(src_data))
+ dst = gr.vector_sink_c()
+ self.tb.connect(src, srcv, op, rhs, dst)
+ self.tb.run()
+ result_data = dst.data()
+ self.assertEqual(exp_data, result_data)
+
+ # add_vXX
+
+ def test_add_vss_one(self):
+ src1_data = (1,)
+ src2_data = (2,)
+ src3_data = (3,)
+ expected_result = (6,)
+ op = blocks_swig.add_ss(1)
+ self.help_ss(1, (src1_data, src2_data, src3_data), expected_result, op)
+
+ def test_add_vss_five(self):
+ src1_data = (1, 2, 3, 4, 5)
+ src2_data = (6, 7, 8, 9, 10)
+ src3_data = (11, 12, 13, 14, 15)
+ expected_result = (18, 21, 24, 27, 30)
+ op = blocks_swig.add_ss(5)
+ self.help_ss(5, (src1_data, src2_data, src3_data), expected_result, op)
+
+ def test_add_vii_one(self):
+ src1_data = (1,)
+ src2_data = (2,)
+ src3_data = (3,)
+ expected_result = (6,)
+ op = blocks_swig.add_ii(1)
+ self.help_ii(1, (src1_data, src2_data, src3_data), expected_result, op)
+
+ def test_add_vii_five(self):
+ src1_data = (1, 2, 3, 4, 5)
+ src2_data = (6, 7, 8, 9, 10)
+ src3_data = (11, 12, 13, 14, 15)
+ expected_result = (18, 21, 24, 27, 30)
+ op = blocks_swig.add_ii(5)
+ self.help_ii(5, (src1_data, src2_data, src3_data), expected_result, op)
+
+ def test_add_vff_one(self):
+ src1_data = (1.0,)
+ src2_data = (2.0,)
+ src3_data = (3.0,)
+ expected_result = (6.0,)
+ op = blocks_swig.add_ff(1)
+ self.help_ff(1, (src1_data, src2_data, src3_data), expected_result, op)
+
+ def test_add_vff_five(self):
+ src1_data = (1.0, 2.0, 3.0, 4.0, 5.0)
+ src2_data = (6.0, 7.0, 8.0, 9.0, 10.0)
+ src3_data = (11.0, 12.0, 13.0, 14.0, 15.0)
+ expected_result = (18.0, 21.0, 24.0, 27.0, 30.0)
+ op = blocks_swig.add_ff(5)
+ self.help_ff(5, (src1_data, src2_data, src3_data), expected_result, op)
+
+ def test_add_vcc_one(self):
+ src1_data = (1.0+2.0j,)
+ src2_data = (3.0+4.0j,)
+ src3_data = (5.0+6.0j,)
+ expected_result = (9.0+12j,)
+ op = blocks_swig.add_cc(1)
+ self.help_cc(1, (src1_data, src2_data, src3_data), expected_result, op)
+
+ def test_add_vcc_five(self):
+ src1_data = (1.0+2.0j, 3.0+4.0j, 5.0+6.0j, 7.0+8.0j, 9.0+10.0j)
+ src2_data = (11.0+12.0j, 13.0+14.0j, 15.0+16.0j, 17.0+18.0j, 19.0+20.0j)
+ src3_data = (21.0+22.0j, 23.0+24.0j, 25.0+26.0j, 27.0+28.0j, 29.0+30.0j)
+ expected_result = (33.0+36.0j, 39.0+42.0j, 45.0+48.0j, 51.0+54.0j, 57.0+60.0j)
+ op = blocks_swig.add_cc(5)
+ self.help_cc(5, (src1_data, src2_data, src3_data), expected_result, op)
+
+ # add_const_vXX
+
+ def test_add_const_vss_one(self):
+ src_data = (1,)
+ op = blocks_swig.add_const_vss((2,))
+ exp_data = (3,)
+ self.help_const_ss(src_data, exp_data, op)
+
+ def test_add_const_vss_five(self):
+ src_data = (1, 2, 3, 4, 5)
+ op = blocks_swig.add_const_vss((6, 7, 8, 9, 10))
+ exp_data = (7, 9, 11, 13, 15)
+ self.help_const_ss(src_data, exp_data, op)
+
+ def test_add_const_vii_one(self):
+ src_data = (1,)
+ op = blocks_swig.add_const_vii((2,))
+ exp_data = (3,)
+ self.help_const_ii(src_data, exp_data, op)
+
+ def test_add_const_vii_five(self):
+ src_data = (1, 2, 3, 4, 5)
+ op = blocks_swig.add_const_vii((6, 7, 8, 9, 10))
+ exp_data = (7, 9, 11, 13, 15)
+ self.help_const_ii(src_data, exp_data, op)
+
+ def test_add_const_vff_one(self):
+ src_data = (1.0,)
+ op = blocks_swig.add_const_vff((2.0,))
+ exp_data = (3.0,)
+ self.help_const_ff(src_data, exp_data, op)
+
+ def test_add_const_vff_five(self):
+ src_data = (1.0, 2.0, 3.0, 4.0, 5.0)
+ op = blocks_swig.add_const_vff((6.0, 7.0, 8.0, 9.0, 10.0))
+ exp_data = (7.0, 9.0, 11.0, 13.0, 15.0)
+ self.help_const_ff(src_data, exp_data, op)
+
+ def test_add_const_vcc_one(self):
+ src_data = (1.0+2.0j,)
+ op = blocks_swig.add_const_vcc((2.0+3.0j,))
+ exp_data = (3.0+5.0j,)
+ self.help_const_cc(src_data, exp_data, op)
+
+ def test_add_const_vcc_five(self):
+ src_data = (1.0+2.0j, 3.0+4.0j, 5.0+6.0j, 7.0+8.0j, 9.0+10.0j)
+ op = blocks_swig.add_const_vcc((11.0+12.0j, 13.0+14.0j, 15.0+16.0j, 17.0+18.0j, 19.0+20.0j))
+ exp_data = (12.0+14.0j, 16.0+18.0j, 20.0+22.0j, 24.0+26.0j, 28.0+30.0j)
+ self.help_const_cc(src_data, exp_data, op)
+
+ # multiply_vXX
+
+ def test_multiply_vss_one(self):
+ src1_data = (1,)
+ src2_data = (2,)
+ src3_data = (3,)
+ expected_result = (6,)
+ op = gr.multiply_vss(1)
+ self.help_ss(1, (src1_data, src2_data, src3_data), expected_result, op)
+
+ def test_multiply_vss_five(self):
+ src1_data = (1, 2, 3, 4, 5)
+ src2_data = (6, 7, 8, 9, 10)
+ src3_data = (11, 12, 13, 14, 15)
+ expected_result = (66, 168, 312, 504, 750)
+ op = gr.multiply_vss(5)
+ self.help_ss(5, (src1_data, src2_data, src3_data), expected_result, op)
+
+ def test_multiply_vii_one(self):
+ src1_data = (1,)
+ src2_data = (2,)
+ src3_data = (3,)
+ expected_result = (6,)
+ op = gr.multiply_vii(1)
+ self.help_ii(1, (src1_data, src2_data, src3_data), expected_result, op)
+
+ def test_multiply_vii_five(self):
+ src1_data = (1, 2, 3, 4, 5)
+ src2_data = (6, 7, 8, 9, 10)
+ src3_data = (11, 12, 13, 14, 15)
+ expected_result = (66, 168, 312, 504, 750)
+ op = gr.multiply_vii(5)
+ self.help_ii(5, (src1_data, src2_data, src3_data), expected_result, op)
+
+ def test_multiply_vff_one(self):
+ src1_data = (1.0,)
+ src2_data = (2.0,)
+ src3_data = (3.0,)
+ expected_result = (6.0,)
+ op = gr.multiply_vff(1)
+ self.help_ff(1, (src1_data, src2_data, src3_data), expected_result, op)
+
+ def test_multiply_vff_five(self):
+ src1_data = (1.0, 2.0, 3.0, 4.0, 5.0)
+ src2_data = (6.0, 7.0, 8.0, 9.0, 10.0)
+ src3_data = (11.0, 12.0, 13.0, 14.0, 15.0)
+ expected_result = (66.0, 168.0, 312.0, 504.0, 750.0)
+ op = gr.multiply_vff(5)
+ self.help_ff(5, (src1_data, src2_data, src3_data), expected_result, op)
+
+ def test_multiply_vcc_one(self):
+ src1_data = (1.0+2.0j,)
+ src2_data = (3.0+4.0j,)
+ src3_data = (5.0+6.0j,)
+ expected_result = (-85+20j,)
+ op = gr.multiply_vcc(1)
+ self.help_cc(1, (src1_data, src2_data, src3_data), expected_result, op)
+
+ def test_multiply_vcc_five(self):
+ src1_data = (1.0+2.0j, 3.0+4.0j, 5.0+6.0j, 7.0+8.0j, 9.0+10.0j)
+ src2_data = (11.0+12.0j, 13.0+14.0j, 15.0+16.0j, 17.0+18.0j, 19.0+20.0j)
+ src3_data = (21.0+22.0j, 23.0+24.0j, 25.0+26.0j, 27.0+28.0j, 29.0+30.0j)
+ expected_result = (-1021.0+428.0j, -2647.0+1754.0j, -4945.0+3704.0j, -8011.0+6374.0j, -11941.0+9860.0j)
+ op = gr.multiply_vcc(5)
+ self.help_cc(5, (src1_data, src2_data, src3_data), expected_result, op)
+
+ # multiply_const_vXX
+
+ def test_multiply_const_vss_one(self):
+ src_data = (2,)
+ op = gr.multiply_const_vss((3,))
+ exp_data = (6,)
+ self.help_const_ss(src_data, exp_data, op)
+
+ def test_multiply_const_vss_five(self):
+ src_data = (1, 2, 3, 4, 5)
+ op = gr.multiply_const_vss((6, 7, 8, 9, 10))
+ exp_data = (6, 14, 24, 36, 50)
+ self.help_const_ss(src_data, exp_data, op)
+
+ def test_multiply_const_vii_one(self):
+ src_data = (2,)
+ op = gr.multiply_const_vii((3,))
+ exp_data = (6,)
+ self.help_const_ii(src_data, exp_data, op)
+
+ def test_multiply_const_vii_five(self):
+ src_data = (1, 2, 3, 4, 5)
+ op = gr.multiply_const_vii((6, 7, 8, 9, 10))
+ exp_data = (6, 14, 24, 36, 50)
+ self.help_const_ii(src_data, exp_data, op)
+
+ def test_multiply_const_vff_one(self):
+ src_data = (2.0,)
+ op = gr.multiply_const_vff((3.0,))
+ exp_data = (6.0,)
+ self.help_const_ff(src_data, exp_data, op)
+
+ def test_multiply_const_vff_five(self):
+ src_data = (1.0, 2.0, 3.0, 4.0, 5.0)
+ op = gr.multiply_const_vff((6.0, 7.0, 8.0, 9.0, 10.0))
+ exp_data = (6.0, 14.0, 24.0, 36.0, 50.0)
+ self.help_const_ff(src_data, exp_data, op)
+
+ def test_multiply_const_vcc_one(self):
+ src_data = (1.0+2.0j,)
+ op = gr.multiply_const_vcc((2.0+3.0j,))
+ exp_data = (-4.0+7.0j,)
+ self.help_const_cc(src_data, exp_data, op)
+
+ def test_multiply_const_vcc_five(self):
+ src_data = (1.0+2.0j, 3.0+4.0j, 5.0+6.0j, 7.0+8.0j, 9.0+10.0j)
+ op = gr.multiply_const_vcc((11.0+12.0j, 13.0+14.0j, 15.0+16.0j, 17.0+18.0j, 19.0+20.0j))
+ exp_data = (-13.0+34.0j, -17.0+94.0j, -21.0+170.0j, -25.0+262.0j, -29.0+370.0j)
+ self.help_const_cc(src_data, exp_data, op)
+
+
+if __name__ == '__main__':
+ gr_unittest.run(test_add_mult_v, "test_add_mult_v.xml")
diff --git a/gr-blocks/python/qa_boolean_operators.py b/gr-blocks/python/qa_boolean_operators.py
new file mode 100755
index 000000000..5572f60ac
--- /dev/null
+++ b/gr-blocks/python/qa_boolean_operators.py
@@ -0,0 +1,195 @@
+#!/usr/bin/env python
+#
+# Copyright 2004,2007,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.
+#
+
+from gnuradio import gr, gr_unittest
+import blocks_swig
+
+class test_boolean_operators (gr_unittest.TestCase):
+
+ def setUp (self):
+ self.tb = gr.top_block ()
+
+ def tearDown (self):
+ self.tb = None
+
+ def help_ss (self, src_data, exp_data, op):
+ for s in zip (range (len (src_data)), src_data):
+ src = gr.vector_source_s (s[1])
+ self.tb.connect (src, (op, s[0]))
+ dst = gr.vector_sink_s ()
+ self.tb.connect (op, dst)
+ self.tb.run ()
+ result_data = dst.data ()
+ self.assertEqual (exp_data, result_data)
+
+ def help_bb (self, src_data, exp_data, op):
+ for s in zip (range (len (src_data)), src_data):
+ src = gr.vector_source_b (s[1])
+ self.tb.connect (src, (op, s[0]))
+ dst = gr.vector_sink_b ()
+ self.tb.connect (op, dst)
+ self.tb.run ()
+ result_data = dst.data ()
+ self.assertEqual (exp_data, result_data)
+
+ def help_ii (self, src_data, exp_data, op):
+ for s in zip (range (len (src_data)), src_data):
+ src = gr.vector_source_i (s[1])
+ self.tb.connect (src, (op, s[0]))
+ dst = gr.vector_sink_i ()
+ self.tb.connect (op, dst)
+ self.tb.run ()
+ result_data = dst.data ()
+ self.assertEqual (exp_data, result_data)
+
+ def test_xor_ss (self):
+ src1_data = (1, 2, 3, 0x5004, 0x1150)
+ src2_data = (8, 2, 1 , 0x0508, 0x1105)
+ expected_result = (9, 0, 2, 0x550C, 0x0055)
+ op = blocks_swig.xor_ss ()
+ self.help_ss ((src1_data, src2_data),
+ expected_result, op)
+
+ def test_xor_bb (self):
+ src1_data = (1, 2, 3, 4, 0x50)
+ src2_data = (8, 2, 1 , 8, 0x05)
+ expected_result = (9, 0, 2, 0xC, 0x55)
+ op = blocks_swig.xor_bb ()
+ self.help_bb ((src1_data, src2_data),
+ expected_result, op)
+
+
+ def test_xor_ii (self):
+ src1_data = (1, 2, 3, 0x5000004, 0x11000050)
+ src2_data = (8, 2, 1 , 0x0500008, 0x11000005)
+ expected_result = (9, 0, 2, 0x550000C, 0x00000055)
+ op = blocks_swig.xor_ii ()
+ self.help_ii ((src1_data, src2_data),
+ expected_result, op)
+
+
+ def test_and_ss (self):
+ src1_data = (1, 2, 3, 0x5004, 0x1150)
+ src2_data = (8, 2, 1 , 0x0508, 0x1105)
+ expected_result = (0, 2, 1, 0x0000, 0x1100)
+ op = blocks_swig.and_ss ()
+ self.help_ss ((src1_data, src2_data),
+ expected_result, op)
+
+ def test_and_bb (self):
+ src1_data = (1, 2, 2, 3, 0x04, 0x50)
+ src2_data = (8, 2, 2, 1, 0x08, 0x05)
+ src3_data = (8, 2, 1, 1, 0x08, 0x05)
+ expected_result = (0, 2, 0, 1, 0x00, 0x00)
+ op = blocks_swig.and_bb ()
+ self.help_bb ((src1_data, src2_data, src3_data),
+ expected_result, op)
+
+ def test_and_ii (self):
+ src1_data = (1, 2, 3, 0x50005004, 0x11001150)
+ src2_data = (8, 2, 1 , 0x05000508, 0x11001105)
+ expected_result = (0, 2, 1, 0x00000000, 0x11001100)
+ op = blocks_swig.and_ii ()
+ self.help_ii ((src1_data, src2_data),
+ expected_result, op)
+
+ def test_and_const_ss (self):
+ src_data = (1, 2, 3, 0x5004, 0x1150)
+ expected_result = (0, 2, 2, 0x5000, 0x1100)
+ src = gr.vector_source_s(src_data)
+ op = blocks_swig.and_const_ss (0x55AA)
+ dst = gr.vector_sink_s()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ self.assertEqual(dst.data(), expected_result)
+
+ def test_and_const_bb (self):
+ src_data = (1, 2, 3, 0x50, 0x11)
+ expected_result = (0, 2, 2, 0x00, 0x00)
+ src = gr.vector_source_b(src_data)
+ op = blocks_swig.and_const_bb (0xAA)
+ dst = gr.vector_sink_b()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ self.assertEqual(dst.data(), expected_result)
+
+
+ def test_and_const_ii (self):
+ src_data = (1, 2, 3, 0x5004, 0x1150)
+ expected_result = (0, 2, 2, 0x5000, 0x1100)
+ src = gr.vector_source_i(src_data)
+ op = blocks_swig.and_const_ii (0x55AA)
+ dst = gr.vector_sink_i()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ self.assertEqual(dst.data(), expected_result)
+
+
+ def test_or_ss (self):
+ src1_data = (1, 2, 3, 0x5004, 0x1150)
+ src2_data = (8, 2, 1 , 0x0508, 0x1105)
+ expected_result = (9, 2, 3, 0x550C, 0x1155)
+ op = blocks_swig.or_ss ()
+ self.help_ss ((src1_data, src2_data),
+ expected_result, op)
+
+ def test_or_bb (self):
+ src1_data = (1, 2, 2, 3, 0x04, 0x50)
+ src2_data = (8, 2, 2, 1 , 0x08, 0x05)
+ src3_data = (8, 2, 1, 1 , 0x08, 0x05)
+ expected_result = (9, 2, 3, 3, 0x0C, 0x55)
+ op = blocks_swig.or_bb ()
+ self.help_bb ((src1_data, src2_data, src3_data),
+ expected_result, op)
+
+ def test_or_ii (self):
+ src1_data = (1, 2, 3, 0x50005004, 0x11001150)
+ src2_data = (8, 2, 1 , 0x05000508, 0x11001105)
+ expected_result = (9, 2, 3, 0x5500550C, 0x11001155)
+ op = blocks_swig.or_ii ()
+ self.help_ii ((src1_data, src2_data),
+ expected_result, op)
+
+ def test_not_ss (self):
+ src1_data = (1, 2, 3, 0x5004, 0x1150)
+ expected_result = (~1, ~2, ~3, ~0x5004, ~0x1150)
+ op = blocks_swig.not_ss ()
+ self.help_ss ((((src1_data),)),
+ expected_result, op)
+
+ def test_not_bb (self):
+ src1_data = (1, 2, 2, 3, 0x04, 0x50)
+ expected_result = (0xFE, 0xFD, 0xFD, 0xFC, 0xFB, 0xAF)
+ op = blocks_swig.not_bb ()
+ self.help_bb (((src1_data), ),
+ expected_result, op)
+
+ def test_not_ii (self):
+ src1_data = (1, 2, 3, 0x50005004, 0x11001150)
+ expected_result = (~1 , ~2, ~3, ~0x50005004, ~0x11001150)
+ op = blocks_swig.not_ii ()
+ self.help_ii (((src1_data),),
+ expected_result, op)
+
+
+if __name__ == '__main__':
+ gr_unittest.run(test_boolean_operators, "test_boolean_operators.xml")
diff --git a/gr-blocks/python/qa_conjugate.py b/gr-blocks/python/qa_conjugate.py
new file mode 100644
index 000000000..1808aa9c0
--- /dev/null
+++ b/gr-blocks/python/qa_conjugate.py
@@ -0,0 +1,54 @@
+#!/usr/bin/env python
+#
+# 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.
+#
+
+from gnuradio import gr, gr_unittest
+import blocks_swig
+
+class test_conjugate (gr_unittest.TestCase):
+
+ def setUp (self):
+ self.tb = gr.top_block ()
+
+ def tearDown (self):
+ self.tb = None
+
+ def test_000 (self):
+ src_data = (-2-2j, -1-1j, -2+2j, -1+1j,
+ 2-2j, 1-1j, 2+2j, 1+1j,
+ 0+0j)
+
+ exp_data = (-2+2j, -1+1j, -2-2j, -1-1j,
+ 2+2j, 1+1j, 2-2j, 1-1j,
+ 0-0j)
+
+ src = gr.vector_source_c(src_data)
+ op = blocks_swig.conjugate_cc ()
+ dst = gr.vector_sink_c ()
+
+ self.tb.connect(src, op)
+ self.tb.connect(op, dst)
+ self.tb.run()
+ result_data = dst.data ()
+ self.assertEqual (exp_data, result_data)
+
+if __name__ == '__main__':
+ gr_unittest.run(test_conjugate, "test_conjugate.xml")
diff --git a/gr-blocks/python/qa_delay.py b/gr-blocks/python/qa_delay.py
new file mode 100755
index 000000000..031cadb2d
--- /dev/null
+++ b/gr-blocks/python/qa_delay.py
@@ -0,0 +1,65 @@
+#!/usr/bin/env python
+#
+# Copyright 2004,2007,2010,2013 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 gnuradio import gr, gr_unittest
+import blocks_swig as blocks
+
+class test_delay(gr_unittest.TestCase):
+
+ def setUp(self):
+ self.tb = gr.top_block()
+
+ def tearDown(self):
+ self.tb = None
+
+ def test_000(self):
+ delta_t = 0
+ tb = self.tb
+ src_data = [float(x) for x in range(0, 100)]
+ expected_result = tuple(delta_t*[0.0] + src_data)
+
+ src = gr.vector_source_f(src_data)
+ op = blocks.delay(gr.sizeof_float, delta_t)
+ dst = gr.vector_sink_f()
+
+ tb.connect(src, op, dst)
+ tb.run()
+ dst_data = dst.data()
+ self.assertEqual(expected_result, dst_data)
+
+ def test_010(self):
+ delta_t = 10
+ tb = self.tb
+ src_data = [float(x) for x in range(0, 100)]
+ expected_result = tuple(delta_t*[0.0] + src_data)
+
+ src = gr.vector_source_f(src_data)
+ op = blocks.delay(gr.sizeof_float, delta_t)
+ dst = gr.vector_sink_f()
+
+ tb.connect(src, op, dst)
+ tb.run()
+ dst_data = dst.data()
+ self.assertEqual(expected_result, dst_data)
+
+if __name__ == '__main__':
+ gr_unittest.run(test_delay, "test_delay.xml")
diff --git a/gr-blocks/python/qa_file_metadata.py b/gr-blocks/python/qa_file_metadata.py
new file mode 100644
index 000000000..c7826b1d3
--- /dev/null
+++ b/gr-blocks/python/qa_file_metadata.py
@@ -0,0 +1,202 @@
+#!/usr/bin/env python
+#
+# 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.
+#
+
+from gnuradio import gr, gr_unittest
+import parse_file_metadata
+import blocks_swig as blocks
+import pmt
+import os, math
+
+def sig_source_c(samp_rate, freq, amp, N):
+ t = map(lambda x: float(x)/samp_rate, xrange(N))
+ y = map(lambda x: amp*math.cos(2.*math.pi*freq*x) + \
+ 1j*amp*math.sin(2.*math.pi*freq*x), t)
+ return y
+
+class test_file_metadata(gr_unittest.TestCase):
+
+ def setUp(self):
+ self.tb = gr.top_block()
+
+ def tearDown(self):
+ self.tb = None
+
+ def test_001(self):
+ N = 1000
+ outfile = "test_out.dat"
+
+ detached = False
+ samp_rate = 200000
+ key = pmt.pmt_intern("samp_rate")
+ val = pmt.pmt_from_double(samp_rate)
+ extras = pmt.pmt_make_dict()
+ extras = pmt.pmt_dict_add(extras, key, val)
+ extras_str = pmt.pmt_serialize_str(extras)
+
+ data = sig_source_c(samp_rate, 1000, 1, N)
+ src = gr.vector_source_c(data)
+ fsnk = blocks.file_meta_sink(gr.sizeof_gr_complex, outfile,
+ samp_rate, 1,
+ blocks.GR_FILE_FLOAT, True,
+ 1000000, extras_str, detached)
+ fsnk.set_unbuffered(True)
+
+ self.tb.connect(src, fsnk)
+ self.tb.run()
+ fsnk.close()
+
+ handle = open(outfile, "rb")
+ header_str = handle.read(parse_file_metadata.HEADER_LENGTH)
+ if(len(header_str) == 0):
+ self.assertFalse()
+
+ try:
+ header = pmt.pmt_deserialize_str(header_str)
+ except RuntimeError:
+ self.assertFalse()
+
+ print header
+ info = parse_file_metadata.parse_header(header, False)
+
+ extra_str = handle.read(info["extra_len"])
+ self.assertGreater(len(extra_str), 0)
+ handle.close()
+
+ try:
+ extra = pmt.pmt_deserialize_str(extra_str)
+ except RuntimeError:
+ self.assertFalse()
+
+ extra_info = parse_file_metadata.parse_extra_dict(extra, info, False)
+
+ self.assertEqual(info['rx_rate'], samp_rate)
+ self.assertEqual(pmt.pmt_to_double(extra_info['samp_rate']), samp_rate)
+
+
+ # Test file metadata source
+ src.rewind()
+ fsrc = blocks.file_meta_source(outfile, False)
+ vsnk = gr.vector_sink_c()
+ tsnk = gr.tag_debug(gr.sizeof_gr_complex, "QA")
+ ssnk = gr.vector_sink_c()
+ self.tb.disconnect(src, fsnk)
+ self.tb.connect(fsrc, vsnk)
+ self.tb.connect(fsrc, tsnk)
+ self.tb.connect(src, ssnk)
+ self.tb.run()
+
+ # Test to make sure tags with 'samp_rate' and 'rx_rate' keys
+ # were generated and received correctly.
+ tags = tsnk.current_tags()
+ for t in tags:
+ if(pmt.pmt_eq(t.key, pmt.pmt_intern("samp_rate"))):
+ self.assertEqual(pmt.pmt_to_double(t.value), samp_rate)
+ elif(pmt.pmt_eq(t.key, pmt.pmt_intern("rx_rate"))):
+ self.assertEqual(pmt.pmt_to_double(t.value), samp_rate)
+
+ # Test that the data portion was extracted and received correctly.
+ self.assertComplexTuplesAlmostEqual(vsnk.data(), ssnk.data(), 5)
+
+ os.remove(outfile)
+
+ def test_002(self):
+ N = 1000
+ outfile = "test_out.dat"
+ outfile_hdr = "test_out.dat.hdr"
+
+ detached = True
+ samp_rate = 200000
+ key = pmt.pmt_intern("samp_rate")
+ val = pmt.pmt_from_double(samp_rate)
+ extras = pmt.pmt_make_dict()
+ extras = pmt.pmt_dict_add(extras, key, val)
+ extras_str = pmt.pmt_serialize_str(extras)
+
+ data = sig_source_c(samp_rate, 1000, 1, N)
+ src = gr.vector_source_c(data)
+ fsnk = blocks.file_meta_sink(gr.sizeof_gr_complex, outfile,
+ samp_rate, 1,
+ blocks.GR_FILE_FLOAT, True,
+ 1000000, extras_str, detached)
+ fsnk.set_unbuffered(True)
+
+ self.tb.connect(src, fsnk)
+ self.tb.run()
+ fsnk.close()
+
+ # Open detached header for reading
+ handle = open(outfile_hdr, "rb")
+ header_str = handle.read(parse_file_metadata.HEADER_LENGTH)
+ if(len(header_str) == 0):
+ self.assertFalse()
+
+ try:
+ header = pmt.pmt_deserialize_str(header_str)
+ except RuntimeError:
+ self.assertFalse()
+
+ info = parse_file_metadata.parse_header(header, False)
+
+ extra_str = handle.read(info["extra_len"])
+ self.assertGreater(len(extra_str), 0)
+ handle.close()
+
+ try:
+ extra = pmt.pmt_deserialize_str(extra_str)
+ except RuntimeError:
+ self.assertFalse()
+
+ extra_info = parse_file_metadata.parse_extra_dict(extra, info, False)
+
+ self.assertEqual(info['rx_rate'], samp_rate)
+ self.assertEqual(pmt.pmt_to_double(extra_info['samp_rate']), samp_rate)
+
+
+ # Test file metadata source
+ src.rewind()
+ fsrc = blocks.file_meta_source(outfile, False, detached, outfile_hdr)
+ vsnk = gr.vector_sink_c()
+ tsnk = gr.tag_debug(gr.sizeof_gr_complex, "QA")
+ ssnk = gr.vector_sink_c()
+ self.tb.disconnect(src, fsnk)
+ self.tb.connect(fsrc, vsnk)
+ self.tb.connect(fsrc, tsnk)
+ self.tb.connect(src, ssnk)
+ self.tb.run()
+
+ # Test to make sure tags with 'samp_rate' and 'rx_rate' keys
+ # were generated and received correctly.
+ tags = tsnk.current_tags()
+ for t in tags:
+ if(pmt.pmt_eq(t.key, pmt.pmt_intern("samp_rate"))):
+ self.assertEqual(pmt.pmt_to_double(t.value), samp_rate)
+ elif(pmt.pmt_eq(t.key, pmt.pmt_intern("rx_rate"))):
+ self.assertEqual(pmt.pmt_to_double(t.value), samp_rate)
+
+ # Test that the data portion was extracted and received correctly.
+ self.assertComplexTuplesAlmostEqual(vsnk.data(), ssnk.data(), 5)
+
+ os.remove(outfile)
+ os.remove(outfile_hdr)
+
+if __name__ == '__main__':
+ gr_unittest.run(test_file_metadata, "test_file_metadata.xml")
diff --git a/gr-blocks/python/qa_integrate.py b/gr-blocks/python/qa_integrate.py
new file mode 100755
index 000000000..c404f1b30
--- /dev/null
+++ b/gr-blocks/python/qa_integrate.py
@@ -0,0 +1,76 @@
+#!/usr/bin/env python
+#
+# 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.
+#
+
+from gnuradio import gr, gr_unittest
+import blocks_swig
+import math
+
+class test_integrate (gr_unittest.TestCase):
+
+ def setUp (self):
+ self.tb = gr.top_block ()
+
+ def tearDown (self):
+ self.tb = None
+
+ def test_000_ss(self):
+ src_data = (1, 2, 3, 4, 5, 6)
+ dst_data = (6, 15)
+ src = gr.vector_source_s(src_data)
+ itg = blocks_swig.integrate_ss(3)
+ dst = gr.vector_sink_s()
+ self.tb.connect(src, itg, dst)
+ self.tb.run()
+ self.assertEqual(dst_data, dst.data())
+
+ def test_001_ii(self):
+ src_data = (1, 2, 3, 4, 5, 6)
+ dst_data = (6, 15)
+ src = gr.vector_source_i(src_data)
+ itg = blocks_swig.integrate_ii(3)
+ dst = gr.vector_sink_i()
+ self.tb.connect(src, itg, dst)
+ self.tb.run()
+ self.assertEqual(dst_data, dst.data())
+
+ def test_002_ff(self):
+ src_data = [1.0, 2.0, 3.0, 4.0, 5.0, 6.0]
+ dst_data = [6.0, 15.0]
+ src = gr.vector_source_f(src_data)
+ itg = blocks_swig.integrate_ff(3)
+ dst = gr.vector_sink_f()
+ self.tb.connect(src, itg, dst)
+ self.tb.run()
+ self.assertFloatTuplesAlmostEqual(dst_data, dst.data(), 6)
+
+ def test_003_cc(self):
+ src_data = [1.0+1.0j, 2.0+2.0j, 3.0+3.0j, 4.0+4.0j, 5.0+5.0j, 6.0+6.0j]
+ dst_data = [6.0+6.0j, 15.0+15.0j]
+ src = gr.vector_source_c(src_data)
+ itg = blocks_swig.integrate_cc(3)
+ dst = gr.vector_sink_c()
+ self.tb.connect(src, itg, dst)
+ self.tb.run()
+ self.assertComplexTuplesAlmostEqual(dst_data, dst.data(), 6)
+
+if __name__ == '__main__':
+ gr_unittest.run(test_integrate, "test_integrate.xml")
diff --git a/gr-blocks/python/qa_interleave.py b/gr-blocks/python/qa_interleave.py
new file mode 100755
index 000000000..376d487b1
--- /dev/null
+++ b/gr-blocks/python/qa_interleave.py
@@ -0,0 +1,82 @@
+#!/usr/bin/env python
+#
+# Copyright 2004,2007,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.
+#
+
+from gnuradio import gr, gr_unittest
+import blocks_swig
+import math
+
+class test_interleave (gr_unittest.TestCase):
+
+ def setUp (self):
+ self.tb = gr.top_block ()
+
+ def tearDown (self):
+ self.tb = None
+
+ def test_int_001 (self):
+ lenx = 64
+ src0 = gr.vector_source_f (range (0, lenx, 4))
+ src1 = gr.vector_source_f (range (1, lenx, 4))
+ src2 = gr.vector_source_f (range (2, lenx, 4))
+ src3 = gr.vector_source_f (range (3, lenx, 4))
+ op = blocks_swig.interleave (gr.sizeof_float)
+ dst = gr.vector_sink_f ()
+
+ self.tb.connect (src0, (op, 0))
+ self.tb.connect (src1, (op, 1))
+ self.tb.connect (src2, (op, 2))
+ self.tb.connect (src3, (op, 3))
+ self.tb.connect (op, dst)
+ self.tb.run ()
+ expected_result = tuple (range (lenx))
+ result_data = dst.data ()
+ self.assertFloatTuplesAlmostEqual (expected_result, result_data)
+
+ def test_deint_001 (self):
+ lenx = 64
+ src = gr.vector_source_f (range (lenx))
+ op = blocks_swig.deinterleave (gr.sizeof_float)
+ dst0 = gr.vector_sink_f ()
+ dst1 = gr.vector_sink_f ()
+ dst2 = gr.vector_sink_f ()
+ dst3 = gr.vector_sink_f ()
+
+ self.tb.connect (src, op)
+ self.tb.connect ((op, 0), dst0)
+ self.tb.connect ((op, 1), dst1)
+ self.tb.connect ((op, 2), dst2)
+ self.tb.connect ((op, 3), dst3)
+ self.tb.run ()
+
+ expected_result0 = tuple (range (0, lenx, 4))
+ expected_result1 = tuple (range (1, lenx, 4))
+ expected_result2 = tuple (range (2, lenx, 4))
+ expected_result3 = tuple (range (3, lenx, 4))
+
+ self.assertFloatTuplesAlmostEqual (expected_result0, dst0.data ())
+ self.assertFloatTuplesAlmostEqual (expected_result1, dst1.data ())
+ self.assertFloatTuplesAlmostEqual (expected_result2, dst2.data ())
+ self.assertFloatTuplesAlmostEqual (expected_result3, dst3.data ())
+
+if __name__ == '__main__':
+ gr_unittest.run(test_interleave, "test_interleave.xml")
+
diff --git a/gr-blocks/python/qa_keep_m_in_n.py b/gr-blocks/python/qa_keep_m_in_n.py
new file mode 100755
index 000000000..0898217ba
--- /dev/null
+++ b/gr-blocks/python/qa_keep_m_in_n.py
@@ -0,0 +1,59 @@
+#!/usr/bin/env python
+#
+# Copyright 2008,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 this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+
+from gnuradio import gr, gr_unittest
+import blocks_swig
+import sys
+import random
+
+class test_keep_m_in_n(gr_unittest.TestCase):
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def test_001(self):
+ self.maxDiff = None;
+ tb = gr.top_block()
+ src = gr.vector_source_b( range(0,100) )
+
+ # itemsize, M, N, offset
+ km2 = blocks_swig.keep_m_in_n( 1, 1, 2, 0 );
+ km3 = blocks_swig.keep_m_in_n( 1, 1, 3, 1 );
+ km7 = blocks_swig.keep_m_in_n( 1, 1, 7, 2 );
+ snk2 = gr.vector_sink_b();
+ snk3 = gr.vector_sink_b();
+ snk7 = gr.vector_sink_b();
+ tb.connect(src,km2,snk2);
+ tb.connect(src,km3,snk3);
+ tb.connect(src,km7,snk7);
+ tb.run();
+
+ self.assertEqual(range(0,100,2), list(snk2.data()));
+ self.assertEqual(range(1,100,3), list(snk3.data()));
+ self.assertEqual(range(2,100,7), list(snk7.data()));
+
+
+if __name__ == '__main__':
+ gr_unittest.run(test_keep_m_in_n, "test_keep_m_in_n.xml")
+
diff --git a/gr-blocks/python/qa_keep_one_in_n.py b/gr-blocks/python/qa_keep_one_in_n.py
new file mode 100755
index 000000000..8c5f44b84
--- /dev/null
+++ b/gr-blocks/python/qa_keep_one_in_n.py
@@ -0,0 +1,46 @@
+#!/usr/bin/env python
+#
+# 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.
+#
+
+from gnuradio import gr, gr_unittest
+import blocks_swig
+
+class test_keep_one_in_n(gr_unittest.TestCase):
+
+ def setUp (self):
+ self.tb = gr.top_block ()
+
+ def tearDown (self):
+ self.tb = None
+
+ def test_001(self):
+ src_data = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
+ expected_data = (5, 10)
+ src = gr.vector_source_b(src_data);
+ op = blocks_swig.keep_one_in_n(gr.sizeof_char, 5)
+ dst = gr.vector_sink_b()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ self.assertEqual(dst.data(), expected_data)
+
+
+if __name__ == '__main__':
+ gr_unittest.run(test_keep_one_in_n, "test_integrate.xml")
diff --git a/gr-blocks/python/qa_multiply_conjugate.py b/gr-blocks/python/qa_multiply_conjugate.py
new file mode 100644
index 000000000..f51563f85
--- /dev/null
+++ b/gr-blocks/python/qa_multiply_conjugate.py
@@ -0,0 +1,58 @@
+#!/usr/bin/env python
+#
+# 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.
+#
+
+from gnuradio import gr, gr_unittest
+import blocks_swig
+
+class test_multiply_conjugate (gr_unittest.TestCase):
+
+ def setUp (self):
+ self.tb = gr.top_block ()
+
+ def tearDown (self):
+ self.tb = None
+
+ def test_000 (self):
+ src_data0 = (-2-2j, -1-1j, -2+2j, -1+1j,
+ 2-2j, 1-1j, 2+2j, 1+1j,
+ 0+0j)
+ src_data1 = (-3-3j, -4-4j, -3+3j, -4+4j,
+ 3-3j, 4-4j, 3+3j, 4+4j,
+ 0+0j)
+
+ exp_data = (12+0j, 8+0j, 12+0j, 8+0j,
+ 12+0j, 8+0j, 12+0j, 8+0j,
+ 0+0j)
+ src0 = gr.vector_source_c(src_data0)
+ src1 = gr.vector_source_c(src_data1)
+ op = blocks_swig.multiply_conjugate_cc ()
+ dst = gr.vector_sink_c ()
+
+ self.tb.connect(src0, (op,0))
+ self.tb.connect(src1, (op,1))
+ self.tb.connect(op, dst)
+ self.tb.run()
+ result_data = dst.data ()
+ self.assertEqual (exp_data, result_data)
+
+if __name__ == '__main__':
+ gr_unittest.run(test_multiply_conjugate, "test_multiply_conjugate.xml")
diff --git a/gr-blocks/python/qa_nlog10.py b/gr-blocks/python/qa_nlog10.py
new file mode 100755
index 000000000..cc2a3e8cc
--- /dev/null
+++ b/gr-blocks/python/qa_nlog10.py
@@ -0,0 +1,48 @@
+#!/usr/bin/env python
+#
+# Copyright 2005,2007,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.
+#
+
+from gnuradio import gr, gr_unittest
+import blocks_swig
+
+class test_nlog10(gr_unittest.TestCase):
+
+ def setUp (self):
+ self.tb = gr.top_block ()
+
+ def tearDown (self):
+ self.tb = None
+
+ def test_001(self):
+ src_data = (-10, 0, 10, 100, 1000, 10000, 100000)
+ expected_result = (-180, -180, 10, 20, 30, 40, 50)
+ src = gr.vector_source_f(src_data)
+ op = blocks_swig.nlog10_ff(10)
+ dst = gr.vector_sink_f()
+ self.tb.connect (src, op, dst)
+ self.tb.run()
+ result_data = dst.data()
+ self.assertFloatTuplesAlmostEqual (expected_result, result_data)
+
+
+if __name__ == '__main__':
+ gr_unittest.run(test_nlog10, "test_nlog10.xml")
+
diff --git a/gr-blocks/python/qa_packed_to_unpacked.py b/gr-blocks/python/qa_packed_to_unpacked.py
new file mode 100755
index 000000000..d84f5dbd3
--- /dev/null
+++ b/gr-blocks/python/qa_packed_to_unpacked.py
@@ -0,0 +1,344 @@
+#!/usr/bin/env python
+#
+# Copyright 2005,2007,2010,2013 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 gnuradio import gr, gr_unittest
+import blocks_swig as blocks
+import random
+
+class test_packing(gr_unittest.TestCase):
+
+ def setUp(self):
+ self.tb = gr.top_block ()
+
+ def tearDown(self):
+ self.tb = None
+
+ def test_001(self):
+ src_data = (0x80,)
+ expected_results = (1,0,0,0,0,0,0,0)
+ src = gr.vector_source_b(src_data, False)
+ op = blocks.packed_to_unpacked_bb(1, gr.GR_MSB_FIRST)
+ dst = gr.vector_sink_b()
+
+ self.tb.connect(src, op)
+ self.tb.connect(op, dst)
+ self.tb.run()
+
+ self.assertEqual(expected_results, dst.data())
+
+ def test_002(self):
+ src_data = (0x80,)
+ expected_results = (0,0,0,0,0,0,0,1)
+ src = gr.vector_source_b(src_data, False)
+ op = blocks.packed_to_unpacked_bb(1, gr.GR_LSB_FIRST)
+ dst = gr.vector_sink_b()
+
+ self.tb.connect(src, op)
+ self.tb.connect(op, dst)
+ self.tb.run()
+
+ self.assertEqual(expected_results, dst.data())
+
+ def test_003(self):
+ src_data = (0x11,)
+ expected_results = (4, 2)
+ src = gr.vector_source_b(src_data, False)
+ op = blocks.packed_to_unpacked_bb(3, gr.GR_LSB_FIRST)
+ dst = gr.vector_sink_b()
+
+ self.tb.connect(src, op)
+ self.tb.connect(op, dst)
+ self.tb.run()
+
+ self.assertEqual(expected_results, dst.data())
+
+ def test_004(self):
+ src_data = (0x11,)
+ expected_results = (0, 4)
+ src = gr.vector_source_b(src_data, False)
+ op = blocks.packed_to_unpacked_bb(3, gr.GR_MSB_FIRST)
+ dst = gr.vector_sink_b()
+
+ self.tb.connect(src, op)
+ self.tb.connect(op, dst)
+ self.tb.run()
+
+ self.assertEqual(expected_results, dst.data())
+
+ def test_005(self):
+ src_data = (1,0,0,0,0,0,1,0,0,1,0,1,1,0,1,0)
+ expected_results = (0x82, 0x5a)
+ src = gr.vector_source_b(src_data, False)
+ op = blocks.unpacked_to_packed_bb(1, gr.GR_MSB_FIRST)
+ dst = gr.vector_sink_b()
+
+ self.tb.connect(src, op)
+ self.tb.connect(op, dst)
+ self.tb.run()
+
+ self.assertEqual(expected_results, dst.data())
+
+ def test_006(self):
+ src_data = (0,1,0,0,0,0,0,1,0,1,0,1,1,0,1,0)
+ expected_results = (0x82, 0x5a)
+ src = gr.vector_source_b(src_data, False)
+ op = blocks.unpacked_to_packed_bb(1, gr.GR_LSB_FIRST)
+ dst = gr.vector_sink_b()
+
+ self.tb.connect(src, op)
+ self.tb.connect(op, dst)
+ self.tb.run()
+
+ self.assertEqual(expected_results, dst.data())
+
+ def test_007(self):
+ src_data = (4, 2, 0,0,0)
+ expected_results = (0x11,)
+ src = gr.vector_source_b(src_data, False)
+ op = blocks.unpacked_to_packed_bb(3, gr.GR_LSB_FIRST)
+ dst = gr.vector_sink_b()
+
+ self.tb.connect(src, op)
+ self.tb.connect(op, dst)
+ self.tb.run()
+
+ self.assertEqual(expected_results, dst.data())
+
+ def test_008(self):
+ src_data = (0, 4, 2,0,0)
+ expected_results = (0x11,)
+ src = gr.vector_source_b(src_data,False)
+ op = blocks.unpacked_to_packed_bb(3, gr.GR_MSB_FIRST)
+ dst = gr.vector_sink_b()
+
+ self.tb.connect(src, op)
+ self.tb.connect(op, dst)
+ self.tb.run()
+
+ self.assertEqual(expected_results, dst.data())
+
+ def test_009(self):
+ random.seed(0)
+ src_data = []
+ for i in xrange(202):
+ src_data.append((random.randint(0,255)))
+ src_data = tuple(src_data)
+ expected_results = src_data
+
+ src = gr.vector_source_b(tuple(src_data), False)
+ op1 = blocks.packed_to_unpacked_bb(3, gr.GR_MSB_FIRST)
+ op2 = blocks.unpacked_to_packed_bb(3, gr.GR_MSB_FIRST)
+ dst = gr.vector_sink_b()
+
+ self.tb.connect(src, op1, op2)
+ self.tb.connect(op2, dst)
+ self.tb.run()
+
+ self.assertEqual(expected_results[0:201], dst.data())
+
+ def test_010(self):
+ random.seed(0)
+ src_data = []
+ for i in xrange(56):
+ src_data.append((random.randint(0,255)))
+ src_data = tuple(src_data)
+ expected_results = src_data
+ src = gr.vector_source_b(tuple(src_data), False)
+ op1 = blocks.packed_to_unpacked_bb(7, gr.GR_MSB_FIRST)
+ op2 = blocks.unpacked_to_packed_bb(7, gr.GR_MSB_FIRST)
+ dst = gr.vector_sink_b()
+
+ self.tb.connect(src, op1, op2)
+ self.tb.connect(op2, dst)
+ self.tb.run()
+
+ self.assertEqual(expected_results[0:201], dst.data())
+
+ def test_011(self):
+ random.seed(0)
+ src_data = []
+ for i in xrange(56):
+ src_data.append((random.randint(0,255)))
+ src_data = tuple(src_data)
+ expected_results = src_data
+ src = gr.vector_source_b(tuple(src_data),False)
+ op1 = blocks.packed_to_unpacked_bb(7, gr.GR_LSB_FIRST)
+ op2 = blocks.unpacked_to_packed_bb(7, gr.GR_LSB_FIRST)
+ dst = gr.vector_sink_b()
+
+ self.tb.connect(src, op1, op2)
+ self.tb.connect(op2, dst)
+ self.tb.run()
+
+ self.assertEqual(expected_results[0:201], dst.data())
+
+
+ # tests on shorts
+ def test_100a(self):
+ random.seed(0)
+ src_data = []
+ for i in xrange(100):
+ src_data.append((random.randint(-2**15,2**15-1)))
+ src_data = tuple(src_data)
+ expected_results = src_data
+ src = gr.vector_source_s(tuple(src_data), False)
+ op1 = blocks.packed_to_unpacked_ss(1, gr.GR_MSB_FIRST)
+ op2 = blocks.unpacked_to_packed_ss(1, gr.GR_MSB_FIRST)
+ dst = gr.vector_sink_s()
+
+ self.tb.connect(src, op1, op2)
+ self.tb.connect(op2, dst)
+ self.tb.run()
+
+ self.assertEqual(expected_results, dst.data())
+
+ def test_100b(self):
+ random.seed(0)
+ src_data = []
+ for i in xrange(100):
+ src_data.append((random.randint(-2**15,2**15-1)))
+ src_data = tuple(src_data)
+ expected_results = src_data
+ src = gr.vector_source_s(tuple(src_data), False)
+ op1 = blocks.packed_to_unpacked_ss(1, gr.GR_LSB_FIRST)
+ op2 = blocks.unpacked_to_packed_ss(1, gr.GR_LSB_FIRST)
+ dst = gr.vector_sink_s()
+
+ self.tb.connect(src, op1, op2)
+ self.tb.connect(op2, dst)
+ self.tb.run()
+
+ self.assertEqual(expected_results, dst.data())
+
+ def test_101a(self):
+ random.seed(0)
+ src_data = []
+ for i in xrange(100):
+ src_data.append((random.randint(-2**15,2**15-1)))
+ src_data = tuple(src_data)
+ expected_results = src_data
+ src = gr.vector_source_s(tuple(src_data), False)
+ op1 = blocks.packed_to_unpacked_ss(8, gr.GR_MSB_FIRST)
+ op2 = blocks.unpacked_to_packed_ss(8, gr.GR_MSB_FIRST)
+ dst = gr.vector_sink_s()
+
+ self.tb.connect(src, op1, op2)
+ self.tb.connect(op2, dst)
+ self.tb.run()
+
+ self.assertEqual(expected_results, dst.data())
+
+ def test_101b(self):
+ random.seed(0)
+ src_data = []
+ for i in xrange(100):
+ src_data.append((random.randint(-2**15,2**15-1)))
+ src_data = tuple(src_data)
+ expected_results = src_data
+ src = gr.vector_source_s(tuple(src_data), False)
+ op1 = blocks.packed_to_unpacked_ss(8, gr.GR_LSB_FIRST)
+ op2 = blocks.unpacked_to_packed_ss(8, gr.GR_LSB_FIRST)
+ dst = gr.vector_sink_s()
+
+ self.tb.connect(src, op1, op2)
+ self.tb.connect(op2, dst)
+ self.tb.run()
+
+ self.assertEqual(expected_results, dst.data())
+
+
+ # tests on ints
+ def test_200a(self):
+ random.seed(0)
+ src_data = []
+ for i in xrange(100):
+ src_data.append((random.randint(-2**31,2**31-1)))
+ src_data = tuple(src_data)
+ expected_results = src_data
+ src = gr.vector_source_i(tuple(src_data), False)
+ op1 = blocks.packed_to_unpacked_ii(1, gr.GR_MSB_FIRST)
+ op2 = blocks.unpacked_to_packed_ii(1, gr.GR_MSB_FIRST)
+ dst = gr.vector_sink_i()
+
+ self.tb.connect(src, op1, op2)
+ self.tb.connect(op2, dst)
+ self.tb.run()
+
+ self.assertEqual(expected_results, dst.data())
+
+ def test_200b(self):
+ random.seed(0)
+ src_data = []
+ for i in xrange(100):
+ src_data.append((random.randint(-2**31,2**31-1)))
+ src_data = tuple(src_data)
+ expected_results = src_data
+ src = gr.vector_source_i(tuple(src_data), False)
+ op1 = blocks.packed_to_unpacked_ii(1, gr.GR_LSB_FIRST)
+ op2 = blocks.unpacked_to_packed_ii(1, gr.GR_LSB_FIRST)
+ dst = gr.vector_sink_i()
+
+ self.tb.connect(src, op1, op2)
+ self.tb.connect(op2, dst)
+ self.tb.run()
+
+ self.assertEqual(expected_results, dst.data())
+
+ def test_201a(self):
+ random.seed(0)
+ src_data = []
+ for i in xrange(100):
+ src_data.append((random.randint(-2**31,2**31-1)))
+ src_data = tuple(src_data)
+ expected_results = src_data
+ src = gr.vector_source_i(tuple(src_data), False)
+ op1 = blocks.packed_to_unpacked_ii(8, gr.GR_MSB_FIRST)
+ op2 = blocks.unpacked_to_packed_ii(8, gr.GR_MSB_FIRST)
+ dst = gr.vector_sink_i()
+
+ self.tb.connect(src, op1, op2)
+ self.tb.connect(op2, dst)
+ self.tb.run()
+
+ self.assertEqual(expected_results, dst.data())
+
+ def test_201b(self):
+ random.seed(0)
+ src_data = []
+ for i in xrange(100):
+ src_data.append((random.randint(-2**31,2**31-1)))
+ src_data = tuple(src_data)
+ expected_results = src_data
+ src = gr.vector_source_i(tuple(src_data), False)
+ op1 = blocks.packed_to_unpacked_ii(8, gr.GR_LSB_FIRST)
+ op2 = blocks.unpacked_to_packed_ii(8, gr.GR_LSB_FIRST)
+ dst = gr.vector_sink_i()
+
+ self.tb.connect(src, op1, op2)
+ self.tb.connect(op2, dst)
+ self.tb.run()
+
+ self.assertEqual(expected_results, dst.data())
+
+if __name__ == '__main__':
+ gr_unittest.run(test_packing, "test_packing.xml")
+
diff --git a/gr-blocks/python/qa_patterned_interleaver.py b/gr-blocks/python/qa_patterned_interleaver.py
new file mode 100755
index 000000000..3cf29c917
--- /dev/null
+++ b/gr-blocks/python/qa_patterned_interleaver.py
@@ -0,0 +1,56 @@
+#!/usr/bin/env python
+#
+# 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.
+#
+
+from gnuradio import gr, gr_unittest
+try:
+ import blocks_swig as blocks
+except:
+ from gnuradio import blocks
+import math
+
+class test_patterned_interleaver (gr_unittest.TestCase):
+
+ def setUp (self):
+ self.tb = gr.top_block ()
+
+ def tearDown (self):
+ self.tb = None
+
+ def test_000(self):
+ dst_data = [0,0,1,2,0,2,1,0];
+ src0 = gr.vector_source_f(200*[0])
+ src1 = gr.vector_source_f(200*[1])
+ src2 = gr.vector_source_f(200*[2])
+ itg = blocks.patterned_interleaver(gr.sizeof_float, dst_data)
+ dst = gr.vector_sink_f()
+ head = gr.head(gr.sizeof_float, 8);
+
+ self.tb.connect( src0, (itg,0) );
+ self.tb.connect( src1, (itg,1) );
+ self.tb.connect( src2, (itg,2) );
+ self.tb.connect( itg, head, dst );
+
+ self.tb.run()
+ self.assertEqual(list(dst_data), list(dst.data()))
+
+if __name__ == '__main__':
+ gr_unittest.run(test_patterned_interleaver, "test_patterned_interleaver.xml")
diff --git a/gr-blocks/python/qa_peak_detector2.py b/gr-blocks/python/qa_peak_detector2.py
new file mode 100644
index 000000000..4b864e4d7
--- /dev/null
+++ b/gr-blocks/python/qa_peak_detector2.py
@@ -0,0 +1,58 @@
+#!/usr/bin/env python
+#
+# Copyright 2007,2010,2013 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 gnuradio import gr, gr_unittest
+import blocks_swig as blocks
+
+class test_peak_detector2(gr_unittest.TestCase):
+
+ def setUp(self):
+ self.tb = gr.top_block()
+
+ def tearDown(self):
+ self.tb = None
+
+ def test_regen1(self):
+ tb = self.tb
+
+ data = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
+ 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]
+
+ expected_result = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
+
+
+ src = gr.vector_source_f(data, False)
+ regen = blocks.peak_detector2_fb()
+ dst = gr.vector_sink_b()
+
+ tb.connect(src, regen)
+ tb.connect(regen, dst)
+ tb.run()
+
+ dst_data = dst.data()
+ print dst_data
+
+ self.assertEqual(expected_result, dst_data)
+
+if __name__ == '__main__':
+ gr_unittest.run(test_peak_detector2, "test_peak_detector2.xml")
diff --git a/gr-blocks/python/qa_pipe_fittings.py b/gr-blocks/python/qa_pipe_fittings.py
new file mode 100755
index 000000000..321660d5e
--- /dev/null
+++ b/gr-blocks/python/qa_pipe_fittings.py
@@ -0,0 +1,138 @@
+#!/usr/bin/env python
+#
+# Copyright 2005,2007,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.
+#
+
+from gnuradio import gr, gr_unittest
+import blocks_swig
+
+def calc_expected_result(src_data, n):
+ assert (len(src_data) % n) == 0
+ result = [list() for x in range(n)]
+ #print "len(result) =", len(result)
+ for i in xrange(len(src_data)):
+ (result[i % n]).append(src_data[i])
+ return [tuple(x) for x in result]
+
+
+class test_pipe_fittings(gr_unittest.TestCase):
+
+ def setUp(self):
+ self.tb = gr.top_block ()
+
+ def tearDown(self):
+ self.tb = None
+
+ def test_001(self):
+ """
+ Test stream_to_streams.
+ """
+ n = 8
+ src_len = n * 8
+ src_data = range(src_len)
+
+ expected_results = calc_expected_result(src_data, n)
+ #print "expected results: ", expected_results
+ src = gr.vector_source_i(src_data)
+ op = gr.stream_to_streams(gr.sizeof_int, n)
+ self.tb.connect(src, op)
+
+ dsts = []
+ for i in range(n):
+ dst = gr.vector_sink_i()
+ self.tb.connect((op, i), (dst, 0))
+ dsts.append(dst)
+
+ self.tb.run()
+
+ for d in range(n):
+ self.assertEqual(expected_results[d], dsts[d].data())
+
+ def test_002(self):
+
+ # Test streams_to_stream (using stream_to_streams).
+
+ n = 8
+ src_len = n * 8
+ src_data = tuple(range(src_len))
+ expected_results = src_data
+
+ src = gr.vector_source_i(src_data)
+ op1 = gr.stream_to_streams(gr.sizeof_int, n)
+ op2 = gr.streams_to_stream(gr.sizeof_int, n)
+ dst = gr.vector_sink_i()
+
+ self.tb.connect(src, op1)
+ for i in range(n):
+ self.tb.connect((op1, i), (op2, i))
+ self.tb.connect(op2, dst)
+
+ self.tb.run()
+ self.assertEqual(expected_results, dst.data())
+
+ def test_003(self):
+
+ #Test streams_to_vector (using stream_to_streams & vector_to_stream).
+
+ n = 8
+ src_len = n * 8
+ src_data = tuple(range(src_len))
+ expected_results = src_data
+
+ src = gr.vector_source_i(src_data)
+ op1 = gr.stream_to_streams(gr.sizeof_int, n)
+ op2 = gr.streams_to_vector(gr.sizeof_int, n)
+ op3 = gr.vector_to_stream(gr.sizeof_int, n)
+ dst = gr.vector_sink_i()
+
+ self.tb.connect(src, op1)
+ for i in range(n):
+ self.tb.connect((op1, i), (op2, i))
+ self.tb.connect(op2, op3, dst)
+
+ self.tb.run()
+ self.assertEqual(expected_results, dst.data())
+
+ def test_004(self):
+
+ #Test vector_to_streams.
+
+ n = 8
+ src_len = n * 8
+ src_data = tuple(range(src_len))
+ expected_results = src_data
+
+ src = gr.vector_source_i(src_data)
+ op1 = gr.stream_to_vector(gr.sizeof_int, n)
+ op2 = gr.vector_to_streams(gr.sizeof_int, n)
+ op3 = gr.streams_to_stream(gr.sizeof_int, n)
+ dst = gr.vector_sink_i()
+
+ self.tb.connect(src, op1, op2)
+ for i in range(n):
+ self.tb.connect((op2, i), (op3, i))
+ self.tb.connect(op3, dst)
+
+ self.tb.run()
+ self.assertEqual(expected_results, dst.data())
+
+
+if __name__ == '__main__':
+ gr_unittest.run(test_pipe_fittings, "test_pipe_fittings.xml")
diff --git a/gr-blocks/python/qa_regenerate.py b/gr-blocks/python/qa_regenerate.py
new file mode 100755
index 000000000..a57eeba2b
--- /dev/null
+++ b/gr-blocks/python/qa_regenerate.py
@@ -0,0 +1,90 @@
+#!/usr/bin/env python
+#
+# Copyright 2007,2010,2013 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 gnuradio import gr, gr_unittest
+import blocks_swig as blocks
+
+class test_regenerate(gr_unittest.TestCase):
+
+ def setUp(self):
+ self.tb = gr.top_block()
+
+ def tearDown(self):
+ self.tb = None
+
+ def test_regen1(self):
+ tb = self.tb
+
+ data = [0, 0, 0,
+ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
+
+ expected_result = (0, 0, 0,
+ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
+
+
+ src = gr.vector_source_b(data, False)
+ regen = blocks.regenerate_bb(5, 2)
+ dst = gr.vector_sink_b()
+
+ tb.connect(src, regen)
+ tb.connect(regen, dst)
+ tb.run()
+
+ dst_data = dst.data()
+
+ self.assertEqual(expected_result, dst_data)
+
+ def test_regen2(self):
+ tb = self.tb
+
+ data = 200*[0,]
+ data[9] = 1
+ data[99] = 1
+
+ expected_result = 200*[0,]
+ expected_result[9] = 1
+ expected_result[19] = 1
+ expected_result[29] = 1
+ expected_result[39] = 1
+
+ expected_result[99] = 1
+ expected_result[109] = 1
+ expected_result[119] = 1
+ expected_result[129] = 1
+
+ src = gr.vector_source_b(data, False)
+ regen = blocks.regenerate_bb(10, 3)
+ dst = gr.vector_sink_b()
+
+ tb.connect(src, regen)
+ tb.connect(regen, dst)
+ tb.run ()
+
+ dst_data = dst.data()
+
+ self.assertEqual(tuple(expected_result), dst_data)
+
+
+if __name__ == '__main__':
+ gr_unittest.run(test_regenerate, "test_regenerate.xml")
diff --git a/gr-blocks/python/qa_repeat.py b/gr-blocks/python/qa_repeat.py
new file mode 100755
index 000000000..69fb3ef72
--- /dev/null
+++ b/gr-blocks/python/qa_repeat.py
@@ -0,0 +1,49 @@
+#!/usr/bin/env python
+#
+# Copyright 2008,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.
+#
+
+from gnuradio import gr, gr_unittest
+import blocks_swig
+import math
+
+class test_repeat (gr_unittest.TestCase):
+
+ def setUp (self):
+ self.tb = gr.top_block ()
+
+ def tearDown (self):
+ self.tb = None
+
+ def test_001_float(self):
+ src_data = [n*1.0 for n in range(100)];
+ dst_data = []
+ for n in range(100):
+ dst_data += [1.0*n, 1.0*n, 1.0*n]
+
+ src = gr.vector_source_f(src_data)
+ rpt = blocks_swig.repeat(gr.sizeof_float, 3)
+ dst = gr.vector_sink_f()
+ self.tb.connect(src, rpt, dst)
+ self.tb.run()
+ self.assertFloatTuplesAlmostEqual(dst_data, dst.data(), 6)
+
+if __name__ == '__main__':
+ gr_unittest.run(test_repeat, "test_repeat.xml")
diff --git a/gr-blocks/python/qa_rms.py b/gr-blocks/python/qa_rms.py
new file mode 100644
index 000000000..f3386668a
--- /dev/null
+++ b/gr-blocks/python/qa_rms.py
@@ -0,0 +1,83 @@
+#!/usr/bin/env python
+#
+# Copyright 2013 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 gnuradio import gr, gr_unittest
+import blocks_swig as blocks
+import math
+
+def sig_source_f(samp_rate, freq, amp, N):
+ t = map(lambda x: float(x)/samp_rate, xrange(N))
+ y = map(lambda x: amp*math.cos(2.*math.pi*freq*x), t)
+ return y
+
+def sig_source_c(samp_rate, freq, amp, N):
+ t = map(lambda x: float(x)/samp_rate, xrange(N))
+ y = map(lambda x: amp*math.cos(2.*math.pi*freq*x) + \
+ 1j*amp*math.sin(2.*math.pi*freq*x), t)
+ return y
+
+class test_rms(gr_unittest.TestCase):
+
+ def setUp(self):
+ self.tb = gr.top_block()
+
+ def tearDown(self):
+ self.tb = None
+
+ def test_ff(self):
+ amp = 2
+ src_data = sig_source_f(1, 0.01, amp, 200)
+ N = 750000
+
+ expected_data = amp/math.sqrt(2.0)
+
+ src = gr.vector_source_f(src_data, True)
+ head = gr.head(gr.sizeof_float, N)
+ op = blocks.rms_ff(0.0001)
+ dst = gr.vector_sink_f()
+
+ self.tb.connect(src, head, op, dst)
+ self.tb.run()
+
+ dst_data = dst.data()
+ self.assertAlmostEqual(dst_data[-1], expected_data, 4)
+
+ def test_cf(self):
+ amp = 4
+ src_data = sig_source_c(1, 0.01, amp, 200)
+ N = 750000
+
+ expected_data = amp
+
+ src = gr.vector_source_c(src_data, True)
+ head = gr.head(gr.sizeof_gr_complex, N)
+ op = blocks.rms_cf(0.0001)
+ dst = gr.vector_sink_f()
+
+ self.tb.connect(src, head, op, dst)
+ self.tb.run()
+
+ dst_data = dst.data()
+ self.assertAlmostEqual(dst_data[-1], expected_data, 4)
+
+if __name__ == '__main__':
+ gr_unittest.run(test_rms, "test_rms.xml")
diff --git a/gr-blocks/python/qa_stream_mux.py b/gr-blocks/python/qa_stream_mux.py
new file mode 100755
index 000000000..f21a9bbbc
--- /dev/null
+++ b/gr-blocks/python/qa_stream_mux.py
@@ -0,0 +1,169 @@
+#!/usr/bin/env python
+#
+# Copyright 2004,2005,2007,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.
+#
+
+from gnuradio import gr, gr_unittest
+import blocks_swig
+
+class test_stream_mux (gr_unittest.TestCase):
+
+ def setUp (self):
+ self.tb = gr.top_block ()
+
+ def tearDown (self):
+ self.tb = None
+
+ def help_stream_2ff(self, N, stream_sizes):
+ v0 = gr.vector_source_f(N*[1,], False)
+ v1 = gr.vector_source_f(N*[2,], False)
+
+ mux = blocks_swig.stream_mux(gr.sizeof_float, stream_sizes)
+
+ dst = gr.vector_sink_f ()
+
+ self.tb.connect (v0, (mux,0))
+ self.tb.connect (v1, (mux,1))
+ self.tb.connect (mux, dst)
+ self.tb.run ()
+
+ return dst.data ()
+
+ def help_stream_ramp_2ff(self, N, stream_sizes):
+ r1 = range(N)
+ r2 = range(N)
+ r2.reverse()
+
+ v0 = gr.vector_source_f(r1, False)
+ v1 = gr.vector_source_f(r2, False)
+
+ mux = blocks_swig.stream_mux(gr.sizeof_float, stream_sizes)
+
+ dst = gr.vector_sink_f ()
+
+ self.tb.connect (v0, (mux,0))
+ self.tb.connect (v1, (mux,1))
+ self.tb.connect (mux, dst)
+ self.tb.run ()
+
+ return dst.data ()
+
+ def test_stream_2NN_ff(self):
+ N = 40
+ stream_sizes = [10, 10]
+ result_data = self.help_stream_2ff(N, stream_sizes)
+
+ exp_data = (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
+ 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0,
+ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
+ 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0,
+ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
+ 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0,
+ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
+ 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0)
+ self.assertEqual (exp_data, result_data)
+
+ def test_stream_ramp_2NN_ff(self):
+ N = 40
+ stream_sizes = [10, 10]
+ result_data = self.help_stream_ramp_2ff(N, stream_sizes)
+
+ exp_data = ( 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0,
+ 39.0, 38.0, 37.0, 36.0, 35.0, 34.0, 33.0, 32.0, 31.0, 30.0,
+ 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0,
+ 29.0, 28.0, 27.0, 26.0, 25.0, 24.0, 23.0, 22.0, 21.0, 20.0,
+ 20.0, 21.0, 22.0, 23.0, 24.0, 25.0, 26.0, 27.0, 28.0, 29.0,
+ 19.0, 18.0, 17.0, 16.0, 15.0, 14.0, 13.0, 12.0, 11.0, 10.0,
+ 30.0, 31.0, 32.0, 33.0, 34.0, 35.0, 36.0, 37.0, 38.0, 39.0,
+ 9.0, 8.0, 7.0, 6.0, 5.0, 4.0, 3.0, 2.0, 1.0, 0.0)
+ self.assertEqual (exp_data, result_data)
+
+ def test_stream_2NM_ff(self):
+ N = 40
+ stream_sizes = [7, 9]
+ self.help_stream_2ff(N, stream_sizes)
+
+ result_data = self.help_stream_2ff(N, stream_sizes)
+
+ exp_data = (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
+ 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0,
+ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
+ 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0,
+ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
+ 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0,
+ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
+ 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0,
+ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
+ 2.0, 2.0, 2.0, 2.0)
+
+ self.assertEqual (exp_data, result_data)
+
+
+ def test_stream_2MN_ff(self):
+ N = 37
+ stream_sizes = [7, 9]
+ self.help_stream_2ff(N, stream_sizes)
+
+ result_data = self.help_stream_2ff(N, stream_sizes)
+
+ exp_data = (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
+ 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0,
+ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
+ 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0,
+ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
+ 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0,
+ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
+ 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0,
+ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
+ 2.0)
+
+ self.assertEqual (exp_data, result_data)
+
+ def test_stream_2N0_ff(self):
+ N = 30
+ stream_sizes = [7, 0]
+ self.help_stream_2ff(N, stream_sizes)
+
+ result_data = self.help_stream_2ff(N, stream_sizes)
+
+ exp_data = (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
+ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
+ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
+ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
+ 1.0, 1.0)
+
+ self.assertEqual (exp_data, result_data)
+
+ def test_stream_20N_ff(self):
+ N = 30
+ stream_sizes = [0, 9]
+ self.help_stream_2ff(N, stream_sizes)
+
+ result_data = self.help_stream_2ff(N, stream_sizes)
+
+ exp_data = (2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0,
+ 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0,
+ 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0,
+ 2.0, 2.0, 2.0)
+
+ self.assertEqual (exp_data, result_data)
+
+if __name__ == '__main__':
+ gr_unittest.run(test_stream_mux, "test_stream_mux.xml")
diff --git a/gr-blocks/python/qa_stretch.py b/gr-blocks/python/qa_stretch.py
new file mode 100755
index 000000000..013d878a8
--- /dev/null
+++ b/gr-blocks/python/qa_stretch.py
@@ -0,0 +1,67 @@
+#!/usr/bin/env python
+#
+# Copyright 2013 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 gnuradio import gr, gr_unittest
+import blocks_swig as blocks
+
+class test_stretch(gr_unittest.TestCase):
+
+ def setUp(self):
+ self.tb = gr.top_block()
+
+ def tearDown(self):
+ self.tb = None
+
+ def test_stretch_01(self):
+ tb = self.tb
+
+ data = 10*[1,]
+ data0 = map(lambda x: x/20.0, data)
+ data1 = map(lambda x: x/10.0, data)
+
+ expected_result0 = 10*[0.05,]
+ expected_result1 = 10*[0.1,]
+
+ src0 = gr.vector_source_f(data0, False)
+ src1 = gr.vector_source_f(data1, False)
+ inter = gr.streams_to_vector(gr.sizeof_float, 2)
+ op = blocks.stretch_ff(0.1, 2)
+ deinter = gr.vector_to_streams(gr.sizeof_float, 2)
+ dst0 = gr.vector_sink_f()
+ dst1 = gr.vector_sink_f()
+
+ tb.connect(src0, (inter,0))
+ tb.connect(src1, (inter,1))
+ tb.connect(inter, op)
+ tb.connect(op, deinter)
+ tb.connect((deinter,0), dst0)
+ tb.connect((deinter,1), dst1)
+ tb.run()
+
+ dst0_data = dst0.data()
+ dst1_data = dst1.data()
+
+ self.assertFloatTuplesAlmostEqual(expected_result0, dst0_data, 4)
+ self.assertFloatTuplesAlmostEqual(expected_result1, dst1_data, 4)
+
+if __name__ == '__main__':
+ gr_unittest.run(test_stretch, "test_stretch.xml")
diff --git a/gr-blocks/python/qa_threshold.py b/gr-blocks/python/qa_threshold.py
new file mode 100644
index 000000000..f91af739a
--- /dev/null
+++ b/gr-blocks/python/qa_threshold.py
@@ -0,0 +1,54 @@
+#!/usr/bin/env python
+#
+# Copyright 2013 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 gnuradio import gr, gr_unittest
+import blocks_swig as blocks
+
+class test_threshold(gr_unittest.TestCase):
+
+ def setUp(self):
+ self.tb = gr.top_block()
+
+ def tearDown(self):
+ self.tb = None
+
+ def test_01(self):
+ tb = self.tb
+
+ data = [0, 0, 0, 2, 2, 2, 2, 0, 0, 0, 2, 2, 2]
+
+ expected_result = (0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1)
+
+ src = gr.vector_source_f(data, False)
+ op = blocks.threshold_ff(1, 1)
+ dst = gr.vector_sink_f()
+
+ tb.connect(src, op)
+ tb.connect(op, dst)
+ tb.run()
+
+ dst_data = dst.data()
+
+ self.assertEqual(expected_result, dst_data)
+
+if __name__ == '__main__':
+ gr_unittest.run(test_threshold, "test_threshold.xml")
diff --git a/gr-blocks/python/qa_throttle.py b/gr-blocks/python/qa_throttle.py
new file mode 100755
index 000000000..5d462f2c9
--- /dev/null
+++ b/gr-blocks/python/qa_throttle.py
@@ -0,0 +1,39 @@
+#!/usr/bin/env python
+#
+# Copyright 2013 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 gnuradio import gr, gr_unittest
+import blocks_swig as blocks
+
+class test_throttle(gr_unittest.TestCase):
+
+ def setUp(self):
+ self.tb = gr.top_block()
+
+ def tearDown(self):
+ self.tb = None
+
+ def test_01(self):
+ # Test that we can make the block
+ op = blocks.throttle(gr.sizeof_gr_complex, 1)
+
+if __name__ == '__main__':
+ gr_unittest.run(test_throttle, "test_throttle.xml")
diff --git a/gr-blocks/python/qa_transcendental.py b/gr-blocks/python/qa_transcendental.py
new file mode 100644
index 000000000..8174f7963
--- /dev/null
+++ b/gr-blocks/python/qa_transcendental.py
@@ -0,0 +1,90 @@
+#!/usr/bin/env python
+#
+# Copyright 2013 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 gnuradio import gr, gr_unittest
+import blocks_swig as blocks
+import math
+
+class test_transcendental(gr_unittest.TestCase):
+
+ def setUp(self):
+ self.tb = gr.top_block()
+
+ def tearDown(self):
+ self.tb = None
+
+ def test_01(self):
+ tb = self.tb
+
+ data = 100*[0,]
+ expected_result = 100*[1,]
+
+ src = gr.vector_source_f(data, False)
+ op = blocks.transcendental("cos", "float")
+ dst = gr.vector_sink_f()
+
+ tb.connect(src, op)
+ tb.connect(op, dst)
+ tb.run()
+
+ dst_data = dst.data()
+
+ self.assertFloatTuplesAlmostEqual(expected_result, dst_data, 5)
+
+ def test_02(self):
+ tb = self.tb
+
+ data = 100*[3,]
+ expected_result = 100*[math.log10(3),]
+
+ src = gr.vector_source_f(data, False)
+ op = blocks.transcendental("log10", "float")
+ dst = gr.vector_sink_f()
+
+ tb.connect(src, op)
+ tb.connect(op, dst)
+ tb.run()
+
+ dst_data = dst.data()
+
+ self.assertFloatTuplesAlmostEqual(expected_result, dst_data, 5)
+
+ def test_03(self):
+ tb = self.tb
+
+ data = 100*[3,]
+ expected_result = 100*[math.tanh(3),]
+
+ src = gr.vector_source_f(data, False)
+ op = blocks.transcendental("tanh", "float")
+ dst = gr.vector_sink_f()
+
+ tb.connect(src, op)
+ tb.connect(op, dst)
+ tb.run()
+
+ dst_data = dst.data()
+
+ self.assertFloatTuplesAlmostEqual(expected_result, dst_data, 5)
+
+if __name__ == '__main__':
+ gr_unittest.run(test_transcendental, "test_transcendental.xml")
diff --git a/gr-blocks/python/qa_type_conversions.py b/gr-blocks/python/qa_type_conversions.py
new file mode 100755
index 000000000..eb1b42b63
--- /dev/null
+++ b/gr-blocks/python/qa_type_conversions.py
@@ -0,0 +1,316 @@
+#!/usr/bin/env python
+#
+# 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.
+#
+
+from gnuradio import gr, gr_unittest
+import blocks_swig
+from math import sqrt, atan2
+
+class test_type_conversions(gr_unittest.TestCase):
+
+ def setUp(self):
+ self.tb = gr.top_block()
+
+ def tearDown(self):
+ self.tb = None
+
+ def test_char_to_float_identity(self):
+ src_data = (1, 2, 3, 4, 5)
+ expected_data = (1.0, 2.0, 3.0, 4.0, 5.0)
+ src = gr.vector_source_b(src_data)
+ op = blocks_swig.char_to_float()
+ dst = gr.vector_sink_f()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ self.assertFloatTuplesAlmostEqual(expected_data, dst.data())
+
+ def test_char_to_float_scale(self):
+ src_data = (1, 2, 3, 4, 5)
+ expected_data = (0.5, 1.0, 1.5, 2.0, 2.5)
+ src = gr.vector_source_b(src_data)
+ op = blocks_swig.char_to_float(scale=2.0)
+ dst = gr.vector_sink_f()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ self.assertFloatTuplesAlmostEqual(expected_data, dst.data())
+
+ def test_char_to_short(self):
+ src_data = (1, 2, 3, 4, 5)
+ expected_data = (256, 512, 768, 1024, 1280)
+ src = gr.vector_source_b(src_data)
+ op = blocks_swig.char_to_short()
+ dst = gr.vector_sink_s()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ self.assertEqual(expected_data, dst.data())
+
+ def test_complex_to_interleaved_short(self):
+ src_data = (1+2j, 3+4j, 5+6j, 7+8j, 9+10j)
+ expected_data = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
+ src = gr.vector_source_c(src_data)
+ op = blocks_swig.complex_to_interleaved_short()
+ dst = gr.vector_sink_s()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ self.assertEqual(expected_data, dst.data())
+
+ def test_complex_to_float_1(self):
+ src_data = (1+2j, 3+4j, 5+6j, 7+8j, 9+10j)
+ expected_data = (1.0, 3.0, 5.0, 7.0, 9.0)
+ src = gr.vector_source_c(src_data)
+ op = blocks_swig.complex_to_float()
+ dst = gr.vector_sink_f()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ self.assertFloatTuplesAlmostEqual(expected_data, dst.data())
+
+ def test_complex_to_float_2(self):
+ src_data = (1+2j, 3+4j, 5+6j, 7+8j, 9+10j)
+ expected_data1 = (1.0, 3.0, 5.0, 7.0, 9.0)
+ expected_data2 = (2.0, 4.0, 6.0, 8.0, 10.0)
+ src = gr.vector_source_c(src_data)
+ op = blocks_swig.complex_to_float()
+ dst1 = gr.vector_sink_f()
+ dst2 = gr.vector_sink_f()
+ self.tb.connect(src, op)
+ self.tb.connect((op, 0), dst1)
+ self.tb.connect((op, 1), dst2)
+ self.tb.run()
+ self.assertFloatTuplesAlmostEqual(expected_data1, dst1.data())
+ self.assertFloatTuplesAlmostEqual(expected_data2, dst2.data())
+
+ def test_complex_to_real(self):
+ src_data = (1+2j, 3+4j, 5+6j, 7+8j, 9+10j)
+ expected_data = (1.0, 3.0, 5.0, 7.0, 9.0)
+ src = gr.vector_source_c(src_data)
+ op = blocks_swig.complex_to_real()
+ dst = gr.vector_sink_f()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ self.assertFloatTuplesAlmostEqual(expected_data, dst.data())
+
+ def test_complex_to_imag(self):
+ src_data = (1+2j, 3+4j, 5+6j, 7+8j, 9+10j)
+ expected_data = (2.0, 4.0, 6.0, 8.0, 10.0)
+ src = gr.vector_source_c(src_data)
+ op = blocks_swig.complex_to_imag()
+ dst = gr.vector_sink_f()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ self.assertFloatTuplesAlmostEqual(expected_data, dst.data())
+
+ def test_complex_to_mag(self):
+ src_data = (1+2j, 3-4j, 5+6j, 7-8j, -9+10j)
+ expected_data = (sqrt(5), sqrt(25), sqrt(61), sqrt(113), sqrt(181))
+ src = gr.vector_source_c(src_data)
+ op = blocks_swig.complex_to_mag()
+ dst = gr.vector_sink_f()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ self.assertFloatTuplesAlmostEqual(expected_data, dst.data(), 5)
+
+ def test_complex_to_mag_squared(self):
+ src_data = (1+2j, 3-4j, 5+6j, 7-8j, -9+10j)
+ expected_data = (5.0, 25.0, 61.0, 113.0, 181.0)
+ src = gr.vector_source_c(src_data)
+ op = blocks_swig.complex_to_mag_squared()
+ dst = gr.vector_sink_f()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ self.assertFloatTuplesAlmostEqual(expected_data, dst.data())
+
+ def test_complex_to_arg(self):
+ src_data = (1+2j, 3-4j, 5+6j, 7-8j, -9+10j)
+ expected_data = (atan2(2, 1), atan2(-4,3), atan2(6, 5), atan2(-8, 7), atan2(10,-9))
+ src = gr.vector_source_c(src_data)
+ op = blocks_swig.complex_to_arg()
+ dst = gr.vector_sink_f()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ self.assertFloatTuplesAlmostEqual(expected_data, dst.data(), 2)
+
+ def test_float_to_char_identity(self):
+ src_data = (1.0, 2.0, 3.0, 4.0, 5.0)
+ expected_data = (1, 2, 3, 4, 5)
+ src = gr.vector_source_f(src_data)
+ op = blocks_swig.float_to_char()
+ dst = gr.vector_sink_b()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ self.assertEqual(expected_data, dst.data())
+
+ def test_float_to_char_scale(self):
+ src_data = (1.0, 2.0, 3.0, 4.0, 5.0)
+ expected_data = (5, 10, 15, 20, 25)
+ src = gr.vector_source_f(src_data)
+ op = blocks_swig.float_to_char(1, 5)
+ dst = gr.vector_sink_b()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ self.assertEqual(expected_data, dst.data())
+
+ def test_float_to_complex_1(self):
+ src_data = (1.0, 3.0, 5.0, 7.0, 9.0)
+ expected_data = (1+0j, 3+0j, 5+0j, 7+0j, 9+0j)
+ src = gr.vector_source_f(src_data)
+ op = blocks_swig.float_to_complex()
+ dst = gr.vector_sink_c()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ self.assertFloatTuplesAlmostEqual(expected_data, dst.data())
+
+ def test_float_to_complex_2(self):
+ src1_data = (1.0, 3.0, 5.0, 7.0, 9.0)
+ src2_data = (2.0, 4.0, 6.0, 8.0, 10.0)
+ expected_data = (1+2j, 3+4j, 5+6j, 7+8j, 9+10j)
+ src1 = gr.vector_source_f(src1_data)
+ src2 = gr.vector_source_f(src2_data)
+ op = blocks_swig.float_to_complex()
+ dst = gr.vector_sink_c()
+ self.tb.connect(src1, (op, 0))
+ self.tb.connect(src2, (op, 1))
+ self.tb.connect(op, dst)
+ self.tb.run()
+ self.assertFloatTuplesAlmostEqual(expected_data, dst.data())
+
+ def test_float_to_int_identity(self):
+ src_data = (1.0, 2.0, 3.0, 4.0, 5.0)
+ expected_data = (1, 2, 3, 4, 5)
+ src = gr.vector_source_f(src_data)
+ op = blocks_swig.float_to_int()
+ dst = gr.vector_sink_i()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ self.assertEqual(expected_data, dst.data())
+
+ def test_float_to_int_scale(self):
+ src_data = (1.0, 2.0, 3.0, 4.0, 5.0)
+ expected_data = (5, 10, 15, 20, 25)
+ src = gr.vector_source_f(src_data)
+ op = blocks_swig.float_to_int(1, 5)
+ dst = gr.vector_sink_i()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ self.assertEqual(expected_data, dst.data())
+
+ def test_float_to_short_identity(self):
+ src_data = (1.0, 2.0, 3.0, 4.0, 5.0)
+ expected_data = (1, 2, 3, 4, 5)
+ src = gr.vector_source_f(src_data)
+ op = blocks_swig.float_to_short()
+ dst = gr.vector_sink_s()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ self.assertEqual(expected_data, dst.data())
+
+ def test_float_to_short_scale(self):
+ src_data = (1.0, 2.0, 3.0, 4.0, 5.0)
+ expected_data = (5, 10, 15, 20, 25)
+ src = gr.vector_source_f(src_data)
+ op = blocks_swig.float_to_short(1, 5)
+ dst = gr.vector_sink_s()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ self.assertEqual(expected_data, dst.data())
+
+ def test_float_to_uchar(self):
+ src_data = (1.0, -2.0, 3.0, -4.0, 256.0)
+ expected_data = (1, 0, 3, 0, 255)
+ src = gr.vector_source_f(src_data)
+ op = blocks_swig.float_to_uchar()
+ dst = gr.vector_sink_b()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ self.assertEqual(expected_data, dst.data())
+
+ def test_int_to_float_identity(self):
+ src_data = (1, 2, 3, 4, 5)
+ expected_data = (1.0, 2.0, 3.0, 4.0, 5.0)
+ src = gr.vector_source_i(src_data)
+ op = blocks_swig.int_to_float()
+ dst = gr.vector_sink_f()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ self.assertFloatTuplesAlmostEqual(expected_data, dst.data())
+
+ def test_int_to_float_scale(self):
+ src_data = (1, 2, 3, 4, 5)
+ expected_data = (0.2, 0.4, 0.6, 0.8, 1.0)
+ src = gr.vector_source_i(src_data)
+ op = blocks_swig.int_to_float(1, 5)
+ dst = gr.vector_sink_f()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ self.assertFloatTuplesAlmostEqual(expected_data, dst.data())
+
+ def test_interleaved_short_to_complex(self):
+ src_data = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
+ expected_data = (1+2j, 3+4j, 5+6j, 7+8j, 9+10j)
+ src = gr.vector_source_s(src_data)
+ op = blocks_swig.interleaved_short_to_complex()
+ dst = gr.vector_sink_c()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ self.assertEqual(expected_data, dst.data())
+
+ def test_short_to_char(self):
+ src_data = (256, 512, 768, 1024, 1280)
+ expected_data = (1, 2, 3, 4, 5)
+ src = gr.vector_source_s(src_data)
+ op = blocks_swig.short_to_char()
+ dst = gr.vector_sink_b()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ self.assertEqual(expected_data, dst.data())
+
+ def test_short_to_float_identity(self):
+ src_data = (1, 2, 3, 4, 5)
+ expected_data = (1.0, 2.0, 3.0, 4.0, 5.0)
+ src = gr.vector_source_s(src_data)
+ op = blocks_swig.short_to_float()
+ dst = gr.vector_sink_f()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ self.assertEqual(expected_data, dst.data())
+
+ def test_short_to_float_scale(self):
+ src_data = (5, 10, 15, 20, 25)
+ expected_data = (1.0, 2.0, 3.0, 4.0, 5.0)
+ src = gr.vector_source_s(src_data)
+ op = blocks_swig.short_to_float(1, 5)
+ dst = gr.vector_sink_f()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ self.assertEqual(expected_data, dst.data())
+
+ def test_uchar_to_float(self):
+ src_data = (1, 2, 3, 4, 5)
+ expected_data = (1.0, 2.0, 3.0, 4.0, 5.0)
+ src = gr.vector_source_b(src_data)
+ op = blocks_swig.uchar_to_float()
+ dst = gr.vector_sink_f()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ self.assertEqual(expected_data, dst.data())
+
+
+if __name__ == '__main__':
+ gr_unittest.run(test_type_conversions, "test_type_conversions.xml")
diff --git a/gr-blocks/swig/CMakeLists.txt b/gr-blocks/swig/CMakeLists.txt
new file mode 100644
index 000000000..84ab5b660
--- /dev/null
+++ b/gr-blocks/swig/CMakeLists.txt
@@ -0,0 +1,53 @@
+# 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.
+
+########################################################################
+# Setup swig generation
+########################################################################
+include(GrPython)
+include(GrSwig)
+
+set(GR_SWIG_INCLUDE_DIRS
+ ${CMAKE_CURRENT_BINARY_DIR}/../include
+ ${GR_BLOCKS_INCLUDE_DIRS}
+ ${GNURADIO_CORE_SWIG_INCLUDE_DIRS}
+ ${GRUEL_INCLUDE_DIRS}
+ ${Boost_INCLUDE_DIRS}
+)
+
+set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/blocks_swig_doc.i)
+set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../lib)
+set(GR_SWIG_TARGET_DEPS blocks_generated_includes)
+set(GR_SWIG_LIBRARIES gnuradio-blocks)
+
+GR_SWIG_MAKE(blocks_swig blocks_swig.i)
+
+GR_SWIG_INSTALL(
+ TARGETS blocks_swig
+ DESTINATION ${GR_PYTHON_DIR}/gnuradio/blocks
+ COMPONENT "blocks_python"
+)
+
+install(
+ FILES
+ blocks_swig.i
+ ${CMAKE_CURRENT_BINARY_DIR}/blocks_swig_doc.i
+ DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig
+ COMPONENT "blocks_swig"
+)
diff --git a/gr-blocks/swig/blocks_swig.i b/gr-blocks/swig/blocks_swig.i
new file mode 100644
index 000000000..db8af3436
--- /dev/null
+++ b/gr-blocks/swig/blocks_swig.i
@@ -0,0 +1,347 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2012-2013 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.
+ */
+
+#define BLOCKS_API
+
+%include "gnuradio.i"
+
+//load generated python docstrings
+%include "blocks_swig_doc.i"
+
+%include <gr_endianness.h>
+
+%{
+#include "blocks/add_ff.h"
+#include "blocks/add_ss.h"
+#include "blocks/add_ii.h"
+#include "blocks/add_cc.h"
+#include "blocks/add_const_ff.h"
+#include "blocks/add_const_ss.h"
+#include "blocks/add_const_ii.h"
+#include "blocks/add_const_cc.h"
+#include "blocks/add_const_vff.h"
+#include "blocks/add_const_vss.h"
+#include "blocks/add_const_vii.h"
+#include "blocks/add_const_vcc.h"
+#include "blocks/and_bb.h"
+#include "blocks/and_ss.h"
+#include "blocks/and_ii.h"
+#include "blocks/and_const_bb.h"
+#include "blocks/and_const_ss.h"
+#include "blocks/and_const_ii.h"
+#include "blocks/char_to_float.h"
+#include "blocks/char_to_short.h"
+#include "blocks/complex_to_interleaved_short.h"
+#include "blocks/complex_to_float.h"
+#include "blocks/complex_to_real.h"
+#include "blocks/complex_to_imag.h"
+#include "blocks/complex_to_mag.h"
+#include "blocks/complex_to_mag_squared.h"
+#include "blocks/complex_to_arg.h"
+#include "blocks/conjugate_cc.h"
+#include "blocks/deinterleave.h"
+#include "blocks/delay.h"
+#include "blocks/divide_ff.h"
+#include "blocks/divide_ss.h"
+#include "blocks/divide_ii.h"
+#include "blocks/divide_cc.h"
+#include "blocks/file_source.h"
+#include "blocks/file_meta_sink.h"
+#include "blocks/file_meta_source.h"
+#include "blocks/float_to_char.h"
+#include "blocks/float_to_complex.h"
+#include "blocks/float_to_int.h"
+#include "blocks/float_to_short.h"
+#include "blocks/float_to_uchar.h"
+#include "blocks/int_to_float.h"
+#include "blocks/integrate_ss.h"
+#include "blocks/integrate_ii.h"
+#include "blocks/integrate_ff.h"
+#include "blocks/integrate_cc.h"
+#include "blocks/interleave.h"
+#include "blocks/interleaved_short_to_complex.h"
+#include "blocks/keep_m_in_n.h"
+#include "blocks/keep_one_in_n.h"
+#include "blocks/multiply_ss.h"
+#include "blocks/multiply_ii.h"
+#include "blocks/multiply_ff.h"
+#include "blocks/multiply_cc.h"
+#include "blocks/multiply_conjugate_cc.h"
+#include "blocks/multiply_const_ss.h"
+#include "blocks/multiply_const_ii.h"
+#include "blocks/multiply_const_ff.h"
+#include "blocks/multiply_const_cc.h"
+#include "blocks/multiply_const_vss.h"
+#include "blocks/multiply_const_vii.h"
+#include "blocks/multiply_const_vff.h"
+#include "blocks/multiply_const_vcc.h"
+#include "blocks/nlog10_ff.h"
+#include "blocks/not_bb.h"
+#include "blocks/not_ss.h"
+#include "blocks/not_ii.h"
+#include "blocks/patterned_interleaver.h"
+#include "blocks/packed_to_unpacked_bb.h"
+#include "blocks/packed_to_unpacked_ss.h"
+#include "blocks/packed_to_unpacked_ii.h"
+#include "blocks/peak_detector2_fb.h"
+#include "blocks/or_bb.h"
+#include "blocks/or_ss.h"
+#include "blocks/or_ii.h"
+#include "blocks/regenerate_bb.h"
+#include "blocks/repeat.h"
+#include "blocks/rms_cf.h"
+#include "blocks/rms_ff.h"
+#include "blocks/short_to_char.h"
+#include "blocks/short_to_float.h"
+#include "blocks/stream_mux.h"
+#include "blocks/stream_to_streams.h"
+#include "blocks/stream_to_vector.h"
+#include "blocks/streams_to_stream.h"
+#include "blocks/streams_to_vector.h"
+#include "blocks/stretch_ff.h"
+#include "blocks/sub_ff.h"
+#include "blocks/sub_ss.h"
+#include "blocks/sub_ii.h"
+#include "blocks/sub_cc.h"
+#include "blocks/threshold_ff.h"
+#include "blocks/throttle.h"
+#include "blocks/transcendental.h"
+#include "blocks/uchar_to_float.h"
+#include "blocks/unpacked_to_packed_bb.h"
+#include "blocks/unpacked_to_packed_ss.h"
+#include "blocks/unpacked_to_packed_ii.h"
+#include "blocks/vector_to_stream.h"
+#include "blocks/vector_to_streams.h"
+#include "blocks/xor_bb.h"
+#include "blocks/xor_ss.h"
+#include "blocks/xor_ii.h"
+%}
+
+%include "blocks/add_ff.h"
+%include "blocks/add_ss.h"
+%include "blocks/add_ii.h"
+%include "blocks/add_cc.h"
+%include "blocks/add_const_ff.h"
+%include "blocks/add_const_ss.h"
+%include "blocks/add_const_ii.h"
+%include "blocks/add_const_cc.h"
+%include "blocks/add_const_vff.h"
+%include "blocks/add_const_vss.h"
+%include "blocks/add_const_vii.h"
+%include "blocks/add_const_vcc.h"
+%include "blocks/and_bb.h"
+%include "blocks/and_ss.h"
+%include "blocks/and_ii.h"
+%include "blocks/and_const_bb.h"
+%include "blocks/and_const_ss.h"
+%include "blocks/and_const_ii.h"
+%include "blocks/char_to_float.h"
+%include "blocks/char_to_short.h"
+%include "blocks/complex_to_interleaved_short.h"
+%include "blocks/complex_to_float.h"
+%include "blocks/complex_to_real.h"
+%include "blocks/complex_to_imag.h"
+%include "blocks/complex_to_mag.h"
+%include "blocks/complex_to_mag_squared.h"
+%include "blocks/complex_to_arg.h"
+%include "blocks/conjugate_cc.h"
+%include "blocks/deinterleave.h"
+%include "blocks/delay.h"
+%include "blocks/file_source.h"
+%include "blocks/file_meta_sink.h"
+%include "blocks/file_meta_source.h"
+%include "blocks/divide_ff.h"
+%include "blocks/divide_ss.h"
+%include "blocks/divide_ii.h"
+%include "blocks/divide_cc.h"
+%include "blocks/float_to_char.h"
+%include "blocks/float_to_complex.h"
+%include "blocks/float_to_int.h"
+%include "blocks/float_to_short.h"
+%include "blocks/float_to_uchar.h"
+%include "blocks/int_to_float.h"
+%include "blocks/integrate_ss.h"
+%include "blocks/integrate_ii.h"
+%include "blocks/integrate_ff.h"
+%include "blocks/integrate_cc.h"
+%include "blocks/interleave.h"
+%include "blocks/interleaved_short_to_complex.h"
+%include "blocks/keep_m_in_n.h"
+%include "blocks/keep_one_in_n.h"
+%include "blocks/multiply_ss.h"
+%include "blocks/multiply_ii.h"
+%include "blocks/multiply_ff.h"
+%include "blocks/multiply_cc.h"
+%include "blocks/multiply_conjugate_cc.h"
+%include "blocks/multiply_const_ss.h"
+%include "blocks/multiply_const_ii.h"
+%include "blocks/multiply_const_ff.h"
+%include "blocks/multiply_const_cc.h"
+%include "blocks/multiply_const_vss.h"
+%include "blocks/multiply_const_vii.h"
+%include "blocks/multiply_const_vff.h"
+%include "blocks/multiply_const_vcc.h"
+%include "blocks/nlog10_ff.h"
+%include "blocks/not_bb.h"
+%include "blocks/not_ss.h"
+%include "blocks/not_ii.h"
+%include "blocks/patterned_interleaver.h"
+%include "blocks/packed_to_unpacked_bb.h"
+%include "blocks/packed_to_unpacked_ss.h"
+%include "blocks/packed_to_unpacked_ii.h"
+%include "blocks/peak_detector2_fb.h"
+%include "blocks/or_bb.h"
+%include "blocks/or_ss.h"
+%include "blocks/or_ii.h"
+%include "blocks/regenerate_bb.h"
+%include "blocks/repeat.h"
+%include "blocks/rms_cf.h"
+%include "blocks/rms_ff.h"
+%include "blocks/short_to_char.h"
+%include "blocks/short_to_float.h"
+%include "blocks/stream_mux.h"
+%include "blocks/stream_to_streams.h"
+%include "blocks/stream_to_vector.h"
+%include "blocks/streams_to_stream.h"
+%include "blocks/streams_to_vector.h"
+%include "blocks/stretch_ff.h"
+%include "blocks/sub_ff.h"
+%include "blocks/sub_ss.h"
+%include "blocks/sub_ii.h"
+%include "blocks/sub_cc.h"
+%include "blocks/threshold_ff.h"
+%include "blocks/throttle.h"
+%include "blocks/transcendental.h"
+%include "blocks/uchar_to_float.h"
+%include "blocks/unpacked_to_packed_bb.h"
+%include "blocks/unpacked_to_packed_ss.h"
+%include "blocks/unpacked_to_packed_ii.h"
+%include "blocks/vector_to_stream.h"
+%include "blocks/vector_to_streams.h"
+%include "blocks/xor_bb.h"
+%include "blocks/xor_ss.h"
+%include "blocks/xor_ii.h"
+
+GR_SWIG_BLOCK_MAGIC2(blocks, add_ff);
+GR_SWIG_BLOCK_MAGIC2(blocks, add_ss);
+GR_SWIG_BLOCK_MAGIC2(blocks, add_ii);
+GR_SWIG_BLOCK_MAGIC2(blocks, add_cc);
+GR_SWIG_BLOCK_MAGIC2(blocks, add_const_ff);
+GR_SWIG_BLOCK_MAGIC2(blocks, add_const_ss);
+GR_SWIG_BLOCK_MAGIC2(blocks, add_const_ii);
+GR_SWIG_BLOCK_MAGIC2(blocks, add_const_cc);
+GR_SWIG_BLOCK_MAGIC2(blocks, add_const_vff);
+GR_SWIG_BLOCK_MAGIC2(blocks, add_const_vss);
+GR_SWIG_BLOCK_MAGIC2(blocks, add_const_vii);
+GR_SWIG_BLOCK_MAGIC2(blocks, add_const_vcc);
+GR_SWIG_BLOCK_MAGIC2(blocks, and_bb);
+GR_SWIG_BLOCK_MAGIC2(blocks, and_ss);
+GR_SWIG_BLOCK_MAGIC2(blocks, and_ii);
+GR_SWIG_BLOCK_MAGIC2(blocks, and_const_bb);
+GR_SWIG_BLOCK_MAGIC2(blocks, and_const_ss);
+GR_SWIG_BLOCK_MAGIC2(blocks, and_const_ii);
+GR_SWIG_BLOCK_MAGIC2(blocks, char_to_float);
+GR_SWIG_BLOCK_MAGIC2(blocks, char_to_short);
+GR_SWIG_BLOCK_MAGIC2(blocks, complex_to_interleaved_short);
+GR_SWIG_BLOCK_MAGIC2(blocks, complex_to_float);
+GR_SWIG_BLOCK_MAGIC2(blocks, complex_to_real);
+GR_SWIG_BLOCK_MAGIC2(blocks, complex_to_imag);
+GR_SWIG_BLOCK_MAGIC2(blocks, complex_to_mag);
+GR_SWIG_BLOCK_MAGIC2(blocks, complex_to_mag_squared);
+GR_SWIG_BLOCK_MAGIC2(blocks, complex_to_arg);
+GR_SWIG_BLOCK_MAGIC2(blocks, conjugate_cc);
+GR_SWIG_BLOCK_MAGIC2(blocks, deinterleave);
+GR_SWIG_BLOCK_MAGIC2(blocks, delay);
+GR_SWIG_BLOCK_MAGIC2(blocks, divide_ff);
+GR_SWIG_BLOCK_MAGIC2(blocks, divide_ss);
+GR_SWIG_BLOCK_MAGIC2(blocks, divide_ii);
+GR_SWIG_BLOCK_MAGIC2(blocks, divide_cc);
+GR_SWIG_BLOCK_MAGIC2(blocks, file_source);
+GR_SWIG_BLOCK_MAGIC2(blocks, file_meta_sink);
+GR_SWIG_BLOCK_MAGIC2(blocks, file_meta_source);
+GR_SWIG_BLOCK_MAGIC2(blocks, float_to_char);
+GR_SWIG_BLOCK_MAGIC2(blocks, float_to_complex);
+GR_SWIG_BLOCK_MAGIC2(blocks, float_to_int);
+GR_SWIG_BLOCK_MAGIC2(blocks, float_to_short);
+GR_SWIG_BLOCK_MAGIC2(blocks, float_to_uchar);
+GR_SWIG_BLOCK_MAGIC2(blocks, int_to_float);
+GR_SWIG_BLOCK_MAGIC2(blocks, integrate_ss);
+GR_SWIG_BLOCK_MAGIC2(blocks, integrate_ii);
+GR_SWIG_BLOCK_MAGIC2(blocks, integrate_ff);
+GR_SWIG_BLOCK_MAGIC2(blocks, integrate_cc);
+GR_SWIG_BLOCK_MAGIC2(blocks, interleave);
+GR_SWIG_BLOCK_MAGIC2(blocks, interleaved_short_to_complex);
+GR_SWIG_BLOCK_MAGIC2(blocks, keep_m_in_n);
+GR_SWIG_BLOCK_MAGIC2(blocks, keep_one_in_n);
+GR_SWIG_BLOCK_MAGIC2(blocks, multiply_ss);
+GR_SWIG_BLOCK_MAGIC2(blocks, multiply_ii);
+GR_SWIG_BLOCK_MAGIC2(blocks, multiply_ff);
+GR_SWIG_BLOCK_MAGIC2(blocks, multiply_cc);
+GR_SWIG_BLOCK_MAGIC2(blocks, multiply_conjugate_cc);
+GR_SWIG_BLOCK_MAGIC2(blocks, multiply_const_ss);
+GR_SWIG_BLOCK_MAGIC2(blocks, multiply_const_ii);
+GR_SWIG_BLOCK_MAGIC2(blocks, multiply_const_ff);
+GR_SWIG_BLOCK_MAGIC2(blocks, multiply_const_cc);
+GR_SWIG_BLOCK_MAGIC2(blocks, multiply_const_vss);
+GR_SWIG_BLOCK_MAGIC2(blocks, multiply_const_vii);
+GR_SWIG_BLOCK_MAGIC2(blocks, multiply_const_vff);
+GR_SWIG_BLOCK_MAGIC2(blocks, multiply_const_vcc);
+GR_SWIG_BLOCK_MAGIC2(blocks, nlog10_ff);
+GR_SWIG_BLOCK_MAGIC2(blocks, not_bb);
+GR_SWIG_BLOCK_MAGIC2(blocks, not_ss);
+GR_SWIG_BLOCK_MAGIC2(blocks, not_ii);
+GR_SWIG_BLOCK_MAGIC2(blocks, patterned_interleaver);
+GR_SWIG_BLOCK_MAGIC2(blocks, packed_to_unpacked_bb);
+GR_SWIG_BLOCK_MAGIC2(blocks, packed_to_unpacked_ss);
+GR_SWIG_BLOCK_MAGIC2(blocks, packed_to_unpacked_ii);
+GR_SWIG_BLOCK_MAGIC2(blocks, peak_detector2_fb);
+GR_SWIG_BLOCK_MAGIC2(blocks, or_bb);
+GR_SWIG_BLOCK_MAGIC2(blocks, or_ss);
+GR_SWIG_BLOCK_MAGIC2(blocks, or_ii);
+GR_SWIG_BLOCK_MAGIC2(blocks, regenerate_bb);
+GR_SWIG_BLOCK_MAGIC2(blocks, repeat);
+GR_SWIG_BLOCK_MAGIC2(blocks, rms_cf);
+GR_SWIG_BLOCK_MAGIC2(blocks, rms_ff);
+GR_SWIG_BLOCK_MAGIC2(blocks, short_to_char);
+GR_SWIG_BLOCK_MAGIC2(blocks, short_to_float);
+GR_SWIG_BLOCK_MAGIC2(blocks, stream_mux);
+GR_SWIG_BLOCK_MAGIC2(blocks, stream_to_streams);
+GR_SWIG_BLOCK_MAGIC2(blocks, stream_to_vector);
+GR_SWIG_BLOCK_MAGIC2(blocks, streams_to_stream);
+GR_SWIG_BLOCK_MAGIC2(blocks, streams_to_vector);
+GR_SWIG_BLOCK_MAGIC2(blocks, stretch_ff);
+GR_SWIG_BLOCK_MAGIC2(blocks, sub_ff);
+GR_SWIG_BLOCK_MAGIC2(blocks, sub_ss);
+GR_SWIG_BLOCK_MAGIC2(blocks, sub_ii);
+GR_SWIG_BLOCK_MAGIC2(blocks, sub_cc);
+GR_SWIG_BLOCK_MAGIC2(blocks, threshold_ff);
+GR_SWIG_BLOCK_MAGIC2(blocks, throttle);
+GR_SWIG_BLOCK_MAGIC2(blocks, transcendental);
+GR_SWIG_BLOCK_MAGIC2(blocks, uchar_to_float);
+GR_SWIG_BLOCK_MAGIC2(blocks, unpacked_to_packed_bb);
+GR_SWIG_BLOCK_MAGIC2(blocks, unpacked_to_packed_ss);
+GR_SWIG_BLOCK_MAGIC2(blocks, unpacked_to_packed_ii);
+GR_SWIG_BLOCK_MAGIC2(blocks, vector_to_stream);
+GR_SWIG_BLOCK_MAGIC2(blocks, vector_to_streams);
+GR_SWIG_BLOCK_MAGIC2(blocks, xor_bb);
+GR_SWIG_BLOCK_MAGIC2(blocks, xor_ss);
+GR_SWIG_BLOCK_MAGIC2(blocks, xor_ii);
diff --git a/gr-comedi/CMakeLists.txt b/gr-comedi/CMakeLists.txt
new file mode 100644
index 000000000..a10a66a4b
--- /dev/null
+++ b/gr-comedi/CMakeLists.txt
@@ -0,0 +1,104 @@
+# Copyright 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.
+
+########################################################################
+# Setup dependencies
+########################################################################
+include(GrBoost)
+
+include(FindPkgConfig)
+
+PKG_CHECK_MODULES(COMEDI comedilib)
+
+########################################################################
+# Register component
+########################################################################
+include(GrComponent)
+GR_REGISTER_COMPONENT("gr-comedi" ENABLE_GR_COMEDI
+ COMEDI_FOUND
+ LINUX #comedi uses linux specific device noces
+ Boost_FOUND
+ ENABLE_GR_CORE
+)
+
+remove_definitions(-fvisibility=hidden) #FIXME until we do symbol visibility
+
+GR_SET_GLOBAL(GR_COMEDI_INCLUDE_DIRS
+ ${CMAKE_CURRENT_SOURCE_DIR}/src
+)
+
+########################################################################
+# Begin conditional configuration
+########################################################################
+if(ENABLE_GR_COMEDI)
+
+########################################################################
+# Setup CPack components
+########################################################################
+include(GrPackage)
+CPACK_SET(CPACK_COMPONENT_GROUP_COMEDI_DESCRIPTION "GNU Radio Comedi Blocks")
+
+CPACK_COMPONENT("comedi_runtime"
+ GROUP "Comedi"
+ DISPLAY_NAME "Runtime"
+ DESCRIPTION "Runtime"
+ DEPENDS "core_runtime"
+)
+
+CPACK_COMPONENT("comedi_devel"
+ GROUP "Comedi"
+ DISPLAY_NAME "Development"
+ DESCRIPTION "C++ headers, package config, import libraries"
+ DEPENDS "core_devel"
+)
+
+CPACK_COMPONENT("comedi_python"
+ GROUP "Comedi"
+ DISPLAY_NAME "Python"
+ DESCRIPTION "Python modules for runtime; GRC xml files"
+ DEPENDS "core_python;comedi_runtime"
+)
+
+CPACK_COMPONENT("comedi_swig"
+ GROUP "Comedi"
+ DISPLAY_NAME "SWIG"
+ DESCRIPTION "SWIG development .i files"
+ DEPENDS "core_swig;comedi_python;comedi_devel"
+)
+
+########################################################################
+# Add subdirectories
+########################################################################
+add_subdirectory(src)
+
+########################################################################
+# Create Pkg Config File
+########################################################################
+configure_file(
+ ${CMAKE_CURRENT_SOURCE_DIR}/gnuradio-comedi.pc.in
+ ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-comedi.pc
+@ONLY)
+
+install(
+ FILES ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-comedi.pc
+ DESTINATION ${GR_LIBRARY_DIR}/pkgconfig
+ COMPONENT "comedi_devel"
+)
+
+endif(ENABLE_GR_COMEDI)
diff --git a/gr-comedi/README b/gr-comedi/README
new file mode 100644
index 000000000..db6fde714
--- /dev/null
+++ b/gr-comedi/README
@@ -0,0 +1,3 @@
+This module appears to wrap COMEDI devices for GNU Radio.
+
+See http://www.comedi.org/.
diff --git a/gr-comedi/gnuradio-comedi.pc.in b/gr-comedi/gnuradio-comedi.pc.in
new file mode 100644
index 000000000..205b40e37
--- /dev/null
+++ b/gr-comedi/gnuradio-comedi.pc.in
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: gnuradio-comedi
+Description: GNU Radio blocks for the comedi library
+Requires: gnuradio-core
+Version: @LIBVER@
+Libs: -L${libdir} -lgnuradio-comedi
+Cflags: -I${includedir}
diff --git a/gr-comedi/src/CMakeLists.txt b/gr-comedi/src/CMakeLists.txt
new file mode 100644
index 000000000..1d9dac2c4
--- /dev/null
+++ b/gr-comedi/src/CMakeLists.txt
@@ -0,0 +1,117 @@
+# Copyright 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.
+
+########################################################################
+# Setup the include and linker paths
+########################################################################
+include_directories(
+ ${GR_COMEDI_INCLUDE_DIRS}
+ ${GNURADIO_CORE_INCLUDE_DIRS}
+ ${GRUEL_INCLUDE_DIRS}
+ ${Boost_INCLUDE_DIRS}
+ ${COMEDI_INCLUDE_DIRS}
+)
+
+link_directories(
+ ${Boost_LIBRARY_DIRS}
+ ${COMEDI_LIBRARY_DIRS}
+)
+
+########################################################################
+# Setup library
+########################################################################
+list(APPEND gr_comedi_sources
+ comedi_sink_s.cc
+ comedi_source_s.cc
+ gri_comedi.cc
+)
+
+list(APPEND comedi_libs
+ gnuradio-core
+ ${Boost_LIBRARIES}
+ ${COMEDI_LIBRARIES}
+)
+
+add_library(gnuradio-comedi SHARED ${gr_comedi_sources})
+target_link_libraries(gnuradio-comedi ${comedi_libs})
+GR_LIBRARY_FOO(gnuradio-comedi RUNTIME_COMPONENT "comedi_runtime" DEVEL_COMPONENT "comedi_devel")
+
+########################################################################
+# Install public header files
+########################################################################
+install(FILES
+ comedi_sink_s.h
+ comedi_source_s.h
+ DESTINATION ${GR_INCLUDE_DIR}/gnuradio
+ COMPONENT "comedi_devel"
+)
+
+########################################################################
+# Setup swig generation
+########################################################################
+if(ENABLE_PYTHON)
+include(GrPython)
+include(GrSwig)
+
+set(GR_SWIG_INCLUDE_DIRS
+ ${GR_COMEDI_INCLUDE_DIRS}
+ ${GNURADIO_CORE_SWIG_INCLUDE_DIRS}
+ ${GRUEL_INCLUDE_DIRS}
+ ${Boost_INCLUDE_DIRS}
+)
+
+set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/comedi_swig_doc.i)
+set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR})
+
+set(GR_SWIG_LIBRARIES gnuradio-comedi)
+
+GR_SWIG_MAKE(comedi comedi.i)
+
+GR_SWIG_INSTALL(
+ TARGETS comedi
+ DESTINATION ${GR_PYTHON_DIR}/gnuradio
+ COMPONENT "comedi_python"
+)
+
+install(
+ FILES comedi.i
+ ${CMAKE_CURRENT_BINARY_DIR}/comedi_swig_doc.i
+ DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig
+ COMPONENT "comedi_swig"
+)
+
+endif(ENABLE_PYTHON)
+
+########################################################################
+# Handle the unit tests
+########################################################################
+if(ENABLE_TESTING AND ENABLE_PYTHON)
+
+list(APPEND GR_TEST_PYTHON_DIRS
+ ${CMAKE_BINARY_DIR}/gr-comedi/src
+)
+list(APPEND GR_TEST_TARGET_DEPS gnuradio-comedi)
+
+include(GrTest)
+file(GLOB py_qa_test_files "qa_*.py")
+foreach(py_qa_test_file ${py_qa_test_files})
+ get_filename_component(py_qa_test_name ${py_qa_test_file} NAME_WE)
+ GR_ADD_TEST(${py_qa_test_name} ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} ${py_qa_test_file})
+endforeach(py_qa_test_file)
+endif(ENABLE_TESTING AND ENABLE_PYTHON)
diff --git a/gr-comedi/src/comedi.i b/gr-comedi/src/comedi.i
new file mode 100644
index 000000000..d3660580a
--- /dev/null
+++ b/gr-comedi/src/comedi.i
@@ -0,0 +1,74 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005,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 "gnuradio.i" // the common stuff
+
+//load generated python docstrings
+%include "comedi_swig_doc.i"
+
+%{
+#include "comedi_sink_s.h"
+#include "comedi_source_s.h"
+%}
+
+// ----------------------------------------------------------------
+
+GR_SWIG_BLOCK_MAGIC(comedi,source_s)
+
+comedi_source_s_sptr
+comedi_make_source_s (int sampling_freq,
+ const std::string dev = ""
+ ) throw (std::runtime_error);
+
+class comedi_source_s : public gr_sync_block {
+
+ protected:
+ comedi_source_s (int sampling_freq,
+ const std::string device_name
+ ) throw (std::runtime_error);
+
+ public:
+ ~comedi_source_s ();
+
+ bool start();
+ bool stop();
+};
+
+// ----------------------------------------------------------------
+
+GR_SWIG_BLOCK_MAGIC(comedi,sink_s)
+
+comedi_sink_s_sptr
+comedi_make_sink_s (int sampling_freq,
+ const std::string dev = ""
+ ) throw (std::runtime_error);
+
+class comedi_sink_s : public gr_sync_block {
+
+ protected:
+ comedi_sink_s (int sampling_freq,
+ const std::string device_name
+ ) throw (std::runtime_error);
+
+ public:
+ ~comedi_sink_s ();
+};
diff --git a/gr-comedi/src/comedi_sink_s.cc b/gr-comedi/src/comedi_sink_s.cc
new file mode 100644
index 000000000..de1decfb6
--- /dev/null
+++ b/gr-comedi/src/comedi_sink_s.cc
@@ -0,0 +1,233 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <sys/mman.h>
+
+#include <comedi_sink_s.h>
+#include <gr_io_signature.h>
+#include <stdio.h>
+#include <errno.h>
+#include <iostream>
+#include <stdexcept>
+#include <gri_comedi.h>
+
+
+/*
+ * comedi_sink_s is untested because I don't own appropriate hardware.
+ * Feedback is welcome! --SF
+ */
+
+static std::string
+default_device_name ()
+{
+ return "/dev/comedi0";
+}
+
+
+// ----------------------------------------------------------------
+
+comedi_sink_s_sptr
+comedi_make_sink_s (int sampling_freq, const std::string dev)
+{
+ return gnuradio::get_initial_sptr(new comedi_sink_s (sampling_freq, dev));
+}
+
+comedi_sink_s::comedi_sink_s (int sampling_freq,
+ const std::string device_name)
+ : gr_sync_block ("comedi_sink_s",
+ gr_make_io_signature (0, 0, 0),
+ gr_make_io_signature (0, 0, 0)),
+ d_sampling_freq (sampling_freq),
+ d_device_name (device_name.empty() ? default_device_name() : device_name),
+ d_dev (0),
+ d_subdevice (COMEDI_SUBD_AO),
+ d_n_chan (1), // number of input channels
+ d_map (0),
+ d_buffer_size (0),
+ d_buf_front (0),
+ d_buf_back (0)
+{
+ int aref=AREF_GROUND;
+ int range=0;
+
+ d_dev = comedi_open(d_device_name.c_str());
+ if (d_dev == 0){
+ comedi_perror(d_device_name.c_str());
+ throw std::runtime_error ("comedi_sink_s");
+ }
+
+ unsigned int chanlist[256];
+
+ for(int i=0; i<d_n_chan; i++){
+ chanlist[i]=CR_PACK(i,range,aref);
+ }
+
+ comedi_cmd cmd;
+ int ret;
+
+ ret = comedi_get_cmd_generic_timed(d_dev,d_subdevice,&cmd,d_n_chan,(unsigned int)(1e9/sampling_freq));
+ if(ret<0)
+ bail ("comedi_get_cmd_generic_timed", comedi_errno());
+
+ // TODO: check period_ns is not to far off sampling_freq
+
+ d_buffer_size = comedi_get_buffer_size(d_dev, d_subdevice);
+ if (d_buffer_size <= 0)
+ bail ("comedi_get_buffer_size", comedi_errno());
+
+ d_map = mmap(NULL,d_buffer_size,PROT_WRITE,MAP_SHARED,comedi_fileno(d_dev),0);
+ if (d_map == MAP_FAILED)
+ bail ("mmap", errno);
+
+ cmd.chanlist = chanlist;
+ cmd.chanlist_len = d_n_chan;
+ cmd.scan_end_arg = d_n_chan;
+
+ cmd.stop_src=TRIG_NONE;
+ cmd.stop_arg=0;
+
+ /* comedi_command_test() tests a command to see if the
+ * trigger sources and arguments are valid for the subdevice.
+ * If a trigger source is invalid, it will be logically ANDed
+ * with valid values (trigger sources are actually bitmasks),
+ * which may or may not result in a valid trigger source.
+ * If an argument is invalid, it will be adjusted to the
+ * nearest valid value. In this way, for many commands, you
+ * can test it multiple times until it passes. Typically,
+ * if you can't get a valid command in two tests, the original
+ * command wasn't specified very well. */
+ ret = comedi_command_test(d_dev,&cmd);
+
+ if(ret<0)
+ bail ("comedi_command_test", comedi_errno());
+
+ ret = comedi_command_test(d_dev,&cmd);
+
+ if(ret<0)
+ bail ("comedi_command_test", comedi_errno());
+
+ /* start the command */
+ ret = comedi_command(d_dev,&cmd);
+
+ if(ret<0)
+ bail ("comedi_command", comedi_errno());
+
+ set_output_multiple (d_n_chan*sizeof(sampl_t));
+
+ assert(sizeof(sampl_t) == sizeof(short));
+ set_output_signature (gr_make_io_signature (1, 1, sizeof (sampl_t)));
+}
+
+bool
+comedi_sink_s::check_topology (int ninputs, int noutputs)
+{
+ if (ninputs > d_n_chan)
+ throw std::runtime_error ("comedi_sink_s");
+
+ return true;
+}
+
+comedi_sink_s::~comedi_sink_s ()
+{
+ if (d_map) {
+ munmap(d_map, d_buffer_size);
+ d_map = 0;
+ }
+
+ comedi_close(d_dev);
+}
+
+int
+comedi_sink_s::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ int ret;
+
+ int work_left = noutput_items * sizeof(sampl_t) * d_n_chan;
+ sampl_t *pbuf = (sampl_t*)d_map;
+
+ do {
+
+ do {
+ ret = comedi_get_buffer_contents(d_dev,d_subdevice);
+ if (ret < 0)
+ bail ("comedi_get_buffer_contents", comedi_errno());
+
+ assert(ret % sizeof(sampl_t) == 0);
+ assert(work_left % sizeof(sampl_t) == 0);
+
+ ret = std::min(ret, work_left);
+ d_buf_front += ret;
+
+ assert(d_buffer_size%d_n_chan == 0);
+ if (d_buf_front-d_buf_back > (unsigned)d_buffer_size) {
+ d_buf_front+=d_buffer_size;
+ d_buf_back +=d_buffer_size;
+ }
+
+ if(d_buf_front==d_buf_back){
+ usleep(1000000*std::min(work_left,d_buffer_size/2)/(d_sampling_freq*sizeof(sampl_t)*d_n_chan));
+ continue;
+ }
+ } while (d_buf_front==d_buf_back);
+
+ for(unsigned i=d_buf_back/sizeof(sampl_t);i<d_buf_front/sizeof(sampl_t);i++){
+ int chan = i%d_n_chan;
+ int i_idx = noutput_items-work_left/d_n_chan/sizeof(sampl_t)+(i-d_buf_back/sizeof(sampl_t))/d_n_chan;
+
+ pbuf[i%(d_buffer_size/sizeof(sampl_t))] = input_items[chan]==0 ? 0 :
+ (int)((short*)(input_items[chan]))[i_idx] + 32767;
+ }
+
+ // FIXME: how to tell comedi the buffer is *written* ?
+ ret = comedi_mark_buffer_read(d_dev,d_subdevice,d_buf_front-d_buf_back);
+ if(ret<0)
+ bail ("comedi_mark_buffer_read", comedi_errno());
+
+ work_left -= d_buf_front-d_buf_back;
+
+ d_buf_back = d_buf_front;
+
+ } while(work_left>0);
+
+ return noutput_items;
+}
+
+
+void
+comedi_sink_s::output_error_msg (const char *msg, int err)
+{
+ fprintf (stderr, "comedi_sink_s[%s]: %s: %s\n",
+ d_device_name.c_str(), msg, comedi_strerror(err));
+}
+
+void
+comedi_sink_s::bail (const char *msg, int err) throw (std::runtime_error)
+{
+ output_error_msg (msg, err);
+ throw std::runtime_error ("comedi_sink_s");
+}
diff --git a/gr-comedi/src/comedi_sink_s.h b/gr-comedi/src/comedi_sink_s.h
new file mode 100644
index 000000000..94d39710c
--- /dev/null
+++ b/gr-comedi/src/comedi_sink_s.h
@@ -0,0 +1,89 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005 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_COMEDI_SINK_H
+#define INCLUDED_COMEDI_SINK_H
+
+#include <gr_sync_block.h>
+#include <string>
+#include <comedilib.h>
+#include <stdexcept>
+
+class comedi_sink_s;
+typedef boost::shared_ptr<comedi_sink_s> comedi_sink_s_sptr;
+
+/*!
+ * \brief make a COMEDI sink.
+ *
+ * \param sampling_freq sampling rate in Hz
+ * \param dev COMEDI device name, e.g., "/dev/comedi0"
+ */
+comedi_sink_s_sptr
+comedi_make_sink_s (int sampling_freq,
+ const std::string dev = "/dev/comedi0");
+
+/*!
+ * \brief sink using COMEDI
+ *
+ * The sink has one input stream of signed short integers.
+ *
+ * Input samples must be in the range [-32768,32767].
+ */
+class comedi_sink_s : public gr_sync_block {
+ friend comedi_sink_s_sptr
+ comedi_make_sink_s (int sampling_freq, const std::string dev);
+
+ // typedef for pointer to class work method
+ typedef int (comedi_sink_s::*work_t)(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+
+ unsigned int d_sampling_freq;
+ std::string d_device_name;
+
+ comedi_t *d_dev;
+ int d_subdevice;
+ int d_n_chan;
+ void *d_map;
+ int d_buffer_size;
+ unsigned d_buf_front;
+ unsigned d_buf_back;
+
+ // random stats
+ int d_nunderuns; // count of underruns
+
+ void output_error_msg (const char *msg, int err);
+ void bail (const char *msg, int err) throw (std::runtime_error);
+
+ protected:
+ comedi_sink_s (int sampling_freq, const std::string device_name);
+
+ public:
+ ~comedi_sink_s ();
+
+ bool check_topology (int ninputs, int noutputs);
+
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif /* INCLUDED_COMEDI_SINK_H */
diff --git a/gr-comedi/src/comedi_source_s.cc b/gr-comedi/src/comedi_source_s.cc
new file mode 100644
index 000000000..517f1440b
--- /dev/null
+++ b/gr-comedi/src/comedi_source_s.cc
@@ -0,0 +1,229 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <sys/mman.h>
+
+#include <comedi_source_s.h>
+#include <gr_io_signature.h>
+#include <stdio.h>
+#include <errno.h>
+#include <iostream>
+#include <stdexcept>
+#include <gri_comedi.h>
+
+
+// FIXME these should query some kind of user preference
+
+
+static std::string
+default_device_name ()
+{
+ return "/dev/comedi0";
+}
+
+// ----------------------------------------------------------------
+
+comedi_source_s_sptr
+comedi_make_source_s (int sampling_freq, const std::string dev)
+{
+ return gnuradio::get_initial_sptr(new comedi_source_s (sampling_freq, dev));
+}
+
+comedi_source_s::comedi_source_s (int sampling_freq,
+ const std::string device_name)
+ : gr_sync_block ("comedi_source_s",
+ gr_make_io_signature (0, 0, 0),
+ gr_make_io_signature (0, 0, 0)),
+ d_sampling_freq (sampling_freq),
+ d_device_name (device_name.empty() ? default_device_name() : device_name),
+ d_dev (0),
+ d_subdevice (0/*COMEDI_SUBD_AI*/),
+ d_n_chan (1), // number of input channels
+ d_map (0),
+ d_buffer_size (0),
+ d_buf_front (0),
+ d_buf_back (0)
+{
+ int aref=AREF_GROUND;
+ int range=0;
+
+ d_dev = comedi_open(d_device_name.c_str());
+ if (d_dev == 0){
+ comedi_perror(d_device_name.c_str());
+ throw std::runtime_error ("comedi_source_s");
+ }
+
+ unsigned int chanlist[256];
+
+ for(int i=0; i<d_n_chan; i++){
+ chanlist[i]=CR_PACK(i,range,aref);
+ }
+
+ comedi_cmd cmd;
+ int ret;
+
+ ret = comedi_get_cmd_generic_timed(d_dev,d_subdevice,&cmd,d_n_chan,(unsigned int)(1e9/sampling_freq));
+ if(ret<0)
+ bail ("comedi_get_cmd_generic_timed", comedi_errno());
+
+ // TODO: check period_ns is not to far off sampling_freq
+
+ d_buffer_size = comedi_get_buffer_size(d_dev, d_subdevice);
+ if (d_buffer_size <= 0)
+ bail ("comedi_get_buffer_size", comedi_errno());
+
+ d_map = mmap(NULL,d_buffer_size,PROT_READ,MAP_SHARED,comedi_fileno(d_dev),0);
+ if (d_map == MAP_FAILED)
+ bail ("mmap", errno);
+
+ cmd.chanlist = chanlist;
+ cmd.chanlist_len = d_n_chan;
+ cmd.scan_end_arg = d_n_chan;
+
+ cmd.stop_src=TRIG_NONE;
+ cmd.stop_arg=0;
+
+ /* comedi_command_test() tests a command to see if the
+ * trigger sources and arguments are valid for the subdevice.
+ * If a trigger source is invalid, it will be logically ANDed
+ * with valid values (trigger sources are actually bitmasks),
+ * which may or may not result in a valid trigger source.
+ * If an argument is invalid, it will be adjusted to the
+ * nearest valid value. In this way, for many commands, you
+ * can test it multiple times until it passes. Typically,
+ * if you can't get a valid command in two tests, the original
+ * command wasn't specified very well. */
+ ret = comedi_command_test(d_dev,&cmd);
+
+ if(ret<0)
+ bail ("comedi_command_test", comedi_errno());
+
+ ret = comedi_command_test(d_dev,&cmd);
+
+ if(ret<0)
+ bail ("comedi_command_test", comedi_errno());
+
+ /* start the command */
+ ret = comedi_command(d_dev,&cmd);
+
+ if(ret<0)
+ bail ("comedi_command", comedi_errno());
+
+ set_output_multiple (d_n_chan*sizeof(sampl_t));
+
+ assert(sizeof(sampl_t) == sizeof(short));
+ set_output_signature (gr_make_io_signature (1, 1, sizeof (sampl_t)));
+}
+
+bool
+comedi_source_s::check_topology (int ninputs, int noutputs)
+{
+ if (noutputs > d_n_chan)
+ throw std::runtime_error ("comedi_source_s");
+
+ return true;
+}
+
+comedi_source_s::~comedi_source_s ()
+{
+ if (d_map) {
+ munmap(d_map, d_buffer_size);
+ d_map = 0;
+ }
+
+ comedi_close(d_dev);
+}
+
+int
+comedi_source_s::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ int ret;
+
+ int work_left = noutput_items * sizeof(sampl_t) * d_n_chan;
+ sampl_t *pbuf = (sampl_t*)d_map;
+
+ do {
+
+ do {
+ ret = comedi_get_buffer_contents(d_dev,d_subdevice);
+ if (ret < 0)
+ bail ("comedi_get_buffer_contents", comedi_errno());
+
+ assert(ret % sizeof(sampl_t) == 0);
+ assert(work_left % sizeof(sampl_t) == 0);
+
+ ret = std::min(ret, work_left);
+ d_buf_front += ret;
+
+ assert(d_buffer_size%d_n_chan == 0);
+ if (d_buf_front-d_buf_back > (unsigned)d_buffer_size) {
+ d_buf_front+=d_buffer_size;
+ d_buf_back +=d_buffer_size;
+ }
+
+ if(d_buf_front==d_buf_back){
+ usleep(1000000*std::min(work_left,d_buffer_size/2)/(d_sampling_freq*sizeof(sampl_t)*d_n_chan));
+ continue;
+ }
+ } while (d_buf_front==d_buf_back);
+
+ for(unsigned i=d_buf_back/sizeof(sampl_t);i<d_buf_front/sizeof(sampl_t);i++){
+ int chan = i%d_n_chan;
+ int o_idx = noutput_items-work_left/d_n_chan/sizeof(sampl_t)+(i-d_buf_back/sizeof(sampl_t))/d_n_chan;
+
+ if (output_items[chan])
+ ((short*)(output_items[chan]))[o_idx] =
+ (int)pbuf[i%(d_buffer_size/sizeof(sampl_t))] - 32767;
+ }
+
+ ret = comedi_mark_buffer_read(d_dev,d_subdevice,d_buf_front-d_buf_back);
+ if(ret<0)
+ bail ("comedi_mark_buffer_read", comedi_errno());
+
+ work_left -= d_buf_front-d_buf_back;
+
+ d_buf_back = d_buf_front;
+
+ } while(work_left>0);
+
+ return noutput_items;
+}
+
+void
+comedi_source_s::output_error_msg (const char *msg, int err)
+{
+ fprintf (stderr, "comedi_source_s[%s]: %s: %s\n",
+ d_device_name.c_str(), msg, comedi_strerror(err));
+}
+
+void
+comedi_source_s::bail (const char *msg, int err) throw (std::runtime_error)
+{
+ output_error_msg (msg, err);
+ throw std::runtime_error ("comedi_source_s");
+}
diff --git a/gr-comedi/src/comedi_source_s.h b/gr-comedi/src/comedi_source_s.h
new file mode 100644
index 000000000..b9fde4c1e
--- /dev/null
+++ b/gr-comedi/src/comedi_source_s.h
@@ -0,0 +1,90 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005 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_COMEDI_SOURCE_S_H
+#define INCLUDED_COMEDI_SOURCE_S_H
+
+#include <gr_sync_block.h>
+#include <string>
+#include <comedilib.h>
+#include <stdexcept>
+
+class comedi_source_s;
+typedef boost::shared_ptr<comedi_source_s> comedi_source_s_sptr;
+
+/*!
+ * \brief make a COMEDI source.
+ *
+ * \param sampling_freq sampling rate in Hz
+ * \param dev COMEDI device name, e.g., "/dev/comedi0"
+ */
+comedi_source_s_sptr
+comedi_make_source_s (int sampling_freq,
+ const std::string dev = "/dev/comedi0");
+
+/*!
+ * \brief source using COMEDI
+ *
+ * The source has one to many input stream of signed short integers.
+ *
+ * Output samples will be in the range [-32768,32767].
+ */
+class comedi_source_s : public gr_sync_block {
+ friend comedi_source_s_sptr
+ comedi_make_source_s (int sampling_freq, const std::string dev);
+
+ // typedef for pointer to class work method
+ typedef int (comedi_source_s::*work_t)(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+
+ unsigned int d_sampling_freq;
+ std::string d_device_name;
+
+ comedi_t *d_dev;
+ int d_subdevice;
+ int d_n_chan;
+ void *d_map;
+ int d_buffer_size;
+ unsigned d_buf_front;
+ unsigned d_buf_back;
+
+ // random stats
+ int d_noverruns; // count of overruns
+
+ void output_error_msg (const char *msg, int err);
+ void bail (const char *msg, int err) throw (std::runtime_error);
+
+
+ protected:
+ comedi_source_s (int sampling_freq, const std::string device_name);
+
+ public:
+ ~comedi_source_s ();
+
+ bool check_topology (int ninputs, int noutputs);
+
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif /* INCLUDED_COMEDI_SOURCE_S_H */
diff --git a/gr-comedi/src/gri_comedi.cc b/gr-comedi/src/gri_comedi.cc
new file mode 100644
index 000000000..97b3ccd3e
--- /dev/null
+++ b/gr-comedi/src/gri_comedi.cc
@@ -0,0 +1,30 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005 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 <gri_comedi.h>
+#include <algorithm>
+
+
diff --git a/gr-comedi/src/gri_comedi.h b/gr-comedi/src/gri_comedi.h
new file mode 100644
index 000000000..571a41180
--- /dev/null
+++ b/gr-comedi/src/gri_comedi.h
@@ -0,0 +1,28 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005 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_GRI_COMEDI_H
+#define INCLUDED_GRI_COMEDI_H
+
+#include <stdio.h>
+
+#endif /* INCLUDED_GRI_COMEDI_H */
diff --git a/gr-comedi/src/qa_comedi.py b/gr-comedi/src/qa_comedi.py
new file mode 100755
index 000000000..a407ab62b
--- /dev/null
+++ b/gr-comedi/src/qa_comedi.py
@@ -0,0 +1,40 @@
+#!/usr/bin/env python
+#
+# Copyright 2005,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.
+#
+
+from gnuradio import gr, gr_unittest
+import comedi
+
+class qa_comedi (gr_unittest.TestCase):
+
+ def setUp (self):
+ self.tb = gr.top_block ()
+
+ def tearDown (self):
+ self.tb = None
+
+ def test_000_nop (self):
+ """Just see if we can import the module...
+ They may not have COMEDI library, etc. Don't try to run anything"""
+ pass
+
+if __name__ == '__main__':
+ gr_unittest.main ()
diff --git a/gr-fft/CMakeLists.txt b/gr-fft/CMakeLists.txt
new file mode 100644
index 000000000..7d76dc7f9
--- /dev/null
+++ b/gr-fft/CMakeLists.txt
@@ -0,0 +1,111 @@
+# 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.
+
+########################################################################
+# Setup dependencies
+########################################################################
+include(GrBoost)
+
+find_package(FFTW3f)
+
+########################################################################
+# Register component
+########################################################################
+include(GrComponent)
+
+GR_REGISTER_COMPONENT("gr-fft" ENABLE_GR_FFT
+ ENABLE_GRUEL
+ ENABLE_VOLK
+ Boost_FOUND
+ ENABLE_GR_CORE
+ FFTW3F_FOUND
+)
+
+GR_SET_GLOBAL(GR_FFT_INCLUDE_DIRS
+ ${CMAKE_CURRENT_SOURCE_DIR}/lib
+ ${CMAKE_CURRENT_SOURCE_DIR}/include
+)
+
+########################################################################
+# Begin conditional configuration
+########################################################################
+if(ENABLE_GR_FFT)
+
+########################################################################
+# Setup CPack components
+########################################################################
+include(GrPackage)
+CPACK_SET(CPACK_COMPONENT_GROUP_FFT_DESCRIPTION "GNU Radio FFT Blocks")
+
+CPACK_COMPONENT("fft_runtime"
+ GROUP "FFT"
+ DISPLAY_NAME "Runtime"
+ DESCRIPTION "Runtime"
+ DEPENDS "core_runtime"
+)
+
+CPACK_COMPONENT("fft_devel"
+ GROUP "FFT"
+ DISPLAY_NAME "Development"
+ DESCRIPTION "C++ headers, package config, import libraries"
+ DEPENDS "core_devel"
+)
+
+CPACK_COMPONENT("fft_python"
+ GROUP "FFT"
+ DISPLAY_NAME "Python"
+ DESCRIPTION "Python modules for runtime; GRC xml files"
+ DEPENDS "core_python;fft_runtime"
+)
+
+CPACK_COMPONENT("fft_swig"
+ GROUP "FFT"
+ DISPLAY_NAME "SWIG"
+ DESCRIPTION "SWIG development .i files"
+ DEPENDS "core_swig;fft_python;fft_devel"
+)
+
+########################################################################
+# Add subdirectories
+########################################################################
+add_subdirectory(include/fft)
+add_subdirectory(lib)
+if(ENABLE_PYTHON)
+ add_subdirectory(swig)
+ add_subdirectory(python)
+ add_subdirectory(grc)
+endif(ENABLE_PYTHON)
+#add_subdirectory(examples)
+add_subdirectory(doc)
+
+########################################################################
+# Create Pkg Config File
+########################################################################
+configure_file(
+ ${CMAKE_CURRENT_SOURCE_DIR}/gnuradio-fft.pc.in
+ ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-fft.pc
+@ONLY)
+
+install(
+ FILES ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-fft.pc
+ DESTINATION ${GR_LIBRARY_DIR}/pkgconfig
+ COMPONENT "fft_devel"
+)
+
+endif(ENABLE_GR_FFT)
diff --git a/gr-fft/doc/CMakeLists.txt b/gr-fft/doc/CMakeLists.txt
new file mode 100644
index 000000000..96c42f030
--- /dev/null
+++ b/gr-fft/doc/CMakeLists.txt
@@ -0,0 +1,23 @@
+# 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.
+
+install(
+ FILES README.fft
+ DESTINATION ${GR_PKG_DOC_DIR}
+)
diff --git a/gr-fft/doc/README.fft b/gr-fft/doc/README.fft
new file mode 100644
index 000000000..3ea9e81f8
--- /dev/null
+++ b/gr-fft/doc/README.fft
@@ -0,0 +1,13 @@
+This is the gr-fft package. It contains signal processing blocks to
+perform FFTs and FFT-related functionality.
+
+The Python namespace is in gnuradio.fft, which would be normally
+imported as:
+
+ from gnuradio import fft
+
+See the Doxygen documentation for details about the blocks available
+in this package. A quick listing of the details can be found in Python
+after importing by using:
+
+ help(fft)
diff --git a/gr-fft/doc/fft.dox b/gr-fft/doc/fft.dox
new file mode 100644
index 000000000..5bf612d84
--- /dev/null
+++ b/gr-fft/doc/fft.dox
@@ -0,0 +1,29 @@
+/*! \page page_fft FFT Signal Processing Blocks
+
+\section Introduction
+
+This is the gr-fft package. It contains signal processing blocks to
+perform FFTs and FFT-related functionality.
+
+The Python namespace is in gnuradio.fft, which would be normally
+imported as:
+
+\code
+ from gnuradio import fft
+\endcode
+
+See the Doxygen documentation for details about the blocks available
+in this package. A quick listing of the details can be found in Python
+after importing by using:
+
+\code
+ help(fft)
+\endcode
+
+\section Dependencies
+
+The FFT blocks require the following dependencies.
+
+\li fftw3f (>= 3.0) http://www.fftw.org/download.html
+
+*/
diff --git a/gr-fft/gnuradio-fft.pc.in b/gr-fft/gnuradio-fft.pc.in
new file mode 100644
index 000000000..eb4ddfd9f
--- /dev/null
+++ b/gr-fft/gnuradio-fft.pc.in
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: gnuradio-fft
+Description: GNU Radio's FFT signal processing blocks
+Requires: gnuradio-core
+Version: @LIBVER@
+Libs: -L${libdir} -lgnuradio-fft
+Cflags: -I${includedir}
diff --git a/gr-fft/grc/CMakeLists.txt b/gr-fft/grc/CMakeLists.txt
new file mode 100644
index 000000000..632a9aaad
--- /dev/null
+++ b/gr-fft/grc/CMakeLists.txt
@@ -0,0 +1,26 @@
+# 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.
+
+install(FILES
+ fft_block_tree.xml
+ fft_vxx.xml
+ goertzel_fc.xml
+ DESTINATION ${GRC_BLOCKS_DIR}
+ COMPONENT "fft_python"
+)
diff --git a/gr-fft/grc/fft_block_tree.xml b/gr-fft/grc/fft_block_tree.xml
new file mode 100644
index 000000000..3bda77eae
--- /dev/null
+++ b/gr-fft/grc/fft_block_tree.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+<!--
+###################################################
+##Block Tree for GR FFT blocks.
+###################################################
+ -->
+<cat>
+ <name></name> <!-- Blank for Root Name -->
+ <cat>
+ <name>FFT</name>
+ <block>fft_vxx</block>
+ <block>goertzel_fc</block>
+ </cat>
+</cat>
diff --git a/gr-fft/grc/fft_vxx.xml b/gr-fft/grc/fft_vxx.xml
new file mode 100644
index 000000000..69f12ace7
--- /dev/null
+++ b/gr-fft/grc/fft_vxx.xml
@@ -0,0 +1,88 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##FFT
+###################################################
+ -->
+<block>
+ <name>FFT</name>
+ <key>fft_vxx</key>
+ <import>from gnuradio import fft</import>
+ <import>from gnuradio import window</import>
+ <make>#if $type() == "complex"
+fft.fft_vcc($fft_size, $forward, $window, $shift, $nthreads)
+#else
+fft.fft_vfc($fft_size, $forward, $window, $nthreads)
+#end if</make>
+ <callback>set_nthreads($nthreads)</callback>
+ <param>
+ <name>Input Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>hide_shift:</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>hide_shift:all</opt>
+ </option>
+ </param>
+ <param>
+ <name>FFT Size</name>
+ <key>fft_size</key>
+ <value>1024</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Forward/Reverse</name>
+ <key>forward</key>
+ <type>enum</type>
+ <option>
+ <name>Forward</name>
+ <key>True</key>
+ </option>
+ <option>
+ <name>Reverse</name>
+ <key>False</key>
+ </option>
+ </param>
+ <param>
+ <name>Window</name>
+ <key>window</key>
+ <value>window.blackmanharris(1024)</value>
+ <type>real_vector</type>
+ </param>
+ <param>
+ <name>Shift</name>
+ <key>shift</key>
+ <type>enum</type>
+ <hide>$type.hide_shift</hide>
+ <option>
+ <name>Yes</name>
+ <key>True</key>
+ </option>
+ <option>
+ <name>No</name>
+ <key>False</key>
+ </option>
+ </param>
+ <param>
+ <name>Num. Threads</name>
+ <key>nthreads</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <vlen>$fft_size</vlen>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>complex</type>
+ <vlen>$fft_size</vlen>
+ </source>
+</block>
diff --git a/gr-fft/grc/goertzel_fc.xml b/gr-fft/grc/goertzel_fc.xml
new file mode 100644
index 000000000..371284358
--- /dev/null
+++ b/gr-fft/grc/goertzel_fc.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Goertzel
+###################################################
+ -->
+<block>
+ <name>Goertzel</name>
+ <key>goertzel_fc</key>
+ <import>from gnuradio import fft</import>
+ <make>fft.goertzel_fc($rate, $len, $freq)</make>
+ <callback>set_freq($freq)</callback>
+ <callback>set_rate($rate)</callback>
+ <param>
+ <name>Rate</name>
+ <key>rate</key>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Length</name>
+ <key>len</key>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Frequency</name>
+ <key>freq</key>
+ <type>real</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>float</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>complex</type>
+ </source>
+</block>
diff --git a/gr-fft/include/fft/CMakeLists.txt b/gr-fft/include/fft/CMakeLists.txt
new file mode 100644
index 000000000..bce3da674
--- /dev/null
+++ b/gr-fft/include/fft/CMakeLists.txt
@@ -0,0 +1,33 @@
+# 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.
+
+########################################################################
+# Install header files
+########################################################################
+install(FILES
+ api.h
+ fft.h
+ fft_vcc.h
+ fft_vfc.h
+ goertzel.h
+ goertzel_fc.h
+ DESTINATION ${GR_INCLUDE_DIR}/gnuradio/fft
+ COMPONENT "fft_devel"
+)
+
diff --git a/gr-fft/include/fft/api.h b/gr-fft/include/fft/api.h
new file mode 100644
index 000000000..eef456373
--- /dev/null
+++ b/gr-fft/include/fft/api.h
@@ -0,0 +1,33 @@
+/*
+ * 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.
+ */
+
+#ifndef INCLUDED_FFT_API_H
+#define INCLUDED_FFT_API_H
+
+#include <gruel/attributes.h>
+
+#ifdef gnuradio_fft_EXPORTS
+# define FFT_API __GR_ATTR_EXPORT
+#else
+# define FFT_API __GR_ATTR_IMPORT
+#endif
+
+#endif /* INCLUDED_FFT_API_H */
diff --git a/gr-fft/include/fft/fft.h b/gr-fft/include/fft/fft.h
new file mode 100644
index 000000000..e3fd3f278
--- /dev/null
+++ b/gr-fft/include/fft/fft.h
@@ -0,0 +1,195 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2003,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.
+ */
+
+#ifndef _FFT_FFT_H_
+#define _FFT_FFT_H_
+
+/*
+ * Wrappers for FFTW single precision 1d dft
+ */
+
+#include <fft/api.h>
+#include <gr_complex.h>
+#include <boost/thread.hpp>
+
+namespace gr {
+ namespace fft {
+
+
+ /*! \brief Helper function for allocating complex fft buffers
+ */
+ FFT_API gr_complex* malloc_complex(int size);
+
+ /*! \brief Helper function for allocating float fft buffers
+ */
+ FFT_API float* malloc_float(int size);
+
+ /*! \brief Helper function for freeing fft buffers
+ */
+ FFT_API void free(void *b);
+
+ /*!
+ * \brief Export reference to planner mutex for those apps that
+ * want to use FFTW w/o using the fft_impl_fftw* classes.
+ */
+ class FFT_API planner {
+ public:
+ typedef boost::mutex::scoped_lock scoped_lock;
+ /*!
+ * Return reference to planner mutex
+ */
+ static boost::mutex &mutex();
+ };
+
+ /*!
+ * \brief FFT: complex in, complex out
+ * \ingroup misc
+ */
+ class FFT_API fft_complex {
+ int d_fft_size;
+ int d_nthreads;
+ gr_complex *d_inbuf;
+ gr_complex *d_outbuf;
+ void *d_plan;
+
+ public:
+ fft_complex(int fft_size, bool forward = true, int nthreads=1);
+ virtual ~fft_complex();
+
+ /*
+ * These return pointers to buffers owned by fft_impl_fft_complex
+ * into which input and output take place. It's done this way in
+ * order to ensure optimal alignment for SIMD instructions.
+ */
+ gr_complex *get_inbuf() const { return d_inbuf; }
+ gr_complex *get_outbuf() const { return d_outbuf; }
+
+ int inbuf_length() const { return d_fft_size; }
+ int outbuf_length() const { return d_fft_size; }
+
+ /*!
+ * Set the number of threads to use for caclulation.
+ */
+ void set_nthreads(int n);
+
+ /*!
+ * Get the number of threads being used by FFTW
+ */
+ int nthreads() const { return d_nthreads; }
+
+ /*!
+ * compute FFT. The input comes from inbuf, the output is placed in
+ * outbuf.
+ */
+ void execute();
+ };
+
+ /*!
+ * \brief FFT: real in, complex out
+ * \ingroup misc
+ */
+ class FFT_API fft_real_fwd {
+ int d_fft_size;
+ int d_nthreads;
+ float *d_inbuf;
+ gr_complex *d_outbuf;
+ void *d_plan;
+
+ public:
+ fft_real_fwd (int fft_size, int nthreads=1);
+ virtual ~fft_real_fwd ();
+
+ /*
+ * These return pointers to buffers owned by fft_impl_fft_real_fwd
+ * into which input and output take place. It's done this way in
+ * order to ensure optimal alignment for SIMD instructions.
+ */
+ float *get_inbuf() const { return d_inbuf; }
+ gr_complex *get_outbuf() const { return d_outbuf; }
+
+ int inbuf_length() const { return d_fft_size; }
+ int outbuf_length() const { return d_fft_size / 2 + 1; }
+
+ /*!
+ * Set the number of threads to use for caclulation.
+ */
+ void set_nthreads(int n);
+
+ /*!
+ * Get the number of threads being used by FFTW
+ */
+ int nthreads() const { return d_nthreads; }
+
+ /*!
+ * compute FFT. The input comes from inbuf, the output is placed in
+ * outbuf.
+ */
+ void execute();
+ };
+
+ /*!
+ * \brief FFT: complex in, float out
+ * \ingroup misc
+ */
+ class FFT_API fft_real_rev {
+ int d_fft_size;
+ int d_nthreads;
+ gr_complex *d_inbuf;
+ float *d_outbuf;
+ void *d_plan;
+
+ public:
+ fft_real_rev(int fft_size, int nthreads=1);
+ virtual ~fft_real_rev();
+
+ /*
+ * These return pointers to buffers owned by fft_impl_fft_real_rev
+ * into which input and output take place. It's done this way in
+ * order to ensure optimal alignment for SIMD instructions.
+ */
+ gr_complex *get_inbuf() const { return d_inbuf; }
+ float *get_outbuf() const { return d_outbuf; }
+
+ int inbuf_length() const { return d_fft_size / 2 + 1; }
+ int outbuf_length() const { return d_fft_size; }
+
+ /*!
+ * Set the number of threads to use for caclulation.
+ */
+ void set_nthreads(int n);
+
+ /*!
+ * Get the number of threads being used by FFTW
+ */
+ int nthreads() const { return d_nthreads; }
+
+ /*!
+ * compute FFT. The input comes from inbuf, the output is placed in
+ * outbuf.
+ */
+ void execute();
+ };
+
+ } /* namespace fft */
+} /*namespace gr */
+
+#endif /* _FFT_FFT_H_ */
diff --git a/gr-fft/include/fft/fft_vcc.h b/gr-fft/include/fft/fft_vcc.h
new file mode 100644
index 000000000..cb07b166d
--- /dev/null
+++ b/gr-fft/include/fft/fft_vcc.h
@@ -0,0 +1,57 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2007,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.
+ */
+
+#ifndef INCLUDED_FFT_FFT_VCC_H
+#define INCLUDED_FFT_FFT_VCC_H
+
+#include <fft/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace fft {
+
+ class FFT_API fft_vcc : virtual public gr_sync_block
+ {
+ public:
+
+ // gr::fft::fft_vcc::sptr
+ typedef boost::shared_ptr<fft_vcc> sptr;
+
+ /*!
+ * \brief Compute forward or reverse FFT. complex vector in / complex vector out.
+ * \ingroup dft_blk
+ */
+ static sptr make(int fft_size, bool forward,
+ const std::vector<float> &window,
+ bool shift=false, int nthreads=1);
+
+ virtual void set_nthreads(int n) = 0;
+
+ virtual int nthreads() const = 0;
+
+ virtual bool set_window(const std::vector<float> &window) = 0;
+ };
+
+ } /* namespace fft */
+} /* namespace gr */
+
+#endif /* INCLUDED_FFT_FFT_VCC_H */
diff --git a/gr-fft/include/fft/fft_vfc.h b/gr-fft/include/fft/fft_vfc.h
new file mode 100644
index 000000000..ec441d66a
--- /dev/null
+++ b/gr-fft/include/fft/fft_vfc.h
@@ -0,0 +1,57 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,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.
+ */
+
+#ifndef INCLUDED_FFT_FFT_VFC_H
+#define INCLUDED_FFT_FFT_VFC_H
+
+#include <fft/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace fft {
+
+ class FFT_API fft_vfc : virtual public gr_sync_block
+ {
+ public:
+
+ // gr::fft::fft_vfc::sptr
+ typedef boost::shared_ptr<fft_vfc> sptr;
+
+ /*!
+ * \brief Compute forward or reverse FFT. float vector in / complex vector out.
+ * \ingroup dft_blk
+ */
+ static sptr make(int fft_size, bool forward,
+ const std::vector<float> &window,
+ int nthreads=1);
+
+ virtual void set_nthreads(int n) = 0;
+
+ virtual int nthreads() const = 0;
+
+ virtual bool set_window(const std::vector<float> &window) = 0;
+ };
+
+ } /* namespace fft */
+} /* namespace gr */
+
+#endif /* INCLUDED_FFT_FFT_VFC_H */
diff --git a/gr-fft/include/fft/goertzel.h b/gr-fft/include/fft/goertzel.h
new file mode 100644
index 000000000..ff37355e6
--- /dev/null
+++ b/gr-fft/include/fft/goertzel.h
@@ -0,0 +1,64 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006,2011,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 INCLUDED_FFT_IMPL_GOERTZEL_H
+#define INCLUDED_FFT_IMPL_GOERTZEL_H
+
+#include <fft/api.h>
+#include <gr_types.h>
+
+namespace gr {
+ namespace fft {
+
+ /*!
+ * \brief Implements Goertzel single-bin DFT calculation
+ * \ingroup misc
+ */
+ class FFT_API goertzel
+ {
+ public:
+ goertzel(){}
+ goertzel(int rate, int len, float freq);
+
+ void set_params(int rate, int len, float freq);
+
+ // Process a input array
+ gr_complex batch(float *in);
+
+ // Process sample by sample
+ void input(const float &in);
+ gr_complex output();
+ bool ready() const { return d_processed == d_len; }
+
+ private:
+ float d_d1;
+ float d_d2;
+ float d_wr;
+ float d_wi;
+ int d_len;
+ int d_processed;
+ };
+
+ } /* namespace fft */
+} /* namespace gr */
+
+#endif /* INCLUDED_FFT_IMPL_GOERTZEL_H */
diff --git a/gr-fft/include/fft/goertzel_fc.h b/gr-fft/include/fft/goertzel_fc.h
new file mode 100644
index 000000000..5b3c8f1c4
--- /dev/null
+++ b/gr-fft/include/fft/goertzel_fc.h
@@ -0,0 +1,57 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006,2011,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 INCLUDED_FFT_GOERTZEL_FC_H
+#define INCLUDED_FFT_GOERTZEL_FC_H
+
+#include <fft/api.h>
+#include <gr_sync_decimator.h>
+
+namespace gr {
+ namespace fft {
+
+ class FFT_API goertzel_fc : virtual public gr_sync_decimator
+ {
+ public:
+
+ // gr::fft::goertzel_fc::sptr
+ typedef boost::shared_ptr<goertzel_fc> sptr;
+
+ /*!
+ * \brief Goertzel single-bin DFT calculation.
+ * \ingroup dft_blk
+ */
+ static sptr make(int rate, int len, float freq);
+
+ virtual void set_freq (float freq) = 0;
+
+ virtual void set_rate (int rate) = 0;
+
+ virtual float freq() = 0;
+
+ virtual int rate() = 0;
+ };
+
+ } /* namespace fft */
+} /* namespace gr */
+
+#endif /* INCLUDED_FFT_GOERTZEL_FC_H */
diff --git a/gr-fft/lib/CMakeLists.txt b/gr-fft/lib/CMakeLists.txt
new file mode 100644
index 000000000..26fcaa7cd
--- /dev/null
+++ b/gr-fft/lib/CMakeLists.txt
@@ -0,0 +1,60 @@
+# 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.
+
+########################################################################
+# Setup the include and linker paths
+########################################################################
+include_directories(
+ ${CMAKE_CURRENT_SOURCE_DIR}
+ ${CMAKE_CURRENT_BINARY_DIR}
+ ${GR_FFT_INCLUDE_DIRS}
+ ${GNURADIO_CORE_INCLUDE_DIRS}
+ ${GRUEL_INCLUDE_DIRS}
+ ${Boost_INCLUDE_DIRS}
+ ${FFTW3F_INCLUDE_DIRS}
+)
+
+link_directories(${Boost_LIBRARY_DIRS})
+link_directories(${FFTW3F_LIBRARY_DIRS})
+
+########################################################################
+# Setup library
+########################################################################
+list(APPEND fft_sources
+ fft.cc
+ fft_vcc_fftw.cc
+ fft_vfc_fftw.cc
+ goertzel_fc_impl.cc
+ goertzel.cc
+)
+
+list(APPEND fft_libs
+ gnuradio-core
+ ${Boost_LIBRARIES}
+ ${FFTW3F_LIBRARIES}
+)
+
+if(FFTW3F_THREADS_LIBRARIES)
+ list(APPEND fft_libs ${FFTW3F_THREADS_LIBRARIES})
+ add_definitions("-DFFTW3F_THREADS")
+endif()
+
+add_library(gnuradio-fft SHARED ${fft_sources})
+target_link_libraries(gnuradio-fft ${fft_libs})
+GR_LIBRARY_FOO(gnuradio-fft RUNTIME_COMPONENT "fft_runtime" DEVEL_COMPONENT "fft_devel")
diff --git a/gr-fft/lib/fft.cc b/gr-fft/lib/fft.cc
new file mode 100644
index 000000000..6074236e1
--- /dev/null
+++ b/gr-fft/lib/fft.cc
@@ -0,0 +1,338 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2003,2008,2011,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.
+ */
+
+#include <fft/fft.h>
+#include <gr_sys_paths.h>
+#include <fftw3.h>
+
+#ifdef _MSC_VER //http://www.fftw.org/install/windows.html#DLLwisdom
+static void my_fftw_write_char(char c, void *f) { fputc(c, (FILE *) f); }
+#define fftw_export_wisdom_to_file(f) fftw_export_wisdom(my_fftw_write_char, (void*) (f))
+#define fftwf_export_wisdom_to_file(f) fftwf_export_wisdom(my_fftw_write_char, (void*) (f))
+#define fftwl_export_wisdom_to_file(f) fftwl_export_wisdom(my_fftw_write_char, (void*) (f))
+
+static int my_fftw_read_char(void *f) { return fgetc((FILE *) f); }
+#define fftw_import_wisdom_from_file(f) fftw_import_wisdom(my_fftw_read_char, (void*) (f))
+#define fftwf_import_wisdom_from_file(f) fftwf_import_wisdom(my_fftw_read_char, (void*) (f))
+#define fftwl_import_wisdom_from_file(f) fftwl_import_wisdom(my_fftw_read_char, (void*) (f))
+#endif //_MSC_VER
+
+#include <gr_complex.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+#include <cassert>
+#include <stdexcept>
+
+#include <boost/filesystem/operations.hpp>
+#include <boost/filesystem/path.hpp>
+namespace fs = boost::filesystem;
+
+namespace gr {
+ namespace fft {
+
+ gr_complex *
+ malloc_complex(int size)
+ {
+ return (gr_complex*)fftwf_malloc(sizeof(gr_complex)*size);
+ }
+
+ float *
+ malloc_float(int size)
+ {
+ return (float*)fftwf_malloc(sizeof(float)*size);
+ }
+
+ void
+ free(void *b)
+ {
+ fftwf_free(b);
+ }
+
+ boost::mutex &
+ planner::mutex()
+ {
+ static boost::mutex s_planning_mutex;
+
+ return s_planning_mutex;
+ }
+
+ static const char *
+ wisdom_filename()
+ {
+ static fs::path path;
+ path = fs::path(gr_appdata_path()) / ".gr_fftw_wisdom";
+ return path.string().c_str();
+ }
+
+ static void
+ import_wisdom()
+ {
+ const char *filename = wisdom_filename ();
+ FILE *fp = fopen (filename, "r");
+ if (fp != 0){
+ int r = fftwf_import_wisdom_from_file (fp);
+ fclose (fp);
+ if (!r){
+ fprintf (stderr, "gr::fft: can't import wisdom from %s\n", filename);
+ }
+ }
+ }
+
+ static void
+ config_threading(int nthreads)
+ {
+ static int fftw_threads_inited = 0;
+
+#ifdef FFTW3F_THREADS
+ if (fftw_threads_inited == 0)
+ {
+ fftw_threads_inited = 1;
+ fftwf_init_threads();
+ }
+
+ fftwf_plan_with_nthreads(nthreads);
+#endif
+ }
+
+ static void
+ export_wisdom()
+ {
+ const char *filename = wisdom_filename ();
+ FILE *fp = fopen (filename, "w");
+ if (fp != 0){
+ fftwf_export_wisdom_to_file (fp);
+ fclose (fp);
+ }
+ else {
+ fprintf (stderr, "fft_impl_fftw: ");
+ perror (filename);
+ }
+ }
+
+// ----------------------------------------------------------------
+
+ fft_complex::fft_complex(int fft_size, bool forward, int nthreads)
+ {
+ // Hold global mutex during plan construction and destruction.
+ planner::scoped_lock lock(planner::mutex());
+
+ assert (sizeof (fftwf_complex) == sizeof (gr_complex));
+
+ if (fft_size <= 0)
+ throw std::out_of_range ("fft_impl_fftw: invalid fft_size");
+
+ d_fft_size = fft_size;
+ d_inbuf = (gr_complex *) fftwf_malloc (sizeof (gr_complex) * inbuf_length ());
+ if (d_inbuf == 0)
+ throw std::runtime_error ("fftwf_malloc");
+
+ d_outbuf = (gr_complex *) fftwf_malloc (sizeof (gr_complex) * outbuf_length ());
+ if (d_outbuf == 0){
+ fftwf_free (d_inbuf);
+ throw std::runtime_error ("fftwf_malloc");
+ }
+
+ d_nthreads = nthreads;
+ config_threading(nthreads);
+ import_wisdom(); // load prior wisdom from disk
+
+ d_plan = fftwf_plan_dft_1d (fft_size,
+ reinterpret_cast<fftwf_complex *>(d_inbuf),
+ reinterpret_cast<fftwf_complex *>(d_outbuf),
+ forward ? FFTW_FORWARD : FFTW_BACKWARD,
+ FFTW_MEASURE);
+
+ if (d_plan == NULL) {
+ fprintf(stderr, "gr::fft: error creating plan\n");
+ throw std::runtime_error ("fftwf_plan_dft_1d failed");
+ }
+ export_wisdom(); // store new wisdom to disk
+ }
+
+ fft_complex::~fft_complex()
+ {
+ // Hold global mutex during plan construction and destruction.
+ planner::scoped_lock lock(planner::mutex());
+
+ fftwf_destroy_plan ((fftwf_plan) d_plan);
+ fftwf_free (d_inbuf);
+ fftwf_free (d_outbuf);
+ }
+
+ void
+ fft_complex::set_nthreads(int n)
+ {
+ if (n <= 0)
+ throw std::out_of_range ("gr::fft: invalid number of threads");
+ d_nthreads = n;
+
+#ifdef FFTW3F_THREADS
+ fftwf_plan_with_nthreads(d_nthreads);
+#endif
+ }
+
+ void
+ fft_complex::execute()
+ {
+ fftwf_execute((fftwf_plan) d_plan);
+ }
+
+// ----------------------------------------------------------------
+
+ fft_real_fwd::fft_real_fwd (int fft_size, int nthreads)
+ {
+ // Hold global mutex during plan construction and destruction.
+ planner::scoped_lock lock(planner::mutex());
+
+ assert (sizeof (fftwf_complex) == sizeof (gr_complex));
+
+ if (fft_size <= 0)
+ throw std::out_of_range ("gr::fft: invalid fft_size");
+
+ d_fft_size = fft_size;
+ d_inbuf = (float *) fftwf_malloc (sizeof (float) * inbuf_length ());
+ if (d_inbuf == 0)
+ throw std::runtime_error ("fftwf_malloc");
+
+ d_outbuf = (gr_complex *) fftwf_malloc (sizeof (gr_complex) * outbuf_length ());
+ if (d_outbuf == 0){
+ fftwf_free (d_inbuf);
+ throw std::runtime_error ("fftwf_malloc");
+ }
+
+ d_nthreads = nthreads;
+ config_threading(nthreads);
+ import_wisdom(); // load prior wisdom from disk
+
+ d_plan = fftwf_plan_dft_r2c_1d (fft_size,
+ d_inbuf,
+ reinterpret_cast<fftwf_complex *>(d_outbuf),
+ FFTW_MEASURE);
+
+ if (d_plan == NULL) {
+ fprintf(stderr, "gr::fft::fft_real_fwd: error creating plan\n");
+ throw std::runtime_error ("fftwf_plan_dft_r2c_1d failed");
+ }
+ export_wisdom(); // store new wisdom to disk
+ }
+
+ fft_real_fwd::~fft_real_fwd()
+ {
+ // Hold global mutex during plan construction and destruction.
+ planner::scoped_lock lock(planner::mutex());
+
+ fftwf_destroy_plan ((fftwf_plan) d_plan);
+ fftwf_free (d_inbuf);
+ fftwf_free (d_outbuf);
+ }
+
+ void
+ fft_real_fwd::set_nthreads(int n)
+ {
+ if (n <= 0)
+ throw std::out_of_range ("gr::fft::fft_real_fwd::set_nthreads: invalid number of threads");
+ d_nthreads = n;
+
+#ifdef FFTW3F_THREADS
+ fftwf_plan_with_nthreads(d_nthreads);
+#endif
+ }
+
+ void
+ fft_real_fwd::execute()
+ {
+ fftwf_execute ((fftwf_plan) d_plan);
+ }
+
+ // ----------------------------------------------------------------
+
+ fft_real_rev::fft_real_rev(int fft_size, int nthreads)
+ {
+ // Hold global mutex during plan construction and destruction.
+ planner::scoped_lock lock(planner::mutex());
+
+ assert (sizeof (fftwf_complex) == sizeof (gr_complex));
+
+ if (fft_size <= 0)
+ throw std::out_of_range ("gr::fft::fft_real_rev: invalid fft_size");
+
+ d_fft_size = fft_size;
+ d_inbuf = (gr_complex *) fftwf_malloc (sizeof (gr_complex) * inbuf_length ());
+ if (d_inbuf == 0)
+ throw std::runtime_error ("fftwf_malloc");
+
+ d_outbuf = (float *) fftwf_malloc (sizeof (float) * outbuf_length ());
+ if (d_outbuf == 0){
+ fftwf_free (d_inbuf);
+ throw std::runtime_error ("fftwf_malloc");
+ }
+
+ d_nthreads = nthreads;
+ config_threading(nthreads);
+ import_wisdom(); // load prior wisdom from disk
+
+ // FIXME If there's ever a chance that the planning functions
+ // will be called in multiple threads, we've got to ensure single
+ // threaded access. They are not thread-safe.
+ d_plan = fftwf_plan_dft_c2r_1d (fft_size,
+ reinterpret_cast<fftwf_complex *>(d_inbuf),
+ d_outbuf,
+ FFTW_MEASURE);
+
+ if (d_plan == NULL) {
+ fprintf(stderr, "gr::fft::fft_real_rev: error creating plan\n");
+ throw std::runtime_error ("fftwf_plan_dft_c2r_1d failed");
+ }
+ export_wisdom (); // store new wisdom to disk
+ }
+
+ fft_real_rev::~fft_real_rev ()
+ {
+ // Hold global mutex during plan construction and destruction.
+ planner::scoped_lock lock(planner::mutex());
+
+ fftwf_destroy_plan ((fftwf_plan) d_plan);
+ fftwf_free (d_inbuf);
+ fftwf_free (d_outbuf);
+ }
+
+ void
+ fft_real_rev::set_nthreads(int n)
+ {
+ if (n <= 0)
+ throw std::out_of_range ("gr::fft::fft_real_rev::set_nthreads: invalid number of threads");
+ d_nthreads = n;
+
+#ifdef FFTW3F_THREADS
+ fftwf_plan_with_nthreads(d_nthreads);
+#endif
+ }
+
+ void
+ fft_real_rev::execute ()
+ {
+ fftwf_execute ((fftwf_plan) d_plan);
+ }
+
+ } /* namespace fft */
+} /* namespace gr */
diff --git a/gr-fft/lib/fft_vcc_fftw.cc b/gr-fft/lib/fft_vcc_fftw.cc
new file mode 100644
index 000000000..ebcd5ec53
--- /dev/null
+++ b/gr-fft/lib/fft_vcc_fftw.cc
@@ -0,0 +1,147 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2007,2008,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 "fft_vcc_fftw.h"
+#include <gr_io_signature.h>
+#include <math.h>
+#include <string.h>
+
+namespace gr {
+ namespace fft {
+
+ fft_vcc::sptr fft_vcc::make(int fft_size, bool forward,
+ const std::vector<float> &window,
+ bool shift, int nthreads)
+ {
+ return gnuradio::get_initial_sptr(new fft_vcc_fftw
+ (fft_size, forward, window,
+ shift, nthreads));
+ }
+
+ fft_vcc_fftw::fft_vcc_fftw(int fft_size, bool forward,
+ const std::vector<float> &window,
+ bool shift, int nthreads)
+ : gr_sync_block("fft_vcc_fftw",
+ gr_make_io_signature(1, 1, fft_size * sizeof(gr_complex)),
+ gr_make_io_signature(1, 1, fft_size * sizeof(gr_complex))),
+ d_fft_size(fft_size), d_forward(forward), d_shift(shift)
+ {
+ d_fft = new fft_complex(d_fft_size, forward, nthreads);
+ }
+
+ fft_vcc_fftw::~fft_vcc_fftw()
+ {
+ delete d_fft;
+ }
+
+ void
+ fft_vcc_fftw::set_nthreads(int n)
+ {
+ d_fft->set_nthreads(n);
+ }
+
+ int
+ fft_vcc_fftw::nthreads() const
+ {
+ return d_fft->nthreads();
+ }
+
+ bool
+ fft_vcc_fftw::set_window(const std::vector<float> &window)
+ {
+ if(window.size()==0 || window.size()==d_fft_size) {
+ d_window=window;
+ return true;
+ }
+ else
+ return false;
+ }
+
+ int
+ fft_vcc_fftw::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const gr_complex *in = (const gr_complex *) input_items[0];
+ gr_complex *out = (gr_complex *) output_items[0];
+
+ unsigned int input_data_size = input_signature()->sizeof_stream_item (0);
+ unsigned int output_data_size = output_signature()->sizeof_stream_item (0);
+
+ int count = 0;
+
+ while(count++ < noutput_items) {
+
+ // copy input into optimally aligned buffer
+ if(d_window.size()) {
+ gr_complex *dst = d_fft->get_inbuf();
+ if(!d_forward && d_shift) {
+ unsigned int offset = (!d_forward && d_shift)?(d_fft_size/2):0;
+ int fft_m_offset = d_fft_size - offset;
+ for(unsigned int i = 0; i < offset; i++) // apply window
+ dst[i+fft_m_offset] = in[i] * d_window[i];
+ for(unsigned int i = offset; i < d_fft_size; i++) // apply window
+ dst[i-offset] = in[i] * d_window[i];
+ }
+ else {
+ for(unsigned int i = 0; i < d_fft_size; i++) // apply window
+ dst[i] = in[i] * d_window[i];
+ }
+ }
+ else {
+ if(!d_forward && d_shift) { // apply an ifft shift on the data
+ gr_complex *dst = d_fft->get_inbuf();
+ unsigned int len = (unsigned int)(floor(d_fft_size/2.0)); // half length of complex array
+ memcpy(&dst[0], &in[len], sizeof(gr_complex)*(d_fft_size - len));
+ memcpy(&dst[d_fft_size - len], &in[0], sizeof(gr_complex)*len);
+ }
+ else {
+ memcpy(d_fft->get_inbuf(), in, input_data_size);
+ }
+ }
+
+ // compute the fft
+ d_fft->execute();
+
+ // copy result to our output
+ if(d_forward && d_shift) { // apply a fft shift on the data
+ unsigned int len = (unsigned int)(ceil(d_fft_size/2.0));
+ memcpy(&out[0], &d_fft->get_outbuf()[len], sizeof(gr_complex)*(d_fft_size - len));
+ memcpy(&out[d_fft_size - len], &d_fft->get_outbuf()[0], sizeof(gr_complex)*len);
+ }
+ else {
+ memcpy (out, d_fft->get_outbuf (), output_data_size);
+ }
+
+ in += d_fft_size;
+ out += d_fft_size;
+ }
+
+ return noutput_items;
+ }
+
+ } /* namespace fft */
+} /* namespace gr */
diff --git a/gr-fft/lib/fft_vcc_fftw.h b/gr-fft/lib/fft_vcc_fftw.h
new file mode 100644
index 000000000..ea15dd07b
--- /dev/null
+++ b/gr-fft/lib/fft_vcc_fftw.h
@@ -0,0 +1,60 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2007,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.
+ */
+
+#ifndef INCLUDED_FFT_FFT_VCC_FFTW_IMPL_H
+#define INCLUDED_FFT_FFT_VCC_FFTW_IMPL_H
+
+#include <fft/fft_vcc.h>
+#include <fft/fft.h>
+
+namespace gr {
+ namespace fft {
+
+ class FFT_API fft_vcc_fftw : public fft_vcc
+ {
+ private:
+ fft_complex *d_fft;
+ unsigned int d_fft_size;
+ std::vector<float> d_window;
+ bool d_forward;
+ bool d_shift;
+
+ public:
+ fft_vcc_fftw(int fft_size, bool forward,
+ const std::vector<float> &window,
+ bool shift, int nthreads=1);
+
+ ~fft_vcc_fftw();
+
+ void set_nthreads(int n);
+ int nthreads() const;
+ bool set_window(const std::vector<float> &window);
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace fft */
+} /* namespace gr */
+
+#endif /* INCLUDED_FFT_FFT_VCC_FFTW_IMPL_H */
diff --git a/gr-fft/lib/fft_vfc_fftw.cc b/gr-fft/lib/fft_vfc_fftw.cc
new file mode 100644
index 000000000..890dac7be
--- /dev/null
+++ b/gr-fft/lib/fft_vfc_fftw.cc
@@ -0,0 +1,124 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2007,2008,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 "fft_vfc_fftw.h"
+#include <gr_io_signature.h>
+#include <math.h>
+#include <string.h>
+
+namespace gr {
+ namespace fft {
+
+ fft_vfc::sptr fft_vfc::make(int fft_size, bool forward,
+ const std::vector<float> &window,
+ int nthreads)
+ {
+ return gnuradio::get_initial_sptr(new fft_vfc_fftw
+ (fft_size, forward, window,
+ nthreads));
+ }
+
+ fft_vfc_fftw::fft_vfc_fftw(int fft_size, bool forward,
+ const std::vector<float> &window,
+ int nthreads)
+ : gr_sync_block("fft_vfc_fftw",
+ gr_make_io_signature(1, 1, fft_size * sizeof(float)),
+ gr_make_io_signature(1, 1, fft_size * sizeof(gr_complex))),
+ d_fft_size(fft_size), d_forward(forward)
+ {
+ d_fft = new fft_complex(d_fft_size, forward, nthreads);
+ }
+
+ fft_vfc_fftw::~fft_vfc_fftw()
+ {
+ delete d_fft;
+ }
+
+ void
+ fft_vfc_fftw::set_nthreads(int n)
+ {
+ d_fft->set_nthreads(n);
+ }
+
+ int
+ fft_vfc_fftw::nthreads() const
+ {
+ return d_fft->nthreads();
+ }
+
+ bool
+ fft_vfc_fftw::set_window(const std::vector<float> &window)
+ {
+ if(window.size()==0 || window.size()==d_fft_size) {
+ d_window=window;
+ return true;
+ }
+ else
+ return false;
+ }
+
+ int
+ fft_vfc_fftw::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const float *in = (const float *)input_items[0];
+ gr_complex *out = (gr_complex *)output_items[0];
+
+ unsigned int output_data_size = output_signature()->sizeof_stream_item (0);
+
+ int count = 0;
+
+ while(count++ < noutput_items) {
+
+ // copy input into optimally aligned buffer
+ if(d_window.size()) {
+ gr_complex *dst = d_fft->get_inbuf();
+ for(unsigned int i = 0; i < d_fft_size; i++) // apply window
+ dst[i] = in[i] * d_window[i];
+ }
+ else {
+ gr_complex *dst = d_fft->get_inbuf();
+ for(unsigned int i = 0; i < d_fft_size; i++) // float to complex conversion
+ dst[i] = in[i];
+ }
+
+ // compute the fft
+ d_fft->execute();
+
+ // copy result to output stream
+ memcpy(out, d_fft->get_outbuf(), output_data_size);
+
+ in += d_fft_size;
+ out += d_fft_size;
+ }
+
+ return noutput_items;
+ }
+
+ } /* namespace fft */
+} /* namespace gr */
+
diff --git a/gr-fft/lib/fft_vfc_fftw.h b/gr-fft/lib/fft_vfc_fftw.h
new file mode 100644
index 000000000..1b6f78ba6
--- /dev/null
+++ b/gr-fft/lib/fft_vfc_fftw.h
@@ -0,0 +1,59 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2007,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.
+ */
+
+#ifndef INCLUDED_FFT_FFT_VFC_FFTW_IMPL_H
+#define INCLUDED_FFT_FFT_VFC_FFTW_IMPL_H
+
+#include <fft/fft_vfc.h>
+#include <fft/fft.h>
+
+namespace gr {
+ namespace fft {
+
+ class FFT_API fft_vfc_fftw : public fft_vfc
+ {
+ private:
+ fft_complex *d_fft;
+ unsigned int d_fft_size;
+ std::vector<float> d_window;
+ bool d_forward;
+
+ public:
+ fft_vfc_fftw(int fft_size, bool forward,
+ const std::vector<float> &window,
+ int nthreads=1);
+
+ ~fft_vfc_fftw();
+
+ void set_nthreads(int n);
+ int nthreads() const;
+ bool set_window(const std::vector<float> &window);
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace fft */
+} /* namespace gr */
+
+#endif /* INCLUDED_FFT_FFT_VFC_FFTW_IMPL_H */
diff --git a/gr-fft/lib/goertzel.cc b/gr-fft/lib/goertzel.cc
new file mode 100644
index 000000000..4bcd5ee19
--- /dev/null
+++ b/gr-fft/lib/goertzel.cc
@@ -0,0 +1,84 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002,2011,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 <cmath>
+#include <fft/goertzel.h>
+
+namespace gr {
+ namespace fft {
+
+ goertzel::goertzel(int rate, int len, float freq)
+ {
+ set_params(rate, len, freq);
+ }
+
+ void
+ goertzel::set_params(int rate, int len, float freq)
+ {
+ d_d1 = 0.0;
+ d_d2 = 0.0;
+
+ float w = 2.0*M_PI*freq/rate;
+ d_wr = 2.0*std::cos(w);
+ d_wi = std::sin(w);
+ d_len = len;
+ d_processed = 0;
+ }
+
+ gr_complex
+ goertzel::batch(float *in)
+ {
+ d_d1 = 0.0;
+ d_d2 = 0.0;
+
+ for(int i = 0; i < d_len; i++)
+ input(in[i]);
+
+ return output();
+ }
+
+ void
+ goertzel::input(const float &input)
+ {
+ float y = input + d_wr*d_d1 - d_d2;
+ d_d2 = d_d1;
+ d_d1 = y;
+ d_processed++;
+ }
+
+ gr_complex
+ goertzel::output()
+ {
+ gr_complex out((0.5*d_wr*d_d1-d_d2)/d_len, (d_wi*d_d1)/d_len);
+ d_d1 = 0.0;
+ d_d2 = 0.0;
+ d_processed = 0;
+ return out;
+ }
+
+ } /* namespace fft */
+}/* namespace gr */
+
diff --git a/gr-fft/lib/goertzel_fc_impl.cc b/gr-fft/lib/goertzel_fc_impl.cc
new file mode 100644
index 000000000..ee214f24d
--- /dev/null
+++ b/gr-fft/lib/goertzel_fc_impl.cc
@@ -0,0 +1,85 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006,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 "goertzel_fc_impl.h"
+#include <gr_io_signature.h>
+
+namespace gr {
+ namespace fft {
+
+ goertzel_fc::sptr goertzel_fc::make(int rate, int len, float freq)
+ {
+ return gnuradio::get_initial_sptr(new goertzel_fc_impl(rate, len, freq));
+ }
+
+ goertzel_fc_impl::goertzel_fc_impl(int rate, int len, float freq)
+ : gr_sync_decimator("goertzel_fc",
+ gr_make_io_signature (1, 1, sizeof(float)),
+ gr_make_io_signature (1, 1, sizeof(gr_complex)),
+ len),
+ d_goertzel(rate, len, freq)
+ {
+ d_len = len;
+ d_rate = rate;
+ d_freq = freq;
+ }
+
+ goertzel_fc_impl::~goertzel_fc_impl()
+ {
+ }
+
+ void
+ goertzel_fc_impl::set_freq(float freq)
+ {
+ d_freq = freq;
+ d_goertzel.set_params(d_rate, d_len, d_freq);
+ }
+
+ void
+ goertzel_fc_impl::set_rate(int rate)
+ {
+ d_rate = rate;
+ d_goertzel.set_params(d_rate, d_len, d_freq);
+ }
+
+ int
+ goertzel_fc_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ float *in = (float *)input_items[0];
+ gr_complex *out = (gr_complex *)output_items[0];
+
+ for(int i = 0; i < noutput_items; i++) {
+ *out++ = d_goertzel.batch(in);
+ in += d_len;
+ }
+
+ return noutput_items;
+ }
+
+ } /* namespace fft */
+} /* namespace gr */
diff --git a/gr-fft/lib/goertzel_fc_impl.h b/gr-fft/lib/goertzel_fc_impl.h
new file mode 100644
index 000000000..426bc71f6
--- /dev/null
+++ b/gr-fft/lib/goertzel_fc_impl.h
@@ -0,0 +1,60 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006,2011,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 INCLUDED_FFT_GOERTZEL_FC_IMPL_H
+#define INCLUDED_FFT_GOERTZEL_FC_IMPL_H
+
+#include <fft/goertzel_fc.h>
+#include <fft/goertzel.h>
+
+namespace gr {
+ namespace fft {
+
+ class FFT_API goertzel_fc_impl : public goertzel_fc
+ {
+ private:
+ goertzel d_goertzel;
+ int d_len;
+ float d_freq;
+ int d_rate;
+
+ public:
+ goertzel_fc_impl(int rate, int len, float freq);
+
+ ~goertzel_fc_impl();
+
+ void set_freq(float freq);
+ void set_rate(int rate);
+
+ float freq() { return d_freq; }
+ int rate() { return d_rate; }
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace fft */
+} /* namespace gr */
+
+#endif /* INCLUDED_FFT_GOERTZEL_FC_IMPL_H */
+
diff --git a/gr-fft/python/CMakeLists.txt b/gr-fft/python/CMakeLists.txt
new file mode 100644
index 000000000..3b328780f
--- /dev/null
+++ b/gr-fft/python/CMakeLists.txt
@@ -0,0 +1,47 @@
+# 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.
+
+########################################################################
+include(GrPython)
+
+GR_PYTHON_INSTALL(
+ FILES
+ __init__.py
+ DESTINATION ${GR_PYTHON_DIR}/gnuradio/fft
+ COMPONENT "fft_python"
+)
+
+########################################################################
+# Handle the unit tests
+########################################################################
+if(ENABLE_TESTING)
+
+list(APPEND GR_TEST_PYTHON_DIRS
+ ${CMAKE_BINARY_DIR}/gr-fft/python
+ ${CMAKE_BINARY_DIR}/gr-fft/swig
+)
+list(APPEND GR_TEST_TARGET_DEPS gnuradio-fft)
+
+include(GrTest)
+file(GLOB py_qa_test_files "qa_*.py")
+foreach(py_qa_test_file ${py_qa_test_files})
+ get_filename_component(py_qa_test_name ${py_qa_test_file} NAME_WE)
+ GR_ADD_TEST(${py_qa_test_name} ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} ${py_qa_test_file})
+endforeach(py_qa_test_file)
+endif(ENABLE_TESTING)
diff --git a/gr-fft/python/__init__.py b/gr-fft/python/__init__.py
new file mode 100644
index 000000000..0fa643e35
--- /dev/null
+++ b/gr-fft/python/__init__.py
@@ -0,0 +1,28 @@
+#
+# 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.
+#
+
+'''
+This is the gr-fft package. This package provides GNU Radio
+processing blocks for FFT and related functions.
+'''
+
+from fft_swig import *
+
diff --git a/gr-fft/python/qa_fft.py b/gr-fft/python/qa_fft.py
new file mode 100755
index 000000000..1c45ac148
--- /dev/null
+++ b/gr-fft/python/qa_fft.py
@@ -0,0 +1,213 @@
+#!/usr/bin/env python
+#
+# Copyright 2008,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 this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+
+from gnuradio import gr, gr_unittest
+import fft_swig as fft
+import sys
+import random
+
+primes = (2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,
+ 59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,
+ 137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,
+ 227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311)
+
+
+class test_fft(gr_unittest.TestCase):
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def assert_fft_ok2(self, expected_result, result_data):
+ expected_result = expected_result[:len(result_data)]
+ self.assertComplexTuplesAlmostEqual2 (expected_result, result_data,
+ abs_eps=1e-9, rel_eps=4e-4)
+
+ def assert_fft_float_ok2(self, expected_result, result_data, abs_eps=1e-9, rel_eps=4e-4):
+ expected_result = expected_result[:len(result_data)]
+ self.assertFloatTuplesAlmostEqual2 (expected_result, result_data,
+ abs_eps, rel_eps)
+
+ def test_001(self):
+ tb = gr.top_block()
+ fft_size = 32
+ src_data = tuple([complex(primes[2*i], primes[2*i+1]) for i in range(fft_size)])
+
+ expected_result = ((4377+4516j),
+ (-1706.1268310546875+1638.4256591796875j),
+ (-915.2083740234375+660.69427490234375j),
+ (-660.370361328125+381.59600830078125j),
+ (-499.96044921875+238.41630554199219j),
+ (-462.26748657226562+152.88948059082031j),
+ (-377.98440551757812+77.5928955078125j),
+ (-346.85821533203125+47.152004241943359j),
+ (-295+20j),
+ (-286.33609008789062-22.257017135620117j),
+ (-271.52999877929688-33.081821441650391j),
+ (-224.6358642578125-67.019538879394531j),
+ (-244.24473571777344-91.524826049804688j),
+ (-203.09068298339844-108.54627227783203j),
+ (-198.45195007324219-115.90768432617188j),
+ (-182.97744750976562-128.12318420410156j),
+ (-167-180j),
+ (-130.33688354492188-173.83778381347656j),
+ (-141.19784545898438-190.28807067871094j),
+ (-111.09677124023438-214.48896789550781j),
+ (-70.039543151855469-242.41630554199219j),
+ (-68.960540771484375-228.30015563964844j),
+ (-53.049201965332031-291.47097778320312j),
+ (-28.695289611816406-317.64553833007812j),
+ (57-300j),
+ (45.301143646240234-335.69509887695312j),
+ (91.936195373535156-373.32437133789062j),
+ (172.09465026855469-439.275146484375j),
+ (242.24473571777344-504.47515869140625j),
+ (387.81732177734375-666.6788330078125j),
+ (689.48553466796875-918.2142333984375j),
+ (1646.539306640625-1694.1956787109375j))
+
+ src = gr.vector_source_c(src_data)
+ s2v = gr.stream_to_vector(gr.sizeof_gr_complex, fft_size)
+ op = fft.fft_vcc(fft_size, True, [], False)
+ v2s = gr.vector_to_stream(gr.sizeof_gr_complex, fft_size)
+ dst = gr.vector_sink_c()
+ tb.connect(src, s2v, op, v2s, dst)
+ tb.run()
+ result_data = dst.data()
+ #print 'expected:', expected_result
+ #print 'results: ', result_data
+ #self.assertComplexTuplesAlmostEqual (expected_result, result_data, 5)
+ self.assert_fft_ok2(expected_result, result_data)
+
+ def test_002(self):
+ tb = gr.top_block()
+ fft_size = 32
+
+ tmp_data = ((4377+4516j),
+ (-1706.1268310546875+1638.4256591796875j),
+ (-915.2083740234375+660.69427490234375j),
+ (-660.370361328125+381.59600830078125j),
+ (-499.96044921875+238.41630554199219j),
+ (-462.26748657226562+152.88948059082031j),
+ (-377.98440551757812+77.5928955078125j),
+ (-346.85821533203125+47.152004241943359j),
+ (-295+20j),
+ (-286.33609008789062-22.257017135620117j),
+ (-271.52999877929688-33.081821441650391j),
+ (-224.6358642578125-67.019538879394531j),
+ (-244.24473571777344-91.524826049804688j),
+ (-203.09068298339844-108.54627227783203j),
+ (-198.45195007324219-115.90768432617188j),
+ (-182.97744750976562-128.12318420410156j),
+ (-167-180j),
+ (-130.33688354492188-173.83778381347656j),
+ (-141.19784545898438-190.28807067871094j),
+ (-111.09677124023438-214.48896789550781j),
+ (-70.039543151855469-242.41630554199219j),
+ (-68.960540771484375-228.30015563964844j),
+ (-53.049201965332031-291.47097778320312j),
+ (-28.695289611816406-317.64553833007812j),
+ (57-300j),
+ (45.301143646240234-335.69509887695312j),
+ (91.936195373535156-373.32437133789062j),
+ (172.09465026855469-439.275146484375j),
+ (242.24473571777344-504.47515869140625j),
+ (387.81732177734375-666.6788330078125j),
+ (689.48553466796875-918.2142333984375j),
+ (1646.539306640625-1694.1956787109375j))
+
+ src_data = tuple([x/fft_size for x in tmp_data])
+
+ expected_result = tuple([complex(primes[2*i], primes[2*i+1]) for i in range(fft_size)])
+
+ src = gr.vector_source_c(src_data)
+ s2v = gr.stream_to_vector(gr.sizeof_gr_complex, fft_size)
+ op = fft.fft_vcc(fft_size, False, [], False)
+ v2s = gr.vector_to_stream(gr.sizeof_gr_complex, fft_size)
+ dst = gr.vector_sink_c()
+ tb.connect(src, s2v, op, v2s, dst)
+ tb.run()
+ result_data = dst.data()
+ #print 'expected:', expected_result
+ #print 'results: ', result_data
+ #self.assertComplexTuplesAlmostEqual (expected_result, result_data, 5)
+ self.assert_fft_ok2(expected_result, result_data)
+
+ def test_003(self):
+ # Same test as above, only use 2 threads
+
+ tb = gr.top_block()
+ fft_size = 32
+
+ tmp_data = ((4377+4516j),
+ (-1706.1268310546875+1638.4256591796875j),
+ (-915.2083740234375+660.69427490234375j),
+ (-660.370361328125+381.59600830078125j),
+ (-499.96044921875+238.41630554199219j),
+ (-462.26748657226562+152.88948059082031j),
+ (-377.98440551757812+77.5928955078125j),
+ (-346.85821533203125+47.152004241943359j),
+ (-295+20j),
+ (-286.33609008789062-22.257017135620117j),
+ (-271.52999877929688-33.081821441650391j),
+ (-224.6358642578125-67.019538879394531j),
+ (-244.24473571777344-91.524826049804688j),
+ (-203.09068298339844-108.54627227783203j),
+ (-198.45195007324219-115.90768432617188j),
+ (-182.97744750976562-128.12318420410156j),
+ (-167-180j),
+ (-130.33688354492188-173.83778381347656j),
+ (-141.19784545898438-190.28807067871094j),
+ (-111.09677124023438-214.48896789550781j),
+ (-70.039543151855469-242.41630554199219j),
+ (-68.960540771484375-228.30015563964844j),
+ (-53.049201965332031-291.47097778320312j),
+ (-28.695289611816406-317.64553833007812j),
+ (57-300j),
+ (45.301143646240234-335.69509887695312j),
+ (91.936195373535156-373.32437133789062j),
+ (172.09465026855469-439.275146484375j),
+ (242.24473571777344-504.47515869140625j),
+ (387.81732177734375-666.6788330078125j),
+ (689.48553466796875-918.2142333984375j),
+ (1646.539306640625-1694.1956787109375j))
+
+ src_data = tuple([x/fft_size for x in tmp_data])
+
+ expected_result = tuple([complex(primes[2*i], primes[2*i+1]) for i in range(fft_size)])
+
+ nthreads = 2
+
+ src = gr.vector_source_c(src_data)
+ s2v = gr.stream_to_vector(gr.sizeof_gr_complex, fft_size)
+ op = fft.fft_vcc(fft_size, False, [], False, nthreads)
+ v2s = gr.vector_to_stream(gr.sizeof_gr_complex, fft_size)
+ dst = gr.vector_sink_c()
+ tb.connect(src, s2v, op, v2s, dst)
+ tb.run()
+ result_data = dst.data()
+ self.assert_fft_ok2(expected_result, result_data)
+
+if __name__ == '__main__':
+ gr_unittest.run(test_fft, "test_fft.xml")
+
diff --git a/gr-fft/python/qa_goertzel.py b/gr-fft/python/qa_goertzel.py
new file mode 100755
index 000000000..27f9d370e
--- /dev/null
+++ b/gr-fft/python/qa_goertzel.py
@@ -0,0 +1,65 @@
+#!/usr/bin/env python
+#
+# Copyright 2006,2007,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.
+#
+
+from gnuradio import gr, gr_unittest
+from math import pi, cos
+import fft_swig as fft
+
+class test_goertzel(gr_unittest.TestCase):
+
+ def setUp(self):
+ self.tb = gr.top_block()
+
+ def tearDown(self):
+ self.tb = None
+
+ def make_tone_data(self, rate, freq):
+ return [cos(2*pi*x*freq/rate) for x in range(rate)]
+
+ def transform(self, src_data, rate, freq):
+ src = gr.vector_source_f(src_data, False)
+ dft = fft.goertzel_fc(rate, rate, freq)
+ dst = gr.vector_sink_c()
+ self.tb.connect(src, dft, dst)
+ self.tb.run()
+ return dst.data()
+
+ def test_001(self): # Measure single tone magnitude
+ rate = 8000
+ freq = 100
+ bin = freq
+ src_data = self.make_tone_data(rate, freq)
+ expected_result = 0.5
+ actual_result = abs(self.transform(src_data, rate, bin)[0])
+ self.assertAlmostEqual(expected_result, actual_result, places=4)
+
+ def test_002(self): # Measure off frequency magnitude
+ rate = 8000
+ freq = 100
+ bin = freq/2
+ src_data = self.make_tone_data(rate, freq)
+ expected_result = 0.0
+ actual_result = abs(self.transform(src_data, rate, bin)[0])
+ self.assertAlmostEqual(expected_result, actual_result, places=4)
+
+if __name__ == '__main__':
+ gr_unittest.run(test_goertzel, "test_goertzel.xml")
diff --git a/gr-fft/swig/CMakeLists.txt b/gr-fft/swig/CMakeLists.txt
new file mode 100644
index 000000000..13ade2c90
--- /dev/null
+++ b/gr-fft/swig/CMakeLists.txt
@@ -0,0 +1,53 @@
+# 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.
+
+########################################################################
+# Setup swig generation
+########################################################################
+include(GrPython)
+include(GrSwig)
+
+set(GR_SWIG_INCLUDE_DIRS
+ ${GR_FFT_INCLUDE_DIRS}
+ ${GNURADIO_CORE_SWIG_INCLUDE_DIRS}
+ ${GRUEL_INCLUDE_DIRS}
+ ${Boost_INCLUDE_DIRS}
+ ${FFTW3F_INCLUDE_DIRS}
+)
+
+set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/fft_swig_doc.i)
+set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include/fft)
+
+set(GR_SWIG_LIBRARIES gnuradio-fft)
+
+GR_SWIG_MAKE(fft_swig fft_swig.i)
+
+GR_SWIG_INSTALL(
+ TARGETS fft_swig
+ DESTINATION ${GR_PYTHON_DIR}/gnuradio/fft
+ COMPONENT "fft_python"
+)
+
+install(
+ FILES
+ fft_swig.i
+ ${CMAKE_CURRENT_BINARY_DIR}/fft_swig_doc.i
+ DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig
+ COMPONENT "fft_swig"
+)
diff --git a/gr-fft/swig/fft_swig.i b/gr-fft/swig/fft_swig.i
new file mode 100644
index 000000000..07fab34d4
--- /dev/null
+++ b/gr-fft/swig/fft_swig.i
@@ -0,0 +1,42 @@
+/* -*- 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.
+ */
+
+#define FFT_API
+
+%include "gnuradio.i"
+
+//load generated python docstrings
+%include "fft_swig_doc.i"
+
+%{
+#include "fft/fft_vcc.h"
+#include "fft/fft_vfc.h"
+#include "fft/goertzel_fc.h"
+%}
+
+%include "fft/fft_vcc.h"
+%include "fft/fft_vfc.h"
+%include "fft/goertzel_fc.h"
+
+GR_SWIG_BLOCK_MAGIC2(fft, fft_vcc);
+GR_SWIG_BLOCK_MAGIC2(fft, fft_vfc);
+GR_SWIG_BLOCK_MAGIC2(fft, goertzel_fc);
diff --git a/gr-filter/CMakeLists.txt b/gr-filter/CMakeLists.txt
new file mode 100644
index 000000000..b77a3d9d4
--- /dev/null
+++ b/gr-filter/CMakeLists.txt
@@ -0,0 +1,113 @@
+# 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.
+
+########################################################################
+# Setup dependencies
+########################################################################
+include(GrBoost)
+
+########################################################################
+# Register component
+########################################################################
+include(GrComponent)
+
+GR_REGISTER_COMPONENT("gr-filter" ENABLE_GR_FILTER
+ ENABLE_GRUEL
+ ENABLE_VOLK
+ Boost_FOUND
+ ENABLE_GR_CORE
+ ENABLE_GR_FFT
+)
+
+GR_SET_GLOBAL(GR_FILTER_INCLUDE_DIRS
+ ${CMAKE_CURRENT_SOURCE_DIR}/lib
+ ${CMAKE_CURRENT_SOURCE_DIR}/include
+ ${CMAKE_CURRENT_BINARY_DIR}/lib
+ ${CMAKE_CURRENT_BINARY_DIR}/include
+)
+
+SET(GR_PKG_FILTER_EXAMPLES_DIR ${GR_PKG_DATA_DIR}/examples/filter)
+
+########################################################################
+# Begin conditional configuration
+########################################################################
+if(ENABLE_GR_FILTER)
+
+########################################################################
+# Setup CPack components
+########################################################################
+include(GrPackage)
+CPACK_SET(CPACK_COMPONENT_GROUP_FILTER_DESCRIPTION "GNU Radio Filter Blocks")
+
+CPACK_COMPONENT("filter_runtime"
+ GROUP "Filter"
+ DISPLAY_NAME "Runtime"
+ DESCRIPTION "Runtime"
+ DEPENDS "core_runtime"
+)
+
+CPACK_COMPONENT("filter_devel"
+ GROUP "Filter"
+ DISPLAY_NAME "Development"
+ DESCRIPTION "C++ headers, package config, import libraries"
+ DEPENDS "core_devel"
+)
+
+CPACK_COMPONENT("filter_python"
+ GROUP "Filter"
+ DISPLAY_NAME "Python"
+ DESCRIPTION "Python modules for runtime; GRC xml files"
+ DEPENDS "core_python;filter_runtime"
+)
+
+CPACK_COMPONENT("filter_swig"
+ GROUP "Filter"
+ DISPLAY_NAME "SWIG"
+ DESCRIPTION "SWIG development .i files"
+ DEPENDS "core_swig;filter_python;filter_devel"
+)
+
+########################################################################
+# Add subdirectories
+########################################################################
+add_subdirectory(include/filter)
+add_subdirectory(lib)
+if(ENABLE_PYTHON)
+ add_subdirectory(swig)
+ add_subdirectory(python)
+ add_subdirectory(grc)
+endif(ENABLE_PYTHON)
+add_subdirectory(examples)
+add_subdirectory(doc)
+
+########################################################################
+# Create Pkg Config File
+########################################################################
+configure_file(
+ ${CMAKE_CURRENT_SOURCE_DIR}/gnuradio-filter.pc.in
+ ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-filter.pc
+@ONLY)
+
+install(
+ FILES ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-filter.pc
+ DESTINATION ${GR_LIBRARY_DIR}/pkgconfig
+ COMPONENT "filter_devel"
+)
+
+endif(ENABLE_GR_FILTER)
diff --git a/gr-filter/doc/CMakeLists.txt b/gr-filter/doc/CMakeLists.txt
new file mode 100644
index 000000000..63447ed2c
--- /dev/null
+++ b/gr-filter/doc/CMakeLists.txt
@@ -0,0 +1,23 @@
+# 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.
+
+install(
+ FILES README.filter
+ DESTINATION ${GR_PKG_DOC_DIR}
+)
diff --git a/gr-filter/doc/README.filter b/gr-filter/doc/README.filter
new file mode 100644
index 000000000..776acd46c
--- /dev/null
+++ b/gr-filter/doc/README.filter
@@ -0,0 +1,13 @@
+This is the gr-filter package. It contains signal processing blocks to
+perform filtering operations.
+
+The Python namespace is in gnuradio.filter, which would be normally
+imported as:
+
+ from gnuradio import filter
+
+See the Doxygen documentation for details about the blocks available
+in this package. A quick listing of the details can be found in Python
+after importing by using:
+
+ help(filter)
diff --git a/gr-filter/doc/filter.dox b/gr-filter/doc/filter.dox
new file mode 100644
index 000000000..fc3b52e91
--- /dev/null
+++ b/gr-filter/doc/filter.dox
@@ -0,0 +1,27 @@
+/*! \page page_filter filter Signal Processing Blocks
+
+\section Introduction
+
+This is the gr-filter package. It contains signal processing blocks to
+perform filtering operations.
+
+The Python namespace is in gnuradio.filter, which would be normally
+imported as:
+
+\code
+ from gnuradio import filter
+\endcode
+
+See the Doxygen documentation for details about the blocks available
+in this package. A quick listing of the details can be found in Python
+after importing by using:
+
+\code
+ help(filter)
+\endcode
+
+\section Dependencies
+
+The filter blocks depend on \ref page_fft.
+
+*/
diff --git a/gr-filter/examples/CMakeLists.txt b/gr-filter/examples/CMakeLists.txt
new file mode 100644
index 000000000..84a93d55f
--- /dev/null
+++ b/gr-filter/examples/CMakeLists.txt
@@ -0,0 +1,45 @@
+# Copyright 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.
+
+include(GrPython)
+
+# Base stuff
+GR_PYTHON_INSTALL(PROGRAMS
+ channelize.py
+ chirp_channelize.py
+ decimate.py
+ fft_filter_ccc.py
+ fir_filter_ccc.py
+ fir_filter_fff.py
+ fmtest.py
+ interpolate.py
+ reconstruction.py
+ resampler.py
+ synth_filter.py
+ synth_to_chan.py
+ DESTINATION ${GR_PKG_FILTER_EXAMPLES_DIR}
+ COMPONENT "filter_python"
+)
+
+install(
+ FILES
+ resampler_demo.grc
+ DESTINATION ${GR_PKG_FILTER_EXAMPLES_DIR}
+ COMPONENT "filter_python"
+)
diff --git a/gr-filter/examples/channelize.py b/gr-filter/examples/channelize.py
new file mode 100755
index 000000000..1f784d9b0
--- /dev/null
+++ b/gr-filter/examples/channelize.py
@@ -0,0 +1,195 @@
+#!/usr/bin/env python
+#
+# Copyright 2009,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.
+#
+
+from gnuradio import gr, blks2
+from gnuradio import filter
+import sys, time
+
+try:
+ import scipy
+ from scipy import fftpack
+except ImportError:
+ print "Error: Program requires scipy (see: www.scipy.org)."
+ sys.exit(1)
+
+try:
+ import pylab
+ from pylab import mlab
+except ImportError:
+ print "Error: Program requires matplotlib (see: matplotlib.sourceforge.net)."
+ sys.exit(1)
+
+class pfb_top_block(gr.top_block):
+ def __init__(self):
+ gr.top_block.__init__(self)
+
+ self._N = 2000000 # number of samples to use
+ self._fs = 1000 # initial sampling rate
+ self._M = M = 9 # Number of channels to channelize
+ self._ifs = M*self._fs # initial sampling rate
+
+ # Create a set of taps for the PFB channelizer
+ self._taps = filter.firdes.low_pass_2(1, self._ifs, 475.50, 50,
+ attenuation_dB=100,
+ window=filter.firdes.WIN_BLACKMAN_hARRIS)
+
+ # Calculate the number of taps per channel for our own information
+ tpc = scipy.ceil(float(len(self._taps)) / float(self._M))
+ print "Number of taps: ", len(self._taps)
+ print "Number of channels: ", self._M
+ print "Taps per channel: ", tpc
+
+ # Create a set of signals at different frequencies
+ # freqs lists the frequencies of the signals that get stored
+ # in the list "signals", which then get summed together
+ self.signals = list()
+ self.add = gr.add_cc()
+ freqs = [-70, -50, -30, -10, 10, 20, 40, 60, 80]
+ for i in xrange(len(freqs)):
+ f = freqs[i] + (M/2-M+i+1)*self._fs
+ self.signals.append(gr.sig_source_c(self._ifs, gr.GR_SIN_WAVE, f, 1))
+ self.connect(self.signals[i], (self.add,i))
+
+ self.head = gr.head(gr.sizeof_gr_complex, self._N)
+
+ # Construct the channelizer filter
+ self.pfb = filter.pfb.channelizer_ccf(self._M, self._taps, 1)
+
+ # Construct a vector sink for the input signal to the channelizer
+ self.snk_i = gr.vector_sink_c()
+
+ # Connect the blocks
+ self.connect(self.add, self.head, self.pfb)
+ self.connect(self.add, self.snk_i)
+
+ # Use this to play with the channel mapping
+ #self.pfb.set_channel_map([5,6,7,8,0,1,2,3,4])
+
+ # Create a vector sink for each of M output channels of the filter and connect it
+ self.snks = list()
+ for i in xrange(self._M):
+ self.snks.append(gr.vector_sink_c())
+ self.connect((self.pfb, i), self.snks[i])
+
+
+def main():
+ tstart = time.time()
+
+ tb = pfb_top_block()
+ tb.run()
+
+ tend = time.time()
+ print "Run time: %f" % (tend - tstart)
+
+ if 1:
+ fig_in = pylab.figure(1, figsize=(16,9), facecolor="w")
+ fig1 = pylab.figure(2, figsize=(16,9), facecolor="w")
+ fig2 = pylab.figure(3, figsize=(16,9), facecolor="w")
+
+ Ns = 1000
+ Ne = 10000
+
+ fftlen = 8192
+ winfunc = scipy.blackman
+ fs = tb._ifs
+
+ # Plot the input signal on its own figure
+ d = tb.snk_i.data()[Ns:Ne]
+ spin_f = fig_in.add_subplot(2, 1, 1)
+
+ X,freq = mlab.psd(d, NFFT=fftlen, noverlap=fftlen/4, Fs=fs,
+ window = lambda d: d*winfunc(fftlen),
+ scale_by_freq=True)
+ X_in = 10.0*scipy.log10(abs(X))
+ f_in = scipy.arange(-fs/2.0, fs/2.0, fs/float(X_in.size))
+ pin_f = spin_f.plot(f_in, X_in, "b")
+ spin_f.set_xlim([min(f_in), max(f_in)+1])
+ spin_f.set_ylim([-200.0, 50.0])
+
+ spin_f.set_title("Input Signal", weight="bold")
+ spin_f.set_xlabel("Frequency (Hz)")
+ spin_f.set_ylabel("Power (dBW)")
+
+
+ Ts = 1.0/fs
+ Tmax = len(d)*Ts
+
+ t_in = scipy.arange(0, Tmax, Ts)
+ x_in = scipy.array(d)
+ spin_t = fig_in.add_subplot(2, 1, 2)
+ pin_t = spin_t.plot(t_in, x_in.real, "b")
+ pin_t = spin_t.plot(t_in, x_in.imag, "r")
+
+ spin_t.set_xlabel("Time (s)")
+ spin_t.set_ylabel("Amplitude")
+
+ Ncols = int(scipy.floor(scipy.sqrt(tb._M)))
+ Nrows = int(scipy.floor(tb._M / Ncols))
+ if(tb._M % Ncols != 0):
+ Nrows += 1
+
+ # Plot each of the channels outputs. Frequencies on Figure 2 and
+ # time signals on Figure 3
+ fs_o = tb._fs
+ Ts_o = 1.0/fs_o
+ Tmax_o = len(d)*Ts_o
+ for i in xrange(len(tb.snks)):
+ # remove issues with the transients at the beginning
+ # also remove some corruption at the end of the stream
+ # this is a bug, probably due to the corner cases
+ d = tb.snks[i].data()[Ns:Ne]
+
+ sp1_f = fig1.add_subplot(Nrows, Ncols, 1+i)
+ X,freq = mlab.psd(d, NFFT=fftlen, noverlap=fftlen/4, Fs=fs_o,
+ window = lambda d: d*winfunc(fftlen),
+ scale_by_freq=True)
+ X_o = 10.0*scipy.log10(abs(X))
+ f_o = scipy.arange(-fs_o/2.0, fs_o/2.0, fs_o/float(X_o.size))
+ p2_f = sp1_f.plot(f_o, X_o, "b")
+ sp1_f.set_xlim([min(f_o), max(f_o)+1])
+ sp1_f.set_ylim([-200.0, 50.0])
+
+ sp1_f.set_title(("Channel %d" % i), weight="bold")
+ sp1_f.set_xlabel("Frequency (Hz)")
+ sp1_f.set_ylabel("Power (dBW)")
+
+ x_o = scipy.array(d)
+ t_o = scipy.arange(0, Tmax_o, Ts_o)
+ sp2_o = fig2.add_subplot(Nrows, Ncols, 1+i)
+ p2_o = sp2_o.plot(t_o, x_o.real, "b")
+ p2_o = sp2_o.plot(t_o, x_o.imag, "r")
+ sp2_o.set_xlim([min(t_o), max(t_o)+1])
+ sp2_o.set_ylim([-2, 2])
+
+ sp2_o.set_title(("Channel %d" % i), weight="bold")
+ sp2_o.set_xlabel("Time (s)")
+ sp2_o.set_ylabel("Amplitude")
+
+ pylab.show()
+
+
+if __name__ == "__main__":
+ try:
+ main()
+ except KeyboardInterrupt:
+ pass
+
diff --git a/gr-filter/examples/chirp_channelize.py b/gr-filter/examples/chirp_channelize.py
new file mode 100755
index 000000000..3638c55d1
--- /dev/null
+++ b/gr-filter/examples/chirp_channelize.py
@@ -0,0 +1,205 @@
+#!/usr/bin/env python
+#
+# Copyright 2009,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.
+#
+
+from gnuradio import gr, blks2
+from gnuradio import filter
+import sys, time
+
+try:
+ import scipy
+ from scipy import fftpack
+except ImportError:
+ print "Error: Program requires scipy (see: www.scipy.org)."
+ sys.exit(1)
+
+try:
+ import pylab
+ from pylab import mlab
+except ImportError:
+ print "Error: Program requires matplotlib (see: matplotlib.sourceforge.net)."
+ sys.exit(1)
+
+class pfb_top_block(gr.top_block):
+ def __init__(self):
+ gr.top_block.__init__(self)
+
+ self._N = 200000 # number of samples to use
+ self._fs = 9000 # initial sampling rate
+ self._M = 9 # Number of channels to channelize
+
+ # Create a set of taps for the PFB channelizer
+ self._taps = filter.firdes.low_pass_2(1, self._fs, 500, 20,
+ attenuation_dB=10,
+ window=filter.firdes.WIN_BLACKMAN_hARRIS)
+
+ # Calculate the number of taps per channel for our own information
+ tpc = scipy.ceil(float(len(self._taps)) / float(self._M))
+ print "Number of taps: ", len(self._taps)
+ print "Number of channels: ", self._M
+ print "Taps per channel: ", tpc
+
+ repeated = True
+ if(repeated):
+ self.vco_input = gr.sig_source_f(self._fs, gr.GR_SIN_WAVE, 0.25, 110)
+ else:
+ amp = 100
+ data = scipy.arange(0, amp, amp/float(self._N))
+ self.vco_input = gr.vector_source_f(data, False)
+
+ # Build a VCO controlled by either the sinusoid or single chirp tone
+ # Then convert this to a complex signal
+ self.vco = gr.vco_f(self._fs, 225, 1)
+ self.f2c = gr.float_to_complex()
+
+ self.head = gr.head(gr.sizeof_gr_complex, self._N)
+
+ # Construct the channelizer filter
+ self.pfb = filter.pfb.channelizer_ccf(self._M, self._taps)
+
+ # Construct a vector sink for the input signal to the channelizer
+ self.snk_i = gr.vector_sink_c()
+
+ # Connect the blocks
+ self.connect(self.vco_input, self.vco, self.f2c)
+ self.connect(self.f2c, self.head, self.pfb)
+ self.connect(self.f2c, self.snk_i)
+
+ # Create a vector sink for each of M output channels of the filter and connect it
+ self.snks = list()
+ for i in xrange(self._M):
+ self.snks.append(gr.vector_sink_c())
+ self.connect((self.pfb, i), self.snks[i])
+
+
+def main():
+ tstart = time.time()
+
+ tb = pfb_top_block()
+ tb.run()
+
+ tend = time.time()
+ print "Run time: %f" % (tend - tstart)
+
+ if 1:
+ fig_in = pylab.figure(1, figsize=(16,9), facecolor="w")
+ fig1 = pylab.figure(2, figsize=(16,9), facecolor="w")
+ fig2 = pylab.figure(3, figsize=(16,9), facecolor="w")
+ fig3 = pylab.figure(4, figsize=(16,9), facecolor="w")
+
+ Ns = 650
+ Ne = 20000
+
+ fftlen = 8192
+ winfunc = scipy.blackman
+ fs = tb._fs
+
+ # Plot the input signal on its own figure
+ d = tb.snk_i.data()[Ns:Ne]
+ spin_f = fig_in.add_subplot(2, 1, 1)
+
+ X,freq = mlab.psd(d, NFFT=fftlen, noverlap=fftlen/4, Fs=fs,
+ window = lambda d: d*winfunc(fftlen),
+ scale_by_freq=True)
+ X_in = 10.0*scipy.log10(abs(fftpack.fftshift(X)))
+ f_in = scipy.arange(-fs/2.0, fs/2.0, fs/float(X_in.size))
+ pin_f = spin_f.plot(f_in, X_in, "b")
+ spin_f.set_xlim([min(f_in), max(f_in)+1])
+ spin_f.set_ylim([-200.0, 50.0])
+
+ spin_f.set_title("Input Signal", weight="bold")
+ spin_f.set_xlabel("Frequency (Hz)")
+ spin_f.set_ylabel("Power (dBW)")
+
+
+ Ts = 1.0/fs
+ Tmax = len(d)*Ts
+
+ t_in = scipy.arange(0, Tmax, Ts)
+ x_in = scipy.array(d)
+ spin_t = fig_in.add_subplot(2, 1, 2)
+ pin_t = spin_t.plot(t_in, x_in.real, "b")
+ pin_t = spin_t.plot(t_in, x_in.imag, "r")
+
+ spin_t.set_xlabel("Time (s)")
+ spin_t.set_ylabel("Amplitude")
+
+ Ncols = int(scipy.floor(scipy.sqrt(tb._M)))
+ Nrows = int(scipy.floor(tb._M / Ncols))
+ if(tb._M % Ncols != 0):
+ Nrows += 1
+
+ # Plot each of the channels outputs. Frequencies on Figure 2 and
+ # time signals on Figure 3
+ fs_o = tb._fs / tb._M
+ Ts_o = 1.0/fs_o
+ Tmax_o = len(d)*Ts_o
+ for i in xrange(len(tb.snks)):
+ # remove issues with the transients at the beginning
+ # also remove some corruption at the end of the stream
+ # this is a bug, probably due to the corner cases
+ d = tb.snks[i].data()[Ns:Ne]
+
+ sp1_f = fig1.add_subplot(Nrows, Ncols, 1+i)
+ X,freq = mlab.psd(d, NFFT=fftlen, noverlap=fftlen/4, Fs=fs_o,
+ window = lambda d: d*winfunc(fftlen),
+ scale_by_freq=True)
+ X_o = 10.0*scipy.log10(abs(X))
+ f_o = freq
+ p2_f = sp1_f.plot(f_o, X_o, "b")
+ sp1_f.set_xlim([min(f_o), max(f_o)+1])
+ sp1_f.set_ylim([-200.0, 50.0])
+
+ sp1_f.set_title(("Channel %d" % i), weight="bold")
+ sp1_f.set_xlabel("Frequency (Hz)")
+ sp1_f.set_ylabel("Power (dBW)")
+
+ x_o = scipy.array(d)
+ t_o = scipy.arange(0, Tmax_o, Ts_o)
+ sp2_o = fig2.add_subplot(Nrows, Ncols, 1+i)
+ p2_o = sp2_o.plot(t_o, x_o.real, "b")
+ p2_o = sp2_o.plot(t_o, x_o.imag, "r")
+ sp2_o.set_xlim([min(t_o), max(t_o)+1])
+ sp2_o.set_ylim([-2, 2])
+
+ sp2_o.set_title(("Channel %d" % i), weight="bold")
+ sp2_o.set_xlabel("Time (s)")
+ sp2_o.set_ylabel("Amplitude")
+
+
+ sp3 = fig3.add_subplot(1,1,1)
+ p3 = sp3.plot(t_o, x_o.real)
+ sp3.set_xlim([min(t_o), max(t_o)+1])
+ sp3.set_ylim([-2, 2])
+
+ sp3.set_title("All Channels")
+ sp3.set_xlabel("Time (s)")
+ sp3.set_ylabel("Amplitude")
+
+ pylab.show()
+
+
+if __name__ == "__main__":
+ try:
+ main()
+ except KeyboardInterrupt:
+ pass
+
diff --git a/gr-filter/examples/decimate.py b/gr-filter/examples/decimate.py
new file mode 100755
index 000000000..7f1f03d8f
--- /dev/null
+++ b/gr-filter/examples/decimate.py
@@ -0,0 +1,181 @@
+#!/usr/bin/env python
+#
+# Copyright 2009,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.
+#
+
+from gnuradio import gr
+from gnuradio import filter
+import sys, time
+
+try:
+ import scipy
+ from scipy import fftpack
+except ImportError:
+ print "Error: Program requires scipy (see: www.scipy.org)."
+ sys.exit(1)
+
+try:
+ import pylab
+ from pylab import mlab
+except ImportError:
+ print "Error: Program requires matplotlib (see: matplotlib.sourceforge.net)."
+ sys.exit(1)
+
+class pfb_top_block(gr.top_block):
+ def __init__(self):
+ gr.top_block.__init__(self)
+
+ self._N = 10000000 # number of samples to use
+ self._fs = 10000 # initial sampling rate
+ self._decim = 20 # Decimation rate
+
+ # Generate the prototype filter taps for the decimators with a 200 Hz bandwidth
+ self._taps = filter.firdes.low_pass_2(1, self._fs,
+ 200, 150,
+ attenuation_dB=120,
+ window=filter.firdes.WIN_BLACKMAN_hARRIS)
+
+ # Calculate the number of taps per channel for our own information
+ tpc = scipy.ceil(float(len(self._taps)) / float(self._decim))
+ print "Number of taps: ", len(self._taps)
+ print "Number of filters: ", self._decim
+ print "Taps per channel: ", tpc
+
+ # Build the input signal source
+ # We create a list of freqs, and a sine wave is generated and added to the source
+ # for each one of these frequencies.
+ self.signals = list()
+ self.add = gr.add_cc()
+ freqs = [10, 20, 2040]
+ for i in xrange(len(freqs)):
+ self.signals.append(gr.sig_source_c(self._fs, gr.GR_SIN_WAVE, freqs[i], 1))
+ self.connect(self.signals[i], (self.add,i))
+
+ self.head = gr.head(gr.sizeof_gr_complex, self._N)
+
+ # Construct a PFB decimator filter
+ self.pfb = filter.pfb.decimator_ccf(self._decim, self._taps, 0)
+
+ # Construct a standard FIR decimating filter
+ self.dec = filter.fir_filter_ccf(self._decim, self._taps)
+
+ self.snk_i = gr.vector_sink_c()
+
+ # Connect the blocks
+ self.connect(self.add, self.head, self.pfb)
+ self.connect(self.add, self.snk_i)
+
+ # Create the sink for the decimated siganl
+ self.snk = gr.vector_sink_c()
+ self.connect(self.pfb, self.snk)
+
+
+def main():
+ tb = pfb_top_block()
+
+ tstart = time.time()
+ tb.run()
+ tend = time.time()
+ print "Run time: %f" % (tend - tstart)
+
+ if 1:
+ fig1 = pylab.figure(1, figsize=(16,9))
+ fig2 = pylab.figure(2, figsize=(16,9))
+
+ Ns = 10000
+ Ne = 10000
+
+ fftlen = 8192
+ winfunc = scipy.blackman
+ fs = tb._fs
+
+ # Plot the input to the decimator
+
+ d = tb.snk_i.data()[Ns:Ns+Ne]
+ sp1_f = fig1.add_subplot(2, 1, 1)
+
+ X,freq = mlab.psd(d, NFFT=fftlen, noverlap=fftlen/4, Fs=fs,
+ window = lambda d: d*winfunc(fftlen),
+ scale_by_freq=True)
+ X_in = 10.0*scipy.log10(abs(fftpack.fftshift(X)))
+ f_in = scipy.arange(-fs/2.0, fs/2.0, fs/float(X_in.size))
+ p1_f = sp1_f.plot(f_in, X_in, "b")
+ sp1_f.set_xlim([min(f_in), max(f_in)+1])
+ sp1_f.set_ylim([-200.0, 50.0])
+
+ sp1_f.set_title("Input Signal", weight="bold")
+ sp1_f.set_xlabel("Frequency (Hz)")
+ sp1_f.set_ylabel("Power (dBW)")
+
+ Ts = 1.0/fs
+ Tmax = len(d)*Ts
+
+ t_in = scipy.arange(0, Tmax, Ts)
+ x_in = scipy.array(d)
+ sp1_t = fig1.add_subplot(2, 1, 2)
+ p1_t = sp1_t.plot(t_in, x_in.real, "b")
+ p1_t = sp1_t.plot(t_in, x_in.imag, "r")
+ sp1_t.set_ylim([-tb._decim*1.1, tb._decim*1.1])
+
+ sp1_t.set_xlabel("Time (s)")
+ sp1_t.set_ylabel("Amplitude")
+
+
+ # Plot the output of the decimator
+ fs_o = tb._fs / tb._decim
+
+ sp2_f = fig2.add_subplot(2, 1, 1)
+ d = tb.snk.data()[Ns:Ns+Ne]
+ X,freq = mlab.psd(d, NFFT=fftlen, noverlap=fftlen/4, Fs=fs_o,
+ window = lambda d: d*winfunc(fftlen),
+ scale_by_freq=True)
+ X_o = 10.0*scipy.log10(abs(fftpack.fftshift(X)))
+ f_o = scipy.arange(-fs_o/2.0, fs_o/2.0, fs_o/float(X_o.size))
+ p2_f = sp2_f.plot(f_o, X_o, "b")
+ sp2_f.set_xlim([min(f_o), max(f_o)+1])
+ sp2_f.set_ylim([-200.0, 50.0])
+
+ sp2_f.set_title("PFB Decimated Signal", weight="bold")
+ sp2_f.set_xlabel("Frequency (Hz)")
+ sp2_f.set_ylabel("Power (dBW)")
+
+
+ Ts_o = 1.0/fs_o
+ Tmax_o = len(d)*Ts_o
+
+ x_o = scipy.array(d)
+ t_o = scipy.arange(0, Tmax_o, Ts_o)
+ sp2_t = fig2.add_subplot(2, 1, 2)
+ p2_t = sp2_t.plot(t_o, x_o.real, "b-o")
+ p2_t = sp2_t.plot(t_o, x_o.imag, "r-o")
+ sp2_t.set_ylim([-2.5, 2.5])
+
+ sp2_t.set_xlabel("Time (s)")
+ sp2_t.set_ylabel("Amplitude")
+
+ pylab.show()
+
+
+if __name__ == "__main__":
+ try:
+ main()
+ except KeyboardInterrupt:
+ pass
+
diff --git a/gr-filter/examples/fft_filter_ccc.py b/gr-filter/examples/fft_filter_ccc.py
new file mode 100755
index 000000000..45e241a6f
--- /dev/null
+++ b/gr-filter/examples/fft_filter_ccc.py
@@ -0,0 +1,98 @@
+#!/usr/bin/env python
+
+from gnuradio import gr, filter
+from gnuradio import eng_notation
+from gnuradio.eng_option import eng_option
+from optparse import OptionParser
+
+try:
+ import scipy
+except ImportError:
+ print "Error: could not import scipy (http://www.scipy.org/)"
+ sys.exit(1)
+
+try:
+ import pylab
+except ImportError:
+ print "Error: could not import pylab (http://matplotlib.sourceforge.net/)"
+ sys.exit(1)
+
+class example_fft_filter_ccc(gr.top_block):
+ def __init__(self, N, fs, bw0, bw1, tw, atten, D):
+ gr.top_block.__init__(self)
+
+ self._nsamps = N
+ self._fs = fs
+ self._bw0 = bw0
+ self._bw1 = bw1
+ self._tw = tw
+ self._at = atten
+ self._decim = D
+ taps = filter.firdes.complex_band_pass_2(1, self._fs,
+ self._bw0, self._bw1,
+ self._tw, self._at)
+ print "Num. Taps: ", len(taps)
+
+ self.src = gr.noise_source_c(gr.GR_GAUSSIAN, 1)
+ self.head = gr.head(gr.sizeof_gr_complex, self._nsamps)
+
+ self.filt0 = filter.fft_filter_ccc(self._decim, taps)
+
+ self.vsnk_src = gr.vector_sink_c()
+ self.vsnk_out = gr.vector_sink_c()
+
+ self.connect(self.src, self.head, self.vsnk_src)
+ self.connect(self.head, self.filt0, self.vsnk_out)
+
+def main():
+ parser = OptionParser(option_class=eng_option, conflict_handler="resolve")
+ parser.add_option("-N", "--nsamples", type="int", default=10000,
+ help="Number of samples to process [default=%default]")
+ parser.add_option("-s", "--samplerate", type="eng_float", default=8000,
+ help="System sample rate [default=%default]")
+ parser.add_option("-S", "--start-pass", type="eng_float", default=1000,
+ help="Start of Passband [default=%default]")
+ parser.add_option("-E", "--end-pass", type="eng_float", default=2000,
+ help="End of Passband [default=%default]")
+ parser.add_option("-T", "--transition", type="eng_float", default=100,
+ help="Transition band [default=%default]")
+ parser.add_option("-A", "--attenuation", type="eng_float", default=80,
+ help="Stopband attenuation [default=%default]")
+ parser.add_option("-D", "--decimation", type="int", default=1,
+ help="Decmation factor [default=%default]")
+ (options, args) = parser.parse_args ()
+
+ put = example_fft_filter_ccc(options.nsamples,
+ options.samplerate,
+ options.start_pass,
+ options.end_pass,
+ options.transition,
+ options.attenuation,
+ options.decimation)
+ put.run()
+
+ data_src = scipy.array(put.vsnk_src.data())
+ data_snk = scipy.array(put.vsnk_out.data())
+
+ # Plot the signals PSDs
+ nfft = 1024
+ f1 = pylab.figure(1, figsize=(12,10))
+ s1 = f1.add_subplot(1,1,1)
+ s1.psd(data_src, NFFT=nfft, noverlap=nfft/4,
+ Fs=options.samplerate)
+ s1.psd(data_snk, NFFT=nfft, noverlap=nfft/4,
+ Fs=options.samplerate)
+
+ f2 = pylab.figure(2, figsize=(12,10))
+ s2 = f2.add_subplot(1,1,1)
+ s2.plot(data_src)
+ s2.plot(data_snk.real, 'g')
+
+ pylab.show()
+
+if __name__ == "__main__":
+ try:
+ main()
+ except KeyboardInterrupt:
+ pass
+
diff --git a/gr-filter/examples/fir_filter_ccc.py b/gr-filter/examples/fir_filter_ccc.py
new file mode 100755
index 000000000..baa05eeb7
--- /dev/null
+++ b/gr-filter/examples/fir_filter_ccc.py
@@ -0,0 +1,92 @@
+#!/usr/bin/env python
+
+from gnuradio import gr, filter
+from gnuradio import eng_notation
+from gnuradio.eng_option import eng_option
+from optparse import OptionParser
+
+try:
+ import scipy
+except ImportError:
+ print "Error: could not import scipy (http://www.scipy.org/)"
+ sys.exit(1)
+
+try:
+ import pylab
+except ImportError:
+ print "Error: could not import pylab (http://matplotlib.sourceforge.net/)"
+ sys.exit(1)
+
+class example_fir_filter_ccc(gr.top_block):
+ def __init__(self, N, fs, bw, tw, atten, D):
+ gr.top_block.__init__(self)
+
+ self._nsamps = N
+ self._fs = fs
+ self._bw = bw
+ self._tw = tw
+ self._at = atten
+ self._decim = D
+ taps = filter.firdes.low_pass_2(1, self._fs, self._bw, self._tw, self._at)
+ print "Num. Taps: ", len(taps)
+
+ self.src = gr.noise_source_c(gr.GR_GAUSSIAN, 1)
+ self.head = gr.head(gr.sizeof_gr_complex, self._nsamps)
+
+ self.filt0 = filter.fir_filter_ccc(self._decim, taps)
+
+ self.vsnk_src = gr.vector_sink_c()
+ self.vsnk_out = gr.vector_sink_c()
+
+ self.connect(self.src, self.head, self.vsnk_src)
+ self.connect(self.head, self.filt0, self.vsnk_out)
+
+def main():
+ parser = OptionParser(option_class=eng_option, conflict_handler="resolve")
+ parser.add_option("-N", "--nsamples", type="int", default=10000,
+ help="Number of samples to process [default=%default]")
+ parser.add_option("-s", "--samplerate", type="eng_float", default=8000,
+ help="System sample rate [default=%default]")
+ parser.add_option("-B", "--bandwidth", type="eng_float", default=1000,
+ help="Filter bandwidth [default=%default]")
+ parser.add_option("-T", "--transition", type="eng_float", default=100,
+ help="Transition band [default=%default]")
+ parser.add_option("-A", "--attenuation", type="eng_float", default=80,
+ help="Stopband attenuation [default=%default]")
+ parser.add_option("-D", "--decimation", type="int", default=1,
+ help="Decmation factor [default=%default]")
+ (options, args) = parser.parse_args ()
+
+ put = example_fir_filter_ccc(options.nsamples,
+ options.samplerate,
+ options.bandwidth,
+ options.transition,
+ options.attenuation,
+ options.decimation)
+ put.run()
+
+ data_src = scipy.array(put.vsnk_src.data())
+ data_snk = scipy.array(put.vsnk_out.data())
+
+ # Plot the signals PSDs
+ nfft = 1024
+ f1 = pylab.figure(1, figsize=(12,10))
+ s1 = f1.add_subplot(1,1,1)
+ s1.psd(data_src, NFFT=nfft, noverlap=nfft/4,
+ Fs=options.samplerate)
+ s1.psd(data_snk, NFFT=nfft, noverlap=nfft/4,
+ Fs=options.samplerate)
+
+ f2 = pylab.figure(2, figsize=(12,10))
+ s2 = f2.add_subplot(1,1,1)
+ s2.plot(data_src)
+ s2.plot(data_snk.real, 'g')
+
+ pylab.show()
+
+if __name__ == "__main__":
+ try:
+ main()
+ except KeyboardInterrupt:
+ pass
+
diff --git a/gr-filter/examples/fir_filter_fff.py b/gr-filter/examples/fir_filter_fff.py
new file mode 100755
index 000000000..48769f00d
--- /dev/null
+++ b/gr-filter/examples/fir_filter_fff.py
@@ -0,0 +1,92 @@
+#!/usr/bin/env python
+
+from gnuradio import gr, filter
+from gnuradio import eng_notation
+from gnuradio.eng_option import eng_option
+from optparse import OptionParser
+
+try:
+ import scipy
+except ImportError:
+ print "Error: could not import scipy (http://www.scipy.org/)"
+ sys.exit(1)
+
+try:
+ import pylab
+except ImportError:
+ print "Error: could not import pylab (http://matplotlib.sourceforge.net/)"
+ sys.exit(1)
+
+class example_fir_filter_fff(gr.top_block):
+ def __init__(self, N, fs, bw, tw, atten, D):
+ gr.top_block.__init__(self)
+
+ self._nsamps = N
+ self._fs = fs
+ self._bw = bw
+ self._tw = tw
+ self._at = atten
+ self._decim = D
+ taps = filter.firdes.low_pass_2(1, self._fs, self._bw, self._tw, self._at)
+ print "Num. Taps: ", len(taps)
+
+ self.src = gr.noise_source_f(gr.GR_GAUSSIAN, 1)
+ self.head = gr.head(gr.sizeof_float, self._nsamps)
+
+ self.filt0 = filter.fir_filter_fff(self._decim, taps)
+
+ self.vsnk_src = gr.vector_sink_f()
+ self.vsnk_out = gr.vector_sink_f()
+
+ self.connect(self.src, self.head, self.vsnk_src)
+ self.connect(self.head, self.filt0, self.vsnk_out)
+
+def main():
+ parser = OptionParser(option_class=eng_option, conflict_handler="resolve")
+ parser.add_option("-N", "--nsamples", type="int", default=10000,
+ help="Number of samples to process [default=%default]")
+ parser.add_option("-s", "--samplerate", type="eng_float", default=8000,
+ help="System sample rate [default=%default]")
+ parser.add_option("-B", "--bandwidth", type="eng_float", default=1000,
+ help="Filter bandwidth [default=%default]")
+ parser.add_option("-T", "--transition", type="eng_float", default=100,
+ help="Transition band [default=%default]")
+ parser.add_option("-A", "--attenuation", type="eng_float", default=80,
+ help="Stopband attenuation [default=%default]")
+ parser.add_option("-D", "--decimation", type="int", default=1,
+ help="Decmation factor [default=%default]")
+ (options, args) = parser.parse_args ()
+
+ put = example_fir_filter_fff(options.nsamples,
+ options.samplerate,
+ options.bandwidth,
+ options.transition,
+ options.attenuation,
+ options.decimation)
+ put.run()
+
+ data_src = scipy.array(put.vsnk_src.data())
+ data_snk = scipy.array(put.vsnk_out.data())
+
+ # Plot the signals PSDs
+ nfft = 1024
+ f1 = pylab.figure(1, figsize=(12,10))
+ s1 = f1.add_subplot(1,1,1)
+ s1.psd(data_src, NFFT=nfft, noverlap=nfft/4,
+ Fs=options.samplerate)
+ s1.psd(data_snk, NFFT=nfft, noverlap=nfft/4,
+ Fs=options.samplerate)
+
+ f2 = pylab.figure(2, figsize=(12,10))
+ s2 = f2.add_subplot(1,1,1)
+ s2.plot(data_src)
+ s2.plot(data_snk.real, 'g')
+
+ pylab.show()
+
+if __name__ == "__main__":
+ try:
+ main()
+ except KeyboardInterrupt:
+ pass
+
diff --git a/gr-filter/examples/fmtest.py b/gr-filter/examples/fmtest.py
new file mode 100755
index 000000000..9b02526d9
--- /dev/null
+++ b/gr-filter/examples/fmtest.py
@@ -0,0 +1,226 @@
+#!/usr/bin/env python
+#
+# Copyright 2009,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.
+#
+
+from gnuradio import gr, blks2
+from gnuradio import filter
+import sys, math, time
+
+try:
+ import scipy
+ from scipy import fftpack
+except ImportError:
+ print "Error: Program requires scipy (see: www.scipy.org)."
+ sys.exit(1)
+
+try:
+ import pylab
+except ImportError:
+ print "Error: Program requires matplotlib (see: matplotlib.sourceforge.net)."
+ sys.exit(1)
+
+
+class fmtx(gr.hier_block2):
+ def __init__(self, lo_freq, audio_rate, if_rate):
+
+ gr.hier_block2.__init__(self, "build_fm",
+ gr.io_signature(1, 1, gr.sizeof_float),
+ gr.io_signature(1, 1, gr.sizeof_gr_complex))
+
+ fmtx = blks2.nbfm_tx (audio_rate, if_rate, max_dev=5e3, tau=75e-6)
+
+ # Local oscillator
+ lo = gr.sig_source_c (if_rate, # sample rate
+ gr.GR_SIN_WAVE, # waveform type
+ lo_freq, #frequency
+ 1.0, # amplitude
+ 0) # DC Offset
+ mixer = gr.multiply_cc ()
+
+ self.connect (self, fmtx, (mixer, 0))
+ self.connect (lo, (mixer, 1))
+ self.connect (mixer, self)
+
+class fmtest(gr.top_block):
+ def __init__(self):
+ gr.top_block.__init__(self)
+
+ self._nsamples = 1000000
+ self._audio_rate = 8000
+
+ # Set up N channels with their own baseband and IF frequencies
+ self._N = 5
+ chspacing = 16000
+ freq = [10, 20, 30, 40, 50]
+ f_lo = [0, 1*chspacing, -1*chspacing, 2*chspacing, -2*chspacing]
+
+ self._if_rate = 4*self._N*self._audio_rate
+
+ # Create a signal source and frequency modulate it
+ self.sum = gr.add_cc ()
+ for n in xrange(self._N):
+ sig = gr.sig_source_f(self._audio_rate, gr.GR_SIN_WAVE, freq[n], 0.5)
+ fm = fmtx(f_lo[n], self._audio_rate, self._if_rate)
+ self.connect(sig, fm)
+ self.connect(fm, (self.sum, n))
+
+ self.head = gr.head(gr.sizeof_gr_complex, self._nsamples)
+ self.snk_tx = gr.vector_sink_c()
+ self.channel = blks2.channel_model(0.1)
+
+ self.connect(self.sum, self.head, self.channel, self.snk_tx)
+
+
+ # Design the channlizer
+ self._M = 10
+ bw = chspacing/2.0
+ t_bw = chspacing/10.0
+ self._chan_rate = self._if_rate / self._M
+ self._taps = filter.firdes.low_pass_2(1, self._if_rate, bw, t_bw,
+ attenuation_dB=100,
+ window=filter.firdes.WIN_BLACKMAN_hARRIS)
+ tpc = math.ceil(float(len(self._taps)) / float(self._M))
+
+ print "Number of taps: ", len(self._taps)
+ print "Number of channels: ", self._M
+ print "Taps per channel: ", tpc
+
+ self.pfb = filter.pfb.channelizer_ccf(self._M, self._taps)
+
+ self.connect(self.channel, self.pfb)
+
+ # Create a file sink for each of M output channels of the filter and connect it
+ self.fmdet = list()
+ self.squelch = list()
+ self.snks = list()
+ for i in xrange(self._M):
+ self.fmdet.append(blks2.nbfm_rx(self._audio_rate, self._chan_rate))
+ self.squelch.append(blks2.standard_squelch(self._audio_rate*10))
+ self.snks.append(gr.vector_sink_f())
+ self.connect((self.pfb, i), self.fmdet[i], self.squelch[i], self.snks[i])
+
+ def num_tx_channels(self):
+ return self._N
+
+ def num_rx_channels(self):
+ return self._M
+
+def main():
+
+ fm = fmtest()
+
+ tstart = time.time()
+ fm.run()
+ tend = time.time()
+
+ if 1:
+ fig1 = pylab.figure(1, figsize=(12,10), facecolor="w")
+ fig2 = pylab.figure(2, figsize=(12,10), facecolor="w")
+ fig3 = pylab.figure(3, figsize=(12,10), facecolor="w")
+
+ Ns = 10000
+ Ne = 100000
+
+ fftlen = 8192
+ winfunc = scipy.blackman
+
+ # Plot transmitted signal
+ fs = fm._if_rate
+
+ d = fm.snk_tx.data()[Ns:Ns+Ne]
+ sp1_f = fig1.add_subplot(2, 1, 1)
+
+ X,freq = sp1_f.psd(d, NFFT=fftlen, noverlap=fftlen/4, Fs=fs,
+ window = lambda d: d*winfunc(fftlen),
+ visible=False)
+ X_in = 10.0*scipy.log10(abs(fftpack.fftshift(X)))
+ f_in = scipy.arange(-fs/2.0, fs/2.0, fs/float(X_in.size))
+ p1_f = sp1_f.plot(f_in, X_in, "b")
+ sp1_f.set_xlim([min(f_in), max(f_in)+1])
+ sp1_f.set_ylim([-120.0, 20.0])
+
+ sp1_f.set_title("Input Signal", weight="bold")
+ sp1_f.set_xlabel("Frequency (Hz)")
+ sp1_f.set_ylabel("Power (dBW)")
+
+ Ts = 1.0/fs
+ Tmax = len(d)*Ts
+
+ t_in = scipy.arange(0, Tmax, Ts)
+ x_in = scipy.array(d)
+ sp1_t = fig1.add_subplot(2, 1, 2)
+ p1_t = sp1_t.plot(t_in, x_in.real, "b-o")
+ #p1_t = sp1_t.plot(t_in, x_in.imag, "r-o")
+ sp1_t.set_ylim([-5, 5])
+
+ # Set up the number of rows and columns for plotting the subfigures
+ Ncols = int(scipy.floor(scipy.sqrt(fm.num_rx_channels())))
+ Nrows = int(scipy.floor(fm.num_rx_channels() / Ncols))
+ if(fm.num_rx_channels() % Ncols != 0):
+ Nrows += 1
+
+ # Plot each of the channels outputs. Frequencies on Figure 2 and
+ # time signals on Figure 3
+ fs_o = fm._audio_rate
+ for i in xrange(len(fm.snks)):
+ # remove issues with the transients at the beginning
+ # also remove some corruption at the end of the stream
+ # this is a bug, probably due to the corner cases
+ d = fm.snks[i].data()[Ns:Ne]
+
+ sp2_f = fig2.add_subplot(Nrows, Ncols, 1+i)
+ X,freq = sp2_f.psd(d, NFFT=fftlen, noverlap=fftlen/4, Fs=fs_o,
+ window = lambda d: d*winfunc(fftlen),
+ visible=False)
+ #X_o = 10.0*scipy.log10(abs(fftpack.fftshift(X)))
+ X_o = 10.0*scipy.log10(abs(X))
+ #f_o = scipy.arange(-fs_o/2.0, fs_o/2.0, fs_o/float(X_o.size))
+ f_o = scipy.arange(0, fs_o/2.0, fs_o/2.0/float(X_o.size))
+ p2_f = sp2_f.plot(f_o, X_o, "b")
+ sp2_f.set_xlim([min(f_o), max(f_o)+0.1])
+ sp2_f.set_ylim([-120.0, 20.0])
+ sp2_f.grid(True)
+
+ sp2_f.set_title(("Channel %d" % i), weight="bold")
+ sp2_f.set_xlabel("Frequency (kHz)")
+ sp2_f.set_ylabel("Power (dBW)")
+
+
+ Ts = 1.0/fs_o
+ Tmax = len(d)*Ts
+ t_o = scipy.arange(0, Tmax, Ts)
+
+ x_t = scipy.array(d)
+ sp2_t = fig3.add_subplot(Nrows, Ncols, 1+i)
+ p2_t = sp2_t.plot(t_o, x_t.real, "b")
+ p2_t = sp2_t.plot(t_o, x_t.imag, "r")
+ sp2_t.set_xlim([min(t_o), max(t_o)+1])
+ sp2_t.set_ylim([-1, 1])
+
+ sp2_t.set_xlabel("Time (s)")
+ sp2_t.set_ylabel("Amplitude")
+
+
+ pylab.show()
+
+
+if __name__ == "__main__":
+ main()
diff --git a/gr-filter/examples/interpolate.py b/gr-filter/examples/interpolate.py
new file mode 100755
index 000000000..56d78d597
--- /dev/null
+++ b/gr-filter/examples/interpolate.py
@@ -0,0 +1,240 @@
+#!/usr/bin/env python
+#
+# Copyright 2009,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.
+#
+
+from gnuradio import gr
+from gnuradio import filter
+import sys, time
+
+try:
+ import scipy
+ from scipy import fftpack
+except ImportError:
+ print "Error: Program requires scipy (see: www.scipy.org)."
+ sys.exit(1)
+
+try:
+ import pylab
+ from pylab import mlab
+except ImportError:
+ print "Error: Program requires matplotlib (see: matplotlib.sourceforge.net)."
+ sys.exit(1)
+
+class pfb_top_block(gr.top_block):
+ def __init__(self):
+ gr.top_block.__init__(self)
+
+ self._N = 100000 # number of samples to use
+ self._fs = 2000 # initial sampling rate
+ self._interp = 5 # Interpolation rate for PFB interpolator
+ self._ainterp = 5.5 # Resampling rate for the PFB arbitrary resampler
+
+ # Frequencies of the signals we construct
+ freq1 = 100
+ freq2 = 200
+
+ # Create a set of taps for the PFB interpolator
+ # This is based on the post-interpolation sample rate
+ self._taps = filter.firdes.low_pass_2(self._interp,
+ self._interp*self._fs,
+ freq2+50, 50,
+ attenuation_dB=120,
+ window=filter.firdes.WIN_BLACKMAN_hARRIS)
+
+ # Create a set of taps for the PFB arbitrary resampler
+ # The filter size is the number of filters in the filterbank; 32 will give very low side-lobes,
+ # and larger numbers will reduce these even farther
+ # The taps in this filter are based on a sampling rate of the filter size since it acts
+ # internally as an interpolator.
+ flt_size = 32
+ self._taps2 = filter.firdes.low_pass_2(flt_size,
+ flt_size*self._fs,
+ freq2+50, 150,
+ attenuation_dB=120,
+ window=filter.firdes.WIN_BLACKMAN_hARRIS)
+
+ # Calculate the number of taps per channel for our own information
+ tpc = scipy.ceil(float(len(self._taps)) / float(self._interp))
+ print "Number of taps: ", len(self._taps)
+ print "Number of filters: ", self._interp
+ print "Taps per channel: ", tpc
+
+ # Create a couple of signals at different frequencies
+ self.signal1 = gr.sig_source_c(self._fs, gr.GR_SIN_WAVE, freq1, 0.5)
+ self.signal2 = gr.sig_source_c(self._fs, gr.GR_SIN_WAVE, freq2, 0.5)
+ self.signal = gr.add_cc()
+
+ self.head = gr.head(gr.sizeof_gr_complex, self._N)
+
+ # Construct the PFB interpolator filter
+ self.pfb = filter.pfb.interpolator_ccf(self._interp, self._taps)
+
+ # Construct the PFB arbitrary resampler filter
+ self.pfb_ar = filter.pfb.arb_resampler_ccf(self._ainterp, self._taps2, flt_size)
+ self.snk_i = gr.vector_sink_c()
+
+ #self.pfb_ar.pfb.print_taps()
+ #self.pfb.pfb.print_taps()
+
+ # Connect the blocks
+ self.connect(self.signal1, self.head, (self.signal,0))
+ self.connect(self.signal2, (self.signal,1))
+ self.connect(self.signal, self.pfb)
+ self.connect(self.signal, self.pfb_ar)
+ self.connect(self.signal, self.snk_i)
+
+ # Create the sink for the interpolated signals
+ self.snk1 = gr.vector_sink_c()
+ self.snk2 = gr.vector_sink_c()
+ self.connect(self.pfb, self.snk1)
+ self.connect(self.pfb_ar, self.snk2)
+
+
+def main():
+ tb = pfb_top_block()
+
+ tstart = time.time()
+ tb.run()
+ tend = time.time()
+ print "Run time: %f" % (tend - tstart)
+
+
+ if 1:
+ fig1 = pylab.figure(1, figsize=(12,10), facecolor="w")
+ fig2 = pylab.figure(2, figsize=(12,10), facecolor="w")
+ fig3 = pylab.figure(3, figsize=(12,10), facecolor="w")
+
+ Ns = 10000
+ Ne = 10000
+
+ fftlen = 8192
+ winfunc = scipy.blackman
+
+ # Plot input signal
+ fs = tb._fs
+
+ d = tb.snk_i.data()[Ns:Ns+Ne]
+ sp1_f = fig1.add_subplot(2, 1, 1)
+
+ X,freq = mlab.psd(d, NFFT=fftlen, noverlap=fftlen/4, Fs=fs,
+ window = lambda d: d*winfunc(fftlen),
+ scale_by_freq=True)
+ X_in = 10.0*scipy.log10(abs(fftpack.fftshift(X)))
+ f_in = scipy.arange(-fs/2.0, fs/2.0, fs/float(X_in.size))
+ p1_f = sp1_f.plot(f_in, X_in, "b")
+ sp1_f.set_xlim([min(f_in), max(f_in)+1])
+ sp1_f.set_ylim([-200.0, 50.0])
+
+
+ sp1_f.set_title("Input Signal", weight="bold")
+ sp1_f.set_xlabel("Frequency (Hz)")
+ sp1_f.set_ylabel("Power (dBW)")
+
+ Ts = 1.0/fs
+ Tmax = len(d)*Ts
+
+ t_in = scipy.arange(0, Tmax, Ts)
+ x_in = scipy.array(d)
+ sp1_t = fig1.add_subplot(2, 1, 2)
+ p1_t = sp1_t.plot(t_in, x_in.real, "b-o")
+ #p1_t = sp1_t.plot(t_in, x_in.imag, "r-o")
+ sp1_t.set_ylim([-2.5, 2.5])
+
+ sp1_t.set_title("Input Signal", weight="bold")
+ sp1_t.set_xlabel("Time (s)")
+ sp1_t.set_ylabel("Amplitude")
+
+
+ # Plot output of PFB interpolator
+ fs_int = tb._fs*tb._interp
+
+ sp2_f = fig2.add_subplot(2, 1, 1)
+ d = tb.snk1.data()[Ns:Ns+(tb._interp*Ne)]
+ X,freq = mlab.psd(d, NFFT=fftlen, noverlap=fftlen/4, Fs=fs,
+ window = lambda d: d*winfunc(fftlen),
+ scale_by_freq=True)
+ X_o = 10.0*scipy.log10(abs(fftpack.fftshift(X)))
+ f_o = scipy.arange(-fs_int/2.0, fs_int/2.0, fs_int/float(X_o.size))
+ p2_f = sp2_f.plot(f_o, X_o, "b")
+ sp2_f.set_xlim([min(f_o), max(f_o)+1])
+ sp2_f.set_ylim([-200.0, 50.0])
+
+ sp2_f.set_title("Output Signal from PFB Interpolator", weight="bold")
+ sp2_f.set_xlabel("Frequency (Hz)")
+ sp2_f.set_ylabel("Power (dBW)")
+
+ Ts_int = 1.0/fs_int
+ Tmax = len(d)*Ts_int
+
+ t_o = scipy.arange(0, Tmax, Ts_int)
+ x_o1 = scipy.array(d)
+ sp2_t = fig2.add_subplot(2, 1, 2)
+ p2_t = sp2_t.plot(t_o, x_o1.real, "b-o")
+ #p2_t = sp2_t.plot(t_o, x_o.imag, "r-o")
+ sp2_t.set_ylim([-2.5, 2.5])
+
+ sp2_t.set_title("Output Signal from PFB Interpolator", weight="bold")
+ sp2_t.set_xlabel("Time (s)")
+ sp2_t.set_ylabel("Amplitude")
+
+
+ # Plot output of PFB arbitrary resampler
+ fs_aint = tb._fs * tb._ainterp
+
+ sp3_f = fig3.add_subplot(2, 1, 1)
+ d = tb.snk2.data()[Ns:Ns+(tb._interp*Ne)]
+ X,freq = mlab.psd(d, NFFT=fftlen, noverlap=fftlen/4, Fs=fs,
+ window = lambda d: d*winfunc(fftlen),
+ scale_by_freq=True)
+ X_o = 10.0*scipy.log10(abs(fftpack.fftshift(X)))
+ f_o = scipy.arange(-fs_aint/2.0, fs_aint/2.0, fs_aint/float(X_o.size))
+ p3_f = sp3_f.plot(f_o, X_o, "b")
+ sp3_f.set_xlim([min(f_o), max(f_o)+1])
+ sp3_f.set_ylim([-200.0, 50.0])
+
+ sp3_f.set_title("Output Signal from PFB Arbitrary Resampler", weight="bold")
+ sp3_f.set_xlabel("Frequency (Hz)")
+ sp3_f.set_ylabel("Power (dBW)")
+
+ Ts_aint = 1.0/fs_aint
+ Tmax = len(d)*Ts_aint
+
+ t_o = scipy.arange(0, Tmax, Ts_aint)
+ x_o2 = scipy.array(d)
+ sp3_f = fig3.add_subplot(2, 1, 2)
+ p3_f = sp3_f.plot(t_o, x_o2.real, "b-o")
+ p3_f = sp3_f.plot(t_o, x_o1.real, "m-o")
+ #p3_f = sp3_f.plot(t_o, x_o2.imag, "r-o")
+ sp3_f.set_ylim([-2.5, 2.5])
+
+ sp3_f.set_title("Output Signal from PFB Arbitrary Resampler", weight="bold")
+ sp3_f.set_xlabel("Time (s)")
+ sp3_f.set_ylabel("Amplitude")
+
+ pylab.show()
+
+
+if __name__ == "__main__":
+ try:
+ main()
+ except KeyboardInterrupt:
+ pass
+
diff --git a/gr-filter/examples/reconstruction.py b/gr-filter/examples/reconstruction.py
new file mode 100755
index 000000000..9e38f3669
--- /dev/null
+++ b/gr-filter/examples/reconstruction.py
@@ -0,0 +1,164 @@
+#!/usr/bin/env python
+#
+# Copyright 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.
+#
+
+from gnuradio import gr, digital
+from gnuradio import filter
+
+try:
+ import scipy
+ from scipy import fftpack
+except ImportError:
+ print "Error: Program requires scipy (see: www.scipy.org)."
+ sys.exit(1)
+
+try:
+ import pylab
+except ImportError:
+ print "Error: Program requires matplotlib (see: matplotlib.sourceforge.net)."
+ sys.exit(1)
+
+fftlen = 8192
+
+def main():
+ N = 10000
+ fs = 2000.0
+ Ts = 1.0/fs
+ t = scipy.arange(0, N*Ts, Ts)
+
+ # When playing with the number of channels, be careful about the filter
+ # specs and the channel map of the synthesizer set below.
+ nchans = 10
+
+ # Build the filter(s)
+ bw = 1000
+ tb = 400
+ proto_taps = filter.firdes.low_pass_2(1, nchans*fs,
+ bw, tb, 80,
+ filter.firdes.WIN_BLACKMAN_hARRIS)
+ print "Filter length: ", len(proto_taps)
+
+
+ # Create a modulated signal
+ npwr = 0.01
+ data = scipy.random.randint(0, 256, N)
+ rrc_taps = filter.firdes.root_raised_cosine(1, 2, 1, 0.35, 41)
+
+ src = gr.vector_source_b(data.astype(scipy.uint8).tolist(), False)
+ mod = digital.bpsk_mod(samples_per_symbol=2)
+ chan = gr.channel_model(npwr)
+ rrc = filter.fft_filter_ccc(1, rrc_taps)
+
+ # Split it up into pieces
+ channelizer = filter.pfb.channelizer_ccf(nchans, proto_taps, 2)
+
+ # Put the pieces back together again
+ syn_taps = [nchans*t for t in proto_taps]
+ synthesizer = filter.pfb_synthesizer_ccf(nchans, syn_taps, True)
+ src_snk = gr.vector_sink_c()
+ snk = gr.vector_sink_c()
+
+ # Remap the location of the channels
+ # Can be done in synth or channelizer (watch out for rotattions in
+ # the channelizer)
+ synthesizer.set_channel_map([ 0, 1, 2, 3, 4,
+ 15, 16, 17, 18, 19])
+
+ tb = gr.top_block()
+ tb.connect(src, mod, chan, rrc, channelizer)
+ tb.connect(rrc, src_snk)
+
+ vsnk = []
+ for i in xrange(nchans):
+ tb.connect((channelizer,i), (synthesizer, i))
+
+ vsnk.append(gr.vector_sink_c())
+ tb.connect((channelizer,i), vsnk[i])
+
+ tb.connect(synthesizer, snk)
+ tb.run()
+
+ sin = scipy.array(src_snk.data()[1000:])
+ sout = scipy.array(snk.data()[1000:])
+
+
+ # Plot original signal
+ fs_in = nchans*fs
+ f1 = pylab.figure(1, figsize=(16,12), facecolor='w')
+ s11 = f1.add_subplot(2,2,1)
+ s11.psd(sin, NFFT=fftlen, Fs=fs_in)
+ s11.set_title("PSD of Original Signal")
+ s11.set_ylim([-200, -20])
+
+ s12 = f1.add_subplot(2,2,2)
+ s12.plot(sin.real[1000:1500], "o-b")
+ s12.plot(sin.imag[1000:1500], "o-r")
+ s12.set_title("Original Signal in Time")
+
+ start = 1
+ skip = 4
+ s13 = f1.add_subplot(2,2,3)
+ s13.plot(sin.real[start::skip], sin.imag[start::skip], "o")
+ s13.set_title("Constellation")
+ s13.set_xlim([-2, 2])
+ s13.set_ylim([-2, 2])
+
+ # Plot channels
+ nrows = int(scipy.sqrt(nchans))
+ ncols = int(scipy.ceil(float(nchans)/float(nrows)))
+
+ f2 = pylab.figure(2, figsize=(16,12), facecolor='w')
+ for n in xrange(nchans):
+ s = f2.add_subplot(nrows, ncols, n+1)
+ s.psd(vsnk[n].data(), NFFT=fftlen, Fs=fs_in)
+ s.set_title("Channel {0}".format(n))
+ s.set_ylim([-200, -20])
+
+ # Plot reconstructed signal
+ fs_out = 2*nchans*fs
+ f3 = pylab.figure(3, figsize=(16,12), facecolor='w')
+ s31 = f3.add_subplot(2,2,1)
+ s31.psd(sout, NFFT=fftlen, Fs=fs_out)
+ s31.set_title("PSD of Reconstructed Signal")
+ s31.set_ylim([-200, -20])
+
+ s32 = f3.add_subplot(2,2,2)
+ s32.plot(sout.real[1000:1500], "o-b")
+ s32.plot(sout.imag[1000:1500], "o-r")
+ s32.set_title("Reconstructed Signal in Time")
+
+ start = 2
+ skip = 4
+ s33 = f3.add_subplot(2,2,3)
+ s33.plot(sout.real[start::skip], sout.imag[start::skip], "o")
+ s33.set_title("Constellation")
+ s33.set_xlim([-2, 2])
+ s33.set_ylim([-2, 2])
+
+ pylab.show()
+
+
+if __name__ == "__main__":
+ try:
+ main()
+ except KeyboardInterrupt:
+ pass
+
diff --git a/gr-filter/examples/resampler.py b/gr-filter/examples/resampler.py
new file mode 100755
index 000000000..395e095cb
--- /dev/null
+++ b/gr-filter/examples/resampler.py
@@ -0,0 +1,128 @@
+#!/usr/bin/env python
+#
+# Copyright 2009,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.
+#
+
+from gnuradio import gr
+from gnuradio import filter
+import sys
+
+try:
+ import scipy
+except ImportError:
+ print "Error: Program requires scipy (see: www.scipy.org)."
+ sys.exit(1)
+
+try:
+ import pylab
+except ImportError:
+ print "Error: Program requires matplotlib (see: matplotlib.sourceforge.net)."
+ sys.exit(1)
+
+class mytb(gr.top_block):
+ def __init__(self, fs_in, fs_out, fc, N=10000):
+ gr.top_block.__init__(self)
+
+ rerate = float(fs_out) / float(fs_in)
+ print "Resampling from %f to %f by %f " %(fs_in, fs_out, rerate)
+
+ # Creating our own taps
+ taps = gr.firdes.low_pass_2(32, 32, 0.25, 0.1, 80)
+
+ self.src = gr.sig_source_c(fs_in, gr.GR_SIN_WAVE, fc, 1)
+ #self.src = gr.noise_source_c(gr.GR_GAUSSIAN, 1)
+ self.head = gr.head(gr.sizeof_gr_complex, N)
+
+ # A resampler with our taps
+ self.resamp_0 = filter.pfb.arb_resampler_ccf(rerate, taps,
+ flt_size=32)
+
+ # A resampler that just needs a resampling rate.
+ # Filter is created for us and designed to cover
+ # entire bandwidth of the input signal.
+ # An optional atten=XX rate can be used here to
+ # specify the out-of-band rejection (default=80).
+ self.resamp_1 = filter.pfb.arb_resampler_ccf(rerate)
+
+ self.snk_in = gr.vector_sink_c()
+ self.snk_0 = gr.vector_sink_c()
+ self.snk_1 = gr.vector_sink_c()
+
+ self.connect(self.src, self.head, self.snk_in)
+ self.connect(self.head, self.resamp_0, self.snk_0)
+ self.connect(self.head, self.resamp_1, self.snk_1)
+
+def main():
+ fs_in = 8000
+ fs_out = 20000
+ fc = 1000
+ N = 10000
+
+ tb = mytb(fs_in, fs_out, fc, N)
+ tb.run()
+
+
+ # Plot PSD of signals
+ nfftsize = 2048
+ fig1 = pylab.figure(1, figsize=(10,10), facecolor="w")
+ sp1 = fig1.add_subplot(2,1,1)
+ sp1.psd(tb.snk_in.data(), NFFT=nfftsize,
+ noverlap=nfftsize/4, Fs = fs_in)
+ sp1.set_title(("Input Signal at f_s=%.2f kHz" % (fs_in/1000.0)))
+ sp1.set_xlim([-fs_in/2, fs_in/2])
+
+ sp2 = fig1.add_subplot(2,1,2)
+ sp2.psd(tb.snk_0.data(), NFFT=nfftsize,
+ noverlap=nfftsize/4, Fs = fs_out,
+ label="With our filter")
+ sp2.psd(tb.snk_1.data(), NFFT=nfftsize,
+ noverlap=nfftsize/4, Fs = fs_out,
+ label="With auto-generated filter")
+ sp2.set_title(("Output Signals at f_s=%.2f kHz" % (fs_out/1000.0)))
+ sp2.set_xlim([-fs_out/2, fs_out/2])
+ sp2.legend()
+
+ # Plot signals in time
+ Ts_in = 1.0/fs_in
+ Ts_out = 1.0/fs_out
+ t_in = scipy.arange(0, len(tb.snk_in.data())*Ts_in, Ts_in)
+ t_out = scipy.arange(0, len(tb.snk_0.data())*Ts_out, Ts_out)
+
+ fig2 = pylab.figure(2, figsize=(10,10), facecolor="w")
+ sp21 = fig2.add_subplot(2,1,1)
+ sp21.plot(t_in, tb.snk_in.data())
+ sp21.set_title(("Input Signal at f_s=%.2f kHz" % (fs_in/1000.0)))
+ sp21.set_xlim([t_in[100], t_in[200]])
+
+ sp22 = fig2.add_subplot(2,1,2)
+ sp22.plot(t_out, tb.snk_0.data(),
+ label="With our filter")
+ sp22.plot(t_out, tb.snk_1.data(),
+ label="With auto-generated filter")
+ sp22.set_title(("Output Signals at f_s=%.2f kHz" % (fs_out/1000.0)))
+ r = float(fs_out)/float(fs_in)
+ sp22.set_xlim([t_out[r * 100], t_out[r * 200]])
+ sp22.legend()
+
+ pylab.show()
+
+if __name__ == "__main__":
+ main()
+
diff --git a/gr-filter/examples/resampler_demo.grc b/gr-filter/examples/resampler_demo.grc
new file mode 100644
index 000000000..b3991ac19
--- /dev/null
+++ b/gr-filter/examples/resampler_demo.grc
@@ -0,0 +1,630 @@
+<?xml version='1.0' encoding='ASCII'?>
+<flow_graph>
+ <timestamp>Tue Jun 19 21:31:30 2012</timestamp>
+ <block>
+ <key>options</key>
+ <param>
+ <key>id</key>
+ <value>resampler_demo</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>title</key>
+ <value></value>
+ </param>
+ <param>
+ <key>author</key>
+ <value></value>
+ </param>
+ <param>
+ <key>description</key>
+ <value></value>
+ </param>
+ <param>
+ <key>window_size</key>
+ <value>1280, 1024</value>
+ </param>
+ <param>
+ <key>generate_options</key>
+ <value>wx_gui</value>
+ </param>
+ <param>
+ <key>category</key>
+ <value>Custom</value>
+ </param>
+ <param>
+ <key>run_options</key>
+ <value>prompt</value>
+ </param>
+ <param>
+ <key>run</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>realtime_scheduling</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(10, 10)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>import</key>
+ <param>
+ <key>id</key>
+ <value>import_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>import</key>
+ <value>import math</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(11, 59)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable</key>
+ <param>
+ <key>id</key>
+ <value>rs_taps</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>firdes.low_pass(nphases, nphases, frac_bw, 0.5-frac_bw)</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(273, 154)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>gr_add_const_vxx</key>
+ <param>
+ <key>id</key>
+ <value>adder</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>float</value>
+ </param>
+ <param>
+ <key>const</key>
+ <value>-1.0</value>
+ </param>
+ <param>
+ <key>vlen</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(227, 303)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>gr_throttle</key>
+ <param>
+ <key>id</key>
+ <value>throttle</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>float</value>
+ </param>
+ <param>
+ <key>samples_per_second</key>
+ <value>samp_rate</value>
+ </param>
+ <param>
+ <key>vlen</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(227, 493)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>wxgui_fftsink2</key>
+ <param>
+ <key>id</key>
+ <value>orig_fft</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>complex</value>
+ </param>
+ <param>
+ <key>title</key>
+ <value>Original Spectrum</value>
+ </param>
+ <param>
+ <key>samp_rate</key>
+ <value>samp_rate</value>
+ </param>
+ <param>
+ <key>baseband_freq</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>y_per_div</key>
+ <value>10</value>
+ </param>
+ <param>
+ <key>y_divs</key>
+ <value>10</value>
+ </param>
+ <param>
+ <key>ref_level</key>
+ <value>30</value>
+ </param>
+ <param>
+ <key>ref_scale</key>
+ <value>2.0</value>
+ </param>
+ <param>
+ <key>fft_size</key>
+ <value>1024</value>
+ </param>
+ <param>
+ <key>fft_rate</key>
+ <value>30</value>
+ </param>
+ <param>
+ <key>peak_hold</key>
+ <value>False</value>
+ </param>
+ <param>
+ <key>average</key>
+ <value>False</value>
+ </param>
+ <param>
+ <key>avg_alpha</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>win</key>
+ <value>None</value>
+ </param>
+ <param>
+ <key>win_size</key>
+ <value></value>
+ </param>
+ <param>
+ <key>grid_pos</key>
+ <value>1, 0, 1, 3</value>
+ </param>
+ <param>
+ <key>notebook</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(409, 289)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>180</value>
+ </param>
+ </block>
+ <block>
+ <key>gr_sig_source_x</key>
+ <param>
+ <key>id</key>
+ <value>tri_source</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>float</value>
+ </param>
+ <param>
+ <key>samp_rate</key>
+ <value>samp_rate</value>
+ </param>
+ <param>
+ <key>waveform</key>
+ <value>gr.GR_TRI_WAVE</value>
+ </param>
+ <param>
+ <key>freq</key>
+ <value>0.05</value>
+ </param>
+ <param>
+ <key>amp</key>
+ <value>2.0</value>
+ </param>
+ <param>
+ <key>offset</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(21, 271)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable</key>
+ <param>
+ <key>id</key>
+ <value>nphases</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>32</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(185, 153)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable_static_text</key>
+ <param>
+ <key>id</key>
+ <value>samp_rate</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>label</key>
+ <value>Sample Rate</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>44100</value>
+ </param>
+ <param>
+ <key>converver</key>
+ <value>float_converter</value>
+ </param>
+ <param>
+ <key>formatter</key>
+ <value>None</value>
+ </param>
+ <param>
+ <key>grid_pos</key>
+ <value>0, 0, 1, 1</value>
+ </param>
+ <param>
+ <key>notebook</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(179, 14)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable_static_text</key>
+ <param>
+ <key>id</key>
+ <value>new_rate</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>label</key>
+ <value>Resampled Rate</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>48000</value>
+ </param>
+ <param>
+ <key>converver</key>
+ <value>float_converter</value>
+ </param>
+ <param>
+ <key>formatter</key>
+ <value>None</value>
+ </param>
+ <param>
+ <key>grid_pos</key>
+ <value>0, 1, 1, 1</value>
+ </param>
+ <param>
+ <key>notebook</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(328, 15)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable_static_text</key>
+ <param>
+ <key>id</key>
+ <value>frac_bw</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>label</key>
+ <value>Fractional Bandwidth</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>0.45</value>
+ </param>
+ <param>
+ <key>converver</key>
+ <value>float_converter</value>
+ </param>
+ <param>
+ <key>formatter</key>
+ <value>lambda x: "%0.2f"%x</value>
+ </param>
+ <param>
+ <key>grid_pos</key>
+ <value>0,2,1,1</value>
+ </param>
+ <param>
+ <key>notebook</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(473, 14)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>gr_frequency_modulator_fc</key>
+ <param>
+ <key>id</key>
+ <value>fm_mod</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>sensitivity</key>
+ <value>math.pi</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(411, 493)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>wxgui_fftsink2</key>
+ <param>
+ <key>id</key>
+ <value>resamp_fft</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>complex</value>
+ </param>
+ <param>
+ <key>title</key>
+ <value>Resampled Spectrum</value>
+ </param>
+ <param>
+ <key>samp_rate</key>
+ <value>new_rate</value>
+ </param>
+ <param>
+ <key>baseband_freq</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>y_per_div</key>
+ <value>10</value>
+ </param>
+ <param>
+ <key>y_divs</key>
+ <value>10</value>
+ </param>
+ <param>
+ <key>ref_level</key>
+ <value>30</value>
+ </param>
+ <param>
+ <key>ref_scale</key>
+ <value>2.0</value>
+ </param>
+ <param>
+ <key>fft_size</key>
+ <value>1024</value>
+ </param>
+ <param>
+ <key>fft_rate</key>
+ <value>30</value>
+ </param>
+ <param>
+ <key>peak_hold</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>average</key>
+ <value>False</value>
+ </param>
+ <param>
+ <key>avg_alpha</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>win</key>
+ <value>None</value>
+ </param>
+ <param>
+ <key>win_size</key>
+ <value></value>
+ </param>
+ <param>
+ <key>grid_pos</key>
+ <value>2, 0, 1, 3</value>
+ </param>
+ <param>
+ <key>notebook</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(640, 256)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>180</value>
+ </param>
+ </block>
+ <block>
+ <key>pfb_arb_resampler_xxx</key>
+ <param>
+ <key>id</key>
+ <value>pfb_arb_resampler_xxx_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>ccf</value>
+ </param>
+ <param>
+ <key>rrate</key>
+ <value>float(new_rate)/samp_rate</value>
+ </param>
+ <param>
+ <key>taps</key>
+ <value>rs_taps</value>
+ </param>
+ <param>
+ <key>nfilts</key>
+ <value>nphases</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(649, 469)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <connection>
+ <source_block_id>tri_source</source_block_id>
+ <sink_block_id>adder</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>adder</source_block_id>
+ <sink_block_id>throttle</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>fm_mod</source_block_id>
+ <sink_block_id>orig_fft</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>throttle</source_block_id>
+ <sink_block_id>fm_mod</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>fm_mod</source_block_id>
+ <sink_block_id>pfb_arb_resampler_xxx_0</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>pfb_arb_resampler_xxx_0</source_block_id>
+ <sink_block_id>resamp_fft</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+</flow_graph>
diff --git a/gr-filter/examples/synth_filter.py b/gr-filter/examples/synth_filter.py
new file mode 100755
index 000000000..a5b6fdf4c
--- /dev/null
+++ b/gr-filter/examples/synth_filter.py
@@ -0,0 +1,85 @@
+#!/usr/bin/env python
+#
+# Copyright 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.
+#
+
+from gnuradio import gr
+from gnuradio import filter
+import sys
+
+try:
+ import scipy
+except ImportError:
+ print "Error: Program requires scipy (see: www.scipy.org)."
+ sys.exit(1)
+
+try:
+ import pylab
+except ImportError:
+ print "Error: Program requires matplotlib (see: matplotlib.sourceforge.net)."
+ sys.exit(1)
+
+def main():
+ N = 1000000
+ fs = 8000
+
+ freqs = [100, 200, 300, 400, 500]
+ nchans = 7
+
+ sigs = list()
+ for fi in freqs:
+ s = gr.sig_source_c(fs, gr.GR_SIN_WAVE, fi, 1)
+ sigs.append(s)
+
+ taps = filter.firdes.low_pass_2(len(freqs), fs,
+ fs/float(nchans)/2, 100, 100)
+ print "Num. Taps = %d (taps per filter = %d)" % (len(taps),
+ len(taps)/nchans)
+ filtbank = filter.pfb_synthesizer_ccf(nchans, taps)
+
+ head = gr.head(gr.sizeof_gr_complex, N)
+ snk = gr.vector_sink_c()
+
+ tb = gr.top_block()
+ tb.connect(filtbank, head, snk)
+
+ for i,si in enumerate(sigs):
+ tb.connect(si, (filtbank, i))
+
+ tb.run()
+
+ if 1:
+ f1 = pylab.figure(1)
+ s1 = f1.add_subplot(1,1,1)
+ s1.plot(snk.data()[1000:])
+
+ fftlen = 2048
+ f2 = pylab.figure(2)
+ s2 = f2.add_subplot(1,1,1)
+ winfunc = scipy.blackman
+ s2.psd(snk.data()[10000:], NFFT=fftlen,
+ Fs = nchans*fs,
+ noverlap=fftlen/4,
+ window = lambda d: d*winfunc(fftlen))
+
+ pylab.show()
+
+if __name__ == "__main__":
+ main()
diff --git a/gr-filter/examples/synth_to_chan.py b/gr-filter/examples/synth_to_chan.py
new file mode 100755
index 000000000..b5f4c958e
--- /dev/null
+++ b/gr-filter/examples/synth_to_chan.py
@@ -0,0 +1,118 @@
+#!/usr/bin/env python
+#
+# Copyright 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.
+#
+
+from gnuradio import gr, blks2
+from gnuradio import filter
+import sys
+
+try:
+ import scipy
+except ImportError:
+ print "Error: Program requires scipy (see: www.scipy.org)."
+ sys.exit(1)
+
+try:
+ import pylab
+except ImportError:
+ print "Error: Program requires matplotlib (see: matplotlib.sourceforge.net)."
+ sys.exit(1)
+
+def main():
+ N = 1000000
+ fs = 8000
+
+ freqs = [100, 200, 300, 400, 500]
+ nchans = 7
+
+ sigs = list()
+ fmtx = list()
+ for fi in freqs:
+ s = gr.sig_source_f(fs, gr.GR_SIN_WAVE, fi, 1)
+ fm = blks2.nbfm_tx (fs, 4*fs, max_dev=10000, tau=75e-6)
+ sigs.append(s)
+ fmtx.append(fm)
+
+ syntaps = filter.firdes.low_pass_2(len(freqs), fs, fs/float(nchans)/2, 100, 100)
+ print "Synthesis Num. Taps = %d (taps per filter = %d)" % (len(syntaps),
+ len(syntaps)/nchans)
+ chtaps = filter.firdes.low_pass_2(len(freqs), fs, fs/float(nchans)/2, 100, 100)
+ print "Channelizer Num. Taps = %d (taps per filter = %d)" % (len(chtaps),
+ len(chtaps)/nchans)
+ filtbank = filter.pfb_synthesizer_ccf(nchans, syntaps)
+ channelizer = filter.pfb.channelizer_ccf(nchans, chtaps)
+
+ noise_level = 0.01
+ head = gr.head(gr.sizeof_gr_complex, N)
+ noise = gr.noise_source_c(gr.GR_GAUSSIAN, noise_level)
+ addnoise = gr.add_cc()
+ snk_synth = gr.vector_sink_c()
+
+ tb = gr.top_block()
+
+ tb.connect(noise, (addnoise,0))
+ tb.connect(filtbank, head, (addnoise, 1))
+ tb.connect(addnoise, channelizer)
+ tb.connect(addnoise, snk_synth)
+
+ snk = list()
+ for i,si in enumerate(sigs):
+ tb.connect(si, fmtx[i], (filtbank, i))
+
+ for i in xrange(nchans):
+ snk.append(gr.vector_sink_c())
+ tb.connect((channelizer, i), snk[i])
+
+ tb.run()
+
+ if 1:
+ channel = 1
+ data = snk[channel].data()[1000:]
+
+ f1 = pylab.figure(1)
+ s1 = f1.add_subplot(1,1,1)
+ s1.plot(data[10000:10200] )
+ s1.set_title(("Output Signal from Channel %d" % channel))
+
+ fftlen = 2048
+ winfunc = scipy.blackman
+ #winfunc = scipy.hamming
+
+ f2 = pylab.figure(2)
+ s2 = f2.add_subplot(1,1,1)
+ s2.psd(data, NFFT=fftlen,
+ Fs = nchans*fs,
+ noverlap=fftlen/4,
+ window = lambda d: d*winfunc(fftlen))
+ s2.set_title(("Output PSD from Channel %d" % channel))
+
+ f3 = pylab.figure(3)
+ s3 = f3.add_subplot(1,1,1)
+ s3.psd(snk_synth.data()[1000:], NFFT=fftlen,
+ Fs = nchans*fs,
+ noverlap=fftlen/4,
+ window = lambda d: d*winfunc(fftlen))
+ s3.set_title("Output of Synthesis Filter")
+
+ pylab.show()
+
+if __name__ == "__main__":
+ main()
diff --git a/gr-filter/gnuradio-filter.pc.in b/gr-filter/gnuradio-filter.pc.in
new file mode 100644
index 000000000..e4e83b350
--- /dev/null
+++ b/gr-filter/gnuradio-filter.pc.in
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: gnuradio-filter
+Description: GNU Radio's filter signal processing blocks
+Requires: gnuradio-core gnuradio-fft
+Version: @LIBVER@
+Libs: -L${libdir} -lgnuradio-filter
+Cflags: -I${includedir}
diff --git a/gr-filter/grc/CMakeLists.txt b/gr-filter/grc/CMakeLists.txt
new file mode 100644
index 000000000..2e3fef4f0
--- /dev/null
+++ b/gr-filter/grc/CMakeLists.txt
@@ -0,0 +1,41 @@
+# 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.
+
+install(FILES
+ filter_block_tree.xml
+ dc_blocker_xx.xml
+ fft_filter_xxx.xml
+ fir_filter_xxx.xml
+ filter_delay_fc.xml
+ fractional_interpolator_xx.xml
+ freq_xlating_fir_filter_xxx.xml
+ hilbert_fc.xml
+ iir_filter_ffd.xml
+ interp_fir_filter_xxx.xml
+ pfb_arb_resampler.xml
+ pfb_channelizer.xml
+ pfb_decimator.xml
+ pfb_interpolator.xml
+ pfb_synthesizer.xml
+ rational_resampler_base_xxx.xml
+ single_pole_iir_filter_xx.xml
+ channel_model.xml
+ DESTINATION ${GRC_BLOCKS_DIR}
+ COMPONENT "filter_python"
+)
diff --git a/gr-filter/grc/channel_model.xml b/gr-filter/grc/channel_model.xml
new file mode 100644
index 000000000..6d780974a
--- /dev/null
+++ b/gr-filter/grc/channel_model.xml
@@ -0,0 +1,61 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Channel Model
+###################################################
+ -->
+<block>
+ <name>Channel Model</name>
+ <key>channel_model</key>
+ <import>from gnuradio import filter</import>
+ <import>from gnuradio.filter import firdes</import>
+ <make>filter.channel_model(
+ noise_voltage=$noise_voltage,
+ frequency_offset=$freq_offset,
+ epsilon=$epsilon,
+ taps=$taps,
+ noise_seed=$seed,
+)</make>
+ <callback>set_noise_voltage($noise_voltage)</callback>
+ <callback>set_frequency_offset($freq_offset)</callback>
+ <callback>set_taps($taps)</callback>
+ <callback>set_timing_offset($epsilon)</callback>
+ <param>
+ <name>Noise Voltage</name>
+ <key>noise_voltage</key>
+ <value>0.0</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Frequency Offset</name>
+ <key>freq_offset</key>
+ <value>0.0</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Epsilon</name>
+ <key>epsilon</key>
+ <value>1.0</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Taps</name>
+ <key>taps</key>
+ <value>1.0 + 1.0j</value>
+ <type>complex_vector</type>
+ </param>
+ <param>
+ <name>Seed</name>
+ <key>seed</key>
+ <value>0</value>
+ <type>int</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>complex</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>complex</type>
+ </source>
+</block>
diff --git a/gr-filter/grc/dc_blocker_xx.xml b/gr-filter/grc/dc_blocker_xx.xml
new file mode 100644
index 000000000..9bce5e980
--- /dev/null
+++ b/gr-filter/grc/dc_blocker_xx.xml
@@ -0,0 +1,51 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+## DC Blocker
+###################################################
+ -->
+<block>
+ <name>DC Blocker</name>
+ <key>dc_blocker_xx</key>
+ <import>from gnuradio import filter</import>
+ <make>filter.dc_blocker_$(type)($length, $long_form)</make>
+ <!-- <callback>set_length($length)</callback> -->
+ <param>
+ <name>Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex->Complex</name>
+ <key>cc</key>
+ <opt>input:complex</opt>
+ <opt>output:complex</opt>
+ </option>
+ <option>
+ <name>Float->Float</name>
+ <key>ff</key>
+ <opt>input:float</opt>
+ <opt>output:float</opt>
+ </option>
+ </param>
+ <param>
+ <name>Length</name>
+ <key>length</key>
+ <value>32</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Long Form</name>
+ <key>long_form</key>
+ <value>True</value>
+ <type>bool</type>
+ </param>
+
+ <sink>
+ <name>in</name>
+ <type>$type.input</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type.output</type>
+ </source>
+</block>
diff --git a/gr-filter/grc/fft_filter_xxx.xml b/gr-filter/grc/fft_filter_xxx.xml
new file mode 100644
index 000000000..29612dffd
--- /dev/null
+++ b/gr-filter/grc/fft_filter_xxx.xml
@@ -0,0 +1,59 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##FFT Filter
+###################################################
+ -->
+<block>
+ <name>FFT Filter</name>
+ <key>fft_filter_xxx</key>
+ <import>from gnuradio import filter</import>
+ <import>from gnuradio.gr import firdes</import>
+ <make>filter.fft_filter_$(type)($decim, $taps, $nthreads)</make>
+ <callback>set_taps($taps)</callback>
+ <callback>set_nthreads($nthreads)</callback>
+ <param>
+ <name>Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex->Complex (Complex Taps)</name>
+ <key>ccc</key>
+ <opt>input:complex</opt>
+ <opt>output:complex</opt>
+ <opt>taps:complex_vector</opt>
+ </option>
+ <option>
+ <name>Float->Float (Real Taps)</name>
+ <key>fff</key>
+ <opt>input:float</opt>
+ <opt>output:float</opt>
+ <opt>taps:real_vector</opt>
+ </option>
+ </param>
+ <param>
+ <name>Decimation</name>
+ <key>decim</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Taps</name>
+ <key>taps</key>
+ <type>$type.taps</type>
+ </param>
+ <param>
+ <name>Num. Threads</name>
+ <key>nthreads</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>$type.input</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type.output</type>
+ </source>
+</block>
diff --git a/gr-filter/grc/filter_block_tree.xml b/gr-filter/grc/filter_block_tree.xml
new file mode 100644
index 000000000..711ce4059
--- /dev/null
+++ b/gr-filter/grc/filter_block_tree.xml
@@ -0,0 +1,51 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+<!--
+###################################################
+##Block Tree for GR Filter blocks.
+###################################################
+ -->
+<cat>
+ <name></name> <!-- Blank for Root Name -->
+ <cat>
+ <name>Filters</name>
+ <block>dc_blocker_xx</block>
+ <block>fft_filter_xxx</block>
+ <block>fir_filter_xxx</block>
+ <block>filter_delay_fc</block>
+ <block>fractional_interpolator_xx</block>
+ <block>freq_xlating_fir_filter_xxx</block>
+ <block>hilbert_fc</block>
+ <block>iir_filter_ffd</block>
+ <block>interp_fir_filter_xxx</block>
+ <block>pfb_arb_resampler_xxx</block>
+ <block>pfb_channelizer_ccf</block>
+ <block>pfb_decimator_ccf</block>
+ <block>pfb_interpolator_ccf</block>
+ <block>pfb_synthesizer_ccf</block>
+ <block>rational_resampler_base_xxx</block>
+ <block>single_pole_iir_filter_xx</block>
+ <block>channel_model</block>
+ </cat>
+</cat>
diff --git a/gr-filter/grc/filter_delay_fc.xml b/gr-filter/grc/filter_delay_fc.xml
new file mode 100644
index 000000000..7b77c2caf
--- /dev/null
+++ b/gr-filter/grc/filter_delay_fc.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Filter Delay
+###################################################
+ -->
+<block>
+ <name>Filter Delay</name>
+ <key>filter_delay_fc</key>
+ <import>from gnuradio import filter</import>
+ <import>from gnuradio.filter import firdes</import>
+ <make>filter.filter_delay_fc($taps)</make>
+ <param>
+ <name>Taps</name>
+ <key>taps</key>
+ <type>real_vector</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>float</type>
+ </sink>
+ <sink>
+ <name>in</name>
+ <type>float</type>
+ <optional>1</optional>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>complex</type>
+ </source>
+</block>
diff --git a/gr-filter/grc/fir_filter_xxx.xml b/gr-filter/grc/fir_filter_xxx.xml
new file mode 100644
index 000000000..3925eb555
--- /dev/null
+++ b/gr-filter/grc/fir_filter_xxx.xml
@@ -0,0 +1,80 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Decimating FIR Filter
+###################################################
+ -->
+<block>
+ <name>Decimating FIR Filter</name>
+ <key>fir_filter_xxx</key>
+ <import>from gnuradio import filter</import>
+ <import>from gnuradio.filter import firdes</import>
+ <make>filter.fir_filter_$(type)($decim, $taps)</make>
+ <callback>set_taps($taps)</callback>
+ <param>
+ <name>Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex->Complex (Complex Taps)</name>
+ <key>ccc</key>
+ <opt>input:complex</opt>
+ <opt>output:complex</opt>
+ <opt>taps:complex_vector</opt>
+ </option>
+ <option>
+ <name>Complex->Complex (Real Taps)</name>
+ <key>ccf</key>
+ <opt>input:complex</opt>
+ <opt>output:complex</opt>
+ <opt>taps:real_vector</opt>
+ </option>
+ <option>
+ <name>Float->Complex (Complex Taps)</name>
+ <key>fcc</key>
+ <opt>input:float</opt>
+ <opt>output:complex</opt>
+ <opt>taps:complex_vector</opt>
+ </option>
+ <option>
+ <name>Float->Float (Real Taps)</name>
+ <key>fff</key>
+ <opt>input:float</opt>
+ <opt>output:float</opt>
+ <opt>taps:real_vector</opt>
+ </option>
+ <option>
+ <name>Float->Short (Real Taps)</name>
+ <key>fsf</key>
+ <opt>input:float</opt>
+ <opt>output:short</opt>
+ <opt>taps:real_vector</opt>
+ </option>
+ <option>
+ <name>Short->Complex (Complex Taps)</name>
+ <key>scc</key>
+ <opt>input:short</opt>
+ <opt>output:complex</opt>
+ <opt>taps:complex_vector</opt>
+ </option>
+ </param>
+ <param>
+ <name>Decimation</name>
+ <key>decim</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Taps</name>
+ <key>taps</key>
+ <type>$type.taps</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>$type.input</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type.output</type>
+ </source>
+</block>
diff --git a/gr-filter/grc/fractional_interpolator_xx.xml b/gr-filter/grc/fractional_interpolator_xx.xml
new file mode 100644
index 000000000..760e8bb06
--- /dev/null
+++ b/gr-filter/grc/fractional_interpolator_xx.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Fractional Interpolator
+###################################################
+ -->
+<block>
+ <name>Fractional Interpolator</name>
+ <key>fractional_interpolator_xx</key>
+ <import>from gnuradio import filter</import>
+ <make>filter.fractional_interpolator_$(type.fcn)($phase_shift, $interp_ratio)</make>
+ <callback>set_interp_ratio($interp_ratio)</callback>
+ <param>
+ <name>Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>fcn:cc</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>fcn:ff</opt>
+ </option>
+ </param>
+ <param>
+ <name>Phase Shift</name>
+ <key>phase_shift</key>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Interpolation Ratio</name>
+ <key>interp_ratio</key>
+ <type>real</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ </source>
+</block>
diff --git a/gr-filter/grc/freq_xlating_fir_filter_xxx.xml b/gr-filter/grc/freq_xlating_fir_filter_xxx.xml
new file mode 100644
index 000000000..178a42f48
--- /dev/null
+++ b/gr-filter/grc/freq_xlating_fir_filter_xxx.xml
@@ -0,0 +1,93 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Frequency Xlating Filter
+###################################################
+ -->
+<block>
+ <name>Frequency Xlating FIR Filter</name>
+ <key>freq_xlating_fir_filter_xxx</key>
+ <import>from gnuradio import filter</import>
+ <import>from gnuradio.filter import firdes</import>
+ <make>filter.freq_xlating_fir_filter_$(type)($decim, $taps, $center_freq, $samp_rate)</make>
+ <callback>set_taps($taps)</callback>
+ <callback>set_center_freq($center_freq)</callback>
+ <param>
+ <name>Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex->Complex (Complex Taps)</name>
+ <key>ccc</key>
+ <opt>input:complex</opt>
+ <opt>output:complex</opt>
+ <opt>taps:complex_vector</opt>
+ </option>
+ <option>
+ <name>Complex->Complex (Real Taps)</name>
+ <key>ccf</key>
+ <opt>input:complex</opt>
+ <opt>output:complex</opt>
+ <opt>taps:real_vector</opt>
+ </option>
+ <option>
+ <name>Float->Complex (Complex Taps)</name>
+ <key>fcc</key>
+ <opt>input:float</opt>
+ <opt>output:complex</opt>
+ <opt>taps:complex_vector</opt>
+ </option>
+ <option>
+ <name>Float->Complex (Real Taps)</name>
+ <key>fcf</key>
+ <opt>input:float</opt>
+ <opt>output:complex</opt>
+ <opt>taps:real_vector</opt>
+ </option>
+ <option>
+ <name>Short->Complex (Complex Taps)</name>
+ <key>scc</key>
+ <opt>input:short</opt>
+ <opt>output:complex</opt>
+ <opt>taps:complex_vector</opt>
+ </option>
+ <option>
+ <name>Short->Complex (Real Taps)</name>
+ <key>scf</key>
+ <opt>input:short</opt>
+ <opt>output:complex</opt>
+ <opt>taps:real_vector</opt>
+ </option>
+ </param>
+ <param>
+ <name>Decimation</name>
+ <key>decim</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Taps</name>
+ <key>taps</key>
+ <type>$type.taps</type>
+ </param>
+ <param>
+ <name>Center Frequency</name>
+ <key>center_freq</key>
+ <value>0</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Sample Rate</name>
+ <key>samp_rate</key>
+ <value>samp_rate</value>
+ <type>real</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>$type.input</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type.output</type>
+ </source>
+</block>
diff --git a/gr-filter/grc/hilbert_fc.xml b/gr-filter/grc/hilbert_fc.xml
new file mode 100644
index 000000000..dd4c94b83
--- /dev/null
+++ b/gr-filter/grc/hilbert_fc.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Hilbert
+###################################################
+ -->
+<block>
+ <name>Hilbert</name>
+ <key>hilbert_fc</key>
+ <import>from gnuradio import filter</import>
+ <make>filter.hilbert_fc($num_taps)</make>
+ <param>
+ <name>Num Taps</name>
+ <key>num_taps</key>
+ <value>64</value>
+ <type>int</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>float</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>complex</type>
+ </source>
+</block>
diff --git a/gr-filter/grc/iir_filter_ffd.xml b/gr-filter/grc/iir_filter_ffd.xml
new file mode 100644
index 000000000..261aba320
--- /dev/null
+++ b/gr-filter/grc/iir_filter_ffd.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##IIR Filter
+###################################################
+ -->
+<block>
+ <name>IIR Filter</name>
+ <key>iir_filter_ffd</key>
+ <import>from gnuradio import filter</import>
+ <make>filter.iir_filter_ffd($fftaps, $fbtaps)</make>
+ <callback>set_taps($fftaps, $fbtaps)</callback>
+ <param>
+ <name>Feed-forward Taps</name>
+ <key>fftaps</key>
+ <type>real_vector</type>
+ </param>
+ <param>
+ <name>Feedback Taps</name>
+ <key>fbtaps</key>
+ <type>real_vector</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>float</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>float</type>
+ </source>
+</block>
diff --git a/gr-filter/grc/interp_fir_filter_xxx.xml b/gr-filter/grc/interp_fir_filter_xxx.xml
new file mode 100644
index 000000000..98a143f53
--- /dev/null
+++ b/gr-filter/grc/interp_fir_filter_xxx.xml
@@ -0,0 +1,80 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Interpolating FIR Filter
+###################################################
+ -->
+<block>
+ <name>Interpolating FIR Filter</name>
+ <key>interp_fir_filter_xxx</key>
+ <import>from gnuradio import filter</import>
+ <import>from gnuradio.filter import firdes</import>
+ <make>filter.interp_fir_filter_$(type)($interp, $taps)</make>
+ <callback>set_taps($taps)</callback>
+ <param>
+ <name>Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex->Complex (Complex Taps)</name>
+ <key>ccc</key>
+ <opt>input:complex</opt>
+ <opt>output:complex</opt>
+ <opt>taps:complex_vector</opt>
+ </option>
+ <option>
+ <name>Complex->Complex (Real Taps)</name>
+ <key>ccf</key>
+ <opt>input:complex</opt>
+ <opt>output:complex</opt>
+ <opt>taps:real_vector</opt>
+ </option>
+ <option>
+ <name>Float->Complex (Complex Taps)</name>
+ <key>fcc</key>
+ <opt>input:float</opt>
+ <opt>output:complex</opt>
+ <opt>taps:complex_vector</opt>
+ </option>
+ <option>
+ <name>Float->Float (Real Taps)</name>
+ <key>fff</key>
+ <opt>input:float</opt>
+ <opt>output:float</opt>
+ <opt>taps:real_vector</opt>
+ </option>
+ <option>
+ <name>Float->Short (Real Taps)</name>
+ <key>fsf</key>
+ <opt>input:float</opt>
+ <opt>output:short</opt>
+ <opt>taps:real_vector</opt>
+ </option>
+ <option>
+ <name>Short->Complex (Complex Taps)</name>
+ <key>scc</key>
+ <opt>input:short</opt>
+ <opt>output:complex</opt>
+ <opt>taps:complex_vector</opt>
+ </option>
+ </param>
+ <param>
+ <name>Interpolation</name>
+ <key>interp</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Taps</name>
+ <key>taps</key>
+ <type>$type.taps</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>$type.input</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type.output</type>
+ </source>
+</block>
diff --git a/gr-filter/grc/pfb_arb_resampler.xml b/gr-filter/grc/pfb_arb_resampler.xml
new file mode 100644
index 000000000..3ad0d394a
--- /dev/null
+++ b/gr-filter/grc/pfb_arb_resampler.xml
@@ -0,0 +1,65 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Polyphase Arbitrary Resampler
+###################################################
+ -->
+<block>
+ <name>Polyphase Arbitrary Resampler</name>
+ <key>pfb_arb_resampler_xxx</key>
+ <import>from gnuradio import filter</import>
+ <import>from gnuradio.filter import firdes</import>
+ <make>filter.pfb.arb_resampler_$(type)(
+ $rrate,
+#if $taps()
+ taps=$taps,
+#else
+ taps=None,
+#end if
+ flt_size=$nfilts)
+ </make>
+ <callback>set_taps($taps)</callback>
+ <param>
+ <name>Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex->Complex (Real Taps)</name>
+ <key>ccf</key>
+ <opt>input:complex</opt>
+ <opt>output:complex</opt>
+ <opt>taps:real_vector</opt>
+ </option>
+ <option>
+ <name>Float->Float (Real Taps)</name>
+ <key>fff</key>
+ <opt>input:float</opt>
+ <opt>output:float</opt>
+ <opt>taps:real_vector</opt>
+ </option>
+ </param>
+ <param>
+ <name>Resampling Rate</name>
+ <key>rrate</key>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Taps</name>
+ <key>taps</key>
+ <type>$type.taps</type>
+ </param>
+ <param>
+ <name>Number of Filters</name>
+ <key>nfilts</key>
+ <value>32</value>
+ <type>int</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>$type.input</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type.output</type>
+ </source>
+</block>
diff --git a/gr-filter/grc/pfb_channelizer.xml b/gr-filter/grc/pfb_channelizer.xml
new file mode 100644
index 000000000..114abc0f0
--- /dev/null
+++ b/gr-filter/grc/pfb_channelizer.xml
@@ -0,0 +1,62 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Polyphase Channelizer
+###################################################
+ -->
+<block>
+ <name>Polyphase Channelizer</name>
+ <key>pfb_channelizer_ccf</key>
+ <import>from gnuradio import filter</import>
+ <import>from gnuradio.filter import firdes</import>
+ <make>filter.pfb.channelizer_ccf(
+ $nchans,
+ $taps,
+ $osr,
+ $atten)
+self.$(id).set_channel_map($ch_map)
+ </make>
+ <!-- Set taps not implemented yet
+ <callback>set_taps($taps)</callback>
+ -->
+ <callback>set_channel_map($ch_map)</callback>
+
+ <param>
+ <name>Channels</name>
+ <key>nchans</key>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Taps</name>
+ <key>taps</key>
+ <value>None</value>
+ <type>real_vector</type>
+ </param>
+ <param>
+ <name>Over Sample Ratio</name>
+ <key>osr</key>
+ <value>1.0</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Attenuation</name>
+ <key>atten</key>
+ <value>100</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Channel Map</name>
+ <key>ch_map</key>
+ <value>[]</value>
+ <type>int_vector</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>complex</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>complex</type>
+ <nports>$nchans</nports>
+ </source>
+</block>
diff --git a/gr-filter/grc/pfb_decimator.xml b/gr-filter/grc/pfb_decimator.xml
new file mode 100644
index 000000000..b0540d3e2
--- /dev/null
+++ b/gr-filter/grc/pfb_decimator.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Polyphase Decimator
+###################################################
+ -->
+<block>
+ <name>Polyphase Decimator</name>
+ <key>pfb_decimator_ccf</key>
+ <import>from gnuradio import filter</import>
+ <import>from gnuradio.filter import firdes</import>
+ <make>filter.pfb_decimator_ccf(
+ $decim,
+ $taps,
+ $channel)
+ </make>
+ <callback>set_taps($taps)</callback>
+ <param>
+ <name>Decimation</name>
+ <key>decim</key>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Taps</name>
+ <key>taps</key>
+ <value>None</value>
+ <type>real_vector</type>
+ </param>
+ <param>
+ <name>Output Channel</name>
+ <key>channel</key>
+ <value>0</value>
+ <type>int</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>complex</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>complex</type>
+ </source>
+</block>
diff --git a/gr-filter/grc/pfb_interpolator.xml b/gr-filter/grc/pfb_interpolator.xml
new file mode 100644
index 000000000..600493123
--- /dev/null
+++ b/gr-filter/grc/pfb_interpolator.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Polyphase Interpolator
+###################################################
+ -->
+<block>
+ <name>Polyphase Interpolator</name>
+ <key>pfb_interpolator_ccf</key>
+ <import>from gnuradio import filter</import>
+ <import>from gnuradio.filter import firdes</import>
+ <make>filter.pfb.interpolator_ccf(
+ $interp,
+ $taps)
+ </make>
+ <callback>set_taps($taps)</callback>
+ <param>
+ <name>Interpolation</name>
+ <key>interp</key>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Taps</name>
+ <key>taps</key>
+ <value>None</value>
+ <type>real_vector</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>complex</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>complex</type>
+ </source>
+</block>
diff --git a/gr-filter/grc/pfb_synthesizer.xml b/gr-filter/grc/pfb_synthesizer.xml
new file mode 100644
index 000000000..e84b25e62
--- /dev/null
+++ b/gr-filter/grc/pfb_synthesizer.xml
@@ -0,0 +1,57 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Polyphase Synthesis Filterbank
+###################################################
+ -->
+<block>
+ <name>Polyphase Synthesizer</name>
+ <key>pfb_synthesizer_ccf</key>
+ <import>from gnuradio import filter</import>
+ <import>from gnuradio.filter import firdes</import>
+ <make>filter.pfb_synthesizer_ccf(
+ $numchans, $taps, $twox)
+self.$(id).set_channel_map($ch_map)
+ </make>
+ <callback>set_taps($taps)</callback>
+ <callback>set_channel_map($ch_map)</callback>
+
+ <param>
+ <name>Channels</name>
+ <key>numchans</key>
+ <value>2</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Connections</name>
+ <key>connections</key>
+ <value>2</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Taps</name>
+ <key>taps</key>
+ <type>real_vector</type>
+ </param>
+ <param>
+ <name>2x Sample Rate</name>
+ <key>twox</key>
+ <value>False</value>
+ <type>bool</type>
+ </param>
+ <param>
+ <name>Channel Map</name>
+ <key>ch_map</key>
+ <value>[]</value>
+ <type>int_vector</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>complex</type>
+ <nports>$connections</nports>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>complex</type>
+ </source>
+</block>
diff --git a/gr-filter/grc/rational_resampler_base_xxx.xml b/gr-filter/grc/rational_resampler_base_xxx.xml
new file mode 100644
index 000000000..399bfc74c
--- /dev/null
+++ b/gr-filter/grc/rational_resampler_base_xxx.xml
@@ -0,0 +1,86 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Rational Resampler Base
+###################################################
+ -->
+<block>
+ <name>Rational Resampler Base</name>
+ <key>rational_resampler_base_xxx</key>
+ <import>from gnuradio import filter</import>
+ <import>from gnuradio.filter import firdes</import>
+ <make>filter.rational_resampler_base_$(type)($interp, $decim, $taps)</make>
+ <callback>set_taps($taps)</callback>
+ <param>
+ <name>Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex->Complex (Complex Taps)</name>
+ <key>ccc</key>
+ <opt>input:complex</opt>
+ <opt>output:complex</opt>
+ <opt>taps:complex_vector</opt>
+ </option>
+ <option>
+ <name>Complex->Complex (Real Taps)</name>
+ <key>ccf</key>
+ <opt>input:complex</opt>
+ <opt>output:complex</opt>
+ <opt>taps:real_vector</opt>
+ </option>
+ <option>
+ <name>Float->Complex (Complex Taps)</name>
+ <key>fcc</key>
+ <opt>input:float</opt>
+ <opt>output:complex</opt>
+ <opt>taps:complex_vector</opt>
+ </option>
+ <option>
+ <name>Float->Float (Real Taps)</name>
+ <key>fff</key>
+ <opt>input:float</opt>
+ <opt>output:float</opt>
+ <opt>taps:real_vector</opt>
+ </option>
+ <option>
+ <name>Float->Short (Real Taps)</name>
+ <key>fsf</key>
+ <opt>input:float</opt>
+ <opt>output:short</opt>
+ <opt>taps:real_vector</opt>
+ </option>
+ <option>
+ <name>Short->Complex (Complex Taps)</name>
+ <key>scc</key>
+ <opt>input:short</opt>
+ <opt>output:complex</opt>
+ <opt>taps:complex_vector</opt>
+ </option>
+ </param>
+ <param>
+ <name>Interpolation</name>
+ <key>interp</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Decimation</name>
+ <key>decim</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Taps</name>
+ <key>taps</key>
+ <type>$type.taps</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>$type.input</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type.output</type>
+ </source>
+</block>
diff --git a/gr-filter/grc/single_pole_iir_filter_xx.xml b/gr-filter/grc/single_pole_iir_filter_xx.xml
new file mode 100644
index 000000000..3eaf52625
--- /dev/null
+++ b/gr-filter/grc/single_pole_iir_filter_xx.xml
@@ -0,0 +1,51 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Single Pole IIR Filter
+###################################################
+ -->
+<block>
+ <name>Single Pole IIR Filter</name>
+ <key>single_pole_iir_filter_xx</key>
+ <import>from gnuradio import filter</import>
+ <make>filter.single_pole_iir_filter_$(type.fcn)($alpha, $vlen)</make>
+ <callback>set_taps($alpha)</callback>
+ <param>
+ <name>Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>fcn:cc</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>fcn:ff</opt>
+ </option>
+ </param>
+ <param>
+ <name>Alpha</name>
+ <key>alpha</key>
+ <value>1.0</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$vlen &gt; 0</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </source>
+</block>
diff --git a/gr-filter/include/filter/CMakeLists.txt b/gr-filter/include/filter/CMakeLists.txt
new file mode 100644
index 000000000..4c126fcbd
--- /dev/null
+++ b/gr-filter/include/filter/CMakeLists.txt
@@ -0,0 +1,116 @@
+# 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.
+
+########################################################################
+# generate helper scripts to expand templated files
+########################################################################
+include(GrPython)
+
+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_dict2(name, sig, 'filter')
+ build_utils.expand_template(d, inp)
+
+")
+
+macro(expand_h root)
+ #make a list of all the generated files
+ unset(expanded_files_h)
+ foreach(sig ${ARGN})
+ string(REGEX REPLACE "X+" ${sig} name ${root})
+ list(APPEND expanded_files_h ${CMAKE_CURRENT_BINARY_DIR}/${name}.h)
+ endforeach(sig)
+
+ #create a command to generate the files
+ add_custom_command(
+ OUTPUT ${expanded_files_h}
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${root}.h.t
+ COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B}
+ ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py
+ ${root} ${root}.h.t ${ARGN}
+ )
+
+ #install rules for the generated h files
+ list(APPEND generated_includes ${expanded_files_h})
+endmacro(expand_h)
+
+########################################################################
+# Invoke macro to generate various sources
+#######################################################################
+expand_h(fir_filter_XXX ccc ccf fcc fff fsf scc)
+expand_h(freq_xlating_fir_filter_XXX ccc ccf fcc fcf scf scc)
+expand_h(interp_fir_filter_XXX ccc ccf fcc fff fsf scc)
+expand_h(rational_resampler_base_XXX ccc ccf fcc fff fsf scc)
+
+add_custom_target(filter_generated_includes DEPENDS
+ ${generated_includes}
+)
+
+########################################################################
+# Install header files
+########################################################################
+install(FILES
+ ${generated_includes}
+ api.h
+ firdes.h
+ fir_filter.h
+ fir_filter_with_buffer.h
+ fft_filter.h
+ iir_filter.h
+ interpolator_taps.h
+ mmse_fir_interpolator_cc.h
+ mmse_fir_interpolator_ff.h
+ pm_remez.h
+ polyphase_filterbank.h
+ single_pole_iir.h
+ adaptive_fir_ccc.h
+ adaptive_fir_ccf.h
+ dc_blocker_cc.h
+ dc_blocker_ff.h
+ filter_delay_fc.h
+ fft_filter_ccc.h
+ fft_filter_fff.h
+ fractional_interpolator_cc.h
+ fractional_interpolator_ff.h
+ hilbert_fc.h
+ iir_filter_ffd.h
+ pfb_arb_resampler_ccf.h
+ pfb_arb_resampler_fff.h
+ pfb_channelizer_ccf.h
+ pfb_decimator_ccf.h
+ pfb_interpolator_ccf.h
+ pfb_synthesizer_ccf.h
+ single_pole_iir_filter_cc.h
+ single_pole_iir_filter_ff.h
+ channel_model.h
+ DESTINATION ${GR_INCLUDE_DIR}/gnuradio/filter
+ COMPONENT "filter_devel"
+)
+
diff --git a/gr-filter/include/filter/adaptive_fir_ccc.h b/gr-filter/include/filter/adaptive_fir_ccc.h
new file mode 100644
index 000000000..261259957
--- /dev/null
+++ b/gr-filter/include/filter/adaptive_fir_ccc.h
@@ -0,0 +1,85 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2011,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 INCLUDED_FILTER_ADAPTIVE_FIR_CCC_H
+#define INCLUDED_FILTER_ADAPTIVE_FIR_CCC_H
+
+#include <filter/api.h>
+#include <gr_sync_decimator.h>
+#include <filter/fir_filter.h>
+
+namespace gr {
+ namespace filter {
+
+ /*!
+ * \brief Adaptive FIR filter with gr_complex input, gr_complex output and gr_complex taps
+ * \ingroup filter_blk
+ *
+ * This is a base class to implement an adaptive FIR
+ * filter. Generally, another block will inherit from this one to
+ * build a new type of adaptive filter such as an equalizer.
+ *
+ * This class implements two functions that are designed to be
+ * overloaded by the child class: error(gr_complex out) and
+ * update_tap(gr_complex tap, gr_complex in).
+ *
+ * The error() function calculates the error value that will be
+ * used to adjust the taps. The update_tap function then uses the
+ * error and the input signal value to update a particular
+ * tap. Typically, the error is calculated for a given output and
+ * then this is used in a loop to update all of the filter taps in
+ * a loop:
+ *
+ * \code
+ * d_error = error(sum);
+ * for(k = 0; k < l; k++) {
+ * update_tap(d_taps[ntaps-k-1], in[i+k]);
+ * }
+ * \endcode
+ *
+ * See digital::cma_equalizer_cc and digital::lms_dd_equalizer_cc
+ * for example usage.
+ */
+ class FILTER_API adaptive_fir_ccc : virtual public gr_sync_decimator
+ {
+ public:
+ // gr::filter::adaptive_fir_ccc::sptr
+ typedef boost::shared_ptr<adaptive_fir_ccc> sptr;
+
+ /*!
+ * \brief Adaptive FIR filter with gr_complex input, gr_complex output and gr_complex taps
+ *
+ * \param name Provides a name to identify this type of algorithm
+ * \param decimation (interger) decimation rate of the filter
+ * \param taps (complex) filter taps
+ */
+ static sptr make(const char *name, int decimation,
+ const std::vector<gr_complex> &taps);
+
+ virtual void set_taps(const std::vector<gr_complex> &taps) = 0;
+ virtual std::vector<gr_complex> taps() const = 0;
+ };
+
+ } /* namespace filter */
+} /* namespace gr */
+
+#endif /* INCLUDED_FILTER_ADAPTIVE_FIR_CCC_H */
diff --git a/gr-filter/include/filter/adaptive_fir_ccf.h b/gr-filter/include/filter/adaptive_fir_ccf.h
new file mode 100644
index 000000000..0fd8d5746
--- /dev/null
+++ b/gr-filter/include/filter/adaptive_fir_ccf.h
@@ -0,0 +1,81 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2011,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 INCLUDED_FILTER_ADAPTIVE_FIR_CCF_H
+#define INCLUDED_FILTER_ADAPTIVE_FIR_CCF_H
+
+#include <filter/api.h>
+#include <gr_sync_decimator.h>
+
+namespace gr {
+ namespace filter {
+
+ /*!
+ * \brief Adaptive FIR filter with gr_complex input, gr_complex output and float taps
+ * \ingroup filter_blk
+ *
+ * This is a base class to implement an adaptive FIR
+ * filter. Generally, another block will inherit from this one to
+ * build a new type of adaptive filter such as an equalizer.
+ *
+ * This class implements two functions that are designed to be
+ * overloaded by the child class: error(gr_complex out) and
+ * update_tap(float tap, gr_complex in).
+ *
+ * The error() function calculates the error value that will be
+ * used to adjust the taps. The update_tap function then uses the
+ * error and the input signal value to update a particular
+ * tap. Typically, the error is calculated for a given output and
+ * then this is used in a loop to update all of the filter taps in
+ * a loop:
+ *
+ * \code
+ * d_error = error(sum);
+ * for(k = 0; k < l; k++) {
+ * update_tap(d_taps[ntaps-k-1], in[i+k]);
+ * }
+ * \endcode
+ */
+ class FILTER_API adaptive_fir_ccf : virtual public gr_sync_decimator
+ {
+ public:
+ // gr::filter::adaptive_fir_ccf::sptr
+ typedef boost::shared_ptr<adaptive_fir_ccf> sptr;
+
+ /*!
+ * \brief Adaptive FIR filter with gr_complex input, gr_complex output and float taps
+ *
+ * \param name Provides a name to identify this type of algorithm
+ * \param decimation (interger) decimation rate of the filter
+ * \param taps (real) filter taps
+ */
+ static sptr make(const char *name, int decimation,
+ const std::vector<float> &taps);
+
+ virtual void set_taps(const std::vector<float> &taps) = 0;
+ virtual std::vector<float> taps() = 0;
+ };
+
+ } /* namespace filter */
+} /* namespace gr */
+
+#endif /* INCLUDED_FILTER_ADAPTIVE_FIR_CCF_H */
diff --git a/gr-filter/include/filter/api.h b/gr-filter/include/filter/api.h
new file mode 100644
index 000000000..025b0bd4a
--- /dev/null
+++ b/gr-filter/include/filter/api.h
@@ -0,0 +1,33 @@
+/*
+ * 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.
+ */
+
+#ifndef INCLUDED_FILTER_API_H
+#define INCLUDED_FILTER_API_H
+
+#include <gruel/attributes.h>
+
+#ifdef gnuradio_filter_EXPORTS
+# define FILTER_API __GR_ATTR_EXPORT
+#else
+# define FILTER_API __GR_ATTR_IMPORT
+#endif
+
+#endif /* INCLUDED_FILTER_API_H */
diff --git a/gr-filter/include/filter/channel_model.h b/gr-filter/include/filter/channel_model.h
new file mode 100644
index 000000000..49c08181f
--- /dev/null
+++ b/gr-filter/include/filter/channel_model.h
@@ -0,0 +1,87 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2009,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 INCLUDED_FILTER_CHANNEL_MODEL_H
+#define INCLUDED_FILTER_CHANNEL_MODEL_H
+
+#include <filter/api.h>
+#include <gr_hier_block2.h>
+#include <gr_types.h>
+
+namespace gr {
+ namespace filter {
+
+ /*!
+ * \brief channel simulator
+ * \ingroup misc_blk
+ *
+ * This block implements a basic channel model simulator that can
+ * be used to help evaluate, design, and test various signals,
+ * waveforms, and algorithms. This model allows the user to set
+ * the voltage of an AWGN noise source, a (normalized) frequency
+ * offset, a sample timing offset, and a noise seed to randomize
+ * the AWGN noise source.
+ *
+ * Multipath can be approximated in this model by using a FIR
+ * filter representation of a multipath delay profile..
+ */
+ class FILTER_API channel_model : virtual public gr_hier_block2
+ {
+ public:
+ // gr::filter::channel_model::sptr
+ typedef boost::shared_ptr<channel_model> sptr;
+
+ /*! \brief Build the channel simulator.
+ *
+ * \param noise_voltage The AWGN noise level as a voltage (to be
+ * calculated externally to meet, say, a
+ * desired SNR).
+ * \param frequency_offset The normalized frequency offset. 0 is
+ * no offset; 0.25 would be, for a digital
+ * modem, one quarter of the symbol rate.
+ * \param epsilon The sample timing offset to emulate the
+ * different rates between the sample clocks of
+ * the transmitter and receiver. 1.0 is no difference.
+ * \param taps Taps of a FIR filter to emulate a multipath delay profile.
+ * \param noise_seed A random number generator seed for the noise source.
+ */
+ static sptr make(double noise_voltage=0.0,
+ double frequency_offset=0.0,
+ double epsilon=1.0,
+ const std::vector<gr_complex> &taps=std::vector<gr_complex>(1,1),
+ double noise_seed=0);
+
+ virtual void set_noise_voltage(double noise_voltage) = 0;
+ virtual void set_frequency_offset(double frequency_offset) = 0;
+ virtual void set_taps(const std::vector<gr_complex> &taps) = 0;
+ virtual void set_timing_offset(double epsilon) = 0;
+
+ virtual double noise_voltage() const = 0;
+ virtual double frequency_offset() const = 0;
+ virtual std::vector<gr_complex> taps() const = 0;
+ virtual double timing_offset() const = 0;
+ };
+
+ } /* namespace filter */
+} /* namespace gr */
+
+#endif /* INCLUDED_FILTER_CHANNEL_MODEL_H */
diff --git a/gr-filter/include/filter/dc_blocker_cc.h b/gr-filter/include/filter/dc_blocker_cc.h
new file mode 100644
index 000000000..df4c815d6
--- /dev/null
+++ b/gr-filter/include/filter/dc_blocker_cc.h
@@ -0,0 +1,76 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2011,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 INCLUDED_FILTER_DC_BLOCKER_CC_H
+#define INCLUDED_FILTER_DC_BLOCKER_CC_H
+
+#include <filter/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace filter {
+
+ class FILTER_API dc_blocker_cc : virtual public gr_sync_block
+ {
+ public:
+
+ // gr::filter::dc_blocker_cc::sptr
+ typedef boost::shared_ptr<dc_blocker_cc> sptr;
+
+ /*!
+ * \class dc_blocker_cc
+ * \brief a computationally efficient controllable DC blocker
+ *
+ * \ingroup filter_blk
+ *
+ * This block implements a computationally efficient DC blocker that produces
+ * a tighter notch filter around DC for a smaller group delay than an
+ * equivalent FIR filter or using a single pole IIR filter (though the IIR
+ * filter is computationally cheaper).
+ *
+ * The block defaults to using a delay line of length 32 and the long form
+ * of the filter. Optionally, the delay line length can be changed to alter
+ * the width of the DC notch (longer lines will decrease the width).
+ *
+ * The long form of the filter produces a nearly flat response outside of
+ * the notch but at the cost of a group delay of 2D-2.
+ *
+ * The short form of the filter does not have as flat a response in the
+ * passband but has a group delay of only D-1 and is cheaper to compute.
+ *
+ * The theory behind this block can be found in the paper:
+ *
+ * <B><EM>R. Yates, "DC Blocker Algorithms," IEEE Signal Processing Magazine,
+ * Mar. 2008, pp 132-134.</EM></B>
+ *
+ * \param D (int) the length of the delay line
+ * \param long_form (bool) whether to use long (true, default) or short form
+ */
+ static sptr make(int D, bool long_form);
+
+ virtual int group_delay() = 0;
+ };
+
+ } /* namespace filter */
+} /* namespace gr */
+
+#endif /* INCLUDED_FILTER_DC_BLOCKER_CC_H */
diff --git a/gr-filter/include/filter/dc_blocker_ff.h b/gr-filter/include/filter/dc_blocker_ff.h
new file mode 100644
index 000000000..6ab4d5a3d
--- /dev/null
+++ b/gr-filter/include/filter/dc_blocker_ff.h
@@ -0,0 +1,76 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2011,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 INCLUDED_FILTER_DC_BLOCKER_FF_H
+#define INCLUDED_FILTER_DC_BLOCKER_FF_H
+
+#include <filter/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace filter {
+
+ class FILTER_API dc_blocker_ff : virtual public gr_sync_block
+ {
+ public:
+
+ // gr::filter::dc_blocker_ff::sptr
+ typedef boost::shared_ptr<dc_blocker_ff> sptr;
+
+ /*!
+ * \class dc_blocker_ff
+ * \brief a computationally efficient controllable DC blocker
+ *
+ * \ingroup filter_blk
+ *
+ * This block implements a computationally efficient DC blocker that produces
+ * a tighter notch filter around DC for a smaller group delay than an
+ * equivalent FIR filter or using a single pole IIR filter (though the IIR
+ * filter is computationally cheaper).
+ *
+ * The block defaults to using a delay line of length 32 and the long form
+ * of the filter. Optionally, the delay line length can be changed to alter
+ * the width of the DC notch (longer lines will decrease the width).
+ *
+ * The long form of the filter produces a nearly flat response outside of
+ * the notch but at the cost of a group delay of 2D-2.
+ *
+ * The short form of the filter does not have as flat a response in the
+ * passband but has a group delay of only D-1 and is cheaper to compute.
+ *
+ * The theory behind this block can be found in the paper:
+ *
+ * <B><EM>R. Yates, "DC Blocker Algorithms," IEEE Signal Processing Magazine,
+ * Mar. 2008, pp 132-134.</EM></B>
+ *
+ * \param D (int) the length of the delay line
+ * \param long_form (bool) whether to use long (true, default) or short form
+ */
+ static sptr make(int D, bool long_form=true);
+
+ virtual int group_delay() = 0;
+ };
+
+ } /* namespace filter */
+} /* namespace gr */
+
+#endif /* INCLUDED_FILTER_DC_BLOCKER_FF_H */
diff --git a/gr-filter/include/filter/fft_filter.h b/gr-filter/include/filter/fft_filter.h
new file mode 100644
index 000000000..8c7d6cf78
--- /dev/null
+++ b/gr-filter/include/filter/fft_filter.h
@@ -0,0 +1,171 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+#ifndef INCLUDED_FILTER_FFT_FILTER_H
+#define INCLUDED_FILTER_FFT_FILTER_H
+
+#include <filter/api.h>
+#include <vector>
+#include <gr_complex.h>
+#include <fft/fft.h>
+
+namespace gr {
+ namespace filter {
+ namespace kernel {
+ /*!
+ * \brief Fast FFT filter with float input, float output and float taps
+ * \ingroup filter_blk
+ */
+ class FILTER_API fft_filter_fff
+ {
+ private:
+ int d_ntaps;
+ int d_nsamples;
+ int d_fftsize; // fftsize = ntaps + nsamples - 1
+ int d_decimation;
+ fft::fft_real_fwd *d_fwdfft; // forward "plan"
+ fft::fft_real_rev *d_invfft; // inverse "plan"
+ int d_nthreads; // number of FFTW threads to use
+ std::vector<float> d_tail; // state carried between blocks for overlap-add
+ std::vector<float> d_new_taps;
+ gr_complex *d_xformed_taps; // Fourier xformed taps
+
+ void compute_sizes(int ntaps);
+ int tailsize() const { return d_ntaps - 1; }
+
+ public:
+ /*!
+ * \brief Construct an FFT filter for float vectors with the given taps and decimation rate.
+ *
+ * This is the basic implementation for performing FFT filter for fast convolution
+ * in other blocks for complex vectors (such as fft_filter_ccc).
+ *
+ * \param decimation The decimation rate of the filter (int)
+ * \param taps The filter taps (complex)
+ * \param nthreads The number of threads for the FFT to use (int)
+ */
+ fft_filter_fff(int decimation,
+ const std::vector<float> &taps,
+ int nthreads=1);
+
+ ~fft_filter_fff();
+
+ /*!
+ * \brief Set new taps for the filter.
+ *
+ * Sets new taps and resets the class properties to handle different sizes
+ * \param taps The filter taps (complex)
+ */
+ int set_taps(const std::vector<float> &taps);
+
+ /*!
+ * \brief Set number of threads to use.
+ */
+ void set_nthreads(int n);
+
+ /*!
+ * \brief Get number of threads being used.
+ */
+ int nthreads() const;
+
+ /*!
+ * \brief Perform the filter operation
+ *
+ * \param nitems The number of items to produce
+ * \param input The input vector to be filtered
+ * \param output The result of the filter operation
+ */
+ int filter(int nitems, const float *input, float *output);
+ };
+
+
+ /*!
+ * \brief Fast FFT filter with gr_complex input, gr_complex output and gr_complex taps
+ * \ingroup filter_blk
+ */
+ class FILTER_API fft_filter_ccc
+ {
+ private:
+ int d_ntaps;
+ int d_nsamples;
+ int d_fftsize; // fftsize = ntaps + nsamples - 1
+ int d_decimation;
+ fft::fft_complex *d_fwdfft; // forward "plan"
+ fft::fft_complex *d_invfft; // inverse "plan"
+ int d_nthreads; // number of FFTW threads to use
+ std::vector<gr_complex> d_tail; // state carried between blocks for overlap-add
+ std::vector<gr_complex> d_new_taps;
+ gr_complex *d_xformed_taps; // Fourier xformed taps
+
+ void compute_sizes(int ntaps);
+ int tailsize() const { return d_ntaps - 1; }
+
+ public:
+ /*!
+ * \brief Construct an FFT filter for complex vectors with the given taps and decimation rate.
+ *
+ * This is the basic implementation for performing FFT filter for fast convolution
+ * in other blocks for complex vectors (such as fft_filter_ccc).
+ *
+ * \param decimation The decimation rate of the filter (int)
+ * \param taps The filter taps (complex)
+ * \param nthreads The number of threads for the FFT to use (int)
+ */
+ fft_filter_ccc(int decimation,
+ const std::vector<gr_complex> &taps,
+ int nthreads=1);
+
+ ~fft_filter_ccc();
+
+ /*!
+ * \brief Set new taps for the filter.
+ *
+ * Sets new taps and resets the class properties to handle different sizes
+ * \param taps The filter taps (complex)
+ */
+ int set_taps(const std::vector<gr_complex> &taps);
+
+ /*!
+ * \brief Set number of threads to use.
+ */
+ void set_nthreads(int n);
+
+ /*!
+ * \brief Get number of threads being used.
+ */
+ int nthreads() const;
+
+ /*!
+ * \brief Perform the filter operation
+ *
+ * \param nitems The number of items to produce
+ * \param input The input vector to be filtered
+ * \param output The result of the filter operation
+ */
+ int filter(int nitems, const gr_complex *input, gr_complex *output);
+ };
+
+ } /* namespace kernel */
+ } /* namespace filter */
+} /* namespace gr */
+
+#endif /* INCLUDED_FILTER_FFT_FILTER_H */
diff --git a/gr-filter/include/filter/fft_filter_ccc.h b/gr-filter/include/filter/fft_filter_ccc.h
new file mode 100644
index 000000000..acec93277
--- /dev/null
+++ b/gr-filter/include/filter/fft_filter_ccc.h
@@ -0,0 +1,86 @@
+/* -*- 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 INCLUDED_FILTER_FFT_FILTER_CCC_H
+#define INCLUDED_FILTER_FFT_FILTER_CCC_H
+
+#include <filter/api.h>
+#include <gr_sync_decimator.h>
+
+namespace gr {
+ namespace filter {
+
+ class FILTER_API fft_filter_ccc : virtual public gr_sync_decimator
+ {
+ public:
+ // gr::filter::fft_filter_ccc::sptr
+ typedef boost::shared_ptr<fft_filter_ccc> sptr;
+
+ /*!
+ * \brief Fast FFT filter with gr_complex input, gr_complex output and gr_complex taps
+ * \ingroup filter_blk
+ *
+ * This block implements a complex decimating filter using the
+ * fast convolution method via an FFT. The decimation factor is
+ * an interger that is greater than or equal to 1.
+ *
+ * The filter takes a set of complex (or real) taps to use in
+ * the filtering operation. These taps can be defined as
+ * anything that satisfies the user's filtering needs. For
+ * standard filters such as lowpass, highpass, bandpass, etc.,
+ * the filter.firdes and filter.optfir classes provide
+ * convenient generating methods.
+ *
+ * This filter is implemented by using the FFTW package to
+ * perform the required FFTs. An optional argument, nthreads,
+ * may be passed to the constructor (or set using the
+ * set_nthreads member function) to split the FFT among N number
+ * of threads. This can improve performance on very large FFTs
+ * (that is, if the number of taps used is very large) if you
+ * have enough threads/cores to support it.
+ *
+ * \param decimation >= 1
+ * \param taps complex filter taps
+ * \param nthreads number of threads for the FFT to use
+ */
+ static sptr make(int decimation,
+ const std::vector<gr_complex> &taps,
+ int nthreads=1);
+
+ virtual void set_taps(const std::vector<gr_complex> &taps) = 0;
+ virtual std::vector<gr_complex> taps() const = 0;
+
+ /*!
+ * \brief Set number of threads to use.
+ */
+ virtual void set_nthreads(int n) = 0;
+
+ /*!
+ * \brief Get number of threads being used.
+ */
+ virtual int nthreads() const = 0;
+ };
+
+ } /* namespace filter */
+} /* namespace gr */
+
+#endif /* INCLUDED_FILTER_FFT_FILTER_CCC_H */
diff --git a/gr-filter/include/filter/fft_filter_fff.h b/gr-filter/include/filter/fft_filter_fff.h
new file mode 100644
index 000000000..d8140325f
--- /dev/null
+++ b/gr-filter/include/filter/fft_filter_fff.h
@@ -0,0 +1,86 @@
+/* -*- 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 INCLUDED_FILTER_FFT_FILTER_FFF_H
+#define INCLUDED_FILTER_FFT_FILTER_FFF_H
+
+#include <filter/api.h>
+#include <gr_sync_decimator.h>
+
+namespace gr {
+ namespace filter {
+
+ class FILTER_API fft_filter_fff : virtual public gr_sync_decimator
+ {
+ public:
+ // gr::filter::fft_filter_fff::sptr
+ typedef boost::shared_ptr<fft_filter_fff> sptr;
+
+ /*!
+ * \brief Fast FFT filter with float input, float output and float taps
+ * \ingroup filter_blk
+ *
+ * This block implements a real-value decimating filter using
+ * the fast convolution method via an FFT. The decimation factor
+ * is an interger that is greater than or equal to 1.
+ *
+ * The filter takes a set of real-valued taps to use in
+ * the filtering operation. These taps can be defined as
+ * anything that satisfies the user's filtering needs. For
+ * standard filters such as lowpass, highpass, bandpass, etc.,
+ * the filter.firdes and filter.optfir classes provide
+ * convenient generating methods.
+ *
+ * This filter is implemented by using the FFTW package to
+ * perform the required FFTs. An optional argument, nthreads,
+ * may be passed to the constructor (or set using the
+ * set_nthreads member function) to split the FFT among N number
+ * of threads. This can improve performance on very large FFTs
+ * (that is, if the number of taps used is very large) if you
+ * have enough threads/cores to support it.
+ *
+ * \param decimation >= 1
+ * \param taps float filter taps
+ * \param nthreads number of threads for the FFT to use
+ */
+ static sptr make(int decimation,
+ const std::vector<float> &taps,
+ int nthreads=1);
+
+ virtual void set_taps(const std::vector<float> &taps) = 0;
+ virtual std::vector<float> taps() const = 0;
+
+ /*!
+ * \brief Set number of threads to use.
+ */
+ virtual void set_nthreads(int n) = 0;
+
+ /*!
+ * \brief Get number of threads being used.
+ */
+ virtual int nthreads() const = 0;
+ };
+
+ } /* namespace filter */
+} /* namespace gr */
+
+#endif /* INCLUDED_FILTER_FFT_FILTER_FFF_H */
diff --git a/gr-filter/include/filter/filter_delay_fc.h b/gr-filter/include/filter/filter_delay_fc.h
new file mode 100644
index 000000000..8a84a6a0e
--- /dev/null
+++ b/gr-filter/include/filter/filter_delay_fc.h
@@ -0,0 +1,65 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,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 INCLUDED_FILTER_FILTER_DELAY_FC_H
+#define INCLUDED_FILTER_FILTER_DELAY_FC_H
+
+#include <filter/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace filter {
+
+ class FILTER_API filter_delay_fc : virtual public gr_sync_block
+ {
+ public:
+
+ // gr::filter::filter_delay_fc::sptr
+ typedef boost::shared_ptr<filter_delay_fc> sptr;
+
+ /*!
+ * \brief Filter-Delay Combination Block.
+ * \ingroup filter_blk
+ *
+ * The block takes one or two float stream and outputs a complex
+ * stream.
+ *
+ * If only one float stream is input, the real output is a
+ * delayed version of this input and the imaginary output is the
+ * filtered output.
+ *
+ * If two floats are connected to the input, then the real
+ * output is the delayed version of the first input, and the
+ * imaginary output is the filtered output.
+ *
+ * The delay in the real path accounts for the group delay
+ * introduced by the filter in the imaginary path. The filter
+ * taps needs to be calculated before initializing this block.
+ *
+ */
+ static sptr make(const std::vector<float> &taps);
+ };
+
+ } /* namespace filter */
+} /* namespace gr */
+
+#endif /* INCLUDED_FILTER_FILTER_DELAY_FC_H */
diff --git a/gr-filter/include/filter/fir_filter.h b/gr-filter/include/filter/fir_filter.h
new file mode 100644
index 000000000..e86111268
--- /dev/null
+++ b/gr-filter/include/filter/fir_filter.h
@@ -0,0 +1,222 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,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.
+ */
+
+#ifndef INCLUDED_FILTER_FIR_FILTER_H
+#define INCLUDED_FILTER_FIR_FILTER_H
+
+#include <filter/api.h>
+#include <vector>
+#include <gr_complex.h>
+
+namespace gr {
+ namespace filter {
+ namespace kernel {
+
+ class FILTER_API fir_filter_fff
+ {
+ public:
+ fir_filter_fff(int decimation,
+ const std::vector<float> &taps);
+ ~fir_filter_fff();
+
+ void set_taps(const std::vector<float> &taps);
+ std::vector<float> taps() const;
+ unsigned int ntaps() const;
+
+ float filter(const float input[]);
+ void filterN(float output[],
+ const float input[],
+ unsigned long n);
+ void filterNdec(float output[],
+ const float input[],
+ unsigned long n,
+ unsigned int decimate);
+
+ protected:
+ std::vector<float> d_taps;
+ unsigned int d_ntaps;
+ float **d_aligned_taps;
+ float *d_output;
+ int d_align;
+ int d_naligned;
+ };
+
+ /**************************************************************/
+
+ class FILTER_API fir_filter_ccf
+ {
+ public:
+ fir_filter_ccf(int decimation,
+ const std::vector<float> &taps);
+ ~fir_filter_ccf();
+
+ void set_taps(const std::vector<float> &taps);
+ std::vector<float> taps() const;
+ unsigned int ntaps() const;
+
+ gr_complex filter(const gr_complex input[]);
+ void filterN(gr_complex output[],
+ const gr_complex input[],
+ unsigned long n);
+ void filterNdec(gr_complex output[],
+ const gr_complex input[],
+ unsigned long n,
+ unsigned int decimate);
+
+ protected:
+ std::vector<float> d_taps;
+ unsigned int d_ntaps;
+ float **d_aligned_taps;
+ gr_complex *d_output;
+ int d_align;
+ int d_naligned;
+ };
+
+ /**************************************************************/
+
+ class FILTER_API fir_filter_fcc
+ {
+ public:
+ fir_filter_fcc(int decimation,
+ const std::vector<gr_complex> &taps);
+ ~fir_filter_fcc();
+
+ void set_taps(const std::vector<gr_complex> &taps);
+ std::vector<gr_complex> taps() const;
+ unsigned int ntaps() const;
+
+ gr_complex filter(const float input[]);
+ void filterN(gr_complex output[],
+ const float input[],
+ unsigned long n);
+ void filterNdec(gr_complex output[],
+ const float input[],
+ unsigned long n,
+ unsigned int decimate);
+
+ protected:
+ std::vector<gr_complex> d_taps;
+ unsigned int d_ntaps;
+ gr_complex **d_aligned_taps;
+ gr_complex *d_output;
+ int d_align;
+ int d_naligned;
+ };
+
+ /**************************************************************/
+
+ class FILTER_API fir_filter_ccc
+ {
+ public:
+ fir_filter_ccc(int decimation,
+ const std::vector<gr_complex> &taps);
+ ~fir_filter_ccc();
+
+ void set_taps(const std::vector<gr_complex> &taps);
+ std::vector<gr_complex> taps() const;
+ unsigned int ntaps() const;
+
+ gr_complex filter(const gr_complex input[]);
+ void filterN(gr_complex output[],
+ const gr_complex input[],
+ unsigned long n);
+ void filterNdec(gr_complex output[],
+ const gr_complex input[],
+ unsigned long n,
+ unsigned int decimate);
+
+ protected:
+ std::vector<gr_complex> d_taps;
+ unsigned int d_ntaps;
+ gr_complex **d_aligned_taps;
+ gr_complex *d_output;
+ int d_align;
+ int d_naligned;
+ };
+
+ /**************************************************************/
+
+ class FILTER_API fir_filter_scc
+ {
+ public:
+ fir_filter_scc(int decimation,
+ const std::vector<gr_complex> &taps);
+ ~fir_filter_scc();
+
+ void set_taps(const std::vector<gr_complex> &taps);
+ std::vector<gr_complex> taps() const;
+ unsigned int ntaps() const;
+
+ gr_complex filter(const short input[]);
+ void filterN(gr_complex output[],
+ const short input[],
+ unsigned long n);
+ void filterNdec(gr_complex output[],
+ const short input[],
+ unsigned long n,
+ unsigned int decimate);
+
+ protected:
+ std::vector<gr_complex> d_taps;
+ unsigned int d_ntaps;
+ gr_complex **d_aligned_taps;
+ gr_complex *d_output;
+ int d_align;
+ int d_naligned;
+ };
+
+ /**************************************************************/
+
+ class FILTER_API fir_filter_fsf
+ {
+ public:
+ fir_filter_fsf(int decimation,
+ const std::vector<float> &taps);
+ ~fir_filter_fsf();
+
+ void set_taps(const std::vector<float> &taps);
+ std::vector<float> taps() const;
+ unsigned int ntaps() const;
+
+ short filter(const float input[]);
+ void filterN(short output[],
+ const float input[],
+ unsigned long n);
+ void filterNdec(short output[],
+ const float input[],
+ unsigned long n,
+ unsigned int decimate);
+
+ protected:
+ std::vector<float> d_taps;
+ unsigned int d_ntaps;
+ float **d_aligned_taps;
+ short *d_output;
+ int d_align;
+ int d_naligned;
+ };
+
+ } /* namespace kernel */
+ } /* namespace filter */
+} /* namespace gr */
+
+#endif /* INCLUDED_FILTER_FIR_FILTER_H */
diff --git a/gr-filter/include/filter/fir_filter_XXX.h.t b/gr-filter/include/filter/fir_filter_XXX.h.t
new file mode 100644
index 000000000..98e82f510
--- /dev/null
+++ b/gr-filter/include/filter/fir_filter_XXX.h.t
@@ -0,0 +1,82 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,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 <filter/api.h>
+#include <gr_sync_decimator.h>
+
+namespace gr {
+ namespace filter {
+
+ /*!
+ * \brief FIR filter with @I_TYPE@ input, @O_TYPE@ output, and @TAP_TYPE@ taps
+ * \ingroup filter_blk
+ *
+ * The fir_filter_XXX blocks create finite impulse response
+ * (FIR) filters that perform the convolution in the time
+ * domain:
+ *
+ * \code
+ * out = 0
+ * for i in ntaps:
+ * out += input[n-i] * taps[i]
+ * \endcode
+ *
+ * The taps are a C++ vector (or Python list) of values of the
+ * type specified by the third letter in the block's suffix. For
+ * this block, the value is of type @TAP_TYPE@. Taps can be
+ * created using the firdes or optfir tools.
+ *
+ * These versions of the filter can also act as down-samplers
+ * (or decimators) by specifying an integer value for \p
+ * decimation.
+ *
+ */
+ class FILTER_API @BASE_NAME@ : virtual public gr_sync_decimator
+ {
+ public:
+
+ // gr::filter::@BASE_NAME@::sptr
+ typedef boost::shared_ptr<@BASE_NAME@> sptr;
+
+ /*!
+ * \brief FIR filter with @I_TYPE@ input, @O_TYPE@ output, and @TAP_TYPE@ taps
+ * \ingroup filter_blk
+ *
+ * \param decimation set the integer decimation rate
+ * \param taps a vector/list of taps of type @TAP_TYPE@
+ */
+ static sptr make(int decimation,
+ const std::vector<@TAP_TYPE@> &taps);
+
+ virtual void set_taps(const std::vector<@TAP_TYPE@> &taps) = 0;
+ virtual std::vector<@TAP_TYPE@> taps() const = 0;
+ };
+
+ } /* namespace filter */
+} /* namespace gr */
+
+#endif /* @GUARD_NAME@ */
diff --git a/gr-filter/include/filter/fir_filter_with_buffer.h b/gr-filter/include/filter/fir_filter_with_buffer.h
new file mode 100644
index 000000000..007eae3fa
--- /dev/null
+++ b/gr-filter/include/filter/fir_filter_with_buffer.h
@@ -0,0 +1,326 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+#ifndef INCLUDED_FILTER_FIR_FILTER_WITH_BUFFER_H
+#define INCLUDED_FILTER_FIR_FILTER_WITH_BUFFER_H
+
+#include <filter/api.h>
+#include <vector>
+#include <gr_complex.h>
+
+namespace gr {
+ namespace filter {
+ namespace kernel {
+
+ /*!
+ * \brief FIR with internal buffer for float input, float output and float taps.
+ * \ingroup filter
+ */
+ class FILTER_API fir_filter_with_buffer_fff
+ {
+ private:
+ std::vector<float> d_taps;
+ unsigned int d_ntaps;
+ float *d_buffer_ptr;
+ float *d_buffer;
+ unsigned int d_idx;
+ float **d_aligned_taps;
+ float *d_output;
+ int d_align;
+ int d_naligned;
+
+ public:
+
+ // CONSTRUCTORS
+
+ /*!
+ * \brief construct new FIR with given taps.
+ *
+ * Note that taps must be in forward order, e.g., coefficient 0 is
+ * stored in new_taps[0], coefficient 1 is stored in
+ * new_taps[1], etc.
+ */
+ fir_filter_with_buffer_fff(const std::vector<float> &taps);
+
+ ~fir_filter_with_buffer_fff();
+
+ // MANIPULATORS
+
+ /*!
+ * \brief compute a single output value.
+ *
+ * \p input is a single input value of the filter type
+ *
+ * \returns the filtered input value.
+ */
+ float filter(float input);
+
+ /*!
+ * \brief compute a single output value; designed for decimating filters.
+ *
+ * \p input is a single input value of the filter type. The value of dec is the
+ * decimating value of the filter, so input[] must have dec valid values.
+ * The filter pushes dec number of items onto the circ. buffer before computing
+ * a single output.
+ *
+ * \returns the filtered input value.
+ */
+ float filter(const float input[], unsigned long dec);
+
+ /*!
+ * \brief compute an array of N output values.
+ *
+ * \p input must have (n - 1 + ntaps()) valid entries.
+ * input[0] .. input[n - 1 + ntaps() - 1] are referenced to compute the output values.
+ */
+ void filterN(float output[],
+ const float input[],
+ unsigned long n);
+
+ /*!
+ * \brief compute an array of N output values, decimating the input
+ *
+ * \p input must have (decimate * (n - 1) + ntaps()) valid entries.
+ * input[0] .. input[decimate * (n - 1) + ntaps() - 1] are referenced to
+ * compute the output values.
+ */
+ void filterNdec(float output[], const float input[],
+ unsigned long n, unsigned long decimate);
+
+ // ACCESSORS
+
+ /*!
+ * \return number of taps in filter.
+ */
+ unsigned int ntaps() const { return d_ntaps; }
+
+ /*!
+ * \brief install \p new_taps as the current taps.
+ */
+ void set_taps(const std::vector<float> &taps);
+
+ /*!
+ * \return current taps
+ */
+ std::vector<float> taps() const;
+ };
+
+
+ /**************************************************************/
+
+
+ /*!
+ * \brief FIR with internal buffer for gr_complex input, gr_complex output and gr_complex taps.
+ * \ingroup filter
+ */
+ class FILTER_API fir_filter_with_buffer_ccc
+ {
+ private:
+ std::vector<gr_complex> d_taps;
+ unsigned int d_ntaps;
+ gr_complex *d_buffer_ptr;
+ gr_complex *d_buffer;
+ unsigned int d_idx;
+ gr_complex **d_aligned_taps;
+ gr_complex *d_output;
+ int d_align;
+ int d_naligned;
+
+ public:
+
+ // CONSTRUCTORS
+
+ /*!
+ * \brief construct new FIR with given taps.
+ *
+ * Note that taps must be in forward order, e.g., coefficient 0 is
+ * stored in new_taps[0], coefficient 1 is stored in
+ * new_taps[1], etc.
+ */
+ fir_filter_with_buffer_ccc(const std::vector<gr_complex> &taps);
+
+ ~fir_filter_with_buffer_ccc();
+
+ // MANIPULATORS
+
+ /*!
+ * \brief compute a single output value.
+ *
+ * \p input is a single input value of the filter type
+ *
+ * \returns the filtered input value.
+ */
+ gr_complex filter(gr_complex input);
+
+ /*!
+ * \brief compute a single output value; designed for decimating filters.
+ *
+ * \p input is a single input value of the filter type. The value of dec is the
+ * decimating value of the filter, so input[] must have dec valid values.
+ * The filter pushes dec number of items onto the circ. buffer before computing
+ * a single output.
+ *
+ * \returns the filtered input value.
+ */
+ gr_complex filter(const gr_complex input[], unsigned long dec);
+
+ /*!
+ * \brief compute an array of N output values.
+ *
+ * \p input must have (n - 1 + ntaps()) valid entries.
+ * input[0] .. input[n - 1 + ntaps() - 1] are referenced to compute the output values.
+ */
+ void filterN(gr_complex output[],
+ const gr_complex input[],
+ unsigned long n);
+
+ /*!
+ * \brief compute an array of N output values, decimating the input
+ *
+ * \p input must have (decimate * (n - 1) + ntaps()) valid entries.
+ * input[0] .. input[decimate * (n - 1) + ntaps() - 1] are referenced to
+ * compute the output values.
+ */
+ void filterNdec(gr_complex output[], const gr_complex input[],
+ unsigned long n, unsigned long decimate);
+
+ // ACCESSORS
+
+ /*!
+ * \return number of taps in filter.
+ */
+ unsigned int ntaps() const { return d_ntaps; }
+
+ /*!
+ * \brief install \p new_taps as the current taps.
+ */
+ void set_taps(const std::vector<gr_complex> &taps);
+
+ /*!
+ * \return current taps
+ */
+ std::vector<gr_complex> taps() const;
+ };
+
+
+ /**************************************************************/
+
+
+ /*!
+ * \brief FIR with internal buffer for gr_complex input, gr_complex output and gr_complex taps.
+ * \ingroup filter
+ */
+ class FILTER_API fir_filter_with_buffer_ccf
+ {
+ private:
+ std::vector<float> d_taps;
+ unsigned int d_ntaps;
+ gr_complex *d_buffer_ptr;
+ gr_complex *d_buffer;
+ unsigned int d_idx;
+ float **d_aligned_taps;
+ gr_complex *d_output;
+ int d_align;
+ int d_naligned;
+
+ public:
+
+ // CONSTRUCTORS
+
+ /*!
+ * \brief construct new FIR with given taps.
+ *
+ * Note that taps must be in forward order, e.g., coefficient 0 is
+ * stored in new_taps[0], coefficient 1 is stored in
+ * new_taps[1], etc.
+ */
+ fir_filter_with_buffer_ccf(const std::vector<float> &taps);
+
+ ~fir_filter_with_buffer_ccf();
+
+ // MANIPULATORS
+
+ /*!
+ * \brief compute a single output value.
+ *
+ * \p input is a single input value of the filter type
+ *
+ * \returns the filtered input value.
+ */
+ gr_complex filter(gr_complex input);
+
+ /*!
+ * \brief compute a single output value; designed for decimating filters.
+ *
+ * \p input is a single input value of the filter type. The value of dec is the
+ * decimating value of the filter, so input[] must have dec valid values.
+ * The filter pushes dec number of items onto the circ. buffer before computing
+ * a single output.
+ *
+ * \returns the filtered input value.
+ */
+ gr_complex filter(const gr_complex input[], unsigned long dec);
+
+ /*!
+ * \brief compute an array of N output values.
+ *
+ * \p input must have (n - 1 + ntaps()) valid entries.
+ * input[0] .. input[n - 1 + ntaps() - 1] are referenced to compute the output values.
+ */
+ void filterN(gr_complex output[],
+ const gr_complex input[],
+ unsigned long n);
+
+ /*!
+ * \brief compute an array of N output values, decimating the input
+ *
+ * \p input must have (decimate * (n - 1) + ntaps()) valid entries.
+ * input[0] .. input[decimate * (n - 1) + ntaps() - 1] are referenced to
+ * compute the output values.
+ */
+ void filterNdec(gr_complex output[], const gr_complex input[],
+ unsigned long n, unsigned long decimate);
+
+ // ACCESSORS
+
+ /*!
+ * \return number of taps in filter.
+ */
+ unsigned int ntaps() const { return d_ntaps; }
+
+ /*!
+ * \brief install \p new_taps as the current taps.
+ */
+ void set_taps(const std::vector<float> &taps);
+
+ /*!
+ * \return current taps
+ */
+ std::vector<float> taps() const;
+ };
+
+
+ } /* namespace kernel */
+ } /* namespace filter */
+} /* namespace gr */
+
+#endif /* INCLUDED_FILTER_FIR_FILTER_WITH_BUFFER_H */
diff --git a/gr-filter/include/filter/firdes.h b/gr-filter/include/filter/firdes.h
new file mode 100644
index 000000000..172563ea0
--- /dev/null
+++ b/gr-filter/include/filter/firdes.h
@@ -0,0 +1,378 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002,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.
+ */
+
+#ifndef _FILTER_FIRDES_H_
+#define _FILTER_FIRDES_H_
+
+#include <filter/api.h>
+#include <vector>
+#include <cmath>
+#include <gr_complex.h>
+
+namespace gr {
+ namespace filter {
+
+ /*!
+ * \brief Finite Impulse Response (FIR) filter design functions.
+ * \ingroup filter_design
+ */
+
+ class FILTER_API firdes {
+ public:
+
+ enum win_type {
+ WIN_HAMMING = 0, // max attenuation 53 dB
+ WIN_HANN = 1, // max attenuation 44 dB
+ WIN_BLACKMAN = 2, // max attenuation 74 dB
+ WIN_RECTANGULAR = 3,
+ WIN_KAISER = 4, // max attenuation a function of beta, google it
+ WIN_BLACKMAN_hARRIS = 5,
+ WIN_BLACKMAN_HARRIS = 5, // alias for capitalization consistency
+ };
+
+
+ // ... class methods ...
+
+ /*!
+ * \brief use "window method" to design a low-pass FIR filter
+ *
+ * \p gain: overall gain of filter (typically 1.0)
+ * \p sampling_freq: sampling freq (Hz)
+ * \p cutoff_freq: center of transition band (Hz)
+ * \p transition_width: width of transition band (Hz).
+ * The normalized width of the transition
+ * band is what sets the number of taps
+ * required. Narrow --> more taps
+ * \p window_type: What kind of window to use. Determines
+ * maximum attenuation and passband ripple.
+ * \p beta: parameter for Kaiser window
+ */
+ static std::vector<float>
+ low_pass(double gain,
+ double sampling_freq,
+ double cutoff_freq, // Hz center of transition band
+ double transition_width, // Hz width of transition band
+ win_type window = WIN_HAMMING,
+ double beta = 6.76); // used only with Kaiser
+
+ /*!
+ * \brief use "window method" to design a low-pass FIR filter
+ *
+ * \p gain: overall gain of filter (typically 1.0)
+ * \p sampling_freq: sampling freq (Hz)
+ * \p cutoff_freq: center of transition band (Hz)
+ * \p transition_width: width of transition band (Hz).
+ * \p attenuation_dB required stopband attenuation
+ * The normalized width of the transition
+ * band and the required stop band
+ * attenuation is what sets the number of taps
+ * required. Narrow --> more taps
+ * More attenuatin --> more taps
+ * \p window_type: What kind of window to use. Determines
+ * maximum attenuation and passband ripple.
+ * \p beta: parameter for Kaiser window
+ */
+
+ static std::vector<float>
+ low_pass_2(double gain,
+ double sampling_freq,
+ double cutoff_freq, // Hz beginning transition band
+ double transition_width, // Hz width of transition band
+ double attenuation_dB, // out of band attenuation dB
+ win_type window = WIN_HAMMING,
+ double beta = 6.76); // used only with Kaiser
+
+ /*!
+ * \brief use "window method" to design a high-pass FIR filter
+ *
+ * \p gain: overall gain of filter (typically 1.0)
+ * \p sampling_freq: sampling freq (Hz)
+ * \p cutoff_freq: center of transition band (Hz)
+ * \p transition_width: width of transition band (Hz).
+ * The normalized width of the transition
+ * band is what sets the number of taps
+ * required. Narrow --> more taps
+ * \p window_type: What kind of window to use. Determines
+ * maximum attenuation and passband ripple.
+ * \p beta: parameter for Kaiser window
+ */
+
+ static std::vector<float>
+ high_pass(double gain,
+ double sampling_freq,
+ double cutoff_freq, // Hz center of transition band
+ double transition_width, // Hz width of transition band
+ win_type window = WIN_HAMMING,
+ double beta = 6.76); // used only with Kaiser
+
+ /*!
+ * \brief use "window method" to design a high-pass FIR filter
+ *
+ * \p gain: overall gain of filter (typically 1.0)
+ * \p sampling_freq: sampling freq (Hz)
+ * \p cutoff_freq: center of transition band (Hz)
+ * \p transition_width: width of transition band (Hz).
+ * \p attenuation_dB out of band attenuation
+ * The normalized width of the transition
+ * band and the required stop band
+ * attenuation is what sets the number of taps
+ * required. Narrow --> more taps
+ * More attenuation --> more taps
+ * \p window_type: What kind of window to use. Determines
+ * maximum attenuation and passband ripple.
+ * \p beta: parameter for Kaiser window
+ */
+
+ static std::vector<float>
+ high_pass_2(double gain,
+ double sampling_freq,
+ double cutoff_freq, // Hz center of transition band
+ double transition_width, // Hz width of transition band
+ double attenuation_dB, // out of band attenuation dB
+ win_type window = WIN_HAMMING,
+ double beta = 6.76); // used only with Kaiser
+
+ /*!
+ * \brief use "window method" to design a band-pass FIR filter
+ *
+ * \p gain: overall gain of filter (typically 1.0)
+ * \p sampling_freq: sampling freq (Hz)
+ * \p low_cutoff_freq: center of transition band (Hz)
+ * \p high_cutoff_freq: center of transition band (Hz)
+ * \p transition_width: width of transition band (Hz).
+ * The normalized width of the transition
+ * band is what sets the number of taps
+ * required. Narrow --> more taps
+ * \p window_type: What kind of window to use. Determines
+ * maximum attenuation and passband ripple.
+ * \p beta: parameter for Kaiser window
+ */
+ static std::vector<float>
+ band_pass(double gain,
+ double sampling_freq,
+ double low_cutoff_freq, // Hz center of transition band
+ double high_cutoff_freq, // Hz center of transition band
+ double transition_width, // Hz width of transition band
+ win_type window = WIN_HAMMING,
+ double beta = 6.76); // used only with Kaiser
+
+ /*!
+ * \brief use "window method" to design a band-pass FIR filter
+ *
+ * \p gain: overall gain of filter (typically 1.0)
+ * \p sampling_freq: sampling freq (Hz)
+ * \p low_cutoff_freq: center of transition band (Hz)
+ * \p high_cutoff_freq: center of transition band (Hz)
+ * \p transition_width: width of transition band (Hz).
+ * \p attenuation_dB out of band attenuation
+ * The normalized width of the transition
+ * band and the required stop band
+ * attenuation is what sets the number of taps
+ * required. Narrow --> more taps
+ * More attenuation --> more taps
+ * \p window_type: What kind of window to use. Determines
+ * maximum attenuation and passband ripple.
+ * \p beta: parameter for Kaiser window
+ */
+
+ static std::vector<float>
+ band_pass_2(double gain,
+ double sampling_freq,
+ double low_cutoff_freq, // Hz beginning transition band
+ double high_cutoff_freq, // Hz beginning transition band
+ double transition_width, // Hz width of transition band
+ double attenuation_dB, // out of band attenuation dB
+ win_type window = WIN_HAMMING,
+ double beta = 6.76); // used only with Kaiser
+
+ /*!
+ * \brief use "window method" to design a complex band-pass FIR filter
+ *
+ * \p gain: overall gain of filter (typically 1.0)
+ * \p sampling_freq: sampling freq (Hz)
+ * \p low_cutoff_freq: center of transition band (Hz)
+ * \p high_cutoff_freq: center of transition band (Hz)
+ * \p transition_width: width of transition band (Hz).
+ * The normalized width of the transition
+ * band is what sets the number of taps
+ * required. Narrow --> more taps
+ * \p window_type: What kind of window to use. Determines
+ * maximum attenuation and passband ripple.
+ * \p beta: parameter for Kaiser window
+ */
+ static std::vector<gr_complex>
+ complex_band_pass(double gain,
+ double sampling_freq,
+ double low_cutoff_freq, // Hz center of transition band
+ double high_cutoff_freq, // Hz center of transition band
+ double transition_width, // Hz width of transition band
+ win_type window = WIN_HAMMING,
+ double beta = 6.76); // used only with Kaiser
+
+ /*!
+ * \brief use "window method" to design a complex band-pass FIR filter
+ *
+ * \p gain: overall gain of filter (typically 1.0)
+ * \p sampling_freq: sampling freq (Hz)
+ * \p low_cutoff_freq: center of transition band (Hz)
+ * \p high_cutoff_freq: center of transition band (Hz)
+ * \p transition_width: width of transition band (Hz).
+ * \p attenuation_dB out of band attenuation
+ * The normalized width of the transition
+ * band and the required stop band
+ * attenuation is what sets the number of taps
+ * required. Narrow --> more taps
+ * More attenuation --> more taps
+ * \p window_type: What kind of window to use. Determines
+ * maximum attenuation and passband ripple.
+ * \p beta: parameter for Kaiser window
+ */
+
+ static std::vector<gr_complex>
+ complex_band_pass_2(double gain,
+ double sampling_freq,
+ double low_cutoff_freq, // Hz beginning transition band
+ double high_cutoff_freq, // Hz beginning transition band
+ double transition_width, // Hz width of transition band
+ double attenuation_dB, // out of band attenuation dB
+ win_type window = WIN_HAMMING,
+ double beta = 6.76); // used only with Kaiser
+
+ /*!
+ * \brief use "window method" to design a band-reject FIR filter
+ *
+ * \p gain: overall gain of filter (typically 1.0)
+ * \p sampling_freq: sampling freq (Hz)
+ * \p low_cutoff_freq: center of transition band (Hz)
+ * \p high_cutoff_freq: center of transition band (Hz)
+ * \p transition_width: width of transition band (Hz).
+ * The normalized width of the transition
+ * band is what sets the number of taps
+ * required. Narrow --> more taps
+ * \p window_type: What kind of window to use. Determines
+ * maximum attenuation and passband ripple.
+ * \p beta: parameter for Kaiser window
+ */
+
+ static std::vector<float>
+ band_reject(double gain,
+ double sampling_freq,
+ double low_cutoff_freq, // Hz center of transition band
+ double high_cutoff_freq, // Hz center of transition band
+ double transition_width, // Hz width of transition band
+ win_type window = WIN_HAMMING,
+ double beta = 6.76); // used only with Kaiser
+
+ /*!
+ * \brief use "window method" to design a band-reject FIR filter
+ *
+ * \p gain: overall gain of filter (typically 1.0)
+ * \p sampling_freq: sampling freq (Hz)
+ * \p low_cutoff_freq: center of transition band (Hz)
+ * \p high_cutoff_freq: center of transition band (Hz)
+ * \p transition_width: width of transition band (Hz).
+ * \p attenuation_dB out of band attenuation
+ * The normalized width of the transition
+ * band and the required stop band
+ * attenuation is what sets the number of taps
+ * required. Narrow --> more taps
+ * More attenuation --> more taps
+ * \p window_type: What kind of window to use. Determines
+ * maximum attenuation and passband ripple.
+ * \p beta: parameter for Kaiser window
+ */
+
+ static std::vector<float>
+ band_reject_2(double gain,
+ double sampling_freq,
+ double low_cutoff_freq, // Hz beginning transition band
+ double high_cutoff_freq, // Hz beginning transition band
+ double transition_width, // Hz width of transition band
+ double attenuation_dB, // out of band attenuation dB
+ win_type window = WIN_HAMMING,
+ double beta = 6.76); // used only with Kaiser
+
+ /*!\brief design a Hilbert Transform Filter
+ *
+ * \p ntaps: Number of taps, must be odd
+ * \p window_type: What kind of window to use
+ * \p beta: Only used for Kaiser
+ */
+ static std::vector<float>
+ hilbert(unsigned int ntaps = 19,
+ win_type windowtype = WIN_RECTANGULAR,
+ double beta = 6.76);
+
+ /*!
+ * \brief design a Root Cosine FIR Filter (do we need a window?)
+ *
+ * \p gain: overall gain of filter (typically 1.0)
+ * \p sampling_freq: sampling freq (Hz)
+ * \p symbol rate: symbol rate, must be a factor of sample rate
+ * \p alpha: excess bandwidth factor
+ * \p ntaps: number of taps
+ */
+ static std::vector<float>
+ root_raised_cosine(double gain,
+ double sampling_freq,
+ double symbol_rate, // Symbol rate, NOT bitrate (unless BPSK)
+ double alpha, // Excess Bandwidth Factor
+ int ntaps);
+
+ /*!
+ * \brief design a Gaussian filter
+ *
+ * \p gain: overall gain of filter (typically 1.0)
+ * \p symbols per bit: symbol rate, must be a factor of sample rate
+ * \p ntaps: number of taps
+ */
+ static std::vector<float>
+ gaussian(double gain,
+ double spb,
+ double bt, // Bandwidth to bitrate ratio
+ int ntaps);
+
+ // window functions ...
+ static std::vector<float> window (win_type type, int ntaps, double beta);
+
+ private:
+ static double bessi0(double x);
+ static void sanity_check_1f(double sampling_freq, double f1,
+ double transition_width);
+ static void sanity_check_2f(double sampling_freq, double f1, double f2,
+ double transition_width);
+ static void sanity_check_2f_c(double sampling_freq, double f1, double f2,
+ double transition_width);
+
+ static int compute_ntaps(double sampling_freq,
+ double transition_width,
+ win_type window_type, double beta);
+
+ static int compute_ntaps_windes(double sampling_freq,
+ double transition_width,
+ double attenuation_dB);
+ };
+
+ } /* namespace filter */
+} /* namespace gr */
+
+#endif /* _FILTER_FIRDES_H_ */
diff --git a/gr-filter/include/filter/fractional_interpolator_cc.h b/gr-filter/include/filter/fractional_interpolator_cc.h
new file mode 100644
index 000000000..bb0e18932
--- /dev/null
+++ b/gr-filter/include/filter/fractional_interpolator_cc.h
@@ -0,0 +1,60 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2007,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 INCLUDED_FRACTIONAL_INTERPOLATOR_CC_H
+#define INCLUDED_FRACTIONAL_INTERPOLATOR_CC_H
+
+#include <filter/api.h>
+#include <gr_block.h>
+
+namespace gr {
+ namespace filter {
+
+ /*!
+ * \brief Interpolating MMSE filter with complex input, complex output
+ * \ingroup filter_blk
+ */
+ class FILTER_API fractional_interpolator_cc : virtual public gr_block
+ {
+ public:
+ // gr::filter::fractional_interpolator_cc::sptr
+ typedef boost::shared_ptr<fractional_interpolator_cc> sptr;
+
+ /*!
+ * \brief Build the interpolating MMSE filter (complex input, complex output)
+ *
+ * \param phase_shift The phase shift of the output signal to the input
+ * \param interp_ratio The interpolation ratio = input_rate / output_rate.
+ */
+ static sptr make(float phase_shift,
+ float interp_ratio);
+
+ virtual float mu() const = 0;
+ virtual float interp_ratio() const = 0;
+ virtual void set_mu (float mu) = 0;
+ virtual void set_interp_ratio(float interp_ratio) = 0;
+ };
+
+ } /* namespace filter */
+} /* namespace gr */
+
+#endif /* INCLUDED_FRACTIONAL_INTERPOLATOR_FF_H */
diff --git a/gr-filter/include/filter/fractional_interpolator_ff.h b/gr-filter/include/filter/fractional_interpolator_ff.h
new file mode 100644
index 000000000..fc43c3457
--- /dev/null
+++ b/gr-filter/include/filter/fractional_interpolator_ff.h
@@ -0,0 +1,60 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2007,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 INCLUDED_FRACTIONAL_INTERPOLATOR_FF_H
+#define INCLUDED_FRACTIONAL_INTERPOLATOR_FF_H
+
+#include <filter/api.h>
+#include <gr_block.h>
+
+namespace gr {
+ namespace filter {
+
+ /*!
+ * \brief Interpolating MMSE filter with float input, float output
+ * \ingroup filter_blk
+ */
+ class FILTER_API fractional_interpolator_ff : virtual public gr_block
+ {
+ public:
+ // gr::filter::fractional_interpolator_ff::sptr
+ typedef boost::shared_ptr<fractional_interpolator_ff> sptr;
+
+ /*!
+ * \brief Build the interpolating MMSE filter (float input, float output)
+ *
+ * \param phase_shift The phase shift of the output signal to the input
+ * \param interp_ratio The interpolation ratio = input_rate / output_rate.
+ */
+ static sptr make(float phase_shift,
+ float interp_ratio);
+
+ virtual float mu() const = 0;
+ virtual float interp_ratio() const = 0;
+ virtual void set_mu (float mu) = 0;
+ virtual void set_interp_ratio(float interp_ratio) = 0;
+ };
+
+ } /* namespace filter */
+} /* namespace gr */
+
+#endif /* INCLUDED_FRACTIONAL_INTERPOLATOR_FF_H */
diff --git a/gr-filter/include/filter/freq_xlating_fir_filter_XXX.h.t b/gr-filter/include/filter/freq_xlating_fir_filter_XXX.h.t
new file mode 100644
index 000000000..88e15f823
--- /dev/null
+++ b/gr-filter/include/filter/freq_xlating_fir_filter_XXX.h.t
@@ -0,0 +1,90 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002,2004,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: This file is automatically generated by cmake.
+ * Any changes made to this file will be overwritten.
+ */
+
+#ifndef @GUARD_NAME@
+#define @GUARD_NAME@
+
+#include <filter/api.h>
+#include <gr_sync_decimator.h>
+#include <gr_rotator.h>
+
+namespace gr {
+ namespace filter {
+
+
+ /*!
+ * \brief FIR filter combined with frequency translation with
+ * @I_TYPE@ input, @O_TYPE@ output and @TAP_TYPE@ taps
+ *
+ * \ingroup filter_blk
+ *
+ * This class efficiently combines a frequency translation
+ * (typically "down conversion") with a FIR filter (typically
+ * low-pass) and decimation. It is ideally suited for a "channel
+ * selection filter" and can be efficiently used to select and
+ * decimate a narrow band signal out of wide bandwidth input.
+ *
+ * Uses a single input array to produce a single output array.
+ * Additional inputs and/or outputs are ignored.
+ */
+ class FILTER_API @BASE_NAME@ : virtual public gr_sync_decimator
+ {
+ public:
+ // gr::filter::@BASE_NAME@::sptr
+ typedef boost::shared_ptr<@BASE_NAME@> sptr;
+
+ /*!
+ * \brief FIR filter with @I_TYPE@ input, @O_TYPE@ output, and
+ * @TAP_TYPE@ taps that also frequency translates a signal from
+ * \p center_freq.
+ *
+ * Construct a FIR filter with the given taps and a composite
+ * frequency translation that shifts center_freq down to zero
+ * Hz. The frequency translation logically comes before the
+ * filtering operation.
+ *
+ * \param decimation set the integer decimation rate
+ * \param taps a vector/list of taps of type @TAP_TYPE@
+ * \param center_freq Center frequency of signal to down convert from (Hz)
+ * \param sampling_freq Sampling rate of signal (in Hz)
+ */
+ static sptr make(int decimation,
+ const std::vector<@TAP_TYPE@> &taps,
+ double center_freq,
+ double sampling_freq);
+
+ virtual void set_center_freq(double center_freq) = 0;
+ virtual double center_freq() const = 0;
+
+ virtual void set_taps(const std::vector<@TAP_TYPE@> &taps) = 0;
+ virtual std::vector<@TAP_TYPE@> taps() const = 0;
+ };
+
+ } /* namespace filter */
+} /* namespace gr */
+
+#endif /* @GUARD_NAME@ */
diff --git a/gr-filter/include/filter/hilbert_fc.h b/gr-filter/include/filter/hilbert_fc.h
new file mode 100644
index 000000000..de7cd82b6
--- /dev/null
+++ b/gr-filter/include/filter/hilbert_fc.h
@@ -0,0 +1,53 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,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 INCLUDED_FILTER_HILBERT_FC_H
+#define INCLUDED_FILTER_HILBERT_FC_H
+
+#include <filter/api.h>
+#include <gr_sync_block.h>
+#include <gr_types.h>
+
+namespace gr {
+ namespace filter {
+
+ class FILTER_API hilbert_fc : virtual public gr_sync_block
+ {
+ public:
+ // gr::filter::hilbert_fc::sptr
+ typedef boost::shared_ptr<hilbert_fc> sptr;
+
+ /*!
+ * \brief Hilbert transformer.
+ * \ingroup filter_blk
+ *
+ * real output is input appropriately delayed.
+ * imaginary output is hilbert filtered (90 degree phase shift)
+ * version of input.
+ */
+ static sptr make(unsigned int ntaps);
+ };
+
+ } /* namespace filter */
+} /* namespace gr */
+
+#endif /* INCLUDED_FILTER_HILBERT_FC_H */
diff --git a/gr-filter/include/filter/iir_filter.h b/gr-filter/include/filter/iir_filter.h
new file mode 100644
index 000000000..667acec35
--- /dev/null
+++ b/gr-filter/include/filter/iir_filter.h
@@ -0,0 +1,183 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002,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 INCLUDED_IIR_FILTER_H
+#define INCLUDED_IIR_FILTER_H
+
+#include <filter/api.h>
+#include <vector>
+#include <stdexcept>
+
+namespace gr {
+ namespace filter {
+ namespace kernel {
+
+ /*!
+ * \brief base class template for Infinite Impulse Response filter (IIR)
+ */
+ template<class i_type, class o_type, class tap_type>
+ class iir_filter
+ {
+ public:
+ /*!
+ * \brief Construct an IIR with the given taps.
+ *
+ * This filter uses the Direct Form I implementation, where
+ * \p fftaps contains the feed-forward taps, and \p fbtaps the feedback ones.
+ *
+ * \p fftaps and \p fbtaps must have equal numbers of taps
+ *
+ * The input and output satisfy a difference equation of the form
+
+ \f[
+ y[n] - \sum_{k=1}^{M} a_k y[n-k] = \sum_{k=0}^{N} b_k x[n-k]
+ \f]
+
+ * with the corresponding rational system function
+
+ \f[
+ H(z) = \frac{\sum_{k=0}^{N} b_k z^{-k}}{1 - \sum_{k=1}^{M} a_k z^{-k}}
+ \f]
+
+ * Note that some texts define the system function with a + in
+ * the denominator. If you're using that convention, you'll
+ * need to negate the feedback taps.
+ */
+ iir_filter(const std::vector<tap_type>& fftaps,
+ const std::vector<tap_type>& fbtaps) throw (std::invalid_argument)
+ {
+ set_taps(fftaps, fbtaps);
+ }
+
+ iir_filter() : d_latest_n(0),d_latest_m(0) { }
+
+ ~iir_filter() {}
+
+ /*!
+ * \brief compute a single output value.
+ * \returns the filtered input value.
+ */
+ o_type filter(const i_type input);
+
+ /*!
+ * \brief compute an array of N output values.
+ * \p input must have N valid entries.
+ */
+ void filter_n(o_type output[], const i_type input[], long n);
+
+ /*!
+ * \return number of taps in filter.
+ */
+ unsigned ntaps_ff() const { return d_fftaps.size(); }
+ unsigned ntaps_fb() const { return d_fbtaps.size(); }
+
+ /*!
+ * \brief install new taps.
+ */
+ void set_taps(const std::vector<tap_type> &fftaps,
+ const std::vector<tap_type> &fbtaps) throw (std::invalid_argument)
+ {
+ d_latest_n = 0;
+ d_latest_m = 0;
+ d_fftaps = fftaps;
+ d_fbtaps = fbtaps;
+
+ int n = fftaps.size();
+ int m = fbtaps.size();
+ d_prev_input.resize(2 * n);
+ d_prev_output.resize(2 * m);
+
+ for(int i = 0; i < 2 * n; i++) {
+ d_prev_input[i] = 0;
+ }
+ for(int i = 0; i < 2 * m; i++) {
+ d_prev_output[i] = 0;
+ }
+ }
+
+ protected:
+ std::vector<tap_type> d_fftaps;
+ std::vector<tap_type> d_fbtaps;
+ int d_latest_n;
+ int d_latest_m;
+ std::vector<tap_type> d_prev_output;
+ std::vector<i_type> d_prev_input;
+ };
+
+ //
+ // general case. We may want to specialize this
+ //
+ template<class i_type, class o_type, class tap_type>
+ o_type
+ iir_filter<i_type, o_type, tap_type>::filter(const i_type input)
+ {
+ tap_type acc;
+ unsigned i = 0;
+ unsigned n = ntaps_ff();
+ unsigned m = ntaps_fb();
+
+ if(n == 0)
+ return (o_type)0;
+
+ int latest_n = d_latest_n;
+ int latest_m = d_latest_m;
+
+ acc = d_fftaps[0] * input;
+ for(i = 1; i < n; i ++)
+ acc += (d_fftaps[i] * d_prev_input[latest_n + i]);
+ for(i = 1; i < m; i ++)
+ acc += (d_fbtaps[i] * d_prev_output[latest_m + i]);
+
+ // store the values twice to avoid having to handle wrap-around in the loop
+ d_prev_output[latest_m] = acc;
+ d_prev_output[latest_m+m] = acc;
+ d_prev_input[latest_n] = input;
+ d_prev_input[latest_n+n] = input;
+
+ latest_n--;
+ latest_m--;
+ if(latest_n < 0)
+ latest_n += n;
+ if(latest_m < 0)
+ latest_m += m;
+
+ d_latest_m = latest_m;
+ d_latest_n = latest_n;
+ return (o_type)acc;
+ }
+
+ template<class i_type, class o_type, class tap_type>
+ void
+ iir_filter<i_type, o_type, tap_type>::filter_n(o_type output[],
+ const i_type input[],
+ long n)
+ {
+ for(int i = 0; i < n; i++)
+ output[i] = filter(input[i]);
+ }
+
+ } /* namespace kernel */
+ } /* namespace filter */
+} /* namespace gr */
+
+#endif /* INCLUDED_IIR_FILTER_H */
+
diff --git a/gr-filter/include/filter/iir_filter_ffd.h b/gr-filter/include/filter/iir_filter_ffd.h
new file mode 100644
index 000000000..04dd1e776
--- /dev/null
+++ b/gr-filter/include/filter/iir_filter_ffd.h
@@ -0,0 +1,82 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,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 INCLUDED_IIR_FILTER_FFD_H
+#define INCLUDED_IIR_FILTER_FFD_H
+
+#include <filter/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace filter {
+
+ /*!
+ * \brief IIR filter with float input, float output and double taps
+ * \ingroup filter_blk
+ *
+ * This filter uses the Direct Form I implementation, where
+ * \p fftaps contains the feed-forward taps, and \p fbtaps the feedback ones.
+ *
+ *
+ * The input and output satisfy a difference equation of the form
+ \htmlonly
+ \f{
+ y[n] - \sum_{k=1}^{M} a_k y[n-k] = \sum_{k=0}^{N} b_k x[n-k]
+ \f}
+ \endhtmlonly
+
+ \xmlonly
+ y[n] - \sum_{k=1}^{M} a_k y[n-k] = \sum_{k=0}^{N} b_k x[n-k]
+ \endxmlonly
+
+ * with the corresponding rational system function
+ \htmlonly
+ \f{
+ H(z) = \ frac{\sum_{k=0}^{M} b_k z^{-k}}{1 - \sum_{k=1}^{N} a_k z^{-k}}
+ \f}
+ \endhtmlonly
+
+ \xmlonly
+ H(z) = \ frac{\sum_{k=0}^{M} b_k z^{-k}}{1 - \sum_{k=1}^{N} a_k z^{-k}}
+ \endxmlonly
+
+ * Note that some texts define the system function with a + in the
+ * denominator. If you're using that convention, you'll need to
+ * negate the feedback taps.
+ */
+ class FILTER_API iir_filter_ffd : virtual public gr_sync_block
+ {
+ public:
+ // gr::filter::iir_filter_ffd::sptr
+ typedef boost::shared_ptr<iir_filter_ffd> sptr;
+
+ static sptr make(const std::vector<double> &fftaps,
+ const std::vector<double> &fbtaps);
+
+ virtual void set_taps(const std::vector<double> &fftaps,
+ const std::vector<double> &fbtaps) = 0;
+ };
+
+ } /* namespace filter */
+} /* namespace gr */
+
+#endif /* INCLUDED_IIR_FILTER_FFD_H */
diff --git a/gr-filter/include/filter/interp_fir_filter_XXX.h.t b/gr-filter/include/filter/interp_fir_filter_XXX.h.t
new file mode 100644
index 000000000..b66c9f643
--- /dev/null
+++ b/gr-filter/include/filter/interp_fir_filter_XXX.h.t
@@ -0,0 +1,81 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,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 <filter/api.h>
+#include <gr_sync_interpolator.h>
+
+namespace gr {
+ namespace filter {
+
+ /*!
+ * \brief Interpolating FIR filter with @I_TYPE@ input, @O_TYPE@ output and @TAP_TYPE@ taps
+ * \ingroup filter_blk
+ *
+ * The fir_filter_XXX blocks create finite impulse response
+ * (FIR) filters that perform the convolution in the time
+ * domain:
+ *
+ * \code
+ * out = 0
+ * for i in ntaps:
+ * out += input[n-i] * taps[i]
+ * \endcode
+ *
+ * The taps are a C++ vector (or Python list) of values of the
+ * type specified by the third letter in the block's suffix. For
+ * this block, the value is of type @TAP_TYPE@. Taps can be
+ * created using the firdes or optfir tools.
+ *
+ * These versions of the filter can also act as up-samplers
+ * (or interpolators) by specifying an integer value for \p
+ * interpolation.
+ *
+ */
+ class FILTER_API @BASE_NAME@ : virtual public gr_sync_interpolator
+ {
+ public:
+ // gr::filter::@BASE_NAME@::sptr
+ typedef boost::shared_ptr<@BASE_NAME@> sptr;
+
+ /*!
+ * \brief Interpolating FIR filter with @I_TYPE@ input, @O_TYPE@ output, and @TAP_TYPE@ taps
+ * \ingroup filter_blk
+ *
+ * \param interpolation set the integer interpolation rate
+ * \param taps a vector/list of taps of type @TAP_TYPE@
+ */
+ static sptr make(unsigned interpolation,
+ const std::vector<@TAP_TYPE@> &taps);
+
+ virtual void set_taps(const std::vector<@TAP_TYPE@> &taps) = 0;
+ virtual std::vector<@TAP_TYPE@> taps() const = 0;
+ };
+
+ } /* namespace filter */
+} /* namespace gr */
+
+#endif /* @GUARD_NAME@ */
diff --git a/gr-filter/include/filter/interpolator_taps.h b/gr-filter/include/filter/interpolator_taps.h
new file mode 100644
index 000000000..a232edd38
--- /dev/null
+++ b/gr-filter/include/filter/interpolator_taps.h
@@ -0,0 +1,140 @@
+/*
+ * This file was machine generated by gen_interpolator_taps.
+ * DO NOT EDIT BY HAND.
+ */
+
+static const int NTAPS = 8;
+static const int NSTEPS = 128;
+
+static const float taps[NSTEPS+1][NTAPS] = {
+ // -4 -3 -2 -1 0 1 2 3 mu
+ { 0.00000e+00, 0.00000e+00, 0.00000e+00, 0.00000e+00, 1.00000e+00, 0.00000e+00, 0.00000e+00, 0.00000e+00 }, // 0/128
+ { -1.54700e-04, 8.53777e-04, -2.76968e-03, 7.89295e-03, 9.98534e-01, -5.41054e-03, 1.24642e-03, -1.98993e-04 }, // 1/128
+ { -3.09412e-04, 1.70888e-03, -5.55134e-03, 1.58840e-02, 9.96891e-01, -1.07209e-02, 2.47942e-03, -3.96391e-04 }, // 2/128
+ { -4.64053e-04, 2.56486e-03, -8.34364e-03, 2.39714e-02, 9.95074e-01, -1.59305e-02, 3.69852e-03, -5.92100e-04 }, // 3/128
+ { -6.18544e-04, 3.42130e-03, -1.11453e-02, 3.21531e-02, 9.93082e-01, -2.10389e-02, 4.90322e-03, -7.86031e-04 }, // 4/128
+ { -7.72802e-04, 4.27773e-03, -1.39548e-02, 4.04274e-02, 9.90917e-01, -2.60456e-02, 6.09305e-03, -9.78093e-04 }, // 5/128
+ { -9.26747e-04, 5.13372e-03, -1.67710e-02, 4.87921e-02, 9.88580e-01, -3.09503e-02, 7.26755e-03, -1.16820e-03 }, // 6/128
+ { -1.08030e-03, 5.98883e-03, -1.95925e-02, 5.72454e-02, 9.86071e-01, -3.57525e-02, 8.42626e-03, -1.35627e-03 }, // 7/128
+ { -1.23337e-03, 6.84261e-03, -2.24178e-02, 6.57852e-02, 9.83392e-01, -4.04519e-02, 9.56876e-03, -1.54221e-03 }, // 8/128
+ { -1.38589e-03, 7.69462e-03, -2.52457e-02, 7.44095e-02, 9.80543e-01, -4.50483e-02, 1.06946e-02, -1.72594e-03 }, // 9/128
+ { -1.53777e-03, 8.54441e-03, -2.80746e-02, 8.31162e-02, 9.77526e-01, -4.95412e-02, 1.18034e-02, -1.90738e-03 }, // 10/128
+ { -1.68894e-03, 9.39154e-03, -3.09033e-02, 9.19033e-02, 9.74342e-01, -5.39305e-02, 1.28947e-02, -2.08645e-03 }, // 11/128
+ { -1.83931e-03, 1.02356e-02, -3.37303e-02, 1.00769e-01, 9.70992e-01, -5.82159e-02, 1.39681e-02, -2.26307e-03 }, // 12/128
+ { -1.98880e-03, 1.10760e-02, -3.65541e-02, 1.09710e-01, 9.67477e-01, -6.23972e-02, 1.50233e-02, -2.43718e-03 }, // 13/128
+ { -2.13733e-03, 1.19125e-02, -3.93735e-02, 1.18725e-01, 9.63798e-01, -6.64743e-02, 1.60599e-02, -2.60868e-03 }, // 14/128
+ { -2.28483e-03, 1.27445e-02, -4.21869e-02, 1.27812e-01, 9.59958e-01, -7.04471e-02, 1.70776e-02, -2.77751e-03 }, // 15/128
+ { -2.43121e-03, 1.35716e-02, -4.49929e-02, 1.36968e-01, 9.55956e-01, -7.43154e-02, 1.80759e-02, -2.94361e-03 }, // 16/128
+ { -2.57640e-03, 1.43934e-02, -4.77900e-02, 1.46192e-01, 9.51795e-01, -7.80792e-02, 1.90545e-02, -3.10689e-03 }, // 17/128
+ { -2.72032e-03, 1.52095e-02, -5.05770e-02, 1.55480e-01, 9.47477e-01, -8.17385e-02, 2.00132e-02, -3.26730e-03 }, // 18/128
+ { -2.86289e-03, 1.60193e-02, -5.33522e-02, 1.64831e-01, 9.43001e-01, -8.52933e-02, 2.09516e-02, -3.42477e-03 }, // 19/128
+ { -3.00403e-03, 1.68225e-02, -5.61142e-02, 1.74242e-01, 9.38371e-01, -8.87435e-02, 2.18695e-02, -3.57923e-03 }, // 20/128
+ { -3.14367e-03, 1.76185e-02, -5.88617e-02, 1.83711e-01, 9.33586e-01, -9.20893e-02, 2.27664e-02, -3.73062e-03 }, // 21/128
+ { -3.28174e-03, 1.84071e-02, -6.15931e-02, 1.93236e-01, 9.28650e-01, -9.53307e-02, 2.36423e-02, -3.87888e-03 }, // 22/128
+ { -3.41815e-03, 1.91877e-02, -6.43069e-02, 2.02814e-01, 9.23564e-01, -9.84679e-02, 2.44967e-02, -4.02397e-03 }, // 23/128
+ { -3.55283e-03, 1.99599e-02, -6.70018e-02, 2.12443e-01, 9.18329e-01, -1.01501e-01, 2.53295e-02, -4.16581e-03 }, // 24/128
+ { -3.68570e-03, 2.07233e-02, -6.96762e-02, 2.22120e-01, 9.12947e-01, -1.04430e-01, 2.61404e-02, -4.30435e-03 }, // 25/128
+ { -3.81671e-03, 2.14774e-02, -7.23286e-02, 2.31843e-01, 9.07420e-01, -1.07256e-01, 2.69293e-02, -4.43955e-03 }, // 26/128
+ { -3.94576e-03, 2.22218e-02, -7.49577e-02, 2.41609e-01, 9.01749e-01, -1.09978e-01, 2.76957e-02, -4.57135e-03 }, // 27/128
+ { -4.07279e-03, 2.29562e-02, -7.75620e-02, 2.51417e-01, 8.95936e-01, -1.12597e-01, 2.84397e-02, -4.69970e-03 }, // 28/128
+ { -4.19774e-03, 2.36801e-02, -8.01399e-02, 2.61263e-01, 8.89984e-01, -1.15113e-01, 2.91609e-02, -4.82456e-03 }, // 29/128
+ { -4.32052e-03, 2.43930e-02, -8.26900e-02, 2.71144e-01, 8.83893e-01, -1.17526e-01, 2.98593e-02, -4.94589e-03 }, // 30/128
+ { -4.44107e-03, 2.50946e-02, -8.52109e-02, 2.81060e-01, 8.77666e-01, -1.19837e-01, 3.05345e-02, -5.06363e-03 }, // 31/128
+ { -4.55932e-03, 2.57844e-02, -8.77011e-02, 2.91006e-01, 8.71305e-01, -1.22047e-01, 3.11866e-02, -5.17776e-03 }, // 32/128
+ { -4.67520e-03, 2.64621e-02, -9.01591e-02, 3.00980e-01, 8.64812e-01, -1.24154e-01, 3.18153e-02, -5.28823e-03 }, // 33/128
+ { -4.78866e-03, 2.71272e-02, -9.25834e-02, 3.10980e-01, 8.58189e-01, -1.26161e-01, 3.24205e-02, -5.39500e-03 }, // 34/128
+ { -4.89961e-03, 2.77794e-02, -9.49727e-02, 3.21004e-01, 8.51437e-01, -1.28068e-01, 3.30021e-02, -5.49804e-03 }, // 35/128
+ { -5.00800e-03, 2.84182e-02, -9.73254e-02, 3.31048e-01, 8.44559e-01, -1.29874e-01, 3.35600e-02, -5.59731e-03 }, // 36/128
+ { -5.11376e-03, 2.90433e-02, -9.96402e-02, 3.41109e-01, 8.37557e-01, -1.31581e-01, 3.40940e-02, -5.69280e-03 }, // 37/128
+ { -5.21683e-03, 2.96543e-02, -1.01915e-01, 3.51186e-01, 8.30432e-01, -1.33189e-01, 3.46042e-02, -5.78446e-03 }, // 38/128
+ { -5.31716e-03, 3.02507e-02, -1.04150e-01, 3.61276e-01, 8.23188e-01, -1.34699e-01, 3.50903e-02, -5.87227e-03 }, // 39/128
+ { -5.41467e-03, 3.08323e-02, -1.06342e-01, 3.71376e-01, 8.15826e-01, -1.36111e-01, 3.55525e-02, -5.95620e-03 }, // 40/128
+ { -5.50931e-03, 3.13987e-02, -1.08490e-01, 3.81484e-01, 8.08348e-01, -1.37426e-01, 3.59905e-02, -6.03624e-03 }, // 41/128
+ { -5.60103e-03, 3.19495e-02, -1.10593e-01, 3.91596e-01, 8.00757e-01, -1.38644e-01, 3.64044e-02, -6.11236e-03 }, // 42/128
+ { -5.68976e-03, 3.24843e-02, -1.12650e-01, 4.01710e-01, 7.93055e-01, -1.39767e-01, 3.67941e-02, -6.18454e-03 }, // 43/128
+ { -5.77544e-03, 3.30027e-02, -1.14659e-01, 4.11823e-01, 7.85244e-01, -1.40794e-01, 3.71596e-02, -6.25277e-03 }, // 44/128
+ { -5.85804e-03, 3.35046e-02, -1.16618e-01, 4.21934e-01, 7.77327e-01, -1.41727e-01, 3.75010e-02, -6.31703e-03 }, // 45/128
+ { -5.93749e-03, 3.39894e-02, -1.18526e-01, 4.32038e-01, 7.69305e-01, -1.42566e-01, 3.78182e-02, -6.37730e-03 }, // 46/128
+ { -6.01374e-03, 3.44568e-02, -1.20382e-01, 4.42134e-01, 7.61181e-01, -1.43313e-01, 3.81111e-02, -6.43358e-03 }, // 47/128
+ { -6.08674e-03, 3.49066e-02, -1.22185e-01, 4.52218e-01, 7.52958e-01, -1.43968e-01, 3.83800e-02, -6.48585e-03 }, // 48/128
+ { -6.15644e-03, 3.53384e-02, -1.23933e-01, 4.62289e-01, 7.44637e-01, -1.44531e-01, 3.86247e-02, -6.53412e-03 }, // 49/128
+ { -6.22280e-03, 3.57519e-02, -1.25624e-01, 4.72342e-01, 7.36222e-01, -1.45004e-01, 3.88454e-02, -6.57836e-03 }, // 50/128
+ { -6.28577e-03, 3.61468e-02, -1.27258e-01, 4.82377e-01, 7.27714e-01, -1.45387e-01, 3.90420e-02, -6.61859e-03 }, // 51/128
+ { -6.34530e-03, 3.65227e-02, -1.28832e-01, 4.92389e-01, 7.19116e-01, -1.45682e-01, 3.92147e-02, -6.65479e-03 }, // 52/128
+ { -6.40135e-03, 3.68795e-02, -1.30347e-01, 5.02377e-01, 7.10431e-01, -1.45889e-01, 3.93636e-02, -6.68698e-03 }, // 53/128
+ { -6.45388e-03, 3.72167e-02, -1.31800e-01, 5.12337e-01, 7.01661e-01, -1.46009e-01, 3.94886e-02, -6.71514e-03 }, // 54/128
+ { -6.50285e-03, 3.75341e-02, -1.33190e-01, 5.22267e-01, 6.92808e-01, -1.46043e-01, 3.95900e-02, -6.73929e-03 }, // 55/128
+ { -6.54823e-03, 3.78315e-02, -1.34515e-01, 5.32164e-01, 6.83875e-01, -1.45993e-01, 3.96678e-02, -6.75943e-03 }, // 56/128
+ { -6.58996e-03, 3.81085e-02, -1.35775e-01, 5.42025e-01, 6.74865e-01, -1.45859e-01, 3.97222e-02, -6.77557e-03 }, // 57/128
+ { -6.62802e-03, 3.83650e-02, -1.36969e-01, 5.51849e-01, 6.65779e-01, -1.45641e-01, 3.97532e-02, -6.78771e-03 }, // 58/128
+ { -6.66238e-03, 3.86006e-02, -1.38094e-01, 5.61631e-01, 6.56621e-01, -1.45343e-01, 3.97610e-02, -6.79588e-03 }, // 59/128
+ { -6.69300e-03, 3.88151e-02, -1.39150e-01, 5.71370e-01, 6.47394e-01, -1.44963e-01, 3.97458e-02, -6.80007e-03 }, // 60/128
+ { -6.71985e-03, 3.90083e-02, -1.40136e-01, 5.81063e-01, 6.38099e-01, -1.44503e-01, 3.97077e-02, -6.80032e-03 }, // 61/128
+ { -6.74291e-03, 3.91800e-02, -1.41050e-01, 5.90706e-01, 6.28739e-01, -1.43965e-01, 3.96469e-02, -6.79662e-03 }, // 62/128
+ { -6.76214e-03, 3.93299e-02, -1.41891e-01, 6.00298e-01, 6.19318e-01, -1.43350e-01, 3.95635e-02, -6.78902e-03 }, // 63/128
+ { -6.77751e-03, 3.94578e-02, -1.42658e-01, 6.09836e-01, 6.09836e-01, -1.42658e-01, 3.94578e-02, -6.77751e-03 }, // 64/128
+ { -6.78902e-03, 3.95635e-02, -1.43350e-01, 6.19318e-01, 6.00298e-01, -1.41891e-01, 3.93299e-02, -6.76214e-03 }, // 65/128
+ { -6.79662e-03, 3.96469e-02, -1.43965e-01, 6.28739e-01, 5.90706e-01, -1.41050e-01, 3.91800e-02, -6.74291e-03 }, // 66/128
+ { -6.80032e-03, 3.97077e-02, -1.44503e-01, 6.38099e-01, 5.81063e-01, -1.40136e-01, 3.90083e-02, -6.71985e-03 }, // 67/128
+ { -6.80007e-03, 3.97458e-02, -1.44963e-01, 6.47394e-01, 5.71370e-01, -1.39150e-01, 3.88151e-02, -6.69300e-03 }, // 68/128
+ { -6.79588e-03, 3.97610e-02, -1.45343e-01, 6.56621e-01, 5.61631e-01, -1.38094e-01, 3.86006e-02, -6.66238e-03 }, // 69/128
+ { -6.78771e-03, 3.97532e-02, -1.45641e-01, 6.65779e-01, 5.51849e-01, -1.36969e-01, 3.83650e-02, -6.62802e-03 }, // 70/128
+ { -6.77557e-03, 3.97222e-02, -1.45859e-01, 6.74865e-01, 5.42025e-01, -1.35775e-01, 3.81085e-02, -6.58996e-03 }, // 71/128
+ { -6.75943e-03, 3.96678e-02, -1.45993e-01, 6.83875e-01, 5.32164e-01, -1.34515e-01, 3.78315e-02, -6.54823e-03 }, // 72/128
+ { -6.73929e-03, 3.95900e-02, -1.46043e-01, 6.92808e-01, 5.22267e-01, -1.33190e-01, 3.75341e-02, -6.50285e-03 }, // 73/128
+ { -6.71514e-03, 3.94886e-02, -1.46009e-01, 7.01661e-01, 5.12337e-01, -1.31800e-01, 3.72167e-02, -6.45388e-03 }, // 74/128
+ { -6.68698e-03, 3.93636e-02, -1.45889e-01, 7.10431e-01, 5.02377e-01, -1.30347e-01, 3.68795e-02, -6.40135e-03 }, // 75/128
+ { -6.65479e-03, 3.92147e-02, -1.45682e-01, 7.19116e-01, 4.92389e-01, -1.28832e-01, 3.65227e-02, -6.34530e-03 }, // 76/128
+ { -6.61859e-03, 3.90420e-02, -1.45387e-01, 7.27714e-01, 4.82377e-01, -1.27258e-01, 3.61468e-02, -6.28577e-03 }, // 77/128
+ { -6.57836e-03, 3.88454e-02, -1.45004e-01, 7.36222e-01, 4.72342e-01, -1.25624e-01, 3.57519e-02, -6.22280e-03 }, // 78/128
+ { -6.53412e-03, 3.86247e-02, -1.44531e-01, 7.44637e-01, 4.62289e-01, -1.23933e-01, 3.53384e-02, -6.15644e-03 }, // 79/128
+ { -6.48585e-03, 3.83800e-02, -1.43968e-01, 7.52958e-01, 4.52218e-01, -1.22185e-01, 3.49066e-02, -6.08674e-03 }, // 80/128
+ { -6.43358e-03, 3.81111e-02, -1.43313e-01, 7.61181e-01, 4.42134e-01, -1.20382e-01, 3.44568e-02, -6.01374e-03 }, // 81/128
+ { -6.37730e-03, 3.78182e-02, -1.42566e-01, 7.69305e-01, 4.32038e-01, -1.18526e-01, 3.39894e-02, -5.93749e-03 }, // 82/128
+ { -6.31703e-03, 3.75010e-02, -1.41727e-01, 7.77327e-01, 4.21934e-01, -1.16618e-01, 3.35046e-02, -5.85804e-03 }, // 83/128
+ { -6.25277e-03, 3.71596e-02, -1.40794e-01, 7.85244e-01, 4.11823e-01, -1.14659e-01, 3.30027e-02, -5.77544e-03 }, // 84/128
+ { -6.18454e-03, 3.67941e-02, -1.39767e-01, 7.93055e-01, 4.01710e-01, -1.12650e-01, 3.24843e-02, -5.68976e-03 }, // 85/128
+ { -6.11236e-03, 3.64044e-02, -1.38644e-01, 8.00757e-01, 3.91596e-01, -1.10593e-01, 3.19495e-02, -5.60103e-03 }, // 86/128
+ { -6.03624e-03, 3.59905e-02, -1.37426e-01, 8.08348e-01, 3.81484e-01, -1.08490e-01, 3.13987e-02, -5.50931e-03 }, // 87/128
+ { -5.95620e-03, 3.55525e-02, -1.36111e-01, 8.15826e-01, 3.71376e-01, -1.06342e-01, 3.08323e-02, -5.41467e-03 }, // 88/128
+ { -5.87227e-03, 3.50903e-02, -1.34699e-01, 8.23188e-01, 3.61276e-01, -1.04150e-01, 3.02507e-02, -5.31716e-03 }, // 89/128
+ { -5.78446e-03, 3.46042e-02, -1.33189e-01, 8.30432e-01, 3.51186e-01, -1.01915e-01, 2.96543e-02, -5.21683e-03 }, // 90/128
+ { -5.69280e-03, 3.40940e-02, -1.31581e-01, 8.37557e-01, 3.41109e-01, -9.96402e-02, 2.90433e-02, -5.11376e-03 }, // 91/128
+ { -5.59731e-03, 3.35600e-02, -1.29874e-01, 8.44559e-01, 3.31048e-01, -9.73254e-02, 2.84182e-02, -5.00800e-03 }, // 92/128
+ { -5.49804e-03, 3.30021e-02, -1.28068e-01, 8.51437e-01, 3.21004e-01, -9.49727e-02, 2.77794e-02, -4.89961e-03 }, // 93/128
+ { -5.39500e-03, 3.24205e-02, -1.26161e-01, 8.58189e-01, 3.10980e-01, -9.25834e-02, 2.71272e-02, -4.78866e-03 }, // 94/128
+ { -5.28823e-03, 3.18153e-02, -1.24154e-01, 8.64812e-01, 3.00980e-01, -9.01591e-02, 2.64621e-02, -4.67520e-03 }, // 95/128
+ { -5.17776e-03, 3.11866e-02, -1.22047e-01, 8.71305e-01, 2.91006e-01, -8.77011e-02, 2.57844e-02, -4.55932e-03 }, // 96/128
+ { -5.06363e-03, 3.05345e-02, -1.19837e-01, 8.77666e-01, 2.81060e-01, -8.52109e-02, 2.50946e-02, -4.44107e-03 }, // 97/128
+ { -4.94589e-03, 2.98593e-02, -1.17526e-01, 8.83893e-01, 2.71144e-01, -8.26900e-02, 2.43930e-02, -4.32052e-03 }, // 98/128
+ { -4.82456e-03, 2.91609e-02, -1.15113e-01, 8.89984e-01, 2.61263e-01, -8.01399e-02, 2.36801e-02, -4.19774e-03 }, // 99/128
+ { -4.69970e-03, 2.84397e-02, -1.12597e-01, 8.95936e-01, 2.51417e-01, -7.75620e-02, 2.29562e-02, -4.07279e-03 }, // 100/128
+ { -4.57135e-03, 2.76957e-02, -1.09978e-01, 9.01749e-01, 2.41609e-01, -7.49577e-02, 2.22218e-02, -3.94576e-03 }, // 101/128
+ { -4.43955e-03, 2.69293e-02, -1.07256e-01, 9.07420e-01, 2.31843e-01, -7.23286e-02, 2.14774e-02, -3.81671e-03 }, // 102/128
+ { -4.30435e-03, 2.61404e-02, -1.04430e-01, 9.12947e-01, 2.22120e-01, -6.96762e-02, 2.07233e-02, -3.68570e-03 }, // 103/128
+ { -4.16581e-03, 2.53295e-02, -1.01501e-01, 9.18329e-01, 2.12443e-01, -6.70018e-02, 1.99599e-02, -3.55283e-03 }, // 104/128
+ { -4.02397e-03, 2.44967e-02, -9.84679e-02, 9.23564e-01, 2.02814e-01, -6.43069e-02, 1.91877e-02, -3.41815e-03 }, // 105/128
+ { -3.87888e-03, 2.36423e-02, -9.53307e-02, 9.28650e-01, 1.93236e-01, -6.15931e-02, 1.84071e-02, -3.28174e-03 }, // 106/128
+ { -3.73062e-03, 2.27664e-02, -9.20893e-02, 9.33586e-01, 1.83711e-01, -5.88617e-02, 1.76185e-02, -3.14367e-03 }, // 107/128
+ { -3.57923e-03, 2.18695e-02, -8.87435e-02, 9.38371e-01, 1.74242e-01, -5.61142e-02, 1.68225e-02, -3.00403e-03 }, // 108/128
+ { -3.42477e-03, 2.09516e-02, -8.52933e-02, 9.43001e-01, 1.64831e-01, -5.33522e-02, 1.60193e-02, -2.86289e-03 }, // 109/128
+ { -3.26730e-03, 2.00132e-02, -8.17385e-02, 9.47477e-01, 1.55480e-01, -5.05770e-02, 1.52095e-02, -2.72032e-03 }, // 110/128
+ { -3.10689e-03, 1.90545e-02, -7.80792e-02, 9.51795e-01, 1.46192e-01, -4.77900e-02, 1.43934e-02, -2.57640e-03 }, // 111/128
+ { -2.94361e-03, 1.80759e-02, -7.43154e-02, 9.55956e-01, 1.36968e-01, -4.49929e-02, 1.35716e-02, -2.43121e-03 }, // 112/128
+ { -2.77751e-03, 1.70776e-02, -7.04471e-02, 9.59958e-01, 1.27812e-01, -4.21869e-02, 1.27445e-02, -2.28483e-03 }, // 113/128
+ { -2.60868e-03, 1.60599e-02, -6.64743e-02, 9.63798e-01, 1.18725e-01, -3.93735e-02, 1.19125e-02, -2.13733e-03 }, // 114/128
+ { -2.43718e-03, 1.50233e-02, -6.23972e-02, 9.67477e-01, 1.09710e-01, -3.65541e-02, 1.10760e-02, -1.98880e-03 }, // 115/128
+ { -2.26307e-03, 1.39681e-02, -5.82159e-02, 9.70992e-01, 1.00769e-01, -3.37303e-02, 1.02356e-02, -1.83931e-03 }, // 116/128
+ { -2.08645e-03, 1.28947e-02, -5.39305e-02, 9.74342e-01, 9.19033e-02, -3.09033e-02, 9.39154e-03, -1.68894e-03 }, // 117/128
+ { -1.90738e-03, 1.18034e-02, -4.95412e-02, 9.77526e-01, 8.31162e-02, -2.80746e-02, 8.54441e-03, -1.53777e-03 }, // 118/128
+ { -1.72594e-03, 1.06946e-02, -4.50483e-02, 9.80543e-01, 7.44095e-02, -2.52457e-02, 7.69462e-03, -1.38589e-03 }, // 119/128
+ { -1.54221e-03, 9.56876e-03, -4.04519e-02, 9.83392e-01, 6.57852e-02, -2.24178e-02, 6.84261e-03, -1.23337e-03 }, // 120/128
+ { -1.35627e-03, 8.42626e-03, -3.57525e-02, 9.86071e-01, 5.72454e-02, -1.95925e-02, 5.98883e-03, -1.08030e-03 }, // 121/128
+ { -1.16820e-03, 7.26755e-03, -3.09503e-02, 9.88580e-01, 4.87921e-02, -1.67710e-02, 5.13372e-03, -9.26747e-04 }, // 122/128
+ { -9.78093e-04, 6.09305e-03, -2.60456e-02, 9.90917e-01, 4.04274e-02, -1.39548e-02, 4.27773e-03, -7.72802e-04 }, // 123/128
+ { -7.86031e-04, 4.90322e-03, -2.10389e-02, 9.93082e-01, 3.21531e-02, -1.11453e-02, 3.42130e-03, -6.18544e-04 }, // 124/128
+ { -5.92100e-04, 3.69852e-03, -1.59305e-02, 9.95074e-01, 2.39714e-02, -8.34364e-03, 2.56486e-03, -4.64053e-04 }, // 125/128
+ { -3.96391e-04, 2.47942e-03, -1.07209e-02, 9.96891e-01, 1.58840e-02, -5.55134e-03, 1.70888e-03, -3.09412e-04 }, // 126/128
+ { -1.98993e-04, 1.24642e-03, -5.41054e-03, 9.98534e-01, 7.89295e-03, -2.76968e-03, 8.53777e-04, -1.54700e-04 }, // 127/128
+ { 0.00000e+00, 0.00000e+00, 0.00000e+00, 1.00000e+00, 0.00000e+00, 0.00000e+00, 0.00000e+00, 0.00000e+00 }, // 128/128
+};
diff --git a/gr-filter/include/filter/mmse_fir_interpolator_cc.h b/gr-filter/include/filter/mmse_fir_interpolator_cc.h
new file mode 100644
index 000000000..0436b4a0f
--- /dev/null
+++ b/gr-filter/include/filter/mmse_fir_interpolator_cc.h
@@ -0,0 +1,79 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002,2007,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 _GRI_MMSE_FIR_INTERPOLATOR_CC_H_
+#define _GRI_MMSE_FIR_INTERPOLATOR_CC_H_
+
+#include <filter/api.h>
+#include <filter/fir_filter.h>
+#include <gr_complex.h>
+#include <vector>
+
+namespace gr {
+ namespace filter {
+
+ /*!
+ * \brief Compute intermediate samples between signal samples x(k*Ts)
+ * \ingroup filter_primitive
+ *
+ * This implements a Mininum Mean Squared Error interpolator with
+ * 8 taps. It is suitable for signals where the bandwidth of
+ * interest B = 1/(4*Ts) Where Ts is the time between samples.
+ *
+ * Although mu, the fractional delay, is specified as a float, it
+ * is actually quantized. 0.0 <= mu <= 1.0. That is, mu is
+ * quantized in the interpolate method to 32nd's of a sample.
+ *
+ * For more information, in the GNU Radio source code, see:
+ * \li gnuradio-core/src/gen_interpolator_taps/README
+ * \li gnuradio-core/src/gen_interpolator_taps/praxis.txt
+ */
+
+ class FILTER_API mmse_fir_interpolator_cc
+ {
+ public:
+ mmse_fir_interpolator_cc();
+ ~mmse_fir_interpolator_cc();
+
+ unsigned ntaps() const;
+ unsigned nsteps() const;
+
+ /*!
+ * \brief compute a single interpolated output value.
+ *
+ * \p input must have ntaps() valid entries and be 8-byte aligned.
+ * input[0] .. input[ntaps() - 1] are referenced to compute the output value.
+ * \throws std::invalid_argument if input is not 8-byte aligned.
+ *
+ * \p mu must be in the range [0, 1] and specifies the fractional delay.
+ *
+ * \returns the interpolated input value.
+ */
+ gr_complex interpolate(const gr_complex input[], float mu) const;
+
+ protected:
+ std::vector<kernel::fir_filter_ccf *> filters;
+ };
+
+ } /* namespace filter */
+} /* namespace gr */
+
+#endif /* _MMSE_FIR_INTERPOLATOR_CC_H_ */
diff --git a/gr-filter/include/filter/mmse_fir_interpolator_ff.h b/gr-filter/include/filter/mmse_fir_interpolator_ff.h
new file mode 100644
index 000000000..4353aa94f
--- /dev/null
+++ b/gr-filter/include/filter/mmse_fir_interpolator_ff.h
@@ -0,0 +1,76 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002,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 _MMSE_FIR_INTERPOLATOR_FF_H_
+#define _MMSE_FIR_INTERPOLATOR_FF_H_
+
+#include <filter/api.h>
+#include <filter/fir_filter.h>
+#include <vector>
+
+namespace gr {
+ namespace filter {
+
+ /*!
+ * \brief Compute intermediate samples between signal samples x(k*Ts)
+ * \ingroup filter_primitive
+ *
+ * This implements a Mininum Mean Squared Error interpolator with
+ * 8 taps. It is suitable for signals where the bandwidth of
+ * interest B = 1/(4*Ts) Where Ts is the time between samples.
+ *
+ * Although mu, the fractional delay, is specified as a float, it
+ * is actually quantized. 0.0 <= mu <= 1.0. That is, mu is
+ * quantized in the interpolate method to 32nd's of a sample.
+ *
+ * For more information, in the GNU Radio source code, see:
+ * \li gnuradio-core/src/gen_interpolator_taps/README
+ * \li gnuradio-core/src/gen_interpolator_taps/praxis.txt
+ */
+ class FILTER_API mmse_fir_interpolator_ff
+ {
+ public:
+ mmse_fir_interpolator_ff();
+ ~mmse_fir_interpolator_ff();
+
+ unsigned ntaps() const;
+ unsigned nsteps() const;
+
+ /*!
+ * \brief compute a single interpolated output value.
+ * \p input must have ntaps() valid entries.
+ * input[0] .. input[ntaps() - 1] are referenced to compute the output value.
+ *
+ * \p mu must be in the range [0, 1] and specifies the fractional delay.
+ *
+ * \returns the interpolated input value.
+ */
+ float interpolate(const float input[], float mu) const;
+
+ protected:
+ std::vector<kernel::fir_filter_fff*> filters;
+ };
+
+ } /* namespace filter */
+} /* namespace gr */
+
+#endif /* _MMSE_FIR_INTERPOLATOR_FF_H_ */
diff --git a/gr-filter/include/filter/pfb_arb_resampler_ccf.h b/gr-filter/include/filter/pfb_arb_resampler_ccf.h
new file mode 100644
index 000000000..a154e055a
--- /dev/null
+++ b/gr-filter/include/filter/pfb_arb_resampler_ccf.h
@@ -0,0 +1,151 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2009,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.
+ */
+
+
+#ifndef INCLUDED_PFB_ARB_RESAMPLER_CCF_H
+#define INCLUDED_PFB_ARB_RESAMPLER_CCF_H
+
+#include <filter/api.h>
+#include <gr_block.h>
+
+namespace gr {
+ namespace filter {
+
+ /*!
+ * \class pfb_arb_resampler_ccf
+ *
+ * \brief Polyphase filterbank arbitrary resampler with
+ * gr_complex input, gr_complex output and float taps
+ *
+ * \ingroup filter_blk
+ * \ingroup pfb_blk
+ *
+ * This block takes in a signal stream and performs arbitrary
+ * resampling. The resampling rate can be any real number
+ * <EM>r</EM>. The resampling is done by constructing <EM>N</EM>
+ * filters where <EM>N</EM> is the interpolation rate. We then
+ * calculate <EM>D</EM> where <EM>D = floor(N/r)</EM>.
+ *
+ * Using <EM>N</EM> and <EM>D</EM>, we can perform rational
+ * resampling where <EM>N/D</EM> is a rational number close to the
+ * input rate <EM>r</EM> where we have <EM>N</EM> filters and we
+ * cycle through them as a polyphase filterbank with a stride of
+ * <EM>D</EM> so that <EM>i+1 = (i + D) % N</EM>.
+ *
+ * To get the arbitrary rate, we want to interpolate between two
+ * points. For each value out, we take an output from the current
+ * filter, <EM>i</EM>, and the next filter <EM>i+1</EM> and then
+ * linearly interpolate between the two based on the real
+ * resampling rate we want.
+ *
+ * The linear interpolation only provides us with an approximation
+ * to the real sampling rate specified. The error is a
+ * quantization error between the two filters we used as our
+ * interpolation points. To this end, the number of filters,
+ * <EM>N</EM>, used determines the quantization error; the larger
+ * <EM>N</EM>, the smaller the noise. You can design for a
+ * specified noise floor by setting the filter size (parameters
+ * <EM>filter_size</EM>). The size defaults to 32 filters, which
+ * is about as good as most implementations need.
+ *
+ * The trick with designing this filter is in how to specify the
+ * taps of the prototype filter. Like the PFB interpolator, the
+ * taps are specified using the interpolated filter rate. In this
+ * case, that rate is the input sample rate multiplied by the
+ * number of filters in the filterbank, which is also the
+ * interpolation rate. All other values should be relative to this
+ * rate.
+ *
+ * For example, for a 32-filter arbitrary resampler and using the
+ * GNU Radio's firdes utility to build the filter, we build a
+ * low-pass filter with a sampling rate of <EM>fs</EM>, a 3-dB
+ * bandwidth of <EM>BW</EM> and a transition bandwidth of
+ * <EM>TB</EM>. We can also specify the out-of-band attenuation to
+ * use, <EM>ATT</EM>, and the filter window function (a
+ * Blackman-harris window in this case). The first input is the
+ * gain of the filter, which we specify here as the interpolation
+ * rate (<EM>32</EM>).
+ *
+ * <B><EM>self._taps = filter.firdes.low_pass_2(32, 32*fs, BW, TB,
+ * attenuation_dB=ATT, window=filter.firdes.WIN_BLACKMAN_hARRIS)</EM></B>
+ *
+ * The theory behind this block can be found in Chapter 7.5 of
+ * the following book.
+ *
+ * <B><EM>f. harris, "Multirate Signal Processing for Communication
+ * Systems", Upper Saddle River, NJ: Prentice Hall, Inc. 2004.</EM></B>
+ */
+
+ class FILTER_API pfb_arb_resampler_ccf : virtual public gr_block
+ {
+ public:
+ // gr::filter::pfb_arb_resampler_ccf::sptr
+ typedef boost::shared_ptr<pfb_arb_resampler_ccf> sptr;
+
+ /*!
+ * Build the polyphase filterbank arbitray resampler.
+ * \param rate (float) Specifies the resampling rate to use
+ * \param taps (vector/list of floats) The prototype filter to populate the filterbank. The taps
+ * should be generated at the filter_size sampling rate.
+ * \param filter_size (unsigned int) The number of filters in the filter bank. This is directly
+ * related to quantization noise introduced during the resampling.
+ * Defaults to 32 filters.
+ */
+ static sptr make(float rate,
+ const std::vector<float> &taps,
+ unsigned int filter_size=32);
+ /*!
+ * Resets the filterbank's filter taps with the new prototype filter
+ * \param taps (vector/list of floats) The prototype filter to populate the filterbank.
+ */
+ virtual void set_taps(const std::vector<float> &taps) = 0;
+
+ /*!
+ * Return a vector<vector<>> of the filterbank taps
+ */
+ virtual std::vector<std::vector<float> > taps() const = 0;
+
+ /*!
+ * Print all of the filterbank taps to screen.
+ */
+ virtual void print_taps() = 0;
+
+ /*!
+ * Sets the resampling rate of the block.
+ */
+ virtual void set_rate (float rate) = 0;
+
+ /*!
+ * Sets the current phase offset in radians (0 to 2pi).
+ */
+ virtual void set_phase(float ph) = 0;
+
+ /*!
+ * Gets the current phase of the resampler in radians (2 to 2pi).
+ */
+ virtual float phase() const = 0;
+ };
+
+ } /* namespace filter */
+} /* namespace gr */
+
+#endif /* INCLUDED_PFB_ARB_RESAMPLER_CCF_H */
diff --git a/gr-filter/include/filter/pfb_arb_resampler_fff.h b/gr-filter/include/filter/pfb_arb_resampler_fff.h
new file mode 100644
index 000000000..38dcc7132
--- /dev/null
+++ b/gr-filter/include/filter/pfb_arb_resampler_fff.h
@@ -0,0 +1,152 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2009-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 INCLUDED_PFB_ARB_RESAMPLER_FFF_H
+#define INCLUDED_PFB_ARB_RESAMPLER_FFF_H
+
+#include <filter/api.h>
+#include <gr_block.h>
+
+namespace gr {
+ namespace filter {
+
+ /*!
+ * \class pfb_arb_resampler_fff
+ *
+ * \brief Polyphase filterbank arbitrary resampler with
+ * float input, float output and float taps
+ *
+ * \ingroup filter_blk
+ * \ingroup pfb_blk
+ *
+ * This block takes in a signal stream and performs arbitrary
+ * resampling. The resampling rate can be any real number
+ * <EM>r</EM>. The resampling is done by constructing <EM>N</EM>
+ * filters where <EM>N</EM> is the interpolation rate. We then
+ * calculate <EM>D</EM> where <EM>D = floor(N/r)</EM>.
+ *
+ * Using <EM>N</EM> and <EM>D</EM>, we can perform rational
+ * resampling where <EM>N/D</EM> is a rational number close to the
+ * input rate <EM>r</EM> where we have <EM>N</EM> filters and we
+ * cycle through them as a polyphase filterbank with a stride of
+ * <EM>D</EM> so that <EM>i+1 = (i + D) % N</EM>.
+ *
+ * To get the arbitrary rate, we want to interpolate between two
+ * points. For each value out, we take an output from the current
+ * filter, <EM>i</EM>, and the next filter <EM>i+1</EM> and then
+ * linearly interpolate between the two based on the real
+ * resampling rate we want.
+ *
+ * The linear interpolation only provides us with an approximation
+ * to the real sampling rate specified. The error is a
+ * quantization error between the two filters we used as our
+ * interpolation points. To this end, the number of filters,
+ * <EM>N</EM>, used determines the quantization error; the larger
+ * <EM>N</EM>, the smaller the noise. You can design for a
+ * specified noise floor by setting the filter size (parameters
+ * <EM>filter_size</EM>). The size defaults to 32 filters, which
+ * is about as good as most implementations need.
+ *
+ * The trick with designing this filter is in how to specify the
+ * taps of the prototype filter. Like the PFB interpolator, the
+ * taps are specified using the interpolated filter rate. In this
+ * case, that rate is the input sample rate multiplied by the
+ * number of filters in the filterbank, which is also the
+ * interpolation rate. All other values should be relative to this
+ * rate.
+ *
+ * For example, for a 32-filter arbitrary resampler and using the
+ * GNU Radio's firdes utility to build the filter, we build a
+ * low-pass filter with a sampling rate of <EM>fs</EM>, a 3-dB
+ * bandwidth of <EM>BW</EM> and a transition bandwidth of
+ * <EM>TB</EM>. We can also specify the out-of-band attenuation to
+ * use, <EM>ATT</EM>, and the filter window function (a
+ * Blackman-harris window in this case). The first input is the
+ * gain of the filter, which we specify here as the interpolation
+ * rate (<EM>32</EM>).
+ *
+ * <B><EM>self._taps = filter.firdes.low_pass_2(32, 32*fs, BW, TB,
+ * attenuation_dB=ATT, window=filter.firdes.WIN_BLACKMAN_hARRIS)</EM></B>
+ *
+ * The theory behind this block can be found in Chapter 7.5 of the
+ * following book.
+ *
+ * <B><EM>f. harris, "Multirate Signal Processing for Communication
+ * Systems", Upper Saddle River, NJ: Prentice Hall, Inc. 2004.</EM></B>
+ */
+
+ class FILTER_API pfb_arb_resampler_fff : virtual public gr_block
+ {
+ public:
+ // gr::filter::pfb_arb_resampler_fff::sptr
+ typedef boost::shared_ptr<pfb_arb_resampler_fff> sptr;
+
+ /*!
+ * Build the polyphase filterbank arbitray resampler.
+ * \param rate (float) Specifies the resampling rate to use
+ * \param taps (vector/list of floats) The prototype filter to populate the filterbank. The taps
+ * should be generated at the filter_size sampling rate.
+ * \param filter_size (unsigned int) The number of filters in the filter bank. This is directly
+ * related to quantization noise introduced during the resampling.
+ * Defaults to 32 filters.
+ */
+ static sptr make(float rate,
+ const std::vector<float> &taps,
+ unsigned int filter_size=32);
+
+ /*!
+ * Resets the filterbank's filter taps with the new prototype filter
+ * \param taps (vector/list of floats) The prototype filter to populate the filterbank.
+ */
+ virtual void set_taps(const std::vector<float> &taps) = 0;
+
+ /*!
+ * Return a vector<vector<>> of the filterbank taps
+ */
+ virtual std::vector<std::vector<float> > taps() const = 0;
+
+ /*!
+ * Print all of the filterbank taps to screen.
+ */
+ virtual void print_taps() = 0;
+
+ /*!
+ * Sets the resampling rate of the block.
+ */
+ virtual void set_rate (float rate) = 0;
+
+ /*!
+ * Sets the current phase offset in radians (0 to 2pi).
+ */
+ virtual void set_phase(float ph) = 0;
+
+ /*!
+ * Gets the current phase of the resampler in radians (2 to 2pi).
+ */
+ virtual float phase() const = 0;
+ };
+
+ } /* namespace filter */
+} /* namespace gr */
+
+#endif /* INCLUDED_PFB_ARB_RESAMPLER_FFF_H */
diff --git a/gr-filter/include/filter/pfb_channelizer_ccf.h b/gr-filter/include/filter/pfb_channelizer_ccf.h
new file mode 100644
index 000000000..2ff83b5e7
--- /dev/null
+++ b/gr-filter/include/filter/pfb_channelizer_ccf.h
@@ -0,0 +1,204 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2009,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.
+ */
+
+
+#ifndef INCLUDED_FILTER_PFB_CHANNELIZER_CCF_H
+#define INCLUDED_FILTER_PFB_CHANNELIZER_CCF_H
+
+#include <filter/api.h>
+#include <gr_block.h>
+
+namespace gr {
+ namespace filter {
+
+ /*!
+ * \class pfb_channelizer_ccf
+ *
+ * \brief Polyphase filterbank channelizer with
+ * gr_complex input, gr_complex output and float taps
+ *
+ * \ingroup filter_blk
+ * \ingroup pfb_blk
+ *
+ * This block takes in complex inputs and channelizes it to <EM>M</EM>
+ * channels of equal bandwidth. Each of the resulting channels is
+ * decimated to the new rate that is the input sampling rate
+ * <EM>fs</EM> divided by the number of channels, <EM>M</EM>.
+ *
+ * The PFB channelizer code takes the taps generated above and builds
+ * a set of filters. The set contains <EM>M</EM> number of filters
+ * and each filter contains ceil(taps.size()/decim) number of taps.
+ * Each tap from the filter prototype is sequentially inserted into
+ * the next filter. When all of the input taps are used, the remaining
+ * filters in the filterbank are filled out with 0's to make sure each
+ * filter has the same number of taps.
+ *
+ * Each filter operates using the gr_fir filter classs of GNU Radio,
+ * which takes the input stream at <EM>i</EM> and performs the inner
+ * product calculation to <EM>i+(n-1)</EM> where <EM>n</EM> is the
+ * number of filter taps. To efficiently handle this in the GNU Radio
+ * structure, each filter input must come from its own input
+ * stream. So the channelizer must be provided with <EM>M</EM> streams
+ * where the input stream has been deinterleaved. This is most easily
+ * done using the gr_stream_to_streams block.
+ *
+ * The output is then produced as a vector, where index <EM>i</EM> in
+ * the vector is the next sample from the <EM>i</EM>th channel. This
+ * is most easily handled by sending the output to a
+ * gr_vector_to_streams block to handle the conversion and passing
+ * <EM>M</EM> streams out.
+ *
+ * The input and output formatting is done using a hier_block2 called
+ * pfb_channelizer_ccf. This can take in a single stream and outputs
+ * <EM>M</EM> streams based on the behavior described above.
+ *
+ * The filter's taps should be based on the input sampling rate.
+ *
+ * For example, using the GNU Radio's firdes utility to building
+ * filters, we build a low-pass filter with a sampling rate of
+ * <EM>fs</EM>, a 3-dB bandwidth of <EM>BW</EM> and a transition
+ * bandwidth of <EM>TB</EM>. We can also specify the out-of-band
+ * attenuation to use, <EM>ATT</EM>, and the filter window
+ * function (a Blackman-harris window in this case). The first input
+ * is the gain of the filter, which we specify here as unity.
+ *
+ * <B><EM>self._taps = filter.firdes.low_pass_2(1, fs, BW, TB,
+ * attenuation_dB=ATT, window=filter.firdes.WIN_BLACKMAN_hARRIS)</EM></B>
+ *
+ * The filter output can also be overs ampled. The over sampling rate
+ * is the ratio of the the actual output sampling rate to the normal
+ * output sampling rate. It must be rationally related to the number
+ * of channels as N/i for i in [1,N], which gives an outputsample rate
+ * of [fs/N, fs] where fs is the input sample rate and N is the number
+ * of channels.
+ *
+ * For example, for 6 channels with fs = 6000 Hz, the normal rate is
+ * 6000/6 = 1000 Hz. Allowable oversampling rates are 6/6, 6/5, 6/4,
+ * 6/3, 6/2, and 6/1 where the output sample rate of a 6/1 oversample
+ * ratio is 6000 Hz, or 6 times the normal 1000 Hz. A rate of 6/5 = 1.2,
+ * so the output rate would be 1200 Hz.
+ *
+ * The theory behind this block can be found in Chapter 6 of
+ * the following book.
+ *
+ * <B><EM>f. harris, "Multirate Signal Processing for Communication
+ * Systems," Upper Saddle River, NJ: Prentice Hall, Inc. 2004.</EM></B>
+ *
+ */
+
+ class FILTER_API pfb_channelizer_ccf : virtual public gr_block
+ {
+ public:
+ // gr::filter::pfb_channelizer_ccf::sptr
+ typedef boost::shared_ptr<pfb_channelizer_ccf> sptr;
+
+ /*!
+ * Build the polyphase filterbank decimator.
+ * \param numchans (unsigned integer) Specifies the number of
+ * channels <EM>M</EM>
+ * \param taps (vector/list of floats) The prototype filter to
+ * populate the filterbank.
+ * \param oversample_rate (float) The over sampling rate is the
+ * ratio of the the actual output
+ * sampling rate to the normal
+ * output sampling rate. It must
+ * be rationally related to the
+ * number of channels as N/i for
+ * i in [1,N], which gives an
+ * outputsample rate of [fs/N,
+ * fs] where fs is the input
+ * sample rate and N is the
+ * number of channels.
+ *
+ * For example, for 6 channels
+ * with fs = 6000 Hz, the normal
+ * rateis 6000/6 = 1000
+ * Hz. Allowable oversampling
+ * rates are 6/6, 6/5, 6/4, 6/3,
+ * 6/2, and 6/1 where the output
+ * sample rate of a 6/1
+ * oversample ratio is 6000 Hz,
+ * or 6 times the normal 1000 Hz.
+ */
+ static sptr make(unsigned int numchans,
+ const std::vector<float> &taps,
+ float oversample_rate);
+
+ /*!
+ * Resets the filterbank's filter taps with the new prototype filter
+ * \param taps (vector/list of floats) The prototype filter to populate the filterbank.
+ */
+ virtual void set_taps(const std::vector<float> &taps) = 0;
+
+ /*!
+ * Print all of the filterbank taps to screen.
+ */
+ virtual void print_taps() = 0;
+
+ /*!
+ * Return a vector<vector<>> of the filterbank taps
+ */
+ virtual std::vector<std::vector<float> > taps() const = 0;
+
+ /*!
+ * Set the channel map. Channels are numbers as:
+ *
+ * N/2+1 | ... | N-1 | 0 | 1 | 2 | ... | N/2
+ * <------------------- 0 -------------------->
+ * freq
+ *
+ * So output stream 0 comes from channel 0, etc. Setting a new
+ * channel map allows the user to specify which channel in frequency
+ * he/she wants to got to which output stream.
+ *
+ * The map should have the same number of elements as the number
+ * of output connections from the block. The minimum value of
+ * the map is 0 (for the 0th channel) and the maximum number is
+ * N-1 where N is the number of channels.
+ *
+ * We specify M as the number of output connections made where M
+ * <= N, so only M out of N channels are driven to an output
+ * stream. The number of items in the channel map should be at
+ * least M long. If there are more channels specified, any value
+ * in the map over M-1 will be ignored. If the size of the map
+ * is less than M the behavior is unknown (we don't wish to
+ * check every entry into the work function).
+ *
+ * This means that if the channelizer is splitting the signal up
+ * into N channels but only M channels are specified in the map
+ * (where M <= N), then M output streams must be connected and
+ * the map and the channel numbers used must be less than
+ * N-1. Output channel number can be reused, too. By default,
+ * the map is [0...M-1] with M = N.
+ */
+ virtual void set_channel_map(const std::vector<int> &map) = 0;
+
+ /*!
+ * Gets the current channel map.
+ */
+ virtual std::vector<int> channel_map() const = 0;
+ };
+
+ } /* namespace filter */
+} /* namespace gr */
+
+#endif /* INCLUDED_FILTER_PFB_CHANNELIZER_CCF_H */
diff --git a/gr-filter/include/filter/pfb_decimator_ccf.h b/gr-filter/include/filter/pfb_decimator_ccf.h
new file mode 100644
index 000000000..bf9d0d950
--- /dev/null
+++ b/gr-filter/include/filter/pfb_decimator_ccf.h
@@ -0,0 +1,131 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2009,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 INCLUDED_PFB_DECIMATOR_CCF_H
+#define INCLUDED_PFB_DECIMATOR_CCF_H
+
+#include <filter/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace filter {
+
+ /*!
+ * \class pfb_decimator_ccf
+ * \brief Polyphase filterbank bandpass decimator with gr_complex
+ * input, gr_complex output and float taps
+ *
+ * \ingroup filter_blk
+ * \ingroup pfb_blk
+ *
+ * This block takes in a signal stream and performs interger down-
+ * sampling (decimation) with a polyphase filterbank. The first
+ * input is the integer specifying how much to decimate by. The
+ * second input is a vector (Python list) of floating-point taps
+ * of the prototype filter. The third input specifies the channel
+ * to extract. By default, the zeroth channel is used, which is
+ * the baseband channel (first Nyquist zone).
+ *
+ * The <EM>channel</EM> parameter specifies which channel to use
+ * since this class is capable of bandpass decimation. Given a
+ * complex input stream at a sampling rate of <EM>fs</EM> and a
+ * decimation rate of <EM>decim</EM>, the input frequency domain
+ * is split into <EM>decim</EM> channels that represent the
+ * Nyquist zones. Using the polyphase filterbank, we can select
+ * any one of these channels to decimate.
+ *
+ * The output signal will be the basebanded and decimated signal
+ * from that channel. This concept is very similar to the PFB
+ * channelizer (see #gr_pfb_channelizer_ccf) where only a single
+ * channel is extracted at a time.
+ *
+ * The filter's taps should be based on the sampling rate before
+ * decimation.
+ *
+ * For example, using the GNU Radio's firdes utility to building
+ * filters, we build a low-pass filter with a sampling rate of
+ * <EM>fs</EM>, a 3-dB bandwidth of <EM>BW</EM> and a transition
+ * bandwidth of <EM>TB</EM>. We can also specify the out-of-band
+ * attenuation to use, <EM>ATT</EM>, and the filter window
+ * function (a Blackman-harris window in this case). The first
+ * input is the gain of the filter, which we specify here as
+ * unity.
+ *
+ * <B><EM>self._taps = filter.firdes.low_pass_2(1, fs, BW, TB,
+ * attenuation_dB=ATT, window=filter.firdes.WIN_BLACKMAN_hARRIS)</EM></B>
+ *
+ * The PFB decimator code takes the taps generated above and
+ * builds a set of filters. The set contains <EM>decim</EM> number
+ * of filters and each filter contains ceil(taps.size()/decim)
+ * number of taps. Each tap from the filter prototype is
+ * sequentially inserted into the next filter. When all of the
+ * input taps are used, the remaining filters in the filterbank
+ * are filled out with 0's to make sure each filter has the same
+ * number of taps.
+ *
+ * The theory behind this block can be found in Chapter 6 of
+ * the following book.
+ *
+ * <B><EM>f. harris, "Multirate Signal Processing for Communication
+ * Systems," Upper Saddle River, NJ: Prentice Hall, Inc. 2004.</EM></B>
+ */
+
+ class FILTER_API pfb_decimator_ccf : virtual public gr_sync_block
+ {
+ public:
+ // gr::filter::pfb_decimator_ccf::sptr
+ typedef boost::shared_ptr<pfb_decimator_ccf> sptr;
+
+ /*!
+ * Build the polyphase filterbank decimator.
+ * \param decim (unsigned integer) Specifies the decimation rate to use
+ * \param taps (vector/list of floats) The prototype filter to populate the filterbank.
+ * \param channel (unsigned integer) Selects the channel to return [default=0].
+ */
+ static sptr make(unsigned int decim,
+ const std::vector<float> &taps,
+ unsigned int channel);
+
+ /*!
+ * Resets the filterbank's filter taps with the new prototype filter
+ * \param taps (vector/list of floats) The prototype filter to populate the filterbank.
+ */
+ virtual void set_taps(const std::vector<float> &taps) = 0;
+
+ /*!
+ * Return a vector<vector<>> of the filterbank taps
+ */
+ virtual std::vector<std::vector<float> > taps() const = 0;
+
+ /*!
+ * Print all of the filterbank taps to screen.
+ */
+ virtual void print_taps() = 0;
+
+ //virtual void set_channel(unsigned int channel) = 0;
+ };
+
+ } /* namespace filter */
+} /* namespace gr */
+
+#endif /* INCLUDED_PFB_DECIMATOR_CCF_H */
diff --git a/gr-filter/include/filter/pfb_interpolator_ccf.h b/gr-filter/include/filter/pfb_interpolator_ccf.h
new file mode 100644
index 000000000..df28ab64d
--- /dev/null
+++ b/gr-filter/include/filter/pfb_interpolator_ccf.h
@@ -0,0 +1,118 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2009,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 INCLUDED_PFB_INTERPOLATOR_CCF_H
+#define INCLUDED_PFB_INTERPOLATOR_CCF_H
+
+#include <filter/api.h>
+#include <gr_sync_interpolator.h>
+
+namespace gr {
+ namespace filter {
+
+ /*!
+ * \class gr_pfb_interpolator_ccf
+ *
+ * \brief Polyphase filterbank interpolator with gr_complex input,
+ * gr_complex output and float taps
+ *
+ * \ingroup filter_blk
+ * \ingroup pfb_blk
+ *
+ * This block takes in a signal stream and performs interger up-
+ * sampling (interpolation) with a polyphase filterbank. The first
+ * input is the integer specifying how much to interpolate by. The
+ * second input is a vector (Python list) of floating-point taps
+ * of the prototype filter.
+ *
+ * The filter's taps should be based on the interpolation rate
+ * specified. That is, the bandwidth specified is relative to the
+ * bandwidth after interpolation.
+ *
+ * For example, using the GNU Radio's firdes utility to building
+ * filters, we build a low-pass filter with a sampling rate of
+ * <EM>fs</EM>, a 3-dB bandwidth of <EM>BW</EM> and a transition
+ * bandwidth of <EM>TB</EM>. We can also specify the out-of-band
+ * attenuation to use, ATT, and the filter window function (a
+ * Blackman-harris window in this case). The first input is the
+ * gain, which is also specified as the interpolation rate so that
+ * the output levels are the same as the input (this creates an
+ * overall increase in power).
+ *
+ * <B><EM>self._taps = filter.firdes.low_pass_2(interp, interp*fs, BW, TB,
+ * attenuation_dB=ATT, window=filter.firdes.WIN_BLACKMAN_hARRIS)</EM></B>
+ *
+ * The PFB interpolator code takes the taps generated above and
+ * builds a set of filters. The set contains <EM>interp</EM>
+ * number of filters and each filter contains
+ * ceil(taps.size()/interp) number of taps. Each tap from the
+ * filter prototype is sequentially inserted into the next
+ * filter. When all of the input taps are used, the remaining
+ * filters in the filterbank are filled out with 0's to make sure
+ * each filter has the same number of taps.
+ *
+ * The theory behind this block can be found in Chapter 7.1 of the
+ * following book.
+ *
+ * <B><EM>f. harris, "Multirate Signal Processing for Communication
+ * Systems</EM>," Upper Saddle River, NJ: Prentice Hall,
+ * Inc. 2004.</EM></B>
+ */
+
+ class FILTER_API pfb_interpolator_ccf : virtual public gr_sync_interpolator
+ {
+ public:
+ // gr::filter::pfb_interpolator_ccf::sptr
+ typedef boost::shared_ptr<pfb_interpolator_ccf> sptr;
+
+ /*!
+ * Build the polyphase filterbank interpolator.
+ * \param interp (unsigned integer) Specifies the interpolation rate to use
+ * \param taps (vector/list of floats) The prototype filter to populate the filterbank. The taps
+ * should be generated at the interpolated sampling rate.
+ */
+ static sptr make(unsigned int interp,
+ const std::vector<float> &taps);
+
+ /*!
+ * Resets the filterbank's filter taps with the new prototype filter
+ * \param taps (vector/list of floats) The prototype filter to populate the filterbank.
+ * The taps should be generated at the interpolated sampling rate.
+ */
+ virtual void set_taps(const std::vector<float> &taps) = 0;
+
+ /*!
+ * Return a vector<vector<>> of the filterbank taps
+ */
+ virtual std::vector<std::vector<float> > taps() const = 0;
+
+ /*!
+ * Print all of the filterbank taps to screen.
+ */
+ virtual void print_taps() = 0;
+ };
+
+ } /* namespace filter */
+} /* namespace gr */
+
+#endif /* INCLUDED_FILTER_PFB_INTERPOLATOR_CCF_H */
diff --git a/gr-filter/include/filter/pfb_synthesizer_ccf.h b/gr-filter/include/filter/pfb_synthesizer_ccf.h
new file mode 100644
index 000000000..faa16990c
--- /dev/null
+++ b/gr-filter/include/filter/pfb_synthesizer_ccf.h
@@ -0,0 +1,107 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+
+#ifndef INCLUDED_PFB_SYNTHESIZER_CCF_H
+#define INCLUDED_PFB_SYNTHESIZER_CCF_H
+
+#include <filter/api.h>
+#include <gr_sync_interpolator.h>
+
+namespace gr {
+ namespace filter {
+
+ /*!
+ * \class pfb_synthesizer_ccf
+ *
+ * \brief Polyphase synthesis filterbank with
+ * gr_complex input, gr_complex output and float taps
+ *
+ * \ingroup filter_blk
+ * \ingroup pfb_blk
+ */
+
+ class FILTER_API pfb_synthesizer_ccf : virtual public gr_sync_interpolator
+ {
+ public:
+ // gr::filter::pfb_synthesizer_ccf::sptr
+ typedef boost::shared_ptr<pfb_synthesizer_ccf> sptr;
+
+ /*!
+ * Build the polyphase synthesis filterbank.
+ * \param numchans (unsigned integer) Specifies the number of
+ * channels <EM>M</EM>
+ * \param taps (vector/list of floats) The prototype filter to
+ * populate the filterbank.
+ * \param twox (bool) use 2x oversampling or not (default is no)
+ */
+ static sptr make(unsigned int numchans,
+ const std::vector<float> &taps,
+ bool twox=false);
+
+ /*!
+ * Resets the filterbank's filter taps with the new prototype filter
+ * \param taps (vector/list of floats) The prototype filter to
+ * populate the filterbank.
+ */
+ virtual void set_taps(const std::vector<float> &taps) = 0;
+
+ /*!
+ * Print all of the filterbank taps to screen.
+ */
+ virtual void print_taps() = 0;
+
+ /*!
+ * Return a vector<vector<>> of the filterbank taps
+ */
+ virtual std::vector<std::vector<float> > taps() const = 0;
+
+ /*!
+ * Set the channel map. Channels are numbers as:
+ * N/2+1 | ... | N-1 | 0 | 1 | 2 | ... | N/2
+ * <------------------- 0 -------------------->
+ * freq
+ *
+ * So input stream 0 goes to channel 0, etc. Setting a new channel
+ * map allows the user to specify where in frequency he/she wants
+ * the input stream to go. This is especially useful to avoid
+ * putting signals into the channels on the edge of the spectrum
+ * which can either wrap around (in the case of odd number of
+ * channels) and be affected by filter rolloff in the transmitter.
+ *
+ * The map must be at least the number of streams being sent to the
+ * block. Less and the algorithm will not have enough data to
+ * properly setup the buffers. Any more channels specified will be
+ * ignored.
+ */
+ virtual void set_channel_map(const std::vector<int> &map) = 0;
+
+ /*!
+ * Gets the current channel map.
+ */
+ virtual std::vector<int> channel_map() const = 0;
+ };
+
+ } /* namespace filter */
+} /* namespace gr */
+
+#endif /* INCLUDED_PFB_SYNTHESIZER_CCF_H */
diff --git a/gr-filter/include/filter/pm_remez.h b/gr-filter/include/filter/pm_remez.h
new file mode 100644
index 000000000..a57e9e276
--- /dev/null
+++ b/gr-filter/include/filter/pm_remez.h
@@ -0,0 +1,72 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,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 INCLUDED_FILTER_PM_REMEZ_H
+#define INCLUDED_FILTER_PM_REMEZ_H
+
+#include <filter/api.h>
+#include <gr_types.h>
+#include <string>
+#include <stdexcept>
+
+namespace gr {
+ namespace filter {
+ /*!
+ * \brief Parks-McClellan FIR filter design using Remez algorithm.
+ *
+ * \ingroup filter_design
+ *
+ * Calculates the optimal (in the Chebyshev/minimax sense) FIR
+ * filter inpulse reponse given a set of band edges, the desired
+ * reponse on those bands, and the weight given to the error in
+ * those bands.
+ *
+ * \param order filter order (number of taps in the returned filter - 1)
+ * \param bands frequency at the band edges [ b1 e1 b2 e2 b3 e3 ...]
+ * \param ampl desired amplitude at the band edges [ a(b1) a(e1) a(b2) a(e2) ...]
+ * \param error_weight weighting applied to each band (usually 1)
+ * \param filter_type one of "bandpass", "hilbert" or "differentiator"
+ * \param grid_density determines how accurately the filter will be constructed. \
+ * The minimum value is 16; higher values are slower to compute.
+ *
+ * Frequency is in the range [0, 1], with 1 being the Nyquist
+ * frequency (Fs/2)
+ *
+ * \returns vector of computed taps
+ *
+ * \throws std::runtime_error if args are invalid or calculation
+ * fails to converge.
+ */
+
+ FILTER_API std::vector<double>
+ pm_remez(int order,
+ const std::vector<double> &bands,
+ const std::vector<double> &ampl,
+ const std::vector<double> &error_weight,
+ const std::string filter_type = "bandpass",
+ int grid_density = 16
+ ) throw (std::runtime_error);
+
+ } /* namespace filter */
+} /* namespace gr */
+
+#endif /* INCLUDED_FILTER_PM_REMEZ_H */
diff --git a/gr-filter/include/filter/polyphase_filterbank.h b/gr-filter/include/filter/polyphase_filterbank.h
new file mode 100644
index 000000000..33e9522e1
--- /dev/null
+++ b/gr-filter/include/filter/polyphase_filterbank.h
@@ -0,0 +1,148 @@
+/* -*- 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.
+ */
+
+
+#ifndef INCLUDED_FILTER_POLYPHASE_FILTERBANK_H
+#define INCLUDED_FILTER_POLYPHASE_FILTERBANK_H
+
+#include <filter/api.h>
+#include <filter/fir_filter.h>
+#include <fft/fft.h>
+
+namespace gr {
+ namespace filter {
+ namespace kernel {
+
+ /*!
+ * \class polyphase_filterbank
+ *
+ * \brief Polyphase filterbank parent class
+ *
+ * \ingroup filter_blk
+ * \ingroup pfb_blk
+ *
+ * This block takes in complex inputs and channelizes it to
+ * <EM>M</EM> channels of equal bandwidth. Each of the resulting
+ * channels is decimated to the new rate that is the input
+ * sampling rate <EM>fs</EM> divided by the number of channels,
+ * <EM>M</EM>.
+ *
+ * The PFB channelizer code takes the taps generated above and
+ * builds a set of filters. The set contains <EM>M</EM> number
+ * of filters and each filter contains ceil(taps.size()/decim)
+ * number of taps. Each tap from the filter prototype is
+ * sequentially inserted into the next filter. When all of the
+ * input taps are used, the remaining filters in the filterbank
+ * are filled out with 0's to make sure each filter has the same
+ * number of taps.
+ *
+ * Each filter operates using the gr_fir filter classs of GNU
+ * Radio, which takes the input stream at <EM>i</EM> and
+ * performs the inner product calculation to <EM>i+(n-1)</EM>
+ * where <EM>n</EM> is the number of filter taps. To efficiently
+ * handle this in the GNU Radio structure, each filter input
+ * must come from its own input stream. So the channelizer must
+ * be provided with <EM>M</EM> streams where the input stream
+ * has been deinterleaved. This is most easily done using the
+ * gr_stream_to_streams block.
+ *
+ * The output is then produced as a vector, where index
+ * <EM>i</EM> in the vector is the next sample from the
+ * <EM>i</EM>th channel. This is most easily handled by sending
+ * the output to a gr_vector_to_streams block to handle the
+ * conversion and passing <EM>M</EM> streams out.
+ *
+ * The input and output formatting is done using a hier_block2
+ * called pfb_channelizer_ccf. This can take in a single stream
+ * and outputs <EM>M</EM> streams based on the behavior
+ * described above.
+ *
+ * The filter's taps should be based on the input sampling rate.
+ *
+ * For example, using the GNU Radio's firdes utility to building
+ * filters, we build a low-pass filter with a sampling rate of
+ * <EM>fs</EM>, a 3-dB bandwidth of <EM>BW</EM> and a transition
+ * bandwidth of <EM>TB</EM>. We can also specify the out-of-band
+ * attenuation to use, <EM>ATT</EM>, and the filter window
+ * function (a Blackman-harris window in this case). The first
+ * input is the gain of the filter, which we specify here as
+ * unity.
+ *
+ * <B><EM>self._taps = filter.firdes.low_pass_2(1, fs, BW, TB,
+ * attenuation_dB=ATT, window=filter.firdes.WIN_BLACKMAN_hARRIS)</EM></B>
+ *
+ * More on the theory of polyphase filterbanks can be found in
+ * the following book.
+ *
+ * <B><EM>f. harris, "Multirate Signal Processing for
+ * Communication Systems," Upper Saddle River, NJ:
+ * Prentice Hall, Inc. 2004.</EM></B>
+ *
+ */
+
+ class FILTER_API polyphase_filterbank
+ {
+ protected:
+ unsigned int d_nfilts;
+ std::vector<kernel::fir_filter_ccf*> d_filters;
+ std::vector< std::vector<float> > d_taps;
+ unsigned int d_taps_per_filter;
+ fft::fft_complex *d_fft;
+
+ public:
+ /*!
+ * Build the polyphase filterbank decimator.
+ * \param nfilts (unsigned integer) Specifies the number of
+ * channels <EM>M</EM>
+ * \param taps (vector/list of floats) The prototype filter to
+ * populate the filterbank.
+ */
+ polyphase_filterbank(unsigned int nfilts,
+ const std::vector<float> &taps);
+
+ ~polyphase_filterbank();
+
+ /*!
+ * Update the filterbank's filter taps from a prototype
+ * filter.
+ *
+ * \param taps (vector/list of floats) The prototype filter to
+ * populate the filterbank.
+ */
+ void set_taps(const std::vector<float> &taps);
+
+ /*!
+ * Print all of the filterbank taps to screen.
+ */
+ void print_taps();
+
+ /*!
+ * Return a vector<vector<>> of the filterbank taps
+ */
+ std::vector<std::vector<float> > taps() const;
+ };
+
+ } /* namespace kernel */
+ } /* namespace filter */
+} /* namespace gr */
+
+#endif /* INCLUDED_FILTER_POLYPHASE_FILTERBANK_H */
diff --git a/gr-filter/include/filter/rational_resampler_base_XXX.h.t b/gr-filter/include/filter/rational_resampler_base_XXX.h.t
new file mode 100644
index 000000000..e47a16ec6
--- /dev/null
+++ b/gr-filter/include/filter/rational_resampler_base_XXX.h.t
@@ -0,0 +1,61 @@
+/* -*- 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.
+ */
+
+/* @WARNING@ */
+
+#ifndef @GUARD_NAME@
+#define @GUARD_NAME@
+
+#include <filter/api.h>
+#include <gr_block.h>
+
+
+namespace gr {
+ namespace filter {
+
+ /*!
+ * \brief Rational Resampling Polyphase FIR filter with @I_TYPE@
+ * input, @O_TYPE@ output and @TAP_TYPE@ taps.
+ *
+ *\ingroup filter_blk
+ */
+ class FILTER_API @NAME@ : virtual public gr_block
+ {
+ public:
+ // gr::filter::@BASE_NAME@::sptr
+ typedef boost::shared_ptr<@BASE_NAME@> sptr;
+
+ static sptr make(unsigned interpolation,
+ unsigned decimation,
+ const std::vector<@TAP_TYPE@> &taps);
+
+ virtual unsigned interpolation() const = 0;
+ virtual unsigned decimation() const = 0;
+
+ virtual void set_taps(const std::vector<@TAP_TYPE@> &taps) = 0;
+ virtual std::vector<@TAP_TYPE@> taps() const = 0;
+ };
+
+ } /* namespace filter */
+} /* namespace gr */
+
+#endif /* @GUARD_NAME@ */
diff --git a/gr-filter/include/filter/single_pole_iir.h b/gr-filter/include/filter/single_pole_iir.h
new file mode 100644
index 000000000..10d1b4791
--- /dev/null
+++ b/gr-filter/include/filter/single_pole_iir.h
@@ -0,0 +1,200 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002,2006,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 INCLUDED_SINGLE_POLE_IIR_H
+#define INCLUDED_SINGLE_POLE_IIR_H
+
+#include <filter/api.h>
+#include <stdexcept>
+#include <gr_complex.h>
+
+namespace gr {
+ namespace filter {
+
+ /*!
+ * \brief class template for single pole IIR filter
+ */
+ template<class o_type, class i_type, class tap_type>
+ class single_pole_iir
+ {
+ public:
+ /*!
+ * \brief construct new single pole IIR with given alpha
+ *
+ * computes y(i) = (1-alpha) * y(i-1) + alpha * x(i)
+ */
+ single_pole_iir(tap_type alpha = 1.0)
+ {
+ d_prev_output = 0;
+ set_taps(alpha);
+ }
+
+ /*!
+ * \brief compute a single output value.
+ * \returns the filtered input value.
+ */
+ o_type filter(const i_type input);
+
+ /*!
+ * \brief compute an array of N output values.
+ * \p input must have n valid entries.
+ */
+ void filterN(o_type output[], const i_type input[], unsigned long n);
+
+ /*!
+ * \brief install \p alpha as the current taps.
+ */
+ void set_taps(tap_type alpha)
+ {
+ if(alpha < 0 || alpha > 1)
+ throw std::out_of_range("Alpha must be in [0, 1]\n");
+
+ d_alpha = alpha;
+ d_one_minus_alpha = 1.0 - alpha;
+ }
+
+ //! reset state to zero
+ void reset()
+ {
+ d_prev_output = 0;
+ }
+
+ o_type prev_output() const { return d_prev_output; }
+
+ protected:
+ tap_type d_alpha;
+ tap_type d_one_minus_alpha;
+ o_type d_prev_output;
+ };
+
+ //
+ // general case. We may want to specialize this
+ //
+ template<class o_type, class i_type, class tap_type>
+ o_type
+ single_pole_iir<o_type, i_type, tap_type>::filter(const i_type input)
+ {
+ o_type output;
+
+ output = d_alpha * input + d_one_minus_alpha * d_prev_output;
+ d_prev_output = output;
+
+ return (o_type) output;
+ }
+
+
+ template<class o_type, class i_type, class tap_type>
+ void
+ single_pole_iir<o_type, i_type, tap_type>::filterN(o_type output[],
+ const i_type input[],
+ unsigned long n)
+ {
+ for(unsigned i = 0; i < n; i++)
+ output[i] = filter(input[i]);
+ }
+
+
+ //
+ // Specialized case for gr_complex output and double taps
+ // We need to have a gr_complexd type for the calculations and prev_output variable (in stead of double)
+
+ template<class i_type>
+ class single_pole_iir<gr_complex, i_type, double>
+ {
+ public:
+ /*!
+ * \brief construct new single pole IIR with given alpha
+ *
+ * computes y(i) = (1-alpha) * y(i-1) + alpha * x(i)
+ */
+ single_pole_iir(double alpha = 1.0)
+ {
+ d_prev_output = 0;
+ set_taps(alpha);
+ }
+
+ /*!
+ * \brief compute a single output value.
+ * \returns the filtered input value.
+ */
+ gr_complex filter(const i_type input);
+
+ /*!
+ * \brief compute an array of N output values.
+ * \p input must have n valid entries.
+ */
+ void filterN(gr_complex output[], const i_type input[], unsigned long n);
+
+ /*!
+ * \brief install \p alpha as the current taps.
+ */
+ void set_taps(double alpha)
+ {
+ if(alpha < 0 || alpha > 1)
+ throw std::out_of_range("Alpha must be in [0, 1]\n");
+
+ d_alpha = alpha;
+ d_one_minus_alpha = 1.0 - alpha;
+ }
+
+ //! reset state to zero
+ void reset()
+ {
+ d_prev_output = 0;
+ }
+
+ gr_complexd prev_output() const { return d_prev_output; }
+
+ protected:
+ double d_alpha;
+ double d_one_minus_alpha;
+ gr_complexd d_prev_output;
+ };
+
+ template< class i_type>
+ gr_complex
+ single_pole_iir<gr_complex, i_type, double>::filter(const i_type input)
+ {
+ gr_complexd output;
+
+ output = d_alpha * (gr_complexd)input + d_one_minus_alpha * d_prev_output;
+ d_prev_output = output;
+
+ return (gr_complex) output;
+ }
+
+ //Do we need to specialize this, although it is the same as the general case?
+
+ template<class i_type>
+ void
+ single_pole_iir<gr_complex, i_type, double>::filterN(gr_complex output[],
+ const i_type input[],
+ unsigned long n)
+ {
+ for(unsigned i = 0; i < n; i++)
+ output[i] = filter(input[i]);
+ }
+
+ } /* namespace filter */
+} /* namespace gr */
+
+#endif /* INCLUDED_SINGLE_POLE_IIR_H */
diff --git a/gr-filter/include/filter/single_pole_iir_filter_cc.h b/gr-filter/include/filter/single_pole_iir_filter_cc.h
new file mode 100644
index 000000000..82febe8ec
--- /dev/null
+++ b/gr-filter/include/filter/single_pole_iir_filter_cc.h
@@ -0,0 +1,78 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004-2006,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 INCLUDED_SINGLE_POLE_IIR_FILTER_CC_H
+#define INCLUDED_SINGLE_POLE_IIR_FILTER_CC_H
+
+#include <filter/api.h>
+#include <filter/single_pole_iir.h>
+#include <gr_sync_block.h>
+#include <gr_complex.h>
+
+namespace gr {
+ namespace filter {
+
+ /*!
+ * \brief single pole IIR filter with complex input, complex output
+ * \ingroup filter_blk
+ *
+ * The input and output satisfy a difference equation of the form
+ \htmlonly
+ \f{
+ y[n] - (1-alpha) y[n-1] = alpha x[n]
+ \f}
+ \endhtmlonly
+
+ \xmlonly
+ y[n] - (1-alpha) y[n-1] = alpha x[n]
+ \endxmlonly
+
+ * with the corresponding rational system function
+ \htmlonly
+ \f{
+ H(z) = \frac{alpha}{1 - (1-alpha) z^{-1}}
+ \f}
+ \endhtmlonly
+
+ \xmlonly
+ H(z) = \ frac{alpha}{1 - (1-alpha) z^{-1}}
+ \endxmlonly
+
+ * Note that some texts define the system function with a + in the
+ * denominator. If you're using that convention, you'll need to
+ * negate the feedback tap.
+ */
+ class FILTER_API single_pole_iir_filter_cc : virtual public gr_sync_block
+ {
+ public:
+ // gr::filter::single_pole_iir_filter_cc::sptr
+ typedef boost::shared_ptr<single_pole_iir_filter_cc> sptr;
+
+ static sptr make(double alpha, unsigned int vlen=1);
+
+ virtual void set_taps(double alpha) = 0;
+ };
+
+ } /* namespace filter */
+} /* namespace gr */
+
+#endif /* INCLUDED_SINGLE_POLE_IIR_FILTER_CC_H */
diff --git a/gr-filter/include/filter/single_pole_iir_filter_ff.h b/gr-filter/include/filter/single_pole_iir_filter_ff.h
new file mode 100644
index 000000000..d85688db8
--- /dev/null
+++ b/gr-filter/include/filter/single_pole_iir_filter_ff.h
@@ -0,0 +1,78 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2005 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_SINGLE_POLE_IIR_FILTER_FF_H
+#define INCLUDED_SINGLE_POLE_IIR_FILTER_FF_H
+
+#include <filter/api.h>
+#include <filter/single_pole_iir.h>
+#include <gr_sync_block.h>
+#include <gr_complex.h>
+
+namespace gr {
+ namespace filter {
+
+ /*!
+ * \brief single pole IIR filter with float input, float output
+ * \ingroup filter_blk
+ *
+ * The input and output satisfy a difference equation of the form
+ \htmlonly
+ \f{
+ y[n] - (1-alpha) y[n-1] = alpha x[n]
+ \f}
+ \endhtmlonly
+
+ \xmlonly
+ y[n] - (1-alpha) y[n-1] = alpha x[n]
+ \endxmlonly
+
+ * with the corresponding rational system function
+ \htmlonly
+ \f{
+ H(z) = \frac{alpha}{1 - (1-alpha) z^{-1}}
+ \f}
+ \endhtmlonly
+
+ \xmlonly
+ H(z) = \ frac{alpha}{1 - (1-alpha) z^{-1}}
+ \endxmlonly
+
+ * Note that some texts define the system function with a + in the
+ * denominator. If you're using that convention, you'll need to
+ * negate the feedback tap.
+ */
+ class FILTER_API single_pole_iir_filter_ff : virtual public gr_sync_block
+ {
+ public:
+ // gr::filter::single_pole_iir_filter_ff::sptr
+ typedef boost::shared_ptr<single_pole_iir_filter_ff> sptr;
+
+ static sptr make(double alpha, unsigned int vlen=1);
+
+ virtual void set_taps (double alpha) = 0;
+ };
+
+ } /* namespace filter */
+} /* namespace gr */
+
+#endif /* INCLUDED_SINGLE_POLE_IIR_FILTER_FF_H */
diff --git a/gr-filter/lib/CMakeLists.txt b/gr-filter/lib/CMakeLists.txt
new file mode 100644
index 000000000..626f5521f
--- /dev/null
+++ b/gr-filter/lib/CMakeLists.txt
@@ -0,0 +1,184 @@
+# 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.
+
+########################################################################
+# generate helper scripts to expand templated files
+########################################################################
+include(GrPython)
+
+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_impl_dict2(name, sig, 'filter')
+ build_utils.expand_template(d, inp)
+")
+
+macro(expand_cc root)
+ #make a list of all the generated files
+ unset(expanded_files_cc)
+ unset(expanded_files_h)
+ foreach(sig ${ARGN})
+ string(REGEX REPLACE "X+" ${sig} name ${root})
+ list(APPEND expanded_files_cc ${CMAKE_CURRENT_BINARY_DIR}/${name}.cc)
+ list(APPEND expanded_files_h ${CMAKE_CURRENT_BINARY_DIR}/${name}.h)
+ endforeach(sig)
+
+ #create a command to generate the source files
+ add_custom_command(
+ OUTPUT ${expanded_files_cc}
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${root}.cc.t
+ COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B}
+ ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py
+ ${root} ${root}.cc.t ${ARGN}
+ )
+
+ #create a command to generate the header file
+ add_custom_command(
+ OUTPUT ${expanded_files_h}
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${root}.h.t
+ COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B}
+ ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py
+ ${root} ${root}.h.t ${ARGN}
+ )
+
+ #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 files
+ list(APPEND generated_sources ${expanded_files_cc})
+ list(APPEND generated_headers ${expanded_files_h})
+endmacro(expand_cc)
+
+########################################################################
+# Invoke macro to generate various sources
+########################################################################
+expand_cc(fir_filter_XXX_impl ccc ccf fcc fff fsf scc)
+expand_cc(freq_xlating_fir_filter_XXX_impl ccc ccf fcc fcf scf scc)
+expand_cc(interp_fir_filter_XXX_impl ccc ccf fcc fff fsf scc)
+expand_cc(rational_resampler_base_XXX_impl ccc ccf fcc fff fsf scc)
+
+
+########################################################################
+# Setup the include and linker paths
+########################################################################
+include_directories(
+ ${CMAKE_CURRENT_SOURCE_DIR}
+ ${CMAKE_CURRENT_BINARY_DIR}
+ ${GR_FILTER_INCLUDE_DIRS}
+ ${GR_FFT_INCLUDE_DIRS}
+ ${GNURADIO_CORE_INCLUDE_DIRS}
+ ${VOLK_INCLUDE_DIRS}
+ ${GRUEL_INCLUDE_DIRS}
+ ${Boost_INCLUDE_DIRS}
+)
+
+link_directories(${Boost_LIBRARY_DIRS})
+
+########################################################################
+# Setup library
+########################################################################
+list(APPEND filter_sources
+ fir_filter.cc
+ fir_filter_with_buffer.cc
+ fft_filter.cc
+ firdes.cc
+ mmse_fir_interpolator_cc.cc
+ mmse_fir_interpolator_ff.cc
+ pm_remez.cc
+ polyphase_filterbank.cc
+ ${generated_sources}
+ adaptive_fir_ccc_impl.cc
+ adaptive_fir_ccf_impl.cc
+ dc_blocker_cc_impl.cc
+ dc_blocker_ff_impl.cc
+ filter_delay_fc_impl.cc
+ fft_filter_ccc_impl.cc
+ fft_filter_fff_impl.cc
+ fractional_interpolator_cc_impl.cc
+ fractional_interpolator_ff_impl.cc
+ hilbert_fc_impl.cc
+ iir_filter_ffd_impl.cc
+ pfb_arb_resampler_ccf_impl.cc
+ pfb_arb_resampler_fff_impl.cc
+ pfb_channelizer_ccf_impl.cc
+ pfb_decimator_ccf_impl.cc
+ pfb_interpolator_ccf_impl.cc
+ pfb_synthesizer_ccf_impl.cc
+ single_pole_iir_filter_cc_impl.cc
+ single_pole_iir_filter_ff_impl.cc
+ channel_model_impl.cc
+)
+
+list(APPEND filter_libs
+ gnuradio-core
+ gnuradio-fft
+ volk
+ ${Boost_LIBRARIES}
+)
+
+add_library(gnuradio-filter SHARED ${filter_sources})
+target_link_libraries(gnuradio-filter ${filter_libs})
+GR_LIBRARY_FOO(gnuradio-filter RUNTIME_COMPONENT "filter_runtime" DEVEL_COMPONENT "filter_devel")
+add_dependencies(gnuradio-filter gnuradio-fft filter_generated_includes filter_generated_swigs)
+
+
+########################################################################
+# QA C++ Code for gr-filter
+########################################################################
+if(ENABLE_TESTING)
+ include(GrTest)
+
+ include_directories(${CPPUNIT_INCLUDE_DIRS})
+ link_directories(${CPPUNIT_LIBRARY_DIRS})
+
+ list(APPEND test_gr_filter_sources
+ ${CMAKE_CURRENT_SOURCE_DIR}/test_gr_filter.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/qa_filter.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/qa_firdes.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/qa_fir_filter_with_buffer.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/qa_mmse_fir_interpolator_cc.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/qa_mmse_fir_interpolator_ff.cc
+ )
+
+ add_executable(test-gr-filter ${test_gr_filter_sources})
+
+ list(APPEND GR_TEST_TARGET_DEPS test-gr-filter gnuradio-filter gnuradio-fft)
+
+ target_link_libraries(
+ test-gr-filter
+ gnuradio-core
+ gnuradio-filter
+ ${Boost_LIBRARIES}
+ ${CPPUNIT_LIBRARIES}
+ )
+
+ GR_ADD_TEST(test_gr_filter test-gr-filter)
+endif(ENABLE_TESTING)
diff --git a/gr-filter/lib/adaptive_fir_ccc_impl.cc b/gr-filter/lib/adaptive_fir_ccc_impl.cc
new file mode 100644
index 000000000..515ef90cd
--- /dev/null
+++ b/gr-filter/lib/adaptive_fir_ccc_impl.cc
@@ -0,0 +1,106 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2011,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 "adaptive_fir_ccc_impl.h"
+#include <gr_io_signature.h>
+
+namespace gr {
+ namespace filter {
+
+ adaptive_fir_ccc::sptr adaptive_fir_ccc::make(const char *name, int decimation,
+ const std::vector<gr_complex> &taps)
+ {
+ return gnuradio::get_initial_sptr(new adaptive_fir_ccc_impl
+ (name, decimation, taps));
+ }
+
+ adaptive_fir_ccc_impl::adaptive_fir_ccc_impl(const char *name, int decimation,
+ const std::vector<gr_complex> &taps)
+ : gr_sync_decimator(name,
+ gr_make_io_signature(1, 1, sizeof(gr_complex)),
+ gr_make_io_signature(1, 1, sizeof(gr_complex)),
+ decimation),
+ kernel::fir_filter_ccc(decimation, taps),
+ d_updated(false)
+ {
+ set_history(d_ntaps);
+ }
+
+ void
+ adaptive_fir_ccc_impl::set_taps(const std::vector<gr_complex> &taps)
+ {
+ d_new_taps = taps;
+ d_updated = true;
+ }
+
+ std::vector<gr_complex>
+ adaptive_fir_ccc_impl::taps() const
+ {
+ return kernel::fir_filter_ccc::taps();
+ }
+
+ gr_complex
+ adaptive_fir_ccc_impl::error(const gr_complex &out)
+ {
+ return 0;
+ }
+
+ void
+ adaptive_fir_ccc_impl::update_tap(gr_complex &tap, const gr_complex &in)
+ {
+ tap = tap;
+ }
+
+ int
+ adaptive_fir_ccc_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ gr_complex *in = (gr_complex *)input_items[0];
+ gr_complex *out = (gr_complex *)output_items[0];
+
+ if (d_updated) {
+ kernel::fir_filter_ccc::set_taps(d_new_taps);
+ set_history(d_ntaps);
+ d_updated = false;
+ return 0; // history requirements may have changed.
+ }
+
+ // Call base class filtering function that uses
+ // overloaded error and update_tap functions.
+ if (decimation() == 1) {
+ filterN(out, in, noutput_items);
+ }
+ else {
+ filterNdec(out, in, noutput_items,
+ decimation());
+ }
+
+ return noutput_items;
+ }
+
+ } /* namespace filter */
+} /* namespace gr */
diff --git a/gr-filter/lib/adaptive_fir_ccc_impl.h b/gr-filter/lib/adaptive_fir_ccc_impl.h
new file mode 100644
index 000000000..fd6274a1d
--- /dev/null
+++ b/gr-filter/lib/adaptive_fir_ccc_impl.h
@@ -0,0 +1,61 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2011,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 INCLUDED_FILTER_ADAPTIVE_FIR_CCC_IMPL_H
+#define INCLUDED_FILTER_ADAPTIVE_FIR_CCC_IMPL_H
+
+#include <filter/adaptive_fir_ccc.h>
+#include <filter/fir_filter.h>
+#include <gr_types.h>
+
+namespace gr {
+ namespace filter {
+
+ class FILTER_API adaptive_fir_ccc_impl : public adaptive_fir_ccc, public kernel::fir_filter_ccc
+ {
+ private:
+ std::vector<gr_complex> d_new_taps;
+ bool d_updated;
+
+ protected:
+ // Override to calculate error signal per output
+ gr_complex error(const gr_complex &out);
+
+ // Override to calculate new weight from old, corresponding input
+ void update_tap(gr_complex &tap, const gr_complex &in);
+
+ public:
+ void set_taps(const std::vector<gr_complex> &taps);
+ std::vector<gr_complex> taps() const;
+
+ adaptive_fir_ccc_impl(const char *name, int decimation,
+ const std::vector<gr_complex> &taps);
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace filter */
+} /* namespace gr */
+
+#endif /* INCLUDED_FILTER_ADAPTIVE_FIR_CCC_IMPL_H */
diff --git a/gr-filter/lib/adaptive_fir_ccf_impl.cc b/gr-filter/lib/adaptive_fir_ccf_impl.cc
new file mode 100644
index 000000000..004a9286b
--- /dev/null
+++ b/gr-filter/lib/adaptive_fir_ccf_impl.cc
@@ -0,0 +1,106 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2011,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 "adaptive_fir_ccf_impl.h"
+#include <gr_io_signature.h>
+
+namespace gr {
+ namespace filter {
+
+ adaptive_fir_ccf::sptr adaptive_fir_ccf::make(const char *name, int decimation,
+ const std::vector<float> &taps)
+ {
+ return gnuradio::get_initial_sptr(new adaptive_fir_ccf_impl
+ (name, decimation, taps));
+ }
+
+ adaptive_fir_ccf_impl::adaptive_fir_ccf_impl(const char *name, int decimation,
+ const std::vector<float> &taps)
+ : gr_sync_decimator(name,
+ gr_make_io_signature(1, 1, sizeof(gr_complex)),
+ gr_make_io_signature(1, 1, sizeof(gr_complex)),
+ decimation),
+ kernel::fir_filter_ccf(decimation, taps),
+ d_updated(false)
+ {
+ set_history(d_ntaps);
+ }
+
+ void
+ adaptive_fir_ccf_impl::set_taps(const std::vector<float> &taps)
+ {
+ d_new_taps = taps;
+ d_updated = true;
+ }
+
+ std::vector<float>
+ adaptive_fir_ccf_impl::taps()
+ {
+ return kernel::fir_filter_ccf::taps();
+ }
+
+ float
+ adaptive_fir_ccf_impl::error(const gr_complex &out)
+ {
+ return 0;
+ }
+
+ void
+ adaptive_fir_ccf_impl::update_tap(float &tap, const gr_complex &in)
+ {
+ tap = tap;
+ }
+
+ int
+ adaptive_fir_ccf_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ gr_complex *in = (gr_complex *)input_items[0];
+ gr_complex *out = (gr_complex *)output_items[0];
+
+ if (d_updated) {
+ kernel::fir_filter_ccf::set_taps(d_new_taps);
+ set_history(d_ntaps);
+ d_updated = false;
+ return 0; // history requirements may have changed.
+ }
+
+ // Call base class filtering function that uses
+ // overloaded error and update_tap functions.
+ if (decimation() == 1) {
+ filterN(out, in, noutput_items);
+ }
+ else {
+ filterNdec(out, in, noutput_items,
+ decimation());
+ }
+
+ return noutput_items;
+ }
+
+ } /* namespace filter */
+} /* namespace gr */
diff --git a/gr-filter/lib/adaptive_fir_ccf_impl.h b/gr-filter/lib/adaptive_fir_ccf_impl.h
new file mode 100644
index 000000000..a0c9581ea
--- /dev/null
+++ b/gr-filter/lib/adaptive_fir_ccf_impl.h
@@ -0,0 +1,61 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2011,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 INCLUDED_FILTER_ADAPTIVE_FIR_CCF_IMPL_H
+#define INCLUDED_FILTER_ADAPTIVE_FIR_CCF_IMPL_H
+
+#include <filter/adaptive_fir_ccf.h>
+#include <filter/fir_filter.h>
+#include <gr_types.h>
+
+namespace gr {
+ namespace filter {
+
+ class FILTER_API adaptive_fir_ccf_impl : public adaptive_fir_ccf, public kernel::fir_filter_ccf
+ {
+ private:
+ std::vector<float> d_new_taps;
+ bool d_updated;
+
+ protected:
+ // Override to calculate error signal per output
+ float error(const gr_complex &out);
+
+ // Override to calculate new weight from old, corresponding input
+ void update_tap(float &tap, const gr_complex &in);
+
+ public:
+ void set_taps(const std::vector<float> &taps);
+ std::vector<float> taps();
+
+ adaptive_fir_ccf_impl(const char *name, int decimation,
+ const std::vector<float> &taps);
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace filter */
+} /* namespace gr */
+
+#endif /* INCLUDED_FILTER_ADAPTIVE_FIR_CCF_IMPL_H */
diff --git a/gr-filter/lib/channel_model_impl.cc b/gr-filter/lib/channel_model_impl.cc
new file mode 100644
index 000000000..f9e995479
--- /dev/null
+++ b/gr-filter/lib/channel_model_impl.cc
@@ -0,0 +1,135 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2009,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.
+ */
+
+#include "channel_model_impl.h"
+#include <gr_io_signature.h>
+#include <iostream>
+
+namespace gr {
+ namespace filter {
+
+ channel_model::sptr
+ channel_model::make(double noise_voltage,
+ double frequency_offset,
+ double epsilon,
+ const std::vector<gr_complex> &taps,
+ double noise_seed)
+ {
+ return gnuradio::get_initial_sptr
+ (new channel_model_impl(noise_voltage,
+ frequency_offset,
+ epsilon,
+ taps,
+ noise_seed));
+ }
+
+ // Hierarchical block constructor
+ channel_model_impl::channel_model_impl(double noise_voltage,
+ double frequency_offset,
+ double epsilon,
+ const std::vector<gr_complex> &taps,
+ double noise_seed)
+ : gr_hier_block2("gr_channel_model",
+ gr_make_io_signature(1, 1, sizeof(gr_complex)),
+ gr_make_io_signature(1, 1, sizeof(gr_complex)))
+ {
+ d_taps = taps;
+ while(d_taps.size() < 2) {
+ d_taps.push_back(0);
+ }
+
+ d_timing_offset = fractional_interpolator_cc::make(0, epsilon);
+
+ d_multipath = fir_filter_ccc::make(1, d_taps);
+
+ d_noise_adder = gr_make_add_cc();
+ d_noise = gr_make_noise_source_c(GR_GAUSSIAN, noise_voltage, noise_seed);
+ d_freq_offset = gr_make_sig_source_c(1, GR_SIN_WAVE, frequency_offset, 1.0, 0.0);
+ d_mixer_offset = gr_make_multiply_cc();
+
+ connect(self(), 0, d_timing_offset, 0);
+ connect(d_timing_offset, 0, d_multipath, 0);
+ connect(d_multipath, 0, d_mixer_offset, 0);
+ connect(d_freq_offset, 0, d_mixer_offset, 1);
+ connect(d_mixer_offset, 0, d_noise_adder, 1);
+ connect(d_noise, 0, d_noise_adder, 0);
+ connect(d_noise_adder, 0, self(), 0);
+ }
+
+ channel_model_impl::~channel_model_impl()
+ {
+ }
+
+ void
+ channel_model_impl::set_noise_voltage(double noise_voltage)
+ {
+ d_noise->set_amplitude(noise_voltage);
+ }
+
+ void
+ channel_model_impl::set_frequency_offset(double frequency_offset)
+ {
+ d_freq_offset->set_frequency(frequency_offset);
+ }
+
+ void
+ channel_model_impl::set_taps(const std::vector<gr_complex> &taps)
+ {
+ d_taps = taps;
+ while(d_taps.size() < 2) {
+ d_taps.push_back(0);
+ }
+ d_multipath->set_taps(d_taps);
+ }
+
+ void
+ channel_model_impl::set_timing_offset(double epsilon)
+ {
+ d_timing_offset->set_interp_ratio(epsilon);
+ }
+
+ double
+ channel_model_impl::noise_voltage() const
+ {
+ return d_noise->amplitude();
+ }
+
+ double
+ channel_model_impl::frequency_offset() const
+ {
+ return d_freq_offset->frequency();
+ }
+
+ std::vector<gr_complex>
+ channel_model_impl::taps() const
+ {
+ return d_multipath->taps();
+ }
+
+ double
+ channel_model_impl::timing_offset() const
+ {
+ return d_timing_offset->interp_ratio();
+ }
+
+ } /* namespace filter */
+} /* namespace gr */
diff --git a/gr-filter/lib/channel_model_impl.h b/gr-filter/lib/channel_model_impl.h
new file mode 100644
index 000000000..95a63d790
--- /dev/null
+++ b/gr-filter/lib/channel_model_impl.h
@@ -0,0 +1,74 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2009,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 INCLUDED_FILTER_CHANNEL_MODEL_IMPL_H
+#define INCLUDED_FILTER_CHANNEL_MODEL_IMPL_H
+
+#include <gr_top_block.h>
+#include <gr_sig_source_c.h>
+#include <gr_add_cc.h>
+#include <gr_multiply_cc.h>
+#include <gr_noise_source_c.h>
+#include <filter/channel_model.h>
+#include <filter/fractional_interpolator_cc.h>
+#include <filter/fir_filter_ccc.h>
+
+namespace gr {
+ namespace filter {
+
+ class FILTER_API channel_model_impl : public channel_model
+ {
+ private:
+ gr_sig_source_c_sptr d_freq_offset;
+ gr_add_cc_sptr d_noise_adder;
+ gr_noise_source_c_sptr d_noise;
+ gr_multiply_cc_sptr d_mixer_offset;
+
+ fractional_interpolator_cc::sptr d_timing_offset;
+ fir_filter_ccc::sptr d_multipath;
+
+ std::vector<gr_complex> d_taps;
+
+ public:
+ channel_model_impl(double noise_voltage,
+ double frequency_offset,
+ double epsilon,
+ const std::vector<gr_complex> &taps,
+ double noise_seed);
+
+ ~channel_model_impl();
+
+ void set_noise_voltage(double noise_voltage);
+ void set_frequency_offset(double frequency_offset);
+ void set_taps(const std::vector<gr_complex> &taps);
+ void set_timing_offset(double epsilon);
+
+ double noise_voltage() const;
+ double frequency_offset() const;
+ std::vector<gr_complex> taps() const;
+ double timing_offset() const;
+ };
+
+ } /* namespace filter */
+} /* namespace gr */
+
+#endif /* INCLUDED_FILTER_CHANNEL_MODEL_IMPL_H */
diff --git a/gr-filter/lib/dc_blocker_cc_impl.cc b/gr-filter/lib/dc_blocker_cc_impl.cc
new file mode 100644
index 000000000..663ba94f1
--- /dev/null
+++ b/gr-filter/lib/dc_blocker_cc_impl.cc
@@ -0,0 +1,144 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2011,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 "dc_blocker_cc_impl.h"
+#include <gr_io_signature.h>
+#include <cstdio>
+
+namespace gr {
+ namespace filter {
+
+ moving_averager_c::moving_averager_c(int D)
+ : d_length(D), d_out(0), d_out_d1(0), d_out_d2(0)
+ {
+ d_delay_line = std::deque<gr_complex>(d_length-1, gr_complex(0,0));
+ }
+
+ moving_averager_c::~moving_averager_c()
+ {
+ }
+
+ gr_complex
+ moving_averager_c::filter(gr_complex x)
+ {
+ d_out_d1 = d_out;
+ d_delay_line.push_back(x);
+ d_out = d_delay_line[0];
+ d_delay_line.pop_front();
+
+ gr_complex y = x - d_out_d1 + d_out_d2;
+ d_out_d2 = y;
+
+ return (y / (float)(d_length));
+ }
+
+
+
+ dc_blocker_cc::sptr dc_blocker_cc::make(int D, bool long_form)
+ {
+ return gnuradio::get_initial_sptr(new dc_blocker_cc_impl(D, long_form));
+ }
+
+
+ dc_blocker_cc_impl::dc_blocker_cc_impl(int D, bool long_form)
+ : gr_sync_block("dc_blocker_cc",
+ gr_make_io_signature (1, 1, sizeof(gr_complex)),
+ gr_make_io_signature (1, 1, sizeof(gr_complex))),
+ d_length(D), d_long_form(long_form)
+ {
+ if(d_long_form) {
+ d_ma_0 = new moving_averager_c(D);
+ d_ma_1 = new moving_averager_c(D);
+ d_ma_2 = new moving_averager_c(D);
+ d_ma_3 = new moving_averager_c(D);
+ d_delay_line = std::deque<gr_complex>(d_length-1, gr_complex(0,0));
+ }
+ else {
+ d_ma_0 = new moving_averager_c(D);
+ d_ma_1 = new moving_averager_c(D);
+ }
+ }
+
+ dc_blocker_cc_impl::~dc_blocker_cc_impl()
+ {
+ if(d_long_form) {
+ delete d_ma_0;
+ delete d_ma_1;
+ delete d_ma_2;
+ delete d_ma_3;
+ }
+ else {
+ delete d_ma_0;
+ delete d_ma_1;
+ }
+ }
+
+ int
+ dc_blocker_cc_impl::group_delay()
+ {
+ if(d_long_form)
+ return (2*d_length-2);
+ else
+ return d_length - 1;
+ }
+
+ int
+ dc_blocker_cc_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const gr_complex *in = (const gr_complex*)input_items[0];
+ gr_complex *out = (gr_complex*)output_items[0];
+
+ if(d_long_form) {
+ gr_complex y1, y2, y3, y4, d;
+ for(int i = 0; i < noutput_items; i++) {
+ y1 = d_ma_0->filter(in[i]);
+ y2 = d_ma_1->filter(y1);
+ y3 = d_ma_2->filter(y2);
+ y4 = d_ma_3->filter(y3);
+
+ d_delay_line.push_back(d_ma_0->delayed_sig());
+ d = d_delay_line[0];
+ d_delay_line.pop_front();
+
+ out[i] = d - y4;
+ }
+ }
+ else {
+ gr_complex y1, y2;
+ for(int i = 0; i < noutput_items; i++) {
+ y1 = d_ma_0->filter(in[i]);
+ y2 = d_ma_1->filter(y1);
+ out[i] = d_ma_0->delayed_sig() - y2;
+ }
+ }
+
+ return noutput_items;
+ }
+
+ } /* namespace filter */
+} /* namespace gr */
diff --git a/gr-filter/lib/dc_blocker_cc_impl.h b/gr-filter/lib/dc_blocker_cc_impl.h
new file mode 100644
index 000000000..6f8bc16c7
--- /dev/null
+++ b/gr-filter/lib/dc_blocker_cc_impl.h
@@ -0,0 +1,76 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2011,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 INCLUDED_FILTER_DC_BLOCKER_CC_IMPL_H
+#define INCLUDED_FILTER_DC_BLOCKER_CC_IMPL_H
+
+#include <filter/dc_blocker_cc.h>
+#include <deque>
+
+namespace gr {
+ namespace filter {
+
+ class moving_averager_c
+ {
+ public:
+ moving_averager_c(int D);
+ ~moving_averager_c();
+
+ gr_complex filter(gr_complex x);
+ gr_complex delayed_sig() { return d_out; }
+
+ private:
+ int d_length;
+ gr_complex d_out, d_out_d1, d_out_d2;
+ std::deque<gr_complex> d_delay_line;
+ };
+
+ class FILTER_API dc_blocker_cc_impl : public dc_blocker_cc
+ {
+ private:
+ int d_length;
+ bool d_long_form;
+ moving_averager_c *d_ma_0;
+ moving_averager_c *d_ma_1;
+ moving_averager_c *d_ma_2;
+ moving_averager_c *d_ma_3;
+ std::deque<gr_complex> d_delay_line;
+
+ public:
+ dc_blocker_cc_impl(int D, bool long_form);
+
+ ~dc_blocker_cc_impl();
+
+ int group_delay();
+
+ //int set_length(int D);
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace filter */
+} /* namespace gr */
+
+#endif /* INCLUDED_FILTER_DC_BLOCKER_CC_IMPL_H */
diff --git a/gr-filter/lib/dc_blocker_ff_impl.cc b/gr-filter/lib/dc_blocker_ff_impl.cc
new file mode 100644
index 000000000..22822d147
--- /dev/null
+++ b/gr-filter/lib/dc_blocker_ff_impl.cc
@@ -0,0 +1,142 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2011,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 "dc_blocker_ff_impl.h"
+#include <gr_io_signature.h>
+#include <cstdio>
+
+namespace gr {
+ namespace filter {
+
+ moving_averager_f::moving_averager_f(int D)
+ : d_length(D), d_out(0), d_out_d1(0), d_out_d2(0)
+ {
+ d_delay_line = std::deque<float>(d_length-1, 0);
+ }
+
+ moving_averager_f::~moving_averager_f()
+ {
+ }
+
+ float
+ moving_averager_f::filter(float x)
+ {
+ d_out_d1 = d_out;
+ d_delay_line.push_back(x);
+ d_out = d_delay_line[0];
+ d_delay_line.pop_front();
+
+ float y = x - d_out_d1 + d_out_d2;
+ d_out_d2 = y;
+
+ return (y / (float)(d_length));
+ }
+
+
+ dc_blocker_ff::sptr dc_blocker_ff::make(int D, bool long_form)
+ {
+ return gnuradio::get_initial_sptr(new dc_blocker_ff_impl(D, long_form));
+ }
+
+ dc_blocker_ff_impl::dc_blocker_ff_impl(int D, bool long_form)
+ : gr_sync_block("dc_blocker_ff",
+ gr_make_io_signature (1, 1, sizeof(float)),
+ gr_make_io_signature (1, 1, sizeof(float))),
+ d_length(D), d_long_form(long_form)
+ {
+ if(d_long_form) {
+ d_ma_0 = new moving_averager_f(D);
+ d_ma_1 = new moving_averager_f(D);
+ d_ma_2 = new moving_averager_f(D);
+ d_ma_3 = new moving_averager_f(D);
+ d_delay_line = std::deque<float>(d_length-1, 0);
+ }
+ else {
+ d_ma_0 = new moving_averager_f(D);
+ d_ma_1 = new moving_averager_f(D);
+ }
+ }
+
+ dc_blocker_ff_impl::~dc_blocker_ff_impl()
+ {
+ if(d_long_form) {
+ delete d_ma_0;
+ delete d_ma_1;
+ delete d_ma_2;
+ delete d_ma_3;
+ }
+ else {
+ delete d_ma_0;
+ delete d_ma_1;
+ }
+ }
+
+ int
+ dc_blocker_ff_impl::group_delay()
+ {
+ if(d_long_form)
+ return (2*d_length-2);
+ else
+ return d_length - 1;
+ }
+
+ int
+ dc_blocker_ff_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const float *in = (const float*)input_items[0];
+ float *out = (float*)output_items[0];
+
+ if(d_long_form) {
+ float y1, y2, y3, y4, d;
+ for(int i = 0; i < noutput_items; i++) {
+ y1 = d_ma_0->filter(in[i]);
+ y2 = d_ma_1->filter(y1);
+ y3 = d_ma_2->filter(y2);
+ y4 = d_ma_3->filter(y3);
+
+ d_delay_line.push_back(d_ma_0->delayed_sig());
+ d = d_delay_line[0];
+ d_delay_line.pop_front();
+
+ out[i] = d - y4;
+ }
+ }
+ else {
+ float y1, y2;
+ for(int i = 0; i < noutput_items; i++) {
+ y1 = d_ma_0->filter(in[i]);
+ y2 = d_ma_1->filter(y1);
+ out[i] = d_ma_0->delayed_sig() - y2;
+ }
+ }
+
+ return noutput_items;
+ }
+
+ } /* namespace filter */
+} /* namespace gr */
diff --git a/gr-filter/lib/dc_blocker_ff_impl.h b/gr-filter/lib/dc_blocker_ff_impl.h
new file mode 100644
index 000000000..5ae60e2e4
--- /dev/null
+++ b/gr-filter/lib/dc_blocker_ff_impl.h
@@ -0,0 +1,76 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2011,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 INCLUDED_FILTER_DC_BLOCKER_FF_IMPL_H
+#define INCLUDED_FILTER_DC_BLOCKER_FF_IMPL_H
+
+#include <filter/dc_blocker_ff.h>
+#include <deque>
+
+namespace gr {
+ namespace filter {
+
+ class moving_averager_f
+ {
+ public:
+ moving_averager_f(int D);
+ ~moving_averager_f();
+
+ float filter(float x);
+ float delayed_sig() { return d_out; }
+
+ private:
+ int d_length;
+ float d_out, d_out_d1, d_out_d2;
+ std::deque<float> d_delay_line;
+ };
+
+ class FILTER_API dc_blocker_ff_impl : public dc_blocker_ff
+ {
+ private:
+ int d_length;
+ bool d_long_form;
+ moving_averager_f *d_ma_0;
+ moving_averager_f *d_ma_1;
+ moving_averager_f *d_ma_2;
+ moving_averager_f *d_ma_3;
+ std::deque<float> d_delay_line;
+
+ public:
+ dc_blocker_ff_impl(int D, bool long_form);
+
+ ~dc_blocker_ff_impl();
+
+ int group_delay();
+
+ //int set_length(int D);
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace filter */
+} /* namespace gr */
+
+#endif /* INCLUDED_FILTER_DC_BLOCKER_FF_IMPL_H */
diff --git a/gr-filter/lib/fft_filter.cc b/gr-filter/lib/fft_filter.cc
new file mode 100644
index 000000000..1b256a3da
--- /dev/null
+++ b/gr-filter/lib/fft_filter.cc
@@ -0,0 +1,316 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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 <filter/fft_filter.h>
+#include <volk/volk.h>
+#include <iostream>
+#include <cstring>
+
+namespace gr {
+ namespace filter {
+ namespace kernel {
+
+ #define VERBOSE 0
+
+ fft_filter_fff::fft_filter_fff(int decimation,
+ const std::vector<float> &taps,
+ int nthreads)
+ : d_fftsize(-1), d_decimation(decimation), d_fwdfft(0),
+ d_invfft(0), d_nthreads(nthreads)
+ {
+ set_taps(taps);
+ }
+
+ fft_filter_fff::~fft_filter_fff()
+ {
+ delete d_fwdfft;
+ delete d_invfft;
+ fft::free(d_xformed_taps);
+ }
+
+ /*
+ * determines d_ntaps, d_nsamples, d_fftsize, d_xformed_taps
+ */
+ int
+ fft_filter_fff::set_taps(const std::vector<float> &taps)
+ {
+ int i = 0;
+ compute_sizes(taps.size());
+
+ d_tail.resize(tailsize());
+ for(i = 0; i < tailsize(); i++)
+ d_tail[i] = 0;
+
+ float *in = d_fwdfft->get_inbuf();
+ gr_complex *out = d_fwdfft->get_outbuf();
+
+ float scale = 1.0 / d_fftsize;
+
+ // Compute forward xform of taps.
+ // Copy taps into first ntaps slots, then pad with zeros
+ for (i = 0; i < d_ntaps; i++)
+ in[i] = taps[i] * scale;
+
+ for (; i < d_fftsize; i++)
+ in[i] = 0;
+
+ d_fwdfft->execute(); // do the xform
+
+ // now copy output to d_xformed_taps
+ for (i = 0; i < d_fftsize/2+1; i++)
+ d_xformed_taps[i] = out[i];
+
+ return d_nsamples;
+ }
+
+ // determine and set d_ntaps, d_nsamples, d_fftsize
+ void
+ fft_filter_fff::compute_sizes(int ntaps)
+ {
+ int old_fftsize = d_fftsize;
+ d_ntaps = ntaps;
+ d_fftsize = (int) (2 * pow(2.0, ceil(log(double(ntaps)) / log(2.0))));
+ d_nsamples = d_fftsize - d_ntaps + 1;
+
+ if(VERBOSE) {
+ std::cerr << "fft_filter_fff: ntaps = " << d_ntaps
+ << " fftsize = " << d_fftsize
+ << " nsamples = " << d_nsamples << std::endl;
+ }
+
+ // compute new plans
+ if(d_fftsize != old_fftsize) {
+ delete d_fwdfft;
+ delete d_invfft;
+ d_fwdfft = new fft::fft_real_fwd(d_fftsize);
+ d_invfft = new fft::fft_real_rev(d_fftsize);
+ d_xformed_taps = fft::malloc_complex(d_fftsize/2+1);
+ }
+ }
+
+ void
+ fft_filter_fff::set_nthreads(int n)
+ {
+ d_nthreads = n;
+ if(d_fwdfft)
+ d_fwdfft->set_nthreads(n);
+ if(d_invfft)
+ d_invfft->set_nthreads(n);
+ }
+
+ int
+ fft_filter_fff::nthreads() const
+ {
+ return d_nthreads;
+ }
+
+ int
+ fft_filter_fff::filter(int nitems, const float *input, float *output)
+ {
+ int dec_ctr = 0;
+ int j = 0;
+ int ninput_items = nitems * d_decimation;
+
+ for (int i = 0; i < ninput_items; i += d_nsamples){
+
+ memcpy(d_fwdfft->get_inbuf(), &input[i], d_nsamples * sizeof(float));
+
+ for (j = d_nsamples; j < d_fftsize; j++)
+ d_fwdfft->get_inbuf()[j] = 0;
+
+ d_fwdfft->execute(); // compute fwd xform
+
+ gr_complex *a = d_fwdfft->get_outbuf();
+ gr_complex *b = d_xformed_taps;
+ gr_complex *c = d_invfft->get_inbuf();
+
+ volk_32fc_x2_multiply_32fc_a(c, a, b, d_fftsize/2+1);
+
+ d_invfft->execute(); // compute inv xform
+
+ // add in the overlapping tail
+ for (j = 0; j < tailsize(); j++)
+ d_invfft->get_outbuf()[j] += d_tail[j];
+
+ // copy nsamples to output
+ j = dec_ctr;
+ while (j < d_nsamples) {
+ *output++ = d_invfft->get_outbuf()[j];
+ j += d_decimation;
+ }
+ dec_ctr = (j - d_nsamples);
+
+ // stash the tail
+ memcpy(&d_tail[0], d_invfft->get_outbuf() + d_nsamples,
+ tailsize() * sizeof(float));
+ }
+
+ return nitems;
+ }
+
+
+ /**************************************************************/
+
+
+ fft_filter_ccc::fft_filter_ccc(int decimation,
+ const std::vector<gr_complex> &taps,
+ int nthreads)
+ : d_fftsize(-1), d_decimation(decimation), d_fwdfft(0),
+ d_invfft(0), d_nthreads(nthreads)
+ {
+ set_taps(taps);
+ }
+
+ fft_filter_ccc::~fft_filter_ccc()
+ {
+ delete d_fwdfft;
+ delete d_invfft;
+ fft::free(d_xformed_taps);
+ }
+
+ /*
+ * determines d_ntaps, d_nsamples, d_fftsize, d_xformed_taps
+ */
+ int
+ fft_filter_ccc::set_taps(const std::vector<gr_complex> &taps)
+ {
+ int i = 0;
+ compute_sizes(taps.size());
+
+ d_tail.resize(tailsize());
+ for(i = 0; i < tailsize(); i++)
+ d_tail[i] = 0;
+
+ gr_complex *in = d_fwdfft->get_inbuf();
+ gr_complex *out = d_fwdfft->get_outbuf();
+
+ float scale = 1.0 / d_fftsize;
+
+ // Compute forward xform of taps.
+ // Copy taps into first ntaps slots, then pad with zeros
+ for(i = 0; i < d_ntaps; i++)
+ in[i] = taps[i] * scale;
+
+ for(; i < d_fftsize; i++)
+ in[i] = 0;
+
+ d_fwdfft->execute(); // do the xform
+
+ // now copy output to d_xformed_taps
+ for(i = 0; i < d_fftsize; i++)
+ d_xformed_taps[i] = out[i];
+
+ return d_nsamples;
+ }
+
+ // determine and set d_ntaps, d_nsamples, d_fftsize
+ void
+ fft_filter_ccc::compute_sizes(int ntaps)
+ {
+ int old_fftsize = d_fftsize;
+ d_ntaps = ntaps;
+ d_fftsize = (int) (2 * pow(2.0, ceil(log(double(ntaps)) / log(2.0))));
+ d_nsamples = d_fftsize - d_ntaps + 1;
+
+ if(VERBOSE) {
+ std::cerr << "fft_filter_ccc: ntaps = " << d_ntaps
+ << " fftsize = " << d_fftsize
+ << " nsamples = " << d_nsamples << std::endl;
+ }
+
+ // compute new plans
+ if(d_fftsize != old_fftsize) {
+ delete d_fwdfft;
+ delete d_invfft;
+ d_fwdfft = new fft::fft_complex(d_fftsize, true, d_nthreads);
+ d_invfft = new fft::fft_complex(d_fftsize, false, d_nthreads);
+ d_xformed_taps = fft::malloc_complex(d_fftsize);
+ }
+ }
+
+ void
+ fft_filter_ccc::set_nthreads(int n)
+ {
+ d_nthreads = n;
+ if(d_fwdfft)
+ d_fwdfft->set_nthreads(n);
+ if(d_invfft)
+ d_invfft->set_nthreads(n);
+ }
+
+ int
+ fft_filter_ccc::nthreads() const
+ {
+ return d_nthreads;
+ }
+
+ int
+ fft_filter_ccc::filter(int nitems, const gr_complex *input, gr_complex *output)
+ {
+ int dec_ctr = 0;
+ int j = 0;
+ int ninput_items = nitems * d_decimation;
+
+ for(int i = 0; i < ninput_items; i += d_nsamples) {
+ memcpy(d_fwdfft->get_inbuf(), &input[i], d_nsamples * sizeof(gr_complex));
+
+ for(j = d_nsamples; j < d_fftsize; j++)
+ d_fwdfft->get_inbuf()[j] = 0;
+
+ d_fwdfft->execute(); // compute fwd xform
+
+ gr_complex *a = d_fwdfft->get_outbuf();
+ gr_complex *b = d_xformed_taps;
+ gr_complex *c = d_invfft->get_inbuf();
+
+ volk_32fc_x2_multiply_32fc_a(c, a, b, d_fftsize);
+
+ d_invfft->execute(); // compute inv xform
+
+ // add in the overlapping tail
+
+ for(j = 0; j < tailsize(); j++)
+ d_invfft->get_outbuf()[j] += d_tail[j];
+
+ // copy nsamples to output
+ j = dec_ctr;
+ while(j < d_nsamples) {
+ *output++ = d_invfft->get_outbuf()[j];
+ j += d_decimation;
+ }
+ dec_ctr = (j - d_nsamples);
+
+ // stash the tail
+ memcpy(&d_tail[0], d_invfft->get_outbuf() + d_nsamples,
+ tailsize() * sizeof(gr_complex));
+ }
+
+ return nitems;
+ }
+
+ } /* namespace kernel */
+ } /* namespace filter */
+} /* namespace gr */
diff --git a/gr-filter/lib/fft_filter_ccc_impl.cc b/gr-filter/lib/fft_filter_ccc_impl.cc
new file mode 100644
index 000000000..0a2002991
--- /dev/null
+++ b/gr-filter/lib/fft_filter_ccc_impl.cc
@@ -0,0 +1,118 @@
+/* -*- 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 "fft_filter_ccc_impl.h"
+#include <gr_io_signature.h>
+
+#include <math.h>
+#include <assert.h>
+#include <stdexcept>
+
+namespace gr {
+ namespace filter {
+
+ fft_filter_ccc::sptr fft_filter_ccc::make(int decimation,
+ const std::vector<gr_complex> &taps,
+ int nthreads)
+ {
+ return gnuradio::get_initial_sptr(new fft_filter_ccc_impl
+ (decimation, taps, nthreads));
+ }
+
+ fft_filter_ccc_impl::fft_filter_ccc_impl(int decimation,
+ const std::vector<gr_complex> &taps,
+ int nthreads)
+ : gr_sync_decimator("fft_filter_ccc",
+ gr_make_io_signature (1, 1, sizeof(gr_complex)),
+ gr_make_io_signature (1, 1, sizeof(gr_complex)),
+ decimation),
+ d_updated(false)
+ {
+ set_history(1);
+
+ d_filter = new kernel::fft_filter_ccc(decimation, taps, nthreads);
+
+ d_new_taps = taps;
+ d_nsamples = d_filter->set_taps(taps);
+ set_output_multiple(d_nsamples);
+ }
+
+ fft_filter_ccc_impl::~fft_filter_ccc_impl()
+ {
+ delete d_filter;
+ }
+
+ void
+ fft_filter_ccc_impl::set_taps(const std::vector<gr_complex> &taps)
+ {
+ d_new_taps = taps;
+ d_updated = true;
+ }
+
+ std::vector<gr_complex>
+ fft_filter_ccc_impl::taps() const
+ {
+ return d_new_taps;
+ }
+
+ void
+ fft_filter_ccc_impl::set_nthreads(int n)
+ {
+ if(d_filter)
+ d_filter->set_nthreads(n);
+ }
+
+ int
+ fft_filter_ccc_impl::nthreads() const
+ {
+ if(d_filter)
+ return d_filter->nthreads();
+ else
+ return 0;
+ }
+
+ int
+ fft_filter_ccc_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const gr_complex *in = (const gr_complex *) input_items[0];
+ gr_complex *out = (gr_complex *) output_items[0];
+
+ if (d_updated){
+ d_nsamples = d_filter->set_taps(d_new_taps);
+ d_updated = false;
+ set_output_multiple(d_nsamples);
+ return 0; // output multiple may have changed
+ }
+
+ d_filter->filter(noutput_items, in, out);
+
+ return noutput_items;
+ }
+
+ } /* namespace filter */
+} /* namespace gr */
diff --git a/gr-filter/lib/fft_filter_ccc_impl.h b/gr-filter/lib/fft_filter_ccc_impl.h
new file mode 100644
index 000000000..82be00915
--- /dev/null
+++ b/gr-filter/lib/fft_filter_ccc_impl.h
@@ -0,0 +1,61 @@
+/* -*- 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 INCLUDED_FILTER_FFT_FILTER_CCC_IMPL_H
+#define INCLUDED_FILTER_FFT_FILTER_CCC_IMPL_H
+
+#include <filter/api.h>
+#include <filter/fft_filter.h>
+#include <filter/fft_filter_ccc.h>
+
+namespace gr {
+ namespace filter {
+
+ class FILTER_API fft_filter_ccc_impl : public fft_filter_ccc
+ {
+ private:
+ int d_nsamples;
+ bool d_updated;
+ kernel::fft_filter_ccc *d_filter;
+ std::vector<gr_complex> d_new_taps;
+
+ public:
+ fft_filter_ccc_impl(int decimation,
+ const std::vector<gr_complex> &taps,
+ int nthreads=1);
+
+ ~fft_filter_ccc_impl();
+
+ void set_taps(const std::vector<gr_complex> &taps);
+ std::vector<gr_complex> taps() const;
+
+ void set_nthreads(int n);
+ int nthreads() const;
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace filter */
+} /* namespace gr */
+
+#endif /* INCLUDED_FILTER_FFT_FILTER_CCC_IMPL_H */
diff --git a/gr-filter/lib/fft_filter_fff_impl.cc b/gr-filter/lib/fft_filter_fff_impl.cc
new file mode 100644
index 000000000..1d6eb02db
--- /dev/null
+++ b/gr-filter/lib/fft_filter_fff_impl.cc
@@ -0,0 +1,119 @@
+/* -*- 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 "fft_filter_fff_impl.h"
+#include <gr_io_signature.h>
+
+#include <math.h>
+#include <assert.h>
+#include <stdexcept>
+
+namespace gr {
+ namespace filter {
+
+ fft_filter_fff::sptr fft_filter_fff::make(int decimation,
+ const std::vector<float> &taps,
+ int nthreads)
+ {
+ return gnuradio::get_initial_sptr(new fft_filter_fff_impl
+ (decimation, taps, nthreads));
+ }
+
+
+ fft_filter_fff_impl::fft_filter_fff_impl(int decimation,
+ const std::vector<float> &taps,
+ int nthreads)
+ : gr_sync_decimator("fft_filter_fff",
+ gr_make_io_signature (1, 1, sizeof(float)),
+ gr_make_io_signature (1, 1, sizeof(float)),
+ decimation),
+ d_updated(false)
+ {
+ set_history(1);
+
+ d_filter = new kernel::fft_filter_fff(decimation, taps, nthreads);
+
+ d_new_taps = taps;
+ d_nsamples = d_filter->set_taps(taps);
+ set_output_multiple(d_nsamples);
+ }
+
+ fft_filter_fff_impl::~fft_filter_fff_impl()
+ {
+ delete d_filter;
+ }
+
+ void
+ fft_filter_fff_impl::set_taps(const std::vector<float> &taps)
+ {
+ d_new_taps = taps;
+ d_updated = true;
+ }
+
+ std::vector<float>
+ fft_filter_fff_impl::taps() const
+ {
+ return d_new_taps;
+ }
+
+ void
+ fft_filter_fff_impl::set_nthreads(int n)
+ {
+ if(d_filter)
+ d_filter->set_nthreads(n);
+ }
+
+ int
+ fft_filter_fff_impl::nthreads() const
+ {
+ if(d_filter)
+ return d_filter->nthreads();
+ else
+ return 0;
+ }
+
+ int
+ fft_filter_fff_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const float *in = (const float *)input_items[0];
+ float *out = (float *)output_items[0];
+
+ if (d_updated){
+ d_nsamples = d_filter->set_taps(d_new_taps);
+ d_updated = false;
+ set_output_multiple(d_nsamples);
+ return 0; // output multiple may have changed
+ }
+
+ d_filter->filter(noutput_items, in, out);
+
+ return noutput_items;
+ }
+
+ } /* namespace filter */
+} /* namespace gr */
diff --git a/gr-filter/lib/fft_filter_fff_impl.h b/gr-filter/lib/fft_filter_fff_impl.h
new file mode 100644
index 000000000..df35d3df7
--- /dev/null
+++ b/gr-filter/lib/fft_filter_fff_impl.h
@@ -0,0 +1,61 @@
+/* -*- 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 INCLUDED_FILTER_FFT_FILTER_FFF_IMPL_H
+#define INCLUDED_FILTER_FFT_FILTER_FFF_IMPL_H
+
+#include <filter/api.h>
+#include <filter/fft_filter.h>
+#include <filter/fft_filter_fff.h>
+
+namespace gr {
+ namespace filter {
+
+ class FILTER_API fft_filter_fff_impl : public fft_filter_fff
+ {
+ private:
+ int d_nsamples;
+ bool d_updated;
+ kernel::fft_filter_fff *d_filter;
+ std::vector<float> d_new_taps;
+
+ public:
+ fft_filter_fff_impl(int decimation,
+ const std::vector<float> &taps,
+ int nthreads=1);
+
+ ~fft_filter_fff_impl();
+
+ void set_taps(const std::vector<float> &taps);
+ std::vector<float> taps() const;
+
+ void set_nthreads(int n);
+ int nthreads() const;
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace filter */
+} /* namespace gr */
+
+#endif /* INCLUDED_FILTER_FFT_FILTER_FFF_IMPL_H */
diff --git a/gr-filter/lib/filter_delay_fc_impl.cc b/gr-filter/lib/filter_delay_fc_impl.cc
new file mode 100644
index 000000000..3bb550864
--- /dev/null
+++ b/gr-filter/lib/filter_delay_fc_impl.cc
@@ -0,0 +1,112 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,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 "filter_delay_fc_impl.h"
+#include <volk/volk.h>
+
+namespace gr {
+ namespace filter {
+
+ filter_delay_fc::sptr filter_delay_fc::make(const std::vector<float> &taps)
+ {
+ return gnuradio::get_initial_sptr(new filter_delay_fc_impl(taps));
+ }
+
+ filter_delay_fc_impl::filter_delay_fc_impl(const std::vector<float> &taps)
+ : gr_sync_block("filter_delay_fc",
+ gr_make_io_signature(1, 2, sizeof(float)),
+ gr_make_io_signature(1, 1, sizeof(gr_complex))),
+ d_update(false)
+ {
+ d_taps = taps;
+ d_fir = new kernel::fir_filter_fff(1, taps);
+ d_delay = d_fir->ntaps() / 2;
+ set_history(d_fir->ntaps());
+
+ const int alignment_multiple =
+ volk_get_alignment() / sizeof(float);
+ set_alignment(std::max(1, alignment_multiple));
+ }
+
+ filter_delay_fc_impl::~filter_delay_fc_impl()
+ {
+ delete d_fir;
+ }
+
+ std::vector<float>
+ filter_delay_fc_impl::taps()
+ {
+ return d_fir->taps();
+ }
+
+ void
+ filter_delay_fc_impl::set_taps(const std::vector<float> &taps)
+ {
+ // don't reset taps in case history changes
+ d_taps = taps;
+ d_update = true;
+ }
+
+ int
+ filter_delay_fc_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ float *in0 = (float *)input_items[0];
+ float *in1 = (float *)input_items[1];
+ gr_complex *out = (gr_complex *)output_items[0];
+
+ if(d_update) {
+ d_fir->set_taps(d_taps);
+ d_delay = d_fir->ntaps() / 2;
+ set_history(d_fir->ntaps());
+ return 0;
+ }
+
+ switch(input_items.size ()) {
+ case 1:
+ for(int i = 0; i < noutput_items; i++) {
+ out[i] = gr_complex(in0[i + d_delay],
+ d_fir->filter(&in0[i]));
+ }
+ break;
+
+ case 2:
+ for(int j = 0; j < noutput_items; j++) {
+ out[j] = gr_complex(in0[j + d_delay],
+ d_fir->filter(&in1[j]));
+ }
+ break;
+
+ default:
+ assert(0);
+ }
+
+ return noutput_items;
+ }
+
+ } /* namespace filter */
+} /* namespace gr */
diff --git a/gr-filter/lib/filter_delay_fc_impl.h b/gr-filter/lib/filter_delay_fc_impl.h
new file mode 100644
index 000000000..5157d6e02
--- /dev/null
+++ b/gr-filter/lib/filter_delay_fc_impl.h
@@ -0,0 +1,56 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,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 INCLUDED_FILTER_FILTER_DELAY_FC_IMPL_H
+#define INCLUDED_FILTER_FILTER_DELAY_FC_IMPL_H
+
+#include <filter/filter_delay_fc.h>
+#include <filter/fir_filter.h>
+#include <gr_io_signature.h>
+
+namespace gr {
+ namespace filter {
+
+ class FILTER_API filter_delay_fc_impl : public filter_delay_fc
+ {
+ private:
+ unsigned int d_delay;
+ kernel::fir_filter_fff *d_fir;
+ std::vector<float> d_taps;
+ bool d_update;
+
+ public:
+ filter_delay_fc_impl(const std::vector<float> &taps);
+ ~filter_delay_fc_impl();
+
+ std::vector<float> taps();
+ void set_taps(const std::vector<float> &taps);
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace filter */
+} /* namespace gr */
+
+#endif /* INCLUDED_FILTER_FILTER_DELAY_FC_IMPL_H */
diff --git a/gr-filter/lib/fir_filter.cc b/gr-filter/lib/fir_filter.cc
new file mode 100644
index 000000000..d5cf3cd54
--- /dev/null
+++ b/gr-filter/lib/fir_filter.cc
@@ -0,0 +1,667 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,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.
+ */
+
+#include <filter/fir_filter.h>
+#include <fft/fft.h>
+#include <volk/volk.h>
+#include <cstdio>
+#include <cstring>
+
+namespace gr {
+ namespace filter {
+ namespace kernel {
+
+ fir_filter_fff::fir_filter_fff(int decimation,
+ const std::vector<float> &taps)
+ {
+ d_align = volk_get_alignment();
+ d_naligned = std::max((size_t)1, d_align / sizeof(float));
+
+ d_aligned_taps = NULL;
+ set_taps(taps);
+
+ // Make sure the output sample is always aligned, too.
+ d_output = fft::malloc_float(1);
+ }
+
+ fir_filter_fff::~fir_filter_fff()
+ {
+ // Free all aligned taps
+ if(d_aligned_taps != NULL) {
+ for(int i = 0; i < d_naligned; i++) {
+ fft::free(d_aligned_taps[i]);
+ }
+ ::free(d_aligned_taps);
+ d_aligned_taps = NULL;
+ }
+
+ // Free output sample
+ fft::free(d_output);
+ }
+
+ void
+ fir_filter_fff::set_taps(const std::vector<float> &taps)
+ {
+ // Free the taps if already allocated
+ if(d_aligned_taps!= NULL) {
+ for(int i = 0; i < d_naligned; i++) {
+ fft::free(d_aligned_taps[i]);
+ }
+ ::free(d_aligned_taps);
+ d_aligned_taps = NULL;
+ }
+
+ d_ntaps = (int)taps.size();
+ d_taps = taps;
+ std::reverse(d_taps.begin(), d_taps.end());
+
+ // Make a set of taps at all possible arch alignments
+ d_aligned_taps = (float**)malloc(d_naligned*sizeof(float**));
+ for(int i = 0; i < d_naligned; i++) {
+ d_aligned_taps[i] = fft::malloc_float(d_ntaps+d_naligned-1);
+ memset(d_aligned_taps[i], 0, sizeof(float)*(d_ntaps+d_naligned-1));
+ for(unsigned int j = 0; j < d_ntaps; j++)
+ d_aligned_taps[i][i+j] = d_taps[j];
+ }
+ }
+
+ std::vector<float>
+ fir_filter_fff::taps() const
+ {
+ std::vector<float> t = d_taps;
+ std::reverse(t.begin(), t.end());
+ return t;
+ }
+
+ unsigned int
+ fir_filter_fff::ntaps() const
+ {
+ return d_ntaps;
+ }
+
+ float
+ fir_filter_fff::filter(const float input[])
+ {
+ const float *ar = (float *)((unsigned long) input & ~(d_align-1));
+ unsigned al = input - ar;
+
+ volk_32f_x2_dot_prod_32f_a(d_output, ar,
+ d_aligned_taps[al],
+ d_ntaps+al);
+ return *d_output;
+ }
+
+ void
+ fir_filter_fff::filterN(float output[],
+ const float input[],
+ unsigned long n)
+ {
+ for(unsigned long i = 0; i < n; i++) {
+ output[i] = filter(&input[i]);
+ }
+ }
+
+ void
+ fir_filter_fff::filterNdec(float output[],
+ const float input[],
+ unsigned long n,
+ unsigned int decimate)
+ {
+ unsigned long j = 0;
+ for(unsigned long i = 0; i < n; i++) {
+ output[i] = filter(&input[j]);
+ j += decimate;
+ }
+ }
+
+ /**************************************************************/
+
+ fir_filter_ccf::fir_filter_ccf(int decimation,
+ const std::vector<float> &taps)
+ {
+ d_align = volk_get_alignment();
+ d_naligned = std::max((size_t)1, d_align / sizeof(gr_complex));
+
+ d_aligned_taps = NULL;
+ set_taps(taps);
+
+ // Make sure the output sample is always aligned, too.
+ d_output = fft::malloc_complex(1);
+ }
+
+ fir_filter_ccf::~fir_filter_ccf()
+ {
+ // Free all aligned taps
+ if(d_aligned_taps != NULL) {
+ for(int i = 0; i < d_naligned; i++) {
+ fft::free(d_aligned_taps[i]);
+ }
+ ::free(d_aligned_taps);
+ d_aligned_taps = NULL;
+ }
+
+ // Free output sample
+ fft::free(d_output);
+ }
+
+ void
+ fir_filter_ccf::set_taps(const std::vector<float> &taps)
+ {
+ // Free the taps if already allocated
+ if(d_aligned_taps != NULL) {
+ for(int i = 0; i < d_naligned; i++) {
+ fft::free(d_aligned_taps[i]);
+ }
+ ::free(d_aligned_taps);
+ d_aligned_taps = NULL;
+ }
+
+ d_ntaps = (int)taps.size();
+ d_taps = taps;
+ std::reverse(d_taps.begin(), d_taps.end());
+
+ // Make a set of taps at all possible arch alignments
+ d_aligned_taps = (float**)malloc(d_naligned*sizeof(float**));
+ for(int i = 0; i < d_naligned; i++) {
+ d_aligned_taps[i] = fft::malloc_float(d_ntaps+d_naligned-1);
+ memset(d_aligned_taps[i], 0, sizeof(float)*(d_ntaps+d_naligned-1));
+ for(unsigned int j = 0; j < d_ntaps; j++)
+ d_aligned_taps[i][i+j] = d_taps[j];
+ }
+ }
+
+ std::vector<float>
+ fir_filter_ccf::taps() const
+ {
+ std::vector<float> t = d_taps;
+ std::reverse(t.begin(), t.end());
+ return t;
+ }
+
+ unsigned int
+ fir_filter_ccf::ntaps() const
+ {
+ return d_ntaps;
+ }
+
+ gr_complex
+ fir_filter_ccf::filter(const gr_complex input[])
+ {
+ const gr_complex *ar = (gr_complex *)((unsigned long) input & ~(d_align-1));
+ unsigned al = input - ar;
+
+ volk_32fc_32f_dot_prod_32fc_a(d_output, ar,
+ d_aligned_taps[al],
+ (d_ntaps+al));
+ return *d_output;
+ }
+
+ void
+ fir_filter_ccf::filterN(gr_complex output[],
+ const gr_complex input[],
+ unsigned long n)
+ {
+ for(unsigned long i = 0; i < n; i++)
+ output[i] = filter(&input[i]);
+ }
+
+
+ void
+ fir_filter_ccf::filterNdec(gr_complex output[],
+ const gr_complex input[],
+ unsigned long n,
+ unsigned int decimate)
+ {
+ unsigned long j = 0;
+ for(unsigned long i = 0; i < n; i++){
+ output[i] = filter(&input[j]);
+ j += decimate;
+ }
+ }
+
+
+ /**************************************************************/
+
+
+ fir_filter_fcc::fir_filter_fcc(int decimation,
+ const std::vector<gr_complex> &taps)
+ {
+ d_align = volk_get_alignment();
+ d_naligned = std::max((size_t)1, d_align / sizeof(float));
+
+ d_aligned_taps = NULL;
+ set_taps(taps);
+
+ // Make sure the output sample is always aligned, too.
+ d_output = fft::malloc_complex(1);
+ }
+
+ fir_filter_fcc::~fir_filter_fcc()
+ {
+ // Free all aligned taps
+ if(d_aligned_taps != NULL) {
+ for(int i = 0; i < d_naligned; i++) {
+ fft::free(d_aligned_taps[i]);
+ }
+ ::free(d_aligned_taps);
+ d_aligned_taps = NULL;
+ }
+
+ // Free output sample
+ fft::free(d_output);
+ }
+
+ void
+ fir_filter_fcc::set_taps(const std::vector<gr_complex> &taps)
+ {
+ // Free the taps if already allocated
+ if(d_aligned_taps != NULL) {
+ for(int i = 0; i < d_naligned; i++) {
+ fft::free(d_aligned_taps[i]);
+ }
+ ::free(d_aligned_taps);
+ d_aligned_taps = NULL;
+ }
+
+ d_ntaps = (int)taps.size();
+ d_taps = taps;
+ std::reverse(d_taps.begin(), d_taps.end());
+
+ // Make a set of taps at all possible arch alignments
+ d_aligned_taps = (gr_complex**)malloc(d_naligned*sizeof(gr_complex**));
+ for(int i = 0; i < d_naligned; i++) {
+ d_aligned_taps[i] = fft::malloc_complex(d_ntaps+d_naligned-1);
+ memset(d_aligned_taps[i], 0, sizeof(gr_complex)*(d_ntaps+d_naligned-1));
+ for(unsigned int j = 0; j < d_ntaps; j++)
+ d_aligned_taps[i][i+j] = d_taps[j];
+ }
+ }
+
+ std::vector<gr_complex>
+ fir_filter_fcc::taps() const
+ {
+ std::vector<gr_complex> t = d_taps;
+ std::reverse(t.begin(), t.end());
+ return t;
+ }
+
+ unsigned int
+ fir_filter_fcc::ntaps() const
+ {
+ return d_ntaps;
+ }
+
+ gr_complex
+ fir_filter_fcc::filter(const float input[])
+ {
+ const float *ar = (float *)((unsigned long) input & ~(d_align-1));
+ unsigned al = input - ar;
+
+ volk_32fc_32f_dot_prod_32fc_a(d_output,
+ d_aligned_taps[al],
+ ar,
+ (d_ntaps+al));
+ return *d_output;
+ }
+
+ void
+ fir_filter_fcc::filterN(gr_complex output[],
+ const float input[],
+ unsigned long n)
+ {
+ for(unsigned long i = 0; i < n; i++)
+ output[i] = filter(&input[i]);
+ }
+
+
+ void
+ fir_filter_fcc::filterNdec(gr_complex output[],
+ const float input[],
+ unsigned long n,
+ unsigned int decimate)
+ {
+ unsigned long j = 0;
+ for(unsigned long i = 0; i < n; i++){
+ output[i] = filter(&input[j]);
+ j += decimate;
+ }
+ }
+
+ /**************************************************************/
+
+ fir_filter_ccc::fir_filter_ccc(int decimation,
+ const std::vector<gr_complex> &taps)
+ {
+ d_align = volk_get_alignment();
+ d_naligned = std::max((size_t)1, d_align / sizeof(gr_complex));
+
+ d_aligned_taps = NULL;
+ set_taps(taps);
+
+ // Make sure the output sample is always aligned, too.
+ d_output = fft::malloc_complex(1);
+ }
+
+ fir_filter_ccc::~fir_filter_ccc()
+ {
+ // Free all aligned taps
+ if(d_aligned_taps != NULL) {
+ for(int i = 0; i < d_naligned; i++) {
+ fft::free(d_aligned_taps[i]);
+ }
+ ::free(d_aligned_taps);
+ d_aligned_taps = NULL;
+ }
+
+ // Free output sample
+ fft::free(d_output);
+ }
+
+ void
+ fir_filter_ccc::set_taps(const std::vector<gr_complex> &taps)
+ {
+ // Free the taps if already allocated
+ if(d_aligned_taps != NULL) {
+ for(int i = 0; i < d_naligned; i++) {
+ fft::free(d_aligned_taps[i]);
+ }
+ ::free(d_aligned_taps);
+ d_aligned_taps = NULL;
+ }
+
+ d_ntaps = (int)taps.size();
+ d_taps = taps;
+ std::reverse(d_taps.begin(), d_taps.end());
+
+ // Make a set of taps at all possible arch alignments
+ d_aligned_taps = (gr_complex**)malloc(d_naligned*sizeof(gr_complex**));
+ for(int i = 0; i < d_naligned; i++) {
+ d_aligned_taps[i] = fft::malloc_complex(d_ntaps+d_naligned-1);
+ memset(d_aligned_taps[i], 0, sizeof(gr_complex)*(d_ntaps+d_naligned-1));
+ for(unsigned int j = 0; j < d_ntaps; j++)
+ d_aligned_taps[i][i+j] = d_taps[j];
+ }
+ }
+
+ std::vector<gr_complex>
+ fir_filter_ccc::taps() const
+ {
+ std::vector<gr_complex> t = d_taps;
+ std::reverse(t.begin(), t.end());
+ return t;
+ }
+
+ unsigned int
+ fir_filter_ccc::ntaps() const
+ {
+ return d_ntaps;
+ }
+
+ gr_complex
+ fir_filter_ccc::filter(const gr_complex input[])
+ {
+ const gr_complex *ar = (gr_complex *)((unsigned long) input & ~(d_align-1));
+ unsigned al = input - ar;
+
+ volk_32fc_x2_dot_prod_32fc_a(d_output, ar,
+ d_aligned_taps[al],
+ (d_ntaps+al));
+ return *d_output;
+ }
+
+ void
+ fir_filter_ccc::filterN(gr_complex output[],
+ const gr_complex input[],
+ unsigned long n)
+ {
+ for(unsigned long i = 0; i < n; i++)
+ output[i] = filter(&input[i]);
+ }
+
+
+ void
+ fir_filter_ccc::filterNdec(gr_complex output[],
+ const gr_complex input[],
+ unsigned long n,
+ unsigned int decimate)
+ {
+ unsigned long j = 0;
+ for(unsigned long i = 0; i < n; i++){
+ output[i] = filter(&input[j]);
+ j += decimate;
+ }
+ }
+
+ /**************************************************************/
+
+ fir_filter_scc::fir_filter_scc(int decimation,
+ const std::vector<gr_complex> &taps)
+ {
+ d_align = volk_get_alignment();
+ d_naligned = std::max((size_t)1, d_align / sizeof(short));
+
+ d_aligned_taps = NULL;
+ set_taps(taps);
+
+ // Make sure the output sample is always aligned, too.
+ d_output = fft::malloc_complex(1);
+ }
+
+ fir_filter_scc::~fir_filter_scc()
+ {
+ // Free all aligned taps
+ if(d_aligned_taps != NULL) {
+ for(int i = 0; i < d_naligned; i++) {
+ fft::free(d_aligned_taps[i]);
+ }
+ ::free(d_aligned_taps);
+ d_aligned_taps = NULL;
+ }
+
+ // Free output sample
+ fft::free(d_output);
+ }
+
+ void
+ fir_filter_scc::set_taps(const std::vector<gr_complex> &taps)
+ {
+ // Free the taps if already allocated
+ if(d_aligned_taps != NULL) {
+ for(int i = 0; i < d_naligned; i++) {
+ fft::free(d_aligned_taps[i]);
+ }
+ ::free(d_aligned_taps);
+ d_aligned_taps = NULL;
+ }
+
+ d_ntaps = (int)taps.size();
+ d_taps = taps;
+ std::reverse(d_taps.begin(), d_taps.end());
+
+ // Make a set of taps at all possible arch alignments
+ d_aligned_taps = (gr_complex**)malloc(d_naligned*sizeof(gr_complex**));
+ for(int i = 0; i < d_naligned; i++) {
+ d_aligned_taps[i] = fft::malloc_complex(d_ntaps+d_naligned-1);
+ memset(d_aligned_taps[i], 0, sizeof(gr_complex)*(d_ntaps+d_naligned-1));
+ for(unsigned int j = 0; j < d_ntaps; j++)
+ d_aligned_taps[i][i+j] = d_taps[j];
+ }
+ }
+
+ std::vector<gr_complex>
+ fir_filter_scc::taps() const
+ {
+ std::vector<gr_complex> t = d_taps;
+ std::reverse(t.begin(), t.end());
+ return t;
+ }
+
+ unsigned int
+ fir_filter_scc::ntaps() const
+ {
+ return d_ntaps;
+ }
+
+ gr_complex
+ fir_filter_scc::filter(const short input[])
+ {
+ const short *ar = (short *)((unsigned long) input & ~(d_align-1));
+ unsigned al = input - ar;
+
+ volk_16i_32fc_dot_prod_32fc_a(d_output, ar,
+ d_aligned_taps[al],
+ (d_ntaps+al));
+
+ return *d_output;
+ }
+
+ void
+ fir_filter_scc::filterN(gr_complex output[],
+ const short input[],
+ unsigned long n)
+ {
+ for(unsigned long i = 0; i < n; i++)
+ output[i] = filter(&input[i]);
+ }
+
+
+ void
+ fir_filter_scc::filterNdec(gr_complex output[],
+ const short input[],
+ unsigned long n,
+ unsigned int decimate)
+ {
+ unsigned long j = 0;
+ for(unsigned long i = 0; i < n; i++){
+ output[i] = filter(&input[j]);
+ j += decimate;
+ }
+ }
+
+ /**************************************************************/
+
+ fir_filter_fsf::fir_filter_fsf(int decimation,
+ const std::vector<float> &taps)
+ {
+ d_align = volk_get_alignment();
+ d_naligned = std::max((size_t)1, d_align / sizeof(float));
+
+ d_aligned_taps = NULL;
+ set_taps(taps);
+
+ // Make sure the output sample is always aligned, too.
+ d_output = (short*)fft::malloc_float(1);
+ }
+
+ fir_filter_fsf::~fir_filter_fsf()
+ {
+ // Free all aligned taps
+ if(d_aligned_taps != NULL) {
+ for(int i = 0; i < d_naligned; i++) {
+ fft::free(d_aligned_taps[i]);
+ }
+ ::free(d_aligned_taps);
+ d_aligned_taps = NULL;
+ }
+
+ // Free output sample
+ fft::free(d_output);
+ }
+
+ void
+ fir_filter_fsf::set_taps(const std::vector<float> &taps)
+ {
+ // Free the taps if already allocated
+ if(d_aligned_taps != NULL) {
+ for(int i = 0; i < d_naligned; i++) {
+ fft::free(d_aligned_taps[i]);
+ }
+ ::free(d_aligned_taps);
+ d_aligned_taps = NULL;
+ }
+
+ d_ntaps = (int)taps.size();
+ d_taps = taps;
+ std::reverse(d_taps.begin(), d_taps.end());
+
+ // Make a set of taps at all possible arch alignments
+ d_aligned_taps = (float**)malloc(d_naligned*sizeof(float**));
+ for(int i = 0; i < d_naligned; i++) {
+ d_aligned_taps[i] = fft::malloc_float(d_ntaps+d_naligned-1);
+ memset(d_aligned_taps[i], 0, sizeof(float)*(d_ntaps+d_naligned-1));
+ for(unsigned int j = 0; j < d_ntaps; j++)
+ d_aligned_taps[i][i+j] = d_taps[j];
+ }
+ }
+
+ std::vector<float>
+ fir_filter_fsf::taps() const
+ {
+ std::vector<float> t = d_taps;
+ std::reverse(t.begin(), t.end());
+ return t;
+ }
+
+ unsigned int
+ fir_filter_fsf::ntaps() const
+ {
+ return d_ntaps;
+ }
+
+ short
+ fir_filter_fsf::filter(const float input[])
+ {
+ const float *ar = (float *)((unsigned long) input & ~(d_align-1));
+ unsigned al = input - ar;
+
+ volk_32f_x2_dot_prod_16i_a(d_output, ar,
+ d_aligned_taps[al],
+ (d_ntaps+al));
+
+ return *d_output;
+ }
+
+ void
+ fir_filter_fsf::filterN(short output[],
+ const float input[],
+ unsigned long n)
+ {
+ for(unsigned long i = 0; i < n; i++)
+ output[i] = filter(&input[i]);
+ }
+
+ void
+ fir_filter_fsf::filterNdec(short output[],
+ const float input[],
+ unsigned long n,
+ unsigned int decimate)
+ {
+ unsigned long j = 0;
+ for(unsigned long i = 0; i < n; i++){
+ output[i] = filter(&input[j]);
+ j += decimate;
+ }
+ }
+
+ } /* namespace kernel */
+ } /* namespace filter */
+} /* namespace gr */
diff --git a/gr-filter/lib/fir_filter_XXX_impl.cc.t b/gr-filter/lib/fir_filter_XXX_impl.cc.t
new file mode 100644
index 000000000..319c26727
--- /dev/null
+++ b/gr-filter/lib/fir_filter_XXX_impl.cc.t
@@ -0,0 +1,107 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,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.
+ */
+
+/* @WARNING@ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "@IMPL_NAME@.h"
+#include <gr_io_signature.h>
+#include <volk/volk.h>
+
+namespace gr {
+ namespace filter {
+
+ @BASE_NAME@::sptr
+ @BASE_NAME@::make(int decimation, const std::vector<@TAP_TYPE@> &taps)
+ {
+ return gnuradio::get_initial_sptr(new @IMPL_NAME@
+ (decimation, taps));
+ }
+
+
+ @IMPL_NAME@::@IMPL_NAME@(int decimation, const std::vector<@TAP_TYPE@> &taps)
+ : gr_sync_decimator("@BASE_NAME@",
+ gr_make_io_signature(1, 1, sizeof(@I_TYPE@)),
+ gr_make_io_signature(1, 1, sizeof(@O_TYPE@)),
+ decimation)
+ {
+ d_fir = new kernel::@BASE_NAME@(decimation, taps);
+ d_updated = false;
+ set_history(d_fir->ntaps());
+
+ const int alignment_multiple =
+ volk_get_alignment() / sizeof(float);
+ set_alignment(std::max(1, alignment_multiple));
+ }
+
+ @IMPL_NAME@::~@IMPL_NAME@()
+ {
+ delete d_fir;
+ }
+
+ void
+ @IMPL_NAME@::set_taps(const std::vector<@TAP_TYPE@> &taps)
+ {
+ gruel::scoped_lock l(d_setlock);
+ d_fir->set_taps(taps);
+ d_updated = true;
+ }
+
+ std::vector<@TAP_TYPE@>
+ @IMPL_NAME@::taps() const
+ {
+ return d_fir->taps();
+ }
+
+ int
+ @IMPL_NAME@::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ gruel::scoped_lock l(d_setlock);
+
+ const @I_TYPE@ *in = (const @I_TYPE@*)input_items[0];
+ @O_TYPE@ *out = (@O_TYPE@*)output_items[0];
+
+ if (d_updated) {
+ set_history(d_fir->ntaps());
+ d_updated = false;
+ return 0; // history requirements may have changed.
+ }
+
+ if (decimation() == 1) {
+ d_fir->filterN(out, in, noutput_items);
+ }
+ else {
+ d_fir->filterNdec(out, in, noutput_items,
+ decimation());
+ }
+
+ return noutput_items;
+ }
+
+ } /* namespace filter */
+} /* namespace gr */
+
diff --git a/gr-filter/lib/fir_filter_XXX_impl.h.t b/gr-filter/lib/fir_filter_XXX_impl.h.t
new file mode 100644
index 000000000..ef0a7adfe
--- /dev/null
+++ b/gr-filter/lib/fir_filter_XXX_impl.h.t
@@ -0,0 +1,56 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,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 <filter/fir_filter.h>
+#include <filter/@BASE_NAME@.h>
+
+namespace gr {
+ namespace filter {
+
+ class FILTER_API @IMPL_NAME@ : public @BASE_NAME@
+ {
+ private:
+ kernel::@BASE_NAME@ *d_fir;
+ bool d_updated;
+
+ public:
+ @IMPL_NAME@(int decimation, const std::vector<@TAP_TYPE@> &taps);
+
+ ~@IMPL_NAME@();
+
+ void set_taps(const std::vector<@TAP_TYPE@> &taps);
+ std::vector<@TAP_TYPE@> taps() const;
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace filter */
+} /* namespace gr */
+
+#endif /* @GUARD_NAME@ */
diff --git a/gr-filter/lib/fir_filter_with_buffer.cc b/gr-filter/lib/fir_filter_with_buffer.cc
new file mode 100644
index 000000000..7c37361c1
--- /dev/null
+++ b/gr-filter/lib/fir_filter_with_buffer.cc
@@ -0,0 +1,496 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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 <filter/fir_filter_with_buffer.h>
+#include <fft/fft.h>
+#include <volk/volk.h>
+#include <algorithm>
+#include <cstdio>
+#include <cstring>
+
+namespace gr {
+ namespace filter {
+ namespace kernel {
+
+ fir_filter_with_buffer_fff::fir_filter_with_buffer_fff(const std::vector<float> &taps)
+ {
+ d_align = volk_get_alignment();
+ d_naligned = std::max((size_t)1, d_align / sizeof(float));
+
+ d_buffer_ptr = NULL;
+ d_aligned_taps = NULL;
+ set_taps(taps);
+
+ // Make sure the output sample is always aligned, too.
+ d_output = fft::malloc_float(1);
+ }
+
+ fir_filter_with_buffer_fff::~fir_filter_with_buffer_fff()
+ {
+ if(d_buffer_ptr != NULL) {
+ fft::free(d_buffer_ptr);
+ d_buffer_ptr = NULL;
+ }
+
+ // Free aligned taps
+ if(d_aligned_taps != NULL) {
+ for(int i = 0; i < d_naligned; i++) {
+ fft::free(d_aligned_taps[i]);
+ }
+ ::free(d_aligned_taps);
+ d_aligned_taps = NULL;
+ }
+
+ // Free output sample
+ fft::free(d_output);
+ }
+
+ void
+ fir_filter_with_buffer_fff::set_taps(const std::vector<float> &taps)
+ {
+ if(d_buffer_ptr != NULL) {
+ fft::free(d_buffer_ptr);
+ d_buffer_ptr = NULL;
+ }
+
+ // Free the taps if already allocated
+ if(d_aligned_taps != NULL) {
+ for(int i = 0; i < d_naligned; i++) {
+ fft::free(d_aligned_taps[i]);
+ }
+ ::free(d_aligned_taps);
+ d_aligned_taps = NULL;
+ }
+
+ d_ntaps = (int)taps.size();
+ d_taps = taps;
+ std::reverse(d_taps.begin(), d_taps.end());
+
+ // We allocate enough to be able to look back and forth
+ // d_naligned beyond the buffer boundaries and make sure these
+ // are zeroed out (or they may be nan, which will cause
+ // problems). We then set d_buffer to the position in the
+ // d_buffer_ptr such that we only touch the internally
+ // allocated space.
+ d_buffer_ptr = fft::malloc_float(2*(d_ntaps + d_naligned));
+ memset(d_buffer_ptr, 0, 2*(d_ntaps + d_naligned)*sizeof(float));
+ d_buffer = d_buffer_ptr + d_naligned;
+
+ // Allocate aligned taps
+ d_aligned_taps = (float**)malloc(d_naligned*sizeof(float**));
+ for(int i = 0; i < d_naligned; i++) {
+ d_aligned_taps[i] = fft::malloc_float(d_ntaps+d_naligned-1);
+ memset(d_aligned_taps[i], 0, sizeof(float)*(d_ntaps+d_naligned-1));
+ for(unsigned int j = 0; j < d_ntaps; j++)
+ d_aligned_taps[i][i+j] = d_taps[j];
+ }
+
+ d_idx = 0;
+ }
+
+ std::vector<float>
+ fir_filter_with_buffer_fff::taps() const
+ {
+ std::vector<float> t = d_taps;
+ std::reverse(t.begin(), t.end());
+ return t;
+ }
+
+ float
+ fir_filter_with_buffer_fff::filter(float input)
+ {
+ d_buffer[d_idx] = input;
+ d_buffer[d_idx+ntaps()] = input;
+
+ d_idx++;
+ if(d_idx >= ntaps())
+ d_idx = 0;
+
+ const float *ar = (float*)((unsigned long)(&d_buffer[d_idx]) & ~(d_align-1));
+ unsigned al = (&d_buffer[d_idx]) - ar;
+
+ volk_32f_x2_dot_prod_32f_a(d_output, ar,
+ d_aligned_taps[al],
+ ntaps()+al);
+ return *d_output;
+ }
+
+ float
+ fir_filter_with_buffer_fff::filter(const float input[],
+ unsigned long dec)
+ {
+ unsigned int i;
+
+ for(i = 0; i < dec; i++) {
+ d_buffer[d_idx] = input[i];
+ d_buffer[d_idx+ntaps()] = input[i];
+ d_idx++;
+ if(d_idx >= ntaps())
+ d_idx = 0;
+ }
+
+ const float *ar = (float*)((unsigned long)(&d_buffer[d_idx]) & ~(d_align-1));
+ unsigned al = (&d_buffer[d_idx]) - ar;
+
+ volk_32f_x2_dot_prod_32f_a(d_output, ar,
+ d_aligned_taps[al],
+ ntaps()+al);
+ return *d_output;
+ }
+
+ void
+ fir_filter_with_buffer_fff::filterN(float output[],
+ const float input[],
+ unsigned long n)
+ {
+ for(unsigned long i = 0; i < n; i++) {
+ output[i] = filter(input[i]);
+ }
+ }
+
+ void
+ fir_filter_with_buffer_fff::filterNdec(float output[],
+ const float input[],
+ unsigned long n,
+ unsigned long decimate)
+ {
+ unsigned long j = 0;
+ for(unsigned long i = 0; i < n; i++) {
+ output[i] = filter(&input[j], decimate);
+ j += decimate;
+ }
+ }
+
+
+ /**************************************************************/
+
+
+ fir_filter_with_buffer_ccc::fir_filter_with_buffer_ccc(const std::vector<gr_complex> &taps)
+ {
+ d_align = volk_get_alignment();
+ d_naligned = std::max((size_t)1, d_align / sizeof(gr_complex));
+
+ d_buffer_ptr = NULL;
+ d_aligned_taps = NULL;
+ set_taps(taps);
+
+ // Make sure the output sample is always aligned, too.
+ d_output = fft::malloc_complex(1);
+ }
+
+ fir_filter_with_buffer_ccc::~fir_filter_with_buffer_ccc()
+ {
+ if(d_buffer_ptr != NULL) {
+ fft::free(d_buffer_ptr);
+ d_buffer_ptr = NULL;
+ }
+
+ // Free aligned taps
+ if(d_aligned_taps != NULL) {
+ for(int i = 0; i < d_naligned; i++) {
+ fft::free(d_aligned_taps[i]);
+ }
+ ::free(d_aligned_taps);
+ d_aligned_taps = NULL;
+ }
+
+ // Free output sample
+ fft::free(d_output);
+ }
+
+ void
+ fir_filter_with_buffer_ccc::set_taps(const std::vector<gr_complex> &taps)
+ {
+ if(d_buffer_ptr != NULL) {
+ fft::free(d_buffer_ptr);
+ d_buffer_ptr = NULL;
+ }
+
+ // Free the taps if already allocated
+ if(d_aligned_taps != NULL) {
+ for(int i = 0; i < d_naligned; i++) {
+ fft::free(d_aligned_taps[i]);
+ }
+ ::free(d_aligned_taps);
+ d_aligned_taps = NULL;
+ }
+
+ d_ntaps = (int)taps.size();
+ d_taps = taps;
+ std::reverse(d_taps.begin(), d_taps.end());
+
+ // We allocate enough to be able to look back and forth
+ // d_naligned beyond the buffer boundaries and make sure these
+ // are zeroed out (or they may be nan, which will cause
+ // problems). We then set d_buffer to the position in the
+ // d_buffer_ptr such that we only touch the internally
+ // allocated space.
+ d_buffer_ptr = fft::malloc_complex(2*(d_ntaps + d_naligned));
+ memset(d_buffer_ptr, 0, 2*(d_ntaps + d_naligned)*sizeof(gr_complex));
+ d_buffer = d_buffer_ptr + d_naligned;
+
+ // Allocate aligned taps
+ d_aligned_taps = (gr_complex**)malloc(d_naligned*sizeof(gr_complex**));
+ for(int i = 0; i < d_naligned; i++) {
+ d_aligned_taps[i] = fft::malloc_complex(d_ntaps+d_naligned-1);
+ memset(d_aligned_taps[i], 0, sizeof(gr_complex)*(d_ntaps+d_naligned-1));
+ for(unsigned int j = 0; j < d_ntaps; j++)
+ d_aligned_taps[i][i+j] = d_taps[j];
+ }
+
+ d_idx = 0;
+ }
+
+ std::vector<gr_complex>
+ fir_filter_with_buffer_ccc::taps() const
+ {
+ std::vector<gr_complex> t = d_taps;
+ std::reverse(t.begin(), t.end());
+ return t;
+ }
+
+ gr_complex
+ fir_filter_with_buffer_ccc::filter(gr_complex input)
+ {
+ d_buffer[d_idx] = input;
+ d_buffer[d_idx+ntaps()] = input;
+
+ d_idx++;
+ if(d_idx >= ntaps())
+ d_idx = 0;
+
+ const gr_complex *ar = (gr_complex *)((unsigned long)(&d_buffer[d_idx]) & ~(d_align-1));
+ unsigned al = (&d_buffer[d_idx]) - ar;
+
+ volk_32fc_x2_dot_prod_32fc_a(d_output, ar,
+ d_aligned_taps[al],
+ (ntaps()+al));
+ return *d_output;
+ }
+
+ gr_complex
+ fir_filter_with_buffer_ccc::filter(const gr_complex input[],
+ unsigned long dec)
+ {
+ unsigned int i;
+
+ for(i = 0; i < dec; i++) {
+ d_buffer[d_idx] = input[i];
+ d_buffer[d_idx+ntaps()] = input[i];
+ d_idx++;
+ if(d_idx >= ntaps())
+ d_idx = 0;
+ }
+
+ const gr_complex *ar = (gr_complex *)((unsigned long)(&d_buffer[d_idx]) & ~(d_align-1));
+ unsigned al = (&d_buffer[d_idx]) - ar;
+
+ volk_32fc_x2_dot_prod_32fc_a(d_output, ar,
+ d_aligned_taps[al],
+ (ntaps()+al));
+ return *d_output;
+ }
+
+ void
+ fir_filter_with_buffer_ccc::filterN(gr_complex output[],
+ const gr_complex input[],
+ unsigned long n)
+ {
+ for(unsigned long i = 0; i < n; i++) {
+ output[i] = filter(input[i]);
+ }
+ }
+
+ void
+ fir_filter_with_buffer_ccc::filterNdec(gr_complex output[],
+ const gr_complex input[],
+ unsigned long n,
+ unsigned long decimate)
+ {
+ unsigned long j = 0;
+ for(unsigned long i = 0; i < n; i++) {
+ output[i] = filter(&input[j], decimate);
+ j += decimate;
+ }
+ }
+
+
+ /**************************************************************/
+
+
+ fir_filter_with_buffer_ccf::fir_filter_with_buffer_ccf(const std::vector<float> &taps)
+ {
+ d_align = volk_get_alignment();
+ d_naligned = std::max((size_t)1, d_align / sizeof(gr_complex));
+
+ d_buffer_ptr = NULL;
+ d_aligned_taps = NULL;
+ set_taps(taps);
+
+ // Make sure the output sample is always aligned, too.
+ d_output = fft::malloc_complex(1);
+ }
+
+ fir_filter_with_buffer_ccf::~fir_filter_with_buffer_ccf()
+ {
+ if(d_buffer_ptr != NULL) {
+ fft::free(d_buffer_ptr);
+ d_buffer_ptr = NULL;
+ }
+
+ // Free aligned taps
+ if(d_aligned_taps != NULL) {
+ for(int i = 0; i < d_naligned; i++) {
+ fft::free(d_aligned_taps[i]);
+ }
+ ::free(d_aligned_taps);
+ d_aligned_taps = NULL;
+ }
+
+ // Free output sample
+ fft::free(d_output);
+ }
+
+ void
+ fir_filter_with_buffer_ccf::set_taps(const std::vector<float> &taps)
+ {
+ if(d_buffer_ptr != NULL) {
+ fft::free(d_buffer_ptr);
+ d_buffer_ptr = NULL;
+ }
+
+ // Free the taps if already allocated
+ if(d_aligned_taps != NULL) {
+ for(int i = 0; i < d_naligned; i++) {
+ fft::free(d_aligned_taps[i]);
+ }
+ ::free(d_aligned_taps);
+ d_aligned_taps = NULL;
+ }
+
+ d_ntaps = (int)taps.size();
+ d_taps = taps;
+ std::reverse(d_taps.begin(), d_taps.end());
+
+ // We allocate enough to be able to look back and forth
+ // d_naligned beyond the buffer boundaries and make sure these
+ // are zeroed out (or they may be nan, which will cause
+ // problems). We then set d_buffer to the position in the
+ // d_buffer_ptr such that we only touch the internally
+ // allocated space.
+ d_buffer_ptr = fft::malloc_complex(2*(d_ntaps + d_naligned));
+ memset(d_buffer_ptr, 0, 2*(d_ntaps + d_naligned)*sizeof(gr_complex));
+ d_buffer = d_buffer_ptr + d_naligned;
+
+ // Allocate aligned taps
+ d_aligned_taps = (float**)malloc(d_naligned*sizeof(float**));
+ for(int i = 0; i < d_naligned; i++) {
+ d_aligned_taps[i] = fft::malloc_float(d_ntaps+d_naligned-1);
+ memset(d_aligned_taps[i], 0, sizeof(float)*(d_ntaps+d_naligned-1));
+ for(unsigned int j = 0; j < d_ntaps; j++)
+ d_aligned_taps[i][i+j] = d_taps[j];
+ }
+
+ d_idx = 0;
+ }
+
+ std::vector<float>
+ fir_filter_with_buffer_ccf::taps() const
+ {
+ std::vector<float> t = d_taps;
+ std::reverse(t.begin(), t.end());
+ return t;
+ }
+
+ gr_complex
+ fir_filter_with_buffer_ccf::filter(gr_complex input)
+ {
+ d_buffer[d_idx] = input;
+ d_buffer[d_idx+ntaps()] = input;
+
+ d_idx++;
+ if(d_idx >= ntaps())
+ d_idx = 0;
+
+ const gr_complex *ar = (gr_complex *)((unsigned long)(&d_buffer[d_idx]) & ~(d_align-1));
+ unsigned al = (&d_buffer[d_idx]) - ar;
+
+ volk_32fc_32f_dot_prod_32fc_a(d_output, ar,
+ d_aligned_taps[al],
+ ntaps()+al);
+ return *d_output;
+ }
+
+ gr_complex
+ fir_filter_with_buffer_ccf::filter(const gr_complex input[],
+ unsigned long dec)
+ {
+ unsigned int i;
+
+ for(i = 0; i < dec; i++) {
+ d_buffer[d_idx] = input[i];
+ d_buffer[d_idx+ntaps()] = input[i];
+ d_idx++;
+ if(d_idx >= ntaps())
+ d_idx = 0;
+ }
+
+ const gr_complex *ar = (gr_complex *)((unsigned long)(&d_buffer[d_idx]) & ~(d_align-1));
+ unsigned al = (&d_buffer[d_idx]) - ar;
+
+ volk_32fc_32f_dot_prod_32fc_a(d_output, ar,
+ d_aligned_taps[al],
+ ntaps()+al);
+ return *d_output;
+ }
+
+ void
+ fir_filter_with_buffer_ccf::filterN(gr_complex output[],
+ const gr_complex input[],
+ unsigned long n)
+ {
+ for(unsigned long i = 0; i < n; i++) {
+ output[i] = filter(input[i]);
+ }
+ }
+
+ void
+ fir_filter_with_buffer_ccf::filterNdec(gr_complex output[],
+ const gr_complex input[],
+ unsigned long n,
+ unsigned long decimate)
+ {
+ unsigned long j = 0;
+ for(unsigned long i = 0; i < n; i++) {
+ output[i] = filter(&input[j], decimate);
+ j += decimate;
+ }
+ }
+
+
+ } /* namespace kernel */
+ } /* namespace filter */
+} /* namespace gr */
diff --git a/gr-filter/lib/firdes.cc b/gr-filter/lib/firdes.cc
new file mode 100644
index 000000000..5c3320d71
--- /dev/null
+++ b/gr-filter/lib/firdes.cc
@@ -0,0 +1,855 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002,2007,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <filter/firdes.h>
+#include <stdexcept>
+
+using std::vector;
+
+namespace gr {
+ namespace filter {
+
+#define IzeroEPSILON 1E-21 /* Max error acceptable in Izero */
+
+ static double Izero(double x)
+ {
+ double sum, u, halfx, temp;
+ int n;
+
+ sum = u = n = 1;
+ halfx = x/2.0;
+ do {
+ temp = halfx/(double)n;
+ n += 1;
+ temp *= temp;
+ u *= temp;
+ sum += u;
+ } while (u >= IzeroEPSILON*sum);
+ return(sum);
+ }
+
+
+ //
+ // === Low Pass ===
+ //
+
+ vector<float>
+ firdes::low_pass_2(double gain,
+ double sampling_freq, // Hz
+ double cutoff_freq, // Hz BEGINNING of transition band
+ double transition_width, // Hz width of transition band
+ double attenuation_dB, // attenuation dB
+ win_type window_type,
+ double beta) // used only with Kaiser
+ {
+ sanity_check_1f(sampling_freq, cutoff_freq, transition_width);
+
+ int ntaps = compute_ntaps_windes(sampling_freq,
+ transition_width,
+ attenuation_dB);
+
+ // construct the truncated ideal impulse response
+ // [sin(x)/x for the low pass case]
+
+ vector<float> taps(ntaps);
+ vector<float> w = window(window_type, ntaps, beta);
+
+ int M = (ntaps - 1) / 2;
+ double fwT0 = 2 * M_PI * cutoff_freq / sampling_freq;
+ for(int n = -M; n <= M; n++) {
+ if (n == 0)
+ taps[n + M] = fwT0 / M_PI * w[n + M];
+ else {
+ // a little algebra gets this into the more familiar sin(x)/x form
+ taps[n + M] = sin(n * fwT0) / (n * M_PI) * w[n + M];
+ }
+ }
+
+ // find the factor to normalize the gain, fmax.
+ // For low-pass, gain @ zero freq = 1.0
+
+ double fmax = taps[0 + M];
+ for(int n = 1; n <= M; n++)
+ fmax += 2 * taps[n + M];
+
+ gain /= fmax; // normalize
+
+ for(int i = 0; i < ntaps; i++)
+ taps[i] *= gain;
+
+ return taps;
+ }
+
+ vector<float>
+ firdes::low_pass(double gain,
+ double sampling_freq,
+ double cutoff_freq, // Hz center of transition band
+ double transition_width, // Hz width of transition band
+ win_type window_type,
+ double beta) // used only with Kaiser
+ {
+ sanity_check_1f(sampling_freq, cutoff_freq, transition_width);
+
+ int ntaps = compute_ntaps(sampling_freq,
+ transition_width,
+ window_type, beta);
+
+ // construct the truncated ideal impulse response
+ // [sin(x)/x for the low pass case]
+
+ vector<float> taps(ntaps);
+ vector<float> w = window(window_type, ntaps, beta);
+
+ int M = (ntaps - 1) / 2;
+ double fwT0 = 2 * M_PI * cutoff_freq / sampling_freq;
+
+ for(int n = -M; n <= M; n++) {
+ if(n == 0)
+ taps[n + M] = fwT0 / M_PI * w[n + M];
+ else {
+ // a little algebra gets this into the more familiar sin(x)/x form
+ taps[n + M] = sin(n * fwT0) / (n * M_PI) * w[n + M];
+ }
+ }
+
+ // find the factor to normalize the gain, fmax.
+ // For low-pass, gain @ zero freq = 1.0
+
+ double fmax = taps[0 + M];
+ for(int n = 1; n <= M; n++)
+ fmax += 2 * taps[n + M];
+
+ gain /= fmax; // normalize
+
+ for(int i = 0; i < ntaps; i++)
+ taps[i] *= gain;
+
+ return taps;
+ }
+
+
+ //
+ // === High Pass ===
+ //
+
+ vector<float>
+ firdes::high_pass_2(double gain,
+ double sampling_freq,
+ double cutoff_freq, // Hz center of transition band
+ double transition_width, // Hz width of transition band
+ double attenuation_dB, // attenuation dB
+ win_type window_type,
+ double beta) // used only with Kaiser
+ {
+ sanity_check_1f(sampling_freq, cutoff_freq, transition_width);
+
+ int ntaps = compute_ntaps_windes(sampling_freq,
+ transition_width,
+ attenuation_dB);
+
+ // construct the truncated ideal impulse response times the window function
+
+ vector<float> taps(ntaps);
+ vector<float> w = window(window_type, ntaps, beta);
+
+ int M = (ntaps - 1) / 2;
+ double fwT0 = 2 * M_PI * cutoff_freq / sampling_freq;
+
+ for(int n = -M; n <= M; n++) {
+ if(n == 0)
+ taps[n + M] = (1 - (fwT0 / M_PI)) * w[n + M];
+ else {
+ // a little algebra gets this into the more familiar sin(x)/x form
+ taps[n + M] = -sin(n * fwT0) / (n * M_PI) * w[n + M];
+ }
+ }
+
+ // find the factor to normalize the gain, fmax.
+ // For high-pass, gain @ fs/2 freq = 1.0
+
+ double fmax = taps[0 + M];
+ for(int n = 1; n <= M; n++)
+ fmax += 2 * taps[n + M] * cos(n * M_PI);
+
+ gain /= fmax; // normalize
+
+ for(int i = 0; i < ntaps; i++)
+ taps[i] *= gain;
+
+ return taps;
+ }
+
+
+ vector<float>
+ firdes::high_pass(double gain,
+ double sampling_freq,
+ double cutoff_freq, // Hz center of transition band
+ double transition_width, // Hz width of transition band
+ win_type window_type,
+ double beta) // used only with Kaiser
+ {
+ sanity_check_1f(sampling_freq, cutoff_freq, transition_width);
+
+ int ntaps = compute_ntaps(sampling_freq,
+ transition_width,
+ window_type, beta);
+
+ // construct the truncated ideal impulse response times the window function
+
+ vector<float> taps(ntaps);
+ vector<float> w = window(window_type, ntaps, beta);
+
+ int M = (ntaps - 1) / 2;
+ double fwT0 = 2 * M_PI * cutoff_freq / sampling_freq;
+
+ for(int n = -M; n <= M; n++) {
+ if(n == 0)
+ taps[n + M] = (1 - (fwT0 / M_PI)) * w[n + M];
+ else {
+ // a little algebra gets this into the more familiar sin(x)/x form
+ taps[n + M] = -sin(n * fwT0) / (n * M_PI) * w[n + M];
+ }
+ }
+
+ // find the factor to normalize the gain, fmax.
+ // For high-pass, gain @ fs/2 freq = 1.0
+
+ double fmax = taps[0 + M];
+ for(int n = 1; n <= M; n++)
+ fmax += 2 * taps[n + M] * cos(n * M_PI);
+
+ gain /= fmax; // normalize
+
+ for(int i = 0; i < ntaps; i++)
+ taps[i] *= gain;
+
+ return taps;
+ }
+
+ //
+ // === Band Pass ===
+ //
+
+ vector<float>
+ firdes::band_pass_2(double gain,
+ double sampling_freq,
+ double low_cutoff_freq, // Hz center of transition band
+ double high_cutoff_freq, // Hz center of transition band
+ double transition_width, // Hz width of transition band
+ double attenuation_dB, // attenuation dB
+ win_type window_type,
+ double beta) // used only with Kaiser
+ {
+ sanity_check_2f(sampling_freq,
+ low_cutoff_freq,
+ high_cutoff_freq, transition_width);
+
+ int ntaps = compute_ntaps_windes(sampling_freq,
+ transition_width,
+ attenuation_dB);
+
+ vector<float> taps(ntaps);
+ vector<float> w = window(window_type, ntaps, beta);
+
+ int M = (ntaps - 1) / 2;
+ double fwT0 = 2 * M_PI * low_cutoff_freq / sampling_freq;
+ double fwT1 = 2 * M_PI * high_cutoff_freq / sampling_freq;
+
+ for(int n = -M; n <= M; n++) {
+ if (n == 0)
+ taps[n + M] = (fwT1 - fwT0) / M_PI * w[n + M];
+ else {
+ taps[n + M] = (sin(n * fwT1) - sin(n * fwT0)) / (n * M_PI) * w[n + M];
+ }
+ }
+
+ // find the factor to normalize the gain, fmax.
+ // For band-pass, gain @ center freq = 1.0
+
+ double fmax = taps[0 + M];
+ for(int n = 1; n <= M; n++)
+ fmax += 2 * taps[n + M] * cos(n * (fwT0 + fwT1) * 0.5);
+
+ gain /= fmax; // normalize
+
+ for(int i = 0; i < ntaps; i++)
+ taps[i] *= gain;
+
+ return taps;
+ }
+
+
+ vector<float>
+ firdes::band_pass(double gain,
+ double sampling_freq,
+ double low_cutoff_freq, // Hz center of transition band
+ double high_cutoff_freq, // Hz center of transition band
+ double transition_width, // Hz width of transition band
+ win_type window_type,
+ double beta) // used only with Kaiser
+ {
+ sanity_check_2f(sampling_freq,
+ low_cutoff_freq,
+ high_cutoff_freq,
+ transition_width);
+
+ int ntaps = compute_ntaps(sampling_freq,
+ transition_width,
+ window_type, beta);
+
+ // construct the truncated ideal impulse response times the window function
+
+ vector<float> taps(ntaps);
+ vector<float> w = window(window_type, ntaps, beta);
+
+ int M = (ntaps - 1) / 2;
+ double fwT0 = 2 * M_PI * low_cutoff_freq / sampling_freq;
+ double fwT1 = 2 * M_PI * high_cutoff_freq / sampling_freq;
+
+ for(int n = -M; n <= M; n++) {
+ if (n == 0)
+ taps[n + M] = (fwT1 - fwT0) / M_PI * w[n + M];
+ else {
+ taps[n + M] = (sin(n * fwT1) - sin(n * fwT0)) / (n * M_PI) * w[n + M];
+ }
+ }
+
+ // find the factor to normalize the gain, fmax.
+ // For band-pass, gain @ center freq = 1.0
+
+ double fmax = taps[0 + M];
+ for(int n = 1; n <= M; n++)
+ fmax += 2 * taps[n + M] * cos(n * (fwT0 + fwT1) * 0.5);
+
+ gain /= fmax; // normalize
+
+ for(int i = 0; i < ntaps; i++)
+ taps[i] *= gain;
+
+ return taps;
+ }
+
+ //
+ // === Complex Band Pass ===
+ //
+
+ vector<gr_complex>
+ firdes::complex_band_pass_2(double gain,
+ double sampling_freq,
+ double low_cutoff_freq, // Hz center of transition band
+ double high_cutoff_freq, // Hz center of transition band
+ double transition_width, // Hz width of transition band
+ double attenuation_dB, // attenuation dB
+ win_type window_type,
+ double beta) // used only with Kaiser
+ {
+ sanity_check_2f_c(sampling_freq,
+ low_cutoff_freq,
+ high_cutoff_freq,
+ transition_width);
+
+ int ntaps = compute_ntaps_windes(sampling_freq,
+ transition_width,
+ attenuation_dB);
+
+ vector<gr_complex> taps(ntaps);
+ vector<float> lptaps(ntaps);
+ vector<float> w = window(window_type, ntaps, beta);
+
+ lptaps = low_pass_2(gain, sampling_freq,
+ (high_cutoff_freq - low_cutoff_freq)/2,
+ transition_width, attenuation_dB,
+ window_type, beta);
+
+ gr_complex *optr = &taps[0];
+ float *iptr = &lptaps[0];
+ float freq = M_PI * (high_cutoff_freq + low_cutoff_freq)/sampling_freq;
+ float phase = 0;
+ if (lptaps.size() & 01) {
+ phase = - freq * ( lptaps.size() >> 1 );
+ }
+ else
+ phase = - freq/2.0 * ((1 + 2*lptaps.size()) >> 1);
+
+ for(unsigned int i = 0; i < lptaps.size(); i++) {
+ *optr++ = gr_complex(*iptr * cos(phase), *iptr * sin(phase));
+ iptr++, phase += freq;
+ }
+
+ return taps;
+ }
+
+
+ vector<gr_complex>
+ firdes::complex_band_pass(double gain,
+ double sampling_freq,
+ double low_cutoff_freq, // Hz center of transition band
+ double high_cutoff_freq, // Hz center of transition band
+ double transition_width, // Hz width of transition band
+ win_type window_type,
+ double beta) // used only with Kaiser
+ {
+ sanity_check_2f_c (sampling_freq,
+ low_cutoff_freq,
+ high_cutoff_freq,
+ transition_width);
+
+ int ntaps = compute_ntaps(sampling_freq,
+ transition_width,
+ window_type, beta);
+
+ // construct the truncated ideal impulse response times the window function
+
+ vector<gr_complex> taps(ntaps);
+ vector<float> lptaps(ntaps);
+ vector<float> w = window(window_type, ntaps, beta);
+
+ lptaps = low_pass(gain, sampling_freq,
+ (high_cutoff_freq - low_cutoff_freq)/2,
+ transition_width, window_type, beta);
+
+ gr_complex *optr = &taps[0];
+ float *iptr = &lptaps[0];
+ float freq = M_PI * (high_cutoff_freq + low_cutoff_freq)/sampling_freq;
+ float phase = 0;
+ if(lptaps.size() & 01) {
+ phase = - freq * ( lptaps.size() >> 1 );
+ }
+ else
+ phase = - freq/2.0 * ((1 + 2*lptaps.size()) >> 1);
+
+ for(unsigned int i=0;i<lptaps.size();i++) {
+ *optr++ = gr_complex(*iptr * cos(phase), *iptr * sin(phase));
+ iptr++, phase += freq;
+ }
+
+ return taps;
+ }
+
+ //
+ // === Band Reject ===
+ //
+
+ vector<float>
+ firdes::band_reject_2(double gain,
+ double sampling_freq,
+ double low_cutoff_freq, // Hz center of transition band
+ double high_cutoff_freq, // Hz center of transition band
+ double transition_width, // Hz width of transition band
+ double attenuation_dB, // attenuation dB
+ win_type window_type,
+ double beta) // used only with Kaiser
+ {
+ sanity_check_2f(sampling_freq,
+ low_cutoff_freq,
+ high_cutoff_freq,
+ transition_width);
+
+ int ntaps = compute_ntaps_windes(sampling_freq,
+ transition_width,
+ attenuation_dB);
+
+ // construct the truncated ideal impulse response times the window function
+
+ vector<float> taps(ntaps);
+ vector<float> w = window(window_type, ntaps, beta);
+
+ int M = (ntaps - 1) / 2;
+ double fwT0 = 2 * M_PI * low_cutoff_freq / sampling_freq;
+ double fwT1 = 2 * M_PI * high_cutoff_freq / sampling_freq;
+
+ for(int n = -M; n <= M; n++) {
+ if (n == 0)
+ taps[n + M] = 1.0 + ((fwT0 - fwT1) / M_PI * w[n + M]);
+ else {
+ taps[n + M] = (sin(n * fwT0) - sin(n * fwT1)) / (n * M_PI) * w[n + M];
+ }
+ }
+
+ // find the factor to normalize the gain, fmax.
+ // For band-reject, gain @ zero freq = 1.0
+
+ double fmax = taps[0 + M];
+ for(int n = 1; n <= M; n++)
+ fmax += 2 * taps[n + M];
+
+ gain /= fmax; // normalize
+
+ for(int i = 0; i < ntaps; i++)
+ taps[i] *= gain;
+
+ return taps;
+ }
+
+ vector<float>
+ firdes::band_reject(double gain,
+ double sampling_freq,
+ double low_cutoff_freq, // Hz center of transition band
+ double high_cutoff_freq, // Hz center of transition band
+ double transition_width, // Hz width of transition band
+ win_type window_type,
+ double beta) // used only with Kaiser
+ {
+ sanity_check_2f(sampling_freq,
+ low_cutoff_freq,
+ high_cutoff_freq,
+ transition_width);
+
+ int ntaps = compute_ntaps(sampling_freq,
+ transition_width,
+ window_type, beta);
+
+ // construct the truncated ideal impulse response times the window function
+
+ vector<float> taps(ntaps);
+ vector<float> w = window(window_type, ntaps, beta);
+
+ int M = (ntaps - 1) / 2;
+ double fwT0 = 2 * M_PI * low_cutoff_freq / sampling_freq;
+ double fwT1 = 2 * M_PI * high_cutoff_freq / sampling_freq;
+
+ for(int n = -M; n <= M; n++) {
+ if (n == 0)
+ taps[n + M] = 1.0 + ((fwT0 - fwT1) / M_PI * w[n + M]);
+ else {
+ taps[n + M] = (sin(n * fwT0) - sin(n * fwT1)) / (n * M_PI) * w[n + M];
+ }
+ }
+
+ // find the factor to normalize the gain, fmax.
+ // For band-reject, gain @ zero freq = 1.0
+
+ double fmax = taps[0 + M];
+ for(int n = 1; n <= M; n++)
+ fmax += 2 * taps[n + M];
+
+ gain /= fmax; // normalize
+
+ for(int i = 0; i < ntaps; i++)
+ taps[i] *= gain;
+
+ return taps;
+ }
+
+ //
+ // Hilbert Transform
+ //
+
+ vector<float>
+ firdes::hilbert(unsigned int ntaps,
+ win_type windowtype,
+ double beta)
+ {
+ if(!(ntaps & 1))
+ throw std::out_of_range("Hilbert: Must have odd number of taps");
+
+ vector<float> taps(ntaps);
+ vector<float> w = window (windowtype, ntaps, beta);
+ unsigned int h = (ntaps-1)/2;
+ float gain=0;
+ for(unsigned int i = 1; i <= h; i++) {
+ if(i & 1) {
+ float x = 1/(float)i;
+ taps[h+i] = x * w[h+i];
+ taps[h-i] = -x * w[h-i];
+ gain = taps[h+i] - gain;
+ }
+ else
+ taps[h+i] = taps[h-i] = 0;
+ }
+
+ gain = 2 * fabs(gain);
+ for(unsigned int i = 0; i < ntaps; i++)
+ taps[i] /= gain;
+ return taps;
+ }
+
+ //
+ // Gaussian
+ //
+
+ vector<float>
+ firdes::gaussian(double gain,
+ double spb,
+ double bt,
+ int ntaps)
+ {
+ vector<float> taps(ntaps);
+ double scale = 0;
+ double dt = 1.0/spb;
+ double s = 1.0/(sqrt(log(2.0)) / (2*M_PI*bt));
+ double t0 = -0.5 * ntaps;
+ double ts;
+ for(int i=0;i<ntaps;i++) {
+ t0++;
+ ts = s*dt*t0;
+ taps[i] = exp(-0.5*ts*ts);
+ scale += taps[i];
+ }
+ for(int i=0;i<ntaps;i++)
+ taps[i] = taps[i] / scale * gain;
+
+ return taps;
+ }
+
+
+ //
+ // Root Raised Cosine
+ //
+
+ vector<float>
+ firdes::root_raised_cosine(double gain,
+ double sampling_freq,
+ double symbol_rate,
+ double alpha,
+ int ntaps)
+ {
+ ntaps |= 1; // ensure that ntaps is odd
+
+ double spb = sampling_freq/symbol_rate; // samples per bit/symbol
+ vector<float> taps(ntaps);
+ double scale = 0;
+ for(int i = 0; i < ntaps; i++) {
+ double x1,x2,x3,num,den;
+ double xindx = i - ntaps/2;
+ x1 = M_PI * xindx/spb;
+ x2 = 4 * alpha * xindx / spb;
+ x3 = x2*x2 - 1;
+
+ if(fabs(x3) >= 0.000001) { // Avoid Rounding errors...
+ if(i != ntaps/2)
+ num = cos((1+alpha)*x1) + sin((1-alpha)*x1)/(4*alpha*xindx/spb);
+ else
+ num = cos((1+alpha)*x1) + (1-alpha) * M_PI / (4*alpha);
+ den = x3 * M_PI;
+ }
+ else {
+ if(alpha==1) {
+ taps[i] = -1;
+ continue;
+ }
+ x3 = (1-alpha)*x1;
+ x2 = (1+alpha)*x1;
+ num = (sin(x2)*(1+alpha)*M_PI
+ - cos(x3)*((1-alpha)*M_PI*spb)/(4*alpha*xindx)
+ + sin(x3)*spb*spb/(4*alpha*xindx*xindx));
+ den = -32 * M_PI * alpha * alpha * xindx/spb;
+ }
+ taps[i] = 4 * alpha * num / den;
+ scale += taps[i];
+ }
+
+ for(int i = 0; i < ntaps; i++)
+ taps[i] = taps[i] * gain / scale;
+
+ return taps;
+ }
+
+ //
+ // === Utilities ===
+ //
+
+ // delta_f / width_factor gives number of taps required.
+ static const float width_factor[5] = { // indexed by win_type
+ 3.3, // WIN_HAMMING
+ 3.1, // WIN_HANN
+ 5.5, // WIN_BLACKMAN
+ 2.0, // WIN_RECTANGULAR
+ //5.0 // WIN_KAISER (guesstimate compromise)
+ //2.0 // WIN_KAISER (guesstimate compromise)
+ 10.0 // WIN_KAISER
+ };
+
+ int
+ firdes::compute_ntaps_windes(double sampling_freq,
+ double transition_width, // this is frequency, not relative frequency
+ double attenuation_dB)
+ {
+ // Based on formula from Multirate Signal Processing for
+ // Communications Systems, fredric j harris
+ int ntaps = (int)(attenuation_dB*sampling_freq/(22.0*transition_width));
+ if ((ntaps & 1) == 0) // if even...
+ ntaps++; // ...make odd
+ return ntaps;
+ }
+
+ int
+ firdes::compute_ntaps(double sampling_freq,
+ double transition_width,
+ win_type window_type,
+ double beta)
+ {
+ // normalized transition width
+ double delta_f = transition_width / sampling_freq;
+
+ // compute number of taps required for given transition width
+ int ntaps = (int)(width_factor[window_type] / delta_f + 0.5);
+ if((ntaps & 1) == 0) // if even...
+ ntaps++; // ...make odd
+
+ return ntaps;
+ }
+
+ double
+ firdes::bessi0(double x)
+ {
+ double ax,ans;
+ double y;
+
+ ax=fabs(x);
+ if (ax < 3.75) {
+ y=x/3.75;
+ y*=y;
+ ans=1.0+y*(3.5156229+y*(3.0899424+y*(1.2067492
+ +y*(0.2659732+y*(0.360768e-1+y*0.45813e-2)))));
+ }
+ else {
+ y=3.75/ax;
+ ans=(exp(ax)/sqrt(ax))*(0.39894228+y*(0.1328592e-1
+ +y*(0.225319e-2+y*(-0.157565e-2+y*(0.916281e-2
+ +y*(-0.2057706e-1+y*(0.2635537e-1+y*(-0.1647633e-1
+ +y*0.392377e-2))))))));
+ }
+ return ans;
+ }
+
+ vector<float>
+ firdes::window (win_type type, int ntaps, double beta)
+ {
+ vector<float> taps(ntaps);
+ int M = ntaps - 1; // filter order
+
+ switch (type) {
+ case WIN_RECTANGULAR:
+ for(int n = 0; n < ntaps; n++)
+ taps[n] = 1;
+
+ case WIN_HAMMING:
+ for(int n = 0; n < ntaps; n++)
+ taps[n] = 0.54 - 0.46 * cos((2 * M_PI * n) / M);
+ break;
+
+ case WIN_HANN:
+ for(int n = 0; n < ntaps; n++)
+ taps[n] = 0.5 - 0.5 * cos((2 * M_PI * n) / M);
+ break;
+
+ case WIN_BLACKMAN:
+ for(int n = 0; n < ntaps; n++)
+ taps[n] = 0.42 - 0.50 * cos((2*M_PI * n) / (M-1))
+ - 0.08 * cos((4*M_PI * n) / (M-1));
+ break;
+
+ case WIN_BLACKMAN_hARRIS:
+ for(int n = -ntaps/2; n < ntaps/2; n++)
+ taps[n+ntaps/2] = 0.35875 + 0.48829*cos((2*M_PI * n) / (float)M) +
+ 0.14128*cos((4*M_PI * n) / (float)M) + 0.01168*cos((6*M_PI * n) / (float)M);
+ break;
+
+ case WIN_KAISER:
+ {
+ double IBeta = 1.0/Izero(beta);
+ double inm1 = 1.0/((double)(ntaps));
+ double temp;
+ //fprintf(stderr, "IBeta = %g; inm1 = %g\n", IBeta, inm1);
+
+ for(int i=0; i<ntaps; i++) {
+ temp = i * inm1;
+ //fprintf(stderr, "temp = %g\n", temp);
+ taps[i] = Izero(beta*sqrt(1.0-temp*temp)) * IBeta;
+ //fprintf(stderr, "taps[%d] = %g\n", i, taps[i]);
+ }
+ }
+ break;
+
+ default:
+ throw std::out_of_range("firdes:window: type out of range");
+ }
+
+ return taps;
+ }
+
+ void
+ firdes::sanity_check_1f(double sampling_freq,
+ double fa, // cutoff freq
+ double transition_width)
+ {
+ if(sampling_freq <= 0.0)
+ throw std::out_of_range("firdes check failed: sampling_freq > 0");
+
+ if(fa <= 0.0 || fa > sampling_freq / 2)
+ throw std::out_of_range("firdes check failed: 0 < fa <= sampling_freq / 2");
+
+ if(transition_width <= 0)
+ throw std::out_of_range("gr_dirdes check failed: transition_width > 0");
+ }
+
+ void
+ firdes::sanity_check_2f(double sampling_freq,
+ double fa, // first cutoff freq
+ double fb, // second cutoff freq
+ double transition_width)
+ {
+ if (sampling_freq <= 0.0)
+ throw std::out_of_range("firdes check failed: sampling_freq > 0");
+
+ if (fa <= 0.0 || fa > sampling_freq / 2)
+ throw std::out_of_range("firdes check failed: 0 < fa <= sampling_freq / 2");
+
+ if (fb <= 0.0 || fb > sampling_freq / 2)
+ throw std::out_of_range("firdes check failed: 0 < fb <= sampling_freq / 2");
+
+ if (fa > fb)
+ throw std::out_of_range("firdes check failed: fa <= fb");
+
+ if (transition_width <= 0)
+ throw std::out_of_range("firdes check failed: transition_width > 0");
+ }
+
+ void
+ firdes::sanity_check_2f_c(double sampling_freq,
+ double fa, // first cutoff freq
+ double fb, // second cutoff freq
+ double transition_width)
+ {
+ if(sampling_freq <= 0.0)
+ throw std::out_of_range("firdes check failed: sampling_freq > 0");
+
+ if(fa < -sampling_freq / 2 || fa > sampling_freq / 2)
+ throw std::out_of_range("firdes check failed: 0 < fa <= sampling_freq / 2");
+
+ if(fb < -sampling_freq / 2 || fb > sampling_freq / 2)
+ throw std::out_of_range("firdes check failed: 0 < fb <= sampling_freq / 2");
+
+ if(fa > fb)
+ throw std::out_of_range("firdes check failed: fa <= fb");
+
+ if(transition_width <= 0)
+ throw std::out_of_range("firdes check failed: transition_width > 0");
+ }
+
+ } /* namespace filter */
+} /* namespace gr */
diff --git a/gr-filter/lib/fractional_interpolator_cc_impl.cc b/gr-filter/lib/fractional_interpolator_cc_impl.cc
new file mode 100644
index 000000000..8fd89f437
--- /dev/null
+++ b/gr-filter/lib/fractional_interpolator_cc_impl.cc
@@ -0,0 +1,125 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2007,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 <gr_io_signature.h>
+#include "fractional_interpolator_cc_impl.h"
+#include <stdexcept>
+
+namespace gr {
+ namespace filter {
+
+ fractional_interpolator_cc::sptr
+ fractional_interpolator_cc::make(float phase_shift, float interp_ratio)
+ {
+ return gnuradio::get_initial_sptr(
+ new fractional_interpolator_cc_impl(phase_shift, interp_ratio));
+ }
+
+ fractional_interpolator_cc_impl::fractional_interpolator_cc_impl
+ (float phase_shift, float interp_ratio)
+ : gr_block("fractional_interpolator_cc",
+ gr_make_io_signature(1, 1, sizeof(gr_complex)),
+ gr_make_io_signature(1, 1, sizeof(gr_complex))),
+ d_mu (phase_shift), d_mu_inc (interp_ratio),
+ d_interp(new mmse_fir_interpolator_cc())
+ {
+ if(interp_ratio <= 0)
+ throw std::out_of_range("interpolation ratio must be > 0");
+ if(phase_shift < 0 || phase_shift > 1)
+ throw std::out_of_range("phase shift ratio must be > 0 and < 1");
+
+ set_relative_rate(1.0 / interp_ratio);
+ }
+
+ fractional_interpolator_cc_impl::~fractional_interpolator_cc_impl()
+ {
+ delete d_interp;
+ }
+
+ void
+ fractional_interpolator_cc_impl::forecast(int noutput_items,
+ gr_vector_int &ninput_items_required)
+ {
+ unsigned ninputs = ninput_items_required.size();
+ for(unsigned i=0; i < ninputs; i++) {
+ ninput_items_required[i] =
+ (int)ceil((noutput_items * d_mu_inc) + d_interp->ntaps());
+ }
+ }
+
+ int
+ fractional_interpolator_cc_impl::general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const gr_complex *in = (const gr_complex*)input_items[0];
+ gr_complex *out = (gr_complex*)output_items[0];
+
+ int ii = 0; // input index
+ int oo = 0; // output index
+
+ while(oo < noutput_items) {
+ out[oo++] = d_interp->interpolate(&in[ii], d_mu);
+
+ double s = d_mu + d_mu_inc;
+ double f = floor(s);
+ int incr = (int)f;
+ d_mu = s - f;
+ ii += incr;
+ }
+
+ consume_each(ii);
+
+ return noutput_items;
+ }
+
+ float
+ fractional_interpolator_cc_impl::mu() const
+ {
+ return d_mu;
+ }
+
+ float
+ fractional_interpolator_cc_impl::interp_ratio() const
+ {
+ return d_mu_inc;
+ }
+
+ void
+ fractional_interpolator_cc_impl::set_mu(float mu)
+ {
+ d_mu = mu;
+ }
+
+ void
+ fractional_interpolator_cc_impl::set_interp_ratio(float interp_ratio)
+ {
+ d_mu_inc = interp_ratio;
+ }
+
+ } /* namespace filter */
+} /* namespace gr */
diff --git a/gr-filter/lib/fractional_interpolator_cc_impl.h b/gr-filter/lib/fractional_interpolator_cc_impl.h
new file mode 100644
index 000000000..cb4218603
--- /dev/null
+++ b/gr-filter/lib/fractional_interpolator_cc_impl.h
@@ -0,0 +1,61 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2007,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 INCLUDED_FRACTIONAL_INTERPOLATOR_CC_IMPL_H
+#define INCLUDED_FRACTIONAL_INTERPOLATOR_CC_IMPL_H
+
+#include <filter/fractional_interpolator_cc.h>
+#include <filter/mmse_fir_interpolator_cc.h>
+
+namespace gr {
+ namespace filter {
+
+ class FILTER_API fractional_interpolator_cc_impl
+ : public fractional_interpolator_cc
+ {
+ private:
+ float d_mu;
+ float d_mu_inc;
+ mmse_fir_interpolator_cc *d_interp;
+
+ public:
+ fractional_interpolator_cc_impl(float phase_shift,
+ float interp_ratio);
+ ~fractional_interpolator_cc_impl();
+
+ 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);
+
+ float mu() const;
+ float interp_ratio() const;
+ void set_mu(float mu);
+ void set_interp_ratio(float interp_ratio);
+ };
+
+ } /* namespace filter */
+} /* namespace gr */
+
+#endif /* INCLUDED_FRACTIONAL_INTERPOLATOR_CC_IMPL_H */
diff --git a/gr-filter/lib/fractional_interpolator_ff_impl.cc b/gr-filter/lib/fractional_interpolator_ff_impl.cc
new file mode 100644
index 000000000..6b35dc106
--- /dev/null
+++ b/gr-filter/lib/fractional_interpolator_ff_impl.cc
@@ -0,0 +1,125 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_io_signature.h>
+#include "fractional_interpolator_ff_impl.h"
+#include <stdexcept>
+
+namespace gr {
+ namespace filter {
+
+ fractional_interpolator_ff::sptr
+ fractional_interpolator_ff::make(float phase_shift, float interp_ratio)
+ {
+ return gnuradio::get_initial_sptr(
+ new fractional_interpolator_ff_impl(phase_shift, interp_ratio));
+ }
+
+ fractional_interpolator_ff_impl::fractional_interpolator_ff_impl
+ (float phase_shift, float interp_ratio)
+ : gr_block("fractional_interpolator_ff",
+ gr_make_io_signature(1, 1, sizeof(float)),
+ gr_make_io_signature(1, 1, sizeof(float))),
+ d_mu (phase_shift), d_mu_inc (interp_ratio),
+ d_interp(new mmse_fir_interpolator_ff())
+ {
+ if(interp_ratio <= 0)
+ throw std::out_of_range("interpolation ratio must be > 0");
+ if(phase_shift < 0 || phase_shift > 1)
+ throw std::out_of_range("phase shift ratio must be > 0 and < 1");
+
+ set_relative_rate(1.0 / interp_ratio);
+ }
+
+ fractional_interpolator_ff_impl::~fractional_interpolator_ff_impl()
+ {
+ delete d_interp;
+ }
+
+ void
+ fractional_interpolator_ff_impl::forecast(int noutput_items,
+ gr_vector_int &ninput_items_required)
+ {
+ unsigned ninputs = ninput_items_required.size();
+ for(unsigned i=0; i < ninputs; i++) {
+ ninput_items_required[i] =
+ (int)ceil((noutput_items * d_mu_inc) + d_interp->ntaps());
+ }
+ }
+
+ int
+ fractional_interpolator_ff_impl::general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const float *in = (const float*)input_items[0];
+ float *out = (float*)output_items[0];
+
+ int ii = 0; // input index
+ int oo = 0; // output index
+
+ while(oo < noutput_items) {
+ out[oo++] = d_interp->interpolate(&in[ii], d_mu);
+
+ double s = d_mu + d_mu_inc;
+ double f = floor(s);
+ int incr = (int)f;
+ d_mu = s - f;
+ ii += incr;
+ }
+
+ consume_each(ii);
+
+ return noutput_items;
+ }
+
+ float
+ fractional_interpolator_ff_impl::mu() const
+ {
+ return d_mu;
+ }
+
+ float
+ fractional_interpolator_ff_impl::interp_ratio() const
+ {
+ return d_mu_inc;
+ }
+
+ void
+ fractional_interpolator_ff_impl::set_mu(float mu)
+ {
+ d_mu = mu;
+ }
+
+ void
+ fractional_interpolator_ff_impl::set_interp_ratio(float interp_ratio)
+ {
+ d_mu_inc = interp_ratio;
+ }
+
+ } /* namespace filter */
+} /* namespace gr */
diff --git a/gr-filter/lib/fractional_interpolator_ff_impl.h b/gr-filter/lib/fractional_interpolator_ff_impl.h
new file mode 100644
index 000000000..d31385cc4
--- /dev/null
+++ b/gr-filter/lib/fractional_interpolator_ff_impl.h
@@ -0,0 +1,61 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2007,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 INCLUDED_FRACTIONAL_INTERPOLATOR_FF_IMPL_H
+#define INCLUDED_FRACTIONAL_INTERPOLATOR_FF_IMPL_H
+
+#include <filter/fractional_interpolator_ff.h>
+#include <filter/mmse_fir_interpolator_ff.h>
+
+namespace gr {
+ namespace filter {
+
+ class FILTER_API fractional_interpolator_ff_impl
+ : public fractional_interpolator_ff
+ {
+ private:
+ float d_mu;
+ float d_mu_inc;
+ mmse_fir_interpolator_ff *d_interp;
+
+ public:
+ fractional_interpolator_ff_impl(float phase_shift,
+ float interp_ratio);
+ ~fractional_interpolator_ff_impl();
+
+ 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);
+
+ float mu() const;
+ float interp_ratio() const;
+ void set_mu(float mu);
+ void set_interp_ratio(float interp_ratio);
+ };
+
+ } /* namespace filter */
+} /* namespace gr */
+
+#endif /* INCLUDED_FRACTIONAL_INTERPOLATOR_FF_IMPL_H */
diff --git a/gr-filter/lib/freq_xlating_fir_filter_XXX_impl.cc.t b/gr-filter/lib/freq_xlating_fir_filter_XXX_impl.cc.t
new file mode 100644
index 000000000..a59fa12b3
--- /dev/null
+++ b/gr-filter/lib/freq_xlating_fir_filter_XXX_impl.cc.t
@@ -0,0 +1,143 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2003,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.
+ */
+
+/*
+ * WARNING: This file is automatically generated by cmake.
+ * Any changes made to this file will be overwritten.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "@IMPL_NAME@.h"
+#include <gr_io_signature.h>
+#include <volk/volk.h>
+
+namespace gr {
+ namespace filter {
+
+ @BASE_NAME@::sptr
+ @BASE_NAME@::make(int decimation,
+ const std::vector<@TAP_TYPE@> &taps,
+ double center_freq,
+ double sampling_freq)
+ {
+ return gnuradio::get_initial_sptr(new @IMPL_NAME@
+ (decimation, taps,
+ center_freq,
+ sampling_freq));
+ }
+
+ @IMPL_NAME@::@IMPL_NAME@(int decimation,
+ const std::vector<@TAP_TYPE@> &taps,
+ double center_freq,
+ double sampling_freq)
+ : gr_sync_decimator("@BASE_NAME@",
+ gr_make_io_signature(1, 1, sizeof(@I_TYPE@)),
+ gr_make_io_signature(1, 1, sizeof(@O_TYPE@)),
+ decimation),
+ d_proto_taps(taps), d_center_freq(center_freq),
+ d_sampling_freq(sampling_freq),
+ d_updated(false)
+ {
+ std::vector<gr_complex> dummy_taps;
+ d_composite_fir = new kernel::@CFIR_TYPE@(decimation, dummy_taps);
+
+ set_history(d_proto_taps.size());
+ build_composite_fir();
+ }
+
+ @IMPL_NAME@::~@IMPL_NAME@()
+ {
+ delete d_composite_fir;
+ }
+
+ void
+ @IMPL_NAME@::build_composite_fir()
+ {
+ std::vector<gr_complex> ctaps(d_proto_taps.size());
+
+ float fwT0 = -2 * M_PI * d_center_freq / d_sampling_freq;
+ for(unsigned int i = 0; i < d_proto_taps.size(); i++) {
+ ctaps[i] = d_proto_taps[i] * exp(gr_complex(0, i * fwT0));
+ }
+
+ std::reverse(ctaps.begin(), ctaps.end());
+ d_composite_fir->set_taps(ctaps);
+ d_r.set_phase_incr(exp(gr_complex(0, fwT0 * decimation())));
+ }
+
+ void
+ @IMPL_NAME@::set_center_freq(double center_freq)
+ {
+ d_center_freq = center_freq;
+ d_updated = true;
+ }
+
+ double
+ @IMPL_NAME@::center_freq() const
+ {
+ return d_center_freq;
+ }
+
+ void
+ @IMPL_NAME@::set_taps(const std::vector<@TAP_TYPE@> &taps)
+ {
+ d_proto_taps = taps;
+ d_updated = true;
+ }
+
+ std::vector<@TAP_TYPE@>
+ @IMPL_NAME@::taps() const
+ {
+ return d_proto_taps;
+ }
+
+ int
+ @IMPL_NAME@::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ @I_TYPE@ *in = (@I_TYPE@ *)input_items[0];
+ @O_TYPE@ *out = (@O_TYPE@ *)output_items[0];
+
+ // rebuild composite FIR if the center freq has changed
+ if(d_updated) {
+ set_history(d_proto_taps.size());
+ build_composite_fir();
+ d_updated = false;
+ return 0; // history requirements may have changed.
+ }
+
+ unsigned j = 0;
+ for (int i = 0; i < noutput_items; i++){
+ out[i] = d_r.rotate(d_composite_fir->filter(&in[j]));
+ j += decimation();
+ }
+
+ return noutput_items;
+ }
+
+ } /* namespace filter */
+} /* namespace gr */
+
diff --git a/gr-filter/lib/freq_xlating_fir_filter_XXX_impl.h.t b/gr-filter/lib/freq_xlating_fir_filter_XXX_impl.h.t
new file mode 100644
index 000000000..0cf976d58
--- /dev/null
+++ b/gr-filter/lib/freq_xlating_fir_filter_XXX_impl.h.t
@@ -0,0 +1,71 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002,2004,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: This file is automatically generated by cmake.
+ * Any changes made to this file will be overwritten.
+ */
+
+#ifndef @GUARD_NAME@
+#define @GUARD_NAME@
+
+#include <filter/api.h>
+#include <filter/fir_filter.h>
+#include <filter/@BASE_NAME@.h>
+
+namespace gr {
+ namespace filter {
+
+ class FILTER_API @IMPL_NAME@ : public @BASE_NAME@
+ {
+ protected:
+ std::vector<@TAP_TYPE@> d_proto_taps;
+ kernel::@CFIR_TYPE@ *d_composite_fir;
+ gr_rotator d_r;
+ double d_center_freq;
+ double d_sampling_freq;
+ bool d_updated;
+
+ virtual void build_composite_fir();
+ public:
+
+ @IMPL_NAME@(int decimation,
+ const std::vector<@TAP_TYPE@> &taps,
+ double center_freq,
+ double sampling_freq);
+ virtual ~@IMPL_NAME@();
+
+ void set_center_freq(double center_freq);
+ double center_freq() const;
+
+ void set_taps(const std::vector<@TAP_TYPE@> &taps);
+ std::vector<@TAP_TYPE@> taps() const;
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace filter */
+} /* namespace gr */
+
+#endif /* @GUARD_NAME@ */
diff --git a/gr-filter/lib/hilbert_fc_impl.cc b/gr-filter/lib/hilbert_fc_impl.cc
new file mode 100644
index 000000000..52b2dabae
--- /dev/null
+++ b/gr-filter/lib/hilbert_fc_impl.cc
@@ -0,0 +1,76 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "hilbert_fc_impl.h"
+#include <filter/firdes.h>
+#include <gr_io_signature.h>
+#include <volk/volk.h>
+
+namespace gr {
+ namespace filter {
+
+ hilbert_fc::sptr hilbert_fc::make(unsigned int ntaps)
+ {
+ return gnuradio::get_initial_sptr(new hilbert_fc_impl(ntaps));
+ }
+
+ hilbert_fc_impl::hilbert_fc_impl(unsigned int ntaps)
+ : gr_sync_block ("hilbert_fc",
+ gr_make_io_signature (1, 1, sizeof(float)),
+ gr_make_io_signature (1, 1, sizeof(gr_complex))),
+ d_ntaps(ntaps | 0x1) // ensure ntaps is odd
+ {
+ d_hilb = new kernel::fir_filter_fff(1, firdes::hilbert(d_ntaps));
+ set_history (d_ntaps);
+
+ const int alignment_multiple =
+ volk_get_alignment() / sizeof(float);
+ set_alignment(std::max(1, alignment_multiple));
+ }
+
+ hilbert_fc_impl::~hilbert_fc_impl()
+ {
+ delete d_hilb;
+ }
+
+ int
+ hilbert_fc_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ float *in = (float *)input_items[0];
+ gr_complex *out = (gr_complex *)output_items[0];
+
+ for(int i = 0; i < noutput_items; i++) {
+ out[i] = gr_complex(in[i + d_ntaps/2],
+ d_hilb->filter(&in[i]));
+ }
+
+ return noutput_items;
+ }
+
+ } /* namespace filter */
+} /* namespace gr */
diff --git a/gr-filter/lib/hilbert_fc_impl.h b/gr-filter/lib/hilbert_fc_impl.h
new file mode 100644
index 000000000..d2b41b573
--- /dev/null
+++ b/gr-filter/lib/hilbert_fc_impl.h
@@ -0,0 +1,52 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,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 INCLUDED_FILTER_HILBERT_FC_IMPL_H
+#define INCLUDED_FILTER_HILBERT_FC_IMPL_H
+
+#include <filter/hilbert_fc.h>
+#include <filter/fir_filter.h>
+#include <gr_types.h>
+
+namespace gr {
+ namespace filter {
+
+ class FILTER_API hilbert_fc_impl : public hilbert_fc
+ {
+ private:
+ unsigned int d_ntaps;
+ kernel::fir_filter_fff *d_hilb;
+
+ public:
+ hilbert_fc_impl(unsigned int ntaps);
+
+ ~hilbert_fc_impl();
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace filter */
+} /* namespace gr */
+
+#endif /* INCLUDED_FILTER_HILBERT_FC_IMPL_H */
diff --git a/gr-filter/lib/iir_filter_ffd_impl.cc b/gr-filter/lib/iir_filter_ffd_impl.cc
new file mode 100644
index 000000000..24bfad190
--- /dev/null
+++ b/gr-filter/lib/iir_filter_ffd_impl.cc
@@ -0,0 +1,85 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,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 "iir_filter_ffd_impl.h"
+#include <gr_io_signature.h>
+
+namespace gr {
+ namespace filter {
+
+ iir_filter_ffd::sptr
+ iir_filter_ffd::make(const std::vector<double> &fftaps,
+ const std::vector<double> &fbtaps)
+ {
+ return gnuradio::get_initial_sptr(new iir_filter_ffd_impl(fftaps, fbtaps));
+ }
+
+ iir_filter_ffd_impl::iir_filter_ffd_impl(const std::vector<double> &fftaps,
+ const std::vector<double> &fbtaps)
+
+ : gr_sync_block("iir_filter_ffd",
+ gr_make_io_signature(1, 1, sizeof (float)),
+ gr_make_io_signature(1, 1, sizeof (float))),
+ d_updated(false)
+ {
+ d_iir = new kernel::iir_filter<float,float,double>(fftaps, fbtaps);
+ //d_iir = new gri_iir<float,float,double>(fftaps, fbtaps);
+ }
+
+ iir_filter_ffd_impl::~iir_filter_ffd_impl()
+ {
+ delete d_iir;
+ }
+
+ void
+ iir_filter_ffd_impl::set_taps(const std::vector<double> &fftaps,
+ const std::vector<double> &fbtaps)
+ {
+ d_new_fftaps = fftaps;
+ d_new_fbtaps = fbtaps;
+ d_updated = true;
+ }
+
+ int
+ iir_filter_ffd_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const float *in = (const float*)input_items[0];
+ float *out = (float*)output_items[0];
+
+ if(d_updated) {
+ d_iir->set_taps(d_new_fftaps, d_new_fbtaps);
+ d_updated = false;
+ }
+
+ d_iir->filter_n(out, in, noutput_items);
+ return noutput_items;
+ };
+
+ } /* namespace filter */
+} /* namespace gr */
+
diff --git a/gr-filter/lib/iir_filter_ffd_impl.h b/gr-filter/lib/iir_filter_ffd_impl.h
new file mode 100644
index 000000000..45aab6c22
--- /dev/null
+++ b/gr-filter/lib/iir_filter_ffd_impl.h
@@ -0,0 +1,56 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,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 INCLUDED_IIR_FILTER_FFD_IMPL_H
+#define INCLUDED_IIR_FILTER_FFD_IMPL_H
+
+#include <filter/iir_filter.h>
+#include <filter/iir_filter_ffd.h>
+
+namespace gr {
+ namespace filter {
+
+ class FILTER_API iir_filter_ffd_impl : public iir_filter_ffd
+ {
+ private:
+ bool d_updated;
+ kernel::iir_filter<float,float,double> *d_iir;
+ std::vector<double> d_new_fftaps;
+ std::vector<double> d_new_fbtaps;
+
+ public:
+ iir_filter_ffd_impl(const std::vector<double> &fftaps,
+ const std::vector<double> &fbtaps);
+ ~iir_filter_ffd_impl();
+
+ void set_taps(const std::vector<double> &fftaps,
+ const std::vector<double> &fbtaps);
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace filter */
+} /* namespace gr */
+
+#endif /* INCLUDED_IIR_FILTER_FFD_IMPL_H */
diff --git a/gr-filter/lib/interp_fir_filter_XXX_impl.cc.t b/gr-filter/lib/interp_fir_filter_XXX_impl.cc.t
new file mode 100644
index 000000000..fea3b1c8e
--- /dev/null
+++ b/gr-filter/lib/interp_fir_filter_XXX_impl.cc.t
@@ -0,0 +1,155 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,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.
+ */
+
+/* @WARNING@ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "@IMPL_NAME@.h"
+#include <gr_io_signature.h>
+#include <volk/volk.h>
+#include <stdexcept>
+
+namespace gr {
+ namespace filter {
+
+ @BASE_NAME@::sptr
+ @BASE_NAME@::make(unsigned interpolation,
+ const std::vector<@TAP_TYPE@> &taps)
+ {
+ return gnuradio::get_initial_sptr(new @IMPL_NAME@
+ (interpolation, taps));
+ }
+
+ @IMPL_NAME@::@IMPL_NAME@(unsigned interpolation,
+ const std::vector<@TAP_TYPE@> &taps)
+ : gr_sync_interpolator("@BASE_NAME@",
+ gr_make_io_signature(1, 1, sizeof(@I_TYPE@)),
+ gr_make_io_signature(1, 1, sizeof(@O_TYPE@)),
+ interpolation),
+ d_updated(false), d_firs(interpolation)
+ {
+ if(interpolation == 0) {
+ throw std::out_of_range("@IMPL_NAME@: interpolation must be > 0\n");
+ }
+
+ if(taps.size() == 0) {
+ throw std::runtime_error("@IMPL_NAME@: no filter taps provided.\n");
+ }
+
+ std::vector<@TAP_TYPE@> dummy_taps;
+
+ for(unsigned i = 0; i < interpolation; i++) {
+ d_firs[i] = new kernel::@FIR_TYPE@(1, dummy_taps);
+ }
+
+ set_taps(taps);
+ install_taps(d_new_taps);
+ }
+
+ @IMPL_NAME@::~@IMPL_NAME@()
+ {
+ for(unsigned i = 0; i < interpolation(); i++) {
+ delete d_firs[i];
+ }
+ }
+
+ void
+ @IMPL_NAME@::set_taps(const std::vector<@TAP_TYPE@> &taps)
+ {
+ d_new_taps = taps;
+ d_updated = true;
+
+ // round up length to a multiple of the interpolation factor
+ int n = taps.size() % interpolation();
+ if(n > 0) {
+ n = interpolation() - n;
+ while(n-- > 0) {
+ d_new_taps.insert(d_new_taps.begin(), 0);
+ }
+ }
+
+ if(d_new_taps.size() % interpolation() != 0) {
+ throw std::runtime_error("@IMPL_NAME@: error setting interpolator taps.\n");
+ }
+ }
+
+ void
+ @IMPL_NAME@::install_taps(const std::vector<@TAP_TYPE@> &taps)
+ {
+ unsigned nfilters = interpolation();
+ int nt = taps.size() / nfilters;
+
+ std::vector< std::vector <@TAP_TYPE@> > xtaps(nfilters);
+
+ for(unsigned n = 0; n < nfilters; n++) {
+ xtaps[n].resize (nt);
+ }
+
+ for(size_t i = 0; i < taps.size(); i++) {
+ xtaps[i % nfilters][i / nfilters] = taps[i];
+ }
+
+ for(unsigned n = 0; n < nfilters; n++) {
+ d_firs[n]->set_taps (xtaps[n]);
+ }
+
+ set_history(nt);
+ d_updated = false;
+ }
+
+ std::vector<@TAP_TYPE@>
+ @IMPL_NAME@::taps() const
+ {
+ return d_new_taps;
+ }
+
+ 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];
+
+ if(d_updated) {
+ install_taps(d_new_taps);
+ return 0; // history requirements may have changed.
+ }
+
+ int nfilters = interpolation();
+ int ni = noutput_items / interpolation();
+
+ for(int i = 0; i < ni; i++) {
+ for(int nf = 0; nf < nfilters; nf++) {
+ out[nf] = d_firs[nf]->filter(&in[i]);
+ }
+ out += nfilters;
+ }
+
+ return noutput_items;
+ }
+
+ } /* namespace filter */
+} /* namespace gr */
diff --git a/gr-filter/lib/interp_fir_filter_XXX_impl.h.t b/gr-filter/lib/interp_fir_filter_XXX_impl.h.t
new file mode 100644
index 000000000..e505fca69
--- /dev/null
+++ b/gr-filter/lib/interp_fir_filter_XXX_impl.h.t
@@ -0,0 +1,62 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,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 <filter/api.h>
+#include <filter/fir_filter.h>
+#include <filter/@BASE_NAME@.h>
+#include <vector>
+
+namespace gr {
+ namespace filter {
+
+ class FILTER_API @IMPL_NAME@ : public @BASE_NAME@
+ {
+ private:
+ bool d_updated;
+ std::vector<kernel::@FIR_TYPE@ *> d_firs;
+ std::vector<@TAP_TYPE@> d_new_taps;
+
+ void install_taps(const std::vector<@TAP_TYPE@> &taps);
+
+ public:
+ @IMPL_NAME@(unsigned interpolation,
+ const std::vector<@TAP_TYPE@> &taps);
+
+ ~@IMPL_NAME@();
+
+ void set_taps(const std::vector<@TAP_TYPE@> &taps);
+ std::vector<@TAP_TYPE@> taps() const;
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace filter */
+} /* namespace gr */
+
+#endif /* @GUARD_NAME@ */
diff --git a/gr-filter/lib/mmse_fir_interpolator_cc.cc b/gr-filter/lib/mmse_fir_interpolator_cc.cc
new file mode 100644
index 000000000..8af1fb39a
--- /dev/null
+++ b/gr-filter/lib/mmse_fir_interpolator_cc.cc
@@ -0,0 +1,77 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002,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 <filter/mmse_fir_interpolator_cc.h>
+#include <filter/interpolator_taps.h>
+#include <stdexcept>
+
+namespace gr {
+ namespace filter {
+
+ mmse_fir_interpolator_cc::mmse_fir_interpolator_cc()
+ {
+ filters.resize (NSTEPS + 1);
+
+ for(int i = 0; i < NSTEPS + 1; i++) {
+ std::vector<float> t (&taps[i][0], &taps[i][NTAPS]);
+ filters[i] = new kernel::fir_filter_ccf(1, t);
+ }
+ }
+
+ mmse_fir_interpolator_cc::~mmse_fir_interpolator_cc()
+ {
+ for(int i = 0; i < NSTEPS + 1; i++)
+ delete filters[i];
+ }
+
+ unsigned
+ mmse_fir_interpolator_cc::ntaps() const
+ {
+ return NTAPS;
+ }
+
+ unsigned
+ mmse_fir_interpolator_cc::nsteps() const
+ {
+ return NSTEPS;
+ }
+
+ gr_complex
+ mmse_fir_interpolator_cc::interpolate(const gr_complex input[],
+ float mu) const
+ {
+ int imu = (int)rint(mu * NSTEPS);
+
+ if((imu < 0) || (imu > NSTEPS)) {
+ throw std::runtime_error("mmse_fir_interpolator_cc: imu out of bounds.\n");
+ }
+
+ gr_complex r = filters[imu]->filter(input);
+ return r;
+ }
+
+ } /* namespace filter */
+} /* namespace gr */
diff --git a/gr-filter/lib/mmse_fir_interpolator_ff.cc b/gr-filter/lib/mmse_fir_interpolator_ff.cc
new file mode 100644
index 000000000..ff2c4dd87
--- /dev/null
+++ b/gr-filter/lib/mmse_fir_interpolator_ff.cc
@@ -0,0 +1,77 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002,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 <filter/mmse_fir_interpolator_ff.h>
+#include <filter/interpolator_taps.h>
+#include <stdexcept>
+
+namespace gr {
+ namespace filter {
+
+ mmse_fir_interpolator_ff::mmse_fir_interpolator_ff()
+ {
+ filters.resize(NSTEPS + 1);
+
+ for(int i = 0; i < NSTEPS + 1; i++) {
+ std::vector<float> t(&taps[i][0], &taps[i][NTAPS]);
+ filters[i] = new kernel::fir_filter_fff(1, t);
+ }
+ }
+
+ mmse_fir_interpolator_ff::~mmse_fir_interpolator_ff()
+ {
+ for(int i = 0; i < NSTEPS + 1; i++)
+ delete filters[i];
+ }
+
+ unsigned
+ mmse_fir_interpolator_ff::ntaps() const
+ {
+ return NTAPS;
+ }
+
+ unsigned
+ mmse_fir_interpolator_ff::nsteps() const
+ {
+ return NSTEPS;
+ }
+
+ float
+ mmse_fir_interpolator_ff::interpolate(const float input[],
+ float mu) const
+ {
+ int imu = (int)rint(mu * NSTEPS);
+
+ if((imu < 0) || (imu > NSTEPS)) {
+ throw std::runtime_error("mmse_fir_interpolator_ff: imu out of bounds.\n");
+ }
+
+ float r = filters[imu]->filter(input);
+ return r;
+ }
+
+ } /* namespace filter */
+} /* namespace gr */
diff --git a/gr-filter/lib/pfb_arb_resampler_ccf_impl.cc b/gr-filter/lib/pfb_arb_resampler_ccf_impl.cc
new file mode 100644
index 000000000..5480366de
--- /dev/null
+++ b/gr-filter/lib/pfb_arb_resampler_ccf_impl.cc
@@ -0,0 +1,258 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2009,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 "pfb_arb_resampler_ccf_impl.h"
+#include <gr_io_signature.h>
+#include <cstdio>
+
+namespace gr {
+ namespace filter {
+
+ pfb_arb_resampler_ccf::sptr
+ pfb_arb_resampler_ccf::make(float rate,
+ const std::vector<float> &taps,
+ unsigned int filter_size)
+ {
+ return gnuradio::get_initial_sptr
+ (new pfb_arb_resampler_ccf_impl(rate, taps, filter_size));
+ }
+
+
+ pfb_arb_resampler_ccf_impl::pfb_arb_resampler_ccf_impl(float rate,
+ const std::vector<float> &taps,
+ unsigned int filter_size)
+ : gr_block("pfb_arb_resampler_ccf",
+ gr_make_io_signature(1, 1, sizeof(gr_complex)),
+ gr_make_io_signature(1, 1, sizeof(gr_complex))),
+ d_updated (false)
+ {
+ d_acc = 0; // start accumulator at 0
+
+ /* The number of filters is specified by the user as the filter
+ size; this is also the interpolation rate of the filter. We
+ use it and the rate provided to determine the decimation
+ rate. This acts as a rational resampler. The flt_rate is
+ calculated as the residual between the integer decimation
+ rate and the real decimation rate and will be used to
+ determine to interpolation point of the resampling process.
+ */
+ d_int_rate = filter_size;
+ set_rate(rate);
+
+ // Store the last filter between calls to work
+ d_last_filter = 0;
+
+ d_start_index = 0;
+
+ d_filters = std::vector<kernel::fir_filter_ccf*>(d_int_rate);
+ d_diff_filters = std::vector<kernel::fir_filter_ccf*>(d_int_rate);
+
+ // Create an FIR filter for each channel and zero out the taps
+ std::vector<float> vtaps(0, d_int_rate);
+ for(unsigned int i = 0; i < d_int_rate; i++) {
+ d_filters[i] = new kernel::fir_filter_ccf(1, vtaps);
+ d_diff_filters[i] = new kernel::fir_filter_ccf(1, vtaps);
+ }
+
+ // Now, actually set the filters' taps
+ set_taps(taps);
+ d_updated = false;
+ }
+
+ pfb_arb_resampler_ccf_impl::~pfb_arb_resampler_ccf_impl()
+ {
+ for(unsigned int i = 0; i < d_int_rate; i++) {
+ delete d_filters[i];
+ delete d_diff_filters[i];
+ }
+ }
+
+ void
+ pfb_arb_resampler_ccf_impl::create_taps(const std::vector<float> &newtaps,
+ std::vector< std::vector<float> > &ourtaps,
+ std::vector<kernel::fir_filter_ccf*> &ourfilter)
+ {
+ unsigned int ntaps = newtaps.size();
+ d_taps_per_filter = (unsigned int)ceil((double)ntaps/(double)d_int_rate);
+
+ // Create d_numchan vectors to store each channel's taps
+ ourtaps.resize(d_int_rate);
+
+ // Make a vector of the taps plus fill it out with 0's to fill
+ // each polyphase filter with exactly d_taps_per_filter
+ std::vector<float> tmp_taps;
+ tmp_taps = newtaps;
+ while((float)(tmp_taps.size()) < d_int_rate*d_taps_per_filter) {
+ tmp_taps.push_back(0.0);
+ }
+
+ // Partition the filter
+ for(unsigned int i = 0; i < d_int_rate; i++) {
+ // Each channel uses all d_taps_per_filter with 0's if not enough taps to fill out
+ ourtaps[d_int_rate-1-i] = std::vector<float>(d_taps_per_filter, 0);
+ for(unsigned int j = 0; j < d_taps_per_filter; j++) {
+ ourtaps[d_int_rate - 1 - i][j] = tmp_taps[i + j*d_int_rate];
+ }
+
+ // Build a filter for each channel and add it's taps to it
+ ourfilter[i]->set_taps(ourtaps[d_int_rate-1-i]);
+ }
+ }
+
+ void
+ pfb_arb_resampler_ccf_impl::create_diff_taps(const std::vector<float> &newtaps,
+ std::vector<float> &difftaps)
+ {
+ // Calculate the differential taps (derivative filter) by taking the difference
+ // between two taps. Duplicate the last one to make both filters the same length.
+ float tap;
+ difftaps.clear();
+ for(unsigned int i = 0; i < newtaps.size()-1; i++) {
+ tap = newtaps[i+1] - newtaps[i];
+ difftaps.push_back(tap);
+ }
+ difftaps.push_back(tap);
+ }
+
+ void
+ pfb_arb_resampler_ccf_impl::set_taps(const std::vector<float> &taps)
+ {
+ gruel::scoped_lock guard(d_mutex);
+
+ std::vector<float> dtaps;
+ create_diff_taps(taps, dtaps);
+ create_taps(taps, d_taps, d_filters);
+ create_taps(dtaps, d_dtaps, d_diff_filters);
+ set_history(d_taps_per_filter + 1);
+ d_updated = true;
+ }
+
+ std::vector<std::vector<float> >
+ pfb_arb_resampler_ccf_impl::taps() const
+ {
+ return d_taps;
+ }
+
+ void
+ pfb_arb_resampler_ccf_impl::print_taps()
+ {
+ unsigned int i, j;
+ for(i = 0; i < d_int_rate; i++) {
+ printf("filter[%d]: [", i);
+ for(j = 0; j < d_taps_per_filter; j++) {
+ printf(" %.4e", d_taps[i][j]);
+ }
+ printf("]\n");
+ }
+ }
+
+ void
+ pfb_arb_resampler_ccf_impl::set_rate(float rate)
+ {
+ gruel::scoped_lock guard(d_mutex);
+
+ d_dec_rate = (unsigned int)floor(d_int_rate/rate);
+ d_flt_rate = (d_int_rate/rate) - d_dec_rate;
+ set_relative_rate(rate);
+ }
+
+ void
+ pfb_arb_resampler_ccf_impl::set_phase(float ph)
+ {
+ gruel::scoped_lock guard(d_mutex);
+ if((ph < 0) || (ph >= 2.0*M_PI)) {
+ throw std::runtime_error("pfb_arb_resampler_ccf: set_phase value out of bounds [0, 2pi).\n");
+ }
+
+ float ph_diff = 2.0*M_PI / (float)d_filters.size();
+ d_last_filter = static_cast<int>(ph / ph_diff);
+ }
+
+ float
+ pfb_arb_resampler_ccf_impl::phase() const
+ {
+ float ph_diff = 2.0*M_PI / static_cast<float>(d_filters.size());
+ return d_last_filter * ph_diff;
+ }
+
+ int
+ pfb_arb_resampler_ccf_impl::general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ gruel::scoped_lock guard(d_mutex);
+
+ gr_complex *in = (gr_complex*)input_items[0];
+ gr_complex *out = (gr_complex*)output_items[0];
+
+ if(d_updated) {
+ d_updated = false;
+ return 0; // history requirements may have changed.
+ }
+
+ int i = 0, count = d_start_index;
+ unsigned int j;
+ gr_complex o0, o1;
+
+ // Restore the last filter position
+ j = d_last_filter;
+
+ // produce output as long as we can and there are enough input samples
+ int max_input = ninput_items[0] - (int)d_taps_per_filter;
+ while((i < noutput_items) && (count < max_input)) {
+ // start j by wrapping around mod the number of channels
+ while((j < d_int_rate) && (i < noutput_items)) {
+ // Take the current filter and derivative filter output
+ o0 = d_filters[j]->filter(&in[count]);
+ o1 = d_diff_filters[j]->filter(&in[count]);
+
+ out[i] = o0 + o1*d_acc; // linearly interpolate between samples
+ i++;
+
+ // Adjust accumulator and index into filterbank
+ d_acc += d_flt_rate;
+ j += d_dec_rate + (int)floor(d_acc);
+ d_acc = fmodf(d_acc, 1.0);
+ }
+ if(i < noutput_items) { // keep state for next entry
+ float ss = (int)(j / d_int_rate); // number of items to skip ahead by
+ count += ss; // we have fully consumed another input
+ j = j % d_int_rate; // roll filter around
+ }
+ }
+
+ // Store the current filter position and start of next sample
+ d_last_filter = j;
+ d_start_index = std::max(0, count - ninput_items[0]);
+
+ // consume all we've processed but no more than we can
+ consume_each(std::min(count, ninput_items[0]));
+ return i;
+ }
+
+ } /* namespace filter */
+} /* namespace gr */
diff --git a/gr-filter/lib/pfb_arb_resampler_ccf_impl.h b/gr-filter/lib/pfb_arb_resampler_ccf_impl.h
new file mode 100644
index 000000000..891e601e0
--- /dev/null
+++ b/gr-filter/lib/pfb_arb_resampler_ccf_impl.h
@@ -0,0 +1,89 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2009,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.
+ */
+
+
+#ifndef INCLUDED_PFB_ARB_RESAMPLER_CCF_IMPL_H
+#define INCLUDED_PFB_ARB_RESAMPLER_CCF_IMPL_H
+
+#include <filter/pfb_arb_resampler_ccf.h>
+#include <filter/fir_filter.h>
+#include <gruel/thread.h>
+
+namespace gr {
+ namespace filter {
+
+ class FILTER_API pfb_arb_resampler_ccf_impl : public pfb_arb_resampler_ccf
+ {
+ private:
+ std::vector<kernel::fir_filter_ccf*> d_filters;
+ std::vector<kernel::fir_filter_ccf*> d_diff_filters;
+ std::vector< std::vector<float> > d_taps;
+ std::vector< std::vector<float> > d_dtaps;
+ unsigned int d_int_rate; // the number of filters (interpolation rate)
+ unsigned int d_dec_rate; // the stride through the filters (decimation rate)
+ float d_flt_rate; // residual rate for the linear interpolation
+ float d_acc;
+ unsigned int d_last_filter;
+ int d_start_index;
+ unsigned int d_taps_per_filter;
+ bool d_updated;
+ gruel::mutex d_mutex; // mutex to protect set/work access
+
+ void create_diff_taps(const std::vector<float> &newtaps,
+ std::vector<float> &difftaps);
+
+ /*!
+ * Resets the filterbank's filter taps with the new prototype filter
+ * \param newtaps (vector of floats) The prototype filter to populate the filterbank.
+ * The taps should be generated at the interpolated sampling rate.
+ * \param ourtaps (vector of floats) Reference to our internal member of holding the taps.
+ * \param ourfilter (vector of filters) Reference to our internal filter to set the taps for.
+ */
+ void create_taps(const std::vector<float> &newtaps,
+ std::vector< std::vector<float> > &ourtaps,
+ std::vector<kernel::fir_filter_ccf*> &ourfilter);
+
+ public:
+ pfb_arb_resampler_ccf_impl(float rate,
+ const std::vector<float> &taps,
+ unsigned int filter_size);
+
+ ~pfb_arb_resampler_ccf_impl();
+
+ void set_taps(const std::vector<float> &taps);
+ std::vector<std::vector<float> > taps() const;
+ void print_taps();
+ void set_rate(float rate);
+
+ void set_phase(float ph);
+ float phase() const;
+
+ int general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace filter */
+} /* namespace gr */
+
+#endif /* INCLUDED_PFB_ARB_RESAMPLER_CCF_IMPL_H */
diff --git a/gr-filter/lib/pfb_arb_resampler_fff_impl.cc b/gr-filter/lib/pfb_arb_resampler_fff_impl.cc
new file mode 100644
index 000000000..6aff374fd
--- /dev/null
+++ b/gr-filter/lib/pfb_arb_resampler_fff_impl.cc
@@ -0,0 +1,258 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2009-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 "pfb_arb_resampler_fff_impl.h"
+#include <gr_io_signature.h>
+#include <cstdio>
+
+namespace gr {
+ namespace filter {
+
+ pfb_arb_resampler_fff::sptr
+ pfb_arb_resampler_fff::make(float rate,
+ const std::vector<float> &taps,
+ unsigned int filter_size)
+ {
+ return gnuradio::get_initial_sptr
+ (new pfb_arb_resampler_fff_impl(rate, taps, filter_size));
+ }
+
+
+ pfb_arb_resampler_fff_impl::pfb_arb_resampler_fff_impl(float rate,
+ const std::vector<float> &taps,
+ unsigned int filter_size)
+ : gr_block("pfb_arb_resampler_fff",
+ gr_make_io_signature(1, 1, sizeof(float)),
+ gr_make_io_signature(1, 1, sizeof(float))),
+ d_updated(false)
+ {
+ d_acc = 0; // start accumulator at 0
+
+ /* The number of filters is specified by the user as the filter
+ size; this is also the interpolation rate of the filter. We
+ use it and the rate provided to determine the decimation
+ rate. This acts as a rational resampler. The flt_rate is
+ calculated as the residual between the integer decimation
+ rate and the real decimation rate and will be used to
+ determine to interpolation point of the resampling process.
+ */
+ d_int_rate = filter_size;
+ set_rate(rate);
+
+ // Store the last filter between calls to work
+ d_last_filter = 0;
+
+ d_start_index = 0;
+
+ d_filters = std::vector<kernel::fir_filter_fff*>(d_int_rate);
+ d_diff_filters = std::vector<kernel::fir_filter_fff*>(d_int_rate);
+
+ // Create an FIR filter for each channel and zero out the taps
+ std::vector<float> vtaps(0, d_int_rate);
+ for(unsigned int i = 0; i < d_int_rate; i++) {
+ d_filters[i] = new kernel::fir_filter_fff(1, vtaps);
+ d_diff_filters[i] = new kernel::fir_filter_fff(1, vtaps);
+ }
+
+ // Now, actually set the filters' taps
+ std::vector<float> dtaps;
+ create_diff_taps(taps, dtaps);
+ create_taps(taps, d_taps, d_filters);
+ create_taps(dtaps, d_dtaps, d_diff_filters);
+ }
+
+ pfb_arb_resampler_fff_impl::~pfb_arb_resampler_fff_impl()
+ {
+ for(unsigned int i = 0; i < d_int_rate; i++) {
+ delete d_filters[i];
+ delete d_diff_filters[i];
+ }
+ }
+
+ void
+ pfb_arb_resampler_fff_impl::create_taps(const std::vector<float> &newtaps,
+ std::vector< std::vector<float> > &ourtaps,
+ std::vector<kernel::fir_filter_fff*> &ourfilter)
+ {
+ unsigned int ntaps = newtaps.size();
+ d_taps_per_filter = (unsigned int)ceil((double)ntaps/(double)d_int_rate);
+
+ // Create d_numchan vectors to store each channel's taps
+ ourtaps.resize(d_int_rate);
+
+ // Make a vector of the taps plus fill it out with 0's to fill
+ // each polyphase filter with exactly d_taps_per_filter
+ std::vector<float> tmp_taps;
+ tmp_taps = newtaps;
+ while((float)(tmp_taps.size()) < d_int_rate*d_taps_per_filter) {
+ tmp_taps.push_back(0.0);
+ }
+
+ // Partition the filter
+ for(unsigned int i = 0; i < d_int_rate; i++) {
+ // Each channel uses all d_taps_per_filter with 0's if not enough taps to fill out
+ ourtaps[d_int_rate-1-i] = std::vector<float>(d_taps_per_filter, 0);
+ for(unsigned int j = 0; j < d_taps_per_filter; j++) {
+ ourtaps[d_int_rate - 1 - i][j] = tmp_taps[i + j*d_int_rate];
+ }
+
+ // Build a filter for each channel and add it's taps to it
+ ourfilter[i]->set_taps(ourtaps[d_int_rate-1-i]);
+ }
+
+ // Set the history to ensure enough input items for each filter
+ set_history(d_taps_per_filter + 1);
+
+ d_updated = true;
+ }
+
+ void
+ pfb_arb_resampler_fff_impl::create_diff_taps(const std::vector<float> &newtaps,
+ std::vector<float> &difftaps)
+ {
+ // Calculate the differential taps (derivative filter) by taking the difference
+ // between two taps. Duplicate the last one to make both filters the same length.
+ float tap;
+ difftaps.clear();
+ for(unsigned int i = 0; i < newtaps.size()-1; i++) {
+ tap = newtaps[i+1] - newtaps[i];
+ difftaps.push_back(tap);
+ }
+ difftaps.push_back(tap);
+ }
+
+ void
+ pfb_arb_resampler_fff_impl::set_taps(const std::vector<float> &taps)
+ {
+ gruel::scoped_lock guard(d_mutex);
+ }
+
+ std::vector<std::vector<float> >
+ pfb_arb_resampler_fff_impl::taps() const
+ {
+ return d_taps;
+ }
+
+ void
+ pfb_arb_resampler_fff_impl::print_taps()
+ {
+ unsigned int i, j;
+ for(i = 0; i < d_int_rate; i++) {
+ printf("filter[%d]: [", i);
+ for(j = 0; j < d_taps_per_filter; j++) {
+ printf(" %.4e", d_taps[i][j]);
+ }
+ printf("]\n");
+ }
+ }
+
+ void
+ pfb_arb_resampler_fff_impl::set_rate(float rate)
+ {
+ gruel::scoped_lock guard(d_mutex);
+
+ d_dec_rate = (unsigned int)floor(d_int_rate/rate);
+ d_flt_rate = (d_int_rate/rate) - d_dec_rate;
+ set_relative_rate(rate);
+ }
+
+ void
+ pfb_arb_resampler_fff_impl::set_phase(float ph)
+ {
+ gruel::scoped_lock guard(d_mutex);
+ if((ph < 0) || (ph >= 2.0*M_PI)) {
+ throw std::runtime_error("pfb_arb_resampler_ccf: set_phase value out of bounds [0, 2pi).\n");
+ }
+
+ float ph_diff = 2.0*M_PI / (float)d_filters.size();
+ d_last_filter = static_cast<int>(ph / ph_diff);
+ }
+
+ float
+ pfb_arb_resampler_fff_impl::phase() const
+ {
+ float ph_diff = 2.0*M_PI / static_cast<float>(d_filters.size());
+ return d_last_filter * ph_diff;
+ }
+
+ int
+ pfb_arb_resampler_fff_impl::general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ gruel::scoped_lock guard(d_mutex);
+
+ float *in = (float*)input_items[0];
+ float *out = (float*)output_items[0];
+
+ if(d_updated) {
+ d_updated = false;
+ return 0; // history requirements may have changed.
+ }
+
+ int i = 0, count = d_start_index;
+ unsigned int j;
+ float o0, o1;
+
+ // Restore the last filter position
+ j = d_last_filter;
+
+ // produce output as long as we can and there are enough input samples
+ int max_input = ninput_items[0] - (int)d_taps_per_filter;
+ while((i < noutput_items) && (count < max_input)) {
+ // start j by wrapping around mod the number of channels
+ while((j < d_int_rate) && (i < noutput_items)) {
+ // Take the current filter and derivative filter output
+ o0 = d_filters[j]->filter(&in[count]);
+ o1 = d_diff_filters[j]->filter(&in[count]);
+
+ out[i] = o0 + o1*d_acc; // linearly interpolate between samples
+ i++;
+
+ // Adjust accumulator and index into filterbank
+ d_acc += d_flt_rate;
+ j += d_dec_rate + (int)floor(d_acc);
+ d_acc = fmodf(d_acc, 1.0);
+ }
+ if(i < noutput_items) { // keep state for next entry
+ float ss = (int)(j / d_int_rate); // number of items to skip ahead by
+ count += ss; // we have fully consumed another input
+ j = j % d_int_rate; // roll filter around
+ }
+ }
+
+ // Store the current filter position and start of next sample
+ d_last_filter = j;
+ d_start_index = std::max(0, count - ninput_items[0]);
+
+ // consume all we've processed but no more than we can
+ consume_each(std::min(count, ninput_items[0]));
+ return i;
+ }
+
+ } /* namespace filter */
+} /* namespace gr */
diff --git a/gr-filter/lib/pfb_arb_resampler_fff_impl.h b/gr-filter/lib/pfb_arb_resampler_fff_impl.h
new file mode 100644
index 000000000..588962711
--- /dev/null
+++ b/gr-filter/lib/pfb_arb_resampler_fff_impl.h
@@ -0,0 +1,88 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2009-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 INCLUDED_PFB_ARB_RESAMPLER_FFF_IMPL_H
+#define INCLUDED_PFB_ARB_RESAMPLER_FFF_IMPL_H
+
+#include <filter/pfb_arb_resampler_fff.h>
+#include <filter/fir_filter.h>
+#include <gruel/thread.h>
+
+namespace gr {
+ namespace filter {
+
+ class FILTER_API pfb_arb_resampler_fff_impl : public pfb_arb_resampler_fff
+ {
+ private:
+ std::vector<kernel::fir_filter_fff*> d_filters;
+ std::vector<kernel::fir_filter_fff*> d_diff_filters;
+ std::vector< std::vector<float> > d_taps;
+ std::vector< std::vector<float> > d_dtaps;
+ unsigned int d_int_rate; // the number of filters (interpolation rate)
+ unsigned int d_dec_rate; // the stride through the filters (decimation rate)
+ float d_flt_rate; // residual rate for the linear interpolation
+ float d_acc;
+ unsigned int d_last_filter;
+ int d_start_index;
+ unsigned int d_taps_per_filter;
+ bool d_updated;
+ gruel::mutex d_mutex; // mutex to protect set/work access
+
+ void create_diff_taps(const std::vector<float> &newtaps,
+ std::vector<float> &difftaps);
+
+ /*!
+ * Resets the filterbank's filter taps with the new prototype filter
+ * \param newtaps (vector of floats) The prototype filter to populate the filterbank.
+ * The taps should be generated at the interpolated sampling rate.
+ * \param ourtaps (vector of floats) Reference to our internal member of holding the taps.
+ * \param ourfilter (vector of filters) Reference to our internal filter to set the taps for.
+ */
+ void create_taps(const std::vector<float> &newtaps,
+ std::vector< std::vector<float> > &ourtaps,
+ std::vector<kernel::fir_filter_fff*> &ourfilter);
+ public:
+ pfb_arb_resampler_fff_impl(float rate,
+ const std::vector<float> &taps,
+ unsigned int filter_size);
+
+ ~pfb_arb_resampler_fff_impl();
+
+ void set_taps(const std::vector<float> &taps);
+ std::vector<std::vector<float> > taps() const;
+ void print_taps();
+ void set_rate(float rate);
+
+ void set_phase(float ph);
+ float phase() const;
+
+ int general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace filter */
+} /* namespace gr */
+
+#endif /* INCLUDED_PFB_ARB_RESAMPLER_FFF_IMPL_H */
diff --git a/gr-filter/lib/pfb_channelizer_ccf_impl.cc b/gr-filter/lib/pfb_channelizer_ccf_impl.cc
new file mode 100644
index 000000000..28fc1dcc1
--- /dev/null
+++ b/gr-filter/lib/pfb_channelizer_ccf_impl.cc
@@ -0,0 +1,191 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2009,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 "pfb_channelizer_ccf_impl.h"
+#include <gr_io_signature.h>
+
+namespace gr {
+ namespace filter {
+
+ pfb_channelizer_ccf::sptr pfb_channelizer_ccf::make(unsigned int nfilts,
+ const std::vector<float> &taps,
+ float oversample_rate)
+ {
+ return gnuradio::get_initial_sptr(new pfb_channelizer_ccf_impl(nfilts, taps,
+ oversample_rate));
+ }
+
+ pfb_channelizer_ccf_impl::pfb_channelizer_ccf_impl(unsigned int nfilts,
+ const std::vector<float> &taps,
+ float oversample_rate)
+ : gr_block("pfb_channelizer_ccf",
+ gr_make_io_signature(nfilts, nfilts, sizeof(gr_complex)),
+ gr_make_io_signature(1, nfilts, sizeof(gr_complex))),
+ polyphase_filterbank(nfilts, taps),
+ d_updated(false), d_oversample_rate(oversample_rate)
+ {
+ // The over sampling rate must be rationally related to the number of channels
+ // in that it must be N/i for i in [1,N], which gives an outputsample rate
+ // of [fs/N, fs] where fs is the input sample rate.
+ // This tests the specified input sample rate to see if it conforms to this
+ // requirement within a few significant figures.
+ double intp = 0;
+ double fltp = modf(nfilts / oversample_rate, &intp);
+ if(fltp != 0.0)
+ throw std::invalid_argument("pfb_channelizer: oversample rate must be N/i for i in [1, N]");
+
+ set_relative_rate(1.0/intp);
+
+ // Default channel map
+ d_channel_map.resize(d_nfilts);
+ for(unsigned int i = 0; i < d_nfilts; i++) {
+ d_channel_map[i] = i;
+ }
+
+ // Although the filters change, we use this look up table
+ // to set the index of the FFT input buffer, which equivalently
+ // performs the FFT shift operation on every other turn.
+ d_rate_ratio = (int)rintf(d_nfilts / d_oversample_rate);
+ d_idxlut = new int[d_nfilts];
+ for(unsigned int i = 0; i < d_nfilts; i++) {
+ d_idxlut[i] = d_nfilts - ((i + d_rate_ratio) % d_nfilts) - 1;
+ }
+
+ // Calculate the number of filtering rounds to do to evenly
+ // align the input vectors with the output channels
+ d_output_multiple = 1;
+ while((d_output_multiple * d_rate_ratio) % d_nfilts != 0)
+ d_output_multiple++;
+ set_output_multiple(d_output_multiple);
+
+ set_history(d_taps_per_filter+1);
+ }
+
+ pfb_channelizer_ccf_impl::~pfb_channelizer_ccf_impl()
+ {
+ delete [] d_idxlut;
+ }
+
+ void
+ pfb_channelizer_ccf_impl::set_taps(const std::vector<float> &taps)
+ {
+ gruel::scoped_lock guard(d_mutex);
+
+ polyphase_filterbank::set_taps(taps);
+ set_history(d_taps_per_filter+1);
+ d_updated = true;
+ }
+
+ void
+ pfb_channelizer_ccf_impl::print_taps()
+ {
+ polyphase_filterbank::print_taps();
+ }
+
+ std::vector<std::vector<float> >
+ pfb_channelizer_ccf_impl::taps() const
+ {
+ return polyphase_filterbank::taps();
+ }
+
+ void
+ pfb_channelizer_ccf_impl::set_channel_map(const std::vector<int> &map)
+ {
+ gruel::scoped_lock guard(d_mutex);
+
+ if(map.size() > 0) {
+ unsigned int max = (unsigned int)*std::max_element(map.begin(), map.end());
+ if(max >= d_nfilts) {
+ throw std::invalid_argument("pfb_channelizer_ccf_impl::set_channel_map: map range out of bounds.\n");
+ }
+ d_channel_map = map;
+ }
+ }
+
+ std::vector<int>
+ pfb_channelizer_ccf_impl::channel_map() const
+ {
+ return d_channel_map;
+ }
+
+ int
+ pfb_channelizer_ccf_impl::general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ gruel::scoped_lock guard(d_mutex);
+
+ gr_complex *in = (gr_complex *) input_items[0];
+ gr_complex *out = (gr_complex *) output_items[0];
+
+ if(d_updated) {
+ d_updated = false;
+ return 0; // history requirements may have changed.
+ }
+
+ size_t noutputs = output_items.size();
+
+ int n=1, i=-1, j=0, oo=0, last;
+ int toconsume = (int)rintf(noutput_items/d_oversample_rate);
+ while(n <= toconsume) {
+ j = 0;
+ i = (i + d_rate_ratio) % d_nfilts;
+ last = i;
+ while(i >= 0) {
+ in = (gr_complex*)input_items[j];
+ d_fft->get_inbuf()[d_idxlut[j]] = d_filters[i]->filter(&in[n]);
+ j++;
+ i--;
+ }
+
+ i = d_nfilts-1;
+ while(i > last) {
+ in = (gr_complex*)input_items[j];
+ d_fft->get_inbuf()[d_idxlut[j]] = d_filters[i]->filter(&in[n-1]);
+ j++;
+ i--;
+ }
+
+ n += (i+d_rate_ratio) >= (int)d_nfilts;
+
+ // despin through FFT
+ d_fft->execute();
+
+ // Send to output channels
+ for(unsigned int nn = 0; nn < noutputs; nn++) {
+ out = (gr_complex*)output_items[nn];
+ out[oo] = d_fft->get_outbuf()[d_channel_map[nn]];
+ }
+ oo++;
+ }
+
+ consume_each(toconsume);
+ return noutput_items;
+ }
+
+ } /* namespace filter */
+} /* namespace gr */
diff --git a/gr-filter/lib/pfb_channelizer_ccf_impl.h b/gr-filter/lib/pfb_channelizer_ccf_impl.h
new file mode 100644
index 000000000..16b112b9a
--- /dev/null
+++ b/gr-filter/lib/pfb_channelizer_ccf_impl.h
@@ -0,0 +1,69 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2009,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.
+ */
+
+#ifndef INCLUDED_FILTER_PFB_CHANNELIZER_CCF_IMPL_H
+#define INCLUDED_FILTER_PFB_CHANNELIZER_CCF_IMPL_H
+
+#include <filter/pfb_channelizer_ccf.h>
+#include <filter/polyphase_filterbank.h>
+#include <filter/fir_filter.h>
+#include <fft/fft.h>
+#include <gruel/thread.h>
+
+namespace gr {
+ namespace filter {
+
+ class FILTER_API pfb_channelizer_ccf_impl : public pfb_channelizer_ccf, kernel::polyphase_filterbank
+ {
+ private:
+ bool d_updated;
+ float d_oversample_rate;
+ int *d_idxlut;
+ int d_rate_ratio;
+ int d_output_multiple;
+ std::vector<int> d_channel_map;
+ gruel::mutex d_mutex; // mutex to protect set/work access
+
+ public:
+ pfb_channelizer_ccf_impl(unsigned int nfilts,
+ const std::vector<float> &taps,
+ float oversample_rate);
+
+ ~pfb_channelizer_ccf_impl();
+
+ void set_taps(const std::vector<float> &taps);
+ void print_taps();
+ std::vector<std::vector<float> > taps() const;
+
+ void set_channel_map(const std::vector<int> &map);
+ std::vector<int> channel_map() const;
+
+ int general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace filter */
+} /* namespace gr */
+
+#endif
diff --git a/gr-filter/lib/pfb_decimator_ccf_impl.cc b/gr-filter/lib/pfb_decimator_ccf_impl.cc
new file mode 100644
index 000000000..f9a60cb28
--- /dev/null
+++ b/gr-filter/lib/pfb_decimator_ccf_impl.cc
@@ -0,0 +1,137 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2009,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 "pfb_decimator_ccf_impl.h"
+#include <gr_io_signature.h>
+
+namespace gr {
+ namespace filter {
+
+ pfb_decimator_ccf::sptr
+ pfb_decimator_ccf::make(unsigned int decim,
+ const std::vector<float> &taps,
+ unsigned int channel)
+ {
+ return gnuradio::get_initial_sptr
+ (new pfb_decimator_ccf_impl(decim, taps, channel));
+ }
+
+
+ pfb_decimator_ccf_impl::pfb_decimator_ccf_impl(unsigned int decim,
+ const std::vector<float> &taps,
+ unsigned int channel)
+ : gr_sync_block("pfb_decimator_ccf",
+ gr_make_io_signature(decim, decim, sizeof(gr_complex)),
+ gr_make_io_signature(1, 1, sizeof(gr_complex))),
+ polyphase_filterbank(decim, taps),
+ d_updated(false), d_chan(channel)
+ {
+ d_rate = decim;
+ d_rotator = new gr_complex[d_rate];
+
+ set_relative_rate(1.0/(float)decim);
+ set_history(d_taps_per_filter+1);
+ }
+
+ pfb_decimator_ccf_impl::~pfb_decimator_ccf_impl()
+ {
+ }
+
+ void
+ pfb_decimator_ccf_impl::set_taps(const std::vector<float> &taps)
+ {
+ gruel::scoped_lock guard(d_mutex);
+
+ polyphase_filterbank::set_taps(taps);
+ set_history(d_taps_per_filter+1);
+ d_updated = true;
+ }
+
+ void
+ pfb_decimator_ccf_impl::print_taps()
+ {
+ polyphase_filterbank::print_taps();
+ }
+
+ std::vector<std::vector<float> >
+ pfb_decimator_ccf_impl::taps() const
+ {
+ return polyphase_filterbank::taps();
+ }
+
+#define ROTATEFFT
+
+ int
+ pfb_decimator_ccf_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ gruel::scoped_lock guard(d_mutex);
+
+ gr_complex *in;
+ gr_complex *out = (gr_complex *)output_items[0];
+
+ if(d_updated) {
+ d_updated = false;
+ return 0; // history requirements may have changed.
+ }
+
+ int i;
+ for(i = 0; i < noutput_items; i++) {
+ // Move through filters from bottom to top
+ out[i] = 0;
+ for(int j = d_rate-1; j >= 0; j--) {
+ // Take in the items from the first input stream to d_rate
+ in = (gr_complex*)input_items[d_rate - 1 - j];
+
+ // Filter current input stream from bottom filter to top
+ // The rotate them by expj(j*k*2pi/M) where M is the number of filters
+ // (the decimation rate) and k is the channel number to extract
+
+ // This is the real math that goes on; we abuse the FFT to do this quickly
+ // for decimation rates > N where N is a small number (~5):
+ // out[i] += d_filters[j]->filter(&in[i])*gr_expj(j*d_chan*2*M_PI/d_rate);
+#ifdef ROTATEFFT
+ d_fft->get_inbuf()[j] = d_filters[j]->filter(&in[i]);
+#else
+ out[i] += d_filters[j]->filter(&in[i])*d_rotator[i];
+#endif
+ }
+
+#ifdef ROTATEFFT
+ // Perform the FFT to do the complex multiply despinning for all channels
+ d_fft->execute();
+
+ // Select only the desired channel out
+ out[i] = d_fft->get_outbuf()[d_chan];
+#endif
+ }
+
+ return noutput_items;
+ }
+
+ } /* namespace filter */
+} /* namespace gr */
diff --git a/gr-filter/lib/pfb_decimator_ccf_impl.h b/gr-filter/lib/pfb_decimator_ccf_impl.h
new file mode 100644
index 000000000..c4338a5ec
--- /dev/null
+++ b/gr-filter/lib/pfb_decimator_ccf_impl.h
@@ -0,0 +1,65 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2009,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 INCLUDED_PFB_DECIMATOR_CCF_IMPL_H
+#define INCLUDED_PFB_DECIMATOR_CCF_IMPL_H
+
+#include <filter/pfb_decimator_ccf.h>
+#include <filter/polyphase_filterbank.h>
+#include <filter/fir_filter.h>
+#include <fft/fft.h>
+#include <gruel/thread.h>
+
+namespace gr {
+ namespace filter {
+
+ class FILTER_API pfb_decimator_ccf_impl : public pfb_decimator_ccf, kernel::polyphase_filterbank
+ {
+ private:
+ bool d_updated;
+ unsigned int d_rate;
+ unsigned int d_chan;
+ gr_complex *d_rotator;
+ gruel::mutex d_mutex; // mutex to protect set/work access
+
+ public:
+ pfb_decimator_ccf_impl(unsigned int decim,
+ const std::vector<float> &taps,
+ unsigned int channel);
+
+ ~pfb_decimator_ccf_impl();
+
+ void set_taps(const std::vector<float> &taps);
+ void print_taps();
+ std::vector<std::vector<float> > taps() const;
+ //void set_channel(unsigned int channel);
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace filter */
+} /* namespace gr */
+
+#endif /* INCLUDED_PFB_DECIMATOR_CCF_IMPL_H */
diff --git a/gr-filter/lib/pfb_interpolator_ccf_impl.cc b/gr-filter/lib/pfb_interpolator_ccf_impl.cc
new file mode 100644
index 000000000..572db728b
--- /dev/null
+++ b/gr-filter/lib/pfb_interpolator_ccf_impl.cc
@@ -0,0 +1,107 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2009,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 "pfb_interpolator_ccf_impl.h"
+#include <gr_io_signature.h>
+
+namespace gr {
+ namespace filter {
+
+ pfb_interpolator_ccf::sptr
+ pfb_interpolator_ccf::make(unsigned int interp,
+ const std::vector<float> &taps)
+ {
+ return gnuradio::get_initial_sptr
+ (new pfb_interpolator_ccf_impl(interp, taps));
+ }
+
+
+ pfb_interpolator_ccf_impl::pfb_interpolator_ccf_impl(unsigned int interp,
+ const std::vector<float> &taps)
+ : gr_sync_interpolator("pfb_interpolator_ccf",
+ gr_make_io_signature(1, 1, sizeof(gr_complex)),
+ gr_make_io_signature(1, 1, sizeof(gr_complex)),
+ interp),
+ polyphase_filterbank(interp, taps),
+ d_updated (false), d_rate(interp)
+ {
+ set_history(d_taps_per_filter+1);
+ }
+
+ pfb_interpolator_ccf_impl::~pfb_interpolator_ccf_impl()
+ {
+ }
+
+ void
+ pfb_interpolator_ccf_impl::set_taps(const std::vector<float> &taps)
+ {
+ gruel::scoped_lock guard(d_mutex);
+
+ polyphase_filterbank::set_taps(taps);
+ set_history(d_taps_per_filter+1);
+ d_updated = true;
+ }
+
+ void
+ pfb_interpolator_ccf_impl::print_taps()
+ {
+ polyphase_filterbank::print_taps();
+ }
+
+ std::vector<std::vector<float> >
+ pfb_interpolator_ccf_impl::taps() const
+ {
+ return polyphase_filterbank::taps();
+ }
+
+ int
+ pfb_interpolator_ccf_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ gr_complex *in = (gr_complex*)input_items[0];
+ gr_complex *out = (gr_complex*)output_items[0];
+
+ if(d_updated) {
+ d_updated = false;
+ return 0; // history requirements may have changed.
+ }
+
+ int i = 0, count = 0;
+
+ while(i < noutput_items) {
+ for(unsigned int j = 0; j < d_rate; j++) {
+ out[i] = d_filters[j]->filter(&in[count]);
+ i++;
+ }
+ count++;
+ }
+
+ return i;
+ }
+
+ } /* namespace filter */
+} /* namespace gr */
diff --git a/gr-filter/lib/pfb_interpolator_ccf_impl.h b/gr-filter/lib/pfb_interpolator_ccf_impl.h
new file mode 100644
index 000000000..7e1fe2ca1
--- /dev/null
+++ b/gr-filter/lib/pfb_interpolator_ccf_impl.h
@@ -0,0 +1,61 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2009,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 INCLUDED_PFB_INTERPOLATOR_CCF_IMPL_H
+#define INCLUDED_PFB_INTERPOLATOR_CCF_IMPL_H
+
+#include <filter/pfb_interpolator_ccf.h>
+#include <filter/polyphase_filterbank.h>
+#include <filter/fir_filter.h>
+#include <fft/fft.h>
+#include <gruel/thread.h>
+
+namespace gr {
+ namespace filter {
+
+ class FILTER_API pfb_interpolator_ccf_impl : public pfb_interpolator_ccf, kernel::polyphase_filterbank
+ {
+ private:
+ bool d_updated;
+ unsigned int d_rate;
+ gruel::mutex d_mutex; // mutex to protect set/work access
+
+ public:
+ pfb_interpolator_ccf_impl(unsigned int interp,
+ const std::vector<float> &taps);
+
+ ~pfb_interpolator_ccf_impl();
+
+ void set_taps(const std::vector<float> &taps);
+ void print_taps();
+ std::vector<std::vector<float> > taps() const;
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace filter */
+} /* namespace gr */
+
+#endif /* INCLUDED_PFB_INTERPOLATOR_CCF_IMPL_H */
diff --git a/gr-filter/lib/pfb_synthesizer_ccf_impl.cc b/gr-filter/lib/pfb_synthesizer_ccf_impl.cc
new file mode 100644
index 000000000..f89b48b12
--- /dev/null
+++ b/gr-filter/lib/pfb_synthesizer_ccf_impl.cc
@@ -0,0 +1,289 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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 "pfb_synthesizer_ccf_impl.h"
+#include <gr_io_signature.h>
+#include <cstdio>
+
+namespace gr {
+ namespace filter {
+
+ pfb_synthesizer_ccf::sptr
+ pfb_synthesizer_ccf::make(unsigned int numchans,
+ const std::vector<float> &taps,
+ bool twox)
+ {
+ return gnuradio::get_initial_sptr
+ (new pfb_synthesizer_ccf_impl(numchans, taps, twox));
+ }
+
+
+ pfb_synthesizer_ccf_impl::pfb_synthesizer_ccf_impl(unsigned int numchans,
+ const std::vector<float> &taps,
+ bool twox)
+ : gr_sync_interpolator("pfb_synthesizer_ccf",
+ gr_make_io_signature(1, numchans, sizeof(gr_complex)),
+ gr_make_io_signature(1, 1, sizeof(gr_complex)),
+ (twox ? numchans/2 : numchans)),
+ d_updated(false), d_numchans(numchans), d_state(0)
+ {
+ // set up 2x multiplier; if twox==True, set to 2, otherwise to 1
+ d_twox = (twox ? 2 : 1);
+ if(d_numchans % d_twox != 0) {
+ throw std::invalid_argument("pfb_synthesizer_ccf: number of channels must be even for 2x oversampling.\n");
+ }
+
+ d_filters = std::vector<kernel::fir_filter_with_buffer_ccf*>(d_numchans);
+ d_channel_map.resize(d_numchans);
+
+ // Create a FIR filter for each channel and zero out the taps
+ std::vector<float> vtaps(0, d_numchans);
+ for(unsigned int i = 0; i < d_numchans; i++) {
+ d_filters[i] = new kernel::fir_filter_with_buffer_ccf(vtaps);
+ d_channel_map[i] = i;
+ }
+
+ // Now, actually set the filters' taps
+ set_taps(taps);
+
+ // Create the IFFT to handle the input channel rotations
+ d_fft = new fft::fft_complex(d_numchans, false);
+ memset(d_fft->get_inbuf(), 0, d_numchans*sizeof(gr_complex));
+
+ set_output_multiple(d_numchans);
+ }
+
+ pfb_synthesizer_ccf_impl::~pfb_synthesizer_ccf_impl()
+ {
+ for(unsigned int i = 0; i < d_numchans; i++) {
+ delete d_filters[i];
+ }
+ }
+
+ void
+ pfb_synthesizer_ccf_impl::set_taps(const std::vector<float> &taps)
+ {
+ gruel::scoped_lock guard(d_mutex);
+
+ if(d_twox == 1)
+ set_taps1(taps);
+ else
+ set_taps2(taps);
+
+ // Set the history to ensure enough input items for each filter
+ set_history(d_taps_per_filter+1);
+
+ d_updated = true;
+ }
+
+ void
+ pfb_synthesizer_ccf_impl::set_taps1(const std::vector<float> &taps)
+ {
+ unsigned int i,j;
+
+ unsigned int ntaps = taps.size();
+ d_taps_per_filter = (unsigned int)ceil((double)ntaps/(double)d_numchans);
+
+ // Create d_numchan vectors to store each channel's taps
+ d_taps.resize(d_numchans);
+
+ // Make a vector of the taps plus fill it out with 0's to fill
+ // each polyphase filter with exactly d_taps_per_filter
+ std::vector<float> tmp_taps;
+ tmp_taps = taps;
+ while((float)(tmp_taps.size()) < d_numchans*d_taps_per_filter) {
+ tmp_taps.push_back(0.0);
+ }
+
+ // Partition the filter
+ for(i = 0; i < d_numchans; i++) {
+ // Each channel uses all d_taps_per_filter with 0's if not enough taps to fill out
+ d_taps[i] = std::vector<float>(d_taps_per_filter, 0);
+ for(j = 0; j < d_taps_per_filter; j++) {
+ d_taps[i][j] = tmp_taps[i + j*d_numchans]; // add taps to channels in reverse order
+ }
+
+ // Build a filter for each channel and add it's taps to it
+ d_filters[i]->set_taps(d_taps[i]);
+ }
+ }
+
+ void
+ pfb_synthesizer_ccf_impl::set_taps2 (const std::vector<float> &taps)
+ {
+ unsigned int i,j;
+ int state = 0;
+
+ unsigned int ntaps = 2*taps.size();
+ d_taps_per_filter = (unsigned int)ceil((double)ntaps/(double)d_numchans);
+
+ // Create d_numchan vectors to store each channel's taps
+ d_taps.resize(d_numchans);
+
+ // Make a vector of the taps plus fill it out with 0's to fill
+ // each polyphase filter with exactly d_taps_per_filter
+ std::vector<float> tmp_taps;
+ tmp_taps = taps;
+ while((float)(tmp_taps.size()) < d_numchans*d_taps_per_filter) {
+ tmp_taps.push_back(0.0);
+ }
+
+ // Partition the filter
+ unsigned int halfchans = d_numchans/2;
+ for(i = 0; i < halfchans; i++) {
+ // Each channel uses all d_taps_per_filter with 0's if not enough taps to fill out
+ d_taps[i] = std::vector<float>(d_taps_per_filter, 0);
+ d_taps[halfchans+i] = std::vector<float>(d_taps_per_filter, 0);
+ state = 0;
+ for(j = 0; j < d_taps_per_filter; j++) {
+ // add taps to channels in reverse order
+ // Zero out every other tap
+ if(state == 0) {
+ d_taps[i][j] = tmp_taps[i + j*halfchans];
+ d_taps[halfchans + i][j] = 0;
+ state = 1;
+ }
+ else {
+ d_taps[i][j] = 0;
+ d_taps[halfchans + i][j] = tmp_taps[i + j*halfchans];
+ state = 0;
+ }
+ }
+
+ // Build a filter for each channel and add it's taps to it
+ d_filters[i]->set_taps(d_taps[i]);
+ d_filters[halfchans + i]->set_taps(d_taps[halfchans + i]);
+ }
+ }
+
+ void
+ pfb_synthesizer_ccf_impl::print_taps()
+ {
+ unsigned int i, j;
+ for(i = 0; i < d_numchans; i++) {
+ printf("filter[%d]: [", i);
+ for(j = 0; j < d_taps_per_filter; j++) {
+ printf(" %.4e", d_taps[i][j]);
+ }
+ printf("]\n\n");
+ }
+ }
+
+ std::vector< std::vector<float> >
+ pfb_synthesizer_ccf_impl::taps() const
+ {
+ return d_taps;
+ }
+
+ void
+ pfb_synthesizer_ccf_impl::set_channel_map(const std::vector<int> &map)
+ {
+ gruel::scoped_lock guard(d_mutex);
+
+ if(map.size() > 0) {
+ unsigned int max = (unsigned int)*std::max_element(map.begin(), map.end());
+ if(max >= d_numchans) {
+ throw std::invalid_argument("gr_pfb_synthesizer_ccf::set_channel_map: map range out of bounds.\n");
+ }
+ d_channel_map = map;
+
+ // Zero out fft buffer so that unused channels are always 0
+ memset(d_fft->get_inbuf(), 0, d_numchans*sizeof(gr_complex));
+ }
+ }
+
+ std::vector<int>
+ pfb_synthesizer_ccf_impl::channel_map() const
+ {
+ return d_channel_map;
+ }
+
+ int
+ pfb_synthesizer_ccf_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ gruel::scoped_lock guard(d_mutex);
+
+ gr_complex *in = (gr_complex*)input_items[0];
+ gr_complex *out = (gr_complex*)output_items[0];
+
+ if(d_updated) {
+ d_updated = false;
+ return 0; // history requirements may have changed.
+ }
+
+ unsigned int n, i;
+ size_t ninputs = input_items.size();
+
+ // Algoritm for critically sampled channels
+ if(d_twox == 1) {
+ for(n = 0; n < noutput_items/d_numchans; n++) {
+ for(i = 0; i < ninputs; i++) {
+ in = (gr_complex*)input_items[i];
+ d_fft->get_inbuf()[d_channel_map[i]] = in[n];
+ }
+
+ // spin through IFFT
+ d_fft->execute();
+
+ for(i = 0; i < d_numchans; i++) {
+ out[i] = d_filters[i]->filter(d_fft->get_outbuf()[i]);
+ }
+ out += d_numchans;
+ }
+ }
+
+ // Algorithm for oversampling by 2x
+ else {
+ unsigned int halfchans = d_numchans/2;
+ for(n = 0; n < noutput_items/halfchans; n++) {
+ for(i = 0; i < ninputs; i++) {
+ in = (gr_complex*)input_items[i];
+ d_fft->get_inbuf()[d_channel_map[i]] = in[n];
+ }
+
+ // spin through IFFT
+ d_fft->execute();
+
+ // Output is sum of two filters, but the input buffer to the filters must be circularly
+ // shifted by numchans every time through, done by using d_state to determine which IFFT
+ // buffer position to pull from.
+ for(i = 0; i < halfchans; i++) {
+ out[i] = d_filters[i]->filter(d_fft->get_outbuf()[d_state*halfchans+i]);
+ out[i] += d_filters[halfchans+i]->filter(d_fft->get_outbuf()[(d_state^1)*halfchans+i]);
+ }
+ d_state ^= 1;
+
+ out += halfchans;
+ }
+ }
+
+ return noutput_items;
+ }
+
+ } /* namespace filter */
+} /* namespace gr */
diff --git a/gr-filter/lib/pfb_synthesizer_ccf_impl.h b/gr-filter/lib/pfb_synthesizer_ccf_impl.h
new file mode 100644
index 000000000..adffc143f
--- /dev/null
+++ b/gr-filter/lib/pfb_synthesizer_ccf_impl.h
@@ -0,0 +1,85 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+
+#ifndef INCLUDED_PFB_SYNTHESIZER_CCF_IMPL_H
+#define INCLUDED_PFB_SYNTHESIZER_CCF_IMPL_H
+
+#include <filter/pfb_synthesizer_ccf.h>
+#include <filter/fir_filter_with_buffer.h>
+#include <fft/fft.h>
+#include <gruel/thread.h>
+
+namespace gr {
+ namespace filter {
+
+ // While this is a polyphase_filterbank, we don't use the normal
+ // parent class because we have to use the fir_filter_with_buffer
+ // objects instead of normal filters.
+
+ class FILTER_API pfb_synthesizer_ccf_impl : public pfb_synthesizer_ccf
+ {
+ private:
+ bool d_updated;
+ unsigned int d_numchans;
+ unsigned int d_taps_per_filter;
+ fft::fft_complex *d_fft;
+ std::vector< kernel::fir_filter_with_buffer_ccf*> d_filters;
+ std::vector< std::vector<float> > d_taps;
+ int d_state;
+ std::vector<int> d_channel_map;
+ unsigned int d_twox;
+ gruel::mutex d_mutex; // mutex to protect set/work access
+
+ /*!
+ * \brief Tap setting algorithm for critically sampled channels
+ */
+ void set_taps1(const std::vector<float> &taps);
+
+ /*!
+ * \brief Tap setting algorithm for 2x over-sampled channels
+ */
+ void set_taps2(const std::vector<float> &taps);
+
+
+ public:
+ pfb_synthesizer_ccf_impl(unsigned int numchans,
+ const std::vector<float> &taps,
+ bool twox);
+ ~pfb_synthesizer_ccf_impl();
+
+ void set_taps(const std::vector<float> &taps);
+ std::vector<std::vector<float> > taps() const;
+ void print_taps();
+
+ void set_channel_map(const std::vector<int> &map);
+ std::vector<int> channel_map() const;
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace filter */
+} /* namespace gr */
+
+#endif /* INCLUDED_PFB_SYNTHESIZER_CCF_IMPL_H */
diff --git a/gr-filter/lib/pm_remez.cc b/gr-filter/lib/pm_remez.cc
new file mode 100644
index 000000000..e7136bd83
--- /dev/null
+++ b/gr-filter/lib/pm_remez.cc
@@ -0,0 +1,834 @@
+/**************************************************************************
+ * Parks-McClellan algorithm for FIR filter design (C version)
+ *-------------------------------------------------
+ * Copyright (c) 1995,1998 Jake Janovetz (janovetz@uiuc.edu)
+ * Copyright (c) 2004 Free Software Foundation, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Foundation, Inc., 51 Franklin Street, Boston, MA 02110-1301 USA
+ *
+ *
+ * Sep 1999 - Paul Kienzle (pkienzle@cs.indiana.edu)
+ * Modified for use in octave as a replacement for the matlab function
+ * remez.mex. In particular, magnitude responses are required for all
+ * band edges rather than one per band, griddensity is a parameter,
+ * and errors are returned rather than printed directly.
+ * Mar 2000 - Kai Habel (kahacjde@linux.zrz.tu-berlin.de)
+ * Change: ColumnVector x=arg(i).vector_value();
+ * to: ColumnVector x(arg(i).vector_value());
+ * There appear to be some problems with the routine search. See comments
+ * therein [search for PAK:]. I haven't looked closely at the rest
+ * of the code---it may also have some problems.
+ *************************************************************************/
+
+/*
+ * This code was extracted from octave.sf.net, and wrapped with
+ * GNU Radio glue.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <filter/pm_remez.h>
+#include <cmath>
+#include <assert.h>
+#include <iostream>
+
+#ifndef LOCAL_BUFFER
+#include <vector>
+#define LOCAL_BUFFER(T, buf, size) \
+ std::vector<T> buf ## _vector (size); \
+ T *buf = &(buf ## _vector[0])
+#endif
+
+namespace gr {
+ namespace filter {
+
+#define CONST const
+#define BANDPASS 1
+#define DIFFERENTIATOR 2
+#define HILBERT 3
+
+#define NEGATIVE 0
+#define POSITIVE 1
+
+#define Pi 3.14159265358979323846
+#define Pi2 (2*Pi)
+
+#define GRIDDENSITY 16
+#define MAXITERATIONS 40
+
+ /*******************
+ * create_dense_grid
+ *=================
+ *
+ * Creates the dense grid of frequencies from the specified bands.
+ * Also creates the Desired Frequency Response function (D[]) and
+ * the Weight function (W[]) on that dense grid
+ *
+ *
+ * INPUT:
+ * ------
+ * int r - 1/2 the number of filter coefficients
+ * int numtaps - Number of taps in the resulting filter
+ * int numband - Number of bands in user specification
+ * double bands[] - User-specified band edges [2*numband]
+ * double des[] - Desired response per band [2*numband]
+ * double weight[] - Weight per band [numband]
+ * int symmetry - Symmetry of filter - used for grid check
+ * int griddensity
+ *
+ * OUTPUT:
+ * -------
+ * int gridsize - Number of elements in the dense frequency grid
+ * double Grid[] - Frequencies (0 to 0.5) on the dense grid [gridsize]
+ * double D[] - Desired response on the dense grid [gridsize]
+ * double W[] - Weight function on the dense grid [gridsize]
+ *******************/
+
+ static void
+ create_dense_grid(int r, int numtaps, int numband, const double bands[],
+ const double des[], const double weight[], int gridsize,
+ double Grid[], double D[], double W[],
+ int symmetry, int griddensity)
+ {
+ int i, j, k, band;
+ double delf, lowf, highf, grid0;
+
+ delf = 0.5/(griddensity*r);
+
+ /*
+ * For differentiator, hilbert,
+ * symmetry is odd and Grid[0] = max(delf, bands[0])
+ */
+ grid0 = (symmetry == NEGATIVE) && (delf > bands[0]) ? delf : bands[0];
+
+ j=0;
+ for(band=0; band < numband; band++) {
+ lowf = (band==0 ? grid0 : bands[2*band]);
+ highf = bands[2*band + 1];
+ k = (int)((highf - lowf)/delf + 0.5); /* .5 for rounding */
+ for(i=0; i<k; i++) {
+ D[j] = des[2*band] + i*(des[2*band+1]-des[2*band])/(k-1);
+ W[j] = weight[band];
+ Grid[j] = lowf;
+ lowf += delf;
+ j++;
+ }
+ Grid[j-1] = highf;
+ }
+
+ /*
+ * Similar to above, if odd symmetry, last grid point can't be .5
+ * - but, if there are even taps, leave the last grid point at .5
+ */
+ if((symmetry == NEGATIVE) &&
+ (Grid[gridsize-1] > (0.5 - delf)) &&
+ (numtaps % 2))
+ {
+ Grid[gridsize-1] = 0.5-delf;
+ }
+ }
+
+
+ /********************
+ * initial_guess
+ *==============
+ * Places Extremal Frequencies evenly throughout the dense grid.
+ *
+ *
+ * INPUT:
+ * ------
+ * int r - 1/2 the number of filter coefficients
+ * int gridsize - Number of elements in the dense frequency grid
+ *
+ * OUTPUT:
+ * -------
+ * int ext[] - Extremal indexes to dense frequency grid [r+1]
+ ********************/
+
+ static void
+ initial_guess(int r, int Ext[], int gridsize)
+ {
+ int i;
+
+ for(i=0; i<=r; i++)
+ Ext[i] = i * (gridsize-1) / r;
+ }
+
+
+ /***********************
+ * calc_parms
+ *===========
+ *
+ *
+ * INPUT:
+ * ------
+ * int r - 1/2 the number of filter coefficients
+ * int Ext[] - Extremal indexes to dense frequency grid [r+1]
+ * double Grid[] - Frequencies (0 to 0.5) on the dense grid [gridsize]
+ * double D[] - Desired response on the dense grid [gridsize]
+ * double W[] - Weight function on the dense grid [gridsize]
+ *
+ * OUTPUT:
+ * -------
+ * double ad[] - 'b' in Oppenheim & Schafer [r+1]
+ * double x[] - [r+1]
+ * double y[] - 'C' in Oppenheim & Schafer [r+1]
+ ***********************/
+
+ static void
+ calc_parms(int r, int Ext[], double Grid[], double D[], double W[],
+ double ad[], double x[], double y[])
+ {
+ int i, j, k, ld;
+ double sign, xi, delta, denom, numer;
+
+ /*
+ * Find x[]
+ */
+ for(i = 0; i <= r; i++)
+ x[i] = cos(Pi2 * Grid[Ext[i]]);
+
+ /*
+ * Calculate ad[] - Oppenheim & Schafer eq 7.132
+ */
+ ld = (r-1)/15 + 1; /* Skips around to avoid round errors */
+ for(i = 0; i <= r; i++) {
+ denom = 1.0;
+ xi = x[i];
+ for(j = 0; j < ld; j++) {
+ for(k = j; k <= r; k += ld)
+ if(k != i)
+ denom *= 2.0*(xi - x[k]);
+ }
+ if(fabs(denom) < 0.00001)
+ denom = 0.00001;
+ ad[i] = 1.0/denom;
+ }
+
+ /*
+ * Calculate delta - Oppenheim & Schafer eq 7.131
+ */
+ numer = denom = 0;
+ sign = 1;
+ for(i = 0; i <= r; i++) {
+ numer += ad[i] * D[Ext[i]];
+ denom += sign * ad[i]/W[Ext[i]];
+ sign = -sign;
+ }
+ delta = numer/denom;
+ sign = 1;
+
+ /*
+ * Calculate y[] - Oppenheim & Schafer eq 7.133b
+ */
+ for(i = 0; i <= r; i++) {
+ y[i] = D[Ext[i]] - sign * delta/W[Ext[i]];
+ sign = -sign;
+ }
+ }
+
+
+ /*********************
+ * compute_A
+ *==========
+ * Using values calculated in calc_parms, compute_A calculates the
+ * actual filter response at a given frequency (freq). Uses
+ * eq 7.133a from Oppenheim & Schafer.
+ *
+ *
+ * INPUT:
+ * ------
+ * double freq - Frequency (0 to 0.5) at which to calculate A
+ * int r - 1/2 the number of filter coefficients
+ * double ad[] - 'b' in Oppenheim & Schafer [r+1]
+ * double x[] - [r+1]
+ * double y[] - 'C' in Oppenheim & Schafer [r+1]
+ *
+ * OUTPUT:
+ * -------
+ * Returns double value of A[freq]
+ *********************/
+
+ static double
+ compute_A(double freq, int r, double ad[], double x[], double y[])
+ {
+ int i;
+ double xc, c, denom, numer;
+
+ denom = numer = 0;
+ xc = cos(Pi2 * freq);
+ for(i = 0; i <= r; i++) {
+ c = xc - x[i];
+ if(fabs(c) < 1.0e-7) {
+ numer = y[i];
+ denom = 1;
+ break;
+ }
+ c = ad[i]/c;
+ denom += c;
+ numer += c*y[i];
+ }
+ return numer/denom;
+ }
+
+
+ /************************
+ * calc_error
+ *===========
+ * Calculates the Error function from the desired frequency response
+ * on the dense grid (D[]), the weight function on the dense grid (W[]),
+ * and the present response calculation (A[])
+ *
+ *
+ * INPUT:
+ * ------
+ * int r - 1/2 the number of filter coefficients
+ * double ad[] - [r+1]
+ * double x[] - [r+1]
+ * double y[] - [r+1]
+ * int gridsize - Number of elements in the dense frequency grid
+ * double Grid[] - Frequencies on the dense grid [gridsize]
+ * double D[] - Desired response on the dense grid [gridsize]
+ * double W[] - Weight function on the desnse grid [gridsize]
+ *
+ * OUTPUT:
+ * -------
+ * double E[] - Error function on dense grid [gridsize]
+ ************************/
+
+ static void
+ calc_error(int r, double ad[], double x[], double y[],
+ int gridsize, double Grid[],
+ double D[], double W[], double E[])
+ {
+ int i;
+ double A;
+
+ for(i = 0; i < gridsize; i++) {
+ A = compute_A(Grid[i], r, ad, x, y);
+ E[i] = W[i] * (D[i] - A);
+ }
+ }
+
+ /************************
+ * search
+ *========
+ * Searches for the maxima/minima of the error curve. If more than
+ * r+1 extrema are found, it uses the following heuristic (thanks
+ * Chris Hanson):
+ * 1) Adjacent non-alternating extrema deleted first.
+ * 2) If there are more than one excess extrema, delete the
+ * one with the smallest error. This will create a non-alternation
+ * condition that is fixed by 1).
+ * 3) If there is exactly one excess extremum, delete the smaller
+ * of the first/last extremum
+ *
+ *
+ * INPUT:
+ * ------
+ * int r - 1/2 the number of filter coefficients
+ * int Ext[] - Indexes to Grid[] of extremal frequencies [r+1]
+ * int gridsize - Number of elements in the dense frequency grid
+ * double E[] - Array of error values. [gridsize]
+ * OUTPUT:
+ * -------
+ * int Ext[] - New indexes to extremal frequencies [r+1]
+ ************************/
+ static int
+ search(int r, int Ext[],
+ int gridsize, double E[])
+ {
+ int i, j, k, l, extra; /* Counters */
+ int up, alt;
+ int *foundExt; /* Array of found extremals */
+
+ /*
+ * Allocate enough space for found extremals.
+ */
+ foundExt = (int *)malloc((2*r) * sizeof(int));
+ k = 0;
+
+ /*
+ * Check for extremum at 0.
+ */
+ if(((E[0] > 0.0) && (E[0] > E[1])) ||
+ ((E[0] < 0.0) && (E[0] < E[1])))
+ foundExt[k++] = 0;
+
+ /*
+ * Check for extrema inside dense grid
+ */
+ for(i = 1; i < gridsize-1; i++) {
+ if(((E[i] >= E[i-1]) && (E[i] > E[i+1]) && (E[i] > 0.0)) ||
+ ((E[i] <= E[i-1]) && (E[i] < E[i+1]) && (E[i] < 0.0))) {
+ // PAK: we sometimes get too many extremal frequencies
+ if(k >= 2*r)
+ return -3;
+ foundExt[k++] = i;
+ }
+ }
+
+ /*
+ * Check for extremum at 0.5
+ */
+ j = gridsize-1;
+ if(((E[j] > 0.0) && (E[j] > E[j-1])) ||
+ ((E[j] < 0.0) && (E[j] < E[j-1]))) {
+ if(k >= 2*r)
+ return -3;
+ foundExt[k++] = j;
+ }
+
+ // PAK: we sometimes get not enough extremal frequencies
+ if(k < r+1)
+ return -2;
+
+ /*
+ * Remove extra extremals
+ */
+ extra = k - (r+1);
+ assert(extra >= 0);
+
+ while(extra > 0) {
+ if(E[foundExt[0]] > 0.0)
+ up = 1; /* first one is a maxima */
+ else
+ up = 0; /* first one is a minima */
+
+ l=0;
+ alt = 1;
+ for(j = 1; j < k; j++) {
+ if(fabs(E[foundExt[j]]) < fabs(E[foundExt[l]]))
+ l = j; /* new smallest error. */
+ if((up) && (E[foundExt[j]] < 0.0))
+ up = 0; /* switch to a minima */
+ else if((!up) && (E[foundExt[j]] > 0.0))
+ up = 1; /* switch to a maxima */
+ else {
+ alt = 0;
+ // PAK: break now and you will delete the smallest overall
+ // extremal. If you want to delete the smallest of the
+ // pair of non-alternating extremals, then you must do:
+ //
+ // if(fabs(E[foundExt[j]]) < fabs(E[foundExt[j-1]])) l=j;
+ // else l=j-1;
+ break; /* Ooops, found two non-alternating */
+ } /* extrema. Delete smallest of them */
+ } /* if the loop finishes, all extrema are alternating */
+
+ /*
+ * If there's only one extremal and all are alternating,
+ * delete the smallest of the first/last extremals.
+ */
+ if((alt) && (extra == 1)) {
+ if(fabs(E[foundExt[k-1]]) < fabs(E[foundExt[0]]))
+ /* Delete last extremal */
+ l = k-1;
+ // PAK: changed from l = foundExt[k-1];
+ else
+ /* Delete first extremal */
+ l = 0;
+ // PAK: changed from l = foundExt[0];
+ }
+
+ for(j = l; j < k-1; j++) { /* Loop that does the deletion */
+ foundExt[j] = foundExt[j+1];
+ assert(foundExt[j]<gridsize);
+ }
+ k--;
+ extra--;
+ }
+
+ for(i = 0; i <= r; i++) {
+ assert(foundExt[i]<gridsize);
+ Ext[i] = foundExt[i]; /* Copy found extremals to Ext[] */
+ }
+
+ free(foundExt);
+ return 0;
+ }
+
+
+ /*********************
+ * freq_sample
+ *============
+ * Simple frequency sampling algorithm to determine the impulse
+ * response h[] from A's found in compute_A
+ *
+ *
+ * INPUT:
+ * ------
+ * int N - Number of filter coefficients
+ * double A[] - Sample points of desired response [N/2]
+ * int symmetry - Symmetry of desired filter
+ *
+ * OUTPUT:
+ * -------
+ * double h[] - Impulse Response of final filter [N]
+ *********************/
+ static void
+ freq_sample(int N, double A[], double h[], int symm)
+ {
+ int n, k;
+ double x, val, M;
+
+ M = (N-1.0)/2.0;
+ if(symm == POSITIVE) {
+ if(N % 2) {
+ for(n = 0; n < N; n++) {
+ val = A[0];
+ x = Pi2 * (n - M)/N;
+ for(k=1; k<=M; k++)
+ val += 2.0 * A[k] * cos(x*k);
+ h[n] = val/N;
+ }
+ }
+ else {
+ for(n = 0; n < N; n++) {
+ val = A[0];
+ x = Pi2 * (n - M)/N;
+ for(k = 1; k <= (N/2-1); k++)
+ val += 2.0 * A[k] * cos(x*k);
+ h[n] = val/N;
+ }
+ }
+ }
+ else {
+ if(N % 2) {
+ for(n = 0; n < N; n++) {
+ val = 0;
+ x = Pi2 * (n - M)/N;
+ for(k = 1; k <= M; k++)
+ val += 2.0 * A[k] * sin(x*k);
+ h[n] = val/N;
+ }
+ }
+ else {
+ for(n = 0; n < N; n++) {
+ val = A[N/2] * sin(Pi * (n - M));
+ x = Pi2 * (n - M)/N;
+ for(k = 1; k <= (N/2-1); k++)
+ val += 2.0 * A[k] * sin(x*k);
+ h[n] = val/N;
+ }
+ }
+ }
+ }
+
+ /*******************
+ * is_done
+ *========
+ * Checks to see if the error function is small enough to consider
+ * the result to have converged.
+ *
+ * INPUT:
+ * ------
+ * int r - 1/2 the number of filter coeffiecients
+ * int Ext[] - Indexes to extremal frequencies [r+1]
+ * double E[] - Error function on the dense grid [gridsize]
+ *
+ * OUTPUT:
+ * -------
+ * Returns 1 if the result converged
+ * Returns 0 if the result has not converged
+ ********************/
+
+ static bool
+ is_done(int r, int Ext[], double E[])
+ {
+ int i;
+ double min, max, current;
+
+ min = max = fabs(E[Ext[0]]);
+ for(i = 1; i <= r; i++) {
+ current = fabs(E[Ext[i]]);
+ if(current < min)
+ min = current;
+ if(current > max)
+ max = current;
+ }
+ return(((max-min)/max) < 0.0001);
+ }
+
+ /********************
+ * remez
+ *=======
+ * Calculates the optimal (in the Chebyshev/minimax sense)
+ * FIR filter impulse response given a set of band edges,
+ * the desired reponse on those bands, and the weight given to
+ * the error in those bands.
+ *
+ * INPUT:
+ * ------
+ * int numtaps - Number of filter coefficients
+ * int numband - Number of bands in filter specification
+ * double bands[] - User-specified band edges [2 * numband]
+ * double des[] - User-specified band responses [2 * numband]
+ * double weight[] - User-specified error weights [numband]
+ * int type - Type of filter
+ *
+ * OUTPUT:
+ * -------
+ * double h[] - Impulse response of final filter [numtaps]
+ * returns - true on success, false on failure to converge
+ ********************/
+
+ static int
+ remez(double h[], int numtaps,
+ int numband, const double bands[],
+ const double des[], const double weight[],
+ int type, int griddensity)
+ {
+ double *Grid, *W, *D, *E;
+ int i, iter, gridsize, r, *Ext;
+ double *taps, c;
+ double *x, *y, *ad;
+ int symmetry;
+
+ if(type == BANDPASS)
+ symmetry = POSITIVE;
+ else
+ symmetry = NEGATIVE;
+
+ r = numtaps/2; /* number of extrema */
+ if((numtaps % 2) && (symmetry == POSITIVE))
+ r++;
+
+ /*
+ * Predict dense grid size in advance for memory allocation
+ * .5 is so we round up, not truncate
+ */
+ gridsize = 0;
+ for(i = 0; i < numband; i++) {
+ gridsize +=(int)(2*r*griddensity*(bands[2*i+1] - bands[2*i]) + .5);
+ }
+ if(symmetry == NEGATIVE) {
+ gridsize--;
+ }
+
+ /*
+ * Dynamically allocate memory for arrays with proper sizes
+ */
+ Grid = (double *)malloc(gridsize * sizeof(double));
+ D = (double *)malloc(gridsize * sizeof(double));
+ W = (double *)malloc(gridsize * sizeof(double));
+ E = (double *)malloc(gridsize * sizeof(double));
+ Ext = (int *)malloc((r+1) * sizeof(int));
+ taps = (double *)malloc((r+1) * sizeof(double));
+ x = (double *)malloc((r+1) * sizeof(double));
+ y = (double *)malloc((r+1) * sizeof(double));
+ ad = (double *)malloc((r+1) * sizeof(double));
+
+ /*
+ * Create dense frequency grid
+ */
+ create_dense_grid(r, numtaps, numband, bands, des, weight,
+ gridsize, Grid, D, W, symmetry, griddensity);
+ initial_guess(r, Ext, gridsize);
+
+ /*
+ * For Differentiator: (fix grid)
+ */
+ if(type == DIFFERENTIATOR) {
+ for(i = 0; i < gridsize; i++) {
+ /* D[i] = D[i]*Grid[i]; */
+ if(D[i] > 0.0001)
+ W[i] = W[i]/Grid[i];
+ }
+ }
+
+ /*
+ * For odd or Negative symmetry filters, alter the
+ * D[] and W[] according to Parks McClellan
+ */
+ if(symmetry == POSITIVE) {
+ if(numtaps % 2 == 0) {
+ for(i = 0; i < gridsize; i++) {
+ c = cos(Pi * Grid[i]);
+ D[i] /= c;
+ W[i] *= c;
+ }
+ }
+ }
+ else {
+ if(numtaps % 2) {
+ for(i = 0; i < gridsize; i++) {
+ c = sin(Pi2 * Grid[i]);
+ D[i] /= c;
+ W[i] *= c;
+ }
+ }
+ else {
+ for(i = 0; i < gridsize; i++) {
+ c = sin(Pi * Grid[i]);
+ D[i] /= c;
+ W[i] *= c;
+ }
+ }
+ }
+
+ /*
+ * Perform the Remez Exchange algorithm
+ */
+ for(iter = 0; iter < MAXITERATIONS; iter++) {
+ calc_parms(r, Ext, Grid, D, W, ad, x, y);
+ calc_error(r, ad, x, y, gridsize, Grid, D, W, E);
+ int err = search(r, Ext, gridsize, E);
+ if(err)
+ return err;
+ for(int i = 0; i <= r; i++)
+ assert(Ext[i] < gridsize);
+ if(is_done(r, Ext, E))
+ break;
+ }
+
+ calc_parms(r, Ext, Grid, D, W, ad, x, y);
+
+ /*
+ * Find the 'taps' of the filter for use with Frequency
+ * Sampling. If odd or Negative symmetry, fix the taps
+ * according to Parks McClellan
+ */
+ for(i = 0; i <= numtaps/2; i++) {
+ if(symmetry == POSITIVE) {
+ if(numtaps % 2)
+ c = 1;
+ else
+ c = cos(Pi * (double)i/numtaps);
+ }
+ else {
+ if(numtaps % 2)
+ c = sin(Pi2 * (double)i/numtaps);
+ else
+ c = sin(Pi * (double)i/numtaps);
+ }
+ taps[i] = compute_A((double)i/numtaps, r, ad, x, y)*c;
+ }
+
+ /*
+ * Frequency sampling design with calculated taps
+ */
+ freq_sample(numtaps, taps, h, symmetry);
+
+ /*
+ * Delete allocated memory
+ */
+ free(Grid);
+ free(W);
+ free(D);
+ free(E);
+ free(Ext);
+ free(x);
+ free(y);
+ free(ad);
+
+ return iter<MAXITERATIONS?0:-1;
+ }
+
+ //////////////////////////////////////////////////////////////////////////////
+ //
+ // GNU Radio interface
+ //
+ //////////////////////////////////////////////////////////////////////////////
+
+ static void
+ punt(const std::string msg)
+ {
+ std::cerr << msg << '\n';
+ throw std::runtime_error(msg);
+ }
+
+ std::vector<double>
+ pm_remez(int order,
+ const std::vector<double> &arg_bands,
+ const std::vector<double> &arg_response,
+ const std::vector<double> &arg_weight,
+ const std::string filter_type,
+ int grid_density
+ ) throw (std::runtime_error)
+ {
+ int numtaps = order + 1;
+ if(numtaps < 4)
+ punt("gr_remez: number of taps must be >= 3");
+
+ int numbands = arg_bands.size() / 2;
+ LOCAL_BUFFER(double, bands, numbands * 2);
+ if(numbands < 1 || arg_bands.size() % 2 == 1)
+ punt("gr_remez: must have an even number of band edges");
+
+ for(unsigned int i = 1; i < arg_bands.size(); i++){
+ if(arg_bands[i] < arg_bands[i-1])
+ punt("gr_remez: band edges must be nondecreasing");
+ }
+
+ if(arg_bands[0] < 0 || arg_bands[arg_bands.size() - 1] > 1)
+ punt("gr_remez: band edges must be in the range [0,1]");
+
+ // Divide by 2 to fit with the implementation that uses a
+ // sample rate of [0, 0.5] instead of [0, 1.0]
+ for(int i = 0; i < 2 * numbands; i++)
+ bands[i] = arg_bands[i] / 2;
+
+ LOCAL_BUFFER(double, response, numbands * 2);
+ if(arg_response.size() != arg_bands.size())
+ punt("gr_remez: must have one response magnitude for each band edge");
+
+ for(int i = 0; i < 2 * numbands; i++)
+ response[i] = arg_response[i];
+
+ LOCAL_BUFFER(double, weight, numbands);
+ for(int i = 0; i < numbands; i++)
+ weight[i] = 1.0;
+
+ if(arg_weight.size() != 0) {
+ if((int) arg_weight.size() != numbands)
+ punt("gr_remez: need one weight for each band [=length(band)/2]");
+ for(int i = 0; i < numbands; i++)
+ weight[i] = arg_weight [i];
+ }
+
+ int itype = 0;
+ if(filter_type == "bandpass")
+ itype = BANDPASS;
+ else if(filter_type == "differentiator")
+ itype = DIFFERENTIATOR;
+ else if(filter_type == "hilbert")
+ itype = HILBERT;
+ else
+ punt("gr_remez: unknown ftype '" + filter_type + "'");
+
+ if(grid_density < 16)
+ punt("gr_remez: grid_density is too low; must be >= 16");
+
+ LOCAL_BUFFER(double, coeff, numtaps + 5); // FIXME why + 5?
+ int err = remez(coeff, numtaps, numbands,
+ bands, response, weight, itype, grid_density);
+
+ if(err == -1)
+ punt("gr_remez: failed to converge");
+
+ if(err == -2)
+ punt("gr_remez: insufficient extremals -- cannot continue");
+
+ if(err == -3)
+ punt("gr_remez: too many extremals -- cannot continue");
+
+ return std::vector<double>(&coeff[0], &coeff[numtaps]);
+ }
+
+ } /* namespace filter */
+} /* namespace gr */
diff --git a/gr-filter/lib/polyphase_filterbank.cc b/gr-filter/lib/polyphase_filterbank.cc
new file mode 100644
index 000000000..046c23fc0
--- /dev/null
+++ b/gr-filter/lib/polyphase_filterbank.cc
@@ -0,0 +1,114 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <filter/polyphase_filterbank.h>
+#include <cstdio>
+
+namespace gr {
+ namespace filter {
+ namespace kernel {
+
+ polyphase_filterbank::polyphase_filterbank(unsigned int nfilts,
+ const std::vector<float> &taps)
+ : d_nfilts(nfilts)
+ {
+ d_filters = std::vector<kernel::fir_filter_ccf*>(d_nfilts);
+
+ // Create an FIR filter for each channel and zero out the taps
+ std::vector<float> vtaps(0, d_nfilts);
+ for(unsigned int i = 0; i < d_nfilts; i++) {
+ d_filters[i] = new kernel::fir_filter_ccf(1, vtaps);
+ }
+
+ // Now, actually set the filters' taps
+ set_taps(taps);
+
+ // Create the FFT to handle the output de-spinning of the channels
+ d_fft = new fft::fft_complex(d_nfilts, false);
+ }
+
+ polyphase_filterbank::~polyphase_filterbank()
+ {
+ delete d_fft;
+ for(unsigned int i = 0; i < d_nfilts; i++) {
+ delete d_filters[i];
+ }
+ }
+
+ void
+ polyphase_filterbank::set_taps(const std::vector<float> &taps)
+ {
+ unsigned int i,j;
+
+ unsigned int ntaps = taps.size();
+ d_taps_per_filter = (unsigned int)ceil((double)ntaps/(double)d_nfilts);
+
+ // Create d_numchan vectors to store each channel's taps
+ d_taps.resize(d_nfilts);
+
+ // Make a vector of the taps plus fill it out with 0's to fill
+ // each polyphase filter with exactly d_taps_per_filter
+ std::vector<float> tmp_taps;
+ tmp_taps = taps;
+ while((float)(tmp_taps.size()) < d_nfilts*d_taps_per_filter) {
+ tmp_taps.push_back(0.0);
+ }
+
+ // Partition the filter
+ for(i = 0; i < d_nfilts; i++) {
+ // Each channel uses all d_taps_per_filter with 0's if not enough taps to fill out
+ d_taps[i] = std::vector<float>(d_taps_per_filter, 0);
+ for(j = 0; j < d_taps_per_filter; j++) {
+ d_taps[i][j] = tmp_taps[i + j*d_nfilts]; // add taps to channels in reverse order
+ }
+
+ // Build a filter for each channel and add it's taps to it
+ d_filters[i]->set_taps(d_taps[i]);
+ }
+ }
+
+ void
+ polyphase_filterbank::print_taps()
+ {
+ unsigned int i, j;
+ for(i = 0; i < d_nfilts; i++) {
+ printf("filter[%d]: [", i);
+ for(j = 0; j < d_taps_per_filter; j++) {
+ printf(" %.4e", d_taps[i][j]);
+ }
+ printf("]\n\n");
+ }
+ }
+
+ std::vector< std::vector<float> >
+ polyphase_filterbank::taps() const
+ {
+ return d_taps;
+ }
+
+ } /* namespace kernel */
+ } /* namespace filter */
+} /* namespace gr */
diff --git a/gr-filter/lib/qa_filter.cc b/gr-filter/lib/qa_filter.cc
new file mode 100644
index 000000000..b7760b19e
--- /dev/null
+++ b/gr-filter/lib/qa_filter.cc
@@ -0,0 +1,47 @@
+/*
+ * 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.
+ */
+
+/*
+ * This class gathers together all the test cases for the gr-filter
+ * directory into a single test suite. As you create new test cases,
+ * add them here.
+ */
+
+#include <qa_filter.h>
+#include <qa_firdes.h>
+#include <qa_fir_filter_with_buffer.h>
+#include <qa_mmse_fir_interpolator_cc.h>
+#include <qa_mmse_fir_interpolator_ff.h>
+
+CppUnit::TestSuite *
+qa_gr_filter::suite ()
+{
+ CppUnit::TestSuite *s = new CppUnit::TestSuite ("gr-filter");
+
+ s->addTest(gr::filter::qa_firdes::suite());
+ s->addTest(gr::filter::fff::qa_fir_filter_with_buffer_fff::suite());
+ s->addTest(gr::filter::ccc::qa_fir_filter_with_buffer_ccc::suite());
+ s->addTest(gr::filter::ccf::qa_fir_filter_with_buffer_ccf::suite());
+ s->addTest(gr::filter::qa_mmse_fir_interpolator_cc::suite());
+ s->addTest(gr::filter::qa_mmse_fir_interpolator_ff::suite());
+
+ return s;
+}
diff --git a/gr-filter/lib/qa_filter.h b/gr-filter/lib/qa_filter.h
new file mode 100644
index 000000000..427e7f9f6
--- /dev/null
+++ b/gr-filter/lib/qa_filter.h
@@ -0,0 +1,38 @@
+/* -*- 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.
+ */
+
+#ifndef _QA_GR_FILTER_H_
+#define _QA_GR_FILTER_H_
+
+#include <gruel/attributes.h>
+#include <cppunit/TestSuite.h>
+
+//! collect all the tests for the gr-filter directory
+
+class __GR_ATTR_EXPORT qa_gr_filter {
+ public:
+ //! return suite of tests for all of gr-filter directory
+ static CppUnit::TestSuite *suite ();
+};
+
+
+#endif /* _QA_GR_FILTER_H_ */
diff --git a/gr-filter/lib/qa_fir_filter_with_buffer.cc b/gr-filter/lib/qa_fir_filter_with_buffer.cc
new file mode 100644
index 000000000..ab2958ed1
--- /dev/null
+++ b/gr-filter/lib/qa_fir_filter_with_buffer.cc
@@ -0,0 +1,406 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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 <gr_types.h>
+#include <qa_fir_filter_with_buffer.h>
+#include <filter/fir_filter_with_buffer.h>
+#include <fft/fft.h>
+#include <cppunit/TestAssert.h>
+#include <cmath>
+#include <random.h>
+#include <cstring>
+
+namespace gr {
+ namespace filter {
+
+#define MAX_DATA (16383)
+#define ERR_DELTA (1e-5)
+
+ static float
+ uniform()
+ {
+ return 2.0 * ((float) random() / RANDOM_MAX - 0.5); // uniformly (-1, 1)
+ }
+
+ static void
+ random_floats(float *buf, unsigned n)
+ {
+ for(unsigned i = 0; i < n; i++)
+ buf[i] = (float)rint(uniform() * 32767);
+ }
+
+ static void
+ random_complex(gr_complex *buf, unsigned n)
+ {
+ for(unsigned i = 0; i < n; i++) {
+ float re = rint(uniform() * MAX_DATA);
+ float im = rint(uniform() * MAX_DATA);
+ buf[i] = gr_complex(re, im);
+ }
+ }
+
+ namespace fff {
+
+ typedef float i_type;
+ typedef float o_type;
+ typedef float tap_type;
+ typedef float acc_type;
+
+ using std::vector;
+
+ static o_type
+ ref_dotprod(const i_type input[], const tap_type taps[], int ntaps)
+ {
+ acc_type sum = 0;
+ for (int i = 0; i < ntaps; i++) {
+ sum += input[i] * taps[i];
+ }
+ return sum;
+ }
+
+ void
+ qa_fir_filter_with_buffer_fff::t1()
+ {
+ test_decimate(1);
+ }
+
+ void
+ qa_fir_filter_with_buffer_fff::t2()
+ {
+ test_decimate(2);
+ }
+
+ void
+ qa_fir_filter_with_buffer_fff::t3()
+ {
+ test_decimate(5);
+ }
+
+ //
+ // Test for ntaps in [0,9], and input lengths in [0,17].
+ // This ensures that we are building the shifted taps correctly,
+ // and exercises all corner cases on input alignment and length.
+ //
+ void
+ qa_fir_filter_with_buffer_fff::test_decimate(unsigned int decimate)
+ {
+ const int MAX_TAPS = 29;
+ const int OUTPUT_LEN = 37;
+ const int INPUT_LEN = MAX_TAPS + OUTPUT_LEN;
+
+ // Mem aligned buffer not really necessary, but why not?
+ i_type *input = fft::malloc_float(INPUT_LEN);
+ i_type *dline = fft::malloc_float(INPUT_LEN);
+ o_type *expected_output = fft::malloc_float(OUTPUT_LEN);
+ o_type *actual_output = fft::malloc_float(OUTPUT_LEN);
+ tap_type *taps = fft::malloc_float(MAX_TAPS);
+
+ srandom(0); // we want reproducibility
+ memset(dline, 0, INPUT_LEN*sizeof(i_type));
+
+ for(int n = 0; n <= MAX_TAPS; n++) {
+ for(int ol = 0; ol <= OUTPUT_LEN; ol++) {
+
+ // build random test case
+ random_floats(input, INPUT_LEN);
+ random_floats(taps, MAX_TAPS);
+
+ // compute expected output values
+ memset(dline, 0, INPUT_LEN*sizeof(i_type));
+ for(int o = 0; o < (int)(ol/decimate); o++) {
+ // use an actual delay line for this test
+ for(int dd = 0; dd < (int)decimate; dd++) {
+ for(int oo = INPUT_LEN-1; oo > 0; oo--)
+ dline[oo] = dline[oo-1];
+ dline[0] = input[decimate*o+dd];
+ }
+ expected_output[o] = ref_dotprod(dline, taps, n);
+ }
+
+ // build filter
+ vector<tap_type> f1_taps(&taps[0], &taps[n]);
+ kernel::fir_filter_with_buffer_fff *f1 = \
+ new kernel::fir_filter_with_buffer_fff(f1_taps);
+
+ // zero the output, then do the filtering
+ memset(actual_output, 0, OUTPUT_LEN*sizeof(o_type));
+ f1->filterNdec(actual_output, input, ol/decimate, decimate);
+
+ // check results
+ //
+ // we use a sloppy error margin because on the x86 architecture,
+ // our reference implementation is using 80 bit floating point
+ // arithmetic, while the SSE version is using 32 bit float point
+ // arithmetic.
+
+ for(int o = 0; o < (int)(ol/decimate); o++) {
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(expected_output[o], actual_output[o],
+ sqrt((float)n)*0.25*MAX_DATA*MAX_DATA * ERR_DELTA);
+ }
+ delete f1;
+ }
+ }
+ fft::free(input);
+ fft::free(dline);
+ fft::free(expected_output);
+ fft::free(actual_output);
+ fft::free(taps);
+ }
+
+ } /* namespace fff */
+
+
+ /**************************************************************/
+
+
+ namespace ccc {
+
+ typedef gr_complex i_type;
+ typedef gr_complex o_type;
+ typedef gr_complex tap_type;
+ typedef gr_complex acc_type;
+
+ using std::vector;
+
+ static o_type
+ ref_dotprod(const i_type input[], const tap_type taps[], int ntaps)
+ {
+ acc_type sum = 0;
+ for(int i = 0; i < ntaps; i++) {
+ sum += input[i] * taps[i];
+ }
+
+ return sum;
+ }
+
+ void
+ qa_fir_filter_with_buffer_ccc::t1()
+ {
+ test_decimate(1);
+ }
+
+ void
+ qa_fir_filter_with_buffer_ccc::t2()
+ {
+ test_decimate(2);
+ }
+
+ void
+ qa_fir_filter_with_buffer_ccc::t3()
+ {
+ test_decimate(5);
+ }
+
+ //
+ // Test for ntaps in [0,9], and input lengths in [0,17].
+ // This ensures that we are building the shifted taps correctly,
+ // and exercises all corner cases on input alignment and length.
+ //
+ void
+ qa_fir_filter_with_buffer_ccc::test_decimate(unsigned int decimate)
+ {
+ const int MAX_TAPS = 29;
+ const int OUTPUT_LEN = 37;
+ const int INPUT_LEN = MAX_TAPS + OUTPUT_LEN;
+
+ // Mem aligned buffer not really necessary, but why not?
+ i_type *input = fft::malloc_complex(INPUT_LEN);
+ i_type *dline = fft::malloc_complex(INPUT_LEN);
+ o_type *expected_output = fft::malloc_complex(OUTPUT_LEN);
+ o_type *actual_output = fft::malloc_complex(OUTPUT_LEN);
+ tap_type *taps = fft::malloc_complex(MAX_TAPS);
+
+ srandom(0); // we want reproducibility
+ memset(dline, 0, INPUT_LEN*sizeof(i_type));
+
+ for(int n = 0; n <= MAX_TAPS; n++) {
+ for(int ol = 0; ol <= OUTPUT_LEN; ol++) {
+
+ // build random test case
+ random_complex(input, INPUT_LEN);
+ random_complex(taps, MAX_TAPS);
+
+ // compute expected output values
+ memset(dline, 0, INPUT_LEN*sizeof(i_type));
+ for(int o = 0; o < (int)(ol/decimate); o++) {
+ // use an actual delay line for this test
+ for(int dd = 0; dd < (int)decimate; dd++) {
+ for(int oo = INPUT_LEN-1; oo > 0; oo--)
+ dline[oo] = dline[oo-1];
+ dline[0] = input[decimate*o+dd];
+ }
+ expected_output[o] = ref_dotprod(dline, taps, n);
+ }
+
+ // build filter
+ vector<tap_type> f1_taps(&taps[0], &taps[n]);
+ kernel::fir_filter_with_buffer_ccc *f1 = \
+ new kernel::fir_filter_with_buffer_ccc(f1_taps);
+
+ // zero the output, then do the filtering
+ memset(actual_output, 0, OUTPUT_LEN*sizeof(o_type));
+ f1->filterNdec(actual_output, input, ol/decimate, decimate);
+
+ // check results
+ //
+ // we use a sloppy error margin because on the x86 architecture,
+ // our reference implementation is using 80 bit floating point
+ // arithmetic, while the SSE version is using 32 bit float point
+ // arithmetic.
+
+ for(int o = 0; o < (int)(ol/decimate); o++) {
+ CPPUNIT_ASSERT_COMPLEXES_EQUAL(expected_output[o], actual_output[o],
+ sqrt((float)n)*0.25*MAX_DATA*MAX_DATA * ERR_DELTA);
+ }
+ delete f1;
+ }
+ }
+ fft::free(input);
+ fft::free(dline);
+ fft::free(expected_output);
+ fft::free(actual_output);
+ fft::free(taps);
+ }
+
+ } /* namespace ccc */
+
+
+ /**************************************************************/
+
+ namespace ccf {
+
+ typedef gr_complex i_type;
+ typedef gr_complex o_type;
+ typedef float tap_type;
+ typedef gr_complex acc_type;
+
+ using std::vector;
+
+ static o_type
+ ref_dotprod(const i_type input[], const tap_type taps[], int ntaps)
+ {
+ acc_type sum = 0;
+ for(int i = 0; i < ntaps; i++) {
+ sum += input[i] * taps[i];
+ }
+
+ //return gr_complex(121,9)*sum;
+ return sum;
+ }
+
+ void
+ qa_fir_filter_with_buffer_ccf::t1()
+ {
+ test_decimate(1);
+ }
+
+ void
+ qa_fir_filter_with_buffer_ccf::t2()
+ {
+ test_decimate(2);
+ }
+
+ void
+ qa_fir_filter_with_buffer_ccf::t3()
+ {
+ test_decimate(5);
+ }
+
+ //
+ // Test for ntaps in [0,9], and input lengths in [0,17].
+ // This ensures that we are building the shifted taps correctly,
+ // and exercises all corner cases on input alignment and length.
+ //
+ void
+ qa_fir_filter_with_buffer_ccf::test_decimate(unsigned int decimate)
+ {
+ const int MAX_TAPS = 29;
+ const int OUTPUT_LEN = 37;
+ const int INPUT_LEN = MAX_TAPS + OUTPUT_LEN;
+
+ // Mem aligned buffer not really necessary, but why not?
+ i_type *input = fft::malloc_complex(INPUT_LEN);
+ i_type *dline = fft::malloc_complex(INPUT_LEN);
+ o_type *expected_output = fft::malloc_complex(OUTPUT_LEN);
+ o_type *actual_output = fft::malloc_complex(OUTPUT_LEN);
+ tap_type *taps = fft::malloc_float(MAX_TAPS);
+
+ srandom(0); // we want reproducibility
+ memset(dline, 0, INPUT_LEN*sizeof(i_type));
+
+ for(int n = 0; n <= MAX_TAPS; n++) {
+ for(int ol = 0; ol <= OUTPUT_LEN; ol++) {
+
+ // build random test case
+ random_complex(input, INPUT_LEN);
+ random_floats(taps, MAX_TAPS);
+
+ // compute expected output values
+ memset(dline, 0, INPUT_LEN*sizeof(i_type));
+ for(int o = 0; o < (int)(ol/decimate); o++) {
+ // use an actual delay line for this test
+ for(int dd = 0; dd < (int)decimate; dd++) {
+ for(int oo = INPUT_LEN-1; oo > 0; oo--)
+ dline[oo] = dline[oo-1];
+ dline[0] = input[decimate*o+dd];
+ }
+ expected_output[o] = ref_dotprod(dline, taps, n);
+ }
+
+ // build filter
+ vector<tap_type> f1_taps(&taps[0], &taps[n]);
+ kernel::fir_filter_with_buffer_ccf *f1 = \
+ new kernel::fir_filter_with_buffer_ccf(f1_taps);
+
+ // zero the output, then do the filtering
+ memset(actual_output, 0, sizeof(OUTPUT_LEN*sizeof(gr_complex)));
+ f1->filterNdec(actual_output, input, ol/decimate, decimate);
+
+ // check results
+ //
+ // we use a sloppy error margin because on the x86 architecture,
+ // our reference implementation is using 80 bit floating point
+ // arithmetic, while the SSE version is using 32 bit float point
+ // arithmetic.
+
+ for(int o = 0; o < (int)(ol/decimate); o++) {
+ CPPUNIT_ASSERT_COMPLEXES_EQUAL(expected_output[o], actual_output[o],
+ sqrt((float)n)*0.25*MAX_DATA*MAX_DATA * ERR_DELTA);
+ }
+ delete f1;
+ }
+ }
+ fft::free(input);
+ fft::free(dline);
+ fft::free(expected_output);
+ fft::free(actual_output);
+ fft::free(taps);
+ }
+
+ } /* namespace ccf */
+
+ } /* namespace filter */
+} /* namespace gr */
diff --git a/gr-filter/lib/qa_fir_filter_with_buffer.h b/gr-filter/lib/qa_fir_filter_with_buffer.h
new file mode 100644
index 000000000..8850ada20
--- /dev/null
+++ b/gr-filter/lib/qa_fir_filter_with_buffer.h
@@ -0,0 +1,94 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+#ifndef _QA_FIR_FILTER_WITH_BUFFER_H_
+#define _QA_FIR_FILTER_WITH_BUFFER_H_
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/TestCase.h>
+
+namespace gr {
+ namespace filter {
+
+ namespace fff {
+
+ class qa_fir_filter_with_buffer_fff : public CppUnit::TestCase
+ {
+ CPPUNIT_TEST_SUITE(qa_fir_filter_with_buffer_fff);
+ CPPUNIT_TEST(t1);
+ CPPUNIT_TEST(t2);
+ CPPUNIT_TEST(t3);
+ CPPUNIT_TEST_SUITE_END();
+
+ private:
+ void test_decimate(unsigned int decimate);
+
+ void t1();
+ void t2();
+ void t3();
+ };
+
+ } /* namespace fff */
+
+ namespace ccc {
+
+ class qa_fir_filter_with_buffer_ccc : public CppUnit::TestCase
+ {
+ CPPUNIT_TEST_SUITE(qa_fir_filter_with_buffer_ccc);
+ CPPUNIT_TEST(t1);
+ CPPUNIT_TEST(t2);
+ CPPUNIT_TEST(t3);
+ CPPUNIT_TEST_SUITE_END();
+
+ private:
+ void test_decimate(unsigned int decimate);
+
+ void t1();
+ void t2();
+ void t3();
+ };
+
+ } /* namespace ccc */
+
+ namespace ccf {
+
+ class qa_fir_filter_with_buffer_ccf : public CppUnit::TestCase
+ {
+ CPPUNIT_TEST_SUITE(qa_fir_filter_with_buffer_ccf);
+ CPPUNIT_TEST(t1);
+ CPPUNIT_TEST(t2);
+ CPPUNIT_TEST(t3);
+ CPPUNIT_TEST_SUITE_END();
+
+ private:
+ void test_decimate(unsigned int decimate);
+
+ void t1();
+ void t2();
+ void t3();
+ };
+
+ } /* namespace ccf */
+
+ } /* namespace filter */
+} /* namespace gr */
+
+#endif /* _QA_FIR_FILTER_WITH_BUFFER_H_ */
diff --git a/gr-filter/lib/qa_firdes.cc b/gr-filter/lib/qa_firdes.cc
new file mode 100644
index 000000000..c2fe399d5
--- /dev/null
+++ b/gr-filter/lib/qa_firdes.cc
@@ -0,0 +1,621 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002,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.
+ */
+
+#include <qa_firdes.h>
+#include <filter/firdes.h>
+#include <cppunit/TestAssert.h>
+#include <gr_complex.h>
+#include <string.h>
+#include <iostream>
+#include <iomanip>
+#include <stdio.h>
+
+namespace gr {
+ namespace filter {
+
+#define NELEM(x) (sizeof(x) / sizeof(x[0]))
+
+ using std::vector;
+
+#if 0
+ static void
+ print_taps(std::ostream &s, vector<float> &v)
+ {
+
+ for(unsigned int i = 0; i < v.size(); i++) {
+ printf("tap[%2d] = %16.7e\n", i, v[i]);
+ }
+ }
+#endif
+
+ static void
+ check_symmetry(vector<float> &v)
+ {
+ int n = v.size();
+ int m = n / 2;
+
+ for(int i = 0; i < m; i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(v[i], v[n - i - 1], 1e-9);
+ }
+
+ const static float t1_exp[53] = {
+ -9.0525491e-04,
+ 2.0713841e-04,
+ 1.2388536e-03,
+ 2.9683491e-04,
+ -1.7744775e-03,
+ -1.3599906e-03,
+ 2.2031884e-03,
+ 3.2744040e-03,
+ -1.8868084e-03,
+ -5.9935520e-03,
+ 6.4301129e-18,
+ 8.9516686e-03,
+ 4.2178580e-03,
+ -1.0998557e-02,
+ -1.1173409e-02,
+ 1.0455756e-02,
+ 2.0686293e-02,
+ -5.2032238e-03,
+ -3.1896964e-02,
+ -7.4998410e-03,
+ 4.3362070e-02,
+ 3.2502845e-02,
+ -5.3328082e-02,
+ -8.5621715e-02,
+ 6.0117975e-02,
+ 3.1128189e-01,
+ 4.3769023e-01,
+ 3.1128189e-01,
+ 6.0117975e-02,
+ -8.5621715e-02,
+ -5.3328082e-02,
+ 3.2502845e-02,
+ 4.3362070e-02,
+ -7.4998410e-03,
+ -3.1896964e-02,
+ -5.2032238e-03,
+ 2.0686293e-02,
+ 1.0455756e-02,
+ -1.1173409e-02,
+ -1.0998557e-02,
+ 4.2178580e-03,
+ 8.9516686e-03,
+ 6.4301129e-18,
+ -5.9935520e-03,
+ -1.8868084e-03,
+ 3.2744040e-03,
+ 2.2031884e-03,
+ -1.3599906e-03,
+ -1.7744775e-03,
+ 2.9683491e-04,
+ 1.2388536e-03,
+ 2.0713841e-04,
+ -9.0525491e-04
+ };
+
+ const static float t2_exp[53] = {
+ 9.0380036e-04,
+ -2.0680559e-04,
+ -1.2368630e-03,
+ -2.9635796e-04,
+ 1.7716263e-03,
+ 1.3578053e-03,
+ -2.1996482e-03,
+ -3.2691427e-03,
+ 1.8837767e-03,
+ 5.9839217e-03,
+ -6.4197810e-18,
+ -8.9372853e-03,
+ -4.2110807e-03,
+ 1.0980885e-02,
+ 1.1155456e-02,
+ -1.0438956e-02,
+ -2.0653054e-02,
+ 5.1948633e-03,
+ 3.1845711e-02,
+ 7.4877902e-03,
+ -4.3292396e-02,
+ -3.2450620e-02,
+ 5.3242393e-02,
+ 8.5484132e-02,
+ -6.0021374e-02,
+ -3.1078172e-01,
+ 5.6184036e-01,
+ -3.1078172e-01,
+ -6.0021374e-02,
+ 8.5484132e-02,
+ 5.3242393e-02,
+ -3.2450620e-02,
+ -4.3292396e-02,
+ 7.4877902e-03,
+ 3.1845711e-02,
+ 5.1948633e-03,
+ -2.0653054e-02,
+ -1.0438956e-02,
+ 1.1155456e-02,
+ 1.0980885e-02,
+ -4.2110807e-03,
+ -8.9372853e-03,
+ -6.4197810e-18,
+ 5.9839217e-03,
+ 1.8837767e-03,
+ -3.2691427e-03,
+ -2.1996482e-03,
+ 1.3578053e-03,
+ 1.7716263e-03,
+ -2.9635796e-04,
+ -1.2368630e-03,
+ -2.0680559e-04,
+ 9.0380036e-04
+ };
+
+ const static float t3_exp[107] = {
+ -1.8970841e-06,
+ -7.1057165e-04,
+ 5.4005696e-04,
+ 4.6233178e-04,
+ 2.0572044e-04,
+ 3.5209916e-04,
+ -1.4098573e-03,
+ 1.1279077e-04,
+ -6.2994129e-04,
+ 1.1450432e-03,
+ 1.3637283e-03,
+ -6.4360141e-04,
+ 3.6509900e-04,
+ -3.2864159e-03,
+ 7.0192874e-04,
+ 3.7524730e-04,
+ 2.0256115e-03,
+ 3.0641893e-03,
+ -3.6618244e-03,
+ 7.5592739e-05,
+ -5.5586505e-03,
+ 2.3849572e-03,
+ 4.0114378e-03,
+ 1.6636450e-03,
+ 4.7835698e-03,
+ -1.0191196e-02,
+ -3.8158931e-04,
+ -5.5551580e-03,
+ 5.3901658e-03,
+ 1.1366769e-02,
+ -3.0000482e-03,
+ 4.9341680e-03,
+ -2.0093076e-02,
+ 5.5752542e-17,
+ 1.2093617e-03,
+ 8.6089745e-03,
+ 2.2382140e-02,
+ -1.6854567e-02,
+ 1.6913920e-03,
+ -3.1222520e-02,
+ 3.2711059e-03,
+ 2.2604836e-02,
+ 8.1451107e-03,
+ 3.7583180e-02,
+ -5.2293688e-02,
+ -8.0551542e-03,
+ -4.0092729e-02,
+ 1.5582236e-02,
+ 9.7452506e-02,
+ -1.6183170e-02,
+ 8.3281815e-02,
+ -2.8196752e-01,
+ -1.0965768e-01,
+ 5.2867508e-01,
+ -1.0965768e-01,
+ -2.8196752e-01,
+ 8.3281815e-02,
+ -1.6183170e-02,
+ 9.7452506e-02,
+ 1.5582236e-02,
+ -4.0092729e-02,
+ -8.0551542e-03,
+ -5.2293688e-02,
+ 3.7583180e-02,
+ 8.1451107e-03,
+ 2.2604836e-02,
+ 3.2711059e-03,
+ -3.1222520e-02,
+ 1.6913920e-03,
+ -1.6854567e-02,
+ 2.2382140e-02,
+ 8.6089745e-03,
+ 1.2093617e-03,
+ 5.5752542e-17,
+ -2.0093076e-02,
+ 4.9341680e-03,
+ -3.0000482e-03,
+ 1.1366769e-02,
+ 5.3901658e-03,
+ -5.5551580e-03,
+ -3.8158931e-04,
+ -1.0191196e-02,
+ 4.7835698e-03,
+ 1.6636450e-03,
+ 4.0114378e-03,
+ 2.3849572e-03,
+ -5.5586505e-03,
+ 7.5592739e-05,
+ -3.6618244e-03,
+ 3.0641893e-03,
+ 2.0256115e-03,
+ 3.7524730e-04,
+ 7.0192874e-04,
+ -3.2864159e-03,
+ 3.6509900e-04,
+ -6.4360141e-04,
+ 1.3637283e-03,
+ 1.1450432e-03,
+ -6.2994129e-04,
+ 1.1279077e-04,
+ -1.4098573e-03,
+ 3.5209916e-04,
+ 2.0572044e-04,
+ 4.6233178e-04,
+ 5.4005696e-04,
+ -7.1057165e-04,
+ -1.8970841e-06
+ };
+
+ const static float t4_exp[] = { // low pass
+ 0.001059958362,
+ 0.0002263929928,
+ -0.001277606934,
+ -0.0009675776237,
+ 0.001592264394,
+ 0.00243603508,
+ -0.001451682881,
+ -0.004769335967,
+ 5.281541594e-18,
+ 0.007567512803,
+ 0.003658855334,
+ -0.009761494584,
+ -0.01011830103,
+ 0.009636915289,
+ 0.0193619132,
+ -0.004935568199,
+ -0.03060629964,
+ -0.007267376408,
+ 0.04236677289,
+ 0.03197422624,
+ -0.05274848267,
+ -0.0850463286,
+ 0.05989059806,
+ 0.31065014,
+ 0.4370569289,
+ 0.31065014,
+ 0.05989059806,
+ -0.0850463286,
+ -0.05274848267,
+ 0.03197422624,
+ 0.04236677289,
+ -0.007267376408,
+ -0.03060629964,
+ -0.004935568199,
+ 0.0193619132,
+ 0.009636915289,
+ -0.01011830103,
+ -0.009761494584,
+ 0.003658855334,
+ 0.007567512803,
+ 5.281541594e-18,
+ -0.004769335967,
+ -0.001451682881,
+ 0.00243603508,
+ 0.001592264394,
+ -0.0009675776237,
+ -0.001277606934,
+ 0.0002263929928,
+ 0.001059958362,
+ };
+
+ const static float t5_exp[] = { //high pass
+ -0.001062123571,
+ -0.0002268554381,
+ 0.001280216733,
+ 0.000969554123,
+ -0.001595516922,
+ -0.002441011136,
+ 0.001454648213,
+ 0.004779078532,
+ -5.292330097e-18,
+ -0.007582970895,
+ -0.00366632943,
+ 0.009781434201,
+ 0.01013896987,
+ -0.009656600654,
+ -0.01940146461,
+ 0.004945650231,
+ 0.03066881932,
+ 0.00728222169,
+ -0.04245331511,
+ -0.03203954175,
+ 0.05285623297,
+ 0.08522006124,
+ -0.06001294032,
+ -0.3112847209,
+ 0.5630782247,
+ -0.3112847209,
+ -0.06001294032,
+ 0.08522006124,
+ 0.05285623297,
+ -0.03203954175,
+ -0.04245331511,
+ 0.00728222169,
+ 0.03066881932,
+ 0.004945650231,
+ -0.01940146461,
+ -0.009656600654,
+ 0.01013896987,
+ 0.009781434201,
+ -0.00366632943,
+ -0.007582970895,
+ -5.292330097e-18,
+ 0.004779078532,
+ 0.001454648213,
+ -0.002441011136,
+ -0.001595516922,
+ 0.000969554123,
+ 0.001280216733,
+ -0.0002268554381,
+ -0.001062123571,
+ };
+
+ const static float t6_exp[] = { // bandpass
+ 0.0002809273137,
+ -0.001047327649,
+ 7.936541806e-05,
+ -0.0004270860809,
+ 0.0007595835486,
+ 0.0008966081077,
+ -0.0004236323002,
+ 0.0002423936094,
+ -0.002212299034,
+ 0.0004807534278,
+ 0.0002620361629,
+ 0.001443728455,
+ 0.002229931997,
+ -0.002720607212,
+ 5.731141573e-05,
+ -0.004297634587,
+ 0.001878833398,
+ 0.003217151389,
+ 0.001357055153,
+ 0.003965090029,
+ -0.008576190099,
+ -0.0003257228818,
+ -0.004805727862,
+ 0.004721920472,
+ 0.01007549558,
+ -0.002688719891,
+ 0.004467967432,
+ -0.01837076992,
+ 5.119658377e-17,
+ 0.001125075156,
+ 0.008071650751,
+ 0.02113764361,
+ -0.01602453552,
+ 0.001618095324,
+ -0.03004053794,
+ 0.003163811285,
+ 0.0219683405,
+ 0.007950295694,
+ 0.03682873398,
+ -0.05142467469,
+ -0.00794606097,
+ -0.03965795785,
+ 0.01544955093,
+ 0.09681399167,
+ -0.01610304788,
+ 0.08297294378,
+ -0.2811714709,
+ -0.1094062924,
+ 0.5275565982,
+ -0.1094062924,
+ -0.2811714709,
+ 0.08297294378,
+ -0.01610304788,
+ 0.09681399167,
+ 0.01544955093,
+ -0.03965795785,
+ -0.00794606097,
+ -0.05142467469,
+ 0.03682873398,
+ 0.007950295694,
+ 0.0219683405,
+ 0.003163811285,
+ -0.03004053794,
+ 0.001618095324,
+ -0.01602453552,
+ 0.02113764361,
+ 0.008071650751,
+ 0.001125075156,
+ 5.119658377e-17,
+ -0.01837076992,
+ 0.004467967432,
+ -0.002688719891,
+ 0.01007549558,
+ 0.004721920472,
+ -0.004805727862,
+ -0.0003257228818,
+ -0.008576190099,
+ 0.003965090029,
+ 0.001357055153,
+ 0.003217151389,
+ 0.001878833398,
+ -0.004297634587,
+ 5.731141573e-05,
+ -0.002720607212,
+ 0.002229931997,
+ 0.001443728455,
+ 0.0002620361629,
+ 0.0004807534278,
+ -0.002212299034,
+ 0.0002423936094,
+ -0.0004236323002,
+ 0.0008966081077,
+ 0.0007595835486,
+ -0.0004270860809,
+ 7.936541806e-05,
+ -0.001047327649,
+ 0.0002809273137,
+ };
+
+ void
+ qa_firdes::t1()
+ {
+ vector<float> taps =
+ firdes::low_pass(1.0,
+ 8000,
+ 1750,
+ 500,
+ firdes::WIN_HAMMING);
+
+ // cout << "ntaps: " << taps.size() << endl;
+ // print_taps(cout, taps);
+
+ CPPUNIT_ASSERT_EQUAL(NELEM(t1_exp), taps.size());
+ for(unsigned int i = 0; i < taps.size(); i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(t1_exp[i], taps[i], 1e-9);
+
+ check_symmetry(taps);
+}
+
+ void
+ qa_firdes::t2()
+ {
+ vector<float> taps =
+ firdes::high_pass(1.0,
+ 8000,
+ 1750,
+ 500,
+ firdes::WIN_HAMMING);
+
+ // cout << "ntaps: " << taps.size() << endl;
+ // print_taps(cout, taps);
+
+ CPPUNIT_ASSERT_EQUAL(NELEM(t2_exp), taps.size());
+
+ for(unsigned int i = 0; i < taps.size(); i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(t2_exp[i], taps[i], 1e-9);
+
+ check_symmetry(taps);
+ }
+
+ void
+ qa_firdes::t3()
+ {
+ vector<float> taps =
+ firdes::band_pass(1.0,
+ 20e6,
+ 5.75e6 - (5.28e6/2),
+ 5.75e6 + (5.28e6/2),
+ 0.62e6,
+ firdes::WIN_HAMMING);
+
+ // cout << "ntaps: " << taps.size() << endl;
+ // print_taps(cout, taps);
+
+ CPPUNIT_ASSERT_EQUAL(NELEM(t3_exp), taps.size());
+
+ for(unsigned int i = 0; i < taps.size(); i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(t3_exp[i], taps[i], 1e-7);
+
+ check_symmetry(taps);
+ }
+
+ void
+ qa_firdes::t4()
+ {
+ vector<float> taps =
+ firdes::low_pass_2(1.0,
+ 8000,
+ 1750,
+ 500,
+ 66,
+ firdes::WIN_HAMMING);
+
+ // std::cout << "ntaps: " << taps.size() << std::endl;
+ // print_taps(std::cout, taps);
+
+ CPPUNIT_ASSERT_EQUAL(NELEM(t4_exp), taps.size());
+ for(unsigned int i = 0; i < taps.size(); i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(t4_exp[i], taps[i], 1e-9);
+
+ check_symmetry(taps);
+ }
+
+ void
+ qa_firdes::t5()
+ {
+ vector<float> taps =
+ firdes::high_pass_2(1.0,
+ 8000,
+ 1750,
+ 500,
+ 66,
+ firdes::WIN_HAMMING);
+
+ // std::cout << "ntaps: " << taps.size() << std::endl;
+ // print_taps(std::cout, taps);
+
+ CPPUNIT_ASSERT_EQUAL(NELEM(t5_exp), taps.size());
+
+ for(unsigned int i = 0; i < taps.size(); i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(t5_exp[i], taps[i], 1e-9);
+
+ check_symmetry(taps);
+}
+
+ void
+ qa_firdes::t6()
+ {
+ vector<float> taps =
+ firdes::band_pass_2(1.0,
+ 20e6,
+ 5.75e6 - (5.28e6/2),
+ 5.75e6 + (5.28e6/2),
+ 0.62e6,
+ 66,
+ firdes::WIN_HAMMING);
+
+ // std::cout << "ntaps: " << taps.size() << std::endl;
+ // print_taps(std::cout, taps);
+
+ CPPUNIT_ASSERT_EQUAL(NELEM(t6_exp), taps.size());
+
+ for(unsigned int i = 0; i < taps.size(); i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(t6_exp[i], taps[i], 1e-7);
+
+ check_symmetry(taps);
+ }
+
+ void
+ qa_firdes::t7()
+ {
+ }
+
+ } /* namespace filter */
+} /* namespace gr */
diff --git a/gr-filter/lib/qa_firdes.h b/gr-filter/lib/qa_firdes.h
new file mode 100644
index 000000000..b27cf78b9
--- /dev/null
+++ b/gr-filter/lib/qa_firdes.h
@@ -0,0 +1,56 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002,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 _QA_FILTER_FIRDES_H_
+#define _QA_FILTER_FIRDES_H_
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/TestCase.h>
+
+namespace gr {
+ namespace filter {
+
+ class qa_firdes : public CppUnit::TestCase {
+
+ CPPUNIT_TEST_SUITE(qa_firdes);
+ CPPUNIT_TEST(t1);
+ CPPUNIT_TEST(t2);
+ CPPUNIT_TEST(t3);
+ CPPUNIT_TEST(t4);
+ CPPUNIT_TEST(t5);
+ CPPUNIT_TEST(t6);
+ CPPUNIT_TEST(t7);
+ CPPUNIT_TEST_SUITE_END();
+
+ private:
+ void t1();
+ void t2();
+ void t3();
+ void t4();
+ void t5();
+ void t6();
+ void t7();
+ };
+
+ } /* namespace filter */
+} /* namespace gr */
+
+#endif /* _QA_FILTER_FIRDES_H_ */
diff --git a/gr-filter/lib/qa_mmse_fir_interpolator_cc.cc b/gr-filter/lib/qa_mmse_fir_interpolator_cc.cc
new file mode 100644
index 000000000..268b8801c
--- /dev/null
+++ b/gr-filter/lib/qa_mmse_fir_interpolator_cc.cc
@@ -0,0 +1,126 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002,2007,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 <cppunit/TestAssert.h>
+#include <qa_mmse_fir_interpolator_cc.h>
+#include <filter/mmse_fir_interpolator_cc.h>
+#include <fft/fft.h>
+#include <cstdio>
+#include <cmath>
+#include <stdexcept>
+#include <stdint.h>
+
+namespace gr {
+ namespace filter {
+
+ static float
+ test_fcn_sin(double index)
+ {
+ return (2 * sin (index * 0.25 * 2 * M_PI + 0.125 * M_PI)
+ + 3 * sin (index * 0.077 * 2 * M_PI + 0.3 * M_PI));
+ }
+
+ static float
+ test_fcn_cos(double index)
+ {
+ return (2 * cos (index * 0.25 * 2 * M_PI + 0.125 * M_PI)
+ + 3 * cos (index * 0.077 * 2 * M_PI + 0.3 * M_PI));
+ }
+
+ static gr_complex
+ test_fcn(double index)
+ {
+ return gr_complex(test_fcn_cos(index), test_fcn_sin(index));
+ }
+
+
+ void
+ qa_mmse_fir_interpolator_cc::t1()
+ {
+ static const unsigned N = 100;
+ gr_complex *input = fft::malloc_complex(N + 10);
+
+ for(unsigned i = 0; i < N+10; i++)
+ input[i] = test_fcn((double) i);
+
+ mmse_fir_interpolator_cc intr;
+ float inv_nsteps = 1.0 / intr.nsteps();
+
+ for(unsigned i = 0; i < N; i++) {
+ for(unsigned imu = 0; imu <= intr.nsteps (); imu += 1) {
+ gr_complex expected = test_fcn((i + 3) + imu * inv_nsteps);
+ gr_complex actual = intr.interpolate(&input[i], imu * inv_nsteps);
+
+ CPPUNIT_ASSERT_COMPLEXES_EQUAL(expected, actual, 0.004);
+ // printf ("%9.6f %9.6f %9.6f\n", expected, actual, expected - actual);
+ }
+ }
+ fft::free(input);
+ }
+
+ /*
+ * Force bad alignment and confirm that it raises an exception
+ */
+ void
+ qa_mmse_fir_interpolator_cc::t2_body()
+ {
+ static const unsigned N = 100;
+ float float_input[2*(N+10) + 1];
+ gr_complex *input;
+
+ // We require that gr_complex be aligned on an 8-byte boundary.
+ // Ensure that we ARE NOT ;)
+
+ if(((intptr_t) float_input & 0x7) == 0)
+ input = reinterpret_cast<gr_complex *>(&float_input[1]);
+ else
+ input = reinterpret_cast<gr_complex *>(&float_input[0]);
+
+ for(unsigned i = 0; i < (N+10); i++)
+ input[i] = test_fcn((double) i);
+
+ mmse_fir_interpolator_cc intr;
+ float inv_nsteps = 1.0 / intr.nsteps();
+
+ for(unsigned i = 0; i < N; i++) {
+ for(unsigned imu = 0; imu <= intr.nsteps (); imu += 1) {
+ gr_complex expected = test_fcn((i + 3) + imu * inv_nsteps);
+ gr_complex actual = intr.interpolate(&input[i], imu * inv_nsteps);
+
+ CPPUNIT_ASSERT_COMPLEXES_EQUAL(expected, actual, 0.004);
+ // printf ("%9.6f %9.6f %9.6f\n", expected, actual, expected - actual);
+ }
+ }
+ }
+
+ void
+ qa_mmse_fir_interpolator_cc::t2()
+ {
+ CPPUNIT_ASSERT_THROW(t2_body(), std::invalid_argument);
+ }
+
+ } /* namespace filter */
+} /* namespace gr */
diff --git a/gr-filter/lib/qa_mmse_fir_interpolator_cc.h b/gr-filter/lib/qa_mmse_fir_interpolator_cc.h
new file mode 100644
index 000000000..a45965ca2
--- /dev/null
+++ b/gr-filter/lib/qa_mmse_fir_interpolator_cc.h
@@ -0,0 +1,48 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002,2007,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 _QA_MMSE_FIR_INTERPOLATOR_CC_H_
+#define _QA_MMSE_FIR_INTERPOLATOR_CC_H_
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/TestCase.h>
+
+namespace gr {
+ namespace filter {
+
+ class qa_mmse_fir_interpolator_cc : public CppUnit::TestCase
+ {
+ CPPUNIT_TEST_SUITE(qa_mmse_fir_interpolator_cc);
+ CPPUNIT_TEST(t1);
+ // CPPUNIT_TEST(t2);
+ CPPUNIT_TEST_SUITE_END();
+
+ private:
+ void t1();
+ void t2();
+ void t2_body();
+ };
+
+ } /* namespace filter */
+} /* namespace gr */
+
+#endif /* _QA_MMSE_FIR_INTERPOLATOR_CC_H_ */
diff --git a/gr-filter/lib/qa_mmse_fir_interpolator_ff.cc b/gr-filter/lib/qa_mmse_fir_interpolator_ff.cc
new file mode 100644
index 000000000..54387fd9b
--- /dev/null
+++ b/gr-filter/lib/qa_mmse_fir_interpolator_ff.cc
@@ -0,0 +1,71 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002,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 <cppunit/TestAssert.h>
+#include <qa_mmse_fir_interpolator_ff.h>
+#include <filter/mmse_fir_interpolator_ff.h>
+#include <fft/fft.h>
+#include <cstdio>
+#include <cmath>
+
+namespace gr {
+ namespace filter {
+
+ static float
+ test_fcn(double index)
+ {
+ return (2 * sin(index * 0.25 * 2 * M_PI + 0.125 * M_PI)
+ + 3 * sin(index * 0.077 * 2 * M_PI + 0.3 * M_PI));
+ }
+
+ void
+ qa_mmse_fir_interpolator_ff::t1()
+ {
+ // use aligned malloc and make sure that everything in this
+ // buffer is properly initialized.
+ static const unsigned N = 100;
+ float *input = fft::malloc_float(N + 10);
+
+ for(unsigned i = 0; i < N+10; i++)
+ input[i] = test_fcn((double) i);
+
+ mmse_fir_interpolator_ff intr;
+ float inv_nsteps = 1.0 / intr.nsteps();
+
+ for(unsigned i = 0; i < N; i++) {
+ for(unsigned imu = 0; imu <= intr.nsteps (); imu += 1) {
+ float expected = test_fcn((i + 3) + imu * inv_nsteps);
+ float actual = intr.interpolate(&input[i], imu * inv_nsteps);
+
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(expected, actual, 0.004);
+ // printf ("%9.6f %9.6f %9.6f\n", expected, actual, expected - actual);
+ }
+ }
+ fft::free(input);
+ }
+
+ } /* namespace filter */
+} /* namespace gr */
diff --git a/gr-filter/lib/qa_mmse_fir_interpolator_ff.h b/gr-filter/lib/qa_mmse_fir_interpolator_ff.h
new file mode 100644
index 000000000..833ec173a
--- /dev/null
+++ b/gr-filter/lib/qa_mmse_fir_interpolator_ff.h
@@ -0,0 +1,45 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002,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 _QA_MMSE_FIR_INTERPOLATOR_FF_H_
+#define _QA_MMSE_FIR_INTERPOLATOR_FF_H_
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/TestCase.h>
+
+namespace gr {
+ namespace filter {
+
+ class qa_mmse_fir_interpolator_ff : public CppUnit::TestCase
+ {
+ CPPUNIT_TEST_SUITE(qa_mmse_fir_interpolator_ff);
+ CPPUNIT_TEST(t1);
+ CPPUNIT_TEST_SUITE_END();
+
+ private:
+ void t1();
+ };
+
+ } /* namespace filter */
+} /* namespace gr */
+
+#endif /* _QA_MMSE_FIR_INTERPOLATOR_FF_H_ */
diff --git a/gr-filter/lib/rational_resampler_base_XXX_impl.cc.t b/gr-filter/lib/rational_resampler_base_XXX_impl.cc.t
new file mode 100644
index 000000000..2e9161eeb
--- /dev/null
+++ b/gr-filter/lib/rational_resampler_base_XXX_impl.cc.t
@@ -0,0 +1,174 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,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.
+ */
+
+/* @WARNING@ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "@IMPL_NAME@.h"
+#include <gr_io_signature.h>
+#include <volk/volk.h>
+#include <stdexcept>
+
+namespace gr {
+ namespace filter {
+
+ @BASE_NAME@::sptr
+ @BASE_NAME@::make(unsigned interpolation,
+ unsigned decimation,
+ const std::vector<@TAP_TYPE@> &taps)
+ {
+ return gnuradio::get_initial_sptr
+ (new @IMPL_NAME@(interpolation, decimation, taps));
+ }
+
+ @IMPL_NAME@::@IMPL_NAME@(unsigned interpolation,
+ unsigned decimation,
+ const std::vector<@TAP_TYPE@> &taps)
+ : gr_block("@BASE_NAME@",
+ gr_make_io_signature(1, 1, sizeof(@I_TYPE@)),
+ gr_make_io_signature(1, 1, sizeof(@O_TYPE@))),
+ d_history(1),
+ d_interpolation(interpolation),
+ d_decimation(decimation),
+ d_ctr(0),
+ d_firs(interpolation),
+ d_updated(false)
+ {
+ if(interpolation == 0)
+ throw std::out_of_range("@IMPL_NAME@: interpolation must be > 0");
+ if(decimation == 0)
+ throw std::out_of_range("@IMPL_NAME@: decimation must be > 0");
+
+ set_relative_rate(1.0 * interpolation / decimation);
+ set_output_multiple(1);
+
+ std::vector<@TAP_TYPE@> dummy_taps;
+
+ for(unsigned i = 0; i < interpolation; i++) {
+ d_firs[i] = new kernel::@FIR_TYPE@(1, dummy_taps);
+ }
+
+ set_taps(taps);
+ install_taps(d_new_taps);
+ }
+
+ @IMPL_NAME@::~@IMPL_NAME@()
+ {
+ int interp = interpolation();
+ for(int i = 0; i < interp; i++) {
+ delete d_firs[i];
+ }
+ }
+
+ void
+ @IMPL_NAME@::set_taps(const std::vector<@TAP_TYPE@> &taps)
+ {
+ d_new_taps = taps;
+ d_updated = true;
+
+ // round up length to a multiple of the interpolation factor
+ int n = taps.size() % interpolation();
+ if(n > 0) {
+ n = interpolation() - n;
+ while(n-- > 0) {
+ d_new_taps.insert(d_new_taps.begin(), 0);
+ }
+ }
+
+ assert(d_new_taps.size() % interpolation() == 0);
+ }
+
+ void
+ @IMPL_NAME@::install_taps(const std::vector<@TAP_TYPE@> &taps)
+ {
+ int nfilters = interpolation();
+ int nt = taps.size() / nfilters;
+
+ assert(nt * nfilters == (int) taps.size());
+
+ std::vector< std::vector <@TAP_TYPE@> > xtaps(nfilters);
+
+ for(int n = 0; n < nfilters; n++)
+ xtaps[n].resize (nt);
+
+ for(int i = 0; i < (int)taps.size(); i++)
+ xtaps[i % nfilters][i / nfilters] = taps[i];
+
+ for(int n = 0; n < nfilters; n++)
+ d_firs[n]->set_taps(xtaps[n]);
+
+ set_history(nt);
+ d_updated = false;
+ }
+
+ std::vector<@TAP_TYPE@>
+ @IMPL_NAME@::taps() const
+ {
+ return d_new_taps;
+ }
+
+ void
+ @IMPL_NAME@::forecast(int noutput_items, gr_vector_int &ninput_items_required)
+ {
+ int nreqd = std::max((unsigned)1, (int)((double) (noutput_items+1) * \
+ decimation() / interpolation()) + history() - 1);
+ unsigned ninputs = ninput_items_required.size();
+ for(unsigned i = 0; i < ninputs; i++)
+ ninput_items_required[i] = nreqd;
+ }
+
+ int
+ @IMPL_NAME@::general_work(int noutput_items,
+ gr_vector_int &ninput_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];
+
+ if(d_updated) {
+ install_taps(d_new_taps);
+ return 0; // history requirement may have increased.
+ }
+
+ unsigned int ctr = d_ctr;
+
+ int i = 0;
+ while(i < noutput_items) {
+ out[i++] = d_firs[ctr]->filter(in);
+ ctr += decimation();
+ while(ctr >= interpolation()) {
+ ctr -= interpolation();
+ in++;
+ }
+ }
+
+ d_ctr = ctr;
+ consume_each(in - (@I_TYPE@*)input_items[0]);
+ return i;
+ }
+
+ } /* namespace filter */
+} /* namespace gr */
diff --git a/gr-filter/lib/rational_resampler_base_XXX_impl.h.t b/gr-filter/lib/rational_resampler_base_XXX_impl.h.t
new file mode 100644
index 000000000..4396656da
--- /dev/null
+++ b/gr-filter/lib/rational_resampler_base_XXX_impl.h.t
@@ -0,0 +1,72 @@
+/* -*- 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.
+ */
+
+/* @WARNING@ */
+
+#ifndef @GUARD_NAME@
+#define @GUARD_NAME@
+
+#include <filter/fir_filter.h>
+#include <filter/@BASE_NAME@.h>
+
+namespace gr {
+ namespace filter {
+
+ class FILTER_API @IMPL_NAME@ : public @BASE_NAME@
+ {
+ private:
+ unsigned d_history;
+ unsigned d_interpolation;
+ unsigned d_decimation;
+ unsigned d_ctr;
+ std::vector<@TAP_TYPE@> d_new_taps;
+ std::vector<kernel::@FIR_TYPE@ *> d_firs;
+ bool d_updated;
+
+ void install_taps(const std::vector<@TAP_TYPE@> &taps);
+
+ public:
+ @IMPL_NAME@(unsigned interpolation, unsigned decimation,
+ const std::vector<@TAP_TYPE@> &taps);
+
+ ~@IMPL_NAME@();
+
+ unsigned history() const { return d_history; }
+ void set_history(unsigned history) { d_history = history; }
+
+ unsigned interpolation() const { return d_interpolation; }
+ unsigned decimation() const { return d_decimation; }
+
+ void set_taps(const std::vector<@TAP_TYPE@> &taps);
+ std::vector<@TAP_TYPE@> taps() const;
+
+ 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);
+ };
+
+ } /* namespace filter */
+} /* namespace gr */
+
+#endif /* @GUARD_NAME@ */
diff --git a/gr-filter/lib/single_pole_iir_filter_cc_impl.cc b/gr-filter/lib/single_pole_iir_filter_cc_impl.cc
new file mode 100644
index 000000000..9406f2c98
--- /dev/null
+++ b/gr-filter/lib/single_pole_iir_filter_cc_impl.cc
@@ -0,0 +1,89 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2006,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 "single_pole_iir_filter_cc_impl.h"
+#include <gr_io_signature.h>
+
+
+namespace gr {
+ namespace filter {
+
+ single_pole_iir_filter_cc::sptr
+ single_pole_iir_filter_cc::make(double alpha, unsigned int vlen)
+ {
+ return gnuradio::get_initial_sptr
+ (new single_pole_iir_filter_cc_impl(alpha, vlen));
+ }
+
+ single_pole_iir_filter_cc_impl::single_pole_iir_filter_cc_impl
+ (double alpha, unsigned int vlen)
+ : gr_sync_block("single_pole_iir_filter_cc",
+ gr_make_io_signature(1, 1, sizeof (gr_complex) * vlen),
+ gr_make_io_signature(1, 1, sizeof (gr_complex) * vlen)),
+ d_vlen(vlen), d_iir(vlen)
+ {
+ set_taps(alpha);
+ }
+
+ single_pole_iir_filter_cc_impl::~single_pole_iir_filter_cc_impl()
+ {
+ }
+
+ void
+ single_pole_iir_filter_cc_impl::set_taps(double alpha)
+ {
+ for(unsigned int i = 0; i < d_vlen; i++) {
+ d_iir[i].set_taps(alpha);
+ }
+ }
+
+ int
+ single_pole_iir_filter_cc_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const gr_complex *in = (const gr_complex*)input_items[0];
+ gr_complex *out = (gr_complex*)output_items[0];
+ unsigned int vlen = d_vlen;
+
+ if(d_vlen == 1) {
+ for(int i = 0; i < noutput_items; i++) {
+ out[i] = d_iir[0].filter(in[i]);
+ }
+ }
+ else {
+ for(int i = 0; i < noutput_items; i++) {
+ for(unsigned int j = 0; j < vlen; j++) {
+ *out++ = d_iir[j].filter(*in++);
+ }
+ }
+ }
+
+ return noutput_items;
+ };
+
+ } /* namespace filter */
+} /* namespace gr */
diff --git a/gr-filter/lib/single_pole_iir_filter_cc_impl.h b/gr-filter/lib/single_pole_iir_filter_cc_impl.h
new file mode 100644
index 000000000..fa627881e
--- /dev/null
+++ b/gr-filter/lib/single_pole_iir_filter_cc_impl.h
@@ -0,0 +1,55 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004-2006,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 INCLUDED_SINGLE_POLE_IIR_FILTER_CC_IMPL_H
+#define INCLUDED_SINGLE_POLE_IIR_FILTER_CC_IMPL_H
+
+#include <filter/single_pole_iir.h>
+#include <filter/single_pole_iir_filter_cc.h>
+#include <gr_sync_block.h>
+#include <gr_complex.h>
+#include <stdexcept>
+
+namespace gr {
+ namespace filter {
+
+ class FILTER_API single_pole_iir_filter_cc_impl : public single_pole_iir_filter_cc
+ {
+ private:
+ unsigned int d_vlen;
+ std::vector<single_pole_iir<gr_complex,gr_complex,double> > d_iir;
+
+ public:
+ single_pole_iir_filter_cc_impl(double alpha, unsigned int vlen);
+ ~single_pole_iir_filter_cc_impl();
+
+ void set_taps(double alpha);
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace filter */
+} /* namespace gr */
+
+#endif /* INCLUDED_SINGLE_POLE_IIR_FILTER_CC_IMPL_H */
diff --git a/gr-filter/lib/single_pole_iir_filter_ff_impl.cc b/gr-filter/lib/single_pole_iir_filter_ff_impl.cc
new file mode 100644
index 000000000..7e2bae5db
--- /dev/null
+++ b/gr-filter/lib/single_pole_iir_filter_ff_impl.cc
@@ -0,0 +1,87 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,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 "single_pole_iir_filter_ff_impl.h"
+#include <gr_io_signature.h>
+
+namespace gr {
+ namespace filter {
+
+ single_pole_iir_filter_ff::sptr
+ single_pole_iir_filter_ff::make(double alpha, unsigned int vlen)
+ {
+ return gnuradio::get_initial_sptr
+ (new single_pole_iir_filter_ff_impl(alpha, vlen));
+ }
+
+ single_pole_iir_filter_ff_impl::single_pole_iir_filter_ff_impl
+ (double alpha, unsigned int vlen)
+ : gr_sync_block("single_pole_iir_filter_ff",
+ gr_make_io_signature(1, 1, sizeof(float)*vlen),
+ gr_make_io_signature(1, 1, sizeof(float)*vlen)),
+ d_vlen(vlen), d_iir(vlen)
+ {
+ set_taps(alpha);
+ }
+
+ single_pole_iir_filter_ff_impl::~single_pole_iir_filter_ff_impl()
+ {
+ }
+
+ void
+ single_pole_iir_filter_ff_impl::set_taps(double alpha)
+ {
+ for(unsigned int i = 0; i < d_vlen; i++) {
+ d_iir[i].set_taps(alpha);
+ }
+ }
+
+ int
+ single_pole_iir_filter_ff_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const float *in = (const float*)input_items[0];
+ float *out = (float*)output_items[0];
+ unsigned int vlen = d_vlen;
+
+ if(d_vlen == 1) {
+ for(int i = 0; i < noutput_items; i++) {
+ out[i] = d_iir[0].filter (in[i]);
+ }
+ }
+ else {
+ for(int i = 0; i < noutput_items; i++) {
+ for(unsigned int j = 0; j < vlen; j++) {
+ *out++ = d_iir[j].filter(*in++);
+ }
+ }
+ }
+ return noutput_items;
+ };
+
+ } /* namespace filter */
+} /* namespace gr */
diff --git a/gr-filter/lib/single_pole_iir_filter_ff_impl.h b/gr-filter/lib/single_pole_iir_filter_ff_impl.h
new file mode 100644
index 000000000..cba9c188c
--- /dev/null
+++ b/gr-filter/lib/single_pole_iir_filter_ff_impl.h
@@ -0,0 +1,54 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004-2006,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 INCLUDED_SINGLE_POLE_IIR_FILTER_FF_IMPL_H
+#define INCLUDED_SINGLE_POLE_IIR_FILTER_FF_IMPL_H
+
+#include <filter/single_pole_iir.h>
+#include <filter/single_pole_iir_filter_ff.h>
+#include <gr_sync_block.h>
+#include <stdexcept>
+
+namespace gr {
+ namespace filter {
+
+ class FILTER_API single_pole_iir_filter_ff_impl : public single_pole_iir_filter_ff
+ {
+ private:
+ unsigned int d_vlen;
+ std::vector<single_pole_iir<float,float,double> > d_iir;
+
+ public:
+ single_pole_iir_filter_ff_impl(double alpha, unsigned int vlen);
+ ~single_pole_iir_filter_ff_impl();
+
+ void set_taps(double alpha);
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace filter */
+} /* namespace gr */
+
+#endif /* INCLUDED_SINGLE_POLE_IIR_FILTER_FF_IMPL_H */
diff --git a/gr-filter/lib/test_gr_filter.cc b/gr-filter/lib/test_gr_filter.cc
new file mode 100644
index 000000000..915b6286b
--- /dev/null
+++ b/gr-filter/lib/test_gr_filter.cc
@@ -0,0 +1,43 @@
+/* -*- 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.
+ */
+
+#include <cppunit/TextTestRunner.h>
+#include <cppunit/XmlOutputter.h>
+
+#include <gr_unittests.h>
+#include <qa_filter.h>
+#include <iostream>
+
+int
+main (int argc, char **argv)
+{
+ CppUnit::TextTestRunner runner;
+ std::ofstream xmlfile(get_unittest_path("gr_filter.xml").c_str());
+ CppUnit::XmlOutputter *xmlout = new CppUnit::XmlOutputter(&runner.result(), xmlfile);
+
+ runner.addTest(qa_gr_filter::suite());
+ runner.setOutputter(xmlout);
+
+ bool was_successful = runner.run("", false);
+
+ return was_successful ? 0 : 1;
+}
diff --git a/gr-filter/python/CMakeLists.txt b/gr-filter/python/CMakeLists.txt
new file mode 100644
index 000000000..bcb55cf46
--- /dev/null
+++ b/gr-filter/python/CMakeLists.txt
@@ -0,0 +1,50 @@
+# 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.
+
+########################################################################
+include(GrPython)
+
+GR_PYTHON_INSTALL(
+ FILES
+ __init__.py
+ optfir.py
+ pfb.py
+ rational_resampler.py
+ DESTINATION ${GR_PYTHON_DIR}/gnuradio/filter
+ COMPONENT "filter_python"
+)
+
+########################################################################
+# Handle the unit tests
+########################################################################
+if(ENABLE_TESTING)
+
+list(APPEND GR_TEST_PYTHON_DIRS
+ ${CMAKE_BINARY_DIR}/gr-filter/python
+ ${CMAKE_BINARY_DIR}/gr-filter/swig
+)
+list(APPEND GR_TEST_TARGET_DEPS gnuradio-filter gnuradio-fft)
+
+include(GrTest)
+file(GLOB py_qa_test_files "qa_*.py")
+foreach(py_qa_test_file ${py_qa_test_files})
+ get_filename_component(py_qa_test_name ${py_qa_test_file} NAME_WE)
+ GR_ADD_TEST(${py_qa_test_name} ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} ${py_qa_test_file})
+endforeach(py_qa_test_file)
+endif(ENABLE_TESTING)
diff --git a/gr-filter/python/__init__.py b/gr-filter/python/__init__.py
new file mode 100644
index 000000000..65a62d828
--- /dev/null
+++ b/gr-filter/python/__init__.py
@@ -0,0 +1,30 @@
+#
+# 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.
+#
+
+'''
+This is the gr-filter package. This package provides GNU Radio
+processing blocks for FILTER and related functions.
+'''
+
+from filter_swig import *
+from rational_resampler import *
+import pfb
+import optfir
diff --git a/gr-filter/python/optfir.py b/gr-filter/python/optfir.py
new file mode 100644
index 000000000..bccb8c68d
--- /dev/null
+++ b/gr-filter/python/optfir.py
@@ -0,0 +1,339 @@
+#
+# Copyright 2004,2005,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.
+#
+
+'''
+Routines for designing optimal FIR filters.
+
+For a great intro to how all this stuff works, see section 6.6 of
+"Digital Signal Processing: A Practical Approach", Emmanuael C. Ifeachor
+and Barrie W. Jervis, Adison-Wesley, 1993. ISBN 0-201-54413-X.
+'''
+
+import math, cmath
+import filter_swig as filter
+
+# ----------------------------------------------------------------
+
+## Builds a low pass filter.
+# @param gain Filter gain in the passband (linear)
+# @param Fs Sampling rate (sps)
+# @param freq1 End of pass band (in Hz)
+# @param freq2 Start of stop band (in Hz)
+# @param passband_ripple_db Pass band ripple in dB (should be small, < 1)
+# @param stopband_atten_db Stop band attenuation in dB (should be large, >= 60)
+# @param nextra_taps Extra taps to use in the filter (default=2)
+def low_pass (gain, Fs, freq1, freq2, passband_ripple_db, stopband_atten_db,
+ nextra_taps=2):
+ passband_dev = passband_ripple_to_dev (passband_ripple_db)
+ stopband_dev = stopband_atten_to_dev (stopband_atten_db)
+ desired_ampls = (gain, 0)
+ (n, fo, ao, w) = remezord ([freq1, freq2], desired_ampls,
+ [passband_dev, stopband_dev], Fs)
+ # The remezord typically under-estimates the filter order, so add 2 taps by default
+ taps = filter.pm_remez (n + nextra_taps, fo, ao, w, "bandpass")
+ return taps
+
+## Builds a band pass filter.
+# @param gain Filter gain in the passband (linear)
+# @param Fs Sampling rate (sps)
+# @param freq_sb1 End of stop band (in Hz)
+# @param freq_pb1 Start of pass band (in Hz)
+# @param freq_pb2 End of pass band (in Hz)
+# @param freq_sb2 Start of stop band (in Hz)
+# @param passband_ripple_db Pass band ripple in dB (should be small, < 1)
+# @param stopband_atten_db Stop band attenuation in dB (should be large, >= 60)
+# @param nextra_taps Extra taps to use in the filter (default=2)
+def band_pass (gain, Fs, freq_sb1, freq_pb1, freq_pb2, freq_sb2,
+ passband_ripple_db, stopband_atten_db,
+ nextra_taps=2):
+ passband_dev = passband_ripple_to_dev (passband_ripple_db)
+ stopband_dev = stopband_atten_to_dev (stopband_atten_db)
+ desired_ampls = (0, gain, 0)
+ desired_freqs = [freq_sb1, freq_pb1, freq_pb2, freq_sb2]
+ desired_ripple = [stopband_dev, passband_dev, stopband_dev]
+ (n, fo, ao, w) = remezord (desired_freqs, desired_ampls,
+ desired_ripple, Fs)
+ # The remezord typically under-estimates the filter order, so add 2 taps by default
+ taps = filter.pm_remez (n + nextra_taps, fo, ao, w, "bandpass")
+ return taps
+
+
+## Builds a band pass filter with complex taps by making an LPF and
+# spinning it up to the right center frequency
+# @param gain Filter gain in the passband (linear)
+# @param Fs Sampling rate (sps)
+# @param freq_sb1 End of stop band (in Hz)
+# @param freq_pb1 Start of pass band (in Hz)
+# @param freq_pb2 End of pass band (in Hz)
+# @param freq_sb2 Start of stop band (in Hz)
+# @param passband_ripple_db Pass band ripple in dB (should be small, < 1)
+# @param stopband_atten_db Stop band attenuation in dB (should be large, >= 60)
+# @param nextra_taps Extra taps to use in the filter (default=2)
+def complex_band_pass (gain, Fs, freq_sb1, freq_pb1, freq_pb2, freq_sb2,
+ passband_ripple_db, stopband_atten_db,
+ nextra_taps=2):
+ center_freq = (freq_pb2 + freq_pb1) / 2.0
+ lp_pb = (freq_pb2 - center_freq)/1.0
+ lp_sb = freq_sb2 - center_freq
+ lptaps = low_pass(gain, Fs, lp_pb, lp_sb, passband_ripple_db,
+ stopband_atten_db, nextra_taps)
+ spinner = [cmath.exp(2j*cmath.pi*center_freq/Fs*i) for i in xrange(len(lptaps))]
+ taps = [s*t for s,t in zip(spinner, lptaps)]
+ return taps
+
+
+## Builds a band reject filter
+# spinning it up to the right center frequency
+# @param gain Filter gain in the passband (linear)
+# @param Fs Sampling rate (sps)
+# @param freq_pb1 End of pass band (in Hz)
+# @param freq_sb1 Start of stop band (in Hz)
+# @param freq_sb2 End of stop band (in Hz)
+# @param freq_pb2 Start of pass band (in Hz)
+# @param passband_ripple_db Pass band ripple in dB (should be small, < 1)
+# @param stopband_atten_db Stop band attenuation in dB (should be large, >= 60)
+# @param nextra_taps Extra taps to use in the filter (default=2)
+def band_reject (gain, Fs, freq_pb1, freq_sb1, freq_sb2, freq_pb2,
+ passband_ripple_db, stopband_atten_db,
+ nextra_taps=2):
+ passband_dev = passband_ripple_to_dev (passband_ripple_db)
+ stopband_dev = stopband_atten_to_dev (stopband_atten_db)
+ desired_ampls = (gain, 0, gain)
+ desired_freqs = [freq_pb1, freq_sb1, freq_sb2, freq_pb2]
+ desired_ripple = [passband_dev, stopband_dev, passband_dev]
+ (n, fo, ao, w) = remezord (desired_freqs, desired_ampls,
+ desired_ripple, Fs)
+ # Make sure we use an odd number of taps
+ if((n+nextra_taps)%2 == 1):
+ n += 1
+ # The remezord typically under-estimates the filter order, so add 2 taps by default
+ taps = filter.pm_remez (n + nextra_taps, fo, ao, w, "bandpass")
+ return taps
+
+
+## Builds a high pass filter.
+# @param gain Filter gain in the passband (linear)
+# @param Fs Sampling rate (sps)
+# @param freq1 End of stop band (in Hz)
+# @param freq2 Start of pass band (in Hz)
+# @param passband_ripple_db Pass band ripple in dB (should be small, < 1)
+# @param stopband_atten_db Stop band attenuation in dB (should be large, >= 60)
+# @param nextra_taps Extra taps to use in the filter (default=2)
+def high_pass (gain, Fs, freq1, freq2, passband_ripple_db, stopband_atten_db,
+ nextra_taps=2):
+ passband_dev = passband_ripple_to_dev (passband_ripple_db)
+ stopband_dev = stopband_atten_to_dev (stopband_atten_db)
+ desired_ampls = (0, 1)
+ (n, fo, ao, w) = remezord ([freq1, freq2], desired_ampls,
+ [stopband_dev, passband_dev], Fs)
+ # For a HPF, we need to use an odd number of taps
+ # In filter.remez, ntaps = n+1, so n must be even
+ if((n+nextra_taps)%2 == 1):
+ n += 1
+
+ # The remezord typically under-estimates the filter order, so add 2 taps by default
+ taps = filter.pm_remez (n + nextra_taps, fo, ao, w, "bandpass")
+ return taps
+
+# ----------------------------------------------------------------
+
+def stopband_atten_to_dev (atten_db):
+ """Convert a stopband attenuation in dB to an absolute value"""
+ return 10**(-atten_db/20)
+
+def passband_ripple_to_dev (ripple_db):
+ """Convert passband ripple spec expressed in dB to an absolute value"""
+ return (10**(ripple_db/20)-1)/(10**(ripple_db/20)+1)
+
+# ----------------------------------------------------------------
+
+def remezord (fcuts, mags, devs, fsamp = 2):
+ '''
+ FIR order estimator (lowpass, highpass, bandpass, mulitiband).
+
+ (n, fo, ao, w) = remezord (f, a, dev)
+ (n, fo, ao, w) = remezord (f, a, dev, fs)
+
+ (n, fo, ao, w) = remezord (f, a, dev) finds the approximate order,
+ normalized frequency band edges, frequency band amplitudes, and
+ weights that meet input specifications f, a, and dev, to use with
+ the remez command.
+
+ * f is a sequence of frequency band edges (between 0 and Fs/2, where
+ Fs is the sampling frequency), and a is a sequence specifying the
+ desired amplitude on the bands defined by f. The length of f is
+ twice the length of a, minus 2. The desired function is
+ piecewise constant.
+
+ * dev is a sequence the same size as a that specifies the maximum
+ allowable deviation or ripples between the frequency response
+ and the desired amplitude of the output filter, for each band.
+
+ Use remez with the resulting order n, frequency sequence fo,
+ amplitude response sequence ao, and weights w to design the filter b
+ which approximately meets the specifications given by remezord
+ input parameters f, a, and dev:
+
+ b = remez (n, fo, ao, w)
+
+ (n, fo, ao, w) = remezord (f, a, dev, Fs) specifies a sampling frequency Fs.
+
+ Fs defaults to 2 Hz, implying a Nyquist frequency of 1 Hz. You can
+ therefore specify band edges scaled to a particular applications
+ sampling frequency.
+
+ In some cases remezord underestimates the order n. If the filter
+ does not meet the specifications, try a higher order such as n+1
+ or n+2.
+ '''
+ # get local copies
+ fcuts = fcuts[:]
+ mags = mags[:]
+ devs = devs[:]
+
+ for i in range (len (fcuts)):
+ fcuts[i] = float (fcuts[i]) / fsamp
+
+ nf = len (fcuts)
+ nm = len (mags)
+ nd = len (devs)
+ nbands = nm
+
+ if nm != nd:
+ raise ValueError, "Length of mags and devs must be equal"
+
+ if nf != 2 * (nbands - 1):
+ raise ValueError, "Length of f must be 2 * len (mags) - 2"
+
+ for i in range (len (mags)):
+ if mags[i] != 0: # if not stopband, get relative deviation
+ devs[i] = devs[i] / mags[i]
+
+ # separate the passband and stopband edges
+ f1 = fcuts[0::2]
+ f2 = fcuts[1::2]
+
+ n = 0
+ min_delta = 2
+ for i in range (len (f1)):
+ if f2[i] - f1[i] < min_delta:
+ n = i
+ min_delta = f2[i] - f1[i]
+
+ if nbands == 2:
+ # lowpass or highpass case (use formula)
+ l = lporder (f1[n], f2[n], devs[0], devs[1])
+ else:
+ # bandpass or multipass case
+ # try different lowpasses and take the worst one that
+ # goes through the BP specs
+ l = 0
+ for i in range (1, nbands-1):
+ l1 = lporder (f1[i-1], f2[i-1], devs[i], devs[i-1])
+ l2 = lporder (f1[i], f2[i], devs[i], devs[i+1])
+ l = max (l, l1, l2)
+
+ n = int (math.ceil (l)) - 1 # need order, not length for remez
+
+ # cook up remez compatible result
+ ff = [0] + fcuts + [1]
+ for i in range (1, len (ff) - 1):
+ ff[i] *= 2
+
+ aa = []
+ for a in mags:
+ aa = aa + [a, a]
+
+ max_dev = max (devs)
+ wts = [1] * len(devs)
+ for i in range (len (wts)):
+ wts[i] = max_dev / devs[i]
+
+ return (n, ff, aa, wts)
+
+# ----------------------------------------------------------------
+
+def lporder (freq1, freq2, delta_p, delta_s):
+ '''
+ FIR lowpass filter length estimator. freq1 and freq2 are
+ normalized to the sampling frequency. delta_p is the passband
+ deviation (ripple), delta_s is the stopband deviation (ripple).
+
+ Note, this works for high pass filters too (freq1 > freq2), but
+ doesnt work well if the transition is near f == 0 or f == fs/2
+
+ From Herrmann et al (1973), Practical design rules for optimum
+ finite impulse response filters. Bell System Technical J., 52, 769-99
+ '''
+ df = abs (freq2 - freq1)
+ ddp = math.log10 (delta_p)
+ dds = math.log10 (delta_s)
+
+ a1 = 5.309e-3
+ a2 = 7.114e-2
+ a3 = -4.761e-1
+ a4 = -2.66e-3
+ a5 = -5.941e-1
+ a6 = -4.278e-1
+
+ b1 = 11.01217
+ b2 = 0.5124401
+
+ t1 = a1 * ddp * ddp
+ t2 = a2 * ddp
+ t3 = a4 * ddp * ddp
+ t4 = a5 * ddp
+
+ dinf=((t1 + t2 + a3) * dds) + (t3 + t4 + a6)
+ ff = b1 + b2 * (ddp - dds)
+ n = dinf / df - ff * df + 1
+ return n
+
+
+def bporder (freq1, freq2, delta_p, delta_s):
+ '''
+ FIR bandpass filter length estimator. freq1 and freq2 are
+ normalized to the sampling frequency. delta_p is the passband
+ deviation (ripple), delta_s is the stopband deviation (ripple).
+
+ From Mintzer and Liu (1979)
+ '''
+ df = abs (freq2 - freq1)
+ ddp = math.log10 (delta_p)
+ dds = math.log10 (delta_s)
+
+ a1 = 0.01201
+ a2 = 0.09664
+ a3 = -0.51325
+ a4 = 0.00203
+ a5 = -0.57054
+ a6 = -0.44314
+
+ t1 = a1 * ddp * ddp
+ t2 = a2 * ddp
+ t3 = a4 * ddp * ddp
+ t4 = a5 * ddp
+
+ cinf = dds * (t1 + t2 + a3) + t3 + t4 + a6
+ ginf = -14.6 * math.log10 (delta_p / delta_s) - 16.9
+ n = cinf / df + ginf * df + 1
+ return n
+
diff --git a/gr-filter/python/pfb.py b/gr-filter/python/pfb.py
new file mode 100644
index 000000000..ddf289982
--- /dev/null
+++ b/gr-filter/python/pfb.py
@@ -0,0 +1,271 @@
+#!/usr/bin/env python
+#
+# Copyright 2009,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.
+#
+
+from gnuradio import gr
+import filter_swig as filter
+import optfir
+
+class channelizer_ccf(gr.hier_block2):
+ '''
+ Make a Polyphase Filter channelizer (complex in, complex out, floating-point taps)
+
+ This simplifies the interface by allowing a single input stream to connect to this block.
+ It will then output a stream for each channel.
+ '''
+ def __init__(self, numchans, taps=None, oversample_rate=1, atten=100):
+ gr.hier_block2.__init__(self, "pfb_channelizer_ccf",
+ gr.io_signature(1, 1, gr.sizeof_gr_complex),
+ gr.io_signature(numchans, numchans, gr.sizeof_gr_complex))
+
+ self._nchans = numchans
+ self._oversample_rate = oversample_rate
+
+ if taps is not None:
+ self._taps = taps
+ else:
+ # Create a filter that covers the full bandwidth of the input signal
+ bw = 0.4
+ tb = 0.2
+ ripple = 0.1
+ made = False
+ while not made:
+ try:
+ self._taps = optfir.low_pass(1, self._nchans, bw, bw+tb, ripple, atten)
+ made = True
+ except RuntimeError:
+ ripple += 0.01
+ made = False
+ print("Warning: set ripple to %.4f dB. If this is a problem, adjust the attenuation or create your own filter taps." % (ripple))
+
+ # Build in an exit strategy; if we've come this far, it ain't working.
+ if(ripple >= 1.0):
+ raise RuntimeError("optfir could not generate an appropriate filter.")
+
+ self.s2ss = gr.stream_to_streams(gr.sizeof_gr_complex, self._nchans)
+ self.pfb = filter.pfb_channelizer_ccf(self._nchans, self._taps,
+ self._oversample_rate)
+ self.connect(self, self.s2ss)
+
+ for i in xrange(self._nchans):
+ self.connect((self.s2ss,i), (self.pfb,i))
+ self.connect((self.pfb,i), (self,i))
+
+ def set_channel_map(self, newmap):
+ self.pfb.set_channel_map(newmap)
+
+
+
+class interpolator_ccf(gr.hier_block2):
+ '''
+ Make a Polyphase Filter interpolator (complex in, complex out, floating-point taps)
+
+ The block takes a single complex stream in and outputs a single complex
+ stream out. As such, it requires no extra glue to handle the input/output
+ streams. This block is provided to be consistent with the interface to the
+ other PFB block.
+ '''
+ def __init__(self, interp, taps=None, atten=100):
+ gr.hier_block2.__init__(self, "pfb_interpolator_ccf",
+ gr.io_signature(1, 1, gr.sizeof_gr_complex),
+ gr.io_signature(1, 1, gr.sizeof_gr_complex))
+
+ self._interp = interp
+ self._taps = taps
+
+ if taps is not None:
+ self._taps = taps
+ else:
+ # Create a filter that covers the full bandwidth of the input signal
+ bw = 0.4
+ tb = 0.2
+ ripple = 0.99
+ made = False
+ while not made:
+ try:
+ self._taps = optfir.low_pass(self._interp, self._interp, bw, bw+tb, ripple, atten)
+ made = True
+ except RuntimeError:
+ ripple += 0.01
+ made = False
+ print("Warning: set ripple to %.4f dB. If this is a problem, adjust the attenuation or create your own filter taps." % (ripple))
+
+ # Build in an exit strategy; if we've come this far, it ain't working.
+ if(ripple >= 1.0):
+ raise RuntimeError("optfir could not generate an appropriate filter.")
+
+ self.pfb = filter.pfb_interpolator_ccf(self._interp, self._taps)
+
+ self.connect(self, self.pfb)
+ self.connect(self.pfb, self)
+
+
+class decimator_ccf(gr.hier_block2):
+ '''
+ Make a Polyphase Filter decimator (complex in, complex out, floating-point taps)
+
+ This simplifies the interface by allowing a single input stream to connect to this block.
+ It will then output a stream that is the decimated output stream.
+ '''
+ def __init__(self, decim, taps=None, channel=0, atten=100):
+ gr.hier_block2.__init__(self, "pfb_decimator_ccf",
+ gr.io_signature(1, 1, gr.sizeof_gr_complex),
+ gr.io_signature(1, 1, gr.sizeof_gr_complex))
+
+ self._decim = decim
+ self._channel = channel
+
+ if taps is not None:
+ self._taps = taps
+ else:
+ # Create a filter that covers the full bandwidth of the input signal
+ bw = 0.4
+ tb = 0.2
+ ripple = 0.1
+ made = False
+ while not made:
+ try:
+ self._taps = optfir.low_pass(1, self._decim, bw, bw+tb, ripple, atten)
+ made = True
+ except RuntimeError:
+ ripple += 0.01
+ made = False
+ print("Warning: set ripple to %.4f dB. If this is a problem, adjust the attenuation or create your own filter taps." % (ripple))
+
+ # Build in an exit strategy; if we've come this far, it ain't working.
+ if(ripple >= 1.0):
+ raise RuntimeError("optfir could not generate an appropriate filter.")
+
+ self.s2ss = gr.stream_to_streams(gr.sizeof_gr_complex, self._decim)
+ self.pfb = filter.pfb_decimator_ccf(self._decim, self._taps, self._channel)
+
+ self.connect(self, self.s2ss)
+
+ for i in xrange(self._decim):
+ self.connect((self.s2ss,i), (self.pfb,i))
+
+ self.connect(self.pfb, self)
+
+
+class arb_resampler_ccf(gr.hier_block2):
+ '''
+ Convenience wrapper for the polyphase filterbank arbitrary resampler.
+
+ The block takes a single complex stream in and outputs a single complex
+ stream out. As such, it requires no extra glue to handle the input/output
+ streams. This block is provided to be consistent with the interface to the
+ other PFB block.
+ '''
+ def __init__(self, rate, taps=None, flt_size=32, atten=100):
+ gr.hier_block2.__init__(self, "pfb_arb_resampler_ccf",
+ gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature
+ gr.io_signature(1, 1, gr.sizeof_gr_complex)) # Output signature
+
+ self._rate = rate
+ self._size = flt_size
+
+ if taps is not None:
+ self._taps = taps
+ else:
+ # Create a filter that covers the full bandwidth of the input signal
+ bw = 0.4
+ tb = 0.2
+ ripple = 0.1
+ #self._taps = filter.firdes.low_pass_2(self._size, self._size, bw, tb, atten)
+ made = False
+ while not made:
+ try:
+ self._taps = optfir.low_pass(self._size, self._size, bw, bw+tb, ripple, atten)
+ made = True
+ except RuntimeError:
+ ripple += 0.01
+ made = False
+ print("Warning: set ripple to %.4f dB. If this is a problem, adjust the attenuation or create your own filter taps." % (ripple))
+
+ # Build in an exit strategy; if we've come this far, it ain't working.
+ if(ripple >= 1.0):
+ raise RuntimeError("optfir could not generate an appropriate filter.")
+
+ self.pfb = filter.pfb_arb_resampler_ccf(self._rate, self._taps, self._size)
+ #print "PFB has %d taps\n" % (len(self._taps),)
+
+ self.connect(self, self.pfb)
+ self.connect(self.pfb, self)
+
+ # Note -- set_taps not implemented in base class yet
+ def set_taps(self, taps):
+ self.pfb.set_taps(taps)
+
+ def set_rate(self, rate):
+ self.pfb.set_rate(rate)
+
+
+class arb_resampler_fff(gr.hier_block2):
+ '''
+ Convenience wrapper for the polyphase filterbank arbitrary resampler.
+
+ The block takes a single float stream in and outputs a single float
+ stream out. As such, it requires no extra glue to handle the input/output
+ streams. This block is provided to be consistent with the interface to the
+ other PFB block.
+ '''
+ def __init__(self, rate, taps=None, flt_size=32, atten=100):
+ gr.hier_block2.__init__(self, "pfb_arb_resampler_fff",
+ gr.io_signature(1, 1, gr.sizeof_float), # Input signature
+ gr.io_signature(1, 1, gr.sizeof_float)) # Output signature
+
+ self._rate = rate
+ self._size = flt_size
+
+ if taps is not None:
+ self._taps = taps
+ else:
+ # Create a filter that covers the full bandwidth of the input signal
+ bw = 0.4
+ tb = 0.2
+ ripple = 0.1
+ #self._taps = filter.firdes.low_pass_2(self._size, self._size, bw, tb, atten)
+ made = False
+ while not made:
+ try:
+ self._taps = optfir.low_pass(self._size, self._size, bw, bw+tb, ripple, atten)
+ made = True
+ except RuntimeError:
+ ripple += 0.01
+ made = False
+ print("Warning: set ripple to %.4f dB. If this is a problem, adjust the attenuation or create your own filter taps." % (ripple))
+
+ # Build in an exit strategy; if we've come this far, it ain't working.
+ if(ripple >= 1.0):
+ raise RuntimeError("optfir could not generate an appropriate filter.")
+
+ self.pfb = filter.pfb_arb_resampler_fff(self._rate, self._taps, self._size)
+ #print "PFB has %d taps\n" % (len(self._taps),)
+
+ self.connect(self, self.pfb)
+ self.connect(self.pfb, self)
+
+ # Note -- set_taps not implemented in base class yet
+ def set_taps(self, taps):
+ self.pfb.set_taps(taps)
+
+ def set_rate(self, rate):
+ self.pfb.set_rate(rate)
diff --git a/gr-filter/python/qa_adaptive_fir_filter.py b/gr-filter/python/qa_adaptive_fir_filter.py
new file mode 100755
index 000000000..cadce5204
--- /dev/null
+++ b/gr-filter/python/qa_adaptive_fir_filter.py
@@ -0,0 +1,159 @@
+#!/usr/bin/env python
+#
+# Copyright 2008,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 this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+
+from gnuradio import gr, gr_unittest
+import filter_swig as filter
+
+class test_adaptive_filter(gr_unittest.TestCase):
+
+ def setUp(self):
+ self.tb = gr.top_block ()
+
+ def tearDown(self):
+ self.tb = None
+
+ def test_adaptive_fir_filter_ccf_001(self):
+ src_data = 40*[1+1j, 2+2j, 3+3j, 4+4j]
+ expected_data = ((0.5+0.5j), (1.5+1.5j), (3+3j), (5+5j), (5.5+5.5j),
+ (6.5+6.5j), (8+8j), (10+10j), (10.5+10.5j), (11.5+11.5j),
+ (13+13j), (15+15j), (15.5+15.5j), (16.5+16.5j), (18+18j),
+ (20+20j), (20.5+20.5j), (21.5+21.5j), (23+23j), (25+25j),
+ (25.5+25.5j), (26.5+26.5j), (28+28j), (30+30j), (30.5+30.5j),
+ (31.5+31.5j), (33+33j), (35+35j), (35.5+35.5j), (36.5+36.5j),
+ (38+38j), (40+40j), (40.5+40.5j), (41.5+41.5j), (43+43j),
+ (45+45j), (45.5+45.5j), (46.5+46.5j), (48+48j), (50+50j),
+ (50+50j), (50+50j), (50+50j), (50+50j), (50+50j), (50+50j),
+ (50+50j), (50+50j), (50+50j), (50+50j), (50+50j), (50+50j),
+ (50+50j), (50+50j), (50+50j), (50+50j), (50+50j), (50+50j),
+ (50+50j), (50+50j), (50+50j), (50+50j), (50+50j), (50+50j),
+ (50+50j), (50+50j), (50+50j), (50+50j), (50+50j), (50+50j),
+ (50+50j), (50+50j), (50+50j), (50+50j), (50+50j), (50+50j),
+ (50+50j), (50+50j), (50+50j), (50+50j), (50+50j), (50+50j),
+ (50+50j), (50+50j), (50+50j), (50+50j), (50+50j), (50+50j),
+ (50+50j), (50+50j), (50+50j), (50+50j), (50+50j), (50+50j),
+ (50+50j), (50+50j), (50+50j), (50+50j), (50+50j), (50+50j),
+ (50+50j), (50+50j), (50+50j), (50+50j), (50+50j), (50+50j),
+ (50+50j), (50+50j), (50+50j), (50+50j), (50+50j), (50+50j),
+ (50+50j), (50+50j), (50+50j), (50+50j), (50+50j), (50+50j),
+ (50+50j), (50+50j), (50+50j), (50+50j), (50+50j), (50+50j),
+ (50+50j), (50+50j), (50+50j), (50+50j), (50+50j), (50+50j),
+ (50+50j), (50+50j), (50+50j), (50+50j), (50+50j), (50+50j),
+ (50+50j), (50+50j), (50+50j), (50+50j), (50+50j), (50+50j),
+ (50+50j), (50+50j), (50+50j), (50+50j), (50+50j), (50+50j),
+ (50+50j), (50+50j), (50+50j), (50+50j), (50+50j), (50+50j),
+ (50+50j), (50+50j), (50+50j), (50+50j), (50+50j), (50+50j))
+
+ src = gr.vector_source_c(src_data)
+ op = filter.adaptive_fir_ccf("test", 1, 20*[0.5, 0.5])
+ dst = gr.vector_sink_c()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ result_data = dst.data()
+ self.assertComplexTuplesAlmostEqual(expected_data, result_data, 5)
+
+ def test_adaptive_fir_filter_ccf_002(self):
+ src_data = 40*[1+1j, 2+2j, 3+3j, 4+4j]
+ expected_data = ((0.5+0.5j), (5.5+5.5j), (10.5+10.5j), (15.5+15.5j),
+ (20.5+20.5j), (25.5+25.5j), (30.5+30.5j), (35.5+35.5j),
+ (40.5+40.5j), (45.5+45.5j), (50+50j), (50+50j), (50+50j),
+ (50+50j), (50+50j), (50+50j), (50+50j), (50+50j), (50+50j),
+ (50+50j), (50+50j), (50+50j), (50+50j), (50+50j), (50+50j),
+ (50+50j), (50+50j), (50+50j), (50+50j), (50+50j), (50+50j),
+ (50+50j), (50+50j), (50+50j), (50+50j), (50+50j),
+ (50+50j), (50+50j), (50+50j), (50+50j))
+
+ src = gr.vector_source_c(src_data)
+ op = filter.adaptive_fir_ccf("test", 4, 20*[0.5, 0.5])
+ dst = gr.vector_sink_c()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ result_data = dst.data()
+ self.assertComplexTuplesAlmostEqual(expected_data, result_data, 5)
+
+ def test_adaptive_fir_filter_ccc_001(self):
+ src_data = 40*[1+1j, 2+2j, 3+3j, 4+4j]
+ expected_data = ((-0.5+1.5j), (-1.5+4.5j), (-3+9j), (-5+15j),
+ (-5.5+16.5j), (-6.5+19.5j), (-8+24j), (-10+30j),
+ (-10.5+31.5j), (-11.5+34.5j), (-13+39j), (-15+45j),
+ (-15.5+46.5j), (-16.5+49.5j), (-18+54j), (-20+60j),
+ (-20.5+61.5j), (-21.5+64.5j), (-23+69j), (-25+75j),
+ (-25.5+76.5j), (-26.5+79.5j), (-28+84j), (-30+90j),
+ (-30.5+91.5j), (-31.5+94.5j), (-33+99j), (-35+105j),
+ (-35.5+106.5j), (-36.5+109.5j), (-38+114j), (-40+120j),
+ (-40.5+121.5j), (-41.5+124.5j), (-43+129j), (-45+135j),
+ (-45.5+136.5j), (-46.5+139.5j), (-48+144j), (-50+150j),
+ (-50+150j), (-50+150j), (-50+150j), (-50+150j), (-50+150j),
+ (-50+150j), (-50+150j), (-50+150j), (-50+150j), (-50+150j),
+ (-50+150j), (-50+150j), (-50+150j), (-50+150j), (-50+150j),
+ (-50+150j), (-50+150j), (-50+150j), (-50+150j), (-50+150j),
+ (-50+150j), (-50+150j), (-50+150j), (-50+150j), (-50+150j),
+ (-50+150j), (-50+150j), (-50+150j), (-50+150j), (-50+150j),
+ (-50+150j), (-50+150j), (-50+150j), (-50+150j), (-50+150j),
+ (-50+150j), (-50+150j), (-50+150j), (-50+150j), (-50+150j),
+ (-50+150j), (-50+150j), (-50+150j), (-50+150j), (-50+150j),
+ (-50+150j), (-50+150j), (-50+150j), (-50+150j), (-50+150j),
+ (-50+150j), (-50+150j), (-50+150j), (-50+150j), (-50+150j),
+ (-50+150j), (-50+150j), (-50+150j), (-50+150j), (-50+150j),
+ (-50+150j), (-50+150j), (-50+150j), (-50+150j), (-50+150j),
+ (-50+150j), (-50+150j), (-50+150j), (-50+150j), (-50+150j),
+ (-50+150j), (-50+150j), (-50+150j), (-50+150j), (-50+150j),
+ (-50+150j), (-50+150j), (-50+150j), (-50+150j), (-50+150j),
+ (-50+150j), (-50+150j), (-50+150j), (-50+150j), (-50+150j),
+ (-50+150j), (-50+150j), (-50+150j), (-50+150j), (-50+150j),
+ (-50+150j), (-50+150j), (-50+150j), (-50+150j), (-50+150j),
+ (-50+150j), (-50+150j), (-50+150j), (-50+150j), (-50+150j),
+ (-50+150j), (-50+150j), (-50+150j), (-50+150j), (-50+150j),
+ (-50+150j), (-50+150j), (-50+150j), (-50+150j), (-50+150j),
+ (-50+150j), (-50+150j), (-50+150j), (-50+150j), (-50+150j),
+ (-50+150j), (-50+150j), (-50+150j), (-50+150j), (-50+150j))
+ src = gr.vector_source_c(src_data)
+ op = filter.adaptive_fir_ccc("test", 1, 20*[0.5+1j, 0.5+1j])
+ dst = gr.vector_sink_c()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ result_data = dst.data()
+ self.assertComplexTuplesAlmostEqual(expected_data, result_data, 5)
+
+
+ def test_adaptive_fir_filter_ccc_002(self):
+ src_data = 40*[1+1j, 2+2j, 3+3j, 4+4j]
+ expected_data = ((-0.5+1.5j), (-5.5+16.5j), (-10.5+31.5j),
+ (-15.5+46.5j), (-20.5+61.5j), (-25.5+76.5j),
+ (-30.5+91.5j), (-35.5+106.5j), (-40.5+121.5j),
+ (-45.5+136.5j), (-50+150j), (-50+150j), (-50+150j),
+ (-50+150j), (-50+150j), (-50+150j), (-50+150j),
+ (-50+150j), (-50+150j), (-50+150j), (-50+150j),
+ (-50+150j), (-50+150j), (-50+150j), (-50+150j),
+ (-50+150j), (-50+150j), (-50+150j), (-50+150j),
+ (-50+150j), (-50+150j), (-50+150j), (-50+150j),
+ (-50+150j), (-50+150j), (-50+150j), (-50+150j),
+ (-50+150j), (-50+150j), (-50+150j))
+ src = gr.vector_source_c(src_data)
+ op = filter.adaptive_fir_ccc("test", 4, 20*[0.5+1j, 0.5+1j])
+ dst = gr.vector_sink_c()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ result_data = dst.data()
+ self.assertComplexTuplesAlmostEqual(expected_data, result_data, 5)
+
+if __name__ == '__main__':
+ gr_unittest.run(test_adaptive_filter, "test_adaptive_filter.xml")
+
diff --git a/gr-filter/python/qa_channel_model.py b/gr-filter/python/qa_channel_model.py
new file mode 100755
index 000000000..7f1c61b4e
--- /dev/null
+++ b/gr-filter/python/qa_channel_model.py
@@ -0,0 +1,60 @@
+#!/usr/bin/env python
+#
+# 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.
+#
+
+from gnuradio import gr, gr_unittest
+import filter_swig as filter
+import math
+
+class test_channel_model(gr_unittest.TestCase):
+
+ def setUp(self):
+ self.tb = gr.top_block()
+
+ def tearDown(self):
+ self.tb = None
+
+ def test_000(self):
+ N = 1000 # number of samples to use
+ fs = 1000 # baseband sampling rate
+ freq = 100
+
+ signal = gr.sig_source_c(fs, gr.GR_SIN_WAVE, freq, 1)
+ head = gr.head(gr.sizeof_gr_complex, N)
+ op = filter.channel_model(0.0, 0.0, 1.0, [1,], 0)
+ snk = gr.vector_sink_c()
+ snk1 = gr.vector_sink_c()
+
+ op.set_noise_voltage(0.0)
+ op.set_frequency_offset(0.0)
+ op.set_taps([1,])
+ op.set_timing_offset(1.0)
+
+ self.tb.connect(signal, head, op, snk)
+ self.tb.connect(op, snk1)
+ self.tb.run()
+
+ dst_data = snk.data()
+ exp_data = snk1.data()
+ self.assertComplexTuplesAlmostEqual(exp_data, dst_data, 5)
+
+if __name__ == '__main__':
+ gr_unittest.run(test_channel_model, "test_channel_model.xml")
diff --git a/gr-filter/python/qa_dc_blocker.py b/gr-filter/python/qa_dc_blocker.py
new file mode 100755
index 000000000..b9df06b45
--- /dev/null
+++ b/gr-filter/python/qa_dc_blocker.py
@@ -0,0 +1,109 @@
+#!/usr/bin/env python
+#
+# Copyright 2011,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.
+#
+
+from gnuradio import gr, gr_unittest
+import filter_swig as filter
+
+class test_dc_blocker(gr_unittest.TestCase):
+
+ def setUp (self):
+ self.tb = gr.top_block ()
+
+ def tearDown (self):
+ self.tb = None
+
+ def test_001(self):
+ ''' Test impulse response - long form, cc '''
+ src_data = [1,] + 100*[0,]
+ expected_result = ((-0.02072429656982422+0j), (-0.02081298828125+0j),
+ (0.979156494140625+0j), (-0.02081298828125+0j),
+ (-0.02072429656982422+0j))
+
+ src = gr.vector_source_c(src_data)
+ op = filter.dc_blocker_cc(32, True)
+ dst = gr.vector_sink_c()
+
+ self.tb.connect (src, op, dst)
+ self.tb.run()
+
+ # only test samples around 2D-2
+ result_data = dst.data()[60:65]
+ self.assertComplexTuplesAlmostEqual (expected_result, result_data)
+
+ def test_002(self):
+ ''' Test impulse response - short form, cc '''
+ src_data = [1,] + 100*[0,]
+ expected_result = ((-0.029296875+0j), (-0.0302734375+0j),
+ (0.96875+0j), (-0.0302734375+0j),
+ (-0.029296875+0j))
+
+ src = gr.vector_source_c(src_data)
+ op = filter.dc_blocker_cc(32, False)
+ dst = gr.vector_sink_c()
+
+ self.tb.connect (src, op, dst)
+ self.tb.run()
+
+ # only test samples around D-1
+ result_data = dst.data()[29:34]
+ self.assertComplexTuplesAlmostEqual (expected_result, result_data)
+
+
+ def test_003(self):
+ ''' Test impulse response - long form, ff '''
+ src_data = [1,] + 100*[0,]
+ expected_result = ((-0.02072429656982422), (-0.02081298828125),
+ (0.979156494140625), (-0.02081298828125),
+ (-0.02072429656982422))
+
+ src = gr.vector_source_f(src_data)
+ op = filter.dc_blocker_ff(32, True)
+ dst = gr.vector_sink_f()
+
+ self.tb.connect (src, op, dst)
+ self.tb.run()
+
+ # only test samples around 2D-2
+ result_data = dst.data()[60:65]
+ self.assertFloatTuplesAlmostEqual (expected_result, result_data)
+
+ def test_004(self):
+ ''' Test impulse response - short form, ff '''
+ src_data = [1,] + 100*[0,]
+ expected_result = ((-0.029296875), (-0.0302734375),
+ (0.96875), (-0.0302734375),
+ (-0.029296875))
+
+ src = gr.vector_source_f(src_data)
+ op = filter.dc_blocker_ff(32, False)
+ dst = gr.vector_sink_f()
+
+ self.tb.connect (src, op, dst)
+ self.tb.run()
+
+ # only test samples around D-1
+ result_data = dst.data()[29:34]
+ self.assertFloatTuplesAlmostEqual (expected_result, result_data)
+
+if __name__ == '__main__':
+ gr_unittest.run(test_dc_blocker, "test_dc_blocker.xml")
+
diff --git a/gr-filter/python/qa_fft_filter.py b/gr-filter/python/qa_fft_filter.py
new file mode 100755
index 000000000..cb5416373
--- /dev/null
+++ b/gr-filter/python/qa_fft_filter.py
@@ -0,0 +1,380 @@
+#!/usr/bin/env python
+#
+# Copyright 2004,2005,2007,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.
+#
+
+from gnuradio import gr, gr_unittest
+import filter_swig as filter
+import sys
+import random
+
+def make_random_complex_tuple(L):
+ result = []
+ for x in range(L):
+ result.append(complex(2*random.random()-1,
+ 2*random.random()-1))
+ return tuple(result)
+
+def make_random_float_tuple(L):
+ result = []
+ for x in range(L):
+ result.append(float(int(2*random.random()-1)))
+ return tuple(result)
+
+
+def reference_filter_ccc(dec, taps, input):
+ """
+ compute result using conventional fir filter
+ """
+ tb = gr.top_block()
+ #src = gr.vector_source_c(((0,) * (len(taps) - 1)) + input)
+ src = gr.vector_source_c(input)
+ op = filter.fir_filter_ccc(dec, taps)
+ dst = gr.vector_sink_c()
+ tb.connect(src, op, dst)
+ tb.run()
+ return dst.data()
+
+def reference_filter_fff(dec, taps, input):
+ """
+ compute result using conventional fir filter
+ """
+ tb = gr.top_block()
+ #src = gr.vector_source_f(((0,) * (len(taps) - 1)) + input)
+ src = gr.vector_source_f(input)
+ op = filter.fir_filter_fff(dec, taps)
+ dst = gr.vector_sink_f()
+ tb.connect(src, op, dst)
+ tb.run()
+ return dst.data()
+
+
+def print_complex(x):
+ for i in x:
+ i = complex(i)
+ sys.stdout.write("(%6.3f,%6.3fj), " % (i.real, i.imag))
+ sys.stdout.write('\n')
+
+
+class test_fft_filter(gr_unittest.TestCase):
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def assert_fft_ok2(self, expected_result, result_data):
+ expected_result = expected_result[:len(result_data)]
+ self.assertComplexTuplesAlmostEqual2 (expected_result, result_data,
+ abs_eps=1e-9, rel_eps=4e-4)
+
+ def assert_fft_float_ok2(self, expected_result, result_data, abs_eps=1e-9, rel_eps=4e-4):
+ expected_result = expected_result[:len(result_data)]
+ self.assertFloatTuplesAlmostEqual2 (expected_result, result_data,
+ abs_eps, rel_eps)
+
+ def test_ccc_001(self):
+ tb = gr.top_block()
+ src_data = (0,1,2,3,4,5,6,7)
+ taps = (1,)
+ expected_result = tuple([complex(x) for x in (0,1,2,3,4,5,6,7)])
+ src = gr.vector_source_c(src_data)
+ op = filter.fft_filter_ccc(1, taps)
+ dst = gr.vector_sink_c()
+ tb.connect(src, op, dst)
+ tb.run()
+ result_data = dst.data()
+ #print 'expected:', expected_result
+ #print 'results: ', result_data
+ self.assertComplexTuplesAlmostEqual (expected_result, result_data, 5)
+
+
+ def test_ccc_002(self):
+ # Test nthreads
+ tb = gr.top_block()
+ src_data = (0,1,2,3,4,5,6,7)
+ taps = (2,)
+ nthreads = 2
+ expected_result = tuple([2 * complex(x) for x in (0,1,2,3,4,5,6,7)])
+ src = gr.vector_source_c(src_data)
+ op = filter.fft_filter_ccc(1, taps, nthreads)
+ dst = gr.vector_sink_c()
+ tb.connect(src, op, dst)
+ tb.run()
+ result_data = dst.data()
+ #print 'expected:', expected_result
+ #print 'results: ', result_data
+ self.assertComplexTuplesAlmostEqual (expected_result, result_data, 5)
+
+ def test_ccc_003(self):
+ tb = gr.top_block()
+ src_data = (0,1,2,3,4,5,6,7)
+ taps = (2,)
+ expected_result = tuple([2 * complex(x) for x in (0,1,2,3,4,5,6,7)])
+ src = gr.vector_source_c(src_data)
+ op = filter.fft_filter_ccc(1, taps)
+ dst = gr.vector_sink_c()
+ tb.connect(src, op, dst)
+ tb.run()
+ result_data = dst.data()
+ #print 'expected:', expected_result
+ #print 'results: ', result_data
+ self.assertComplexTuplesAlmostEqual (expected_result, result_data, 5)
+
+
+ def test_ccc_004(self):
+ random.seed(0)
+ for i in xrange(25):
+ # sys.stderr.write("\n>>> Loop = %d\n" % (i,))
+ src_len = 4*1024
+ src_data = make_random_complex_tuple(src_len)
+ ntaps = int(random.uniform(2, 1000))
+ taps = make_random_complex_tuple(ntaps)
+ expected_result = reference_filter_ccc(1, taps, src_data)
+
+ src = gr.vector_source_c(src_data)
+ op = filter.fft_filter_ccc(1, taps)
+ dst = gr.vector_sink_c()
+ tb = gr.top_block()
+ tb.connect(src, op, dst)
+ tb.run()
+ result_data = dst.data()
+ del tb
+ self.assert_fft_ok2(expected_result, result_data)
+
+ def test_ccc_005(self):
+ random.seed(0)
+ for i in xrange(25):
+ # sys.stderr.write("\n>>> Loop = %d\n" % (i,))
+ dec = i + 1
+ src_len = 4*1024
+ src_data = make_random_complex_tuple(src_len)
+ ntaps = int(random.uniform(2, 100))
+ taps = make_random_complex_tuple(ntaps)
+ expected_result = reference_filter_ccc(dec, taps, src_data)
+
+ src = gr.vector_source_c(src_data)
+ op = filter.fft_filter_ccc(dec, taps)
+ dst = gr.vector_sink_c()
+ tb = gr.top_block()
+ tb.connect(src, op, dst)
+ tb.run()
+ del tb
+ result_data = dst.data()
+
+ self.assert_fft_ok2(expected_result, result_data)
+
+ def test_ccc_006(self):
+ # Test decimating with nthreads=2
+ random.seed(0)
+ nthreads = 2
+ for i in xrange(25):
+ # sys.stderr.write("\n>>> Loop = %d\n" % (i,))
+ dec = i + 1
+ src_len = 4*1024
+ src_data = make_random_complex_tuple(src_len)
+ ntaps = int(random.uniform(2, 100))
+ taps = make_random_complex_tuple(ntaps)
+ expected_result = reference_filter_ccc(dec, taps, src_data)
+
+ src = gr.vector_source_c(src_data)
+ op = filter.fft_filter_ccc(dec, taps, nthreads)
+ dst = gr.vector_sink_c()
+ tb = gr.top_block()
+ tb.connect(src, op, dst)
+ tb.run()
+ del tb
+ result_data = dst.data()
+
+ self.assert_fft_ok2(expected_result, result_data)
+
+ # ----------------------------------------------------------------
+ # test _fff version
+ # ----------------------------------------------------------------
+
+ def test_fff_001(self):
+ tb = gr.top_block()
+ src_data = (0,1,2,3,4,5,6,7)
+ taps = (1,)
+ expected_result = tuple([float(x) for x in (0,1,2,3,4,5,6,7)])
+ src = gr.vector_source_f(src_data)
+ op = filter.fft_filter_fff(1, taps)
+ dst = gr.vector_sink_f()
+ tb.connect(src, op, dst)
+ tb.run()
+ result_data = dst.data()
+ #print 'expected:', expected_result
+ #print 'results: ', result_data
+ self.assertFloatTuplesAlmostEqual (expected_result, result_data, 5)
+
+
+ def test_fff_002(self):
+ tb = gr.top_block()
+ src_data = (0,1,2,3,4,5,6,7)
+ taps = (2,)
+ expected_result = tuple([2 * float(x) for x in (0,1,2,3,4,5,6,7)])
+ src = gr.vector_source_f(src_data)
+ op = filter.fft_filter_fff(1, taps)
+ dst = gr.vector_sink_f()
+ tb.connect(src, op, dst)
+ tb.run()
+ result_data = dst.data()
+ #print 'expected:', expected_result
+ #print 'results: ', result_data
+ self.assertFloatTuplesAlmostEqual (expected_result, result_data, 5)
+
+ def test_fff_003(self):
+ # Test 02 with nthreads
+ tb = gr.top_block()
+ src_data = (0,1,2,3,4,5,6,7)
+ taps = (2,)
+ nthreads = 2
+ expected_result = tuple([2 * float(x) for x in (0,1,2,3,4,5,6,7)])
+ src = gr.vector_source_f(src_data)
+ op = filter.fft_filter_fff(1, taps, nthreads)
+ dst = gr.vector_sink_f()
+ tb.connect(src, op, dst)
+ tb.run()
+ result_data = dst.data()
+ self.assertFloatTuplesAlmostEqual (expected_result, result_data, 5)
+
+ def xtest_fff_004(self):
+ random.seed(0)
+ for i in xrange(25):
+ sys.stderr.write("\n>>> Loop = %d\n" % (i,))
+ src_len = 4096
+ src_data = make_random_float_tuple(src_len)
+ ntaps = int(random.uniform(2, 1000))
+ taps = make_random_float_tuple(ntaps)
+ expected_result = reference_filter_fff(1, taps, src_data)
+
+ src = gr.vector_source_f(src_data)
+ op = filter.fft_filter_fff(1, taps)
+ dst = gr.vector_sink_f()
+ tb = gr.top_block()
+ tb.connect(src, op, dst)
+ tb.run()
+ result_data = dst.data()
+
+ #print "src_len =", src_len, " ntaps =", ntaps
+ try:
+ self.assert_fft_float_ok2(expected_result, result_data, abs_eps=1.0)
+ except:
+ expected = open('expected', 'w')
+ for x in expected_result:
+ expected.write(`x` + '\n')
+ actual = open('actual', 'w')
+ for x in result_data:
+ actual.write(`x` + '\n')
+ raise
+
+ def xtest_fff_005(self):
+ random.seed(0)
+ for i in xrange(25):
+ sys.stderr.write("\n>>> Loop = %d\n" % (i,))
+ src_len = 4*1024
+ src_data = make_random_float_tuple(src_len)
+ ntaps = int(random.uniform(2, 1000))
+ taps = make_random_float_tuple(ntaps)
+ expected_result = reference_filter_fff(1, taps, src_data)
+
+ src = gr.vector_source_f(src_data)
+ op = filter.fft_filter_fff(1, taps)
+ dst = gr.vector_sink_f()
+ tb = gr.top_block()
+ tb.connect(src, op, dst)
+ tb.run()
+ result_data = dst.data()
+
+ self.assert_fft_float_ok2(expected_result, result_data, abs_eps=2.0)
+
+ def xtest_fff_006(self):
+ random.seed(0)
+ for i in xrange(25):
+ sys.stderr.write("\n>>> Loop = %d\n" % (i,))
+ dec = i + 1
+ src_len = 4*1024
+ src_data = make_random_float_tuple(src_len)
+ ntaps = int(random.uniform(2, 100))
+ taps = make_random_float_tuple(ntaps)
+ expected_result = reference_filter_fff(dec, taps, src_data)
+
+ src = gr.vector_source_f(src_data)
+ op = filter.fft_filter_fff(dec, taps)
+ dst = gr.vector_sink_f()
+ tb = gr.top_block()
+ tb.connect(src, op, dst)
+ tb.run()
+ result_data = dst.data()
+
+ self.assert_fft_float_ok2(expected_result, result_data)
+
+ def xtest_fff_007(self):
+ # test decimation with nthreads
+ random.seed(0)
+ nthreads = 2
+ for i in xrange(25):
+ sys.stderr.write("\n>>> Loop = %d\n" % (i,))
+ dec = i + 1
+ src_len = 4*1024
+ src_data = make_random_float_tuple(src_len)
+ ntaps = int(random.uniform(2, 100))
+ taps = make_random_float_tuple(ntaps)
+ expected_result = reference_filter_fff(dec, taps, src_data)
+
+ src = gr.vector_source_f(src_data)
+ op = filter.fft_filter_fff(dec, taps, nthreads)
+ dst = gr.vector_sink_f()
+ tb = gr.top_block()
+ tb.connect(src, op, dst)
+ tb.run()
+ result_data = dst.data()
+
+ self.assert_fft_float_ok2(expected_result, result_data)
+
+ def test_fff_get0(self):
+ random.seed(0)
+ for i in xrange(25):
+ ntaps = int(random.uniform(2, 100))
+ taps = make_random_float_tuple(ntaps)
+
+ op = filter.fft_filter_fff(1, taps)
+ result_data = op.taps()
+ #print result_data
+
+ self.assertEqual(taps, result_data)
+
+ def test_ccc_get0(self):
+ random.seed(0)
+ for i in xrange(25):
+ ntaps = int(random.uniform(2, 100))
+ taps = make_random_complex_tuple(ntaps)
+
+ op = filter.fft_filter_ccc(1, taps)
+ result_data = op.taps()
+ #print result_data
+
+ self.assertComplexTuplesAlmostEqual(taps, result_data, 4)
+
+
+if __name__ == '__main__':
+ gr_unittest.run(test_fft_filter, "test_fft_filter.xml")
+
diff --git a/gr-filter/python/qa_filter_delay_fc.py b/gr-filter/python/qa_filter_delay_fc.py
new file mode 100755
index 000000000..57b063e7b
--- /dev/null
+++ b/gr-filter/python/qa_filter_delay_fc.py
@@ -0,0 +1,318 @@
+#!/usr/bin/env python
+#
+# Copyright 2004,2007,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.
+#
+
+from gnuradio import gr, gr_unittest
+import filter_swig as filter
+import math
+
+class test_filter_delay_fc(gr_unittest.TestCase):
+
+ def setUp(self):
+ self.tb = gr.top_block()
+
+ def tearDown(self):
+ self.tb = None
+
+ def test_001_filter_delay_one_input(self):
+
+ # expected result
+ expected_result = ( -1.4678005338941702e-11j,
+ -0.0011950774351134896j,
+ -0.0019336787518113852j,
+ -0.0034673355985432863j,
+ -0.0036765895783901215j,
+ -0.004916108213365078j,
+ -0.0042778430506587029j,
+ -0.006028641015291214j,
+ -0.005476709920912981j,
+ -0.0092810001224279404j,
+ -0.0095402700826525688j,
+ -0.016060983762145042j,
+ -0.016446959227323532j,
+ -0.02523401565849781j,
+ -0.024382550269365311j,
+ -0.035477779805660248j,
+ -0.033021725714206696j,
+ -0.048487484455108643j,
+ -0.04543270543217659j,
+ -0.069477587938308716j,
+ -0.066984444856643677j,
+ -0.10703597217798233j,
+ -0.10620346665382385j,
+ -0.1852707713842392j,
+ -0.19357112050056458j,
+ (7.2191945754696007e-09 -0.50004088878631592j),
+ (0.58778399229049683 -0.6155126690864563j),
+ (0.95105588436126709 -0.12377222627401352j),
+ (0.95105588436126709 +0.41524654626846313j),
+ (0.5877838134765625 +0.91611981391906738j),
+ (5.8516356205018383e-09 +1.0670661926269531j),
+ (-0.5877840518951416 +0.87856143712997437j),
+ (-0.95105588436126709 +0.35447561740875244j),
+ (-0.95105588436126709 -0.26055556535720825j),
+ (-0.5877838134765625 -0.77606213092803955j),
+ (-8.7774534307527574e-09 -0.96460390090942383j),
+ (0.58778399229049683 -0.78470128774642944j),
+ (0.95105588436126709 -0.28380891680717468j),
+ (0.95105588436126709 +0.32548999786376953j),
+ (0.5877838134765625 +0.82514488697052002j),
+ (1.4629089051254596e-08 +1.0096219778060913j),
+ (-0.5877840518951416 +0.81836479902267456j),
+ (-0.95105588436126709 +0.31451958417892456j),
+ (-0.95105588436126709 -0.3030143678188324j),
+ (-0.5877838134765625 -0.80480599403381348j),
+ (-1.7554906861505515e-08 -0.99516552686691284j),
+ (0.58778399229049683 -0.80540722608566284j),
+ (0.95105582475662231 -0.30557557940483093j),
+ (0.95105588436126709 +0.31097668409347534j),
+ (0.5877838134765625 +0.81027895212173462j),
+ (2.3406542482007353e-08 +1.0000816583633423j),
+ (-0.5877840518951416 +0.80908381938934326j),
+ (-0.95105588436126709 +0.30904293060302734j),
+ (-0.95105588436126709 -0.30904296040534973j),
+ (-0.5877838134765625 -0.80908387899398804j),
+ (-2.6332360292258272e-08 -1.0000815391540527j),
+ (0.58778399229049683 -0.80908381938934326j),
+ (0.95105582475662231 -0.30904299020767212j),
+ (0.95105588436126709 +0.30904293060302734j),
+ (0.5877838134765625 +0.80908381938934326j),
+ (3.218399768911695e-08 +1.0000815391540527j))
+
+ tb = self.tb
+
+ sampling_freq = 100
+
+ ntaps = 51
+ src1 = gr.sig_source_f(sampling_freq, gr.GR_SIN_WAVE,
+ sampling_freq * 0.10, 1.0)
+ head = gr.head(gr.sizeof_float, int(ntaps + sampling_freq * 0.10))
+ dst2 = gr.vector_sink_c()
+
+ # calculate taps
+ taps = filter.firdes_hilbert(ntaps)
+ hd = filter.filter_delay_fc(taps)
+
+ tb.connect(src1, head)
+ tb.connect(head, hd)
+ tb.connect(hd,dst2)
+
+ tb.run()
+
+ # get output
+ result_data = dst2.data()
+ self.assertComplexTuplesAlmostEqual(expected_result, result_data, 5)
+
+ def test_002_filter_delay_two_inputs(self):
+
+ # giving the same signal to both the inputs should fetch the same results
+ # as above
+
+ # expected result
+ expected_result = ( -1.4678005338941702e-11j,
+ -0.0011950774351134896j,
+ -0.0019336787518113852j,
+ -0.0034673355985432863j,
+ -0.0036765895783901215j,
+ -0.004916108213365078j,
+ -0.0042778430506587029j,
+ -0.006028641015291214j,
+ -0.005476709920912981j,
+ -0.0092810001224279404j,
+ -0.0095402700826525688j,
+ -0.016060983762145042j,
+ -0.016446959227323532j,
+ -0.02523401565849781j,
+ -0.024382550269365311j,
+ -0.035477779805660248j,
+ -0.033021725714206696j,
+ -0.048487484455108643j,
+ -0.04543270543217659j,
+ -0.069477587938308716j,
+ -0.066984444856643677j,
+ -0.10703597217798233j,
+ -0.10620346665382385j,
+ -0.1852707713842392j,
+ -0.19357112050056458j,
+ (7.2191945754696007e-09 -0.50004088878631592j),
+ (0.58778399229049683 -0.6155126690864563j),
+ (0.95105588436126709 -0.12377222627401352j),
+ (0.95105588436126709 +0.41524654626846313j),
+ (0.5877838134765625 +0.91611981391906738j),
+ (5.8516356205018383e-09 +1.0670661926269531j),
+ (-0.5877840518951416 +0.87856143712997437j),
+ (-0.95105588436126709 +0.35447561740875244j),
+ (-0.95105588436126709 -0.26055556535720825j),
+ (-0.5877838134765625 -0.77606213092803955j),
+ (-8.7774534307527574e-09 -0.96460390090942383j),
+ (0.58778399229049683 -0.78470128774642944j),
+ (0.95105588436126709 -0.28380891680717468j),
+ (0.95105588436126709 +0.32548999786376953j),
+ (0.5877838134765625 +0.82514488697052002j),
+ (1.4629089051254596e-08 +1.0096219778060913j),
+ (-0.5877840518951416 +0.81836479902267456j),
+ (-0.95105588436126709 +0.31451958417892456j),
+ (-0.95105588436126709 -0.3030143678188324j),
+ (-0.5877838134765625 -0.80480599403381348j),
+ (-1.7554906861505515e-08 -0.99516552686691284j),
+ (0.58778399229049683 -0.80540722608566284j),
+ (0.95105582475662231 -0.30557557940483093j),
+ (0.95105588436126709 +0.31097668409347534j),
+ (0.5877838134765625 +0.81027895212173462j),
+ (2.3406542482007353e-08 +1.0000816583633423j),
+ (-0.5877840518951416 +0.80908381938934326j),
+ (-0.95105588436126709 +0.30904293060302734j),
+ (-0.95105588436126709 -0.30904296040534973j),
+ (-0.5877838134765625 -0.80908387899398804j),
+ (-2.6332360292258272e-08 -1.0000815391540527j),
+ (0.58778399229049683 -0.80908381938934326j),
+ (0.95105582475662231 -0.30904299020767212j),
+ (0.95105588436126709 +0.30904293060302734j),
+ (0.5877838134765625 +0.80908381938934326j),
+ (3.218399768911695e-08 +1.0000815391540527j))
+
+
+ tb = self.tb
+
+ sampling_freq = 100
+ ntaps = 51
+ src1 = gr.sig_source_f(sampling_freq, gr.GR_SIN_WAVE,
+ sampling_freq * 0.10, 1.0)
+ head = gr.head(gr.sizeof_float, int(ntaps + sampling_freq * 0.10))
+ dst2 = gr.vector_sink_c()
+
+
+ # calculate taps
+ taps = filter.firdes_hilbert(ntaps)
+ hd = filter.filter_delay_fc(taps)
+
+ tb.connect(src1, head)
+ tb.connect(head, (hd,0))
+ tb.connect(head, (hd,1))
+ tb.connect(hd,dst2)
+ tb.run()
+
+ # get output
+ result_data = dst2.data()
+
+ self.assertComplexTuplesAlmostEqual(expected_result, result_data, 5)
+
+
+ def test_003_filter_delay_two_inputs(self):
+
+ # give two different inputs
+
+ # expected result
+ expected_result = ( -0.0020331963896751404j,
+ -0.0016448829555884004j,
+ -0.0032375147566199303j,
+ -0.0014826074475422502j,
+ -0.0033034090884029865j,
+ -0.00051144487224519253j,
+ -0.0043686260469257832j,
+ -0.0010198024101555347j,
+ -0.0082517862319946289j,
+ -0.003456643782556057j,
+ -0.014193611219525337j,
+ -0.005875137634575367j,
+ -0.020293503999710083j,
+ -0.0067503536120057106j,
+ -0.026798896491527557j,
+ -0.0073488112539052963j,
+ -0.037041611969470978j,
+ -0.010557252913713455j,
+ -0.055669989436864853j,
+ -0.018332764506340027j,
+ -0.089904911816120148j,
+ -0.033361352980136871j,
+ -0.16902604699134827j,
+ -0.074318811297416687j,
+ -0.58429563045501709j,
+ (7.2191945754696007e-09 -0.35892376303672791j),
+ (0.58778399229049683 +0.63660913705825806j),
+ (0.95105588436126709 +0.87681591510772705j),
+ (0.95105588436126709 +0.98705857992172241j),
+ (0.5877838134765625 +0.55447429418563843j),
+ (5.8516356205018383e-09 +0.026006083935499191j),
+ (-0.5877840518951416 -0.60616838932037354j),
+ (-0.95105588436126709 -0.9311758279800415j),
+ (-0.95105588436126709 -0.96169203519821167j),
+ (-0.5877838134765625 -0.57292771339416504j),
+ (-8.7774534307527574e-09 -0.0073488391935825348j),
+ (0.58778399229049683 +0.59720659255981445j),
+ (0.95105588436126709 +0.94438445568084717j),
+ (0.95105588436126709 +0.95582199096679688j),
+ (0.5877838134765625 +0.58196049928665161j),
+ (1.4629089051254596e-08 +0.0026587247848510742j),
+ (-0.5877840518951416 -0.59129220247268677j),
+ (-0.95105588436126709 -0.94841635227203369j),
+ (-0.95105588436126709 -0.95215457677841187j),
+ (-0.5877838134765625 -0.58535969257354736j),
+ (-1.7554906861505515e-08 -0.00051158666610717773j),
+ (0.58778399229049683 +0.58867418766021729j),
+ (0.95105582475662231 +0.94965213537216187j),
+ (0.95105588436126709 +0.95050644874572754j),
+ (0.5877838134765625 +0.58619076013565063j),
+ (2.3406542482007353e-08 +1.1920928955078125e-07j),
+ (-0.5877840518951416 -0.58783555030822754j),
+ (-0.95105588436126709 -0.95113480091094971j),
+ (-0.95105588436126709 -0.95113474130630493j),
+ (-0.5877838134765625 -0.58783555030822754j),
+ (-2.6332360292258272e-08 -8.1956386566162109e-08j),
+ (0.58778399229049683 +0.58783555030822754j),
+ (0.95105582475662231 +0.95113474130630493j),
+ (0.95105588436126709 +0.95113474130630493j),
+ (0.5877838134765625 +0.58783560991287231j),
+ (3.218399768911695e-08 +1.1920928955078125e-07j))
+
+ tb = self.tb
+
+ sampling_freq = 100
+ ntaps = 51
+
+ src1 = gr.sig_source_f(sampling_freq, gr.GR_SIN_WAVE,sampling_freq * 0.10, 1.0)
+ src2 = gr.sig_source_f(sampling_freq, gr.GR_COS_WAVE,sampling_freq * 0.10, 1.0)
+
+ head1 = gr.head(gr.sizeof_float, int(ntaps + sampling_freq * 0.10))
+ head2 = gr.head(gr.sizeof_float, int(ntaps + sampling_freq * 0.10))
+
+ taps = filter.firdes_hilbert(ntaps)
+ hd = filter.filter_delay_fc(taps)
+
+ dst2 = gr.vector_sink_c()
+
+ tb.connect(src1, head1)
+ tb.connect(src2, head2)
+
+ tb.connect(head1, (hd,0))
+ tb.connect(head2, (hd,1))
+ tb.connect(hd, dst2)
+
+ tb.run()
+
+ # get output
+ result_data = dst2.data()
+
+ self.assertComplexTuplesAlmostEqual(expected_result, result_data, 5)
+
+
+if __name__ == '__main__':
+ gr_unittest.run(test_filter_delay_fc, "test_filter_delay_fc.xml")
diff --git a/gr-filter/python/qa_fir_filter.py b/gr-filter/python/qa_fir_filter.py
new file mode 100755
index 000000000..2a61498a2
--- /dev/null
+++ b/gr-filter/python/qa_fir_filter.py
@@ -0,0 +1,318 @@
+#!/usr/bin/env python
+#
+# Copyright 2008,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 this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+
+from gnuradio import gr, gr_unittest
+import filter_swig as filter
+
+class test_filter(gr_unittest.TestCase):
+
+ def setUp(self):
+ self.tb = gr.top_block ()
+
+ def tearDown(self):
+ self.tb = None
+
+ def test_fir_filter_fff_001(self):
+ src_data = 40*[1, 2, 3, 4]
+ expected_data = (0.5, 1.5, 3.0, 5.0, 5.5, 6.5, 8.0, 10.0,
+ 10.5, 11.5, 13.0, 15.0, 15.5, 16.5, 18.0,
+ 20.0, 20.5, 21.5, 23.0, 25.0, 25.5, 26.5,
+ 28.0, 30.0, 30.5, 31.5, 33.0, 35.0, 35.5,
+ 36.5, 38.0, 40.0, 40.5, 41.5, 43.0, 45.0,
+ 45.5, 46.5, 48.0, 50.0, 50.0, 50.0, 50.0,
+ 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0,
+ 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0,
+ 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0,
+ 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0,
+ 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0,
+ 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0,
+ 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0,
+ 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0,
+ 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0,
+ 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0,
+ 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0,
+ 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0,
+ 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0,
+ 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0,
+ 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0,
+ 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0,
+ 50.0, 50.0, 50.0, 50.0, 50.0)
+ src = gr.vector_source_f(src_data)
+ op = filter.fir_filter_fff(1, 20*[0.5, 0.5])
+ dst = gr.vector_sink_f()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ result_data = dst.data()
+ self.assertFloatTuplesAlmostEqual(expected_data, result_data, 5)
+
+ def test_fir_filter_fff_002(self):
+ src_data = 40*[1, 2, 3, 4]
+ expected_data = (0.5, 5.5, 10.5, 15.5, 20.5, 25.5, 30.5, 35.5,
+ 40.5, 45.5, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0,
+ 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0,
+ 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0,
+ 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0)
+ src = gr.vector_source_f(src_data)
+ op = filter.fir_filter_fff(4, 20*[0.5, 0.5])
+ dst = gr.vector_sink_f()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ result_data = dst.data()
+ self.assertFloatTuplesAlmostEqual(expected_data, result_data, 5)
+
+ def test_fir_filter_ccf_001(self):
+ src_data = 40*[1+1j, 2+2j, 3+3j, 4+4j]
+ expected_data = ((0.5+0.5j), (1.5+1.5j), (3+3j), (5+5j), (5.5+5.5j),
+ (6.5+6.5j), (8+8j), (10+10j), (10.5+10.5j), (11.5+11.5j),
+ (13+13j), (15+15j), (15.5+15.5j), (16.5+16.5j), (18+18j),
+ (20+20j), (20.5+20.5j), (21.5+21.5j), (23+23j), (25+25j),
+ (25.5+25.5j), (26.5+26.5j), (28+28j), (30+30j), (30.5+30.5j),
+ (31.5+31.5j), (33+33j), (35+35j), (35.5+35.5j), (36.5+36.5j),
+ (38+38j), (40+40j), (40.5+40.5j), (41.5+41.5j), (43+43j),
+ (45+45j), (45.5+45.5j), (46.5+46.5j), (48+48j), (50+50j),
+ (50+50j), (50+50j), (50+50j), (50+50j), (50+50j), (50+50j),
+ (50+50j), (50+50j), (50+50j), (50+50j), (50+50j), (50+50j),
+ (50+50j), (50+50j), (50+50j), (50+50j), (50+50j), (50+50j),
+ (50+50j), (50+50j), (50+50j), (50+50j), (50+50j), (50+50j),
+ (50+50j), (50+50j), (50+50j), (50+50j), (50+50j), (50+50j),
+ (50+50j), (50+50j), (50+50j), (50+50j), (50+50j), (50+50j),
+ (50+50j), (50+50j), (50+50j), (50+50j), (50+50j), (50+50j),
+ (50+50j), (50+50j), (50+50j), (50+50j), (50+50j), (50+50j),
+ (50+50j), (50+50j), (50+50j), (50+50j), (50+50j), (50+50j),
+ (50+50j), (50+50j), (50+50j), (50+50j), (50+50j), (50+50j),
+ (50+50j), (50+50j), (50+50j), (50+50j), (50+50j), (50+50j),
+ (50+50j), (50+50j), (50+50j), (50+50j), (50+50j), (50+50j),
+ (50+50j), (50+50j), (50+50j), (50+50j), (50+50j), (50+50j),
+ (50+50j), (50+50j), (50+50j), (50+50j), (50+50j), (50+50j),
+ (50+50j), (50+50j), (50+50j), (50+50j), (50+50j), (50+50j),
+ (50+50j), (50+50j), (50+50j), (50+50j), (50+50j), (50+50j),
+ (50+50j), (50+50j), (50+50j), (50+50j), (50+50j), (50+50j),
+ (50+50j), (50+50j), (50+50j), (50+50j), (50+50j), (50+50j),
+ (50+50j), (50+50j), (50+50j), (50+50j), (50+50j), (50+50j),
+ (50+50j), (50+50j), (50+50j), (50+50j), (50+50j), (50+50j))
+
+ src = gr.vector_source_c(src_data)
+ op = filter.fir_filter_ccf(1, 20*[0.5, 0.5])
+ dst = gr.vector_sink_c()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ result_data = dst.data()
+ self.assertComplexTuplesAlmostEqual(expected_data, result_data, 5)
+
+ def test_fir_filter_ccf_002(self):
+ src_data = 40*[1+1j, 2+2j, 3+3j, 4+4j]
+ expected_data = ((0.5+0.5j), (5.5+5.5j), (10.5+10.5j), (15.5+15.5j),
+ (20.5+20.5j), (25.5+25.5j), (30.5+30.5j), (35.5+35.5j),
+ (40.5+40.5j), (45.5+45.5j), (50+50j), (50+50j), (50+50j),
+ (50+50j), (50+50j), (50+50j), (50+50j), (50+50j), (50+50j),
+ (50+50j), (50+50j), (50+50j), (50+50j), (50+50j), (50+50j),
+ (50+50j), (50+50j), (50+50j), (50+50j), (50+50j), (50+50j),
+ (50+50j), (50+50j), (50+50j), (50+50j), (50+50j),
+ (50+50j), (50+50j), (50+50j), (50+50j))
+
+ src = gr.vector_source_c(src_data)
+ op = filter.fir_filter_ccf(4, 20*[0.5, 0.5])
+ dst = gr.vector_sink_c()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ result_data = dst.data()
+ self.assertComplexTuplesAlmostEqual(expected_data, result_data, 5)
+
+ def test_fir_filter_ccc_001(self):
+ src_data = 40*[1+1j, 2+2j, 3+3j, 4+4j]
+ expected_data = ((-0.5+1.5j), (-1.5+4.5j), (-3+9j), (-5+15j),
+ (-5.5+16.5j), (-6.5+19.5j), (-8+24j), (-10+30j),
+ (-10.5+31.5j), (-11.5+34.5j), (-13+39j), (-15+45j),
+ (-15.5+46.5j), (-16.5+49.5j), (-18+54j), (-20+60j),
+ (-20.5+61.5j), (-21.5+64.5j), (-23+69j), (-25+75j),
+ (-25.5+76.5j), (-26.5+79.5j), (-28+84j), (-30+90j),
+ (-30.5+91.5j), (-31.5+94.5j), (-33+99j), (-35+105j),
+ (-35.5+106.5j), (-36.5+109.5j), (-38+114j), (-40+120j),
+ (-40.5+121.5j), (-41.5+124.5j), (-43+129j), (-45+135j),
+ (-45.5+136.5j), (-46.5+139.5j), (-48+144j), (-50+150j),
+ (-50+150j), (-50+150j), (-50+150j), (-50+150j), (-50+150j),
+ (-50+150j), (-50+150j), (-50+150j), (-50+150j), (-50+150j),
+ (-50+150j), (-50+150j), (-50+150j), (-50+150j), (-50+150j),
+ (-50+150j), (-50+150j), (-50+150j), (-50+150j), (-50+150j),
+ (-50+150j), (-50+150j), (-50+150j), (-50+150j), (-50+150j),
+ (-50+150j), (-50+150j), (-50+150j), (-50+150j), (-50+150j),
+ (-50+150j), (-50+150j), (-50+150j), (-50+150j), (-50+150j),
+ (-50+150j), (-50+150j), (-50+150j), (-50+150j), (-50+150j),
+ (-50+150j), (-50+150j), (-50+150j), (-50+150j), (-50+150j),
+ (-50+150j), (-50+150j), (-50+150j), (-50+150j), (-50+150j),
+ (-50+150j), (-50+150j), (-50+150j), (-50+150j), (-50+150j),
+ (-50+150j), (-50+150j), (-50+150j), (-50+150j), (-50+150j),
+ (-50+150j), (-50+150j), (-50+150j), (-50+150j), (-50+150j),
+ (-50+150j), (-50+150j), (-50+150j), (-50+150j), (-50+150j),
+ (-50+150j), (-50+150j), (-50+150j), (-50+150j), (-50+150j),
+ (-50+150j), (-50+150j), (-50+150j), (-50+150j), (-50+150j),
+ (-50+150j), (-50+150j), (-50+150j), (-50+150j), (-50+150j),
+ (-50+150j), (-50+150j), (-50+150j), (-50+150j), (-50+150j),
+ (-50+150j), (-50+150j), (-50+150j), (-50+150j), (-50+150j),
+ (-50+150j), (-50+150j), (-50+150j), (-50+150j), (-50+150j),
+ (-50+150j), (-50+150j), (-50+150j), (-50+150j), (-50+150j),
+ (-50+150j), (-50+150j), (-50+150j), (-50+150j), (-50+150j),
+ (-50+150j), (-50+150j), (-50+150j), (-50+150j), (-50+150j),
+ (-50+150j), (-50+150j), (-50+150j), (-50+150j), (-50+150j))
+ src = gr.vector_source_c(src_data)
+ op = filter.fir_filter_ccc(1, 20*[0.5+1j, 0.5+1j])
+ dst = gr.vector_sink_c()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ result_data = dst.data()
+ self.assertComplexTuplesAlmostEqual(expected_data, result_data, 5)
+
+
+ def test_fir_filter_ccc_002(self):
+ src_data = 10*[1+1j, 2+2j, 3+3j, 4+4j]
+
+ # results derived from original gr.fir_filter_ccc
+ expected_data = ((7.537424837948042e-20+7.537424837948042e-20j), (9.131923434324563e-05+9.131923434324563e-05j), (0.0003317668742965907+0.0003317668742965907j), (0.0007230418268591166+0.0007230418268591166j), (0.0012087896466255188+0.0012087896466255188j), (0.0013292605290189385+0.0013292605290189385j), (0.001120875240303576+0.001120875240303576j), (0.000744672492146492+0.000744672492146492j), (0.000429437990533188+0.000429437990533188j), (2.283908543176949e-05+2.283908543176949e-05j), (-0.0002245186478830874-0.0002245186478830874j), (-0.0001157080550910905-0.0001157080550910905j), (0.00041409023106098175+0.00041409023106098175j), (0.0009017843985930085+0.0009017843985930085j), (0.0012520025484263897+0.0012520025484263897j), (0.0014116164529696107+0.0014116164529696107j), (0.001393353333696723+0.001393353333696723j), (0.000912194955162704+0.000912194955162704j), (0.00022649182938039303+0.00022649182938039303j), (-0.00031363096786662936-0.00031363096786662936j), (-0.0003966730728279799-0.0003966730728279799j), (-0.00023757052258588374-0.00023757052258588374j), (0.00021952332463115454+0.00021952332463115454j), (0.0009092430118471384+0.0009092430118471384j), (0.001662317430600524+0.001662317430600524j), (0.0019024648936465383+0.0019024648936465383j), (0.0015955769922584295+0.0015955769922584295j), (0.0009144138311967254+0.0009144138311967254j), (0.0001872836146503687+0.0001872836146503687j), (-0.000581968342885375-0.000581968342885375j), (-0.0009886166080832481-0.0009886166080832481j), (-0.0007480768254026771-0.0007480768254026771j), (0.00018211957649327815+0.00018211957649327815j), (0.0012042406015098095+0.0012042406015098095j), (0.0020200139842927456+0.0020200139842927456j), (0.0023816542234271765+0.0023816542234271765j), (0.002195809967815876+0.002195809967815876j), (0.0012113333214074373+0.0012113333214074373j), (-0.00014088614261709154-0.00014088614261709154j), (-0.0012574587017297745-0.0012574587017297745j))
+
+ taps = filter.firdes.low_pass(1, 1, 0.1, 0.01)
+ src = gr.vector_source_c(src_data)
+ op = filter.fir_filter_ccc(1, taps)
+ dst = gr.vector_sink_c()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ result_data = dst.data()
+ self.assertComplexTuplesAlmostEqual(expected_data, result_data, 5)
+
+ def test_fir_filter_ccc_003(self):
+ src_data = 40*[1+1j, 2+2j, 3+3j, 4+4j]
+ expected_data = ((-0.5+1.5j), (-5.5+16.5j), (-10.5+31.5j),
+ (-15.5+46.5j), (-20.5+61.5j), (-25.5+76.5j),
+ (-30.5+91.5j), (-35.5+106.5j), (-40.5+121.5j),
+ (-45.5+136.5j), (-50+150j), (-50+150j), (-50+150j),
+ (-50+150j), (-50+150j), (-50+150j), (-50+150j),
+ (-50+150j), (-50+150j), (-50+150j), (-50+150j),
+ (-50+150j), (-50+150j), (-50+150j), (-50+150j),
+ (-50+150j), (-50+150j), (-50+150j), (-50+150j),
+ (-50+150j), (-50+150j), (-50+150j), (-50+150j),
+ (-50+150j), (-50+150j), (-50+150j), (-50+150j),
+ (-50+150j), (-50+150j), (-50+150j))
+ src = gr.vector_source_c(src_data)
+ op = filter.fir_filter_ccc(4, 20*[0.5+1j, 0.5+1j])
+ dst = gr.vector_sink_c()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ result_data = dst.data()
+ self.assertComplexTuplesAlmostEqual(expected_data, result_data, 5)
+
+
+ def test_fir_filter_scc_001(self):
+ src_data = 40*[1, 2, 3, 4]
+ expected_data = ((0.5+1j), (1.5+3j), (3+6j), (5+10j), (5.5+11j),
+ (6.5+13j), (8+16j), (10+20j), (10.5+21j), (11.5+23j),
+ (13+26j), (15+30j), (15.5+31j), (16.5+33j), (18+36j),
+ (20+40j), (20.5+41j), (21.5+43j), (23+46j), (25+50j),
+ (25.5+51j), (26.5+53j), (28+56j), (30+60j), (30.5+61j),
+ (31.5+63j), (33+66j), (35+70j), (35.5+71j), (36.5+73j),
+ (38+76j), (40+80j), (40.5+81j), (41.5+83j), (43+86j),
+ (45+90j), (45.5+91j), (46.5+93j), (48+96j), (50+100j),
+ (50+100j), (50+100j), (50+100j), (50+100j), (50+100j),
+ (50+100j), (50+100j), (50+100j), (50+100j), (50+100j),
+ (50+100j), (50+100j), (50+100j), (50+100j), (50+100j),
+ (50+100j), (50+100j), (50+100j), (50+100j), (50+100j),
+ (50+100j), (50+100j), (50+100j), (50+100j), (50+100j),
+ (50+100j), (50+100j), (50+100j), (50+100j), (50+100j),
+ (50+100j), (50+100j), (50+100j), (50+100j), (50+100j),
+ (50+100j), (50+100j), (50+100j), (50+100j), (50+100j),
+ (50+100j), (50+100j), (50+100j), (50+100j), (50+100j),
+ (50+100j), (50+100j), (50+100j), (50+100j), (50+100j),
+ (50+100j), (50+100j), (50+100j), (50+100j), (50+100j),
+ (50+100j), (50+100j), (50+100j), (50+100j), (50+100j),
+ (50+100j), (50+100j), (50+100j), (50+100j), (50+100j),
+ (50+100j), (50+100j), (50+100j), (50+100j), (50+100j),
+ (50+100j), (50+100j), (50+100j), (50+100j), (50+100j),
+ (50+100j), (50+100j), (50+100j), (50+100j), (50+100j),
+ (50+100j), (50+100j), (50+100j), (50+100j), (50+100j),
+ (50+100j), (50+100j), (50+100j), (50+100j), (50+100j),
+ (50+100j), (50+100j), (50+100j), (50+100j), (50+100j),
+ (50+100j), (50+100j), (50+100j), (50+100j), (50+100j),
+ (50+100j), (50+100j), (50+100j), (50+100j), (50+100j),
+ (50+100j), (50+100j), (50+100j), (50+100j), (50+100j),
+ (50+100j), (50+100j), (50+100j), (50+100j), (50+100j),
+ (50+100j), (50+100j), (50+100j), (50+100j), (50+100j))
+ src = gr.vector_source_s(src_data)
+ op = filter.fir_filter_scc(1, 20*[0.5+1j, 0.5+1j])
+ dst = gr.vector_sink_c()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ result_data = dst.data()
+ self.assertComplexTuplesAlmostEqual(expected_data, result_data, 5)
+
+
+ def test_fir_filter_scc_002(self):
+ src_data = 40*[1, 2, 3, 4]
+ expected_data = ((0.5+1j), (5.5+11j), (10.5+21j), (15.5+31j), (20.5+41j),
+ (25.5+51j), (30.5+61j), (35.5+71j), (40.5+81j), (45.5+91j),
+ (50+100j), (50+100j), (50+100j), (50+100j), (50+100j),
+ (50+100j), (50+100j), (50+100j), (50+100j), (50+100j),
+ (50+100j), (50+100j), (50+100j), (50+100j), (50+100j),
+ (50+100j), (50+100j), (50+100j), (50+100j), (50+100j),
+ (50+100j), (50+100j), (50+100j), (50+100j), (50+100j),
+ (50+100j), (50+100j), (50+100j), (50+100j), (50+100j))
+ src = gr.vector_source_s(src_data)
+ op = filter.fir_filter_scc(4, 20*[0.5+1j, 0.5+1j])
+ dst = gr.vector_sink_c()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ result_data = dst.data()
+ self.assertComplexTuplesAlmostEqual(expected_data, result_data, 5)
+
+ def test_fir_filter_fsf_001(self):
+ src_data = 40*[1, 2, 3, 4]
+ expected_data =(0, 1, 3, 5, 5, 6, 8, 10, 10, 11, 13, 15, 15, 16, 18, 20, 20,
+ 21, 23, 25, 25, 26, 28, 30, 30, 31, 33, 35, 35, 36, 38, 40, 40,
+ 41, 43, 45, 45, 46, 48, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
+ 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
+ 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
+ 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
+ 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
+ 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
+ 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
+ 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50)
+ src = gr.vector_source_f(src_data)
+ op = filter.fir_filter_fsf(1, 20*[0.5, 0.5])
+ dst = gr.vector_sink_s()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ result_data = dst.data()
+ self.assertComplexTuplesAlmostEqual(expected_data, result_data, 5)
+
+
+ def test_fir_filter_fsf_002(self):
+ src_data = 40*[1, 2, 3, 4]
+ expected_data = (0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 50, 50, 50, 50,
+ 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
+ 50, 50, 50, 50, 50, 50, 50, 50, 50, 50)
+ src = gr.vector_source_f(src_data)
+ op = filter.fir_filter_fsf(4, 20*[0.5, 0.5])
+ dst = gr.vector_sink_s()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ result_data = dst.data()
+ self.assertComplexTuplesAlmostEqual(expected_data, result_data, 5)
+
+if __name__ == '__main__':
+ gr_unittest.run(test_filter, "test_filter.xml")
+
diff --git a/gr-filter/python/qa_firdes.py b/gr-filter/python/qa_firdes.py
new file mode 100755
index 000000000..cfd10435f
--- /dev/null
+++ b/gr-filter/python/qa_firdes.py
@@ -0,0 +1,202 @@
+#!/usr/bin/env python
+#
+# 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.
+#
+
+from gnuradio import gr, gr_unittest
+import filter_swig as filter
+import sys
+
+class test_firdes(gr_unittest.TestCase):
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def test_low_pass(self):
+ known_taps = (0.0030193300917744637, -0.004960992839187384,
+ 0.006678304169327021, -1.132049690556083e-17,
+ -0.0251916591078043, 0.07206480950117111,
+ -0.13062666356563568, 0.18007083237171173,
+ 0.7978920936584473, 0.18007083237171173,
+ -0.13062666356563568, 0.07206480950117111,
+ -0.0251916591078043, -1.132049690556083e-17,
+ 0.006678304169327021, -0.004960992839187384,
+ 0.0030193300917744637)
+ new_taps = filter.firdes.low_pass(1, 1, 0.4, 0.2)
+ self.assertFloatTuplesAlmostEqual(known_taps, new_taps, 5)
+
+ def test_low_pass_2(self):
+ known_taps = (0.0024871660862118006, -4.403502608370943e-18,
+ -0.014456653036177158, 0.0543283149600029,
+ -0.116202212870121, 0.17504146695137024,
+ 0.7976038455963135, 0.17504146695137024,
+ -0.116202212870121, 0.0543283149600029,
+ -0.014456653036177158, -4.403502608370943e-18,
+ 0.0024871660862118006)
+ new_taps = filter.firdes.low_pass_2(1, 1, 0.4, 0.2, 60)
+ self.assertFloatTuplesAlmostEqual(known_taps, new_taps, 5)
+
+ def test_high_pass(self):
+ known_taps = (-0.003062003292143345, 0.005031108390539885,
+ -0.0067726909182965755, 1.1480492661182674e-17,
+ 0.025547700002789497, -0.0730833187699318,
+ 0.13247284293174744, -0.18261581659317017,
+ 0.20229223370552063, -0.18261581659317017,
+ 0.13247284293174744, -0.0730833187699318,
+ 0.025547700002789497, 1.1480492661182674e-17,
+ -0.0067726909182965755, 0.005031108390539885,
+ -0.003062003292143345)
+ new_taps = filter.firdes.high_pass(1, 1, 0.4, 0.2)
+ self.assertFloatTuplesAlmostEqual(known_taps, new_taps, 5)
+
+ def test_high_pass_2(self):
+ known_taps = (-0.0027197482995688915, 4.815287179370254e-18,
+ 0.01580853760242462, -0.05940871313214302,
+ 0.1270686239004135, -0.1914101094007492,
+ 0.21804752945899963, -0.1914101094007492,
+ 0.1270686239004135, -0.05940871313214302,
+ 0.01580853760242462, 4.815287179370254e-18,
+ -0.0027197482995688915)
+ new_taps = filter.firdes.high_pass_2(1, 1, 0.4, 0.2, 60)
+ self.assertFloatTuplesAlmostEqual(known_taps, new_taps, 5)
+
+ def test_band_pass(self):
+ known_taps = (0.004961997736245394, -0.008152946829795837,
+ -0.004192151129245758, -5.749020235348687e-18,
+ 0.01581347920000553, 0.11843203753232956,
+ -0.21467317640781403, -0.11303528398275375,
+ 0.40520283579826355, -0.11303528398275375,
+ -0.21467317640781403, 0.11843203753232956,
+ 0.01581347920000553, -5.749020235348687e-18,
+ -0.004192151129245758, -0.008152946829795837,
+ 0.004961997736245394)
+ new_taps = filter.firdes.band_pass(1, 1, 0.2, 0.4, 0.2)
+ self.assertFloatTuplesAlmostEqual(known_taps, new_taps, 5)
+
+ def test_band_pass_2(self):
+ known_taps = (-0.001676854444667697, -2.4018533253972557e-18,
+ 0.009746716357767582, 0.09589414298534393,
+ -0.20510689914226532, -0.11801345646381378,
+ 0.4350462853908539, -0.11801345646381378,
+ -0.20510689914226532, 0.09589414298534393,
+ 0.009746716357767582, -2.4018533253972557e-18,
+ -0.001676854444667697)
+ new_taps = filter.firdes.band_pass_2(1, 1, 0.2, 0.4, 0.2, 60)
+ self.assertFloatTuplesAlmostEqual(known_taps, new_taps, 5)
+
+ def test_complex_band_pass(self):
+ known_taps = ((0.0024772135075181723+0.0017997993854805827j),
+ (-0.004070250317454338+0.002957213670015335j),
+ (-0.0020928815938532352-0.006441210396587849j),
+ (-2.8701231652956686e-18+2.805614574993832e-24j),
+ (0.007894645445048809-0.024297315627336502j),
+ (0.05912570655345917+0.04295721650123596j),
+ (-0.10717268288135529+0.07786571979522705j),
+ (-0.0564316064119339-0.17367789149284363j),
+ (0.20229223370552063-2.4115112751132983e-07j),
+ (-0.05643119290471077+0.17367802560329437j),
+ (-0.10717286914587021-0.07786546647548676j),
+ (0.05912560224533081-0.0429573580622673j),
+ (0.007894691079854965+0.024297300726175308j),
+ (-2.8701231652956686e-18+2.6687109203363464e-24j),
+ (-0.0020928694866597652+0.006441214121878147j),
+ (-0.004070255905389786-0.0029572059866040945j),
+ (0.0024772100150585175-0.0017998040420934558j))
+ new_taps = filter.firdes.complex_band_pass(1, 1, 0.2, 0.4, 0.2)
+ self.assertComplexTuplesAlmostEqual(known_taps, new_taps, 5)
+
+ def test_complex_band_pass_2(self):
+ known_taps = ((-0.0008404505206272006-0.0025866336654871702j),
+ (-1.2038217948425635e-18+1.1767648157397848e-24j),
+ (0.0048850891180336475-0.015034818090498447j),
+ (0.048062704503536224+0.03491950035095215j),
+ (-0.10280057787895203+0.07468919456005096j),
+ (-0.05914920195937157-0.18204176425933838j),
+ (0.21804752945899963-2.5993290364567656e-07j),
+ (-0.059148769825696945+0.18204189836978912j),
+ (-0.10280075669288635-0.07468894869089127j),
+ (0.04806262254714966-0.0349196158349514j),
+ (0.004885117989033461+0.015034808777272701j),
+ (-1.2038217948425635e-18+1.1193430388030685e-24j),
+ (-0.000840445572976023+0.002586635295301676j))
+ new_taps = filter.firdes.complex_band_pass_2(1, 1, 0.2, 0.4, 0.2, 60)
+ self.assertComplexTuplesAlmostEqual(known_taps, new_taps, 5)
+
+ def test_band_reject(self):
+ known_taps = (-0.004915320314466953, 0.008076251484453678,
+ 0.00415271520614624, 5.694938753309664e-18,
+ -0.01566472090780735, -0.11731793731451035,
+ 0.2126537412405014, 0.11197195947170258,
+ 0.6020866632461548, 0.11197195947170258,
+ 0.2126537412405014, -0.11731793731451035,
+ -0.01566472090780735, 5.694938753309664e-18,
+ 0.00415271520614624, 0.008076251484453678,
+ -0.004915320314466953)
+ new_taps = filter.firdes.band_reject(1, 1, 0.2, 0.4, 0.2)
+ self.assertFloatTuplesAlmostEqual(known_taps, new_taps, 5)
+
+ def test_band_reject_2(self):
+ known_taps = (0.0015371545450761914, 2.201753372137003e-18,
+ -0.00893471110612154, -0.08790513873100281,
+ 0.1880193054676056, 0.1081816703081131,
+ 0.5982034206390381, 0.1081816703081131,
+ 0.1880193054676056, -0.08790513873100281,
+ -0.00893471110612154, 2.201753372137003e-18,
+ 0.0015371545450761914)
+ new_taps = filter.firdes.band_reject_2(1, 1, 0.2, 0.4, 0.2, 60)
+ self.assertFloatTuplesAlmostEqual(known_taps, new_taps, 5)
+
+ def test_hilbert(self):
+ known_taps = (-0.010056184604763985, 0.0,
+ -0.08335155993700027, 0.0,
+ -0.5732954144477844, 0.0,
+ 0.5732954144477844, 0.0,
+ 0.08335155993700027, 0.0,
+ 0.010056184604763985)
+ new_taps = filter.firdes.hilbert(11)
+ self.assertFloatTuplesAlmostEqual(known_taps, new_taps, 5)
+
+ def test_root_raised_cosine(self):
+ known_taps = (-0.04609205573797226, -0.02069387212395668,
+ 0.050548505038022995, 0.14850808680057526,
+ 0.23387153446674347, 0.2677156329154968,
+ 0.23387153446674347, 0.14850808680057526,
+ 0.050548505038022995, -0.02069387212395668,
+ -0.04609205573797226)
+ new_taps = filter.firdes.root_raised_cosine(1, 4, 1, 0.35, 11)
+ self.assertFloatTuplesAlmostEqual(known_taps, new_taps, 5)
+
+ def test_gaussian(self):
+ known_taps = (0.0003600157215259969, 0.0031858310103416443,
+ 0.0182281993329525, 0.06743486225605011,
+ 0.16130395233631134, 0.24947398900985718,
+ 0.24947398900985718, 0.16130395233631134,
+ 0.06743486225605011, 0.0182281993329525,
+ 0.0031858310103416443, 0.0003600157215259969,
+ 2.630509879963938e-05)
+ new_taps = filter.firdes.gaussian(1, 4, 0.35, 13)
+ self.assertFloatTuplesAlmostEqual(known_taps, new_taps, 5)
+
+if __name__ == '__main__':
+ gr_unittest.run(test_firdes, "test_firdes.xml")
+
diff --git a/gr-filter/python/qa_fractional_interpolator.py b/gr-filter/python/qa_fractional_interpolator.py
new file mode 100755
index 000000000..9e0f685d8
--- /dev/null
+++ b/gr-filter/python/qa_fractional_interpolator.py
@@ -0,0 +1,89 @@
+#!/usr/bin/env python
+#
+# Copyright 2007,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.
+#
+
+from gnuradio import gr, gr_unittest
+import filter_swig as filter
+import math
+
+class test_fractional_resampler(gr_unittest.TestCase):
+
+ def setUp(self):
+ self.tb = gr.top_block()
+
+ def tearDown(self):
+ self.tb = None
+
+ def test_001_ff(self):
+ N = 10000 # number of samples to use
+ fs = 1000 # baseband sampling rate
+ rrate = 1.123 # resampling rate
+
+ freq = 10
+ signal = gr.sig_source_f(fs, gr.GR_SIN_WAVE, freq, 1)
+ head = gr.head(gr.sizeof_float, N)
+ op = filter.fractional_interpolator_ff(0, rrate)
+ snk = gr.vector_sink_f()
+
+ self.tb.connect(signal, head, op, snk)
+ self.tb.run()
+
+ Ntest = 5000
+ L = len(snk.data())
+ t = map(lambda x: float(x)/(fs/rrate), xrange(L))
+
+ phase = 0.1884
+ expected_data = map(lambda x: math.sin(2.*math.pi*freq*x+phase), t)
+
+ dst_data = snk.data()
+
+ self.assertFloatTuplesAlmostEqual(expected_data[-Ntest:], dst_data[-Ntest:], 3)
+
+
+ def test_002_cc(self):
+ N = 10000 # number of samples to use
+ fs = 1000 # baseband sampling rate
+ rrate = 1.123 # resampling rate
+
+ freq = 10
+ signal = gr.sig_source_c(fs, gr.GR_SIN_WAVE, freq, 1)
+ head = gr.head(gr.sizeof_gr_complex, N)
+ op = filter.fractional_interpolator_cc(0.0, rrate)
+ snk = gr.vector_sink_c()
+
+ self.tb.connect(signal, head, op, snk)
+ self.tb.run()
+
+ Ntest = 5000
+ L = len(snk.data())
+ t = map(lambda x: float(x)/(fs/rrate), xrange(L))
+
+ phase = 0.1884
+ expected_data = map(lambda x: math.cos(2.*math.pi*freq*x+phase) + \
+ 1j*math.sin(2.*math.pi*freq*x+phase), t)
+
+ dst_data = snk.data()
+
+ self.assertComplexTuplesAlmostEqual(expected_data[-Ntest:], dst_data[-Ntest:], 3)
+
+
+if __name__ == '__main__':
+ gr_unittest.run(test_fractional_resampler, "test_fractional_resampler.xml")
diff --git a/gr-filter/python/qa_freq_xlating_fir_filter.py b/gr-filter/python/qa_freq_xlating_fir_filter.py
new file mode 100755
index 000000000..ee38eb7df
--- /dev/null
+++ b/gr-filter/python/qa_freq_xlating_fir_filter.py
@@ -0,0 +1,445 @@
+#!/usr/bin/env python
+#
+# Copyright 2008,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 this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+
+from gnuradio import gr, gr_unittest
+import filter_swig as filter
+import cmath, math
+
+class test_freq_xlating_filter(gr_unittest.TestCase):
+
+ def setUp(self):
+ self.tb = gr.top_block ()
+
+ def tearDown(self):
+ self.tb = None
+
+ def generate_ccf_source(self):
+ self.fs = fs = 1
+ self.fc = fc = 0.3
+ self.bw = bw = 0.1
+ self.taps = filter.firdes.low_pass(1, fs, bw, bw/4)
+ times = xrange(100)
+ self.src_data = map(lambda t: cmath.exp(-2j*cmath.pi*fc/fs*(t/100.0)), times)
+
+ def generate_ccc_source(self):
+ self.fs = fs = 1
+ self.fc = fc = 0.3
+ self.bw = bw = 0.1
+ self.taps = filter.firdes.complex_band_pass(1, fs, -bw/2, bw/2, bw/4)
+ times = xrange(100)
+ self.src_data = map(lambda t: cmath.exp(-2j*cmath.pi*fc/fs*(t/100.0)), times)
+
+ def generate_fcf_source(self):
+ self.fs = fs = 1
+ self.fc = fc = 0.3
+ self.bw = bw = 0.1
+ self.taps = filter.firdes.low_pass(1, fs, bw, bw/4)
+ times = xrange(100)
+ self.src_data = map(lambda t: math.sin(2*cmath.pi*fc/fs*(t/100.0)), times)
+
+ def generate_fcc_source(self):
+ self.fs = fs = 1
+ self.fc = fc = 0.3
+ self.bw = bw = 0.1
+ self.taps = filter.firdes.complex_band_pass(1, fs, -bw/2, bw/2, bw/4)
+ times = xrange(100)
+ self.src_data = map(lambda t: math.sin(2*cmath.pi*fc/fs*(t/100.0)), times)
+
+ def generate_scf_source(self):
+ self.fs = fs = 1
+ self.fc = fc = 0.3
+ self.bw = bw = 0.1
+ self.taps = filter.firdes.low_pass(1, fs, bw, bw/4)
+ times = xrange(100)
+ self.src_data = map(lambda t: int(100*math.sin(2*cmath.pi*fc/fs*(t/100.0))), times)
+
+ def generate_scc_source(self):
+ self.fs = fs = 1
+ self.fc = fc = 0.3
+ self.bw = bw = 0.1
+ self.taps = filter.firdes.complex_band_pass(1, fs, -bw/2, bw/2, bw/4)
+ times = xrange(100)
+ self.src_data = map(lambda t: int(100*math.sin(2*cmath.pi*fc/fs*(t/100.0))), times)
+
+
+ def test_fir_filter_ccf_001(self):
+ self.generate_ccf_source()
+ expected_data = ((0.001697700354270637+0.004312471952289343j),
+ (0.003520616563037038-0.003014103975147009j),
+ (0.004252811893820763-0.008337559178471565j),
+ (0.0030743128154426813-0.010262271389365196j),
+ (0.0007344777695834637-0.007861139252781868j),
+ (-0.0011067686136811972-0.0028924935031682253j),
+ (-0.002371778478845954+0.0019914964213967323j),
+ (-0.003023319412022829+0.005717850290238857j),
+ (-0.0021738125942647457+0.007211698684841394j),
+ (-0.0004628606839105487+0.005501383915543556j),
+ (0.0007428556564264+0.0019867848604917526j),
+ (0.001634795218706131-0.0013514887541532516j),
+ (0.002205110155045986-0.00402155052870512j),
+ (0.0015480631263926625-0.005179159343242645j),
+ (0.00026722141774371266-0.003887997241690755j),
+ (-0.0004911854630336165-0.0013578246580436826j),
+ (-0.0011226939968764782+0.0009080552263185382j),
+ (-0.0016229727771133184+0.0028335191309452057j),
+ (-0.0010890064295381308+0.0037298379465937614j),
+ (-0.00012392725329846144+0.0027196139562875032j))
+ src = gr.vector_source_c(self.src_data)
+ op = filter.freq_xlating_fir_filter_ccf(1, self.taps, self.fc, self.fs)
+ dst = gr.vector_sink_c()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ result_data = dst.data()
+ self.assertComplexTuplesAlmostEqual(expected_data, result_data[-20:], 5)
+
+ def test_fir_filter_ccf_002(self):
+ self.generate_ccf_source()
+ expected_data = ((6.419439159799367e-05-0.0006292851758189499j),
+ (-0.00037074743886478245+0.0013245552545413375j),
+ (0.0006853155209682882-0.0023769831750541925j),
+ (-0.001427714480087161+0.002608160488307476j),
+ (0.0015907397028058767-0.000811046629678458j),
+ (-0.0004226673918310553-0.0024389736354351044j),
+ (-0.0013841050677001476+0.006231029983609915j),
+ (0.0035029184073209763-0.009738259017467499j),
+ (-0.005924836732447147+0.010320881381630898j),
+ (0.006831614300608635-0.003950652200728655j),
+ (-0.0021247887052595615-0.015604906715452671j),
+ (-0.04283163696527481+0.09995654970407486j),
+ (-0.01391829177737236+0.07924056798219681j),
+ (0.010886997915804386-0.02463012933731079j),
+ (-0.0056075905449688435+0.004998659715056419j),
+ (0.0016976913902908564+0.004312459379434586j),
+ (0.0007344821933656931-0.007861112244427204j),
+ (-0.002173811662942171+0.007211671676486731j),
+ (0.0022051059640944004-0.00402153329923749j),
+ (-0.0011226903880015016+0.0009080505697056651j))
+ src = gr.vector_source_c(self.src_data)
+ op = filter.freq_xlating_fir_filter_ccf(4, self.taps, self.fc, self.fs)
+ dst = gr.vector_sink_c()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ result_data = dst.data()
+ self.assertComplexTuplesAlmostEqual(expected_data, result_data[-20:], 5)
+
+ def test_fir_filter_ccc_001(self):
+ self.generate_ccc_source()
+ expected_data = ((0.0036842757836-0.0114002721384j),
+ (0.00324621866457-0.0108166672289j),
+ (0.00206564785913-0.00923090614378j),
+ (0.00109899020754-0.00656201224774j),
+ (0.000506619049702-0.00402844604105j),
+ (-0.000523390364833-0.00166808743961j),
+ (-0.00140534969978+0.00103991874494j),
+ (-0.00154365820345+0.00315759982914j),
+ (-0.00180402118713+0.00427215453237j),
+ (-0.00216706306674+0.00524478312582j),
+ (-0.00178848754149+0.0057489364408j),
+ (-0.00129876169376+0.00512680830434j),
+ (-0.00122803379782+0.00427244976163j),
+ (-0.000722666736692+0.00351428100839j),
+ (5.53092104383e-05+0.00207865727134j),
+ (0.000227351076319+0.000517217209563j),
+ (0.000414477253798-0.000383921898901j),
+ (0.000998671515845-0.00135387131013j),
+ (0.00104933069088-0.00243046949618j),
+ (0.000765930046327-0.0026717747096j))
+ src = gr.vector_source_c(self.src_data)
+ op = filter.freq_xlating_fir_filter_ccc(1, self.taps, self.fc, self.fs)
+ dst = gr.vector_sink_c()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ result_data = dst.data()
+ self.assertComplexTuplesAlmostEqual(expected_data, result_data[-20:], 5)
+
+ def test_fir_filter_ccc_002(self):
+ self.generate_ccc_source()
+ expected_data = ((-0.000650451984257+0.00120697380044j),
+ (-9.59713361226e-05+0.00102412770502j),
+ (0.000958710326813-0.00145424995571j),
+ (0.000901343999431-0.00290832063183j),
+ (-0.000822560978122+0.000296717538731j),
+ (-0.00211223773658+0.00519825471565j),
+ (-0.00037001183955+0.00358242215589j),
+ (0.00327983591706-0.00616005761549j),
+ (0.00356886954978-0.0117237549275j),
+ (-0.00328874029219+0.00182871113066j),
+ (-0.0139285130426+0.0320657044649j),
+ (-0.0198133718222+0.0562113076448j),
+ (-0.0157803222537+0.0530290603638j),
+ (-0.00550725404173+0.0255754813552j),
+ (0.00252919178456-0.00232240976766j),
+ (0.00368427345529-0.0114002330229j),
+ (0.000506620621309-0.00402843113989j),
+ (-0.00180401885882+0.00427213776857j),
+ (-0.00122803344857+0.00427243299782j),
+ (0.000414476031438-0.000383919978049j))
+ src = gr.vector_source_c(self.src_data)
+ op = filter.freq_xlating_fir_filter_ccc(4, self.taps, self.fc, self.fs)
+ dst = gr.vector_sink_c()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ result_data = dst.data()
+ self.assertComplexTuplesAlmostEqual(expected_data, result_data[-20:], 5)
+
+ def test_fir_filter_fcf_001(self):
+ self.generate_fcf_source()
+ expected_data = ((0.000247188087087-0.000157509770361j),
+ (-0.000155229790835-0.000246197130764j),
+ (-0.000264906557277+0.000174603672349j),
+ (6.99016964063e-05+0.000174961372977j),
+ (-5.48477692064e-05-0.0001131295503j),
+ (-0.000237467131228+0.000118011368613j),
+ (0.000136614587973+0.000229531884543j),
+ (0.000229347482673-0.000166581812664j),
+ (-0.000106010869786-0.000150042149471j),
+ (2.92293734674e-05+0.000142060467624j),
+ (0.000228707227507-9.30760797928e-05j),
+ (-0.000124306126963-0.000216641055886j),
+ (-0.000204823678359+0.00016052465071j),
+ (0.00012825592421+0.000133123627165j),
+ (-1.18284006021e-05-0.000159015646204j),
+ (-0.000219973371713+7.5438656495e-05j),
+ (0.000114713984658+0.000205190401175j),
+ (0.000185727752978-0.000154630601173j),
+ (-0.000141745767905-0.000120098840853j),
+ (-3.9850056055e-07+0.000168364742422j))
+ src = gr.vector_source_f(self.src_data)
+ op = filter.freq_xlating_fir_filter_fcf(1, self.taps, self.fc, self.fs)
+ dst = gr.vector_sink_c()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ result_data = dst.data()
+ self.assertComplexTuplesAlmostEqual(expected_data, result_data[-20:], 5)
+
+ def test_fir_filter_fcf_002(self):
+ self.generate_fcf_source()
+ expected_data = ((7.3052920925e-05-3.91741014028e-06j),
+ (3.11913172482e-05-0.000109872074972j),
+ (-0.000128646017401-3.49857727997e-05j),
+ (-5.49546712136e-05+8.96326746442e-05j),
+ (5.14321582159e-05+9.64698920143e-05j),
+ (0.000120189361041+2.4231892894e-05j),
+ (0.000100405508419-0.000223224604269j),
+ (-0.000274751859251-2.33274622587e-05j),
+ (1.52600114234e-06+0.000133301247843j),
+ (3.77224641852e-05+5.29596509296e-05j),
+ (-3.60160379387e-06+0.000247975171078j),
+ (0.00113093166146-0.000663110695314j),
+ (0.00059568521101-0.00099650840275j),
+ (-0.000475480686873+0.000250602373853j),
+ (0.000191397906747+0.000271986238658j),
+ (0.000247183139436-0.000157510468853j),
+ (-5.48357638763e-05-0.000113135029096j),
+ (-0.00010601492977-0.00015005269961j),
+ (-0.000204817260965+0.000160534662427j),
+ (0.000114742244477+0.000205190313864j))
+ src = gr.vector_source_f(self.src_data)
+ op = filter.freq_xlating_fir_filter_fcf(4, self.taps, self.fc, self.fs)
+ dst = gr.vector_sink_c()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ result_data = dst.data()
+ self.assertComplexTuplesAlmostEqual(expected_data, result_data[-20:], 5)
+
+ def test_fir_filter_fcc_001(self):
+ self.generate_fcc_source()
+ expected_data = ((-0.000337088305969+7.46004516259e-05j),
+ (-5.63409266761e-05+0.000301144464174j),
+ (9.16960561881e-05-2.89259278361e-05j),
+ (-0.000231866899412-6.25764005235e-05j),
+ (-0.000116414688819+0.000258557556663j),
+ (0.000206079319469+5.05045172758e-05j),
+ (-3.85114690289e-05-0.00019276549574j),
+ (-0.000146380873048+0.000112079876999j),
+ (0.000215423395275+0.000116706331028j),
+ (0.000136050162837-0.000232611957472j),
+ (-0.000155499437824-5.41604022146e-05j),
+ (0.000106907449663+0.00016310159117j),
+ (0.000224392410018-0.000156331108883j),
+ (-0.000131131906528-0.000172063446371j),
+ (-5.92393880652e-05+0.00016801241145j),
+ (0.000214921761653-5.32235890205e-06j),
+ (-5.96960526309e-05-0.000211164733628j),
+ (-0.000193948610104+0.000113364716526j),
+ (0.000134820176754+0.000142527525895j),
+ (4.74465123261e-05-0.000175131688593j))
+ src = gr.vector_source_f(self.src_data)
+ op = filter.freq_xlating_fir_filter_fcc(1, self.taps, self.fc, self.fs)
+ dst = gr.vector_sink_c()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ result_data = dst.data()
+ self.assertComplexTuplesAlmostEqual(expected_data, result_data[-20:], 5)
+
+ def test_fir_filter_fcc_002(self):
+ self.generate_fcc_source()
+ expected_data = ((-6.94218761055e-05-9.90489479591e-06j),
+ (-2.56973435171e-05+8.05932795629e-05j),
+ (7.01698663761e-05+7.36373840482e-05j),
+ (7.57163215894e-05-4.65324592369e-05j),
+ (-3.01657128148e-05-0.000122838056996j),
+ (-9.53659764491e-05-3.73945695173e-05j),
+ (-2.33501577895e-05+0.000109135726234j),
+ (6.65136758471e-05+0.000125709688291j),
+ (3.08501912514e-05-9.16842873266e-06j),
+ (-2.64703612629e-05-0.000135892929393j),
+ (0.000136643866426-0.000162003751029j),
+ (0.000501801609062-0.000185820827028j),
+ (0.000694551155902-0.000299874518532j),
+ (0.000424396857852-0.00038379128091j),
+ (-9.1786707344e-05-0.000242479465669j),
+ (-0.000337087287335+7.45999423089e-05j),
+ (-0.000116414521472+0.000258556567132j),
+ (0.000215422536712+0.000116706112749j),
+ (0.000224391726078-0.000156330308528j),
+ (-5.96956087975e-05-0.000211163976928j))
+ src = gr.vector_source_f(self.src_data)
+ op = filter.freq_xlating_fir_filter_fcc(4, self.taps, self.fc, self.fs)
+ dst = gr.vector_sink_c()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ result_data = dst.data()
+ self.assertComplexTuplesAlmostEqual(expected_data, result_data[-20:], 5)
+
+ def test_fir_filter_scf_001(self):
+ self.generate_scf_source()
+ expected_data = ((-0.0330070219934+0.101965591311j),
+ (-0.0484239049256+0.0872343629599j),
+ (-0.0214109234512+0.102555386722j),
+ (0.0484058149159+0.0557125210762j),
+ (0.0574690811336-0.0350844524801j),
+ (0.0365394353867-0.0802438184619j),
+ (0.0453781634569-0.130992040038j),
+ (0.00801951438189-0.214278846979j),
+ (-0.0770946145058-0.230616629124j),
+ (-0.105601429939-0.190731987357j),
+ (-0.105361394584-0.177761554718j),
+ (-0.131518915296-0.136102750897j),
+ (-0.103761836886-0.0382263250649j),
+ (-0.0167790111154+0.0152206514031j),
+ (0.0277570039034+0.0300403907895j),
+ (0.056065287441+0.0806603953242j),
+ (0.118084669113+0.104863211513j),
+ (0.128281414509+0.0677760615945j),
+ (0.0748447552323+0.0619902014732j),
+ (0.0512856245041+0.0775099247694j))
+ src = gr.vector_source_s(self.src_data)
+ op = filter.freq_xlating_fir_filter_scf(1, self.taps, self.fc, self.fs)
+ dst = gr.vector_sink_c()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ result_data = dst.data()
+ self.assertComplexTuplesAlmostEqual(expected_data, result_data[-20:], 5)
+
+ def test_fir_filter_scf_002(self):
+ self.generate_scf_source()
+ expected_data = ((0.00824625696987-1.50158575707e-05j),
+ (0.0020101047121-0.0116540221497j),
+ (-0.0126378880814-0.00259830290452j),
+ (-0.00363933457993+0.00837504956871j),
+ (0.00107023562305+0.00915473792702j),
+ (0.0169738996774+0.00422182958573j),
+ (0.00630031805485-0.025423232466j),
+ (-0.0283014029264+0.00104465708137j),
+ (0.00890890974551+0.0115978596732j),
+ (-0.0142687577754+0.00306978379376j),
+ (0.02845691517+0.0331163145602j),
+ (0.0538152232766-0.0908300876617j),
+ (-0.0843691527843-0.0956566259265j),
+ (0.0476895272732+0.0747984498739j),
+ (0.0898786485195+0.082478672266j),
+ (-0.0330070182681+0.101965606213j),
+ (0.0574697069824-0.0350842289627j),
+ (-0.0770940706134-0.230615705252j),
+ (-0.103762261569-0.0382265634835j),
+ (0.11808334291+0.104863762856j))
+ src = gr.vector_source_s(self.src_data)
+ op = filter.freq_xlating_fir_filter_scf(4, self.taps, self.fc, self.fs)
+ dst = gr.vector_sink_c()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ result_data = dst.data()
+ self.assertComplexTuplesAlmostEqual(expected_data, result_data[-20:], 5)
+
+ def test_fir_filter_scc_001(self):
+ self.generate_scc_source()
+ expected_data = ((-0.00775564694777+0.0437113791704j),
+ (0.0108830630779+0.0433648750186j),
+ (0.015553932637-0.0133284125477j),
+ (-0.0264905355871-0.0403266139328j),
+ (-0.0243480335921-0.03030154109j),
+ (-0.000327925226884-0.069333948195j),
+ (-0.0306392069906-0.107313856483j),
+ (-0.0452371090651-0.0854917764664j),
+ (-0.0108894333243-0.0875641107559j),
+ (-0.0182112380862-0.118961036205j),
+ (-0.0447825863957-0.0922874584794j),
+ (-0.0147479763255-0.0572904124856j),
+ (0.00204290449619-0.0721436738968j),
+ (-0.027713002637-0.0548989400268j),
+ (-0.0149045493454-0.00210141134448j),
+ (0.0176361314952-0.00149522523861j),
+ (-0.00527482619509-0.00698099425063j),
+ (-0.0151527002454+0.036265052855j),
+ (0.0199296213686+0.0452499426901j),
+ (0.0122985243797+0.0143278446048j))
+ src = gr.vector_source_s(self.src_data)
+ op = filter.freq_xlating_fir_filter_scc(1, self.taps, self.fc, self.fs)
+ dst = gr.vector_sink_c()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ result_data = dst.data()
+ self.assertComplexTuplesAlmostEqual(expected_data, result_data[-20:], 5)
+
+ def test_fir_filter_scc_002(self):
+ self.generate_scc_source()
+ expected_data = ((-0.0080680437386-0.00158522999845j),
+ (-0.0037795654498+0.00733159901574j),
+ (0.00842926371843+0.00777021236718j),
+ (0.0112090632319-0.00249325321056j),
+ (-0.0027476802934-0.0115710813552j),
+ (-0.0158688724041-0.00715934624895j),
+ (-0.00802888441831+0.00620818417519j),
+ (0.0131985172629+0.0149175003171j),
+ (0.0190298333764+0.00956719089299j),
+ (-0.00112380902283-0.00936658866704j),
+ (-0.0204226914793-0.0333464704454j),
+ (-0.00695514678955-0.0437445007265j),
+ (0.0314490310848-0.0207983348519j),
+ (0.0529675260186+0.0302227605134j),
+ (0.0317338332534+0.0667510479689j),
+ (-0.00775565672666+0.0437112376094j),
+ (-0.024347923696-0.0303014591336j),
+ (-0.0108893103898-0.0875638127327j),
+ (0.00204296782613-0.0721434056759j),
+ (-0.00527479872108-0.00698097236454j))
+ src = gr.vector_source_s(self.src_data)
+ op = filter.freq_xlating_fir_filter_scc(4, self.taps, self.fc, self.fs)
+ dst = gr.vector_sink_c()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ result_data = dst.data()
+ self.assertComplexTuplesAlmostEqual(expected_data, result_data[-20:], 5)
+
+if __name__ == '__main__':
+ gr_unittest.run(test_freq_xlating_filter, "test_freq_xlating_filter.xml")
+
diff --git a/gr-filter/python/qa_hilbert.py b/gr-filter/python/qa_hilbert.py
new file mode 100755
index 000000000..b460b6438
--- /dev/null
+++ b/gr-filter/python/qa_hilbert.py
@@ -0,0 +1,117 @@
+#!/usr/bin/env python
+#
+# Copyright 2004,2007,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.
+#
+
+from gnuradio import gr, gr_unittest
+import filter_swig as filter
+import math
+
+class test_hilbert(gr_unittest.TestCase):
+
+ def setUp(self):
+ self.tb = gr.top_block ()
+
+ def tearDown(self):
+ self.tb = None
+
+ def test_hilbert(self):
+ tb = self.tb
+ ntaps = 51
+ sampling_freq = 100
+
+ expected_result = ( -1.4678005338941702e-11j,
+ -0.0011950774351134896j,
+ -0.0019336787518113852j,
+ -0.0034673355985432863j,
+ -0.0036765895783901215j,
+ -0.004916108213365078j,
+ -0.0042778430506587029j,
+ -0.006028641015291214j,
+ -0.005476709920912981j,
+ -0.0092810001224279404j,
+ -0.0095402700826525688j,
+ -0.016060983762145042j,
+ -0.016446959227323532j,
+ -0.02523401565849781j,
+ -0.024382550269365311j,
+ -0.035477779805660248j,
+ -0.033021725714206696j,
+ -0.048487484455108643j,
+ -0.04543270543217659j,
+ -0.069477587938308716j,
+ -0.066984444856643677j,
+ -0.10703597217798233j,
+ -0.10620346665382385j,
+ -0.1852707713842392j,
+ -0.19357112050056458j,
+ (7.2191945754696007e-09 -0.50004088878631592j),
+ (0.58778399229049683 -0.6155126690864563j),
+ (0.95105588436126709 -0.12377222627401352j),
+ (0.95105588436126709 +0.41524654626846313j),
+ (0.5877838134765625 +0.91611981391906738j),
+ (5.8516356205018383e-09 +1.0670661926269531j),
+ (-0.5877840518951416 +0.87856143712997437j),
+ (-0.95105588436126709 +0.35447561740875244j),
+ (-0.95105588436126709 -0.26055556535720825j),
+ (-0.5877838134765625 -0.77606213092803955j),
+ (-8.7774534307527574e-09 -0.96460390090942383j),
+ (0.58778399229049683 -0.78470128774642944j),
+ (0.95105588436126709 -0.28380891680717468j),
+ (0.95105588436126709 +0.32548999786376953j),
+ (0.5877838134765625 +0.82514488697052002j),
+ (1.4629089051254596e-08 +1.0096219778060913j),
+ (-0.5877840518951416 +0.81836479902267456j),
+ (-0.95105588436126709 +0.31451958417892456j),
+ (-0.95105588436126709 -0.3030143678188324j),
+ (-0.5877838134765625 -0.80480599403381348j),
+ (-1.7554906861505515e-08 -0.99516552686691284j),
+ (0.58778399229049683 -0.80540722608566284j),
+ (0.95105582475662231 -0.30557557940483093j),
+ (0.95105588436126709 +0.31097668409347534j),
+ (0.5877838134765625 +0.81027895212173462j),
+ (2.3406542482007353e-08 +1.0000816583633423j),
+ (-0.5877840518951416 +0.80908381938934326j),
+ (-0.95105588436126709 +0.30904293060302734j),
+ (-0.95105588436126709 -0.30904296040534973j),
+ (-0.5877838134765625 -0.80908387899398804j),
+ (-2.6332360292258272e-08 -1.0000815391540527j),
+ (0.58778399229049683 -0.80908381938934326j),
+ (0.95105582475662231 -0.30904299020767212j),
+ (0.95105588436126709 +0.30904293060302734j),
+ (0.5877838134765625 +0.80908381938934326j),
+ (3.218399768911695e-08 +1.0000815391540527j))
+
+
+ src1 = gr.sig_source_f(sampling_freq, gr.GR_SIN_WAVE,
+ sampling_freq * 0.10, 1.0)
+
+ head = gr.head(gr.sizeof_float, int (ntaps + sampling_freq * 0.10))
+ hilb = filter.hilbert_fc(ntaps)
+ dst1 = gr.vector_sink_c()
+ tb.connect(src1, head)
+ tb.connect(head, hilb)
+ tb.connect(hilb, dst1)
+ tb.run()
+ dst_data = dst1.data()
+ self.assertComplexTuplesAlmostEqual (expected_result, dst_data, 5)
+
+if __name__ == '__main__':
+ gr_unittest.run(test_hilbert, "test_hilbert.xml")
diff --git a/gr-filter/python/qa_iir_filter.py b/gr-filter/python/qa_iir_filter.py
new file mode 100755
index 000000000..645c4b66e
--- /dev/null
+++ b/gr-filter/python/qa_iir_filter.py
@@ -0,0 +1,157 @@
+#!/usr/bin/env python
+#
+# Copyright 2004,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.
+#
+
+from gnuradio import gr, gr_unittest
+import filter_swig as filter
+
+class test_iir_filter(gr_unittest.TestCase):
+
+ def setUp(self):
+ self.tb = gr.top_block()
+
+ def tearDown(self):
+ self.tb = None
+
+ def test_iir_direct_001(self):
+ src_data = (1, 2, 3, 4, 5, 6, 7, 8)
+ fftaps = ()
+ fbtaps = ()
+ expected_result = (0, 0, 0, 0, 0, 0, 0, 0)
+ src = gr.vector_source_f(src_data)
+ op = filter.iir_filter_ffd(fftaps, fbtaps)
+ dst = gr.vector_sink_f()
+ self.tb.connect(src, op)
+ self.tb.connect(op, dst)
+ self.tb.run()
+ result_data = dst.data()
+ self.assertFloatTuplesAlmostEqual(expected_result, result_data)
+
+ def test_iir_direct_002(self):
+ src_data = (1, 2, 3, 4, 5, 6, 7, 8)
+ fftaps = (2,)
+ fbtaps = (0,)
+ expected_result = (2, 4, 6, 8, 10, 12, 14, 16)
+ src = gr.vector_source_f(src_data)
+ op = filter.iir_filter_ffd(fftaps, fbtaps)
+ dst = gr.vector_sink_f()
+ self.tb.connect(src, op)
+ self.tb.connect(op, dst)
+ self.tb.run()
+ result_data = dst.data()
+ self.assertFloatTuplesAlmostEqual(expected_result, result_data)
+
+ def test_iir_direct_003(self):
+ src_data = (1, 2, 3, 4, 5, 6, 7, 8)
+ fftaps = (2, 11)
+ fbtaps = (0, 0)
+ expected_result = (2, 15, 28, 41, 54, 67, 80, 93)
+ src = gr.vector_source_f(src_data)
+ op = filter.iir_filter_ffd(fftaps, fbtaps)
+ dst = gr.vector_sink_f()
+ self.tb.connect(src, op)
+ self.tb.connect(op, dst)
+ self.tb.run()
+ result_data = dst.data()
+ self.assertFloatTuplesAlmostEqual(expected_result, result_data)
+
+ def test_iir_direct_004(self):
+ src_data = (1, 2, 3, 4, 5, 6, 7, 8)
+ fftaps = (2, 11)
+ fbtaps = (0, -1)
+ expected_result = (2, 13, 15, 26, 28, 39, 41, 52)
+ src = gr.vector_source_f(src_data)
+ op = filter.iir_filter_ffd(fftaps, fbtaps)
+ dst = gr.vector_sink_f()
+ self.tb.connect(src, op)
+ self.tb.connect(op, dst)
+ self.tb.run()
+ result_data = dst.data()
+ self.assertFloatTuplesAlmostEqual(expected_result, result_data)
+
+ def test_iir_direct_005(self):
+ src_data = (1, 2, 3, 4, 5, 6, 7, 8)
+ fftaps = (2, 11, 0)
+ fbtaps = (0, -1, 3)
+ expected_result = (2, 13, 21, 59, 58, 186, 68, 583)
+ src = gr.vector_source_f(src_data)
+ op = filter.iir_filter_ffd(fftaps, fbtaps)
+ dst = gr.vector_sink_f()
+ self.tb.connect(src, op)
+ self.tb.connect(op, dst)
+ self.tb.run()
+ result_data = dst.data()
+ self.assertFloatTuplesAlmostEqual(expected_result, result_data)
+
+ def test_iir_direct_006(self):
+ src_data = (1, 2, 3, 4, 5, 6, 7, 8)
+ expected_result = (2, 13, 21, 59, 58, 186, 68, 583)
+ fftaps = (2, 1)
+ fbtaps = (0, -1)
+ src = gr.vector_source_f(src_data)
+ op = filter.iir_filter_ffd(fftaps, fbtaps)
+ fftaps = (2, 11, 0)
+ fbtaps = (0, -1, 3)
+ op.set_taps(fftaps, fbtaps)
+ dst = gr.vector_sink_f()
+ self.tb.connect(src, op)
+ self.tb.connect(op, dst)
+ self.tb.run()
+ result_data = dst.data()
+ self.assertFloatTuplesAlmostEqual(expected_result, result_data)
+
+ def test_iir_direct_007(self):
+ src_data = (1, 2, 3, 4, 5, 6, 7, 8)
+ expected_result = (2,2,5,5,8,8,11,11)
+ fftaps = (2, 1)
+ fbtaps = (0, -1)
+ src = gr.vector_source_f(src_data)
+ op = filter.iir_filter_ffd(fftaps, fbtaps)
+ fftaps = (2,0,1)
+ fbtaps = (0, -1)
+ op.set_taps(fftaps, fbtaps)
+ dst = gr.vector_sink_f()
+ self.tb.connect(src, op)
+ self.tb.connect(op, dst)
+ self.tb.run()
+ result_data = dst.data()
+ self.assertFloatTuplesAlmostEqual(expected_result, result_data)
+
+ def test_iir_direct_008(self):
+ src_data = (1, 2, 3, 4, 5, 6, 7, 8)
+ expected_result = (2,4,4,10,18,14,26,56)
+ fftaps = (2,)
+ fbtaps = (0, 1)
+ src = gr.vector_source_f(src_data)
+ op = filter.iir_filter_ffd(fftaps, fbtaps)
+ fftaps_data = (1)
+ fbtaps = (0,0, -1,3)
+ op.set_taps(fftaps, fbtaps)
+ dst = gr.vector_sink_f()
+ self.tb.connect(src, op)
+ self.tb.connect(op, dst)
+ self.tb.run()
+ result_data = dst.data()
+ self.assertFloatTuplesAlmostEqual (expected_result, result_data)
+
+if __name__ == '__main__':
+ gr_unittest.run(test_iir_filter, "test_iir_filter.xml")
+
diff --git a/gr-filter/python/qa_interp_fir_filter.py b/gr-filter/python/qa_interp_fir_filter.py
new file mode 100755
index 000000000..839330539
--- /dev/null
+++ b/gr-filter/python/qa_interp_fir_filter.py
@@ -0,0 +1,60 @@
+#!/usr/bin/env python
+#
+# Copyright 2004,2007,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.
+#
+
+from gnuradio import gr, gr_unittest
+import filter_swig as filter
+import math
+
+class test_interp_fir_filter(gr_unittest.TestCase):
+
+ def setUp(self):
+ self.tb = gr.top_block()
+
+ def tearDown(self):
+ self.tb = None
+
+ def test_fff(self):
+ taps = [1, 10, 100, 1000, 10000]
+ src_data = (0, 2, 3, 5, 7, 11, 13, 17)
+ interpolation = 3
+ xr = (0,0,0,0,
+ 2,20,200,2003,20030,
+ 300,3005,30050,
+ 500,5007,50070,
+ 700,7011,70110,
+ 1100,11013,110130,
+ 1300,13017,130170)
+ expected_result = tuple([float(x) for x in xr])
+
+ src = gr.vector_source_f(src_data)
+ op = filter.interp_fir_filter_fff(interpolation, taps)
+ dst = gr.vector_sink_f()
+ self.tb.connect(src, op)
+ self.tb.connect(op, dst)
+ self.tb.run()
+ result_data = dst.data()
+ L = min(len(result_data), len(expected_result))
+ self.assertEqual(expected_result[0:L], result_data[0:L])
+
+if __name__ == '__main__':
+ gr_unittest.run(test_interp_fir_filter, "test_interp_fir_filter.xml")
+
diff --git a/gr-filter/python/qa_pfb_arb_resampler.py b/gr-filter/python/qa_pfb_arb_resampler.py
new file mode 100755
index 000000000..a4e22f4c0
--- /dev/null
+++ b/gr-filter/python/qa_pfb_arb_resampler.py
@@ -0,0 +1,95 @@
+#!/usr/bin/env python
+#
+# 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.
+#
+
+from gnuradio import gr, gr_unittest
+import filter_swig as filter
+import math
+
+class test_pfb_arb_resampler(gr_unittest.TestCase):
+
+ def setUp(self):
+ self.tb = gr.top_block()
+
+ def tearDown(self):
+ self.tb = None
+
+ def test_fff_000(self):
+ N = 1000 # number of samples to use
+ fs = 1000 # baseband sampling rate
+ rrate = 1.123 # resampling rate
+
+ nfilts = 32
+ taps = filter.firdes.low_pass_2(nfilts, nfilts*fs, fs/2, fs/10,
+ attenuation_dB=80,
+ window=filter.firdes.WIN_BLACKMAN_hARRIS)
+
+ freq = 100
+ signal = gr.sig_source_f(fs, gr.GR_SIN_WAVE, freq, 1)
+ head = gr.head(gr.sizeof_float, N)
+ pfb = filter.pfb_arb_resampler_fff(rrate, taps)
+ snk = gr.vector_sink_f()
+
+ self.tb.connect(signal, head, pfb, snk)
+ self.tb.run()
+
+ Ntest = 50
+ L = len(snk.data())
+ t = map(lambda x: float(x)/(fs*rrate), xrange(L))
+
+ phase = 0.53013
+ expected_data = map(lambda x: math.sin(2.*math.pi*freq*x+phase), t)
+
+ dst_data = snk.data()
+ self.assertFloatTuplesAlmostEqual(expected_data[-Ntest:], dst_data[-Ntest:], 3)
+
+ def test_ccf_000(self):
+ N = 1000 # number of samples to use
+ fs = 1000 # baseband sampling rate
+ rrate = 1.123 # resampling rate
+
+ nfilts = 32
+ taps = filter.firdes.low_pass_2(nfilts, nfilts*fs, fs/2, fs/10,
+ attenuation_dB=80,
+ window=filter.firdes.WIN_BLACKMAN_hARRIS)
+
+ freq = 100
+ signal = gr.sig_source_c(fs, gr.GR_SIN_WAVE, freq, 1)
+ head = gr.head(gr.sizeof_gr_complex, N)
+ pfb = filter.pfb_arb_resampler_ccf(rrate, taps)
+ snk = gr.vector_sink_c()
+
+ self.tb.connect(signal, head, pfb, snk)
+ self.tb.run()
+
+ Ntest = 50
+ L = len(snk.data())
+ t = map(lambda x: float(x)/(fs*rrate), xrange(L))
+
+ phase = 0.53013
+ expected_data = map(lambda x: math.cos(2.*math.pi*freq*x+phase) + \
+ 1j*math.sin(2.*math.pi*freq*x+phase), t)
+
+ dst_data = snk.data()
+ self.assertComplexTuplesAlmostEqual(expected_data[-Ntest:], dst_data[-Ntest:], 3)
+
+if __name__ == '__main__':
+ gr_unittest.run(test_pfb_arb_resampler, "test_pfb_arb_resampler.xml")
diff --git a/gr-filter/python/qa_pfb_channelizer.py b/gr-filter/python/qa_pfb_channelizer.py
new file mode 100755
index 000000000..c0ed8327d
--- /dev/null
+++ b/gr-filter/python/qa_pfb_channelizer.py
@@ -0,0 +1,104 @@
+#!/usr/bin/env python
+#
+# 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.
+#
+
+from gnuradio import gr, gr_unittest
+import filter_swig as filter
+import math
+
+class test_pfb_channelizer(gr_unittest.TestCase):
+
+ def setUp(self):
+ self.tb = gr.top_block()
+
+ def tearDown(self):
+ self.tb = None
+
+ def test_000(self):
+ N = 1000 # number of samples to use
+ M = 5 # Number of channels to channelize
+ fs = 1000 # baseband sampling rate
+ ifs = M*fs # input samp rate to channelizer
+
+ taps = filter.firdes.low_pass_2(1, ifs, 500, 50,
+ attenuation_dB=80,
+ window=filter.firdes.WIN_BLACKMAN_hARRIS)
+
+ signals = list()
+ add = gr.add_cc()
+ freqs = [-200, -100, 0, 100, 200]
+ for i in xrange(len(freqs)):
+ f = freqs[i] + (M/2-M+i+1)*fs
+ signals.append(gr.sig_source_c(ifs, gr.GR_SIN_WAVE, f, 1))
+ self.tb.connect(signals[i], (add,i))
+
+ head = gr.head(gr.sizeof_gr_complex, N)
+ s2ss = gr.stream_to_streams(gr.sizeof_gr_complex, M)
+ pfb = filter.pfb_channelizer_ccf(M, taps, 1)
+
+ self.tb.connect(add, head, s2ss)
+
+ snks = list()
+ for i in xrange(M):
+ snks.append(gr.vector_sink_c())
+ self.tb.connect((s2ss,i), (pfb,i))
+ self.tb.connect((pfb, i), snks[i])
+
+ self.tb.run()
+
+ Ntest = 50
+ L = len(snks[0].data())
+ t = map(lambda x: float(x)/fs, xrange(L))
+
+ # Adjusted phase rotations for data
+ p0 = 0
+ p1 = math.pi*0.51998885
+ p2 = -math.pi*0.96002233
+ p3 = math.pi*0.96002233
+ p4 = -math.pi*0.51998885
+
+ # Create known data as complex sinusoids at the different baseband freqs
+ # the different channel numbering is due to channelizer output order.
+ expected0_data = map(lambda x: math.cos(2.*math.pi*freqs[2]*x+p0) + \
+ 1j*math.sin(2.*math.pi*freqs[2]*x+p0), t)
+ expected1_data = map(lambda x: math.cos(2.*math.pi*freqs[3]*x+p1) + \
+ 1j*math.sin(2.*math.pi*freqs[3]*x+p1), t)
+ expected2_data = map(lambda x: math.cos(2.*math.pi*freqs[4]*x+p2) + \
+ 1j*math.sin(2.*math.pi*freqs[4]*x+p2), t)
+ expected3_data = map(lambda x: math.cos(2.*math.pi*freqs[0]*x+p3) + \
+ 1j*math.sin(2.*math.pi*freqs[0]*x+p3), t)
+ expected4_data = map(lambda x: math.cos(2.*math.pi*freqs[1]*x+p4) + \
+ 1j*math.sin(2.*math.pi*freqs[1]*x+p4), t)
+
+ dst0_data = snks[0].data()
+ dst1_data = snks[1].data()
+ dst2_data = snks[2].data()
+ dst3_data = snks[3].data()
+ dst4_data = snks[4].data()
+
+ self.assertComplexTuplesAlmostEqual(expected0_data[-Ntest:], dst0_data[-Ntest:], 3)
+ self.assertComplexTuplesAlmostEqual(expected1_data[-Ntest:], dst1_data[-Ntest:], 3)
+ self.assertComplexTuplesAlmostEqual(expected2_data[-Ntest:], dst2_data[-Ntest:], 3)
+ self.assertComplexTuplesAlmostEqual(expected3_data[-Ntest:], dst3_data[-Ntest:], 3)
+ self.assertComplexTuplesAlmostEqual(expected4_data[-Ntest:], dst4_data[-Ntest:], 3)
+
+if __name__ == '__main__':
+ gr_unittest.run(test_pfb_channelizer, "test_pfb_channelizer.xml")
diff --git a/gr-filter/python/qa_pfb_decimator.py b/gr-filter/python/qa_pfb_decimator.py
new file mode 100755
index 000000000..063845f63
--- /dev/null
+++ b/gr-filter/python/qa_pfb_decimator.py
@@ -0,0 +1,125 @@
+#!/usr/bin/env python
+#
+# 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.
+#
+
+from gnuradio import gr, gr_unittest
+import filter_swig as filter
+import math
+
+class test_pfb_decimator(gr_unittest.TestCase):
+
+ def setUp(self):
+ self.tb = gr.top_block()
+
+ def tearDown(self):
+ self.tb = None
+
+ def test_000(self):
+ N = 1000 # number of samples to use
+ M = 5 # Number of channels
+ fs = 1000 # baseband sampling rate
+ ifs = M*fs # input samp rate to decimator
+ channel = 0 # Extract channel 0
+
+ taps = filter.firdes.low_pass_2(1, ifs, fs/2, fs/10,
+ attenuation_dB=80,
+ window=filter.firdes.WIN_BLACKMAN_hARRIS)
+
+ signals = list()
+ add = gr.add_cc()
+ freqs = [-200, -100, 0, 100, 200]
+ for i in xrange(len(freqs)):
+ f = freqs[i] + (M/2-M+i+1)*fs
+ signals.append(gr.sig_source_c(ifs, gr.GR_SIN_WAVE, f, 1))
+ self.tb.connect(signals[i], (add,i))
+
+ head = gr.head(gr.sizeof_gr_complex, N)
+ s2ss = gr.stream_to_streams(gr.sizeof_gr_complex, M)
+ pfb = filter.pfb_decimator_ccf(M, taps, channel)
+ snk = gr.vector_sink_c()
+
+ self.tb.connect(add, head, s2ss)
+ for i in xrange(M):
+ self.tb.connect((s2ss,i), (pfb,i))
+ self.tb.connect(pfb, snk)
+
+ self.tb.run()
+
+ Ntest = 50
+ L = len(snk.data())
+ t = map(lambda x: float(x)/fs, xrange(L))
+
+ # Create known data as complex sinusoids for the baseband freq
+ # of the extracted channel is due to decimator output order.
+ phase = 0
+ expected_data = map(lambda x: math.cos(2.*math.pi*freqs[2]*x+phase) + \
+ 1j*math.sin(2.*math.pi*freqs[2]*x+phase), t)
+
+ dst_data = snk.data()
+
+ self.assertComplexTuplesAlmostEqual(expected_data[-Ntest:], dst_data[-Ntest:], 4)
+
+ def test_001(self):
+ N = 1000 # number of samples to use
+ M = 5 # Number of channels
+ fs = 1000 # baseband sampling rate
+ ifs = M*fs # input samp rate to decimator
+ channel = 1 # Extract channel 0
+
+ taps = filter.firdes.low_pass_2(1, ifs, fs/2, fs/10,
+ attenuation_dB=80,
+ window=filter.firdes.WIN_BLACKMAN_hARRIS)
+
+ signals = list()
+ add = gr.add_cc()
+ freqs = [-200, -100, 0, 100, 200]
+ for i in xrange(len(freqs)):
+ f = freqs[i] + (M/2-M+i+1)*fs
+ signals.append(gr.sig_source_c(ifs, gr.GR_SIN_WAVE, f, 1))
+ self.tb.connect(signals[i], (add,i))
+
+ head = gr.head(gr.sizeof_gr_complex, N)
+ s2ss = gr.stream_to_streams(gr.sizeof_gr_complex, M)
+ pfb = filter.pfb_decimator_ccf(M, taps, channel)
+ snk = gr.vector_sink_c()
+
+ self.tb.connect(add, head, s2ss)
+ for i in xrange(M):
+ self.tb.connect((s2ss,i), (pfb,i))
+ self.tb.connect(pfb, snk)
+
+ self.tb.run()
+
+ Ntest = 50
+ L = len(snk.data())
+ t = map(lambda x: float(x)/fs, xrange(L))
+
+ # Create known data as complex sinusoids for the baseband freq
+ # of the extracted channel is due to decimator output order.
+ phase = 6.15746
+ expected_data = map(lambda x: math.cos(2.*math.pi*freqs[3]*x+phase) + \
+ 1j*math.sin(2.*math.pi*freqs[3]*x+phase), t)
+ dst_data = snk.data()
+
+ self.assertComplexTuplesAlmostEqual(expected_data[-Ntest:], dst_data[-Ntest:], 4)
+
+if __name__ == '__main__':
+ gr_unittest.run(test_pfb_decimator, "test_pfb_decimator.xml")
diff --git a/gr-filter/python/qa_pfb_interpolator.py b/gr-filter/python/qa_pfb_interpolator.py
new file mode 100755
index 000000000..5b84b7c64
--- /dev/null
+++ b/gr-filter/python/qa_pfb_interpolator.py
@@ -0,0 +1,71 @@
+#!/usr/bin/env python
+#
+# 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.
+#
+
+from gnuradio import gr, gr_unittest
+import filter_swig as filter
+import math
+
+class test_pfb_interpolator(gr_unittest.TestCase):
+
+ def setUp(self):
+ self.tb = gr.top_block()
+
+ def tearDown(self):
+ self.tb = None
+
+ def test_000(self):
+ N = 1000 # number of samples to use
+ M = 5 # Number of channels
+ fs = 1000 # baseband sampling rate
+ ifs = M*fs # input samp rate to decimator
+
+ taps = filter.firdes.low_pass_2(M, ifs, fs/2, fs/10,
+ attenuation_dB=80,
+ window=filter.firdes.WIN_BLACKMAN_hARRIS)
+
+ freq = 100
+ signal = gr.sig_source_c(fs, gr.GR_COS_WAVE, freq, 1)
+ head = gr.head(gr.sizeof_gr_complex, N)
+ pfb = filter.pfb_interpolator_ccf(M, taps)
+ snk = gr.vector_sink_c()
+
+ self.tb.connect(signal, head, pfb)
+ self.tb.connect(pfb, snk)
+
+ self.tb.run()
+
+ Ntest = 50
+ L = len(snk.data())
+ t = map(lambda x: float(x)/ifs, xrange(L))
+
+ # Create known data as complex sinusoids at freq
+ # of the channel at the interpolated rate.
+ phase = 0.62833
+ expected_data = map(lambda x: math.cos(2.*math.pi*freq*x+phase) + \
+ 1j*math.sin(2.*math.pi*freq*x+phase), t)
+
+ dst_data = snk.data()
+
+ self.assertComplexTuplesAlmostEqual(expected_data[-Ntest:], dst_data[-Ntest:], 4)
+
+if __name__ == '__main__':
+ gr_unittest.run(test_pfb_interpolator, "test_pfb_interpolator.xml")
diff --git a/gr-filter/python/qa_pfb_synthesizer.py b/gr-filter/python/qa_pfb_synthesizer.py
new file mode 100755
index 000000000..e8164d268
--- /dev/null
+++ b/gr-filter/python/qa_pfb_synthesizer.py
@@ -0,0 +1,87 @@
+#!/usr/bin/env python
+#
+# 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.
+#
+
+from gnuradio import gr, gr_unittest
+import filter_swig as filter
+import math
+
+class test_pfb_synthesizer(gr_unittest.TestCase):
+
+ def setUp(self):
+ self.tb = gr.top_block()
+
+ def tearDown(self):
+ self.tb = None
+
+ def test_000(self):
+ N = 10000 # number of samples to use
+ M = 5 # Number of channels
+ fs = 1000 # baseband sampling rate
+ ofs = M*fs # input samp rate to decimator
+
+ taps = filter.firdes.low_pass_2(M, ofs, fs/2, fs/10,
+ attenuation_dB=80,
+ window=filter.firdes.WIN_BLACKMAN_hARRIS)
+
+ signals = list()
+ freqs = [0, 100, 200, -200, -100]
+ for i in xrange(len(freqs)):
+ signals.append(gr.sig_source_c(fs, gr.GR_SIN_WAVE, freqs[i], 1))
+
+ head = gr.head(gr.sizeof_gr_complex, N)
+ pfb = filter.pfb_synthesizer_ccf(M, taps)
+ snk = gr.vector_sink_c()
+
+ for i in xrange(M):
+ self.tb.connect(signals[i], (pfb,i))
+
+ self.tb.connect(pfb, head, snk)
+
+ self.tb.run()
+
+ Ntest = 1000
+ L = len(snk.data())
+ t = map(lambda x: float(x)/ofs, xrange(L))
+
+ # Create known data as sum of complex sinusoids at freqs
+ # of the output channels.
+ freqs = [-2200, -1100, 0, 1100, 2200]
+ expected_data = len(t)*[0,]
+ for i in xrange(len(t)):
+ expected_data[i] = math.cos(2.*math.pi*freqs[0]*t[i]) + \
+ 1j*math.sin(2.*math.pi*freqs[0]*t[i]) + \
+ math.cos(2.*math.pi*freqs[1]*t[i]) + \
+ 1j*math.sin(2.*math.pi*freqs[1]*t[i]) + \
+ math.cos(2.*math.pi*freqs[2]*t[i]) + \
+ 1j*math.sin(2.*math.pi*freqs[2]*t[i]) + \
+ math.cos(2.*math.pi*freqs[3]*t[i]) + \
+ 1j*math.sin(2.*math.pi*freqs[3]*t[i]) + \
+ math.cos(2.*math.pi*freqs[4]*t[i]) + \
+ 1j*math.sin(2.*math.pi*freqs[4]*t[i])
+ dst_data = snk.data()
+
+ offset = 25
+ self.assertComplexTuplesAlmostEqual(expected_data[2000-offset:2000-offset+Ntest],
+ dst_data[2000:2000+Ntest], 4)
+
+if __name__ == '__main__':
+ gr_unittest.run(test_pfb_synthesizer, "test_pfb_synthesizer.xml")
diff --git a/gr-filter/python/qa_pm_remez.py b/gr-filter/python/qa_pm_remez.py
new file mode 100755
index 000000000..a76e14c93
--- /dev/null
+++ b/gr-filter/python/qa_pm_remez.py
@@ -0,0 +1,188 @@
+#!/usr/bin/env python
+#
+# 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.
+#
+
+from gnuradio import gr, gr_unittest
+import filter_swig as filter
+import sys, math
+
+# ----------------------------------------------------------------
+# See optfir for an explanation of these.
+
+def stopband_atten_to_dev (atten_db):
+ """Convert a stopband attenuation in dB to an absolute value"""
+ return 10**(-atten_db/20)
+
+def passband_ripple_to_dev (ripple_db):
+ """Convert passband ripple spec expressed in dB to an absolute value"""
+ return (10**(ripple_db/20)-1)/(10**(ripple_db/20)+1)
+
+# ----------------------------------------------------------------
+
+def remezord (fcuts, mags, devs, fsamp = 2):
+ '''
+ FIR order estimator (lowpass, highpass, bandpass, mulitiband).
+ '''
+
+ # get local copies
+ fcuts = fcuts[:]
+ mags = mags[:]
+ devs = devs[:]
+
+ for i in range (len (fcuts)):
+ fcuts[i] = float (fcuts[i]) / fsamp
+
+ nf = len (fcuts)
+ nm = len (mags)
+ nd = len (devs)
+ nbands = nm
+
+ if nm != nd:
+ raise ValueError, "Length of mags and devs must be equal"
+
+ if nf != 2 * (nbands - 1):
+ raise ValueError, "Length of f must be 2 * len (mags) - 2"
+
+ for i in range (len (mags)):
+ if mags[i] != 0: # if not stopband, get relative deviation
+ devs[i] = devs[i] / mags[i]
+
+ # separate the passband and stopband edges
+ f1 = fcuts[0::2]
+ f2 = fcuts[1::2]
+
+ n = 0
+ min_delta = 2
+ for i in range (len (f1)):
+ if f2[i] - f1[i] < min_delta:
+ n = i
+ min_delta = f2[i] - f1[i]
+
+ if nbands == 2:
+ # lowpass or highpass case (use formula)
+ l = lporder (f1[n], f2[n], devs[0], devs[1])
+ else:
+ # bandpass or multipass case
+ # try different lowpasses and take the worst one that
+ # goes through the BP specs
+ l = 0
+ for i in range (1, nbands-1):
+ l1 = lporder (f1[i-1], f2[i-1], devs[i], devs[i-1])
+ l2 = lporder (f1[i], f2[i], devs[i], devs[i+1])
+ l = max (l, l1, l2)
+
+ n = int (math.ceil (l)) - 1 # need order, not length for remez
+
+ # cook up remez compatible result
+ ff = [0] + fcuts + [1]
+ for i in range (1, len (ff) - 1):
+ ff[i] *= 2
+
+ aa = []
+ for a in mags:
+ aa = aa + [a, a]
+
+ max_dev = max (devs)
+ wts = [1] * len(devs)
+ for i in range (len (wts)):
+ wts[i] = max_dev / devs[i]
+
+ return (n, ff, aa, wts)
+
+
+def lporder (freq1, freq2, delta_p, delta_s):
+ '''
+ FIR lowpass filter length estimator.
+ '''
+ df = abs (freq2 - freq1)
+ ddp = math.log10 (delta_p)
+ dds = math.log10 (delta_s)
+
+ a1 = 5.309e-3
+ a2 = 7.114e-2
+ a3 = -4.761e-1
+ a4 = -2.66e-3
+ a5 = -5.941e-1
+ a6 = -4.278e-1
+
+ b1 = 11.01217
+ b2 = 0.5124401
+
+ t1 = a1 * ddp * ddp
+ t2 = a2 * ddp
+ t3 = a4 * ddp * ddp
+ t4 = a5 * ddp
+
+ dinf=((t1 + t2 + a3) * dds) + (t3 + t4 + a6)
+ ff = b1 + b2 * (ddp - dds)
+ n = dinf / df - ff * df + 1
+ return n
+
+# ----------------------------------------------------------------
+
+class test_pm_remez(gr_unittest.TestCase):
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def test_low_pass(self):
+ gain = 1
+ Fs = 1
+ freq1 = 0.1
+ freq2 = 0.2
+ passband_ripple_db = 0.01
+ stopband_atten_db = 60
+
+ passband_dev = passband_ripple_to_dev(passband_ripple_db)
+ stopband_dev = stopband_atten_to_dev(stopband_atten_db)
+ desired_ampls = (gain, 0)
+ (n, fo, ao, w) = remezord([freq1, freq2], desired_ampls,
+ [passband_dev, stopband_dev], Fs)
+ new_taps = filter.pm_remez(n + 2, fo, ao, w, "bandpass")
+
+ known_taps = (-0.0008370135734511828, -0.0006622211673134374,
+ 0.0008501079576365787, 0.003059609130249229,
+ 0.003202235537205373, -0.001000899296974219,
+ -0.007589728680590891, -0.009790921118281865,
+ -0.001524210202628562, 0.014373535837200111,
+ 0.02392881326993834, 0.011798133085019008,
+ -0.021954446348997188, -0.05293436740264934,
+ -0.04375787096766848, 0.028038890498420392,
+ 0.14612655590172896, 0.25738578419108626,
+ 0.302967004188747, 0.25738578419108626,
+ 0.14612655590172896, 0.028038890498420392,
+ -0.04375787096766848, -0.05293436740264934,
+ -0.021954446348997188, 0.011798133085019008,
+ 0.02392881326993834, 0.014373535837200111,
+ -0.001524210202628562, -0.009790921118281865,
+ -0.007589728680590891, -0.001000899296974219,
+ 0.003202235537205373, 0.003059609130249229,
+ 0.0008501079576365787, -0.0006622211673134374,
+ -0.0008370135734511828)
+
+ self.assertFloatTuplesAlmostEqual(known_taps, new_taps, 5)
+
+if __name__ == '__main__':
+ gr_unittest.run(test_pm_remez, "test_pm_remez.xml")
+
diff --git a/gr-filter/python/qa_rational_resampler.py b/gr-filter/python/qa_rational_resampler.py
new file mode 100755
index 000000000..eb86ef542
--- /dev/null
+++ b/gr-filter/python/qa_rational_resampler.py
@@ -0,0 +1,257 @@
+#!/usr/bin/env python
+#
+# Copyright 2005,2006,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.
+#
+
+from gnuradio import gr, gr_unittest
+import filter_swig as filter
+import math
+import random
+import sys
+
+
+def random_floats(n):
+ r = []
+ for x in xrange(n):
+ # r.append(float(random.randint(-32768, 32768)))
+ r.append(float(random.random()))
+ return tuple(r)
+
+
+def reference_dec_filter(src_data, decim, taps):
+ tb = gr.top_block()
+ src = gr.vector_source_f(src_data)
+ op = filter.fir_filter_fff(decim, taps)
+ dst = gr.vector_sink_f()
+ tb.connect(src, op, dst)
+ tb.run()
+ result_data = dst.data()
+ tb = None
+ return result_data
+
+def reference_interp_filter(src_data, interp, taps):
+ tb = gr.top_block()
+ src = gr.vector_source_f(src_data)
+ op = filter.interp_fir_filter_fff(interp, taps)
+ dst = gr.vector_sink_f()
+ tb.connect(src, op, dst)
+ tb.run()
+ result_data = dst.data()
+ tb = None
+ return result_data
+
+def reference_interp_dec_filter(src_data, interp, decim, taps):
+ tb = gr.top_block()
+ src = gr.vector_source_f(src_data)
+ up = filter.interp_fir_filter_fff(interp, (1,))
+ dn = filter.fir_filter_fff(decim, taps)
+ dst = gr.vector_sink_f()
+ tb.connect(src, up, dn, dst)
+ tb.run()
+ result_data = dst.data()
+ tb = None
+ return result_data
+
+
+class test_rational_resampler (gr_unittest.TestCase):
+
+ def setUp(self):
+ random.seed(0)
+
+ def tearDown(self):
+ pass
+
+
+ def test_000_1_to_1(self):
+ taps = (-4, 5)
+ src_data = (234, -4, 23, -56, 45, 98, -23, -7)
+ xr = (1186, -112, 339, -460, -167, 582)
+ expected_result = tuple([float(x) for x in xr])
+
+ tb = gr.top_block()
+ src = gr.vector_source_f(src_data)
+ op = filter.rational_resampler_base_fff(1, 1, taps)
+ dst = gr.vector_sink_f()
+ tb.connect(src, op)
+ tb.connect(op, dst)
+ tb.run()
+ result_data = dst.data()
+ self.assertEqual(expected_result, result_data)
+
+ def test_001_interp(self):
+ taps = [1, 10, 100, 1000, 10000]
+ src_data = (0, 2, 3, 5, 7, 11, 13, 17)
+ interpolation = 3
+ xr = (0,2,20,200,2003,20030,
+ 300,3005,30050,
+ 500,5007,50070,
+ 700,7011,70110,
+ 1100,11013,110130,
+ 1300,13017,130170,
+ 1700.0,17000.0,170000.0)
+ expected_result = tuple([float(x) for x in xr])
+
+ tb = gr.top_block()
+ src = gr.vector_source_f(src_data)
+ op = filter.rational_resampler_base_fff(interpolation, 1, taps)
+ dst = gr.vector_sink_f()
+ tb.connect(src, op)
+ tb.connect(op, dst)
+ tb.run()
+ result_data = dst.data()
+ self.assertEqual(expected_result, result_data)
+
+ def test_002_interp(self):
+ taps = random_floats(31)
+ src_data = random_floats(10000)
+ interpolation = 3
+
+ expected_result = reference_interp_filter(src_data, interpolation, taps)
+
+ tb = gr.top_block()
+ src = gr.vector_source_f(src_data)
+ op = filter.rational_resampler_base_fff(interpolation, 1, taps)
+ dst = gr.vector_sink_f()
+ tb.connect(src, op)
+ tb.connect(op, dst)
+ tb.run()
+ result_data = dst.data()
+
+ N = 1000
+ offset = len(taps)-1
+ self.assertEqual(expected_result[offset:offset+N], result_data[0:N])
+
+ def xtest_003_interp(self):
+ taps = random_floats(9)
+ src_data = random_floats(10000)
+ decimation = 3
+
+ expected_result = reference_dec_filter(src_data, decimation, taps)
+
+ tb = gr.top_block()
+ src = gr.vector_source_f(src_data)
+ op = filter.rational_resampler_base_fff(1, decimation, taps)
+ dst = gr.vector_sink_f()
+ tb.connect(src, op)
+ tb.connect(op, dst)
+ tb.run()
+ result_data = dst.data()
+
+ N = 10
+ offset = 10#len(taps)-1
+ print expected_result[100+offset:100+offset+N]
+ print result_data[100:100+N]
+ #self.assertEqual(expected_result[offset:offset+N], result_data[0:N])
+
+ # FIXME disabled. Triggers hang on SuSE 10.0
+ def xtest_004_decim_random_vals(self):
+ MAX_TAPS = 9
+ MAX_DECIM = 7
+ OUTPUT_LEN = 9
+
+ random.seed(0) # we want reproducibility
+
+ for ntaps in xrange(1, MAX_TAPS + 1):
+ for decim in xrange(1, MAX_DECIM+1):
+ for ilen in xrange(ntaps + decim, ntaps + OUTPUT_LEN*decim):
+ src_data = random_floats(ilen)
+ taps = random_floats(ntaps)
+ expected_result = reference_dec_filter(src_data, decim, taps)
+
+ tb = gr.top_block()
+ src = gr.vector_source_f(src_data)
+ op = filter.rational_resampler_base_fff(1, decim, taps)
+ dst = gr.vector_sink_f()
+ tb.connect(src, op, dst)
+ tb.run()
+ tb = None
+ result_data = dst.data()
+
+ L1 = len(result_data)
+ L2 = len(expected_result)
+ L = min(L1, L2)
+ if False:
+ sys.stderr.write('delta = %2d: ntaps = %d decim = %d ilen = %d\n' % (L2 - L1, ntaps, decim, ilen))
+ sys.stderr.write(' len(result_data) = %d len(expected_result) = %d\n' %
+ (len(result_data), len(expected_result)))
+ self.assertEqual(expected_result[0:L], result_data[0:L])
+
+
+ # FIXME disabled. Triggers hang on SuSE 10.0
+ def xtest_005_interp_random_vals(self):
+ MAX_TAPS = 9
+ MAX_INTERP = 7
+ INPUT_LEN = 9
+
+ random.seed(0) # we want reproducibility
+
+ for ntaps in xrange(1, MAX_TAPS + 1):
+ for interp in xrange(1, MAX_INTERP+1):
+ for ilen in xrange(ntaps, ntaps + INPUT_LEN):
+ src_data = random_floats(ilen)
+ taps = random_floats(ntaps)
+ expected_result = reference_interp_filter(src_data, interp, taps)
+
+ tb = gr.top_block()
+ src = gr.vector_source_f(src_data)
+ op = filter.rational_resampler_base_fff(interp, 1, taps)
+ dst = gr.vector_sink_f()
+ tb.connect(src, op, dst)
+ tb.run()
+ tb = None
+ result_data = dst.data()
+ L1 = len(result_data)
+ L2 = len(expected_result)
+ L = min(L1, L2)
+ #if True or abs(L1-L2) > 1:
+ if False:
+ sys.stderr.write('delta = %2d: ntaps = %d interp = %d ilen = %d\n' % (L2 - L1, ntaps, interp, ilen))
+ #sys.stderr.write(' len(result_data) = %d len(expected_result) = %d\n' %
+ # (len(result_data), len(expected_result)))
+ #self.assertEqual(expected_result[0:L], result_data[0:L])
+ # FIXME check first ntaps+1 answers
+ self.assertEqual(expected_result[ntaps+1:L], result_data[ntaps+1:L])
+
+ def test_006_interp_decim(self):
+ taps = random_floats(31)
+ src_data = random_floats(10000)
+ interp = 3
+ decimation = 2
+
+ expected_result = reference_interp_dec_filter(src_data, interp, decimation, taps)
+
+ tb = gr.top_block()
+ src = gr.vector_source_f(src_data)
+ op = filter.rational_resampler_base_fff(interp, decimation, taps)
+ dst = gr.vector_sink_f()
+ tb.connect(src, op)
+ tb.connect(op, dst)
+ tb.run()
+ result_data = dst.data()
+
+ N = 1000
+ offset = len(taps)/2
+ self.assertFloatTuplesAlmostEqual(expected_result[offset:offset+N], result_data[0:N], 5)
+
+
+if __name__ == '__main__':
+ # FIXME: Disabled, see ticket:210
+ gr_unittest.run(test_rational_resampler, "test_rational_resampler.xml")
+
diff --git a/gr-filter/python/qa_single_pole_iir.py b/gr-filter/python/qa_single_pole_iir.py
new file mode 100755
index 000000000..3608c77f9
--- /dev/null
+++ b/gr-filter/python/qa_single_pole_iir.py
@@ -0,0 +1,114 @@
+#!/usr/bin/env python
+#
+# Copyright 2005,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.
+#
+
+from gnuradio import gr, gr_unittest
+import filter_swig as filter
+
+class test_single_pole_iir_filter(gr_unittest.TestCase):
+
+ def setUp (self):
+ self.tb = gr.top_block ()
+
+ def tearDown (self):
+ self.tb = None
+
+ def test_ff_001(self):
+ src_data = (0, 1000, 2000, 3000, 4000, 5000)
+ expected_result = src_data
+ src = gr.vector_source_f(src_data)
+ op = filter.single_pole_iir_filter_ff(1.0)
+ dst = gr.vector_sink_f()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ result_data = dst.data()
+ self.assertFloatTuplesAlmostEqual(expected_result, result_data)
+
+ def test_ff_002(self):
+ src_data = (0, 1000, 2000, 3000, 4000, 5000)
+ expected_result = (0, 125, 359.375, 689.453125, 1103.271484, 1590.36255)
+ src = gr.vector_source_f(src_data)
+ op = filter.single_pole_iir_filter_ff(0.125)
+ dst = gr.vector_sink_f()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ result_data = dst.data()
+ self.assertFloatTuplesAlmostEqual(expected_result, result_data, 3)
+
+ def test_ff_003(self):
+ block_size = 2
+ src_data = (0, 1000, 2000, 3000, 4000, 5000)
+ expected_result = (0, 125, 250, 484.375, 718.75, 1048.828125)
+ src = gr.vector_source_f(src_data)
+ s2p = gr.serial_to_parallel(gr.sizeof_float, block_size)
+ op = filter.single_pole_iir_filter_ff (0.125, block_size)
+ p2s = gr.parallel_to_serial(gr.sizeof_float, block_size)
+ dst = gr.vector_sink_f()
+ self.tb.connect(src, s2p, op, p2s, dst)
+ self.tb.run()
+ result_data = dst.data()
+ self.assertFloatTuplesAlmostEqual(expected_result, result_data, 3)
+
+ def test_cc_001(self):
+ src_data = (0+0j, 1000+1000j, 2000+2000j, 3000+3000j, 4000+4000j, 5000+5000j)
+ expected_result = src_data
+ src = gr.vector_source_c(src_data)
+ op = filter.single_pole_iir_filter_cc(1.0)
+ dst = gr.vector_sink_c()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ result_data = dst.data()
+ self.assertComplexTuplesAlmostEqual(expected_result, result_data)
+
+ def test_cc_002(self):
+ src_data = (complex(0,0), complex(1000,-1000), complex(2000,-2000),
+ complex(3000,-3000), complex(4000,-4000), complex(5000,-5000))
+ expected_result = (complex(0,0), complex(125,-125), complex(359.375,-359.375),
+ complex(689.453125,-689.453125), complex(1103.271484,-1103.271484),
+ complex(1590.36255,-1590.36255))
+ src = gr.vector_source_c(src_data)
+ op = filter.single_pole_iir_filter_cc(0.125)
+ dst = gr.vector_sink_c()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ result_data = dst.data()
+ self.assertComplexTuplesAlmostEqual(expected_result, result_data, 3)
+
+ def test_cc_003(self):
+ block_size = 2
+ src_data = (complex(0,0), complex(1000,-1000), complex(2000,-2000),
+ complex(3000,-3000), complex(4000,-4000), complex(5000,-5000))
+ expected_result = (complex(0,0), complex(125,-125), complex(250,-250),
+ complex(484.375,-484.375), complex(718.75,-718.75),
+ complex(1048.828125,-1048.828125))
+ src = gr.vector_source_c(src_data)
+ s2p = gr.serial_to_parallel(gr.sizeof_gr_complex, block_size)
+ op = filter.single_pole_iir_filter_cc(0.125, block_size)
+ p2s = gr.parallel_to_serial(gr.sizeof_gr_complex, block_size)
+ dst = gr.vector_sink_c()
+ self.tb.connect(src, s2p, op, p2s, dst)
+ self.tb.run()
+ result_data = dst.data()
+ self.assertComplexTuplesAlmostEqual(expected_result, result_data, 3)
+
+if __name__ == '__main__':
+ gr_unittest.run(test_single_pole_iir_filter, "test_single_pole_iir_filter.xml")
+
diff --git a/gr-filter/python/rational_resampler.py b/gr-filter/python/rational_resampler.py
new file mode 100644
index 000000000..312b011d3
--- /dev/null
+++ b/gr-filter/python/rational_resampler.py
@@ -0,0 +1,129 @@
+#
+# Copyright 2005,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.
+#
+
+from gnuradio import gr, gru
+
+_plot = None
+
+def design_filter(interpolation, decimation, fractional_bw):
+ """
+ Given the interpolation rate, decimation rate and a fractional bandwidth,
+ design a set of taps.
+
+ @param interpolation: interpolation factor
+ @type interpolation: integer > 0
+ @param decimation: decimation factor
+ @type decimation: integer > 0
+ @param fractional_bw: fractional bandwidth in (0, 0.5) 0.4 works well.
+ @type fractional_bw: float
+ @returns: sequence of numbers
+ """
+
+ if fractional_bw >= 0.5 or fractional_bw <= 0:
+ raise ValueError, "Invalid fractional_bandwidth, must be in (0, 0.5)"
+
+ beta = 5.0
+ trans_width = 0.5 - fractional_bw
+ mid_transition_band = 0.5 - trans_width/2
+
+ taps = filter.firdes.low_pass(interpolation, # gain
+ 1, # Fs
+ mid_transition_band/interpolation, # trans mid point
+ trans_width/interpolation, # transition width
+ filter.firdes.WIN_KAISER,
+ beta) # beta
+ return taps
+
+
+
+class _rational_resampler_base(gr.hier_block2):
+ """
+ base class for all rational resampler variants.
+ """
+ def __init__(self, resampler_base,
+ interpolation, decimation, taps=None, fractional_bw=None):
+ """
+ Rational resampling polyphase FIR filter.
+
+ Either taps or fractional_bw may be specified, but not both.
+ If neither is specified, a reasonable default, 0.4, is used as
+ the fractional_bw.
+
+ @param interpolation: interpolation factor
+ @type interpolation: integer > 0
+ @param decimation: decimation factor
+ @type decimation: integer > 0
+ @param taps: optional filter coefficients
+ @type taps: sequence
+ @param fractional_bw: fractional bandwidth in (0, 0.5), measured at final freq (use 0.4)
+ @type fractional_bw: float
+ """
+
+ if not isinstance(interpolation, int) or interpolation < 1:
+ raise ValueError, "interpolation must be an integer >= 1"
+
+ if not isinstance(decimation, int) or decimation < 1:
+ raise ValueError, "decimation must be an integer >= 1"
+
+ if taps is None and fractional_bw is None:
+ fractional_bw = 0.4
+
+ d = gru.gcd(interpolation, decimation)
+ interpolation = interpolation // d
+ decimation = decimation // d
+
+ if taps is None:
+ taps = design_filter(interpolation, decimation, fractional_bw)
+
+ resampler = resampler_base(interpolation, decimation, taps)
+ gr.hier_block2.__init__(self, "rational_resampler",
+ gr.io_signature(1, 1, resampler.input_signature().sizeof_stream_item(0)),
+ gr.io_signature(1, 1, resampler.output_signature().sizeof_stream_item(0)))
+
+ self.connect(self, resampler, self)
+
+
+class rational_resampler_fff(_rational_resampler_base):
+ def __init__(self, interpolation, decimation, taps=None, fractional_bw=None):
+ """
+ Rational resampling polyphase FIR filter with
+ float input, float output and float taps.
+ """
+ _rational_resampler_base.__init__(self, filter.rational_resampler_base_fff,
+ interpolation, decimation, taps, fractional_bw)
+
+class rational_resampler_ccf(_rational_resampler_base):
+ def __init__(self, interpolation, decimation, taps=None, fractional_bw=None):
+ """
+ Rational resampling polyphase FIR filter with
+ complex input, complex output and float taps.
+ """
+ _rational_resampler_base.__init__(self, filter.rational_resampler_base_ccf,
+ interpolation, decimation, taps, fractional_bw)
+
+class rational_resampler_ccc(_rational_resampler_base):
+ def __init__(self, interpolation, decimation, taps=None, fractional_bw=None):
+ """
+ Rational resampling polyphase FIR filter with
+ complex input, complex output and complex taps.
+ """
+ _rational_resampler_base.__init__(self, filter.rational_resampler_base_ccc,
+ interpolation, decimation, taps, fractional_bw)
diff --git a/gr-filter/swig/CMakeLists.txt b/gr-filter/swig/CMakeLists.txt
new file mode 100644
index 000000000..ea8c010e0
--- /dev/null
+++ b/gr-filter/swig/CMakeLists.txt
@@ -0,0 +1,55 @@
+# 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.
+
+########################################################################
+# Setup swig generation
+########################################################################
+include(GrPython)
+include(GrSwig)
+
+set(GR_SWIG_INCLUDE_DIRS
+ ${GR_FILTER_INCLUDE_DIRS}
+ ${GR_FFT_INCLUDE_DIRS}
+ ${GNURADIO_CORE_SWIG_INCLUDE_DIRS}
+ ${GRUEL_INCLUDE_DIRS}
+ ${Boost_INCLUDE_DIRS}
+ ${FFTW3F_INCLUDE_DIRS}
+)
+
+# FIXME: rename to filter_swig_doc.i when gnuradio-core is updated
+set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/gr_filter_swig_doc.i)
+set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../lib)
+set(GR_SWIG_TARGET_DEPS filter_generated_includes)
+set(GR_SWIG_LIBRARIES gnuradio-filter gnuradio-fft)
+
+GR_SWIG_MAKE(filter_swig filter_swig.i)
+
+GR_SWIG_INSTALL(
+ TARGETS filter_swig
+ DESTINATION ${GR_PYTHON_DIR}/gnuradio/filter
+ COMPONENT "filter_python"
+)
+
+install(
+ FILES
+ filter_swig.i
+ ${CMAKE_CURRENT_BINARY_DIR}/gr_filter_swig_doc.i
+ DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig
+ COMPONENT "filter_swig"
+)
diff --git a/gr-filter/swig/filter_swig.i b/gr-filter/swig/filter_swig.i
new file mode 100644
index 000000000..05b84d4d6
--- /dev/null
+++ b/gr-filter/swig/filter_swig.i
@@ -0,0 +1,169 @@
+/* -*- 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.
+ */
+
+#define FILTER_API
+
+%include "gnuradio.i"
+
+//load generated python docstrings
+%include "gr_filter_swig_doc.i"
+
+%{
+#include "filter/firdes.h"
+#include "filter/pm_remez.h"
+#include "filter/adaptive_fir_ccc.h"
+#include "filter/adaptive_fir_ccf.h"
+#include "filter/dc_blocker_cc.h"
+#include "filter/dc_blocker_ff.h"
+#include "filter/filter_delay_fc.h"
+#include "filter/fir_filter_ccc.h"
+#include "filter/fir_filter_ccf.h"
+#include "filter/fir_filter_fcc.h"
+#include "filter/fir_filter_fff.h"
+#include "filter/fir_filter_fsf.h"
+#include "filter/fir_filter_scc.h"
+#include "filter/fft_filter_ccc.h"
+#include "filter/fft_filter_fff.h"
+#include "filter/fractional_interpolator_cc.h"
+#include "filter/fractional_interpolator_ff.h"
+#include "filter/freq_xlating_fir_filter_ccc.h"
+#include "filter/freq_xlating_fir_filter_ccf.h"
+#include "filter/freq_xlating_fir_filter_fcc.h"
+#include "filter/freq_xlating_fir_filter_fcf.h"
+#include "filter/freq_xlating_fir_filter_scf.h"
+#include "filter/freq_xlating_fir_filter_scc.h"
+#include "filter/hilbert_fc.h"
+#include "filter/iir_filter_ffd.h"
+#include "filter/interp_fir_filter_ccc.h"
+#include "filter/interp_fir_filter_ccf.h"
+#include "filter/interp_fir_filter_fcc.h"
+#include "filter/interp_fir_filter_fff.h"
+#include "filter/interp_fir_filter_fsf.h"
+#include "filter/interp_fir_filter_scc.h"
+#include "filter/pfb_arb_resampler_ccf.h"
+#include "filter/pfb_arb_resampler_fff.h"
+#include "filter/pfb_channelizer_ccf.h"
+#include "filter/pfb_decimator_ccf.h"
+#include "filter/pfb_interpolator_ccf.h"
+#include "filter/pfb_synthesizer_ccf.h"
+#include "filter/rational_resampler_base_ccc.h"
+#include "filter/rational_resampler_base_ccf.h"
+#include "filter/rational_resampler_base_fcc.h"
+#include "filter/rational_resampler_base_fff.h"
+#include "filter/rational_resampler_base_fsf.h"
+#include "filter/rational_resampler_base_scc.h"
+#include "filter/single_pole_iir_filter_cc.h"
+#include "filter/single_pole_iir_filter_ff.h"
+#include "filter/channel_model.h"
+%}
+
+%include "filter/firdes.h"
+%include "filter/pm_remez.h"
+%include "filter/adaptive_fir_ccc.h"
+%include "filter/adaptive_fir_ccf.h"
+%include "filter/dc_blocker_cc.h"
+%include "filter/dc_blocker_ff.h"
+%include "filter/filter_delay_fc.h"
+%include "filter/fir_filter_ccc.h"
+%include "filter/fir_filter_ccf.h"
+%include "filter/fir_filter_fcc.h"
+%include "filter/fir_filter_fff.h"
+%include "filter/fir_filter_fsf.h"
+%include "filter/fir_filter_scc.h"
+%include "filter/fft_filter_ccc.h"
+%include "filter/fft_filter_fff.h"
+%include "filter/fractional_interpolator_cc.h"
+%include "filter/fractional_interpolator_ff.h"
+%include "filter/freq_xlating_fir_filter_ccc.h"
+%include "filter/freq_xlating_fir_filter_ccf.h"
+%include "filter/freq_xlating_fir_filter_fcc.h"
+%include "filter/freq_xlating_fir_filter_fcf.h"
+%include "filter/freq_xlating_fir_filter_scf.h"
+%include "filter/freq_xlating_fir_filter_scc.h"
+%include "filter/hilbert_fc.h"
+%include "filter/iir_filter_ffd.h"
+%include "filter/interp_fir_filter_ccc.h"
+%include "filter/interp_fir_filter_ccf.h"
+%include "filter/interp_fir_filter_fcc.h"
+%include "filter/interp_fir_filter_fff.h"
+%include "filter/interp_fir_filter_fsf.h"
+%include "filter/interp_fir_filter_scc.h"
+%include "filter/pfb_arb_resampler_ccf.h"
+%include "filter/pfb_arb_resampler_fff.h"
+%include "filter/pfb_channelizer_ccf.h"
+%include "filter/pfb_decimator_ccf.h"
+%include "filter/pfb_interpolator_ccf.h"
+%include "filter/pfb_synthesizer_ccf.h"
+%include "filter/rational_resampler_base_ccc.h"
+%include "filter/rational_resampler_base_ccf.h"
+%include "filter/rational_resampler_base_fcc.h"
+%include "filter/rational_resampler_base_fff.h"
+%include "filter/rational_resampler_base_fsf.h"
+%include "filter/rational_resampler_base_scc.h"
+%include "filter/single_pole_iir_filter_cc.h"
+%include "filter/single_pole_iir_filter_ff.h"
+%include "filter/channel_model.h"
+
+GR_SWIG_BLOCK_MAGIC2(filter, adaptive_fir_ccc);
+GR_SWIG_BLOCK_MAGIC2(filter, adaptive_fir_ccf);
+GR_SWIG_BLOCK_MAGIC2(filter, dc_blocker_cc);
+GR_SWIG_BLOCK_MAGIC2(filter, dc_blocker_ff);
+GR_SWIG_BLOCK_MAGIC2(filter, filter_delay_fc);
+GR_SWIG_BLOCK_MAGIC2(filter, fir_filter_ccc);
+GR_SWIG_BLOCK_MAGIC2(filter, fir_filter_ccf);
+GR_SWIG_BLOCK_MAGIC2(filter, fir_filter_fcc);
+GR_SWIG_BLOCK_MAGIC2(filter, fir_filter_fff);
+GR_SWIG_BLOCK_MAGIC2(filter, fir_filter_fsf);
+GR_SWIG_BLOCK_MAGIC2(filter, fir_filter_scc);
+GR_SWIG_BLOCK_MAGIC2(filter, fft_filter_ccc);
+GR_SWIG_BLOCK_MAGIC2(filter, fft_filter_fff);
+GR_SWIG_BLOCK_MAGIC2(filter, fractional_interpolator_cc);
+GR_SWIG_BLOCK_MAGIC2(filter, fractional_interpolator_ff);
+GR_SWIG_BLOCK_MAGIC2(filter, freq_xlating_fir_filter_ccc);
+GR_SWIG_BLOCK_MAGIC2(filter, freq_xlating_fir_filter_ccf);
+GR_SWIG_BLOCK_MAGIC2(filter, freq_xlating_fir_filter_fcc);
+GR_SWIG_BLOCK_MAGIC2(filter, freq_xlating_fir_filter_fcf);
+GR_SWIG_BLOCK_MAGIC2(filter, freq_xlating_fir_filter_scf);
+GR_SWIG_BLOCK_MAGIC2(filter, freq_xlating_fir_filter_scc);
+GR_SWIG_BLOCK_MAGIC2(filter, hilbert_fc);
+GR_SWIG_BLOCK_MAGIC2(filter, iir_filter_ffd);
+GR_SWIG_BLOCK_MAGIC2(filter, interp_fir_filter_ccc);
+GR_SWIG_BLOCK_MAGIC2(filter, interp_fir_filter_ccf);
+GR_SWIG_BLOCK_MAGIC2(filter, interp_fir_filter_fcc);
+GR_SWIG_BLOCK_MAGIC2(filter, interp_fir_filter_fff);
+GR_SWIG_BLOCK_MAGIC2(filter, interp_fir_filter_fsf);
+GR_SWIG_BLOCK_MAGIC2(filter, interp_fir_filter_scc);
+GR_SWIG_BLOCK_MAGIC2(filter, pfb_arb_resampler_ccf);
+GR_SWIG_BLOCK_MAGIC2(filter, pfb_arb_resampler_fff);
+GR_SWIG_BLOCK_MAGIC2(filter, pfb_channelizer_ccf);
+GR_SWIG_BLOCK_MAGIC2(filter, pfb_decimator_ccf);
+GR_SWIG_BLOCK_MAGIC2(filter, pfb_interpolator_ccf);
+GR_SWIG_BLOCK_MAGIC2(filter, pfb_synthesizer_ccf);
+GR_SWIG_BLOCK_MAGIC2(filter, rational_resampler_base_ccc);
+GR_SWIG_BLOCK_MAGIC2(filter, rational_resampler_base_ccf);
+GR_SWIG_BLOCK_MAGIC2(filter, rational_resampler_base_fcc);
+GR_SWIG_BLOCK_MAGIC2(filter, rational_resampler_base_fff);
+GR_SWIG_BLOCK_MAGIC2(filter, rational_resampler_base_fsf);
+GR_SWIG_BLOCK_MAGIC2(filter, rational_resampler_base_scc);
+GR_SWIG_BLOCK_MAGIC2(filter, single_pole_iir_filter_cc);
+GR_SWIG_BLOCK_MAGIC2(filter, single_pole_iir_filter_ff);
+GR_SWIG_BLOCK_MAGIC2(filter, channel_model);
diff --git a/gr-howto-write-a-block/CMakeLists.txt b/gr-howto-write-a-block/CMakeLists.txt
new file mode 100644
index 000000000..02b13c6b6
--- /dev/null
+++ b/gr-howto-write-a-block/CMakeLists.txt
@@ -0,0 +1,138 @@
+# Copyright 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.
+
+
+########################################################################
+# Project setup
+########################################################################
+cmake_minimum_required(VERSION 2.6)
+project(gr-howto-write-a-block CXX C)
+enable_testing()
+
+#select the release build type by default to get optimization flags
+if(NOT CMAKE_BUILD_TYPE)
+ set(CMAKE_BUILD_TYPE "Release")
+ message(STATUS "Build type not specified: defaulting to release.")
+endif(NOT CMAKE_BUILD_TYPE)
+set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "")
+
+list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules)
+
+########################################################################
+# Compiler specific setup
+########################################################################
+if(CMAKE_COMPILER_IS_GNUCXX AND NOT WIN32)
+ #http://gcc.gnu.org/wiki/Visibility
+ add_definitions(-fvisibility=hidden)
+endif()
+
+########################################################################
+# Find boost
+########################################################################
+if(UNIX AND EXISTS "/usr/lib64")
+ list(APPEND BOOST_LIBRARYDIR "/usr/lib64") #fedora 64-bit fix
+endif(UNIX AND EXISTS "/usr/lib64")
+set(Boost_ADDITIONAL_VERSIONS
+ "1.35.0" "1.35" "1.36.0" "1.36" "1.37.0" "1.37" "1.38.0" "1.38" "1.39.0" "1.39"
+ "1.40.0" "1.40" "1.41.0" "1.41" "1.42.0" "1.42" "1.43.0" "1.43" "1.44.0" "1.44"
+ "1.45.0" "1.45" "1.46.0" "1.46" "1.47.0" "1.47" "1.48.0" "1.48" "1.49.0" "1.49"
+ "1.50.0" "1.50" "1.51.0" "1.51" "1.52.0" "1.52" "1.53.0" "1.53" "1.54.0" "1.54"
+ "1.55.0" "1.55" "1.56.0" "1.56" "1.57.0" "1.57" "1.58.0" "1.58" "1.59.0" "1.59"
+ "1.60.0" "1.60" "1.61.0" "1.61" "1.62.0" "1.62" "1.63.0" "1.63" "1.64.0" "1.64"
+ "1.65.0" "1.65" "1.66.0" "1.66" "1.67.0" "1.67" "1.68.0" "1.68" "1.69.0" "1.69"
+)
+find_package(Boost "1.35")
+
+if(NOT Boost_FOUND)
+ message(FATAL_ERROR "Boost required to compile howto")
+endif()
+
+########################################################################
+# Install directories
+########################################################################
+include(GrPlatform) #define LIB_SUFFIX
+set(GR_RUNTIME_DIR bin)
+set(GR_LIBRARY_DIR lib${LIB_SUFFIX})
+set(GR_INCLUDE_DIR include)
+set(GR_DATA_DIR share)
+set(GR_PKG_DATA_DIR ${GR_DATA_DIR}/${CMAKE_PROJECT_NAME})
+set(GR_DOC_DIR ${GR_DATA_DIR}/doc)
+set(GR_PKG_DOC_DIR ${GR_DOC_DIR}/${CMAKE_PROJECT_NAME})
+set(GR_CONF_DIR etc)
+set(GR_PKG_CONF_DIR ${GR_CONF_DIR}/${CMAKE_PROJECT_NAME}/conf.d)
+set(GR_LIBEXEC_DIR libexec)
+set(GR_PKG_LIBEXEC_DIR ${GR_LIBEXEC_DIR}/${CMAKE_PROJECT_NAME})
+set(GRC_BLOCKS_DIR ${GR_PKG_DATA_DIR}/grc/blocks)
+
+########################################################################
+# Find gnuradio build dependencies
+########################################################################
+find_package(Gruel)
+find_package(GnuradioCore)
+
+if(NOT GRUEL_FOUND)
+ message(FATAL_ERROR "Gruel required to compile howto")
+endif()
+
+if(NOT GNURADIO_CORE_FOUND)
+ message(FATAL_ERROR "GnuRadio Core required to compile howto")
+endif()
+
+########################################################################
+# Setup the include and linker paths
+########################################################################
+include_directories(
+ ${CMAKE_SOURCE_DIR}/include
+ ${GNURADIO_CORE_INCLUDE_DIRS}
+ ${GRUEL_INCLUDE_DIRS}
+ ${Boost_INCLUDE_DIRS}
+)
+
+link_directories(
+ ${GNURADIO_CORE_LIBRARY_DIRS}
+ ${GRUEL_LIBRARY_DIRS}
+ ${Boost_LIBRARY_DIRS}
+)
+
+# Set component parameters
+set(GR_HOWTO_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include CACHE INTERNAL "" FORCE)
+set(GR_HOWTO_SWIG_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/swig CACHE INTERNAL "" FORCE)
+
+########################################################################
+# Create uninstall target
+########################################################################
+configure_file(
+ ${CMAKE_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in
+ ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake
+@ONLY)
+
+add_custom_target(uninstall
+ ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake
+)
+
+########################################################################
+# Add subdirectories
+########################################################################
+add_subdirectory(include)
+add_subdirectory(lib)
+add_subdirectory(swig)
+add_subdirectory(python)
+add_subdirectory(grc)
+add_subdirectory(apps)
+add_subdirectory(docs)
diff --git a/gr-howto-write-a-block/apps/CMakeLists.txt b/gr-howto-write-a-block/apps/CMakeLists.txt
new file mode 100644
index 000000000..875b6b4ce
--- /dev/null
+++ b/gr-howto-write-a-block/apps/CMakeLists.txt
@@ -0,0 +1,26 @@
+# Copyright 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.
+
+include(GrPython)
+
+GR_PYTHON_INSTALL(
+ PROGRAMS
+ howto_square.py
+ DESTINATION bin
+)
diff --git a/gr-howto-write-a-block/apps/howto_square.grc b/gr-howto-write-a-block/apps/howto_square.grc
new file mode 100644
index 000000000..a8563698b
--- /dev/null
+++ b/gr-howto-write-a-block/apps/howto_square.grc
@@ -0,0 +1,325 @@
+<?xml version='1.0' encoding='ASCII'?>
+<flow_graph>
+ <timestamp>Thu Nov 12 11:26:07 2009</timestamp>
+ <block>
+ <key>options</key>
+ <param>
+ <key>id</key>
+ <value>howto_square</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>title</key>
+ <value></value>
+ </param>
+ <param>
+ <key>author</key>
+ <value></value>
+ </param>
+ <param>
+ <key>description</key>
+ <value></value>
+ </param>
+ <param>
+ <key>window_size</key>
+ <value>1280, 1024</value>
+ </param>
+ <param>
+ <key>generate_options</key>
+ <value>wx_gui</value>
+ </param>
+ <param>
+ <key>category</key>
+ <value>Custom</value>
+ </param>
+ <param>
+ <key>run_options</key>
+ <value>prompt</value>
+ </param>
+ <param>
+ <key>run</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>realtime_scheduling</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(10, 10)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable</key>
+ <param>
+ <key>id</key>
+ <value>samp_rate</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>10e3</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(10, 170)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>wxgui_scopesink2</key>
+ <param>
+ <key>id</key>
+ <value>sink</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>float</value>
+ </param>
+ <param>
+ <key>title</key>
+ <value>Input</value>
+ </param>
+ <param>
+ <key>samp_rate</key>
+ <value>samp_rate</value>
+ </param>
+ <param>
+ <key>v_scale</key>
+ <value>20</value>
+ </param>
+ <param>
+ <key>v_offset</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>t_scale</key>
+ <value>0.002</value>
+ </param>
+ <param>
+ <key>ac_couple</key>
+ <value>False</value>
+ </param>
+ <param>
+ <key>xy_mode</key>
+ <value>False</value>
+ </param>
+ <param>
+ <key>num_inputs</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>win_size</key>
+ <value></value>
+ </param>
+ <param>
+ <key>grid_pos</key>
+ <value></value>
+ </param>
+ <param>
+ <key>notebook</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(691, 222)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>howto_square_ff</key>
+ <param>
+ <key>id</key>
+ <value>sqr</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(709, 344)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>gr_throttle</key>
+ <param>
+ <key>id</key>
+ <value>thr</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>float</value>
+ </param>
+ <param>
+ <key>samples_per_second</key>
+ <value>samp_rate</value>
+ </param>
+ <param>
+ <key>vlen</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(497, 340)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>gr_vector_source_x</key>
+ <param>
+ <key>id</key>
+ <value>src</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>float</value>
+ </param>
+ <param>
+ <key>vector</key>
+ <value>[float(n)-50 for n in range(100)]</value>
+ </param>
+ <param>
+ <key>repeat</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>vlen</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(246, 332)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>wxgui_scopesink2</key>
+ <param>
+ <key>id</key>
+ <value>sink2</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>float</value>
+ </param>
+ <param>
+ <key>title</key>
+ <value>Output</value>
+ </param>
+ <param>
+ <key>samp_rate</key>
+ <value>samp_rate</value>
+ </param>
+ <param>
+ <key>v_scale</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>v_offset</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>t_scale</key>
+ <value>0.002</value>
+ </param>
+ <param>
+ <key>ac_couple</key>
+ <value>False</value>
+ </param>
+ <param>
+ <key>xy_mode</key>
+ <value>False</value>
+ </param>
+ <param>
+ <key>num_inputs</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>win_size</key>
+ <value></value>
+ </param>
+ <param>
+ <key>grid_pos</key>
+ <value></value>
+ </param>
+ <param>
+ <key>notebook</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(869, 324)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <connection>
+ <source_block_id>thr</source_block_id>
+ <sink_block_id>sqr</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>src</source_block_id>
+ <sink_block_id>thr</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>thr</source_block_id>
+ <sink_block_id>sink</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>sqr</source_block_id>
+ <sink_block_id>sink2</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+</flow_graph>
diff --git a/gr-howto-write-a-block/apps/howto_square.py b/gr-howto-write-a-block/apps/howto_square.py
new file mode 100755
index 000000000..f14e28325
--- /dev/null
+++ b/gr-howto-write-a-block/apps/howto_square.py
@@ -0,0 +1,77 @@
+#!/usr/bin/env python
+##################################################
+# Gnuradio Python Flow Graph
+# Title: Howto Square
+# Generated: Thu Nov 12 11:26:07 2009
+##################################################
+
+import howto
+from gnuradio import eng_notation
+from gnuradio import gr
+from gnuradio.eng_option import eng_option
+from gnuradio.gr import firdes
+from gnuradio.wxgui import scopesink2
+from grc_gnuradio import wxgui as grc_wxgui
+from optparse import OptionParser
+import wx
+
+class howto_square(grc_wxgui.top_block_gui):
+
+ def __init__(self):
+ grc_wxgui.top_block_gui.__init__(self, title="Howto Square")
+
+ ##################################################
+ # Variables
+ ##################################################
+ self.samp_rate = samp_rate = 10e3
+
+ ##################################################
+ # Blocks
+ ##################################################
+ self.sink = scopesink2.scope_sink_f(
+ self.GetWin(),
+ title="Input",
+ sample_rate=samp_rate,
+ v_scale=20,
+ v_offset=0,
+ t_scale=0.002,
+ ac_couple=False,
+ xy_mode=False,
+ num_inputs=1,
+ )
+ self.Add(self.sink.win)
+ self.sink2 = scopesink2.scope_sink_f(
+ self.GetWin(),
+ title="Output",
+ sample_rate=samp_rate,
+ v_scale=0,
+ v_offset=0,
+ t_scale=0.002,
+ ac_couple=False,
+ xy_mode=False,
+ num_inputs=1,
+ )
+ self.Add(self.sink2.win)
+ self.sqr = howto.square_ff()
+ self.src = gr.vector_source_f(([float(n)-50 for n in range(100)]), True, 1)
+ self.thr = gr.throttle(gr.sizeof_float*1, samp_rate)
+
+ ##################################################
+ # Connections
+ ##################################################
+ self.connect((self.thr, 0), (self.sqr, 0))
+ self.connect((self.src, 0), (self.thr, 0))
+ self.connect((self.thr, 0), (self.sink, 0))
+ self.connect((self.sqr, 0), (self.sink2, 0))
+
+ def set_samp_rate(self, samp_rate):
+ self.samp_rate = samp_rate
+ self.sink.set_sample_rate(self.samp_rate)
+ self.sink2.set_sample_rate(self.samp_rate)
+
+if __name__ == '__main__':
+ parser = OptionParser(option_class=eng_option, usage="%prog: [options]")
+ (options, args) = parser.parse_args()
+ tb = howto_square()
+ tb.Run(True)
+
diff --git a/gr-howto-write-a-block/cmake/Modules/CMakeParseArgumentsCopy.cmake b/gr-howto-write-a-block/cmake/Modules/CMakeParseArgumentsCopy.cmake
new file mode 100644
index 000000000..7ce4c49ae
--- /dev/null
+++ b/gr-howto-write-a-block/cmake/Modules/CMakeParseArgumentsCopy.cmake
@@ -0,0 +1,138 @@
+# CMAKE_PARSE_ARGUMENTS(<prefix> <options> <one_value_keywords> <multi_value_keywords> args...)
+#
+# CMAKE_PARSE_ARGUMENTS() is intended to be used in macros or functions for
+# parsing the arguments given to that macro or function.
+# It processes the arguments and defines a set of variables which hold the
+# values of the respective options.
+#
+# The <options> argument contains all options for the respective macro,
+# i.e. keywords which can be used when calling the macro without any value
+# following, like e.g. the OPTIONAL keyword of the install() command.
+#
+# The <one_value_keywords> argument contains all keywords for this macro
+# which are followed by one value, like e.g. DESTINATION keyword of the
+# install() command.
+#
+# The <multi_value_keywords> argument contains all keywords for this macro
+# which can be followed by more than one value, like e.g. the TARGETS or
+# FILES keywords of the install() command.
+#
+# When done, CMAKE_PARSE_ARGUMENTS() will have defined for each of the
+# keywords listed in <options>, <one_value_keywords> and
+# <multi_value_keywords> a variable composed of the given <prefix>
+# followed by "_" and the name of the respective keyword.
+# These variables will then hold the respective value from the argument list.
+# For the <options> keywords this will be TRUE or FALSE.
+#
+# All remaining arguments are collected in a variable
+# <prefix>_UNPARSED_ARGUMENTS, this can be checked afterwards to see whether
+# your macro was called with unrecognized parameters.
+#
+# As an example here a my_install() macro, which takes similar arguments as the
+# real install() command:
+#
+# function(MY_INSTALL)
+# set(options OPTIONAL FAST)
+# set(oneValueArgs DESTINATION RENAME)
+# set(multiValueArgs TARGETS CONFIGURATIONS)
+# cmake_parse_arguments(MY_INSTALL "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
+# ...
+#
+# Assume my_install() has been called like this:
+# my_install(TARGETS foo bar DESTINATION bin OPTIONAL blub)
+#
+# After the cmake_parse_arguments() call the macro will have set the following
+# variables:
+# MY_INSTALL_OPTIONAL = TRUE
+# MY_INSTALL_FAST = FALSE (this option was not used when calling my_install()
+# MY_INSTALL_DESTINATION = "bin"
+# MY_INSTALL_RENAME = "" (was not used)
+# MY_INSTALL_TARGETS = "foo;bar"
+# MY_INSTALL_CONFIGURATIONS = "" (was not used)
+# MY_INSTALL_UNPARSED_ARGUMENTS = "blub" (no value expected after "OPTIONAL"
+#
+# You can the continue and process these variables.
+#
+# Keywords terminate lists of values, e.g. if directly after a one_value_keyword
+# another recognized keyword follows, this is interpreted as the beginning of
+# the new option.
+# E.g. my_install(TARGETS foo DESTINATION OPTIONAL) would result in
+# MY_INSTALL_DESTINATION set to "OPTIONAL", but MY_INSTALL_DESTINATION would
+# be empty and MY_INSTALL_OPTIONAL would be set to TRUE therefor.
+
+#=============================================================================
+# Copyright 2010 Alexander Neundorf <neundorf@kde.org>
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+
+if(__CMAKE_PARSE_ARGUMENTS_INCLUDED)
+ return()
+endif()
+set(__CMAKE_PARSE_ARGUMENTS_INCLUDED TRUE)
+
+
+function(CMAKE_PARSE_ARGUMENTS prefix _optionNames _singleArgNames _multiArgNames)
+ # first set all result variables to empty/FALSE
+ foreach(arg_name ${_singleArgNames} ${_multiArgNames})
+ set(${prefix}_${arg_name})
+ endforeach(arg_name)
+
+ foreach(option ${_optionNames})
+ set(${prefix}_${option} FALSE)
+ endforeach(option)
+
+ set(${prefix}_UNPARSED_ARGUMENTS)
+
+ set(insideValues FALSE)
+ set(currentArgName)
+
+ # now iterate over all arguments and fill the result variables
+ foreach(currentArg ${ARGN})
+ list(FIND _optionNames "${currentArg}" optionIndex) # ... then this marks the end of the arguments belonging to this keyword
+ list(FIND _singleArgNames "${currentArg}" singleArgIndex) # ... then this marks the end of the arguments belonging to this keyword
+ list(FIND _multiArgNames "${currentArg}" multiArgIndex) # ... then this marks the end of the arguments belonging to this keyword
+
+ if(${optionIndex} EQUAL -1 AND ${singleArgIndex} EQUAL -1 AND ${multiArgIndex} EQUAL -1)
+ if(insideValues)
+ if("${insideValues}" STREQUAL "SINGLE")
+ set(${prefix}_${currentArgName} ${currentArg})
+ set(insideValues FALSE)
+ elseif("${insideValues}" STREQUAL "MULTI")
+ list(APPEND ${prefix}_${currentArgName} ${currentArg})
+ endif()
+ else(insideValues)
+ list(APPEND ${prefix}_UNPARSED_ARGUMENTS ${currentArg})
+ endif(insideValues)
+ else()
+ if(NOT ${optionIndex} EQUAL -1)
+ set(${prefix}_${currentArg} TRUE)
+ set(insideValues FALSE)
+ elseif(NOT ${singleArgIndex} EQUAL -1)
+ set(currentArgName ${currentArg})
+ set(${prefix}_${currentArgName})
+ set(insideValues "SINGLE")
+ elseif(NOT ${multiArgIndex} EQUAL -1)
+ set(currentArgName ${currentArg})
+ set(${prefix}_${currentArgName})
+ set(insideValues "MULTI")
+ endif()
+ endif()
+
+ endforeach(currentArg)
+
+ # propagate the result variables to the caller:
+ foreach(arg_name ${_singleArgNames} ${_multiArgNames} ${_optionNames})
+ set(${prefix}_${arg_name} ${${prefix}_${arg_name}} PARENT_SCOPE)
+ endforeach(arg_name)
+ set(${prefix}_UNPARSED_ARGUMENTS ${${prefix}_UNPARSED_ARGUMENTS} PARENT_SCOPE)
+
+endfunction(CMAKE_PARSE_ARGUMENTS _options _singleArgs _multiArgs)
diff --git a/gr-howto-write-a-block/cmake/Modules/FindGnuradioCore.cmake b/gr-howto-write-a-block/cmake/Modules/FindGnuradioCore.cmake
new file mode 100644
index 000000000..3773588a7
--- /dev/null
+++ b/gr-howto-write-a-block/cmake/Modules/FindGnuradioCore.cmake
@@ -0,0 +1,26 @@
+INCLUDE(FindPkgConfig)
+PKG_CHECK_MODULES(PC_GNURADIO_CORE gnuradio-core)
+
+FIND_PATH(
+ GNURADIO_CORE_INCLUDE_DIRS
+ NAMES gr_random.h
+ HINTS $ENV{GNURADIO_CORE_DIR}/include/gnuradio
+ ${PC_GNURADIO_CORE_INCLUDEDIR}
+ PATHS /usr/local/include/gnuradio
+ /usr/include/gnuradio
+)
+
+FIND_LIBRARY(
+ GNURADIO_CORE_LIBRARIES
+ NAMES gnuradio-core
+ HINTS $ENV{GNURADIO_CORE_DIR}/lib
+ ${PC_GNURADIO_CORE_LIBDIR}
+ PATHS /usr/local/lib
+ /usr/local/lib64
+ /usr/lib
+ /usr/lib64
+)
+
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(GNURADIO_CORE DEFAULT_MSG GNURADIO_CORE_LIBRARIES GNURADIO_CORE_INCLUDE_DIRS)
+MARK_AS_ADVANCED(GNURADIO_CORE_LIBRARIES GNURADIO_CORE_INCLUDE_DIRS)
diff --git a/gr-howto-write-a-block/cmake/Modules/FindGruel.cmake b/gr-howto-write-a-block/cmake/Modules/FindGruel.cmake
new file mode 100644
index 000000000..58dff7044
--- /dev/null
+++ b/gr-howto-write-a-block/cmake/Modules/FindGruel.cmake
@@ -0,0 +1,26 @@
+INCLUDE(FindPkgConfig)
+PKG_CHECK_MODULES(PC_GRUEL gruel)
+
+FIND_PATH(
+ GRUEL_INCLUDE_DIRS
+ NAMES gruel/attributes.h
+ HINTS $ENV{GRUEL_DIR}/include
+ ${PC_GRUEL_INCLUDEDIR}
+ PATHS /usr/local/include
+ /usr/include
+)
+
+FIND_LIBRARY(
+ GRUEL_LIBRARIES
+ NAMES gruel
+ HINTS $ENV{GRUEL_DIR}/lib
+ ${PC_GRUEL_LIBDIR}
+ PATHS /usr/local/lib
+ /usr/local/lib64
+ /usr/lib
+ /usr/lib64
+)
+
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(GRUEL DEFAULT_MSG GRUEL_LIBRARIES GRUEL_INCLUDE_DIRS)
+MARK_AS_ADVANCED(GRUEL_LIBRARIES GRUEL_INCLUDE_DIRS)
diff --git a/gr-howto-write-a-block/cmake/Modules/GrMiscUtils.cmake b/gr-howto-write-a-block/cmake/Modules/GrMiscUtils.cmake
new file mode 100644
index 000000000..9331d5deb
--- /dev/null
+++ b/gr-howto-write-a-block/cmake/Modules/GrMiscUtils.cmake
@@ -0,0 +1,210 @@
+# 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.
+
+if(DEFINED __INCLUDED_GR_MISC_UTILS_CMAKE)
+ return()
+endif()
+set(__INCLUDED_GR_MISC_UTILS_CMAKE TRUE)
+
+########################################################################
+# Set global variable macro.
+# Used for subdirectories to export settings.
+# Example: include and library paths.
+########################################################################
+function(GR_SET_GLOBAL var)
+ set(${var} ${ARGN} CACHE INTERNAL "" FORCE)
+endfunction(GR_SET_GLOBAL)
+
+########################################################################
+# Set the pre-processor definition if the condition is true.
+# - def the pre-processor definition to set and condition name
+########################################################################
+function(GR_ADD_COND_DEF def)
+ if(${def})
+ add_definitions(-D${def})
+ endif(${def})
+endfunction(GR_ADD_COND_DEF)
+
+########################################################################
+# Check for a header and conditionally set a compile define.
+# - hdr the relative path to the header file
+# - def the pre-processor definition to set
+########################################################################
+function(GR_CHECK_HDR_N_DEF hdr def)
+ include(CheckIncludeFileCXX)
+ CHECK_INCLUDE_FILE_CXX(${hdr} ${def})
+ GR_ADD_COND_DEF(${def})
+endfunction(GR_CHECK_HDR_N_DEF)
+
+########################################################################
+# Include subdirectory macro.
+# Sets the CMake directory variables,
+# includes the subdirectory CMakeLists.txt,
+# resets the CMake directory variables.
+#
+# This macro includes subdirectories rather than adding them
+# so that the subdirectory can affect variables in the level above.
+# This provides a work-around for the lack of convenience libraries.
+# This way a subdirectory can append to the list of library sources.
+########################################################################
+macro(GR_INCLUDE_SUBDIRECTORY subdir)
+ #insert the current directories on the front of the list
+ list(INSERT _cmake_source_dirs 0 ${CMAKE_CURRENT_SOURCE_DIR})
+ list(INSERT _cmake_binary_dirs 0 ${CMAKE_CURRENT_BINARY_DIR})
+
+ #set the current directories to the names of the subdirs
+ set(CMAKE_CURRENT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/${subdir})
+ set(CMAKE_CURRENT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/${subdir})
+
+ #include the subdirectory CMakeLists to run it
+ file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
+ include(${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt)
+
+ #reset the value of the current directories
+ list(GET _cmake_source_dirs 0 CMAKE_CURRENT_SOURCE_DIR)
+ list(GET _cmake_binary_dirs 0 CMAKE_CURRENT_BINARY_DIR)
+
+ #pop the subdir names of the front of the list
+ list(REMOVE_AT _cmake_source_dirs 0)
+ list(REMOVE_AT _cmake_binary_dirs 0)
+endmacro(GR_INCLUDE_SUBDIRECTORY)
+
+########################################################################
+# Check if a compiler flag works and conditionally set a compile define.
+# - flag the compiler flag to check for
+# - have the variable to set with result
+########################################################################
+macro(GR_ADD_CXX_COMPILER_FLAG_IF_AVAILABLE flag have)
+ include(CheckCXXCompilerFlag)
+ CHECK_CXX_COMPILER_FLAG(${flag} ${have})
+ if(${have})
+ add_definitions(${flag})
+ endif(${have})
+endmacro(GR_ADD_CXX_COMPILER_FLAG_IF_AVAILABLE)
+
+########################################################################
+# Generates the .la libtool file
+# This appears to generate libtool files that cannot be used by auto*.
+# Usage GR_LIBTOOL(TARGET [target] DESTINATION [dest])
+# Notice: there is not COMPONENT option, these will not get distributed.
+########################################################################
+function(GR_LIBTOOL)
+ if(NOT DEFINED GENERATE_LIBTOOL)
+ set(GENERATE_LIBTOOL OFF) #disabled by default
+ endif()
+
+ if(GENERATE_LIBTOOL)
+ include(CMakeParseArgumentsCopy)
+ CMAKE_PARSE_ARGUMENTS(GR_LIBTOOL "" "TARGET;DESTINATION" "" ${ARGN})
+
+ find_program(LIBTOOL libtool)
+ if(LIBTOOL)
+ include(CMakeMacroLibtoolFile)
+ CREATE_LIBTOOL_FILE(${GR_LIBTOOL_TARGET} /${GR_LIBTOOL_DESTINATION})
+ endif(LIBTOOL)
+ endif(GENERATE_LIBTOOL)
+
+endfunction(GR_LIBTOOL)
+
+########################################################################
+# Do standard things to the library target
+# - set target properties
+# - make install rules
+# Also handle gnuradio custom naming conventions w/ extras mode.
+########################################################################
+function(GR_LIBRARY_FOO target)
+ #parse the arguments for component names
+ include(CMakeParseArgumentsCopy)
+ CMAKE_PARSE_ARGUMENTS(GR_LIBRARY "" "RUNTIME_COMPONENT;DEVEL_COMPONENT" "" ${ARGN})
+
+ #set additional target properties
+ set_target_properties(${target} PROPERTIES SOVERSION ${LIBVER})
+
+ #install the generated files like so...
+ install(TARGETS ${target}
+ LIBRARY DESTINATION ${GR_LIBRARY_DIR} COMPONENT ${GR_LIBRARY_RUNTIME_COMPONENT} # .so/.dylib file
+ ARCHIVE DESTINATION ${GR_LIBRARY_DIR} COMPONENT ${GR_LIBRARY_DEVEL_COMPONENT} # .lib file
+ RUNTIME DESTINATION ${GR_RUNTIME_DIR} COMPONENT ${GR_LIBRARY_RUNTIME_COMPONENT} # .dll file
+ )
+
+ #extras mode enabled automatically on linux
+ if(NOT DEFINED LIBRARY_EXTRAS)
+ set(LIBRARY_EXTRAS ${LINUX})
+ endif()
+
+ #special extras mode to enable alternative naming conventions
+ if(LIBRARY_EXTRAS)
+
+ #create .la file before changing props
+ GR_LIBTOOL(TARGET ${target} DESTINATION ${GR_LIBRARY_DIR})
+
+ #give the library a special name with ultra-zero soversion
+ set_target_properties(${target} PROPERTIES LIBRARY_OUTPUT_NAME ${target}-${LIBVER} SOVERSION "0.0.0")
+ set(target_name lib${target}-${LIBVER}.so.0.0.0)
+
+ #custom command to generate symlinks
+ add_custom_command(
+ TARGET ${target}
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E create_symlink ${target_name} ${CMAKE_CURRENT_BINARY_DIR}/lib${target}.so
+ COMMAND ${CMAKE_COMMAND} -E create_symlink ${target_name} ${CMAKE_CURRENT_BINARY_DIR}/lib${target}-${LIBVER}.so.0
+ COMMAND ${CMAKE_COMMAND} -E touch ${target_name} #so the symlinks point to something valid so cmake 2.6 will install
+ )
+
+ #and install the extra symlinks
+ install(
+ FILES
+ ${CMAKE_CURRENT_BINARY_DIR}/lib${target}.so
+ ${CMAKE_CURRENT_BINARY_DIR}/lib${target}-${LIBVER}.so.0
+ DESTINATION ${GR_LIBRARY_DIR} COMPONENT ${GR_LIBRARY_RUNTIME_COMPONENT}
+ )
+
+ endif(LIBRARY_EXTRAS)
+endfunction(GR_LIBRARY_FOO)
+
+########################################################################
+# Create a dummy custom command that depends on other targets.
+# Usage:
+# GR_GEN_TARGET_DEPS(unique_name target_deps <target1> <target2> ...)
+# ADD_CUSTOM_COMMAND(<the usual args> ${target_deps})
+#
+# Custom command cant depend on targets, but can depend on executables,
+# and executables can depend on targets. So this is the process:
+########################################################################
+function(GR_GEN_TARGET_DEPS name var)
+ file(
+ WRITE ${CMAKE_CURRENT_BINARY_DIR}/${name}.cpp.in
+ "int main(void){return 0;}\n"
+ )
+ execute_process(
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different
+ ${CMAKE_CURRENT_BINARY_DIR}/${name}.cpp.in
+ ${CMAKE_CURRENT_BINARY_DIR}/${name}.cpp
+ )
+ add_executable(${name} ${CMAKE_CURRENT_BINARY_DIR}/${name}.cpp)
+ if(ARGN)
+ add_dependencies(${name} ${ARGN})
+ endif(ARGN)
+
+ if(CMAKE_CROSSCOMPILING)
+ set(${var} "DEPENDS;${name}" PARENT_SCOPE) #cant call command when cross
+ else()
+ set(${var} "DEPENDS;${name};COMMAND;${name}" PARENT_SCOPE)
+ endif()
+endfunction(GR_GEN_TARGET_DEPS)
diff --git a/gr-howto-write-a-block/cmake/Modules/GrPlatform.cmake b/gr-howto-write-a-block/cmake/Modules/GrPlatform.cmake
new file mode 100644
index 000000000..a2e4f3b34
--- /dev/null
+++ b/gr-howto-write-a-block/cmake/Modules/GrPlatform.cmake
@@ -0,0 +1,46 @@
+# Copyright 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.
+
+if(DEFINED __INCLUDED_GR_PLATFORM_CMAKE)
+ return()
+endif()
+set(__INCLUDED_GR_PLATFORM_CMAKE TRUE)
+
+########################################################################
+# Setup additional defines for OS types
+########################################################################
+if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
+ set(LINUX TRUE)
+endif()
+
+if(LINUX AND EXISTS "/etc/debian_version")
+ set(DEBIAN TRUE)
+endif()
+
+if(LINUX AND EXISTS "/etc/redhat-release")
+ set(REDHAT TRUE)
+endif()
+
+########################################################################
+# when the library suffix should be 64 (applies to redhat linux family)
+########################################################################
+if(NOT DEFINED LIB_SUFFIX AND REDHAT AND CMAKE_SYSTEM_PROCESSOR MATCHES "64$")
+ set(LIB_SUFFIX 64)
+endif()
+set(LIB_SUFFIX ${LIB_SUFFIX} CACHE STRING "lib directory suffix")
diff --git a/gr-howto-write-a-block/cmake/Modules/GrPython.cmake b/gr-howto-write-a-block/cmake/Modules/GrPython.cmake
new file mode 100644
index 000000000..efdddf371
--- /dev/null
+++ b/gr-howto-write-a-block/cmake/Modules/GrPython.cmake
@@ -0,0 +1,227 @@
+# 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.
+
+if(DEFINED __INCLUDED_GR_PYTHON_CMAKE)
+ return()
+endif()
+set(__INCLUDED_GR_PYTHON_CMAKE TRUE)
+
+########################################################################
+# Setup the python interpreter:
+# This allows the user to specify a specific interpreter,
+# or finds the interpreter via the built-in cmake module.
+########################################################################
+#this allows the user to override PYTHON_EXECUTABLE
+if(PYTHON_EXECUTABLE)
+
+ set(PYTHONINTERP_FOUND TRUE)
+
+#otherwise if not set, try to automatically find it
+else(PYTHON_EXECUTABLE)
+
+ #use the built-in find script
+ find_package(PythonInterp)
+
+ #and if that fails use the find program routine
+ if(NOT PYTHONINTERP_FOUND)
+ find_program(PYTHON_EXECUTABLE NAMES python python2.7 python2.6 python2.5)
+ if(PYTHON_EXECUTABLE)
+ set(PYTHONINTERP_FOUND TRUE)
+ endif(PYTHON_EXECUTABLE)
+ endif(NOT PYTHONINTERP_FOUND)
+
+endif(PYTHON_EXECUTABLE)
+
+#make the path to the executable appear in the cmake gui
+set(PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE} CACHE FILEPATH "python interpreter")
+
+#make sure we can use -B with python (introduced in 2.6)
+if(PYTHON_EXECUTABLE)
+ execute_process(
+ COMMAND ${PYTHON_EXECUTABLE} -B -c ""
+ OUTPUT_QUIET ERROR_QUIET
+ RESULT_VARIABLE PYTHON_HAS_DASH_B_RESULT
+ )
+ if(PYTHON_HAS_DASH_B_RESULT EQUAL 0)
+ set(PYTHON_DASH_B "-B")
+ endif()
+endif(PYTHON_EXECUTABLE)
+
+########################################################################
+# Check for the existence of a python module:
+# - desc a string description of the check
+# - mod the name of the module to import
+# - cmd an additional command to run
+# - have the result variable to set
+########################################################################
+macro(GR_PYTHON_CHECK_MODULE desc mod cmd have)
+ message(STATUS "")
+ message(STATUS "Python checking for ${desc}")
+ execute_process(
+ COMMAND ${PYTHON_EXECUTABLE} -c "
+#########################################
+try: import ${mod}
+except: exit(-1)
+try: assert ${cmd}
+except: exit(-1)
+#########################################"
+ RESULT_VARIABLE ${have}
+ )
+ if(${have} EQUAL 0)
+ message(STATUS "Python checking for ${desc} - found")
+ set(${have} TRUE)
+ else(${have} EQUAL 0)
+ message(STATUS "Python checking for ${desc} - not found")
+ set(${have} FALSE)
+ endif(${have} EQUAL 0)
+endmacro(GR_PYTHON_CHECK_MODULE)
+
+########################################################################
+# Sets the python installation directory GR_PYTHON_DIR
+########################################################################
+execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "
+from distutils import sysconfig
+print sysconfig.get_python_lib(plat_specific=True, prefix='')
+" OUTPUT_VARIABLE GR_PYTHON_DIR OUTPUT_STRIP_TRAILING_WHITESPACE
+)
+file(TO_CMAKE_PATH ${GR_PYTHON_DIR} GR_PYTHON_DIR)
+
+########################################################################
+# Create an always-built target with a unique name
+# Usage: GR_UNIQUE_TARGET(<description> <dependencies list>)
+########################################################################
+function(GR_UNIQUE_TARGET desc)
+ file(RELATIVE_PATH reldir ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR})
+ execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import re, hashlib
+unique = hashlib.md5('${reldir}${ARGN}').hexdigest()[:5]
+print(re.sub('\\W', '_', '${desc} ${reldir} ' + unique))"
+ OUTPUT_VARIABLE _target OUTPUT_STRIP_TRAILING_WHITESPACE)
+ add_custom_target(${_target} ALL DEPENDS ${ARGN})
+endfunction(GR_UNIQUE_TARGET)
+
+########################################################################
+# Install python sources (also builds and installs byte-compiled python)
+########################################################################
+function(GR_PYTHON_INSTALL)
+ include(CMakeParseArgumentsCopy)
+ CMAKE_PARSE_ARGUMENTS(GR_PYTHON_INSTALL "" "DESTINATION;COMPONENT" "FILES;PROGRAMS" ${ARGN})
+
+ ####################################################################
+ if(GR_PYTHON_INSTALL_FILES)
+ ####################################################################
+ install(${ARGN}) #installs regular python files
+
+ #create a list of all generated files
+ unset(pysrcfiles)
+ unset(pycfiles)
+ unset(pyofiles)
+ foreach(pyfile ${GR_PYTHON_INSTALL_FILES})
+ get_filename_component(pyfile ${pyfile} ABSOLUTE)
+ list(APPEND pysrcfiles ${pyfile})
+
+ #determine if this file is in the source or binary directory
+ file(RELATIVE_PATH source_rel_path ${CMAKE_CURRENT_SOURCE_DIR} ${pyfile})
+ string(LENGTH "${source_rel_path}" source_rel_path_len)
+ file(RELATIVE_PATH binary_rel_path ${CMAKE_CURRENT_BINARY_DIR} ${pyfile})
+ string(LENGTH "${binary_rel_path}" binary_rel_path_len)
+
+ #and set the generated path appropriately
+ if(${source_rel_path_len} GREATER ${binary_rel_path_len})
+ set(pygenfile ${CMAKE_CURRENT_BINARY_DIR}/${binary_rel_path})
+ else()
+ set(pygenfile ${CMAKE_CURRENT_BINARY_DIR}/${source_rel_path})
+ endif()
+ list(APPEND pycfiles ${pygenfile}c)
+ list(APPEND pyofiles ${pygenfile}o)
+
+ #ensure generation path exists
+ get_filename_component(pygen_path ${pygenfile} PATH)
+ file(MAKE_DIRECTORY ${pygen_path})
+
+ endforeach(pyfile)
+
+ #the command to generate the pyc files
+ add_custom_command(
+ DEPENDS ${pysrcfiles} OUTPUT ${pycfiles}
+ COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_BINARY_DIR}/python_compile_helper.py ${pysrcfiles} ${pycfiles}
+ )
+
+ #the command to generate the pyo files
+ add_custom_command(
+ DEPENDS ${pysrcfiles} OUTPUT ${pyofiles}
+ COMMAND ${PYTHON_EXECUTABLE} -O ${CMAKE_BINARY_DIR}/python_compile_helper.py ${pysrcfiles} ${pyofiles}
+ )
+
+ #create install rule and add generated files to target list
+ set(python_install_gen_targets ${pycfiles} ${pyofiles})
+ install(FILES ${python_install_gen_targets}
+ DESTINATION ${GR_PYTHON_INSTALL_DESTINATION}
+ COMPONENT ${GR_PYTHON_INSTALL_COMPONENT}
+ )
+
+
+ ####################################################################
+ elseif(GR_PYTHON_INSTALL_PROGRAMS)
+ ####################################################################
+ file(TO_NATIVE_PATH ${PYTHON_EXECUTABLE} pyexe_native)
+
+ foreach(pyfile ${GR_PYTHON_INSTALL_PROGRAMS})
+ get_filename_component(pyfile_name ${pyfile} NAME)
+ get_filename_component(pyfile ${pyfile} ABSOLUTE)
+ string(REPLACE "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" pyexefile "${pyfile}.exe")
+ list(APPEND python_install_gen_targets ${pyexefile})
+
+ get_filename_component(pyexefile_path ${pyexefile} PATH)
+ file(MAKE_DIRECTORY ${pyexefile_path})
+
+ add_custom_command(
+ OUTPUT ${pyexefile} DEPENDS ${pyfile}
+ COMMAND ${PYTHON_EXECUTABLE} -c
+ \"open('${pyexefile}', 'w').write('\#!${pyexe_native}\\n'+open('${pyfile}').read())\"
+ COMMENT "Shebangin ${pyfile_name}"
+ )
+
+ #on windows, python files need an extension to execute
+ get_filename_component(pyfile_ext ${pyfile} EXT)
+ if(WIN32 AND NOT pyfile_ext)
+ set(pyfile_name "${pyfile_name}.py")
+ endif()
+
+ install(PROGRAMS ${pyexefile} RENAME ${pyfile_name}
+ DESTINATION ${GR_PYTHON_INSTALL_DESTINATION}
+ COMPONENT ${GR_PYTHON_INSTALL_COMPONENT}
+ )
+ endforeach(pyfile)
+
+ endif()
+
+ GR_UNIQUE_TARGET("pygen" ${python_install_gen_targets})
+
+endfunction(GR_PYTHON_INSTALL)
+
+########################################################################
+# Write the python helper script that generates byte code files
+########################################################################
+file(WRITE ${CMAKE_BINARY_DIR}/python_compile_helper.py "
+import sys, py_compile
+files = sys.argv[1:]
+srcs, gens = files[:len(files)/2], files[len(files)/2:]
+for src, gen in zip(srcs, gens):
+ py_compile.compile(file=src, cfile=gen, doraise=True)
+")
diff --git a/gr-howto-write-a-block/cmake/Modules/GrSwig.cmake b/gr-howto-write-a-block/cmake/Modules/GrSwig.cmake
new file mode 100644
index 000000000..51a753ec5
--- /dev/null
+++ b/gr-howto-write-a-block/cmake/Modules/GrSwig.cmake
@@ -0,0 +1,229 @@
+# 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.
+
+if(DEFINED __INCLUDED_GR_SWIG_CMAKE)
+ return()
+endif()
+set(__INCLUDED_GR_SWIG_CMAKE TRUE)
+
+include(GrPython)
+
+########################################################################
+# Builds a swig documentation file to be generated into python docstrings
+# Usage: GR_SWIG_MAKE_DOCS(output_file input_path input_path....)
+#
+# Set the following variable to specify extra dependent targets:
+# - GR_SWIG_DOCS_SOURCE_DEPS
+# - GR_SWIG_DOCS_TARGET_DEPS
+########################################################################
+function(GR_SWIG_MAKE_DOCS output_file)
+ find_package(Doxygen)
+ if(DOXYGEN_FOUND)
+
+ #setup the input files variable list, quote formated
+ set(input_files)
+ unset(INPUT_PATHS)
+ foreach(input_path ${ARGN})
+ if (IS_DIRECTORY ${input_path}) #when input path is a directory
+ file(GLOB input_path_h_files ${input_path}/*.h)
+ else() #otherwise its just a file, no glob
+ set(input_path_h_files ${input_path})
+ endif()
+ list(APPEND input_files ${input_path_h_files})
+ set(INPUT_PATHS "${INPUT_PATHS} \"${input_path}\"")
+ endforeach(input_path)
+
+ #determine the output directory
+ get_filename_component(name ${output_file} NAME_WE)
+ get_filename_component(OUTPUT_DIRECTORY ${output_file} PATH)
+ set(OUTPUT_DIRECTORY ${OUTPUT_DIRECTORY}/${name}_swig_docs)
+ make_directory(${OUTPUT_DIRECTORY})
+
+ #generate the Doxyfile used by doxygen
+ configure_file(
+ ${CMAKE_SOURCE_DIR}/docs/doxygen/Doxyfile.swig_doc.in
+ ${OUTPUT_DIRECTORY}/Doxyfile
+ @ONLY)
+
+ #Create a dummy custom command that depends on other targets
+ include(GrMiscUtils)
+ GR_GEN_TARGET_DEPS(_${name}_tag tag_deps ${GR_SWIG_DOCS_TARGET_DEPS})
+
+ #call doxygen on the Doxyfile + input headers
+ add_custom_command(
+ OUTPUT ${OUTPUT_DIRECTORY}/xml/index.xml
+ DEPENDS ${input_files} ${GR_SWIG_DOCS_SOURCE_DEPS} ${tag_deps}
+ COMMAND ${DOXYGEN_EXECUTABLE} ${OUTPUT_DIRECTORY}/Doxyfile
+ COMMENT "Generating doxygen xml for ${name} docs"
+ )
+
+ #call the swig_doc script on the xml files
+ add_custom_command(
+ OUTPUT ${output_file}
+ DEPENDS ${input_files} ${OUTPUT_DIRECTORY}/xml/index.xml
+ COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B}
+ ${CMAKE_SOURCE_DIR}/docs/doxygen/swig_doc.py
+ ${OUTPUT_DIRECTORY}/xml
+ ${output_file}
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/docs/doxygen
+ )
+
+ else(DOXYGEN_FOUND)
+ file(WRITE ${output_file} "\n") #no doxygen -> empty file
+ endif(DOXYGEN_FOUND)
+endfunction(GR_SWIG_MAKE_DOCS)
+
+########################################################################
+# Build a swig target for the common gnuradio use case. Usage:
+# GR_SWIG_MAKE(target ifile ifile ifile...)
+#
+# Set the following variables before calling:
+# - GR_SWIG_FLAGS
+# - GR_SWIG_INCLUDE_DIRS
+# - GR_SWIG_LIBRARIES
+# - GR_SWIG_SOURCE_DEPS
+# - GR_SWIG_TARGET_DEPS
+# - GR_SWIG_DOC_FILE
+# - GR_SWIG_DOC_DIRS
+########################################################################
+macro(GR_SWIG_MAKE name)
+ set(ifiles ${ARGN})
+
+ #do swig doc generation if specified
+ if (GR_SWIG_DOC_FILE)
+ set(GR_SWIG_DOCS_SOURCE_DEPS ${GR_SWIG_SOURCE_DEPS})
+ set(GR_SWIG_DOCS_TARGET_DEPS ${GR_SWIG_TARGET_DEPS})
+ GR_SWIG_MAKE_DOCS(${GR_SWIG_DOC_FILE} ${GR_SWIG_DOC_DIRS})
+ list(APPEND GR_SWIG_SOURCE_DEPS ${GR_SWIG_DOC_FILE})
+ endif()
+
+ #append additional include directories
+ find_package(PythonLibs)
+ list(APPEND GR_SWIG_INCLUDE_DIRS ${PYTHON_INCLUDE_PATH}) #deprecated name (now dirs)
+ list(APPEND GR_SWIG_INCLUDE_DIRS ${PYTHON_INCLUDE_DIRS})
+ list(APPEND GR_SWIG_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR})
+ list(APPEND GR_SWIG_INCLUDE_DIRS ${CMAKE_CURRENT_BINARY_DIR})
+
+ #determine include dependencies for swig file
+ execute_process(
+ COMMAND ${PYTHON_EXECUTABLE}
+ ${CMAKE_BINARY_DIR}/get_swig_deps.py
+ "${ifiles}" "${GR_SWIG_INCLUDE_DIRS}"
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ OUTPUT_VARIABLE SWIG_MODULE_${name}_EXTRA_DEPS
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+ )
+
+ #Create a dummy custom command that depends on other targets
+ include(GrMiscUtils)
+ GR_GEN_TARGET_DEPS(_${name}_swig_tag tag_deps ${GR_SWIG_TARGET_DEPS})
+ set(tag_file ${CMAKE_CURRENT_BINARY_DIR}/${name}.tag)
+ add_custom_command(
+ OUTPUT ${tag_file}
+ DEPENDS ${GR_SWIG_SOURCE_DEPS} ${tag_deps}
+ COMMAND ${CMAKE_COMMAND} -E touch ${tag_file}
+ )
+
+ #append the specified include directories
+ include_directories(${GR_SWIG_INCLUDE_DIRS})
+ list(APPEND SWIG_MODULE_${name}_EXTRA_DEPS ${tag_file})
+
+ #setup the swig flags with flags and include directories
+ set(CMAKE_SWIG_FLAGS -fvirtual -modern -keyword -w511 -module ${name} ${GR_SWIG_FLAGS})
+ foreach(dir ${GR_SWIG_INCLUDE_DIRS})
+ list(APPEND CMAKE_SWIG_FLAGS "-I${dir}")
+ endforeach(dir)
+
+ #set the C++ property on the swig .i file so it builds
+ set_source_files_properties(${ifiles} PROPERTIES CPLUSPLUS ON)
+
+ #setup the actual swig library target to be built
+ include(UseSWIG)
+ SWIG_ADD_MODULE(${name} python ${ifiles})
+ SWIG_LINK_LIBRARIES(${name} ${PYTHON_LIBRARIES} ${GR_SWIG_LIBRARIES})
+
+endmacro(GR_SWIG_MAKE)
+
+########################################################################
+# Install swig targets generated by GR_SWIG_MAKE. Usage:
+# GR_SWIG_INSTALL(
+# TARGETS target target target...
+# [DESTINATION destination]
+# [COMPONENT component]
+# )
+########################################################################
+macro(GR_SWIG_INSTALL)
+
+ include(CMakeParseArgumentsCopy)
+ CMAKE_PARSE_ARGUMENTS(GR_SWIG_INSTALL "" "DESTINATION;COMPONENT" "TARGETS" ${ARGN})
+
+ foreach(name ${GR_SWIG_INSTALL_TARGETS})
+ install(TARGETS ${SWIG_MODULE_${name}_REAL_NAME}
+ DESTINATION ${GR_SWIG_INSTALL_DESTINATION}
+ COMPONENT ${GR_SWIG_INSTALL_COMPONENT}
+ )
+
+ include(GrPython)
+ GR_PYTHON_INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${name}.py
+ DESTINATION ${GR_SWIG_INSTALL_DESTINATION}
+ COMPONENT ${GR_SWIG_INSTALL_COMPONENT}
+ )
+
+ GR_LIBTOOL(
+ TARGET ${SWIG_MODULE_${name}_REAL_NAME}
+ DESTINATION ${GR_SWIG_INSTALL_DESTINATION}
+ )
+
+ endforeach(name)
+
+endmacro(GR_SWIG_INSTALL)
+
+########################################################################
+# Generate a python file that can determine swig dependencies.
+# Used by the make macro above to determine extra dependencies.
+# When you build C++, CMake figures out the header dependencies.
+# This code essentially performs that logic for swig includes.
+########################################################################
+file(WRITE ${CMAKE_BINARY_DIR}/get_swig_deps.py "
+
+import os, sys, re
+
+include_matcher = re.compile('[#|%]include\\s*[<|\"](.*)[>|\"]')
+include_dirs = sys.argv[2].split(';')
+
+def get_swig_incs(file_path):
+ file_contents = open(file_path, 'r').read()
+ return include_matcher.findall(file_contents, re.MULTILINE)
+
+def get_swig_deps(file_path, level):
+ deps = [file_path]
+ if level == 0: return deps
+ for inc_file in get_swig_incs(file_path):
+ for inc_dir in include_dirs:
+ inc_path = os.path.join(inc_dir, inc_file)
+ if not os.path.exists(inc_path): continue
+ deps.extend(get_swig_deps(inc_path, level-1))
+ return deps
+
+if __name__ == '__main__':
+ ifiles = sys.argv[1].split(';')
+ deps = sum([get_swig_deps(ifile, 3) for ifile in ifiles], [])
+ #sys.stderr.write(';'.join(set(deps)) + '\\n\\n')
+ print(';'.join(set(deps)))
+")
diff --git a/gr-howto-write-a-block/cmake/Modules/GrTest.cmake b/gr-howto-write-a-block/cmake/Modules/GrTest.cmake
new file mode 100644
index 000000000..6174c034e
--- /dev/null
+++ b/gr-howto-write-a-block/cmake/Modules/GrTest.cmake
@@ -0,0 +1,133 @@
+# 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.
+
+if(DEFINED __INCLUDED_GR_TEST_CMAKE)
+ return()
+endif()
+set(__INCLUDED_GR_TEST_CMAKE TRUE)
+
+########################################################################
+# Add a unit test and setup the environment for a unit test.
+# Takes the same arguments as the ADD_TEST function.
+#
+# Before calling set the following variables:
+# GR_TEST_TARGET_DEPS - built targets for the library path
+# GR_TEST_LIBRARY_DIRS - directories for the library path
+# GR_TEST_PYTHON_DIRS - directories for the python path
+########################################################################
+function(GR_ADD_TEST test_name)
+
+ if(WIN32)
+ #Ensure that the build exe also appears in the PATH.
+ list(APPEND GR_TEST_TARGET_DEPS ${ARGN})
+
+ #In the land of windows, all libraries must be in the PATH.
+ #Since the dependent libraries are not yet installed,
+ #we must manually set them in the PATH to run tests.
+ #The following appends the path of a target dependency.
+ foreach(target ${GR_TEST_TARGET_DEPS})
+ get_target_property(location ${target} LOCATION)
+ if(location)
+ get_filename_component(path ${location} PATH)
+ string(REGEX REPLACE "\\$\\(.*\\)" ${CMAKE_BUILD_TYPE} path ${path})
+ list(APPEND GR_TEST_LIBRARY_DIRS ${path})
+ endif(location)
+ endforeach(target)
+
+ #SWIG generates the python library files into a subdirectory.
+ #Therefore, we must append this subdirectory into PYTHONPATH.
+ #Only do this for the python directories matching the following:
+ foreach(pydir ${GR_TEST_PYTHON_DIRS})
+ get_filename_component(name ${pydir} NAME)
+ if(name MATCHES "^(swig|lib|src)$")
+ list(APPEND GR_TEST_PYTHON_DIRS ${pydir}/${CMAKE_BUILD_TYPE})
+ endif()
+ endforeach(pydir)
+ endif(WIN32)
+
+ file(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR} srcdir)
+ file(TO_NATIVE_PATH "${GR_TEST_LIBRARY_DIRS}" libpath) #ok to use on dir list?
+ file(TO_NATIVE_PATH "${GR_TEST_PYTHON_DIRS}" pypath) #ok to use on dir list?
+
+ set(environs "GR_DONT_LOAD_PREFS=1" "srcdir=${srcdir}")
+
+ #http://www.cmake.org/pipermail/cmake/2009-May/029464.html
+ #Replaced this add test + set environs code with the shell script generation.
+ #Its nicer to be able to manually run the shell script to diagnose problems.
+ #ADD_TEST(${ARGV})
+ #SET_TESTS_PROPERTIES(${test_name} PROPERTIES ENVIRONMENT "${environs}")
+
+ if(UNIX)
+ set(binpath "${CMAKE_CURRENT_BINARY_DIR}:$PATH")
+ #set both LD and DYLD paths to cover multiple UNIX OS library paths
+ list(APPEND libpath "$LD_LIBRARY_PATH" "$DYLD_LIBRARY_PATH")
+ list(APPEND pypath "$PYTHONPATH")
+
+ #replace list separator with the path separator
+ string(REPLACE ";" ":" libpath "${libpath}")
+ string(REPLACE ";" ":" pypath "${pypath}")
+ list(APPEND environs "PATH=${binpath}" "LD_LIBRARY_PATH=${libpath}" "DYLD_LIBRARY_PATH=${libpath}" "PYTHONPATH=${pypath}")
+
+ #generate a bat file that sets the environment and runs the test
+ find_program(SHELL sh)
+ set(sh_file ${CMAKE_CURRENT_BINARY_DIR}/${test_name}_test.sh)
+ file(WRITE ${sh_file} "#!${SHELL}\n")
+ #each line sets an environment variable
+ foreach(environ ${environs})
+ file(APPEND ${sh_file} "export ${environ}\n")
+ endforeach(environ)
+ #load the command to run with its arguments
+ foreach(arg ${ARGN})
+ file(APPEND ${sh_file} "${arg} ")
+ endforeach(arg)
+ file(APPEND ${sh_file} "\n")
+
+ #make the shell file executable
+ execute_process(COMMAND chmod +x ${sh_file})
+
+ add_test(${test_name} ${SHELL} ${sh_file})
+
+ endif(UNIX)
+
+ if(WIN32)
+ list(APPEND libpath ${DLL_PATHS} "%PATH%")
+ list(APPEND pypath "%PYTHONPATH%")
+
+ #replace list separator with the path separator (escaped)
+ string(REPLACE ";" "\\;" libpath "${libpath}")
+ string(REPLACE ";" "\\;" pypath "${pypath}")
+ list(APPEND environs "PATH=${libpath}" "PYTHONPATH=${pypath}")
+
+ #generate a bat file that sets the environment and runs the test
+ set(bat_file ${CMAKE_CURRENT_BINARY_DIR}/${test_name}_test.bat)
+ file(WRITE ${bat_file} "@echo off\n")
+ #each line sets an environment variable
+ foreach(environ ${environs})
+ file(APPEND ${bat_file} "SET ${environ}\n")
+ endforeach(environ)
+ #load the command to run with its arguments
+ foreach(arg ${ARGN})
+ file(APPEND ${bat_file} "${arg} ")
+ endforeach(arg)
+ file(APPEND ${bat_file} "\n")
+
+ add_test(${test_name} ${bat_file})
+ endif(WIN32)
+
+endfunction(GR_ADD_TEST)
diff --git a/gr-howto-write-a-block/cmake/cmake_uninstall.cmake.in b/gr-howto-write-a-block/cmake/cmake_uninstall.cmake.in
new file mode 100644
index 000000000..9ae1ae4bd
--- /dev/null
+++ b/gr-howto-write-a-block/cmake/cmake_uninstall.cmake.in
@@ -0,0 +1,32 @@
+# http://www.vtk.org/Wiki/CMake_FAQ#Can_I_do_.22make_uninstall.22_with_CMake.3F
+
+IF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
+ MESSAGE(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"")
+ENDIF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
+
+FILE(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
+STRING(REGEX REPLACE "\n" ";" files "${files}")
+FOREACH(file ${files})
+ MESSAGE(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"")
+ IF(EXISTS "$ENV{DESTDIR}${file}")
+ EXEC_PROGRAM(
+ "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
+ OUTPUT_VARIABLE rm_out
+ RETURN_VALUE rm_retval
+ )
+ IF(NOT "${rm_retval}" STREQUAL 0)
+ MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"")
+ ENDIF(NOT "${rm_retval}" STREQUAL 0)
+ ELSEIF(IS_SYMLINK "$ENV{DESTDIR}${file}")
+ EXEC_PROGRAM(
+ "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
+ OUTPUT_VARIABLE rm_out
+ RETURN_VALUE rm_retval
+ )
+ IF(NOT "${rm_retval}" STREQUAL 0)
+ MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"")
+ ENDIF(NOT "${rm_retval}" STREQUAL 0)
+ ELSE(EXISTS "$ENV{DESTDIR}${file}")
+ MESSAGE(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.")
+ ENDIF(EXISTS "$ENV{DESTDIR}${file}")
+ENDFOREACH(file)
diff --git a/gr-howto-write-a-block/docs/CMakeLists.txt b/gr-howto-write-a-block/docs/CMakeLists.txt
new file mode 100644
index 000000000..f16fbf6db
--- /dev/null
+++ b/gr-howto-write-a-block/docs/CMakeLists.txt
@@ -0,0 +1,35 @@
+# Copyright 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.
+
+########################################################################
+# Setup dependencies
+########################################################################
+find_package(Doxygen)
+
+########################################################################
+# Begin conditional configuration
+########################################################################
+if(ENABLE_DOXYGEN)
+
+########################################################################
+# Add subdirectories
+########################################################################
+add_subdirectory(doxygen)
+
+endif(ENABLE_DOXYGEN)
diff --git a/gr-howto-write-a-block/docs/doxygen/CMakeLists.txt b/gr-howto-write-a-block/docs/doxygen/CMakeLists.txt
new file mode 100644
index 000000000..1b4479929
--- /dev/null
+++ b/gr-howto-write-a-block/docs/doxygen/CMakeLists.txt
@@ -0,0 +1,52 @@
+# Copyright 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.
+
+########################################################################
+# Create the doxygen configuration file
+########################################################################
+file(TO_NATIVE_PATH ${CMAKE_SOURCE_DIR} top_srcdir)
+file(TO_NATIVE_PATH ${CMAKE_BINARY_DIR} top_builddir)
+file(TO_NATIVE_PATH ${CMAKE_SOURCE_DIR} abs_top_srcdir)
+file(TO_NATIVE_PATH ${CMAKE_BINARY_DIR} abs_top_builddir)
+
+set(HAVE_DOT ${DOXYGEN_DOT_FOUND})
+set(enable_html_docs YES)
+set(enable_latex_docs NO)
+set(enable_xml_docs YES)
+
+configure_file(
+ ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in
+ ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
+@ONLY)
+
+set(BUILT_DIRS ${CMAKE_CURRENT_BINARY_DIR}/xml ${CMAKE_CURRENT_BINARY_DIR}/html)
+
+########################################################################
+# Make and install doxygen docs
+########################################################################
+add_custom_command(
+ OUTPUT ${BUILT_DIRS}
+ COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ COMMENT "Generating documentation with doxygen"
+)
+
+add_custom_target(doxygen_target ALL DEPENDS ${BUILT_DIRS})
+
+install(DIRECTORY ${BUILT_DIRS} DESTINATION ${GR_PKG_DOC_DIR})
diff --git a/gr-howto-write-a-block/docs/doxygen/Doxyfile.in b/gr-howto-write-a-block/docs/doxygen/Doxyfile.in
new file mode 100644
index 000000000..6ee69ee35
--- /dev/null
+++ b/gr-howto-write-a-block/docs/doxygen/Doxyfile.in
@@ -0,0 +1,1492 @@
+# Doxyfile 1.5.7.1
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project
+#
+# All text after a hash (#) is considered a comment and will be ignored
+# The format is:
+# TAG = value [value, ...]
+# For lists items can also be appended using:
+# TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (" ")
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+# This tag specifies the encoding used for all characters in the config file
+# that follow. The default is UTF-8 which is also the encoding used for all
+# text before the first occurrence of this tag. Doxygen uses libiconv (or the
+# iconv built into libc) for the transcoding. See
+# http://www.gnu.org/software/libiconv for the list of possible encodings.
+
+DOXYFILE_ENCODING = UTF-8
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
+# by quotes) that should identify the project.
+
+PROJECT_NAME = "GNU Radio's HOWTO Package"
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number.
+# This could be handy for archiving the generated documentation or
+# if some version control system is used.
+
+PROJECT_NUMBER =
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
+# base path where the generated documentation will be put.
+# If a relative path is entered, it will be relative to the location
+# where doxygen was started. If left blank the current directory will be used.
+
+OUTPUT_DIRECTORY =
+
+# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
+# 4096 sub-directories (in 2 levels) under the output directory of each output
+# format and will distribute the generated files over these directories.
+# Enabling this option can be useful when feeding doxygen a huge amount of
+# source files, where putting all generated files in the same directory would
+# otherwise cause performance problems for the file system.
+
+CREATE_SUBDIRS = NO
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all
+# documentation generated by doxygen is written. Doxygen will use this
+# information to generate all constant output in the proper language.
+# The default language is English, other supported languages are:
+# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional,
+# Croatian, Czech, Danish, Dutch, Farsi, Finnish, French, German, Greek,
+# Hungarian, Italian, Japanese, Japanese-en (Japanese with English messages),
+# Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, Polish,
+# Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak, Slovene,
+# Spanish, Swedish, and Ukrainian.
+
+OUTPUT_LANGUAGE = English
+
+# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
+# include brief member descriptions after the members that are listed in
+# the file and class documentation (similar to JavaDoc).
+# Set to NO to disable this.
+
+BRIEF_MEMBER_DESC = YES
+
+# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
+# the brief description of a member or function before the detailed description.
+# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
+# brief descriptions will be completely suppressed.
+
+REPEAT_BRIEF = YES
+
+# This tag implements a quasi-intelligent brief description abbreviator
+# that is used to form the text in various listings. Each string
+# in this list, if found as the leading text of the brief description, will be
+# stripped from the text and the result after processing the whole list, is
+# used as the annotated text. Otherwise, the brief description is used as-is.
+# If left blank, the following values are used ("$name" is automatically
+# replaced with the name of the entity): "The $name class" "The $name widget"
+# "The $name file" "is" "provides" "specifies" "contains"
+# "represents" "a" "an" "the"
+
+ABBREVIATE_BRIEF =
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
+# Doxygen will generate a detailed section even if there is only a brief
+# description.
+
+ALWAYS_DETAILED_SEC = YES
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
+# inherited members of a class in the documentation of that class as if those
+# members were ordinary class members. Constructors, destructors and assignment
+# operators of the base classes will not be shown.
+
+INLINE_INHERITED_MEMB = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
+# path before files name in the file list and in the header files. If set
+# to NO the shortest path that makes the file name unique will be used.
+
+FULL_PATH_NAMES = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
+# can be used to strip a user-defined part of the path. Stripping is
+# only done if one of the specified strings matches the left-hand part of
+# the path. The tag can be used to show relative paths in the file list.
+# If left blank the directory from which doxygen is run is used as the
+# path to strip.
+
+STRIP_FROM_PATH =
+
+# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
+# the path mentioned in the documentation of a class, which tells
+# the reader which header file to include in order to use a class.
+# If left blank only the name of the header file containing the class
+# definition is used. Otherwise one should specify the include paths that
+# are normally passed to the compiler using the -I flag.
+
+STRIP_FROM_INC_PATH =
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
+# (but less readable) file names. This can be useful is your file systems
+# doesn't support long names like on DOS, Mac, or CD-ROM.
+
+SHORT_NAMES = NO
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
+# will interpret the first line (until the first dot) of a JavaDoc-style
+# comment as the brief description. If set to NO, the JavaDoc
+# comments will behave just like regular Qt-style comments
+# (thus requiring an explicit @brief command for a brief description.)
+
+JAVADOC_AUTOBRIEF = NO
+
+# If the QT_AUTOBRIEF tag is set to YES then Doxygen will
+# interpret the first line (until the first dot) of a Qt-style
+# comment as the brief description. If set to NO, the comments
+# will behave just like regular Qt-style comments (thus requiring
+# an explicit \brief command for a brief description.)
+
+QT_AUTOBRIEF = NO
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
+# treat a multi-line C++ special comment block (i.e. a block of //! or ///
+# comments) as a brief description. This used to be the default behaviour.
+# The new default is to treat a multi-line C++ comment block as a detailed
+# description. Set this tag to YES if you prefer the old behaviour instead.
+
+MULTILINE_CPP_IS_BRIEF = YES
+
+# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
+# member inherits the documentation from any documented member that it
+# re-implements.
+
+INHERIT_DOCS = YES
+
+# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce
+# a new page for each member. If set to NO, the documentation of a member will
+# be part of the file/class/namespace that contains it.
+
+SEPARATE_MEMBER_PAGES = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab.
+# Doxygen uses this value to replace tabs by spaces in code fragments.
+
+TAB_SIZE = 8
+
+# This tag can be used to specify a number of aliases that acts
+# as commands in the documentation. An alias has the form "name=value".
+# For example adding "sideeffect=\par Side Effects:\n" will allow you to
+# put the command \sideeffect (or @sideeffect) in the documentation, which
+# will result in a user-defined paragraph with heading "Side Effects:".
+# You can put \n's in the value part of an alias to insert newlines.
+
+ALIASES =
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
+# sources only. Doxygen will then generate output that is more tailored for C.
+# For instance, some of the names that are used will be different. The list
+# of all members will be omitted, etc.
+
+OPTIMIZE_OUTPUT_FOR_C = NO
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java
+# sources only. Doxygen will then generate output that is more tailored for
+# Java. For instance, namespaces will be presented as packages, qualified
+# scopes will look different, etc.
+
+OPTIMIZE_OUTPUT_JAVA = NO
+
+# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
+# sources only. Doxygen will then generate output that is more tailored for
+# Fortran.
+
+OPTIMIZE_FOR_FORTRAN = NO
+
+# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
+# sources. Doxygen will then generate output that is tailored for
+# VHDL.
+
+OPTIMIZE_OUTPUT_VHDL = NO
+
+# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
+# to include (a tag file for) the STL sources as input, then you should
+# set this tag to YES in order to let doxygen match functions declarations and
+# definitions whose arguments contain STL classes (e.g. func(std::string); v.s.
+# func(std::string) {}). This also make the inheritance and collaboration
+# diagrams that involve STL classes more complete and accurate.
+
+BUILTIN_STL_SUPPORT = YES
+
+# If you use Microsoft's C++/CLI language, you should set this option to YES to
+# enable parsing support.
+
+CPP_CLI_SUPPORT = NO
+
+# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only.
+# Doxygen will parse them like normal C++ but will assume all classes use public
+# instead of private inheritance when no explicit protection keyword is present.
+
+SIP_SUPPORT = NO
+
+# For Microsoft's IDL there are propget and propput attributes to indicate getter
+# and setter methods for a property. Setting this option to YES (the default)
+# will make doxygen to replace the get and set methods by a property in the
+# documentation. This will only work if the methods are indeed getting or
+# setting a simple type. If this is not the case, or you want to show the
+# methods anyway, you should set this option to NO.
+
+IDL_PROPERTY_SUPPORT = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
+# tag is set to YES, then doxygen will reuse the documentation of the first
+# member in the group (if any) for the other members of the group. By default
+# all members of a group must be documented explicitly.
+
+DISTRIBUTE_GROUP_DOC = NO
+
+# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
+# the same type (for instance a group of public functions) to be put as a
+# subgroup of that type (e.g. under the Public Functions section). Set it to
+# NO to prevent subgrouping. Alternatively, this can be done per class using
+# the \nosubgrouping command.
+
+SUBGROUPING = YES
+
+# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum
+# is documented as struct, union, or enum with the name of the typedef. So
+# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
+# with name TypeT. When disabled the typedef will appear as a member of a file,
+# namespace, or class. And the struct will be named TypeS. This can typically
+# be useful for C code in case the coding convention dictates that all compound
+# types are typedef'ed and only the typedef is referenced, never the tag name.
+
+TYPEDEF_HIDES_STRUCT = NO
+
+# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to
+# determine which symbols to keep in memory and which to flush to disk.
+# When the cache is full, less often used symbols will be written to disk.
+# For small to medium size projects (<1000 input files) the default value is
+# probably good enough. For larger projects a too small cache size can cause
+# doxygen to be busy swapping symbols to and from disk most of the time
+# causing a significant performance penality.
+# If the system has enough physical memory increasing the cache will improve the
+# performance by keeping more symbols in memory. Note that the value works on
+# a logarithmic scale so increasing the size by one will rougly double the
+# memory usage. The cache size is given by this formula:
+# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0,
+# corresponding to a cache size of 2^16 = 65536 symbols
+
+SYMBOL_CACHE_SIZE = 4
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
+# documentation are documented, even if no documentation was available.
+# Private class members and static file members will be hidden unless
+# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
+
+EXTRACT_ALL = YES
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
+# will be included in the documentation.
+
+EXTRACT_PRIVATE = NO
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file
+# will be included in the documentation.
+
+EXTRACT_STATIC = YES
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
+# defined locally in source files will be included in the documentation.
+# If set to NO only classes defined in header files are included.
+
+EXTRACT_LOCAL_CLASSES = YES
+
+# This flag is only useful for Objective-C code. When set to YES local
+# methods, which are defined in the implementation section but not in
+# the interface are included in the documentation.
+# If set to NO (the default) only methods in the interface are included.
+
+EXTRACT_LOCAL_METHODS = NO
+
+# If this flag is set to YES, the members of anonymous namespaces will be
+# extracted and appear in the documentation as a namespace called
+# 'anonymous_namespace{file}', where file will be replaced with the base
+# name of the file that contains the anonymous namespace. By default
+# anonymous namespace are hidden.
+
+EXTRACT_ANON_NSPACES = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
+# undocumented members of documented classes, files or namespaces.
+# If set to NO (the default) these members will be included in the
+# various overviews, but no documentation section is generated.
+# This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_MEMBERS = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
+# undocumented classes that are normally visible in the class hierarchy.
+# If set to NO (the default) these classes will be included in the various
+# overviews. This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_CLASSES = NO
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
+# friend (class|struct|union) declarations.
+# If set to NO (the default) these declarations will be included in the
+# documentation.
+
+HIDE_FRIEND_COMPOUNDS = NO
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
+# documentation blocks found inside the body of a function.
+# If set to NO (the default) these blocks will be appended to the
+# function's detailed documentation block.
+
+HIDE_IN_BODY_DOCS = NO
+
+# The INTERNAL_DOCS tag determines if documentation
+# that is typed after a \internal command is included. If the tag is set
+# to NO (the default) then the documentation will be excluded.
+# Set it to YES to include the internal documentation.
+
+INTERNAL_DOCS = NO
+
+# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
+# file names in lower-case letters. If set to YES upper-case letters are also
+# allowed. This is useful if you have classes or files whose names only differ
+# in case and if your file system supports case sensitive file names. Windows
+# and Mac users are advised to set this option to NO.
+
+CASE_SENSE_NAMES = YES
+
+# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
+# will show members with their full class and namespace scopes in the
+# documentation. If set to YES the scope will be hidden.
+
+HIDE_SCOPE_NAMES = NO
+
+# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
+# will put a list of the files that are included by a file in the documentation
+# of that file.
+
+SHOW_INCLUDE_FILES = YES
+
+# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
+# is inserted in the documentation for inline members.
+
+INLINE_INFO = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
+# will sort the (detailed) documentation of file and class members
+# alphabetically by member name. If set to NO the members will appear in
+# declaration order.
+
+SORT_MEMBER_DOCS = YES
+
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
+# brief documentation of file, namespace and class members alphabetically
+# by member name. If set to NO (the default) the members will appear in
+# declaration order.
+
+SORT_BRIEF_DOCS = NO
+
+# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the
+# hierarchy of group names into alphabetical order. If set to NO (the default)
+# the group names will appear in their defined order.
+
+SORT_GROUP_NAMES = NO
+
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
+# sorted by fully-qualified names, including namespaces. If set to
+# NO (the default), the class list will be sorted only by class name,
+# not including the namespace part.
+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
+# Note: This option applies only to the class list, not to the
+# alphabetical list.
+
+SORT_BY_SCOPE_NAME = NO
+
+# The GENERATE_TODOLIST tag can be used to enable (YES) or
+# disable (NO) the todo list. This list is created by putting \todo
+# commands in the documentation.
+
+GENERATE_TODOLIST = NO
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or
+# disable (NO) the test list. This list is created by putting \test
+# commands in the documentation.
+
+GENERATE_TESTLIST = NO
+
+# The GENERATE_BUGLIST tag can be used to enable (YES) or
+# disable (NO) the bug list. This list is created by putting \bug
+# commands in the documentation.
+
+GENERATE_BUGLIST = NO
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
+# disable (NO) the deprecated list. This list is created by putting
+# \deprecated commands in the documentation.
+
+GENERATE_DEPRECATEDLIST= NO
+
+# The ENABLED_SECTIONS tag can be used to enable conditional
+# documentation sections, marked by \if sectionname ... \endif.
+
+ENABLED_SECTIONS =
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
+# the initial value of a variable or define consists of for it to appear in
+# the documentation. If the initializer consists of more lines than specified
+# here it will be hidden. Use a value of 0 to hide initializers completely.
+# The appearance of the initializer of individual variables and defines in the
+# documentation can be controlled using \showinitializer or \hideinitializer
+# command in the documentation regardless of this setting.
+
+MAX_INITIALIZER_LINES = 30
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
+# at the bottom of the documentation of classes and structs. If set to YES the
+# list will mention the files that were used to generate the documentation.
+
+SHOW_USED_FILES = YES
+
+# Set the SHOW_FILES tag to NO to disable the generation of the Files page.
+# This will remove the Files entry from the Quick Index and from the
+# Folder Tree View (if specified). The default is YES.
+
+SHOW_FILES = YES
+
+# Set the SHOW_NAMESPACES tag to NO to disable the generation of the
+# Namespaces page. This will remove the Namespaces entry from the Quick Index
+# and from the Folder Tree View (if specified). The default is YES.
+
+SHOW_NAMESPACES = NO
+
+# The FILE_VERSION_FILTER tag can be used to specify a program or script that
+# doxygen should invoke to get the current version for each file (typically from
+# the version control system). Doxygen will invoke the program by executing (via
+# popen()) the command <command> <input-file>, where <command> is the value of
+# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file
+# provided by doxygen. Whatever the program writes to standard output
+# is used as the file version. See the manual for examples.
+
+FILE_VERSION_FILTER =
+
+# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed by
+# doxygen. The layout file controls the global structure of the generated output files
+# in an output format independent way. The create the layout file that represents
+# doxygen's defaults, run doxygen with the -l option. You can optionally specify a
+# file name after the option, if omitted DoxygenLayout.xml will be used as the name
+# of the layout file.
+
+LAYOUT_FILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated
+# by doxygen. Possible values are YES and NO. If left blank NO is used.
+
+QUIET = YES
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are
+# generated by doxygen. Possible values are YES and NO. If left blank
+# NO is used.
+
+WARNINGS = YES
+
+# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
+# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
+# automatically be disabled.
+
+WARN_IF_UNDOCUMENTED = YES
+
+# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
+# potential errors in the documentation, such as not documenting some
+# parameters in a documented function, or documenting parameters that
+# don't exist or using markup commands wrongly.
+
+WARN_IF_DOC_ERROR = YES
+
+# This WARN_NO_PARAMDOC option can be abled to get warnings for
+# functions that are documented, but have no documentation for their parameters
+# or return value. If set to NO (the default) doxygen will only warn about
+# wrong or incomplete parameter documentation, but not about the absence of
+# documentation.
+
+WARN_NO_PARAMDOC = NO
+
+# The WARN_FORMAT tag determines the format of the warning messages that
+# doxygen can produce. The string should contain the $file, $line, and $text
+# tags, which will be replaced by the file and line number from which the
+# warning originated and the warning text. Optionally the format may contain
+# $version, which will be replaced by the version of the file (if it could
+# be obtained via FILE_VERSION_FILTER)
+
+WARN_FORMAT = "$file:$line: $text "
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning
+# and error messages should be written. If left blank the output is written
+# to stderr.
+
+WARN_LOGFILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag can be used to specify the files and/or directories that contain
+# documented source files. You may enter file names like "myfile.cpp" or
+# directories like "/usr/src/myproject". Separate the files or directories
+# with spaces.
+
+INPUT = @top_srcdir@ @top_builddir@
+
+# This tag can be used to specify the character encoding of the source files
+# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
+# also the default input encoding. Doxygen uses libiconv (or the iconv built
+# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for
+# the list of possible encodings.
+
+INPUT_ENCODING = UTF-8
+
+# If the value of the INPUT tag contains directories, you can use the
+# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank the following patterns are tested:
+# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx
+# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90
+
+FILE_PATTERNS = *.h \
+ *.dox
+
+# The RECURSIVE tag can be used to turn specify whether or not subdirectories
+# should be searched for input files as well. Possible values are YES and NO.
+# If left blank NO is used.
+
+RECURSIVE = YES
+
+# The EXCLUDE tag can be used to specify files and/or directories that should
+# excluded from the INPUT source files. This way you can easily exclude a
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+
+EXCLUDE = @abs_top_builddir@/docs/doxygen/html \
+ @abs_top_builddir@/docs/doxygen/xml \
+ @abs_top_builddir@/docs/doxygen/other/doxypy.py \
+ @abs_top_builddir@/_CPack_Packages \
+ @abs_top_srcdir@/cmake
+
+# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
+# directories that are symbolic links (a Unix filesystem feature) are excluded
+# from the input.
+
+EXCLUDE_SYMLINKS = NO
+
+# If the value of the INPUT tag contains directories, you can use the
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
+# certain files from those directories. Note that the wildcards are matched
+# against the file with absolute path, so to exclude all test directories
+# for example use the pattern */test/*
+
+EXCLUDE_PATTERNS = */.deps/* \
+ */.libs/* \
+ */.svn/* \
+ */CVS/* \
+ */__init__.py \
+ */qa_*.cc \
+ */qa_*.h \
+ */qa_*.py
+
+# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
+# (namespaces, classes, functions, etc.) that should be excluded from the
+# output. The symbol name can be a fully qualified name, a word, or if the
+# wildcard * is used, a substring. Examples: ANamespace, AClass,
+# AClass::ANamespace, ANamespace::*Test
+
+EXCLUDE_SYMBOLS = ad9862 \
+ numpy \
+ *swig* \
+ *Swig* \
+ *my_top_block* \
+ *my_graph* \
+ *app_top_block* \
+ *am_rx_graph* \
+ *_queue_watcher_thread* \
+ *parse* \
+ *MyFrame* \
+ *MyApp* \
+ *PyObject* \
+ *wfm_rx_block* \
+ *_sptr* \
+ *debug* \
+ *wfm_rx_sca_block* \
+ *tv_rx_block* \
+ *wxapt_rx_block* \
+ *example_signal*
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or
+# directories that contain example code fragments that are included (see
+# the \include command).
+
+EXAMPLE_PATH =
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank all files are included.
+
+EXAMPLE_PATTERNS =
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
+# searched for input files to be used with the \include or \dontinclude
+# commands irrespective of the value of the RECURSIVE tag.
+# Possible values are YES and NO. If left blank NO is used.
+
+EXAMPLE_RECURSIVE = NO
+
+# The IMAGE_PATH tag can be used to specify one or more files or
+# directories that contain image that are included in the documentation (see
+# the \image command).
+
+IMAGE_PATH =
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should
+# invoke to filter for each input file. Doxygen will invoke the filter program
+# by executing (via popen()) the command <filter> <input-file>, where <filter>
+# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
+# input file. Doxygen will then use the output that the filter program writes
+# to standard output. If FILTER_PATTERNS is specified, this tag will be
+# ignored.
+
+INPUT_FILTER =
+
+# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
+# basis. Doxygen will compare the file name with each pattern and apply the
+# filter if there is a match. The filters are a list of the form:
+# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
+# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER
+# is applied to all files.
+
+FILTER_PATTERNS = *.py=@top_srcdir@/gnuradio-core/doc/other/doxypy.py
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
+# INPUT_FILTER) will be used to filter the input files when producing source
+# files to browse (i.e. when SOURCE_BROWSER is set to YES).
+
+FILTER_SOURCE_FILES = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will
+# be generated. Documented entities will be cross-referenced with these sources.
+# Note: To get rid of all source code in the generated output, make sure also
+# VERBATIM_HEADERS is set to NO.
+
+SOURCE_BROWSER = NO
+
+# Setting the INLINE_SOURCES tag to YES will include the body
+# of functions and classes directly in the documentation.
+
+INLINE_SOURCES = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
+# doxygen to hide any special comment blocks from generated source code
+# fragments. Normal C and C++ comments will always remain visible.
+
+STRIP_CODE_COMMENTS = NO
+
+# If the REFERENCED_BY_RELATION tag is set to YES
+# then for each documented function all documented
+# functions referencing it will be listed.
+
+REFERENCED_BY_RELATION = YES
+
+# If the REFERENCES_RELATION tag is set to YES
+# then for each documented function all documented entities
+# called/used by that function will be listed.
+
+REFERENCES_RELATION = YES
+
+# If the REFERENCES_LINK_SOURCE tag is set to YES (the default)
+# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
+# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
+# link to the source code. Otherwise they will link to the documentstion.
+
+REFERENCES_LINK_SOURCE = YES
+
+# If the USE_HTAGS tag is set to YES then the references to source code
+# will point to the HTML generated by the htags(1) tool instead of doxygen
+# built-in source browser. The htags tool is part of GNU's global source
+# tagging system (see http://www.gnu.org/software/global/global.html). You
+# will need version 4.8.6 or higher.
+
+USE_HTAGS = NO
+
+# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
+# will generate a verbatim copy of the header file for each class for
+# which an include is specified. Set to NO to disable this.
+
+VERBATIM_HEADERS = YES
+
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
+# of all compounds will be generated. Enable this if the project
+# contains a lot of classes, structs, unions or interfaces.
+
+ALPHABETICAL_INDEX = YES
+
+# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
+# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
+# in which this list will be split (can be a number in the range [1..20])
+
+COLS_IN_ALPHA_INDEX = 5
+
+# In case all classes in a project start with a common prefix, all
+# classes will be put under the same header in the alphabetical index.
+# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
+# should be ignored while generating the index headers.
+
+IGNORE_PREFIX =
+
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
+# generate HTML output.
+
+GENERATE_HTML = @enable_html_docs@
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `html' will be used as the default path.
+
+HTML_OUTPUT = html
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
+# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
+# doxygen will generate files with .html extension.
+
+HTML_FILE_EXTENSION = .html
+
+# The HTML_HEADER tag can be used to specify a personal HTML header for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard header.
+
+HTML_HEADER =
+
+# The HTML_FOOTER tag can be used to specify a personal HTML footer for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard footer.
+
+HTML_FOOTER =
+
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
+# style sheet that is used by each HTML page. It can be used to
+# fine-tune the look of the HTML output. If the tag is left blank doxygen
+# will generate a default style sheet. Note that doxygen will try to copy
+# the style sheet file to the HTML output directory, so don't put your own
+# stylesheet in the HTML output directory as well, or it will be erased!
+
+HTML_STYLESHEET =
+
+# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
+# documentation will contain sections that can be hidden and shown after the
+# page has loaded. For this to work a browser that supports
+# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox
+# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
+
+HTML_DYNAMIC_SECTIONS = NO
+
+# If the GENERATE_DOCSET tag is set to YES, additional index files
+# will be generated that can be used as input for Apple's Xcode 3
+# integrated development environment, introduced with OSX 10.5 (Leopard).
+# To create a documentation set, doxygen will generate a Makefile in the
+# HTML output directory. Running make will produce the docset in that
+# directory and running "make install" will install the docset in
+# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find
+# it at startup.
+# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html for more information.
+
+GENERATE_DOCSET = NO
+
+# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the
+# feed. A documentation feed provides an umbrella under which multiple
+# documentation sets from a single provider (such as a company or product suite)
+# can be grouped.
+
+DOCSET_FEEDNAME = "Doxygen generated docs"
+
+# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that
+# should uniquely identify the documentation set bundle. This should be a
+# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen
+# will append .docset to the name.
+
+DOCSET_BUNDLE_ID = org.doxygen.Project
+
+# If the GENERATE_HTMLHELP tag is set to YES, additional index files
+# will be generated that can be used as input for tools like the
+# Microsoft HTML help workshop to generate a compiled HTML help file (.chm)
+# of the generated HTML documentation.
+
+GENERATE_HTMLHELP = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
+# be used to specify the file name of the resulting .chm file. You
+# can add a path in front of the file if the result should not be
+# written to the html output directory.
+
+CHM_FILE =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
+# be used to specify the location (absolute path including file name) of
+# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
+# the HTML help compiler on the generated index.hhp.
+
+HHC_LOCATION =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
+# controls if a separate .chi index file is generated (YES) or that
+# it should be included in the master .chm file (NO).
+
+GENERATE_CHI = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING
+# is used to encode HtmlHelp index (hhk), content (hhc) and project file
+# content.
+
+CHM_INDEX_ENCODING =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
+# controls whether a binary table of contents is generated (YES) or a
+# normal table of contents (NO) in the .chm file.
+
+BINARY_TOC = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members
+# to the contents of the HTML help documentation and to the tree view.
+
+TOC_EXPAND = YES
+
+# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and QHP_VIRTUAL_FOLDER
+# are set, an additional index file will be generated that can be used as input for
+# Qt's qhelpgenerator to generate a Qt Compressed Help (.qch) of the generated
+# HTML documentation.
+
+GENERATE_QHP = NO
+
+# If the QHG_LOCATION tag is specified, the QCH_FILE tag can
+# be used to specify the file name of the resulting .qch file.
+# The path specified is relative to the HTML output folder.
+
+QCH_FILE =
+
+# The QHP_NAMESPACE tag specifies the namespace to use when generating
+# Qt Help Project output. For more information please see
+# <a href="http://doc.trolltech.com/qthelpproject.html#namespace">Qt Help Project / Namespace</a>.
+
+QHP_NAMESPACE = org.doxygen.Project
+
+# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating
+# Qt Help Project output. For more information please see
+# <a href="http://doc.trolltech.com/qthelpproject.html#virtual-folders">Qt Help Project / Virtual Folders</a>.
+
+QHP_VIRTUAL_FOLDER = doc
+
+# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can
+# be used to specify the location of Qt's qhelpgenerator.
+# If non-empty doxygen will try to run qhelpgenerator on the generated
+# .qhp file .
+
+QHG_LOCATION =
+
+# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
+# top of each HTML page. The value NO (the default) enables the index and
+# the value YES disables it.
+
+DISABLE_INDEX = YES
+
+# This tag can be used to set the number of enum values (range [1..20])
+# that doxygen will group on one line in the generated HTML documentation.
+
+ENUM_VALUES_PER_LINE = 4
+
+# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
+# structure should be generated to display hierarchical information.
+# If the tag value is set to FRAME, a side panel will be generated
+# containing a tree-like index structure (just like the one that
+# is generated for HTML Help). For this to work a browser that supports
+# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+,
+# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are
+# probably better off using the HTML help feature. Other possible values
+# for this tag are: HIERARCHIES, which will generate the Groups, Directories,
+# and Class Hierarchy pages using a tree view instead of an ordered list;
+# ALL, which combines the behavior of FRAME and HIERARCHIES; and NONE, which
+# disables this behavior completely. For backwards compatibility with previous
+# releases of Doxygen, the values YES and NO are equivalent to FRAME and NONE
+# respectively.
+
+GENERATE_TREEVIEW = YES
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
+# used to set the initial width (in pixels) of the frame in which the tree
+# is shown.
+
+TREEVIEW_WIDTH = 180
+
+# Use this tag to change the font size of Latex formulas included
+# as images in the HTML documentation. The default is 10. Note that
+# when you change the font size after a successful doxygen run you need
+# to manually remove any form_*.png images from the HTML output directory
+# to force them to be regenerated.
+
+FORMULA_FONTSIZE = 10
+
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
+# generate Latex output.
+
+GENERATE_LATEX = @enable_latex_docs@
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `latex' will be used as the default path.
+
+LATEX_OUTPUT = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
+# invoked. If left blank `latex' will be used as the default command name.
+
+LATEX_CMD_NAME = latex
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
+# generate index for LaTeX. If left blank `makeindex' will be used as the
+# default command name.
+
+MAKEINDEX_CMD_NAME = makeindex
+
+# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
+# LaTeX documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_LATEX = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used
+# by the printer. Possible values are: a4, a4wide, letter, legal and
+# executive. If left blank a4wide will be used.
+
+PAPER_TYPE = letter
+
+# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
+# packages that should be included in the LaTeX output.
+
+EXTRA_PACKAGES =
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
+# the generated latex document. The header should contain everything until
+# the first chapter. If it is left blank doxygen will generate a
+# standard header. Notice: only use this tag if you know what you are doing!
+
+LATEX_HEADER =
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
+# is prepared for conversion to pdf (using ps2pdf). The pdf file will
+# contain links (just like the HTML output) instead of page references
+# This makes the output suitable for online browsing using a pdf viewer.
+
+PDF_HYPERLINKS = YES
+
+# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
+# plain latex in the generated Makefile. Set this option to YES to get a
+# higher quality PDF documentation.
+
+USE_PDFLATEX = NO
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
+# command to the generated LaTeX files. This will instruct LaTeX to keep
+# running if errors occur, instead of asking the user for help.
+# This option is also used when generating formulas in HTML.
+
+LATEX_BATCHMODE = NO
+
+# If LATEX_HIDE_INDICES is set to YES then doxygen will not
+# include the index chapters (such as File Index, Compound Index, etc.)
+# in the output.
+
+LATEX_HIDE_INDICES = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
+# The RTF output is optimized for Word 97 and may not look very pretty with
+# other RTF readers or editors.
+
+GENERATE_RTF = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `rtf' will be used as the default path.
+
+RTF_OUTPUT = rtf
+
+# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
+# RTF documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_RTF = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
+# will contain hyperlink fields. The RTF file will
+# contain links (just like the HTML output) instead of page references.
+# This makes the output suitable for online browsing using WORD or other
+# programs which support those fields.
+# Note: wordpad (write) and others do not support links.
+
+RTF_HYPERLINKS = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's
+# config file, i.e. a series of assignments. You only have to provide
+# replacements, missing definitions are set to their default value.
+
+RTF_STYLESHEET_FILE =
+
+# Set optional variables used in the generation of an rtf document.
+# Syntax is similar to doxygen's config file.
+
+RTF_EXTENSIONS_FILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
+# generate man pages
+
+GENERATE_MAN = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `man' will be used as the default path.
+
+MAN_OUTPUT = man
+
+# The MAN_EXTENSION tag determines the extension that is added to
+# the generated man pages (default is the subroutine's section .3)
+
+MAN_EXTENSION = .3
+
+# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
+# then it will generate one additional man file for each entity
+# documented in the real man page(s). These additional files
+# only source the real man page, but without them the man command
+# would be unable to find the correct page. The default is NO.
+
+MAN_LINKS = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES Doxygen will
+# generate an XML file that captures the structure of
+# the code including all documentation.
+
+GENERATE_XML = @enable_xml_docs@
+
+# The XML_OUTPUT tag is used to specify where the XML pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `xml' will be used as the default path.
+
+XML_OUTPUT = xml
+
+# The XML_SCHEMA tag can be used to specify an XML schema,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_SCHEMA =
+
+# The XML_DTD tag can be used to specify an XML DTD,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_DTD =
+
+# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
+# dump the program listings (including syntax highlighting
+# and cross-referencing information) to the XML output. Note that
+# enabling this will significantly increase the size of the XML output.
+
+XML_PROGRAMLISTING = NO
+
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
+# generate an AutoGen Definitions (see autogen.sf.net) file
+# that captures the structure of the code including all
+# documentation. Note that this feature is still experimental
+# and incomplete at the moment.
+
+GENERATE_AUTOGEN_DEF = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_PERLMOD tag is set to YES Doxygen will
+# generate a Perl module file that captures the structure of
+# the code including all documentation. Note that this
+# feature is still experimental and incomplete at the
+# moment.
+
+GENERATE_PERLMOD = NO
+
+# If the PERLMOD_LATEX tag is set to YES Doxygen will generate
+# the necessary Makefile rules, Perl scripts and LaTeX code to be able
+# to generate PDF and DVI output from the Perl module output.
+
+PERLMOD_LATEX = NO
+
+# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
+# nicely formatted so it can be parsed by a human reader. This is useful
+# if you want to understand what is going on. On the other hand, if this
+# tag is set to NO the size of the Perl module output will be much smaller
+# and Perl will parse it just the same.
+
+PERLMOD_PRETTY = YES
+
+# The names of the make variables in the generated doxyrules.make file
+# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
+# This is useful so different doxyrules.make files included by the same
+# Makefile don't overwrite each other's variables.
+
+PERLMOD_MAKEVAR_PREFIX =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
+# evaluate all C-preprocessor directives found in the sources and include
+# files.
+
+ENABLE_PREPROCESSING = YES
+
+# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
+# names in the source code. If set to NO (the default) only conditional
+# compilation will be performed. Macro expansion can be done in a controlled
+# way by setting EXPAND_ONLY_PREDEF to YES.
+
+MACRO_EXPANSION = NO
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
+# then the macro expansion is limited to the macros specified with the
+# PREDEFINED and EXPAND_AS_DEFINED tags.
+
+EXPAND_ONLY_PREDEF = NO
+
+# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
+# in the INCLUDE_PATH (see below) will be search if a #include is found.
+
+SEARCH_INCLUDES = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that
+# contain include files that are not input files but should be processed by
+# the preprocessor.
+
+INCLUDE_PATH =
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
+# patterns (like *.h and *.hpp) to filter out the header-files in the
+# directories. If left blank, the patterns specified with FILE_PATTERNS will
+# be used.
+
+INCLUDE_FILE_PATTERNS =
+
+# The PREDEFINED tag can be used to specify one or more macro names that
+# are defined before the preprocessor is started (similar to the -D option of
+# gcc). The argument of the tag is a list of macros of the form: name
+# or name=definition (no spaces). If the definition and the = are
+# omitted =1 is assumed. To prevent a macro definition from being
+# undefined via #undef or recursively expanded use the := operator
+# instead of the = operator.
+
+PREDEFINED =
+
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
+# this tag can be used to specify a list of macro names that should be expanded.
+# The macro definition that is found in the sources will be used.
+# Use the PREDEFINED tag if you want to use a different macro definition.
+
+EXPAND_AS_DEFINED =
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
+# doxygen's preprocessor will remove all function-like macros that are alone
+# on a line, have an all uppercase name, and do not end with a semicolon. Such
+# function macros are typically used for boiler-plate code, and will confuse
+# the parser if not removed.
+
+SKIP_FUNCTION_MACROS = YES
+
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references
+#---------------------------------------------------------------------------
+
+# The TAGFILES option can be used to specify one or more tagfiles.
+# Optionally an initial location of the external documentation
+# can be added for each tagfile. The format of a tag file without
+# this location is as follows:
+# TAGFILES = file1 file2 ...
+# Adding location for the tag files is done as follows:
+# TAGFILES = file1=loc1 "file2 = loc2" ...
+# where "loc1" and "loc2" can be relative or absolute paths or
+# URLs. If a location is present for each tag, the installdox tool
+# does not have to be run to correct the links.
+# Note that each tag file must have a unique name
+# (where the name does NOT include the path)
+# If a tag file is not located in the directory in which doxygen
+# is run, you must also specify the path to the tagfile here.
+
+TAGFILES =
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create
+# a tag file that is based on the input files it reads.
+
+GENERATE_TAGFILE =
+
+# If the ALLEXTERNALS tag is set to YES all external classes will be listed
+# in the class index. If set to NO only the inherited external classes
+# will be listed.
+
+ALLEXTERNALS = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
+# in the modules index. If set to NO, only the current project's groups will
+# be listed.
+
+EXTERNAL_GROUPS = YES
+
+# The PERL_PATH should be the absolute path and name of the perl script
+# interpreter (i.e. the result of `which perl').
+
+PERL_PATH = /usr/bin/perl
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
+# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base
+# or super classes. Setting the tag to NO turns the diagrams off. Note that
+# this option is superseded by the HAVE_DOT option below. This is only a
+# fallback. It is recommended to install and use dot, since it yields more
+# powerful graphs.
+
+CLASS_DIAGRAMS = YES
+
+# You can define message sequence charts within doxygen comments using the \msc
+# command. Doxygen will then run the mscgen tool (see
+# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the
+# documentation. The MSCGEN_PATH tag allows you to specify the directory where
+# the mscgen tool resides. If left empty the tool is assumed to be found in the
+# default search path.
+
+MSCGEN_PATH =
+
+# If set to YES, the inheritance and collaboration graphs will hide
+# inheritance and usage relations if the target is undocumented
+# or is not a class.
+
+HIDE_UNDOC_RELATIONS = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
+# available from the path. This tool is part of Graphviz, a graph visualization
+# toolkit from AT&T and Lucent Bell Labs. The other options in this section
+# have no effect if this option is set to NO (the default)
+
+HAVE_DOT = @HAVE_DOT@
+
+# By default doxygen will write a font called FreeSans.ttf to the output
+# directory and reference it in all dot files that doxygen generates. This
+# font does not include all possible unicode characters however, so when you need
+# these (or just want a differently looking font) you can specify the font name
+# using DOT_FONTNAME. You need need to make sure dot is able to find the font,
+# which can be done by putting it in a standard location or by setting the
+# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory
+# containing the font.
+
+DOT_FONTNAME = FreeSans
+
+# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs.
+# The default size is 10pt.
+
+DOT_FONTSIZE = 10
+
+# By default doxygen will tell dot to use the output directory to look for the
+# FreeSans.ttf font (which doxygen will put there itself). If you specify a
+# different font using DOT_FONTNAME you can set the path where dot
+# can find it using this tag.
+
+DOT_FONTPATH =
+
+# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect inheritance relations. Setting this tag to YES will force the
+# the CLASS_DIAGRAMS tag to NO.
+
+CLASS_GRAPH = YES
+
+# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect implementation dependencies (inheritance, containment, and
+# class references variables) of the class with other documented classes.
+
+COLLABORATION_GRAPH = NO
+
+# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for groups, showing the direct groups dependencies
+
+GROUP_GRAPHS = YES
+
+# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
+# collaboration diagrams in a style similar to the OMG's Unified Modeling
+# Language.
+
+UML_LOOK = NO
+
+# If set to YES, the inheritance and collaboration graphs will show the
+# relations between templates and their instances.
+
+TEMPLATE_RELATIONS = NO
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
+# tags are set to YES then doxygen will generate a graph for each documented
+# file showing the direct and indirect include dependencies of the file with
+# other documented files.
+
+INCLUDE_GRAPH = YES
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
+# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
+# documented header file showing the documented files that directly or
+# indirectly include this file.
+
+INCLUDED_BY_GRAPH = YES
+
+# If the CALL_GRAPH and HAVE_DOT options are set to YES then
+# doxygen will generate a call dependency graph for every global function
+# or class method. Note that enabling this option will significantly increase
+# the time of a run. So in most cases it will be better to enable call graphs
+# for selected functions only using the \callgraph command.
+
+CALL_GRAPH = NO
+
+# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then
+# doxygen will generate a caller dependency graph for every global function
+# or class method. Note that enabling this option will significantly increase
+# the time of a run. So in most cases it will be better to enable caller
+# graphs for selected functions only using the \callergraph command.
+
+CALLER_GRAPH = NO
+
+# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
+# will graphical hierarchy of all classes instead of a textual one.
+
+GRAPHICAL_HIERARCHY = YES
+
+# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES
+# then doxygen will show the dependencies a directory has on other directories
+# in a graphical way. The dependency relations are determined by the #include
+# relations between the files in the directories.
+
+DIRECTORY_GRAPH = YES
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
+# generated by dot. Possible values are png, jpg, or gif
+# If left blank png will be used.
+
+DOT_IMAGE_FORMAT = png
+
+# The tag DOT_PATH can be used to specify the path where the dot tool can be
+# found. If left blank, it is assumed the dot tool can be found in the path.
+
+DOT_PATH =
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that
+# contain dot files that are included in the documentation (see the
+# \dotfile command).
+
+DOTFILE_DIRS =
+
+# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of
+# nodes that will be shown in the graph. If the number of nodes in a graph
+# becomes larger than this value, doxygen will truncate the graph, which is
+# visualized by representing a node as a red box. Note that doxygen if the
+# number of direct children of the root node in a graph is already larger than
+# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note
+# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
+
+DOT_GRAPH_MAX_NODES = 50
+
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
+# graphs generated by dot. A depth value of 3 means that only nodes reachable
+# from the root by following a path via at most 3 edges will be shown. Nodes
+# that lay further from the root node will be omitted. Note that setting this
+# option to 1 or 2 may greatly reduce the computation time needed for large
+# code bases. Also note that the size of a graph can be further restricted by
+# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
+
+MAX_DOT_GRAPH_DEPTH = 0
+
+# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
+# background. This is disabled by default, because dot on Windows does not
+# seem to support this out of the box. Warning: Depending on the platform used,
+# enabling this option may lead to badly anti-aliased labels on the edges of
+# a graph (i.e. they become hard to read).
+
+DOT_TRANSPARENT = NO
+
+# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
+# files in one run (i.e. multiple -o and -T options on the command line). This
+# makes dot run faster, but since only newer versions of dot (>1.8.10)
+# support this, this feature is disabled by default.
+
+DOT_MULTI_TARGETS = YES
+
+# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
+# generate a legend page explaining the meaning of the various boxes and
+# arrows in the dot generated graphs.
+
+GENERATE_LEGEND = YES
+
+# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
+# remove the intermediate dot files that are used to generate
+# the various graphs.
+
+DOT_CLEANUP = YES
+
+#---------------------------------------------------------------------------
+# Configuration::additions related to the search engine
+#---------------------------------------------------------------------------
+
+# The SEARCHENGINE tag specifies whether or not a search engine should be
+# used. If set to NO the values of all tags below this one will be ignored.
+
+SEARCHENGINE = NO
diff --git a/gr-howto-write-a-block/docs/doxygen/Doxyfile.swig_doc.in b/gr-howto-write-a-block/docs/doxygen/Doxyfile.swig_doc.in
new file mode 100644
index 000000000..121c3e858
--- /dev/null
+++ b/gr-howto-write-a-block/docs/doxygen/Doxyfile.swig_doc.in
@@ -0,0 +1,1497 @@
+# Doxyfile 1.6.1
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project
+#
+# All text after a hash (#) is considered a comment and will be ignored
+# The format is:
+# TAG = value [value, ...]
+# For lists items can also be appended using:
+# TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (" ")
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+# This tag specifies the encoding used for all characters in the config file
+# that follow. The default is UTF-8 which is also the encoding used for all
+# text before the first occurrence of this tag. Doxygen uses libiconv (or the
+# iconv built into libc) for the transcoding. See
+# http://www.gnu.org/software/libiconv for the list of possible encodings.
+
+DOXYFILE_ENCODING = UTF-8
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
+# by quotes) that should identify the project.
+
+PROJECT_NAME = @CPACK_PACKAGE_NAME@
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number.
+# This could be handy for archiving the generated documentation or
+# if some version control system is used.
+
+PROJECT_NUMBER = @CPACK_PACKAGE_VERSION@
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
+# base path where the generated documentation will be put.
+# If a relative path is entered, it will be relative to the location
+# where doxygen was started. If left blank the current directory will be used.
+
+OUTPUT_DIRECTORY = @OUTPUT_DIRECTORY@
+
+# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
+# 4096 sub-directories (in 2 levels) under the output directory of each output
+# format and will distribute the generated files over these directories.
+# Enabling this option can be useful when feeding doxygen a huge amount of
+# source files, where putting all generated files in the same directory would
+# otherwise cause performance problems for the file system.
+
+CREATE_SUBDIRS = NO
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all
+# documentation generated by doxygen is written. Doxygen will use this
+# information to generate all constant output in the proper language.
+# The default language is English, other supported languages are:
+# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional,
+# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German,
+# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English
+# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian,
+# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak,
+# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese.
+
+OUTPUT_LANGUAGE = English
+
+# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
+# include brief member descriptions after the members that are listed in
+# the file and class documentation (similar to JavaDoc).
+# Set to NO to disable this.
+
+BRIEF_MEMBER_DESC = YES
+
+# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
+# the brief description of a member or function before the detailed description.
+# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
+# brief descriptions will be completely suppressed.
+
+REPEAT_BRIEF = YES
+
+# This tag implements a quasi-intelligent brief description abbreviator
+# that is used to form the text in various listings. Each string
+# in this list, if found as the leading text of the brief description, will be
+# stripped from the text and the result after processing the whole list, is
+# used as the annotated text. Otherwise, the brief description is used as-is.
+# If left blank, the following values are used ("$name" is automatically
+# replaced with the name of the entity): "The $name class" "The $name widget"
+# "The $name file" "is" "provides" "specifies" "contains"
+# "represents" "a" "an" "the"
+
+ABBREVIATE_BRIEF =
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
+# Doxygen will generate a detailed section even if there is only a brief
+# description.
+
+ALWAYS_DETAILED_SEC = NO
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
+# inherited members of a class in the documentation of that class as if those
+# members were ordinary class members. Constructors, destructors and assignment
+# operators of the base classes will not be shown.
+
+INLINE_INHERITED_MEMB = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
+# path before files name in the file list and in the header files. If set
+# to NO the shortest path that makes the file name unique will be used.
+
+FULL_PATH_NAMES = YES
+
+# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
+# can be used to strip a user-defined part of the path. Stripping is
+# only done if one of the specified strings matches the left-hand part of
+# the path. The tag can be used to show relative paths in the file list.
+# If left blank the directory from which doxygen is run is used as the
+# path to strip.
+
+STRIP_FROM_PATH =
+
+# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
+# the path mentioned in the documentation of a class, which tells
+# the reader which header file to include in order to use a class.
+# If left blank only the name of the header file containing the class
+# definition is used. Otherwise one should specify the include paths that
+# are normally passed to the compiler using the -I flag.
+
+STRIP_FROM_INC_PATH =
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
+# (but less readable) file names. This can be useful is your file systems
+# doesn't support long names like on DOS, Mac, or CD-ROM.
+
+SHORT_NAMES = NO
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
+# will interpret the first line (until the first dot) of a JavaDoc-style
+# comment as the brief description. If set to NO, the JavaDoc
+# comments will behave just like regular Qt-style comments
+# (thus requiring an explicit @brief command for a brief description.)
+
+JAVADOC_AUTOBRIEF = NO
+
+# If the QT_AUTOBRIEF tag is set to YES then Doxygen will
+# interpret the first line (until the first dot) of a Qt-style
+# comment as the brief description. If set to NO, the comments
+# will behave just like regular Qt-style comments (thus requiring
+# an explicit \brief command for a brief description.)
+
+QT_AUTOBRIEF = NO
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
+# treat a multi-line C++ special comment block (i.e. a block of //! or ///
+# comments) as a brief description. This used to be the default behaviour.
+# The new default is to treat a multi-line C++ comment block as a detailed
+# description. Set this tag to YES if you prefer the old behaviour instead.
+
+MULTILINE_CPP_IS_BRIEF = NO
+
+# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
+# member inherits the documentation from any documented member that it
+# re-implements.
+
+INHERIT_DOCS = YES
+
+# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce
+# a new page for each member. If set to NO, the documentation of a member will
+# be part of the file/class/namespace that contains it.
+
+SEPARATE_MEMBER_PAGES = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab.
+# Doxygen uses this value to replace tabs by spaces in code fragments.
+
+TAB_SIZE = 8
+
+# This tag can be used to specify a number of aliases that acts
+# as commands in the documentation. An alias has the form "name=value".
+# For example adding "sideeffect=\par Side Effects:\n" will allow you to
+# put the command \sideeffect (or @sideeffect) in the documentation, which
+# will result in a user-defined paragraph with heading "Side Effects:".
+# You can put \n's in the value part of an alias to insert newlines.
+
+ALIASES =
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
+# sources only. Doxygen will then generate output that is more tailored for C.
+# For instance, some of the names that are used will be different. The list
+# of all members will be omitted, etc.
+
+OPTIMIZE_OUTPUT_FOR_C = NO
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java
+# sources only. Doxygen will then generate output that is more tailored for
+# Java. For instance, namespaces will be presented as packages, qualified
+# scopes will look different, etc.
+
+OPTIMIZE_OUTPUT_JAVA = NO
+
+# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
+# sources only. Doxygen will then generate output that is more tailored for
+# Fortran.
+
+OPTIMIZE_FOR_FORTRAN = NO
+
+# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
+# sources. Doxygen will then generate output that is tailored for
+# VHDL.
+
+OPTIMIZE_OUTPUT_VHDL = NO
+
+# Doxygen selects the parser to use depending on the extension of the files it parses.
+# With this tag you can assign which parser to use for a given extension.
+# Doxygen has a built-in mapping, but you can override or extend it using this tag.
+# The format is ext=language, where ext is a file extension, and language is one of
+# the parsers supported by doxygen: IDL, Java, Javascript, C#, C, C++, D, PHP,
+# Objective-C, Python, Fortran, VHDL, C, C++. For instance to make doxygen treat
+# .inc files as Fortran files (default is PHP), and .f files as C (default is Fortran),
+# use: inc=Fortran f=C. Note that for custom extensions you also need to set FILE_PATTERNS otherwise the files are not read by doxygen.
+
+EXTENSION_MAPPING =
+
+# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
+# to include (a tag file for) the STL sources as input, then you should
+# set this tag to YES in order to let doxygen match functions declarations and
+# definitions whose arguments contain STL classes (e.g. func(std::string); v.s.
+# func(std::string) {}). This also make the inheritance and collaboration
+# diagrams that involve STL classes more complete and accurate.
+
+BUILTIN_STL_SUPPORT = YES
+
+# If you use Microsoft's C++/CLI language, you should set this option to YES to
+# enable parsing support.
+
+CPP_CLI_SUPPORT = NO
+
+# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only.
+# Doxygen will parse them like normal C++ but will assume all classes use public
+# instead of private inheritance when no explicit protection keyword is present.
+
+SIP_SUPPORT = NO
+
+# For Microsoft's IDL there are propget and propput attributes to indicate getter
+# and setter methods for a property. Setting this option to YES (the default)
+# will make doxygen to replace the get and set methods by a property in the
+# documentation. This will only work if the methods are indeed getting or
+# setting a simple type. If this is not the case, or you want to show the
+# methods anyway, you should set this option to NO.
+
+IDL_PROPERTY_SUPPORT = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
+# tag is set to YES, then doxygen will reuse the documentation of the first
+# member in the group (if any) for the other members of the group. By default
+# all members of a group must be documented explicitly.
+
+DISTRIBUTE_GROUP_DOC = NO
+
+# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
+# the same type (for instance a group of public functions) to be put as a
+# subgroup of that type (e.g. under the Public Functions section). Set it to
+# NO to prevent subgrouping. Alternatively, this can be done per class using
+# the \nosubgrouping command.
+
+SUBGROUPING = YES
+
+# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum
+# is documented as struct, union, or enum with the name of the typedef. So
+# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
+# with name TypeT. When disabled the typedef will appear as a member of a file,
+# namespace, or class. And the struct will be named TypeS. This can typically
+# be useful for C code in case the coding convention dictates that all compound
+# types are typedef'ed and only the typedef is referenced, never the tag name.
+
+TYPEDEF_HIDES_STRUCT = NO
+
+# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to
+# determine which symbols to keep in memory and which to flush to disk.
+# When the cache is full, less often used symbols will be written to disk.
+# For small to medium size projects (<1000 input files) the default value is
+# probably good enough. For larger projects a too small cache size can cause
+# doxygen to be busy swapping symbols to and from disk most of the time
+# causing a significant performance penality.
+# If the system has enough physical memory increasing the cache will improve the
+# performance by keeping more symbols in memory. Note that the value works on
+# a logarithmic scale so increasing the size by one will rougly double the
+# memory usage. The cache size is given by this formula:
+# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0,
+# corresponding to a cache size of 2^16 = 65536 symbols
+
+SYMBOL_CACHE_SIZE = 0
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
+# documentation are documented, even if no documentation was available.
+# Private class members and static file members will be hidden unless
+# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
+
+EXTRACT_ALL = YES
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
+# will be included in the documentation.
+
+EXTRACT_PRIVATE = NO
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file
+# will be included in the documentation.
+
+EXTRACT_STATIC = NO
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
+# defined locally in source files will be included in the documentation.
+# If set to NO only classes defined in header files are included.
+
+EXTRACT_LOCAL_CLASSES = YES
+
+# This flag is only useful for Objective-C code. When set to YES local
+# methods, which are defined in the implementation section but not in
+# the interface are included in the documentation.
+# If set to NO (the default) only methods in the interface are included.
+
+EXTRACT_LOCAL_METHODS = NO
+
+# If this flag is set to YES, the members of anonymous namespaces will be
+# extracted and appear in the documentation as a namespace called
+# 'anonymous_namespace{file}', where file will be replaced with the base
+# name of the file that contains the anonymous namespace. By default
+# anonymous namespace are hidden.
+
+EXTRACT_ANON_NSPACES = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
+# undocumented members of documented classes, files or namespaces.
+# If set to NO (the default) these members will be included in the
+# various overviews, but no documentation section is generated.
+# This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_MEMBERS = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
+# undocumented classes that are normally visible in the class hierarchy.
+# If set to NO (the default) these classes will be included in the various
+# overviews. This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_CLASSES = NO
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
+# friend (class|struct|union) declarations.
+# If set to NO (the default) these declarations will be included in the
+# documentation.
+
+HIDE_FRIEND_COMPOUNDS = NO
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
+# documentation blocks found inside the body of a function.
+# If set to NO (the default) these blocks will be appended to the
+# function's detailed documentation block.
+
+HIDE_IN_BODY_DOCS = NO
+
+# The INTERNAL_DOCS tag determines if documentation
+# that is typed after a \internal command is included. If the tag is set
+# to NO (the default) then the documentation will be excluded.
+# Set it to YES to include the internal documentation.
+
+INTERNAL_DOCS = NO
+
+# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
+# file names in lower-case letters. If set to YES upper-case letters are also
+# allowed. This is useful if you have classes or files whose names only differ
+# in case and if your file system supports case sensitive file names. Windows
+# and Mac users are advised to set this option to NO.
+
+CASE_SENSE_NAMES = YES
+
+# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
+# will show members with their full class and namespace scopes in the
+# documentation. If set to YES the scope will be hidden.
+
+HIDE_SCOPE_NAMES = NO
+
+# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
+# will put a list of the files that are included by a file in the documentation
+# of that file.
+
+SHOW_INCLUDE_FILES = YES
+
+# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
+# is inserted in the documentation for inline members.
+
+INLINE_INFO = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
+# will sort the (detailed) documentation of file and class members
+# alphabetically by member name. If set to NO the members will appear in
+# declaration order.
+
+SORT_MEMBER_DOCS = YES
+
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
+# brief documentation of file, namespace and class members alphabetically
+# by member name. If set to NO (the default) the members will appear in
+# declaration order.
+
+SORT_BRIEF_DOCS = NO
+
+# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the (brief and detailed) documentation of class members so that constructors and destructors are listed first. If set to NO (the default) the constructors will appear in the respective orders defined by SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO.
+
+SORT_MEMBERS_CTORS_1ST = NO
+
+# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the
+# hierarchy of group names into alphabetical order. If set to NO (the default)
+# the group names will appear in their defined order.
+
+SORT_GROUP_NAMES = NO
+
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
+# sorted by fully-qualified names, including namespaces. If set to
+# NO (the default), the class list will be sorted only by class name,
+# not including the namespace part.
+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
+# Note: This option applies only to the class list, not to the
+# alphabetical list.
+
+SORT_BY_SCOPE_NAME = NO
+
+# The GENERATE_TODOLIST tag can be used to enable (YES) or
+# disable (NO) the todo list. This list is created by putting \todo
+# commands in the documentation.
+
+GENERATE_TODOLIST = YES
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or
+# disable (NO) the test list. This list is created by putting \test
+# commands in the documentation.
+
+GENERATE_TESTLIST = YES
+
+# The GENERATE_BUGLIST tag can be used to enable (YES) or
+# disable (NO) the bug list. This list is created by putting \bug
+# commands in the documentation.
+
+GENERATE_BUGLIST = YES
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
+# disable (NO) the deprecated list. This list is created by putting
+# \deprecated commands in the documentation.
+
+GENERATE_DEPRECATEDLIST= YES
+
+# The ENABLED_SECTIONS tag can be used to enable conditional
+# documentation sections, marked by \if sectionname ... \endif.
+
+ENABLED_SECTIONS =
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
+# the initial value of a variable or define consists of for it to appear in
+# the documentation. If the initializer consists of more lines than specified
+# here it will be hidden. Use a value of 0 to hide initializers completely.
+# The appearance of the initializer of individual variables and defines in the
+# documentation can be controlled using \showinitializer or \hideinitializer
+# command in the documentation regardless of this setting.
+
+MAX_INITIALIZER_LINES = 30
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
+# at the bottom of the documentation of classes and structs. If set to YES the
+# list will mention the files that were used to generate the documentation.
+
+SHOW_USED_FILES = YES
+
+# Set the SHOW_FILES tag to NO to disable the generation of the Files page.
+# This will remove the Files entry from the Quick Index and from the
+# Folder Tree View (if specified). The default is YES.
+
+SHOW_FILES = YES
+
+# Set the SHOW_NAMESPACES tag to NO to disable the generation of the
+# Namespaces page.
+# This will remove the Namespaces entry from the Quick Index
+# and from the Folder Tree View (if specified). The default is YES.
+
+SHOW_NAMESPACES = YES
+
+# The FILE_VERSION_FILTER tag can be used to specify a program or script that
+# doxygen should invoke to get the current version for each file (typically from
+# the version control system). Doxygen will invoke the program by executing (via
+# popen()) the command <command> <input-file>, where <command> is the value of
+# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file
+# provided by doxygen. Whatever the program writes to standard output
+# is used as the file version. See the manual for examples.
+
+FILE_VERSION_FILTER =
+
+# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed by
+# doxygen. The layout file controls the global structure of the generated output files
+# in an output format independent way. The create the layout file that represents
+# doxygen's defaults, run doxygen with the -l option. You can optionally specify a
+# file name after the option, if omitted DoxygenLayout.xml will be used as the name
+# of the layout file.
+
+LAYOUT_FILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated
+# by doxygen. Possible values are YES and NO. If left blank NO is used.
+
+QUIET = YES
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are
+# generated by doxygen. Possible values are YES and NO. If left blank
+# NO is used.
+
+WARNINGS = YES
+
+# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
+# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
+# automatically be disabled.
+
+WARN_IF_UNDOCUMENTED = YES
+
+# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
+# potential errors in the documentation, such as not documenting some
+# parameters in a documented function, or documenting parameters that
+# don't exist or using markup commands wrongly.
+
+WARN_IF_DOC_ERROR = YES
+
+# This WARN_NO_PARAMDOC option can be abled to get warnings for
+# functions that are documented, but have no documentation for their parameters
+# or return value. If set to NO (the default) doxygen will only warn about
+# wrong or incomplete parameter documentation, but not about the absence of
+# documentation.
+
+WARN_NO_PARAMDOC = NO
+
+# The WARN_FORMAT tag determines the format of the warning messages that
+# doxygen can produce. The string should contain the $file, $line, and $text
+# tags, which will be replaced by the file and line number from which the
+# warning originated and the warning text. Optionally the format may contain
+# $version, which will be replaced by the version of the file (if it could
+# be obtained via FILE_VERSION_FILTER)
+
+WARN_FORMAT = "$file:$line: $text"
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning
+# and error messages should be written. If left blank the output is written
+# to stderr.
+
+WARN_LOGFILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag can be used to specify the files and/or directories that contain
+# documented source files. You may enter file names like "myfile.cpp" or
+# directories like "/usr/src/myproject". Separate the files or directories
+# with spaces.
+
+INPUT = @INPUT_PATHS@
+
+# This tag can be used to specify the character encoding of the source files
+# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
+# also the default input encoding. Doxygen uses libiconv (or the iconv built
+# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for
+# the list of possible encodings.
+
+INPUT_ENCODING = UTF-8
+
+# If the value of the INPUT tag contains directories, you can use the
+# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank the following patterns are tested:
+# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx
+# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90
+
+FILE_PATTERNS = *.h
+
+# The RECURSIVE tag can be used to turn specify whether or not subdirectories
+# should be searched for input files as well. Possible values are YES and NO.
+# If left blank NO is used.
+
+RECURSIVE = YES
+
+# The EXCLUDE tag can be used to specify files and/or directories that should
+# excluded from the INPUT source files. This way you can easily exclude a
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+
+EXCLUDE =
+
+# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
+# directories that are symbolic links (a Unix filesystem feature) are excluded
+# from the input.
+
+EXCLUDE_SYMLINKS = NO
+
+# If the value of the INPUT tag contains directories, you can use the
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
+# certain files from those directories. Note that the wildcards are matched
+# against the file with absolute path, so to exclude all test directories
+# for example use the pattern */test/*
+
+EXCLUDE_PATTERNS =
+
+# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
+# (namespaces, classes, functions, etc.) that should be excluded from the
+# output. The symbol name can be a fully qualified name, a word, or if the
+# wildcard * is used, a substring. Examples: ANamespace, AClass,
+# AClass::ANamespace, ANamespace::*Test
+
+EXCLUDE_SYMBOLS =
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or
+# directories that contain example code fragments that are included (see
+# the \include command).
+
+EXAMPLE_PATH =
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank all files are included.
+
+EXAMPLE_PATTERNS =
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
+# searched for input files to be used with the \include or \dontinclude
+# commands irrespective of the value of the RECURSIVE tag.
+# Possible values are YES and NO. If left blank NO is used.
+
+EXAMPLE_RECURSIVE = NO
+
+# The IMAGE_PATH tag can be used to specify one or more files or
+# directories that contain image that are included in the documentation (see
+# the \image command).
+
+IMAGE_PATH =
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should
+# invoke to filter for each input file. Doxygen will invoke the filter program
+# by executing (via popen()) the command <filter> <input-file>, where <filter>
+# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
+# input file. Doxygen will then use the output that the filter program writes
+# to standard output.
+# If FILTER_PATTERNS is specified, this tag will be
+# ignored.
+
+INPUT_FILTER =
+
+# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
+# basis.
+# Doxygen will compare the file name with each pattern and apply the
+# filter if there is a match.
+# The filters are a list of the form:
+# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
+# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER
+# is applied to all files.
+
+FILTER_PATTERNS =
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
+# INPUT_FILTER) will be used to filter the input files when producing source
+# files to browse (i.e. when SOURCE_BROWSER is set to YES).
+
+FILTER_SOURCE_FILES = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will
+# be generated. Documented entities will be cross-referenced with these sources.
+# Note: To get rid of all source code in the generated output, make sure also
+# VERBATIM_HEADERS is set to NO.
+
+SOURCE_BROWSER = NO
+
+# Setting the INLINE_SOURCES tag to YES will include the body
+# of functions and classes directly in the documentation.
+
+INLINE_SOURCES = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
+# doxygen to hide any special comment blocks from generated source code
+# fragments. Normal C and C++ comments will always remain visible.
+
+STRIP_CODE_COMMENTS = YES
+
+# If the REFERENCED_BY_RELATION tag is set to YES
+# then for each documented function all documented
+# functions referencing it will be listed.
+
+REFERENCED_BY_RELATION = NO
+
+# If the REFERENCES_RELATION tag is set to YES
+# then for each documented function all documented entities
+# called/used by that function will be listed.
+
+REFERENCES_RELATION = NO
+
+# If the REFERENCES_LINK_SOURCE tag is set to YES (the default)
+# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
+# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
+# link to the source code.
+# Otherwise they will link to the documentation.
+
+REFERENCES_LINK_SOURCE = YES
+
+# If the USE_HTAGS tag is set to YES then the references to source code
+# will point to the HTML generated by the htags(1) tool instead of doxygen
+# built-in source browser. The htags tool is part of GNU's global source
+# tagging system (see http://www.gnu.org/software/global/global.html). You
+# will need version 4.8.6 or higher.
+
+USE_HTAGS = NO
+
+# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
+# will generate a verbatim copy of the header file for each class for
+# which an include is specified. Set to NO to disable this.
+
+VERBATIM_HEADERS = YES
+
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
+# of all compounds will be generated. Enable this if the project
+# contains a lot of classes, structs, unions or interfaces.
+
+ALPHABETICAL_INDEX = NO
+
+# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
+# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
+# in which this list will be split (can be a number in the range [1..20])
+
+COLS_IN_ALPHA_INDEX = 5
+
+# In case all classes in a project start with a common prefix, all
+# classes will be put under the same header in the alphabetical index.
+# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
+# should be ignored while generating the index headers.
+
+IGNORE_PREFIX =
+
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
+# generate HTML output.
+
+GENERATE_HTML = NO
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `html' will be used as the default path.
+
+HTML_OUTPUT = html
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
+# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
+# doxygen will generate files with .html extension.
+
+HTML_FILE_EXTENSION = .html
+
+# The HTML_HEADER tag can be used to specify a personal HTML header for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard header.
+
+HTML_HEADER =
+
+# The HTML_FOOTER tag can be used to specify a personal HTML footer for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard footer.
+
+HTML_FOOTER =
+
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
+# style sheet that is used by each HTML page. It can be used to
+# fine-tune the look of the HTML output. If the tag is left blank doxygen
+# will generate a default style sheet. Note that doxygen will try to copy
+# the style sheet file to the HTML output directory, so don't put your own
+# stylesheet in the HTML output directory as well, or it will be erased!
+
+HTML_STYLESHEET =
+
+# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
+# documentation will contain sections that can be hidden and shown after the
+# page has loaded. For this to work a browser that supports
+# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox
+# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
+
+HTML_DYNAMIC_SECTIONS = NO
+
+# If the GENERATE_DOCSET tag is set to YES, additional index files
+# will be generated that can be used as input for Apple's Xcode 3
+# integrated development environment, introduced with OSX 10.5 (Leopard).
+# To create a documentation set, doxygen will generate a Makefile in the
+# HTML output directory. Running make will produce the docset in that
+# directory and running "make install" will install the docset in
+# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find
+# it at startup.
+# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html for more information.
+
+GENERATE_DOCSET = NO
+
+# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the
+# feed. A documentation feed provides an umbrella under which multiple
+# documentation sets from a single provider (such as a company or product suite)
+# can be grouped.
+
+DOCSET_FEEDNAME = "Doxygen generated docs"
+
+# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that
+# should uniquely identify the documentation set bundle. This should be a
+# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen
+# will append .docset to the name.
+
+DOCSET_BUNDLE_ID = org.doxygen.Project
+
+# If the GENERATE_HTMLHELP tag is set to YES, additional index files
+# will be generated that can be used as input for tools like the
+# Microsoft HTML help workshop to generate a compiled HTML help file (.chm)
+# of the generated HTML documentation.
+
+GENERATE_HTMLHELP = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
+# be used to specify the file name of the resulting .chm file. You
+# can add a path in front of the file if the result should not be
+# written to the html output directory.
+
+CHM_FILE =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
+# be used to specify the location (absolute path including file name) of
+# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
+# the HTML help compiler on the generated index.hhp.
+
+HHC_LOCATION =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
+# controls if a separate .chi index file is generated (YES) or that
+# it should be included in the master .chm file (NO).
+
+GENERATE_CHI = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING
+# is used to encode HtmlHelp index (hhk), content (hhc) and project file
+# content.
+
+CHM_INDEX_ENCODING =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
+# controls whether a binary table of contents is generated (YES) or a
+# normal table of contents (NO) in the .chm file.
+
+BINARY_TOC = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members
+# to the contents of the HTML help documentation and to the tree view.
+
+TOC_EXPAND = NO
+
+# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and QHP_VIRTUAL_FOLDER
+# are set, an additional index file will be generated that can be used as input for
+# Qt's qhelpgenerator to generate a Qt Compressed Help (.qch) of the generated
+# HTML documentation.
+
+GENERATE_QHP = NO
+
+# If the QHG_LOCATION tag is specified, the QCH_FILE tag can
+# be used to specify the file name of the resulting .qch file.
+# The path specified is relative to the HTML output folder.
+
+QCH_FILE =
+
+# The QHP_NAMESPACE tag specifies the namespace to use when generating
+# Qt Help Project output. For more information please see
+# http://doc.trolltech.com/qthelpproject.html#namespace
+
+QHP_NAMESPACE =
+
+# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating
+# Qt Help Project output. For more information please see
+# http://doc.trolltech.com/qthelpproject.html#virtual-folders
+
+QHP_VIRTUAL_FOLDER = doc
+
+# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to add.
+# For more information please see
+# http://doc.trolltech.com/qthelpproject.html#custom-filters
+
+QHP_CUST_FILTER_NAME =
+
+# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the custom filter to add.For more information please see
+# <a href="http://doc.trolltech.com/qthelpproject.html#custom-filters">Qt Help Project / Custom Filters</a>.
+
+QHP_CUST_FILTER_ATTRS =
+
+# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this project's
+# filter section matches.
+# <a href="http://doc.trolltech.com/qthelpproject.html#filter-attributes">Qt Help Project / Filter Attributes</a>.
+
+QHP_SECT_FILTER_ATTRS =
+
+# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can
+# be used to specify the location of Qt's qhelpgenerator.
+# If non-empty doxygen will try to run qhelpgenerator on the generated
+# .qhp file.
+
+QHG_LOCATION =
+
+# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
+# top of each HTML page. The value NO (the default) enables the index and
+# the value YES disables it.
+
+DISABLE_INDEX = NO
+
+# This tag can be used to set the number of enum values (range [1..20])
+# that doxygen will group on one line in the generated HTML documentation.
+
+ENUM_VALUES_PER_LINE = 4
+
+# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
+# structure should be generated to display hierarchical information.
+# If the tag value is set to YES, a side panel will be generated
+# containing a tree-like index structure (just like the one that
+# is generated for HTML Help). For this to work a browser that supports
+# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser).
+# Windows users are probably better off using the HTML help feature.
+
+GENERATE_TREEVIEW = NO
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
+# used to set the initial width (in pixels) of the frame in which the tree
+# is shown.
+
+TREEVIEW_WIDTH = 250
+
+# Use this tag to change the font size of Latex formulas included
+# as images in the HTML documentation. The default is 10. Note that
+# when you change the font size after a successful doxygen run you need
+# to manually remove any form_*.png images from the HTML output directory
+# to force them to be regenerated.
+
+FORMULA_FONTSIZE = 10
+
+# When the SEARCHENGINE tag is enable doxygen will generate a search box for the HTML output. The underlying search engine uses javascript
+# and DHTML and should work on any modern browser. Note that when using HTML help (GENERATE_HTMLHELP) or Qt help (GENERATE_QHP)
+# there is already a search function so this one should typically
+# be disabled.
+
+SEARCHENGINE = YES
+
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
+# generate Latex output.
+
+GENERATE_LATEX = NO
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `latex' will be used as the default path.
+
+LATEX_OUTPUT = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
+# invoked. If left blank `latex' will be used as the default command name.
+
+LATEX_CMD_NAME = latex
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
+# generate index for LaTeX. If left blank `makeindex' will be used as the
+# default command name.
+
+MAKEINDEX_CMD_NAME = makeindex
+
+# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
+# LaTeX documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_LATEX = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used
+# by the printer. Possible values are: a4, a4wide, letter, legal and
+# executive. If left blank a4wide will be used.
+
+PAPER_TYPE = a4wide
+
+# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
+# packages that should be included in the LaTeX output.
+
+EXTRA_PACKAGES =
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
+# the generated latex document. The header should contain everything until
+# the first chapter. If it is left blank doxygen will generate a
+# standard header. Notice: only use this tag if you know what you are doing!
+
+LATEX_HEADER =
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
+# is prepared for conversion to pdf (using ps2pdf). The pdf file will
+# contain links (just like the HTML output) instead of page references
+# This makes the output suitable for online browsing using a pdf viewer.
+
+PDF_HYPERLINKS = YES
+
+# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
+# plain latex in the generated Makefile. Set this option to YES to get a
+# higher quality PDF documentation.
+
+USE_PDFLATEX = YES
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
+# command to the generated LaTeX files. This will instruct LaTeX to keep
+# running if errors occur, instead of asking the user for help.
+# This option is also used when generating formulas in HTML.
+
+LATEX_BATCHMODE = NO
+
+# If LATEX_HIDE_INDICES is set to YES then doxygen will not
+# include the index chapters (such as File Index, Compound Index, etc.)
+# in the output.
+
+LATEX_HIDE_INDICES = NO
+
+# If LATEX_SOURCE_CODE is set to YES then doxygen will include source code with syntax highlighting in the LaTeX output. Note that which sources are shown also depends on other settings such as SOURCE_BROWSER.
+
+LATEX_SOURCE_CODE = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
+# The RTF output is optimized for Word 97 and may not look very pretty with
+# other RTF readers or editors.
+
+GENERATE_RTF = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `rtf' will be used as the default path.
+
+RTF_OUTPUT = rtf
+
+# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
+# RTF documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_RTF = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
+# will contain hyperlink fields. The RTF file will
+# contain links (just like the HTML output) instead of page references.
+# This makes the output suitable for online browsing using WORD or other
+# programs which support those fields.
+# Note: wordpad (write) and others do not support links.
+
+RTF_HYPERLINKS = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's
+# config file, i.e. a series of assignments. You only have to provide
+# replacements, missing definitions are set to their default value.
+
+RTF_STYLESHEET_FILE =
+
+# Set optional variables used in the generation of an rtf document.
+# Syntax is similar to doxygen's config file.
+
+RTF_EXTENSIONS_FILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
+# generate man pages
+
+GENERATE_MAN = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `man' will be used as the default path.
+
+MAN_OUTPUT = man
+
+# The MAN_EXTENSION tag determines the extension that is added to
+# the generated man pages (default is the subroutine's section .3)
+
+MAN_EXTENSION = .3
+
+# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
+# then it will generate one additional man file for each entity
+# documented in the real man page(s). These additional files
+# only source the real man page, but without them the man command
+# would be unable to find the correct page. The default is NO.
+
+MAN_LINKS = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES Doxygen will
+# generate an XML file that captures the structure of
+# the code including all documentation.
+
+GENERATE_XML = YES
+
+# The XML_OUTPUT tag is used to specify where the XML pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `xml' will be used as the default path.
+
+XML_OUTPUT = xml
+
+# The XML_SCHEMA tag can be used to specify an XML schema,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_SCHEMA =
+
+# The XML_DTD tag can be used to specify an XML DTD,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_DTD =
+
+# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
+# dump the program listings (including syntax highlighting
+# and cross-referencing information) to the XML output. Note that
+# enabling this will significantly increase the size of the XML output.
+
+XML_PROGRAMLISTING = YES
+
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
+# generate an AutoGen Definitions (see autogen.sf.net) file
+# that captures the structure of the code including all
+# documentation. Note that this feature is still experimental
+# and incomplete at the moment.
+
+GENERATE_AUTOGEN_DEF = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_PERLMOD tag is set to YES Doxygen will
+# generate a Perl module file that captures the structure of
+# the code including all documentation. Note that this
+# feature is still experimental and incomplete at the
+# moment.
+
+GENERATE_PERLMOD = NO
+
+# If the PERLMOD_LATEX tag is set to YES Doxygen will generate
+# the necessary Makefile rules, Perl scripts and LaTeX code to be able
+# to generate PDF and DVI output from the Perl module output.
+
+PERLMOD_LATEX = NO
+
+# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
+# nicely formatted so it can be parsed by a human reader.
+# This is useful
+# if you want to understand what is going on.
+# On the other hand, if this
+# tag is set to NO the size of the Perl module output will be much smaller
+# and Perl will parse it just the same.
+
+PERLMOD_PRETTY = YES
+
+# The names of the make variables in the generated doxyrules.make file
+# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
+# This is useful so different doxyrules.make files included by the same
+# Makefile don't overwrite each other's variables.
+
+PERLMOD_MAKEVAR_PREFIX =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
+# evaluate all C-preprocessor directives found in the sources and include
+# files.
+
+ENABLE_PREPROCESSING = YES
+
+# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
+# names in the source code. If set to NO (the default) only conditional
+# compilation will be performed. Macro expansion can be done in a controlled
+# way by setting EXPAND_ONLY_PREDEF to YES.
+
+MACRO_EXPANSION = YES
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
+# then the macro expansion is limited to the macros specified with the
+# PREDEFINED and EXPAND_AS_DEFINED tags.
+
+EXPAND_ONLY_PREDEF = NO
+
+# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
+# in the INCLUDE_PATH (see below) will be search if a #include is found.
+
+SEARCH_INCLUDES = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that
+# contain include files that are not input files but should be processed by
+# the preprocessor.
+
+INCLUDE_PATH =
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
+# patterns (like *.h and *.hpp) to filter out the header-files in the
+# directories. If left blank, the patterns specified with FILE_PATTERNS will
+# be used.
+
+INCLUDE_FILE_PATTERNS =
+
+# The PREDEFINED tag can be used to specify one or more macro names that
+# are defined before the preprocessor is started (similar to the -D option of
+# gcc). The argument of the tag is a list of macros of the form: name
+# or name=definition (no spaces). If the definition and the = are
+# omitted =1 is assumed. To prevent a macro definition from being
+# undefined via #undef or recursively expanded use the := operator
+# instead of the = operator.
+
+PREDEFINED =
+
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
+# this tag can be used to specify a list of macro names that should be expanded.
+# The macro definition that is found in the sources will be used.
+# Use the PREDEFINED tag if you want to use a different macro definition.
+
+EXPAND_AS_DEFINED =
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
+# doxygen's preprocessor will remove all function-like macros that are alone
+# on a line, have an all uppercase name, and do not end with a semicolon. Such
+# function macros are typically used for boiler-plate code, and will confuse
+# the parser if not removed.
+
+SKIP_FUNCTION_MACROS = YES
+
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references
+#---------------------------------------------------------------------------
+
+# The TAGFILES option can be used to specify one or more tagfiles.
+# Optionally an initial location of the external documentation
+# can be added for each tagfile. The format of a tag file without
+# this location is as follows:
+#
+# TAGFILES = file1 file2 ...
+# Adding location for the tag files is done as follows:
+#
+# TAGFILES = file1=loc1 "file2 = loc2" ...
+# where "loc1" and "loc2" can be relative or absolute paths or
+# URLs. If a location is present for each tag, the installdox tool
+# does not have to be run to correct the links.
+# Note that each tag file must have a unique name
+# (where the name does NOT include the path)
+# If a tag file is not located in the directory in which doxygen
+# is run, you must also specify the path to the tagfile here.
+
+TAGFILES =
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create
+# a tag file that is based on the input files it reads.
+
+GENERATE_TAGFILE =
+
+# If the ALLEXTERNALS tag is set to YES all external classes will be listed
+# in the class index. If set to NO only the inherited external classes
+# will be listed.
+
+ALLEXTERNALS = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
+# in the modules index. If set to NO, only the current project's groups will
+# be listed.
+
+EXTERNAL_GROUPS = YES
+
+# The PERL_PATH should be the absolute path and name of the perl script
+# interpreter (i.e. the result of `which perl').
+
+PERL_PATH = /usr/bin/perl
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
+# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base
+# or super classes. Setting the tag to NO turns the diagrams off. Note that
+# this option is superseded by the HAVE_DOT option below. This is only a
+# fallback. It is recommended to install and use dot, since it yields more
+# powerful graphs.
+
+CLASS_DIAGRAMS = YES
+
+# You can define message sequence charts within doxygen comments using the \msc
+# command. Doxygen will then run the mscgen tool (see
+# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the
+# documentation. The MSCGEN_PATH tag allows you to specify the directory where
+# the mscgen tool resides. If left empty the tool is assumed to be found in the
+# default search path.
+
+MSCGEN_PATH =
+
+# If set to YES, the inheritance and collaboration graphs will hide
+# inheritance and usage relations if the target is undocumented
+# or is not a class.
+
+HIDE_UNDOC_RELATIONS = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
+# available from the path. This tool is part of Graphviz, a graph visualization
+# toolkit from AT&T and Lucent Bell Labs. The other options in this section
+# have no effect if this option is set to NO (the default)
+
+HAVE_DOT = NO
+
+# By default doxygen will write a font called FreeSans.ttf to the output
+# directory and reference it in all dot files that doxygen generates. This
+# font does not include all possible unicode characters however, so when you need
+# these (or just want a differently looking font) you can specify the font name
+# using DOT_FONTNAME. You need need to make sure dot is able to find the font,
+# which can be done by putting it in a standard location or by setting the
+# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory
+# containing the font.
+
+DOT_FONTNAME = FreeSans
+
+# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs.
+# The default size is 10pt.
+
+DOT_FONTSIZE = 10
+
+# By default doxygen will tell dot to use the output directory to look for the
+# FreeSans.ttf font (which doxygen will put there itself). If you specify a
+# different font using DOT_FONTNAME you can set the path where dot
+# can find it using this tag.
+
+DOT_FONTPATH =
+
+# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect inheritance relations. Setting this tag to YES will force the
+# the CLASS_DIAGRAMS tag to NO.
+
+CLASS_GRAPH = YES
+
+# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect implementation dependencies (inheritance, containment, and
+# class references variables) of the class with other documented classes.
+
+COLLABORATION_GRAPH = YES
+
+# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for groups, showing the direct groups dependencies
+
+GROUP_GRAPHS = YES
+
+# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
+# collaboration diagrams in a style similar to the OMG's Unified Modeling
+# Language.
+
+UML_LOOK = NO
+
+# If set to YES, the inheritance and collaboration graphs will show the
+# relations between templates and their instances.
+
+TEMPLATE_RELATIONS = NO
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
+# tags are set to YES then doxygen will generate a graph for each documented
+# file showing the direct and indirect include dependencies of the file with
+# other documented files.
+
+INCLUDE_GRAPH = YES
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
+# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
+# documented header file showing the documented files that directly or
+# indirectly include this file.
+
+INCLUDED_BY_GRAPH = YES
+
+# If the CALL_GRAPH and HAVE_DOT options are set to YES then
+# doxygen will generate a call dependency graph for every global function
+# or class method. Note that enabling this option will significantly increase
+# the time of a run. So in most cases it will be better to enable call graphs
+# for selected functions only using the \callgraph command.
+
+CALL_GRAPH = NO
+
+# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then
+# doxygen will generate a caller dependency graph for every global function
+# or class method. Note that enabling this option will significantly increase
+# the time of a run. So in most cases it will be better to enable caller
+# graphs for selected functions only using the \callergraph command.
+
+CALLER_GRAPH = NO
+
+# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
+# will graphical hierarchy of all classes instead of a textual one.
+
+GRAPHICAL_HIERARCHY = YES
+
+# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES
+# then doxygen will show the dependencies a directory has on other directories
+# in a graphical way. The dependency relations are determined by the #include
+# relations between the files in the directories.
+
+DIRECTORY_GRAPH = YES
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
+# generated by dot. Possible values are png, jpg, or gif
+# If left blank png will be used.
+
+DOT_IMAGE_FORMAT = png
+
+# The tag DOT_PATH can be used to specify the path where the dot tool can be
+# found. If left blank, it is assumed the dot tool can be found in the path.
+
+DOT_PATH =
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that
+# contain dot files that are included in the documentation (see the
+# \dotfile command).
+
+DOTFILE_DIRS =
+
+# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of
+# nodes that will be shown in the graph. If the number of nodes in a graph
+# becomes larger than this value, doxygen will truncate the graph, which is
+# visualized by representing a node as a red box. Note that doxygen if the
+# number of direct children of the root node in a graph is already larger than
+# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note
+# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
+
+DOT_GRAPH_MAX_NODES = 50
+
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
+# graphs generated by dot. A depth value of 3 means that only nodes reachable
+# from the root by following a path via at most 3 edges will be shown. Nodes
+# that lay further from the root node will be omitted. Note that setting this
+# option to 1 or 2 may greatly reduce the computation time needed for large
+# code bases. Also note that the size of a graph can be further restricted by
+# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
+
+MAX_DOT_GRAPH_DEPTH = 0
+
+# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
+# background. This is disabled by default, because dot on Windows does not
+# seem to support this out of the box. Warning: Depending on the platform used,
+# enabling this option may lead to badly anti-aliased labels on the edges of
+# a graph (i.e. they become hard to read).
+
+DOT_TRANSPARENT = NO
+
+# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
+# files in one run (i.e. multiple -o and -T options on the command line). This
+# makes dot run faster, but since only newer versions of dot (>1.8.10)
+# support this, this feature is disabled by default.
+
+DOT_MULTI_TARGETS = YES
+
+# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
+# generate a legend page explaining the meaning of the various boxes and
+# arrows in the dot generated graphs.
+
+GENERATE_LEGEND = YES
+
+# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
+# remove the intermediate dot files that are used to generate
+# the various graphs.
+
+DOT_CLEANUP = YES
diff --git a/gr-howto-write-a-block/docs/doxygen/doxyxml/__init__.py b/gr-howto-write-a-block/docs/doxygen/doxyxml/__init__.py
new file mode 100644
index 000000000..5cd0b3c6c
--- /dev/null
+++ b/gr-howto-write-a-block/docs/doxygen/doxyxml/__init__.py
@@ -0,0 +1,82 @@
+#
+# Copyright 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.
+#
+"""
+Python interface to contents of doxygen xml documentation.
+
+Example use:
+See the contents of the example folder for the C++ and
+doxygen-generated xml used in this example.
+
+>>> # Parse the doxygen docs.
+>>> import os
+>>> this_dir = os.path.dirname(globals()['__file__'])
+>>> xml_path = this_dir + "/example/xml/"
+>>> di = DoxyIndex(xml_path)
+
+Get a list of all top-level objects.
+
+>>> print([mem.name() for mem in di.members()])
+[u'Aadvark', u'aadvarky_enough', u'main']
+
+Get all functions.
+
+>>> print([mem.name() for mem in di.in_category(DoxyFunction)])
+[u'aadvarky_enough', u'main']
+
+Check if an object is present.
+
+>>> di.has_member(u'Aadvark')
+True
+>>> di.has_member(u'Fish')
+False
+
+Get an item by name and check its properties.
+
+>>> aad = di.get_member(u'Aadvark')
+>>> print(aad.brief_description)
+Models the mammal Aadvark.
+>>> print(aad.detailed_description)
+Sadly the model is incomplete and cannot capture all aspects of an aadvark yet.
+<BLANKLINE>
+This line is uninformative and is only to test line breaks in the comments.
+>>> [mem.name() for mem in aad.members()]
+[u'aadvarkness', u'print', u'Aadvark', u'get_aadvarkness']
+>>> aad.get_member(u'print').brief_description
+u'Outputs the vital aadvark statistics.'
+
+"""
+
+from doxyindex import DoxyIndex, DoxyFunction, DoxyParam, DoxyClass, DoxyFile, DoxyNamespace, DoxyGroup, DoxyFriend, DoxyOther
+
+def _test():
+ import os
+ this_dir = os.path.dirname(globals()['__file__'])
+ xml_path = this_dir + "/example/xml/"
+ di = DoxyIndex(xml_path)
+ # Get the Aadvark class
+ aad = di.get_member('Aadvark')
+ aad.brief_description
+ import doctest
+ return doctest.testmod()
+
+if __name__ == "__main__":
+ _test()
+
diff --git a/gr-howto-write-a-block/docs/doxygen/doxyxml/base.py b/gr-howto-write-a-block/docs/doxygen/doxyxml/base.py
new file mode 100644
index 000000000..e8f026ab9
--- /dev/null
+++ b/gr-howto-write-a-block/docs/doxygen/doxyxml/base.py
@@ -0,0 +1,219 @@
+#
+# Copyright 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.
+#
+"""
+A base class is created.
+
+Classes based upon this are used to make more user-friendly interfaces
+to the doxygen xml docs than the generated classes provide.
+"""
+
+import os
+import pdb
+
+from xml.parsers.expat import ExpatError
+
+from generated import compound
+
+
+class Base(object):
+
+ class Duplicate(StandardError):
+ pass
+
+ class NoSuchMember(StandardError):
+ pass
+
+ class ParsingError(StandardError):
+ pass
+
+ def __init__(self, parse_data, top=None):
+ self._parsed = False
+ self._error = False
+ self._parse_data = parse_data
+ self._members = []
+ self._dict_members = {}
+ self._in_category = {}
+ self._data = {}
+ if top is not None:
+ self._xml_path = top._xml_path
+ # Set up holder of references
+ else:
+ top = self
+ self._refs = {}
+ self._xml_path = parse_data
+ self.top = top
+
+ @classmethod
+ def from_refid(cls, refid, top=None):
+ """ Instantiate class from a refid rather than parsing object. """
+ # First check to see if its already been instantiated.
+ if top is not None and refid in top._refs:
+ return top._refs[refid]
+ # Otherwise create a new instance and set refid.
+ inst = cls(None, top=top)
+ inst.refid = refid
+ inst.add_ref(inst)
+ return inst
+
+ @classmethod
+ def from_parse_data(cls, parse_data, top=None):
+ refid = getattr(parse_data, 'refid', None)
+ if refid is not None and top is not None and refid in top._refs:
+ return top._refs[refid]
+ inst = cls(parse_data, top=top)
+ if refid is not None:
+ inst.refid = refid
+ inst.add_ref(inst)
+ return inst
+
+ def add_ref(self, obj):
+ if hasattr(obj, 'refid'):
+ self.top._refs[obj.refid] = obj
+
+ mem_classes = []
+
+ def get_cls(self, mem):
+ for cls in self.mem_classes:
+ if cls.can_parse(mem):
+ return cls
+ raise StandardError(("Did not find a class for object '%s'." \
+ % (mem.get_name())))
+
+ def convert_mem(self, mem):
+ try:
+ cls = self.get_cls(mem)
+ converted = cls.from_parse_data(mem, self.top)
+ if converted is None:
+ raise StandardError('No class matched this object.')
+ self.add_ref(converted)
+ return converted
+ except StandardError, e:
+ print e
+
+ @classmethod
+ def includes(cls, inst):
+ return isinstance(inst, cls)
+
+ @classmethod
+ def can_parse(cls, obj):
+ return False
+
+ def _parse(self):
+ self._parsed = True
+
+ def _get_dict_members(self, cat=None):
+ """
+ For given category a dictionary is returned mapping member names to
+ members of that category. For names that are duplicated the name is
+ mapped to None.
+ """
+ self.confirm_no_error()
+ if cat not in self._dict_members:
+ new_dict = {}
+ for mem in self.in_category(cat):
+ if mem.name() not in new_dict:
+ new_dict[mem.name()] = mem
+ else:
+ new_dict[mem.name()] = self.Duplicate
+ self._dict_members[cat] = new_dict
+ return self._dict_members[cat]
+
+ def in_category(self, cat):
+ self.confirm_no_error()
+ if cat is None:
+ return self._members
+ if cat not in self._in_category:
+ self._in_category[cat] = [mem for mem in self._members
+ if cat.includes(mem)]
+ return self._in_category[cat]
+
+ def get_member(self, name, cat=None):
+ self.confirm_no_error()
+ # Check if it's in a namespace or class.
+ bits = name.split('::')
+ first = bits[0]
+ rest = '::'.join(bits[1:])
+ member = self._get_dict_members(cat).get(first, self.NoSuchMember)
+ # Raise any errors that are returned.
+ if member in set([self.NoSuchMember, self.Duplicate]):
+ raise member()
+ if rest:
+ return member.get_member(rest, cat=cat)
+ return member
+
+ def has_member(self, name, cat=None):
+ try:
+ mem = self.get_member(name, cat=cat)
+ return True
+ except self.NoSuchMember:
+ return False
+
+ def data(self):
+ self.confirm_no_error()
+ return self._data
+
+ def members(self):
+ self.confirm_no_error()
+ return self._members
+
+ def process_memberdefs(self):
+ mdtss = []
+ for sec in self._retrieved_data.compounddef.sectiondef:
+ mdtss += sec.memberdef
+ # At the moment we lose all information associated with sections.
+ # Sometimes a memberdef is in several sectiondef.
+ # We make sure we don't get duplicates here.
+ uniques = set([])
+ for mem in mdtss:
+ converted = self.convert_mem(mem)
+ pair = (mem.name, mem.__class__)
+ if pair not in uniques:
+ uniques.add(pair)
+ self._members.append(converted)
+
+ def retrieve_data(self):
+ filename = os.path.join(self._xml_path, self.refid + '.xml')
+ try:
+ self._retrieved_data = compound.parse(filename)
+ except ExpatError:
+ print('Error in xml in file %s' % filename)
+ self._error = True
+ self._retrieved_data = None
+
+ def check_parsed(self):
+ if not self._parsed:
+ self._parse()
+
+ def confirm_no_error(self):
+ self.check_parsed()
+ if self._error:
+ raise self.ParsingError()
+
+ def error(self):
+ self.check_parsed()
+ return self._error
+
+ def name(self):
+ # first see if we can do it without processing.
+ if self._parse_data is not None:
+ return self._parse_data.name
+ self.check_parsed()
+ return self._retrieved_data.compounddef.name
diff --git a/gr-howto-write-a-block/docs/doxygen/doxyxml/doxyindex.py b/gr-howto-write-a-block/docs/doxygen/doxyxml/doxyindex.py
new file mode 100644
index 000000000..304109a8e
--- /dev/null
+++ b/gr-howto-write-a-block/docs/doxygen/doxyxml/doxyindex.py
@@ -0,0 +1,288 @@
+#
+# Copyright 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.
+#
+"""
+Classes providing more user-friendly interfaces to the doxygen xml
+docs than the generated classes provide.
+"""
+
+import os
+
+from generated import index
+from base import Base
+from text import description
+
+class DoxyIndex(Base):
+ """
+ Parses a doxygen xml directory.
+ """
+
+ __module__ = "gnuradio.utils.doxyxml"
+
+ def _parse(self):
+ if self._parsed:
+ return
+ super(DoxyIndex, self)._parse()
+ self._root = index.parse(os.path.join(self._xml_path, 'index.xml'))
+ for mem in self._root.compound:
+ converted = self.convert_mem(mem)
+ # For files we want the contents to be accessible directly
+ # from the parent rather than having to go through the file
+ # object.
+ if self.get_cls(mem) == DoxyFile:
+ if mem.name.endswith('.h'):
+ self._members += converted.members()
+ self._members.append(converted)
+ else:
+ self._members.append(converted)
+
+
+def generate_swig_doc_i(self):
+ """
+ %feature("docstring") gr_make_align_on_samplenumbers_ss::align_state "
+ Wraps the C++: gr_align_on_samplenumbers_ss::align_state";
+ """
+ pass
+
+
+class DoxyCompMem(Base):
+
+
+ kind = None
+
+ def __init__(self, *args, **kwargs):
+ super(DoxyCompMem, self).__init__(*args, **kwargs)
+
+ @classmethod
+ def can_parse(cls, obj):
+ return obj.kind == cls.kind
+
+ def set_descriptions(self, parse_data):
+ bd = description(getattr(parse_data, 'briefdescription', None))
+ dd = description(getattr(parse_data, 'detaileddescription', None))
+ self._data['brief_description'] = bd
+ self._data['detailed_description'] = dd
+
+ def set_parameters(self, data):
+ vs = [ddc.value for ddc in data.detaileddescription.content_]
+ pls = []
+ for v in vs:
+ if hasattr(v, 'parameterlist'):
+ pls += v.parameterlist
+ pis = []
+ for pl in pls:
+ pis += pl.parameteritem
+ dpis = []
+ for pi in pis:
+ dpi = DoxyParameterItem(pi)
+ dpi._parse()
+ dpis.append(dpi)
+ self._data['params'] = dpis
+
+
+class DoxyCompound(DoxyCompMem):
+ pass
+
+class DoxyMember(DoxyCompMem):
+ pass
+
+class DoxyFunction(DoxyMember):
+
+ __module__ = "gnuradio.utils.doxyxml"
+
+ kind = 'function'
+
+ def _parse(self):
+ if self._parsed:
+ return
+ super(DoxyFunction, self)._parse()
+ self.set_descriptions(self._parse_data)
+ self.set_parameters(self._parse_data)
+ if not self._data['params']:
+ # If the params weren't set by a comment then just grab the names.
+ self._data['params'] = []
+ prms = self._parse_data.param
+ for prm in prms:
+ self._data['params'].append(DoxyParam(prm))
+
+ brief_description = property(lambda self: self.data()['brief_description'])
+ detailed_description = property(lambda self: self.data()['detailed_description'])
+ params = property(lambda self: self.data()['params'])
+
+Base.mem_classes.append(DoxyFunction)
+
+
+class DoxyParam(DoxyMember):
+
+ __module__ = "gnuradio.utils.doxyxml"
+
+ def _parse(self):
+ if self._parsed:
+ return
+ super(DoxyParam, self)._parse()
+ self.set_descriptions(self._parse_data)
+ self._data['declname'] = self._parse_data.declname
+
+ @property
+ def description(self):
+ descriptions = []
+ if self.brief_description:
+ descriptions.append(self.brief_description)
+ if self.detailed_description:
+ descriptions.append(self.detailed_description)
+ return '\n\n'.join(descriptions)
+
+ brief_description = property(lambda self: self.data()['brief_description'])
+ detailed_description = property(lambda self: self.data()['detailed_description'])
+ name = property(lambda self: self.data()['declname'])
+
+class DoxyParameterItem(DoxyMember):
+ """A different representation of a parameter in Doxygen."""
+
+ def _parse(self):
+ if self._parsed:
+ return
+ super(DoxyParameterItem, self)._parse()
+ names = []
+ for nl in self._parse_data.parameternamelist:
+ for pn in nl.parametername:
+ names.append(description(pn))
+ # Just take first name
+ self._data['name'] = names[0]
+ # Get description
+ pd = description(self._parse_data.get_parameterdescription())
+ self._data['description'] = pd
+
+ description = property(lambda self: self.data()['description'])
+ name = property(lambda self: self.data()['name'])
+
+
+class DoxyClass(DoxyCompound):
+
+ __module__ = "gnuradio.utils.doxyxml"
+
+ kind = 'class'
+
+ def _parse(self):
+ if self._parsed:
+ return
+ super(DoxyClass, self)._parse()
+ self.retrieve_data()
+ if self._error:
+ return
+ self.set_descriptions(self._retrieved_data.compounddef)
+ self.set_parameters(self._retrieved_data.compounddef)
+ # Sectiondef.kind tells about whether private or public.
+ # We just ignore this for now.
+ self.process_memberdefs()
+
+ brief_description = property(lambda self: self.data()['brief_description'])
+ detailed_description = property(lambda self: self.data()['detailed_description'])
+ params = property(lambda self: self.data()['params'])
+
+Base.mem_classes.append(DoxyClass)
+
+
+class DoxyFile(DoxyCompound):
+
+ __module__ = "gnuradio.utils.doxyxml"
+
+ kind = 'file'
+
+ def _parse(self):
+ if self._parsed:
+ return
+ super(DoxyFile, self)._parse()
+ self.retrieve_data()
+ self.set_descriptions(self._retrieved_data.compounddef)
+ if self._error:
+ return
+ self.process_memberdefs()
+
+ brief_description = property(lambda self: self.data()['brief_description'])
+ detailed_description = property(lambda self: self.data()['detailed_description'])
+
+Base.mem_classes.append(DoxyFile)
+
+
+class DoxyNamespace(DoxyCompound):
+
+ __module__ = "gnuradio.utils.doxyxml"
+
+ kind = 'namespace'
+
+Base.mem_classes.append(DoxyNamespace)
+
+
+class DoxyGroup(DoxyCompound):
+
+ __module__ = "gnuradio.utils.doxyxml"
+
+ kind = 'group'
+
+ def _parse(self):
+ if self._parsed:
+ return
+ super(DoxyGroup, self)._parse()
+ self.retrieve_data()
+ if self._error:
+ return
+ cdef = self._retrieved_data.compounddef
+ self._data['title'] = description(cdef.title)
+ # Process inner groups
+ grps = cdef.innergroup
+ for grp in grps:
+ converted = DoxyGroup.from_refid(grp.refid, top=self.top)
+ self._members.append(converted)
+ # Process inner classes
+ klasses = cdef.innerclass
+ for kls in klasses:
+ converted = DoxyClass.from_refid(kls.refid, top=self.top)
+ self._members.append(converted)
+ # Process normal members
+ self.process_memberdefs()
+
+ title = property(lambda self: self.data()['title'])
+
+
+Base.mem_classes.append(DoxyGroup)
+
+
+class DoxyFriend(DoxyMember):
+
+ __module__ = "gnuradio.utils.doxyxml"
+
+ kind = 'friend'
+
+Base.mem_classes.append(DoxyFriend)
+
+
+class DoxyOther(Base):
+
+ __module__ = "gnuradio.utils.doxyxml"
+
+ kinds = set(['variable', 'struct', 'union', 'define', 'typedef', 'enum', 'dir', 'page'])
+
+ @classmethod
+ def can_parse(cls, obj):
+ return obj.kind in cls.kinds
+
+Base.mem_classes.append(DoxyOther)
+
diff --git a/gr-howto-write-a-block/docs/doxygen/doxyxml/example/Doxyfile b/gr-howto-write-a-block/docs/doxygen/doxyxml/example/Doxyfile
new file mode 100644
index 000000000..dd2e5c77e
--- /dev/null
+++ b/gr-howto-write-a-block/docs/doxygen/doxyxml/example/Doxyfile
@@ -0,0 +1,1534 @@
+# Doxyfile 1.6.3
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project
+#
+# All text after a hash (#) is considered a comment and will be ignored
+# The format is:
+# TAG = value [value, ...]
+# For lists items can also be appended using:
+# TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (" ")
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+# This tag specifies the encoding used for all characters in the config file
+# that follow. The default is UTF-8 which is also the encoding used for all
+# text before the first occurrence of this tag. Doxygen uses libiconv (or the
+# iconv built into libc) for the transcoding. See
+# http://www.gnu.org/software/libiconv for the list of possible encodings.
+
+DOXYFILE_ENCODING = UTF-8
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
+# by quotes) that should identify the project.
+
+PROJECT_NAME =
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number.
+# This could be handy for archiving the generated documentation or
+# if some version control system is used.
+
+PROJECT_NUMBER =
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
+# base path where the generated documentation will be put.
+# If a relative path is entered, it will be relative to the location
+# where doxygen was started. If left blank the current directory will be used.
+
+OUTPUT_DIRECTORY =
+
+# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
+# 4096 sub-directories (in 2 levels) under the output directory of each output
+# format and will distribute the generated files over these directories.
+# Enabling this option can be useful when feeding doxygen a huge amount of
+# source files, where putting all generated files in the same directory would
+# otherwise cause performance problems for the file system.
+
+CREATE_SUBDIRS = NO
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all
+# documentation generated by doxygen is written. Doxygen will use this
+# information to generate all constant output in the proper language.
+# The default language is English, other supported languages are:
+# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional,
+# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German,
+# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English
+# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian,
+# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak,
+# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese.
+
+OUTPUT_LANGUAGE = English
+
+# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
+# include brief member descriptions after the members that are listed in
+# the file and class documentation (similar to JavaDoc).
+# Set to NO to disable this.
+
+BRIEF_MEMBER_DESC = YES
+
+# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
+# the brief description of a member or function before the detailed description.
+# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
+# brief descriptions will be completely suppressed.
+
+REPEAT_BRIEF = YES
+
+# This tag implements a quasi-intelligent brief description abbreviator
+# that is used to form the text in various listings. Each string
+# in this list, if found as the leading text of the brief description, will be
+# stripped from the text and the result after processing the whole list, is
+# used as the annotated text. Otherwise, the brief description is used as-is.
+# If left blank, the following values are used ("$name" is automatically
+# replaced with the name of the entity): "The $name class" "The $name widget"
+# "The $name file" "is" "provides" "specifies" "contains"
+# "represents" "a" "an" "the"
+
+ABBREVIATE_BRIEF =
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
+# Doxygen will generate a detailed section even if there is only a brief
+# description.
+
+ALWAYS_DETAILED_SEC = NO
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
+# inherited members of a class in the documentation of that class as if those
+# members were ordinary class members. Constructors, destructors and assignment
+# operators of the base classes will not be shown.
+
+INLINE_INHERITED_MEMB = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
+# path before files name in the file list and in the header files. If set
+# to NO the shortest path that makes the file name unique will be used.
+
+FULL_PATH_NAMES = YES
+
+# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
+# can be used to strip a user-defined part of the path. Stripping is
+# only done if one of the specified strings matches the left-hand part of
+# the path. The tag can be used to show relative paths in the file list.
+# If left blank the directory from which doxygen is run is used as the
+# path to strip.
+
+STRIP_FROM_PATH =
+
+# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
+# the path mentioned in the documentation of a class, which tells
+# the reader which header file to include in order to use a class.
+# If left blank only the name of the header file containing the class
+# definition is used. Otherwise one should specify the include paths that
+# are normally passed to the compiler using the -I flag.
+
+STRIP_FROM_INC_PATH =
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
+# (but less readable) file names. This can be useful is your file systems
+# doesn't support long names like on DOS, Mac, or CD-ROM.
+
+SHORT_NAMES = NO
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
+# will interpret the first line (until the first dot) of a JavaDoc-style
+# comment as the brief description. If set to NO, the JavaDoc
+# comments will behave just like regular Qt-style comments
+# (thus requiring an explicit @brief command for a brief description.)
+
+JAVADOC_AUTOBRIEF = NO
+
+# If the QT_AUTOBRIEF tag is set to YES then Doxygen will
+# interpret the first line (until the first dot) of a Qt-style
+# comment as the brief description. If set to NO, the comments
+# will behave just like regular Qt-style comments (thus requiring
+# an explicit \brief command for a brief description.)
+
+QT_AUTOBRIEF = NO
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
+# treat a multi-line C++ special comment block (i.e. a block of //! or ///
+# comments) as a brief description. This used to be the default behaviour.
+# The new default is to treat a multi-line C++ comment block as a detailed
+# description. Set this tag to YES if you prefer the old behaviour instead.
+
+MULTILINE_CPP_IS_BRIEF = NO
+
+# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
+# member inherits the documentation from any documented member that it
+# re-implements.
+
+INHERIT_DOCS = YES
+
+# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce
+# a new page for each member. If set to NO, the documentation of a member will
+# be part of the file/class/namespace that contains it.
+
+SEPARATE_MEMBER_PAGES = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab.
+# Doxygen uses this value to replace tabs by spaces in code fragments.
+
+TAB_SIZE = 8
+
+# This tag can be used to specify a number of aliases that acts
+# as commands in the documentation. An alias has the form "name=value".
+# For example adding "sideeffect=\par Side Effects:\n" will allow you to
+# put the command \sideeffect (or @sideeffect) in the documentation, which
+# will result in a user-defined paragraph with heading "Side Effects:".
+# You can put \n's in the value part of an alias to insert newlines.
+
+ALIASES =
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
+# sources only. Doxygen will then generate output that is more tailored for C.
+# For instance, some of the names that are used will be different. The list
+# of all members will be omitted, etc.
+
+OPTIMIZE_OUTPUT_FOR_C = NO
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java
+# sources only. Doxygen will then generate output that is more tailored for
+# Java. For instance, namespaces will be presented as packages, qualified
+# scopes will look different, etc.
+
+OPTIMIZE_OUTPUT_JAVA = NO
+
+# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
+# sources only. Doxygen will then generate output that is more tailored for
+# Fortran.
+
+OPTIMIZE_FOR_FORTRAN = NO
+
+# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
+# sources. Doxygen will then generate output that is tailored for
+# VHDL.
+
+OPTIMIZE_OUTPUT_VHDL = NO
+
+# Doxygen selects the parser to use depending on the extension of the files it parses.
+# With this tag you can assign which parser to use for a given extension.
+# Doxygen has a built-in mapping, but you can override or extend it using this tag.
+# The format is ext=language, where ext is a file extension, and language is one of
+# the parsers supported by doxygen: IDL, Java, Javascript, C#, C, C++, D, PHP,
+# Objective-C, Python, Fortran, VHDL, C, C++. For instance to make doxygen treat
+# .inc files as Fortran files (default is PHP), and .f files as C (default is Fortran),
+# use: inc=Fortran f=C. Note that for custom extensions you also need to set FILE_PATTERNS otherwise the files are not read by doxygen.
+
+EXTENSION_MAPPING =
+
+# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
+# to include (a tag file for) the STL sources as input, then you should
+# set this tag to YES in order to let doxygen match functions declarations and
+# definitions whose arguments contain STL classes (e.g. func(std::string); v.s.
+# func(std::string) {}). This also make the inheritance and collaboration
+# diagrams that involve STL classes more complete and accurate.
+
+BUILTIN_STL_SUPPORT = NO
+
+# If you use Microsoft's C++/CLI language, you should set this option to YES to
+# enable parsing support.
+
+CPP_CLI_SUPPORT = NO
+
+# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only.
+# Doxygen will parse them like normal C++ but will assume all classes use public
+# instead of private inheritance when no explicit protection keyword is present.
+
+SIP_SUPPORT = NO
+
+# For Microsoft's IDL there are propget and propput attributes to indicate getter
+# and setter methods for a property. Setting this option to YES (the default)
+# will make doxygen to replace the get and set methods by a property in the
+# documentation. This will only work if the methods are indeed getting or
+# setting a simple type. If this is not the case, or you want to show the
+# methods anyway, you should set this option to NO.
+
+IDL_PROPERTY_SUPPORT = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
+# tag is set to YES, then doxygen will reuse the documentation of the first
+# member in the group (if any) for the other members of the group. By default
+# all members of a group must be documented explicitly.
+
+DISTRIBUTE_GROUP_DOC = NO
+
+# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
+# the same type (for instance a group of public functions) to be put as a
+# subgroup of that type (e.g. under the Public Functions section). Set it to
+# NO to prevent subgrouping. Alternatively, this can be done per class using
+# the \nosubgrouping command.
+
+SUBGROUPING = YES
+
+# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum
+# is documented as struct, union, or enum with the name of the typedef. So
+# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
+# with name TypeT. When disabled the typedef will appear as a member of a file,
+# namespace, or class. And the struct will be named TypeS. This can typically
+# be useful for C code in case the coding convention dictates that all compound
+# types are typedef'ed and only the typedef is referenced, never the tag name.
+
+TYPEDEF_HIDES_STRUCT = NO
+
+# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to
+# determine which symbols to keep in memory and which to flush to disk.
+# When the cache is full, less often used symbols will be written to disk.
+# For small to medium size projects (<1000 input files) the default value is
+# probably good enough. For larger projects a too small cache size can cause
+# doxygen to be busy swapping symbols to and from disk most of the time
+# causing a significant performance penality.
+# If the system has enough physical memory increasing the cache will improve the
+# performance by keeping more symbols in memory. Note that the value works on
+# a logarithmic scale so increasing the size by one will rougly double the
+# memory usage. The cache size is given by this formula:
+# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0,
+# corresponding to a cache size of 2^16 = 65536 symbols
+
+SYMBOL_CACHE_SIZE = 0
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
+# documentation are documented, even if no documentation was available.
+# Private class members and static file members will be hidden unless
+# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
+
+EXTRACT_ALL = NO
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
+# will be included in the documentation.
+
+EXTRACT_PRIVATE = NO
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file
+# will be included in the documentation.
+
+EXTRACT_STATIC = NO
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
+# defined locally in source files will be included in the documentation.
+# If set to NO only classes defined in header files are included.
+
+EXTRACT_LOCAL_CLASSES = YES
+
+# This flag is only useful for Objective-C code. When set to YES local
+# methods, which are defined in the implementation section but not in
+# the interface are included in the documentation.
+# If set to NO (the default) only methods in the interface are included.
+
+EXTRACT_LOCAL_METHODS = NO
+
+# If this flag is set to YES, the members of anonymous namespaces will be
+# extracted and appear in the documentation as a namespace called
+# 'anonymous_namespace{file}', where file will be replaced with the base
+# name of the file that contains the anonymous namespace. By default
+# anonymous namespace are hidden.
+
+EXTRACT_ANON_NSPACES = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
+# undocumented members of documented classes, files or namespaces.
+# If set to NO (the default) these members will be included in the
+# various overviews, but no documentation section is generated.
+# This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_MEMBERS = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
+# undocumented classes that are normally visible in the class hierarchy.
+# If set to NO (the default) these classes will be included in the various
+# overviews. This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_CLASSES = NO
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
+# friend (class|struct|union) declarations.
+# If set to NO (the default) these declarations will be included in the
+# documentation.
+
+HIDE_FRIEND_COMPOUNDS = NO
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
+# documentation blocks found inside the body of a function.
+# If set to NO (the default) these blocks will be appended to the
+# function's detailed documentation block.
+
+HIDE_IN_BODY_DOCS = NO
+
+# The INTERNAL_DOCS tag determines if documentation
+# that is typed after a \internal command is included. If the tag is set
+# to NO (the default) then the documentation will be excluded.
+# Set it to YES to include the internal documentation.
+
+INTERNAL_DOCS = NO
+
+# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
+# file names in lower-case letters. If set to YES upper-case letters are also
+# allowed. This is useful if you have classes or files whose names only differ
+# in case and if your file system supports case sensitive file names. Windows
+# and Mac users are advised to set this option to NO.
+
+CASE_SENSE_NAMES = YES
+
+# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
+# will show members with their full class and namespace scopes in the
+# documentation. If set to YES the scope will be hidden.
+
+HIDE_SCOPE_NAMES = NO
+
+# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
+# will put a list of the files that are included by a file in the documentation
+# of that file.
+
+SHOW_INCLUDE_FILES = YES
+
+# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen
+# will list include files with double quotes in the documentation
+# rather than with sharp brackets.
+
+FORCE_LOCAL_INCLUDES = NO
+
+# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
+# is inserted in the documentation for inline members.
+
+INLINE_INFO = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
+# will sort the (detailed) documentation of file and class members
+# alphabetically by member name. If set to NO the members will appear in
+# declaration order.
+
+SORT_MEMBER_DOCS = YES
+
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
+# brief documentation of file, namespace and class members alphabetically
+# by member name. If set to NO (the default) the members will appear in
+# declaration order.
+
+SORT_BRIEF_DOCS = NO
+
+# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the (brief and detailed) documentation of class members so that constructors and destructors are listed first. If set to NO (the default) the constructors will appear in the respective orders defined by SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO.
+
+SORT_MEMBERS_CTORS_1ST = NO
+
+# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the
+# hierarchy of group names into alphabetical order. If set to NO (the default)
+# the group names will appear in their defined order.
+
+SORT_GROUP_NAMES = NO
+
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
+# sorted by fully-qualified names, including namespaces. If set to
+# NO (the default), the class list will be sorted only by class name,
+# not including the namespace part.
+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
+# Note: This option applies only to the class list, not to the
+# alphabetical list.
+
+SORT_BY_SCOPE_NAME = NO
+
+# The GENERATE_TODOLIST tag can be used to enable (YES) or
+# disable (NO) the todo list. This list is created by putting \todo
+# commands in the documentation.
+
+GENERATE_TODOLIST = YES
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or
+# disable (NO) the test list. This list is created by putting \test
+# commands in the documentation.
+
+GENERATE_TESTLIST = YES
+
+# The GENERATE_BUGLIST tag can be used to enable (YES) or
+# disable (NO) the bug list. This list is created by putting \bug
+# commands in the documentation.
+
+GENERATE_BUGLIST = YES
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
+# disable (NO) the deprecated list. This list is created by putting
+# \deprecated commands in the documentation.
+
+GENERATE_DEPRECATEDLIST= YES
+
+# The ENABLED_SECTIONS tag can be used to enable conditional
+# documentation sections, marked by \if sectionname ... \endif.
+
+ENABLED_SECTIONS =
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
+# the initial value of a variable or define consists of for it to appear in
+# the documentation. If the initializer consists of more lines than specified
+# here it will be hidden. Use a value of 0 to hide initializers completely.
+# The appearance of the initializer of individual variables and defines in the
+# documentation can be controlled using \showinitializer or \hideinitializer
+# command in the documentation regardless of this setting.
+
+MAX_INITIALIZER_LINES = 30
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
+# at the bottom of the documentation of classes and structs. If set to YES the
+# list will mention the files that were used to generate the documentation.
+
+SHOW_USED_FILES = YES
+
+# Set the SHOW_FILES tag to NO to disable the generation of the Files page.
+# This will remove the Files entry from the Quick Index and from the
+# Folder Tree View (if specified). The default is YES.
+
+SHOW_FILES = YES
+
+# Set the SHOW_NAMESPACES tag to NO to disable the generation of the
+# Namespaces page.
+# This will remove the Namespaces entry from the Quick Index
+# and from the Folder Tree View (if specified). The default is YES.
+
+SHOW_NAMESPACES = YES
+
+# The FILE_VERSION_FILTER tag can be used to specify a program or script that
+# doxygen should invoke to get the current version for each file (typically from
+# the version control system). Doxygen will invoke the program by executing (via
+# popen()) the command <command> <input-file>, where <command> is the value of
+# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file
+# provided by doxygen. Whatever the program writes to standard output
+# is used as the file version. See the manual for examples.
+
+FILE_VERSION_FILTER =
+
+# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed by
+# doxygen. The layout file controls the global structure of the generated output files
+# in an output format independent way. The create the layout file that represents
+# doxygen's defaults, run doxygen with the -l option. You can optionally specify a
+# file name after the option, if omitted DoxygenLayout.xml will be used as the name
+# of the layout file.
+
+LAYOUT_FILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated
+# by doxygen. Possible values are YES and NO. If left blank NO is used.
+
+QUIET = NO
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are
+# generated by doxygen. Possible values are YES and NO. If left blank
+# NO is used.
+
+WARNINGS = YES
+
+# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
+# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
+# automatically be disabled.
+
+WARN_IF_UNDOCUMENTED = YES
+
+# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
+# potential errors in the documentation, such as not documenting some
+# parameters in a documented function, or documenting parameters that
+# don't exist or using markup commands wrongly.
+
+WARN_IF_DOC_ERROR = YES
+
+# This WARN_NO_PARAMDOC option can be abled to get warnings for
+# functions that are documented, but have no documentation for their parameters
+# or return value. If set to NO (the default) doxygen will only warn about
+# wrong or incomplete parameter documentation, but not about the absence of
+# documentation.
+
+WARN_NO_PARAMDOC = NO
+
+# The WARN_FORMAT tag determines the format of the warning messages that
+# doxygen can produce. The string should contain the $file, $line, and $text
+# tags, which will be replaced by the file and line number from which the
+# warning originated and the warning text. Optionally the format may contain
+# $version, which will be replaced by the version of the file (if it could
+# be obtained via FILE_VERSION_FILTER)
+
+WARN_FORMAT = "$file:$line: $text"
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning
+# and error messages should be written. If left blank the output is written
+# to stderr.
+
+WARN_LOGFILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag can be used to specify the files and/or directories that contain
+# documented source files. You may enter file names like "myfile.cpp" or
+# directories like "/usr/src/myproject". Separate the files or directories
+# with spaces.
+
+INPUT =
+
+# This tag can be used to specify the character encoding of the source files
+# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
+# also the default input encoding. Doxygen uses libiconv (or the iconv built
+# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for
+# the list of possible encodings.
+
+INPUT_ENCODING = UTF-8
+
+# If the value of the INPUT tag contains directories, you can use the
+# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank the following patterns are tested:
+# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx
+# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90
+
+FILE_PATTERNS =
+
+# The RECURSIVE tag can be used to turn specify whether or not subdirectories
+# should be searched for input files as well. Possible values are YES and NO.
+# If left blank NO is used.
+
+RECURSIVE = NO
+
+# The EXCLUDE tag can be used to specify files and/or directories that should
+# excluded from the INPUT source files. This way you can easily exclude a
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+
+EXCLUDE =
+
+# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
+# directories that are symbolic links (a Unix filesystem feature) are excluded
+# from the input.
+
+EXCLUDE_SYMLINKS = NO
+
+# If the value of the INPUT tag contains directories, you can use the
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
+# certain files from those directories. Note that the wildcards are matched
+# against the file with absolute path, so to exclude all test directories
+# for example use the pattern */test/*
+
+EXCLUDE_PATTERNS =
+
+# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
+# (namespaces, classes, functions, etc.) that should be excluded from the
+# output. The symbol name can be a fully qualified name, a word, or if the
+# wildcard * is used, a substring. Examples: ANamespace, AClass,
+# AClass::ANamespace, ANamespace::*Test
+
+EXCLUDE_SYMBOLS =
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or
+# directories that contain example code fragments that are included (see
+# the \include command).
+
+EXAMPLE_PATH =
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank all files are included.
+
+EXAMPLE_PATTERNS =
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
+# searched for input files to be used with the \include or \dontinclude
+# commands irrespective of the value of the RECURSIVE tag.
+# Possible values are YES and NO. If left blank NO is used.
+
+EXAMPLE_RECURSIVE = NO
+
+# The IMAGE_PATH tag can be used to specify one or more files or
+# directories that contain image that are included in the documentation (see
+# the \image command).
+
+IMAGE_PATH =
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should
+# invoke to filter for each input file. Doxygen will invoke the filter program
+# by executing (via popen()) the command <filter> <input-file>, where <filter>
+# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
+# input file. Doxygen will then use the output that the filter program writes
+# to standard output.
+# If FILTER_PATTERNS is specified, this tag will be
+# ignored.
+
+INPUT_FILTER =
+
+# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
+# basis.
+# Doxygen will compare the file name with each pattern and apply the
+# filter if there is a match.
+# The filters are a list of the form:
+# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
+# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER
+# is applied to all files.
+
+FILTER_PATTERNS =
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
+# INPUT_FILTER) will be used to filter the input files when producing source
+# files to browse (i.e. when SOURCE_BROWSER is set to YES).
+
+FILTER_SOURCE_FILES = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will
+# be generated. Documented entities will be cross-referenced with these sources.
+# Note: To get rid of all source code in the generated output, make sure also
+# VERBATIM_HEADERS is set to NO.
+
+SOURCE_BROWSER = NO
+
+# Setting the INLINE_SOURCES tag to YES will include the body
+# of functions and classes directly in the documentation.
+
+INLINE_SOURCES = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
+# doxygen to hide any special comment blocks from generated source code
+# fragments. Normal C and C++ comments will always remain visible.
+
+STRIP_CODE_COMMENTS = YES
+
+# If the REFERENCED_BY_RELATION tag is set to YES
+# then for each documented function all documented
+# functions referencing it will be listed.
+
+REFERENCED_BY_RELATION = NO
+
+# If the REFERENCES_RELATION tag is set to YES
+# then for each documented function all documented entities
+# called/used by that function will be listed.
+
+REFERENCES_RELATION = NO
+
+# If the REFERENCES_LINK_SOURCE tag is set to YES (the default)
+# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
+# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
+# link to the source code.
+# Otherwise they will link to the documentation.
+
+REFERENCES_LINK_SOURCE = YES
+
+# If the USE_HTAGS tag is set to YES then the references to source code
+# will point to the HTML generated by the htags(1) tool instead of doxygen
+# built-in source browser. The htags tool is part of GNU's global source
+# tagging system (see http://www.gnu.org/software/global/global.html). You
+# will need version 4.8.6 or higher.
+
+USE_HTAGS = NO
+
+# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
+# will generate a verbatim copy of the header file for each class for
+# which an include is specified. Set to NO to disable this.
+
+VERBATIM_HEADERS = YES
+
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
+# of all compounds will be generated. Enable this if the project
+# contains a lot of classes, structs, unions or interfaces.
+
+ALPHABETICAL_INDEX = NO
+
+# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
+# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
+# in which this list will be split (can be a number in the range [1..20])
+
+COLS_IN_ALPHA_INDEX = 5
+
+# In case all classes in a project start with a common prefix, all
+# classes will be put under the same header in the alphabetical index.
+# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
+# should be ignored while generating the index headers.
+
+IGNORE_PREFIX =
+
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
+# generate HTML output.
+
+GENERATE_HTML = YES
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `html' will be used as the default path.
+
+HTML_OUTPUT = html
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
+# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
+# doxygen will generate files with .html extension.
+
+HTML_FILE_EXTENSION = .html
+
+# The HTML_HEADER tag can be used to specify a personal HTML header for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard header.
+
+HTML_HEADER =
+
+# The HTML_FOOTER tag can be used to specify a personal HTML footer for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard footer.
+
+HTML_FOOTER =
+
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
+# style sheet that is used by each HTML page. It can be used to
+# fine-tune the look of the HTML output. If the tag is left blank doxygen
+# will generate a default style sheet. Note that doxygen will try to copy
+# the style sheet file to the HTML output directory, so don't put your own
+# stylesheet in the HTML output directory as well, or it will be erased!
+
+HTML_STYLESHEET =
+
+# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
+# page will contain the date and time when the page was generated. Setting
+# this to NO can help when comparing the output of multiple runs.
+
+HTML_TIMESTAMP = YES
+
+# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
+# documentation will contain sections that can be hidden and shown after the
+# page has loaded. For this to work a browser that supports
+# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox
+# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
+
+HTML_DYNAMIC_SECTIONS = NO
+
+# If the GENERATE_DOCSET tag is set to YES, additional index files
+# will be generated that can be used as input for Apple's Xcode 3
+# integrated development environment, introduced with OSX 10.5 (Leopard).
+# To create a documentation set, doxygen will generate a Makefile in the
+# HTML output directory. Running make will produce the docset in that
+# directory and running "make install" will install the docset in
+# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find
+# it at startup.
+# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html for more information.
+
+GENERATE_DOCSET = NO
+
+# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the
+# feed. A documentation feed provides an umbrella under which multiple
+# documentation sets from a single provider (such as a company or product suite)
+# can be grouped.
+
+DOCSET_FEEDNAME = "Doxygen generated docs"
+
+# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that
+# should uniquely identify the documentation set bundle. This should be a
+# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen
+# will append .docset to the name.
+
+DOCSET_BUNDLE_ID = org.doxygen.Project
+
+# If the GENERATE_HTMLHELP tag is set to YES, additional index files
+# will be generated that can be used as input for tools like the
+# Microsoft HTML help workshop to generate a compiled HTML help file (.chm)
+# of the generated HTML documentation.
+
+GENERATE_HTMLHELP = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
+# be used to specify the file name of the resulting .chm file. You
+# can add a path in front of the file if the result should not be
+# written to the html output directory.
+
+CHM_FILE =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
+# be used to specify the location (absolute path including file name) of
+# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
+# the HTML help compiler on the generated index.hhp.
+
+HHC_LOCATION =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
+# controls if a separate .chi index file is generated (YES) or that
+# it should be included in the master .chm file (NO).
+
+GENERATE_CHI = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING
+# is used to encode HtmlHelp index (hhk), content (hhc) and project file
+# content.
+
+CHM_INDEX_ENCODING =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
+# controls whether a binary table of contents is generated (YES) or a
+# normal table of contents (NO) in the .chm file.
+
+BINARY_TOC = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members
+# to the contents of the HTML help documentation and to the tree view.
+
+TOC_EXPAND = NO
+
+# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and QHP_VIRTUAL_FOLDER
+# are set, an additional index file will be generated that can be used as input for
+# Qt's qhelpgenerator to generate a Qt Compressed Help (.qch) of the generated
+# HTML documentation.
+
+GENERATE_QHP = NO
+
+# If the QHG_LOCATION tag is specified, the QCH_FILE tag can
+# be used to specify the file name of the resulting .qch file.
+# The path specified is relative to the HTML output folder.
+
+QCH_FILE =
+
+# The QHP_NAMESPACE tag specifies the namespace to use when generating
+# Qt Help Project output. For more information please see
+# http://doc.trolltech.com/qthelpproject.html#namespace
+
+QHP_NAMESPACE = org.doxygen.Project
+
+# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating
+# Qt Help Project output. For more information please see
+# http://doc.trolltech.com/qthelpproject.html#virtual-folders
+
+QHP_VIRTUAL_FOLDER = doc
+
+# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to add.
+# For more information please see
+# http://doc.trolltech.com/qthelpproject.html#custom-filters
+
+QHP_CUST_FILTER_NAME =
+
+# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the custom filter to add.For more information please see
+# <a href="http://doc.trolltech.com/qthelpproject.html#custom-filters">Qt Help Project / Custom Filters</a>.
+
+QHP_CUST_FILTER_ATTRS =
+
+# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this project's
+# filter section matches.
+# <a href="http://doc.trolltech.com/qthelpproject.html#filter-attributes">Qt Help Project / Filter Attributes</a>.
+
+QHP_SECT_FILTER_ATTRS =
+
+# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can
+# be used to specify the location of Qt's qhelpgenerator.
+# If non-empty doxygen will try to run qhelpgenerator on the generated
+# .qhp file.
+
+QHG_LOCATION =
+
+# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files
+# will be generated, which together with the HTML files, form an Eclipse help
+# plugin. To install this plugin and make it available under the help contents
+# menu in Eclipse, the contents of the directory containing the HTML and XML
+# files needs to be copied into the plugins directory of eclipse. The name of
+# the directory within the plugins directory should be the same as
+# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before the help appears.
+
+GENERATE_ECLIPSEHELP = NO
+
+# A unique identifier for the eclipse help plugin. When installing the plugin
+# the directory name containing the HTML and XML files should also have
+# this name.
+
+ECLIPSE_DOC_ID = org.doxygen.Project
+
+# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
+# top of each HTML page. The value NO (the default) enables the index and
+# the value YES disables it.
+
+DISABLE_INDEX = NO
+
+# This tag can be used to set the number of enum values (range [1..20])
+# that doxygen will group on one line in the generated HTML documentation.
+
+ENUM_VALUES_PER_LINE = 4
+
+# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
+# structure should be generated to display hierarchical information.
+# If the tag value is set to YES, a side panel will be generated
+# containing a tree-like index structure (just like the one that
+# is generated for HTML Help). For this to work a browser that supports
+# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser).
+# Windows users are probably better off using the HTML help feature.
+
+GENERATE_TREEVIEW = NO
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
+# used to set the initial width (in pixels) of the frame in which the tree
+# is shown.
+
+TREEVIEW_WIDTH = 250
+
+# Use this tag to change the font size of Latex formulas included
+# as images in the HTML documentation. The default is 10. Note that
+# when you change the font size after a successful doxygen run you need
+# to manually remove any form_*.png images from the HTML output directory
+# to force them to be regenerated.
+
+FORMULA_FONTSIZE = 10
+
+# When the SEARCHENGINE tag is enabled doxygen will generate a search box for the HTML output. The underlying search engine uses javascript
+# and DHTML and should work on any modern browser. Note that when using HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) there is already a search function so this one should
+# typically be disabled. For large projects the javascript based search engine
+# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution.
+
+SEARCHENGINE = YES
+
+# When the SERVER_BASED_SEARCH tag is enabled the search engine will be implemented using a PHP enabled web server instead of at the web client using Javascript. Doxygen will generate the search PHP script and index
+# file to put on the web server. The advantage of the server based approach is that it scales better to large projects and allows full text search. The disadvances is that it is more difficult to setup
+# and does not have live searching capabilities.
+
+SERVER_BASED_SEARCH = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
+# generate Latex output.
+
+GENERATE_LATEX = YES
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `latex' will be used as the default path.
+
+LATEX_OUTPUT = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
+# invoked. If left blank `latex' will be used as the default command name.
+# Note that when enabling USE_PDFLATEX this option is only used for
+# generating bitmaps for formulas in the HTML output, but not in the
+# Makefile that is written to the output directory.
+
+LATEX_CMD_NAME = latex
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
+# generate index for LaTeX. If left blank `makeindex' will be used as the
+# default command name.
+
+MAKEINDEX_CMD_NAME = makeindex
+
+# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
+# LaTeX documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_LATEX = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used
+# by the printer. Possible values are: a4, a4wide, letter, legal and
+# executive. If left blank a4wide will be used.
+
+PAPER_TYPE = a4wide
+
+# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
+# packages that should be included in the LaTeX output.
+
+EXTRA_PACKAGES =
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
+# the generated latex document. The header should contain everything until
+# the first chapter. If it is left blank doxygen will generate a
+# standard header. Notice: only use this tag if you know what you are doing!
+
+LATEX_HEADER =
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
+# is prepared for conversion to pdf (using ps2pdf). The pdf file will
+# contain links (just like the HTML output) instead of page references
+# This makes the output suitable for online browsing using a pdf viewer.
+
+PDF_HYPERLINKS = YES
+
+# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
+# plain latex in the generated Makefile. Set this option to YES to get a
+# higher quality PDF documentation.
+
+USE_PDFLATEX = YES
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
+# command to the generated LaTeX files. This will instruct LaTeX to keep
+# running if errors occur, instead of asking the user for help.
+# This option is also used when generating formulas in HTML.
+
+LATEX_BATCHMODE = NO
+
+# If LATEX_HIDE_INDICES is set to YES then doxygen will not
+# include the index chapters (such as File Index, Compound Index, etc.)
+# in the output.
+
+LATEX_HIDE_INDICES = NO
+
+# If LATEX_SOURCE_CODE is set to YES then doxygen will include source code with syntax highlighting in the LaTeX output. Note that which sources are shown also depends on other settings such as SOURCE_BROWSER.
+
+LATEX_SOURCE_CODE = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
+# The RTF output is optimized for Word 97 and may not look very pretty with
+# other RTF readers or editors.
+
+GENERATE_RTF = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `rtf' will be used as the default path.
+
+RTF_OUTPUT = rtf
+
+# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
+# RTF documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_RTF = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
+# will contain hyperlink fields. The RTF file will
+# contain links (just like the HTML output) instead of page references.
+# This makes the output suitable for online browsing using WORD or other
+# programs which support those fields.
+# Note: wordpad (write) and others do not support links.
+
+RTF_HYPERLINKS = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's
+# config file, i.e. a series of assignments. You only have to provide
+# replacements, missing definitions are set to their default value.
+
+RTF_STYLESHEET_FILE =
+
+# Set optional variables used in the generation of an rtf document.
+# Syntax is similar to doxygen's config file.
+
+RTF_EXTENSIONS_FILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
+# generate man pages
+
+GENERATE_MAN = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `man' will be used as the default path.
+
+MAN_OUTPUT = man
+
+# The MAN_EXTENSION tag determines the extension that is added to
+# the generated man pages (default is the subroutine's section .3)
+
+MAN_EXTENSION = .3
+
+# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
+# then it will generate one additional man file for each entity
+# documented in the real man page(s). These additional files
+# only source the real man page, but without them the man command
+# would be unable to find the correct page. The default is NO.
+
+MAN_LINKS = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES Doxygen will
+# generate an XML file that captures the structure of
+# the code including all documentation.
+
+GENERATE_XML = YES
+
+# The XML_OUTPUT tag is used to specify where the XML pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `xml' will be used as the default path.
+
+XML_OUTPUT = xml
+
+# The XML_SCHEMA tag can be used to specify an XML schema,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_SCHEMA =
+
+# The XML_DTD tag can be used to specify an XML DTD,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_DTD =
+
+# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
+# dump the program listings (including syntax highlighting
+# and cross-referencing information) to the XML output. Note that
+# enabling this will significantly increase the size of the XML output.
+
+XML_PROGRAMLISTING = YES
+
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
+# generate an AutoGen Definitions (see autogen.sf.net) file
+# that captures the structure of the code including all
+# documentation. Note that this feature is still experimental
+# and incomplete at the moment.
+
+GENERATE_AUTOGEN_DEF = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_PERLMOD tag is set to YES Doxygen will
+# generate a Perl module file that captures the structure of
+# the code including all documentation. Note that this
+# feature is still experimental and incomplete at the
+# moment.
+
+GENERATE_PERLMOD = NO
+
+# If the PERLMOD_LATEX tag is set to YES Doxygen will generate
+# the necessary Makefile rules, Perl scripts and LaTeX code to be able
+# to generate PDF and DVI output from the Perl module output.
+
+PERLMOD_LATEX = NO
+
+# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
+# nicely formatted so it can be parsed by a human reader.
+# This is useful
+# if you want to understand what is going on.
+# On the other hand, if this
+# tag is set to NO the size of the Perl module output will be much smaller
+# and Perl will parse it just the same.
+
+PERLMOD_PRETTY = YES
+
+# The names of the make variables in the generated doxyrules.make file
+# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
+# This is useful so different doxyrules.make files included by the same
+# Makefile don't overwrite each other's variables.
+
+PERLMOD_MAKEVAR_PREFIX =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
+# evaluate all C-preprocessor directives found in the sources and include
+# files.
+
+ENABLE_PREPROCESSING = YES
+
+# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
+# names in the source code. If set to NO (the default) only conditional
+# compilation will be performed. Macro expansion can be done in a controlled
+# way by setting EXPAND_ONLY_PREDEF to YES.
+
+MACRO_EXPANSION = NO
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
+# then the macro expansion is limited to the macros specified with the
+# PREDEFINED and EXPAND_AS_DEFINED tags.
+
+EXPAND_ONLY_PREDEF = NO
+
+# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
+# in the INCLUDE_PATH (see below) will be search if a #include is found.
+
+SEARCH_INCLUDES = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that
+# contain include files that are not input files but should be processed by
+# the preprocessor.
+
+INCLUDE_PATH =
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
+# patterns (like *.h and *.hpp) to filter out the header-files in the
+# directories. If left blank, the patterns specified with FILE_PATTERNS will
+# be used.
+
+INCLUDE_FILE_PATTERNS =
+
+# The PREDEFINED tag can be used to specify one or more macro names that
+# are defined before the preprocessor is started (similar to the -D option of
+# gcc). The argument of the tag is a list of macros of the form: name
+# or name=definition (no spaces). If the definition and the = are
+# omitted =1 is assumed. To prevent a macro definition from being
+# undefined via #undef or recursively expanded use the := operator
+# instead of the = operator.
+
+PREDEFINED =
+
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
+# this tag can be used to specify a list of macro names that should be expanded.
+# The macro definition that is found in the sources will be used.
+# Use the PREDEFINED tag if you want to use a different macro definition.
+
+EXPAND_AS_DEFINED =
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
+# doxygen's preprocessor will remove all function-like macros that are alone
+# on a line, have an all uppercase name, and do not end with a semicolon. Such
+# function macros are typically used for boiler-plate code, and will confuse
+# the parser if not removed.
+
+SKIP_FUNCTION_MACROS = YES
+
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references
+#---------------------------------------------------------------------------
+
+# The TAGFILES option can be used to specify one or more tagfiles.
+# Optionally an initial location of the external documentation
+# can be added for each tagfile. The format of a tag file without
+# this location is as follows:
+#
+# TAGFILES = file1 file2 ...
+# Adding location for the tag files is done as follows:
+#
+# TAGFILES = file1=loc1 "file2 = loc2" ...
+# where "loc1" and "loc2" can be relative or absolute paths or
+# URLs. If a location is present for each tag, the installdox tool
+# does not have to be run to correct the links.
+# Note that each tag file must have a unique name
+# (where the name does NOT include the path)
+# If a tag file is not located in the directory in which doxygen
+# is run, you must also specify the path to the tagfile here.
+
+TAGFILES =
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create
+# a tag file that is based on the input files it reads.
+
+GENERATE_TAGFILE =
+
+# If the ALLEXTERNALS tag is set to YES all external classes will be listed
+# in the class index. If set to NO only the inherited external classes
+# will be listed.
+
+ALLEXTERNALS = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
+# in the modules index. If set to NO, only the current project's groups will
+# be listed.
+
+EXTERNAL_GROUPS = YES
+
+# The PERL_PATH should be the absolute path and name of the perl script
+# interpreter (i.e. the result of `which perl').
+
+PERL_PATH = /usr/bin/perl
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
+# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base
+# or super classes. Setting the tag to NO turns the diagrams off. Note that
+# this option is superseded by the HAVE_DOT option below. This is only a
+# fallback. It is recommended to install and use dot, since it yields more
+# powerful graphs.
+
+CLASS_DIAGRAMS = YES
+
+# You can define message sequence charts within doxygen comments using the \msc
+# command. Doxygen will then run the mscgen tool (see
+# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the
+# documentation. The MSCGEN_PATH tag allows you to specify the directory where
+# the mscgen tool resides. If left empty the tool is assumed to be found in the
+# default search path.
+
+MSCGEN_PATH =
+
+# If set to YES, the inheritance and collaboration graphs will hide
+# inheritance and usage relations if the target is undocumented
+# or is not a class.
+
+HIDE_UNDOC_RELATIONS = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
+# available from the path. This tool is part of Graphviz, a graph visualization
+# toolkit from AT&T and Lucent Bell Labs. The other options in this section
+# have no effect if this option is set to NO (the default)
+
+HAVE_DOT = NO
+
+# By default doxygen will write a font called FreeSans.ttf to the output
+# directory and reference it in all dot files that doxygen generates. This
+# font does not include all possible unicode characters however, so when you need
+# these (or just want a differently looking font) you can specify the font name
+# using DOT_FONTNAME. You need need to make sure dot is able to find the font,
+# which can be done by putting it in a standard location or by setting the
+# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory
+# containing the font.
+
+DOT_FONTNAME = FreeSans
+
+# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs.
+# The default size is 10pt.
+
+DOT_FONTSIZE = 10
+
+# By default doxygen will tell dot to use the output directory to look for the
+# FreeSans.ttf font (which doxygen will put there itself). If you specify a
+# different font using DOT_FONTNAME you can set the path where dot
+# can find it using this tag.
+
+DOT_FONTPATH =
+
+# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect inheritance relations. Setting this tag to YES will force the
+# the CLASS_DIAGRAMS tag to NO.
+
+CLASS_GRAPH = YES
+
+# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect implementation dependencies (inheritance, containment, and
+# class references variables) of the class with other documented classes.
+
+COLLABORATION_GRAPH = YES
+
+# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for groups, showing the direct groups dependencies
+
+GROUP_GRAPHS = YES
+
+# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
+# collaboration diagrams in a style similar to the OMG's Unified Modeling
+# Language.
+
+UML_LOOK = NO
+
+# If set to YES, the inheritance and collaboration graphs will show the
+# relations between templates and their instances.
+
+TEMPLATE_RELATIONS = NO
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
+# tags are set to YES then doxygen will generate a graph for each documented
+# file showing the direct and indirect include dependencies of the file with
+# other documented files.
+
+INCLUDE_GRAPH = YES
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
+# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
+# documented header file showing the documented files that directly or
+# indirectly include this file.
+
+INCLUDED_BY_GRAPH = YES
+
+# If the CALL_GRAPH and HAVE_DOT options are set to YES then
+# doxygen will generate a call dependency graph for every global function
+# or class method. Note that enabling this option will significantly increase
+# the time of a run. So in most cases it will be better to enable call graphs
+# for selected functions only using the \callgraph command.
+
+CALL_GRAPH = NO
+
+# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then
+# doxygen will generate a caller dependency graph for every global function
+# or class method. Note that enabling this option will significantly increase
+# the time of a run. So in most cases it will be better to enable caller
+# graphs for selected functions only using the \callergraph command.
+
+CALLER_GRAPH = NO
+
+# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
+# will graphical hierarchy of all classes instead of a textual one.
+
+GRAPHICAL_HIERARCHY = YES
+
+# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES
+# then doxygen will show the dependencies a directory has on other directories
+# in a graphical way. The dependency relations are determined by the #include
+# relations between the files in the directories.
+
+DIRECTORY_GRAPH = YES
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
+# generated by dot. Possible values are png, jpg, or gif
+# If left blank png will be used.
+
+DOT_IMAGE_FORMAT = png
+
+# The tag DOT_PATH can be used to specify the path where the dot tool can be
+# found. If left blank, it is assumed the dot tool can be found in the path.
+
+DOT_PATH =
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that
+# contain dot files that are included in the documentation (see the
+# \dotfile command).
+
+DOTFILE_DIRS =
+
+# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of
+# nodes that will be shown in the graph. If the number of nodes in a graph
+# becomes larger than this value, doxygen will truncate the graph, which is
+# visualized by representing a node as a red box. Note that doxygen if the
+# number of direct children of the root node in a graph is already larger than
+# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note
+# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
+
+DOT_GRAPH_MAX_NODES = 50
+
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
+# graphs generated by dot. A depth value of 3 means that only nodes reachable
+# from the root by following a path via at most 3 edges will be shown. Nodes
+# that lay further from the root node will be omitted. Note that setting this
+# option to 1 or 2 may greatly reduce the computation time needed for large
+# code bases. Also note that the size of a graph can be further restricted by
+# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
+
+MAX_DOT_GRAPH_DEPTH = 0
+
+# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
+# background. This is disabled by default, because dot on Windows does not
+# seem to support this out of the box. Warning: Depending on the platform used,
+# enabling this option may lead to badly anti-aliased labels on the edges of
+# a graph (i.e. they become hard to read).
+
+DOT_TRANSPARENT = NO
+
+# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
+# files in one run (i.e. multiple -o and -T options on the command line). This
+# makes dot run faster, but since only newer versions of dot (>1.8.10)
+# support this, this feature is disabled by default.
+
+DOT_MULTI_TARGETS = YES
+
+# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
+# generate a legend page explaining the meaning of the various boxes and
+# arrows in the dot generated graphs.
+
+GENERATE_LEGEND = YES
+
+# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
+# remove the intermediate dot files that are used to generate
+# the various graphs.
+
+DOT_CLEANUP = YES
diff --git a/gr-howto-write-a-block/docs/doxygen/doxyxml/example/aadvark.cc b/gr-howto-write-a-block/docs/doxygen/doxyxml/example/aadvark.cc
new file mode 100644
index 000000000..f91c1ba56
--- /dev/null
+++ b/gr-howto-write-a-block/docs/doxygen/doxyxml/example/aadvark.cc
@@ -0,0 +1,50 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+#include <iostream>
+#include "aadvark.h"
+
+void Aadvark::print() {
+ std::cout << "aadvark is " << aadvarkness << "/10 aadvarky" << std::endl;
+}
+
+Aadvark::Aadvark(int aaness): aadvarkness(aaness) {}
+
+bool aadvarky_enough(Aadvark aad) {
+ if (aad.get_aadvarkness() > 6)
+ return true;
+ else
+ return false;
+}
+
+int Aadvark::get_aadvarkness() {
+ return aadvarkness;
+}
+
+int main() {
+ Aadvark arold = Aadvark(6);
+ arold.print();
+ if (aadvarky_enough(arold))
+ std::cout << "He is aadvarky enough" << std::endl;
+ else
+ std::cout << "He is not aadvarky enough" << std::endl;
+}
+
diff --git a/gr-howto-write-a-block/docs/doxygen/doxyxml/example/aadvark.h b/gr-howto-write-a-block/docs/doxygen/doxyxml/example/aadvark.h
new file mode 100644
index 000000000..d3c17445e
--- /dev/null
+++ b/gr-howto-write-a-block/docs/doxygen/doxyxml/example/aadvark.h
@@ -0,0 +1,44 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+#include <iostream>
+
+/*!
+ * \brief Models the mammal Aadvark.
+ *
+ * Sadly the model is incomplete and cannot capture all aspects of an aadvark yet.
+ *
+ * This line is uninformative and is only to test line breaks in the comments.
+ */
+class Aadvark {
+public:
+ //! \brief Outputs the vital aadvark statistics.
+ void print();
+ //! \param aaness The aadvarkness of an aadvark is a measure of how aadvarky it is.
+ Aadvark(int aaness);
+ int get_aadvarkness();
+private:
+ int aadvarkness;
+};
+
+bool aadvarky_enough(Aadvark aad);
+
+int main();
diff --git a/gr-howto-write-a-block/docs/doxygen/doxyxml/example/xml/aadvark_8cc.xml b/gr-howto-write-a-block/docs/doxygen/doxyxml/example/xml/aadvark_8cc.xml
new file mode 100644
index 000000000..f031e01ac
--- /dev/null
+++ b/gr-howto-write-a-block/docs/doxygen/doxyxml/example/xml/aadvark_8cc.xml
@@ -0,0 +1,88 @@
+<?xml version='1.0' encoding='UTF-8' standalone='no'?>
+<doxygen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="compound.xsd" version="1.6.3">
+ <compounddef id="aadvark_8cc" kind="file">
+ <compoundname>aadvark.cc</compoundname>
+ <includes local="no">iostream</includes>
+ <includes refid="aadvark_8cc" local="yes">aadvark.h</includes>
+ <includedby refid="aadvark_8cc" local="yes">aadvark.cc</includedby>
+ <incdepgraph>
+ <node id="0">
+ <label>aadvark.cc</label>
+ <link refid="aadvark.cc"/>
+ <childnode refid="1" relation="include">
+ </childnode>
+ </node>
+ <node id="1">
+ <label>iostream</label>
+ </node>
+ </incdepgraph>
+ <sectiondef kind="func">
+ <memberdef kind="function" id="aadvark_8cc_1acb52858524210ec6dddc3e16d1e52946" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
+ <type>bool</type>
+ <definition>bool aadvarky_enough</definition>
+ <argsstring>(Aadvark aad)</argsstring>
+ <name>aadvarky_enough</name>
+ <param>
+ <type><ref refid="classAadvark" kindref="compound">Aadvark</ref></type>
+ <declname>aad</declname>
+ </param>
+ <briefdescription>
+ </briefdescription>
+ <detaileddescription>
+ </detaileddescription>
+ <inbodydescription>
+ </inbodydescription>
+ <location file="/home/ben/gnuradio/gnuradio-core/src/python/gnuradio/utils/doxyxml/example/aadvark.cc" line="10" bodyfile="/home/ben/gnuradio/gnuradio-core/src/python/gnuradio/utils/doxyxml/example/aadvark.cc" bodystart="10" bodyend="15"/>
+ </memberdef>
+ <memberdef kind="function" id="aadvark_8cc_1ae66f6b31b5ad750f1fe042a706a4e3d4" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
+ <type>int</type>
+ <definition>int main</definition>
+ <argsstring>()</argsstring>
+ <name>main</name>
+ <briefdescription>
+ </briefdescription>
+ <detaileddescription>
+ </detaileddescription>
+ <inbodydescription>
+ </inbodydescription>
+ <location file="/home/ben/gnuradio/gnuradio-core/src/python/gnuradio/utils/doxyxml/example/aadvark.cc" line="21" bodyfile="/home/ben/gnuradio/gnuradio-core/src/python/gnuradio/utils/doxyxml/example/aadvark.cc" bodystart="21" bodyend="28"/>
+ </memberdef>
+ </sectiondef>
+ <briefdescription>
+ </briefdescription>
+ <detaileddescription>
+ </detaileddescription>
+ <programlisting>
+<codeline lineno="1"><highlight class="preprocessor">#include<sp/>&lt;iostream&gt;</highlight><highlight class="normal"></highlight></codeline>
+<codeline lineno="2"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;aadvark.h&quot;</highlight><highlight class="normal"></highlight></codeline>
+<codeline lineno="3"><highlight class="normal"></highlight></codeline>
+<codeline lineno="4"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="classAadvark_1abd061aa5f998002e72080a34f512a059" kindref="member" tooltip="Outputs the vital aadvark statistics.">Aadvark::print</ref>()<sp/>{</highlight></codeline>
+<codeline lineno="5"><highlight class="normal"><sp/><sp/>std::cout<sp/>&lt;&lt;<sp/></highlight><highlight class="stringliteral">&quot;aadvark<sp/>is<sp/>&quot;</highlight><highlight class="normal"><sp/>&lt;&lt;<sp/>aadvarkness<sp/>&lt;&lt;<sp/></highlight><highlight class="stringliteral">&quot;/10<sp/>aadvarky&quot;</highlight><highlight class="normal"><sp/>&lt;&lt;<sp/>std::endl;</highlight></codeline>
+<codeline lineno="6"><highlight class="normal">}</highlight></codeline>
+<codeline lineno="7"><highlight class="normal"></highlight></codeline>
+<codeline lineno="8"><highlight class="normal"><ref refid="classAadvark_1adf1a4b97a641411a74a04ab312484462" kindref="member">Aadvark::Aadvark</ref>(</highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>aaness):<sp/>aadvarkness(aaness)<sp/>{}</highlight></codeline>
+<codeline lineno="9"><highlight class="normal"></highlight></codeline>
+<codeline lineno="10"><highlight class="normal"></highlight><highlight class="keywordtype">bool</highlight><highlight class="normal"><sp/>aadvarky_enough(<ref refid="classAadvark" kindref="compound" tooltip="Models the mammal Aadvark.">Aadvark</ref><sp/>aad)<sp/>{</highlight></codeline>
+<codeline lineno="11"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(aad.get_aadvarkness()<sp/>&gt;<sp/>6)</highlight></codeline>
+<codeline lineno="12"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">true</highlight><highlight class="normal">;</highlight></codeline>
+<codeline lineno="13"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline>
+<codeline lineno="14"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">false</highlight><highlight class="normal">;</highlight></codeline>
+<codeline lineno="15"><highlight class="normal">}</highlight></codeline>
+<codeline lineno="16"><highlight class="normal"></highlight></codeline>
+<codeline lineno="17"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>Aadvark::get_aadvarkness()<sp/>{</highlight></codeline>
+<codeline lineno="18"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>aadvarkness;</highlight></codeline>
+<codeline lineno="19"><highlight class="normal">}</highlight></codeline>
+<codeline lineno="20"><highlight class="normal"></highlight></codeline>
+<codeline lineno="21"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>main()<sp/>{</highlight></codeline>
+<codeline lineno="22"><highlight class="normal"><sp/><sp/><ref refid="classAadvark" kindref="compound" tooltip="Models the mammal Aadvark.">Aadvark</ref><sp/>arold<sp/>=<sp/><ref refid="classAadvark" kindref="compound" tooltip="Models the mammal Aadvark.">Aadvark</ref>(6);</highlight></codeline>
+<codeline lineno="23"><highlight class="normal"><sp/><sp/>arold.<ref refid="classAadvark_1abd061aa5f998002e72080a34f512a059" kindref="member" tooltip="Outputs the vital aadvark statistics.">print</ref>();</highlight></codeline>
+<codeline lineno="24"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(aadvarky_enough(arold))</highlight></codeline>
+<codeline lineno="25"><highlight class="normal"><sp/><sp/><sp/><sp/>std::cout<sp/>&lt;&lt;<sp/></highlight><highlight class="stringliteral">&quot;He<sp/>is<sp/>aadvarky<sp/>enough&quot;</highlight><highlight class="normal"><sp/>&lt;&lt;<sp/>std::endl;</highlight></codeline>
+<codeline lineno="26"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline>
+<codeline lineno="27"><highlight class="normal"><sp/><sp/><sp/><sp/>std::cout<sp/>&lt;&lt;<sp/></highlight><highlight class="stringliteral">&quot;He<sp/>is<sp/>not<sp/>aadvarky<sp/>enough&quot;</highlight><highlight class="normal"><sp/>&lt;&lt;<sp/>std::endl;</highlight></codeline>
+<codeline lineno="28"><highlight class="normal">}</highlight></codeline>
+<codeline lineno="29"><highlight class="normal"></highlight></codeline>
+ </programlisting>
+ <location file="/home/ben/gnuradio/gnuradio-core/src/python/gnuradio/utils/doxyxml/example/aadvark.cc"/>
+ </compounddef>
+</doxygen>
diff --git a/gr-howto-write-a-block/docs/doxygen/doxyxml/example/xml/aadvark_8h.xml b/gr-howto-write-a-block/docs/doxygen/doxyxml/example/xml/aadvark_8h.xml
new file mode 100644
index 000000000..a1854b685
--- /dev/null
+++ b/gr-howto-write-a-block/docs/doxygen/doxyxml/example/xml/aadvark_8h.xml
@@ -0,0 +1,72 @@
+<?xml version='1.0' encoding='UTF-8' standalone='no'?>
+<doxygen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="compound.xsd" version="1.6.3">
+ <compounddef id="aadvark_8h" kind="file">
+ <compoundname>aadvark.h</compoundname>
+ <includes local="no">iostream</includes>
+ <incdepgraph>
+ <node id="3">
+ <label>aadvark.h</label>
+ <link refid="aadvark.h"/>
+ <childnode refid="4" relation="include">
+ </childnode>
+ </node>
+ <node id="4">
+ <label>iostream</label>
+ </node>
+ </incdepgraph>
+ <innerclass refid="classAadvark" prot="public">Aadvark</innerclass>
+ <sectiondef kind="func">
+ <memberdef kind="function" id="aadvark_8h_1acb52858524210ec6dddc3e16d1e52946" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
+ <type>bool</type>
+ <definition>bool aadvarky_enough</definition>
+ <argsstring>(Aadvark aad)</argsstring>
+ <name>aadvarky_enough</name>
+ <param>
+ <type><ref refid="classAadvark" kindref="compound">Aadvark</ref></type>
+ <declname>aad</declname>
+ </param>
+ <briefdescription>
+ </briefdescription>
+ <detaileddescription>
+ </detaileddescription>
+ <inbodydescription>
+ </inbodydescription>
+ <location file="/home/ben/gnuradio/gnuradio-core/src/python/gnuradio/utils/doxyxml/example/aadvark.h" line="21" bodyfile="/home/ben/gnuradio/gnuradio-core/src/python/gnuradio/utils/doxyxml/example/aadvark.cc" bodystart="10" bodyend="15"/>
+ </memberdef>
+ <memberdef kind="function" id="aadvark_8h_1ae66f6b31b5ad750f1fe042a706a4e3d4" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
+ <type>int</type>
+ <definition>int main</definition>
+ <argsstring>()</argsstring>
+ <name>main</name>
+ <briefdescription>
+ </briefdescription>
+ <detaileddescription>
+ </detaileddescription>
+ <inbodydescription>
+ </inbodydescription>
+ <location file="/home/ben/gnuradio/gnuradio-core/src/python/gnuradio/utils/doxyxml/example/aadvark.h" line="23" bodyfile="/home/ben/gnuradio/gnuradio-core/src/python/gnuradio/utils/doxyxml/example/aadvark.cc" bodystart="21" bodyend="28"/>
+ </memberdef>
+ </sectiondef>
+ <briefdescription>
+ </briefdescription>
+ <detaileddescription>
+ </detaileddescription>
+ <programlisting>
+<codeline lineno="1"><highlight class="preprocessor">#include<sp/>&lt;iostream&gt;</highlight><highlight class="normal"></highlight></codeline>
+<codeline lineno="2"><highlight class="normal"></highlight></codeline>
+<codeline lineno="10" refid="classAadvark" refkind="compound"><highlight class="keyword">class<sp/></highlight><highlight class="normal"><ref refid="classAadvark" kindref="compound" tooltip="Models the mammal Aadvark.">Aadvark</ref><sp/>{</highlight></codeline>
+<codeline lineno="11"><highlight class="normal"></highlight><highlight class="keyword">public</highlight><highlight class="normal">:</highlight></codeline>
+<codeline lineno="13"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="classAadvark_1abd061aa5f998002e72080a34f512a059" kindref="member" tooltip="Outputs the vital aadvark statistics.">print</ref>();</highlight></codeline>
+<codeline lineno="15"><highlight class="normal"><sp/><sp/><ref refid="classAadvark_1adf1a4b97a641411a74a04ab312484462" kindref="member">Aadvark</ref>(</highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>aaness);</highlight></codeline>
+<codeline lineno="16"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>get_aadvarkness();</highlight></codeline>
+<codeline lineno="17"><highlight class="normal"></highlight><highlight class="keyword">private</highlight><highlight class="normal">:</highlight></codeline>
+<codeline lineno="18"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>aadvarkness;</highlight></codeline>
+<codeline lineno="19"><highlight class="normal">};</highlight></codeline>
+<codeline lineno="20"><highlight class="normal"></highlight></codeline>
+<codeline lineno="21"><highlight class="normal"></highlight><highlight class="keywordtype">bool</highlight><highlight class="normal"><sp/>aadvarky_enough(<ref refid="classAadvark" kindref="compound" tooltip="Models the mammal Aadvark.">Aadvark</ref><sp/>aad);</highlight></codeline>
+<codeline lineno="22"><highlight class="normal"></highlight></codeline>
+<codeline lineno="23"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>main();</highlight></codeline>
+ </programlisting>
+ <location file="/home/ben/gnuradio/gnuradio-core/src/python/gnuradio/utils/doxyxml/example/aadvark.h"/>
+ </compounddef>
+</doxygen>
diff --git a/gr-howto-write-a-block/docs/doxygen/doxyxml/example/xml/classAadvark.xml b/gr-howto-write-a-block/docs/doxygen/doxyxml/example/xml/classAadvark.xml
new file mode 100644
index 000000000..54fe8b32c
--- /dev/null
+++ b/gr-howto-write-a-block/docs/doxygen/doxyxml/example/xml/classAadvark.xml
@@ -0,0 +1,86 @@
+<?xml version='1.0' encoding='UTF-8' standalone='no'?>
+<doxygen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="compound.xsd" version="1.6.3">
+ <compounddef id="classAadvark" kind="class" prot="public">
+ <compoundname>Aadvark</compoundname>
+ <includes refid="aadvark_8h" local="no">aadvark.h</includes>
+ <sectiondef kind="private-attrib">
+ <memberdef kind="variable" id="classAadvark_1ab79eb58d7bb9d5ddfa5d6f783836cab9" prot="private" static="no" mutable="no">
+ <type>int</type>
+ <definition>int Aadvark::aadvarkness</definition>
+ <argsstring></argsstring>
+ <name>aadvarkness</name>
+ <briefdescription>
+ </briefdescription>
+ <detaileddescription>
+ </detaileddescription>
+ <inbodydescription>
+ </inbodydescription>
+ <location file="/home/ben/gnuradio/gnuradio-core/src/python/gnuradio/utils/doxyxml/example/aadvark.h" line="18" bodyfile="/home/ben/gnuradio/gnuradio-core/src/python/gnuradio/utils/doxyxml/example/aadvark.h" bodystart="18" bodyend="-1"/>
+ </memberdef>
+ </sectiondef>
+ <sectiondef kind="public-func">
+ <memberdef kind="function" id="classAadvark_1abd061aa5f998002e72080a34f512a059" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
+ <type>void</type>
+ <definition>void Aadvark::print</definition>
+ <argsstring>()</argsstring>
+ <name>print</name>
+ <briefdescription>
+<para>Outputs the vital aadvark statistics. </para> </briefdescription>
+ <detaileddescription>
+ </detaileddescription>
+ <inbodydescription>
+ </inbodydescription>
+ <location file="/home/ben/gnuradio/gnuradio-core/src/python/gnuradio/utils/doxyxml/example/aadvark.h" line="13" bodyfile="/home/ben/gnuradio/gnuradio-core/src/python/gnuradio/utils/doxyxml/example/aadvark.cc" bodystart="4" bodyend="6"/>
+ </memberdef>
+ <memberdef kind="function" id="classAadvark_1adf1a4b97a641411a74a04ab312484462" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
+ <type></type>
+ <definition>Aadvark::Aadvark</definition>
+ <argsstring>(int aaness)</argsstring>
+ <name>Aadvark</name>
+ <param>
+ <type>int</type>
+ <declname>aaness</declname>
+ </param>
+ <briefdescription>
+ </briefdescription>
+ <detaileddescription>
+<para><parameterlist kind="param"><parameteritem>
+<parameternamelist>
+<parametername>aaness</parametername>
+</parameternamelist>
+<parameterdescription>
+<para>The aadvarkness of an aadvark is a measure of how aadvarky it is. </para></parameterdescription>
+</parameteritem>
+</parameterlist>
+</para> </detaileddescription>
+ <inbodydescription>
+ </inbodydescription>
+ <location file="/home/ben/gnuradio/gnuradio-core/src/python/gnuradio/utils/doxyxml/example/aadvark.h" line="15" bodyfile="/home/ben/gnuradio/gnuradio-core/src/python/gnuradio/utils/doxyxml/example/aadvark.cc" bodystart="8" bodyend="8"/>
+ </memberdef>
+ <memberdef kind="function" id="classAadvark_1affd2ada0a85807efcbe26615a848f53e" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
+ <type>int</type>
+ <definition>int Aadvark::get_aadvarkness</definition>
+ <argsstring>()</argsstring>
+ <name>get_aadvarkness</name>
+ <briefdescription>
+ </briefdescription>
+ <detaileddescription>
+ </detaileddescription>
+ <inbodydescription>
+ </inbodydescription>
+ <location file="/home/ben/gnuradio/gnuradio-core/src/python/gnuradio/utils/doxyxml/example/aadvark.h" line="16" bodyfile="/home/ben/gnuradio/gnuradio-core/src/python/gnuradio/utils/doxyxml/example/aadvark.cc" bodystart="17" bodyend="19"/>
+ </memberdef>
+ </sectiondef>
+ <briefdescription>
+<para>Models the mammal <ref refid="classAadvark" kindref="compound">Aadvark</ref>. </para> </briefdescription>
+ <detaileddescription>
+<para>Sadly the model is incomplete and cannot capture all aspects of an aadvark yet.</para><para>This line is uninformative and is only to test line breaks in the comments. </para> </detaileddescription>
+ <location file="/home/ben/gnuradio/gnuradio-core/src/python/gnuradio/utils/doxyxml/example/aadvark.h" line="10" bodyfile="/home/ben/gnuradio/gnuradio-core/src/python/gnuradio/utils/doxyxml/example/aadvark.h" bodystart="10" bodyend="19"/>
+ <listofallmembers>
+ <member refid="classAadvark_1adf1a4b97a641411a74a04ab312484462" prot="public" virt="non-virtual"><scope>Aadvark</scope><name>Aadvark</name></member>
+ <member refid="classAadvark_1ab79eb58d7bb9d5ddfa5d6f783836cab9" prot="private" virt="non-virtual"><scope>Aadvark</scope><name>aadvarkness</name></member>
+ <member refid="classAadvark_1affd2ada0a85807efcbe26615a848f53e" prot="public" virt="non-virtual"><scope>Aadvark</scope><name>get_aadvarkness</name></member>
+ <member refid="classAadvark_1abd061aa5f998002e72080a34f512a059" prot="public" virt="non-virtual"><scope>Aadvark</scope><name>print</name></member>
+ </listofallmembers>
+ </compounddef>
+</doxygen>
diff --git a/gr-howto-write-a-block/docs/doxygen/doxyxml/example/xml/combine.xslt b/gr-howto-write-a-block/docs/doxygen/doxyxml/example/xml/combine.xslt
new file mode 100644
index 000000000..6de203a2b
--- /dev/null
+++ b/gr-howto-write-a-block/docs/doxygen/doxyxml/example/xml/combine.xslt
@@ -0,0 +1,15 @@
+<!-- XSLT script to combine the generated output into a single file.
+ If you have xsltproc you could use:
+ xsltproc combine.xslt index.xml >all.xml
+-->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+ <xsl:output method="xml" version="1.0" indent="yes" standalone="yes" />
+ <xsl:template match="/">
+ <doxygen version="{doxygenindex/@version}">
+ <!-- Load all doxgen generated xml files -->
+ <xsl:for-each select="doxygenindex/compound">
+ <xsl:copy-of select="document( concat( @refid, '.xml' ) )/doxygen/*" />
+ </xsl:for-each>
+ </doxygen>
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/gr-howto-write-a-block/docs/doxygen/doxyxml/example/xml/compound.xsd b/gr-howto-write-a-block/docs/doxygen/doxyxml/example/xml/compound.xsd
new file mode 100644
index 000000000..5bb567052
--- /dev/null
+++ b/gr-howto-write-a-block/docs/doxygen/doxyxml/example/xml/compound.xsd
@@ -0,0 +1,814 @@
+<?xml version='1.0' encoding='utf-8' ?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <xsd:element name="doxygen" type="DoxygenType"/>
+
+ <!-- Complex types -->
+
+ <xsd:complexType name="DoxygenType">
+ <xsd:sequence maxOccurs="unbounded">
+ <xsd:element name="compounddef" type="compounddefType" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="version" type="DoxVersionNumber" use="required" />
+ </xsd:complexType>
+
+ <xsd:complexType name="compounddefType">
+ <xsd:sequence>
+ <xsd:element name="compoundname" type="xsd:string"/>
+ <xsd:element name="title" type="xsd:string" minOccurs="0" />
+ <xsd:element name="basecompoundref" type="compoundRefType" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element name="derivedcompoundref" type="compoundRefType" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element name="includes" type="incType" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element name="includedby" type="incType" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element name="incdepgraph" type="graphType" minOccurs="0" />
+ <xsd:element name="invincdepgraph" type="graphType" minOccurs="0" />
+ <xsd:element name="innerdir" type="refType" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element name="innerfile" type="refType" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element name="innerclass" type="refType" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element name="innernamespace" type="refType" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element name="innerpage" type="refType" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element name="innergroup" type="refType" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element name="templateparamlist" type="templateparamlistType" minOccurs="0" />
+ <xsd:element name="sectiondef" type="sectiondefType" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element name="briefdescription" type="descriptionType" minOccurs="0" />
+ <xsd:element name="detaileddescription" type="descriptionType" minOccurs="0" />
+ <xsd:element name="inheritancegraph" type="graphType" minOccurs="0" />
+ <xsd:element name="collaborationgraph" type="graphType" minOccurs="0" />
+ <xsd:element name="programlisting" type="listingType" minOccurs="0" />
+ <xsd:element name="location" type="locationType" minOccurs="0" />
+ <xsd:element name="listofallmembers" type="listofallmembersType" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:string" />
+ <xsd:attribute name="kind" type="DoxCompoundKind" />
+ <xsd:attribute name="prot" type="DoxProtectionKind" />
+ </xsd:complexType>
+
+ <xsd:complexType name="listofallmembersType">
+ <xsd:sequence>
+ <xsd:element name="member" type="memberRefType" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="memberRefType">
+ <xsd:sequence>
+ <xsd:element name="scope" />
+ <xsd:element name="name" />
+ </xsd:sequence>
+ <xsd:attribute name="refid" type="xsd:string" />
+ <xsd:attribute name="prot" type="DoxProtectionKind" />
+ <xsd:attribute name="virt" type="DoxVirtualKind" />
+ <xsd:attribute name="ambiguityscope" type="xsd:string" />
+ </xsd:complexType>
+
+ <xsd:complexType name="compoundRefType" mixed="true">
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string">
+ <xsd:attribute name="refid" type="xsd:string" use="optional" />
+ <xsd:attribute name="prot" type="DoxProtectionKind" />
+ <xsd:attribute name="virt" type="DoxVirtualKind" />
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+ <xsd:complexType name="reimplementType" mixed="true">
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string">
+ <xsd:attribute name="refid" type="xsd:string" />
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+ <xsd:complexType name="incType" mixed="true">
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string">
+ <xsd:attribute name="refid" type="xsd:string" />
+ <xsd:attribute name="local" type="DoxBool" />
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+ <xsd:complexType name="refType" mixed="true">
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string">
+ <xsd:attribute name="refid" type="xsd:string" />
+ <xsd:attribute name="prot" type="DoxProtectionKind" use="optional"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+ <xsd:complexType name="refTextType" mixed="true">
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string">
+ <xsd:attribute name="refid" type="xsd:string" />
+ <xsd:attribute name="kindref" type="DoxRefKind" />
+ <xsd:attribute name="external" type="xsd:string" use="optional"/>
+ <xsd:attribute name="tooltip" type="xsd:string" use="optional"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+ <xsd:complexType name="sectiondefType">
+ <xsd:sequence>
+ <xsd:element name="header" type="xsd:string" minOccurs="0" />
+ <xsd:element name="description" type="descriptionType" minOccurs="0" />
+ <xsd:element name="memberdef" type="memberdefType" maxOccurs="unbounded" />
+ </xsd:sequence>
+ <xsd:attribute name="kind" type="DoxSectionKind" />
+ </xsd:complexType>
+
+ <xsd:complexType name="memberdefType">
+ <xsd:sequence>
+ <xsd:element name="templateparamlist" type="templateparamlistType" minOccurs="0" />
+ <xsd:element name="type" type="linkedTextType" minOccurs="0" />
+ <xsd:element name="definition" minOccurs="0" />
+ <xsd:element name="argsstring" minOccurs="0" />
+ <xsd:element name="name" />
+ <xsd:element name="read" minOccurs="0" />
+ <xsd:element name="write" minOccurs="0" />
+ <xsd:element name="bitfield" minOccurs="0" />
+ <xsd:element name="reimplements" type="reimplementType" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element name="reimplementedby" type="reimplementType" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element name="param" type="paramType" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element name="enumvalue" type="enumvalueType" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element name="initializer" type="linkedTextType" minOccurs="0" />
+ <xsd:element name="exceptions" type="linkedTextType" minOccurs="0" />
+ <xsd:element name="briefdescription" type="descriptionType" minOccurs="0" />
+ <xsd:element name="detaileddescription" type="descriptionType" minOccurs="0" />
+ <xsd:element name="inbodydescription" type="descriptionType" minOccurs="0" />
+ <xsd:element name="location" type="locationType" />
+ <xsd:element name="references" type="referenceType" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element name="referencedby" type="referenceType" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ <xsd:attribute name="kind" type="DoxMemberKind" />
+ <xsd:attribute name="id" type="xsd:string" />
+ <xsd:attribute name="prot" type="DoxProtectionKind" />
+ <xsd:attribute name="static" type="DoxBool" />
+ <xsd:attribute name="const" type="DoxBool" />
+ <xsd:attribute name="explicit" type="DoxBool" />
+ <xsd:attribute name="inline" type="DoxBool" />
+ <xsd:attribute name="virt" type="DoxVirtualKind" />
+ <xsd:attribute name="volatile" type="DoxBool" />
+ <xsd:attribute name="mutable" type="DoxBool" />
+ <!-- Qt property -->
+ <xsd:attribute name="readable" type="DoxBool" use="optional"/>
+ <xsd:attribute name="writable" type="DoxBool" use="optional"/>
+ <!-- C++/CLI variable -->
+ <xsd:attribute name="initonly" type="DoxBool" use="optional"/>
+ <!-- C++/CLI and C# property -->
+ <xsd:attribute name="settable" type="DoxBool" use="optional"/>
+ <xsd:attribute name="gettable" type="DoxBool" use="optional"/>
+ <!-- C++/CLI function -->
+ <xsd:attribute name="final" type="DoxBool" use="optional"/>
+ <xsd:attribute name="sealed" type="DoxBool" use="optional"/>
+ <xsd:attribute name="new" type="DoxBool" use="optional"/>
+ <!-- C++/CLI event -->
+ <xsd:attribute name="add" type="DoxBool" use="optional"/>
+ <xsd:attribute name="remove" type="DoxBool" use="optional"/>
+ <xsd:attribute name="raise" type="DoxBool" use="optional"/>
+ <!-- Objective-C 2.0 protocol method -->
+ <xsd:attribute name="optional" type="DoxBool" use="optional"/>
+ <xsd:attribute name="required" type="DoxBool" use="optional"/>
+ <!-- Objective-C 2.0 property accessor -->
+ <xsd:attribute name="accessor" type="DoxAccessor" use="optional"/>
+ </xsd:complexType>
+
+ <xsd:complexType name="descriptionType" mixed="true">
+ <xsd:sequence>
+ <xsd:element name="title" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="para" type="docParaType" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element name="sect1" type="docSect1Type" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element name="internal" type="docInternalType" minOccurs="0" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="enumvalueType" mixed="true">
+ <xsd:sequence>
+ <xsd:element name="name" />
+ <xsd:element name="initializer" type="linkedTextType" minOccurs="0" />
+ <xsd:element name="briefdescription" type="descriptionType" minOccurs="0" />
+ <xsd:element name="detaileddescription" type="descriptionType" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:string" />
+ <xsd:attribute name="prot" type="DoxProtectionKind" />
+ </xsd:complexType>
+
+ <xsd:complexType name="templateparamlistType">
+ <xsd:sequence>
+ <xsd:element name="param" type="paramType" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="paramType">
+ <xsd:sequence>
+ <xsd:element name="type" type="linkedTextType" minOccurs="0" />
+ <xsd:element name="declname" minOccurs="0" />
+ <xsd:element name="defname" minOccurs="0" />
+ <xsd:element name="array" minOccurs="0" />
+ <xsd:element name="defval" type="linkedTextType" minOccurs="0" />
+ <xsd:element name="briefdescription" type="descriptionType" minOccurs="0" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="linkedTextType" mixed="true">
+ <xsd:sequence>
+ <xsd:element name="ref" type="refTextType" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="graphType">
+ <xsd:sequence>
+ <xsd:element name="node" type="nodeType" maxOccurs="unbounded" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="nodeType">
+ <xsd:sequence>
+ <xsd:element name="label" />
+ <xsd:element name="link" type="linkType" minOccurs="0" />
+ <xsd:element name="childnode" type="childnodeType" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:string" />
+ </xsd:complexType>
+
+ <xsd:complexType name="childnodeType">
+ <xsd:sequence>
+ <xsd:element name="edgelabel" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="refid" type="xsd:string" />
+ <xsd:attribute name="relation" type="DoxGraphRelation" />
+ </xsd:complexType>
+
+ <xsd:complexType name="linkType">
+ <xsd:attribute name="refid" type="xsd:string" />
+ <xsd:attribute name="external" type="xsd:string" use="optional"/>
+ </xsd:complexType>
+
+ <xsd:complexType name="listingType">
+ <xsd:sequence>
+ <xsd:element name="codeline" type="codelineType" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="codelineType">
+ <xsd:sequence>
+ <xsd:element name="highlight" type="highlightType" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ <xsd:attribute name="lineno" type="xsd:integer" />
+ <xsd:attribute name="refid" type="xsd:string" />
+ <xsd:attribute name="refkind" type="DoxRefKind" />
+ <xsd:attribute name="external" type="DoxBool" />
+ </xsd:complexType>
+
+ <xsd:complexType name="highlightType" mixed="true">
+ <xsd:choice minOccurs="0" maxOccurs="unbounded">
+ <xsd:element name="sp" />
+ <xsd:element name="ref" type="refTextType" />
+ </xsd:choice>
+ <xsd:attribute name="class" type="DoxHighlightClass" />
+ </xsd:complexType>
+
+ <xsd:complexType name="referenceType" mixed="true">
+ <xsd:attribute name="refid" type="xsd:string" />
+ <xsd:attribute name="compoundref" type="xsd:string" use="optional" />
+ <xsd:attribute name="startline" type="xsd:integer" />
+ <xsd:attribute name="endline" type="xsd:integer" />
+ </xsd:complexType>
+
+ <xsd:complexType name="locationType">
+ <xsd:attribute name="file" type="xsd:string" />
+ <xsd:attribute name="line" type="xsd:integer" />
+ <xsd:attribute name="bodyfile" type="xsd:string" />
+ <xsd:attribute name="bodystart" type="xsd:integer" />
+ <xsd:attribute name="bodyend" type="xsd:integer" />
+ </xsd:complexType>
+
+ <xsd:complexType name="docSect1Type" mixed="true">
+ <xsd:sequence>
+ <xsd:element name="title" type="xsd:string" />
+ <xsd:element name="para" type="docParaType" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element name="sect2" type="docSect2Type" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element name="internal" type="docInternalS1Type" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:string" />
+ </xsd:complexType>
+
+ <xsd:complexType name="docSect2Type" mixed="true">
+ <xsd:sequence>
+ <xsd:element name="title" type="xsd:string" />
+ <xsd:element name="para" type="docParaType" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element name="sect3" type="docSect3Type" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element name="internal" type="docInternalS2Type" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:string" />
+ </xsd:complexType>
+
+ <xsd:complexType name="docSect3Type" mixed="true">
+ <xsd:sequence>
+ <xsd:element name="title" type="xsd:string" />
+ <xsd:element name="para" type="docParaType" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element name="sect4" type="docSect4Type" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element name="internal" type="docInternalS3Type" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:string" />
+ </xsd:complexType>
+
+ <xsd:complexType name="docSect4Type" mixed="true">
+ <xsd:sequence>
+ <xsd:element name="title" type="xsd:string" />
+ <xsd:element name="para" type="docParaType" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element name="internal" type="docInternalS4Type" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:string" />
+ </xsd:complexType>
+
+ <xsd:complexType name="docInternalType" mixed="true">
+ <xsd:sequence>
+ <xsd:element name="para" type="docParaType" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element name="sect1" type="docSect1Type" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="docInternalS1Type" mixed="true">
+ <xsd:sequence>
+ <xsd:element name="para" type="docParaType" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element name="sect2" type="docSect2Type" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="docInternalS2Type" mixed="true">
+ <xsd:sequence>
+ <xsd:element name="para" type="docParaType" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element name="sect3" type="docSect3Type" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="docInternalS3Type" mixed="true">
+ <xsd:sequence>
+ <xsd:element name="para" type="docParaType" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element name="sect3" type="docSect4Type" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="docInternalS4Type" mixed="true">
+ <xsd:sequence>
+ <xsd:element name="para" type="docParaType" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:group name="docTitleCmdGroup">
+ <xsd:choice>
+ <xsd:element name="ulink" type="docURLLink" />
+ <xsd:element name="bold" type="docMarkupType" />
+ <xsd:element name="emphasis" type="docMarkupType" />
+ <xsd:element name="computeroutput" type="docMarkupType" />
+ <xsd:element name="subscript" type="docMarkupType" />
+ <xsd:element name="superscript" type="docMarkupType" />
+ <xsd:element name="center" type="docMarkupType" />
+ <xsd:element name="small" type="docMarkupType" />
+ <xsd:element name="htmlonly" type="xsd:string" />
+ <xsd:element name="latexonly" type="xsd:string" />
+ <xsd:element name="dot" type="xsd:string" />
+ <xsd:element name="anchor" type="docAnchorType" />
+ <xsd:element name="formula" type="docFormulaType" />
+ <xsd:element name="ref" type="docRefTextType" />
+ <xsd:element name="copy" type="docEmptyType" />
+ <xsd:element name="trademark" type="docEmptyType" />
+ <xsd:element name="registered" type="docEmptyType" />
+ <xsd:element name="lsquo" type="docEmptyType" />
+ <xsd:element name="rsquo" type="docEmptyType" />
+ <xsd:element name="ldquo" type="docEmptyType" />
+ <xsd:element name="rdquo" type="docEmptyType" />
+ <xsd:element name="ndash" type="docEmptyType" />
+ <xsd:element name="mdash" type="docEmptyType" />
+ <xsd:element name="umlaut" type="docCharType" />
+ <xsd:element name="acute" type="docCharType" />
+ <xsd:element name="grave" type="docCharType" />
+ <xsd:element name="circ" type="docCharType" />
+ <xsd:element name="slash" type="docCharType" />
+ <xsd:element name="tilde" type="docCharType" />
+ <xsd:element name="cedil" type="docCharType" />
+ <xsd:element name="ring" type="docCharType" />
+ <xsd:element name="szlig" type="docEmptyType" />
+ <xsd:element name="nonbreakablespace" type="docEmptyType" />
+ </xsd:choice>
+ </xsd:group>
+
+ <xsd:complexType name="docTitleType" mixed="true">
+ <xsd:group ref="docTitleCmdGroup" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:complexType>
+
+ <xsd:group name="docCmdGroup">
+ <xsd:choice>
+ <xsd:group ref="docTitleCmdGroup"/>
+ <xsd:element name="linebreak" type="docEmptyType" />
+ <xsd:element name="hruler" type="docEmptyType" />
+ <xsd:element name="preformatted" type="docMarkupType" />
+ <xsd:element name="programlisting" type="listingType" />
+ <xsd:element name="verbatim" type="xsd:string" />
+ <xsd:element name="indexentry" type="docIndexEntryType" />
+ <xsd:element name="orderedlist" type="docListType" />
+ <xsd:element name="itemizedlist" type="docListType" />
+ <xsd:element name="simplesect" type="docSimpleSectType" />
+ <xsd:element name="title" type="docTitleType" />
+ <xsd:element name="variablelist" type="docVariableListType" />
+ <xsd:element name="table" type="docTableType" />
+ <xsd:element name="heading" type="docHeadingType" />
+ <xsd:element name="image" type="docImageType" />
+ <xsd:element name="dotfile" type="docDotFileType" />
+ <xsd:element name="toclist" type="docTocListType" />
+ <xsd:element name="language" type="docLanguageType" />
+ <xsd:element name="parameterlist" type="docParamListType" />
+ <xsd:element name="xrefsect" type="docXRefSectType" />
+ <xsd:element name="copydoc" type="docCopyType" />
+ </xsd:choice>
+ </xsd:group>
+
+ <xsd:complexType name="docParaType" mixed="true">
+ <xsd:group ref="docCmdGroup" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:complexType>
+
+ <xsd:complexType name="docMarkupType" mixed="true">
+ <xsd:group ref="docCmdGroup" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:complexType>
+
+ <xsd:complexType name="docURLLink" mixed="true">
+ <xsd:group ref="docTitleCmdGroup" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:attribute name="url" type="xsd:string" />
+ </xsd:complexType>
+
+ <xsd:complexType name="docAnchorType" mixed="true">
+ <xsd:attribute name="id" type="xsd:string" />
+ </xsd:complexType>
+
+ <xsd:complexType name="docFormulaType" mixed="true">
+ <xsd:attribute name="id" type="xsd:string" />
+ </xsd:complexType>
+
+ <xsd:complexType name="docIndexEntryType">
+ <xsd:sequence>
+ <xsd:element name="primaryie" type="xsd:string" />
+ <xsd:element name="secondaryie" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="docListType">
+ <xsd:sequence>
+ <xsd:element name="listitem" type="docListItemType" maxOccurs="unbounded" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="docListItemType">
+ <xsd:sequence>
+ <xsd:element name="para" type="docParaType" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="docSimpleSectType">
+ <xsd:sequence>
+ <xsd:element name="title" type="docTitleType" minOccurs="0" />
+ <xsd:sequence minOccurs="0" maxOccurs="unbounded">
+ <xsd:element name="para" type="docParaType" minOccurs="1" maxOccurs="unbounded" />
+ <xsd:element name="simplesectsep" type="docEmptyType" minOccurs="0"/>
+ </xsd:sequence>
+ </xsd:sequence>
+ <xsd:attribute name="kind" type="DoxSimpleSectKind" />
+ </xsd:complexType>
+
+ <xsd:complexType name="docVarListEntryType">
+ <xsd:sequence>
+ <xsd:element name="term" type="docTitleType" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:group name="docVariableListGroup">
+ <xsd:sequence>
+ <xsd:element name="varlistentry" type="docVarListEntryType" />
+ <xsd:element name="listitem" type="docListItemType" />
+ </xsd:sequence>
+ </xsd:group>
+
+ <xsd:complexType name="docVariableListType">
+ <xsd:sequence>
+ <xsd:group ref="docVariableListGroup" maxOccurs="unbounded" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="docRefTextType" mixed="true">
+ <xsd:group ref="docTitleCmdGroup" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:attribute name="refid" type="xsd:string" />
+ <xsd:attribute name="kindref" type="DoxRefKind" />
+ <xsd:attribute name="external" type="xsd:string" />
+ </xsd:complexType>
+
+ <xsd:complexType name="docTableType">
+ <xsd:sequence>
+ <xsd:element name="row" type="docRowType" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element name="caption" type="docCaptionType" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="rows" type="xsd:integer" />
+ <xsd:attribute name="cols" type="xsd:integer" />
+ </xsd:complexType>
+
+ <xsd:complexType name="docRowType">
+ <xsd:sequence>
+ <xsd:element name="entry" type="docEntryType" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="docEntryType">
+ <xsd:sequence>
+ <xsd:element name="para" type="docParaType" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ <xsd:attribute name="thead" type="DoxBool" />
+ </xsd:complexType>
+
+ <xsd:complexType name="docCaptionType" mixed="true">
+ <xsd:group ref="docTitleCmdGroup" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:complexType>
+
+ <xsd:complexType name="docHeadingType" mixed="true">
+ <xsd:group ref="docTitleCmdGroup" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:attribute name="level" type="xsd:integer" /> <!-- todo: range 1-6 -->
+ </xsd:complexType>
+
+ <xsd:complexType name="docImageType" mixed="true">
+ <xsd:group ref="docTitleCmdGroup" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:attribute name="type" type="DoxImageKind" />
+ <xsd:attribute name="name" type="xsd:string" />
+ <xsd:attribute name="width" type="xsd:string" />
+ <xsd:attribute name="height" type="xsd:string" />
+ </xsd:complexType>
+
+ <xsd:complexType name="docDotFileType" mixed="true">
+ <xsd:group ref="docTitleCmdGroup" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+
+ <xsd:complexType name="docTocItemType" mixed="true">
+ <xsd:group ref="docTitleCmdGroup" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:attribute name="id" type="xsd:string" />
+ </xsd:complexType>
+
+ <xsd:complexType name="docTocListType">
+ <xsd:sequence>
+ <xsd:element name="tocitem" type="docTocItemType" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="docLanguageType">
+ <xsd:sequence>
+ <xsd:element name="para" type="docParaType" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ <xsd:attribute name="langid" type="xsd:string" />
+ </xsd:complexType>
+
+ <xsd:complexType name="docParamListType">
+ <xsd:sequence>
+ <xsd:element name="parameteritem" type="docParamListItem" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ <xsd:attribute name="kind" type="DoxParamListKind" />
+ </xsd:complexType>
+
+ <xsd:complexType name="docParamListItem">
+ <xsd:sequence>
+ <xsd:element name="parameternamelist" type="docParamNameList" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element name="parameterdescription" type="descriptionType" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="docParamNameList">
+ <xsd:sequence>
+ <xsd:element name="parametername" type="docParamName" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="docParamName" mixed="true">
+ <xsd:sequence>
+ <xsd:element name="ref" type="refTextType" minOccurs="0" maxOccurs="1" />
+ </xsd:sequence>
+ <xsd:attribute name="direction" type="DoxParamDir" use="optional" />
+ </xsd:complexType>
+
+ <xsd:complexType name="docXRefSectType">
+ <xsd:sequence>
+ <xsd:element name="xreftitle" type="xsd:string" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element name="xrefdescription" type="descriptionType" />
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:string" />
+ </xsd:complexType>
+
+ <xsd:complexType name="docCopyType">
+ <xsd:sequence>
+ <xsd:element name="para" type="docParaType" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element name="sect1" type="docSect1Type" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element name="internal" type="docInternalType" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="link" type="xsd:string" />
+ </xsd:complexType>
+
+ <xsd:complexType name="docCharType">
+ <xsd:attribute name="char" type="DoxCharRange"/>
+ </xsd:complexType>
+
+ <xsd:complexType name="docEmptyType"/>
+
+ <!-- Simple types -->
+
+ <xsd:simpleType name="DoxBool">
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="yes" />
+ <xsd:enumeration value="no" />
+ </xsd:restriction>
+ </xsd:simpleType>
+
+ <xsd:simpleType name="DoxGraphRelation">
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="include" />
+ <xsd:enumeration value="usage" />
+ <xsd:enumeration value="template-instance" />
+ <xsd:enumeration value="public-inheritance" />
+ <xsd:enumeration value="protected-inheritance" />
+ <xsd:enumeration value="private-inheritance" />
+ </xsd:restriction>
+ </xsd:simpleType>
+
+ <xsd:simpleType name="DoxRefKind">
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="compound" />
+ <xsd:enumeration value="member" />
+ </xsd:restriction>
+ </xsd:simpleType>
+
+ <xsd:simpleType name="DoxMemberKind">
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="define" />
+ <xsd:enumeration value="property" />
+ <xsd:enumeration value="event" />
+ <xsd:enumeration value="variable" />
+ <xsd:enumeration value="typedef" />
+ <xsd:enumeration value="enum" />
+ <xsd:enumeration value="function" />
+ <xsd:enumeration value="signal" />
+ <xsd:enumeration value="prototype" />
+ <xsd:enumeration value="friend" />
+ <xsd:enumeration value="dcop" />
+ <xsd:enumeration value="slot" />
+ </xsd:restriction>
+ </xsd:simpleType>
+
+ <xsd:simpleType name="DoxProtectionKind">
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="public" />
+ <xsd:enumeration value="protected" />
+ <xsd:enumeration value="private" />
+ <xsd:enumeration value="package" />
+ </xsd:restriction>
+ </xsd:simpleType>
+
+ <xsd:simpleType name="DoxVirtualKind">
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="non-virtual" />
+ <xsd:enumeration value="virtual" />
+ <xsd:enumeration value="pure-virtual" />
+ </xsd:restriction>
+ </xsd:simpleType>
+
+ <xsd:simpleType name="DoxCompoundKind">
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="class" />
+ <xsd:enumeration value="struct" />
+ <xsd:enumeration value="union" />
+ <xsd:enumeration value="interface" />
+ <xsd:enumeration value="protocol" />
+ <xsd:enumeration value="category" />
+ <xsd:enumeration value="exception" />
+ <xsd:enumeration value="file" />
+ <xsd:enumeration value="namespace" />
+ <xsd:enumeration value="group" />
+ <xsd:enumeration value="page" />
+ <xsd:enumeration value="example" />
+ <xsd:enumeration value="dir" />
+ </xsd:restriction>
+ </xsd:simpleType>
+
+ <xsd:simpleType name="DoxSectionKind">
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="user-defined" />
+ <xsd:enumeration value="public-type" />
+ <xsd:enumeration value="public-func" />
+ <xsd:enumeration value="public-attrib" />
+ <xsd:enumeration value="public-slot" />
+ <xsd:enumeration value="signal" />
+ <xsd:enumeration value="dcop-func" />
+ <xsd:enumeration value="property" />
+ <xsd:enumeration value="event" />
+ <xsd:enumeration value="public-static-func" />
+ <xsd:enumeration value="public-static-attrib" />
+ <xsd:enumeration value="protected-type" />
+ <xsd:enumeration value="protected-func" />
+ <xsd:enumeration value="protected-attrib" />
+ <xsd:enumeration value="protected-slot" />
+ <xsd:enumeration value="protected-static-func" />
+ <xsd:enumeration value="protected-static-attrib" />
+ <xsd:enumeration value="package-type" />
+ <xsd:enumeration value="package-func" />
+ <xsd:enumeration value="package-attrib" />
+ <xsd:enumeration value="package-static-func" />
+ <xsd:enumeration value="package-static-attrib" />
+ <xsd:enumeration value="private-type" />
+ <xsd:enumeration value="private-func" />
+ <xsd:enumeration value="private-attrib" />
+ <xsd:enumeration value="private-slot" />
+ <xsd:enumeration value="private-static-func" />
+ <xsd:enumeration value="private-static-attrib" />
+ <xsd:enumeration value="friend" />
+ <xsd:enumeration value="related" />
+ <xsd:enumeration value="define" />
+ <xsd:enumeration value="prototype" />
+ <xsd:enumeration value="typedef" />
+ <xsd:enumeration value="enum" />
+ <xsd:enumeration value="func" />
+ <xsd:enumeration value="var" />
+ </xsd:restriction>
+ </xsd:simpleType>
+
+ <xsd:simpleType name="DoxHighlightClass">
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="comment" />
+ <xsd:enumeration value="normal" />
+ <xsd:enumeration value="preprocessor" />
+ <xsd:enumeration value="keyword" />
+ <xsd:enumeration value="keywordtype" />
+ <xsd:enumeration value="keywordflow" />
+ <xsd:enumeration value="stringliteral" />
+ <xsd:enumeration value="charliteral" />
+ </xsd:restriction>
+ </xsd:simpleType>
+
+ <xsd:simpleType name="DoxSimpleSectKind">
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="see" />
+ <xsd:enumeration value="return" />
+ <xsd:enumeration value="author" />
+ <xsd:enumeration value="authors" />
+ <xsd:enumeration value="version" />
+ <xsd:enumeration value="since" />
+ <xsd:enumeration value="date" />
+ <xsd:enumeration value="note" />
+ <xsd:enumeration value="warning" />
+ <xsd:enumeration value="pre" />
+ <xsd:enumeration value="post" />
+ <xsd:enumeration value="invariant" />
+ <xsd:enumeration value="remark" />
+ <xsd:enumeration value="attention" />
+ <xsd:enumeration value="par" />
+ <xsd:enumeration value="rcs" />
+ </xsd:restriction>
+ </xsd:simpleType>
+
+ <xsd:simpleType name="DoxVersionNumber">
+ <xsd:restriction base="xsd:string">
+ <xsd:pattern value="\d+\.\d+.*" />
+ </xsd:restriction>
+ </xsd:simpleType>
+
+ <xsd:simpleType name="DoxImageKind">
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="html" />
+ <xsd:enumeration value="latex" />
+ <xsd:enumeration value="rtf" />
+ </xsd:restriction>
+ </xsd:simpleType>
+
+ <xsd:simpleType name="DoxParamListKind">
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="param" />
+ <xsd:enumeration value="retval" />
+ <xsd:enumeration value="exception" />
+ <xsd:enumeration value="templateparam" />
+ </xsd:restriction>
+ </xsd:simpleType>
+
+ <xsd:simpleType name="DoxCharRange">
+ <xsd:restriction base="xsd:string">
+ <xsd:pattern value="[aeiouncAEIOUNC]" />
+ </xsd:restriction>
+ </xsd:simpleType>
+
+ <xsd:simpleType name="DoxParamDir">
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="in"/>
+ <xsd:enumeration value="out"/>
+ <xsd:enumeration value="inout"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+
+ <xsd:simpleType name="DoxAccessor">
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="retain"/>
+ <xsd:enumeration value="copy"/>
+ <xsd:enumeration value="assign"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+
+</xsd:schema>
+
diff --git a/gr-howto-write-a-block/docs/doxygen/doxyxml/example/xml/index.xml b/gr-howto-write-a-block/docs/doxygen/doxyxml/example/xml/index.xml
new file mode 100644
index 000000000..13fd53f90
--- /dev/null
+++ b/gr-howto-write-a-block/docs/doxygen/doxyxml/example/xml/index.xml
@@ -0,0 +1,17 @@
+<?xml version='1.0' encoding='UTF-8' standalone='no'?>
+<doxygenindex xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="index.xsd" version="1.6.3">
+ <compound refid="classAadvark" kind="class"><name>Aadvark</name>
+ <member refid="classAadvark_1ab79eb58d7bb9d5ddfa5d6f783836cab9" kind="variable"><name>aadvarkness</name></member>
+ <member refid="classAadvark_1abd061aa5f998002e72080a34f512a059" kind="function"><name>print</name></member>
+ <member refid="classAadvark_1adf1a4b97a641411a74a04ab312484462" kind="function"><name>Aadvark</name></member>
+ <member refid="classAadvark_1affd2ada0a85807efcbe26615a848f53e" kind="function"><name>get_aadvarkness</name></member>
+ </compound>
+ <compound refid="aadvark_8cc" kind="file"><name>aadvark.cc</name>
+ <member refid="aadvark_8cc_1acb52858524210ec6dddc3e16d1e52946" kind="function"><name>aadvarky_enough</name></member>
+ <member refid="aadvark_8cc_1ae66f6b31b5ad750f1fe042a706a4e3d4" kind="function"><name>main</name></member>
+ </compound>
+ <compound refid="aadvark_8h" kind="file"><name>aadvark.h</name>
+ <member refid="aadvark_8h_1acb52858524210ec6dddc3e16d1e52946" kind="function"><name>aadvarky_enough</name></member>
+ <member refid="aadvark_8h_1ae66f6b31b5ad750f1fe042a706a4e3d4" kind="function"><name>main</name></member>
+ </compound>
+</doxygenindex>
diff --git a/gr-howto-write-a-block/docs/doxygen/doxyxml/example/xml/index.xsd b/gr-howto-write-a-block/docs/doxygen/doxyxml/example/xml/index.xsd
new file mode 100644
index 000000000..bfe960c0f
--- /dev/null
+++ b/gr-howto-write-a-block/docs/doxygen/doxyxml/example/xml/index.xsd
@@ -0,0 +1,66 @@
+<?xml version='1.0' encoding='utf-8' ?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <xsd:element name="doxygenindex" type="DoxygenType"/>
+
+ <xsd:complexType name="DoxygenType">
+ <xsd:sequence>
+ <xsd:element name="compound" type="CompoundType" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="version" type="xsd:string" use="required"/>
+ </xsd:complexType>
+
+ <xsd:complexType name="CompoundType">
+ <xsd:sequence>
+ <xsd:element name="name" type="xsd:string"/>
+ <xsd:element name="member" type="MemberType" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="refid" type="xsd:string" use="required"/>
+ <xsd:attribute name="kind" type="CompoundKind" use="required"/>
+ </xsd:complexType>
+
+ <xsd:complexType name="MemberType">
+ <xsd:sequence>
+ <xsd:element name="name" type="xsd:string"/>
+ </xsd:sequence>
+ <xsd:attribute name="refid" type="xsd:string" use="required"/>
+ <xsd:attribute name="kind" type="MemberKind" use="required"/>
+ </xsd:complexType>
+
+ <xsd:simpleType name="CompoundKind">
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="class"/>
+ <xsd:enumeration value="struct"/>
+ <xsd:enumeration value="union"/>
+ <xsd:enumeration value="interface"/>
+ <xsd:enumeration value="protocol"/>
+ <xsd:enumeration value="category"/>
+ <xsd:enumeration value="exception"/>
+ <xsd:enumeration value="file"/>
+ <xsd:enumeration value="namespace"/>
+ <xsd:enumeration value="group"/>
+ <xsd:enumeration value="page"/>
+ <xsd:enumeration value="example"/>
+ <xsd:enumeration value="dir"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+
+ <xsd:simpleType name="MemberKind">
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="define"/>
+ <xsd:enumeration value="property"/>
+ <xsd:enumeration value="event"/>
+ <xsd:enumeration value="variable"/>
+ <xsd:enumeration value="typedef"/>
+ <xsd:enumeration value="enum"/>
+ <xsd:enumeration value="enumvalue"/>
+ <xsd:enumeration value="function"/>
+ <xsd:enumeration value="signal"/>
+ <xsd:enumeration value="prototype"/>
+ <xsd:enumeration value="friend"/>
+ <xsd:enumeration value="dcop"/>
+ <xsd:enumeration value="slot"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+
+</xsd:schema>
+
diff --git a/gr-howto-write-a-block/docs/doxygen/doxyxml/generated/__init__.py b/gr-howto-write-a-block/docs/doxygen/doxyxml/generated/__init__.py
new file mode 100644
index 000000000..39823979f
--- /dev/null
+++ b/gr-howto-write-a-block/docs/doxygen/doxyxml/generated/__init__.py
@@ -0,0 +1,7 @@
+"""
+Contains generated files produced by generateDS.py.
+
+These do the real work of parsing the doxygen xml files but the
+resultant classes are not very friendly to navigate so the rest of the
+doxyxml module processes them further.
+"""
diff --git a/gr-howto-write-a-block/docs/doxygen/doxyxml/generated/compound.py b/gr-howto-write-a-block/docs/doxygen/doxyxml/generated/compound.py
new file mode 100644
index 000000000..1522ac23f
--- /dev/null
+++ b/gr-howto-write-a-block/docs/doxygen/doxyxml/generated/compound.py
@@ -0,0 +1,503 @@
+#!/usr/bin/env python
+
+"""
+Generated Mon Feb 9 19:08:05 2009 by generateDS.py.
+"""
+
+from string import lower as str_lower
+from xml.dom import minidom
+from xml.dom import Node
+
+import sys
+
+import compoundsuper as supermod
+from compoundsuper import MixedContainer
+
+
+class DoxygenTypeSub(supermod.DoxygenType):
+ def __init__(self, version=None, compounddef=None):
+ supermod.DoxygenType.__init__(self, version, compounddef)
+
+ def find(self, details):
+
+ return self.compounddef.find(details)
+
+supermod.DoxygenType.subclass = DoxygenTypeSub
+# end class DoxygenTypeSub
+
+
+class compounddefTypeSub(supermod.compounddefType):
+ def __init__(self, kind=None, prot=None, id=None, compoundname='', title='', basecompoundref=None, derivedcompoundref=None, includes=None, includedby=None, incdepgraph=None, invincdepgraph=None, innerdir=None, innerfile=None, innerclass=None, innernamespace=None, innerpage=None, innergroup=None, templateparamlist=None, sectiondef=None, briefdescription=None, detaileddescription=None, inheritancegraph=None, collaborationgraph=None, programlisting=None, location=None, listofallmembers=None):
+ supermod.compounddefType.__init__(self, kind, prot, id, compoundname, title, basecompoundref, derivedcompoundref, includes, includedby, incdepgraph, invincdepgraph, innerdir, innerfile, innerclass, innernamespace, innerpage, innergroup, templateparamlist, sectiondef, briefdescription, detaileddescription, inheritancegraph, collaborationgraph, programlisting, location, listofallmembers)
+
+ def find(self, details):
+
+ if self.id == details.refid:
+ return self
+
+ for sectiondef in self.sectiondef:
+ result = sectiondef.find(details)
+ if result:
+ return result
+
+
+supermod.compounddefType.subclass = compounddefTypeSub
+# end class compounddefTypeSub
+
+
+class listofallmembersTypeSub(supermod.listofallmembersType):
+ def __init__(self, member=None):
+ supermod.listofallmembersType.__init__(self, member)
+supermod.listofallmembersType.subclass = listofallmembersTypeSub
+# end class listofallmembersTypeSub
+
+
+class memberRefTypeSub(supermod.memberRefType):
+ def __init__(self, virt=None, prot=None, refid=None, ambiguityscope=None, scope='', name=''):
+ supermod.memberRefType.__init__(self, virt, prot, refid, ambiguityscope, scope, name)
+supermod.memberRefType.subclass = memberRefTypeSub
+# end class memberRefTypeSub
+
+
+class compoundRefTypeSub(supermod.compoundRefType):
+ def __init__(self, virt=None, prot=None, refid=None, valueOf_='', mixedclass_=None, content_=None):
+ supermod.compoundRefType.__init__(self, mixedclass_, content_)
+supermod.compoundRefType.subclass = compoundRefTypeSub
+# end class compoundRefTypeSub
+
+
+class reimplementTypeSub(supermod.reimplementType):
+ def __init__(self, refid=None, valueOf_='', mixedclass_=None, content_=None):
+ supermod.reimplementType.__init__(self, mixedclass_, content_)
+supermod.reimplementType.subclass = reimplementTypeSub
+# end class reimplementTypeSub
+
+
+class incTypeSub(supermod.incType):
+ def __init__(self, local=None, refid=None, valueOf_='', mixedclass_=None, content_=None):
+ supermod.incType.__init__(self, mixedclass_, content_)
+supermod.incType.subclass = incTypeSub
+# end class incTypeSub
+
+
+class refTypeSub(supermod.refType):
+ def __init__(self, prot=None, refid=None, valueOf_='', mixedclass_=None, content_=None):
+ supermod.refType.__init__(self, mixedclass_, content_)
+supermod.refType.subclass = refTypeSub
+# end class refTypeSub
+
+
+
+class refTextTypeSub(supermod.refTextType):
+ def __init__(self, refid=None, kindref=None, external=None, valueOf_='', mixedclass_=None, content_=None):
+ supermod.refTextType.__init__(self, mixedclass_, content_)
+
+supermod.refTextType.subclass = refTextTypeSub
+# end class refTextTypeSub
+
+class sectiondefTypeSub(supermod.sectiondefType):
+
+
+ def __init__(self, kind=None, header='', description=None, memberdef=None):
+ supermod.sectiondefType.__init__(self, kind, header, description, memberdef)
+
+ def find(self, details):
+
+ for memberdef in self.memberdef:
+ if memberdef.id == details.refid:
+ return memberdef
+
+ return None
+
+
+supermod.sectiondefType.subclass = sectiondefTypeSub
+# end class sectiondefTypeSub
+
+
+class memberdefTypeSub(supermod.memberdefType):
+ def __init__(self, initonly=None, kind=None, volatile=None, const=None, raise_=None, virt=None, readable=None, prot=None, explicit=None, new=None, final=None, writable=None, add=None, static=None, remove=None, sealed=None, mutable=None, gettable=None, inline=None, settable=None, id=None, templateparamlist=None, type_=None, definition='', argsstring='', name='', read='', write='', bitfield='', reimplements=None, reimplementedby=None, param=None, enumvalue=None, initializer=None, exceptions=None, briefdescription=None, detaileddescription=None, inbodydescription=None, location=None, references=None, referencedby=None):
+ supermod.memberdefType.__init__(self, initonly, kind, volatile, const, raise_, virt, readable, prot, explicit, new, final, writable, add, static, remove, sealed, mutable, gettable, inline, settable, id, templateparamlist, type_, definition, argsstring, name, read, write, bitfield, reimplements, reimplementedby, param, enumvalue, initializer, exceptions, briefdescription, detaileddescription, inbodydescription, location, references, referencedby)
+supermod.memberdefType.subclass = memberdefTypeSub
+# end class memberdefTypeSub
+
+
+class descriptionTypeSub(supermod.descriptionType):
+ def __init__(self, title='', para=None, sect1=None, internal=None, mixedclass_=None, content_=None):
+ supermod.descriptionType.__init__(self, mixedclass_, content_)
+supermod.descriptionType.subclass = descriptionTypeSub
+# end class descriptionTypeSub
+
+
+class enumvalueTypeSub(supermod.enumvalueType):
+ def __init__(self, prot=None, id=None, name='', initializer=None, briefdescription=None, detaileddescription=None, mixedclass_=None, content_=None):
+ supermod.enumvalueType.__init__(self, mixedclass_, content_)
+supermod.enumvalueType.subclass = enumvalueTypeSub
+# end class enumvalueTypeSub
+
+
+class templateparamlistTypeSub(supermod.templateparamlistType):
+ def __init__(self, param=None):
+ supermod.templateparamlistType.__init__(self, param)
+supermod.templateparamlistType.subclass = templateparamlistTypeSub
+# end class templateparamlistTypeSub
+
+
+class paramTypeSub(supermod.paramType):
+ def __init__(self, type_=None, declname='', defname='', array='', defval=None, briefdescription=None):
+ supermod.paramType.__init__(self, type_, declname, defname, array, defval, briefdescription)
+supermod.paramType.subclass = paramTypeSub
+# end class paramTypeSub
+
+
+class linkedTextTypeSub(supermod.linkedTextType):
+ def __init__(self, ref=None, mixedclass_=None, content_=None):
+ supermod.linkedTextType.__init__(self, mixedclass_, content_)
+supermod.linkedTextType.subclass = linkedTextTypeSub
+# end class linkedTextTypeSub
+
+
+class graphTypeSub(supermod.graphType):
+ def __init__(self, node=None):
+ supermod.graphType.__init__(self, node)
+supermod.graphType.subclass = graphTypeSub
+# end class graphTypeSub
+
+
+class nodeTypeSub(supermod.nodeType):
+ def __init__(self, id=None, label='', link=None, childnode=None):
+ supermod.nodeType.__init__(self, id, label, link, childnode)
+supermod.nodeType.subclass = nodeTypeSub
+# end class nodeTypeSub
+
+
+class childnodeTypeSub(supermod.childnodeType):
+ def __init__(self, relation=None, refid=None, edgelabel=None):
+ supermod.childnodeType.__init__(self, relation, refid, edgelabel)
+supermod.childnodeType.subclass = childnodeTypeSub
+# end class childnodeTypeSub
+
+
+class linkTypeSub(supermod.linkType):
+ def __init__(self, refid=None, external=None, valueOf_=''):
+ supermod.linkType.__init__(self, refid, external)
+supermod.linkType.subclass = linkTypeSub
+# end class linkTypeSub
+
+
+class listingTypeSub(supermod.listingType):
+ def __init__(self, codeline=None):
+ supermod.listingType.__init__(self, codeline)
+supermod.listingType.subclass = listingTypeSub
+# end class listingTypeSub
+
+
+class codelineTypeSub(supermod.codelineType):
+ def __init__(self, external=None, lineno=None, refkind=None, refid=None, highlight=None):
+ supermod.codelineType.__init__(self, external, lineno, refkind, refid, highlight)
+supermod.codelineType.subclass = codelineTypeSub
+# end class codelineTypeSub
+
+
+class highlightTypeSub(supermod.highlightType):
+ def __init__(self, class_=None, sp=None, ref=None, mixedclass_=None, content_=None):
+ supermod.highlightType.__init__(self, mixedclass_, content_)
+supermod.highlightType.subclass = highlightTypeSub
+# end class highlightTypeSub
+
+
+class referenceTypeSub(supermod.referenceType):
+ def __init__(self, endline=None, startline=None, refid=None, compoundref=None, valueOf_='', mixedclass_=None, content_=None):
+ supermod.referenceType.__init__(self, mixedclass_, content_)
+supermod.referenceType.subclass = referenceTypeSub
+# end class referenceTypeSub
+
+
+class locationTypeSub(supermod.locationType):
+ def __init__(self, bodystart=None, line=None, bodyend=None, bodyfile=None, file=None, valueOf_=''):
+ supermod.locationType.__init__(self, bodystart, line, bodyend, bodyfile, file)
+supermod.locationType.subclass = locationTypeSub
+# end class locationTypeSub
+
+
+class docSect1TypeSub(supermod.docSect1Type):
+ def __init__(self, id=None, title='', para=None, sect2=None, internal=None, mixedclass_=None, content_=None):
+ supermod.docSect1Type.__init__(self, mixedclass_, content_)
+supermod.docSect1Type.subclass = docSect1TypeSub
+# end class docSect1TypeSub
+
+
+class docSect2TypeSub(supermod.docSect2Type):
+ def __init__(self, id=None, title='', para=None, sect3=None, internal=None, mixedclass_=None, content_=None):
+ supermod.docSect2Type.__init__(self, mixedclass_, content_)
+supermod.docSect2Type.subclass = docSect2TypeSub
+# end class docSect2TypeSub
+
+
+class docSect3TypeSub(supermod.docSect3Type):
+ def __init__(self, id=None, title='', para=None, sect4=None, internal=None, mixedclass_=None, content_=None):
+ supermod.docSect3Type.__init__(self, mixedclass_, content_)
+supermod.docSect3Type.subclass = docSect3TypeSub
+# end class docSect3TypeSub
+
+
+class docSect4TypeSub(supermod.docSect4Type):
+ def __init__(self, id=None, title='', para=None, internal=None, mixedclass_=None, content_=None):
+ supermod.docSect4Type.__init__(self, mixedclass_, content_)
+supermod.docSect4Type.subclass = docSect4TypeSub
+# end class docSect4TypeSub
+
+
+class docInternalTypeSub(supermod.docInternalType):
+ def __init__(self, para=None, sect1=None, mixedclass_=None, content_=None):
+ supermod.docInternalType.__init__(self, mixedclass_, content_)
+supermod.docInternalType.subclass = docInternalTypeSub
+# end class docInternalTypeSub
+
+
+class docInternalS1TypeSub(supermod.docInternalS1Type):
+ def __init__(self, para=None, sect2=None, mixedclass_=None, content_=None):
+ supermod.docInternalS1Type.__init__(self, mixedclass_, content_)
+supermod.docInternalS1Type.subclass = docInternalS1TypeSub
+# end class docInternalS1TypeSub
+
+
+class docInternalS2TypeSub(supermod.docInternalS2Type):
+ def __init__(self, para=None, sect3=None, mixedclass_=None, content_=None):
+ supermod.docInternalS2Type.__init__(self, mixedclass_, content_)
+supermod.docInternalS2Type.subclass = docInternalS2TypeSub
+# end class docInternalS2TypeSub
+
+
+class docInternalS3TypeSub(supermod.docInternalS3Type):
+ def __init__(self, para=None, sect3=None, mixedclass_=None, content_=None):
+ supermod.docInternalS3Type.__init__(self, mixedclass_, content_)
+supermod.docInternalS3Type.subclass = docInternalS3TypeSub
+# end class docInternalS3TypeSub
+
+
+class docInternalS4TypeSub(supermod.docInternalS4Type):
+ def __init__(self, para=None, mixedclass_=None, content_=None):
+ supermod.docInternalS4Type.__init__(self, mixedclass_, content_)
+supermod.docInternalS4Type.subclass = docInternalS4TypeSub
+# end class docInternalS4TypeSub
+
+
+class docURLLinkSub(supermod.docURLLink):
+ def __init__(self, url=None, valueOf_='', mixedclass_=None, content_=None):
+ supermod.docURLLink.__init__(self, mixedclass_, content_)
+supermod.docURLLink.subclass = docURLLinkSub
+# end class docURLLinkSub
+
+
+class docAnchorTypeSub(supermod.docAnchorType):
+ def __init__(self, id=None, valueOf_='', mixedclass_=None, content_=None):
+ supermod.docAnchorType.__init__(self, mixedclass_, content_)
+supermod.docAnchorType.subclass = docAnchorTypeSub
+# end class docAnchorTypeSub
+
+
+class docFormulaTypeSub(supermod.docFormulaType):
+ def __init__(self, id=None, valueOf_='', mixedclass_=None, content_=None):
+ supermod.docFormulaType.__init__(self, mixedclass_, content_)
+supermod.docFormulaType.subclass = docFormulaTypeSub
+# end class docFormulaTypeSub
+
+
+class docIndexEntryTypeSub(supermod.docIndexEntryType):
+ def __init__(self, primaryie='', secondaryie=''):
+ supermod.docIndexEntryType.__init__(self, primaryie, secondaryie)
+supermod.docIndexEntryType.subclass = docIndexEntryTypeSub
+# end class docIndexEntryTypeSub
+
+
+class docListTypeSub(supermod.docListType):
+ def __init__(self, listitem=None):
+ supermod.docListType.__init__(self, listitem)
+supermod.docListType.subclass = docListTypeSub
+# end class docListTypeSub
+
+
+class docListItemTypeSub(supermod.docListItemType):
+ def __init__(self, para=None):
+ supermod.docListItemType.__init__(self, para)
+supermod.docListItemType.subclass = docListItemTypeSub
+# end class docListItemTypeSub
+
+
+class docSimpleSectTypeSub(supermod.docSimpleSectType):
+ def __init__(self, kind=None, title=None, para=None):
+ supermod.docSimpleSectType.__init__(self, kind, title, para)
+supermod.docSimpleSectType.subclass = docSimpleSectTypeSub
+# end class docSimpleSectTypeSub
+
+
+class docVarListEntryTypeSub(supermod.docVarListEntryType):
+ def __init__(self, term=None):
+ supermod.docVarListEntryType.__init__(self, term)
+supermod.docVarListEntryType.subclass = docVarListEntryTypeSub
+# end class docVarListEntryTypeSub
+
+
+class docRefTextTypeSub(supermod.docRefTextType):
+ def __init__(self, refid=None, kindref=None, external=None, valueOf_='', mixedclass_=None, content_=None):
+ supermod.docRefTextType.__init__(self, mixedclass_, content_)
+supermod.docRefTextType.subclass = docRefTextTypeSub
+# end class docRefTextTypeSub
+
+
+class docTableTypeSub(supermod.docTableType):
+ def __init__(self, rows=None, cols=None, row=None, caption=None):
+ supermod.docTableType.__init__(self, rows, cols, row, caption)
+supermod.docTableType.subclass = docTableTypeSub
+# end class docTableTypeSub
+
+
+class docRowTypeSub(supermod.docRowType):
+ def __init__(self, entry=None):
+ supermod.docRowType.__init__(self, entry)
+supermod.docRowType.subclass = docRowTypeSub
+# end class docRowTypeSub
+
+
+class docEntryTypeSub(supermod.docEntryType):
+ def __init__(self, thead=None, para=None):
+ supermod.docEntryType.__init__(self, thead, para)
+supermod.docEntryType.subclass = docEntryTypeSub
+# end class docEntryTypeSub
+
+
+class docHeadingTypeSub(supermod.docHeadingType):
+ def __init__(self, level=None, valueOf_='', mixedclass_=None, content_=None):
+ supermod.docHeadingType.__init__(self, mixedclass_, content_)
+supermod.docHeadingType.subclass = docHeadingTypeSub
+# end class docHeadingTypeSub
+
+
+class docImageTypeSub(supermod.docImageType):
+ def __init__(self, width=None, type_=None, name=None, height=None, valueOf_='', mixedclass_=None, content_=None):
+ supermod.docImageType.__init__(self, mixedclass_, content_)
+supermod.docImageType.subclass = docImageTypeSub
+# end class docImageTypeSub
+
+
+class docDotFileTypeSub(supermod.docDotFileType):
+ def __init__(self, name=None, valueOf_='', mixedclass_=None, content_=None):
+ supermod.docDotFileType.__init__(self, mixedclass_, content_)
+supermod.docDotFileType.subclass = docDotFileTypeSub
+# end class docDotFileTypeSub
+
+
+class docTocItemTypeSub(supermod.docTocItemType):
+ def __init__(self, id=None, valueOf_='', mixedclass_=None, content_=None):
+ supermod.docTocItemType.__init__(self, mixedclass_, content_)
+supermod.docTocItemType.subclass = docTocItemTypeSub
+# end class docTocItemTypeSub
+
+
+class docTocListTypeSub(supermod.docTocListType):
+ def __init__(self, tocitem=None):
+ supermod.docTocListType.__init__(self, tocitem)
+supermod.docTocListType.subclass = docTocListTypeSub
+# end class docTocListTypeSub
+
+
+class docLanguageTypeSub(supermod.docLanguageType):
+ def __init__(self, langid=None, para=None):
+ supermod.docLanguageType.__init__(self, langid, para)
+supermod.docLanguageType.subclass = docLanguageTypeSub
+# end class docLanguageTypeSub
+
+
+class docParamListTypeSub(supermod.docParamListType):
+ def __init__(self, kind=None, parameteritem=None):
+ supermod.docParamListType.__init__(self, kind, parameteritem)
+supermod.docParamListType.subclass = docParamListTypeSub
+# end class docParamListTypeSub
+
+
+class docParamListItemSub(supermod.docParamListItem):
+ def __init__(self, parameternamelist=None, parameterdescription=None):
+ supermod.docParamListItem.__init__(self, parameternamelist, parameterdescription)
+supermod.docParamListItem.subclass = docParamListItemSub
+# end class docParamListItemSub
+
+
+class docParamNameListSub(supermod.docParamNameList):
+ def __init__(self, parametername=None):
+ supermod.docParamNameList.__init__(self, parametername)
+supermod.docParamNameList.subclass = docParamNameListSub
+# end class docParamNameListSub
+
+
+class docParamNameSub(supermod.docParamName):
+ def __init__(self, direction=None, ref=None, mixedclass_=None, content_=None):
+ supermod.docParamName.__init__(self, mixedclass_, content_)
+supermod.docParamName.subclass = docParamNameSub
+# end class docParamNameSub
+
+
+class docXRefSectTypeSub(supermod.docXRefSectType):
+ def __init__(self, id=None, xreftitle=None, xrefdescription=None):
+ supermod.docXRefSectType.__init__(self, id, xreftitle, xrefdescription)
+supermod.docXRefSectType.subclass = docXRefSectTypeSub
+# end class docXRefSectTypeSub
+
+
+class docCopyTypeSub(supermod.docCopyType):
+ def __init__(self, link=None, para=None, sect1=None, internal=None):
+ supermod.docCopyType.__init__(self, link, para, sect1, internal)
+supermod.docCopyType.subclass = docCopyTypeSub
+# end class docCopyTypeSub
+
+
+class docCharTypeSub(supermod.docCharType):
+ def __init__(self, char=None, valueOf_=''):
+ supermod.docCharType.__init__(self, char)
+supermod.docCharType.subclass = docCharTypeSub
+# end class docCharTypeSub
+
+class docParaTypeSub(supermod.docParaType):
+ def __init__(self, char=None, valueOf_=''):
+ supermod.docParaType.__init__(self, char)
+
+ self.parameterlist = []
+ self.simplesects = []
+ self.content = []
+
+ def buildChildren(self, child_, nodeName_):
+ supermod.docParaType.buildChildren(self, child_, nodeName_)
+
+ if child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == "ref":
+ obj_ = supermod.docRefTextType.factory()
+ obj_.build(child_)
+ self.content.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'parameterlist':
+ obj_ = supermod.docParamListType.factory()
+ obj_.build(child_)
+ self.parameterlist.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'simplesect':
+ obj_ = supermod.docSimpleSectType.factory()
+ obj_.build(child_)
+ self.simplesects.append(obj_)
+
+
+supermod.docParaType.subclass = docParaTypeSub
+# end class docParaTypeSub
+
+
+
+def parse(inFilename):
+ doc = minidom.parse(inFilename)
+ rootNode = doc.documentElement
+ rootObj = supermod.DoxygenType.factory()
+ rootObj.build(rootNode)
+ return rootObj
+
+
diff --git a/gr-howto-write-a-block/docs/doxygen/doxyxml/generated/compoundsuper.py b/gr-howto-write-a-block/docs/doxygen/doxyxml/generated/compoundsuper.py
new file mode 100644
index 000000000..6255dda16
--- /dev/null
+++ b/gr-howto-write-a-block/docs/doxygen/doxyxml/generated/compoundsuper.py
@@ -0,0 +1,8342 @@
+#!/usr/bin/env python
+
+#
+# Generated Thu Jun 11 18:44:25 2009 by generateDS.py.
+#
+
+import sys
+import getopt
+from string import lower as str_lower
+from xml.dom import minidom
+from xml.dom import Node
+
+#
+# User methods
+#
+# Calls to the methods in these classes are generated by generateDS.py.
+# You can replace these methods by re-implementing the following class
+# in a module named generatedssuper.py.
+
+try:
+ from generatedssuper import GeneratedsSuper
+except ImportError, exp:
+
+ class GeneratedsSuper:
+ def format_string(self, input_data, input_name=''):
+ return input_data
+ def format_integer(self, input_data, input_name=''):
+ return '%d' % input_data
+ def format_float(self, input_data, input_name=''):
+ return '%f' % input_data
+ def format_double(self, input_data, input_name=''):
+ return '%e' % input_data
+ def format_boolean(self, input_data, input_name=''):
+ return '%s' % input_data
+
+
+#
+# If you have installed IPython you can uncomment and use the following.
+# IPython is available from http://ipython.scipy.org/.
+#
+
+## from IPython.Shell import IPShellEmbed
+## args = ''
+## ipshell = IPShellEmbed(args,
+## banner = 'Dropping into IPython',
+## exit_msg = 'Leaving Interpreter, back to program.')
+
+# Then use the following line where and when you want to drop into the
+# IPython shell:
+# ipshell('<some message> -- Entering ipshell.\nHit Ctrl-D to exit')
+
+#
+# Globals
+#
+
+ExternalEncoding = 'ascii'
+
+#
+# Support/utility functions.
+#
+
+def showIndent(outfile, level):
+ for idx in range(level):
+ outfile.write(' ')
+
+def quote_xml(inStr):
+ s1 = (isinstance(inStr, basestring) and inStr or
+ '%s' % inStr)
+ s1 = s1.replace('&', '&amp;')
+ s1 = s1.replace('<', '&lt;')
+ s1 = s1.replace('>', '&gt;')
+ return s1
+
+def quote_attrib(inStr):
+ s1 = (isinstance(inStr, basestring) and inStr or
+ '%s' % inStr)
+ s1 = s1.replace('&', '&amp;')
+ s1 = s1.replace('<', '&lt;')
+ s1 = s1.replace('>', '&gt;')
+ if '"' in s1:
+ if "'" in s1:
+ s1 = '"%s"' % s1.replace('"', "&quot;")
+ else:
+ s1 = "'%s'" % s1
+ else:
+ s1 = '"%s"' % s1
+ return s1
+
+def quote_python(inStr):
+ s1 = inStr
+ if s1.find("'") == -1:
+ if s1.find('\n') == -1:
+ return "'%s'" % s1
+ else:
+ return "'''%s'''" % s1
+ else:
+ if s1.find('"') != -1:
+ s1 = s1.replace('"', '\\"')
+ if s1.find('\n') == -1:
+ return '"%s"' % s1
+ else:
+ return '"""%s"""' % s1
+
+
+class MixedContainer:
+ # Constants for category:
+ CategoryNone = 0
+ CategoryText = 1
+ CategorySimple = 2
+ CategoryComplex = 3
+ # Constants for content_type:
+ TypeNone = 0
+ TypeText = 1
+ TypeString = 2
+ TypeInteger = 3
+ TypeFloat = 4
+ TypeDecimal = 5
+ TypeDouble = 6
+ TypeBoolean = 7
+ def __init__(self, category, content_type, name, value):
+ self.category = category
+ self.content_type = content_type
+ self.name = name
+ self.value = value
+ def getCategory(self):
+ return self.category
+ def getContenttype(self, content_type):
+ return self.content_type
+ def getValue(self):
+ return self.value
+ def getName(self):
+ return self.name
+ def export(self, outfile, level, name, namespace):
+ if self.category == MixedContainer.CategoryText:
+ outfile.write(self.value)
+ elif self.category == MixedContainer.CategorySimple:
+ self.exportSimple(outfile, level, name)
+ else: # category == MixedContainer.CategoryComplex
+ self.value.export(outfile, level, namespace,name)
+ def exportSimple(self, outfile, level, name):
+ if self.content_type == MixedContainer.TypeString:
+ outfile.write('<%s>%s</%s>' % (self.name, self.value, self.name))
+ elif self.content_type == MixedContainer.TypeInteger or \
+ self.content_type == MixedContainer.TypeBoolean:
+ outfile.write('<%s>%d</%s>' % (self.name, self.value, self.name))
+ elif self.content_type == MixedContainer.TypeFloat or \
+ self.content_type == MixedContainer.TypeDecimal:
+ outfile.write('<%s>%f</%s>' % (self.name, self.value, self.name))
+ elif self.content_type == MixedContainer.TypeDouble:
+ outfile.write('<%s>%g</%s>' % (self.name, self.value, self.name))
+ def exportLiteral(self, outfile, level, name):
+ if self.category == MixedContainer.CategoryText:
+ showIndent(outfile, level)
+ outfile.write('MixedContainer(%d, %d, "%s", "%s"),\n' % \
+ (self.category, self.content_type, self.name, self.value))
+ elif self.category == MixedContainer.CategorySimple:
+ showIndent(outfile, level)
+ outfile.write('MixedContainer(%d, %d, "%s", "%s"),\n' % \
+ (self.category, self.content_type, self.name, self.value))
+ else: # category == MixedContainer.CategoryComplex
+ showIndent(outfile, level)
+ outfile.write('MixedContainer(%d, %d, "%s",\n' % \
+ (self.category, self.content_type, self.name,))
+ self.value.exportLiteral(outfile, level + 1)
+ showIndent(outfile, level)
+ outfile.write(')\n')
+
+
+class _MemberSpec(object):
+ def __init__(self, name='', data_type='', container=0):
+ self.name = name
+ self.data_type = data_type
+ self.container = container
+ def set_name(self, name): self.name = name
+ def get_name(self): return self.name
+ def set_data_type(self, data_type): self.data_type = data_type
+ def get_data_type(self): return self.data_type
+ def set_container(self, container): self.container = container
+ def get_container(self): return self.container
+
+
+#
+# Data representation classes.
+#
+
+class DoxygenType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, version=None, compounddef=None):
+ self.version = version
+ self.compounddef = compounddef
+ def factory(*args_, **kwargs_):
+ if DoxygenType.subclass:
+ return DoxygenType.subclass(*args_, **kwargs_)
+ else:
+ return DoxygenType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_compounddef(self): return self.compounddef
+ def set_compounddef(self, compounddef): self.compounddef = compounddef
+ def get_version(self): return self.version
+ def set_version(self, version): self.version = version
+ def export(self, outfile, level, namespace_='', name_='DoxygenType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='DoxygenType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='DoxygenType'):
+ outfile.write(' version=%s' % (quote_attrib(self.version), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='DoxygenType'):
+ if self.compounddef:
+ self.compounddef.export(outfile, level, namespace_, name_='compounddef')
+ def hasContent_(self):
+ if (
+ self.compounddef is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='DoxygenType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.version is not None:
+ showIndent(outfile, level)
+ outfile.write('version = "%s",\n' % (self.version,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ if self.compounddef:
+ showIndent(outfile, level)
+ outfile.write('compounddef=model_.compounddefType(\n')
+ self.compounddef.exportLiteral(outfile, level, name_='compounddef')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('version'):
+ self.version = attrs.get('version').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'compounddef':
+ obj_ = compounddefType.factory()
+ obj_.build(child_)
+ self.set_compounddef(obj_)
+# end class DoxygenType
+
+
+class compounddefType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, kind=None, prot=None, id=None, compoundname=None, title=None, basecompoundref=None, derivedcompoundref=None, includes=None, includedby=None, incdepgraph=None, invincdepgraph=None, innerdir=None, innerfile=None, innerclass=None, innernamespace=None, innerpage=None, innergroup=None, templateparamlist=None, sectiondef=None, briefdescription=None, detaileddescription=None, inheritancegraph=None, collaborationgraph=None, programlisting=None, location=None, listofallmembers=None):
+ self.kind = kind
+ self.prot = prot
+ self.id = id
+ self.compoundname = compoundname
+ self.title = title
+ if basecompoundref is None:
+ self.basecompoundref = []
+ else:
+ self.basecompoundref = basecompoundref
+ if derivedcompoundref is None:
+ self.derivedcompoundref = []
+ else:
+ self.derivedcompoundref = derivedcompoundref
+ if includes is None:
+ self.includes = []
+ else:
+ self.includes = includes
+ if includedby is None:
+ self.includedby = []
+ else:
+ self.includedby = includedby
+ self.incdepgraph = incdepgraph
+ self.invincdepgraph = invincdepgraph
+ if innerdir is None:
+ self.innerdir = []
+ else:
+ self.innerdir = innerdir
+ if innerfile is None:
+ self.innerfile = []
+ else:
+ self.innerfile = innerfile
+ if innerclass is None:
+ self.innerclass = []
+ else:
+ self.innerclass = innerclass
+ if innernamespace is None:
+ self.innernamespace = []
+ else:
+ self.innernamespace = innernamespace
+ if innerpage is None:
+ self.innerpage = []
+ else:
+ self.innerpage = innerpage
+ if innergroup is None:
+ self.innergroup = []
+ else:
+ self.innergroup = innergroup
+ self.templateparamlist = templateparamlist
+ if sectiondef is None:
+ self.sectiondef = []
+ else:
+ self.sectiondef = sectiondef
+ self.briefdescription = briefdescription
+ self.detaileddescription = detaileddescription
+ self.inheritancegraph = inheritancegraph
+ self.collaborationgraph = collaborationgraph
+ self.programlisting = programlisting
+ self.location = location
+ self.listofallmembers = listofallmembers
+ def factory(*args_, **kwargs_):
+ if compounddefType.subclass:
+ return compounddefType.subclass(*args_, **kwargs_)
+ else:
+ return compounddefType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_compoundname(self): return self.compoundname
+ def set_compoundname(self, compoundname): self.compoundname = compoundname
+ def get_title(self): return self.title
+ def set_title(self, title): self.title = title
+ def get_basecompoundref(self): return self.basecompoundref
+ def set_basecompoundref(self, basecompoundref): self.basecompoundref = basecompoundref
+ def add_basecompoundref(self, value): self.basecompoundref.append(value)
+ def insert_basecompoundref(self, index, value): self.basecompoundref[index] = value
+ def get_derivedcompoundref(self): return self.derivedcompoundref
+ def set_derivedcompoundref(self, derivedcompoundref): self.derivedcompoundref = derivedcompoundref
+ def add_derivedcompoundref(self, value): self.derivedcompoundref.append(value)
+ def insert_derivedcompoundref(self, index, value): self.derivedcompoundref[index] = value
+ def get_includes(self): return self.includes
+ def set_includes(self, includes): self.includes = includes
+ def add_includes(self, value): self.includes.append(value)
+ def insert_includes(self, index, value): self.includes[index] = value
+ def get_includedby(self): return self.includedby
+ def set_includedby(self, includedby): self.includedby = includedby
+ def add_includedby(self, value): self.includedby.append(value)
+ def insert_includedby(self, index, value): self.includedby[index] = value
+ def get_incdepgraph(self): return self.incdepgraph
+ def set_incdepgraph(self, incdepgraph): self.incdepgraph = incdepgraph
+ def get_invincdepgraph(self): return self.invincdepgraph
+ def set_invincdepgraph(self, invincdepgraph): self.invincdepgraph = invincdepgraph
+ def get_innerdir(self): return self.innerdir
+ def set_innerdir(self, innerdir): self.innerdir = innerdir
+ def add_innerdir(self, value): self.innerdir.append(value)
+ def insert_innerdir(self, index, value): self.innerdir[index] = value
+ def get_innerfile(self): return self.innerfile
+ def set_innerfile(self, innerfile): self.innerfile = innerfile
+ def add_innerfile(self, value): self.innerfile.append(value)
+ def insert_innerfile(self, index, value): self.innerfile[index] = value
+ def get_innerclass(self): return self.innerclass
+ def set_innerclass(self, innerclass): self.innerclass = innerclass
+ def add_innerclass(self, value): self.innerclass.append(value)
+ def insert_innerclass(self, index, value): self.innerclass[index] = value
+ def get_innernamespace(self): return self.innernamespace
+ def set_innernamespace(self, innernamespace): self.innernamespace = innernamespace
+ def add_innernamespace(self, value): self.innernamespace.append(value)
+ def insert_innernamespace(self, index, value): self.innernamespace[index] = value
+ def get_innerpage(self): return self.innerpage
+ def set_innerpage(self, innerpage): self.innerpage = innerpage
+ def add_innerpage(self, value): self.innerpage.append(value)
+ def insert_innerpage(self, index, value): self.innerpage[index] = value
+ def get_innergroup(self): return self.innergroup
+ def set_innergroup(self, innergroup): self.innergroup = innergroup
+ def add_innergroup(self, value): self.innergroup.append(value)
+ def insert_innergroup(self, index, value): self.innergroup[index] = value
+ def get_templateparamlist(self): return self.templateparamlist
+ def set_templateparamlist(self, templateparamlist): self.templateparamlist = templateparamlist
+ def get_sectiondef(self): return self.sectiondef
+ def set_sectiondef(self, sectiondef): self.sectiondef = sectiondef
+ def add_sectiondef(self, value): self.sectiondef.append(value)
+ def insert_sectiondef(self, index, value): self.sectiondef[index] = value
+ def get_briefdescription(self): return self.briefdescription
+ def set_briefdescription(self, briefdescription): self.briefdescription = briefdescription
+ def get_detaileddescription(self): return self.detaileddescription
+ def set_detaileddescription(self, detaileddescription): self.detaileddescription = detaileddescription
+ def get_inheritancegraph(self): return self.inheritancegraph
+ def set_inheritancegraph(self, inheritancegraph): self.inheritancegraph = inheritancegraph
+ def get_collaborationgraph(self): return self.collaborationgraph
+ def set_collaborationgraph(self, collaborationgraph): self.collaborationgraph = collaborationgraph
+ def get_programlisting(self): return self.programlisting
+ def set_programlisting(self, programlisting): self.programlisting = programlisting
+ def get_location(self): return self.location
+ def set_location(self, location): self.location = location
+ def get_listofallmembers(self): return self.listofallmembers
+ def set_listofallmembers(self, listofallmembers): self.listofallmembers = listofallmembers
+ def get_kind(self): return self.kind
+ def set_kind(self, kind): self.kind = kind
+ def get_prot(self): return self.prot
+ def set_prot(self, prot): self.prot = prot
+ def get_id(self): return self.id
+ def set_id(self, id): self.id = id
+ def export(self, outfile, level, namespace_='', name_='compounddefType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='compounddefType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='compounddefType'):
+ if self.kind is not None:
+ outfile.write(' kind=%s' % (quote_attrib(self.kind), ))
+ if self.prot is not None:
+ outfile.write(' prot=%s' % (quote_attrib(self.prot), ))
+ if self.id is not None:
+ outfile.write(' id=%s' % (self.format_string(quote_attrib(self.id).encode(ExternalEncoding), input_name='id'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='compounddefType'):
+ if self.compoundname is not None:
+ showIndent(outfile, level)
+ outfile.write('<%scompoundname>%s</%scompoundname>\n' % (namespace_, self.format_string(quote_xml(self.compoundname).encode(ExternalEncoding), input_name='compoundname'), namespace_))
+ if self.title is not None:
+ showIndent(outfile, level)
+ outfile.write('<%stitle>%s</%stitle>\n' % (namespace_, self.format_string(quote_xml(self.title).encode(ExternalEncoding), input_name='title'), namespace_))
+ for basecompoundref_ in self.basecompoundref:
+ basecompoundref_.export(outfile, level, namespace_, name_='basecompoundref')
+ for derivedcompoundref_ in self.derivedcompoundref:
+ derivedcompoundref_.export(outfile, level, namespace_, name_='derivedcompoundref')
+ for includes_ in self.includes:
+ includes_.export(outfile, level, namespace_, name_='includes')
+ for includedby_ in self.includedby:
+ includedby_.export(outfile, level, namespace_, name_='includedby')
+ if self.incdepgraph:
+ self.incdepgraph.export(outfile, level, namespace_, name_='incdepgraph')
+ if self.invincdepgraph:
+ self.invincdepgraph.export(outfile, level, namespace_, name_='invincdepgraph')
+ for innerdir_ in self.innerdir:
+ innerdir_.export(outfile, level, namespace_, name_='innerdir')
+ for innerfile_ in self.innerfile:
+ innerfile_.export(outfile, level, namespace_, name_='innerfile')
+ for innerclass_ in self.innerclass:
+ innerclass_.export(outfile, level, namespace_, name_='innerclass')
+ for innernamespace_ in self.innernamespace:
+ innernamespace_.export(outfile, level, namespace_, name_='innernamespace')
+ for innerpage_ in self.innerpage:
+ innerpage_.export(outfile, level, namespace_, name_='innerpage')
+ for innergroup_ in self.innergroup:
+ innergroup_.export(outfile, level, namespace_, name_='innergroup')
+ if self.templateparamlist:
+ self.templateparamlist.export(outfile, level, namespace_, name_='templateparamlist')
+ for sectiondef_ in self.sectiondef:
+ sectiondef_.export(outfile, level, namespace_, name_='sectiondef')
+ if self.briefdescription:
+ self.briefdescription.export(outfile, level, namespace_, name_='briefdescription')
+ if self.detaileddescription:
+ self.detaileddescription.export(outfile, level, namespace_, name_='detaileddescription')
+ if self.inheritancegraph:
+ self.inheritancegraph.export(outfile, level, namespace_, name_='inheritancegraph')
+ if self.collaborationgraph:
+ self.collaborationgraph.export(outfile, level, namespace_, name_='collaborationgraph')
+ if self.programlisting:
+ self.programlisting.export(outfile, level, namespace_, name_='programlisting')
+ if self.location:
+ self.location.export(outfile, level, namespace_, name_='location')
+ if self.listofallmembers:
+ self.listofallmembers.export(outfile, level, namespace_, name_='listofallmembers')
+ def hasContent_(self):
+ if (
+ self.compoundname is not None or
+ self.title is not None or
+ self.basecompoundref is not None or
+ self.derivedcompoundref is not None or
+ self.includes is not None or
+ self.includedby is not None or
+ self.incdepgraph is not None or
+ self.invincdepgraph is not None or
+ self.innerdir is not None or
+ self.innerfile is not None or
+ self.innerclass is not None or
+ self.innernamespace is not None or
+ self.innerpage is not None or
+ self.innergroup is not None or
+ self.templateparamlist is not None or
+ self.sectiondef is not None or
+ self.briefdescription is not None or
+ self.detaileddescription is not None or
+ self.inheritancegraph is not None or
+ self.collaborationgraph is not None or
+ self.programlisting is not None or
+ self.location is not None or
+ self.listofallmembers is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='compounddefType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.kind is not None:
+ showIndent(outfile, level)
+ outfile.write('kind = "%s",\n' % (self.kind,))
+ if self.prot is not None:
+ showIndent(outfile, level)
+ outfile.write('prot = "%s",\n' % (self.prot,))
+ if self.id is not None:
+ showIndent(outfile, level)
+ outfile.write('id = %s,\n' % (self.id,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('compoundname=%s,\n' % quote_python(self.compoundname).encode(ExternalEncoding))
+ if self.title:
+ showIndent(outfile, level)
+ outfile.write('title=model_.xsd_string(\n')
+ self.title.exportLiteral(outfile, level, name_='title')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ showIndent(outfile, level)
+ outfile.write('basecompoundref=[\n')
+ level += 1
+ for basecompoundref in self.basecompoundref:
+ showIndent(outfile, level)
+ outfile.write('model_.basecompoundref(\n')
+ basecompoundref.exportLiteral(outfile, level, name_='basecompoundref')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('derivedcompoundref=[\n')
+ level += 1
+ for derivedcompoundref in self.derivedcompoundref:
+ showIndent(outfile, level)
+ outfile.write('model_.derivedcompoundref(\n')
+ derivedcompoundref.exportLiteral(outfile, level, name_='derivedcompoundref')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('includes=[\n')
+ level += 1
+ for includes in self.includes:
+ showIndent(outfile, level)
+ outfile.write('model_.includes(\n')
+ includes.exportLiteral(outfile, level, name_='includes')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('includedby=[\n')
+ level += 1
+ for includedby in self.includedby:
+ showIndent(outfile, level)
+ outfile.write('model_.includedby(\n')
+ includedby.exportLiteral(outfile, level, name_='includedby')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ if self.incdepgraph:
+ showIndent(outfile, level)
+ outfile.write('incdepgraph=model_.graphType(\n')
+ self.incdepgraph.exportLiteral(outfile, level, name_='incdepgraph')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ if self.invincdepgraph:
+ showIndent(outfile, level)
+ outfile.write('invincdepgraph=model_.graphType(\n')
+ self.invincdepgraph.exportLiteral(outfile, level, name_='invincdepgraph')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ showIndent(outfile, level)
+ outfile.write('innerdir=[\n')
+ level += 1
+ for innerdir in self.innerdir:
+ showIndent(outfile, level)
+ outfile.write('model_.innerdir(\n')
+ innerdir.exportLiteral(outfile, level, name_='innerdir')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('innerfile=[\n')
+ level += 1
+ for innerfile in self.innerfile:
+ showIndent(outfile, level)
+ outfile.write('model_.innerfile(\n')
+ innerfile.exportLiteral(outfile, level, name_='innerfile')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('innerclass=[\n')
+ level += 1
+ for innerclass in self.innerclass:
+ showIndent(outfile, level)
+ outfile.write('model_.innerclass(\n')
+ innerclass.exportLiteral(outfile, level, name_='innerclass')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('innernamespace=[\n')
+ level += 1
+ for innernamespace in self.innernamespace:
+ showIndent(outfile, level)
+ outfile.write('model_.innernamespace(\n')
+ innernamespace.exportLiteral(outfile, level, name_='innernamespace')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('innerpage=[\n')
+ level += 1
+ for innerpage in self.innerpage:
+ showIndent(outfile, level)
+ outfile.write('model_.innerpage(\n')
+ innerpage.exportLiteral(outfile, level, name_='innerpage')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('innergroup=[\n')
+ level += 1
+ for innergroup in self.innergroup:
+ showIndent(outfile, level)
+ outfile.write('model_.innergroup(\n')
+ innergroup.exportLiteral(outfile, level, name_='innergroup')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ if self.templateparamlist:
+ showIndent(outfile, level)
+ outfile.write('templateparamlist=model_.templateparamlistType(\n')
+ self.templateparamlist.exportLiteral(outfile, level, name_='templateparamlist')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ showIndent(outfile, level)
+ outfile.write('sectiondef=[\n')
+ level += 1
+ for sectiondef in self.sectiondef:
+ showIndent(outfile, level)
+ outfile.write('model_.sectiondef(\n')
+ sectiondef.exportLiteral(outfile, level, name_='sectiondef')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ if self.briefdescription:
+ showIndent(outfile, level)
+ outfile.write('briefdescription=model_.descriptionType(\n')
+ self.briefdescription.exportLiteral(outfile, level, name_='briefdescription')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ if self.detaileddescription:
+ showIndent(outfile, level)
+ outfile.write('detaileddescription=model_.descriptionType(\n')
+ self.detaileddescription.exportLiteral(outfile, level, name_='detaileddescription')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ if self.inheritancegraph:
+ showIndent(outfile, level)
+ outfile.write('inheritancegraph=model_.graphType(\n')
+ self.inheritancegraph.exportLiteral(outfile, level, name_='inheritancegraph')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ if self.collaborationgraph:
+ showIndent(outfile, level)
+ outfile.write('collaborationgraph=model_.graphType(\n')
+ self.collaborationgraph.exportLiteral(outfile, level, name_='collaborationgraph')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ if self.programlisting:
+ showIndent(outfile, level)
+ outfile.write('programlisting=model_.listingType(\n')
+ self.programlisting.exportLiteral(outfile, level, name_='programlisting')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ if self.location:
+ showIndent(outfile, level)
+ outfile.write('location=model_.locationType(\n')
+ self.location.exportLiteral(outfile, level, name_='location')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ if self.listofallmembers:
+ showIndent(outfile, level)
+ outfile.write('listofallmembers=model_.listofallmembersType(\n')
+ self.listofallmembers.exportLiteral(outfile, level, name_='listofallmembers')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('kind'):
+ self.kind = attrs.get('kind').value
+ if attrs.get('prot'):
+ self.prot = attrs.get('prot').value
+ if attrs.get('id'):
+ self.id = attrs.get('id').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'compoundname':
+ compoundname_ = ''
+ for text__content_ in child_.childNodes:
+ compoundname_ += text__content_.nodeValue
+ self.compoundname = compoundname_
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'title':
+ obj_ = docTitleType.factory()
+ obj_.build(child_)
+ self.set_title(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'basecompoundref':
+ obj_ = compoundRefType.factory()
+ obj_.build(child_)
+ self.basecompoundref.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'derivedcompoundref':
+ obj_ = compoundRefType.factory()
+ obj_.build(child_)
+ self.derivedcompoundref.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'includes':
+ obj_ = incType.factory()
+ obj_.build(child_)
+ self.includes.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'includedby':
+ obj_ = incType.factory()
+ obj_.build(child_)
+ self.includedby.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'incdepgraph':
+ obj_ = graphType.factory()
+ obj_.build(child_)
+ self.set_incdepgraph(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'invincdepgraph':
+ obj_ = graphType.factory()
+ obj_.build(child_)
+ self.set_invincdepgraph(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'innerdir':
+ obj_ = refType.factory()
+ obj_.build(child_)
+ self.innerdir.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'innerfile':
+ obj_ = refType.factory()
+ obj_.build(child_)
+ self.innerfile.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'innerclass':
+ obj_ = refType.factory()
+ obj_.build(child_)
+ self.innerclass.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'innernamespace':
+ obj_ = refType.factory()
+ obj_.build(child_)
+ self.innernamespace.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'innerpage':
+ obj_ = refType.factory()
+ obj_.build(child_)
+ self.innerpage.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'innergroup':
+ obj_ = refType.factory()
+ obj_.build(child_)
+ self.innergroup.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'templateparamlist':
+ obj_ = templateparamlistType.factory()
+ obj_.build(child_)
+ self.set_templateparamlist(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'sectiondef':
+ obj_ = sectiondefType.factory()
+ obj_.build(child_)
+ self.sectiondef.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'briefdescription':
+ obj_ = descriptionType.factory()
+ obj_.build(child_)
+ self.set_briefdescription(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'detaileddescription':
+ obj_ = descriptionType.factory()
+ obj_.build(child_)
+ self.set_detaileddescription(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'inheritancegraph':
+ obj_ = graphType.factory()
+ obj_.build(child_)
+ self.set_inheritancegraph(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'collaborationgraph':
+ obj_ = graphType.factory()
+ obj_.build(child_)
+ self.set_collaborationgraph(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'programlisting':
+ obj_ = listingType.factory()
+ obj_.build(child_)
+ self.set_programlisting(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'location':
+ obj_ = locationType.factory()
+ obj_.build(child_)
+ self.set_location(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'listofallmembers':
+ obj_ = listofallmembersType.factory()
+ obj_.build(child_)
+ self.set_listofallmembers(obj_)
+# end class compounddefType
+
+
+class listofallmembersType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, member=None):
+ if member is None:
+ self.member = []
+ else:
+ self.member = member
+ def factory(*args_, **kwargs_):
+ if listofallmembersType.subclass:
+ return listofallmembersType.subclass(*args_, **kwargs_)
+ else:
+ return listofallmembersType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_member(self): return self.member
+ def set_member(self, member): self.member = member
+ def add_member(self, value): self.member.append(value)
+ def insert_member(self, index, value): self.member[index] = value
+ def export(self, outfile, level, namespace_='', name_='listofallmembersType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='listofallmembersType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='listofallmembersType'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='listofallmembersType'):
+ for member_ in self.member:
+ member_.export(outfile, level, namespace_, name_='member')
+ def hasContent_(self):
+ if (
+ self.member is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='listofallmembersType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('member=[\n')
+ level += 1
+ for member in self.member:
+ showIndent(outfile, level)
+ outfile.write('model_.member(\n')
+ member.exportLiteral(outfile, level, name_='member')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'member':
+ obj_ = memberRefType.factory()
+ obj_.build(child_)
+ self.member.append(obj_)
+# end class listofallmembersType
+
+
+class memberRefType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, virt=None, prot=None, refid=None, ambiguityscope=None, scope=None, name=None):
+ self.virt = virt
+ self.prot = prot
+ self.refid = refid
+ self.ambiguityscope = ambiguityscope
+ self.scope = scope
+ self.name = name
+ def factory(*args_, **kwargs_):
+ if memberRefType.subclass:
+ return memberRefType.subclass(*args_, **kwargs_)
+ else:
+ return memberRefType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_scope(self): return self.scope
+ def set_scope(self, scope): self.scope = scope
+ def get_name(self): return self.name
+ def set_name(self, name): self.name = name
+ def get_virt(self): return self.virt
+ def set_virt(self, virt): self.virt = virt
+ def get_prot(self): return self.prot
+ def set_prot(self, prot): self.prot = prot
+ def get_refid(self): return self.refid
+ def set_refid(self, refid): self.refid = refid
+ def get_ambiguityscope(self): return self.ambiguityscope
+ def set_ambiguityscope(self, ambiguityscope): self.ambiguityscope = ambiguityscope
+ def export(self, outfile, level, namespace_='', name_='memberRefType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='memberRefType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='memberRefType'):
+ if self.virt is not None:
+ outfile.write(' virt=%s' % (quote_attrib(self.virt), ))
+ if self.prot is not None:
+ outfile.write(' prot=%s' % (quote_attrib(self.prot), ))
+ if self.refid is not None:
+ outfile.write(' refid=%s' % (self.format_string(quote_attrib(self.refid).encode(ExternalEncoding), input_name='refid'), ))
+ if self.ambiguityscope is not None:
+ outfile.write(' ambiguityscope=%s' % (self.format_string(quote_attrib(self.ambiguityscope).encode(ExternalEncoding), input_name='ambiguityscope'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='memberRefType'):
+ if self.scope is not None:
+ showIndent(outfile, level)
+ outfile.write('<%sscope>%s</%sscope>\n' % (namespace_, self.format_string(quote_xml(self.scope).encode(ExternalEncoding), input_name='scope'), namespace_))
+ if self.name is not None:
+ showIndent(outfile, level)
+ outfile.write('<%sname>%s</%sname>\n' % (namespace_, self.format_string(quote_xml(self.name).encode(ExternalEncoding), input_name='name'), namespace_))
+ def hasContent_(self):
+ if (
+ self.scope is not None or
+ self.name is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='memberRefType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.virt is not None:
+ showIndent(outfile, level)
+ outfile.write('virt = "%s",\n' % (self.virt,))
+ if self.prot is not None:
+ showIndent(outfile, level)
+ outfile.write('prot = "%s",\n' % (self.prot,))
+ if self.refid is not None:
+ showIndent(outfile, level)
+ outfile.write('refid = %s,\n' % (self.refid,))
+ if self.ambiguityscope is not None:
+ showIndent(outfile, level)
+ outfile.write('ambiguityscope = %s,\n' % (self.ambiguityscope,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('scope=%s,\n' % quote_python(self.scope).encode(ExternalEncoding))
+ showIndent(outfile, level)
+ outfile.write('name=%s,\n' % quote_python(self.name).encode(ExternalEncoding))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('virt'):
+ self.virt = attrs.get('virt').value
+ if attrs.get('prot'):
+ self.prot = attrs.get('prot').value
+ if attrs.get('refid'):
+ self.refid = attrs.get('refid').value
+ if attrs.get('ambiguityscope'):
+ self.ambiguityscope = attrs.get('ambiguityscope').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'scope':
+ scope_ = ''
+ for text__content_ in child_.childNodes:
+ scope_ += text__content_.nodeValue
+ self.scope = scope_
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'name':
+ name_ = ''
+ for text__content_ in child_.childNodes:
+ name_ += text__content_.nodeValue
+ self.name = name_
+# end class memberRefType
+
+
+class scope(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, valueOf_=''):
+ self.valueOf_ = valueOf_
+ def factory(*args_, **kwargs_):
+ if scope.subclass:
+ return scope.subclass(*args_, **kwargs_)
+ else:
+ return scope(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='scope', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='scope')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='scope'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='scope'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='scope'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class scope
+
+
+class name(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, valueOf_=''):
+ self.valueOf_ = valueOf_
+ def factory(*args_, **kwargs_):
+ if name.subclass:
+ return name.subclass(*args_, **kwargs_)
+ else:
+ return name(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='name', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='name')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='name'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='name'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='name'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class name
+
+
+class compoundRefType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, virt=None, prot=None, refid=None, valueOf_='', mixedclass_=None, content_=None):
+ self.virt = virt
+ self.prot = prot
+ self.refid = refid
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if compoundRefType.subclass:
+ return compoundRefType.subclass(*args_, **kwargs_)
+ else:
+ return compoundRefType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_virt(self): return self.virt
+ def set_virt(self, virt): self.virt = virt
+ def get_prot(self): return self.prot
+ def set_prot(self, prot): self.prot = prot
+ def get_refid(self): return self.refid
+ def set_refid(self, refid): self.refid = refid
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='compoundRefType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='compoundRefType')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='compoundRefType'):
+ if self.virt is not None:
+ outfile.write(' virt=%s' % (quote_attrib(self.virt), ))
+ if self.prot is not None:
+ outfile.write(' prot=%s' % (quote_attrib(self.prot), ))
+ if self.refid is not None:
+ outfile.write(' refid=%s' % (self.format_string(quote_attrib(self.refid).encode(ExternalEncoding), input_name='refid'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='compoundRefType'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='compoundRefType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.virt is not None:
+ showIndent(outfile, level)
+ outfile.write('virt = "%s",\n' % (self.virt,))
+ if self.prot is not None:
+ showIndent(outfile, level)
+ outfile.write('prot = "%s",\n' % (self.prot,))
+ if self.refid is not None:
+ showIndent(outfile, level)
+ outfile.write('refid = %s,\n' % (self.refid,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('virt'):
+ self.virt = attrs.get('virt').value
+ if attrs.get('prot'):
+ self.prot = attrs.get('prot').value
+ if attrs.get('refid'):
+ self.refid = attrs.get('refid').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class compoundRefType
+
+
+class reimplementType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, refid=None, valueOf_='', mixedclass_=None, content_=None):
+ self.refid = refid
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if reimplementType.subclass:
+ return reimplementType.subclass(*args_, **kwargs_)
+ else:
+ return reimplementType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_refid(self): return self.refid
+ def set_refid(self, refid): self.refid = refid
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='reimplementType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='reimplementType')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='reimplementType'):
+ if self.refid is not None:
+ outfile.write(' refid=%s' % (self.format_string(quote_attrib(self.refid).encode(ExternalEncoding), input_name='refid'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='reimplementType'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='reimplementType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.refid is not None:
+ showIndent(outfile, level)
+ outfile.write('refid = %s,\n' % (self.refid,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('refid'):
+ self.refid = attrs.get('refid').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class reimplementType
+
+
+class incType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, local=None, refid=None, valueOf_='', mixedclass_=None, content_=None):
+ self.local = local
+ self.refid = refid
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if incType.subclass:
+ return incType.subclass(*args_, **kwargs_)
+ else:
+ return incType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_local(self): return self.local
+ def set_local(self, local): self.local = local
+ def get_refid(self): return self.refid
+ def set_refid(self, refid): self.refid = refid
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='incType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='incType')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='incType'):
+ if self.local is not None:
+ outfile.write(' local=%s' % (quote_attrib(self.local), ))
+ if self.refid is not None:
+ outfile.write(' refid=%s' % (self.format_string(quote_attrib(self.refid).encode(ExternalEncoding), input_name='refid'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='incType'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='incType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.local is not None:
+ showIndent(outfile, level)
+ outfile.write('local = "%s",\n' % (self.local,))
+ if self.refid is not None:
+ showIndent(outfile, level)
+ outfile.write('refid = %s,\n' % (self.refid,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('local'):
+ self.local = attrs.get('local').value
+ if attrs.get('refid'):
+ self.refid = attrs.get('refid').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class incType
+
+
+class refType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, prot=None, refid=None, valueOf_='', mixedclass_=None, content_=None):
+ self.prot = prot
+ self.refid = refid
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if refType.subclass:
+ return refType.subclass(*args_, **kwargs_)
+ else:
+ return refType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_prot(self): return self.prot
+ def set_prot(self, prot): self.prot = prot
+ def get_refid(self): return self.refid
+ def set_refid(self, refid): self.refid = refid
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='refType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='refType')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='refType'):
+ if self.prot is not None:
+ outfile.write(' prot=%s' % (quote_attrib(self.prot), ))
+ if self.refid is not None:
+ outfile.write(' refid=%s' % (self.format_string(quote_attrib(self.refid).encode(ExternalEncoding), input_name='refid'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='refType'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='refType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.prot is not None:
+ showIndent(outfile, level)
+ outfile.write('prot = "%s",\n' % (self.prot,))
+ if self.refid is not None:
+ showIndent(outfile, level)
+ outfile.write('refid = %s,\n' % (self.refid,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('prot'):
+ self.prot = attrs.get('prot').value
+ if attrs.get('refid'):
+ self.refid = attrs.get('refid').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class refType
+
+
+class refTextType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, refid=None, kindref=None, external=None, valueOf_='', mixedclass_=None, content_=None):
+ self.refid = refid
+ self.kindref = kindref
+ self.external = external
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if refTextType.subclass:
+ return refTextType.subclass(*args_, **kwargs_)
+ else:
+ return refTextType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_refid(self): return self.refid
+ def set_refid(self, refid): self.refid = refid
+ def get_kindref(self): return self.kindref
+ def set_kindref(self, kindref): self.kindref = kindref
+ def get_external(self): return self.external
+ def set_external(self, external): self.external = external
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='refTextType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='refTextType')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='refTextType'):
+ if self.refid is not None:
+ outfile.write(' refid=%s' % (self.format_string(quote_attrib(self.refid).encode(ExternalEncoding), input_name='refid'), ))
+ if self.kindref is not None:
+ outfile.write(' kindref=%s' % (quote_attrib(self.kindref), ))
+ if self.external is not None:
+ outfile.write(' external=%s' % (self.format_string(quote_attrib(self.external).encode(ExternalEncoding), input_name='external'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='refTextType'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='refTextType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.refid is not None:
+ showIndent(outfile, level)
+ outfile.write('refid = %s,\n' % (self.refid,))
+ if self.kindref is not None:
+ showIndent(outfile, level)
+ outfile.write('kindref = "%s",\n' % (self.kindref,))
+ if self.external is not None:
+ showIndent(outfile, level)
+ outfile.write('external = %s,\n' % (self.external,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('refid'):
+ self.refid = attrs.get('refid').value
+ if attrs.get('kindref'):
+ self.kindref = attrs.get('kindref').value
+ if attrs.get('external'):
+ self.external = attrs.get('external').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class refTextType
+
+
+class sectiondefType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, kind=None, header=None, description=None, memberdef=None):
+ self.kind = kind
+ self.header = header
+ self.description = description
+ if memberdef is None:
+ self.memberdef = []
+ else:
+ self.memberdef = memberdef
+ def factory(*args_, **kwargs_):
+ if sectiondefType.subclass:
+ return sectiondefType.subclass(*args_, **kwargs_)
+ else:
+ return sectiondefType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_header(self): return self.header
+ def set_header(self, header): self.header = header
+ def get_description(self): return self.description
+ def set_description(self, description): self.description = description
+ def get_memberdef(self): return self.memberdef
+ def set_memberdef(self, memberdef): self.memberdef = memberdef
+ def add_memberdef(self, value): self.memberdef.append(value)
+ def insert_memberdef(self, index, value): self.memberdef[index] = value
+ def get_kind(self): return self.kind
+ def set_kind(self, kind): self.kind = kind
+ def export(self, outfile, level, namespace_='', name_='sectiondefType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='sectiondefType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='sectiondefType'):
+ if self.kind is not None:
+ outfile.write(' kind=%s' % (quote_attrib(self.kind), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='sectiondefType'):
+ if self.header is not None:
+ showIndent(outfile, level)
+ outfile.write('<%sheader>%s</%sheader>\n' % (namespace_, self.format_string(quote_xml(self.header).encode(ExternalEncoding), input_name='header'), namespace_))
+ if self.description:
+ self.description.export(outfile, level, namespace_, name_='description')
+ for memberdef_ in self.memberdef:
+ memberdef_.export(outfile, level, namespace_, name_='memberdef')
+ def hasContent_(self):
+ if (
+ self.header is not None or
+ self.description is not None or
+ self.memberdef is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='sectiondefType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.kind is not None:
+ showIndent(outfile, level)
+ outfile.write('kind = "%s",\n' % (self.kind,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('header=%s,\n' % quote_python(self.header).encode(ExternalEncoding))
+ if self.description:
+ showIndent(outfile, level)
+ outfile.write('description=model_.descriptionType(\n')
+ self.description.exportLiteral(outfile, level, name_='description')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ showIndent(outfile, level)
+ outfile.write('memberdef=[\n')
+ level += 1
+ for memberdef in self.memberdef:
+ showIndent(outfile, level)
+ outfile.write('model_.memberdef(\n')
+ memberdef.exportLiteral(outfile, level, name_='memberdef')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('kind'):
+ self.kind = attrs.get('kind').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'header':
+ header_ = ''
+ for text__content_ in child_.childNodes:
+ header_ += text__content_.nodeValue
+ self.header = header_
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'description':
+ obj_ = descriptionType.factory()
+ obj_.build(child_)
+ self.set_description(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'memberdef':
+ obj_ = memberdefType.factory()
+ obj_.build(child_)
+ self.memberdef.append(obj_)
+# end class sectiondefType
+
+
+class memberdefType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, initonly=None, kind=None, volatile=None, const=None, raisexx=None, virt=None, readable=None, prot=None, explicit=None, new=None, final=None, writable=None, add=None, static=None, remove=None, sealed=None, mutable=None, gettable=None, inline=None, settable=None, id=None, templateparamlist=None, type_=None, definition=None, argsstring=None, name=None, read=None, write=None, bitfield=None, reimplements=None, reimplementedby=None, param=None, enumvalue=None, initializer=None, exceptions=None, briefdescription=None, detaileddescription=None, inbodydescription=None, location=None, references=None, referencedby=None):
+ self.initonly = initonly
+ self.kind = kind
+ self.volatile = volatile
+ self.const = const
+ self.raisexx = raisexx
+ self.virt = virt
+ self.readable = readable
+ self.prot = prot
+ self.explicit = explicit
+ self.new = new
+ self.final = final
+ self.writable = writable
+ self.add = add
+ self.static = static
+ self.remove = remove
+ self.sealed = sealed
+ self.mutable = mutable
+ self.gettable = gettable
+ self.inline = inline
+ self.settable = settable
+ self.id = id
+ self.templateparamlist = templateparamlist
+ self.type_ = type_
+ self.definition = definition
+ self.argsstring = argsstring
+ self.name = name
+ self.read = read
+ self.write = write
+ self.bitfield = bitfield
+ if reimplements is None:
+ self.reimplements = []
+ else:
+ self.reimplements = reimplements
+ if reimplementedby is None:
+ self.reimplementedby = []
+ else:
+ self.reimplementedby = reimplementedby
+ if param is None:
+ self.param = []
+ else:
+ self.param = param
+ if enumvalue is None:
+ self.enumvalue = []
+ else:
+ self.enumvalue = enumvalue
+ self.initializer = initializer
+ self.exceptions = exceptions
+ self.briefdescription = briefdescription
+ self.detaileddescription = detaileddescription
+ self.inbodydescription = inbodydescription
+ self.location = location
+ if references is None:
+ self.references = []
+ else:
+ self.references = references
+ if referencedby is None:
+ self.referencedby = []
+ else:
+ self.referencedby = referencedby
+ def factory(*args_, **kwargs_):
+ if memberdefType.subclass:
+ return memberdefType.subclass(*args_, **kwargs_)
+ else:
+ return memberdefType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_templateparamlist(self): return self.templateparamlist
+ def set_templateparamlist(self, templateparamlist): self.templateparamlist = templateparamlist
+ def get_type(self): return self.type_
+ def set_type(self, type_): self.type_ = type_
+ def get_definition(self): return self.definition
+ def set_definition(self, definition): self.definition = definition
+ def get_argsstring(self): return self.argsstring
+ def set_argsstring(self, argsstring): self.argsstring = argsstring
+ def get_name(self): return self.name
+ def set_name(self, name): self.name = name
+ def get_read(self): return self.read
+ def set_read(self, read): self.read = read
+ def get_write(self): return self.write
+ def set_write(self, write): self.write = write
+ def get_bitfield(self): return self.bitfield
+ def set_bitfield(self, bitfield): self.bitfield = bitfield
+ def get_reimplements(self): return self.reimplements
+ def set_reimplements(self, reimplements): self.reimplements = reimplements
+ def add_reimplements(self, value): self.reimplements.append(value)
+ def insert_reimplements(self, index, value): self.reimplements[index] = value
+ def get_reimplementedby(self): return self.reimplementedby
+ def set_reimplementedby(self, reimplementedby): self.reimplementedby = reimplementedby
+ def add_reimplementedby(self, value): self.reimplementedby.append(value)
+ def insert_reimplementedby(self, index, value): self.reimplementedby[index] = value
+ def get_param(self): return self.param
+ def set_param(self, param): self.param = param
+ def add_param(self, value): self.param.append(value)
+ def insert_param(self, index, value): self.param[index] = value
+ def get_enumvalue(self): return self.enumvalue
+ def set_enumvalue(self, enumvalue): self.enumvalue = enumvalue
+ def add_enumvalue(self, value): self.enumvalue.append(value)
+ def insert_enumvalue(self, index, value): self.enumvalue[index] = value
+ def get_initializer(self): return self.initializer
+ def set_initializer(self, initializer): self.initializer = initializer
+ def get_exceptions(self): return self.exceptions
+ def set_exceptions(self, exceptions): self.exceptions = exceptions
+ def get_briefdescription(self): return self.briefdescription
+ def set_briefdescription(self, briefdescription): self.briefdescription = briefdescription
+ def get_detaileddescription(self): return self.detaileddescription
+ def set_detaileddescription(self, detaileddescription): self.detaileddescription = detaileddescription
+ def get_inbodydescription(self): return self.inbodydescription
+ def set_inbodydescription(self, inbodydescription): self.inbodydescription = inbodydescription
+ def get_location(self): return self.location
+ def set_location(self, location): self.location = location
+ def get_references(self): return self.references
+ def set_references(self, references): self.references = references
+ def add_references(self, value): self.references.append(value)
+ def insert_references(self, index, value): self.references[index] = value
+ def get_referencedby(self): return self.referencedby
+ def set_referencedby(self, referencedby): self.referencedby = referencedby
+ def add_referencedby(self, value): self.referencedby.append(value)
+ def insert_referencedby(self, index, value): self.referencedby[index] = value
+ def get_initonly(self): return self.initonly
+ def set_initonly(self, initonly): self.initonly = initonly
+ def get_kind(self): return self.kind
+ def set_kind(self, kind): self.kind = kind
+ def get_volatile(self): return self.volatile
+ def set_volatile(self, volatile): self.volatile = volatile
+ def get_const(self): return self.const
+ def set_const(self, const): self.const = const
+ def get_raise(self): return self.raisexx
+ def set_raise(self, raisexx): self.raisexx = raisexx
+ def get_virt(self): return self.virt
+ def set_virt(self, virt): self.virt = virt
+ def get_readable(self): return self.readable
+ def set_readable(self, readable): self.readable = readable
+ def get_prot(self): return self.prot
+ def set_prot(self, prot): self.prot = prot
+ def get_explicit(self): return self.explicit
+ def set_explicit(self, explicit): self.explicit = explicit
+ def get_new(self): return self.new
+ def set_new(self, new): self.new = new
+ def get_final(self): return self.final
+ def set_final(self, final): self.final = final
+ def get_writable(self): return self.writable
+ def set_writable(self, writable): self.writable = writable
+ def get_add(self): return self.add
+ def set_add(self, add): self.add = add
+ def get_static(self): return self.static
+ def set_static(self, static): self.static = static
+ def get_remove(self): return self.remove
+ def set_remove(self, remove): self.remove = remove
+ def get_sealed(self): return self.sealed
+ def set_sealed(self, sealed): self.sealed = sealed
+ def get_mutable(self): return self.mutable
+ def set_mutable(self, mutable): self.mutable = mutable
+ def get_gettable(self): return self.gettable
+ def set_gettable(self, gettable): self.gettable = gettable
+ def get_inline(self): return self.inline
+ def set_inline(self, inline): self.inline = inline
+ def get_settable(self): return self.settable
+ def set_settable(self, settable): self.settable = settable
+ def get_id(self): return self.id
+ def set_id(self, id): self.id = id
+ def export(self, outfile, level, namespace_='', name_='memberdefType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='memberdefType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='memberdefType'):
+ if self.initonly is not None:
+ outfile.write(' initonly=%s' % (quote_attrib(self.initonly), ))
+ if self.kind is not None:
+ outfile.write(' kind=%s' % (quote_attrib(self.kind), ))
+ if self.volatile is not None:
+ outfile.write(' volatile=%s' % (quote_attrib(self.volatile), ))
+ if self.const is not None:
+ outfile.write(' const=%s' % (quote_attrib(self.const), ))
+ if self.raisexx is not None:
+ outfile.write(' raise=%s' % (quote_attrib(self.raisexx), ))
+ if self.virt is not None:
+ outfile.write(' virt=%s' % (quote_attrib(self.virt), ))
+ if self.readable is not None:
+ outfile.write(' readable=%s' % (quote_attrib(self.readable), ))
+ if self.prot is not None:
+ outfile.write(' prot=%s' % (quote_attrib(self.prot), ))
+ if self.explicit is not None:
+ outfile.write(' explicit=%s' % (quote_attrib(self.explicit), ))
+ if self.new is not None:
+ outfile.write(' new=%s' % (quote_attrib(self.new), ))
+ if self.final is not None:
+ outfile.write(' final=%s' % (quote_attrib(self.final), ))
+ if self.writable is not None:
+ outfile.write(' writable=%s' % (quote_attrib(self.writable), ))
+ if self.add is not None:
+ outfile.write(' add=%s' % (quote_attrib(self.add), ))
+ if self.static is not None:
+ outfile.write(' static=%s' % (quote_attrib(self.static), ))
+ if self.remove is not None:
+ outfile.write(' remove=%s' % (quote_attrib(self.remove), ))
+ if self.sealed is not None:
+ outfile.write(' sealed=%s' % (quote_attrib(self.sealed), ))
+ if self.mutable is not None:
+ outfile.write(' mutable=%s' % (quote_attrib(self.mutable), ))
+ if self.gettable is not None:
+ outfile.write(' gettable=%s' % (quote_attrib(self.gettable), ))
+ if self.inline is not None:
+ outfile.write(' inline=%s' % (quote_attrib(self.inline), ))
+ if self.settable is not None:
+ outfile.write(' settable=%s' % (quote_attrib(self.settable), ))
+ if self.id is not None:
+ outfile.write(' id=%s' % (self.format_string(quote_attrib(self.id).encode(ExternalEncoding), input_name='id'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='memberdefType'):
+ if self.templateparamlist:
+ self.templateparamlist.export(outfile, level, namespace_, name_='templateparamlist')
+ if self.type_:
+ self.type_.export(outfile, level, namespace_, name_='type')
+ if self.definition is not None:
+ showIndent(outfile, level)
+ outfile.write('<%sdefinition>%s</%sdefinition>\n' % (namespace_, self.format_string(quote_xml(self.definition).encode(ExternalEncoding), input_name='definition'), namespace_))
+ if self.argsstring is not None:
+ showIndent(outfile, level)
+ outfile.write('<%sargsstring>%s</%sargsstring>\n' % (namespace_, self.format_string(quote_xml(self.argsstring).encode(ExternalEncoding), input_name='argsstring'), namespace_))
+ if self.name is not None:
+ showIndent(outfile, level)
+ outfile.write('<%sname>%s</%sname>\n' % (namespace_, self.format_string(quote_xml(self.name).encode(ExternalEncoding), input_name='name'), namespace_))
+ if self.read is not None:
+ showIndent(outfile, level)
+ outfile.write('<%sread>%s</%sread>\n' % (namespace_, self.format_string(quote_xml(self.read).encode(ExternalEncoding), input_name='read'), namespace_))
+ if self.write is not None:
+ showIndent(outfile, level)
+ outfile.write('<%swrite>%s</%swrite>\n' % (namespace_, self.format_string(quote_xml(self.write).encode(ExternalEncoding), input_name='write'), namespace_))
+ if self.bitfield is not None:
+ showIndent(outfile, level)
+ outfile.write('<%sbitfield>%s</%sbitfield>\n' % (namespace_, self.format_string(quote_xml(self.bitfield).encode(ExternalEncoding), input_name='bitfield'), namespace_))
+ for reimplements_ in self.reimplements:
+ reimplements_.export(outfile, level, namespace_, name_='reimplements')
+ for reimplementedby_ in self.reimplementedby:
+ reimplementedby_.export(outfile, level, namespace_, name_='reimplementedby')
+ for param_ in self.param:
+ param_.export(outfile, level, namespace_, name_='param')
+ for enumvalue_ in self.enumvalue:
+ enumvalue_.export(outfile, level, namespace_, name_='enumvalue')
+ if self.initializer:
+ self.initializer.export(outfile, level, namespace_, name_='initializer')
+ if self.exceptions:
+ self.exceptions.export(outfile, level, namespace_, name_='exceptions')
+ if self.briefdescription:
+ self.briefdescription.export(outfile, level, namespace_, name_='briefdescription')
+ if self.detaileddescription:
+ self.detaileddescription.export(outfile, level, namespace_, name_='detaileddescription')
+ if self.inbodydescription:
+ self.inbodydescription.export(outfile, level, namespace_, name_='inbodydescription')
+ if self.location:
+ self.location.export(outfile, level, namespace_, name_='location', )
+ for references_ in self.references:
+ references_.export(outfile, level, namespace_, name_='references')
+ for referencedby_ in self.referencedby:
+ referencedby_.export(outfile, level, namespace_, name_='referencedby')
+ def hasContent_(self):
+ if (
+ self.templateparamlist is not None or
+ self.type_ is not None or
+ self.definition is not None or
+ self.argsstring is not None or
+ self.name is not None or
+ self.read is not None or
+ self.write is not None or
+ self.bitfield is not None or
+ self.reimplements is not None or
+ self.reimplementedby is not None or
+ self.param is not None or
+ self.enumvalue is not None or
+ self.initializer is not None or
+ self.exceptions is not None or
+ self.briefdescription is not None or
+ self.detaileddescription is not None or
+ self.inbodydescription is not None or
+ self.location is not None or
+ self.references is not None or
+ self.referencedby is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='memberdefType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.initonly is not None:
+ showIndent(outfile, level)
+ outfile.write('initonly = "%s",\n' % (self.initonly,))
+ if self.kind is not None:
+ showIndent(outfile, level)
+ outfile.write('kind = "%s",\n' % (self.kind,))
+ if self.volatile is not None:
+ showIndent(outfile, level)
+ outfile.write('volatile = "%s",\n' % (self.volatile,))
+ if self.const is not None:
+ showIndent(outfile, level)
+ outfile.write('const = "%s",\n' % (self.const,))
+ if self.raisexx is not None:
+ showIndent(outfile, level)
+ outfile.write('raisexx = "%s",\n' % (self.raisexx,))
+ if self.virt is not None:
+ showIndent(outfile, level)
+ outfile.write('virt = "%s",\n' % (self.virt,))
+ if self.readable is not None:
+ showIndent(outfile, level)
+ outfile.write('readable = "%s",\n' % (self.readable,))
+ if self.prot is not None:
+ showIndent(outfile, level)
+ outfile.write('prot = "%s",\n' % (self.prot,))
+ if self.explicit is not None:
+ showIndent(outfile, level)
+ outfile.write('explicit = "%s",\n' % (self.explicit,))
+ if self.new is not None:
+ showIndent(outfile, level)
+ outfile.write('new = "%s",\n' % (self.new,))
+ if self.final is not None:
+ showIndent(outfile, level)
+ outfile.write('final = "%s",\n' % (self.final,))
+ if self.writable is not None:
+ showIndent(outfile, level)
+ outfile.write('writable = "%s",\n' % (self.writable,))
+ if self.add is not None:
+ showIndent(outfile, level)
+ outfile.write('add = "%s",\n' % (self.add,))
+ if self.static is not None:
+ showIndent(outfile, level)
+ outfile.write('static = "%s",\n' % (self.static,))
+ if self.remove is not None:
+ showIndent(outfile, level)
+ outfile.write('remove = "%s",\n' % (self.remove,))
+ if self.sealed is not None:
+ showIndent(outfile, level)
+ outfile.write('sealed = "%s",\n' % (self.sealed,))
+ if self.mutable is not None:
+ showIndent(outfile, level)
+ outfile.write('mutable = "%s",\n' % (self.mutable,))
+ if self.gettable is not None:
+ showIndent(outfile, level)
+ outfile.write('gettable = "%s",\n' % (self.gettable,))
+ if self.inline is not None:
+ showIndent(outfile, level)
+ outfile.write('inline = "%s",\n' % (self.inline,))
+ if self.settable is not None:
+ showIndent(outfile, level)
+ outfile.write('settable = "%s",\n' % (self.settable,))
+ if self.id is not None:
+ showIndent(outfile, level)
+ outfile.write('id = %s,\n' % (self.id,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ if self.templateparamlist:
+ showIndent(outfile, level)
+ outfile.write('templateparamlist=model_.templateparamlistType(\n')
+ self.templateparamlist.exportLiteral(outfile, level, name_='templateparamlist')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ if self.type_:
+ showIndent(outfile, level)
+ outfile.write('type_=model_.linkedTextType(\n')
+ self.type_.exportLiteral(outfile, level, name_='type')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ showIndent(outfile, level)
+ outfile.write('definition=%s,\n' % quote_python(self.definition).encode(ExternalEncoding))
+ showIndent(outfile, level)
+ outfile.write('argsstring=%s,\n' % quote_python(self.argsstring).encode(ExternalEncoding))
+ showIndent(outfile, level)
+ outfile.write('name=%s,\n' % quote_python(self.name).encode(ExternalEncoding))
+ showIndent(outfile, level)
+ outfile.write('read=%s,\n' % quote_python(self.read).encode(ExternalEncoding))
+ showIndent(outfile, level)
+ outfile.write('write=%s,\n' % quote_python(self.write).encode(ExternalEncoding))
+ showIndent(outfile, level)
+ outfile.write('bitfield=%s,\n' % quote_python(self.bitfield).encode(ExternalEncoding))
+ showIndent(outfile, level)
+ outfile.write('reimplements=[\n')
+ level += 1
+ for reimplements in self.reimplements:
+ showIndent(outfile, level)
+ outfile.write('model_.reimplements(\n')
+ reimplements.exportLiteral(outfile, level, name_='reimplements')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('reimplementedby=[\n')
+ level += 1
+ for reimplementedby in self.reimplementedby:
+ showIndent(outfile, level)
+ outfile.write('model_.reimplementedby(\n')
+ reimplementedby.exportLiteral(outfile, level, name_='reimplementedby')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('param=[\n')
+ level += 1
+ for param in self.param:
+ showIndent(outfile, level)
+ outfile.write('model_.param(\n')
+ param.exportLiteral(outfile, level, name_='param')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('enumvalue=[\n')
+ level += 1
+ for enumvalue in self.enumvalue:
+ showIndent(outfile, level)
+ outfile.write('model_.enumvalue(\n')
+ enumvalue.exportLiteral(outfile, level, name_='enumvalue')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ if self.initializer:
+ showIndent(outfile, level)
+ outfile.write('initializer=model_.linkedTextType(\n')
+ self.initializer.exportLiteral(outfile, level, name_='initializer')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ if self.exceptions:
+ showIndent(outfile, level)
+ outfile.write('exceptions=model_.linkedTextType(\n')
+ self.exceptions.exportLiteral(outfile, level, name_='exceptions')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ if self.briefdescription:
+ showIndent(outfile, level)
+ outfile.write('briefdescription=model_.descriptionType(\n')
+ self.briefdescription.exportLiteral(outfile, level, name_='briefdescription')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ if self.detaileddescription:
+ showIndent(outfile, level)
+ outfile.write('detaileddescription=model_.descriptionType(\n')
+ self.detaileddescription.exportLiteral(outfile, level, name_='detaileddescription')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ if self.inbodydescription:
+ showIndent(outfile, level)
+ outfile.write('inbodydescription=model_.descriptionType(\n')
+ self.inbodydescription.exportLiteral(outfile, level, name_='inbodydescription')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ if self.location:
+ showIndent(outfile, level)
+ outfile.write('location=model_.locationType(\n')
+ self.location.exportLiteral(outfile, level, name_='location')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ showIndent(outfile, level)
+ outfile.write('references=[\n')
+ level += 1
+ for references in self.references:
+ showIndent(outfile, level)
+ outfile.write('model_.references(\n')
+ references.exportLiteral(outfile, level, name_='references')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('referencedby=[\n')
+ level += 1
+ for referencedby in self.referencedby:
+ showIndent(outfile, level)
+ outfile.write('model_.referencedby(\n')
+ referencedby.exportLiteral(outfile, level, name_='referencedby')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('initonly'):
+ self.initonly = attrs.get('initonly').value
+ if attrs.get('kind'):
+ self.kind = attrs.get('kind').value
+ if attrs.get('volatile'):
+ self.volatile = attrs.get('volatile').value
+ if attrs.get('const'):
+ self.const = attrs.get('const').value
+ if attrs.get('raise'):
+ self.raisexx = attrs.get('raise').value
+ if attrs.get('virt'):
+ self.virt = attrs.get('virt').value
+ if attrs.get('readable'):
+ self.readable = attrs.get('readable').value
+ if attrs.get('prot'):
+ self.prot = attrs.get('prot').value
+ if attrs.get('explicit'):
+ self.explicit = attrs.get('explicit').value
+ if attrs.get('new'):
+ self.new = attrs.get('new').value
+ if attrs.get('final'):
+ self.final = attrs.get('final').value
+ if attrs.get('writable'):
+ self.writable = attrs.get('writable').value
+ if attrs.get('add'):
+ self.add = attrs.get('add').value
+ if attrs.get('static'):
+ self.static = attrs.get('static').value
+ if attrs.get('remove'):
+ self.remove = attrs.get('remove').value
+ if attrs.get('sealed'):
+ self.sealed = attrs.get('sealed').value
+ if attrs.get('mutable'):
+ self.mutable = attrs.get('mutable').value
+ if attrs.get('gettable'):
+ self.gettable = attrs.get('gettable').value
+ if attrs.get('inline'):
+ self.inline = attrs.get('inline').value
+ if attrs.get('settable'):
+ self.settable = attrs.get('settable').value
+ if attrs.get('id'):
+ self.id = attrs.get('id').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'templateparamlist':
+ obj_ = templateparamlistType.factory()
+ obj_.build(child_)
+ self.set_templateparamlist(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'type':
+ obj_ = linkedTextType.factory()
+ obj_.build(child_)
+ self.set_type(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'definition':
+ definition_ = ''
+ for text__content_ in child_.childNodes:
+ definition_ += text__content_.nodeValue
+ self.definition = definition_
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'argsstring':
+ argsstring_ = ''
+ for text__content_ in child_.childNodes:
+ argsstring_ += text__content_.nodeValue
+ self.argsstring = argsstring_
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'name':
+ name_ = ''
+ for text__content_ in child_.childNodes:
+ name_ += text__content_.nodeValue
+ self.name = name_
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'read':
+ read_ = ''
+ for text__content_ in child_.childNodes:
+ read_ += text__content_.nodeValue
+ self.read = read_
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'write':
+ write_ = ''
+ for text__content_ in child_.childNodes:
+ write_ += text__content_.nodeValue
+ self.write = write_
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'bitfield':
+ bitfield_ = ''
+ for text__content_ in child_.childNodes:
+ bitfield_ += text__content_.nodeValue
+ self.bitfield = bitfield_
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'reimplements':
+ obj_ = reimplementType.factory()
+ obj_.build(child_)
+ self.reimplements.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'reimplementedby':
+ obj_ = reimplementType.factory()
+ obj_.build(child_)
+ self.reimplementedby.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'param':
+ obj_ = paramType.factory()
+ obj_.build(child_)
+ self.param.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'enumvalue':
+ obj_ = enumvalueType.factory()
+ obj_.build(child_)
+ self.enumvalue.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'initializer':
+ obj_ = linkedTextType.factory()
+ obj_.build(child_)
+ self.set_initializer(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'exceptions':
+ obj_ = linkedTextType.factory()
+ obj_.build(child_)
+ self.set_exceptions(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'briefdescription':
+ obj_ = descriptionType.factory()
+ obj_.build(child_)
+ self.set_briefdescription(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'detaileddescription':
+ obj_ = descriptionType.factory()
+ obj_.build(child_)
+ self.set_detaileddescription(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'inbodydescription':
+ obj_ = descriptionType.factory()
+ obj_.build(child_)
+ self.set_inbodydescription(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'location':
+ obj_ = locationType.factory()
+ obj_.build(child_)
+ self.set_location(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'references':
+ obj_ = referenceType.factory()
+ obj_.build(child_)
+ self.references.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'referencedby':
+ obj_ = referenceType.factory()
+ obj_.build(child_)
+ self.referencedby.append(obj_)
+# end class memberdefType
+
+
+class definition(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, valueOf_=''):
+ self.valueOf_ = valueOf_
+ def factory(*args_, **kwargs_):
+ if definition.subclass:
+ return definition.subclass(*args_, **kwargs_)
+ else:
+ return definition(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='definition', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='definition')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='definition'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='definition'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='definition'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class definition
+
+
+class argsstring(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, valueOf_=''):
+ self.valueOf_ = valueOf_
+ def factory(*args_, **kwargs_):
+ if argsstring.subclass:
+ return argsstring.subclass(*args_, **kwargs_)
+ else:
+ return argsstring(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='argsstring', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='argsstring')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='argsstring'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='argsstring'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='argsstring'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class argsstring
+
+
+class read(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, valueOf_=''):
+ self.valueOf_ = valueOf_
+ def factory(*args_, **kwargs_):
+ if read.subclass:
+ return read.subclass(*args_, **kwargs_)
+ else:
+ return read(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='read', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='read')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='read'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='read'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='read'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class read
+
+
+class write(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, valueOf_=''):
+ self.valueOf_ = valueOf_
+ def factory(*args_, **kwargs_):
+ if write.subclass:
+ return write.subclass(*args_, **kwargs_)
+ else:
+ return write(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='write', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='write')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='write'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='write'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='write'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class write
+
+
+class bitfield(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, valueOf_=''):
+ self.valueOf_ = valueOf_
+ def factory(*args_, **kwargs_):
+ if bitfield.subclass:
+ return bitfield.subclass(*args_, **kwargs_)
+ else:
+ return bitfield(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='bitfield', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='bitfield')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='bitfield'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='bitfield'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='bitfield'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class bitfield
+
+
+class descriptionType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, title=None, para=None, sect1=None, internal=None, mixedclass_=None, content_=None):
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if descriptionType.subclass:
+ return descriptionType.subclass(*args_, **kwargs_)
+ else:
+ return descriptionType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_title(self): return self.title
+ def set_title(self, title): self.title = title
+ def get_para(self): return self.para
+ def set_para(self, para): self.para = para
+ def add_para(self, value): self.para.append(value)
+ def insert_para(self, index, value): self.para[index] = value
+ def get_sect1(self): return self.sect1
+ def set_sect1(self, sect1): self.sect1 = sect1
+ def add_sect1(self, value): self.sect1.append(value)
+ def insert_sect1(self, index, value): self.sect1[index] = value
+ def get_internal(self): return self.internal
+ def set_internal(self, internal): self.internal = internal
+ def export(self, outfile, level, namespace_='', name_='descriptionType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='descriptionType')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='descriptionType'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='descriptionType'):
+ for item_ in self.content_:
+ item_.export(outfile, level, item_.name, namespace_)
+ def hasContent_(self):
+ if (
+ self.title is not None or
+ self.para is not None or
+ self.sect1 is not None or
+ self.internal is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='descriptionType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'title':
+ childobj_ = docTitleType.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'title', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'para':
+ childobj_ = docParaType.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'para', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'sect1':
+ childobj_ = docSect1Type.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'sect1', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'internal':
+ childobj_ = docInternalType.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'internal', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+# end class descriptionType
+
+
+class enumvalueType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, prot=None, id=None, name=None, initializer=None, briefdescription=None, detaileddescription=None, mixedclass_=None, content_=None):
+ self.prot = prot
+ self.id = id
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if enumvalueType.subclass:
+ return enumvalueType.subclass(*args_, **kwargs_)
+ else:
+ return enumvalueType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_name(self): return self.name
+ def set_name(self, name): self.name = name
+ def get_initializer(self): return self.initializer
+ def set_initializer(self, initializer): self.initializer = initializer
+ def get_briefdescription(self): return self.briefdescription
+ def set_briefdescription(self, briefdescription): self.briefdescription = briefdescription
+ def get_detaileddescription(self): return self.detaileddescription
+ def set_detaileddescription(self, detaileddescription): self.detaileddescription = detaileddescription
+ def get_prot(self): return self.prot
+ def set_prot(self, prot): self.prot = prot
+ def get_id(self): return self.id
+ def set_id(self, id): self.id = id
+ def export(self, outfile, level, namespace_='', name_='enumvalueType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='enumvalueType')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='enumvalueType'):
+ if self.prot is not None:
+ outfile.write(' prot=%s' % (quote_attrib(self.prot), ))
+ if self.id is not None:
+ outfile.write(' id=%s' % (self.format_string(quote_attrib(self.id).encode(ExternalEncoding), input_name='id'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='enumvalueType'):
+ for item_ in self.content_:
+ item_.export(outfile, level, item_.name, namespace_)
+ def hasContent_(self):
+ if (
+ self.name is not None or
+ self.initializer is not None or
+ self.briefdescription is not None or
+ self.detaileddescription is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='enumvalueType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.prot is not None:
+ showIndent(outfile, level)
+ outfile.write('prot = "%s",\n' % (self.prot,))
+ if self.id is not None:
+ showIndent(outfile, level)
+ outfile.write('id = %s,\n' % (self.id,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('prot'):
+ self.prot = attrs.get('prot').value
+ if attrs.get('id'):
+ self.id = attrs.get('id').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'name':
+ value_ = []
+ for text_ in child_.childNodes:
+ value_.append(text_.nodeValue)
+ valuestr_ = ''.join(value_)
+ obj_ = self.mixedclass_(MixedContainer.CategorySimple,
+ MixedContainer.TypeString, 'name', valuestr_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'initializer':
+ childobj_ = linkedTextType.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'initializer', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'briefdescription':
+ childobj_ = descriptionType.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'briefdescription', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'detaileddescription':
+ childobj_ = descriptionType.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'detaileddescription', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+# end class enumvalueType
+
+
+class templateparamlistType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, param=None):
+ if param is None:
+ self.param = []
+ else:
+ self.param = param
+ def factory(*args_, **kwargs_):
+ if templateparamlistType.subclass:
+ return templateparamlistType.subclass(*args_, **kwargs_)
+ else:
+ return templateparamlistType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_param(self): return self.param
+ def set_param(self, param): self.param = param
+ def add_param(self, value): self.param.append(value)
+ def insert_param(self, index, value): self.param[index] = value
+ def export(self, outfile, level, namespace_='', name_='templateparamlistType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='templateparamlistType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='templateparamlistType'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='templateparamlistType'):
+ for param_ in self.param:
+ param_.export(outfile, level, namespace_, name_='param')
+ def hasContent_(self):
+ if (
+ self.param is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='templateparamlistType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('param=[\n')
+ level += 1
+ for param in self.param:
+ showIndent(outfile, level)
+ outfile.write('model_.param(\n')
+ param.exportLiteral(outfile, level, name_='param')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'param':
+ obj_ = paramType.factory()
+ obj_.build(child_)
+ self.param.append(obj_)
+# end class templateparamlistType
+
+
+class paramType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, type_=None, declname=None, defname=None, array=None, defval=None, briefdescription=None):
+ self.type_ = type_
+ self.declname = declname
+ self.defname = defname
+ self.array = array
+ self.defval = defval
+ self.briefdescription = briefdescription
+ def factory(*args_, **kwargs_):
+ if paramType.subclass:
+ return paramType.subclass(*args_, **kwargs_)
+ else:
+ return paramType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_type(self): return self.type_
+ def set_type(self, type_): self.type_ = type_
+ def get_declname(self): return self.declname
+ def set_declname(self, declname): self.declname = declname
+ def get_defname(self): return self.defname
+ def set_defname(self, defname): self.defname = defname
+ def get_array(self): return self.array
+ def set_array(self, array): self.array = array
+ def get_defval(self): return self.defval
+ def set_defval(self, defval): self.defval = defval
+ def get_briefdescription(self): return self.briefdescription
+ def set_briefdescription(self, briefdescription): self.briefdescription = briefdescription
+ def export(self, outfile, level, namespace_='', name_='paramType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='paramType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='paramType'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='paramType'):
+ if self.type_:
+ self.type_.export(outfile, level, namespace_, name_='type')
+ if self.declname is not None:
+ showIndent(outfile, level)
+ outfile.write('<%sdeclname>%s</%sdeclname>\n' % (namespace_, self.format_string(quote_xml(self.declname).encode(ExternalEncoding), input_name='declname'), namespace_))
+ if self.defname is not None:
+ showIndent(outfile, level)
+ outfile.write('<%sdefname>%s</%sdefname>\n' % (namespace_, self.format_string(quote_xml(self.defname).encode(ExternalEncoding), input_name='defname'), namespace_))
+ if self.array is not None:
+ showIndent(outfile, level)
+ outfile.write('<%sarray>%s</%sarray>\n' % (namespace_, self.format_string(quote_xml(self.array).encode(ExternalEncoding), input_name='array'), namespace_))
+ if self.defval:
+ self.defval.export(outfile, level, namespace_, name_='defval')
+ if self.briefdescription:
+ self.briefdescription.export(outfile, level, namespace_, name_='briefdescription')
+ def hasContent_(self):
+ if (
+ self.type_ is not None or
+ self.declname is not None or
+ self.defname is not None or
+ self.array is not None or
+ self.defval is not None or
+ self.briefdescription is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='paramType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ if self.type_:
+ showIndent(outfile, level)
+ outfile.write('type_=model_.linkedTextType(\n')
+ self.type_.exportLiteral(outfile, level, name_='type')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ showIndent(outfile, level)
+ outfile.write('declname=%s,\n' % quote_python(self.declname).encode(ExternalEncoding))
+ showIndent(outfile, level)
+ outfile.write('defname=%s,\n' % quote_python(self.defname).encode(ExternalEncoding))
+ showIndent(outfile, level)
+ outfile.write('array=%s,\n' % quote_python(self.array).encode(ExternalEncoding))
+ if self.defval:
+ showIndent(outfile, level)
+ outfile.write('defval=model_.linkedTextType(\n')
+ self.defval.exportLiteral(outfile, level, name_='defval')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ if self.briefdescription:
+ showIndent(outfile, level)
+ outfile.write('briefdescription=model_.descriptionType(\n')
+ self.briefdescription.exportLiteral(outfile, level, name_='briefdescription')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'type':
+ obj_ = linkedTextType.factory()
+ obj_.build(child_)
+ self.set_type(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'declname':
+ declname_ = ''
+ for text__content_ in child_.childNodes:
+ declname_ += text__content_.nodeValue
+ self.declname = declname_
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'defname':
+ defname_ = ''
+ for text__content_ in child_.childNodes:
+ defname_ += text__content_.nodeValue
+ self.defname = defname_
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'array':
+ array_ = ''
+ for text__content_ in child_.childNodes:
+ array_ += text__content_.nodeValue
+ self.array = array_
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'defval':
+ obj_ = linkedTextType.factory()
+ obj_.build(child_)
+ self.set_defval(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'briefdescription':
+ obj_ = descriptionType.factory()
+ obj_.build(child_)
+ self.set_briefdescription(obj_)
+# end class paramType
+
+
+class declname(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, valueOf_=''):
+ self.valueOf_ = valueOf_
+ def factory(*args_, **kwargs_):
+ if declname.subclass:
+ return declname.subclass(*args_, **kwargs_)
+ else:
+ return declname(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='declname', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='declname')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='declname'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='declname'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='declname'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class declname
+
+
+class defname(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, valueOf_=''):
+ self.valueOf_ = valueOf_
+ def factory(*args_, **kwargs_):
+ if defname.subclass:
+ return defname.subclass(*args_, **kwargs_)
+ else:
+ return defname(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='defname', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='defname')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='defname'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='defname'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='defname'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class defname
+
+
+class array(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, valueOf_=''):
+ self.valueOf_ = valueOf_
+ def factory(*args_, **kwargs_):
+ if array.subclass:
+ return array.subclass(*args_, **kwargs_)
+ else:
+ return array(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='array', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='array')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='array'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='array'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='array'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class array
+
+
+class linkedTextType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, ref=None, mixedclass_=None, content_=None):
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if linkedTextType.subclass:
+ return linkedTextType.subclass(*args_, **kwargs_)
+ else:
+ return linkedTextType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_ref(self): return self.ref
+ def set_ref(self, ref): self.ref = ref
+ def add_ref(self, value): self.ref.append(value)
+ def insert_ref(self, index, value): self.ref[index] = value
+ def export(self, outfile, level, namespace_='', name_='linkedTextType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='linkedTextType')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='linkedTextType'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='linkedTextType'):
+ for item_ in self.content_:
+ item_.export(outfile, level, item_.name, namespace_)
+ def hasContent_(self):
+ if (
+ self.ref is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='linkedTextType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'ref':
+ childobj_ = docRefTextType.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'ref', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+# end class linkedTextType
+
+
+class graphType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, node=None):
+ if node is None:
+ self.node = []
+ else:
+ self.node = node
+ def factory(*args_, **kwargs_):
+ if graphType.subclass:
+ return graphType.subclass(*args_, **kwargs_)
+ else:
+ return graphType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_node(self): return self.node
+ def set_node(self, node): self.node = node
+ def add_node(self, value): self.node.append(value)
+ def insert_node(self, index, value): self.node[index] = value
+ def export(self, outfile, level, namespace_='', name_='graphType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='graphType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='graphType'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='graphType'):
+ for node_ in self.node:
+ node_.export(outfile, level, namespace_, name_='node')
+ def hasContent_(self):
+ if (
+ self.node is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='graphType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('node=[\n')
+ level += 1
+ for node in self.node:
+ showIndent(outfile, level)
+ outfile.write('model_.node(\n')
+ node.exportLiteral(outfile, level, name_='node')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'node':
+ obj_ = nodeType.factory()
+ obj_.build(child_)
+ self.node.append(obj_)
+# end class graphType
+
+
+class nodeType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, id=None, label=None, link=None, childnode=None):
+ self.id = id
+ self.label = label
+ self.link = link
+ if childnode is None:
+ self.childnode = []
+ else:
+ self.childnode = childnode
+ def factory(*args_, **kwargs_):
+ if nodeType.subclass:
+ return nodeType.subclass(*args_, **kwargs_)
+ else:
+ return nodeType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_label(self): return self.label
+ def set_label(self, label): self.label = label
+ def get_link(self): return self.link
+ def set_link(self, link): self.link = link
+ def get_childnode(self): return self.childnode
+ def set_childnode(self, childnode): self.childnode = childnode
+ def add_childnode(self, value): self.childnode.append(value)
+ def insert_childnode(self, index, value): self.childnode[index] = value
+ def get_id(self): return self.id
+ def set_id(self, id): self.id = id
+ def export(self, outfile, level, namespace_='', name_='nodeType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='nodeType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='nodeType'):
+ if self.id is not None:
+ outfile.write(' id=%s' % (self.format_string(quote_attrib(self.id).encode(ExternalEncoding), input_name='id'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='nodeType'):
+ if self.label is not None:
+ showIndent(outfile, level)
+ outfile.write('<%slabel>%s</%slabel>\n' % (namespace_, self.format_string(quote_xml(self.label).encode(ExternalEncoding), input_name='label'), namespace_))
+ if self.link:
+ self.link.export(outfile, level, namespace_, name_='link')
+ for childnode_ in self.childnode:
+ childnode_.export(outfile, level, namespace_, name_='childnode')
+ def hasContent_(self):
+ if (
+ self.label is not None or
+ self.link is not None or
+ self.childnode is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='nodeType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.id is not None:
+ showIndent(outfile, level)
+ outfile.write('id = %s,\n' % (self.id,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('label=%s,\n' % quote_python(self.label).encode(ExternalEncoding))
+ if self.link:
+ showIndent(outfile, level)
+ outfile.write('link=model_.linkType(\n')
+ self.link.exportLiteral(outfile, level, name_='link')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ showIndent(outfile, level)
+ outfile.write('childnode=[\n')
+ level += 1
+ for childnode in self.childnode:
+ showIndent(outfile, level)
+ outfile.write('model_.childnode(\n')
+ childnode.exportLiteral(outfile, level, name_='childnode')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('id'):
+ self.id = attrs.get('id').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'label':
+ label_ = ''
+ for text__content_ in child_.childNodes:
+ label_ += text__content_.nodeValue
+ self.label = label_
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'link':
+ obj_ = linkType.factory()
+ obj_.build(child_)
+ self.set_link(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'childnode':
+ obj_ = childnodeType.factory()
+ obj_.build(child_)
+ self.childnode.append(obj_)
+# end class nodeType
+
+
+class label(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, valueOf_=''):
+ self.valueOf_ = valueOf_
+ def factory(*args_, **kwargs_):
+ if label.subclass:
+ return label.subclass(*args_, **kwargs_)
+ else:
+ return label(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='label', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='label')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='label'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='label'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='label'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class label
+
+
+class childnodeType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, relation=None, refid=None, edgelabel=None):
+ self.relation = relation
+ self.refid = refid
+ if edgelabel is None:
+ self.edgelabel = []
+ else:
+ self.edgelabel = edgelabel
+ def factory(*args_, **kwargs_):
+ if childnodeType.subclass:
+ return childnodeType.subclass(*args_, **kwargs_)
+ else:
+ return childnodeType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_edgelabel(self): return self.edgelabel
+ def set_edgelabel(self, edgelabel): self.edgelabel = edgelabel
+ def add_edgelabel(self, value): self.edgelabel.append(value)
+ def insert_edgelabel(self, index, value): self.edgelabel[index] = value
+ def get_relation(self): return self.relation
+ def set_relation(self, relation): self.relation = relation
+ def get_refid(self): return self.refid
+ def set_refid(self, refid): self.refid = refid
+ def export(self, outfile, level, namespace_='', name_='childnodeType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='childnodeType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='childnodeType'):
+ if self.relation is not None:
+ outfile.write(' relation=%s' % (quote_attrib(self.relation), ))
+ if self.refid is not None:
+ outfile.write(' refid=%s' % (self.format_string(quote_attrib(self.refid).encode(ExternalEncoding), input_name='refid'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='childnodeType'):
+ for edgelabel_ in self.edgelabel:
+ showIndent(outfile, level)
+ outfile.write('<%sedgelabel>%s</%sedgelabel>\n' % (namespace_, self.format_string(quote_xml(edgelabel_).encode(ExternalEncoding), input_name='edgelabel'), namespace_))
+ def hasContent_(self):
+ if (
+ self.edgelabel is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='childnodeType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.relation is not None:
+ showIndent(outfile, level)
+ outfile.write('relation = "%s",\n' % (self.relation,))
+ if self.refid is not None:
+ showIndent(outfile, level)
+ outfile.write('refid = %s,\n' % (self.refid,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('edgelabel=[\n')
+ level += 1
+ for edgelabel in self.edgelabel:
+ showIndent(outfile, level)
+ outfile.write('%s,\n' % quote_python(edgelabel).encode(ExternalEncoding))
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('relation'):
+ self.relation = attrs.get('relation').value
+ if attrs.get('refid'):
+ self.refid = attrs.get('refid').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'edgelabel':
+ edgelabel_ = ''
+ for text__content_ in child_.childNodes:
+ edgelabel_ += text__content_.nodeValue
+ self.edgelabel.append(edgelabel_)
+# end class childnodeType
+
+
+class edgelabel(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, valueOf_=''):
+ self.valueOf_ = valueOf_
+ def factory(*args_, **kwargs_):
+ if edgelabel.subclass:
+ return edgelabel.subclass(*args_, **kwargs_)
+ else:
+ return edgelabel(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='edgelabel', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='edgelabel')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='edgelabel'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='edgelabel'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='edgelabel'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class edgelabel
+
+
+class linkType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, refid=None, external=None, valueOf_=''):
+ self.refid = refid
+ self.external = external
+ self.valueOf_ = valueOf_
+ def factory(*args_, **kwargs_):
+ if linkType.subclass:
+ return linkType.subclass(*args_, **kwargs_)
+ else:
+ return linkType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_refid(self): return self.refid
+ def set_refid(self, refid): self.refid = refid
+ def get_external(self): return self.external
+ def set_external(self, external): self.external = external
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='linkType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='linkType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='linkType'):
+ if self.refid is not None:
+ outfile.write(' refid=%s' % (self.format_string(quote_attrib(self.refid).encode(ExternalEncoding), input_name='refid'), ))
+ if self.external is not None:
+ outfile.write(' external=%s' % (self.format_string(quote_attrib(self.external).encode(ExternalEncoding), input_name='external'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='linkType'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='linkType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.refid is not None:
+ showIndent(outfile, level)
+ outfile.write('refid = %s,\n' % (self.refid,))
+ if self.external is not None:
+ showIndent(outfile, level)
+ outfile.write('external = %s,\n' % (self.external,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('refid'):
+ self.refid = attrs.get('refid').value
+ if attrs.get('external'):
+ self.external = attrs.get('external').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class linkType
+
+
+class listingType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, codeline=None):
+ if codeline is None:
+ self.codeline = []
+ else:
+ self.codeline = codeline
+ def factory(*args_, **kwargs_):
+ if listingType.subclass:
+ return listingType.subclass(*args_, **kwargs_)
+ else:
+ return listingType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_codeline(self): return self.codeline
+ def set_codeline(self, codeline): self.codeline = codeline
+ def add_codeline(self, value): self.codeline.append(value)
+ def insert_codeline(self, index, value): self.codeline[index] = value
+ def export(self, outfile, level, namespace_='', name_='listingType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='listingType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='listingType'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='listingType'):
+ for codeline_ in self.codeline:
+ codeline_.export(outfile, level, namespace_, name_='codeline')
+ def hasContent_(self):
+ if (
+ self.codeline is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='listingType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('codeline=[\n')
+ level += 1
+ for codeline in self.codeline:
+ showIndent(outfile, level)
+ outfile.write('model_.codeline(\n')
+ codeline.exportLiteral(outfile, level, name_='codeline')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'codeline':
+ obj_ = codelineType.factory()
+ obj_.build(child_)
+ self.codeline.append(obj_)
+# end class listingType
+
+
+class codelineType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, external=None, lineno=None, refkind=None, refid=None, highlight=None):
+ self.external = external
+ self.lineno = lineno
+ self.refkind = refkind
+ self.refid = refid
+ if highlight is None:
+ self.highlight = []
+ else:
+ self.highlight = highlight
+ def factory(*args_, **kwargs_):
+ if codelineType.subclass:
+ return codelineType.subclass(*args_, **kwargs_)
+ else:
+ return codelineType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_highlight(self): return self.highlight
+ def set_highlight(self, highlight): self.highlight = highlight
+ def add_highlight(self, value): self.highlight.append(value)
+ def insert_highlight(self, index, value): self.highlight[index] = value
+ def get_external(self): return self.external
+ def set_external(self, external): self.external = external
+ def get_lineno(self): return self.lineno
+ def set_lineno(self, lineno): self.lineno = lineno
+ def get_refkind(self): return self.refkind
+ def set_refkind(self, refkind): self.refkind = refkind
+ def get_refid(self): return self.refid
+ def set_refid(self, refid): self.refid = refid
+ def export(self, outfile, level, namespace_='', name_='codelineType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='codelineType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='codelineType'):
+ if self.external is not None:
+ outfile.write(' external=%s' % (quote_attrib(self.external), ))
+ if self.lineno is not None:
+ outfile.write(' lineno="%s"' % self.format_integer(self.lineno, input_name='lineno'))
+ if self.refkind is not None:
+ outfile.write(' refkind=%s' % (quote_attrib(self.refkind), ))
+ if self.refid is not None:
+ outfile.write(' refid=%s' % (self.format_string(quote_attrib(self.refid).encode(ExternalEncoding), input_name='refid'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='codelineType'):
+ for highlight_ in self.highlight:
+ highlight_.export(outfile, level, namespace_, name_='highlight')
+ def hasContent_(self):
+ if (
+ self.highlight is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='codelineType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.external is not None:
+ showIndent(outfile, level)
+ outfile.write('external = "%s",\n' % (self.external,))
+ if self.lineno is not None:
+ showIndent(outfile, level)
+ outfile.write('lineno = %s,\n' % (self.lineno,))
+ if self.refkind is not None:
+ showIndent(outfile, level)
+ outfile.write('refkind = "%s",\n' % (self.refkind,))
+ if self.refid is not None:
+ showIndent(outfile, level)
+ outfile.write('refid = %s,\n' % (self.refid,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('highlight=[\n')
+ level += 1
+ for highlight in self.highlight:
+ showIndent(outfile, level)
+ outfile.write('model_.highlight(\n')
+ highlight.exportLiteral(outfile, level, name_='highlight')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('external'):
+ self.external = attrs.get('external').value
+ if attrs.get('lineno'):
+ try:
+ self.lineno = int(attrs.get('lineno').value)
+ except ValueError, exp:
+ raise ValueError('Bad integer attribute (lineno): %s' % exp)
+ if attrs.get('refkind'):
+ self.refkind = attrs.get('refkind').value
+ if attrs.get('refid'):
+ self.refid = attrs.get('refid').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'highlight':
+ obj_ = highlightType.factory()
+ obj_.build(child_)
+ self.highlight.append(obj_)
+# end class codelineType
+
+
+class highlightType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, classxx=None, sp=None, ref=None, mixedclass_=None, content_=None):
+ self.classxx = classxx
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if highlightType.subclass:
+ return highlightType.subclass(*args_, **kwargs_)
+ else:
+ return highlightType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_sp(self): return self.sp
+ def set_sp(self, sp): self.sp = sp
+ def add_sp(self, value): self.sp.append(value)
+ def insert_sp(self, index, value): self.sp[index] = value
+ def get_ref(self): return self.ref
+ def set_ref(self, ref): self.ref = ref
+ def add_ref(self, value): self.ref.append(value)
+ def insert_ref(self, index, value): self.ref[index] = value
+ def get_class(self): return self.classxx
+ def set_class(self, classxx): self.classxx = classxx
+ def export(self, outfile, level, namespace_='', name_='highlightType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='highlightType')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='highlightType'):
+ if self.classxx is not None:
+ outfile.write(' class=%s' % (quote_attrib(self.classxx), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='highlightType'):
+ for item_ in self.content_:
+ item_.export(outfile, level, item_.name, namespace_)
+ def hasContent_(self):
+ if (
+ self.sp is not None or
+ self.ref is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='highlightType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.classxx is not None:
+ showIndent(outfile, level)
+ outfile.write('classxx = "%s",\n' % (self.classxx,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('class'):
+ self.classxx = attrs.get('class').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'sp':
+ value_ = []
+ for text_ in child_.childNodes:
+ value_.append(text_.nodeValue)
+ valuestr_ = ''.join(value_)
+ obj_ = self.mixedclass_(MixedContainer.CategorySimple,
+ MixedContainer.TypeString, 'sp', valuestr_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'ref':
+ childobj_ = docRefTextType.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'ref', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+# end class highlightType
+
+
+class sp(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, valueOf_=''):
+ self.valueOf_ = valueOf_
+ def factory(*args_, **kwargs_):
+ if sp.subclass:
+ return sp.subclass(*args_, **kwargs_)
+ else:
+ return sp(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='sp', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='sp')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='sp'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='sp'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='sp'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class sp
+
+
+class referenceType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, endline=None, startline=None, refid=None, compoundref=None, valueOf_='', mixedclass_=None, content_=None):
+ self.endline = endline
+ self.startline = startline
+ self.refid = refid
+ self.compoundref = compoundref
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if referenceType.subclass:
+ return referenceType.subclass(*args_, **kwargs_)
+ else:
+ return referenceType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_endline(self): return self.endline
+ def set_endline(self, endline): self.endline = endline
+ def get_startline(self): return self.startline
+ def set_startline(self, startline): self.startline = startline
+ def get_refid(self): return self.refid
+ def set_refid(self, refid): self.refid = refid
+ def get_compoundref(self): return self.compoundref
+ def set_compoundref(self, compoundref): self.compoundref = compoundref
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='referenceType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='referenceType')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='referenceType'):
+ if self.endline is not None:
+ outfile.write(' endline="%s"' % self.format_integer(self.endline, input_name='endline'))
+ if self.startline is not None:
+ outfile.write(' startline="%s"' % self.format_integer(self.startline, input_name='startline'))
+ if self.refid is not None:
+ outfile.write(' refid=%s' % (self.format_string(quote_attrib(self.refid).encode(ExternalEncoding), input_name='refid'), ))
+ if self.compoundref is not None:
+ outfile.write(' compoundref=%s' % (self.format_string(quote_attrib(self.compoundref).encode(ExternalEncoding), input_name='compoundref'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='referenceType'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='referenceType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.endline is not None:
+ showIndent(outfile, level)
+ outfile.write('endline = %s,\n' % (self.endline,))
+ if self.startline is not None:
+ showIndent(outfile, level)
+ outfile.write('startline = %s,\n' % (self.startline,))
+ if self.refid is not None:
+ showIndent(outfile, level)
+ outfile.write('refid = %s,\n' % (self.refid,))
+ if self.compoundref is not None:
+ showIndent(outfile, level)
+ outfile.write('compoundref = %s,\n' % (self.compoundref,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('endline'):
+ try:
+ self.endline = int(attrs.get('endline').value)
+ except ValueError, exp:
+ raise ValueError('Bad integer attribute (endline): %s' % exp)
+ if attrs.get('startline'):
+ try:
+ self.startline = int(attrs.get('startline').value)
+ except ValueError, exp:
+ raise ValueError('Bad integer attribute (startline): %s' % exp)
+ if attrs.get('refid'):
+ self.refid = attrs.get('refid').value
+ if attrs.get('compoundref'):
+ self.compoundref = attrs.get('compoundref').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class referenceType
+
+
+class locationType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, bodystart=None, line=None, bodyend=None, bodyfile=None, file=None, valueOf_=''):
+ self.bodystart = bodystart
+ self.line = line
+ self.bodyend = bodyend
+ self.bodyfile = bodyfile
+ self.file = file
+ self.valueOf_ = valueOf_
+ def factory(*args_, **kwargs_):
+ if locationType.subclass:
+ return locationType.subclass(*args_, **kwargs_)
+ else:
+ return locationType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_bodystart(self): return self.bodystart
+ def set_bodystart(self, bodystart): self.bodystart = bodystart
+ def get_line(self): return self.line
+ def set_line(self, line): self.line = line
+ def get_bodyend(self): return self.bodyend
+ def set_bodyend(self, bodyend): self.bodyend = bodyend
+ def get_bodyfile(self): return self.bodyfile
+ def set_bodyfile(self, bodyfile): self.bodyfile = bodyfile
+ def get_file(self): return self.file
+ def set_file(self, file): self.file = file
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='locationType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='locationType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='locationType'):
+ if self.bodystart is not None:
+ outfile.write(' bodystart="%s"' % self.format_integer(self.bodystart, input_name='bodystart'))
+ if self.line is not None:
+ outfile.write(' line="%s"' % self.format_integer(self.line, input_name='line'))
+ if self.bodyend is not None:
+ outfile.write(' bodyend="%s"' % self.format_integer(self.bodyend, input_name='bodyend'))
+ if self.bodyfile is not None:
+ outfile.write(' bodyfile=%s' % (self.format_string(quote_attrib(self.bodyfile).encode(ExternalEncoding), input_name='bodyfile'), ))
+ if self.file is not None:
+ outfile.write(' file=%s' % (self.format_string(quote_attrib(self.file).encode(ExternalEncoding), input_name='file'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='locationType'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='locationType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.bodystart is not None:
+ showIndent(outfile, level)
+ outfile.write('bodystart = %s,\n' % (self.bodystart,))
+ if self.line is not None:
+ showIndent(outfile, level)
+ outfile.write('line = %s,\n' % (self.line,))
+ if self.bodyend is not None:
+ showIndent(outfile, level)
+ outfile.write('bodyend = %s,\n' % (self.bodyend,))
+ if self.bodyfile is not None:
+ showIndent(outfile, level)
+ outfile.write('bodyfile = %s,\n' % (self.bodyfile,))
+ if self.file is not None:
+ showIndent(outfile, level)
+ outfile.write('file = %s,\n' % (self.file,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('bodystart'):
+ try:
+ self.bodystart = int(attrs.get('bodystart').value)
+ except ValueError, exp:
+ raise ValueError('Bad integer attribute (bodystart): %s' % exp)
+ if attrs.get('line'):
+ try:
+ self.line = int(attrs.get('line').value)
+ except ValueError, exp:
+ raise ValueError('Bad integer attribute (line): %s' % exp)
+ if attrs.get('bodyend'):
+ try:
+ self.bodyend = int(attrs.get('bodyend').value)
+ except ValueError, exp:
+ raise ValueError('Bad integer attribute (bodyend): %s' % exp)
+ if attrs.get('bodyfile'):
+ self.bodyfile = attrs.get('bodyfile').value
+ if attrs.get('file'):
+ self.file = attrs.get('file').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class locationType
+
+
+class docSect1Type(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, id=None, title=None, para=None, sect2=None, internal=None, mixedclass_=None, content_=None):
+ self.id = id
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if docSect1Type.subclass:
+ return docSect1Type.subclass(*args_, **kwargs_)
+ else:
+ return docSect1Type(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_title(self): return self.title
+ def set_title(self, title): self.title = title
+ def get_para(self): return self.para
+ def set_para(self, para): self.para = para
+ def add_para(self, value): self.para.append(value)
+ def insert_para(self, index, value): self.para[index] = value
+ def get_sect2(self): return self.sect2
+ def set_sect2(self, sect2): self.sect2 = sect2
+ def add_sect2(self, value): self.sect2.append(value)
+ def insert_sect2(self, index, value): self.sect2[index] = value
+ def get_internal(self): return self.internal
+ def set_internal(self, internal): self.internal = internal
+ def get_id(self): return self.id
+ def set_id(self, id): self.id = id
+ def export(self, outfile, level, namespace_='', name_='docSect1Type', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docSect1Type')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='docSect1Type'):
+ if self.id is not None:
+ outfile.write(' id=%s' % (self.format_string(quote_attrib(self.id).encode(ExternalEncoding), input_name='id'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='docSect1Type'):
+ for item_ in self.content_:
+ item_.export(outfile, level, item_.name, namespace_)
+ def hasContent_(self):
+ if (
+ self.title is not None or
+ self.para is not None or
+ self.sect2 is not None or
+ self.internal is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docSect1Type'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.id is not None:
+ showIndent(outfile, level)
+ outfile.write('id = %s,\n' % (self.id,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('id'):
+ self.id = attrs.get('id').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'title':
+ childobj_ = docTitleType.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'title', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'para':
+ childobj_ = docParaType.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'para', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'sect2':
+ childobj_ = docSect2Type.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'sect2', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'internal':
+ childobj_ = docInternalS1Type.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'internal', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+# end class docSect1Type
+
+
+class docSect2Type(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, id=None, title=None, para=None, sect3=None, internal=None, mixedclass_=None, content_=None):
+ self.id = id
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if docSect2Type.subclass:
+ return docSect2Type.subclass(*args_, **kwargs_)
+ else:
+ return docSect2Type(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_title(self): return self.title
+ def set_title(self, title): self.title = title
+ def get_para(self): return self.para
+ def set_para(self, para): self.para = para
+ def add_para(self, value): self.para.append(value)
+ def insert_para(self, index, value): self.para[index] = value
+ def get_sect3(self): return self.sect3
+ def set_sect3(self, sect3): self.sect3 = sect3
+ def add_sect3(self, value): self.sect3.append(value)
+ def insert_sect3(self, index, value): self.sect3[index] = value
+ def get_internal(self): return self.internal
+ def set_internal(self, internal): self.internal = internal
+ def get_id(self): return self.id
+ def set_id(self, id): self.id = id
+ def export(self, outfile, level, namespace_='', name_='docSect2Type', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docSect2Type')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='docSect2Type'):
+ if self.id is not None:
+ outfile.write(' id=%s' % (self.format_string(quote_attrib(self.id).encode(ExternalEncoding), input_name='id'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='docSect2Type'):
+ for item_ in self.content_:
+ item_.export(outfile, level, item_.name, namespace_)
+ def hasContent_(self):
+ if (
+ self.title is not None or
+ self.para is not None or
+ self.sect3 is not None or
+ self.internal is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docSect2Type'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.id is not None:
+ showIndent(outfile, level)
+ outfile.write('id = %s,\n' % (self.id,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('id'):
+ self.id = attrs.get('id').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'title':
+ childobj_ = docTitleType.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'title', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'para':
+ childobj_ = docParaType.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'para', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'sect3':
+ childobj_ = docSect3Type.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'sect3', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'internal':
+ childobj_ = docInternalS2Type.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'internal', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+# end class docSect2Type
+
+
+class docSect3Type(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, id=None, title=None, para=None, sect4=None, internal=None, mixedclass_=None, content_=None):
+ self.id = id
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if docSect3Type.subclass:
+ return docSect3Type.subclass(*args_, **kwargs_)
+ else:
+ return docSect3Type(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_title(self): return self.title
+ def set_title(self, title): self.title = title
+ def get_para(self): return self.para
+ def set_para(self, para): self.para = para
+ def add_para(self, value): self.para.append(value)
+ def insert_para(self, index, value): self.para[index] = value
+ def get_sect4(self): return self.sect4
+ def set_sect4(self, sect4): self.sect4 = sect4
+ def add_sect4(self, value): self.sect4.append(value)
+ def insert_sect4(self, index, value): self.sect4[index] = value
+ def get_internal(self): return self.internal
+ def set_internal(self, internal): self.internal = internal
+ def get_id(self): return self.id
+ def set_id(self, id): self.id = id
+ def export(self, outfile, level, namespace_='', name_='docSect3Type', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docSect3Type')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='docSect3Type'):
+ if self.id is not None:
+ outfile.write(' id=%s' % (self.format_string(quote_attrib(self.id).encode(ExternalEncoding), input_name='id'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='docSect3Type'):
+ for item_ in self.content_:
+ item_.export(outfile, level, item_.name, namespace_)
+ def hasContent_(self):
+ if (
+ self.title is not None or
+ self.para is not None or
+ self.sect4 is not None or
+ self.internal is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docSect3Type'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.id is not None:
+ showIndent(outfile, level)
+ outfile.write('id = %s,\n' % (self.id,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('id'):
+ self.id = attrs.get('id').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'title':
+ childobj_ = docTitleType.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'title', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'para':
+ childobj_ = docParaType.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'para', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'sect4':
+ childobj_ = docSect4Type.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'sect4', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'internal':
+ childobj_ = docInternalS3Type.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'internal', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+# end class docSect3Type
+
+
+class docSect4Type(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, id=None, title=None, para=None, internal=None, mixedclass_=None, content_=None):
+ self.id = id
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if docSect4Type.subclass:
+ return docSect4Type.subclass(*args_, **kwargs_)
+ else:
+ return docSect4Type(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_title(self): return self.title
+ def set_title(self, title): self.title = title
+ def get_para(self): return self.para
+ def set_para(self, para): self.para = para
+ def add_para(self, value): self.para.append(value)
+ def insert_para(self, index, value): self.para[index] = value
+ def get_internal(self): return self.internal
+ def set_internal(self, internal): self.internal = internal
+ def get_id(self): return self.id
+ def set_id(self, id): self.id = id
+ def export(self, outfile, level, namespace_='', name_='docSect4Type', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docSect4Type')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='docSect4Type'):
+ if self.id is not None:
+ outfile.write(' id=%s' % (self.format_string(quote_attrib(self.id).encode(ExternalEncoding), input_name='id'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='docSect4Type'):
+ for item_ in self.content_:
+ item_.export(outfile, level, item_.name, namespace_)
+ def hasContent_(self):
+ if (
+ self.title is not None or
+ self.para is not None or
+ self.internal is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docSect4Type'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.id is not None:
+ showIndent(outfile, level)
+ outfile.write('id = %s,\n' % (self.id,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('id'):
+ self.id = attrs.get('id').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'title':
+ childobj_ = docTitleType.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'title', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'para':
+ childobj_ = docParaType.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'para', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'internal':
+ childobj_ = docInternalS4Type.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'internal', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+# end class docSect4Type
+
+
+class docInternalType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, para=None, sect1=None, mixedclass_=None, content_=None):
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if docInternalType.subclass:
+ return docInternalType.subclass(*args_, **kwargs_)
+ else:
+ return docInternalType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_para(self): return self.para
+ def set_para(self, para): self.para = para
+ def add_para(self, value): self.para.append(value)
+ def insert_para(self, index, value): self.para[index] = value
+ def get_sect1(self): return self.sect1
+ def set_sect1(self, sect1): self.sect1 = sect1
+ def add_sect1(self, value): self.sect1.append(value)
+ def insert_sect1(self, index, value): self.sect1[index] = value
+ def export(self, outfile, level, namespace_='', name_='docInternalType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docInternalType')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='docInternalType'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='docInternalType'):
+ for item_ in self.content_:
+ item_.export(outfile, level, item_.name, namespace_)
+ def hasContent_(self):
+ if (
+ self.para is not None or
+ self.sect1 is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docInternalType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'para':
+ childobj_ = docParaType.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'para', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'sect1':
+ childobj_ = docSect1Type.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'sect1', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+# end class docInternalType
+
+
+class docInternalS1Type(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, para=None, sect2=None, mixedclass_=None, content_=None):
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if docInternalS1Type.subclass:
+ return docInternalS1Type.subclass(*args_, **kwargs_)
+ else:
+ return docInternalS1Type(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_para(self): return self.para
+ def set_para(self, para): self.para = para
+ def add_para(self, value): self.para.append(value)
+ def insert_para(self, index, value): self.para[index] = value
+ def get_sect2(self): return self.sect2
+ def set_sect2(self, sect2): self.sect2 = sect2
+ def add_sect2(self, value): self.sect2.append(value)
+ def insert_sect2(self, index, value): self.sect2[index] = value
+ def export(self, outfile, level, namespace_='', name_='docInternalS1Type', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docInternalS1Type')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='docInternalS1Type'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='docInternalS1Type'):
+ for item_ in self.content_:
+ item_.export(outfile, level, item_.name, namespace_)
+ def hasContent_(self):
+ if (
+ self.para is not None or
+ self.sect2 is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docInternalS1Type'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'para':
+ childobj_ = docParaType.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'para', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'sect2':
+ childobj_ = docSect2Type.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'sect2', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+# end class docInternalS1Type
+
+
+class docInternalS2Type(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, para=None, sect3=None, mixedclass_=None, content_=None):
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if docInternalS2Type.subclass:
+ return docInternalS2Type.subclass(*args_, **kwargs_)
+ else:
+ return docInternalS2Type(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_para(self): return self.para
+ def set_para(self, para): self.para = para
+ def add_para(self, value): self.para.append(value)
+ def insert_para(self, index, value): self.para[index] = value
+ def get_sect3(self): return self.sect3
+ def set_sect3(self, sect3): self.sect3 = sect3
+ def add_sect3(self, value): self.sect3.append(value)
+ def insert_sect3(self, index, value): self.sect3[index] = value
+ def export(self, outfile, level, namespace_='', name_='docInternalS2Type', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docInternalS2Type')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='docInternalS2Type'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='docInternalS2Type'):
+ for item_ in self.content_:
+ item_.export(outfile, level, item_.name, namespace_)
+ def hasContent_(self):
+ if (
+ self.para is not None or
+ self.sect3 is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docInternalS2Type'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'para':
+ childobj_ = docParaType.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'para', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'sect3':
+ childobj_ = docSect3Type.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'sect3', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+# end class docInternalS2Type
+
+
+class docInternalS3Type(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, para=None, sect3=None, mixedclass_=None, content_=None):
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if docInternalS3Type.subclass:
+ return docInternalS3Type.subclass(*args_, **kwargs_)
+ else:
+ return docInternalS3Type(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_para(self): return self.para
+ def set_para(self, para): self.para = para
+ def add_para(self, value): self.para.append(value)
+ def insert_para(self, index, value): self.para[index] = value
+ def get_sect3(self): return self.sect3
+ def set_sect3(self, sect3): self.sect3 = sect3
+ def add_sect3(self, value): self.sect3.append(value)
+ def insert_sect3(self, index, value): self.sect3[index] = value
+ def export(self, outfile, level, namespace_='', name_='docInternalS3Type', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docInternalS3Type')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='docInternalS3Type'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='docInternalS3Type'):
+ for item_ in self.content_:
+ item_.export(outfile, level, item_.name, namespace_)
+ def hasContent_(self):
+ if (
+ self.para is not None or
+ self.sect3 is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docInternalS3Type'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'para':
+ childobj_ = docParaType.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'para', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'sect3':
+ childobj_ = docSect4Type.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'sect3', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+# end class docInternalS3Type
+
+
+class docInternalS4Type(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, para=None, mixedclass_=None, content_=None):
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if docInternalS4Type.subclass:
+ return docInternalS4Type.subclass(*args_, **kwargs_)
+ else:
+ return docInternalS4Type(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_para(self): return self.para
+ def set_para(self, para): self.para = para
+ def add_para(self, value): self.para.append(value)
+ def insert_para(self, index, value): self.para[index] = value
+ def export(self, outfile, level, namespace_='', name_='docInternalS4Type', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docInternalS4Type')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='docInternalS4Type'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='docInternalS4Type'):
+ for item_ in self.content_:
+ item_.export(outfile, level, item_.name, namespace_)
+ def hasContent_(self):
+ if (
+ self.para is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docInternalS4Type'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'para':
+ childobj_ = docParaType.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'para', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+# end class docInternalS4Type
+
+
+class docTitleType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, valueOf_='', mixedclass_=None, content_=None):
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if docTitleType.subclass:
+ return docTitleType.subclass(*args_, **kwargs_)
+ else:
+ return docTitleType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='docTitleType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docTitleType')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='docTitleType'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='docTitleType'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docTitleType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class docTitleType
+
+
+class docParaType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, valueOf_='', mixedclass_=None, content_=None):
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if docParaType.subclass:
+ return docParaType.subclass(*args_, **kwargs_)
+ else:
+ return docParaType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='docParaType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docParaType')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='docParaType'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='docParaType'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docParaType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class docParaType
+
+
+class docMarkupType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, valueOf_='', mixedclass_=None, content_=None):
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if docMarkupType.subclass:
+ return docMarkupType.subclass(*args_, **kwargs_)
+ else:
+ return docMarkupType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='docMarkupType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docMarkupType')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='docMarkupType'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='docMarkupType'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docMarkupType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class docMarkupType
+
+
+class docURLLink(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, url=None, valueOf_='', mixedclass_=None, content_=None):
+ self.url = url
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if docURLLink.subclass:
+ return docURLLink.subclass(*args_, **kwargs_)
+ else:
+ return docURLLink(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_url(self): return self.url
+ def set_url(self, url): self.url = url
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='docURLLink', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docURLLink')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='docURLLink'):
+ if self.url is not None:
+ outfile.write(' url=%s' % (self.format_string(quote_attrib(self.url).encode(ExternalEncoding), input_name='url'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='docURLLink'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docURLLink'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.url is not None:
+ showIndent(outfile, level)
+ outfile.write('url = %s,\n' % (self.url,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('url'):
+ self.url = attrs.get('url').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class docURLLink
+
+
+class docAnchorType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, id=None, valueOf_='', mixedclass_=None, content_=None):
+ self.id = id
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if docAnchorType.subclass:
+ return docAnchorType.subclass(*args_, **kwargs_)
+ else:
+ return docAnchorType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_id(self): return self.id
+ def set_id(self, id): self.id = id
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='docAnchorType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docAnchorType')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='docAnchorType'):
+ if self.id is not None:
+ outfile.write(' id=%s' % (self.format_string(quote_attrib(self.id).encode(ExternalEncoding), input_name='id'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='docAnchorType'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docAnchorType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.id is not None:
+ showIndent(outfile, level)
+ outfile.write('id = %s,\n' % (self.id,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('id'):
+ self.id = attrs.get('id').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class docAnchorType
+
+
+class docFormulaType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, id=None, valueOf_='', mixedclass_=None, content_=None):
+ self.id = id
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if docFormulaType.subclass:
+ return docFormulaType.subclass(*args_, **kwargs_)
+ else:
+ return docFormulaType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_id(self): return self.id
+ def set_id(self, id): self.id = id
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='docFormulaType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docFormulaType')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='docFormulaType'):
+ if self.id is not None:
+ outfile.write(' id=%s' % (self.format_string(quote_attrib(self.id).encode(ExternalEncoding), input_name='id'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='docFormulaType'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docFormulaType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.id is not None:
+ showIndent(outfile, level)
+ outfile.write('id = %s,\n' % (self.id,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('id'):
+ self.id = attrs.get('id').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class docFormulaType
+
+
+class docIndexEntryType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, primaryie=None, secondaryie=None):
+ self.primaryie = primaryie
+ self.secondaryie = secondaryie
+ def factory(*args_, **kwargs_):
+ if docIndexEntryType.subclass:
+ return docIndexEntryType.subclass(*args_, **kwargs_)
+ else:
+ return docIndexEntryType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_primaryie(self): return self.primaryie
+ def set_primaryie(self, primaryie): self.primaryie = primaryie
+ def get_secondaryie(self): return self.secondaryie
+ def set_secondaryie(self, secondaryie): self.secondaryie = secondaryie
+ def export(self, outfile, level, namespace_='', name_='docIndexEntryType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docIndexEntryType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='docIndexEntryType'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='docIndexEntryType'):
+ if self.primaryie is not None:
+ showIndent(outfile, level)
+ outfile.write('<%sprimaryie>%s</%sprimaryie>\n' % (namespace_, self.format_string(quote_xml(self.primaryie).encode(ExternalEncoding), input_name='primaryie'), namespace_))
+ if self.secondaryie is not None:
+ showIndent(outfile, level)
+ outfile.write('<%ssecondaryie>%s</%ssecondaryie>\n' % (namespace_, self.format_string(quote_xml(self.secondaryie).encode(ExternalEncoding), input_name='secondaryie'), namespace_))
+ def hasContent_(self):
+ if (
+ self.primaryie is not None or
+ self.secondaryie is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docIndexEntryType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('primaryie=%s,\n' % quote_python(self.primaryie).encode(ExternalEncoding))
+ showIndent(outfile, level)
+ outfile.write('secondaryie=%s,\n' % quote_python(self.secondaryie).encode(ExternalEncoding))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'primaryie':
+ primaryie_ = ''
+ for text__content_ in child_.childNodes:
+ primaryie_ += text__content_.nodeValue
+ self.primaryie = primaryie_
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'secondaryie':
+ secondaryie_ = ''
+ for text__content_ in child_.childNodes:
+ secondaryie_ += text__content_.nodeValue
+ self.secondaryie = secondaryie_
+# end class docIndexEntryType
+
+
+class docListType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, listitem=None):
+ if listitem is None:
+ self.listitem = []
+ else:
+ self.listitem = listitem
+ def factory(*args_, **kwargs_):
+ if docListType.subclass:
+ return docListType.subclass(*args_, **kwargs_)
+ else:
+ return docListType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_listitem(self): return self.listitem
+ def set_listitem(self, listitem): self.listitem = listitem
+ def add_listitem(self, value): self.listitem.append(value)
+ def insert_listitem(self, index, value): self.listitem[index] = value
+ def export(self, outfile, level, namespace_='', name_='docListType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docListType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='docListType'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='docListType'):
+ for listitem_ in self.listitem:
+ listitem_.export(outfile, level, namespace_, name_='listitem')
+ def hasContent_(self):
+ if (
+ self.listitem is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docListType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('listitem=[\n')
+ level += 1
+ for listitem in self.listitem:
+ showIndent(outfile, level)
+ outfile.write('model_.listitem(\n')
+ listitem.exportLiteral(outfile, level, name_='listitem')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'listitem':
+ obj_ = docListItemType.factory()
+ obj_.build(child_)
+ self.listitem.append(obj_)
+# end class docListType
+
+
+class docListItemType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, para=None):
+ if para is None:
+ self.para = []
+ else:
+ self.para = para
+ def factory(*args_, **kwargs_):
+ if docListItemType.subclass:
+ return docListItemType.subclass(*args_, **kwargs_)
+ else:
+ return docListItemType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_para(self): return self.para
+ def set_para(self, para): self.para = para
+ def add_para(self, value): self.para.append(value)
+ def insert_para(self, index, value): self.para[index] = value
+ def export(self, outfile, level, namespace_='', name_='docListItemType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docListItemType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='docListItemType'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='docListItemType'):
+ for para_ in self.para:
+ para_.export(outfile, level, namespace_, name_='para')
+ def hasContent_(self):
+ if (
+ self.para is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docListItemType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('para=[\n')
+ level += 1
+ for para in self.para:
+ showIndent(outfile, level)
+ outfile.write('model_.para(\n')
+ para.exportLiteral(outfile, level, name_='para')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'para':
+ obj_ = docParaType.factory()
+ obj_.build(child_)
+ self.para.append(obj_)
+# end class docListItemType
+
+
+class docSimpleSectType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, kind=None, title=None, para=None):
+ self.kind = kind
+ self.title = title
+ if para is None:
+ self.para = []
+ else:
+ self.para = para
+ def factory(*args_, **kwargs_):
+ if docSimpleSectType.subclass:
+ return docSimpleSectType.subclass(*args_, **kwargs_)
+ else:
+ return docSimpleSectType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_title(self): return self.title
+ def set_title(self, title): self.title = title
+ def get_para(self): return self.para
+ def set_para(self, para): self.para = para
+ def add_para(self, value): self.para.append(value)
+ def insert_para(self, index, value): self.para[index] = value
+ def get_kind(self): return self.kind
+ def set_kind(self, kind): self.kind = kind
+ def export(self, outfile, level, namespace_='', name_='docSimpleSectType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docSimpleSectType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='docSimpleSectType'):
+ if self.kind is not None:
+ outfile.write(' kind=%s' % (quote_attrib(self.kind), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='docSimpleSectType'):
+ if self.title:
+ self.title.export(outfile, level, namespace_, name_='title')
+ for para_ in self.para:
+ para_.export(outfile, level, namespace_, name_='para')
+ def hasContent_(self):
+ if (
+ self.title is not None or
+ self.para is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docSimpleSectType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.kind is not None:
+ showIndent(outfile, level)
+ outfile.write('kind = "%s",\n' % (self.kind,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ if self.title:
+ showIndent(outfile, level)
+ outfile.write('title=model_.docTitleType(\n')
+ self.title.exportLiteral(outfile, level, name_='title')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ showIndent(outfile, level)
+ outfile.write('para=[\n')
+ level += 1
+ for para in self.para:
+ showIndent(outfile, level)
+ outfile.write('model_.para(\n')
+ para.exportLiteral(outfile, level, name_='para')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('kind'):
+ self.kind = attrs.get('kind').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'title':
+ obj_ = docTitleType.factory()
+ obj_.build(child_)
+ self.set_title(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'para':
+ obj_ = docParaType.factory()
+ obj_.build(child_)
+ self.para.append(obj_)
+# end class docSimpleSectType
+
+
+class docVarListEntryType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, term=None):
+ self.term = term
+ def factory(*args_, **kwargs_):
+ if docVarListEntryType.subclass:
+ return docVarListEntryType.subclass(*args_, **kwargs_)
+ else:
+ return docVarListEntryType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_term(self): return self.term
+ def set_term(self, term): self.term = term
+ def export(self, outfile, level, namespace_='', name_='docVarListEntryType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docVarListEntryType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='docVarListEntryType'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='docVarListEntryType'):
+ if self.term:
+ self.term.export(outfile, level, namespace_, name_='term', )
+ def hasContent_(self):
+ if (
+ self.term is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docVarListEntryType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ if self.term:
+ showIndent(outfile, level)
+ outfile.write('term=model_.docTitleType(\n')
+ self.term.exportLiteral(outfile, level, name_='term')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'term':
+ obj_ = docTitleType.factory()
+ obj_.build(child_)
+ self.set_term(obj_)
+# end class docVarListEntryType
+
+
+class docVariableListType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, valueOf_=''):
+ self.valueOf_ = valueOf_
+ def factory(*args_, **kwargs_):
+ if docVariableListType.subclass:
+ return docVariableListType.subclass(*args_, **kwargs_)
+ else:
+ return docVariableListType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='docVariableListType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docVariableListType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='docVariableListType'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='docVariableListType'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docVariableListType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class docVariableListType
+
+
+class docRefTextType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, refid=None, kindref=None, external=None, valueOf_='', mixedclass_=None, content_=None):
+ self.refid = refid
+ self.kindref = kindref
+ self.external = external
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if docRefTextType.subclass:
+ return docRefTextType.subclass(*args_, **kwargs_)
+ else:
+ return docRefTextType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_refid(self): return self.refid
+ def set_refid(self, refid): self.refid = refid
+ def get_kindref(self): return self.kindref
+ def set_kindref(self, kindref): self.kindref = kindref
+ def get_external(self): return self.external
+ def set_external(self, external): self.external = external
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='docRefTextType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docRefTextType')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='docRefTextType'):
+ if self.refid is not None:
+ outfile.write(' refid=%s' % (self.format_string(quote_attrib(self.refid).encode(ExternalEncoding), input_name='refid'), ))
+ if self.kindref is not None:
+ outfile.write(' kindref=%s' % (quote_attrib(self.kindref), ))
+ if self.external is not None:
+ outfile.write(' external=%s' % (self.format_string(quote_attrib(self.external).encode(ExternalEncoding), input_name='external'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='docRefTextType'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docRefTextType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.refid is not None:
+ showIndent(outfile, level)
+ outfile.write('refid = %s,\n' % (self.refid,))
+ if self.kindref is not None:
+ showIndent(outfile, level)
+ outfile.write('kindref = "%s",\n' % (self.kindref,))
+ if self.external is not None:
+ showIndent(outfile, level)
+ outfile.write('external = %s,\n' % (self.external,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('refid'):
+ self.refid = attrs.get('refid').value
+ if attrs.get('kindref'):
+ self.kindref = attrs.get('kindref').value
+ if attrs.get('external'):
+ self.external = attrs.get('external').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class docRefTextType
+
+
+class docTableType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, rows=None, cols=None, row=None, caption=None):
+ self.rows = rows
+ self.cols = cols
+ if row is None:
+ self.row = []
+ else:
+ self.row = row
+ self.caption = caption
+ def factory(*args_, **kwargs_):
+ if docTableType.subclass:
+ return docTableType.subclass(*args_, **kwargs_)
+ else:
+ return docTableType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_row(self): return self.row
+ def set_row(self, row): self.row = row
+ def add_row(self, value): self.row.append(value)
+ def insert_row(self, index, value): self.row[index] = value
+ def get_caption(self): return self.caption
+ def set_caption(self, caption): self.caption = caption
+ def get_rows(self): return self.rows
+ def set_rows(self, rows): self.rows = rows
+ def get_cols(self): return self.cols
+ def set_cols(self, cols): self.cols = cols
+ def export(self, outfile, level, namespace_='', name_='docTableType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docTableType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='docTableType'):
+ if self.rows is not None:
+ outfile.write(' rows="%s"' % self.format_integer(self.rows, input_name='rows'))
+ if self.cols is not None:
+ outfile.write(' cols="%s"' % self.format_integer(self.cols, input_name='cols'))
+ def exportChildren(self, outfile, level, namespace_='', name_='docTableType'):
+ for row_ in self.row:
+ row_.export(outfile, level, namespace_, name_='row')
+ if self.caption:
+ self.caption.export(outfile, level, namespace_, name_='caption')
+ def hasContent_(self):
+ if (
+ self.row is not None or
+ self.caption is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docTableType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.rows is not None:
+ showIndent(outfile, level)
+ outfile.write('rows = %s,\n' % (self.rows,))
+ if self.cols is not None:
+ showIndent(outfile, level)
+ outfile.write('cols = %s,\n' % (self.cols,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('row=[\n')
+ level += 1
+ for row in self.row:
+ showIndent(outfile, level)
+ outfile.write('model_.row(\n')
+ row.exportLiteral(outfile, level, name_='row')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ if self.caption:
+ showIndent(outfile, level)
+ outfile.write('caption=model_.docCaptionType(\n')
+ self.caption.exportLiteral(outfile, level, name_='caption')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('rows'):
+ try:
+ self.rows = int(attrs.get('rows').value)
+ except ValueError, exp:
+ raise ValueError('Bad integer attribute (rows): %s' % exp)
+ if attrs.get('cols'):
+ try:
+ self.cols = int(attrs.get('cols').value)
+ except ValueError, exp:
+ raise ValueError('Bad integer attribute (cols): %s' % exp)
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'row':
+ obj_ = docRowType.factory()
+ obj_.build(child_)
+ self.row.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'caption':
+ obj_ = docCaptionType.factory()
+ obj_.build(child_)
+ self.set_caption(obj_)
+# end class docTableType
+
+
+class docRowType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, entry=None):
+ if entry is None:
+ self.entry = []
+ else:
+ self.entry = entry
+ def factory(*args_, **kwargs_):
+ if docRowType.subclass:
+ return docRowType.subclass(*args_, **kwargs_)
+ else:
+ return docRowType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_entry(self): return self.entry
+ def set_entry(self, entry): self.entry = entry
+ def add_entry(self, value): self.entry.append(value)
+ def insert_entry(self, index, value): self.entry[index] = value
+ def export(self, outfile, level, namespace_='', name_='docRowType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docRowType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='docRowType'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='docRowType'):
+ for entry_ in self.entry:
+ entry_.export(outfile, level, namespace_, name_='entry')
+ def hasContent_(self):
+ if (
+ self.entry is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docRowType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('entry=[\n')
+ level += 1
+ for entry in self.entry:
+ showIndent(outfile, level)
+ outfile.write('model_.entry(\n')
+ entry.exportLiteral(outfile, level, name_='entry')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'entry':
+ obj_ = docEntryType.factory()
+ obj_.build(child_)
+ self.entry.append(obj_)
+# end class docRowType
+
+
+class docEntryType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, thead=None, para=None):
+ self.thead = thead
+ if para is None:
+ self.para = []
+ else:
+ self.para = para
+ def factory(*args_, **kwargs_):
+ if docEntryType.subclass:
+ return docEntryType.subclass(*args_, **kwargs_)
+ else:
+ return docEntryType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_para(self): return self.para
+ def set_para(self, para): self.para = para
+ def add_para(self, value): self.para.append(value)
+ def insert_para(self, index, value): self.para[index] = value
+ def get_thead(self): return self.thead
+ def set_thead(self, thead): self.thead = thead
+ def export(self, outfile, level, namespace_='', name_='docEntryType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docEntryType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='docEntryType'):
+ if self.thead is not None:
+ outfile.write(' thead=%s' % (quote_attrib(self.thead), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='docEntryType'):
+ for para_ in self.para:
+ para_.export(outfile, level, namespace_, name_='para')
+ def hasContent_(self):
+ if (
+ self.para is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docEntryType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.thead is not None:
+ showIndent(outfile, level)
+ outfile.write('thead = "%s",\n' % (self.thead,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('para=[\n')
+ level += 1
+ for para in self.para:
+ showIndent(outfile, level)
+ outfile.write('model_.para(\n')
+ para.exportLiteral(outfile, level, name_='para')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('thead'):
+ self.thead = attrs.get('thead').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'para':
+ obj_ = docParaType.factory()
+ obj_.build(child_)
+ self.para.append(obj_)
+# end class docEntryType
+
+
+class docCaptionType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, valueOf_='', mixedclass_=None, content_=None):
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if docCaptionType.subclass:
+ return docCaptionType.subclass(*args_, **kwargs_)
+ else:
+ return docCaptionType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='docCaptionType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docCaptionType')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='docCaptionType'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='docCaptionType'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docCaptionType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class docCaptionType
+
+
+class docHeadingType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, level=None, valueOf_='', mixedclass_=None, content_=None):
+ self.level = level
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if docHeadingType.subclass:
+ return docHeadingType.subclass(*args_, **kwargs_)
+ else:
+ return docHeadingType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_level(self): return self.level
+ def set_level(self, level): self.level = level
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='docHeadingType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docHeadingType')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='docHeadingType'):
+ if self.level is not None:
+ outfile.write(' level="%s"' % self.format_integer(self.level, input_name='level'))
+ def exportChildren(self, outfile, level, namespace_='', name_='docHeadingType'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docHeadingType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.level is not None:
+ showIndent(outfile, level)
+ outfile.write('level = %s,\n' % (self.level,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('level'):
+ try:
+ self.level = int(attrs.get('level').value)
+ except ValueError, exp:
+ raise ValueError('Bad integer attribute (level): %s' % exp)
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class docHeadingType
+
+
+class docImageType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, width=None, type_=None, name=None, height=None, valueOf_='', mixedclass_=None, content_=None):
+ self.width = width
+ self.type_ = type_
+ self.name = name
+ self.height = height
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if docImageType.subclass:
+ return docImageType.subclass(*args_, **kwargs_)
+ else:
+ return docImageType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_width(self): return self.width
+ def set_width(self, width): self.width = width
+ def get_type(self): return self.type_
+ def set_type(self, type_): self.type_ = type_
+ def get_name(self): return self.name
+ def set_name(self, name): self.name = name
+ def get_height(self): return self.height
+ def set_height(self, height): self.height = height
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='docImageType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docImageType')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='docImageType'):
+ if self.width is not None:
+ outfile.write(' width=%s' % (self.format_string(quote_attrib(self.width).encode(ExternalEncoding), input_name='width'), ))
+ if self.type_ is not None:
+ outfile.write(' type=%s' % (quote_attrib(self.type_), ))
+ if self.name is not None:
+ outfile.write(' name=%s' % (self.format_string(quote_attrib(self.name).encode(ExternalEncoding), input_name='name'), ))
+ if self.height is not None:
+ outfile.write(' height=%s' % (self.format_string(quote_attrib(self.height).encode(ExternalEncoding), input_name='height'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='docImageType'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docImageType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.width is not None:
+ showIndent(outfile, level)
+ outfile.write('width = %s,\n' % (self.width,))
+ if self.type_ is not None:
+ showIndent(outfile, level)
+ outfile.write('type_ = "%s",\n' % (self.type_,))
+ if self.name is not None:
+ showIndent(outfile, level)
+ outfile.write('name = %s,\n' % (self.name,))
+ if self.height is not None:
+ showIndent(outfile, level)
+ outfile.write('height = %s,\n' % (self.height,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('width'):
+ self.width = attrs.get('width').value
+ if attrs.get('type'):
+ self.type_ = attrs.get('type').value
+ if attrs.get('name'):
+ self.name = attrs.get('name').value
+ if attrs.get('height'):
+ self.height = attrs.get('height').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class docImageType
+
+
+class docDotFileType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, name=None, valueOf_='', mixedclass_=None, content_=None):
+ self.name = name
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if docDotFileType.subclass:
+ return docDotFileType.subclass(*args_, **kwargs_)
+ else:
+ return docDotFileType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_name(self): return self.name
+ def set_name(self, name): self.name = name
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='docDotFileType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docDotFileType')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='docDotFileType'):
+ if self.name is not None:
+ outfile.write(' name=%s' % (self.format_string(quote_attrib(self.name).encode(ExternalEncoding), input_name='name'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='docDotFileType'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docDotFileType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.name is not None:
+ showIndent(outfile, level)
+ outfile.write('name = %s,\n' % (self.name,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('name'):
+ self.name = attrs.get('name').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class docDotFileType
+
+
+class docTocItemType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, id=None, valueOf_='', mixedclass_=None, content_=None):
+ self.id = id
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if docTocItemType.subclass:
+ return docTocItemType.subclass(*args_, **kwargs_)
+ else:
+ return docTocItemType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_id(self): return self.id
+ def set_id(self, id): self.id = id
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='docTocItemType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docTocItemType')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='docTocItemType'):
+ if self.id is not None:
+ outfile.write(' id=%s' % (self.format_string(quote_attrib(self.id).encode(ExternalEncoding), input_name='id'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='docTocItemType'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docTocItemType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.id is not None:
+ showIndent(outfile, level)
+ outfile.write('id = %s,\n' % (self.id,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('id'):
+ self.id = attrs.get('id').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class docTocItemType
+
+
+class docTocListType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, tocitem=None):
+ if tocitem is None:
+ self.tocitem = []
+ else:
+ self.tocitem = tocitem
+ def factory(*args_, **kwargs_):
+ if docTocListType.subclass:
+ return docTocListType.subclass(*args_, **kwargs_)
+ else:
+ return docTocListType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_tocitem(self): return self.tocitem
+ def set_tocitem(self, tocitem): self.tocitem = tocitem
+ def add_tocitem(self, value): self.tocitem.append(value)
+ def insert_tocitem(self, index, value): self.tocitem[index] = value
+ def export(self, outfile, level, namespace_='', name_='docTocListType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docTocListType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='docTocListType'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='docTocListType'):
+ for tocitem_ in self.tocitem:
+ tocitem_.export(outfile, level, namespace_, name_='tocitem')
+ def hasContent_(self):
+ if (
+ self.tocitem is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docTocListType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('tocitem=[\n')
+ level += 1
+ for tocitem in self.tocitem:
+ showIndent(outfile, level)
+ outfile.write('model_.tocitem(\n')
+ tocitem.exportLiteral(outfile, level, name_='tocitem')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'tocitem':
+ obj_ = docTocItemType.factory()
+ obj_.build(child_)
+ self.tocitem.append(obj_)
+# end class docTocListType
+
+
+class docLanguageType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, langid=None, para=None):
+ self.langid = langid
+ if para is None:
+ self.para = []
+ else:
+ self.para = para
+ def factory(*args_, **kwargs_):
+ if docLanguageType.subclass:
+ return docLanguageType.subclass(*args_, **kwargs_)
+ else:
+ return docLanguageType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_para(self): return self.para
+ def set_para(self, para): self.para = para
+ def add_para(self, value): self.para.append(value)
+ def insert_para(self, index, value): self.para[index] = value
+ def get_langid(self): return self.langid
+ def set_langid(self, langid): self.langid = langid
+ def export(self, outfile, level, namespace_='', name_='docLanguageType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docLanguageType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='docLanguageType'):
+ if self.langid is not None:
+ outfile.write(' langid=%s' % (self.format_string(quote_attrib(self.langid).encode(ExternalEncoding), input_name='langid'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='docLanguageType'):
+ for para_ in self.para:
+ para_.export(outfile, level, namespace_, name_='para')
+ def hasContent_(self):
+ if (
+ self.para is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docLanguageType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.langid is not None:
+ showIndent(outfile, level)
+ outfile.write('langid = %s,\n' % (self.langid,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('para=[\n')
+ level += 1
+ for para in self.para:
+ showIndent(outfile, level)
+ outfile.write('model_.para(\n')
+ para.exportLiteral(outfile, level, name_='para')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('langid'):
+ self.langid = attrs.get('langid').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'para':
+ obj_ = docParaType.factory()
+ obj_.build(child_)
+ self.para.append(obj_)
+# end class docLanguageType
+
+
+class docParamListType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, kind=None, parameteritem=None):
+ self.kind = kind
+ if parameteritem is None:
+ self.parameteritem = []
+ else:
+ self.parameteritem = parameteritem
+ def factory(*args_, **kwargs_):
+ if docParamListType.subclass:
+ return docParamListType.subclass(*args_, **kwargs_)
+ else:
+ return docParamListType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_parameteritem(self): return self.parameteritem
+ def set_parameteritem(self, parameteritem): self.parameteritem = parameteritem
+ def add_parameteritem(self, value): self.parameteritem.append(value)
+ def insert_parameteritem(self, index, value): self.parameteritem[index] = value
+ def get_kind(self): return self.kind
+ def set_kind(self, kind): self.kind = kind
+ def export(self, outfile, level, namespace_='', name_='docParamListType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docParamListType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='docParamListType'):
+ if self.kind is not None:
+ outfile.write(' kind=%s' % (quote_attrib(self.kind), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='docParamListType'):
+ for parameteritem_ in self.parameteritem:
+ parameteritem_.export(outfile, level, namespace_, name_='parameteritem')
+ def hasContent_(self):
+ if (
+ self.parameteritem is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docParamListType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.kind is not None:
+ showIndent(outfile, level)
+ outfile.write('kind = "%s",\n' % (self.kind,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('parameteritem=[\n')
+ level += 1
+ for parameteritem in self.parameteritem:
+ showIndent(outfile, level)
+ outfile.write('model_.parameteritem(\n')
+ parameteritem.exportLiteral(outfile, level, name_='parameteritem')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('kind'):
+ self.kind = attrs.get('kind').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'parameteritem':
+ obj_ = docParamListItem.factory()
+ obj_.build(child_)
+ self.parameteritem.append(obj_)
+# end class docParamListType
+
+
+class docParamListItem(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, parameternamelist=None, parameterdescription=None):
+ if parameternamelist is None:
+ self.parameternamelist = []
+ else:
+ self.parameternamelist = parameternamelist
+ self.parameterdescription = parameterdescription
+ def factory(*args_, **kwargs_):
+ if docParamListItem.subclass:
+ return docParamListItem.subclass(*args_, **kwargs_)
+ else:
+ return docParamListItem(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_parameternamelist(self): return self.parameternamelist
+ def set_parameternamelist(self, parameternamelist): self.parameternamelist = parameternamelist
+ def add_parameternamelist(self, value): self.parameternamelist.append(value)
+ def insert_parameternamelist(self, index, value): self.parameternamelist[index] = value
+ def get_parameterdescription(self): return self.parameterdescription
+ def set_parameterdescription(self, parameterdescription): self.parameterdescription = parameterdescription
+ def export(self, outfile, level, namespace_='', name_='docParamListItem', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docParamListItem')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='docParamListItem'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='docParamListItem'):
+ for parameternamelist_ in self.parameternamelist:
+ parameternamelist_.export(outfile, level, namespace_, name_='parameternamelist')
+ if self.parameterdescription:
+ self.parameterdescription.export(outfile, level, namespace_, name_='parameterdescription', )
+ def hasContent_(self):
+ if (
+ self.parameternamelist is not None or
+ self.parameterdescription is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docParamListItem'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('parameternamelist=[\n')
+ level += 1
+ for parameternamelist in self.parameternamelist:
+ showIndent(outfile, level)
+ outfile.write('model_.parameternamelist(\n')
+ parameternamelist.exportLiteral(outfile, level, name_='parameternamelist')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ if self.parameterdescription:
+ showIndent(outfile, level)
+ outfile.write('parameterdescription=model_.descriptionType(\n')
+ self.parameterdescription.exportLiteral(outfile, level, name_='parameterdescription')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'parameternamelist':
+ obj_ = docParamNameList.factory()
+ obj_.build(child_)
+ self.parameternamelist.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'parameterdescription':
+ obj_ = descriptionType.factory()
+ obj_.build(child_)
+ self.set_parameterdescription(obj_)
+# end class docParamListItem
+
+
+class docParamNameList(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, parametername=None):
+ if parametername is None:
+ self.parametername = []
+ else:
+ self.parametername = parametername
+ def factory(*args_, **kwargs_):
+ if docParamNameList.subclass:
+ return docParamNameList.subclass(*args_, **kwargs_)
+ else:
+ return docParamNameList(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_parametername(self): return self.parametername
+ def set_parametername(self, parametername): self.parametername = parametername
+ def add_parametername(self, value): self.parametername.append(value)
+ def insert_parametername(self, index, value): self.parametername[index] = value
+ def export(self, outfile, level, namespace_='', name_='docParamNameList', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docParamNameList')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='docParamNameList'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='docParamNameList'):
+ for parametername_ in self.parametername:
+ parametername_.export(outfile, level, namespace_, name_='parametername')
+ def hasContent_(self):
+ if (
+ self.parametername is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docParamNameList'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('parametername=[\n')
+ level += 1
+ for parametername in self.parametername:
+ showIndent(outfile, level)
+ outfile.write('model_.parametername(\n')
+ parametername.exportLiteral(outfile, level, name_='parametername')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'parametername':
+ obj_ = docParamName.factory()
+ obj_.build(child_)
+ self.parametername.append(obj_)
+# end class docParamNameList
+
+
+class docParamName(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, direction=None, ref=None, mixedclass_=None, content_=None):
+ self.direction = direction
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if docParamName.subclass:
+ return docParamName.subclass(*args_, **kwargs_)
+ else:
+ return docParamName(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_ref(self): return self.ref
+ def set_ref(self, ref): self.ref = ref
+ def get_direction(self): return self.direction
+ def set_direction(self, direction): self.direction = direction
+ def export(self, outfile, level, namespace_='', name_='docParamName', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docParamName')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='docParamName'):
+ if self.direction is not None:
+ outfile.write(' direction=%s' % (quote_attrib(self.direction), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='docParamName'):
+ for item_ in self.content_:
+ item_.export(outfile, level, item_.name, namespace_)
+ def hasContent_(self):
+ if (
+ self.ref is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docParamName'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.direction is not None:
+ showIndent(outfile, level)
+ outfile.write('direction = "%s",\n' % (self.direction,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('direction'):
+ self.direction = attrs.get('direction').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'ref':
+ childobj_ = docRefTextType.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'ref', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+# end class docParamName
+
+
+class docXRefSectType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, id=None, xreftitle=None, xrefdescription=None):
+ self.id = id
+ if xreftitle is None:
+ self.xreftitle = []
+ else:
+ self.xreftitle = xreftitle
+ self.xrefdescription = xrefdescription
+ def factory(*args_, **kwargs_):
+ if docXRefSectType.subclass:
+ return docXRefSectType.subclass(*args_, **kwargs_)
+ else:
+ return docXRefSectType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_xreftitle(self): return self.xreftitle
+ def set_xreftitle(self, xreftitle): self.xreftitle = xreftitle
+ def add_xreftitle(self, value): self.xreftitle.append(value)
+ def insert_xreftitle(self, index, value): self.xreftitle[index] = value
+ def get_xrefdescription(self): return self.xrefdescription
+ def set_xrefdescription(self, xrefdescription): self.xrefdescription = xrefdescription
+ def get_id(self): return self.id
+ def set_id(self, id): self.id = id
+ def export(self, outfile, level, namespace_='', name_='docXRefSectType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docXRefSectType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='docXRefSectType'):
+ if self.id is not None:
+ outfile.write(' id=%s' % (self.format_string(quote_attrib(self.id).encode(ExternalEncoding), input_name='id'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='docXRefSectType'):
+ for xreftitle_ in self.xreftitle:
+ showIndent(outfile, level)
+ outfile.write('<%sxreftitle>%s</%sxreftitle>\n' % (namespace_, self.format_string(quote_xml(xreftitle_).encode(ExternalEncoding), input_name='xreftitle'), namespace_))
+ if self.xrefdescription:
+ self.xrefdescription.export(outfile, level, namespace_, name_='xrefdescription', )
+ def hasContent_(self):
+ if (
+ self.xreftitle is not None or
+ self.xrefdescription is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docXRefSectType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.id is not None:
+ showIndent(outfile, level)
+ outfile.write('id = %s,\n' % (self.id,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('xreftitle=[\n')
+ level += 1
+ for xreftitle in self.xreftitle:
+ showIndent(outfile, level)
+ outfile.write('%s,\n' % quote_python(xreftitle).encode(ExternalEncoding))
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ if self.xrefdescription:
+ showIndent(outfile, level)
+ outfile.write('xrefdescription=model_.descriptionType(\n')
+ self.xrefdescription.exportLiteral(outfile, level, name_='xrefdescription')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('id'):
+ self.id = attrs.get('id').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'xreftitle':
+ xreftitle_ = ''
+ for text__content_ in child_.childNodes:
+ xreftitle_ += text__content_.nodeValue
+ self.xreftitle.append(xreftitle_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'xrefdescription':
+ obj_ = descriptionType.factory()
+ obj_.build(child_)
+ self.set_xrefdescription(obj_)
+# end class docXRefSectType
+
+
+class docCopyType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, link=None, para=None, sect1=None, internal=None):
+ self.link = link
+ if para is None:
+ self.para = []
+ else:
+ self.para = para
+ if sect1 is None:
+ self.sect1 = []
+ else:
+ self.sect1 = sect1
+ self.internal = internal
+ def factory(*args_, **kwargs_):
+ if docCopyType.subclass:
+ return docCopyType.subclass(*args_, **kwargs_)
+ else:
+ return docCopyType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_para(self): return self.para
+ def set_para(self, para): self.para = para
+ def add_para(self, value): self.para.append(value)
+ def insert_para(self, index, value): self.para[index] = value
+ def get_sect1(self): return self.sect1
+ def set_sect1(self, sect1): self.sect1 = sect1
+ def add_sect1(self, value): self.sect1.append(value)
+ def insert_sect1(self, index, value): self.sect1[index] = value
+ def get_internal(self): return self.internal
+ def set_internal(self, internal): self.internal = internal
+ def get_link(self): return self.link
+ def set_link(self, link): self.link = link
+ def export(self, outfile, level, namespace_='', name_='docCopyType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docCopyType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='docCopyType'):
+ if self.link is not None:
+ outfile.write(' link=%s' % (self.format_string(quote_attrib(self.link).encode(ExternalEncoding), input_name='link'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='docCopyType'):
+ for para_ in self.para:
+ para_.export(outfile, level, namespace_, name_='para')
+ for sect1_ in self.sect1:
+ sect1_.export(outfile, level, namespace_, name_='sect1')
+ if self.internal:
+ self.internal.export(outfile, level, namespace_, name_='internal')
+ def hasContent_(self):
+ if (
+ self.para is not None or
+ self.sect1 is not None or
+ self.internal is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docCopyType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.link is not None:
+ showIndent(outfile, level)
+ outfile.write('link = %s,\n' % (self.link,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('para=[\n')
+ level += 1
+ for para in self.para:
+ showIndent(outfile, level)
+ outfile.write('model_.para(\n')
+ para.exportLiteral(outfile, level, name_='para')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('sect1=[\n')
+ level += 1
+ for sect1 in self.sect1:
+ showIndent(outfile, level)
+ outfile.write('model_.sect1(\n')
+ sect1.exportLiteral(outfile, level, name_='sect1')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ if self.internal:
+ showIndent(outfile, level)
+ outfile.write('internal=model_.docInternalType(\n')
+ self.internal.exportLiteral(outfile, level, name_='internal')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('link'):
+ self.link = attrs.get('link').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'para':
+ obj_ = docParaType.factory()
+ obj_.build(child_)
+ self.para.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'sect1':
+ obj_ = docSect1Type.factory()
+ obj_.build(child_)
+ self.sect1.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'internal':
+ obj_ = docInternalType.factory()
+ obj_.build(child_)
+ self.set_internal(obj_)
+# end class docCopyType
+
+
+class docCharType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, char=None, valueOf_=''):
+ self.char = char
+ self.valueOf_ = valueOf_
+ def factory(*args_, **kwargs_):
+ if docCharType.subclass:
+ return docCharType.subclass(*args_, **kwargs_)
+ else:
+ return docCharType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_char(self): return self.char
+ def set_char(self, char): self.char = char
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='docCharType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docCharType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='docCharType'):
+ if self.char is not None:
+ outfile.write(' char=%s' % (quote_attrib(self.char), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='docCharType'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docCharType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.char is not None:
+ showIndent(outfile, level)
+ outfile.write('char = "%s",\n' % (self.char,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('char'):
+ self.char = attrs.get('char').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class docCharType
+
+
+class docEmptyType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, valueOf_=''):
+ self.valueOf_ = valueOf_
+ def factory(*args_, **kwargs_):
+ if docEmptyType.subclass:
+ return docEmptyType.subclass(*args_, **kwargs_)
+ else:
+ return docEmptyType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='docEmptyType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docEmptyType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='docEmptyType'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='docEmptyType'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docEmptyType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class docEmptyType
+
+
+USAGE_TEXT = """
+Usage: python <Parser>.py [ -s ] <in_xml_file>
+Options:
+ -s Use the SAX parser, not the minidom parser.
+"""
+
+def usage():
+ print USAGE_TEXT
+ sys.exit(1)
+
+
+def parse(inFileName):
+ doc = minidom.parse(inFileName)
+ rootNode = doc.documentElement
+ rootObj = DoxygenType.factory()
+ rootObj.build(rootNode)
+ # Enable Python to collect the space used by the DOM.
+ doc = None
+ sys.stdout.write('<?xml version="1.0" ?>\n')
+ rootObj.export(sys.stdout, 0, name_="doxygen",
+ namespacedef_='')
+ return rootObj
+
+
+def parseString(inString):
+ doc = minidom.parseString(inString)
+ rootNode = doc.documentElement
+ rootObj = DoxygenType.factory()
+ rootObj.build(rootNode)
+ # Enable Python to collect the space used by the DOM.
+ doc = None
+ sys.stdout.write('<?xml version="1.0" ?>\n')
+ rootObj.export(sys.stdout, 0, name_="doxygen",
+ namespacedef_='')
+ return rootObj
+
+
+def parseLiteral(inFileName):
+ doc = minidom.parse(inFileName)
+ rootNode = doc.documentElement
+ rootObj = DoxygenType.factory()
+ rootObj.build(rootNode)
+ # Enable Python to collect the space used by the DOM.
+ doc = None
+ sys.stdout.write('from compound import *\n\n')
+ sys.stdout.write('rootObj = doxygen(\n')
+ rootObj.exportLiteral(sys.stdout, 0, name_="doxygen")
+ sys.stdout.write(')\n')
+ return rootObj
+
+
+def main():
+ args = sys.argv[1:]
+ if len(args) == 1:
+ parse(args[0])
+ else:
+ usage()
+
+
+if __name__ == '__main__':
+ main()
+ #import pdb
+ #pdb.run('main()')
+
diff --git a/gr-howto-write-a-block/docs/doxygen/doxyxml/generated/index.py b/gr-howto-write-a-block/docs/doxygen/doxyxml/generated/index.py
new file mode 100644
index 000000000..7a70e14a1
--- /dev/null
+++ b/gr-howto-write-a-block/docs/doxygen/doxyxml/generated/index.py
@@ -0,0 +1,77 @@
+#!/usr/bin/env python
+
+"""
+Generated Mon Feb 9 19:08:05 2009 by generateDS.py.
+"""
+
+from xml.dom import minidom
+
+import os
+import sys
+import compound
+
+import indexsuper as supermod
+
+class DoxygenTypeSub(supermod.DoxygenType):
+ def __init__(self, version=None, compound=None):
+ supermod.DoxygenType.__init__(self, version, compound)
+
+ def find_compounds_and_members(self, details):
+ """
+ Returns a list of all compounds and their members which match details
+ """
+
+ results = []
+ for compound in self.compound:
+ members = compound.find_members(details)
+ if members:
+ results.append([compound, members])
+ else:
+ if details.match(compound):
+ results.append([compound, []])
+
+ return results
+
+supermod.DoxygenType.subclass = DoxygenTypeSub
+# end class DoxygenTypeSub
+
+
+class CompoundTypeSub(supermod.CompoundType):
+ def __init__(self, kind=None, refid=None, name='', member=None):
+ supermod.CompoundType.__init__(self, kind, refid, name, member)
+
+ def find_members(self, details):
+ """
+ Returns a list of all members which match details
+ """
+
+ results = []
+
+ for member in self.member:
+ if details.match(member):
+ results.append(member)
+
+ return results
+
+supermod.CompoundType.subclass = CompoundTypeSub
+# end class CompoundTypeSub
+
+
+class MemberTypeSub(supermod.MemberType):
+
+ def __init__(self, kind=None, refid=None, name=''):
+ supermod.MemberType.__init__(self, kind, refid, name)
+
+supermod.MemberType.subclass = MemberTypeSub
+# end class MemberTypeSub
+
+
+def parse(inFilename):
+
+ doc = minidom.parse(inFilename)
+ rootNode = doc.documentElement
+ rootObj = supermod.DoxygenType.factory()
+ rootObj.build(rootNode)
+
+ return rootObj
+
diff --git a/gr-howto-write-a-block/docs/doxygen/doxyxml/generated/indexsuper.py b/gr-howto-write-a-block/docs/doxygen/doxyxml/generated/indexsuper.py
new file mode 100644
index 000000000..a99153019
--- /dev/null
+++ b/gr-howto-write-a-block/docs/doxygen/doxyxml/generated/indexsuper.py
@@ -0,0 +1,523 @@
+#!/usr/bin/env python
+
+#
+# Generated Thu Jun 11 18:43:54 2009 by generateDS.py.
+#
+
+import sys
+import getopt
+from string import lower as str_lower
+from xml.dom import minidom
+from xml.dom import Node
+
+#
+# User methods
+#
+# Calls to the methods in these classes are generated by generateDS.py.
+# You can replace these methods by re-implementing the following class
+# in a module named generatedssuper.py.
+
+try:
+ from generatedssuper import GeneratedsSuper
+except ImportError, exp:
+
+ class GeneratedsSuper:
+ def format_string(self, input_data, input_name=''):
+ return input_data
+ def format_integer(self, input_data, input_name=''):
+ return '%d' % input_data
+ def format_float(self, input_data, input_name=''):
+ return '%f' % input_data
+ def format_double(self, input_data, input_name=''):
+ return '%e' % input_data
+ def format_boolean(self, input_data, input_name=''):
+ return '%s' % input_data
+
+
+#
+# If you have installed IPython you can uncomment and use the following.
+# IPython is available from http://ipython.scipy.org/.
+#
+
+## from IPython.Shell import IPShellEmbed
+## args = ''
+## ipshell = IPShellEmbed(args,
+## banner = 'Dropping into IPython',
+## exit_msg = 'Leaving Interpreter, back to program.')
+
+# Then use the following line where and when you want to drop into the
+# IPython shell:
+# ipshell('<some message> -- Entering ipshell.\nHit Ctrl-D to exit')
+
+#
+# Globals
+#
+
+ExternalEncoding = 'ascii'
+
+#
+# Support/utility functions.
+#
+
+def showIndent(outfile, level):
+ for idx in range(level):
+ outfile.write(' ')
+
+def quote_xml(inStr):
+ s1 = (isinstance(inStr, basestring) and inStr or
+ '%s' % inStr)
+ s1 = s1.replace('&', '&amp;')
+ s1 = s1.replace('<', '&lt;')
+ s1 = s1.replace('>', '&gt;')
+ return s1
+
+def quote_attrib(inStr):
+ s1 = (isinstance(inStr, basestring) and inStr or
+ '%s' % inStr)
+ s1 = s1.replace('&', '&amp;')
+ s1 = s1.replace('<', '&lt;')
+ s1 = s1.replace('>', '&gt;')
+ if '"' in s1:
+ if "'" in s1:
+ s1 = '"%s"' % s1.replace('"', "&quot;")
+ else:
+ s1 = "'%s'" % s1
+ else:
+ s1 = '"%s"' % s1
+ return s1
+
+def quote_python(inStr):
+ s1 = inStr
+ if s1.find("'") == -1:
+ if s1.find('\n') == -1:
+ return "'%s'" % s1
+ else:
+ return "'''%s'''" % s1
+ else:
+ if s1.find('"') != -1:
+ s1 = s1.replace('"', '\\"')
+ if s1.find('\n') == -1:
+ return '"%s"' % s1
+ else:
+ return '"""%s"""' % s1
+
+
+class MixedContainer:
+ # Constants for category:
+ CategoryNone = 0
+ CategoryText = 1
+ CategorySimple = 2
+ CategoryComplex = 3
+ # Constants for content_type:
+ TypeNone = 0
+ TypeText = 1
+ TypeString = 2
+ TypeInteger = 3
+ TypeFloat = 4
+ TypeDecimal = 5
+ TypeDouble = 6
+ TypeBoolean = 7
+ def __init__(self, category, content_type, name, value):
+ self.category = category
+ self.content_type = content_type
+ self.name = name
+ self.value = value
+ def getCategory(self):
+ return self.category
+ def getContenttype(self, content_type):
+ return self.content_type
+ def getValue(self):
+ return self.value
+ def getName(self):
+ return self.name
+ def export(self, outfile, level, name, namespace):
+ if self.category == MixedContainer.CategoryText:
+ outfile.write(self.value)
+ elif self.category == MixedContainer.CategorySimple:
+ self.exportSimple(outfile, level, name)
+ else: # category == MixedContainer.CategoryComplex
+ self.value.export(outfile, level, namespace,name)
+ def exportSimple(self, outfile, level, name):
+ if self.content_type == MixedContainer.TypeString:
+ outfile.write('<%s>%s</%s>' % (self.name, self.value, self.name))
+ elif self.content_type == MixedContainer.TypeInteger or \
+ self.content_type == MixedContainer.TypeBoolean:
+ outfile.write('<%s>%d</%s>' % (self.name, self.value, self.name))
+ elif self.content_type == MixedContainer.TypeFloat or \
+ self.content_type == MixedContainer.TypeDecimal:
+ outfile.write('<%s>%f</%s>' % (self.name, self.value, self.name))
+ elif self.content_type == MixedContainer.TypeDouble:
+ outfile.write('<%s>%g</%s>' % (self.name, self.value, self.name))
+ def exportLiteral(self, outfile, level, name):
+ if self.category == MixedContainer.CategoryText:
+ showIndent(outfile, level)
+ outfile.write('MixedContainer(%d, %d, "%s", "%s"),\n' % \
+ (self.category, self.content_type, self.name, self.value))
+ elif self.category == MixedContainer.CategorySimple:
+ showIndent(outfile, level)
+ outfile.write('MixedContainer(%d, %d, "%s", "%s"),\n' % \
+ (self.category, self.content_type, self.name, self.value))
+ else: # category == MixedContainer.CategoryComplex
+ showIndent(outfile, level)
+ outfile.write('MixedContainer(%d, %d, "%s",\n' % \
+ (self.category, self.content_type, self.name,))
+ self.value.exportLiteral(outfile, level + 1)
+ showIndent(outfile, level)
+ outfile.write(')\n')
+
+
+class _MemberSpec(object):
+ def __init__(self, name='', data_type='', container=0):
+ self.name = name
+ self.data_type = data_type
+ self.container = container
+ def set_name(self, name): self.name = name
+ def get_name(self): return self.name
+ def set_data_type(self, data_type): self.data_type = data_type
+ def get_data_type(self): return self.data_type
+ def set_container(self, container): self.container = container
+ def get_container(self): return self.container
+
+
+#
+# Data representation classes.
+#
+
+class DoxygenType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, version=None, compound=None):
+ self.version = version
+ if compound is None:
+ self.compound = []
+ else:
+ self.compound = compound
+ def factory(*args_, **kwargs_):
+ if DoxygenType.subclass:
+ return DoxygenType.subclass(*args_, **kwargs_)
+ else:
+ return DoxygenType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_compound(self): return self.compound
+ def set_compound(self, compound): self.compound = compound
+ def add_compound(self, value): self.compound.append(value)
+ def insert_compound(self, index, value): self.compound[index] = value
+ def get_version(self): return self.version
+ def set_version(self, version): self.version = version
+ def export(self, outfile, level, namespace_='', name_='DoxygenType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='DoxygenType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='DoxygenType'):
+ outfile.write(' version=%s' % (self.format_string(quote_attrib(self.version).encode(ExternalEncoding), input_name='version'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='DoxygenType'):
+ for compound_ in self.compound:
+ compound_.export(outfile, level, namespace_, name_='compound')
+ def hasContent_(self):
+ if (
+ self.compound is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='DoxygenType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.version is not None:
+ showIndent(outfile, level)
+ outfile.write('version = %s,\n' % (self.version,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('compound=[\n')
+ level += 1
+ for compound in self.compound:
+ showIndent(outfile, level)
+ outfile.write('model_.compound(\n')
+ compound.exportLiteral(outfile, level, name_='compound')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('version'):
+ self.version = attrs.get('version').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'compound':
+ obj_ = CompoundType.factory()
+ obj_.build(child_)
+ self.compound.append(obj_)
+# end class DoxygenType
+
+
+class CompoundType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, kind=None, refid=None, name=None, member=None):
+ self.kind = kind
+ self.refid = refid
+ self.name = name
+ if member is None:
+ self.member = []
+ else:
+ self.member = member
+ def factory(*args_, **kwargs_):
+ if CompoundType.subclass:
+ return CompoundType.subclass(*args_, **kwargs_)
+ else:
+ return CompoundType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_name(self): return self.name
+ def set_name(self, name): self.name = name
+ def get_member(self): return self.member
+ def set_member(self, member): self.member = member
+ def add_member(self, value): self.member.append(value)
+ def insert_member(self, index, value): self.member[index] = value
+ def get_kind(self): return self.kind
+ def set_kind(self, kind): self.kind = kind
+ def get_refid(self): return self.refid
+ def set_refid(self, refid): self.refid = refid
+ def export(self, outfile, level, namespace_='', name_='CompoundType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='CompoundType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='CompoundType'):
+ outfile.write(' kind=%s' % (quote_attrib(self.kind), ))
+ outfile.write(' refid=%s' % (self.format_string(quote_attrib(self.refid).encode(ExternalEncoding), input_name='refid'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='CompoundType'):
+ if self.name is not None:
+ showIndent(outfile, level)
+ outfile.write('<%sname>%s</%sname>\n' % (namespace_, self.format_string(quote_xml(self.name).encode(ExternalEncoding), input_name='name'), namespace_))
+ for member_ in self.member:
+ member_.export(outfile, level, namespace_, name_='member')
+ def hasContent_(self):
+ if (
+ self.name is not None or
+ self.member is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='CompoundType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.kind is not None:
+ showIndent(outfile, level)
+ outfile.write('kind = "%s",\n' % (self.kind,))
+ if self.refid is not None:
+ showIndent(outfile, level)
+ outfile.write('refid = %s,\n' % (self.refid,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('name=%s,\n' % quote_python(self.name).encode(ExternalEncoding))
+ showIndent(outfile, level)
+ outfile.write('member=[\n')
+ level += 1
+ for member in self.member:
+ showIndent(outfile, level)
+ outfile.write('model_.member(\n')
+ member.exportLiteral(outfile, level, name_='member')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('kind'):
+ self.kind = attrs.get('kind').value
+ if attrs.get('refid'):
+ self.refid = attrs.get('refid').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'name':
+ name_ = ''
+ for text__content_ in child_.childNodes:
+ name_ += text__content_.nodeValue
+ self.name = name_
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'member':
+ obj_ = MemberType.factory()
+ obj_.build(child_)
+ self.member.append(obj_)
+# end class CompoundType
+
+
+class MemberType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, kind=None, refid=None, name=None):
+ self.kind = kind
+ self.refid = refid
+ self.name = name
+ def factory(*args_, **kwargs_):
+ if MemberType.subclass:
+ return MemberType.subclass(*args_, **kwargs_)
+ else:
+ return MemberType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_name(self): return self.name
+ def set_name(self, name): self.name = name
+ def get_kind(self): return self.kind
+ def set_kind(self, kind): self.kind = kind
+ def get_refid(self): return self.refid
+ def set_refid(self, refid): self.refid = refid
+ def export(self, outfile, level, namespace_='', name_='MemberType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='MemberType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='MemberType'):
+ outfile.write(' kind=%s' % (quote_attrib(self.kind), ))
+ outfile.write(' refid=%s' % (self.format_string(quote_attrib(self.refid).encode(ExternalEncoding), input_name='refid'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='MemberType'):
+ if self.name is not None:
+ showIndent(outfile, level)
+ outfile.write('<%sname>%s</%sname>\n' % (namespace_, self.format_string(quote_xml(self.name).encode(ExternalEncoding), input_name='name'), namespace_))
+ def hasContent_(self):
+ if (
+ self.name is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='MemberType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.kind is not None:
+ showIndent(outfile, level)
+ outfile.write('kind = "%s",\n' % (self.kind,))
+ if self.refid is not None:
+ showIndent(outfile, level)
+ outfile.write('refid = %s,\n' % (self.refid,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('name=%s,\n' % quote_python(self.name).encode(ExternalEncoding))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('kind'):
+ self.kind = attrs.get('kind').value
+ if attrs.get('refid'):
+ self.refid = attrs.get('refid').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'name':
+ name_ = ''
+ for text__content_ in child_.childNodes:
+ name_ += text__content_.nodeValue
+ self.name = name_
+# end class MemberType
+
+
+USAGE_TEXT = """
+Usage: python <Parser>.py [ -s ] <in_xml_file>
+Options:
+ -s Use the SAX parser, not the minidom parser.
+"""
+
+def usage():
+ print USAGE_TEXT
+ sys.exit(1)
+
+
+def parse(inFileName):
+ doc = minidom.parse(inFileName)
+ rootNode = doc.documentElement
+ rootObj = DoxygenType.factory()
+ rootObj.build(rootNode)
+ # Enable Python to collect the space used by the DOM.
+ doc = None
+ sys.stdout.write('<?xml version="1.0" ?>\n')
+ rootObj.export(sys.stdout, 0, name_="doxygenindex",
+ namespacedef_='')
+ return rootObj
+
+
+def parseString(inString):
+ doc = minidom.parseString(inString)
+ rootNode = doc.documentElement
+ rootObj = DoxygenType.factory()
+ rootObj.build(rootNode)
+ # Enable Python to collect the space used by the DOM.
+ doc = None
+ sys.stdout.write('<?xml version="1.0" ?>\n')
+ rootObj.export(sys.stdout, 0, name_="doxygenindex",
+ namespacedef_='')
+ return rootObj
+
+
+def parseLiteral(inFileName):
+ doc = minidom.parse(inFileName)
+ rootNode = doc.documentElement
+ rootObj = DoxygenType.factory()
+ rootObj.build(rootNode)
+ # Enable Python to collect the space used by the DOM.
+ doc = None
+ sys.stdout.write('from index import *\n\n')
+ sys.stdout.write('rootObj = doxygenindex(\n')
+ rootObj.exportLiteral(sys.stdout, 0, name_="doxygenindex")
+ sys.stdout.write(')\n')
+ return rootObj
+
+
+def main():
+ args = sys.argv[1:]
+ if len(args) == 1:
+ parse(args[0])
+ else:
+ usage()
+
+
+
+
+if __name__ == '__main__':
+ main()
+ #import pdb
+ #pdb.run('main()')
+
diff --git a/gr-howto-write-a-block/docs/doxygen/doxyxml/text.py b/gr-howto-write-a-block/docs/doxygen/doxyxml/text.py
new file mode 100644
index 000000000..629edd180
--- /dev/null
+++ b/gr-howto-write-a-block/docs/doxygen/doxyxml/text.py
@@ -0,0 +1,56 @@
+#
+# Copyright 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.
+#
+"""
+Utilities for extracting text from generated classes.
+"""
+
+def is_string(txt):
+ if isinstance(txt, str):
+ return True
+ try:
+ if isinstance(txt, unicode):
+ return True
+ except NameError:
+ pass
+ return False
+
+def description(obj):
+ if obj is None:
+ return None
+ return description_bit(obj).strip()
+
+def description_bit(obj):
+ if hasattr(obj, 'content'):
+ contents = [description_bit(item) for item in obj.content]
+ result = ''.join(contents)
+ elif hasattr(obj, 'content_'):
+ contents = [description_bit(item) for item in obj.content_]
+ result = ''.join(contents)
+ elif hasattr(obj, 'value'):
+ result = description_bit(obj.value)
+ elif is_string(obj):
+ return obj
+ else:
+ raise StandardError('Expecting a string or something with content, content_ or value attribute')
+ # If this bit is a paragraph then add one some line breaks.
+ if hasattr(obj, 'name') and obj.name == 'para':
+ result += "\n\n"
+ return result
diff --git a/gr-howto-write-a-block/docs/doxygen/other/group_defs.dox b/gr-howto-write-a-block/docs/doxygen/other/group_defs.dox
new file mode 100644
index 000000000..708f8c6d9
--- /dev/null
+++ b/gr-howto-write-a-block/docs/doxygen/other/group_defs.dox
@@ -0,0 +1,7 @@
+/*!
+ * \defgroup block GNU Radio HOWTO C++ Signal Processing Blocks
+ * \brief All C++ blocks that can be used from the HOWTO GNU Radio
+ * module are listed here or in the subcategories below.
+ *
+ */
+
diff --git a/gr-howto-write-a-block/docs/doxygen/other/main_page.dox b/gr-howto-write-a-block/docs/doxygen/other/main_page.dox
new file mode 100644
index 000000000..635704491
--- /dev/null
+++ b/gr-howto-write-a-block/docs/doxygen/other/main_page.dox
@@ -0,0 +1,10 @@
+/*! \mainpage
+
+Welcome to the GNU Radio HOWTO Block
+
+This is the intro page for the Doxygen manual generated for the HOWTO
+block (docs/doxygen/other/main_page.dox). Edit it to add more detailed
+documentation about the new GNU Radio modules contained in this
+project.
+
+*/
diff --git a/gr-howto-write-a-block/docs/doxygen/swig_doc.py b/gr-howto-write-a-block/docs/doxygen/swig_doc.py
new file mode 100644
index 000000000..f24608b3e
--- /dev/null
+++ b/gr-howto-write-a-block/docs/doxygen/swig_doc.py
@@ -0,0 +1,326 @@
+#
+# Copyright 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.
+#
+"""
+Creates the swig_doc.i SWIG interface file.
+Execute using: python swig_doc.py xml_path outputfilename
+
+The file instructs SWIG to transfer the doxygen comments into the
+python docstrings.
+
+"""
+
+import sys, time
+
+from doxyxml import DoxyIndex, DoxyClass, DoxyFriend, DoxyFunction, DoxyFile
+from doxyxml import DoxyOther, base
+
+def py_name(name):
+ bits = name.split('_')
+ return '_'.join(bits[1:])
+
+def make_name(name):
+ bits = name.split('_')
+ return bits[0] + '_make_' + '_'.join(bits[1:])
+
+
+class Block(object):
+ """
+ Checks if doxyxml produced objects correspond to a gnuradio block.
+ """
+
+ @classmethod
+ def includes(cls, item):
+ if not isinstance(item, DoxyClass):
+ return False
+ # Check for a parsing error.
+ if item.error():
+ return False
+ friendname = make_name(item.name())
+ is_a_block = item.has_member(friendname, DoxyFriend)
+ # But now sometimes the make function isn't a friend so check again.
+ if not is_a_block:
+ is_a_block = di.has_member(friendname, DoxyFunction)
+ return is_a_block
+
+class Block2(object):
+ """
+ Checks if doxyxml produced objects correspond to a new style
+ gnuradio block.
+ """
+
+ @classmethod
+ def includes(cls, item):
+ if not isinstance(item, DoxyClass):
+ return False
+ # Check for a parsing error.
+ if item.error():
+ return False
+ is_a_block2 = item.has_member('make', DoxyFunction) and item.has_member('sptr', DoxyOther)
+ return is_a_block2
+
+
+def utoascii(text):
+ """
+ Convert unicode text into ascii and escape quotes.
+ """
+ if text is None:
+ return ''
+ out = text.encode('ascii', 'replace')
+ out = out.replace('"', '\\"')
+ return out
+
+
+def combine_descriptions(obj):
+ """
+ Combines the brief and detailed descriptions of an object together.
+ """
+ description = []
+ bd = obj.brief_description.strip()
+ dd = obj.detailed_description.strip()
+ if bd:
+ description.append(bd)
+ if dd:
+ description.append(dd)
+ return utoascii('\n\n'.join(description)).strip()
+
+def format_params(parameteritems):
+ output = ['Args:']
+ template = ' {0} : {1}'
+ for pi in parameteritems:
+ output.append(template.format(pi.name, pi.description))
+ return '\n'.join(output)
+
+entry_templ = '%feature("docstring") {name} "{docstring}"'
+def make_entry(obj, name=None, templ="{description}", description=None, params=[]):
+ """
+ Create a docstring entry for a swig interface file.
+
+ obj - a doxyxml object from which documentation will be extracted.
+ name - the name of the C object (defaults to obj.name())
+ templ - an optional template for the docstring containing only one
+ variable named 'description'.
+ description - if this optional variable is set then it's value is
+ used as the description instead of extracting it from obj.
+ """
+ if name is None:
+ name=obj.name()
+ if "operator " in name:
+ return ''
+ if description is None:
+ description = combine_descriptions(obj)
+ if params:
+ description += '\n\n'
+ description += utoascii(format_params(params))
+ docstring = templ.format(description=description)
+ if not docstring:
+ return ''
+ return entry_templ.format(
+ name=name,
+ docstring=docstring,
+ )
+
+
+def make_func_entry(func, name=None, description=None, params=None):
+ """
+ Create a function docstring entry for a swig interface file.
+
+ func - a doxyxml object from which documentation will be extracted.
+ name - the name of the C object (defaults to func.name())
+ description - if this optional variable is set then it's value is
+ used as the description instead of extracting it from func.
+ params - a parameter list that overrides using func.params.
+ """
+ #if params is None:
+ # params = func.params
+ #params = [prm.declname for prm in params]
+ #if params:
+ # sig = "Params: (%s)" % ", ".join(params)
+ #else:
+ # sig = "Params: (NONE)"
+ #templ = "{description}\n\n" + sig
+ #return make_entry(func, name=name, templ=utoascii(templ),
+ # description=description)
+ return make_entry(func, name=name, description=description, params=params)
+
+
+def make_class_entry(klass, description=None, ignored_methods=[], params=None):
+ """
+ Create a class docstring for a swig interface file.
+ """
+ if params is None:
+ params = klass.params
+ output = []
+ output.append(make_entry(klass, description=description, params=params))
+ for func in klass.in_category(DoxyFunction):
+ if func.name() not in ignored_methods:
+ name = klass.name() + '::' + func.name()
+ output.append(make_func_entry(func, name=name))
+ return "\n\n".join(output)
+
+
+def make_block_entry(di, block):
+ """
+ Create class and function docstrings of a gnuradio block for a
+ swig interface file.
+ """
+ descriptions = []
+ # Get the documentation associated with the class.
+ class_desc = combine_descriptions(block)
+ if class_desc:
+ descriptions.append(class_desc)
+ # Get the documentation associated with the make function
+ make_func = di.get_member(make_name(block.name()), DoxyFunction)
+ make_func_desc = combine_descriptions(make_func)
+ if make_func_desc:
+ descriptions.append(make_func_desc)
+ # Get the documentation associated with the file
+ try:
+ block_file = di.get_member(block.name() + ".h", DoxyFile)
+ file_desc = combine_descriptions(block_file)
+ if file_desc:
+ descriptions.append(file_desc)
+ except base.Base.NoSuchMember:
+ # Don't worry if we can't find a matching file.
+ pass
+ # And join them all together to make a super duper description.
+ super_description = "\n\n".join(descriptions)
+ # Associate the combined description with the class and
+ # the make function.
+ output = []
+ output.append(make_class_entry(block, description=super_description))
+ output.append(make_func_entry(make_func, description=super_description,
+ params=block.params))
+ return "\n\n".join(output)
+
+def make_block2_entry(di, block):
+ """
+ Create class and function docstrings of a new style gnuradio block for a
+ swig interface file.
+ """
+ descriptions = []
+ # For new style blocks all the relevant documentation should be
+ # associated with the 'make' method.
+ make_func = block.get_member('make', DoxyFunction)
+ description = combine_descriptions(make_func)
+ # Associate the combined description with the class and
+ # the make function.
+ output = []
+ #output.append(make_class_entry(
+ # block, description=description,
+ # ignored_methods=['make'], params=make_func.params))
+ makename = block.name() + '::make'
+ output.append(make_func_entry(
+ make_func, name=makename, description=description,
+ params=make_func.params))
+ return "\n\n".join(output)
+
+def make_swig_interface_file(di, swigdocfilename, custom_output=None):
+
+ output = ["""
+/*
+ * This file was automatically generated using swig_doc.py.
+ *
+ * Any changes to it will be lost next time it is regenerated.
+ */
+"""]
+
+ if custom_output is not None:
+ output.append(custom_output)
+
+ # Create docstrings for the blocks.
+ blocks = di.in_category(Block)
+ blocks2 = di.in_category(Block2)
+
+ make_funcs = set([])
+ for block in blocks:
+ try:
+ make_func = di.get_member(make_name(block.name()), DoxyFunction)
+ # Don't want to risk writing to output twice.
+ if make_func.name() not in make_funcs:
+ make_funcs.add(make_func.name())
+ output.append(make_block_entry(di, block))
+ except block.ParsingError:
+ sys.stderr.write('Parsing error for block {0}\n'.format(block.name()))
+ raise
+
+ for block in blocks2:
+ try:
+ make_func = block.get_member('make', DoxyFunction)
+ make_func_name = block.name() +'::make'
+ # Don't want to risk writing to output twice.
+ if make_func_name not in make_funcs:
+ make_funcs.add(make_func_name)
+ output.append(make_block2_entry(di, block))
+ except block.ParsingError:
+ sys.stderr.write('Parsing error for block {0}\n'.format(block.name()))
+ raise
+
+ # Create docstrings for functions
+ # Don't include the make functions since they have already been dealt with.
+ funcs = [f for f in di.in_category(DoxyFunction)
+ if f.name() not in make_funcs and not f.name().startswith('std::')]
+ for f in funcs:
+ try:
+ output.append(make_func_entry(f))
+ except f.ParsingError:
+ sys.stderr.write('Parsing error for function {0}\n'.format(f.name()))
+
+ # Create docstrings for classes
+ block_names = [block.name() for block in blocks]
+ block_names += [block.name() for block in blocks2]
+ klasses = [k for k in di.in_category(DoxyClass)
+ if k.name() not in block_names and not k.name().startswith('std::')]
+ for k in klasses:
+ try:
+ output.append(make_class_entry(k))
+ except k.ParsingError:
+ sys.stderr.write('Parsing error for class {0}\n'.format(k.name()))
+
+ # Docstrings are not created for anything that is not a function or a class.
+ # If this excludes anything important please add it here.
+
+ output = "\n\n".join(output)
+
+ swig_doc = file(swigdocfilename, 'w')
+ swig_doc.write(output)
+ swig_doc.close()
+
+if __name__ == "__main__":
+ # Parse command line options and set up doxyxml.
+ err_msg = "Execute using: python swig_doc.py xml_path outputfilename"
+ if len(sys.argv) != 3:
+ raise StandardError(err_msg)
+ xml_path = sys.argv[1]
+ swigdocfilename = sys.argv[2]
+ di = DoxyIndex(xml_path)
+
+ # gnuradio.gr.msq_queue.insert_tail and delete_head create errors unless docstrings are defined!
+ # This is presumably a bug in SWIG.
+ #msg_q = di.get_member(u'gr_msg_queue', DoxyClass)
+ #insert_tail = msg_q.get_member(u'insert_tail', DoxyFunction)
+ #delete_head = msg_q.get_member(u'delete_head', DoxyFunction)
+ output = []
+ #output.append(make_func_entry(insert_tail, name='gr_py_msg_queue__insert_tail'))
+ #output.append(make_func_entry(delete_head, name='gr_py_msg_queue__delete_head'))
+ custom_output = "\n\n".join(output)
+
+ # Generate the docstrings interface file.
+ make_swig_interface_file(di, swigdocfilename, custom_output=custom_output)
diff --git a/gr-howto-write-a-block/grc/CMakeLists.txt b/gr-howto-write-a-block/grc/CMakeLists.txt
new file mode 100644
index 000000000..b7bd11d80
--- /dev/null
+++ b/gr-howto-write-a-block/grc/CMakeLists.txt
@@ -0,0 +1,24 @@
+# Copyright 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.
+
+install(FILES
+ howto_square_ff.xml
+ howto_square2_ff.xml
+ DESTINATION share/gnuradio/grc/blocks
+)
diff --git a/gr-howto-write-a-block/grc/howto_square2_ff.xml b/gr-howto-write-a-block/grc/howto_square2_ff.xml
new file mode 100644
index 000000000..c58ef0047
--- /dev/null
+++ b/gr-howto-write-a-block/grc/howto_square2_ff.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0"?>
+<block>
+ <name>Square2</name>
+ <key>howto_square2_ff</key>
+ <category>HOWTO</category>
+ <import>import howto</import>
+ <make>howto.square2_ff()</make>
+
+ <sink>
+ <name>in</name>
+ <type>float</type>
+ </sink>
+
+ <source>
+ <name>out</name>
+ <type>float</type>
+ </source>
+</block>
diff --git a/gr-howto-write-a-block/grc/howto_square_ff.xml b/gr-howto-write-a-block/grc/howto_square_ff.xml
new file mode 100644
index 000000000..34a0b0a3f
--- /dev/null
+++ b/gr-howto-write-a-block/grc/howto_square_ff.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0"?>
+<block>
+ <name>Square</name>
+ <key>howto_square_ff</key>
+ <category>HOWTO</category>
+ <import>import howto</import>
+ <make>howto.square_ff()</make>
+
+ <sink>
+ <name>in</name>
+ <type>float</type>
+ </sink>
+
+ <source>
+ <name>out</name>
+ <type>float</type>
+ </source>
+</block>
diff --git a/gr-howto-write-a-block/include/CMakeLists.txt b/gr-howto-write-a-block/include/CMakeLists.txt
new file mode 100644
index 000000000..475cc73c6
--- /dev/null
+++ b/gr-howto-write-a-block/include/CMakeLists.txt
@@ -0,0 +1,28 @@
+# Copyright 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.
+
+########################################################################
+# Install public header files
+########################################################################
+install(FILES
+ howto_api.h
+ howto_square_ff.h
+ howto_square2_ff.h
+ DESTINATION include/howto
+)
diff --git a/gr-howto-write-a-block/include/howto_api.h b/gr-howto-write-a-block/include/howto_api.h
new file mode 100644
index 000000000..5263a1cf7
--- /dev/null
+++ b/gr-howto-write-a-block/include/howto_api.h
@@ -0,0 +1,33 @@
+/*
+ * Copyright 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.
+ */
+
+#ifndef INCLUDED_HOWTO_API_H
+#define INCLUDED_HOWTO_API_H
+
+#include <gruel/attributes.h>
+
+#ifdef gnuradio_howto_EXPORTS
+# define HOWTO_API __GR_ATTR_EXPORT
+#else
+# define HOWTO_API __GR_ATTR_IMPORT
+#endif
+
+#endif /* INCLUDED_HOWTO_API_H */
diff --git a/gr-howto-write-a-block/include/howto_square2_ff.h b/gr-howto-write-a-block/include/howto_square2_ff.h
new file mode 100644
index 000000000..2d6c7938b
--- /dev/null
+++ b/gr-howto-write-a-block/include/howto_square2_ff.h
@@ -0,0 +1,78 @@
+/* -*- 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_HOWTO_SQUARE2_FF_H
+#define INCLUDED_HOWTO_SQUARE2_FF_H
+
+#include <howto_api.h>
+#include <gr_sync_block.h>
+
+class howto_square2_ff;
+
+/*
+ * We use boost::shared_ptr's instead of raw pointers for all access
+ * to gr_blocks (and many other data structures). The shared_ptr gets
+ * us transparent reference counting, which greatly simplifies storage
+ * management issues. This is especially helpful in our hybrid
+ * C++ / Python system.
+ *
+ * See http://www.boost.org/libs/smart_ptr/smart_ptr.htm
+ *
+ * As a convention, the _sptr suffix indicates a boost::shared_ptr
+ */
+typedef boost::shared_ptr<howto_square2_ff> howto_square2_ff_sptr;
+
+/*!
+ * \brief Return a shared_ptr to a new instance of howto_square2_ff.
+ *
+ * To avoid accidental use of raw pointers, howto_square2_ff's
+ * constructor is private. howto_make_square2_ff is the public
+ * interface for creating new instances.
+ */
+HOWTO_API howto_square2_ff_sptr howto_make_square2_ff ();
+
+/*!
+ * \brief square2 a stream of floats.
+ * \ingroup block
+ *
+ * This uses the preferred technique: subclassing gr_sync_block.
+ */
+class HOWTO_API howto_square2_ff : public gr_sync_block
+{
+private:
+ // The friend declaration allows howto_make_square2_ff to
+ // access the private constructor.
+
+ friend HOWTO_API howto_square2_ff_sptr howto_make_square2_ff ();
+
+ howto_square2_ff (); // private constructor
+
+ public:
+ ~howto_square2_ff (); // public destructor
+
+ // Where all the action really happens
+
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif /* INCLUDED_HOWTO_SQUARE2_FF_H */
diff --git a/gr-howto-write-a-block/include/howto_square_ff.h b/gr-howto-write-a-block/include/howto_square_ff.h
new file mode 100644
index 000000000..2efc7fc71
--- /dev/null
+++ b/gr-howto-write-a-block/include/howto_square_ff.h
@@ -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.
+ */
+#ifndef INCLUDED_HOWTO_SQUARE_FF_H
+#define INCLUDED_HOWTO_SQUARE_FF_H
+
+#include <howto_api.h>
+#include <gr_block.h>
+
+class howto_square_ff;
+
+/*
+ * We use boost::shared_ptr's instead of raw pointers for all access
+ * to gr_blocks (and many other data structures). The shared_ptr gets
+ * us transparent reference counting, which greatly simplifies storage
+ * management issues. This is especially helpful in our hybrid
+ * C++ / Python system.
+ *
+ * See http://www.boost.org/libs/smart_ptr/smart_ptr.htm
+ *
+ * As a convention, the _sptr suffix indicates a boost::shared_ptr
+ */
+typedef boost::shared_ptr<howto_square_ff> howto_square_ff_sptr;
+
+/*!
+ * \brief Return a shared_ptr to a new instance of howto_square_ff.
+ *
+ * To avoid accidental use of raw pointers, howto_square_ff's
+ * constructor is private. howto_make_square_ff is the public
+ * interface for creating new instances.
+ */
+HOWTO_API howto_square_ff_sptr howto_make_square_ff ();
+
+/*!
+ * \brief square a stream of floats.
+ * \ingroup block
+ *
+ * \sa howto_square2_ff for a version that subclasses gr_sync_block.
+ */
+class HOWTO_API howto_square_ff : public gr_block
+{
+private:
+ // The friend declaration allows howto_make_square_ff to
+ // access the private constructor.
+
+ friend HOWTO_API howto_square_ff_sptr howto_make_square_ff ();
+
+ /*!
+ * \brief square a stream of floats.
+ */
+ howto_square_ff (); // private constructor
+
+ public:
+ ~howto_square_ff (); // public destructor
+
+ // Where all the action really happens
+
+ int general_work (int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif /* INCLUDED_HOWTO_SQUARE_FF_H */
diff --git a/gr-howto-write-a-block/lib/CMakeLists.txt b/gr-howto-write-a-block/lib/CMakeLists.txt
new file mode 100644
index 000000000..835ae02d6
--- /dev/null
+++ b/gr-howto-write-a-block/lib/CMakeLists.txt
@@ -0,0 +1,54 @@
+# Copyright 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.
+
+########################################################################
+# Setup library
+########################################################################
+include(GrPlatform) #define LIB_SUFFIX
+
+add_library(gnuradio-howto SHARED howto_square_ff.cc howto_square2_ff.cc)
+target_link_libraries(gnuradio-howto ${Boost_LIBRARIES} ${GRUEL_LIBRARIES} ${GNURADIO_CORE_LIBRARIES})
+set_target_properties(gnuradio-howto PROPERTIES DEFINE_SYMBOL "gnuradio_howto_EXPORTS")
+
+########################################################################
+# Install built library files
+########################################################################
+install(TARGETS gnuradio-howto
+ LIBRARY DESTINATION lib${LIB_SUFFIX} # .so/.dylib file
+ ARCHIVE DESTINATION lib${LIB_SUFFIX} # .lib file
+ RUNTIME DESTINATION bin # .dll file
+)
+
+########################################################################
+# Build and register unit test
+########################################################################
+find_package(Boost COMPONENTS unit_test_framework)
+
+include(GrTest)
+set(GR_TEST_TARGET_DEPS gnuradio-howto)
+#turn each test cpp file into an executable with an int main() function
+add_definitions(-DBOOST_TEST_DYN_LINK -DBOOST_TEST_MAIN)
+
+add_executable(qa_howto_square_ff qa_howto_square_ff.cc)
+target_link_libraries(qa_howto_square_ff gnuradio-howto ${Boost_LIBRARIES})
+GR_ADD_TEST(qa_howto_square_ff qa_howto_square_ff)
+
+add_executable(qa_howto_square2_ff qa_howto_square2_ff.cc)
+target_link_libraries(qa_howto_square2_ff gnuradio-howto ${Boost_LIBRARIES})
+GR_ADD_TEST(qa_howto_square2_ff qa_howto_square2_ff)
diff --git a/gr-howto-write-a-block/lib/howto_square2_ff.cc b/gr-howto-write-a-block/lib/howto_square2_ff.cc
new file mode 100644
index 000000000..3586559ff
--- /dev/null
+++ b/gr-howto-write-a-block/lib/howto_square2_ff.cc
@@ -0,0 +1,92 @@
+/* -*- 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.
+ */
+
+/*
+ * config.h is generated by configure. It contains the results
+ * of probing for features, options etc. It should be the first
+ * file included in your .cc file.
+ */
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <howto_square2_ff.h>
+#include <gr_io_signature.h>
+
+/*
+ * Create a new instance of howto_square2_ff and return
+ * a boost shared_ptr. This is effectively the public constructor.
+ */
+howto_square2_ff_sptr
+howto_make_square2_ff ()
+{
+ return gnuradio::get_initial_sptr(new howto_square2_ff ());
+}
+
+/*
+ * Specify constraints on number of input and output streams.
+ * This info is used to construct the input and output signatures
+ * (2nd & 3rd args to gr_block's constructor). The input and
+ * output signatures are used by the runtime system to
+ * check that a valid number and type of inputs and outputs
+ * are connected to this block. In this case, we accept
+ * only 1 input and 1 output.
+ */
+static const int MIN_IN = 1; // mininum number of input streams
+static const int MAX_IN = 1; // maximum number of input streams
+static const int MIN_OUT = 1; // minimum number of output streams
+static const int MAX_OUT = 1; // maximum number of output streams
+
+/*
+ * The private constructor
+ */
+howto_square2_ff::howto_square2_ff ()
+ : gr_sync_block ("square2_ff",
+ gr_make_io_signature (MIN_IN, MAX_IN, sizeof (float)),
+ gr_make_io_signature (MIN_OUT, MAX_OUT, sizeof (float)))
+{
+ // nothing else required in this example
+}
+
+/*
+ * Our virtual destructor.
+ */
+howto_square2_ff::~howto_square2_ff ()
+{
+ // nothing else required in this example
+}
+
+int
+howto_square2_ff::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const float *in = (const float *) input_items[0];
+ float *out = (float *) output_items[0];
+
+ for (int i = 0; i < noutput_items; i++){
+ out[i] = in[i] * in[i];
+ }
+
+ // Tell runtime system how many output items we produced.
+ return noutput_items;
+}
diff --git a/gr-howto-write-a-block/lib/howto_square_ff.cc b/gr-howto-write-a-block/lib/howto_square_ff.cc
new file mode 100644
index 000000000..f0d2e1f86
--- /dev/null
+++ b/gr-howto-write-a-block/lib/howto_square_ff.cc
@@ -0,0 +1,98 @@
+/* -*- 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.
+ */
+
+/*
+ * config.h is generated by configure. It contains the results
+ * of probing for features, options etc. It should be the first
+ * file included in your .cc file.
+ */
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <howto_square_ff.h>
+#include <gr_io_signature.h>
+
+/*
+ * Create a new instance of howto_square_ff and return
+ * a boost shared_ptr. This is effectively the public constructor.
+ */
+howto_square_ff_sptr
+howto_make_square_ff ()
+{
+ return gnuradio::get_initial_sptr(new howto_square_ff ());
+}
+
+/*
+ * Specify constraints on number of input and output streams.
+ * This info is used to construct the input and output signatures
+ * (2nd & 3rd args to gr_block's constructor). The input and
+ * output signatures are used by the runtime system to
+ * check that a valid number and type of inputs and outputs
+ * are connected to this block. In this case, we accept
+ * only 1 input and 1 output.
+ */
+static const int MIN_IN = 1; // mininum number of input streams
+static const int MAX_IN = 1; // maximum number of input streams
+static const int MIN_OUT = 1; // minimum number of output streams
+static const int MAX_OUT = 1; // maximum number of output streams
+
+/*
+ * The private constructor
+ */
+howto_square_ff::howto_square_ff ()
+ : gr_block ("square_ff",
+ gr_make_io_signature (MIN_IN, MAX_IN, sizeof (float)),
+ gr_make_io_signature (MIN_OUT, MAX_OUT, sizeof (float)))
+{
+ // nothing else required in this example
+}
+
+/*
+ * Our virtual destructor.
+ */
+howto_square_ff::~howto_square_ff ()
+{
+ // nothing else required in this example
+}
+
+int
+howto_square_ff::general_work (int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const float *in = (const float *) input_items[0];
+ float *out = (float *) output_items[0];
+
+ for (int i = 0; i < noutput_items; i++){
+ out[i] = in[i] * in[i];
+ }
+
+ // Tell runtime system how many input items we consumed on
+ // each input stream.
+
+ consume_each (noutput_items);
+
+ // Tell runtime system how many output items we produced.
+ return noutput_items;
+}
diff --git a/gr-howto-write-a-block/lib/qa_howto_square2_ff.cc b/gr-howto-write-a-block/lib/qa_howto_square2_ff.cc
new file mode 100644
index 000000000..ff1e5d5b0
--- /dev/null
+++ b/gr-howto-write-a-block/lib/qa_howto_square2_ff.cc
@@ -0,0 +1,32 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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 this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <boost/test/unit_test.hpp>
+
+BOOST_AUTO_TEST_CASE(qa_howto_square2_ff_t1){
+ BOOST_CHECK_EQUAL(2 + 2, 4);
+ // TODO BOOST_* test macros here
+}
+
+BOOST_AUTO_TEST_CASE(qa_howto_square2_ff_t2){
+ BOOST_CHECK_EQUAL(2 + 2, 4);
+ // TODO BOOST_* test macros here
+}
diff --git a/gr-howto-write-a-block/lib/qa_howto_square_ff.cc b/gr-howto-write-a-block/lib/qa_howto_square_ff.cc
new file mode 100644
index 000000000..98f6cc587
--- /dev/null
+++ b/gr-howto-write-a-block/lib/qa_howto_square_ff.cc
@@ -0,0 +1,32 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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 this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <boost/test/unit_test.hpp>
+
+BOOST_AUTO_TEST_CASE(qa_howto_square_ff_t1){
+ BOOST_CHECK_EQUAL(2 + 2, 4);
+ // TODO BOOST_* test macros here
+}
+
+BOOST_AUTO_TEST_CASE(qa_howto_square_ff_t2){
+ BOOST_CHECK_EQUAL(2 + 2, 4);
+ // TODO BOOST_* test macros here
+}
diff --git a/gr-howto-write-a-block/python/CMakeLists.txt b/gr-howto-write-a-block/python/CMakeLists.txt
new file mode 100644
index 000000000..ac5531638
--- /dev/null
+++ b/gr-howto-write-a-block/python/CMakeLists.txt
@@ -0,0 +1,45 @@
+# Copyright 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.
+
+########################################################################
+# Include python install macros
+########################################################################
+include(GrPython)
+if(NOT PYTHONINTERP_FOUND)
+ return()
+endif()
+
+########################################################################
+# Install python sources
+########################################################################
+GR_PYTHON_INSTALL(
+ FILES
+ __init__.py
+ square3_ff.py
+ DESTINATION ${GR_PYTHON_DIR}/howto
+)
+
+########################################################################
+# Handle the unit tests
+########################################################################
+include(GrTest)
+
+set(GR_TEST_TARGET_DEPS gnuradio-howto)
+set(GR_TEST_PYTHON_DIRS ${CMAKE_BINARY_DIR}/swig)
+GR_ADD_TEST(qa_howto ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_howto.py)
diff --git a/gr-howto-write-a-block/python/__init__.py b/gr-howto-write-a-block/python/__init__.py
new file mode 100644
index 000000000..6e5e1c147
--- /dev/null
+++ b/gr-howto-write-a-block/python/__init__.py
@@ -0,0 +1,31 @@
+#
+# Copyright 2008,2009 Free Software Foundation, Inc.
+#
+# This application 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.
+#
+# This application 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 this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+
+# The presence of this file turns this directory into a Python package
+
+'''
+This is the GNU Radio HOWTO module. Place your Python package
+description here (python/__init__.py).
+'''
+
+# import swig generated symbols into the howto namespace
+from howto_swig import *
+from square3_ff import square3_ff
+
+# import any pure python here
+#
diff --git a/gr-howto-write-a-block/python/qa_howto.py b/gr-howto-write-a-block/python/qa_howto.py
new file mode 100755
index 000000000..5e62fc890
--- /dev/null
+++ b/gr-howto-write-a-block/python/qa_howto.py
@@ -0,0 +1,72 @@
+#!/usr/bin/env python
+#
+# Copyright 2004,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.
+#
+
+from gnuradio import gr, gr_unittest
+import howto_swig
+from square3_ff import square3_ff
+
+class qa_howto (gr_unittest.TestCase):
+
+ def setUp (self):
+ self.tb = gr.top_block ()
+
+ def tearDown (self):
+ self.tb = None
+
+ def test_001_square_ff (self):
+ src_data = (-3, 4, -5.5, 2, 3)
+ expected_result = (9, 16, 30.25, 4, 9)
+ src = gr.vector_source_f (src_data)
+ sqr = howto_swig.square_ff ()
+ dst = gr.vector_sink_f ()
+ self.tb.connect (src, sqr)
+ self.tb.connect (sqr, dst)
+ self.tb.run ()
+ result_data = dst.data ()
+ self.assertFloatTuplesAlmostEqual (expected_result, result_data, 6)
+
+ def test_002_square2_ff (self):
+ src_data = (-3, 4, -5.5, 2, 3)
+ expected_result = (9, 16, 30.25, 4, 9)
+ src = gr.vector_source_f (src_data)
+ sqr = howto_swig.square2_ff ()
+ dst = gr.vector_sink_f ()
+ self.tb.connect (src, sqr)
+ self.tb.connect (sqr, dst)
+ self.tb.run ()
+ result_data = dst.data ()
+ self.assertFloatTuplesAlmostEqual (expected_result, result_data, 6)
+
+ def test_003_square3_ff (self):
+ src_data = (-3, 4, -5.5, 2, 3)
+ expected_result = (9, 16, 30.25, 4, 9)
+ src = gr.vector_source_f (src_data)
+ sqr = square3_ff ()
+ dst = gr.vector_sink_f ()
+ self.tb.connect (src, sqr)
+ self.tb.connect (sqr, dst)
+ self.tb.run ()
+ result_data = dst.data ()
+ self.assertFloatTuplesAlmostEqual (expected_result, result_data, 6)
+
+if __name__ == '__main__':
+ gr_unittest.main ()
diff --git a/gr-howto-write-a-block/python/square3_ff.py b/gr-howto-write-a-block/python/square3_ff.py
new file mode 100644
index 000000000..df702734e
--- /dev/null
+++ b/gr-howto-write-a-block/python/square3_ff.py
@@ -0,0 +1,47 @@
+#!/usr/bin/env python
+#
+# Copyright 2013 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.
+#
+
+import numpy
+from gnuradio import gr
+
+class square3_ff(gr.sync_block):
+ " Squaring block "
+ def __init__(self):
+ gr.sync_block.__init__(
+ self,
+ name = "square3_ff",
+ in_sig = [numpy.float32], # Input signature: 1 float at a time
+ out_sig = [numpy.float32], # Output signature: 1 float at a time
+ )
+
+ def work(self, input_items, output_items):
+ """ Notes:
+ - You must not forget the [:] at the output items, otherwise
+ stuff doesn't truly get copied to the output
+ - Both input_ and output_items[N] are numpy arrays, so you can
+ do fancy stuff like multiplying them elementwise
+ - noutput_items and ninput_items are implicit in the length of
+ output_items and input_items, respectively
+ """
+ output_items[0][:] = input_items[0] * input_items[0]
+ return len(output_items[0])
+
diff --git a/gr-howto-write-a-block/swig/CMakeLists.txt b/gr-howto-write-a-block/swig/CMakeLists.txt
new file mode 100644
index 000000000..4d5f1156e
--- /dev/null
+++ b/gr-howto-write-a-block/swig/CMakeLists.txt
@@ -0,0 +1,63 @@
+# Copyright 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.
+
+########################################################################
+# Include swig generation macros
+########################################################################
+find_package(SWIG)
+find_package(PythonLibs)
+if(NOT SWIG_FOUND OR NOT PYTHONLIBS_FOUND)
+ return()
+endif()
+include(GrSwig)
+include(GrPython)
+
+########################################################################
+# Setup swig generation
+########################################################################
+foreach(incdir ${GNURADIO_CORE_INCLUDE_DIRS})
+ list(APPEND GR_SWIG_INCLUDE_DIRS ${incdir}/swig)
+endforeach(incdir)
+
+foreach(incdir ${GRUEL_INCLUDE_DIRS})
+ list(APPEND GR_SWIG_INCLUDE_DIRS ${incdir}/gruel/swig)
+endforeach(incdir)
+
+list(APPEND GR_SWIG_INCLUDE_DIRS ${Boost_INCLUDE_DIRS})
+
+set(GR_SWIG_LIBRARIES gnuradio-howto)
+set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/howto_swig_doc.i)
+set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include)
+
+GR_SWIG_MAKE(howto_swig howto_swig.i)
+
+########################################################################
+# Install the build swig module
+########################################################################
+GR_SWIG_INSTALL(TARGETS howto_swig DESTINATION ${GR_PYTHON_DIR}/howto)
+
+########################################################################
+# Install swig .i files for development
+########################################################################
+install(
+ FILES
+ howto_swig.i
+ ${CMAKE_CURRENT_BINARY_DIR}/howto_swig_doc.i
+ DESTINATION ${GR_INCLUDE_DIR}/howto/swig
+)
diff --git a/gr-howto-write-a-block/swig/howto_swig.i b/gr-howto-write-a-block/swig/howto_swig.i
new file mode 100644
index 000000000..dd662b5e5
--- /dev/null
+++ b/gr-howto-write-a-block/swig/howto_swig.i
@@ -0,0 +1,20 @@
+/* -*- c++ -*- */
+
+#define HOWTO_API
+
+%include "gnuradio.i" // the common stuff
+
+//load generated python docstrings
+%include "howto_swig_doc.i"
+
+
+%{
+#include "howto_square_ff.h"
+#include "howto_square2_ff.h"
+%}
+
+GR_SWIG_BLOCK_MAGIC(howto,square_ff);
+%include "howto_square_ff.h"
+
+GR_SWIG_BLOCK_MAGIC(howto,square2_ff);
+%include "howto_square2_ff.h"
diff --git a/gr-qtgui/CMakeLists.txt b/gr-qtgui/CMakeLists.txt
new file mode 100644
index 000000000..d7d889e93
--- /dev/null
+++ b/gr-qtgui/CMakeLists.txt
@@ -0,0 +1,131 @@
+# Copyright 2010-2011,2013 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.
+
+########################################################################
+# Setup dependencies
+########################################################################
+include(GrBoost)
+
+find_package(Qt4 4.2.0 COMPONENTS QtCore QtGui)
+
+find_package(Qwt)
+
+find_package(PythonLibs)
+
+include(GrPython)
+GR_PYTHON_CHECK_MODULE("PyQt4" PyQt4 True PYQT4_FOUND)
+
+########################################################################
+# Register component
+########################################################################
+include(GrComponent)
+if(NOT CMAKE_CROSSCOMPILING)
+ set(qt_gui_python_deps
+ PYQT4_FOUND
+ #we could check for pyqwt, but its not strictly required
+ )
+endif(NOT CMAKE_CROSSCOMPILING)
+
+GR_REGISTER_COMPONENT("gr-qtgui" ENABLE_GR_QTGUI
+ Boost_FOUND
+ QT4_FOUND
+ QWT_FOUND
+ ENABLE_GR_CORE
+ PYTHONLIBS_FOUND
+ ${qt_gui_python_deps}
+)
+
+GR_SET_GLOBAL(GR_QTGUI_INCLUDE_DIRS
+ ${CMAKE_CURRENT_SOURCE_DIR}/include
+ ${CMAKE_CURRENT_SOURCE_DIR}/lib
+ ${CMAKE_CURRENT_BINARY_DIR}/lib
+)
+
+SET(GR_PKG_QTGUI_EXAMPLES_DIR ${GR_PKG_DATA_DIR}/examples/qt-gui)
+
+########################################################################
+# Begin conditional configuration
+########################################################################
+if(ENABLE_GR_QTGUI)
+
+# populate the environment with QT variables
+include(GrSetupQt4)
+
+########################################################################
+# Setup CPack components
+########################################################################
+include(GrPackage)
+CPACK_SET(CPACK_COMPONENT_GROUP_QTGUI_DESCRIPTION "GNU Radio QtGUI Blocks")
+
+CPACK_COMPONENT("qtgui_runtime"
+ GROUP "QtGUI"
+ DISPLAY_NAME "Runtime"
+ DESCRIPTION "Runtime"
+ DEPENDS "core_runtime"
+)
+
+CPACK_COMPONENT("qtgui_devel"
+ GROUP "QtGUI"
+ DISPLAY_NAME "Development"
+ DESCRIPTION "C++ headers, package config, import libraries"
+ DEPENDS "core_devel"
+)
+
+CPACK_COMPONENT("qtgui_python"
+ GROUP "QtGUI"
+ DISPLAY_NAME "Python"
+ DESCRIPTION "Python modules for runtime; GRC xml files"
+ DEPENDS "core_python;qtgui_runtime"
+)
+
+CPACK_COMPONENT("qtgui_swig"
+ GROUP "QtGUI"
+ DISPLAY_NAME "SWIG"
+ DESCRIPTION "SWIG development .i files"
+ DEPENDS "core_swig;qtgui_python;qtgui_devel"
+)
+
+########################################################################
+# Add subdirectories
+########################################################################
+add_subdirectory(include)
+add_subdirectory(lib)
+add_subdirectory(doc)
+if(ENABLE_PYTHON)
+ add_subdirectory(grc)
+ add_subdirectory(swig)
+ add_subdirectory(python)
+ add_subdirectory(examples)
+endif(ENABLE_PYTHON)
+
+########################################################################
+# Create Pkg Config File
+########################################################################
+configure_file(
+ ${CMAKE_CURRENT_SOURCE_DIR}/gnuradio-qtgui.pc.in
+ ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-qtgui.pc
+@ONLY)
+
+install(
+ FILES ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-qtgui.pc
+ DESTINATION ${GR_LIBRARY_DIR}/pkgconfig
+ COMPONENT "qtgui_devel"
+)
+
+endif(ENABLE_GR_QTGUI)
diff --git a/gr-qtgui/apps/grc_qt_example.grc b/gr-qtgui/apps/grc_qt_example.grc
new file mode 100644
index 000000000..170cd546a
--- /dev/null
+++ b/gr-qtgui/apps/grc_qt_example.grc
@@ -0,0 +1,441 @@
+<?xml version='1.0' encoding='ASCII'?>
+<flow_graph>
+ <timestamp>Sun Apr 10 16:49:13 2011</timestamp>
+ <block>
+ <key>options</key>
+ <param>
+ <key>id</key>
+ <value>grc_qt_example</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>title</key>
+ <value></value>
+ </param>
+ <param>
+ <key>author</key>
+ <value></value>
+ </param>
+ <param>
+ <key>description</key>
+ <value></value>
+ </param>
+ <param>
+ <key>window_size</key>
+ <value>1280, 1024</value>
+ </param>
+ <param>
+ <key>generate_options</key>
+ <value>qt_gui</value>
+ </param>
+ <param>
+ <key>category</key>
+ <value>Custom</value>
+ </param>
+ <param>
+ <key>run_options</key>
+ <value>prompt</value>
+ </param>
+ <param>
+ <key>run</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>realtime_scheduling</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(10, 10)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable</key>
+ <param>
+ <key>id</key>
+ <value>samp_rate</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>32000</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(10, 170)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>gr_throttle</key>
+ <param>
+ <key>id</key>
+ <value>gr_throttle_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>complex</value>
+ </param>
+ <param>
+ <key>samples_per_second</key>
+ <value>samp_rate</value>
+ </param>
+ <param>
+ <key>vlen</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(511, 96)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable_qtgui_range</key>
+ <param>
+ <key>id</key>
+ <value>freq</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>label</key>
+ <value>Signal Frequency</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>1000</value>
+ </param>
+ <param>
+ <key>start</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>stop</key>
+ <value>samp_rate/2.0</value>
+ </param>
+ <param>
+ <key>step</key>
+ <value>samp_rate/100.0</value>
+ </param>
+ <param>
+ <key>widget</key>
+ <value>counter_slider</value>
+ </param>
+ <param>
+ <key>orient</key>
+ <value>Qt.Horizontal</value>
+ </param>
+ <param>
+ <key>min_len</key>
+ <value>200</value>
+ </param>
+ <param>
+ <key>gui_hint</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(169, 187)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>gr_sig_source_x</key>
+ <param>
+ <key>id</key>
+ <value>gr_sig_source_x_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>complex</value>
+ </param>
+ <param>
+ <key>samp_rate</key>
+ <value>samp_rate</value>
+ </param>
+ <param>
+ <key>waveform</key>
+ <value>gr.GR_COS_WAVE</value>
+ </param>
+ <param>
+ <key>freq</key>
+ <value>freq</value>
+ </param>
+ <param>
+ <key>amp</key>
+ <value>amp</value>
+ </param>
+ <param>
+ <key>offset</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(295, 64)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable_qtgui_range</key>
+ <param>
+ <key>id</key>
+ <value>amp</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>label</key>
+ <value>Signal Amplitude</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>start</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>stop</key>
+ <value>1.0</value>
+ </param>
+ <param>
+ <key>step</key>
+ <value>0.01</value>
+ </param>
+ <param>
+ <key>widget</key>
+ <value>counter_slider</value>
+ </param>
+ <param>
+ <key>orient</key>
+ <value>Qt.Horizontal</value>
+ </param>
+ <param>
+ <key>min_len</key>
+ <value>200</value>
+ </param>
+ <param>
+ <key>gui_hint</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(311, 187)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable_qtgui_range</key>
+ <param>
+ <key>id</key>
+ <value>noise</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>label</key>
+ <value>Noise Amplitude</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>0.01</value>
+ </param>
+ <param>
+ <key>start</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>stop</key>
+ <value>1.0</value>
+ </param>
+ <param>
+ <key>step</key>
+ <value>0.01</value>
+ </param>
+ <param>
+ <key>widget</key>
+ <value>counter_slider</value>
+ </param>
+ <param>
+ <key>orient</key>
+ <value>Qt.Horizontal</value>
+ </param>
+ <param>
+ <key>min_len</key>
+ <value>200</value>
+ </param>
+ <param>
+ <key>gui_hint</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(723, 191)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>gr_channel_model</key>
+ <param>
+ <key>id</key>
+ <value>gr_channel_model_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>noise_voltage</key>
+ <value>noise</value>
+ </param>
+ <param>
+ <key>freq_offset</key>
+ <value>0.0</value>
+ </param>
+ <param>
+ <key>epsilon</key>
+ <value>1.0</value>
+ </param>
+ <param>
+ <key>taps</key>
+ <value>1.0 + 0.0j</value>
+ </param>
+ <param>
+ <key>seed</key>
+ <value>42</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(727, 64)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>qtgui_sink_x</key>
+ <param>
+ <key>id</key>
+ <value>qtgui_sink_x_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>complex</value>
+ </param>
+ <param>
+ <key>name</key>
+ <value>QT GUI Plot</value>
+ </param>
+ <param>
+ <key>fftsize</key>
+ <value>1024</value>
+ </param>
+ <param>
+ <key>wintype</key>
+ <value>firdes.WIN_BLACKMAN_hARRIS</value>
+ </param>
+ <param>
+ <key>fc</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>bw</key>
+ <value>samp_rate</value>
+ </param>
+ <param>
+ <key>plotfreq</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>plotwaterfall</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>plottime</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>plotconst</key>
+ <value>False</value>
+ </param>
+ <param>
+ <key>gui_hint</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(958, 72)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <connection>
+ <source_block_id>gr_sig_source_x_0</source_block_id>
+ <sink_block_id>gr_throttle_0</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>gr_throttle_0</source_block_id>
+ <sink_block_id>gr_channel_model_0</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>gr_channel_model_0</source_block_id>
+ <sink_block_id>qtgui_sink_x_0</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+</flow_graph>
diff --git a/gr-qtgui/apps/qt_digital.py b/gr-qtgui/apps/qt_digital.py
new file mode 100755
index 000000000..2bc039a31
--- /dev/null
+++ b/gr-qtgui/apps/qt_digital.py
@@ -0,0 +1,308 @@
+#!/usr/bin/env python
+#
+# Copyright 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.
+#
+
+from gnuradio import gr, blks2
+from gnuradio import eng_notation
+import sys
+
+try:
+ from gnuradio import qtgui
+ from PyQt4 import QtGui, QtCore
+ import sip
+except ImportError:
+ print "Error: Program requires PyQt4 and gr-qtgui."
+ sys.exit(1)
+
+try:
+ import scipy
+except ImportError:
+ print "Error: Program requires scipy (see: www.scipy.org)."
+ sys.exit(1)
+
+try:
+ from qt_digital_window import Ui_DigitalWindow
+except ImportError:
+ print "Error: could not find qt_digital_window.py:"
+ print "\t\"Please run: pyuic4 qt_digital_window.ui -o qt_digital_window.py\""
+ sys.exit(1)
+
+class dialog_box(QtGui.QMainWindow):
+ def __init__(self, snkTx, snkRx, fg, parent=None):
+ QtGui.QWidget.__init__(self, parent)
+ self.gui = Ui_DigitalWindow()
+ self.gui.setupUi(self)
+
+ self.fg = fg
+
+ self.set_sample_rate(self.fg.sample_rate())
+
+ self.set_snr(self.fg.snr())
+ self.set_frequency(self.fg.frequency_offset())
+ self.set_time_offset(self.fg.timing_offset())
+
+ self.set_gain_mu(self.fg.rx_gain_mu())
+ self.set_alpha(self.fg.rx_alpha())
+
+ # Add the qtsnk widgets to the hlayout box
+ self.gui.sinkLayout.addWidget(snkTx)
+ self.gui.sinkLayout.addWidget(snkRx)
+
+
+ # Connect up some signals
+ self.connect(self.gui.pauseButton, QtCore.SIGNAL("clicked()"),
+ self.pauseFg)
+
+ self.connect(self.gui.sampleRateEdit, QtCore.SIGNAL("editingFinished()"),
+ self.sampleRateEditText)
+
+ self.connect(self.gui.snrEdit, QtCore.SIGNAL("editingFinished()"),
+ self.snrEditText)
+ self.connect(self.gui.freqEdit, QtCore.SIGNAL("editingFinished()"),
+ self.freqEditText)
+ self.connect(self.gui.timeEdit, QtCore.SIGNAL("editingFinished()"),
+ self.timeEditText)
+
+ self.connect(self.gui.gainMuEdit, QtCore.SIGNAL("editingFinished()"),
+ self.gainMuEditText)
+ self.connect(self.gui.alphaEdit, QtCore.SIGNAL("editingFinished()"),
+ self.alphaEditText)
+
+
+ def pauseFg(self):
+ if(self.gui.pauseButton.text() == "Pause"):
+ self.fg.stop()
+ self.fg.wait()
+ self.gui.pauseButton.setText("Unpause")
+ else:
+ self.fg.start()
+ self.gui.pauseButton.setText("Pause")
+
+ # Accessor functions for Gui to manipulate system parameters
+ def set_sample_rate(self, sr):
+ ssr = eng_notation.num_to_str(sr)
+ self.gui.sampleRateEdit.setText(QtCore.QString("%1").arg(ssr))
+
+ def sampleRateEditText(self):
+ try:
+ rate = self.gui.sampleRateEdit.text().toAscii()
+ srate = eng_notation.str_to_num(rate)
+ self.fg.set_sample_rate(srate)
+ except RuntimeError:
+ pass
+
+
+ # Accessor functions for Gui to manipulate channel model
+ def set_snr(self, snr):
+ self.gui.snrEdit.setText(QtCore.QString("%1").arg(snr))
+
+ def set_frequency(self, fo):
+ self.gui.freqEdit.setText(QtCore.QString("%1").arg(fo))
+
+ def set_time_offset(self, to):
+ self.gui.timeEdit.setText(QtCore.QString("%1").arg(to))
+
+ def snrEditText(self):
+ try:
+ snr = self.gui.snrEdit.text().toDouble()[0]
+ self.fg.set_snr(snr)
+ except RuntimeError:
+ pass
+
+ def freqEditText(self):
+ try:
+ freq = self.gui.freqEdit.text().toDouble()[0]
+ self.fg.set_frequency_offset(freq)
+ except RuntimeError:
+ pass
+
+ def timeEditText(self):
+ try:
+ to = self.gui.timeEdit.text().toDouble()[0]
+ self.fg.set_timing_offset(to)
+ except RuntimeError:
+ pass
+
+
+ # Accessor functions for Gui to manipulate receiver parameters
+ def set_gain_mu(self, gain):
+ self.gui.gainMuEdit.setText(QtCore.QString("%1").arg(gain))
+
+ def set_alpha(self, alpha):
+ self.gui.alphaEdit.setText(QtCore.QString("%1").arg(alpha))
+
+ def alphaEditText(self):
+ try:
+ alpha = self.gui.alphaEdit.text().toDouble()[0]
+ self.fg.set_rx_alpha(alpha)
+ except RuntimeError:
+ pass
+
+ def gainMuEditText(self):
+ try:
+ gain = self.gui.gainMuEdit.text().toDouble()[0]
+ self.fg.set_rx_gain_mu(gain)
+ except RuntimeError:
+ pass
+
+
+class my_top_block(gr.top_block):
+ def __init__(self):
+ gr.top_block.__init__(self)
+
+ self.qapp = QtGui.QApplication(sys.argv)
+
+ self._sample_rate = 2000e3
+
+ self.sps = 2
+ self.excess_bw = 0.35
+ self.gray_code = True
+
+ fftsize = 2048
+
+ self.data = scipy.random.randint(0, 255, 1000)
+ self.src = gr.vector_source_b(self.data.tolist(), True)
+ self.mod = blks2.dqpsk_mod(self.sps, self.excess_bw, self.gray_code, False, False)
+
+ self.rrctaps = gr.firdes.root_raised_cosine(1, self.sps, 1, self.excess_bw, 21)
+ self.rx_rrc = gr.fir_filter_ccf(1, self.rrctaps)
+
+
+ # Set up the carrier & clock recovery parameters
+ self.arity = 4
+ self.mu = 0.5
+ self.gain_mu = 0.05
+ self.omega = self.sps
+ self.gain_omega = .25 * self.gain_mu * self.gain_mu
+ self.omega_rel_lim = 0.05
+
+ self.alpha = 0.15
+ self.beta = 0.25 * self.alpha * self.alpha
+ self.fmin = -1000/self.sample_rate()
+ self.fmax = 1000/self.sample_rate()
+
+ self.receiver = gr.mpsk_receiver_cc(self.arity, 0,
+ self.alpha, self.beta,
+ self.fmin, self.fmax,
+ self.mu, self.gain_mu,
+ self.omega, self.gain_omega,
+ self.omega_rel_lim)
+
+
+ self.snr_dB = 15
+ noise = self.get_noise_voltage(self.snr_dB)
+ self.fo = 100/self.sample_rate()
+ self.to = 1.0
+ self.channel = gr.channel_model(noise, self.fo, self.to)
+
+ self.thr = gr.throttle(gr.sizeof_char, self._sample_rate)
+ self.snk_tx = qtgui.sink_c(fftsize, gr.firdes.WIN_BLACKMAN_hARRIS,
+ 0, self._sample_rate*self.sps,
+ "Tx", True, True, True, True)
+
+ self.snk_rx = qtgui.sink_c(fftsize, gr.firdes.WIN_BLACKMAN_hARRIS,
+ 0, self._sample_rate,
+ "Rx", True, True, True, True)
+
+ self.connect(self.src, self.thr, self.mod, self.channel, self.snk_tx)
+ self.connect(self.channel, self.rx_rrc, self.receiver, self.snk_rx)
+
+ pyTxQt = self.snk_tx.pyqwidget()
+ pyTx = sip.wrapinstance(pyTxQt, QtGui.QWidget)
+
+ pyRxQt = self.snk_rx.pyqwidget()
+ pyRx = sip.wrapinstance(pyRxQt, QtGui.QWidget)
+
+ self.main_box = dialog_box(pyTx, pyRx, self);
+ self.main_box.show()
+
+
+ def get_noise_voltage(self, SNR):
+ S = 0 # dBm, assuming signal power normalized
+ N = S - SNR # dBm
+ npwr = pow(10.0, N/10.0) # ratio
+ nv = scipy.sqrt(npwr * self.sps) # convert the noise voltage
+ return nv
+
+
+ # System Parameters
+ def sample_rate(self):
+ return self._sample_rate
+
+ def set_sample_rate(self, sr):
+ self._sample_rate = sr
+
+
+ # Channel Model Parameters
+ def snr(self):
+ return self.snr_dB
+
+ def set_snr(self, snr):
+ self.snr_dB = snr
+ noise = self.get_noise_voltage(self.snr_dB)
+ self.channel.set_noise_voltage(noise)
+
+ def frequency_offset(self):
+ return self.fo * self.sample_rate()
+
+ def set_frequency_offset(self, fo):
+ self.fo = fo / self.sample_rate()
+ self.channel.set_frequency_offset(self.fo)
+
+ def timing_offset(self):
+ return self.to
+
+ def set_timing_offset(self, to):
+ self.to = to
+ self.channel.set_timing_offset(self.to)
+
+
+ # Receiver Parameters
+ def rx_gain_mu(self):
+ return self.gain_mu
+
+ def rx_gain_omega(self):
+ return self.gain_omega
+
+ def set_rx_gain_mu(self, gain):
+ self.gain_mu = gain
+ self.gain_omega = .25 * self.gain_mu * self.gain_mu
+ self.receiver.set_gain_mu(self.gain_mu)
+ self.receiver.set_gain_omega(self.gain_omega)
+
+ def rx_alpha(self):
+ return self.alpha
+
+ def rx_beta(self):
+ return self.beta
+
+ def set_rx_alpha(self, alpha):
+ self.alpha = alpha
+ self.beta = .25 * self.alpha * self.alpha
+ self.receiver.set_alpha(self.alpha)
+ self.receiver.set_beta(self.beta)
+
+
+if __name__ == "__main__":
+ tb = my_top_block();
+ tb.start()
+ tb.qapp.exec_()
+ tb.stop()
diff --git a/gr-qtgui/apps/qt_digital_window.py b/gr-qtgui/apps/qt_digital_window.py
new file mode 100644
index 000000000..50dd53a92
--- /dev/null
+++ b/gr-qtgui/apps/qt_digital_window.py
@@ -0,0 +1,161 @@
+# -*- coding: utf-8 -*-
+
+# Form implementation generated from reading ui file 'qt_digital_window.ui'
+#
+# Created: Sat May 1 20:14:02 2010
+# by: PyQt4 UI code generator 4.6.1
+#
+# WARNING! All changes made in this file will be lost!
+
+from PyQt4 import QtCore, QtGui
+
+class Ui_DigitalWindow(object):
+ def setupUi(self, DigitalWindow):
+ DigitalWindow.setObjectName("DigitalWindow")
+ DigitalWindow.resize(1236, 741)
+ self.centralwidget = QtGui.QWidget(DigitalWindow)
+ self.centralwidget.setObjectName("centralwidget")
+ self.verticalLayout = QtGui.QVBoxLayout(self.centralwidget)
+ self.verticalLayout.setObjectName("verticalLayout")
+ self.sinkFrame = QtGui.QFrame(self.centralwidget)
+ self.sinkFrame.setMinimumSize(QtCore.QSize(0, 550))
+ self.sinkFrame.setFrameShape(QtGui.QFrame.StyledPanel)
+ self.sinkFrame.setFrameShadow(QtGui.QFrame.Raised)
+ self.sinkFrame.setObjectName("sinkFrame")
+ self.horizontalLayout_2 = QtGui.QHBoxLayout(self.sinkFrame)
+ self.horizontalLayout_2.setObjectName("horizontalLayout_2")
+ self.sinkLayout = QtGui.QHBoxLayout()
+ self.sinkLayout.setObjectName("sinkLayout")
+ self.horizontalLayout_2.addLayout(self.sinkLayout)
+ self.verticalLayout.addWidget(self.sinkFrame)
+ self.horizontalLayout = QtGui.QHBoxLayout()
+ self.horizontalLayout.setObjectName("horizontalLayout")
+ self.sysBox = QtGui.QGroupBox(self.centralwidget)
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.sysBox.sizePolicy().hasHeightForWidth())
+ self.sysBox.setSizePolicy(sizePolicy)
+ self.sysBox.setMinimumSize(QtCore.QSize(0, 0))
+ self.sysBox.setMaximumSize(QtCore.QSize(16777215, 120))
+ self.sysBox.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop)
+ self.sysBox.setObjectName("sysBox")
+ self.gridLayout_2 = QtGui.QGridLayout(self.sysBox)
+ self.gridLayout_2.setObjectName("gridLayout_2")
+ self.sampleRateEdit = QtGui.QLineEdit(self.sysBox)
+ self.sampleRateEdit.setMaximumSize(QtCore.QSize(100, 16777215))
+ self.sampleRateEdit.setObjectName("sampleRateEdit")
+ self.gridLayout_2.addWidget(self.sampleRateEdit, 0, 3, 1, 1)
+ self.sampleRateLabel = QtGui.QLabel(self.sysBox)
+ self.sampleRateLabel.setObjectName("sampleRateLabel")
+ self.gridLayout_2.addWidget(self.sampleRateLabel, 0, 2, 1, 1)
+ self.horizontalLayout.addWidget(self.sysBox)
+ self.rxBox = QtGui.QGroupBox(self.centralwidget)
+ self.rxBox.setMaximumSize(QtCore.QSize(16777215, 120))
+ self.rxBox.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop)
+ self.rxBox.setObjectName("rxBox")
+ self.gridLayout_3 = QtGui.QGridLayout(self.rxBox)
+ self.gridLayout_3.setObjectName("gridLayout_3")
+ self.alphaLabel = QtGui.QLabel(self.rxBox)
+ self.alphaLabel.setObjectName("alphaLabel")
+ self.gridLayout_3.addWidget(self.alphaLabel, 1, 0, 1, 1)
+ self.alphaEdit = QtGui.QLineEdit(self.rxBox)
+ self.alphaEdit.setMaximumSize(QtCore.QSize(100, 16777215))
+ self.alphaEdit.setObjectName("alphaEdit")
+ self.gridLayout_3.addWidget(self.alphaEdit, 1, 1, 1, 1)
+ self.gainMuLabel = QtGui.QLabel(self.rxBox)
+ self.gainMuLabel.setObjectName("gainMuLabel")
+ self.gridLayout_3.addWidget(self.gainMuLabel, 0, 0, 1, 1)
+ self.gainMuEdit = QtGui.QLineEdit(self.rxBox)
+ self.gainMuEdit.setMaximumSize(QtCore.QSize(100, 16777215))
+ self.gainMuEdit.setObjectName("gainMuEdit")
+ self.gridLayout_3.addWidget(self.gainMuEdit, 0, 1, 1, 1)
+ self.horizontalLayout.addWidget(self.rxBox)
+ self.channelModeBox = QtGui.QGroupBox(self.centralwidget)
+ self.channelModeBox.setMaximumSize(QtCore.QSize(16777215, 120))
+ self.channelModeBox.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop)
+ self.channelModeBox.setObjectName("channelModeBox")
+ self.gridLayout = QtGui.QGridLayout(self.channelModeBox)
+ self.gridLayout.setSizeConstraint(QtGui.QLayout.SetMinimumSize)
+ self.gridLayout.setObjectName("gridLayout")
+ self.snrLabel = QtGui.QLabel(self.channelModeBox)
+ self.snrLabel.setObjectName("snrLabel")
+ self.gridLayout.addWidget(self.snrLabel, 0, 1, 1, 1)
+ self.snrEdit = QtGui.QLineEdit(self.channelModeBox)
+ self.snrEdit.setMaximumSize(QtCore.QSize(100, 16777215))
+ self.snrEdit.setObjectName("snrEdit")
+ self.gridLayout.addWidget(self.snrEdit, 0, 2, 1, 1)
+ self.freqLabel = QtGui.QLabel(self.channelModeBox)
+ self.freqLabel.setObjectName("freqLabel")
+ self.gridLayout.addWidget(self.freqLabel, 1, 1, 1, 1)
+ self.freqEdit = QtGui.QLineEdit(self.channelModeBox)
+ self.freqEdit.setMaximumSize(QtCore.QSize(100, 16777215))
+ self.freqEdit.setObjectName("freqEdit")
+ self.gridLayout.addWidget(self.freqEdit, 1, 2, 1, 1)
+ self.timeLabel = QtGui.QLabel(self.channelModeBox)
+ self.timeLabel.setObjectName("timeLabel")
+ self.gridLayout.addWidget(self.timeLabel, 2, 1, 1, 1)
+ self.timeEdit = QtGui.QLineEdit(self.channelModeBox)
+ self.timeEdit.setMaximumSize(QtCore.QSize(100, 16777215))
+ self.timeEdit.setObjectName("timeEdit")
+ self.gridLayout.addWidget(self.timeEdit, 2, 2, 1, 1)
+ self.horizontalLayout.addWidget(self.channelModeBox)
+ spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+ self.horizontalLayout.addItem(spacerItem)
+ self.verticalLayout_2 = QtGui.QVBoxLayout()
+ self.verticalLayout_2.setObjectName("verticalLayout_2")
+ spacerItem1 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
+ self.verticalLayout_2.addItem(spacerItem1)
+ self.pauseButton = QtGui.QPushButton(self.centralwidget)
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.pauseButton.sizePolicy().hasHeightForWidth())
+ self.pauseButton.setSizePolicy(sizePolicy)
+ self.pauseButton.setMaximumSize(QtCore.QSize(80, 16777215))
+ self.pauseButton.setObjectName("pauseButton")
+ self.verticalLayout_2.addWidget(self.pauseButton)
+ self.closeButton = QtGui.QPushButton(self.centralwidget)
+ self.closeButton.setMaximumSize(QtCore.QSize(80, 16777215))
+ self.closeButton.setObjectName("closeButton")
+ self.verticalLayout_2.addWidget(self.closeButton)
+ self.horizontalLayout.addLayout(self.verticalLayout_2)
+ self.verticalLayout.addLayout(self.horizontalLayout)
+ DigitalWindow.setCentralWidget(self.centralwidget)
+ self.menubar = QtGui.QMenuBar(DigitalWindow)
+ self.menubar.setGeometry(QtCore.QRect(0, 0, 1236, 23))
+ self.menubar.setObjectName("menubar")
+ self.menuFile = QtGui.QMenu(self.menubar)
+ self.menuFile.setObjectName("menuFile")
+ DigitalWindow.setMenuBar(self.menubar)
+ self.statusbar = QtGui.QStatusBar(DigitalWindow)
+ self.statusbar.setObjectName("statusbar")
+ DigitalWindow.setStatusBar(self.statusbar)
+ self.actionExit = QtGui.QAction(DigitalWindow)
+ self.actionExit.setObjectName("actionExit")
+ self.menuFile.addAction(self.actionExit)
+ self.menubar.addAction(self.menuFile.menuAction())
+
+ self.retranslateUi(DigitalWindow)
+ QtCore.QObject.connect(self.closeButton, QtCore.SIGNAL("clicked()"), DigitalWindow.close)
+ QtCore.QObject.connect(self.actionExit, QtCore.SIGNAL("triggered()"), DigitalWindow.close)
+ QtCore.QMetaObject.connectSlotsByName(DigitalWindow)
+ DigitalWindow.setTabOrder(self.snrEdit, self.freqEdit)
+ DigitalWindow.setTabOrder(self.freqEdit, self.timeEdit)
+
+ def retranslateUi(self, DigitalWindow):
+ DigitalWindow.setWindowTitle(QtGui.QApplication.translate("DigitalWindow", "MainWindow", None, QtGui.QApplication.UnicodeUTF8))
+ self.sysBox.setTitle(QtGui.QApplication.translate("DigitalWindow", "System Parameters", None, QtGui.QApplication.UnicodeUTF8))
+ self.sampleRateLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Sample Rate (sps)", None, QtGui.QApplication.UnicodeUTF8))
+ self.rxBox.setTitle(QtGui.QApplication.translate("DigitalWindow", "Receiver Parameters", None, QtGui.QApplication.UnicodeUTF8))
+ self.alphaLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Alpha", None, QtGui.QApplication.UnicodeUTF8))
+ self.gainMuLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Gain mu", None, QtGui.QApplication.UnicodeUTF8))
+ self.channelModeBox.setTitle(QtGui.QApplication.translate("DigitalWindow", "Channel Model Parameters", None, QtGui.QApplication.UnicodeUTF8))
+ self.snrLabel.setText(QtGui.QApplication.translate("DigitalWindow", "SNR (dB)", None, QtGui.QApplication.UnicodeUTF8))
+ self.freqLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Frequency Offset (Hz)", None, QtGui.QApplication.UnicodeUTF8))
+ self.timeLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Timing Offset", None, QtGui.QApplication.UnicodeUTF8))
+ self.pauseButton.setText(QtGui.QApplication.translate("DigitalWindow", "Pause", None, QtGui.QApplication.UnicodeUTF8))
+ self.closeButton.setText(QtGui.QApplication.translate("DigitalWindow", "Close", None, QtGui.QApplication.UnicodeUTF8))
+ self.menuFile.setTitle(QtGui.QApplication.translate("DigitalWindow", "&File", None, QtGui.QApplication.UnicodeUTF8))
+ self.actionExit.setText(QtGui.QApplication.translate("DigitalWindow", "E&xit", None, QtGui.QApplication.UnicodeUTF8))
+
diff --git a/gr-qtgui/apps/qt_digital_window.ui b/gr-qtgui/apps/qt_digital_window.ui
new file mode 100644
index 000000000..967252181
--- /dev/null
+++ b/gr-qtgui/apps/qt_digital_window.ui
@@ -0,0 +1,342 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>DigitalWindow</class>
+ <widget class="QMainWindow" name="DigitalWindow">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>1236</width>
+ <height>741</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>MainWindow</string>
+ </property>
+ <widget class="QWidget" name="centralwidget">
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QFrame" name="sinkFrame">
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>550</height>
+ </size>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::StyledPanel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Raised</enum>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <layout class="QHBoxLayout" name="sinkLayout"/>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QGroupBox" name="sysBox">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>16777215</width>
+ <height>120</height>
+ </size>
+ </property>
+ <property name="title">
+ <string>System Parameters</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
+ </property>
+ <layout class="QGridLayout" name="gridLayout_2">
+ <item row="0" column="3">
+ <widget class="QLineEdit" name="sampleRateEdit">
+ <property name="maximumSize">
+ <size>
+ <width>100</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="2">
+ <widget class="QLabel" name="sampleRateLabel">
+ <property name="text">
+ <string>Sample Rate (sps)</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="rxBox">
+ <property name="maximumSize">
+ <size>
+ <width>16777215</width>
+ <height>120</height>
+ </size>
+ </property>
+ <property name="title">
+ <string>Receiver Parameters</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
+ </property>
+ <layout class="QGridLayout" name="gridLayout_3">
+ <item row="1" column="0">
+ <widget class="QLabel" name="alphaLabel">
+ <property name="text">
+ <string>Alpha</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QLineEdit" name="alphaEdit">
+ <property name="maximumSize">
+ <size>
+ <width>100</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="0">
+ <widget class="QLabel" name="gainMuLabel">
+ <property name="text">
+ <string>Gain mu</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QLineEdit" name="gainMuEdit">
+ <property name="maximumSize">
+ <size>
+ <width>100</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="channelModeBox">
+ <property name="maximumSize">
+ <size>
+ <width>16777215</width>
+ <height>120</height>
+ </size>
+ </property>
+ <property name="title">
+ <string>Channel Model Parameters</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
+ </property>
+ <layout class="QGridLayout" name="gridLayout">
+ <property name="sizeConstraint">
+ <enum>QLayout::SetMinimumSize</enum>
+ </property>
+ <item row="0" column="1">
+ <widget class="QLabel" name="snrLabel">
+ <property name="text">
+ <string>SNR (dB)</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="2">
+ <widget class="QLineEdit" name="snrEdit">
+ <property name="maximumSize">
+ <size>
+ <width>100</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QLabel" name="freqLabel">
+ <property name="text">
+ <string>Frequency Offset (Hz)</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="2">
+ <widget class="QLineEdit" name="freqEdit">
+ <property name="maximumSize">
+ <size>
+ <width>100</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QLabel" name="timeLabel">
+ <property name="text">
+ <string>Timing Offset</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="2">
+ <widget class="QLineEdit" name="timeEdit">
+ <property name="maximumSize">
+ <size>
+ <width>100</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QPushButton" name="pauseButton">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>80</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Pause</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="closeButton">
+ <property name="maximumSize">
+ <size>
+ <width>80</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Close</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QMenuBar" name="menubar">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>1236</width>
+ <height>23</height>
+ </rect>
+ </property>
+ <widget class="QMenu" name="menuFile">
+ <property name="title">
+ <string>&amp;File</string>
+ </property>
+ <addaction name="actionExit"/>
+ </widget>
+ <addaction name="menuFile"/>
+ </widget>
+ <widget class="QStatusBar" name="statusbar"/>
+ <action name="actionExit">
+ <property name="text">
+ <string>E&amp;xit</string>
+ </property>
+ </action>
+ </widget>
+ <tabstops>
+ <tabstop>snrEdit</tabstop>
+ <tabstop>freqEdit</tabstop>
+ <tabstop>timeEdit</tabstop>
+ </tabstops>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>closeButton</sender>
+ <signal>clicked()</signal>
+ <receiver>DigitalWindow</receiver>
+ <slot>close()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>322</x>
+ <y>623</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>66</x>
+ <y>561</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>actionExit</sender>
+ <signal>triggered()</signal>
+ <receiver>DigitalWindow</receiver>
+ <slot>close()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>-1</x>
+ <y>-1</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>617</x>
+ <y>327</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>
diff --git a/gr-qtgui/apps/uhd_display.py b/gr-qtgui/apps/uhd_display.py
new file mode 100755
index 000000000..d02fbad9e
--- /dev/null
+++ b/gr-qtgui/apps/uhd_display.py
@@ -0,0 +1,317 @@
+#!/usr/bin/env python
+#
+# Copyright 2009,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.
+#
+
+from gnuradio import gr
+from gnuradio import uhd
+from gnuradio import eng_notation
+from gnuradio.eng_option import eng_option
+from gnuradio.qtgui import qtgui
+from optparse import OptionParser
+import sys
+
+try:
+ from gnuradio.qtgui import qtgui
+ from PyQt4 import QtGui, QtCore
+ import sip
+except ImportError:
+ print "Error: Program requires PyQt4 and gr-qtgui."
+ sys.exit(1)
+
+try:
+ from usrp_display_qtgui import Ui_MainWindow
+except ImportError:
+ print "Error: could not find usrp_display_qtgui.py:"
+ print "\t\"pyuic4 usrp_display_qtgui.ui -o usrp_display_qtgui.py\""
+ sys.exit(1)
+
+
+# ////////////////////////////////////////////////////////////////////
+# Define the QT Interface and Control Dialog
+# ////////////////////////////////////////////////////////////////////
+
+
+class main_window(QtGui.QMainWindow):
+ def __init__(self, snk, fg, parent=None):
+
+ QtGui.QWidget.__init__(self, parent)
+ self.gui = Ui_MainWindow()
+ self.gui.setupUi(self)
+
+ self.fg = fg
+
+ # Add the qtsnk widgets to the layout box
+ self.gui.sinkLayout.addWidget(snk)
+
+ self.gui.dcGainEdit.setText(QtCore.QString("%1").arg(0.001))
+
+ # Connect up some signals
+ self.connect(self.gui.pauseButton, QtCore.SIGNAL("clicked()"),
+ self.pauseFg)
+ self.connect(self.gui.frequencyEdit, QtCore.SIGNAL("editingFinished()"),
+ self.frequencyEditText)
+ self.connect(self.gui.gainEdit, QtCore.SIGNAL("editingFinished()"),
+ self.gainEditText)
+ self.connect(self.gui.bandwidthEdit, QtCore.SIGNAL("editingFinished()"),
+ self.bandwidthEditText)
+ self.connect(self.gui.amplifierEdit, QtCore.SIGNAL("editingFinished()"),
+ self.amplifierEditText)
+
+ self.connect(self.gui.actionSaveData, QtCore.SIGNAL("activated()"),
+ self.saveData)
+ self.gui.actionSaveData.setShortcut(QtGui.QKeySequence.Save)
+
+ self.connect(self.gui.dcGainEdit, QtCore.SIGNAL("editingFinished()"),
+ self.dcGainEditText)
+ self.connect(self.gui.dcCancelCheckBox, QtCore.SIGNAL("clicked(bool)"),
+ self.dcCancelClicked)
+
+ def pauseFg(self):
+ if(self.gui.pauseButton.text() == "Pause"):
+ self.fg.stop()
+ self.fg.wait()
+ self.gui.pauseButton.setText("Unpause")
+ else:
+ self.fg.start()
+ self.gui.pauseButton.setText("Pause")
+
+
+ # Functions to set the values in the GUI
+ def set_frequency(self, freq):
+ self.freq = freq
+ sfreq = eng_notation.num_to_str(self.freq)
+ self.gui.frequencyEdit.setText(QtCore.QString("%1").arg(sfreq))
+
+ def set_gain(self, gain):
+ self.gain = gain
+ self.gui.gainEdit.setText(QtCore.QString("%1").arg(self.gain))
+
+ def set_bandwidth(self, bw):
+ self.bw = bw
+ sbw = eng_notation.num_to_str(self.bw)
+ self.gui.bandwidthEdit.setText(QtCore.QString("%1").arg(sbw))
+
+ def set_amplifier(self, amp):
+ self.amp = amp
+ self.gui.amplifierEdit.setText(QtCore.QString("%1").arg(self.amp))
+
+
+ # Functions called when signals are triggered in the GUI
+ def frequencyEditText(self):
+ try:
+ freq = eng_notation.str_to_num(self.gui.frequencyEdit.text().toAscii())
+ self.fg.set_frequency(freq)
+ self.freq = freq
+ except RuntimeError:
+ pass
+
+ def gainEditText(self):
+ try:
+ gain = float(self.gui.gainEdit.text())
+ self.fg.set_gain(gain)
+ self.gain = gain
+ except ValueError:
+ pass
+
+ def bandwidthEditText(self):
+ try:
+ bw = eng_notation.str_to_num(self.gui.bandwidthEdit.text().toAscii())
+ self.fg.set_bandwidth(bw)
+ self.bw = bw
+ except ValueError:
+ pass
+
+ def amplifierEditText(self):
+ try:
+ amp = float(self.gui.amplifierEdit.text())
+ self.fg.set_amplifier_gain(amp)
+ self.amp = amp
+ except ValueError:
+ pass
+
+ def saveData(self):
+ fileName = QtGui.QFileDialog.getSaveFileName(self, "Save data to file", ".");
+ if(len(fileName)):
+ self.fg.save_to_file(str(fileName))
+
+ def dcGainEditText(self):
+ gain = float(self.gui.dcGainEdit.text())
+ self.fg.set_dc_gain(gain)
+
+ def dcCancelClicked(self, state):
+ self.dcGainEditText()
+ self.fg.cancel_dc(state)
+
+
+
+class my_top_block(gr.top_block):
+ def __init__(self, options):
+ gr.top_block.__init__(self)
+
+ self.options = options
+ self.show_debug_info = True
+
+ self.qapp = QtGui.QApplication(sys.argv)
+
+ self.u = uhd.usrp_source(device_addr=options.address, stream_args=uhd.stream_args('fc32'))
+
+ if(options.antenna):
+ self.u.set_antenna(options.antenna, 0)
+
+ self.set_bandwidth(options.samp_rate)
+
+ if options.gain is None:
+ # if no gain was specified, use the mid-point in dB
+ g = self.u.get_gain_range()
+ options.gain = float(g.start()+g.stop())/2
+ self.set_gain(options.gain)
+
+ if options.freq is None:
+ # if no freq was specified, use the mid-point
+ r = self.u.get_freq_range()
+ options.freq = float(r.start()+r.stop())/2
+ self.set_frequency(options.freq)
+
+ self._fftsize = options.fft_size
+
+ self.snk = qtgui.sink_c(options.fft_size,
+ gr.firdes.WIN_BLACKMAN_hARRIS,
+ self._freq, self._bandwidth,
+ "UHD Display",
+ True, True, True, False)
+
+ # Set up internal amplifier
+ self.amp = gr.multiply_const_cc(0.0)
+ self.set_amplifier_gain(100)
+
+ # Create a single-pole IIR filter to remove DC
+ # but don't connect it yet
+ self.dc_gain = 0.001
+ self.dc = gr.single_pole_iir_filter_cc(self.dc_gain)
+ self.dc_sub = gr.sub_cc()
+
+ self.connect(self.u, self.amp, self.snk)
+
+ if self.show_debug_info:
+ print "Bandwidth: ", self.u.get_samp_rate()
+ print "Center Freq: ", self.u.get_center_freq()
+ print "Freq Range: ", self.u.get_freq_range()
+
+ # Get the reference pointer to the SpectrumDisplayForm QWidget
+ # Wrap the pointer as a PyQt SIP object
+ # This can now be manipulated as a PyQt4.QtGui.QWidget
+ self.pysink = sip.wrapinstance(self.snk.pyqwidget(), QtGui.QWidget)
+
+ self.main_win = main_window(self.pysink, self)
+
+ self.main_win.set_frequency(self._freq)
+ self.main_win.set_gain(self._gain)
+ self.main_win.set_bandwidth(self._bandwidth)
+ self.main_win.set_amplifier(self._amp_value)
+
+ self.main_win.show()
+
+
+ def save_to_file(self, name):
+ self.lock()
+
+ # Add file sink to save data
+ self.file_sink = gr.file_sink(gr.sizeof_gr_complex, name)
+ self.connect(self.amp, self.file_sink)
+
+ self.unlock()
+
+ def set_gain(self, gain):
+ self._gain = gain
+ self.u.set_gain(self._gain)
+
+ def set_frequency(self, freq):
+ self._freq = freq
+ r = self.u.set_center_freq(freq)
+
+ try:
+ self.snk.set_frequency_range(self._freq, self._bandwidth)
+ except:
+ pass
+
+ def set_bandwidth(self, bw):
+ self._bandwidth = bw
+ self.u.set_samp_rate(self._bandwidth)
+
+ try:
+ self.snk.set_frequency_range(self._freq, self._bandwidth)
+ except:
+ pass
+
+ def set_amplifier_gain(self, amp):
+ self._amp_value = amp
+ self.amp.set_k(self._amp_value)
+
+ def set_dc_gain(self, gain):
+ self.dc.set_taps(gain)
+
+ def cancel_dc(self, state):
+ self.lock()
+
+ if(state):
+ self.disconnect(self.u, self.amp)
+ self.connect(self.u, (self.dc_sub,0))
+ self.connect(self.u, self.dc, (self.dc_sub,1))
+ self.connect(self.dc_sub, self.amp)
+ else:
+ self.disconnect(self.dc_sub, self.amp)
+ self.disconnect(self.dc, (self.dc_sub,1))
+ self.disconnect(self.u, self.dc)
+ self.disconnect(self.u, (self.dc_sub,0))
+ self.connect(self.u, self.amp)
+
+ self.unlock()
+
+def main ():
+ parser = OptionParser(option_class=eng_option)
+ parser.add_option("-a", "--address", type="string", default="addr=192.168.10.2",
+ help="Address of UHD device, [default=%default]")
+ parser.add_option("-A", "--antenna", type="string", default=None,
+ help="select Rx Antenna where appropriate")
+ parser.add_option("-s", "--samp-rate", type="eng_float", default=1e6,
+ help="set sample rate (bandwidth) [default=%default]")
+ parser.add_option("-f", "--freq", type="eng_float", default=2412e6,
+ help="set frequency to FREQ", metavar="FREQ")
+ parser.add_option("-g", "--gain", type="eng_float", default=None,
+ help="set gain in dB (default is midpoint)")
+ parser.add_option("--fft-size", type="int", default=2048,
+ help="Set number of FFT bins [default=%default]")
+ (options, args) = parser.parse_args()
+
+ if len(args) != 0:
+ parser.print_help()
+ sys.exit(1)
+
+ tb = my_top_block(options)
+ tb.start()
+ tb.snk.exec_();
+
+if __name__ == '__main__':
+ try:
+ main ()
+ except KeyboardInterrupt:
+ pass
+
diff --git a/gr-qtgui/apps/usrp_display_qtgui.py b/gr-qtgui/apps/usrp_display_qtgui.py
new file mode 100644
index 000000000..4c9de3a53
--- /dev/null
+++ b/gr-qtgui/apps/usrp_display_qtgui.py
@@ -0,0 +1,191 @@
+# -*- coding: utf-8 -*-
+
+# Form implementation generated from reading ui file 'usrp_display_qtgui.ui'
+#
+# Created: Thu Jul 16 22:06:24 2009
+# by: PyQt4 UI code generator 4.4.3
+#
+# WARNING! All changes made in this file will be lost!
+
+from PyQt4 import QtCore, QtGui
+
+class Ui_MainWindow(object):
+ def setupUi(self, MainWindow):
+ MainWindow.setObjectName("MainWindow")
+ MainWindow.resize(820, 774)
+ self.centralwidget = QtGui.QWidget(MainWindow)
+ self.centralwidget.setObjectName("centralwidget")
+ self.gridLayout_2 = QtGui.QGridLayout(self.centralwidget)
+ self.gridLayout_2.setObjectName("gridLayout_2")
+ self.horizontalLayout_2 = QtGui.QHBoxLayout()
+ self.horizontalLayout_2.setObjectName("horizontalLayout_2")
+ self.groupBox = QtGui.QGroupBox(self.centralwidget)
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.groupBox.sizePolicy().hasHeightForWidth())
+ self.groupBox.setSizePolicy(sizePolicy)
+ self.groupBox.setMinimumSize(QtCore.QSize(240, 150))
+ self.groupBox.setMaximumSize(QtCore.QSize(240, 16777215))
+ self.groupBox.setObjectName("groupBox")
+ self.formLayoutWidget = QtGui.QWidget(self.groupBox)
+ self.formLayoutWidget.setGeometry(QtCore.QRect(10, 20, 221, 124))
+ self.formLayoutWidget.setObjectName("formLayoutWidget")
+ self.formLayout = QtGui.QFormLayout(self.formLayoutWidget)
+ self.formLayout.setObjectName("formLayout")
+ self.frequencyLabel = QtGui.QLabel(self.formLayoutWidget)
+ self.frequencyLabel.setObjectName("frequencyLabel")
+ self.formLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.frequencyLabel)
+ self.gainLabel = QtGui.QLabel(self.formLayoutWidget)
+ self.gainLabel.setObjectName("gainLabel")
+ self.formLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.gainLabel)
+ self.bandwidthLabel = QtGui.QLabel(self.formLayoutWidget)
+ self.bandwidthLabel.setObjectName("bandwidthLabel")
+ self.formLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.bandwidthLabel)
+ self.frequencyEdit = QtGui.QLineEdit(self.formLayoutWidget)
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.frequencyEdit.sizePolicy().hasHeightForWidth())
+ self.frequencyEdit.setSizePolicy(sizePolicy)
+ self.frequencyEdit.setMinimumSize(QtCore.QSize(120, 26))
+ self.frequencyEdit.setObjectName("frequencyEdit")
+ self.formLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.frequencyEdit)
+ self.gainEdit = QtGui.QLineEdit(self.formLayoutWidget)
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.gainEdit.sizePolicy().hasHeightForWidth())
+ self.gainEdit.setSizePolicy(sizePolicy)
+ self.gainEdit.setMinimumSize(QtCore.QSize(120, 26))
+ self.gainEdit.setObjectName("gainEdit")
+ self.formLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.gainEdit)
+ self.bandwidthEdit = QtGui.QLineEdit(self.formLayoutWidget)
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.bandwidthEdit.sizePolicy().hasHeightForWidth())
+ self.bandwidthEdit.setSizePolicy(sizePolicy)
+ self.bandwidthEdit.setMinimumSize(QtCore.QSize(120, 26))
+ self.bandwidthEdit.setObjectName("bandwidthEdit")
+ self.formLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.bandwidthEdit)
+ self.amplifierLabel = QtGui.QLabel(self.formLayoutWidget)
+ self.amplifierLabel.setObjectName("amplifierLabel")
+ self.formLayout.setWidget(3, QtGui.QFormLayout.LabelRole, self.amplifierLabel)
+ self.amplifierEdit = QtGui.QLineEdit(self.formLayoutWidget)
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.amplifierEdit.sizePolicy().hasHeightForWidth())
+ self.amplifierEdit.setSizePolicy(sizePolicy)
+ self.amplifierEdit.setMinimumSize(QtCore.QSize(120, 26))
+ self.amplifierEdit.setObjectName("amplifierEdit")
+ self.formLayout.setWidget(3, QtGui.QFormLayout.FieldRole, self.amplifierEdit)
+ self.horizontalLayout_2.addWidget(self.groupBox)
+ self.frame_2 = QtGui.QFrame(self.centralwidget)
+ self.frame_2.setMinimumSize(QtCore.QSize(200, 0))
+ self.frame_2.setFrameShape(QtGui.QFrame.StyledPanel)
+ self.frame_2.setFrameShadow(QtGui.QFrame.Raised)
+ self.frame_2.setObjectName("frame_2")
+ self.verticalLayoutWidget = QtGui.QWidget(self.frame_2)
+ self.verticalLayoutWidget.setGeometry(QtCore.QRect(10, -1, 191, 151))
+ self.verticalLayoutWidget.setObjectName("verticalLayoutWidget")
+ self.verticalLayout_3 = QtGui.QVBoxLayout(self.verticalLayoutWidget)
+ self.verticalLayout_3.setObjectName("verticalLayout_3")
+ self.dcCancelCheckBox = QtGui.QCheckBox(self.verticalLayoutWidget)
+ self.dcCancelCheckBox.setObjectName("dcCancelCheckBox")
+ self.verticalLayout_3.addWidget(self.dcCancelCheckBox)
+ self.horizontalLayout = QtGui.QHBoxLayout()
+ self.horizontalLayout.setObjectName("horizontalLayout")
+ self.dcGainLabel = QtGui.QLabel(self.verticalLayoutWidget)
+ self.dcGainLabel.setObjectName("dcGainLabel")
+ self.horizontalLayout.addWidget(self.dcGainLabel)
+ self.dcGainEdit = QtGui.QLineEdit(self.verticalLayoutWidget)
+ self.dcGainEdit.setObjectName("dcGainEdit")
+ self.horizontalLayout.addWidget(self.dcGainEdit)
+ self.verticalLayout_3.addLayout(self.horizontalLayout)
+ spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
+ self.verticalLayout_3.addItem(spacerItem)
+ self.horizontalLayout_2.addWidget(self.frame_2)
+ spacerItem1 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+ self.horizontalLayout_2.addItem(spacerItem1)
+ self.verticalLayout = QtGui.QVBoxLayout()
+ self.verticalLayout.setObjectName("verticalLayout")
+ spacerItem2 = QtGui.QSpacerItem(20, 80, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed)
+ self.verticalLayout.addItem(spacerItem2)
+ self.pauseButton = QtGui.QPushButton(self.centralwidget)
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.pauseButton.sizePolicy().hasHeightForWidth())
+ self.pauseButton.setSizePolicy(sizePolicy)
+ self.pauseButton.setObjectName("pauseButton")
+ self.verticalLayout.addWidget(self.pauseButton)
+ self.closeButton = QtGui.QPushButton(self.centralwidget)
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.closeButton.sizePolicy().hasHeightForWidth())
+ self.closeButton.setSizePolicy(sizePolicy)
+ self.closeButton.setMinimumSize(QtCore.QSize(75, 0))
+ self.closeButton.setObjectName("closeButton")
+ self.verticalLayout.addWidget(self.closeButton)
+ self.horizontalLayout_2.addLayout(self.verticalLayout)
+ self.gridLayout_2.addLayout(self.horizontalLayout_2, 1, 0, 1, 1)
+ self.verticalLayout_2 = QtGui.QVBoxLayout()
+ self.verticalLayout_2.setObjectName("verticalLayout_2")
+ self.frame = QtGui.QFrame(self.centralwidget)
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(1)
+ sizePolicy.setHeightForWidth(self.frame.sizePolicy().hasHeightForWidth())
+ self.frame.setSizePolicy(sizePolicy)
+ self.frame.setMinimumSize(QtCore.QSize(800, 550))
+ self.frame.setFrameShape(QtGui.QFrame.StyledPanel)
+ self.frame.setFrameShadow(QtGui.QFrame.Raised)
+ self.frame.setObjectName("frame")
+ self.gridLayout = QtGui.QGridLayout(self.frame)
+ self.gridLayout.setObjectName("gridLayout")
+ self.sinkLayout = QtGui.QHBoxLayout()
+ self.sinkLayout.setObjectName("sinkLayout")
+ self.gridLayout.addLayout(self.sinkLayout, 0, 0, 1, 1)
+ self.verticalLayout_2.addWidget(self.frame)
+ self.gridLayout_2.addLayout(self.verticalLayout_2, 0, 0, 1, 1)
+ MainWindow.setCentralWidget(self.centralwidget)
+ self.menubar = QtGui.QMenuBar(MainWindow)
+ self.menubar.setGeometry(QtCore.QRect(0, 0, 820, 24))
+ self.menubar.setObjectName("menubar")
+ self.menuFile = QtGui.QMenu(self.menubar)
+ self.menuFile.setObjectName("menuFile")
+ MainWindow.setMenuBar(self.menubar)
+ self.statusbar = QtGui.QStatusBar(MainWindow)
+ self.statusbar.setObjectName("statusbar")
+ MainWindow.setStatusBar(self.statusbar)
+ self.actionExit = QtGui.QAction(MainWindow)
+ self.actionExit.setObjectName("actionExit")
+ self.actionSaveData = QtGui.QAction(MainWindow)
+ self.actionSaveData.setObjectName("actionSaveData")
+ self.menuFile.addAction(self.actionSaveData)
+ self.menuFile.addAction(self.actionExit)
+ self.menubar.addAction(self.menuFile.menuAction())
+
+ self.retranslateUi(MainWindow)
+ QtCore.QObject.connect(self.closeButton, QtCore.SIGNAL("clicked()"), MainWindow.close)
+ QtCore.QObject.connect(self.actionExit, QtCore.SIGNAL("triggered()"), MainWindow.close)
+ QtCore.QMetaObject.connectSlotsByName(MainWindow)
+
+ def retranslateUi(self, MainWindow):
+ MainWindow.setWindowTitle(QtGui.QApplication.translate("MainWindow", "USRP Display", None, QtGui.QApplication.UnicodeUTF8))
+ self.groupBox.setTitle(QtGui.QApplication.translate("MainWindow", "Receiver Parameters", None, QtGui.QApplication.UnicodeUTF8))
+ self.frequencyLabel.setText(QtGui.QApplication.translate("MainWindow", "Frequency (Hz)", None, QtGui.QApplication.UnicodeUTF8))
+ self.gainLabel.setText(QtGui.QApplication.translate("MainWindow", "RF Gain", None, QtGui.QApplication.UnicodeUTF8))
+ self.bandwidthLabel.setText(QtGui.QApplication.translate("MainWindow", "Bandwidth", None, QtGui.QApplication.UnicodeUTF8))
+ self.amplifierLabel.setText(QtGui.QApplication.translate("MainWindow", "Amplifier", None, QtGui.QApplication.UnicodeUTF8))
+ self.dcCancelCheckBox.setText(QtGui.QApplication.translate("MainWindow", "Cancel DC", None, QtGui.QApplication.UnicodeUTF8))
+ self.dcGainLabel.setText(QtGui.QApplication.translate("MainWindow", "DC Canceller Gain", None, QtGui.QApplication.UnicodeUTF8))
+ self.pauseButton.setText(QtGui.QApplication.translate("MainWindow", "Pause", None, QtGui.QApplication.UnicodeUTF8))
+ self.closeButton.setText(QtGui.QApplication.translate("MainWindow", "Close", None, QtGui.QApplication.UnicodeUTF8))
+ self.menuFile.setTitle(QtGui.QApplication.translate("MainWindow", "&File", None, QtGui.QApplication.UnicodeUTF8))
+ self.actionExit.setText(QtGui.QApplication.translate("MainWindow", "E&xit", None, QtGui.QApplication.UnicodeUTF8))
+ self.actionSaveData.setText(QtGui.QApplication.translate("MainWindow", "&Save Data", None, QtGui.QApplication.UnicodeUTF8))
+
diff --git a/gr-qtgui/apps/usrp_display_qtgui.ui b/gr-qtgui/apps/usrp_display_qtgui.ui
new file mode 100644
index 000000000..e88ca9dce
--- /dev/null
+++ b/gr-qtgui/apps/usrp_display_qtgui.ui
@@ -0,0 +1,375 @@
+<ui version="4.0" >
+ <class>MainWindow</class>
+ <widget class="QMainWindow" name="MainWindow" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>820</width>
+ <height>774</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>USRP Display</string>
+ </property>
+ <widget class="QWidget" name="centralwidget" >
+ <layout class="QGridLayout" name="gridLayout_2" >
+ <item row="1" column="0" >
+ <layout class="QHBoxLayout" name="horizontalLayout_2" >
+ <item>
+ <widget class="QGroupBox" name="groupBox" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize" >
+ <size>
+ <width>240</width>
+ <height>150</height>
+ </size>
+ </property>
+ <property name="maximumSize" >
+ <size>
+ <width>240</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="title" >
+ <string>Receiver Parameters</string>
+ </property>
+ <widget class="QWidget" name="formLayoutWidget" >
+ <property name="geometry" >
+ <rect>
+ <x>10</x>
+ <y>20</y>
+ <width>221</width>
+ <height>124</height>
+ </rect>
+ </property>
+ <layout class="QFormLayout" name="formLayout" >
+ <item row="0" column="0" >
+ <widget class="QLabel" name="frequencyLabel" >
+ <property name="text" >
+ <string>Frequency (Hz)</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" >
+ <widget class="QLabel" name="gainLabel" >
+ <property name="text" >
+ <string>RF Gain</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0" >
+ <widget class="QLabel" name="bandwidthLabel" >
+ <property name="text" >
+ <string>Bandwidth</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1" >
+ <widget class="QLineEdit" name="frequencyEdit" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize" >
+ <size>
+ <width>120</width>
+ <height>26</height>
+ </size>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1" >
+ <widget class="QLineEdit" name="gainEdit" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize" >
+ <size>
+ <width>120</width>
+ <height>26</height>
+ </size>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1" >
+ <widget class="QLineEdit" name="bandwidthEdit" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize" >
+ <size>
+ <width>120</width>
+ <height>26</height>
+ </size>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0" >
+ <widget class="QLabel" name="amplifierLabel" >
+ <property name="text" >
+ <string>Amplifier</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="1" >
+ <widget class="QLineEdit" name="amplifierEdit" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize" >
+ <size>
+ <width>120</width>
+ <height>26</height>
+ </size>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ </item>
+ <item>
+ <widget class="QFrame" name="frame_2" >
+ <property name="minimumSize" >
+ <size>
+ <width>200</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="frameShape" >
+ <enum>QFrame::StyledPanel</enum>
+ </property>
+ <property name="frameShadow" >
+ <enum>QFrame::Raised</enum>
+ </property>
+ <widget class="QWidget" name="verticalLayoutWidget" >
+ <property name="geometry" >
+ <rect>
+ <x>10</x>
+ <y>-1</y>
+ <width>191</width>
+ <height>151</height>
+ </rect>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_3" >
+ <item>
+ <widget class="QCheckBox" name="dcCancelCheckBox" >
+ <property name="text" >
+ <string>Cancel DC</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout" >
+ <item>
+ <widget class="QLabel" name="dcGainLabel" >
+ <property name="text" >
+ <string>DC Canceller Gain</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="dcGainEdit" />
+ </item>
+ </layout>
+ </item>
+ <item>
+ <spacer name="verticalSpacer_2" >
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0" >
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer" >
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0" >
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout" >
+ <item>
+ <spacer name="verticalSpacer" >
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeType" >
+ <enum>QSizePolicy::Fixed</enum>
+ </property>
+ <property name="sizeHint" stdset="0" >
+ <size>
+ <width>20</width>
+ <height>80</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QPushButton" name="pauseButton" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text" >
+ <string>Pause</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="closeButton" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize" >
+ <size>
+ <width>75</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text" >
+ <string>Close</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </item>
+ <item row="0" column="0" >
+ <layout class="QVBoxLayout" name="verticalLayout_2" >
+ <item>
+ <widget class="QFrame" name="frame" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
+ <horstretch>0</horstretch>
+ <verstretch>1</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize" >
+ <size>
+ <width>800</width>
+ <height>550</height>
+ </size>
+ </property>
+ <property name="frameShape" >
+ <enum>QFrame::StyledPanel</enum>
+ </property>
+ <property name="frameShadow" >
+ <enum>QFrame::Raised</enum>
+ </property>
+ <layout class="QGridLayout" name="gridLayout" >
+ <item row="0" column="0" >
+ <layout class="QHBoxLayout" name="sinkLayout" />
+ </item>
+ </layout>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QMenuBar" name="menubar" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>820</width>
+ <height>24</height>
+ </rect>
+ </property>
+ <widget class="QMenu" name="menuFile" >
+ <property name="title" >
+ <string>&amp;File</string>
+ </property>
+ <addaction name="actionSaveData" />
+ <addaction name="actionExit" />
+ </widget>
+ <addaction name="menuFile" />
+ </widget>
+ <widget class="QStatusBar" name="statusbar" />
+ <action name="actionExit" >
+ <property name="text" >
+ <string>E&amp;xit</string>
+ </property>
+ </action>
+ <action name="actionSaveData" >
+ <property name="text" >
+ <string>&amp;Save Data</string>
+ </property>
+ </action>
+ </widget>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>closeButton</sender>
+ <signal>clicked()</signal>
+ <receiver>MainWindow</receiver>
+ <slot>close()</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>808</x>
+ <y>739</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>66</x>
+ <y>561</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>actionExit</sender>
+ <signal>triggered()</signal>
+ <receiver>MainWindow</receiver>
+ <slot>close()</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>-1</x>
+ <y>-1</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>617</x>
+ <y>327</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>
diff --git a/gr-qtgui/doc/CMakeLists.txt b/gr-qtgui/doc/CMakeLists.txt
new file mode 100644
index 000000000..668ed59f5
--- /dev/null
+++ b/gr-qtgui/doc/CMakeLists.txt
@@ -0,0 +1,23 @@
+# Copyright 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.
+
+install(
+ FILES README.qtgui
+ DESTINATION ${GR_PKG_DOC_DIR}
+)
diff --git a/gr-qtgui/doc/README.qtgui b/gr-qtgui/doc/README.qtgui
new file mode 100644
index 000000000..b5b523bf6
--- /dev/null
+++ b/gr-qtgui/doc/README.qtgui
@@ -0,0 +1,12 @@
+This is the gr-qtgui package. It contains various QT-based graphical
+user interface blocks that add graphical sinks to a GNU Radio
+flowgraph. The Python namespaces is in gnuradio.qtgui, which would be normally
+imported as:
+
+ from gnuradio import qtgui
+
+See the Doxygen documentation for details about the blocks available
+in this package. A quick listing of the details can be found in Python
+after importing by using:
+
+ help(qtgui)
diff --git a/gr-qtgui/doc/qtgui.dox b/gr-qtgui/doc/qtgui.dox
new file mode 100644
index 000000000..8664af163
--- /dev/null
+++ b/gr-qtgui/doc/qtgui.dox
@@ -0,0 +1,77 @@
+/*! \page page_qtgui QT Graphical User Interface
+
+\section Introduction
+
+This is the gr-qtgui package. It contains various QT-based graphical
+user interface blocks that add graphical sinks to a GNU Radio
+flowgraph. The Python namespaces is in gnuradio.qtgui, which would be normally
+imported as:
+
+\code
+ from gnuradio import qtgui
+\endcode
+
+See the Doxygen documentation for details about the blocks available
+in this package. The relevant blocks are listed in the \ref
+qtgui_blk group.
+
+A quick listing of the details can be found in Python after importing
+by using:
+
+\code
+ help(qtgui)
+\endcode
+
+
+\section Dependencies
+
+The QT GUI blocks require the following dependencies.
+
+\li QtCore (version >= 4.4)
+\li QtGui (version >= 4.4)
+\li QtOpenGL (version >= 4.4)
+\li PyQt4 for Qt4 (version >= 4.4)
+\li Qwt (version >= 5.2)
+\li PyQwt5 for Qt4 (version >= 5.2)
+
+\section Usage
+
+To use the qtgui interface, a bit of boiler-plate lines must be
+included. First, the sink is defined, then it must be exposed from C++
+into Python using the "sip.wrapinstance" command, and finally, the
+"show" method is run on the new Python object. This sets up the QT
+environment to show the widget, but the qApplication must also be
+launched.
+
+In the "main" function of the code, the qApp is retrieved. Then, after
+the GNU Radio top block is started (remember that start() is a
+non-blocking call to launch the main thread of the flowgraph), the
+qapp's "exec_()" function is called. This function is a blocking call
+while the GUI is alive.
+
+\code
+from PyQt4 import Qt
+from gnuradio.qtgui import qtgui
+import sys, sip
+
+class grclass(gr.top_block):
+ ....
+
+ self.snk = qtgui.sink_c(1024, #fftsize
+ samp_rate, #bw
+ "QT GUI Plot") #name
+
+ self.snk_win = sip.wrapinstance(self.snk.pyqwidget(), Qt.QWidget)
+ self.snk_win.show()
+
+def main():
+ qapp = Qt.QApplication(sys.argv)
+ tb = grclass()
+ tb.start()
+ qapp.exec_()
+ tb.stop()
+
+
+\endcode
+
+*/
diff --git a/gr-qtgui/examples/CMakeLists.txt b/gr-qtgui/examples/CMakeLists.txt
new file mode 100644
index 000000000..998d17bd9
--- /dev/null
+++ b/gr-qtgui/examples/CMakeLists.txt
@@ -0,0 +1,29 @@
+# Copyright 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.
+
+include(GrPython)
+
+GR_PYTHON_INSTALL(PROGRAMS
+ pyqt_example_c.py
+ pyqt_example_f.py
+ pyqt_time_c.py
+ pyqt_time_f.py
+ DESTINATION ${GR_PKG_QTGUI_EXAMPLES_DIR}
+ COMPONENT "qtgui_python"
+)
diff --git a/gr-qtgui/examples/pyqt_example_c.py b/gr-qtgui/examples/pyqt_example_c.py
new file mode 100755
index 000000000..0b43fce0e
--- /dev/null
+++ b/gr-qtgui/examples/pyqt_example_c.py
@@ -0,0 +1,176 @@
+#!/usr/bin/env python
+#
+# Copyright 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.
+#
+
+from gnuradio import gr
+import sys
+
+try:
+ from gnuradio import qtgui
+ from PyQt4 import QtGui, QtCore
+ import sip
+except ImportError:
+ print "Error: Program requires PyQt4 and gr-qtgui."
+ sys.exit(1)
+
+class dialog_box(QtGui.QWidget):
+ def __init__(self, display, control):
+ QtGui.QWidget.__init__(self, None)
+ self.setWindowTitle('PyQt Test GUI')
+
+ self.boxlayout = QtGui.QBoxLayout(QtGui.QBoxLayout.LeftToRight, self)
+ self.boxlayout.addWidget(display, 1)
+ self.boxlayout.addWidget(control)
+
+ self.resize(800, 500)
+
+class control_box(QtGui.QWidget):
+ def __init__(self, parent=None):
+ QtGui.QWidget.__init__(self, parent)
+ self.setWindowTitle('Control Panel')
+
+ self.setToolTip('Control the signals')
+ QtGui.QToolTip.setFont(QtGui.QFont('OldEnglish', 10))
+
+ self.layout = QtGui.QFormLayout(self)
+
+ # Control the first signal
+ self.freq1Edit = QtGui.QLineEdit(self)
+ self.freq1Edit.setMinimumWidth(100)
+ self.layout.addRow("Signal 1 Frequency:", self.freq1Edit)
+ self.connect(self.freq1Edit, QtCore.SIGNAL("editingFinished()"),
+ self.freq1EditText)
+
+ self.amp1Edit = QtGui.QLineEdit(self)
+ self.amp1Edit.setMinimumWidth(100)
+ self.layout.addRow("Signal 1 Amplitude:", self.amp1Edit)
+ self.connect(self.amp1Edit, QtCore.SIGNAL("editingFinished()"),
+ self.amp1EditText)
+
+
+ # Control the second signal
+ self.freq2Edit = QtGui.QLineEdit(self)
+ self.freq2Edit.setMinimumWidth(100)
+ self.layout.addRow("Signal 2 Frequency:", self.freq2Edit)
+ self.connect(self.freq2Edit, QtCore.SIGNAL("editingFinished()"),
+ self.freq2EditText)
+
+
+ self.amp2Edit = QtGui.QLineEdit(self)
+ self.amp2Edit.setMinimumWidth(100)
+ self.layout.addRow("Signal 2 Amplitude:", self.amp2Edit)
+ self.connect(self.amp2Edit, QtCore.SIGNAL("editingFinished()"),
+ self.amp2EditText)
+
+ self.quit = QtGui.QPushButton('Close', self)
+ self.quit.setMinimumWidth(100)
+ self.layout.addWidget(self.quit)
+
+ self.connect(self.quit, QtCore.SIGNAL('clicked()'),
+ QtGui.qApp, QtCore.SLOT('quit()'))
+
+ def attach_signal1(self, signal):
+ self.signal1 = signal
+ self.freq1Edit.setText(QtCore.QString("%1").arg(self.signal1.frequency()))
+ self.amp1Edit.setText(QtCore.QString("%1").arg(self.signal1.amplitude()))
+
+ def attach_signal2(self, signal):
+ self.signal2 = signal
+ self.freq2Edit.setText(QtCore.QString("%1").arg(self.signal2.frequency()))
+ self.amp2Edit.setText(QtCore.QString("%1").arg(self.signal2.amplitude()))
+
+ def freq1EditText(self):
+ try:
+ newfreq = float(self.freq1Edit.text())
+ self.signal1.set_frequency(newfreq)
+ except ValueError:
+ print "Bad frequency value entered"
+
+ def amp1EditText(self):
+ try:
+ newamp = float(self.amp1Edit.text())
+ self.signal1.set_amplitude(newamp)
+ except ValueError:
+ print "Bad amplitude value entered"
+
+
+ def freq2EditText(self):
+ try:
+ newfreq = float(self.freq2Edit.text())
+ self.signal2.set_frequency(newfreq)
+ except ValueError:
+ print "Bad frequency value entered"
+
+ def amp2EditText(self):
+ try:
+ newamp = float(self.amp2Edit.text())
+ self.signal2.set_amplitude(newamp)
+ except ValueError:
+ print "Bad amplitude value entered"
+
+
+class my_top_block(gr.top_block):
+ def __init__(self):
+ gr.top_block.__init__(self)
+
+ Rs = 8000
+ f1 = 1000
+ f2 = 2000
+
+ fftsize = 2048
+
+ self.qapp = QtGui.QApplication(sys.argv)
+
+ src1 = gr.sig_source_c(Rs, gr.GR_SIN_WAVE, f1, 0.1, 0)
+ src2 = gr.sig_source_c(Rs, gr.GR_SIN_WAVE, f2, 0.1, 0)
+ src = gr.add_cc()
+ channel = gr.channel_model(0.001)
+ thr = gr.throttle(gr.sizeof_gr_complex, 100*fftsize)
+ self.snk1 = qtgui.sink_c(fftsize, gr.firdes.WIN_BLACKMAN_hARRIS,
+ 0, Rs,
+ "Complex Signal Example",
+ True, True, True, False)
+
+ self.connect(src1, (src,0))
+ self.connect(src2, (src,1))
+ self.connect(src, channel, thr, self.snk1)
+
+ self.ctrl_win = control_box()
+ self.ctrl_win.attach_signal1(src1)
+ self.ctrl_win.attach_signal2(src2)
+
+ # Get the reference pointer to the SpectrumDisplayForm QWidget
+ pyQt = self.snk1.pyqwidget()
+
+ # Wrap the pointer as a PyQt SIP object
+ # This can now be manipulated as a PyQt4.QtGui.QWidget
+ pyWin = sip.wrapinstance(pyQt, QtGui.QWidget)
+
+ self.main_box = dialog_box(pyWin, self.ctrl_win)
+
+ self.main_box.show()
+
+if __name__ == "__main__":
+ tb = my_top_block();
+ tb.start()
+ tb.qapp.exec_()
+ tb.stop()
+
diff --git a/gr-qtgui/examples/pyqt_example_f.py b/gr-qtgui/examples/pyqt_example_f.py
new file mode 100755
index 000000000..d00011f40
--- /dev/null
+++ b/gr-qtgui/examples/pyqt_example_f.py
@@ -0,0 +1,178 @@
+#!/usr/bin/env python
+#
+# Copyright 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.
+#
+
+from gnuradio import gr
+import sys
+
+try:
+ from gnuradio import qtgui
+ from PyQt4 import QtGui, QtCore
+ import sip
+except ImportError:
+ print "Error: Program requires PyQt4 and gr-qtgui."
+ sys.exit(1)
+
+class dialog_box(QtGui.QWidget):
+ def __init__(self, display, control):
+ QtGui.QWidget.__init__(self, None)
+ self.setWindowTitle('PyQt Test GUI')
+
+ self.boxlayout = QtGui.QBoxLayout(QtGui.QBoxLayout.LeftToRight, self)
+ self.boxlayout.addWidget(display, 1)
+ self.boxlayout.addWidget(control)
+
+ self.resize(800, 500)
+
+class control_box(QtGui.QWidget):
+ def __init__(self, parent=None):
+ QtGui.QWidget.__init__(self, parent)
+ self.setWindowTitle('Control Panel')
+
+ self.setToolTip('Control the signals')
+ QtGui.QToolTip.setFont(QtGui.QFont('OldEnglish', 10))
+
+ self.layout = QtGui.QFormLayout(self)
+
+ # Control the first signal
+ self.freq1Edit = QtGui.QLineEdit(self)
+ self.freq1Edit.setMinimumWidth(100)
+ self.layout.addRow("Signal 1 Frequency:", self.freq1Edit)
+ self.connect(self.freq1Edit, QtCore.SIGNAL("editingFinished()"),
+ self.freq1EditText)
+
+ self.amp1Edit = QtGui.QLineEdit(self)
+ self.amp1Edit.setMinimumWidth(100)
+ self.layout.addRow("Signal 1 Amplitude:", self.amp1Edit)
+ self.connect(self.amp1Edit, QtCore.SIGNAL("editingFinished()"),
+ self.amp1EditText)
+
+
+ # Control the second signal
+ self.freq2Edit = QtGui.QLineEdit(self)
+ self.freq2Edit.setMinimumWidth(100)
+ self.layout.addRow("Signal 2 Frequency:", self.freq2Edit)
+ self.connect(self.freq2Edit, QtCore.SIGNAL("editingFinished()"),
+ self.freq2EditText)
+
+
+ self.amp2Edit = QtGui.QLineEdit(self)
+ self.amp2Edit.setMinimumWidth(100)
+ self.layout.addRow("Signal 2 Amplitude:", self.amp2Edit)
+ self.connect(self.amp2Edit, QtCore.SIGNAL("editingFinished()"),
+ self.amp2EditText)
+
+ self.quit = QtGui.QPushButton('Close', self)
+ self.quit.setMinimumWidth(100)
+ self.layout.addWidget(self.quit)
+
+ self.connect(self.quit, QtCore.SIGNAL('clicked()'),
+ QtGui.qApp, QtCore.SLOT('quit()'))
+
+ def attach_signal1(self, signal):
+ self.signal1 = signal
+ self.freq1Edit.setText(QtCore.QString("%1").arg(self.signal1.frequency()))
+ self.amp1Edit.setText(QtCore.QString("%1").arg(self.signal1.amplitude()))
+
+ def attach_signal2(self, signal):
+ self.signal2 = signal
+ self.freq2Edit.setText(QtCore.QString("%1").arg(self.signal2.frequency()))
+ self.amp2Edit.setText(QtCore.QString("%1").arg(self.signal2.amplitude()))
+
+ def freq1EditText(self):
+ try:
+ newfreq = float(self.freq1Edit.text())
+ self.signal1.set_frequency(newfreq)
+ except ValueError:
+ print "Bad frequency value entered"
+
+ def amp1EditText(self):
+ try:
+ newamp = float(self.amp1Edit.text())
+ self.signal1.set_amplitude(newamp)
+ except ValueError:
+ print "Bad amplitude value entered"
+
+
+ def freq2EditText(self):
+ try:
+ newfreq = float(self.freq2Edit.text())
+ self.signal2.set_frequency(newfreq)
+ except ValueError:
+ print "Bad frequency value entered"
+
+ def amp2EditText(self):
+ try:
+ newamp = float(self.amp2Edit.text())
+ self.signal2.set_amplitude(newamp)
+ except ValueError:
+ print "Bad amplitude value entered"
+
+
+class my_top_block(gr.top_block):
+ def __init__(self):
+ gr.top_block.__init__(self)
+
+ Rs = 8000
+ f1 = 1000
+ f2 = 2000
+
+ fftsize = 2048
+
+ self.qapp = QtGui.QApplication(sys.argv)
+
+ src1 = gr.sig_source_f(Rs, gr.GR_SIN_WAVE, f1, 0.1, 0)
+ src2 = gr.sig_source_f(Rs, gr.GR_SIN_WAVE, f2, 0.1, 0)
+ src = gr.add_ff()
+ thr = gr.throttle(gr.sizeof_float, 100*fftsize)
+ noise = gr.noise_source_f(gr.GR_GAUSSIAN, 0.001)
+ add = gr.add_ff()
+ self.snk1 = qtgui.sink_f(fftsize, gr.firdes.WIN_BLACKMAN_hARRIS,
+ 0, Rs,
+ "Float Signal Example",
+ True, True, True, False)
+
+ self.connect(src1, (src,0))
+ self.connect(src2, (src,1))
+ self.connect(src, thr, (add,0))
+ self.connect(noise, (add,1))
+ self.connect(add, self.snk1)
+
+ self.ctrl_win = control_box()
+ self.ctrl_win.attach_signal1(src1)
+ self.ctrl_win.attach_signal2(src2)
+
+ # Get the reference pointer to the SpectrumDisplayForm QWidget
+ pyQt = self.snk1.pyqwidget()
+
+ # Wrap the pointer as a PyQt SIP object
+ # This can now be manipulated as a PyQt4.QtGui.QWidget
+ pyWin = sip.wrapinstance(pyQt, QtGui.QWidget)
+
+ self.main_box = dialog_box(pyWin, self.ctrl_win)
+
+ self.main_box.show()
+
+if __name__ == "__main__":
+ tb = my_top_block();
+ tb.start()
+ tb.qapp.exec_()
+ tb.stop()
diff --git a/gr-qtgui/examples/pyqt_time_c.py b/gr-qtgui/examples/pyqt_time_c.py
new file mode 100755
index 000000000..04425e11f
--- /dev/null
+++ b/gr-qtgui/examples/pyqt_time_c.py
@@ -0,0 +1,189 @@
+#!/usr/bin/env python
+#
+# Copyright 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.
+#
+
+from gnuradio import gr
+import sys
+
+try:
+ from gnuradio import qtgui
+ from PyQt4 import QtGui, QtCore
+ import sip
+except ImportError:
+ print "Error: Program requires PyQt4 and gr-qtgui."
+ sys.exit(1)
+
+class dialog_box(QtGui.QWidget):
+ def __init__(self, display, control):
+ QtGui.QWidget.__init__(self, None)
+ self.setWindowTitle('PyQt Test GUI')
+
+ self.boxlayout = QtGui.QBoxLayout(QtGui.QBoxLayout.LeftToRight, self)
+ self.boxlayout.addWidget(display, 1)
+ self.boxlayout.addWidget(control)
+
+ self.resize(800, 500)
+
+class control_box(QtGui.QWidget):
+ def __init__(self, parent=None):
+ QtGui.QWidget.__init__(self, parent)
+ self.setWindowTitle('Control Panel')
+
+ self.setToolTip('Control the signals')
+ QtGui.QToolTip.setFont(QtGui.QFont('OldEnglish', 10))
+
+ self.layout = QtGui.QFormLayout(self)
+
+ # Control the first signal
+ self.freq1Edit = QtGui.QLineEdit(self)
+ self.freq1Edit.setMinimumWidth(100)
+ self.layout.addRow("Signal 1 Frequency:", self.freq1Edit)
+ self.connect(self.freq1Edit, QtCore.SIGNAL("editingFinished()"),
+ self.freq1EditText)
+
+ self.amp1Edit = QtGui.QLineEdit(self)
+ self.amp1Edit.setMinimumWidth(100)
+ self.layout.addRow("Signal 1 Amplitude:", self.amp1Edit)
+ self.connect(self.amp1Edit, QtCore.SIGNAL("editingFinished()"),
+ self.amp1EditText)
+
+
+ # Control the second signal
+ self.freq2Edit = QtGui.QLineEdit(self)
+ self.freq2Edit.setMinimumWidth(100)
+ self.layout.addRow("Signal 2 Frequency:", self.freq2Edit)
+ self.connect(self.freq2Edit, QtCore.SIGNAL("editingFinished()"),
+ self.freq2EditText)
+
+
+ self.amp2Edit = QtGui.QLineEdit(self)
+ self.amp2Edit.setMinimumWidth(100)
+ self.layout.addRow("Signal 2 Amplitude:", self.amp2Edit)
+ self.connect(self.amp2Edit, QtCore.SIGNAL("editingFinished()"),
+ self.amp2EditText)
+
+ self.quit = QtGui.QPushButton('Close', self)
+ self.quit.setMinimumWidth(100)
+ self.layout.addWidget(self.quit)
+
+ self.connect(self.quit, QtCore.SIGNAL('clicked()'),
+ QtGui.qApp, QtCore.SLOT('quit()'))
+
+ def attach_signal1(self, signal):
+ self.signal1 = signal
+ self.freq1Edit.setText(QtCore.QString("%1").arg(self.signal1.frequency()))
+ self.amp1Edit.setText(QtCore.QString("%1").arg(self.signal1.amplitude()))
+
+ def attach_signal2(self, signal):
+ self.signal2 = signal
+ self.freq2Edit.setText(QtCore.QString("%1").arg(self.signal2.frequency()))
+ self.amp2Edit.setText(QtCore.QString("%1").arg(self.signal2.amplitude()))
+
+ def freq1EditText(self):
+ try:
+ newfreq = float(self.freq1Edit.text())
+ self.signal1.set_frequency(newfreq)
+ except ValueError:
+ print "Bad frequency value entered"
+
+ def amp1EditText(self):
+ try:
+ newamp = float(self.amp1Edit.text())
+ self.signal1.set_amplitude(newamp)
+ except ValueError:
+ print "Bad amplitude value entered"
+
+
+ def freq2EditText(self):
+ try:
+ newfreq = float(self.freq2Edit.text())
+ self.signal2.set_frequency(newfreq)
+ except ValueError:
+ print "Bad frequency value entered"
+
+ def amp2EditText(self):
+ try:
+ newamp = float(self.amp2Edit.text())
+ self.signal2.set_amplitude(newamp)
+ except ValueError:
+ print "Bad amplitude value entered"
+
+
+class my_top_block(gr.top_block):
+ def __init__(self):
+ gr.top_block.__init__(self)
+
+ Rs = 8000
+ f1 = 100
+ f2 = 200
+
+ npts = 2048
+
+ self.qapp = QtGui.QApplication(sys.argv)
+
+ src1 = gr.sig_source_c(Rs, gr.GR_SIN_WAVE, f1, 0.1, 0)
+ src2 = gr.sig_source_c(Rs, gr.GR_SIN_WAVE, f2, 0.1, 0)
+ src = gr.add_cc()
+ channel = gr.channel_model(0.01)
+ thr = gr.throttle(gr.sizeof_gr_complex, 100*npts)
+ self.snk1 = qtgui.time_sink_c(npts, Rs,
+ "Complex Time Example", 3)
+
+ self.connect(src1, (src,0))
+ self.connect(src2, (src,1))
+ self.connect(src, channel, thr, (self.snk1, 0))
+ self.connect(src1, (self.snk1, 1))
+ self.connect(src2, (self.snk1, 2))
+
+ self.ctrl_win = control_box()
+ self.ctrl_win.attach_signal1(src1)
+ self.ctrl_win.attach_signal2(src2)
+
+ # Get the reference pointer to the SpectrumDisplayForm QWidget
+ pyQt = self.snk1.pyqwidget()
+
+ # Wrap the pointer as a PyQt SIP object
+ # This can now be manipulated as a PyQt4.QtGui.QWidget
+ pyWin = sip.wrapinstance(pyQt, QtGui.QWidget)
+
+ # Example of using signal/slot to set the title of a curve
+ pyWin.connect(pyWin, QtCore.SIGNAL("setTitle(int, QString)"),
+ pyWin, QtCore.SLOT("setTitle(int, QString)"))
+ pyWin.emit(QtCore.SIGNAL("setTitle(int, QString)"), 0, "Re{sum}")
+ self.snk1.set_title(1, "Im{Sum}")
+ self.snk1.set_title(2, "Re{src1}")
+ self.snk1.set_title(3, "Im{src1}")
+ self.snk1.set_title(4, "Re{src2}")
+ self.snk1.set_title(5, "Im{src2}")
+
+ # Can also set the color of a curve
+ #self.snk1.set_color(5, "blue")
+
+ #pyWin.show()
+ self.main_box = dialog_box(pyWin, self.ctrl_win)
+ self.main_box.show()
+
+if __name__ == "__main__":
+ tb = my_top_block();
+ tb.start()
+ tb.qapp.exec_()
+ tb.stop()
+
diff --git a/gr-qtgui/examples/pyqt_time_f.py b/gr-qtgui/examples/pyqt_time_f.py
new file mode 100755
index 000000000..464d8939b
--- /dev/null
+++ b/gr-qtgui/examples/pyqt_time_f.py
@@ -0,0 +1,189 @@
+#!/usr/bin/env python
+#
+# Copyright 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.
+#
+
+from gnuradio import gr
+import sys
+
+try:
+ from gnuradio import qtgui
+ from PyQt4 import QtGui, QtCore
+ import sip
+except ImportError:
+ print "Error: Program requires PyQt4 and gr-qtgui."
+ sys.exit(1)
+
+class dialog_box(QtGui.QWidget):
+ def __init__(self, display, control):
+ QtGui.QWidget.__init__(self, None)
+ self.setWindowTitle('PyQt Test GUI')
+
+ self.boxlayout = QtGui.QBoxLayout(QtGui.QBoxLayout.LeftToRight, self)
+ self.boxlayout.addWidget(display, 1)
+ self.boxlayout.addWidget(control)
+
+ self.resize(800, 500)
+
+class control_box(QtGui.QWidget):
+ def __init__(self, parent=None):
+ QtGui.QWidget.__init__(self, parent)
+ self.setWindowTitle('Control Panel')
+
+ self.setToolTip('Control the signals')
+ QtGui.QToolTip.setFont(QtGui.QFont('OldEnglish', 10))
+
+ self.layout = QtGui.QFormLayout(self)
+
+ # Control the first signal
+ self.freq1Edit = QtGui.QLineEdit(self)
+ self.freq1Edit.setMinimumWidth(100)
+ self.layout.addRow("Signal 1 Frequency:", self.freq1Edit)
+ self.connect(self.freq1Edit, QtCore.SIGNAL("editingFinished()"),
+ self.freq1EditText)
+
+ self.amp1Edit = QtGui.QLineEdit(self)
+ self.amp1Edit.setMinimumWidth(100)
+ self.layout.addRow("Signal 1 Amplitude:", self.amp1Edit)
+ self.connect(self.amp1Edit, QtCore.SIGNAL("editingFinished()"),
+ self.amp1EditText)
+
+
+ # Control the second signal
+ self.freq2Edit = QtGui.QLineEdit(self)
+ self.freq2Edit.setMinimumWidth(100)
+ self.layout.addRow("Signal 2 Frequency:", self.freq2Edit)
+ self.connect(self.freq2Edit, QtCore.SIGNAL("editingFinished()"),
+ self.freq2EditText)
+
+
+ self.amp2Edit = QtGui.QLineEdit(self)
+ self.amp2Edit.setMinimumWidth(100)
+ self.layout.addRow("Signal 2 Amplitude:", self.amp2Edit)
+ self.connect(self.amp2Edit, QtCore.SIGNAL("editingFinished()"),
+ self.amp2EditText)
+
+ self.quit = QtGui.QPushButton('Close', self)
+ self.quit.setMinimumWidth(100)
+ self.layout.addWidget(self.quit)
+
+ self.connect(self.quit, QtCore.SIGNAL('clicked()'),
+ QtGui.qApp, QtCore.SLOT('quit()'))
+
+ def attach_signal1(self, signal):
+ self.signal1 = signal
+ self.freq1Edit.setText(QtCore.QString("%1").arg(self.signal1.frequency()))
+ self.amp1Edit.setText(QtCore.QString("%1").arg(self.signal1.amplitude()))
+
+ def attach_signal2(self, signal):
+ self.signal2 = signal
+ self.freq2Edit.setText(QtCore.QString("%1").arg(self.signal2.frequency()))
+ self.amp2Edit.setText(QtCore.QString("%1").arg(self.signal2.amplitude()))
+
+ def freq1EditText(self):
+ try:
+ newfreq = float(self.freq1Edit.text())
+ self.signal1.set_frequency(newfreq)
+ except ValueError:
+ print "Bad frequency value entered"
+
+ def amp1EditText(self):
+ try:
+ newamp = float(self.amp1Edit.text())
+ self.signal1.set_amplitude(newamp)
+ except ValueError:
+ print "Bad amplitude value entered"
+
+
+ def freq2EditText(self):
+ try:
+ newfreq = float(self.freq2Edit.text())
+ self.signal2.set_frequency(newfreq)
+ except ValueError:
+ print "Bad frequency value entered"
+
+ def amp2EditText(self):
+ try:
+ newamp = float(self.amp2Edit.text())
+ self.signal2.set_amplitude(newamp)
+ except ValueError:
+ print "Bad amplitude value entered"
+
+
+class my_top_block(gr.top_block):
+ def __init__(self):
+ gr.top_block.__init__(self)
+
+ Rs = 8000
+ f1 = 100
+ f2 = 200
+
+ npts = 2048
+
+ self.qapp = QtGui.QApplication(sys.argv)
+
+ src1 = gr.sig_source_f(Rs, gr.GR_SIN_WAVE, f1, 0.1, 0)
+ src2 = gr.sig_source_f(Rs, gr.GR_SIN_WAVE, f2, 0.1, 0)
+ src = gr.add_ff()
+ thr = gr.throttle(gr.sizeof_float, 100*npts)
+ noise = gr.noise_source_f(gr.GR_GAUSSIAN, 0.001)
+ add = gr.add_ff()
+ self.snk1 = qtgui.time_sink_f(npts, Rs,
+ "Complex Time Example", 3)
+
+ self.connect(src1, (src,0))
+ self.connect(src2, (src,1))
+ self.connect(src, thr, (add,0))
+ self.connect(noise, (add,1))
+ self.connect(add, self.snk1)
+ self.connect(src1, (self.snk1, 1))
+ self.connect(src2, (self.snk1, 2))
+
+ self.ctrl_win = control_box()
+ self.ctrl_win.attach_signal1(src1)
+ self.ctrl_win.attach_signal2(src2)
+
+ # Get the reference pointer to the SpectrumDisplayForm QWidget
+ pyQt = self.snk1.pyqwidget()
+
+ # Wrap the pointer as a PyQt SIP object
+ # This can now be manipulated as a PyQt4.QtGui.QWidget
+ pyWin = sip.wrapinstance(pyQt, QtGui.QWidget)
+
+ # Example of using signal/slot to set the title of a curve
+ pyWin.connect(pyWin, QtCore.SIGNAL("setTitle(int, QString)"),
+ pyWin, QtCore.SLOT("setTitle(int, QString)"))
+ pyWin.emit(QtCore.SIGNAL("setTitle(int, QString)"), 0, "sum")
+ self.snk1.set_title(1, "src1")
+ self.snk1.set_title(2, "src2")
+
+ # Can also set the color of a curve
+ #self.snk1.set_color(5, "blue")
+
+ #pyWin.show()
+ self.main_box = dialog_box(pyWin, self.ctrl_win)
+ self.main_box.show()
+
+if __name__ == "__main__":
+ tb = my_top_block();
+ tb.start()
+ tb.qapp.exec_()
+ tb.stop()
+
diff --git a/gr-qtgui/gnuradio-qtgui.pc.in b/gr-qtgui/gnuradio-qtgui.pc.in
new file mode 100644
index 000000000..27b6a21bf
--- /dev/null
+++ b/gr-qtgui/gnuradio-qtgui.pc.in
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: gnuradio-qtgui
+Description: GNU Radio blocks for QT GUI
+Requires: gnuradio-core
+Version: @LIBVER@
+Libs: -L${libdir} -lgnuradio-qtgui
+Cflags: -I${includedir}
diff --git a/gr-qtgui/grc/CMakeLists.txt b/gr-qtgui/grc/CMakeLists.txt
new file mode 100644
index 000000000..d56158ac7
--- /dev/null
+++ b/gr-qtgui/grc/CMakeLists.txt
@@ -0,0 +1,22 @@
+# Copyright 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.
+
+########################################################################
+file(GLOB xml_files "*.xml")
+install(FILES ${xml_files} DESTINATION ${GRC_BLOCKS_DIR} COMPONENT "qtgui_python")
diff --git a/gr-qtgui/grc/qtgui_check_box.xml b/gr-qtgui/grc/qtgui_check_box.xml
new file mode 100644
index 000000000..95f4f968a
--- /dev/null
+++ b/gr-qtgui/grc/qtgui_check_box.xml
@@ -0,0 +1,83 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Variable Check Box:
+## a gui check box form
+###################################################
+ -->
+<block>
+ <name>QT GUI Check Box</name>
+ <key>variable_qtgui_check_box</key>
+ <category>QT GUI Widgets</category>
+ <import>from PyQt4 import Qt</import>
+ <var_make>self.$(id) = $(id) = $value</var_make>
+ <make>#set $win = '_%s_check_box'%$id
+#if not $label()
+ #set $label = '"%s"'%$id
+#end if
+$win = Qt.QCheckBox($label)
+self._$(id)_choices = {True: $true, False: $false}
+self._$(id)_choices_inv = dict((v,k) for k,v in self._$(id)_choices.iteritems())
+self._$(id)_callback = lambda i: $(win).setChecked(self._$(id)_choices_inv[i])
+self._$(id)_callback(self.$id)
+$(win).stateChanged.connect(lambda i: self.set_$(id)(self._$(id)_choices[bool(i)]))
+$(gui_hint()($win))</make>
+ <callback>self.set_$(id)($value)</callback>
+ <callback>self._$(id)_callback($id)</callback>
+ <param>
+ <name>Label</name>
+ <key>label</key>
+ <value></value>
+ <type>string</type>
+ <hide>#if $label() then 'none' else 'part'#</hide>
+ </param>
+ <param>
+ <name>Type</name>
+ <key>type</key>
+ <value>int</value>
+ <type>enum</type>
+ <hide>part</hide>
+ <option><name>Float</name><key>real</key><opt>conv:float</opt></option>
+ <option><name>Integer</name><key>int</key><opt>conv:int</opt></option>
+ <option><name>String</name><key>string</key><opt>conv:str</opt></option>
+ <option><name>Boolean</name><key>bool</key><opt>conv:bool</opt></option>
+ <option><name>Any</name><key>raw</key><opt>conv:eval</opt></option>
+ </param>
+ <param>
+ <name>Default Value</name>
+ <key>value</key>
+ <value>True</value>
+ <type>$type</type>
+ </param>
+ <param>
+ <name>True</name>
+ <key>true</key>
+ <value>True</value>
+ <type>$type</type>
+ </param>
+ <param>
+ <name>False</name>
+ <key>false</key>
+ <value>False</value>
+ <type>$type</type>
+ </param>
+ <param>
+ <name>GUI Hint</name>
+ <key>gui_hint</key>
+ <value></value>
+ <type>gui_hint</type>
+ <hide>part</hide>
+ </param>
+ <check>$value in ($true, $false)</check>
+ <doc>
+This block creates a variable check box. \
+Leave the label blank to use the variable id as the label.
+
+A check box selects between two values of similar type. \
+Te values do not necessarily need to be of boolean type.
+
+The GUI hint can be used to position the widget within the application. \
+The hint is of the form [tab_id@tab_index]: [row, col, row_span, col_span]. \
+Both the tab specification and the grid position are optional.
+ </doc>
+</block>
diff --git a/gr-qtgui/grc/qtgui_chooser.xml b/gr-qtgui/grc/qtgui_chooser.xml
new file mode 100644
index 000000000..cb5090289
--- /dev/null
+++ b/gr-qtgui/grc/qtgui_chooser.xml
@@ -0,0 +1,251 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Variable Chooser:
+## A chooser, radio buttons
+###################################################
+ -->
+<block>
+ <name>QT GUI Chooser</name>
+ <key>variable_qtgui_chooser</key>
+ <category>QT GUI Widgets</category>
+ <import>from PyQt4 import Qt</import>
+ <var_make>self.$(id) = $(id) = $value</var_make>
+ <make>#slurp
+#set $all_options = [$option0, $option1, $option2, $option3, $option4][:int($num_opts())]
+#set $all_labels = [$label0, $label1, $label2, $label3, $label4][:int($num_opts())]
+#if not $label()
+ #set $label = '"%s"'%$id
+#end if
+########################################################################
+## Create the options list
+########################################################################
+#if int($num_opts())
+self._$(id)_options = (#slurp
+ #for $ch in $all_options
+$ch, #slurp
+ #end for
+)
+#else
+self._$(id)_options = $options
+#end if
+########################################################################
+## Create the labels list
+########################################################################
+#if int($num_opts())
+self._$(id)_labels = (#slurp
+ #for i, $lbl in enumerate($all_labels)
+ #if $lbl()
+$lbl, #slurp
+ #else
+str(self._$(id)_options[$i]), #slurp
+ #end if
+ #end for
+)
+#elif $labels()
+self._$(id)_labels = $labels
+#else
+self._$(id)_labels = map(str, self._$(id)_options)
+#end if
+########################################################################
+## Create the combo box
+########################################################################
+#if $widget() == 'combo_box'
+#set $win = 'self._%s_tool_bar'%$id
+$win = Qt.QToolBar(self)
+$(win).addWidget(Qt.QLabel($label+": "))
+self._$(id)_combo_box = Qt.QComboBox()
+$(win).addWidget(self._$(id)_combo_box)
+for label in self._$(id)_labels: self._$(id)_combo_box.addItem(label)
+self._$(id)_callback = lambda i: self._$(id)_combo_box.setCurrentIndex(self._$(id)_options.index(i))
+self._$(id)_callback(self.$id)
+self._$(id)_combo_box.currentIndexChanged.connect(
+ lambda i: self.set_$(id)(self._$(id)_options[i]))
+#end if
+########################################################################
+## Create the radio buttons
+########################################################################
+#if $widget() == 'radio_buttons'
+#set $win = 'self._%s_group_box'%$id
+$win = Qt.QGroupBox($label)
+self._$(id)_box = $(orient)()
+self._$(id)_button_group = Qt.QButtonGroup()
+$(win).setLayout(self._$(id)_box)
+for i, label in enumerate(self._$(id)_labels):
+ radio_button = Qt.QRadioButton(label)
+ self._$(id)_box.addWidget(radio_button)
+ self._$(id)_button_group.addButton(radio_button, i)
+self._$(id)_callback = lambda i: self._$(id)_button_group.button(self._$(id)_options.index(i)).setChecked(True)
+self._$(id)_callback(self.$id)
+self._$(id)_button_group.buttonClicked[int].connect(
+ lambda i: self.set_$(id)(self._$(id)_options[i]))
+#end if
+$(gui_hint()($win))</make>
+ <callback>self.set_$(id)($value)</callback>
+ <callback>self._$(id)_callback($id)</callback>
+ <param>
+ <name>Label</name>
+ <key>label</key>
+ <value></value>
+ <type>string</type>
+ <hide>#if $label() then 'none' else 'part'#</hide>
+ </param>
+ <param>
+ <name>Type</name>
+ <key>type</key>
+ <value>int</value>
+ <type>enum</type>
+ <hide>part</hide>
+ <option><name>Float</name><key>real</key></option>
+ <option><name>Integer</name><key>int</key></option>
+ <option><name>String</name><key>string</key></option>
+ <option><name>Any</name><key>raw</key></option>
+ </param>
+ <param>
+ <name>Num Options</name>
+ <key>num_opts</key>
+ <value>3</value>
+ <type>enum</type>
+ <option><name>List</name><key>0</key></option>
+ <option><name>1</name><key>1</key></option>
+ <option><name>2</name><key>2</key></option>
+ <option><name>3</name><key>3</key></option>
+ <option><name>4</name><key>4</key></option>
+ <option><name>5</name><key>5</key></option>
+ </param>
+ <param>
+ <name>Default Value</name>
+ <key>value</key>
+ <value>0</value>
+ <type>$type</type>
+ </param>
+ <param>
+ <name>Options</name>
+ <key>options</key>
+ <value>[0, 1, 2]</value>
+ <type>raw</type>
+ <hide>#if int($num_opts()) then 'all' else 'none'#</hide>
+ </param>
+ <param>
+ <name>Labels</name>
+ <key>labels</key>
+ <value>[]</value>
+ <type>raw</type>
+ <hide>#if int($num_opts()) then 'all' else 'none'#</hide>
+ </param>
+ <param>
+ <name>Option 0</name>
+ <key>option0</key>
+ <value>0</value>
+ <type>$type</type>
+ <hide>#if int($num_opts()) > 0 then 'none' else 'all'#</hide>
+ </param>
+ <param>
+ <name>Label 0</name>
+ <key>label0</key>
+ <value></value>
+ <type>string</type>
+ <hide>$((int($num_opts()) > 0) and ($label0() and 'none' or 'part') or 'all')</hide>
+ </param>
+ <param>
+ <name>Option 1</name>
+ <key>option1</key>
+ <value>1</value>
+ <type>$type</type>
+ <hide>#if int($num_opts()) > 1 then 'none' else 'all'#</hide>
+ </param>
+ <param>
+ <name>Label 1</name>
+ <key>label1</key>
+ <value></value>
+ <type>string</type>
+ <hide>$((int($num_opts()) > 1) and ($label1() and 'none' or 'part') or 'all')</hide>
+ </param>
+ <param>
+ <name>Option 2</name>
+ <key>option2</key>
+ <value>2</value>
+ <type>$type</type>
+ <hide>#if int($num_opts()) > 2 then 'none' else 'all'#</hide>
+ </param>
+ <param>
+ <name>Label 2</name>
+ <key>label2</key>
+ <value></value>
+ <type>string</type>
+ <hide>$((int($num_opts()) > 2) and ($label2() and 'none' or 'part') or 'all')</hide>
+ </param>
+ <param>
+ <name>Option 3</name>
+ <key>option3</key>
+ <value>3</value>
+ <type>$type</type>
+ <hide>#if int($num_opts()) > 3 then 'none' else 'all'#</hide>
+ </param>
+ <param>
+ <name>Label 3</name>
+ <key>label3</key>
+ <value></value>
+ <type>string</type>
+ <hide>$((int($num_opts()) > 3) and ($label3() and 'none' or 'part') or 'all')</hide>
+ </param>
+ <param>
+ <name>Option 4</name>
+ <key>option4</key>
+ <value>4</value>
+ <type>$type</type>
+ <hide>#if int($num_opts()) > 4 then 'none' else 'all'#</hide>
+ </param>
+ <param>
+ <name>Label 4</name>
+ <key>label4</key>
+ <value></value>
+ <type>string</type>
+ <hide>$((int($num_opts()) > 4) and ($label4() and 'none' or 'part') or 'all')</hide>
+ </param>
+ <param>
+ <name>Widget</name>
+ <key>widget</key>
+ <value>combo_box</value>
+ <type>enum</type>
+ <hide>part</hide>
+ <option><name>Combo Box</name><key>combo_box</key></option>
+ <option><name>Radio Buttons</name><key>radio_buttons</key></option>
+ </param>
+ <param>
+ <name>Orientation</name>
+ <key>orient</key>
+ <value>Qt.QVBoxLayout</value>
+ <type>enum</type>
+ <hide>#if $widget() == 'radio_buttons' then 'part' else 'all'#</hide>
+ <option>
+ <name>Horizontal</name>
+ <key>Qt.QHBoxLayout</key>
+ </option>
+ <option>
+ <name>Vertical</name>
+ <key>Qt.QVBoxLayout</key>
+ </option>
+ </param>
+ <param>
+ <name>GUI Hint</name>
+ <key>gui_hint</key>
+ <value></value>
+ <type>gui_hint</type>
+ <hide>part</hide>
+ </param>
+ <doc>
+This block creates a variable with enumerated options. \
+The gui widget is implemented as a combo box or radio button group. \
+Leave the label blank to use the variable id as the label.
+
+Choose the number of options available to your chooser. \
+When the label is left blank, the option will be used as the label. \
+Set the number of options to "list" to enter a single list of options and labels. \
+When the labels is an empty list, the options will be used as the label.
+
+The GUI hint can be used to position the widget within the application. \
+The hint is of the form [tab_id@tab_index]: [row, col, row_span, col_span]. \
+Both the tab specification and the grid position are optional.
+ </doc>
+</block>
diff --git a/gr-qtgui/grc/qtgui_entry.xml b/gr-qtgui/grc/qtgui_entry.xml
new file mode 100644
index 000000000..1a98402a0
--- /dev/null
+++ b/gr-qtgui/grc/qtgui_entry.xml
@@ -0,0 +1,68 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Variable Text Entry:
+## a gui text box form
+###################################################
+ -->
+<block>
+ <name>QT GUI Entry</name>
+ <key>variable_qtgui_entry</key>
+ <category>QT GUI Widgets</category>
+ <import>from PyQt4 import Qt</import>
+ <import>from gnuradio import eng_notation</import>
+ <var_make>self.$(id) = $(id) = $value</var_make>
+ <make>#set $win = 'self._%s_tool_bar'%$id
+$win = Qt.QToolBar(self)
+#if not $label()
+ #set $label = '"%s"'%$id
+#end if
+$(win).addWidget(Qt.QLabel($label+": "))
+self._$(id)_line_edit = Qt.QLineEdit(str(self.$id))
+self._$(id)_tool_bar.addWidget(self._$(id)_line_edit)
+self._$(id)_line_edit.returnPressed.connect(
+ lambda: self.set_$(id)($(type.conv)(self._$(id)_line_edit.text().toAscii())))
+$(gui_hint()($win))</make>
+ <callback>self.set_$(id)($value)</callback>
+ <callback>self._$(id)_line_edit.setText($(type.str)($id))</callback>
+ <param>
+ <name>Label</name>
+ <key>label</key>
+ <value></value>
+ <type>string</type>
+ <hide>#if $label() then 'none' else 'part'#</hide>
+ </param>
+ <param>
+ <name>Type</name>
+ <key>type</key>
+ <value>int</value>
+ <type>enum</type>
+ <hide>part</hide>
+ <option><name>Float</name><key>real</key><opt>conv:eng_notation.str_to_num</opt><opt>str:eng_notation.num_to_str</opt></option>
+ <option><name>Integer</name><key>int</key><opt>conv:int</opt><opt>str:str</opt></option>
+ <option><name>String</name><key>string</key><opt>conv:str</opt><opt>str:str</opt></option>
+ <option><name>Boolean</name><key>bool</key><opt>conv:bool</opt><opt>str:str</opt></option>
+ <option><name>Any</name><key>raw</key><opt>conv:eval</opt><opt>str:repr</opt></option>
+ </param>
+ <param>
+ <name>Default Value</name>
+ <key>value</key>
+ <value>0</value>
+ <type>$type</type>
+ </param>
+ <param>
+ <name>GUI Hint</name>
+ <key>gui_hint</key>
+ <value></value>
+ <type>gui_hint</type>
+ <hide>part</hide>
+ </param>
+ <doc>
+This block creates a variable with a text entry box. \
+Leave the label blank to use the variable id as the label.
+
+The GUI hint can be used to position the widget within the application. \
+The hint is of the form [tab_id@tab_index]: [row, col, row_span, col_span]. \
+Both the tab specification and the grid position are optional.
+ </doc>
+</block>
diff --git a/gr-qtgui/grc/qtgui_label.xml b/gr-qtgui/grc/qtgui_label.xml
new file mode 100644
index 000000000..5049118c4
--- /dev/null
+++ b/gr-qtgui/grc/qtgui_label.xml
@@ -0,0 +1,66 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Variable Label Text:
+## a gui static text form
+###################################################
+ -->
+<block>
+ <name>QT GUI Label</name>
+ <key>variable_qtgui_label</key>
+ <category>QT GUI Widgets</category>
+ <import>from PyQt4 import Qt</import>
+ <import>from gnuradio import eng_notation</import>
+ <var_make>self.$(id) = $(id) = $value</var_make>
+ <make>#set $win = 'self._%s_tool_bar'%$id
+$win = Qt.QToolBar(self)
+#if not $label()
+ #set $label = '"%s"'%$id
+#end if
+$(win).addWidget(Qt.QLabel($label+": "))
+self._$(id)_label = Qt.QLabel(str(self.$id))
+self._$(id)_tool_bar.addWidget(self._$(id)_label)
+$(gui_hint()($win))</make>
+ <callback>self.set_$(id)($value)</callback>
+ <callback>self._$(id)_label.setText($(type.str)($id))</callback>
+ <param>
+ <name>Label</name>
+ <key>label</key>
+ <value></value>
+ <type>string</type>
+ <hide>#if $label() then 'none' else 'part'#</hide>
+ </param>
+ <param>
+ <name>Type</name>
+ <key>type</key>
+ <value>int</value>
+ <type>enum</type>
+ <hide>part</hide>
+ <option><name>Float</name><key>real</key><opt>conv:eng_notation.str_to_num</opt><opt>str:eng_notation.num_to_str</opt></option>
+ <option><name>Integer</name><key>int</key><opt>conv:int</opt><opt>str:str</opt></option>
+ <option><name>String</name><key>string</key><opt>conv:str</opt><opt>str:str</opt></option>
+ <option><name>Boolean</name><key>bool</key><opt>conv:bool</opt><opt>str:str</opt></option>
+ <option><name>Any</name><key>raw</key><opt>conv:eval</opt><opt>str:repr</opt></option>
+ </param>
+ <param>
+ <name>Default Value</name>
+ <key>value</key>
+ <value>0</value>
+ <type>$type</type>
+ </param>
+ <param>
+ <name>GUI Hint</name>
+ <key>gui_hint</key>
+ <value></value>
+ <type>gui_hint</type>
+ <hide>part</hide>
+ </param>
+ <doc>
+This block creates a variable with a label widget for text. \
+Leave the label blank to use the variable id as the label.
+
+The GUI hint can be used to position the widget within the application. \
+The hint is of the form [tab_id@tab_index]: [row, col, row_span, col_span]. \
+Both the tab specification and the grid position are optional.
+ </doc>
+</block>
diff --git a/gr-qtgui/grc/qtgui_range.xml b/gr-qtgui/grc/qtgui_range.xml
new file mode 100644
index 000000000..6b0555f98
--- /dev/null
+++ b/gr-qtgui/grc/qtgui_range.xml
@@ -0,0 +1,211 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Variable Range:
+## ranged widgets like a slider or a knob
+###################################################
+ -->
+<block>
+ <name>QT GUI Range</name>
+ <key>variable_qtgui_range</key>
+ <category>QT GUI Widgets</category>
+ <import>from PyQt4 import Qt</import>
+ <import>import PyQt4.Qwt5 as Qwt</import>
+ <var_make>self.$(id) = $(id) = $value</var_make>
+ <make>#set $win = 'self._%s_layout'%$id
+#if not $label()
+ #set $label = '"%s"'%$id
+#end if
+########################################################################
+#if $widget() == "knob"
+########################################################################
+$win = Qt.QVBoxLayout()
+self._$(id)_knob = Qwt.QwtKnob()
+self._$(id)_knob.setRange($start, $stop, $step)
+self._$(id)_knob.setValue(self.$id)
+self._$(id)_knob.valueChanged.connect(self.set_$(id))
+$(win).addWidget(self._$(id)_knob)
+self._$(id)_label = Qt.QLabel($label)
+self._$(id)_label.setAlignment(Qt.Qt.AlignTop | Qt.Qt.AlignHCenter)
+$(win).addWidget(self._$(id)_label)
+#end if
+########################################################################
+#if $widget() == "thermo"
+########################################################################
+$win = Qt.QVBoxLayout()
+self._$(id)_label = Qt.QLabel($label)
+self._$(id)_thermo = Qwt.QwtThermo()
+self._$(id)_thermo.setScalePosition(Qwt.QwtThermo.$orient.scalepos)
+self._$(id)_thermo.setRange($start, $stop)
+self._$(id)_thermo.setValue(self.$id)
+self._$(id)_thermo.$(orient.minfcn)($min_len)
+#if 'horizontal' in $orient().lower()
+self._$(id)_label.setAlignment(Qt.Qt.AlignBottom | Qt.Qt.AlignHCenter)
+$(win).addWidget(self._$(id)_label)
+$(win).addWidget(self._$(id)_thermo)
+#elif 'vertical' in $orient().lower()
+self._$(id)_label.setAlignment(Qt.Qt.AlignTop)
+$(win).addWidget(self._$(id)_thermo)
+$(win).addWidget(self._$(id)_label)
+#end if
+#end if
+########################################################################
+#if $widget() == "counter"
+########################################################################
+$win = Qt.QHBoxLayout()
+$(win).addWidget(Qt.QLabel($label+": "))
+self._$(id)_counter = Qwt.QwtCounter()
+self._$(id)_counter.setRange($start, $stop, $step)
+self._$(id)_counter.setNumButtons(2)
+self._$(id)_counter.setMinimumWidth($min_len)
+self._$(id)_counter.setValue(self.$id)
+$(win).addWidget(self._$(id)_counter)
+self._$(id)_counter.valueChanged.connect(self.set_$(id))
+#end if
+########################################################################
+#if $widget() == "slider"
+########################################################################
+$win = Qt.QVBoxLayout()
+self._$(id)_label = Qt.QLabel($label)
+self._$(id)_slider = Qwt.QwtSlider(None, Qt.$orient, Qwt.QwtSlider.$orient.scalepos, Qwt.QwtSlider.BgSlot)
+self._$(id)_slider.setRange($start, $stop, $step)
+self._$(id)_slider.setValue(self.$id)
+self._$(id)_slider.$(orient.minfcn)($min_len)
+self._$(id)_slider.valueChanged.connect(self.set_$(id))
+#if 'horizontal' in $orient().lower()
+self._$(id)_label.setAlignment(Qt.Qt.AlignBottom | Qt.Qt.AlignHCenter)
+$(win).addWidget(self._$(id)_label)
+$(win).addWidget(self._$(id)_slider)
+#elif 'vertical' in $orient().lower()
+self._$(id)_label.setAlignment(Qt.Qt.AlignTop)
+$(win).addWidget(self._$(id)_slider)
+$(win).addWidget(self._$(id)_label)
+#end if
+#end if
+########################################################################
+#if $widget() == "counter_slider"
+########################################################################
+$win = Qt.QVBoxLayout()
+self._$(id)_tool_bar = Qt.QToolBar(self)
+$(win).addWidget(self._$(id)_tool_bar)
+self._$(id)_tool_bar.addWidget(Qt.QLabel($label+": "))
+self._$(id)_counter = Qwt.QwtCounter()
+self._$(id)_counter.setRange($start, $stop, $step)
+self._$(id)_counter.setNumButtons(2)
+self._$(id)_counter.setValue(self.$id)
+self._$(id)_tool_bar.addWidget(self._$(id)_counter)
+self._$(id)_counter.valueChanged.connect(self.set_$(id))
+self._$(id)_slider = Qwt.QwtSlider(None, Qt.Qt.Horizontal, Qwt.QwtSlider.BottomScale, Qwt.QwtSlider.BgSlot)
+self._$(id)_slider.setRange($start, $stop, $step)
+self._$(id)_slider.setValue(self.$id)
+self._$(id)_slider.setMinimumWidth($min_len)
+self._$(id)_slider.valueChanged.connect(self.set_$(id))
+$(win).addWidget(self._$(id)_slider)
+#end if
+$(gui_hint()($win))</make>
+ <callback>self.set_$(id)($value)</callback>
+ <callback>#if $widget() == "knob"
+self._$(id)_knob.setValue($id)
+#end if
+#if $widget() == "thermo"
+self._$(id)_thermo.setValue($id)
+#end if
+#if $widget() == "counter"
+self._$(id)_counter.setValue($id)
+#end if
+#if $widget() == "slider"
+self._$(id)_slider.setValue($id)
+#end if
+#if $widget() == "counter_slider"
+self._$(id)_counter.setValue($id)
+self._$(id)_slider.setValue($id)
+#end if</callback>
+ <param>
+ <name>Label</name>
+ <key>label</key>
+ <value></value>
+ <type>string</type>
+ <hide>#if $label() then 'none' else 'part'#</hide>
+ </param>
+ <param>
+ <name>Default Value</name>
+ <key>value</key>
+ <value>50</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Start</name>
+ <key>start</key>
+ <value>0</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Stop</name>
+ <key>stop</key>
+ <value>100</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Step</name>
+ <key>step</key>
+ <value>1</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Widget</name>
+ <key>widget</key>
+ <value>counter_slider</value>
+ <type>enum</type>
+ <hide>part</hide>
+ <option><name>Counter + Slider</name><key>counter_slider</key></option>
+ <option><name>Counter</name><key>counter</key></option>
+ <option><name>Slider</name><key>slider</key></option>
+ <option><name>Knob</name><key>knob</key></option>
+ <option><name>Thermo</name><key>thermo</key></option>
+ </param>
+ <param>
+ <name>Orientation</name>
+ <key>orient</key>
+ <value>Qt.Horizontal</value>
+ <type>enum</type>
+ <hide>#if $widget() in ("slider", "thermo") then 'part' else 'all'#</hide>
+ <option>
+ <name>Horizontal</name>
+ <key>Qt.Horizontal</key>
+ <opt>scalepos:BottomScale</opt>
+ <opt>minfcn:setMinimumWidth</opt>
+ </option>
+ <option>
+ <name>Vertical</name>
+ <key>Qt.Vertical</key>
+ <opt>scalepos:LeftScale</opt>
+ <opt>minfcn:setMinimumHeight</opt>
+ </option>
+ </param>
+ <param>
+ <name>Minimum Length</name>
+ <key>min_len</key>
+ <value>200</value>
+ <type>int</type>
+ <hide>#if $widget().split('_')[0] in ("slider", "counter", "thermo") then 'part' else 'all'#</hide>
+ </param>
+ <param>
+ <name>GUI Hint</name>
+ <key>gui_hint</key>
+ <value></value>
+ <type>gui_hint</type>
+ <hide>part</hide>
+ </param>
+ <check>$start &lt;= $value &lt;= $stop</check>
+ <check>$start &lt; $stop</check>
+ <doc>
+This block creates a variable with a slider. \
+Leave the label blank to use the variable id as the label. \
+The value must be a real number. \
+The value must be between the start and the stop.
+
+The GUI hint can be used to position the widget within the application. \
+The hint is of the form [tab_id@tab_index]: [row, col, row_span, col_span]. \
+Both the tab specification and the grid position are optional.
+ </doc>
+</block>
diff --git a/gr-qtgui/grc/qtgui_sink_x.xml b/gr-qtgui/grc/qtgui_sink_x.xml
new file mode 100644
index 000000000..6488ac04c
--- /dev/null
+++ b/gr-qtgui/grc/qtgui_sink_x.xml
@@ -0,0 +1,153 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##QT GUI Sink
+###################################################
+ -->
+<block>
+ <name>QT GUI Sink</name>
+ <key>qtgui_sink_x</key>
+ <category>QT GUI Widgets</category>
+ <import>from PyQt4 import Qt</import>
+ <import>from gnuradio.qtgui import qtgui</import>
+ <import>from gnuradio.gr import firdes</import>
+ <import>import sip</import>
+ <make>#set $win = 'self._%s_win'%$id
+qtgui.$(type.fcn)(
+ $fftsize, \#fftsize
+ $wintype, \#wintype
+ $fc, \#fc
+ $bw, \#bw
+ $name, \#name
+ $plotfreq, \#plotfreq
+ $plotwaterfall, \#plotwaterfall
+ $plottime, \#plottime
+ $plotconst, \#plotconst
+)
+self.$(id).set_update_time(1.0 / $rate)
+self._$(id)_win = sip.wrapinstance(self.$(id).pyqwidget(), Qt.QWidget)
+$(gui_hint()($win))</make>
+ <callback>set_frequency_range($fc, $bw)</callback>
+ <param>
+ <name>Type</name>
+ <key>type</key>
+ <value>complex</value>
+ <type>enum</type>
+ <option><name>Complex</name><key>complex</key><opt>fcn:sink_c</opt></option>
+ <option><name>Float</name><key>float</key><opt>fcn:sink_f</opt></option>
+ </param>
+ <param>
+ <name>Name</name>
+ <key>name</key>
+ <value>QT GUI Plot</value>
+ <type>string</type>
+ </param>
+ <param>
+ <name>FFT Size</name>
+ <key>fftsize</key>
+ <value>1024</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Window Type</name>
+ <key>wintype</key>
+ <value>firdes.WIN_BLACKMAN_hARRIS</value>
+ <type>int</type>
+ <hide>part</hide>
+ <option>
+ <name>Blackman-harris</name>
+ <key>firdes.WIN_BLACKMAN_hARRIS</key>
+ </option>
+ <option>
+ <name>Hamming</name>
+ <key>firdes.WIN_HAMMING</key>
+ </option>
+ <option>
+ <name>Hann</name>
+ <key>firdes.WIN_HANN</key>
+ </option>
+ <option>
+ <name>Blackman</name>
+ <key>firdes.WIN_BLACKMAN</key>
+ </option>
+ <option>
+ <name>Rectangular</name>
+ <key>firdes.WIN_RECTANGULAR</key>
+ </option>
+ <option>
+ <name>Kaiser</name>
+ <key>firdes.WIN_KAISER</key>
+ </option>
+ </param>
+ <param>
+ <name>Center Frequency (Hz)</name>
+ <key>fc</key>
+ <value>0</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Bandwidth (Hz)</name>
+ <key>bw</key>
+ <value>samp_rate</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Plot Frequency</name>
+ <key>plotfreq</key>
+ <value>True</value>
+ <type>bool</type>
+ <hide>part</hide>
+ <option><name>On</name><key>True</key></option>
+ <option><name>Off</name><key>False</key></option>
+ </param>
+ <param>
+ <name>Plot Waterfall</name>
+ <key>plotwaterfall</key>
+ <value>True</value>
+ <type>bool</type>
+ <hide>part</hide>
+ <option><name>On</name><key>True</key></option>
+ <option><name>Off</name><key>False</key></option>
+ </param>
+ <param>
+ <name>Plot Time</name>
+ <key>plottime</key>
+ <value>True</value>
+ <type>bool</type>
+ <hide>part</hide>
+ <option><name>On</name><key>True</key></option>
+ <option><name>Off</name><key>False</key></option>
+ </param>
+ <param>
+ <name>Plot Const</name>
+ <key>plotconst</key>
+ <value>True</value>
+ <type>bool</type>
+ <hide>part</hide>
+ <option><name>On</name><key>True</key></option>
+ <option><name>Off</name><key>False</key></option>
+ </param>
+ <param>
+ <name>GUI Hint</name>
+ <key>gui_hint</key>
+ <value></value>
+ <type>gui_hint</type>
+ <hide>part</hide>
+ </param>
+ <param>
+ <name>Update Rate</name>
+ <key>rate</key>
+ <value>10</value>
+ <type>real</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <nports>$num_inputs</nports>
+ </sink>
+ <doc>
+The GUI hint can be used to position the widget within the application. \
+The hint is of the form [tab_id@tab_index]: [row, col, row_span, col_span]. \
+Both the tab specification and the grid position are optional.
+ </doc>
+</block>
diff --git a/gr-qtgui/grc/qtgui_tab_widget.xml b/gr-qtgui/grc/qtgui_tab_widget.xml
new file mode 100644
index 000000000..f90054109
--- /dev/null
+++ b/gr-qtgui/grc/qtgui_tab_widget.xml
@@ -0,0 +1,84 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##WX GUI Notebook
+###################################################
+ -->
+<block>
+ <name>QT GUI Tab Widget</name>
+ <key>qtgui_tab_widget</key>
+ <category>QT GUI Widgets</category>
+ <import>from PyQt4 import Qt</import>
+ <make>#set $win = 'self.%s'%$id
+Qt.QTabWidget()
+#set $all_labels = [$label0, $label1, $label2, $label3, $label4][:int($num_tabs())]
+#for i, label in enumerate($all_labels)
+self.$(id)_widget_$(i) = Qt.QWidget()
+self.$(id)_layout_$(i) = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.$(id)_widget_$(i))
+self.$(id)_grid_layout_$(i) = Qt.QGridLayout()
+self.$(id)_layout_$(i).addLayout(self.$(id)_grid_layout_$(i))
+$(win).addTab(self.$(id)_widget_$(i), $label)
+#end for
+$(gui_hint()($win))</make>
+ <param>
+ <name>Num Tabs</name>
+ <key>num_tabs</key>
+ <value>1</value>
+ <type>enum</type>
+ <option><name>1</name><key>1</key></option>
+ <option><name>2</name><key>2</key></option>
+ <option><name>3</name><key>3</key></option>
+ <option><name>4</name><key>4</key></option>
+ <option><name>5</name><key>5</key></option>
+ </param>
+ <param>
+ <name>Label 0</name>
+ <key>label0</key>
+ <value>Tab 0</value>
+ <type>string</type>
+ <hide>#if int($num_tabs()) > 0 then 'none' else 'all'#</hide>
+ </param>
+ <param>
+ <name>Label 1</name>
+ <key>label1</key>
+ <value>Tab 1</value>
+ <type>string</type>
+ <hide>#if int($num_tabs()) > 1 then 'none' else 'all'#</hide>
+ </param>
+ <param>
+ <name>Label 2</name>
+ <key>label2</key>
+ <value>Tab 2</value>
+ <type>string</type>
+ <hide>#if int($num_tabs()) > 2 then 'none' else 'all'#</hide>
+ </param>
+ <param>
+ <name>Label 3</name>
+ <key>label3</key>
+ <value>Tab 3</value>
+ <type>string</type>
+ <hide>#if int($num_tabs()) > 3 then 'none' else 'all'#</hide>
+ </param>
+ <param>
+ <name>Label 4</name>
+ <key>label4</key>
+ <value>Tab 4</value>
+ <type>string</type>
+ <hide>#if int($num_tabs()) > 4 then 'none' else 'all'#</hide>
+ </param>
+ <param>
+ <name>GUI Hint</name>
+ <key>gui_hint</key>
+ <value></value>
+ <type>gui_hint</type>
+ <hide>part</hide>
+ </param>
+ <doc>
+This block creates a tabbed widget to organize other widgets. \
+The ID of this block can be used as the tab_id in the GUI hints of other widgets.
+
+The GUI hint can be used to position the widget within the application. \
+The hint is of the form [tab_id@tab_index]: [row, col, row_span, col_span]. \
+Both the tab specification and the grid position are optional.
+ </doc>
+</block>
diff --git a/gr-qtgui/grc/qtgui_time_sink_x.xml b/gr-qtgui/grc/qtgui_time_sink_x.xml
new file mode 100644
index 000000000..9c8da6fbc
--- /dev/null
+++ b/gr-qtgui/grc/qtgui_time_sink_x.xml
@@ -0,0 +1,78 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##QT GUI Sink
+###################################################
+ -->
+<block>
+ <name>QT GUI Time Sink</name>
+ <key>qtgui_time_sink_x</key>
+ <category>QT GUI Widgets</category>
+ <import>from PyQt4 import Qt</import>
+ <import>from gnuradio.qtgui import qtgui</import>
+ <import>from gnuradio.gr import firdes</import>
+ <import>import sip</import>
+ <make>#set $win = 'self._%s_win'%$id
+qtgui.$(type.fcn)(
+ $size, \#size
+ $bw, \#bw
+ $name, \#name
+ $nconnections \#number of inputs
+)
+self._$(id)_win = sip.wrapinstance(self.$(id).pyqwidget(), Qt.QWidget)
+$(gui_hint()($win))</make>
+ <callback>set_time_domain_axis($min, $max)</callback>
+ <callback>set_update_time($t)</callback>
+ <callback>set_title($which, $title)</callback>
+ <callback>set_color($which, $color)</callback>
+ <param>
+ <name>Type</name>
+ <key>type</key>
+ <value>complex</value>
+ <type>enum</type>
+ <option><name>Complex</name><key>complex</key><opt>fcn:time_sink_c</opt></option>
+ <option><name>Float</name><key>float</key><opt>fcn:time_sink_f</opt></option>
+ </param>
+ <param>
+ <name>Name</name>
+ <key>name</key>
+ <value>QT GUI Plot</value>
+ <type>string</type>
+ </param>
+ <param>
+ <name>Number of Points</name>
+ <key>size</key>
+ <value>1024</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Bandwidth (Hz)</name>
+ <key>bw</key>
+ <value>samp_rate</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Number of Inputs</name>
+ <key>nconnections</key>
+ <value>1</value>
+ <type>int</type>
+ <hide>part</hide>
+ </param>
+ <param>
+ <name>GUI Hint</name>
+ <key>gui_hint</key>
+ <value></value>
+ <type>gui_hint</type>
+ <hide>part</hide>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <nports>$nconnections</nports>
+ </sink>
+ <doc>
+The GUI hint can be used to position the widget within the application. \
+The hint is of the form [tab_id@tab_index]: [row, col, row_span, col_span]. \
+Both the tab specification and the grid position are optional.
+ </doc>
+</block>
diff --git a/gr-qtgui/include/CMakeLists.txt b/gr-qtgui/include/CMakeLists.txt
new file mode 100644
index 000000000..ef4cb1175
--- /dev/null
+++ b/gr-qtgui/include/CMakeLists.txt
@@ -0,0 +1,32 @@
+# 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.
+
+########################################################################
+# Install the header files
+########################################################################
+install(FILES
+ gr_qtgui_api.h
+ qtgui_time_sink_c.h
+ qtgui_time_sink_f.h
+ qtgui_sink_c.h
+ qtgui_sink_f.h
+ qtgui_util.h
+ DESTINATION ${GR_INCLUDE_DIR}/gnuradio
+ COMPONENT "qtgui_devel"
+)
diff --git a/gr-qtgui/include/gr_qtgui_api.h b/gr-qtgui/include/gr_qtgui_api.h
new file mode 100644
index 000000000..c39add1e8
--- /dev/null
+++ b/gr-qtgui/include/gr_qtgui_api.h
@@ -0,0 +1,33 @@
+/*
+ * Copyright 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.
+ */
+
+#ifndef INCLUDED_GR_QTGUI_API_H
+#define INCLUDED_GR_QTGUI_API_H
+
+#include <gruel/attributes.h>
+
+#ifdef gnuradio_qtgui_EXPORTS
+# define GR_QTGUI_API __GR_ATTR_EXPORT
+#else
+# define GR_QTGUI_API __GR_ATTR_IMPORT
+#endif
+
+#endif /* INCLUDED_GR_QTGUI_API_H */
diff --git a/gr-qtgui/include/qtgui_sink_c.h b/gr-qtgui/include/qtgui_sink_c.h
new file mode 100644
index 000000000..68fff368a
--- /dev/null
+++ b/gr-qtgui/include/qtgui_sink_c.h
@@ -0,0 +1,128 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,2009,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.
+ */
+
+#ifndef INCLUDED_QTGUI_SINK_C_H
+#define INCLUDED_QTGUI_SINK_C_H
+
+#include <Python.h>
+#include <gr_qtgui_api.h>
+#include <gr_block.h>
+#include <gr_firdes.h>
+#include <gri_fft.h>
+#include <qapplication.h>
+#include <gruel/high_res_timer.h>
+#include "SpectrumGUIClass.h"
+
+class qtgui_sink_c;
+typedef boost::shared_ptr<qtgui_sink_c> qtgui_sink_c_sptr;
+
+GR_QTGUI_API qtgui_sink_c_sptr qtgui_make_sink_c (int fftsize, int wintype,
+ double fc=0, double bandwidth=1.0,
+ const std::string &name="Spectrum Display",
+ bool plotfreq=true, bool plotwaterfall=true,
+ bool plottime=true, bool plotconst=true,
+ QWidget *parent=NULL);
+
+/*!
+ * \brief A graphical sink to display freq, spec, time, and const plots.
+ * \ingroup qtgui_blk
+ *
+ * This is a QT-based graphical sink the takes a complex stream and
+ * plots it. The default action is to plot the signal as a PSD (FFT),
+ * spectrogram (waterfall), time domain I&Q, and constellation (I
+ * vs. Q) plots. The plots may be turned off by setting the
+ * appropriate boolean value in the constructor to False.
+ */
+
+class GR_QTGUI_API qtgui_sink_c : public gr_block
+{
+private:
+ friend GR_QTGUI_API qtgui_sink_c_sptr qtgui_make_sink_c (int fftsize, int wintype,
+ double fc, double bw,
+ const std::string &name,
+ bool plotfreq, bool plotwaterfall,
+ bool plottime, bool plotconst,
+ QWidget *parent);
+ qtgui_sink_c (int fftsize, int wintype,
+ double fc, double bw,
+ const std::string &name,
+ bool plotfreq, bool plotwaterfall,
+ bool plottime, bool plotconst,
+ QWidget *parent);
+
+ void forecast(int noutput_items, gr_vector_int &ninput_items_required);
+
+ void initialize();
+
+ int d_fftsize;
+ gr_firdes::win_type d_wintype;
+ std::vector<float> d_window;
+ double d_center_freq;
+ double d_bandwidth;
+ std::string d_name;
+ gruel::high_res_timer_type d_last_update;
+ bool d_update_active;
+
+ bool d_shift;
+ gri_fft_complex *d_fft;
+
+ int d_index;
+ gr_complex *d_residbuf;
+
+ bool d_plotfreq, d_plotwaterfall, d_plottime, d_plotconst;
+
+ gruel::high_res_timer_type d_update_time;
+
+ QWidget *d_parent;
+ SpectrumGUIClass *d_main_gui;
+
+ void windowreset();
+ void buildwindow();
+ void fftresize();
+ void fft(const gr_complex *data_in, int size);
+
+public:
+ ~qtgui_sink_c();
+ void exec_();
+ QWidget* qwidget();
+ PyObject* pyqwidget();
+
+ void set_frequency_range(const double centerfreq,
+ const double bandwidth);
+
+ void set_time_domain_axis(double min, double max);
+ void set_constellation_axis(double xmin, double xmax,
+ double ymin, double ymax);
+ void set_constellation_pen_size(int size);
+ void set_frequency_axis(double min, double max);
+
+ void set_update_time(double t);
+
+ QApplication *d_qApplication;
+
+ int general_work (int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif /* INCLUDED_QTGUI_SINK_C_H */
diff --git a/gr-qtgui/include/qtgui_sink_f.h b/gr-qtgui/include/qtgui_sink_f.h
new file mode 100644
index 000000000..709f02a2f
--- /dev/null
+++ b/gr-qtgui/include/qtgui_sink_f.h
@@ -0,0 +1,125 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,2009,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.
+ */
+
+#ifndef INCLUDED_QTGUI_SINK_F_H
+#define INCLUDED_QTGUI_SINK_F_H
+
+#include <Python.h>
+#include <gr_qtgui_api.h>
+#include <gr_block.h>
+#include <gr_firdes.h>
+#include <gri_fft.h>
+#include <qapplication.h>
+#include "SpectrumGUIClass.h"
+
+class qtgui_sink_f;
+typedef boost::shared_ptr<qtgui_sink_f> qtgui_sink_f_sptr;
+
+GR_QTGUI_API qtgui_sink_f_sptr qtgui_make_sink_f (int fftsize, int wintype,
+ double fc=0, double bw=1.0,
+ const std::string &name="Spectrum Display",
+ bool plotfreq=true, bool plotwaterfall=true,
+ bool plottime=true, bool plotconst=false,
+ QWidget *parent=NULL);
+
+/*!
+ * \brief A graphical sink to display freq, spec, and time.
+ * \ingroup qtgui_blk
+ *
+ * This is a QT-based graphical sink the takes a float stream and
+ * plots it. The default action is to plot the signal as a PSD (FFT),
+ * spectrogram (waterfall), and time domain plots. The plots may be
+ * turned off by setting the appropriate boolean value in the
+ * constructor to False.
+ */
+
+class GR_QTGUI_API qtgui_sink_f : public gr_block
+{
+private:
+ friend GR_QTGUI_API qtgui_sink_f_sptr qtgui_make_sink_f (int fftsize, int wintype,
+ double fc, double bw,
+ const std::string &name,
+ bool plotfreq, bool plotwaterfall,
+ bool plottime, bool plotconst,
+ QWidget *parent);
+ qtgui_sink_f (int fftsize, int wintype,
+ double fc, double bw,
+ const std::string &name,
+ bool plotfreq, bool plotwaterfall,
+ bool plottime, bool plotconst,
+ QWidget *parent);
+
+ void forecast(int noutput_items, gr_vector_int &ninput_items_required);
+
+ void initialize();
+
+ int d_fftsize;
+ gr_firdes::win_type d_wintype;
+ std::vector<float> d_window;
+ double d_center_freq;
+ double d_bandwidth;
+ std::string d_name;
+
+ bool d_shift;
+ gri_fft_complex *d_fft;
+
+ int d_index;
+ float *d_residbuf;
+
+ bool d_plotfreq, d_plotwaterfall, d_plottime, d_plotconst;
+
+ double d_update_time;
+
+ QWidget *d_parent;
+ SpectrumGUIClass *d_main_gui;
+
+ void windowreset();
+ void buildwindow();
+ void fftresize();
+ void fft(const float *data_in, int size);
+
+public:
+ ~qtgui_sink_f();
+ void exec_();
+ QWidget* qwidget();
+ PyObject* pyqwidget();
+
+ void set_frequency_range(const double centerfreq,
+ const double bandwidth);
+
+ void set_time_domain_axis(double min, double max);
+ void set_constellation_axis(double xmin, double xmax,
+ double ymin, double ymax);
+ void set_constellation_pen_size(int size);
+ void set_frequency_axis(double min, double max);
+
+ void set_update_time(double t);
+
+ QApplication *d_qApplication;
+
+ int general_work (int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif /* INCLUDED_QTGUI_SINK_F_H */
diff --git a/gr-qtgui/include/qtgui_time_sink_c.h b/gr-qtgui/include/qtgui_time_sink_c.h
new file mode 100644
index 000000000..561d796cf
--- /dev/null
+++ b/gr-qtgui/include/qtgui_time_sink_c.h
@@ -0,0 +1,101 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+#ifndef INCLUDED_QTGUI_TIME_SINK_C_H
+#define INCLUDED_QTGUI_TIME_SINK_C_H
+
+#include <Python.h>
+#include <gr_qtgui_api.h>
+#include <gr_sync_block.h>
+#include <gr_firdes.h>
+#include <gri_fft.h>
+#include <qapplication.h>
+#include <timedisplayform.h>
+
+class qtgui_time_sink_c;
+typedef boost::shared_ptr<qtgui_time_sink_c> qtgui_time_sink_c_sptr;
+
+GR_QTGUI_API qtgui_time_sink_c_sptr qtgui_make_time_sink_c(int size, double bw,
+ const std::string &name,
+ int nconnectons=1,
+ QWidget *parent=NULL);
+
+/*!
+ * \brief A graphical sink to display multiple signals in time.
+ * \ingroup qtgui_blk
+ *
+ * This is a QT-based graphical sink the takes set of a complex
+ * streams and plots them in the time domain. For each signal, both
+ * the signal's I and Q parts are plotted, and they are all plotted
+ * with a different color, and the \a set_title and \a set_color
+ * functions can be used to change the lable and color for a given
+ * input number.
+ */
+class GR_QTGUI_API qtgui_time_sink_c : public gr_sync_block
+{
+private:
+ friend GR_QTGUI_API qtgui_time_sink_c_sptr qtgui_make_time_sink_c(int size, double bw,
+ const std::string &name,
+ int nconnections,
+ QWidget *parent);
+ qtgui_time_sink_c(int size, double bw,
+ const std::string &name,
+ int nconnections,
+ QWidget *parent=NULL);
+
+ void initialize();
+
+ int d_size;
+ double d_bandwidth;
+ std::string d_name;
+ int d_nconnections;
+
+ int d_index;
+ std::vector<double*> d_residbufs;
+
+ double d_update_time;
+
+ QWidget *d_parent;
+ TimeDisplayForm *d_main_gui;
+
+ gruel::high_res_timer_type d_current_time;
+ gruel::high_res_timer_type d_last_time;
+
+public:
+ ~qtgui_time_sink_c();
+ void exec_();
+ QWidget* qwidget();
+ PyObject* pyqwidget();
+
+ void set_time_domain_axis(double min, double max);
+ void set_update_time(double t);
+ void set_title(int which, const std::string &title);
+ void set_color(int which, const std::string &color);
+
+ QApplication *d_qApplication;
+
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif /* INCLUDED_QTGUI_TIME_SINK_C_H */
diff --git a/gr-qtgui/include/qtgui_time_sink_f.h b/gr-qtgui/include/qtgui_time_sink_f.h
new file mode 100644
index 000000000..993e0556c
--- /dev/null
+++ b/gr-qtgui/include/qtgui_time_sink_f.h
@@ -0,0 +1,99 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+#ifndef INCLUDED_QTGUI_TIME_SINK_F_H
+#define INCLUDED_QTGUI_TIME_SINK_F_H
+
+#include <Python.h>
+#include <gr_qtgui_api.h>
+#include <gr_sync_block.h>
+#include <gr_firdes.h>
+#include <gri_fft.h>
+#include <qapplication.h>
+#include <timedisplayform.h>
+
+class qtgui_time_sink_f;
+typedef boost::shared_ptr<qtgui_time_sink_f> qtgui_time_sink_f_sptr;
+
+GR_QTGUI_API qtgui_time_sink_f_sptr qtgui_make_time_sink_f(int size, double bw,
+ const std::string &name,
+ int nconnectons=1,
+ QWidget *parent=NULL);
+
+/*!
+ * \brief A graphical sink to display multiple signals in time.
+ * \ingroup qtgui_blk
+ *
+ * This is a QT-based graphical sink the takes set of a float streams
+ * and plots them in the time domain. Each signal is plotted with a
+ * different color, and the \a set_title and \a set_color functions
+ * can be used to change the lable and color for a given input number.
+ */
+class GR_QTGUI_API qtgui_time_sink_f : public gr_sync_block
+{
+private:
+ friend GR_QTGUI_API qtgui_time_sink_f_sptr qtgui_make_time_sink_f(int size, double bw,
+ const std::string &name,
+ int nconnections,
+ QWidget *parent);
+ qtgui_time_sink_f(int size, double bw,
+ const std::string &name,
+ int nconnections,
+ QWidget *parent=NULL);
+
+ void initialize();
+
+ int d_size;
+ double d_bandwidth;
+ std::string d_name;
+ int d_nconnections;
+
+ int d_index;
+ std::vector<double*> d_residbufs;
+
+ double d_update_time;
+
+ QWidget *d_parent;
+ TimeDisplayForm *d_main_gui;
+
+ gruel::high_res_timer_type d_current_time;
+ gruel::high_res_timer_type d_last_time;
+
+public:
+ ~qtgui_time_sink_f();
+ void exec_();
+ QWidget* qwidget();
+ PyObject* pyqwidget();
+
+ void set_time_domain_axis(double min, double max);
+ void set_update_time(double t);
+ void set_title(int which, const std::string &title);
+ void set_color(int which, const std::string &color);
+
+ QApplication *d_qApplication;
+
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif /* INCLUDED_QTGUI_TIME_SINK_F_H */
diff --git a/gr-qtgui/include/qtgui_util.h b/gr-qtgui/include/qtgui_util.h
new file mode 100644
index 000000000..2deaddb94
--- /dev/null
+++ b/gr-qtgui/include/qtgui_util.h
@@ -0,0 +1,57 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+#ifndef INCLUDED_QTGUI_UTIL_H
+#define INCLUDED_QTGUI_UTIL_H
+
+#include <qevent.h>
+#include <gr_qtgui_api.h>
+#include <qwt_plot_picker.h>
+#include <qwt_picker_machine.h>
+
+
+class GR_QTGUI_API QwtDblClickPlotPicker: public QwtPlotPicker
+{
+public:
+ QwtDblClickPlotPicker(QwtPlotCanvas *);
+ ~QwtDblClickPlotPicker();
+
+ virtual QwtPickerMachine * stateMachine(int) const;
+};
+
+class GR_QTGUI_API QwtPickerDblClickPointMachine: public QwtPickerMachine
+{
+public:
+ QwtPickerDblClickPointMachine();
+ ~QwtPickerDblClickPointMachine();
+
+#if QWT_VERSION < 0x060000
+ virtual CommandList transition( const QwtEventPattern &eventPattern,
+ const QEvent *e);
+#else
+ virtual QList<QwtPickerMachine::Command>
+ transition( const QwtEventPattern &eventPattern,
+ const QEvent *e);
+#endif
+};
+
+#endif /* INCLUDED_QTGUI_UTIL_H */
diff --git a/gr-qtgui/lib/CMakeLists.txt b/gr-qtgui/lib/CMakeLists.txt
new file mode 100644
index 000000000..49fa525d7
--- /dev/null
+++ b/gr-qtgui/lib/CMakeLists.txt
@@ -0,0 +1,112 @@
+# Copyright 2010-2011,2013 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.
+
+########################################################################
+# Setup the QT file generations stuff
+########################################################################
+set(qtgui_moc_hdrs
+ spectrumdisplayform.h
+ timedisplayform.h
+ FrequencyDisplayPlot.h
+ TimeDomainDisplayPlot.h
+ WaterfallDisplayPlot.h
+ ConstellationDisplayPlot.h
+)
+QT4_WRAP_CPP(qtgui_moc_srcs ${qtgui_moc_hdrs})
+QT4_WRAP_UI(qtgui_ui_hdrs spectrumdisplayform.ui)
+
+#FIXME the sources expect <foo>.ui.h, but the macros generate ui_foo.h
+#avoid changing the sources by generating the header with the include
+set(spectrum_ui_hdr ${CMAKE_CURRENT_BINARY_DIR}/spectrumdisplayform.ui.h)
+if(NOT EXISTS ${spectrum_ui_hdr})
+ file(WRITE ${spectrum_ui_hdr} "#include <ui_spectrumdisplayform.h>\n")
+endif(NOT EXISTS ${spectrum_ui_hdr})
+
+set(qtgui_srcs
+ ${qtgui_moc_srcs}
+ ${qtgui_ui_hdrs}
+ FrequencyDisplayPlot.cc
+ TimeDomainDisplayPlot.cc
+ WaterfallDisplayPlot.cc
+ waterfallGlobalData.cc
+ ConstellationDisplayPlot.cc
+ spectrumdisplayform.cc
+ timedisplayform.cc
+ SpectrumGUIClass.cc
+ spectrumUpdateEvents.cc
+ plot_waterfall.cc
+ qtgui_sink_c.cc
+ qtgui_sink_f.cc
+ qtgui_time_sink_c.cc
+ qtgui_time_sink_f.cc
+ qtgui_util.cc
+)
+
+########################################################################
+# Setup the include and linker paths
+########################################################################
+include_directories(
+ ${GR_QTGUI_INCLUDE_DIRS}
+ ${GNURADIO_CORE_INCLUDE_DIRS}
+ ${GRUEL_INCLUDE_DIRS}
+ ${QWT_INCLUDE_DIRS}
+ ${QT_INCLUDE_DIRS}
+ ${Boost_INCLUDE_DIRS}
+ ${PYTHON_INCLUDE_DIRS}
+)
+
+link_directories(
+ ${QWT_LIBRARY_DIRS}
+ ${Boost_LIBRARY_DIRS}
+)
+
+include_directories(${PYTHON_INCLUDE_PATH}) #deprecated for dirs (cmake 2.6)
+
+########################################################################
+# Setup library
+########################################################################
+list(APPEND qtgui_libs
+ gnuradio-core
+ ${QWT_LIBRARIES}
+ ${QT_LIBRARIES}
+ ${PYTHON_LIBRARIES}
+)
+
+add_definitions(-DQWT_DLL) #setup QWT library linkage
+add_library(gnuradio-qtgui SHARED ${qtgui_srcs})
+target_link_libraries(gnuradio-qtgui ${qtgui_libs})
+GR_LIBRARY_FOO(gnuradio-qtgui RUNTIME_COMPONENT "qtgui_runtime" DEVEL_COMPONENT "qtgui_devel")
+
+########################################################################
+# Install the header files
+########################################################################
+install(FILES
+ FrequencyDisplayPlot.h
+ TimeDomainDisplayPlot.h
+ WaterfallDisplayPlot.h
+ waterfallGlobalData.h
+ ConstellationDisplayPlot.h
+ plot_waterfall.h
+ spectrumdisplayform.h
+ timedisplayform.h
+ SpectrumGUIClass.h
+ spectrumUpdateEvents.h
+ DESTINATION ${GR_INCLUDE_DIR}/gnuradio
+ COMPONENT "qtgui_devel"
+)
diff --git a/gr-qtgui/lib/ConstellationDisplayPlot.cc b/gr-qtgui/lib/ConstellationDisplayPlot.cc
new file mode 100644
index 000000000..7a595fef4
--- /dev/null
+++ b/gr-qtgui/lib/ConstellationDisplayPlot.cc
@@ -0,0 +1,255 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,2009,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.
+ */
+
+#ifndef CONSTELLATION_DISPLAY_PLOT_C
+#define CONSTELLATION_DISPLAY_PLOT_C
+
+#include <ConstellationDisplayPlot.h>
+
+#include <qwt_scale_draw.h>
+#include <qwt_legend.h>
+#include <iostream>
+
+class ConstellationDisplayZoomer: public QwtPlotZoomer
+{
+public:
+ ConstellationDisplayZoomer(QwtPlotCanvas* canvas):QwtPlotZoomer(canvas)
+ {
+ setTrackerMode(QwtPicker::AlwaysOn);
+ }
+
+ virtual ~ConstellationDisplayZoomer(){
+
+ }
+
+ virtual void updateTrackerText(){
+ updateDisplay();
+ }
+
+protected:
+ using QwtPlotZoomer::trackerText;
+ virtual QwtText trackerText( const QwtDoublePoint& p ) const
+ {
+ QwtText t(QString("(%1, %2)").arg(p.x(), 0, 'f', 4).
+ arg(p.y(), 0, 'f', 4));
+ return t;
+ }
+};
+
+ConstellationDisplayPlot::ConstellationDisplayPlot(QWidget* parent)
+ : QwtPlot(parent)
+{
+ _lastReplot = 0;
+
+ resize(parent->width(), parent->height());
+
+ _numPoints = 1024;
+ _penSize = 5;
+ _realDataPoints = new double[_numPoints];
+ _imagDataPoints = new double[_numPoints];
+
+ // Disable polygon clipping
+#if QWT_VERSION < 0x060000
+ QwtPainter::setDeviceClipping(false);
+#else
+ QwtPainter::setPolylineSplitting(false);
+#endif
+
+#if QWT_VERSION < 0x060000
+ // We don't need the cache here
+ canvas()->setPaintAttribute(QwtPlotCanvas::PaintCached, false);
+ canvas()->setPaintAttribute(QwtPlotCanvas::PaintPacked, false);
+#endif
+
+ QPalette palette;
+ palette.setColor(canvas()->backgroundRole(), QColor("white"));
+ canvas()->setPalette(palette);
+
+ setAxisScaleEngine(QwtPlot::xBottom, new QwtLinearScaleEngine);
+ set_xaxis(-2.0, 2.0);
+ setAxisTitle(QwtPlot::xBottom, "In-phase");
+
+ setAxisScaleEngine(QwtPlot::yLeft, new QwtLinearScaleEngine);
+ set_yaxis(-2.0, 2.0);
+ setAxisTitle(QwtPlot::yLeft, "Quadrature");
+
+ // Automatically deleted when parent is deleted
+ _plot_curve = new QwtPlotCurve("Constellation Points");
+ _plot_curve->attach(this);
+ _plot_curve->setPen(QPen(Qt::blue, _penSize, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
+ _plot_curve->setStyle(QwtPlotCurve::Dots);
+
+#if QWT_VERSION < 0x060000
+ _plot_curve->setRawData(_realDataPoints, _imagDataPoints, _numPoints);
+#else
+ _plot_curve->setRawSamples(_realDataPoints, _imagDataPoints, _numPoints);
+#endif
+
+ memset(_realDataPoints, 0x0, _numPoints*sizeof(double));
+ memset(_imagDataPoints, 0x0, _numPoints*sizeof(double));
+
+ _zoomer = new ConstellationDisplayZoomer(canvas());
+
+#if QWT_VERSION < 0x060000
+ _zoomer->setSelectionFlags(QwtPicker::RectSelection | QwtPicker::DragSelection);
+#endif
+
+ _zoomer->setMousePattern(QwtEventPattern::MouseSelect2,
+ Qt::RightButton, Qt::ControlModifier);
+ _zoomer->setMousePattern(QwtEventPattern::MouseSelect3,
+ Qt::RightButton);
+
+ _panner = new QwtPlotPanner(canvas());
+ _panner->setAxisEnabled(QwtPlot::yRight, false);
+ _panner->setMouseButton(Qt::MidButton);
+
+ // Avoid jumping when labels with more/less digits
+ // appear/disappear when scrolling vertically
+
+ const QFontMetrics fm(axisWidget(QwtPlot::yLeft)->font());
+ QwtScaleDraw *sd = axisScaleDraw(QwtPlot::yLeft);
+ sd->setMinimumExtent( fm.width("100.00") );
+
+ const QColor c(Qt::darkRed);
+ _zoomer->setRubberBandPen(c);
+ _zoomer->setTrackerPen(c);
+
+ // emit the position of clicks on widget
+ _picker = new QwtDblClickPlotPicker(canvas());
+
+#if QWT_VERSION < 0x060000
+ connect(_picker, SIGNAL(selected(const QwtDoublePoint &)),
+ this, SLOT(OnPickerPointSelected(const QwtDoublePoint &)));
+#else
+ connect(_picker, SIGNAL(selected(const QPointF &)),
+ this, SLOT(OnPickerPointSelected6(const QPointF &)));
+#endif
+
+ connect(this, SIGNAL(legendChecked(QwtPlotItem *, bool ) ),
+ this, SLOT(LegendEntryChecked(QwtPlotItem *, bool ) ));
+}
+
+ConstellationDisplayPlot::~ConstellationDisplayPlot()
+{
+ delete[] _realDataPoints;
+ delete[] _imagDataPoints;
+
+ // _fft_plot_curves deleted when parent deleted
+ // _zoomer and _panner deleted when parent deleted
+}
+
+void
+ConstellationDisplayPlot::set_pen_size(int size)
+{
+ if(size > 0 && size < 30){
+ _penSize = size;
+ _plot_curve->setPen(QPen(Qt::blue, _penSize, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
+ }
+}
+
+
+void
+ConstellationDisplayPlot::set_xaxis(double min, double max)
+{
+ setAxisScale(QwtPlot::xBottom, min, max);
+}
+
+void
+ConstellationDisplayPlot::set_yaxis(double min, double max)
+{
+ setAxisScale(QwtPlot::yLeft, min, max);
+}
+
+void
+ConstellationDisplayPlot::set_axis(double xmin, double xmax,
+ double ymin, double ymax)
+{
+ set_xaxis(xmin, xmax);
+ set_yaxis(ymin, ymax);
+}
+
+void ConstellationDisplayPlot::replot()
+{
+ QwtPlot::replot();
+}
+
+void
+ConstellationDisplayPlot::resizeSlot( QSize *s )
+{
+ resize(s->width(), s->height());
+}
+
+void ConstellationDisplayPlot::PlotNewData(const double* realDataPoints,
+ const double* imagDataPoints,
+ const int64_t numDataPoints,
+ const double timeInterval)
+{
+ if((numDataPoints > 0) &&
+ (gruel::high_res_timer_now() - _lastReplot > timeInterval*gruel::high_res_timer_tps())) {
+
+ if(numDataPoints != _numPoints){
+ _numPoints = numDataPoints;
+
+ delete[] _realDataPoints;
+ delete[] _imagDataPoints;
+ _realDataPoints = new double[_numPoints];
+ _imagDataPoints = new double[_numPoints];
+
+#if QWT_VERSION < 0x060000
+ _plot_curve->setRawData(_realDataPoints, _imagDataPoints, _numPoints);
+#else
+ _plot_curve->setRawSamples(_realDataPoints, _imagDataPoints, _numPoints);
+#endif
+ }
+
+ memcpy(_realDataPoints, realDataPoints, numDataPoints*sizeof(double));
+ memcpy(_imagDataPoints, imagDataPoints, numDataPoints*sizeof(double));
+
+ replot();
+
+ _lastReplot = gruel::high_res_timer_now();
+ }
+}
+
+void
+ConstellationDisplayPlot::LegendEntryChecked(QwtPlotItem* plotItem, bool on)
+{
+ plotItem->setVisible(!on);
+}
+
+void
+ConstellationDisplayPlot::OnPickerPointSelected(const QwtDoublePoint & p)
+{
+ QPointF point = p;
+ //fprintf(stderr,"OnPickerPointSelected %f %f\n", point.x(), point.y());
+ emit plotPointSelected(point);
+}
+
+void
+ConstellationDisplayPlot::OnPickerPointSelected6(const QPointF & p)
+{
+ QPointF point = p;
+ //fprintf(stderr,"OnPickerPointSelected %f %f\n", point.x(), point.y());
+ emit plotPointSelected(point);
+}
+
+#endif /* CONSTELLATION_DISPLAY_PLOT_C */
diff --git a/gr-qtgui/lib/ConstellationDisplayPlot.h b/gr-qtgui/lib/ConstellationDisplayPlot.h
new file mode 100644
index 000000000..9e0f6f26a
--- /dev/null
+++ b/gr-qtgui/lib/ConstellationDisplayPlot.h
@@ -0,0 +1,101 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,2009,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.
+ */
+
+#ifndef CONSTELLATION_DISPLAY_PLOT_HPP
+#define CONSTELLATION_DISPLAY_PLOT_HPP
+
+#include <stdint.h>
+#include <cstdio>
+#include <qwt_plot.h>
+#include <qwt_painter.h>
+#include <qwt_plot_canvas.h>
+#include <qwt_plot_curve.h>
+#include <qwt_scale_engine.h>
+#include <qwt_scale_widget.h>
+#include <qwt_plot_zoomer.h>
+#include <qwt_plot_panner.h>
+#include <qwt_plot_marker.h>
+#include <gruel/high_res_timer.h>
+#include <qwt_symbol.h>
+#include <qtgui_util.h>
+
+#if QWT_VERSION >= 0x060000
+#include <qwt_point_3d.h> // doesn't seem necessary, but is...
+#include <qwt_compat.h>
+#endif
+
+class ConstellationDisplayPlot : public QwtPlot
+{
+ Q_OBJECT
+
+public:
+ ConstellationDisplayPlot(QWidget*);
+ virtual ~ConstellationDisplayPlot();
+
+ void PlotNewData(const double* realDataPoints,
+ const double* imagDataPoints,
+ const int64_t numDataPoints,
+ const double timeInterval);
+
+ virtual void replot();
+
+ void set_xaxis(double min, double max);
+ void set_yaxis(double min, double max);
+ void set_axis(double xmin, double xmax,
+ double ymin, double ymax);
+ void set_pen_size(int size);
+
+public slots:
+ void resizeSlot( QSize *s );
+
+ // Because of the preprocessing of slots in QT, these are no
+ // easily separated by the version check. Make one for each
+ // version until it's worked out.
+ void OnPickerPointSelected(const QwtDoublePoint & p);
+ void OnPickerPointSelected6(const QPointF & p);
+
+signals:
+ void plotPointSelected(const QPointF p);
+
+protected slots:
+ void LegendEntryChecked(QwtPlotItem *plotItem, bool on);
+
+protected:
+
+private:
+ QwtPlotCurve* _plot_curve;
+
+ QwtPlotPanner* _panner;
+ QwtPlotZoomer* _zoomer;
+
+ QwtDblClickPlotPicker *_picker;
+
+ double* _realDataPoints;
+ double* _imagDataPoints;
+
+ gruel::high_res_timer_type _lastReplot;
+
+ int64_t _numPoints;
+ int64_t _penSize;
+};
+
+#endif /* CONSTELLATION_DISPLAY_PLOT_HPP */
diff --git a/gr-qtgui/lib/FrequencyDisplayPlot.cc b/gr-qtgui/lib/FrequencyDisplayPlot.cc
new file mode 100644
index 000000000..b74d46015
--- /dev/null
+++ b/gr-qtgui/lib/FrequencyDisplayPlot.cc
@@ -0,0 +1,560 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,2009,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.
+ */
+
+#ifndef FREQUENCY_DISPLAY_PLOT_C
+#define FREQUENCY_DISPLAY_PLOT_C
+
+#include <FrequencyDisplayPlot.h>
+
+#include <qwt_scale_draw.h>
+
+class FreqPrecisionClass
+{
+public:
+ FreqPrecisionClass(const int freqPrecision)
+ {
+ _frequencyPrecision = freqPrecision;
+ }
+
+ virtual ~FreqPrecisionClass()
+ {
+ }
+
+ virtual unsigned int GetFrequencyPrecision() const
+ {
+ return _frequencyPrecision;
+ }
+
+ virtual void SetFrequencyPrecision(const unsigned int newPrecision)
+ {
+ _frequencyPrecision = newPrecision;
+ }
+protected:
+ unsigned int _frequencyPrecision;
+
+private:
+
+};
+
+class FreqDisplayScaleDraw: public QwtScaleDraw, public FreqPrecisionClass
+{
+public:
+ FreqDisplayScaleDraw(const unsigned int precision)
+ : QwtScaleDraw(), FreqPrecisionClass(precision)
+ {
+ }
+
+ virtual ~FreqDisplayScaleDraw()
+ {
+ }
+
+ virtual QwtText label(double value) const
+ {
+ return QString("%1").arg(value, 0, 'f', GetFrequencyPrecision());
+ }
+
+protected:
+
+private:
+
+};
+
+class FreqDisplayZoomer: public QwtPlotZoomer, public FreqPrecisionClass
+{
+public:
+ FreqDisplayZoomer(QwtPlotCanvas* canvas, const unsigned int freqPrecision)
+ : QwtPlotZoomer(canvas),FreqPrecisionClass(freqPrecision)
+ {
+ setTrackerMode(QwtPicker::AlwaysOn);
+ }
+
+ virtual ~FreqDisplayZoomer(){
+
+ }
+
+ virtual void updateTrackerText(){
+ updateDisplay();
+ }
+
+ void SetUnitType(const std::string &type)
+ {
+ _unitType = type;
+ }
+
+protected:
+ using QwtPlotZoomer::trackerText;
+ virtual QwtText trackerText( const QwtDoublePoint& p ) const
+ {
+ QwtText t(QString("%1 %2, %3 dB").
+ arg(p.x(), 0, 'f', GetFrequencyPrecision()).
+ arg(_unitType.c_str()).arg(p.y(), 0, 'f', 2));
+ return t;
+ }
+
+private:
+ std::string _unitType;
+};
+
+FrequencyDisplayPlot::FrequencyDisplayPlot(QWidget* parent)
+ : QwtPlot(parent)
+{
+ _startFrequency = 0;
+ _stopFrequency = 4000;
+
+ _lastReplot = 0;
+
+ resize(parent->width(), parent->height());
+
+ _useCenterFrequencyFlag = false;
+
+ _numPoints = 1024;
+ _dataPoints = new double[_numPoints];
+ _minFFTPoints = new double[_numPoints];
+ _maxFFTPoints = new double[_numPoints];
+ _xAxisPoints = new double[_numPoints];
+
+ // Disable polygon clipping
+#if QWT_VERSION < 0x060000
+ QwtPainter::setDeviceClipping(false);
+#else
+ QwtPainter::setPolylineSplitting(false);
+#endif
+
+#if QWT_VERSION < 0x060000
+ // We don't need the cache here
+ canvas()->setPaintAttribute(QwtPlotCanvas::PaintCached, false);
+ canvas()->setPaintAttribute(QwtPlotCanvas::PaintPacked, false);
+#endif
+
+ QPalette palette;
+ palette.setColor(canvas()->backgroundRole(), QColor("white"));
+ canvas()->setPalette(palette);
+
+ setAxisTitle(QwtPlot::xBottom, "Frequency (Hz)");
+ setAxisScaleDraw(QwtPlot::xBottom, new FreqDisplayScaleDraw(0));
+
+ _minYAxis = -120;
+ _maxYAxis = 10;
+ setAxisScaleEngine(QwtPlot::yLeft, new QwtLinearScaleEngine);
+ setAxisScale(QwtPlot::yLeft, _minYAxis, _maxYAxis);
+ setAxisTitle(QwtPlot::yLeft, "Power (dB)");
+
+ // Automatically deleted when parent is deleted
+ _fft_plot_curve = new QwtPlotCurve("Power Spectrum");
+ _fft_plot_curve->attach(this);
+ _fft_plot_curve->setPen(QPen(Qt::blue));
+
+#if QWT_VERSION < 0x060000
+ _fft_plot_curve->setRawData(_xAxisPoints, _dataPoints, _numPoints);
+#else
+ _fft_plot_curve->setRawSamples(_xAxisPoints, _dataPoints, _numPoints);
+#endif
+
+ _min_fft_plot_curve = new QwtPlotCurve("Minimum Power");
+ _min_fft_plot_curve->attach(this);
+ _min_fft_plot_curve->setPen(QPen(Qt::magenta));
+
+#if QWT_VERSION < 0x060000
+ _min_fft_plot_curve->setRawData(_xAxisPoints, _minFFTPoints, _numPoints);
+#else
+ _min_fft_plot_curve->setRawSamples(_xAxisPoints, _minFFTPoints, _numPoints);
+#endif
+
+ _min_fft_plot_curve->setVisible(false);
+
+ _max_fft_plot_curve = new QwtPlotCurve("Maximum Power");
+ _max_fft_plot_curve->attach(this);
+ _max_fft_plot_curve->setPen(QPen(Qt::darkYellow));
+
+#if QWT_VERSION < 0x060000
+ _max_fft_plot_curve->setRawData(_xAxisPoints, _maxFFTPoints, _numPoints);
+#else
+ _max_fft_plot_curve->setRawSamples(_xAxisPoints, _maxFFTPoints, _numPoints);
+#endif
+
+ _max_fft_plot_curve->setVisible(false);
+
+ _lower_intensity_marker= new QwtPlotMarker();
+ _lower_intensity_marker->setLineStyle(QwtPlotMarker::HLine);
+ _lower_intensity_marker->setLinePen(QPen(Qt::cyan));
+ _lower_intensity_marker->attach(this);
+
+ _upper_intensity_marker = new QwtPlotMarker();
+ _upper_intensity_marker->setLineStyle(QwtPlotMarker::HLine);
+ _upper_intensity_marker->setLinePen(QPen(Qt::green, 0, Qt::DotLine));
+ _upper_intensity_marker->attach(this);
+
+ memset(_dataPoints, 0x0, _numPoints*sizeof(double));
+ memset(_xAxisPoints, 0x0, _numPoints*sizeof(double));
+
+ for(int64_t number = 0; number < _numPoints; number++){
+ _minFFTPoints[number] = 200.0;
+ _maxFFTPoints[number] = -280.0;
+ }
+
+ // set up peak marker
+ QwtSymbol symbol;
+
+ _markerPeakAmplitude = new QwtPlotMarker();
+ _markerPeakAmplitude->setLinePen(QPen(Qt::yellow));
+ symbol.setStyle(QwtSymbol::Diamond);
+ symbol.setSize(8);
+ symbol.setPen(QPen(Qt::yellow));
+ symbol.setBrush(QBrush(Qt::yellow));
+
+#if QWT_VERSION < 0x060000
+ _markerPeakAmplitude->setSymbol(symbol);
+#else
+ _markerPeakAmplitude->setSymbol(&symbol);
+#endif
+
+ /// THIS CAUSES A PROBLEM!
+ //_markerPeakAmplitude->attach(this);
+
+ _markerNoiseFloorAmplitude = new QwtPlotMarker();
+ _markerNoiseFloorAmplitude->setLineStyle(QwtPlotMarker::HLine);
+ _markerNoiseFloorAmplitude->setLinePen(QPen(Qt::darkRed, 0, Qt::DotLine));
+ _markerNoiseFloorAmplitude->attach(this);
+
+ _markerCF= new QwtPlotMarker();
+ _markerCF->setLineStyle(QwtPlotMarker::VLine);
+ _markerCF->setLinePen(QPen(Qt::lightGray, 0, Qt::DotLine));
+ _markerCF->attach(this);
+ _markerCF->hide();
+
+ _peakFrequency = 0;
+ _peakAmplitude = -HUGE_VAL;
+
+ _noiseFloorAmplitude = -HUGE_VAL;
+
+ replot();
+
+ // emit the position of clicks on widget
+ _picker = new QwtDblClickPlotPicker(canvas());
+
+#if QWT_VERSION < 0x060000
+ connect(_picker, SIGNAL(selected(const QwtDoublePoint &)),
+ this, SLOT(OnPickerPointSelected(const QwtDoublePoint &)));
+#else
+ connect(_picker, SIGNAL(selected(const QPointF &)),
+ this, SLOT(OnPickerPointSelected6(const QPointF &)));
+#endif
+
+ // Configure magnify on mouse wheel
+ _magnifier = new QwtPlotMagnifier(canvas());
+ _magnifier->setAxisEnabled(QwtPlot::xBottom, false);
+
+ _zoomer = new FreqDisplayZoomer(canvas(), 0);
+
+#if QWT_VERSION < 0x060000
+ _zoomer->setSelectionFlags(QwtPicker::RectSelection | QwtPicker::DragSelection);
+#endif
+
+ _zoomer->setMousePattern(QwtEventPattern::MouseSelect2,
+ Qt::RightButton, Qt::ControlModifier);
+ _zoomer->setMousePattern(QwtEventPattern::MouseSelect3,
+ Qt::RightButton);
+
+ _panner = new QwtPlotPanner(canvas());
+ _panner->setAxisEnabled(QwtPlot::yRight, false);
+ _panner->setMouseButton(Qt::MidButton);
+
+ // Avoid jumping when labels with more/less digits
+ // appear/disappear when scrolling vertically
+
+ const QFontMetrics fm(axisWidget(QwtPlot::yLeft)->font());
+ QwtScaleDraw *sd = axisScaleDraw(QwtPlot::yLeft);
+ sd->setMinimumExtent( fm.width("100.00") );
+
+ const QColor c(Qt::darkRed);
+ _zoomer->setRubberBandPen(c);
+ _zoomer->setTrackerPen(c);
+
+ // Do this after the zoomer has been built
+ _resetXAxisPoints();
+}
+
+FrequencyDisplayPlot::~FrequencyDisplayPlot()
+{
+ delete[] _dataPoints;
+ delete[] _maxFFTPoints;
+ delete[] _minFFTPoints;
+ delete[] _xAxisPoints;
+
+ // _fft_plot_curves deleted when parent deleted
+ // _zoomer and _panner deleted when parent deleted
+}
+
+void
+FrequencyDisplayPlot::set_yaxis(double min, double max)
+{
+ // Get the new max/min values for the plot
+ _minYAxis = min;
+ _maxYAxis = max;
+
+ // Set the axis max/min to the new values
+ setAxisScale(QwtPlot::yLeft, _minYAxis, _maxYAxis);
+
+ // Reset the base zoom level to the new axis scale set here
+ _zoomer->setZoomBase();
+}
+
+void
+FrequencyDisplayPlot::SetFrequencyRange(const double constStartFreq,
+ const double constStopFreq,
+ const double constCenterFreq,
+ const bool useCenterFrequencyFlag,
+ const double units, const std::string &strunits)
+{
+ double startFreq = constStartFreq / units;
+ double stopFreq = constStopFreq / units;
+ double centerFreq = constCenterFreq / units;
+
+ _xAxisMultiplier = units;
+ _useCenterFrequencyFlag = useCenterFrequencyFlag;
+
+ if(_useCenterFrequencyFlag){
+ startFreq = (startFreq + centerFreq);
+ stopFreq = (stopFreq + centerFreq);
+ }
+
+ bool reset = false;
+ if((startFreq != _startFrequency) || (stopFreq != _stopFrequency))
+ reset = true;
+
+ if(stopFreq > startFreq) {
+ _startFrequency = startFreq;
+ _stopFrequency = stopFreq;
+
+ if((axisScaleDraw(QwtPlot::xBottom) != NULL) && (_zoomer != NULL)){
+ double display_units = ceil(log10(units)/2.0);
+ setAxisScaleDraw(QwtPlot::xBottom, new FreqDisplayScaleDraw(display_units));
+ setAxisTitle(QwtPlot::xBottom, QString("Frequency (%1)").arg(strunits.c_str()));
+
+ if(reset)
+ _resetXAxisPoints();
+
+ ((FreqDisplayZoomer*)_zoomer)->SetFrequencyPrecision(display_units);
+ ((FreqDisplayZoomer*)_zoomer)->SetUnitType(strunits);
+ }
+ }
+}
+
+
+double
+FrequencyDisplayPlot::GetStartFrequency() const
+{
+ return _startFrequency;
+}
+
+double
+FrequencyDisplayPlot::GetStopFrequency() const
+{
+ return _stopFrequency;
+}
+
+void
+FrequencyDisplayPlot::replot()
+{
+ _markerNoiseFloorAmplitude->setYValue(_noiseFloorAmplitude);
+
+ // Make sure to take into account the start frequency
+ if(_useCenterFrequencyFlag){
+ _markerPeakAmplitude->setXValue((_peakFrequency/1000.0) + _startFrequency);
+ }
+ else{
+ _markerPeakAmplitude->setXValue(_peakFrequency + _startFrequency);
+ }
+ _markerPeakAmplitude->setYValue(_peakAmplitude);
+
+ QwtPlot::replot();
+}
+
+void
+FrequencyDisplayPlot::resizeSlot( QSize *s )
+{
+ resize(s->width(), s->height());
+}
+
+void
+FrequencyDisplayPlot::PlotNewData(const double* dataPoints, const int64_t numDataPoints,
+ const double noiseFloorAmplitude, const double peakFrequency,
+ const double peakAmplitude, const double timeInterval)
+{
+ // Only update plot if there is data and if the time interval has elapsed
+ if((numDataPoints > 0) &&
+ (gruel::high_res_timer_now() - _lastReplot > timeInterval*gruel::high_res_timer_tps())) {
+
+ if(numDataPoints != _numPoints) {
+ _numPoints = numDataPoints;
+
+ delete[] _dataPoints;
+ delete[] _minFFTPoints;
+ delete[] _maxFFTPoints;
+ delete[] _xAxisPoints;
+ _dataPoints = new double[_numPoints];
+ _xAxisPoints = new double[_numPoints];
+ _minFFTPoints = new double[_numPoints];
+ _maxFFTPoints = new double[_numPoints];
+
+#if QWT_VERSION < 0x060000
+ _fft_plot_curve->setRawData(_xAxisPoints, _dataPoints, _numPoints);
+ _min_fft_plot_curve->setRawData(_xAxisPoints, _minFFTPoints, _numPoints);
+ _max_fft_plot_curve->setRawData(_xAxisPoints, _maxFFTPoints, _numPoints);
+#else
+ _fft_plot_curve->setRawSamples(_xAxisPoints, _dataPoints, _numPoints);
+ _min_fft_plot_curve->setRawSamples(_xAxisPoints, _minFFTPoints, _numPoints);
+ _max_fft_plot_curve->setRawSamples(_xAxisPoints, _maxFFTPoints, _numPoints);
+#endif
+
+ _resetXAxisPoints();
+ ClearMaxData();
+ ClearMinData();
+ }
+
+ memcpy(_dataPoints, dataPoints, numDataPoints*sizeof(double));
+ for(int64_t point = 0; point < numDataPoints; point++){
+ if(dataPoints[point] < _minFFTPoints[point]){
+ _minFFTPoints[point] = dataPoints[point];
+ }
+ if(dataPoints[point] > _maxFFTPoints[point]){
+ _maxFFTPoints[point] = dataPoints[point];
+ }
+ }
+
+ _noiseFloorAmplitude = noiseFloorAmplitude;
+ _peakFrequency = peakFrequency;
+ _peakAmplitude = peakAmplitude;
+
+ SetUpperIntensityLevel(_peakAmplitude);
+
+ replot();
+
+ _lastReplot = gruel::high_res_timer_now();
+ }
+}
+
+void
+FrequencyDisplayPlot::ClearMaxData()
+{
+ for(int64_t number = 0; number < _numPoints; number++){
+ _maxFFTPoints[number] = _minYAxis;
+ }
+}
+
+void
+FrequencyDisplayPlot::ClearMinData()
+{
+ for(int64_t number = 0; number < _numPoints; number++){
+ _minFFTPoints[number] = _maxYAxis;
+ }
+}
+
+void
+FrequencyDisplayPlot::SetMaxFFTVisible(const bool visibleFlag)
+{
+ _max_fft_plot_curve->setVisible(visibleFlag);
+}
+
+void
+FrequencyDisplayPlot::SetMinFFTVisible(const bool visibleFlag)
+{
+ _min_fft_plot_curve->setVisible(visibleFlag);
+}
+
+void
+FrequencyDisplayPlot::_resetXAxisPoints()
+{
+ double fft_bin_size = (_stopFrequency-_startFrequency) / static_cast<double>(_numPoints);
+ double freqValue = _startFrequency;
+ for(int64_t loc = 0; loc < _numPoints; loc++){
+ _xAxisPoints[loc] = freqValue;
+ freqValue += fft_bin_size;
+ }
+
+ setAxisScale(QwtPlot::xBottom, _startFrequency, _stopFrequency);
+
+ // Set up zoomer base for maximum unzoom x-axis
+ // and reset to maximum unzoom level
+ QwtDoubleRect zbase = _zoomer->zoomBase();
+ zbase.setLeft(_startFrequency);
+ zbase.setRight(_stopFrequency);
+ _zoomer->zoom(zbase);
+ _zoomer->setZoomBase(zbase);
+ _zoomer->zoom(0);
+}
+
+void
+FrequencyDisplayPlot::SetLowerIntensityLevel(const double lowerIntensityLevel)
+{
+ _lower_intensity_marker->setYValue( lowerIntensityLevel );
+}
+
+void
+FrequencyDisplayPlot::SetUpperIntensityLevel(const double upperIntensityLevel)
+{
+ _upper_intensity_marker->setYValue( upperIntensityLevel );
+}
+
+void
+FrequencyDisplayPlot::SetTraceColour (QColor c)
+{
+ _fft_plot_curve->setPen(QPen(c));
+}
+
+void
+FrequencyDisplayPlot::SetBGColour (QColor c)
+{
+ QPalette palette;
+ palette.setColor(canvas()->backgroundRole(), c);
+ canvas()->setPalette(palette);
+}
+
+void
+FrequencyDisplayPlot::ShowCFMarker (const bool show)
+{
+ if (show)
+ _markerCF->show();
+ else
+ _markerCF->hide();
+}
+
+
+void
+FrequencyDisplayPlot::OnPickerPointSelected(const QwtDoublePoint & p)
+{
+ QPointF point = p;
+ //fprintf(stderr,"OnPickerPointSelected %f %f %d\n", point.x(), point.y(), _xAxisMultiplier);
+ point.setX(point.x() * _xAxisMultiplier);
+ emit plotPointSelected(point);
+}
+
+void
+FrequencyDisplayPlot::OnPickerPointSelected6(const QPointF & p)
+{
+ QPointF point = p;
+ //fprintf(stderr,"OnPickerPointSelected %f %f %d\n", point.x(), point.y(), _xAxisMultiplier);
+ point.setX(point.x() * _xAxisMultiplier);
+ emit plotPointSelected(point);
+}
+
+#endif /* FREQUENCY_DISPLAY_PLOT_C */
diff --git a/gr-qtgui/lib/FrequencyDisplayPlot.h b/gr-qtgui/lib/FrequencyDisplayPlot.h
new file mode 100644
index 000000000..5c3ea708c
--- /dev/null
+++ b/gr-qtgui/lib/FrequencyDisplayPlot.h
@@ -0,0 +1,139 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,2009,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.
+ */
+
+#ifndef FREQUENCY_DISPLAY_PLOT_HPP
+#define FREQUENCY_DISPLAY_PLOT_HPP
+
+#include <stdint.h>
+#include <cstdio>
+#include <qwt_plot.h>
+#include <qwt_painter.h>
+#include <qwt_plot_canvas.h>
+#include <qwt_plot_curve.h>
+#include <qwt_scale_engine.h>
+#include <qwt_scale_widget.h>
+#include <qwt_plot_zoomer.h>
+#include <qwt_plot_panner.h>
+#include <qwt_plot_marker.h>
+#include <qwt_plot_magnifier.h>
+#include <gruel/high_res_timer.h>
+#include <qwt_symbol.h>
+#include <qtgui_util.h>
+
+#if QWT_VERSION >= 0x060000
+#include <qwt_compat.h>
+#endif
+
+class FrequencyDisplayPlot:public QwtPlot{
+ Q_OBJECT
+
+public:
+ FrequencyDisplayPlot(QWidget*);
+ virtual ~FrequencyDisplayPlot();
+
+ void SetFrequencyRange(const double, const double,
+ const double, const bool,
+ const double units=1000.0,
+ const std::string &strunits = "kHz");
+ double GetStartFrequency()const;
+ double GetStopFrequency()const;
+
+ void PlotNewData(const double* dataPoints, const int64_t numDataPoints,
+ const double noiseFloorAmplitude, const double peakFrequency,
+ const double peakAmplitude, const double timeInterval);
+
+ void ClearMaxData();
+ void ClearMinData();
+
+ void SetMaxFFTVisible(const bool);
+ void SetMinFFTVisible(const bool);
+
+ virtual void replot();
+
+ void set_yaxis(double min, double max);
+
+ void SetTraceColour (QColor);
+ void SetBGColour (QColor c);
+ void ShowCFMarker (const bool);
+
+public slots:
+ void resizeSlot( QSize *e );
+ void SetLowerIntensityLevel(const double);
+ void SetUpperIntensityLevel(const double);
+
+ // Because of the preprocessing of slots in QT, these are no
+ // easily separated by the version check. Make one for each
+ // version until it's worked out.
+ void OnPickerPointSelected(const QwtDoublePoint & p);
+ void OnPickerPointSelected6(const QPointF & p);
+
+signals:
+ void plotPointSelected(const QPointF p);
+
+protected:
+
+private:
+
+ void _resetXAxisPoints();
+
+ double _startFrequency;
+ double _stopFrequency;
+ double _maxYAxis;
+ double _minYAxis;
+
+ QwtPlotCurve* _fft_plot_curve;
+ QwtPlotCurve* _min_fft_plot_curve;
+ QwtPlotCurve* _max_fft_plot_curve;
+
+ QwtPlotMarker* _lower_intensity_marker;
+ QwtPlotMarker* _upper_intensity_marker;
+
+ QwtPlotPanner* _panner;
+ QwtPlotZoomer* _zoomer;
+
+ QwtPlotMarker *_markerPeakAmplitude;
+ QwtPlotMarker *_markerNoiseFloorAmplitude;
+ QwtPlotMarker *_markerCF;
+
+ QwtDblClickPlotPicker *_picker;
+
+ QwtPlotMagnifier *_magnifier;
+
+ double* _dataPoints;
+ double* _xAxisPoints;
+ int _xAxisMultiplier;
+
+ double* _minFFTPoints;
+ double* _maxFFTPoints;
+ int64_t _numPoints;
+
+ double _peakFrequency;
+ double _peakAmplitude;
+
+ double _noiseFloorAmplitude;
+
+ gruel::high_res_timer_type _lastReplot;
+
+ bool _useCenterFrequencyFlag;
+};
+
+#endif /* FREQUENCY_DISPLAY_PLOT_HPP */
diff --git a/gr-qtgui/lib/SpectrumGUIClass.cc b/gr-qtgui/lib/SpectrumGUIClass.cc
new file mode 100644
index 000000000..3efba3f40
--- /dev/null
+++ b/gr-qtgui/lib/SpectrumGUIClass.cc
@@ -0,0 +1,478 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,2009,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.
+ */
+
+#ifndef SPECTRUM_GUI_CLASS_CPP
+#define SPECTRUM_GUI_CLASS_CPP
+
+#include <SpectrumGUIClass.h>
+//Added by qt3to4:
+#include <QEvent>
+#include <QCustomEvent>
+
+const long SpectrumGUIClass::MAX_FFT_SIZE = 32768;
+const long SpectrumGUIClass::MIN_FFT_SIZE = 256;
+
+SpectrumGUIClass::SpectrumGUIClass(const uint64_t maxDataSize,
+ const uint64_t fftSize,
+ const double newCenterFrequency,
+ const double newStartFrequency,
+ const double newStopFrequency)
+{
+ _dataPoints = maxDataSize;
+ if(_dataPoints < 2){
+ _dataPoints = 2;
+ }
+ _lastDataPointCount = _dataPoints;
+
+ _fftSize = fftSize;
+
+ _pendingGUIUpdateEventsCount = 0;
+ _droppedEntriesCount = 0;
+
+ _centerFrequency = newCenterFrequency;
+ _startFrequency = newStartFrequency;
+ _stopFrequency = newStopFrequency;
+
+ _windowType = 5;
+
+ _lastGUIUpdateTime = 0;
+
+ _windowOpennedFlag = false;
+ _fftBuffersCreatedFlag = false;
+
+ _powerValue = 1;
+}
+
+SpectrumGUIClass::~SpectrumGUIClass()
+{
+ // We don't need to delete this since as a QWidget, it is supposed to be destroyed
+ // with it's parent. Deleting it causes a segmentation fault, and not deleting it
+ // does not leave any extra memory.
+ //if(GetWindowOpenFlag()){
+ //delete _spectrumDisplayForm;
+ //}
+
+ if(_fftBuffersCreatedFlag){
+ delete[] _fftPoints;
+ delete[] _realTimeDomainPoints;
+ delete[] _imagTimeDomainPoints;
+ }
+}
+
+void
+SpectrumGUIClass::OpenSpectrumWindow(QWidget* parent,
+ const bool frequency, const bool waterfall,
+ const bool time, const bool constellation)
+{
+ d_mutex.lock();
+
+ if(!_windowOpennedFlag){
+
+ if(!_fftBuffersCreatedFlag){
+ _fftPoints = new std::complex<float>[_dataPoints];
+ _realTimeDomainPoints = new double[_dataPoints];
+ _imagTimeDomainPoints = new double[_dataPoints];
+ _fftBuffersCreatedFlag = true;
+
+
+ memset(_fftPoints, 0x0, _dataPoints*sizeof(std::complex<float>));
+ memset(_realTimeDomainPoints, 0x0, _dataPoints*sizeof(double));
+ memset(_imagTimeDomainPoints, 0x0, _dataPoints*sizeof(double));
+ }
+
+ // Called from the Event Thread
+ _spectrumDisplayForm = new SpectrumDisplayForm(parent);
+
+ // Toggle Windows on/off
+ _spectrumDisplayForm->ToggleTabFrequency(frequency);
+ _spectrumDisplayForm->ToggleTabWaterfall(waterfall);
+ _spectrumDisplayForm->ToggleTabTime(time);
+ _spectrumDisplayForm->ToggleTabConstellation(constellation);
+
+ _windowOpennedFlag = true;
+
+ _spectrumDisplayForm->setSystem(this, _dataPoints, _fftSize);
+
+ qApp->processEvents();
+ }
+ d_mutex.unlock();
+
+
+ SetDisplayTitle(_title);
+ Reset();
+
+ qApp->postEvent(_spectrumDisplayForm,
+ new QEvent(QEvent::Type(QEvent::User+3)));
+
+ _lastGUIUpdateTime = 0;
+
+ // Draw Blank Display
+ UpdateWindow(false, NULL, 0, NULL, 0, NULL, 0, gruel::high_res_timer_now(), true);
+
+ // Set up the initial frequency axis settings
+ SetFrequencyRange(_centerFrequency, _startFrequency, _stopFrequency);
+
+ // GUI Thread only
+ qApp->processEvents();
+
+ // Set the FFT Size combo box to display the right number
+ int idx = _spectrumDisplayForm->FFTSizeComboBox->findText(QString("%1").arg(_fftSize));
+ _spectrumDisplayForm->FFTSizeComboBox->setCurrentIndex(idx);
+}
+
+void
+SpectrumGUIClass::Reset()
+{
+ if(GetWindowOpenFlag()) {
+ qApp->postEvent(_spectrumDisplayForm,
+ new SpectrumFrequencyRangeEvent(_centerFrequency,
+ _startFrequency,
+ _stopFrequency));
+ qApp->postEvent(_spectrumDisplayForm, new SpectrumWindowResetEvent());
+ }
+ _droppedEntriesCount = 0;
+ // Call the following function the the Spectrum Window Reset Event window
+ // ResetPendingGUIUpdateEvents();
+}
+
+void
+SpectrumGUIClass::SetDisplayTitle(const std::string newString)
+{
+ _title.assign(newString);
+
+ if(GetWindowOpenFlag()){
+ qApp->postEvent(_spectrumDisplayForm,
+ new SpectrumWindowCaptionEvent(_title.c_str()));
+ }
+}
+
+bool
+SpectrumGUIClass::GetWindowOpenFlag()
+{
+ gruel::scoped_lock lock(d_mutex);
+ bool returnFlag = false;
+ returnFlag = _windowOpennedFlag;
+ return returnFlag;
+}
+
+
+void
+SpectrumGUIClass::SetWindowOpenFlag(const bool newFlag)
+{
+ gruel::scoped_lock lock(d_mutex);
+ _windowOpennedFlag = newFlag;
+}
+
+void
+SpectrumGUIClass::SetFrequencyRange(const double centerFreq,
+ const double startFreq,
+ const double stopFreq)
+{
+ gruel::scoped_lock lock(d_mutex);
+ _centerFrequency = centerFreq;
+ _startFrequency = startFreq;
+ _stopFrequency = stopFreq;
+
+ _spectrumDisplayForm->SetFrequencyRange(_centerFrequency,
+ _startFrequency,
+ _stopFrequency);
+}
+
+double
+SpectrumGUIClass::GetStartFrequency()
+{
+ gruel::scoped_lock lock(d_mutex);
+ double returnValue = 0.0;
+ returnValue = _startFrequency;
+ return returnValue;
+}
+
+double
+SpectrumGUIClass::GetStopFrequency()
+{
+ gruel::scoped_lock lock(d_mutex);
+ double returnValue = 0.0;
+ returnValue = _stopFrequency;
+ return returnValue;
+}
+
+double
+SpectrumGUIClass::GetCenterFrequency()
+{
+ gruel::scoped_lock lock(d_mutex);
+ double returnValue = 0.0;
+ returnValue = _centerFrequency;
+ return returnValue;
+}
+
+
+void
+SpectrumGUIClass::UpdateWindow(const bool updateDisplayFlag,
+ const std::complex<float>* fftBuffer,
+ const uint64_t inputBufferSize,
+ const float* realTimeDomainData,
+ const uint64_t realTimeDomainDataSize,
+ const float* complexTimeDomainData,
+ const uint64_t complexTimeDomainDataSize,
+ const gruel::high_res_timer_type timestamp,
+ const bool lastOfMultipleFFTUpdateFlag)
+{
+ //gruel::scoped_lock lock(d_mutex);
+ int64_t bufferSize = inputBufferSize;
+ bool repeatDataFlag = false;
+ if(bufferSize > _dataPoints){
+ bufferSize = _dataPoints;
+ }
+ int64_t timeDomainBufferSize = 0;
+
+ if(updateDisplayFlag){
+ if((fftBuffer != NULL) && (bufferSize > 0)){
+ memcpy(_fftPoints, fftBuffer, bufferSize * sizeof(std::complex<float>));
+ }
+
+ // Can't do a memcpy since ths is going from float to double data type
+ if((realTimeDomainData != NULL) && (realTimeDomainDataSize > 0)){
+ const float* realTimeDomainDataPtr = realTimeDomainData;
+
+ double* realTimeDomainPointsPtr = _realTimeDomainPoints;
+ timeDomainBufferSize = realTimeDomainDataSize;
+
+ memset( _imagTimeDomainPoints, 0x0, realTimeDomainDataSize*sizeof(double));
+ for( uint64_t number = 0; number < realTimeDomainDataSize; number++){
+ *realTimeDomainPointsPtr++ = *realTimeDomainDataPtr++;
+ }
+ }
+
+ // Can't do a memcpy since ths is going from float to double data type
+ if((complexTimeDomainData != NULL) && (complexTimeDomainDataSize > 0)){
+ const float* complexTimeDomainDataPtr = complexTimeDomainData;
+
+ double* realTimeDomainPointsPtr = _realTimeDomainPoints;
+ double* imagTimeDomainPointsPtr = _imagTimeDomainPoints;
+
+ timeDomainBufferSize = complexTimeDomainDataSize;
+ for( uint64_t number = 0; number < complexTimeDomainDataSize; number++){
+ *realTimeDomainPointsPtr++ = *complexTimeDomainDataPtr++;
+ *imagTimeDomainPointsPtr++ = *complexTimeDomainDataPtr++;
+ }
+ }
+ }
+
+ // If bufferSize is zero, then just update the display by sending over the old data
+ if(bufferSize < 1){
+ bufferSize = _lastDataPointCount;
+ repeatDataFlag = true;
+ }
+ else{
+ // Since there is data this time, update the count
+ _lastDataPointCount = bufferSize;
+ }
+
+ const gruel::high_res_timer_type currentTime = gruel::high_res_timer_now();
+ const gruel::high_res_timer_type lastUpdateGUITime = GetLastGUIUpdateTime();
+
+ if((currentTime - lastUpdateGUITime > (4*_updateTime)*gruel::high_res_timer_tps()) &&
+ (GetPendingGUIUpdateEvents() > 0) && lastUpdateGUITime != 0) {
+ // Do not update the display if too much data is pending to be displayed
+ _droppedEntriesCount++;
+ }
+ else{
+ // Draw the Data
+ IncrementPendingGUIUpdateEvents();
+ qApp->postEvent(_spectrumDisplayForm,
+ new SpectrumUpdateEvent(_fftPoints, bufferSize,
+ _realTimeDomainPoints,
+ _imagTimeDomainPoints,
+ timeDomainBufferSize,
+ timestamp,
+ repeatDataFlag,
+ lastOfMultipleFFTUpdateFlag,
+ currentTime,
+ _droppedEntriesCount));
+
+ // Only reset the dropped entries counter if this is not
+ // repeat data since repeat data is dropped by the display systems
+ if(!repeatDataFlag){
+ _droppedEntriesCount = 0;
+ }
+ }
+}
+
+float
+SpectrumGUIClass::GetPowerValue()
+{
+ gruel::scoped_lock lock(d_mutex);
+ float returnValue = 0;
+ returnValue = _powerValue;
+ return returnValue;
+}
+
+void
+SpectrumGUIClass::SetPowerValue(const float value)
+{
+ gruel::scoped_lock lock(d_mutex);
+ _powerValue = value;
+}
+
+int
+SpectrumGUIClass::GetWindowType()
+{
+ gruel::scoped_lock lock(d_mutex);
+ int returnValue = 0;
+ returnValue = _windowType;
+ return returnValue;
+}
+
+void
+SpectrumGUIClass::SetWindowType(const int newType)
+{
+ gruel::scoped_lock lock(d_mutex);
+ _windowType = newType;
+}
+
+int
+SpectrumGUIClass::GetFFTSize()
+{
+ int returnValue = 0;
+ returnValue = _fftSize;
+ return returnValue;
+}
+
+int
+SpectrumGUIClass::GetFFTSizeIndex()
+{
+ gruel::scoped_lock lock(d_mutex);
+ int fftsize = GetFFTSize();
+ switch(fftsize) {
+ case(1024): return 0; break;
+ case(2048): return 1; break;
+ case(4096): return 2; break;
+ case(8192): return 3; break;
+ case(16384): return 3; break;
+ case(32768): return 3; break;
+ default: return 0;
+ }
+}
+
+void
+SpectrumGUIClass::SetFFTSize(const int newSize)
+{
+ gruel::scoped_lock lock(d_mutex);
+ _fftSize = newSize;
+}
+
+gruel::high_res_timer_type
+SpectrumGUIClass::GetLastGUIUpdateTime()
+{
+ gruel::scoped_lock lock(d_mutex);
+ gruel::high_res_timer_type returnValue;
+ returnValue = _lastGUIUpdateTime;
+ return returnValue;
+}
+
+void
+SpectrumGUIClass::SetLastGUIUpdateTime(const gruel::high_res_timer_type newTime)
+{
+ gruel::scoped_lock lock(d_mutex);
+ _lastGUIUpdateTime = newTime;
+}
+
+unsigned int
+SpectrumGUIClass::GetPendingGUIUpdateEvents()
+{
+ gruel::scoped_lock lock(d_mutex);
+ unsigned int returnValue = 0;
+ returnValue = _pendingGUIUpdateEventsCount;
+ return returnValue;
+}
+
+void
+SpectrumGUIClass::IncrementPendingGUIUpdateEvents()
+{
+ gruel::scoped_lock lock(d_mutex);
+ _pendingGUIUpdateEventsCount++;
+}
+
+void
+SpectrumGUIClass::DecrementPendingGUIUpdateEvents()
+{
+ gruel::scoped_lock lock(d_mutex);
+ if(_pendingGUIUpdateEventsCount > 0){
+ _pendingGUIUpdateEventsCount--;
+ }
+}
+
+void
+SpectrumGUIClass::ResetPendingGUIUpdateEvents()
+{
+ gruel::scoped_lock lock(d_mutex);
+ _pendingGUIUpdateEventsCount = 0;
+}
+
+
+QWidget*
+SpectrumGUIClass::qwidget()
+{
+ gruel::scoped_lock lock(d_mutex);
+ return (QWidget*)_spectrumDisplayForm;
+}
+
+void
+SpectrumGUIClass::SetTimeDomainAxis(double min, double max)
+{
+ gruel::scoped_lock lock(d_mutex);
+ _spectrumDisplayForm->SetTimeDomainAxis(min, max);
+}
+
+void
+SpectrumGUIClass::SetConstellationAxis(double xmin, double xmax,
+ double ymin, double ymax)
+{
+ gruel::scoped_lock lock(d_mutex);
+ _spectrumDisplayForm->SetConstellationAxis(xmin, xmax, ymin, ymax);
+}
+
+void
+SpectrumGUIClass::SetConstellationPenSize(int size)
+{
+ gruel::scoped_lock lock(d_mutex);
+ _spectrumDisplayForm->SetConstellationPenSize(size);
+}
+
+
+void
+SpectrumGUIClass::SetFrequencyAxis(double min, double max)
+{
+ gruel::scoped_lock lock(d_mutex);
+ _spectrumDisplayForm->SetFrequencyAxis(min, max);
+}
+
+void
+SpectrumGUIClass::SetUpdateTime(double t)
+{
+ gruel::scoped_lock lock(d_mutex);
+ _updateTime = t;
+ _spectrumDisplayForm->SetUpdateTime(_updateTime);
+}
+
+
+#endif /* SPECTRUM_GUI_CLASS_CPP */
diff --git a/gr-qtgui/lib/SpectrumGUIClass.h b/gr-qtgui/lib/SpectrumGUIClass.h
new file mode 100644
index 000000000..e0612413b
--- /dev/null
+++ b/gr-qtgui/lib/SpectrumGUIClass.h
@@ -0,0 +1,130 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,2009,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.
+ */
+
+#ifndef SPECTRUM_GUI_CLASS_HPP
+#define SPECTRUM_GUI_CLASS_HPP
+
+#include <gruel/thread.h>
+#include <qwidget.h>
+#include <qapplication.h>
+#include <qlabel.h>
+#include <qslider.h>
+#include <spectrumUpdateEvents.h>
+
+class SpectrumDisplayForm;
+#include <spectrumdisplayform.h>
+
+#include <cmath>
+
+#include <complex>
+#include <vector>
+#include <string>
+
+class SpectrumGUIClass
+{
+public:
+ SpectrumGUIClass(const uint64_t maxDataSize, const uint64_t fftSize,
+ const double newCenterFrequency,
+ const double newStartFrequency,
+ const double newStopFrequency);
+ ~SpectrumGUIClass();
+ void Reset();
+
+ void OpenSpectrumWindow(QWidget*,
+ const bool frequency=true, const bool waterfall=true,
+ const bool time=true, const bool constellation=true);
+ void SetDisplayTitle(const std::string);
+
+ bool GetWindowOpenFlag();
+ void SetWindowOpenFlag(const bool);
+
+ void SetFrequencyRange(const double, const double, const double);
+ double GetStartFrequency();
+ double GetStopFrequency();
+ double GetCenterFrequency();
+
+ void UpdateWindow(const bool, const std::complex<float>*,
+ const uint64_t, const float*,
+ const uint64_t, const float*,
+ const uint64_t,
+ const gruel::high_res_timer_type, const bool);
+
+ float GetPowerValue();
+ void SetPowerValue(const float);
+
+ int GetWindowType();
+ void SetWindowType(const int);
+
+ int GetFFTSize();
+ int GetFFTSizeIndex();
+ void SetFFTSize(const int);
+
+ gruel::high_res_timer_type GetLastGUIUpdateTime();
+ void SetLastGUIUpdateTime(const gruel::high_res_timer_type);
+
+ unsigned int GetPendingGUIUpdateEvents();
+ void IncrementPendingGUIUpdateEvents();
+ void DecrementPendingGUIUpdateEvents();
+ void ResetPendingGUIUpdateEvents();
+
+ static const long MAX_FFT_SIZE;
+ static const long MIN_FFT_SIZE;
+
+ QWidget* qwidget();
+
+ void SetTimeDomainAxis(double min, double max);
+ void SetConstellationAxis(double xmin, double xmax,
+ double ymin, double ymax);
+ void SetConstellationPenSize(int size);
+ void SetFrequencyAxis(double min, double max);
+
+ void SetUpdateTime(double t);
+
+protected:
+
+private:
+
+ gruel::mutex d_mutex;
+ int64_t _dataPoints;
+ std::string _title;
+ double _centerFrequency;
+ double _startFrequency;
+ double _stopFrequency;
+ float _powerValue;
+ bool _windowOpennedFlag;
+ int _windowType;
+ int64_t _lastDataPointCount;
+ int _fftSize;
+ gruel::high_res_timer_type _lastGUIUpdateTime;
+ unsigned int _pendingGUIUpdateEventsCount;
+ int _droppedEntriesCount;
+ bool _fftBuffersCreatedFlag;
+ double _updateTime;
+
+ SpectrumDisplayForm* _spectrumDisplayForm;
+
+ std::complex<float>* _fftPoints;
+ double* _realTimeDomainPoints;
+ double* _imagTimeDomainPoints;
+};
+
+#endif /* SPECTRUM_GUI_CLASS_HPP */
diff --git a/gr-qtgui/lib/TimeDomainDisplayPlot.cc b/gr-qtgui/lib/TimeDomainDisplayPlot.cc
new file mode 100644
index 000000000..84b09af90
--- /dev/null
+++ b/gr-qtgui/lib/TimeDomainDisplayPlot.cc
@@ -0,0 +1,345 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,2009,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.
+ */
+
+#ifndef TIME_DOMAIN_DISPLAY_PLOT_C
+#define TIME_DOMAIN_DISPLAY_PLOT_C
+
+#include <TimeDomainDisplayPlot.h>
+
+#include <qwt_scale_draw.h>
+#include <qwt_legend.h>
+#include <QColor>
+#include <iostream>
+
+class TimePrecisionClass
+{
+public:
+ TimePrecisionClass(const int timePrecision)
+ {
+ _timePrecision = timePrecision;
+ }
+
+ virtual ~TimePrecisionClass()
+ {
+ }
+
+ virtual unsigned int GetTimePrecision() const
+ {
+ return _timePrecision;
+ }
+
+ virtual void SetTimePrecision(const unsigned int newPrecision)
+ {
+ _timePrecision = newPrecision;
+ }
+protected:
+ unsigned int _timePrecision;
+};
+
+
+class TimeDomainDisplayZoomer: public QwtPlotZoomer, public TimePrecisionClass
+{
+public:
+ TimeDomainDisplayZoomer(QwtPlotCanvas* canvas, const unsigned int timePrecision)
+ : QwtPlotZoomer(canvas),TimePrecisionClass(timePrecision)
+ {
+ setTrackerMode(QwtPicker::AlwaysOn);
+ }
+
+ virtual ~TimeDomainDisplayZoomer(){
+
+ }
+
+ virtual void updateTrackerText(){
+ updateDisplay();
+ }
+
+ void SetUnitType(const std::string &type)
+ {
+ _unitType = type;
+ }
+
+protected:
+ using QwtPlotZoomer::trackerText;
+ virtual QwtText trackerText( const QwtDoublePoint& p ) const
+ {
+ QwtText t(QString("%1 %2, %3 V").arg(p.x(), 0, 'f', GetTimePrecision()).
+ arg(_unitType.c_str()).
+ arg(p.y(), 0, 'f', 4));
+
+ return t;
+ }
+
+private:
+ std::string _unitType;
+};
+
+TimeDomainDisplayPlot::TimeDomainDisplayPlot(int nplots, QWidget* parent)
+ : QwtPlot(parent), _nplots(nplots)
+{
+ resize(parent->width(), parent->height());
+
+ _numPoints = 1024;
+ _xAxisPoints = new double[_numPoints];
+ memset(_xAxisPoints, 0x0, _numPoints*sizeof(double));
+
+ _zoomer = new TimeDomainDisplayZoomer(canvas(), 0);
+
+#if QWT_VERSION < 0x060000
+ _zoomer->setSelectionFlags(QwtPicker::RectSelection | QwtPicker::DragSelection);
+#endif
+
+ // Disable polygon clipping
+#if QWT_VERSION < 0x060000
+ QwtPainter::setDeviceClipping(false);
+#else
+ QwtPainter::setPolylineSplitting(false);
+#endif
+
+#if QWT_VERSION < 0x060000
+ // We don't need the cache here
+ canvas()->setPaintAttribute(QwtPlotCanvas::PaintCached, false);
+ canvas()->setPaintAttribute(QwtPlotCanvas::PaintPacked, false);
+#endif
+
+ QPalette palette;
+ palette.setColor(canvas()->backgroundRole(), QColor("white"));
+ canvas()->setPalette(palette);
+
+ setAxisScaleEngine(QwtPlot::xBottom, new QwtLinearScaleEngine);
+ setXaxis(0, _numPoints);
+ setAxisTitle(QwtPlot::xBottom, "Time (sec)");
+
+ setAxisScaleEngine(QwtPlot::yLeft, new QwtLinearScaleEngine);
+ setYaxis(-2.0, 2.0);
+ setAxisTitle(QwtPlot::yLeft, "Amplitude");
+
+ QList<QColor> colors;
+ colors << QColor(Qt::blue) << QColor(Qt::red) << QColor(Qt::green)
+ << QColor(Qt::black) << QColor(Qt::cyan) << QColor(Qt::magenta)
+ << QColor(Qt::yellow) << QColor(Qt::gray) << QColor(Qt::darkRed)
+ << QColor(Qt::darkGreen) << QColor(Qt::darkBlue) << QColor(Qt::darkGray);
+
+ // Setup dataPoints and plot vectors
+ // Automatically deleted when parent is deleted
+ for(int i = 0; i < _nplots; i++) {
+ _dataPoints.push_back(new double[_numPoints]);
+ memset(_dataPoints[i], 0x0, _numPoints*sizeof(double));
+
+ _plot_curve.push_back(new QwtPlotCurve(QString("Data %1").arg(i)));
+ _plot_curve[i]->attach(this);
+ _plot_curve[i]->setPen(QPen(colors[i]));
+
+#if QWT_VERSION < 0x060000
+ _plot_curve[i]->setRawData(_xAxisPoints, _dataPoints[i], _numPoints);
+#else
+ _plot_curve[i]->setRawSamples(_xAxisPoints, _dataPoints[i], _numPoints);
+#endif
+}
+
+ _sampleRate = 1;
+ _resetXAxisPoints();
+
+ _zoomer->setMousePattern(QwtEventPattern::MouseSelect2,
+ Qt::RightButton, Qt::ControlModifier);
+ _zoomer->setMousePattern(QwtEventPattern::MouseSelect3,
+ Qt::RightButton);
+
+ _panner = new QwtPlotPanner(canvas());
+ _panner->setAxisEnabled(QwtPlot::yRight, false);
+ _panner->setMouseButton(Qt::MidButton);
+
+ // emit the position of clicks on widget
+ _picker = new QwtDblClickPlotPicker(canvas());
+
+#if QWT_VERSION < 0x060000
+ connect(_picker, SIGNAL(selected(const QwtDoublePoint &)),
+ this, SLOT(OnPickerPointSelected(const QwtDoublePoint &)));
+#else
+ connect(_picker, SIGNAL(selected(const QPointF &)),
+ this, SLOT(OnPickerPointSelected6(const QPointF &)));
+#endif
+
+ // Configure magnify on mouse wheel
+ _magnifier = new QwtPlotMagnifier(canvas());
+ _magnifier->setAxisEnabled(QwtPlot::xBottom, false);
+
+ // Avoid jumping when labels with more/less digits
+ // appear/disappear when scrolling vertically
+
+ const QFontMetrics fm(axisWidget(QwtPlot::yLeft)->font());
+ QwtScaleDraw *sd = axisScaleDraw(QwtPlot::yLeft);
+ sd->setMinimumExtent( fm.width("100.00") );
+
+ const QColor c(Qt::darkRed);
+ _zoomer->setRubberBandPen(c);
+ _zoomer->setTrackerPen(c);
+
+ QwtLegend* legendDisplay = new QwtLegend(this);
+ legendDisplay->setItemMode(QwtLegend::CheckableItem);
+ insertLegend(legendDisplay);
+
+ connect(this, SIGNAL( legendChecked(QwtPlotItem *, bool ) ),
+ this, SLOT( LegendEntryChecked(QwtPlotItem *, bool ) ));
+}
+
+TimeDomainDisplayPlot::~TimeDomainDisplayPlot()
+{
+ for(int i = 0; i < _nplots; i++)
+ delete [] _dataPoints[i];
+ delete[] _xAxisPoints;
+
+ // _zoomer and _panner deleted when parent deleted
+}
+
+void
+TimeDomainDisplayPlot::setYaxis(double min, double max)
+{
+ setAxisScale(QwtPlot::yLeft, min, max);
+ _zoomer->setZoomBase();
+}
+
+void
+TimeDomainDisplayPlot::setXaxis(double min, double max)
+{
+ setAxisScale(QwtPlot::xBottom, min, max);
+ _zoomer->setZoomBase();
+}
+
+void
+TimeDomainDisplayPlot::setTitle(int which, QString title)
+{
+ _plot_curve[which]->setTitle(title);
+}
+
+void
+TimeDomainDisplayPlot::setColor(int which, QString color)
+{
+ _plot_curve[which]->setPen(QPen(color));
+}
+
+void TimeDomainDisplayPlot::replot()
+{
+ QwtPlot::replot();
+}
+
+void
+TimeDomainDisplayPlot::resizeSlot( QSize *s )
+{
+ // -10 is to spare some room for the legend and x-axis label
+ resize(s->width()-10, s->height()-10);
+}
+
+void TimeDomainDisplayPlot::PlotNewData(const std::vector<double*> dataPoints,
+ const int64_t numDataPoints,
+ const double timeInterval)
+{
+ if((numDataPoints > 0)) {
+ if(numDataPoints != _numPoints){
+ _numPoints = numDataPoints;
+
+ delete[] _xAxisPoints;
+ _xAxisPoints = new double[_numPoints];
+
+ for(int i = 0; i < _nplots; i++) {
+ delete[] _dataPoints[i];
+ _dataPoints[i] = new double[_numPoints];
+
+#if QWT_VERSION < 0x060000
+ _plot_curve[i]->setRawData(_xAxisPoints, _dataPoints[i], _numPoints);
+#else
+ _plot_curve[i]->setRawSamples(_xAxisPoints, _dataPoints[i], _numPoints);
+#endif
+ }
+
+ setXaxis(0, numDataPoints);
+ _resetXAxisPoints();
+ }
+
+ for(int i = 0; i < _nplots; i++) {
+ memcpy(_dataPoints[i], dataPoints[i], numDataPoints*sizeof(double));
+ }
+
+ replot();
+ }
+}
+
+void TimeDomainDisplayPlot::_resetXAxisPoints()
+{
+ double delt = 1.0/_sampleRate;
+ for(long loc = 0; loc < _numPoints; loc++){
+ _xAxisPoints[loc] = loc*delt;
+ }
+ setAxisScale(QwtPlot::xBottom, 0, _numPoints*delt);
+
+ // Set up zoomer base for maximum unzoom x-axis
+ // and reset to maximum unzoom level
+ QwtDoubleRect zbase = _zoomer->zoomBase();
+ zbase.setLeft(0);
+ zbase.setRight(_numPoints*delt);
+ _zoomer->zoom(zbase);
+ _zoomer->setZoomBase(zbase);
+ _zoomer->zoom(0);
+}
+
+void TimeDomainDisplayPlot::LegendEntryChecked(QwtPlotItem* plotItem, bool on)
+{
+ plotItem->setVisible(!on);
+}
+
+void
+TimeDomainDisplayPlot::SetSampleRate(double sr, double units,
+ const std::string &strunits)
+{
+ double newsr = sr/units;
+ if(newsr != _sampleRate) {
+ _sampleRate = sr/units;
+ _resetXAxisPoints();
+
+ // While we could change the displayed sigfigs based on the unit being
+ // displayed, I think it looks better by just setting it to 4 regardless.
+ //double display_units = ceil(log10(units)/2.0);
+ double display_units = 4;
+ setAxisTitle(QwtPlot::xBottom, QString("Time (%1)").arg(strunits.c_str()));
+ ((TimeDomainDisplayZoomer*)_zoomer)->SetTimePrecision(display_units);
+ ((TimeDomainDisplayZoomer*)_zoomer)->SetUnitType(strunits);
+ }
+}
+
+
+void
+TimeDomainDisplayPlot::OnPickerPointSelected(const QwtDoublePoint & p)
+{
+ QPointF point = p;
+ //fprintf(stderr,"OnPickerPointSelected %f %f\n", point.x(), point.y());
+ emit plotPointSelected(point);
+}
+
+void
+TimeDomainDisplayPlot::OnPickerPointSelected6(const QPointF & p)
+{
+ QPointF point = p;
+ //fprintf(stderr,"OnPickerPointSelected %f %f\n", point.x(), point.y());
+ emit plotPointSelected(point);
+}
+
+#endif /* TIME_DOMAIN_DISPLAY_PLOT_C */
diff --git a/gr-qtgui/lib/TimeDomainDisplayPlot.h b/gr-qtgui/lib/TimeDomainDisplayPlot.h
new file mode 100644
index 000000000..356da25ad
--- /dev/null
+++ b/gr-qtgui/lib/TimeDomainDisplayPlot.h
@@ -0,0 +1,102 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,2009,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.
+ */
+
+#ifndef TIME_DOMAIN_DISPLAY_PLOT_HPP
+#define TIME_DOMAIN_DISPLAY_PLOT_HPP
+
+#include <stdint.h>
+#include <cstdio>
+#include <vector>
+#include <qwt_plot.h>
+#include <qwt_painter.h>
+#include <qwt_plot_canvas.h>
+#include <qwt_plot_curve.h>
+#include <qwt_scale_engine.h>
+#include <qwt_scale_widget.h>
+#include <qwt_plot_zoomer.h>
+#include <qwt_plot_panner.h>
+#include <qwt_plot_magnifier.h>
+#include <qwt_plot_marker.h>
+#include <qwt_symbol.h>
+#include <qtgui_util.h>
+
+#if QWT_VERSION >= 0x060000
+#include <qwt_compat.h>
+#endif
+
+class TimeDomainDisplayPlot:public QwtPlot{
+ Q_OBJECT
+
+public:
+ TimeDomainDisplayPlot(int nplots, QWidget*);
+ virtual ~TimeDomainDisplayPlot();
+
+ void PlotNewData(const std::vector<double*> dataPoints,
+ const int64_t numDataPoints, const double timeInterval);
+
+ virtual void replot();
+
+public slots:
+ void setYaxis(double min, double max);
+ void setXaxis(double min, double max);
+ void setTitle(int which, QString title);
+ void setColor(int which, QString color);
+
+ void resizeSlot( QSize *s );
+ void SetSampleRate(double sr, double units,
+ const std::string &strunits);
+
+ // Because of the preprocessing of slots in QT, these are no
+ // easily separated by the version check. Make one for each
+ // version until it's worked out.
+ void OnPickerPointSelected(const QwtDoublePoint & p);
+ void OnPickerPointSelected6(const QPointF & p);
+
+signals:
+ void plotPointSelected(const QPointF p);
+
+protected slots:
+ void LegendEntryChecked(QwtPlotItem *plotItem, bool on);
+
+protected:
+
+private:
+ void _resetXAxisPoints();
+
+ int _nplots;
+ std::vector<QwtPlotCurve*> _plot_curve;
+
+ QwtPlotPanner* _panner;
+ QwtPlotZoomer* _zoomer;
+
+ QwtDblClickPlotPicker *_picker;
+ QwtPlotMagnifier *_magnifier;
+
+ std::vector<double*> _dataPoints;
+ double* _xAxisPoints;
+
+ double _sampleRate;
+
+ int64_t _numPoints;
+};
+
+#endif /* TIME_DOMAIN_DISPLAY_PLOT_HPP */
diff --git a/gr-qtgui/lib/WaterfallDisplayPlot.cc b/gr-qtgui/lib/WaterfallDisplayPlot.cc
new file mode 100644
index 000000000..63eb57ffe
--- /dev/null
+++ b/gr-qtgui/lib/WaterfallDisplayPlot.cc
@@ -0,0 +1,695 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,2009,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.
+ */
+
+#ifndef WATERFALL_DISPLAY_PLOT_C
+#define WATERFALL_DISPLAY_PLOT_C
+
+#include <WaterfallDisplayPlot.h>
+
+#include <qwt_color_map.h>
+#include <qwt_scale_widget.h>
+#include <qwt_scale_draw.h>
+#include <qwt_plot_zoomer.h>
+#include <qwt_plot_panner.h>
+#include <qwt_plot_layout.h>
+
+#include <qapplication.h>
+
+#include <boost/date_time/posix_time/posix_time.hpp>
+namespace pt = boost::posix_time;
+
+class FreqOffsetAndPrecisionClass
+{
+public:
+ FreqOffsetAndPrecisionClass(const int freqPrecision)
+ {
+ _frequencyPrecision = freqPrecision;
+ _centerFrequency = 0;
+ }
+
+ virtual ~FreqOffsetAndPrecisionClass()
+ {
+ }
+
+ virtual unsigned int GetFrequencyPrecision() const
+ {
+ return _frequencyPrecision;
+ }
+
+ virtual void SetFrequencyPrecision(const unsigned int newPrecision)
+ {
+ _frequencyPrecision = newPrecision;
+ }
+
+ virtual double GetCenterFrequency() const
+ {
+ return _centerFrequency;
+ }
+
+ virtual void SetCenterFrequency(const double newFreq)
+ {
+ _centerFrequency = newFreq;
+ }
+
+protected:
+ unsigned int _frequencyPrecision;
+ double _centerFrequency;
+
+private:
+
+};
+
+class WaterfallFreqDisplayScaleDraw: public QwtScaleDraw, public FreqOffsetAndPrecisionClass{
+public:
+ WaterfallFreqDisplayScaleDraw(const unsigned int precision)
+ : QwtScaleDraw(), FreqOffsetAndPrecisionClass(precision)
+ {
+ }
+
+ virtual ~WaterfallFreqDisplayScaleDraw()
+ {
+ }
+
+ QwtText label(double value) const
+ {
+ return QString("%1").arg(value, 0, 'f', GetFrequencyPrecision());
+ }
+
+ virtual void initiateUpdate()
+ {
+ invalidateCache();
+ }
+
+protected:
+
+private:
+
+};
+
+class TimeScaleData
+{
+public:
+ TimeScaleData()
+ {
+ _zeroTime = 0;
+ _secondsPerLine = 1.0;
+ }
+
+ virtual ~TimeScaleData()
+ {
+ }
+
+ virtual gruel::high_res_timer_type GetZeroTime() const
+ {
+ return _zeroTime;
+ }
+
+ virtual void SetZeroTime(const gruel::high_res_timer_type newTime)
+ {
+ _zeroTime = newTime - gruel::high_res_timer_epoch();
+ }
+
+ virtual void SetSecondsPerLine(const double newTime)
+ {
+ _secondsPerLine = newTime;
+ }
+
+ virtual double GetSecondsPerLine() const
+ {
+ return _secondsPerLine;
+ }
+
+
+protected:
+ gruel::high_res_timer_type _zeroTime;
+ double _secondsPerLine;
+
+private:
+
+};
+
+static QString
+make_time_label(double secs)
+{
+ std::string time_str = pt::to_simple_string(pt::from_time_t(time_t(secs)));
+
+ // lops off the YYYY-mmm-DD part of the string
+ size_t ind = time_str.find(" ");
+ if(ind != std::string::npos)
+ time_str = time_str.substr(ind);
+
+ return QString("").sprintf("%s.%03ld", time_str.c_str(), long(std::fmod(secs*1000, 1000)));
+}
+
+class QwtTimeScaleDraw: public QwtScaleDraw, public TimeScaleData
+{
+public:
+ QwtTimeScaleDraw():QwtScaleDraw(),TimeScaleData()
+ {
+ }
+
+ virtual ~QwtTimeScaleDraw()
+ {
+ }
+
+ virtual QwtText label(double value) const
+ {
+ double secs = GetZeroTime()/double(gruel::high_res_timer_tps()) - (value * GetSecondsPerLine());
+ return QwtText(make_time_label(secs));
+ }
+
+ virtual void initiateUpdate()
+ {
+ // Do this in one call rather than when zeroTime and secondsPerLine
+ // updates is to prevent the display from being updated too often...
+ invalidateCache();
+ }
+
+protected:
+
+private:
+
+};
+
+class WaterfallZoomer: public QwtPlotZoomer, public TimeScaleData,
+ public FreqOffsetAndPrecisionClass
+{
+public:
+ WaterfallZoomer(QwtPlotCanvas* canvas, const unsigned int freqPrecision)
+ : QwtPlotZoomer(canvas), TimeScaleData(),
+ FreqOffsetAndPrecisionClass(freqPrecision)
+ {
+ setTrackerMode(QwtPicker::AlwaysOn);
+ }
+
+ virtual ~WaterfallZoomer()
+ {
+ }
+
+ virtual void updateTrackerText()
+ {
+ updateDisplay();
+ }
+
+ void SetUnitType(const std::string &type)
+ {
+ _unitType = type;
+ }
+
+protected:
+ using QwtPlotZoomer::trackerText;
+ virtual QwtText trackerText( const QwtDoublePoint& p ) const
+ {
+ double secs = GetZeroTime()/double(gruel::high_res_timer_tps()) - (p.y() * GetSecondsPerLine());
+ QwtText t(QString("%1 %2, %3").
+ arg(p.x(), 0, 'f', GetFrequencyPrecision()).
+ arg(_unitType.c_str()).arg(make_time_label(secs)));
+ return t;
+ }
+
+private:
+ std::string _unitType;
+};
+
+class ColorMap_MultiColor: public QwtLinearColorMap
+{
+public:
+ ColorMap_MultiColor():
+ QwtLinearColorMap(Qt::darkCyan, Qt::white)
+ {
+ addColorStop(0.25, Qt::cyan);
+ addColorStop(0.5, Qt::yellow);
+ addColorStop(0.75, Qt::red);
+ }
+};
+
+class ColorMap_WhiteHot: public QwtLinearColorMap
+{
+public:
+ ColorMap_WhiteHot():
+ QwtLinearColorMap(Qt::black, Qt::white)
+ {
+ }
+};
+
+class ColorMap_BlackHot: public QwtLinearColorMap
+{
+public:
+ ColorMap_BlackHot():
+ QwtLinearColorMap(Qt::white, Qt::black)
+ {
+ }
+};
+
+class ColorMap_Incandescent: public QwtLinearColorMap
+{
+public:
+ ColorMap_Incandescent():
+ QwtLinearColorMap(Qt::black, Qt::white)
+ {
+ addColorStop(0.5, Qt::darkRed);
+ }
+};
+
+class ColorMap_UserDefined: public QwtLinearColorMap
+{
+public:
+ ColorMap_UserDefined(QColor low, QColor high):
+ QwtLinearColorMap(low, high)
+ {
+ }
+};
+
+/*********************************************************************
+MAIN WATERFALL PLOT WIDGET
+*********************************************************************/
+
+WaterfallDisplayPlot::WaterfallDisplayPlot(QWidget* parent)
+ : QwtPlot(parent)
+{
+ _zoomer = NULL;
+ _startFrequency = 0;
+ _stopFrequency = 4000;
+
+ resize(parent->width(), parent->height());
+ _numPoints = 1024;
+
+ QPalette palette;
+ palette.setColor(canvas()->backgroundRole(), QColor("white"));
+ canvas()->setPalette(palette);
+
+ setAxisTitle(QwtPlot::xBottom, "Frequency (Hz)");
+ setAxisScaleDraw(QwtPlot::xBottom, new WaterfallFreqDisplayScaleDraw(0));
+
+ setAxisTitle(QwtPlot::yLeft, "Time");
+ setAxisScaleDraw(QwtPlot::yLeft, new QwtTimeScaleDraw());
+
+ _lastReplot = 0;
+
+ _intensityColorMapType = INTENSITY_COLOR_MAP_TYPE_MULTI_COLOR;
+
+ d_data = new WaterfallData(_startFrequency, _stopFrequency,
+ _numPoints, 200);
+
+#if QWT_VERSION < 0x060000
+ d_spectrogram = new PlotWaterfall(d_data, "Waterfall Display");
+
+ ColorMap_MultiColor colorMap;
+ d_spectrogram->setColorMap(colorMap);
+
+#else
+ d_spectrogram = new QwtPlotSpectrogram("Spectrogram");
+ d_spectrogram->setData(d_data);
+ d_spectrogram->setDisplayMode(QwtPlotSpectrogram::ImageMode, true);
+ d_spectrogram->setColorMap(new ColorMap_MultiColor());
+#endif
+
+ d_spectrogram->attach(this);
+
+ // LeftButton for the zooming
+ // MidButton for the panning
+ // RightButton: zoom out by 1
+ // Ctrl+RighButton: zoom out to full size
+ _zoomer = new WaterfallZoomer(canvas(), 0);
+#if QWT_VERSION < 0x060000
+ _zoomer->setSelectionFlags(QwtPicker::RectSelection | QwtPicker::DragSelection);
+#endif
+ _zoomer->setMousePattern(QwtEventPattern::MouseSelect2,
+ Qt::RightButton, Qt::ControlModifier);
+ _zoomer->setMousePattern(QwtEventPattern::MouseSelect3,
+ Qt::RightButton);
+
+ _panner = new QwtPlotPanner(canvas());
+ _panner->setAxisEnabled(QwtPlot::yRight, false);
+ _panner->setMouseButton(Qt::MidButton);
+
+ // emit the position of clicks on widget
+ _picker = new QwtDblClickPlotPicker(canvas());
+#if QWT_VERSION < 0x060000
+ connect(_picker, SIGNAL(selected(const QwtDoublePoint &)),
+ this, SLOT(OnPickerPointSelected(const QwtDoublePoint &)));
+#else
+ connect(_picker, SIGNAL(selected(const QPointF &)),
+ this, SLOT(OnPickerPointSelected6(const QPointF &)));
+#endif
+
+ // Avoid jumping when labels with more/less digits
+ // appear/disappear when scrolling vertically
+
+ const QFontMetrics fm(axisWidget(QwtPlot::yLeft)->font());
+ QwtScaleDraw *sd = axisScaleDraw(QwtPlot::yLeft);
+ sd->setMinimumExtent( fm.width("100.00") );
+
+ const QColor c(Qt::black);
+ _zoomer->setRubberBandPen(c);
+ _zoomer->setTrackerPen(c);
+
+ _UpdateIntensityRangeDisplay();
+
+ _xAxisMultiplier = 1;
+}
+
+WaterfallDisplayPlot::~WaterfallDisplayPlot()
+{
+ delete d_data;
+ delete d_spectrogram;
+}
+
+void
+WaterfallDisplayPlot::Reset()
+{
+ d_data->ResizeData(_startFrequency, _stopFrequency, _numPoints);
+ d_data->Reset();
+
+ setAxisScale(QwtPlot::xBottom, _startFrequency, _stopFrequency);
+
+ // Load up the new base zoom settings
+ QwtDoubleRect newSize = _zoomer->zoomBase();
+ newSize.setLeft(_startFrequency);
+ newSize.setWidth(_stopFrequency-_startFrequency);
+ _zoomer->zoom(newSize);
+ _zoomer->setZoomBase(newSize);
+ _zoomer->zoom(0);
+}
+
+void
+WaterfallDisplayPlot::SetFrequencyRange(const double constStartFreq,
+ const double constStopFreq,
+ const double constCenterFreq,
+ const bool useCenterFrequencyFlag,
+ const double units, const std::string &strunits)
+{
+ double startFreq = constStartFreq / units;
+ double stopFreq = constStopFreq / units;
+ double centerFreq = constCenterFreq / units;
+
+ _xAxisMultiplier = units;
+
+ _useCenterFrequencyFlag = useCenterFrequencyFlag;
+
+ if(_useCenterFrequencyFlag){
+ startFreq = (startFreq + centerFreq);
+ stopFreq = (stopFreq + centerFreq);
+ }
+
+ bool reset = false;
+ if((startFreq != _startFrequency) || (stopFreq != _stopFrequency))
+ reset = true;
+
+ if(stopFreq > startFreq) {
+ _startFrequency = startFreq;
+ _stopFrequency = stopFreq;
+
+ if((axisScaleDraw(QwtPlot::xBottom) != NULL) && (_zoomer != NULL)){
+ double display_units = ceil(log10(units)/2.0);
+ setAxisScaleDraw(QwtPlot::xBottom, new WaterfallFreqDisplayScaleDraw(display_units));
+ setAxisTitle(QwtPlot::xBottom, QString("Frequency (%1)").arg(strunits.c_str()));
+
+ if(reset) {
+ Reset();
+ }
+
+ ((WaterfallZoomer*)_zoomer)->SetFrequencyPrecision(display_units);
+ ((WaterfallZoomer*)_zoomer)->SetUnitType(strunits);
+ }
+ }
+}
+
+
+double
+WaterfallDisplayPlot::GetStartFrequency() const
+{
+ return _startFrequency;
+}
+
+double
+WaterfallDisplayPlot::GetStopFrequency() const
+{
+ return _stopFrequency;
+}
+
+void
+WaterfallDisplayPlot::PlotNewData(const double* dataPoints,
+ const int64_t numDataPoints,
+ const double timePerFFT,
+ const gruel::high_res_timer_type timestamp,
+ const int droppedFrames)
+{
+ if(numDataPoints > 0){
+ if(numDataPoints != _numPoints){
+ _numPoints = numDataPoints;
+
+ Reset();
+
+ d_spectrogram->invalidateCache();
+ d_spectrogram->itemChanged();
+
+ if(isVisible()){
+ replot();
+ }
+
+ _lastReplot = gruel::high_res_timer_now();
+ }
+
+ if(gruel::high_res_timer_now() - _lastReplot > timePerFFT*gruel::high_res_timer_tps()) {
+ d_data->addFFTData(dataPoints, numDataPoints, droppedFrames);
+ d_data->IncrementNumLinesToUpdate();
+
+ QwtTimeScaleDraw* timeScale = (QwtTimeScaleDraw*)axisScaleDraw(QwtPlot::yLeft);
+ timeScale->SetSecondsPerLine(timePerFFT);
+ timeScale->SetZeroTime(timestamp);
+
+ ((WaterfallZoomer*)_zoomer)->SetSecondsPerLine(timePerFFT);
+ ((WaterfallZoomer*)_zoomer)->SetZeroTime(timestamp);
+
+ d_spectrogram->invalidateCache();
+ d_spectrogram->itemChanged();
+
+ replot();
+
+ _lastReplot = gruel::high_res_timer_now();
+ }
+ }
+}
+
+void
+WaterfallDisplayPlot::SetIntensityRange(const double minIntensity,
+ const double maxIntensity)
+{
+#if QWT_VERSION < 0x060000
+ d_data->setRange(QwtDoubleInterval(minIntensity, maxIntensity));
+#else
+ d_data->setInterval(Qt::ZAxis, QwtInterval(minIntensity, maxIntensity));
+#endif
+
+ emit UpdatedLowerIntensityLevel(minIntensity);
+ emit UpdatedUpperIntensityLevel(maxIntensity);
+
+ _UpdateIntensityRangeDisplay();
+}
+
+void
+WaterfallDisplayPlot::replot()
+{
+ QwtTimeScaleDraw* timeScale = (QwtTimeScaleDraw*)axisScaleDraw(QwtPlot::yLeft);
+ timeScale->initiateUpdate();
+
+ WaterfallFreqDisplayScaleDraw* freqScale = \
+ (WaterfallFreqDisplayScaleDraw*)axisScaleDraw(QwtPlot::xBottom);
+ freqScale->initiateUpdate();
+
+ // Update the time axis display
+ if(axisWidget(QwtPlot::yLeft) != NULL){
+ axisWidget(QwtPlot::yLeft)->update();
+ }
+
+ // Update the Frequency Offset Display
+ if(axisWidget(QwtPlot::xBottom) != NULL){
+ axisWidget(QwtPlot::xBottom)->update();
+ }
+
+ if(_zoomer != NULL){
+ ((WaterfallZoomer*)_zoomer)->updateTrackerText();
+ }
+
+ QwtPlot::replot();
+}
+
+void
+WaterfallDisplayPlot::resizeSlot( QSize *s )
+{
+ resize(s->width(), s->height());
+}
+
+int
+WaterfallDisplayPlot::GetIntensityColorMapType() const
+{
+ return _intensityColorMapType;
+}
+
+void
+WaterfallDisplayPlot::SetIntensityColorMapType(const int newType,
+ const QColor lowColor,
+ const QColor highColor)
+{
+ if((_intensityColorMapType != newType) ||
+ ((newType == INTENSITY_COLOR_MAP_TYPE_USER_DEFINED) &&
+ (lowColor.isValid() && highColor.isValid()))){
+ switch(newType){
+ case INTENSITY_COLOR_MAP_TYPE_MULTI_COLOR:{
+ _intensityColorMapType = newType;
+#if QWT_VERSION < 0x060000
+ ColorMap_MultiColor colorMap;
+ d_spectrogram->setColorMap(colorMap);
+#else
+ d_spectrogram->setColorMap(new ColorMap_MultiColor());
+#endif
+ break;
+ }
+ case INTENSITY_COLOR_MAP_TYPE_WHITE_HOT:{
+ _intensityColorMapType = newType;
+#if QWT_VERSION < 0x060000
+ ColorMap_WhiteHot colorMap;
+ d_spectrogram->setColorMap(colorMap);
+#else
+ d_spectrogram->setColorMap(new ColorMap_WhiteHot());
+#endif
+ break;
+ }
+ case INTENSITY_COLOR_MAP_TYPE_BLACK_HOT:{
+ _intensityColorMapType = newType;
+#if QWT_VERSION < 0x060000
+ ColorMap_BlackHot colorMap;
+ d_spectrogram->setColorMap(colorMap);
+#else
+ d_spectrogram->setColorMap(new ColorMap_BlackHot());
+#endif
+ break;
+ }
+ case INTENSITY_COLOR_MAP_TYPE_INCANDESCENT:{
+ _intensityColorMapType = newType;
+#if QWT_VERSION < 0x060000
+ ColorMap_Incandescent colorMap;
+ d_spectrogram->setColorMap(colorMap);
+#else
+ d_spectrogram->setColorMap(new ColorMap_Incandescent());
+#endif
+ break;
+ }
+ case INTENSITY_COLOR_MAP_TYPE_USER_DEFINED:{
+ _userDefinedLowIntensityColor = lowColor;
+ _userDefinedHighIntensityColor = highColor;
+ _intensityColorMapType = newType;
+#if QWT_VERSION < 0x060000
+ ColorMap_UserDefined colorMap(lowColor, highColor);
+ d_spectrogram->setColorMap(colorMap);
+#else
+ d_spectrogram->setColorMap(new ColorMap_UserDefined(lowColor, highColor));
+#endif
+ break;
+ }
+ default: break;
+ }
+
+ _UpdateIntensityRangeDisplay();
+ }
+}
+
+const QColor
+WaterfallDisplayPlot::GetUserDefinedLowIntensityColor() const
+{
+ return _userDefinedLowIntensityColor;
+}
+
+const QColor
+WaterfallDisplayPlot::GetUserDefinedHighIntensityColor() const
+{
+ return _userDefinedHighIntensityColor;
+}
+
+void
+WaterfallDisplayPlot::_UpdateIntensityRangeDisplay()
+{
+ QwtScaleWidget *rightAxis = axisWidget(QwtPlot::yRight);
+ rightAxis->setTitle("Intensity (dB)");
+ rightAxis->setColorBarEnabled(true);
+
+#if QWT_VERSION < 0x060000
+ rightAxis->setColorMap(d_spectrogram->data()->range(),
+ d_spectrogram->colorMap());
+ setAxisScale(QwtPlot::yRight,
+ d_spectrogram->data()->range().minValue(),
+ d_spectrogram->data()->range().maxValue());
+#else
+ QwtInterval intv = d_spectrogram->interval(Qt::ZAxis);
+ switch(_intensityColorMapType) {
+ case INTENSITY_COLOR_MAP_TYPE_MULTI_COLOR:
+ rightAxis->setColorMap(intv, new ColorMap_MultiColor()); break;
+ case INTENSITY_COLOR_MAP_TYPE_WHITE_HOT:
+ rightAxis->setColorMap(intv, new ColorMap_WhiteHot()); break;
+ case INTENSITY_COLOR_MAP_TYPE_BLACK_HOT:
+ rightAxis->setColorMap(intv, new ColorMap_BlackHot()); break;
+ case INTENSITY_COLOR_MAP_TYPE_INCANDESCENT:
+ rightAxis->setColorMap(intv, new ColorMap_Incandescent()); break;
+ case INTENSITY_COLOR_MAP_TYPE_USER_DEFINED:
+ rightAxis->setColorMap(intv, new ColorMap_UserDefined(_userDefinedLowIntensityColor,
+ _userDefinedHighIntensityColor)); break;
+ default:
+ rightAxis->setColorMap(intv, new ColorMap_MultiColor()); break;
+ }
+ setAxisScale(QwtPlot::yRight, intv.minValue(), intv.maxValue());
+#endif
+
+ enableAxis(QwtPlot::yRight);
+
+ plotLayout()->setAlignCanvasToScales(true);
+
+ // Tell the display to redraw everything
+ d_spectrogram->invalidateCache();
+ d_spectrogram->itemChanged();
+
+ // Draw again
+ replot();
+
+ // Update the last replot timer
+ _lastReplot = gruel::high_res_timer_now();
+}
+
+void
+WaterfallDisplayPlot::OnPickerPointSelected(const QwtDoublePoint & p)
+{
+ QPointF point = p;
+ //fprintf(stderr,"OnPickerPointSelected %f %f\n", point.x(), point.y());
+ point.setX(point.x() * _xAxisMultiplier);
+ emit plotPointSelected(point);
+}
+
+void
+WaterfallDisplayPlot::OnPickerPointSelected6(const QPointF & p)
+{
+ QPointF point = p;
+ //fprintf(stderr,"OnPickerPointSelected %f %f\n", point.x(), point.y());
+ point.setX(point.x() * _xAxisMultiplier);
+ emit plotPointSelected(point);
+}
+
+#endif /* WATERFALL_DISPLAY_PLOT_C */
diff --git a/gr-qtgui/lib/WaterfallDisplayPlot.h b/gr-qtgui/lib/WaterfallDisplayPlot.h
new file mode 100644
index 000000000..d189ca2cb
--- /dev/null
+++ b/gr-qtgui/lib/WaterfallDisplayPlot.h
@@ -0,0 +1,127 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,2009,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.
+ */
+
+#ifndef WATERFALL_DISPLAY_PLOT_HPP
+#define WATERFALL_DISPLAY_PLOT_HPP
+
+#include <stdint.h>
+#include <cstdio>
+#include <qwt_plot.h>
+#include <qwt_plot_spectrogram.h>
+#include <qwt_plot_zoomer.h>
+#include <qwt_plot_panner.h>
+#include <qtgui_util.h>
+#include <waterfallGlobalData.h>
+
+#include <gruel/high_res_timer.h>
+
+#if QWT_VERSION < 0x060000
+#include <plot_waterfall.h>
+#else
+#include <qwt_compat.h>
+#endif
+
+class WaterfallDisplayPlot:public QwtPlot{
+ Q_OBJECT
+
+public:
+ WaterfallDisplayPlot(QWidget*);
+ virtual ~WaterfallDisplayPlot();
+
+ void Reset();
+
+ void SetFrequencyRange(const double, const double,
+ const double, const bool,
+ const double units=1000.0,
+ const std::string &strunits = "kHz");
+ double GetStartFrequency()const;
+ double GetStopFrequency()const;
+
+ void PlotNewData(const double* dataPoints, const int64_t numDataPoints,
+ const double timePerFFT, const gruel::high_res_timer_type timestamp,
+ const int droppedFrames);
+
+ void SetIntensityRange(const double minIntensity, const double maxIntensity);
+
+ virtual void replot(void);
+
+ int GetIntensityColorMapType()const;
+ void SetIntensityColorMapType( const int, const QColor, const QColor );
+ const QColor GetUserDefinedLowIntensityColor()const;
+ const QColor GetUserDefinedHighIntensityColor()const;
+
+ enum{
+ INTENSITY_COLOR_MAP_TYPE_MULTI_COLOR = 0,
+ INTENSITY_COLOR_MAP_TYPE_WHITE_HOT = 1,
+ INTENSITY_COLOR_MAP_TYPE_BLACK_HOT = 2,
+ INTENSITY_COLOR_MAP_TYPE_INCANDESCENT = 3,
+ INTENSITY_COLOR_MAP_TYPE_USER_DEFINED = 4
+ };
+
+public slots:
+ void resizeSlot( QSize *s );
+
+ // Because of the preprocessing of slots in QT, these are no
+ // easily separated by the version check. Make one for each
+ // version until it's worked out.
+ void OnPickerPointSelected(const QwtDoublePoint & p);
+ void OnPickerPointSelected6(const QPointF & p);
+
+signals:
+ void UpdatedLowerIntensityLevel(const double);
+ void UpdatedUpperIntensityLevel(const double);
+ void plotPointSelected(const QPointF p);
+
+protected:
+
+private:
+ void _UpdateIntensityRangeDisplay();
+
+ double _startFrequency;
+ double _stopFrequency;
+ int _xAxisMultiplier;
+
+ QwtPlotPanner* _panner;
+ QwtPlotZoomer* _zoomer;
+
+ QwtDblClickPlotPicker *_picker;
+
+ WaterfallData *d_data;
+
+#if QWT_VERSION < 0x060000
+ PlotWaterfall *d_spectrogram;
+#else
+ QwtPlotSpectrogram *d_spectrogram;
+#endif
+
+ gruel::high_res_timer_type _lastReplot;
+
+ bool _useCenterFrequencyFlag;
+
+ int64_t _numPoints;
+
+ int _intensityColorMapType;
+ QColor _userDefinedLowIntensityColor;
+ QColor _userDefinedHighIntensityColor;
+};
+
+#endif /* WATERFALL_DISPLAY_PLOT_HPP */
diff --git a/gr-qtgui/lib/plot_waterfall.cc b/gr-qtgui/lib/plot_waterfall.cc
new file mode 100644
index 000000000..517ec0275
--- /dev/null
+++ b/gr-qtgui/lib/plot_waterfall.cc
@@ -0,0 +1,310 @@
+#include <qimage.h>
+#include <qpen.h>
+#include <qpainter.h>
+#include "qwt_painter.h"
+#include "qwt_scale_map.h"
+#include "qwt_color_map.h"
+#include "plot_waterfall.h"
+
+#if QWT_VERSION < 0x060000
+#include "qwt_double_interval.h"
+#endif
+
+typedef QVector<QRgb> QwtColorTable;
+
+class PlotWaterfallImage: public QImage
+{
+ // This class hides some Qt3/Qt4 API differences
+public:
+ PlotWaterfallImage(const QSize &size, QwtColorMap::Format format):
+ QImage(size, format == QwtColorMap::RGB
+ ? QImage::Format_ARGB32 : QImage::Format_Indexed8 )
+ {
+ }
+
+ PlotWaterfallImage(const QImage &other):
+ QImage(other)
+ {
+ }
+
+ void initColorTable(const QImage& other)
+ {
+ setColorTable(other.colorTable());
+ }
+};
+
+class PlotWaterfall::PrivateData
+{
+public:
+ PrivateData()
+ {
+ data = NULL;
+ colorMap = new QwtLinearColorMap();
+ }
+ ~PrivateData()
+ {
+ delete colorMap;
+ }
+
+ WaterfallData *data;
+ QwtColorMap *colorMap;
+};
+
+/*!
+ Sets the following item attributes:
+ - QwtPlotItem::AutoScale: true
+ - QwtPlotItem::Legend: false
+
+ The z value is initialized by 8.0.
+
+ \param title Title
+
+ \sa QwtPlotItem::setItemAttribute(), QwtPlotItem::setZ()
+*/
+PlotWaterfall::PlotWaterfall(WaterfallData* data, const QString &title):
+ QwtPlotRasterItem(title)
+{
+ d_data = new PrivateData();
+ d_data->data = data;
+
+// setCachePolicy(QwtPlotRasterItem::PaintCache);
+
+ setItemAttribute(QwtPlotItem::AutoScale, true);
+ setItemAttribute(QwtPlotItem::Legend, false);
+
+ setZ(8.0);
+}
+
+//! Destructor
+PlotWaterfall::~PlotWaterfall()
+{
+ delete d_data;
+}
+
+const WaterfallData* PlotWaterfall::data()const{
+ return d_data->data;
+}
+
+//! \return QwtPlotItem::Rtti_PlotSpectrogram
+int PlotWaterfall::rtti() const
+{
+ return QwtPlotItem::Rtti_PlotSpectrogram;
+}
+
+/*!
+ Change the color map
+
+ Often it is useful to display the mapping between intensities and
+ colors as an additional plot axis, showing a color bar.
+
+ \param colorMap Color Map
+
+ \sa colorMap(), QwtScaleWidget::setColorBarEnabled(),
+ QwtScaleWidget::setColorMap()
+*/
+void PlotWaterfall::setColorMap(const QwtColorMap &colorMap)
+{
+ delete d_data->colorMap;
+#if QWT_VERSION < 0x060000
+ d_data->colorMap = colorMap.copy();
+#endif
+
+ invalidateCache();
+ itemChanged();
+}
+
+/*!
+ \return Color Map used for mapping the intensity values to colors
+ \sa setColorMap()
+*/
+const QwtColorMap &PlotWaterfall::colorMap() const
+{
+ return *d_data->colorMap;
+}
+
+/*!
+ \return Bounding rect of the data
+ \sa QwtRasterData::boundingRect
+*/
+#if QWT_VERSION < 0x060000
+QwtDoubleRect PlotWaterfall::boundingRect() const
+{
+ return d_data->data->boundingRect();
+}
+#endif
+
+/*!
+ \brief Returns the recommended raster for a given rect.
+
+ F.e the raster hint is used to limit the resolution of
+ the image that is rendered.
+
+ \param rect Rect for the raster hint
+ \return data().rasterHint(rect)
+*/
+#if QWT_VERSION < 0x060000
+QSize PlotWaterfall::rasterHint(const QwtDoubleRect &rect) const
+{
+ return d_data->data->rasterHint(rect);
+}
+#endif
+
+/*!
+ \brief Render an image from the data and color map.
+
+ The area is translated into a rect of the paint device.
+ For each pixel of this rect the intensity is mapped
+ into a color.
+
+ \param xMap X-Scale Map
+ \param yMap Y-Scale Map
+ \param area Area that should be rendered in scale coordinates.
+
+ \return A QImage::Format_Indexed8 or QImage::Format_ARGB32 depending
+ on the color map.
+
+ \sa QwtRasterData::intensity(), QwtColorMap::rgb(),
+ QwtColorMap::colorIndex()
+*/
+#if QWT_VERSION < 0x060000
+QImage PlotWaterfall::renderImage(const QwtScaleMap &xMap,
+ const QwtScaleMap &yMap,
+ const QwtDoubleRect &area) const
+#else
+QImage PlotWaterfall::renderImage(const QwtScaleMap &xMap,
+ const QwtScaleMap &yMap,
+ const QRectF &area,
+ const QSize &size) const
+#endif
+{
+ if ( area.isEmpty() )
+ return QImage();
+
+#if QWT_VERSION < 0x060000
+ QRect rect = transform(xMap, yMap, area);
+ const QSize res = d_data->data->rasterHint(area);
+#else
+ QRect rect(0,0,0,0);
+ const QSize res(0,0);
+#endif
+
+ QwtScaleMap xxMap = xMap;
+ QwtScaleMap yyMap = yMap;
+
+ if ( res.isValid() )
+ {
+ /*
+ It is useless to render an image with a higher resolution
+ than the data offers. Of course someone will have to
+ scale this image later into the size of the given rect, but f.e.
+ in case of postscript this will done on the printer.
+ */
+ rect.setSize(rect.size().boundedTo(res));
+
+ int px1 = rect.x();
+ int px2 = rect.x() + rect.width();
+ if ( xMap.p1() > xMap.p2() )
+ qSwap(px1, px2);
+
+ double sx1 = area.x();
+ double sx2 = area.x() + area.width();
+ if ( xMap.s1() > xMap.s2() )
+ qSwap(sx1, sx2);
+
+ int py1 = rect.y();
+ int py2 = rect.y() + rect.height();
+ if ( yMap.p1() > yMap.p2() )
+ qSwap(py1, py2);
+
+ double sy1 = area.y();
+ double sy2 = area.y() + area.height();
+ if ( yMap.s1() > yMap.s2() )
+ qSwap(sy1, sy2);
+
+ xxMap.setPaintInterval(px1, px2);
+ xxMap.setScaleInterval(sx1, sx2);
+ yyMap.setPaintInterval(py1, py2);
+ yyMap.setScaleInterval(sy1, sy2);
+ }
+
+ PlotWaterfallImage image(rect.size(), d_data->colorMap->format());
+
+#if QWT_VERSION < 0x060000
+ const QwtDoubleInterval intensityRange = d_data->data->range();
+#else
+ const QwtInterval intensityRange = d_data->data->interval(Qt::ZAxis);
+#endif
+ if ( !intensityRange.isValid() )
+ return image;
+
+ d_data->data->initRaster(area, rect.size());
+
+ if ( d_data->colorMap->format() == QwtColorMap::RGB )
+ {
+ for ( int y = rect.top(); y <= rect.bottom(); y++ )
+ {
+ const double ty = yyMap.invTransform(y);
+
+ QRgb *line = (QRgb *)image.scanLine(y - rect.top());
+ for ( int x = rect.left(); x <= rect.right(); x++ )
+ {
+ const double tx = xxMap.invTransform(x);
+
+ *line++ = d_data->colorMap->rgb(intensityRange,
+ d_data->data->value(tx, ty));
+ }
+ }
+ }
+ else if ( d_data->colorMap->format() == QwtColorMap::Indexed )
+ {
+ image.setColorTable(d_data->colorMap->colorTable(intensityRange));
+
+ for ( int y = rect.top(); y <= rect.bottom(); y++ )
+ {
+ const double ty = yyMap.invTransform(y);
+
+ unsigned char *line = image.scanLine(y - rect.top());
+ for ( int x = rect.left(); x <= rect.right(); x++ )
+ {
+ const double tx = xxMap.invTransform(x);
+
+ *line++ = d_data->colorMap->colorIndex(intensityRange,
+ d_data->data->value(tx, ty));
+ }
+ }
+ }
+
+ d_data->data->discardRaster();
+
+ // Mirror the image in case of inverted maps
+
+ const bool hInvert = xxMap.p1() > xxMap.p2();
+ const bool vInvert = yyMap.p1() < yyMap.p2();
+ if ( hInvert || vInvert )
+ {
+ image = image.mirrored(hInvert, vInvert);
+ }
+
+ return image;
+}
+
+/*!
+ \brief Draw the spectrogram
+
+ \param painter Painter
+ \param xMap Maps x-values into pixel coordinates.
+ \param yMap Maps y-values into pixel coordinates.
+ \param canvasRect Contents rect of the canvas in painter coordinates
+
+ \sa setDisplayMode, renderImage,
+ QwtPlotRasterItem::draw, drawContourLines
+*/
+
+void PlotWaterfall::draw(QPainter *painter,
+ const QwtScaleMap &xMap,
+ const QwtScaleMap &yMap,
+ const QRect &canvasRect) const
+{
+ QwtPlotRasterItem::draw(painter, xMap, yMap, canvasRect);
+}
+
diff --git a/gr-qtgui/lib/plot_waterfall.h b/gr-qtgui/lib/plot_waterfall.h
new file mode 100644
index 000000000..df2537b57
--- /dev/null
+++ b/gr-qtgui/lib/plot_waterfall.h
@@ -0,0 +1,67 @@
+#ifndef PLOT_WATERFALL_H
+#define PLOT_WATERFALL_H
+
+#include <qglobal.h>
+#include <waterfallGlobalData.h>
+#include <qwt_plot_rasteritem.h>
+
+#if QWT_VERSION >= 0x060000
+#include <qwt_point_3d.h> // doesn't seem necessary, but is...
+#include <qwt_compat.h>
+#endif
+
+class QwtColorMap;
+
+/*!
+ \brief A plot item, which displays a waterfall spectrogram
+
+ A waterfall displays threedimenional data, where the 3rd dimension
+ ( the intensity ) is displayed using colors. The colors are calculated
+ from the values using a color map.
+
+ \sa QwtRasterData, QwtColorMap
+*/
+
+class PlotWaterfall: public QwtPlotRasterItem
+{
+public:
+ explicit PlotWaterfall(WaterfallData* data,
+ const QString &title = QString::null);
+ virtual ~PlotWaterfall();
+
+ const WaterfallData* data()const;
+
+ void setColorMap(const QwtColorMap &);
+
+ const QwtColorMap &colorMap() const;
+
+#if QWT_VERSION < 0x060000
+ virtual QwtDoubleRect boundingRect() const;
+ virtual QSize rasterHint(const QwtDoubleRect &) const;
+#endif
+
+ virtual int rtti() const;
+
+ virtual void draw(QPainter *p,
+ const QwtScaleMap &xMap,
+ const QwtScaleMap &yMap,
+ const QRect &rect) const;
+
+protected:
+#if QWT_VERSION < 0x060000
+ QImage renderImage(const QwtScaleMap &xMap,
+ const QwtScaleMap &yMap,
+ const QwtDoubleRect &rect) const;
+#else
+ QImage renderImage(const QwtScaleMap &xMap,
+ const QwtScaleMap &yMap,
+ const QRectF &rect,
+ const QSize &size=QSize(0,0)) const;
+#endif
+
+private:
+ class PrivateData;
+ PrivateData *d_data;
+};
+
+#endif
diff --git a/gr-qtgui/lib/qtgui_sink_c.cc b/gr-qtgui/lib/qtgui_sink_c.cc
new file mode 100644
index 000000000..de730a871
--- /dev/null
+++ b/gr-qtgui/lib/qtgui_sink_c.cc
@@ -0,0 +1,310 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,2009,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <qtgui_sink_c.h>
+#include <gr_io_signature.h>
+#include <string.h>
+
+#include <QTimer>
+
+qtgui_sink_c_sptr
+qtgui_make_sink_c (int fftsize, int wintype,
+ double fc, double bw,
+ const std::string &name,
+ bool plotfreq, bool plotwaterfall,
+ bool plottime, bool plotconst,
+ QWidget *parent)
+{
+ return gnuradio::get_initial_sptr(new qtgui_sink_c (fftsize, wintype,
+ fc, bw, name,
+ plotfreq, plotwaterfall,
+ plottime, plotconst,
+ parent));
+}
+
+qtgui_sink_c::qtgui_sink_c (int fftsize, int wintype,
+ double fc, double bw,
+ const std::string &name,
+ bool plotfreq, bool plotwaterfall,
+ bool plottime, bool plotconst,
+ QWidget *parent)
+ : gr_block ("sink_c",
+ gr_make_io_signature (1, -1, sizeof(gr_complex)),
+ gr_make_io_signature (0, 0, 0)),
+ d_fftsize(fftsize),
+ d_wintype((gr_firdes::win_type)(wintype)),
+ d_center_freq(fc), d_bandwidth(bw), d_name(name),
+ d_plotfreq(plotfreq), d_plotwaterfall(plotwaterfall),
+ d_plottime(plottime), d_plotconst(plotconst),
+ d_parent(parent)
+{
+ d_main_gui = NULL;
+
+ // Perform fftshift operation;
+ // this is usually desired when plotting
+ d_shift = true;
+
+ d_fft = new gri_fft_complex (d_fftsize, true);
+
+ d_index = 0;
+ d_residbuf = new gr_complex[d_fftsize];
+
+ buildwindow();
+
+ initialize();
+}
+
+qtgui_sink_c::~qtgui_sink_c()
+{
+ delete d_main_gui;
+ delete [] d_residbuf;
+ delete d_fft;
+}
+
+void
+qtgui_sink_c::forecast(int noutput_items, gr_vector_int &ninput_items_required)
+{
+ unsigned int ninputs = ninput_items_required.size();
+ for (unsigned int i = 0; i < ninputs; i++) {
+ ninput_items_required[i] = std::min(d_fftsize, 8191);
+ }
+}
+
+void
+qtgui_sink_c::initialize()
+{
+ if(qApp != NULL) {
+ d_qApplication = qApp;
+ }
+ else {
+ int argc=0;
+ char **argv = NULL;
+ d_qApplication = new QApplication(argc, argv);
+ }
+
+ if(d_center_freq < 0) {
+ throw std::runtime_error("qtgui_sink_c: Received bad center frequency.\n");
+ }
+
+ uint64_t maxBufferSize = 32768;
+ d_main_gui = new SpectrumGUIClass(maxBufferSize, d_fftsize,
+ d_center_freq,
+ -d_bandwidth/2.0,
+ d_bandwidth/2.0);
+
+ d_main_gui->SetDisplayTitle(d_name);
+ d_main_gui->SetFFTSize(d_fftsize);
+ d_main_gui->SetWindowType((int)d_wintype);
+
+ d_main_gui->OpenSpectrumWindow(d_parent,
+ d_plotfreq, d_plotwaterfall,
+ d_plottime, d_plotconst);
+
+ // initialize update time to 10 times a second
+ set_update_time(0.5);
+
+ d_last_update = gruel::high_res_timer_now();
+ d_update_active = false;
+}
+
+
+void
+qtgui_sink_c::exec_()
+{
+ d_qApplication->exec();
+}
+
+QWidget*
+qtgui_sink_c::qwidget()
+{
+ return d_main_gui->qwidget();
+}
+
+PyObject*
+qtgui_sink_c::pyqwidget()
+{
+ PyObject *w = PyLong_FromVoidPtr((void*)d_main_gui->qwidget());
+ PyObject *retarg = Py_BuildValue("N", w);
+ return retarg;
+}
+
+void
+qtgui_sink_c::set_frequency_range(const double centerfreq,
+ const double bandwidth)
+{
+ d_center_freq = centerfreq;
+ d_bandwidth = bandwidth;
+ d_main_gui->SetFrequencyRange(d_center_freq,
+ -d_bandwidth/2.0,
+ d_bandwidth/2.0);
+}
+
+void
+qtgui_sink_c::set_time_domain_axis(double min, double max)
+{
+ d_main_gui->SetTimeDomainAxis(min, max);
+}
+
+void
+qtgui_sink_c::set_constellation_axis(double xmin, double xmax,
+ double ymin, double ymax)
+{
+ d_main_gui->SetConstellationAxis(xmin, xmax, ymin, ymax);
+}
+
+void
+qtgui_sink_c::set_constellation_pen_size(int size)
+{
+ d_main_gui->SetConstellationPenSize(size);
+}
+
+
+void
+qtgui_sink_c::set_frequency_axis(double min, double max)
+{
+ d_main_gui->SetFrequencyAxis(min, max);
+}
+
+void
+qtgui_sink_c::set_update_time(double t)
+{
+ d_update_time = t * gruel::high_res_timer_tps();
+ d_main_gui->SetUpdateTime(t);
+}
+
+void
+qtgui_sink_c::fft(const gr_complex *data_in, int size)
+{
+ if (d_window.size()) {
+ gr_complex *dst = d_fft->get_inbuf();
+ int i;
+ for (i = 0; i < size; i++) // apply window
+ dst[i] = data_in[i] * d_window[i];
+ }
+ else {
+ memcpy (d_fft->get_inbuf(), data_in, sizeof(gr_complex)*size);
+ }
+
+ d_fft->execute (); // compute the fft
+}
+
+void
+qtgui_sink_c::windowreset()
+{
+ gr_firdes::win_type newwintype = (gr_firdes::win_type)d_main_gui->GetWindowType();
+ if(d_wintype != newwintype) {
+ d_wintype = newwintype;
+ buildwindow();
+ }
+}
+
+void
+qtgui_sink_c::buildwindow()
+{
+ d_window.clear();
+ if(d_wintype != 0) {
+ d_window = gr_firdes::window(d_wintype, d_fftsize, 6.76);
+ }
+}
+
+void
+qtgui_sink_c::fftresize()
+{
+ int newfftsize = d_main_gui->GetFFTSize();
+
+ if(newfftsize != d_fftsize) {
+
+ // Resize residbuf and replace data
+ delete [] d_residbuf;
+ d_residbuf = new gr_complex[newfftsize];
+
+ // Set new fft size and reset buffer index
+ // (throws away any currently held data, but who cares?)
+ d_fftsize = newfftsize;
+ d_index = 0;
+
+ // Reset window to reflect new size
+ buildwindow();
+
+ // Reset FFTW plan for new size
+ delete d_fft;
+ d_fft = new gri_fft_complex (d_fftsize, true);
+ }
+}
+
+
+int
+qtgui_sink_c::general_work (int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ int j=0;
+ const gr_complex *in = (const gr_complex*)input_items[0];
+
+ // Update the FFT size from the application
+ fftresize();
+ windowreset();
+
+ for(int i=0; i < noutput_items; i+=d_fftsize) {
+ unsigned int datasize = noutput_items - i;
+ unsigned int resid = d_fftsize-d_index;
+
+ if (!d_update_active && (gruel::high_res_timer_now() - d_last_update) < d_update_time) {
+ consume_each(noutput_items);
+ return noutput_items;
+ } else {
+ d_last_update = gruel::high_res_timer_now();
+ d_update_active = true;
+ }
+
+ // If we have enough input for one full FFT, do it
+ if(datasize >= resid) {
+ const gruel::high_res_timer_type currentTime = gruel::high_res_timer_now();
+
+ // Fill up residbuf with d_fftsize number of items
+ memcpy(d_residbuf+d_index, &in[j], sizeof(gr_complex)*resid);
+ d_index = 0;
+
+ j += resid;
+ fft(d_residbuf, d_fftsize);
+
+ d_main_gui->UpdateWindow(true, d_fft->get_outbuf(), d_fftsize,
+ NULL, 0, (float*)d_residbuf, d_fftsize,
+ currentTime, true);
+ d_update_active = false;
+ }
+ // Otherwise, copy what we received into the residbuf for next time
+ else {
+ memcpy(d_residbuf+d_index, &in[j], sizeof(gr_complex)*datasize);
+ d_index += datasize;
+ j += datasize;
+ }
+ }
+
+ consume_each(j);
+ return j;
+}
diff --git a/gr-qtgui/lib/qtgui_sink_f.cc b/gr-qtgui/lib/qtgui_sink_f.cc
new file mode 100644
index 000000000..a02f89d0a
--- /dev/null
+++ b/gr-qtgui/lib/qtgui_sink_f.cc
@@ -0,0 +1,294 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,2009,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <qtgui_sink_f.h>
+#include <gr_io_signature.h>
+#include <string.h>
+
+#include <QTimer>
+
+qtgui_sink_f_sptr
+qtgui_make_sink_f (int fftsize, int wintype,
+ double fc, double bw,
+ const std::string &name,
+ bool plotfreq, bool plotwaterfall,
+ bool plottime, bool plotconst,
+ QWidget *parent)
+{
+ return gnuradio::get_initial_sptr(new qtgui_sink_f (fftsize, wintype,
+ fc, bw, name,
+ plotfreq, plotwaterfall,
+ plottime, plotconst,
+ parent));
+}
+
+qtgui_sink_f::qtgui_sink_f (int fftsize, int wintype,
+ double fc, double bw,
+ const std::string &name,
+ bool plotfreq, bool plotwaterfall,
+ bool plottime, bool plotconst,
+ QWidget *parent)
+ : gr_block ("sink_f",
+ gr_make_io_signature (1, 1, sizeof(float)),
+ gr_make_io_signature (0, 0, 0)),
+ d_fftsize(fftsize),
+ d_wintype((gr_firdes::win_type)(wintype)),
+ d_center_freq(fc), d_bandwidth(bw), d_name(name),
+ d_plotfreq(plotfreq), d_plotwaterfall(plotwaterfall),
+ d_plottime(plottime), d_plotconst(plotconst),
+ d_parent(parent)
+{
+ d_main_gui = NULL;
+
+ // Perform fftshift operation;
+ // this is usually desired when plotting
+ d_shift = true;
+
+ d_fft = new gri_fft_complex (d_fftsize, true);
+
+ d_index = 0;
+ d_residbuf = new float[d_fftsize];
+
+ buildwindow();
+
+ initialize();
+}
+
+qtgui_sink_f::~qtgui_sink_f()
+{
+ delete d_main_gui;
+ delete [] d_residbuf;
+ delete d_fft;
+}
+
+void
+qtgui_sink_f::forecast(int noutput_items, gr_vector_int &ninput_items_required)
+{
+ unsigned int ninputs = ninput_items_required.size();
+ for (unsigned int i = 0; i < ninputs; i++) {
+ ninput_items_required[i] = std::min(d_fftsize, 8191);
+ }
+}
+
+void
+qtgui_sink_f::initialize()
+{
+ if(qApp != NULL) {
+ d_qApplication = qApp;
+ }
+ else {
+ int argc;
+ char **argv = NULL;
+ d_qApplication = new QApplication(argc, argv);
+ }
+
+
+ uint64_t maxBufferSize = 32768;
+ d_main_gui = new SpectrumGUIClass(maxBufferSize, d_fftsize,
+ d_center_freq,
+ -d_bandwidth/2.0,
+ d_bandwidth/2.0);
+ d_main_gui->SetDisplayTitle(d_name);
+ d_main_gui->SetFFTSize(d_fftsize);
+ d_main_gui->SetWindowType((int)d_wintype);
+
+ d_main_gui->OpenSpectrumWindow(d_parent,
+ d_plotfreq, d_plotwaterfall,
+ d_plottime, d_plotconst);
+
+ // initialize update time to 10 times a second
+ set_update_time(0.1);
+}
+
+void
+qtgui_sink_f::exec_()
+{
+ d_qApplication->exec();
+}
+
+QWidget*
+qtgui_sink_f::qwidget()
+{
+ return d_main_gui->qwidget();
+}
+
+PyObject*
+qtgui_sink_f::pyqwidget()
+{
+ PyObject *w = PyLong_FromVoidPtr((void*)d_main_gui->qwidget());
+ PyObject *retarg = Py_BuildValue("N", w);
+ return retarg;
+}
+
+void
+qtgui_sink_f::set_frequency_range(const double centerfreq,
+ const double bandwidth)
+{
+ d_center_freq = centerfreq;
+ d_bandwidth = bandwidth;
+ d_main_gui->SetFrequencyRange(d_center_freq,
+ -d_bandwidth/2.0,
+ d_bandwidth/2.0);
+}
+
+void
+qtgui_sink_f::set_time_domain_axis(double min, double max)
+{
+ d_main_gui->SetTimeDomainAxis(min, max);
+}
+
+void
+qtgui_sink_f::set_constellation_axis(double xmin, double xmax,
+ double ymin, double ymax)
+{
+ d_main_gui->SetConstellationAxis(xmin, xmax, ymin, ymax);
+}
+
+void
+qtgui_sink_f::set_constellation_pen_size(int size)
+{
+ d_main_gui->SetConstellationPenSize(size);
+}
+
+
+void
+qtgui_sink_f::set_frequency_axis(double min, double max)
+{
+ d_main_gui->SetFrequencyAxis(min, max);
+}
+
+void
+qtgui_sink_f::set_update_time(double t)
+{
+ d_update_time = t;
+ d_main_gui->SetUpdateTime(d_update_time);
+}
+
+void
+qtgui_sink_f::fft(const float *data_in, int size)
+{
+ if (d_window.size()) {
+ gr_complex *dst = d_fft->get_inbuf();
+ for (int i = 0; i < size; i++) // apply window
+ dst[i] = data_in[i] * d_window[i];
+ }
+ else {
+ gr_complex *dst = d_fft->get_inbuf();
+ for (int i = 0; i < size; i++) // float to complex conversion
+ dst[i] = data_in[i];
+ }
+
+ d_fft->execute (); // compute the fft
+}
+
+void
+qtgui_sink_f::windowreset()
+{
+ gr_firdes::win_type newwintype = (gr_firdes::win_type)d_main_gui->GetWindowType();
+ if(d_wintype != newwintype) {
+ d_wintype = newwintype;
+ buildwindow();
+ }
+}
+
+void
+qtgui_sink_f::buildwindow()
+{
+ d_window.clear();
+ if(d_wintype != 0) {
+ d_window = gr_firdes::window(d_wintype, d_fftsize, 6.76);
+ }
+}
+
+void
+qtgui_sink_f::fftresize()
+{
+ int newfftsize = d_main_gui->GetFFTSize();
+
+ if(newfftsize != d_fftsize) {
+
+ // Resize residbuf and replace data
+ delete [] d_residbuf;
+ d_residbuf = new float[newfftsize];
+
+ // Set new fft size and reset buffer index
+ // (throws away any currently held data, but who cares?)
+ d_fftsize = newfftsize;
+ d_index = 0;
+
+ // Reset window to reflect new size
+ buildwindow();
+
+ // Reset FFTW plan for new size
+ delete d_fft;
+ d_fft = new gri_fft_complex (d_fftsize, true);
+ }
+}
+
+
+int
+qtgui_sink_f::general_work (int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ int j=0;
+ const float *in = (const float*)input_items[0];
+
+ // Update the FFT size from the application
+ fftresize();
+ windowreset();
+
+ for(int i=0; i < noutput_items; i+=d_fftsize) {
+ unsigned int datasize = noutput_items - i;
+ unsigned int resid = d_fftsize-d_index;
+
+ // If we have enough input for one full FFT, do it
+ if(datasize >= resid) {
+ const gruel::high_res_timer_type currentTime = gruel::high_res_timer_now();
+
+ // Fill up residbuf with d_fftsize number of items
+ memcpy(d_residbuf+d_index, &in[j], sizeof(float)*resid);
+ d_index = 0;
+
+ j += resid;
+ fft(d_residbuf, d_fftsize);
+
+ d_main_gui->UpdateWindow(true, d_fft->get_outbuf(), d_fftsize,
+ (float*)d_residbuf, d_fftsize, NULL, 0,
+ currentTime, true);
+ }
+ // Otherwise, copy what we received into the residbuf for next time
+ else {
+ memcpy(d_residbuf+d_index, &in[j], sizeof(float)*datasize);
+ d_index += datasize;
+ j += datasize;
+ }
+ }
+
+ consume_each(j);
+ return j;
+}
diff --git a/gr-qtgui/lib/qtgui_time_sink_c.cc b/gr-qtgui/lib/qtgui_time_sink_c.cc
new file mode 100644
index 000000000..773199462
--- /dev/null
+++ b/gr-qtgui/lib/qtgui_time_sink_c.cc
@@ -0,0 +1,192 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <qtgui_time_sink_c.h>
+#include <gr_io_signature.h>
+#include <string.h>
+
+#include <QTimer>
+
+qtgui_time_sink_c_sptr
+qtgui_make_time_sink_c (int size, double bw,
+ const std::string &name,
+ int nconnections,
+ QWidget *parent)
+{
+ return gnuradio::get_initial_sptr(new qtgui_time_sink_c (size, bw, name,
+ nconnections, parent));
+}
+
+qtgui_time_sink_c::qtgui_time_sink_c (int size, double bw,
+ const std::string &name,
+ int nconnections,
+ QWidget *parent)
+ : gr_sync_block ("time_sink_c",
+ gr_make_io_signature (nconnections, nconnections, sizeof(gr_complex)),
+ gr_make_io_signature (0, 0, 0)),
+ d_size(size), d_bandwidth(bw), d_name(name),
+ d_nconnections(2*nconnections), d_parent(parent)
+{
+ d_main_gui = NULL;
+
+ d_index = 0;
+
+ for(int i = 0; i < d_nconnections; i++) {
+ d_residbufs.push_back(new double[d_size]);
+ }
+
+ initialize();
+ set_output_multiple(d_size);
+}
+
+qtgui_time_sink_c::~qtgui_time_sink_c()
+{
+ // d_main_gui is a qwidget destroyed with its parent
+ for(int i = 0; i < d_nconnections; i++) {
+ delete [] d_residbufs[i];
+ }
+}
+
+void
+qtgui_time_sink_c::initialize()
+{
+ if(qApp != NULL) {
+ d_qApplication = qApp;
+ }
+ else {
+ int argc=0;
+ char **argv = NULL;
+ d_qApplication = new QApplication(argc, argv);
+ }
+
+ d_main_gui = new TimeDisplayForm(d_nconnections, d_parent);
+ d_main_gui->setFrequencyRange(0, 0, d_bandwidth);
+
+ // initialize update time to 10 times a second
+ set_update_time(0.1);
+ d_last_time = 0;
+}
+
+
+void
+qtgui_time_sink_c::exec_()
+{
+ d_qApplication->exec();
+}
+
+QWidget*
+qtgui_time_sink_c::qwidget()
+{
+ return d_main_gui;
+}
+
+PyObject*
+qtgui_time_sink_c::pyqwidget()
+{
+ PyObject *w = PyLong_FromVoidPtr((void*)d_main_gui);
+ PyObject *retarg = Py_BuildValue("N", w);
+ return retarg;
+}
+
+void
+qtgui_time_sink_c::set_time_domain_axis(double min, double max)
+{
+ d_main_gui->setTimeDomainAxis(min, max);
+}
+
+void
+qtgui_time_sink_c::set_update_time(double t)
+{
+ d_update_time = t;
+ d_main_gui->setUpdateTime(d_update_time);
+}
+
+void
+qtgui_time_sink_c::set_title(int which, const std::string &title)
+{
+ d_main_gui->setTitle(which, title.c_str());
+}
+
+void
+qtgui_time_sink_c::set_color(int which, const std::string &color)
+{
+ d_main_gui->setColor(which, color.c_str());
+}
+
+int
+qtgui_time_sink_c::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ int n=0, j=0, idx=0;
+ const gr_complex *in = (const gr_complex*)input_items[idx];
+
+ for(int i=0; i < noutput_items; i+=d_size) {
+ unsigned int datasize = noutput_items - i;
+ unsigned int resid = d_size-d_index;
+ idx = 0;
+
+ // If we have enough input for one full plot, do it
+ if(datasize >= resid) {
+ d_current_time = gruel::high_res_timer_now();
+
+ // Fill up residbufs with d_size number of items
+ for(n = 0; n < d_nconnections; n+=2) {
+ in = (const gr_complex*)input_items[idx++];
+ for(unsigned int k = 0; k < resid; k++) {
+ d_residbufs[n][d_index+k] = in[j+k].real();
+ d_residbufs[n+1][d_index+k] = in[j+k].imag();
+ }
+ }
+
+ // Update the plot if its time
+ if(gruel::high_res_timer_now() - d_last_time > d_update_time) {
+ d_last_time = d_current_time;
+ d_qApplication->postEvent(d_main_gui,
+ new TimeUpdateEvent(d_residbufs, d_size));
+ }
+
+ d_index = 0;
+ j += resid;
+ }
+ // Otherwise, copy what we received into the residbufs for next time
+ // because we set the output_multiple, this should never need to be called
+ else {
+ assert(0);
+ for(n = 0; n < d_nconnections; n+=2) {
+ in = (const gr_complex*)input_items[idx++];
+ for(unsigned int k = 0; k < resid; k++) {
+ d_residbufs[n][d_index+k] = in[j+k].real();
+ d_residbufs[n+1][d_index+k] = in[j+k].imag();
+ }
+ }
+ d_index += datasize;
+ j += datasize;
+ }
+ }
+
+ return noutput_items;
+}
diff --git a/gr-qtgui/lib/qtgui_time_sink_f.cc b/gr-qtgui/lib/qtgui_time_sink_f.cc
new file mode 100644
index 000000000..1a23023b5
--- /dev/null
+++ b/gr-qtgui/lib/qtgui_time_sink_f.cc
@@ -0,0 +1,190 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <qtgui_time_sink_f.h>
+#include <gr_io_signature.h>
+#include <string.h>
+
+#include <QTimer>
+
+qtgui_time_sink_f_sptr
+qtgui_make_time_sink_f (int size, double bw,
+ const std::string &name,
+ int nconnections,
+ QWidget *parent)
+{
+ return gnuradio::get_initial_sptr(new qtgui_time_sink_f (size, bw, name,
+ nconnections, parent));
+}
+
+qtgui_time_sink_f::qtgui_time_sink_f (int size, double bw,
+ const std::string &name,
+ int nconnections,
+ QWidget *parent)
+ : gr_sync_block ("time_sink_f",
+ gr_make_io_signature (nconnections, nconnections, sizeof(float)),
+ gr_make_io_signature (0, 0, 0)),
+ d_size(size), d_bandwidth(bw), d_name(name),
+ d_nconnections(nconnections), d_parent(parent)
+{
+ d_main_gui = NULL;
+
+ d_index = 0;
+
+ for(int i = 0; i < d_nconnections; i++) {
+ d_residbufs.push_back(new double[d_size]);
+ }
+
+ initialize();
+ set_output_multiple(d_size);
+}
+
+qtgui_time_sink_f::~qtgui_time_sink_f()
+{
+ // d_main_gui is a qwidget destroyed with its parent
+ for(int i = 0; i < d_nconnections; i++) {
+ delete [] d_residbufs[i];
+ }
+}
+
+void
+qtgui_time_sink_f::initialize()
+{
+ if(qApp != NULL) {
+ d_qApplication = qApp;
+ }
+ else {
+ int argc=0;
+ char **argv = NULL;
+ d_qApplication = new QApplication(argc, argv);
+ }
+
+ d_main_gui = new TimeDisplayForm(d_nconnections, d_parent);
+ d_main_gui->setFrequencyRange(0, 0, d_bandwidth);
+
+ // initialize update time to 10 times a second
+ set_update_time(0.1);
+ d_last_time = 0;
+}
+
+
+void
+qtgui_time_sink_f::exec_()
+{
+ d_qApplication->exec();
+}
+
+QWidget*
+qtgui_time_sink_f::qwidget()
+{
+ return d_main_gui;
+}
+
+PyObject*
+qtgui_time_sink_f::pyqwidget()
+{
+ PyObject *w = PyLong_FromVoidPtr((void*)d_main_gui);
+ PyObject *retarg = Py_BuildValue("N", w);
+ return retarg;
+}
+
+void
+qtgui_time_sink_f::set_time_domain_axis(double min, double max)
+{
+ d_main_gui->setTimeDomainAxis(min, max);
+}
+
+void
+qtgui_time_sink_f::set_update_time(double t)
+{
+ d_update_time = t;
+ d_main_gui->setUpdateTime(d_update_time);
+}
+
+void
+qtgui_time_sink_f::set_title(int which, const std::string &title)
+{
+ d_main_gui->setTitle(which, title.c_str());
+}
+
+void
+qtgui_time_sink_f::set_color(int which, const std::string &color)
+{
+ d_main_gui->setColor(which, color.c_str());
+}
+
+int
+qtgui_time_sink_f::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ int n=0, j=0, idx=0;
+ const float *in = (const float*)input_items[idx];
+
+ for(int i=0; i < noutput_items; i+=d_size) {
+ unsigned int datasize = noutput_items - i;
+ unsigned int resid = d_size-d_index;
+ idx = 0;
+
+ // If we have enough input for one full plot, do it
+ if(datasize >= resid) {
+ d_current_time = gruel::high_res_timer_now();
+
+ // Fill up residbufs with d_size number of items
+ for(n = 0; n < d_nconnections; n++) {
+ in = (const float*)input_items[idx++];
+ for(unsigned int k = 0; k < resid; k++) {
+ d_residbufs[n][d_index+k] = in[j+k];
+ }
+ }
+
+ // Update the plot if its time
+ if(gruel::high_res_timer_now() - d_last_time > d_update_time) {
+ d_last_time = d_current_time;
+ d_qApplication->postEvent(d_main_gui,
+ new TimeUpdateEvent(d_residbufs, d_size));
+ }
+
+ d_index = 0;
+ j += resid;
+ }
+ // Otherwise, copy what we received into the residbufs for next time
+ // because we set the output_multiple, this should never need to be called
+ else {
+ assert(0);
+ for(n = 0; n < d_nconnections; n++) {
+ in = (const float*)input_items[idx++];
+ for(unsigned int k = 0; k < resid; k++) {
+ d_residbufs[n][d_index+k] = in[j+k];
+ }
+ }
+ d_index += datasize;
+ j += datasize;
+ }
+ }
+
+ return noutput_items;
+}
diff --git a/gr-qtgui/lib/qtgui_util.cc b/gr-qtgui/lib/qtgui_util.cc
new file mode 100644
index 000000000..543ce1b1c
--- /dev/null
+++ b/gr-qtgui/lib/qtgui_util.cc
@@ -0,0 +1,103 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+#include <qtgui_util.h>
+
+#if QWT_VERSION < 0x060000
+QwtPickerDblClickPointMachine::QwtPickerDblClickPointMachine()
+ : QwtPickerMachine ()
+{
+}
+#else
+QwtPickerDblClickPointMachine::QwtPickerDblClickPointMachine()
+ : QwtPickerMachine (PointSelection)
+{
+}
+#endif
+
+QwtPickerDblClickPointMachine::~QwtPickerDblClickPointMachine()
+{
+
+}
+
+#if QWT_VERSION < 0x060000
+QwtPickerMachine::CommandList
+QwtPickerDblClickPointMachine::transition(const QwtEventPattern &eventPattern,
+ const QEvent *e)
+{
+ QwtPickerMachine::CommandList cmdList;
+ switch(e->type()) {
+ case QEvent::MouseButtonDblClick:
+ if ( eventPattern.mouseMatch(QwtEventPattern::MouseSelect1,
+ (const QMouseEvent *)e) ) {
+ cmdList += QwtPickerMachine::Begin;
+ cmdList += QwtPickerMachine::Append;
+ cmdList += QwtPickerMachine::End;
+ }
+ break;
+ default:
+ break;
+ }
+ return cmdList;
+}
+
+#else
+
+QList<QwtPickerMachine::Command>
+QwtPickerDblClickPointMachine::transition(const QwtEventPattern &eventPattern,
+ const QEvent *e)
+{
+ QList<QwtPickerMachine::Command> cmdList;
+ switch(e->type()) {
+ case QEvent::MouseButtonDblClick:
+ if ( eventPattern.mouseMatch(QwtEventPattern::MouseSelect1,
+ (const QMouseEvent *)e) ) {
+ cmdList += QwtPickerMachine::Begin;
+ cmdList += QwtPickerMachine::Append;
+ cmdList += QwtPickerMachine::End;
+ }
+ break;
+ default:
+ break;
+ }
+ return cmdList;
+}
+#endif
+
+QwtDblClickPlotPicker::QwtDblClickPlotPicker(QwtPlotCanvas* canvas)
+ : QwtPlotPicker(canvas)
+{
+#if QWT_VERSION < 0x060000
+ setSelectionFlags(QwtPicker::PointSelection);
+#endif
+}
+
+QwtDblClickPlotPicker::~QwtDblClickPlotPicker()
+{
+}
+
+QwtPickerMachine*
+QwtDblClickPlotPicker::stateMachine(int n) const
+{
+ return new QwtPickerDblClickPointMachine;
+}
+
diff --git a/gr-qtgui/lib/spectrumUpdateEvents.cc b/gr-qtgui/lib/spectrumUpdateEvents.cc
new file mode 100644
index 000000000..bec39747b
--- /dev/null
+++ b/gr-qtgui/lib/spectrumUpdateEvents.cc
@@ -0,0 +1,223 @@
+#ifndef SPECTRUM_UPDATE_EVENTS_C
+#define SPECTRUM_UPDATE_EVENTS_C
+
+#include <spectrumUpdateEvents.h>
+
+SpectrumUpdateEvent::SpectrumUpdateEvent(const std::complex<float>* fftPoints,
+ const uint64_t numFFTDataPoints,
+ const double* realTimeDomainPoints,
+ const double* imagTimeDomainPoints,
+ const uint64_t numTimeDomainDataPoints,
+ const gruel::high_res_timer_type dataTimestamp,
+ const bool repeatDataFlag,
+ const bool lastOfMultipleUpdateFlag,
+ const gruel::high_res_timer_type generatedTimestamp,
+ const int droppedFFTFrames)
+ : QEvent(QEvent::Type(10005))
+{
+ if(numFFTDataPoints < 1) {
+ _numFFTDataPoints = 1;
+ }
+ else {
+ _numFFTDataPoints = numFFTDataPoints;
+ }
+
+ if(numTimeDomainDataPoints < 1) {
+ _numTimeDomainDataPoints = 1;
+ }
+ else {
+ _numTimeDomainDataPoints = numTimeDomainDataPoints;
+ }
+
+ _fftPoints = new std::complex<float>[_numFFTDataPoints];
+ _fftPoints[0] = std::complex<float>(0,0);
+ memcpy(_fftPoints, fftPoints, numFFTDataPoints*sizeof(std::complex<float>));
+
+ _realDataTimeDomainPoints = new double[_numTimeDomainDataPoints];
+ memset(_realDataTimeDomainPoints, 0x0, _numTimeDomainDataPoints*sizeof(double));
+ if(numTimeDomainDataPoints > 0) {
+ memcpy(_realDataTimeDomainPoints, realTimeDomainPoints,
+ numTimeDomainDataPoints*sizeof(double));
+ }
+
+ _imagDataTimeDomainPoints = new double[_numTimeDomainDataPoints];
+ memset(_imagDataTimeDomainPoints, 0x0, _numTimeDomainDataPoints*sizeof(double));
+ if(numTimeDomainDataPoints > 0) {
+ memcpy(_imagDataTimeDomainPoints, imagTimeDomainPoints,
+ numTimeDomainDataPoints*sizeof(double));
+ }
+ _dataTimestamp = dataTimestamp;
+ _repeatDataFlag = repeatDataFlag;
+ _lastOfMultipleUpdateFlag = lastOfMultipleUpdateFlag;
+ _eventGeneratedTimestamp = generatedTimestamp;
+ _droppedFFTFrames = droppedFFTFrames;
+}
+
+SpectrumUpdateEvent::~SpectrumUpdateEvent()
+{
+ delete[] _fftPoints;
+ delete[] _realDataTimeDomainPoints;
+ delete[] _imagDataTimeDomainPoints;
+}
+
+const std::complex<float>*
+SpectrumUpdateEvent::getFFTPoints() const
+{
+ return _fftPoints;
+}
+
+const double*
+SpectrumUpdateEvent::getRealTimeDomainPoints() const
+{
+ return _realDataTimeDomainPoints;
+}
+
+const double*
+SpectrumUpdateEvent::getImagTimeDomainPoints() const
+{
+ return _imagDataTimeDomainPoints;
+}
+
+uint64_t
+SpectrumUpdateEvent::getNumFFTDataPoints() const
+{
+ return _numFFTDataPoints;
+}
+
+uint64_t
+SpectrumUpdateEvent::getNumTimeDomainDataPoints() const
+{
+ return _numTimeDomainDataPoints;
+}
+
+gruel::high_res_timer_type
+SpectrumUpdateEvent::getDataTimestamp() const
+{
+ return _dataTimestamp;
+}
+
+bool
+SpectrumUpdateEvent::getRepeatDataFlag() const
+{
+ return _repeatDataFlag;
+}
+
+bool
+SpectrumUpdateEvent::getLastOfMultipleUpdateFlag() const
+{
+ return _lastOfMultipleUpdateFlag;
+}
+
+gruel::high_res_timer_type
+SpectrumUpdateEvent::getEventGeneratedTimestamp() const
+{
+ return _eventGeneratedTimestamp;
+}
+
+int
+SpectrumUpdateEvent::getDroppedFFTFrames() const
+{
+ return _droppedFFTFrames;
+}
+
+SpectrumWindowCaptionEvent::SpectrumWindowCaptionEvent(const QString& newLbl)
+ : QEvent(QEvent::Type(10008))
+{
+ _labelString = newLbl;
+}
+
+SpectrumWindowCaptionEvent::~SpectrumWindowCaptionEvent()
+{
+}
+
+QString
+SpectrumWindowCaptionEvent::getLabel()
+{
+ return _labelString;
+}
+
+SpectrumWindowResetEvent::SpectrumWindowResetEvent()
+ : QEvent(QEvent::Type(10009))
+{
+}
+
+SpectrumWindowResetEvent::~SpectrumWindowResetEvent()
+{
+}
+
+SpectrumFrequencyRangeEvent::SpectrumFrequencyRangeEvent(const double centerFreq,
+ const double startFreq,
+ const double stopFreq)
+ : QEvent(QEvent::Type(10010))
+{
+ _centerFrequency = centerFreq;
+ _startFrequency = startFreq;
+ _stopFrequency = stopFreq;
+}
+
+SpectrumFrequencyRangeEvent::~SpectrumFrequencyRangeEvent()
+{
+}
+
+double
+SpectrumFrequencyRangeEvent::GetCenterFrequency() const
+{
+ return _centerFrequency;
+}
+
+double
+SpectrumFrequencyRangeEvent::GetStartFrequency() const
+{
+ return _startFrequency;
+}
+
+double
+SpectrumFrequencyRangeEvent::GetStopFrequency() const
+{
+ return _stopFrequency;
+}
+
+
+/***************************************************************************/
+#include <iostream>
+TimeUpdateEvent::TimeUpdateEvent(const std::vector<double*> timeDomainPoints,
+ const uint64_t numTimeDomainDataPoints)
+ : QEvent(QEvent::Type(10005))
+{
+ if(numTimeDomainDataPoints < 1) {
+ _numTimeDomainDataPoints = 1;
+ }
+ else {
+ _numTimeDomainDataPoints = numTimeDomainDataPoints;
+ }
+
+ _nplots = timeDomainPoints.size();
+ for(size_t i = 0; i < _nplots; i++) {
+ _dataTimeDomainPoints.push_back(new double[_numTimeDomainDataPoints]);
+ if(numTimeDomainDataPoints > 0) {
+ memcpy(_dataTimeDomainPoints[i], timeDomainPoints[i],
+ _numTimeDomainDataPoints*sizeof(double));
+ }
+ }
+}
+
+TimeUpdateEvent::~TimeUpdateEvent()
+{
+ for(size_t i = 0; i < _nplots; i++) {
+ delete[] _dataTimeDomainPoints[i];
+ }
+}
+
+const std::vector<double*>
+TimeUpdateEvent::getTimeDomainPoints() const
+{
+ return _dataTimeDomainPoints;
+}
+
+uint64_t
+TimeUpdateEvent::getNumTimeDomainDataPoints() const
+{
+ return _numTimeDomainDataPoints;
+}
+
+#endif /* SPECTRUM_UPDATE_EVENTS_C */
diff --git a/gr-qtgui/lib/spectrumUpdateEvents.h b/gr-qtgui/lib/spectrumUpdateEvents.h
new file mode 100644
index 000000000..faef0f087
--- /dev/null
+++ b/gr-qtgui/lib/spectrumUpdateEvents.h
@@ -0,0 +1,115 @@
+#ifndef SPECTRUM_UPDATE_EVENTS_H
+#define SPECTRUM_UPDATE_EVENTS_H
+
+#include <stdint.h>
+#include <QEvent>
+#include <QString>
+#include <complex>
+#include <vector>
+#include <gruel/high_res_timer.h>
+
+class SpectrumUpdateEvent:public QEvent{
+
+public:
+ SpectrumUpdateEvent(const std::complex<float>* fftPoints,
+ const uint64_t numFFTDataPoints,
+ const double* realTimeDomainPoints,
+ const double* imagTimeDomainPoints,
+ const uint64_t numTimeDomainDataPoints,
+ const gruel::high_res_timer_type dataTimestamp,
+ const bool repeatDataFlag,
+ const bool lastOfMultipleUpdateFlag,
+ const gruel::high_res_timer_type generatedTimestamp,
+ const int droppedFFTFrames);
+
+ ~SpectrumUpdateEvent();
+
+ const std::complex<float>* getFFTPoints() const;
+ const double* getRealTimeDomainPoints() const;
+ const double* getImagTimeDomainPoints() const;
+ uint64_t getNumFFTDataPoints() const;
+ uint64_t getNumTimeDomainDataPoints() const;
+ gruel::high_res_timer_type getDataTimestamp() const;
+ bool getRepeatDataFlag() const;
+ bool getLastOfMultipleUpdateFlag() const;
+ gruel::high_res_timer_type getEventGeneratedTimestamp() const;
+ int getDroppedFFTFrames() const;
+
+protected:
+
+private:
+ std::complex<float>* _fftPoints;
+ double* _realDataTimeDomainPoints;
+ double* _imagDataTimeDomainPoints;
+ uint64_t _numFFTDataPoints;
+ uint64_t _numTimeDomainDataPoints;
+ gruel::high_res_timer_type _dataTimestamp;
+ bool _repeatDataFlag;
+ bool _lastOfMultipleUpdateFlag;
+ gruel::high_res_timer_type _eventGeneratedTimestamp;
+ int _droppedFFTFrames;
+};
+
+class SpectrumWindowCaptionEvent:public QEvent{
+public:
+ SpectrumWindowCaptionEvent(const QString&);
+ ~SpectrumWindowCaptionEvent();
+ QString getLabel();
+
+protected:
+
+private:
+ QString _labelString;
+};
+
+class SpectrumWindowResetEvent:public QEvent{
+public:
+ SpectrumWindowResetEvent();
+ ~SpectrumWindowResetEvent();
+
+protected:
+
+private:
+
+};
+
+class SpectrumFrequencyRangeEvent:public QEvent{
+public:
+ SpectrumFrequencyRangeEvent(const double, const double, const double);
+ ~SpectrumFrequencyRangeEvent();
+ double GetCenterFrequency()const;
+ double GetStartFrequency()const;
+ double GetStopFrequency()const;
+
+protected:
+
+private:
+ double _centerFrequency;
+ double _startFrequency;
+ double _stopFrequency;
+};
+
+
+class TimeUpdateEvent: public QEvent
+{
+public:
+ TimeUpdateEvent(const std::vector<double*> timeDomainPoints,
+ const uint64_t numTimeDomainDataPoints);
+
+ ~TimeUpdateEvent();
+
+ int which() const;
+ const std::vector<double*> getTimeDomainPoints() const;
+ uint64_t getNumTimeDomainDataPoints() const;
+ bool getRepeatDataFlag() const;
+
+protected:
+
+private:
+ size_t _nplots;
+ std::vector<double*> _dataTimeDomainPoints;
+ uint64_t _numTimeDomainDataPoints;
+};
+
+
+#endif /* SPECTRUM_UPDATE_EVENTS_H */
diff --git a/gr-qtgui/lib/spectrumdisplayform.cc b/gr-qtgui/lib/spectrumdisplayform.cc
new file mode 100644
index 000000000..dd9011dbd
--- /dev/null
+++ b/gr-qtgui/lib/spectrumdisplayform.cc
@@ -0,0 +1,754 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008-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.
+ */
+
+#include <cmath>
+#include <QColorDialog>
+#include <QMessageBox>
+#include <spectrumdisplayform.h>
+
+SpectrumDisplayForm::SpectrumDisplayForm(QWidget* parent)
+ : QWidget(parent)
+{
+ setupUi(this);
+
+ _systemSpecifiedFlag = false;
+ _intValidator = new QIntValidator(this);
+ _intValidator->setBottom(0);
+ _frequencyDisplayPlot = new FrequencyDisplayPlot(FrequencyPlotDisplayFrame);
+ _waterfallDisplayPlot = new WaterfallDisplayPlot(WaterfallPlotDisplayFrame);
+ _timeDomainDisplayPlot = new TimeDomainDisplayPlot(2, TimeDomainDisplayFrame);
+ _constellationDisplayPlot = new ConstellationDisplayPlot(ConstellationDisplayFrame);
+ _numRealDataPoints = 1024;
+ _realFFTDataPoints = new double[_numRealDataPoints];
+ _averagedValues = new double[_numRealDataPoints];
+ _historyVector = new std::vector<double*>;
+
+ _timeDomainDisplayPlot->setTitle(0, "real");
+ _timeDomainDisplayPlot->setTitle(1, "imag");
+
+ AvgLineEdit->setRange(0, 500); // Set range of Average box value from 0 to 500
+ MinHoldCheckBox_toggled( false );
+ MaxHoldCheckBox_toggled( false );
+
+ WaterfallMaximumIntensityWheel->setRange(-200, 0);
+ WaterfallMaximumIntensityWheel->setTickCnt(50);
+ WaterfallMinimumIntensityWheel->setRange(-200, 0);
+ WaterfallMinimumIntensityWheel->setTickCnt(50);
+ WaterfallMinimumIntensityWheel->setValue(-200);
+
+ _peakFrequency = 0;
+ _peakAmplitude = -HUGE_VAL;
+
+ _noiseFloorAmplitude = -HUGE_VAL;
+
+ connect(_waterfallDisplayPlot, SIGNAL(UpdatedLowerIntensityLevel(const double)),
+ _frequencyDisplayPlot, SLOT(SetLowerIntensityLevel(const double)));
+ connect(_waterfallDisplayPlot, SIGNAL(UpdatedUpperIntensityLevel(const double)),
+ _frequencyDisplayPlot, SLOT(SetUpperIntensityLevel(const double)));
+
+ _frequencyDisplayPlot->SetLowerIntensityLevel(-200);
+ _frequencyDisplayPlot->SetUpperIntensityLevel(-200);
+
+ // Load up the acceptable FFT sizes...
+ FFTSizeComboBox->clear();
+ for(long fftSize = SpectrumGUIClass::MIN_FFT_SIZE; fftSize <= SpectrumGUIClass::MAX_FFT_SIZE; fftSize *= 2){
+ FFTSizeComboBox->insertItem(FFTSizeComboBox->count(), QString("%1").arg(fftSize));
+ }
+ Reset();
+
+ ToggleTabFrequency(false);
+ ToggleTabWaterfall(false);
+ ToggleTabTime(false);
+ ToggleTabConstellation(false);
+
+ _historyEntry = 0;
+ _historyEntryCount = 0;
+
+ // Create a timer to update plots at the specified rate
+ displayTimer = new QTimer(this);
+ connect(displayTimer, SIGNAL(timeout()), this, SLOT(UpdateGuiTimer()));
+
+ // Connect double click signals up
+ connect(_frequencyDisplayPlot, SIGNAL(plotPointSelected(const QPointF)),
+ this, SLOT(onFFTPlotPointSelected(const QPointF)));
+
+ connect(_waterfallDisplayPlot, SIGNAL(plotPointSelected(const QPointF)),
+ this, SLOT(onWFallPlotPointSelected(const QPointF)));
+
+ connect(_timeDomainDisplayPlot, SIGNAL(plotPointSelected(const QPointF)),
+ this, SLOT(onTimePlotPointSelected(const QPointF)));
+
+ connect(_constellationDisplayPlot, SIGNAL(plotPointSelected(const QPointF)),
+ this, SLOT(onConstPlotPointSelected(const QPointF)));
+}
+
+SpectrumDisplayForm::~SpectrumDisplayForm()
+{
+ // Qt deletes children when parent is deleted
+
+ // Don't worry about deleting Display Plots - they are deleted when parents are deleted
+ delete _intValidator;
+
+ delete[] _realFFTDataPoints;
+ delete[] _averagedValues;
+
+ for(unsigned int count = 0; count < _historyVector->size(); count++){
+ delete[] _historyVector->operator[](count);
+ }
+
+ delete _historyVector;
+
+ displayTimer->stop();
+ delete displayTimer;
+}
+
+void
+SpectrumDisplayForm::setSystem( SpectrumGUIClass * newSystem,
+ const uint64_t numFFTDataPoints,
+ const uint64_t numTimeDomainDataPoints )
+{
+ ResizeBuffers(numFFTDataPoints, numTimeDomainDataPoints);
+
+ if(newSystem != NULL){
+ _system = newSystem;
+ _systemSpecifiedFlag = true;
+ }
+ else{
+ _systemSpecifiedFlag = false;
+ }
+}
+
+void
+SpectrumDisplayForm::newFrequencyData( const SpectrumUpdateEvent* spectrumUpdateEvent)
+{
+ //_lastSpectrumEvent = (SpectrumUpdateEvent)(*spectrumUpdateEvent);
+ const std::complex<float>* complexDataPoints = spectrumUpdateEvent->getFFTPoints();
+ const uint64_t numFFTDataPoints = spectrumUpdateEvent->getNumFFTDataPoints();
+ const uint64_t numTimeDomainDataPoints = spectrumUpdateEvent->getNumTimeDomainDataPoints();
+ const gruel::high_res_timer_type dataTimestamp = spectrumUpdateEvent->getDataTimestamp();
+ const bool repeatDataFlag = spectrumUpdateEvent->getRepeatDataFlag();
+ const bool lastOfMultipleUpdatesFlag = spectrumUpdateEvent->getLastOfMultipleUpdateFlag();
+ const gruel::high_res_timer_type generatedTimestamp = spectrumUpdateEvent->getEventGeneratedTimestamp();
+ double* realTimeDomainDataPoints = (double*)spectrumUpdateEvent->getRealTimeDomainPoints();
+ double* imagTimeDomainDataPoints = (double*)spectrumUpdateEvent->getImagTimeDomainPoints();
+
+ std::vector<double*> timeDomainDataPoints;
+ timeDomainDataPoints.push_back(realTimeDomainDataPoints);
+ timeDomainDataPoints.push_back(imagTimeDomainDataPoints);
+
+ // REMEMBER: The dataTimestamp is NOT valid when the repeat data flag is true...
+ ResizeBuffers(numFFTDataPoints, numTimeDomainDataPoints);
+
+ // Calculate the Magnitude of the complex point
+ const std::complex<float>* complexDataPointsPtr = complexDataPoints+numFFTDataPoints/2;
+ double* realFFTDataPointsPtr = _realFFTDataPoints;
+
+ double sumMean = 0.0;
+ double localPeakAmplitude = -HUGE_VAL;
+ double localPeakFrequency = 0.0;
+ const double fftBinSize = (_stopFrequency-_startFrequency) /
+ static_cast<double>(numFFTDataPoints);
+
+ // Run this twice to perform the fftshift operation on the data here as well
+ std::complex<float> scaleFactor = std::complex<float>((float)numFFTDataPoints);
+ for(uint64_t point = 0; point < numFFTDataPoints/2; point++){
+ std::complex<float> pt = (*complexDataPointsPtr) / scaleFactor;
+ *realFFTDataPointsPtr = 10.0*log10((pt.real() * pt.real() + pt.imag()*pt.imag()) + 1e-20);
+
+ if(*realFFTDataPointsPtr > localPeakAmplitude) {
+ localPeakFrequency = static_cast<float>(point) * fftBinSize;
+ localPeakAmplitude = *realFFTDataPointsPtr;
+ }
+ sumMean += *realFFTDataPointsPtr;
+
+ complexDataPointsPtr++;
+ realFFTDataPointsPtr++;
+ }
+
+ // This loop takes the first half of the input data and puts it in the
+ // second half of the plotted data
+ complexDataPointsPtr = complexDataPoints;
+ for(uint64_t point = 0; point < numFFTDataPoints/2; point++){
+ std::complex<float> pt = (*complexDataPointsPtr) / scaleFactor;
+ *realFFTDataPointsPtr = 10.0*log10((pt.real() * pt.real() + pt.imag()*pt.imag()) + 1e-20);
+
+ if(*realFFTDataPointsPtr > localPeakAmplitude) {
+ localPeakFrequency = static_cast<float>(point) * fftBinSize;
+ localPeakAmplitude = *realFFTDataPointsPtr;
+ }
+ sumMean += *realFFTDataPointsPtr;
+
+ complexDataPointsPtr++;
+ realFFTDataPointsPtr++;
+ }
+
+ // Don't update the averaging history if this is repeated data
+ if(!repeatDataFlag){
+ _AverageHistory(_realFFTDataPoints);
+
+ // Only use the local info if we are not repeating data
+ _peakAmplitude = localPeakAmplitude;
+ _peakFrequency = localPeakFrequency;
+
+ // calculate the spectral mean
+ // +20 because for the comparison below we only want to throw out bins
+ // that are significantly higher (and would, thus, affect the mean more)
+ const double meanAmplitude = (sumMean / numFFTDataPoints) + 20.0;
+
+ // now throw out any bins higher than the mean
+ sumMean = 0.0;
+ uint64_t newNumDataPoints = numFFTDataPoints;
+ for(uint64_t number = 0; number < numFFTDataPoints; number++){
+ if (_realFFTDataPoints[number] <= meanAmplitude)
+ sumMean += _realFFTDataPoints[number];
+ else
+ newNumDataPoints--;
+ }
+
+ if (newNumDataPoints == 0) // in the odd case that all
+ _noiseFloorAmplitude = meanAmplitude; // amplitudes are equal!
+ else
+ _noiseFloorAmplitude = sumMean / newNumDataPoints;
+ }
+
+ if(lastOfMultipleUpdatesFlag){
+ int tabindex = SpectrumTypeTab->currentIndex();
+ if(tabindex == d_plot_fft) {
+ _frequencyDisplayPlot->PlotNewData(_averagedValues, numFFTDataPoints,
+ _noiseFloorAmplitude, _peakFrequency,
+ _peakAmplitude, d_update_time);
+ }
+ if(tabindex == d_plot_time) {
+ _timeDomainDisplayPlot->PlotNewData(timeDomainDataPoints,
+ numTimeDomainDataPoints,
+ d_update_time);
+ }
+ if(tabindex == d_plot_constellation) {
+ _constellationDisplayPlot->PlotNewData(realTimeDomainDataPoints,
+ imagTimeDomainDataPoints,
+ numTimeDomainDataPoints,
+ d_update_time);
+ }
+
+ // Don't update the repeated data for the waterfall
+ if(!repeatDataFlag){
+ if(tabindex == d_plot_waterfall) {
+ _waterfallDisplayPlot->PlotNewData(_realFFTDataPoints, numFFTDataPoints,
+ d_update_time, dataTimestamp,
+ spectrumUpdateEvent->getDroppedFFTFrames());
+ }
+ }
+
+ // Tell the system the GUI has been updated
+ if(_systemSpecifiedFlag){
+ _system->SetLastGUIUpdateTime(generatedTimestamp);
+ _system->DecrementPendingGUIUpdateEvents();
+ }
+ }
+}
+
+void
+SpectrumDisplayForm::resizeEvent( QResizeEvent *e )
+{
+ QSize s;
+ s.setWidth(FrequencyPlotDisplayFrame->width());
+ s.setHeight(FrequencyPlotDisplayFrame->height());
+ emit _frequencyDisplayPlot->resizeSlot(&s);
+
+ s.setWidth(TimeDomainDisplayFrame->width());
+ s.setHeight(TimeDomainDisplayFrame->height());
+ emit _timeDomainDisplayPlot->resizeSlot(&s);
+
+ s.setWidth(WaterfallPlotDisplayFrame->width());
+ s.setHeight(WaterfallPlotDisplayFrame->height());
+ emit _waterfallDisplayPlot->resizeSlot(&s);
+
+ s.setWidth(ConstellationDisplayFrame->width());
+ s.setHeight(ConstellationDisplayFrame->height());
+ emit _constellationDisplayPlot->resizeSlot(&s);
+}
+
+void
+SpectrumDisplayForm::customEvent( QEvent * e)
+{
+ if(e->type() == QEvent::User+3){
+ if(_systemSpecifiedFlag){
+ WindowComboBox->setCurrentIndex(_system->GetWindowType());
+ FFTSizeComboBox->setCurrentIndex(_system->GetFFTSizeIndex());
+ }
+
+ waterfallMinimumIntensityChangedCB(WaterfallMinimumIntensityWheel->value());
+ waterfallMaximumIntensityChangedCB(WaterfallMaximumIntensityWheel->value());
+
+ // Clear any previous display
+ Reset();
+ }
+ else if(e->type() == 10005){
+ SpectrumUpdateEvent* spectrumUpdateEvent = (SpectrumUpdateEvent*)e;
+ newFrequencyData(spectrumUpdateEvent);
+ }
+ else if(e->type() == 10008){
+ setWindowTitle(((SpectrumWindowCaptionEvent*)e)->getLabel());
+ }
+ else if(e->type() == 10009){
+ Reset();
+ if(_systemSpecifiedFlag){
+ _system->ResetPendingGUIUpdateEvents();
+ }
+ }
+ else if(e->type() == 10010){
+ _startFrequency = ((SpectrumFrequencyRangeEvent*)e)->GetStartFrequency();
+ _stopFrequency = ((SpectrumFrequencyRangeEvent*)e)->GetStopFrequency();
+ _centerFrequency = ((SpectrumFrequencyRangeEvent*)e)->GetCenterFrequency();
+
+ UseRFFrequenciesCB(UseRFFrequenciesCheckBox->isChecked());
+ }
+}
+
+void
+SpectrumDisplayForm::UpdateGuiTimer()
+{
+ // This is called by the displayTimer and redraws the canvases of
+ // all of the plots.
+ _frequencyDisplayPlot->canvas()->update();
+ _waterfallDisplayPlot->canvas()->update();
+ _timeDomainDisplayPlot->canvas()->update();
+ _constellationDisplayPlot->canvas()->update();
+}
+
+
+void
+SpectrumDisplayForm::AvgLineEdit_valueChanged( int value )
+{
+ SetAverageCount(value);
+}
+
+
+void
+SpectrumDisplayForm::MaxHoldCheckBox_toggled( bool newState )
+{
+ MaxHoldResetBtn->setEnabled(newState);
+ _frequencyDisplayPlot->SetMaxFFTVisible(newState);
+ MaxHoldResetBtn_clicked();
+}
+
+
+void
+SpectrumDisplayForm::MinHoldCheckBox_toggled( bool newState )
+{
+ MinHoldResetBtn->setEnabled(newState);
+ _frequencyDisplayPlot->SetMinFFTVisible(newState);
+ MinHoldResetBtn_clicked();
+}
+
+
+void
+SpectrumDisplayForm::MinHoldResetBtn_clicked()
+{
+ _frequencyDisplayPlot->ClearMinData();
+ _frequencyDisplayPlot->replot();
+}
+
+
+void
+SpectrumDisplayForm::MaxHoldResetBtn_clicked()
+{
+ _frequencyDisplayPlot->ClearMaxData();
+ _frequencyDisplayPlot->replot();
+}
+
+
+void
+SpectrumDisplayForm::TabChanged(int index)
+{
+ // This might be dangerous to call this with NULL
+ resizeEvent(NULL);
+}
+
+void
+SpectrumDisplayForm::SetFrequencyRange(const double newCenterFrequency,
+ const double newStartFrequency,
+ const double newStopFrequency)
+{
+ double fdiff;
+ if(UseRFFrequenciesCheckBox->isChecked()) {
+ fdiff = newCenterFrequency;
+ }
+ else {
+ fdiff = std::max(fabs(newStartFrequency), fabs(newStopFrequency));
+ }
+
+ if(fdiff > 0) {
+ std::string strunits[4] = {"Hz", "kHz", "MHz", "GHz"};
+ std::string strtime[4] = {"sec", "ms", "us", "ns"};
+ double units10 = floor(log10(fdiff));
+ double units3 = std::max(floor(units10 / 3.0), 0.0);
+ double units = pow(10, (units10-fmod(units10, 3.0)));
+ int iunit = static_cast<int>(units3);
+
+ _startFrequency = newStartFrequency;
+ _stopFrequency = newStopFrequency;
+ _centerFrequency = newCenterFrequency;
+
+ _frequencyDisplayPlot->SetFrequencyRange(_startFrequency,
+ _stopFrequency,
+ _centerFrequency,
+ UseRFFrequenciesCheckBox->isChecked(),
+ units, strunits[iunit]);
+ _waterfallDisplayPlot->SetFrequencyRange(_startFrequency,
+ _stopFrequency,
+ _centerFrequency,
+ UseRFFrequenciesCheckBox->isChecked(),
+ units, strunits[iunit]);
+ _timeDomainDisplayPlot->SetSampleRate(_stopFrequency - _startFrequency,
+ units, strtime[iunit]);
+ }
+}
+
+int
+SpectrumDisplayForm::GetAverageCount()
+{
+ return _historyVector->size();
+}
+
+void
+SpectrumDisplayForm::SetAverageCount(const int newCount)
+{
+ if(newCount > -1){
+ if(newCount != static_cast<int>(_historyVector->size())){
+ std::vector<double*>::iterator pos;
+ while(newCount < static_cast<int>(_historyVector->size())){
+ pos = _historyVector->begin();
+ delete[] (*pos);
+ _historyVector->erase(pos);
+ }
+
+ while(newCount > static_cast<int>(_historyVector->size())){
+ _historyVector->push_back(new double[_numRealDataPoints]);
+ }
+ AverageDataReset();
+ }
+ }
+}
+
+void
+SpectrumDisplayForm::_AverageHistory(const double* newBuffer)
+{
+ if(_numRealDataPoints > 0){
+ if(_historyVector->size() > 0){
+ memcpy(_historyVector->operator[](_historyEntry), newBuffer,
+ _numRealDataPoints*sizeof(double));
+
+ // Increment the next location to store data
+ _historyEntryCount++;
+ if(_historyEntryCount > static_cast<int>(_historyVector->size())){
+ _historyEntryCount = _historyVector->size();
+ }
+ _historyEntry += 1;
+ _historyEntry = _historyEntry % _historyVector->size();
+
+ // Total up and then average the values
+ double sum;
+ for(uint64_t location = 0; location < _numRealDataPoints; location++){
+ sum = 0;
+ for(int number = 0; number < _historyEntryCount; number++){
+ sum += _historyVector->operator[](number)[location];
+ }
+ _averagedValues[location] = sum/static_cast<double>(_historyEntryCount);
+ }
+ }
+ else{
+ memcpy(_averagedValues, newBuffer, _numRealDataPoints*sizeof(double));
+ }
+ }
+}
+
+void
+SpectrumDisplayForm::ResizeBuffers( const uint64_t numFFTDataPoints,
+ const uint64_t /*numTimeDomainDataPoints*/ )
+{
+ // Convert from Complex to Real for certain Displays
+ if(_numRealDataPoints != numFFTDataPoints){
+ _numRealDataPoints = numFFTDataPoints;
+ delete[] _realFFTDataPoints;
+ delete[] _averagedValues;
+
+ _realFFTDataPoints = new double[_numRealDataPoints];
+ _averagedValues = new double[_numRealDataPoints];
+ memset(_realFFTDataPoints, 0x0, _numRealDataPoints*sizeof(double));
+
+ const int historySize = _historyVector->size();
+ SetAverageCount(0); // Clear the existing history
+ SetAverageCount(historySize);
+
+ Reset();
+ }
+}
+
+void
+SpectrumDisplayForm::Reset()
+{
+ AverageDataReset();
+
+ _waterfallDisplayPlot->Reset();
+}
+
+
+void
+SpectrumDisplayForm::AverageDataReset()
+{
+ _historyEntry = 0;
+ _historyEntryCount = 0;
+
+ memset(_averagedValues, 0x0, _numRealDataPoints*sizeof(double));
+
+ MaxHoldResetBtn_clicked();
+ MinHoldResetBtn_clicked();
+}
+
+
+void
+SpectrumDisplayForm::closeEvent( QCloseEvent *e )
+{
+ if(_systemSpecifiedFlag){
+ _system->SetWindowOpenFlag(false);
+ }
+
+ qApp->processEvents();
+
+ QWidget::closeEvent(e);
+}
+
+
+void
+SpectrumDisplayForm::WindowTypeChanged( int newItem )
+{
+ if(_systemSpecifiedFlag){
+ _system->SetWindowType(newItem);
+ }
+}
+
+
+void
+SpectrumDisplayForm::UseRFFrequenciesCB( bool useRFFlag )
+{
+ SetFrequencyRange(_centerFrequency, _startFrequency, _stopFrequency);
+}
+
+
+void
+SpectrumDisplayForm::waterfallMaximumIntensityChangedCB( double newValue )
+{
+ if(newValue > WaterfallMinimumIntensityWheel->value()){
+ WaterfallMaximumIntensityLabel->setText(QString("%1 dB").arg(newValue, 0, 'f', 0));
+ }
+ else{
+ WaterfallMaximumIntensityWheel->setValue(WaterfallMinimumIntensityWheel->value());
+ }
+
+ _waterfallDisplayPlot->SetIntensityRange(WaterfallMinimumIntensityWheel->value(),
+ WaterfallMaximumIntensityWheel->value());
+}
+
+
+void
+SpectrumDisplayForm::waterfallMinimumIntensityChangedCB( double newValue )
+{
+ if(newValue < WaterfallMaximumIntensityWheel->value()){
+ WaterfallMinimumIntensityLabel->setText(QString("%1 dB").arg(newValue, 0, 'f', 0));
+ }
+ else{
+ WaterfallMinimumIntensityWheel->setValue(WaterfallMaximumIntensityWheel->value());
+ }
+
+ _waterfallDisplayPlot->SetIntensityRange(WaterfallMinimumIntensityWheel->value(),
+ WaterfallMaximumIntensityWheel->value());
+}
+
+void
+SpectrumDisplayForm::FFTComboBoxSelectedCB( const QString &fftSizeString )
+{
+ if(_systemSpecifiedFlag){
+ _system->SetFFTSize(fftSizeString.toLong());
+ }
+}
+
+
+void
+SpectrumDisplayForm::WaterfallAutoScaleBtnCB()
+{
+ double minimumIntensity = _noiseFloorAmplitude - 5;
+ if(minimumIntensity < WaterfallMinimumIntensityWheel->minValue()){
+ minimumIntensity = WaterfallMinimumIntensityWheel->minValue();
+ }
+ WaterfallMinimumIntensityWheel->setValue(minimumIntensity);
+ double maximumIntensity = _peakAmplitude + 10;
+ if(maximumIntensity > WaterfallMaximumIntensityWheel->maxValue()){
+ maximumIntensity = WaterfallMaximumIntensityWheel->maxValue();
+ }
+ WaterfallMaximumIntensityWheel->setValue(maximumIntensity);
+ waterfallMaximumIntensityChangedCB(maximumIntensity);
+}
+
+void
+SpectrumDisplayForm::WaterfallIntensityColorTypeChanged( int newType )
+{
+ QColor lowIntensityColor;
+ QColor highIntensityColor;
+ if(newType == WaterfallDisplayPlot::INTENSITY_COLOR_MAP_TYPE_USER_DEFINED){
+ // Select the Low Intensity Color
+ lowIntensityColor = _waterfallDisplayPlot->GetUserDefinedLowIntensityColor();
+ if(!lowIntensityColor.isValid()){
+ lowIntensityColor = Qt::black;
+ }
+ QMessageBox::information(this, "Low Intensity Color Selection", "In the next window, select the low intensity color for the waterfall display", QMessageBox::Ok);
+ lowIntensityColor = QColorDialog::getColor(lowIntensityColor, this);
+
+ // Select the High Intensity Color
+ highIntensityColor = _waterfallDisplayPlot->GetUserDefinedHighIntensityColor();
+ if(!highIntensityColor.isValid()){
+ highIntensityColor = Qt::white;
+ }
+ QMessageBox::information(this, "High Intensity Color Selection", "In the next window, select the high intensity color for the waterfall display", QMessageBox::Ok);
+ highIntensityColor = QColorDialog::getColor(highIntensityColor, this);
+ }
+
+ _waterfallDisplayPlot->SetIntensityColorMapType(newType, lowIntensityColor, highIntensityColor);
+}
+
+void
+SpectrumDisplayForm::ToggleTabFrequency(const bool state)
+{
+ if(state == true) {
+ if(d_plot_fft == -1) {
+ SpectrumTypeTab->addTab(FrequencyPage, "Frequency Display");
+ d_plot_fft = SpectrumTypeTab->count()-1;
+ }
+ }
+ else {
+ SpectrumTypeTab->removeTab(SpectrumTypeTab->indexOf(FrequencyPage));
+ d_plot_fft = -1;
+ }
+}
+
+void
+SpectrumDisplayForm::ToggleTabWaterfall(const bool state)
+{
+ if(state == true) {
+ if(d_plot_waterfall == -1) {
+ SpectrumTypeTab->addTab(WaterfallPage, "Waterfall Display");
+ d_plot_waterfall = SpectrumTypeTab->count()-1;
+ }
+ }
+ else {
+ SpectrumTypeTab->removeTab(SpectrumTypeTab->indexOf(WaterfallPage));
+ d_plot_waterfall = -1;
+ }
+}
+
+void
+SpectrumDisplayForm::ToggleTabTime(const bool state)
+{
+ if(state == true) {
+ if(d_plot_time == -1) {
+ SpectrumTypeTab->addTab(TimeDomainPage, "Time Domain Display");
+ d_plot_time = SpectrumTypeTab->count()-1;
+ }
+ }
+ else {
+ SpectrumTypeTab->removeTab(SpectrumTypeTab->indexOf(TimeDomainPage));
+ d_plot_time = -1;
+ }
+}
+
+void
+SpectrumDisplayForm::ToggleTabConstellation(const bool state)
+{
+ if(state == true) {
+ if(d_plot_constellation == -1) {
+ SpectrumTypeTab->addTab(ConstellationPage, "Constellation Display");
+ d_plot_constellation = SpectrumTypeTab->count()-1;
+ }
+ }
+ else {
+ SpectrumTypeTab->removeTab(SpectrumTypeTab->indexOf(ConstellationPage));
+ d_plot_constellation = -1;
+ }
+}
+
+
+void
+SpectrumDisplayForm::SetTimeDomainAxis(double min, double max)
+{
+ _timeDomainDisplayPlot->setYaxis(min, max);
+}
+
+void
+SpectrumDisplayForm::SetConstellationAxis(double xmin, double xmax,
+ double ymin, double ymax)
+{
+ _constellationDisplayPlot->set_axis(xmin, xmax, ymin, ymax);
+}
+
+void
+SpectrumDisplayForm::SetConstellationPenSize(int size)
+{
+ _constellationDisplayPlot->set_pen_size( size );
+}
+
+void
+SpectrumDisplayForm::SetFrequencyAxis(double min, double max)
+{
+ _frequencyDisplayPlot->set_yaxis(min, max);
+}
+
+void
+SpectrumDisplayForm::SetUpdateTime(double t)
+{
+ d_update_time = t;
+ // QTimer class takes millisecond input
+ displayTimer->start(d_update_time*1000);
+}
+
+void
+SpectrumDisplayForm::onFFTPlotPointSelected(const QPointF p)
+{
+ emit plotPointSelected(p, 1);
+}
+
+void
+SpectrumDisplayForm::onWFallPlotPointSelected(const QPointF p)
+{
+ emit plotPointSelected(p, 2);
+}
+
+void
+SpectrumDisplayForm::onTimePlotPointSelected(const QPointF p)
+{
+ emit plotPointSelected(p, 3);
+}
+
+void
+SpectrumDisplayForm::onConstPlotPointSelected(const QPointF p)
+{
+ emit plotPointSelected(p, 4);
+}
diff --git a/gr-qtgui/lib/spectrumdisplayform.h b/gr-qtgui/lib/spectrumdisplayform.h
new file mode 100644
index 000000000..63dd304d5
--- /dev/null
+++ b/gr-qtgui/lib/spectrumdisplayform.h
@@ -0,0 +1,139 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,2009,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.
+ */
+
+#ifndef SPECTRUM_DISPLAY_FORM_H
+#define SPECTRUM_DISPLAY_FORM_H
+
+#include "spectrumdisplayform.ui.h"
+
+class SpectrumGUIClass;
+#include <SpectrumGUIClass.h>
+
+#include <SpectrumGUIClass.h>
+#include <FrequencyDisplayPlot.h>
+#include <WaterfallDisplayPlot.h>
+#include <TimeDomainDisplayPlot.h>
+#include <ConstellationDisplayPlot.h>
+#include <QValidator>
+#include <QTimer>
+#include <vector>
+
+class SpectrumDisplayForm : public QWidget, public Ui::SpectrumDisplayForm
+{
+ Q_OBJECT
+
+ public:
+ SpectrumDisplayForm(QWidget* parent = 0);
+ ~SpectrumDisplayForm();
+
+ void setSystem( SpectrumGUIClass * newSystem, const uint64_t numFFTDataPoints,
+ const uint64_t numTimeDomainDataPoints );
+
+ int GetAverageCount();
+ void SetAverageCount( const int newCount );
+ void Reset();
+ void AverageDataReset();
+ void ResizeBuffers( const uint64_t numFFTDataPoints,
+ const uint64_t numTimeDomainDataPoints );
+
+public slots:
+ void resizeEvent( QResizeEvent * e );
+ void customEvent( QEvent * e );
+ void AvgLineEdit_valueChanged( int valueString );
+ void MaxHoldCheckBox_toggled( bool newState );
+ void MinHoldCheckBox_toggled( bool newState );
+ void MinHoldResetBtn_clicked();
+ void MaxHoldResetBtn_clicked();
+ void TabChanged(int index);
+
+ void SetFrequencyRange( const double newCenterFrequency,
+ const double newStartFrequency,
+ const double newStopFrequency );
+ void closeEvent( QCloseEvent * e );
+ void WindowTypeChanged( int newItem );
+ void UseRFFrequenciesCB( bool useRFFlag );
+ void waterfallMaximumIntensityChangedCB(double);
+ void waterfallMinimumIntensityChangedCB(double);
+ void WaterfallIntensityColorTypeChanged(int);
+ void WaterfallAutoScaleBtnCB();
+ void FFTComboBoxSelectedCB(const QString&);
+
+ void ToggleTabFrequency(const bool state);
+ void ToggleTabWaterfall(const bool state);
+ void ToggleTabTime(const bool state);
+ void ToggleTabConstellation(const bool state);
+
+ void SetTimeDomainAxis(double min, double max);
+ void SetConstellationAxis(double xmin, double xmax,
+ double ymin, double ymax);
+ void SetConstellationPenSize(int size);
+ void SetFrequencyAxis(double min, double max);
+ void SetUpdateTime(double t);
+
+private slots:
+ void newFrequencyData( const SpectrumUpdateEvent* );
+ void UpdateGuiTimer();
+
+ void onFFTPlotPointSelected(const QPointF p);
+ void onWFallPlotPointSelected(const QPointF p);
+ void onTimePlotPointSelected(const QPointF p);
+ void onConstPlotPointSelected(const QPointF p);
+
+signals:
+ void plotPointSelected(const QPointF p, int type);
+
+private:
+ void _AverageHistory( const double * newBuffer );
+
+ int _historyEntryCount;
+ int _historyEntry;
+ std::vector<double*>* _historyVector;
+ double* _averagedValues;
+ uint64_t _numRealDataPoints;
+ double* _realFFTDataPoints;
+ QIntValidator* _intValidator;
+ FrequencyDisplayPlot* _frequencyDisplayPlot;
+ WaterfallDisplayPlot* _waterfallDisplayPlot;
+ TimeDomainDisplayPlot* _timeDomainDisplayPlot;
+ ConstellationDisplayPlot* _constellationDisplayPlot;
+ SpectrumGUIClass* _system;
+ bool _systemSpecifiedFlag;
+ double _centerFrequency;
+ double _startFrequency;
+ double _noiseFloorAmplitude;
+ double _peakFrequency;
+ double _peakAmplitude;
+ double _stopFrequency;
+
+ //SpectrumUpdateEvent _lastSpectrumEvent;
+
+ // whether or not to use a particular display
+ int d_plot_fft;
+ int d_plot_waterfall;
+ int d_plot_time;
+ int d_plot_constellation;
+
+ QTimer *displayTimer;
+ double d_update_time;
+};
+
+#endif /* SPECTRUM_DISPLAY_FORM_H */
diff --git a/gr-qtgui/lib/spectrumdisplayform.ui b/gr-qtgui/lib/spectrumdisplayform.ui
new file mode 100644
index 000000000..049d4ffeb
--- /dev/null
+++ b/gr-qtgui/lib/spectrumdisplayform.ui
@@ -0,0 +1,756 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>SpectrumDisplayForm</class>
+ <widget class="QWidget" name="SpectrumDisplayForm">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>712</width>
+ <height>560</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Spectrum Display</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="1" column="3">
+ <widget class="QComboBox" name="FFTSizeComboBox">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>120</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <item>
+ <property name="text">
+ <string>1024</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>2048</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>4096</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>8192</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>16384</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>32768</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ <item row="1" column="2">
+ <widget class="QLabel" name="FFTSizeLabel">
+ <property name="text">
+ <string>FFT Size:</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ <property name="wordWrap">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QCheckBox" name="UseRFFrequenciesCheckBox">
+ <property name="text">
+ <string>Display RF Frequencies</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0">
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QLabel" name="WindowLbl">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Window:</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ <property name="wordWrap">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="WindowComboBox">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>120</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>120</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="font">
+ <font>
+ <pointsize>9</pointsize>
+ </font>
+ </property>
+ <item>
+ <property name="text">
+ <string>Hamming</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Hann</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Blackman</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Rectangular</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Kaiser</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Blackman-harris</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="0" column="0" colspan="4">
+ <widget class="QTabWidget" name="SpectrumTypeTab">
+ <property name="currentIndex">
+ <number>0</number>
+ </property>
+ <widget class="QWidget" name="FrequencyPage">
+ <attribute name="title">
+ <string>Frequency Display</string>
+ </attribute>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <widget class="QFrame" name="FrequencyPlotDisplayFrame">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>617</width>
+ <height>400</height>
+ </size>
+ </property>
+ <property name="sizeIncrement">
+ <size>
+ <width>1</width>
+ <height>1</height>
+ </size>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::NoFrame</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Plain</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QGridLayout" name="gridLayout_2">
+ <item row="1" column="0">
+ <widget class="QCheckBox" name="MaxHoldCheckBox">
+ <property name="text">
+ <string>Max Hold</string>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QCheckBox" name="MinHoldCheckBox">
+ <property name="text">
+ <string>Min Hold</string>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QPushButton" name="MaxHoldResetBtn">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>25</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Reset</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="3">
+ <widget class="QLabel" name="AvgLabel">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>62</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Average</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignCenter</set>
+ </property>
+ <property name="wordWrap">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QPushButton" name="MinHoldResetBtn">
+ <property name="text">
+ <string>Reset</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="3">
+ <widget class="QSpinBox" name="AvgLineEdit"/>
+ </item>
+ <item row="1" column="2">
+ <spacer name="horizontalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>200</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="WaterfallPage">
+ <attribute name="title">
+ <string>Waterfall Display</string>
+ </attribute>
+ <layout class="QGridLayout" name="gridLayout_3">
+ <item row="0" column="0">
+ <widget class="QLabel" name="textLabel1">
+ <property name="maximumSize">
+ <size>
+ <width>100</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Intensity Display:</string>
+ </property>
+ <property name="wordWrap">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="2">
+ <widget class="QwtWheel" name="WaterfallMaximumIntensityWheel">
+ <property name="minimumSize">
+ <size>
+ <width>200</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="mouseTracking">
+ <bool>true</bool>
+ </property>
+ <property name="focusPolicy">
+ <enum>Qt::WheelFocus</enum>
+ </property>
+ <property name="valid">
+ <bool>true</bool>
+ </property>
+ <property name="totalAngle">
+ <double>200.000000000000000</double>
+ </property>
+ <property name="viewAngle">
+ <double>20.000000000000000</double>
+ </property>
+ <property name="mass">
+ <double>0.000000000000000</double>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="3">
+ <widget class="QLabel" name="WaterfallMaximumIntensityLabel">
+ <property name="maximumSize">
+ <size>
+ <width>100</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>100 dB</string>
+ </property>
+ <property name="wordWrap">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" colspan="4">
+ <widget class="QFrame" name="WaterfallPlotDisplayFrame">
+ <property name="minimumSize">
+ <size>
+ <width>617</width>
+ <height>338</height>
+ </size>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::NoFrame</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Plain</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="2">
+ <widget class="QwtWheel" name="WaterfallMinimumIntensityWheel">
+ <property name="minimumSize">
+ <size>
+ <width>200</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="valid">
+ <bool>true</bool>
+ </property>
+ <property name="totalAngle">
+ <double>200.000000000000000</double>
+ </property>
+ <property name="viewAngle">
+ <double>20.000000000000000</double>
+ </property>
+ <property name="mass">
+ <double>0.000000000000000</double>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="3">
+ <widget class="QLabel" name="WaterfallMinimumIntensityLabel">
+ <property name="maximumSize">
+ <size>
+ <width>100</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>-100 dB</string>
+ </property>
+ <property name="wordWrap">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0" colspan="2">
+ <widget class="QPushButton" name="WaterfallAutoScaleBtn">
+ <property name="maximumSize">
+ <size>
+ <width>80</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="toolTip">
+ <string>Scales the Intensity to the current data extremes.</string>
+ </property>
+ <property name="text">
+ <string>Auto Scale</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QComboBox" name="WaterfallIntensityComboBox">
+ <property name="maximumSize">
+ <size>
+ <width>100</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <item>
+ <property name="text">
+ <string>Color</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>White Hot</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Black Hot</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Incandescent</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>User Defined</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="TimeDomainPage">
+ <attribute name="title">
+ <string>Time Domain Display</string>
+ </attribute>
+ <layout class="QGridLayout" name="gridLayout_4">
+ <item row="0" column="0">
+ <widget class="QFrame" name="TimeDomainDisplayFrame">
+ <property name="minimumSize">
+ <size>
+ <width>617</width>
+ <height>404</height>
+ </size>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::NoFrame</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Plain</enum>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="ConstellationPage">
+ <attribute name="title">
+ <string>Constellation Display</string>
+ </attribute>
+ <layout class="QGridLayout" name="gridLayout_5">
+ <item row="0" column="0">
+ <widget class="QFrame" name="ConstellationDisplayFrame">
+ <property name="minimumSize">
+ <size>
+ <width>617</width>
+ <height>406</height>
+ </size>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::StyledPanel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Raised</enum>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <layoutdefault spacing="6" margin="11"/>
+ <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
+ <customwidgets>
+ <customwidget>
+ <class>QwtWheel</class>
+ <extends>QWidget</extends>
+ <header>qwt_wheel.h</header>
+ </customwidget>
+ </customwidgets>
+ <tabstops>
+ <tabstop>SpectrumTypeTab</tabstop>
+ <tabstop>UseRFFrequenciesCheckBox</tabstop>
+ <tabstop>FFTSizeComboBox</tabstop>
+ <tabstop>WaterfallMaximumIntensityWheel</tabstop>
+ <tabstop>WaterfallMinimumIntensityWheel</tabstop>
+ </tabstops>
+ <includes>
+ <include location="global">SpectrumGUIClass.h</include>
+ <include location="global">FrequencyDisplayPlot.h</include>
+ <include location="global">WaterfallDisplayPlot.h</include>
+ <include location="global">TimeDomainDisplayPlot.h</include>
+ <include location="global">qvalidator.h</include>
+ <include location="global">vector</include>
+ <include location="local">qwt_wheel.h</include>
+ </includes>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>MaxHoldCheckBox</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>SpectrumDisplayForm</receiver>
+ <slot>MaxHoldCheckBox_toggled(bool)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>22</x>
+ <y>324</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>20</x>
+ <y>20</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>MaxHoldResetBtn</sender>
+ <signal>clicked()</signal>
+ <receiver>SpectrumDisplayForm</receiver>
+ <slot>MaxHoldResetBtn_clicked()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>107</x>
+ <y>324</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>20</x>
+ <y>20</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>MinHoldCheckBox</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>SpectrumDisplayForm</receiver>
+ <slot>MinHoldCheckBox_toggled(bool)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>22</x>
+ <y>349</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>20</x>
+ <y>20</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>MinHoldResetBtn</sender>
+ <signal>clicked()</signal>
+ <receiver>SpectrumDisplayForm</receiver>
+ <slot>MinHoldResetBtn_clicked()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>107</x>
+ <y>349</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>20</x>
+ <y>20</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>WindowComboBox</sender>
+ <signal>activated(int)</signal>
+ <receiver>SpectrumDisplayForm</receiver>
+ <slot>WindowTypeChanged(int)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>20</x>
+ <y>20</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>20</x>
+ <y>20</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>UseRFFrequenciesCheckBox</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>SpectrumDisplayForm</receiver>
+ <slot>UseRFFrequenciesCB(bool)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>20</x>
+ <y>20</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>20</x>
+ <y>20</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>WaterfallMaximumIntensityWheel</sender>
+ <signal>valueChanged(double)</signal>
+ <receiver>SpectrumDisplayForm</receiver>
+ <slot>waterfallMaximumIntensityChangedCB(double)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>217</x>
+ <y>44</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>20</x>
+ <y>20</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>WaterfallMinimumIntensityWheel</sender>
+ <signal>valueChanged(double)</signal>
+ <receiver>SpectrumDisplayForm</receiver>
+ <slot>waterfallMinimumIntensityChangedCB(double)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>217</x>
+ <y>349</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>20</x>
+ <y>20</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>FFTSizeComboBox</sender>
+ <signal>activated(QString)</signal>
+ <receiver>SpectrumDisplayForm</receiver>
+ <slot>FFTComboBoxSelectedCB(QString)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>20</x>
+ <y>20</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>20</x>
+ <y>20</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>WaterfallAutoScaleBtn</sender>
+ <signal>clicked()</signal>
+ <receiver>SpectrumDisplayForm</receiver>
+ <slot>WaterfallAutoScaleBtnCB()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>22</x>
+ <y>349</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>20</x>
+ <y>20</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>WaterfallIntensityComboBox</sender>
+ <signal>activated(int)</signal>
+ <receiver>SpectrumDisplayForm</receiver>
+ <slot>WaterfallIntensityColorTypeChanged(int)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>92</x>
+ <y>44</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>20</x>
+ <y>20</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>SpectrumTypeTab</sender>
+ <signal>currentChanged(int)</signal>
+ <receiver>SpectrumDisplayForm</receiver>
+ <slot>TabChanged(int)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>314</x>
+ <y>189</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>316</x>
+ <y>217</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>AvgLineEdit</sender>
+ <signal>valueChanged(int)</signal>
+ <receiver>SpectrumDisplayForm</receiver>
+ <slot>AvgLineEdit_valueChanged(int)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>604</x>
+ <y>421</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>328</x>
+ <y>260</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>
diff --git a/gr-qtgui/lib/timedisplayform.cc b/gr-qtgui/lib/timedisplayform.cc
new file mode 100644
index 000000000..c650cd3eb
--- /dev/null
+++ b/gr-qtgui/lib/timedisplayform.cc
@@ -0,0 +1,177 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+#include <cmath>
+#include <QColorDialog>
+#include <QMessageBox>
+#include <timedisplayform.h>
+#include <iostream>
+
+TimeDisplayForm::TimeDisplayForm(int nplots, QWidget* parent)
+ : QWidget(parent)
+{
+ _systemSpecifiedFlag = false;
+ _intValidator = new QIntValidator(this);
+ _intValidator->setBottom(0);
+
+ _layout = new QGridLayout(this);
+ _timeDomainDisplayPlot = new TimeDomainDisplayPlot(nplots, this);
+ _layout->addWidget(_timeDomainDisplayPlot, 0, 0);
+
+ _numRealDataPoints = 1024;
+
+ setLayout(_layout);
+
+ Reset();
+
+ // Create a timer to update plots at the specified rate
+ displayTimer = new QTimer(this);
+ connect(displayTimer, SIGNAL(timeout()), this, SLOT(updateGuiTimer()));
+
+ connect(_timeDomainDisplayPlot, SIGNAL(plotPointSelected(const QPointF)),
+ this, SLOT(onTimePlotPointSelected(const QPointF)));
+}
+
+TimeDisplayForm::~TimeDisplayForm()
+{
+ // Qt deletes children when parent is deleted
+
+ // Don't worry about deleting Display Plots - they are deleted when parents are deleted
+ delete _intValidator;
+
+ displayTimer->stop();
+ delete displayTimer;
+}
+
+void
+TimeDisplayForm::newData( const TimeUpdateEvent* spectrumUpdateEvent)
+{
+ const std::vector<double*> timeDomainDataPoints = spectrumUpdateEvent->getTimeDomainPoints();
+ const uint64_t numTimeDomainDataPoints = spectrumUpdateEvent->getNumTimeDomainDataPoints();
+
+ _timeDomainDisplayPlot->PlotNewData(timeDomainDataPoints,
+ numTimeDomainDataPoints,
+ d_update_time);
+}
+
+void
+TimeDisplayForm::resizeEvent( QResizeEvent *e )
+{
+ QSize s = size();
+ emit _timeDomainDisplayPlot->resizeSlot(&s);
+}
+
+void
+TimeDisplayForm::customEvent( QEvent * e)
+{
+ if(e->type() == 10005) {
+ TimeUpdateEvent* timeUpdateEvent = (TimeUpdateEvent*)e;
+ newData(timeUpdateEvent);
+ }
+ //else if(e->type() == 10008){
+ //setWindowTitle(((SpectrumWindowCaptionEvent*)e)->getLabel());
+ //}
+ //else if(e->type() == 10009){
+ //Reset();
+ //if(_systemSpecifiedFlag){
+ // _system->ResetPendingGUIUpdateEvents();
+ //}
+ //}
+}
+
+void
+TimeDisplayForm::updateGuiTimer()
+{
+ _timeDomainDisplayPlot->canvas()->update();
+}
+
+void
+TimeDisplayForm::onTimePlotPointSelected(const QPointF p)
+{
+ emit plotPointSelected(p, 3);
+}
+
+void
+TimeDisplayForm::setFrequencyRange(const double newCenterFrequency,
+ const double newStartFrequency,
+ const double newStopFrequency)
+{
+ double fdiff = std::max(fabs(newStartFrequency), fabs(newStopFrequency));
+
+ if(fdiff > 0) {
+ std::string strtime[4] = {"sec", "ms", "us", "ns"};
+ double units10 = floor(log10(fdiff));
+ double units3 = std::max(floor(units10 / 3.0), 0.0);
+ double units = pow(10, (units10-fmod(units10, 3.0)));
+ int iunit = static_cast<int>(units3);
+
+ _startFrequency = newStartFrequency;
+ _stopFrequency = newStopFrequency;
+
+ _timeDomainDisplayPlot->SetSampleRate(_stopFrequency - _startFrequency,
+ units, strtime[iunit]);
+ }
+}
+
+void
+TimeDisplayForm::Reset()
+{
+}
+
+
+void
+TimeDisplayForm::closeEvent( QCloseEvent *e )
+{
+ //if(_systemSpecifiedFlag){
+ // _system->SetWindowOpenFlag(false);
+ //}
+
+ qApp->processEvents();
+
+ QWidget::closeEvent(e);
+}
+
+void
+TimeDisplayForm::setTimeDomainAxis(double min, double max)
+{
+ _timeDomainDisplayPlot->setYaxis(min, max);
+}
+
+void
+TimeDisplayForm::setUpdateTime(double t)
+{
+ d_update_time = t;
+ // QTimer class takes millisecond input
+ displayTimer->start(d_update_time*1000);
+}
+
+void
+TimeDisplayForm::setTitle(int which, QString title)
+{
+ _timeDomainDisplayPlot->setTitle(which, title);
+}
+
+void
+TimeDisplayForm::setColor(int which, QString color)
+{
+ _timeDomainDisplayPlot->setColor(which, color);
+}
diff --git a/gr-qtgui/lib/timedisplayform.h b/gr-qtgui/lib/timedisplayform.h
new file mode 100644
index 000000000..dd3f62a83
--- /dev/null
+++ b/gr-qtgui/lib/timedisplayform.h
@@ -0,0 +1,85 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+#ifndef TIME_DISPLAY_FORM_H
+#define TIME_DISPLAY_FORM_H
+
+#include <spectrumUpdateEvents.h>
+#include <FrequencyDisplayPlot.h>
+#include <WaterfallDisplayPlot.h>
+#include <TimeDomainDisplayPlot.h>
+#include <ConstellationDisplayPlot.h>
+#include <QtGui/QApplication>
+#include <QtGui/QGridLayout>
+#include <QValidator>
+#include <QTimer>
+#include <vector>
+
+class TimeDisplayForm : public QWidget
+{
+ Q_OBJECT
+
+ public:
+ TimeDisplayForm(int nplots=1, QWidget* parent = 0);
+ ~TimeDisplayForm();
+
+ void Reset();
+
+public slots:
+ void resizeEvent( QResizeEvent * e );
+ void customEvent( QEvent * e );
+ void setFrequencyRange( const double newCenterFrequency,
+ const double newStartFrequency,
+ const double newStopFrequency );
+ void closeEvent( QCloseEvent * e );
+
+ void setTimeDomainAxis(double min, double max);
+
+ void setUpdateTime(double t);
+
+ void setTitle(int which, QString title);
+ void setColor(int which, QString color);
+
+private slots:
+ void newData( const TimeUpdateEvent* );
+ void updateGuiTimer();
+
+ void onTimePlotPointSelected(const QPointF p);
+
+signals:
+ void plotPointSelected(const QPointF p, int type);
+
+private:
+ uint64_t _numRealDataPoints;
+ QIntValidator* _intValidator;
+
+ QGridLayout *_layout;
+ TimeDomainDisplayPlot* _timeDomainDisplayPlot;
+ bool _systemSpecifiedFlag;
+ double _startFrequency;
+ double _stopFrequency;
+
+ QTimer *displayTimer;
+ double d_update_time;
+};
+
+#endif /* TIME_DISPLAY_FORM_H */
diff --git a/gr-qtgui/lib/waterfallGlobalData.cc b/gr-qtgui/lib/waterfallGlobalData.cc
new file mode 100644
index 000000000..f64ed14f1
--- /dev/null
+++ b/gr-qtgui/lib/waterfallGlobalData.cc
@@ -0,0 +1,230 @@
+#ifndef WATERFALL_GLOBAL_DATA_CPP
+#define WATERFALL_GLOBAL_DATA_CPP
+
+#include <waterfallGlobalData.h>
+#include <cstdio>
+
+WaterfallData::WaterfallData(const double minimumFrequency,
+ const double maximumFrequency,
+ const uint64_t fftPoints,
+ const unsigned int historyExtent)
+#if QWT_VERSION < 0x060000
+ : QwtRasterData(QwtDoubleRect(minimumFrequency /* X START */, 0 /* Y START */,
+ maximumFrequency - minimumFrequency /* WIDTH */,
+ static_cast<double>(historyExtent)/* HEIGHT */))
+#else
+ : QwtRasterData()
+#endif
+{
+ _intensityRange = QwtDoubleInterval(-200.0, 0.0);
+
+ _fftPoints = fftPoints;
+ _historyLength = historyExtent;
+
+ _spectrumData = new double[_fftPoints * _historyLength];
+
+#if QWT_VERSION >= 0x060000
+ setInterval(Qt::XAxis, QwtInterval(minimumFrequency, maximumFrequency));
+ setInterval(Qt::YAxis, QwtInterval(0, historyExtent));
+ setInterval(Qt::ZAxis, QwtInterval(-200, 0.0));
+#endif
+
+ Reset();
+}
+
+WaterfallData::~WaterfallData()
+{
+ delete[] _spectrumData;
+}
+
+void WaterfallData::Reset()
+{
+ memset(_spectrumData, 0x0, _fftPoints*_historyLength*sizeof(double));
+
+ _numLinesToUpdate = -1;
+}
+
+void WaterfallData::Copy(const WaterfallData* rhs)
+{
+#if QWT_VERSION < 0x060000
+ if((_fftPoints != rhs->GetNumFFTPoints()) ||
+ (boundingRect() != rhs->boundingRect()) ){
+ _fftPoints = rhs->GetNumFFTPoints();
+ setBoundingRect(rhs->boundingRect());
+ delete[] _spectrumData;
+ _spectrumData = new double[_fftPoints * _historyLength];
+ }
+#else
+ if(_fftPoints != rhs->GetNumFFTPoints()) {
+ _fftPoints = rhs->GetNumFFTPoints();
+ delete[] _spectrumData;
+ _spectrumData = new double[_fftPoints * _historyLength];
+ }
+#endif
+
+ Reset();
+ SetSpectrumDataBuffer(rhs->GetSpectrumDataBuffer());
+ SetNumLinesToUpdate(rhs->GetNumLinesToUpdate());
+
+#if QWT_VERSION < 0x060000
+ setRange(rhs->range());
+#else
+ setInterval(Qt::XAxis, rhs->interval(Qt::XAxis));
+ setInterval(Qt::YAxis, rhs->interval(Qt::YAxis));
+ setInterval(Qt::ZAxis, rhs->interval(Qt::ZAxis));
+#endif
+}
+
+void WaterfallData::ResizeData(const double startFreq,
+ const double stopFreq,
+ const uint64_t fftPoints)
+{
+#if QWT_VERSION < 0x060000
+ if((fftPoints != GetNumFFTPoints()) ||
+ (boundingRect().width() != (stopFreq - startFreq)) ||
+ (boundingRect().left() != startFreq)){
+
+ setBoundingRect(QwtDoubleRect(startFreq, 0,
+ stopFreq-startFreq,
+ boundingRect().height()));
+ _fftPoints = fftPoints;
+ delete[] _spectrumData;
+ _spectrumData = new double[_fftPoints * _historyLength];
+ }
+
+#else
+ if((fftPoints != GetNumFFTPoints()) ||
+ (interval(Qt::XAxis).width() != (stopFreq - startFreq)) ||
+ (interval(Qt::XAxis).minValue() != startFreq)){
+
+ setInterval(Qt::XAxis, QwtInterval(startFreq, stopFreq));
+
+ _fftPoints = fftPoints;
+ delete[] _spectrumData;
+ _spectrumData = new double[_fftPoints * _historyLength];
+ }
+#endif
+
+ Reset();
+}
+
+QwtRasterData *WaterfallData::copy() const
+{
+#if QWT_VERSION < 0x060000
+ WaterfallData* returnData = new WaterfallData(boundingRect().left(),
+ boundingRect().right(),
+ _fftPoints, _historyLength);
+#else
+ WaterfallData* returnData = new WaterfallData(interval(Qt::XAxis).minValue(),
+ interval(Qt::XAxis).maxValue(),
+ _fftPoints, _historyLength);
+#endif
+
+ returnData->Copy(this);
+ return returnData;
+}
+
+
+#if QWT_VERSION < 0x060000
+QwtDoubleInterval WaterfallData::range() const
+{
+ return _intensityRange;
+}
+
+void WaterfallData::setRange(const QwtDoubleInterval& newRange)
+{
+ _intensityRange = newRange;
+}
+
+#endif
+
+
+double WaterfallData::value(double x, double y) const
+{
+ double returnValue = 0.0;
+
+#if QWT_VERSION < 0x060000
+ const unsigned int intY = static_cast<unsigned int>((1.0 - (y/boundingRect().height())) *
+ static_cast<double>(_historyLength-1));
+ const unsigned int intX = static_cast<unsigned int>((((x - boundingRect().left()) / boundingRect().width()) *
+ static_cast<double>(_fftPoints-1)) + 0.5);
+#else
+ double height = interval(Qt::YAxis).maxValue();
+ double left = interval(Qt::XAxis).minValue();
+ double right = interval(Qt::XAxis).maxValue();
+ double ylen = static_cast<double>(_historyLength-1);
+ double xlen = static_cast<double>(_fftPoints-1);
+ const unsigned int intY = static_cast<unsigned int>((1.0 - y/height) * ylen);
+ const unsigned int intX = static_cast<unsigned int>((((x - left) / (right-left)) * xlen) + 0.5);
+#endif
+
+ const int location = (intY * _fftPoints) + intX;
+ if((location > -1) && (location < static_cast<int64_t>(_fftPoints * _historyLength))){
+ returnValue = _spectrumData[location];
+ }
+
+ return returnValue;
+}
+
+uint64_t WaterfallData::GetNumFFTPoints() const
+{
+ return _fftPoints;
+}
+
+void WaterfallData::addFFTData(const double* fftData,
+ const uint64_t fftDataSize,
+ const int droppedFrames){
+ if(fftDataSize == _fftPoints){
+ int64_t heightOffset = _historyLength - 1 - droppedFrames;
+ uint64_t drawingDroppedFrames = droppedFrames;
+
+ // Any valid data rolled off the display so just fill in zeros and write new data
+ if(heightOffset < 0){
+ heightOffset = 0;
+ drawingDroppedFrames = static_cast<uint64_t>(_historyLength-1);
+ }
+
+ // Copy the old data over if any available
+ if(heightOffset > 0){
+ memmove( _spectrumData, &_spectrumData[(drawingDroppedFrames+1) * _fftPoints],
+ heightOffset * _fftPoints * sizeof(double)) ;
+ }
+
+ if(drawingDroppedFrames > 0){
+ // Fill in zeros data for dropped data
+ memset(&_spectrumData[heightOffset * _fftPoints], 0x00,
+ static_cast<int64_t>(drawingDroppedFrames) * _fftPoints * sizeof(double));
+ }
+
+ // add the new buffer
+ memcpy(&_spectrumData[(_historyLength - 1) * _fftPoints], fftData,
+ _fftPoints*sizeof(double));
+ }
+}
+
+double* WaterfallData::GetSpectrumDataBuffer() const
+{
+ return _spectrumData;
+}
+
+void WaterfallData::SetSpectrumDataBuffer(const double* newData)
+{
+ memcpy(_spectrumData, newData, _fftPoints * _historyLength * sizeof(double));
+}
+
+int WaterfallData::GetNumLinesToUpdate() const
+{
+ return _numLinesToUpdate;
+}
+
+void WaterfallData::SetNumLinesToUpdate(const int newNum)
+{
+ _numLinesToUpdate = newNum;
+}
+
+void WaterfallData::IncrementNumLinesToUpdate()
+{
+ _numLinesToUpdate++;
+}
+
+#endif /* WATERFALL_GLOBAL_DATA_CPP */
diff --git a/gr-qtgui/lib/waterfallGlobalData.h b/gr-qtgui/lib/waterfallGlobalData.h
new file mode 100644
index 000000000..928c3b175
--- /dev/null
+++ b/gr-qtgui/lib/waterfallGlobalData.h
@@ -0,0 +1,59 @@
+#ifndef WATERFALL_GLOBAL_DATA_HPP
+#define WATERFALL_GLOBAL_DATA_HPP
+
+#include <qwt_raster_data.h>
+#include <inttypes.h>
+
+#if QWT_VERSION >= 0x060000
+#include <qwt_point_3d.h> // doesn't seem necessary, but is...
+#include <qwt_compat.h>
+#endif
+
+class WaterfallData: public QwtRasterData
+{
+public:
+ WaterfallData(const double, const double, const uint64_t, const unsigned int);
+ virtual ~WaterfallData();
+
+ virtual void Reset();
+ virtual void Copy(const WaterfallData*);
+
+ virtual void ResizeData(const double, const double, const uint64_t);
+
+ virtual QwtRasterData *copy() const;
+
+#if QWT_VERSION < 0x060000
+ virtual QwtDoubleInterval range() const;
+ virtual void setRange(const QwtDoubleInterval&);
+#endif
+
+ virtual double value(double x, double y) const;
+
+ virtual uint64_t GetNumFFTPoints()const;
+ virtual void addFFTData(const double*, const uint64_t, const int);
+
+ virtual double* GetSpectrumDataBuffer()const;
+ virtual void SetSpectrumDataBuffer(const double*);
+
+ virtual int GetNumLinesToUpdate()const;
+ virtual void SetNumLinesToUpdate(const int);
+ virtual void IncrementNumLinesToUpdate();
+
+protected:
+
+ double* _spectrumData;
+ uint64_t _fftPoints;
+ uint64_t _historyLength;
+ int _numLinesToUpdate;
+
+#if QWT_VERSION < 0x060000
+ QwtDoubleInterval _intensityRange;
+#else
+ QwtInterval _intensityRange;
+#endif
+
+private:
+
+};
+
+#endif /* WATERFALL_GLOBAL_DATA_HPP */
diff --git a/gr-qtgui/python/CMakeLists.txt b/gr-qtgui/python/CMakeLists.txt
new file mode 100644
index 000000000..582285808
--- /dev/null
+++ b/gr-qtgui/python/CMakeLists.txt
@@ -0,0 +1,46 @@
+# Copyright 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.
+
+########################################################################
+include(GrPython)
+
+GR_PYTHON_INSTALL(
+ FILES __init__.py
+ DESTINATION ${GR_PYTHON_DIR}/gnuradio/qtgui
+ COMPONENT "qtgui_python"
+)
+
+########################################################################
+# Handle the unit tests
+########################################################################
+if(ENABLE_TESTING)
+
+list(APPEND GR_TEST_PYTHON_DIRS
+ ${CMAKE_BINARY_DIR}/gr-qtgui/python
+ ${CMAKE_BINARY_DIR}/gr-qtgui/swig
+)
+list(APPEND GR_TEST_TARGET_DEPS gnuradio-qtgui)
+
+include(GrTest)
+file(GLOB py_qa_test_files "qa_*.py")
+foreach(py_qa_test_file ${py_qa_test_files})
+ get_filename_component(py_qa_test_name ${py_qa_test_file} NAME_WE)
+ GR_ADD_TEST(${py_qa_test_name} ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} ${py_qa_test_file})
+endforeach(py_qa_test_file)
+endif(ENABLE_TESTING)
diff --git a/gr-qtgui/python/__init__.py b/gr-qtgui/python/__init__.py
new file mode 100644
index 000000000..c7024e4f7
--- /dev/null
+++ b/gr-qtgui/python/__init__.py
@@ -0,0 +1,30 @@
+#
+# Copyright 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 is the gr-qtgui package. This package includes QT-based graphical
+sinks.
+'''
+
+# The presence of this file turns this directory into a Python package
+
+from qtgui_swig import *
+import qtgui_swig as qtgui # to preserve the old interface
diff --git a/gr-qtgui/python/qa_qtgui.py b/gr-qtgui/python/qa_qtgui.py
new file mode 100755
index 000000000..562706701
--- /dev/null
+++ b/gr-qtgui/python/qa_qtgui.py
@@ -0,0 +1,48 @@
+#!/usr/bin/env python
+#
+# Copyright 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.
+#
+
+from gnuradio import gr, gr_unittest
+import qtgui_swig
+
+class test_qtgui(gr_unittest.TestCase):
+
+ def setUp (self):
+ self.tb = gr.top_block ()
+
+ def tearDown (self):
+ self.tb = None
+
+ def test01 (self):
+ # Test to make sure we can instantiate the sink
+ self.qtsnk = qtgui_swig.sink_c(1024, gr.firdes.WIN_BLACKMAN_hARRIS,
+ 0, 1, "Test",
+ True, True, True, True)
+
+ def test02 (self):
+ # Test to make sure we can instantiate the sink
+ self.qtsnk = qtgui_swig.sink_f(1024, gr.firdes.WIN_BLACKMAN_hARRIS,
+ 0, 1, "Test",
+ True, True, True, True)
+
+
+if __name__ == '__main__':
+ gr_unittest.run(test_qtgui, "test_qtgui.xml")
diff --git a/gr-qtgui/swig/CMakeLists.txt b/gr-qtgui/swig/CMakeLists.txt
new file mode 100644
index 000000000..a1f70240c
--- /dev/null
+++ b/gr-qtgui/swig/CMakeLists.txt
@@ -0,0 +1,57 @@
+# 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.
+
+########################################################################
+# Setup swig generation
+########################################################################
+include(GrPython)
+include(GrSwig)
+
+set(GR_SWIG_INCLUDE_DIRS
+ ${GR_QTGUI_INCLUDE_DIRS}
+ ${GNURADIO_CORE_SWIG_INCLUDE_DIRS}
+ ${GRUEL_INCLUDE_DIRS}
+ ${QWT_INCLUDE_DIRS}
+ ${QT_INCLUDE_DIRS}
+ ${Boost_INCLUDE_DIRS}
+)
+
+set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/qtgui_swig_doc.i)
+set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include)
+
+set(GR_SWIG_LIBRARIES gnuradio-qtgui)
+
+GR_SWIG_MAKE(qtgui_swig qtgui_swig.i)
+
+GR_SWIG_INSTALL(
+ TARGETS qtgui_swig
+ DESTINATION ${GR_PYTHON_DIR}/gnuradio/qtgui
+ COMPONENT "qtgui_python"
+)
+
+install(FILES
+ qtgui_swig.i
+ qtgui_sink_c.i
+ qtgui_sink_f.i
+ qtgui_time_sink_c.i
+ qtgui_time_sink_f.i
+ ${CMAKE_CURRENT_BINARY_DIR}/qtgui_swig_doc.i
+ DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig
+ COMPONENT "qtgui_swig"
+)
diff --git a/gr-qtgui/swig/__init__.py b/gr-qtgui/swig/__init__.py
new file mode 100644
index 000000000..e52e326cb
--- /dev/null
+++ b/gr-qtgui/swig/__init__.py
@@ -0,0 +1,24 @@
+#
+# Copyright 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.
+#
+
+# The presence of this file turns this directory into a Python package
+
+from qtgui_swig import *
diff --git a/gr-qtgui/swig/qtgui_sink_c.i b/gr-qtgui/swig/qtgui_sink_c.i
new file mode 100644
index 000000000..65e7d1c82
--- /dev/null
+++ b/gr-qtgui/swig/qtgui_sink_c.i
@@ -0,0 +1,66 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,2009,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.
+ */
+
+%include "gnuradio.i"
+
+%{
+#include <qtgui_sink_c.h>
+%}
+
+GR_SWIG_BLOCK_MAGIC(qtgui,sink_c)
+
+qtgui_sink_c_sptr qtgui_make_sink_c (int fftsize, int wintype,
+ double fc=0, double bw=1.0,
+ const std::string &name="Display",
+ bool plotfreq=true, bool plotwaterfall=true,
+ bool plottime=true, bool plotconst=true,
+ QWidget *parent=NULL);
+
+class qtgui_sink_c : public gr_block
+{
+private:
+ friend qtgui_sink_c_sptr qtgui_make_sink_c (int fftsize, int wintype,
+ double fc, double bw,
+ const std::string &name,
+ bool plotfreq, bool plotwaterfall,
+ bool plottime, bool plotconst,
+ QWidget *parent);
+ qtgui_sink_c (int fftsize, int wintype,
+ double fc, double bw,
+ const std::string &name,
+ bool plotfreq, bool plotwaterfall,
+ bool plottime, bool plotconst,
+ QWidget *parent);
+
+public:
+ void exec_();
+ PyObject* pyqwidget();
+
+ void set_frequency_range(const double centerfreq,
+ const double bandwidth);
+ void set_time_domain_axis(double min, double max);
+ void set_constellation_axis(double xmin, double xmax,
+ double ymin, double ymax);
+ void set_frequency_axis(double min, double max);
+ void set_constellation_pen_size(int size);
+ void set_update_time(double t);
+};
diff --git a/gr-qtgui/swig/qtgui_sink_f.i b/gr-qtgui/swig/qtgui_sink_f.i
new file mode 100644
index 000000000..b07eaa9ec
--- /dev/null
+++ b/gr-qtgui/swig/qtgui_sink_f.i
@@ -0,0 +1,66 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,2009,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.
+ */
+
+%include "gnuradio.i"
+
+%{
+#include <qtgui_sink_f.h>
+%}
+
+GR_SWIG_BLOCK_MAGIC(qtgui,sink_f)
+
+qtgui_sink_f_sptr qtgui_make_sink_f (int fftsize, int wintype,
+ double fc=0, double bw=0.0,
+ const std::string &name="Display",
+ bool plotfreq=true, bool plotwaterfall=true,
+ bool plottime=true, bool plotconst=false,
+ QWidget *parent=NULL);
+
+class qtgui_sink_f : public gr_block
+{
+private:
+ friend qtgui_sink_f_sptr qtgui_make_sink_f (int fftsize, int wintype,
+ double fc, double bw,
+ const std::string &name,
+ bool plotfreq, bool plotwaterfall,
+ bool plottime, bool plotconst,
+ QWidget *parent);
+ qtgui_sink_f (int fftsize, int wintype,
+ double fc, double bw,
+ const std::string &name,
+ bool plotfreq, bool plotwaterfall,
+ bool plottime, bool plotconst,
+ QWidget *parent);
+
+public:
+ void exec_();
+ PyObject* pyqwidget();
+
+ void set_frequency_range(const double centerfreq,
+ const double bandwidth);
+ void set_time_domain_axis(double min, double max);
+ void set_constellation_axis(double xmin, double xmax,
+ double ymin, double ymax);
+ void set_frequency_axis(double min, double max);
+ void set_constellation_pen_size(int size);
+ void set_update_time(double t);
+};
diff --git a/gr-qtgui/swig/qtgui_swig.i b/gr-qtgui/swig/qtgui_swig.i
new file mode 100644
index 000000000..0d77e22da
--- /dev/null
+++ b/gr-qtgui/swig/qtgui_swig.i
@@ -0,0 +1,38 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,2009,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.
+ */
+
+%include "gnuradio.i"
+
+//load generated python docstrings
+%include "qtgui_swig_doc.i"
+
+%{
+#include "qtgui_sink_c.h"
+#include "qtgui_sink_f.h"
+#include "qtgui_time_sink_c.h"
+#include "qtgui_time_sink_f.h"
+%}
+
+%include "qtgui_sink_c.i"
+%include "qtgui_sink_f.i"
+%include "qtgui_time_sink_c.i"
+%include "qtgui_time_sink_f.i"
diff --git a/gr-qtgui/swig/qtgui_time_sink_c.i b/gr-qtgui/swig/qtgui_time_sink_c.i
new file mode 100644
index 000000000..b78ca5386
--- /dev/null
+++ b/gr-qtgui/swig/qtgui_time_sink_c.i
@@ -0,0 +1,56 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+%include "gnuradio.i"
+
+%{
+#include <qtgui_time_sink_c.h>
+%}
+
+GR_SWIG_BLOCK_MAGIC(qtgui,time_sink_c)
+
+qtgui_time_sink_c_sptr qtgui_make_time_sink_c(int size, double bw,
+ const std::string &name,
+ int nconnections=1,
+ QWidget *parent=NULL);
+
+class qtgui_time_sink_c : public gr_sync_block
+{
+private:
+ friend qtgui_time_sink_c_sptr qtgui_make_time_sink_c(int size, double bw,
+ const std::string &name,
+ int nconnections,
+ QWidget *parent);
+ qtgui_time_sink_c(int size, double bw,
+ const std::string &name,
+ int nconnections,
+ QWidget *parent=NULL);
+
+public:
+ void exec_();
+ PyObject* pyqwidget();
+
+ void set_time_domain_axis(double min, double max);
+ void set_update_time(double t);
+ void set_title(int which, const std::string &title);
+ void set_color(int which, const std::string &color);
+};
diff --git a/gr-qtgui/swig/qtgui_time_sink_f.i b/gr-qtgui/swig/qtgui_time_sink_f.i
new file mode 100644
index 000000000..9d59f9364
--- /dev/null
+++ b/gr-qtgui/swig/qtgui_time_sink_f.i
@@ -0,0 +1,56 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+%include "gnuradio.i"
+
+%{
+#include <qtgui_time_sink_f.h>
+%}
+
+GR_SWIG_BLOCK_MAGIC(qtgui,time_sink_f)
+
+qtgui_time_sink_f_sptr qtgui_make_time_sink_f(int size, double bw,
+ const std::string &name,
+ int nconnections=1,
+ QWidget *parent=NULL);
+
+class qtgui_time_sink_f : public gr_sync_block
+{
+private:
+ friend qtgui_time_sink_f_sptr qtgui_make_time_sink_f(int size, double bw,
+ const std::string &name,
+ int nconnections,
+ QWidget *parent);
+ qtgui_time_sink_f(int size, double bw,
+ const std::string &name,
+ int nconnections,
+ QWidget *parent=NULL);
+
+public:
+ void exec_();
+ PyObject* pyqwidget();
+
+ void set_time_domain_axis(double min, double max);
+ void set_update_time(double t);
+ void set_title(int which, const std::string &title);
+ void set_color(int which, const std::string &color);
+};
diff --git a/gr-scigen/CMakeLists.txt b/gr-scigen/CMakeLists.txt
new file mode 100644
index 000000000..7eed748c0
--- /dev/null
+++ b/gr-scigen/CMakeLists.txt
@@ -0,0 +1,55 @@
+# 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.
+
+########################################################################
+# Setup dependencies
+########################################################################
+#include(GrBoost)
+
+#find_package(SCIGENW3f)
+
+########################################################################
+# Register component
+########################################################################
+include(GrComponent)
+
+GR_REGISTER_COMPONENT("gr-scigen" ENABLE_GR_SCIGEN
+ ENABLE_GRUEL
+ ENABLE_VOLK
+ Boost_FOUND
+ ENABLE_GR_CORE
+)
+
+########################################################################
+# Begin conditional configuration
+########################################################################
+if(ENABLE_GR_SCIGEN)
+
+########################################################################
+# Add subdirectories
+########################################################################
+if(ENABLE_PYTHON)
+ add_subdirectory(python)
+ add_subdirectory(grc)
+endif(ENABLE_PYTHON)
+#add_subdirectory(examples)
+add_subdirectory(doc)
+
+
+endif(ENABLE_GR_SCIGEN)
diff --git a/gr-scigen/doc/CMakeLists.txt b/gr-scigen/doc/CMakeLists.txt
new file mode 100644
index 000000000..80ce59153
--- /dev/null
+++ b/gr-scigen/doc/CMakeLists.txt
@@ -0,0 +1,23 @@
+# 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.
+
+install(
+ FILES README.scigen
+ DESTINATION ${GR_PKG_DOC_DIR}
+)
diff --git a/gr-scigen/doc/README.scigen b/gr-scigen/doc/README.scigen
new file mode 100644
index 000000000..61e8f6bf8
--- /dev/null
+++ b/gr-scigen/doc/README.scigen
@@ -0,0 +1,13 @@
+This is the gr-scigen package. It contains signal processing blocks to
+perform FFTs and FFT-related functionality.
+
+The Python namespace is in gnuradio.scigen, which would be normally
+imported as:
+
+ from gnuradio import scigen
+
+See the Doxygen documentation for details about the blocks available
+in this package. A quick listing of the details can be found in Python
+after importing by using:
+
+ help(scigen)
diff --git a/gr-scigen/doc/scigen.dox b/gr-scigen/doc/scigen.dox
new file mode 100644
index 000000000..8843d0560
--- /dev/null
+++ b/gr-scigen/doc/scigen.dox
@@ -0,0 +1,29 @@
+/*! \page page_fft FFT Signal Processing Blocks
+
+\section Introduction
+
+This is the gr-scigen package. It contains signal processing blocks to
+perform FFTs and FFT-related functionality.
+
+The Python namespace is in gnuradio.fft, which would be normally
+imported as:
+
+\code
+ from gnuradio import scigen
+\endcode
+
+See the Doxygen documentation for details about the blocks available
+in this package. A quick listing of the details can be found in Python
+after importing by using:
+
+\code
+ help(scigen)
+\endcode
+
+\section Dependencies
+
+The scigen blocks require the following dependencies.
+
+\li fftw3f (>= 3.0) http://www.fftw.org/download.html
+
+*/
diff --git a/gr-scigen/grc/CMakeLists.txt b/gr-scigen/grc/CMakeLists.txt
new file mode 100644
index 000000000..ca8f65d18
--- /dev/null
+++ b/gr-scigen/grc/CMakeLists.txt
@@ -0,0 +1,24 @@
+# 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.
+
+install(FILES
+ scigen.xml
+ DESTINATION ${GRC_BLOCKS_DIR}
+ COMPONENT "scigen_python"
+)
diff --git a/gr-scigen/grc/scigen.xml b/gr-scigen/grc/scigen.xml
new file mode 100644
index 000000000..d8c7a25bf
--- /dev/null
+++ b/gr-scigen/grc/scigen.xml
@@ -0,0 +1,82 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Add Block:
+## all types, 1 output, 2 to inf inputs
+###################################################
+ -->
+<block>
+ <name>generic</name>
+ <key>scigen_generic</key>
+ <category>scigen</category>
+
+ <import>import scigen</import>
+ <make>scigen.generic()
+self.$(id).set_parameters($func_name, $window)
+ </make>
+ <param>
+ <name>IO Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option><name>FC32_FC32</name><key>fc32_fc32</key></option>
+ <option><name>F32_F32</name><key>f32_f32</key></option>
+ <option><name>SC32_SC32</name><key>sc32_sc32</key></option>
+ <option><name>S32_S32</name><key>s32_s32</key></option>
+ <option><name>SC16_SC16</name><key>sc16_sc16</key></option>
+ <option><name>S16_S16</name><key>s16_s16</key></option>
+ <option><name>SC8_SC8</name><key>sc8_sc8</key></option>
+ <option><name>S8_S8</name><key>s8_s8</key></option>
+ </param>
+ <param>
+ <name>Num Inputs</name>
+ <key>num_inputs</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+
+ <param>
+ <name>Window</name>
+ <key>window</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+
+ <param>
+ <name>Function Name</name>
+ <key>func_name</key>
+ <value>""</value>
+ <type>string</type>
+ </param>
+
+
+ <!--
+ Check if number of inputs are greater than 0, and if vector length
+ is greater than 0.
+ -->
+ <check>$num_inputs &gt; 0</check>
+ <check>$vlen &gt; 0</check>
+ <sink>
+ <name>in</name>
+ <type>$(str($type).split('_')[0])</type>
+ <vlen>$vlen</vlen>
+ <nports>$num_inputs</nports>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$(str($type).split('_')[1])</type>
+ <vlen>$vlen</vlen>
+ </source>
+ <doc>
+Scilab Generic Block
+
+> Check if your scilab function requires multiple inputs
+> Make sure you have same n_input_items when you have multiple inputs
+ </doc>
+</block>
diff --git a/gr-scigen/python/CMakeLists.txt b/gr-scigen/python/CMakeLists.txt
new file mode 100644
index 000000000..74d9a6bae
--- /dev/null
+++ b/gr-scigen/python/CMakeLists.txt
@@ -0,0 +1,46 @@
+# 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.
+
+########################################################################
+include(GrPython)
+
+GR_PYTHON_INSTALL(
+ FILES
+ __init__.py
+ DESTINATION ${GR_PYTHON_DIR}/gnuradio/scigen
+ COMPONENT "scigen_python"
+)
+
+########################################################################
+# Handle the unit tests
+########################################################################
+if(ENABLE_TESTING)
+
+list(APPEND GR_TEST_PYTHON_DIRS
+ ${CMAKE_BINARY_DIR}/gr-scigen/python
+)
+list(APPEND GR_TEST_TARGET_DEPS gnuradio-scigen)
+
+include(GrTest)
+file(GLOB py_qa_test_files "qa_*.py")
+foreach(py_qa_test_file ${py_qa_test_files})
+ get_filename_component(py_qa_test_name ${py_qa_test_file} NAME_WE)
+ GR_ADD_TEST(${py_qa_test_name} ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} ${py_qa_test_file})
+endforeach(py_qa_test_file)
+endif(ENABLE_TESTING)
diff --git a/gr-scigen/python/__init__.py b/gr-scigen/python/__init__.py
new file mode 100644
index 000000000..11a291ae4
--- /dev/null
+++ b/gr-scigen/python/__init__.py
@@ -0,0 +1,52 @@
+#
+# Copyright 2008,2009 Free Software Foundation, Inc.
+#
+# This application 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.
+#
+# This application 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 this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+
+# The presence of this file turns this directory into a Python package
+
+'''
+This is the GNU Radio SCIGEN module. Place your Python package
+description here (python/__init__.py).
+'''
+
+# ----------------------------------------------------------------
+# Temporary workaround for ticket:181 (swig+python problem)
+import sys
+_RTLD_GLOBAL = 0
+try:
+ from dl import RTLD_GLOBAL as _RTLD_GLOBAL
+except ImportError:
+ try:
+ from DLFCN import RTLD_GLOBAL as _RTLD_GLOBAL
+ except ImportError:
+ pass
+
+if _RTLD_GLOBAL != 0:
+ _dlopenflags = sys.getdlopenflags()
+ sys.setdlopenflags(_dlopenflags|_RTLD_GLOBAL)
+# ----------------------------------------------------------------
+
+
+# import any pure python here
+from generic import *
+#
+
+# ----------------------------------------------------------------
+# Tail of workaround
+if _RTLD_GLOBAL != 0:
+ sys.setdlopenflags(_dlopenflags) # Restore original flags
+# ----------------------------------------------------------------
diff --git a/gr-scigen/python/generic.py b/gr-scigen/python/generic.py
new file mode 100644
index 000000000..f7807fdbc
--- /dev/null
+++ b/gr-scigen/python/generic.py
@@ -0,0 +1,66 @@
+import gras
+import numpy
+
+class generic(gras.Block):
+
+ def __init__(self):
+ gras.Block.__init__(self,
+ name="generic",
+ in_sig=[numpy.float32],
+ out_sig=[numpy.float32])
+
+ def set_parameters(self,func_name,window):
+ self.n = window
+ self.func_name = func_name
+
+ # Check if value of window is integral of length of input source vector
+ # For cases like -> input = [3 , 4, 5 ,6] & window = 3
+ def isIntegralWin(self, input_item, window):
+ if (len(input_item) % window ):
+ raise Exception("Value of Window should be an integral value of length of input items")
+
+
+ def work(self, input_items, output_items):
+
+ # Limit output_items to just the size of window
+ output_items[0] = output_items[0][:self.n]
+ from scilab import Scilab
+ Sci = Scilab()
+
+ # Check number of input_instances
+ n_input_items = len(input_items)
+
+ # Create output string instance which will be evaluated
+ out_eval_string = 'eval("Sci.'+self.func_name+'('
+
+ # Iterate for n_input_items
+ for i in range(n_input_items):
+
+ # Check window condition
+ self.isIntegralWin(input_items[i][:], self.n)
+
+ # If the window is greater than 1, input_items[i][:self.n] looks like [1 2 3 4 5] which is err for python since it requires comma as delimiters
+ if self.n == 1:
+ out_eval_string = out_eval_string + str(input_items[i][:self.n]) + ","
+ else:
+ print 'IN',str(input_items[i][:self.n])
+ out_eval_string = out_eval_string + (str(input_items[i][:self.n].tolist())) + "," # Replace 10spaces with a singe comma
+
+ out_eval_string = out_eval_string.rstrip(",") + ')")'
+ print "STRING ",str(out_eval_string)
+
+ # for functions like sin
+ if n_input_items == 1 and self.n == 1:
+ output_items[0][:self.n] = eval(out_eval_string)
+ else:
+ output_items[0] = eval(out_eval_string)
+
+ print "OUT",output_items[0]
+ #print 'SIZE,', output_items[0].size
+
+ #Write a for loop for n_inputs
+ for i in range(n_input_items):
+ self.consume(i,self.n) # Consume from port 0 input_items
+
+ self.produce(0,self.n) # Produce from port 0 output_items
+
diff --git a/gr-scigen/python/qa_scigen.py b/gr-scigen/python/qa_scigen.py
new file mode 100755
index 000000000..f06dc8b5d
--- /dev/null
+++ b/gr-scigen/python/qa_scigen.py
@@ -0,0 +1,58 @@
+#!/usr/bin/env python
+#
+# Copyright 2013 <+YOU OR YOUR COMPANY+>.
+#
+# This 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.
+#
+# This software 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 this software; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+#
+
+from gnuradio import gr, gr_unittest
+#import mymod_swig as mymod
+from generic import *
+
+
+class qa_generic (gr_unittest.TestCase):
+
+ def setUp (self):
+ self.tb = gr.top_block ()
+
+ def tearDown (self):
+ self.tb = None
+
+ def test_001_t (self):
+
+ src0 = numpy.arange(0,3.1416,1)
+
+ src0 = gr.vector_source_f(src0)
+ expected_result = (0.0, 0.8414709568023682, 0.9092974066734314, 0.14112000167369843)
+
+ sqr = generic()
+ sqr.set_parameters("sin",1)
+
+ dst = gr.vector_sink_f()
+
+ self.tb.connect(src0, (sqr,0)) # src0(vector_source) -> sqr_input_0
+ self.tb.connect(sqr,dst) # sqr_output_0 -> dst (vector_source)
+
+ self.tb.run()
+
+ result_data = dst.data()
+ print result_data, "Result data"
+
+ self.assertFloatTuplesAlmostEqual(expected_result, result_data, 6)
+
+
+if __name__ == '__main__':
+ gr_unittest.main()
diff --git a/gr-scigen/python/scigen.py b/gr-scigen/python/scigen.py
new file mode 100644
index 000000000..ca5556bc8
--- /dev/null
+++ b/gr-scigen/python/scigen.py
@@ -0,0 +1 @@
+from generic import *
diff --git a/gr-utils/CMakeLists.txt b/gr-utils/CMakeLists.txt
new file mode 100644
index 000000000..50ec7e86c
--- /dev/null
+++ b/gr-utils/CMakeLists.txt
@@ -0,0 +1,54 @@
+# Copyright 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.
+
+########################################################################
+# Setup dependencies
+########################################################################
+
+########################################################################
+# Register component
+########################################################################
+include(GrComponent)
+GR_REGISTER_COMPONENT("gr-utils" ENABLE_GR_UTILS
+ ENABLE_GR_CORE
+ ENABLE_PYTHON
+)
+
+########################################################################
+# Begin conditional configuration
+########################################################################
+if(ENABLE_GR_UTILS)
+
+########################################################################
+# Setup CPack components
+########################################################################
+include(GrPackage)
+CPACK_COMPONENT("utils"
+ DISPLAY_NAME "Utils"
+ DESCRIPTION "Misc gnuradio python utilities"
+ DEPENDS "core_python"
+)
+
+########################################################################
+# Add subdirectories
+########################################################################
+add_subdirectory(src/python)
+
+
+endif(ENABLE_GR_UTILS)
diff --git a/gr-utils/src/python/CMakeLists.txt b/gr-utils/src/python/CMakeLists.txt
new file mode 100644
index 000000000..ef4e66d13
--- /dev/null
+++ b/gr-utils/src/python/CMakeLists.txt
@@ -0,0 +1,59 @@
+# Copyright 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.
+
+########################################################################
+# Install python files and apps
+########################################################################
+include(GrPython)
+
+GR_PYTHON_INSTALL(
+ FILES
+ plot_data.py
+ plot_fft_base.py
+ plot_psd_base.py
+ pyqt_plot.py
+ pyqt_filter.py
+ DESTINATION ${GR_PYTHON_DIR}/gnuradio
+ COMPONENT "utils"
+)
+
+GR_PYTHON_INSTALL(
+ PROGRAMS
+ gr_modtool
+ gr_plot_char
+ gr_plot_const
+ gr_plot_fft
+ gr_plot_fft_c
+ gr_plot_fft_f
+ gr_plot_psd
+ gr_plot_psd_c
+ gr_plot_psd_f
+ gr_plot_float
+ gr_plot_int
+ gr_plot_iq
+ gr_plot_short
+ gr_plot_qt
+ gr_filter_design
+ gr_read_file_metadata
+ grcc
+ DESTINATION ${GR_RUNTIME_DIR}
+ COMPONENT "utils"
+)
+
+add_subdirectory(modtool)
diff --git a/gr-utils/src/python/README.plot b/gr-utils/src/python/README.plot
new file mode 100644
index 000000000..60f14c669
--- /dev/null
+++ b/gr-utils/src/python/README.plot
@@ -0,0 +1,97 @@
+* gr_plot_*:
+These are a collection of Python scripts to enable viewing and
+analysis of files produced by GNU Radio flow graphs. Most of them work
+off complex data produced by digital waveforms.
+
+
+** gr_plot_float:
+Takes a GNU Radio floating point binary file and displays the samples
+versus time. You can set the block size to specify how many points to
+read in at a time and the start position in the file.
+
+By default, the system assumes a sample rate of 1, so in time, each
+sample is plotted versus the sample number. To set a true time axis,
+set the sample rate (-R or --sample-rate) to the sample rate used when
+capturing the samples.
+
+
+
+** gr_plot_iq:
+Takes a GNU Radio complex binary file and displays the I&Q data versus
+time. You can set the block size to specify how many points to read in
+at a time and the start position in the file.
+
+By default, the system assumes a sample rate of 1, so in time, each
+sample is plotted versus the sample number. To set a true time axis,
+set the sample rate (-R or --sample-rate) to the sample rate used when
+capturing the samples.
+
+
+
+** gr_plot_const:
+Takes a GNU Radio complex binary file and displays the I&Q data versus
+time and the constellation plot (I vs. Q). You can set the block size
+to specify how many points to read in at a time and the start position
+in the file.
+
+By default, the system assumes a sample rate of 1, so in time, each
+sample is plotted versus the sample number. To set a true time axis,
+set the sample rate (-R or --sample-rate) to the sample rate used when
+capturing the samples.
+
+
+
+** gr_plot_fft_c:
+Takes a GNU Radio complex binary file and displays the I&Q data versus
+time as well as the frequency domain (FFT) plot. The y-axis values are
+plotted assuming volts as the amplitude of the I&Q streams and
+converted into dBm in the frequency domain (the 1/N power adjustment
+out of the FFT is performed internally).
+
+The script plots a certain block of data at a time, specified on the
+command line as -B or --block. This value defaults to 1000. The start
+position in the file can be set by specifying -s or --start and
+defaults to 0 (the start of the file).
+
+By default, the system assumes a sample rate of 1, so in time, each
+sample is plotted versus the sample number. To set a true time and
+frequency axis, set the sample rate (-R or --sample-rate) to the
+sample rate used when capturing the samples.
+
+
+
+** gr_plot_fft_f:
+Takes a GNU Radio floating point binary file and displays the samples
+versus time as well as the frequency domain (FFT) plot. The y-axis
+values are plotted assuming volts as the amplitude of the I&Q streams
+and converted into dBm in the frequency domain (the 1/N power
+adjustment out of the FFT is performed internally).
+
+The script plots a certain block of data at a time, specified on the
+command line as -B or --block. This value defaults to 1000. The start
+position in the file can be set by specifying -s or --start and
+defaults to 0 (the start of the file).
+
+By default, the system assumes a sample rate of 1, so in time, each
+sample is plotted versus the sample number. To set a true time and
+frequency axis, set the sample rate (-R or --sample-rate) to the
+sample rate used when capturing the samples.
+
+
+** gr_plot_fft:
+Takes a GNU Radio binary file (the datatype is specified using the -d
+option and defaults to complex64) and displays the samples versus time
+as well as the frequency domain (FFT) plot. The y-axis values are
+plotted assuming volts as the amplitude of the I&Q streams and
+converted into dBm in the frequency domain (the 1/N power adjustment
+out of the FFT is performed internally).
+
+The script plots a certain block of data at a time, specified on the
+command line as -B or --block. This value defaults to 1000. The start
+position in the file can be set by specifying -s or --start and
+defaults to 0 (the start of the file).
+
+By default, the system assumes a sample rate of 1, so in time, each
+sample is plotted versus the sample number. To set a true time and
+frequency axis, set the sample rate (-R or --sample-rate) to the
+sample rate used when capturing the samples.
diff --git a/gr-utils/src/python/gr_filter_design b/gr-utils/src/python/gr_filter_design
new file mode 100755
index 000000000..cc21ea5e7
--- /dev/null
+++ b/gr-utils/src/python/gr_filter_design
@@ -0,0 +1,874 @@
+#!/usr/bin/env python
+
+import sys, os, re, csv
+from optparse import OptionParser
+from gnuradio import gr, blks2, eng_notation
+
+try:
+ import scipy
+ from scipy import fftpack
+except ImportError:
+ print "Please install SciPy to run this script (http://www.scipy.org/)"
+ raise SystemExit, 1
+
+try:
+ from PyQt4 import Qt, QtCore, QtGui
+except ImportError:
+ print "Please install PyQt4 to run this script (http://www.riverbankcomputing.co.uk/software/pyqt/download)"
+ raise SystemExit, 1
+
+try:
+ import PyQt4.Qwt5 as Qwt
+except ImportError:
+ print "Please install PyQwt5 to run this script (http://pyqwt.sourceforge.net/)"
+ raise SystemExit, 1
+
+try:
+ from gnuradio.pyqt_filter import Ui_MainWindow
+except ImportError:
+ print "Could not import from pyqt_filter. Please build with \"pyuic4 pyqt_filter.ui -o pyqt_filter.py\""
+ raise SystemExit, 1
+
+
+class gr_plot_filter(QtGui.QMainWindow):
+ def __init__(self, qapp, options):
+ QtGui.QWidget.__init__(self, None)
+ self.gui = Ui_MainWindow()
+ self.gui.setupUi(self)
+
+ self.connect(self.gui.action_save,
+ Qt.SIGNAL("activated()"),
+ self.action_save_dialog)
+ self.connect(self.gui.action_open,
+ Qt.SIGNAL("activated()"),
+ self.action_open_dialog)
+
+
+ self.connect(self.gui.filterTypeComboBox,
+ Qt.SIGNAL("currentIndexChanged(const QString&)"),
+ self.changed_filter_type)
+ self.connect(self.gui.filterDesignTypeComboBox,
+ Qt.SIGNAL("currentIndexChanged(const QString&)"),
+ self.changed_filter_design_type)
+
+ self.connect(self.gui.designButton,
+ Qt.SIGNAL("released()"),
+ self.design)
+
+ self.connect(self.gui.tabGroup,
+ Qt.SIGNAL("currentChanged(int)"),
+ self.tab_changed)
+
+ self.connect(self.gui.nfftEdit,
+ Qt.SIGNAL("textEdited(QString)"),
+ self.nfft_edit_changed)
+
+ self.gui.designButton.setShortcut(QtCore.Qt.Key_Return)
+
+ self.taps = []
+ self.fftdB = []
+ self.fftDeg = []
+ self.groupDelay = []
+ self.nfftpts = int(10000)
+ self.gui.nfftEdit.setText(Qt.QString("%1").arg(self.nfftpts))
+
+ self.firFilters = ("Low Pass", "Band Pass", "Complex Band Pass", "Band Notch",
+ "High Pass", "Root Raised Cosine", "Gaussian")
+ self.optFilters = ("Low Pass", "Band Pass", "Complex Band Pass",
+ "Band Notch", "High Pass")
+
+ self.set_windowed()
+
+ # Initialize to LPF
+ self.gui.filterTypeWidget.setCurrentWidget(self.gui.firlpfPage)
+
+ # Set Axis labels
+ self.gui.freqPlot.setAxisTitle(self.gui.freqPlot.xBottom,
+ "Frequency (Hz)")
+ self.gui.freqPlot.setAxisTitle(self.gui.freqPlot.yLeft,
+ "Magnitude (dB)")
+ self.gui.timePlot.setAxisTitle(self.gui.timePlot.xBottom,
+ "Tap number")
+ self.gui.timePlot.setAxisTitle(self.gui.timePlot.yLeft,
+ "Amplitude")
+ self.gui.phasePlot.setAxisTitle(self.gui.phasePlot.xBottom,
+ "Frequency (Hz)")
+ self.gui.phasePlot.setAxisTitle(self.gui.phasePlot.yLeft,
+ "Phase (Radians)")
+ self.gui.groupPlot.setAxisTitle(self.gui.groupPlot.xBottom,
+ "Frequency (Hz)")
+ self.gui.groupPlot.setAxisTitle(self.gui.groupPlot.yLeft,
+ "Delay (sec)")
+
+ # Set up plot curves
+ self.rcurve = Qwt.QwtPlotCurve("Real")
+ self.rcurve.attach(self.gui.timePlot)
+ self.icurve = Qwt.QwtPlotCurve("Imag")
+ self.icurve.attach(self.gui.timePlot)
+
+ self.freqcurve = Qwt.QwtPlotCurve("PSD")
+ self.freqcurve.attach(self.gui.freqPlot)
+
+ self.phasecurve = Qwt.QwtPlotCurve("Phase")
+ self.phasecurve.attach(self.gui.phasePlot)
+
+ self.groupcurve = Qwt.QwtPlotCurve("Group Delay")
+ self.groupcurve.attach(self.gui.groupPlot)
+
+ # Create zoom functionality for the plots
+ self.timeZoomer = Qwt.QwtPlotZoomer(self.gui.timePlot.xBottom,
+ self.gui.timePlot.yLeft,
+ Qwt.QwtPicker.PointSelection,
+ Qwt.QwtPicker.AlwaysOn,
+ self.gui.timePlot.canvas())
+
+ self.freqZoomer = Qwt.QwtPlotZoomer(self.gui.freqPlot.xBottom,
+ self.gui.freqPlot.yLeft,
+ Qwt.QwtPicker.PointSelection,
+ Qwt.QwtPicker.AlwaysOn,
+ self.gui.freqPlot.canvas())
+
+ self.phaseZoomer = Qwt.QwtPlotZoomer(self.gui.phasePlot.xBottom,
+ self.gui.phasePlot.yLeft,
+ Qwt.QwtPicker.PointSelection,
+ Qwt.QwtPicker.AlwaysOn,
+ self.gui.phasePlot.canvas())
+
+ self.groupZoomer = Qwt.QwtPlotZoomer(self.gui.groupPlot.xBottom,
+ self.gui.groupPlot.yLeft,
+ Qwt.QwtPicker.PointSelection,
+ Qwt.QwtPicker.AlwaysOn,
+ self.gui.groupPlot.canvas())
+
+ # Set up pen for colors and line width
+ blue = QtGui.qRgb(0x00, 0x00, 0xFF)
+ blueBrush = Qt.QBrush(Qt.QColor(blue))
+ red = QtGui.qRgb(0xFF, 0x00, 0x00)
+ redBrush = Qt.QBrush(Qt.QColor(red))
+ self.freqcurve.setPen(Qt.QPen(blueBrush, 2))
+ self.rcurve.setPen(Qt.QPen(blueBrush, 2))
+ self.icurve.setPen(Qt.QPen(redBrush, 2))
+ self.phasecurve.setPen(Qt.QPen(blueBrush, 2))
+ self.groupcurve.setPen(Qt.QPen(blueBrush, 2))
+
+ # Set up validators for edit boxes
+ self.intVal = Qt.QIntValidator(None)
+ self.dblVal = Qt.QDoubleValidator(None)
+ self.gui.nfftEdit.setValidator(self.intVal)
+ self.gui.sampleRateEdit.setValidator(self.dblVal)
+ self.gui.filterGainEdit.setValidator(self.dblVal)
+ self.gui.endofLpfPassBandEdit.setValidator(self.dblVal)
+ self.gui.startofLpfStopBandEdit.setValidator(self.dblVal)
+ self.gui.lpfStopBandAttenEdit.setValidator(self.dblVal)
+ self.gui.lpfPassBandRippleEdit.setValidator(self.dblVal)
+ self.gui.startofBpfPassBandEdit.setValidator(self.dblVal)
+ self.gui.endofBpfPassBandEdit.setValidator(self.dblVal)
+ self.gui.bpfTransitionEdit.setValidator(self.dblVal)
+ self.gui.bpfStopBandAttenEdit.setValidator(self.dblVal)
+ self.gui.bpfPassBandRippleEdit.setValidator(self.dblVal)
+ self.gui.startofBnfStopBandEdit.setValidator(self.dblVal)
+ self.gui.endofBnfStopBandEdit.setValidator(self.dblVal)
+ self.gui.bnfTransitionEdit.setValidator(self.dblVal)
+ self.gui.bnfStopBandAttenEdit.setValidator(self.dblVal)
+ self.gui.bnfPassBandRippleEdit.setValidator(self.dblVal)
+ self.gui.endofHpfStopBandEdit.setValidator(self.dblVal)
+ self.gui.startofHpfPassBandEdit.setValidator(self.dblVal)
+ self.gui.hpfStopBandAttenEdit.setValidator(self.dblVal)
+ self.gui.hpfPassBandRippleEdit.setValidator(self.dblVal)
+ self.gui.rrcSymbolRateEdit.setValidator(self.dblVal)
+ self.gui.rrcAlphaEdit.setValidator(self.dblVal)
+ self.gui.rrcNumTapsEdit.setValidator(self.dblVal)
+ self.gui.gausSymbolRateEdit.setValidator(self.dblVal)
+ self.gui.gausBTEdit.setValidator(self.dblVal)
+ self.gui.gausNumTapsEdit.setValidator(self.dblVal)
+
+ self.gui.nTapsEdit.setText("0")
+
+ self.filterWindows = {"Hamming Window" : gr.firdes.WIN_HAMMING,
+ "Hann Window" : gr.firdes.WIN_HANN,
+ "Blackman Window" : gr.firdes.WIN_BLACKMAN,
+ "Rectangular Window" : gr.firdes.WIN_RECTANGULAR,
+ "Kaiser Window" : gr.firdes.WIN_KAISER,
+ "Blackman-harris Window" : gr.firdes.WIN_BLACKMAN_hARRIS}
+ self.EQUIRIPPLE_FILT = 6 # const for equiripple filter window types
+ self.show()
+
+ def changed_filter_type(self, ftype):
+ strftype = str(ftype.toAscii())
+ if(ftype == "Low Pass"):
+ self.gui.filterTypeWidget.setCurrentWidget(self.gui.firlpfPage)
+ elif(ftype == "Band Pass"):
+ self.gui.filterTypeWidget.setCurrentWidget(self.gui.firbpfPage)
+ elif(ftype == "Complex Band Pass"):
+ self.gui.filterTypeWidget.setCurrentWidget(self.gui.firbpfPage)
+ elif(ftype == "Band Notch"):
+ self.gui.filterTypeWidget.setCurrentWidget(self.gui.firbnfPage)
+ elif(ftype == "High Pass"):
+ self.gui.filterTypeWidget.setCurrentWidget(self.gui.firhpfPage)
+ elif(ftype == "Root Raised Cosine"):
+ self.gui.filterTypeWidget.setCurrentWidget(self.gui.rrcPage)
+ elif(ftype == "Gaussian"):
+ self.gui.filterTypeWidget.setCurrentWidget(self.gui.gausPage)
+
+ self.design()
+
+ def changed_filter_design_type(self, design):
+ if(design == "Equiripple"):
+ self.set_equiripple()
+ else:
+ self.set_windowed()
+
+ self.design()
+
+ def set_equiripple(self):
+ # Stop sending the signal for this function
+ self.gui.filterTypeComboBox.blockSignals(True)
+
+ self.equiripple = True
+ self.gui.lpfPassBandRippleLabel.setVisible(True)
+ self.gui.lpfPassBandRippleEdit.setVisible(True)
+ self.gui.bpfPassBandRippleLabel.setVisible(True)
+ self.gui.bpfPassBandRippleEdit.setVisible(True)
+ self.gui.bnfPassBandRippleLabel.setVisible(True)
+ self.gui.bnfPassBandRippleEdit.setVisible(True)
+ self.gui.hpfPassBandRippleLabel.setVisible(True)
+ self.gui.hpfPassBandRippleEdit.setVisible(True)
+
+ # Save current type and repopulate the combo box for
+ # filters this window type can handle
+ currenttype = self.gui.filterTypeComboBox.currentText()
+ items = self.gui.filterTypeComboBox.count()
+ for i in xrange(items):
+ self.gui.filterTypeComboBox.removeItem(0)
+ self.gui.filterTypeComboBox.addItems(self.optFilters)
+
+ # If the last filter type was valid for this window type,
+ # go back to it; otherwise, reset
+ try:
+ index = self.optFilters.index(currenttype)
+ self.gui.filterTypeComboBox.setCurrentIndex(index)
+ except ValueError:
+ pass
+
+ # Tell gui its ok to start sending this signal again
+ self.gui.filterTypeComboBox.blockSignals(False)
+
+ def set_windowed(self):
+ # Stop sending the signal for this function
+ self.gui.filterTypeComboBox.blockSignals(True)
+
+ self.equiripple = False
+ self.gui.lpfPassBandRippleLabel.setVisible(False)
+ self.gui.lpfPassBandRippleEdit.setVisible(False)
+ self.gui.bpfPassBandRippleLabel.setVisible(False)
+ self.gui.bpfPassBandRippleEdit.setVisible(False)
+ self.gui.bnfPassBandRippleLabel.setVisible(False)
+ self.gui.bnfPassBandRippleEdit.setVisible(False)
+ self.gui.hpfPassBandRippleLabel.setVisible(False)
+ self.gui.hpfPassBandRippleEdit.setVisible(False)
+
+ # Save current type and repopulate the combo box for
+ # filters this window type can handle
+ currenttype = self.gui.filterTypeComboBox.currentText()
+ items = self.gui.filterTypeComboBox.count()
+ for i in xrange(items):
+ self.gui.filterTypeComboBox.removeItem(0)
+ self.gui.filterTypeComboBox.addItems(self.firFilters)
+
+ # If the last filter type was valid for this window type,
+ # go back to it; otherwise, reset
+ try:
+ index = self.optFilters.index(currenttype)
+ self.gui.filterTypeComboBox.setCurrentIndex(index)
+ except ValueError:
+ pass
+
+ # Tell gui its ok to start sending this signal again
+ self.gui.filterTypeComboBox.blockSignals(False)
+
+ def design(self):
+ ret = True
+ fs,r = self.gui.sampleRateEdit.text().toDouble()
+ ret = r and ret
+ gain,r = self.gui.filterGainEdit.text().toDouble()
+ ret = r and ret
+
+ if(ret):
+ winstr = str(self.gui.filterDesignTypeComboBox.currentText().toAscii())
+ ftype = str(self.gui.filterTypeComboBox.currentText().toAscii())
+
+ if(winstr == "Equiripple"):
+ designer = {"Low Pass" : self.design_opt_lpf,
+ "Band Pass" : self.design_opt_bpf,
+ "Complex Band Pass" : self.design_opt_cbpf,
+ "Band Notch" : self.design_opt_bnf,
+ "High Pass" : self.design_opt_hpf}
+ taps,params,r = designer[ftype](fs, gain)
+
+ else:
+ designer = {"Low Pass" : self.design_win_lpf,
+ "Band Pass" : self.design_win_bpf,
+ "Complex Band Pass" : self.design_win_cbpf,
+ "Band Notch" : self.design_win_bnf,
+ "High Pass" : self.design_win_hpf,
+ "Root Raised Cosine" : self.design_win_rrc,
+ "Gaussian" : self.design_win_gaus}
+ wintype = self.filterWindows[winstr]
+ taps,params,r = designer[ftype](fs, gain, wintype)
+
+ if(r):
+ self.draw_plots(taps, params)
+
+
+ # Filter design functions using a window
+ def design_win_lpf(self, fs, gain, wintype):
+ ret = True
+ pb,r = self.gui.endofLpfPassBandEdit.text().toDouble()
+ ret = r and ret
+ sb,r = self.gui.startofLpfStopBandEdit.text().toDouble()
+ ret = r and ret
+ atten,r = self.gui.lpfStopBandAttenEdit.text().toDouble()
+ ret = r and ret
+
+ if(ret):
+ tb = sb - pb
+
+ taps = gr.firdes.low_pass_2(gain, fs, pb, tb,
+ atten, wintype)
+ params = {"fs": fs, "gain": gain, "wintype": wintype,
+ "filttype": "lpf", "pbend": pb, "sbstart": sb,
+ "atten": atten, "ntaps": len(taps)}
+ return (taps, params, ret)
+ else:
+ return ([], [], ret)
+
+ def design_win_bpf(self, fs, gain, wintype):
+ ret = True
+ pb1,r = self.gui.startofBpfPassBandEdit.text().toDouble()
+ ret = r and ret
+ pb2,r = self.gui.endofBpfPassBandEdit.text().toDouble()
+ ret = r and ret
+ tb,r = self.gui.bpfTransitionEdit.text().toDouble()
+ ret = r and ret
+ atten,r = self.gui.bpfStopBandAttenEdit.text().toDouble()
+ ret = r and ret
+
+ if(r):
+ taps = gr.firdes.band_pass_2(gain, fs, pb1, pb2, tb,
+ atten, wintype)
+ params = {"fs": fs, "gain": gain, "wintype": wintype,
+ "filttype": "bpf", "pbstart": pb1, "pbend": pb2,
+ "tb": tb, "atten": atten, "ntaps": len(taps)}
+ return (taps,params,r)
+ else:
+ return ([],[],r)
+
+ def design_win_cbpf(self, fs, gain, wintype):
+ ret = True
+ pb1,r = self.gui.startofBpfPassBandEdit.text().toDouble()
+ ret = r and ret
+ pb2,r = self.gui.endofBpfPassBandEdit.text().toDouble()
+ ret = r and ret
+ tb,r = self.gui.bpfTransitionEdit.text().toDouble()
+ ret = r and ret
+ atten,r = self.gui.bpfStopBandAttenEdit.text().toDouble()
+ ret = r and ret
+
+ if(r):
+ taps = gr.firdes.complex_band_pass_2(gain, fs, pb1, pb2, tb,
+ atten, wintype)
+ params = {"fs": fs, "gain": gain, "wintype": wintype,
+ "filttype": "cbpf", "pbstart": pb1, "pbend": pb2,
+ "tb": tb, "atten": atten, "ntaps": len(taps)}
+ return (taps,params,r)
+ else:
+ return ([],[],r)
+
+ def design_win_bnf(self, fs, gain, wintype):
+ ret = True
+ pb1,r = self.gui.startofBnfStopBandEdit.text().toDouble()
+ ret = r and ret
+ pb2,r = self.gui.endofBnfStopBandEdit.text().toDouble()
+ ret = r and ret
+ tb,r = self.gui.bnfTransitionEdit.text().toDouble()
+ ret = r and ret
+ atten,r = self.gui.bnfStopBandAttenEdit.text().toDouble()
+ ret = r and ret
+
+ if(r):
+ taps = gr.firdes.band_reject_2(gain, fs, pb1, pb2, tb,
+ atten, wintype)
+ params = {"fs": fs, "gain": gain, "wintype": wintype,
+ "filttype": "bnf", "sbstart": pb1, "sbend": pb2,
+ "tb": tb, "atten": atten, "ntaps": len(taps)}
+ return (taps,params,r)
+ else:
+ return ([],[],r)
+
+ def design_win_hpf(self, fs, gain, wintype):
+ ret = True
+ sb,r = self.gui.endofHpfStopBandEdit.text().toDouble()
+ ret = r and ret
+ pb,r = self.gui.startofHpfPassBandEdit.text().toDouble()
+ ret = r and ret
+ atten,r = self.gui.hpfStopBandAttenEdit.text().toDouble()
+ ret = r and ret
+
+ if(r):
+ tb = pb - sb
+ taps = gr.firdes.high_pass_2(gain, fs, pb, tb,
+ atten, wintype)
+ params = {"fs": fs, "gain": gain, "wintype": wintype,
+ "filttype": "hpf", "sbend": sb, "pbstart": pb,
+ "atten": atten, "ntaps": len(taps)}
+ return (taps,params,r)
+ else:
+ return ([],[],r)
+
+ def design_win_rrc(self, fs, gain, wintype):
+ ret = True
+ sr,r = self.gui.rrcSymbolRateEdit.text().toDouble()
+ ret = r and ret
+ alpha,r = self.gui.rrcAlphaEdit.text().toDouble()
+ ret = r and ret
+ ntaps,r = self.gui.rrcNumTapsEdit.text().toInt()
+ ret = r and ret
+
+ if(r):
+ taps = gr.firdes.root_raised_cosine(gain, fs, sr,
+ alpha, ntaps)
+ params = {"fs": fs, "gain": gain, "wintype": wintype,
+ "filttype": "rrc", "srate": sr, "alpha": alpha,
+ "ntaps": ntaps}
+ return (taps,params,r)
+ else:
+ return ([],[],r)
+
+ def design_win_gaus(self, fs, gain, wintype):
+ ret = True
+ sr,r = self.gui.gausSymbolRateEdit.text().toDouble()
+ ret = r and ret
+ bt,r = self.gui.gausBTEdit.text().toDouble()
+ ret = r and ret
+ ntaps,r = self.gui.gausNumTapsEdit.text().toInt()
+ ret = r and ret
+
+ if(r):
+ spb = fs / sr
+ taps = gr.firdes.gaussian(gain, spb, bt, ntaps)
+ params = {"fs": fs, "gain": gain, "wintype": wintype,
+ "filttype": "gaus", "srate": sr, "bt": bt,
+ "ntaps": ntaps}
+ return (taps,params,r)
+ else:
+ return ([],[],r)
+
+ # Design Functions for Equiripple Filters
+ def design_opt_lpf(self, fs, gain):
+ ret = True
+ pb,r = self.gui.endofLpfPassBandEdit.text().toDouble()
+ ret = r and ret
+ sb,r = self.gui.startofLpfStopBandEdit.text().toDouble()
+ ret = r and ret
+ atten,r = self.gui.lpfStopBandAttenEdit.text().toDouble()
+ ret = r and ret
+ ripple,r = self.gui.lpfPassBandRippleEdit.text().toDouble()
+ ret = r and ret
+
+ if(ret):
+ try:
+ taps = blks2.optfir.low_pass(gain, fs, pb, sb,
+ ripple, atten)
+ except RuntimeError, e:
+ reply = QtGui.QMessageBox.information(self, "Filter did not converge",
+ e.args[0], "&Ok")
+ return ([],[],False)
+ else:
+ params = {"fs": fs, "gain": gain, "wintype": self.EQUIRIPPLE_FILT,
+ "filttype": "lpf", "pbend": pb, "sbstart": sb,
+ "atten": atten, "ripple": ripple, "ntaps": len(taps)}
+ return (taps, params, ret)
+ else:
+ return ([], [], ret)
+
+ def design_opt_bpf(self, fs, gain):
+ ret = True
+ pb1,r = self.gui.startofBpfPassBandEdit.text().toDouble()
+ ret = r and ret
+ pb2,r = self.gui.endofBpfPassBandEdit.text().toDouble()
+ ret = r and ret
+ tb,r = self.gui.bpfTransitionEdit.text().toDouble()
+ ret = r and ret
+ atten,r = self.gui.bpfStopBandAttenEdit.text().toDouble()
+ ret = r and ret
+ ripple,r = self.gui.bpfPassBandRippleEdit.text().toDouble()
+ ret = r and ret
+
+ if(r):
+ sb1 = pb1 - tb
+ sb2 = pb2 + tb
+ try:
+ taps = blks2.optfir.band_pass(gain, fs, sb1, pb1, pb2, sb2,
+ ripple, atten)
+ except RuntimeError, e:
+ reply = QtGui.QMessageBox.information(self, "Filter did not converge",
+ e.args[0], "&Ok")
+ return ([],[],False)
+
+ else:
+ params = {"fs": fs, "gain": gain, "wintype": self.EQUIRIPPLE_FILT,
+ "filttype": "bpf", "pbstart": pb1, "pbend": pb2,
+ "tb": tb, "atten": atten, "ripple": ripple,
+ "ntaps": len(taps)}
+ return (taps,params,r)
+ else:
+ return ([],[],r)
+
+ def design_opt_cbpf(self, fs, gain):
+ ret = True
+ pb1,r = self.gui.startofBpfPassBandEdit.text().toDouble()
+ ret = r and ret
+ pb2,r = self.gui.endofBpfPassBandEdit.text().toDouble()
+ ret = r and ret
+ tb,r = self.gui.bpfTransitionEdit.text().toDouble()
+ ret = r and ret
+ atten,r = self.gui.bpfStopBandAttenEdit.text().toDouble()
+ ret = r and ret
+ ripple,r = self.gui.bpfPassBandRippleEdit.text().toDouble()
+ ret = r and ret
+
+ if(r):
+ sb1 = pb1 - tb
+ sb2 = pb2 + tb
+ try:
+ taps = blks2.optfir.complex_band_pass(gain, fs, sb1, pb1, pb2, sb2,
+ ripple, atten)
+ except RuntimeError, e:
+ reply = QtGui.QMessageBox.information(self, "Filter did not converge",
+ e.args[0], "&Ok")
+ return ([],[],False)
+ else:
+ params = {"fs": fs, "gain": gain, "wintype": self.EQUIRIPPLE_FILT,
+ "filttype": "cbpf", "pbstart": pb1, "pbend": pb2,
+ "tb": tb, "atten": atten, "ripple": ripple,
+ "ntaps": len(taps)}
+ return (taps,params,r)
+ else:
+ return ([],[],r)
+
+ def design_opt_bnf(self, fs, gain):
+ ret = True
+ sb1,r = self.gui.startofBnfStopBandEdit.text().toDouble()
+ ret = r and ret
+ sb2,r = self.gui.endofBnfStopBandEdit.text().toDouble()
+ ret = r and ret
+ tb,r = self.gui.bnfTransitionEdit.text().toDouble()
+ ret = r and ret
+ atten,r = self.gui.bnfStopBandAttenEdit.text().toDouble()
+ ret = r and ret
+ ripple,r = self.gui.bnfPassBandRippleEdit.text().toDouble()
+ ret = r and ret
+
+ if(r):
+ pb1 = sb1 - tb
+ pb2 = sb2 + tb
+ try:
+ taps = blks2.optfir.band_reject(gain, fs, pb1, sb1, sb2, pb2,
+ ripple, atten)
+ except RuntimeError, e:
+ reply = QtGui.QMessageBox.information(self, "Filter did not converge",
+ e.args[0], "&Ok")
+ return ([],[],False)
+ else:
+ params = {"fs": fs, "gain": gain, "wintype": self.EQUIRIPPLE_FILT,
+ "filttype": "bnf", "sbstart": pb1, "sbend": pb2,
+ "tb": tb, "atten": atten, "ripple": ripple,
+ "ntaps": len(taps)}
+ return (taps,params,r)
+ else:
+ return ([],[],r)
+
+ def design_opt_hpf(self, fs, gain):
+ ret = True
+ sb,r = self.gui.endofHpfStopBandEdit.text().toDouble()
+ ret = r and ret
+ pb,r = self.gui.startofHpfPassBandEdit.text().toDouble()
+ ret = r and ret
+ atten,r = self.gui.hpfStopBandAttenEdit.text().toDouble()
+ ret = r and ret
+ ripple,r = self.gui.hpfPassBandRippleEdit.text().toDouble()
+ ret = r and ret
+
+ if(r):
+ try:
+ taps = blks2.optfir.high_pass(gain, fs, sb, pb,
+ atten, ripple)
+ except RuntimeError, e:
+ reply = QtGui.QMessageBox.information(self, "Filter did not converge",
+ e.args[0], "&Ok")
+ return ([],[],False)
+ else:
+ params = {"fs": fs, "gain": gain, "wintype": self.EQUIRIPPLE_FILT,
+ "filttype": "hpf", "sbend": sb, "pbstart": pb,
+ "atten": atten, "ripple": ripple,
+ "ntaps": len(taps)}
+ return (taps,params,r)
+ else:
+ return ([],[],r)
+
+ def nfft_edit_changed(self, nfft):
+ infft,r = nfft.toInt()
+ if(r and (infft != self.nfftpts)):
+ self.nfftpts = infft
+ self.update_freq_curves()
+
+ def tab_changed(self, tab):
+ if(tab == 0):
+ self.update_freq_curves()
+ if(tab == 1):
+ self.update_time_curves()
+ if(tab == 2):
+ self.update_phase_curves()
+ if(tab == 3):
+ self.update_group_curves()
+
+ def get_fft(self, fs, taps, Npts):
+ Ts = 1.0/fs
+ fftpts = fftpack.fft(taps, Npts)
+ self.freq = scipy.arange(0, fs, 1.0/(Npts*Ts))
+ self.fftdB = 20.0*scipy.log10(abs(fftpts))
+ self.fftDeg = scipy.unwrap(scipy.angle(fftpts))
+ self.groupDelay = -scipy.diff(self.fftDeg)
+
+ def update_time_curves(self):
+ ntaps = len(self.taps)
+ if(ntaps > 0):
+ if(type(self.taps[0]) == scipy.complex128):
+ self.rcurve.setData(scipy.arange(ntaps), self.taps.real)
+ self.icurve.setData(scipy.arange(ntaps), self.taps.imag)
+ else:
+ self.rcurve.setData(scipy.arange(ntaps), self.taps)
+
+ # Reset the x-axis to the new time scale
+ ymax = 1.5 * max(self.taps)
+ ymin = 1.5 * min(self.taps)
+ self.gui.timePlot.setAxisScale(self.gui.timePlot.xBottom,
+ 0, ntaps)
+ self.gui.timePlot.setAxisScale(self.gui.timePlot.yLeft,
+ ymin, ymax)
+
+ # Set the zoomer base to unzoom to the new axis
+ self.timeZoomer.setZoomBase()
+
+ self.gui.timePlot.replot()
+
+ def update_freq_curves(self):
+ npts = len(self.fftdB)
+ if(npts > 0):
+ self.freqcurve.setData(self.freq, self.fftdB)
+
+ # Reset the x-axis to the new time scale
+ ymax = 1.5 * max(self.fftdB[0:npts/2])
+ ymin = 1.1 * min(self.fftdB[0:npts/2])
+ xmax = self.freq[npts/2]
+ xmin = self.freq[0]
+ self.gui.freqPlot.setAxisScale(self.gui.freqPlot.xBottom,
+ xmin, xmax)
+ self.gui.freqPlot.setAxisScale(self.gui.freqPlot.yLeft,
+ ymin, ymax)
+
+ # Set the zoomer base to unzoom to the new axis
+ self.freqZoomer.setZoomBase()
+
+ self.gui.freqPlot.replot()
+
+
+ def update_phase_curves(self):
+ npts = len(self.fftDeg)
+ if(npts > 0):
+ self.phasecurve.setData(self.freq, self.fftDeg)
+
+ # Reset the x-axis to the new time scale
+ ymax = 1.5 * max(self.fftDeg[0:npts/2])
+ ymin = 1.1 * min(self.fftDeg[0:npts/2])
+ xmax = self.freq[npts/2]
+ xmin = self.freq[0]
+ self.gui.phasePlot.setAxisScale(self.gui.phasePlot.xBottom,
+ xmin, xmax)
+ self.gui.phasePlot.setAxisScale(self.gui.phasePlot.yLeft,
+ ymin, ymax)
+
+ # Set the zoomer base to unzoom to the new axis
+ self.phaseZoomer.setZoomBase()
+
+ self.gui.phasePlot.replot()
+
+ def update_group_curves(self):
+ npts = len(self.groupDelay)
+ if(npts > 0):
+ self.groupcurve.setData(self.freq, self.groupDelay)
+
+ # Reset the x-axis to the new time scale
+ ymax = 1.5 * max(self.groupDelay[0:npts/2])
+ ymin = 1.1 * min(self.groupDelay[0:npts/2])
+ xmax = self.freq[npts/2]
+ xmin = self.freq[0]
+ self.gui.groupPlot.setAxisScale(self.gui.groupPlot.xBottom,
+ xmin, xmax)
+ self.gui.groupPlot.setAxisScale(self.gui.groupPlot.yLeft,
+ ymin, ymax)
+
+ # Set the zoomer base to unzoom to the new axis
+ self.groupZoomer.setZoomBase()
+
+ self.gui.groupPlot.replot()
+
+ def action_save_dialog(self):
+ filename = QtGui.QFileDialog.getSaveFileName(self, "Save CSV Filter File", ".", "")
+ try:
+ handle = open(filename, "wb")
+ except IOError:
+ reply = QtGui.QMessageBox.information(self, 'File Name',
+ ("Could not save to file: %s" % filename),
+ "&Ok")
+ return
+
+ csvhandle = csv.writer(handle, delimiter=",")
+ for k in self.params.keys():
+ csvhandle.writerow([k, self.params[k]])
+ csvhandle.writerow(["taps",] + self.taps.tolist())
+ handle.close()
+
+ def action_open_dialog(self):
+ filename = QtGui.QFileDialog.getOpenFileName(self, "Open CSV Filter File", ".", "")
+ if(len(filename) == 0):
+ return
+
+ try:
+ handle = open(filename, "rb")
+ except IOError:
+ reply = QtGui.QMessageBox.information(self, 'File Name',
+ ("Could not open file: %s" % filename),
+ "&Ok")
+ return
+
+ csvhandle = csv.reader(handle, delimiter=",")
+ taps = []
+ params = {}
+ for row in csvhandle:
+ if(row[0] != "taps"):
+ testcpx = re.findall("[+-]?\d+\.*\d*[Ee]?[-+]?\d+j", row[1])
+ if(len(testcpx) > 0): # it's a complex
+ params[row[0]] = complex(row[1])
+ else: # assume it's a float
+ try: # if it's not a float, its a string
+ params[row[0]] = float(row[1])
+ except ValueError:
+ params[row[0]] = row[1]
+ else:
+ testcpx = re.findall("[+-]?\d+\.*\d*[Ee]?[-+]?\d+j", row[1])
+ if(len(testcpx) > 0): # it's a complex
+ taps = [complex(r) for r in row[1:]]
+ else:
+ taps = [float(r) for r in row[1:]]
+ handle.close()
+ self.draw_plots(taps, params)
+
+ self.gui.sampleRateEdit.setText(Qt.QString("%1").arg(params["fs"]))
+ self.gui.filterGainEdit.setText(Qt.QString("%1").arg(params["gain"]))
+
+ # Set up GUI parameters for each filter type
+ if(params["filttype"] == "lpf"):
+ self.gui.filterTypeComboBox.setCurrentIndex(0)
+ self.gui.filterDesignTypeComboBox.setCurrentIndex(int(params["wintype"]))
+
+ self.gui.endofLpfPassBandEdit.setText(Qt.QString("%1").arg(params["pbend"]))
+ self.gui.startofLpfStopBandEdit.setText(Qt.QString("%1").arg(params["sbstart"]))
+ self.gui.lpfStopBandAttenEdit.setText(Qt.QString("%1").arg(params["atten"]))
+ if(params["wintype"] == self.EQUIRIPPLE_FILT):
+ self.gui.lpfPassBandRippleEdit.setText(Qt.QString("%1").arg(params["ripple"]))
+ elif(params["filttype"] == "bpf"):
+ self.gui.filterTypeComboBox.setCurrentIndex(1)
+ self.gui.filterDesignTypeComboBox.setCurrentIndex(int(params["wintype"]))
+
+ self.gui.startofBpfPassBandEdit.setText(Qt.QString("%1").arg(params["pbstart"]))
+ self.gui.endofBpfPassBandEdit.setText(Qt.QString("%1").arg(params["pbend"]))
+ self.gui.bpfTransitionEdit.setText(Qt.QString("%1").arg(params["tb"]))
+ self.gui.bpfStopBandAttenEdit.setText(Qt.QString("%1").arg(params["atten"]))
+ if(params["wintype"] == self.EQUIRIPPLE_FILT):
+ self.gui.bpfPassBandRippleEdit.setText(Qt.QString("%1").arg(params["ripple"]))
+ elif(params["filttype"] == "cbpf"):
+ self.gui.filterTypeComboBox.setCurrentIndex(2)
+ self.gui.filterDesignTypeComboBox.setCurrentIndex(int(params["wintype"]))
+
+ self.gui.startofBpfPassBandEdit.setText(Qt.QString("%1").arg(params["pbstart"]))
+ self.gui.endofBpfPassBandEdit.setText(Qt.QString("%1").arg(params["pbend"]))
+ self.gui.bpfTransitionEdit.setText(Qt.QString("%1").arg(params["tb"]))
+ self.gui.bpfStopBandAttenEdit.setText(Qt.QString("%1").arg(params["atten"]))
+ if(params["wintype"] == self.EQUIRIPPLE_FILT):
+ self.gui.bpfPassBandRippleEdit.setText(Qt.QString("%1").arg(params["ripple"]))
+ elif(params["filttype"] == "bnf"):
+ self.gui.filterTypeComboBox.setCurrentIndex(3)
+ self.gui.filterDesignTypeComboBox.setCurrentIndex(int(params["wintype"]))
+
+ self.gui.startofBnfStopBandEdit.setText(Qt.QString("%1").arg(params["sbstart"]))
+ self.gui.endofBnfStopBandEdit.setText(Qt.QString("%1").arg(params["sbend"]))
+ self.gui.bnfTransitionEdit.setText(Qt.QString("%1").arg(params["tb"]))
+ self.gui.bnfStopBandAttenEdit.setText(Qt.QString("%1").arg(params["atten"]))
+ if(params["wintype"] == self.EQUIRIPPLE_FILT):
+ self.gui.bnfPassBandRippleEdit.setText(Qt.QString("%1").arg(params["ripple"]))
+ elif(params["filttype"] == "hpf"):
+ self.gui.filterTypeComboBox.setCurrentIndex(4)
+ self.gui.filterDesignTypeComboBox.setCurrentIndex(int(params["wintype"]))
+
+ self.gui.endofHpfStopBandEdit.setText(Qt.QString("%1").arg(params["sbend"]))
+ self.gui.startofHpfPassBandEdit.setText(Qt.QString("%1").arg(params["pbstart"]))
+ self.gui.hpfStopBandAttenEdit.setText(Qt.QString("%1").arg(params["atten"]))
+ if(params["wintype"] == self.EQUIRIPPLE_FILT):
+ self.gui.hpfPassBandRippleEdit.setText(Qt.QString("%1").arg(params["ripple"]))
+ elif(params["filttype"] == "rrc"):
+ self.gui.filterTypeComboBox.setCurrentIndex(5)
+ self.gui.filterDesignTypeComboBox.setCurrentIndex(int(params["wintype"]))
+
+ self.gui.rrcSymbolRateEdit.setText(Qt.QString("%1").arg(params["srate"]))
+ self.gui.rrcAlphaEdit.setText(Qt.QString("%1").arg(params["alpha"]))
+ self.gui.rrcNumTapsEdit.setText(Qt.QString("%1").arg(params["ntaps"]))
+ elif(params["filttype"] == "gaus"):
+ self.gui.filterTypeComboBox.setCurrentIndex(6)
+ self.gui.filterDesignTypeComboBox.setCurrentIndex(int(params["wintype"]))
+
+ self.gui.gausSymbolRateEdit.setText(Qt.QString("%1").arg(params["srate"]))
+ self.gui.gausBTEdit.setText(Qt.QString("%1").arg(params["bt"]))
+ self.gui.gausNumTapsEdit.setText(Qt.QString("%1").arg(params["ntaps"]))
+
+ def draw_plots(self, taps, params):
+ self.params = params
+ self.taps = scipy.array(taps)
+ self.get_fft(self.params["fs"], self.taps, self.nfftpts)
+ self.update_time_curves()
+ self.update_freq_curves()
+ self.update_phase_curves()
+ self.update_group_curves()
+
+ self.gui.nTapsEdit.setText(Qt.QString("%1").arg(self.taps.size))
+
+
+def setup_options():
+ usage="%prog: [options] (input_filename)"
+ description = ""
+
+ parser = OptionParser(conflict_handler="resolve",
+ usage=usage, description=description)
+ return parser
+
+def main(args):
+ parser = setup_options()
+ (options, args) = parser.parse_args ()
+
+ app = Qt.QApplication(args)
+ gplt = gr_plot_filter(app, options)
+ app.exec_()
+
+if __name__ == '__main__':
+ main(sys.argv)
+
diff --git a/gr-utils/src/python/gr_modtool b/gr-utils/src/python/gr_modtool
new file mode 100755
index 000000000..8c5c710af
--- /dev/null
+++ b/gr-utils/src/python/gr_modtool
@@ -0,0 +1,43 @@
+#!/usr/bin/env python
+#
+# 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.
+#
+""" A tool for editing GNU Radio out-of-tree modules. """
+
+import sys
+from gnuradio.modtool import *
+
+def main():
+ """ Here we go. Parse command, choose class and run. """
+ cmd_dict = get_class_dict(globals().values())
+ command = get_command_from_argv(cmd_dict.keys())
+ if command is None:
+ print 'Usage:' + templates.Templates['usage']
+ exit(2)
+ modtool = cmd_dict[command]()
+ modtool.setup()
+ modtool.run()
+
+if __name__ == '__main__':
+ try:
+ main()
+ except KeyboardInterrupt:
+ pass
+
diff --git a/gr-utils/src/python/gr_plot_char b/gr-utils/src/python/gr_plot_char
new file mode 100755
index 000000000..a2b93a63c
--- /dev/null
+++ b/gr-utils/src/python/gr_plot_char
@@ -0,0 +1,58 @@
+#!/usr/bin/env python
+#
+# Copyright 2007,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.
+#
+
+try:
+ import scipy
+except ImportError:
+ print "Please install SciPy to run this script (http://www.scipy.org/)"
+ raise SystemExit, 1
+
+from optparse import OptionParser
+from gnuradio.plot_data import plot_data
+
+def main():
+ usage="%prog: [options] input_filenames"
+ description = "Takes a GNU Radio byte/char binary file and displays the samples versus time. You can set the block size to specify how many points to read in at a time and the start position in the file. By default, the system assumes a sample rate of 1, so in time, each sample is plotted versus the sample number. To set a true time axis, set the sample rate (-R or --sample-rate) to the sample rate used when capturing the samples."
+
+ parser = OptionParser(conflict_handler="resolve", usage=usage, description=description)
+ parser.add_option("-B", "--block", type="int", default=1000,
+ help="Specify the block size [default=%default]")
+ parser.add_option("-s", "--start", type="int", default=0,
+ help="Specify where to start in the file [default=%default]")
+ parser.add_option("-R", "--sample-rate", type="float", default=1.0,
+ help="Set the sampler rate of the data [default=%default]")
+
+ (options, args) = parser.parse_args ()
+ if len(args) < 1:
+ parser.print_help()
+ raise SystemExit, 1
+ filenames = args
+
+ datatype=scipy.int8
+ dc = plot_data(datatype, filenames, options)
+
+if __name__ == "__main__":
+ try:
+ main()
+ except KeyboardInterrupt:
+ pass
+
diff --git a/gr-utils/src/python/gr_plot_const b/gr-utils/src/python/gr_plot_const
new file mode 100755
index 000000000..749ad035b
--- /dev/null
+++ b/gr-utils/src/python/gr_plot_const
@@ -0,0 +1,250 @@
+#!/usr/bin/env python
+#
+# Copyright 2007,2008,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.
+#
+
+try:
+ import scipy
+except ImportError:
+ print "Please install SciPy to run this script (http://www.scipy.org/)"
+ raise SystemExit, 1
+
+try:
+ from pylab import *
+ from matplotlib.font_manager import fontManager, FontProperties
+except ImportError:
+ print "Please install Matplotlib to run this script (http://matplotlib.sourceforge.net/)"
+ raise SystemExit, 1
+
+from optparse import OptionParser
+
+class draw_constellation:
+ def __init__(self, filename, options):
+ self.hfile = open(filename, "r")
+ self.block_length = options.block
+ self.start = options.start
+ self.sample_rate = options.sample_rate
+
+ self.datatype = scipy.complex64
+ self.sizeof_data = self.datatype().nbytes # number of bytes per sample in file
+
+ self.axis_font_size = 16
+ self.label_font_size = 18
+ self.title_font_size = 20
+
+ # Setup PLOT
+ self.fig = figure(1, figsize=(16, 9), facecolor='w')
+ rcParams['xtick.labelsize'] = self.axis_font_size
+ rcParams['ytick.labelsize'] = self.axis_font_size
+
+ self.text_file = figtext(0.10, 0.95, ("File: %s" % filename), weight="heavy", size=16)
+ self.text_file_pos = figtext(0.10, 0.90, "File Position: ", weight="heavy", size=16)
+ self.text_block = figtext(0.40, 0.90, ("Block Size: %d" % self.block_length),
+ weight="heavy", size=16)
+ self.text_sr = figtext(0.60, 0.90, ("Sample Rate: %.2f" % self.sample_rate),
+ weight="heavy", size=16)
+ self.make_plots()
+
+ self.button_left_axes = self.fig.add_axes([0.45, 0.01, 0.05, 0.05], frameon=True)
+ self.button_left = Button(self.button_left_axes, "<")
+ self.button_left_callback = self.button_left.on_clicked(self.button_left_click)
+
+ self.button_right_axes = self.fig.add_axes([0.50, 0.01, 0.05, 0.05], frameon=True)
+ self.button_right = Button(self.button_right_axes, ">")
+ self.button_right_callback = self.button_right.on_clicked(self.button_right_click)
+
+ self.xlim = self.sp_iq.get_xlim()
+
+ self.manager = get_current_fig_manager()
+ connect('draw_event', self.zoom)
+ connect('key_press_event', self.click)
+ connect('button_press_event', self.mouse_button_callback)
+ show()
+
+ def get_data(self):
+ self.text_file_pos.set_text("File Position: %d" % (self.hfile.tell()//self.sizeof_data))
+ try:
+ iq = scipy.fromfile(self.hfile, dtype=self.datatype, count=self.block_length)
+ except MemoryError:
+ print "End of File"
+ else:
+ # retesting length here as newer version of scipy does not throw a MemoryError, just
+ # returns a zero-length array
+ if(len(iq) > 0):
+ self.reals = scipy.array([r.real for r in iq])
+ self.imags = scipy.array([i.imag for i in iq])
+
+ self.time = scipy.array([i*(1/self.sample_rate) for i in range(len(self.reals))])
+ return True
+ else:
+ print "End of File"
+ return False
+
+ def make_plots(self):
+ # if specified on the command-line, set file pointer
+ self.hfile.seek(self.sizeof_data*self.start, 1)
+
+ r = self.get_data()
+
+ # Subplot for real and imaginary parts of signal
+ self.sp_iq = self.fig.add_subplot(2,1,1, position=[0.075, 0.2, 0.4, 0.6])
+ self.sp_iq.set_title(("I&Q"), fontsize=self.title_font_size, fontweight="bold")
+ self.sp_iq.set_xlabel("Time (s)", fontsize=self.label_font_size, fontweight="bold")
+ self.sp_iq.set_ylabel("Amplitude (V)", fontsize=self.label_font_size, fontweight="bold")
+ self.plot_iq = self.sp_iq.plot(self.time, self.reals, 'bo-', self.time, self.imags, 'ro-')
+
+ # Subplot for constellation plot
+ self.sp_const = self.fig.add_subplot(2,2,1, position=[0.575, 0.2, 0.4, 0.6])
+ self.sp_const.set_title(("Constellation"), fontsize=self.title_font_size, fontweight="bold")
+ self.sp_const.set_xlabel("Inphase", fontsize=self.label_font_size, fontweight="bold")
+ self.sp_const.set_ylabel("Qaudrature", fontsize=self.label_font_size, fontweight="bold")
+ self.plot_const = self.sp_const.plot(self.reals, self.imags, 'bo')
+
+ # Add plots to mark current location of point between time and constellation plots
+ self.indx = 0
+ self.plot_iq += self.sp_iq.plot([self.time[self.indx],], [self.reals[self.indx],], 'mo', ms=8)
+ self.plot_iq += self.sp_iq.plot([self.time[self.indx],], [self.imags[self.indx],], 'mo', ms=8)
+ self.plot_const += self.sp_const.plot([self.reals[self.indx],], [self.imags[self.indx],], 'mo', ms=12)
+
+ # Adjust axis
+ self.sp_iq.axis([self.time.min(), self.time.max(),
+ 1.5*min([self.reals.min(), self.imags.min()]),
+ 1.5*max([self.reals.max(), self.imags.max()])])
+ self.sp_const.axis([-2, 2, -2, 2])
+
+ draw()
+
+ def update_plots(self):
+ self.plot_iq[0].set_data([self.time, self.reals])
+ self.plot_iq[1].set_data([self.time, self.imags])
+ self.sp_iq.axis([self.time.min(), self.time.max(),
+ 1.5*min([self.reals.min(), self.imags.min()]),
+ 1.5*max([self.reals.max(), self.imags.max()])])
+
+ self.plot_const[0].set_data([self.reals, self.imags])
+ self.sp_const.axis([-2, 2, -2, 2])
+ draw()
+
+ def zoom(self, event):
+ newxlim = scipy.array(self.sp_iq.get_xlim())
+ curxlim = scipy.array(self.xlim)
+ if(newxlim[0] != curxlim[0] or newxlim[1] != curxlim[1]):
+ self.xlim = newxlim
+ r = self.reals[int(ceil(self.xlim[0])) : int(ceil(self.xlim[1]))]
+ i = self.imags[int(ceil(self.xlim[0])) : int(ceil(self.xlim[1]))]
+
+ self.plot_const[0].set_data(r, i)
+ self.sp_const.axis([-2, 2, -2, 2])
+ self.manager.canvas.draw()
+ draw()
+
+ def click(self, event):
+ forward_valid_keys = [" ", "down", "right"]
+ backward_valid_keys = ["up", "left"]
+ trace_forward_valid_keys = [">",]
+ trace_backward_valid_keys = ["<",]
+
+ if(find(event.key, forward_valid_keys)):
+ self.step_forward()
+
+ elif(find(event.key, backward_valid_keys)):
+ self.step_backward()
+
+ elif(find(event.key, trace_forward_valid_keys)):
+ self.indx = min(self.indx+1, len(self.time)-1)
+ self.set_trace(self.indx)
+
+ elif(find(event.key, trace_backward_valid_keys)):
+ self.indx = max(0, self.indx-1)
+ self.set_trace(self.indx)
+
+ def button_left_click(self, event):
+ self.step_backward()
+
+ def button_right_click(self, event):
+ self.step_forward()
+
+ def step_forward(self):
+ r = self.get_data()
+ if(r):
+ self.update_plots()
+
+ def step_backward(self):
+ # Step back in file position
+ if(self.hfile.tell() >= 2*self.sizeof_data*self.block_length ):
+ self.hfile.seek(-2*self.sizeof_data*self.block_length, 1)
+ else:
+ self.hfile.seek(-self.hfile.tell(),1)
+ r = self.get_data()
+ if(r):
+ self.update_plots()
+
+
+ def mouse_button_callback(self, event):
+ x, y = event.xdata, event.ydata
+
+ if x is not None and y is not None:
+ if(event.inaxes == self.sp_iq):
+ self.indx = searchsorted(self.time, [x])
+ self.set_trace(self.indx)
+
+
+ def set_trace(self, indx):
+ self.plot_iq[2].set_data(self.time[indx], self.reals[indx])
+ self.plot_iq[3].set_data(self.time[indx], self.imags[indx])
+ self.plot_const[1].set_data(self.reals[indx], self.imags[indx])
+ draw()
+
+
+def find(item_in, list_search):
+ try:
+ return list_search.index(item_in) != None
+ except ValueError:
+ return False
+
+
+def main():
+ usage="%prog: [options] input_filename"
+ description = "Takes a GNU Radio complex binary file and displays the I&Q data versus time and the constellation plot (I vs. Q). You can set the block size to specify how many points to read in at a time and the start position in the file. By default, the system assumes a sample rate of 1, so in time, each sample is plotted versus the sample number. To set a true time axis, set the sample rate (-R or --sample-rate) to the sample rate used when capturing the samples."
+
+ parser = OptionParser(conflict_handler="resolve", usage=usage, description=description)
+ parser.add_option("-B", "--block", type="int", default=1000,
+ help="Specify the block size [default=%default]")
+ parser.add_option("-s", "--start", type="int", default=0,
+ help="Specify where to start in the file [default=%default]")
+ parser.add_option("-R", "--sample-rate", type="float", default=1.0,
+ help="Set the sampler rate of the data [default=%default]")
+
+ (options, args) = parser.parse_args ()
+ if len(args) != 1:
+ parser.print_help()
+ raise SystemExit, 1
+ filename = args[0]
+
+ dc = draw_constellation(filename, options)
+
+if __name__ == "__main__":
+ try:
+ main()
+ except KeyboardInterrupt:
+ pass
+
+
+
diff --git a/gr-utils/src/python/gr_plot_fft b/gr-utils/src/python/gr_plot_fft
new file mode 100644
index 000000000..434348164
--- /dev/null
+++ b/gr-utils/src/python/gr_plot_fft
@@ -0,0 +1,42 @@
+#!/usr/bin/env python
+#
+# 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.
+#
+
+from gnuradio.plot_fft_base import plot_fft_base
+
+# This is a wrapper program for plot_fft_base. It handles any data
+# type and defaults to complex64.
+
+def main():
+ parser = plot_fft_base.setup_options()
+ (options, args) = parser.parse_args ()
+ if len(args) != 1:
+ parser.print_help()
+ raise SystemExit, 1
+ filename = args[0]
+
+ dc = plot_fft_base(options.data_type, filename, options)
+
+if __name__ == "__main__":
+ try:
+ main()
+ except KeyboardInterrupt:
+ pass
diff --git a/gr-utils/src/python/gr_plot_fft_c b/gr-utils/src/python/gr_plot_fft_c
new file mode 100755
index 000000000..43e808d95
--- /dev/null
+++ b/gr-utils/src/python/gr_plot_fft_c
@@ -0,0 +1,46 @@
+#!/usr/bin/env python
+#
+# Copyright 2007,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.
+#
+
+from gnuradio.plot_fft_base import plot_fft_base
+
+# This is a wrapper program for plot_fft_base specifically for complex data
+
+def main():
+ parser = plot_fft_base.setup_options()
+ parser.remove_option("--data-type")
+
+ (options, args) = parser.parse_args ()
+ if len(args) != 1:
+ parser.print_help()
+ raise SystemExit, 1
+ filename = args[0]
+
+ dc = plot_fft_base("complex64", filename, options)
+
+if __name__ == "__main__":
+ try:
+ main()
+ except KeyboardInterrupt:
+ pass
+
+
+
diff --git a/gr-utils/src/python/gr_plot_fft_f b/gr-utils/src/python/gr_plot_fft_f
new file mode 100755
index 000000000..dee9b17de
--- /dev/null
+++ b/gr-utils/src/python/gr_plot_fft_f
@@ -0,0 +1,46 @@
+#!/usr/bin/env python
+#
+# Copyright 2007,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.
+#
+
+from gnuradio.plot_fft_base import plot_fft_base
+
+# This is a wrapper program for plot_fft_base specifically for float data
+
+def main():
+ parser = plot_fft_base.setup_options()
+ parser.remove_option("--data-type")
+
+ (options, args) = parser.parse_args ()
+ if len(args) != 1:
+ parser.print_help()
+ raise SystemExit, 1
+ filename = args[0]
+
+ dc = plot_fft_base("float32", filename, options)
+
+if __name__ == "__main__":
+ try:
+ main()
+ except KeyboardInterrupt:
+ pass
+
+
+
diff --git a/gr-utils/src/python/gr_plot_float b/gr-utils/src/python/gr_plot_float
new file mode 100755
index 000000000..22806e48a
--- /dev/null
+++ b/gr-utils/src/python/gr_plot_float
@@ -0,0 +1,58 @@
+#!/usr/bin/env python
+#
+# Copyright 2007,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.
+#
+
+try:
+ import scipy
+except ImportError:
+ print "Please install SciPy to run this script (http://www.scipy.org/)"
+ raise SystemExit, 1
+
+from optparse import OptionParser
+from gnuradio.plot_data import plot_data
+
+def main():
+ usage="%prog: [options] input_filenames"
+ description = "Takes a GNU Radio floating point binary file and displays the samples versus time. You can set the block size to specify how many points to read in at a time and the start position in the file. By default, the system assumes a sample rate of 1, so in time, each sample is plotted versus the sample number. To set a true time axis, set the sample rate (-R or --sample-rate) to the sample rate used when capturing the samples."
+
+ parser = OptionParser(conflict_handler="resolve", usage=usage, description=description)
+ parser.add_option("-B", "--block", type="int", default=1000,
+ help="Specify the block size [default=%default]")
+ parser.add_option("-s", "--start", type="int", default=0,
+ help="Specify where to start in the file [default=%default]")
+ parser.add_option("-R", "--sample-rate", type="float", default=1.0,
+ help="Set the sampler rate of the data [default=%default]")
+
+ (options, args) = parser.parse_args ()
+ if len(args) < 1:
+ parser.print_help()
+ raise SystemExit, 1
+ filenames = args
+
+ datatype=scipy.float32
+ dc = plot_data(datatype, filenames, options)
+
+if __name__ == "__main__":
+ try:
+ main()
+ except KeyboardInterrupt:
+ pass
+
diff --git a/gr-utils/src/python/gr_plot_int b/gr-utils/src/python/gr_plot_int
new file mode 100755
index 000000000..355ddf018
--- /dev/null
+++ b/gr-utils/src/python/gr_plot_int
@@ -0,0 +1,58 @@
+#!/usr/bin/env python
+#
+# Copyright 2007,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.
+#
+
+try:
+ import scipy
+except ImportError:
+ print "Please install SciPy to run this script (http://www.scipy.org/)"
+ raise SystemExit, 1
+
+from optparse import OptionParser
+from gnuradio.plot_data import plot_data
+
+def main():
+ usage="%prog: [options] input_filenames"
+ description = "Takes a GNU Radio integer binary file and displays the samples versus time. You can set the block size to specify how many points to read in at a time and the start position in the file. By default, the system assumes a sample rate of 1, so in time, each sample is plotted versus the sample number. To set a true time axis, set the sample rate (-R or --sample-rate) to the sample rate used when capturing the samples."
+
+ parser = OptionParser(conflict_handler="resolve", usage=usage, description=description)
+ parser.add_option("-B", "--block", type="int", default=1000,
+ help="Specify the block size [default=%default]")
+ parser.add_option("-s", "--start", type="int", default=0,
+ help="Specify where to start in the file [default=%default]")
+ parser.add_option("-R", "--sample-rate", type="float", default=1.0,
+ help="Set the sampler rate of the data [default=%default]")
+
+ (options, args) = parser.parse_args ()
+ if len(args) < 1:
+ parser.print_help()
+ raise SystemExit, 1
+ filenames = args
+
+ datatype=scipy.int32
+ dc = plot_data(datatype, filenames, options)
+
+if __name__ == "__main__":
+ try:
+ main()
+ except KeyboardInterrupt:
+ pass
+
diff --git a/gr-utils/src/python/gr_plot_iq b/gr-utils/src/python/gr_plot_iq
new file mode 100755
index 000000000..bf8077b6b
--- /dev/null
+++ b/gr-utils/src/python/gr_plot_iq
@@ -0,0 +1,178 @@
+#!/usr/bin/env python
+#
+# Copyright 2007,2008,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.
+#
+
+try:
+ import scipy
+except ImportError:
+ print "Please install SciPy to run this script (http://www.scipy.org/)"
+ raise SystemExit, 1
+
+try:
+ from pylab import *
+except ImportError:
+ print "Please install Matplotlib to run this script (http://matplotlib.sourceforge.net/)"
+ raise SystemExit, 1
+
+from optparse import OptionParser
+
+class draw_iq:
+ def __init__(self, filename, options):
+ self.hfile = open(filename, "r")
+ self.block_length = options.block
+ self.start = options.start
+ self.sample_rate = options.sample_rate
+
+ self.datatype = scipy.complex64
+ self.sizeof_data = self.datatype().nbytes # number of bytes per sample in file
+
+ self.axis_font_size = 16
+ self.label_font_size = 18
+ self.title_font_size = 20
+ self.text_size = 22
+
+ # Setup PLOT
+ self.fig = figure(1, figsize=(16, 9), facecolor='w')
+ rcParams['xtick.labelsize'] = self.axis_font_size
+ rcParams['ytick.labelsize'] = self.axis_font_size
+
+ self.text_file = figtext(0.10, 0.94, ("File: %s" % filename), weight="heavy", size=self.text_size)
+ self.text_file_pos = figtext(0.10, 0.88, "File Position: ", weight="heavy", size=self.text_size)
+ self.text_block = figtext(0.40, 0.88, ("Block Size: %d" % self.block_length),
+ weight="heavy", size=self.text_size)
+ self.text_sr = figtext(0.60, 0.88, ("Sample Rate: %.2f" % self.sample_rate),
+ weight="heavy", size=self.text_size)
+ self.make_plots()
+
+ self.button_left_axes = self.fig.add_axes([0.45, 0.01, 0.05, 0.05], frameon=True)
+ self.button_left = Button(self.button_left_axes, "<")
+ self.button_left_callback = self.button_left.on_clicked(self.button_left_click)
+
+ self.button_right_axes = self.fig.add_axes([0.50, 0.01, 0.05, 0.05], frameon=True)
+ self.button_right = Button(self.button_right_axes, ">")
+ self.button_right_callback = self.button_right.on_clicked(self.button_right_click)
+
+ self.xlim = self.sp_iq.get_xlim()
+
+ self.manager = get_current_fig_manager()
+ connect('key_press_event', self.click)
+ show()
+
+ def get_data(self):
+ self.text_file_pos.set_text("File Position: %d" % (self.hfile.tell()//self.sizeof_data))
+ try:
+ self.iq = scipy.fromfile(self.hfile, dtype=self.datatype, count=self.block_length)
+ except MemoryError:
+ print "End of File"
+ else:
+ self.reals = scipy.array([r.real for r in self.iq])
+ self.imags = scipy.array([i.imag for i in self.iq])
+ self.time = scipy.array([i*(1/self.sample_rate) for i in range(len(self.reals))])
+
+ def make_plots(self):
+ # if specified on the command-line, set file pointer
+ self.hfile.seek(self.sizeof_data*self.start, 1)
+
+ self.get_data()
+
+ # Subplot for real and imaginary parts of signal
+ self.sp_iq = self.fig.add_subplot(2,1,1, position=[0.075, 0.14, 0.85, 0.67])
+ self.sp_iq.set_title(("I&Q"), fontsize=self.title_font_size, fontweight="bold")
+ self.sp_iq.set_xlabel("Time (s)", fontsize=self.label_font_size, fontweight="bold")
+ self.sp_iq.set_ylabel("Amplitude (V)", fontsize=self.label_font_size, fontweight="bold")
+ self.plot_iq = plot(self.time, self.reals, 'bo-', self.time, self.imags, 'ro-')
+ self.sp_iq.set_ylim([1.5*min([self.reals.min(), self.imags.min()]),
+ 1.5*max([self.reals.max(), self.imags.max()])])
+ self.sp_iq.set_xlim(self.time.min(), self.time.max())
+ draw()
+
+ def update_plots(self):
+ self.plot_iq[0].set_data([self.time, self.reals])
+ self.plot_iq[1].set_data([self.time, self.imags])
+ self.sp_iq.set_ylim([1.5*min([self.reals.min(), self.imags.min()]),
+ 1.5*max([self.reals.max(), self.imags.max()])])
+ self.sp_iq.set_xlim(self.time.min(), self.time.max())
+ draw()
+
+ def click(self, event):
+ forward_valid_keys = [" ", "down", "right"]
+ backward_valid_keys = ["up", "left"]
+
+ if(find(event.key, forward_valid_keys)):
+ self.step_forward()
+
+ elif(find(event.key, backward_valid_keys)):
+ self.step_backward()
+
+ def button_left_click(self, event):
+ self.step_backward()
+
+ def button_right_click(self, event):
+ self.step_forward()
+
+ def step_forward(self):
+ self.get_data()
+ self.update_plots()
+
+ def step_backward(self):
+ # Step back in file position
+ if(self.hfile.tell() >= 2*self.sizeof_data*self.block_length ):
+ self.hfile.seek(-2*self.sizeof_data*self.block_length, 1)
+ else:
+ self.hfile.seek(-self.hfile.tell(),1)
+ self.get_data()
+ self.update_plots()
+
+
+def find(item_in, list_search):
+ try:
+ return list_search.index(item_in) != None
+ except ValueError:
+ return False
+
+def main():
+ usage="%prog: [options] input_filename"
+ description = "Takes a GNU Radio complex binary file and displays the I&Q data versus time. You can set the block size to specify how many points to read in at a time and the start position in the file. By default, the system assumes a sample rate of 1, so in time, each sample is plotted versus the sample number. To set a true time axis, set the sample rate (-R or --sample-rate) to the sample rate used when capturing the samples."
+
+ parser = OptionParser(conflict_handler="resolve", usage=usage, description=description)
+ parser.add_option("-B", "--block", type="int", default=1000,
+ help="Specify the block size [default=%default]")
+ parser.add_option("-s", "--start", type="int", default=0,
+ help="Specify where to start in the file [default=%default]")
+ parser.add_option("-R", "--sample-rate", type="float", default=1.0,
+ help="Set the sampler rate of the data [default=%default]")
+
+ (options, args) = parser.parse_args ()
+ if len(args) != 1:
+ parser.print_help()
+ raise SystemExit, 1
+ filename = args[0]
+
+ dc = draw_iq(filename, options)
+
+if __name__ == "__main__":
+ try:
+ main()
+ except KeyboardInterrupt:
+ pass
+
+
+
diff --git a/gr-utils/src/python/gr_plot_psd b/gr-utils/src/python/gr_plot_psd
new file mode 100644
index 000000000..059ca6b64
--- /dev/null
+++ b/gr-utils/src/python/gr_plot_psd
@@ -0,0 +1,42 @@
+#!/usr/bin/env python
+#
+# 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.
+#
+
+from gnuradio.plot_psd_base import plot_psd_base
+
+# This is a wrapper program for plot_psd_base. It handles any data
+# type and defaults to complex64.
+
+def main():
+ parser = plot_psd_base.setup_options()
+ (options, args) = parser.parse_args ()
+ if len(args) != 1:
+ parser.print_help()
+ raise SystemExit, 1
+ filename = args[0]
+
+ dc = plot_psd_base(options.data_type, filename, options)
+
+if __name__ == "__main__":
+ try:
+ main()
+ except KeyboardInterrupt:
+ pass
diff --git a/gr-utils/src/python/gr_plot_psd_c b/gr-utils/src/python/gr_plot_psd_c
new file mode 100755
index 000000000..fff2bff0f
--- /dev/null
+++ b/gr-utils/src/python/gr_plot_psd_c
@@ -0,0 +1,47 @@
+#!/usr/bin/env python
+#
+# 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.
+#
+
+from optparse import OptionParser
+from gnuradio.plot_psd_base import plot_psd_base
+
+# This is a wrapper program for plot_psd_base specifically for complex data
+
+def main():
+ parser = plot_psd_base.setup_options()
+ parser.remove_option("--data-type")
+
+ (options, args) = parser.parse_args ()
+ if len(args) != 1:
+ parser.print_help()
+ raise SystemExit, 1
+ filename = args[0]
+
+ dc = plot_psd_base("complex64", filename, options)
+
+if __name__ == "__main__":
+ try:
+ main()
+ except KeyboardInterrupt:
+ pass
+
+
+
diff --git a/gr-utils/src/python/gr_plot_psd_f b/gr-utils/src/python/gr_plot_psd_f
new file mode 100755
index 000000000..ec6799479
--- /dev/null
+++ b/gr-utils/src/python/gr_plot_psd_f
@@ -0,0 +1,47 @@
+#!/usr/bin/env python
+#
+# 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.
+#
+
+from optparse import OptionParser
+from gnuradio.plot_psd_base import plot_psd_base
+
+# This is a wrapper program for gr_plot_psd specifically for floating point data
+
+def main():
+ parser = plot_psd_base.setup_options()
+ parser.remove_option("--data-type")
+
+ (options, args) = parser.parse_args ()
+ if len(args) != 1:
+ parser.print_help()
+ raise SystemExit, 1
+ filename = args[0]
+
+ dc = plot_psd_base("float32", filename, options)
+
+if __name__ == "__main__":
+ try:
+ main()
+ except KeyboardInterrupt:
+ pass
+
+
+
diff --git a/gr-utils/src/python/gr_plot_qt b/gr-utils/src/python/gr_plot_qt
new file mode 100755
index 000000000..153359f0c
--- /dev/null
+++ b/gr-utils/src/python/gr_plot_qt
@@ -0,0 +1,729 @@
+#!/usr/bin/env python
+
+try:
+ import scipy
+ from scipy import fftpack
+except ImportError:
+ print "Please install SciPy to run this script (http://www.scipy.org/)"
+ raise SystemExit, 1
+
+try:
+ from matplotlib import mlab
+except ImportError:
+ print "Please install Matplotlib to run this script (http://matplotlib.sourceforge.net)"
+ raise SystemExit, 1
+
+try:
+ from PyQt4 import Qt, QtCore, QtGui
+except ImportError:
+ print "Please install PyQt4 to run this script (http://www.riverbankcomputing.co.uk/software/pyqt/download)"
+ raise SystemExit, 1
+
+try:
+ import PyQt4.Qwt5 as Qwt
+except ImportError:
+ print "Please install PyQwt5 to run this script (http://pyqwt.sourceforge.net/)"
+ raise SystemExit, 1
+
+try:
+ # FIXME: reenable this before committing
+ #from gnuradio.pyqt_plot import Ui_MainWindow
+ from gnuradio.pyqt_plot import Ui_MainWindow
+except ImportError:
+ print "Could not import from pyqt_plot. Please build with \"pyuic4 pyqt_plot.ui -o pyqt_plot.py\""
+ raise SystemExit, 1
+
+import sys, os
+from optparse import OptionParser
+from gnuradio import eng_notation
+
+
+class SpectrogramData(Qwt.QwtRasterData):
+
+ def __init__(self, f, t):
+ Qwt.QwtArrayData.__init__(self, Qt.QRectF(0, 0, 0, 0))
+ self.sp = scipy.array([[0], [0]])
+
+ def set_data(self, xfreq, ytime, data):
+ self.sp = data
+ self.freq = xfreq
+ self.time = ytime
+ boundingBox = Qt.QRectF(self.freq.min(), self.time.min(),
+ self.freq.max() - self.freq.min(),
+ self.time.max() - self.time.min())
+ self.setBoundingRect(boundingBox)
+
+ def rasterHint(self, rect):
+ return Qt.QSize(self.sp.shape[0], self.sp.shape[1])
+
+ def copy(self):
+ return self
+
+ def range(self):
+
+ return Qwt.QwtDoubleInterval(self.sp.min(), self.sp.max())
+
+ def value(self, x, y):
+ try:
+ f = int(self.freq.searchsorted(x))
+ t = int(self.time.searchsorted(y))
+ return self.sp[f][t-1]
+ except AttributeError: # if no file loaded yet
+ return 0
+
+
+class gr_plot_qt(QtGui.QMainWindow):
+ def __init__(self, qapp, filename, options, parent=None):
+ QtGui.QWidget.__init__(self, parent)
+ self.gui = Ui_MainWindow()
+ self.gui.setupUi(self)
+
+ self.filename = None
+ self.block_length = options.block_length
+ self.start = options.start
+ self.sample_rate = options.sample_rate
+ self.psdfftsize = options.psd_size
+ self.specfftsize = options.spec_size
+ self.winfunc = scipy.blackman
+ self.sizeof_data = 8
+ self.datatype = scipy.complex64
+ self.pen_width = 1
+ self.iq = list()
+ self.time = list()
+
+ # Set up basic plot attributes
+ self.gui.timePlot.setAxisTitle(self.gui.timePlot.xBottom, "Time (sec)")
+ self.gui.timePlot.setAxisTitle(self.gui.timePlot.yLeft, "Amplitude (V)")
+ self.gui.freqPlot.setAxisTitle(self.gui.freqPlot.xBottom, "Frequency (Hz)")
+ self.gui.freqPlot.setAxisTitle(self.gui.freqPlot.yLeft, "Magnitude (dB)")
+ self.gui.specPlot.setAxisTitle(self.gui.specPlot.xBottom, "Frequency (Hz)")
+ self.gui.specPlot.setAxisTitle(self.gui.specPlot.yLeft, "Time (sec)")
+
+ # Set up FFT size combo box
+ self.fftsizes = ["128", "256", "512", "1024", "2048",
+ "4096", "8192", "16384", "32768"]
+ self.gui.psdFFTComboBox.addItems(self.fftsizes)
+ self.gui.specFFTComboBox.addItems(self.fftsizes)
+ pos = self.gui.psdFFTComboBox.findText(Qt.QString("%1").arg(self.psdfftsize))
+ self.gui.psdFFTComboBox.setCurrentIndex(pos)
+ pos = self.gui.specFFTComboBox.findText(Qt.QString("%1").arg(self.specfftsize))
+ self.gui.specFFTComboBox.setCurrentIndex(pos)
+
+ self.connect(self.gui.psdFFTComboBox,
+ Qt.SIGNAL("activated (const QString&)"),
+ self.psdFFTComboBoxEdit)
+ self.connect(self.gui.specFFTComboBox,
+ Qt.SIGNAL("activated (const QString&)"),
+ self.specFFTComboBoxEdit)
+
+ # Set up color scheme box
+ self.color_modes = {"Black on White" : self.color_black_on_white,
+ "White on Black" : self.color_white_on_black,
+ "Blue on Black" : self.color_blue_on_black,
+ "Green on Black" : self.color_green_on_black}
+ self.gui.colorComboBox.addItems(self.color_modes.keys())
+ pos = self.gui.colorComboBox.findText("Blue on Black")
+ self.gui.colorComboBox.setCurrentIndex(pos)
+ self.connect(self.gui.colorComboBox,
+ Qt.SIGNAL("activated (const QString&)"),
+ self.colorComboBoxEdit)
+
+
+ # Set up line style combo box
+ self.line_styles = {"None" : Qwt.QwtSymbol.NoSymbol,
+ "Circle" : Qwt.QwtSymbol.Ellipse,
+ "Diamond" : Qwt.QwtSymbol.Rect,
+ "Triangle" : Qwt.QwtSymbol.Triangle}
+ self.gui.lineStyleComboBox.addItems(self.line_styles.keys())
+ pos = self.gui.lineStyleComboBox.findText("None")
+ self.gui.lineStyleComboBox.setCurrentIndex(pos)
+ self.connect(self.gui.lineStyleComboBox,
+ Qt.SIGNAL("activated (const QString&)"),
+ self.lineStyleComboBoxEdit)
+
+ # Create zoom functionality for the plots
+ self.timeZoomer = Qwt.QwtPlotZoomer(self.gui.timePlot.xBottom,
+ self.gui.timePlot.yLeft,
+ Qwt.QwtPicker.PointSelection,
+ Qwt.QwtPicker.AlwaysOn,
+ self.gui.timePlot.canvas())
+
+ self.freqZoomer = Qwt.QwtPlotZoomer(self.gui.freqPlot.xBottom,
+ self.gui.freqPlot.yLeft,
+ Qwt.QwtPicker.PointSelection,
+ Qwt.QwtPicker.AlwaysOn,
+ self.gui.freqPlot.canvas())
+
+ self.specZoomer = Qwt.QwtPlotZoomer(self.gui.specPlot.xBottom,
+ self.gui.specPlot.yLeft,
+ Qwt.QwtPicker.PointSelection,
+ Qwt.QwtPicker.AlwaysOn,
+ self.gui.specPlot.canvas())
+
+ # Set up action when tab is changed
+ self.connect(self.gui.tabGroup,
+ Qt.SIGNAL("currentChanged (int)"),
+ self.tabChanged)
+
+ # Add a legend to the Time plot
+ legend_real = Qwt.QwtLegend()
+ self.gui.timePlot.insertLegend(legend_real)
+
+ # Set up slider
+ self.gui.plotHBar.setSingleStep(1)
+ self.gui.plotHBar.setPageStep(self.block_length)
+ self.gui.plotHBar.setMinimum(0)
+ self.gui.plotHBar.setMaximum(self.block_length)
+ self.connect(self.gui.plotHBar,
+ Qt.SIGNAL("valueChanged(int)"),
+ self.sliderMoved)
+
+ # Connect Open action to Open Dialog box
+ self.connect(self.gui.action_open,
+ Qt.SIGNAL("activated()"),
+ self.open_file)
+
+ # Connect Reload action to reload the file
+ self.connect(self.gui.action_reload,
+ Qt.SIGNAL("activated()"),
+ self.reload_file)
+ self.gui.action_reload.setShortcut(QtGui.QApplication.translate("MainWindow", "Ctrl+R",
+ None, QtGui.QApplication.UnicodeUTF8))
+
+ # Set up file position boxes to update current figure
+ self.connect(self.gui.filePosStartLineEdit,
+ Qt.SIGNAL("editingFinished()"),
+ self.file_position_changed)
+ self.connect(self.gui.filePosStopLineEdit,
+ Qt.SIGNAL("editingFinished()"),
+ self.file_position_changed)
+ self.connect(self.gui.filePosLengthLineEdit,
+ Qt.SIGNAL("editingFinished()"),
+ self.file_length_changed)
+
+ self.connect(self.gui.fileTimeStartLineEdit,
+ Qt.SIGNAL("editingFinished()"),
+ self.file_time_changed)
+ self.connect(self.gui.fileTimeStopLineEdit,
+ Qt.SIGNAL("editingFinished()"),
+ self.file_time_changed)
+ self.connect(self.gui.fileTimeLengthLineEdit,
+ Qt.SIGNAL("editingFinished()"),
+ self.file_time_length_changed)
+
+ stylestr = str(self.gui.lineStyleComboBox.currentText().toAscii())
+ style = self.line_styles[stylestr]
+
+ self.rcurve = Qwt.QwtPlotCurve("Real")
+ self.icurve = Qwt.QwtPlotCurve("Imaginary")
+ self.rsym = Qwt.QwtSymbol()
+ self.rsym.setStyle(style)
+ self.rsym.setSize(10)
+ self.isym = Qwt.QwtSymbol()
+ self.isym.setStyle(style)
+ self.isym.setSize(10)
+ self.rcurve.setSymbol(self.rsym)
+ self.icurve.setSymbol(self.isym)
+
+
+ self.icurve.attach(self.gui.timePlot)
+ self.rcurve.attach(self.gui.timePlot)
+
+ self.psdcurve = Qwt.QwtPlotCurve("PSD")
+ self.psdcurve.attach(self.gui.freqPlot)
+
+ # Set up specTab plot as a spectrogram
+ self.specdata = SpectrogramData(range(0, 10), range(0, 10))
+
+ colorMap = Qwt.QwtLinearColorMap(Qt.Qt.darkCyan, Qt.Qt.red)
+ colorMap.addColorStop(0.1, Qt.Qt.cyan)
+ colorMap.addColorStop(0.6, Qt.Qt.green)
+ colorMap.addColorStop(0.95, Qt.Qt.yellow)
+
+ self.spec = Qwt.QwtPlotSpectrogram()
+ self.spec.setColorMap(colorMap)
+ self.spec.attach(self.gui.specPlot)
+ self.spec.setDisplayMode(Qwt.QwtPlotSpectrogram.ImageMode, True)
+ self.spec.setData(self.specdata)
+
+ self.rightAxis = self.gui.specPlot.axisWidget(Qwt.QwtPlot.yRight)
+ self.rightAxis.setTitle("Magnitude (dBm)")
+ self.rightAxis.setColorBarEnabled(True)
+ self.rightAxis.setColorMap(self.spec.data().range(),
+ self.spec.colorMap())
+ self.gui.specPlot.enableAxis(Qwt.QwtPlot.yRight)
+
+ # Set up initial color scheme
+ self.color_modes["Blue on Black"]()
+
+ # When line width spin box changes, update the pen size
+ self.connect(self.gui.lineWidthSpinBox,
+ Qt.SIGNAL("valueChanged(int)"),
+ self.change_pen_width)
+ self.gui.lineWidthSpinBox.setRange(1, 10)
+
+ # When style size spin box changes, update the pen size
+ self.connect(self.gui.styleSizeSpinBox,
+ Qt.SIGNAL("valueChanged(int)"),
+ self.change_style_size)
+ self.gui.styleSizeSpinBox.setRange(1, 20)
+ self.gui.styleSizeSpinBox.setValue(5)
+
+
+ # Connect a signal for when the sample rate changes
+ self.set_sample_rate(self.sample_rate)
+ self.connect(self.gui.sampleRateLineEdit,
+ Qt.SIGNAL("editingFinished()"),
+ self.sample_rate_changed)
+
+ if(filename is not None):
+ self.initialize(filename)
+
+ self.show()
+
+ def open_file(self):
+ filename = Qt.QFileDialog.getOpenFileName(self, "Open", ".")
+ if(filename != ""):
+ #print filename
+ self.initialize(filename)
+
+ def reload_file(self):
+ if(self.filename):
+ self.initialize(self.filename)
+
+ def initialize(self, filename):
+ self.filename = filename
+ self.hfile = open(filename, "r")
+
+ self.setWindowTitle(("GNU Radio File Plot Utility: %s" % filename))
+
+ self.gui.filePosStartLineEdit.setText("0")
+ self.gui.filePosStopLineEdit.setText("0")
+ self.gui.fileTimeStartLineEdit.setText("0")
+ self.gui.fileTimeStopLineEdit.setText("0")
+
+ self.cur_start = 0
+ self.cur_stop = self.block_length
+
+ self.init_data_input()
+ self.get_data(self.cur_start, self.cur_stop)
+ self.get_psd()
+ self.get_specgram()
+ self.gui.plotHBar.setSliderPosition(0)
+ self.gui.plotHBar.setMaximum(self.signal_size-self.block_length)
+
+
+ self.update_time_curves()
+ self.update_psd_curves()
+ self.update_specgram_curves()
+
+ def init_data_input(self):
+ self.hfile.seek(0, os.SEEK_END)
+ self.signal_size = self.hfile.tell()/self.sizeof_data
+ #print "Sizeof File: ", self.signal_size
+ self.hfile.seek(0, os.SEEK_SET)
+
+ def get_data(self, start, end):
+ if(end > start):
+ self.hfile.seek(start*self.sizeof_data, os.SEEK_SET)
+ self.position = start
+ try:
+ iq = scipy.fromfile(self.hfile, dtype=self.datatype,
+ count=end-start)
+
+ if(len(iq) < (end-start)):
+ end = start + len(iq)
+ self.gui.filePosLengthLineEdit.setText(Qt.QString("%1").arg(len(iq)))
+ self.file_length_changed()
+
+ tstep = 1.0 / self.sample_rate
+ self.iq = iq
+ self.time = [tstep*(self.position + i) for i in xrange(len(self.iq))]
+
+ self.set_file_pos_box(start, end)
+ except MemoryError:
+ pass
+ else:
+ # Do we want to do anything about this?
+ pass
+
+ def get_psd(self):
+ winpoints = self.winfunc(self.psdfftsize)
+ iq_psd, freq = mlab.psd(self.iq, Fs=self.sample_rate,
+ NFFT=self.psdfftsize,
+ noverlap=self.psdfftsize/4.0,
+ window=winpoints,
+ scale_by_freq=False)
+
+ self.iq_psd = 10.0*scipy.log10(abs(fftpack.fftshift(iq_psd)))
+ self.freq = freq - self.sample_rate/2.0
+
+ def get_specgram(self):
+ winpoints = self.winfunc(self.specfftsize)
+ iq_spec, f, t = mlab.specgram(self.iq, Fs=self.sample_rate,
+ NFFT=self.specfftsize,
+ noverlap=self.specfftsize/4.0,
+ window=winpoints,
+ scale_by_freq=False)
+
+ self.iq_spec = 10.0*scipy.log10(abs(iq_spec))
+ self.spec_f = f
+ self.spec_t = t
+
+ def psdFFTComboBoxEdit(self, fftSize):
+ self.psdfftsize = fftSize.toInt()[0]
+ self.get_psd()
+ self.update_psd_curves()
+
+ def specFFTComboBoxEdit(self, fftSize):
+ self.specfftsize = fftSize.toInt()[0]
+ self.get_specgram()
+ self.update_specgram_curves()
+
+ def colorComboBoxEdit(self, colorSelection):
+ colorstr = str(colorSelection.toAscii())
+ color_func = self.color_modes[colorstr]
+ color_func()
+
+ def lineStyleComboBoxEdit(self, styleSelection):
+ stylestr = str(styleSelection.toAscii())
+ self.rsym.setStyle(self.line_styles[stylestr])
+ self.isym.setStyle(self.line_styles[stylestr])
+ self.rcurve.setSymbol(self.rsym)
+ self.icurve.setSymbol(self.isym)
+ self.gui.timePlot.replot()
+
+ def sliderMoved(self, value):
+ pos_start = value
+ pos_end = value + self.gui.plotHBar.pageStep()
+
+ self.get_data(pos_start, pos_end)
+ self.get_psd()
+ self.get_specgram()
+ self.update_time_curves()
+ self.update_psd_curves()
+ self.update_specgram_curves()
+
+ def set_sample_rate(self, sr):
+ self.sample_rate = sr
+ srstr = eng_notation.num_to_str(self.sample_rate)
+ self.gui.sampleRateLineEdit.setText(Qt.QString("%1").arg(srstr))
+
+ def sample_rate_changed(self):
+ srstr = self.gui.sampleRateLineEdit.text().toAscii()
+ self.sample_rate = eng_notation.str_to_num(srstr)
+ self.set_file_pos_box(self.cur_start, self.cur_stop)
+ self.get_data(self.cur_start, self.cur_stop)
+ self.get_psd()
+ self.get_specgram()
+ self.update_time_curves()
+ self.update_psd_curves()
+ self.update_specgram_curves()
+
+ def set_file_pos_box(self, start, end):
+ tstart = start / self.sample_rate
+ tend = end / self.sample_rate
+
+ self.gui.filePosStartLineEdit.setText(Qt.QString("%1").arg(start))
+ self.gui.filePosStopLineEdit.setText(Qt.QString("%1").arg(end))
+ self.gui.filePosLengthLineEdit.setText(Qt.QString("%1").arg(end-start))
+
+ self.gui.fileTimeStartLineEdit.setText(Qt.QString("%1").arg(tstart))
+ self.gui.fileTimeStopLineEdit.setText(Qt.QString("%1").arg(tend))
+ self.gui.fileTimeLengthLineEdit.setText(Qt.QString("%1").arg(tend-tstart))
+
+ def file_position_changed(self):
+ start = self.gui.filePosStartLineEdit.text().toInt()
+ end = self.gui.filePosStopLineEdit.text().toInt()
+ if((start[1] == True) and (end[1] == True)):
+ self.cur_start = start[0]
+ self.cur_stop = end[0]
+
+ tstart = self.cur_start / self.sample_rate
+ tend = self.cur_stop / self.sample_rate
+ self.gui.fileTimeStartLineEdit.setText(Qt.QString("%1").arg(tstart))
+ self.gui.fileTimeStopLineEdit.setText(Qt.QString("%1").arg(tend))
+
+ self.get_data(self.cur_start, self.cur_stop)
+
+ self.update_time_curves()
+ self.update_psd_curves()
+ self.update_specgram_curves()
+
+ # If there's a non-digit character, reset box
+ else:
+ try:
+ self.set_file_pos_box(self.cur_start, self.cur_stop)
+ except AttributeError:
+ pass
+
+
+ def file_time_changed(self):
+ tstart = self.gui.fileTimeStartLineEdit.text().toDouble()
+ tstop = self.gui.fileTimeStopLineEdit.text().toDouble()
+ if((tstart[1] == True) and (tstop[1] == True)):
+ self.cur_start = int(tstart[0] * self.sample_rate)
+ self.cur_stop = int(tstop[0] * self.sample_rate)
+ self.get_data(self.cur_start, self.cur_stop)
+
+ self.gui.filePosStartLineEdit.setText(Qt.QString("%1").arg(self.cur_start))
+ self.gui.filePosStopLineEdit.setText(Qt.QString("%1").arg(self.cur_stop))
+
+ self.update_time_curves()
+ self.update_psd_curves()
+ self.update_specgram_curves()
+ # If there's a non-digit character, reset box
+ else:
+ self.set_file_pos_box(self.cur_start, self.cur_stop)
+
+ def file_length_changed(self):
+ start = self.gui.filePosStartLineEdit.text().toInt()
+ length = self.gui.filePosLengthLineEdit.text().toInt()
+
+ if((start[1] == True) and (length[1] == True)):
+ self.cur_start = start[0]
+ self.block_length = length[0]
+ self.cur_stop = self.cur_start + self.block_length
+
+ tstart = self.cur_start / self.sample_rate
+ tend = self.cur_stop / self.sample_rate
+ tlen = self.block_length / self.sample_rate
+ self.gui.fileTimeStartLineEdit.setText(Qt.QString("%1").arg(tstart))
+ self.gui.fileTimeStopLineEdit.setText(Qt.QString("%1").arg(tend))
+ self.gui.fileTimeLengthLineEdit.setText(Qt.QString("%1").arg(tlen))
+
+ self.gui.plotHBar.setPageStep(self.block_length)
+
+ self.get_data(self.cur_start, self.cur_stop)
+ self.get_psd()
+ self.get_specgram()
+
+ self.update_time_curves()
+ self.update_psd_curves()
+ self.update_specgram_curves()
+ # If there's a non-digit character, reset box
+ else:
+ self.set_file_pos_box(self.cur_start, self.cur_stop)
+
+ def file_time_length_changed(self):
+ tstart = self.gui.fileTimeStartLineEdit.text().toDouble()
+ tlength = self.gui.fileTimeLengthLineEdit.text().toDouble()
+ if((tstart[1] == True) and (tlength[1] == True)):
+ self.cur_start = int(tstart[0] * self.sample_rate)
+ self.block_length = int(tlength[0] * self.sample_rate)
+ self.cur_stop = self.cur_start + self.block_length
+
+ tstart = self.cur_start / self.sample_rate
+ tend = self.cur_stop / self.sample_rate
+ tlen = self.block_length / self.sample_rate
+ self.gui.fileTimeStartLineEdit.setText(Qt.QString("%1").arg(tstart))
+ self.gui.fileTimeStopLineEdit.setText(Qt.QString("%1").arg(tend))
+ self.gui.fileTimeLengthLineEdit.setText(Qt.QString("%1").arg(tlen))
+
+ self.get_data(self.cur_start, self.cur_stop)
+ self.get_psd()
+ self.get_specgram()
+
+ self.update_time_curves()
+ self.update_psd_curves()
+ self.update_specgram_curves()
+ # If there's a non-digit character, reset box
+ else:
+ self.set_file_pos_box(self.cur_start, self.cur_stop)
+
+
+ def update_time_curves(self):
+ self.icurve.setData(self.time, self.iq.imag)
+ self.rcurve.setData(self.time, self.iq.real)
+
+ # Reset the x-axis to the new time scale
+ iqmax = 1.5 * max(max(self.iq.real), max(self.iq.imag))
+ iqmin = 1.5 * min(min(self.iq.real), min(self.iq.imag))
+ self.gui.timePlot.setAxisScale(self.gui.timePlot.xBottom,
+ min(self.time),
+ max(self.time))
+ self.gui.timePlot.setAxisScale(self.gui.timePlot.yLeft,
+ iqmin,
+ iqmax)
+
+ # Set the zoomer base to unzoom to the new axis
+ self.timeZoomer.setZoomBase()
+
+ self.gui.timePlot.replot()
+
+ def update_psd_curves(self):
+ self.psdcurve.setData(self.freq, self.iq_psd)
+
+ self.gui.freqPlot.setAxisScale(self.gui.freqPlot.xBottom,
+ min(self.freq),
+ max(self.freq))
+
+ # Set the zoomer base to unzoom to the new axis
+ self.freqZoomer.setZoomBase()
+
+ self.gui.freqPlot.replot()
+
+ def update_specgram_curves(self):
+ # We don't have to reset the data for the speccurve here
+ # since this is taken care of in the SpectrogramData class
+ self.specdata.set_data(self.spec_f, self.spec_t, self.iq_spec)
+
+ # Set the color map based on the new data
+ self.rightAxis.setColorMap(self.spec.data().range(),
+ self.spec.colorMap())
+
+ # Set the new axis base; include right axis for the intenisty color bar
+ self.gui.specPlot.setAxisScale(self.gui.specPlot.xBottom,
+ min(self.spec_f),
+ max(self.spec_f))
+ self.gui.specPlot.setAxisScale(self.gui.specPlot.yLeft,
+ min(self.spec_t),
+ max(self.spec_t))
+ self.gui.specPlot.setAxisScale(self.gui.specPlot.yRight,
+ self.iq_spec.min(),
+ self.iq_spec.max())
+
+ # Set the zoomer base to unzoom to the new axis
+ self.specZoomer.setZoomBase()
+
+ self.gui.specPlot.replot()
+
+ def tabChanged(self, index):
+ self.gui.timePlot.replot()
+ self.gui.freqPlot.replot()
+ self.gui.specPlot.replot()
+
+ def change_pen_width(self, width):
+ self.pen_width = width
+ colormode = str(self.gui.colorComboBox.currentText().toAscii())
+ color_func = self.color_modes[colormode]()
+
+ def change_style_size(self, size):
+ self.rsym.setSize(size)
+ self.isym.setSize(size)
+ self.rcurve.setSymbol(self.rsym)
+ self.icurve.setSymbol(self.isym)
+ self.gui.timePlot.replot()
+
+ def color_black_on_white(self):
+ blue = QtGui.qRgb(0x00, 0x00, 0xFF)
+ red = QtGui.qRgb(0xFF, 0x00, 0x00)
+
+ blackPen = Qt.QPen(Qt.QBrush(Qt.QColor("black")), self.pen_width)
+ bluePen = Qt.QPen(Qt.QBrush(Qt.QColor(blue)), self.pen_width)
+ redPen = Qt.QPen(Qt.QBrush(Qt.QColor(red)), self.pen_width)
+
+ self.gui.timePlot.setCanvasBackground(Qt.QColor("white"))
+ self.gui.freqPlot.setCanvasBackground(Qt.QColor("white"))
+ self.timeZoomer.setTrackerPen(blackPen)
+ self.timeZoomer.setRubberBandPen(blackPen)
+ self.freqZoomer.setTrackerPen(blackPen)
+ self.freqZoomer.setRubberBandPen(blackPen)
+ self.psdcurve.setPen(bluePen)
+ self.rcurve.setPen(bluePen)
+ self.icurve.setPen(redPen)
+
+ self.rsym.setPen(bluePen)
+ self.isym.setPen(redPen)
+
+ self.gui.timePlot.replot()
+ self.gui.freqPlot.replot()
+
+ def color_white_on_black(self):
+ white = QtGui.qRgb(0xFF, 0xFF, 0xFF)
+ red = QtGui.qRgb(0xFF, 0x00, 0x00)
+
+ whiteBrush = Qt.QBrush(Qt.QColor("white"))
+ whiteBrush = Qt.QBrush(Qt.QColor(white))
+ redBrush = Qt.QBrush(Qt.QColor(red))
+
+ self.gui.timePlot.setCanvasBackground(QtGui.QColor("black"))
+ self.gui.freqPlot.setCanvasBackground(QtGui.QColor("black"))
+ self.timeZoomer.setTrackerPen(Qt.QPen(whiteBrush, self.pen_width))
+ self.timeZoomer.setRubberBandPen(Qt.QPen(whiteBrush, self.pen_width))
+ self.freqZoomer.setTrackerPen(Qt.QPen(whiteBrush, self.pen_width))
+ self.freqZoomer.setRubberBandPen(Qt.QPen(whiteBrush, self.pen_width))
+ self.psdcurve.setPen(Qt.QPen(whiteBrush, self.pen_width))
+ self.rcurve.setPen(Qt.QPen(whiteBrush, self.pen_width))
+ self.icurve.setPen(Qt.QPen(redBrush, self.pen_width))
+
+ self.gui.timePlot.replot()
+ self.gui.freqPlot.replot()
+
+
+ def color_green_on_black(self):
+ green = QtGui.qRgb(0x00, 0xFF, 0x00)
+ red = QtGui.qRgb(0xFF, 0x00, 0x50)
+
+ whiteBrush = Qt.QBrush(Qt.QColor("white"))
+ greenBrush = Qt.QBrush(Qt.QColor(green))
+ redBrush = Qt.QBrush(Qt.QColor(red))
+
+ self.gui.timePlot.setCanvasBackground(QtGui.QColor("black"))
+ self.gui.freqPlot.setCanvasBackground(QtGui.QColor("black"))
+ self.timeZoomer.setTrackerPen(Qt.QPen(whiteBrush, self.pen_width))
+ self.timeZoomer.setRubberBandPen(Qt.QPen(whiteBrush, self.pen_width))
+ self.freqZoomer.setTrackerPen(Qt.QPen(whiteBrush, self.pen_width))
+ self.freqZoomer.setRubberBandPen(Qt.QPen(whiteBrush, self.pen_width))
+ self.psdcurve.setPen(Qt.QPen(greenBrush, self.pen_width))
+ self.rcurve.setPen(Qt.QPen(greenBrush, self.pen_width))
+ self.icurve.setPen(Qt.QPen(redBrush, self.pen_width))
+
+ self.gui.timePlot.replot()
+ self.gui.freqPlot.replot()
+
+ def color_blue_on_black(self):
+ blue = QtGui.qRgb(0x00, 0x00, 0xFF)
+ red = QtGui.qRgb(0xFF, 0x00, 0x00)
+
+ whiteBrush = Qt.QBrush(Qt.QColor("white"))
+ blueBrush = Qt.QBrush(Qt.QColor(blue))
+ redBrush = Qt.QBrush(Qt.QColor(red))
+
+ self.gui.timePlot.setCanvasBackground(QtGui.QColor("black"))
+ self.gui.freqPlot.setCanvasBackground(QtGui.QColor("black"))
+ self.timeZoomer.setTrackerPen(Qt.QPen(whiteBrush, self.pen_width))
+ self.timeZoomer.setRubberBandPen(Qt.QPen(whiteBrush, self.pen_width))
+ self.freqZoomer.setTrackerPen(Qt.QPen(whiteBrush, self.pen_width))
+ self.freqZoomer.setRubberBandPen(Qt.QPen(whiteBrush, self.pen_width))
+ self.psdcurve.setPen(Qt.QPen(blueBrush, self.pen_width))
+ self.rcurve.setPen(Qt.QPen(blueBrush, self.pen_width))
+ self.icurve.setPen(Qt.QPen(redBrush, self.pen_width))
+
+ self.gui.timePlot.replot()
+ self.gui.freqPlot.replot()
+
+def setup_options():
+ usage="%prog: [options] (input_filename)"
+ description = ""
+
+ parser = OptionParser(conflict_handler="resolve", usage=usage, description=description)
+ parser.add_option("-B", "--block-length", type="int", default=8192,
+ help="Specify the block size [default=%default]")
+ parser.add_option("-s", "--start", type="int", default=0,
+ help="Specify where to start in the file [default=%default]")
+ parser.add_option("-R", "--sample-rate", type="float", default=1.0,
+ help="Set the sampler rate of the data [default=%default]")
+ parser.add_option("", "--psd-size", type="int", default=2048,
+ help="Set the size of the PSD FFT [default=%default]")
+ parser.add_option("", "--spec-size", type="int", default=2048,
+ help="Set the size of the spectrogram FFT [default=%default]")
+
+ return parser
+
+def main(args):
+ parser = setup_options()
+ (options, args) = parser.parse_args ()
+
+ if(len(args) == 1):
+ filename = args[0]
+ else:
+ filename = None
+
+ app = Qt.QApplication(args)
+ gplt = gr_plot_qt(app, filename, options)
+ app.exec_()
+
+if __name__ == '__main__':
+ main(sys.argv)
+
diff --git a/gr-utils/src/python/gr_plot_short b/gr-utils/src/python/gr_plot_short
new file mode 100755
index 000000000..702a2a94a
--- /dev/null
+++ b/gr-utils/src/python/gr_plot_short
@@ -0,0 +1,58 @@
+#!/usr/bin/env python
+#
+# Copyright 2007,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.
+#
+
+try:
+ import scipy
+except ImportError:
+ print "Please install SciPy to run this script (http://www.scipy.org/)"
+ raise SystemExit, 1
+
+from optparse import OptionParser
+from gnuradio.plot_data import plot_data
+
+def main():
+ usage="%prog: [options] input_filenames"
+ description = "Takes a GNU Radio short integer binary file and displays the samples versus time. You can set the block size to specify how many points to read in at a time and the start position in the file. By default, the system assumes a sample rate of 1, so in time, each sample is plotted versus the sample number. To set a true time axis, set the sample rate (-R or --sample-rate) to the sample rate used when capturing the samples."
+
+ parser = OptionParser(conflict_handler="resolve", usage=usage, description=description)
+ parser.add_option("-B", "--block", type="int", default=1000,
+ help="Specify the block size [default=%default]")
+ parser.add_option("-s", "--start", type="int", default=0,
+ help="Specify where to start in the file [default=%default]")
+ parser.add_option("-R", "--sample-rate", type="float", default=1.0,
+ help="Set the sampler rate of the data [default=%default]")
+
+ (options, args) = parser.parse_args ()
+ if len(args) < 1:
+ parser.print_help()
+ raise SystemExit, 1
+ filenames = args
+
+ datatype=scipy.int16
+ dc = plot_data(datatype, filenames, options)
+
+if __name__ == "__main__":
+ try:
+ main()
+ except KeyboardInterrupt:
+ pass
+
diff --git a/gr-utils/src/python/gr_read_file_metadata b/gr-utils/src/python/gr_read_file_metadata
new file mode 100644
index 000000000..cf0cd5b11
--- /dev/null
+++ b/gr-utils/src/python/gr_read_file_metadata
@@ -0,0 +1,87 @@
+#!/usr/bin/env python
+#
+# 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.
+#
+
+import sys
+from optparse import OptionParser
+
+from gruel import pmt
+from gnuradio.blocks import parse_file_metadata
+
+def main(filename, detached=False):
+ handle = open(filename, "rb")
+
+ nheaders = 0
+ nread = 0
+ while(True):
+ # read out next header bytes
+ hdr_start = handle.tell()
+ header_str = handle.read(parse_file_metadata.HEADER_LENGTH)
+ if(len(header_str) == 0):
+ break
+
+ # Convert from string to PMT (should be a dictionary)
+ try:
+ header = pmt.pmt_deserialize_str(header_str)
+ except RuntimeError:
+ sys.stderr.write("Could not deserialize header: invalid or corrupt data file.\n")
+ sys.exit(1)
+
+ print "HEADER {0}".format(nheaders)
+ info = parse_file_metadata.parse_header(header, True)
+
+ if(info["extra_len"] > 0):
+ extra_str = handle.read(info["extra_len"])
+ if(len(extra_str) == 0):
+ break
+
+ try:
+ extra = pmt.pmt_deserialize_str(extra_str)
+ except RuntimeError:
+ sys.stderr.write("Could not deserialize extras: invalid or corrupt data file.\n")
+ sys.exit(1)
+
+ print "\nExtra Header:"
+ extra_info = parse_file_metadata.parse_extra_dict(extra, info, True)
+
+ nheaders += 1
+ nread += parse_file_metadata.HEADER_LENGTH + info["extra_len"]
+ if(not detached):
+ nread += info['nbytes']
+ handle.seek(nread, 0)
+ print "\n\n"
+
+if __name__ == "__main__":
+ usage="%prog: [options] filename"
+ description = "Read in a GNU Radio file with meta data, extracts the header and prints it."
+
+ parser = OptionParser(conflict_handler="resolve",
+ usage=usage, description=description)
+ parser.add_option("-D", "--detached", action="store_true", default=False,
+ help="Used if header is detached.")
+ (options, args) = parser.parse_args ()
+
+ if(len(args) < 1):
+ sys.stderr.write("No filename given\n")
+ sys.exit(1)
+
+ filename = args[0]
+ main(filename, options.detached)
diff --git a/gr-utils/src/python/grcc b/gr-utils/src/python/grcc
new file mode 100755
index 000000000..7e5665dc0
--- /dev/null
+++ b/gr-utils/src/python/grcc
@@ -0,0 +1,66 @@
+#!/usr/bin/env python
+#
+# 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.
+#
+
+try:
+ from grc.python.Platform import Platform
+except ImportError:
+ from gnuradio.grc.python.Platform import Platform
+
+from optparse import OptionParser
+import os, sys
+
+class grcc:
+ def __init__(self, grcfile, out_dir):
+ self.out_dir = out_dir
+ self.platform = Platform()
+ data = self.platform.parse_flow_graph(grcfile)
+
+ self.fg = self.platform.get_new_flow_graph()
+ self.fg.import_data(data)
+ self.fg.validate()
+
+ self.gen = self.platform.get_generator()(self.fg, out_dir)
+ self.gen.write()
+
+ def exec_program(self):
+ progname = self.fg.get_option('id')
+ os.system("{0}/{1}.py".format(self.out_dir, progname))
+
+if __name__ == "__main__":
+ usage="%prog: [options] filename"
+ description = "Compiles a GRC file (.grc) into a GNU Radio Python program. The program is stored in ~/.grc_gnuradio by default, but this location can be changed with the -d option."
+
+ parser = OptionParser(conflict_handler="resolve", usage=usage, description=description)
+ parser.add_option("-d", "--directory", type="string", default='{0}/.grc_gnuradio/'.format(os.environ["HOME"]),
+ help="Specify the directory to output the compile program [default=%default]")
+ parser.add_option("-e", "--execute", action="store_true", default=False,
+ help="Run the program after compiling [default=%default]")
+ (options, args) = parser.parse_args ()
+
+ if(len(args) != 1):
+ sys.stderr.write("Please specify a GRC file name to compile.\n")
+ sys.exit(1)
+
+ g = grcc(args[0], options.directory+"/")
+
+ if(options.execute):
+ g.exec_program()
diff --git a/gr-utils/src/python/modtool/CMakeLists.txt b/gr-utils/src/python/modtool/CMakeLists.txt
new file mode 100644
index 000000000..7647c86f6
--- /dev/null
+++ b/gr-utils/src/python/modtool/CMakeLists.txt
@@ -0,0 +1,62 @@
+# Copyright 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.
+
+GR_PYTHON_INSTALL(FILES
+ __init__.py
+ cmakefile_editor.py
+ code_generator.py
+ grc_xml_generator.py
+ modtool_add.py
+ modtool_base.py
+ modtool_disable.py
+ modtool_help.py
+ modtool_info.py
+ modtool_makexml.py
+ modtool_newmod.py
+ modtool_rm.py
+ parser_cc_block.py
+ templates.py
+ util_functions.py
+ DESTINATION ${GR_PYTHON_DIR}/gnuradio/modtool
+ COMPONENT "utils"
+)
+
+set(GR_PKG_MODTOOL_DATA_DIR ${GR_PKG_DATA_DIR}/modtool)
+install(DIRECTORY gr-newmod
+ DESTINATION ${GR_PKG_MODTOOL_DATA_DIR}
+ COMPONENT "utils"
+)
+
+
+########################################################################
+# Create and install the modtool conf file
+########################################################################
+file(TO_NATIVE_PATH ${CMAKE_INSTALL_PREFIX}/${GR_PKG_MODTOOL_DATA_DIR}/gr-newmod newmoddir)
+
+configure_file(
+ ${CMAKE_CURRENT_SOURCE_DIR}/modtool.conf.in
+ ${CMAKE_CURRENT_BINARY_DIR}/modtool.conf
+@ONLY)
+
+install(
+ FILES ${CMAKE_CURRENT_BINARY_DIR}/modtool.conf
+ DESTINATION ${GR_PREFSDIR}
+ COMPONENT "utils"
+)
+
diff --git a/gr-utils/src/python/modtool/README.modtool b/gr-utils/src/python/modtool/README.modtool
new file mode 100644
index 000000000..84c2e66c1
--- /dev/null
+++ b/gr-utils/src/python/modtool/README.modtool
@@ -0,0 +1,19 @@
+gr_modtool: Swiss Army Knife for editing GNU Radio modules and -components.
+
+Adding a new subcommand
+=======================
+
+* Add a new file called modtool_SUBCOMMAND
+* Have a look at the other subcommands, it must inherit from ModTool
+* Add that file to __init__.py and CMakeLists.txt
+
+The gr-newmod directory
+=======================
+This dir basically contains a copy of gr-howto-write-a-block from the gnuradio
+sources, with some differences:
+- All example blocks, apps, grc files (...) and references thereto in the
+ CMake files are removed
+- In the top-level CMake file, the project is called 'gr-howto'.
+- Any time anything relevant is changed in gr-howto-write-a-block, it should
+ be changed here, too.
+
diff --git a/gr-utils/src/python/modtool/__init__.py b/gr-utils/src/python/modtool/__init__.py
new file mode 100644
index 000000000..a242722ab
--- /dev/null
+++ b/gr-utils/src/python/modtool/__init__.py
@@ -0,0 +1,35 @@
+#
+# Copyright 2013 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 cmakefile_editor import CMakeFileEditor
+from code_generator import GRMTemplate
+from grc_xml_generator import GRCXMLGenerator
+from modtool_base import ModTool, get_class_dict
+from modtool_add import ModToolAdd
+from modtool_disable import ModToolDisable
+from modtool_info import ModToolInfo
+from modtool_makexml import ModToolMakeXML
+from modtool_newmod import ModToolNewModule
+from modtool_rm import ModToolRemove
+# Leave this at the end
+from modtool_help import ModToolHelp
+from parser_cc_block import ParserCCBlock
+from util_functions import *
diff --git a/gr-utils/src/python/modtool/cmakefile_editor.py b/gr-utils/src/python/modtool/cmakefile_editor.py
new file mode 100644
index 000000000..3d90b8d16
--- /dev/null
+++ b/gr-utils/src/python/modtool/cmakefile_editor.py
@@ -0,0 +1,113 @@
+#
+# Copyright 2013 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.
+#
+""" Edit CMakeLists.txt files """
+
+import re
+
+class CMakeFileEditor(object):
+ """A tool for editing CMakeLists.txt files. """
+ def __init__(self, filename, separator='\n ', indent=' '):
+ self.filename = filename
+ self.cfile = open(filename, 'r').read()
+ self.separator = separator
+ self.indent = indent
+
+ def append_value(self, entry, value, to_ignore_start='', to_ignore_end=''):
+ """ Add a value to an entry. """
+ regexp = re.compile('(%s\(%s[^()]*?)\s*?(\s?%s)\)' % (entry, to_ignore_start, to_ignore_end),
+ re.MULTILINE)
+ substi = r'\1' + self.separator + value + r'\2)'
+ (self.cfile, nsubs) = regexp.subn(substi, self.cfile, count=1)
+ return nsubs
+
+ def remove_value(self, entry, value, to_ignore_start='', to_ignore_end=''):
+ """Remove a value from an entry."""
+ regexp = '^\s*(%s\(\s*%s[^()]*?\s*)%s\s*([^()]*%s\s*\))' % (entry, to_ignore_start, value, to_ignore_end)
+ regexp = re.compile(regexp, re.MULTILINE)
+ (self.cfile, nsubs) = re.subn(regexp, r'\1\2', self.cfile, count=1)
+ return nsubs
+
+ def delete_entry(self, entry, value_pattern=''):
+ """Remove an entry from the current buffer."""
+ regexp = '%s\s*\([^()]*%s[^()]*\)[^\n]*\n' % (entry, value_pattern)
+ regexp = re.compile(regexp, re.MULTILINE)
+ (self.cfile, nsubs) = re.subn(regexp, '', self.cfile, count=1)
+ return nsubs
+
+ def write(self):
+ """ Write the changes back to the file. """
+ open(self.filename, 'w').write(self.cfile)
+
+ def remove_double_newlines(self):
+ """Simply clear double newlines from the file buffer."""
+ self.cfile = re.compile('\n\n\n+', re.MULTILINE).sub('\n\n', self.cfile)
+
+ def find_filenames_match(self, regex):
+ """ Find the filenames that match a certain regex
+ on lines that aren't comments """
+ filenames = []
+ reg = re.compile(regex)
+ fname_re = re.compile('[a-zA-Z]\w+\.\w{1,5}$')
+ for line in self.cfile.splitlines():
+ if len(line.strip()) == 0 or line.strip()[0] == '#':
+ continue
+ for word in re.split('[ /)(\t\n\r\f\v]', line):
+ if fname_re.match(word) and reg.search(word):
+ filenames.append(word)
+ return filenames
+
+ def disable_file(self, fname):
+ """ Comment out a file.
+ Example:
+ add_library(
+ file1.cc
+ )
+
+ Here, file1.cc becomes #file1.cc with disable_file('file1.cc').
+ """
+ starts_line = False
+ for line in self.cfile.splitlines():
+ if len(line.strip()) == 0 or line.strip()[0] == '#':
+ continue
+ if re.search(r'\b'+fname+r'\b', line):
+ if re.match(fname, line.lstrip()):
+ starts_line = True
+ break
+ comment_out_re = r'#\1' + '\n' + self.indent
+ if not starts_line:
+ comment_out_re = r'\n' + self.indent + comment_out_re
+ (self.cfile, nsubs) = re.subn(r'(\b'+fname+r'\b)\s*', comment_out_re, self.cfile)
+ if nsubs == 0:
+ print "Warning: A replacement failed when commenting out %s. Check the CMakeFile.txt manually." % fname
+ elif nsubs > 1:
+ print "Warning: Replaced %s %d times (instead of once). Check the CMakeFile.txt manually." % (fname, nsubs)
+
+ def comment_out_lines(self, pattern, comment_str='#'):
+ """ Comments out all lines that match with pattern """
+ for line in self.cfile.splitlines():
+ if re.search(pattern, line):
+ self.cfile = self.cfile.replace(line, comment_str+line)
+
+ def check_for_glob(self, globstr):
+ """ Returns true if a glob as in globstr is found in the cmake file """
+ glob_re = r'GLOB\s[a-z_]+\s"%s"' % globstr.replace('*', '\*')
+ return re.search(glob_re, self.cfile, flags=re.MULTILINE|re.IGNORECASE) is not None
+
diff --git a/gr-utils/src/python/modtool/code_generator.py b/gr-utils/src/python/modtool/code_generator.py
new file mode 100644
index 000000000..f6bfcd984
--- /dev/null
+++ b/gr-utils/src/python/modtool/code_generator.py
@@ -0,0 +1,53 @@
+#
+# Copyright 2013 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.
+#
+""" A code generator (needed by ModToolAdd) """
+
+from templates import Templates
+import Cheetah.Template
+from util_functions import str_to_fancyc_comment
+from util_functions import str_to_python_comment
+from util_functions import strip_default_values
+from util_functions import strip_arg_types
+from util_functions import strip_arg_types_grc
+
+class GRMTemplate(Cheetah.Template.Template):
+ """ An extended template class """
+ def __init__(self, src, searchList):
+ self.grtypelist = {
+ 'sync': 'gr_sync_block',
+ 'sink': 'gr_sync_block',
+ 'source': 'gr_sync_block',
+ 'decimator': 'gr_sync_decimator',
+ 'interpolator': 'gr_sync_interpolator',
+ 'general': 'gr_block',
+ 'hier': 'gr_hier_block2',
+ 'noblock': ''}
+ searchList['str_to_fancyc_comment'] = str_to_fancyc_comment
+ searchList['str_to_python_comment'] = str_to_python_comment
+ searchList['strip_default_values'] = strip_default_values
+ searchList['strip_arg_types'] = strip_arg_types
+ searchList['strip_arg_types_grc'] = strip_arg_types_grc
+ Cheetah.Template.Template.__init__(self, src, searchList=searchList)
+ self.grblocktype = self.grtypelist[searchList['blocktype']]
+
+def get_template(tpl_id, **kwargs):
+ """ Return the template given by tpl_id, parsed through Cheetah """
+ return str(GRMTemplate(Templates[tpl_id], searchList=kwargs))
diff --git a/gr-utils/src/python/modtool/gr-newmod/CMakeLists.txt b/gr-utils/src/python/modtool/gr-newmod/CMakeLists.txt
new file mode 100644
index 000000000..deea791f8
--- /dev/null
+++ b/gr-utils/src/python/modtool/gr-newmod/CMakeLists.txt
@@ -0,0 +1,145 @@
+# Copyright 2011,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.
+
+
+########################################################################
+# Project setup
+########################################################################
+cmake_minimum_required(VERSION 2.6)
+project(gr-howto CXX C)
+enable_testing()
+
+#select the release build type by default to get optimization flags
+if(NOT CMAKE_BUILD_TYPE)
+ set(CMAKE_BUILD_TYPE "Release")
+ message(STATUS "Build type not specified: defaulting to release.")
+endif(NOT CMAKE_BUILD_TYPE)
+set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "")
+
+list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules)
+
+########################################################################
+# Compiler specific setup
+########################################################################
+if(CMAKE_COMPILER_IS_GNUCXX AND NOT WIN32)
+ #http://gcc.gnu.org/wiki/Visibility
+ add_definitions(-fvisibility=hidden)
+endif()
+
+########################################################################
+# Find boost
+########################################################################
+if(UNIX AND EXISTS "/usr/lib64")
+ list(APPEND BOOST_LIBRARYDIR "/usr/lib64") #fedora 64-bit fix
+endif(UNIX AND EXISTS "/usr/lib64")
+set(Boost_ADDITIONAL_VERSIONS
+ "1.35.0" "1.35" "1.36.0" "1.36" "1.37.0" "1.37" "1.38.0" "1.38" "1.39.0" "1.39"
+ "1.40.0" "1.40" "1.41.0" "1.41" "1.42.0" "1.42" "1.43.0" "1.43" "1.44.0" "1.44"
+ "1.45.0" "1.45" "1.46.0" "1.46" "1.47.0" "1.47" "1.48.0" "1.48" "1.49.0" "1.49"
+ "1.50.0" "1.50" "1.51.0" "1.51" "1.52.0" "1.52" "1.53.0" "1.53" "1.54.0" "1.54"
+ "1.55.0" "1.55" "1.56.0" "1.56" "1.57.0" "1.57" "1.58.0" "1.58" "1.59.0" "1.59"
+ "1.60.0" "1.60" "1.61.0" "1.61" "1.62.0" "1.62" "1.63.0" "1.63" "1.64.0" "1.64"
+ "1.65.0" "1.65" "1.66.0" "1.66" "1.67.0" "1.67" "1.68.0" "1.68" "1.69.0" "1.69"
+)
+find_package(Boost "1.35" COMPONENTS filesystem system)
+
+if(NOT Boost_FOUND)
+ message(FATAL_ERROR "Boost required to compile howto")
+endif()
+
+########################################################################
+# Install directories
+########################################################################
+include(GrPlatform) #define LIB_SUFFIX
+set(GR_RUNTIME_DIR bin)
+set(GR_LIBRARY_DIR lib${LIB_SUFFIX})
+set(GR_INCLUDE_DIR include/howto)
+set(GR_DATA_DIR share)
+set(GR_PKG_DATA_DIR ${GR_DATA_DIR}/${CMAKE_PROJECT_NAME})
+set(GR_DOC_DIR ${GR_DATA_DIR}/doc)
+set(GR_PKG_DOC_DIR ${GR_DOC_DIR}/${CMAKE_PROJECT_NAME})
+set(GR_CONF_DIR etc)
+set(GR_PKG_CONF_DIR ${GR_CONF_DIR}/${CMAKE_PROJECT_NAME}/conf.d)
+set(GR_LIBEXEC_DIR libexec)
+set(GR_PKG_LIBEXEC_DIR ${GR_LIBEXEC_DIR}/${CMAKE_PROJECT_NAME})
+set(GRC_BLOCKS_DIR ${GR_PKG_DATA_DIR}/grc/blocks)
+
+########################################################################
+# Find gnuradio build dependencies
+########################################################################
+find_package(Gruel)
+find_package(GnuradioCore)
+find_package(CppUnit)
+
+if(NOT GRUEL_FOUND)
+ message(FATAL_ERROR "Gruel required to compile howto")
+endif()
+
+if(NOT GNURADIO_CORE_FOUND)
+ message(FATAL_ERROR "GnuRadio Core required to compile howto")
+endif()
+
+if(NOT CPPUNIT_FOUND)
+ message(FATAL_ERROR "CppUnit required to compile howto")
+endif()
+
+########################################################################
+# Setup the include and linker paths
+########################################################################
+include_directories(
+ ${CMAKE_SOURCE_DIR}/include
+ ${Boost_INCLUDE_DIRS}
+ ${GRUEL_INCLUDE_DIRS}
+ ${CPPUNIT_INCLUDE_DIRS}
+ ${GNURADIO_CORE_INCLUDE_DIRS}
+)
+
+link_directories(
+ ${Boost_LIBRARY_DIRS}
+ ${GRUEL_LIBRARY_DIRS}
+ ${CPPUNIT_LIBRARY_DIRS}
+ ${GNURADIO_CORE_LIBRARY_DIRS}
+)
+
+# Set component parameters
+set(GR_HOWTO_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include CACHE INTERNAL "" FORCE)
+set(GR_HOWTO_SWIG_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/swig CACHE INTERNAL "" FORCE)
+
+########################################################################
+# Create uninstall target
+########################################################################
+configure_file(
+ ${CMAKE_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in
+ ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake
+@ONLY)
+
+add_custom_target(uninstall
+ ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake
+)
+
+########################################################################
+# Add subdirectories
+########################################################################
+add_subdirectory(include/howto)
+add_subdirectory(lib)
+add_subdirectory(swig)
+add_subdirectory(python)
+add_subdirectory(grc)
+add_subdirectory(apps)
+add_subdirectory(docs)
diff --git a/gr-utils/src/python/modtool/gr-newmod/apps/CMakeLists.txt b/gr-utils/src/python/modtool/gr-newmod/apps/CMakeLists.txt
new file mode 100644
index 000000000..c837d77f6
--- /dev/null
+++ b/gr-utils/src/python/modtool/gr-newmod/apps/CMakeLists.txt
@@ -0,0 +1,25 @@
+# Copyright 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.
+
+include(GrPython)
+
+GR_PYTHON_INSTALL(
+ PROGRAMS
+ DESTINATION bin
+)
diff --git a/gr-utils/src/python/modtool/gr-newmod/cmake/Modules/CMakeParseArgumentsCopy.cmake b/gr-utils/src/python/modtool/gr-newmod/cmake/Modules/CMakeParseArgumentsCopy.cmake
new file mode 100644
index 000000000..7ce4c49ae
--- /dev/null
+++ b/gr-utils/src/python/modtool/gr-newmod/cmake/Modules/CMakeParseArgumentsCopy.cmake
@@ -0,0 +1,138 @@
+# CMAKE_PARSE_ARGUMENTS(<prefix> <options> <one_value_keywords> <multi_value_keywords> args...)
+#
+# CMAKE_PARSE_ARGUMENTS() is intended to be used in macros or functions for
+# parsing the arguments given to that macro or function.
+# It processes the arguments and defines a set of variables which hold the
+# values of the respective options.
+#
+# The <options> argument contains all options for the respective macro,
+# i.e. keywords which can be used when calling the macro without any value
+# following, like e.g. the OPTIONAL keyword of the install() command.
+#
+# The <one_value_keywords> argument contains all keywords for this macro
+# which are followed by one value, like e.g. DESTINATION keyword of the
+# install() command.
+#
+# The <multi_value_keywords> argument contains all keywords for this macro
+# which can be followed by more than one value, like e.g. the TARGETS or
+# FILES keywords of the install() command.
+#
+# When done, CMAKE_PARSE_ARGUMENTS() will have defined for each of the
+# keywords listed in <options>, <one_value_keywords> and
+# <multi_value_keywords> a variable composed of the given <prefix>
+# followed by "_" and the name of the respective keyword.
+# These variables will then hold the respective value from the argument list.
+# For the <options> keywords this will be TRUE or FALSE.
+#
+# All remaining arguments are collected in a variable
+# <prefix>_UNPARSED_ARGUMENTS, this can be checked afterwards to see whether
+# your macro was called with unrecognized parameters.
+#
+# As an example here a my_install() macro, which takes similar arguments as the
+# real install() command:
+#
+# function(MY_INSTALL)
+# set(options OPTIONAL FAST)
+# set(oneValueArgs DESTINATION RENAME)
+# set(multiValueArgs TARGETS CONFIGURATIONS)
+# cmake_parse_arguments(MY_INSTALL "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
+# ...
+#
+# Assume my_install() has been called like this:
+# my_install(TARGETS foo bar DESTINATION bin OPTIONAL blub)
+#
+# After the cmake_parse_arguments() call the macro will have set the following
+# variables:
+# MY_INSTALL_OPTIONAL = TRUE
+# MY_INSTALL_FAST = FALSE (this option was not used when calling my_install()
+# MY_INSTALL_DESTINATION = "bin"
+# MY_INSTALL_RENAME = "" (was not used)
+# MY_INSTALL_TARGETS = "foo;bar"
+# MY_INSTALL_CONFIGURATIONS = "" (was not used)
+# MY_INSTALL_UNPARSED_ARGUMENTS = "blub" (no value expected after "OPTIONAL"
+#
+# You can the continue and process these variables.
+#
+# Keywords terminate lists of values, e.g. if directly after a one_value_keyword
+# another recognized keyword follows, this is interpreted as the beginning of
+# the new option.
+# E.g. my_install(TARGETS foo DESTINATION OPTIONAL) would result in
+# MY_INSTALL_DESTINATION set to "OPTIONAL", but MY_INSTALL_DESTINATION would
+# be empty and MY_INSTALL_OPTIONAL would be set to TRUE therefor.
+
+#=============================================================================
+# Copyright 2010 Alexander Neundorf <neundorf@kde.org>
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+
+if(__CMAKE_PARSE_ARGUMENTS_INCLUDED)
+ return()
+endif()
+set(__CMAKE_PARSE_ARGUMENTS_INCLUDED TRUE)
+
+
+function(CMAKE_PARSE_ARGUMENTS prefix _optionNames _singleArgNames _multiArgNames)
+ # first set all result variables to empty/FALSE
+ foreach(arg_name ${_singleArgNames} ${_multiArgNames})
+ set(${prefix}_${arg_name})
+ endforeach(arg_name)
+
+ foreach(option ${_optionNames})
+ set(${prefix}_${option} FALSE)
+ endforeach(option)
+
+ set(${prefix}_UNPARSED_ARGUMENTS)
+
+ set(insideValues FALSE)
+ set(currentArgName)
+
+ # now iterate over all arguments and fill the result variables
+ foreach(currentArg ${ARGN})
+ list(FIND _optionNames "${currentArg}" optionIndex) # ... then this marks the end of the arguments belonging to this keyword
+ list(FIND _singleArgNames "${currentArg}" singleArgIndex) # ... then this marks the end of the arguments belonging to this keyword
+ list(FIND _multiArgNames "${currentArg}" multiArgIndex) # ... then this marks the end of the arguments belonging to this keyword
+
+ if(${optionIndex} EQUAL -1 AND ${singleArgIndex} EQUAL -1 AND ${multiArgIndex} EQUAL -1)
+ if(insideValues)
+ if("${insideValues}" STREQUAL "SINGLE")
+ set(${prefix}_${currentArgName} ${currentArg})
+ set(insideValues FALSE)
+ elseif("${insideValues}" STREQUAL "MULTI")
+ list(APPEND ${prefix}_${currentArgName} ${currentArg})
+ endif()
+ else(insideValues)
+ list(APPEND ${prefix}_UNPARSED_ARGUMENTS ${currentArg})
+ endif(insideValues)
+ else()
+ if(NOT ${optionIndex} EQUAL -1)
+ set(${prefix}_${currentArg} TRUE)
+ set(insideValues FALSE)
+ elseif(NOT ${singleArgIndex} EQUAL -1)
+ set(currentArgName ${currentArg})
+ set(${prefix}_${currentArgName})
+ set(insideValues "SINGLE")
+ elseif(NOT ${multiArgIndex} EQUAL -1)
+ set(currentArgName ${currentArg})
+ set(${prefix}_${currentArgName})
+ set(insideValues "MULTI")
+ endif()
+ endif()
+
+ endforeach(currentArg)
+
+ # propagate the result variables to the caller:
+ foreach(arg_name ${_singleArgNames} ${_multiArgNames} ${_optionNames})
+ set(${prefix}_${arg_name} ${${prefix}_${arg_name}} PARENT_SCOPE)
+ endforeach(arg_name)
+ set(${prefix}_UNPARSED_ARGUMENTS ${${prefix}_UNPARSED_ARGUMENTS} PARENT_SCOPE)
+
+endfunction(CMAKE_PARSE_ARGUMENTS _options _singleArgs _multiArgs)
diff --git a/gr-utils/src/python/modtool/gr-newmod/cmake/Modules/FindCppUnit.cmake b/gr-utils/src/python/modtool/gr-newmod/cmake/Modules/FindCppUnit.cmake
new file mode 100644
index 000000000..9af308f84
--- /dev/null
+++ b/gr-utils/src/python/modtool/gr-newmod/cmake/Modules/FindCppUnit.cmake
@@ -0,0 +1,36 @@
+# http://www.cmake.org/pipermail/cmake/2006-October/011446.html
+# Modified to use pkg config and use standard var names
+
+#
+# Find the CppUnit includes and library
+#
+# This module defines
+# CPPUNIT_INCLUDE_DIR, where to find tiff.h, etc.
+# CPPUNIT_LIBRARIES, the libraries to link against to use CppUnit.
+# CPPUNIT_FOUND, If false, do not try to use CppUnit.
+
+INCLUDE(FindPkgConfig)
+PKG_CHECK_MODULES(PC_CPPUNIT "cppunit")
+
+FIND_PATH(CPPUNIT_INCLUDE_DIRS
+ NAMES cppunit/TestCase.h
+ HINTS ${PC_CPPUNIT_INCLUDE_DIR}
+ PATHS
+ /usr/local/include
+ /usr/include
+)
+
+FIND_LIBRARY(CPPUNIT_LIBRARIES
+ NAMES cppunit
+ HINTS ${PC_CPPUNIT_LIBDIR}
+ PATHS
+ ${CPPUNIT_INCLUDE_DIRS}/../lib
+ /usr/local/lib
+ /usr/lib
+)
+
+LIST(APPEND CPPUNIT_LIBRARIES ${CMAKE_DL_LIBS})
+
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(CPPUNIT DEFAULT_MSG CPPUNIT_LIBRARIES CPPUNIT_INCLUDE_DIRS)
+MARK_AS_ADVANCED(CPPUNIT_LIBRARIES CPPUNIT_INCLUDE_DIRS)
diff --git a/gr-utils/src/python/modtool/gr-newmod/cmake/Modules/FindGnuradioCore.cmake b/gr-utils/src/python/modtool/gr-newmod/cmake/Modules/FindGnuradioCore.cmake
new file mode 100644
index 000000000..3773588a7
--- /dev/null
+++ b/gr-utils/src/python/modtool/gr-newmod/cmake/Modules/FindGnuradioCore.cmake
@@ -0,0 +1,26 @@
+INCLUDE(FindPkgConfig)
+PKG_CHECK_MODULES(PC_GNURADIO_CORE gnuradio-core)
+
+FIND_PATH(
+ GNURADIO_CORE_INCLUDE_DIRS
+ NAMES gr_random.h
+ HINTS $ENV{GNURADIO_CORE_DIR}/include/gnuradio
+ ${PC_GNURADIO_CORE_INCLUDEDIR}
+ PATHS /usr/local/include/gnuradio
+ /usr/include/gnuradio
+)
+
+FIND_LIBRARY(
+ GNURADIO_CORE_LIBRARIES
+ NAMES gnuradio-core
+ HINTS $ENV{GNURADIO_CORE_DIR}/lib
+ ${PC_GNURADIO_CORE_LIBDIR}
+ PATHS /usr/local/lib
+ /usr/local/lib64
+ /usr/lib
+ /usr/lib64
+)
+
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(GNURADIO_CORE DEFAULT_MSG GNURADIO_CORE_LIBRARIES GNURADIO_CORE_INCLUDE_DIRS)
+MARK_AS_ADVANCED(GNURADIO_CORE_LIBRARIES GNURADIO_CORE_INCLUDE_DIRS)
diff --git a/gr-utils/src/python/modtool/gr-newmod/cmake/Modules/FindGruel.cmake b/gr-utils/src/python/modtool/gr-newmod/cmake/Modules/FindGruel.cmake
new file mode 100644
index 000000000..58dff7044
--- /dev/null
+++ b/gr-utils/src/python/modtool/gr-newmod/cmake/Modules/FindGruel.cmake
@@ -0,0 +1,26 @@
+INCLUDE(FindPkgConfig)
+PKG_CHECK_MODULES(PC_GRUEL gruel)
+
+FIND_PATH(
+ GRUEL_INCLUDE_DIRS
+ NAMES gruel/attributes.h
+ HINTS $ENV{GRUEL_DIR}/include
+ ${PC_GRUEL_INCLUDEDIR}
+ PATHS /usr/local/include
+ /usr/include
+)
+
+FIND_LIBRARY(
+ GRUEL_LIBRARIES
+ NAMES gruel
+ HINTS $ENV{GRUEL_DIR}/lib
+ ${PC_GRUEL_LIBDIR}
+ PATHS /usr/local/lib
+ /usr/local/lib64
+ /usr/lib
+ /usr/lib64
+)
+
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(GRUEL DEFAULT_MSG GRUEL_LIBRARIES GRUEL_INCLUDE_DIRS)
+MARK_AS_ADVANCED(GRUEL_LIBRARIES GRUEL_INCLUDE_DIRS)
diff --git a/gr-utils/src/python/modtool/gr-newmod/cmake/Modules/GrMiscUtils.cmake b/gr-utils/src/python/modtool/gr-newmod/cmake/Modules/GrMiscUtils.cmake
new file mode 100644
index 000000000..9331d5deb
--- /dev/null
+++ b/gr-utils/src/python/modtool/gr-newmod/cmake/Modules/GrMiscUtils.cmake
@@ -0,0 +1,210 @@
+# 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.
+
+if(DEFINED __INCLUDED_GR_MISC_UTILS_CMAKE)
+ return()
+endif()
+set(__INCLUDED_GR_MISC_UTILS_CMAKE TRUE)
+
+########################################################################
+# Set global variable macro.
+# Used for subdirectories to export settings.
+# Example: include and library paths.
+########################################################################
+function(GR_SET_GLOBAL var)
+ set(${var} ${ARGN} CACHE INTERNAL "" FORCE)
+endfunction(GR_SET_GLOBAL)
+
+########################################################################
+# Set the pre-processor definition if the condition is true.
+# - def the pre-processor definition to set and condition name
+########################################################################
+function(GR_ADD_COND_DEF def)
+ if(${def})
+ add_definitions(-D${def})
+ endif(${def})
+endfunction(GR_ADD_COND_DEF)
+
+########################################################################
+# Check for a header and conditionally set a compile define.
+# - hdr the relative path to the header file
+# - def the pre-processor definition to set
+########################################################################
+function(GR_CHECK_HDR_N_DEF hdr def)
+ include(CheckIncludeFileCXX)
+ CHECK_INCLUDE_FILE_CXX(${hdr} ${def})
+ GR_ADD_COND_DEF(${def})
+endfunction(GR_CHECK_HDR_N_DEF)
+
+########################################################################
+# Include subdirectory macro.
+# Sets the CMake directory variables,
+# includes the subdirectory CMakeLists.txt,
+# resets the CMake directory variables.
+#
+# This macro includes subdirectories rather than adding them
+# so that the subdirectory can affect variables in the level above.
+# This provides a work-around for the lack of convenience libraries.
+# This way a subdirectory can append to the list of library sources.
+########################################################################
+macro(GR_INCLUDE_SUBDIRECTORY subdir)
+ #insert the current directories on the front of the list
+ list(INSERT _cmake_source_dirs 0 ${CMAKE_CURRENT_SOURCE_DIR})
+ list(INSERT _cmake_binary_dirs 0 ${CMAKE_CURRENT_BINARY_DIR})
+
+ #set the current directories to the names of the subdirs
+ set(CMAKE_CURRENT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/${subdir})
+ set(CMAKE_CURRENT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/${subdir})
+
+ #include the subdirectory CMakeLists to run it
+ file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
+ include(${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt)
+
+ #reset the value of the current directories
+ list(GET _cmake_source_dirs 0 CMAKE_CURRENT_SOURCE_DIR)
+ list(GET _cmake_binary_dirs 0 CMAKE_CURRENT_BINARY_DIR)
+
+ #pop the subdir names of the front of the list
+ list(REMOVE_AT _cmake_source_dirs 0)
+ list(REMOVE_AT _cmake_binary_dirs 0)
+endmacro(GR_INCLUDE_SUBDIRECTORY)
+
+########################################################################
+# Check if a compiler flag works and conditionally set a compile define.
+# - flag the compiler flag to check for
+# - have the variable to set with result
+########################################################################
+macro(GR_ADD_CXX_COMPILER_FLAG_IF_AVAILABLE flag have)
+ include(CheckCXXCompilerFlag)
+ CHECK_CXX_COMPILER_FLAG(${flag} ${have})
+ if(${have})
+ add_definitions(${flag})
+ endif(${have})
+endmacro(GR_ADD_CXX_COMPILER_FLAG_IF_AVAILABLE)
+
+########################################################################
+# Generates the .la libtool file
+# This appears to generate libtool files that cannot be used by auto*.
+# Usage GR_LIBTOOL(TARGET [target] DESTINATION [dest])
+# Notice: there is not COMPONENT option, these will not get distributed.
+########################################################################
+function(GR_LIBTOOL)
+ if(NOT DEFINED GENERATE_LIBTOOL)
+ set(GENERATE_LIBTOOL OFF) #disabled by default
+ endif()
+
+ if(GENERATE_LIBTOOL)
+ include(CMakeParseArgumentsCopy)
+ CMAKE_PARSE_ARGUMENTS(GR_LIBTOOL "" "TARGET;DESTINATION" "" ${ARGN})
+
+ find_program(LIBTOOL libtool)
+ if(LIBTOOL)
+ include(CMakeMacroLibtoolFile)
+ CREATE_LIBTOOL_FILE(${GR_LIBTOOL_TARGET} /${GR_LIBTOOL_DESTINATION})
+ endif(LIBTOOL)
+ endif(GENERATE_LIBTOOL)
+
+endfunction(GR_LIBTOOL)
+
+########################################################################
+# Do standard things to the library target
+# - set target properties
+# - make install rules
+# Also handle gnuradio custom naming conventions w/ extras mode.
+########################################################################
+function(GR_LIBRARY_FOO target)
+ #parse the arguments for component names
+ include(CMakeParseArgumentsCopy)
+ CMAKE_PARSE_ARGUMENTS(GR_LIBRARY "" "RUNTIME_COMPONENT;DEVEL_COMPONENT" "" ${ARGN})
+
+ #set additional target properties
+ set_target_properties(${target} PROPERTIES SOVERSION ${LIBVER})
+
+ #install the generated files like so...
+ install(TARGETS ${target}
+ LIBRARY DESTINATION ${GR_LIBRARY_DIR} COMPONENT ${GR_LIBRARY_RUNTIME_COMPONENT} # .so/.dylib file
+ ARCHIVE DESTINATION ${GR_LIBRARY_DIR} COMPONENT ${GR_LIBRARY_DEVEL_COMPONENT} # .lib file
+ RUNTIME DESTINATION ${GR_RUNTIME_DIR} COMPONENT ${GR_LIBRARY_RUNTIME_COMPONENT} # .dll file
+ )
+
+ #extras mode enabled automatically on linux
+ if(NOT DEFINED LIBRARY_EXTRAS)
+ set(LIBRARY_EXTRAS ${LINUX})
+ endif()
+
+ #special extras mode to enable alternative naming conventions
+ if(LIBRARY_EXTRAS)
+
+ #create .la file before changing props
+ GR_LIBTOOL(TARGET ${target} DESTINATION ${GR_LIBRARY_DIR})
+
+ #give the library a special name with ultra-zero soversion
+ set_target_properties(${target} PROPERTIES LIBRARY_OUTPUT_NAME ${target}-${LIBVER} SOVERSION "0.0.0")
+ set(target_name lib${target}-${LIBVER}.so.0.0.0)
+
+ #custom command to generate symlinks
+ add_custom_command(
+ TARGET ${target}
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E create_symlink ${target_name} ${CMAKE_CURRENT_BINARY_DIR}/lib${target}.so
+ COMMAND ${CMAKE_COMMAND} -E create_symlink ${target_name} ${CMAKE_CURRENT_BINARY_DIR}/lib${target}-${LIBVER}.so.0
+ COMMAND ${CMAKE_COMMAND} -E touch ${target_name} #so the symlinks point to something valid so cmake 2.6 will install
+ )
+
+ #and install the extra symlinks
+ install(
+ FILES
+ ${CMAKE_CURRENT_BINARY_DIR}/lib${target}.so
+ ${CMAKE_CURRENT_BINARY_DIR}/lib${target}-${LIBVER}.so.0
+ DESTINATION ${GR_LIBRARY_DIR} COMPONENT ${GR_LIBRARY_RUNTIME_COMPONENT}
+ )
+
+ endif(LIBRARY_EXTRAS)
+endfunction(GR_LIBRARY_FOO)
+
+########################################################################
+# Create a dummy custom command that depends on other targets.
+# Usage:
+# GR_GEN_TARGET_DEPS(unique_name target_deps <target1> <target2> ...)
+# ADD_CUSTOM_COMMAND(<the usual args> ${target_deps})
+#
+# Custom command cant depend on targets, but can depend on executables,
+# and executables can depend on targets. So this is the process:
+########################################################################
+function(GR_GEN_TARGET_DEPS name var)
+ file(
+ WRITE ${CMAKE_CURRENT_BINARY_DIR}/${name}.cpp.in
+ "int main(void){return 0;}\n"
+ )
+ execute_process(
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different
+ ${CMAKE_CURRENT_BINARY_DIR}/${name}.cpp.in
+ ${CMAKE_CURRENT_BINARY_DIR}/${name}.cpp
+ )
+ add_executable(${name} ${CMAKE_CURRENT_BINARY_DIR}/${name}.cpp)
+ if(ARGN)
+ add_dependencies(${name} ${ARGN})
+ endif(ARGN)
+
+ if(CMAKE_CROSSCOMPILING)
+ set(${var} "DEPENDS;${name}" PARENT_SCOPE) #cant call command when cross
+ else()
+ set(${var} "DEPENDS;${name};COMMAND;${name}" PARENT_SCOPE)
+ endif()
+endfunction(GR_GEN_TARGET_DEPS)
diff --git a/gr-utils/src/python/modtool/gr-newmod/cmake/Modules/GrPlatform.cmake b/gr-utils/src/python/modtool/gr-newmod/cmake/Modules/GrPlatform.cmake
new file mode 100644
index 000000000..a2e4f3b34
--- /dev/null
+++ b/gr-utils/src/python/modtool/gr-newmod/cmake/Modules/GrPlatform.cmake
@@ -0,0 +1,46 @@
+# Copyright 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.
+
+if(DEFINED __INCLUDED_GR_PLATFORM_CMAKE)
+ return()
+endif()
+set(__INCLUDED_GR_PLATFORM_CMAKE TRUE)
+
+########################################################################
+# Setup additional defines for OS types
+########################################################################
+if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
+ set(LINUX TRUE)
+endif()
+
+if(LINUX AND EXISTS "/etc/debian_version")
+ set(DEBIAN TRUE)
+endif()
+
+if(LINUX AND EXISTS "/etc/redhat-release")
+ set(REDHAT TRUE)
+endif()
+
+########################################################################
+# when the library suffix should be 64 (applies to redhat linux family)
+########################################################################
+if(NOT DEFINED LIB_SUFFIX AND REDHAT AND CMAKE_SYSTEM_PROCESSOR MATCHES "64$")
+ set(LIB_SUFFIX 64)
+endif()
+set(LIB_SUFFIX ${LIB_SUFFIX} CACHE STRING "lib directory suffix")
diff --git a/gr-utils/src/python/modtool/gr-newmod/cmake/Modules/GrPython.cmake b/gr-utils/src/python/modtool/gr-newmod/cmake/Modules/GrPython.cmake
new file mode 100644
index 000000000..efdddf371
--- /dev/null
+++ b/gr-utils/src/python/modtool/gr-newmod/cmake/Modules/GrPython.cmake
@@ -0,0 +1,227 @@
+# 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.
+
+if(DEFINED __INCLUDED_GR_PYTHON_CMAKE)
+ return()
+endif()
+set(__INCLUDED_GR_PYTHON_CMAKE TRUE)
+
+########################################################################
+# Setup the python interpreter:
+# This allows the user to specify a specific interpreter,
+# or finds the interpreter via the built-in cmake module.
+########################################################################
+#this allows the user to override PYTHON_EXECUTABLE
+if(PYTHON_EXECUTABLE)
+
+ set(PYTHONINTERP_FOUND TRUE)
+
+#otherwise if not set, try to automatically find it
+else(PYTHON_EXECUTABLE)
+
+ #use the built-in find script
+ find_package(PythonInterp)
+
+ #and if that fails use the find program routine
+ if(NOT PYTHONINTERP_FOUND)
+ find_program(PYTHON_EXECUTABLE NAMES python python2.7 python2.6 python2.5)
+ if(PYTHON_EXECUTABLE)
+ set(PYTHONINTERP_FOUND TRUE)
+ endif(PYTHON_EXECUTABLE)
+ endif(NOT PYTHONINTERP_FOUND)
+
+endif(PYTHON_EXECUTABLE)
+
+#make the path to the executable appear in the cmake gui
+set(PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE} CACHE FILEPATH "python interpreter")
+
+#make sure we can use -B with python (introduced in 2.6)
+if(PYTHON_EXECUTABLE)
+ execute_process(
+ COMMAND ${PYTHON_EXECUTABLE} -B -c ""
+ OUTPUT_QUIET ERROR_QUIET
+ RESULT_VARIABLE PYTHON_HAS_DASH_B_RESULT
+ )
+ if(PYTHON_HAS_DASH_B_RESULT EQUAL 0)
+ set(PYTHON_DASH_B "-B")
+ endif()
+endif(PYTHON_EXECUTABLE)
+
+########################################################################
+# Check for the existence of a python module:
+# - desc a string description of the check
+# - mod the name of the module to import
+# - cmd an additional command to run
+# - have the result variable to set
+########################################################################
+macro(GR_PYTHON_CHECK_MODULE desc mod cmd have)
+ message(STATUS "")
+ message(STATUS "Python checking for ${desc}")
+ execute_process(
+ COMMAND ${PYTHON_EXECUTABLE} -c "
+#########################################
+try: import ${mod}
+except: exit(-1)
+try: assert ${cmd}
+except: exit(-1)
+#########################################"
+ RESULT_VARIABLE ${have}
+ )
+ if(${have} EQUAL 0)
+ message(STATUS "Python checking for ${desc} - found")
+ set(${have} TRUE)
+ else(${have} EQUAL 0)
+ message(STATUS "Python checking for ${desc} - not found")
+ set(${have} FALSE)
+ endif(${have} EQUAL 0)
+endmacro(GR_PYTHON_CHECK_MODULE)
+
+########################################################################
+# Sets the python installation directory GR_PYTHON_DIR
+########################################################################
+execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "
+from distutils import sysconfig
+print sysconfig.get_python_lib(plat_specific=True, prefix='')
+" OUTPUT_VARIABLE GR_PYTHON_DIR OUTPUT_STRIP_TRAILING_WHITESPACE
+)
+file(TO_CMAKE_PATH ${GR_PYTHON_DIR} GR_PYTHON_DIR)
+
+########################################################################
+# Create an always-built target with a unique name
+# Usage: GR_UNIQUE_TARGET(<description> <dependencies list>)
+########################################################################
+function(GR_UNIQUE_TARGET desc)
+ file(RELATIVE_PATH reldir ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR})
+ execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import re, hashlib
+unique = hashlib.md5('${reldir}${ARGN}').hexdigest()[:5]
+print(re.sub('\\W', '_', '${desc} ${reldir} ' + unique))"
+ OUTPUT_VARIABLE _target OUTPUT_STRIP_TRAILING_WHITESPACE)
+ add_custom_target(${_target} ALL DEPENDS ${ARGN})
+endfunction(GR_UNIQUE_TARGET)
+
+########################################################################
+# Install python sources (also builds and installs byte-compiled python)
+########################################################################
+function(GR_PYTHON_INSTALL)
+ include(CMakeParseArgumentsCopy)
+ CMAKE_PARSE_ARGUMENTS(GR_PYTHON_INSTALL "" "DESTINATION;COMPONENT" "FILES;PROGRAMS" ${ARGN})
+
+ ####################################################################
+ if(GR_PYTHON_INSTALL_FILES)
+ ####################################################################
+ install(${ARGN}) #installs regular python files
+
+ #create a list of all generated files
+ unset(pysrcfiles)
+ unset(pycfiles)
+ unset(pyofiles)
+ foreach(pyfile ${GR_PYTHON_INSTALL_FILES})
+ get_filename_component(pyfile ${pyfile} ABSOLUTE)
+ list(APPEND pysrcfiles ${pyfile})
+
+ #determine if this file is in the source or binary directory
+ file(RELATIVE_PATH source_rel_path ${CMAKE_CURRENT_SOURCE_DIR} ${pyfile})
+ string(LENGTH "${source_rel_path}" source_rel_path_len)
+ file(RELATIVE_PATH binary_rel_path ${CMAKE_CURRENT_BINARY_DIR} ${pyfile})
+ string(LENGTH "${binary_rel_path}" binary_rel_path_len)
+
+ #and set the generated path appropriately
+ if(${source_rel_path_len} GREATER ${binary_rel_path_len})
+ set(pygenfile ${CMAKE_CURRENT_BINARY_DIR}/${binary_rel_path})
+ else()
+ set(pygenfile ${CMAKE_CURRENT_BINARY_DIR}/${source_rel_path})
+ endif()
+ list(APPEND pycfiles ${pygenfile}c)
+ list(APPEND pyofiles ${pygenfile}o)
+
+ #ensure generation path exists
+ get_filename_component(pygen_path ${pygenfile} PATH)
+ file(MAKE_DIRECTORY ${pygen_path})
+
+ endforeach(pyfile)
+
+ #the command to generate the pyc files
+ add_custom_command(
+ DEPENDS ${pysrcfiles} OUTPUT ${pycfiles}
+ COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_BINARY_DIR}/python_compile_helper.py ${pysrcfiles} ${pycfiles}
+ )
+
+ #the command to generate the pyo files
+ add_custom_command(
+ DEPENDS ${pysrcfiles} OUTPUT ${pyofiles}
+ COMMAND ${PYTHON_EXECUTABLE} -O ${CMAKE_BINARY_DIR}/python_compile_helper.py ${pysrcfiles} ${pyofiles}
+ )
+
+ #create install rule and add generated files to target list
+ set(python_install_gen_targets ${pycfiles} ${pyofiles})
+ install(FILES ${python_install_gen_targets}
+ DESTINATION ${GR_PYTHON_INSTALL_DESTINATION}
+ COMPONENT ${GR_PYTHON_INSTALL_COMPONENT}
+ )
+
+
+ ####################################################################
+ elseif(GR_PYTHON_INSTALL_PROGRAMS)
+ ####################################################################
+ file(TO_NATIVE_PATH ${PYTHON_EXECUTABLE} pyexe_native)
+
+ foreach(pyfile ${GR_PYTHON_INSTALL_PROGRAMS})
+ get_filename_component(pyfile_name ${pyfile} NAME)
+ get_filename_component(pyfile ${pyfile} ABSOLUTE)
+ string(REPLACE "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" pyexefile "${pyfile}.exe")
+ list(APPEND python_install_gen_targets ${pyexefile})
+
+ get_filename_component(pyexefile_path ${pyexefile} PATH)
+ file(MAKE_DIRECTORY ${pyexefile_path})
+
+ add_custom_command(
+ OUTPUT ${pyexefile} DEPENDS ${pyfile}
+ COMMAND ${PYTHON_EXECUTABLE} -c
+ \"open('${pyexefile}', 'w').write('\#!${pyexe_native}\\n'+open('${pyfile}').read())\"
+ COMMENT "Shebangin ${pyfile_name}"
+ )
+
+ #on windows, python files need an extension to execute
+ get_filename_component(pyfile_ext ${pyfile} EXT)
+ if(WIN32 AND NOT pyfile_ext)
+ set(pyfile_name "${pyfile_name}.py")
+ endif()
+
+ install(PROGRAMS ${pyexefile} RENAME ${pyfile_name}
+ DESTINATION ${GR_PYTHON_INSTALL_DESTINATION}
+ COMPONENT ${GR_PYTHON_INSTALL_COMPONENT}
+ )
+ endforeach(pyfile)
+
+ endif()
+
+ GR_UNIQUE_TARGET("pygen" ${python_install_gen_targets})
+
+endfunction(GR_PYTHON_INSTALL)
+
+########################################################################
+# Write the python helper script that generates byte code files
+########################################################################
+file(WRITE ${CMAKE_BINARY_DIR}/python_compile_helper.py "
+import sys, py_compile
+files = sys.argv[1:]
+srcs, gens = files[:len(files)/2], files[len(files)/2:]
+for src, gen in zip(srcs, gens):
+ py_compile.compile(file=src, cfile=gen, doraise=True)
+")
diff --git a/gr-utils/src/python/modtool/gr-newmod/cmake/Modules/GrSwig.cmake b/gr-utils/src/python/modtool/gr-newmod/cmake/Modules/GrSwig.cmake
new file mode 100644
index 000000000..6ba5ee3a5
--- /dev/null
+++ b/gr-utils/src/python/modtool/gr-newmod/cmake/Modules/GrSwig.cmake
@@ -0,0 +1,229 @@
+# 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.
+
+if(DEFINED __INCLUDED_GR_SWIG_CMAKE)
+ return()
+endif()
+set(__INCLUDED_GR_SWIG_CMAKE TRUE)
+
+include(GrPython)
+
+########################################################################
+# Builds a swig documentation file to be generated into python docstrings
+# Usage: GR_SWIG_MAKE_DOCS(output_file input_path input_path....)
+#
+# Set the following variable to specify extra dependent targets:
+# - GR_SWIG_DOCS_SOURCE_DEPS
+# - GR_SWIG_DOCS_TARGET_DEPS
+########################################################################
+function(GR_SWIG_MAKE_DOCS output_file)
+ find_package(Doxygen)
+ if(DOXYGEN_FOUND)
+
+ #setup the input files variable list, quote formated
+ set(input_files)
+ unset(INPUT_PATHS)
+ foreach(input_path ${ARGN})
+ if (IS_DIRECTORY ${input_path}) #when input path is a directory
+ file(GLOB input_path_h_files ${input_path}/*.h)
+ else() #otherwise its just a file, no glob
+ set(input_path_h_files ${input_path})
+ endif()
+ list(APPEND input_files ${input_path_h_files})
+ set(INPUT_PATHS "${INPUT_PATHS} \"${input_path}\"")
+ endforeach(input_path)
+
+ #determine the output directory
+ get_filename_component(name ${output_file} NAME_WE)
+ get_filename_component(OUTPUT_DIRECTORY ${output_file} PATH)
+ set(OUTPUT_DIRECTORY ${OUTPUT_DIRECTORY}/${name}_swig_docs)
+ make_directory(${OUTPUT_DIRECTORY})
+
+ #generate the Doxyfile used by doxygen
+ configure_file(
+ ${CMAKE_SOURCE_DIR}/docs/doxygen/Doxyfile.swig_doc.in
+ ${OUTPUT_DIRECTORY}/Doxyfile
+ @ONLY)
+
+ #Create a dummy custom command that depends on other targets
+ include(GrMiscUtils)
+ GR_GEN_TARGET_DEPS(_${name}_tag tag_deps ${GR_SWIG_DOCS_TARGET_DEPS})
+
+ #call doxygen on the Doxyfile + input headers
+ add_custom_command(
+ OUTPUT ${OUTPUT_DIRECTORY}/xml/index.xml
+ DEPENDS ${input_files} ${GR_SWIG_DOCS_SOURCE_DEPS} ${tag_deps}
+ COMMAND ${DOXYGEN_EXECUTABLE} ${OUTPUT_DIRECTORY}/Doxyfile
+ COMMENT "Generating doxygen xml for ${name} docs"
+ )
+
+ #call the swig_doc script on the xml files
+ add_custom_command(
+ OUTPUT ${output_file}
+ DEPENDS ${input_files} ${OUTPUT_DIRECTORY}/xml/index.xml
+ COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B}
+ ${CMAKE_SOURCE_DIR}/docs/doxygen/swig_doc.py
+ ${OUTPUT_DIRECTORY}/xml
+ ${output_file}
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/docs/doxygen
+ )
+
+ else(DOXYGEN_FOUND)
+ file(WRITE ${output_file} "\n") #no doxygen -> empty file
+ endif(DOXYGEN_FOUND)
+endfunction(GR_SWIG_MAKE_DOCS)
+
+########################################################################
+# Build a swig target for the common gnuradio use case. Usage:
+# GR_SWIG_MAKE(target ifile ifile ifile...)
+#
+# Set the following variables before calling:
+# - GR_SWIG_FLAGS
+# - GR_SWIG_INCLUDE_DIRS
+# - GR_SWIG_LIBRARIES
+# - GR_SWIG_SOURCE_DEPS
+# - GR_SWIG_TARGET_DEPS
+# - GR_SWIG_DOC_FILE
+# - GR_SWIG_DOC_DIRS
+########################################################################
+macro(GR_SWIG_MAKE name)
+ set(ifiles ${ARGN})
+
+ #do swig doc generation if specified
+ if (GR_SWIG_DOC_FILE)
+ set(GR_SWIG_DOCS_SOURCE_DEPS ${GR_SWIG_SOURCE_DEPS})
+ set(GR_SWIG_DOCS_TAREGT_DEPS ${GR_SWIG_TARGET_DEPS})
+ GR_SWIG_MAKE_DOCS(${GR_SWIG_DOC_FILE} ${GR_SWIG_DOC_DIRS})
+ list(APPEND GR_SWIG_SOURCE_DEPS ${GR_SWIG_DOC_FILE})
+ endif()
+
+ #append additional include directories
+ find_package(PythonLibs)
+ list(APPEND GR_SWIG_INCLUDE_DIRS ${PYTHON_INCLUDE_PATH}) #deprecated name (now dirs)
+ list(APPEND GR_SWIG_INCLUDE_DIRS ${PYTHON_INCLUDE_DIRS})
+ list(APPEND GR_SWIG_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR})
+ list(APPEND GR_SWIG_INCLUDE_DIRS ${CMAKE_CURRENT_BINARY_DIR})
+
+ #determine include dependencies for swig file
+ execute_process(
+ COMMAND ${PYTHON_EXECUTABLE}
+ ${CMAKE_BINARY_DIR}/get_swig_deps.py
+ "${ifiles}" "${GR_SWIG_INCLUDE_DIRS}"
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ OUTPUT_VARIABLE SWIG_MODULE_${name}_EXTRA_DEPS
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+ )
+
+ #Create a dummy custom command that depends on other targets
+ include(GrMiscUtils)
+ GR_GEN_TARGET_DEPS(_${name}_swig_tag tag_deps ${GR_SWIG_TARGET_DEPS})
+ set(tag_file ${CMAKE_CURRENT_BINARY_DIR}/${name}.tag)
+ add_custom_command(
+ OUTPUT ${tag_file}
+ DEPENDS ${GR_SWIG_SOURCE_DEPS} ${tag_deps}
+ COMMAND ${CMAKE_COMMAND} -E touch ${tag_file}
+ )
+
+ #append the specified include directories
+ include_directories(${GR_SWIG_INCLUDE_DIRS})
+ list(APPEND SWIG_MODULE_${name}_EXTRA_DEPS ${tag_file})
+
+ #setup the swig flags with flags and include directories
+ set(CMAKE_SWIG_FLAGS -fvirtual -modern -keyword -w511 -module ${name} ${GR_SWIG_FLAGS})
+ foreach(dir ${GR_SWIG_INCLUDE_DIRS})
+ list(APPEND CMAKE_SWIG_FLAGS "-I${dir}")
+ endforeach(dir)
+
+ #set the C++ property on the swig .i file so it builds
+ set_source_files_properties(${ifiles} PROPERTIES CPLUSPLUS ON)
+
+ #setup the actual swig library target to be built
+ include(UseSWIG)
+ SWIG_ADD_MODULE(${name} python ${ifiles})
+ SWIG_LINK_LIBRARIES(${name} ${PYTHON_LIBRARIES} ${GR_SWIG_LIBRARIES})
+
+endmacro(GR_SWIG_MAKE)
+
+########################################################################
+# Install swig targets generated by GR_SWIG_MAKE. Usage:
+# GR_SWIG_INSTALL(
+# TARGETS target target target...
+# [DESTINATION destination]
+# [COMPONENT component]
+# )
+########################################################################
+macro(GR_SWIG_INSTALL)
+
+ include(CMakeParseArgumentsCopy)
+ CMAKE_PARSE_ARGUMENTS(GR_SWIG_INSTALL "" "DESTINATION;COMPONENT" "TARGETS" ${ARGN})
+
+ foreach(name ${GR_SWIG_INSTALL_TARGETS})
+ install(TARGETS ${SWIG_MODULE_${name}_REAL_NAME}
+ DESTINATION ${GR_SWIG_INSTALL_DESTINATION}
+ COMPONENT ${GR_SWIG_INSTALL_COMPONENT}
+ )
+
+ include(GrPython)
+ GR_PYTHON_INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${name}.py
+ DESTINATION ${GR_SWIG_INSTALL_DESTINATION}
+ COMPONENT ${GR_SWIG_INSTALL_COMPONENT}
+ )
+
+ GR_LIBTOOL(
+ TARGET ${SWIG_MODULE_${name}_REAL_NAME}
+ DESTINATION ${GR_SWIG_INSTALL_DESTINATION}
+ )
+
+ endforeach(name)
+
+endmacro(GR_SWIG_INSTALL)
+
+########################################################################
+# Generate a python file that can determine swig dependencies.
+# Used by the make macro above to determine extra dependencies.
+# When you build C++, CMake figures out the header dependencies.
+# This code essentially performs that logic for swig includes.
+########################################################################
+file(WRITE ${CMAKE_BINARY_DIR}/get_swig_deps.py "
+
+import os, sys, re
+
+include_matcher = re.compile('[#|%]include\\s*[<|\"](.*)[>|\"]')
+include_dirs = sys.argv[2].split(';')
+
+def get_swig_incs(file_path):
+ file_contents = open(file_path, 'r').read()
+ return include_matcher.findall(file_contents, re.MULTILINE)
+
+def get_swig_deps(file_path, level):
+ deps = [file_path]
+ if level == 0: return deps
+ for inc_file in get_swig_incs(file_path):
+ for inc_dir in include_dirs:
+ inc_path = os.path.join(inc_dir, inc_file)
+ if not os.path.exists(inc_path): continue
+ deps.extend(get_swig_deps(inc_path, level-1))
+ return deps
+
+if __name__ == '__main__':
+ ifiles = sys.argv[1].split(';')
+ deps = sum([get_swig_deps(ifile, 3) for ifile in ifiles], [])
+ #sys.stderr.write(';'.join(set(deps)) + '\\n\\n')
+ print(';'.join(set(deps)))
+")
diff --git a/gr-utils/src/python/modtool/gr-newmod/cmake/Modules/GrTest.cmake b/gr-utils/src/python/modtool/gr-newmod/cmake/Modules/GrTest.cmake
new file mode 100644
index 000000000..6174c034e
--- /dev/null
+++ b/gr-utils/src/python/modtool/gr-newmod/cmake/Modules/GrTest.cmake
@@ -0,0 +1,133 @@
+# 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.
+
+if(DEFINED __INCLUDED_GR_TEST_CMAKE)
+ return()
+endif()
+set(__INCLUDED_GR_TEST_CMAKE TRUE)
+
+########################################################################
+# Add a unit test and setup the environment for a unit test.
+# Takes the same arguments as the ADD_TEST function.
+#
+# Before calling set the following variables:
+# GR_TEST_TARGET_DEPS - built targets for the library path
+# GR_TEST_LIBRARY_DIRS - directories for the library path
+# GR_TEST_PYTHON_DIRS - directories for the python path
+########################################################################
+function(GR_ADD_TEST test_name)
+
+ if(WIN32)
+ #Ensure that the build exe also appears in the PATH.
+ list(APPEND GR_TEST_TARGET_DEPS ${ARGN})
+
+ #In the land of windows, all libraries must be in the PATH.
+ #Since the dependent libraries are not yet installed,
+ #we must manually set them in the PATH to run tests.
+ #The following appends the path of a target dependency.
+ foreach(target ${GR_TEST_TARGET_DEPS})
+ get_target_property(location ${target} LOCATION)
+ if(location)
+ get_filename_component(path ${location} PATH)
+ string(REGEX REPLACE "\\$\\(.*\\)" ${CMAKE_BUILD_TYPE} path ${path})
+ list(APPEND GR_TEST_LIBRARY_DIRS ${path})
+ endif(location)
+ endforeach(target)
+
+ #SWIG generates the python library files into a subdirectory.
+ #Therefore, we must append this subdirectory into PYTHONPATH.
+ #Only do this for the python directories matching the following:
+ foreach(pydir ${GR_TEST_PYTHON_DIRS})
+ get_filename_component(name ${pydir} NAME)
+ if(name MATCHES "^(swig|lib|src)$")
+ list(APPEND GR_TEST_PYTHON_DIRS ${pydir}/${CMAKE_BUILD_TYPE})
+ endif()
+ endforeach(pydir)
+ endif(WIN32)
+
+ file(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR} srcdir)
+ file(TO_NATIVE_PATH "${GR_TEST_LIBRARY_DIRS}" libpath) #ok to use on dir list?
+ file(TO_NATIVE_PATH "${GR_TEST_PYTHON_DIRS}" pypath) #ok to use on dir list?
+
+ set(environs "GR_DONT_LOAD_PREFS=1" "srcdir=${srcdir}")
+
+ #http://www.cmake.org/pipermail/cmake/2009-May/029464.html
+ #Replaced this add test + set environs code with the shell script generation.
+ #Its nicer to be able to manually run the shell script to diagnose problems.
+ #ADD_TEST(${ARGV})
+ #SET_TESTS_PROPERTIES(${test_name} PROPERTIES ENVIRONMENT "${environs}")
+
+ if(UNIX)
+ set(binpath "${CMAKE_CURRENT_BINARY_DIR}:$PATH")
+ #set both LD and DYLD paths to cover multiple UNIX OS library paths
+ list(APPEND libpath "$LD_LIBRARY_PATH" "$DYLD_LIBRARY_PATH")
+ list(APPEND pypath "$PYTHONPATH")
+
+ #replace list separator with the path separator
+ string(REPLACE ";" ":" libpath "${libpath}")
+ string(REPLACE ";" ":" pypath "${pypath}")
+ list(APPEND environs "PATH=${binpath}" "LD_LIBRARY_PATH=${libpath}" "DYLD_LIBRARY_PATH=${libpath}" "PYTHONPATH=${pypath}")
+
+ #generate a bat file that sets the environment and runs the test
+ find_program(SHELL sh)
+ set(sh_file ${CMAKE_CURRENT_BINARY_DIR}/${test_name}_test.sh)
+ file(WRITE ${sh_file} "#!${SHELL}\n")
+ #each line sets an environment variable
+ foreach(environ ${environs})
+ file(APPEND ${sh_file} "export ${environ}\n")
+ endforeach(environ)
+ #load the command to run with its arguments
+ foreach(arg ${ARGN})
+ file(APPEND ${sh_file} "${arg} ")
+ endforeach(arg)
+ file(APPEND ${sh_file} "\n")
+
+ #make the shell file executable
+ execute_process(COMMAND chmod +x ${sh_file})
+
+ add_test(${test_name} ${SHELL} ${sh_file})
+
+ endif(UNIX)
+
+ if(WIN32)
+ list(APPEND libpath ${DLL_PATHS} "%PATH%")
+ list(APPEND pypath "%PYTHONPATH%")
+
+ #replace list separator with the path separator (escaped)
+ string(REPLACE ";" "\\;" libpath "${libpath}")
+ string(REPLACE ";" "\\;" pypath "${pypath}")
+ list(APPEND environs "PATH=${libpath}" "PYTHONPATH=${pypath}")
+
+ #generate a bat file that sets the environment and runs the test
+ set(bat_file ${CMAKE_CURRENT_BINARY_DIR}/${test_name}_test.bat)
+ file(WRITE ${bat_file} "@echo off\n")
+ #each line sets an environment variable
+ foreach(environ ${environs})
+ file(APPEND ${bat_file} "SET ${environ}\n")
+ endforeach(environ)
+ #load the command to run with its arguments
+ foreach(arg ${ARGN})
+ file(APPEND ${bat_file} "${arg} ")
+ endforeach(arg)
+ file(APPEND ${bat_file} "\n")
+
+ add_test(${test_name} ${bat_file})
+ endif(WIN32)
+
+endfunction(GR_ADD_TEST)
diff --git a/gr-utils/src/python/modtool/gr-newmod/cmake/cmake_uninstall.cmake.in b/gr-utils/src/python/modtool/gr-newmod/cmake/cmake_uninstall.cmake.in
new file mode 100644
index 000000000..9ae1ae4bd
--- /dev/null
+++ b/gr-utils/src/python/modtool/gr-newmod/cmake/cmake_uninstall.cmake.in
@@ -0,0 +1,32 @@
+# http://www.vtk.org/Wiki/CMake_FAQ#Can_I_do_.22make_uninstall.22_with_CMake.3F
+
+IF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
+ MESSAGE(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"")
+ENDIF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
+
+FILE(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
+STRING(REGEX REPLACE "\n" ";" files "${files}")
+FOREACH(file ${files})
+ MESSAGE(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"")
+ IF(EXISTS "$ENV{DESTDIR}${file}")
+ EXEC_PROGRAM(
+ "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
+ OUTPUT_VARIABLE rm_out
+ RETURN_VALUE rm_retval
+ )
+ IF(NOT "${rm_retval}" STREQUAL 0)
+ MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"")
+ ENDIF(NOT "${rm_retval}" STREQUAL 0)
+ ELSEIF(IS_SYMLINK "$ENV{DESTDIR}${file}")
+ EXEC_PROGRAM(
+ "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
+ OUTPUT_VARIABLE rm_out
+ RETURN_VALUE rm_retval
+ )
+ IF(NOT "${rm_retval}" STREQUAL 0)
+ MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"")
+ ENDIF(NOT "${rm_retval}" STREQUAL 0)
+ ELSE(EXISTS "$ENV{DESTDIR}${file}")
+ MESSAGE(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.")
+ ENDIF(EXISTS "$ENV{DESTDIR}${file}")
+ENDFOREACH(file)
diff --git a/gr-utils/src/python/modtool/gr-newmod/docs/CMakeLists.txt b/gr-utils/src/python/modtool/gr-newmod/docs/CMakeLists.txt
new file mode 100644
index 000000000..f16fbf6db
--- /dev/null
+++ b/gr-utils/src/python/modtool/gr-newmod/docs/CMakeLists.txt
@@ -0,0 +1,35 @@
+# Copyright 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.
+
+########################################################################
+# Setup dependencies
+########################################################################
+find_package(Doxygen)
+
+########################################################################
+# Begin conditional configuration
+########################################################################
+if(ENABLE_DOXYGEN)
+
+########################################################################
+# Add subdirectories
+########################################################################
+add_subdirectory(doxygen)
+
+endif(ENABLE_DOXYGEN)
diff --git a/gr-utils/src/python/modtool/gr-newmod/docs/README.howto b/gr-utils/src/python/modtool/gr-newmod/docs/README.howto
new file mode 100644
index 000000000..a0a6c0f19
--- /dev/null
+++ b/gr-utils/src/python/modtool/gr-newmod/docs/README.howto
@@ -0,0 +1,11 @@
+This is the howto-write-a-block package meant as a guide to building
+out-of-tree packages. To use the howto blocks, the Python namespaces
+is in 'howto', which is imported as:
+
+ import howto
+
+See the Doxygen documentation for details about the blocks available
+in this package. A quick listing of the details can be found in Python
+after importing by using:
+
+ help(howto)
diff --git a/gr-utils/src/python/modtool/gr-newmod/docs/doxygen/CMakeLists.txt b/gr-utils/src/python/modtool/gr-newmod/docs/doxygen/CMakeLists.txt
new file mode 100644
index 000000000..1b4479929
--- /dev/null
+++ b/gr-utils/src/python/modtool/gr-newmod/docs/doxygen/CMakeLists.txt
@@ -0,0 +1,52 @@
+# Copyright 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.
+
+########################################################################
+# Create the doxygen configuration file
+########################################################################
+file(TO_NATIVE_PATH ${CMAKE_SOURCE_DIR} top_srcdir)
+file(TO_NATIVE_PATH ${CMAKE_BINARY_DIR} top_builddir)
+file(TO_NATIVE_PATH ${CMAKE_SOURCE_DIR} abs_top_srcdir)
+file(TO_NATIVE_PATH ${CMAKE_BINARY_DIR} abs_top_builddir)
+
+set(HAVE_DOT ${DOXYGEN_DOT_FOUND})
+set(enable_html_docs YES)
+set(enable_latex_docs NO)
+set(enable_xml_docs YES)
+
+configure_file(
+ ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in
+ ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
+@ONLY)
+
+set(BUILT_DIRS ${CMAKE_CURRENT_BINARY_DIR}/xml ${CMAKE_CURRENT_BINARY_DIR}/html)
+
+########################################################################
+# Make and install doxygen docs
+########################################################################
+add_custom_command(
+ OUTPUT ${BUILT_DIRS}
+ COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ COMMENT "Generating documentation with doxygen"
+)
+
+add_custom_target(doxygen_target ALL DEPENDS ${BUILT_DIRS})
+
+install(DIRECTORY ${BUILT_DIRS} DESTINATION ${GR_PKG_DOC_DIR})
diff --git a/gr-utils/src/python/modtool/gr-newmod/docs/doxygen/Doxyfile.in b/gr-utils/src/python/modtool/gr-newmod/docs/doxygen/Doxyfile.in
new file mode 100644
index 000000000..cb6a913bb
--- /dev/null
+++ b/gr-utils/src/python/modtool/gr-newmod/docs/doxygen/Doxyfile.in
@@ -0,0 +1,1504 @@
+# Doxyfile 1.5.7.1
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project
+#
+# All text after a hash (#) is considered a comment and will be ignored
+# The format is:
+# TAG = value [value, ...]
+# For lists items can also be appended using:
+# TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (" ")
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+# This tag specifies the encoding used for all characters in the config file
+# that follow. The default is UTF-8 which is also the encoding used for all
+# text before the first occurrence of this tag. Doxygen uses libiconv (or the
+# iconv built into libc) for the transcoding. See
+# http://www.gnu.org/software/libiconv for the list of possible encodings.
+
+DOXYFILE_ENCODING = UTF-8
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
+# by quotes) that should identify the project.
+
+PROJECT_NAME = "GNU Radio's HOWTO Package"
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number.
+# This could be handy for archiving the generated documentation or
+# if some version control system is used.
+
+PROJECT_NUMBER =
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
+# base path where the generated documentation will be put.
+# If a relative path is entered, it will be relative to the location
+# where doxygen was started. If left blank the current directory will be used.
+
+OUTPUT_DIRECTORY =
+
+# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
+# 4096 sub-directories (in 2 levels) under the output directory of each output
+# format and will distribute the generated files over these directories.
+# Enabling this option can be useful when feeding doxygen a huge amount of
+# source files, where putting all generated files in the same directory would
+# otherwise cause performance problems for the file system.
+
+CREATE_SUBDIRS = NO
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all
+# documentation generated by doxygen is written. Doxygen will use this
+# information to generate all constant output in the proper language.
+# The default language is English, other supported languages are:
+# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional,
+# Croatian, Czech, Danish, Dutch, Farsi, Finnish, French, German, Greek,
+# Hungarian, Italian, Japanese, Japanese-en (Japanese with English messages),
+# Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, Polish,
+# Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak, Slovene,
+# Spanish, Swedish, and Ukrainian.
+
+OUTPUT_LANGUAGE = English
+
+# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
+# include brief member descriptions after the members that are listed in
+# the file and class documentation (similar to JavaDoc).
+# Set to NO to disable this.
+
+BRIEF_MEMBER_DESC = YES
+
+# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
+# the brief description of a member or function before the detailed description.
+# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
+# brief descriptions will be completely suppressed.
+
+REPEAT_BRIEF = YES
+
+# This tag implements a quasi-intelligent brief description abbreviator
+# that is used to form the text in various listings. Each string
+# in this list, if found as the leading text of the brief description, will be
+# stripped from the text and the result after processing the whole list, is
+# used as the annotated text. Otherwise, the brief description is used as-is.
+# If left blank, the following values are used ("$name" is automatically
+# replaced with the name of the entity): "The $name class" "The $name widget"
+# "The $name file" "is" "provides" "specifies" "contains"
+# "represents" "a" "an" "the"
+
+ABBREVIATE_BRIEF =
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
+# Doxygen will generate a detailed section even if there is only a brief
+# description.
+
+ALWAYS_DETAILED_SEC = YES
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
+# inherited members of a class in the documentation of that class as if those
+# members were ordinary class members. Constructors, destructors and assignment
+# operators of the base classes will not be shown.
+
+INLINE_INHERITED_MEMB = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
+# path before files name in the file list and in the header files. If set
+# to NO the shortest path that makes the file name unique will be used.
+
+FULL_PATH_NAMES = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
+# can be used to strip a user-defined part of the path. Stripping is
+# only done if one of the specified strings matches the left-hand part of
+# the path. The tag can be used to show relative paths in the file list.
+# If left blank the directory from which doxygen is run is used as the
+# path to strip.
+
+STRIP_FROM_PATH =
+
+# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
+# the path mentioned in the documentation of a class, which tells
+# the reader which header file to include in order to use a class.
+# If left blank only the name of the header file containing the class
+# definition is used. Otherwise one should specify the include paths that
+# are normally passed to the compiler using the -I flag.
+
+STRIP_FROM_INC_PATH =
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
+# (but less readable) file names. This can be useful is your file systems
+# doesn't support long names like on DOS, Mac, or CD-ROM.
+
+SHORT_NAMES = NO
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
+# will interpret the first line (until the first dot) of a JavaDoc-style
+# comment as the brief description. If set to NO, the JavaDoc
+# comments will behave just like regular Qt-style comments
+# (thus requiring an explicit @brief command for a brief description.)
+
+JAVADOC_AUTOBRIEF = NO
+
+# If the QT_AUTOBRIEF tag is set to YES then Doxygen will
+# interpret the first line (until the first dot) of a Qt-style
+# comment as the brief description. If set to NO, the comments
+# will behave just like regular Qt-style comments (thus requiring
+# an explicit \brief command for a brief description.)
+
+QT_AUTOBRIEF = NO
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
+# treat a multi-line C++ special comment block (i.e. a block of //! or ///
+# comments) as a brief description. This used to be the default behaviour.
+# The new default is to treat a multi-line C++ comment block as a detailed
+# description. Set this tag to YES if you prefer the old behaviour instead.
+
+MULTILINE_CPP_IS_BRIEF = YES
+
+# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
+# member inherits the documentation from any documented member that it
+# re-implements.
+
+INHERIT_DOCS = YES
+
+# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce
+# a new page for each member. If set to NO, the documentation of a member will
+# be part of the file/class/namespace that contains it.
+
+SEPARATE_MEMBER_PAGES = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab.
+# Doxygen uses this value to replace tabs by spaces in code fragments.
+
+TAB_SIZE = 8
+
+# This tag can be used to specify a number of aliases that acts
+# as commands in the documentation. An alias has the form "name=value".
+# For example adding "sideeffect=\par Side Effects:\n" will allow you to
+# put the command \sideeffect (or @sideeffect) in the documentation, which
+# will result in a user-defined paragraph with heading "Side Effects:".
+# You can put \n's in the value part of an alias to insert newlines.
+
+ALIASES =
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
+# sources only. Doxygen will then generate output that is more tailored for C.
+# For instance, some of the names that are used will be different. The list
+# of all members will be omitted, etc.
+
+OPTIMIZE_OUTPUT_FOR_C = NO
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java
+# sources only. Doxygen will then generate output that is more tailored for
+# Java. For instance, namespaces will be presented as packages, qualified
+# scopes will look different, etc.
+
+OPTIMIZE_OUTPUT_JAVA = NO
+
+# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
+# sources only. Doxygen will then generate output that is more tailored for
+# Fortran.
+
+OPTIMIZE_FOR_FORTRAN = NO
+
+# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
+# sources. Doxygen will then generate output that is tailored for
+# VHDL.
+
+OPTIMIZE_OUTPUT_VHDL = NO
+
+# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
+# to include (a tag file for) the STL sources as input, then you should
+# set this tag to YES in order to let doxygen match functions declarations and
+# definitions whose arguments contain STL classes (e.g. func(std::string); v.s.
+# func(std::string) {}). This also make the inheritance and collaboration
+# diagrams that involve STL classes more complete and accurate.
+
+BUILTIN_STL_SUPPORT = YES
+
+# If you use Microsoft's C++/CLI language, you should set this option to YES to
+# enable parsing support.
+
+CPP_CLI_SUPPORT = NO
+
+# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only.
+# Doxygen will parse them like normal C++ but will assume all classes use public
+# instead of private inheritance when no explicit protection keyword is present.
+
+SIP_SUPPORT = NO
+
+# For Microsoft's IDL there are propget and propput attributes to indicate getter
+# and setter methods for a property. Setting this option to YES (the default)
+# will make doxygen to replace the get and set methods by a property in the
+# documentation. This will only work if the methods are indeed getting or
+# setting a simple type. If this is not the case, or you want to show the
+# methods anyway, you should set this option to NO.
+
+IDL_PROPERTY_SUPPORT = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
+# tag is set to YES, then doxygen will reuse the documentation of the first
+# member in the group (if any) for the other members of the group. By default
+# all members of a group must be documented explicitly.
+
+DISTRIBUTE_GROUP_DOC = NO
+
+# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
+# the same type (for instance a group of public functions) to be put as a
+# subgroup of that type (e.g. under the Public Functions section). Set it to
+# NO to prevent subgrouping. Alternatively, this can be done per class using
+# the \nosubgrouping command.
+
+SUBGROUPING = YES
+
+# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum
+# is documented as struct, union, or enum with the name of the typedef. So
+# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
+# with name TypeT. When disabled the typedef will appear as a member of a file,
+# namespace, or class. And the struct will be named TypeS. This can typically
+# be useful for C code in case the coding convention dictates that all compound
+# types are typedef'ed and only the typedef is referenced, never the tag name.
+
+TYPEDEF_HIDES_STRUCT = NO
+
+# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to
+# determine which symbols to keep in memory and which to flush to disk.
+# When the cache is full, less often used symbols will be written to disk.
+# For small to medium size projects (<1000 input files) the default value is
+# probably good enough. For larger projects a too small cache size can cause
+# doxygen to be busy swapping symbols to and from disk most of the time
+# causing a significant performance penality.
+# If the system has enough physical memory increasing the cache will improve the
+# performance by keeping more symbols in memory. Note that the value works on
+# a logarithmic scale so increasing the size by one will rougly double the
+# memory usage. The cache size is given by this formula:
+# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0,
+# corresponding to a cache size of 2^16 = 65536 symbols
+
+SYMBOL_CACHE_SIZE = 4
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
+# documentation are documented, even if no documentation was available.
+# Private class members and static file members will be hidden unless
+# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
+
+EXTRACT_ALL = YES
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
+# will be included in the documentation.
+
+EXTRACT_PRIVATE = NO
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file
+# will be included in the documentation.
+
+EXTRACT_STATIC = YES
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
+# defined locally in source files will be included in the documentation.
+# If set to NO only classes defined in header files are included.
+
+EXTRACT_LOCAL_CLASSES = YES
+
+# This flag is only useful for Objective-C code. When set to YES local
+# methods, which are defined in the implementation section but not in
+# the interface are included in the documentation.
+# If set to NO (the default) only methods in the interface are included.
+
+EXTRACT_LOCAL_METHODS = NO
+
+# If this flag is set to YES, the members of anonymous namespaces will be
+# extracted and appear in the documentation as a namespace called
+# 'anonymous_namespace{file}', where file will be replaced with the base
+# name of the file that contains the anonymous namespace. By default
+# anonymous namespace are hidden.
+
+EXTRACT_ANON_NSPACES = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
+# undocumented members of documented classes, files or namespaces.
+# If set to NO (the default) these members will be included in the
+# various overviews, but no documentation section is generated.
+# This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_MEMBERS = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
+# undocumented classes that are normally visible in the class hierarchy.
+# If set to NO (the default) these classes will be included in the various
+# overviews. This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_CLASSES = NO
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
+# friend (class|struct|union) declarations.
+# If set to NO (the default) these declarations will be included in the
+# documentation.
+
+HIDE_FRIEND_COMPOUNDS = NO
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
+# documentation blocks found inside the body of a function.
+# If set to NO (the default) these blocks will be appended to the
+# function's detailed documentation block.
+
+HIDE_IN_BODY_DOCS = NO
+
+# The INTERNAL_DOCS tag determines if documentation
+# that is typed after a \internal command is included. If the tag is set
+# to NO (the default) then the documentation will be excluded.
+# Set it to YES to include the internal documentation.
+
+INTERNAL_DOCS = NO
+
+# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
+# file names in lower-case letters. If set to YES upper-case letters are also
+# allowed. This is useful if you have classes or files whose names only differ
+# in case and if your file system supports case sensitive file names. Windows
+# and Mac users are advised to set this option to NO.
+
+CASE_SENSE_NAMES = YES
+
+# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
+# will show members with their full class and namespace scopes in the
+# documentation. If set to YES the scope will be hidden.
+
+HIDE_SCOPE_NAMES = NO
+
+# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
+# will put a list of the files that are included by a file in the documentation
+# of that file.
+
+SHOW_INCLUDE_FILES = YES
+
+# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
+# is inserted in the documentation for inline members.
+
+INLINE_INFO = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
+# will sort the (detailed) documentation of file and class members
+# alphabetically by member name. If set to NO the members will appear in
+# declaration order.
+
+SORT_MEMBER_DOCS = YES
+
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
+# brief documentation of file, namespace and class members alphabetically
+# by member name. If set to NO (the default) the members will appear in
+# declaration order.
+
+SORT_BRIEF_DOCS = NO
+
+# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the
+# hierarchy of group names into alphabetical order. If set to NO (the default)
+# the group names will appear in their defined order.
+
+SORT_GROUP_NAMES = NO
+
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
+# sorted by fully-qualified names, including namespaces. If set to
+# NO (the default), the class list will be sorted only by class name,
+# not including the namespace part.
+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
+# Note: This option applies only to the class list, not to the
+# alphabetical list.
+
+SORT_BY_SCOPE_NAME = NO
+
+# The GENERATE_TODOLIST tag can be used to enable (YES) or
+# disable (NO) the todo list. This list is created by putting \todo
+# commands in the documentation.
+
+GENERATE_TODOLIST = NO
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or
+# disable (NO) the test list. This list is created by putting \test
+# commands in the documentation.
+
+GENERATE_TESTLIST = NO
+
+# The GENERATE_BUGLIST tag can be used to enable (YES) or
+# disable (NO) the bug list. This list is created by putting \bug
+# commands in the documentation.
+
+GENERATE_BUGLIST = NO
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
+# disable (NO) the deprecated list. This list is created by putting
+# \deprecated commands in the documentation.
+
+GENERATE_DEPRECATEDLIST= NO
+
+# The ENABLED_SECTIONS tag can be used to enable conditional
+# documentation sections, marked by \if sectionname ... \endif.
+
+ENABLED_SECTIONS =
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
+# the initial value of a variable or define consists of for it to appear in
+# the documentation. If the initializer consists of more lines than specified
+# here it will be hidden. Use a value of 0 to hide initializers completely.
+# The appearance of the initializer of individual variables and defines in the
+# documentation can be controlled using \showinitializer or \hideinitializer
+# command in the documentation regardless of this setting.
+
+MAX_INITIALIZER_LINES = 30
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
+# at the bottom of the documentation of classes and structs. If set to YES the
+# list will mention the files that were used to generate the documentation.
+
+SHOW_USED_FILES = YES
+
+# If the sources in your project are distributed over multiple directories
+# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy
+# in the documentation. The default is NO.
+
+SHOW_DIRECTORIES = NO
+
+# Set the SHOW_FILES tag to NO to disable the generation of the Files page.
+# This will remove the Files entry from the Quick Index and from the
+# Folder Tree View (if specified). The default is YES.
+
+SHOW_FILES = YES
+
+# Set the SHOW_NAMESPACES tag to NO to disable the generation of the
+# Namespaces page. This will remove the Namespaces entry from the Quick Index
+# and from the Folder Tree View (if specified). The default is YES.
+
+SHOW_NAMESPACES = NO
+
+# The FILE_VERSION_FILTER tag can be used to specify a program or script that
+# doxygen should invoke to get the current version for each file (typically from
+# the version control system). Doxygen will invoke the program by executing (via
+# popen()) the command <command> <input-file>, where <command> is the value of
+# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file
+# provided by doxygen. Whatever the program writes to standard output
+# is used as the file version. See the manual for examples.
+
+FILE_VERSION_FILTER =
+
+# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed by
+# doxygen. The layout file controls the global structure of the generated output files
+# in an output format independent way. The create the layout file that represents
+# doxygen's defaults, run doxygen with the -l option. You can optionally specify a
+# file name after the option, if omitted DoxygenLayout.xml will be used as the name
+# of the layout file.
+
+LAYOUT_FILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated
+# by doxygen. Possible values are YES and NO. If left blank NO is used.
+
+QUIET = YES
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are
+# generated by doxygen. Possible values are YES and NO. If left blank
+# NO is used.
+
+WARNINGS = YES
+
+# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
+# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
+# automatically be disabled.
+
+WARN_IF_UNDOCUMENTED = YES
+
+# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
+# potential errors in the documentation, such as not documenting some
+# parameters in a documented function, or documenting parameters that
+# don't exist or using markup commands wrongly.
+
+WARN_IF_DOC_ERROR = YES
+
+# This WARN_NO_PARAMDOC option can be abled to get warnings for
+# functions that are documented, but have no documentation for their parameters
+# or return value. If set to NO (the default) doxygen will only warn about
+# wrong or incomplete parameter documentation, but not about the absence of
+# documentation.
+
+WARN_NO_PARAMDOC = NO
+
+# The WARN_FORMAT tag determines the format of the warning messages that
+# doxygen can produce. The string should contain the $file, $line, and $text
+# tags, which will be replaced by the file and line number from which the
+# warning originated and the warning text. Optionally the format may contain
+# $version, which will be replaced by the version of the file (if it could
+# be obtained via FILE_VERSION_FILTER)
+
+WARN_FORMAT = "$file:$line: $text "
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning
+# and error messages should be written. If left blank the output is written
+# to stderr.
+
+WARN_LOGFILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag can be used to specify the files and/or directories that contain
+# documented source files. You may enter file names like "myfile.cpp" or
+# directories like "/usr/src/myproject". Separate the files or directories
+# with spaces.
+
+INPUT = @top_srcdir@ @top_builddir@
+
+# This tag can be used to specify the character encoding of the source files
+# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
+# also the default input encoding. Doxygen uses libiconv (or the iconv built
+# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for
+# the list of possible encodings.
+
+INPUT_ENCODING = UTF-8
+
+# If the value of the INPUT tag contains directories, you can use the
+# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank the following patterns are tested:
+# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx
+# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90
+
+FILE_PATTERNS = *.h \
+ *.dox
+
+# The RECURSIVE tag can be used to turn specify whether or not subdirectories
+# should be searched for input files as well. Possible values are YES and NO.
+# If left blank NO is used.
+
+RECURSIVE = YES
+
+# The EXCLUDE tag can be used to specify files and/or directories that should
+# excluded from the INPUT source files. This way you can easily exclude a
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+
+EXCLUDE = @abs_top_builddir@/docs/doxygen/html \
+ @abs_top_builddir@/docs/doxygen/xml \
+ @abs_top_builddir@/docs/doxygen/other/doxypy.py \
+ @abs_top_builddir@/_CPack_Packages \
+ @abs_top_srcdir@/cmake
+
+# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
+# directories that are symbolic links (a Unix filesystem feature) are excluded
+# from the input.
+
+EXCLUDE_SYMLINKS = NO
+
+# If the value of the INPUT tag contains directories, you can use the
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
+# certain files from those directories. Note that the wildcards are matched
+# against the file with absolute path, so to exclude all test directories
+# for example use the pattern */test/*
+
+EXCLUDE_PATTERNS = */.deps/* \
+ */.libs/* \
+ */.svn/* \
+ */CVS/* \
+ */__init__.py \
+ */qa_*.cc \
+ */qa_*.h \
+ */qa_*.py
+
+# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
+# (namespaces, classes, functions, etc.) that should be excluded from the
+# output. The symbol name can be a fully qualified name, a word, or if the
+# wildcard * is used, a substring. Examples: ANamespace, AClass,
+# AClass::ANamespace, ANamespace::*Test
+
+EXCLUDE_SYMBOLS = ad9862 \
+ numpy \
+ *swig* \
+ *Swig* \
+ *my_top_block* \
+ *my_graph* \
+ *app_top_block* \
+ *am_rx_graph* \
+ *_queue_watcher_thread* \
+ *parse* \
+ *MyFrame* \
+ *MyApp* \
+ *PyObject* \
+ *wfm_rx_block* \
+ *_sptr* \
+ *debug* \
+ *wfm_rx_sca_block* \
+ *tv_rx_block* \
+ *wxapt_rx_block* \
+ *example_signal*
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or
+# directories that contain example code fragments that are included (see
+# the \include command).
+
+EXAMPLE_PATH =
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank all files are included.
+
+EXAMPLE_PATTERNS =
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
+# searched for input files to be used with the \include or \dontinclude
+# commands irrespective of the value of the RECURSIVE tag.
+# Possible values are YES and NO. If left blank NO is used.
+
+EXAMPLE_RECURSIVE = NO
+
+# The IMAGE_PATH tag can be used to specify one or more files or
+# directories that contain image that are included in the documentation (see
+# the \image command).
+
+IMAGE_PATH =
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should
+# invoke to filter for each input file. Doxygen will invoke the filter program
+# by executing (via popen()) the command <filter> <input-file>, where <filter>
+# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
+# input file. Doxygen will then use the output that the filter program writes
+# to standard output. If FILTER_PATTERNS is specified, this tag will be
+# ignored.
+
+INPUT_FILTER =
+
+# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
+# basis. Doxygen will compare the file name with each pattern and apply the
+# filter if there is a match. The filters are a list of the form:
+# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
+# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER
+# is applied to all files.
+
+FILTER_PATTERNS = *.py=@top_srcdir@/gnuradio-core/doc/other/doxypy.py
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
+# INPUT_FILTER) will be used to filter the input files when producing source
+# files to browse (i.e. when SOURCE_BROWSER is set to YES).
+
+FILTER_SOURCE_FILES = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will
+# be generated. Documented entities will be cross-referenced with these sources.
+# Note: To get rid of all source code in the generated output, make sure also
+# VERBATIM_HEADERS is set to NO.
+
+SOURCE_BROWSER = NO
+
+# Setting the INLINE_SOURCES tag to YES will include the body
+# of functions and classes directly in the documentation.
+
+INLINE_SOURCES = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
+# doxygen to hide any special comment blocks from generated source code
+# fragments. Normal C and C++ comments will always remain visible.
+
+STRIP_CODE_COMMENTS = NO
+
+# If the REFERENCED_BY_RELATION tag is set to YES
+# then for each documented function all documented
+# functions referencing it will be listed.
+
+REFERENCED_BY_RELATION = YES
+
+# If the REFERENCES_RELATION tag is set to YES
+# then for each documented function all documented entities
+# called/used by that function will be listed.
+
+REFERENCES_RELATION = YES
+
+# If the REFERENCES_LINK_SOURCE tag is set to YES (the default)
+# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
+# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
+# link to the source code. Otherwise they will link to the documentstion.
+
+REFERENCES_LINK_SOURCE = YES
+
+# If the USE_HTAGS tag is set to YES then the references to source code
+# will point to the HTML generated by the htags(1) tool instead of doxygen
+# built-in source browser. The htags tool is part of GNU's global source
+# tagging system (see http://www.gnu.org/software/global/global.html). You
+# will need version 4.8.6 or higher.
+
+USE_HTAGS = NO
+
+# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
+# will generate a verbatim copy of the header file for each class for
+# which an include is specified. Set to NO to disable this.
+
+VERBATIM_HEADERS = YES
+
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
+# of all compounds will be generated. Enable this if the project
+# contains a lot of classes, structs, unions or interfaces.
+
+ALPHABETICAL_INDEX = YES
+
+# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
+# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
+# in which this list will be split (can be a number in the range [1..20])
+
+COLS_IN_ALPHA_INDEX = 5
+
+# In case all classes in a project start with a common prefix, all
+# classes will be put under the same header in the alphabetical index.
+# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
+# should be ignored while generating the index headers.
+
+IGNORE_PREFIX =
+
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
+# generate HTML output.
+
+GENERATE_HTML = @enable_html_docs@
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `html' will be used as the default path.
+
+HTML_OUTPUT = html
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
+# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
+# doxygen will generate files with .html extension.
+
+HTML_FILE_EXTENSION = .html
+
+# The HTML_HEADER tag can be used to specify a personal HTML header for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard header.
+
+HTML_HEADER =
+
+# The HTML_FOOTER tag can be used to specify a personal HTML footer for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard footer.
+
+HTML_FOOTER =
+
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
+# style sheet that is used by each HTML page. It can be used to
+# fine-tune the look of the HTML output. If the tag is left blank doxygen
+# will generate a default style sheet. Note that doxygen will try to copy
+# the style sheet file to the HTML output directory, so don't put your own
+# stylesheet in the HTML output directory as well, or it will be erased!
+
+HTML_STYLESHEET =
+
+# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
+# files or namespaces will be aligned in HTML using tables. If set to
+# NO a bullet list will be used.
+
+HTML_ALIGN_MEMBERS = YES
+
+# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
+# documentation will contain sections that can be hidden and shown after the
+# page has loaded. For this to work a browser that supports
+# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox
+# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
+
+HTML_DYNAMIC_SECTIONS = NO
+
+# If the GENERATE_DOCSET tag is set to YES, additional index files
+# will be generated that can be used as input for Apple's Xcode 3
+# integrated development environment, introduced with OSX 10.5 (Leopard).
+# To create a documentation set, doxygen will generate a Makefile in the
+# HTML output directory. Running make will produce the docset in that
+# directory and running "make install" will install the docset in
+# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find
+# it at startup.
+# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html for more information.
+
+GENERATE_DOCSET = NO
+
+# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the
+# feed. A documentation feed provides an umbrella under which multiple
+# documentation sets from a single provider (such as a company or product suite)
+# can be grouped.
+
+DOCSET_FEEDNAME = "Doxygen generated docs"
+
+# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that
+# should uniquely identify the documentation set bundle. This should be a
+# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen
+# will append .docset to the name.
+
+DOCSET_BUNDLE_ID = org.doxygen.Project
+
+# If the GENERATE_HTMLHELP tag is set to YES, additional index files
+# will be generated that can be used as input for tools like the
+# Microsoft HTML help workshop to generate a compiled HTML help file (.chm)
+# of the generated HTML documentation.
+
+GENERATE_HTMLHELP = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
+# be used to specify the file name of the resulting .chm file. You
+# can add a path in front of the file if the result should not be
+# written to the html output directory.
+
+CHM_FILE =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
+# be used to specify the location (absolute path including file name) of
+# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
+# the HTML help compiler on the generated index.hhp.
+
+HHC_LOCATION =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
+# controls if a separate .chi index file is generated (YES) or that
+# it should be included in the master .chm file (NO).
+
+GENERATE_CHI = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING
+# is used to encode HtmlHelp index (hhk), content (hhc) and project file
+# content.
+
+CHM_INDEX_ENCODING =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
+# controls whether a binary table of contents is generated (YES) or a
+# normal table of contents (NO) in the .chm file.
+
+BINARY_TOC = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members
+# to the contents of the HTML help documentation and to the tree view.
+
+TOC_EXPAND = YES
+
+# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and QHP_VIRTUAL_FOLDER
+# are set, an additional index file will be generated that can be used as input for
+# Qt's qhelpgenerator to generate a Qt Compressed Help (.qch) of the generated
+# HTML documentation.
+
+GENERATE_QHP = NO
+
+# If the QHG_LOCATION tag is specified, the QCH_FILE tag can
+# be used to specify the file name of the resulting .qch file.
+# The path specified is relative to the HTML output folder.
+
+QCH_FILE =
+
+# The QHP_NAMESPACE tag specifies the namespace to use when generating
+# Qt Help Project output. For more information please see
+# <a href="http://doc.trolltech.com/qthelpproject.html#namespace">Qt Help Project / Namespace</a>.
+
+QHP_NAMESPACE = org.doxygen.Project
+
+# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating
+# Qt Help Project output. For more information please see
+# <a href="http://doc.trolltech.com/qthelpproject.html#virtual-folders">Qt Help Project / Virtual Folders</a>.
+
+QHP_VIRTUAL_FOLDER = doc
+
+# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can
+# be used to specify the location of Qt's qhelpgenerator.
+# If non-empty doxygen will try to run qhelpgenerator on the generated
+# .qhp file .
+
+QHG_LOCATION =
+
+# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
+# top of each HTML page. The value NO (the default) enables the index and
+# the value YES disables it.
+
+DISABLE_INDEX = YES
+
+# This tag can be used to set the number of enum values (range [1..20])
+# that doxygen will group on one line in the generated HTML documentation.
+
+ENUM_VALUES_PER_LINE = 4
+
+# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
+# structure should be generated to display hierarchical information.
+# If the tag value is set to FRAME, a side panel will be generated
+# containing a tree-like index structure (just like the one that
+# is generated for HTML Help). For this to work a browser that supports
+# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+,
+# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are
+# probably better off using the HTML help feature. Other possible values
+# for this tag are: HIERARCHIES, which will generate the Groups, Directories,
+# and Class Hierarchy pages using a tree view instead of an ordered list;
+# ALL, which combines the behavior of FRAME and HIERARCHIES; and NONE, which
+# disables this behavior completely. For backwards compatibility with previous
+# releases of Doxygen, the values YES and NO are equivalent to FRAME and NONE
+# respectively.
+
+GENERATE_TREEVIEW = YES
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
+# used to set the initial width (in pixels) of the frame in which the tree
+# is shown.
+
+TREEVIEW_WIDTH = 180
+
+# Use this tag to change the font size of Latex formulas included
+# as images in the HTML documentation. The default is 10. Note that
+# when you change the font size after a successful doxygen run you need
+# to manually remove any form_*.png images from the HTML output directory
+# to force them to be regenerated.
+
+FORMULA_FONTSIZE = 10
+
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
+# generate Latex output.
+
+GENERATE_LATEX = @enable_latex_docs@
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `latex' will be used as the default path.
+
+LATEX_OUTPUT = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
+# invoked. If left blank `latex' will be used as the default command name.
+
+LATEX_CMD_NAME = latex
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
+# generate index for LaTeX. If left blank `makeindex' will be used as the
+# default command name.
+
+MAKEINDEX_CMD_NAME = makeindex
+
+# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
+# LaTeX documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_LATEX = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used
+# by the printer. Possible values are: a4, a4wide, letter, legal and
+# executive. If left blank a4wide will be used.
+
+PAPER_TYPE = letter
+
+# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
+# packages that should be included in the LaTeX output.
+
+EXTRA_PACKAGES =
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
+# the generated latex document. The header should contain everything until
+# the first chapter. If it is left blank doxygen will generate a
+# standard header. Notice: only use this tag if you know what you are doing!
+
+LATEX_HEADER =
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
+# is prepared for conversion to pdf (using ps2pdf). The pdf file will
+# contain links (just like the HTML output) instead of page references
+# This makes the output suitable for online browsing using a pdf viewer.
+
+PDF_HYPERLINKS = YES
+
+# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
+# plain latex in the generated Makefile. Set this option to YES to get a
+# higher quality PDF documentation.
+
+USE_PDFLATEX = NO
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
+# command to the generated LaTeX files. This will instruct LaTeX to keep
+# running if errors occur, instead of asking the user for help.
+# This option is also used when generating formulas in HTML.
+
+LATEX_BATCHMODE = NO
+
+# If LATEX_HIDE_INDICES is set to YES then doxygen will not
+# include the index chapters (such as File Index, Compound Index, etc.)
+# in the output.
+
+LATEX_HIDE_INDICES = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
+# The RTF output is optimized for Word 97 and may not look very pretty with
+# other RTF readers or editors.
+
+GENERATE_RTF = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `rtf' will be used as the default path.
+
+RTF_OUTPUT = rtf
+
+# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
+# RTF documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_RTF = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
+# will contain hyperlink fields. The RTF file will
+# contain links (just like the HTML output) instead of page references.
+# This makes the output suitable for online browsing using WORD or other
+# programs which support those fields.
+# Note: wordpad (write) and others do not support links.
+
+RTF_HYPERLINKS = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's
+# config file, i.e. a series of assignments. You only have to provide
+# replacements, missing definitions are set to their default value.
+
+RTF_STYLESHEET_FILE =
+
+# Set optional variables used in the generation of an rtf document.
+# Syntax is similar to doxygen's config file.
+
+RTF_EXTENSIONS_FILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
+# generate man pages
+
+GENERATE_MAN = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `man' will be used as the default path.
+
+MAN_OUTPUT = man
+
+# The MAN_EXTENSION tag determines the extension that is added to
+# the generated man pages (default is the subroutine's section .3)
+
+MAN_EXTENSION = .3
+
+# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
+# then it will generate one additional man file for each entity
+# documented in the real man page(s). These additional files
+# only source the real man page, but without them the man command
+# would be unable to find the correct page. The default is NO.
+
+MAN_LINKS = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES Doxygen will
+# generate an XML file that captures the structure of
+# the code including all documentation.
+
+GENERATE_XML = @enable_xml_docs@
+
+# The XML_OUTPUT tag is used to specify where the XML pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `xml' will be used as the default path.
+
+XML_OUTPUT = xml
+
+# The XML_SCHEMA tag can be used to specify an XML schema,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_SCHEMA =
+
+# The XML_DTD tag can be used to specify an XML DTD,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_DTD =
+
+# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
+# dump the program listings (including syntax highlighting
+# and cross-referencing information) to the XML output. Note that
+# enabling this will significantly increase the size of the XML output.
+
+XML_PROGRAMLISTING = NO
+
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
+# generate an AutoGen Definitions (see autogen.sf.net) file
+# that captures the structure of the code including all
+# documentation. Note that this feature is still experimental
+# and incomplete at the moment.
+
+GENERATE_AUTOGEN_DEF = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_PERLMOD tag is set to YES Doxygen will
+# generate a Perl module file that captures the structure of
+# the code including all documentation. Note that this
+# feature is still experimental and incomplete at the
+# moment.
+
+GENERATE_PERLMOD = NO
+
+# If the PERLMOD_LATEX tag is set to YES Doxygen will generate
+# the necessary Makefile rules, Perl scripts and LaTeX code to be able
+# to generate PDF and DVI output from the Perl module output.
+
+PERLMOD_LATEX = NO
+
+# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
+# nicely formatted so it can be parsed by a human reader. This is useful
+# if you want to understand what is going on. On the other hand, if this
+# tag is set to NO the size of the Perl module output will be much smaller
+# and Perl will parse it just the same.
+
+PERLMOD_PRETTY = YES
+
+# The names of the make variables in the generated doxyrules.make file
+# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
+# This is useful so different doxyrules.make files included by the same
+# Makefile don't overwrite each other's variables.
+
+PERLMOD_MAKEVAR_PREFIX =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
+# evaluate all C-preprocessor directives found in the sources and include
+# files.
+
+ENABLE_PREPROCESSING = YES
+
+# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
+# names in the source code. If set to NO (the default) only conditional
+# compilation will be performed. Macro expansion can be done in a controlled
+# way by setting EXPAND_ONLY_PREDEF to YES.
+
+MACRO_EXPANSION = NO
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
+# then the macro expansion is limited to the macros specified with the
+# PREDEFINED and EXPAND_AS_DEFINED tags.
+
+EXPAND_ONLY_PREDEF = NO
+
+# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
+# in the INCLUDE_PATH (see below) will be search if a #include is found.
+
+SEARCH_INCLUDES = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that
+# contain include files that are not input files but should be processed by
+# the preprocessor.
+
+INCLUDE_PATH =
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
+# patterns (like *.h and *.hpp) to filter out the header-files in the
+# directories. If left blank, the patterns specified with FILE_PATTERNS will
+# be used.
+
+INCLUDE_FILE_PATTERNS =
+
+# The PREDEFINED tag can be used to specify one or more macro names that
+# are defined before the preprocessor is started (similar to the -D option of
+# gcc). The argument of the tag is a list of macros of the form: name
+# or name=definition (no spaces). If the definition and the = are
+# omitted =1 is assumed. To prevent a macro definition from being
+# undefined via #undef or recursively expanded use the := operator
+# instead of the = operator.
+
+PREDEFINED =
+
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
+# this tag can be used to specify a list of macro names that should be expanded.
+# The macro definition that is found in the sources will be used.
+# Use the PREDEFINED tag if you want to use a different macro definition.
+
+EXPAND_AS_DEFINED =
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
+# doxygen's preprocessor will remove all function-like macros that are alone
+# on a line, have an all uppercase name, and do not end with a semicolon. Such
+# function macros are typically used for boiler-plate code, and will confuse
+# the parser if not removed.
+
+SKIP_FUNCTION_MACROS = YES
+
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references
+#---------------------------------------------------------------------------
+
+# The TAGFILES option can be used to specify one or more tagfiles.
+# Optionally an initial location of the external documentation
+# can be added for each tagfile. The format of a tag file without
+# this location is as follows:
+# TAGFILES = file1 file2 ...
+# Adding location for the tag files is done as follows:
+# TAGFILES = file1=loc1 "file2 = loc2" ...
+# where "loc1" and "loc2" can be relative or absolute paths or
+# URLs. If a location is present for each tag, the installdox tool
+# does not have to be run to correct the links.
+# Note that each tag file must have a unique name
+# (where the name does NOT include the path)
+# If a tag file is not located in the directory in which doxygen
+# is run, you must also specify the path to the tagfile here.
+
+TAGFILES =
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create
+# a tag file that is based on the input files it reads.
+
+GENERATE_TAGFILE =
+
+# If the ALLEXTERNALS tag is set to YES all external classes will be listed
+# in the class index. If set to NO only the inherited external classes
+# will be listed.
+
+ALLEXTERNALS = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
+# in the modules index. If set to NO, only the current project's groups will
+# be listed.
+
+EXTERNAL_GROUPS = YES
+
+# The PERL_PATH should be the absolute path and name of the perl script
+# interpreter (i.e. the result of `which perl').
+
+PERL_PATH = /usr/bin/perl
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
+# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base
+# or super classes. Setting the tag to NO turns the diagrams off. Note that
+# this option is superseded by the HAVE_DOT option below. This is only a
+# fallback. It is recommended to install and use dot, since it yields more
+# powerful graphs.
+
+CLASS_DIAGRAMS = YES
+
+# You can define message sequence charts within doxygen comments using the \msc
+# command. Doxygen will then run the mscgen tool (see
+# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the
+# documentation. The MSCGEN_PATH tag allows you to specify the directory where
+# the mscgen tool resides. If left empty the tool is assumed to be found in the
+# default search path.
+
+MSCGEN_PATH =
+
+# If set to YES, the inheritance and collaboration graphs will hide
+# inheritance and usage relations if the target is undocumented
+# or is not a class.
+
+HIDE_UNDOC_RELATIONS = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
+# available from the path. This tool is part of Graphviz, a graph visualization
+# toolkit from AT&T and Lucent Bell Labs. The other options in this section
+# have no effect if this option is set to NO (the default)
+
+HAVE_DOT = @HAVE_DOT@
+
+# By default doxygen will write a font called FreeSans.ttf to the output
+# directory and reference it in all dot files that doxygen generates. This
+# font does not include all possible unicode characters however, so when you need
+# these (or just want a differently looking font) you can specify the font name
+# using DOT_FONTNAME. You need need to make sure dot is able to find the font,
+# which can be done by putting it in a standard location or by setting the
+# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory
+# containing the font.
+
+DOT_FONTNAME = FreeSans
+
+# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs.
+# The default size is 10pt.
+
+DOT_FONTSIZE = 10
+
+# By default doxygen will tell dot to use the output directory to look for the
+# FreeSans.ttf font (which doxygen will put there itself). If you specify a
+# different font using DOT_FONTNAME you can set the path where dot
+# can find it using this tag.
+
+DOT_FONTPATH =
+
+# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect inheritance relations. Setting this tag to YES will force the
+# the CLASS_DIAGRAMS tag to NO.
+
+CLASS_GRAPH = YES
+
+# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect implementation dependencies (inheritance, containment, and
+# class references variables) of the class with other documented classes.
+
+COLLABORATION_GRAPH = NO
+
+# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for groups, showing the direct groups dependencies
+
+GROUP_GRAPHS = YES
+
+# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
+# collaboration diagrams in a style similar to the OMG's Unified Modeling
+# Language.
+
+UML_LOOK = NO
+
+# If set to YES, the inheritance and collaboration graphs will show the
+# relations between templates and their instances.
+
+TEMPLATE_RELATIONS = NO
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
+# tags are set to YES then doxygen will generate a graph for each documented
+# file showing the direct and indirect include dependencies of the file with
+# other documented files.
+
+INCLUDE_GRAPH = YES
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
+# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
+# documented header file showing the documented files that directly or
+# indirectly include this file.
+
+INCLUDED_BY_GRAPH = YES
+
+# If the CALL_GRAPH and HAVE_DOT options are set to YES then
+# doxygen will generate a call dependency graph for every global function
+# or class method. Note that enabling this option will significantly increase
+# the time of a run. So in most cases it will be better to enable call graphs
+# for selected functions only using the \callgraph command.
+
+CALL_GRAPH = NO
+
+# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then
+# doxygen will generate a caller dependency graph for every global function
+# or class method. Note that enabling this option will significantly increase
+# the time of a run. So in most cases it will be better to enable caller
+# graphs for selected functions only using the \callergraph command.
+
+CALLER_GRAPH = NO
+
+# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
+# will graphical hierarchy of all classes instead of a textual one.
+
+GRAPHICAL_HIERARCHY = YES
+
+# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES
+# then doxygen will show the dependencies a directory has on other directories
+# in a graphical way. The dependency relations are determined by the #include
+# relations between the files in the directories.
+
+DIRECTORY_GRAPH = YES
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
+# generated by dot. Possible values are png, jpg, or gif
+# If left blank png will be used.
+
+DOT_IMAGE_FORMAT = png
+
+# The tag DOT_PATH can be used to specify the path where the dot tool can be
+# found. If left blank, it is assumed the dot tool can be found in the path.
+
+DOT_PATH =
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that
+# contain dot files that are included in the documentation (see the
+# \dotfile command).
+
+DOTFILE_DIRS =
+
+# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of
+# nodes that will be shown in the graph. If the number of nodes in a graph
+# becomes larger than this value, doxygen will truncate the graph, which is
+# visualized by representing a node as a red box. Note that doxygen if the
+# number of direct children of the root node in a graph is already larger than
+# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note
+# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
+
+DOT_GRAPH_MAX_NODES = 50
+
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
+# graphs generated by dot. A depth value of 3 means that only nodes reachable
+# from the root by following a path via at most 3 edges will be shown. Nodes
+# that lay further from the root node will be omitted. Note that setting this
+# option to 1 or 2 may greatly reduce the computation time needed for large
+# code bases. Also note that the size of a graph can be further restricted by
+# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
+
+MAX_DOT_GRAPH_DEPTH = 0
+
+# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
+# background. This is disabled by default, because dot on Windows does not
+# seem to support this out of the box. Warning: Depending on the platform used,
+# enabling this option may lead to badly anti-aliased labels on the edges of
+# a graph (i.e. they become hard to read).
+
+DOT_TRANSPARENT = NO
+
+# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
+# files in one run (i.e. multiple -o and -T options on the command line). This
+# makes dot run faster, but since only newer versions of dot (>1.8.10)
+# support this, this feature is disabled by default.
+
+DOT_MULTI_TARGETS = YES
+
+# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
+# generate a legend page explaining the meaning of the various boxes and
+# arrows in the dot generated graphs.
+
+GENERATE_LEGEND = YES
+
+# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
+# remove the intermediate dot files that are used to generate
+# the various graphs.
+
+DOT_CLEANUP = YES
+
+#---------------------------------------------------------------------------
+# Configuration::additions related to the search engine
+#---------------------------------------------------------------------------
+
+# The SEARCHENGINE tag specifies whether or not a search engine should be
+# used. If set to NO the values of all tags below this one will be ignored.
+
+SEARCHENGINE = NO
diff --git a/gr-utils/src/python/modtool/gr-newmod/docs/doxygen/Doxyfile.swig_doc.in b/gr-utils/src/python/modtool/gr-newmod/docs/doxygen/Doxyfile.swig_doc.in
new file mode 100644
index 000000000..50b8aa81d
--- /dev/null
+++ b/gr-utils/src/python/modtool/gr-newmod/docs/doxygen/Doxyfile.swig_doc.in
@@ -0,0 +1,1514 @@
+# Doxyfile 1.6.1
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project
+#
+# All text after a hash (#) is considered a comment and will be ignored
+# The format is:
+# TAG = value [value, ...]
+# For lists items can also be appended using:
+# TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (" ")
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+# This tag specifies the encoding used for all characters in the config file
+# that follow. The default is UTF-8 which is also the encoding used for all
+# text before the first occurrence of this tag. Doxygen uses libiconv (or the
+# iconv built into libc) for the transcoding. See
+# http://www.gnu.org/software/libiconv for the list of possible encodings.
+
+DOXYFILE_ENCODING = UTF-8
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
+# by quotes) that should identify the project.
+
+PROJECT_NAME = @CPACK_PACKAGE_NAME@
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number.
+# This could be handy for archiving the generated documentation or
+# if some version control system is used.
+
+PROJECT_NUMBER = @CPACK_PACKAGE_VERSION@
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
+# base path where the generated documentation will be put.
+# If a relative path is entered, it will be relative to the location
+# where doxygen was started. If left blank the current directory will be used.
+
+OUTPUT_DIRECTORY = @OUTPUT_DIRECTORY@
+
+# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
+# 4096 sub-directories (in 2 levels) under the output directory of each output
+# format and will distribute the generated files over these directories.
+# Enabling this option can be useful when feeding doxygen a huge amount of
+# source files, where putting all generated files in the same directory would
+# otherwise cause performance problems for the file system.
+
+CREATE_SUBDIRS = NO
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all
+# documentation generated by doxygen is written. Doxygen will use this
+# information to generate all constant output in the proper language.
+# The default language is English, other supported languages are:
+# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional,
+# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German,
+# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English
+# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian,
+# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak,
+# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese.
+
+OUTPUT_LANGUAGE = English
+
+# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
+# include brief member descriptions after the members that are listed in
+# the file and class documentation (similar to JavaDoc).
+# Set to NO to disable this.
+
+BRIEF_MEMBER_DESC = YES
+
+# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
+# the brief description of a member or function before the detailed description.
+# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
+# brief descriptions will be completely suppressed.
+
+REPEAT_BRIEF = YES
+
+# This tag implements a quasi-intelligent brief description abbreviator
+# that is used to form the text in various listings. Each string
+# in this list, if found as the leading text of the brief description, will be
+# stripped from the text and the result after processing the whole list, is
+# used as the annotated text. Otherwise, the brief description is used as-is.
+# If left blank, the following values are used ("$name" is automatically
+# replaced with the name of the entity): "The $name class" "The $name widget"
+# "The $name file" "is" "provides" "specifies" "contains"
+# "represents" "a" "an" "the"
+
+ABBREVIATE_BRIEF =
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
+# Doxygen will generate a detailed section even if there is only a brief
+# description.
+
+ALWAYS_DETAILED_SEC = NO
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
+# inherited members of a class in the documentation of that class as if those
+# members were ordinary class members. Constructors, destructors and assignment
+# operators of the base classes will not be shown.
+
+INLINE_INHERITED_MEMB = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
+# path before files name in the file list and in the header files. If set
+# to NO the shortest path that makes the file name unique will be used.
+
+FULL_PATH_NAMES = YES
+
+# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
+# can be used to strip a user-defined part of the path. Stripping is
+# only done if one of the specified strings matches the left-hand part of
+# the path. The tag can be used to show relative paths in the file list.
+# If left blank the directory from which doxygen is run is used as the
+# path to strip.
+
+STRIP_FROM_PATH =
+
+# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
+# the path mentioned in the documentation of a class, which tells
+# the reader which header file to include in order to use a class.
+# If left blank only the name of the header file containing the class
+# definition is used. Otherwise one should specify the include paths that
+# are normally passed to the compiler using the -I flag.
+
+STRIP_FROM_INC_PATH =
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
+# (but less readable) file names. This can be useful is your file systems
+# doesn't support long names like on DOS, Mac, or CD-ROM.
+
+SHORT_NAMES = NO
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
+# will interpret the first line (until the first dot) of a JavaDoc-style
+# comment as the brief description. If set to NO, the JavaDoc
+# comments will behave just like regular Qt-style comments
+# (thus requiring an explicit @brief command for a brief description.)
+
+JAVADOC_AUTOBRIEF = NO
+
+# If the QT_AUTOBRIEF tag is set to YES then Doxygen will
+# interpret the first line (until the first dot) of a Qt-style
+# comment as the brief description. If set to NO, the comments
+# will behave just like regular Qt-style comments (thus requiring
+# an explicit \brief command for a brief description.)
+
+QT_AUTOBRIEF = NO
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
+# treat a multi-line C++ special comment block (i.e. a block of //! or ///
+# comments) as a brief description. This used to be the default behaviour.
+# The new default is to treat a multi-line C++ comment block as a detailed
+# description. Set this tag to YES if you prefer the old behaviour instead.
+
+MULTILINE_CPP_IS_BRIEF = NO
+
+# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
+# member inherits the documentation from any documented member that it
+# re-implements.
+
+INHERIT_DOCS = YES
+
+# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce
+# a new page for each member. If set to NO, the documentation of a member will
+# be part of the file/class/namespace that contains it.
+
+SEPARATE_MEMBER_PAGES = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab.
+# Doxygen uses this value to replace tabs by spaces in code fragments.
+
+TAB_SIZE = 8
+
+# This tag can be used to specify a number of aliases that acts
+# as commands in the documentation. An alias has the form "name=value".
+# For example adding "sideeffect=\par Side Effects:\n" will allow you to
+# put the command \sideeffect (or @sideeffect) in the documentation, which
+# will result in a user-defined paragraph with heading "Side Effects:".
+# You can put \n's in the value part of an alias to insert newlines.
+
+ALIASES =
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
+# sources only. Doxygen will then generate output that is more tailored for C.
+# For instance, some of the names that are used will be different. The list
+# of all members will be omitted, etc.
+
+OPTIMIZE_OUTPUT_FOR_C = NO
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java
+# sources only. Doxygen will then generate output that is more tailored for
+# Java. For instance, namespaces will be presented as packages, qualified
+# scopes will look different, etc.
+
+OPTIMIZE_OUTPUT_JAVA = NO
+
+# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
+# sources only. Doxygen will then generate output that is more tailored for
+# Fortran.
+
+OPTIMIZE_FOR_FORTRAN = NO
+
+# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
+# sources. Doxygen will then generate output that is tailored for
+# VHDL.
+
+OPTIMIZE_OUTPUT_VHDL = NO
+
+# Doxygen selects the parser to use depending on the extension of the files it parses.
+# With this tag you can assign which parser to use for a given extension.
+# Doxygen has a built-in mapping, but you can override or extend it using this tag.
+# The format is ext=language, where ext is a file extension, and language is one of
+# the parsers supported by doxygen: IDL, Java, Javascript, C#, C, C++, D, PHP,
+# Objective-C, Python, Fortran, VHDL, C, C++. For instance to make doxygen treat
+# .inc files as Fortran files (default is PHP), and .f files as C (default is Fortran),
+# use: inc=Fortran f=C. Note that for custom extensions you also need to set FILE_PATTERNS otherwise the files are not read by doxygen.
+
+EXTENSION_MAPPING =
+
+# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
+# to include (a tag file for) the STL sources as input, then you should
+# set this tag to YES in order to let doxygen match functions declarations and
+# definitions whose arguments contain STL classes (e.g. func(std::string); v.s.
+# func(std::string) {}). This also make the inheritance and collaboration
+# diagrams that involve STL classes more complete and accurate.
+
+BUILTIN_STL_SUPPORT = YES
+
+# If you use Microsoft's C++/CLI language, you should set this option to YES to
+# enable parsing support.
+
+CPP_CLI_SUPPORT = NO
+
+# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only.
+# Doxygen will parse them like normal C++ but will assume all classes use public
+# instead of private inheritance when no explicit protection keyword is present.
+
+SIP_SUPPORT = NO
+
+# For Microsoft's IDL there are propget and propput attributes to indicate getter
+# and setter methods for a property. Setting this option to YES (the default)
+# will make doxygen to replace the get and set methods by a property in the
+# documentation. This will only work if the methods are indeed getting or
+# setting a simple type. If this is not the case, or you want to show the
+# methods anyway, you should set this option to NO.
+
+IDL_PROPERTY_SUPPORT = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
+# tag is set to YES, then doxygen will reuse the documentation of the first
+# member in the group (if any) for the other members of the group. By default
+# all members of a group must be documented explicitly.
+
+DISTRIBUTE_GROUP_DOC = NO
+
+# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
+# the same type (for instance a group of public functions) to be put as a
+# subgroup of that type (e.g. under the Public Functions section). Set it to
+# NO to prevent subgrouping. Alternatively, this can be done per class using
+# the \nosubgrouping command.
+
+SUBGROUPING = YES
+
+# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum
+# is documented as struct, union, or enum with the name of the typedef. So
+# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
+# with name TypeT. When disabled the typedef will appear as a member of a file,
+# namespace, or class. And the struct will be named TypeS. This can typically
+# be useful for C code in case the coding convention dictates that all compound
+# types are typedef'ed and only the typedef is referenced, never the tag name.
+
+TYPEDEF_HIDES_STRUCT = NO
+
+# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to
+# determine which symbols to keep in memory and which to flush to disk.
+# When the cache is full, less often used symbols will be written to disk.
+# For small to medium size projects (<1000 input files) the default value is
+# probably good enough. For larger projects a too small cache size can cause
+# doxygen to be busy swapping symbols to and from disk most of the time
+# causing a significant performance penality.
+# If the system has enough physical memory increasing the cache will improve the
+# performance by keeping more symbols in memory. Note that the value works on
+# a logarithmic scale so increasing the size by one will rougly double the
+# memory usage. The cache size is given by this formula:
+# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0,
+# corresponding to a cache size of 2^16 = 65536 symbols
+
+SYMBOL_CACHE_SIZE = 0
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
+# documentation are documented, even if no documentation was available.
+# Private class members and static file members will be hidden unless
+# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
+
+EXTRACT_ALL = YES
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
+# will be included in the documentation.
+
+EXTRACT_PRIVATE = NO
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file
+# will be included in the documentation.
+
+EXTRACT_STATIC = NO
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
+# defined locally in source files will be included in the documentation.
+# If set to NO only classes defined in header files are included.
+
+EXTRACT_LOCAL_CLASSES = YES
+
+# This flag is only useful for Objective-C code. When set to YES local
+# methods, which are defined in the implementation section but not in
+# the interface are included in the documentation.
+# If set to NO (the default) only methods in the interface are included.
+
+EXTRACT_LOCAL_METHODS = NO
+
+# If this flag is set to YES, the members of anonymous namespaces will be
+# extracted and appear in the documentation as a namespace called
+# 'anonymous_namespace{file}', where file will be replaced with the base
+# name of the file that contains the anonymous namespace. By default
+# anonymous namespace are hidden.
+
+EXTRACT_ANON_NSPACES = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
+# undocumented members of documented classes, files or namespaces.
+# If set to NO (the default) these members will be included in the
+# various overviews, but no documentation section is generated.
+# This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_MEMBERS = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
+# undocumented classes that are normally visible in the class hierarchy.
+# If set to NO (the default) these classes will be included in the various
+# overviews. This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_CLASSES = NO
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
+# friend (class|struct|union) declarations.
+# If set to NO (the default) these declarations will be included in the
+# documentation.
+
+HIDE_FRIEND_COMPOUNDS = NO
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
+# documentation blocks found inside the body of a function.
+# If set to NO (the default) these blocks will be appended to the
+# function's detailed documentation block.
+
+HIDE_IN_BODY_DOCS = NO
+
+# The INTERNAL_DOCS tag determines if documentation
+# that is typed after a \internal command is included. If the tag is set
+# to NO (the default) then the documentation will be excluded.
+# Set it to YES to include the internal documentation.
+
+INTERNAL_DOCS = NO
+
+# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
+# file names in lower-case letters. If set to YES upper-case letters are also
+# allowed. This is useful if you have classes or files whose names only differ
+# in case and if your file system supports case sensitive file names. Windows
+# and Mac users are advised to set this option to NO.
+
+CASE_SENSE_NAMES = YES
+
+# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
+# will show members with their full class and namespace scopes in the
+# documentation. If set to YES the scope will be hidden.
+
+HIDE_SCOPE_NAMES = NO
+
+# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
+# will put a list of the files that are included by a file in the documentation
+# of that file.
+
+SHOW_INCLUDE_FILES = YES
+
+# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
+# is inserted in the documentation for inline members.
+
+INLINE_INFO = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
+# will sort the (detailed) documentation of file and class members
+# alphabetically by member name. If set to NO the members will appear in
+# declaration order.
+
+SORT_MEMBER_DOCS = YES
+
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
+# brief documentation of file, namespace and class members alphabetically
+# by member name. If set to NO (the default) the members will appear in
+# declaration order.
+
+SORT_BRIEF_DOCS = NO
+
+# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the (brief and detailed) documentation of class members so that constructors and destructors are listed first. If set to NO (the default) the constructors will appear in the respective orders defined by SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO.
+
+SORT_MEMBERS_CTORS_1ST = NO
+
+# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the
+# hierarchy of group names into alphabetical order. If set to NO (the default)
+# the group names will appear in their defined order.
+
+SORT_GROUP_NAMES = NO
+
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
+# sorted by fully-qualified names, including namespaces. If set to
+# NO (the default), the class list will be sorted only by class name,
+# not including the namespace part.
+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
+# Note: This option applies only to the class list, not to the
+# alphabetical list.
+
+SORT_BY_SCOPE_NAME = NO
+
+# The GENERATE_TODOLIST tag can be used to enable (YES) or
+# disable (NO) the todo list. This list is created by putting \todo
+# commands in the documentation.
+
+GENERATE_TODOLIST = YES
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or
+# disable (NO) the test list. This list is created by putting \test
+# commands in the documentation.
+
+GENERATE_TESTLIST = YES
+
+# The GENERATE_BUGLIST tag can be used to enable (YES) or
+# disable (NO) the bug list. This list is created by putting \bug
+# commands in the documentation.
+
+GENERATE_BUGLIST = YES
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
+# disable (NO) the deprecated list. This list is created by putting
+# \deprecated commands in the documentation.
+
+GENERATE_DEPRECATEDLIST= YES
+
+# The ENABLED_SECTIONS tag can be used to enable conditional
+# documentation sections, marked by \if sectionname ... \endif.
+
+ENABLED_SECTIONS =
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
+# the initial value of a variable or define consists of for it to appear in
+# the documentation. If the initializer consists of more lines than specified
+# here it will be hidden. Use a value of 0 to hide initializers completely.
+# The appearance of the initializer of individual variables and defines in the
+# documentation can be controlled using \showinitializer or \hideinitializer
+# command in the documentation regardless of this setting.
+
+MAX_INITIALIZER_LINES = 30
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
+# at the bottom of the documentation of classes and structs. If set to YES the
+# list will mention the files that were used to generate the documentation.
+
+SHOW_USED_FILES = YES
+
+# If the sources in your project are distributed over multiple directories
+# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy
+# in the documentation. The default is NO.
+
+SHOW_DIRECTORIES = NO
+
+# Set the SHOW_FILES tag to NO to disable the generation of the Files page.
+# This will remove the Files entry from the Quick Index and from the
+# Folder Tree View (if specified). The default is YES.
+
+SHOW_FILES = YES
+
+# Set the SHOW_NAMESPACES tag to NO to disable the generation of the
+# Namespaces page.
+# This will remove the Namespaces entry from the Quick Index
+# and from the Folder Tree View (if specified). The default is YES.
+
+SHOW_NAMESPACES = YES
+
+# The FILE_VERSION_FILTER tag can be used to specify a program or script that
+# doxygen should invoke to get the current version for each file (typically from
+# the version control system). Doxygen will invoke the program by executing (via
+# popen()) the command <command> <input-file>, where <command> is the value of
+# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file
+# provided by doxygen. Whatever the program writes to standard output
+# is used as the file version. See the manual for examples.
+
+FILE_VERSION_FILTER =
+
+# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed by
+# doxygen. The layout file controls the global structure of the generated output files
+# in an output format independent way. The create the layout file that represents
+# doxygen's defaults, run doxygen with the -l option. You can optionally specify a
+# file name after the option, if omitted DoxygenLayout.xml will be used as the name
+# of the layout file.
+
+LAYOUT_FILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated
+# by doxygen. Possible values are YES and NO. If left blank NO is used.
+
+QUIET = YES
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are
+# generated by doxygen. Possible values are YES and NO. If left blank
+# NO is used.
+
+WARNINGS = YES
+
+# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
+# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
+# automatically be disabled.
+
+WARN_IF_UNDOCUMENTED = YES
+
+# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
+# potential errors in the documentation, such as not documenting some
+# parameters in a documented function, or documenting parameters that
+# don't exist or using markup commands wrongly.
+
+WARN_IF_DOC_ERROR = YES
+
+# This WARN_NO_PARAMDOC option can be abled to get warnings for
+# functions that are documented, but have no documentation for their parameters
+# or return value. If set to NO (the default) doxygen will only warn about
+# wrong or incomplete parameter documentation, but not about the absence of
+# documentation.
+
+WARN_NO_PARAMDOC = NO
+
+# The WARN_FORMAT tag determines the format of the warning messages that
+# doxygen can produce. The string should contain the $file, $line, and $text
+# tags, which will be replaced by the file and line number from which the
+# warning originated and the warning text. Optionally the format may contain
+# $version, which will be replaced by the version of the file (if it could
+# be obtained via FILE_VERSION_FILTER)
+
+WARN_FORMAT = "$file:$line: $text"
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning
+# and error messages should be written. If left blank the output is written
+# to stderr.
+
+WARN_LOGFILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag can be used to specify the files and/or directories that contain
+# documented source files. You may enter file names like "myfile.cpp" or
+# directories like "/usr/src/myproject". Separate the files or directories
+# with spaces.
+
+INPUT = @INPUT_PATHS@
+
+# This tag can be used to specify the character encoding of the source files
+# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
+# also the default input encoding. Doxygen uses libiconv (or the iconv built
+# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for
+# the list of possible encodings.
+
+INPUT_ENCODING = UTF-8
+
+# If the value of the INPUT tag contains directories, you can use the
+# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank the following patterns are tested:
+# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx
+# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90
+
+FILE_PATTERNS = *.h
+
+# The RECURSIVE tag can be used to turn specify whether or not subdirectories
+# should be searched for input files as well. Possible values are YES and NO.
+# If left blank NO is used.
+
+RECURSIVE = YES
+
+# The EXCLUDE tag can be used to specify files and/or directories that should
+# excluded from the INPUT source files. This way you can easily exclude a
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+
+EXCLUDE =
+
+# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
+# directories that are symbolic links (a Unix filesystem feature) are excluded
+# from the input.
+
+EXCLUDE_SYMLINKS = NO
+
+# If the value of the INPUT tag contains directories, you can use the
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
+# certain files from those directories. Note that the wildcards are matched
+# against the file with absolute path, so to exclude all test directories
+# for example use the pattern */test/*
+
+EXCLUDE_PATTERNS =
+
+# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
+# (namespaces, classes, functions, etc.) that should be excluded from the
+# output. The symbol name can be a fully qualified name, a word, or if the
+# wildcard * is used, a substring. Examples: ANamespace, AClass,
+# AClass::ANamespace, ANamespace::*Test
+
+EXCLUDE_SYMBOLS =
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or
+# directories that contain example code fragments that are included (see
+# the \include command).
+
+EXAMPLE_PATH =
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank all files are included.
+
+EXAMPLE_PATTERNS =
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
+# searched for input files to be used with the \include or \dontinclude
+# commands irrespective of the value of the RECURSIVE tag.
+# Possible values are YES and NO. If left blank NO is used.
+
+EXAMPLE_RECURSIVE = NO
+
+# The IMAGE_PATH tag can be used to specify one or more files or
+# directories that contain image that are included in the documentation (see
+# the \image command).
+
+IMAGE_PATH =
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should
+# invoke to filter for each input file. Doxygen will invoke the filter program
+# by executing (via popen()) the command <filter> <input-file>, where <filter>
+# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
+# input file. Doxygen will then use the output that the filter program writes
+# to standard output.
+# If FILTER_PATTERNS is specified, this tag will be
+# ignored.
+
+INPUT_FILTER =
+
+# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
+# basis.
+# Doxygen will compare the file name with each pattern and apply the
+# filter if there is a match.
+# The filters are a list of the form:
+# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
+# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER
+# is applied to all files.
+
+FILTER_PATTERNS =
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
+# INPUT_FILTER) will be used to filter the input files when producing source
+# files to browse (i.e. when SOURCE_BROWSER is set to YES).
+
+FILTER_SOURCE_FILES = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will
+# be generated. Documented entities will be cross-referenced with these sources.
+# Note: To get rid of all source code in the generated output, make sure also
+# VERBATIM_HEADERS is set to NO.
+
+SOURCE_BROWSER = NO
+
+# Setting the INLINE_SOURCES tag to YES will include the body
+# of functions and classes directly in the documentation.
+
+INLINE_SOURCES = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
+# doxygen to hide any special comment blocks from generated source code
+# fragments. Normal C and C++ comments will always remain visible.
+
+STRIP_CODE_COMMENTS = YES
+
+# If the REFERENCED_BY_RELATION tag is set to YES
+# then for each documented function all documented
+# functions referencing it will be listed.
+
+REFERENCED_BY_RELATION = NO
+
+# If the REFERENCES_RELATION tag is set to YES
+# then for each documented function all documented entities
+# called/used by that function will be listed.
+
+REFERENCES_RELATION = NO
+
+# If the REFERENCES_LINK_SOURCE tag is set to YES (the default)
+# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
+# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
+# link to the source code.
+# Otherwise they will link to the documentation.
+
+REFERENCES_LINK_SOURCE = YES
+
+# If the USE_HTAGS tag is set to YES then the references to source code
+# will point to the HTML generated by the htags(1) tool instead of doxygen
+# built-in source browser. The htags tool is part of GNU's global source
+# tagging system (see http://www.gnu.org/software/global/global.html). You
+# will need version 4.8.6 or higher.
+
+USE_HTAGS = NO
+
+# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
+# will generate a verbatim copy of the header file for each class for
+# which an include is specified. Set to NO to disable this.
+
+VERBATIM_HEADERS = YES
+
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
+# of all compounds will be generated. Enable this if the project
+# contains a lot of classes, structs, unions or interfaces.
+
+ALPHABETICAL_INDEX = NO
+
+# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
+# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
+# in which this list will be split (can be a number in the range [1..20])
+
+COLS_IN_ALPHA_INDEX = 5
+
+# In case all classes in a project start with a common prefix, all
+# classes will be put under the same header in the alphabetical index.
+# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
+# should be ignored while generating the index headers.
+
+IGNORE_PREFIX =
+
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
+# generate HTML output.
+
+GENERATE_HTML = NO
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `html' will be used as the default path.
+
+HTML_OUTPUT = html
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
+# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
+# doxygen will generate files with .html extension.
+
+HTML_FILE_EXTENSION = .html
+
+# The HTML_HEADER tag can be used to specify a personal HTML header for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard header.
+
+HTML_HEADER =
+
+# The HTML_FOOTER tag can be used to specify a personal HTML footer for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard footer.
+
+HTML_FOOTER =
+
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
+# style sheet that is used by each HTML page. It can be used to
+# fine-tune the look of the HTML output. If the tag is left blank doxygen
+# will generate a default style sheet. Note that doxygen will try to copy
+# the style sheet file to the HTML output directory, so don't put your own
+# stylesheet in the HTML output directory as well, or it will be erased!
+
+HTML_STYLESHEET =
+
+# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
+# files or namespaces will be aligned in HTML using tables. If set to
+# NO a bullet list will be used.
+
+HTML_ALIGN_MEMBERS = YES
+
+# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
+# documentation will contain sections that can be hidden and shown after the
+# page has loaded. For this to work a browser that supports
+# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox
+# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
+
+HTML_DYNAMIC_SECTIONS = NO
+
+# If the GENERATE_DOCSET tag is set to YES, additional index files
+# will be generated that can be used as input for Apple's Xcode 3
+# integrated development environment, introduced with OSX 10.5 (Leopard).
+# To create a documentation set, doxygen will generate a Makefile in the
+# HTML output directory. Running make will produce the docset in that
+# directory and running "make install" will install the docset in
+# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find
+# it at startup.
+# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html for more information.
+
+GENERATE_DOCSET = NO
+
+# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the
+# feed. A documentation feed provides an umbrella under which multiple
+# documentation sets from a single provider (such as a company or product suite)
+# can be grouped.
+
+DOCSET_FEEDNAME = "Doxygen generated docs"
+
+# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that
+# should uniquely identify the documentation set bundle. This should be a
+# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen
+# will append .docset to the name.
+
+DOCSET_BUNDLE_ID = org.doxygen.Project
+
+# If the GENERATE_HTMLHELP tag is set to YES, additional index files
+# will be generated that can be used as input for tools like the
+# Microsoft HTML help workshop to generate a compiled HTML help file (.chm)
+# of the generated HTML documentation.
+
+GENERATE_HTMLHELP = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
+# be used to specify the file name of the resulting .chm file. You
+# can add a path in front of the file if the result should not be
+# written to the html output directory.
+
+CHM_FILE =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
+# be used to specify the location (absolute path including file name) of
+# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
+# the HTML help compiler on the generated index.hhp.
+
+HHC_LOCATION =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
+# controls if a separate .chi index file is generated (YES) or that
+# it should be included in the master .chm file (NO).
+
+GENERATE_CHI = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING
+# is used to encode HtmlHelp index (hhk), content (hhc) and project file
+# content.
+
+CHM_INDEX_ENCODING =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
+# controls whether a binary table of contents is generated (YES) or a
+# normal table of contents (NO) in the .chm file.
+
+BINARY_TOC = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members
+# to the contents of the HTML help documentation and to the tree view.
+
+TOC_EXPAND = NO
+
+# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and QHP_VIRTUAL_FOLDER
+# are set, an additional index file will be generated that can be used as input for
+# Qt's qhelpgenerator to generate a Qt Compressed Help (.qch) of the generated
+# HTML documentation.
+
+GENERATE_QHP = NO
+
+# If the QHG_LOCATION tag is specified, the QCH_FILE tag can
+# be used to specify the file name of the resulting .qch file.
+# The path specified is relative to the HTML output folder.
+
+QCH_FILE =
+
+# The QHP_NAMESPACE tag specifies the namespace to use when generating
+# Qt Help Project output. For more information please see
+# http://doc.trolltech.com/qthelpproject.html#namespace
+
+QHP_NAMESPACE =
+
+# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating
+# Qt Help Project output. For more information please see
+# http://doc.trolltech.com/qthelpproject.html#virtual-folders
+
+QHP_VIRTUAL_FOLDER = doc
+
+# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to add.
+# For more information please see
+# http://doc.trolltech.com/qthelpproject.html#custom-filters
+
+QHP_CUST_FILTER_NAME =
+
+# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the custom filter to add.For more information please see
+# <a href="http://doc.trolltech.com/qthelpproject.html#custom-filters">Qt Help Project / Custom Filters</a>.
+
+QHP_CUST_FILTER_ATTRS =
+
+# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this project's
+# filter section matches.
+# <a href="http://doc.trolltech.com/qthelpproject.html#filter-attributes">Qt Help Project / Filter Attributes</a>.
+
+QHP_SECT_FILTER_ATTRS =
+
+# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can
+# be used to specify the location of Qt's qhelpgenerator.
+# If non-empty doxygen will try to run qhelpgenerator on the generated
+# .qhp file.
+
+QHG_LOCATION =
+
+# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
+# top of each HTML page. The value NO (the default) enables the index and
+# the value YES disables it.
+
+DISABLE_INDEX = NO
+
+# This tag can be used to set the number of enum values (range [1..20])
+# that doxygen will group on one line in the generated HTML documentation.
+
+ENUM_VALUES_PER_LINE = 4
+
+# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
+# structure should be generated to display hierarchical information.
+# If the tag value is set to YES, a side panel will be generated
+# containing a tree-like index structure (just like the one that
+# is generated for HTML Help). For this to work a browser that supports
+# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser).
+# Windows users are probably better off using the HTML help feature.
+
+GENERATE_TREEVIEW = NO
+
+# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories,
+# and Class Hierarchy pages using a tree view instead of an ordered list.
+
+USE_INLINE_TREES = NO
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
+# used to set the initial width (in pixels) of the frame in which the tree
+# is shown.
+
+TREEVIEW_WIDTH = 250
+
+# Use this tag to change the font size of Latex formulas included
+# as images in the HTML documentation. The default is 10. Note that
+# when you change the font size after a successful doxygen run you need
+# to manually remove any form_*.png images from the HTML output directory
+# to force them to be regenerated.
+
+FORMULA_FONTSIZE = 10
+
+# When the SEARCHENGINE tag is enable doxygen will generate a search box for the HTML output. The underlying search engine uses javascript
+# and DHTML and should work on any modern browser. Note that when using HTML help (GENERATE_HTMLHELP) or Qt help (GENERATE_QHP)
+# there is already a search function so this one should typically
+# be disabled.
+
+SEARCHENGINE = YES
+
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
+# generate Latex output.
+
+GENERATE_LATEX = NO
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `latex' will be used as the default path.
+
+LATEX_OUTPUT = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
+# invoked. If left blank `latex' will be used as the default command name.
+
+LATEX_CMD_NAME = latex
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
+# generate index for LaTeX. If left blank `makeindex' will be used as the
+# default command name.
+
+MAKEINDEX_CMD_NAME = makeindex
+
+# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
+# LaTeX documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_LATEX = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used
+# by the printer. Possible values are: a4, a4wide, letter, legal and
+# executive. If left blank a4wide will be used.
+
+PAPER_TYPE = a4wide
+
+# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
+# packages that should be included in the LaTeX output.
+
+EXTRA_PACKAGES =
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
+# the generated latex document. The header should contain everything until
+# the first chapter. If it is left blank doxygen will generate a
+# standard header. Notice: only use this tag if you know what you are doing!
+
+LATEX_HEADER =
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
+# is prepared for conversion to pdf (using ps2pdf). The pdf file will
+# contain links (just like the HTML output) instead of page references
+# This makes the output suitable for online browsing using a pdf viewer.
+
+PDF_HYPERLINKS = YES
+
+# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
+# plain latex in the generated Makefile. Set this option to YES to get a
+# higher quality PDF documentation.
+
+USE_PDFLATEX = YES
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
+# command to the generated LaTeX files. This will instruct LaTeX to keep
+# running if errors occur, instead of asking the user for help.
+# This option is also used when generating formulas in HTML.
+
+LATEX_BATCHMODE = NO
+
+# If LATEX_HIDE_INDICES is set to YES then doxygen will not
+# include the index chapters (such as File Index, Compound Index, etc.)
+# in the output.
+
+LATEX_HIDE_INDICES = NO
+
+# If LATEX_SOURCE_CODE is set to YES then doxygen will include source code with syntax highlighting in the LaTeX output. Note that which sources are shown also depends on other settings such as SOURCE_BROWSER.
+
+LATEX_SOURCE_CODE = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
+# The RTF output is optimized for Word 97 and may not look very pretty with
+# other RTF readers or editors.
+
+GENERATE_RTF = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `rtf' will be used as the default path.
+
+RTF_OUTPUT = rtf
+
+# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
+# RTF documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_RTF = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
+# will contain hyperlink fields. The RTF file will
+# contain links (just like the HTML output) instead of page references.
+# This makes the output suitable for online browsing using WORD or other
+# programs which support those fields.
+# Note: wordpad (write) and others do not support links.
+
+RTF_HYPERLINKS = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's
+# config file, i.e. a series of assignments. You only have to provide
+# replacements, missing definitions are set to their default value.
+
+RTF_STYLESHEET_FILE =
+
+# Set optional variables used in the generation of an rtf document.
+# Syntax is similar to doxygen's config file.
+
+RTF_EXTENSIONS_FILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
+# generate man pages
+
+GENERATE_MAN = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `man' will be used as the default path.
+
+MAN_OUTPUT = man
+
+# The MAN_EXTENSION tag determines the extension that is added to
+# the generated man pages (default is the subroutine's section .3)
+
+MAN_EXTENSION = .3
+
+# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
+# then it will generate one additional man file for each entity
+# documented in the real man page(s). These additional files
+# only source the real man page, but without them the man command
+# would be unable to find the correct page. The default is NO.
+
+MAN_LINKS = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES Doxygen will
+# generate an XML file that captures the structure of
+# the code including all documentation.
+
+GENERATE_XML = YES
+
+# The XML_OUTPUT tag is used to specify where the XML pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `xml' will be used as the default path.
+
+XML_OUTPUT = xml
+
+# The XML_SCHEMA tag can be used to specify an XML schema,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_SCHEMA =
+
+# The XML_DTD tag can be used to specify an XML DTD,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_DTD =
+
+# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
+# dump the program listings (including syntax highlighting
+# and cross-referencing information) to the XML output. Note that
+# enabling this will significantly increase the size of the XML output.
+
+XML_PROGRAMLISTING = YES
+
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
+# generate an AutoGen Definitions (see autogen.sf.net) file
+# that captures the structure of the code including all
+# documentation. Note that this feature is still experimental
+# and incomplete at the moment.
+
+GENERATE_AUTOGEN_DEF = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_PERLMOD tag is set to YES Doxygen will
+# generate a Perl module file that captures the structure of
+# the code including all documentation. Note that this
+# feature is still experimental and incomplete at the
+# moment.
+
+GENERATE_PERLMOD = NO
+
+# If the PERLMOD_LATEX tag is set to YES Doxygen will generate
+# the necessary Makefile rules, Perl scripts and LaTeX code to be able
+# to generate PDF and DVI output from the Perl module output.
+
+PERLMOD_LATEX = NO
+
+# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
+# nicely formatted so it can be parsed by a human reader.
+# This is useful
+# if you want to understand what is going on.
+# On the other hand, if this
+# tag is set to NO the size of the Perl module output will be much smaller
+# and Perl will parse it just the same.
+
+PERLMOD_PRETTY = YES
+
+# The names of the make variables in the generated doxyrules.make file
+# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
+# This is useful so different doxyrules.make files included by the same
+# Makefile don't overwrite each other's variables.
+
+PERLMOD_MAKEVAR_PREFIX =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
+# evaluate all C-preprocessor directives found in the sources and include
+# files.
+
+ENABLE_PREPROCESSING = YES
+
+# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
+# names in the source code. If set to NO (the default) only conditional
+# compilation will be performed. Macro expansion can be done in a controlled
+# way by setting EXPAND_ONLY_PREDEF to YES.
+
+MACRO_EXPANSION = YES
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
+# then the macro expansion is limited to the macros specified with the
+# PREDEFINED and EXPAND_AS_DEFINED tags.
+
+EXPAND_ONLY_PREDEF = NO
+
+# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
+# in the INCLUDE_PATH (see below) will be search if a #include is found.
+
+SEARCH_INCLUDES = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that
+# contain include files that are not input files but should be processed by
+# the preprocessor.
+
+INCLUDE_PATH =
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
+# patterns (like *.h and *.hpp) to filter out the header-files in the
+# directories. If left blank, the patterns specified with FILE_PATTERNS will
+# be used.
+
+INCLUDE_FILE_PATTERNS =
+
+# The PREDEFINED tag can be used to specify one or more macro names that
+# are defined before the preprocessor is started (similar to the -D option of
+# gcc). The argument of the tag is a list of macros of the form: name
+# or name=definition (no spaces). If the definition and the = are
+# omitted =1 is assumed. To prevent a macro definition from being
+# undefined via #undef or recursively expanded use the := operator
+# instead of the = operator.
+
+PREDEFINED =
+
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
+# this tag can be used to specify a list of macro names that should be expanded.
+# The macro definition that is found in the sources will be used.
+# Use the PREDEFINED tag if you want to use a different macro definition.
+
+EXPAND_AS_DEFINED =
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
+# doxygen's preprocessor will remove all function-like macros that are alone
+# on a line, have an all uppercase name, and do not end with a semicolon. Such
+# function macros are typically used for boiler-plate code, and will confuse
+# the parser if not removed.
+
+SKIP_FUNCTION_MACROS = YES
+
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references
+#---------------------------------------------------------------------------
+
+# The TAGFILES option can be used to specify one or more tagfiles.
+# Optionally an initial location of the external documentation
+# can be added for each tagfile. The format of a tag file without
+# this location is as follows:
+#
+# TAGFILES = file1 file2 ...
+# Adding location for the tag files is done as follows:
+#
+# TAGFILES = file1=loc1 "file2 = loc2" ...
+# where "loc1" and "loc2" can be relative or absolute paths or
+# URLs. If a location is present for each tag, the installdox tool
+# does not have to be run to correct the links.
+# Note that each tag file must have a unique name
+# (where the name does NOT include the path)
+# If a tag file is not located in the directory in which doxygen
+# is run, you must also specify the path to the tagfile here.
+
+TAGFILES =
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create
+# a tag file that is based on the input files it reads.
+
+GENERATE_TAGFILE =
+
+# If the ALLEXTERNALS tag is set to YES all external classes will be listed
+# in the class index. If set to NO only the inherited external classes
+# will be listed.
+
+ALLEXTERNALS = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
+# in the modules index. If set to NO, only the current project's groups will
+# be listed.
+
+EXTERNAL_GROUPS = YES
+
+# The PERL_PATH should be the absolute path and name of the perl script
+# interpreter (i.e. the result of `which perl').
+
+PERL_PATH = /usr/bin/perl
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
+# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base
+# or super classes. Setting the tag to NO turns the diagrams off. Note that
+# this option is superseded by the HAVE_DOT option below. This is only a
+# fallback. It is recommended to install and use dot, since it yields more
+# powerful graphs.
+
+CLASS_DIAGRAMS = YES
+
+# You can define message sequence charts within doxygen comments using the \msc
+# command. Doxygen will then run the mscgen tool (see
+# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the
+# documentation. The MSCGEN_PATH tag allows you to specify the directory where
+# the mscgen tool resides. If left empty the tool is assumed to be found in the
+# default search path.
+
+MSCGEN_PATH =
+
+# If set to YES, the inheritance and collaboration graphs will hide
+# inheritance and usage relations if the target is undocumented
+# or is not a class.
+
+HIDE_UNDOC_RELATIONS = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
+# available from the path. This tool is part of Graphviz, a graph visualization
+# toolkit from AT&T and Lucent Bell Labs. The other options in this section
+# have no effect if this option is set to NO (the default)
+
+HAVE_DOT = NO
+
+# By default doxygen will write a font called FreeSans.ttf to the output
+# directory and reference it in all dot files that doxygen generates. This
+# font does not include all possible unicode characters however, so when you need
+# these (or just want a differently looking font) you can specify the font name
+# using DOT_FONTNAME. You need need to make sure dot is able to find the font,
+# which can be done by putting it in a standard location or by setting the
+# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory
+# containing the font.
+
+DOT_FONTNAME = FreeSans
+
+# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs.
+# The default size is 10pt.
+
+DOT_FONTSIZE = 10
+
+# By default doxygen will tell dot to use the output directory to look for the
+# FreeSans.ttf font (which doxygen will put there itself). If you specify a
+# different font using DOT_FONTNAME you can set the path where dot
+# can find it using this tag.
+
+DOT_FONTPATH =
+
+# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect inheritance relations. Setting this tag to YES will force the
+# the CLASS_DIAGRAMS tag to NO.
+
+CLASS_GRAPH = YES
+
+# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect implementation dependencies (inheritance, containment, and
+# class references variables) of the class with other documented classes.
+
+COLLABORATION_GRAPH = YES
+
+# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for groups, showing the direct groups dependencies
+
+GROUP_GRAPHS = YES
+
+# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
+# collaboration diagrams in a style similar to the OMG's Unified Modeling
+# Language.
+
+UML_LOOK = NO
+
+# If set to YES, the inheritance and collaboration graphs will show the
+# relations between templates and their instances.
+
+TEMPLATE_RELATIONS = NO
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
+# tags are set to YES then doxygen will generate a graph for each documented
+# file showing the direct and indirect include dependencies of the file with
+# other documented files.
+
+INCLUDE_GRAPH = YES
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
+# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
+# documented header file showing the documented files that directly or
+# indirectly include this file.
+
+INCLUDED_BY_GRAPH = YES
+
+# If the CALL_GRAPH and HAVE_DOT options are set to YES then
+# doxygen will generate a call dependency graph for every global function
+# or class method. Note that enabling this option will significantly increase
+# the time of a run. So in most cases it will be better to enable call graphs
+# for selected functions only using the \callgraph command.
+
+CALL_GRAPH = NO
+
+# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then
+# doxygen will generate a caller dependency graph for every global function
+# or class method. Note that enabling this option will significantly increase
+# the time of a run. So in most cases it will be better to enable caller
+# graphs for selected functions only using the \callergraph command.
+
+CALLER_GRAPH = NO
+
+# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
+# will graphical hierarchy of all classes instead of a textual one.
+
+GRAPHICAL_HIERARCHY = YES
+
+# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES
+# then doxygen will show the dependencies a directory has on other directories
+# in a graphical way. The dependency relations are determined by the #include
+# relations between the files in the directories.
+
+DIRECTORY_GRAPH = YES
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
+# generated by dot. Possible values are png, jpg, or gif
+# If left blank png will be used.
+
+DOT_IMAGE_FORMAT = png
+
+# The tag DOT_PATH can be used to specify the path where the dot tool can be
+# found. If left blank, it is assumed the dot tool can be found in the path.
+
+DOT_PATH =
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that
+# contain dot files that are included in the documentation (see the
+# \dotfile command).
+
+DOTFILE_DIRS =
+
+# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of
+# nodes that will be shown in the graph. If the number of nodes in a graph
+# becomes larger than this value, doxygen will truncate the graph, which is
+# visualized by representing a node as a red box. Note that doxygen if the
+# number of direct children of the root node in a graph is already larger than
+# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note
+# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
+
+DOT_GRAPH_MAX_NODES = 50
+
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
+# graphs generated by dot. A depth value of 3 means that only nodes reachable
+# from the root by following a path via at most 3 edges will be shown. Nodes
+# that lay further from the root node will be omitted. Note that setting this
+# option to 1 or 2 may greatly reduce the computation time needed for large
+# code bases. Also note that the size of a graph can be further restricted by
+# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
+
+MAX_DOT_GRAPH_DEPTH = 0
+
+# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
+# background. This is disabled by default, because dot on Windows does not
+# seem to support this out of the box. Warning: Depending on the platform used,
+# enabling this option may lead to badly anti-aliased labels on the edges of
+# a graph (i.e. they become hard to read).
+
+DOT_TRANSPARENT = NO
+
+# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
+# files in one run (i.e. multiple -o and -T options on the command line). This
+# makes dot run faster, but since only newer versions of dot (>1.8.10)
+# support this, this feature is disabled by default.
+
+DOT_MULTI_TARGETS = YES
+
+# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
+# generate a legend page explaining the meaning of the various boxes and
+# arrows in the dot generated graphs.
+
+GENERATE_LEGEND = YES
+
+# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
+# remove the intermediate dot files that are used to generate
+# the various graphs.
+
+DOT_CLEANUP = YES
diff --git a/gr-utils/src/python/modtool/gr-newmod/docs/doxygen/doxyxml/__init__.py b/gr-utils/src/python/modtool/gr-newmod/docs/doxygen/doxyxml/__init__.py
new file mode 100644
index 000000000..5cd0b3c6c
--- /dev/null
+++ b/gr-utils/src/python/modtool/gr-newmod/docs/doxygen/doxyxml/__init__.py
@@ -0,0 +1,82 @@
+#
+# Copyright 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.
+#
+"""
+Python interface to contents of doxygen xml documentation.
+
+Example use:
+See the contents of the example folder for the C++ and
+doxygen-generated xml used in this example.
+
+>>> # Parse the doxygen docs.
+>>> import os
+>>> this_dir = os.path.dirname(globals()['__file__'])
+>>> xml_path = this_dir + "/example/xml/"
+>>> di = DoxyIndex(xml_path)
+
+Get a list of all top-level objects.
+
+>>> print([mem.name() for mem in di.members()])
+[u'Aadvark', u'aadvarky_enough', u'main']
+
+Get all functions.
+
+>>> print([mem.name() for mem in di.in_category(DoxyFunction)])
+[u'aadvarky_enough', u'main']
+
+Check if an object is present.
+
+>>> di.has_member(u'Aadvark')
+True
+>>> di.has_member(u'Fish')
+False
+
+Get an item by name and check its properties.
+
+>>> aad = di.get_member(u'Aadvark')
+>>> print(aad.brief_description)
+Models the mammal Aadvark.
+>>> print(aad.detailed_description)
+Sadly the model is incomplete and cannot capture all aspects of an aadvark yet.
+<BLANKLINE>
+This line is uninformative and is only to test line breaks in the comments.
+>>> [mem.name() for mem in aad.members()]
+[u'aadvarkness', u'print', u'Aadvark', u'get_aadvarkness']
+>>> aad.get_member(u'print').brief_description
+u'Outputs the vital aadvark statistics.'
+
+"""
+
+from doxyindex import DoxyIndex, DoxyFunction, DoxyParam, DoxyClass, DoxyFile, DoxyNamespace, DoxyGroup, DoxyFriend, DoxyOther
+
+def _test():
+ import os
+ this_dir = os.path.dirname(globals()['__file__'])
+ xml_path = this_dir + "/example/xml/"
+ di = DoxyIndex(xml_path)
+ # Get the Aadvark class
+ aad = di.get_member('Aadvark')
+ aad.brief_description
+ import doctest
+ return doctest.testmod()
+
+if __name__ == "__main__":
+ _test()
+
diff --git a/gr-utils/src/python/modtool/gr-newmod/docs/doxygen/doxyxml/base.py b/gr-utils/src/python/modtool/gr-newmod/docs/doxygen/doxyxml/base.py
new file mode 100644
index 000000000..e8f026ab9
--- /dev/null
+++ b/gr-utils/src/python/modtool/gr-newmod/docs/doxygen/doxyxml/base.py
@@ -0,0 +1,219 @@
+#
+# Copyright 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.
+#
+"""
+A base class is created.
+
+Classes based upon this are used to make more user-friendly interfaces
+to the doxygen xml docs than the generated classes provide.
+"""
+
+import os
+import pdb
+
+from xml.parsers.expat import ExpatError
+
+from generated import compound
+
+
+class Base(object):
+
+ class Duplicate(StandardError):
+ pass
+
+ class NoSuchMember(StandardError):
+ pass
+
+ class ParsingError(StandardError):
+ pass
+
+ def __init__(self, parse_data, top=None):
+ self._parsed = False
+ self._error = False
+ self._parse_data = parse_data
+ self._members = []
+ self._dict_members = {}
+ self._in_category = {}
+ self._data = {}
+ if top is not None:
+ self._xml_path = top._xml_path
+ # Set up holder of references
+ else:
+ top = self
+ self._refs = {}
+ self._xml_path = parse_data
+ self.top = top
+
+ @classmethod
+ def from_refid(cls, refid, top=None):
+ """ Instantiate class from a refid rather than parsing object. """
+ # First check to see if its already been instantiated.
+ if top is not None and refid in top._refs:
+ return top._refs[refid]
+ # Otherwise create a new instance and set refid.
+ inst = cls(None, top=top)
+ inst.refid = refid
+ inst.add_ref(inst)
+ return inst
+
+ @classmethod
+ def from_parse_data(cls, parse_data, top=None):
+ refid = getattr(parse_data, 'refid', None)
+ if refid is not None and top is not None and refid in top._refs:
+ return top._refs[refid]
+ inst = cls(parse_data, top=top)
+ if refid is not None:
+ inst.refid = refid
+ inst.add_ref(inst)
+ return inst
+
+ def add_ref(self, obj):
+ if hasattr(obj, 'refid'):
+ self.top._refs[obj.refid] = obj
+
+ mem_classes = []
+
+ def get_cls(self, mem):
+ for cls in self.mem_classes:
+ if cls.can_parse(mem):
+ return cls
+ raise StandardError(("Did not find a class for object '%s'." \
+ % (mem.get_name())))
+
+ def convert_mem(self, mem):
+ try:
+ cls = self.get_cls(mem)
+ converted = cls.from_parse_data(mem, self.top)
+ if converted is None:
+ raise StandardError('No class matched this object.')
+ self.add_ref(converted)
+ return converted
+ except StandardError, e:
+ print e
+
+ @classmethod
+ def includes(cls, inst):
+ return isinstance(inst, cls)
+
+ @classmethod
+ def can_parse(cls, obj):
+ return False
+
+ def _parse(self):
+ self._parsed = True
+
+ def _get_dict_members(self, cat=None):
+ """
+ For given category a dictionary is returned mapping member names to
+ members of that category. For names that are duplicated the name is
+ mapped to None.
+ """
+ self.confirm_no_error()
+ if cat not in self._dict_members:
+ new_dict = {}
+ for mem in self.in_category(cat):
+ if mem.name() not in new_dict:
+ new_dict[mem.name()] = mem
+ else:
+ new_dict[mem.name()] = self.Duplicate
+ self._dict_members[cat] = new_dict
+ return self._dict_members[cat]
+
+ def in_category(self, cat):
+ self.confirm_no_error()
+ if cat is None:
+ return self._members
+ if cat not in self._in_category:
+ self._in_category[cat] = [mem for mem in self._members
+ if cat.includes(mem)]
+ return self._in_category[cat]
+
+ def get_member(self, name, cat=None):
+ self.confirm_no_error()
+ # Check if it's in a namespace or class.
+ bits = name.split('::')
+ first = bits[0]
+ rest = '::'.join(bits[1:])
+ member = self._get_dict_members(cat).get(first, self.NoSuchMember)
+ # Raise any errors that are returned.
+ if member in set([self.NoSuchMember, self.Duplicate]):
+ raise member()
+ if rest:
+ return member.get_member(rest, cat=cat)
+ return member
+
+ def has_member(self, name, cat=None):
+ try:
+ mem = self.get_member(name, cat=cat)
+ return True
+ except self.NoSuchMember:
+ return False
+
+ def data(self):
+ self.confirm_no_error()
+ return self._data
+
+ def members(self):
+ self.confirm_no_error()
+ return self._members
+
+ def process_memberdefs(self):
+ mdtss = []
+ for sec in self._retrieved_data.compounddef.sectiondef:
+ mdtss += sec.memberdef
+ # At the moment we lose all information associated with sections.
+ # Sometimes a memberdef is in several sectiondef.
+ # We make sure we don't get duplicates here.
+ uniques = set([])
+ for mem in mdtss:
+ converted = self.convert_mem(mem)
+ pair = (mem.name, mem.__class__)
+ if pair not in uniques:
+ uniques.add(pair)
+ self._members.append(converted)
+
+ def retrieve_data(self):
+ filename = os.path.join(self._xml_path, self.refid + '.xml')
+ try:
+ self._retrieved_data = compound.parse(filename)
+ except ExpatError:
+ print('Error in xml in file %s' % filename)
+ self._error = True
+ self._retrieved_data = None
+
+ def check_parsed(self):
+ if not self._parsed:
+ self._parse()
+
+ def confirm_no_error(self):
+ self.check_parsed()
+ if self._error:
+ raise self.ParsingError()
+
+ def error(self):
+ self.check_parsed()
+ return self._error
+
+ def name(self):
+ # first see if we can do it without processing.
+ if self._parse_data is not None:
+ return self._parse_data.name
+ self.check_parsed()
+ return self._retrieved_data.compounddef.name
diff --git a/gr-utils/src/python/modtool/gr-newmod/docs/doxygen/doxyxml/doxyindex.py b/gr-utils/src/python/modtool/gr-newmod/docs/doxygen/doxyxml/doxyindex.py
new file mode 100644
index 000000000..0132ab86f
--- /dev/null
+++ b/gr-utils/src/python/modtool/gr-newmod/docs/doxygen/doxyxml/doxyindex.py
@@ -0,0 +1,237 @@
+#
+# Copyright 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.
+#
+"""
+Classes providing more user-friendly interfaces to the doxygen xml
+docs than the generated classes provide.
+"""
+
+import os
+
+from generated import index
+from base import Base
+from text import description
+
+class DoxyIndex(Base):
+ """
+ Parses a doxygen xml directory.
+ """
+
+ __module__ = "gnuradio.utils.doxyxml"
+
+ def _parse(self):
+ if self._parsed:
+ return
+ super(DoxyIndex, self)._parse()
+ self._root = index.parse(os.path.join(self._xml_path, 'index.xml'))
+ for mem in self._root.compound:
+ converted = self.convert_mem(mem)
+ # For files we want the contents to be accessible directly
+ # from the parent rather than having to go through the file
+ # object.
+ if self.get_cls(mem) == DoxyFile:
+ if mem.name.endswith('.h'):
+ self._members += converted.members()
+ self._members.append(converted)
+ else:
+ self._members.append(converted)
+
+
+def generate_swig_doc_i(self):
+ """
+ %feature("docstring") gr_make_align_on_samplenumbers_ss::align_state "
+ Wraps the C++: gr_align_on_samplenumbers_ss::align_state";
+ """
+ pass
+
+
+class DoxyCompMem(Base):
+
+
+ kind = None
+
+ def __init__(self, *args, **kwargs):
+ super(DoxyCompMem, self).__init__(*args, **kwargs)
+
+ @classmethod
+ def can_parse(cls, obj):
+ return obj.kind == cls.kind
+
+ def set_descriptions(self, parse_data):
+ bd = description(getattr(parse_data, 'briefdescription', None))
+ dd = description(getattr(parse_data, 'detaileddescription', None))
+ self._data['brief_description'] = bd
+ self._data['detailed_description'] = dd
+
+class DoxyCompound(DoxyCompMem):
+ pass
+
+class DoxyMember(DoxyCompMem):
+ pass
+
+
+class DoxyFunction(DoxyMember):
+
+ __module__ = "gnuradio.utils.doxyxml"
+
+ kind = 'function'
+
+ def _parse(self):
+ if self._parsed:
+ return
+ super(DoxyFunction, self)._parse()
+ self.set_descriptions(self._parse_data)
+ self._data['params'] = []
+ prms = self._parse_data.param
+ for prm in prms:
+ self._data['params'].append(DoxyParam(prm))
+
+ brief_description = property(lambda self: self.data()['brief_description'])
+ detailed_description = property(lambda self: self.data()['detailed_description'])
+ params = property(lambda self: self.data()['params'])
+
+Base.mem_classes.append(DoxyFunction)
+
+
+class DoxyParam(DoxyMember):
+
+ __module__ = "gnuradio.utils.doxyxml"
+
+ def _parse(self):
+ if self._parsed:
+ return
+ super(DoxyParam, self)._parse()
+ self.set_descriptions(self._parse_data)
+ self._data['declname'] = self._parse_data.declname
+
+ brief_description = property(lambda self: self.data()['brief_description'])
+ detailed_description = property(lambda self: self.data()['detailed_description'])
+ declname = property(lambda self: self.data()['declname'])
+
+class DoxyClass(DoxyCompound):
+
+ __module__ = "gnuradio.utils.doxyxml"
+
+ kind = 'class'
+
+ def _parse(self):
+ if self._parsed:
+ return
+ super(DoxyClass, self)._parse()
+ self.retrieve_data()
+ if self._error:
+ return
+ self.set_descriptions(self._retrieved_data.compounddef)
+ # Sectiondef.kind tells about whether private or public.
+ # We just ignore this for now.
+ self.process_memberdefs()
+
+ brief_description = property(lambda self: self.data()['brief_description'])
+ detailed_description = property(lambda self: self.data()['detailed_description'])
+
+Base.mem_classes.append(DoxyClass)
+
+
+class DoxyFile(DoxyCompound):
+
+ __module__ = "gnuradio.utils.doxyxml"
+
+ kind = 'file'
+
+ def _parse(self):
+ if self._parsed:
+ return
+ super(DoxyFile, self)._parse()
+ self.retrieve_data()
+ self.set_descriptions(self._retrieved_data.compounddef)
+ if self._error:
+ return
+ self.process_memberdefs()
+
+ brief_description = property(lambda self: self.data()['brief_description'])
+ detailed_description = property(lambda self: self.data()['detailed_description'])
+
+Base.mem_classes.append(DoxyFile)
+
+
+class DoxyNamespace(DoxyCompound):
+
+ __module__ = "gnuradio.utils.doxyxml"
+
+ kind = 'namespace'
+
+Base.mem_classes.append(DoxyNamespace)
+
+
+class DoxyGroup(DoxyCompound):
+
+ __module__ = "gnuradio.utils.doxyxml"
+
+ kind = 'group'
+
+ def _parse(self):
+ if self._parsed:
+ return
+ super(DoxyGroup, self)._parse()
+ self.retrieve_data()
+ if self._error:
+ return
+ cdef = self._retrieved_data.compounddef
+ self._data['title'] = description(cdef.title)
+ # Process inner groups
+ grps = cdef.innergroup
+ for grp in grps:
+ converted = DoxyGroup.from_refid(grp.refid, top=self.top)
+ self._members.append(converted)
+ # Process inner classes
+ klasses = cdef.innerclass
+ for kls in klasses:
+ converted = DoxyClass.from_refid(kls.refid, top=self.top)
+ self._members.append(converted)
+ # Process normal members
+ self.process_memberdefs()
+
+ title = property(lambda self: self.data()['title'])
+
+
+Base.mem_classes.append(DoxyGroup)
+
+
+class DoxyFriend(DoxyMember):
+
+ __module__ = "gnuradio.utils.doxyxml"
+
+ kind = 'friend'
+
+Base.mem_classes.append(DoxyFriend)
+
+
+class DoxyOther(Base):
+
+ __module__ = "gnuradio.utils.doxyxml"
+
+ kinds = set(['variable', 'struct', 'union', 'define', 'typedef', 'enum', 'dir', 'page'])
+
+ @classmethod
+ def can_parse(cls, obj):
+ return obj.kind in cls.kinds
+
+Base.mem_classes.append(DoxyOther)
+
diff --git a/gr-utils/src/python/modtool/gr-newmod/docs/doxygen/doxyxml/generated/__init__.py b/gr-utils/src/python/modtool/gr-newmod/docs/doxygen/doxyxml/generated/__init__.py
new file mode 100644
index 000000000..39823979f
--- /dev/null
+++ b/gr-utils/src/python/modtool/gr-newmod/docs/doxygen/doxyxml/generated/__init__.py
@@ -0,0 +1,7 @@
+"""
+Contains generated files produced by generateDS.py.
+
+These do the real work of parsing the doxygen xml files but the
+resultant classes are not very friendly to navigate so the rest of the
+doxyxml module processes them further.
+"""
diff --git a/gr-utils/src/python/modtool/gr-newmod/docs/doxygen/doxyxml/generated/compound.py b/gr-utils/src/python/modtool/gr-newmod/docs/doxygen/doxyxml/generated/compound.py
new file mode 100644
index 000000000..1522ac23f
--- /dev/null
+++ b/gr-utils/src/python/modtool/gr-newmod/docs/doxygen/doxyxml/generated/compound.py
@@ -0,0 +1,503 @@
+#!/usr/bin/env python
+
+"""
+Generated Mon Feb 9 19:08:05 2009 by generateDS.py.
+"""
+
+from string import lower as str_lower
+from xml.dom import minidom
+from xml.dom import Node
+
+import sys
+
+import compoundsuper as supermod
+from compoundsuper import MixedContainer
+
+
+class DoxygenTypeSub(supermod.DoxygenType):
+ def __init__(self, version=None, compounddef=None):
+ supermod.DoxygenType.__init__(self, version, compounddef)
+
+ def find(self, details):
+
+ return self.compounddef.find(details)
+
+supermod.DoxygenType.subclass = DoxygenTypeSub
+# end class DoxygenTypeSub
+
+
+class compounddefTypeSub(supermod.compounddefType):
+ def __init__(self, kind=None, prot=None, id=None, compoundname='', title='', basecompoundref=None, derivedcompoundref=None, includes=None, includedby=None, incdepgraph=None, invincdepgraph=None, innerdir=None, innerfile=None, innerclass=None, innernamespace=None, innerpage=None, innergroup=None, templateparamlist=None, sectiondef=None, briefdescription=None, detaileddescription=None, inheritancegraph=None, collaborationgraph=None, programlisting=None, location=None, listofallmembers=None):
+ supermod.compounddefType.__init__(self, kind, prot, id, compoundname, title, basecompoundref, derivedcompoundref, includes, includedby, incdepgraph, invincdepgraph, innerdir, innerfile, innerclass, innernamespace, innerpage, innergroup, templateparamlist, sectiondef, briefdescription, detaileddescription, inheritancegraph, collaborationgraph, programlisting, location, listofallmembers)
+
+ def find(self, details):
+
+ if self.id == details.refid:
+ return self
+
+ for sectiondef in self.sectiondef:
+ result = sectiondef.find(details)
+ if result:
+ return result
+
+
+supermod.compounddefType.subclass = compounddefTypeSub
+# end class compounddefTypeSub
+
+
+class listofallmembersTypeSub(supermod.listofallmembersType):
+ def __init__(self, member=None):
+ supermod.listofallmembersType.__init__(self, member)
+supermod.listofallmembersType.subclass = listofallmembersTypeSub
+# end class listofallmembersTypeSub
+
+
+class memberRefTypeSub(supermod.memberRefType):
+ def __init__(self, virt=None, prot=None, refid=None, ambiguityscope=None, scope='', name=''):
+ supermod.memberRefType.__init__(self, virt, prot, refid, ambiguityscope, scope, name)
+supermod.memberRefType.subclass = memberRefTypeSub
+# end class memberRefTypeSub
+
+
+class compoundRefTypeSub(supermod.compoundRefType):
+ def __init__(self, virt=None, prot=None, refid=None, valueOf_='', mixedclass_=None, content_=None):
+ supermod.compoundRefType.__init__(self, mixedclass_, content_)
+supermod.compoundRefType.subclass = compoundRefTypeSub
+# end class compoundRefTypeSub
+
+
+class reimplementTypeSub(supermod.reimplementType):
+ def __init__(self, refid=None, valueOf_='', mixedclass_=None, content_=None):
+ supermod.reimplementType.__init__(self, mixedclass_, content_)
+supermod.reimplementType.subclass = reimplementTypeSub
+# end class reimplementTypeSub
+
+
+class incTypeSub(supermod.incType):
+ def __init__(self, local=None, refid=None, valueOf_='', mixedclass_=None, content_=None):
+ supermod.incType.__init__(self, mixedclass_, content_)
+supermod.incType.subclass = incTypeSub
+# end class incTypeSub
+
+
+class refTypeSub(supermod.refType):
+ def __init__(self, prot=None, refid=None, valueOf_='', mixedclass_=None, content_=None):
+ supermod.refType.__init__(self, mixedclass_, content_)
+supermod.refType.subclass = refTypeSub
+# end class refTypeSub
+
+
+
+class refTextTypeSub(supermod.refTextType):
+ def __init__(self, refid=None, kindref=None, external=None, valueOf_='', mixedclass_=None, content_=None):
+ supermod.refTextType.__init__(self, mixedclass_, content_)
+
+supermod.refTextType.subclass = refTextTypeSub
+# end class refTextTypeSub
+
+class sectiondefTypeSub(supermod.sectiondefType):
+
+
+ def __init__(self, kind=None, header='', description=None, memberdef=None):
+ supermod.sectiondefType.__init__(self, kind, header, description, memberdef)
+
+ def find(self, details):
+
+ for memberdef in self.memberdef:
+ if memberdef.id == details.refid:
+ return memberdef
+
+ return None
+
+
+supermod.sectiondefType.subclass = sectiondefTypeSub
+# end class sectiondefTypeSub
+
+
+class memberdefTypeSub(supermod.memberdefType):
+ def __init__(self, initonly=None, kind=None, volatile=None, const=None, raise_=None, virt=None, readable=None, prot=None, explicit=None, new=None, final=None, writable=None, add=None, static=None, remove=None, sealed=None, mutable=None, gettable=None, inline=None, settable=None, id=None, templateparamlist=None, type_=None, definition='', argsstring='', name='', read='', write='', bitfield='', reimplements=None, reimplementedby=None, param=None, enumvalue=None, initializer=None, exceptions=None, briefdescription=None, detaileddescription=None, inbodydescription=None, location=None, references=None, referencedby=None):
+ supermod.memberdefType.__init__(self, initonly, kind, volatile, const, raise_, virt, readable, prot, explicit, new, final, writable, add, static, remove, sealed, mutable, gettable, inline, settable, id, templateparamlist, type_, definition, argsstring, name, read, write, bitfield, reimplements, reimplementedby, param, enumvalue, initializer, exceptions, briefdescription, detaileddescription, inbodydescription, location, references, referencedby)
+supermod.memberdefType.subclass = memberdefTypeSub
+# end class memberdefTypeSub
+
+
+class descriptionTypeSub(supermod.descriptionType):
+ def __init__(self, title='', para=None, sect1=None, internal=None, mixedclass_=None, content_=None):
+ supermod.descriptionType.__init__(self, mixedclass_, content_)
+supermod.descriptionType.subclass = descriptionTypeSub
+# end class descriptionTypeSub
+
+
+class enumvalueTypeSub(supermod.enumvalueType):
+ def __init__(self, prot=None, id=None, name='', initializer=None, briefdescription=None, detaileddescription=None, mixedclass_=None, content_=None):
+ supermod.enumvalueType.__init__(self, mixedclass_, content_)
+supermod.enumvalueType.subclass = enumvalueTypeSub
+# end class enumvalueTypeSub
+
+
+class templateparamlistTypeSub(supermod.templateparamlistType):
+ def __init__(self, param=None):
+ supermod.templateparamlistType.__init__(self, param)
+supermod.templateparamlistType.subclass = templateparamlistTypeSub
+# end class templateparamlistTypeSub
+
+
+class paramTypeSub(supermod.paramType):
+ def __init__(self, type_=None, declname='', defname='', array='', defval=None, briefdescription=None):
+ supermod.paramType.__init__(self, type_, declname, defname, array, defval, briefdescription)
+supermod.paramType.subclass = paramTypeSub
+# end class paramTypeSub
+
+
+class linkedTextTypeSub(supermod.linkedTextType):
+ def __init__(self, ref=None, mixedclass_=None, content_=None):
+ supermod.linkedTextType.__init__(self, mixedclass_, content_)
+supermod.linkedTextType.subclass = linkedTextTypeSub
+# end class linkedTextTypeSub
+
+
+class graphTypeSub(supermod.graphType):
+ def __init__(self, node=None):
+ supermod.graphType.__init__(self, node)
+supermod.graphType.subclass = graphTypeSub
+# end class graphTypeSub
+
+
+class nodeTypeSub(supermod.nodeType):
+ def __init__(self, id=None, label='', link=None, childnode=None):
+ supermod.nodeType.__init__(self, id, label, link, childnode)
+supermod.nodeType.subclass = nodeTypeSub
+# end class nodeTypeSub
+
+
+class childnodeTypeSub(supermod.childnodeType):
+ def __init__(self, relation=None, refid=None, edgelabel=None):
+ supermod.childnodeType.__init__(self, relation, refid, edgelabel)
+supermod.childnodeType.subclass = childnodeTypeSub
+# end class childnodeTypeSub
+
+
+class linkTypeSub(supermod.linkType):
+ def __init__(self, refid=None, external=None, valueOf_=''):
+ supermod.linkType.__init__(self, refid, external)
+supermod.linkType.subclass = linkTypeSub
+# end class linkTypeSub
+
+
+class listingTypeSub(supermod.listingType):
+ def __init__(self, codeline=None):
+ supermod.listingType.__init__(self, codeline)
+supermod.listingType.subclass = listingTypeSub
+# end class listingTypeSub
+
+
+class codelineTypeSub(supermod.codelineType):
+ def __init__(self, external=None, lineno=None, refkind=None, refid=None, highlight=None):
+ supermod.codelineType.__init__(self, external, lineno, refkind, refid, highlight)
+supermod.codelineType.subclass = codelineTypeSub
+# end class codelineTypeSub
+
+
+class highlightTypeSub(supermod.highlightType):
+ def __init__(self, class_=None, sp=None, ref=None, mixedclass_=None, content_=None):
+ supermod.highlightType.__init__(self, mixedclass_, content_)
+supermod.highlightType.subclass = highlightTypeSub
+# end class highlightTypeSub
+
+
+class referenceTypeSub(supermod.referenceType):
+ def __init__(self, endline=None, startline=None, refid=None, compoundref=None, valueOf_='', mixedclass_=None, content_=None):
+ supermod.referenceType.__init__(self, mixedclass_, content_)
+supermod.referenceType.subclass = referenceTypeSub
+# end class referenceTypeSub
+
+
+class locationTypeSub(supermod.locationType):
+ def __init__(self, bodystart=None, line=None, bodyend=None, bodyfile=None, file=None, valueOf_=''):
+ supermod.locationType.__init__(self, bodystart, line, bodyend, bodyfile, file)
+supermod.locationType.subclass = locationTypeSub
+# end class locationTypeSub
+
+
+class docSect1TypeSub(supermod.docSect1Type):
+ def __init__(self, id=None, title='', para=None, sect2=None, internal=None, mixedclass_=None, content_=None):
+ supermod.docSect1Type.__init__(self, mixedclass_, content_)
+supermod.docSect1Type.subclass = docSect1TypeSub
+# end class docSect1TypeSub
+
+
+class docSect2TypeSub(supermod.docSect2Type):
+ def __init__(self, id=None, title='', para=None, sect3=None, internal=None, mixedclass_=None, content_=None):
+ supermod.docSect2Type.__init__(self, mixedclass_, content_)
+supermod.docSect2Type.subclass = docSect2TypeSub
+# end class docSect2TypeSub
+
+
+class docSect3TypeSub(supermod.docSect3Type):
+ def __init__(self, id=None, title='', para=None, sect4=None, internal=None, mixedclass_=None, content_=None):
+ supermod.docSect3Type.__init__(self, mixedclass_, content_)
+supermod.docSect3Type.subclass = docSect3TypeSub
+# end class docSect3TypeSub
+
+
+class docSect4TypeSub(supermod.docSect4Type):
+ def __init__(self, id=None, title='', para=None, internal=None, mixedclass_=None, content_=None):
+ supermod.docSect4Type.__init__(self, mixedclass_, content_)
+supermod.docSect4Type.subclass = docSect4TypeSub
+# end class docSect4TypeSub
+
+
+class docInternalTypeSub(supermod.docInternalType):
+ def __init__(self, para=None, sect1=None, mixedclass_=None, content_=None):
+ supermod.docInternalType.__init__(self, mixedclass_, content_)
+supermod.docInternalType.subclass = docInternalTypeSub
+# end class docInternalTypeSub
+
+
+class docInternalS1TypeSub(supermod.docInternalS1Type):
+ def __init__(self, para=None, sect2=None, mixedclass_=None, content_=None):
+ supermod.docInternalS1Type.__init__(self, mixedclass_, content_)
+supermod.docInternalS1Type.subclass = docInternalS1TypeSub
+# end class docInternalS1TypeSub
+
+
+class docInternalS2TypeSub(supermod.docInternalS2Type):
+ def __init__(self, para=None, sect3=None, mixedclass_=None, content_=None):
+ supermod.docInternalS2Type.__init__(self, mixedclass_, content_)
+supermod.docInternalS2Type.subclass = docInternalS2TypeSub
+# end class docInternalS2TypeSub
+
+
+class docInternalS3TypeSub(supermod.docInternalS3Type):
+ def __init__(self, para=None, sect3=None, mixedclass_=None, content_=None):
+ supermod.docInternalS3Type.__init__(self, mixedclass_, content_)
+supermod.docInternalS3Type.subclass = docInternalS3TypeSub
+# end class docInternalS3TypeSub
+
+
+class docInternalS4TypeSub(supermod.docInternalS4Type):
+ def __init__(self, para=None, mixedclass_=None, content_=None):
+ supermod.docInternalS4Type.__init__(self, mixedclass_, content_)
+supermod.docInternalS4Type.subclass = docInternalS4TypeSub
+# end class docInternalS4TypeSub
+
+
+class docURLLinkSub(supermod.docURLLink):
+ def __init__(self, url=None, valueOf_='', mixedclass_=None, content_=None):
+ supermod.docURLLink.__init__(self, mixedclass_, content_)
+supermod.docURLLink.subclass = docURLLinkSub
+# end class docURLLinkSub
+
+
+class docAnchorTypeSub(supermod.docAnchorType):
+ def __init__(self, id=None, valueOf_='', mixedclass_=None, content_=None):
+ supermod.docAnchorType.__init__(self, mixedclass_, content_)
+supermod.docAnchorType.subclass = docAnchorTypeSub
+# end class docAnchorTypeSub
+
+
+class docFormulaTypeSub(supermod.docFormulaType):
+ def __init__(self, id=None, valueOf_='', mixedclass_=None, content_=None):
+ supermod.docFormulaType.__init__(self, mixedclass_, content_)
+supermod.docFormulaType.subclass = docFormulaTypeSub
+# end class docFormulaTypeSub
+
+
+class docIndexEntryTypeSub(supermod.docIndexEntryType):
+ def __init__(self, primaryie='', secondaryie=''):
+ supermod.docIndexEntryType.__init__(self, primaryie, secondaryie)
+supermod.docIndexEntryType.subclass = docIndexEntryTypeSub
+# end class docIndexEntryTypeSub
+
+
+class docListTypeSub(supermod.docListType):
+ def __init__(self, listitem=None):
+ supermod.docListType.__init__(self, listitem)
+supermod.docListType.subclass = docListTypeSub
+# end class docListTypeSub
+
+
+class docListItemTypeSub(supermod.docListItemType):
+ def __init__(self, para=None):
+ supermod.docListItemType.__init__(self, para)
+supermod.docListItemType.subclass = docListItemTypeSub
+# end class docListItemTypeSub
+
+
+class docSimpleSectTypeSub(supermod.docSimpleSectType):
+ def __init__(self, kind=None, title=None, para=None):
+ supermod.docSimpleSectType.__init__(self, kind, title, para)
+supermod.docSimpleSectType.subclass = docSimpleSectTypeSub
+# end class docSimpleSectTypeSub
+
+
+class docVarListEntryTypeSub(supermod.docVarListEntryType):
+ def __init__(self, term=None):
+ supermod.docVarListEntryType.__init__(self, term)
+supermod.docVarListEntryType.subclass = docVarListEntryTypeSub
+# end class docVarListEntryTypeSub
+
+
+class docRefTextTypeSub(supermod.docRefTextType):
+ def __init__(self, refid=None, kindref=None, external=None, valueOf_='', mixedclass_=None, content_=None):
+ supermod.docRefTextType.__init__(self, mixedclass_, content_)
+supermod.docRefTextType.subclass = docRefTextTypeSub
+# end class docRefTextTypeSub
+
+
+class docTableTypeSub(supermod.docTableType):
+ def __init__(self, rows=None, cols=None, row=None, caption=None):
+ supermod.docTableType.__init__(self, rows, cols, row, caption)
+supermod.docTableType.subclass = docTableTypeSub
+# end class docTableTypeSub
+
+
+class docRowTypeSub(supermod.docRowType):
+ def __init__(self, entry=None):
+ supermod.docRowType.__init__(self, entry)
+supermod.docRowType.subclass = docRowTypeSub
+# end class docRowTypeSub
+
+
+class docEntryTypeSub(supermod.docEntryType):
+ def __init__(self, thead=None, para=None):
+ supermod.docEntryType.__init__(self, thead, para)
+supermod.docEntryType.subclass = docEntryTypeSub
+# end class docEntryTypeSub
+
+
+class docHeadingTypeSub(supermod.docHeadingType):
+ def __init__(self, level=None, valueOf_='', mixedclass_=None, content_=None):
+ supermod.docHeadingType.__init__(self, mixedclass_, content_)
+supermod.docHeadingType.subclass = docHeadingTypeSub
+# end class docHeadingTypeSub
+
+
+class docImageTypeSub(supermod.docImageType):
+ def __init__(self, width=None, type_=None, name=None, height=None, valueOf_='', mixedclass_=None, content_=None):
+ supermod.docImageType.__init__(self, mixedclass_, content_)
+supermod.docImageType.subclass = docImageTypeSub
+# end class docImageTypeSub
+
+
+class docDotFileTypeSub(supermod.docDotFileType):
+ def __init__(self, name=None, valueOf_='', mixedclass_=None, content_=None):
+ supermod.docDotFileType.__init__(self, mixedclass_, content_)
+supermod.docDotFileType.subclass = docDotFileTypeSub
+# end class docDotFileTypeSub
+
+
+class docTocItemTypeSub(supermod.docTocItemType):
+ def __init__(self, id=None, valueOf_='', mixedclass_=None, content_=None):
+ supermod.docTocItemType.__init__(self, mixedclass_, content_)
+supermod.docTocItemType.subclass = docTocItemTypeSub
+# end class docTocItemTypeSub
+
+
+class docTocListTypeSub(supermod.docTocListType):
+ def __init__(self, tocitem=None):
+ supermod.docTocListType.__init__(self, tocitem)
+supermod.docTocListType.subclass = docTocListTypeSub
+# end class docTocListTypeSub
+
+
+class docLanguageTypeSub(supermod.docLanguageType):
+ def __init__(self, langid=None, para=None):
+ supermod.docLanguageType.__init__(self, langid, para)
+supermod.docLanguageType.subclass = docLanguageTypeSub
+# end class docLanguageTypeSub
+
+
+class docParamListTypeSub(supermod.docParamListType):
+ def __init__(self, kind=None, parameteritem=None):
+ supermod.docParamListType.__init__(self, kind, parameteritem)
+supermod.docParamListType.subclass = docParamListTypeSub
+# end class docParamListTypeSub
+
+
+class docParamListItemSub(supermod.docParamListItem):
+ def __init__(self, parameternamelist=None, parameterdescription=None):
+ supermod.docParamListItem.__init__(self, parameternamelist, parameterdescription)
+supermod.docParamListItem.subclass = docParamListItemSub
+# end class docParamListItemSub
+
+
+class docParamNameListSub(supermod.docParamNameList):
+ def __init__(self, parametername=None):
+ supermod.docParamNameList.__init__(self, parametername)
+supermod.docParamNameList.subclass = docParamNameListSub
+# end class docParamNameListSub
+
+
+class docParamNameSub(supermod.docParamName):
+ def __init__(self, direction=None, ref=None, mixedclass_=None, content_=None):
+ supermod.docParamName.__init__(self, mixedclass_, content_)
+supermod.docParamName.subclass = docParamNameSub
+# end class docParamNameSub
+
+
+class docXRefSectTypeSub(supermod.docXRefSectType):
+ def __init__(self, id=None, xreftitle=None, xrefdescription=None):
+ supermod.docXRefSectType.__init__(self, id, xreftitle, xrefdescription)
+supermod.docXRefSectType.subclass = docXRefSectTypeSub
+# end class docXRefSectTypeSub
+
+
+class docCopyTypeSub(supermod.docCopyType):
+ def __init__(self, link=None, para=None, sect1=None, internal=None):
+ supermod.docCopyType.__init__(self, link, para, sect1, internal)
+supermod.docCopyType.subclass = docCopyTypeSub
+# end class docCopyTypeSub
+
+
+class docCharTypeSub(supermod.docCharType):
+ def __init__(self, char=None, valueOf_=''):
+ supermod.docCharType.__init__(self, char)
+supermod.docCharType.subclass = docCharTypeSub
+# end class docCharTypeSub
+
+class docParaTypeSub(supermod.docParaType):
+ def __init__(self, char=None, valueOf_=''):
+ supermod.docParaType.__init__(self, char)
+
+ self.parameterlist = []
+ self.simplesects = []
+ self.content = []
+
+ def buildChildren(self, child_, nodeName_):
+ supermod.docParaType.buildChildren(self, child_, nodeName_)
+
+ if child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == "ref":
+ obj_ = supermod.docRefTextType.factory()
+ obj_.build(child_)
+ self.content.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'parameterlist':
+ obj_ = supermod.docParamListType.factory()
+ obj_.build(child_)
+ self.parameterlist.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'simplesect':
+ obj_ = supermod.docSimpleSectType.factory()
+ obj_.build(child_)
+ self.simplesects.append(obj_)
+
+
+supermod.docParaType.subclass = docParaTypeSub
+# end class docParaTypeSub
+
+
+
+def parse(inFilename):
+ doc = minidom.parse(inFilename)
+ rootNode = doc.documentElement
+ rootObj = supermod.DoxygenType.factory()
+ rootObj.build(rootNode)
+ return rootObj
+
+
diff --git a/gr-utils/src/python/modtool/gr-newmod/docs/doxygen/doxyxml/generated/compoundsuper.py b/gr-utils/src/python/modtool/gr-newmod/docs/doxygen/doxyxml/generated/compoundsuper.py
new file mode 100644
index 000000000..6255dda16
--- /dev/null
+++ b/gr-utils/src/python/modtool/gr-newmod/docs/doxygen/doxyxml/generated/compoundsuper.py
@@ -0,0 +1,8342 @@
+#!/usr/bin/env python
+
+#
+# Generated Thu Jun 11 18:44:25 2009 by generateDS.py.
+#
+
+import sys
+import getopt
+from string import lower as str_lower
+from xml.dom import minidom
+from xml.dom import Node
+
+#
+# User methods
+#
+# Calls to the methods in these classes are generated by generateDS.py.
+# You can replace these methods by re-implementing the following class
+# in a module named generatedssuper.py.
+
+try:
+ from generatedssuper import GeneratedsSuper
+except ImportError, exp:
+
+ class GeneratedsSuper:
+ def format_string(self, input_data, input_name=''):
+ return input_data
+ def format_integer(self, input_data, input_name=''):
+ return '%d' % input_data
+ def format_float(self, input_data, input_name=''):
+ return '%f' % input_data
+ def format_double(self, input_data, input_name=''):
+ return '%e' % input_data
+ def format_boolean(self, input_data, input_name=''):
+ return '%s' % input_data
+
+
+#
+# If you have installed IPython you can uncomment and use the following.
+# IPython is available from http://ipython.scipy.org/.
+#
+
+## from IPython.Shell import IPShellEmbed
+## args = ''
+## ipshell = IPShellEmbed(args,
+## banner = 'Dropping into IPython',
+## exit_msg = 'Leaving Interpreter, back to program.')
+
+# Then use the following line where and when you want to drop into the
+# IPython shell:
+# ipshell('<some message> -- Entering ipshell.\nHit Ctrl-D to exit')
+
+#
+# Globals
+#
+
+ExternalEncoding = 'ascii'
+
+#
+# Support/utility functions.
+#
+
+def showIndent(outfile, level):
+ for idx in range(level):
+ outfile.write(' ')
+
+def quote_xml(inStr):
+ s1 = (isinstance(inStr, basestring) and inStr or
+ '%s' % inStr)
+ s1 = s1.replace('&', '&amp;')
+ s1 = s1.replace('<', '&lt;')
+ s1 = s1.replace('>', '&gt;')
+ return s1
+
+def quote_attrib(inStr):
+ s1 = (isinstance(inStr, basestring) and inStr or
+ '%s' % inStr)
+ s1 = s1.replace('&', '&amp;')
+ s1 = s1.replace('<', '&lt;')
+ s1 = s1.replace('>', '&gt;')
+ if '"' in s1:
+ if "'" in s1:
+ s1 = '"%s"' % s1.replace('"', "&quot;")
+ else:
+ s1 = "'%s'" % s1
+ else:
+ s1 = '"%s"' % s1
+ return s1
+
+def quote_python(inStr):
+ s1 = inStr
+ if s1.find("'") == -1:
+ if s1.find('\n') == -1:
+ return "'%s'" % s1
+ else:
+ return "'''%s'''" % s1
+ else:
+ if s1.find('"') != -1:
+ s1 = s1.replace('"', '\\"')
+ if s1.find('\n') == -1:
+ return '"%s"' % s1
+ else:
+ return '"""%s"""' % s1
+
+
+class MixedContainer:
+ # Constants for category:
+ CategoryNone = 0
+ CategoryText = 1
+ CategorySimple = 2
+ CategoryComplex = 3
+ # Constants for content_type:
+ TypeNone = 0
+ TypeText = 1
+ TypeString = 2
+ TypeInteger = 3
+ TypeFloat = 4
+ TypeDecimal = 5
+ TypeDouble = 6
+ TypeBoolean = 7
+ def __init__(self, category, content_type, name, value):
+ self.category = category
+ self.content_type = content_type
+ self.name = name
+ self.value = value
+ def getCategory(self):
+ return self.category
+ def getContenttype(self, content_type):
+ return self.content_type
+ def getValue(self):
+ return self.value
+ def getName(self):
+ return self.name
+ def export(self, outfile, level, name, namespace):
+ if self.category == MixedContainer.CategoryText:
+ outfile.write(self.value)
+ elif self.category == MixedContainer.CategorySimple:
+ self.exportSimple(outfile, level, name)
+ else: # category == MixedContainer.CategoryComplex
+ self.value.export(outfile, level, namespace,name)
+ def exportSimple(self, outfile, level, name):
+ if self.content_type == MixedContainer.TypeString:
+ outfile.write('<%s>%s</%s>' % (self.name, self.value, self.name))
+ elif self.content_type == MixedContainer.TypeInteger or \
+ self.content_type == MixedContainer.TypeBoolean:
+ outfile.write('<%s>%d</%s>' % (self.name, self.value, self.name))
+ elif self.content_type == MixedContainer.TypeFloat or \
+ self.content_type == MixedContainer.TypeDecimal:
+ outfile.write('<%s>%f</%s>' % (self.name, self.value, self.name))
+ elif self.content_type == MixedContainer.TypeDouble:
+ outfile.write('<%s>%g</%s>' % (self.name, self.value, self.name))
+ def exportLiteral(self, outfile, level, name):
+ if self.category == MixedContainer.CategoryText:
+ showIndent(outfile, level)
+ outfile.write('MixedContainer(%d, %d, "%s", "%s"),\n' % \
+ (self.category, self.content_type, self.name, self.value))
+ elif self.category == MixedContainer.CategorySimple:
+ showIndent(outfile, level)
+ outfile.write('MixedContainer(%d, %d, "%s", "%s"),\n' % \
+ (self.category, self.content_type, self.name, self.value))
+ else: # category == MixedContainer.CategoryComplex
+ showIndent(outfile, level)
+ outfile.write('MixedContainer(%d, %d, "%s",\n' % \
+ (self.category, self.content_type, self.name,))
+ self.value.exportLiteral(outfile, level + 1)
+ showIndent(outfile, level)
+ outfile.write(')\n')
+
+
+class _MemberSpec(object):
+ def __init__(self, name='', data_type='', container=0):
+ self.name = name
+ self.data_type = data_type
+ self.container = container
+ def set_name(self, name): self.name = name
+ def get_name(self): return self.name
+ def set_data_type(self, data_type): self.data_type = data_type
+ def get_data_type(self): return self.data_type
+ def set_container(self, container): self.container = container
+ def get_container(self): return self.container
+
+
+#
+# Data representation classes.
+#
+
+class DoxygenType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, version=None, compounddef=None):
+ self.version = version
+ self.compounddef = compounddef
+ def factory(*args_, **kwargs_):
+ if DoxygenType.subclass:
+ return DoxygenType.subclass(*args_, **kwargs_)
+ else:
+ return DoxygenType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_compounddef(self): return self.compounddef
+ def set_compounddef(self, compounddef): self.compounddef = compounddef
+ def get_version(self): return self.version
+ def set_version(self, version): self.version = version
+ def export(self, outfile, level, namespace_='', name_='DoxygenType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='DoxygenType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='DoxygenType'):
+ outfile.write(' version=%s' % (quote_attrib(self.version), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='DoxygenType'):
+ if self.compounddef:
+ self.compounddef.export(outfile, level, namespace_, name_='compounddef')
+ def hasContent_(self):
+ if (
+ self.compounddef is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='DoxygenType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.version is not None:
+ showIndent(outfile, level)
+ outfile.write('version = "%s",\n' % (self.version,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ if self.compounddef:
+ showIndent(outfile, level)
+ outfile.write('compounddef=model_.compounddefType(\n')
+ self.compounddef.exportLiteral(outfile, level, name_='compounddef')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('version'):
+ self.version = attrs.get('version').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'compounddef':
+ obj_ = compounddefType.factory()
+ obj_.build(child_)
+ self.set_compounddef(obj_)
+# end class DoxygenType
+
+
+class compounddefType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, kind=None, prot=None, id=None, compoundname=None, title=None, basecompoundref=None, derivedcompoundref=None, includes=None, includedby=None, incdepgraph=None, invincdepgraph=None, innerdir=None, innerfile=None, innerclass=None, innernamespace=None, innerpage=None, innergroup=None, templateparamlist=None, sectiondef=None, briefdescription=None, detaileddescription=None, inheritancegraph=None, collaborationgraph=None, programlisting=None, location=None, listofallmembers=None):
+ self.kind = kind
+ self.prot = prot
+ self.id = id
+ self.compoundname = compoundname
+ self.title = title
+ if basecompoundref is None:
+ self.basecompoundref = []
+ else:
+ self.basecompoundref = basecompoundref
+ if derivedcompoundref is None:
+ self.derivedcompoundref = []
+ else:
+ self.derivedcompoundref = derivedcompoundref
+ if includes is None:
+ self.includes = []
+ else:
+ self.includes = includes
+ if includedby is None:
+ self.includedby = []
+ else:
+ self.includedby = includedby
+ self.incdepgraph = incdepgraph
+ self.invincdepgraph = invincdepgraph
+ if innerdir is None:
+ self.innerdir = []
+ else:
+ self.innerdir = innerdir
+ if innerfile is None:
+ self.innerfile = []
+ else:
+ self.innerfile = innerfile
+ if innerclass is None:
+ self.innerclass = []
+ else:
+ self.innerclass = innerclass
+ if innernamespace is None:
+ self.innernamespace = []
+ else:
+ self.innernamespace = innernamespace
+ if innerpage is None:
+ self.innerpage = []
+ else:
+ self.innerpage = innerpage
+ if innergroup is None:
+ self.innergroup = []
+ else:
+ self.innergroup = innergroup
+ self.templateparamlist = templateparamlist
+ if sectiondef is None:
+ self.sectiondef = []
+ else:
+ self.sectiondef = sectiondef
+ self.briefdescription = briefdescription
+ self.detaileddescription = detaileddescription
+ self.inheritancegraph = inheritancegraph
+ self.collaborationgraph = collaborationgraph
+ self.programlisting = programlisting
+ self.location = location
+ self.listofallmembers = listofallmembers
+ def factory(*args_, **kwargs_):
+ if compounddefType.subclass:
+ return compounddefType.subclass(*args_, **kwargs_)
+ else:
+ return compounddefType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_compoundname(self): return self.compoundname
+ def set_compoundname(self, compoundname): self.compoundname = compoundname
+ def get_title(self): return self.title
+ def set_title(self, title): self.title = title
+ def get_basecompoundref(self): return self.basecompoundref
+ def set_basecompoundref(self, basecompoundref): self.basecompoundref = basecompoundref
+ def add_basecompoundref(self, value): self.basecompoundref.append(value)
+ def insert_basecompoundref(self, index, value): self.basecompoundref[index] = value
+ def get_derivedcompoundref(self): return self.derivedcompoundref
+ def set_derivedcompoundref(self, derivedcompoundref): self.derivedcompoundref = derivedcompoundref
+ def add_derivedcompoundref(self, value): self.derivedcompoundref.append(value)
+ def insert_derivedcompoundref(self, index, value): self.derivedcompoundref[index] = value
+ def get_includes(self): return self.includes
+ def set_includes(self, includes): self.includes = includes
+ def add_includes(self, value): self.includes.append(value)
+ def insert_includes(self, index, value): self.includes[index] = value
+ def get_includedby(self): return self.includedby
+ def set_includedby(self, includedby): self.includedby = includedby
+ def add_includedby(self, value): self.includedby.append(value)
+ def insert_includedby(self, index, value): self.includedby[index] = value
+ def get_incdepgraph(self): return self.incdepgraph
+ def set_incdepgraph(self, incdepgraph): self.incdepgraph = incdepgraph
+ def get_invincdepgraph(self): return self.invincdepgraph
+ def set_invincdepgraph(self, invincdepgraph): self.invincdepgraph = invincdepgraph
+ def get_innerdir(self): return self.innerdir
+ def set_innerdir(self, innerdir): self.innerdir = innerdir
+ def add_innerdir(self, value): self.innerdir.append(value)
+ def insert_innerdir(self, index, value): self.innerdir[index] = value
+ def get_innerfile(self): return self.innerfile
+ def set_innerfile(self, innerfile): self.innerfile = innerfile
+ def add_innerfile(self, value): self.innerfile.append(value)
+ def insert_innerfile(self, index, value): self.innerfile[index] = value
+ def get_innerclass(self): return self.innerclass
+ def set_innerclass(self, innerclass): self.innerclass = innerclass
+ def add_innerclass(self, value): self.innerclass.append(value)
+ def insert_innerclass(self, index, value): self.innerclass[index] = value
+ def get_innernamespace(self): return self.innernamespace
+ def set_innernamespace(self, innernamespace): self.innernamespace = innernamespace
+ def add_innernamespace(self, value): self.innernamespace.append(value)
+ def insert_innernamespace(self, index, value): self.innernamespace[index] = value
+ def get_innerpage(self): return self.innerpage
+ def set_innerpage(self, innerpage): self.innerpage = innerpage
+ def add_innerpage(self, value): self.innerpage.append(value)
+ def insert_innerpage(self, index, value): self.innerpage[index] = value
+ def get_innergroup(self): return self.innergroup
+ def set_innergroup(self, innergroup): self.innergroup = innergroup
+ def add_innergroup(self, value): self.innergroup.append(value)
+ def insert_innergroup(self, index, value): self.innergroup[index] = value
+ def get_templateparamlist(self): return self.templateparamlist
+ def set_templateparamlist(self, templateparamlist): self.templateparamlist = templateparamlist
+ def get_sectiondef(self): return self.sectiondef
+ def set_sectiondef(self, sectiondef): self.sectiondef = sectiondef
+ def add_sectiondef(self, value): self.sectiondef.append(value)
+ def insert_sectiondef(self, index, value): self.sectiondef[index] = value
+ def get_briefdescription(self): return self.briefdescription
+ def set_briefdescription(self, briefdescription): self.briefdescription = briefdescription
+ def get_detaileddescription(self): return self.detaileddescription
+ def set_detaileddescription(self, detaileddescription): self.detaileddescription = detaileddescription
+ def get_inheritancegraph(self): return self.inheritancegraph
+ def set_inheritancegraph(self, inheritancegraph): self.inheritancegraph = inheritancegraph
+ def get_collaborationgraph(self): return self.collaborationgraph
+ def set_collaborationgraph(self, collaborationgraph): self.collaborationgraph = collaborationgraph
+ def get_programlisting(self): return self.programlisting
+ def set_programlisting(self, programlisting): self.programlisting = programlisting
+ def get_location(self): return self.location
+ def set_location(self, location): self.location = location
+ def get_listofallmembers(self): return self.listofallmembers
+ def set_listofallmembers(self, listofallmembers): self.listofallmembers = listofallmembers
+ def get_kind(self): return self.kind
+ def set_kind(self, kind): self.kind = kind
+ def get_prot(self): return self.prot
+ def set_prot(self, prot): self.prot = prot
+ def get_id(self): return self.id
+ def set_id(self, id): self.id = id
+ def export(self, outfile, level, namespace_='', name_='compounddefType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='compounddefType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='compounddefType'):
+ if self.kind is not None:
+ outfile.write(' kind=%s' % (quote_attrib(self.kind), ))
+ if self.prot is not None:
+ outfile.write(' prot=%s' % (quote_attrib(self.prot), ))
+ if self.id is not None:
+ outfile.write(' id=%s' % (self.format_string(quote_attrib(self.id).encode(ExternalEncoding), input_name='id'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='compounddefType'):
+ if self.compoundname is not None:
+ showIndent(outfile, level)
+ outfile.write('<%scompoundname>%s</%scompoundname>\n' % (namespace_, self.format_string(quote_xml(self.compoundname).encode(ExternalEncoding), input_name='compoundname'), namespace_))
+ if self.title is not None:
+ showIndent(outfile, level)
+ outfile.write('<%stitle>%s</%stitle>\n' % (namespace_, self.format_string(quote_xml(self.title).encode(ExternalEncoding), input_name='title'), namespace_))
+ for basecompoundref_ in self.basecompoundref:
+ basecompoundref_.export(outfile, level, namespace_, name_='basecompoundref')
+ for derivedcompoundref_ in self.derivedcompoundref:
+ derivedcompoundref_.export(outfile, level, namespace_, name_='derivedcompoundref')
+ for includes_ in self.includes:
+ includes_.export(outfile, level, namespace_, name_='includes')
+ for includedby_ in self.includedby:
+ includedby_.export(outfile, level, namespace_, name_='includedby')
+ if self.incdepgraph:
+ self.incdepgraph.export(outfile, level, namespace_, name_='incdepgraph')
+ if self.invincdepgraph:
+ self.invincdepgraph.export(outfile, level, namespace_, name_='invincdepgraph')
+ for innerdir_ in self.innerdir:
+ innerdir_.export(outfile, level, namespace_, name_='innerdir')
+ for innerfile_ in self.innerfile:
+ innerfile_.export(outfile, level, namespace_, name_='innerfile')
+ for innerclass_ in self.innerclass:
+ innerclass_.export(outfile, level, namespace_, name_='innerclass')
+ for innernamespace_ in self.innernamespace:
+ innernamespace_.export(outfile, level, namespace_, name_='innernamespace')
+ for innerpage_ in self.innerpage:
+ innerpage_.export(outfile, level, namespace_, name_='innerpage')
+ for innergroup_ in self.innergroup:
+ innergroup_.export(outfile, level, namespace_, name_='innergroup')
+ if self.templateparamlist:
+ self.templateparamlist.export(outfile, level, namespace_, name_='templateparamlist')
+ for sectiondef_ in self.sectiondef:
+ sectiondef_.export(outfile, level, namespace_, name_='sectiondef')
+ if self.briefdescription:
+ self.briefdescription.export(outfile, level, namespace_, name_='briefdescription')
+ if self.detaileddescription:
+ self.detaileddescription.export(outfile, level, namespace_, name_='detaileddescription')
+ if self.inheritancegraph:
+ self.inheritancegraph.export(outfile, level, namespace_, name_='inheritancegraph')
+ if self.collaborationgraph:
+ self.collaborationgraph.export(outfile, level, namespace_, name_='collaborationgraph')
+ if self.programlisting:
+ self.programlisting.export(outfile, level, namespace_, name_='programlisting')
+ if self.location:
+ self.location.export(outfile, level, namespace_, name_='location')
+ if self.listofallmembers:
+ self.listofallmembers.export(outfile, level, namespace_, name_='listofallmembers')
+ def hasContent_(self):
+ if (
+ self.compoundname is not None or
+ self.title is not None or
+ self.basecompoundref is not None or
+ self.derivedcompoundref is not None or
+ self.includes is not None or
+ self.includedby is not None or
+ self.incdepgraph is not None or
+ self.invincdepgraph is not None or
+ self.innerdir is not None or
+ self.innerfile is not None or
+ self.innerclass is not None or
+ self.innernamespace is not None or
+ self.innerpage is not None or
+ self.innergroup is not None or
+ self.templateparamlist is not None or
+ self.sectiondef is not None or
+ self.briefdescription is not None or
+ self.detaileddescription is not None or
+ self.inheritancegraph is not None or
+ self.collaborationgraph is not None or
+ self.programlisting is not None or
+ self.location is not None or
+ self.listofallmembers is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='compounddefType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.kind is not None:
+ showIndent(outfile, level)
+ outfile.write('kind = "%s",\n' % (self.kind,))
+ if self.prot is not None:
+ showIndent(outfile, level)
+ outfile.write('prot = "%s",\n' % (self.prot,))
+ if self.id is not None:
+ showIndent(outfile, level)
+ outfile.write('id = %s,\n' % (self.id,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('compoundname=%s,\n' % quote_python(self.compoundname).encode(ExternalEncoding))
+ if self.title:
+ showIndent(outfile, level)
+ outfile.write('title=model_.xsd_string(\n')
+ self.title.exportLiteral(outfile, level, name_='title')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ showIndent(outfile, level)
+ outfile.write('basecompoundref=[\n')
+ level += 1
+ for basecompoundref in self.basecompoundref:
+ showIndent(outfile, level)
+ outfile.write('model_.basecompoundref(\n')
+ basecompoundref.exportLiteral(outfile, level, name_='basecompoundref')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('derivedcompoundref=[\n')
+ level += 1
+ for derivedcompoundref in self.derivedcompoundref:
+ showIndent(outfile, level)
+ outfile.write('model_.derivedcompoundref(\n')
+ derivedcompoundref.exportLiteral(outfile, level, name_='derivedcompoundref')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('includes=[\n')
+ level += 1
+ for includes in self.includes:
+ showIndent(outfile, level)
+ outfile.write('model_.includes(\n')
+ includes.exportLiteral(outfile, level, name_='includes')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('includedby=[\n')
+ level += 1
+ for includedby in self.includedby:
+ showIndent(outfile, level)
+ outfile.write('model_.includedby(\n')
+ includedby.exportLiteral(outfile, level, name_='includedby')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ if self.incdepgraph:
+ showIndent(outfile, level)
+ outfile.write('incdepgraph=model_.graphType(\n')
+ self.incdepgraph.exportLiteral(outfile, level, name_='incdepgraph')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ if self.invincdepgraph:
+ showIndent(outfile, level)
+ outfile.write('invincdepgraph=model_.graphType(\n')
+ self.invincdepgraph.exportLiteral(outfile, level, name_='invincdepgraph')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ showIndent(outfile, level)
+ outfile.write('innerdir=[\n')
+ level += 1
+ for innerdir in self.innerdir:
+ showIndent(outfile, level)
+ outfile.write('model_.innerdir(\n')
+ innerdir.exportLiteral(outfile, level, name_='innerdir')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('innerfile=[\n')
+ level += 1
+ for innerfile in self.innerfile:
+ showIndent(outfile, level)
+ outfile.write('model_.innerfile(\n')
+ innerfile.exportLiteral(outfile, level, name_='innerfile')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('innerclass=[\n')
+ level += 1
+ for innerclass in self.innerclass:
+ showIndent(outfile, level)
+ outfile.write('model_.innerclass(\n')
+ innerclass.exportLiteral(outfile, level, name_='innerclass')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('innernamespace=[\n')
+ level += 1
+ for innernamespace in self.innernamespace:
+ showIndent(outfile, level)
+ outfile.write('model_.innernamespace(\n')
+ innernamespace.exportLiteral(outfile, level, name_='innernamespace')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('innerpage=[\n')
+ level += 1
+ for innerpage in self.innerpage:
+ showIndent(outfile, level)
+ outfile.write('model_.innerpage(\n')
+ innerpage.exportLiteral(outfile, level, name_='innerpage')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('innergroup=[\n')
+ level += 1
+ for innergroup in self.innergroup:
+ showIndent(outfile, level)
+ outfile.write('model_.innergroup(\n')
+ innergroup.exportLiteral(outfile, level, name_='innergroup')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ if self.templateparamlist:
+ showIndent(outfile, level)
+ outfile.write('templateparamlist=model_.templateparamlistType(\n')
+ self.templateparamlist.exportLiteral(outfile, level, name_='templateparamlist')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ showIndent(outfile, level)
+ outfile.write('sectiondef=[\n')
+ level += 1
+ for sectiondef in self.sectiondef:
+ showIndent(outfile, level)
+ outfile.write('model_.sectiondef(\n')
+ sectiondef.exportLiteral(outfile, level, name_='sectiondef')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ if self.briefdescription:
+ showIndent(outfile, level)
+ outfile.write('briefdescription=model_.descriptionType(\n')
+ self.briefdescription.exportLiteral(outfile, level, name_='briefdescription')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ if self.detaileddescription:
+ showIndent(outfile, level)
+ outfile.write('detaileddescription=model_.descriptionType(\n')
+ self.detaileddescription.exportLiteral(outfile, level, name_='detaileddescription')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ if self.inheritancegraph:
+ showIndent(outfile, level)
+ outfile.write('inheritancegraph=model_.graphType(\n')
+ self.inheritancegraph.exportLiteral(outfile, level, name_='inheritancegraph')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ if self.collaborationgraph:
+ showIndent(outfile, level)
+ outfile.write('collaborationgraph=model_.graphType(\n')
+ self.collaborationgraph.exportLiteral(outfile, level, name_='collaborationgraph')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ if self.programlisting:
+ showIndent(outfile, level)
+ outfile.write('programlisting=model_.listingType(\n')
+ self.programlisting.exportLiteral(outfile, level, name_='programlisting')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ if self.location:
+ showIndent(outfile, level)
+ outfile.write('location=model_.locationType(\n')
+ self.location.exportLiteral(outfile, level, name_='location')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ if self.listofallmembers:
+ showIndent(outfile, level)
+ outfile.write('listofallmembers=model_.listofallmembersType(\n')
+ self.listofallmembers.exportLiteral(outfile, level, name_='listofallmembers')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('kind'):
+ self.kind = attrs.get('kind').value
+ if attrs.get('prot'):
+ self.prot = attrs.get('prot').value
+ if attrs.get('id'):
+ self.id = attrs.get('id').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'compoundname':
+ compoundname_ = ''
+ for text__content_ in child_.childNodes:
+ compoundname_ += text__content_.nodeValue
+ self.compoundname = compoundname_
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'title':
+ obj_ = docTitleType.factory()
+ obj_.build(child_)
+ self.set_title(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'basecompoundref':
+ obj_ = compoundRefType.factory()
+ obj_.build(child_)
+ self.basecompoundref.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'derivedcompoundref':
+ obj_ = compoundRefType.factory()
+ obj_.build(child_)
+ self.derivedcompoundref.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'includes':
+ obj_ = incType.factory()
+ obj_.build(child_)
+ self.includes.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'includedby':
+ obj_ = incType.factory()
+ obj_.build(child_)
+ self.includedby.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'incdepgraph':
+ obj_ = graphType.factory()
+ obj_.build(child_)
+ self.set_incdepgraph(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'invincdepgraph':
+ obj_ = graphType.factory()
+ obj_.build(child_)
+ self.set_invincdepgraph(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'innerdir':
+ obj_ = refType.factory()
+ obj_.build(child_)
+ self.innerdir.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'innerfile':
+ obj_ = refType.factory()
+ obj_.build(child_)
+ self.innerfile.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'innerclass':
+ obj_ = refType.factory()
+ obj_.build(child_)
+ self.innerclass.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'innernamespace':
+ obj_ = refType.factory()
+ obj_.build(child_)
+ self.innernamespace.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'innerpage':
+ obj_ = refType.factory()
+ obj_.build(child_)
+ self.innerpage.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'innergroup':
+ obj_ = refType.factory()
+ obj_.build(child_)
+ self.innergroup.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'templateparamlist':
+ obj_ = templateparamlistType.factory()
+ obj_.build(child_)
+ self.set_templateparamlist(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'sectiondef':
+ obj_ = sectiondefType.factory()
+ obj_.build(child_)
+ self.sectiondef.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'briefdescription':
+ obj_ = descriptionType.factory()
+ obj_.build(child_)
+ self.set_briefdescription(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'detaileddescription':
+ obj_ = descriptionType.factory()
+ obj_.build(child_)
+ self.set_detaileddescription(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'inheritancegraph':
+ obj_ = graphType.factory()
+ obj_.build(child_)
+ self.set_inheritancegraph(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'collaborationgraph':
+ obj_ = graphType.factory()
+ obj_.build(child_)
+ self.set_collaborationgraph(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'programlisting':
+ obj_ = listingType.factory()
+ obj_.build(child_)
+ self.set_programlisting(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'location':
+ obj_ = locationType.factory()
+ obj_.build(child_)
+ self.set_location(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'listofallmembers':
+ obj_ = listofallmembersType.factory()
+ obj_.build(child_)
+ self.set_listofallmembers(obj_)
+# end class compounddefType
+
+
+class listofallmembersType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, member=None):
+ if member is None:
+ self.member = []
+ else:
+ self.member = member
+ def factory(*args_, **kwargs_):
+ if listofallmembersType.subclass:
+ return listofallmembersType.subclass(*args_, **kwargs_)
+ else:
+ return listofallmembersType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_member(self): return self.member
+ def set_member(self, member): self.member = member
+ def add_member(self, value): self.member.append(value)
+ def insert_member(self, index, value): self.member[index] = value
+ def export(self, outfile, level, namespace_='', name_='listofallmembersType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='listofallmembersType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='listofallmembersType'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='listofallmembersType'):
+ for member_ in self.member:
+ member_.export(outfile, level, namespace_, name_='member')
+ def hasContent_(self):
+ if (
+ self.member is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='listofallmembersType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('member=[\n')
+ level += 1
+ for member in self.member:
+ showIndent(outfile, level)
+ outfile.write('model_.member(\n')
+ member.exportLiteral(outfile, level, name_='member')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'member':
+ obj_ = memberRefType.factory()
+ obj_.build(child_)
+ self.member.append(obj_)
+# end class listofallmembersType
+
+
+class memberRefType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, virt=None, prot=None, refid=None, ambiguityscope=None, scope=None, name=None):
+ self.virt = virt
+ self.prot = prot
+ self.refid = refid
+ self.ambiguityscope = ambiguityscope
+ self.scope = scope
+ self.name = name
+ def factory(*args_, **kwargs_):
+ if memberRefType.subclass:
+ return memberRefType.subclass(*args_, **kwargs_)
+ else:
+ return memberRefType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_scope(self): return self.scope
+ def set_scope(self, scope): self.scope = scope
+ def get_name(self): return self.name
+ def set_name(self, name): self.name = name
+ def get_virt(self): return self.virt
+ def set_virt(self, virt): self.virt = virt
+ def get_prot(self): return self.prot
+ def set_prot(self, prot): self.prot = prot
+ def get_refid(self): return self.refid
+ def set_refid(self, refid): self.refid = refid
+ def get_ambiguityscope(self): return self.ambiguityscope
+ def set_ambiguityscope(self, ambiguityscope): self.ambiguityscope = ambiguityscope
+ def export(self, outfile, level, namespace_='', name_='memberRefType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='memberRefType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='memberRefType'):
+ if self.virt is not None:
+ outfile.write(' virt=%s' % (quote_attrib(self.virt), ))
+ if self.prot is not None:
+ outfile.write(' prot=%s' % (quote_attrib(self.prot), ))
+ if self.refid is not None:
+ outfile.write(' refid=%s' % (self.format_string(quote_attrib(self.refid).encode(ExternalEncoding), input_name='refid'), ))
+ if self.ambiguityscope is not None:
+ outfile.write(' ambiguityscope=%s' % (self.format_string(quote_attrib(self.ambiguityscope).encode(ExternalEncoding), input_name='ambiguityscope'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='memberRefType'):
+ if self.scope is not None:
+ showIndent(outfile, level)
+ outfile.write('<%sscope>%s</%sscope>\n' % (namespace_, self.format_string(quote_xml(self.scope).encode(ExternalEncoding), input_name='scope'), namespace_))
+ if self.name is not None:
+ showIndent(outfile, level)
+ outfile.write('<%sname>%s</%sname>\n' % (namespace_, self.format_string(quote_xml(self.name).encode(ExternalEncoding), input_name='name'), namespace_))
+ def hasContent_(self):
+ if (
+ self.scope is not None or
+ self.name is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='memberRefType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.virt is not None:
+ showIndent(outfile, level)
+ outfile.write('virt = "%s",\n' % (self.virt,))
+ if self.prot is not None:
+ showIndent(outfile, level)
+ outfile.write('prot = "%s",\n' % (self.prot,))
+ if self.refid is not None:
+ showIndent(outfile, level)
+ outfile.write('refid = %s,\n' % (self.refid,))
+ if self.ambiguityscope is not None:
+ showIndent(outfile, level)
+ outfile.write('ambiguityscope = %s,\n' % (self.ambiguityscope,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('scope=%s,\n' % quote_python(self.scope).encode(ExternalEncoding))
+ showIndent(outfile, level)
+ outfile.write('name=%s,\n' % quote_python(self.name).encode(ExternalEncoding))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('virt'):
+ self.virt = attrs.get('virt').value
+ if attrs.get('prot'):
+ self.prot = attrs.get('prot').value
+ if attrs.get('refid'):
+ self.refid = attrs.get('refid').value
+ if attrs.get('ambiguityscope'):
+ self.ambiguityscope = attrs.get('ambiguityscope').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'scope':
+ scope_ = ''
+ for text__content_ in child_.childNodes:
+ scope_ += text__content_.nodeValue
+ self.scope = scope_
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'name':
+ name_ = ''
+ for text__content_ in child_.childNodes:
+ name_ += text__content_.nodeValue
+ self.name = name_
+# end class memberRefType
+
+
+class scope(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, valueOf_=''):
+ self.valueOf_ = valueOf_
+ def factory(*args_, **kwargs_):
+ if scope.subclass:
+ return scope.subclass(*args_, **kwargs_)
+ else:
+ return scope(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='scope', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='scope')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='scope'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='scope'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='scope'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class scope
+
+
+class name(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, valueOf_=''):
+ self.valueOf_ = valueOf_
+ def factory(*args_, **kwargs_):
+ if name.subclass:
+ return name.subclass(*args_, **kwargs_)
+ else:
+ return name(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='name', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='name')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='name'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='name'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='name'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class name
+
+
+class compoundRefType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, virt=None, prot=None, refid=None, valueOf_='', mixedclass_=None, content_=None):
+ self.virt = virt
+ self.prot = prot
+ self.refid = refid
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if compoundRefType.subclass:
+ return compoundRefType.subclass(*args_, **kwargs_)
+ else:
+ return compoundRefType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_virt(self): return self.virt
+ def set_virt(self, virt): self.virt = virt
+ def get_prot(self): return self.prot
+ def set_prot(self, prot): self.prot = prot
+ def get_refid(self): return self.refid
+ def set_refid(self, refid): self.refid = refid
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='compoundRefType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='compoundRefType')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='compoundRefType'):
+ if self.virt is not None:
+ outfile.write(' virt=%s' % (quote_attrib(self.virt), ))
+ if self.prot is not None:
+ outfile.write(' prot=%s' % (quote_attrib(self.prot), ))
+ if self.refid is not None:
+ outfile.write(' refid=%s' % (self.format_string(quote_attrib(self.refid).encode(ExternalEncoding), input_name='refid'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='compoundRefType'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='compoundRefType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.virt is not None:
+ showIndent(outfile, level)
+ outfile.write('virt = "%s",\n' % (self.virt,))
+ if self.prot is not None:
+ showIndent(outfile, level)
+ outfile.write('prot = "%s",\n' % (self.prot,))
+ if self.refid is not None:
+ showIndent(outfile, level)
+ outfile.write('refid = %s,\n' % (self.refid,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('virt'):
+ self.virt = attrs.get('virt').value
+ if attrs.get('prot'):
+ self.prot = attrs.get('prot').value
+ if attrs.get('refid'):
+ self.refid = attrs.get('refid').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class compoundRefType
+
+
+class reimplementType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, refid=None, valueOf_='', mixedclass_=None, content_=None):
+ self.refid = refid
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if reimplementType.subclass:
+ return reimplementType.subclass(*args_, **kwargs_)
+ else:
+ return reimplementType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_refid(self): return self.refid
+ def set_refid(self, refid): self.refid = refid
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='reimplementType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='reimplementType')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='reimplementType'):
+ if self.refid is not None:
+ outfile.write(' refid=%s' % (self.format_string(quote_attrib(self.refid).encode(ExternalEncoding), input_name='refid'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='reimplementType'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='reimplementType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.refid is not None:
+ showIndent(outfile, level)
+ outfile.write('refid = %s,\n' % (self.refid,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('refid'):
+ self.refid = attrs.get('refid').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class reimplementType
+
+
+class incType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, local=None, refid=None, valueOf_='', mixedclass_=None, content_=None):
+ self.local = local
+ self.refid = refid
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if incType.subclass:
+ return incType.subclass(*args_, **kwargs_)
+ else:
+ return incType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_local(self): return self.local
+ def set_local(self, local): self.local = local
+ def get_refid(self): return self.refid
+ def set_refid(self, refid): self.refid = refid
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='incType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='incType')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='incType'):
+ if self.local is not None:
+ outfile.write(' local=%s' % (quote_attrib(self.local), ))
+ if self.refid is not None:
+ outfile.write(' refid=%s' % (self.format_string(quote_attrib(self.refid).encode(ExternalEncoding), input_name='refid'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='incType'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='incType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.local is not None:
+ showIndent(outfile, level)
+ outfile.write('local = "%s",\n' % (self.local,))
+ if self.refid is not None:
+ showIndent(outfile, level)
+ outfile.write('refid = %s,\n' % (self.refid,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('local'):
+ self.local = attrs.get('local').value
+ if attrs.get('refid'):
+ self.refid = attrs.get('refid').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class incType
+
+
+class refType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, prot=None, refid=None, valueOf_='', mixedclass_=None, content_=None):
+ self.prot = prot
+ self.refid = refid
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if refType.subclass:
+ return refType.subclass(*args_, **kwargs_)
+ else:
+ return refType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_prot(self): return self.prot
+ def set_prot(self, prot): self.prot = prot
+ def get_refid(self): return self.refid
+ def set_refid(self, refid): self.refid = refid
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='refType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='refType')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='refType'):
+ if self.prot is not None:
+ outfile.write(' prot=%s' % (quote_attrib(self.prot), ))
+ if self.refid is not None:
+ outfile.write(' refid=%s' % (self.format_string(quote_attrib(self.refid).encode(ExternalEncoding), input_name='refid'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='refType'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='refType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.prot is not None:
+ showIndent(outfile, level)
+ outfile.write('prot = "%s",\n' % (self.prot,))
+ if self.refid is not None:
+ showIndent(outfile, level)
+ outfile.write('refid = %s,\n' % (self.refid,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('prot'):
+ self.prot = attrs.get('prot').value
+ if attrs.get('refid'):
+ self.refid = attrs.get('refid').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class refType
+
+
+class refTextType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, refid=None, kindref=None, external=None, valueOf_='', mixedclass_=None, content_=None):
+ self.refid = refid
+ self.kindref = kindref
+ self.external = external
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if refTextType.subclass:
+ return refTextType.subclass(*args_, **kwargs_)
+ else:
+ return refTextType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_refid(self): return self.refid
+ def set_refid(self, refid): self.refid = refid
+ def get_kindref(self): return self.kindref
+ def set_kindref(self, kindref): self.kindref = kindref
+ def get_external(self): return self.external
+ def set_external(self, external): self.external = external
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='refTextType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='refTextType')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='refTextType'):
+ if self.refid is not None:
+ outfile.write(' refid=%s' % (self.format_string(quote_attrib(self.refid).encode(ExternalEncoding), input_name='refid'), ))
+ if self.kindref is not None:
+ outfile.write(' kindref=%s' % (quote_attrib(self.kindref), ))
+ if self.external is not None:
+ outfile.write(' external=%s' % (self.format_string(quote_attrib(self.external).encode(ExternalEncoding), input_name='external'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='refTextType'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='refTextType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.refid is not None:
+ showIndent(outfile, level)
+ outfile.write('refid = %s,\n' % (self.refid,))
+ if self.kindref is not None:
+ showIndent(outfile, level)
+ outfile.write('kindref = "%s",\n' % (self.kindref,))
+ if self.external is not None:
+ showIndent(outfile, level)
+ outfile.write('external = %s,\n' % (self.external,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('refid'):
+ self.refid = attrs.get('refid').value
+ if attrs.get('kindref'):
+ self.kindref = attrs.get('kindref').value
+ if attrs.get('external'):
+ self.external = attrs.get('external').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class refTextType
+
+
+class sectiondefType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, kind=None, header=None, description=None, memberdef=None):
+ self.kind = kind
+ self.header = header
+ self.description = description
+ if memberdef is None:
+ self.memberdef = []
+ else:
+ self.memberdef = memberdef
+ def factory(*args_, **kwargs_):
+ if sectiondefType.subclass:
+ return sectiondefType.subclass(*args_, **kwargs_)
+ else:
+ return sectiondefType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_header(self): return self.header
+ def set_header(self, header): self.header = header
+ def get_description(self): return self.description
+ def set_description(self, description): self.description = description
+ def get_memberdef(self): return self.memberdef
+ def set_memberdef(self, memberdef): self.memberdef = memberdef
+ def add_memberdef(self, value): self.memberdef.append(value)
+ def insert_memberdef(self, index, value): self.memberdef[index] = value
+ def get_kind(self): return self.kind
+ def set_kind(self, kind): self.kind = kind
+ def export(self, outfile, level, namespace_='', name_='sectiondefType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='sectiondefType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='sectiondefType'):
+ if self.kind is not None:
+ outfile.write(' kind=%s' % (quote_attrib(self.kind), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='sectiondefType'):
+ if self.header is not None:
+ showIndent(outfile, level)
+ outfile.write('<%sheader>%s</%sheader>\n' % (namespace_, self.format_string(quote_xml(self.header).encode(ExternalEncoding), input_name='header'), namespace_))
+ if self.description:
+ self.description.export(outfile, level, namespace_, name_='description')
+ for memberdef_ in self.memberdef:
+ memberdef_.export(outfile, level, namespace_, name_='memberdef')
+ def hasContent_(self):
+ if (
+ self.header is not None or
+ self.description is not None or
+ self.memberdef is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='sectiondefType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.kind is not None:
+ showIndent(outfile, level)
+ outfile.write('kind = "%s",\n' % (self.kind,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('header=%s,\n' % quote_python(self.header).encode(ExternalEncoding))
+ if self.description:
+ showIndent(outfile, level)
+ outfile.write('description=model_.descriptionType(\n')
+ self.description.exportLiteral(outfile, level, name_='description')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ showIndent(outfile, level)
+ outfile.write('memberdef=[\n')
+ level += 1
+ for memberdef in self.memberdef:
+ showIndent(outfile, level)
+ outfile.write('model_.memberdef(\n')
+ memberdef.exportLiteral(outfile, level, name_='memberdef')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('kind'):
+ self.kind = attrs.get('kind').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'header':
+ header_ = ''
+ for text__content_ in child_.childNodes:
+ header_ += text__content_.nodeValue
+ self.header = header_
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'description':
+ obj_ = descriptionType.factory()
+ obj_.build(child_)
+ self.set_description(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'memberdef':
+ obj_ = memberdefType.factory()
+ obj_.build(child_)
+ self.memberdef.append(obj_)
+# end class sectiondefType
+
+
+class memberdefType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, initonly=None, kind=None, volatile=None, const=None, raisexx=None, virt=None, readable=None, prot=None, explicit=None, new=None, final=None, writable=None, add=None, static=None, remove=None, sealed=None, mutable=None, gettable=None, inline=None, settable=None, id=None, templateparamlist=None, type_=None, definition=None, argsstring=None, name=None, read=None, write=None, bitfield=None, reimplements=None, reimplementedby=None, param=None, enumvalue=None, initializer=None, exceptions=None, briefdescription=None, detaileddescription=None, inbodydescription=None, location=None, references=None, referencedby=None):
+ self.initonly = initonly
+ self.kind = kind
+ self.volatile = volatile
+ self.const = const
+ self.raisexx = raisexx
+ self.virt = virt
+ self.readable = readable
+ self.prot = prot
+ self.explicit = explicit
+ self.new = new
+ self.final = final
+ self.writable = writable
+ self.add = add
+ self.static = static
+ self.remove = remove
+ self.sealed = sealed
+ self.mutable = mutable
+ self.gettable = gettable
+ self.inline = inline
+ self.settable = settable
+ self.id = id
+ self.templateparamlist = templateparamlist
+ self.type_ = type_
+ self.definition = definition
+ self.argsstring = argsstring
+ self.name = name
+ self.read = read
+ self.write = write
+ self.bitfield = bitfield
+ if reimplements is None:
+ self.reimplements = []
+ else:
+ self.reimplements = reimplements
+ if reimplementedby is None:
+ self.reimplementedby = []
+ else:
+ self.reimplementedby = reimplementedby
+ if param is None:
+ self.param = []
+ else:
+ self.param = param
+ if enumvalue is None:
+ self.enumvalue = []
+ else:
+ self.enumvalue = enumvalue
+ self.initializer = initializer
+ self.exceptions = exceptions
+ self.briefdescription = briefdescription
+ self.detaileddescription = detaileddescription
+ self.inbodydescription = inbodydescription
+ self.location = location
+ if references is None:
+ self.references = []
+ else:
+ self.references = references
+ if referencedby is None:
+ self.referencedby = []
+ else:
+ self.referencedby = referencedby
+ def factory(*args_, **kwargs_):
+ if memberdefType.subclass:
+ return memberdefType.subclass(*args_, **kwargs_)
+ else:
+ return memberdefType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_templateparamlist(self): return self.templateparamlist
+ def set_templateparamlist(self, templateparamlist): self.templateparamlist = templateparamlist
+ def get_type(self): return self.type_
+ def set_type(self, type_): self.type_ = type_
+ def get_definition(self): return self.definition
+ def set_definition(self, definition): self.definition = definition
+ def get_argsstring(self): return self.argsstring
+ def set_argsstring(self, argsstring): self.argsstring = argsstring
+ def get_name(self): return self.name
+ def set_name(self, name): self.name = name
+ def get_read(self): return self.read
+ def set_read(self, read): self.read = read
+ def get_write(self): return self.write
+ def set_write(self, write): self.write = write
+ def get_bitfield(self): return self.bitfield
+ def set_bitfield(self, bitfield): self.bitfield = bitfield
+ def get_reimplements(self): return self.reimplements
+ def set_reimplements(self, reimplements): self.reimplements = reimplements
+ def add_reimplements(self, value): self.reimplements.append(value)
+ def insert_reimplements(self, index, value): self.reimplements[index] = value
+ def get_reimplementedby(self): return self.reimplementedby
+ def set_reimplementedby(self, reimplementedby): self.reimplementedby = reimplementedby
+ def add_reimplementedby(self, value): self.reimplementedby.append(value)
+ def insert_reimplementedby(self, index, value): self.reimplementedby[index] = value
+ def get_param(self): return self.param
+ def set_param(self, param): self.param = param
+ def add_param(self, value): self.param.append(value)
+ def insert_param(self, index, value): self.param[index] = value
+ def get_enumvalue(self): return self.enumvalue
+ def set_enumvalue(self, enumvalue): self.enumvalue = enumvalue
+ def add_enumvalue(self, value): self.enumvalue.append(value)
+ def insert_enumvalue(self, index, value): self.enumvalue[index] = value
+ def get_initializer(self): return self.initializer
+ def set_initializer(self, initializer): self.initializer = initializer
+ def get_exceptions(self): return self.exceptions
+ def set_exceptions(self, exceptions): self.exceptions = exceptions
+ def get_briefdescription(self): return self.briefdescription
+ def set_briefdescription(self, briefdescription): self.briefdescription = briefdescription
+ def get_detaileddescription(self): return self.detaileddescription
+ def set_detaileddescription(self, detaileddescription): self.detaileddescription = detaileddescription
+ def get_inbodydescription(self): return self.inbodydescription
+ def set_inbodydescription(self, inbodydescription): self.inbodydescription = inbodydescription
+ def get_location(self): return self.location
+ def set_location(self, location): self.location = location
+ def get_references(self): return self.references
+ def set_references(self, references): self.references = references
+ def add_references(self, value): self.references.append(value)
+ def insert_references(self, index, value): self.references[index] = value
+ def get_referencedby(self): return self.referencedby
+ def set_referencedby(self, referencedby): self.referencedby = referencedby
+ def add_referencedby(self, value): self.referencedby.append(value)
+ def insert_referencedby(self, index, value): self.referencedby[index] = value
+ def get_initonly(self): return self.initonly
+ def set_initonly(self, initonly): self.initonly = initonly
+ def get_kind(self): return self.kind
+ def set_kind(self, kind): self.kind = kind
+ def get_volatile(self): return self.volatile
+ def set_volatile(self, volatile): self.volatile = volatile
+ def get_const(self): return self.const
+ def set_const(self, const): self.const = const
+ def get_raise(self): return self.raisexx
+ def set_raise(self, raisexx): self.raisexx = raisexx
+ def get_virt(self): return self.virt
+ def set_virt(self, virt): self.virt = virt
+ def get_readable(self): return self.readable
+ def set_readable(self, readable): self.readable = readable
+ def get_prot(self): return self.prot
+ def set_prot(self, prot): self.prot = prot
+ def get_explicit(self): return self.explicit
+ def set_explicit(self, explicit): self.explicit = explicit
+ def get_new(self): return self.new
+ def set_new(self, new): self.new = new
+ def get_final(self): return self.final
+ def set_final(self, final): self.final = final
+ def get_writable(self): return self.writable
+ def set_writable(self, writable): self.writable = writable
+ def get_add(self): return self.add
+ def set_add(self, add): self.add = add
+ def get_static(self): return self.static
+ def set_static(self, static): self.static = static
+ def get_remove(self): return self.remove
+ def set_remove(self, remove): self.remove = remove
+ def get_sealed(self): return self.sealed
+ def set_sealed(self, sealed): self.sealed = sealed
+ def get_mutable(self): return self.mutable
+ def set_mutable(self, mutable): self.mutable = mutable
+ def get_gettable(self): return self.gettable
+ def set_gettable(self, gettable): self.gettable = gettable
+ def get_inline(self): return self.inline
+ def set_inline(self, inline): self.inline = inline
+ def get_settable(self): return self.settable
+ def set_settable(self, settable): self.settable = settable
+ def get_id(self): return self.id
+ def set_id(self, id): self.id = id
+ def export(self, outfile, level, namespace_='', name_='memberdefType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='memberdefType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='memberdefType'):
+ if self.initonly is not None:
+ outfile.write(' initonly=%s' % (quote_attrib(self.initonly), ))
+ if self.kind is not None:
+ outfile.write(' kind=%s' % (quote_attrib(self.kind), ))
+ if self.volatile is not None:
+ outfile.write(' volatile=%s' % (quote_attrib(self.volatile), ))
+ if self.const is not None:
+ outfile.write(' const=%s' % (quote_attrib(self.const), ))
+ if self.raisexx is not None:
+ outfile.write(' raise=%s' % (quote_attrib(self.raisexx), ))
+ if self.virt is not None:
+ outfile.write(' virt=%s' % (quote_attrib(self.virt), ))
+ if self.readable is not None:
+ outfile.write(' readable=%s' % (quote_attrib(self.readable), ))
+ if self.prot is not None:
+ outfile.write(' prot=%s' % (quote_attrib(self.prot), ))
+ if self.explicit is not None:
+ outfile.write(' explicit=%s' % (quote_attrib(self.explicit), ))
+ if self.new is not None:
+ outfile.write(' new=%s' % (quote_attrib(self.new), ))
+ if self.final is not None:
+ outfile.write(' final=%s' % (quote_attrib(self.final), ))
+ if self.writable is not None:
+ outfile.write(' writable=%s' % (quote_attrib(self.writable), ))
+ if self.add is not None:
+ outfile.write(' add=%s' % (quote_attrib(self.add), ))
+ if self.static is not None:
+ outfile.write(' static=%s' % (quote_attrib(self.static), ))
+ if self.remove is not None:
+ outfile.write(' remove=%s' % (quote_attrib(self.remove), ))
+ if self.sealed is not None:
+ outfile.write(' sealed=%s' % (quote_attrib(self.sealed), ))
+ if self.mutable is not None:
+ outfile.write(' mutable=%s' % (quote_attrib(self.mutable), ))
+ if self.gettable is not None:
+ outfile.write(' gettable=%s' % (quote_attrib(self.gettable), ))
+ if self.inline is not None:
+ outfile.write(' inline=%s' % (quote_attrib(self.inline), ))
+ if self.settable is not None:
+ outfile.write(' settable=%s' % (quote_attrib(self.settable), ))
+ if self.id is not None:
+ outfile.write(' id=%s' % (self.format_string(quote_attrib(self.id).encode(ExternalEncoding), input_name='id'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='memberdefType'):
+ if self.templateparamlist:
+ self.templateparamlist.export(outfile, level, namespace_, name_='templateparamlist')
+ if self.type_:
+ self.type_.export(outfile, level, namespace_, name_='type')
+ if self.definition is not None:
+ showIndent(outfile, level)
+ outfile.write('<%sdefinition>%s</%sdefinition>\n' % (namespace_, self.format_string(quote_xml(self.definition).encode(ExternalEncoding), input_name='definition'), namespace_))
+ if self.argsstring is not None:
+ showIndent(outfile, level)
+ outfile.write('<%sargsstring>%s</%sargsstring>\n' % (namespace_, self.format_string(quote_xml(self.argsstring).encode(ExternalEncoding), input_name='argsstring'), namespace_))
+ if self.name is not None:
+ showIndent(outfile, level)
+ outfile.write('<%sname>%s</%sname>\n' % (namespace_, self.format_string(quote_xml(self.name).encode(ExternalEncoding), input_name='name'), namespace_))
+ if self.read is not None:
+ showIndent(outfile, level)
+ outfile.write('<%sread>%s</%sread>\n' % (namespace_, self.format_string(quote_xml(self.read).encode(ExternalEncoding), input_name='read'), namespace_))
+ if self.write is not None:
+ showIndent(outfile, level)
+ outfile.write('<%swrite>%s</%swrite>\n' % (namespace_, self.format_string(quote_xml(self.write).encode(ExternalEncoding), input_name='write'), namespace_))
+ if self.bitfield is not None:
+ showIndent(outfile, level)
+ outfile.write('<%sbitfield>%s</%sbitfield>\n' % (namespace_, self.format_string(quote_xml(self.bitfield).encode(ExternalEncoding), input_name='bitfield'), namespace_))
+ for reimplements_ in self.reimplements:
+ reimplements_.export(outfile, level, namespace_, name_='reimplements')
+ for reimplementedby_ in self.reimplementedby:
+ reimplementedby_.export(outfile, level, namespace_, name_='reimplementedby')
+ for param_ in self.param:
+ param_.export(outfile, level, namespace_, name_='param')
+ for enumvalue_ in self.enumvalue:
+ enumvalue_.export(outfile, level, namespace_, name_='enumvalue')
+ if self.initializer:
+ self.initializer.export(outfile, level, namespace_, name_='initializer')
+ if self.exceptions:
+ self.exceptions.export(outfile, level, namespace_, name_='exceptions')
+ if self.briefdescription:
+ self.briefdescription.export(outfile, level, namespace_, name_='briefdescription')
+ if self.detaileddescription:
+ self.detaileddescription.export(outfile, level, namespace_, name_='detaileddescription')
+ if self.inbodydescription:
+ self.inbodydescription.export(outfile, level, namespace_, name_='inbodydescription')
+ if self.location:
+ self.location.export(outfile, level, namespace_, name_='location', )
+ for references_ in self.references:
+ references_.export(outfile, level, namespace_, name_='references')
+ for referencedby_ in self.referencedby:
+ referencedby_.export(outfile, level, namespace_, name_='referencedby')
+ def hasContent_(self):
+ if (
+ self.templateparamlist is not None or
+ self.type_ is not None or
+ self.definition is not None or
+ self.argsstring is not None or
+ self.name is not None or
+ self.read is not None or
+ self.write is not None or
+ self.bitfield is not None or
+ self.reimplements is not None or
+ self.reimplementedby is not None or
+ self.param is not None or
+ self.enumvalue is not None or
+ self.initializer is not None or
+ self.exceptions is not None or
+ self.briefdescription is not None or
+ self.detaileddescription is not None or
+ self.inbodydescription is not None or
+ self.location is not None or
+ self.references is not None or
+ self.referencedby is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='memberdefType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.initonly is not None:
+ showIndent(outfile, level)
+ outfile.write('initonly = "%s",\n' % (self.initonly,))
+ if self.kind is not None:
+ showIndent(outfile, level)
+ outfile.write('kind = "%s",\n' % (self.kind,))
+ if self.volatile is not None:
+ showIndent(outfile, level)
+ outfile.write('volatile = "%s",\n' % (self.volatile,))
+ if self.const is not None:
+ showIndent(outfile, level)
+ outfile.write('const = "%s",\n' % (self.const,))
+ if self.raisexx is not None:
+ showIndent(outfile, level)
+ outfile.write('raisexx = "%s",\n' % (self.raisexx,))
+ if self.virt is not None:
+ showIndent(outfile, level)
+ outfile.write('virt = "%s",\n' % (self.virt,))
+ if self.readable is not None:
+ showIndent(outfile, level)
+ outfile.write('readable = "%s",\n' % (self.readable,))
+ if self.prot is not None:
+ showIndent(outfile, level)
+ outfile.write('prot = "%s",\n' % (self.prot,))
+ if self.explicit is not None:
+ showIndent(outfile, level)
+ outfile.write('explicit = "%s",\n' % (self.explicit,))
+ if self.new is not None:
+ showIndent(outfile, level)
+ outfile.write('new = "%s",\n' % (self.new,))
+ if self.final is not None:
+ showIndent(outfile, level)
+ outfile.write('final = "%s",\n' % (self.final,))
+ if self.writable is not None:
+ showIndent(outfile, level)
+ outfile.write('writable = "%s",\n' % (self.writable,))
+ if self.add is not None:
+ showIndent(outfile, level)
+ outfile.write('add = "%s",\n' % (self.add,))
+ if self.static is not None:
+ showIndent(outfile, level)
+ outfile.write('static = "%s",\n' % (self.static,))
+ if self.remove is not None:
+ showIndent(outfile, level)
+ outfile.write('remove = "%s",\n' % (self.remove,))
+ if self.sealed is not None:
+ showIndent(outfile, level)
+ outfile.write('sealed = "%s",\n' % (self.sealed,))
+ if self.mutable is not None:
+ showIndent(outfile, level)
+ outfile.write('mutable = "%s",\n' % (self.mutable,))
+ if self.gettable is not None:
+ showIndent(outfile, level)
+ outfile.write('gettable = "%s",\n' % (self.gettable,))
+ if self.inline is not None:
+ showIndent(outfile, level)
+ outfile.write('inline = "%s",\n' % (self.inline,))
+ if self.settable is not None:
+ showIndent(outfile, level)
+ outfile.write('settable = "%s",\n' % (self.settable,))
+ if self.id is not None:
+ showIndent(outfile, level)
+ outfile.write('id = %s,\n' % (self.id,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ if self.templateparamlist:
+ showIndent(outfile, level)
+ outfile.write('templateparamlist=model_.templateparamlistType(\n')
+ self.templateparamlist.exportLiteral(outfile, level, name_='templateparamlist')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ if self.type_:
+ showIndent(outfile, level)
+ outfile.write('type_=model_.linkedTextType(\n')
+ self.type_.exportLiteral(outfile, level, name_='type')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ showIndent(outfile, level)
+ outfile.write('definition=%s,\n' % quote_python(self.definition).encode(ExternalEncoding))
+ showIndent(outfile, level)
+ outfile.write('argsstring=%s,\n' % quote_python(self.argsstring).encode(ExternalEncoding))
+ showIndent(outfile, level)
+ outfile.write('name=%s,\n' % quote_python(self.name).encode(ExternalEncoding))
+ showIndent(outfile, level)
+ outfile.write('read=%s,\n' % quote_python(self.read).encode(ExternalEncoding))
+ showIndent(outfile, level)
+ outfile.write('write=%s,\n' % quote_python(self.write).encode(ExternalEncoding))
+ showIndent(outfile, level)
+ outfile.write('bitfield=%s,\n' % quote_python(self.bitfield).encode(ExternalEncoding))
+ showIndent(outfile, level)
+ outfile.write('reimplements=[\n')
+ level += 1
+ for reimplements in self.reimplements:
+ showIndent(outfile, level)
+ outfile.write('model_.reimplements(\n')
+ reimplements.exportLiteral(outfile, level, name_='reimplements')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('reimplementedby=[\n')
+ level += 1
+ for reimplementedby in self.reimplementedby:
+ showIndent(outfile, level)
+ outfile.write('model_.reimplementedby(\n')
+ reimplementedby.exportLiteral(outfile, level, name_='reimplementedby')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('param=[\n')
+ level += 1
+ for param in self.param:
+ showIndent(outfile, level)
+ outfile.write('model_.param(\n')
+ param.exportLiteral(outfile, level, name_='param')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('enumvalue=[\n')
+ level += 1
+ for enumvalue in self.enumvalue:
+ showIndent(outfile, level)
+ outfile.write('model_.enumvalue(\n')
+ enumvalue.exportLiteral(outfile, level, name_='enumvalue')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ if self.initializer:
+ showIndent(outfile, level)
+ outfile.write('initializer=model_.linkedTextType(\n')
+ self.initializer.exportLiteral(outfile, level, name_='initializer')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ if self.exceptions:
+ showIndent(outfile, level)
+ outfile.write('exceptions=model_.linkedTextType(\n')
+ self.exceptions.exportLiteral(outfile, level, name_='exceptions')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ if self.briefdescription:
+ showIndent(outfile, level)
+ outfile.write('briefdescription=model_.descriptionType(\n')
+ self.briefdescription.exportLiteral(outfile, level, name_='briefdescription')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ if self.detaileddescription:
+ showIndent(outfile, level)
+ outfile.write('detaileddescription=model_.descriptionType(\n')
+ self.detaileddescription.exportLiteral(outfile, level, name_='detaileddescription')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ if self.inbodydescription:
+ showIndent(outfile, level)
+ outfile.write('inbodydescription=model_.descriptionType(\n')
+ self.inbodydescription.exportLiteral(outfile, level, name_='inbodydescription')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ if self.location:
+ showIndent(outfile, level)
+ outfile.write('location=model_.locationType(\n')
+ self.location.exportLiteral(outfile, level, name_='location')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ showIndent(outfile, level)
+ outfile.write('references=[\n')
+ level += 1
+ for references in self.references:
+ showIndent(outfile, level)
+ outfile.write('model_.references(\n')
+ references.exportLiteral(outfile, level, name_='references')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('referencedby=[\n')
+ level += 1
+ for referencedby in self.referencedby:
+ showIndent(outfile, level)
+ outfile.write('model_.referencedby(\n')
+ referencedby.exportLiteral(outfile, level, name_='referencedby')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('initonly'):
+ self.initonly = attrs.get('initonly').value
+ if attrs.get('kind'):
+ self.kind = attrs.get('kind').value
+ if attrs.get('volatile'):
+ self.volatile = attrs.get('volatile').value
+ if attrs.get('const'):
+ self.const = attrs.get('const').value
+ if attrs.get('raise'):
+ self.raisexx = attrs.get('raise').value
+ if attrs.get('virt'):
+ self.virt = attrs.get('virt').value
+ if attrs.get('readable'):
+ self.readable = attrs.get('readable').value
+ if attrs.get('prot'):
+ self.prot = attrs.get('prot').value
+ if attrs.get('explicit'):
+ self.explicit = attrs.get('explicit').value
+ if attrs.get('new'):
+ self.new = attrs.get('new').value
+ if attrs.get('final'):
+ self.final = attrs.get('final').value
+ if attrs.get('writable'):
+ self.writable = attrs.get('writable').value
+ if attrs.get('add'):
+ self.add = attrs.get('add').value
+ if attrs.get('static'):
+ self.static = attrs.get('static').value
+ if attrs.get('remove'):
+ self.remove = attrs.get('remove').value
+ if attrs.get('sealed'):
+ self.sealed = attrs.get('sealed').value
+ if attrs.get('mutable'):
+ self.mutable = attrs.get('mutable').value
+ if attrs.get('gettable'):
+ self.gettable = attrs.get('gettable').value
+ if attrs.get('inline'):
+ self.inline = attrs.get('inline').value
+ if attrs.get('settable'):
+ self.settable = attrs.get('settable').value
+ if attrs.get('id'):
+ self.id = attrs.get('id').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'templateparamlist':
+ obj_ = templateparamlistType.factory()
+ obj_.build(child_)
+ self.set_templateparamlist(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'type':
+ obj_ = linkedTextType.factory()
+ obj_.build(child_)
+ self.set_type(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'definition':
+ definition_ = ''
+ for text__content_ in child_.childNodes:
+ definition_ += text__content_.nodeValue
+ self.definition = definition_
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'argsstring':
+ argsstring_ = ''
+ for text__content_ in child_.childNodes:
+ argsstring_ += text__content_.nodeValue
+ self.argsstring = argsstring_
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'name':
+ name_ = ''
+ for text__content_ in child_.childNodes:
+ name_ += text__content_.nodeValue
+ self.name = name_
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'read':
+ read_ = ''
+ for text__content_ in child_.childNodes:
+ read_ += text__content_.nodeValue
+ self.read = read_
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'write':
+ write_ = ''
+ for text__content_ in child_.childNodes:
+ write_ += text__content_.nodeValue
+ self.write = write_
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'bitfield':
+ bitfield_ = ''
+ for text__content_ in child_.childNodes:
+ bitfield_ += text__content_.nodeValue
+ self.bitfield = bitfield_
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'reimplements':
+ obj_ = reimplementType.factory()
+ obj_.build(child_)
+ self.reimplements.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'reimplementedby':
+ obj_ = reimplementType.factory()
+ obj_.build(child_)
+ self.reimplementedby.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'param':
+ obj_ = paramType.factory()
+ obj_.build(child_)
+ self.param.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'enumvalue':
+ obj_ = enumvalueType.factory()
+ obj_.build(child_)
+ self.enumvalue.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'initializer':
+ obj_ = linkedTextType.factory()
+ obj_.build(child_)
+ self.set_initializer(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'exceptions':
+ obj_ = linkedTextType.factory()
+ obj_.build(child_)
+ self.set_exceptions(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'briefdescription':
+ obj_ = descriptionType.factory()
+ obj_.build(child_)
+ self.set_briefdescription(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'detaileddescription':
+ obj_ = descriptionType.factory()
+ obj_.build(child_)
+ self.set_detaileddescription(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'inbodydescription':
+ obj_ = descriptionType.factory()
+ obj_.build(child_)
+ self.set_inbodydescription(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'location':
+ obj_ = locationType.factory()
+ obj_.build(child_)
+ self.set_location(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'references':
+ obj_ = referenceType.factory()
+ obj_.build(child_)
+ self.references.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'referencedby':
+ obj_ = referenceType.factory()
+ obj_.build(child_)
+ self.referencedby.append(obj_)
+# end class memberdefType
+
+
+class definition(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, valueOf_=''):
+ self.valueOf_ = valueOf_
+ def factory(*args_, **kwargs_):
+ if definition.subclass:
+ return definition.subclass(*args_, **kwargs_)
+ else:
+ return definition(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='definition', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='definition')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='definition'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='definition'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='definition'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class definition
+
+
+class argsstring(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, valueOf_=''):
+ self.valueOf_ = valueOf_
+ def factory(*args_, **kwargs_):
+ if argsstring.subclass:
+ return argsstring.subclass(*args_, **kwargs_)
+ else:
+ return argsstring(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='argsstring', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='argsstring')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='argsstring'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='argsstring'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='argsstring'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class argsstring
+
+
+class read(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, valueOf_=''):
+ self.valueOf_ = valueOf_
+ def factory(*args_, **kwargs_):
+ if read.subclass:
+ return read.subclass(*args_, **kwargs_)
+ else:
+ return read(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='read', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='read')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='read'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='read'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='read'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class read
+
+
+class write(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, valueOf_=''):
+ self.valueOf_ = valueOf_
+ def factory(*args_, **kwargs_):
+ if write.subclass:
+ return write.subclass(*args_, **kwargs_)
+ else:
+ return write(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='write', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='write')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='write'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='write'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='write'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class write
+
+
+class bitfield(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, valueOf_=''):
+ self.valueOf_ = valueOf_
+ def factory(*args_, **kwargs_):
+ if bitfield.subclass:
+ return bitfield.subclass(*args_, **kwargs_)
+ else:
+ return bitfield(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='bitfield', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='bitfield')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='bitfield'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='bitfield'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='bitfield'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class bitfield
+
+
+class descriptionType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, title=None, para=None, sect1=None, internal=None, mixedclass_=None, content_=None):
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if descriptionType.subclass:
+ return descriptionType.subclass(*args_, **kwargs_)
+ else:
+ return descriptionType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_title(self): return self.title
+ def set_title(self, title): self.title = title
+ def get_para(self): return self.para
+ def set_para(self, para): self.para = para
+ def add_para(self, value): self.para.append(value)
+ def insert_para(self, index, value): self.para[index] = value
+ def get_sect1(self): return self.sect1
+ def set_sect1(self, sect1): self.sect1 = sect1
+ def add_sect1(self, value): self.sect1.append(value)
+ def insert_sect1(self, index, value): self.sect1[index] = value
+ def get_internal(self): return self.internal
+ def set_internal(self, internal): self.internal = internal
+ def export(self, outfile, level, namespace_='', name_='descriptionType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='descriptionType')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='descriptionType'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='descriptionType'):
+ for item_ in self.content_:
+ item_.export(outfile, level, item_.name, namespace_)
+ def hasContent_(self):
+ if (
+ self.title is not None or
+ self.para is not None or
+ self.sect1 is not None or
+ self.internal is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='descriptionType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'title':
+ childobj_ = docTitleType.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'title', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'para':
+ childobj_ = docParaType.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'para', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'sect1':
+ childobj_ = docSect1Type.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'sect1', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'internal':
+ childobj_ = docInternalType.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'internal', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+# end class descriptionType
+
+
+class enumvalueType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, prot=None, id=None, name=None, initializer=None, briefdescription=None, detaileddescription=None, mixedclass_=None, content_=None):
+ self.prot = prot
+ self.id = id
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if enumvalueType.subclass:
+ return enumvalueType.subclass(*args_, **kwargs_)
+ else:
+ return enumvalueType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_name(self): return self.name
+ def set_name(self, name): self.name = name
+ def get_initializer(self): return self.initializer
+ def set_initializer(self, initializer): self.initializer = initializer
+ def get_briefdescription(self): return self.briefdescription
+ def set_briefdescription(self, briefdescription): self.briefdescription = briefdescription
+ def get_detaileddescription(self): return self.detaileddescription
+ def set_detaileddescription(self, detaileddescription): self.detaileddescription = detaileddescription
+ def get_prot(self): return self.prot
+ def set_prot(self, prot): self.prot = prot
+ def get_id(self): return self.id
+ def set_id(self, id): self.id = id
+ def export(self, outfile, level, namespace_='', name_='enumvalueType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='enumvalueType')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='enumvalueType'):
+ if self.prot is not None:
+ outfile.write(' prot=%s' % (quote_attrib(self.prot), ))
+ if self.id is not None:
+ outfile.write(' id=%s' % (self.format_string(quote_attrib(self.id).encode(ExternalEncoding), input_name='id'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='enumvalueType'):
+ for item_ in self.content_:
+ item_.export(outfile, level, item_.name, namespace_)
+ def hasContent_(self):
+ if (
+ self.name is not None or
+ self.initializer is not None or
+ self.briefdescription is not None or
+ self.detaileddescription is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='enumvalueType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.prot is not None:
+ showIndent(outfile, level)
+ outfile.write('prot = "%s",\n' % (self.prot,))
+ if self.id is not None:
+ showIndent(outfile, level)
+ outfile.write('id = %s,\n' % (self.id,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('prot'):
+ self.prot = attrs.get('prot').value
+ if attrs.get('id'):
+ self.id = attrs.get('id').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'name':
+ value_ = []
+ for text_ in child_.childNodes:
+ value_.append(text_.nodeValue)
+ valuestr_ = ''.join(value_)
+ obj_ = self.mixedclass_(MixedContainer.CategorySimple,
+ MixedContainer.TypeString, 'name', valuestr_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'initializer':
+ childobj_ = linkedTextType.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'initializer', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'briefdescription':
+ childobj_ = descriptionType.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'briefdescription', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'detaileddescription':
+ childobj_ = descriptionType.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'detaileddescription', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+# end class enumvalueType
+
+
+class templateparamlistType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, param=None):
+ if param is None:
+ self.param = []
+ else:
+ self.param = param
+ def factory(*args_, **kwargs_):
+ if templateparamlistType.subclass:
+ return templateparamlistType.subclass(*args_, **kwargs_)
+ else:
+ return templateparamlistType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_param(self): return self.param
+ def set_param(self, param): self.param = param
+ def add_param(self, value): self.param.append(value)
+ def insert_param(self, index, value): self.param[index] = value
+ def export(self, outfile, level, namespace_='', name_='templateparamlistType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='templateparamlistType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='templateparamlistType'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='templateparamlistType'):
+ for param_ in self.param:
+ param_.export(outfile, level, namespace_, name_='param')
+ def hasContent_(self):
+ if (
+ self.param is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='templateparamlistType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('param=[\n')
+ level += 1
+ for param in self.param:
+ showIndent(outfile, level)
+ outfile.write('model_.param(\n')
+ param.exportLiteral(outfile, level, name_='param')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'param':
+ obj_ = paramType.factory()
+ obj_.build(child_)
+ self.param.append(obj_)
+# end class templateparamlistType
+
+
+class paramType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, type_=None, declname=None, defname=None, array=None, defval=None, briefdescription=None):
+ self.type_ = type_
+ self.declname = declname
+ self.defname = defname
+ self.array = array
+ self.defval = defval
+ self.briefdescription = briefdescription
+ def factory(*args_, **kwargs_):
+ if paramType.subclass:
+ return paramType.subclass(*args_, **kwargs_)
+ else:
+ return paramType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_type(self): return self.type_
+ def set_type(self, type_): self.type_ = type_
+ def get_declname(self): return self.declname
+ def set_declname(self, declname): self.declname = declname
+ def get_defname(self): return self.defname
+ def set_defname(self, defname): self.defname = defname
+ def get_array(self): return self.array
+ def set_array(self, array): self.array = array
+ def get_defval(self): return self.defval
+ def set_defval(self, defval): self.defval = defval
+ def get_briefdescription(self): return self.briefdescription
+ def set_briefdescription(self, briefdescription): self.briefdescription = briefdescription
+ def export(self, outfile, level, namespace_='', name_='paramType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='paramType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='paramType'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='paramType'):
+ if self.type_:
+ self.type_.export(outfile, level, namespace_, name_='type')
+ if self.declname is not None:
+ showIndent(outfile, level)
+ outfile.write('<%sdeclname>%s</%sdeclname>\n' % (namespace_, self.format_string(quote_xml(self.declname).encode(ExternalEncoding), input_name='declname'), namespace_))
+ if self.defname is not None:
+ showIndent(outfile, level)
+ outfile.write('<%sdefname>%s</%sdefname>\n' % (namespace_, self.format_string(quote_xml(self.defname).encode(ExternalEncoding), input_name='defname'), namespace_))
+ if self.array is not None:
+ showIndent(outfile, level)
+ outfile.write('<%sarray>%s</%sarray>\n' % (namespace_, self.format_string(quote_xml(self.array).encode(ExternalEncoding), input_name='array'), namespace_))
+ if self.defval:
+ self.defval.export(outfile, level, namespace_, name_='defval')
+ if self.briefdescription:
+ self.briefdescription.export(outfile, level, namespace_, name_='briefdescription')
+ def hasContent_(self):
+ if (
+ self.type_ is not None or
+ self.declname is not None or
+ self.defname is not None or
+ self.array is not None or
+ self.defval is not None or
+ self.briefdescription is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='paramType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ if self.type_:
+ showIndent(outfile, level)
+ outfile.write('type_=model_.linkedTextType(\n')
+ self.type_.exportLiteral(outfile, level, name_='type')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ showIndent(outfile, level)
+ outfile.write('declname=%s,\n' % quote_python(self.declname).encode(ExternalEncoding))
+ showIndent(outfile, level)
+ outfile.write('defname=%s,\n' % quote_python(self.defname).encode(ExternalEncoding))
+ showIndent(outfile, level)
+ outfile.write('array=%s,\n' % quote_python(self.array).encode(ExternalEncoding))
+ if self.defval:
+ showIndent(outfile, level)
+ outfile.write('defval=model_.linkedTextType(\n')
+ self.defval.exportLiteral(outfile, level, name_='defval')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ if self.briefdescription:
+ showIndent(outfile, level)
+ outfile.write('briefdescription=model_.descriptionType(\n')
+ self.briefdescription.exportLiteral(outfile, level, name_='briefdescription')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'type':
+ obj_ = linkedTextType.factory()
+ obj_.build(child_)
+ self.set_type(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'declname':
+ declname_ = ''
+ for text__content_ in child_.childNodes:
+ declname_ += text__content_.nodeValue
+ self.declname = declname_
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'defname':
+ defname_ = ''
+ for text__content_ in child_.childNodes:
+ defname_ += text__content_.nodeValue
+ self.defname = defname_
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'array':
+ array_ = ''
+ for text__content_ in child_.childNodes:
+ array_ += text__content_.nodeValue
+ self.array = array_
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'defval':
+ obj_ = linkedTextType.factory()
+ obj_.build(child_)
+ self.set_defval(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'briefdescription':
+ obj_ = descriptionType.factory()
+ obj_.build(child_)
+ self.set_briefdescription(obj_)
+# end class paramType
+
+
+class declname(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, valueOf_=''):
+ self.valueOf_ = valueOf_
+ def factory(*args_, **kwargs_):
+ if declname.subclass:
+ return declname.subclass(*args_, **kwargs_)
+ else:
+ return declname(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='declname', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='declname')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='declname'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='declname'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='declname'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class declname
+
+
+class defname(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, valueOf_=''):
+ self.valueOf_ = valueOf_
+ def factory(*args_, **kwargs_):
+ if defname.subclass:
+ return defname.subclass(*args_, **kwargs_)
+ else:
+ return defname(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='defname', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='defname')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='defname'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='defname'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='defname'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class defname
+
+
+class array(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, valueOf_=''):
+ self.valueOf_ = valueOf_
+ def factory(*args_, **kwargs_):
+ if array.subclass:
+ return array.subclass(*args_, **kwargs_)
+ else:
+ return array(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='array', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='array')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='array'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='array'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='array'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class array
+
+
+class linkedTextType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, ref=None, mixedclass_=None, content_=None):
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if linkedTextType.subclass:
+ return linkedTextType.subclass(*args_, **kwargs_)
+ else:
+ return linkedTextType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_ref(self): return self.ref
+ def set_ref(self, ref): self.ref = ref
+ def add_ref(self, value): self.ref.append(value)
+ def insert_ref(self, index, value): self.ref[index] = value
+ def export(self, outfile, level, namespace_='', name_='linkedTextType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='linkedTextType')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='linkedTextType'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='linkedTextType'):
+ for item_ in self.content_:
+ item_.export(outfile, level, item_.name, namespace_)
+ def hasContent_(self):
+ if (
+ self.ref is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='linkedTextType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'ref':
+ childobj_ = docRefTextType.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'ref', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+# end class linkedTextType
+
+
+class graphType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, node=None):
+ if node is None:
+ self.node = []
+ else:
+ self.node = node
+ def factory(*args_, **kwargs_):
+ if graphType.subclass:
+ return graphType.subclass(*args_, **kwargs_)
+ else:
+ return graphType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_node(self): return self.node
+ def set_node(self, node): self.node = node
+ def add_node(self, value): self.node.append(value)
+ def insert_node(self, index, value): self.node[index] = value
+ def export(self, outfile, level, namespace_='', name_='graphType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='graphType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='graphType'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='graphType'):
+ for node_ in self.node:
+ node_.export(outfile, level, namespace_, name_='node')
+ def hasContent_(self):
+ if (
+ self.node is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='graphType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('node=[\n')
+ level += 1
+ for node in self.node:
+ showIndent(outfile, level)
+ outfile.write('model_.node(\n')
+ node.exportLiteral(outfile, level, name_='node')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'node':
+ obj_ = nodeType.factory()
+ obj_.build(child_)
+ self.node.append(obj_)
+# end class graphType
+
+
+class nodeType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, id=None, label=None, link=None, childnode=None):
+ self.id = id
+ self.label = label
+ self.link = link
+ if childnode is None:
+ self.childnode = []
+ else:
+ self.childnode = childnode
+ def factory(*args_, **kwargs_):
+ if nodeType.subclass:
+ return nodeType.subclass(*args_, **kwargs_)
+ else:
+ return nodeType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_label(self): return self.label
+ def set_label(self, label): self.label = label
+ def get_link(self): return self.link
+ def set_link(self, link): self.link = link
+ def get_childnode(self): return self.childnode
+ def set_childnode(self, childnode): self.childnode = childnode
+ def add_childnode(self, value): self.childnode.append(value)
+ def insert_childnode(self, index, value): self.childnode[index] = value
+ def get_id(self): return self.id
+ def set_id(self, id): self.id = id
+ def export(self, outfile, level, namespace_='', name_='nodeType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='nodeType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='nodeType'):
+ if self.id is not None:
+ outfile.write(' id=%s' % (self.format_string(quote_attrib(self.id).encode(ExternalEncoding), input_name='id'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='nodeType'):
+ if self.label is not None:
+ showIndent(outfile, level)
+ outfile.write('<%slabel>%s</%slabel>\n' % (namespace_, self.format_string(quote_xml(self.label).encode(ExternalEncoding), input_name='label'), namespace_))
+ if self.link:
+ self.link.export(outfile, level, namespace_, name_='link')
+ for childnode_ in self.childnode:
+ childnode_.export(outfile, level, namespace_, name_='childnode')
+ def hasContent_(self):
+ if (
+ self.label is not None or
+ self.link is not None or
+ self.childnode is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='nodeType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.id is not None:
+ showIndent(outfile, level)
+ outfile.write('id = %s,\n' % (self.id,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('label=%s,\n' % quote_python(self.label).encode(ExternalEncoding))
+ if self.link:
+ showIndent(outfile, level)
+ outfile.write('link=model_.linkType(\n')
+ self.link.exportLiteral(outfile, level, name_='link')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ showIndent(outfile, level)
+ outfile.write('childnode=[\n')
+ level += 1
+ for childnode in self.childnode:
+ showIndent(outfile, level)
+ outfile.write('model_.childnode(\n')
+ childnode.exportLiteral(outfile, level, name_='childnode')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('id'):
+ self.id = attrs.get('id').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'label':
+ label_ = ''
+ for text__content_ in child_.childNodes:
+ label_ += text__content_.nodeValue
+ self.label = label_
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'link':
+ obj_ = linkType.factory()
+ obj_.build(child_)
+ self.set_link(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'childnode':
+ obj_ = childnodeType.factory()
+ obj_.build(child_)
+ self.childnode.append(obj_)
+# end class nodeType
+
+
+class label(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, valueOf_=''):
+ self.valueOf_ = valueOf_
+ def factory(*args_, **kwargs_):
+ if label.subclass:
+ return label.subclass(*args_, **kwargs_)
+ else:
+ return label(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='label', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='label')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='label'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='label'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='label'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class label
+
+
+class childnodeType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, relation=None, refid=None, edgelabel=None):
+ self.relation = relation
+ self.refid = refid
+ if edgelabel is None:
+ self.edgelabel = []
+ else:
+ self.edgelabel = edgelabel
+ def factory(*args_, **kwargs_):
+ if childnodeType.subclass:
+ return childnodeType.subclass(*args_, **kwargs_)
+ else:
+ return childnodeType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_edgelabel(self): return self.edgelabel
+ def set_edgelabel(self, edgelabel): self.edgelabel = edgelabel
+ def add_edgelabel(self, value): self.edgelabel.append(value)
+ def insert_edgelabel(self, index, value): self.edgelabel[index] = value
+ def get_relation(self): return self.relation
+ def set_relation(self, relation): self.relation = relation
+ def get_refid(self): return self.refid
+ def set_refid(self, refid): self.refid = refid
+ def export(self, outfile, level, namespace_='', name_='childnodeType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='childnodeType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='childnodeType'):
+ if self.relation is not None:
+ outfile.write(' relation=%s' % (quote_attrib(self.relation), ))
+ if self.refid is not None:
+ outfile.write(' refid=%s' % (self.format_string(quote_attrib(self.refid).encode(ExternalEncoding), input_name='refid'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='childnodeType'):
+ for edgelabel_ in self.edgelabel:
+ showIndent(outfile, level)
+ outfile.write('<%sedgelabel>%s</%sedgelabel>\n' % (namespace_, self.format_string(quote_xml(edgelabel_).encode(ExternalEncoding), input_name='edgelabel'), namespace_))
+ def hasContent_(self):
+ if (
+ self.edgelabel is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='childnodeType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.relation is not None:
+ showIndent(outfile, level)
+ outfile.write('relation = "%s",\n' % (self.relation,))
+ if self.refid is not None:
+ showIndent(outfile, level)
+ outfile.write('refid = %s,\n' % (self.refid,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('edgelabel=[\n')
+ level += 1
+ for edgelabel in self.edgelabel:
+ showIndent(outfile, level)
+ outfile.write('%s,\n' % quote_python(edgelabel).encode(ExternalEncoding))
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('relation'):
+ self.relation = attrs.get('relation').value
+ if attrs.get('refid'):
+ self.refid = attrs.get('refid').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'edgelabel':
+ edgelabel_ = ''
+ for text__content_ in child_.childNodes:
+ edgelabel_ += text__content_.nodeValue
+ self.edgelabel.append(edgelabel_)
+# end class childnodeType
+
+
+class edgelabel(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, valueOf_=''):
+ self.valueOf_ = valueOf_
+ def factory(*args_, **kwargs_):
+ if edgelabel.subclass:
+ return edgelabel.subclass(*args_, **kwargs_)
+ else:
+ return edgelabel(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='edgelabel', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='edgelabel')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='edgelabel'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='edgelabel'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='edgelabel'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class edgelabel
+
+
+class linkType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, refid=None, external=None, valueOf_=''):
+ self.refid = refid
+ self.external = external
+ self.valueOf_ = valueOf_
+ def factory(*args_, **kwargs_):
+ if linkType.subclass:
+ return linkType.subclass(*args_, **kwargs_)
+ else:
+ return linkType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_refid(self): return self.refid
+ def set_refid(self, refid): self.refid = refid
+ def get_external(self): return self.external
+ def set_external(self, external): self.external = external
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='linkType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='linkType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='linkType'):
+ if self.refid is not None:
+ outfile.write(' refid=%s' % (self.format_string(quote_attrib(self.refid).encode(ExternalEncoding), input_name='refid'), ))
+ if self.external is not None:
+ outfile.write(' external=%s' % (self.format_string(quote_attrib(self.external).encode(ExternalEncoding), input_name='external'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='linkType'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='linkType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.refid is not None:
+ showIndent(outfile, level)
+ outfile.write('refid = %s,\n' % (self.refid,))
+ if self.external is not None:
+ showIndent(outfile, level)
+ outfile.write('external = %s,\n' % (self.external,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('refid'):
+ self.refid = attrs.get('refid').value
+ if attrs.get('external'):
+ self.external = attrs.get('external').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class linkType
+
+
+class listingType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, codeline=None):
+ if codeline is None:
+ self.codeline = []
+ else:
+ self.codeline = codeline
+ def factory(*args_, **kwargs_):
+ if listingType.subclass:
+ return listingType.subclass(*args_, **kwargs_)
+ else:
+ return listingType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_codeline(self): return self.codeline
+ def set_codeline(self, codeline): self.codeline = codeline
+ def add_codeline(self, value): self.codeline.append(value)
+ def insert_codeline(self, index, value): self.codeline[index] = value
+ def export(self, outfile, level, namespace_='', name_='listingType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='listingType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='listingType'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='listingType'):
+ for codeline_ in self.codeline:
+ codeline_.export(outfile, level, namespace_, name_='codeline')
+ def hasContent_(self):
+ if (
+ self.codeline is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='listingType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('codeline=[\n')
+ level += 1
+ for codeline in self.codeline:
+ showIndent(outfile, level)
+ outfile.write('model_.codeline(\n')
+ codeline.exportLiteral(outfile, level, name_='codeline')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'codeline':
+ obj_ = codelineType.factory()
+ obj_.build(child_)
+ self.codeline.append(obj_)
+# end class listingType
+
+
+class codelineType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, external=None, lineno=None, refkind=None, refid=None, highlight=None):
+ self.external = external
+ self.lineno = lineno
+ self.refkind = refkind
+ self.refid = refid
+ if highlight is None:
+ self.highlight = []
+ else:
+ self.highlight = highlight
+ def factory(*args_, **kwargs_):
+ if codelineType.subclass:
+ return codelineType.subclass(*args_, **kwargs_)
+ else:
+ return codelineType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_highlight(self): return self.highlight
+ def set_highlight(self, highlight): self.highlight = highlight
+ def add_highlight(self, value): self.highlight.append(value)
+ def insert_highlight(self, index, value): self.highlight[index] = value
+ def get_external(self): return self.external
+ def set_external(self, external): self.external = external
+ def get_lineno(self): return self.lineno
+ def set_lineno(self, lineno): self.lineno = lineno
+ def get_refkind(self): return self.refkind
+ def set_refkind(self, refkind): self.refkind = refkind
+ def get_refid(self): return self.refid
+ def set_refid(self, refid): self.refid = refid
+ def export(self, outfile, level, namespace_='', name_='codelineType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='codelineType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='codelineType'):
+ if self.external is not None:
+ outfile.write(' external=%s' % (quote_attrib(self.external), ))
+ if self.lineno is not None:
+ outfile.write(' lineno="%s"' % self.format_integer(self.lineno, input_name='lineno'))
+ if self.refkind is not None:
+ outfile.write(' refkind=%s' % (quote_attrib(self.refkind), ))
+ if self.refid is not None:
+ outfile.write(' refid=%s' % (self.format_string(quote_attrib(self.refid).encode(ExternalEncoding), input_name='refid'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='codelineType'):
+ for highlight_ in self.highlight:
+ highlight_.export(outfile, level, namespace_, name_='highlight')
+ def hasContent_(self):
+ if (
+ self.highlight is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='codelineType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.external is not None:
+ showIndent(outfile, level)
+ outfile.write('external = "%s",\n' % (self.external,))
+ if self.lineno is not None:
+ showIndent(outfile, level)
+ outfile.write('lineno = %s,\n' % (self.lineno,))
+ if self.refkind is not None:
+ showIndent(outfile, level)
+ outfile.write('refkind = "%s",\n' % (self.refkind,))
+ if self.refid is not None:
+ showIndent(outfile, level)
+ outfile.write('refid = %s,\n' % (self.refid,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('highlight=[\n')
+ level += 1
+ for highlight in self.highlight:
+ showIndent(outfile, level)
+ outfile.write('model_.highlight(\n')
+ highlight.exportLiteral(outfile, level, name_='highlight')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('external'):
+ self.external = attrs.get('external').value
+ if attrs.get('lineno'):
+ try:
+ self.lineno = int(attrs.get('lineno').value)
+ except ValueError, exp:
+ raise ValueError('Bad integer attribute (lineno): %s' % exp)
+ if attrs.get('refkind'):
+ self.refkind = attrs.get('refkind').value
+ if attrs.get('refid'):
+ self.refid = attrs.get('refid').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'highlight':
+ obj_ = highlightType.factory()
+ obj_.build(child_)
+ self.highlight.append(obj_)
+# end class codelineType
+
+
+class highlightType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, classxx=None, sp=None, ref=None, mixedclass_=None, content_=None):
+ self.classxx = classxx
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if highlightType.subclass:
+ return highlightType.subclass(*args_, **kwargs_)
+ else:
+ return highlightType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_sp(self): return self.sp
+ def set_sp(self, sp): self.sp = sp
+ def add_sp(self, value): self.sp.append(value)
+ def insert_sp(self, index, value): self.sp[index] = value
+ def get_ref(self): return self.ref
+ def set_ref(self, ref): self.ref = ref
+ def add_ref(self, value): self.ref.append(value)
+ def insert_ref(self, index, value): self.ref[index] = value
+ def get_class(self): return self.classxx
+ def set_class(self, classxx): self.classxx = classxx
+ def export(self, outfile, level, namespace_='', name_='highlightType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='highlightType')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='highlightType'):
+ if self.classxx is not None:
+ outfile.write(' class=%s' % (quote_attrib(self.classxx), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='highlightType'):
+ for item_ in self.content_:
+ item_.export(outfile, level, item_.name, namespace_)
+ def hasContent_(self):
+ if (
+ self.sp is not None or
+ self.ref is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='highlightType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.classxx is not None:
+ showIndent(outfile, level)
+ outfile.write('classxx = "%s",\n' % (self.classxx,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('class'):
+ self.classxx = attrs.get('class').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'sp':
+ value_ = []
+ for text_ in child_.childNodes:
+ value_.append(text_.nodeValue)
+ valuestr_ = ''.join(value_)
+ obj_ = self.mixedclass_(MixedContainer.CategorySimple,
+ MixedContainer.TypeString, 'sp', valuestr_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'ref':
+ childobj_ = docRefTextType.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'ref', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+# end class highlightType
+
+
+class sp(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, valueOf_=''):
+ self.valueOf_ = valueOf_
+ def factory(*args_, **kwargs_):
+ if sp.subclass:
+ return sp.subclass(*args_, **kwargs_)
+ else:
+ return sp(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='sp', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='sp')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='sp'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='sp'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='sp'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class sp
+
+
+class referenceType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, endline=None, startline=None, refid=None, compoundref=None, valueOf_='', mixedclass_=None, content_=None):
+ self.endline = endline
+ self.startline = startline
+ self.refid = refid
+ self.compoundref = compoundref
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if referenceType.subclass:
+ return referenceType.subclass(*args_, **kwargs_)
+ else:
+ return referenceType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_endline(self): return self.endline
+ def set_endline(self, endline): self.endline = endline
+ def get_startline(self): return self.startline
+ def set_startline(self, startline): self.startline = startline
+ def get_refid(self): return self.refid
+ def set_refid(self, refid): self.refid = refid
+ def get_compoundref(self): return self.compoundref
+ def set_compoundref(self, compoundref): self.compoundref = compoundref
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='referenceType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='referenceType')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='referenceType'):
+ if self.endline is not None:
+ outfile.write(' endline="%s"' % self.format_integer(self.endline, input_name='endline'))
+ if self.startline is not None:
+ outfile.write(' startline="%s"' % self.format_integer(self.startline, input_name='startline'))
+ if self.refid is not None:
+ outfile.write(' refid=%s' % (self.format_string(quote_attrib(self.refid).encode(ExternalEncoding), input_name='refid'), ))
+ if self.compoundref is not None:
+ outfile.write(' compoundref=%s' % (self.format_string(quote_attrib(self.compoundref).encode(ExternalEncoding), input_name='compoundref'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='referenceType'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='referenceType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.endline is not None:
+ showIndent(outfile, level)
+ outfile.write('endline = %s,\n' % (self.endline,))
+ if self.startline is not None:
+ showIndent(outfile, level)
+ outfile.write('startline = %s,\n' % (self.startline,))
+ if self.refid is not None:
+ showIndent(outfile, level)
+ outfile.write('refid = %s,\n' % (self.refid,))
+ if self.compoundref is not None:
+ showIndent(outfile, level)
+ outfile.write('compoundref = %s,\n' % (self.compoundref,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('endline'):
+ try:
+ self.endline = int(attrs.get('endline').value)
+ except ValueError, exp:
+ raise ValueError('Bad integer attribute (endline): %s' % exp)
+ if attrs.get('startline'):
+ try:
+ self.startline = int(attrs.get('startline').value)
+ except ValueError, exp:
+ raise ValueError('Bad integer attribute (startline): %s' % exp)
+ if attrs.get('refid'):
+ self.refid = attrs.get('refid').value
+ if attrs.get('compoundref'):
+ self.compoundref = attrs.get('compoundref').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class referenceType
+
+
+class locationType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, bodystart=None, line=None, bodyend=None, bodyfile=None, file=None, valueOf_=''):
+ self.bodystart = bodystart
+ self.line = line
+ self.bodyend = bodyend
+ self.bodyfile = bodyfile
+ self.file = file
+ self.valueOf_ = valueOf_
+ def factory(*args_, **kwargs_):
+ if locationType.subclass:
+ return locationType.subclass(*args_, **kwargs_)
+ else:
+ return locationType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_bodystart(self): return self.bodystart
+ def set_bodystart(self, bodystart): self.bodystart = bodystart
+ def get_line(self): return self.line
+ def set_line(self, line): self.line = line
+ def get_bodyend(self): return self.bodyend
+ def set_bodyend(self, bodyend): self.bodyend = bodyend
+ def get_bodyfile(self): return self.bodyfile
+ def set_bodyfile(self, bodyfile): self.bodyfile = bodyfile
+ def get_file(self): return self.file
+ def set_file(self, file): self.file = file
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='locationType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='locationType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='locationType'):
+ if self.bodystart is not None:
+ outfile.write(' bodystart="%s"' % self.format_integer(self.bodystart, input_name='bodystart'))
+ if self.line is not None:
+ outfile.write(' line="%s"' % self.format_integer(self.line, input_name='line'))
+ if self.bodyend is not None:
+ outfile.write(' bodyend="%s"' % self.format_integer(self.bodyend, input_name='bodyend'))
+ if self.bodyfile is not None:
+ outfile.write(' bodyfile=%s' % (self.format_string(quote_attrib(self.bodyfile).encode(ExternalEncoding), input_name='bodyfile'), ))
+ if self.file is not None:
+ outfile.write(' file=%s' % (self.format_string(quote_attrib(self.file).encode(ExternalEncoding), input_name='file'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='locationType'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='locationType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.bodystart is not None:
+ showIndent(outfile, level)
+ outfile.write('bodystart = %s,\n' % (self.bodystart,))
+ if self.line is not None:
+ showIndent(outfile, level)
+ outfile.write('line = %s,\n' % (self.line,))
+ if self.bodyend is not None:
+ showIndent(outfile, level)
+ outfile.write('bodyend = %s,\n' % (self.bodyend,))
+ if self.bodyfile is not None:
+ showIndent(outfile, level)
+ outfile.write('bodyfile = %s,\n' % (self.bodyfile,))
+ if self.file is not None:
+ showIndent(outfile, level)
+ outfile.write('file = %s,\n' % (self.file,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('bodystart'):
+ try:
+ self.bodystart = int(attrs.get('bodystart').value)
+ except ValueError, exp:
+ raise ValueError('Bad integer attribute (bodystart): %s' % exp)
+ if attrs.get('line'):
+ try:
+ self.line = int(attrs.get('line').value)
+ except ValueError, exp:
+ raise ValueError('Bad integer attribute (line): %s' % exp)
+ if attrs.get('bodyend'):
+ try:
+ self.bodyend = int(attrs.get('bodyend').value)
+ except ValueError, exp:
+ raise ValueError('Bad integer attribute (bodyend): %s' % exp)
+ if attrs.get('bodyfile'):
+ self.bodyfile = attrs.get('bodyfile').value
+ if attrs.get('file'):
+ self.file = attrs.get('file').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class locationType
+
+
+class docSect1Type(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, id=None, title=None, para=None, sect2=None, internal=None, mixedclass_=None, content_=None):
+ self.id = id
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if docSect1Type.subclass:
+ return docSect1Type.subclass(*args_, **kwargs_)
+ else:
+ return docSect1Type(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_title(self): return self.title
+ def set_title(self, title): self.title = title
+ def get_para(self): return self.para
+ def set_para(self, para): self.para = para
+ def add_para(self, value): self.para.append(value)
+ def insert_para(self, index, value): self.para[index] = value
+ def get_sect2(self): return self.sect2
+ def set_sect2(self, sect2): self.sect2 = sect2
+ def add_sect2(self, value): self.sect2.append(value)
+ def insert_sect2(self, index, value): self.sect2[index] = value
+ def get_internal(self): return self.internal
+ def set_internal(self, internal): self.internal = internal
+ def get_id(self): return self.id
+ def set_id(self, id): self.id = id
+ def export(self, outfile, level, namespace_='', name_='docSect1Type', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docSect1Type')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='docSect1Type'):
+ if self.id is not None:
+ outfile.write(' id=%s' % (self.format_string(quote_attrib(self.id).encode(ExternalEncoding), input_name='id'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='docSect1Type'):
+ for item_ in self.content_:
+ item_.export(outfile, level, item_.name, namespace_)
+ def hasContent_(self):
+ if (
+ self.title is not None or
+ self.para is not None or
+ self.sect2 is not None or
+ self.internal is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docSect1Type'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.id is not None:
+ showIndent(outfile, level)
+ outfile.write('id = %s,\n' % (self.id,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('id'):
+ self.id = attrs.get('id').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'title':
+ childobj_ = docTitleType.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'title', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'para':
+ childobj_ = docParaType.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'para', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'sect2':
+ childobj_ = docSect2Type.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'sect2', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'internal':
+ childobj_ = docInternalS1Type.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'internal', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+# end class docSect1Type
+
+
+class docSect2Type(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, id=None, title=None, para=None, sect3=None, internal=None, mixedclass_=None, content_=None):
+ self.id = id
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if docSect2Type.subclass:
+ return docSect2Type.subclass(*args_, **kwargs_)
+ else:
+ return docSect2Type(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_title(self): return self.title
+ def set_title(self, title): self.title = title
+ def get_para(self): return self.para
+ def set_para(self, para): self.para = para
+ def add_para(self, value): self.para.append(value)
+ def insert_para(self, index, value): self.para[index] = value
+ def get_sect3(self): return self.sect3
+ def set_sect3(self, sect3): self.sect3 = sect3
+ def add_sect3(self, value): self.sect3.append(value)
+ def insert_sect3(self, index, value): self.sect3[index] = value
+ def get_internal(self): return self.internal
+ def set_internal(self, internal): self.internal = internal
+ def get_id(self): return self.id
+ def set_id(self, id): self.id = id
+ def export(self, outfile, level, namespace_='', name_='docSect2Type', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docSect2Type')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='docSect2Type'):
+ if self.id is not None:
+ outfile.write(' id=%s' % (self.format_string(quote_attrib(self.id).encode(ExternalEncoding), input_name='id'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='docSect2Type'):
+ for item_ in self.content_:
+ item_.export(outfile, level, item_.name, namespace_)
+ def hasContent_(self):
+ if (
+ self.title is not None or
+ self.para is not None or
+ self.sect3 is not None or
+ self.internal is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docSect2Type'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.id is not None:
+ showIndent(outfile, level)
+ outfile.write('id = %s,\n' % (self.id,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('id'):
+ self.id = attrs.get('id').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'title':
+ childobj_ = docTitleType.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'title', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'para':
+ childobj_ = docParaType.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'para', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'sect3':
+ childobj_ = docSect3Type.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'sect3', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'internal':
+ childobj_ = docInternalS2Type.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'internal', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+# end class docSect2Type
+
+
+class docSect3Type(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, id=None, title=None, para=None, sect4=None, internal=None, mixedclass_=None, content_=None):
+ self.id = id
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if docSect3Type.subclass:
+ return docSect3Type.subclass(*args_, **kwargs_)
+ else:
+ return docSect3Type(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_title(self): return self.title
+ def set_title(self, title): self.title = title
+ def get_para(self): return self.para
+ def set_para(self, para): self.para = para
+ def add_para(self, value): self.para.append(value)
+ def insert_para(self, index, value): self.para[index] = value
+ def get_sect4(self): return self.sect4
+ def set_sect4(self, sect4): self.sect4 = sect4
+ def add_sect4(self, value): self.sect4.append(value)
+ def insert_sect4(self, index, value): self.sect4[index] = value
+ def get_internal(self): return self.internal
+ def set_internal(self, internal): self.internal = internal
+ def get_id(self): return self.id
+ def set_id(self, id): self.id = id
+ def export(self, outfile, level, namespace_='', name_='docSect3Type', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docSect3Type')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='docSect3Type'):
+ if self.id is not None:
+ outfile.write(' id=%s' % (self.format_string(quote_attrib(self.id).encode(ExternalEncoding), input_name='id'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='docSect3Type'):
+ for item_ in self.content_:
+ item_.export(outfile, level, item_.name, namespace_)
+ def hasContent_(self):
+ if (
+ self.title is not None or
+ self.para is not None or
+ self.sect4 is not None or
+ self.internal is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docSect3Type'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.id is not None:
+ showIndent(outfile, level)
+ outfile.write('id = %s,\n' % (self.id,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('id'):
+ self.id = attrs.get('id').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'title':
+ childobj_ = docTitleType.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'title', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'para':
+ childobj_ = docParaType.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'para', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'sect4':
+ childobj_ = docSect4Type.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'sect4', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'internal':
+ childobj_ = docInternalS3Type.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'internal', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+# end class docSect3Type
+
+
+class docSect4Type(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, id=None, title=None, para=None, internal=None, mixedclass_=None, content_=None):
+ self.id = id
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if docSect4Type.subclass:
+ return docSect4Type.subclass(*args_, **kwargs_)
+ else:
+ return docSect4Type(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_title(self): return self.title
+ def set_title(self, title): self.title = title
+ def get_para(self): return self.para
+ def set_para(self, para): self.para = para
+ def add_para(self, value): self.para.append(value)
+ def insert_para(self, index, value): self.para[index] = value
+ def get_internal(self): return self.internal
+ def set_internal(self, internal): self.internal = internal
+ def get_id(self): return self.id
+ def set_id(self, id): self.id = id
+ def export(self, outfile, level, namespace_='', name_='docSect4Type', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docSect4Type')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='docSect4Type'):
+ if self.id is not None:
+ outfile.write(' id=%s' % (self.format_string(quote_attrib(self.id).encode(ExternalEncoding), input_name='id'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='docSect4Type'):
+ for item_ in self.content_:
+ item_.export(outfile, level, item_.name, namespace_)
+ def hasContent_(self):
+ if (
+ self.title is not None or
+ self.para is not None or
+ self.internal is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docSect4Type'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.id is not None:
+ showIndent(outfile, level)
+ outfile.write('id = %s,\n' % (self.id,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('id'):
+ self.id = attrs.get('id').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'title':
+ childobj_ = docTitleType.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'title', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'para':
+ childobj_ = docParaType.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'para', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'internal':
+ childobj_ = docInternalS4Type.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'internal', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+# end class docSect4Type
+
+
+class docInternalType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, para=None, sect1=None, mixedclass_=None, content_=None):
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if docInternalType.subclass:
+ return docInternalType.subclass(*args_, **kwargs_)
+ else:
+ return docInternalType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_para(self): return self.para
+ def set_para(self, para): self.para = para
+ def add_para(self, value): self.para.append(value)
+ def insert_para(self, index, value): self.para[index] = value
+ def get_sect1(self): return self.sect1
+ def set_sect1(self, sect1): self.sect1 = sect1
+ def add_sect1(self, value): self.sect1.append(value)
+ def insert_sect1(self, index, value): self.sect1[index] = value
+ def export(self, outfile, level, namespace_='', name_='docInternalType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docInternalType')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='docInternalType'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='docInternalType'):
+ for item_ in self.content_:
+ item_.export(outfile, level, item_.name, namespace_)
+ def hasContent_(self):
+ if (
+ self.para is not None or
+ self.sect1 is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docInternalType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'para':
+ childobj_ = docParaType.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'para', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'sect1':
+ childobj_ = docSect1Type.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'sect1', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+# end class docInternalType
+
+
+class docInternalS1Type(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, para=None, sect2=None, mixedclass_=None, content_=None):
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if docInternalS1Type.subclass:
+ return docInternalS1Type.subclass(*args_, **kwargs_)
+ else:
+ return docInternalS1Type(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_para(self): return self.para
+ def set_para(self, para): self.para = para
+ def add_para(self, value): self.para.append(value)
+ def insert_para(self, index, value): self.para[index] = value
+ def get_sect2(self): return self.sect2
+ def set_sect2(self, sect2): self.sect2 = sect2
+ def add_sect2(self, value): self.sect2.append(value)
+ def insert_sect2(self, index, value): self.sect2[index] = value
+ def export(self, outfile, level, namespace_='', name_='docInternalS1Type', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docInternalS1Type')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='docInternalS1Type'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='docInternalS1Type'):
+ for item_ in self.content_:
+ item_.export(outfile, level, item_.name, namespace_)
+ def hasContent_(self):
+ if (
+ self.para is not None or
+ self.sect2 is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docInternalS1Type'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'para':
+ childobj_ = docParaType.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'para', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'sect2':
+ childobj_ = docSect2Type.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'sect2', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+# end class docInternalS1Type
+
+
+class docInternalS2Type(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, para=None, sect3=None, mixedclass_=None, content_=None):
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if docInternalS2Type.subclass:
+ return docInternalS2Type.subclass(*args_, **kwargs_)
+ else:
+ return docInternalS2Type(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_para(self): return self.para
+ def set_para(self, para): self.para = para
+ def add_para(self, value): self.para.append(value)
+ def insert_para(self, index, value): self.para[index] = value
+ def get_sect3(self): return self.sect3
+ def set_sect3(self, sect3): self.sect3 = sect3
+ def add_sect3(self, value): self.sect3.append(value)
+ def insert_sect3(self, index, value): self.sect3[index] = value
+ def export(self, outfile, level, namespace_='', name_='docInternalS2Type', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docInternalS2Type')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='docInternalS2Type'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='docInternalS2Type'):
+ for item_ in self.content_:
+ item_.export(outfile, level, item_.name, namespace_)
+ def hasContent_(self):
+ if (
+ self.para is not None or
+ self.sect3 is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docInternalS2Type'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'para':
+ childobj_ = docParaType.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'para', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'sect3':
+ childobj_ = docSect3Type.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'sect3', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+# end class docInternalS2Type
+
+
+class docInternalS3Type(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, para=None, sect3=None, mixedclass_=None, content_=None):
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if docInternalS3Type.subclass:
+ return docInternalS3Type.subclass(*args_, **kwargs_)
+ else:
+ return docInternalS3Type(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_para(self): return self.para
+ def set_para(self, para): self.para = para
+ def add_para(self, value): self.para.append(value)
+ def insert_para(self, index, value): self.para[index] = value
+ def get_sect3(self): return self.sect3
+ def set_sect3(self, sect3): self.sect3 = sect3
+ def add_sect3(self, value): self.sect3.append(value)
+ def insert_sect3(self, index, value): self.sect3[index] = value
+ def export(self, outfile, level, namespace_='', name_='docInternalS3Type', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docInternalS3Type')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='docInternalS3Type'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='docInternalS3Type'):
+ for item_ in self.content_:
+ item_.export(outfile, level, item_.name, namespace_)
+ def hasContent_(self):
+ if (
+ self.para is not None or
+ self.sect3 is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docInternalS3Type'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'para':
+ childobj_ = docParaType.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'para', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'sect3':
+ childobj_ = docSect4Type.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'sect3', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+# end class docInternalS3Type
+
+
+class docInternalS4Type(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, para=None, mixedclass_=None, content_=None):
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if docInternalS4Type.subclass:
+ return docInternalS4Type.subclass(*args_, **kwargs_)
+ else:
+ return docInternalS4Type(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_para(self): return self.para
+ def set_para(self, para): self.para = para
+ def add_para(self, value): self.para.append(value)
+ def insert_para(self, index, value): self.para[index] = value
+ def export(self, outfile, level, namespace_='', name_='docInternalS4Type', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docInternalS4Type')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='docInternalS4Type'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='docInternalS4Type'):
+ for item_ in self.content_:
+ item_.export(outfile, level, item_.name, namespace_)
+ def hasContent_(self):
+ if (
+ self.para is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docInternalS4Type'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'para':
+ childobj_ = docParaType.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'para', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+# end class docInternalS4Type
+
+
+class docTitleType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, valueOf_='', mixedclass_=None, content_=None):
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if docTitleType.subclass:
+ return docTitleType.subclass(*args_, **kwargs_)
+ else:
+ return docTitleType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='docTitleType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docTitleType')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='docTitleType'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='docTitleType'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docTitleType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class docTitleType
+
+
+class docParaType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, valueOf_='', mixedclass_=None, content_=None):
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if docParaType.subclass:
+ return docParaType.subclass(*args_, **kwargs_)
+ else:
+ return docParaType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='docParaType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docParaType')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='docParaType'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='docParaType'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docParaType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class docParaType
+
+
+class docMarkupType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, valueOf_='', mixedclass_=None, content_=None):
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if docMarkupType.subclass:
+ return docMarkupType.subclass(*args_, **kwargs_)
+ else:
+ return docMarkupType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='docMarkupType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docMarkupType')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='docMarkupType'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='docMarkupType'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docMarkupType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class docMarkupType
+
+
+class docURLLink(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, url=None, valueOf_='', mixedclass_=None, content_=None):
+ self.url = url
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if docURLLink.subclass:
+ return docURLLink.subclass(*args_, **kwargs_)
+ else:
+ return docURLLink(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_url(self): return self.url
+ def set_url(self, url): self.url = url
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='docURLLink', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docURLLink')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='docURLLink'):
+ if self.url is not None:
+ outfile.write(' url=%s' % (self.format_string(quote_attrib(self.url).encode(ExternalEncoding), input_name='url'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='docURLLink'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docURLLink'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.url is not None:
+ showIndent(outfile, level)
+ outfile.write('url = %s,\n' % (self.url,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('url'):
+ self.url = attrs.get('url').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class docURLLink
+
+
+class docAnchorType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, id=None, valueOf_='', mixedclass_=None, content_=None):
+ self.id = id
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if docAnchorType.subclass:
+ return docAnchorType.subclass(*args_, **kwargs_)
+ else:
+ return docAnchorType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_id(self): return self.id
+ def set_id(self, id): self.id = id
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='docAnchorType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docAnchorType')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='docAnchorType'):
+ if self.id is not None:
+ outfile.write(' id=%s' % (self.format_string(quote_attrib(self.id).encode(ExternalEncoding), input_name='id'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='docAnchorType'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docAnchorType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.id is not None:
+ showIndent(outfile, level)
+ outfile.write('id = %s,\n' % (self.id,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('id'):
+ self.id = attrs.get('id').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class docAnchorType
+
+
+class docFormulaType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, id=None, valueOf_='', mixedclass_=None, content_=None):
+ self.id = id
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if docFormulaType.subclass:
+ return docFormulaType.subclass(*args_, **kwargs_)
+ else:
+ return docFormulaType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_id(self): return self.id
+ def set_id(self, id): self.id = id
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='docFormulaType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docFormulaType')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='docFormulaType'):
+ if self.id is not None:
+ outfile.write(' id=%s' % (self.format_string(quote_attrib(self.id).encode(ExternalEncoding), input_name='id'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='docFormulaType'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docFormulaType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.id is not None:
+ showIndent(outfile, level)
+ outfile.write('id = %s,\n' % (self.id,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('id'):
+ self.id = attrs.get('id').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class docFormulaType
+
+
+class docIndexEntryType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, primaryie=None, secondaryie=None):
+ self.primaryie = primaryie
+ self.secondaryie = secondaryie
+ def factory(*args_, **kwargs_):
+ if docIndexEntryType.subclass:
+ return docIndexEntryType.subclass(*args_, **kwargs_)
+ else:
+ return docIndexEntryType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_primaryie(self): return self.primaryie
+ def set_primaryie(self, primaryie): self.primaryie = primaryie
+ def get_secondaryie(self): return self.secondaryie
+ def set_secondaryie(self, secondaryie): self.secondaryie = secondaryie
+ def export(self, outfile, level, namespace_='', name_='docIndexEntryType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docIndexEntryType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='docIndexEntryType'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='docIndexEntryType'):
+ if self.primaryie is not None:
+ showIndent(outfile, level)
+ outfile.write('<%sprimaryie>%s</%sprimaryie>\n' % (namespace_, self.format_string(quote_xml(self.primaryie).encode(ExternalEncoding), input_name='primaryie'), namespace_))
+ if self.secondaryie is not None:
+ showIndent(outfile, level)
+ outfile.write('<%ssecondaryie>%s</%ssecondaryie>\n' % (namespace_, self.format_string(quote_xml(self.secondaryie).encode(ExternalEncoding), input_name='secondaryie'), namespace_))
+ def hasContent_(self):
+ if (
+ self.primaryie is not None or
+ self.secondaryie is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docIndexEntryType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('primaryie=%s,\n' % quote_python(self.primaryie).encode(ExternalEncoding))
+ showIndent(outfile, level)
+ outfile.write('secondaryie=%s,\n' % quote_python(self.secondaryie).encode(ExternalEncoding))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'primaryie':
+ primaryie_ = ''
+ for text__content_ in child_.childNodes:
+ primaryie_ += text__content_.nodeValue
+ self.primaryie = primaryie_
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'secondaryie':
+ secondaryie_ = ''
+ for text__content_ in child_.childNodes:
+ secondaryie_ += text__content_.nodeValue
+ self.secondaryie = secondaryie_
+# end class docIndexEntryType
+
+
+class docListType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, listitem=None):
+ if listitem is None:
+ self.listitem = []
+ else:
+ self.listitem = listitem
+ def factory(*args_, **kwargs_):
+ if docListType.subclass:
+ return docListType.subclass(*args_, **kwargs_)
+ else:
+ return docListType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_listitem(self): return self.listitem
+ def set_listitem(self, listitem): self.listitem = listitem
+ def add_listitem(self, value): self.listitem.append(value)
+ def insert_listitem(self, index, value): self.listitem[index] = value
+ def export(self, outfile, level, namespace_='', name_='docListType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docListType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='docListType'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='docListType'):
+ for listitem_ in self.listitem:
+ listitem_.export(outfile, level, namespace_, name_='listitem')
+ def hasContent_(self):
+ if (
+ self.listitem is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docListType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('listitem=[\n')
+ level += 1
+ for listitem in self.listitem:
+ showIndent(outfile, level)
+ outfile.write('model_.listitem(\n')
+ listitem.exportLiteral(outfile, level, name_='listitem')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'listitem':
+ obj_ = docListItemType.factory()
+ obj_.build(child_)
+ self.listitem.append(obj_)
+# end class docListType
+
+
+class docListItemType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, para=None):
+ if para is None:
+ self.para = []
+ else:
+ self.para = para
+ def factory(*args_, **kwargs_):
+ if docListItemType.subclass:
+ return docListItemType.subclass(*args_, **kwargs_)
+ else:
+ return docListItemType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_para(self): return self.para
+ def set_para(self, para): self.para = para
+ def add_para(self, value): self.para.append(value)
+ def insert_para(self, index, value): self.para[index] = value
+ def export(self, outfile, level, namespace_='', name_='docListItemType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docListItemType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='docListItemType'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='docListItemType'):
+ for para_ in self.para:
+ para_.export(outfile, level, namespace_, name_='para')
+ def hasContent_(self):
+ if (
+ self.para is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docListItemType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('para=[\n')
+ level += 1
+ for para in self.para:
+ showIndent(outfile, level)
+ outfile.write('model_.para(\n')
+ para.exportLiteral(outfile, level, name_='para')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'para':
+ obj_ = docParaType.factory()
+ obj_.build(child_)
+ self.para.append(obj_)
+# end class docListItemType
+
+
+class docSimpleSectType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, kind=None, title=None, para=None):
+ self.kind = kind
+ self.title = title
+ if para is None:
+ self.para = []
+ else:
+ self.para = para
+ def factory(*args_, **kwargs_):
+ if docSimpleSectType.subclass:
+ return docSimpleSectType.subclass(*args_, **kwargs_)
+ else:
+ return docSimpleSectType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_title(self): return self.title
+ def set_title(self, title): self.title = title
+ def get_para(self): return self.para
+ def set_para(self, para): self.para = para
+ def add_para(self, value): self.para.append(value)
+ def insert_para(self, index, value): self.para[index] = value
+ def get_kind(self): return self.kind
+ def set_kind(self, kind): self.kind = kind
+ def export(self, outfile, level, namespace_='', name_='docSimpleSectType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docSimpleSectType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='docSimpleSectType'):
+ if self.kind is not None:
+ outfile.write(' kind=%s' % (quote_attrib(self.kind), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='docSimpleSectType'):
+ if self.title:
+ self.title.export(outfile, level, namespace_, name_='title')
+ for para_ in self.para:
+ para_.export(outfile, level, namespace_, name_='para')
+ def hasContent_(self):
+ if (
+ self.title is not None or
+ self.para is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docSimpleSectType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.kind is not None:
+ showIndent(outfile, level)
+ outfile.write('kind = "%s",\n' % (self.kind,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ if self.title:
+ showIndent(outfile, level)
+ outfile.write('title=model_.docTitleType(\n')
+ self.title.exportLiteral(outfile, level, name_='title')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ showIndent(outfile, level)
+ outfile.write('para=[\n')
+ level += 1
+ for para in self.para:
+ showIndent(outfile, level)
+ outfile.write('model_.para(\n')
+ para.exportLiteral(outfile, level, name_='para')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('kind'):
+ self.kind = attrs.get('kind').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'title':
+ obj_ = docTitleType.factory()
+ obj_.build(child_)
+ self.set_title(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'para':
+ obj_ = docParaType.factory()
+ obj_.build(child_)
+ self.para.append(obj_)
+# end class docSimpleSectType
+
+
+class docVarListEntryType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, term=None):
+ self.term = term
+ def factory(*args_, **kwargs_):
+ if docVarListEntryType.subclass:
+ return docVarListEntryType.subclass(*args_, **kwargs_)
+ else:
+ return docVarListEntryType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_term(self): return self.term
+ def set_term(self, term): self.term = term
+ def export(self, outfile, level, namespace_='', name_='docVarListEntryType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docVarListEntryType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='docVarListEntryType'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='docVarListEntryType'):
+ if self.term:
+ self.term.export(outfile, level, namespace_, name_='term', )
+ def hasContent_(self):
+ if (
+ self.term is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docVarListEntryType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ if self.term:
+ showIndent(outfile, level)
+ outfile.write('term=model_.docTitleType(\n')
+ self.term.exportLiteral(outfile, level, name_='term')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'term':
+ obj_ = docTitleType.factory()
+ obj_.build(child_)
+ self.set_term(obj_)
+# end class docVarListEntryType
+
+
+class docVariableListType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, valueOf_=''):
+ self.valueOf_ = valueOf_
+ def factory(*args_, **kwargs_):
+ if docVariableListType.subclass:
+ return docVariableListType.subclass(*args_, **kwargs_)
+ else:
+ return docVariableListType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='docVariableListType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docVariableListType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='docVariableListType'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='docVariableListType'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docVariableListType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class docVariableListType
+
+
+class docRefTextType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, refid=None, kindref=None, external=None, valueOf_='', mixedclass_=None, content_=None):
+ self.refid = refid
+ self.kindref = kindref
+ self.external = external
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if docRefTextType.subclass:
+ return docRefTextType.subclass(*args_, **kwargs_)
+ else:
+ return docRefTextType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_refid(self): return self.refid
+ def set_refid(self, refid): self.refid = refid
+ def get_kindref(self): return self.kindref
+ def set_kindref(self, kindref): self.kindref = kindref
+ def get_external(self): return self.external
+ def set_external(self, external): self.external = external
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='docRefTextType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docRefTextType')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='docRefTextType'):
+ if self.refid is not None:
+ outfile.write(' refid=%s' % (self.format_string(quote_attrib(self.refid).encode(ExternalEncoding), input_name='refid'), ))
+ if self.kindref is not None:
+ outfile.write(' kindref=%s' % (quote_attrib(self.kindref), ))
+ if self.external is not None:
+ outfile.write(' external=%s' % (self.format_string(quote_attrib(self.external).encode(ExternalEncoding), input_name='external'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='docRefTextType'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docRefTextType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.refid is not None:
+ showIndent(outfile, level)
+ outfile.write('refid = %s,\n' % (self.refid,))
+ if self.kindref is not None:
+ showIndent(outfile, level)
+ outfile.write('kindref = "%s",\n' % (self.kindref,))
+ if self.external is not None:
+ showIndent(outfile, level)
+ outfile.write('external = %s,\n' % (self.external,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('refid'):
+ self.refid = attrs.get('refid').value
+ if attrs.get('kindref'):
+ self.kindref = attrs.get('kindref').value
+ if attrs.get('external'):
+ self.external = attrs.get('external').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class docRefTextType
+
+
+class docTableType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, rows=None, cols=None, row=None, caption=None):
+ self.rows = rows
+ self.cols = cols
+ if row is None:
+ self.row = []
+ else:
+ self.row = row
+ self.caption = caption
+ def factory(*args_, **kwargs_):
+ if docTableType.subclass:
+ return docTableType.subclass(*args_, **kwargs_)
+ else:
+ return docTableType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_row(self): return self.row
+ def set_row(self, row): self.row = row
+ def add_row(self, value): self.row.append(value)
+ def insert_row(self, index, value): self.row[index] = value
+ def get_caption(self): return self.caption
+ def set_caption(self, caption): self.caption = caption
+ def get_rows(self): return self.rows
+ def set_rows(self, rows): self.rows = rows
+ def get_cols(self): return self.cols
+ def set_cols(self, cols): self.cols = cols
+ def export(self, outfile, level, namespace_='', name_='docTableType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docTableType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='docTableType'):
+ if self.rows is not None:
+ outfile.write(' rows="%s"' % self.format_integer(self.rows, input_name='rows'))
+ if self.cols is not None:
+ outfile.write(' cols="%s"' % self.format_integer(self.cols, input_name='cols'))
+ def exportChildren(self, outfile, level, namespace_='', name_='docTableType'):
+ for row_ in self.row:
+ row_.export(outfile, level, namespace_, name_='row')
+ if self.caption:
+ self.caption.export(outfile, level, namespace_, name_='caption')
+ def hasContent_(self):
+ if (
+ self.row is not None or
+ self.caption is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docTableType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.rows is not None:
+ showIndent(outfile, level)
+ outfile.write('rows = %s,\n' % (self.rows,))
+ if self.cols is not None:
+ showIndent(outfile, level)
+ outfile.write('cols = %s,\n' % (self.cols,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('row=[\n')
+ level += 1
+ for row in self.row:
+ showIndent(outfile, level)
+ outfile.write('model_.row(\n')
+ row.exportLiteral(outfile, level, name_='row')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ if self.caption:
+ showIndent(outfile, level)
+ outfile.write('caption=model_.docCaptionType(\n')
+ self.caption.exportLiteral(outfile, level, name_='caption')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('rows'):
+ try:
+ self.rows = int(attrs.get('rows').value)
+ except ValueError, exp:
+ raise ValueError('Bad integer attribute (rows): %s' % exp)
+ if attrs.get('cols'):
+ try:
+ self.cols = int(attrs.get('cols').value)
+ except ValueError, exp:
+ raise ValueError('Bad integer attribute (cols): %s' % exp)
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'row':
+ obj_ = docRowType.factory()
+ obj_.build(child_)
+ self.row.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'caption':
+ obj_ = docCaptionType.factory()
+ obj_.build(child_)
+ self.set_caption(obj_)
+# end class docTableType
+
+
+class docRowType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, entry=None):
+ if entry is None:
+ self.entry = []
+ else:
+ self.entry = entry
+ def factory(*args_, **kwargs_):
+ if docRowType.subclass:
+ return docRowType.subclass(*args_, **kwargs_)
+ else:
+ return docRowType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_entry(self): return self.entry
+ def set_entry(self, entry): self.entry = entry
+ def add_entry(self, value): self.entry.append(value)
+ def insert_entry(self, index, value): self.entry[index] = value
+ def export(self, outfile, level, namespace_='', name_='docRowType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docRowType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='docRowType'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='docRowType'):
+ for entry_ in self.entry:
+ entry_.export(outfile, level, namespace_, name_='entry')
+ def hasContent_(self):
+ if (
+ self.entry is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docRowType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('entry=[\n')
+ level += 1
+ for entry in self.entry:
+ showIndent(outfile, level)
+ outfile.write('model_.entry(\n')
+ entry.exportLiteral(outfile, level, name_='entry')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'entry':
+ obj_ = docEntryType.factory()
+ obj_.build(child_)
+ self.entry.append(obj_)
+# end class docRowType
+
+
+class docEntryType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, thead=None, para=None):
+ self.thead = thead
+ if para is None:
+ self.para = []
+ else:
+ self.para = para
+ def factory(*args_, **kwargs_):
+ if docEntryType.subclass:
+ return docEntryType.subclass(*args_, **kwargs_)
+ else:
+ return docEntryType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_para(self): return self.para
+ def set_para(self, para): self.para = para
+ def add_para(self, value): self.para.append(value)
+ def insert_para(self, index, value): self.para[index] = value
+ def get_thead(self): return self.thead
+ def set_thead(self, thead): self.thead = thead
+ def export(self, outfile, level, namespace_='', name_='docEntryType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docEntryType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='docEntryType'):
+ if self.thead is not None:
+ outfile.write(' thead=%s' % (quote_attrib(self.thead), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='docEntryType'):
+ for para_ in self.para:
+ para_.export(outfile, level, namespace_, name_='para')
+ def hasContent_(self):
+ if (
+ self.para is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docEntryType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.thead is not None:
+ showIndent(outfile, level)
+ outfile.write('thead = "%s",\n' % (self.thead,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('para=[\n')
+ level += 1
+ for para in self.para:
+ showIndent(outfile, level)
+ outfile.write('model_.para(\n')
+ para.exportLiteral(outfile, level, name_='para')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('thead'):
+ self.thead = attrs.get('thead').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'para':
+ obj_ = docParaType.factory()
+ obj_.build(child_)
+ self.para.append(obj_)
+# end class docEntryType
+
+
+class docCaptionType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, valueOf_='', mixedclass_=None, content_=None):
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if docCaptionType.subclass:
+ return docCaptionType.subclass(*args_, **kwargs_)
+ else:
+ return docCaptionType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='docCaptionType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docCaptionType')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='docCaptionType'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='docCaptionType'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docCaptionType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class docCaptionType
+
+
+class docHeadingType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, level=None, valueOf_='', mixedclass_=None, content_=None):
+ self.level = level
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if docHeadingType.subclass:
+ return docHeadingType.subclass(*args_, **kwargs_)
+ else:
+ return docHeadingType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_level(self): return self.level
+ def set_level(self, level): self.level = level
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='docHeadingType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docHeadingType')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='docHeadingType'):
+ if self.level is not None:
+ outfile.write(' level="%s"' % self.format_integer(self.level, input_name='level'))
+ def exportChildren(self, outfile, level, namespace_='', name_='docHeadingType'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docHeadingType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.level is not None:
+ showIndent(outfile, level)
+ outfile.write('level = %s,\n' % (self.level,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('level'):
+ try:
+ self.level = int(attrs.get('level').value)
+ except ValueError, exp:
+ raise ValueError('Bad integer attribute (level): %s' % exp)
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class docHeadingType
+
+
+class docImageType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, width=None, type_=None, name=None, height=None, valueOf_='', mixedclass_=None, content_=None):
+ self.width = width
+ self.type_ = type_
+ self.name = name
+ self.height = height
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if docImageType.subclass:
+ return docImageType.subclass(*args_, **kwargs_)
+ else:
+ return docImageType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_width(self): return self.width
+ def set_width(self, width): self.width = width
+ def get_type(self): return self.type_
+ def set_type(self, type_): self.type_ = type_
+ def get_name(self): return self.name
+ def set_name(self, name): self.name = name
+ def get_height(self): return self.height
+ def set_height(self, height): self.height = height
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='docImageType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docImageType')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='docImageType'):
+ if self.width is not None:
+ outfile.write(' width=%s' % (self.format_string(quote_attrib(self.width).encode(ExternalEncoding), input_name='width'), ))
+ if self.type_ is not None:
+ outfile.write(' type=%s' % (quote_attrib(self.type_), ))
+ if self.name is not None:
+ outfile.write(' name=%s' % (self.format_string(quote_attrib(self.name).encode(ExternalEncoding), input_name='name'), ))
+ if self.height is not None:
+ outfile.write(' height=%s' % (self.format_string(quote_attrib(self.height).encode(ExternalEncoding), input_name='height'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='docImageType'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docImageType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.width is not None:
+ showIndent(outfile, level)
+ outfile.write('width = %s,\n' % (self.width,))
+ if self.type_ is not None:
+ showIndent(outfile, level)
+ outfile.write('type_ = "%s",\n' % (self.type_,))
+ if self.name is not None:
+ showIndent(outfile, level)
+ outfile.write('name = %s,\n' % (self.name,))
+ if self.height is not None:
+ showIndent(outfile, level)
+ outfile.write('height = %s,\n' % (self.height,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('width'):
+ self.width = attrs.get('width').value
+ if attrs.get('type'):
+ self.type_ = attrs.get('type').value
+ if attrs.get('name'):
+ self.name = attrs.get('name').value
+ if attrs.get('height'):
+ self.height = attrs.get('height').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class docImageType
+
+
+class docDotFileType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, name=None, valueOf_='', mixedclass_=None, content_=None):
+ self.name = name
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if docDotFileType.subclass:
+ return docDotFileType.subclass(*args_, **kwargs_)
+ else:
+ return docDotFileType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_name(self): return self.name
+ def set_name(self, name): self.name = name
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='docDotFileType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docDotFileType')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='docDotFileType'):
+ if self.name is not None:
+ outfile.write(' name=%s' % (self.format_string(quote_attrib(self.name).encode(ExternalEncoding), input_name='name'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='docDotFileType'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docDotFileType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.name is not None:
+ showIndent(outfile, level)
+ outfile.write('name = %s,\n' % (self.name,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('name'):
+ self.name = attrs.get('name').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class docDotFileType
+
+
+class docTocItemType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, id=None, valueOf_='', mixedclass_=None, content_=None):
+ self.id = id
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if docTocItemType.subclass:
+ return docTocItemType.subclass(*args_, **kwargs_)
+ else:
+ return docTocItemType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_id(self): return self.id
+ def set_id(self, id): self.id = id
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='docTocItemType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docTocItemType')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='docTocItemType'):
+ if self.id is not None:
+ outfile.write(' id=%s' % (self.format_string(quote_attrib(self.id).encode(ExternalEncoding), input_name='id'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='docTocItemType'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docTocItemType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.id is not None:
+ showIndent(outfile, level)
+ outfile.write('id = %s,\n' % (self.id,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('id'):
+ self.id = attrs.get('id').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class docTocItemType
+
+
+class docTocListType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, tocitem=None):
+ if tocitem is None:
+ self.tocitem = []
+ else:
+ self.tocitem = tocitem
+ def factory(*args_, **kwargs_):
+ if docTocListType.subclass:
+ return docTocListType.subclass(*args_, **kwargs_)
+ else:
+ return docTocListType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_tocitem(self): return self.tocitem
+ def set_tocitem(self, tocitem): self.tocitem = tocitem
+ def add_tocitem(self, value): self.tocitem.append(value)
+ def insert_tocitem(self, index, value): self.tocitem[index] = value
+ def export(self, outfile, level, namespace_='', name_='docTocListType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docTocListType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='docTocListType'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='docTocListType'):
+ for tocitem_ in self.tocitem:
+ tocitem_.export(outfile, level, namespace_, name_='tocitem')
+ def hasContent_(self):
+ if (
+ self.tocitem is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docTocListType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('tocitem=[\n')
+ level += 1
+ for tocitem in self.tocitem:
+ showIndent(outfile, level)
+ outfile.write('model_.tocitem(\n')
+ tocitem.exportLiteral(outfile, level, name_='tocitem')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'tocitem':
+ obj_ = docTocItemType.factory()
+ obj_.build(child_)
+ self.tocitem.append(obj_)
+# end class docTocListType
+
+
+class docLanguageType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, langid=None, para=None):
+ self.langid = langid
+ if para is None:
+ self.para = []
+ else:
+ self.para = para
+ def factory(*args_, **kwargs_):
+ if docLanguageType.subclass:
+ return docLanguageType.subclass(*args_, **kwargs_)
+ else:
+ return docLanguageType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_para(self): return self.para
+ def set_para(self, para): self.para = para
+ def add_para(self, value): self.para.append(value)
+ def insert_para(self, index, value): self.para[index] = value
+ def get_langid(self): return self.langid
+ def set_langid(self, langid): self.langid = langid
+ def export(self, outfile, level, namespace_='', name_='docLanguageType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docLanguageType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='docLanguageType'):
+ if self.langid is not None:
+ outfile.write(' langid=%s' % (self.format_string(quote_attrib(self.langid).encode(ExternalEncoding), input_name='langid'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='docLanguageType'):
+ for para_ in self.para:
+ para_.export(outfile, level, namespace_, name_='para')
+ def hasContent_(self):
+ if (
+ self.para is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docLanguageType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.langid is not None:
+ showIndent(outfile, level)
+ outfile.write('langid = %s,\n' % (self.langid,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('para=[\n')
+ level += 1
+ for para in self.para:
+ showIndent(outfile, level)
+ outfile.write('model_.para(\n')
+ para.exportLiteral(outfile, level, name_='para')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('langid'):
+ self.langid = attrs.get('langid').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'para':
+ obj_ = docParaType.factory()
+ obj_.build(child_)
+ self.para.append(obj_)
+# end class docLanguageType
+
+
+class docParamListType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, kind=None, parameteritem=None):
+ self.kind = kind
+ if parameteritem is None:
+ self.parameteritem = []
+ else:
+ self.parameteritem = parameteritem
+ def factory(*args_, **kwargs_):
+ if docParamListType.subclass:
+ return docParamListType.subclass(*args_, **kwargs_)
+ else:
+ return docParamListType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_parameteritem(self): return self.parameteritem
+ def set_parameteritem(self, parameteritem): self.parameteritem = parameteritem
+ def add_parameteritem(self, value): self.parameteritem.append(value)
+ def insert_parameteritem(self, index, value): self.parameteritem[index] = value
+ def get_kind(self): return self.kind
+ def set_kind(self, kind): self.kind = kind
+ def export(self, outfile, level, namespace_='', name_='docParamListType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docParamListType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='docParamListType'):
+ if self.kind is not None:
+ outfile.write(' kind=%s' % (quote_attrib(self.kind), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='docParamListType'):
+ for parameteritem_ in self.parameteritem:
+ parameteritem_.export(outfile, level, namespace_, name_='parameteritem')
+ def hasContent_(self):
+ if (
+ self.parameteritem is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docParamListType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.kind is not None:
+ showIndent(outfile, level)
+ outfile.write('kind = "%s",\n' % (self.kind,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('parameteritem=[\n')
+ level += 1
+ for parameteritem in self.parameteritem:
+ showIndent(outfile, level)
+ outfile.write('model_.parameteritem(\n')
+ parameteritem.exportLiteral(outfile, level, name_='parameteritem')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('kind'):
+ self.kind = attrs.get('kind').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'parameteritem':
+ obj_ = docParamListItem.factory()
+ obj_.build(child_)
+ self.parameteritem.append(obj_)
+# end class docParamListType
+
+
+class docParamListItem(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, parameternamelist=None, parameterdescription=None):
+ if parameternamelist is None:
+ self.parameternamelist = []
+ else:
+ self.parameternamelist = parameternamelist
+ self.parameterdescription = parameterdescription
+ def factory(*args_, **kwargs_):
+ if docParamListItem.subclass:
+ return docParamListItem.subclass(*args_, **kwargs_)
+ else:
+ return docParamListItem(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_parameternamelist(self): return self.parameternamelist
+ def set_parameternamelist(self, parameternamelist): self.parameternamelist = parameternamelist
+ def add_parameternamelist(self, value): self.parameternamelist.append(value)
+ def insert_parameternamelist(self, index, value): self.parameternamelist[index] = value
+ def get_parameterdescription(self): return self.parameterdescription
+ def set_parameterdescription(self, parameterdescription): self.parameterdescription = parameterdescription
+ def export(self, outfile, level, namespace_='', name_='docParamListItem', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docParamListItem')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='docParamListItem'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='docParamListItem'):
+ for parameternamelist_ in self.parameternamelist:
+ parameternamelist_.export(outfile, level, namespace_, name_='parameternamelist')
+ if self.parameterdescription:
+ self.parameterdescription.export(outfile, level, namespace_, name_='parameterdescription', )
+ def hasContent_(self):
+ if (
+ self.parameternamelist is not None or
+ self.parameterdescription is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docParamListItem'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('parameternamelist=[\n')
+ level += 1
+ for parameternamelist in self.parameternamelist:
+ showIndent(outfile, level)
+ outfile.write('model_.parameternamelist(\n')
+ parameternamelist.exportLiteral(outfile, level, name_='parameternamelist')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ if self.parameterdescription:
+ showIndent(outfile, level)
+ outfile.write('parameterdescription=model_.descriptionType(\n')
+ self.parameterdescription.exportLiteral(outfile, level, name_='parameterdescription')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'parameternamelist':
+ obj_ = docParamNameList.factory()
+ obj_.build(child_)
+ self.parameternamelist.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'parameterdescription':
+ obj_ = descriptionType.factory()
+ obj_.build(child_)
+ self.set_parameterdescription(obj_)
+# end class docParamListItem
+
+
+class docParamNameList(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, parametername=None):
+ if parametername is None:
+ self.parametername = []
+ else:
+ self.parametername = parametername
+ def factory(*args_, **kwargs_):
+ if docParamNameList.subclass:
+ return docParamNameList.subclass(*args_, **kwargs_)
+ else:
+ return docParamNameList(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_parametername(self): return self.parametername
+ def set_parametername(self, parametername): self.parametername = parametername
+ def add_parametername(self, value): self.parametername.append(value)
+ def insert_parametername(self, index, value): self.parametername[index] = value
+ def export(self, outfile, level, namespace_='', name_='docParamNameList', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docParamNameList')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='docParamNameList'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='docParamNameList'):
+ for parametername_ in self.parametername:
+ parametername_.export(outfile, level, namespace_, name_='parametername')
+ def hasContent_(self):
+ if (
+ self.parametername is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docParamNameList'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('parametername=[\n')
+ level += 1
+ for parametername in self.parametername:
+ showIndent(outfile, level)
+ outfile.write('model_.parametername(\n')
+ parametername.exportLiteral(outfile, level, name_='parametername')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'parametername':
+ obj_ = docParamName.factory()
+ obj_.build(child_)
+ self.parametername.append(obj_)
+# end class docParamNameList
+
+
+class docParamName(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, direction=None, ref=None, mixedclass_=None, content_=None):
+ self.direction = direction
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if docParamName.subclass:
+ return docParamName.subclass(*args_, **kwargs_)
+ else:
+ return docParamName(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_ref(self): return self.ref
+ def set_ref(self, ref): self.ref = ref
+ def get_direction(self): return self.direction
+ def set_direction(self, direction): self.direction = direction
+ def export(self, outfile, level, namespace_='', name_='docParamName', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docParamName')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='docParamName'):
+ if self.direction is not None:
+ outfile.write(' direction=%s' % (quote_attrib(self.direction), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='docParamName'):
+ for item_ in self.content_:
+ item_.export(outfile, level, item_.name, namespace_)
+ def hasContent_(self):
+ if (
+ self.ref is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docParamName'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.direction is not None:
+ showIndent(outfile, level)
+ outfile.write('direction = "%s",\n' % (self.direction,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('direction'):
+ self.direction = attrs.get('direction').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'ref':
+ childobj_ = docRefTextType.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'ref', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+# end class docParamName
+
+
+class docXRefSectType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, id=None, xreftitle=None, xrefdescription=None):
+ self.id = id
+ if xreftitle is None:
+ self.xreftitle = []
+ else:
+ self.xreftitle = xreftitle
+ self.xrefdescription = xrefdescription
+ def factory(*args_, **kwargs_):
+ if docXRefSectType.subclass:
+ return docXRefSectType.subclass(*args_, **kwargs_)
+ else:
+ return docXRefSectType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_xreftitle(self): return self.xreftitle
+ def set_xreftitle(self, xreftitle): self.xreftitle = xreftitle
+ def add_xreftitle(self, value): self.xreftitle.append(value)
+ def insert_xreftitle(self, index, value): self.xreftitle[index] = value
+ def get_xrefdescription(self): return self.xrefdescription
+ def set_xrefdescription(self, xrefdescription): self.xrefdescription = xrefdescription
+ def get_id(self): return self.id
+ def set_id(self, id): self.id = id
+ def export(self, outfile, level, namespace_='', name_='docXRefSectType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docXRefSectType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='docXRefSectType'):
+ if self.id is not None:
+ outfile.write(' id=%s' % (self.format_string(quote_attrib(self.id).encode(ExternalEncoding), input_name='id'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='docXRefSectType'):
+ for xreftitle_ in self.xreftitle:
+ showIndent(outfile, level)
+ outfile.write('<%sxreftitle>%s</%sxreftitle>\n' % (namespace_, self.format_string(quote_xml(xreftitle_).encode(ExternalEncoding), input_name='xreftitle'), namespace_))
+ if self.xrefdescription:
+ self.xrefdescription.export(outfile, level, namespace_, name_='xrefdescription', )
+ def hasContent_(self):
+ if (
+ self.xreftitle is not None or
+ self.xrefdescription is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docXRefSectType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.id is not None:
+ showIndent(outfile, level)
+ outfile.write('id = %s,\n' % (self.id,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('xreftitle=[\n')
+ level += 1
+ for xreftitle in self.xreftitle:
+ showIndent(outfile, level)
+ outfile.write('%s,\n' % quote_python(xreftitle).encode(ExternalEncoding))
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ if self.xrefdescription:
+ showIndent(outfile, level)
+ outfile.write('xrefdescription=model_.descriptionType(\n')
+ self.xrefdescription.exportLiteral(outfile, level, name_='xrefdescription')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('id'):
+ self.id = attrs.get('id').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'xreftitle':
+ xreftitle_ = ''
+ for text__content_ in child_.childNodes:
+ xreftitle_ += text__content_.nodeValue
+ self.xreftitle.append(xreftitle_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'xrefdescription':
+ obj_ = descriptionType.factory()
+ obj_.build(child_)
+ self.set_xrefdescription(obj_)
+# end class docXRefSectType
+
+
+class docCopyType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, link=None, para=None, sect1=None, internal=None):
+ self.link = link
+ if para is None:
+ self.para = []
+ else:
+ self.para = para
+ if sect1 is None:
+ self.sect1 = []
+ else:
+ self.sect1 = sect1
+ self.internal = internal
+ def factory(*args_, **kwargs_):
+ if docCopyType.subclass:
+ return docCopyType.subclass(*args_, **kwargs_)
+ else:
+ return docCopyType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_para(self): return self.para
+ def set_para(self, para): self.para = para
+ def add_para(self, value): self.para.append(value)
+ def insert_para(self, index, value): self.para[index] = value
+ def get_sect1(self): return self.sect1
+ def set_sect1(self, sect1): self.sect1 = sect1
+ def add_sect1(self, value): self.sect1.append(value)
+ def insert_sect1(self, index, value): self.sect1[index] = value
+ def get_internal(self): return self.internal
+ def set_internal(self, internal): self.internal = internal
+ def get_link(self): return self.link
+ def set_link(self, link): self.link = link
+ def export(self, outfile, level, namespace_='', name_='docCopyType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docCopyType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='docCopyType'):
+ if self.link is not None:
+ outfile.write(' link=%s' % (self.format_string(quote_attrib(self.link).encode(ExternalEncoding), input_name='link'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='docCopyType'):
+ for para_ in self.para:
+ para_.export(outfile, level, namespace_, name_='para')
+ for sect1_ in self.sect1:
+ sect1_.export(outfile, level, namespace_, name_='sect1')
+ if self.internal:
+ self.internal.export(outfile, level, namespace_, name_='internal')
+ def hasContent_(self):
+ if (
+ self.para is not None or
+ self.sect1 is not None or
+ self.internal is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docCopyType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.link is not None:
+ showIndent(outfile, level)
+ outfile.write('link = %s,\n' % (self.link,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('para=[\n')
+ level += 1
+ for para in self.para:
+ showIndent(outfile, level)
+ outfile.write('model_.para(\n')
+ para.exportLiteral(outfile, level, name_='para')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('sect1=[\n')
+ level += 1
+ for sect1 in self.sect1:
+ showIndent(outfile, level)
+ outfile.write('model_.sect1(\n')
+ sect1.exportLiteral(outfile, level, name_='sect1')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ if self.internal:
+ showIndent(outfile, level)
+ outfile.write('internal=model_.docInternalType(\n')
+ self.internal.exportLiteral(outfile, level, name_='internal')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('link'):
+ self.link = attrs.get('link').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'para':
+ obj_ = docParaType.factory()
+ obj_.build(child_)
+ self.para.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'sect1':
+ obj_ = docSect1Type.factory()
+ obj_.build(child_)
+ self.sect1.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'internal':
+ obj_ = docInternalType.factory()
+ obj_.build(child_)
+ self.set_internal(obj_)
+# end class docCopyType
+
+
+class docCharType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, char=None, valueOf_=''):
+ self.char = char
+ self.valueOf_ = valueOf_
+ def factory(*args_, **kwargs_):
+ if docCharType.subclass:
+ return docCharType.subclass(*args_, **kwargs_)
+ else:
+ return docCharType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_char(self): return self.char
+ def set_char(self, char): self.char = char
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='docCharType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docCharType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='docCharType'):
+ if self.char is not None:
+ outfile.write(' char=%s' % (quote_attrib(self.char), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='docCharType'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docCharType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.char is not None:
+ showIndent(outfile, level)
+ outfile.write('char = "%s",\n' % (self.char,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('char'):
+ self.char = attrs.get('char').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class docCharType
+
+
+class docEmptyType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, valueOf_=''):
+ self.valueOf_ = valueOf_
+ def factory(*args_, **kwargs_):
+ if docEmptyType.subclass:
+ return docEmptyType.subclass(*args_, **kwargs_)
+ else:
+ return docEmptyType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='docEmptyType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docEmptyType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='docEmptyType'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='docEmptyType'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docEmptyType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class docEmptyType
+
+
+USAGE_TEXT = """
+Usage: python <Parser>.py [ -s ] <in_xml_file>
+Options:
+ -s Use the SAX parser, not the minidom parser.
+"""
+
+def usage():
+ print USAGE_TEXT
+ sys.exit(1)
+
+
+def parse(inFileName):
+ doc = minidom.parse(inFileName)
+ rootNode = doc.documentElement
+ rootObj = DoxygenType.factory()
+ rootObj.build(rootNode)
+ # Enable Python to collect the space used by the DOM.
+ doc = None
+ sys.stdout.write('<?xml version="1.0" ?>\n')
+ rootObj.export(sys.stdout, 0, name_="doxygen",
+ namespacedef_='')
+ return rootObj
+
+
+def parseString(inString):
+ doc = minidom.parseString(inString)
+ rootNode = doc.documentElement
+ rootObj = DoxygenType.factory()
+ rootObj.build(rootNode)
+ # Enable Python to collect the space used by the DOM.
+ doc = None
+ sys.stdout.write('<?xml version="1.0" ?>\n')
+ rootObj.export(sys.stdout, 0, name_="doxygen",
+ namespacedef_='')
+ return rootObj
+
+
+def parseLiteral(inFileName):
+ doc = minidom.parse(inFileName)
+ rootNode = doc.documentElement
+ rootObj = DoxygenType.factory()
+ rootObj.build(rootNode)
+ # Enable Python to collect the space used by the DOM.
+ doc = None
+ sys.stdout.write('from compound import *\n\n')
+ sys.stdout.write('rootObj = doxygen(\n')
+ rootObj.exportLiteral(sys.stdout, 0, name_="doxygen")
+ sys.stdout.write(')\n')
+ return rootObj
+
+
+def main():
+ args = sys.argv[1:]
+ if len(args) == 1:
+ parse(args[0])
+ else:
+ usage()
+
+
+if __name__ == '__main__':
+ main()
+ #import pdb
+ #pdb.run('main()')
+
diff --git a/gr-utils/src/python/modtool/gr-newmod/docs/doxygen/doxyxml/generated/index.py b/gr-utils/src/python/modtool/gr-newmod/docs/doxygen/doxyxml/generated/index.py
new file mode 100644
index 000000000..7a70e14a1
--- /dev/null
+++ b/gr-utils/src/python/modtool/gr-newmod/docs/doxygen/doxyxml/generated/index.py
@@ -0,0 +1,77 @@
+#!/usr/bin/env python
+
+"""
+Generated Mon Feb 9 19:08:05 2009 by generateDS.py.
+"""
+
+from xml.dom import minidom
+
+import os
+import sys
+import compound
+
+import indexsuper as supermod
+
+class DoxygenTypeSub(supermod.DoxygenType):
+ def __init__(self, version=None, compound=None):
+ supermod.DoxygenType.__init__(self, version, compound)
+
+ def find_compounds_and_members(self, details):
+ """
+ Returns a list of all compounds and their members which match details
+ """
+
+ results = []
+ for compound in self.compound:
+ members = compound.find_members(details)
+ if members:
+ results.append([compound, members])
+ else:
+ if details.match(compound):
+ results.append([compound, []])
+
+ return results
+
+supermod.DoxygenType.subclass = DoxygenTypeSub
+# end class DoxygenTypeSub
+
+
+class CompoundTypeSub(supermod.CompoundType):
+ def __init__(self, kind=None, refid=None, name='', member=None):
+ supermod.CompoundType.__init__(self, kind, refid, name, member)
+
+ def find_members(self, details):
+ """
+ Returns a list of all members which match details
+ """
+
+ results = []
+
+ for member in self.member:
+ if details.match(member):
+ results.append(member)
+
+ return results
+
+supermod.CompoundType.subclass = CompoundTypeSub
+# end class CompoundTypeSub
+
+
+class MemberTypeSub(supermod.MemberType):
+
+ def __init__(self, kind=None, refid=None, name=''):
+ supermod.MemberType.__init__(self, kind, refid, name)
+
+supermod.MemberType.subclass = MemberTypeSub
+# end class MemberTypeSub
+
+
+def parse(inFilename):
+
+ doc = minidom.parse(inFilename)
+ rootNode = doc.documentElement
+ rootObj = supermod.DoxygenType.factory()
+ rootObj.build(rootNode)
+
+ return rootObj
+
diff --git a/gr-utils/src/python/modtool/gr-newmod/docs/doxygen/doxyxml/generated/indexsuper.py b/gr-utils/src/python/modtool/gr-newmod/docs/doxygen/doxyxml/generated/indexsuper.py
new file mode 100644
index 000000000..a99153019
--- /dev/null
+++ b/gr-utils/src/python/modtool/gr-newmod/docs/doxygen/doxyxml/generated/indexsuper.py
@@ -0,0 +1,523 @@
+#!/usr/bin/env python
+
+#
+# Generated Thu Jun 11 18:43:54 2009 by generateDS.py.
+#
+
+import sys
+import getopt
+from string import lower as str_lower
+from xml.dom import minidom
+from xml.dom import Node
+
+#
+# User methods
+#
+# Calls to the methods in these classes are generated by generateDS.py.
+# You can replace these methods by re-implementing the following class
+# in a module named generatedssuper.py.
+
+try:
+ from generatedssuper import GeneratedsSuper
+except ImportError, exp:
+
+ class GeneratedsSuper:
+ def format_string(self, input_data, input_name=''):
+ return input_data
+ def format_integer(self, input_data, input_name=''):
+ return '%d' % input_data
+ def format_float(self, input_data, input_name=''):
+ return '%f' % input_data
+ def format_double(self, input_data, input_name=''):
+ return '%e' % input_data
+ def format_boolean(self, input_data, input_name=''):
+ return '%s' % input_data
+
+
+#
+# If you have installed IPython you can uncomment and use the following.
+# IPython is available from http://ipython.scipy.org/.
+#
+
+## from IPython.Shell import IPShellEmbed
+## args = ''
+## ipshell = IPShellEmbed(args,
+## banner = 'Dropping into IPython',
+## exit_msg = 'Leaving Interpreter, back to program.')
+
+# Then use the following line where and when you want to drop into the
+# IPython shell:
+# ipshell('<some message> -- Entering ipshell.\nHit Ctrl-D to exit')
+
+#
+# Globals
+#
+
+ExternalEncoding = 'ascii'
+
+#
+# Support/utility functions.
+#
+
+def showIndent(outfile, level):
+ for idx in range(level):
+ outfile.write(' ')
+
+def quote_xml(inStr):
+ s1 = (isinstance(inStr, basestring) and inStr or
+ '%s' % inStr)
+ s1 = s1.replace('&', '&amp;')
+ s1 = s1.replace('<', '&lt;')
+ s1 = s1.replace('>', '&gt;')
+ return s1
+
+def quote_attrib(inStr):
+ s1 = (isinstance(inStr, basestring) and inStr or
+ '%s' % inStr)
+ s1 = s1.replace('&', '&amp;')
+ s1 = s1.replace('<', '&lt;')
+ s1 = s1.replace('>', '&gt;')
+ if '"' in s1:
+ if "'" in s1:
+ s1 = '"%s"' % s1.replace('"', "&quot;")
+ else:
+ s1 = "'%s'" % s1
+ else:
+ s1 = '"%s"' % s1
+ return s1
+
+def quote_python(inStr):
+ s1 = inStr
+ if s1.find("'") == -1:
+ if s1.find('\n') == -1:
+ return "'%s'" % s1
+ else:
+ return "'''%s'''" % s1
+ else:
+ if s1.find('"') != -1:
+ s1 = s1.replace('"', '\\"')
+ if s1.find('\n') == -1:
+ return '"%s"' % s1
+ else:
+ return '"""%s"""' % s1
+
+
+class MixedContainer:
+ # Constants for category:
+ CategoryNone = 0
+ CategoryText = 1
+ CategorySimple = 2
+ CategoryComplex = 3
+ # Constants for content_type:
+ TypeNone = 0
+ TypeText = 1
+ TypeString = 2
+ TypeInteger = 3
+ TypeFloat = 4
+ TypeDecimal = 5
+ TypeDouble = 6
+ TypeBoolean = 7
+ def __init__(self, category, content_type, name, value):
+ self.category = category
+ self.content_type = content_type
+ self.name = name
+ self.value = value
+ def getCategory(self):
+ return self.category
+ def getContenttype(self, content_type):
+ return self.content_type
+ def getValue(self):
+ return self.value
+ def getName(self):
+ return self.name
+ def export(self, outfile, level, name, namespace):
+ if self.category == MixedContainer.CategoryText:
+ outfile.write(self.value)
+ elif self.category == MixedContainer.CategorySimple:
+ self.exportSimple(outfile, level, name)
+ else: # category == MixedContainer.CategoryComplex
+ self.value.export(outfile, level, namespace,name)
+ def exportSimple(self, outfile, level, name):
+ if self.content_type == MixedContainer.TypeString:
+ outfile.write('<%s>%s</%s>' % (self.name, self.value, self.name))
+ elif self.content_type == MixedContainer.TypeInteger or \
+ self.content_type == MixedContainer.TypeBoolean:
+ outfile.write('<%s>%d</%s>' % (self.name, self.value, self.name))
+ elif self.content_type == MixedContainer.TypeFloat or \
+ self.content_type == MixedContainer.TypeDecimal:
+ outfile.write('<%s>%f</%s>' % (self.name, self.value, self.name))
+ elif self.content_type == MixedContainer.TypeDouble:
+ outfile.write('<%s>%g</%s>' % (self.name, self.value, self.name))
+ def exportLiteral(self, outfile, level, name):
+ if self.category == MixedContainer.CategoryText:
+ showIndent(outfile, level)
+ outfile.write('MixedContainer(%d, %d, "%s", "%s"),\n' % \
+ (self.category, self.content_type, self.name, self.value))
+ elif self.category == MixedContainer.CategorySimple:
+ showIndent(outfile, level)
+ outfile.write('MixedContainer(%d, %d, "%s", "%s"),\n' % \
+ (self.category, self.content_type, self.name, self.value))
+ else: # category == MixedContainer.CategoryComplex
+ showIndent(outfile, level)
+ outfile.write('MixedContainer(%d, %d, "%s",\n' % \
+ (self.category, self.content_type, self.name,))
+ self.value.exportLiteral(outfile, level + 1)
+ showIndent(outfile, level)
+ outfile.write(')\n')
+
+
+class _MemberSpec(object):
+ def __init__(self, name='', data_type='', container=0):
+ self.name = name
+ self.data_type = data_type
+ self.container = container
+ def set_name(self, name): self.name = name
+ def get_name(self): return self.name
+ def set_data_type(self, data_type): self.data_type = data_type
+ def get_data_type(self): return self.data_type
+ def set_container(self, container): self.container = container
+ def get_container(self): return self.container
+
+
+#
+# Data representation classes.
+#
+
+class DoxygenType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, version=None, compound=None):
+ self.version = version
+ if compound is None:
+ self.compound = []
+ else:
+ self.compound = compound
+ def factory(*args_, **kwargs_):
+ if DoxygenType.subclass:
+ return DoxygenType.subclass(*args_, **kwargs_)
+ else:
+ return DoxygenType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_compound(self): return self.compound
+ def set_compound(self, compound): self.compound = compound
+ def add_compound(self, value): self.compound.append(value)
+ def insert_compound(self, index, value): self.compound[index] = value
+ def get_version(self): return self.version
+ def set_version(self, version): self.version = version
+ def export(self, outfile, level, namespace_='', name_='DoxygenType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='DoxygenType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='DoxygenType'):
+ outfile.write(' version=%s' % (self.format_string(quote_attrib(self.version).encode(ExternalEncoding), input_name='version'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='DoxygenType'):
+ for compound_ in self.compound:
+ compound_.export(outfile, level, namespace_, name_='compound')
+ def hasContent_(self):
+ if (
+ self.compound is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='DoxygenType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.version is not None:
+ showIndent(outfile, level)
+ outfile.write('version = %s,\n' % (self.version,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('compound=[\n')
+ level += 1
+ for compound in self.compound:
+ showIndent(outfile, level)
+ outfile.write('model_.compound(\n')
+ compound.exportLiteral(outfile, level, name_='compound')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('version'):
+ self.version = attrs.get('version').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'compound':
+ obj_ = CompoundType.factory()
+ obj_.build(child_)
+ self.compound.append(obj_)
+# end class DoxygenType
+
+
+class CompoundType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, kind=None, refid=None, name=None, member=None):
+ self.kind = kind
+ self.refid = refid
+ self.name = name
+ if member is None:
+ self.member = []
+ else:
+ self.member = member
+ def factory(*args_, **kwargs_):
+ if CompoundType.subclass:
+ return CompoundType.subclass(*args_, **kwargs_)
+ else:
+ return CompoundType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_name(self): return self.name
+ def set_name(self, name): self.name = name
+ def get_member(self): return self.member
+ def set_member(self, member): self.member = member
+ def add_member(self, value): self.member.append(value)
+ def insert_member(self, index, value): self.member[index] = value
+ def get_kind(self): return self.kind
+ def set_kind(self, kind): self.kind = kind
+ def get_refid(self): return self.refid
+ def set_refid(self, refid): self.refid = refid
+ def export(self, outfile, level, namespace_='', name_='CompoundType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='CompoundType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='CompoundType'):
+ outfile.write(' kind=%s' % (quote_attrib(self.kind), ))
+ outfile.write(' refid=%s' % (self.format_string(quote_attrib(self.refid).encode(ExternalEncoding), input_name='refid'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='CompoundType'):
+ if self.name is not None:
+ showIndent(outfile, level)
+ outfile.write('<%sname>%s</%sname>\n' % (namespace_, self.format_string(quote_xml(self.name).encode(ExternalEncoding), input_name='name'), namespace_))
+ for member_ in self.member:
+ member_.export(outfile, level, namespace_, name_='member')
+ def hasContent_(self):
+ if (
+ self.name is not None or
+ self.member is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='CompoundType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.kind is not None:
+ showIndent(outfile, level)
+ outfile.write('kind = "%s",\n' % (self.kind,))
+ if self.refid is not None:
+ showIndent(outfile, level)
+ outfile.write('refid = %s,\n' % (self.refid,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('name=%s,\n' % quote_python(self.name).encode(ExternalEncoding))
+ showIndent(outfile, level)
+ outfile.write('member=[\n')
+ level += 1
+ for member in self.member:
+ showIndent(outfile, level)
+ outfile.write('model_.member(\n')
+ member.exportLiteral(outfile, level, name_='member')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('kind'):
+ self.kind = attrs.get('kind').value
+ if attrs.get('refid'):
+ self.refid = attrs.get('refid').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'name':
+ name_ = ''
+ for text__content_ in child_.childNodes:
+ name_ += text__content_.nodeValue
+ self.name = name_
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'member':
+ obj_ = MemberType.factory()
+ obj_.build(child_)
+ self.member.append(obj_)
+# end class CompoundType
+
+
+class MemberType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, kind=None, refid=None, name=None):
+ self.kind = kind
+ self.refid = refid
+ self.name = name
+ def factory(*args_, **kwargs_):
+ if MemberType.subclass:
+ return MemberType.subclass(*args_, **kwargs_)
+ else:
+ return MemberType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_name(self): return self.name
+ def set_name(self, name): self.name = name
+ def get_kind(self): return self.kind
+ def set_kind(self, kind): self.kind = kind
+ def get_refid(self): return self.refid
+ def set_refid(self, refid): self.refid = refid
+ def export(self, outfile, level, namespace_='', name_='MemberType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='MemberType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='MemberType'):
+ outfile.write(' kind=%s' % (quote_attrib(self.kind), ))
+ outfile.write(' refid=%s' % (self.format_string(quote_attrib(self.refid).encode(ExternalEncoding), input_name='refid'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='MemberType'):
+ if self.name is not None:
+ showIndent(outfile, level)
+ outfile.write('<%sname>%s</%sname>\n' % (namespace_, self.format_string(quote_xml(self.name).encode(ExternalEncoding), input_name='name'), namespace_))
+ def hasContent_(self):
+ if (
+ self.name is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='MemberType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.kind is not None:
+ showIndent(outfile, level)
+ outfile.write('kind = "%s",\n' % (self.kind,))
+ if self.refid is not None:
+ showIndent(outfile, level)
+ outfile.write('refid = %s,\n' % (self.refid,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('name=%s,\n' % quote_python(self.name).encode(ExternalEncoding))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('kind'):
+ self.kind = attrs.get('kind').value
+ if attrs.get('refid'):
+ self.refid = attrs.get('refid').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'name':
+ name_ = ''
+ for text__content_ in child_.childNodes:
+ name_ += text__content_.nodeValue
+ self.name = name_
+# end class MemberType
+
+
+USAGE_TEXT = """
+Usage: python <Parser>.py [ -s ] <in_xml_file>
+Options:
+ -s Use the SAX parser, not the minidom parser.
+"""
+
+def usage():
+ print USAGE_TEXT
+ sys.exit(1)
+
+
+def parse(inFileName):
+ doc = minidom.parse(inFileName)
+ rootNode = doc.documentElement
+ rootObj = DoxygenType.factory()
+ rootObj.build(rootNode)
+ # Enable Python to collect the space used by the DOM.
+ doc = None
+ sys.stdout.write('<?xml version="1.0" ?>\n')
+ rootObj.export(sys.stdout, 0, name_="doxygenindex",
+ namespacedef_='')
+ return rootObj
+
+
+def parseString(inString):
+ doc = minidom.parseString(inString)
+ rootNode = doc.documentElement
+ rootObj = DoxygenType.factory()
+ rootObj.build(rootNode)
+ # Enable Python to collect the space used by the DOM.
+ doc = None
+ sys.stdout.write('<?xml version="1.0" ?>\n')
+ rootObj.export(sys.stdout, 0, name_="doxygenindex",
+ namespacedef_='')
+ return rootObj
+
+
+def parseLiteral(inFileName):
+ doc = minidom.parse(inFileName)
+ rootNode = doc.documentElement
+ rootObj = DoxygenType.factory()
+ rootObj.build(rootNode)
+ # Enable Python to collect the space used by the DOM.
+ doc = None
+ sys.stdout.write('from index import *\n\n')
+ sys.stdout.write('rootObj = doxygenindex(\n')
+ rootObj.exportLiteral(sys.stdout, 0, name_="doxygenindex")
+ sys.stdout.write(')\n')
+ return rootObj
+
+
+def main():
+ args = sys.argv[1:]
+ if len(args) == 1:
+ parse(args[0])
+ else:
+ usage()
+
+
+
+
+if __name__ == '__main__':
+ main()
+ #import pdb
+ #pdb.run('main()')
+
diff --git a/gr-utils/src/python/modtool/gr-newmod/docs/doxygen/doxyxml/text.py b/gr-utils/src/python/modtool/gr-newmod/docs/doxygen/doxyxml/text.py
new file mode 100644
index 000000000..629edd180
--- /dev/null
+++ b/gr-utils/src/python/modtool/gr-newmod/docs/doxygen/doxyxml/text.py
@@ -0,0 +1,56 @@
+#
+# Copyright 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.
+#
+"""
+Utilities for extracting text from generated classes.
+"""
+
+def is_string(txt):
+ if isinstance(txt, str):
+ return True
+ try:
+ if isinstance(txt, unicode):
+ return True
+ except NameError:
+ pass
+ return False
+
+def description(obj):
+ if obj is None:
+ return None
+ return description_bit(obj).strip()
+
+def description_bit(obj):
+ if hasattr(obj, 'content'):
+ contents = [description_bit(item) for item in obj.content]
+ result = ''.join(contents)
+ elif hasattr(obj, 'content_'):
+ contents = [description_bit(item) for item in obj.content_]
+ result = ''.join(contents)
+ elif hasattr(obj, 'value'):
+ result = description_bit(obj.value)
+ elif is_string(obj):
+ return obj
+ else:
+ raise StandardError('Expecting a string or something with content, content_ or value attribute')
+ # If this bit is a paragraph then add one some line breaks.
+ if hasattr(obj, 'name') and obj.name == 'para':
+ result += "\n\n"
+ return result
diff --git a/gr-utils/src/python/modtool/gr-newmod/docs/doxygen/other/group_defs.dox b/gr-utils/src/python/modtool/gr-newmod/docs/doxygen/other/group_defs.dox
new file mode 100644
index 000000000..708f8c6d9
--- /dev/null
+++ b/gr-utils/src/python/modtool/gr-newmod/docs/doxygen/other/group_defs.dox
@@ -0,0 +1,7 @@
+/*!
+ * \defgroup block GNU Radio HOWTO C++ Signal Processing Blocks
+ * \brief All C++ blocks that can be used from the HOWTO GNU Radio
+ * module are listed here or in the subcategories below.
+ *
+ */
+
diff --git a/gr-utils/src/python/modtool/gr-newmod/docs/doxygen/other/main_page.dox b/gr-utils/src/python/modtool/gr-newmod/docs/doxygen/other/main_page.dox
new file mode 100644
index 000000000..635704491
--- /dev/null
+++ b/gr-utils/src/python/modtool/gr-newmod/docs/doxygen/other/main_page.dox
@@ -0,0 +1,10 @@
+/*! \mainpage
+
+Welcome to the GNU Radio HOWTO Block
+
+This is the intro page for the Doxygen manual generated for the HOWTO
+block (docs/doxygen/other/main_page.dox). Edit it to add more detailed
+documentation about the new GNU Radio modules contained in this
+project.
+
+*/
diff --git a/gr-utils/src/python/modtool/gr-newmod/docs/doxygen/swig_doc.py b/gr-utils/src/python/modtool/gr-newmod/docs/doxygen/swig_doc.py
new file mode 100644
index 000000000..4e1ce2e47
--- /dev/null
+++ b/gr-utils/src/python/modtool/gr-newmod/docs/doxygen/swig_doc.py
@@ -0,0 +1,255 @@
+#
+# 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.
+#
+"""
+Creates the swig_doc.i SWIG interface file.
+Execute using: python swig_doc.py xml_path outputfilename
+
+The file instructs SWIG to transfer the doxygen comments into the
+python docstrings.
+
+"""
+
+import sys
+
+try:
+ from doxyxml import DoxyIndex, DoxyClass, DoxyFriend, DoxyFunction, DoxyFile, base
+except ImportError:
+ from gnuradio.doxyxml import DoxyIndex, DoxyClass, DoxyFriend, DoxyFunction, DoxyFile, base
+
+
+def py_name(name):
+ bits = name.split('_')
+ return '_'.join(bits[1:])
+
+def make_name(name):
+ bits = name.split('_')
+ return bits[0] + '_make_' + '_'.join(bits[1:])
+
+
+class Block(object):
+ """
+ Checks if doxyxml produced objects correspond to a gnuradio block.
+ """
+
+ @classmethod
+ def includes(cls, item):
+ if not isinstance(item, DoxyClass):
+ return False
+ # Check for a parsing error.
+ if item.error():
+ return False
+ return item.has_member(make_name(item.name()), DoxyFriend)
+
+
+def utoascii(text):
+ """
+ Convert unicode text into ascii and escape quotes.
+ """
+ if text is None:
+ return ''
+ out = text.encode('ascii', 'replace')
+ out = out.replace('"', '\\"')
+ return out
+
+
+def combine_descriptions(obj):
+ """
+ Combines the brief and detailed descriptions of an object together.
+ """
+ description = []
+ bd = obj.brief_description.strip()
+ dd = obj.detailed_description.strip()
+ if bd:
+ description.append(bd)
+ if dd:
+ description.append(dd)
+ return utoascii('\n\n'.join(description)).strip()
+
+
+entry_templ = '%feature("docstring") {name} "{docstring}"'
+def make_entry(obj, name=None, templ="{description}", description=None):
+ """
+ Create a docstring entry for a swig interface file.
+
+ obj - a doxyxml object from which documentation will be extracted.
+ name - the name of the C object (defaults to obj.name())
+ templ - an optional template for the docstring containing only one
+ variable named 'description'.
+ description - if this optional variable is set then it's value is
+ used as the description instead of extracting it from obj.
+ """
+ if name is None:
+ name=obj.name()
+ if "operator " in name:
+ return ''
+ if description is None:
+ description = combine_descriptions(obj)
+ docstring = templ.format(description=description)
+ if not docstring:
+ return ''
+ return entry_templ.format(
+ name=name,
+ docstring=docstring,
+ )
+
+
+def make_func_entry(func, name=None, description=None, params=None):
+ """
+ Create a function docstring entry for a swig interface file.
+
+ func - a doxyxml object from which documentation will be extracted.
+ name - the name of the C object (defaults to func.name())
+ description - if this optional variable is set then it's value is
+ used as the description instead of extracting it from func.
+ params - a parameter list that overrides using func.params.
+ """
+ if params is None:
+ params = func.params
+ params = [prm.declname for prm in params]
+ if params:
+ sig = "Params: (%s)" % ", ".join(params)
+ else:
+ sig = "Params: (NONE)"
+ templ = "{description}\n\n" + sig
+ return make_entry(func, name=name, templ=utoascii(templ),
+ description=description)
+
+
+def make_class_entry(klass, description=None):
+ """
+ Create a class docstring for a swig interface file.
+ """
+ output = []
+ output.append(make_entry(klass, description=description))
+ for func in klass.in_category(DoxyFunction):
+ name = klass.name() + '::' + func.name()
+ output.append(make_func_entry(func, name=name))
+ return "\n\n".join(output)
+
+
+def make_block_entry(di, block):
+ """
+ Create class and function docstrings of a gnuradio block for a
+ swig interface file.
+ """
+ descriptions = []
+ # Get the documentation associated with the class.
+ class_desc = combine_descriptions(block)
+ if class_desc:
+ descriptions.append(class_desc)
+ # Get the documentation associated with the make function
+ make_func = di.get_member(make_name(block.name()), DoxyFunction)
+ make_func_desc = combine_descriptions(make_func)
+ if make_func_desc:
+ descriptions.append(make_func_desc)
+ # Get the documentation associated with the file
+ try:
+ block_file = di.get_member(block.name() + ".h", DoxyFile)
+ file_desc = combine_descriptions(block_file)
+ if file_desc:
+ descriptions.append(file_desc)
+ except base.Base.NoSuchMember:
+ # Don't worry if we can't find a matching file.
+ pass
+ # And join them all together to make a super duper description.
+ super_description = "\n\n".join(descriptions)
+ # Associate the combined description with the class and
+ # the make function.
+ output = []
+ output.append(make_class_entry(block, description=super_description))
+ creator = block.get_member(block.name(), DoxyFunction)
+ output.append(make_func_entry(make_func, description=super_description,
+ params=creator.params))
+ return "\n\n".join(output)
+
+
+def make_swig_interface_file(di, swigdocfilename, custom_output=None):
+
+ output = ["""
+/*
+ * This file was automatically generated using swig_doc.py.
+ *
+ * Any changes to it will be lost next time it is regenerated.
+ */
+"""]
+
+ if custom_output is not None:
+ output.append(custom_output)
+
+ # Create docstrings for the blocks.
+ blocks = di.in_category(Block)
+ make_funcs = set([])
+ for block in blocks:
+ try:
+ make_func = di.get_member(make_name(block.name()), DoxyFunction)
+ make_funcs.add(make_func.name())
+ output.append(make_block_entry(di, block))
+ except block.ParsingError:
+ print('Parsing error for block %s' % block.name())
+
+ # Create docstrings for functions
+ # Don't include the make functions since they have already been dealt with.
+ funcs = [f for f in di.in_category(DoxyFunction) if f.name() not in make_funcs]
+ for f in funcs:
+ try:
+ output.append(make_func_entry(f))
+ except f.ParsingError:
+ print('Parsing error for function %s' % f.name())
+
+ # Create docstrings for classes
+ block_names = [block.name() for block in blocks]
+ klasses = [k for k in di.in_category(DoxyClass) if k.name() not in block_names]
+ for k in klasses:
+ try:
+ output.append(make_class_entry(k))
+ except k.ParsingError:
+ print('Parsing error for class %s' % k.name())
+
+ # Docstrings are not created for anything that is not a function or a class.
+ # If this excludes anything important please add it here.
+
+ output = "\n\n".join(output)
+
+ swig_doc = file(swigdocfilename, 'w')
+ swig_doc.write(output)
+ swig_doc.close()
+
+if __name__ == "__main__":
+ # Parse command line options and set up doxyxml.
+ err_msg = "Execute using: python swig_doc.py xml_path outputfilename"
+ if len(sys.argv) != 3:
+ raise StandardError(err_msg)
+ xml_path = sys.argv[1]
+ swigdocfilename = sys.argv[2]
+ di = DoxyIndex(xml_path)
+
+ # gnuradio.gr.msq_queue.insert_tail and delete_head create errors unless docstrings are defined!
+ # This is presumably a bug in SWIG.
+ #msg_q = di.get_member(u'gr_msg_queue', DoxyClass)
+ #insert_tail = msg_q.get_member(u'insert_tail', DoxyFunction)
+ #delete_head = msg_q.get_member(u'delete_head', DoxyFunction)
+ output = []
+ #output.append(make_func_entry(insert_tail, name='gr_py_msg_queue__insert_tail'))
+ #output.append(make_func_entry(delete_head, name='gr_py_msg_queue__delete_head'))
+ custom_output = "\n\n".join(output)
+
+ # Generate the docstrings interface file.
+ make_swig_interface_file(di, swigdocfilename, custom_output=custom_output)
diff --git a/gr-utils/src/python/modtool/gr-newmod/grc/CMakeLists.txt b/gr-utils/src/python/modtool/gr-newmod/grc/CMakeLists.txt
new file mode 100644
index 000000000..d776de752
--- /dev/null
+++ b/gr-utils/src/python/modtool/gr-newmod/grc/CMakeLists.txt
@@ -0,0 +1,22 @@
+# Copyright 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.
+
+install(FILES
+ DESTINATION share/gnuradio/grc/blocks
+)
diff --git a/gr-utils/src/python/modtool/gr-newmod/include/howto/CMakeLists.txt b/gr-utils/src/python/modtool/gr-newmod/include/howto/CMakeLists.txt
new file mode 100644
index 000000000..1cfb5a6ea
--- /dev/null
+++ b/gr-utils/src/python/modtool/gr-newmod/include/howto/CMakeLists.txt
@@ -0,0 +1,26 @@
+# Copyright 2011,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.
+
+########################################################################
+# Install public header files
+########################################################################
+install(FILES
+ api.h
+ DESTINATION include/howto
+)
diff --git a/gr-utils/src/python/modtool/gr-newmod/include/howto/api.h b/gr-utils/src/python/modtool/gr-newmod/include/howto/api.h
new file mode 100644
index 000000000..5263a1cf7
--- /dev/null
+++ b/gr-utils/src/python/modtool/gr-newmod/include/howto/api.h
@@ -0,0 +1,33 @@
+/*
+ * Copyright 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.
+ */
+
+#ifndef INCLUDED_HOWTO_API_H
+#define INCLUDED_HOWTO_API_H
+
+#include <gruel/attributes.h>
+
+#ifdef gnuradio_howto_EXPORTS
+# define HOWTO_API __GR_ATTR_EXPORT
+#else
+# define HOWTO_API __GR_ATTR_IMPORT
+#endif
+
+#endif /* INCLUDED_HOWTO_API_H */
diff --git a/gr-utils/src/python/modtool/gr-newmod/lib/CMakeLists.txt b/gr-utils/src/python/modtool/gr-newmod/lib/CMakeLists.txt
new file mode 100644
index 000000000..a9df565cf
--- /dev/null
+++ b/gr-utils/src/python/modtool/gr-newmod/lib/CMakeLists.txt
@@ -0,0 +1,66 @@
+# Copyright 2011,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.
+
+########################################################################
+# Setup library
+########################################################################
+include(GrPlatform) #define LIB_SUFFIX
+
+include_directories(${Boost_INCLUDE_DIR})
+link_directories(${Boost_LIBRARY_DIRS})
+
+list(APPEND howto_sources
+)
+
+add_library(gnuradio-howto SHARED ${howto_sources})
+target_link_libraries(gnuradio-howto ${Boost_LIBRARIES} ${GRUEL_LIBRARIES} ${GNURADIO_CORE_LIBRARIES})
+set_target_properties(gnuradio-howto PROPERTIES DEFINE_SYMBOL "gnuradio_howto_EXPORTS")
+
+########################################################################
+# Install built library files
+########################################################################
+install(TARGETS gnuradio-howto
+ LIBRARY DESTINATION lib${LIB_SUFFIX} # .so/.dylib file
+ ARCHIVE DESTINATION lib${LIB_SUFFIX} # .lib file
+ RUNTIME DESTINATION bin # .dll file
+)
+
+########################################################################
+# Build and register unit test
+########################################################################
+include(GrTest)
+
+include_directories(${CPPUNIT_INCLUDE_DIRS})
+
+list(APPEND test_howto_sources
+ ${CMAKE_CURRENT_SOURCE_DIR}/test_howto.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/qa_howto.cc
+)
+
+add_executable(test-howto ${test_howto_sources})
+
+target_link_libraries(
+ test-howto
+ ${GNURADIO_CORE_LIBRARIES}
+ ${Boost_LIBRARIES}
+ ${CPPUNIT_LIBRARIES}
+ gnuradio-howto
+)
+
+GR_ADD_TEST(test_howto test-howto)
diff --git a/gr-utils/src/python/modtool/gr-newmod/lib/qa_howto.cc b/gr-utils/src/python/modtool/gr-newmod/lib/qa_howto.cc
new file mode 100644
index 000000000..f86aed4aa
--- /dev/null
+++ b/gr-utils/src/python/modtool/gr-newmod/lib/qa_howto.cc
@@ -0,0 +1,36 @@
+/*
+ * 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.
+ */
+
+/*
+ * This class gathers together all the test cases for the gr-filter
+ * directory into a single test suite. As you create new test cases,
+ * add them here.
+ */
+
+#include "qa_howto.h"
+
+CppUnit::TestSuite *
+qa_howto::suite()
+{
+ CppUnit::TestSuite *s = new CppUnit::TestSuite("howto");
+
+ return s;
+}
diff --git a/gr-utils/src/python/modtool/gr-newmod/lib/qa_howto.h b/gr-utils/src/python/modtool/gr-newmod/lib/qa_howto.h
new file mode 100644
index 000000000..8eff956b6
--- /dev/null
+++ b/gr-utils/src/python/modtool/gr-newmod/lib/qa_howto.h
@@ -0,0 +1,38 @@
+/* -*- 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.
+ */
+
+#ifndef _QA_HOWTO_H_
+#define _QA_HOWTO_H_
+
+#include <gruel/attributes.h>
+#include <cppunit/TestSuite.h>
+
+//! collect all the tests for the gr-filter directory
+
+class __GR_ATTR_EXPORT qa_howto
+{
+ public:
+ //! return suite of tests for all of gr-filter directory
+ static CppUnit::TestSuite *suite();
+};
+
+#endif /* _QA_HOWTO_H_ */
diff --git a/gr-utils/src/python/modtool/gr-newmod/lib/test_howto.cc b/gr-utils/src/python/modtool/gr-newmod/lib/test_howto.cc
new file mode 100644
index 000000000..bf344265d
--- /dev/null
+++ b/gr-utils/src/python/modtool/gr-newmod/lib/test_howto.cc
@@ -0,0 +1,43 @@
+/* -*- 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.
+ */
+
+#include <cppunit/TextTestRunner.h>
+#include <cppunit/XmlOutputter.h>
+
+#include <gr_unittests.h>
+#include "qa_howto.h"
+#include <iostream>
+
+int
+main (int argc, char **argv)
+{
+ CppUnit::TextTestRunner runner;
+ std::ofstream xmlfile(get_unittest_path("howto.xml").c_str());
+ CppUnit::XmlOutputter *xmlout = new CppUnit::XmlOutputter(&runner.result(), xmlfile);
+
+ runner.addTest(qa_howto::suite());
+ runner.setOutputter(xmlout);
+
+ bool was_successful = runner.run("", false);
+
+ return was_successful ? 0 : 1;
+}
diff --git a/gr-utils/src/python/modtool/gr-newmod/python/CMakeLists.txt b/gr-utils/src/python/modtool/gr-newmod/python/CMakeLists.txt
new file mode 100644
index 000000000..9901854c8
--- /dev/null
+++ b/gr-utils/src/python/modtool/gr-newmod/python/CMakeLists.txt
@@ -0,0 +1,43 @@
+# Copyright 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.
+
+########################################################################
+# Include python install macros
+########################################################################
+include(GrPython)
+if(NOT PYTHONINTERP_FOUND)
+ return()
+endif()
+
+########################################################################
+# Install python sources
+########################################################################
+GR_PYTHON_INSTALL(
+ FILES
+ __init__.py
+ DESTINATION ${GR_PYTHON_DIR}/howto
+)
+
+########################################################################
+# Handle the unit tests
+########################################################################
+include(GrTest)
+
+set(GR_TEST_TARGET_DEPS gnuradio-howto)
+set(GR_TEST_PYTHON_DIRS ${CMAKE_BINARY_DIR}/swig)
diff --git a/gr-utils/src/python/modtool/gr-newmod/python/__init__.py b/gr-utils/src/python/modtool/gr-newmod/python/__init__.py
new file mode 100644
index 000000000..575cbfc22
--- /dev/null
+++ b/gr-utils/src/python/modtool/gr-newmod/python/__init__.py
@@ -0,0 +1,54 @@
+#
+# Copyright 2008,2009 Free Software Foundation, Inc.
+#
+# This application 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.
+#
+# This application 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 this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+
+# The presence of this file turns this directory into a Python package
+
+'''
+This is the GNU Radio HOWTO module. Place your Python package
+description here (python/__init__.py).
+'''
+
+# ----------------------------------------------------------------
+# Temporary workaround for ticket:181 (swig+python problem)
+import sys
+_RTLD_GLOBAL = 0
+try:
+ from dl import RTLD_GLOBAL as _RTLD_GLOBAL
+except ImportError:
+ try:
+ from DLFCN import RTLD_GLOBAL as _RTLD_GLOBAL
+ except ImportError:
+ pass
+
+if _RTLD_GLOBAL != 0:
+ _dlopenflags = sys.getdlopenflags()
+ sys.setdlopenflags(_dlopenflags|_RTLD_GLOBAL)
+# ----------------------------------------------------------------
+
+
+# import swig generated symbols into the howto namespace
+from howto_swig import *
+
+# import any pure python here
+#
+
+# ----------------------------------------------------------------
+# Tail of workaround
+if _RTLD_GLOBAL != 0:
+ sys.setdlopenflags(_dlopenflags) # Restore original flags
+# ----------------------------------------------------------------
diff --git a/gr-utils/src/python/modtool/gr-newmod/swig/CMakeLists.txt b/gr-utils/src/python/modtool/gr-newmod/swig/CMakeLists.txt
new file mode 100644
index 000000000..1e3e59e2c
--- /dev/null
+++ b/gr-utils/src/python/modtool/gr-newmod/swig/CMakeLists.txt
@@ -0,0 +1,61 @@
+# Copyright 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.
+
+########################################################################
+# Include swig generation macros
+########################################################################
+find_package(SWIG)
+find_package(PythonLibs)
+if(NOT SWIG_FOUND OR NOT PYTHONLIBS_FOUND)
+ return()
+endif()
+include(GrSwig)
+include(GrPython)
+
+########################################################################
+# Setup swig generation
+########################################################################
+foreach(incdir ${GNURADIO_CORE_INCLUDE_DIRS})
+ list(APPEND GR_SWIG_INCLUDE_DIRS ${incdir}/swig)
+endforeach(incdir)
+
+foreach(incdir ${GRUEL_INCLUDE_DIRS})
+ list(APPEND GR_SWIG_INCLUDE_DIRS ${incdir}/gruel/swig)
+endforeach(incdir)
+
+set(GR_SWIG_LIBRARIES gnuradio-howto)
+set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/howto_swig_doc.i)
+set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include)
+
+GR_SWIG_MAKE(howto_swig howto_swig.i)
+
+########################################################################
+# Install the build swig module
+########################################################################
+GR_SWIG_INSTALL(TARGETS howto_swig DESTINATION ${GR_PYTHON_DIR}/howto)
+
+########################################################################
+# Install swig .i files for development
+########################################################################
+install(
+ FILES
+ howto_swig.i
+ ${CMAKE_CURRENT_BINARY_DIR}/howto_swig_doc.i
+ DESTINATION ${GR_INCLUDE_DIR}/howto/swig
+)
diff --git a/gr-utils/src/python/modtool/gr-newmod/swig/howto_swig.i b/gr-utils/src/python/modtool/gr-newmod/swig/howto_swig.i
new file mode 100644
index 000000000..4627d48d3
--- /dev/null
+++ b/gr-utils/src/python/modtool/gr-newmod/swig/howto_swig.i
@@ -0,0 +1,13 @@
+/* -*- c++ -*- */
+
+#define HOWTO_API
+
+%include "gnuradio.i" // the common stuff
+
+//load generated python docstrings
+%include "howto_swig_doc.i"
+
+%{
+%}
+
+
diff --git a/gr-utils/src/python/modtool/grc_xml_generator.py b/gr-utils/src/python/modtool/grc_xml_generator.py
new file mode 100644
index 000000000..7ccd44319
--- /dev/null
+++ b/gr-utils/src/python/modtool/grc_xml_generator.py
@@ -0,0 +1,104 @@
+#
+# Copyright 2013 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.
+#
+import xml.etree.ElementTree as ET
+from util_functions import is_number, xml_indent
+
+try:
+ import lxml.etree
+ LXML_IMPORTED = True
+except ImportError:
+ LXML_IMPORTED = False
+
+class GRCXMLGenerator(object):
+ """ Create and write the XML bindings for a GRC block. """
+ def __init__(self, modname=None, blockname=None, doc=None, params=None, iosig=None):
+ """docstring for __init__"""
+ params_list = ['$'+s['key'] for s in params if s['in_constructor']]
+ # Can't make a dict 'cause order matters
+ self._header = (('name', blockname.replace('_', ' ').capitalize()),
+ ('key', '%s_%s' % (modname, blockname)),
+ ('category', modname.upper()),
+ ('import', 'import %s' % modname),
+ ('make', '%s.%s(%s)' % (modname, blockname, ', '.join(params_list)))
+ )
+ self.params = params
+ self.iosig = iosig
+ self.doc = doc
+ self.root = None
+ if LXML_IMPORTED:
+ self._prettyprint = self._lxml_prettyprint
+ else:
+ self._prettyprint = self._manual_prettyprint
+
+ def _lxml_prettyprint(self):
+ """ XML pretty printer using lxml """
+ return lxml.etree.tostring(
+ lxml.etree.fromstring(ET.tostring(self.root, encoding="UTF-8")),
+ pretty_print=True
+ )
+
+ def _manual_prettyprint(self):
+ """ XML pretty printer using xml_indent """
+ xml_indent(self.root)
+ return ET.tostring(self.root, encoding="UTF-8")
+
+ def make_xml(self):
+ """ Create the actual tag tree """
+ root = ET.Element("block")
+ iosig = self.iosig
+ for tag, value in self._header:
+ this_tag = ET.SubElement(root, tag)
+ this_tag.text = value
+ for param in self.params:
+ param_tag = ET.SubElement(root, 'param')
+ ET.SubElement(param_tag, 'name').text = param['key'].capitalize()
+ ET.SubElement(param_tag, 'key').text = param['key']
+ if len(param['default']):
+ ET.SubElement(param_tag, 'value').text = param['default']
+ ET.SubElement(param_tag, 'type').text = param['type']
+ for inout in sorted(iosig.keys()):
+ if iosig[inout]['max_ports'] == '0':
+ continue
+ for i in range(len(iosig[inout]['type'])):
+ s_tag = ET.SubElement(root, {'in': 'sink', 'out': 'source'}[inout])
+ ET.SubElement(s_tag, 'name').text = inout
+ ET.SubElement(s_tag, 'type').text = iosig[inout]['type'][i]
+ if iosig[inout]['vlen'][i] != '1':
+ vlen = iosig[inout]['vlen'][i]
+ if is_number(vlen):
+ ET.SubElement(s_tag, 'vlen').text = vlen
+ else:
+ ET.SubElement(s_tag, 'vlen').text = '$'+vlen
+ if i == len(iosig[inout]['type'])-1:
+ if not is_number(iosig[inout]['max_ports']):
+ ET.SubElement(s_tag, 'nports').text = iosig[inout]['max_ports']
+ elif len(iosig[inout]['type']) < int(iosig[inout]['max_ports']):
+ ET.SubElement(s_tag, 'nports').text = str(int(iosig[inout]['max_ports']) -
+ len(iosig[inout]['type'])+1)
+ if self.doc is not None:
+ ET.SubElement(root, 'doc').text = self.doc
+ self.root = root
+
+ def save(self, filename):
+ """ Write the XML file """
+ self.make_xml()
+ open(filename, 'w').write(self._prettyprint())
+
diff --git a/gr-utils/src/python/modtool/modtool.conf.in b/gr-utils/src/python/modtool/modtool.conf.in
new file mode 100644
index 000000000..8b3df1b9c
--- /dev/null
+++ b/gr-utils/src/python/modtool/modtool.conf.in
@@ -0,0 +1,6 @@
+# This file contains system wide configuration data for GNU Radio.
+# You may override any setting on a per-user basis by editing
+# ~/.gnuradio/config.conf
+
+[modtool]
+newmod_path = @newmoddir@
diff --git a/gr-utils/src/python/modtool/modtool_add.py b/gr-utils/src/python/modtool/modtool_add.py
new file mode 100644
index 000000000..e1d61cf0f
--- /dev/null
+++ b/gr-utils/src/python/modtool/modtool_add.py
@@ -0,0 +1,310 @@
+#
+# Copyright 2013 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.
+#
+""" Module to add new blocks """
+
+import os
+import sys
+import re
+from optparse import OptionGroup
+
+from util_functions import append_re_line_sequence, ask_yes_no
+from cmakefile_editor import CMakeFileEditor
+from modtool_base import ModTool
+from templates import Templates
+from code_generator import get_template
+import Cheetah.Template
+
+class ModToolAdd(ModTool):
+ """ Add block to the out-of-tree module. """
+ name = 'add'
+ aliases = ('insert',)
+ _block_types = ('sink', 'source', 'sync', 'decimator', 'interpolator',
+ 'general', 'hier', 'noblock')
+ def __init__(self):
+ ModTool.__init__(self)
+ self._add_cc_qa = False
+ self._add_py_qa = False
+
+ def setup_parser(self):
+ parser = ModTool.setup_parser(self)
+ ogroup = OptionGroup(parser, "Add module options")
+ ogroup.add_option("-t", "--block-type", type="choice",
+ choices=self._block_types, default=None, help="One of %s." % ', '.join(self._block_types))
+ ogroup.add_option("--license-file", type="string", default=None,
+ help="File containing the license header for every source code file.")
+ ogroup.add_option("--argument-list", type="string", default=None,
+ help="The argument list for the constructor and make functions.")
+ ogroup.add_option("--add-python-qa", action="store_true", default=None,
+ help="If given, Python QA code is automatically added if possible.")
+ ogroup.add_option("--add-cpp-qa", action="store_true", default=None,
+ help="If given, C++ QA code is automatically added if possible.")
+ ogroup.add_option("--skip-cmakefiles", action="store_true", default=False,
+ help="If given, only source files are written, but CMakeLists.txt files are left unchanged.")
+ ogroup.add_option("-l", "--lang", type="choice", choices=('cpp', 'c++', 'python'),
+ default='cpp', help="Language (cpp or python)")
+ parser.add_option_group(ogroup)
+ return parser
+
+ def setup(self):
+ ModTool.setup(self)
+ options = self.options
+ self._info['blocktype'] = options.block_type
+ if self._info['blocktype'] is None:
+ while self._info['blocktype'] not in self._block_types:
+ self._info['blocktype'] = raw_input("Enter code type: ")
+ if self._info['blocktype'] not in self._block_types:
+ print 'Must be one of ' + str(self._block_types)
+ self._info['lang'] = options.lang
+ if self._info['lang'] == 'c++':
+ self._info['lang'] = 'cpp'
+ print "Language: %s" % {'cpp': 'C++', 'python': 'Python'}[self._info['lang']]
+
+ if ((self._skip_subdirs['lib'] and self._info['lang'] == 'cpp')
+ or (self._skip_subdirs['python'] and self._info['lang'] == 'python')):
+ print "Missing or skipping relevant subdir."
+ exit(1)
+
+ if self._info['blockname'] is None:
+ if len(self.args) >= 2:
+ self._info['blockname'] = self.args[1]
+ else:
+ self._info['blockname'] = raw_input("Enter name of block/code (without module name prefix): ")
+ if not re.match('[a-zA-Z0-9_]+', self._info['blockname']):
+ print 'Invalid block name.'
+ exit(2)
+ print "Block/code identifier: " + self._info['blockname']
+ self._info['fullblockname'] = self._info['modname'] + '_' + self._info['blockname']
+ self._info['license'] = self.setup_choose_license()
+
+ if options.argument_list is not None:
+ self._info['arglist'] = options.argument_list
+ else:
+ self._info['arglist'] = raw_input('Enter valid argument list, including default arguments: ')
+
+ if not (self._info['blocktype'] in ('noblock') or self._skip_subdirs['python']):
+ self._add_py_qa = options.add_python_qa
+ if self._add_py_qa is None:
+ self._add_py_qa = ask_yes_no('Add Python QA code?', True)
+ if self._info['lang'] == 'cpp':
+ self._add_cc_qa = options.add_cpp_qa
+ if self._add_cc_qa is None:
+ self._add_cc_qa = ask_yes_no('Add C++ QA code?', not self._add_py_qa)
+ if self._info['version'] == 'autofoo' and not self.options.skip_cmakefiles:
+ print "Warning: Autotools modules are not supported. ",
+ print "Files will be created, but Makefiles will not be edited."
+ self.options.skip_cmakefiles = True
+
+
+ def setup_choose_license(self):
+ """ Select a license by the following rules, in this order:
+ 1) The contents of the file given by --license-file
+ 2) The contents of the file LICENSE or LICENCE in the modules
+ top directory
+ 3) The default license. """
+ if self.options.license_file is not None \
+ and os.path.isfile(self.options.license_file):
+ return open(self.options.license_file).read()
+ elif os.path.isfile('LICENSE'):
+ return open('LICENSE').read()
+ elif os.path.isfile('LICENCE'):
+ return open('LICENCE').read()
+ else:
+ return Templates['defaultlicense']
+
+ def _write_tpl(self, tpl, path, fname):
+ """ Shorthand for writing a substituted template to a file"""
+ print "Adding file '%s'..." % fname
+ open(os.path.join(path, fname), 'w').write(get_template(tpl, **self._info))
+
+ def run(self):
+ """ Go, go, go. """
+ has_swig = (
+ self._info['lang'] == 'cpp'
+ and not self._skip_subdirs['swig']
+ )
+ has_grc = False
+ if self._info['lang'] == 'cpp':
+ self._run_lib()
+ has_grc = has_swig
+ else: # Python
+ self._run_python()
+ if self._info['blocktype'] != 'noblock':
+ has_grc = True
+ if has_swig:
+ self._run_swig()
+ if self._add_py_qa:
+ self._run_python_qa()
+ if has_grc and not self._skip_subdirs['grc']:
+ self._run_grc()
+
+ def _run_lib(self):
+ """ Do everything that needs doing in the subdir 'lib' and 'include'.
+ - add .cc and .h files
+ - include them into CMakeLists.txt
+ - check if C++ QA code is req'd
+ - if yes, create qa_*.{cc,h} and add them to CMakeLists.txt
+ """
+ def _add_qa():
+ " Add C++ QA files for 3.7 API "
+ fname_qa_h = 'qa_%s.h' % self._info['blockname']
+ fname_qa_cc = 'qa_%s.cc' % self._info['blockname']
+ self._write_tpl('qa_cpp', 'lib', fname_qa_cc)
+ self._write_tpl('qa_h', 'lib', fname_qa_h)
+ if not self.options.skip_cmakefiles:
+ try:
+ append_re_line_sequence(self._file['cmlib'],
+ '\$\{CMAKE_CURRENT_SOURCE_DIR\}/qa_%s.cc.*\n' % self._info['modname'],
+ ' ${CMAKE_CURRENT_SOURCE_DIR}/qa_%s.cc' % self._info['blockname'])
+ append_re_line_sequence(self._file['qalib'],
+ '#include.*\n',
+ '#include "%s"' % fname_qa_h)
+ append_re_line_sequence(self._file['qalib'],
+ '(addTest.*suite.*\n|new CppUnit.*TestSuite.*\n)',
+ ' s->addTest(gr::%s::qa_%s::suite());' % (self._info['modname'],
+ self._info['blockname'])
+ )
+ except IOError:
+ print "Can't add C++ QA files."
+ def _add_qa36():
+ " Add C++ QA files for pre-3.7 API (not autotools) "
+ fname_qa_cc = 'qa_%s.cc' % self._info['fullblockname']
+ self._write_tpl('qa_cpp36', 'lib', fname_qa_cc)
+ if not self.options.skip_cmakefiles:
+ open(self._file['cmlib'], 'a').write(
+ str(
+ Cheetah.Template.Template(
+ Templates['qa_cmakeentry36'],
+ searchList={'basename': os.path.splitext(fname_qa_cc)[0],
+ 'filename': fname_qa_cc,
+ 'modname': self._info['modname']
+ }
+ )
+ )
+ )
+ ed = CMakeFileEditor(self._file['cmlib'])
+ ed.remove_double_newlines()
+ ed.write()
+ fname_cc = None
+ fname_h = None
+ if self._info['version'] == '37':
+ fname_h = self._info['blockname'] + '.h'
+ fname_cc = self._info['blockname'] + '.cc'
+ if self._info['blocktype'] in ('source', 'sink', 'sync', 'decimator',
+ 'interpolator', 'general', 'hier'):
+ fname_cc = self._info['blockname'] + '_impl.cc'
+ self._write_tpl('block_impl_h', 'lib', self._info['blockname'] + '_impl.h')
+ self._write_tpl('block_impl_cpp', 'lib', fname_cc)
+ self._write_tpl('block_def_h', self._info['includedir'], fname_h)
+ else: # Pre-3.7 or autotools
+ fname_h = self._info['fullblockname'] + '.h'
+ fname_cc = self._info['fullblockname'] + '.cc'
+ self._write_tpl('block_h36', self._info['includedir'], fname_h)
+ self._write_tpl('block_cpp36', 'lib', fname_cc)
+ if not self.options.skip_cmakefiles:
+ ed = CMakeFileEditor(self._file['cmlib'])
+ if not ed.append_value('list', fname_cc, to_ignore_start='APPEND %s_sources' % self._info['modname']):
+ ed.append_value('add_library', fname_cc)
+ ed.write()
+ ed = CMakeFileEditor(self._file['cminclude'])
+ ed.append_value('install', fname_h, to_ignore_end='DESTINATION[^()]+')
+ ed.write()
+ if self._add_cc_qa:
+ if self._info['version'] == '37':
+ _add_qa()
+ elif self._info['version'] == '36':
+ _add_qa36()
+ elif self._info['version'] == 'autofoo':
+ print "Warning: C++ QA files not supported for autotools."
+
+ def _run_swig(self):
+ """ Do everything that needs doing in the subdir 'swig'.
+ - Edit main *.i file
+ """
+ if self._get_mainswigfile() is None:
+ print 'Warning: No main swig file found.'
+ return
+ print "Editing %s..." % self._file['swig']
+ mod_block_sep = '/'
+ if self._info['version'] == '36':
+ mod_block_sep = '_'
+ swig_block_magic_str = get_template('swig_block_magic', **self._info)
+ open(self._file['swig'], 'a').write(swig_block_magic_str)
+ include_str = '#include "%s%s%s.h"' % (
+ self._info['modname'],
+ mod_block_sep,
+ self._info['blockname'])
+ if re.search('#include', open(self._file['swig'], 'r').read()):
+ append_re_line_sequence(self._file['swig'], '^#include.*\n', include_str)
+ else: # I.e., if the swig file is empty
+ oldfile = open(self._file['swig'], 'r').read()
+ regexp = re.compile('^%\{\n', re.MULTILINE)
+ oldfile = regexp.sub('%%{\n%s\n' % include_str, oldfile, count=1)
+ open(self._file['swig'], 'w').write(oldfile)
+
+ def _run_python_qa(self):
+ """ Do everything that needs doing in the subdir 'python' to add
+ QA code.
+ - add .py files
+ - include in CMakeLists.txt
+ """
+ fname_py_qa = 'qa_' + self._info['blockname'] + '.py'
+ self._write_tpl('qa_python', 'python', fname_py_qa)
+ os.chmod(os.path.join('python', fname_py_qa), 0755)
+ if self.options.skip_cmakefiles or CMakeFileEditor(self._file['cmpython']).check_for_glob('qa_*.py'):
+ return
+ print "Editing python/CMakeLists.txt..."
+ open(self._file['cmpython'], 'a').write(
+ 'GR_ADD_TEST(qa_%s ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/%s)\n' % \
+ (self._info['blockname'], fname_py_qa))
+
+ def _run_python(self):
+ """ Do everything that needs doing in the subdir 'python' to add
+ a Python block.
+ - add .py file
+ - include in CMakeLists.txt
+ - include in __init__.py
+ """
+ fname_py = self._info['blockname'] + '.py'
+ self._write_tpl('block_python', 'python', fname_py)
+ append_re_line_sequence(self._file['pyinit'],
+ '(^from.*import.*\n|# import any pure.*\n)',
+ 'from %s import %s' % (self._info['blockname'], self._info['blockname']))
+ if self.options.skip_cmakefiles:
+ return
+ ed = CMakeFileEditor(self._file['cmpython'])
+ ed.append_value('GR_PYTHON_INSTALL', fname_py, to_ignore_end='DESTINATION[^()]+')
+ ed.write()
+
+ def _run_grc(self):
+ """ Do everything that needs doing in the subdir 'grc' to add
+ a GRC bindings XML file.
+ - add .xml file
+ - include in CMakeLists.txt
+ """
+ fname_grc = self._info['fullblockname'] + '.xml'
+ self._write_tpl('grc_xml', 'grc', fname_grc)
+ ed = CMakeFileEditor(self._file['cmgrc'], '\n ')
+ if self.options.skip_cmakefiles or ed.check_for_glob('*.xml'):
+ return
+ print "Editing grc/CMakeLists.txt..."
+ ed.append_value('install', fname_grc, to_ignore_end='DESTINATION[^()]+')
+ ed.write()
+
diff --git a/gr-utils/src/python/modtool/modtool_base.py b/gr-utils/src/python/modtool/modtool_base.py
new file mode 100644
index 000000000..3f8f2bc3c
--- /dev/null
+++ b/gr-utils/src/python/modtool/modtool_base.py
@@ -0,0 +1,176 @@
+#
+# Copyright 2013 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.
+#
+""" Base class for the modules """
+
+import os
+import re
+import sys
+from optparse import OptionParser, OptionGroup
+
+from util_functions import get_modname
+from templates import Templates
+
+
+class ModTool(object):
+ """ Base class for all modtool command classes. """
+ def __init__(self):
+ self._subdirs = ['lib', 'include', 'python', 'swig', 'grc'] # List subdirs where stuff happens
+ self._has_subdirs = {}
+ self._skip_subdirs = {}
+ self._info = {}
+ self._file = {}
+ for subdir in self._subdirs:
+ self._has_subdirs[subdir] = False
+ self._skip_subdirs[subdir] = False
+ self.parser = self.setup_parser()
+ self.args = None
+ self.options = None
+ self._dir = None
+
+ def setup_parser(self):
+ """ Init the option parser. If derived classes need to add options,
+ override this and call the parent function. """
+ parser = OptionParser(add_help_option=False)
+ parser.usage = '%prog ' + self.name + ' [options] <PATTERN> \n' + \
+ ' Call "%prog ' + self.name + '" without any options to run it interactively.'
+ ogroup = OptionGroup(parser, "General options")
+ ogroup.add_option("-h", "--help", action="help", help="Displays this help message.")
+ ogroup.add_option("-d", "--directory", type="string", default=".",
+ help="Base directory of the module. Defaults to the cwd.")
+ ogroup.add_option("-n", "--module-name", type="string", default=None,
+ help="Use this to override the current module's name (is normally autodetected).")
+ ogroup.add_option("-N", "--block-name", type="string", default=None,
+ help="Name of the block, where applicable.")
+ ogroup.add_option("--skip-lib", action="store_true", default=False,
+ help="Don't do anything in the lib/ subdirectory.")
+ ogroup.add_option("--skip-swig", action="store_true", default=False,
+ help="Don't do anything in the swig/ subdirectory.")
+ ogroup.add_option("--skip-python", action="store_true", default=False,
+ help="Don't do anything in the python/ subdirectory.")
+ ogroup.add_option("--skip-grc", action="store_true", default=False,
+ help="Don't do anything in the grc/ subdirectory.")
+ ogroup.add_option("-y", "--yes", action="store_true", default=False,
+ help="Answer all questions with 'yes'. This can overwrite and delete your files, so be careful.")
+ parser.add_option_group(ogroup)
+ return parser
+
+ def setup(self):
+ """ Initialise all internal variables, such as the module name etc. """
+ (options, self.args) = self.parser.parse_args()
+ self._dir = options.directory
+ if not self._check_directory(self._dir):
+ print "No GNU Radio module found in the given directory. Quitting."
+ sys.exit(1)
+ if options.module_name is not None:
+ self._info['modname'] = options.module_name
+ else:
+ self._info['modname'] = get_modname()
+ if self._info['modname'] is None:
+ print "No GNU Radio module found in the given directory. Quitting."
+ sys.exit(1)
+ print "GNU Radio module name identified: " + self._info['modname']
+ if self._info['version'] == '36' and os.path.isdir(os.path.join('include', self._info['modname'])):
+ self._info['version'] = '37'
+ if options.skip_lib or not self._has_subdirs['lib']:
+ self._skip_subdirs['lib'] = True
+ if options.skip_python or not self._has_subdirs['python']:
+ self._skip_subdirs['python'] = True
+ if options.skip_swig or self._get_mainswigfile() is None or not self._has_subdirs['swig']:
+ self._skip_subdirs['swig'] = True
+ if options.skip_grc or not self._has_subdirs['grc']:
+ self._skip_subdirs['grc'] = True
+ self._info['blockname'] = options.block_name
+ self.options = options
+ self._setup_files()
+ self._info['yes'] = options.yes
+
+ def _setup_files(self):
+ """ Initialise the self._file[] dictionary """
+ if not self._skip_subdirs['swig']:
+ self._file['swig'] = os.path.join('swig', self._get_mainswigfile())
+ self._file['qalib'] = os.path.join('lib', 'qa_%s.cc' % self._info['modname'])
+ self._file['pyinit'] = os.path.join('python', '__init__.py')
+ self._file['cmlib'] = os.path.join('lib', 'CMakeLists.txt')
+ self._file['cmgrc'] = os.path.join('grc', 'CMakeLists.txt')
+ self._file['cmpython'] = os.path.join('python', 'CMakeLists.txt')
+ if self._info['version'] in ('37', 'component'):
+ self._info['includedir'] = os.path.join('include', self._info['modname'])
+ else:
+ self._info['includedir'] = 'include'
+ self._file['cminclude'] = os.path.join(self._info['includedir'], 'CMakeLists.txt')
+ self._file['cmswig'] = os.path.join('swig', 'CMakeLists.txt')
+
+ def _check_directory(self, directory):
+ """ Guesses if dir is a valid GNU Radio module directory by looking for
+ CMakeLists.txt and at least one of the subdirs lib/, python/ and swig/.
+ Changes the directory, if valid. """
+ has_makefile = False
+ try:
+ files = os.listdir(directory)
+ os.chdir(directory)
+ except OSError:
+ print "Can't read or chdir to directory %s." % directory
+ return False
+ for f in files:
+ if os.path.isfile(f) and f == 'CMakeLists.txt':
+ if re.search('find_package\(GnuradioCore\)', open(f).read()) is not None:
+ self._info['version'] = '36' # Might be 37, check that later
+ has_makefile = True
+ elif re.search('GR_REGISTER_COMPONENT', open(f).read()) is not None:
+ self._info['version'] = '36' # Might be 37, check that later
+ self._info['is_component'] = True
+ has_makefile = True
+ # TODO search for autofoo
+ elif os.path.isdir(f):
+ if (f in self._has_subdirs.keys()):
+ self._has_subdirs[f] = True
+ else:
+ self._skip_subdirs[f] = True
+ return bool(has_makefile and (self._has_subdirs.values()))
+
+ def _get_mainswigfile(self):
+ """ Find out which name the main SWIG file has. In particular, is it
+ a MODNAME.i or a MODNAME_swig.i? Returns None if none is found. """
+ modname = self._info['modname']
+ swig_files = (modname + '.i',
+ modname + '_swig.i')
+ for fname in swig_files:
+ if os.path.isfile(os.path.join(self._dir, 'swig', fname)):
+ return fname
+ return None
+
+ def run(self):
+ """ Override this. """
+ pass
+
+def get_class_dict(the_globals):
+ " Return a dictionary of the available commands in the form command->class "
+ classdict = {}
+ for g in the_globals:
+ try:
+ if issubclass(g, ModTool):
+ classdict[g.name] = g
+ for a in g.aliases:
+ classdict[a] = g
+ except (TypeError, AttributeError):
+ pass
+ return classdict
+
diff --git a/gr-utils/src/python/modtool/modtool_disable.py b/gr-utils/src/python/modtool/modtool_disable.py
new file mode 100644
index 000000000..36725e557
--- /dev/null
+++ b/gr-utils/src/python/modtool/modtool_disable.py
@@ -0,0 +1,148 @@
+#
+# Copyright 2013 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.
+#
+""" Disable blocks module """
+
+import os
+import re
+import sys
+from optparse import OptionGroup
+
+from modtool_base import ModTool
+from cmakefile_editor import CMakeFileEditor
+
+class ModToolDisable(ModTool):
+ """ Disable block (comments out CMake entries for files) """
+ name = 'disable'
+ aliases = ('dis',)
+ def __init__(self):
+ ModTool.__init__(self)
+
+ def setup(self):
+ ModTool.setup(self)
+ options = self.options
+ if options.block_name is not None:
+ self._info['pattern'] = options.block_name
+ elif len(self.args) >= 2:
+ self._info['pattern'] = self.args[1]
+ else:
+ self._info['pattern'] = raw_input('Which blocks do you want to disable? (Regex): ')
+ if len(self._info['pattern']) == 0:
+ self._info['pattern'] = '.'
+
+ def run(self):
+ """ Go, go, go! """
+ def _handle_py_qa(cmake, fname):
+ """ Do stuff for py qa """
+ cmake.comment_out_lines('GR_ADD_TEST.*'+fname)
+ return True
+ def _handle_py_mod(cmake, fname):
+ """ Do stuff for py extra files """
+ try:
+ initfile = open(self._file['pyinit']).read()
+ except IOError:
+ print "Could not edit __init__.py, that might be a problem."
+ return False
+ pymodname = os.path.splitext(fname)[0]
+ initfile = re.sub(r'((from|import)\s+\b'+pymodname+r'\b)', r'#\1', initfile)
+ open(self._file['pyinit'], 'w').write(initfile)
+ return False
+ def _handle_cc_qa(cmake, fname):
+ """ Do stuff for cc qa """
+ if self._info['version'] == '37':
+ cmake.comment_out_lines('\$\{CMAKE_CURRENT_SOURCE_DIR\}/'+fname)
+ fname_base = os.path.splitext(fname)[0]
+ ed = CMakeFileEditor(self._file['qalib']) # Abusing the CMakeFileEditor...
+ ed.comment_out_lines('#include\s+"%s.h"' % fname_base, comment_str='//')
+ ed.comment_out_lines('%s::suite\(\)' % fname_base, comment_str='//')
+ ed.write()
+ elif self._info['version'] == '36':
+ cmake.comment_out_lines('add_executable.*'+fname)
+ cmake.comment_out_lines('target_link_libraries.*'+os.path.splitext(fname)[0])
+ cmake.comment_out_lines('GR_ADD_TEST.*'+os.path.splitext(fname)[0])
+ return True
+ def _handle_h_swig(cmake, fname):
+ """ Comment out include files from the SWIG file,
+ as well as the block magic """
+ swigfile = open(self._file['swig']).read()
+ (swigfile, nsubs) = re.subn('(.include\s+"(%s/)?%s")' % (
+ self._info['modname'], fname),
+ r'//\1', swigfile)
+ if nsubs > 0:
+ print "Changing %s..." % self._file['swig']
+ if nsubs > 1: # Need to find a single BLOCK_MAGIC
+ blockname = os.path.splitext(fname[len(self._info['modname'])+1:])[0]
+ if self._info['version'] == '37':
+ blockname = os.path.splitext(fname)[0]
+ (swigfile, nsubs) = re.subn('(GR_SWIG_BLOCK_MAGIC2?.+%s.+;)' % blockname, r'//\1', swigfile)
+ if nsubs > 1:
+ print "Hm, changed more then expected while editing %s." % self._file['swig']
+ open(self._file['swig'], 'w').write(swigfile)
+ return False
+ def _handle_i_swig(cmake, fname):
+ """ Comment out include files from the SWIG file,
+ as well as the block magic """
+ swigfile = open(self._file['swig']).read()
+ blockname = os.path.splitext(fname[len(self._info['modname'])+1:])[0]
+ if self._info['version'] == '37':
+ blockname = os.path.splitext(fname)[0]
+ swigfile = re.sub('(%include\s+"'+fname+'")', r'//\1', swigfile)
+ print "Changing %s..." % self._file['swig']
+ swigfile = re.sub('(GR_SWIG_BLOCK_MAGIC2?.+'+blockname+'.+;)', r'//\1', swigfile)
+ open(self._file['swig'], 'w').write(swigfile)
+ return False
+ # List of special rules: 0: subdir, 1: filename re match, 2: callback
+ special_treatments = (
+ ('python', 'qa.+py$', _handle_py_qa),
+ ('python', '^(?!qa).+py$', _handle_py_mod),
+ ('lib', 'qa.+\.cc$', _handle_cc_qa),
+ ('include/%s' % self._info['modname'], '.+\.h$', _handle_h_swig),
+ ('include', '.+\.h$', _handle_h_swig),
+ ('swig', '.+\.i$', _handle_i_swig)
+ )
+ for subdir in self._subdirs:
+ if self._skip_subdirs[subdir]: continue
+ if self._info['version'] == '37' and subdir == 'include':
+ subdir = 'include/%s' % self._info['modname']
+ try:
+ cmake = CMakeFileEditor(os.path.join(subdir, 'CMakeLists.txt'))
+ except IOError:
+ continue
+ print "Traversing %s..." % subdir
+ filenames = cmake.find_filenames_match(self._info['pattern'])
+ yes = self._info['yes']
+ for fname in filenames:
+ file_disabled = False
+ if not yes:
+ ans = raw_input("Really disable %s? [Y/n/a/q]: " % fname).lower().strip()
+ if ans == 'a':
+ yes = True
+ if ans == 'q':
+ sys.exit(0)
+ if ans == 'n':
+ continue
+ for special_treatment in special_treatments:
+ if special_treatment[0] == subdir and re.match(special_treatment[1], fname):
+ file_disabled = special_treatment[2](cmake, fname)
+ if not file_disabled:
+ cmake.disable_file(fname)
+ cmake.write()
+ print "Careful: 'gr_modtool disable' does not resolve dependencies."
+
diff --git a/gr-utils/src/python/modtool/modtool_help.py b/gr-utils/src/python/modtool/modtool_help.py
new file mode 100644
index 000000000..76d9fd28b
--- /dev/null
+++ b/gr-utils/src/python/modtool/modtool_help.py
@@ -0,0 +1,66 @@
+#
+# Copyright 2013 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.
+#
+""" The help module """
+
+from gnuradio.modtool import *
+from util_functions import get_command_from_argv
+from templates import Templates
+
+
+def print_class_descriptions():
+ ''' Go through all ModTool* classes and print their name,
+ alias and description. '''
+ desclist = []
+ for gvar in globals().values():
+ try:
+ if issubclass(gvar, ModTool) and not issubclass(gvar, ModToolHelp):
+ desclist.append((gvar.name, ','.join(gvar.aliases), gvar.__doc__))
+ except (TypeError, AttributeError):
+ pass
+ print 'Name Aliases Description'
+ print '====================================================================='
+ for description in desclist:
+ print '%-8s %-12s %s' % description
+
+class ModToolHelp(ModTool):
+ ''' Show some help. '''
+ name = 'help'
+ aliases = ('h', '?')
+ def __init__(self):
+ ModTool.__init__(self)
+
+ def setup(self):
+ pass
+
+ def run(self):
+ cmd_dict = get_class_dict(globals().values())
+ cmds = cmd_dict.keys()
+ cmds.remove(self.name)
+ for a in self.aliases:
+ cmds.remove(a)
+ help_requested_for = get_command_from_argv(cmds)
+ if help_requested_for is None:
+ print 'Usage:' + Templates['usage']
+ print '\nList of possible commands:\n'
+ print_class_descriptions()
+ return
+ cmd_dict[help_requested_for]().setup_parser().print_help()
+
diff --git a/gr-utils/src/python/modtool/modtool_info.py b/gr-utils/src/python/modtool/modtool_info.py
new file mode 100644
index 000000000..680bd41b9
--- /dev/null
+++ b/gr-utils/src/python/modtool/modtool_info.py
@@ -0,0 +1,156 @@
+#
+# Copyright 2013 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.
+#
+""" Returns information about a module """
+
+import os
+from optparse import OptionGroup
+
+from modtool_base import ModTool
+from util_functions import get_modname
+
+class ModToolInfo(ModTool):
+ """ Return information about a given module """
+ name = 'info'
+ aliases = ('getinfo', 'inf')
+ def __init__(self):
+ ModTool.__init__(self)
+
+ def setup_parser(self):
+ " Initialise the option parser for 'gr_modtool info' "
+ parser = ModTool.setup_parser(self)
+ parser.usage = '%prog info [options]. \n Call %prog without any options to run it interactively.'
+ ogroup = OptionGroup(parser, "Info options")
+ ogroup.add_option("--python-readable", action="store_true", default=None,
+ help="Return the output in a format that's easier to read for Python scripts.")
+ ogroup.add_option("--suggested-dirs", default=None, type="string",
+ help="Suggest typical include dirs if nothing better can be detected.")
+ parser.add_option_group(ogroup)
+ return parser
+
+ def setup(self):
+ # Won't call parent's setup(), because that's too chatty
+ (self.options, self.args) = self.parser.parse_args()
+
+ def run(self):
+ """ Go, go, go! """
+ mod_info = {}
+ mod_info['base_dir'] = self._get_base_dir(self.options.directory)
+ if mod_info['base_dir'] is None:
+ if self.options.python_readable:
+ print '{}'
+ else:
+ print "No module found."
+ exit(1)
+ os.chdir(mod_info['base_dir'])
+ mod_info['modname'] = get_modname()
+ if mod_info['modname'] is None:
+ if self.options.python_readable:
+ print '{}'
+ else:
+ print "No module found."
+ exit(1)
+ if self._info['version'] == '36' and os.path.isdir(os.path.join('include', mod_info['modname'])):
+ self._info['version'] = '37'
+ mod_info['version'] = self._info['version']
+ if 'is_component' in self._info.keys():
+ mod_info['is_component'] = True
+ mod_info['incdirs'] = []
+ mod_incl_dir = os.path.join(mod_info['base_dir'], 'include')
+ if os.path.isdir(os.path.join(mod_incl_dir, mod_info['modname'])):
+ mod_info['incdirs'].append(os.path.join(mod_incl_dir, mod_info['modname']))
+ else:
+ mod_info['incdirs'].append(mod_incl_dir)
+ build_dir = self._get_build_dir(mod_info)
+ if build_dir is not None:
+ mod_info['build_dir'] = build_dir
+ mod_info['incdirs'] += self._get_include_dirs(mod_info)
+ if self.options.python_readable:
+ print str(mod_info)
+ else:
+ self._pretty_print(mod_info)
+
+ def _get_base_dir(self, start_dir):
+ """ Figure out the base dir (where the top-level cmake file is) """
+ base_dir = os.path.abspath(start_dir)
+ if self._check_directory(base_dir):
+ return base_dir
+ else:
+ (up_dir, this_dir) = os.path.split(base_dir)
+ if os.path.split(up_dir)[1] == 'include':
+ up_dir = os.path.split(up_dir)[0]
+ if self._check_directory(up_dir):
+ return up_dir
+ return None
+
+ def _get_build_dir(self, mod_info):
+ """ Figure out the build dir (i.e. where you run 'cmake'). This checks
+ for a file called CMakeCache.txt, which is created when running cmake.
+ If that hasn't happened, the build dir cannot be detected, unless it's
+ called 'build', which is then assumed to be the build dir. """
+ base_build_dir = mod_info['base_dir']
+ if 'is_component' in mod_info.keys():
+ (base_build_dir, rest_dir) = os.path.split(base_build_dir)
+ has_build_dir = os.path.isdir(os.path.join(base_build_dir , 'build'))
+ if (has_build_dir and os.path.isfile(os.path.join(base_build_dir, 'CMakeCache.txt'))):
+ return os.path.join(base_build_dir, 'build')
+ else:
+ for (dirpath, dirnames, filenames) in os.walk(base_build_dir):
+ if 'CMakeCache.txt' in filenames:
+ return dirpath
+ if has_build_dir:
+ return os.path.join(base_build_dir, 'build')
+ return None
+
+ def _get_include_dirs(self, mod_info):
+ """ Figure out include dirs for the make process. """
+ inc_dirs = []
+ path_or_internal = {True: 'INTERNAL',
+ False: 'PATH'}['is_component' in mod_info.keys()]
+ try:
+ cmakecache_fid = open(os.path.join(mod_info['build_dir'], 'CMakeCache.txt'))
+ for line in cmakecache_fid:
+ if line.find('GNURADIO_CORE_INCLUDE_DIRS:%s' % path_or_internal) != -1:
+ inc_dirs += line.replace('GNURADIO_CORE_INCLUDE_DIRS:%s=' % path_or_internal, '').strip().split(';')
+ if line.find('GRUEL_INCLUDE_DIRS:%s' % path_or_internal) != -1:
+ inc_dirs += line.replace('GRUEL_INCLUDE_DIRS:%s=' % path_or_internal, '').strip().split(';')
+ except IOError:
+ pass
+ if len(inc_dirs) == 0 and self.options.suggested_dirs is not None:
+ inc_dirs = [os.path.normpath(path) for path in self.options.suggested_dirs.split(':') if os.path.isdir(path)]
+ return inc_dirs
+
+ def _pretty_print(self, mod_info):
+ """ Output the module info in human-readable format """
+ index_names = {'base_dir': 'Base directory',
+ 'modname': 'Module name',
+ 'is_component': 'Is GR component',
+ 'build_dir': 'Build directory',
+ 'incdirs': 'Include directories'}
+ for key in mod_info.keys():
+ if key == 'version':
+ print " API version: %s" % {
+ '36': 'pre-3.7',
+ '37': 'post-3.7',
+ 'autofoo': 'Autotools (pre-3.5)'
+ }[mod_info['version']]
+ else:
+ print '%19s: %s' % (index_names[key], mod_info[key])
+
diff --git a/gr-utils/src/python/modtool/modtool_makexml.py b/gr-utils/src/python/modtool/modtool_makexml.py
new file mode 100644
index 000000000..777cc09e1
--- /dev/null
+++ b/gr-utils/src/python/modtool/modtool_makexml.py
@@ -0,0 +1,158 @@
+#
+# Copyright 2013 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.
+#
+""" Automatically create XML bindings for GRC from block code """
+
+import sys
+import os
+import re
+import glob
+from optparse import OptionGroup
+
+from modtool_base import ModTool
+from parser_cc_block import ParserCCBlock
+from grc_xml_generator import GRCXMLGenerator
+from cmakefile_editor import CMakeFileEditor
+from util_functions import ask_yes_no
+
+class ModToolMakeXML(ModTool):
+ """ Make XML file for GRC block bindings """
+ name = 'makexml'
+ aliases = ('mx',)
+ def __init__(self):
+ ModTool.__init__(self)
+
+ def setup(self):
+ ModTool.setup(self)
+ options = self.options
+ if options.block_name is not None:
+ self._info['pattern'] = options.block_name
+ elif len(self.args) >= 2:
+ self._info['pattern'] = self.args[1]
+ else:
+ self._info['pattern'] = raw_input('Which blocks do you want to parse? (Regex): ')
+ if len(self._info['pattern']) == 0:
+ self._info['pattern'] = '.'
+
+ def run(self):
+ """ Go, go, go! """
+ print "Warning: This is an experimental feature. Don't expect any magic."
+ # 1) Go through lib/
+ if not self._skip_subdirs['lib']:
+ if self._info['version'] == '37':
+ files = self._search_files('lib', '*_impl.cc')
+ else:
+ files = self._search_files('lib', '*.cc')
+ for f in files:
+ if os.path.basename(f)[0:2] == 'qa':
+ continue
+ (params, iosig, blockname) = self._parse_cc_h(f)
+ self._make_grc_xml_from_block_data(params, iosig, blockname)
+ # 2) Go through python/
+
+
+ def _search_files(self, path, path_glob):
+ """ Search for files matching pattern in the given path. """
+ files = glob.glob("%s/%s"% (path, path_glob))
+ files_filt = []
+ print "Searching for matching files in %s/:" % path
+ for f in files:
+ if re.search(self._info['pattern'], os.path.basename(f)) is not None:
+ files_filt.append(f)
+ if len(files_filt) == 0:
+ print "None found."
+ return files_filt
+
+ def _make_grc_xml_from_block_data(self, params, iosig, blockname):
+ """ Take the return values from the parser and call the XML
+ generator. Also, check the makefile if the .xml file is in there.
+ If necessary, add. """
+ fname_xml = '%s_%s.xml' % (self._info['modname'], blockname)
+ # Some adaptions for the GRC
+ for inout in ('in', 'out'):
+ if iosig[inout]['max_ports'] == '-1':
+ iosig[inout]['max_ports'] = '$num_%sputs' % inout
+ params.append({'key': 'num_%sputs' % inout,
+ 'type': 'int',
+ 'name': 'Num %sputs' % inout,
+ 'default': '2',
+ 'in_constructor': False})
+ if os.path.isfile(os.path.join('grc', fname_xml)):
+ if not self._info['yes']:
+ if not ask_yes_no('Overwrite existing GRC file?', False):
+ return
+ else:
+ print "Warning: Overwriting existing GRC file."
+ grc_generator = GRCXMLGenerator(
+ modname=self._info['modname'],
+ blockname=blockname,
+ params=params,
+ iosig=iosig
+ )
+ grc_generator.save(os.path.join('grc', fname_xml))
+ if not self._skip_subdirs['grc']:
+ ed = CMakeFileEditor(self._file['cmgrc'])
+ if re.search(fname_xml, ed.cfile) is None and not ed.check_for_glob('*.xml'):
+ print "Adding GRC bindings to grc/CMakeLists.txt..."
+ ed.append_value('install', fname_xml, to_ignore_end='DESTINATION[^()]+')
+ ed.write()
+
+ def _parse_cc_h(self, fname_cc):
+ """ Go through a .cc and .h-file defining a block and return info """
+ def _type_translate(p_type, default_v=None):
+ """ Translates a type from C++ to GRC """
+ translate_dict = {'float': 'float',
+ 'double': 'real',
+ 'int': 'int',
+ 'gr_complex': 'complex',
+ 'char': 'byte',
+ 'unsigned char': 'byte',
+ 'std::string': 'string',
+ 'std::vector<int>': 'int_vector',
+ 'std::vector<float>': 'real_vector',
+ 'std::vector<gr_complex>': 'complex_vector',
+ }
+ if p_type in ('int',) and default_v[:2].lower() == '0x':
+ return 'hex'
+ try:
+ return translate_dict[p_type]
+ except KeyError:
+ return 'raw'
+ def _get_blockdata(fname_cc):
+ """ Return the block name and the header file name from the .cc file name """
+ blockname = os.path.splitext(os.path.basename(fname_cc.replace('_impl.', '.')))[0]
+ fname_h = (blockname + '.h').replace('_impl.', '.')
+ blockname = blockname.replace(self._info['modname']+'_', '', 1)
+ return (blockname, fname_h)
+ # Go, go, go
+ print "Making GRC bindings for %s..." % fname_cc
+ (blockname, fname_h) = _get_blockdata(fname_cc)
+ try:
+ parser = ParserCCBlock(fname_cc,
+ os.path.join(self._info['includedir'], fname_h),
+ blockname,
+ self._info['version'],
+ _type_translate
+ )
+ except IOError:
+ print "Can't open some of the files necessary to parse %s." % fname_cc
+ sys.exit(1)
+ return (parser.read_params(), parser.read_io_signature(), blockname)
+
diff --git a/gr-utils/src/python/modtool/modtool_newmod.py b/gr-utils/src/python/modtool/modtool_newmod.py
new file mode 100644
index 000000000..e3b0e8e79
--- /dev/null
+++ b/gr-utils/src/python/modtool/modtool_newmod.py
@@ -0,0 +1,102 @@
+#
+# Copyright 2013 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.
+#
+""" Create a whole new out-of-tree module """
+
+import shutil
+import os
+import re
+from optparse import OptionGroup
+from gnuradio import gr
+from modtool_base import ModTool
+
+class ModToolNewModule(ModTool):
+ """ Create a new out-of-tree module """
+ name = 'newmod'
+ aliases = ('nm', 'create')
+ def __init__(self):
+ ModTool.__init__(self)
+
+ def setup_parser(self):
+ " Initialise the option parser for 'gr_modtool newmod' "
+ parser = ModTool.setup_parser(self)
+ parser.usage = '%prog nm [options]. \n Call %prog without any options to run it interactively.'
+ ogroup = OptionGroup(parser, "New out-of-tree module options")
+ ogroup.add_option("--srcdir", type="string",
+ help="Source directory for the module template.")
+ parser.add_option_group(ogroup)
+ return parser
+
+ def setup(self):
+ (options, self.args) = self.parser.parse_args()
+ self._info['modname'] = options.module_name
+ if self._info['modname'] is None:
+ if len(self.args) >= 2:
+ self._info['modname'] = self.args[1]
+ else:
+ self._info['modname'] = raw_input('Name of the new module: ')
+ if not re.match('[a-zA-Z0-9_]+', self._info['modname']):
+ print 'Invalid module name.'
+ exit(2)
+ self._dir = options.directory
+ if self._dir == '.':
+ self._dir = './gr-%s' % self._info['modname']
+ try:
+ os.stat(self._dir)
+ except OSError:
+ pass # This is what should happen
+ else:
+ print 'The given directory exists.'
+ exit(2)
+ if options.srcdir is None:
+ options.srcdir = '/usr/local/share/gnuradio/modtool/gr-newmod'
+ self._srcdir = gr.prefs().get_string('modtool', 'newmod_path', options.srcdir)
+ if not os.path.isdir(self._srcdir):
+ print 'Error: Could not find gr-newmod source dir.'
+ exit(2)
+
+ def run(self):
+ """
+ * Copy the example dir recursively
+ * Open all files, rename howto and HOWTO to the module name
+ * Rename files and directories that contain the word howto
+ """
+ print "Creating out-of-tree module in %s..." % self._dir,
+ try:
+ shutil.copytree(self._srcdir, self._dir)
+ os.chdir(self._dir)
+ except OSError:
+ print 'Failed.'
+ print 'Could not create directory %s. Quitting.' % self._dir
+ exit(2)
+ for root, dirs, files in os.walk('.'):
+ for filename in files:
+ f = os.path.join(root, filename)
+ s = open(f, 'r').read()
+ s = s.replace('howto', self._info['modname'])
+ s = s.replace('HOWTO', self._info['modname'].upper())
+ open(f, 'w').write(s)
+ if filename.find('howto') != -1:
+ os.rename(f, os.path.join(root, filename.replace('howto', self._info['modname'])))
+ if os.path.basename(root) == 'howto':
+ os.rename(root, os.path.join(os.path.dirname(root), self._info['modname']))
+ print "Done."
+ print "Use 'gr_modtool add' to add a new block to this currently empty module."
+
diff --git a/gr-utils/src/python/modtool/modtool_rm.py b/gr-utils/src/python/modtool/modtool_rm.py
new file mode 100644
index 000000000..32dfee480
--- /dev/null
+++ b/gr-utils/src/python/modtool/modtool_rm.py
@@ -0,0 +1,159 @@
+#
+# Copyright 2013 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.
+#
+""" Remove blocks module """
+
+import os
+import re
+import sys
+import glob
+from optparse import OptionGroup
+
+from util_functions import remove_pattern_from_file
+from modtool_base import ModTool
+from cmakefile_editor import CMakeFileEditor
+
+class ModToolRemove(ModTool):
+ """ Remove block (delete files and remove Makefile entries) """
+ name = 'remove'
+ aliases = ('rm', 'del')
+ def __init__(self):
+ ModTool.__init__(self)
+
+ def setup(self):
+ ModTool.setup(self)
+ options = self.options
+ if options.block_name is not None:
+ self._info['pattern'] = options.block_name
+ elif len(self.args) >= 2:
+ self._info['pattern'] = self.args[1]
+ else:
+ self._info['pattern'] = raw_input('Which blocks do you want to delete? (Regex): ')
+ if len(self._info['pattern']) == 0:
+ self._info['pattern'] = '.'
+
+ def run(self):
+ """ Go, go, go! """
+ def _remove_cc_test_case(filename=None, ed=None):
+ """ Special function that removes the occurrences of a qa*.cc file
+ from the CMakeLists.txt. """
+ if filename[:2] != 'qa':
+ return
+ if self._info['version'] == '37':
+ (base, ext) = os.path.splitext(filename)
+ if ext == '.h':
+ remove_pattern_from_file(self._file['qalib'],
+ '^#include "%s"\s*$' % filename)
+ remove_pattern_from_file(self._file['qalib'],
+ '^\s*s->addTest\(gr::%s::%s::suite\(\)\);\s*$' % (
+ self._info['modname'], base)
+ )
+ elif ext == '.cc':
+ ed.remove_value('list',
+ '\$\{CMAKE_CURRENT_SOURCE_DIR\}/%s' % filename,
+ to_ignore_start='APPEND test_%s_sources' % self._info['modname'])
+ else:
+ filebase = os.path.splitext(filename)[0]
+ ed.delete_entry('add_executable', filebase)
+ ed.delete_entry('target_link_libraries', filebase)
+ ed.delete_entry('GR_ADD_TEST', filebase)
+ ed.remove_double_newlines()
+
+ def _remove_py_test_case(filename=None, ed=None):
+ """ Special function that removes the occurrences of a qa*.{cc,h} file
+ from the CMakeLists.txt and the qa_$modname.cc. """
+ if filename[:2] != 'qa':
+ return
+ filebase = os.path.splitext(filename)[0]
+ ed.delete_entry('GR_ADD_TEST', filebase)
+ ed.remove_double_newlines()
+
+ def _make_swig_regex(filename):
+ filebase = os.path.splitext(filename)[0]
+ pyblockname = filebase.replace(self._info['modname'] + '_', '')
+ regexp = r'(^\s*GR_SWIG_BLOCK_MAGIC2?\(%s,\s*%s\);|^\s*.include\s*"(%s/)?%s"\s*)' % \
+ (self._info['modname'], pyblockname, self._info['modname'], filename)
+ return regexp
+ # Go, go, go!
+ if not self._skip_subdirs['lib']:
+ self._run_subdir('lib', ('*.cc', '*.h'), ('add_library', 'list'),
+ cmakeedit_func=_remove_cc_test_case)
+ if not self._skip_subdirs['include']:
+ incl_files_deleted = self._run_subdir(self._info['includedir'], ('*.h',), ('install',))
+ if not self._skip_subdirs['swig']:
+ swig_files_deleted = self._run_subdir('swig', ('*.i',), ('install',))
+ for f in incl_files_deleted + swig_files_deleted:
+ # TODO do this on all *.i files
+ remove_pattern_from_file(self._file['swig'], _make_swig_regex(f))
+ if not self._skip_subdirs['python']:
+ py_files_deleted = self._run_subdir('python', ('*.py',), ('GR_PYTHON_INSTALL',),
+ cmakeedit_func=_remove_py_test_case)
+ for f in py_files_deleted:
+ remove_pattern_from_file(self._file['pyinit'], '.*import\s+%s.*' % f[:-3])
+ remove_pattern_from_file(self._file['pyinit'], '.*from\s+%s\s+import.*\n' % f[:-3])
+ if not self._skip_subdirs['grc']:
+ self._run_subdir('grc', ('*.xml',), ('install',))
+
+
+ def _run_subdir(self, path, globs, makefile_vars, cmakeedit_func=None):
+ """ Delete all files that match a certain pattern in path.
+ path - The directory in which this will take place
+ globs - A tuple of standard UNIX globs of files to delete (e.g. *.xml)
+ makefile_vars - A tuple with a list of CMakeLists.txt-variables which
+ may contain references to the globbed files
+ cmakeedit_func - If the CMakeLists.txt needs special editing, use this
+ """
+ # 1. Create a filtered list
+ files = []
+ for g in globs:
+ files = files + glob.glob("%s/%s"% (path, g))
+ files_filt = []
+ print "Searching for matching files in %s/:" % path
+ for f in files:
+ if re.search(self._info['pattern'], os.path.basename(f)) is not None:
+ files_filt.append(f)
+ if len(files_filt) == 0:
+ print "None found."
+ return []
+ # 2. Delete files, Makefile entries and other occurences
+ files_deleted = []
+ ed = CMakeFileEditor('%s/CMakeLists.txt' % path)
+ yes = self._info['yes']
+ for f in files_filt:
+ b = os.path.basename(f)
+ if not yes:
+ ans = raw_input("Really delete %s? [Y/n/a/q]: " % f).lower().strip()
+ if ans == 'a':
+ yes = True
+ if ans == 'q':
+ sys.exit(0)
+ if ans == 'n':
+ continue
+ files_deleted.append(b)
+ print "Deleting %s." % f
+ os.unlink(f)
+ print "Deleting occurrences of %s from %s/CMakeLists.txt..." % (b, path)
+ for var in makefile_vars:
+ ed.remove_value(var, b)
+ if cmakeedit_func is not None:
+ cmakeedit_func(b, ed)
+ ed.write()
+ return files_deleted
+
diff --git a/gr-utils/src/python/modtool/parser_cc_block.py b/gr-utils/src/python/modtool/parser_cc_block.py
new file mode 100644
index 000000000..0d1d75f29
--- /dev/null
+++ b/gr-utils/src/python/modtool/parser_cc_block.py
@@ -0,0 +1,225 @@
+#
+# Copyright 2013 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.
+#
+''' A parser for blocks written in C++ '''
+import re
+import sys
+
+def dummy_translator(the_type, default_v=None):
+ """ Doesn't really translate. """
+ return the_type
+
+class ParserCCBlock(object):
+ """ Class to read blocks written in C++ """
+ def __init__(self, filename_cc, filename_h, blockname, version, type_trans=dummy_translator):
+ self.code_cc = open(filename_cc).read()
+ self.code_h = open(filename_h).read()
+ self.blockname = blockname
+ self.type_trans = type_trans
+ self.version = version
+
+ def read_io_signature(self):
+ """ Scans a .cc file for an IO signature. """
+ def _figure_out_iotype_and_vlen(iosigcall, typestr):
+ """ From a type identifier, returns the data type.
+ E.g., for sizeof(int), it will return 'int'.
+ Returns a list! """
+ if 'gr_make_iosignaturev' in iosigcall:
+ print 'tbi'
+ raise ValueError
+ return {'type': [_typestr_to_iotype(x) for x in typestr.split(',')],
+ 'vlen': [_typestr_to_vlen(x) for x in typestr.split(',')]
+ }
+ def _typestr_to_iotype(typestr):
+ """ Convert a type string (e.g. sizeof(int) * vlen) to the type (e.g. 'int'). """
+ type_match = re.search('sizeof\s*\(([^)]*)\)', typestr)
+ if type_match is None:
+ return self.type_trans('char')
+ return self.type_trans(type_match.group(1))
+ def _typestr_to_vlen(typestr):
+ """ From a type identifier, returns the vector length of the block's
+ input/out. E.g., for 'sizeof(int) * 10', it returns 10. For
+ 'sizeof(int)', it returns '1'. For 'sizeof(int) * vlen', it returns
+ the string vlen. """
+ # Catch fringe case where no sizeof() is given
+ if typestr.find('sizeof') == -1:
+ return typestr
+ if typestr.find('*') == -1:
+ return '1'
+ vlen_parts = typestr.split('*')
+ for fac in vlen_parts:
+ if fac.find('sizeof') != -1:
+ vlen_parts.remove(fac)
+ if len(vlen_parts) == 1:
+ return vlen_parts[0].strip()
+ elif len(vlen_parts) > 1:
+ return '*'.join(vlen_parts).strip()
+ iosig = {}
+ iosig_regex = '(?P<incall>gr_make_io_signature[23v]?)\s*\(\s*(?P<inmin>[^,]+),\s*(?P<inmax>[^,]+),' + \
+ '\s*(?P<intype>(\([^\)]*\)|[^)])+)\),\s*' + \
+ '(?P<outcall>gr_make_io_signature[23v]?)\s*\(\s*(?P<outmin>[^,]+),\s*(?P<outmax>[^,]+),' + \
+ '\s*(?P<outtype>(\([^\)]*\)|[^)])+)\)'
+ iosig_match = re.compile(iosig_regex, re.MULTILINE).search(self.code_cc)
+ try:
+ iosig['in'] = _figure_out_iotype_and_vlen(iosig_match.group('incall'),
+ iosig_match.group('intype'))
+ iosig['in']['min_ports'] = iosig_match.group('inmin')
+ iosig['in']['max_ports'] = iosig_match.group('inmax')
+ except ValueError, Exception:
+ print "Error: Can't parse input signature."
+ try:
+ iosig['out'] = _figure_out_iotype_and_vlen(iosig_match.group('outcall'),
+ iosig_match.group('outtype'))
+ iosig['out']['min_ports'] = iosig_match.group('outmin')
+ iosig['out']['max_ports'] = iosig_match.group('outmax')
+ except ValueError, Exception:
+ print "Error: Can't parse output signature."
+ return iosig
+
+
+ def read_params(self):
+ """ Read the parameters required to initialize the block """
+ def _scan_param_list(start_idx):
+ """ Go through a parameter list and return a tuple each:
+ (type, name, default_value). Python's re just doesn't cut
+ it for C++ code :( """
+ i = start_idx
+ c = self.code_h
+ if c[i] != '(':
+ raise ValueError
+ i += 1
+
+ param_list = []
+ read_state = 'type'
+ in_string = False
+ parens_count = 0 # Counts ()
+ brackets_count = 0 # Counts <>
+ end_of_list = False
+ this_type = ''
+ this_name = ''
+ this_defv = ''
+ WHITESPACE = ' \t\n\r\f\v'
+ while not end_of_list:
+ # Keep track of (), stop when reaching final closing parens
+ if not in_string:
+ if c[i] == ')':
+ if parens_count == 0:
+ if read_state == 'type' and len(this_type):
+ raise ValueError(
+ 'Found closing parentheses before finishing last argument (this is how far I got: %s)'
+ % str(param_list)
+ )
+ if len(this_type):
+ param_list.append((this_type, this_name, this_defv))
+ end_of_list = True
+ break
+ else:
+ parens_count -= 1
+ elif c[i] == '(':
+ parens_count += 1
+ # Parameter type (int, const std::string, std::vector<gr_complex>, unsigned long ...)
+ if read_state == 'type':
+ if c[i] == '<':
+ brackets_count += 1
+ if c[i] == '>':
+ brackets_count -= 1
+ if c[i] == '&':
+ i += 1
+ continue
+ if c[i] in WHITESPACE and brackets_count == 0:
+ while c[i] in WHITESPACE:
+ i += 1
+ continue
+ if this_type == 'const' or this_type == '': # Ignore this
+ this_type = ''
+ elif this_type == 'unsigned': # Continue
+ this_type += ' '
+ continue
+ else:
+ read_state = 'name'
+ continue
+ this_type += c[i]
+ i += 1
+ continue
+ # Parameter name
+ if read_state == 'name':
+ if c[i] == '&' or c[i] in WHITESPACE:
+ i += 1
+ elif c[i] == '=':
+ if parens_count != 0:
+ raise ValueError(
+ 'While parsing argument %d (%s): name finished but no closing parentheses.'
+ % (len(param_list)+1, this_type + ' ' + this_name)
+ )
+ read_state = 'defv'
+ i += 1
+ elif c[i] == ',':
+ if parens_count:
+ raise ValueError(
+ 'While parsing argument %d (%s): name finished but no closing parentheses.'
+ % (len(param_list)+1, this_type + ' ' + this_name)
+ )
+ read_state = 'defv'
+ else:
+ this_name += c[i]
+ i += 1
+ continue
+ # Default value
+ if read_state == 'defv':
+ if in_string:
+ if c[i] == '"' and c[i-1] != '\\':
+ in_string = False
+ else:
+ this_defv += c[i]
+ elif c[i] == ',':
+ if parens_count:
+ raise ValueError(
+ 'While parsing argument %d (%s): default value finished but no closing parentheses.'
+ % (len(param_list)+1, this_type + ' ' + this_name)
+ )
+ read_state = 'type'
+ param_list.append((this_type, this_name, this_defv))
+ this_type = ''
+ this_name = ''
+ this_defv = ''
+ else:
+ this_defv += c[i]
+ i += 1
+ continue
+ return param_list
+ # Go, go, go!
+ if self.version == '37':
+ make_regex = 'static\s+sptr\s+make\s*'
+ else:
+ make_regex = '(?<=_API)\s+\w+_sptr\s+\w+_make_\w+\s*'
+ make_match = re.compile(make_regex, re.MULTILINE).search(self.code_h)
+ try:
+ params_list = _scan_param_list(make_match.end(0))
+ except ValueError as ve:
+ print "Can't parse the argument list: ", ve.args[0]
+ sys.exit(0)
+ params = []
+ for plist in params_list:
+ params.append({'type': self.type_trans(plist[0], plist[2]),
+ 'key': plist[1],
+ 'default': plist[2],
+ 'in_constructor': True})
+ return params
+
diff --git a/gr-utils/src/python/modtool/templates.py b/gr-utils/src/python/modtool/templates.py
new file mode 100644
index 000000000..362912c06
--- /dev/null
+++ b/gr-utils/src/python/modtool/templates.py
@@ -0,0 +1,718 @@
+#
+# Copyright 2013 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.
+#
+''' All the templates for skeleton files (needed by ModToolAdd) '''
+
+from datetime import datetime
+
+Templates = {}
+
+# Default licence
+Templates['defaultlicense'] = '''
+Copyright %d <+YOU OR YOUR COMPANY+>.
+
+This 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.
+
+This software 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 this software; see the file COPYING. If not, write to
+the Free Software Foundation, Inc., 51 Franklin Street,
+Boston, MA 02110-1301, USA.
+''' % datetime.now().year
+
+# Header file of a sync/decimator/interpolator block
+Templates['block_impl_h'] = '''/* -*- c++ -*- */
+${str_to_fancyc_comment($license)}
+\#ifndef INCLUDED_${modname.upper()}_${blockname.upper()}_IMPL_H
+\#define INCLUDED_${modname.upper()}_${blockname.upper()}_IMPL_H
+
+\#include <${modname}/${blockname}.h>
+
+namespace gr {
+ namespace ${modname} {
+
+ class ${blockname}_impl : public ${blockname}
+ {
+ private:
+ // Nothing to declare in this block.
+
+ public:
+ ${blockname}_impl(${strip_default_values($arglist)});
+ ~${blockname}_impl();
+
+#if $blocktype == 'general'
+ void forecast (int noutput_items, gr_vector_int &ninput_items_required);
+
+ // Where all the action really happens
+ int general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+#else if $blocktype == 'hier'
+#silent pass
+#else
+ // Where all the action really happens
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+#end if
+ };
+
+ } // namespace ${modname}
+} // namespace gr
+
+\#endif /* INCLUDED_${modname.upper()}_${blockname.upper()}_IMPL_H */
+
+'''
+
+# C++ file of a GR block
+Templates['block_impl_cpp'] = '''/* -*- c++ -*- */
+${str_to_fancyc_comment($license)}
+\#ifdef HAVE_CONFIG_H
+\#include "config.h"
+\#endif
+
+\#include <gr_io_signature.h>
+#if $blocktype == 'noblock'
+\#include <${modname}/${blockname}.h>
+#else
+\#include "${blockname}_impl.h"
+#end if
+
+namespace gr {
+ namespace ${modname} {
+
+#if $blocktype == 'noblock'
+ $blockname::${blockname}(${strip_default_values($arglist)})
+ {
+ }
+
+ $blockname::~${blockname}()
+ {
+ }
+#else
+ ${blockname}::sptr
+ ${blockname}::make(${strip_default_values($arglist)})
+ {
+ return gnuradio::get_initial_sptr
+ (new ${blockname}_impl(${strip_arg_types($arglist)}));
+ }
+
+#if $blocktype == 'decimator'
+#set $decimation = ', <+decimation+>'
+#else if $blocktype == 'interpolator'
+#set $decimation = ', <+interpolation+>'
+#else
+#set $decimation = ''
+#end if
+#if $blocktype == 'source'
+#set $inputsig = '0, 0, 0'
+#else
+#set $inputsig = '<+MIN_IN+>, <+MAX_IN+>, sizeof(<+ITYPE+>)'
+#end if
+#if $blocktype == 'sink'
+#set $outputsig = '0, 0, 0'
+#else
+#set $outputsig = '<+MIN_OUT+>, <+MAX_OUT+>, sizeof(<+OTYPE+>)'
+#end if
+ /*
+ * The private constructor
+ */
+ ${blockname}_impl::${blockname}_impl(${strip_default_values($arglist)})
+ : ${grblocktype}("${blockname}",
+ gr_make_io_signature($inputsig),
+ gr_make_io_signature($outputsig)$decimation)
+#if $blocktype == 'hier'
+ {
+ connect(self(), 0, d_firstblock, 0);
+ // connect other blocks
+ connect(d_lastblock, 0, self(), 0);
+ }
+#else
+ {}
+#end if
+
+ /*
+ * Our virtual destructor.
+ */
+ ${blockname}_impl::~${blockname}_impl()
+ {
+ }
+
+#if $blocktype == 'general'
+ void
+ ${blockname}_impl::forecast (int noutput_items, gr_vector_int &ninput_items_required)
+ {
+ /* <+forecast+> e.g. ninput_items_required[0] = noutput_items */
+ }
+
+ int
+ ${blockname}_impl::general_work (int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const <+ITYPE*> *in = (const <+ITYPE*> *) input_items[0];
+ <+OTYPE*> *out = (<+OTYPE*> *) output_items[0];
+
+ // Do <+signal processing+>
+ // Tell runtime system how many input items we consumed on
+ // each input stream.
+ consume_each (noutput_items);
+
+ // Tell runtime system how many output items we produced.
+ return noutput_items;
+ }
+#else if $blocktype == 'hier'
+#silent pass
+#else
+ int
+ ${blockname}_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const <+ITYPE+> *in = (const <+ITYPE+> *) input_items[0];
+ <+OTYPE+> *out = (<+OTYPE+> *) output_items[0];
+
+ // Do <+signal processing+>
+
+ // Tell runtime system how many output items we produced.
+ return noutput_items;
+ }
+#end if
+#end if
+
+ } /* namespace ${modname} */
+} /* namespace gr */
+
+'''
+
+# Block definition header file (for include/)
+Templates['block_def_h'] = '''/* -*- c++ -*- */
+${str_to_fancyc_comment($license)}
+
+\#ifndef INCLUDED_${modname.upper()}_${blockname.upper()}_H
+\#define INCLUDED_${modname.upper()}_${blockname.upper()}_H
+
+\#include <${modname}/api.h>
+\#include <${grblocktype}.h>
+
+namespace gr {
+ namespace ${modname} {
+
+#if $blocktype == 'noblock'
+ /*!
+ * \\brief <+description+>
+ *
+ */
+ class ${modname.upper()}_API $blockname
+ {
+ public:
+ ${blockname}(${arglist});
+ ~${blockname}();
+ private:
+ };
+#else
+ /*!
+ * \\brief <+description of block+>
+ * \ingroup ${modname}
+ *
+ */
+ class ${modname.upper()}_API ${blockname} : virtual public $grblocktype
+ {
+ public:
+ typedef boost::shared_ptr<${blockname}> sptr;
+
+ /*!
+ * \\brief Return a shared_ptr to a new instance of ${modname}::${blockname}.
+ *
+ * To avoid accidental use of raw pointers, ${modname}::${blockname}'s
+ * constructor is in a private implementation
+ * class. ${modname}::${blockname}::make is the public interface for
+ * creating new instances.
+ */
+ static sptr make($arglist);
+ };
+#end if
+
+ } // namespace ${modname}
+} // namespace gr
+
+\#endif /* INCLUDED_${modname.upper()}_${blockname.upper()}_H */
+
+'''
+
+# Python block (from grextras!)
+Templates['block_python'] = '''\#!/usr/bin/env python
+${str_to_python_comment($license)}
+#
+#if $blocktype == 'noblock'
+#stop
+#end if
+
+#if $blocktype in ('sync', 'sink', 'source')
+#set $parenttype = 'gr.sync_block'
+#else
+#set $parenttype = {'hier': 'gr.hier_block2', 'interpolator': 'gr.interp_block', 'decimator': 'gr.decim_block', 'general': 'gr.basic_block'}[$blocktype]
+#end if
+#if $blocktype != 'hier'
+import numpy
+#if $blocktype == 'source'
+#set $inputsig = 'None'
+#else
+#set $inputsig = '[<+numpy.float+>]'
+#end if
+#if $blocktype == 'sink'
+#set $outputsig = 'None'
+#else
+#set $outputsig = '[<+numpy.float+>]'
+#end if
+#else
+#if $blocktype == 'source'
+#set $inputsig = '0, 0, 0'
+#else
+#set $inputsig = '<+MIN_IN+>, <+MAX_IN+>, gr.sizeof_<+ITYPE+>'
+#end if
+#if $blocktype == 'sink'
+#set $outputsig = '0, 0, 0'
+#else
+#set $outputsig = '<+MIN_OUT+>, <+MAX_OUT+>, gr.sizeof_<+OTYPE+>'
+#end if
+#end if
+#if $blocktype == 'interpolator'
+#set $deciminterp = ', <+interpolation+>'
+#else if $blocktype == 'decimator'
+#set $deciminterp = ', <+decimation+>'
+#else
+#set $deciminterp = ''
+#end if
+from gnuradio import gr
+
+class ${blockname}(${parenttype}):
+ """
+ docstring for block ${blockname}
+ """
+ def __init__(self#if $arglist == '' then '' else ', '#$arglist):
+ ${parenttype}.__init__(self,
+#if $blocktype == 'hier'
+ "$blockname",
+ gr.io_signature(${inputsig}), # Input signature
+ gr.io_signature(${outputsig})) # Output signature
+
+ # Define blocks and connect them
+ self.connect()
+#stop
+#else
+ name="${blockname}",
+ in_sig=${inputsig},
+ out_sig=${outputsig}${deciminterp})
+#end if
+
+#if $blocktype == 'general'
+ def forecast(self, noutput_items, ninput_items_required):
+ #setup size of input_items[i] for work call
+ for i in range(len(ninput_items_required)):
+ ninput_items_required[i] = noutput_items
+
+ def general_work(self, input_items, output_items):
+ output_items[0][:] = input_items[0]
+ consume(0, len(input_items[0]))
+ \#self.consume_each(len(input_items[0]))
+ return len(output_items[0])
+#stop
+#end if
+
+ def work(self, input_items, output_items):
+#if $blocktype != 'source'
+ in0 = input_items[0]
+#end if
+#if $blocktype != 'sink'
+ out = output_items[0]
+#end if
+ # <+signal processing here+>
+#if $blocktype in ('sync', 'decimator', 'interpolator')
+ out[:] = in0
+ return len(output_items[0])
+#else if $blocktype == 'sink'
+ return len(input_items[0])
+#else if $blocktype == 'source'
+ out[:] = whatever
+ return len(output_items[0])
+#end if
+
+'''
+
+# C++ file for QA
+Templates['qa_cpp'] = '''/* -*- c++ -*- */
+${str_to_fancyc_comment($license)}
+
+\#include "qa_${blockname}.h"
+\#include <cppunit/TestAssert.h>
+
+\#include <$modname/${blockname}.h>
+
+namespace gr {
+ namespace ${modname} {
+
+ void
+ qa_${blockname}::t1()
+ {
+ // Put test here
+ }
+
+ } /* namespace ${modname} */
+} /* namespace gr */
+
+'''
+
+# Header file for QA
+Templates['qa_h'] = '''/* -*- c++ -*- */
+${str_to_fancyc_comment($license)}
+
+\#ifndef _QA_${blockname.upper()}_H_
+\#define _QA_${blockname.upper()}_H_
+
+\#include <cppunit/extensions/HelperMacros.h>
+\#include <cppunit/TestCase.h>
+
+namespace gr {
+ namespace ${modname} {
+
+ class qa_${blockname} : public CppUnit::TestCase
+ {
+ public:
+ CPPUNIT_TEST_SUITE(qa_${blockname});
+ CPPUNIT_TEST(t1);
+ CPPUNIT_TEST_SUITE_END();
+
+ private:
+ void t1();
+ };
+
+ } /* namespace ${modname} */
+} /* namespace gr */
+
+\#endif /* _QA_${blockname.upper()}_H_ */
+
+'''
+
+# Python QA code
+Templates['qa_python'] = '''\#!/usr/bin/env python
+${str_to_python_comment($license)}
+#
+
+from gnuradio import gr, gr_unittest
+#if $lang == 'cpp'
+import ${modname}_swig as ${modname}
+#else
+from ${blockname} import ${blockname}
+#end if
+
+class qa_$blockname (gr_unittest.TestCase):
+
+ def setUp (self):
+ self.tb = gr.top_block ()
+
+ def tearDown (self):
+ self.tb = None
+
+ def test_001_t (self):
+ # set up fg
+ self.tb.run ()
+ # check data
+
+
+if __name__ == '__main__':
+ gr_unittest.run(qa_${blockname}, "qa_${blockname}.xml")
+'''
+
+Templates['grc_xml'] = '''<?xml version="1.0"?>
+<block>
+ <name>$blockname</name>
+ <key>${modname}_$blockname</key>
+ <category>$modname</category>
+ <import>import $modname</import>
+ <make>${modname}.${blockname}(${strip_arg_types_grc($arglist)})</make>
+ <!-- Make one 'param' node for every Parameter you want settable from the GUI.
+ Sub-nodes:
+ * name
+ * key (makes the value accessible as \$keyname, e.g. in the make node)
+ * type -->
+ <param>
+ <name>...</name>
+ <key>...</key>
+ <type>...</type>
+ </param>
+
+ <!-- Make one 'sink' node per input. Sub-nodes:
+ * name (an identifier for the GUI)
+ * type
+ * vlen
+ * optional (set to 1 for optional inputs) -->
+ <sink>
+ <name>in</name>
+ <type><!-- e.g. int, float, complex, byte, short, xxx_vector, ...--></type>
+ </sink>
+
+ <!-- Make one 'source' node per output. Sub-nodes:
+ * name (an identifier for the GUI)
+ * type
+ * vlen
+ * optional (set to 1 for optional inputs) -->
+ <source>
+ <name>out</name>
+ <type><!-- e.g. int, float, complex, byte, short, xxx_vector, ...--></type>
+ </source>
+</block>
+'''
+
+# Usage
+Templates['usage'] = '''
+gr_modtool <command> [options] -- Run <command> with the given options.
+gr_modtool help -- Show a list of commands.
+gr_modtool help <command> -- Shows the help for a given command. '''
+
+# SWIG string
+Templates['swig_block_magic'] = """#if $version == '36'
+#if $blocktype != 'noblock'
+GR_SWIG_BLOCK_MAGIC($modname, $blockname);
+#end if
+%include "${modname}_${blockname}.h"
+#else
+%include "${modname}/${blockname}.h"
+#if $blocktype != 'noblock'
+GR_SWIG_BLOCK_MAGIC2($modname, $blockname);
+#end if
+#end if
+"""
+
+## Old stuff
+# C++ file of a GR block
+Templates['block_cpp36'] = '''/* -*- c++ -*- */
+${str_to_fancyc_comment($license)}
+\#ifdef HAVE_CONFIG_H
+\#include "config.h"
+\#endif
+
+#if $blocktype != 'noblock'
+\#include <gr_io_signature.h>
+#end if
+\#include "${modname}_${blockname}.h"
+
+#if $blocktype == 'noblock'
+${modname}_${blockname}::${modname}_${blockname}(${strip_default_values($arglist)})
+{
+}
+
+${modname}_${blockname}::~${modname}_${blockname}()
+{
+}
+#else
+${modname}_${blockname}_sptr
+${modname}_make_${blockname} (${strip_default_values($arglist)})
+{
+ return gnuradio::get_initial_sptr (new ${modname}_${blockname}(${strip_arg_types($arglist)}));
+}
+
+#if $blocktype == 'decimator'
+#set $decimation = ', <+decimation+>'
+#else if $blocktype == 'interpolator'
+#set $decimation = ', <+interpolation+>'
+#else
+#set $decimation = ''
+#end if
+#if $blocktype == 'sink'
+#set $inputsig = '0, 0, 0'
+#else
+#set $inputsig = '<+MIN_IN+>, <+MAX_IN+>, sizeof(<+ITYPE+>)'
+#end if
+#if $blocktype == 'source'
+#set $outputsig = '0, 0, 0'
+#else
+#set $outputsig = '<+MIN_OUT+>, <+MAX_OUT+>, sizeof(<+OTYPE+>)'
+#end if
+
+/*
+ * The private constructor
+ */
+${modname}_${blockname}::${modname}_${blockname} (${strip_default_values($arglist)})
+ : ${grblocktype} ("${blockname}",
+ gr_make_io_signature($inputsig),
+ gr_make_io_signature($outputsig)$decimation)
+{
+#if $blocktype == 'hier'
+ connect(self(), 0, d_firstblock, 0);
+ // <+connect other blocks+>
+ connect(d_lastblock, 0, self(), 0);
+#else
+ // Put in <+constructor stuff+> here
+#end if
+}
+
+
+/*
+ * Our virtual destructor.
+ */
+${modname}_${blockname}::~${modname}_${blockname}()
+{
+ // Put in <+destructor stuff+> here
+}
+#end if
+
+
+#if $blocktype == 'general'
+void
+${modname}_${blockname}::forecast (int noutput_items, gr_vector_int &ninput_items_required)
+{
+ /* <+forecast+> e.g. ninput_items_required[0] = noutput_items */
+}
+
+int
+${modname}_${blockname}::general_work (int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const <+ITYPE+> *in = (const <+ITYPE+> *) input_items[0];
+ <+OTYPE+> *out = (<+OTYPE+> *) output_items[0];
+
+ // Do <+signal processing+>
+ // Tell runtime system how many input items we consumed on
+ // each input stream.
+ consume_each (noutput_items);
+
+ // Tell runtime system how many output items we produced.
+ return noutput_items;
+}
+#else if $blocktype == 'hier' or $blocktype == 'noblock'
+#pass
+#else
+int
+${modname}_${blockname}::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const <+ITYPE+> *in = (const <+ITYPE+> *) input_items[0];
+ <+OTYPE+> *out = (<+OTYPE+> *) output_items[0];
+
+ // Do <+signal processing+>
+
+ // Tell runtime system how many output items we produced.
+ return noutput_items;
+}
+#end if
+
+'''
+
+# Block definition header file (for include/)
+Templates['block_h36'] = '''/* -*- c++ -*- */
+${str_to_fancyc_comment($license)}
+
+\#ifndef INCLUDED_${modname.upper()}_${blockname.upper()}_H
+\#define INCLUDED_${modname.upper()}_${blockname.upper()}_H
+
+\#include <${modname}_api.h>
+#if $blocktype == 'noblock'
+class ${modname.upper()}_API $blockname
+{
+ ${blockname}(${arglist});
+ ~${blockname}();
+ private:
+};
+
+#else
+\#include <${grblocktype}.h>
+
+class ${modname}_${blockname};
+
+typedef boost::shared_ptr<${modname}_${blockname}> ${modname}_${blockname}_sptr;
+
+${modname.upper()}_API ${modname}_${blockname}_sptr ${modname}_make_${blockname} ($arglist);
+
+/*!
+ * \\brief <+description+>
+ * \ingroup ${modname}
+ *
+ */
+class ${modname.upper()}_API ${modname}_${blockname} : public $grblocktype
+{
+ private:
+ friend ${modname.upper()}_API ${modname}_${blockname}_sptr ${modname}_make_${blockname} (${strip_default_values($arglist)});
+
+ ${modname}_${blockname}(${strip_default_values($arglist)});
+
+ public:
+ ~${modname}_${blockname}();
+
+#if $blocktype == 'general'
+ void forecast (int noutput_items, gr_vector_int &ninput_items_required);
+
+ // Where all the action really happens
+ int general_work (int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+#else if $blocktype == 'hier'
+#pass
+#else
+ // Where all the action really happens
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+#end if
+};
+#end if
+
+\#endif /* INCLUDED_${modname.upper()}_${blockname.upper()}_H */
+
+'''
+
+# C++ file for QA
+Templates['qa_cpp36'] = '''/* -*- c++ -*- */
+${str_to_fancyc_comment($license)}
+
+\#include <boost/test/unit_test.hpp>
+
+BOOST_AUTO_TEST_CASE(qa_${modname}_${blockname}_t1){
+ BOOST_CHECK_EQUAL(2 + 2, 4);
+ // TODO BOOST_* test macros here
+}
+
+BOOST_AUTO_TEST_CASE(qa_${modname}_${blockname}_t2){
+ BOOST_CHECK_EQUAL(2 + 2, 4);
+ // TODO BOOST_* test macros here
+}
+
+'''
+
+# Header file for QA
+Templates['qa_cmakeentry36'] = """
+add_executable($basename $filename)
+target_link_libraries($basename gnuradio-$modname \${Boost_LIBRARIES})
+GR_ADD_TEST($basename $basename)
+"""
+
diff --git a/gr-utils/src/python/modtool/util_functions.py b/gr-utils/src/python/modtool/util_functions.py
new file mode 100644
index 000000000..9551056f0
--- /dev/null
+++ b/gr-utils/src/python/modtool/util_functions.py
@@ -0,0 +1,141 @@
+#
+# Copyright 2013 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.
+#
+""" Utility functions for gr_modtool """
+
+import re
+import sys
+
+# None of these must depend on other modtool stuff!
+
+def get_command_from_argv(possible_cmds):
+ """ Read the requested command from argv. This can't be done with optparse,
+ since the option parser isn't defined before the command is known, and
+ optparse throws an error."""
+ command = None
+ for arg in sys.argv:
+ if arg[0] == "-":
+ continue
+ else:
+ command = arg
+ if command in possible_cmds:
+ return arg
+ return None
+
+def append_re_line_sequence(filename, linepattern, newline):
+ """ Detects the re 'linepattern' in the file. After its last occurrence,
+ paste 'newline'. If the pattern does not exist, append the new line
+ to the file. Then, write. """
+ oldfile = open(filename, 'r').read()
+ lines = re.findall(linepattern, oldfile, flags=re.MULTILINE)
+ if len(lines) == 0:
+ open(filename, 'a').write(newline)
+ return
+ last_line = lines[-1]
+ newfile = oldfile.replace(last_line, last_line + newline + '\n')
+ open(filename, 'w').write(newfile)
+
+def remove_pattern_from_file(filename, pattern):
+ """ Remove all occurrences of a given pattern from a file. """
+ oldfile = open(filename, 'r').read()
+ pattern = re.compile(pattern, re.MULTILINE)
+ open(filename, 'w').write(pattern.sub('', oldfile))
+
+def str_to_fancyc_comment(text):
+ """ Return a string as a C formatted comment. """
+ l_lines = text.splitlines()
+ outstr = "/* " + l_lines[0] + "\n"
+ for line in l_lines[1:]:
+ outstr += " * " + line + "\n"
+ outstr += " */\n"
+ return outstr
+
+def str_to_python_comment(text):
+ """ Return a string as a Python formatted comment. """
+ return re.compile('^', re.MULTILINE).sub('# ', text)
+
+def strip_default_values(string):
+ """ Strip default values from a C++ argument list. """
+ return re.sub(' *=[^,)]*', '', string)
+
+def strip_arg_types(string):
+ """" Strip the argument types from a list of arguments
+ Example: "int arg1, double arg2" -> "arg1, arg2" """
+ string = strip_default_values(string)
+ return ", ".join([part.strip().split(' ')[-1] for part in string.split(',')])
+
+def strip_arg_types_grc(string):
+ """" Strip the argument types from a list of arguments for GRC make tag.
+ Example: "int arg1, double arg2" -> "$arg1, $arg2" """
+ string = strip_default_values(string)
+ return ", ".join(['$' + part.strip().split(' ')[-1] for part in string.split(',')])
+
+def get_modname():
+ """ Grep the current module's name from gnuradio.project or CMakeLists.txt """
+ modname_trans = {'howto-write-a-block': 'howto'}
+ try:
+ prfile = open('gnuradio.project', 'r').read()
+ regexp = r'projectname\s*=\s*([a-zA-Z0-9-_]+)$'
+ return re.search(regexp, prfile, flags=re.MULTILINE).group(1).strip()
+ except IOError:
+ pass
+ # OK, there's no gnuradio.project. So, we need to guess.
+ cmfile = open('CMakeLists.txt', 'r').read()
+ regexp = r'(project\s*\(\s*|GR_REGISTER_COMPONENT\(")gr-(?P<modname>[a-zA-Z0-9-_]+)(\s*(CXX)?|" ENABLE)'
+ try:
+ modname = re.search(regexp, cmfile, flags=re.MULTILINE).group('modname').strip()
+ if modname in modname_trans.keys():
+ modname = modname_trans[modname]
+ return modname
+ except AttributeError:
+ return None
+
+def is_number(s):
+ " Return True if the string s contains a number. "
+ try:
+ float(s)
+ return True
+ except ValueError:
+ return False
+
+def xml_indent(elem, level=0):
+ """ Adds indents to XML for pretty printing """
+ i = "\n" + level*" "
+ if len(elem):
+ if not elem.text or not elem.text.strip():
+ elem.text = i + " "
+ if not elem.tail or not elem.tail.strip():
+ elem.tail = i
+ for elem in elem:
+ xml_indent(elem, level+1)
+ if not elem.tail or not elem.tail.strip():
+ elem.tail = i
+ else:
+ if level and (not elem.tail or not elem.tail.strip()):
+ elem.tail = i
+
+def ask_yes_no(question, default):
+ """ Asks a binary question. Returns True for yes, False for no.
+ default is given as a boolean. """
+ question += {True: ' [Y/n] ', False: ' [y/N] '}[default]
+ if raw_input(question).lower() != {True: 'n', False: 'y'}[default]:
+ return default
+ else:
+ return not default
diff --git a/gr-utils/src/python/plot_data.py b/gr-utils/src/python/plot_data.py
new file mode 100644
index 000000000..242ca2a4b
--- /dev/null
+++ b/gr-utils/src/python/plot_data.py
@@ -0,0 +1,165 @@
+#
+# Copyright 2007,2008,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.
+#
+
+try:
+ import scipy
+except ImportError:
+ print "Please install SciPy to run this script (http://www.scipy.org/)"
+ raise SystemExit, 1
+
+try:
+ from pylab import *
+except ImportError:
+ print "Please install Matplotlib to run this script (http://matplotlib.sourceforge.net/)"
+ raise SystemExit, 1
+
+from optparse import OptionParser
+
+class plot_data:
+ def __init__(self, datatype, filenames, options):
+ self.hfile = list()
+ self.legend_text = list()
+ for f in filenames:
+ self.hfile.append(open(f, "r"))
+ self.legend_text.append(f)
+
+ self.block_length = options.block
+ self.start = options.start
+ self.sample_rate = options.sample_rate
+
+ self.datatype = datatype
+ self.sizeof_data = datatype().nbytes # number of bytes per sample in file
+
+ self.axis_font_size = 16
+ self.label_font_size = 18
+ self.title_font_size = 20
+ self.text_size = 22
+
+ # Setup PLOT
+ self.fig = figure(1, figsize=(16, 9), facecolor='w')
+ rcParams['xtick.labelsize'] = self.axis_font_size
+ rcParams['ytick.labelsize'] = self.axis_font_size
+
+ self.text_file_pos = figtext(0.10, 0.88, "File Position: ", weight="heavy", size=self.text_size)
+ self.text_block = figtext(0.40, 0.88, ("Block Size: %d" % self.block_length),
+ weight="heavy", size=self.text_size)
+ self.text_sr = figtext(0.60, 0.88, ("Sample Rate: %.2f" % self.sample_rate),
+ weight="heavy", size=self.text_size)
+ self.make_plots()
+
+ self.button_left_axes = self.fig.add_axes([0.45, 0.01, 0.05, 0.05], frameon=True)
+ self.button_left = Button(self.button_left_axes, "<")
+ self.button_left_callback = self.button_left.on_clicked(self.button_left_click)
+
+ self.button_right_axes = self.fig.add_axes([0.50, 0.01, 0.05, 0.05], frameon=True)
+ self.button_right = Button(self.button_right_axes, ">")
+ self.button_right_callback = self.button_right.on_clicked(self.button_right_click)
+
+ self.xlim = self.sp_f.get_xlim()
+
+ self.manager = get_current_fig_manager()
+ connect('key_press_event', self.click)
+ show()
+
+ def get_data(self, hfile):
+ self.text_file_pos.set_text("File Position: %d" % (hfile.tell()//self.sizeof_data))
+ try:
+ f = scipy.fromfile(hfile, dtype=self.datatype, count=self.block_length)
+ except MemoryError:
+ print "End of File"
+ else:
+ self.f = scipy.array(f)
+ self.time = scipy.array([i*(1/self.sample_rate) for i in range(len(self.f))])
+
+ def make_plots(self):
+ self.sp_f = self.fig.add_subplot(2,1,1, position=[0.075, 0.2, 0.875, 0.6])
+ self.sp_f.set_title(("Amplitude"), fontsize=self.title_font_size, fontweight="bold")
+ self.sp_f.set_xlabel("Time (s)", fontsize=self.label_font_size, fontweight="bold")
+ self.sp_f.set_ylabel("Amplitude (V)", fontsize=self.label_font_size, fontweight="bold")
+ self.plot_f = list()
+
+ maxval = -1e12
+ minval = 1e12
+
+ for hf in self.hfile:
+ # if specified on the command-line, set file pointer
+ hf.seek(self.sizeof_data*self.start, 1)
+
+ self.get_data(hf)
+
+ # Subplot for real and imaginary parts of signal
+ self.plot_f += plot(self.time, self.f, 'o-')
+ maxval = max(maxval, self.f.max())
+ minval = min(minval, self.f.min())
+
+ self.sp_f.set_ylim([1.5*minval, 1.5*maxval])
+
+ self.leg = self.sp_f.legend(self.plot_f, self.legend_text)
+
+ draw()
+
+ def update_plots(self):
+ maxval = -1e12
+ minval = 1e12
+ for hf,p in zip(self.hfile,self.plot_f):
+ self.get_data(hf)
+ p.set_data([self.time, self.f])
+ maxval = max(maxval, self.f.max())
+ minval = min(minval, self.f.min())
+
+ self.sp_f.set_ylim([1.5*minval, 1.5*maxval])
+
+ draw()
+
+ def click(self, event):
+ forward_valid_keys = [" ", "down", "right"]
+ backward_valid_keys = ["up", "left"]
+
+ if(find(event.key, forward_valid_keys)):
+ self.step_forward()
+
+ elif(find(event.key, backward_valid_keys)):
+ self.step_backward()
+
+ def button_left_click(self, event):
+ self.step_backward()
+
+ def button_right_click(self, event):
+ self.step_forward()
+
+ def step_forward(self):
+ self.update_plots()
+
+ def step_backward(self):
+ for hf in self.hfile:
+ # Step back in file position
+ if(hf.tell() >= 2*self.sizeof_data*self.block_length ):
+ hf.seek(-2*self.sizeof_data*self.block_length, 1)
+ else:
+ hf.seek(-hf.tell(),1)
+ self.update_plots()
+
+
+def find(item_in, list_search):
+ try:
+ return list_search.index(item_in) != None
+ except ValueError:
+ return False
diff --git a/gr-utils/src/python/plot_fft_base.py b/gr-utils/src/python/plot_fft_base.py
new file mode 100755
index 000000000..4afdc3a36
--- /dev/null
+++ b/gr-utils/src/python/plot_fft_base.py
@@ -0,0 +1,249 @@
+#!/usr/bin/env python
+#
+# Copyright 2007,2008,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.
+#
+
+try:
+ import scipy
+ from scipy import fftpack
+except ImportError:
+ print "Please install SciPy to run this script (http://www.scipy.org/)"
+ raise SystemExit, 1
+
+try:
+ from pylab import *
+except ImportError:
+ print "Please install Matplotlib to run this script (http://matplotlib.sourceforge.net/)"
+ raise SystemExit, 1
+
+from optparse import OptionParser
+
+class plot_fft_base:
+ def __init__(self, datatype, filename, options):
+ self.hfile = open(filename, "r")
+ self.block_length = options.block
+ self.start = options.start
+ self.sample_rate = options.sample_rate
+
+ self.datatype = getattr(scipy, datatype)
+ self.sizeof_data = self.datatype().nbytes # number of bytes per sample in file
+
+ self.axis_font_size = 16
+ self.label_font_size = 18
+ self.title_font_size = 20
+ self.text_size = 22
+
+ # Setup PLOT
+ self.fig = figure(1, figsize=(16, 12), facecolor='w')
+ rcParams['xtick.labelsize'] = self.axis_font_size
+ rcParams['ytick.labelsize'] = self.axis_font_size
+
+ self.text_file = figtext(0.10, 0.94, ("File: %s" % filename), weight="heavy", size=self.text_size)
+ self.text_file_pos = figtext(0.10, 0.88, "File Position: ", weight="heavy", size=self.text_size)
+ self.text_block = figtext(0.35, 0.88, ("Block Size: %d" % self.block_length),
+ weight="heavy", size=self.text_size)
+ self.text_sr = figtext(0.60, 0.88, ("Sample Rate: %.2f" % self.sample_rate),
+ weight="heavy", size=self.text_size)
+ self.make_plots()
+
+ self.button_left_axes = self.fig.add_axes([0.45, 0.01, 0.05, 0.05], frameon=True)
+ self.button_left = Button(self.button_left_axes, "<")
+ self.button_left_callback = self.button_left.on_clicked(self.button_left_click)
+
+ self.button_right_axes = self.fig.add_axes([0.50, 0.01, 0.05, 0.05], frameon=True)
+ self.button_right = Button(self.button_right_axes, ">")
+ self.button_right_callback = self.button_right.on_clicked(self.button_right_click)
+
+ self.xlim = self.sp_iq.get_xlim()
+
+ self.manager = get_current_fig_manager()
+ connect('draw_event', self.zoom)
+ connect('key_press_event', self.click)
+ show()
+
+ def get_data(self):
+ self.position = self.hfile.tell()/self.sizeof_data
+ self.text_file_pos.set_text("File Position: %d" % (self.position))
+ try:
+ self.iq = scipy.fromfile(self.hfile, dtype=self.datatype, count=self.block_length)
+ except MemoryError:
+ print "End of File"
+ else:
+ self.iq_fft = self.dofft(self.iq)
+
+ tstep = 1.0 / self.sample_rate
+ #self.time = scipy.array([tstep*(self.position + i) for i in xrange(len(self.iq))])
+ self.time = scipy.array([tstep*(i) for i in xrange(len(self.iq))])
+
+ self.freq = self.calc_freq(self.time, self.sample_rate)
+
+ def dofft(self, iq):
+ N = len(iq)
+ iq_fft = scipy.fftpack.fftshift(scipy.fft(iq)) # fft and shift axis
+ iq_fft = 20*scipy.log10(abs((iq_fft+1e-15)/N)) # convert to decibels, adjust power
+ # adding 1e-15 (-300 dB) to protect against value errors if an item in iq_fft is 0
+ return iq_fft
+
+ def calc_freq(self, time, sample_rate):
+ N = len(time)
+ Fs = 1.0 / (time.max() - time.min())
+ Fn = 0.5 * sample_rate
+ freq = scipy.array([-Fn + i*Fs for i in xrange(N)])
+ return freq
+
+ def make_plots(self):
+ # if specified on the command-line, set file pointer
+ self.hfile.seek(self.sizeof_data*self.start, 1)
+
+ # Subplot for real and imaginary parts of signal
+ self.sp_iq = self.fig.add_subplot(2,2,1, position=[0.075, 0.2, 0.4, 0.6])
+ self.sp_iq.set_title(("I&Q"), fontsize=self.title_font_size, fontweight="bold")
+ self.sp_iq.set_xlabel("Time (s)", fontsize=self.label_font_size, fontweight="bold")
+ self.sp_iq.set_ylabel("Amplitude (V)", fontsize=self.label_font_size, fontweight="bold")
+
+ # Subplot for FFT plot
+ self.sp_fft = self.fig.add_subplot(2,2,2, position=[0.575, 0.2, 0.4, 0.6])
+ self.sp_fft.set_title(("FFT"), fontsize=self.title_font_size, fontweight="bold")
+ self.sp_fft.set_xlabel("Frequency (Hz)", fontsize=self.label_font_size, fontweight="bold")
+ self.sp_fft.set_ylabel("Power Spectrum (dBm)", fontsize=self.label_font_size, fontweight="bold")
+
+ self.get_data()
+
+ self.plot_iq = self.sp_iq.plot([], 'bo-') # make plot for reals
+ self.plot_iq += self.sp_iq.plot([], 'ro-') # make plot for imags
+ self.draw_time() # draw the plot
+
+ self.plot_fft = self.sp_fft.plot([], 'bo-') # make plot for FFT
+ self.draw_fft() # draw the plot
+
+ draw()
+
+ def draw_time(self):
+ reals = self.iq.real
+ imags = self.iq.imag
+ self.plot_iq[0].set_data([self.time, reals])
+ self.plot_iq[1].set_data([self.time, imags])
+ self.sp_iq.set_xlim(self.time.min(), self.time.max())
+ self.sp_iq.set_ylim([1.5*min([reals.min(), imags.min()]),
+ 1.5*max([reals.max(), imags.max()])])
+
+ def draw_fft(self):
+ self.plot_fft[0].set_data([self.freq, self.iq_fft])
+ self.sp_fft.set_xlim(self.freq.min(), self.freq.max())
+ self.sp_fft.set_ylim([self.iq_fft.min()-10, self.iq_fft.max()+10])
+
+ def update_plots(self):
+ self.draw_time()
+ self.draw_fft()
+
+ self.xlim = self.sp_iq.get_xlim()
+ draw()
+
+ def zoom(self, event):
+ newxlim = scipy.array(self.sp_iq.get_xlim())
+ curxlim = scipy.array(self.xlim)
+ if(newxlim[0] != curxlim[0] or newxlim[1] != curxlim[1]):
+ self.xlim = newxlim
+ #xmin = max(0, int(ceil(self.sample_rate*(self.xlim[0] - self.position))))
+ #xmax = min(int(ceil(self.sample_rate*(self.xlim[1] - self.position))), len(self.iq))
+ xmin = max(0, int(ceil(self.sample_rate*(self.xlim[0]))))
+ xmax = min(int(ceil(self.sample_rate*(self.xlim[1]))), len(self.iq))
+
+ iq = self.iq[xmin : xmax]
+ time = self.time[xmin : xmax]
+
+ iq_fft = self.dofft(iq)
+ freq = self.calc_freq(time, self.sample_rate)
+
+ self.plot_fft[0].set_data(freq, iq_fft)
+ self.sp_fft.axis([freq.min(), freq.max(),
+ iq_fft.min()-10, iq_fft.max()+10])
+
+ draw()
+
+ def click(self, event):
+ forward_valid_keys = [" ", "down", "right"]
+ backward_valid_keys = ["up", "left"]
+
+ if(find(event.key, forward_valid_keys)):
+ self.step_forward()
+
+ elif(find(event.key, backward_valid_keys)):
+ self.step_backward()
+
+ def button_left_click(self, event):
+ self.step_backward()
+
+ def button_right_click(self, event):
+ self.step_forward()
+
+ def step_forward(self):
+ self.get_data()
+ self.update_plots()
+
+ def step_backward(self):
+ # Step back in file position
+ if(self.hfile.tell() >= 2*self.sizeof_data*self.block_length ):
+ self.hfile.seek(-2*self.sizeof_data*self.block_length, 1)
+ else:
+ self.hfile.seek(-self.hfile.tell(),1)
+ self.get_data()
+ self.update_plots()
+
+ @staticmethod
+ def setup_options():
+ usage="%prog: [options] input_filename"
+ description = "Takes a GNU Radio complex binary file and displays the I&Q data versus time as well as the frequency domain (FFT) plot. The y-axis values are plotted assuming volts as the amplitude of the I&Q streams and converted into dBm in the frequency domain (the 1/N power adjustment out of the FFT is performed internally). The script plots a certain block of data at a time, specified on the command line as -B or --block. This value defaults to 1000. The start position in the file can be set by specifying -s or --start and defaults to 0 (the start of the file). By default, the system assumes a sample rate of 1, so in time, each sample is plotted versus the sample number. To set a true time and frequency axis, set the sample rate (-R or --sample-rate) to the sample rate used when capturing the samples."
+
+ parser = OptionParser(conflict_handler="resolve", usage=usage, description=description)
+ parser.add_option("-d", "--data-type", type="string", default="complex64",
+ help="Specify the data type (complex64, float32, (u)int32, (u)int16, (u)int8) [default=%default]")
+ parser.add_option("-B", "--block", type="int", default=1000,
+ help="Specify the block size [default=%default]")
+ parser.add_option("-s", "--start", type="int", default=0,
+ help="Specify where to start in the file [default=%default]")
+ parser.add_option("-R", "--sample-rate", type="float", default=1.0,
+ help="Set the sampler rate of the data [default=%default]")
+ return parser
+
+def find(item_in, list_search):
+ try:
+ return list_search.index(item_in) != None
+ except ValueError:
+ return False
+
+def main():
+ parser = plot_fft_base.setup_options()
+ (options, args) = parser.parse_args ()
+ if len(args) != 1:
+ parser.print_help()
+ raise SystemExit, 1
+ filename = args[0]
+
+ dc = plot_fft_base(options.data_type, filename, options)
+
+if __name__ == "__main__":
+ try:
+ main()
+ except KeyboardInterrupt:
+ pass
+
+
+
diff --git a/gr-utils/src/python/plot_psd_base.py b/gr-utils/src/python/plot_psd_base.py
new file mode 100755
index 000000000..fe3c9e12b
--- /dev/null
+++ b/gr-utils/src/python/plot_psd_base.py
@@ -0,0 +1,292 @@
+#!/usr/bin/env python
+#
+# Copyright 2007,2008,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.
+#
+
+try:
+ import scipy
+ from scipy import fftpack
+except ImportError:
+ print "Please install SciPy to run this script (http://www.scipy.org/)"
+ raise SystemExit, 1
+
+try:
+ from pylab import *
+except ImportError:
+ print "Please install Matplotlib to run this script (http://matplotlib.sourceforge.net/)"
+ raise SystemExit, 1
+
+from optparse import OptionParser
+from scipy import log10
+from gnuradio.eng_option import eng_option
+
+class plot_psd_base:
+ def __init__(self, datatype, filename, options):
+ self.hfile = open(filename, "r")
+ self.block_length = options.block
+ self.start = options.start
+ self.sample_rate = options.sample_rate
+ self.psdfftsize = options.psd_size
+ self.specfftsize = options.spec_size
+
+ self.dospec = options.enable_spec # if we want to plot the spectrogram
+
+ self.datatype = getattr(scipy, datatype) #scipy.complex64
+ self.sizeof_data = self.datatype().nbytes # number of bytes per sample in file
+
+ self.axis_font_size = 16
+ self.label_font_size = 18
+ self.title_font_size = 20
+ self.text_size = 22
+
+ # Setup PLOT
+ self.fig = figure(1, figsize=(16, 12), facecolor='w')
+ rcParams['xtick.labelsize'] = self.axis_font_size
+ rcParams['ytick.labelsize'] = self.axis_font_size
+
+ self.text_file = figtext(0.10, 0.95, ("File: %s" % filename),
+ weight="heavy", size=self.text_size)
+ self.text_file_pos = figtext(0.10, 0.92, "File Position: ",
+ weight="heavy", size=self.text_size)
+ self.text_block = figtext(0.35, 0.92, ("Block Size: %d" % self.block_length),
+ weight="heavy", size=self.text_size)
+ self.text_sr = figtext(0.60, 0.915, ("Sample Rate: %.2f" % self.sample_rate),
+ weight="heavy", size=self.text_size)
+ self.make_plots()
+
+ self.button_left_axes = self.fig.add_axes([0.45, 0.01, 0.05, 0.05], frameon=True)
+ self.button_left = Button(self.button_left_axes, "<")
+ self.button_left_callback = self.button_left.on_clicked(self.button_left_click)
+
+ self.button_right_axes = self.fig.add_axes([0.50, 0.01, 0.05, 0.05], frameon=True)
+ self.button_right = Button(self.button_right_axes, ">")
+ self.button_right_callback = self.button_right.on_clicked(self.button_right_click)
+
+ self.xlim = scipy.array(self.sp_iq.get_xlim())
+
+ self.manager = get_current_fig_manager()
+ connect('draw_event', self.zoom)
+ connect('key_press_event', self.click)
+ show()
+
+ def get_data(self):
+ self.position = self.hfile.tell()/self.sizeof_data
+ self.text_file_pos.set_text("File Position: %d" % self.position)
+ try:
+ self.iq = scipy.fromfile(self.hfile, dtype=self.datatype, count=self.block_length)
+ except MemoryError:
+ print "End of File"
+ return False
+ else:
+ # retesting length here as newer version of scipy does not throw a MemoryError, just
+ # returns a zero-length array
+ if(len(self.iq) > 0):
+ tstep = 1.0 / self.sample_rate
+ #self.time = scipy.array([tstep*(self.position + i) for i in xrange(len(self.iq))])
+ self.time = scipy.array([tstep*(i) for i in xrange(len(self.iq))])
+
+ self.iq_psd, self.freq = self.dopsd(self.iq)
+ return True
+ else:
+ print "End of File"
+ return False
+
+ def dopsd(self, iq):
+ ''' Need to do this here and plot later so we can do the fftshift '''
+ overlap = self.psdfftsize/4
+ winfunc = scipy.blackman
+ psd,freq = mlab.psd(iq, self.psdfftsize, self.sample_rate,
+ window = lambda d: d*winfunc(self.psdfftsize),
+ noverlap = overlap)
+ psd = 10.0*log10(abs(psd))
+ return (psd, freq)
+
+ def make_plots(self):
+ # if specified on the command-line, set file pointer
+ self.hfile.seek(self.sizeof_data*self.start, 1)
+
+ iqdims = [[0.075, 0.2, 0.4, 0.6], [0.075, 0.55, 0.4, 0.3]]
+ psddims = [[0.575, 0.2, 0.4, 0.6], [0.575, 0.55, 0.4, 0.3]]
+ specdims = [0.2, 0.125, 0.6, 0.3]
+
+ # Subplot for real and imaginary parts of signal
+ self.sp_iq = self.fig.add_subplot(2,2,1, position=iqdims[self.dospec])
+ self.sp_iq.set_title(("I&Q"), fontsize=self.title_font_size, fontweight="bold")
+ self.sp_iq.set_xlabel("Time (s)", fontsize=self.label_font_size, fontweight="bold")
+ self.sp_iq.set_ylabel("Amplitude (V)", fontsize=self.label_font_size, fontweight="bold")
+
+ # Subplot for PSD plot
+ self.sp_psd = self.fig.add_subplot(2,2,2, position=psddims[self.dospec])
+ self.sp_psd.set_title(("PSD"), fontsize=self.title_font_size, fontweight="bold")
+ self.sp_psd.set_xlabel("Frequency (Hz)", fontsize=self.label_font_size, fontweight="bold")
+ self.sp_psd.set_ylabel("Power Spectrum (dBm)", fontsize=self.label_font_size, fontweight="bold")
+
+ r = self.get_data()
+
+ self.plot_iq = self.sp_iq.plot([], 'bo-') # make plot for reals
+ self.plot_iq += self.sp_iq.plot([], 'ro-') # make plot for imags
+ self.draw_time(self.time, self.iq) # draw the plot
+
+ self.plot_psd = self.sp_psd.plot([], 'b') # make plot for PSD
+ self.draw_psd(self.freq, self.iq_psd) # draw the plot
+
+
+ if self.dospec:
+ # Subplot for spectrogram plot
+ self.sp_spec = self.fig.add_subplot(2,2,3, position=specdims)
+ self.sp_spec.set_title(("Spectrogram"), fontsize=self.title_font_size, fontweight="bold")
+ self.sp_spec.set_xlabel("Time (s)", fontsize=self.label_font_size, fontweight="bold")
+ self.sp_spec.set_ylabel("Frequency (Hz)", fontsize=self.label_font_size, fontweight="bold")
+
+ self.draw_spec(self.time, self.iq)
+
+ draw()
+
+ def draw_time(self, t, iq):
+ reals = iq.real
+ imags = iq.imag
+ self.plot_iq[0].set_data([t, reals])
+ self.plot_iq[1].set_data([t, imags])
+ self.sp_iq.set_xlim(t.min(), t.max())
+ self.sp_iq.set_ylim([1.5*min([reals.min(), imags.min()]),
+ 1.5*max([reals.max(), imags.max()])])
+
+ def draw_psd(self, f, p):
+ self.plot_psd[0].set_data([f, p])
+ self.sp_psd.set_ylim([p.min()-10, p.max()+10])
+ self.sp_psd.set_xlim([f.min(), f.max()])
+
+ def draw_spec(self, t, s):
+ overlap = self.specfftsize/4
+ winfunc = scipy.blackman
+ self.sp_spec.clear()
+ self.sp_spec.specgram(s, self.specfftsize, self.sample_rate,
+ window = lambda d: d*winfunc(self.specfftsize),
+ noverlap = overlap, xextent=[t.min(), t.max()])
+
+ def update_plots(self):
+ self.draw_time(self.time, self.iq)
+ self.draw_psd(self.freq, self.iq_psd)
+
+ if self.dospec:
+ self.draw_spec(self.time, self.iq)
+
+ self.xlim = scipy.array(self.sp_iq.get_xlim()) # so zoom doesn't get called
+
+ draw()
+
+ def zoom(self, event):
+ newxlim = scipy.array(self.sp_iq.get_xlim())
+ curxlim = scipy.array(self.xlim)
+ if(newxlim[0] != curxlim[0] or newxlim[1] != curxlim[1]):
+ #xmin = max(0, int(ceil(self.sample_rate*(newxlim[0] - self.position))))
+ #xmax = min(int(ceil(self.sample_rate*(newxlim[1] - self.position))), len(self.iq))
+ xmin = max(0, int(ceil(self.sample_rate*(newxlim[0]))))
+ xmax = min(int(ceil(self.sample_rate*(newxlim[1]))), len(self.iq))
+
+ iq = scipy.array(self.iq[xmin : xmax])
+ time = scipy.array(self.time[xmin : xmax])
+
+ iq_psd, freq = self.dopsd(iq)
+
+ self.draw_psd(freq, iq_psd)
+ self.xlim = scipy.array(self.sp_iq.get_xlim())
+
+ draw()
+
+ def click(self, event):
+ forward_valid_keys = [" ", "down", "right"]
+ backward_valid_keys = ["up", "left"]
+
+ if(find(event.key, forward_valid_keys)):
+ self.step_forward()
+
+ elif(find(event.key, backward_valid_keys)):
+ self.step_backward()
+
+ def button_left_click(self, event):
+ self.step_backward()
+
+ def button_right_click(self, event):
+ self.step_forward()
+
+ def step_forward(self):
+ r = self.get_data()
+ if(r):
+ self.update_plots()
+
+ def step_backward(self):
+ # Step back in file position
+ if(self.hfile.tell() >= 2*self.sizeof_data*self.block_length ):
+ self.hfile.seek(-2*self.sizeof_data*self.block_length, 1)
+ else:
+ self.hfile.seek(-self.hfile.tell(),1)
+ r = self.get_data()
+ if(r):
+ self.update_plots()
+
+ @staticmethod
+ def setup_options():
+ usage="%prog: [options] input_filename"
+ description = "Takes a GNU Radio binary file (with specified data type using --data-type) and displays the I&Q data versus time as well as the power spectral density (PSD) plot. The y-axis values are plotted assuming volts as the amplitude of the I&Q streams and converted into dBm in the frequency domain (the 1/N power adjustment out of the FFT is performed internally). The script plots a certain block of data at a time, specified on the command line as -B or --block. The start position in the file can be set by specifying -s or --start and defaults to 0 (the start of the file). By default, the system assumes a sample rate of 1, so in time, each sample is plotted versus the sample number. To set a true time and frequency axis, set the sample rate (-R or --sample-rate) to the sample rate used when capturing the samples. Finally, the size of the FFT to use for the PSD and spectrogram plots can be set independently with --psd-size and --spec-size, respectively. The spectrogram plot does not display by default and is turned on with -S or --enable-spec."
+
+ parser = OptionParser(option_class=eng_option, conflict_handler="resolve",
+ usage=usage, description=description)
+ parser.add_option("-d", "--data-type", type="string", default="complex64",
+ help="Specify the data type (complex64, float32, (u)int32, (u)int16, (u)int8) [default=%default]")
+ parser.add_option("-B", "--block", type="int", default=8192,
+ help="Specify the block size [default=%default]")
+ parser.add_option("-s", "--start", type="int", default=0,
+ help="Specify where to start in the file [default=%default]")
+ parser.add_option("-R", "--sample-rate", type="eng_float", default=1.0,
+ help="Set the sampler rate of the data [default=%default]")
+ parser.add_option("", "--psd-size", type="int", default=1024,
+ help="Set the size of the PSD FFT [default=%default]")
+ parser.add_option("", "--spec-size", type="int", default=256,
+ help="Set the size of the spectrogram FFT [default=%default]")
+ parser.add_option("-S", "--enable-spec", action="store_true", default=False,
+ help="Turn on plotting the spectrogram [default=%default]")
+
+ return parser
+
+def find(item_in, list_search):
+ try:
+ return list_search.index(item_in) != None
+ except ValueError:
+ return False
+
+def main():
+ parser = plot_psd_base.setup_options()
+ (options, args) = parser.parse_args ()
+ if len(args) != 1:
+ parser.print_help()
+ raise SystemExit, 1
+ filename = args[0]
+
+ dc = plot_psd_base(options.data_type, filename, options)
+
+if __name__ == "__main__":
+ try:
+ main()
+ except KeyboardInterrupt:
+ pass
+
+
+
diff --git a/gr-utils/src/python/pyqt_filter.py b/gr-utils/src/python/pyqt_filter.py
new file mode 100644
index 000000000..0c781f234
--- /dev/null
+++ b/gr-utils/src/python/pyqt_filter.py
@@ -0,0 +1,435 @@
+# -*- coding: utf-8 -*-
+
+# Form implementation generated from reading ui file 'pyqt_filter.ui'
+#
+# Created: Thu Mar 17 10:51:17 2011
+# by: PyQt4 UI code generator 4.7.4
+#
+# WARNING! All changes made in this file will be lost!
+
+from PyQt4 import QtCore, QtGui
+
+class Ui_MainWindow(object):
+ def setupUi(self, MainWindow):
+ MainWindow.setObjectName("MainWindow")
+ MainWindow.resize(1124, 696)
+ self.centralwidget = QtGui.QWidget(MainWindow)
+ self.centralwidget.setObjectName("centralwidget")
+ self.gridLayout = QtGui.QGridLayout(self.centralwidget)
+ self.gridLayout.setObjectName("gridLayout")
+ self.filterFrame = QtGui.QFrame(self.centralwidget)
+ self.filterFrame.setMinimumSize(QtCore.QSize(300, 0))
+ self.filterFrame.setMaximumSize(QtCore.QSize(300, 16777215))
+ self.filterFrame.setFrameShape(QtGui.QFrame.StyledPanel)
+ self.filterFrame.setFrameShadow(QtGui.QFrame.Raised)
+ self.filterFrame.setObjectName("filterFrame")
+ self.verticalLayout = QtGui.QVBoxLayout(self.filterFrame)
+ self.verticalLayout.setObjectName("verticalLayout")
+ self.filterTypeComboBox = QtGui.QComboBox(self.filterFrame)
+ self.filterTypeComboBox.setObjectName("filterTypeComboBox")
+ self.filterTypeComboBox.addItem("")
+ self.filterTypeComboBox.addItem("")
+ self.filterTypeComboBox.addItem("")
+ self.filterTypeComboBox.addItem("")
+ self.filterTypeComboBox.addItem("")
+ self.filterTypeComboBox.addItem("")
+ self.filterTypeComboBox.addItem("")
+ self.verticalLayout.addWidget(self.filterTypeComboBox)
+ self.filterDesignTypeComboBox = QtGui.QComboBox(self.filterFrame)
+ self.filterDesignTypeComboBox.setObjectName("filterDesignTypeComboBox")
+ self.filterDesignTypeComboBox.addItem("")
+ self.filterDesignTypeComboBox.addItem("")
+ self.filterDesignTypeComboBox.addItem("")
+ self.filterDesignTypeComboBox.addItem("")
+ self.filterDesignTypeComboBox.addItem("")
+ self.filterDesignTypeComboBox.addItem("")
+ self.filterDesignTypeComboBox.addItem("")
+ self.verticalLayout.addWidget(self.filterDesignTypeComboBox)
+ self.globalParamsLayout = QtGui.QFormLayout()
+ self.globalParamsLayout.setFieldGrowthPolicy(QtGui.QFormLayout.AllNonFixedFieldsGrow)
+ self.globalParamsLayout.setObjectName("globalParamsLayout")
+ self.sampleRateLabel = QtGui.QLabel(self.filterFrame)
+ self.sampleRateLabel.setMaximumSize(QtCore.QSize(16777215, 30))
+ self.sampleRateLabel.setObjectName("sampleRateLabel")
+ self.globalParamsLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.sampleRateLabel)
+ self.sampleRateEdit = QtGui.QLineEdit(self.filterFrame)
+ self.sampleRateEdit.setMaximumSize(QtCore.QSize(16777215, 30))
+ self.sampleRateEdit.setObjectName("sampleRateEdit")
+ self.globalParamsLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.sampleRateEdit)
+ self.filterGainLabel = QtGui.QLabel(self.filterFrame)
+ self.filterGainLabel.setObjectName("filterGainLabel")
+ self.globalParamsLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.filterGainLabel)
+ self.filterGainEdit = QtGui.QLineEdit(self.filterFrame)
+ self.filterGainEdit.setObjectName("filterGainEdit")
+ self.globalParamsLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.filterGainEdit)
+ self.verticalLayout.addLayout(self.globalParamsLayout)
+ self.filterTypeWidget = QtGui.QStackedWidget(self.filterFrame)
+ self.filterTypeWidget.setObjectName("filterTypeWidget")
+ self.firlpfPage = QtGui.QWidget()
+ self.firlpfPage.setObjectName("firlpfPage")
+ self.formLayout = QtGui.QFormLayout(self.firlpfPage)
+ self.formLayout.setObjectName("formLayout")
+ self.endofLpfPassBandLabel = QtGui.QLabel(self.firlpfPage)
+ self.endofLpfPassBandLabel.setObjectName("endofLpfPassBandLabel")
+ self.formLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.endofLpfPassBandLabel)
+ self.endofLpfPassBandEdit = QtGui.QLineEdit(self.firlpfPage)
+ self.endofLpfPassBandEdit.setObjectName("endofLpfPassBandEdit")
+ self.formLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.endofLpfPassBandEdit)
+ self.startofLpfStopBandLabel = QtGui.QLabel(self.firlpfPage)
+ self.startofLpfStopBandLabel.setObjectName("startofLpfStopBandLabel")
+ self.formLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.startofLpfStopBandLabel)
+ self.startofLpfStopBandEdit = QtGui.QLineEdit(self.firlpfPage)
+ self.startofLpfStopBandEdit.setObjectName("startofLpfStopBandEdit")
+ self.formLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.startofLpfStopBandEdit)
+ self.lpfStopBandAttenLabel = QtGui.QLabel(self.firlpfPage)
+ self.lpfStopBandAttenLabel.setObjectName("lpfStopBandAttenLabel")
+ self.formLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.lpfStopBandAttenLabel)
+ self.lpfStopBandAttenEdit = QtGui.QLineEdit(self.firlpfPage)
+ self.lpfStopBandAttenEdit.setObjectName("lpfStopBandAttenEdit")
+ self.formLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.lpfStopBandAttenEdit)
+ self.lpfPassBandRippleEdit = QtGui.QLineEdit(self.firlpfPage)
+ self.lpfPassBandRippleEdit.setObjectName("lpfPassBandRippleEdit")
+ self.formLayout.setWidget(3, QtGui.QFormLayout.FieldRole, self.lpfPassBandRippleEdit)
+ self.lpfPassBandRippleLabel = QtGui.QLabel(self.firlpfPage)
+ self.lpfPassBandRippleLabel.setObjectName("lpfPassBandRippleLabel")
+ self.formLayout.setWidget(3, QtGui.QFormLayout.LabelRole, self.lpfPassBandRippleLabel)
+ self.filterTypeWidget.addWidget(self.firlpfPage)
+ self.firbpfPage = QtGui.QWidget()
+ self.firbpfPage.setObjectName("firbpfPage")
+ self.formLayout_2 = QtGui.QFormLayout(self.firbpfPage)
+ self.formLayout_2.setObjectName("formLayout_2")
+ self.startofBpfPassBandLabel = QtGui.QLabel(self.firbpfPage)
+ self.startofBpfPassBandLabel.setObjectName("startofBpfPassBandLabel")
+ self.formLayout_2.setWidget(0, QtGui.QFormLayout.LabelRole, self.startofBpfPassBandLabel)
+ self.startofBpfPassBandEdit = QtGui.QLineEdit(self.firbpfPage)
+ self.startofBpfPassBandEdit.setObjectName("startofBpfPassBandEdit")
+ self.formLayout_2.setWidget(0, QtGui.QFormLayout.FieldRole, self.startofBpfPassBandEdit)
+ self.endofBpfPassBandLabel = QtGui.QLabel(self.firbpfPage)
+ self.endofBpfPassBandLabel.setObjectName("endofBpfPassBandLabel")
+ self.formLayout_2.setWidget(1, QtGui.QFormLayout.LabelRole, self.endofBpfPassBandLabel)
+ self.endofBpfPassBandEdit = QtGui.QLineEdit(self.firbpfPage)
+ self.endofBpfPassBandEdit.setObjectName("endofBpfPassBandEdit")
+ self.formLayout_2.setWidget(1, QtGui.QFormLayout.FieldRole, self.endofBpfPassBandEdit)
+ self.bpfStopBandAttenEdit = QtGui.QLineEdit(self.firbpfPage)
+ self.bpfStopBandAttenEdit.setObjectName("bpfStopBandAttenEdit")
+ self.formLayout_2.setWidget(3, QtGui.QFormLayout.FieldRole, self.bpfStopBandAttenEdit)
+ self.bpfStopBandAttenLabel = QtGui.QLabel(self.firbpfPage)
+ self.bpfStopBandAttenLabel.setObjectName("bpfStopBandAttenLabel")
+ self.formLayout_2.setWidget(3, QtGui.QFormLayout.LabelRole, self.bpfStopBandAttenLabel)
+ self.bpfTransitionLabel = QtGui.QLabel(self.firbpfPage)
+ self.bpfTransitionLabel.setObjectName("bpfTransitionLabel")
+ self.formLayout_2.setWidget(2, QtGui.QFormLayout.LabelRole, self.bpfTransitionLabel)
+ self.bpfTransitionEdit = QtGui.QLineEdit(self.firbpfPage)
+ self.bpfTransitionEdit.setObjectName("bpfTransitionEdit")
+ self.formLayout_2.setWidget(2, QtGui.QFormLayout.FieldRole, self.bpfTransitionEdit)
+ self.bpfPassBandRippleEdit = QtGui.QLineEdit(self.firbpfPage)
+ self.bpfPassBandRippleEdit.setObjectName("bpfPassBandRippleEdit")
+ self.formLayout_2.setWidget(4, QtGui.QFormLayout.FieldRole, self.bpfPassBandRippleEdit)
+ self.bpfPassBandRippleLabel = QtGui.QLabel(self.firbpfPage)
+ self.bpfPassBandRippleLabel.setObjectName("bpfPassBandRippleLabel")
+ self.formLayout_2.setWidget(4, QtGui.QFormLayout.LabelRole, self.bpfPassBandRippleLabel)
+ self.filterTypeWidget.addWidget(self.firbpfPage)
+ self.firbnfPage = QtGui.QWidget()
+ self.firbnfPage.setObjectName("firbnfPage")
+ self.formLayout_5 = QtGui.QFormLayout(self.firbnfPage)
+ self.formLayout_5.setFieldGrowthPolicy(QtGui.QFormLayout.AllNonFixedFieldsGrow)
+ self.formLayout_5.setObjectName("formLayout_5")
+ self.startofBnfStopBandLabel = QtGui.QLabel(self.firbnfPage)
+ self.startofBnfStopBandLabel.setObjectName("startofBnfStopBandLabel")
+ self.formLayout_5.setWidget(0, QtGui.QFormLayout.LabelRole, self.startofBnfStopBandLabel)
+ self.startofBnfStopBandEdit = QtGui.QLineEdit(self.firbnfPage)
+ self.startofBnfStopBandEdit.setObjectName("startofBnfStopBandEdit")
+ self.formLayout_5.setWidget(0, QtGui.QFormLayout.FieldRole, self.startofBnfStopBandEdit)
+ self.endofBnfStopBandLabel = QtGui.QLabel(self.firbnfPage)
+ self.endofBnfStopBandLabel.setObjectName("endofBnfStopBandLabel")
+ self.formLayout_5.setWidget(1, QtGui.QFormLayout.LabelRole, self.endofBnfStopBandLabel)
+ self.endofBnfStopBandEdit = QtGui.QLineEdit(self.firbnfPage)
+ self.endofBnfStopBandEdit.setObjectName("endofBnfStopBandEdit")
+ self.formLayout_5.setWidget(1, QtGui.QFormLayout.FieldRole, self.endofBnfStopBandEdit)
+ self.bnfTransitionLabel = QtGui.QLabel(self.firbnfPage)
+ self.bnfTransitionLabel.setObjectName("bnfTransitionLabel")
+ self.formLayout_5.setWidget(2, QtGui.QFormLayout.LabelRole, self.bnfTransitionLabel)
+ self.bnfTransitionEdit = QtGui.QLineEdit(self.firbnfPage)
+ self.bnfTransitionEdit.setObjectName("bnfTransitionEdit")
+ self.formLayout_5.setWidget(2, QtGui.QFormLayout.FieldRole, self.bnfTransitionEdit)
+ self.bnfStopBandAttenLabel = QtGui.QLabel(self.firbnfPage)
+ self.bnfStopBandAttenLabel.setObjectName("bnfStopBandAttenLabel")
+ self.formLayout_5.setWidget(3, QtGui.QFormLayout.LabelRole, self.bnfStopBandAttenLabel)
+ self.bnfStopBandAttenEdit = QtGui.QLineEdit(self.firbnfPage)
+ self.bnfStopBandAttenEdit.setObjectName("bnfStopBandAttenEdit")
+ self.formLayout_5.setWidget(3, QtGui.QFormLayout.FieldRole, self.bnfStopBandAttenEdit)
+ self.bnfPassBandRippleLabel = QtGui.QLabel(self.firbnfPage)
+ self.bnfPassBandRippleLabel.setObjectName("bnfPassBandRippleLabel")
+ self.formLayout_5.setWidget(4, QtGui.QFormLayout.LabelRole, self.bnfPassBandRippleLabel)
+ self.bnfPassBandRippleEdit = QtGui.QLineEdit(self.firbnfPage)
+ self.bnfPassBandRippleEdit.setObjectName("bnfPassBandRippleEdit")
+ self.formLayout_5.setWidget(4, QtGui.QFormLayout.FieldRole, self.bnfPassBandRippleEdit)
+ self.filterTypeWidget.addWidget(self.firbnfPage)
+ self.firhpfPage = QtGui.QWidget()
+ self.firhpfPage.setObjectName("firhpfPage")
+ self.formLayout_3 = QtGui.QFormLayout(self.firhpfPage)
+ self.formLayout_3.setFieldGrowthPolicy(QtGui.QFormLayout.AllNonFixedFieldsGrow)
+ self.formLayout_3.setObjectName("formLayout_3")
+ self.endofHpfStopBandLabel = QtGui.QLabel(self.firhpfPage)
+ self.endofHpfStopBandLabel.setObjectName("endofHpfStopBandLabel")
+ self.formLayout_3.setWidget(0, QtGui.QFormLayout.LabelRole, self.endofHpfStopBandLabel)
+ self.endofHpfStopBandEdit = QtGui.QLineEdit(self.firhpfPage)
+ self.endofHpfStopBandEdit.setObjectName("endofHpfStopBandEdit")
+ self.formLayout_3.setWidget(0, QtGui.QFormLayout.FieldRole, self.endofHpfStopBandEdit)
+ self.startofHpfPassBandLabel = QtGui.QLabel(self.firhpfPage)
+ self.startofHpfPassBandLabel.setObjectName("startofHpfPassBandLabel")
+ self.formLayout_3.setWidget(1, QtGui.QFormLayout.LabelRole, self.startofHpfPassBandLabel)
+ self.startofHpfPassBandEdit = QtGui.QLineEdit(self.firhpfPage)
+ self.startofHpfPassBandEdit.setObjectName("startofHpfPassBandEdit")
+ self.formLayout_3.setWidget(1, QtGui.QFormLayout.FieldRole, self.startofHpfPassBandEdit)
+ self.hpfStopBandAttenLabel = QtGui.QLabel(self.firhpfPage)
+ self.hpfStopBandAttenLabel.setObjectName("hpfStopBandAttenLabel")
+ self.formLayout_3.setWidget(2, QtGui.QFormLayout.LabelRole, self.hpfStopBandAttenLabel)
+ self.hpfStopBandAttenEdit = QtGui.QLineEdit(self.firhpfPage)
+ self.hpfStopBandAttenEdit.setObjectName("hpfStopBandAttenEdit")
+ self.formLayout_3.setWidget(2, QtGui.QFormLayout.FieldRole, self.hpfStopBandAttenEdit)
+ self.hpfPassBandRippleLabel = QtGui.QLabel(self.firhpfPage)
+ self.hpfPassBandRippleLabel.setObjectName("hpfPassBandRippleLabel")
+ self.formLayout_3.setWidget(3, QtGui.QFormLayout.LabelRole, self.hpfPassBandRippleLabel)
+ self.hpfPassBandRippleEdit = QtGui.QLineEdit(self.firhpfPage)
+ self.hpfPassBandRippleEdit.setObjectName("hpfPassBandRippleEdit")
+ self.formLayout_3.setWidget(3, QtGui.QFormLayout.FieldRole, self.hpfPassBandRippleEdit)
+ self.filterTypeWidget.addWidget(self.firhpfPage)
+ self.rrcPage = QtGui.QWidget()
+ self.rrcPage.setObjectName("rrcPage")
+ self.formLayout_6 = QtGui.QFormLayout(self.rrcPage)
+ self.formLayout_6.setObjectName("formLayout_6")
+ self.rrcSymbolRateLabel = QtGui.QLabel(self.rrcPage)
+ self.rrcSymbolRateLabel.setObjectName("rrcSymbolRateLabel")
+ self.formLayout_6.setWidget(0, QtGui.QFormLayout.LabelRole, self.rrcSymbolRateLabel)
+ self.rrcAlphaLabel = QtGui.QLabel(self.rrcPage)
+ self.rrcAlphaLabel.setObjectName("rrcAlphaLabel")
+ self.formLayout_6.setWidget(1, QtGui.QFormLayout.LabelRole, self.rrcAlphaLabel)
+ self.rrcNumTapsLabel = QtGui.QLabel(self.rrcPage)
+ self.rrcNumTapsLabel.setObjectName("rrcNumTapsLabel")
+ self.formLayout_6.setWidget(2, QtGui.QFormLayout.LabelRole, self.rrcNumTapsLabel)
+ self.rrcSymbolRateEdit = QtGui.QLineEdit(self.rrcPage)
+ self.rrcSymbolRateEdit.setObjectName("rrcSymbolRateEdit")
+ self.formLayout_6.setWidget(0, QtGui.QFormLayout.FieldRole, self.rrcSymbolRateEdit)
+ self.rrcAlphaEdit = QtGui.QLineEdit(self.rrcPage)
+ self.rrcAlphaEdit.setObjectName("rrcAlphaEdit")
+ self.formLayout_6.setWidget(1, QtGui.QFormLayout.FieldRole, self.rrcAlphaEdit)
+ self.rrcNumTapsEdit = QtGui.QLineEdit(self.rrcPage)
+ self.rrcNumTapsEdit.setObjectName("rrcNumTapsEdit")
+ self.formLayout_6.setWidget(2, QtGui.QFormLayout.FieldRole, self.rrcNumTapsEdit)
+ self.filterTypeWidget.addWidget(self.rrcPage)
+ self.gausPage = QtGui.QWidget()
+ self.gausPage.setObjectName("gausPage")
+ self.formLayout_7 = QtGui.QFormLayout(self.gausPage)
+ self.formLayout_7.setObjectName("formLayout_7")
+ self.gausSymbolRateLabel = QtGui.QLabel(self.gausPage)
+ self.gausSymbolRateLabel.setObjectName("gausSymbolRateLabel")
+ self.formLayout_7.setWidget(0, QtGui.QFormLayout.LabelRole, self.gausSymbolRateLabel)
+ self.gausSymbolRateEdit = QtGui.QLineEdit(self.gausPage)
+ self.gausSymbolRateEdit.setObjectName("gausSymbolRateEdit")
+ self.formLayout_7.setWidget(0, QtGui.QFormLayout.FieldRole, self.gausSymbolRateEdit)
+ self.gausBTLabel = QtGui.QLabel(self.gausPage)
+ self.gausBTLabel.setObjectName("gausBTLabel")
+ self.formLayout_7.setWidget(1, QtGui.QFormLayout.LabelRole, self.gausBTLabel)
+ self.gausBTEdit = QtGui.QLineEdit(self.gausPage)
+ self.gausBTEdit.setObjectName("gausBTEdit")
+ self.formLayout_7.setWidget(1, QtGui.QFormLayout.FieldRole, self.gausBTEdit)
+ self.gausNumTapsLabel = QtGui.QLabel(self.gausPage)
+ self.gausNumTapsLabel.setObjectName("gausNumTapsLabel")
+ self.formLayout_7.setWidget(2, QtGui.QFormLayout.LabelRole, self.gausNumTapsLabel)
+ self.gausNumTapsEdit = QtGui.QLineEdit(self.gausPage)
+ self.gausNumTapsEdit.setObjectName("gausNumTapsEdit")
+ self.formLayout_7.setWidget(2, QtGui.QFormLayout.FieldRole, self.gausNumTapsEdit)
+ self.filterTypeWidget.addWidget(self.gausPage)
+ self.verticalLayout.addWidget(self.filterTypeWidget)
+ self.filterPropsBox = QtGui.QGroupBox(self.filterFrame)
+ self.filterPropsBox.setObjectName("filterPropsBox")
+ self.formLayout_8 = QtGui.QFormLayout(self.filterPropsBox)
+ self.formLayout_8.setFieldGrowthPolicy(QtGui.QFormLayout.AllNonFixedFieldsGrow)
+ self.formLayout_8.setObjectName("formLayout_8")
+ self.nTapsLabel = QtGui.QLabel(self.filterPropsBox)
+ self.nTapsLabel.setMinimumSize(QtCore.QSize(150, 0))
+ self.nTapsLabel.setObjectName("nTapsLabel")
+ self.formLayout_8.setWidget(1, QtGui.QFormLayout.LabelRole, self.nTapsLabel)
+ self.nTapsEdit = QtGui.QLabel(self.filterPropsBox)
+ self.nTapsEdit.setMaximumSize(QtCore.QSize(100, 16777215))
+ self.nTapsEdit.setFrameShape(QtGui.QFrame.Box)
+ self.nTapsEdit.setFrameShadow(QtGui.QFrame.Raised)
+ self.nTapsEdit.setText("")
+ self.nTapsEdit.setObjectName("nTapsEdit")
+ self.formLayout_8.setWidget(1, QtGui.QFormLayout.FieldRole, self.nTapsEdit)
+ self.verticalLayout.addWidget(self.filterPropsBox)
+ self.sysParamsBox = QtGui.QGroupBox(self.filterFrame)
+ self.sysParamsBox.setObjectName("sysParamsBox")
+ self.formLayout_4 = QtGui.QFormLayout(self.sysParamsBox)
+ self.formLayout_4.setObjectName("formLayout_4")
+ self.nfftEdit = QtGui.QLineEdit(self.sysParamsBox)
+ self.nfftEdit.setObjectName("nfftEdit")
+ self.formLayout_4.setWidget(1, QtGui.QFormLayout.FieldRole, self.nfftEdit)
+ self.nfftLabel = QtGui.QLabel(self.sysParamsBox)
+ self.nfftLabel.setMinimumSize(QtCore.QSize(150, 0))
+ self.nfftLabel.setObjectName("nfftLabel")
+ self.formLayout_4.setWidget(1, QtGui.QFormLayout.LabelRole, self.nfftLabel)
+ self.verticalLayout.addWidget(self.sysParamsBox)
+ self.designButton = QtGui.QPushButton(self.filterFrame)
+ self.designButton.setMinimumSize(QtCore.QSize(0, 0))
+ self.designButton.setMaximumSize(QtCore.QSize(200, 16777215))
+ self.designButton.setAutoDefault(True)
+ self.designButton.setDefault(True)
+ self.designButton.setObjectName("designButton")
+ self.verticalLayout.addWidget(self.designButton)
+ self.gridLayout.addWidget(self.filterFrame, 1, 0, 1, 1)
+ self.tabGroup = QtGui.QTabWidget(self.centralwidget)
+ self.tabGroup.setMinimumSize(QtCore.QSize(800, 0))
+ self.tabGroup.setObjectName("tabGroup")
+ self.freqTab = QtGui.QWidget()
+ self.freqTab.setObjectName("freqTab")
+ self.horizontalLayout_2 = QtGui.QHBoxLayout(self.freqTab)
+ self.horizontalLayout_2.setObjectName("horizontalLayout_2")
+ self.freqPlot = QwtPlot(self.freqTab)
+ self.freqPlot.setObjectName("freqPlot")
+ self.horizontalLayout_2.addWidget(self.freqPlot)
+ self.tabGroup.addTab(self.freqTab, "")
+ self.timeTab = QtGui.QWidget()
+ self.timeTab.setObjectName("timeTab")
+ self.horizontalLayout = QtGui.QHBoxLayout(self.timeTab)
+ self.horizontalLayout.setObjectName("horizontalLayout")
+ self.timePlot = QwtPlot(self.timeTab)
+ self.timePlot.setObjectName("timePlot")
+ self.horizontalLayout.addWidget(self.timePlot)
+ self.tabGroup.addTab(self.timeTab, "")
+ self.phaseTab = QtGui.QWidget()
+ self.phaseTab.setObjectName("phaseTab")
+ self.horizontalLayout_3 = QtGui.QHBoxLayout(self.phaseTab)
+ self.horizontalLayout_3.setObjectName("horizontalLayout_3")
+ self.phasePlot = QwtPlot(self.phaseTab)
+ self.phasePlot.setObjectName("phasePlot")
+ self.horizontalLayout_3.addWidget(self.phasePlot)
+ self.tabGroup.addTab(self.phaseTab, "")
+ self.groupTab = QtGui.QWidget()
+ self.groupTab.setObjectName("groupTab")
+ self.horizontalLayout_4 = QtGui.QHBoxLayout(self.groupTab)
+ self.horizontalLayout_4.setObjectName("horizontalLayout_4")
+ self.groupPlot = QwtPlot(self.groupTab)
+ self.groupPlot.setObjectName("groupPlot")
+ self.horizontalLayout_4.addWidget(self.groupPlot)
+ self.tabGroup.addTab(self.groupTab, "")
+ self.gridLayout.addWidget(self.tabGroup, 1, 1, 1, 1)
+ MainWindow.setCentralWidget(self.centralwidget)
+ self.menubar = QtGui.QMenuBar(MainWindow)
+ self.menubar.setGeometry(QtCore.QRect(0, 0, 1124, 27))
+ self.menubar.setObjectName("menubar")
+ self.menu_File = QtGui.QMenu(self.menubar)
+ self.menu_File.setObjectName("menu_File")
+ MainWindow.setMenuBar(self.menubar)
+ self.statusbar = QtGui.QStatusBar(MainWindow)
+ self.statusbar.setObjectName("statusbar")
+ MainWindow.setStatusBar(self.statusbar)
+ self.action_exit = QtGui.QAction(MainWindow)
+ self.action_exit.setObjectName("action_exit")
+ self.action_save = QtGui.QAction(MainWindow)
+ self.action_save.setObjectName("action_save")
+ self.action_open = QtGui.QAction(MainWindow)
+ self.action_open.setObjectName("action_open")
+ self.menu_File.addAction(self.action_open)
+ self.menu_File.addAction(self.action_save)
+ self.menu_File.addAction(self.action_exit)
+ self.menubar.addAction(self.menu_File.menuAction())
+
+ self.retranslateUi(MainWindow)
+ self.filterTypeWidget.setCurrentIndex(5)
+ self.tabGroup.setCurrentIndex(0)
+ QtCore.QObject.connect(self.action_exit, QtCore.SIGNAL("activated()"), MainWindow.close)
+ QtCore.QMetaObject.connectSlotsByName(MainWindow)
+ MainWindow.setTabOrder(self.filterTypeComboBox, self.filterDesignTypeComboBox)
+ MainWindow.setTabOrder(self.filterDesignTypeComboBox, self.sampleRateEdit)
+ MainWindow.setTabOrder(self.sampleRateEdit, self.filterGainEdit)
+ MainWindow.setTabOrder(self.filterGainEdit, self.endofLpfPassBandEdit)
+ MainWindow.setTabOrder(self.endofLpfPassBandEdit, self.startofLpfStopBandEdit)
+ MainWindow.setTabOrder(self.startofLpfStopBandEdit, self.lpfStopBandAttenEdit)
+ MainWindow.setTabOrder(self.lpfStopBandAttenEdit, self.lpfPassBandRippleEdit)
+ MainWindow.setTabOrder(self.lpfPassBandRippleEdit, self.startofBpfPassBandEdit)
+ MainWindow.setTabOrder(self.startofBpfPassBandEdit, self.endofBpfPassBandEdit)
+ MainWindow.setTabOrder(self.endofBpfPassBandEdit, self.bpfTransitionEdit)
+ MainWindow.setTabOrder(self.bpfTransitionEdit, self.bpfStopBandAttenEdit)
+ MainWindow.setTabOrder(self.bpfStopBandAttenEdit, self.bpfPassBandRippleEdit)
+ MainWindow.setTabOrder(self.bpfPassBandRippleEdit, self.startofBnfStopBandEdit)
+ MainWindow.setTabOrder(self.startofBnfStopBandEdit, self.endofBnfStopBandEdit)
+ MainWindow.setTabOrder(self.endofBnfStopBandEdit, self.bnfTransitionEdit)
+ MainWindow.setTabOrder(self.bnfTransitionEdit, self.bnfStopBandAttenEdit)
+ MainWindow.setTabOrder(self.bnfStopBandAttenEdit, self.bnfPassBandRippleEdit)
+ MainWindow.setTabOrder(self.bnfPassBandRippleEdit, self.endofHpfStopBandEdit)
+ MainWindow.setTabOrder(self.endofHpfStopBandEdit, self.startofHpfPassBandEdit)
+ MainWindow.setTabOrder(self.startofHpfPassBandEdit, self.hpfStopBandAttenEdit)
+ MainWindow.setTabOrder(self.hpfStopBandAttenEdit, self.hpfPassBandRippleEdit)
+ MainWindow.setTabOrder(self.hpfPassBandRippleEdit, self.rrcSymbolRateEdit)
+ MainWindow.setTabOrder(self.rrcSymbolRateEdit, self.rrcAlphaEdit)
+ MainWindow.setTabOrder(self.rrcAlphaEdit, self.rrcNumTapsEdit)
+ MainWindow.setTabOrder(self.rrcNumTapsEdit, self.gausSymbolRateEdit)
+ MainWindow.setTabOrder(self.gausSymbolRateEdit, self.gausBTEdit)
+ MainWindow.setTabOrder(self.gausBTEdit, self.gausNumTapsEdit)
+ MainWindow.setTabOrder(self.gausNumTapsEdit, self.nfftEdit)
+ MainWindow.setTabOrder(self.nfftEdit, self.designButton)
+ MainWindow.setTabOrder(self.designButton, self.tabGroup)
+
+ def retranslateUi(self, MainWindow):
+ MainWindow.setWindowTitle(QtGui.QApplication.translate("MainWindow", "GNU Radio Filter Design Tool", None, QtGui.QApplication.UnicodeUTF8))
+ self.filterTypeComboBox.setItemText(0, QtGui.QApplication.translate("MainWindow", "Low Pass", None, QtGui.QApplication.UnicodeUTF8))
+ self.filterTypeComboBox.setItemText(1, QtGui.QApplication.translate("MainWindow", "Band Pass", None, QtGui.QApplication.UnicodeUTF8))
+ self.filterTypeComboBox.setItemText(2, QtGui.QApplication.translate("MainWindow", "Complex Band Pass", None, QtGui.QApplication.UnicodeUTF8))
+ self.filterTypeComboBox.setItemText(3, QtGui.QApplication.translate("MainWindow", "Band Notch", None, QtGui.QApplication.UnicodeUTF8))
+ self.filterTypeComboBox.setItemText(4, QtGui.QApplication.translate("MainWindow", "High Pass", None, QtGui.QApplication.UnicodeUTF8))
+ self.filterTypeComboBox.setItemText(5, QtGui.QApplication.translate("MainWindow", "Root Raised Cosine", None, QtGui.QApplication.UnicodeUTF8))
+ self.filterTypeComboBox.setItemText(6, QtGui.QApplication.translate("MainWindow", "Gaussian", None, QtGui.QApplication.UnicodeUTF8))
+ self.filterDesignTypeComboBox.setItemText(0, QtGui.QApplication.translate("MainWindow", "Hamming Window", None, QtGui.QApplication.UnicodeUTF8))
+ self.filterDesignTypeComboBox.setItemText(1, QtGui.QApplication.translate("MainWindow", "Hann Window", None, QtGui.QApplication.UnicodeUTF8))
+ self.filterDesignTypeComboBox.setItemText(2, QtGui.QApplication.translate("MainWindow", "Blackman Window", None, QtGui.QApplication.UnicodeUTF8))
+ self.filterDesignTypeComboBox.setItemText(3, QtGui.QApplication.translate("MainWindow", "Rectangular Window", None, QtGui.QApplication.UnicodeUTF8))
+ self.filterDesignTypeComboBox.setItemText(4, QtGui.QApplication.translate("MainWindow", "Kaiser Window", None, QtGui.QApplication.UnicodeUTF8))
+ self.filterDesignTypeComboBox.setItemText(5, QtGui.QApplication.translate("MainWindow", "Blackman-harris Window", None, QtGui.QApplication.UnicodeUTF8))
+ self.filterDesignTypeComboBox.setItemText(6, QtGui.QApplication.translate("MainWindow", "Equiripple", None, QtGui.QApplication.UnicodeUTF8))
+ self.sampleRateLabel.setText(QtGui.QApplication.translate("MainWindow", "Sample Rate (sps)", None, QtGui.QApplication.UnicodeUTF8))
+ self.filterGainLabel.setText(QtGui.QApplication.translate("MainWindow", "Filter Gain", None, QtGui.QApplication.UnicodeUTF8))
+ self.endofLpfPassBandLabel.setText(QtGui.QApplication.translate("MainWindow", "End of Pass Band (Hz)", None, QtGui.QApplication.UnicodeUTF8))
+ self.startofLpfStopBandLabel.setText(QtGui.QApplication.translate("MainWindow", "Start of Stop Band (Hz)", None, QtGui.QApplication.UnicodeUTF8))
+ self.lpfStopBandAttenLabel.setText(QtGui.QApplication.translate("MainWindow", "Stop Band Attenuation (dB)", None, QtGui.QApplication.UnicodeUTF8))
+ self.lpfPassBandRippleLabel.setText(QtGui.QApplication.translate("MainWindow", "Pass Band Ripple (dB)", None, QtGui.QApplication.UnicodeUTF8))
+ self.startofBpfPassBandLabel.setText(QtGui.QApplication.translate("MainWindow", "Start of Pass Band (Hz)", None, QtGui.QApplication.UnicodeUTF8))
+ self.endofBpfPassBandLabel.setText(QtGui.QApplication.translate("MainWindow", "End of Pass Band (Hz)", None, QtGui.QApplication.UnicodeUTF8))
+ self.bpfStopBandAttenLabel.setText(QtGui.QApplication.translate("MainWindow", "Stop Band Attenuation (dB)", None, QtGui.QApplication.UnicodeUTF8))
+ self.bpfTransitionLabel.setText(QtGui.QApplication.translate("MainWindow", "Transition Width (Hz)", None, QtGui.QApplication.UnicodeUTF8))
+ self.bpfPassBandRippleLabel.setText(QtGui.QApplication.translate("MainWindow", "Pass Band Ripple (dB)", None, QtGui.QApplication.UnicodeUTF8))
+ self.startofBnfStopBandLabel.setText(QtGui.QApplication.translate("MainWindow", "Start of Stop Band (Hz)", None, QtGui.QApplication.UnicodeUTF8))
+ self.endofBnfStopBandLabel.setText(QtGui.QApplication.translate("MainWindow", "End of Stop Band (Hz)", None, QtGui.QApplication.UnicodeUTF8))
+ self.bnfTransitionLabel.setText(QtGui.QApplication.translate("MainWindow", "Transition Width (Hz)", None, QtGui.QApplication.UnicodeUTF8))
+ self.bnfStopBandAttenLabel.setText(QtGui.QApplication.translate("MainWindow", "Stop Band Attenuation (dB)", None, QtGui.QApplication.UnicodeUTF8))
+ self.bnfPassBandRippleLabel.setText(QtGui.QApplication.translate("MainWindow", "Pass Band Ripple (dB)", None, QtGui.QApplication.UnicodeUTF8))
+ self.endofHpfStopBandLabel.setText(QtGui.QApplication.translate("MainWindow", "End of Stop Band (Hz)", None, QtGui.QApplication.UnicodeUTF8))
+ self.startofHpfPassBandLabel.setText(QtGui.QApplication.translate("MainWindow", "Start of Pass Band (Hz)", None, QtGui.QApplication.UnicodeUTF8))
+ self.hpfStopBandAttenLabel.setText(QtGui.QApplication.translate("MainWindow", "Stop Band Attenuation (dB)", None, QtGui.QApplication.UnicodeUTF8))
+ self.hpfPassBandRippleLabel.setText(QtGui.QApplication.translate("MainWindow", "Pass Band Ripple (dB)", None, QtGui.QApplication.UnicodeUTF8))
+ self.rrcSymbolRateLabel.setText(QtGui.QApplication.translate("MainWindow", "Symbol Rate (sps)", None, QtGui.QApplication.UnicodeUTF8))
+ self.rrcAlphaLabel.setText(QtGui.QApplication.translate("MainWindow", "Roll-off Factor", None, QtGui.QApplication.UnicodeUTF8))
+ self.rrcNumTapsLabel.setText(QtGui.QApplication.translate("MainWindow", "Number of Taps", None, QtGui.QApplication.UnicodeUTF8))
+ self.gausSymbolRateLabel.setText(QtGui.QApplication.translate("MainWindow", "Symbol Rate (sps)", None, QtGui.QApplication.UnicodeUTF8))
+ self.gausBTLabel.setText(QtGui.QApplication.translate("MainWindow", "Roll-off Factor", None, QtGui.QApplication.UnicodeUTF8))
+ self.gausNumTapsLabel.setText(QtGui.QApplication.translate("MainWindow", "Number of Taps", None, QtGui.QApplication.UnicodeUTF8))
+ self.filterPropsBox.setTitle(QtGui.QApplication.translate("MainWindow", "Filter Properties", None, QtGui.QApplication.UnicodeUTF8))
+ self.nTapsLabel.setText(QtGui.QApplication.translate("MainWindow", "Number of Taps:", None, QtGui.QApplication.UnicodeUTF8))
+ self.sysParamsBox.setTitle(QtGui.QApplication.translate("MainWindow", "System Parameters", None, QtGui.QApplication.UnicodeUTF8))
+ self.nfftLabel.setText(QtGui.QApplication.translate("MainWindow", "Num FFT points", None, QtGui.QApplication.UnicodeUTF8))
+ self.designButton.setText(QtGui.QApplication.translate("MainWindow", "Design", None, QtGui.QApplication.UnicodeUTF8))
+ self.tabGroup.setTabText(self.tabGroup.indexOf(self.freqTab), QtGui.QApplication.translate("MainWindow", "Frequency Domain", None, QtGui.QApplication.UnicodeUTF8))
+ self.tabGroup.setTabText(self.tabGroup.indexOf(self.timeTab), QtGui.QApplication.translate("MainWindow", "Time Domain", None, QtGui.QApplication.UnicodeUTF8))
+ self.tabGroup.setTabText(self.tabGroup.indexOf(self.phaseTab), QtGui.QApplication.translate("MainWindow", "Phase", None, QtGui.QApplication.UnicodeUTF8))
+ self.tabGroup.setTabText(self.tabGroup.indexOf(self.groupTab), QtGui.QApplication.translate("MainWindow", "Group Delay", None, QtGui.QApplication.UnicodeUTF8))
+ self.menu_File.setTitle(QtGui.QApplication.translate("MainWindow", "&File", None, QtGui.QApplication.UnicodeUTF8))
+ self.action_exit.setText(QtGui.QApplication.translate("MainWindow", "E&xit", None, QtGui.QApplication.UnicodeUTF8))
+ self.action_save.setText(QtGui.QApplication.translate("MainWindow", "&Save", None, QtGui.QApplication.UnicodeUTF8))
+ self.action_save.setShortcut(QtGui.QApplication.translate("MainWindow", "Ctrl+S", None, QtGui.QApplication.UnicodeUTF8))
+ self.action_open.setText(QtGui.QApplication.translate("MainWindow", "&Open", None, QtGui.QApplication.UnicodeUTF8))
+ self.action_open.setShortcut(QtGui.QApplication.translate("MainWindow", "Ctrl+O", None, QtGui.QApplication.UnicodeUTF8))
+
+#from qwt_plot import QwtPlot
+from PyQt4.Qwt5 import QwtPlot
+
diff --git a/gr-utils/src/python/pyqt_filter.ui b/gr-utils/src/python/pyqt_filter.ui
new file mode 100644
index 000000000..9853352e2
--- /dev/null
+++ b/gr-utils/src/python/pyqt_filter.ui
@@ -0,0 +1,687 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>MainWindow</class>
+ <widget class="QMainWindow" name="MainWindow">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>1124</width>
+ <height>696</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>GNU Radio Filter Design Tool</string>
+ </property>
+ <widget class="QWidget" name="centralwidget">
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="1" column="0">
+ <widget class="QFrame" name="filterFrame">
+ <property name="minimumSize">
+ <size>
+ <width>300</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>300</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::StyledPanel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Raised</enum>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QComboBox" name="filterTypeComboBox">
+ <item>
+ <property name="text">
+ <string>Low Pass</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Band Pass</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Complex Band Pass</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Band Notch</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>High Pass</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Root Raised Cosine</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Gaussian</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="filterDesignTypeComboBox">
+ <item>
+ <property name="text">
+ <string>Hamming Window</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Hann Window</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Blackman Window</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Rectangular Window</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Kaiser Window</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Blackman-harris Window</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Equiripple</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ <item>
+ <layout class="QFormLayout" name="globalParamsLayout">
+ <property name="fieldGrowthPolicy">
+ <enum>QFormLayout::AllNonFixedFieldsGrow</enum>
+ </property>
+ <item row="0" column="0">
+ <widget class="QLabel" name="sampleRateLabel">
+ <property name="maximumSize">
+ <size>
+ <width>16777215</width>
+ <height>30</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Sample Rate (sps)</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QLineEdit" name="sampleRateEdit">
+ <property name="maximumSize">
+ <size>
+ <width>16777215</width>
+ <height>30</height>
+ </size>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="filterGainLabel">
+ <property name="text">
+ <string>Filter Gain</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QLineEdit" name="filterGainEdit"/>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="QStackedWidget" name="filterTypeWidget">
+ <property name="currentIndex">
+ <number>5</number>
+ </property>
+ <widget class="QWidget" name="firlpfPage">
+ <layout class="QFormLayout" name="formLayout">
+ <item row="0" column="0">
+ <widget class="QLabel" name="endofLpfPassBandLabel">
+ <property name="text">
+ <string>End of Pass Band (Hz)</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QLineEdit" name="endofLpfPassBandEdit"/>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="startofLpfStopBandLabel">
+ <property name="text">
+ <string>Start of Stop Band (Hz)</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QLineEdit" name="startofLpfStopBandEdit"/>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="lpfStopBandAttenLabel">
+ <property name="text">
+ <string>Stop Band Attenuation (dB)</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QLineEdit" name="lpfStopBandAttenEdit"/>
+ </item>
+ <item row="3" column="1">
+ <widget class="QLineEdit" name="lpfPassBandRippleEdit"/>
+ </item>
+ <item row="3" column="0">
+ <widget class="QLabel" name="lpfPassBandRippleLabel">
+ <property name="text">
+ <string>Pass Band Ripple (dB)</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="firbpfPage">
+ <layout class="QFormLayout" name="formLayout_2">
+ <item row="0" column="0">
+ <widget class="QLabel" name="startofBpfPassBandLabel">
+ <property name="text">
+ <string>Start of Pass Band (Hz)</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QLineEdit" name="startofBpfPassBandEdit"/>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="endofBpfPassBandLabel">
+ <property name="text">
+ <string>End of Pass Band (Hz)</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QLineEdit" name="endofBpfPassBandEdit"/>
+ </item>
+ <item row="3" column="1">
+ <widget class="QLineEdit" name="bpfStopBandAttenEdit"/>
+ </item>
+ <item row="3" column="0">
+ <widget class="QLabel" name="bpfStopBandAttenLabel">
+ <property name="text">
+ <string>Stop Band Attenuation (dB)</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="bpfTransitionLabel">
+ <property name="text">
+ <string>Transition Width (Hz)</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QLineEdit" name="bpfTransitionEdit"/>
+ </item>
+ <item row="4" column="1">
+ <widget class="QLineEdit" name="bpfPassBandRippleEdit"/>
+ </item>
+ <item row="4" column="0">
+ <widget class="QLabel" name="bpfPassBandRippleLabel">
+ <property name="text">
+ <string>Pass Band Ripple (dB)</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="firbnfPage">
+ <layout class="QFormLayout" name="formLayout_5">
+ <property name="fieldGrowthPolicy">
+ <enum>QFormLayout::AllNonFixedFieldsGrow</enum>
+ </property>
+ <item row="0" column="0">
+ <widget class="QLabel" name="startofBnfStopBandLabel">
+ <property name="text">
+ <string>Start of Stop Band (Hz)</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QLineEdit" name="startofBnfStopBandEdit"/>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="endofBnfStopBandLabel">
+ <property name="text">
+ <string>End of Stop Band (Hz)</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QLineEdit" name="endofBnfStopBandEdit"/>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="bnfTransitionLabel">
+ <property name="text">
+ <string>Transition Width (Hz)</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QLineEdit" name="bnfTransitionEdit"/>
+ </item>
+ <item row="3" column="0">
+ <widget class="QLabel" name="bnfStopBandAttenLabel">
+ <property name="text">
+ <string>Stop Band Attenuation (dB)</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="1">
+ <widget class="QLineEdit" name="bnfStopBandAttenEdit"/>
+ </item>
+ <item row="4" column="0">
+ <widget class="QLabel" name="bnfPassBandRippleLabel">
+ <property name="text">
+ <string>Pass Band Ripple (dB)</string>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="1">
+ <widget class="QLineEdit" name="bnfPassBandRippleEdit"/>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="firhpfPage">
+ <layout class="QFormLayout" name="formLayout_3">
+ <property name="fieldGrowthPolicy">
+ <enum>QFormLayout::AllNonFixedFieldsGrow</enum>
+ </property>
+ <item row="0" column="0">
+ <widget class="QLabel" name="endofHpfStopBandLabel">
+ <property name="text">
+ <string>End of Stop Band (Hz)</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QLineEdit" name="endofHpfStopBandEdit"/>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="startofHpfPassBandLabel">
+ <property name="text">
+ <string>Start of Pass Band (Hz)</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QLineEdit" name="startofHpfPassBandEdit"/>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="hpfStopBandAttenLabel">
+ <property name="text">
+ <string>Stop Band Attenuation (dB)</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QLineEdit" name="hpfStopBandAttenEdit"/>
+ </item>
+ <item row="3" column="0">
+ <widget class="QLabel" name="hpfPassBandRippleLabel">
+ <property name="text">
+ <string>Pass Band Ripple (dB)</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="1">
+ <widget class="QLineEdit" name="hpfPassBandRippleEdit"/>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="rrcPage">
+ <layout class="QFormLayout" name="formLayout_6">
+ <item row="0" column="0">
+ <widget class="QLabel" name="rrcSymbolRateLabel">
+ <property name="text">
+ <string>Symbol Rate (sps)</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="rrcAlphaLabel">
+ <property name="text">
+ <string>Roll-off Factor</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="rrcNumTapsLabel">
+ <property name="text">
+ <string>Number of Taps</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QLineEdit" name="rrcSymbolRateEdit"/>
+ </item>
+ <item row="1" column="1">
+ <widget class="QLineEdit" name="rrcAlphaEdit"/>
+ </item>
+ <item row="2" column="1">
+ <widget class="QLineEdit" name="rrcNumTapsEdit"/>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="gausPage">
+ <layout class="QFormLayout" name="formLayout_7">
+ <item row="0" column="0">
+ <widget class="QLabel" name="gausSymbolRateLabel">
+ <property name="text">
+ <string>Symbol Rate (sps)</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QLineEdit" name="gausSymbolRateEdit"/>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="gausBTLabel">
+ <property name="text">
+ <string>Roll-off Factor</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QLineEdit" name="gausBTEdit"/>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="gausNumTapsLabel">
+ <property name="text">
+ <string>Number of Taps</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QLineEdit" name="gausNumTapsEdit"/>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="filterPropsBox">
+ <property name="title">
+ <string>Filter Properties</string>
+ </property>
+ <layout class="QFormLayout" name="formLayout_8">
+ <property name="fieldGrowthPolicy">
+ <enum>QFormLayout::AllNonFixedFieldsGrow</enum>
+ </property>
+ <item row="1" column="0">
+ <widget class="QLabel" name="nTapsLabel">
+ <property name="minimumSize">
+ <size>
+ <width>150</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Number of Taps:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QLabel" name="nTapsEdit">
+ <property name="maximumSize">
+ <size>
+ <width>100</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::Box</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Raised</enum>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="sysParamsBox">
+ <property name="title">
+ <string>System Parameters</string>
+ </property>
+ <layout class="QFormLayout" name="formLayout_4">
+ <item row="1" column="1">
+ <widget class="QLineEdit" name="nfftEdit"/>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="nfftLabel">
+ <property name="minimumSize">
+ <size>
+ <width>150</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Num FFT points</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="designButton">
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>200</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Design</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QTabWidget" name="tabGroup">
+ <property name="minimumSize">
+ <size>
+ <width>800</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="currentIndex">
+ <number>0</number>
+ </property>
+ <widget class="QWidget" name="freqTab">
+ <attribute name="title">
+ <string>Frequency Domain</string>
+ </attribute>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <widget class="QwtPlot" name="freqPlot"/>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="timeTab">
+ <attribute name="title">
+ <string>Time Domain</string>
+ </attribute>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QwtPlot" name="timePlot"/>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="phaseTab">
+ <attribute name="title">
+ <string>Phase</string>
+ </attribute>
+ <layout class="QHBoxLayout" name="horizontalLayout_3">
+ <item>
+ <widget class="QwtPlot" name="phasePlot"/>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="groupTab">
+ <attribute name="title">
+ <string>Group Delay</string>
+ </attribute>
+ <layout class="QHBoxLayout" name="horizontalLayout_4">
+ <item>
+ <widget class="QwtPlot" name="groupPlot"/>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QMenuBar" name="menubar">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>1124</width>
+ <height>27</height>
+ </rect>
+ </property>
+ <widget class="QMenu" name="menu_File">
+ <property name="title">
+ <string>&amp;File</string>
+ </property>
+ <addaction name="action_open"/>
+ <addaction name="action_save"/>
+ <addaction name="action_exit"/>
+ </widget>
+ <addaction name="menu_File"/>
+ </widget>
+ <widget class="QStatusBar" name="statusbar"/>
+ <action name="action_exit">
+ <property name="text">
+ <string>E&amp;xit</string>
+ </property>
+ </action>
+ <action name="action_save">
+ <property name="text">
+ <string>&amp;Save</string>
+ </property>
+ <property name="shortcut">
+ <string>Ctrl+S</string>
+ </property>
+ </action>
+ <action name="action_open">
+ <property name="text">
+ <string>&amp;Open</string>
+ </property>
+ <property name="shortcut">
+ <string>Ctrl+O</string>
+ </property>
+ </action>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>QwtPlot</class>
+ <extends>QFrame</extends>
+ <header>qwt_plot.h</header>
+ </customwidget>
+ </customwidgets>
+ <tabstops>
+ <tabstop>filterTypeComboBox</tabstop>
+ <tabstop>filterDesignTypeComboBox</tabstop>
+ <tabstop>sampleRateEdit</tabstop>
+ <tabstop>filterGainEdit</tabstop>
+ <tabstop>endofLpfPassBandEdit</tabstop>
+ <tabstop>startofLpfStopBandEdit</tabstop>
+ <tabstop>lpfStopBandAttenEdit</tabstop>
+ <tabstop>lpfPassBandRippleEdit</tabstop>
+ <tabstop>startofBpfPassBandEdit</tabstop>
+ <tabstop>endofBpfPassBandEdit</tabstop>
+ <tabstop>bpfTransitionEdit</tabstop>
+ <tabstop>bpfStopBandAttenEdit</tabstop>
+ <tabstop>bpfPassBandRippleEdit</tabstop>
+ <tabstop>startofBnfStopBandEdit</tabstop>
+ <tabstop>endofBnfStopBandEdit</tabstop>
+ <tabstop>bnfTransitionEdit</tabstop>
+ <tabstop>bnfStopBandAttenEdit</tabstop>
+ <tabstop>bnfPassBandRippleEdit</tabstop>
+ <tabstop>endofHpfStopBandEdit</tabstop>
+ <tabstop>startofHpfPassBandEdit</tabstop>
+ <tabstop>hpfStopBandAttenEdit</tabstop>
+ <tabstop>hpfPassBandRippleEdit</tabstop>
+ <tabstop>rrcSymbolRateEdit</tabstop>
+ <tabstop>rrcAlphaEdit</tabstop>
+ <tabstop>rrcNumTapsEdit</tabstop>
+ <tabstop>gausSymbolRateEdit</tabstop>
+ <tabstop>gausBTEdit</tabstop>
+ <tabstop>gausNumTapsEdit</tabstop>
+ <tabstop>nfftEdit</tabstop>
+ <tabstop>designButton</tabstop>
+ <tabstop>tabGroup</tabstop>
+ </tabstops>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>action_exit</sender>
+ <signal>activated()</signal>
+ <receiver>MainWindow</receiver>
+ <slot>close()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>-1</x>
+ <y>-1</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>399</x>
+ <y>347</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>
diff --git a/gr-utils/src/python/pyqt_plot.py b/gr-utils/src/python/pyqt_plot.py
new file mode 100644
index 000000000..5650135ab
--- /dev/null
+++ b/gr-utils/src/python/pyqt_plot.py
@@ -0,0 +1,211 @@
+# -*- coding: utf-8 -*-
+
+# Form implementation generated from reading ui file 'pyqt_plot.ui'
+#
+# Created: Tue Oct 6 10:39:58 2009
+# by: PyQt4 UI code generator 4.4.4
+#
+# WARNING! All changes made in this file will be lost!
+
+from PyQt4 import QtCore, QtGui
+
+class Ui_MainWindow(object):
+ def setupUi(self, MainWindow):
+ MainWindow.setObjectName("MainWindow")
+ MainWindow.resize(927, 696)
+ self.centralwidget = QtGui.QWidget(MainWindow)
+ self.centralwidget.setObjectName("centralwidget")
+ self.gridLayout = QtGui.QGridLayout(self.centralwidget)
+ self.gridLayout.setObjectName("gridLayout")
+ self.plotHBar = QtGui.QScrollBar(self.centralwidget)
+ self.plotHBar.setOrientation(QtCore.Qt.Horizontal)
+ self.plotHBar.setObjectName("plotHBar")
+ self.gridLayout.addWidget(self.plotHBar, 2, 0, 1, 2)
+ self.tabGroup = QtGui.QTabWidget(self.centralwidget)
+ self.tabGroup.setObjectName("tabGroup")
+ self.timeTab = QtGui.QWidget()
+ self.timeTab.setObjectName("timeTab")
+ self.horizontalLayout = QtGui.QHBoxLayout(self.timeTab)
+ self.horizontalLayout.setObjectName("horizontalLayout")
+ self.timePlot = Qwt5.QwtPlot(self.timeTab)
+ self.timePlot.setObjectName("timePlot")
+ self.horizontalLayout.addWidget(self.timePlot)
+ self.tabGroup.addTab(self.timeTab, "")
+ self.freqTab = QtGui.QWidget()
+ self.freqTab.setObjectName("freqTab")
+ self.horizontalLayout_2 = QtGui.QHBoxLayout(self.freqTab)
+ self.horizontalLayout_2.setObjectName("horizontalLayout_2")
+ self.fftPropBox = QtGui.QGroupBox(self.freqTab)
+ self.fftPropBox.setMinimumSize(QtCore.QSize(160, 0))
+ self.fftPropBox.setObjectName("fftPropBox")
+ self.formLayout_4 = QtGui.QFormLayout(self.fftPropBox)
+ self.formLayout_4.setFieldGrowthPolicy(QtGui.QFormLayout.AllNonFixedFieldsGrow)
+ self.formLayout_4.setObjectName("formLayout_4")
+ self.psdFFTComboBox = QtGui.QComboBox(self.fftPropBox)
+ self.psdFFTComboBox.setMinimumSize(QtCore.QSize(96, 0))
+ self.psdFFTComboBox.setMaximumSize(QtCore.QSize(96, 16777215))
+ self.psdFFTComboBox.setObjectName("psdFFTComboBox")
+ self.formLayout_4.setWidget(0, QtGui.QFormLayout.FieldRole, self.psdFFTComboBox)
+ self.psdFFTSizeLabel = QtGui.QLabel(self.fftPropBox)
+ self.psdFFTSizeLabel.setObjectName("psdFFTSizeLabel")
+ self.formLayout_4.setWidget(0, QtGui.QFormLayout.LabelRole, self.psdFFTSizeLabel)
+ self.horizontalLayout_2.addWidget(self.fftPropBox)
+ self.freqPlot = Qwt5.QwtPlot(self.freqTab)
+ self.freqPlot.setObjectName("freqPlot")
+ self.horizontalLayout_2.addWidget(self.freqPlot)
+ self.tabGroup.addTab(self.freqTab, "")
+ self.specTab = QtGui.QWidget()
+ self.specTab.setObjectName("specTab")
+ self.horizontalLayout_3 = QtGui.QHBoxLayout(self.specTab)
+ self.horizontalLayout_3.setObjectName("horizontalLayout_3")
+ self.groupBox = QtGui.QGroupBox(self.specTab)
+ self.groupBox.setObjectName("groupBox")
+ self.formLayout_3 = QtGui.QFormLayout(self.groupBox)
+ self.formLayout_3.setObjectName("formLayout_3")
+ self.specFFTLabel = QtGui.QLabel(self.groupBox)
+ self.specFFTLabel.setObjectName("specFFTLabel")
+ self.formLayout_3.setWidget(1, QtGui.QFormLayout.LabelRole, self.specFFTLabel)
+ self.specFFTComboBox = QtGui.QComboBox(self.groupBox)
+ self.specFFTComboBox.setMinimumSize(QtCore.QSize(96, 0))
+ self.specFFTComboBox.setMaximumSize(QtCore.QSize(96, 16777215))
+ self.specFFTComboBox.setObjectName("specFFTComboBox")
+ self.formLayout_3.setWidget(1, QtGui.QFormLayout.FieldRole, self.specFFTComboBox)
+ self.horizontalLayout_3.addWidget(self.groupBox)
+ self.specPlot = Qwt5.QwtPlot(self.specTab)
+ self.specPlot.setObjectName("specPlot")
+ self.horizontalLayout_3.addWidget(self.specPlot)
+ self.tabGroup.addTab(self.specTab, "")
+ self.gridLayout.addWidget(self.tabGroup, 1, 0, 1, 1)
+ self.filePosBox = QtGui.QGroupBox(self.centralwidget)
+ self.filePosBox.setMinimumSize(QtCore.QSize(0, 120))
+ self.filePosBox.setObjectName("filePosBox")
+ self.formLayoutWidget_2 = QtGui.QWidget(self.filePosBox)
+ self.formLayoutWidget_2.setGeometry(QtCore.QRect(0, 20, 160, 92))
+ self.formLayoutWidget_2.setObjectName("formLayoutWidget_2")
+ self.filePosLayout = QtGui.QFormLayout(self.formLayoutWidget_2)
+ self.filePosLayout.setObjectName("filePosLayout")
+ self.filePosStartLabel = QtGui.QLabel(self.formLayoutWidget_2)
+ self.filePosStartLabel.setObjectName("filePosStartLabel")
+ self.filePosLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.filePosStartLabel)
+ self.filePosStartLineEdit = QtGui.QLineEdit(self.formLayoutWidget_2)
+ self.filePosStartLineEdit.setObjectName("filePosStartLineEdit")
+ self.filePosLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.filePosStartLineEdit)
+ self.filePosStopLabel = QtGui.QLabel(self.formLayoutWidget_2)
+ self.filePosStopLabel.setObjectName("filePosStopLabel")
+ self.filePosLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.filePosStopLabel)
+ self.filePosStopLineEdit = QtGui.QLineEdit(self.formLayoutWidget_2)
+ self.filePosStopLineEdit.setObjectName("filePosStopLineEdit")
+ self.filePosLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.filePosStopLineEdit)
+ self.filePosLengthLabel = QtGui.QLabel(self.formLayoutWidget_2)
+ self.filePosLengthLabel.setObjectName("filePosLengthLabel")
+ self.filePosLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.filePosLengthLabel)
+ self.filePosLengthLineEdit = QtGui.QLineEdit(self.formLayoutWidget_2)
+ self.filePosLengthLineEdit.setObjectName("filePosLengthLineEdit")
+ self.filePosLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.filePosLengthLineEdit)
+ self.formLayoutWidget_4 = QtGui.QWidget(self.filePosBox)
+ self.formLayoutWidget_4.setGeometry(QtCore.QRect(180, 20, 231, 92))
+ self.formLayoutWidget_4.setObjectName("formLayoutWidget_4")
+ self.fileTimeLayout = QtGui.QFormLayout(self.formLayoutWidget_4)
+ self.fileTimeLayout.setObjectName("fileTimeLayout")
+ self.fileTimeStartLabel = QtGui.QLabel(self.formLayoutWidget_4)
+ self.fileTimeStartLabel.setObjectName("fileTimeStartLabel")
+ self.fileTimeLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.fileTimeStartLabel)
+ self.fileTimeStartLineEdit = QtGui.QLineEdit(self.formLayoutWidget_4)
+ self.fileTimeStartLineEdit.setObjectName("fileTimeStartLineEdit")
+ self.fileTimeLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.fileTimeStartLineEdit)
+ self.fileTimeStopLabel = QtGui.QLabel(self.formLayoutWidget_4)
+ self.fileTimeStopLabel.setObjectName("fileTimeStopLabel")
+ self.fileTimeLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.fileTimeStopLabel)
+ self.fileTimeStopLineEdit = QtGui.QLineEdit(self.formLayoutWidget_4)
+ self.fileTimeStopLineEdit.setObjectName("fileTimeStopLineEdit")
+ self.fileTimeLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.fileTimeStopLineEdit)
+ self.fileTimeLengthLabel = QtGui.QLabel(self.formLayoutWidget_4)
+ self.fileTimeLengthLabel.setObjectName("fileTimeLengthLabel")
+ self.fileTimeLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.fileTimeLengthLabel)
+ self.fileTimeLengthLineEdit = QtGui.QLineEdit(self.formLayoutWidget_4)
+ self.fileTimeLengthLineEdit.setObjectName("fileTimeLengthLineEdit")
+ self.fileTimeLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.fileTimeLengthLineEdit)
+ self.sysGroupBox = QtGui.QGroupBox(self.filePosBox)
+ self.sysGroupBox.setGeometry(QtCore.QRect(530, 0, 200, 120))
+ self.sysGroupBox.setMinimumSize(QtCore.QSize(200, 0))
+ self.sysGroupBox.setObjectName("sysGroupBox")
+ self.formLayoutWidget_3 = QtGui.QWidget(self.sysGroupBox)
+ self.formLayoutWidget_3.setGeometry(QtCore.QRect(0, 20, 191, 91))
+ self.formLayoutWidget_3.setObjectName("formLayoutWidget_3")
+ self.formLayout_2 = QtGui.QFormLayout(self.formLayoutWidget_3)
+ self.formLayout_2.setObjectName("formLayout_2")
+ self.sampleRateLabel = QtGui.QLabel(self.formLayoutWidget_3)
+ self.sampleRateLabel.setObjectName("sampleRateLabel")
+ self.formLayout_2.setWidget(0, QtGui.QFormLayout.LabelRole, self.sampleRateLabel)
+ self.sampleRateLineEdit = QtGui.QLineEdit(self.formLayoutWidget_3)
+ self.sampleRateLineEdit.setMinimumSize(QtCore.QSize(0, 0))
+ self.sampleRateLineEdit.setObjectName("sampleRateLineEdit")
+ self.formLayout_2.setWidget(0, QtGui.QFormLayout.FieldRole, self.sampleRateLineEdit)
+ self.displayGroupBox = QtGui.QGroupBox(self.filePosBox)
+ self.displayGroupBox.setGeometry(QtCore.QRect(730, 0, 170, 120))
+ self.displayGroupBox.setMinimumSize(QtCore.QSize(170, 0))
+ self.displayGroupBox.setObjectName("displayGroupBox")
+ self.verticalLayoutWidget = QtGui.QWidget(self.displayGroupBox)
+ self.verticalLayoutWidget.setGeometry(QtCore.QRect(0, 20, 160, 91))
+ self.verticalLayoutWidget.setObjectName("verticalLayoutWidget")
+ self.verticalLayout = QtGui.QVBoxLayout(self.verticalLayoutWidget)
+ self.verticalLayout.setObjectName("verticalLayout")
+ self.colorComboBox = QtGui.QComboBox(self.verticalLayoutWidget)
+ self.colorComboBox.setObjectName("colorComboBox")
+ self.verticalLayout.addWidget(self.colorComboBox)
+ spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
+ self.verticalLayout.addItem(spacerItem)
+ self.gridLayout.addWidget(self.filePosBox, 3, 0, 1, 1)
+ MainWindow.setCentralWidget(self.centralwidget)
+ self.menubar = QtGui.QMenuBar(MainWindow)
+ self.menubar.setGeometry(QtCore.QRect(0, 0, 927, 25))
+ self.menubar.setObjectName("menubar")
+ self.menu_File = QtGui.QMenu(self.menubar)
+ self.menu_File.setObjectName("menu_File")
+ MainWindow.setMenuBar(self.menubar)
+ self.statusbar = QtGui.QStatusBar(MainWindow)
+ self.statusbar.setObjectName("statusbar")
+ MainWindow.setStatusBar(self.statusbar)
+ self.action_open = QtGui.QAction(MainWindow)
+ self.action_open.setObjectName("action_open")
+ self.action_exit = QtGui.QAction(MainWindow)
+ self.action_exit.setObjectName("action_exit")
+ self.action_reload = QtGui.QAction(MainWindow)
+ self.action_reload.setObjectName("action_reload")
+ self.menu_File.addAction(self.action_open)
+ self.menu_File.addAction(self.action_reload)
+ self.menu_File.addAction(self.action_exit)
+ self.menubar.addAction(self.menu_File.menuAction())
+
+ self.retranslateUi(MainWindow)
+ self.tabGroup.setCurrentIndex(0)
+ QtCore.QObject.connect(self.action_exit, QtCore.SIGNAL("activated()"), MainWindow.close)
+ QtCore.QMetaObject.connectSlotsByName(MainWindow)
+
+ def retranslateUi(self, MainWindow):
+ MainWindow.setWindowTitle(QtGui.QApplication.translate("MainWindow", "MainWindow", None, QtGui.QApplication.UnicodeUTF8))
+ self.tabGroup.setTabText(self.tabGroup.indexOf(self.timeTab), QtGui.QApplication.translate("MainWindow", "Time Domain", None, QtGui.QApplication.UnicodeUTF8))
+ self.fftPropBox.setTitle(QtGui.QApplication.translate("MainWindow", "FFT Properties", None, QtGui.QApplication.UnicodeUTF8))
+ self.psdFFTSizeLabel.setText(QtGui.QApplication.translate("MainWindow", "FFT Size", None, QtGui.QApplication.UnicodeUTF8))
+ self.tabGroup.setTabText(self.tabGroup.indexOf(self.freqTab), QtGui.QApplication.translate("MainWindow", "Frequency Domain", None, QtGui.QApplication.UnicodeUTF8))
+ self.groupBox.setTitle(QtGui.QApplication.translate("MainWindow", "Spectrogram Properties", None, QtGui.QApplication.UnicodeUTF8))
+ self.specFFTLabel.setText(QtGui.QApplication.translate("MainWindow", "FFT Size", None, QtGui.QApplication.UnicodeUTF8))
+ self.tabGroup.setTabText(self.tabGroup.indexOf(self.specTab), QtGui.QApplication.translate("MainWindow", "Spectrogram", None, QtGui.QApplication.UnicodeUTF8))
+ self.filePosBox.setTitle(QtGui.QApplication.translate("MainWindow", "File Position", None, QtGui.QApplication.UnicodeUTF8))
+ self.filePosStartLabel.setText(QtGui.QApplication.translate("MainWindow", "Start", None, QtGui.QApplication.UnicodeUTF8))
+ self.filePosStopLabel.setText(QtGui.QApplication.translate("MainWindow", "Stop", None, QtGui.QApplication.UnicodeUTF8))
+ self.filePosLengthLabel.setText(QtGui.QApplication.translate("MainWindow", "Length", None, QtGui.QApplication.UnicodeUTF8))
+ self.fileTimeStartLabel.setText(QtGui.QApplication.translate("MainWindow", "time start (sec)", None, QtGui.QApplication.UnicodeUTF8))
+ self.fileTimeStopLabel.setText(QtGui.QApplication.translate("MainWindow", "time stop (sec)", None, QtGui.QApplication.UnicodeUTF8))
+ self.fileTimeLengthLabel.setText(QtGui.QApplication.translate("MainWindow", "time length (sec)", None, QtGui.QApplication.UnicodeUTF8))
+ self.sysGroupBox.setTitle(QtGui.QApplication.translate("MainWindow", "System Properties", None, QtGui.QApplication.UnicodeUTF8))
+ self.sampleRateLabel.setText(QtGui.QApplication.translate("MainWindow", "Sample Rate", None, QtGui.QApplication.UnicodeUTF8))
+ self.displayGroupBox.setTitle(QtGui.QApplication.translate("MainWindow", "Display Properties", None, QtGui.QApplication.UnicodeUTF8))
+ self.menu_File.setTitle(QtGui.QApplication.translate("MainWindow", "&File", None, QtGui.QApplication.UnicodeUTF8))
+ self.action_open.setText(QtGui.QApplication.translate("MainWindow", "&Open", None, QtGui.QApplication.UnicodeUTF8))
+ self.action_open.setShortcut(QtGui.QApplication.translate("MainWindow", "Ctrl+O", None, QtGui.QApplication.UnicodeUTF8))
+ self.action_exit.setText(QtGui.QApplication.translate("MainWindow", "E&xit", None, QtGui.QApplication.UnicodeUTF8))
+ self.action_reload.setText(QtGui.QApplication.translate("MainWindow", "&Reload", None, QtGui.QApplication.UnicodeUTF8))
+ self.action_reload.setShortcut(QtGui.QApplication.translate("MainWindow", "Ctrl+R", None, QtGui.QApplication.UnicodeUTF8))
+
+from PyQt4 import Qwt5
diff --git a/gr-utils/src/python/pyqt_plot.ui b/gr-utils/src/python/pyqt_plot.ui
new file mode 100644
index 000000000..55c72fda2
--- /dev/null
+++ b/gr-utils/src/python/pyqt_plot.ui
@@ -0,0 +1,399 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>MainWindow</class>
+ <widget class="QMainWindow" name="MainWindow">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>927</width>
+ <height>696</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>MainWindow</string>
+ </property>
+ <widget class="QWidget" name="centralwidget">
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="2" column="0" colspan="2">
+ <widget class="QScrollBar" name="plotHBar">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QTabWidget" name="tabGroup">
+ <property name="currentIndex">
+ <number>0</number>
+ </property>
+ <widget class="QWidget" name="timeTab">
+ <attribute name="title">
+ <string>Time Domain</string>
+ </attribute>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QwtPlot" name="timePlot"/>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="freqTab">
+ <attribute name="title">
+ <string>Frequency Domain</string>
+ </attribute>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <widget class="QGroupBox" name="fftPropBox">
+ <property name="minimumSize">
+ <size>
+ <width>160</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="title">
+ <string>FFT Properties</string>
+ </property>
+ <layout class="QFormLayout" name="formLayout_4">
+ <property name="fieldGrowthPolicy">
+ <enum>QFormLayout::AllNonFixedFieldsGrow</enum>
+ </property>
+ <item row="0" column="1">
+ <widget class="QComboBox" name="psdFFTComboBox">
+ <property name="minimumSize">
+ <size>
+ <width>96</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>96</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="0">
+ <widget class="QLabel" name="psdFFTSizeLabel">
+ <property name="text">
+ <string>FFT Size</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QwtPlot" name="freqPlot"/>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="specTab">
+ <attribute name="title">
+ <string>Spectrogram</string>
+ </attribute>
+ <layout class="QHBoxLayout" name="horizontalLayout_3">
+ <item>
+ <widget class="QGroupBox" name="groupBox">
+ <property name="title">
+ <string>Spectrogram Properties</string>
+ </property>
+ <layout class="QFormLayout" name="formLayout_3">
+ <item row="1" column="0">
+ <widget class="QLabel" name="specFFTLabel">
+ <property name="text">
+ <string>FFT Size</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QComboBox" name="specFFTComboBox">
+ <property name="minimumSize">
+ <size>
+ <width>96</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>96</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QwtPlot" name="specPlot"/>
+ </item>
+ </layout>
+ <zorder>specPlot</zorder>
+ <zorder>groupBox</zorder>
+ </widget>
+ </widget>
+ </item>
+ <item row="3" column="0">
+ <widget class="QGroupBox" name="filePosBox">
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>120</height>
+ </size>
+ </property>
+ <property name="title">
+ <string>File Position</string>
+ </property>
+ <widget class="QWidget" name="formLayoutWidget_2">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>20</y>
+ <width>160</width>
+ <height>92</height>
+ </rect>
+ </property>
+ <layout class="QFormLayout" name="filePosLayout">
+ <item row="0" column="0">
+ <widget class="QLabel" name="filePosStartLabel">
+ <property name="text">
+ <string>Start</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QLineEdit" name="filePosStartLineEdit"/>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="filePosStopLabel">
+ <property name="text">
+ <string>Stop</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QLineEdit" name="filePosStopLineEdit"/>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="filePosLengthLabel">
+ <property name="text">
+ <string>Length</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QLineEdit" name="filePosLengthLineEdit"/>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="formLayoutWidget_4">
+ <property name="geometry">
+ <rect>
+ <x>180</x>
+ <y>20</y>
+ <width>231</width>
+ <height>92</height>
+ </rect>
+ </property>
+ <layout class="QFormLayout" name="fileTimeLayout">
+ <item row="0" column="0">
+ <widget class="QLabel" name="fileTimeStartLabel">
+ <property name="text">
+ <string>time start (sec)</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QLineEdit" name="fileTimeStartLineEdit"/>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="fileTimeStopLabel">
+ <property name="text">
+ <string>time stop (sec)</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QLineEdit" name="fileTimeStopLineEdit"/>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="fileTimeLengthLabel">
+ <property name="text">
+ <string>time length (sec)</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QLineEdit" name="fileTimeLengthLineEdit"/>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QGroupBox" name="sysGroupBox">
+ <property name="geometry">
+ <rect>
+ <x>530</x>
+ <y>0</y>
+ <width>200</width>
+ <height>120</height>
+ </rect>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>200</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="title">
+ <string>System Properties</string>
+ </property>
+ <widget class="QWidget" name="formLayoutWidget_3">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>20</y>
+ <width>191</width>
+ <height>91</height>
+ </rect>
+ </property>
+ <layout class="QFormLayout" name="formLayout_2">
+ <item row="0" column="0">
+ <widget class="QLabel" name="sampleRateLabel">
+ <property name="text">
+ <string>Sample Rate</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QLineEdit" name="sampleRateLineEdit">
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>0</height>
+ </size>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ <widget class="QGroupBox" name="displayGroupBox">
+ <property name="geometry">
+ <rect>
+ <x>730</x>
+ <y>0</y>
+ <width>170</width>
+ <height>120</height>
+ </rect>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>170</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="title">
+ <string>Display Properties</string>
+ </property>
+ <widget class="QWidget" name="verticalLayoutWidget">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>20</y>
+ <width>160</width>
+ <height>91</height>
+ </rect>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QComboBox" name="colorComboBox"/>
+ </item>
+ <item>
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QMenuBar" name="menubar">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>927</width>
+ <height>25</height>
+ </rect>
+ </property>
+ <widget class="QMenu" name="menu_File">
+ <property name="title">
+ <string>&amp;File</string>
+ </property>
+ <addaction name="action_open"/>
+ <addaction name="action_reload"/>
+ <addaction name="action_exit"/>
+ </widget>
+ <addaction name="menu_File"/>
+ </widget>
+ <widget class="QStatusBar" name="statusbar"/>
+ <action name="action_open">
+ <property name="text">
+ <string>&amp;Open</string>
+ </property>
+ <property name="shortcut">
+ <string>Ctrl+O</string>
+ </property>
+ </action>
+ <action name="action_exit">
+ <property name="text">
+ <string>E&amp;xit</string>
+ </property>
+ </action>
+ <action name="action_reload">
+ <property name="text">
+ <string>&amp;Reload</string>
+ </property>
+ <property name="shortcut">
+ <string>Ctrl+R</string>
+ </property>
+ </action>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>QwtPlot</class>
+ <extends>QFrame</extends>
+ <header>qwt_plot.h</header>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>action_exit</sender>
+ <signal>activated()</signal>
+ <receiver>MainWindow</receiver>
+ <slot>close()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>-1</x>
+ <y>-1</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>399</x>
+ <y>347</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>
diff --git a/gr-wxgui/CMakeLists.txt b/gr-wxgui/CMakeLists.txt
new file mode 100644
index 000000000..8150c7d80
--- /dev/null
+++ b/gr-wxgui/CMakeLists.txt
@@ -0,0 +1,89 @@
+# Copyright 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.
+
+########################################################################
+# Setup dependencies
+########################################################################
+include(GrPython)
+
+GR_PYTHON_CHECK_MODULE("wx >= 2.8" wx "wx.version().split()[0] >= '2.8'" WX_FOUND)
+GR_PYTHON_CHECK_MODULE("numpy" numpy True NUMPY_FOUND)
+
+########################################################################
+# Register component
+########################################################################
+include(GrComponent)
+if(NOT CMAKE_CROSSCOMPILING)
+ set(wxgui_python_deps
+ NUMPY_FOUND
+ WX_FOUND
+ )
+endif(NOT CMAKE_CROSSCOMPILING)
+
+GR_REGISTER_COMPONENT("gr-wxgui" ENABLE_GR_WXGUI
+ ENABLE_GR_CORE
+ ENABLE_PYTHON
+ ${wxgui_python_deps}
+)
+
+########################################################################
+# Begin conditional configuration
+########################################################################
+if(ENABLE_GR_WXGUI)
+
+########################################################################
+# Setup CPack components
+########################################################################
+include(GrPackage)
+CPACK_COMPONENT("wxgui"
+ DISPLAY_NAME "WxGUI"
+ DESCRIPTION "Wx GUI plotter widgets and grc wrappers"
+ DEPENDS "core_python"
+)
+
+########################################################################
+# Create Pkg Config File
+########################################################################
+configure_file(
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr-wxgui.pc.in
+ ${CMAKE_CURRENT_BINARY_DIR}/gr-wxgui.pc
+@ONLY)
+
+install(
+ FILES ${CMAKE_CURRENT_BINARY_DIR}/gr-wxgui.pc
+ DESTINATION ${GR_LIBRARY_DIR}/pkgconfig
+ COMPONENT "wxgui"
+)
+
+########################################################################
+# Install the conf file
+########################################################################
+install(
+ FILES ${CMAKE_CURRENT_SOURCE_DIR}/gr-wxgui.conf
+ DESTINATION ${GR_PREFSDIR}
+ COMPONENT "wxgui"
+)
+
+########################################################################
+# Add subdirectories
+########################################################################
+add_subdirectory(grc)
+add_subdirectory(src/python)
+
+endif(ENABLE_GR_WXGUI)
diff --git a/gr-wxgui/README b/gr-wxgui/README
new file mode 100644
index 000000000..ebd0d2397
--- /dev/null
+++ b/gr-wxgui/README
@@ -0,0 +1 @@
+This requires wxPython 2.5.2.7 or later. See http://www.wxpython.org
diff --git a/gr-wxgui/README.gl b/gr-wxgui/README.gl
new file mode 100644
index 000000000..1d3eec60b
--- /dev/null
+++ b/gr-wxgui/README.gl
@@ -0,0 +1,29 @@
+To use the OpenGL versions of the graphical display sinks, you must ensure
+that you have Python wrappers for OpenGL installed and are using a version
+of wxPython that supports it. Then you must enable this mode by creating or
+editing an entry in the GNU Radio preferences file at:
+
+~/.gnuradio/config.conf
+
+[wxgui]
+style=gl
+fft_rate=30
+waterfall_rate=30
+scope_rate=30
+number_rate=5
+const_rate=5
+const_size=2048
+
+>>>The style parameter accepts 'nongl', 'gl', and 'auto', and defaults to 'auto'.
+
+'nongl' forces the use of the non-GL (current) sinks.
+
+'gl' forces the use of the new GL based sinks, and will raise an exception if the
+appropriate GL support does not exist.
+
+'auto' currently equates to 'nongl'; however, in release 3.2, this will change to
+use GL if possible and if not, fallback to the non-GL versions.
+
+>>>The *_rate parameter sets the frame rate for various gl sinks.
+
+>>>The const_size parameter sets the number of constellation points per frame.
diff --git a/gr-wxgui/gr-wxgui.conf b/gr-wxgui/gr-wxgui.conf
new file mode 100644
index 000000000..da458238f
--- /dev/null
+++ b/gr-wxgui/gr-wxgui.conf
@@ -0,0 +1,13 @@
+# This file contains system wide configuration data for GNU Radio.
+# You may override any setting on a per-user basis by editing
+# ~/.gnuradio/config.conf
+
+[wxgui]
+# 'gl', 'nongl', or 'auto'
+style = auto
+
+# fftsink and waterfallsink
+fft_rate = 15
+
+# scopesink
+frame_decim = 1
diff --git a/gr-wxgui/gr-wxgui.pc.in b/gr-wxgui/gr-wxgui.pc.in
new file mode 100644
index 000000000..f71389789
--- /dev/null
+++ b/gr-wxgui/gr-wxgui.pc.in
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: gr-wxgui
+Description: A simple wx gui for GNU Radio applications
+Requires: gnuradio-core
+Version: @LIBVER@
+Libs:
+Cflags:
diff --git a/gr-wxgui/grc/CMakeLists.txt b/gr-wxgui/grc/CMakeLists.txt
new file mode 100644
index 000000000..51c5647e5
--- /dev/null
+++ b/gr-wxgui/grc/CMakeLists.txt
@@ -0,0 +1,36 @@
+# Copyright 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.
+
+########################################################################
+file(GLOB xml_files "*.xml")
+install(FILES ${xml_files} DESTINATION ${GRC_BLOCKS_DIR} COMPONENT "wxgui")
+
+########################################################################
+#The wxgui module contains a top_block + wxgui frame.
+########################################################################
+include(GrPython)
+
+GR_PYTHON_INSTALL(
+ FILES
+ __init__.py
+ panel.py
+ top_block_gui.py
+ DESTINATION ${GR_PYTHON_DIR}/grc_gnuradio/wxgui
+ COMPONENT "wxgui"
+)
diff --git a/gr-wxgui/grc/__init__.py b/gr-wxgui/grc/__init__.py
new file mode 100644
index 000000000..81427253b
--- /dev/null
+++ b/gr-wxgui/grc/__init__.py
@@ -0,0 +1,22 @@
+# Copyright 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 top_block_gui import top_block_gui
+from panel import Panel
diff --git a/gr-wxgui/grc/notebook.xml b/gr-wxgui/grc/notebook.xml
new file mode 100644
index 000000000..bb3de51cb
--- /dev/null
+++ b/gr-wxgui/grc/notebook.xml
@@ -0,0 +1,70 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##WX GUI Notebook
+###################################################
+ -->
+<block>
+ <name>WX GUI Notebook</name>
+ <key>notebook</key>
+ <category>WX GUI Widgets</category>
+ <import>from grc_gnuradio import wxgui as grc_wxgui</import>
+ <make>#set $parent = $notebook() and 'self.%s.GetPage(%s)'%$notebook() or 'self'
+self.$(id) = wx.Notebook($(parent).GetWin(), style=$style)
+#for $label in $labels()
+self.$(id).AddPage(grc_wxgui.Panel(self.$(id)), "$label")
+#end for
+#if not $grid_pos()
+$(parent).Add(self.$(id))
+#else
+$(parent).GridAdd(self.$(id), $(', '.join(map(str, $grid_pos()))))
+#end if</make>
+ <param>
+ <name>Tab Orientation</name>
+ <key>style</key>
+ <value>wx.NB_TOP</value>
+ <type>enum</type>
+ <option>
+ <name>Top</name>
+ <key>wx.NB_TOP</key>
+ </option>
+ <option>
+ <name>Right</name>
+ <key>wx.NB_RIGHT</key>
+ </option>
+ <option>
+ <name>Bottom</name>
+ <key>wx.NB_BOTTOM</key>
+ </option>
+ <option>
+ <name>Left</name>
+ <key>wx.NB_LEFT</key>
+ </option>
+ </param>
+ <param>
+ <name>Labels</name>
+ <key>labels</key>
+ <value>['tab1', 'tab2', 'tab3']</value>
+ <type>raw</type>
+ </param>
+ <param>
+ <name>Grid Position</name>
+ <key>grid_pos</key>
+ <value></value>
+ <type>grid_pos</type>
+ </param>
+ <param>
+ <name>Notebook</name>
+ <key>notebook</key>
+ <value></value>
+ <type>notebook</type>
+ </param>
+ <check>isinstance($labels, (list, tuple))</check>
+ <check>all(map(lambda x: isinstance(x, str), $labels))</check>
+ <check>len($labels) &gt; 0</check>
+ <doc>
+Use the Grid Position (row, column, row span, column span) to position the graphical element in the window.
+
+Use the Notebook Param (notebook-id, page-index) to place the graphical element inside of a notebook page.
+ </doc>
+</block>
diff --git a/gr-wxgui/grc/panel.py b/gr-wxgui/grc/panel.py
new file mode 100644
index 000000000..e62133cac
--- /dev/null
+++ b/gr-wxgui/grc/panel.py
@@ -0,0 +1,49 @@
+# 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.
+#
+
+import wx
+
+class Panel(wx.Panel):
+ def __init__(self, parent, orient=wx.VERTICAL):
+ wx.Panel.__init__(self, parent)
+ self._box = wx.BoxSizer(orient)
+ self._grid = wx.GridBagSizer(5, 5)
+ self.Add(self._grid)
+ self.SetSizer(self._box)
+
+ def GetWin(self): return self
+
+ def Add(self, win):
+ """
+ Add a window to the wx vbox.
+ @param win the wx window
+ """
+ self._box.Add(win, 0, wx.EXPAND)
+
+ def GridAdd(self, win, row, col, row_span=1, col_span=1):
+ """
+ Add a window to the wx grid at the given position.
+ @param win the wx window
+ @param row the row specification (integer >= 0)
+ @param col the column specification (integer >= 0)
+ @param row_span the row span specification (integer >= 1)
+ @param col_span the column span specification (integer >= 1)
+ """
+ self._grid.Add(win, wx.GBPosition(row, col), wx.GBSpan(row_span, col_span), wx.EXPAND)
diff --git a/gr-wxgui/grc/top_block_gui.py b/gr-wxgui/grc/top_block_gui.py
new file mode 100644
index 000000000..479f55a30
--- /dev/null
+++ b/gr-wxgui/grc/top_block_gui.py
@@ -0,0 +1,78 @@
+# Copyright 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.
+#
+
+import wx
+from gnuradio import gr
+import panel
+
+default_gui_size = (200, 100)
+
+class top_block_gui(gr.top_block):
+ """gr top block with wx gui app and grid sizer."""
+
+ def __init__(self, title='', size=default_gui_size):
+ """
+ Initialize the gr top block.
+ Create the wx gui elements.
+ @param title the main window title
+ @param size the main window size tuple in pixels
+ @param icon the file path to an icon or None
+ """
+ #initialize
+ gr.top_block.__init__(self)
+ self._size = size
+ #create gui elements
+ self._app = wx.App()
+ self._frame = wx.Frame(None, title=title)
+ self._panel = panel.Panel(self._frame)
+ self.Add = self._panel.Add
+ self.GridAdd = self._panel.GridAdd
+ self.GetWin = self._panel.GetWin
+
+ def SetIcon(self, *args, **kwargs): self._frame.SetIcon(*args, **kwargs)
+
+ def Run(self, start=True, max_nouts=0):
+ """
+ Setup the wx gui elements.
+ Start the gr top block.
+ Block with the wx main loop.
+ """
+ #set minimal window size
+ self._frame.SetSizeHints(*self._size)
+ #create callback for quit
+ def _quit(event):
+ self.stop(); self.wait()
+ self._frame.Destroy()
+ #setup app
+ self._frame.Bind(wx.EVT_CLOSE, _quit)
+ self._sizer = wx.BoxSizer(wx.VERTICAL)
+ self._sizer.Add(self._panel, 0, wx.EXPAND)
+ self._frame.SetSizerAndFit(self._sizer)
+ self._frame.SetAutoLayout(True)
+ self._frame.Show(True)
+ self._app.SetTopWindow(self._frame)
+ #start flow graph
+ if start:
+ if max_nouts != 0:
+ self.start(max_nouts)
+ else:
+ self.start()
+ #blocking main loop
+ self._app.MainLoop()
diff --git a/gr-wxgui/grc/variable_check_box.xml b/gr-wxgui/grc/variable_check_box.xml
new file mode 100644
index 000000000..0c7bd1081
--- /dev/null
+++ b/gr-wxgui/grc/variable_check_box.xml
@@ -0,0 +1,85 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Variable Check Box:
+## a gui check box form
+###################################################
+ -->
+<block>
+ <name>WX GUI Check Box</name>
+ <key>variable_check_box</key>
+ <category>WX GUI Widgets</category>
+ <import>from gnuradio.wxgui import forms</import>
+ <var_make>self.$(id) = $(id) = $value</var_make>
+ <make>#set $parent = $notebook() and 'self.%s.GetPage(%s)'%$notebook() or 'self'
+#set $win = 'self._%s_check_box'%$id
+$win = forms.check_box(
+ parent=$(parent).GetWin(),
+ value=self.$id,
+ callback=self.set_$(id),
+ #if $label()
+ label=$label,
+ #else
+ label='$id',
+ #end if
+ true=$true,
+ false=$false,
+)
+#if not $grid_pos()
+$(parent).Add($win)
+#else
+$(parent).GridAdd($win, $(', '.join(map(str, $grid_pos()))))
+#end if</make>
+ <callback>self.set_$(id)($value)</callback>
+ <callback>self._$(id)_check_box.set_value($id)</callback>
+ <param>
+ <name>Label</name>
+ <key>label</key>
+ <value></value>
+ <type>string</type>
+ <hide>#if $label() then 'none' else 'part'#</hide>
+ </param>
+ <param>
+ <name>Default Value</name>
+ <key>value</key>
+ <value>True</value>
+ <type>raw</type>
+ </param>
+ <param>
+ <name>True</name>
+ <key>true</key>
+ <value>True</value>
+ <type>raw</type>
+ </param>
+ <param>
+ <name>False</name>
+ <key>false</key>
+ <value>False</value>
+ <type>raw</type>
+ </param>
+ <param>
+ <name>Grid Position</name>
+ <key>grid_pos</key>
+ <value></value>
+ <type>grid_pos</type>
+ </param>
+ <param>
+ <name>Notebook</name>
+ <key>notebook</key>
+ <value></value>
+ <type>notebook</type>
+ </param>
+ <check>$value in ($true, $false)</check>
+ <doc>
+This block creates a variable with a check box form. \
+Leave the label blank to use the variable id as the label.
+
+A check box form can switch between two states; \
+the default being True and False. \
+Override True and False to use alternative states.
+
+Use the Grid Position (row, column, row span, column span) to position the graphical element in the window.
+
+Use the Notebook Param (notebook-id, page-index) to place the graphical element inside of a notebook page.
+ </doc>
+</block>
diff --git a/gr-wxgui/grc/variable_chooser.xml b/gr-wxgui/grc/variable_chooser.xml
new file mode 100644
index 000000000..e16e88c5d
--- /dev/null
+++ b/gr-wxgui/grc/variable_chooser.xml
@@ -0,0 +1,123 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Variable Chooser:
+## a gui form with enumerated choices
+## radio buttons, drop down, or button
+###################################################
+ -->
+<block>
+ <name>WX GUI Chooser</name>
+ <key>variable_chooser</key>
+ <category>WX GUI Widgets</category>
+ <import>from gnuradio.wxgui import forms</import>
+ <var_make>self.$(id) = $(id) = $value</var_make>
+ <make>#set $parent = $notebook() and 'self.%s.GetPage(%s)'%$notebook() or 'self'
+#set $win = 'self._%s_chooser'%$id
+$win = forms.$(type)(
+ parent=$(parent).GetWin(),
+ value=self.$id,
+ callback=self.set_$(id),
+ #if $label()
+ label=$label,
+ #else
+ label='$id',
+ #end if
+ choices=$choices,
+ labels=$labels,
+#if $type() == 'radio_buttons'
+ style=$style,
+#end if
+)
+#if not $grid_pos()
+$(parent).Add($win)
+#else
+$(parent).GridAdd($win, $(', '.join(map(str, $grid_pos()))))
+#end if</make>
+ <callback>self.set_$(id)($value)</callback>
+ <callback>self._$(id)_chooser.set_value($id)</callback>
+ <param>
+ <name>Label</name>
+ <key>label</key>
+ <value></value>
+ <type>string</type>
+ <hide>#if $label() then 'none' else 'part'#</hide>
+ </param>
+ <param>
+ <name>Default Value</name>
+ <key>value</key>
+ <value>1</value>
+ <type>raw</type>
+ </param>
+ <param>
+ <name>Choices</name>
+ <key>choices</key>
+ <value>[1, 2, 3]</value>
+ <type>raw</type>
+ </param>
+ <param>
+ <name>Labels</name>
+ <key>labels</key>
+ <value>[]</value>
+ <type>raw</type>
+ </param>
+ <param>
+ <name>Type</name>
+ <key>type</key>
+ <value>drop_down</value>
+ <type>enum</type>
+ <option>
+ <name>Drop Down</name>
+ <key>drop_down</key>
+ </option>
+ <option>
+ <name>Radio Buttons</name>
+ <key>radio_buttons</key>
+ </option>
+ <option>
+ <name>Button</name>
+ <key>button</key>
+ </option>
+ </param>
+ <param>
+ <name>Style</name>
+ <key>style</key>
+ <value>wx.RA_HORIZONTAL</value>
+ <type>enum</type>
+ <hide>#if $type() == 'radio_buttons' then 'part' else 'all'#</hide>
+ <option>
+ <name>Horizontal</name>
+ <key>wx.RA_HORIZONTAL</key>
+ </option>
+ <option>
+ <name>Vertical</name>
+ <key>wx.RA_VERTICAL</key>
+ </option>
+ </param>
+ <param>
+ <name>Grid Position</name>
+ <key>grid_pos</key>
+ <value></value>
+ <type>grid_pos</type>
+ </param>
+ <param>
+ <name>Notebook</name>
+ <key>notebook</key>
+ <value></value>
+ <type>notebook</type>
+ </param>
+ <check>$value in $choices</check>
+ <check>not $labels or len($labels) == len($choices)</check>
+ <doc>
+This block creates a variable with a drop down, radio buttons, or a button. \
+Leave the label blank to use the variable id as the label. \
+The value index is the index of a particular choice, \
+which defines the default choice when the flow graph starts. \
+The choices must be a list of possible values. \
+Leave labels empty to use the choices as the labels.
+
+Use the Grid Position (row, column, row span, column span) to position the graphical element in the window.
+
+Use the Notebook Param (notebook-id, page-index) to place the graphical element inside of a notebook page.
+ </doc>
+</block>
diff --git a/gr-wxgui/grc/variable_slider.xml b/gr-wxgui/grc/variable_slider.xml
new file mode 100644
index 000000000..5e3c175aa
--- /dev/null
+++ b/gr-wxgui/grc/variable_slider.xml
@@ -0,0 +1,139 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Variable Slider:
+## a combined slider and text box form
+###################################################
+ -->
+<block>
+ <name>WX GUI Slider</name>
+ <key>variable_slider</key>
+ <category>WX GUI Widgets</category>
+ <import>from gnuradio.wxgui import forms</import>
+ <var_make>self.$(id) = $(id) = $value</var_make>
+ <make>#set $parent = $notebook() and 'self.%s.GetPage(%s)'%$notebook() or 'self'
+#set $win = '_%s_sizer'%$id
+$win = wx.BoxSizer(wx.VERTICAL)
+self._$(id)_text_box = forms.text_box(
+ parent=$(parent).GetWin(),
+ sizer=$win,
+ value=self.$id,
+ callback=self.set_$(id),
+ #if $label()
+ label=$label,
+ #else
+ label='$id',
+ #end if
+ converter=forms.$(converver)(),
+ proportion=0,
+)
+self._$(id)_slider = forms.slider(
+ parent=$(parent).GetWin(),
+ sizer=$win,
+ value=self.$id,
+ callback=self.set_$(id),
+ minimum=$min,
+ maximum=$max,
+ num_steps=$num_steps,
+ style=$style,
+ cast=$(converver.slider_cast),
+ proportion=1,
+)
+#if not $grid_pos()
+$(parent).Add($win)
+#else
+$(parent).GridAdd($win, $(', '.join(map(str, $grid_pos()))))
+#end if</make>
+ <callback>self.set_$(id)($value)</callback>
+ <callback>self._$(id)_slider.set_value($id)</callback>
+ <callback>self._$(id)_text_box.set_value($id)</callback>
+ <param>
+ <name>Label</name>
+ <key>label</key>
+ <value></value>
+ <type>string</type>
+ <hide>#if $label() then 'none' else 'part'#</hide>
+ </param>
+ <param>
+ <name>Default Value</name>
+ <key>value</key>
+ <value>50</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Minimum</name>
+ <key>min</key>
+ <value>0</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Maximum</name>
+ <key>max</key>
+ <value>100</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Num Steps</name>
+ <key>num_steps</key>
+ <value>100</value>
+ <type>int</type>
+ <hide>part</hide>
+ </param>
+ <param>
+ <name>Style</name>
+ <key>style</key>
+ <value>wx.SL_HORIZONTAL</value>
+ <type>enum</type>
+ <hide>part</hide>
+ <option>
+ <name>Horizontal</name>
+ <key>wx.SL_HORIZONTAL</key>
+ </option>
+ <option>
+ <name>Vertical</name>
+ <key>wx.SL_VERTICAL</key>
+ </option>
+ </param>
+ <param>
+ <name>Converter</name>
+ <key>converver</key>
+ <value>float_converter</value>
+ <type>enum</type>
+ <option>
+ <name>Float</name>
+ <key>float_converter</key>
+ <opt>slider_cast:float</opt>
+ </option>
+ <option>
+ <name>Integer</name>
+ <key>int_converter</key>
+ <opt>slider_cast:int</opt>
+ </option>
+ </param>
+ <param>
+ <name>Grid Position</name>
+ <key>grid_pos</key>
+ <value></value>
+ <type>grid_pos</type>
+ </param>
+ <param>
+ <name>Notebook</name>
+ <key>notebook</key>
+ <value></value>
+ <type>notebook</type>
+ </param>
+ <check>$min &lt;= $value &lt;= $max</check>
+ <check>$min &lt; $max</check>
+ <check>0 &lt; $num_steps &lt;= 1000</check>
+ <doc>
+This block creates a variable with a slider. \
+Leave the label blank to use the variable id as the label. \
+The value must be a real number. \
+The value must be between the minimum and the maximum. \
+The number of steps must be between 0 and 1000.
+
+Use the Grid Position (row, column, row span, column span) to position the graphical element in the window.
+
+Use the Notebook Param (notebook-id, page-index) to place the graphical element inside of a notebook page.
+ </doc>
+</block>
diff --git a/gr-wxgui/grc/variable_static_text.xml b/gr-wxgui/grc/variable_static_text.xml
new file mode 100644
index 000000000..cd122e76a
--- /dev/null
+++ b/gr-wxgui/grc/variable_static_text.xml
@@ -0,0 +1,98 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Variable Static Text:
+## a gui static text form
+###################################################
+ -->
+<block>
+ <name>WX GUI Static Text</name>
+ <key>variable_static_text</key>
+ <category>WX GUI Widgets</category>
+ <import>from gnuradio.wxgui import forms</import>
+ <var_make>self.$(id) = $(id) = $value</var_make>
+ <make>#set $parent = $notebook() and 'self.%s.GetPage(%s)'%$notebook() or 'self'
+#set $win = 'self._%s_static_text'%$id
+$win = forms.static_text(
+ parent=$(parent).GetWin(),
+ value=self.$id,
+ callback=self.set_$(id),
+ #if $label()
+ label=$label,
+ #else
+ label='$id',
+ #end if
+ #if $formatter()
+ converter=forms.$(converver)(formatter=$formatter),
+ #else
+ converter=forms.$(converver)(),
+ #end if
+)
+#if not $grid_pos()
+$(parent).Add($win)
+#else
+$(parent).GridAdd($win, $(', '.join(map(str, $grid_pos()))))
+#end if</make>
+ <callback>self.set_$(id)($value)</callback>
+ <callback>self._$(id)_static_text.set_value($id)</callback>
+ <param>
+ <name>Label</name>
+ <key>label</key>
+ <value></value>
+ <type>string</type>
+ <hide>#if $label() then 'none' else 'part'#</hide>
+ </param>
+ <param>
+ <name>Default Value</name>
+ <key>value</key>
+ <value>0</value>
+ <type>raw</type>
+ </param>
+ <param>
+ <name>Converter</name>
+ <key>converver</key>
+ <value>float_converter</value>
+ <type>enum</type>
+ <option>
+ <name>Float</name>
+ <key>float_converter</key>
+ </option>
+ <option>
+ <name>Integer</name>
+ <key>int_converter</key>
+ </option>
+ <option>
+ <name>String</name>
+ <key>str_converter</key>
+ </option>
+ </param>
+ <param>
+ <name>Formatter</name>
+ <key>formatter</key>
+ <value>None</value>
+ <type>raw</type>
+ <hide>part</hide>
+ </param>
+ <param>
+ <name>Grid Position</name>
+ <key>grid_pos</key>
+ <value></value>
+ <type>grid_pos</type>
+ </param>
+ <param>
+ <name>Notebook</name>
+ <key>notebook</key>
+ <value></value>
+ <type>notebook</type>
+ </param>
+ <doc>
+This block creates a variable with a static text form. \
+Leave the label blank to use the variable id as the label.
+
+Format should be a function/lambda that converts a value into a string or None for the default formatter.
+
+Use the Grid Position (row, column, row span, column span) to position the graphical element in the window.
+
+Use the Notebook Param (notebook-id, page-index) to place the graphical element inside of a notebook page.
+ </doc>
+</block>
diff --git a/gr-wxgui/grc/variable_text_box.xml b/gr-wxgui/grc/variable_text_box.xml
new file mode 100644
index 000000000..afff839cf
--- /dev/null
+++ b/gr-wxgui/grc/variable_text_box.xml
@@ -0,0 +1,102 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Variable Text Box:
+## a gui text box form
+###################################################
+ -->
+<block>
+ <name>WX GUI Text Box</name>
+ <key>variable_text_box</key>
+ <category>WX GUI Widgets</category>
+ <import>from gnuradio.wxgui import forms</import>
+ <var_make>self.$(id) = $(id) = $value</var_make>
+ <make>#set $parent = $notebook() and 'self.%s.GetPage(%s)'%$notebook() or 'self'
+#set $win = 'self._%s_text_box'%$id
+$win = forms.text_box(
+ parent=$(parent).GetWin(),
+ value=self.$id,
+ callback=self.set_$(id),
+ #if $label()
+ label=$label,
+ #else
+ label='$id',
+ #end if
+ #if $formatter()
+ converter=forms.$(converver)(formatter=$formatter),
+ #else
+ converter=forms.$(converver)(),
+ #end if
+)
+#if not $grid_pos()
+$(parent).Add($win)
+#else
+$(parent).GridAdd($win, $(', '.join(map(str, $grid_pos()))))
+#end if</make>
+ <callback>self.set_$(id)($value)</callback>
+ <callback>self._$(id)_text_box.set_value($id)</callback>
+ <param>
+ <name>Label</name>
+ <key>label</key>
+ <value></value>
+ <type>string</type>
+ <hide>#if $label() then 'none' else 'part'#</hide>
+ </param>
+ <param>
+ <name>Default Value</name>
+ <key>value</key>
+ <value>0</value>
+ <type>raw</type>
+ </param>
+ <param>
+ <name>Converter</name>
+ <key>converver</key>
+ <value>float_converter</value>
+ <type>enum</type>
+ <option>
+ <name>Float</name>
+ <key>float_converter</key>
+ </option>
+ <option>
+ <name>Integer</name>
+ <key>int_converter</key>
+ </option>
+ <option>
+ <name>String</name>
+ <key>str_converter</key>
+ </option>
+ <option>
+ <name>Evaluate</name>
+ <key>eval_converter</key>
+ </option>
+ </param>
+ <param>
+ <name>Formatter</name>
+ <key>formatter</key>
+ <value>None</value>
+ <type>raw</type>
+ <hide>part</hide>
+ </param>
+ <param>
+ <name>Grid Position</name>
+ <key>grid_pos</key>
+ <value></value>
+ <type>grid_pos</type>
+ </param>
+ <param>
+ <name>Notebook</name>
+ <key>notebook</key>
+ <value></value>
+ <type>notebook</type>
+ </param>
+ <doc>
+This block creates a variable with a text box. \
+Leave the label blank to use the variable id as the label.
+
+Format should be a function/lambda that converts a value into a string or None for the default formatter.
+
+Use the Grid Position (row, column, row span, column span) to position the graphical element in the window.
+
+Use the Notebook Param (notebook-id, page-index) to place the graphical element inside of a notebook page.
+ </doc>
+</block>
diff --git a/gr-wxgui/grc/wxgui_constellationsink2.xml b/gr-wxgui/grc/wxgui_constellationsink2.xml
new file mode 100644
index 000000000..f9df9d4ac
--- /dev/null
+++ b/gr-wxgui/grc/wxgui_constellationsink2.xml
@@ -0,0 +1,140 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Constellation Sink
+###################################################
+ -->
+<block>
+ <name>WX GUI Constellation Sink</name>
+ <key>wxgui_constellationsink2</key>
+ <category>WX GUI Widgets</category>
+ <import>from gnuradio.wxgui import constsink_gl</import>
+ <make>#set $parent = $notebook() and 'self.%s.GetPage(%s)'%$notebook() or 'self'
+constsink_gl.const_sink_c(
+ $(parent).GetWin(),
+ title=$title,
+ sample_rate=$samp_rate,
+ frame_rate=$frame_rate,
+ const_size=$const_size,
+ M=$M,
+ theta=$theta,
+ loop_bw=$loop_bw,
+ fmax=$fmax,
+ mu=$mu,
+ gain_mu=$gain_mu,
+ symbol_rate=$symbol_rate,
+ omega_limit=$omega_limit,
+#if $win_size()
+ size=$win_size,
+#end if
+)
+#if not $grid_pos()
+$(parent).Add(self.$(id).win)
+#else
+$(parent).GridAdd(self.$(id).win, $(', '.join(map(str, $grid_pos()))))
+#end if</make>
+ <callback>set_sample_rate($samp_rate)</callback>
+ <param>
+ <name>Title</name>
+ <key>title</key>
+ <value>Constellation Plot</value>
+ <type>string</type>
+ </param>
+ <param>
+ <name>Sample Rate</name>
+ <key>samp_rate</key>
+ <value>samp_rate</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Frame Rate</name>
+ <key>frame_rate</key>
+ <value>5</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Constellation Size</name>
+ <key>const_size</key>
+ <value>2048</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>M</name>
+ <key>M</key>
+ <value>4</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Theta</name>
+ <key>theta</key>
+ <value>0</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Loop Bandwidth</name>
+ <key>loop_bw</key>
+ <value>6.28/100.0</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Max Freq</name>
+ <key>fmax</key>
+ <value>0.06</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Mu</name>
+ <key>mu</key>
+ <value>0.5</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Gain Mu</name>
+ <key>gain_mu</key>
+ <value>0.005</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Symbol Rate</name>
+ <key>symbol_rate</key>
+ <value>samp_rate/4.</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Omega Limit</name>
+ <key>omega_limit</key>
+ <value>0.005</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Window Size</name>
+ <key>win_size</key>
+ <value></value>
+ <type>int_vector</type>
+ <hide>#if $win_size() then 'none' else 'part'#</hide>
+ </param>
+ <param>
+ <name>Grid Position</name>
+ <key>grid_pos</key>
+ <value></value>
+ <type>grid_pos</type>
+ </param>
+ <param>
+ <name>Notebook</name>
+ <key>notebook</key>
+ <value></value>
+ <type>notebook</type>
+ </param>
+ <check>not $win_size or len($win_size) == 2</check>
+ <sink>
+ <name>in</name>
+ <type>complex</type>
+ </sink>
+ <doc>
+Leave the window blank for the default size, otherwise enter a tuple of (width, height) pixels.
+
+Use the Grid Position (row, column, row span, column span) to position the graphical element in the window.
+
+Use the Notebook Param (notebook-id, page-index) to place the graphical element inside of a notebook page.
+ </doc>
+</block>
diff --git a/gr-wxgui/grc/wxgui_fftsink2.xml b/gr-wxgui/grc/wxgui_fftsink2.xml
new file mode 100644
index 000000000..74ee5b173
--- /dev/null
+++ b/gr-wxgui/grc/wxgui_fftsink2.xml
@@ -0,0 +1,245 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##FFT Sink
+###################################################
+ -->
+<block>
+ <name>WX GUI FFT Sink</name>
+ <key>wxgui_fftsink2</key>
+ <category>WX GUI Widgets</category>
+ <import>from gnuradio import window</import>
+ <import>from gnuradio.wxgui import fftsink2</import>
+ <make>#set $parent = $notebook() and 'self.%s.GetPage(%s)'%$notebook() or 'self'
+fftsink2.$(type.fcn)(
+ $(parent).GetWin(),
+ baseband_freq=$baseband_freq,
+ y_per_div=$y_per_div,
+ y_divs=$y_divs,
+ ref_level=$ref_level,
+ ref_scale=$ref_scale,
+ sample_rate=$samp_rate,
+ fft_size=$fft_size,
+ fft_rate=$fft_rate,
+ average=$average,
+ avg_alpha=#if $avg_alpha() then $avg_alpha else 'None'#,
+ title=$title,
+ peak_hold=$peak_hold,
+#if $win()
+ win=$win,
+#end if
+#if $win_size()
+ size=$win_size,
+#end if
+)
+#if not $grid_pos()
+$(parent).Add(self.$(id).win)
+#else
+$(parent).GridAdd(self.$(id).win, $(', '.join(map(str, $grid_pos()))))
+#end if
+#if $freqvar() is not None
+def $(id)_callback(x, y):
+ self.set_$(freqvar)(x)
+
+self.$(id).set_callback($(id)_callback)
+#end if</make>
+ <callback>set_baseband_freq($baseband_freq)</callback>
+ <callback>set_sample_rate($samp_rate)</callback>
+ <param>
+ <name>Type</name>
+ <key>type</key>
+ <value>complex</value>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>fcn:fft_sink_c</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>fcn:fft_sink_f</opt>
+ </option>
+ </param>
+ <param>
+ <name>Title</name>
+ <key>title</key>
+ <value>FFT Plot</value>
+ <type>string</type>
+ </param>
+ <param>
+ <name>Sample Rate</name>
+ <key>samp_rate</key>
+ <value>samp_rate</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Baseband Freq</name>
+ <key>baseband_freq</key>
+ <value>0</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Y per Div</name>
+ <key>y_per_div</key>
+ <value>10</value>
+ <type>enum</type>
+ <option>
+ <name>1 dB</name>
+ <key>1</key>
+ </option>
+ <option>
+ <name>2 dB</name>
+ <key>2</key>
+ </option>
+ <option>
+ <name>5 dB</name>
+ <key>5</key>
+ </option>
+ <option>
+ <name>10 dB</name>
+ <key>10</key>
+ </option>
+ <option>
+ <name>20 dB</name>
+ <key>20</key>
+ </option>
+ </param>
+ <param>
+ <name>Y Divs</name>
+ <key>y_divs</key>
+ <value>10</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Ref Level (dB)</name>
+ <key>ref_level</key>
+ <value>0</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Ref Scale (p2p)</name>
+ <key>ref_scale</key>
+ <value>2.0</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>FFT Size</name>
+ <key>fft_size</key>
+ <value>1024</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Refresh Rate</name>
+ <key>fft_rate</key>
+ <value>15</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Peak Hold</name>
+ <key>peak_hold</key>
+ <value>False</value>
+ <type>enum</type>
+ <hide>#if $peak_hold() == 'True' then 'none' else 'part'#</hide>
+ <option>
+ <name>On</name>
+ <key>True</key>
+ </option>
+ <option>
+ <name>Off</name>
+ <key>False</key>
+ </option>
+ </param>
+ <param>
+ <name>Average</name>
+ <key>average</key>
+ <value>False</value>
+ <type>enum</type>
+ <hide>part</hide>
+ <option>
+ <name>On</name>
+ <key>True</key>
+ </option>
+ <option>
+ <name>Off</name>
+ <key>False</key>
+ </option>
+ </param>
+ <param>
+ <name>Average Alpha</name>
+ <key>avg_alpha</key>
+ <value>0</value>
+ <type>real</type>
+ <hide>#if $average() == 'True' then 'none' else 'all'#</hide>
+ </param>
+ <param>
+ <name>Window</name>
+ <key>win</key>
+ <value>None</value>
+ <type>raw</type>
+ <hide>#if $win() is None then 'part' else 'none'#</hide>
+ <option>
+ <name>Automatic</name>
+ <key>None</key>
+ </option>
+ <option>
+ <name>Blackman-Harris</name>
+ <key>window.blackmanharris</key>
+ </option>
+ <option>
+ <name>Hamming</name>
+ <key>window.hamming</key>
+ </option>
+ <option>
+ <name>Hanning</name>
+ <key>window.hanning</key>
+ </option>
+ <option>
+ <name>Rectangular</name>
+ <key>window.rectangular</key>
+ </option>
+ <option>
+ <name>Flattop</name>
+ <key>window.flattop</key>
+ </option>
+ </param>
+ <param>
+ <name>Window Size</name>
+ <key>win_size</key>
+ <value></value>
+ <type>int_vector</type>
+ <hide>#if $win_size() then 'none' else 'part'#</hide>
+ </param>
+ <param>
+ <name>Grid Position</name>
+ <key>grid_pos</key>
+ <value></value>
+ <type>grid_pos</type>
+ </param>
+ <param>
+ <name>Notebook</name>
+ <key>notebook</key>
+ <value></value>
+ <type>notebook</type>
+ </param>
+ <param>
+ <name>Freq Set Varname</name>
+ <key>freqvar</key>
+ <value>None</value>
+ <type>raw</type>
+ </param>
+ <check>not $win_size or len($win_size) == 2</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ </sink>
+ <doc>
+Set Average Alpha to 0 for automatic setting.
+
+Leave the window blank for the default size, otherwise enter a tuple of (width, height) pixels.
+
+Use the Grid Position (row, column, row span, column span) to position the graphical element in the window.
+
+Use the Notebook Param (notebook-id, page-index) to place the graphical element inside of a notebook page.
+ </doc>
+</block>
diff --git a/gr-wxgui/grc/wxgui_histosink2.xml b/gr-wxgui/grc/wxgui_histosink2.xml
new file mode 100644
index 000000000..f4f6a2959
--- /dev/null
+++ b/gr-wxgui/grc/wxgui_histosink2.xml
@@ -0,0 +1,78 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Histogram Sink
+###################################################
+ -->
+<block>
+ <name>WX GUI Histo Sink</name>
+ <key>wxgui_histosink2</key>
+ <category>WX GUI Widgets</category>
+ <import>from gnuradio.wxgui import histosink_gl</import>
+ <make>#set $parent = $notebook() and 'self.%s.GetPage(%s)'%$notebook() or 'self'
+histosink_gl.histo_sink_f(
+ $(parent).GetWin(),
+ title=$title,
+ num_bins=$num_bins,
+ frame_size=$frame_size,
+#if $win_size()
+ size=$win_size,
+#end if
+)
+#if not $grid_pos()
+$(parent).Add(self.$(id).win)
+#else
+$(parent).GridAdd(self.$(id).win, $(', '.join(map(str, $grid_pos()))))
+#end if</make>
+ <callback>set_num_bins($num_bins)</callback>
+ <callback>set_frame_size($frame_size)</callback>
+ <param>
+ <name>Title</name>
+ <key>title</key>
+ <value>Histogram Plot</value>
+ <type>string</type>
+ </param>
+ <param>
+ <name>Num Bins</name>
+ <key>num_bins</key>
+ <value>27</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Frame Size</name>
+ <key>frame_size</key>
+ <value>1000</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Window Size</name>
+ <key>win_size</key>
+ <value></value>
+ <type>int_vector</type>
+ <hide>#if $win_size() then 'none' else 'part'#</hide>
+ </param>
+ <param>
+ <name>Grid Position</name>
+ <key>grid_pos</key>
+ <value></value>
+ <type>grid_pos</type>
+ </param>
+ <param>
+ <name>Notebook</name>
+ <key>notebook</key>
+ <value></value>
+ <type>notebook</type>
+ </param>
+ <check>not $win_size or len($win_size) == 2</check>
+ <sink>
+ <name>in</name>
+ <type>float</type>
+ </sink>
+ <doc>
+Leave the window blank for the default size, otherwise enter a tuple of (width, height) pixels.
+
+Use the Grid Position (row, column, row span, column span) to position the graphical element in the window.
+
+Use the Notebook Param (notebook-id, page-index) to place the graphical element inside of a notebook page.
+ </doc>
+</block>
diff --git a/gr-wxgui/grc/wxgui_numbersink2.xml b/gr-wxgui/grc/wxgui_numbersink2.xml
new file mode 100644
index 000000000..255926610
--- /dev/null
+++ b/gr-wxgui/grc/wxgui_numbersink2.xml
@@ -0,0 +1,193 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Number Sink
+###################################################
+ -->
+<block>
+ <name>WX GUI Number Sink</name>
+ <key>wxgui_numbersink2</key>
+ <category>WX GUI Widgets</category>
+ <import>from gnuradio.wxgui import numbersink2</import>
+ <make>#set $parent = $notebook() and 'self.%s.GetPage(%s)'%$notebook() or 'self'
+numbersink2.$(type.fcn)(
+ $(parent).GetWin(),
+ unit=$units,
+ minval=$min_value,
+ maxval=$max_value,
+ factor=$factor,
+ decimal_places=$decimal_places,
+ ref_level=$ref_level,
+ sample_rate=$samp_rate,
+ number_rate=$number_rate,
+ average=$average,
+ avg_alpha=#if $avg_alpha() then $avg_alpha else 'None'#,
+ label=$title,
+ peak_hold=$peak_hold,
+ show_gauge=$show_gauge,
+#if $win_size()
+ size=$win_size,
+#end if
+)
+#if not $grid_pos()
+$(parent).Add(self.$(id).win)
+#else
+$(parent).GridAdd(self.$(id).win, $(', '.join(map(str, $grid_pos()))))
+#end if</make>
+ <param>
+ <name>Type</name>
+ <key>type</key>
+ <value>complex</value>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>fcn:number_sink_c</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>fcn:number_sink_f</opt>
+ </option>
+ </param>
+ <param>
+ <name>Title</name>
+ <key>title</key>
+ <value>Number Plot</value>
+ <type>string</type>
+ </param>
+ <param>
+ <name>Units</name>
+ <key>units</key>
+ <value>Units</value>
+ <type>string</type>
+ </param>
+ <param>
+ <name>Sample Rate</name>
+ <key>samp_rate</key>
+ <value>samp_rate</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Min Value</name>
+ <key>min_value</key>
+ <value>-100</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Max Value</name>
+ <key>max_value</key>
+ <value>100</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Factor</name>
+ <key>factor</key>
+ <value>1.0</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Decimal Places</name>
+ <key>decimal_places</key>
+ <value>10</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Reference Level</name>
+ <key>ref_level</key>
+ <value>0</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Number Rate</name>
+ <key>number_rate</key>
+ <value>15</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Peak Hold</name>
+ <key>peak_hold</key>
+ <value>False</value>
+ <type>enum</type>
+ <hide>#if $peak_hold() == 'True' then 'none' else 'part'#</hide>
+ <option>
+ <name>On</name>
+ <key>True</key>
+ </option>
+ <option>
+ <name>Off</name>
+ <key>False</key>
+ </option>
+ </param>
+ <param>
+ <name>Average</name>
+ <key>average</key>
+ <value>False</value>
+ <type>enum</type>
+ <hide>part</hide>
+ <option>
+ <name>On</name>
+ <key>True</key>
+ </option>
+ <option>
+ <name>Off</name>
+ <key>False</key>
+ </option>
+ </param>
+ <param>
+ <name>Average Alpha</name>
+ <key>avg_alpha</key>
+ <value>0</value>
+ <type>real</type>
+ <hide>#if $average() == 'True' then 'none' else 'all'#</hide>
+ </param>
+ <param>
+ <name>Show Gauge</name>
+ <key>show_gauge</key>
+ <value>True</value>
+ <type>enum</type>
+ <option>
+ <name>Show</name>
+ <key>True</key>
+ </option>
+ <option>
+ <name>Hide</name>
+ <key>False</key>
+ </option>
+ </param>
+ <param>
+ <name>Window Size</name>
+ <key>win_size</key>
+ <value></value>
+ <type>int_vector</type>
+ <hide>#if $win_size() then 'none' else 'part'#</hide>
+ </param>
+ <param>
+ <name>Grid Position</name>
+ <key>grid_pos</key>
+ <value></value>
+ <type>grid_pos</type>
+ </param>
+ <param>
+ <name>Notebook</name>
+ <key>notebook</key>
+ <value></value>
+ <type>notebook</type>
+ </param>
+ <check>not $win_size or len($win_size) == 2</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ </sink>
+ <doc>
+Set Average Alpha to 0 for automatic setting.
+
+Leave the window blank for the default size, otherwise enter a tuple of (width, height) pixels.
+
+Use the Grid Position (row, column, row span, column span) to position the graphical element in the window.
+
+Use the Notebook Param (notebook-id, page-index) to place the graphical element inside of a notebook page.
+
+Incoming numbers are multiplied by the factor, and then added-to by the reference level.
+ </doc>
+</block>
diff --git a/gr-wxgui/grc/wxgui_scopesink2.xml b/gr-wxgui/grc/wxgui_scopesink2.xml
new file mode 100644
index 000000000..dbf983e11
--- /dev/null
+++ b/gr-wxgui/grc/wxgui_scopesink2.xml
@@ -0,0 +1,187 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Scope Sink
+###################################################
+ -->
+<block>
+ <name>WX GUI Scope Sink</name>
+ <key>wxgui_scopesink2</key>
+ <category>WX GUI Widgets</category>
+ <import>from gnuradio.wxgui import scopesink2</import>
+ <import>from gnuradio import gr</import>
+ <make>#set $parent = $notebook() and 'self.%s.GetPage(%s)'%$notebook() or 'self'
+scopesink2.$(type.fcn)(
+ $(parent).GetWin(),
+ title=$title,
+ sample_rate=$samp_rate,
+ v_scale=$v_scale,
+ v_offset=$v_offset,
+ t_scale=$t_scale,
+ ac_couple=$ac_couple,
+ xy_mode=$xy_mode,
+ num_inputs=$num_inputs,
+ trig_mode=$trig_mode,
+ y_axis_label=$y_axis_label,
+#if $win_size()
+ size=$win_size,
+#end if
+)
+#if not $grid_pos()
+$(parent).Add(self.$(id).win)
+#else
+$(parent).GridAdd(self.$(id).win, $(', '.join(map(str, $grid_pos()))))
+#end if</make>
+ <callback>set_sample_rate($samp_rate)</callback>
+ <param>
+ <name>Type</name>
+ <key>type</key>
+ <value>complex</value>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>fcn:scope_sink_c</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>fcn:scope_sink_f</opt>
+ </option>
+ </param>
+ <param>
+ <name>Title</name>
+ <key>title</key>
+ <value>Scope Plot</value>
+ <type>string</type>
+ </param>
+ <param>
+ <name>Sample Rate</name>
+ <key>samp_rate</key>
+ <value>samp_rate</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>V Scale</name>
+ <key>v_scale</key>
+ <value>0</value>
+ <type>real</type>
+ <hide>#if $v_scale() then 'none' else 'part'#</hide>
+ </param>
+ <param>
+ <name>V Offset</name>
+ <key>v_offset</key>
+ <value>0</value>
+ <type>real</type>
+ <hide>#if $v_offset() then 'none' else 'part'#</hide>
+ </param>
+ <param>
+ <name>T Scale</name>
+ <key>t_scale</key>
+ <value>0</value>
+ <type>real</type>
+ <hide>#if $t_scale() then 'none' else 'part'#</hide>
+ </param>
+ <param>
+ <name>AC Couple</name>
+ <key>ac_couple</key>
+ <value>False</value>
+ <type>bool</type>
+ <hide>#if $ac_couple() then 'none' else 'part'#</hide>
+ <option>
+ <name>Off</name>
+ <key>False</key>
+ </option>
+ <option>
+ <name>On</name>
+ <key>True</key>
+ </option>
+ </param>
+ <param>
+ <name>XY Mode</name>
+ <key>xy_mode</key>
+ <value>False</value>
+ <type>enum</type>
+ <hide>#if $xy_mode() == 'True' then 'none' else 'part'#</hide>
+ <option>
+ <name>Off</name>
+ <key>False</key>
+ </option>
+ <option>
+ <name>On</name>
+ <key>True</key>
+ </option>
+ </param>
+ <param>
+ <name>Num Inputs</name>
+ <key>num_inputs</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Window Size</name>
+ <key>win_size</key>
+ <value></value>
+ <type>int_vector</type>
+ <hide>#if $win_size() then 'none' else 'part'#</hide>
+ </param>
+ <param>
+ <name>Grid Position</name>
+ <key>grid_pos</key>
+ <value></value>
+ <type>grid_pos</type>
+ </param>
+ <param>
+ <name>Notebook</name>
+ <key>notebook</key>
+ <value></value>
+ <type>notebook</type>
+ </param>
+ <param>
+ <name>Trigger Mode</name>
+ <key>trig_mode</key>
+ <type>enum</type>
+ <option>
+ <name>Auto</name>
+ <key>gr.gr_TRIG_MODE_AUTO</key>
+ </option>
+ <option>
+ <name>Normal</name>
+ <key>gr.gr_TRIG_MODE_NORM</key>
+ </option>
+ <option>
+ <name>Freerun</name>
+ <key>gr.gr_TRIG_MODE_FREE</key>
+ </option>
+ <option>
+ <name>Stripchart</name>
+ <key>gr.gr_TRIG_MODE_STRIPCHART</key>
+ </option>
+ </param>
+ <param>
+ <name>Y Axis Label</name>
+ <key>y_axis_label</key>
+ <value>Counts</value>
+ <type>string</type>
+ </param>
+ <check>not $win_size or len($win_size) == 2</check>
+ <check>not $xy_mode or '$type' == 'complex' or $num_inputs != 1</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <nports>$num_inputs</nports>
+ </sink>
+ <doc>
+Set the V Scale to 0 for the scope to auto-scale.
+
+Set the T Scale to 0 for automatic setting.
+
+XY Mode allows the scope to initialize as an XY plotter.
+
+Leave the window blank for the default size, otherwise enter a tuple of (width, height) pixels.
+
+Use the Grid Position (row, column, row span, column span) to position the graphical element in the window.
+
+Use the Notebook Param (notebook-id, page-index) to place the graphical element inside of a notebook page.
+ </doc>
+</block>
diff --git a/gr-wxgui/grc/wxgui_termsink.xml b/gr-wxgui/grc/wxgui_termsink.xml
new file mode 100644
index 000000000..3e35c7578
--- /dev/null
+++ b/gr-wxgui/grc/wxgui_termsink.xml
@@ -0,0 +1,56 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Terminal window
+###################################################
+ -->
+<block>
+ <name>WX GUI Terminal Sink</name>
+ <key>wxgui_termsink</key>
+ <category>WX GUI Widgets</category>
+
+ <import>from gnuradio.wxgui import termsink</import>
+
+ <make>#set $parent = $notebook() and 'self.%s.GetPage(%s)'%$notebook() or 'self'
+termsink.termsink(
+ parent=$(parent).GetWin(),
+#if $win_size()
+ size=$win_size,
+#end if
+ msgq=$(id)_msgq_in,
+)
+#if not $grid_pos()
+$(parent).Add(self.$(id))
+#else
+$(parent).GridAdd(self.$(id), $(', '.join(map(str, $grid_pos()))))
+#end if</make>
+
+ <param>
+ <name>Window Size</name>
+ <key>win_size</key>
+ <value></value>
+ <type>int_vector</type>
+ <hide>#if $win_size() then 'none' else 'part'#</hide>
+ </param>
+ <param>
+ <name>Grid Position</name>
+ <key>grid_pos</key>
+ <value></value>
+ <type>grid_pos</type>
+ </param>
+
+ <param>
+ <name>Notebook</name>
+ <key>notebook</key>
+ <value></value>
+ <type>notebook</type>
+ </param>
+
+ <check>not $win_size or len($win_size) == 2</check>
+
+ <sink>
+ <name>in</name>
+ <type>msg</type>
+ </sink>
+
+</block>
diff --git a/gr-wxgui/grc/wxgui_waterfallsink2.xml b/gr-wxgui/grc/wxgui_waterfallsink2.xml
new file mode 100644
index 000000000..8921e87f9
--- /dev/null
+++ b/gr-wxgui/grc/wxgui_waterfallsink2.xml
@@ -0,0 +1,202 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Waterfall Sink
+###################################################
+ -->
+<block>
+ <name>WX GUI Waterfall Sink</name>
+ <key>wxgui_waterfallsink2</key>
+ <category>WX GUI Widgets</category>
+ <import>from gnuradio import window</import>
+ <import>from gnuradio.wxgui import waterfallsink2</import>
+ <make>#set $parent = $notebook() and 'self.%s.GetPage(%s)'%$notebook() or 'self'
+waterfallsink2.$(type.fcn)(
+ $(parent).GetWin(),
+ baseband_freq=$baseband_freq,
+ dynamic_range=$dynamic_range,
+ ref_level=$ref_level,
+ ref_scale=$ref_scale,
+ sample_rate=$samp_rate,
+ fft_size=$fft_size,
+ fft_rate=$fft_rate,
+ average=$average,
+ avg_alpha=#if $avg_alpha() then $avg_alpha else 'None'#,
+ title=$title,
+#if $win()
+ win=$win,
+#end if
+#if $win_size()
+ size=$win_size,
+#end if
+)
+#if not $grid_pos()
+$(parent).Add(self.$(id).win)
+#else
+$(parent).GridAdd(self.$(id).win, $(', '.join(map(str, $grid_pos()))))
+#end if
+#if $freqvar() is not None
+def $(id)_callback(x, y):
+ self.set_$(freqvar)(x)
+
+self.$(id).set_callback($(id)_callback)
+#end if</make>
+ <callback>set_baseband_freq($baseband_freq)</callback>
+ <callback>set_sample_rate($samp_rate)</callback>
+ <param>
+ <name>Type</name>
+ <key>type</key>
+ <value>complex</value>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>fcn:waterfall_sink_c</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>fcn:waterfall_sink_f</opt>
+ </option>
+ </param>
+ <param>
+ <name>Title</name>
+ <key>title</key>
+ <value>Waterfall Plot</value>
+ <type>string</type>
+ </param>
+ <param>
+ <name>Sample Rate</name>
+ <key>samp_rate</key>
+ <value>samp_rate</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Baseband Freq</name>
+ <key>baseband_freq</key>
+ <value>0</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Dynamic Range</name>
+ <key>dynamic_range</key>
+ <value>100</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Reference Level</name>
+ <key>ref_level</key>
+ <value>0</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Ref Scale (p2p)</name>
+ <key>ref_scale</key>
+ <value>2.0</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>FFT Size</name>
+ <key>fft_size</key>
+ <value>512</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>FFT Rate</name>
+ <key>fft_rate</key>
+ <value>15</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Average</name>
+ <key>average</key>
+ <value>False</value>
+ <type>enum</type>
+ <hide>part</hide>
+ <option>
+ <name>On</name>
+ <key>True</key>
+ </option>
+ <option>
+ <name>Off</name>
+ <key>False</key>
+ </option>
+ </param>
+ <param>
+ <name>Average Alpha</name>
+ <key>avg_alpha</key>
+ <value>0</value>
+ <type>real</type>
+ <hide>#if $average() == 'True' then 'none' else 'all'#</hide>
+ </param>
+ <param>
+ <name>Window</name>
+ <key>win</key>
+ <value>None</value>
+ <type>raw</type>
+ <hide>#if $win() is None then 'part' else 'none'#</hide>
+ <option>
+ <name>Automatic</name>
+ <key>None</key>
+ </option>
+ <option>
+ <name>Blackman-Harris</name>
+ <key>window.blackmanharris</key>
+ </option>
+ <option>
+ <name>Hamming</name>
+ <key>window.hamming</key>
+ </option>
+ <option>
+ <name>Hanning</name>
+ <key>window.hanning</key>
+ </option>
+ <option>
+ <name>Rectangular</name>
+ <key>window.rectangular</key>
+ </option>
+ <option>
+ <name>Flattop</name>
+ <key>window.flattop</key>
+ </option>
+ </param>
+ <param>
+ <name>Window Size</name>
+ <key>win_size</key>
+ <value></value>
+ <type>int_vector</type>
+ <hide>#if $win_size() then 'none' else 'part'#</hide>
+ </param>
+ <param>
+ <name>Grid Position</name>
+ <key>grid_pos</key>
+ <value></value>
+ <type>grid_pos</type>
+ </param>
+ <param>
+ <name>Notebook</name>
+ <key>notebook</key>
+ <value></value>
+ <type>notebook</type>
+ </param>
+ <param>
+ <name>Freq Set Varname</name>
+ <key>freqvar</key>
+ <value>None</value>
+ <type>raw</type>
+ </param>
+ <check>not $win_size or len($win_size) == 2</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ </sink>
+ <doc>
+Set Average Alpha to 0 for automatic setting.
+
+Leave the window blank for the default size, otherwise enter a tuple of (width, height) pixels.
+
+Use the Grid Position (row, column, row span, column span) to position the graphical element in the window.
+
+Use the Notebook Param (notebook-id, page-index) to place the graphical element inside of a notebook page.
+ </doc>
+</block>
diff --git a/gr-wxgui/src/python/CMakeLists.txt b/gr-wxgui/src/python/CMakeLists.txt
new file mode 100644
index 000000000..24e06acd5
--- /dev/null
+++ b/gr-wxgui/src/python/CMakeLists.txt
@@ -0,0 +1,88 @@
+# Copyright 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.
+
+########################################################################
+include(GrPython)
+
+########################################################################
+# Install python files into wxgui module
+########################################################################
+GR_PYTHON_INSTALL(
+ FILES
+ __init__.py
+ common.py
+ constants.py
+ constsink_gl.py
+ const_window.py
+ form.py
+ fftsink2.py
+ fftsink_nongl.py
+ fftsink_gl.py
+ fft_window.py
+ gui.py
+ histosink_gl.py
+ histo_window.py
+ numbersink2.py
+ number_window.py
+ plot.py
+ powermate.py
+ pubsub.py
+ scopesink2.py
+ scopesink_nongl.py
+ scopesink_gl.py
+ scope_window.py
+ termsink.py
+ waterfallsink2.py
+ waterfallsink_nongl.py
+ waterfallsink_gl.py
+ waterfall_window.py
+ slider.py
+ stdgui2.py
+ DESTINATION ${GR_PYTHON_DIR}/gnuradio/wxgui
+ COMPONENT "wxgui"
+)
+
+########################################################################
+# Install python files into wxgui forms sub-module
+########################################################################
+GR_PYTHON_INSTALL(
+ FILES
+ forms/__init__.py
+ forms/forms.py
+ forms/converters.py
+ DESTINATION ${GR_PYTHON_DIR}/gnuradio/wxgui/forms
+ COMPONENT "wxgui"
+)
+
+########################################################################
+# Install python files into wxgui plotter sub-module
+########################################################################
+GR_PYTHON_INSTALL(
+ FILES
+ plotter/__init__.py
+ plotter/bar_plotter.py
+ plotter/channel_plotter.py
+ plotter/common.py
+ plotter/gltext.py
+ plotter/grid_plotter_base.py
+ plotter/plotter_base.py
+ plotter/waterfall_plotter.py
+ DESTINATION ${GR_PYTHON_DIR}/gnuradio/wxgui/plotter
+ COMPONENT "wxgui"
+)
diff --git a/gr-wxgui/src/python/__init__.py b/gr-wxgui/src/python/__init__.py
new file mode 100644
index 000000000..68f8f4b5e
--- /dev/null
+++ b/gr-wxgui/src/python/__init__.py
@@ -0,0 +1,25 @@
+#
+# Copyright 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 is the gr-wxgui package. This package provides a GUI interface
+using the Wx backend.
+'''
diff --git a/gr-wxgui/src/python/common.py b/gr-wxgui/src/python/common.py
new file mode 100644
index 000000000..1410d29df
--- /dev/null
+++ b/gr-wxgui/src/python/common.py
@@ -0,0 +1,252 @@
+#
+# Copyright 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.
+#
+
+##################################################
+# conditional disconnections of wx flow graph
+##################################################
+import wx
+from gnuradio import gr
+
+RUN_ALWAYS = gr.prefs().get_bool ('wxgui', 'run_always', False)
+
+class wxgui_hb(object):
+ """
+ The wxgui hier block helper/wrapper class:
+ A hier block should inherit from this class to make use of the wxgui connect method.
+ To use, call wxgui_connect in place of regular connect; self.win must be defined.
+ The implementation will conditionally enable the copy block after the source (self).
+ This condition depends on weather or not the window is visible with the parent notebooks.
+ This condition will be re-checked on every ui update event.
+ """
+
+ def wxgui_connect(self, *points):
+ """
+ Use wxgui connect when the first point is the self source of the hb.
+ The win property of this object should be set to the wx window.
+ When this method tries to connect self to the next point,
+ it will conditionally make this connection based on the visibility state.
+ All other points will be connected normally.
+ """
+ try:
+ assert points[0] == self or points[0][0] == self
+ copy = gr.copy(self._hb.input_signature().sizeof_stream_item(0))
+ handler = self._handler_factory(copy.set_enabled)
+ if RUN_ALWAYS == False:
+ handler(False) #initially disable the copy block
+ else:
+ handler(True) #initially enable the copy block
+ self._bind_to_visible_event(win=self.win, handler=handler)
+ points = list(points)
+ points.insert(1, copy) #insert the copy block into the chain
+ except (AssertionError, IndexError): pass
+ self.connect(*points) #actually connect the blocks
+
+ @staticmethod
+ def _handler_factory(handler):
+ """
+ Create a function that will cache the visibility flag,
+ and only call the handler when that flag changes.
+ @param handler the function to call on a change
+ @return a function of 1 argument
+ """
+ cache = [None]
+ def callback(visible):
+ if cache[0] == visible: return
+ cache[0] = visible
+ #print visible, handler
+ if RUN_ALWAYS == False:
+ handler(visible)
+ else:
+ handler(True)
+ return callback
+
+ @staticmethod
+ def _bind_to_visible_event(win, handler):
+ """
+ Bind a handler to a window when its visibility changes.
+ Specifically, call the handler when the window visibility changes.
+ This condition is checked on every update ui event.
+ @param win the wx window
+ @param handler a function of 1 param
+ """
+ #is the window visible in the hierarchy
+ def is_wx_window_visible(my_win):
+ while True:
+ parent = my_win.GetParent()
+ if not parent: return True #reached the top of the hierarchy
+ #if we are hidden, then finish, otherwise keep traversing up
+ if isinstance(parent, wx.Notebook) and parent.GetCurrentPage() != my_win: return False
+ my_win = parent
+ #call the handler, the arg is shown or not
+ def handler_factory(my_win, my_handler):
+ def callback(evt):
+ my_handler(is_wx_window_visible(my_win))
+ evt.Skip() #skip so all bound handlers are called
+ return callback
+ handler = handler_factory(win, handler)
+ #bind the handler to all the parent notebooks
+ win.Bind(wx.EVT_UPDATE_UI, handler)
+
+##################################################
+# Helpful Functions
+##################################################
+
+#A macro to apply an index to a key
+index_key = lambda key, i: "%s_%d"%(key, i+1)
+
+def _register_access_method(destination, controller, key):
+ """
+ Helper function for register access methods.
+ This helper creates distinct set and get methods for each key
+ and adds them to the destination object.
+ """
+ def set(value): controller[key] = value
+ setattr(destination, 'set_'+key, set)
+ def get(): return controller[key]
+ setattr(destination, 'get_'+key, get)
+
+def register_access_methods(destination, controller):
+ """
+ Register setter and getter functions in the destination object for all keys in the controller.
+ @param destination the object to get new setter and getter methods
+ @param controller the pubsub controller
+ """
+ for key in controller.keys(): _register_access_method(destination, controller, key)
+
+##################################################
+# Input Watcher Thread
+##################################################
+from gnuradio import gru
+
+class input_watcher(gru.msgq_runner):
+ """
+ Input watcher thread runs forever.
+ Read messages from the message queue.
+ Forward messages to the message handler.
+ """
+ def __init__ (self, msgq, controller, msg_key, arg1_key='', arg2_key=''):
+ self._controller = controller
+ self._msg_key = msg_key
+ self._arg1_key = arg1_key
+ self._arg2_key = arg2_key
+ gru.msgq_runner.__init__(self, msgq, self.handle_msg)
+
+ def handle_msg(self, msg):
+ if self._arg1_key: self._controller[self._arg1_key] = msg.arg1()
+ if self._arg2_key: self._controller[self._arg2_key] = msg.arg2()
+ self._controller[self._msg_key] = msg.to_string()
+
+
+##################################################
+# Shared Functions
+##################################################
+import numpy
+import math
+
+def get_exp(num):
+ """
+ Get the exponent of the number in base 10.
+ @param num the floating point number
+ @return the exponent as an integer
+ """
+ if num == 0: return 0
+ return int(math.floor(math.log10(abs(num))))
+
+def get_clean_num(num):
+ """
+ Get the closest clean number match to num with bases 1, 2, 5.
+ @param num the number
+ @return the closest number
+ """
+ if num == 0: return 0
+ sign = num > 0 and 1 or -1
+ exp = get_exp(num)
+ nums = numpy.array((1, 2, 5, 10))*(10**exp)
+ return sign*nums[numpy.argmin(numpy.abs(nums - abs(num)))]
+
+def get_clean_incr(num):
+ """
+ Get the next higher clean number with bases 1, 2, 5.
+ @param num the number
+ @return the next higher number
+ """
+ num = get_clean_num(num)
+ exp = get_exp(num)
+ coeff = int(round(num/10**exp))
+ return {
+ -5: -2,
+ -2: -1,
+ -1: -.5,
+ 1: 2,
+ 2: 5,
+ 5: 10,
+ }[coeff]*(10**exp)
+
+def get_clean_decr(num):
+ """
+ Get the next lower clean number with bases 1, 2, 5.
+ @param num the number
+ @return the next lower number
+ """
+ num = get_clean_num(num)
+ exp = get_exp(num)
+ coeff = int(round(num/10**exp))
+ return {
+ -5: -10,
+ -2: -5,
+ -1: -2,
+ 1: .5,
+ 2: 1,
+ 5: 2,
+ }[coeff]*(10**exp)
+
+def get_min_max(samples):
+ """
+ Get the minimum and maximum bounds for an array of samples.
+ @param samples the array of real values
+ @return a tuple of min, max
+ """
+ factor = 2.0
+ mean = numpy.average(samples)
+ std = numpy.std(samples)
+ fft = numpy.abs(numpy.fft.fft(samples - mean))
+ envelope = 2*numpy.max(fft)/len(samples)
+ ampl = max(std, envelope) or 0.1
+ return mean - factor*ampl, mean + factor*ampl
+
+def get_min_max_fft(fft_samps):
+ """
+ Get the minimum and maximum bounds for an array of fft samples.
+ @param samples the array of real values
+ @return a tuple of min, max
+ """
+ #get the peak level (max of the samples)
+ peak_level = numpy.max(fft_samps)
+ #separate noise samples
+ noise_samps = numpy.sort(fft_samps)[:len(fft_samps)/2]
+ #get the noise floor
+ noise_floor = numpy.average(noise_samps)
+ #get the noise deviation
+ noise_dev = numpy.std(noise_samps)
+ #determine the maximum and minimum levels
+ max_level = peak_level
+ min_level = noise_floor - abs(2*noise_dev)
+ return min_level, max_level
diff --git a/gr-wxgui/src/python/const_window.py b/gr-wxgui/src/python/const_window.py
new file mode 100644
index 000000000..a7ff2e5f3
--- /dev/null
+++ b/gr-wxgui/src/python/const_window.py
@@ -0,0 +1,207 @@
+#
+# 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.
+#
+
+##################################################
+# Imports
+##################################################
+import plotter
+import common
+import wx
+import numpy
+import math
+import pubsub
+from constants import *
+from gnuradio import gr #for gr.prefs
+import forms
+
+##################################################
+# Constants
+##################################################
+SLIDER_STEPS = 200
+LOOP_BW_MIN_EXP, LOOP_BW_MAX_EXP = -6, 0.0
+GAIN_MU_MIN_EXP, GAIN_MU_MAX_EXP = -6, -0.301
+DEFAULT_FRAME_RATE = gr.prefs().get_long('wxgui', 'const_rate', 5)
+DEFAULT_WIN_SIZE = (500, 400)
+DEFAULT_CONST_SIZE = gr.prefs().get_long('wxgui', 'const_size', 2048)
+CONST_PLOT_COLOR_SPEC = (0, 0, 1)
+MARKER_TYPES = (
+ ('Dot Small', 1.0),
+ ('Dot Medium', 2.0),
+ ('Dot Large', 3.0),
+ ('Line Link', None),
+)
+DEFAULT_MARKER_TYPE = 2.0
+
+##################################################
+# Constellation window control panel
+##################################################
+class control_panel(wx.Panel):
+ """
+ A control panel with wx widgits to control the plotter.
+ """
+ def __init__(self, parent):
+ """
+ Create a new control panel.
+ @param parent the wx parent window
+ """
+ self.parent = parent
+ wx.Panel.__init__(self, parent, style=wx.SUNKEN_BORDER)
+ parent[SHOW_CONTROL_PANEL_KEY] = True
+ parent.subscribe(SHOW_CONTROL_PANEL_KEY, self.Show)
+ control_box = forms.static_box_sizer(
+ parent=self, label='Options',
+ bold=True, orient=wx.VERTICAL,
+ )
+ #loop_bw
+ control_box.AddStretchSpacer()
+ forms.text_box(
+ sizer=control_box, parent=self, label='Loop Bandwidth',
+ converter=forms.float_converter(),
+ ps=parent, key=LOOP_BW_KEY,
+ )
+ forms.log_slider(
+ sizer=control_box, parent=self,
+ min_exp=LOOP_BW_MIN_EXP,
+ max_exp=LOOP_BW_MAX_EXP,
+ num_steps=SLIDER_STEPS,
+ ps=parent, key=LOOP_BW_KEY,
+ )
+ #gain_mu
+ control_box.AddStretchSpacer()
+ forms.text_box(
+ sizer=control_box, parent=self, label='Gain Mu',
+ converter=forms.float_converter(),
+ ps=parent, key=GAIN_MU_KEY,
+ )
+ forms.log_slider(
+ sizer=control_box, parent=self,
+ min_exp=GAIN_MU_MIN_EXP,
+ max_exp=GAIN_MU_MAX_EXP,
+ num_steps=SLIDER_STEPS,
+ ps=parent, key=GAIN_MU_KEY,
+ )
+ #marker
+ control_box.AddStretchSpacer()
+ forms.drop_down(
+ sizer=control_box, parent=self,
+ ps=parent, key=MARKER_KEY, label='Marker',
+ choices=map(lambda x: x[1], MARKER_TYPES),
+ labels=map(lambda x: x[0], MARKER_TYPES),
+ )
+ #run/stop
+ control_box.AddStretchSpacer()
+ forms.toggle_button(
+ sizer=control_box, parent=self,
+ true_label='Stop', false_label='Run',
+ ps=parent, key=RUNNING_KEY,
+ )
+ #set sizer
+ self.SetSizerAndFit(control_box)
+
+##################################################
+# Constellation window with plotter and control panel
+##################################################
+class const_window(wx.Panel, pubsub.pubsub):
+ def __init__(
+ self,
+ parent,
+ controller,
+ size,
+ title,
+ msg_key,
+ loop_bw_key,
+ gain_mu_key,
+ gain_omega_key,
+ omega_key,
+ sample_rate_key,
+ ):
+ pubsub.pubsub.__init__(self)
+ #proxy the keys
+ self.proxy(MSG_KEY, controller, msg_key)
+ self.proxy(LOOP_BW_KEY, controller, loop_bw_key)
+ self.proxy(GAIN_MU_KEY, controller, gain_mu_key)
+ self.proxy(GAIN_OMEGA_KEY, controller, gain_omega_key)
+ self.proxy(OMEGA_KEY, controller, omega_key)
+ self.proxy(SAMPLE_RATE_KEY, controller, sample_rate_key)
+ #initialize values
+ self[RUNNING_KEY] = True
+ self[X_DIVS_KEY] = 8
+ self[Y_DIVS_KEY] = 8
+ self[MARKER_KEY] = DEFAULT_MARKER_TYPE
+ #init panel and plot
+ wx.Panel.__init__(self, parent, style=wx.SIMPLE_BORDER)
+ self.plotter = plotter.channel_plotter(self)
+ self.plotter.SetSize(wx.Size(*size))
+ self.plotter.SetSizeHints(*size)
+ self.plotter.set_title(title)
+ self.plotter.set_x_label('Inphase')
+ self.plotter.set_y_label('Quadrature')
+ self.plotter.enable_point_label(True)
+ self.plotter.enable_grid_lines(True)
+ #setup the box with plot and controls
+ self.control_panel = control_panel(self)
+ main_box = wx.BoxSizer(wx.HORIZONTAL)
+ main_box.Add(self.plotter, 1, wx.EXPAND)
+ main_box.Add(self.control_panel, 0, wx.EXPAND)
+ self.SetSizerAndFit(main_box)
+ #alpha and gain mu 2nd orders
+ def set_gain_omega(gain_mu): self[GAIN_OMEGA_KEY] = .25*gain_mu**2
+ self.subscribe(GAIN_MU_KEY, set_gain_omega)
+ #register events
+ self.subscribe(MSG_KEY, self.handle_msg)
+ self.subscribe(X_DIVS_KEY, self.update_grid)
+ self.subscribe(Y_DIVS_KEY, self.update_grid)
+ #initial update
+ self.update_grid()
+
+ def handle_msg(self, msg):
+ """
+ Plot the samples onto the complex grid.
+ @param msg the array of complex samples
+ """
+ if not self[RUNNING_KEY]: return
+ #convert to complex floating point numbers
+ samples = numpy.fromstring(msg, numpy.complex64)
+ real = numpy.real(samples)
+ imag = numpy.imag(samples)
+ #plot
+ self.plotter.set_waveform(
+ channel=0,
+ samples=(real, imag),
+ color_spec=CONST_PLOT_COLOR_SPEC,
+ marker=self[MARKER_KEY],
+ )
+ #update the plotter
+ self.plotter.update()
+
+ def update_grid(self):
+ #update the x axis
+ x_max = 2.0
+ self.plotter.set_x_grid(-x_max, x_max, common.get_clean_num(2.0*x_max/self[X_DIVS_KEY]))
+ #update the y axis
+ y_max = 2.0
+ self.plotter.set_y_grid(-y_max, y_max, common.get_clean_num(2.0*y_max/self[Y_DIVS_KEY]))
+ #update plotter
+ self.plotter.update()
+
+
+
+
diff --git a/gr-wxgui/src/python/constants.py b/gr-wxgui/src/python/constants.py
new file mode 100644
index 000000000..08cc6a634
--- /dev/null
+++ b/gr-wxgui/src/python/constants.py
@@ -0,0 +1,76 @@
+#
+# 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.
+#
+
+##################################################
+# Controller Keys
+##################################################
+AC_COUPLE_KEY = 'ac_couple'
+ALPHA_KEY = 'alpha'
+AUTORANGE_KEY = 'autorange'
+AVERAGE_KEY = 'average'
+AVG_ALPHA_KEY = 'avg_alpha'
+USE_PERSISTENCE_KEY = 'use_persistence'
+PERSIST_ALPHA_KEY = 'persist_alpha'
+BASEBAND_FREQ_KEY = 'baseband_freq'
+BETA_KEY = 'beta'
+COLOR_MODE_KEY = 'color_mode'
+DECIMATION_KEY = 'decimation'
+DYNAMIC_RANGE_KEY = 'dynamic_range'
+FRAME_RATE_KEY = 'frame_rate'
+GAIN_MU_KEY = 'gain_mu'
+GAIN_OMEGA_KEY = 'gain_omega'
+MARKER_KEY = 'marker'
+XY_MARKER_KEY = 'xy_marker'
+MSG_KEY = 'msg'
+NUM_LINES_KEY = 'num_lines'
+OMEGA_KEY = 'omega'
+PEAK_HOLD_KEY = 'peak_hold'
+TRACE_STORE_KEY = 'trace_store'
+TRACE_SHOW_KEY = 'trace_show'
+REF_LEVEL_KEY = 'ref_level'
+RUNNING_KEY = 'running'
+SAMPLE_RATE_KEY = 'sample_rate'
+TRIGGER_CHANNEL_KEY = 'trigger_channel'
+TRIGGER_LEVEL_KEY = 'trigger_level'
+TRIGGER_MODE_KEY = 'trigger_mode'
+TRIGGER_SLOPE_KEY = 'trigger_slope'
+TRIGGER_SHOW_KEY = 'trigger_show'
+XY_MODE_KEY = 'xy_mode'
+X_CHANNEL_KEY = 'x_channel'
+Y_CHANNEL_KEY = 'y_channel'
+T_FRAC_OFF_KEY = 't_frac_off'
+T_DIVS_KEY = 't_divs'
+T_OFF_KEY = 't_off'
+T_PER_DIV_KEY = 't_per_div'
+X_DIVS_KEY = 'x_divs'
+X_OFF_KEY = 'x_off'
+X_PER_DIV_KEY = 'x_per_div'
+Y_DIVS_KEY = 'y_divs'
+Y_OFF_KEY = 'y_off'
+Y_PER_DIV_KEY = 'y_per_div'
+Y_AXIS_LABEL = 'y_axis_label'
+MAXIMUM_KEY = 'maximum'
+MINIMUM_KEY = 'minimum'
+NUM_BINS_KEY = 'num_bins'
+FRAME_SIZE_KEY = 'frame_size'
+CHANNEL_OPTIONS_KEY = 'channel_options'
+SHOW_CONTROL_PANEL_KEY = 'show_control_panel'
+LOOP_BW_KEY = 'loop_bw'
diff --git a/gr-wxgui/src/python/constsink_gl.py b/gr-wxgui/src/python/constsink_gl.py
new file mode 100644
index 000000000..51434df68
--- /dev/null
+++ b/gr-wxgui/src/python/constsink_gl.py
@@ -0,0 +1,140 @@
+#
+# 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.
+#
+
+##################################################
+# Imports
+##################################################
+import const_window
+import common
+from gnuradio import gr, blks2
+from pubsub import pubsub
+from constants import *
+import sys
+try:
+ from gnuradio import digital
+except ImportError:
+ sys.stderr.write("Error: could not import gnuradio.digital, please install gr-digitial.\n")
+ sys.exit(1)
+
+##################################################
+# Constellation sink block (wrapper for old wxgui)
+##################################################
+class const_sink_c(gr.hier_block2, common.wxgui_hb):
+ """
+ A constellation block with a gui window.
+ """
+
+ def __init__(
+ self,
+ parent,
+ title='',
+ sample_rate=1,
+ size=const_window.DEFAULT_WIN_SIZE,
+ frame_rate=const_window.DEFAULT_FRAME_RATE,
+ const_size=const_window.DEFAULT_CONST_SIZE,
+ #mpsk recv params
+ M=4,
+ theta=0,
+ loop_bw=6.28/100.0,
+ fmax=0.06,
+ mu=0.5,
+ gain_mu=0.005,
+ symbol_rate=1,
+ omega_limit=0.005,
+ ):
+ #init
+ gr.hier_block2.__init__(
+ self,
+ "const_sink",
+ gr.io_signature(1, 1, gr.sizeof_gr_complex),
+ gr.io_signature(0, 0, 0),
+ )
+ #blocks
+ sd = blks2.stream_to_vector_decimator(
+ item_size=gr.sizeof_gr_complex,
+ sample_rate=sample_rate,
+ vec_rate=frame_rate,
+ vec_len=const_size,
+ )
+ fmin = -fmax
+ gain_omega = .25*gain_mu**2 #redundant, will be updated
+ omega = 1 #set_sample_rate will update this
+ # Costas frequency/phase recovery loop
+ # Critically damped 2nd order PLL
+ self._costas = digital.costas_loop_cc(loop_bw, M)
+ # Timing recovery loop
+ # Critically damped 2nd order DLL
+ self._retime = digital.clock_recovery_mm_cc(omega,
+ gain_omega,
+ mu, gain_mu,
+ omega_limit)
+ #sync = gr.mpsk_receiver_cc(
+ # M, #psk order
+ # theta,
+ # alpha,
+ # beta,
+ # fmin,
+ # fmax,
+ # mu,
+ # gain_mu,
+ # omega,
+ # gain_omega,
+ # omega_limit,
+ #)
+ agc = gr.feedforward_agc_cc(16, 1)
+ msgq = gr.msg_queue(2)
+ sink = gr.message_sink(gr.sizeof_gr_complex*const_size, msgq, True)
+ #controller
+ def setter(p, k, x): p[k] = x
+ self.controller = pubsub()
+ self.controller.subscribe(LOOP_BW_KEY, self._costas.set_loop_bandwidth)
+ self.controller.publish(LOOP_BW_KEY, self._costas.get_loop_bandwidth)
+ self.controller.subscribe(GAIN_MU_KEY, self._retime.set_gain_mu)
+ self.controller.publish(GAIN_MU_KEY, self._retime.gain_mu)
+ self.controller.subscribe(OMEGA_KEY, self._retime.set_omega)
+ self.controller.publish(OMEGA_KEY, self._retime.omega)
+ self.controller.subscribe(GAIN_OMEGA_KEY, self._retime.set_gain_omega)
+ self.controller.publish(GAIN_OMEGA_KEY, self._retime.gain_omega)
+ self.controller.subscribe(SAMPLE_RATE_KEY, sd.set_sample_rate)
+ self.controller.subscribe(SAMPLE_RATE_KEY, lambda x: setter(self.controller, OMEGA_KEY, float(x)/symbol_rate))
+ self.controller.publish(SAMPLE_RATE_KEY, sd.sample_rate)
+ #initial update
+ self.controller[SAMPLE_RATE_KEY] = sample_rate
+ #start input watcher
+ common.input_watcher(msgq, self.controller, MSG_KEY)
+ #create window
+ self.win = const_window.const_window(
+ parent=parent,
+ controller=self.controller,
+ size=size,
+ title=title,
+ msg_key=MSG_KEY,
+ loop_bw_key=LOOP_BW_KEY,
+ gain_mu_key=GAIN_MU_KEY,
+ gain_omega_key=GAIN_OMEGA_KEY,
+ omega_key=OMEGA_KEY,
+ sample_rate_key=SAMPLE_RATE_KEY,
+ )
+ common.register_access_methods(self, self.win)
+ #connect
+ self.wxgui_connect(self, self._costas, self._retime, agc, sd, sink)
+
+
diff --git a/gr-wxgui/src/python/fft_window.py b/gr-wxgui/src/python/fft_window.py
new file mode 100644
index 000000000..cf21b893a
--- /dev/null
+++ b/gr-wxgui/src/python/fft_window.py
@@ -0,0 +1,408 @@
+#
+# Copyright 2008, 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.
+#
+
+##################################################
+# Imports
+##################################################
+import plotter
+import common
+import wx
+import numpy
+import math
+import pubsub
+from constants import *
+from gnuradio import gr #for gr.prefs
+import forms
+
+##################################################
+# Constants
+##################################################
+SLIDER_STEPS = 100
+AVG_ALPHA_MIN_EXP, AVG_ALPHA_MAX_EXP = -3, 0
+PERSIST_ALPHA_MIN_EXP, PERSIST_ALPHA_MAX_EXP = -2, 0
+DEFAULT_WIN_SIZE = (600, 300)
+DEFAULT_FRAME_RATE = gr.prefs().get_long('wxgui', 'fft_rate', 30)
+DB_DIV_MIN, DB_DIV_MAX = 1, 20
+FFT_PLOT_COLOR_SPEC = (0.3, 0.3, 1.0)
+PEAK_VALS_COLOR_SPEC = (0.0, 0.8, 0.0)
+EMPTY_TRACE = list()
+TRACES = ('A', 'B')
+TRACES_COLOR_SPEC = {
+ 'A': (1.0, 0.0, 0.0),
+ 'B': (0.8, 0.0, 0.8),
+}
+
+##################################################
+# FFT window control panel
+##################################################
+class control_panel(wx.Panel):
+ """
+ A control panel with wx widgits to control the plotter and fft block chain.
+ """
+
+ def __init__(self, parent):
+ """
+ Create a new control panel.
+ @param parent the wx parent window
+ """
+ self.parent = parent
+ wx.Panel.__init__(self, parent, style=wx.SUNKEN_BORDER)
+ parent[SHOW_CONTROL_PANEL_KEY] = True
+ parent.subscribe(SHOW_CONTROL_PANEL_KEY, self.Show)
+ control_box = wx.BoxSizer(wx.VERTICAL)
+ control_box.AddStretchSpacer()
+ #checkboxes for average and peak hold
+ options_box = forms.static_box_sizer(
+ parent=self, sizer=control_box, label='Trace Options',
+ bold=True, orient=wx.VERTICAL,
+ )
+ forms.check_box(
+ sizer=options_box, parent=self, label='Peak Hold',
+ ps=parent, key=PEAK_HOLD_KEY,
+ )
+ forms.check_box(
+ sizer=options_box, parent=self, label='Average',
+ ps=parent, key=AVERAGE_KEY,
+ )
+ #static text and slider for averaging
+ avg_alpha_text = forms.static_text(
+ sizer=options_box, parent=self, label='Avg Alpha',
+ converter=forms.float_converter(lambda x: '%.4f'%x),
+ ps=parent, key=AVG_ALPHA_KEY, width=50,
+ )
+ avg_alpha_slider = forms.log_slider(
+ sizer=options_box, parent=self,
+ min_exp=AVG_ALPHA_MIN_EXP,
+ max_exp=AVG_ALPHA_MAX_EXP,
+ num_steps=SLIDER_STEPS,
+ ps=parent, key=AVG_ALPHA_KEY,
+ )
+ for widget in (avg_alpha_text, avg_alpha_slider):
+ parent.subscribe(AVERAGE_KEY, widget.Enable)
+ widget.Enable(parent[AVERAGE_KEY])
+ parent.subscribe(AVERAGE_KEY, widget.ShowItems)
+ #allways show initially, so room is reserved for them
+ widget.ShowItems(True) # (parent[AVERAGE_KEY])
+
+ parent.subscribe(AVERAGE_KEY, self._update_layout)
+
+ forms.check_box(
+ sizer=options_box, parent=self, label='Persistence',
+ ps=parent, key=USE_PERSISTENCE_KEY,
+ )
+ #static text and slider for persist alpha
+ persist_alpha_text = forms.static_text(
+ sizer=options_box, parent=self, label='Persist Alpha',
+ converter=forms.float_converter(lambda x: '%.4f'%x),
+ ps=parent, key=PERSIST_ALPHA_KEY, width=50,
+ )
+ persist_alpha_slider = forms.log_slider(
+ sizer=options_box, parent=self,
+ min_exp=PERSIST_ALPHA_MIN_EXP,
+ max_exp=PERSIST_ALPHA_MAX_EXP,
+ num_steps=SLIDER_STEPS,
+ ps=parent, key=PERSIST_ALPHA_KEY,
+ )
+ for widget in (persist_alpha_text, persist_alpha_slider):
+ parent.subscribe(USE_PERSISTENCE_KEY, widget.Enable)
+ widget.Enable(parent[USE_PERSISTENCE_KEY])
+ parent.subscribe(USE_PERSISTENCE_KEY, widget.ShowItems)
+ #allways show initially, so room is reserved for them
+ widget.ShowItems(True) # (parent[USE_PERSISTENCE_KEY])
+
+ parent.subscribe(USE_PERSISTENCE_KEY, self._update_layout)
+
+ #trace menu
+ for trace in TRACES:
+ trace_box = wx.BoxSizer(wx.HORIZONTAL)
+ options_box.Add(trace_box, 0, wx.EXPAND)
+ forms.check_box(
+ sizer=trace_box, parent=self,
+ ps=parent, key=TRACE_SHOW_KEY+trace,
+ label='Trace %s'%trace,
+ )
+ trace_box.AddSpacer(10)
+ forms.single_button(
+ sizer=trace_box, parent=self,
+ ps=parent, key=TRACE_STORE_KEY+trace,
+ label='Store', style=wx.BU_EXACTFIT,
+ )
+ trace_box.AddSpacer(10)
+ #radio buttons for div size
+ control_box.AddStretchSpacer()
+ y_ctrl_box = forms.static_box_sizer(
+ parent=self, sizer=control_box, label='Axis Options',
+ bold=True, orient=wx.VERTICAL,
+ )
+ forms.incr_decr_buttons(
+ parent=self, sizer=y_ctrl_box, label='dB/Div',
+ on_incr=self._on_incr_db_div, on_decr=self._on_decr_db_div,
+ )
+ #ref lvl buttons
+ forms.incr_decr_buttons(
+ parent=self, sizer=y_ctrl_box, label='Ref Level',
+ on_incr=self._on_incr_ref_level, on_decr=self._on_decr_ref_level,
+ )
+ y_ctrl_box.AddSpacer(2)
+ #autoscale
+ forms.single_button(
+ sizer=y_ctrl_box, parent=self, label='Autoscale',
+ callback=self.parent.autoscale,
+ )
+ #run/stop
+ control_box.AddStretchSpacer()
+ forms.toggle_button(
+ sizer=control_box, parent=self,
+ true_label='Stop', false_label='Run',
+ ps=parent, key=RUNNING_KEY,
+ )
+ #set sizer
+ self.SetSizerAndFit(control_box)
+
+ #mouse wheel event
+ def on_mouse_wheel(event):
+ if event.GetWheelRotation() < 0: self._on_incr_ref_level(event)
+ else: self._on_decr_ref_level(event)
+ parent.plotter.Bind(wx.EVT_MOUSEWHEEL, on_mouse_wheel)
+
+ ##################################################
+ # Event handlers
+ ##################################################
+ def _on_incr_ref_level(self, event):
+ self.parent[REF_LEVEL_KEY] = self.parent[REF_LEVEL_KEY] + self.parent[Y_PER_DIV_KEY]
+ def _on_decr_ref_level(self, event):
+ self.parent[REF_LEVEL_KEY] = self.parent[REF_LEVEL_KEY] - self.parent[Y_PER_DIV_KEY]
+ def _on_incr_db_div(self, event):
+ self.parent[Y_PER_DIV_KEY] = min(DB_DIV_MAX, common.get_clean_incr(self.parent[Y_PER_DIV_KEY]))
+ def _on_decr_db_div(self, event):
+ self.parent[Y_PER_DIV_KEY] = max(DB_DIV_MIN, common.get_clean_decr(self.parent[Y_PER_DIV_KEY]))
+ ##################################################
+ # subscriber handlers
+ ##################################################
+ def _update_layout(self,key):
+ # Just ignore the key value we get
+ # we only need to now that the visability or size of something has changed
+ self.parent.Layout()
+ #self.parent.Fit()
+
+##################################################
+# FFT window with plotter and control panel
+##################################################
+class fft_window(wx.Panel, pubsub.pubsub):
+ def __init__(
+ self,
+ parent,
+ controller,
+ size,
+ title,
+ real,
+ fft_size,
+ baseband_freq,
+ sample_rate_key,
+ y_per_div,
+ y_divs,
+ ref_level,
+ average_key,
+ avg_alpha_key,
+ peak_hold,
+ msg_key,
+ use_persistence,
+ persist_alpha,
+ ):
+
+ pubsub.pubsub.__init__(self)
+ #setup
+ self.samples = EMPTY_TRACE
+ self.real = real
+ self.fft_size = fft_size
+ self._reset_peak_vals()
+ self._traces = dict()
+ #proxy the keys
+ self.proxy(MSG_KEY, controller, msg_key)
+ self.proxy(AVERAGE_KEY, controller, average_key)
+ self.proxy(AVG_ALPHA_KEY, controller, avg_alpha_key)
+ self.proxy(SAMPLE_RATE_KEY, controller, sample_rate_key)
+ #initialize values
+ self[PEAK_HOLD_KEY] = peak_hold
+ self[Y_PER_DIV_KEY] = y_per_div
+ self[Y_DIVS_KEY] = y_divs
+ self[X_DIVS_KEY] = 8 #approximate
+ self[REF_LEVEL_KEY] = ref_level
+ self[BASEBAND_FREQ_KEY] = baseband_freq
+ self[RUNNING_KEY] = True
+ self[USE_PERSISTENCE_KEY] = use_persistence
+ self[PERSIST_ALPHA_KEY] = persist_alpha
+ for trace in TRACES:
+ #a function that returns a function
+ #so the function wont use local trace
+ def new_store_trace(my_trace):
+ def store_trace(*args):
+ self._traces[my_trace] = self.samples
+ self.update_grid()
+ return store_trace
+ def new_toggle_trace(my_trace):
+ def toggle_trace(toggle):
+ #do an automatic store if toggled on and empty trace
+ if toggle and not len(self._traces[my_trace]):
+ self._traces[my_trace] = self.samples
+ self.update_grid()
+ return toggle_trace
+ self._traces[trace] = EMPTY_TRACE
+ self[TRACE_STORE_KEY+trace] = False
+ self[TRACE_SHOW_KEY+trace] = False
+ self.subscribe(TRACE_STORE_KEY+trace, new_store_trace(trace))
+ self.subscribe(TRACE_SHOW_KEY+trace, new_toggle_trace(trace))
+ #init panel and plot
+ wx.Panel.__init__(self, parent, style=wx.SIMPLE_BORDER)
+ self.plotter = plotter.channel_plotter(self)
+ self.plotter.SetSize(wx.Size(*size))
+ self.plotter.SetSizeHints(*size)
+ self.plotter.set_title(title)
+ self.plotter.enable_legend(True)
+ self.plotter.enable_point_label(True)
+ self.plotter.enable_grid_lines(True)
+ self.plotter.set_use_persistence(use_persistence)
+ self.plotter.set_persist_alpha(persist_alpha)
+ #setup the box with plot and controls
+ self.control_panel = control_panel(self)
+ main_box = wx.BoxSizer(wx.HORIZONTAL)
+ main_box.Add(self.plotter, 1, wx.EXPAND)
+ main_box.Add(self.control_panel, 0, wx.EXPAND)
+ self.SetSizerAndFit(main_box)
+ #register events
+ self.subscribe(AVERAGE_KEY, self._reset_peak_vals)
+ self.subscribe(MSG_KEY, self.handle_msg)
+ self.subscribe(SAMPLE_RATE_KEY, self.update_grid)
+ for key in (
+ BASEBAND_FREQ_KEY,
+ Y_PER_DIV_KEY, X_DIVS_KEY,
+ Y_DIVS_KEY, REF_LEVEL_KEY,
+ ): self.subscribe(key, self.update_grid)
+ self.subscribe(USE_PERSISTENCE_KEY, self.plotter.set_use_persistence)
+ self.subscribe(PERSIST_ALPHA_KEY, self.plotter.set_persist_alpha)
+ #initial update
+ self.update_grid()
+
+ def set_callback(self,callb):
+ self.plotter.set_callback(callb)
+
+ def autoscale(self, *args):
+ """
+ Autoscale the fft plot to the last frame.
+ Set the dynamic range and reference level.
+ """
+ if not len(self.samples): return
+ min_level, max_level = common.get_min_max_fft(self.samples)
+ #set the range to a clean number of the dynamic range
+ self[Y_PER_DIV_KEY] = common.get_clean_num(1+(max_level - min_level)/self[Y_DIVS_KEY])
+ #set the reference level to a multiple of y per div
+ self[REF_LEVEL_KEY] = self[Y_PER_DIV_KEY]*round(.5+max_level/self[Y_PER_DIV_KEY])
+
+ def _reset_peak_vals(self, *args): self.peak_vals = EMPTY_TRACE
+
+ def handle_msg(self, msg):
+ """
+ Handle the message from the fft sink message queue.
+ If complex, reorder the fft samples so the negative bins come first.
+ If real, keep take only the positive bins.
+ Plot the samples onto the grid as channel 1.
+ If peak hold is enabled, plot peak vals as channel 2.
+ @param msg the fft array as a character array
+ """
+ if not self[RUNNING_KEY]: return
+ #convert to floating point numbers
+ samples = numpy.fromstring(msg, numpy.float32)[:self.fft_size] #only take first frame
+ num_samps = len(samples)
+ #reorder fft
+ if self.real: samples = samples[:(num_samps+1)/2]
+ else: samples = numpy.concatenate((samples[num_samps/2+1:], samples[:(num_samps+1)/2]))
+ self.samples = samples
+ #peak hold calculation
+ if self[PEAK_HOLD_KEY]:
+ if len(self.peak_vals) != len(samples): self.peak_vals = samples
+ self.peak_vals = numpy.maximum(samples, self.peak_vals)
+ #plot the peak hold
+ self.plotter.set_waveform(
+ channel='Peak',
+ samples=self.peak_vals,
+ color_spec=PEAK_VALS_COLOR_SPEC,
+ )
+ else:
+ self._reset_peak_vals()
+ self.plotter.clear_waveform(channel='Peak')
+ #plot the fft
+ self.plotter.set_waveform(
+ channel='FFT',
+ samples=samples,
+ color_spec=FFT_PLOT_COLOR_SPEC,
+ )
+ #update the plotter
+ self.plotter.update()
+
+ def update_grid(self, *args):
+ """
+ Update the plotter grid.
+ This update method is dependent on the variables below.
+ Determine the x and y axis grid parameters.
+ The x axis depends on sample rate, baseband freq, and x divs.
+ The y axis depends on y per div, y divs, and ref level.
+ """
+ for trace in TRACES:
+ channel = '%s'%trace.upper()
+ if self[TRACE_SHOW_KEY+trace]:
+ self.plotter.set_waveform(
+ channel=channel,
+ samples=self._traces[trace],
+ color_spec=TRACES_COLOR_SPEC[trace],
+ )
+ else: self.plotter.clear_waveform(channel=channel)
+ #grid parameters
+ sample_rate = self[SAMPLE_RATE_KEY]
+ baseband_freq = self[BASEBAND_FREQ_KEY]
+ y_per_div = self[Y_PER_DIV_KEY]
+ y_divs = self[Y_DIVS_KEY]
+ x_divs = self[X_DIVS_KEY]
+ ref_level = self[REF_LEVEL_KEY]
+ #determine best fitting x_per_div
+ if self.real: x_width = sample_rate/2.0
+ else: x_width = sample_rate/1.0
+ x_per_div = common.get_clean_num(x_width/x_divs)
+ #update the x grid
+ if self.real:
+ self.plotter.set_x_grid(
+ baseband_freq,
+ baseband_freq + sample_rate/2.0,
+ x_per_div, True,
+ )
+ else:
+ self.plotter.set_x_grid(
+ baseband_freq - sample_rate/2.0,
+ baseband_freq + sample_rate/2.0,
+ x_per_div, True,
+ )
+ #update x units
+ self.plotter.set_x_label('Frequency', 'Hz')
+ #update y grid
+ self.plotter.set_y_grid(ref_level-y_per_div*y_divs, ref_level, y_per_div)
+ #update y units
+ self.plotter.set_y_label('Amplitude', 'dB')
+ #update plotter
+ self.plotter.update()
diff --git a/gr-wxgui/src/python/fftsink2.py b/gr-wxgui/src/python/fftsink2.py
new file mode 100644
index 000000000..3277cd3ff
--- /dev/null
+++ b/gr-wxgui/src/python/fftsink2.py
@@ -0,0 +1,41 @@
+#
+# Copyright 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 gnuradio import gr
+
+p = gr.prefs()
+style = p.get_string('wxgui', 'style', 'auto')
+
+if style == 'auto' or style == 'gl':
+ try:
+ import wx.glcanvas
+ from OpenGL.GL import *
+ from fftsink_gl import fft_sink_f, fft_sink_c
+ except ImportError:
+ if style == 'gl':
+ raise RuntimeError("Unable to import OpenGL. Are Python wrappers for OpenGL installed?")
+ else:
+ # Fall backto non-gl sinks
+ from fftsink_nongl import fft_sink_f, fft_sink_c
+elif style == 'nongl':
+ from fftsink_nongl import fft_sink_f, fft_sink_c
+else:
+ raise RuntimeError("Unknown wxgui style")
diff --git a/gr-wxgui/src/python/fftsink_gl.py b/gr-wxgui/src/python/fftsink_gl.py
new file mode 100644
index 000000000..dc31e84a1
--- /dev/null
+++ b/gr-wxgui/src/python/fftsink_gl.py
@@ -0,0 +1,201 @@
+#
+# Copyright 2008,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.
+#
+
+from __future__ import division
+
+##################################################
+# Imports
+##################################################
+import fft_window
+import common
+from gnuradio import gr, blks2
+from pubsub import pubsub
+from constants import *
+import math
+
+##################################################
+# FFT sink block (wrapper for old wxgui)
+##################################################
+class _fft_sink_base(gr.hier_block2, common.wxgui_hb):
+ """
+ An fft block with real/complex inputs and a gui window.
+ """
+
+ def __init__(
+ self,
+ parent,
+ baseband_freq=0,
+ ref_scale=2.0,
+ y_per_div=10,
+ y_divs=8,
+ ref_level=50,
+ sample_rate=1,
+ fft_size=512,
+ fft_rate=fft_window.DEFAULT_FRAME_RATE,
+ average=False,
+ avg_alpha=None,
+ title='',
+ size=fft_window.DEFAULT_WIN_SIZE,
+ peak_hold=False,
+ win=None,
+ use_persistence=False,
+ persist_alpha=None,
+ **kwargs #do not end with a comma
+ ):
+ #ensure avg alpha
+ if avg_alpha is None: avg_alpha = 2.0/fft_rate
+ #ensure analog alpha
+ if persist_alpha is None:
+ actual_fft_rate=float(sample_rate/fft_size)/float(max(1,int(float((sample_rate/fft_size)/fft_rate))))
+ #print "requested_fft_rate ",fft_rate
+ #print "actual_fft_rate ",actual_fft_rate
+ analog_cutoff_freq=0.5 # Hertz
+ #calculate alpha from wanted cutoff freq
+ persist_alpha = 1.0 - math.exp(-2.0*math.pi*analog_cutoff_freq/actual_fft_rate)
+
+ #init
+ gr.hier_block2.__init__(
+ self,
+ "fft_sink",
+ gr.io_signature(1, 1, self._item_size),
+ gr.io_signature(0, 0, 0),
+ )
+ #blocks
+ fft = self._fft_chain(
+ sample_rate=sample_rate,
+ fft_size=fft_size,
+ frame_rate=fft_rate,
+ ref_scale=ref_scale,
+ avg_alpha=avg_alpha,
+ average=average,
+ win=win,
+ )
+ msgq = gr.msg_queue(2)
+ sink = gr.message_sink(gr.sizeof_float*fft_size, msgq, True)
+
+
+ #controller
+ self.controller = pubsub()
+ self.controller.subscribe(AVERAGE_KEY, fft.set_average)
+ self.controller.publish(AVERAGE_KEY, fft.average)
+ self.controller.subscribe(AVG_ALPHA_KEY, fft.set_avg_alpha)
+ self.controller.publish(AVG_ALPHA_KEY, fft.avg_alpha)
+ self.controller.subscribe(SAMPLE_RATE_KEY, fft.set_sample_rate)
+ self.controller.publish(SAMPLE_RATE_KEY, fft.sample_rate)
+ #start input watcher
+ common.input_watcher(msgq, self.controller, MSG_KEY)
+ #create window
+ self.win = fft_window.fft_window(
+ parent=parent,
+ controller=self.controller,
+ size=size,
+ title=title,
+ real=self._real,
+ fft_size=fft_size,
+ baseband_freq=baseband_freq,
+ sample_rate_key=SAMPLE_RATE_KEY,
+ y_per_div=y_per_div,
+ y_divs=y_divs,
+ ref_level=ref_level,
+ average_key=AVERAGE_KEY,
+ avg_alpha_key=AVG_ALPHA_KEY,
+ peak_hold=peak_hold,
+ msg_key=MSG_KEY,
+ use_persistence=use_persistence,
+ persist_alpha=persist_alpha,
+ )
+ common.register_access_methods(self, self.win)
+ setattr(self.win, 'set_baseband_freq', getattr(self, 'set_baseband_freq')) #BACKWARDS
+ setattr(self.win, 'set_peak_hold', getattr(self, 'set_peak_hold')) #BACKWARDS
+ #connect
+ self.wxgui_connect(self, fft, sink)
+
+ def set_callback(self,callb):
+ self.win.set_callback(callb)
+
+class fft_sink_f(_fft_sink_base):
+ _fft_chain = blks2.logpwrfft_f
+ _item_size = gr.sizeof_float
+ _real = True
+
+class fft_sink_c(_fft_sink_base):
+ _fft_chain = blks2.logpwrfft_c
+ _item_size = gr.sizeof_gr_complex
+ _real = False
+
+# ----------------------------------------------------------------
+# Standalone test app
+# ----------------------------------------------------------------
+
+import wx
+from gnuradio.wxgui import stdgui2
+
+class test_app_block (stdgui2.std_top_block):
+ def __init__(self, frame, panel, vbox, argv):
+ stdgui2.std_top_block.__init__ (self, frame, panel, vbox, argv)
+
+ fft_size = 256
+
+ # build our flow graph
+ input_rate = 2048.0e3
+
+ #Generate some noise
+ noise =gr.noise_source_c(gr.GR_UNIFORM, 1.0/10)
+
+ # Generate a complex sinusoid
+ #src1 = gr.sig_source_c (input_rate, gr.GR_SIN_WAVE, 2e3, 1)
+ src1 = gr.sig_source_c (input_rate, gr.GR_CONST_WAVE, 57.50e3, 1)
+
+ # We add these throttle blocks so that this demo doesn't
+ # suck down all the CPU available. Normally you wouldn't use these.
+ thr1 = gr.throttle(gr.sizeof_gr_complex, input_rate)
+
+ sink1 = fft_sink_c (panel, title="Complex Data", fft_size=fft_size,
+ sample_rate=input_rate, baseband_freq=100e3,
+ ref_level=0, y_per_div=20, y_divs=10)
+ vbox.Add (sink1.win, 1, wx.EXPAND)
+
+ combine1=gr.add_cc()
+ self.connect(src1, (combine1,0))
+ self.connect(noise,(combine1,1))
+ self.connect(combine1,thr1, sink1)
+
+ #src2 = gr.sig_source_f (input_rate, gr.GR_SIN_WAVE, 2e3, 1)
+ src2 = gr.sig_source_f (input_rate, gr.GR_CONST_WAVE, 57.50e3, 1)
+ thr2 = gr.throttle(gr.sizeof_float, input_rate)
+ sink2 = fft_sink_f (panel, title="Real Data", fft_size=fft_size*2,
+ sample_rate=input_rate, baseband_freq=100e3,
+ ref_level=0, y_per_div=20, y_divs=10)
+ vbox.Add (sink2.win, 1, wx.EXPAND)
+
+ combine2=gr.add_ff()
+ c2f2=gr.complex_to_float()
+
+ self.connect(src2, (combine2,0))
+ self.connect(noise,c2f2,(combine2,1))
+ self.connect(combine2, thr2,sink2)
+
+def main ():
+ app = stdgui2.stdapp (test_app_block, "FFT Sink Test App")
+ app.MainLoop ()
+
+if __name__ == '__main__':
+ main ()
diff --git a/gr-wxgui/src/python/fftsink_nongl.py b/gr-wxgui/src/python/fftsink_nongl.py
new file mode 100644
index 000000000..473cc424c
--- /dev/null
+++ b/gr-wxgui/src/python/fftsink_nongl.py
@@ -0,0 +1,647 @@
+#!/usr/bin/env python
+#
+# Copyright 2003-2007,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.
+#
+
+from gnuradio import gr, gru, window
+from gnuradio.wxgui import stdgui2
+import wx
+import plot
+import numpy
+import math
+
+DIV_LEVELS = (1, 2, 5, 10, 20)
+
+default_fftsink_size = (640,240)
+default_fft_rate = gr.prefs().get_long('wxgui', 'fft_rate', 15)
+
+class fft_sink_base(object):
+ def __init__(self, input_is_real=False, baseband_freq=0, y_per_div=10,
+ y_divs=8, ref_level=50,
+ sample_rate=1, fft_size=512,
+ fft_rate=default_fft_rate,
+ average=False, avg_alpha=None, title='', peak_hold=False,use_persistence=False,persist_alpha=0.2):
+
+ # initialize common attributes
+ self.baseband_freq = baseband_freq
+ self.y_per_div=y_per_div
+ self.y_divs = y_divs
+ self.ref_level = ref_level
+ self.sample_rate = sample_rate
+ self.fft_size = fft_size
+ self.fft_rate = fft_rate
+ self.average = average
+ if avg_alpha is None:
+ self.avg_alpha = 2.0 / fft_rate
+ else:
+ self.avg_alpha = avg_alpha
+ self.use_persistence = use_persistence
+ self.persist_alpha = persist_alpha
+
+ self.title = title
+ self.peak_hold = peak_hold
+ self.input_is_real = input_is_real
+ self.msgq = gr.msg_queue(2) # queue that holds a maximum of 2 messages
+
+ def set_y_per_div(self, y_per_div):
+ self.y_per_div = y_per_div
+
+ def set_ref_level(self, ref_level):
+ self.ref_level = ref_level
+
+ def set_average(self, average):
+ self.average = average
+ if average:
+ self.avg.set_taps(self.avg_alpha)
+ else:
+ self.avg.set_taps(1.0)
+ self.win.peak_vals = None
+
+ def set_peak_hold(self, enable):
+ self.peak_hold = enable
+ self.win.set_peak_hold(enable)
+
+ def set_use_persistence(self, enable):
+ self.use_persistence = enable
+ self.win.set_use_persistence(enable)
+
+ def set_persist_alpha(self, persist_alpha):
+ self.persist_alpha = persist_alpha
+ self.win.set_persist_alpha(persist_alpha)
+
+ def set_avg_alpha(self, avg_alpha):
+ self.avg_alpha = avg_alpha
+
+ def set_baseband_freq(self, baseband_freq):
+ self.baseband_freq = baseband_freq
+
+ def set_sample_rate(self, sample_rate):
+ self.sample_rate = sample_rate
+ self._set_n()
+
+ def _set_n(self):
+ self.one_in_n.set_n(max(1, int(self.sample_rate/self.fft_size/self.fft_rate)))
+
+ def set_callback(self, callb):
+ return
+
+class fft_sink_f(gr.hier_block2, fft_sink_base):
+ def __init__(self, parent, baseband_freq=0, ref_scale=2.0,
+ y_per_div=10, y_divs=8, ref_level=50, sample_rate=1, fft_size=512,
+ fft_rate=default_fft_rate, average=False, avg_alpha=None,
+ title='', size=default_fftsink_size, peak_hold=False, use_persistence=False,persist_alpha=0.2, **kwargs):
+
+ gr.hier_block2.__init__(self, "fft_sink_f",
+ gr.io_signature(1, 1, gr.sizeof_float),
+ gr.io_signature(0,0,0))
+
+ fft_sink_base.__init__(self, input_is_real=True, baseband_freq=baseband_freq,
+ y_per_div=y_per_div, y_divs=y_divs, ref_level=ref_level,
+ sample_rate=sample_rate, fft_size=fft_size,
+ fft_rate=fft_rate,
+ average=average, avg_alpha=avg_alpha, title=title,
+ peak_hold=peak_hold,use_persistence=use_persistence,persist_alpha=persist_alpha)
+
+ self.s2p = gr.stream_to_vector(gr.sizeof_float, self.fft_size)
+ self.one_in_n = gr.keep_one_in_n(gr.sizeof_float * self.fft_size,
+ max(1, int(self.sample_rate/self.fft_size/self.fft_rate)))
+
+ mywindow = window.blackmanharris(self.fft_size)
+ self.fft = gr.fft_vfc(self.fft_size, True, mywindow)
+ power = 0
+ for tap in mywindow:
+ power += tap*tap
+
+ self.c2mag = gr.complex_to_mag(self.fft_size)
+ self.avg = gr.single_pole_iir_filter_ff(1.0, self.fft_size)
+
+ # FIXME We need to add 3dB to all bins but the DC bin
+ self.log = gr.nlog10_ff(20, self.fft_size,
+ -20*math.log10(self.fft_size) # Adjust for number of bins
+ -10*math.log10(power/self.fft_size) # Adjust for windowing loss
+ -20*math.log10(ref_scale/2)) # Adjust for reference scale
+
+ self.sink = gr.message_sink(gr.sizeof_float * self.fft_size, self.msgq, True)
+ self.connect(self, self.s2p, self.one_in_n, self.fft, self.c2mag, self.avg, self.log, self.sink)
+
+ self.win = fft_window(self, parent, size=size)
+ self.set_average(self.average)
+ self.set_peak_hold(self.peak_hold)
+ self.set_use_persistence(self.use_persistence)
+ self.set_persist_alpha(self.persist_alpha)
+
+class fft_sink_c(gr.hier_block2, fft_sink_base):
+ def __init__(self, parent, baseband_freq=0, ref_scale=2.0,
+ y_per_div=10, y_divs=8, ref_level=50, sample_rate=1, fft_size=512,
+ fft_rate=default_fft_rate, average=False, avg_alpha=None,
+ title='', size=default_fftsink_size, peak_hold=False, use_persistence=False,persist_alpha=0.2, **kwargs):
+
+ gr.hier_block2.__init__(self, "fft_sink_c",
+ gr.io_signature(1, 1, gr.sizeof_gr_complex),
+ gr.io_signature(0,0,0))
+
+ fft_sink_base.__init__(self, input_is_real=False, baseband_freq=baseband_freq,
+ y_per_div=y_per_div, y_divs=y_divs, ref_level=ref_level,
+ sample_rate=sample_rate, fft_size=fft_size,
+ fft_rate=fft_rate,
+ average=average, avg_alpha=avg_alpha, title=title,
+ peak_hold=peak_hold, use_persistence=use_persistence,persist_alpha=persist_alpha)
+
+ self.s2p = gr.stream_to_vector(gr.sizeof_gr_complex, self.fft_size)
+ self.one_in_n = gr.keep_one_in_n(gr.sizeof_gr_complex * self.fft_size,
+ max(1, int(self.sample_rate/self.fft_size/self.fft_rate)))
+
+ mywindow = window.blackmanharris(self.fft_size)
+ self.fft = gr.fft_vcc(self.fft_size, True, mywindow)
+ power = 0
+ for tap in mywindow:
+ power += tap*tap
+
+ self.c2mag = gr.complex_to_mag(self.fft_size)
+ self.avg = gr.single_pole_iir_filter_ff(1.0, self.fft_size)
+
+ # FIXME We need to add 3dB to all bins but the DC bin
+ self.log = gr.nlog10_ff(20, self.fft_size,
+ -20*math.log10(self.fft_size) # Adjust for number of bins
+ -10*math.log10(power/self.fft_size) # Adjust for windowing loss
+ -20*math.log10(ref_scale/2)) # Adjust for reference scale
+
+ self.sink = gr.message_sink(gr.sizeof_float * self.fft_size, self.msgq, True)
+ self.connect(self, self.s2p, self.one_in_n, self.fft, self.c2mag, self.avg, self.log, self.sink)
+
+ self.win = fft_window(self, parent, size=size)
+ self.set_average(self.average)
+ self.set_use_persistence(self.use_persistence)
+ self.set_persist_alpha(self.persist_alpha)
+ self.set_peak_hold(self.peak_hold)
+
+
+# ------------------------------------------------------------------------
+
+myDATA_EVENT = wx.NewEventType()
+EVT_DATA_EVENT = wx.PyEventBinder (myDATA_EVENT, 0)
+
+
+class DataEvent(wx.PyEvent):
+ def __init__(self, data):
+ wx.PyEvent.__init__(self)
+ self.SetEventType (myDATA_EVENT)
+ self.data = data
+
+ def Clone (self):
+ self.__class__ (self.GetId())
+
+
+class input_watcher (gru.msgq_runner):
+ def __init__ (self, msgq, fft_size, event_receiver, **kwds):
+ self.fft_size = fft_size
+ self.event_receiver = event_receiver
+ gru.msgq_runner.__init__(self, msgq, self.handle_msg)
+
+ def handle_msg(self, msg):
+ itemsize = int(msg.arg1())
+ nitems = int(msg.arg2())
+
+ s = msg.to_string() # get the body of the msg as a string
+
+ # There may be more than one FFT frame in the message.
+ # If so, we take only the last one
+ if nitems > 1:
+ start = itemsize * (nitems - 1)
+ s = s[start:start+itemsize]
+
+ complex_data = numpy.fromstring (s, numpy.float32)
+ de = DataEvent (complex_data)
+ wx.PostEvent (self.event_receiver, de)
+ del de
+
+class control_panel(wx.Panel):
+
+ class LabelText(wx.StaticText):
+ def __init__(self, window, label):
+ wx.StaticText.__init__(self, window, -1, label)
+ font = self.GetFont()
+ font.SetWeight(wx.FONTWEIGHT_BOLD)
+ font.SetUnderlined(True)
+ self.SetFont(font)
+
+ def __init__(self, parent):
+ self.parent = parent
+ wx.Panel.__init__(self, parent, -1, style=wx.SIMPLE_BORDER)
+ control_box = wx.BoxSizer(wx.VERTICAL)
+
+ #checkboxes for average and peak hold
+ control_box.AddStretchSpacer()
+ control_box.Add(self.LabelText(self, 'Options'), 0, wx.ALIGN_CENTER)
+ self.average_check_box = wx.CheckBox(parent=self, style=wx.CHK_2STATE, label="Average")
+ self.average_check_box.Bind(wx.EVT_CHECKBOX, parent.on_average)
+ control_box.Add(self.average_check_box, 0, wx.EXPAND)
+ self.use_persistence_check_box = wx.CheckBox(parent=self, style=wx.CHK_2STATE, label="Persistence")
+ self.use_persistence_check_box.Bind(wx.EVT_CHECKBOX, parent.on_use_persistence)
+ control_box.Add(self.use_persistence_check_box, 0, wx.EXPAND)
+ self.peak_hold_check_box = wx.CheckBox(parent=self, style=wx.CHK_2STATE, label="Peak Hold")
+ self.peak_hold_check_box.Bind(wx.EVT_CHECKBOX, parent.on_peak_hold)
+ control_box.Add(self.peak_hold_check_box, 0, wx.EXPAND)
+
+ #radio buttons for div size
+ control_box.AddStretchSpacer()
+ control_box.Add(self.LabelText(self, 'Set dB/div'), 0, wx.ALIGN_CENTER)
+ radio_box = wx.BoxSizer(wx.VERTICAL)
+ self.radio_buttons = list()
+ for y_per_div in DIV_LEVELS:
+ radio_button = wx.RadioButton(self, -1, "%d dB/div"%y_per_div)
+ radio_button.Bind(wx.EVT_RADIOBUTTON, self.on_radio_button_change)
+ self.radio_buttons.append(radio_button)
+ radio_box.Add(radio_button, 0, wx.ALIGN_LEFT)
+ control_box.Add(radio_box, 0, wx.EXPAND)
+
+ #ref lvl buttons
+ control_box.AddStretchSpacer()
+ control_box.Add(self.LabelText(self, 'Adj Ref Lvl'), 0, wx.ALIGN_CENTER)
+ control_box.AddSpacer(2)
+ button_box = wx.BoxSizer(wx.HORIZONTAL)
+ self.ref_plus_button = wx.Button(self, -1, '+', style=wx.BU_EXACTFIT)
+ self.ref_plus_button.Bind(wx.EVT_BUTTON, parent.on_incr_ref_level)
+ button_box.Add(self.ref_plus_button, 0, wx.ALIGN_CENTER)
+ self.ref_minus_button = wx.Button(self, -1, ' - ', style=wx.BU_EXACTFIT)
+ self.ref_minus_button.Bind(wx.EVT_BUTTON, parent.on_decr_ref_level)
+ button_box.Add(self.ref_minus_button, 0, wx.ALIGN_CENTER)
+ control_box.Add(button_box, 0, wx.ALIGN_CENTER)
+ control_box.AddStretchSpacer()
+ #set sizer
+ self.SetSizerAndFit(control_box)
+ #update
+ self.update()
+
+ def update(self):
+ """
+ Read the state of the fft plot settings and update the control panel.
+ """
+ #update checkboxes
+ self.average_check_box.SetValue(self.parent.fftsink.average)
+ self.use_persistence_check_box.SetValue(self.parent.fftsink.use_persistence)
+ self.peak_hold_check_box.SetValue(self.parent.fftsink.peak_hold)
+ #update radio buttons
+ try:
+ index = list(DIV_LEVELS).index(self.parent.fftsink.y_per_div)
+ self.radio_buttons[index].SetValue(True)
+ except: pass
+
+ def on_radio_button_change(self, evt):
+ selected_radio_button = filter(lambda rb: rb.GetValue(), self.radio_buttons)[0]
+ index = self.radio_buttons.index(selected_radio_button)
+ self.parent.fftsink.set_y_per_div(DIV_LEVELS[index])
+
+class fft_window (wx.Panel):
+ def __init__ (self, fftsink, parent, id = -1,
+ pos = wx.DefaultPosition, size = wx.DefaultSize,
+ style = wx.DEFAULT_FRAME_STYLE, name = ""):
+
+ self.fftsink = fftsink
+ #init panel and plot
+ wx.Panel.__init__(self, parent, -1)
+ self.plot = plot.PlotCanvas(self, id, pos, size, style, name)
+ #setup the box with plot and controls
+ self.control_panel = control_panel(self)
+ main_box = wx.BoxSizer (wx.HORIZONTAL)
+ main_box.Add (self.plot, 1, wx.EXPAND)
+ main_box.Add (self.control_panel, 0, wx.EXPAND)
+ self.SetSizerAndFit(main_box)
+
+ self.peak_hold = False
+ self.peak_vals = None
+
+ self.use_persistence=False
+ self.persist_alpha=0.2
+
+
+ self.plot.SetEnableGrid (True)
+ # self.SetEnableZoom (True)
+ # self.SetBackgroundColour ('black')
+
+ self.build_popup_menu()
+ self.set_baseband_freq(self.fftsink.baseband_freq)
+
+ EVT_DATA_EVENT (self, self.set_data)
+ wx.EVT_CLOSE (self, self.on_close_window)
+ self.plot.Bind(wx.EVT_RIGHT_UP, self.on_right_click)
+ self.plot.Bind(wx.EVT_MOTION, self.evt_motion)
+
+ self.input_watcher = input_watcher(fftsink.msgq, fftsink.fft_size, self)
+
+ def set_scale(self, freq):
+ x = max(abs(self.fftsink.sample_rate), abs(self.fftsink.baseband_freq))
+ if x >= 1e9:
+ self._scale_factor = 1e-9
+ self._units = "GHz"
+ self._format = "%3.6f"
+ elif x >= 1e6:
+ self._scale_factor = 1e-6
+ self._units = "MHz"
+ self._format = "%3.3f"
+ else:
+ self._scale_factor = 1e-3
+ self._units = "kHz"
+ self._format = "%3.3f"
+
+ def set_baseband_freq(self, baseband_freq):
+ if self.peak_hold:
+ self.peak_vals = None
+ self.set_scale(baseband_freq)
+ self.fftsink.set_baseband_freq(baseband_freq)
+
+ def on_close_window (self, event):
+ print "fft_window:on_close_window"
+ self.keep_running = False
+
+
+ def set_data (self, evt):
+ dB = evt.data
+ L = len (dB)
+
+ if self.peak_hold:
+ if self.peak_vals is None:
+ self.peak_vals = dB
+ else:
+ self.peak_vals = numpy.maximum(dB, self.peak_vals)
+
+ if self.fftsink.input_is_real: # only plot 1/2 the points
+ x_vals = ((numpy.arange (L/2) * (self.fftsink.sample_rate
+ * self._scale_factor / L))
+ + self.fftsink.baseband_freq * self._scale_factor)
+ self._points = numpy.zeros((len(x_vals), 2), numpy.float64)
+ self._points[:,0] = x_vals
+ self._points[:,1] = dB[0:L/2]
+ if self.peak_hold:
+ self._peak_points = numpy.zeros((len(x_vals), 2), numpy.float64)
+ self._peak_points[:,0] = x_vals
+ self._peak_points[:,1] = self.peak_vals[0:L/2]
+ else:
+ # the "negative freqs" are in the second half of the array
+ x_vals = ((numpy.arange (-L/2, L/2)
+ * (self.fftsink.sample_rate * self._scale_factor / L))
+ + self.fftsink.baseband_freq * self._scale_factor)
+ self._points = numpy.zeros((len(x_vals), 2), numpy.float64)
+ self._points[:,0] = x_vals
+ self._points[:,1] = numpy.concatenate ((dB[L/2:], dB[0:L/2]))
+ if self.peak_hold:
+ self._peak_points = numpy.zeros((len(x_vals), 2), numpy.float64)
+ self._peak_points[:,0] = x_vals
+ self._peak_points[:,1] = numpy.concatenate ((self.peak_vals[L/2:], self.peak_vals[0:L/2]))
+
+ lines = [plot.PolyLine (self._points, colour='BLUE'),]
+ if self.peak_hold:
+ lines.append(plot.PolyLine (self._peak_points, colour='GREEN'))
+
+ graphics = plot.PlotGraphics (lines,
+ title=self.fftsink.title,
+ xLabel = self._units, yLabel = "dB")
+ x_range = x_vals[0], x_vals[-1]
+ ymax = self.fftsink.ref_level
+ ymin = self.fftsink.ref_level - self.fftsink.y_per_div * self.fftsink.y_divs
+ y_range = ymin, ymax
+ self.plot.Draw (graphics, xAxis=x_range, yAxis=y_range, step=self.fftsink.y_per_div)
+
+ def set_use_persistence(self, enable):
+ self.use_persistence = enable
+ self.plot.set_use_persistence( enable)
+
+ def set_persist_alpha(self, persist_alpha):
+ self.persist_alpha = persist_alpha
+ self.plot.set_persist_alpha(persist_alpha)
+
+ def set_peak_hold(self, enable):
+ self.peak_hold = enable
+ self.peak_vals = None
+
+ def on_average(self, evt):
+ # print "on_average"
+ self.fftsink.set_average(evt.IsChecked())
+ self.control_panel.update()
+
+ def on_use_persistence(self, evt):
+ # print "on_analog"
+ self.fftsink.set_use_persistence(evt.IsChecked())
+ self.control_panel.update()
+
+ def on_peak_hold(self, evt):
+ # print "on_peak_hold"
+ self.fftsink.set_peak_hold(evt.IsChecked())
+ self.control_panel.update()
+
+ def on_incr_ref_level(self, evt):
+ # print "on_incr_ref_level"
+ self.fftsink.set_ref_level(self.fftsink.ref_level
+ + self.fftsink.y_per_div)
+
+ def on_decr_ref_level(self, evt):
+ # print "on_decr_ref_level"
+ self.fftsink.set_ref_level(self.fftsink.ref_level
+ - self.fftsink.y_per_div)
+
+ def on_incr_y_per_div(self, evt):
+ # print "on_incr_y_per_div"
+ self.fftsink.set_y_per_div(next_up(self.fftsink.y_per_div, DIV_LEVELS))
+ self.control_panel.update()
+
+ def on_decr_y_per_div(self, evt):
+ # print "on_decr_y_per_div"
+ self.fftsink.set_y_per_div(next_down(self.fftsink.y_per_div, DIV_LEVELS))
+ self.control_panel.update()
+
+ def on_y_per_div(self, evt):
+ # print "on_y_per_div"
+ Id = evt.GetId()
+ if Id == self.id_y_per_div_1:
+ self.fftsink.set_y_per_div(1)
+ elif Id == self.id_y_per_div_2:
+ self.fftsink.set_y_per_div(2)
+ elif Id == self.id_y_per_div_5:
+ self.fftsink.set_y_per_div(5)
+ elif Id == self.id_y_per_div_10:
+ self.fftsink.set_y_per_div(10)
+ elif Id == self.id_y_per_div_20:
+ self.fftsink.set_y_per_div(20)
+ self.control_panel.update()
+
+ def on_right_click(self, event):
+ menu = self.popup_menu
+ for id, pred in self.checkmarks.items():
+ item = menu.FindItemById(id)
+ item.Check(pred())
+ self.plot.PopupMenu(menu, event.GetPosition())
+
+ def evt_motion(self, event):
+ if not hasattr(self, "_points"):
+ return # Got here before first window data update
+
+ # Clip to plotted values
+ (ux, uy) = self.plot.GetXY(event) # Scaled position
+ x_vals = numpy.array(self._points[:,0])
+ if ux < x_vals[0] or ux > x_vals[-1]:
+ tip = self.GetToolTip()
+ if tip:
+ tip.Enable(False)
+ return
+
+ # Get nearest X value (is there a better way)?
+ ind = numpy.argmin(numpy.abs(x_vals-ux))
+ x_val = x_vals[ind]
+ db_val = self._points[ind, 1]
+ text = (self._format+" %s dB=%3.3f") % (x_val, self._units, db_val)
+
+ # Display the tooltip
+ tip = wx.ToolTip(text)
+ tip.Enable(True)
+ tip.SetDelay(0)
+ self.SetToolTip(tip)
+
+ def build_popup_menu(self):
+ self.id_incr_ref_level = wx.NewId()
+ self.id_decr_ref_level = wx.NewId()
+ self.id_incr_y_per_div = wx.NewId()
+ self.id_decr_y_per_div = wx.NewId()
+ self.id_y_per_div_1 = wx.NewId()
+ self.id_y_per_div_2 = wx.NewId()
+ self.id_y_per_div_5 = wx.NewId()
+ self.id_y_per_div_10 = wx.NewId()
+ self.id_y_per_div_20 = wx.NewId()
+ self.id_average = wx.NewId()
+ self.id_use_persistence = wx.NewId()
+ self.id_peak_hold = wx.NewId()
+
+ self.plot.Bind(wx.EVT_MENU, self.on_average, id=self.id_average)
+ self.plot.Bind(wx.EVT_MENU, self.on_use_persistence, id=self.id_use_persistence)
+ self.plot.Bind(wx.EVT_MENU, self.on_peak_hold, id=self.id_peak_hold)
+ self.plot.Bind(wx.EVT_MENU, self.on_incr_ref_level, id=self.id_incr_ref_level)
+ self.plot.Bind(wx.EVT_MENU, self.on_decr_ref_level, id=self.id_decr_ref_level)
+ self.plot.Bind(wx.EVT_MENU, self.on_incr_y_per_div, id=self.id_incr_y_per_div)
+ self.plot.Bind(wx.EVT_MENU, self.on_decr_y_per_div, id=self.id_decr_y_per_div)
+ self.plot.Bind(wx.EVT_MENU, self.on_y_per_div, id=self.id_y_per_div_1)
+ self.plot.Bind(wx.EVT_MENU, self.on_y_per_div, id=self.id_y_per_div_2)
+ self.plot.Bind(wx.EVT_MENU, self.on_y_per_div, id=self.id_y_per_div_5)
+ self.plot.Bind(wx.EVT_MENU, self.on_y_per_div, id=self.id_y_per_div_10)
+ self.plot.Bind(wx.EVT_MENU, self.on_y_per_div, id=self.id_y_per_div_20)
+
+ # make a menu
+ menu = wx.Menu()
+ self.popup_menu = menu
+ menu.AppendCheckItem(self.id_average, "Average")
+ menu.AppendCheckItem(self.id_use_persistence, "Persistence")
+ menu.AppendCheckItem(self.id_peak_hold, "Peak Hold")
+ menu.Append(self.id_incr_ref_level, "Incr Ref Level")
+ menu.Append(self.id_decr_ref_level, "Decr Ref Level")
+ # menu.Append(self.id_incr_y_per_div, "Incr dB/div")
+ # menu.Append(self.id_decr_y_per_div, "Decr dB/div")
+ menu.AppendSeparator()
+ # we'd use RadioItems for these, but they're not supported on Mac
+ menu.AppendCheckItem(self.id_y_per_div_1, "1 dB/div")
+ menu.AppendCheckItem(self.id_y_per_div_2, "2 dB/div")
+ menu.AppendCheckItem(self.id_y_per_div_5, "5 dB/div")
+ menu.AppendCheckItem(self.id_y_per_div_10, "10 dB/div")
+ menu.AppendCheckItem(self.id_y_per_div_20, "20 dB/div")
+
+ self.checkmarks = {
+ self.id_average : lambda : self.fftsink.average,
+ self.id_use_persistence : lambda : self.fftsink.use_persistence,
+ self.id_peak_hold : lambda : self.fftsink.peak_hold,
+ self.id_y_per_div_1 : lambda : self.fftsink.y_per_div == 1,
+ self.id_y_per_div_2 : lambda : self.fftsink.y_per_div == 2,
+ self.id_y_per_div_5 : lambda : self.fftsink.y_per_div == 5,
+ self.id_y_per_div_10 : lambda : self.fftsink.y_per_div == 10,
+ self.id_y_per_div_20 : lambda : self.fftsink.y_per_div == 20,
+ }
+
+
+def next_up(v, seq):
+ """
+ Return the first item in seq that is > v.
+ """
+ for s in seq:
+ if s > v:
+ return s
+ return v
+
+def next_down(v, seq):
+ """
+ Return the last item in seq that is < v.
+ """
+ rseq = list(seq[:])
+ rseq.reverse()
+
+ for s in rseq:
+ if s < v:
+ return s
+ return v
+
+
+# ----------------------------------------------------------------
+# Standalone test app
+# ----------------------------------------------------------------
+
+class test_app_block (stdgui2.std_top_block):
+ def __init__(self, frame, panel, vbox, argv):
+ stdgui2.std_top_block.__init__ (self, frame, panel, vbox, argv)
+
+ fft_size = 256
+
+ # build our flow graph
+ input_rate = 100*20.48e3
+
+ # Generate a complex sinusoid
+ #src1 = gr.sig_source_c (input_rate, gr.GR_SIN_WAVE, 100*2e3, 1)
+ src1 = gr.sig_source_c (input_rate, gr.GR_CONST_WAVE, 100*5.75e3, 1)
+ noise1 = analog.noise_source_c(analog.GR_UNIFORM, 1.0/10)
+ add1 = blocks.add_cc()
+
+ # We add these throttle blocks so that this demo doesn't
+ # suck down all the CPU available. Normally you wouldn't use these.
+ thr1 = gr.throttle(gr.sizeof_gr_complex, input_rate)
+
+ sink1 = fft_sink_c (panel, title="Complex Data", fft_size=fft_size,
+ sample_rate=input_rate, baseband_freq=100e3,
+ ref_level=0, y_per_div=20, y_divs=10)
+ vbox.Add (sink1.win, 1, wx.EXPAND)
+
+ self.connect(src1, (add1,0))
+ self.connect(noise1, (add1,1))
+ self.connect(add1, thr1, sink1)
+
+ #src2 = gr.sig_source_f (input_rate, gr.GR_SIN_WAVE, 100*2e3, 1)
+ src2 = gr.sig_source_f (input_rate, gr.GR_CONST_WAVE, 100*5.75e3, 1)
+ noise2 = analog.noise_source_f(analog.GR_UNIFORM, 1.0/10)
+ add2 = blocks.add_ff()
+
+ thr2 = gr.throttle(gr.sizeof_float, input_rate)
+ sink2 = fft_sink_f (panel, title="Real Data", fft_size=fft_size*2,
+ sample_rate=input_rate, baseband_freq=100e3,
+ ref_level=0, y_per_div=20, y_divs=10)
+ vbox.Add (sink2.win, 1, wx.EXPAND)
+
+ self.connect(src2, (add2,0))
+ self.connect(noise2, (add2,1))
+ self.connect(add2, thr2, sink2)
+
+def main ():
+ app = stdgui2.stdapp (test_app_block, "FFT Sink Test App")
+ app.MainLoop ()
+
+if __name__ == '__main__':
+ main ()
diff --git a/gr-wxgui/src/python/form.py b/gr-wxgui/src/python/form.py
new file mode 100644
index 000000000..0442e49c8
--- /dev/null
+++ b/gr-wxgui/src/python/form.py
@@ -0,0 +1,391 @@
+#!/usr/bin/env python
+#
+# Copyright 2005 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.
+#
+
+import wx
+from gnuradio import eng_notation
+
+# ----------------------------------------------------------------
+# Wrappers for certain widgets
+# ----------------------------------------------------------------
+
+def button_with_callback(parent, label, callback):
+ new_id = wx.NewId()
+ btn = wx.Button(parent, new_id, label)
+ wx.EVT_BUTTON(parent, new_id, lambda evt: callback())
+ return btn
+
+
+# ----------------------------------------------------------------
+# Format converters
+# ----------------------------------------------------------------
+
+class abstract_converter(object):
+ def value_to_prim(self, v):
+ """
+ Convert from user specified value to value acceptable to underlying primitive.
+ The underlying primitive usually expects strings.
+ """
+ raise NotImplementedError
+ def prim_to_value(self, s):
+ """
+ Convert from underlying primitive value to user specified value.
+ The underlying primitive usually expects strings.
+ """
+ raise NotImplementedError
+ def help(self):
+ return "Any string is acceptable"
+
+class identity_converter(abstract_converter):
+ def value_to_prim(self,v):
+ return v
+ def prim_to_value(self, s):
+ return s
+
+class int_converter(abstract_converter):
+ def value_to_prim(self, v):
+ return str(v)
+ def prim_to_value(self, s):
+ return int(s, 0)
+ def help(self):
+ return "Enter an integer. Leading 0x indicates hex"
+
+class float_converter(abstract_converter):
+ def value_to_prim(self, v):
+ return eng_notation.num_to_str(v)
+ def prim_to_value(self, s):
+ return eng_notation.str_to_num(s)
+ def help(self):
+ return "Enter a float with optional scale suffix. E.g., 100.1M"
+
+
+# ----------------------------------------------------------------
+# Various types of data entry fields
+# ----------------------------------------------------------------
+
+class field(object):
+ """
+ A field in a form.
+ """
+ def __init__(self, converter, value):
+ self.converter = converter
+ if value is not None:
+ self.set_value(value)
+
+ def set_value(self, v):
+ self._set_prim_value(self.converter.value_to_prim(v))
+
+ def get_value(self):
+ return self.converter.prim_to_value(self._get_prim_value())
+
+ def get_value_with_check(self):
+ """
+ Returns (value, error_msg), where error_msg is not None if there was problem
+ """
+ try:
+ return (self.get_value(), None)
+ except:
+ return (None, self._error_msg())
+
+ def _set_prim_value(self, v):
+ raise NotImplementedError
+
+ def _get_prim_value(self):
+ raise NotImplementedError
+
+ def _pair_with_label(self, widget, parent=None, sizer=None, label=None, weight=1):
+ self.label = label
+ if label is None:
+ sizer.Add (widget, weight, wx.EXPAND)
+ return widget
+ elif 0:
+ hbox = wx.BoxSizer(wx.HORIZONTAL)
+ label_widget = wx.StaticText(parent, -1, label + ': ')
+ hbox.Add(label_widget, 0, wx.EXPAND)
+ hbox.Add(widget, 1, wx.EXPAND)
+ sizer.Add(hbox, weight, wx.EXPAND)
+ return widget
+ else:
+ label_widget = wx.StaticText(parent, -1, label + ': ')
+ sizer.Add(label_widget, 0, wx.EXPAND)
+ sizer.Add(widget, weight, wx.EXPAND)
+ return widget
+
+ def _error_msg(self):
+ prefix = ''
+ if self.label:
+ prefix = self.label + ': '
+ return "%s%s is invalid. %s" % (prefix, self._get_prim_value(),
+ self.converter.help())
+
+# static (display-only) text fields
+
+class static_text_field(field):
+ def __init__(self, parent=None, sizer=None, label=None, value=None,
+ converter=identity_converter(), weight=0):
+ self.f = self._pair_with_label(wx.StaticText(parent, -1, ""),
+ parent=parent, sizer=sizer, label=label, weight=weight)
+ field.__init__(self, converter, value)
+
+ def _get_prim_value(self):
+ return self.f.GetLabel()
+
+ def _set_prim_value(self, v):
+ self.f.SetLabel(v)
+
+
+class static_int_field(static_text_field):
+ def __init__(self, parent=None, sizer=None, label=None, value=None, weight=0):
+ static_text_field.__init__(self, parent, sizer, label, value, int_converter(), weight)
+
+class static_float_field(static_text_field):
+ def __init__(self, parent=None, sizer=None, label=None, value=None, weight=0):
+ static_text_field.__init__(self, parent, sizer, label, value, float_converter(), weight)
+
+
+# editable text fields
+
+class text_field(field):
+ def __init__(self, parent=None, sizer=None, label=None, value=None,
+ converter=identity_converter(), callback=None, weight=1):
+ style = 0
+ if callback:
+ style = wx.TE_PROCESS_ENTER
+
+ new_id = wx.NewId()
+ w = wx.TextCtrl(parent, new_id, "", style=style)
+ self.f = self._pair_with_label(w, parent=parent, sizer=sizer, label=label, weight=weight)
+ if callback:
+ wx.EVT_TEXT_ENTER(w, new_id, lambda evt: callback())
+ field.__init__(self, converter, value)
+
+ def _get_prim_value(self):
+ return self.f.GetValue()
+
+ def _set_prim_value(self, v):
+ self.f.SetValue(v)
+
+
+class int_field(text_field):
+ def __init__(self, parent=None, sizer=None, label=None, value=None,
+ callback=None, weight=1):
+ text_field.__init__(self, parent, sizer, label, value, int_converter(), callback, weight)
+
+class float_field(text_field):
+ def __init__(self, parent=None, sizer=None, label=None, value=None,
+ callback=None, weight=1):
+ text_field.__init__(self, parent, sizer, label, value, float_converter(), callback, weight)
+
+# other fields
+
+class slider_field(field):
+ def __init__(self, parent=None, sizer=None, label=None, value=None,
+ converter=identity_converter(), callback=None, min=0, max=100, weight=1):
+ new_id = wx.NewId()
+ w = wx.Slider(parent, new_id, (max+min)/2, min, max,
+ size=wx.Size(250, -1), style=wx.SL_HORIZONTAL | wx.SL_LABELS)
+ self.f = self._pair_with_label(w, parent=parent, sizer=sizer, label=label, weight=weight)
+ if callback:
+ wx.EVT_COMMAND_SCROLL(w, new_id, lambda evt: callback(evt.GetInt()))
+ field.__init__(self, converter, value)
+
+ def _get_prim_value(self):
+ return self.f.GetValue()
+
+ def _set_prim_value(self, v):
+ self.f.SetValue(int(v))
+
+class quantized_slider_field(field):
+ def __init__(self, parent=None, sizer=None, label=None, value=None,
+ converter=identity_converter(), callback=None, range=None, weight=1):
+ if not isinstance(range, (tuple, list)) or len(range) != 3:
+ raise ValueError, range
+
+ self.min = range[0]
+ self.max = range[1]
+ self.step_size = float(range[2])
+ nsteps = int((self.max-self.min)/self.step_size)
+
+ new_id = wx.NewId()
+ w = wx.Slider(parent, new_id, 0, 0, nsteps,
+ size=wx.Size(250, -1), style=wx.SL_HORIZONTAL)
+ self.f = self._pair_with_label(w, parent=parent, sizer=sizer, label=label, weight=weight)
+ if callback:
+ wx.EVT_COMMAND_SCROLL(w, new_id,
+ lambda evt: callback(self._map_out(evt.GetInt())))
+ field.__init__(self, converter, value)
+
+ def _get_prim_value(self):
+ return self._map_out(self.f.GetValue())
+
+ def _set_prim_value(self, v):
+ self.f.SetValue(self._map_in(v))
+
+ def _map_in(self, x):
+ return int((x-self.min) / self.step_size)
+
+ def _map_out(self, x):
+ return x * self.step_size + self.min
+
+class checkbox_field(field):
+ def __init__(self, parent=None, sizer=None, label=None, value=None,
+ converter=identity_converter(), callback=None, weight=1):
+ new_id = wx.NewId()
+ w = wx.CheckBox(parent, new_id, label, style=wx.CHK_2STATE)
+ self.f = self._pair_with_label(w, parent=parent, sizer=sizer, label=None, weight=weight)
+ if callback:
+ wx.EVT_CHECKBOX(w, new_id, lambda evt: callback(evt.GetInt()))
+ field.__init__(self, converter, value)
+
+ def _get_prim_value(self):
+ return self.f.GetValue()
+
+ def _set_prim_value(self, v):
+ self.f.SetValue(int(v))
+
+
+class radiobox_field(field):
+ def __init__(self, parent=None, sizer=None, label=None, value=None,
+ converter=identity_converter(), callback=None, weight=1,
+ choices=None, major_dimension=1, specify_rows=False):
+ new_id = wx.NewId()
+
+ if specify_rows:
+ style=wx.RA_SPECIFY_ROWS | wx.RA_HORIZONTAL
+ else:
+ style=wx.RA_SPECIFY_COLS | wx.RA_HORIZONTAL
+
+ w = wx.RadioBox(parent, new_id, label=label, style=style, majorDimension=major_dimension,
+ choices=choices)
+ self.f = self._pair_with_label(w, parent=parent, sizer=sizer, label=None, weight=weight)
+ if callback:
+ wx.EVT_RADIOBOX(w, new_id, lambda evt: callback(evt.GetString()))
+ field.__init__(self, converter, value)
+
+ def _get_prim_value(self):
+ return self.f.GetStringSelection()
+
+ def _set_prim_value(self, v):
+ self.f.SetStringSelection(str(v))
+
+# ----------------------------------------------------------------
+# the form class
+# ----------------------------------------------------------------
+
+class form(dict):
+ def __init__(self):
+ dict.__init__(self)
+
+ def check_input_for_errors(self):
+ """
+ Returns list of error messages if there's trouble,
+ else empty list.
+ """
+ vals = [f.get_value_with_check() for f in self.values()]
+ return [t[1] for t in vals if t[1] is not None]
+
+ def get_key_vals(self):
+ d = {}
+ for (key, f) in self.items():
+ d[key] = f.get_value()
+ return d
+
+
+ def _nop(*args): pass
+
+ def check_input_and_call(self, callback, status_handler=_nop):
+ """
+ Return a function that checks the form for errors, and then if it's OK,
+ invokes the user specified callback, passing it the form key/value dictionary.
+ status_handler is called with a string indicating results.
+ """
+ def doit_callback(*ignore):
+ errors = self.check_input_for_errors()
+ if errors:
+ status_handler(errors[0])
+ #print '\n'.join(tuple(errors))
+ else:
+ kv = self.get_key_vals()
+ if callback(kv):
+ status_handler("OK")
+ else:
+ status_handler("Failed")
+
+ return doit_callback
+
+
+
+# ----------------------------------------------------------------
+# Stand-alone example code
+# ----------------------------------------------------------------
+
+import sys
+from gnuradio.wxgui import stdgui2
+
+class demo_app_flow_graph (stdgui2.std_top_block):
+ def __init__(self, frame, panel, vbox, argv):
+ stdgui2.std_top_block.__init__ (self, frame, panel, vbox, argv)
+
+ self.frame = frame
+ self.panel = panel
+
+ def _print_kv(kv):
+ print "kv =", kv
+ return True
+
+ self.form = form()
+
+ self.form['static1'] = \
+ static_text_field(parent=panel, sizer=vbox,
+ label="Static Text",
+ value="The Static Value")
+
+ self.form['text1'] = \
+ text_field(parent=panel, sizer=vbox,
+ label="TextCtrl",
+ value="The Editable Value")
+
+ self.form['int1'] = \
+ int_field(parent=panel, sizer=vbox,
+ label="Int Field",
+ value=1234)
+
+ self.form['float1'] = \
+ float_field(parent=panel, sizer=vbox,
+ label="Float Field",
+ value=3.14159)
+
+ self.doit = button_with_callback(
+ panel, "Do It!",
+ self.form.check_input_and_call(_print_kv, self._set_status_msg))
+
+ vbox.Add(self.doit, 0, wx.CENTER)
+
+ def _set_status_msg(self, msg):
+ self.frame.GetStatusBar().SetStatusText(msg, 0)
+
+
+def main ():
+ app = stdgui2.stdapp(demo_app_flow_graph, "wxgui form demo", nstatus=1)
+ app.MainLoop ()
+
+if __name__ == '__main__':
+ main ()
diff --git a/gr-wxgui/src/python/forms/__init__.py b/gr-wxgui/src/python/forms/__init__.py
new file mode 100644
index 000000000..3068b18fe
--- /dev/null
+++ b/gr-wxgui/src/python/forms/__init__.py
@@ -0,0 +1,103 @@
+#
+# 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.
+#
+
+"""
+The following classes will be available through gnuradio.wxgui.forms:
+"""
+
+########################################################################
+# External Converters
+########################################################################
+from converters import \
+ eval_converter, str_converter, \
+ float_converter, int_converter
+
+########################################################################
+# External Forms
+########################################################################
+from forms import \
+ radio_buttons, drop_down, notebook, \
+ button, toggle_button, single_button, \
+ check_box, text_box, static_text, \
+ slider, log_slider, gauge, \
+ make_bold, DataEvent, EVT_DATA
+
+########################################################################
+# Helpful widgets
+########################################################################
+import wx
+
+class static_box_sizer(wx.StaticBoxSizer):
+ """
+ A box sizer with label and border.
+ @param parent the parent widget
+ @param sizer add this widget to sizer if provided (optional)
+ @param proportion the proportion when added to the sizer (default=0)
+ @param flag the flag argument when added to the sizer (default=wx.EXPAND)
+ @param label title label for this widget (optional)
+ @param bold true to boldify the label
+ @param orient the sizer orientation wx.VERTICAL or wx.HORIZONTAL (default=wx.VERTICAL)
+ """
+ def __init__(self, parent, label='', bold=False, sizer=None, orient=wx.VERTICAL, proportion=0, flag=wx.EXPAND):
+ box = wx.StaticBox(parent=parent, label=label)
+ if bold: make_bold(box)
+ wx.StaticBoxSizer.__init__(self, box=box, orient=orient)
+ if sizer: sizer.Add(self, proportion, flag)
+
+class incr_decr_buttons(wx.BoxSizer):
+ """
+ A horizontal box sizer with a increment and a decrement button.
+ @param parent the parent widget
+ @param sizer add this widget to sizer if provided (optional)
+ @param proportion the proportion when added to the sizer (default=0)
+ @param flag the flag argument when added to the sizer (default=wx.EXPAND)
+ @param label title label for this widget (optional)
+ @param on_incr the callback for pressing the + button
+ @param on_decr the callback for pressing the - button
+ """
+ def __init__(self, parent, on_incr, on_decr, label='', sizer=None, proportion=0, flag=wx.EXPAND):
+ """
+ @param parent the parent window
+ @param on_incr the event handler for increment
+ @param on_decr the event handler for decrement
+ """
+ wx.BoxSizer.__init__(self, wx.HORIZONTAL)
+ buttons_box = wx.BoxSizer(wx.HORIZONTAL)
+ self._incr_button = wx.Button(parent, label='+', style=wx.BU_EXACTFIT)
+ self._incr_button.Bind(wx.EVT_BUTTON, on_incr)
+ buttons_box.Add(self._incr_button, 0, wx.ALIGN_CENTER_VERTICAL)
+ self._decr_button = wx.Button(parent, label=' - ', style=wx.BU_EXACTFIT)
+ self._decr_button.Bind(wx.EVT_BUTTON, on_decr)
+ buttons_box.Add(self._decr_button, 0, wx.ALIGN_CENTER_VERTICAL)
+ if label: #add label
+ self.Add(wx.StaticText(parent, label='%s: '%label), 1, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_LEFT)
+ self.Add(buttons_box, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT)
+ else: self.Add(buttons_box, 0, wx.ALIGN_CENTER_VERTICAL)
+ if sizer: sizer.Add(self, proportion, flag)
+
+ def Disable(self, disable=True): self.Enable(not disable)
+ def Enable(self, enable=True):
+ if enable:
+ self._incr_button.Enable()
+ self._decr_button.Enable()
+ else:
+ self._incr_button.Disable()
+ self._decr_button.Disable()
diff --git a/gr-wxgui/src/python/forms/converters.py b/gr-wxgui/src/python/forms/converters.py
new file mode 100644
index 000000000..db14d2752
--- /dev/null
+++ b/gr-wxgui/src/python/forms/converters.py
@@ -0,0 +1,154 @@
+#
+# 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.
+#
+
+from gnuradio import eng_notation
+import math
+
+class abstract_converter(object):
+ def external_to_internal(self, v):
+ """
+ Convert from user specified value to value acceptable to underlying primitive.
+ The underlying primitive usually expects strings.
+ """
+ raise NotImplementedError
+ def internal_to_external(self, s):
+ """
+ Convert from underlying primitive value to user specified value.
+ The underlying primitive usually expects strings.
+ """
+ raise NotImplementedError
+ def help(self):
+ return "Any string is acceptable"
+
+class identity_converter(abstract_converter):
+ def external_to_internal(self,v):
+ return v
+ def internal_to_external(self, s):
+ return s
+
+########################################################################
+# Commonly used converters
+########################################################################
+class chooser_converter(abstract_converter):
+ """
+ Convert between a set of possible choices and an index.
+ Used in the chooser base and all sub-classes.
+ """
+ def __init__(self, choices):
+ #choices must be a list because tuple does not have .index() in python2.5
+ self._choices = list(choices)
+ def external_to_internal(self, choice):
+ return self._choices.index(choice)
+ def internal_to_external(self, index):
+ return self._choices[index]
+ def help(self):
+ return 'Enter a possible value in choices: "%s"'%str(self._choices)
+
+class bool_converter(abstract_converter):
+ """
+ The internal representation is boolean.
+ The external representation is specified.
+ Used in the check box form.
+ """
+ def __init__(self, true, false):
+ self._true = true
+ self._false = false
+ def external_to_internal(self, v):
+ if v == self._true: return True
+ if v == self._false: return False
+ raise Exception, 'Value "%s" is not a possible option.'%v
+ def internal_to_external(self, v):
+ if v: return self._true
+ else: return self._false
+ def help(self):
+ return "Value must be in (%s, %s)."%(self._true, self._false)
+
+class eval_converter(abstract_converter):
+ """
+ A catchall converter when int and float are not enough.
+ Evaluate the internal representation with python's eval().
+ Possible uses, set a complex number, constellation points.
+ Used in text box.
+ """
+ def __init__(self, formatter=lambda x: '%s'%(x)):
+ self._formatter = formatter
+ def external_to_internal(self, v):
+ return self._formatter(v)
+ def internal_to_external(self, s):
+ return eval(s)
+ def help(self):
+ return "Value must be evaluatable by python's eval."
+
+class str_converter(abstract_converter):
+ def __init__(self, formatter=lambda x: '%s'%(x)):
+ self._formatter = formatter
+ def external_to_internal(self, v):
+ return self._formatter(v)
+ def internal_to_external(self, s):
+ return str(s)
+
+class int_converter(abstract_converter):
+ def __init__(self, formatter=lambda x: '%d'%round(x)):
+ self._formatter = formatter
+ def external_to_internal(self, v):
+ return self._formatter(v)
+ def internal_to_external(self, s):
+ return int(s, 0)
+ def help(self):
+ return "Enter an integer. Leading 0x indicates hex"
+
+class float_converter(abstract_converter):
+ def __init__(self, formatter=eng_notation.num_to_str):
+ self._formatter = formatter
+ def external_to_internal(self, v):
+ return self._formatter(v)
+ def internal_to_external(self, s):
+ return eng_notation.str_to_num(s)
+ def help(self):
+ return "Enter a float with optional scale suffix. E.g., 100.1M"
+
+class slider_converter(abstract_converter):
+ """
+ Scale values to and from the slider.
+ """
+ def __init__(self, minimum, maximum, num_steps, cast):
+ assert minimum < maximum
+ assert num_steps > 0
+ self._offset = minimum
+ self._scaler = float(maximum - minimum)/num_steps
+ self._cast = cast
+ def external_to_internal(self, v):
+ return (v - self._offset)/self._scaler
+ def internal_to_external(self, v):
+ return self._cast(v*self._scaler + self._offset)
+ def help(self):
+ return "Value should be within slider range"
+
+class log_slider_converter(slider_converter):
+ def __init__(self, min_exp, max_exp, num_steps, base):
+ assert min_exp < max_exp
+ assert num_steps > 0
+ self._base = base
+ slider_converter.__init__(self, minimum=min_exp, maximum=max_exp, num_steps=num_steps, cast=float)
+ def external_to_internal(self, v):
+ return slider_converter.external_to_internal(self, math.log(v, self._base))
+ def internal_to_external(self, v):
+ return self._base**slider_converter.internal_to_external(self, v)
diff --git a/gr-wxgui/src/python/forms/forms.py b/gr-wxgui/src/python/forms/forms.py
new file mode 100644
index 000000000..cabc5860b
--- /dev/null
+++ b/gr-wxgui/src/python/forms/forms.py
@@ -0,0 +1,653 @@
+#
+# 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.
+#
+
+"""
+The forms module contains general purpose wx-gui forms for gnuradio apps.
+
+The forms follow a layered model:
+ * internal layer
+ * deals with the wxgui objects directly
+ * implemented in event handler and update methods
+ * translation layer
+ * translates the between the external and internal layers
+ * handles parsing errors between layers
+ * external layer
+ * provided external access to the user
+ * set_value, get_value, and optional callback
+ * set and get through optional pubsub and key
+
+Known problems:
+ * An empty label in the radio box still consumes space.
+ * The static text cannot resize the parent at runtime.
+"""
+
+EXT_KEY = 'external'
+INT_KEY = 'internal'
+
+import wx
+import sys
+from gnuradio.gr.pubsub import pubsub
+import converters
+
+EVT_DATA = wx.PyEventBinder(wx.NewEventType())
+class DataEvent(wx.PyEvent):
+ def __init__(self, data):
+ wx.PyEvent.__init__(self, wx.NewId(), EVT_DATA.typeId)
+ self.data = data
+
+def make_bold(widget):
+ font = widget.GetFont()
+ font.SetWeight(wx.FONTWEIGHT_BOLD)
+ widget.SetFont(font)
+
+########################################################################
+# Base Class Form
+########################################################################
+class _form_base(pubsub, wx.BoxSizer):
+ def __init__(self, parent=None, sizer=None, proportion=0, flag=wx.EXPAND, ps=None, key='', value=None, callback=None, converter=converters.identity_converter()):
+ pubsub.__init__(self)
+ wx.BoxSizer.__init__(self, wx.HORIZONTAL)
+ self._parent = parent
+ self._key = key
+ self._converter = converter
+ self._callback = callback
+ self._widgets = list()
+ #add to the sizer if provided
+ if sizer: sizer.Add(self, proportion, flag)
+ #proxy the pubsub and key into this form
+ if ps is not None:
+ assert key
+ self.proxy(EXT_KEY, ps, key)
+ #no pubsub passed, must set initial value
+ else: self.set_value(value)
+
+ def __str__(self):
+ return "Form: %s -> %s"%(self.__class__, self._key)
+
+ def _add_widget(self, widget, label='', flag=0, label_prop=0, widget_prop=1):
+ """
+ Add the main widget to this object sizer.
+ If label is passed, add a label as well.
+ Register the widget and the label in the widgets list (for enable/disable).
+ Bind the update handler to the widget for data events.
+ This ensures that the gui thread handles updating widgets.
+ Setup the pusub triggers for external and internal.
+ @param widget the main widget
+ @param label the optional label
+ @param flag additional flags for widget
+ @param label_prop the proportion for the label
+ @param widget_prop the proportion for the widget
+ """
+ #setup data event
+ widget.Bind(EVT_DATA, lambda x: self._update(x.data))
+ update = lambda x: wx.PostEvent(widget, DataEvent(x))
+ #register widget
+ self._widgets.append(widget)
+ #create optional label
+ if not label: self.Add(widget, widget_prop, wx.ALIGN_CENTER_VERTICAL | flag)
+ else:
+ label_text = wx.StaticText(self._parent, label='%s: '%label)
+ self._widgets.append(label_text)
+ self.Add(label_text, label_prop, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_LEFT)
+ self.Add(widget, widget_prop, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT | flag)
+ #initialize without triggering pubsubs
+ self._translate_external_to_internal(self[EXT_KEY])
+ update(self[INT_KEY])
+ #subscribe all the functions
+ self.subscribe(INT_KEY, update)
+ self.subscribe(INT_KEY, self._translate_internal_to_external)
+ self.subscribe(EXT_KEY, self._translate_external_to_internal)
+
+ def _translate_external_to_internal(self, external):
+ try:
+ internal = self._converter.external_to_internal(external)
+ #prevent infinite loop between internal and external pubsub keys by only setting if changed
+ if self[INT_KEY] != internal: self[INT_KEY] = internal
+ except Exception, e:
+ self._err_msg(external, e)
+ self[INT_KEY] = self[INT_KEY] #reset to last good setting
+
+ def _translate_internal_to_external(self, internal):
+ try:
+ external = self._converter.internal_to_external(internal)
+ #prevent infinite loop between internal and external pubsub keys by only setting if changed
+ if self[EXT_KEY] != external: self[EXT_KEY] = external
+ except Exception, e:
+ self._err_msg(internal, e)
+ self[EXT_KEY] = self[EXT_KEY] #reset to last good setting
+ if self._callback: self._callback(self[EXT_KEY])
+
+ def _err_msg(self, value, e):
+ print >> sys.stderr, self, 'Error translating value: "%s"\n\t%s\n\t%s'%(value, e, self._converter.help())
+
+ #override in subclasses to handle the wxgui object
+ def _update(self, value): raise NotImplementedError
+ def _handle(self, event): raise NotImplementedError
+
+ #provide a set/get interface for this form
+ def get_value(self): return self[EXT_KEY]
+ def set_value(self, value): self[EXT_KEY] = value
+
+ def Disable(self, disable=True): self.Enable(not disable)
+ def Enable(self, enable=True):
+ if enable:
+ for widget in self._widgets: widget.Enable()
+ else:
+ for widget in self._widgets: widget.Disable()
+
+########################################################################
+# Base Class Chooser Form
+########################################################################
+class _chooser_base(_form_base):
+ def __init__(self, choices=[], labels=None, **kwargs):
+ _form_base.__init__(self, converter=converters.chooser_converter(choices), **kwargs)
+ self._choices = choices
+ self._labels = map(str, labels or choices)
+
+########################################################################
+# Base Class Slider Form
+########################################################################
+class _slider_base(_form_base):
+ def __init__(self, label='', length=-1, converter=None, num_steps=100, style=wx.SL_HORIZONTAL, **kwargs):
+ _form_base.__init__(self, converter=converter, **kwargs)
+ if style & wx.SL_HORIZONTAL: slider_size = wx.Size(length, -1)
+ elif style & wx.SL_VERTICAL: slider_size = wx.Size(-1, length)
+ else: raise NotImplementedError
+ self._slider = wx.Slider(self._parent, minValue=0, maxValue=num_steps, size=slider_size, style=style)
+ self._slider.Bind(wx.EVT_SCROLL, self._handle)
+ self._add_widget(self._slider, label, flag=wx.EXPAND)
+
+ def _handle(self, event): self[INT_KEY] = self._slider.GetValue()
+ def _update(self, value): self._slider.SetValue(int(round(value)))
+
+########################################################################
+# Static Text Form
+########################################################################
+class static_text(_form_base):
+ """
+ A text box form.
+ @param parent the parent widget
+ @param sizer add this widget to sizer if provided (optional)
+ @param proportion the proportion when added to the sizer (default=0)
+ @param flag the flag argument when added to the sizer (default=wx.EXPAND)
+ @param ps the pubsub object (optional)
+ @param key the pubsub key (optional)
+ @param value the default value (optional)
+ @param label title label for this widget (optional)
+ @param width the width of the form in px
+ @param bold true to bold-ify the text (default=False)
+ @param units a suffix to add after the text
+ @param converter forms.str_converter(), int_converter(), float_converter()...
+ """
+ def __init__(self, label='', width=-1, bold=False, units='', converter=converters.str_converter(), **kwargs):
+ self._units = units
+ _form_base.__init__(self, converter=converter, **kwargs)
+ self._static_text = wx.StaticText(self._parent, size=wx.Size(width, -1))
+ if bold: make_bold(self._static_text)
+ self._add_widget(self._static_text, label)
+
+ def _update(self, label):
+ if self._units: label += ' ' + self._units
+ self._static_text.SetLabel(label); self._parent.Layout()
+
+########################################################################
+# Text Box Form
+########################################################################
+class text_box(_form_base):
+ """
+ A text box form.
+ @param parent the parent widget
+ @param sizer add this widget to sizer if provided (optional)
+ @param proportion the proportion when added to the sizer (default=0)
+ @param flag the flag argument when added to the sizer (default=wx.EXPAND)
+ @param ps the pubsub object (optional)
+ @param key the pubsub key (optional)
+ @param value the default value (optional)
+ @param label title label for this widget (optional)
+ @param width the width of the form in px
+ @param converter forms.str_converter(), int_converter(), float_converter()...
+ """
+ def __init__(self, label='', width=-1, converter=converters.eval_converter(), **kwargs):
+ _form_base.__init__(self, converter=converter, **kwargs)
+ self._text_box = wx.TextCtrl(self._parent, size=wx.Size(width, -1), style=wx.TE_PROCESS_ENTER)
+ self._default_bg_colour = self._text_box.GetBackgroundColour()
+ self._text_box.Bind(wx.EVT_TEXT_ENTER, self._handle)
+ self._text_box.Bind(wx.EVT_TEXT, self._update_color)
+ self._add_widget(self._text_box, label)
+
+ def _update_color(self, *args):
+ if self._text_box.GetValue() == self[INT_KEY]:
+ self._text_box.SetBackgroundColour(self._default_bg_colour)
+ else: self._text_box.SetBackgroundColour('#EEDDDD')
+
+ def _handle(self, event): self[INT_KEY] = self._text_box.GetValue()
+ def _update(self, value): self._text_box.SetValue(value); self._update_color()
+
+########################################################################
+# Slider Form
+# Linear Slider
+# Logarithmic Slider
+########################################################################
+class slider(_slider_base):
+ """
+ A generic linear slider.
+ @param parent the parent widget
+ @param sizer add this widget to sizer if provided (optional)
+ @param proportion the proportion when added to the sizer (default=0)
+ @param flag the flag argument when added to the sizer (default=wx.EXPAND)
+ @param ps the pubsub object (optional)
+ @param key the pubsub key (optional)
+ @param value the default value (optional)
+ @param label title label for this widget (optional)
+ @param length the length of the slider in px (optional)
+ @param style wx.SL_HORIZONTAL or wx.SL_VERTICAL (default=horizontal)
+ @param minimum the minimum value
+ @param maximum the maximum value
+ @param num_steps the number of slider steps (or specify step_size)
+ @param step_size the step between slider jumps (or specify num_steps)
+ @param cast a cast function, int, or float (default=float)
+ """
+ def __init__(self, minimum=-100, maximum=100, num_steps=100, step_size=None, cast=float, **kwargs):
+ assert step_size or num_steps
+ if step_size is not None: num_steps = (maximum - minimum)/step_size
+ converter = converters.slider_converter(minimum=minimum, maximum=maximum, num_steps=num_steps, cast=cast)
+ _slider_base.__init__(self, converter=converter, num_steps=num_steps, **kwargs)
+
+class log_slider(_slider_base):
+ """
+ A generic logarithmic slider.
+ The sliders min and max values are base**min_exp and base**max_exp.
+ @param parent the parent widget
+ @param sizer add this widget to sizer if provided (optional)
+ @param proportion the proportion when added to the sizer (default=0)
+ @param flag the flag argument when added to the sizer (default=wx.EXPAND)
+ @param ps the pubsub object (optional)
+ @param key the pubsub key (optional)
+ @param value the default value (optional)
+ @param label title label for this widget (optional)
+ @param length the length of the slider in px (optional)
+ @param style wx.SL_HORIZONTAL or wx.SL_VERTICAL (default=horizontal)
+ @param min_exp the minimum exponent
+ @param max_exp the maximum exponent
+ @param base the exponent base in base**exp
+ @param num_steps the number of slider steps (or specify step_size)
+ @param step_size the exponent step size (or specify num_steps)
+ """
+ def __init__(self, min_exp=0, max_exp=1, base=10, num_steps=100, step_size=None, **kwargs):
+ assert step_size or num_steps
+ if step_size is not None: num_steps = (max_exp - min_exp)/step_size
+ converter = converters.log_slider_converter(min_exp=min_exp, max_exp=max_exp, num_steps=num_steps, base=base)
+ _slider_base.__init__(self, converter=converter, num_steps=num_steps, **kwargs)
+
+########################################################################
+# Gauge Form
+########################################################################
+class gauge(_form_base):
+ """
+ A gauge bar.
+ The gauge displays floating point values between the minimum and maximum.
+ @param parent the parent widget
+ @param sizer add this widget to sizer if provided (optional)
+ @param proportion the proportion when added to the sizer (default=0)
+ @param flag the flag argument when added to the sizer (default=wx.EXPAND)
+ @param ps the pubsub object (optional)
+ @param key the pubsub key (optional)
+ @param value the default value (optional)
+ @param label title label for this widget (optional)
+ @param length the length of the slider in px (optional)
+ @param style wx.GA_HORIZONTAL or wx.GA_VERTICAL (default=horizontal)
+ @param minimum the minimum value
+ @param maximum the maximum value
+ @param num_steps the number of slider steps (or specify step_size)
+ @param step_size the step between slider jumps (or specify num_steps)
+ """
+ def __init__(self, label='', length=-1, minimum=-100, maximum=100, num_steps=100, step_size=None, style=wx.GA_HORIZONTAL, **kwargs):
+ assert step_size or num_steps
+ if step_size is not None: num_steps = (maximum - minimum)/step_size
+ converter = converters.slider_converter(minimum=minimum, maximum=maximum, num_steps=num_steps, cast=float)
+ _form_base.__init__(self, converter=converter, **kwargs)
+ if style & wx.SL_HORIZONTAL: gauge_size = wx.Size(length, -1)
+ elif style & wx.SL_VERTICAL: gauge_size = wx.Size(-1, length)
+ else: raise NotImplementedError
+ self._gauge = wx.Gauge(self._parent, range=num_steps, size=gauge_size, style=style)
+ self._add_widget(self._gauge, label, flag=wx.EXPAND)
+
+ def _update(self, value): self._gauge.SetValue(value)
+
+########################################################################
+# Check Box Form
+########################################################################
+class check_box(_form_base):
+ """
+ Create a check box form.
+ @param parent the parent widget
+ @param sizer add this widget to sizer if provided (optional)
+ @param proportion the proportion when added to the sizer (default=0)
+ @param flag the flag argument when added to the sizer (default=wx.EXPAND)
+ @param ps the pubsub object (optional)
+ @param key the pubsub key (optional)
+ @param value the default value (optional)
+ @param true the value for form when checked (default=True)
+ @param false the value for form when unchecked (default=False)
+ @param label title label for this widget (optional)
+ """
+ def __init__(self, label='', true=True, false=False, **kwargs):
+ _form_base.__init__(self, converter=converters.bool_converter(true=true, false=false), **kwargs)
+ self._check_box = wx.CheckBox(self._parent, style=wx.CHK_2STATE, label=label)
+ self._check_box.Bind(wx.EVT_CHECKBOX, self._handle)
+ self._add_widget(self._check_box)
+
+ def _handle(self, event): self[INT_KEY] = self._check_box.IsChecked()
+ def _update(self, checked): self._check_box.SetValue(checked)
+
+########################################################################
+# Drop Down Chooser Form
+########################################################################
+class drop_down(_chooser_base):
+ """
+ Create a drop down menu form.
+ @param parent the parent widget
+ @param sizer add this widget to sizer if provided (optional)
+ @param proportion the proportion when added to the sizer (default=0)
+ @param flag the flag argument when added to the sizer (default=wx.EXPAND)
+ @param ps the pubsub object (optional)
+ @param key the pubsub key (optional)
+ @param value the default value (optional)
+ @param choices list of possible values
+ @param labels list of labels for each choice (default=choices)
+ @param label title label for this widget (optional)
+ @param width the form width in px (optional)
+ """
+ def __init__(self, label='', width=-1, **kwargs):
+ _chooser_base.__init__(self, **kwargs)
+ self._drop_down = wx.Choice(self._parent, choices=self._labels, size=wx.Size(width, -1))
+ self._drop_down.Bind(wx.EVT_CHOICE, self._handle)
+ self._add_widget(self._drop_down, label, widget_prop=0, label_prop=1)
+
+ def _handle(self, event): self[INT_KEY] = self._drop_down.GetSelection()
+ def _update(self, i): self._drop_down.SetSelection(i)
+
+########################################################################
+# Button Chooser Form
+# Circularly move through the choices with each click.
+# Can be a single-click button with one choice.
+# Can be a 2-state button with two choices.
+########################################################################
+class button(_chooser_base):
+ """
+ Create a multi-state button.
+ @param parent the parent widget
+ @param sizer add this widget to sizer if provided (optional)
+ @param proportion the proportion when added to the sizer (default=0)
+ @param flag the flag argument when added to the sizer (default=wx.EXPAND)
+ @param ps the pubsub object (optional)
+ @param key the pubsub key (optional)
+ @param value the default value (optional)
+ @param choices list of possible values
+ @param labels list of labels for each choice (default=choices)
+ @param width the width of the button in pixels (optional)
+ @param style style arguments (optional)
+ @param label title label for this widget (optional)
+ """
+ def __init__(self, label='', style=0, width=-1, **kwargs):
+ _chooser_base.__init__(self, **kwargs)
+ self._button = wx.Button(self._parent, size=wx.Size(width, -1), style=style)
+ self._button.Bind(wx.EVT_BUTTON, self._handle)
+ self._add_widget(self._button, label, widget_prop=((not style&wx.BU_EXACTFIT) and 1 or 0))
+
+ def _handle(self, event): self[INT_KEY] = (self[INT_KEY] + 1)%len(self._choices) #circularly increment index
+ def _update(self, i): self._button.SetLabel(self._labels[i]); self.Layout()
+
+class toggle_button(button):
+ """
+ Create a dual-state button.
+ This button will alternate between True and False when clicked.
+ @param parent the parent widget
+ @param sizer add this widget to sizer if provided (optional)
+ @param proportion the proportion when added to the sizer (default=0)
+ @param flag the flag argument when added to the sizer (default=wx.EXPAND)
+ @param ps the pubsub object (optional)
+ @param key the pubsub key (optional)
+ @param value the default value (optional)
+ @param width the width of the button in pixels (optional)
+ @param style style arguments (optional)
+ @param true_label the button's label in the true state
+ @param false_label the button's label in the false state
+ """
+ def __init__(self, true_label='On (click to stop)', false_label='Off (click to start)', **kwargs):
+ button.__init__(self, choices=[True, False], labels=[true_label, false_label], **kwargs)
+
+class single_button(toggle_button):
+ """
+ Create a single state button.
+ This button will callback() when clicked.
+ For use when state holding is not important.
+ @param parent the parent widget
+ @param sizer add this widget to sizer if provided (optional)
+ @param proportion the proportion when added to the sizer (default=0)
+ @param flag the flag argument when added to the sizer (default=wx.EXPAND)
+ @param ps the pubsub object (optional)
+ @param key the pubsub key (optional)
+ @param value the default value (optional)
+ @param width the width of the button in pixels (optional)
+ @param style style arguments (optional)
+ @param label the button's label
+ """
+ def __init__(self, label='click for callback', **kwargs):
+ toggle_button.__init__(self, true_label=label, false_label=label, value=True, **kwargs)
+
+########################################################################
+# Radio Buttons Chooser Form
+########################################################################
+class radio_buttons(_chooser_base):
+ """
+ Create a radio button form.
+ @param parent the parent widget
+ @param sizer add this widget to sizer if provided (optional)
+ @param proportion the proportion when added to the sizer (default=0)
+ @param flag the flag argument when added to the sizer (default=wx.EXPAND)
+ @param ps the pubsub object (optional)
+ @param key the pubsub key (optional)
+ @param value the default value (optional)
+ @param choices list of possible values
+ @param labels list of labels for each choice (default=choices)
+ @param major_dimension the number of rows/cols (default=auto)
+ @param label title label for this widget (optional)
+ @param style useful style args: wx.RA_HORIZONTAL, wx.RA_VERTICAL, wx.NO_BORDER (default=wx.RA_HORIZONTAL)
+ """
+ def __init__(self, style=wx.RA_HORIZONTAL, label='', major_dimension=0, **kwargs):
+ _chooser_base.__init__(self, **kwargs)
+ #create radio buttons
+ self._radio_buttons = wx.RadioBox(self._parent, choices=self._labels, style=style, label=label, majorDimension=major_dimension)
+ self._radio_buttons.Bind(wx.EVT_RADIOBOX, self._handle)
+ self._add_widget(self._radio_buttons)
+
+ def _handle(self, event): self[INT_KEY] = self._radio_buttons.GetSelection()
+ def _update(self, i): self._radio_buttons.SetSelection(i)
+
+########################################################################
+# Notebook Chooser Form
+# The notebook pages/tabs are for selecting between choices.
+# A page must be added to the notebook for each choice.
+########################################################################
+class notebook(_chooser_base):
+ def __init__(self, pages, notebook, **kwargs):
+ _chooser_base.__init__(self, **kwargs)
+ assert len(pages) == len(self._choices)
+ self._notebook = notebook
+ self._notebook.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGED, self._handle)
+ #add pages, setting the label on each tab
+ for i, page in enumerate(pages):
+ self._notebook.AddPage(page, self._labels[i])
+ self._add_widget(self._notebook)
+
+ def _handle(self, event): self[INT_KEY] = self._notebook.GetSelection()
+ # SetSelection triggers a page change event (deprecated, breaks on Windows) and ChangeSelection does not
+ def _update(self, i): self._notebook.ChangeSelection(i)
+
+# ----------------------------------------------------------------
+# Stand-alone test application
+# ----------------------------------------------------------------
+
+import wx
+from gnuradio.wxgui import gui
+
+class app_gui (object):
+ def __init__(self, frame, panel, vbox, top_block, options, args):
+
+ def callback(v): print v
+
+ radio_buttons(
+ sizer=vbox,
+ parent=panel,
+ choices=[2, 4, 8, 16],
+ labels=['two', 'four', 'eight', 'sixteen'],
+ value=4,
+ style=wx.RA_HORIZONTAL,
+ label='test radio long string',
+ callback=callback,
+ #major_dimension = 2,
+ )
+
+ radio_buttons(
+ sizer=vbox,
+ parent=panel,
+ choices=[2, 4, 8, 16],
+ labels=['two', 'four', 'eight', 'sixteen'],
+ value=4,
+ style=wx.RA_VERTICAL,
+ label='test radio long string',
+ callback=callback,
+ #major_dimension = 2,
+ )
+
+ radio_buttons(
+ sizer=vbox,
+ parent=panel,
+ choices=[2, 4, 8, 16],
+ labels=['two', 'four', 'eight', 'sixteen'],
+ value=4,
+ style=wx.RA_VERTICAL | wx.NO_BORDER,
+ callback=callback,
+ #major_dimension = 2,
+ )
+
+ button(
+ sizer=vbox,
+ parent=panel,
+ choices=[2, 4, 8, 16],
+ labels=['two', 'four', 'eight', 'sixteen'],
+ value=2,
+ label='button value',
+ callback=callback,
+ #width=100,
+ )
+
+
+ drop_down(
+ sizer=vbox,
+ parent=panel,
+ choices=[2, 4, 8, 16],
+ value=2,
+ label='Choose One',
+ callback=callback,
+ )
+ check_box(
+ sizer=vbox,
+ parent=panel,
+ value=False,
+ label='check me',
+ callback=callback,
+ )
+ text_box(
+ sizer=vbox,
+ parent=panel,
+ value=3,
+ label='text box',
+ callback=callback,
+ width=200,
+ )
+
+ static_text(
+ sizer=vbox,
+ parent=panel,
+ value='bob',
+ label='static text',
+ width=-1,
+ bold=True,
+ )
+
+ slider(
+ sizer=vbox,
+ parent=panel,
+ value=12,
+ label='slider',
+ callback=callback,
+ )
+
+ log_slider(
+ sizer=vbox,
+ parent=panel,
+ value=12,
+ label='slider',
+ callback=callback,
+ )
+
+ slider(
+ sizer=vbox,
+ parent=panel,
+ value=12,
+ label='slider',
+ callback=callback,
+ style=wx.SL_VERTICAL,
+ length=30,
+ )
+
+ toggle_button(
+ sizer=vbox,
+ parent=panel,
+ value=True,
+ label='toggle it',
+ callback=callback,
+ )
+
+ single_button(
+ sizer=vbox,
+ parent=panel,
+ label='sig test',
+ callback=callback,
+ )
+
+if __name__ == "__main__":
+ try:
+
+ # Create the GUI application
+ app = gui.app(
+ gui=app_gui, # User interface class
+ title="Test Forms", # Top window title
+ )
+
+ # And run it
+ app.MainLoop()
+
+ except RuntimeError, e:
+ print e
+ sys.exit(1)
diff --git a/gr-wxgui/src/python/gui.py b/gr-wxgui/src/python/gui.py
new file mode 100644
index 000000000..ccc773eab
--- /dev/null
+++ b/gr-wxgui/src/python/gui.py
@@ -0,0 +1,135 @@
+#
+# 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.
+#
+
+import wx
+from gnuradio import gr
+
+#
+# Top-level display panel with vertical box sizer. User does not create or
+# subclass this class; rather, the user supplies his own class constructor
+# that gets invoked with needed parameters.
+#
+class top_panel(wx.Panel):
+ def __init__(self, frame, top_block, gui, options, args):
+ wx.Panel.__init__(self, frame, -1)
+ vbox = wx.BoxSizer(wx.VERTICAL)
+
+ # Create the user's GUI class
+ if gui is not None:
+ self.gui = gui(frame, # Top-level window frame
+ self, # Parent class for user created windows
+ vbox, # Sizer for user to add windows to
+ top_block, # GUI-unaware flowgraph to manipulate
+ options, # Command-line options
+ args) # Command-line arguments
+
+ else:
+ # User hasn't made their own GUI, create our default
+ # We don't have a default GUI yet either :)
+ p = wx.Panel(self)
+ p.SetSize((640,480))
+ vbox.Add(p, 1, wx.EXPAND)
+
+ self.SetSizer(vbox)
+ self.SetAutoLayout(True)
+ vbox.Fit(self)
+
+ def shutdown(self):
+ try:
+ self.gui.shutdown()
+ except AttributeError:
+ pass
+
+#
+# Top-level window frame with menu and status bars.
+#
+class top_frame(wx.Frame):
+ def __init__ (self, top_block, gui, options, args,
+ title, nstatus, start, realtime):
+
+ wx.Frame.__init__(self, None, -1, title)
+ self.top_block = top_block
+
+ self.CreateStatusBar(nstatus)
+ mainmenu = wx.MenuBar()
+ self.SetMenuBar(mainmenu)
+
+ menu = wx.Menu()
+
+ item = menu.Append(200, 'E&xit', 'Exit Application') # FIXME magic ID
+ self.Bind(wx.EVT_MENU, self.OnCloseWindow, item)
+ mainmenu.Append(menu, "&File")
+ self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
+
+ # Create main panel, creates user GUI class with supplied parameters
+ self.panel = top_panel(self, top_block, gui, options, args)
+
+ vbox = wx.BoxSizer(wx.VERTICAL)
+ vbox.Add(self.panel, 1, wx.EXPAND)
+ self.SetSizer(vbox)
+ self.SetAutoLayout(True)
+ vbox.Fit(self)
+
+ if realtime:
+ if gr.enable_realtime_scheduling() != gr.RT_OK:
+ self.SetStatusText("Failed to enable realtime scheduling")
+
+ if start and self.top_block is not None:
+ self.top_block.start()
+
+ def OnCloseWindow(self, event):
+ # Give user API a chance to do something
+ self.panel.shutdown()
+
+ # Stop flowgraph as a convenience
+ self.SetStatusText("Ensuring flowgraph has completed before exiting...")
+ if self.top_block is not None:
+ self.top_block.stop()
+ self.top_block.wait()
+
+ self.Destroy()
+
+
+#
+# Top-level wxPython application object. User creates or subclasses this
+# in their GUI script.
+#
+class app(wx.App):
+ def __init__ (self, top_block=None, gui=None, options=None, args=None,
+ title="GNU Radio", nstatus=1, start=False, realtime=False):
+ self.top_block = top_block
+ self.gui = gui
+ self.options = options
+ self.args = args
+ self.title = title
+ self.nstatus = nstatus
+ self.start = start
+ self.realtime = realtime
+
+ wx.App.__init__ (self, redirect=False)
+
+ def OnInit(self):
+ # Pass user parameters to top window frame
+ frame = top_frame(self.top_block, self.gui, self.options, self.args,
+ self.title, self.nstatus, self.start, self.realtime)
+ frame.Show(True)
+ self.SetTopWindow(frame)
+ return True
diff --git a/gr-wxgui/src/python/histo_window.py b/gr-wxgui/src/python/histo_window.py
new file mode 100644
index 000000000..e87e97825
--- /dev/null
+++ b/gr-wxgui/src/python/histo_window.py
@@ -0,0 +1,164 @@
+#
+# 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.
+#
+
+##################################################
+# Imports
+##################################################
+import plotter
+import common
+import wx
+import numpy
+import math
+import pubsub
+from constants import *
+from gnuradio import gr #for gr.prefs
+import forms
+
+##################################################
+# Constants
+##################################################
+DEFAULT_WIN_SIZE = (600, 300)
+
+##################################################
+# histo window control panel
+##################################################
+class control_panel(wx.Panel):
+ """
+ A control panel with wx widgits to control the plotter and histo sink.
+ """
+
+ def __init__(self, parent):
+ """
+ Create a new control panel.
+ @param parent the wx parent window
+ """
+ self.parent = parent
+ wx.Panel.__init__(self, parent, style=wx.SUNKEN_BORDER)
+ parent[SHOW_CONTROL_PANEL_KEY] = True
+ parent.subscribe(SHOW_CONTROL_PANEL_KEY, self.Show)
+ control_box = wx.BoxSizer(wx.VERTICAL)
+ SIZE = (100, -1)
+ control_box = forms.static_box_sizer(
+ parent=self, label='Options',
+ bold=True, orient=wx.VERTICAL,
+ )
+ #num bins
+ control_box.AddStretchSpacer()
+ forms.text_box(
+ sizer=control_box, parent=self, label='Num Bins',
+ converter=forms.int_converter(),
+ ps=parent, key=NUM_BINS_KEY,
+ )
+ #frame size
+ control_box.AddStretchSpacer()
+ forms.text_box(
+ sizer=control_box, parent=self, label='Frame Size',
+ converter=forms.int_converter(),
+ ps=parent, key=FRAME_SIZE_KEY,
+ )
+ #run/stop
+ control_box.AddStretchSpacer()
+ forms.toggle_button(
+ sizer=control_box, parent=self,
+ true_label='Stop', false_label='Run',
+ ps=parent, key=RUNNING_KEY,
+ )
+ #set sizer
+ self.SetSizerAndFit(control_box)
+
+##################################################
+# histo window with plotter and control panel
+##################################################
+class histo_window(wx.Panel, pubsub.pubsub):
+ def __init__(
+ self,
+ parent,
+ controller,
+ size,
+ title,
+ maximum_key,
+ minimum_key,
+ num_bins_key,
+ frame_size_key,
+ msg_key,
+ ):
+ pubsub.pubsub.__init__(self)
+ #setup
+ self.samples = list()
+ #proxy the keys
+ self.proxy(MAXIMUM_KEY, controller, maximum_key)
+ self.proxy(MINIMUM_KEY, controller, minimum_key)
+ self.proxy(NUM_BINS_KEY, controller, num_bins_key)
+ self.proxy(FRAME_SIZE_KEY, controller, frame_size_key)
+ self.proxy(MSG_KEY, controller, msg_key)
+ #initialize values
+ self[RUNNING_KEY] = True
+ self[X_DIVS_KEY] = 8
+ self[Y_DIVS_KEY] = 4
+ #init panel and plot
+ wx.Panel.__init__(self, parent, style=wx.SIMPLE_BORDER)
+ self.plotter = plotter.bar_plotter(self)
+ self.plotter.SetSize(wx.Size(*size))
+ self.plotter.SetSizeHints(*size)
+ self.plotter.set_title(title)
+ self.plotter.enable_point_label(True)
+ self.plotter.enable_grid_lines(False)
+ #setup the box with plot and controls
+ self.control_panel = control_panel(self)
+ main_box = wx.BoxSizer(wx.HORIZONTAL)
+ main_box.Add(self.plotter, 1, wx.EXPAND)
+ main_box.Add(self.control_panel, 0, wx.EXPAND)
+ self.SetSizerAndFit(main_box)
+ #register events
+ self.subscribe(MSG_KEY, self.handle_msg)
+ self.subscribe(X_DIVS_KEY, self.update_grid)
+ self.subscribe(Y_DIVS_KEY, self.update_grid)
+
+ def handle_msg(self, msg):
+ """
+ Handle the message from the fft sink message queue.
+ @param msg the frame as a character array
+ """
+ if not self[RUNNING_KEY]: return
+ #convert to floating point numbers
+ self.samples = 100*numpy.fromstring(msg, numpy.float32)[:self[NUM_BINS_KEY]] #only take first frame
+ self.plotter.set_bars(
+ bars=self.samples,
+ bar_width=0.6,
+ color_spec=(0, 0, 1),
+ )
+ self.update_grid()
+
+ def update_grid(self):
+ if not len(self.samples): return
+ #calculate the maximum y value
+ y_off = math.ceil(numpy.max(self.samples))
+ y_off = min(max(y_off, 1.0), 100.0) #between 1% and 100%
+ #update the x grid
+ self.plotter.set_x_grid(
+ self[MINIMUM_KEY], self[MAXIMUM_KEY],
+ common.get_clean_num((self[MAXIMUM_KEY] - self[MINIMUM_KEY])/self[X_DIVS_KEY]),
+ )
+ self.plotter.set_x_label('Counts')
+ #update the y grid
+ self.plotter.set_y_grid(0, y_off, y_off/self[Y_DIVS_KEY])
+ self.plotter.set_y_label('Frequency', '%')
+ self.plotter.update()
diff --git a/gr-wxgui/src/python/histosink_gl.py b/gr-wxgui/src/python/histosink_gl.py
new file mode 100644
index 000000000..509f746be
--- /dev/null
+++ b/gr-wxgui/src/python/histosink_gl.py
@@ -0,0 +1,110 @@
+#
+# 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.
+#
+
+##################################################
+# Imports
+##################################################
+import histo_window
+import common
+from gnuradio import gr, blks2
+from pubsub import pubsub
+from constants import *
+
+##################################################
+# histo sink block (wrapper for old wxgui)
+##################################################
+class histo_sink_f(gr.hier_block2, common.wxgui_hb):
+ """
+ A histogram block and a gui window.
+ """
+
+ def __init__(
+ self,
+ parent,
+ size=histo_window.DEFAULT_WIN_SIZE,
+ title='',
+ num_bins=11,
+ frame_size=1000,
+ ):
+ #init
+ gr.hier_block2.__init__(
+ self,
+ "histo_sink",
+ gr.io_signature(1, 1, gr.sizeof_float),
+ gr.io_signature(0, 0, 0),
+ )
+ #blocks
+ msgq = gr.msg_queue(2)
+ histo = gr.histo_sink_f(msgq)
+ histo.set_num_bins(num_bins)
+ histo.set_frame_size(frame_size)
+ #controller
+ self.controller = pubsub()
+ self.controller.subscribe(NUM_BINS_KEY, histo.set_num_bins)
+ self.controller.publish(NUM_BINS_KEY, histo.get_num_bins)
+ self.controller.subscribe(FRAME_SIZE_KEY, histo.set_frame_size)
+ self.controller.publish(FRAME_SIZE_KEY, histo.get_frame_size)
+ #start input watcher
+ common.input_watcher(msgq, self.controller, MSG_KEY, arg1_key=MINIMUM_KEY, arg2_key=MAXIMUM_KEY)
+ #create window
+ self.win = histo_window.histo_window(
+ parent=parent,
+ controller=self.controller,
+ size=size,
+ title=title,
+ maximum_key=MAXIMUM_KEY,
+ minimum_key=MINIMUM_KEY,
+ num_bins_key=NUM_BINS_KEY,
+ frame_size_key=FRAME_SIZE_KEY,
+ msg_key=MSG_KEY,
+ )
+ common.register_access_methods(self, self.win)
+ #connect
+ self.wxgui_connect(self, histo)
+
+# ----------------------------------------------------------------
+# Standalone test app
+# ----------------------------------------------------------------
+
+import wx
+from gnuradio.wxgui import stdgui2
+
+class test_app_block (stdgui2.std_top_block):
+ def __init__(self, frame, panel, vbox, argv):
+ stdgui2.std_top_block.__init__ (self, frame, panel, vbox, argv)
+
+ # build our flow graph
+ input_rate = 20.48e3
+
+ src2 = gr.sig_source_f (input_rate, gr.GR_SIN_WAVE, 2e3, 1)
+ #src2 = gr.sig_source_f (input_rate, gr.GR_CONST_WAVE, 5.75e3, 1)
+ thr2 = gr.throttle(gr.sizeof_float, input_rate)
+ sink2 = histo_sink_f (panel, title="Data", num_bins=31, frame_size=1000)
+ vbox.Add (sink2.win, 1, wx.EXPAND)
+
+ self.connect(src2, thr2, sink2)
+
+def main ():
+ app = stdgui2.stdapp (test_app_block, "Histo Sink Test App")
+ app.MainLoop ()
+
+if __name__ == '__main__':
+ main ()
diff --git a/gr-wxgui/src/python/number_window.py b/gr-wxgui/src/python/number_window.py
new file mode 100644
index 000000000..ab9d1ebc0
--- /dev/null
+++ b/gr-wxgui/src/python/number_window.py
@@ -0,0 +1,213 @@
+#
+# 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.
+#
+
+##################################################
+# Imports
+##################################################
+import common
+import numpy
+import wx
+import pubsub
+from constants import *
+from gnuradio import gr #for gr.prefs
+import forms
+
+##################################################
+# Constants
+##################################################
+NEG_INF = float('-inf')
+SLIDER_STEPS = 100
+AVG_ALPHA_MIN_EXP, AVG_ALPHA_MAX_EXP = -3, 0
+DEFAULT_NUMBER_RATE = gr.prefs().get_long('wxgui', 'number_rate', 5)
+DEFAULT_WIN_SIZE = (300, 300)
+DEFAULT_GAUGE_RANGE = 1000
+VALUE_REPR_KEY = 'value_repr'
+VALUE_REAL_KEY = 'value_real'
+VALUE_IMAG_KEY = 'value_imag'
+
+##################################################
+# Number window control panel
+##################################################
+class control_panel(wx.Panel):
+ """
+ A control panel with wx widgits to control the averaging.
+ """
+
+ def __init__(self, parent):
+ """
+ Create a new control panel.
+ @param parent the wx parent window
+ """
+ self.parent = parent
+ wx.Panel.__init__(self, parent)
+ parent[SHOW_CONTROL_PANEL_KEY] = True
+ parent.subscribe(SHOW_CONTROL_PANEL_KEY, self.Show)
+ control_box = wx.BoxSizer(wx.VERTICAL)
+ #checkboxes for average and peak hold
+ control_box.AddStretchSpacer()
+ options_box = forms.static_box_sizer(
+ parent=self, sizer=control_box, label='Options',
+ bold=True, orient=wx.VERTICAL,
+ )
+ forms.check_box(
+ sizer=options_box, parent=self, label='Peak Hold',
+ ps=parent, key=PEAK_HOLD_KEY,
+ )
+ forms.check_box(
+ sizer=options_box, parent=self, label='Average',
+ ps=parent, key=AVERAGE_KEY,
+ )
+ #static text and slider for averaging
+ avg_alpha_text = forms.static_text(
+ sizer=options_box, parent=self, label='Avg Alpha',
+ converter=forms.float_converter(lambda x: '%.4f'%x),
+ ps=parent, key=AVG_ALPHA_KEY, width=50,
+ )
+ avg_alpha_slider = forms.log_slider(
+ sizer=options_box, parent=self,
+ min_exp=AVG_ALPHA_MIN_EXP,
+ max_exp=AVG_ALPHA_MAX_EXP,
+ num_steps=SLIDER_STEPS,
+ ps=parent, key=AVG_ALPHA_KEY,
+ )
+ for widget in (avg_alpha_text, avg_alpha_slider):
+ parent.subscribe(AVERAGE_KEY, widget.Enable)
+ widget.Enable(parent[AVERAGE_KEY])
+ #run/stop
+ control_box.AddStretchSpacer()
+ forms.toggle_button(
+ sizer=control_box, parent=self,
+ true_label='Stop', false_label='Run',
+ ps=parent, key=RUNNING_KEY,
+ )
+ #set sizer
+ self.SetSizerAndFit(control_box)
+
+##################################################
+# Numbersink window with label and gauges
+##################################################
+class number_window(wx.Panel, pubsub.pubsub):
+ def __init__(
+ self,
+ parent,
+ controller,
+ size,
+ title,
+ units,
+ show_gauge,
+ real,
+ minval,
+ maxval,
+ decimal_places,
+ average_key,
+ avg_alpha_key,
+ peak_hold,
+ msg_key,
+ sample_rate_key,
+ ):
+ pubsub.pubsub.__init__(self)
+ wx.Panel.__init__(self, parent, style=wx.SUNKEN_BORDER)
+ #setup
+ self.peak_val_real = NEG_INF
+ self.peak_val_imag = NEG_INF
+ self.real = real
+ self.units = units
+ self.decimal_places = decimal_places
+ #proxy the keys
+ self.proxy(MSG_KEY, controller, msg_key)
+ self.proxy(AVERAGE_KEY, controller, average_key)
+ self.proxy(AVG_ALPHA_KEY, controller, avg_alpha_key)
+ self.proxy(SAMPLE_RATE_KEY, controller, sample_rate_key)
+ #initialize values
+ self[PEAK_HOLD_KEY] = peak_hold
+ self[RUNNING_KEY] = True
+ self[VALUE_REAL_KEY] = minval
+ self[VALUE_IMAG_KEY] = minval
+ #setup the box with display and controls
+ self.control_panel = control_panel(self)
+ main_box = wx.BoxSizer(wx.HORIZONTAL)
+ sizer = forms.static_box_sizer(
+ parent=self, sizer=main_box, label=title,
+ bold=True, orient=wx.VERTICAL, proportion=1,
+ )
+ main_box.Add(self.control_panel, 0, wx.EXPAND)
+ sizer.AddStretchSpacer()
+ forms.static_text(
+ parent=self, sizer=sizer,
+ ps=self, key=VALUE_REPR_KEY, width=size[0],
+ converter=forms.str_converter(),
+ )
+ sizer.AddStretchSpacer()
+ self.gauge_real = forms.gauge(
+ parent=self, sizer=sizer, style=wx.GA_HORIZONTAL,
+ ps=self, key=VALUE_REAL_KEY, length=size[0],
+ minimum=minval, maximum=maxval, num_steps=DEFAULT_GAUGE_RANGE,
+ )
+ self.gauge_imag = forms.gauge(
+ parent=self, sizer=sizer, style=wx.GA_HORIZONTAL,
+ ps=self, key=VALUE_IMAG_KEY, length=size[0],
+ minimum=minval, maximum=maxval, num_steps=DEFAULT_GAUGE_RANGE,
+ )
+ #hide/show gauges
+ self.show_gauges(show_gauge)
+ self.SetSizerAndFit(main_box)
+ #register events
+ self.subscribe(MSG_KEY, self.handle_msg)
+
+ def show_gauges(self, show_gauge):
+ """
+ Show or hide the gauges.
+ If this is real, never show the imaginary gauge.
+ @param show_gauge true to show
+ """
+ self.gauge_real.ShowItems(show_gauge)
+ self.gauge_imag.ShowItems(show_gauge and not self.real)
+
+ def handle_msg(self, msg):
+ """
+ Handle a message from the message queue.
+ Convert the string based message into a float or complex.
+ If more than one number was read, only take the last number.
+ Perform peak hold operations, set the gauges and display.
+ @param event event.data is the number sample as a character array
+ """
+ if not self[RUNNING_KEY]: return
+ format_string = "%%.%df"%self.decimal_places
+ if self.real:
+ sample = numpy.fromstring(msg, numpy.float32)[-1]
+ if self[PEAK_HOLD_KEY]: sample = self.peak_val_real = max(self.peak_val_real, sample)
+ label_text = "%s %s"%(format_string%sample, self.units)
+ self[VALUE_REAL_KEY] = sample
+ else:
+ sample = numpy.fromstring(msg, numpy.complex64)[-1]
+ if self[PEAK_HOLD_KEY]:
+ self.peak_val_real = max(self.peak_val_real, sample.real)
+ self.peak_val_imag = max(self.peak_val_imag, sample.imag)
+ sample = self.peak_val_real + self.peak_val_imag*1j
+ label_text = "%s + %sj %s"%(format_string%sample.real, format_string%sample.imag, self.units)
+ self[VALUE_REAL_KEY] = sample.real
+ self[VALUE_IMAG_KEY] = sample.imag
+ #set label text
+ self[VALUE_REPR_KEY] = label_text
+ #clear peak hold
+ if not self[PEAK_HOLD_KEY]:
+ self.peak_val_real = NEG_INF
+ self.peak_val_imag = NEG_INF
diff --git a/gr-wxgui/src/python/numbersink2.py b/gr-wxgui/src/python/numbersink2.py
new file mode 100644
index 000000000..011acdfd5
--- /dev/null
+++ b/gr-wxgui/src/python/numbersink2.py
@@ -0,0 +1,171 @@
+#
+# 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.
+#
+
+##################################################
+# Imports
+##################################################
+import number_window
+import common
+from gnuradio import gr, blks2
+from pubsub import pubsub
+from constants import *
+
+##################################################
+# Number sink block (wrapper for old wxgui)
+##################################################
+class _number_sink_base(gr.hier_block2, common.wxgui_hb):
+ """
+ An decimator block with a number window display
+ """
+
+ def __init__(
+ self,
+ parent,
+ unit='units',
+ minval=0,
+ maxval=1,
+ factor=1,
+ decimal_places=3,
+ ref_level=0,
+ sample_rate=1,
+ number_rate=number_window.DEFAULT_NUMBER_RATE,
+ average=False,
+ avg_alpha=None,
+ label='Number Plot',
+ size=number_window.DEFAULT_WIN_SIZE,
+ peak_hold=False,
+ show_gauge=True,
+ **kwargs #catchall for backwards compatibility
+ ):
+ #ensure avg alpha
+ if avg_alpha is None: avg_alpha = 2.0/number_rate
+ #init
+ gr.hier_block2.__init__(
+ self,
+ "number_sink",
+ gr.io_signature(1, 1, self._item_size),
+ gr.io_signature(0, 0, 0),
+ )
+ #blocks
+ sd = blks2.stream_to_vector_decimator(
+ item_size=self._item_size,
+ sample_rate=sample_rate,
+ vec_rate=number_rate,
+ vec_len=1,
+ )
+ if self._real:
+ mult = gr.multiply_const_ff(factor)
+ add = gr.add_const_ff(ref_level)
+ avg = gr.single_pole_iir_filter_ff(1.0)
+ else:
+ mult = gr.multiply_const_cc(factor)
+ add = gr.add_const_cc(ref_level)
+ avg = gr.single_pole_iir_filter_cc(1.0)
+ msgq = gr.msg_queue(2)
+ sink = gr.message_sink(self._item_size, msgq, True)
+ #controller
+ self.controller = pubsub()
+ self.controller.subscribe(SAMPLE_RATE_KEY, sd.set_sample_rate)
+ self.controller.publish(SAMPLE_RATE_KEY, sd.sample_rate)
+ self.controller[AVERAGE_KEY] = average
+ self.controller[AVG_ALPHA_KEY] = avg_alpha
+ def update_avg(*args):
+ if self.controller[AVERAGE_KEY]: avg.set_taps(self.controller[AVG_ALPHA_KEY])
+ else: avg.set_taps(1.0)
+ update_avg()
+ self.controller.subscribe(AVERAGE_KEY, update_avg)
+ self.controller.subscribe(AVG_ALPHA_KEY, update_avg)
+ #start input watcher
+ common.input_watcher(msgq, self.controller, MSG_KEY)
+ #create window
+ self.win = number_window.number_window(
+ parent=parent,
+ controller=self.controller,
+ size=size,
+ title=label,
+ units=unit,
+ real=self._real,
+ minval=minval,
+ maxval=maxval,
+ decimal_places=decimal_places,
+ show_gauge=show_gauge,
+ average_key=AVERAGE_KEY,
+ avg_alpha_key=AVG_ALPHA_KEY,
+ peak_hold=peak_hold,
+ msg_key=MSG_KEY,
+ sample_rate_key=SAMPLE_RATE_KEY,
+ )
+ common.register_access_methods(self, self.controller)
+ #backwards compadibility
+ self.set_show_gauge = self.win.show_gauges
+ #connect
+ self.wxgui_connect(self, sd, mult, add, avg, sink)
+
+class number_sink_f(_number_sink_base):
+ _item_size = gr.sizeof_float
+ _real = True
+
+class number_sink_c(_number_sink_base):
+ _item_size = gr.sizeof_gr_complex
+ _real = False
+
+# ----------------------------------------------------------------
+# Standalone test app
+# ----------------------------------------------------------------
+
+import wx
+from gnuradio.wxgui import stdgui2
+
+class test_app_flow_graph (stdgui2.std_top_block):
+ def __init__(self, frame, panel, vbox, argv):
+ stdgui2.std_top_block.__init__ (self, frame, panel, vbox, argv)
+
+ # build our flow graph
+ input_rate = 20.48e3
+
+ # Generate a real and complex sinusoids
+ src1 = gr.sig_source_f (input_rate, gr.GR_SIN_WAVE, 2.21e3, 1)
+ src2 = gr.sig_source_c (input_rate, gr.GR_SIN_WAVE, 2.21e3, 1)
+
+ # We add these throttle blocks so that this demo doesn't
+ # suck down all the CPU available. Normally you wouldn't use these.
+ thr1 = gr.throttle(gr.sizeof_float, input_rate)
+ thr2 = gr.throttle(gr.sizeof_gr_complex, input_rate)
+
+ sink1 = number_sink_f (panel, unit='V',label="Real Data", avg_alpha=0.001,
+ sample_rate=input_rate, minval=-1, maxval=1,
+ ref_level=0, decimal_places=3)
+ vbox.Add (sink1.win, 1, wx.EXPAND)
+ sink2 = number_sink_c (panel, unit='V',label="Complex Data", avg_alpha=0.001,
+ sample_rate=input_rate, minval=-1, maxval=1,
+ ref_level=0, decimal_places=3)
+ vbox.Add (sink2.win, 1, wx.EXPAND)
+
+ self.connect (src1, thr1, sink1)
+ self.connect (src2, thr2, sink2)
+
+def main ():
+ app = stdgui2.stdapp (test_app_flow_graph, "Number Sink Test App")
+ app.MainLoop ()
+
+if __name__ == '__main__':
+ main ()
+
diff --git a/gr-wxgui/src/python/plot.py b/gr-wxgui/src/python/plot.py
new file mode 100644
index 000000000..041a2a7a5
--- /dev/null
+++ b/gr-wxgui/src/python/plot.py
@@ -0,0 +1,1834 @@
+#-----------------------------------------------------------------------------
+# Name: wx.lib.plot.py
+# Purpose: Line, Bar and Scatter Graphs
+#
+# Author: Gordon Williams
+#
+# Created: 2003/11/03
+# RCS-ID: $Id$
+# Copyright: (c) 2002,2007,2010
+# Licence: Use as you wish.
+#-----------------------------------------------------------------------------
+# 12/15/2003 - Jeff Grimmett (grimmtooth@softhome.net)
+#
+# o 2.5 compatability update.
+# o Renamed to plot.py in the wx.lib directory.
+# o Reworked test frame to work with wx demo framework. This saves a bit
+# of tedious cut and paste, and the test app is excellent.
+#
+# 12/18/2003 - Jeff Grimmett (grimmtooth@softhome.net)
+#
+# o wxScrolledMessageDialog -> ScrolledMessageDialog
+#
+# Oct 6, 2004 Gordon Williams (g_will@cyberus.ca)
+# - Added bar graph demo
+# - Modified line end shape from round to square.
+# - Removed FloatDCWrapper for conversion to ints and ints in arguments
+#
+# Oct 15, 2004 Gordon Williams (g_will@cyberus.ca)
+# - Imported modules given leading underscore to name.
+# - Added Cursor Line Tracking and User Point Labels.
+# - Demo for Cursor Line Tracking and Point Labels.
+# - Size of plot preview frame adjusted to show page better.
+# - Added helper functions PositionUserToScreen and PositionScreenToUser in PlotCanvas.
+# - Added functions GetClosestPoints (all curves) and GetClosestPoint (only closest curve)
+# can be in either user coords or screen coords.
+#
+# May 27, 2007 Johnathan Corgan (jcorgan@corganenterprises.com)
+# - Converted from numarray to numpy
+#
+# Apr 23, 2010 Martin Dudok van Heel (http://www.olifantasia.com/gnuradio/contact_olifantasia.gif)
+# - Added Persistence option (emulate after glow of an analog CRT display using IIR)
+
+"""
+This is a simple light weight plotting module that can be used with
+Boa or easily integrated into your own wxPython application. The
+emphasis is on small size and fast plotting for large data sets. It
+has a reasonable number of features to do line and scatter graphs
+easily as well as simple bar graphs. It is not as sophisticated or
+as powerful as SciPy Plt or Chaco. Both of these are great packages
+but consume huge amounts of computer resources for simple plots.
+They can be found at http://scipy.com
+
+This file contains two parts; first the re-usable library stuff, then,
+after a "if __name__=='__main__'" test, a simple frame and a few default
+plots for examples and testing.
+
+Based on wxPlotCanvas
+Written by K.Hinsen, R. Srinivasan;
+Ported to wxPython Harm van der Heijden, feb 1999
+
+Major Additions Gordon Williams Feb. 2003 (g_will@cyberus.ca)
+ -More style options
+ -Zooming using mouse 'rubber band'
+ -Scroll left, right
+ -Grid(graticule)
+ -Printing, preview, and page set up (margins)
+ -Axis and title labels
+ -Cursor xy axis values
+ -Doc strings and lots of comments
+ -Optimizations for large number of points
+ -Legends
+
+Did a lot of work here to speed markers up. Only a factor of 4
+improvement though. Lines are much faster than markers, especially
+filled markers. Stay away from circles and triangles unless you
+only have a few thousand points.
+
+Times for 25,000 points
+Line - 0.078 sec
+Markers
+Square - 0.22 sec
+dot - 0.10
+circle - 0.87
+cross,plus - 0.28
+triangle, triangle_down - 0.90
+
+Thanks to Chris Barker for getting this version working on Linux.
+
+Zooming controls with mouse (when enabled):
+ Left mouse drag - Zoom box.
+ Left mouse double click - reset zoom.
+ Right mouse click - zoom out centred on click location.
+"""
+
+import string as _string
+import time as _time
+import wx
+
+# Needs numpy or numarray
+try:
+ import numpy as _numpy
+except:
+ try:
+ import numarray as _numpy #if numarray is used it is renamed numpy
+ except:
+ msg= """
+ This module requires the numpy or numarray module,
+ which could not be imported. It probably is not installed
+ (it's not part of the standard Python distribution). See the
+ Python site (http://www.python.org) for information on
+ downloading source or binaries."""
+ raise ImportError, "numpy or numarray not found. \n" + msg
+
+
+
+#
+# Plotting classes...
+#
+class PolyPoints:
+ """Base Class for lines and markers
+ - All methods are private.
+ """
+
+ def __init__(self, points, attr):
+ self.points = _numpy.array(points)
+ self.currentScale= (1,1)
+ self.currentShift= (0,0)
+ self.scaled = self.points
+ self.attributes = {}
+ self.attributes.update(self._attributes)
+ for name, value in attr.items():
+ if name not in self._attributes.keys():
+ raise KeyError, "Style attribute incorrect. Should be one of %s" % self._attributes.keys()
+ self.attributes[name] = value
+
+ def boundingBox(self):
+ if len(self.points) == 0:
+ # no curves to draw
+ # defaults to (-1,-1) and (1,1) but axis can be set in Draw
+ minXY= _numpy.array([-1,-1])
+ maxXY= _numpy.array([ 1, 1])
+ else:
+ minXY= _numpy.minimum.reduce(self.points)
+ maxXY= _numpy.maximum.reduce(self.points)
+ return minXY, maxXY
+
+ def scaleAndShift(self, scale=(1,1), shift=(0,0)):
+ if len(self.points) == 0:
+ # no curves to draw
+ return
+ if (scale is not self.currentScale) or (shift is not self.currentShift):
+ # update point scaling
+ self.scaled = scale*self.points+shift
+ self.currentScale= scale
+ self.currentShift= shift
+ # else unchanged use the current scaling
+
+ def getLegend(self):
+ return self.attributes['legend']
+
+ def getClosestPoint(self, pntXY, pointScaled= True):
+ """Returns the index of closest point on the curve, pointXY, scaledXY, distance
+ x, y in user coords
+ if pointScaled == True based on screen coords
+ if pointScaled == False based on user coords
+ """
+ if pointScaled == True:
+ #Using screen coords
+ p = self.scaled
+ pxy = self.currentScale * _numpy.array(pntXY)+ self.currentShift
+ else:
+ #Using user coords
+ p = self.points
+ pxy = _numpy.array(pntXY)
+ #determine distance for each point
+ d= _numpy.sqrt(_numpy.add.reduce((p-pxy)**2,1)) #sqrt(dx^2+dy^2)
+ pntIndex = _numpy.argmin(d)
+ dist = d[pntIndex]
+ return [pntIndex, self.points[pntIndex], self.scaled[pntIndex], dist]
+
+
+class PolyLine(PolyPoints):
+ """Class to define line type and style
+ - All methods except __init__ are private.
+ """
+
+ _attributes = {'colour': 'black',
+ 'width': 1,
+ 'style': wx.SOLID,
+ 'legend': ''}
+
+ def __init__(self, points, **attr):
+ """Creates PolyLine object
+ points - sequence (array, tuple or list) of (x,y) points making up line
+ **attr - key word attributes
+ Defaults:
+ 'colour'= 'black', - wx.Pen Colour any wx.NamedColour
+ 'width'= 1, - Pen width
+ 'style'= wx.SOLID, - wx.Pen style
+ 'legend'= '' - Line Legend to display
+ """
+ PolyPoints.__init__(self, points, attr)
+
+ def draw(self, dc, printerScale, coord= None):
+ colour = self.attributes['colour']
+ width = self.attributes['width'] * printerScale
+ style= self.attributes['style']
+ pen = wx.Pen(wx.NamedColour(colour), width, style)
+ pen.SetCap(wx.CAP_BUTT)
+ dc.SetPen(pen)
+ if coord == None:
+ dc.DrawLines(self.scaled)
+ else:
+ dc.DrawLines(coord) # draw legend line
+
+ def getSymExtent(self, printerScale):
+ """Width and Height of Marker"""
+ h= self.attributes['width'] * printerScale
+ w= 5 * h
+ return (w,h)
+
+
+class PolyMarker(PolyPoints):
+ """Class to define marker type and style
+ - All methods except __init__ are private.
+ """
+
+ _attributes = {'colour': 'black',
+ 'width': 1,
+ 'size': 2,
+ 'fillcolour': None,
+ 'fillstyle': wx.SOLID,
+ 'marker': 'circle',
+ 'legend': ''}
+
+ def __init__(self, points, **attr):
+ """Creates PolyMarker object
+ points - sequence (array, tuple or list) of (x,y) points
+ **attr - key word attributes
+ Defaults:
+ 'colour'= 'black', - wx.Pen Colour any wx.NamedColour
+ 'width'= 1, - Pen width
+ 'size'= 2, - Marker size
+ 'fillcolour'= same as colour, - wx.Brush Colour any wx.NamedColour
+ 'fillstyle'= wx.SOLID, - wx.Brush fill style (use wx.TRANSPARENT for no fill)
+ 'marker'= 'circle' - Marker shape
+ 'legend'= '' - Marker Legend to display
+
+ Marker Shapes:
+ - 'circle'
+ - 'dot'
+ - 'square'
+ - 'triangle'
+ - 'triangle_down'
+ - 'cross'
+ - 'plus'
+ """
+
+ PolyPoints.__init__(self, points, attr)
+
+ def draw(self, dc, printerScale, coord= None):
+ colour = self.attributes['colour']
+ width = self.attributes['width'] * printerScale
+ size = self.attributes['size'] * printerScale
+ fillcolour = self.attributes['fillcolour']
+ fillstyle = self.attributes['fillstyle']
+ marker = self.attributes['marker']
+
+ dc.SetPen(wx.Pen(wx.NamedColour(colour), width))
+ if fillcolour:
+ dc.SetBrush(wx.Brush(wx.NamedColour(fillcolour),fillstyle))
+ else:
+ dc.SetBrush(wx.Brush(wx.NamedColour(colour), fillstyle))
+ if coord == None:
+ self._drawmarkers(dc, self.scaled, marker, size)
+ else:
+ self._drawmarkers(dc, coord, marker, size) # draw legend marker
+
+ def getSymExtent(self, printerScale):
+ """Width and Height of Marker"""
+ s= 5*self.attributes['size'] * printerScale
+ return (s,s)
+
+ def _drawmarkers(self, dc, coords, marker,size=1):
+ f = eval('self._' +marker)
+ f(dc, coords, size)
+
+ def _circle(self, dc, coords, size=1):
+ fact= 2.5*size
+ wh= 5.0*size
+ rect= _numpy.zeros((len(coords),4),_numpy.float)+[0.0,0.0,wh,wh]
+ rect[:,0:2]= coords-[fact,fact]
+ dc.DrawEllipseList(rect.astype(_numpy.int32))
+
+ def _dot(self, dc, coords, size=1):
+ dc.DrawPointList(coords)
+
+ def _square(self, dc, coords, size=1):
+ fact= 2.5*size
+ wh= 5.0*size
+ rect= _numpy.zeros((len(coords),4),_numpy.float)+[0.0,0.0,wh,wh]
+ rect[:,0:2]= coords-[fact,fact]
+ dc.DrawRectangleList(rect.astype(_numpy.int32))
+
+ def _triangle(self, dc, coords, size=1):
+ shape= [(-2.5*size,1.44*size), (2.5*size,1.44*size), (0.0,-2.88*size)]
+ poly= _numpy.repeat(coords,3)
+ poly.shape= (len(coords),3,2)
+ poly += shape
+ dc.DrawPolygonList(poly.astype(_numpy.int32))
+
+ def _triangle_down(self, dc, coords, size=1):
+ shape= [(-2.5*size,-1.44*size), (2.5*size,-1.44*size), (0.0,2.88*size)]
+ poly= _numpy.repeat(coords,3)
+ poly.shape= (len(coords),3,2)
+ poly += shape
+ dc.DrawPolygonList(poly.astype(_numpy.int32))
+
+ def _cross(self, dc, coords, size=1):
+ fact= 2.5*size
+ for f in [[-fact,-fact,fact,fact],[-fact,fact,fact,-fact]]:
+ lines= _numpy.concatenate((coords,coords),axis=1)+f
+ dc.DrawLineList(lines.astype(_numpy.int32))
+
+ def _plus(self, dc, coords, size=1):
+ fact= 2.5*size
+ for f in [[-fact,0,fact,0],[0,-fact,0,fact]]:
+ lines= _numpy.concatenate((coords,coords),axis=1)+f
+ dc.DrawLineList(lines.astype(_numpy.int32))
+
+class PlotGraphics:
+ """Container to hold PolyXXX objects and graph labels
+ - All methods except __init__ are private.
+ """
+
+ def __init__(self, objects, title='', xLabel='', yLabel= ''):
+ """Creates PlotGraphics object
+ objects - list of PolyXXX objects to make graph
+ title - title shown at top of graph
+ xLabel - label shown on x-axis
+ yLabel - label shown on y-axis
+ """
+ if type(objects) not in [list,tuple]:
+ raise TypeError, "objects argument should be list or tuple"
+ self.objects = objects
+ self.title= title
+ self.xLabel= xLabel
+ self.yLabel= yLabel
+
+ def boundingBox(self):
+ p1, p2 = self.objects[0].boundingBox()
+ for o in self.objects[1:]:
+ p1o, p2o = o.boundingBox()
+ p1 = _numpy.minimum(p1, p1o)
+ p2 = _numpy.maximum(p2, p2o)
+ return p1, p2
+
+ def scaleAndShift(self, scale=(1,1), shift=(0,0)):
+ for o in self.objects:
+ o.scaleAndShift(scale, shift)
+
+ def setPrinterScale(self, scale):
+ """Thickens up lines and markers only for printing"""
+ self.printerScale= scale
+
+ def setXLabel(self, xLabel= ''):
+ """Set the X axis label on the graph"""
+ self.xLabel= xLabel
+
+ def setYLabel(self, yLabel= ''):
+ """Set the Y axis label on the graph"""
+ self.yLabel= yLabel
+
+ def setTitle(self, title= ''):
+ """Set the title at the top of graph"""
+ self.title= title
+
+ def getXLabel(self):
+ """Get x axis label string"""
+ return self.xLabel
+
+ def getYLabel(self):
+ """Get y axis label string"""
+ return self.yLabel
+
+ def getTitle(self, title= ''):
+ """Get the title at the top of graph"""
+ return self.title
+
+ def draw(self, dc):
+ for o in self.objects:
+ #t=_time.clock() # profile info
+ o.draw(dc, self.printerScale)
+ #dt= _time.clock()-t
+ #print o, "time=", dt
+
+ def getSymExtent(self, printerScale):
+ """Get max width and height of lines and markers symbols for legend"""
+ symExt = self.objects[0].getSymExtent(printerScale)
+ for o in self.objects[1:]:
+ oSymExt = o.getSymExtent(printerScale)
+ symExt = _numpy.maximum(symExt, oSymExt)
+ return symExt
+
+ def getLegendNames(self):
+ """Returns list of legend names"""
+ lst = [None]*len(self)
+ for i in range(len(self)):
+ lst[i]= self.objects[i].getLegend()
+ return lst
+
+ def __len__(self):
+ return len(self.objects)
+
+ def __getitem__(self, item):
+ return self.objects[item]
+
+
+#-------------------------------------------------------------------------------
+# Main window that you will want to import into your application.
+
+class PlotCanvas(wx.Window):
+ """Subclass of a wx.Window to allow simple general plotting
+ of data with zoom, labels, and automatic axis scaling."""
+
+ def __init__(self, parent, id = -1, pos=wx.DefaultPosition,
+ size=wx.DefaultSize, style= wx.DEFAULT_FRAME_STYLE, name= ""):
+
+ self.use_persistence=False
+ self.alpha=0.3
+ self.decimation=10
+ self.decim_counter=0
+ """Constucts a window, which can be a child of a frame, dialog or
+ any other non-control window"""
+
+ wx.Window.__init__(self, parent, id, pos, size, style, name)
+ self.border = (1,1)
+
+ self.SetBackgroundColour("white")
+
+ # Create some mouse events for zooming
+ self.Bind(wx.EVT_LEFT_DOWN, self.OnMouseLeftDown)
+ self.Bind(wx.EVT_LEFT_UP, self.OnMouseLeftUp)
+ self.Bind(wx.EVT_MOTION, self.OnMotion)
+ self.Bind(wx.EVT_LEFT_DCLICK, self.OnMouseDoubleClick)
+ self.Bind(wx.EVT_RIGHT_DOWN, self.OnMouseRightDown)
+
+ # set curser as cross-hairs
+ self.SetCursor(wx.CROSS_CURSOR)
+
+ # Things for printing
+ self.print_data = wx.PrintData()
+ self.print_data.SetPaperId(wx.PAPER_LETTER)
+ self.print_data.SetOrientation(wx.LANDSCAPE)
+ self.pageSetupData= wx.PageSetupDialogData()
+ self.pageSetupData.SetMarginBottomRight((25,25))
+ self.pageSetupData.SetMarginTopLeft((25,25))
+ self.pageSetupData.SetPrintData(self.print_data)
+ self.printerScale = 1
+ self.parent= parent
+
+ # Zooming variables
+ self._zoomInFactor = 0.5
+ self._zoomOutFactor = 2
+ self._zoomCorner1= _numpy.array([0.0, 0.0]) # left mouse down corner
+ self._zoomCorner2= _numpy.array([0.0, 0.0]) # left mouse up corner
+ self._zoomEnabled= False
+ self._hasDragged= False
+
+ # Drawing Variables
+ self.last_draw = None
+ self._pointScale= 1
+ self._pointShift= 0
+ self._xSpec= 'auto'
+ self._ySpec= 'auto'
+ self._gridEnabled= False
+ self._legendEnabled= False
+ self._xUseScopeTicks= False
+
+ # Fonts
+ self._fontCache = {}
+ self._fontSizeAxis= 10
+ self._fontSizeTitle= 15
+ self._fontSizeLegend= 7
+
+ # pointLabels
+ self._pointLabelEnabled= False
+ self.last_PointLabel= None
+ self._pointLabelFunc= None
+ self.Bind(wx.EVT_LEAVE_WINDOW, self.OnLeave)
+
+ self.Bind(wx.EVT_PAINT, self.OnPaint)
+ self.Bind(wx.EVT_SIZE, self.OnSize)
+ # OnSize called to make sure the buffer is initialized.
+ # This might result in OnSize getting called twice on some
+ # platforms at initialization, but little harm done.
+ self.OnSize(None) # sets the initial size based on client size
+ # UNCONDITIONAL, needed to create self._Buffer
+
+
+ def set_use_persistence(self, enable):
+ self.use_persistence = enable
+
+ def set_persist_alpha(self, persist_alpha):
+ self.alpha = persist_alpha
+
+
+ # SaveFile
+ def SaveFile(self, fileName= ''):
+ """Saves the file to the type specified in the extension. If no file
+ name is specified a dialog box is provided. Returns True if sucessful,
+ otherwise False.
+
+ .bmp Save a Windows bitmap file.
+ .xbm Save an X bitmap file.
+ .xpm Save an XPM bitmap file.
+ .png Save a Portable Network Graphics file.
+ .jpg Save a Joint Photographic Experts Group file.
+ """
+ if _string.lower(fileName[-3:]) not in ['bmp','xbm','xpm','png','jpg']:
+ dlg1 = wx.FileDialog(
+ self,
+ "Choose a file with extension bmp, gif, xbm, xpm, png, or jpg", ".", "",
+ "BMP files (*.bmp)|*.bmp|XBM files (*.xbm)|*.xbm|XPM file (*.xpm)|*.xpm|PNG files (*.png)|*.png|JPG files (*.jpg)|*.jpg",
+ wx.SAVE|wx.OVERWRITE_PROMPT
+ )
+ try:
+ while 1:
+ if dlg1.ShowModal() == wx.ID_OK:
+ fileName = dlg1.GetPath()
+ # Check for proper exension
+ if _string.lower(fileName[-3:]) not in ['bmp','xbm','xpm','png','jpg']:
+ dlg2 = wx.MessageDialog(self, 'File name extension\n'
+ 'must be one of\n'
+ 'bmp, xbm, xpm, png, or jpg',
+ 'File Name Error', wx.OK | wx.ICON_ERROR)
+ try:
+ dlg2.ShowModal()
+ finally:
+ dlg2.Destroy()
+ else:
+ break # now save file
+ else: # exit without saving
+ return False
+ finally:
+ dlg1.Destroy()
+
+ # File name has required extension
+ fType = _string.lower(fileName[-3:])
+ if fType == "bmp":
+ tp= wx.BITMAP_TYPE_BMP # Save a Windows bitmap file.
+ elif fType == "xbm":
+ tp= wx.BITMAP_TYPE_XBM # Save an X bitmap file.
+ elif fType == "xpm":
+ tp= wx.BITMAP_TYPE_XPM # Save an XPM bitmap file.
+ elif fType == "jpg":
+ tp= wx.BITMAP_TYPE_JPEG # Save a JPG file.
+ else:
+ tp= wx.BITMAP_TYPE_PNG # Save a PNG file.
+ # Save Bitmap
+ res= self._Buffer.SaveFile(fileName, tp)
+ return res
+
+ def PageSetup(self):
+ """Brings up the page setup dialog"""
+ data = self.pageSetupData
+ data.SetPrintData(self.print_data)
+ dlg = wx.PageSetupDialog(self.parent, data)
+ try:
+ if dlg.ShowModal() == wx.ID_OK:
+ data = dlg.GetPageSetupData() # returns wx.PageSetupDialogData
+ # updates page parameters from dialog
+ self.pageSetupData.SetMarginBottomRight(data.GetMarginBottomRight())
+ self.pageSetupData.SetMarginTopLeft(data.GetMarginTopLeft())
+ self.pageSetupData.SetPrintData(data.GetPrintData())
+ self.print_data=data.GetPrintData() # updates print_data
+ finally:
+ dlg.Destroy()
+
+ def Printout(self, paper=None):
+ """Print current plot."""
+ if paper != None:
+ self.print_data.SetPaperId(paper)
+ pdd = wx.PrintDialogData()
+ pdd.SetPrintData(self.print_data)
+ printer = wx.Printer(pdd)
+ out = PlotPrintout(self)
+ print_ok = printer.Print(self.parent, out)
+ if print_ok:
+ self.print_data = printer.GetPrintDialogData().GetPrintData()
+ out.Destroy()
+
+ def PrintPreview(self):
+ """Print-preview current plot."""
+ printout = PlotPrintout(self)
+ printout2 = PlotPrintout(self)
+ self.preview = wx.PrintPreview(printout, printout2, self.print_data)
+ if not self.preview.Ok():
+ wx.MessageDialog(self, "Print Preview failed.\n" \
+ "Check that default printer is configured\n", \
+ "Print error", wx.OK|wx.CENTRE).ShowModal()
+ self.preview.SetZoom(40)
+ # search up tree to find frame instance
+ frameInst= self
+ while not isinstance(frameInst, wx.Frame):
+ frameInst= frameInst.GetParent()
+ frame = wx.PreviewFrame(self.preview, frameInst, "Preview")
+ frame.Initialize()
+ frame.SetPosition(self.GetPosition())
+ frame.SetSize((600,550))
+ frame.Centre(wx.BOTH)
+ frame.Show(True)
+
+ def SetFontSizeAxis(self, point= 10):
+ """Set the tick and axis label font size (default is 10 point)"""
+ self._fontSizeAxis= point
+
+ def GetFontSizeAxis(self):
+ """Get current tick and axis label font size in points"""
+ return self._fontSizeAxis
+
+ def SetFontSizeTitle(self, point= 15):
+ """Set Title font size (default is 15 point)"""
+ self._fontSizeTitle= point
+
+ def GetFontSizeTitle(self):
+ """Get current Title font size in points"""
+ return self._fontSizeTitle
+
+ def SetFontSizeLegend(self, point= 7):
+ """Set Legend font size (default is 7 point)"""
+ self._fontSizeLegend= point
+
+ def GetFontSizeLegend(self):
+ """Get current Legend font size in points"""
+ return self._fontSizeLegend
+
+ def SetEnableZoom(self, value):
+ """Set True to enable zooming."""
+ if value not in [True,False]:
+ raise TypeError, "Value should be True or False"
+ self._zoomEnabled= value
+
+ def GetEnableZoom(self):
+ """True if zooming enabled."""
+ return self._zoomEnabled
+
+ def SetEnableGrid(self, value):
+ """Set True to enable grid."""
+ if value not in [True,False]:
+ raise TypeError, "Value should be True or False"
+ self._gridEnabled= value
+ self.Redraw()
+
+ def GetEnableGrid(self):
+ """True if grid enabled."""
+ return self._gridEnabled
+
+ def SetEnableLegend(self, value):
+ """Set True to enable legend."""
+ if value not in [True,False]:
+ raise TypeError, "Value should be True or False"
+ self._legendEnabled= value
+ self.Redraw()
+
+ def GetEnableLegend(self):
+ """True if Legend enabled."""
+ return self._legendEnabled
+
+ def SetEnablePointLabel(self, value):
+ """Set True to enable pointLabel."""
+ if value not in [True,False]:
+ raise TypeError, "Value should be True or False"
+ self._pointLabelEnabled= value
+ self.Redraw() #will erase existing pointLabel if present
+ self.last_PointLabel = None
+
+ def GetEnablePointLabel(self):
+ """True if pointLabel enabled."""
+ return self._pointLabelEnabled
+
+ def SetPointLabelFunc(self, func):
+ """Sets the function with custom code for pointLabel drawing
+ ******** more info needed ***************
+ """
+ self._pointLabelFunc= func
+
+ def GetPointLabelFunc(self):
+ """Returns pointLabel Drawing Function"""
+ return self._pointLabelFunc
+
+ def Reset(self):
+ """Unzoom the plot."""
+ self.last_PointLabel = None #reset pointLabel
+ if self.last_draw is not None:
+ self.Draw(self.last_draw[0])
+
+ def ScrollRight(self, units):
+ """Move view right number of axis units."""
+ self.last_PointLabel = None #reset pointLabel
+ if self.last_draw is not None:
+ graphics, xAxis, yAxis= self.last_draw
+ xAxis= (xAxis[0]+units, xAxis[1]+units)
+ self.Draw(graphics,xAxis,yAxis)
+
+ def ScrollUp(self, units):
+ """Move view up number of axis units."""
+ self.last_PointLabel = None #reset pointLabel
+ if self.last_draw is not None:
+ graphics, xAxis, yAxis= self.last_draw
+ yAxis= (yAxis[0]+units, yAxis[1]+units)
+ self.Draw(graphics,xAxis,yAxis)
+
+ def GetXY(self,event):
+ """Takes a mouse event and returns the XY user axis values."""
+ x,y= self.PositionScreenToUser(event.GetPosition())
+ return x,y
+
+ def PositionUserToScreen(self, pntXY):
+ """Converts User position to Screen Coordinates"""
+ userPos= _numpy.array(pntXY)
+ x,y= userPos * self._pointScale + self._pointShift
+ return x,y
+
+ def PositionScreenToUser(self, pntXY):
+ """Converts Screen position to User Coordinates"""
+ screenPos= _numpy.array(pntXY)
+ x,y= (screenPos-self._pointShift)/self._pointScale
+ return x,y
+
+ def SetXSpec(self, type= 'auto'):
+ """xSpec- defines x axis type. Can be 'none', 'min' or 'auto'
+ where:
+ 'none' - shows no axis or tick mark values
+ 'min' - shows min bounding box values
+ 'auto' - rounds axis range to sensible values
+ """
+ self._xSpec= type
+
+ def SetYSpec(self, type= 'auto'):
+ """ySpec- defines x axis type. Can be 'none', 'min' or 'auto'
+ where:
+ 'none' - shows no axis or tick mark values
+ 'min' - shows min bounding box values
+ 'auto' - rounds axis range to sensible values
+ """
+ self._ySpec= type
+
+ def GetXSpec(self):
+ """Returns current XSpec for axis"""
+ return self._xSpec
+
+ def GetYSpec(self):
+ """Returns current YSpec for axis"""
+ return self._ySpec
+
+ def GetXMaxRange(self):
+ """Returns (minX, maxX) x-axis range for displayed graph"""
+ graphics= self.last_draw[0]
+ p1, p2 = graphics.boundingBox() # min, max points of graphics
+ xAxis = self._axisInterval(self._xSpec, p1[0], p2[0]) # in user units
+ return xAxis
+
+ def GetYMaxRange(self):
+ """Returns (minY, maxY) y-axis range for displayed graph"""
+ graphics= self.last_draw[0]
+ p1, p2 = graphics.boundingBox() # min, max points of graphics
+ yAxis = self._axisInterval(self._ySpec, p1[1], p2[1])
+ return yAxis
+
+ def GetXCurrentRange(self):
+ """Returns (minX, maxX) x-axis for currently displayed portion of graph"""
+ return self.last_draw[1]
+
+ def GetYCurrentRange(self):
+ """Returns (minY, maxY) y-axis for currently displayed portion of graph"""
+ return self.last_draw[2]
+
+ def SetXUseScopeTicks(self, v=False):
+ """Always 10 divisions, no labels"""
+ self._xUseScopeTicks = v
+
+ def GetXUseScopeTicks(self):
+ return self._xUseScopeTicks
+
+ def Draw(self, graphics, xAxis = None, yAxis = None, dc = None, step=None):
+ """Draw objects in graphics with specified x and y axis.
+ graphics- instance of PlotGraphics with list of PolyXXX objects
+ xAxis - tuple with (min, max) axis range to view
+ yAxis - same as xAxis
+ dc - drawing context - doesn't have to be specified.
+ If it's not, the offscreen buffer is used
+ """
+ # check Axis is either tuple or none
+ if type(xAxis) not in [type(None),tuple]:
+ raise TypeError, "xAxis should be None or (minX,maxX)"
+ if type(yAxis) not in [type(None),tuple]:
+ raise TypeError, "yAxis should be None or (minY,maxY)"
+
+ # check case for axis = (a,b) where a==b caused by improper zooms
+ if xAxis != None:
+ if xAxis[0] == xAxis[1]:
+ return
+ if yAxis != None:
+ if yAxis[0] == yAxis[1]:
+ return
+
+ if dc == None:
+ # sets new dc and clears it
+ if self.use_persistence:
+ dc = wx.MemoryDC()
+ dc.SelectObject(self._Buffer)
+ dc.Clear()
+ else:
+ dc = wx.BufferedDC(wx.ClientDC(self), self._Buffer)
+ dc.Clear()
+
+ dc.BeginDrawing()
+ # dc.Clear()
+
+
+
+ # set font size for every thing but title and legend
+ dc.SetFont(self._getFont(self._fontSizeAxis))
+
+ # sizes axis to axis type, create lower left and upper right corners of plot
+ if xAxis == None or yAxis == None:
+ # One or both axis not specified in Draw
+ p1, p2 = graphics.boundingBox() # min, max points of graphics
+ if xAxis == None:
+ xAxis = self._axisInterval(self._xSpec, p1[0], p2[0]) # in user units
+ if yAxis == None:
+ yAxis = self._axisInterval(self._ySpec, p1[1], p2[1])
+ # Adjust bounding box for axis spec
+ p1[0],p1[1] = xAxis[0], yAxis[0] # lower left corner user scale (xmin,ymin)
+ p2[0],p2[1] = xAxis[1], yAxis[1] # upper right corner user scale (xmax,ymax)
+ else:
+ # Both axis specified in Draw
+ p1= _numpy.array([xAxis[0], yAxis[0]]) # lower left corner user scale (xmin,ymin)
+ p2= _numpy.array([xAxis[1], yAxis[1]]) # upper right corner user scale (xmax,ymax)
+
+ self.last_draw = (graphics, xAxis, yAxis) # saves most recient values
+
+ if False:
+ ptx,pty,rectWidth,rectHeight= self._point2ClientCoord(p1, p2)
+ #dc.SetPen(wx.Pen(wx.BLACK))
+ dc.SetBrush(wx.Brush( wx.BLACK, wx.SOLID ) ) #wx.SOLID wx.TRANSPARENT ) )
+ #dc.SetLogicalFunction(wx.INVERT) #wx.XOR wx.INVERT
+ dc.DrawRectangle( ptx,pty, rectWidth,rectHeight)
+ #dc.SetBrush(wx.Brush( wx.WHITE, wx.SOLID ) )
+ #dc.SetLogicalFunction(wx.COPY)
+
+ # Get ticks and textExtents for axis if required
+ if self._xSpec is not 'none':
+ if self._xUseScopeTicks:
+ xticks = self._scope_ticks(xAxis[0], xAxis[1])
+ else:
+ xticks = self._ticks(xAxis[0], xAxis[1])
+ xTextExtent = dc.GetTextExtent(xticks[-1][1])# w h of x axis text last number on axis
+ else:
+ xticks = None
+ xTextExtent= (0,0) # No text for ticks
+ if self._ySpec is not 'none':
+ yticks = self._ticks(yAxis[0], yAxis[1], step)
+ yTextExtentBottom= dc.GetTextExtent(yticks[0][1])
+ yTextExtentTop = dc.GetTextExtent(yticks[-1][1])
+ yTextExtent= (max(yTextExtentBottom[0],yTextExtentTop[0]),
+ max(yTextExtentBottom[1],yTextExtentTop[1]))
+ else:
+ yticks = None
+ yTextExtent= (0,0) # No text for ticks
+
+ # TextExtents for Title and Axis Labels
+ titleWH, xLabelWH, yLabelWH= self._titleLablesWH(dc, graphics)
+
+ # TextExtents for Legend
+ legendBoxWH, legendSymExt, legendTextExt = self._legendWH(dc, graphics)
+
+ # room around graph area
+ rhsW= max(xTextExtent[0], legendBoxWH[0]) # use larger of number width or legend width
+ lhsW= yTextExtent[0]+ yLabelWH[1]
+ bottomH= max(xTextExtent[1], yTextExtent[1]/2.)+ xLabelWH[1]
+ topH= yTextExtent[1]/2. + titleWH[1]
+ textSize_scale= _numpy.array([rhsW+lhsW,bottomH+topH]) # make plot area smaller by text size
+ textSize_shift= _numpy.array([lhsW, bottomH]) # shift plot area by this amount
+
+ # drawing title and labels text
+ dc.SetFont(self._getFont(self._fontSizeTitle))
+ titlePos= (self.plotbox_origin[0]+ lhsW + (self.plotbox_size[0]-lhsW-rhsW)/2.- titleWH[0]/2.,
+ self.plotbox_origin[1]- self.plotbox_size[1])
+ dc.DrawText(graphics.getTitle(),titlePos[0],titlePos[1])
+ dc.SetFont(self._getFont(self._fontSizeAxis))
+ xLabelPos= (self.plotbox_origin[0]+ lhsW + (self.plotbox_size[0]-lhsW-rhsW)/2.- xLabelWH[0]/2.,
+ self.plotbox_origin[1]- xLabelWH[1])
+ dc.DrawText(graphics.getXLabel(),xLabelPos[0],xLabelPos[1])
+ yLabelPos= (self.plotbox_origin[0],
+ self.plotbox_origin[1]- bottomH- (self.plotbox_size[1]-bottomH-topH)/2.+ yLabelWH[0]/2.)
+ if graphics.getYLabel(): # bug fix for Linux
+ dc.DrawRotatedText(graphics.getYLabel(),yLabelPos[0],yLabelPos[1],90)
+
+ # drawing legend makers and text
+ if self._legendEnabled:
+ self._drawLegend(dc,graphics,rhsW,topH,legendBoxWH, legendSymExt, legendTextExt)
+
+ # allow for scaling and shifting plotted points
+ scale = (self.plotbox_size-textSize_scale) / (p2-p1)* _numpy.array((1,-1))
+ shift = -p1*scale + self.plotbox_origin + textSize_shift * _numpy.array((1,-1))
+ self._pointScale= scale # make available for mouse events
+ self._pointShift= shift
+
+ #dc.SetLogicalFunction(wx.INVERT) #wx.XOR wx.INVERT
+ self._drawAxes(dc, p1, p2, scale, shift, xticks, yticks)
+ #dc.SetLogicalFunction(wx.COPY)
+
+ graphics.scaleAndShift(scale, shift)
+ graphics.setPrinterScale(self.printerScale) # thicken up lines and markers if printing
+
+ # set clipping area so drawing does not occur outside axis box
+ ptx,pty,rectWidth,rectHeight= self._point2ClientCoord(p1, p2)
+ dc.SetClippingRegion(ptx,pty,rectWidth,rectHeight)
+ # Draw the lines and markers
+ #start = _time.clock()
+
+ graphics.draw(dc)
+ # print "entire graphics drawing took: %f second"%(_time.clock() - start)
+ # remove the clipping region
+ dc.DestroyClippingRegion()
+ dc.EndDrawing()
+
+
+ if self.use_persistence:
+ dc=None
+ self._Buffer.CopyToBuffer(self._Bufferarray) #, format=wx.BitmapBufferFormat_RGB, stride=-1)
+ ## do the IIR filter
+ alpha_int=int(float(self.alpha*256))
+ if True:
+ _numpy.add(self._Bufferarray,0,self._Buffer3array)
+ _numpy.multiply(self._Buffer3array,alpha_int,self._Buffer3array)
+ _numpy.multiply(self._Buffer2array,(256-alpha_int),self._Buffer2array)
+ _numpy.add(self._Buffer3array,self._Buffer2array,self._Buffer2array)
+ _numpy.right_shift(self._Buffer2array,8,self._Buffer2array)
+ elif False:
+ self._Buffer2array=(self._Bufferarray.astype(_numpy.uint32) *alpha_int + self._Buffer2array*(256-alpha_int)).__rshift__(8)
+ elif False:
+ self._Buffer2array *=(256-alpha_int)
+ self._Buffer2array +=self._Bufferarray.astype(_numpy.uint32)*alpha_int
+ self._Buffer2array /=256
+
+ ##copy back to image buffer
+ self._Buffer2.CopyFromBuffer(self._Buffer2array.astype(_numpy.uint8)) #, format=wx.BitmapBufferFormat_RGB, stride=-1)
+
+ #draw to the screen
+ #self.decim_counter=self.decim_counter+1
+ if True: #self.decim_counter>self.decimation:
+ #self.decim_counter=0
+ dc2 = wx.ClientDC( self )
+ dc2.BeginDrawing()
+ dc2.DrawBitmap(self._Buffer2, 0, 0, False)
+ #dc2.DrawBitmap(self._Buffer, 0, 0, False)
+ dc2.EndDrawing()
+
+ def Redraw(self, dc= None):
+ """Redraw the existing plot."""
+ if self.last_draw is not None:
+ graphics, xAxis, yAxis= self.last_draw
+ self.Draw(graphics,xAxis,yAxis,dc)
+
+ def Clear(self):
+ """Erase the window."""
+ self.last_PointLabel = None #reset pointLabel
+ dc = wx.BufferedDC(wx.ClientDC(self), self._Buffer)
+ dc.Clear()
+ self.last_draw = None
+
+ def Zoom(self, Center, Ratio):
+ """ Zoom on the plot
+ Centers on the X,Y coords given in Center
+ Zooms by the Ratio = (Xratio, Yratio) given
+ """
+ self.last_PointLabel = None #reset maker
+ x,y = Center
+ if self.last_draw != None:
+ (graphics, xAxis, yAxis) = self.last_draw
+ w = (xAxis[1] - xAxis[0]) * Ratio[0]
+ h = (yAxis[1] - yAxis[0]) * Ratio[1]
+ xAxis = ( x - w/2, x + w/2 )
+ yAxis = ( y - h/2, y + h/2 )
+ self.Draw(graphics, xAxis, yAxis)
+
+ def GetClosestPoints(self, pntXY, pointScaled= True):
+ """Returns list with
+ [curveNumber, legend, index of closest point, pointXY, scaledXY, distance]
+ list for each curve.
+ Returns [] if no curves are being plotted.
+
+ x, y in user coords
+ if pointScaled == True based on screen coords
+ if pointScaled == False based on user coords
+ """
+ if self.last_draw == None:
+ #no graph available
+ return []
+ graphics, xAxis, yAxis= self.last_draw
+ l = []
+ for curveNum,obj in enumerate(graphics):
+ #check there are points in the curve
+ if len(obj.points) == 0:
+ continue #go to next obj
+ #[curveNumber, legend, index of closest point, pointXY, scaledXY, distance]
+ cn = [curveNum]+ [obj.getLegend()]+ obj.getClosestPoint( pntXY, pointScaled)
+ l.append(cn)
+ return l
+
+ def GetClosetPoint(self, pntXY, pointScaled= True):
+ """Returns list with
+ [curveNumber, legend, index of closest point, pointXY, scaledXY, distance]
+ list for only the closest curve.
+ Returns [] if no curves are being plotted.
+
+ x, y in user coords
+ if pointScaled == True based on screen coords
+ if pointScaled == False based on user coords
+ """
+ #closest points on screen based on screen scaling (pointScaled= True)
+ #list [curveNumber, index, pointXY, scaledXY, distance] for each curve
+ closestPts= self.GetClosestPoints(pntXY, pointScaled)
+ if closestPts == []:
+ return [] #no graph present
+ #find one with least distance
+ dists = [c[-1] for c in closestPts]
+ mdist = min(dists) #Min dist
+ i = dists.index(mdist) #index for min dist
+ return closestPts[i] #this is the closest point on closest curve
+
+ def UpdatePointLabel(self, mDataDict):
+ """Updates the pointLabel point on screen with data contained in
+ mDataDict.
+
+ mDataDict will be passed to your function set by
+ SetPointLabelFunc. It can contain anything you
+ want to display on the screen at the scaledXY point
+ you specify.
+
+ This function can be called from parent window with onClick,
+ onMotion events etc.
+ """
+ if self.last_PointLabel != None:
+ #compare pointXY
+ if mDataDict["pointXY"] != self.last_PointLabel["pointXY"]:
+ #closest changed
+ self._drawPointLabel(self.last_PointLabel) #erase old
+ self._drawPointLabel(mDataDict) #plot new
+ else:
+ #just plot new with no erase
+ self._drawPointLabel(mDataDict) #plot new
+ #save for next erase
+ self.last_PointLabel = mDataDict
+
+ # event handlers **********************************
+ def OnMotion(self, event):
+ if self._zoomEnabled and event.LeftIsDown():
+ if self._hasDragged:
+ self._drawRubberBand(self._zoomCorner1, self._zoomCorner2) # remove old
+ else:
+ self._hasDragged= True
+ self._zoomCorner2[0], self._zoomCorner2[1] = self.GetXY(event)
+ self._drawRubberBand(self._zoomCorner1, self._zoomCorner2) # add new
+
+ def OnMouseLeftDown(self,event):
+ self._zoomCorner1[0], self._zoomCorner1[1]= self.GetXY(event)
+
+ def OnMouseLeftUp(self, event):
+ if self._zoomEnabled:
+ if self._hasDragged == True:
+ self._drawRubberBand(self._zoomCorner1, self._zoomCorner2) # remove old
+ self._zoomCorner2[0], self._zoomCorner2[1]= self.GetXY(event)
+ self._hasDragged = False # reset flag
+ minX, minY= _numpy.minimum( self._zoomCorner1, self._zoomCorner2)
+ maxX, maxY= _numpy.maximum( self._zoomCorner1, self._zoomCorner2)
+ self.last_PointLabel = None #reset pointLabel
+ if self.last_draw != None:
+ self.Draw(self.last_draw[0], xAxis = (minX,maxX), yAxis = (minY,maxY), dc = None)
+ #else: # A box has not been drawn, zoom in on a point
+ ## this interfered with the double click, so I've disables it.
+ # X,Y = self.GetXY(event)
+ # self.Zoom( (X,Y), (self._zoomInFactor,self._zoomInFactor) )
+
+ def OnMouseDoubleClick(self,event):
+ if self._zoomEnabled:
+ self.Reset()
+
+ def OnMouseRightDown(self,event):
+ if self._zoomEnabled:
+ X,Y = self.GetXY(event)
+ self.Zoom( (X,Y), (self._zoomOutFactor, self._zoomOutFactor) )
+
+ def OnPaint(self, event):
+ # All that is needed here is to draw the buffer to screen
+ if self.last_PointLabel != None:
+ self._drawPointLabel(self.last_PointLabel) #erase old
+ self.last_PointLabel = None
+
+ #paint current buffer to screen
+ dc = wx.BufferedPaintDC(self, self._Buffer)
+
+ def OnSize(self,event):
+ # The Buffer init is done here, to make sure the buffer is always
+ # the same size as the Window
+ Size = self.GetClientSize()
+
+ # Make new offscreen bitmap: this bitmap will always have the
+ # current drawing in it, so it can be used to save the image to
+ # a file, or whatever.
+ self._Buffer = wx.EmptyBitmap(Size[0],Size[1],24)
+
+
+ if True: #self.use_persistence:
+ #self._Bufferarray = _numpy.zeros((Size[0], Size[1],3), dtype=_numpy.uint8)
+ self._Bufferarray = _numpy.zeros((Size[0]* Size[1]*3), dtype=_numpy.uint8)
+
+ # Make new second offscreen bitmap: this bitmap will always have the
+ # last drawing in it, so it can be used to do display time dependent processing
+ # like averaging (IIR) or show differences between updates
+ self._Buffer2 = wx.EmptyBitmap(Size[0],Size[1],24)
+ # now the extra buffers for the IIR processing
+ # note the different datatype uint32
+ self._Buffer2array = _numpy.zeros((Size[0]* Size[1]*3), dtype=_numpy.uint32) #dtype=_numpy.float
+ self._Buffer3array = _numpy.zeros((Size[0]* Size[1]*3), dtype=_numpy.uint32) #dtype=_numpy.float
+ # optional you can set the ufunct buffer size to improve speed
+ #_numpy.setbufsize(16*((Size[0]* Size[1]*3)/16 +1))
+ self._setSize()
+
+ self.last_PointLabel = None #reset pointLabel
+
+ if self.last_draw is None:
+ self.Clear()
+ else:
+ graphics, xSpec, ySpec = self.last_draw
+ self.Draw(graphics,xSpec,ySpec)
+
+ def OnLeave(self, event):
+ """Used to erase pointLabel when mouse outside window"""
+ if self.last_PointLabel != None:
+ self._drawPointLabel(self.last_PointLabel) #erase old
+ self.last_PointLabel = None
+
+
+ # Private Methods **************************************************
+ def _setSize(self, width=None, height=None):
+ """DC width and height."""
+ if width == None:
+ (self.width,self.height) = self.GetClientSize()
+ else:
+ self.width, self.height= width,height
+ self.plotbox_size = 0.97*_numpy.array([self.width, self.height])
+ xo = 0.5*(self.width-self.plotbox_size[0])
+ yo = self.height-0.5*(self.height-self.plotbox_size[1])
+ self.plotbox_origin = _numpy.array([xo, yo])
+
+ def _setPrinterScale(self, scale):
+ """Used to thicken lines and increase marker size for print out."""
+ # line thickness on printer is very thin at 600 dot/in. Markers small
+ self.printerScale= scale
+
+ def _printDraw(self, printDC):
+ """Used for printing."""
+ if self.last_draw != None:
+ graphics, xSpec, ySpec= self.last_draw
+ self.Draw(graphics,xSpec,ySpec,printDC)
+
+ def _drawPointLabel(self, mDataDict):
+ """Draws and erases pointLabels"""
+ width = self._Buffer.GetWidth()
+ height = self._Buffer.GetHeight()
+ tmp_Buffer = wx.EmptyBitmap(width,height)
+ dcs = wx.MemoryDC()
+ dcs.SelectObject(tmp_Buffer)
+ dcs.Clear()
+ dcs.BeginDrawing()
+ self._pointLabelFunc(dcs,mDataDict) #custom user pointLabel function
+ dcs.EndDrawing()
+
+ dc = wx.ClientDC( self )
+ #this will erase if called twice
+ dc.Blit(0, 0, width, height, dcs, 0, 0, wx.EQUIV) #(NOT src) XOR dst
+
+
+ def _drawLegend(self,dc,graphics,rhsW,topH,legendBoxWH, legendSymExt, legendTextExt):
+ """Draws legend symbols and text"""
+ # top right hand corner of graph box is ref corner
+ trhc= self.plotbox_origin+ (self.plotbox_size-[rhsW,topH])*[1,-1]
+ legendLHS= .091* legendBoxWH[0] # border space between legend sym and graph box
+ lineHeight= max(legendSymExt[1], legendTextExt[1]) * 1.1 #1.1 used as space between lines
+ dc.SetFont(self._getFont(self._fontSizeLegend))
+ for i in range(len(graphics)):
+ o = graphics[i]
+ s= i*lineHeight
+ if isinstance(o,PolyMarker):
+ # draw marker with legend
+ pnt= (trhc[0]+legendLHS+legendSymExt[0]/2., trhc[1]+s+lineHeight/2.)
+ o.draw(dc, self.printerScale, coord= _numpy.array([pnt]))
+ elif isinstance(o,PolyLine):
+ # draw line with legend
+ pnt1= (trhc[0]+legendLHS, trhc[1]+s+lineHeight/2.)
+ pnt2= (trhc[0]+legendLHS+legendSymExt[0], trhc[1]+s+lineHeight/2.)
+ o.draw(dc, self.printerScale, coord= _numpy.array([pnt1,pnt2]))
+ else:
+ raise TypeError, "object is neither PolyMarker or PolyLine instance"
+ # draw legend txt
+ pnt= (trhc[0]+legendLHS+legendSymExt[0], trhc[1]+s+lineHeight/2.-legendTextExt[1]/2)
+ dc.DrawText(o.getLegend(),pnt[0],pnt[1])
+ dc.SetFont(self._getFont(self._fontSizeAxis)) # reset
+
+ def _titleLablesWH(self, dc, graphics):
+ """Draws Title and labels and returns width and height for each"""
+ # TextExtents for Title and Axis Labels
+ dc.SetFont(self._getFont(self._fontSizeTitle))
+ title= graphics.getTitle()
+ titleWH= dc.GetTextExtent(title)
+ dc.SetFont(self._getFont(self._fontSizeAxis))
+ xLabel, yLabel= graphics.getXLabel(),graphics.getYLabel()
+ xLabelWH= dc.GetTextExtent(xLabel)
+ yLabelWH= dc.GetTextExtent(yLabel)
+ return titleWH, xLabelWH, yLabelWH
+
+ def _legendWH(self, dc, graphics):
+ """Returns the size in screen units for legend box"""
+ if self._legendEnabled != True:
+ legendBoxWH= symExt= txtExt= (0,0)
+ else:
+ # find max symbol size
+ symExt= graphics.getSymExtent(self.printerScale)
+ # find max legend text extent
+ dc.SetFont(self._getFont(self._fontSizeLegend))
+ txtList= graphics.getLegendNames()
+ txtExt= dc.GetTextExtent(txtList[0])
+ for txt in graphics.getLegendNames()[1:]:
+ txtExt= _numpy.maximum(txtExt,dc.GetTextExtent(txt))
+ maxW= symExt[0]+txtExt[0]
+ maxH= max(symExt[1],txtExt[1])
+ # padding .1 for lhs of legend box and space between lines
+ maxW= maxW* 1.1
+ maxH= maxH* 1.1 * len(txtList)
+ dc.SetFont(self._getFont(self._fontSizeAxis))
+ legendBoxWH= (maxW,maxH)
+ return (legendBoxWH, symExt, txtExt)
+
+ def _drawRubberBand(self, corner1, corner2):
+ """Draws/erases rect box from corner1 to corner2"""
+ ptx,pty,rectWidth,rectHeight= self._point2ClientCoord(corner1, corner2)
+ # draw rectangle
+ dc = wx.ClientDC( self )
+ dc.BeginDrawing()
+ dc.SetPen(wx.Pen(wx.BLACK))
+ dc.SetBrush(wx.Brush( wx.WHITE, wx.TRANSPARENT ) )
+ dc.SetLogicalFunction(wx.INVERT)
+ dc.DrawRectangle( ptx,pty, rectWidth,rectHeight)
+ dc.SetLogicalFunction(wx.COPY)
+ dc.EndDrawing()
+
+ def _getFont(self,size):
+ """Take font size, adjusts if printing and returns wx.Font"""
+ s = size*self.printerScale
+ of = self.GetFont()
+ # Linux speed up to get font from cache rather than X font server
+ key = (int(s), of.GetFamily (), of.GetStyle (), of.GetWeight ())
+ font = self._fontCache.get (key, None)
+ if font:
+ return font # yeah! cache hit
+ else:
+ font = wx.Font(int(s), of.GetFamily(), of.GetStyle(), of.GetWeight())
+ self._fontCache[key] = font
+ return font
+
+
+ def _point2ClientCoord(self, corner1, corner2):
+ """Converts user point coords to client screen int coords x,y,width,height"""
+ c1= _numpy.array(corner1)
+ c2= _numpy.array(corner2)
+ # convert to screen coords
+ pt1= c1*self._pointScale+self._pointShift
+ pt2= c2*self._pointScale+self._pointShift
+ # make height and width positive
+ pul= _numpy.minimum(pt1,pt2) # Upper left corner
+ plr= _numpy.maximum(pt1,pt2) # Lower right corner
+ rectWidth, rectHeight= plr-pul
+ ptx,pty= pul
+ return ptx, pty, rectWidth, rectHeight
+
+ def _axisInterval(self, spec, lower, upper):
+ """Returns sensible axis range for given spec"""
+ if spec == 'none' or spec == 'min':
+ if lower == upper:
+ return lower-0.5, upper+0.5
+ else:
+ return lower, upper
+ elif spec == 'auto':
+ range = upper-lower
+ # if range == 0.:
+ if abs(range) < 1e-36:
+ return lower-0.5, upper+0.5
+ log = _numpy.log10(range)
+ power = _numpy.floor(log)
+ fraction = log-power
+ if fraction <= 0.05:
+ power = power-1
+ grid = 10.**power
+ lower = lower - lower % grid
+ mod = upper % grid
+ if mod != 0:
+ upper = upper - mod + grid
+ return lower, upper
+ elif type(spec) == type(()):
+ lower, upper = spec
+ if lower <= upper:
+ return lower, upper
+ else:
+ return upper, lower
+ else:
+ raise ValueError, str(spec) + ': illegal axis specification'
+
+ def _drawAxes(self, dc, p1, p2, scale, shift, xticks, yticks):
+
+ penWidth= self.printerScale # increases thickness for printing only
+ dc.SetPen(wx.Pen(wx.NamedColour('BLACK'), penWidth))
+
+ # set length of tick marks--long ones make grid
+ if self._gridEnabled:
+ x,y,width,height= self._point2ClientCoord(p1,p2)
+ yTickLength= width/2.0 +1
+ xTickLength= height/2.0 +1
+ else:
+ yTickLength= 3 * self.printerScale # lengthens lines for printing
+ xTickLength= 3 * self.printerScale
+
+ if self._xSpec is not 'none':
+ lower, upper = p1[0],p2[0]
+ text = 1
+ for y, d in [(p1[1], -xTickLength), (p2[1], xTickLength)]: # miny, maxy and tick lengths
+ a1 = scale*_numpy.array([lower, y])+shift
+ a2 = scale*_numpy.array([upper, y])+shift
+ dc.DrawLine(a1[0],a1[1],a2[0],a2[1]) # draws upper and lower axis line
+ for x, label in xticks:
+ pt = scale*_numpy.array([x, y])+shift
+ dc.DrawLine(pt[0],pt[1],pt[0],pt[1] + d) # draws tick mark d units
+ if text:
+ dc.DrawText(label,pt[0],pt[1])
+ text = 0 # axis values not drawn on top side
+
+ if self._ySpec is not 'none':
+ lower, upper = p1[1],p2[1]
+ text = 1
+ h = dc.GetCharHeight()
+ for x, d in [(p1[0], -yTickLength), (p2[0], yTickLength)]:
+ a1 = scale*_numpy.array([x, lower])+shift
+ a2 = scale*_numpy.array([x, upper])+shift
+ dc.DrawLine(a1[0],a1[1],a2[0],a2[1])
+ for y, label in yticks:
+ pt = scale*_numpy.array([x, y])+shift
+ dc.DrawLine(pt[0],pt[1],pt[0]-d,pt[1])
+ if text:
+ dc.DrawText(label,pt[0]-dc.GetTextExtent(label)[0],
+ pt[1]-0.5*h)
+ text = 0 # axis values not drawn on right side
+
+ def _ticks(self, lower, upper, step=None):
+ ideal = (upper-lower)/7.
+ log = _numpy.log10(ideal)
+ power = _numpy.floor(log)
+ fraction = log-power
+ factor = 1.
+ error = fraction
+ for f, lf in self._multiples:
+ e = _numpy.fabs(fraction-lf)
+ if e < error:
+ error = e
+ factor = f
+ grid = factor * 10.**power
+ if power > 4 or power < -4:
+ format = '%+7.1e'
+ elif power >= 0:
+ digits = max(1, int(power))
+ format = '%' + `digits`+'.0f'
+ else:
+ digits = -int(power)
+ format = '%'+`digits+2`+'.'+`digits`+'f'
+ #force grid when step is not None
+ if step is not None: grid = step
+ ticks = []
+ t = -grid*_numpy.floor(-lower/grid)
+ while t <= upper:
+ if t == -0: t = 0 #remove neg zero condition
+ ticks.append( (t, format % (t,)) )
+ t = t + grid
+ return ticks
+
+ def _scope_ticks (self, lower, upper):
+ '''Always 10 divisions, no labels'''
+ grid = (upper - lower) / 10.0
+ ticks = []
+ t = lower
+ while t <= upper:
+ ticks.append( (t, ""))
+ t = t + grid
+ return ticks
+
+ _multiples = [(2., _numpy.log10(2.)), (5., _numpy.log10(5.))]
+
+
+#-------------------------------------------------------------------------------
+# Used to layout the printer page
+
+class PlotPrintout(wx.Printout):
+ """Controls how the plot is made in printing and previewing"""
+ # Do not change method names in this class,
+ # we have to override wx.Printout methods here!
+ def __init__(self, graph):
+ """graph is instance of plotCanvas to be printed or previewed"""
+ wx.Printout.__init__(self)
+ self.graph = graph
+
+ def HasPage(self, page):
+ if page == 1:
+ return True
+ else:
+ return False
+
+ def GetPageInfo(self):
+ return (1, 1, 1, 1) # disable page numbers
+
+ def OnPrintPage(self, page):
+ dc = self.GetDC() # allows using floats for certain functions
+## print "PPI Printer",self.GetPPIPrinter()
+## print "PPI Screen", self.GetPPIScreen()
+## print "DC GetSize", dc.GetSize()
+## print "GetPageSizePixels", self.GetPageSizePixels()
+ # Note PPIScreen does not give the correct number
+ # Calulate everything for printer and then scale for preview
+ PPIPrinter= self.GetPPIPrinter() # printer dots/inch (w,h)
+ #PPIScreen= self.GetPPIScreen() # screen dots/inch (w,h)
+ dcSize= dc.GetSize() # DC size
+ pageSize= self.GetPageSizePixels() # page size in terms of pixcels
+ clientDcSize= self.graph.GetClientSize()
+
+ # find what the margins are (mm)
+ margLeftSize,margTopSize= self.graph.pageSetupData.GetMarginTopLeft()
+ margRightSize, margBottomSize= self.graph.pageSetupData.GetMarginBottomRight()
+
+ # calculate offset and scale for dc
+ pixLeft= margLeftSize*PPIPrinter[0]/25.4 # mm*(dots/in)/(mm/in)
+ pixRight= margRightSize*PPIPrinter[0]/25.4
+ pixTop= margTopSize*PPIPrinter[1]/25.4
+ pixBottom= margBottomSize*PPIPrinter[1]/25.4
+
+ plotAreaW= pageSize[0]-(pixLeft+pixRight)
+ plotAreaH= pageSize[1]-(pixTop+pixBottom)
+
+ # ratio offset and scale to screen size if preview
+ if self.IsPreview():
+ ratioW= float(dcSize[0])/pageSize[0]
+ ratioH= float(dcSize[1])/pageSize[1]
+ pixLeft *= ratioW
+ pixTop *= ratioH
+ plotAreaW *= ratioW
+ plotAreaH *= ratioH
+
+ # rescale plot to page or preview plot area
+ self.graph._setSize(plotAreaW,plotAreaH)
+
+ # Set offset and scale
+ dc.SetDeviceOrigin(pixLeft,pixTop)
+
+ # Thicken up pens and increase marker size for printing
+ ratioW= float(plotAreaW)/clientDcSize[0]
+ ratioH= float(plotAreaH)/clientDcSize[1]
+ aveScale= (ratioW+ratioH)/2
+ self.graph._setPrinterScale(aveScale) # tickens up pens for printing
+
+ self.graph._printDraw(dc)
+ # rescale back to original
+ self.graph._setSize()
+ self.graph._setPrinterScale(1)
+ self.graph.Redraw() #to get point label scale and shift correct
+
+ return True
+
+
+
+
+#---------------------------------------------------------------------------
+# if running standalone...
+#
+# ...a sample implementation using the above
+#
+
+def _draw1Objects():
+ # 100 points sin function, plotted as green circles
+ data1 = 2.*_numpy.pi*_numpy.arange(200)/200.
+ data1.shape = (100, 2)
+ data1[:,1] = _numpy.sin(data1[:,0])
+ markers1 = PolyMarker(data1, legend='Green Markers', colour='green', marker='circle',size=1)
+
+ # 50 points cos function, plotted as red line
+ data1 = 2.*_numpy.pi*_numpy.arange(100)/100.
+ data1.shape = (50,2)
+ data1[:,1] = _numpy.cos(data1[:,0])
+ lines = PolyLine(data1, legend= 'Red Line', colour='red')
+
+ # A few more points...
+ pi = _numpy.pi
+ markers2 = PolyMarker([(0., 0.), (pi/4., 1.), (pi/2, 0.),
+ (3.*pi/4., -1)], legend='Cross Legend', colour='blue',
+ marker='cross')
+
+ return PlotGraphics([markers1, lines, markers2],"Graph Title", "X Axis", "Y Axis")
+
+def _draw2Objects():
+ # 100 points sin function, plotted as green dots
+ data1 = 2.*_numpy.pi*_numpy.arange(200)/200.
+ data1.shape = (100, 2)
+ data1[:,1] = _numpy.sin(data1[:,0])
+ line1 = PolyLine(data1, legend='Green Line', colour='green', width=6, style=wx.DOT)
+
+ # 50 points cos function, plotted as red dot-dash
+ data1 = 2.*_numpy.pi*_numpy.arange(100)/100.
+ data1.shape = (50,2)
+ data1[:,1] = _numpy.cos(data1[:,0])
+ line2 = PolyLine(data1, legend='Red Line', colour='red', width=3, style= wx.DOT_DASH)
+
+ # A few more points...
+ pi = _numpy.pi
+ markers1 = PolyMarker([(0., 0.), (pi/4., 1.), (pi/2, 0.),
+ (3.*pi/4., -1)], legend='Cross Hatch Square', colour='blue', width= 3, size= 6,
+ fillcolour= 'red', fillstyle= wx.CROSSDIAG_HATCH,
+ marker='square')
+
+ return PlotGraphics([markers1, line1, line2], "Big Markers with Different Line Styles")
+
+def _draw3Objects():
+ markerList= ['circle', 'dot', 'square', 'triangle', 'triangle_down',
+ 'cross', 'plus', 'circle']
+ m=[]
+ for i in range(len(markerList)):
+ m.append(PolyMarker([(2*i+.5,i+.5)], legend=markerList[i], colour='blue',
+ marker=markerList[i]))
+ return PlotGraphics(m, "Selection of Markers", "Minimal Axis", "No Axis")
+
+def _draw4Objects():
+ # 25,000 point line
+ data1 = _numpy.arange(5e5,1e6,10)
+ data1.shape = (25000, 2)
+ line1 = PolyLine(data1, legend='Wide Line', colour='green', width=5)
+
+ # A few more points...
+ markers2 = PolyMarker(data1, legend='Square', colour='blue',
+ marker='square')
+ return PlotGraphics([line1, markers2], "25,000 Points", "Value X", "")
+
+def _draw5Objects():
+ # Empty graph with axis defined but no points/lines
+ points=[]
+ line1 = PolyLine(points, legend='Wide Line', colour='green', width=5)
+ return PlotGraphics([line1], "Empty Plot With Just Axes", "Value X", "Value Y")
+
+def _draw6Objects():
+ # Bar graph
+ points1=[(1,0), (1,10)]
+ line1 = PolyLine(points1, colour='green', legend='Feb.', width=10)
+ points1g=[(2,0), (2,4)]
+ line1g = PolyLine(points1g, colour='red', legend='Mar.', width=10)
+ points1b=[(3,0), (3,6)]
+ line1b = PolyLine(points1b, colour='blue', legend='Apr.', width=10)
+
+ points2=[(4,0), (4,12)]
+ line2 = PolyLine(points2, colour='Yellow', legend='May', width=10)
+ points2g=[(5,0), (5,8)]
+ line2g = PolyLine(points2g, colour='orange', legend='June', width=10)
+ points2b=[(6,0), (6,4)]
+ line2b = PolyLine(points2b, colour='brown', legend='July', width=10)
+
+ return PlotGraphics([line1, line1g, line1b, line2, line2g, line2b],
+ "Bar Graph - (Turn on Grid, Legend)", "Months", "Number of Students")
+
+
+class TestFrame(wx.Frame):
+ def __init__(self, parent, id, title):
+ wx.Frame.__init__(self, parent, id, title,
+ wx.DefaultPosition, (600, 400))
+
+ # Now Create the menu bar and items
+ self.mainmenu = wx.MenuBar()
+
+ menu = wx.Menu()
+ menu.Append(200, 'Page Setup...', 'Setup the printer page')
+ self.Bind(wx.EVT_MENU, self.OnFilePageSetup, id=200)
+
+ menu.Append(201, 'Print Preview...', 'Show the current plot on page')
+ self.Bind(wx.EVT_MENU, self.OnFilePrintPreview, id=201)
+
+ menu.Append(202, 'Print...', 'Print the current plot')
+ self.Bind(wx.EVT_MENU, self.OnFilePrint, id=202)
+
+ menu.Append(203, 'Save Plot...', 'Save current plot')
+ self.Bind(wx.EVT_MENU, self.OnSaveFile, id=203)
+
+ menu.Append(205, 'E&xit', 'Enough of this already!')
+ self.Bind(wx.EVT_MENU, self.OnFileExit, id=205)
+ self.mainmenu.Append(menu, '&File')
+
+ menu = wx.Menu()
+ menu.Append(206, 'Draw1', 'Draw plots1')
+ self.Bind(wx.EVT_MENU,self.OnPlotDraw1, id=206)
+ menu.Append(207, 'Draw2', 'Draw plots2')
+ self.Bind(wx.EVT_MENU,self.OnPlotDraw2, id=207)
+ menu.Append(208, 'Draw3', 'Draw plots3')
+ self.Bind(wx.EVT_MENU,self.OnPlotDraw3, id=208)
+ menu.Append(209, 'Draw4', 'Draw plots4')
+ self.Bind(wx.EVT_MENU,self.OnPlotDraw4, id=209)
+ menu.Append(210, 'Draw5', 'Draw plots5')
+ self.Bind(wx.EVT_MENU,self.OnPlotDraw5, id=210)
+ menu.Append(260, 'Draw6', 'Draw plots6')
+ self.Bind(wx.EVT_MENU,self.OnPlotDraw6, id=260)
+
+
+ menu.Append(211, '&Redraw', 'Redraw plots')
+ self.Bind(wx.EVT_MENU,self.OnPlotRedraw, id=211)
+ menu.Append(212, '&Clear', 'Clear canvas')
+ self.Bind(wx.EVT_MENU,self.OnPlotClear, id=212)
+ menu.Append(213, '&Scale', 'Scale canvas')
+ self.Bind(wx.EVT_MENU,self.OnPlotScale, id=213)
+ menu.Append(214, 'Enable &Zoom', 'Enable Mouse Zoom', kind=wx.ITEM_CHECK)
+ self.Bind(wx.EVT_MENU,self.OnEnableZoom, id=214)
+ menu.Append(215, 'Enable &Grid', 'Turn on Grid', kind=wx.ITEM_CHECK)
+ self.Bind(wx.EVT_MENU,self.OnEnableGrid, id=215)
+ menu.Append(220, 'Enable &Legend', 'Turn on Legend', kind=wx.ITEM_CHECK)
+ self.Bind(wx.EVT_MENU,self.OnEnableLegend, id=220)
+ menu.Append(222, 'Enable &Point Label', 'Show Closest Point', kind=wx.ITEM_CHECK)
+ self.Bind(wx.EVT_MENU,self.OnEnablePointLabel, id=222)
+
+ menu.Append(225, 'Scroll Up 1', 'Move View Up 1 Unit')
+ self.Bind(wx.EVT_MENU,self.OnScrUp, id=225)
+ menu.Append(230, 'Scroll Rt 2', 'Move View Right 2 Units')
+ self.Bind(wx.EVT_MENU,self.OnScrRt, id=230)
+ menu.Append(235, '&Plot Reset', 'Reset to original plot')
+ self.Bind(wx.EVT_MENU,self.OnReset, id=235)
+
+ self.mainmenu.Append(menu, '&Plot')
+
+ menu = wx.Menu()
+ menu.Append(300, '&About', 'About this thing...')
+ self.Bind(wx.EVT_MENU, self.OnHelpAbout, id=300)
+ self.mainmenu.Append(menu, '&Help')
+
+ self.SetMenuBar(self.mainmenu)
+
+ # A status bar to tell people what's happening
+ self.CreateStatusBar(1)
+
+ self.client = PlotCanvas(self)
+ #define the function for drawing pointLabels
+ self.client.SetPointLabelFunc(self.DrawPointLabel)
+ # Create mouse event for showing cursor coords in status bar
+ self.client.Bind(wx.EVT_LEFT_DOWN, self.OnMouseLeftDown)
+ # Show closest point when enabled
+ self.client.Bind(wx.EVT_MOTION, self.OnMotion)
+
+ self.Show(True)
+
+ def DrawPointLabel(self, dc, mDataDict):
+ """This is the fuction that defines how the pointLabels are plotted
+ dc - DC that will be passed
+ mDataDict - Dictionary of data that you want to use for the pointLabel
+
+ As an example I have decided I want a box at the curve point
+ with some text information about the curve plotted below.
+ Any wxDC method can be used.
+ """
+ # ----------
+ dc.SetPen(wx.Pen(wx.BLACK))
+ dc.SetBrush(wx.Brush( wx.BLACK, wx.SOLID ) )
+
+ sx, sy = mDataDict["scaledXY"] #scaled x,y of closest point
+ dc.DrawRectangle( sx-5,sy-5, 10, 10) #10by10 square centered on point
+ px,py = mDataDict["pointXY"]
+ cNum = mDataDict["curveNum"]
+ pntIn = mDataDict["pIndex"]
+ legend = mDataDict["legend"]
+ #make a string to display
+ s = "Crv# %i, '%s', Pt. (%.2f,%.2f), PtInd %i" %(cNum, legend, px, py, pntIn)
+ dc.DrawText(s, sx , sy+1)
+ # -----------
+
+ def OnMouseLeftDown(self,event):
+ s= "Left Mouse Down at Point: (%.4f, %.4f)" % self.client.GetXY(event)
+ self.SetStatusText(s)
+ event.Skip() #allows plotCanvas OnMouseLeftDown to be called
+
+ def OnMotion(self, event):
+ #show closest point (when enbled)
+ if self.client.GetEnablePointLabel() == True:
+ #make up dict with info for the pointLabel
+ #I've decided to mark the closest point on the closest curve
+ dlst= self.client.GetClosetPoint( self.client.GetXY(event), pointScaled= True)
+ if dlst != []: #returns [] if none
+ curveNum, legend, pIndex, pointXY, scaledXY, distance = dlst
+ #make up dictionary to pass to my user function (see DrawPointLabel)
+ mDataDict= {"curveNum":curveNum, "legend":legend, "pIndex":pIndex,\
+ "pointXY":pointXY, "scaledXY":scaledXY}
+ #pass dict to update the pointLabel
+ self.client.UpdatePointLabel(mDataDict)
+ event.Skip() #go to next handler
+
+ def OnFilePageSetup(self, event):
+ self.client.PageSetup()
+
+ def OnFilePrintPreview(self, event):
+ self.client.PrintPreview()
+
+ def OnFilePrint(self, event):
+ self.client.Printout()
+
+ def OnSaveFile(self, event):
+ self.client.SaveFile()
+
+ def OnFileExit(self, event):
+ self.Close()
+
+ def OnPlotDraw1(self, event):
+ self.resetDefaults()
+ self.client.Draw(_draw1Objects())
+
+ def OnPlotDraw2(self, event):
+ self.resetDefaults()
+ self.client.Draw(_draw2Objects())
+
+ def OnPlotDraw3(self, event):
+ self.resetDefaults()
+ self.client.SetFont(wx.Font(10,wx.SCRIPT,wx.NORMAL,wx.NORMAL))
+ self.client.SetFontSizeAxis(20)
+ self.client.SetFontSizeLegend(12)
+ self.client.SetXSpec('min')
+ self.client.SetYSpec('none')
+ self.client.Draw(_draw3Objects())
+
+ def OnPlotDraw4(self, event):
+ self.resetDefaults()
+ drawObj= _draw4Objects()
+ self.client.Draw(drawObj)
+## # profile
+## start = _time.clock()
+## for x in range(10):
+## self.client.Draw(drawObj)
+## print "10 plots of Draw4 took: %f sec."%(_time.clock() - start)
+## # profile end
+
+ def OnPlotDraw5(self, event):
+ # Empty plot with just axes
+ self.resetDefaults()
+ drawObj= _draw5Objects()
+ # make the axis X= (0,5), Y=(0,10)
+ # (default with None is X= (-1,1), Y= (-1,1))
+ self.client.Draw(drawObj, xAxis= (0,5), yAxis= (0,10))
+
+ def OnPlotDraw6(self, event):
+ #Bar Graph Example
+ self.resetDefaults()
+ #self.client.SetEnableLegend(True) #turn on Legend
+ #self.client.SetEnableGrid(True) #turn on Grid
+ self.client.SetXSpec('none') #turns off x-axis scale
+ self.client.SetYSpec('auto')
+ self.client.Draw(_draw6Objects(), xAxis= (0,7))
+
+ def OnPlotRedraw(self,event):
+ self.client.Redraw()
+
+ def OnPlotClear(self,event):
+ self.client.Clear()
+
+ def OnPlotScale(self, event):
+ if self.client.last_draw != None:
+ graphics, xAxis, yAxis= self.client.last_draw
+ self.client.Draw(graphics,(1,3.05),(0,1))
+
+ def OnEnableZoom(self, event):
+ self.client.SetEnableZoom(event.IsChecked())
+
+ def OnEnableGrid(self, event):
+ self.client.SetEnableGrid(event.IsChecked())
+
+ def OnEnableLegend(self, event):
+ self.client.SetEnableLegend(event.IsChecked())
+
+ def OnEnablePointLabel(self, event):
+ self.client.SetEnablePointLabel(event.IsChecked())
+
+ def OnScrUp(self, event):
+ self.client.ScrollUp(1)
+
+ def OnScrRt(self,event):
+ self.client.ScrollRight(2)
+
+ def OnReset(self,event):
+ self.client.Reset()
+
+ def OnHelpAbout(self, event):
+ from wx.lib.dialogs import ScrolledMessageDialog
+ about = ScrolledMessageDialog(self, __doc__, "About...")
+ about.ShowModal()
+
+ def resetDefaults(self):
+ """Just to reset the fonts back to the PlotCanvas defaults"""
+ self.client.SetFont(wx.Font(10,wx.SWISS,wx.NORMAL,wx.NORMAL))
+ self.client.SetFontSizeAxis(10)
+ self.client.SetFontSizeLegend(7)
+ self.client.SetXSpec('auto')
+ self.client.SetYSpec('auto')
+
+
+def __test():
+
+ class MyApp(wx.App):
+ def OnInit(self):
+ wx.InitAllImageHandlers()
+ frame = TestFrame(None, -1, "PlotCanvas")
+ #frame.Show(True)
+ self.SetTopWindow(frame)
+ return True
+
+
+ app = MyApp(0)
+ app.MainLoop()
+
+if __name__ == '__main__':
+ __test()
diff --git a/gr-wxgui/src/python/plotter/__init__.py b/gr-wxgui/src/python/plotter/__init__.py
new file mode 100644
index 000000000..616492a3e
--- /dev/null
+++ b/gr-wxgui/src/python/plotter/__init__.py
@@ -0,0 +1,24 @@
+#
+# 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.
+#
+
+from channel_plotter import channel_plotter
+from waterfall_plotter import waterfall_plotter
+from bar_plotter import bar_plotter
diff --git a/gr-wxgui/src/python/plotter/bar_plotter.py b/gr-wxgui/src/python/plotter/bar_plotter.py
new file mode 100644
index 000000000..3f9259e9d
--- /dev/null
+++ b/gr-wxgui/src/python/plotter/bar_plotter.py
@@ -0,0 +1,144 @@
+#
+# 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.
+#
+
+import wx
+from grid_plotter_base import grid_plotter_base
+from OpenGL import GL
+import common
+import numpy
+
+LEGEND_TEXT_FONT_SIZE = 8
+LEGEND_BOX_PADDING = 3
+MIN_PADDING = 0, 0, 0, 70 #top, right, bottom, left
+#constants for the waveform storage
+SAMPLES_KEY = 'samples'
+COLOR_SPEC_KEY = 'color_spec'
+MARKERY_KEY = 'marker'
+TRIG_OFF_KEY = 'trig_off'
+
+##################################################
+# Bar Plotter for histogram waveforms
+##################################################
+class bar_plotter(grid_plotter_base):
+
+ def __init__(self, parent):
+ """
+ Create a new bar plotter.
+ """
+ #init
+ grid_plotter_base.__init__(self, parent, MIN_PADDING)
+ self._bars = list()
+ self._bar_width = .5
+ self._color_spec = (0, 0, 0)
+ #setup bar cache
+ self._bar_cache = self.new_gl_cache(self._draw_bars)
+ #setup bar plotter
+ self.register_init(self._init_bar_plotter)
+
+ def _init_bar_plotter(self):
+ """
+ Run gl initialization tasks.
+ """
+ GL.glEnableClientState(GL.GL_VERTEX_ARRAY)
+
+ def _draw_bars(self):
+ """
+ Draw the vertical bars.
+ """
+ bars = self._bars
+ num_bars = len(bars)
+ if num_bars == 0: return
+ #use scissor to prevent drawing outside grid
+ GL.glEnable(GL.GL_SCISSOR_TEST)
+ GL.glScissor(
+ self.padding_left,
+ self.padding_bottom+1,
+ self.width-self.padding_left-self.padding_right-1,
+ self.height-self.padding_top-self.padding_bottom-1,
+ )
+ #load the points
+ points = list()
+ width = self._bar_width/2
+ for i, bar in enumerate(bars):
+ points.extend([
+ (i-width, 0),
+ (i+width, 0),
+ (i+width, bar),
+ (i-width, bar),
+ ]
+ )
+ GL.glColor3f(*self._color_spec)
+ #matrix transforms
+ GL.glPushMatrix()
+ GL.glTranslatef(self.padding_left, self.padding_top, 0)
+ GL.glScalef(
+ (self.width-self.padding_left-self.padding_right),
+ (self.height-self.padding_top-self.padding_bottom),
+ 1,
+ )
+ GL.glTranslatef(0, 1, 0)
+ GL.glScalef(1.0/(num_bars-1), -1.0/(self.y_max-self.y_min), 1)
+ GL.glTranslatef(0, -self.y_min, 0)
+ #draw the bars
+ GL.glVertexPointerf(points)
+ GL.glDrawArrays(GL.GL_QUADS, 0, len(points))
+ GL.glPopMatrix()
+ GL.glDisable(GL.GL_SCISSOR_TEST)
+
+ def _populate_point_label(self, x_val, y_val):
+ """
+ Get the text the will populate the point label.
+ Give X and Y values for the current point.
+ Give values for the channel at the X coordinate.
+ @param x_val the current x value
+ @param y_val the current y value
+ @return a string with newlines
+ """
+ if len(self._bars) == 0: return ''
+ scalar = float(len(self._bars)-1)/(self.x_max - self.x_min)
+ #convert x val to bar #
+ bar_index = scalar*(x_val - self.x_min)
+ #if abs(bar_index - round(bar_index)) > self._bar_width/2: return ''
+ bar_index = int(round(bar_index))
+ bar_start = (bar_index - self._bar_width/2)/scalar + self.x_min
+ bar_end = (bar_index + self._bar_width/2)/scalar + self.x_min
+ bar_value = self._bars[bar_index]
+ return '%s to %s\n%s: %s'%(
+ common.eng_format(bar_start, self.x_units),
+ common.eng_format(bar_end, self.x_units),
+ self.y_label, common.eng_format(bar_value, self.y_units),
+ )
+
+ def set_bars(self, bars, bar_width, color_spec):
+ """
+ Set the bars.
+ @param bars a list of bars
+ @param bar_width the fractional width of the bar, between 0 and 1
+ @param color_spec the color tuple
+ """
+ self.lock()
+ self._bars = bars
+ self._bar_width = float(bar_width)
+ self._color_spec = color_spec
+ self._bar_cache.changed(True)
+ self.unlock()
+
+
diff --git a/gr-wxgui/src/python/plotter/channel_plotter.py b/gr-wxgui/src/python/plotter/channel_plotter.py
new file mode 100644
index 000000000..4bcc36fd4
--- /dev/null
+++ b/gr-wxgui/src/python/plotter/channel_plotter.py
@@ -0,0 +1,236 @@
+#
+# Copyright 2008, 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.
+#
+
+import wx
+from grid_plotter_base import grid_plotter_base
+from OpenGL import GL
+import common
+import numpy
+import gltext
+import math
+
+LEGEND_TEXT_FONT_SIZE = 8
+LEGEND_BOX_PADDING = 3
+MIN_PADDING = 35, 10, 0, 0 #top, right, bottom, left
+#constants for the waveform storage
+SAMPLES_KEY = 'samples'
+COLOR_SPEC_KEY = 'color_spec'
+MARKERY_KEY = 'marker'
+TRIG_OFF_KEY = 'trig_off'
+
+##################################################
+# Channel Plotter for X Y Waveforms
+##################################################
+class channel_plotter(grid_plotter_base):
+
+ def __init__(self, parent):
+ """
+ Create a new channel plotter.
+ """
+ #init
+ grid_plotter_base.__init__(self, parent, MIN_PADDING)
+ self.set_use_persistence(False)
+ #setup legend cache
+ self._legend_cache = self.new_gl_cache(self._draw_legend, 50)
+ self.enable_legend(False)
+ #setup waveform cache
+ self._waveform_cache = self.new_gl_cache(self._draw_waveforms, 50)
+ self._channels = dict()
+ #init channel plotter
+ self.register_init(self._init_channel_plotter)
+ self.callback = None
+
+ def _init_channel_plotter(self):
+ """
+ Run gl initialization tasks.
+ """
+ GL.glEnableClientState(GL.GL_VERTEX_ARRAY)
+
+ def enable_legend(self, enable=None):
+ """
+ Enable/disable the legend.
+ @param enable true to enable
+ @return the enable state when None
+ """
+ if enable is None: return self._enable_legend
+ self.lock()
+ self._enable_legend = enable
+ self._legend_cache.changed(True)
+ self.unlock()
+
+ def _draw_waveforms(self):
+ """
+ Draw the waveforms for each channel.
+ Scale the waveform data to the grid using gl matrix operations.
+ """
+ #use scissor to prevent drawing outside grid
+ GL.glEnable(GL.GL_SCISSOR_TEST)
+ GL.glScissor(
+ self.padding_left+1,
+ self.padding_bottom+1,
+ self.width-self.padding_left-self.padding_right-1,
+ self.height-self.padding_top-self.padding_bottom-1,
+ )
+ for channel in reversed(sorted(self._channels.keys())):
+ samples = self._channels[channel][SAMPLES_KEY]
+ num_samps = len(samples)
+ if not num_samps: continue
+ #use opengl to scale the waveform
+ GL.glPushMatrix()
+ GL.glTranslatef(self.padding_left, self.padding_top, 0)
+ GL.glScalef(
+ (self.width-self.padding_left-self.padding_right),
+ (self.height-self.padding_top-self.padding_bottom),
+ 1,
+ )
+ GL.glTranslatef(0, 1, 0)
+ if isinstance(samples, tuple):
+ x_scale, x_trans = 1.0/(self.x_max-self.x_min), -self.x_min
+ points = zip(*samples)
+ else:
+ x_scale, x_trans = 1.0/(num_samps-1), -self._channels[channel][TRIG_OFF_KEY]
+ points = zip(numpy.arange(0, num_samps), samples)
+ GL.glScalef(x_scale, -1.0/(self.y_max-self.y_min), 1)
+ GL.glTranslatef(x_trans, -self.y_min, 0)
+ #draw the points/lines
+ GL.glColor3f(*self._channels[channel][COLOR_SPEC_KEY])
+ marker = self._channels[channel][MARKERY_KEY]
+ if marker is None:
+ GL.glVertexPointerf(points)
+ GL.glDrawArrays(GL.GL_LINE_STRIP, 0, len(points))
+ elif isinstance(marker, (int, float)) and marker > 0:
+ GL.glPointSize(marker)
+ GL.glVertexPointerf(points)
+ GL.glDrawArrays(GL.GL_POINTS, 0, len(points))
+ GL.glPopMatrix()
+ GL.glDisable(GL.GL_SCISSOR_TEST)
+
+ def _populate_point_label(self, x_val, y_val):
+ """
+ Get the text the will populate the point label.
+ Give X and Y values for the current point.
+ Give values for the channel at the X coordinate.
+ @param x_val the current x value
+ @param y_val the current y value
+ @return a string with newlines
+ """
+ #create text
+ label_str = '%s: %s\n%s: %s'%(
+ self.x_label, common.eng_format(x_val, self.x_units),
+ self.y_label, common.eng_format(y_val, self.y_units),
+ )
+ for channel in sorted(self._channels.keys()):
+ samples = self._channels[channel][SAMPLES_KEY]
+ num_samps = len(samples)
+ if not num_samps: continue
+ if isinstance(samples, tuple): continue
+ #linear interpolation
+ x_index = (num_samps-1)*(x_val-self.x_min)/(self.x_max-self.x_min)
+ x_index_low = int(math.floor(x_index))
+ x_index_high = int(math.ceil(x_index))
+ scale = x_index - x_index_low + self._channels[channel][TRIG_OFF_KEY]
+ y_value = (samples[x_index_high] - samples[x_index_low])*scale + samples[x_index_low]
+ label_str += '\n%s: %s'%(channel, common.eng_format(y_value, self.y_units))
+ return label_str
+
+ def _call_callback (self, x_val, y_val):
+ if self.callback != None:
+ self.callback(x_val, y_val)
+
+ def set_callback (self, callback):
+ self.callback = callback
+
+ def _draw_legend(self):
+ """
+ Draw the legend in the upper right corner.
+ For each channel, draw a rectangle out of the channel color,
+ and overlay the channel text on top of the rectangle.
+ """
+ if not self.enable_legend(): return
+ x_off = self.width - self.padding_right - LEGEND_BOX_PADDING
+ for i, channel in enumerate(reversed(sorted(self._channels.keys()))):
+ samples = self._channels[channel][SAMPLES_KEY]
+ if not len(samples): continue
+ color_spec = self._channels[channel][COLOR_SPEC_KEY]
+ txt = gltext.Text(channel, font_size=LEGEND_TEXT_FONT_SIZE)
+ w, h = txt.get_size()
+ #draw rect + text
+ GL.glColor3f(*color_spec)
+ self._draw_rect(
+ x_off - w - LEGEND_BOX_PADDING,
+ self.padding_top/2 - h/2 - LEGEND_BOX_PADDING,
+ w+2*LEGEND_BOX_PADDING,
+ h+2*LEGEND_BOX_PADDING,
+ )
+ txt.draw_text(wx.Point(x_off - w, self.padding_top/2 - h/2))
+ x_off -= w + 4*LEGEND_BOX_PADDING
+
+ def clear_waveform(self, channel):
+ """
+ Remove a waveform from the list of waveforms.
+ @param channel the channel key
+ """
+ self.lock()
+ if channel in self._channels.keys():
+ self._channels.pop(channel)
+ self._legend_cache.changed(True)
+ self._waveform_cache.changed(True)
+ self.unlock()
+
+ def set_waveform(self, channel, samples=[], color_spec=(0, 0, 0), marker=None, trig_off=0):
+ """
+ Set the waveform for a given channel.
+ @param channel the channel key
+ @param samples the waveform samples
+ @param color_spec the 3-tuple for line color
+ @param marker None for line
+ @param trig_off fraction of sample for trigger offset
+ """
+ self.lock()
+ if channel not in self._channels.keys(): self._legend_cache.changed(True)
+ self._channels[channel] = {
+ SAMPLES_KEY: samples,
+ COLOR_SPEC_KEY: color_spec,
+ MARKERY_KEY: marker,
+ TRIG_OFF_KEY: trig_off,
+ }
+ self._waveform_cache.changed(True)
+ self.unlock()
+
+if __name__ == '__main__':
+ app = wx.PySimpleApp()
+ frame = wx.Frame(None, -1, 'Demo', wx.DefaultPosition)
+ vbox = wx.BoxSizer(wx.VERTICAL)
+
+ plotter = channel_plotter(frame)
+ plotter.set_x_grid(-1, 1, .2)
+ plotter.set_y_grid(-1, 1, .4)
+ vbox.Add(plotter, 1, wx.EXPAND)
+
+ plotter = channel_plotter(frame)
+ plotter.set_x_grid(-1, 1, .2)
+ plotter.set_y_grid(-1, 1, .4)
+ vbox.Add(plotter, 1, wx.EXPAND)
+
+ frame.SetSizerAndFit(vbox)
+ frame.SetSize(wx.Size(800, 600))
+ frame.Show()
+ app.MainLoop()
diff --git a/gr-wxgui/src/python/plotter/common.py b/gr-wxgui/src/python/plotter/common.py
new file mode 100644
index 000000000..88215e039
--- /dev/null
+++ b/gr-wxgui/src/python/plotter/common.py
@@ -0,0 +1,133 @@
+#
+# 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.
+#
+
+import threading
+import time
+import math
+import wx
+
+##################################################
+# Number formatting
+##################################################
+def get_exp(num):
+ """
+ Get the exponent of the number in base 10.
+ @param num the floating point number
+ @return the exponent as an integer
+ """
+ if num == 0: return 0
+ return int(math.floor(math.log10(abs(num))))
+
+def get_si_components(num):
+ """
+ Get the SI units for the number.
+ Extract the coeff and exponent of the number.
+ The exponent will be a multiple of 3.
+ @param num the floating point number
+ @return the tuple coeff, exp, prefix
+ """
+ num = float(num)
+ exp = get_exp(num)
+ exp -= exp%3
+ exp = min(max(exp, -24), 24) #bounds on SI table below
+ prefix = {
+ 24: 'Y', 21: 'Z',
+ 18: 'E', 15: 'P',
+ 12: 'T', 9: 'G',
+ 6: 'M', 3: 'k',
+ 0: '',
+ -3: 'm', -6: 'u',
+ -9: 'n', -12: 'p',
+ -15: 'f', -18: 'a',
+ -21: 'z', -24: 'y',
+ }[exp]
+ coeff = num/10**exp
+ return coeff, exp, prefix
+
+def sci_format(num):
+ """
+ Format a floating point number into scientific notation.
+ @param num the number to format
+ @return a label string
+ """
+ coeff, exp, prefix = get_si_components(num)
+ if -3 <= exp < 3: return '%g'%num
+ return '%.3ge%d'%(coeff, exp)
+
+def eng_format(num, units=''):
+ """
+ Format a floating point number into engineering notation.
+ @param num the number to format
+ @param units the units to append
+ @return a label string
+ """
+ coeff, exp, prefix = get_si_components(num)
+ if -3 <= exp < 3: return '%g'%num
+ return '%g%s%s%s'%(coeff, units and ' ' or '', prefix, units)
+
+##################################################
+# Interface with thread safe lock/unlock
+##################################################
+class mutex(object):
+ _lock = threading.Lock()
+ def lock(self): self._lock.acquire()
+ def unlock(self): self._lock.release()
+
+##################################################
+# Periodic update thread for point label
+##################################################
+class point_label_thread(threading.Thread, mutex):
+
+ def __init__(self, plotter):
+ self._plotter = plotter
+ self._coor_queue = list()
+ #bind plotter mouse events
+ self._plotter.Bind(wx.EVT_MOTION, lambda evt: self.enqueue(evt.GetPosition()))
+ self._plotter.Bind(wx.EVT_LEAVE_WINDOW, lambda evt: self.enqueue(None))
+ self._plotter.Bind(wx.EVT_RIGHT_DOWN, lambda evt: plotter.enable_point_label(not plotter.enable_point_label()))
+ self._plotter.Bind(wx.EVT_LEFT_DOWN, lambda evt: plotter.call_freq_callback(evt.GetPosition()))
+ #start the thread
+ threading.Thread.__init__(self)
+ self.start()
+
+ def enqueue(self, coor):
+ self.lock()
+ self._coor_queue.append(coor)
+ self.unlock()
+
+ def run(self):
+ last_ts = time.time()
+ last_coor = coor = None
+ try:
+ while True:
+ time.sleep(1.0/30.0)
+ self.lock()
+ #get most recent coor change
+ if self._coor_queue:
+ coor = self._coor_queue[-1]
+ self._coor_queue = list()
+ self.unlock()
+ #update if coor change, or enough time expired
+ if last_coor != coor or (time.time() - last_ts) > (1.0/2.0):
+ self._plotter.set_point_label_coordinate(coor)
+ last_coor = coor
+ last_ts = time.time()
+ except wx.PyDeadObjectError: pass
diff --git a/gr-wxgui/src/python/plotter/gltext.py b/gr-wxgui/src/python/plotter/gltext.py
new file mode 100644
index 000000000..0b6e3f55b
--- /dev/null
+++ b/gr-wxgui/src/python/plotter/gltext.py
@@ -0,0 +1,503 @@
+#!/usr/bin/env python
+# -*- coding: utf-8
+#
+# Provides some text display functions for wx + ogl
+# Copyright (C) 2007 Christian Brugger, Stefan Hacker
+#
+# This program 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 2 of the License, or
+# (at your option) any later version.
+#
+# This program 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 this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+import wx
+from OpenGL.GL import *
+
+"""
+Optimize with psyco if possible, this gains us about 50% speed when
+creating our textures in trade for about 4MBytes of additional memory usage for
+psyco. If you don't like loosing the memory you have to turn the lines following
+"enable psyco" into a comment while uncommenting the line after "Disable psyco".
+"""
+#Try to enable psyco
+try:
+ import psyco
+ psyco_optimized = False
+except ImportError:
+ psyco = None
+
+#Disable psyco
+#psyco = None
+
+class TextElement(object):
+ """
+ A simple class for using system Fonts to display
+ text in an OpenGL scene
+ """
+ def __init__(self,
+ text = '',
+ font = None,
+ foreground = wx.BLACK,
+ centered = False):
+ """
+ text (String) - Text
+ font (wx.Font) - Font to draw with (None = System default)
+ foreground (wx.Color) - Color of the text
+ or (wx.Bitmap)- Bitmap to overlay the text with
+ centered (bool) - Center the text
+
+ Initializes the TextElement
+ """
+ # save given variables
+ self._text = text
+ self._lines = text.split('\n')
+ self._font = font
+ self._foreground = foreground
+ self._centered = centered
+
+ # init own variables
+ self._owner_cnt = 0 #refcounter
+ self._texture = None #OpenGL texture ID
+ self._text_size = None #x/y size tuple of the text
+ self._texture_size= None #x/y Texture size tuple
+
+ # create Texture
+ self.createTexture()
+
+
+ #---Internal helpers
+
+ def _getUpper2Base(self, value):
+ """
+ Returns the lowest value with the power of
+ 2 greater than 'value' (2^n>value)
+ """
+ base2 = 1
+ while base2 < value:
+ base2 *= 2
+ return base2
+
+ #---Functions
+
+ def draw_text(self, position = wx.Point(0,0), scale = 1.0, rotation = 0):
+ """
+ position (wx.Point) - x/y Position to draw in scene
+ scale (float) - Scale
+ rotation (int) - Rotation in degree
+
+ Draws the text to the scene
+ """
+ #Enable necessary functions
+ glColor(1,1,1,1)
+ glEnable(GL_TEXTURE_2D)
+ glEnable(GL_ALPHA_TEST) #Enable alpha test
+ glAlphaFunc(GL_GREATER, 0)
+ glEnable(GL_BLEND) #Enable blending
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
+ #Bind texture
+ glBindTexture(GL_TEXTURE_2D, self._texture)
+
+ ow, oh = self._text_size
+ w , h = self._texture_size
+ #Perform transformations
+ glPushMatrix()
+ glTranslated(position.x, position.y, 0)
+ glRotate(-rotation, 0, 0, 1)
+ glScaled(scale, scale, scale)
+ if self._centered:
+ glTranslate(-w/2, -oh/2, 0)
+ #Draw vertices
+ glBegin(GL_QUADS)
+ glTexCoord2f(0,0); glVertex2f(0,0)
+ glTexCoord2f(0,1); glVertex2f(0,h)
+ glTexCoord2f(1,1); glVertex2f(w,h)
+ glTexCoord2f(1,0); glVertex2f(w,0)
+ glEnd()
+ glPopMatrix()
+
+ #Disable features
+ glDisable(GL_BLEND)
+ glDisable(GL_ALPHA_TEST)
+ glDisable(GL_TEXTURE_2D)
+
+ def createTexture(self):
+ """
+ Creates a texture from the settings saved in TextElement, to be able to use normal
+ system fonts conviently a wx.MemoryDC is used to draw on a wx.Bitmap. As wxwidgets
+ device contexts don't support alpha at all it is necessary to apply a little hack
+ to preserve antialiasing without sticking to a fixed background color:
+
+ We draw the bmp in b/w mode so we can use its data as a alpha channel for a solid
+ color bitmap which after GL_ALPHA_TEST and GL_BLEND will show a nicely antialiased
+ text on any surface.
+
+ To access the raw pixel data the bmp gets converted to a wx.Image. Now we just have
+ to merge our foreground color with the alpha data we just created and push it all
+ into a OpenGL texture and we are DONE *inhalesdelpy*
+
+ DRAWBACK of the whole conversion thing is a really long time for creating the
+ texture. If you see any optimizations that could save time PLEASE CREATE A PATCH!!!
+ """
+ # get a memory dc
+ dc = wx.MemoryDC()
+
+ # set our font
+ dc.SetFont(self._font)
+
+ # Approximate extend to next power of 2 and create our bitmap
+ # REMARK: You wouldn't believe how much fucking speed this little
+ # sucker gains compared to sizes not of the power of 2. It's like
+ # 500ms --> 0.5ms (on my ATI-GPU powered Notebook). On Sams nvidia
+ # machine there don't seem to occur any losses...bad drivers?
+ ow, oh = dc.GetMultiLineTextExtent(self._text)[:2]
+ w, h = self._getUpper2Base(ow), self._getUpper2Base(oh)
+
+ self._text_size = wx.Size(ow,oh)
+ self._texture_size = wx.Size(w,h)
+ bmp = wx.EmptyBitmap(w,h)
+
+
+ #Draw in b/w mode to bmp so we can use it as alpha channel
+ dc.SelectObject(bmp)
+ dc.SetBackground(wx.BLACK_BRUSH)
+ dc.Clear()
+ dc.SetTextForeground(wx.WHITE)
+ x,y = 0,0
+ centered = self.centered
+ for line in self._lines:
+ if not line: line = ' '
+ tw, th = dc.GetTextExtent(line)
+ if centered:
+ x = int(round((w-tw)/2))
+ dc.DrawText(line, x, y)
+ x = 0
+ y += th
+ #Release the dc
+ dc.SelectObject(wx.NullBitmap)
+ del dc
+
+ #Generate a correct RGBA data string from our bmp
+ """
+ NOTE: You could also use wx.AlphaPixelData to access the pixel data
+ in 'bmp' directly, but the iterator given by it is much slower than
+ first converting to an image and using wx.Image.GetData().
+ """
+ img = wx.ImageFromBitmap(bmp)
+ alpha = img.GetData()
+
+ if isinstance(self._foreground, wx.Colour):
+ """
+ If we have a static color...
+ """
+ r,g,b = self._foreground.Get()
+ color = "%c%c%c" % (chr(r), chr(g), chr(b))
+
+ data = ''
+ for i in xrange(0, len(alpha)-1, 3):
+ data += color + alpha[i]
+
+ elif isinstance(self._foreground, wx.Bitmap):
+ """
+ If we have a bitmap...
+ """
+ bg_img = wx.ImageFromBitmap(self._foreground)
+ bg = bg_img.GetData()
+ bg_width = self._foreground.GetWidth()
+ bg_height = self._foreground.GetHeight()
+
+ data = ''
+
+ for y in xrange(0, h):
+ for x in xrange(0, w):
+ if (y > (bg_height-1)) or (x > (bg_width-1)):
+ color = "%c%c%c" % (chr(0),chr(0),chr(0))
+ else:
+ pos = (x+y*bg_width) * 3
+ color = bg[pos:pos+3]
+ data += color + alpha[(x+y*w)*3]
+
+
+ # now convert it to ogl texture
+ self._texture = glGenTextures(1)
+ glBindTexture(GL_TEXTURE_2D, self._texture)
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR)
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR)
+
+ glPixelStorei(GL_UNPACK_ROW_LENGTH, 0)
+ glPixelStorei(GL_UNPACK_ALIGNMENT, 2)
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, data)
+
+ def deleteTexture(self):
+ """
+ Deletes the OpenGL texture object
+ """
+ if self._texture:
+ if glIsTexture(self._texture):
+ glDeleteTextures(self._texture)
+ else:
+ self._texture = None
+
+ def bind(self):
+ """
+ Increase refcount
+ """
+ self._owner_cnt += 1
+
+ def release(self):
+ """
+ Decrease refcount
+ """
+ self._owner_cnt -= 1
+
+ def isBound(self):
+ """
+ Return refcount
+ """
+ return self._owner_cnt
+
+ def __del__(self):
+ """
+ Destructor
+ """
+ self.deleteTexture()
+
+ #---Getters/Setters
+
+ def getText(self): return self._text
+ def getFont(self): return self._font
+ def getForeground(self): return self._foreground
+ def getCentered(self): return self._centered
+ def getTexture(self): return self._texture
+ def getTexture_size(self): return self._texture_size
+
+ def getOwner_cnt(self): return self._owner_cnt
+ def setOwner_cnt(self, value):
+ self._owner_cnt = value
+
+ #---Properties
+
+ text = property(getText, None, None, "Text of the object")
+ font = property(getFont, None, None, "Font of the object")
+ foreground = property(getForeground, None, None, "Color of the text")
+ centered = property(getCentered, None, None, "Is text centered")
+ owner_cnt = property(getOwner_cnt, setOwner_cnt, None, "Owner count")
+ texture = property(getTexture, None, None, "Used texture")
+ texture_size = property(getTexture_size, None, None, "Size of the used texture")
+
+
+class Text(object):
+ """
+ A simple class for using System Fonts to display text in
+ an OpenGL scene. The Text adds a global Cache of already
+ created text elements to TextElement's base functionality
+ so you can save some memory and increase speed
+ """
+ _texts = [] #Global cache for TextElements
+
+ def __init__(self,
+ text = 'Text',
+ font = None,
+ font_size = 8,
+ foreground = wx.BLACK,
+ centered = False,
+ bold = False):
+ """
+ text (string) - displayed text
+ font (wx.Font) - if None, system default font will be used with font_size
+ font_size (int) - font size in points
+ foreground (wx.Color) - Color of the text
+ or (wx.Bitmap) - Bitmap to overlay the text with
+ centered (bool) - should the text drawn centered towards position?
+
+ Initializes the text object
+ """
+ #Init/save variables
+ self._aloc_text = None
+ self._text = text
+ self._font_size = font_size
+ self._foreground= foreground
+ self._centered = centered
+
+ #Check if we are offered a font
+ if not font:
+ #if not use the system default
+ self._font = wx.SystemSettings.GetFont(wx.SYS_DEFAULT_GUI_FONT)
+ else:
+ #save it
+ self._font = font
+
+ if bold: self._font.SetWeight(wx.FONTWEIGHT_BOLD)
+
+ #Bind us to our texture
+ self._initText()
+
+ #---Internal helpers
+
+ def _initText(self):
+ """
+ Initializes/Reinitializes the Text object by binding it
+ to a TextElement suitable for its current settings
+ """
+ #Check if we already bound to a texture
+ if self._aloc_text:
+ #if so release it
+ self._aloc_text.release()
+ if not self._aloc_text.isBound():
+ self._texts.remove(self._aloc_text)
+ self._aloc_text = None
+
+ #Adjust our font
+ self._font.SetPointSize(self._font_size)
+
+ #Search for existing element in our global buffer
+ for element in self._texts:
+ if element.text == self._text and\
+ element.font == self._font and\
+ element.foreground == self._foreground and\
+ element.centered == self._centered:
+ # We already exist in global buffer ;-)
+ element.bind()
+ self._aloc_text = element
+ break
+
+ if not self._aloc_text:
+ # We are not in the global buffer, let's create ourselves
+ aloc_text = self._aloc_text = TextElement(self._text,
+ self._font,
+ self._foreground,
+ self._centered)
+ aloc_text.bind()
+ self._texts.append(aloc_text)
+
+ def __del__(self):
+ """
+ Destructor
+ """
+ aloc_text = self._aloc_text
+ aloc_text.release()
+ if not aloc_text.isBound():
+ self._texts.remove(aloc_text)
+
+ #---Functions
+
+ def draw_text(self, position = wx.Point(0,0), scale = 1.0, rotation = 0):
+ """
+ position (wx.Point) - x/y Position to draw in scene
+ scale (float) - Scale
+ rotation (int) - Rotation in degree
+
+ Draws the text to the scene
+ """
+
+ self._aloc_text.draw_text(position, scale, rotation)
+
+ #---Setter/Getter
+
+ def getText(self): return self._text
+ def setText(self, value, reinit = True):
+ """
+ value (bool) - New Text
+ reinit (bool) - Create a new texture
+
+ Sets a new text
+ """
+ self._text = value
+ if reinit:
+ self._initText()
+
+ def getFont(self): return self._font
+ def setFont(self, value, reinit = True):
+ """
+ value (bool) - New Font
+ reinit (bool) - Create a new texture
+
+ Sets a new font
+ """
+ self._font = value
+ if reinit:
+ self._initText()
+
+ def getFont_size(self): return self._font_size
+ def setFont_size(self, value, reinit = True):
+ """
+ value (bool) - New font size
+ reinit (bool) - Create a new texture
+
+ Sets a new font size
+ """
+ self._font_size = value
+ if reinit:
+ self._initText()
+
+ def getForeground(self): return self._foreground
+ def setForeground(self, value, reinit = True):
+ """
+ value (bool) - New centered value
+ reinit (bool) - Create a new texture
+
+ Sets a new value for 'centered'
+ """
+ self._foreground = value
+ if reinit:
+ self._initText()
+
+ def getCentered(self): return self._centered
+ def setCentered(self, value, reinit = True):
+ """
+ value (bool) - New centered value
+ reinit (bool) - Create a new texture
+
+ Sets a new value for 'centered'
+ """
+ self._centered = value
+ if reinit:
+ self._initText()
+
+ def get_size(self):
+ """
+ Returns a text size tuple
+ """
+ return self._aloc_text._text_size
+
+ def getTexture_size(self):
+ """
+ Returns a texture size tuple
+ """
+ return self._aloc_text.texture_size
+
+ def getTextElement(self):
+ """
+ Returns the text element bound to the Text class
+ """
+ return self._aloc_text
+
+ def getTexture(self):
+ """
+ Returns the texture of the bound TextElement
+ """
+ return self._aloc_text.texture
+
+
+ #---Properties
+
+ text = property(getText, setText, None, "Text of the object")
+ font = property(getFont, setFont, None, "Font of the object")
+ font_size = property(getFont_size, setFont_size, None, "Font size")
+ foreground = property(getForeground, setForeground, None, "Color/Overlay bitmap of the text")
+ centered = property(getCentered, setCentered, None, "Display the text centered")
+ texture_size = property(getTexture_size, None, None, "Size of the used texture")
+ texture = property(getTexture, None, None, "Texture of bound TextElement")
+ text_element = property(getTextElement,None , None, "TextElement bound to this class")
+
+#Optimize critical functions
+if psyco and not psyco_optimized:
+ psyco.bind(TextElement.createTexture)
+ psyco_optimized = True
diff --git a/gr-wxgui/src/python/plotter/grid_plotter_base.py b/gr-wxgui/src/python/plotter/grid_plotter_base.py
new file mode 100644
index 000000000..f1bc8f546
--- /dev/null
+++ b/gr-wxgui/src/python/plotter/grid_plotter_base.py
@@ -0,0 +1,419 @@
+#
+# 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.
+#
+
+import wx
+import wx.glcanvas
+from OpenGL import GL
+import common
+from plotter_base import plotter_base
+import gltext
+import math
+
+GRID_LINE_COLOR_SPEC = (.7, .7, .7) #gray
+GRID_BORDER_COLOR_SPEC = (0, 0, 0) #black
+TICK_TEXT_FONT_SIZE = 9
+TITLE_TEXT_FONT_SIZE = 13
+UNITS_TEXT_FONT_SIZE = 9
+AXIS_LABEL_PADDING = 5
+TICK_LABEL_PADDING = 5
+TITLE_LABEL_PADDING = 7
+POINT_LABEL_FONT_SIZE = 8
+POINT_LABEL_COLOR_SPEC = (1, 1, 0.5, 0.75)
+POINT_LABEL_PADDING = 3
+POINT_LABEL_OFFSET = 10
+GRID_LINE_DASH_LEN = 4
+
+##################################################
+# Grid Plotter Base Class
+##################################################
+class grid_plotter_base(plotter_base):
+
+ def __init__(self, parent, min_padding=(0, 0, 0, 0)):
+ plotter_base.__init__(self, parent)
+ #setup grid cache
+ self._grid_cache = self.new_gl_cache(self._draw_grid, 25)
+ self.enable_grid_lines(True)
+ #setup padding
+ self.padding_top_min, self.padding_right_min, self.padding_bottom_min, self.padding_left_min = min_padding
+ #store title and unit strings
+ self.set_title('Title')
+ self.set_x_label('X Label')
+ self.set_y_label('Y Label')
+ #init the grid to some value
+ self.set_x_grid(-1, 1, 1)
+ self.set_y_grid(-1, 1, 1)
+ #setup point label cache
+ self._point_label_cache = self.new_gl_cache(self._draw_point_label, 75)
+ self.enable_point_label(False)
+ self.enable_grid_aspect_ratio(False)
+ self.set_point_label_coordinate(None)
+ common.point_label_thread(self)
+ #init grid plotter
+ self.register_init(self._init_grid_plotter)
+
+ def _init_grid_plotter(self):
+ """
+ Run gl initialization tasks.
+ """
+ GL.glEnableClientState(GL.GL_VERTEX_ARRAY)
+
+ def set_point_label_coordinate(self, coor):
+ """
+ Set the point label coordinate.
+ @param coor the coordinate x, y tuple or None
+ """
+ self.lock()
+ self._point_label_coordinate = coor
+ self._point_label_cache.changed(True)
+ self.update()
+ self.unlock()
+
+ def call_freq_callback(self, coor):
+ x, y = self._point_label_coordinate
+ if x < self.padding_left or x > self.width-self.padding_right: return
+ if y < self.padding_top or y > self.height-self.padding_bottom: return
+ #scale to window bounds
+ x_win_scalar = float(x - self.padding_left)/(self.width-self.padding_left-self.padding_right)
+ y_win_scalar = float((self.height - y) - self.padding_bottom)/(self.height-self.padding_top-self.padding_bottom)
+ #scale to grid bounds
+ x_val = x_win_scalar*(self.x_max-self.x_min) + self.x_min
+ y_val = y_win_scalar*(self.y_max-self.y_min) + self.y_min
+ self._call_callback(x_val, y_val)
+
+ def enable_grid_aspect_ratio(self, enable=None):
+ """
+ Enable/disable the grid aspect ratio.
+ If enabled, enforce the aspect ratio on the padding:
+ horizontal_padding:vertical_padding == width:height
+ @param enable true to enable
+ @return the enable state when None
+ """
+ if enable is None: return self._enable_grid_aspect_ratio
+ self.lock()
+ self._enable_grid_aspect_ratio = enable
+ for cache in self._gl_caches: cache.changed(True)
+ self.unlock()
+
+ def enable_point_label(self, enable=None):
+ """
+ Enable/disable the point label.
+ @param enable true to enable
+ @return the enable state when None
+ """
+ if enable is None: return self._enable_point_label
+ self.lock()
+ self._enable_point_label = enable
+ self._point_label_cache.changed(True)
+ self.unlock()
+
+ def set_title(self, title):
+ """
+ Set the title.
+ @param title the title string
+ """
+ self.lock()
+ self.title = title
+ self._grid_cache.changed(True)
+ self.unlock()
+
+ def set_x_label(self, x_label, x_units=''):
+ """
+ Set the x label and units.
+ @param x_label the x label string
+ @param x_units the x units string
+ """
+ self.lock()
+ self.x_label = x_label
+ self.x_units = x_units
+ self._grid_cache.changed(True)
+ self.unlock()
+
+ def set_y_label(self, y_label, y_units=''):
+ """
+ Set the y label and units.
+ @param y_label the y label string
+ @param y_units the y units string
+ """
+ self.lock()
+ self.y_label = y_label
+ self.y_units = y_units
+ self._grid_cache.changed(True)
+ self.unlock()
+
+ def set_x_grid(self, minimum, maximum, step, scale=False):
+ """
+ Set the x grid parameters.
+ @param minimum the left-most value
+ @param maximum the right-most value
+ @param step the grid spacing
+ @param scale true to scale the x grid
+ """
+ self.lock()
+ self.x_min = float(minimum)
+ self.x_max = float(maximum)
+ self.x_step = float(step)
+ if scale:
+ coeff, exp, prefix = common.get_si_components(max(abs(self.x_min), abs(self.x_max)))
+ self.x_scalar = 10**(-exp)
+ self.x_prefix = prefix
+ else:
+ self.x_scalar = 1.0
+ self.x_prefix = ''
+ for cache in self._gl_caches: cache.changed(True)
+ self.unlock()
+
+ def set_y_grid(self, minimum, maximum, step, scale=False):
+ """
+ Set the y grid parameters.
+ @param minimum the bottom-most value
+ @param maximum the top-most value
+ @param step the grid spacing
+ @param scale true to scale the y grid
+ """
+ self.lock()
+ self.y_min = float(minimum)
+ self.y_max = float(maximum)
+ self.y_step = float(step)
+ if scale:
+ coeff, exp, prefix = common.get_si_components(max(abs(self.y_min), abs(self.y_max)))
+ self.y_scalar = 10**(-exp)
+ self.y_prefix = prefix
+ else:
+ self.y_scalar = 1.0
+ self.y_prefix = ''
+ for cache in self._gl_caches: cache.changed(True)
+ self.unlock()
+
+ def _draw_grid(self):
+ """
+ Create the x, y, tick, and title labels.
+ Resize the padding for the labels.
+ Draw the border, grid, title, and labels.
+ """
+ ##################################################
+ # Create GL text labels
+ ##################################################
+ #create x tick labels
+ x_tick_labels = [(tick, self._get_tick_label(tick, self.x_units))
+ for tick in self._get_ticks(self.x_min, self.x_max, self.x_step, self.x_scalar)]
+ #create x tick labels
+ y_tick_labels = [(tick, self._get_tick_label(tick, self.y_units))
+ for tick in self._get_ticks(self.y_min, self.y_max, self.y_step, self.y_scalar)]
+ #create x label
+ x_label_str = self.x_units and "%s (%s%s)"%(self.x_label, self.x_prefix, self.x_units) or self.x_label
+ x_label = gltext.Text(x_label_str, bold=True, font_size=UNITS_TEXT_FONT_SIZE, centered=True)
+ #create y label
+ y_label_str = self.y_units and "%s (%s%s)"%(self.y_label, self.y_prefix, self.y_units) or self.y_label
+ y_label = gltext.Text(y_label_str, bold=True, font_size=UNITS_TEXT_FONT_SIZE, centered=True)
+ #create title
+ title_label = gltext.Text(self.title, bold=True, font_size=TITLE_TEXT_FONT_SIZE, centered=True)
+ ##################################################
+ # Resize the padding
+ ##################################################
+ self.padding_top = max(2*TITLE_LABEL_PADDING + title_label.get_size()[1], self.padding_top_min)
+ self.padding_right = max(2*TICK_LABEL_PADDING, self.padding_right_min)
+ self.padding_bottom = max(2*AXIS_LABEL_PADDING + TICK_LABEL_PADDING + x_label.get_size()[1] + max([label.get_size()[1] for tick, label in x_tick_labels]), self.padding_bottom_min)
+ self.padding_left = max(2*AXIS_LABEL_PADDING + TICK_LABEL_PADDING + y_label.get_size()[1] + max([label.get_size()[0] for tick, label in y_tick_labels]), self.padding_left_min)
+ #enforce padding aspect ratio if enabled
+ if self.enable_grid_aspect_ratio():
+ w_over_h_ratio = float(self.width)/float(self.height)
+ horizontal_padding = float(self.padding_right + self.padding_left)
+ veritical_padding = float(self.padding_top + self.padding_bottom)
+ if w_over_h_ratio > horizontal_padding/veritical_padding:
+ #increase the horizontal padding
+ new_padding = veritical_padding*w_over_h_ratio - horizontal_padding
+ #distribute the padding to left and right
+ self.padding_left += int(round(new_padding/2))
+ self.padding_right += int(round(new_padding/2))
+ else:
+ #increase the vertical padding
+ new_padding = horizontal_padding/w_over_h_ratio - veritical_padding
+ #distribute the padding to top and bottom
+ self.padding_top += int(round(new_padding/2))
+ self.padding_bottom += int(round(new_padding/2))
+ ##################################################
+ # Draw Grid X
+ ##################################################
+ for tick, label in x_tick_labels:
+ scaled_tick = (self.width-self.padding_left-self.padding_right)*\
+ (tick/self.x_scalar-self.x_min)/(self.x_max-self.x_min) + self.padding_left
+ self._draw_grid_line(
+ (scaled_tick, self.padding_top),
+ (scaled_tick, self.height-self.padding_bottom),
+ )
+ w, h = label.get_size()
+ label.draw_text(wx.Point(scaled_tick-w/2, self.height-self.padding_bottom+TICK_LABEL_PADDING))
+ ##################################################
+ # Draw Grid Y
+ ##################################################
+ for tick, label in y_tick_labels:
+ scaled_tick = (self.height-self.padding_top-self.padding_bottom)*\
+ (1 - (tick/self.y_scalar-self.y_min)/(self.y_max-self.y_min)) + self.padding_top
+ self._draw_grid_line(
+ (self.padding_left, scaled_tick),
+ (self.width-self.padding_right, scaled_tick),
+ )
+ w, h = label.get_size()
+ label.draw_text(wx.Point(self.padding_left-w-TICK_LABEL_PADDING, scaled_tick-h/2))
+ ##################################################
+ # Draw Border
+ ##################################################
+ GL.glColor3f(*GRID_BORDER_COLOR_SPEC)
+ self._draw_rect(
+ self.padding_left,
+ self.padding_top,
+ self.width - self.padding_right - self.padding_left,
+ self.height - self.padding_top - self.padding_bottom,
+ fill=False,
+ )
+ ##################################################
+ # Draw Labels
+ ##################################################
+ #draw title label
+ title_label.draw_text(wx.Point(self.width/2.0, TITLE_LABEL_PADDING + title_label.get_size()[1]/2))
+ #draw x labels
+ x_label.draw_text(wx.Point(
+ (self.width-self.padding_left-self.padding_right)/2.0 + self.padding_left,
+ self.height-(AXIS_LABEL_PADDING + x_label.get_size()[1]/2),
+ )
+ )
+ #draw y labels
+ y_label.draw_text(wx.Point(
+ AXIS_LABEL_PADDING + y_label.get_size()[1]/2,
+ (self.height-self.padding_top-self.padding_bottom)/2.0 + self.padding_top,
+ ), rotation=90,
+ )
+
+ def _get_tick_label(self, tick, unit):
+ """
+ Format the tick value and create a gl text.
+ @param tick the floating point tick value
+ @param unit the axis unit
+ @return the tick label text
+ """
+ if unit: tick_str = common.sci_format(tick)
+ else: tick_str = common.eng_format(tick)
+ return gltext.Text(tick_str, font_size=TICK_TEXT_FONT_SIZE)
+
+ def _get_ticks(self, min, max, step, scalar):
+ """
+ Determine the positions for the ticks.
+ @param min the lower bound
+ @param max the upper bound
+ @param step the grid spacing
+ @param scalar the grid scaling
+ @return a list of tick positions between min and max
+ """
+ #cast to float
+ min = float(min)
+ max = float(max)
+ step = float(step)
+ #check for valid numbers
+ try:
+ assert step > 0
+ assert max > min
+ assert max - min > step
+ except AssertionError: return [-1, 1]
+ #determine the start and stop value
+ start = int(math.ceil(min/step))
+ stop = int(math.floor(max/step))
+ return [i*step*scalar for i in range(start, stop+1)]
+
+ def enable_grid_lines(self, enable=None):
+ """
+ Enable/disable the grid lines.
+ @param enable true to enable
+ @return the enable state when None
+ """
+ if enable is None: return self._enable_grid_lines
+ self.lock()
+ self._enable_grid_lines = enable
+ self._grid_cache.changed(True)
+ self.unlock()
+
+ def _draw_grid_line(self, coor1, coor2):
+ """
+ Draw a dashed line from coor1 to coor2.
+ @param corr1 a tuple of x, y
+ @param corr2 a tuple of x, y
+ """
+ if not self.enable_grid_lines(): return
+ length = math.sqrt((coor1[0] - coor2[0])**2 + (coor1[1] - coor2[1])**2)
+ num_points = int(length/GRID_LINE_DASH_LEN)
+ #calculate points array
+ points = [(
+ coor1[0] + i*(coor2[0]-coor1[0])/(num_points - 1),
+ coor1[1] + i*(coor2[1]-coor1[1])/(num_points - 1)
+ ) for i in range(num_points)]
+ #set color and draw
+ GL.glColor3f(*GRID_LINE_COLOR_SPEC)
+ GL.glVertexPointerf(points)
+ GL.glDrawArrays(GL.GL_LINES, 0, len(points))
+
+ def _draw_rect(self, x, y, width, height, fill=True):
+ """
+ Draw a rectangle on the x, y plane.
+ X and Y are the top-left corner.
+ @param x the left position of the rectangle
+ @param y the top position of the rectangle
+ @param width the width of the rectangle
+ @param height the height of the rectangle
+ @param fill true to color inside of rectangle
+ """
+ GL.glBegin(fill and GL.GL_QUADS or GL.GL_LINE_LOOP)
+ GL.glVertex2f(x, y)
+ GL.glVertex2f(x+width, y)
+ GL.glVertex2f(x+width, y+height)
+ GL.glVertex2f(x, y+height)
+ GL.glEnd()
+
+ def _draw_point_label(self):
+ """
+ Draw the point label for the last mouse motion coordinate.
+ The mouse coordinate must be an X, Y tuple.
+ The label will be drawn at the X, Y coordinate.
+ The values of the X, Y coordinate will be scaled to the current X, Y bounds.
+ """
+ if not self.enable_point_label(): return
+ if not self._point_label_coordinate: return
+ x, y = self._point_label_coordinate
+ if x < self.padding_left or x > self.width-self.padding_right: return
+ if y < self.padding_top or y > self.height-self.padding_bottom: return
+ #scale to window bounds
+ x_win_scalar = float(x - self.padding_left)/(self.width-self.padding_left-self.padding_right)
+ y_win_scalar = float((self.height - y) - self.padding_bottom)/(self.height-self.padding_top-self.padding_bottom)
+ #scale to grid bounds
+ x_val = x_win_scalar*(self.x_max-self.x_min) + self.x_min
+ y_val = y_win_scalar*(self.y_max-self.y_min) + self.y_min
+ #create text
+ label_str = self._populate_point_label(x_val, y_val)
+ if not label_str: return
+ txt = gltext.Text(label_str, font_size=POINT_LABEL_FONT_SIZE)
+ w, h = txt.get_size()
+ #enable transparency
+ GL.glEnable(GL.GL_BLEND)
+ GL.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA)
+ #draw rect + text
+ GL.glColor4f(*POINT_LABEL_COLOR_SPEC)
+ if x > self.width/2: x -= w+2*POINT_LABEL_PADDING + POINT_LABEL_OFFSET
+ else: x += POINT_LABEL_OFFSET
+ self._draw_rect(x, y-h-2*POINT_LABEL_PADDING, w+2*POINT_LABEL_PADDING, h+2*POINT_LABEL_PADDING)
+ txt.draw_text(wx.Point(x+POINT_LABEL_PADDING, y-h-POINT_LABEL_PADDING))
diff --git a/gr-wxgui/src/python/plotter/plotter_base.py b/gr-wxgui/src/python/plotter/plotter_base.py
new file mode 100644
index 000000000..6d9463458
--- /dev/null
+++ b/gr-wxgui/src/python/plotter/plotter_base.py
@@ -0,0 +1,214 @@
+#
+# Copyright 2008, 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.
+#
+
+import wx
+import wx.glcanvas
+from OpenGL import GL
+import common
+
+BACKGROUND_COLOR_SPEC = (1, 0.976, 1, 1) #creamy white
+
+##################################################
+# GL caching interface
+##################################################
+class gl_cache(object):
+ """
+ Cache a set of gl drawing routines in a compiled list.
+ """
+
+ def __init__(self, draw):
+ """
+ Create a new cache.
+ @param draw a function to draw gl stuff
+ """
+ self.changed(True)
+ self._draw = draw
+
+ def init(self):
+ """
+ To be called when gl initializes.
+ Create a new compiled list.
+ """
+ self._grid_compiled_list_id = GL.glGenLists(1)
+
+ def draw(self):
+ """
+ Draw the gl stuff using a compiled list.
+ If changed, reload the compiled list.
+ """
+ if self.changed():
+ GL.glNewList(self._grid_compiled_list_id, GL.GL_COMPILE)
+ self._draw()
+ GL.glEndList()
+ self.changed(False)
+ #draw the grid
+ GL.glCallList(self._grid_compiled_list_id)
+
+ def changed(self, state=None):
+ """
+ Set the changed flag if state is not None.
+ Otherwise return the changed flag.
+ """
+ if state is None: return self._changed
+ self._changed = state
+
+##################################################
+# OpenGL WX Plotter Canvas
+##################################################
+class plotter_base(wx.glcanvas.GLCanvas, common.mutex):
+ """
+ Plotter base class for all plot types.
+ """
+
+ def __init__(self, parent):
+ """
+ Create a new plotter base.
+ Initialize the GLCanvas with double buffering.
+ Initialize various plotter flags.
+ Bind the paint and size events.
+ @param parent the parent widgit
+ """
+ attribList = (wx.glcanvas.WX_GL_DOUBLEBUFFER, wx.glcanvas.WX_GL_RGBA)
+ wx.glcanvas.GLCanvas.__init__(self, parent, wx.ID_ANY, attribList); # Specifically use the CTOR which does NOT create an implicit GL context
+ self._gl_ctx = wx.glcanvas.GLContext(self) # Create the explicit GL context
+ self.use_persistence=False
+ self.persist_alpha=2.0/15
+ self.clear_accum=True
+ self._gl_init_flag = False
+ self._resized_flag = True
+ self._init_fcns = list()
+ self._draw_fcns = list()
+ self._gl_caches = list()
+ self.Bind(wx.EVT_PAINT, self._on_paint)
+ self.Bind(wx.EVT_SIZE, self._on_size)
+ self.Bind(wx.EVT_ERASE_BACKGROUND, lambda e: None)
+
+ def set_use_persistence(self,enable):
+ self.use_persistence=enable
+ self.clear_accum=True
+
+ def set_persist_alpha(self,analog_alpha):
+ self.persist_alpha=analog_alpha
+
+ def new_gl_cache(self, draw_fcn, draw_pri=50):
+ """
+ Create a new gl cache.
+ Register its draw and init function.
+ @return the new cache object
+ """
+ cache = gl_cache(draw_fcn)
+ self.register_init(cache.init)
+ self.register_draw(cache.draw, draw_pri)
+ self._gl_caches.append(cache)
+ return cache
+
+ def register_init(self, init_fcn):
+ self._init_fcns.append(init_fcn)
+
+ def register_draw(self, draw_fcn, draw_pri=50):
+ """
+ Register a draw function with a layer priority.
+ Large pri values are drawn last.
+ Small pri values are drawn first.
+ """
+ for i in range(len(self._draw_fcns)):
+ if draw_pri < self._draw_fcns[i][0]:
+ self._draw_fcns.insert(i, (draw_pri, draw_fcn))
+ return
+ self._draw_fcns.append((draw_pri, draw_fcn))
+
+ def _on_size(self, event):
+ """
+ Flag the resize event.
+ The paint event will handle the actual resizing.
+ """
+ self.lock()
+ self._resized_flag = True
+ self.clear_accum=True
+ self.unlock()
+
+ def _on_paint(self, event):
+ """
+ Respond to paint events.
+ Initialize GL if this is the first paint event.
+ Resize the view port if the width or height changed.
+ Redraw the screen, calling the draw functions.
+ """
+ if not self.IsShownOnScreen(): # Cannot realise a GL context on OS X if window is not yet shown
+ return
+ # create device context (needed on Windows, noop on X)
+ dc = None
+ if event.GetEventObject(): # Only create DC if paint triggered by WM message (for OS X)
+ dc = wx.PaintDC(self)
+ self.lock()
+ self.SetCurrent(self._gl_ctx) # Real the explicit GL context
+
+ # check if gl was initialized
+ if not self._gl_init_flag:
+ GL.glClearColor(*BACKGROUND_COLOR_SPEC)
+ for fcn in self._init_fcns: fcn()
+ self._gl_init_flag = True
+
+ # check for a change in window size
+ if self._resized_flag:
+ self.width, self.height = self.GetSize()
+ GL.glMatrixMode(GL.GL_PROJECTION)
+ GL.glLoadIdentity()
+ GL.glOrtho(0, self.width, self.height, 0, 1, 0)
+ GL.glMatrixMode(GL.GL_MODELVIEW)
+ GL.glLoadIdentity()
+ GL.glViewport(0, 0, self.width, self.height)
+ for cache in self._gl_caches: cache.changed(True)
+ self._resized_flag = False
+
+ # clear buffer if needed
+ if self.clear_accum or not self.use_persistence:
+ GL.glClear(GL.GL_COLOR_BUFFER_BIT)
+ self.clear_accum=False
+
+ # apply fading
+ if self.use_persistence:
+ GL.glEnable(GL.GL_BLEND)
+ GL.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA)
+
+ GL.glBegin(GL.GL_QUADS)
+ GL.glColor4f(1,1,1,self.persist_alpha)
+ GL.glVertex2f(0, self.height)
+ GL.glVertex2f(self.width, self.height)
+ GL.glVertex2f(self.width, 0)
+ GL.glVertex2f(0, 0)
+ GL.glEnd()
+
+ GL.glDisable(GL.GL_BLEND)
+
+ # draw functions
+ for fcn in self._draw_fcns: fcn[1]()
+
+ # show result
+ self.SwapBuffers()
+ self.unlock()
+
+ def update(self):
+ """
+ Force a paint event.
+ """
+ if not self._gl_init_flag: return
+ wx.PostEvent(self, wx.PaintEvent())
diff --git a/gr-wxgui/src/python/plotter/waterfall_plotter.py b/gr-wxgui/src/python/plotter/waterfall_plotter.py
new file mode 100644
index 000000000..6a6bf6330
--- /dev/null
+++ b/gr-wxgui/src/python/plotter/waterfall_plotter.py
@@ -0,0 +1,278 @@
+#
+# Copyright 2008, 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.
+#
+
+import wx
+from grid_plotter_base import grid_plotter_base
+from OpenGL import GL
+import common
+import numpy
+import gltext
+import math
+import struct
+
+LEGEND_LEFT_PAD = 7
+LEGEND_NUM_BLOCKS = 256
+LEGEND_NUM_LABELS = 9
+LEGEND_WIDTH = 8
+LEGEND_FONT_SIZE = 8
+LEGEND_BORDER_COLOR_SPEC = (0, 0, 0) #black
+MIN_PADDING = 0, 60, 0, 0 #top, right, bottom, left
+
+ceil_log2 = lambda x: 2**int(math.ceil(math.log(x)/math.log(2)))
+
+pack_color = lambda x: struct.unpack('I', struct.pack('BBBB', *x))[0]
+unpack_color = lambda x: struct.unpack('BBBB', struct.pack('I', int(x)))
+
+def _get_rbga(red_pts, green_pts, blue_pts, alpha_pts=[(0, 0), (1, 0)]):
+ """
+ Get an array of 256 rgba values where each index maps to a color.
+ The scaling for red, green, blue, alpha are specified in piece-wise functions.
+ The piece-wise functions consist of a set of x, y coordinates.
+ The x and y values of the coordinates range from 0 to 1.
+ The coordinates must be specified so that x increases with the index value.
+ Resulting values are calculated along the line formed between 2 coordinates.
+ @param *_pts an array of x,y coordinates for each color element
+ @return array of rbga values (4 bytes) each
+ """
+ def _fcn(x, pw):
+ for (x1, y1), (x2, y2) in zip(pw, pw[1:]):
+ #linear interpolation
+ if x <= x2: return float(y1 - y2)/(x1 - x2)*(x - x1) + y1
+ raise Exception
+ return numpy.array([pack_color(map(
+ lambda pw: int(255*_fcn(i/255.0, pw)),
+ (red_pts, green_pts, blue_pts, alpha_pts),
+ )) for i in range(0, 256)], numpy.uint32)
+
+COLORS = {
+ 'rgb1': _get_rbga( #http://www.ks.uiuc.edu/Research/vmd/vmd-1.7.1/ug/img47.gif
+ red_pts = [(0, 0), (.5, 0), (1, 1)],
+ green_pts = [(0, 0), (.5, 1), (1, 0)],
+ blue_pts = [(0, 1), (.5, 0), (1, 0)],
+ ),
+ 'rgb2': _get_rbga( #http://xtide.ldeo.columbia.edu/~krahmann/coledit/screen.jpg
+ red_pts = [(0, 0), (3.0/8, 0), (5.0/8, 1), (7.0/8, 1), (1, .5)],
+ green_pts = [(0, 0), (1.0/8, 0), (3.0/8, 1), (5.0/8, 1), (7.0/8, 0), (1, 0)],
+ blue_pts = [(0, .5), (1.0/8, 1), (3.0/8, 1), (5.0/8, 0), (1, 0)],
+ ),
+ 'rgb3': _get_rbga(
+ red_pts = [(0, 0), (1.0/3.0, 0), (2.0/3.0, 0), (1, 1)],
+ green_pts = [(0, 0), (1.0/3.0, 0), (2.0/3.0, 1), (1, 0)],
+ blue_pts = [(0, 0), (1.0/3.0, 1), (2.0/3.0, 0), (1, 0)],
+ ),
+ 'gray': _get_rbga(
+ red_pts = [(0, 0), (1, 1)],
+ green_pts = [(0, 0), (1, 1)],
+ blue_pts = [(0, 0), (1, 1)],
+ ),
+}
+
+##################################################
+# Waterfall Plotter
+##################################################
+class waterfall_plotter(grid_plotter_base):
+ def __init__(self, parent):
+ """
+ Create a new channel plotter.
+ """
+ #init
+ grid_plotter_base.__init__(self, parent, MIN_PADDING)
+ #setup legend cache
+ self._legend_cache = self.new_gl_cache(self._draw_legend)
+ #setup waterfall cache
+ self._waterfall_cache = self.new_gl_cache(self._draw_waterfall, 50)
+ #setup waterfall plotter
+ self.register_init(self._init_waterfall)
+ self._resize_texture(False)
+ self._minimum = 0
+ self._maximum = 0
+ self._fft_size = 1
+ self._buffer = list()
+ self._pointer = 0
+ self._counter = 0
+ self.set_num_lines(0)
+ self.set_color_mode(COLORS.keys()[0])
+ self.callback = None
+
+ def _init_waterfall(self):
+ """
+ Run gl initialization tasks.
+ """
+ self._waterfall_texture = GL.glGenTextures(1)
+
+ def _draw_waterfall(self):
+ """
+ Draw the waterfall from the texture.
+ The texture is circularly filled and will wrap around.
+ Use matrix modeling to shift and scale the texture onto the coordinate plane.
+ """
+ #resize texture
+ self._resize_texture()
+ #setup texture
+ GL.glBindTexture(GL.GL_TEXTURE_2D, self._waterfall_texture)
+ GL.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_LINEAR)
+ GL.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MIN_FILTER, GL.GL_LINEAR)
+ GL.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_T, GL.GL_REPEAT)
+ GL.glTexEnvi(GL.GL_TEXTURE_ENV, GL.GL_TEXTURE_ENV_MODE, GL.GL_REPLACE)
+ #write the buffer to the texture
+ while self._buffer:
+ GL.glTexSubImage2D(GL.GL_TEXTURE_2D, 0, 0, self._pointer, self._fft_size, 1, GL.GL_RGBA, GL.GL_UNSIGNED_BYTE, self._buffer.pop(0))
+ self._pointer = (self._pointer + 1)%self._num_lines
+ #begin drawing
+ GL.glEnable(GL.GL_TEXTURE_2D)
+ GL.glPushMatrix()
+ #matrix scaling
+ GL.glTranslatef(self.padding_left, self.padding_top, 0)
+ GL.glScalef(
+ float(self.width-self.padding_left-self.padding_right),
+ float(self.height-self.padding_top-self.padding_bottom),
+ 1.0,
+ )
+ #draw texture with wrapping
+ GL.glBegin(GL.GL_QUADS)
+ prop_y = float(self._pointer)/(self._num_lines-1)
+ prop_x = float(self._fft_size)/ceil_log2(self._fft_size)
+ off = 1.0/(self._num_lines-1)
+ GL.glTexCoord2f(0, prop_y+1-off)
+ GL.glVertex2f(0, 1)
+ GL.glTexCoord2f(prop_x, prop_y+1-off)
+ GL.glVertex2f(1, 1)
+ GL.glTexCoord2f(prop_x, prop_y)
+ GL.glVertex2f(1, 0)
+ GL.glTexCoord2f(0, prop_y)
+ GL.glVertex2f(0, 0)
+ GL.glEnd()
+ GL.glPopMatrix()
+ GL.glDisable(GL.GL_TEXTURE_2D)
+
+ def _populate_point_label(self, x_val, y_val):
+ """
+ Get the text the will populate the point label.
+ Give the X value for the current point.
+ @param x_val the current x value
+ @param y_val the current y value
+ @return a value string with units
+ """
+ return '%s: %s'%(self.x_label, common.eng_format(x_val, self.x_units))
+
+ def _call_callback(self, x_val, y_val):
+ if self.callback != None:
+ self.callback(x_val,y_val)
+
+ def set_callback(self,callback):
+ self.callback = callback
+
+ def _draw_legend(self):
+ """
+ Draw the color scale legend.
+ """
+ if not self._color_mode: return
+ legend_height = self.height-self.padding_top-self.padding_bottom
+ #draw each legend block
+ block_height = float(legend_height)/LEGEND_NUM_BLOCKS
+ x = self.width - self.padding_right + LEGEND_LEFT_PAD
+ for i in range(LEGEND_NUM_BLOCKS):
+ color = unpack_color(COLORS[self._color_mode][int(255*i/float(LEGEND_NUM_BLOCKS-1))])
+ GL.glColor4f(*numpy.array(color)/255.0)
+ y = self.height - (i+1)*block_height - self.padding_bottom
+ self._draw_rect(x, y, LEGEND_WIDTH, block_height)
+ #draw rectangle around color scale border
+ GL.glColor3f(*LEGEND_BORDER_COLOR_SPEC)
+ self._draw_rect(x, self.padding_top, LEGEND_WIDTH, legend_height, fill=False)
+ #draw each legend label
+ label_spacing = float(legend_height)/(LEGEND_NUM_LABELS-1)
+ x = self.width - (self.padding_right - LEGEND_LEFT_PAD - LEGEND_WIDTH)/2
+ for i in range(LEGEND_NUM_LABELS):
+ proportion = i/float(LEGEND_NUM_LABELS-1)
+ dB = proportion*(self._maximum - self._minimum) + self._minimum
+ y = self.height - i*label_spacing - self.padding_bottom
+ txt = gltext.Text('%ddB'%int(dB), font_size=LEGEND_FONT_SIZE, centered=True)
+ txt.draw_text(wx.Point(x, y))
+
+ def _resize_texture(self, flag=None):
+ """
+ Create the texture to fit the fft_size X num_lines.
+ @param flag the set/unset or update flag
+ """
+ if flag is not None:
+ self._resize_texture_flag = flag
+ return
+ if not self._resize_texture_flag: return
+ self._buffer = list()
+ self._pointer = 0
+ if self._num_lines and self._fft_size:
+ GL.glBindTexture(GL.GL_TEXTURE_2D, self._waterfall_texture)
+ data = numpy.zeros(self._num_lines*ceil_log2(self._fft_size)*4, numpy.uint8).tostring()
+ GL.glTexImage2D(GL.GL_TEXTURE_2D, 0, GL.GL_RGBA, ceil_log2(self._fft_size), self._num_lines, 0, GL.GL_RGBA, GL.GL_UNSIGNED_BYTE, data)
+ self._resize_texture_flag = False
+
+ def set_color_mode(self, color_mode):
+ """
+ Set the color mode.
+ New samples will be converted to the new color mode.
+ Old samples will not be recolorized.
+ @param color_mode the new color mode string
+ """
+ self.lock()
+ if color_mode in COLORS.keys():
+ self._color_mode = color_mode
+ self._legend_cache.changed(True)
+ self.update()
+ self.unlock()
+
+ def set_num_lines(self, num_lines):
+ """
+ Set number of lines.
+ Powers of two only.
+ @param num_lines the new number of lines
+ """
+ self.lock()
+ self._num_lines = num_lines
+ self._resize_texture(True)
+ self.update()
+ self.unlock()
+
+ def set_samples(self, samples, minimum, maximum):
+ """
+ Set the samples to the waterfall.
+ Convert the samples to color data.
+ @param samples the array of floats
+ @param minimum the minimum value to scale
+ @param maximum the maximum value to scale
+ """
+ self.lock()
+ #set the min, max values
+ if self._minimum != minimum or self._maximum != maximum:
+ self._minimum = minimum
+ self._maximum = maximum
+ self._legend_cache.changed(True)
+ if self._fft_size != len(samples):
+ self._fft_size = len(samples)
+ self._resize_texture(True)
+ #normalize the samples to min/max
+ samples = (samples - minimum)*float(255/(maximum-minimum))
+ samples = numpy.clip(samples, 0, 255) #clip
+ samples = numpy.array(samples, numpy.uint8)
+ #convert the samples to RGBA data
+ data = COLORS[self._color_mode][samples].tostring()
+ self._buffer.append(data)
+ self._waterfall_cache.changed(True)
+ self.unlock()
diff --git a/gr-wxgui/src/python/powermate.py b/gr-wxgui/src/python/powermate.py
new file mode 100644
index 000000000..7c324c5d9
--- /dev/null
+++ b/gr-wxgui/src/python/powermate.py
@@ -0,0 +1,448 @@
+#!/usr/bin/env python
+#
+# Copyright 2005 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.
+#
+
+"""
+Handler for Griffin PowerMate, Contour ShuttlePro & ShuttleXpress USB knobs
+
+This is Linux and wxPython specific.
+"""
+
+import os
+import sys
+import struct
+import exceptions
+import threading
+import wx
+from gnuradio import gru
+
+imported_ok = True
+
+try:
+ import select
+ import fcntl
+except ImportError:
+ imported_ok = False
+
+
+# First a little bit of background:
+#
+# The Griffin PowerMate has
+# * a single knob which rotates
+# * a single button (pressing the knob)
+#
+# The Contour ShuttleXpress (aka SpaceShuttle) has
+# * "Jog Wheel" -- the knob (rotary encoder) on the inside
+# * "Shuttle Ring" -- the spring loaded rubber covered ring
+# * 5 buttons
+#
+# The Contour ShuttlePro has
+# * "Jog Wheel" -- the knob (rotary encoder) on the inside
+# * "Shuttle Ring" -- the spring loaded rubber covered ring
+# * 13 buttons
+#
+# The Contour ShuttlePro V2 has
+# *"Jog Wheel" -- the knob (rotary encoder) on the inside
+# * "Shuttle Ring" -- the spring loaded rubber covered ring
+# * 15 buttons
+
+# We remap all the buttons on the devices so that they start at zero.
+
+# For the ShuttleXpress the buttons are 0 to 4 (left to right)
+
+# For the ShuttlePro, we number the buttons immediately above
+# the ring 0 to 4 (left to right) so that they match our numbering
+# on the ShuttleXpress. The top row is 5, 6, 7, 8. The first row below
+# the ring is 9, 10, and the bottom row is 11, 12.
+
+# For the ShuttlePro V2, buttons 13 & 14 are to the
+# left and right of the wheel respectively.
+
+# We generate 3 kinds of events:
+#
+# button press/release (button_number, press/release)
+# knob rotation (relative_clicks) # typically -1, +1
+# shuttle position (absolute_position) # -7,-6,...,0,...,6,7
+
+# ----------------------------------------------------------------
+# Our ID's for the devices:
+# Not to be confused with anything related to magic hardware numbers.
+
+ID_POWERMATE = 'powermate'
+ID_SHUTTLE_XPRESS = 'shuttle xpress'
+ID_SHUTTLE_PRO = 'shuttle pro'
+ID_SHUTTLE_PRO_V2 = 'shuttle pro v2'
+
+# ------------------------------------------------------------------------
+# format of messages that we read from /dev/input/event*
+# See /usr/include/linux/input.h for more info
+#
+#struct input_event {
+# struct timeval time; = {long seconds, long microseconds}
+# unsigned short type;
+# unsigned short code;
+# unsigned int value;
+#};
+
+input_event_struct = "@llHHi"
+input_event_size = struct.calcsize(input_event_struct)
+
+# ------------------------------------------------------------------------
+# input_event types
+# ------------------------------------------------------------------------
+
+IET_SYN = 0x00 # aka RESET
+IET_KEY = 0x01 # key or button press/release
+IET_REL = 0x02 # relative movement (knob rotation)
+IET_ABS = 0x03 # absolute position (graphics pad, etc)
+IET_MSC = 0x04
+IET_LED = 0x11
+IET_SND = 0x12
+IET_REP = 0x14
+IET_FF = 0x15
+IET_PWR = 0x16
+IET_FF_STATUS = 0x17
+IET_MAX = 0x1f
+
+# ------------------------------------------------------------------------
+# input_event codes (there are a zillion of them, we only define a few)
+# ------------------------------------------------------------------------
+
+# these are valid for IET_KEY
+
+IEC_BTN_0 = 0x100
+IEC_BTN_1 = 0x101
+IEC_BTN_2 = 0x102
+IEC_BTN_3 = 0x103
+IEC_BTN_4 = 0x104
+IEC_BTN_5 = 0x105
+IEC_BTN_6 = 0x106
+IEC_BTN_7 = 0x107
+IEC_BTN_8 = 0x108
+IEC_BTN_9 = 0x109
+IEC_BTN_10 = 0x10a
+IEC_BTN_11 = 0x10b
+IEC_BTN_12 = 0x10c
+IEC_BTN_13 = 0x10d
+IEC_BTN_14 = 0x10e
+IEC_BTN_15 = 0x10f
+
+# these are valid for IET_REL (Relative axes)
+
+IEC_REL_X = 0x00
+IEC_REL_Y = 0x01
+IEC_REL_Z = 0x02
+IEC_REL_HWHEEL = 0x06
+IEC_REL_DIAL = 0x07 # rotating the knob
+IEC_REL_WHEEL = 0x08 # moving the shuttle ring
+IEC_REL_MISC = 0x09
+IEC_REL_MAX = 0x0f
+
+# ------------------------------------------------------------------------
+
+class powermate(threading.Thread):
+ """
+ Interface to Griffin PowerMate and Contour Shuttles
+ """
+ def __init__(self, event_receiver=None, filename=None, **kwargs):
+ self.event_receiver = event_receiver
+ self.handle = -1
+ if not imported_ok:
+ raise exceptions.RuntimeError, 'powermate not supported on this platform'
+
+ if filename:
+ if not self._open_device(filename):
+ raise exceptions.RuntimeError, 'Unable to find powermate'
+ else:
+ ok = False
+ for d in range(0, 16):
+ if self._open_device("/dev/input/event%d" % d):
+ ok = True
+ break
+ if not ok:
+ raise exceptions.RuntimeError, 'Unable to find powermate'
+
+ threading.Thread.__init__(self, **kwargs)
+ self.setDaemon (1)
+ self.keep_running = True
+ self.start ()
+
+ def __del__(self):
+ self.keep_running = False
+ if self.handle >= 0:
+ os.close(self.handle)
+ self.handle = -1
+
+ def _open_device(self, filename):
+ try:
+ self.handle = os.open(filename, os.O_RDWR)
+ if self.handle < 0:
+ return False
+
+ # read event device name
+ name = fcntl.ioctl(self.handle, gru.hexint(0x80ff4506), chr(0) * 256)
+ name = name.replace(chr(0), '')
+
+ # do we see anything we recognize?
+ if name == 'Griffin PowerMate' or name == 'Griffin SoundKnob':
+ self.id = ID_POWERMATE
+ self.mapper = _powermate_remapper()
+ elif name == 'CAVS SpaceShuttle A/V' or name == 'Contour Design ShuttleXpress':
+ self.id = ID_SHUTTLE_XPRESS
+ self.mapper = _contour_remapper()
+ elif name == 'Contour Design ShuttlePRO':
+ self.id = ID_SHUTTLE_PRO
+ self.mapper = _contour_remapper()
+ elif name == 'Contour Design ShuttlePRO v2':
+ self.id = ID_SHUTTLE_PRO_V2
+ self.mapper = _contour_remapper()
+ else:
+ os.close(self.handle)
+ self.handle = -1
+ return False
+
+ # get exclusive control of the device, using ioctl EVIOCGRAB
+ # there may be an issue with this on non x86 platforms and if
+ # the _IOW,_IOC,... macros in <asm/ioctl.h> are changed
+ fcntl.ioctl(self.handle,gru.hexint(0x40044590), 1)
+ return True
+ except exceptions.OSError:
+ return False
+
+
+ def set_event_receiver(self, obj):
+ self.event_receiver = obj
+
+
+ def set_led_state(self, static_brightness, pulse_speed=0,
+ pulse_table=0, pulse_on_sleep=0, pulse_on_wake=0):
+ """
+ What do these magic values mean...
+ """
+ if self.id != ID_POWERMATE:
+ return False
+
+ static_brightness &= 0xff;
+ if pulse_speed < 0:
+ pulse_speed = 0
+ if pulse_speed > 510:
+ pulse_speed = 510
+ if pulse_table < 0:
+ pulse_table = 0
+ if pulse_table > 2:
+ pulse_table = 2
+ pulse_on_sleep = not not pulse_on_sleep # not not = convert to 0/1
+ pulse_on_wake = not not pulse_on_wake
+ magic = (static_brightness
+ | (pulse_speed << 8)
+ | (pulse_table << 17)
+ | (pulse_on_sleep << 19)
+ | (pulse_on_wake << 20))
+ data = struct.pack(input_event_struct, 0, 0, 0x04, 0x01, magic)
+ os.write(self.handle, data)
+ return True
+
+ def run (self):
+ while (self.keep_running):
+ s = os.read (self.handle, input_event_size)
+ if not s:
+ self.keep_running = False
+ break
+
+ raw_input_event = struct.unpack(input_event_struct,s)
+ sec, usec, type, code, val = self.mapper(raw_input_event)
+
+ if self.event_receiver is None:
+ continue
+
+ if type == IET_SYN: # ignore
+ pass
+ elif type == IET_MSC: # ignore (seems to be PowerMate reporting led brightness)
+ pass
+ elif type == IET_REL and code == IEC_REL_DIAL:
+ #print "Dial: %d" % (val,)
+ wx.PostEvent(self.event_receiver, PMRotateEvent(val))
+ elif type == IET_REL and code == IEC_REL_WHEEL:
+ #print "Shuttle: %d" % (val,)
+ wx.PostEvent(self.event_receiver, PMShuttleEvent(val))
+ elif type == IET_KEY:
+ #print "Key: Btn%d %d" % (code - IEC_BTN_0, val)
+ wx.PostEvent(self.event_receiver,
+ PMButtonEvent(code - IEC_BTN_0, val))
+ else:
+ print "powermate: unrecognized event: type = 0x%x code = 0x%x val = %d" % (type, code, val)
+
+
+class _powermate_remapper(object):
+ def __init__(self):
+ pass
+ def __call__(self, event):
+ """
+ Notice how nice and simple this is...
+ """
+ return event
+
+class _contour_remapper(object):
+ def __init__(self):
+ self.prev = None
+ def __call__(self, event):
+ """
+ ...and how screwed up this is
+ """
+ sec, usec, type, code, val = event
+ if type == IET_REL and code == IEC_REL_WHEEL:
+ # === Shuttle ring ===
+ # First off, this really ought to be IET_ABS, not IET_REL!
+ # They never generate a zero value so you can't
+ # tell when the shuttle ring is back in the center.
+ # We kludge around this by calling both -1 and 1 zero.
+ if val == -1 or val == 1:
+ return (sec, usec, type, code, 0)
+ return event
+
+ if type == IET_REL and code == IEC_REL_DIAL:
+ # === Jog knob (rotary encoder) ===
+ # Dim wits got it wrong again! This one should return a
+ # a relative value, e.g., -1, +1. Instead they return
+ # a total that runs modulo 256 (almost!). For some
+ # reason they count like this 253, 254, 255, 1, 2, 3
+
+ if self.prev is None: # first time call
+ self.prev = val
+ return (sec, usec, IET_SYN, 0, 0) # will be ignored above
+
+ diff = val - self.prev
+ if diff == 0: # sometimes it just sends stuff...
+ return (sec, usec, IET_SYN, 0, 0) # will be ignored above
+
+ if abs(diff) > 100: # crossed into the twilight zone
+ if self.prev > val: # we've wrapped going forward
+ self.prev = val
+ return (sec, usec, type, code, +1)
+ else: # we've wrapped going backward
+ self.prev = val
+ return (sec, usec, type, code, -1)
+
+ self.prev = val
+ return (sec, usec, type, code, diff)
+
+ if type == IET_KEY:
+ # remap keys so that all 3 gadgets have buttons 0 to 4 in common
+ return (sec, usec, type,
+ (IEC_BTN_5, IEC_BTN_6, IEC_BTN_7, IEC_BTN_8,
+ IEC_BTN_0, IEC_BTN_1, IEC_BTN_2, IEC_BTN_3, IEC_BTN_4,
+ IEC_BTN_9, IEC_BTN_10,
+ IEC_BTN_11, IEC_BTN_12,
+ IEC_BTN_13, IEC_BTN_14)[code - IEC_BTN_0], val)
+
+ return event
+
+# ------------------------------------------------------------------------
+# new wxPython event classes
+# ------------------------------------------------------------------------
+
+grEVT_POWERMATE_BUTTON = wx.NewEventType()
+grEVT_POWERMATE_ROTATE = wx.NewEventType()
+grEVT_POWERMATE_SHUTTLE = wx.NewEventType()
+
+EVT_POWERMATE_BUTTON = wx.PyEventBinder(grEVT_POWERMATE_BUTTON, 0)
+EVT_POWERMATE_ROTATE = wx.PyEventBinder(grEVT_POWERMATE_ROTATE, 0)
+EVT_POWERMATE_SHUTTLE = wx.PyEventBinder(grEVT_POWERMATE_SHUTTLE, 0)
+
+class PMButtonEvent(wx.PyEvent):
+ def __init__(self, button, value):
+ wx.PyEvent.__init__(self)
+ self.SetEventType(grEVT_POWERMATE_BUTTON)
+ self.button = button
+ self.value = value
+
+ def Clone (self):
+ self.__class__(self.GetId())
+
+
+class PMRotateEvent(wx.PyEvent):
+ def __init__(self, delta):
+ wx.PyEvent.__init__(self)
+ self.SetEventType (grEVT_POWERMATE_ROTATE)
+ self.delta = delta
+
+ def Clone (self):
+ self.__class__(self.GetId())
+
+
+class PMShuttleEvent(wx.PyEvent):
+ def __init__(self, position):
+ wx.PyEvent.__init__(self)
+ self.SetEventType (grEVT_POWERMATE_SHUTTLE)
+ self.position = position
+
+ def Clone (self):
+ self.__class__(self.GetId())
+
+# ------------------------------------------------------------------------
+# Example usage
+# ------------------------------------------------------------------------
+
+if __name__ == '__main__':
+ class Frame(wx.Frame):
+ def __init__(self,parent=None,id=-1,title='Title',
+ pos=wx.DefaultPosition, size=(400,200)):
+ wx.Frame.__init__(self,parent,id,title,pos,size)
+ EVT_POWERMATE_BUTTON(self, self.on_button)
+ EVT_POWERMATE_ROTATE(self, self.on_rotate)
+ EVT_POWERMATE_SHUTTLE(self, self.on_shuttle)
+ self.brightness = 128
+ self.pulse_speed = 0
+
+ try:
+ self.pm = powermate(self)
+ except:
+ sys.stderr.write("Unable to find PowerMate or Contour Shuttle\n")
+ sys.exit(1)
+
+ self.pm.set_led_state(self.brightness, self.pulse_speed)
+
+
+ def on_button(self, evt):
+ print "Button %d %s" % (evt.button,
+ ("Released", "Pressed")[evt.value])
+
+ def on_rotate(self, evt):
+ print "Rotated %d" % (evt.delta,)
+ if 0:
+ new = max(0, min(255, self.brightness + evt.delta))
+ if new != self.brightness:
+ self.brightness = new
+ self.pm.set_led_state(self.brightness, self.pulse_speed)
+
+ def on_shuttle(self, evt):
+ print "Shuttle %d" % (evt.position,)
+
+ class App(wx.App):
+ def OnInit(self):
+ title='PowerMate Demo'
+ self.frame = Frame(parent=None,id=-1,title=title)
+ self.frame.Show()
+ self.SetTopWindow(self.frame)
+ return True
+
+ app = App()
+ app.MainLoop ()
diff --git a/gr-wxgui/src/python/pubsub.py b/gr-wxgui/src/python/pubsub.py
new file mode 100644
index 000000000..e55d69197
--- /dev/null
+++ b/gr-wxgui/src/python/pubsub.py
@@ -0,0 +1,153 @@
+#!/usr/bin/env python
+#
+# 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.
+#
+
+"""
+Abstract GNU Radio publisher/subscriber interface
+
+This is a proof of concept implementation, will likely change significantly.
+"""
+
+class pubsub(dict):
+ def __init__(self):
+ self._publishers = { }
+ self._subscribers = { }
+ self._proxies = { }
+
+ def __missing__(self, key, value=None):
+ dict.__setitem__(self, key, value)
+ self._publishers[key] = None
+ self._subscribers[key] = []
+ self._proxies[key] = None
+
+ def __setitem__(self, key, val):
+ if not self.has_key(key):
+ self.__missing__(key, val)
+ elif self._proxies[key] is not None:
+ (p, pkey) = self._proxies[key]
+ p[pkey] = val
+ else:
+ dict.__setitem__(self, key, val)
+ for sub in self._subscribers[key]:
+ # Note this means subscribers will get called in the thread
+ # context of the 'set' caller.
+ sub(val)
+
+ def __getitem__(self, key):
+ if not self.has_key(key): self.__missing__(key)
+ if self._proxies[key] is not None:
+ (p, pkey) = self._proxies[key]
+ return p[pkey]
+ elif self._publishers[key] is not None:
+ return self._publishers[key]()
+ else:
+ return dict.__getitem__(self, key)
+
+ def publish(self, key, publisher):
+ if not self.has_key(key): self.__missing__(key)
+ if self._proxies[key] is not None:
+ (p, pkey) = self._proxies[key]
+ p.publish(pkey, publisher)
+ else:
+ self._publishers[key] = publisher
+
+ def subscribe(self, key, subscriber):
+ if not self.has_key(key): self.__missing__(key)
+ if self._proxies[key] is not None:
+ (p, pkey) = self._proxies[key]
+ p.subscribe(pkey, subscriber)
+ else:
+ self._subscribers[key].append(subscriber)
+
+ def unpublish(self, key):
+ if self._proxies[key] is not None:
+ (p, pkey) = self._proxies[key]
+ p.unpublish(pkey)
+ else:
+ self._publishers[key] = None
+
+ def unsubscribe(self, key, subscriber):
+ if self._proxies[key] is not None:
+ (p, pkey) = self._proxies[key]
+ p.unsubscribe(pkey, subscriber)
+ else:
+ self._subscribers[key].remove(subscriber)
+
+ def proxy(self, key, p, pkey=None):
+ if not self.has_key(key): self.__missing__(key)
+ if pkey is None: pkey = key
+ self._proxies[key] = (p, pkey)
+
+ def unproxy(self, key):
+ self._proxies[key] = None
+
+# Test code
+if __name__ == "__main__":
+ import sys
+ o = pubsub()
+
+ # Non-existent key gets auto-created with None value
+ print "Auto-created key 'foo' value:", o['foo']
+
+ # Add some subscribers
+ # First is a bare function
+ def print_len(x):
+ print "len=%i" % (len(x), )
+ o.subscribe('foo', print_len)
+
+ # The second is a class member function
+ class subber(object):
+ def __init__(self, param):
+ self._param = param
+ def printer(self, x):
+ print self._param, `x`
+ s = subber('param')
+ o.subscribe('foo', s.printer)
+
+ # The third is a lambda function
+ o.subscribe('foo', lambda x: sys.stdout.write('val='+`x`+'\n'))
+
+ # Update key 'foo', will notify subscribers
+ print "Updating 'foo' with three subscribers:"
+ o['foo'] = 'bar';
+
+ # Remove first subscriber
+ o.unsubscribe('foo', print_len)
+
+ # Update now will only trigger second and third subscriber
+ print "Updating 'foo' after removing a subscriber:"
+ o['foo'] = 'bar2';
+
+ # Publish a key as a function, in this case, a lambda function
+ o.publish('baz', lambda : 42)
+ print "Published value of 'baz':", o['baz']
+
+ # Unpublish the key
+ o.unpublish('baz')
+
+ # This will return None, as there is no publisher
+ print "Value of 'baz' with no publisher:", o['baz']
+
+ # Set 'baz' key, it gets cached
+ o['baz'] = 'bazzz'
+
+ # Now will return cached value, since no provider
+ print "Cached value of 'baz' after being set:", o['baz']
diff --git a/gr-wxgui/src/python/scope_window.py b/gr-wxgui/src/python/scope_window.py
new file mode 100644
index 000000000..fa79a986e
--- /dev/null
+++ b/gr-wxgui/src/python/scope_window.py
@@ -0,0 +1,686 @@
+#
+# 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.
+#
+
+##################################################
+# Imports
+##################################################
+import plotter
+import common
+import wx
+import numpy
+import time
+import pubsub
+from constants import *
+from gnuradio import gr #for gr.prefs, trigger modes
+import forms
+
+##################################################
+# Constants
+##################################################
+DEFAULT_FRAME_RATE = gr.prefs().get_long('wxgui', 'scope_rate', 30)
+PERSIST_ALPHA_MIN_EXP, PERSIST_ALPHA_MAX_EXP = -2, 0
+SLIDER_STEPS = 100
+DEFAULT_TRIG_MODE = gr.prefs().get_long('wxgui', 'trig_mode', gr.gr_TRIG_MODE_AUTO)
+DEFAULT_WIN_SIZE = (600, 300)
+COUPLING_MODES = (
+ ('DC', False),
+ ('AC', True),
+)
+TRIGGER_MODES = (
+ ('Freerun', gr.gr_TRIG_MODE_FREE),
+ ('Auto', gr.gr_TRIG_MODE_AUTO),
+ ('Normal', gr.gr_TRIG_MODE_NORM),
+ ('Stripchart', gr.gr_TRIG_MODE_STRIPCHART),
+)
+TRIGGER_SLOPES = (
+ ('Pos +', gr.gr_TRIG_SLOPE_POS),
+ ('Neg -', gr.gr_TRIG_SLOPE_NEG),
+)
+CHANNEL_COLOR_SPECS = (
+ (0.3, 0.3, 1.0),
+ (0.0, 0.8, 0.0),
+ (1.0, 0.0, 0.0),
+ (0.8, 0.0, 0.8),
+ (0.7, 0.7, 0.0),
+ (0.15, 0.90, 0.98),
+
+)
+TRIGGER_COLOR_SPEC = (1.0, 0.4, 0.0)
+AUTORANGE_UPDATE_RATE = 0.5 #sec
+MARKER_TYPES = (
+ ('Line Link', None),
+ ('Dot Large', 3.0),
+ ('Dot Med', 2.0),
+ ('Dot Small', 1.0),
+ ('None', 0.0),
+)
+DEFAULT_MARKER_TYPE = None
+
+##################################################
+# Scope window control panel
+##################################################
+class control_panel(wx.Panel):
+ """
+ A control panel with wx widgits to control the plotter and scope block.
+ """
+ def __init__(self, parent):
+ """
+ Create a new control panel.
+ @param parent the wx parent window
+ """
+ WIDTH = 90
+ self.parent = parent
+ wx.Panel.__init__(self, parent, style=wx.SUNKEN_BORDER)
+ parent[SHOW_CONTROL_PANEL_KEY] = True
+ parent.subscribe(SHOW_CONTROL_PANEL_KEY, self.Show)
+ control_box = wx.BoxSizer(wx.VERTICAL)
+
+ ##################################################
+ # Persistence
+ ##################################################
+
+ forms.check_box(
+ sizer=control_box, parent=self, label='Persistence',
+ ps=parent, key=USE_PERSISTENCE_KEY,
+ )
+ #static text and slider for analog alpha
+ persist_alpha_text = forms.static_text(
+ sizer=control_box, parent=self, label='Analog Alpha',
+ converter=forms.float_converter(lambda x: '%.4f'%x),
+ ps=parent, key=PERSIST_ALPHA_KEY, width=50,
+ )
+ persist_alpha_slider = forms.log_slider(
+ sizer=control_box, parent=self,
+ min_exp=PERSIST_ALPHA_MIN_EXP,
+ max_exp=PERSIST_ALPHA_MAX_EXP,
+ num_steps=SLIDER_STEPS,
+ ps=parent, key=PERSIST_ALPHA_KEY,
+ )
+ for widget in (persist_alpha_text, persist_alpha_slider):
+ parent.subscribe(USE_PERSISTENCE_KEY, widget.Enable)
+ widget.Enable(parent[USE_PERSISTENCE_KEY])
+ parent.subscribe(USE_PERSISTENCE_KEY, widget.ShowItems)
+ #allways show initially, so room is reserved for them
+ widget.ShowItems(True) # (parent[USE_PERSISTENCE_KEY])
+
+ parent.subscribe(USE_PERSISTENCE_KEY, self._update_layout)
+
+ ##################################################
+ # Axes Options
+ ##################################################
+ control_box.AddStretchSpacer()
+ axes_options_box = forms.static_box_sizer(
+ parent=self, sizer=control_box, label='Axes Options',
+ bold=True, orient=wx.VERTICAL,
+ )
+ ##################################################
+ # Scope Mode Box
+ ##################################################
+ scope_mode_box = wx.BoxSizer(wx.VERTICAL)
+ axes_options_box.Add(scope_mode_box, 0, wx.EXPAND)
+ #x axis divs
+ forms.incr_decr_buttons(
+ parent=self, sizer=scope_mode_box, label='Secs/Div',
+ on_incr=self._on_incr_t_divs, on_decr=self._on_decr_t_divs,
+ )
+ #y axis divs
+ y_buttons_scope = forms.incr_decr_buttons(
+ parent=self, sizer=scope_mode_box, label='Counts/Div',
+ on_incr=self._on_incr_y_divs, on_decr=self._on_decr_y_divs,
+ )
+ #y axis ref lvl
+ y_off_buttons_scope = forms.incr_decr_buttons(
+ parent=self, sizer=scope_mode_box, label='Y Offset',
+ on_incr=self._on_incr_y_off, on_decr=self._on_decr_y_off,
+ )
+ #t axis ref lvl
+ scope_mode_box.AddSpacer(5)
+ forms.slider(
+ parent=self, sizer=scope_mode_box,
+ ps=parent, key=T_FRAC_OFF_KEY, label='T Offset',
+ minimum=0, maximum=1, num_steps=1000,
+ )
+ scope_mode_box.AddSpacer(5)
+ ##################################################
+ # XY Mode Box
+ ##################################################
+ xy_mode_box = wx.BoxSizer(wx.VERTICAL)
+ axes_options_box.Add(xy_mode_box, 0, wx.EXPAND)
+ #x div controls
+ x_buttons = forms.incr_decr_buttons(
+ parent=self, sizer=xy_mode_box, label='X/Div',
+ on_incr=self._on_incr_x_divs, on_decr=self._on_decr_x_divs,
+ )
+ #y div controls
+ y_buttons = forms.incr_decr_buttons(
+ parent=self, sizer=xy_mode_box, label='Y/Div',
+ on_incr=self._on_incr_y_divs, on_decr=self._on_decr_y_divs,
+ )
+ #x offset controls
+ x_off_buttons = forms.incr_decr_buttons(
+ parent=self, sizer=xy_mode_box, label='X Off',
+ on_incr=self._on_incr_x_off, on_decr=self._on_decr_x_off,
+ )
+ #y offset controls
+ y_off_buttons = forms.incr_decr_buttons(
+ parent=self, sizer=xy_mode_box, label='Y Off',
+ on_incr=self._on_incr_y_off, on_decr=self._on_decr_y_off,
+ )
+ for widget in (y_buttons_scope, y_off_buttons_scope, x_buttons, y_buttons, x_off_buttons, y_off_buttons):
+ parent.subscribe(AUTORANGE_KEY, widget.Disable)
+ widget.Disable(parent[AUTORANGE_KEY])
+ xy_mode_box.ShowItems(False)
+ #autorange check box
+ forms.check_box(
+ parent=self, sizer=axes_options_box, label='Autorange',
+ ps=parent, key=AUTORANGE_KEY,
+ )
+ ##################################################
+ # Channel Options
+ ##################################################
+ TRIGGER_PAGE_INDEX = parent.num_inputs
+ XY_PAGE_INDEX = parent.num_inputs+1
+ control_box.AddStretchSpacer()
+ chan_options_box = forms.static_box_sizer(
+ parent=self, sizer=control_box, label='Channel Options',
+ bold=True, orient=wx.VERTICAL,
+ )
+ options_notebook = wx.Notebook(self)
+ options_notebook_args = list()
+ CHANNELS = [('Ch %d'%(i+1), i) for i in range(parent.num_inputs)]
+ ##################################################
+ # Channel Menu Boxes
+ ##################################################
+ for i in range(parent.num_inputs):
+ channel_menu_panel = wx.Panel(options_notebook)
+ options_notebook_args.append((channel_menu_panel, i, 'Ch%d'%(i+1)))
+ channel_menu_box = wx.BoxSizer(wx.VERTICAL)
+ channel_menu_panel.SetSizer(channel_menu_box)
+ #ac couple check box
+ channel_menu_box.AddStretchSpacer()
+ forms.drop_down(
+ parent=channel_menu_panel, sizer=channel_menu_box,
+ ps=parent, key=common.index_key(AC_COUPLE_KEY, i),
+ choices=map(lambda x: x[1], COUPLING_MODES),
+ labels=map(lambda x: x[0], COUPLING_MODES),
+ label='Coupling', width=WIDTH,
+ )
+ #marker
+ channel_menu_box.AddStretchSpacer()
+ forms.drop_down(
+ parent=channel_menu_panel, sizer=channel_menu_box,
+ ps=parent, key=common.index_key(MARKER_KEY, i),
+ choices=map(lambda x: x[1], MARKER_TYPES),
+ labels=map(lambda x: x[0], MARKER_TYPES),
+ label='Marker', width=WIDTH,
+ )
+ channel_menu_box.AddStretchSpacer()
+ ##################################################
+ # Trigger Menu Box
+ ##################################################
+ trigger_menu_panel = wx.Panel(options_notebook)
+ options_notebook_args.append((trigger_menu_panel, TRIGGER_PAGE_INDEX, 'Trig'))
+ trigger_menu_box = wx.BoxSizer(wx.VERTICAL)
+ trigger_menu_panel.SetSizer(trigger_menu_box)
+ #trigger mode
+ forms.drop_down(
+ parent=trigger_menu_panel, sizer=trigger_menu_box,
+ ps=parent, key=TRIGGER_MODE_KEY,
+ choices=map(lambda x: x[1], TRIGGER_MODES),
+ labels=map(lambda x: x[0], TRIGGER_MODES),
+ label='Mode', width=WIDTH,
+ )
+ #trigger slope
+ trigger_slope_chooser = forms.drop_down(
+ parent=trigger_menu_panel, sizer=trigger_menu_box,
+ ps=parent, key=TRIGGER_SLOPE_KEY,
+ choices=map(lambda x: x[1], TRIGGER_SLOPES),
+ labels=map(lambda x: x[0], TRIGGER_SLOPES),
+ label='Slope', width=WIDTH,
+ )
+ #trigger channel
+ trigger_channel_chooser = forms.drop_down(
+ parent=trigger_menu_panel, sizer=trigger_menu_box,
+ ps=parent, key=TRIGGER_CHANNEL_KEY,
+ choices=map(lambda x: x[1], CHANNELS),
+ labels=map(lambda x: x[0], CHANNELS),
+ label='Channel', width=WIDTH,
+ )
+ #trigger level
+ hbox = wx.BoxSizer(wx.HORIZONTAL)
+ trigger_menu_box.Add(hbox, 0, wx.EXPAND)
+ hbox.Add(wx.StaticText(trigger_menu_panel, label='Level:'), 1, wx.ALIGN_CENTER_VERTICAL)
+ trigger_level_button = forms.single_button(
+ parent=trigger_menu_panel, sizer=hbox, label='50%',
+ callback=parent.set_auto_trigger_level, style=wx.BU_EXACTFIT,
+ )
+ hbox.AddSpacer(WIDTH-60)
+ trigger_level_buttons = forms.incr_decr_buttons(
+ parent=trigger_menu_panel, sizer=hbox,
+ on_incr=self._on_incr_trigger_level, on_decr=self._on_decr_trigger_level,
+ )
+ def disable_all(trigger_mode):
+ for widget in (trigger_slope_chooser, trigger_channel_chooser, trigger_level_buttons, trigger_level_button):
+ widget.Disable(trigger_mode == gr.gr_TRIG_MODE_FREE)
+ parent.subscribe(TRIGGER_MODE_KEY, disable_all)
+ disable_all(parent[TRIGGER_MODE_KEY])
+ ##################################################
+ # XY Menu Box
+ ##################################################
+ if parent.num_inputs > 1:
+ xy_menu_panel = wx.Panel(options_notebook)
+ options_notebook_args.append((xy_menu_panel, XY_PAGE_INDEX, 'XY'))
+ xy_menu_box = wx.BoxSizer(wx.VERTICAL)
+ xy_menu_panel.SetSizer(xy_menu_box)
+ #x and y channel choosers
+ xy_menu_box.AddStretchSpacer()
+ forms.drop_down(
+ parent=xy_menu_panel, sizer=xy_menu_box,
+ ps=parent, key=X_CHANNEL_KEY,
+ choices=map(lambda x: x[1], CHANNELS),
+ labels=map(lambda x: x[0], CHANNELS),
+ label='Channel X', width=WIDTH,
+ )
+ xy_menu_box.AddStretchSpacer()
+ forms.drop_down(
+ parent=xy_menu_panel, sizer=xy_menu_box,
+ ps=parent, key=Y_CHANNEL_KEY,
+ choices=map(lambda x: x[1], CHANNELS),
+ labels=map(lambda x: x[0], CHANNELS),
+ label='Channel Y', width=WIDTH,
+ )
+ #marker
+ xy_menu_box.AddStretchSpacer()
+ forms.drop_down(
+ parent=xy_menu_panel, sizer=xy_menu_box,
+ ps=parent, key=XY_MARKER_KEY,
+ choices=map(lambda x: x[1], MARKER_TYPES),
+ labels=map(lambda x: x[0], MARKER_TYPES),
+ label='Marker', width=WIDTH,
+ )
+ xy_menu_box.AddStretchSpacer()
+ ##################################################
+ # Setup Options Notebook
+ ##################################################
+ forms.notebook(
+ parent=self, sizer=chan_options_box,
+ notebook=options_notebook,
+ ps=parent, key=CHANNEL_OPTIONS_KEY,
+ pages=map(lambda x: x[0], options_notebook_args),
+ choices=map(lambda x: x[1], options_notebook_args),
+ labels=map(lambda x: x[2], options_notebook_args),
+ )
+ #gui handling for channel options changing
+ def options_notebook_changed(chan_opt):
+ try:
+ parent[TRIGGER_SHOW_KEY] = chan_opt == TRIGGER_PAGE_INDEX
+ parent[XY_MODE_KEY] = chan_opt == XY_PAGE_INDEX
+ except wx.PyDeadObjectError: pass
+ parent.subscribe(CHANNEL_OPTIONS_KEY, options_notebook_changed)
+ #gui handling for xy mode changing
+ def xy_mode_changed(mode):
+ #ensure xy tab is selected
+ if mode and parent[CHANNEL_OPTIONS_KEY] != XY_PAGE_INDEX:
+ parent[CHANNEL_OPTIONS_KEY] = XY_PAGE_INDEX
+ #ensure xy tab is not selected
+ elif not mode and parent[CHANNEL_OPTIONS_KEY] == XY_PAGE_INDEX:
+ parent[CHANNEL_OPTIONS_KEY] = 0
+ #show/hide control buttons
+ scope_mode_box.ShowItems(not mode)
+ xy_mode_box.ShowItems(mode)
+ control_box.Layout()
+ parent.subscribe(XY_MODE_KEY, xy_mode_changed)
+ xy_mode_changed(parent[XY_MODE_KEY])
+ ##################################################
+ # Run/Stop Button
+ ##################################################
+ #run/stop
+ control_box.AddStretchSpacer()
+ forms.toggle_button(
+ sizer=control_box, parent=self,
+ true_label='Stop', false_label='Run',
+ ps=parent, key=RUNNING_KEY,
+ )
+ #set sizer
+ self.SetSizerAndFit(control_box)
+ #mouse wheel event
+ def on_mouse_wheel(event):
+ if not parent[XY_MODE_KEY]:
+ if event.GetWheelRotation() < 0: self._on_incr_t_divs(event)
+ else: self._on_decr_t_divs(event)
+ parent.plotter.Bind(wx.EVT_MOUSEWHEEL, on_mouse_wheel)
+
+ ##################################################
+ # Event handlers
+ ##################################################
+ #trigger level
+ def _on_incr_trigger_level(self, event):
+ self.parent[TRIGGER_LEVEL_KEY] += self.parent[Y_PER_DIV_KEY]/3.
+ def _on_decr_trigger_level(self, event):
+ self.parent[TRIGGER_LEVEL_KEY] -= self.parent[Y_PER_DIV_KEY]/3.
+ #incr/decr divs
+ def _on_incr_t_divs(self, event):
+ self.parent[T_PER_DIV_KEY] = common.get_clean_incr(self.parent[T_PER_DIV_KEY])
+ def _on_decr_t_divs(self, event):
+ self.parent[T_PER_DIV_KEY] = common.get_clean_decr(self.parent[T_PER_DIV_KEY])
+ def _on_incr_x_divs(self, event):
+ self.parent[X_PER_DIV_KEY] = common.get_clean_incr(self.parent[X_PER_DIV_KEY])
+ def _on_decr_x_divs(self, event):
+ self.parent[X_PER_DIV_KEY] = common.get_clean_decr(self.parent[X_PER_DIV_KEY])
+ def _on_incr_y_divs(self, event):
+ self.parent[Y_PER_DIV_KEY] = common.get_clean_incr(self.parent[Y_PER_DIV_KEY])
+ def _on_decr_y_divs(self, event):
+ self.parent[Y_PER_DIV_KEY] = common.get_clean_decr(self.parent[Y_PER_DIV_KEY])
+ #incr/decr offset
+ def _on_incr_x_off(self, event):
+ self.parent[X_OFF_KEY] = self.parent[X_OFF_KEY] + self.parent[X_PER_DIV_KEY]
+ def _on_decr_x_off(self, event):
+ self.parent[X_OFF_KEY] = self.parent[X_OFF_KEY] - self.parent[X_PER_DIV_KEY]
+ def _on_incr_y_off(self, event):
+ self.parent[Y_OFF_KEY] = self.parent[Y_OFF_KEY] + self.parent[Y_PER_DIV_KEY]
+ def _on_decr_y_off(self, event):
+ self.parent[Y_OFF_KEY] = self.parent[Y_OFF_KEY] - self.parent[Y_PER_DIV_KEY]
+
+ ##################################################
+ # subscriber handlers
+ ##################################################
+ def _update_layout(self,key):
+ # Just ignore the key value we get
+ # we only need to now that the visability or size of something has changed
+ self.parent.Layout()
+ #self.parent.Fit()
+
+##################################################
+# Scope window with plotter and control panel
+##################################################
+class scope_window(wx.Panel, pubsub.pubsub):
+ def __init__(
+ self,
+ parent,
+ controller,
+ size,
+ title,
+ frame_rate,
+ num_inputs,
+ sample_rate_key,
+ t_scale,
+ v_scale,
+ v_offset,
+ xy_mode,
+ ac_couple_key,
+ trigger_level_key,
+ trigger_mode_key,
+ trigger_slope_key,
+ trigger_channel_key,
+ decimation_key,
+ msg_key,
+ use_persistence,
+ persist_alpha,
+ trig_mode,
+ y_axis_label,
+ ):
+ pubsub.pubsub.__init__(self)
+ #check num inputs
+ assert num_inputs <= len(CHANNEL_COLOR_SPECS)
+ #setup
+ self.sampleses = None
+ self.num_inputs = num_inputs
+ autorange = not v_scale
+ self.autorange_ts = 0
+ v_scale = v_scale or 1
+ self.frame_rate_ts = 0
+ #proxy the keys
+ self.proxy(MSG_KEY, controller, msg_key)
+ self.proxy(SAMPLE_RATE_KEY, controller, sample_rate_key)
+ self.proxy(TRIGGER_LEVEL_KEY, controller, trigger_level_key)
+ self.proxy(TRIGGER_MODE_KEY, controller, trigger_mode_key)
+ self.proxy(TRIGGER_SLOPE_KEY, controller, trigger_slope_key)
+ self.proxy(TRIGGER_CHANNEL_KEY, controller, trigger_channel_key)
+ self.proxy(DECIMATION_KEY, controller, decimation_key)
+ #initialize values
+ self[RUNNING_KEY] = True
+ self[XY_MARKER_KEY] = 2.0
+ self[CHANNEL_OPTIONS_KEY] = 0
+ self[XY_MODE_KEY] = xy_mode
+ self[X_CHANNEL_KEY] = 0
+ self[Y_CHANNEL_KEY] = self.num_inputs-1
+ self[AUTORANGE_KEY] = autorange
+ self[T_PER_DIV_KEY] = t_scale
+ self[X_PER_DIV_KEY] = v_scale
+ self[Y_PER_DIV_KEY] = v_scale
+ self[T_OFF_KEY] = 0
+ self[X_OFF_KEY] = v_offset
+ self[Y_OFF_KEY] = v_offset
+ self[T_DIVS_KEY] = 8
+ self[X_DIVS_KEY] = 8
+ self[Y_DIVS_KEY] = 8
+ self[Y_AXIS_LABEL] = y_axis_label
+ self[FRAME_RATE_KEY] = frame_rate
+ self[TRIGGER_LEVEL_KEY] = 0
+ self[TRIGGER_CHANNEL_KEY] = 0
+ self[TRIGGER_MODE_KEY] = trig_mode
+
+ self[TRIGGER_SLOPE_KEY] = gr.gr_TRIG_SLOPE_POS
+ self[T_FRAC_OFF_KEY] = 0.5
+ self[USE_PERSISTENCE_KEY] = use_persistence
+ self[PERSIST_ALPHA_KEY] = persist_alpha
+
+ if self[TRIGGER_MODE_KEY] == gr.gr_TRIG_MODE_STRIPCHART:
+ self[T_FRAC_OFF_KEY] = 0.0
+
+ for i in range(num_inputs):
+ self.proxy(common.index_key(AC_COUPLE_KEY, i), controller, common.index_key(ac_couple_key, i))
+ #init panel and plot
+ wx.Panel.__init__(self, parent, style=wx.SIMPLE_BORDER)
+ self.plotter = plotter.channel_plotter(self)
+ self.plotter.SetSize(wx.Size(*size))
+ self.plotter.SetSizeHints(*size)
+ self.plotter.set_title(title)
+ self.plotter.enable_legend(True)
+ self.plotter.enable_point_label(True)
+ self.plotter.enable_grid_lines(True)
+ self.plotter.set_use_persistence(use_persistence)
+ self.plotter.set_persist_alpha(persist_alpha)
+ #setup the box with plot and controls
+ self.control_panel = control_panel(self)
+ main_box = wx.BoxSizer(wx.HORIZONTAL)
+ main_box.Add(self.plotter, 1, wx.EXPAND)
+ main_box.Add(self.control_panel, 0, wx.EXPAND)
+ self.SetSizerAndFit(main_box)
+ #register events for message
+ self.subscribe(MSG_KEY, self.handle_msg)
+ #register events for grid
+ for key in [common.index_key(MARKER_KEY, i) for i in range(self.num_inputs)] + [
+ TRIGGER_LEVEL_KEY, TRIGGER_MODE_KEY,
+ T_PER_DIV_KEY, X_PER_DIV_KEY, Y_PER_DIV_KEY,
+ T_OFF_KEY, X_OFF_KEY, Y_OFF_KEY,
+ T_DIVS_KEY, X_DIVS_KEY, Y_DIVS_KEY,
+ XY_MODE_KEY, AUTORANGE_KEY, T_FRAC_OFF_KEY,
+ TRIGGER_SHOW_KEY, XY_MARKER_KEY, X_CHANNEL_KEY, Y_CHANNEL_KEY,
+ ]: self.subscribe(key, self.update_grid)
+ #register events for plotter settings
+ self.subscribe(USE_PERSISTENCE_KEY, self.plotter.set_use_persistence)
+ self.subscribe(PERSIST_ALPHA_KEY, self.plotter.set_persist_alpha)
+ #initial update
+ self.update_grid()
+
+ def handle_msg(self, msg):
+ """
+ Handle the message from the scope sink message queue.
+ Plot the list of arrays of samples onto the grid.
+ Each samples array gets its own channel.
+ @param msg the time domain data as a character array
+ """
+ if not self[RUNNING_KEY]: return
+ #check time elapsed
+ if time.time() - self.frame_rate_ts < 1.0/self[FRAME_RATE_KEY]: return
+ #convert to floating point numbers
+ samples = numpy.fromstring(msg, numpy.float32)
+ #extract the trigger offset
+ self.trigger_offset = samples[-1]
+ samples = samples[:-1]
+ samps_per_ch = len(samples)/self.num_inputs
+ self.sampleses = [samples[samps_per_ch*i:samps_per_ch*(i+1)] for i in range(self.num_inputs)]
+ #handle samples
+ self.handle_samples()
+ self.frame_rate_ts = time.time()
+
+ def set_auto_trigger_level(self, *args):
+ """
+ Use the current trigger channel and samples to calculate the 50% level.
+ """
+ if not self.sampleses: return
+ samples = self.sampleses[self[TRIGGER_CHANNEL_KEY]]
+ self[TRIGGER_LEVEL_KEY] = (numpy.max(samples)+numpy.min(samples))/2
+
+ def handle_samples(self):
+ """
+ Handle the cached samples from the scope input.
+ Perform ac coupling, triggering, and auto ranging.
+ """
+ if not self.sampleses: return
+ sampleses = self.sampleses
+ if self[XY_MODE_KEY]:
+ self[DECIMATION_KEY] = 1
+ x_samples = sampleses[self[X_CHANNEL_KEY]]
+ y_samples = sampleses[self[Y_CHANNEL_KEY]]
+ #autorange
+ if self[AUTORANGE_KEY] and time.time() - self.autorange_ts > AUTORANGE_UPDATE_RATE:
+ x_min, x_max = common.get_min_max(x_samples)
+ y_min, y_max = common.get_min_max(y_samples)
+ #adjust the x per div
+ x_per_div = common.get_clean_num((x_max-x_min)/self[X_DIVS_KEY])
+ if x_per_div != self[X_PER_DIV_KEY]: self[X_PER_DIV_KEY] = x_per_div; return
+ #adjust the x offset
+ x_off = x_per_div*round((x_max+x_min)/2/x_per_div)
+ if x_off != self[X_OFF_KEY]: self[X_OFF_KEY] = x_off; return
+ #adjust the y per div
+ y_per_div = common.get_clean_num((y_max-y_min)/self[Y_DIVS_KEY])
+ if y_per_div != self[Y_PER_DIV_KEY]: self[Y_PER_DIV_KEY] = y_per_div; return
+ #adjust the y offset
+ y_off = y_per_div*round((y_max+y_min)/2/y_per_div)
+ if y_off != self[Y_OFF_KEY]: self[Y_OFF_KEY] = y_off; return
+ self.autorange_ts = time.time()
+ #plot xy channel
+ self.plotter.set_waveform(
+ channel='XY',
+ samples=(x_samples, y_samples),
+ color_spec=CHANNEL_COLOR_SPECS[0],
+ marker=self[XY_MARKER_KEY],
+ )
+ #turn off each waveform
+ for i, samples in enumerate(sampleses):
+ self.plotter.clear_waveform(channel='Ch%d'%(i+1))
+ else:
+ #autorange
+ if self[AUTORANGE_KEY] and time.time() - self.autorange_ts > AUTORANGE_UPDATE_RATE:
+ bounds = [common.get_min_max(samples) for samples in sampleses]
+ y_min = numpy.min([bound[0] for bound in bounds])
+ y_max = numpy.max([bound[1] for bound in bounds])
+ #adjust the y per div
+ y_per_div = common.get_clean_num((y_max-y_min)/self[Y_DIVS_KEY])
+ if y_per_div != self[Y_PER_DIV_KEY]: self[Y_PER_DIV_KEY] = y_per_div; return
+ #adjust the y offset
+ y_off = y_per_div*round((y_max+y_min)/2/y_per_div)
+ if y_off != self[Y_OFF_KEY]: self[Y_OFF_KEY] = y_off; return
+ self.autorange_ts = time.time()
+ #number of samples to scale to the screen
+ actual_rate = self.get_actual_rate()
+ time_span = self[T_PER_DIV_KEY]*self[T_DIVS_KEY]
+ num_samps = int(round(time_span*actual_rate))
+ #handle the time offset
+ t_off = self[T_FRAC_OFF_KEY]*(len(sampleses[0])/actual_rate - time_span)
+ if t_off != self[T_OFF_KEY]: self[T_OFF_KEY] = t_off; return
+ samps_off = int(round(actual_rate*self[T_OFF_KEY]))
+ #adjust the decim so that we use about half the samps
+ self[DECIMATION_KEY] = int(round(
+ time_span*self[SAMPLE_RATE_KEY]/(0.5*len(sampleses[0]))
+ )
+ )
+ #num samps too small, auto increment the time
+ if num_samps < 2: self[T_PER_DIV_KEY] = common.get_clean_incr(self[T_PER_DIV_KEY])
+ #num samps in bounds, plot each waveform
+ elif num_samps <= len(sampleses[0]):
+ for i, samples in enumerate(sampleses):
+ #plot samples
+ self.plotter.set_waveform(
+ channel='Ch%d'%(i+1),
+ samples=samples[samps_off:num_samps+samps_off],
+ color_spec=CHANNEL_COLOR_SPECS[i],
+ marker=self[common.index_key(MARKER_KEY, i)],
+ trig_off=self.trigger_offset,
+ )
+ #turn XY channel off
+ self.plotter.clear_waveform(channel='XY')
+ #keep trigger level within range
+ if self[TRIGGER_LEVEL_KEY] > self.get_y_max():
+ self[TRIGGER_LEVEL_KEY] = self.get_y_max(); return
+ if self[TRIGGER_LEVEL_KEY] < self.get_y_min():
+ self[TRIGGER_LEVEL_KEY] = self.get_y_min(); return
+ #disable the trigger channel
+ if not self[TRIGGER_SHOW_KEY] or self[XY_MODE_KEY] or self[TRIGGER_MODE_KEY] == gr.gr_TRIG_MODE_FREE:
+ self.plotter.clear_waveform(channel='Trig')
+ else: #show trigger channel
+ trigger_level = self[TRIGGER_LEVEL_KEY]
+ trigger_point = (len(self.sampleses[0])-1)/self.get_actual_rate()/2.0
+ self.plotter.set_waveform(
+ channel='Trig',
+ samples=(
+ [self.get_t_min(), trigger_point, trigger_point, trigger_point, trigger_point, self.get_t_max()],
+ [trigger_level, trigger_level, self.get_y_max(), self.get_y_min(), trigger_level, trigger_level]
+ ),
+ color_spec=TRIGGER_COLOR_SPEC,
+ )
+ #update the plotter
+ self.plotter.update()
+
+ def get_actual_rate(self): return 1.0*self[SAMPLE_RATE_KEY]/self[DECIMATION_KEY]
+ def get_t_min(self): return self[T_OFF_KEY]
+ def get_t_max(self): return self[T_PER_DIV_KEY]*self[T_DIVS_KEY] + self[T_OFF_KEY]
+ def get_x_min(self): return -1*self[X_PER_DIV_KEY]*self[X_DIVS_KEY]/2.0 + self[X_OFF_KEY]
+ def get_x_max(self): return self[X_PER_DIV_KEY]*self[X_DIVS_KEY]/2.0 + self[X_OFF_KEY]
+ def get_y_min(self): return -1*self[Y_PER_DIV_KEY]*self[Y_DIVS_KEY]/2.0 + self[Y_OFF_KEY]
+ def get_y_max(self): return self[Y_PER_DIV_KEY]*self[Y_DIVS_KEY]/2.0 + self[Y_OFF_KEY]
+
+ def update_grid(self, *args):
+ """
+ Update the grid to reflect the current settings:
+ xy divisions, xy offset, xy mode setting
+ """
+ if self[T_FRAC_OFF_KEY] < 0: self[T_FRAC_OFF_KEY] = 0; return
+ if self[T_FRAC_OFF_KEY] > 1: self[T_FRAC_OFF_KEY] = 1; return
+ if self[XY_MODE_KEY]:
+ #update the x axis
+ self.plotter.set_x_label('Ch%d'%(self[X_CHANNEL_KEY]+1))
+ self.plotter.set_x_grid(self.get_x_min(), self.get_x_max(), self[X_PER_DIV_KEY])
+ #update the y axis
+ self.plotter.set_y_label('Ch%d'%(self[Y_CHANNEL_KEY]+1))
+ self.plotter.set_y_grid(self.get_y_min(), self.get_y_max(), self[Y_PER_DIV_KEY])
+ else:
+ #update the t axis
+ self.plotter.set_x_label('Time', 's')
+ self.plotter.set_x_grid(self.get_t_min(), self.get_t_max(), self[T_PER_DIV_KEY], True)
+ #update the y axis
+ self.plotter.set_y_label(self[Y_AXIS_LABEL])
+ self.plotter.set_y_grid(self.get_y_min(), self.get_y_max(), self[Y_PER_DIV_KEY])
+ #redraw current sample
+ self.handle_samples()
+
diff --git a/gr-wxgui/src/python/scopesink2.py b/gr-wxgui/src/python/scopesink2.py
new file mode 100644
index 000000000..99e268895
--- /dev/null
+++ b/gr-wxgui/src/python/scopesink2.py
@@ -0,0 +1,41 @@
+#
+# Copyright 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 gnuradio import gr
+
+p = gr.prefs()
+style = p.get_string('wxgui', 'style', 'auto')
+
+if style == 'auto' or style == 'gl':
+ try:
+ import wx.glcanvas
+ from OpenGL.GL import *
+ from scopesink_gl import scope_sink_f, scope_sink_c
+ except ImportError:
+ if style == 'gl':
+ raise RuntimeError("Unable to import OpenGL. Are Python wrappers for OpenGL installed?")
+ else:
+ # Fall backto non-gl sinks
+ from scopesink_nongl import scope_sink_f, scope_sink_c
+elif style == 'nongl':
+ from scopesink_nongl import scope_sink_f, scope_sink_c
+else:
+ raise RuntimeError("Unknown wxgui style")
diff --git a/gr-wxgui/src/python/scopesink_gl.py b/gr-wxgui/src/python/scopesink_gl.py
new file mode 100644
index 000000000..e6ff532e7
--- /dev/null
+++ b/gr-wxgui/src/python/scopesink_gl.py
@@ -0,0 +1,233 @@
+#
+# 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.
+#
+
+##################################################
+# Imports
+##################################################
+import scope_window
+import common
+from gnuradio import gr
+from pubsub import pubsub
+from constants import *
+import math
+
+class ac_couple_block(gr.hier_block2):
+ """
+ AC couple the incoming stream by subtracting out the low pass signal.
+ Mute the low pass filter to disable ac coupling.
+ """
+
+ def __init__(self, controller, ac_couple_key, sample_rate_key):
+ gr.hier_block2.__init__(
+ self,
+ "ac_couple",
+ gr.io_signature(1, 1, gr.sizeof_float),
+ gr.io_signature(1, 1, gr.sizeof_float),
+ )
+ #blocks
+ lpf = gr.single_pole_iir_filter_ff(0.0)
+ sub = gr.sub_ff()
+ mute = gr.mute_ff()
+ #connect
+ self.connect(self, sub, self)
+ self.connect(self, lpf, mute, (sub, 1))
+ #subscribe
+ controller.subscribe(ac_couple_key, lambda x: mute.set_mute(not x))
+ controller.subscribe(sample_rate_key, lambda x: lpf.set_taps(0.05))
+ #initialize
+ controller[ac_couple_key] = controller[ac_couple_key]
+ controller[sample_rate_key] = controller[sample_rate_key]
+
+##################################################
+# Scope sink block (wrapper for old wxgui)
+##################################################
+class _scope_sink_base(gr.hier_block2, common.wxgui_hb):
+ """
+ A scope block with a gui window.
+ """
+
+ def __init__(
+ self,
+ parent,
+ title='',
+ sample_rate=1,
+ size=scope_window.DEFAULT_WIN_SIZE,
+ v_scale=0,
+ t_scale=0,
+ v_offset=0,
+ xy_mode=False,
+ ac_couple=False,
+ num_inputs=1,
+ trig_mode=scope_window.DEFAULT_TRIG_MODE,
+ y_axis_label='Counts',
+ frame_rate=scope_window.DEFAULT_FRAME_RATE,
+ use_persistence=False,
+ persist_alpha=None,
+ **kwargs #do not end with a comma
+ ):
+ #ensure analog alpha
+ if persist_alpha is None:
+ actual_frame_rate=float(frame_rate)
+ analog_cutoff_freq=0.5 # Hertz
+ #calculate alpha from wanted cutoff freq
+ persist_alpha = 1.0 - math.exp(-2.0*math.pi*analog_cutoff_freq/actual_frame_rate)
+
+ if not t_scale: t_scale = 10.0/sample_rate
+ #init
+ gr.hier_block2.__init__(
+ self,
+ "scope_sink",
+ gr.io_signature(num_inputs, num_inputs, self._item_size),
+ gr.io_signature(0, 0, 0),
+ )
+ #scope
+ msgq = gr.msg_queue(2)
+ scope = gr.oscope_sink_f(sample_rate, msgq)
+ #controller
+ self.controller = pubsub()
+ self.controller.subscribe(SAMPLE_RATE_KEY, scope.set_sample_rate)
+ self.controller.publish(SAMPLE_RATE_KEY, scope.sample_rate)
+ self.controller.subscribe(DECIMATION_KEY, scope.set_decimation_count)
+ self.controller.publish(DECIMATION_KEY, scope.get_decimation_count)
+ self.controller.subscribe(TRIGGER_LEVEL_KEY, scope.set_trigger_level)
+ self.controller.publish(TRIGGER_LEVEL_KEY, scope.get_trigger_level)
+ self.controller.subscribe(TRIGGER_MODE_KEY, scope.set_trigger_mode)
+ self.controller.publish(TRIGGER_MODE_KEY, scope.get_trigger_mode)
+ self.controller.subscribe(TRIGGER_SLOPE_KEY, scope.set_trigger_slope)
+ self.controller.publish(TRIGGER_SLOPE_KEY, scope.get_trigger_slope)
+ self.controller.subscribe(TRIGGER_CHANNEL_KEY, scope.set_trigger_channel)
+ self.controller.publish(TRIGGER_CHANNEL_KEY, scope.get_trigger_channel)
+ actual_num_inputs = self._real and num_inputs or num_inputs*2
+ #init ac couple
+ for i in range(actual_num_inputs):
+ self.controller[common.index_key(AC_COUPLE_KEY, i)] = ac_couple
+ #start input watcher
+ common.input_watcher(msgq, self.controller, MSG_KEY)
+ #create window
+ self.win = scope_window.scope_window(
+ parent=parent,
+ controller=self.controller,
+ size=size,
+ title=title,
+ frame_rate=frame_rate,
+ num_inputs=actual_num_inputs,
+ sample_rate_key=SAMPLE_RATE_KEY,
+ t_scale=t_scale,
+ v_scale=v_scale,
+ v_offset=v_offset,
+ xy_mode=xy_mode,
+ trig_mode=trig_mode,
+ y_axis_label=y_axis_label,
+ ac_couple_key=AC_COUPLE_KEY,
+ trigger_level_key=TRIGGER_LEVEL_KEY,
+ trigger_mode_key=TRIGGER_MODE_KEY,
+ trigger_slope_key=TRIGGER_SLOPE_KEY,
+ trigger_channel_key=TRIGGER_CHANNEL_KEY,
+ decimation_key=DECIMATION_KEY,
+ msg_key=MSG_KEY,
+ use_persistence=use_persistence,
+ persist_alpha=persist_alpha,
+ )
+ common.register_access_methods(self, self.win)
+ #connect
+ if self._real:
+ for i in range(num_inputs):
+ self.wxgui_connect(
+ (self, i),
+ ac_couple_block(self.controller, common.index_key(AC_COUPLE_KEY, i), SAMPLE_RATE_KEY),
+ (scope, i),
+ )
+ else:
+ for i in range(num_inputs):
+ c2f = gr.complex_to_float()
+ self.wxgui_connect((self, i), c2f)
+ for j in range(2):
+ self.connect(
+ (c2f, j),
+ ac_couple_block(self.controller, common.index_key(AC_COUPLE_KEY, 2*i+j), SAMPLE_RATE_KEY),
+ (scope, 2*i+j),
+ )
+
+class scope_sink_f(_scope_sink_base):
+ _item_size = gr.sizeof_float
+ _real = True
+
+class scope_sink_c(_scope_sink_base):
+ _item_size = gr.sizeof_gr_complex
+ _real = False
+
+# ----------------------------------------------------------------
+# Stand-alone test application
+# ----------------------------------------------------------------
+
+import wx
+from gnuradio.wxgui import stdgui2
+
+class test_top_block (stdgui2.std_top_block):
+ def __init__(self, frame, panel, vbox, argv):
+ stdgui2.std_top_block.__init__ (self, frame, panel, vbox, argv)
+
+ default_input_rate = 1e6
+ if len(argv) > 1:
+ input_rate = int(argv[1])
+ else:
+ input_rate = default_input_rate
+
+ if len(argv) > 2:
+ v_scale = float(argv[2]) # start up at this v_scale value
+ else:
+ v_scale = None # start up in autorange mode, default
+
+ if len(argv) > 3:
+ t_scale = float(argv[3]) # start up at this t_scale value
+ else:
+ t_scale = .00003*default_input_rate/input_rate # old behavior
+
+ print "input rate %s v_scale %s t_scale %s" % (input_rate,v_scale,t_scale)
+
+
+ # Generate a complex sinusoid
+ ampl=1.0e3
+ self.src0 = gr.sig_source_c (input_rate, gr.GR_SIN_WAVE, 25.1e3*input_rate/default_input_rate, ampl)
+ self.noise =gr.sig_source_c (input_rate, gr.GR_SIN_WAVE, 11.1*25.1e3*input_rate/default_input_rate, ampl/10)
+ #self.noise =gr.noise_source_c(gr.GR_GAUSSIAN, ampl/10)
+ self.combine=gr.add_cc()
+
+ # We add this throttle block so that this demo doesn't suck down
+ # all the CPU available. You normally wouldn't use it...
+ self.thr = gr.throttle(gr.sizeof_gr_complex, input_rate)
+
+ scope = scope_sink_c (panel,"Secret Data",sample_rate=input_rate,
+ v_scale=v_scale, t_scale=t_scale)
+ vbox.Add (scope.win, 1, wx.EXPAND)
+
+ # Ultimately this will be
+ # self.connect("src0 throttle scope")
+ self.connect(self.src0,(self.combine,0))
+ self.connect(self.noise,(self.combine,1))
+ self.connect(self.combine, self.thr, scope)
+
+def main ():
+ app = stdgui2.stdapp (test_top_block, "O'Scope Test App")
+ app.MainLoop ()
+
+if __name__ == '__main__':
+ main ()
diff --git a/gr-wxgui/src/python/scopesink_nongl.py b/gr-wxgui/src/python/scopesink_nongl.py
new file mode 100644
index 000000000..d45e79906
--- /dev/null
+++ b/gr-wxgui/src/python/scopesink_nongl.py
@@ -0,0 +1,651 @@
+#!/usr/bin/env python
+#
+# Copyright 2003,2004,2006,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.
+#
+
+from gnuradio import gr, gru, eng_notation
+from gnuradio.wxgui import stdgui2
+import wx
+import gnuradio.wxgui.plot as plot
+import numpy
+import struct
+
+default_scopesink_size = (640, 240)
+default_v_scale = 1000
+default_frame_decim = gr.prefs().get_long('wxgui', 'frame_decim', 1)
+
+class scope_sink_f(gr.hier_block2):
+ def __init__(self, parent, title='', sample_rate=1,
+ size=default_scopesink_size, frame_decim=default_frame_decim,
+ v_scale=default_v_scale, t_scale=None, num_inputs=1, **kwargs):
+
+ gr.hier_block2.__init__(self, "scope_sink_f",
+ gr.io_signature(num_inputs, num_inputs, gr.sizeof_float),
+ gr.io_signature(0,0,0))
+
+ msgq = gr.msg_queue(2) # message queue that holds at most 2 messages
+ self.guts = gr.oscope_sink_f(sample_rate, msgq)
+ for i in range(num_inputs):
+ self.connect((self, i), (self.guts, i))
+
+ self.win = scope_window(win_info (msgq, sample_rate, frame_decim,
+ v_scale, t_scale, self.guts, title), parent)
+
+ def set_sample_rate(self, sample_rate):
+ self.guts.set_sample_rate(sample_rate)
+ self.win.info.set_sample_rate(sample_rate)
+
+class scope_sink_c(gr.hier_block2):
+ def __init__(self, parent, title='', sample_rate=1,
+ size=default_scopesink_size, frame_decim=default_frame_decim,
+ v_scale=default_v_scale, t_scale=None, num_inputs=1, xy_mode=False, **kwargs):
+
+ gr.hier_block2.__init__(self, "scope_sink_c",
+ gr.io_signature(num_inputs, num_inputs, gr.sizeof_gr_complex),
+ gr.io_signature(0,0,0))
+
+ msgq = gr.msg_queue(2) # message queue that holds at most 2 messages
+ self.guts = gr.oscope_sink_f(sample_rate, msgq)
+ for i in range(num_inputs):
+ c2f = gr.complex_to_float()
+ self.connect((self, i), c2f)
+ self.connect((c2f, 0), (self.guts, 2*i+0))
+ self.connect((c2f, 1), (self.guts, 2*i+1))
+
+ self.win = scope_window(win_info(msgq, sample_rate, frame_decim,
+ v_scale, t_scale, self.guts, title), parent)
+ self.win.info.xy = xy_mode
+
+ def set_sample_rate(self, sample_rate):
+ self.guts.set_sample_rate(sample_rate)
+ self.win.info.set_sample_rate(sample_rate)
+
+class constellation_sink(scope_sink_c):
+ def __init__(self, parent, title='Constellation', sample_rate=1,
+ size=default_scopesink_size, frame_decim=default_frame_decim):
+ scope_sink_c.__init__(self, parent=parent, title=title, sample_rate=sample_rate,
+ size=size, frame_decim=frame_decim)
+ self.win.info.xy = True #constellation mode
+
+# ========================================================================
+
+
+time_base_list = [ # time / division
+ 1.0e-7, # 100ns / div
+ 2.5e-7,
+ 5.0e-7,
+ 1.0e-6, # 1us / div
+ 2.5e-6,
+ 5.0e-6,
+ 1.0e-5, # 10us / div
+ 2.5e-5,
+ 5.0e-5,
+ 1.0e-4, # 100us / div
+ 2.5e-4,
+ 5.0e-4,
+ 1.0e-3, # 1ms / div
+ 2.5e-3,
+ 5.0e-3,
+ 1.0e-2, # 10ms / div
+ 2.5e-2,
+ 5.0e-2
+ ]
+
+v_scale_list = [ # counts / div, LARGER gains are SMALLER /div, appear EARLIER
+ 2.0e-3, # 2m / div, don't call it V/div it's actually counts/div
+ 5.0e-3,
+ 1.0e-2,
+ 2.0e-2,
+ 5.0e-2,
+ 1.0e-1,
+ 2.0e-1,
+ 5.0e-1,
+ 1.0e+0,
+ 2.0e+0,
+ 5.0e+0,
+ 1.0e+1,
+ 2.0e+1,
+ 5.0e+1,
+ 1.0e+2,
+ 2.0e+2,
+ 5.0e+2,
+ 1.0e+3,
+ 2.0e+3,
+ 5.0e+3,
+ 1.0e+4 # 10000 /div, USRP full scale is -/+ 32767
+ ]
+
+
+wxDATA_EVENT = wx.NewEventType()
+
+def EVT_DATA_EVENT(win, func):
+ win.Connect(-1, -1, wxDATA_EVENT, func)
+
+class DataEvent(wx.PyEvent):
+ def __init__(self, data):
+ wx.PyEvent.__init__(self)
+ self.SetEventType (wxDATA_EVENT)
+ self.data = data
+
+ def Clone (self):
+ self.__class__ (self.GetId())
+
+
+class win_info (object):
+ __slots__ = ['msgq', 'sample_rate', 'frame_decim', 'v_scale',
+ 'scopesink', 'title',
+ 'time_scale_cursor', 'v_scale_cursor', 'marker', 'xy',
+ 'autorange', 'running']
+
+ def __init__ (self, msgq, sample_rate, frame_decim, v_scale, t_scale,
+ scopesink, title = "Oscilloscope", xy=False):
+ self.msgq = msgq
+ self.sample_rate = sample_rate
+ self.frame_decim = frame_decim
+ self.scopesink = scopesink
+ self.title = title;
+
+ self.time_scale_cursor = gru.seq_with_cursor(time_base_list, initial_value = t_scale)
+ self.v_scale_cursor = gru.seq_with_cursor(v_scale_list, initial_value = v_scale)
+
+ self.marker = 'line'
+ self.xy = xy
+ self.autorange = not v_scale
+ self.running = True
+
+ def get_time_per_div (self):
+ return self.time_scale_cursor.current ()
+
+ def get_volts_per_div (self):
+ return self.v_scale_cursor.current ()
+
+ def set_sample_rate(self, sample_rate):
+ self.sample_rate = sample_rate
+
+ def get_sample_rate (self):
+ return self.sample_rate
+
+ def get_decimation_rate (self):
+ return 1.0
+
+ def set_marker (self, s):
+ self.marker = s
+
+ def get_marker (self):
+ return self.marker
+
+
+class input_watcher (gru.msgq_runner):
+ def __init__ (self, msgq, event_receiver, frame_decim, **kwds):
+ self.event_receiver = event_receiver
+ self.frame_decim = frame_decim
+ self.iscan = 0
+ gru.msgq_runner.__init__(self, msgq, self.handle_msg)
+
+ def handle_msg(self, msg):
+ if self.iscan == 0: # only display at frame_decim
+ self.iscan = self.frame_decim
+
+ nchan = int(msg.arg1()) # number of channels of data in msg
+ nsamples = int(msg.arg2()) # number of samples in each channel
+
+ s = msg.to_string() # get the body of the msg as a string
+
+ bytes_per_chan = nsamples * gr.sizeof_float
+
+ records = []
+ for ch in range (nchan):
+
+ start = ch * bytes_per_chan
+ chan_data = s[start:start+bytes_per_chan]
+ rec = numpy.fromstring (chan_data, numpy.float32)
+ records.append (rec)
+
+ # print "nrecords = %d, reclen = %d" % (len (records),nsamples)
+
+ de = DataEvent (records)
+ wx.PostEvent (self.event_receiver, de)
+ records = []
+ del de
+
+ self.iscan -= 1
+
+
+class scope_window (wx.Panel):
+
+ def __init__ (self, info, parent, id = -1,
+ pos = wx.DefaultPosition, size = wx.DefaultSize, name = ""):
+ wx.Panel.__init__ (self, parent, -1)
+ self.info = info
+
+ vbox = wx.BoxSizer (wx.VERTICAL)
+
+ self.graph = graph_window (info, self, -1)
+
+ vbox.Add (self.graph, 1, wx.EXPAND)
+ vbox.Add (self.make_control_box(), 0, wx.EXPAND)
+ vbox.Add (self.make_control2_box(), 0, wx.EXPAND)
+
+ self.sizer = vbox
+ self.SetSizer (self.sizer)
+ self.SetAutoLayout (True)
+ self.sizer.Fit (self)
+ self.set_autorange(self.info.autorange)
+
+
+ # second row of control buttons etc. appears BELOW control_box
+ def make_control2_box (self):
+ ctrlbox = wx.BoxSizer (wx.HORIZONTAL)
+
+ self.inc_v_button = wx.Button (self, 1101, " < ", style=wx.BU_EXACTFIT)
+ self.inc_v_button.SetToolTipString ("Increase vertical range")
+ wx.EVT_BUTTON (self, 1101, self.incr_v_scale) # ID matches button ID above
+
+ self.dec_v_button = wx.Button (self, 1100, " > ", style=wx.BU_EXACTFIT)
+ self.dec_v_button.SetToolTipString ("Decrease vertical range")
+ wx.EVT_BUTTON (self, 1100, self.decr_v_scale)
+
+ self.v_scale_label = wx.StaticText (self, 1002, "None") # vertical /div
+ self.update_v_scale_label ()
+
+ self.autorange_checkbox = wx.CheckBox (self, 1102, "Autorange")
+ self.autorange_checkbox.SetToolTipString ("Select autorange on/off")
+ wx.EVT_CHECKBOX(self, 1102, self.autorange_checkbox_event)
+
+ ctrlbox.Add ((5,0) ,0) # left margin space
+ ctrlbox.Add (self.inc_v_button, 0, wx.EXPAND)
+ ctrlbox.Add (self.dec_v_button, 0, wx.EXPAND)
+ ctrlbox.Add (self.v_scale_label, 0, wx.ALIGN_CENTER)
+ ctrlbox.Add ((20,0) ,0) # spacer
+ ctrlbox.Add (self.autorange_checkbox, 0, wx.ALIGN_CENTER)
+
+ return ctrlbox
+
+ def make_control_box (self):
+ ctrlbox = wx.BoxSizer (wx.HORIZONTAL)
+
+ tb_left = wx.Button (self, 1001, " < ", style=wx.BU_EXACTFIT)
+ tb_left.SetToolTipString ("Increase time base")
+ wx.EVT_BUTTON (self, 1001, self.incr_timebase)
+
+
+ tb_right = wx.Button (self, 1000, " > ", style=wx.BU_EXACTFIT)
+ tb_right.SetToolTipString ("Decrease time base")
+ wx.EVT_BUTTON (self, 1000, self.decr_timebase)
+
+ self.time_base_label = wx.StaticText (self, 1002, "")
+ self.update_timebase_label ()
+
+ ctrlbox.Add ((5,0) ,0)
+ # ctrlbox.Add (wx.StaticText (self, -1, "Horiz Scale: "), 0, wx.ALIGN_CENTER)
+ ctrlbox.Add (tb_left, 0, wx.EXPAND)
+ ctrlbox.Add (tb_right, 0, wx.EXPAND)
+ ctrlbox.Add (self.time_base_label, 0, wx.ALIGN_CENTER)
+
+ ctrlbox.Add ((10,0) ,1) # stretchy space
+
+ ctrlbox.Add (wx.StaticText (self, -1, "Trig: "), 0, wx.ALIGN_CENTER)
+ self.trig_chan_choice = wx.Choice (self, 1004,
+ choices = ['Ch1', 'Ch2', 'Ch3', 'Ch4'])
+ self.trig_chan_choice.SetToolTipString ("Select channel for trigger")
+ wx.EVT_CHOICE (self, 1004, self.trig_chan_choice_event)
+ ctrlbox.Add (self.trig_chan_choice, 0, wx.ALIGN_CENTER)
+
+ self.trig_mode_choice = wx.Choice (self, 1005,
+ choices = ['Free', 'Auto', 'Norm'])
+ self.trig_mode_choice.SetSelection(1)
+ self.trig_mode_choice.SetToolTipString ("Select trigger slope or Auto (untriggered roll)")
+ wx.EVT_CHOICE (self, 1005, self.trig_mode_choice_event)
+ ctrlbox.Add (self.trig_mode_choice, 0, wx.ALIGN_CENTER)
+
+ trig_level50 = wx.Button (self, 1006, "50%")
+ trig_level50.SetToolTipString ("Set trigger level to 50%")
+ wx.EVT_BUTTON (self, 1006, self.set_trig_level50)
+ ctrlbox.Add (trig_level50, 0, wx.EXPAND)
+
+ run_stop = wx.Button (self, 1007, "Run/Stop")
+ run_stop.SetToolTipString ("Toggle Run/Stop mode")
+ wx.EVT_BUTTON (self, 1007, self.run_stop)
+ ctrlbox.Add (run_stop, 0, wx.EXPAND)
+
+ ctrlbox.Add ((10, 0) ,1) # stretchy space
+
+ ctrlbox.Add (wx.StaticText (self, -1, "Fmt: "), 0, wx.ALIGN_CENTER)
+ self.marker_choice = wx.Choice (self, 1002, choices = self._marker_choices)
+ self.marker_choice.SetToolTipString ("Select plotting with lines, pluses or dots")
+ wx.EVT_CHOICE (self, 1002, self.marker_choice_event)
+ ctrlbox.Add (self.marker_choice, 0, wx.ALIGN_CENTER)
+
+ self.xy_choice = wx.Choice (self, 1003, choices = ['X:t', 'X:Y'])
+ self.xy_choice.SetToolTipString ("Select X vs time or X vs Y display")
+ wx.EVT_CHOICE (self, 1003, self.xy_choice_event)
+ ctrlbox.Add (self.xy_choice, 0, wx.ALIGN_CENTER)
+
+ return ctrlbox
+
+ _marker_choices = ['line', 'plus', 'dot']
+
+ def update_timebase_label (self):
+ time_per_div = self.info.get_time_per_div ()
+ s = ' ' + eng_notation.num_to_str (time_per_div) + 's/div'
+ self.time_base_label.SetLabel (s)
+
+ def decr_timebase (self, evt):
+ self.info.time_scale_cursor.prev ()
+ self.update_timebase_label ()
+
+ def incr_timebase (self, evt):
+ self.info.time_scale_cursor.next ()
+ self.update_timebase_label ()
+
+ def update_v_scale_label (self):
+ volts_per_div = self.info.get_volts_per_div ()
+ s = ' ' + eng_notation.num_to_str (volts_per_div) + '/div' # Not V/div
+ self.v_scale_label.SetLabel (s)
+
+ def decr_v_scale (self, evt):
+ self.info.v_scale_cursor.prev ()
+ self.update_v_scale_label ()
+
+ def incr_v_scale (self, evt):
+ self.info.v_scale_cursor.next ()
+ self.update_v_scale_label ()
+
+ def marker_choice_event (self, evt):
+ s = evt.GetString ()
+ self.set_marker (s)
+
+ def set_autorange(self, on):
+ if on:
+ self.v_scale_label.SetLabel(" (auto)")
+ self.info.autorange = True
+ self.autorange_checkbox.SetValue(True)
+ self.inc_v_button.Enable(False)
+ self.dec_v_button.Enable(False)
+ else:
+ if self.graph.y_range:
+ (l,u) = self.graph.y_range # found by autorange
+ self.info.v_scale_cursor.set_index_by_value((u-l)/8.0)
+ self.update_v_scale_label()
+ self.info.autorange = False
+ self.autorange_checkbox.SetValue(False)
+ self.inc_v_button.Enable(True)
+ self.dec_v_button.Enable(True)
+
+ def autorange_checkbox_event(self, evt):
+ if evt.Checked():
+ self.set_autorange(True)
+ else:
+ self.set_autorange(False)
+
+ def set_marker (self, s):
+ self.info.set_marker (s) # set info for drawing routines
+ i = self.marker_choice.FindString (s)
+ assert i >= 0, "Hmmm, set_marker problem"
+ self.marker_choice.SetSelection (i)
+
+ def set_format_line (self):
+ self.set_marker ('line')
+
+ def set_format_dot (self):
+ self.set_marker ('dot')
+
+ def set_format_plus (self):
+ self.set_marker ('plus')
+
+ def xy_choice_event (self, evt):
+ s = evt.GetString ()
+ self.info.xy = s == 'X:Y'
+
+ def trig_chan_choice_event (self, evt):
+ s = evt.GetString ()
+ ch = int (s[-1]) - 1
+ self.info.scopesink.set_trigger_channel (ch)
+
+ def trig_mode_choice_event (self, evt):
+ sink = self.info.scopesink
+ s = evt.GetString ()
+ if s == 'Norm':
+ sink.set_trigger_mode (gr.gr_TRIG_MODE_NORM)
+ elif s == 'Auto':
+ sink.set_trigger_mode (gr.gr_TRIG_MODE_AUTO)
+ elif s == 'Free':
+ sink.set_trigger_mode (gr.gr_TRIG_MODE_FREE)
+ else:
+ assert 0, "Bad trig_mode_choice string"
+
+ def set_trig_level50 (self, evt):
+ self.info.scopesink.set_trigger_level_auto ()
+
+ def run_stop (self, evt):
+ self.info.running = not self.info.running
+
+
+class graph_window (plot.PlotCanvas):
+
+ channel_colors = ['BLUE', 'RED',
+ 'CYAN', 'MAGENTA', 'GREEN', 'YELLOW']
+
+ def __init__ (self, info, parent, id = -1,
+ pos = wx.DefaultPosition, size = (640, 240),
+ style = wx.DEFAULT_FRAME_STYLE, name = ""):
+ plot.PlotCanvas.__init__ (self, parent, id, pos, size, style, name)
+
+ self.SetXUseScopeTicks (True)
+ self.SetEnableGrid (True)
+ self.SetEnableZoom (True)
+ self.SetEnableLegend(True)
+ # self.SetBackgroundColour ('black')
+
+ self.info = info;
+ self.y_range = None
+ self.x_range = None
+ self.avg_y_min = None
+ self.avg_y_max = None
+ self.avg_x_min = None
+ self.avg_x_max = None
+
+ EVT_DATA_EVENT (self, self.format_data)
+
+ self.input_watcher = input_watcher (info.msgq, self, info.frame_decim)
+
+ def channel_color (self, ch):
+ return self.channel_colors[ch % len(self.channel_colors)]
+
+ def format_data (self, evt):
+ if not self.info.running:
+ return
+
+ if self.info.xy:
+ self.format_xy_data (evt)
+ return
+
+ info = self.info
+ records = evt.data
+ nchannels = len (records)
+ npoints = len (records[0])
+
+ objects = []
+
+ Ts = 1.0 / (info.get_sample_rate () / info.get_decimation_rate ())
+ x_vals = Ts * numpy.arange (-npoints/2, npoints/2)
+
+ # preliminary clipping based on time axis here, instead of in graphics code
+ time_per_window = self.info.get_time_per_div () * 10
+ n = int (time_per_window / Ts + 0.5)
+ n = n & ~0x1 # make even
+ n = max (2, min (n, npoints))
+
+ self.SetXUseScopeTicks (True) # use 10 divisions, no labels
+
+ for ch in range(nchannels):
+ r = records[ch]
+
+ # plot middle n points of record
+
+ lb = npoints/2 - n/2
+ ub = npoints/2 + n/2
+ # points = zip (x_vals[lb:ub], r[lb:ub])
+ points = numpy.zeros ((ub-lb, 2), numpy.float64)
+ points[:,0] = x_vals[lb:ub]
+ points[:,1] = r[lb:ub]
+
+ m = info.get_marker ()
+ if m == 'line':
+ objects.append (plot.PolyLine (points,
+ colour=self.channel_color (ch),
+ legend=('Ch%d' % (ch+1,))))
+ else:
+ objects.append (plot.PolyMarker (points,
+ marker=m,
+ colour=self.channel_color (ch),
+ legend=('Ch%d' % (ch+1,))))
+
+ graphics = plot.PlotGraphics (objects,
+ title=self.info.title,
+ xLabel = '', yLabel = '')
+
+ time_per_div = info.get_time_per_div ()
+ x_range = (-5.0 * time_per_div, 5.0 * time_per_div) # ranges are tuples!
+ volts_per_div = info.get_volts_per_div ()
+ if not self.info.autorange:
+ self.y_range = (-4.0 * volts_per_div, 4.0 * volts_per_div)
+ self.Draw (graphics, xAxis=x_range, yAxis=self.y_range)
+ self.update_y_range () # autorange to self.y_range
+
+
+ def format_xy_data (self, evt):
+ info = self.info
+ records = evt.data
+ nchannels = len (records)
+ npoints = len (records[0])
+
+ if nchannels < 2:
+ return
+
+ objects = []
+ # points = zip (records[0], records[1])
+ points = numpy.zeros ((len(records[0]), 2), numpy.float32)
+ points[:,0] = records[0]
+ points[:,1] = records[1]
+
+ self.SetXUseScopeTicks (False)
+
+ m = info.get_marker ()
+ if m == 'line':
+ objects.append (plot.PolyLine (points,
+ colour=self.channel_color (0)))
+ else:
+ objects.append (plot.PolyMarker (points,
+ marker=m,
+ colour=self.channel_color (0)))
+
+ graphics = plot.PlotGraphics (objects,
+ title=self.info.title,
+ xLabel = 'I', yLabel = 'Q')
+
+ self.Draw (graphics, xAxis=self.x_range, yAxis=self.y_range)
+ self.update_y_range ()
+ self.update_x_range ()
+
+
+ def update_y_range (self):
+ alpha = 1.0/25
+ graphics = self.last_draw[0]
+ p1, p2 = graphics.boundingBox () # min, max points of graphics
+
+ if self.avg_y_min: # prevent vertical scale from jumping abruptly --?
+ self.avg_y_min = p1[1] * alpha + self.avg_y_min * (1 - alpha)
+ self.avg_y_max = p2[1] * alpha + self.avg_y_max * (1 - alpha)
+ else: # initial guess
+ self.avg_y_min = p1[1] # -500.0 workaround, sometimes p1 is ~ 10^35
+ self.avg_y_max = p2[1] # 500.0
+
+ self.y_range = self._axisInterval ('auto', self.avg_y_min, self.avg_y_max)
+ # print "p1 %s p2 %s y_min %s y_max %s y_range %s" \
+ # % (p1, p2, self.avg_y_min, self.avg_y_max, self.y_range)
+
+
+ def update_x_range (self):
+ alpha = 1.0/25
+ graphics = self.last_draw[0]
+ p1, p2 = graphics.boundingBox () # min, max points of graphics
+
+ if self.avg_x_min:
+ self.avg_x_min = p1[0] * alpha + self.avg_x_min * (1 - alpha)
+ self.avg_x_max = p2[0] * alpha + self.avg_x_max * (1 - alpha)
+ else:
+ self.avg_x_min = p1[0]
+ self.avg_x_max = p2[0]
+
+ self.x_range = self._axisInterval ('auto', self.avg_x_min, self.avg_x_max)
+
+
+# ----------------------------------------------------------------
+# Stand-alone test application
+# ----------------------------------------------------------------
+
+class test_top_block (stdgui2.std_top_block):
+ def __init__(self, frame, panel, vbox, argv):
+ stdgui2.std_top_block.__init__ (self, frame, panel, vbox, argv)
+
+ if len(argv) > 1:
+ frame_decim = int(argv[1])
+ else:
+ frame_decim = 1
+
+ if len(argv) > 2:
+ v_scale = float(argv[2]) # start up at this v_scale value
+ else:
+ v_scale = None # start up in autorange mode, default
+
+ if len(argv) > 3:
+ t_scale = float(argv[3]) # start up at this t_scale value
+ else:
+ t_scale = None # old behavior
+
+ print "frame decim %s v_scale %s t_scale %s" % (frame_decim,v_scale,t_scale)
+
+ input_rate = 1e6
+
+ # Generate a complex sinusoid
+ self.src0 = gr.sig_source_c (input_rate, gr.GR_SIN_WAVE, 25.1e3, 1e3)
+
+ # We add this throttle block so that this demo doesn't suck down
+ # all the CPU available. You normally wouldn't use it...
+ self.thr = gr.throttle(gr.sizeof_gr_complex, input_rate)
+
+ scope = scope_sink_c (panel,"Secret Data",sample_rate=input_rate,
+ frame_decim=frame_decim,
+ v_scale=v_scale, t_scale=t_scale)
+ vbox.Add (scope.win, 1, wx.EXPAND)
+
+ # Ultimately this will be
+ # self.connect("src0 throttle scope")
+ self.connect(self.src0, self.thr, scope)
+
+def main ():
+ app = stdgui2.stdapp (test_top_block, "O'Scope Test App")
+ app.MainLoop ()
+
+if __name__ == '__main__':
+ main ()
+
+# ----------------------------------------------------------------
diff --git a/gr-wxgui/src/python/slider.py b/gr-wxgui/src/python/slider.py
new file mode 100644
index 000000000..e8cdcfcac
--- /dev/null
+++ b/gr-wxgui/src/python/slider.py
@@ -0,0 +1,49 @@
+#!/usr/bin/env python
+
+import wx
+
+def slider(parent, min, max, callback):
+ """
+ Return a wx.Slider object.
+
+ @param min: minimum slider value
+ @type min: float
+ @param max: maximum slider value
+ @type max: float
+ @param callback: function of one arg invoked when slider moves.
+ @rtype: wx.Slider
+ """
+ new_id = wx.NewId()
+ s = wx.Slider(parent, new_id, (max+min)/2, min, max, wx.DefaultPosition,
+ wx.Size(250,-1), wx.SL_HORIZONTAL | wx.SL_LABELS)
+ wx.EVT_COMMAND_SCROLL(parent, new_id,
+ lambda evt : callback(evt.GetInt()))
+ return s
+
+
+# ----------------------------------------------------------------
+# Demo app
+# ----------------------------------------------------------------
+if __name__ == '__main__':
+
+ from gnuradio.wxgui import stdgui
+
+ class demo_graph(stdgui.gui_flow_graph):
+
+ def __init__(self, frame, panel, vbox, argv):
+ stdgui.gui_flow_graph.__init__ (self, frame, panel, vbox, argv)
+
+ vbox.Add(slider(panel, 23, 47, self.my_callback1), 1, wx.ALIGN_CENTER)
+ vbox.Add(slider(panel, -100, 100, self.my_callback2), 1, wx.ALIGN_CENTER)
+
+ def my_callback1(self, val):
+ print "cb1 = ", val
+
+ def my_callback2(self, val):
+ print "cb2 = ", val
+
+ def main ():
+ app = stdgui.stdapp (demo_graph, "Slider Demo")
+ app.MainLoop ()
+
+ main ()
diff --git a/gr-wxgui/src/python/stdgui2.py b/gr-wxgui/src/python/stdgui2.py
new file mode 100644
index 000000000..71436d72c
--- /dev/null
+++ b/gr-wxgui/src/python/stdgui2.py
@@ -0,0 +1,100 @@
+#
+# 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.
+#
+
+'''A simple wx gui for GNU Radio applications'''
+
+import wx
+import sys
+from gnuradio import gr
+
+
+class stdapp (wx.App):
+ def __init__ (self, top_block_maker, title="GNU Radio", nstatus=2,
+ max_noutput_items=None):
+ self.top_block_maker = top_block_maker
+ self.title = title
+ self._nstatus = nstatus
+ self._max_noutput_items = max_noutput_items
+ # All our initialization must come before calling wx.App.__init__.
+ # OnInit is called from somewhere in the guts of __init__.
+ wx.App.__init__ (self, redirect=False)
+
+ def OnInit (self):
+ frame = stdframe (self.top_block_maker, self.title, self._nstatus,
+ self._max_noutput_items)
+ frame.Show (True)
+ self.SetTopWindow (frame)
+ return True
+
+
+class stdframe (wx.Frame):
+ def __init__ (self, top_block_maker, title="GNU Radio", nstatus=2,
+ max_nouts=None):
+ # print "stdframe.__init__"
+ wx.Frame.__init__(self, None, -1, title)
+
+ self.CreateStatusBar (nstatus)
+ mainmenu = wx.MenuBar ()
+
+ menu = wx.Menu ()
+ item = menu.Append (200, 'E&xit', 'Exit')
+ self.Bind (wx.EVT_MENU, self.OnCloseWindow, item)
+ mainmenu.Append (menu, "&File")
+ self.SetMenuBar (mainmenu)
+
+ self.Bind (wx.EVT_CLOSE, self.OnCloseWindow)
+ self.panel = stdpanel (self, self, top_block_maker, max_nouts)
+ vbox = wx.BoxSizer(wx.VERTICAL)
+ vbox.Add(self.panel, 1, wx.EXPAND)
+ self.SetSizer(vbox)
+ self.SetAutoLayout(True)
+ vbox.Fit(self)
+
+ def OnCloseWindow (self, event):
+ self.top_block().stop()
+ self.Destroy ()
+
+ def top_block (self):
+ return self.panel.top_block
+
+class stdpanel (wx.Panel):
+ def __init__ (self, parent, frame, top_block_maker,
+ max_nouts=None):
+ # print "stdpanel.__init__"
+ wx.Panel.__init__ (self, parent, -1)
+ self.frame = frame
+
+ vbox = wx.BoxSizer (wx.VERTICAL)
+ self.top_block = top_block_maker (frame, self, vbox, sys.argv)
+ self.SetSizer (vbox)
+ self.SetAutoLayout (True)
+ vbox.Fit (self)
+
+ if(max_nouts is not None):
+ self.top_block.start (max_nouts)
+ else:
+ self.top_block.start ()
+
+class std_top_block (gr.top_block):
+ def __init__ (self, parent, panel, vbox, argv):
+ # Call the hier_block2 constructor
+ # Top blocks have no inputs and outputs
+ gr.top_block.__init__(self, "std_top_block")
diff --git a/gr-wxgui/src/python/termsink.py b/gr-wxgui/src/python/termsink.py
new file mode 100644
index 000000000..a0cfd575d
--- /dev/null
+++ b/gr-wxgui/src/python/termsink.py
@@ -0,0 +1,77 @@
+#
+# 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.
+#
+
+from gnuradio import gru
+import wx
+
+DEFAULT_WIN_SIZE = (600, 300)
+APPEND_EVENT = wx.NewEventType()
+EVT_APPEND_EVENT = wx.PyEventBinder(APPEND_EVENT, 0)
+
+class AppendEvent(wx.PyEvent):
+ def __init__(self, text):
+ wx.PyEvent.__init__(self)
+ self.SetEventType(APPEND_EVENT)
+ self.text = text
+
+ def Clone(self):
+ self.__class__(self.GetId())
+
+class termsink(wx.Panel):
+ def __init__(self,
+ parent,
+ msgq,
+ size=DEFAULT_WIN_SIZE,
+ ):
+
+ wx.Panel.__init__(self,
+ parent,
+ size=size,
+ style=wx.SIMPLE_BORDER,
+ )
+
+ self.text_ctrl = wx.TextCtrl(self,
+ wx.ID_ANY,
+ value="",
+ size=size,
+ style=wx.TE_MULTILINE|wx.TE_READONLY,
+ )
+
+ main_sizer = wx.BoxSizer(wx.VERTICAL)
+ main_sizer.Add(self.text_ctrl, 1, wx.EXPAND)
+ self.SetSizerAndFit(main_sizer)
+
+ EVT_APPEND_EVENT(self, self.evt_append)
+ self.runner = gru.msgq_runner(msgq, self.handle_msg)
+
+ def handle_msg(self, msg):
+ # This gets called in the queue runner thread context
+ # For now, just add whatever the user sends to the text control
+ text = msg.to_string()
+
+ # Create a wxPython event and post it to the event queue
+ evt = AppendEvent(text)
+ wx.PostEvent(self, evt)
+ del evt
+
+ def evt_append(self, evt):
+ # This gets called by the wxPython event queue runner
+ self.text_ctrl.AppendText(evt.text)
diff --git a/gr-wxgui/src/python/waterfall_window.py b/gr-wxgui/src/python/waterfall_window.py
new file mode 100644
index 000000000..a190899c3
--- /dev/null
+++ b/gr-wxgui/src/python/waterfall_window.py
@@ -0,0 +1,324 @@
+#
+# 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-1`301, USA.
+#
+
+##################################################
+# Imports
+##################################################
+import plotter
+import common
+import wx
+import numpy
+import math
+import pubsub
+from constants import *
+from gnuradio import gr #for gr.prefs
+import forms
+
+##################################################
+# Constants
+##################################################
+SLIDER_STEPS = 100
+AVG_ALPHA_MIN_EXP, AVG_ALPHA_MAX_EXP = -3, 0
+DEFAULT_FRAME_RATE = gr.prefs().get_long('wxgui', 'waterfall_rate', 30)
+DEFAULT_COLOR_MODE = gr.prefs().get_string('wxgui', 'waterfall_color', 'rgb1')
+DEFAULT_WIN_SIZE = (600, 300)
+DIV_LEVELS = (1, 2, 5, 10, 20)
+MIN_DYNAMIC_RANGE, MAX_DYNAMIC_RANGE = 10, 200
+DYNAMIC_RANGE_STEP = 10.
+COLOR_MODES = (
+ ('RGB1', 'rgb1'),
+ ('RGB2', 'rgb2'),
+ ('RGB3', 'rgb3'),
+ ('Gray', 'gray'),
+)
+
+##################################################
+# Waterfall window control panel
+##################################################
+class control_panel(wx.Panel):
+ """
+ A control panel with wx widgits to control the plotter and fft block chain.
+ """
+
+ def __init__(self, parent):
+ """
+ Create a new control panel.
+ @param parent the wx parent window
+ """
+ self.parent = parent
+ wx.Panel.__init__(self, parent, style=wx.SUNKEN_BORDER)
+ parent[SHOW_CONTROL_PANEL_KEY] = True
+ parent.subscribe(SHOW_CONTROL_PANEL_KEY, self.Show)
+ control_box = wx.BoxSizer(wx.VERTICAL)
+ control_box.AddStretchSpacer()
+ options_box = forms.static_box_sizer(
+ parent=self, sizer=control_box, label='Options',
+ bold=True, orient=wx.VERTICAL,
+ )
+ #average
+ forms.check_box(
+ sizer=options_box, parent=self, label='Average',
+ ps=parent, key=AVERAGE_KEY,
+ )
+ avg_alpha_text = forms.static_text(
+ sizer=options_box, parent=self, label='Avg Alpha',
+ converter=forms.float_converter(lambda x: '%.4f'%x),
+ ps=parent, key=AVG_ALPHA_KEY, width=50,
+ )
+ avg_alpha_slider = forms.log_slider(
+ sizer=options_box, parent=self,
+ min_exp=AVG_ALPHA_MIN_EXP,
+ max_exp=AVG_ALPHA_MAX_EXP,
+ num_steps=SLIDER_STEPS,
+ ps=parent, key=AVG_ALPHA_KEY,
+ )
+ for widget in (avg_alpha_text, avg_alpha_slider):
+ parent.subscribe(AVERAGE_KEY, widget.Enable)
+ widget.Enable(parent[AVERAGE_KEY])
+ #begin axes box
+ control_box.AddStretchSpacer()
+ axes_box = forms.static_box_sizer(
+ parent=self, sizer=control_box, label='Axes Options',
+ bold=True, orient=wx.VERTICAL,
+ )
+ #num lines buttons
+ forms.incr_decr_buttons(
+ parent=self, sizer=axes_box, label='Time Scale',
+ on_incr=self._on_incr_time_scale, on_decr=self._on_decr_time_scale,
+ )
+ #dyanmic range buttons
+ forms.incr_decr_buttons(
+ parent=self, sizer=axes_box, label='Dyn Range',
+ on_incr=self._on_incr_dynamic_range, on_decr=self._on_decr_dynamic_range,
+ )
+ #ref lvl buttons
+ forms.incr_decr_buttons(
+ parent=self, sizer=axes_box, label='Ref Level',
+ on_incr=self._on_incr_ref_level, on_decr=self._on_decr_ref_level,
+ )
+ #color mode
+ forms.drop_down(
+ parent=self, sizer=axes_box, width=100,
+ ps=parent, key=COLOR_MODE_KEY, label='Color',
+ choices=map(lambda x: x[1], COLOR_MODES),
+ labels=map(lambda x: x[0], COLOR_MODES),
+ )
+ #autoscale
+ forms.single_button(
+ parent=self, sizer=axes_box, label='Autoscale',
+ callback=self.parent.autoscale,
+ )
+ #clear
+ control_box.AddStretchSpacer()
+ forms.single_button(
+ parent=self, sizer=control_box, label='Clear',
+ callback=self._on_clear_button,
+ )
+ #run/stop
+ forms.toggle_button(
+ sizer=control_box, parent=self,
+ true_label='Stop', false_label='Run',
+ ps=parent, key=RUNNING_KEY,
+ )
+ #set sizer
+ self.SetSizerAndFit(control_box)
+
+ ##################################################
+ # Event handlers
+ ##################################################
+ def _on_clear_button(self, event):
+ self.parent[NUM_LINES_KEY] = self.parent[NUM_LINES_KEY]
+ def _on_incr_dynamic_range(self, event):
+ self.parent[DYNAMIC_RANGE_KEY] = min(MAX_DYNAMIC_RANGE, common.get_clean_incr(self.parent[DYNAMIC_RANGE_KEY]))
+ def _on_decr_dynamic_range(self, event):
+ self.parent[DYNAMIC_RANGE_KEY] = max(MIN_DYNAMIC_RANGE, common.get_clean_decr(self.parent[DYNAMIC_RANGE_KEY]))
+ def _on_incr_ref_level(self, event):
+ self.parent[REF_LEVEL_KEY] = self.parent[REF_LEVEL_KEY] + self.parent[DYNAMIC_RANGE_KEY]/DYNAMIC_RANGE_STEP
+ def _on_decr_ref_level(self, event):
+ self.parent[REF_LEVEL_KEY] = self.parent[REF_LEVEL_KEY] - self.parent[DYNAMIC_RANGE_KEY]/DYNAMIC_RANGE_STEP
+ def _on_incr_time_scale(self, event):
+ old_rate = self.parent[FRAME_RATE_KEY]
+ self.parent[FRAME_RATE_KEY] *= 0.75
+ if self.parent[FRAME_RATE_KEY] < 1.0:
+ self.parent[FRAME_RATE_KEY] = 1.0
+
+ if self.parent[FRAME_RATE_KEY] == old_rate:
+ self.parent[DECIMATION_KEY] += 1
+ def _on_decr_time_scale(self, event):
+ old_rate = self.parent[FRAME_RATE_KEY]
+ self.parent[FRAME_RATE_KEY] *= 1.25
+ if self.parent[FRAME_RATE_KEY] == old_rate:
+ self.parent[DECIMATION_KEY] -= 1
+
+##################################################
+# Waterfall window with plotter and control panel
+##################################################
+class waterfall_window(wx.Panel, pubsub.pubsub):
+ def __init__(
+ self,
+ parent,
+ controller,
+ size,
+ title,
+ real,
+ fft_size,
+ num_lines,
+ decimation_key,
+ baseband_freq,
+ sample_rate_key,
+ frame_rate_key,
+ dynamic_range,
+ ref_level,
+ average_key,
+ avg_alpha_key,
+ msg_key,
+ ):
+ pubsub.pubsub.__init__(self)
+ #setup
+ self.samples = list()
+ self.real = real
+ self.fft_size = fft_size
+ #proxy the keys
+ self.proxy(MSG_KEY, controller, msg_key)
+ self.proxy(DECIMATION_KEY, controller, decimation_key)
+ self.proxy(FRAME_RATE_KEY, controller, frame_rate_key)
+ self.proxy(AVERAGE_KEY, controller, average_key)
+ self.proxy(AVG_ALPHA_KEY, controller, avg_alpha_key)
+ self.proxy(SAMPLE_RATE_KEY, controller, sample_rate_key)
+ #init panel and plot
+ wx.Panel.__init__(self, parent, style=wx.SIMPLE_BORDER)
+ self.plotter = plotter.waterfall_plotter(self)
+ self.plotter.SetSize(wx.Size(*size))
+ self.plotter.SetSizeHints(*size)
+ self.plotter.set_title(title)
+ self.plotter.enable_point_label(True)
+ self.plotter.enable_grid_lines(False)
+ #plotter listeners
+ self.subscribe(COLOR_MODE_KEY, self.plotter.set_color_mode)
+ self.subscribe(NUM_LINES_KEY, self.plotter.set_num_lines)
+ #initialize values
+ self[DYNAMIC_RANGE_KEY] = dynamic_range
+ self[NUM_LINES_KEY] = num_lines
+ self[Y_DIVS_KEY] = 8
+ self[X_DIVS_KEY] = 8 #approximate
+ self[REF_LEVEL_KEY] = ref_level
+ self[BASEBAND_FREQ_KEY] = baseband_freq
+ self[COLOR_MODE_KEY] = COLOR_MODES[0][1]
+ self[COLOR_MODE_KEY] = DEFAULT_COLOR_MODE
+ self[RUNNING_KEY] = True
+ #setup the box with plot and controls
+ self.control_panel = control_panel(self)
+ main_box = wx.BoxSizer(wx.HORIZONTAL)
+ main_box.Add(self.plotter, 1, wx.EXPAND)
+ main_box.Add(self.control_panel, 0, wx.EXPAND)
+ self.SetSizerAndFit(main_box)
+ #register events
+ self.subscribe(MSG_KEY, self.handle_msg)
+ for key in (
+ DECIMATION_KEY, SAMPLE_RATE_KEY, FRAME_RATE_KEY,
+ BASEBAND_FREQ_KEY, X_DIVS_KEY, Y_DIVS_KEY, NUM_LINES_KEY,
+ ): self.subscribe(key, self.update_grid)
+ #initial update
+ self.update_grid()
+
+ def set_callback(self,callb):
+ self.plotter.set_callback(callb)
+
+ def autoscale(self, *args):
+ """
+ Autoscale the waterfall plot to the last frame.
+ Set the dynamic range and reference level.
+ Does not affect the current data in the waterfall.
+ """
+ if not len(self.samples): return
+ min_level, max_level = common.get_min_max_fft(self.samples)
+ #set the range and level
+ self[DYNAMIC_RANGE_KEY] = common.get_clean_num(max_level - min_level)
+ self[REF_LEVEL_KEY] = DYNAMIC_RANGE_STEP*round(.5+max_level/DYNAMIC_RANGE_STEP)
+
+ def handle_msg(self, msg):
+ """
+ Handle the message from the fft sink message queue.
+ If complex, reorder the fft samples so the negative bins come first.
+ If real, keep take only the positive bins.
+ Send the data to the plotter.
+ @param msg the fft array as a character array
+ """
+ if not self[RUNNING_KEY]: return
+ #convert to floating point numbers
+ self.samples = samples = numpy.fromstring(msg, numpy.float32)[:self.fft_size] #only take first frame
+ num_samps = len(samples)
+ #reorder fft
+ if self.real: samples = samples[:(num_samps+1)/2]
+ else: samples = numpy.concatenate((samples[num_samps/2+1:], samples[:(num_samps+1)/2]))
+ #plot the fft
+ self.plotter.set_samples(
+ samples=samples,
+ minimum=self[REF_LEVEL_KEY] - self[DYNAMIC_RANGE_KEY],
+ maximum=self[REF_LEVEL_KEY],
+ )
+ #update the plotter
+ self.plotter.update()
+
+ def update_grid(self, *args):
+ """
+ Update the plotter grid.
+ This update method is dependent on the variables below.
+ Determine the x and y axis grid parameters.
+ The x axis depends on sample rate, baseband freq, and x divs.
+ The y axis depends on y per div, y divs, and ref level.
+ """
+ #grid parameters
+ sample_rate = self[SAMPLE_RATE_KEY]
+ frame_rate = self[FRAME_RATE_KEY]
+ if frame_rate < 1.0 :
+ frame_rate = 1.0
+ baseband_freq = self[BASEBAND_FREQ_KEY]
+ num_lines = self[NUM_LINES_KEY]
+ y_divs = self[Y_DIVS_KEY]
+ x_divs = self[X_DIVS_KEY]
+ #determine best fitting x_per_div
+ if self.real: x_width = sample_rate/2.0
+ else: x_width = sample_rate/1.0
+ x_per_div = common.get_clean_num(x_width/x_divs)
+ #update the x grid
+ if self.real:
+ self.plotter.set_x_grid(
+ baseband_freq,
+ baseband_freq + sample_rate/2.0,
+ x_per_div, True,
+ )
+ else:
+ self.plotter.set_x_grid(
+ baseband_freq - sample_rate/2.0,
+ baseband_freq + sample_rate/2.0,
+ x_per_div, True,
+ )
+ #update x units
+ self.plotter.set_x_label('Frequency', 'Hz')
+ #update y grid
+ duration = float(num_lines)/frame_rate
+ y_per_div = common.get_clean_num(duration/y_divs)
+ self.plotter.set_y_grid(0, duration, y_per_div, True)
+ #update y units
+ self.plotter.set_y_label('Time', 's')
+ #update plotter
+ self.plotter.update()
diff --git a/gr-wxgui/src/python/waterfallsink2.py b/gr-wxgui/src/python/waterfallsink2.py
new file mode 100644
index 000000000..0b876fc3e
--- /dev/null
+++ b/gr-wxgui/src/python/waterfallsink2.py
@@ -0,0 +1,41 @@
+#
+# Copyright 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 gnuradio import gr
+
+p = gr.prefs()
+style = p.get_string('wxgui', 'style', 'auto')
+
+if style == 'auto' or style == 'gl':
+ try:
+ import wx.glcanvas
+ from OpenGL.GL import *
+ from waterfallsink_gl import waterfall_sink_f, waterfall_sink_c
+ except ImportError:
+ if style == 'gl':
+ raise RuntimeError("Unable to import OpenGL. Are Python wrappers for OpenGL installed?")
+ else:
+ # Fall backto non-gl sinks
+ from waterfallsink_nongl import waterfall_sink_f, waterfall_sink_c
+elif style == 'nongl':
+ from waterfallsink_nongl import waterfall_sink_f, waterfall_sink_c
+else:
+ raise RuntimeError("Unknown wxgui style")
diff --git a/gr-wxgui/src/python/waterfallsink_gl.py b/gr-wxgui/src/python/waterfallsink_gl.py
new file mode 100644
index 000000000..b69c5dda0
--- /dev/null
+++ b/gr-wxgui/src/python/waterfallsink_gl.py
@@ -0,0 +1,173 @@
+#
+# Copyright 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.
+#
+
+##################################################
+# Imports
+##################################################
+import waterfall_window
+import common
+from gnuradio import gr, blks2
+from pubsub import pubsub
+from constants import *
+
+##################################################
+# Waterfall sink block (wrapper for old wxgui)
+##################################################
+class _waterfall_sink_base(gr.hier_block2, common.wxgui_hb):
+ """
+ An fft block with real/complex inputs and a gui window.
+ """
+
+ def __init__(
+ self,
+ parent,
+ baseband_freq=0,
+ ref_level=50,
+ sample_rate=1,
+ fft_size=512,
+ fft_rate=waterfall_window.DEFAULT_FRAME_RATE,
+ average=False,
+ avg_alpha=None,
+ title='',
+ size=waterfall_window.DEFAULT_WIN_SIZE,
+ ref_scale=2.0,
+ dynamic_range=80,
+ num_lines=256,
+ win=None,
+ **kwargs #do not end with a comma
+ ):
+ #ensure avg alpha
+ if avg_alpha is None: avg_alpha = 2.0/fft_rate
+ #init
+ gr.hier_block2.__init__(
+ self,
+ "waterfall_sink",
+ gr.io_signature(1, 1, self._item_size),
+ gr.io_signature(0, 0, 0),
+ )
+ #blocks
+ fft = self._fft_chain(
+ sample_rate=sample_rate,
+ fft_size=fft_size,
+ frame_rate=fft_rate,
+ ref_scale=ref_scale,
+ avg_alpha=avg_alpha,
+ average=average,
+ win=win,
+ )
+ msgq = gr.msg_queue(2)
+ sink = gr.message_sink(gr.sizeof_float*fft_size, msgq, True)
+ #controller
+ self.controller = pubsub()
+ self.controller.subscribe(AVERAGE_KEY, fft.set_average)
+ self.controller.publish(AVERAGE_KEY, fft.average)
+ self.controller.subscribe(AVG_ALPHA_KEY, fft.set_avg_alpha)
+ self.controller.publish(AVG_ALPHA_KEY, fft.avg_alpha)
+ self.controller.subscribe(SAMPLE_RATE_KEY, fft.set_sample_rate)
+ self.controller.publish(SAMPLE_RATE_KEY, fft.sample_rate)
+ self.controller.subscribe(DECIMATION_KEY, fft.set_decimation)
+ self.controller.publish(DECIMATION_KEY, fft.decimation)
+ self.controller.subscribe(FRAME_RATE_KEY, fft.set_vec_rate)
+ self.controller.publish(FRAME_RATE_KEY, fft.frame_rate)
+ #start input watcher
+ common.input_watcher(msgq, self.controller, MSG_KEY)
+ #create window
+ self.win = waterfall_window.waterfall_window(
+ parent=parent,
+ controller=self.controller,
+ size=size,
+ title=title,
+ real=self._real,
+ fft_size=fft_size,
+ num_lines=num_lines,
+ baseband_freq=baseband_freq,
+ decimation_key=DECIMATION_KEY,
+ sample_rate_key=SAMPLE_RATE_KEY,
+ frame_rate_key=FRAME_RATE_KEY,
+ dynamic_range=dynamic_range,
+ ref_level=ref_level,
+ average_key=AVERAGE_KEY,
+ avg_alpha_key=AVG_ALPHA_KEY,
+ msg_key=MSG_KEY,
+ )
+ common.register_access_methods(self, self.win)
+ setattr(self.win, 'set_baseband_freq', getattr(self, 'set_baseband_freq')) #BACKWARDS
+ #connect
+ self.wxgui_connect(self, fft, sink)
+
+ def set_callback(self,callb):
+ self.win.set_callback(callb)
+
+class waterfall_sink_f(_waterfall_sink_base):
+ _fft_chain = blks2.logpwrfft_f
+ _item_size = gr.sizeof_float
+ _real = True
+
+class waterfall_sink_c(_waterfall_sink_base):
+ _fft_chain = blks2.logpwrfft_c
+ _item_size = gr.sizeof_gr_complex
+ _real = False
+
+# ----------------------------------------------------------------
+# Standalone test app
+# ----------------------------------------------------------------
+
+import wx
+from gnuradio.wxgui import stdgui2
+
+class test_top_block (stdgui2.std_top_block):
+ def __init__(self, frame, panel, vbox, argv):
+ stdgui2.std_top_block.__init__ (self, frame, panel, vbox, argv)
+
+ fft_size = 512
+
+ # build our flow graph
+ input_rate = 20.000e3
+
+ # Generate a complex sinusoid
+ self.src1 = gr.sig_source_c (input_rate, gr.GR_SIN_WAVE, 5.75e3, 1000)
+ #src1 = gr.sig_source_c (input_rate, gr.GR_CONST_WAVE, 5.75e3, 1000)
+
+ # We add these throttle blocks so that this demo doesn't
+ # suck down all the CPU available. Normally you wouldn't use these.
+ self.thr1 = gr.throttle(gr.sizeof_gr_complex, input_rate)
+
+ sink1 = waterfall_sink_c (panel, title="Complex Data", fft_size=fft_size,
+ sample_rate=input_rate, baseband_freq=100e3)
+ self.connect(self.src1, self.thr1, sink1)
+ vbox.Add (sink1.win, 1, wx.EXPAND)
+
+ # generate a real sinusoid
+ self.src2 = gr.sig_source_f (input_rate, gr.GR_SIN_WAVE, 5.75e3, 1000)
+ self.thr2 = gr.throttle(gr.sizeof_float, input_rate)
+ sink2 = waterfall_sink_f (panel, title="Real Data", fft_size=fft_size,
+ sample_rate=input_rate, baseband_freq=100e3)
+ self.connect(self.src2, self.thr2, sink2)
+ vbox.Add (sink2.win, 1, wx.EXPAND)
+
+
+def main ():
+ app = stdgui2.stdapp (test_top_block, "Waterfall Sink Test App")
+ app.MainLoop ()
+
+if __name__ == '__main__':
+ main ()
+
diff --git a/gr-wxgui/src/python/waterfallsink_nongl.py b/gr-wxgui/src/python/waterfallsink_nongl.py
new file mode 100644
index 000000000..bf77b4b13
--- /dev/null
+++ b/gr-wxgui/src/python/waterfallsink_nongl.py
@@ -0,0 +1,431 @@
+#!/usr/bin/env python
+#
+# Copyright 2003-2005,2007,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.
+#
+
+from gnuradio import gr, gru, window
+from gnuradio.wxgui import stdgui2
+import wx
+import gnuradio.wxgui.plot as plot
+import numpy
+import os
+import math
+
+default_fftsink_size = (640,240)
+default_fft_rate = gr.prefs().get_long('wxgui', 'fft_rate', 15)
+
+class waterfall_sink_base(object):
+ def __init__(self, input_is_real=False, baseband_freq=0,
+ sample_rate=1, fft_size=512,
+ fft_rate=default_fft_rate,
+ average=False, avg_alpha=None, title=''):
+
+ # initialize common attributes
+ self.baseband_freq = baseband_freq
+ self.sample_rate = sample_rate
+ self.fft_size = fft_size
+ self.fft_rate = fft_rate
+ self.average = average
+ if avg_alpha is None:
+ self.avg_alpha = 2.0 / fft_rate
+ else:
+ self.avg_alpha = avg_alpha
+ self.title = title
+ self.input_is_real = input_is_real
+ self.msgq = gr.msg_queue(2) # queue up to 2 messages
+
+ def set_average(self, average):
+ self.average = average
+ if average:
+ self.avg.set_taps(self.avg_alpha)
+ else:
+ self.avg.set_taps(1.0)
+
+ def set_avg_alpha(self, avg_alpha):
+ self.avg_alpha = avg_alpha
+
+ def set_baseband_freq(self, baseband_freq):
+ self.baseband_freq = baseband_freq
+
+ def set_sample_rate(self, sample_rate):
+ self.sample_rate = sample_rate
+ self._set_n()
+
+ def _set_n(self):
+ self.one_in_n.set_n(max(1, int(self.sample_rate/self.fft_size/self.fft_rate)))
+
+ def set_callback(self, callb):
+ return
+
+class waterfall_sink_f(gr.hier_block2, waterfall_sink_base):
+ def __init__(self, parent, baseband_freq=0,
+ y_per_div=10, ref_level=50, sample_rate=1, fft_size=512,
+ fft_rate=default_fft_rate, average=False, avg_alpha=None,
+ title='', size=default_fftsink_size, **kwargs):
+
+ gr.hier_block2.__init__(self, "waterfall_sink_f",
+ gr.io_signature(1, 1, gr.sizeof_float),
+ gr.io_signature(0,0,0))
+
+ waterfall_sink_base.__init__(self, input_is_real=True, baseband_freq=baseband_freq,
+ sample_rate=sample_rate, fft_size=fft_size,
+ fft_rate=fft_rate,
+ average=average, avg_alpha=avg_alpha, title=title)
+
+ self.s2p = gr.serial_to_parallel(gr.sizeof_float, self.fft_size)
+ self.one_in_n = gr.keep_one_in_n(gr.sizeof_float * self.fft_size,
+ max(1, int(self.sample_rate/self.fft_size/self.fft_rate)))
+
+ mywindow = window.blackmanharris(self.fft_size)
+ self.fft = gr.fft_vfc(self.fft_size, True, mywindow)
+ self.c2mag = gr.complex_to_mag(self.fft_size)
+ self.avg = gr.single_pole_iir_filter_ff(1.0, self.fft_size)
+ self.log = gr.nlog10_ff(20, self.fft_size, -20*math.log10(self.fft_size))
+ self.sink = gr.message_sink(gr.sizeof_float * self.fft_size, self.msgq, True)
+ self.connect(self, self.s2p, self.one_in_n, self.fft, self.c2mag, self.avg, self.log, self.sink)
+
+ self.win = waterfall_window(self, parent, size=size)
+ self.set_average(self.average)
+
+
+class waterfall_sink_c(gr.hier_block2, waterfall_sink_base):
+ def __init__(self, parent, baseband_freq=0,
+ y_per_div=10, ref_level=50, sample_rate=1, fft_size=512,
+ fft_rate=default_fft_rate, average=False, avg_alpha=None,
+ title='', size=default_fftsink_size, **kwargs):
+
+ gr.hier_block2.__init__(self, "waterfall_sink_f",
+ gr.io_signature(1, 1, gr.sizeof_gr_complex),
+ gr.io_signature(0,0,0))
+
+ waterfall_sink_base.__init__(self, input_is_real=False, baseband_freq=baseband_freq,
+ sample_rate=sample_rate, fft_size=fft_size,
+ fft_rate=fft_rate,
+ average=average, avg_alpha=avg_alpha, title=title)
+
+ self.s2p = gr.serial_to_parallel(gr.sizeof_gr_complex, self.fft_size)
+ self.one_in_n = gr.keep_one_in_n(gr.sizeof_gr_complex * self.fft_size,
+ max(1, int(self.sample_rate/self.fft_size/self.fft_rate)))
+
+ mywindow = window.blackmanharris(self.fft_size)
+ self.fft = gr.fft_vcc(self.fft_size, True, mywindow)
+ self.c2mag = gr.complex_to_mag(self.fft_size)
+ self.avg = gr.single_pole_iir_filter_ff(1.0, self.fft_size)
+ self.log = gr.nlog10_ff(20, self.fft_size, -20*math.log10(self.fft_size))
+ self.sink = gr.message_sink(gr.sizeof_float * self.fft_size, self.msgq, True)
+ self.connect(self, self.s2p, self.one_in_n, self.fft, self.c2mag, self.avg, self.log, self.sink)
+
+ self.win = waterfall_window(self, parent, size=size)
+ self.set_average(self.average)
+
+
+# ------------------------------------------------------------------------
+
+myDATA_EVENT = wx.NewEventType()
+EVT_DATA_EVENT = wx.PyEventBinder (myDATA_EVENT, 0)
+
+
+class DataEvent(wx.PyEvent):
+ def __init__(self, data):
+ wx.PyEvent.__init__(self)
+ self.SetEventType (myDATA_EVENT)
+ self.data = data
+
+ def Clone (self):
+ self.__class__ (self.GetId())
+
+class input_watcher (gru.msgq_runner):
+ def __init__ (self, msgq, fft_size, event_receiver, **kwds):
+ self.fft_size = fft_size
+ self.event_receiver = event_receiver
+ gru.msgq_runner.__init__(self, msgq, self.handle_msg)
+
+ def handle_msg(self, msg):
+ itemsize = int(msg.arg1())
+ nitems = int(msg.arg2())
+
+ s = msg.to_string() # get the body of the msg as a string
+
+ # There may be more than one FFT frame in the message.
+ # If so, we take only the last one
+ if nitems > 1:
+ start = itemsize * (nitems - 1)
+ s = s[start:start+itemsize]
+
+ complex_data = numpy.fromstring (s, numpy.float32)
+ de = DataEvent (complex_data)
+ wx.PostEvent (self.event_receiver, de)
+ del de
+
+class waterfall_window (wx.Panel):
+ def __init__ (self, fftsink, parent, id = -1,
+ pos = wx.DefaultPosition, size = wx.DefaultSize,
+ style = wx.DEFAULT_FRAME_STYLE, name = ""):
+ wx.Panel.__init__(self, parent, id, pos, size, style, name)
+ self.set_baseband_freq = fftsink.set_baseband_freq
+ self.fftsink = fftsink
+ self.bm = wx.EmptyBitmap(self.fftsink.fft_size, 300, -1)
+
+ self.scale_factor = 5.0 # FIXME should autoscale, or set this
+
+ dc1 = wx.MemoryDC()
+ dc1.SelectObject(self.bm)
+ dc1.Clear()
+
+ self.pens = self.make_pens()
+
+ wx.EVT_PAINT( self, self.OnPaint )
+ wx.EVT_CLOSE (self, self.on_close_window)
+ EVT_DATA_EVENT (self, self.set_data)
+
+ self.build_popup_menu()
+
+ wx.EVT_CLOSE (self, self.on_close_window)
+ self.Bind(wx.EVT_RIGHT_UP, self.on_right_click)
+
+ self.input_watcher = input_watcher(fftsink.msgq, fftsink.fft_size, self)
+
+
+ def on_close_window (self, event):
+ print "waterfall_window: on_close_window"
+ self.keep_running = False
+
+ def const_list(self,const,len):
+ return [const] * len
+
+ def make_colormap(self):
+ r = []
+ r.extend(self.const_list(0,96))
+ r.extend(range(0,255,4))
+ r.extend(self.const_list(255,64))
+ r.extend(range(255,128,-4))
+
+ g = []
+ g.extend(self.const_list(0,32))
+ g.extend(range(0,255,4))
+ g.extend(self.const_list(255,64))
+ g.extend(range(255,0,-4))
+ g.extend(self.const_list(0,32))
+
+ b = range(128,255,4)
+ b.extend(self.const_list(255,64))
+ b.extend(range(255,0,-4))
+ b.extend(self.const_list(0,96))
+ return (r,g,b)
+
+ def make_pens(self):
+ (r,g,b) = self.make_colormap()
+ pens = []
+ for i in range(0,256):
+ colour = wx.Colour(r[i], g[i], b[i])
+ pens.append( wx.Pen(colour, 2, wx.SOLID))
+ return pens
+
+ def OnPaint(self, event):
+ dc = wx.PaintDC(self)
+ self.DoDrawing(dc)
+
+ def DoDrawing(self, dc=None):
+ if dc is None:
+ dc = wx.ClientDC(self)
+ dc.DrawBitmap(self.bm, 0, 0, False )
+
+
+ def const_list(self,const,len):
+ a = [const]
+ for i in range(1,len):
+ a.append(const)
+ return a
+
+
+ def set_data (self, evt):
+ dB = evt.data
+ L = len (dB)
+
+ dc1 = wx.MemoryDC()
+ dc1.SelectObject(self.bm)
+ dc1.Blit(0,1,self.fftsink.fft_size,300,dc1,0,0,wx.COPY,False,-1,-1)
+
+ x = max(abs(self.fftsink.sample_rate), abs(self.fftsink.baseband_freq))
+ if x >= 1e9:
+ sf = 1e-9
+ units = "GHz"
+ elif x >= 1e6:
+ sf = 1e-6
+ units = "MHz"
+ else:
+ sf = 1e-3
+ units = "kHz"
+
+
+ if self.fftsink.input_is_real: # only plot 1/2 the points
+ d_max = L/2
+ p_width = 2
+ else:
+ d_max = L/2
+ p_width = 1
+
+ scale_factor = self.scale_factor
+ if self.fftsink.input_is_real: # real fft
+ for x_pos in range(0, d_max):
+ value = int(dB[x_pos] * scale_factor)
+ value = min(255, max(0, value))
+ dc1.SetPen(self.pens[value])
+ dc1.DrawRectangle(x_pos*p_width, 0, p_width, 2)
+ else: # complex fft
+ for x_pos in range(0, d_max): # positive freqs
+ value = int(dB[x_pos] * scale_factor)
+ value = min(255, max(0, value))
+ dc1.SetPen(self.pens[value])
+ dc1.DrawRectangle(x_pos*p_width + d_max, 0, p_width, 2)
+ for x_pos in range(0 , d_max): # negative freqs
+ value = int(dB[x_pos+d_max] * scale_factor)
+ value = min(255, max(0, value))
+ dc1.SetPen(self.pens[value])
+ dc1.DrawRectangle(x_pos*p_width, 0, p_width, 2)
+
+ del dc1
+ self.DoDrawing (None)
+
+ def on_average(self, evt):
+ # print "on_average"
+ self.fftsink.set_average(evt.IsChecked())
+
+ def on_right_click(self, event):
+ menu = self.popup_menu
+ for id, pred in self.checkmarks.items():
+ item = menu.FindItemById(id)
+ item.Check(pred())
+ self.PopupMenu(menu, event.GetPosition())
+
+
+ def build_popup_menu(self):
+ self.id_incr_ref_level = wx.NewId()
+ self.id_decr_ref_level = wx.NewId()
+ self.id_incr_y_per_div = wx.NewId()
+ self.id_decr_y_per_div = wx.NewId()
+ self.id_y_per_div_1 = wx.NewId()
+ self.id_y_per_div_2 = wx.NewId()
+ self.id_y_per_div_5 = wx.NewId()
+ self.id_y_per_div_10 = wx.NewId()
+ self.id_y_per_div_20 = wx.NewId()
+ self.id_average = wx.NewId()
+
+ self.Bind(wx.EVT_MENU, self.on_average, id=self.id_average)
+ #self.Bind(wx.EVT_MENU, self.on_incr_ref_level, id=self.id_incr_ref_level)
+ #self.Bind(wx.EVT_MENU, self.on_decr_ref_level, id=self.id_decr_ref_level)
+ #self.Bind(wx.EVT_MENU, self.on_incr_y_per_div, id=self.id_incr_y_per_div)
+ #self.Bind(wx.EVT_MENU, self.on_decr_y_per_div, id=self.id_decr_y_per_div)
+ #self.Bind(wx.EVT_MENU, self.on_y_per_div, id=self.id_y_per_div_1)
+ #self.Bind(wx.EVT_MENU, self.on_y_per_div, id=self.id_y_per_div_2)
+ #self.Bind(wx.EVT_MENU, self.on_y_per_div, id=self.id_y_per_div_5)
+ #self.Bind(wx.EVT_MENU, self.on_y_per_div, id=self.id_y_per_div_10)
+ #self.Bind(wx.EVT_MENU, self.on_y_per_div, id=self.id_y_per_div_20)
+
+
+ # make a menu
+ menu = wx.Menu()
+ self.popup_menu = menu
+ menu.AppendCheckItem(self.id_average, "Average")
+ # menu.Append(self.id_incr_ref_level, "Incr Ref Level")
+ # menu.Append(self.id_decr_ref_level, "Decr Ref Level")
+ # menu.Append(self.id_incr_y_per_div, "Incr dB/div")
+ # menu.Append(self.id_decr_y_per_div, "Decr dB/div")
+ # menu.AppendSeparator()
+ # we'd use RadioItems for these, but they're not supported on Mac
+ #menu.AppendCheckItem(self.id_y_per_div_1, "1 dB/div")
+ #menu.AppendCheckItem(self.id_y_per_div_2, "2 dB/div")
+ #menu.AppendCheckItem(self.id_y_per_div_5, "5 dB/div")
+ #menu.AppendCheckItem(self.id_y_per_div_10, "10 dB/div")
+ #menu.AppendCheckItem(self.id_y_per_div_20, "20 dB/div")
+
+ self.checkmarks = {
+ self.id_average : lambda : self.fftsink.average
+ #self.id_y_per_div_1 : lambda : self.fftsink.y_per_div == 1,
+ #self.id_y_per_div_2 : lambda : self.fftsink.y_per_div == 2,
+ #self.id_y_per_div_5 : lambda : self.fftsink.y_per_div == 5,
+ #self.id_y_per_div_10 : lambda : self.fftsink.y_per_div == 10,
+ #self.id_y_per_div_20 : lambda : self.fftsink.y_per_div == 20,
+ }
+
+
+def next_up(v, seq):
+ """
+ Return the first item in seq that is > v.
+ """
+ for s in seq:
+ if s > v:
+ return s
+ return v
+
+def next_down(v, seq):
+ """
+ Return the last item in seq that is < v.
+ """
+ rseq = list(seq[:])
+ rseq.reverse()
+
+ for s in rseq:
+ if s < v:
+ return s
+ return v
+
+
+# ----------------------------------------------------------------
+# Standalone test app
+# ----------------------------------------------------------------
+
+class test_top_block (stdgui2.std_top_block):
+ def __init__(self, frame, panel, vbox, argv):
+ stdgui2.std_top_block.__init__ (self, frame, panel, vbox, argv)
+
+ fft_size = 512
+
+ # build our flow graph
+ input_rate = 20.000e3
+
+ # Generate a complex sinusoid
+ self.src1 = gr.sig_source_c (input_rate, gr.GR_SIN_WAVE, 5.75e3, 1000)
+ #src1 = gr.sig_source_c (input_rate, gr.GR_CONST_WAVE, 5.75e3, 1000)
+
+ # We add these throttle blocks so that this demo doesn't
+ # suck down all the CPU available. Normally you wouldn't use these.
+ self.thr1 = gr.throttle(gr.sizeof_gr_complex, input_rate)
+
+ sink1 = waterfall_sink_c (panel, title="Complex Data", fft_size=fft_size,
+ sample_rate=input_rate, baseband_freq=100e3)
+ self.connect(self.src1, self.thr1, sink1)
+ vbox.Add (sink1.win, 1, wx.EXPAND)
+
+ # generate a real sinusoid
+ self.src2 = gr.sig_source_f (input_rate, gr.GR_SIN_WAVE, 5.75e3, 1000)
+ self.thr2 = gr.throttle(gr.sizeof_float, input_rate)
+ sink2 = waterfall_sink_f (panel, title="Real Data", fft_size=fft_size,
+ sample_rate=input_rate, baseband_freq=100e3)
+ self.connect(self.src2, self.thr2, sink2)
+ vbox.Add (sink2.win, 1, wx.EXPAND)
+
+
+def main ():
+ app = stdgui2.stdapp (test_top_block, "Waterfall Sink Test App")
+ app.MainLoop ()
+
+if __name__ == '__main__':
+ main ()
diff --git a/grc/CMakeLists.txt b/grc/CMakeLists.txt
new file mode 100644
index 000000000..1156f1d76
--- /dev/null
+++ b/grc/CMakeLists.txt
@@ -0,0 +1,128 @@
+# Copyright 2011,2013 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.
+
+########################################################################
+# Setup dependencies
+########################################################################
+include(GrPython)
+
+GR_PYTHON_CHECK_MODULE("python >= 2.5" sys "sys.version.split()[0] >= '2.5'" PYTHON_MIN_VER_FOUND)
+GR_PYTHON_CHECK_MODULE("Cheetah >= 2.0.0" Cheetah "Cheetah.Version >= '2.0.0'" CHEETAH_FOUND)
+GR_PYTHON_CHECK_MODULE("lxml >= 1.3.6" lxml.etree "lxml.etree.LXML_VERSION >= (1, 3, 6, 0)" LXML_FOUND)
+GR_PYTHON_CHECK_MODULE("pygtk >= 2.10.0" gtk "gtk.pygtk_version >= (2, 10, 0)" PYGTK_FOUND)
+GR_PYTHON_CHECK_MODULE("numpy" numpy True NUMPY_FOUND)
+
+########################################################################
+# Register component
+########################################################################
+include(GrComponent)
+if(NOT CMAKE_CROSSCOMPILING)
+ set(grc_python_deps
+ PYTHON_MIN_VER_FOUND
+ CHEETAH_FOUND
+ LXML_FOUND
+ PYGTK_FOUND
+ NUMPY_FOUND
+ )
+endif(NOT CMAKE_CROSSCOMPILING)
+
+GR_REGISTER_COMPONENT("gnuradio-companion" ENABLE_GRC
+ ENABLE_GR_CORE
+ ENABLE_PYTHON
+ ${grc_python_deps}
+)
+
+########################################################################
+# Begin conditional configuration
+########################################################################
+if(ENABLE_GRC)
+
+########################################################################
+# Setup CPack components
+########################################################################
+include(GrPackage)
+CPACK_COMPONENT("grc"
+ DISPLAY_NAME "GNU Radio Companion"
+ DESCRIPTION "Graphical flow graph designer"
+ DEPENDS "core_python"
+)
+
+########################################################################
+# Create and install the grc conf file
+########################################################################
+file(TO_NATIVE_PATH ${CMAKE_INSTALL_PREFIX}/${GRC_BLOCKS_DIR} blocksdir)
+
+configure_file(
+ ${CMAKE_CURRENT_SOURCE_DIR}/grc.conf.in
+ ${CMAKE_CURRENT_BINARY_DIR}/grc.conf
+@ONLY)
+
+install(
+ FILES ${CMAKE_CURRENT_BINARY_DIR}/grc.conf
+ DESTINATION ${GR_PREFSDIR}
+ COMPONENT "grc"
+)
+
+GR_PYTHON_INSTALL(
+ FILES __init__.py
+ DESTINATION ${GR_PYTHON_DIR}/gnuradio/grc
+ COMPONENT "grc"
+)
+
+########################################################################
+# Appens NSIS commands to set environment variables
+########################################################################
+if(WIN32)
+
+file(TO_NATIVE_PATH ${GR_PKG_DOC_DIR} GR_DOC_DIR)
+string(REPLACE "\\" "\\\\" GR_DOC_DIR ${GR_DOC_DIR})
+
+file(TO_NATIVE_PATH ${GRC_BLOCKS_DIR} GRC_BLOCKS_PATH)
+string(REPLACE "\\" "\\\\" GRC_BLOCKS_PATH ${GRC_BLOCKS_PATH})
+
+file(TO_NATIVE_PATH ${GR_PYTHON_DIR} GR_PYTHON_POSTFIX)
+string(REPLACE "\\" "\\\\" GR_PYTHON_POSTFIX ${GR_PYTHON_POSTFIX})
+
+CPACK_SET(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "${CPACK_NSIS_EXTRA_INSTALL_COMMANDS}
+ #!include \\\"winmessages.nsh\\\"
+ WriteRegStr HKLM ${HLKM_ENV} \\\"GRC_BLOCKS_PATH\\\" \\\"$INSTDIR\\\\${GRC_BLOCKS_PATH}\\\"
+ SendMessage \\\${HWND_BROADCAST} \\\${WM_WININICHANGE} 0 \\\"STR:Environment\\\" /TIMEOUT=5000
+")
+
+CPACK_SET(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS "${CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS}
+ #!include \\\"winmessages.nsh\\\"
+ DeleteRegValue HKLM ${HLKM_ENV} \\\"GRC_BLOCKS_PATH\\\"
+ SendMessage \\\${HWND_BROADCAST} \\\${WM_WININICHANGE} 0 \\\"STR:Environment\\\" /TIMEOUT=5000
+")
+
+endif(WIN32)
+
+########################################################################
+# Add subdirectories
+########################################################################
+add_subdirectory(base)
+add_subdirectory(blocks)
+add_subdirectory(freedesktop)
+add_subdirectory(grc_gnuradio)
+add_subdirectory(gui)
+add_subdirectory(python)
+add_subdirectory(scripts)
+add_subdirectory(examples)
+
+endif(ENABLE_GRC)
diff --git a/grc/__init__.py b/grc/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/grc/__init__.py
diff --git a/grc/base/Block.py b/grc/base/Block.py
new file mode 100644
index 000000000..a20be9db9
--- /dev/null
+++ b/grc/base/Block.py
@@ -0,0 +1,253 @@
+"""
+Copyright 2008-2011 Free Software Foundation, Inc.
+This file is part of GNU Radio
+
+GNU Radio Companion 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 2
+of the License, or (at your option) any later version.
+
+GNU Radio Companion 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 this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+"""
+
+from . import odict
+from Element import Element
+
+from Cheetah.Template import Template
+from UserDict import UserDict
+
+class TemplateArg(UserDict):
+ """
+ A cheetah template argument created from a param.
+ The str of this class evaluates to the param's to code method.
+ The use of this class as a dictionary (enum only) will reveal the enum opts.
+ The __call__ or () method can return the param evaluated to a raw python data type.
+ """
+
+ def __init__(self, param):
+ UserDict.__init__(self)
+ self._param = param
+ if param.is_enum():
+ for key in param.get_opt_keys():
+ self[key] = str(param.get_opt(key))
+
+ def __str__(self):
+ return str(self._param.to_code())
+
+ def __call__(self):
+ return self._param.get_evaluated()
+
+def _get_keys(lst): return [elem.get_key() for elem in lst]
+def _get_elem(lst, key):
+ try: return lst[_get_keys(lst).index(key)]
+ except ValueError: raise ValueError, 'Key "%s" not found in %s.'%(key, _get_keys(lst))
+
+class Block(Element):
+
+ def __init__(self, flow_graph, n):
+ """
+ Make a new block from nested data.
+ @param flow graph the parent element
+ @param n the nested odict
+ @return block a new block
+ """
+ #build the block
+ Element.__init__(self, flow_graph)
+ #grab the data
+ params = n.findall('param')
+ sources = n.findall('source')
+ sinks = n.findall('sink')
+ self._name = n.find('name')
+ self._key = n.find('key')
+ self._category = n.find('category') or ''
+ self._grc_source = n.find('grc_source') or ''
+ self._block_wrapper_path = n.find('block_wrapper_path')
+ #create the param objects
+ self._params = list()
+ #add the id param
+ self.get_params().append(self.get_parent().get_parent().Param(
+ block=self,
+ n=odict({
+ 'name': 'ID',
+ 'key': 'id',
+ 'type': 'id',
+ })
+ ))
+ self.get_params().append(self.get_parent().get_parent().Param(
+ block=self,
+ n=odict({
+ 'name': 'Enabled',
+ 'key': '_enabled',
+ 'type': 'raw',
+ 'value': 'True',
+ 'hide': 'all',
+ })
+ ))
+ for param in map(lambda n: self.get_parent().get_parent().Param(block=self, n=n), params):
+ key = param.get_key()
+ #test against repeated keys
+ if key in self.get_param_keys():
+ raise Exception, 'Key "%s" already exists in params'%key
+ #store the param
+ self.get_params().append(param)
+ #create the source objects
+ self._sources = list()
+ for source in map(lambda n: self.get_parent().get_parent().Port(block=self, n=n, dir='source'), sources):
+ key = source.get_key()
+ #test against repeated keys
+ if key in self.get_source_keys():
+ raise Exception, 'Key "%s" already exists in sources'%key
+ #store the port
+ self.get_sources().append(source)
+ #create the sink objects
+ self._sinks = list()
+ for sink in map(lambda n: self.get_parent().get_parent().Port(block=self, n=n, dir='sink'), sinks):
+ key = sink.get_key()
+ #test against repeated keys
+ if key in self.get_sink_keys():
+ raise Exception, 'Key "%s" already exists in sinks'%key
+ #store the port
+ self.get_sinks().append(sink)
+
+ def get_enabled(self):
+ """
+ Get the enabled state of the block.
+ @return true for enabled
+ """
+ try: return eval(self.get_param('_enabled').get_value())
+ except: return True
+
+ def set_enabled(self, enabled):
+ """
+ Set the enabled state of the block.
+ @param enabled true for enabled
+ """
+ self.get_param('_enabled').set_value(str(enabled))
+
+ def __str__(self): return 'Block - %s - %s(%s)'%(self.get_id(), self.get_name(), self.get_key())
+
+ def get_id(self): return self.get_param('id').get_value()
+ def is_block(self): return True
+ def get_name(self): return self._name
+ def get_key(self): return self._key
+ def get_category(self): return self._category
+ def get_doc(self): return ''
+ def get_ports(self): return self.get_sources() + self.get_sinks()
+ def get_children(self): return self.get_ports() + self.get_params()
+ def get_block_wrapper_path(self): return self._block_wrapper_path
+
+ ##############################################
+ # Access Params
+ ##############################################
+ def get_param_keys(self): return _get_keys(self._params)
+ def get_param(self, key): return _get_elem(self._params, key)
+ def get_params(self): return self._params
+
+ ##############################################
+ # Access Sinks
+ ##############################################
+ def get_sink_keys(self): return _get_keys(self._sinks)
+ def get_sink(self, key): return _get_elem(self._sinks, key)
+ def get_sinks(self): return self._sinks
+
+ ##############################################
+ # Access Sources
+ ##############################################
+ def get_source_keys(self): return _get_keys(self._sources)
+ def get_source(self, key): return _get_elem(self._sources, key)
+ def get_sources(self): return self._sources
+
+ def get_connections(self):
+ return sum([port.get_connections() for port in self.get_ports()], [])
+
+ def resolve_dependencies(self, tmpl):
+ """
+ Resolve a paramater dependency with cheetah templates.
+ @param tmpl the string with dependencies
+ @return the resolved value
+ """
+ tmpl = str(tmpl)
+ if '$' not in tmpl: return tmpl
+ n = dict((p.get_key(), TemplateArg(p)) for p in self.get_params())
+ try: return str(Template(tmpl, n))
+ except Exception, e: return "-------->\n%s: %s\n<--------"%(e, tmpl)
+
+ ##############################################
+ # Controller Modify
+ ##############################################
+ def type_controller_modify(self, direction):
+ """
+ Change the type controller.
+ @param direction +1 or -1
+ @return true for change
+ """
+ changed = False
+ type_param = None
+ for param in filter(lambda p: p.is_enum(), self.get_params()):
+ children = self.get_ports() + self.get_params()
+ #priority to the type controller
+ if param.get_key() in ' '.join(map(lambda p: p._type, children)): type_param = param
+ #use param if type param is unset
+ if not type_param: type_param = param
+ if type_param:
+ #try to increment the enum by direction
+ try:
+ keys = type_param.get_option_keys()
+ old_index = keys.index(type_param.get_value())
+ new_index = (old_index + direction + len(keys))%len(keys)
+ type_param.set_value(keys[new_index])
+ changed = True
+ except: pass
+ return changed
+
+ def port_controller_modify(self, direction):
+ """
+ Change the port controller.
+ @param direction +1 or -1
+ @return true for change
+ """
+ return False
+
+ ##############################################
+ ## Import/Export Methods
+ ##############################################
+ def export_data(self):
+ """
+ Export this block's params to nested data.
+ @return a nested data odict
+ """
+ n = odict()
+ n['key'] = self.get_key()
+ n['param'] = map(lambda p: p.export_data(), self.get_params())
+ return n
+
+ def import_data(self, n):
+ """
+ Import this block's params from nested data.
+ Any param keys that do not exist will be ignored.
+ Since params can be dynamically created based another param,
+ call rewrite, and repeat the load until the params stick.
+ This call to rewrite will also create any dynamic ports
+ that are needed for the connections creation phase.
+ @param n the nested data odict
+ """
+ get_hash = lambda: hash(tuple(map(hash, self.get_params())))
+ my_hash = 0
+ while get_hash() != my_hash:
+ params_n = n.findall('param')
+ for param_n in params_n:
+ key = param_n.find('key')
+ value = param_n.find('value')
+ #the key must exist in this block's params
+ if key in self.get_param_keys():
+ self.get_param(key).set_value(value)
+ #store hash and call rewrite
+ my_hash = get_hash()
+ self.rewrite()
diff --git a/grc/base/CMakeLists.txt b/grc/base/CMakeLists.txt
new file mode 100644
index 000000000..1087e842a
--- /dev/null
+++ b/grc/base/CMakeLists.txt
@@ -0,0 +1,42 @@
+# Copyright 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.
+
+########################################################################
+GR_PYTHON_INSTALL(FILES
+ odict.py
+ ParseXML.py
+ Block.py
+ Connection.py
+ Constants.py
+ Element.py
+ FlowGraph.py
+ Param.py
+ Platform.py
+ Port.py
+ __init__.py
+ DESTINATION ${GR_PYTHON_DIR}/gnuradio/grc/base
+ COMPONENT "grc"
+)
+
+install(FILES
+ block_tree.dtd
+ flow_graph.dtd
+ DESTINATION ${GR_PYTHON_DIR}/gnuradio/grc/base
+ COMPONENT "grc"
+)
diff --git a/grc/base/Connection.py b/grc/base/Connection.py
new file mode 100644
index 000000000..3ce7fd07f
--- /dev/null
+++ b/grc/base/Connection.py
@@ -0,0 +1,97 @@
+"""
+Copyright 2008-2011 Free Software Foundation, Inc.
+This file is part of GNU Radio
+
+GNU Radio Companion 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 2
+of the License, or (at your option) any later version.
+
+GNU Radio Companion 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 this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+"""
+
+from Element import Element
+from . import odict
+
+class Connection(Element):
+
+ def __init__(self, flow_graph, porta, portb):
+ """
+ Make a new connection given the parent and 2 ports.
+ @param flow_graph the parent of this element
+ @param porta a port (any direction)
+ @param portb a port (any direction)
+ @throws Error cannot make connection
+ @return a new connection
+ """
+ Element.__init__(self, flow_graph)
+ source = sink = None
+ #separate the source and sink
+ for port in (porta, portb):
+ if port.is_source(): source = port
+ if port.is_sink(): sink = port
+ if not source: raise ValueError('Connection could not isolate source')
+ if not sink: raise ValueError('Connection could not isolate sink')
+ #ensure that this connection (source -> sink) is unique
+ for connection in self.get_parent().get_connections():
+ if connection.get_source() is source and connection.get_sink() is sink:
+ raise Exception('This connection between source and sink is not unique.')
+ self._source = source
+ self._sink = sink
+
+ def __str__(self):
+ return 'Connection (\n\t%s\n\t\t%s\n\t%s\n\t\t%s\n)'%(
+ self.get_source().get_parent(),
+ self.get_source(),
+ self.get_sink().get_parent(),
+ self.get_sink(),
+ )
+
+ def is_connection(self): return True
+
+ def validate(self):
+ """
+ Validate the connections.
+ The ports must match in type.
+ """
+ Element.validate(self)
+ source_type = self.get_source().get_type()
+ sink_type = self.get_sink().get_type()
+ if source_type != sink_type:
+ self.add_error_message('Source type "%s" does not match sink type "%s".'%(source_type, sink_type))
+
+ def get_enabled(self):
+ """
+ Get the enabled state of this connection.
+ @return true if source and sink blocks are enabled
+ """
+ return self.get_source().get_parent().get_enabled() and \
+ self.get_sink().get_parent().get_enabled()
+
+ #############################
+ # Access Ports
+ #############################
+ def get_sink(self): return self._sink
+ def get_source(self): return self._source
+
+ ##############################################
+ ## Import/Export Methods
+ ##############################################
+ def export_data(self):
+ """
+ Export this connection's info.
+ @return a nested data odict
+ """
+ n = odict()
+ n['source_block_id'] = self.get_source().get_parent().get_id()
+ n['sink_block_id'] = self.get_sink().get_parent().get_id()
+ n['source_key'] = self.get_source().get_key()
+ n['sink_key'] = self.get_sink().get_key()
+ return n
diff --git a/grc/base/Constants.py b/grc/base/Constants.py
new file mode 100644
index 000000000..ef45be8df
--- /dev/null
+++ b/grc/base/Constants.py
@@ -0,0 +1,25 @@
+"""
+Copyright 2008, 2009 Free Software Foundation, Inc.
+This file is part of GNU Radio
+
+GNU Radio Companion 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 2
+of the License, or (at your option) any later version.
+
+GNU Radio Companion 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 this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+"""
+
+import os
+
+#data files
+DATA_DIR = os.path.dirname(__file__)
+FLOW_GRAPH_DTD = os.path.join(DATA_DIR, 'flow_graph.dtd')
+BLOCK_TREE_DTD = os.path.join(DATA_DIR, 'block_tree.dtd')
diff --git a/grc/base/Element.py b/grc/base/Element.py
new file mode 100644
index 000000000..a57090f3b
--- /dev/null
+++ b/grc/base/Element.py
@@ -0,0 +1,89 @@
+"""
+Copyright 2008, 2009 Free Software Foundation, Inc.
+This file is part of GNU Radio
+
+GNU Radio Companion 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 2
+of the License, or (at your option) any later version.
+
+GNU Radio Companion 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 this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+"""
+
+class Element(object):
+
+ def __init__(self, parent=None):
+ self._parent = parent
+
+ ##################################################
+ # Element Validation API
+ ##################################################
+ def validate(self):
+ """
+ Validate this element and call validate on all children.
+ Call this base method before adding error messages in the subclass.
+ """
+ self._error_messages = list()
+ for child in self.get_children(): child.validate()
+
+ def is_valid(self):
+ """
+ Is this element valid?
+ @return true when the element is enabled and has no error messages
+ """
+ return not self.get_error_messages() or not self.get_enabled()
+
+ def add_error_message(self, msg):
+ """
+ Add an error message to the list of errors.
+ @param msg the error message string
+ """
+ self._error_messages.append(msg)
+
+ def get_error_messages(self):
+ """
+ Get the list of error messages from this element and all of its children.
+ Do not include the error messages from disabled children.
+ Cleverly indent the children error messages for printing purposes.
+ @return a list of error message strings
+ """
+ error_messages = list(self._error_messages) #make a copy
+ for child in filter(lambda c: c.get_enabled(), self.get_children()):
+ for msg in child.get_error_messages():
+ error_messages.append("%s:\n\t%s"%(child, msg.replace("\n", "\n\t")))
+ return error_messages
+
+ def rewrite(self):
+ """
+ Rewrite this element and call rewrite on all children.
+ Call this base method before rewriting the element.
+ """
+ for child in self.get_children(): child.rewrite()
+
+ def get_enabled(self): return True
+
+ ##############################################
+ ## Tree-like API
+ ##############################################
+ def get_parent(self): return self._parent
+ def get_children(self): return list()
+
+ ##############################################
+ ## Type testing methods
+ ##############################################
+ def is_element(self): return True
+ def is_platform(self): return False
+ def is_flow_graph(self): return False
+ def is_connection(self): return False
+ def is_block(self): return False
+ def is_source(self): return False
+ def is_sink(self): return False
+ def is_port(self): return False
+ def is_param(self): return False
diff --git a/grc/base/FlowGraph.py b/grc/base/FlowGraph.py
new file mode 100644
index 000000000..0ba1f2389
--- /dev/null
+++ b/grc/base/FlowGraph.py
@@ -0,0 +1,219 @@
+"""
+Copyright 2008-2011 Free Software Foundation, Inc.
+This file is part of GNU Radio
+
+GNU Radio Companion 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 2
+of the License, or (at your option) any later version.
+
+GNU Radio Companion 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 this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+"""
+
+from . import odict
+from Element import Element
+from .. gui import Messages
+
+class FlowGraph(Element):
+
+ def __init__(self, platform):
+ """
+ Make a flow graph from the arguments.
+ @param platform a platforms with blocks and contrcutors
+ @return the flow graph object
+ """
+ #initialize
+ Element.__init__(self, platform)
+ #inital blank import
+ self.import_data()
+
+ def _get_unique_id(self, base_id=''):
+ """
+ Get a unique id starting with the base id.
+ @param base_id the id starts with this and appends a count
+ @return a unique id
+ """
+ index = 0
+ while True:
+ id = '%s_%d'%(base_id, index)
+ index = index + 1
+ #make sure that the id is not used by another block
+ if not filter(lambda b: b.get_id() == id, self.get_blocks()): return id
+
+ def __str__(self): return 'FlowGraph - %s(%s)'%(self.get_option('title'), self.get_option('id'))
+
+ def get_option(self, key):
+ """
+ Get the option for a given key.
+ The option comes from the special options block.
+ @param key the param key for the options block
+ @return the value held by that param
+ """
+ return self._options_block.get_param(key).get_evaluated()
+
+ def is_flow_graph(self): return True
+
+ ##############################################
+ ## Access Elements
+ ##############################################
+ def get_block(self, id): return filter(lambda b: b.get_id() == id, self.get_blocks())[0]
+ def get_blocks(self): return filter(lambda e: e.is_block(), self.get_elements())
+ def get_connections(self): return filter(lambda e: e.is_connection(), self.get_elements())
+ def get_children(self): return self.get_elements()
+ def get_elements(self):
+ """
+ Get a list of all the elements.
+ Always ensure that the options block is in the list (only once).
+ @return the element list
+ """
+ options_block_count = self._elements.count(self._options_block)
+ if not options_block_count:
+ self._elements.append(self._options_block)
+ for i in range(options_block_count-1):
+ self._elements.remove(self._options_block)
+ return self._elements
+
+ def get_enabled_blocks(self):
+ """
+ Get a list of all blocks that are enabled.
+ @return a list of blocks
+ """
+ return filter(lambda b: b.get_enabled(), self.get_blocks())
+
+ def get_enabled_connections(self):
+ """
+ Get a list of all connections that are enabled.
+ @return a list of connections
+ """
+ return filter(lambda c: c.get_enabled(), self.get_connections())
+
+ def get_new_block(self, key):
+ """
+ Get a new block of the specified key.
+ Add the block to the list of elements.
+ @param key the block key
+ @return the new block or None if not found
+ """
+ if key not in self.get_parent().get_block_keys(): return None
+ block = self.get_parent().get_new_block(self, key)
+ self.get_elements().append(block)
+ return block
+
+ def connect(self, porta, portb):
+ """
+ Create a connection between porta and portb.
+ @param porta a port
+ @param portb another port
+ @throw Exception bad connection
+ @return the new connection
+ """
+ connection = self.get_parent().Connection(flow_graph=self, porta=porta, portb=portb)
+ self.get_elements().append(connection)
+ return connection
+
+ def remove_element(self, element):
+ """
+ Remove the element from the list of elements.
+ If the element is a port, remove the whole block.
+ If the element is a block, remove its connections.
+ If the element is a connection, just remove the connection.
+ """
+ if element not in self.get_elements(): return
+ #found a port, set to parent signal block
+ if element.is_port():
+ element = element.get_parent()
+ #remove block, remove all involved connections
+ if element.is_block():
+ for port in element.get_ports():
+ map(self.remove_element, port.get_connections())
+ self.get_elements().remove(element)
+
+ def evaluate(self, expr):
+ """
+ Evaluate the expression.
+ @param expr the string expression
+ @throw NotImplementedError
+ """
+ raise NotImplementedError
+
+ ##############################################
+ ## Import/Export Methods
+ ##############################################
+ def export_data(self):
+ """
+ Export this flow graph to nested data.
+ Export all block and connection data.
+ @return a nested data odict
+ """
+ import time
+ n = odict()
+ n['timestamp'] = time.ctime()
+ n['block'] = [block.export_data() for block in self.get_blocks()]
+ n['connection'] = [connection.export_data() for connection in self.get_connections()]
+ return odict({'flow_graph': n})
+
+ def import_data(self, n=None):
+ """
+ Import blocks and connections into this flow graph.
+ Clear this flowgraph of all previous blocks and connections.
+ Any blocks or connections in error will be ignored.
+ @param n the nested data odict
+ """
+ #remove previous elements
+ self._elements = list()
+ #use blank data if none provided
+ fg_n = n and n.find('flow_graph') or odict()
+ blocks_n = fg_n.findall('block')
+ connections_n = fg_n.findall('connection')
+ #create option block
+ self._options_block = self.get_parent().get_new_block(self, 'options')
+ #build the blocks
+ for block_n in blocks_n:
+ key = block_n.find('key')
+ if key == 'options': block = self._options_block
+ else: block = self.get_new_block(key)
+ #only load the block when the block key was valid
+ if block: block.import_data(block_n)
+ else: Messages.send_error_load('Block key "%s" not found in %s'%(key, self.get_parent()))
+ #build the connections
+ for connection_n in connections_n:
+ #try to make the connection
+ try:
+ #get the block ids
+ source_block_id = connection_n.find('source_block_id')
+ sink_block_id = connection_n.find('sink_block_id')
+ #get the port keys
+ source_key = connection_n.find('source_key')
+ sink_key = connection_n.find('sink_key')
+ #verify the blocks
+ block_ids = map(lambda b: b.get_id(), self.get_blocks())
+ if source_block_id not in block_ids:
+ raise LookupError('source block id "%s" not in block ids'%source_block_id)
+ if sink_block_id not in block_ids:
+ raise LookupError('sink block id "%s" not in block ids'%sink_block_id)
+ #get the blocks
+ source_block = self.get_block(source_block_id)
+ sink_block = self.get_block(sink_block_id)
+ #verify the ports
+ if source_key not in source_block.get_source_keys():
+ raise LookupError('source key "%s" not in source block keys'%source_key)
+ if sink_key not in sink_block.get_sink_keys():
+ raise LookupError('sink key "%s" not in sink block keys'%sink_key)
+ #get the ports
+ source = source_block.get_source(source_key)
+ sink = sink_block.get_sink(sink_key)
+ #build the connection
+ self.connect(source, sink)
+ except LookupError, e: Messages.send_error_load(
+ 'Connection between %s(%s) and %s(%s) could not be made.\n\t%s'%(
+ source_block_id, source_key, sink_block_id, sink_key, e
+ )
+ )
+ self.rewrite() #global rewrite
diff --git a/grc/base/Param.py b/grc/base/Param.py
new file mode 100644
index 000000000..c2fa5461a
--- /dev/null
+++ b/grc/base/Param.py
@@ -0,0 +1,181 @@
+"""
+Copyright 2008-2011 Free Software Foundation, Inc.
+This file is part of GNU Radio
+
+GNU Radio Companion 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 2
+of the License, or (at your option) any later version.
+
+GNU Radio Companion 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 this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+"""
+
+from . import odict
+from Element import Element
+
+def _get_keys(lst): return [elem.get_key() for elem in lst]
+def _get_elem(lst, key):
+ try: return lst[_get_keys(lst).index(key)]
+ except ValueError: raise ValueError, 'Key "%s" not found in %s.'%(key, _get_keys(lst))
+
+class Option(Element):
+
+ def __init__(self, param, n):
+ Element.__init__(self, param)
+ self._name = n.find('name')
+ self._key = n.find('key')
+ self._opts = dict()
+ opts = n.findall('opt')
+ #test against opts when non enum
+ if not self.get_parent().is_enum() and opts:
+ raise Exception, 'Options for non-enum types cannot have sub-options'
+ #extract opts
+ for opt in opts:
+ #separate the key:value
+ try: key, value = opt.split(':')
+ except: raise Exception, 'Error separating "%s" into key:value'%opt
+ #test against repeated keys
+ if self._opts.has_key(key):
+ raise Exception, 'Key "%s" already exists in option'%key
+ #store the option
+ self._opts[key] = value
+
+ def __str__(self): return 'Option %s(%s)'%(self.get_name(), self.get_key())
+ def get_name(self): return self._name
+ def get_key(self): return self._key
+
+ ##############################################
+ # Access Opts
+ ##############################################
+ def get_opt_keys(self): return self._opts.keys()
+ def get_opt(self, key): return self._opts[key]
+ def get_opts(self): return self._opts.values()
+
+class Param(Element):
+
+ def __init__(self, block, n):
+ """
+ Make a new param from nested data.
+ @param block the parent element
+ @param n the nested odict
+ """
+ #grab the data
+ self._name = n.find('name')
+ self._key = n.find('key')
+ value = n.find('value') or ''
+ self._type = n.find('type')
+ self._hide = n.find('hide') or ''
+ #build the param
+ Element.__init__(self, block)
+ #create the Option objects from the n data
+ self._options = list()
+ for option in map(lambda o: Option(param=self, n=o), n.findall('option')):
+ key = option.get_key()
+ #test against repeated keys
+ if key in self.get_option_keys():
+ raise Exception, 'Key "%s" already exists in options'%key
+ #store the option
+ self.get_options().append(option)
+ #test the enum options
+ if self.is_enum():
+ #test against options with identical keys
+ if len(set(self.get_option_keys())) != len(self.get_options()):
+ raise Exception, 'Options keys "%s" are not unique.'%self.get_option_keys()
+ #test against inconsistent keys in options
+ opt_keys = self.get_options()[0].get_opt_keys()
+ for option in self.get_options():
+ if set(opt_keys) != set(option.get_opt_keys()):
+ raise Exception, 'Opt keys "%s" are not identical across all options.'%opt_keys
+ #if a value is specified, it must be in the options keys
+ self._value = value if value or value in self.get_option_keys() else self.get_option_keys()[0]
+ if self.get_value() not in self.get_option_keys():
+ raise Exception, 'The value "%s" is not in the possible values of "%s".'%(self.get_value(), self.get_option_keys())
+ else: self._value = value or ''
+
+ def validate(self):
+ """
+ Validate the param.
+ The value must be evaluated and type must a possible type.
+ """
+ Element.validate(self)
+ if self.get_type() not in self.get_types():
+ self.add_error_message('Type "%s" is not a possible type.'%self.get_type())
+
+ def get_evaluated(self): raise NotImplementedError
+
+ def to_code(self):
+ """
+ Convert the value to code.
+ @throw NotImplementedError
+ """
+ raise NotImplementedError
+
+ def get_types(self):
+ """
+ Get a list of all possible param types.
+ @throw NotImplementedError
+ """
+ raise NotImplementedError
+
+ def get_color(self): return '#FFFFFF'
+ def __str__(self): return 'Param - %s(%s)'%(self.get_name(), self.get_key())
+ def is_param(self): return True
+ def get_name(self): return self._name
+ def get_key(self): return self._key
+ def get_hide(self): return self.get_parent().resolve_dependencies(self._hide).strip()
+
+ def get_value(self):
+ value = self._value
+ if self.is_enum() and value not in self.get_option_keys():
+ value = self.get_option_keys()[0]
+ self.set_value(value)
+ return value
+
+ def set_value(self, value): self._value = str(value) #must be a string
+
+ def get_type(self): return self.get_parent().resolve_dependencies(self._type)
+ def is_enum(self): return self._type == 'enum'
+
+ def __repr__(self):
+ """
+ Get the repr (nice string format) for this param.
+ Just return the value (special case enum).
+ Derived classes can handle complex formatting.
+ @return the string representation
+ """
+ if self.is_enum(): return self.get_option(self.get_value()).get_name()
+ return self.get_value()
+
+ ##############################################
+ # Access Options
+ ##############################################
+ def get_option_keys(self): return _get_keys(self.get_options())
+ def get_option(self, key): return _get_elem(self.get_options(), key)
+ def get_options(self): return self._options
+
+ ##############################################
+ # Access Opts
+ ##############################################
+ def get_opt_keys(self): return self.get_option(self.get_value()).get_opt_keys()
+ def get_opt(self, key): return self.get_option(self.get_value()).get_opt(key)
+ def get_opts(self): return self.get_option(self.get_value()).get_opts()
+
+ ##############################################
+ ## Import/Export Methods
+ ##############################################
+ def export_data(self):
+ """
+ Export this param's key/value.
+ @return a nested data odict
+ """
+ n = odict()
+ n['key'] = self.get_key()
+ n['value'] = self.get_value()
+ return n
diff --git a/grc/base/ParseXML.py b/grc/base/ParseXML.py
new file mode 100644
index 000000000..078ebd078
--- /dev/null
+++ b/grc/base/ParseXML.py
@@ -0,0 +1,102 @@
+"""
+Copyright 2008 Free Software Foundation, Inc.
+This file is part of GNU Radio
+
+GNU Radio Companion 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 2
+of the License, or (at your option) any later version.
+
+GNU Radio Companion 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 this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+"""
+
+from lxml import etree
+from . import odict
+
+class XMLSyntaxError(Exception):
+ def __init__(self, error_log):
+ self._error_log = error_log
+ def __str__(self):
+ return '\n'.join(map(str, self._error_log.filter_from_errors()))
+
+def validate_dtd(xml_file, dtd_file=None):
+ """
+ Validate an xml file against its dtd.
+ @param xml_file the xml file
+ @param dtd_file the optional dtd file
+ @throws Exception validation fails
+ """
+ #perform parsing, use dtd validation if dtd file is not specified
+ parser = etree.XMLParser(dtd_validation=not dtd_file)
+ xml = etree.parse(xml_file, parser=parser)
+ if parser.error_log: raise XMLSyntaxError(parser.error_log)
+ #perform dtd validation if the dtd file is specified
+ if not dtd_file: return
+ dtd = etree.DTD(dtd_file)
+ if not dtd.validate(xml.getroot()): raise XMLSyntaxError(dtd.error_log)
+
+def from_file(xml_file):
+ """
+ Create nested data from an xml file using the from xml helper.
+ @param xml_file the xml file path
+ @return the nested data
+ """
+ xml = etree.parse(xml_file).getroot()
+ return _from_file(xml)
+
+def _from_file(xml):
+ """
+ Recursivly parse the xml tree into nested data format.
+ @param xml the xml tree
+ @return the nested data
+ """
+ tag = xml.tag
+ if not len(xml):
+ return odict({tag: xml.text or ''}) #store empty tags (text is None) as empty string
+ nested_data = odict()
+ for elem in xml:
+ key, value = _from_file(elem).items()[0]
+ if nested_data.has_key(key): nested_data[key].append(value)
+ else: nested_data[key] = [value]
+ #delistify if the length of values is 1
+ for key, values in nested_data.iteritems():
+ if len(values) == 1: nested_data[key] = values[0]
+ return odict({tag: nested_data})
+
+def to_file(nested_data, xml_file):
+ """
+ Write an xml file and use the to xml helper method to load it.
+ @param nested_data the nested data
+ @param xml_file the xml file path
+ """
+ xml = _to_file(nested_data)[0]
+ open(xml_file, 'w').write(etree.tostring(xml, xml_declaration=True, pretty_print=True))
+
+def _to_file(nested_data):
+ """
+ Recursivly parse the nested data into xml tree format.
+ @param nested_data the nested data
+ @return the xml tree filled with child nodes
+ """
+ nodes = list()
+ for key, values in nested_data.iteritems():
+ #listify the values if not a list
+ if not isinstance(values, (list, set, tuple)):
+ values = [values]
+ for value in values:
+ node = etree.Element(key)
+ if isinstance(value, (str, unicode)): node.text = value
+ else: node.extend(_to_file(value))
+ nodes.append(node)
+ return nodes
+
+if __name__ == '__main__':
+ """Use the main method to test parse xml's functions."""
+ pass
diff --git a/grc/base/Platform.py b/grc/base/Platform.py
new file mode 100644
index 000000000..d4b09088b
--- /dev/null
+++ b/grc/base/Platform.py
@@ -0,0 +1,178 @@
+"""
+Copyright 2008-2011 Free Software Foundation, Inc.
+This file is part of GNU Radio
+
+GNU Radio Companion 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 2
+of the License, or (at your option) any later version.
+
+GNU Radio Companion 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 this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+"""
+
+import os
+import sys
+from .. base import ParseXML, odict
+from Element import Element as _Element
+from FlowGraph import FlowGraph as _FlowGraph
+from Connection import Connection as _Connection
+from Block import Block as _Block
+from Port import Port as _Port
+from Param import Param as _Param
+from Constants import BLOCK_TREE_DTD, FLOW_GRAPH_DTD
+
+class Platform(_Element):
+
+ def __init__(self, name, version, key,
+ block_paths, block_dtd, default_flow_graph, generator,
+ license='', website=None, colors=[]):
+ """
+ Make a platform from the arguments.
+ @param name the platform name
+ @param version the version string
+ @param key the unique platform key
+ @param block_paths the file paths to blocks in this platform
+ @param block_dtd the dtd validator for xml block wrappers
+ @param default_flow_graph the default flow graph file path
+ @param generator the generator class for this platform
+ @param colors a list of title, color_spec tuples
+ @param license a multi-line license (first line is copyright)
+ @param website the website url for this platform
+ @return a platform object
+ """
+ _Element.__init__(self)
+ self._name = name
+ self._version = version
+ self._key = key
+ self._license = license
+ self._website = website
+ self._block_paths = block_paths
+ self._block_dtd = block_dtd
+ self._default_flow_graph = default_flow_graph
+ self._generator = generator
+ self._colors = colors
+ #create a dummy flow graph for the blocks
+ self._flow_graph = _Element(self)
+ #search for *.xml files in the given search path
+
+ self.loadblocks();
+
+ def loadblocks(self):
+ xml_files = list()
+ for block_path in self._block_paths:
+ if os.path.isfile(block_path): xml_files.append(block_path)
+ elif os.path.isdir(block_path):
+ for dirpath, dirnames, filenames in os.walk(block_path):
+ for filename in sorted(filter(lambda f: f.endswith('.xml'), filenames)):
+ xml_files.append(os.path.join(dirpath, filename))
+ #load the blocks
+ self._blocks = odict()
+ self._blocks_n = odict()
+ self._block_tree_files = list()
+ for xml_file in xml_files:
+ try: #try to add the xml file as a block wrapper
+ ParseXML.validate_dtd(xml_file, self._block_dtd)
+ n = ParseXML.from_file(xml_file).find('block')
+ #inject block wrapper path
+ n['block_wrapper_path'] = xml_file
+ block = self.Block(self._flow_graph, n)
+ key = block.get_key()
+ #test against repeated keys
+ if key in self.get_block_keys():
+ print >> sys.stderr, 'Warning: Block with key "%s" already exists.\n\tIgnoring: %s'%(key, xml_file)
+ #store the block
+ else:
+ self._blocks[key] = block
+ self._blocks_n[key] = n
+ except ParseXML.XMLSyntaxError, e:
+ try: #try to add the xml file as a block tree
+ ParseXML.validate_dtd(xml_file, BLOCK_TREE_DTD)
+ self._block_tree_files.append(xml_file)
+ except ParseXML.XMLSyntaxError, e:
+ print >> sys.stderr, 'Warning: Block validation failed:\n\t%s\n\tIgnoring: %s'%(e, xml_file)
+ except Exception, e:
+ print >> sys.stderr, 'Warning: Block loading failed:\n\t%s\n\tIgnoring: %s'%(e, xml_file)
+
+ def parse_flow_graph(self, flow_graph_file):
+ """
+ Parse a saved flow graph file.
+ Ensure that the file exists, and passes the dtd check.
+ @param flow_graph_file the flow graph file
+ @return nested data
+ @throws exception if the validation fails
+ """
+ flow_graph_file = flow_graph_file or self._default_flow_graph
+ open(flow_graph_file, 'r') #test open
+ ParseXML.validate_dtd(flow_graph_file, FLOW_GRAPH_DTD)
+ return ParseXML.from_file(flow_graph_file)
+
+ def load_block_tree(self, block_tree):
+ """
+ Load a block tree with categories and blocks.
+ Step 1: Load all blocks from the xml specification.
+ Step 2: Load blocks with builtin category specifications.
+ @param block_tree the block tree object
+ """
+ #recursive function to load categories and blocks
+ def load_category(cat_n, parent=[]):
+ #add this category
+ parent = parent + [cat_n.find('name')]
+ block_tree.add_block(parent)
+ #recursive call to load sub categories
+ map(lambda c: load_category(c, parent), cat_n.findall('cat'))
+ #add blocks in this category
+ for block_key in cat_n.findall('block'):
+ if block_key not in self.get_block_keys():
+ print >> sys.stderr, 'Warning: Block key "%s" not found when loading category tree.'%(block_key)
+ continue
+ block = self.get_block(block_key)
+ #if it exists, the block's category overrides the block tree
+ if not block.get_category(): block_tree.add_block(parent, block)
+ #load the block tree
+ for block_tree_file in self._block_tree_files:
+ #recursivly add all blocks in the tree
+ load_category(ParseXML.from_file(block_tree_file).find('cat'))
+ #add all other blocks, use the catgory tag
+ for block in self.get_blocks():
+ #blocks with empty categories are in the xml block tree or hidden
+ if not block.get_category(): continue
+ block_tree.add_block(block.get_category(), block)
+
+ def __str__(self): return 'Platform - %s(%s)'%(self.get_key(), self.get_name())
+
+ def is_platform(self): return True
+
+ def get_new_flow_graph(self): return self.FlowGraph(platform=self)
+
+ def get_generator(self): return self._generator
+
+ ##############################################
+ # Access Blocks
+ ##############################################
+ def get_block_keys(self): return self._blocks.keys()
+ def get_block(self, key): return self._blocks[key]
+ def get_blocks(self): return self._blocks.values()
+ def get_new_block(self, flow_graph, key): return self.Block(flow_graph, n=self._blocks_n[key])
+
+ def get_name(self): return self._name
+ def get_version(self): return self._version
+ def get_key(self): return self._key
+ def get_license(self): return self._license
+ def get_website(self): return self._website
+ def get_colors(self): return self._colors
+
+ ##############################################
+ # Constructors
+ ##############################################
+ FlowGraph = _FlowGraph
+ Connection = _Connection
+ Block = _Block
+ Port = _Port
+ Param = _Param
diff --git a/grc/base/Port.py b/grc/base/Port.py
new file mode 100644
index 000000000..7a1b5d4e6
--- /dev/null
+++ b/grc/base/Port.py
@@ -0,0 +1,83 @@
+"""
+Copyright 2008-2011 Free Software Foundation, Inc.
+This file is part of GNU Radio
+
+GNU Radio Companion 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 2
+of the License, or (at your option) any later version.
+
+GNU Radio Companion 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 this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+"""
+
+from Element import Element
+
+class Port(Element):
+
+ def __init__(self, block, n, dir):
+ """
+ Make a new port from nested data.
+ @param block the parent element
+ @param n the nested odict
+ @param dir the direction source or sink
+ """
+ #build the port
+ Element.__init__(self, block)
+ #grab the data
+ self._name = n['name']
+ self._key = n['key']
+ self._type = n['type']
+ self._dir = dir
+
+ def validate(self):
+ """
+ Validate the port.
+ The port must be non-empty and type must a possible type.
+ """
+ Element.validate(self)
+ if self.get_type() not in self.get_types():
+ self.add_error_message('Type "%s" is not a possible type.'%self.get_type())
+
+ def __str__(self):
+ if self.is_source():
+ return 'Source - %s(%s)'%(self.get_name(), self.get_key())
+ if self.is_sink():
+ return 'Sink - %s(%s)'%(self.get_name(), self.get_key())
+
+ def get_types(self):
+ """
+ Get a list of all possible port types.
+ @throw NotImplementedError
+ """
+ raise NotImplementedError
+
+ def is_port(self): return True
+ def get_color(self): return '#FFFFFF'
+ def get_name(self): return self._name
+ def get_key(self): return self._key
+ def is_sink(self): return self._dir == 'sink'
+ def is_source(self): return self._dir == 'source'
+ def get_type(self): return self.get_parent().resolve_dependencies(self._type)
+
+ def get_connections(self):
+ """
+ Get all connections that use this port.
+ @return a list of connection objects
+ """
+ connections = self.get_parent().get_parent().get_connections()
+ connections = filter(lambda c: c.get_source() is self or c.get_sink() is self, connections)
+ return connections
+
+ def get_enabled_connections(self):
+ """
+ Get all enabled connections that use this port.
+ @return a list of connection objects
+ """
+ return filter(lambda c: c.get_enabled(), self.get_connections())
diff --git a/grc/base/__init__.py b/grc/base/__init__.py
new file mode 100644
index 000000000..2682db812
--- /dev/null
+++ b/grc/base/__init__.py
@@ -0,0 +1,20 @@
+"""
+Copyright 2009 Free Software Foundation, Inc.
+This file is part of GNU Radio
+
+GNU Radio Companion 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 2
+of the License, or (at your option) any later version.
+
+GNU Radio Companion 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 this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+"""
+
+from odict import odict
diff --git a/grc/base/block_tree.dtd b/grc/base/block_tree.dtd
new file mode 100644
index 000000000..7d4a13ccc
--- /dev/null
+++ b/grc/base/block_tree.dtd
@@ -0,0 +1,26 @@
+<!--
+Copyright 2008 Free Software Foundation, Inc.
+This file is part of GNU Radio
+
+GNU Radio Companion 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 2
+of the License, or (at your option) any later version.
+
+GNU Radio Companion 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 this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+-->
+<!--
+ block_tree.dtd
+ Josh Blum
+ The document type definition for a block tree category listing.
+ -->
+<!ELEMENT cat (name, cat*, block*)>
+<!ELEMENT name (#PCDATA)>
+<!ELEMENT block (#PCDATA)>
diff --git a/grc/base/flow_graph.dtd b/grc/base/flow_graph.dtd
new file mode 100644
index 000000000..74f48f10a
--- /dev/null
+++ b/grc/base/flow_graph.dtd
@@ -0,0 +1,36 @@
+<!--
+Copyright 2008 Free Software Foundation, Inc.
+This file is part of GNU Radio
+
+GNU Radio Companion 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 2
+of the License, or (at your option) any later version.
+
+GNU Radio Companion 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 this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+-->
+<!--
+ flow_graph.dtd
+ Josh Blum
+ The document type definition for flow graph xml files.
+ -->
+<!ELEMENT flow_graph (timestamp?, block*, connection*)> <!-- optional timestamp -->
+<!ELEMENT timestamp (#PCDATA)>
+<!-- Block -->
+<!ELEMENT block (key, param*)>
+<!ELEMENT param (key, value)>
+<!ELEMENT key (#PCDATA)>
+<!ELEMENT value (#PCDATA)>
+<!-- Connection -->
+<!ELEMENT connection (source_block_id, sink_block_id, source_key, sink_key)>
+<!ELEMENT source_block_id (#PCDATA)>
+<!ELEMENT sink_block_id (#PCDATA)>
+<!ELEMENT source_key (#PCDATA)>
+<!ELEMENT sink_key (#PCDATA)>
diff --git a/grc/base/odict.py b/grc/base/odict.py
new file mode 100644
index 000000000..044d04ad7
--- /dev/null
+++ b/grc/base/odict.py
@@ -0,0 +1,93 @@
+"""
+Copyright 2008-2011 Free Software Foundation, Inc.
+This file is part of GNU Radio
+
+GNU Radio Companion 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 2
+of the License, or (at your option) any later version.
+
+GNU Radio Companion 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 this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+"""
+
+from UserDict import DictMixin
+
+class odict(DictMixin):
+
+ def __init__(self, d={}):
+ self._keys = list(d.keys())
+ self._data = dict(d.copy())
+
+ def __setitem__(self, key, value):
+ if key not in self._data:
+ self._keys.append(key)
+ self._data[key] = value
+
+ def __getitem__(self, key):
+ return self._data[key]
+
+ def __delitem__(self, key):
+ del self._data[key]
+ self._keys.remove(key)
+
+ def keys(self):
+ return list(self._keys)
+
+ def copy(self):
+ copy_dict = odict()
+ copy_dict._data = self._data.copy()
+ copy_dict._keys = list(self._keys)
+ return copy_dict
+
+ def insert_after(self, pos_key, key, val):
+ """
+ Insert the new key, value entry after the entry given by the position key.
+ If the positional key is None, insert at the end.
+ @param pos_key the positional key
+ @param key the key for the new entry
+ @param val the value for the new entry
+ """
+ index = (pos_key is None) and len(self._keys) or self._keys.index(pos_key)
+ if key in self._keys: raise KeyError('Cannot insert, key "%s" already exists'%str(key))
+ self._keys.insert(index+1, key)
+ self._data[key] = val
+
+ def insert_before(self, pos_key, key, val):
+ """
+ Insert the new key, value entry before the entry given by the position key.
+ If the positional key is None, insert at the begining.
+ @param pos_key the positional key
+ @param key the key for the new entry
+ @param val the value for the new entry
+ """
+ index = (pos_key is not None) and self._keys.index(pos_key) or 0
+ if key in self._keys: raise KeyError('Cannot insert, key "%s" already exists'%str(key))
+ self._keys.insert(index, key)
+ self._data[key] = val
+
+ def find(self, key):
+ """
+ Get the value for this key if exists.
+ @param key the key to search for
+ @return the value or None
+ """
+ if self.has_key(key): return self[key]
+ return None
+
+ def findall(self, key):
+ """
+ Get a list of values for this key.
+ @param key the key to search for
+ @return a list of values or empty list
+ """
+ obj = self.find(key)
+ if obj is None: obj = list()
+ if isinstance(obj, list): return obj
+ return [obj]
diff --git a/grc/blocks/CMakeLists.txt b/grc/blocks/CMakeLists.txt
new file mode 100644
index 000000000..fce4a1907
--- /dev/null
+++ b/grc/blocks/CMakeLists.txt
@@ -0,0 +1,22 @@
+# Copyright 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.
+
+########################################################################
+file(GLOB xml_files "*.xml")
+install(FILES ${xml_files} DESTINATION ${GRC_BLOCKS_DIR} COMPONENT "grc")
diff --git a/grc/blocks/band_pass_filter.xml b/grc/blocks/band_pass_filter.xml
new file mode 100644
index 000000000..af083473d
--- /dev/null
+++ b/grc/blocks/band_pass_filter.xml
@@ -0,0 +1,166 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Band Pass Filter: Custom wrapper
+###################################################
+ -->
+<block>
+ <name>Band Pass Filter</name>
+ <key>band_pass_filter</key>
+ <import>from gnuradio import gr</import>
+ <import>from gnuradio.gr import firdes</import>
+ <make>gr.$(type)(#if str($type).startswith('interp') then $interp else $decim#, firdes.$(type.fcn)(
+ $gain, $samp_rate, $low_cutoff_freq, $high_cutoff_freq, $width, $win, $beta))</make>
+ <callback>set_taps(firdes.$(type.fcn)($gain, $samp_rate, $low_cutoff_freq, $high_cutoff_freq, $width, $win, $beta))</callback>
+ <param>
+ <name>FIR Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <!-- Real Band Pass Taps -->
+ <option>
+ <name>Complex->Complex (Real Taps) (Decim)</name>
+ <key>fir_filter_ccf</key>
+ <opt>input:complex</opt>
+ <opt>output:complex</opt>
+ <opt>fcn:band_pass</opt>
+ </option>
+ <option>
+ <name>Complex->Complex (Real Taps) (Interp)</name>
+ <key>interp_fir_filter_ccf</key>
+ <opt>input:complex</opt>
+ <opt>output:complex</opt>
+ <opt>fcn:band_pass</opt>
+ </option>
+ <option>
+ <name>Float->Float (Real Taps) (Decim)</name>
+ <key>fir_filter_fff</key>
+ <opt>input:float</opt>
+ <opt>output:float</opt>
+ <opt>fcn:band_pass</opt>
+ </option>
+ <option>
+ <name>Float->Float (Real Taps) (Interp)</name>
+ <key>interp_fir_filter_fff</key>
+ <opt>input:float</opt>
+ <opt>output:float</opt>
+ <opt>fcn:band_pass</opt>
+ </option>
+ <!-- Complex Band Pass Taps -->
+ <option>
+ <name>Complex->Complex (Complex Taps) (Decim)</name>
+ <key>fir_filter_ccc</key>
+ <opt>input:complex</opt>
+ <opt>output:complex</opt>
+ <opt>fcn:complex_band_pass</opt>
+ </option>
+ <option>
+ <name>Complex->Complex (Complex Taps) (Interp)</name>
+ <key>interp_fir_filter_ccc</key>
+ <opt>input:complex</opt>
+ <opt>output:complex</opt>
+ <opt>fcn:complex_band_pass</opt>
+ </option>
+ <option>
+ <name>Float->Complex (Complex Taps) (Decim)</name>
+ <key>fir_filter_fcc</key>
+ <opt>input:float</opt>
+ <opt>output:complex</opt>
+ <opt>fcn:complex_band_pass</opt>
+ </option>
+ <option>
+ <name>Float->Complex (Complex Taps) (Interp)</name>
+ <key>interp_fir_filter_fcc</key>
+ <opt>input:float</opt>
+ <opt>output:complex</opt>
+ <opt>fcn:complex_band_pass</opt>
+ </option>
+ </param>
+ <param>
+ <name>Decimation</name>
+ <key>decim</key>
+ <value>1</value>
+ <type>int</type>
+ <hide>#if str($type).startswith('interp') then 'all' else 'none'#</hide>
+ </param>
+ <param>
+ <name>Interpolation</name>
+ <key>interp</key>
+ <value>1</value>
+ <type>int</type>
+ <hide>#if str($type).startswith('interp') then 'none' else 'all'#</hide>
+ </param>
+ <param>
+ <name>Gain</name>
+ <key>gain</key>
+ <value>1</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Sample Rate</name>
+ <key>samp_rate</key>
+ <value>samp_rate</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Low Cutoff Freq</name>
+ <key>low_cutoff_freq</key>
+ <type>real</type>
+ </param>
+ <param>
+ <name>High Cutoff Freq</name>
+ <key>high_cutoff_freq</key>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Transition Width</name>
+ <key>width</key>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Window</name>
+ <key>win</key>
+ <value>firdes.WIN_HAMMING</value>
+ <type>int</type>
+ <option>
+ <name>Hamming</name>
+ <key>firdes.WIN_HAMMING</key>
+ </option>
+ <option>
+ <name>Hann</name>
+ <key>firdes.WIN_HANN</key>
+ </option>
+ <option>
+ <name>Blackman</name>
+ <key>firdes.WIN_BLACKMAN</key>
+ </option>
+ <option>
+ <name>Rectangular</name>
+ <key>firdes.WIN_RECTANGULAR</key>
+ </option>
+ <option>
+ <name>Kaiser</name>
+ <key>firdes.WIN_KAISER</key>
+ </option>
+ </param>
+ <param>
+ <name>Beta</name>
+ <key>beta</key>
+ <value>6.76</value>
+ <type>real</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>$type.input</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type.output</type>
+ </source>
+ <doc>
+This filter is a convenience wrapper for an fir filter and a firdes taps generating function.
+
+Sample rate, cutoff frequency, and transition width are in Hertz.
+
+The beta paramater only applies to the Kaiser window.
+ </doc>
+</block>
diff --git a/grc/blocks/band_reject_filter.xml b/grc/blocks/band_reject_filter.xml
new file mode 100644
index 000000000..dd5e7a9d7
--- /dev/null
+++ b/grc/blocks/band_reject_filter.xml
@@ -0,0 +1,132 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Band Reject Filter: Custom wrapper
+###################################################
+ -->
+<block>
+ <name>Band Reject Filter</name>
+ <key>band_reject_filter</key>
+ <import>from gnuradio import gr</import>
+ <import>from gnuradio.gr import firdes</import>
+ <make>gr.$(type)(#if str($type).startswith('interp') then $interp else $decim#, firdes.band_reject(
+ $gain, $samp_rate, $low_cutoff_freq, $high_cutoff_freq, $width, $win, $beta))</make>
+ <callback>set_taps(firdes.band_reject($gain, $samp_rate, $low_cutoff_freq, $high_cutoff_freq, $width, $win, $beta))</callback>
+ <param>
+ <name>FIR Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex->Complex (Decimating)</name>
+ <key>fir_filter_ccf</key>
+ <opt>input:complex</opt>
+ <opt>output:complex</opt>
+ </option>
+ <option>
+ <name>Complex->Complex (Interpolating)</name>
+ <key>interp_fir_filter_ccf</key>
+ <opt>input:complex</opt>
+ <opt>output:complex</opt>
+ </option>
+ <option>
+ <name>Float->Float (Decimating)</name>
+ <key>fir_filter_fff</key>
+ <opt>input:float</opt>
+ <opt>output:float</opt>
+ </option>
+ <option>
+ <name>Float->Float (Interpolating)</name>
+ <key>interp_fir_filter_fff</key>
+ <opt>input:float</opt>
+ <opt>output:float</opt>
+ </option>
+ </param>
+ <param>
+ <name>Decimation</name>
+ <key>decim</key>
+ <value>1</value>
+ <type>int</type>
+ <hide>#if str($type).startswith('interp') then 'all' else 'none'#</hide>
+ </param>
+ <param>
+ <name>Interpolation</name>
+ <key>interp</key>
+ <value>1</value>
+ <type>int</type>
+ <hide>#if str($type).startswith('interp') then 'none' else 'all'#</hide>
+ </param>
+ <param>
+ <name>Gain</name>
+ <key>gain</key>
+ <value>1</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Sample Rate</name>
+ <key>samp_rate</key>
+ <value>samp_rate</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Low Cutoff Freq</name>
+ <key>low_cutoff_freq</key>
+ <type>real</type>
+ </param>
+ <param>
+ <name>High Cutoff Freq</name>
+ <key>high_cutoff_freq</key>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Transition Width</name>
+ <key>width</key>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Window</name>
+ <key>win</key>
+ <value>firdes.WIN_HAMMING</value>
+ <type>int</type>
+ <option>
+ <name>Hamming</name>
+ <key>firdes.WIN_HAMMING</key>
+ </option>
+ <option>
+ <name>Hann</name>
+ <key>firdes.WIN_HANN</key>
+ </option>
+ <option>
+ <name>Blackman</name>
+ <key>firdes.WIN_BLACKMAN</key>
+ </option>
+ <option>
+ <name>Rectangular</name>
+ <key>firdes.WIN_RECTANGULAR</key>
+ </option>
+ <option>
+ <name>Kaiser</name>
+ <key>firdes.WIN_KAISER</key>
+ </option>
+ </param>
+ <param>
+ <name>Beta</name>
+ <key>beta</key>
+ <value>6.76</value>
+ <type>real</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>$type.input</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type.output</type>
+ </source>
+ <doc>
+This filter is a convenience wrapper for an fir filter and a firdes taps generating function.
+
+Sample rate, cutoff frequency, and transition width are in Hertz.
+
+The beta paramater only applies to the Kaiser window.
+ </doc>
+</block>
diff --git a/grc/blocks/blks2_am_demod_cf.xml b/grc/blocks/blks2_am_demod_cf.xml
new file mode 100644
index 000000000..898c613be
--- /dev/null
+++ b/grc/blocks/blks2_am_demod_cf.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##AM Demod
+###################################################
+ -->
+<block>
+ <name>AM Demod</name>
+ <key>blks2_am_demod_cf</key>
+ <import>from gnuradio import blks2</import>
+ <make>blks2.am_demod_cf(
+ channel_rate=$chan_rate,
+ audio_decim=$audio_decim,
+ audio_pass=$audio_pass,
+ audio_stop=$audio_stop,
+)</make>
+ <param>
+ <name>Channel Rate</name>
+ <key>chan_rate</key>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Audio Decimation</name>
+ <key>audio_decim</key>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Audio Pass</name>
+ <key>audio_pass</key>
+ <value>5000</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Audio Stop</name>
+ <key>audio_stop</key>
+ <value>5500</value>
+ <type>real</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>complex</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>float</type>
+ </source>
+</block>
diff --git a/grc/blocks/blks2_analysis_filterbank.xml b/grc/blocks/blks2_analysis_filterbank.xml
new file mode 100644
index 000000000..93cfa30af
--- /dev/null
+++ b/grc/blocks/blks2_analysis_filterbank.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Analysis Filterbank
+###################################################
+ -->
+<block>
+ <name>Analysis Filterbank</name>
+ <key>blks2_analysis_filterbank</key>
+ <import>from gnuradio import blks2</import>
+ <make>blks2.analysis_filterbank(mpoints=$mpoints, taps=$taps)</make>
+ <param>
+ <name>MPoints</name>
+ <key>mpoints</key>
+ <value>3</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Taps</name>
+ <key>taps</key>
+ <type>complex_vector</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>complex</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>complex</type>
+ <nports>$mpoints</nports>
+ </source>
+</block>
diff --git a/grc/blocks/blks2_error_rate.xml b/grc/blocks/blks2_error_rate.xml
new file mode 100644
index 000000000..91a303206
--- /dev/null
+++ b/grc/blocks/blks2_error_rate.xml
@@ -0,0 +1,69 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Error Rate:
+## Custom blks2 block
+###################################################
+ -->
+<block>
+ <name>Error Rate</name>
+ <key>blks2_error_rate</key>
+ <import>from grc_gnuradio import blks2 as grc_blks2</import>
+ <make>grc_blks2.error_rate(
+ type=$type,
+ win_size=$win_size,
+ bits_per_symbol=$bits_per_symbol,
+)</make>
+ <param>
+ <name>Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Bit Error Rate</name>
+ <key>'BER'</key>
+ <opt>hide_bps:</opt>
+ </option>
+ <option>
+ <name>Symbol Error Rate</name>
+ <key>'SER'</key>
+ <opt>hide_bps:all</opt>
+ </option>
+ </param>
+ <param>
+ <name>Window Size</name>
+ <key>win_size</key>
+ <value>1000</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Bits per Symbol</name>
+ <key>bits_per_symbol</key>
+ <value>2</value>
+ <type>int</type>
+ <hide>$type.hide_bps</hide>
+ </param>
+ <sink>
+ <name>ref</name>
+ <type>byte</type>
+ </sink>
+ <sink>
+ <name>in</name>
+ <type>byte</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>float</type>
+ </source>
+ <doc>
+Calculate the bit error rate (BER) or the symbol error rate (SER) over a number of samples given by the window size. \
+The actual window size will start at size one and grow to the full window size as new samples arrive. \
+Once the window has reached full size, old samples are shifted out of the window and new samples shfited in.
+
+The error block compares the input byte stream to the reference byte stream. \
+For example, the reference byte stream could be the input to a modulator, \
+and the input byte stream could be the output of a modulator.
+
+Each byte in the incoming stream represents one symbol. \
+The bits per symbol parameter is only useful for calculating the BER.
+ </doc>
+</block>
diff --git a/grc/blocks/blks2_fm_deemph.xml b/grc/blocks/blks2_fm_deemph.xml
new file mode 100644
index 000000000..6f38dab6d
--- /dev/null
+++ b/grc/blocks/blks2_fm_deemph.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##FM Deemphasis
+###################################################
+ -->
+<block>
+ <name>FM Deemphasis</name>
+ <key>blks2_fm_deemph</key>
+ <import>from gnuradio import blks2</import>
+ <make>blks2.fm_deemph(fs=$samp_rate, tau=$tau)</make>
+ <param>
+ <name>Sample Rate</name>
+ <key>samp_rate</key>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Tau</name>
+ <key>tau</key>
+ <value>75e-6</value>
+ <type>real</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>float</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>float</type>
+ </source>
+</block>
diff --git a/grc/blocks/blks2_fm_demod_cf.xml b/grc/blocks/blks2_fm_demod_cf.xml
new file mode 100644
index 000000000..2ce1fb973
--- /dev/null
+++ b/grc/blocks/blks2_fm_demod_cf.xml
@@ -0,0 +1,68 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##FM Demod
+###################################################
+ -->
+<block>
+ <name>FM Demod</name>
+ <key>blks2_fm_demod_cf</key>
+ <import>from gnuradio import blks2</import>
+ <make>blks2.fm_demod_cf(
+ channel_rate=$chan_rate,
+ audio_decim=$audio_decim,
+ deviation=$deviation,
+ audio_pass=$audio_pass,
+ audio_stop=$audio_stop,
+ gain=$gain,
+ tau=$tau,
+)</make>
+ <param>
+ <name>Channel Rate</name>
+ <key>chan_rate</key>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Audio Decimation</name>
+ <key>audio_decim</key>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Deviation</name>
+ <key>deviation</key>
+ <value>75000</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Audio Pass</name>
+ <key>audio_pass</key>
+ <value>15000</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Audio Stop</name>
+ <key>audio_stop</key>
+ <value>16000</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Gain</name>
+ <key>gain</key>
+ <value>1.0</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Tau</name>
+ <key>tau</key>
+ <value>75e-6</value>
+ <type>real</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>complex</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>float</type>
+ </source>
+</block>
diff --git a/grc/blocks/blks2_fm_preemph.xml b/grc/blocks/blks2_fm_preemph.xml
new file mode 100644
index 000000000..672a7a7b2
--- /dev/null
+++ b/grc/blocks/blks2_fm_preemph.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##FM Preemphasis
+###################################################
+ -->
+<block>
+ <name>FM Preemphasis</name>
+ <key>blks2_fm_preemph</key>
+ <import>from gnuradio import blks2</import>
+ <make>blks2.fm_preemph(fs=$samp_rate, tau=$tau)</make>
+ <param>
+ <name>Sample Rate</name>
+ <key>samp_rate</key>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Tau</name>
+ <key>tau</key>
+ <value>75e-6</value>
+ <type>real</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>float</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>float</type>
+ </source>
+</block>
diff --git a/grc/blocks/blks2_logpwrfft_x.xml b/grc/blocks/blks2_logpwrfft_x.xml
new file mode 100644
index 000000000..79a3bfc4b
--- /dev/null
+++ b/grc/blocks/blks2_logpwrfft_x.xml
@@ -0,0 +1,90 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Log Power FFT
+###################################################
+ -->
+<block>
+ <name>Log Power FFT</name>
+ <key>blks2_logpwrfft_x</key>
+ <import>from gnuradio import blks2</import>
+ <make>blks2.logpwrfft_$(type.fcn)(
+ sample_rate=$sample_rate,
+ fft_size=$fft_size,
+ ref_scale=$ref_scale,
+ frame_rate=$frame_rate,
+ avg_alpha=$avg_alpha,
+ average=$average,
+)</make>
+ <callback>set_sample_rate($sample_rate)</callback>
+ <callback>set_avg_alpha($avg_alpha)</callback>
+ <callback>set_average($average)</callback>
+ <param>
+ <name>Input Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>fcn:c</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>fcn:f</opt>
+ </option>
+ </param>
+ <param>
+ <name>Sample Rate</name>
+ <key>sample_rate</key>
+ <value>samp_rate</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>FFT Size</name>
+ <key>fft_size</key>
+ <value>1024</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Reference Scale</name>
+ <key>ref_scale</key>
+ <value>2</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Frame Rate</name>
+ <key>frame_rate</key>
+ <value>30</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Average</name>
+ <key>average</key>
+ <value>False</value>
+ <type>bool</type>
+ <option>
+ <name>On</name>
+ <key>True</key>
+ </option>
+ <option>
+ <name>Off</name>
+ <key>False</key>
+ </option>
+ </param>
+ <param>
+ <name>Average Alpha</name>
+ <key>avg_alpha</key>
+ <value>1.0</value>
+ <type>real</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>float</type>
+ <vlen>$fft_size</vlen>
+ </source>
+</block>
diff --git a/grc/blocks/blks2_nbfm_rx.xml b/grc/blocks/blks2_nbfm_rx.xml
new file mode 100644
index 000000000..d332b9a6b
--- /dev/null
+++ b/grc/blocks/blks2_nbfm_rx.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##NBFM Receive
+###################################################
+ -->
+<block>
+ <name>NBFM Receive</name>
+ <key>blks2_nbfm_rx</key>
+ <import>from gnuradio import blks2</import>
+ <make>blks2.nbfm_rx(
+ audio_rate=$audio_rate,
+ quad_rate=$quad_rate,
+ tau=$tau,
+ max_dev=$max_dev,
+)</make>
+ <param>
+ <name>Audio Rate</name>
+ <key>audio_rate</key>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Quadrature Rate</name>
+ <key>quad_rate</key>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Tau</name>
+ <key>tau</key>
+ <value>75e-6</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Max Deviation</name>
+ <key>max_dev</key>
+ <value>5e3</value>
+ <type>real</type>
+ </param>
+ <check>$quad_rate%$audio_rate == 0</check>
+ <sink>
+ <name>in</name>
+ <type>complex</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>float</type>
+ </source>
+</block>
diff --git a/grc/blocks/blks2_nbfm_tx.xml b/grc/blocks/blks2_nbfm_tx.xml
new file mode 100644
index 000000000..3aa7ede0e
--- /dev/null
+++ b/grc/blocks/blks2_nbfm_tx.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##NBFM Transmit
+###################################################
+ -->
+<block>
+ <name>NBFM Transmit</name>
+ <key>blks2_nbfm_tx</key>
+ <import>from gnuradio import blks2</import>
+ <make>blks2.nbfm_tx(
+ audio_rate=$audio_rate,
+ quad_rate=$quad_rate,
+ tau=$tau,
+ max_dev=$max_dev,
+)</make>
+ <param>
+ <name>Audio Rate</name>
+ <key>audio_rate</key>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Quadrature Rate</name>
+ <key>quad_rate</key>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Tau</name>
+ <key>tau</key>
+ <value>75e-6</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Max Deviation</name>
+ <key>max_dev</key>
+ <value>5e3</value>
+ <type>real</type>
+ </param>
+ <check>$quad_rate%$audio_rate == 0</check>
+ <sink>
+ <name>in</name>
+ <type>float</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>complex</type>
+ </source>
+</block>
diff --git a/grc/blocks/blks2_packet_decoder.xml b/grc/blocks/blks2_packet_decoder.xml
new file mode 100644
index 000000000..07b0d1f2e
--- /dev/null
+++ b/grc/blocks/blks2_packet_decoder.xml
@@ -0,0 +1,75 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Packet Decoder
+###################################################
+ -->
+<block>
+ <name>Packet Decoder</name>
+ <key>blks2_packet_decoder</key>
+ <import>from grc_gnuradio import blks2 as grc_blks2</import>
+ <make>grc_blks2.packet_demod_$(type.fcn)(grc_blks2.packet_decoder(
+ access_code=$access_code,
+ threshold=$threshold,
+ callback=lambda ok, payload: self.$(id).recv_pkt(ok, payload),
+ ),
+)</make>
+ <param>
+ <name>Output Type</name>
+ <key>type</key>
+ <value>float</value>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>fcn:c</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>fcn:f</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>fcn:i</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>fcn:s</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>fcn:b</opt>
+ </option>
+ </param>
+ <param>
+ <name>Access Code</name>
+ <key>access_code</key>
+ <value></value>
+ <type>string</type>
+ </param>
+ <param>
+ <name>Threshold</name>
+ <key>threshold</key>
+ <value>-1</value>
+ <type>int</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>byte</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ </source>
+ <doc>
+Packet decoder block, for use with the gnuradio demodulator blocks: gmsk, psk, qam.
+
+Access Code: string of 1's and 0's, leave blank for automatic.
+
+Threshold: -1 for automatic.
+ </doc>
+</block>
diff --git a/grc/blocks/blks2_packet_encoder.xml b/grc/blocks/blks2_packet_encoder.xml
new file mode 100644
index 000000000..b184ebd31
--- /dev/null
+++ b/grc/blocks/blks2_packet_encoder.xml
@@ -0,0 +1,110 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Packet Encoder
+###################################################
+ -->
+<block>
+ <name>Packet Encoder</name>
+ <key>blks2_packet_encoder</key>
+ <import>from grc_gnuradio import blks2 as grc_blks2</import>
+ <make>grc_blks2.packet_mod_$(type.fcn)(grc_blks2.packet_encoder(
+ samples_per_symbol=$samples_per_symbol,
+ bits_per_symbol=$bits_per_symbol,
+ access_code=$access_code,
+ pad_for_usrp=$pad_for_usrp,
+ ),
+ payload_length=$payload_length,
+)</make>
+ <param>
+ <name>Input Type</name>
+ <key>type</key>
+ <value>float</value>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>fcn:c</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>fcn:f</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>fcn:i</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>fcn:s</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>fcn:b</opt>
+ </option>
+ </param>
+ <param>
+ <name>Samples/Symbol</name>
+ <key>samples_per_symbol</key>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Bits/Symbol</name>
+ <key>bits_per_symbol</key>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Access Code</name>
+ <key>access_code</key>
+ <value></value>
+ <type>string</type>
+ </param>
+ <param>
+ <name>Pad for USRP</name>
+ <key>pad_for_usrp</key>
+ <type>enum</type>
+ <option>
+ <name>Yes</name>
+ <key>True</key>
+ </option>
+ <option>
+ <name>No</name>
+ <key>False</key>
+ </option>
+ </param>
+ <param>
+ <name>Payload Length</name>
+ <key>payload_length</key>
+ <value>0</value>
+ <type>int</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>byte</type>
+ </source>
+ <doc>
+Packet encoder block, for use with the gnuradio modulator blocks: gmsk, dpsk, qam.
+
+Access Code: string of 1's and 0's, leave blank for automatic.
+
+Payload Length: 0 for automatic.
+
+Bits/Symbol should be set accordingly:
+ gmsk -> 1
+ dbpsk -> 1
+ dqpsk -> 2
+ d8psk -> 3
+ qam8 -> 3
+ qam16 -> 4
+ qam64 -> 6
+ qam256 -> 8
+ </doc>
+</block>
diff --git a/grc/blocks/blks2_pfb_arb_resampler.xml b/grc/blocks/blks2_pfb_arb_resampler.xml
new file mode 100644
index 000000000..b58e70f1c
--- /dev/null
+++ b/grc/blocks/blks2_pfb_arb_resampler.xml
@@ -0,0 +1,45 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Polyphase Arbitrary Resampler
+###################################################
+ -->
+<block>
+ <name>Polyphase Resampler</name>
+ <key>blks2_pfb_arb_resampler_ccf</key>
+ <import>from gnuradio import blks2</import>
+ <import>from gnuradio.gr import firdes</import>
+ <make>blks2.pfb_arb_resampler_ccf(
+ $rate,
+ $taps,
+ $size,
+)</make>
+ <!-- Set taps not implemented yet
+ <callback>set_taps($taps)</callback>
+ -->
+ <callback>set_rate($rate)</callback>
+ <param>
+ <name>Resample Rate</name>
+ <key>rate</key>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Taps</name>
+ <key>taps</key>
+ <type>real_vector</type>
+ </param>
+ <param>
+ <name>Size (# phases)</name>
+ <key>size</key>
+ <value>32</value>
+ <type>int</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>complex</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>complex</type>
+ </source>
+</block>
diff --git a/grc/blocks/blks2_pfb_channelizer.xml b/grc/blocks/blks2_pfb_channelizer.xml
new file mode 100644
index 000000000..5a93c0866
--- /dev/null
+++ b/grc/blocks/blks2_pfb_channelizer.xml
@@ -0,0 +1,62 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Polyphase Channelizer
+###################################################
+ -->
+<block>
+ <name>Polyphase Channelizer</name>
+ <key>blks2_pfb_channelizer_ccf</key>
+ <import>from gnuradio import blks2</import>
+ <import>from gnuradio.gr import firdes</import>
+ <make>blks2.pfb_channelizer_ccf(
+ $nchans,
+ $taps,
+ $osr,
+ $atten)
+self.$(id).set_channel_map($ch_map)
+ </make>
+ <!-- Set taps not implemented yet
+ <callback>set_taps($taps)</callback>
+ -->
+ <callback>set_channel_map($ch_map)</callback>
+
+ <param>
+ <name>Channels</name>
+ <key>nchans</key>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Taps</name>
+ <key>taps</key>
+ <value>None</value>
+ <type>real_vector</type>
+ </param>
+ <param>
+ <name>Over Sample Ratio</name>
+ <key>osr</key>
+ <value>1.0</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Attenuation</name>
+ <key>atten</key>
+ <value>100</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Channel Map</name>
+ <key>ch_map</key>
+ <value>[]</value>
+ <type>int_vector</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>complex</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>complex</type>
+ <nports>$nchans</nports>
+ </source>
+</block>
diff --git a/grc/blocks/blks2_rational_resampler_xxx.xml b/grc/blocks/blks2_rational_resampler_xxx.xml
new file mode 100644
index 000000000..b92ec8ec2
--- /dev/null
+++ b/grc/blocks/blks2_rational_resampler_xxx.xml
@@ -0,0 +1,88 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Rational Resampler
+###################################################
+ -->
+<block>
+ <name>Rational Resampler</name>
+ <key>blks2_rational_resampler_xxx</key>
+ <import>from gnuradio import blks2</import>
+ <import>from gnuradio.gr import firdes</import>
+ <make>blks2.rational_resampler_$(type)(
+ interpolation=$interp,
+ decimation=$decim,
+#if $taps()
+ taps=$taps,
+#else
+ taps=None,
+#end if
+#if $fractional_bw() != 0
+ fractional_bw=$fractional_bw,
+#else
+ fractional_bw=None,
+#end if
+)</make>
+ <param>
+ <name>Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex->Complex (Complex Taps)</name>
+ <key>ccc</key>
+ <opt>input:complex</opt>
+ <opt>output:complex</opt>
+ <opt>taps:complex_vector</opt>
+ </option>
+ <option>
+ <name>Complex->Complex (Real Taps)</name>
+ <key>ccf</key>
+ <opt>input:complex</opt>
+ <opt>output:complex</opt>
+ <opt>taps:real_vector</opt>
+ </option>
+ <option>
+ <name>Float->Float (Real Taps)</name>
+ <key>fff</key>
+ <opt>input:float</opt>
+ <opt>output:float</opt>
+ <opt>taps:real_vector</opt>
+ </option>
+ </param>
+ <param>
+ <name>Decimation</name>
+ <key>decim</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Interpolation</name>
+ <key>interp</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Taps</name>
+ <key>taps</key>
+ <value>[]</value>
+ <type>$type.taps</type>
+ </param>
+ <param>
+ <name>Fractional BW</name>
+ <key>fractional_bw</key>
+ <value>0</value>
+ <type>real</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>$type.input</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type.output</type>
+ </source>
+ <doc>
+Leave taps empty for automatic value.
+Leave fractional bandwidth 0 for automatic value.
+ </doc>
+</block>
diff --git a/grc/blocks/blks2_selector.xml b/grc/blocks/blks2_selector.xml
new file mode 100644
index 000000000..2d89df186
--- /dev/null
+++ b/grc/blocks/blks2_selector.xml
@@ -0,0 +1,97 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Selector:
+## Custom blks2 block
+###################################################
+ -->
+<block>
+ <name>Selector</name>
+ <key>blks2_selector</key>
+ <import>from grc_gnuradio import blks2 as grc_blks2</import>
+ <make>grc_blks2.selector(
+ item_size=$type.size*$vlen,
+ num_inputs=$num_inputs,
+ num_outputs=$num_outputs,
+ input_index=$input_index,
+ output_index=$output_index,
+)</make>
+ <callback>set_input_index(int($input_index))</callback>
+ <callback>set_output_index(int($output_index))</callback>
+ <param>
+ <name>Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>size:gr.sizeof_gr_complex</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>size:gr.sizeof_float</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>size:gr.sizeof_int</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>size:gr.sizeof_short</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>size:gr.sizeof_char</opt>
+ </option>
+ </param>
+ <param>
+ <name>Num Inputs</name>
+ <key>num_inputs</key>
+ <value>2</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Num Outputs</name>
+ <key>num_outputs</key>
+ <value>2</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Input Index</name>
+ <key>input_index</key>
+ <value>0</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Output Index</name>
+ <key>output_index</key>
+ <value>0</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$vlen &gt; 0</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ <nports>$num_inputs</nports>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ <nports>$num_outputs</nports>
+ </source>
+ <doc>
+Connect the sink at input index to the source at output index. Leave all other ports disconnected.
+ </doc>
+</block>
diff --git a/grc/blocks/blks2_standard_squelch.xml b/grc/blocks/blks2_standard_squelch.xml
new file mode 100644
index 000000000..f0baeb662
--- /dev/null
+++ b/grc/blocks/blks2_standard_squelch.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Standard Squelch
+###################################################
+ -->
+<block>
+ <name>Standard Squelch</name>
+ <key>blks2_standard_squelch</key>
+ <import>from gnuradio import blks2</import>
+ <make>blks2.standard_squelch(audio_rate=$audio_rate)
+self.$(id).set_threshold($threshold)</make>
+ <callback>set_threshold($threshold)</callback>
+ <param>
+ <name>Audio Rate</name>
+ <key>audio_rate</key>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Threshold</name>
+ <key>threshold</key>
+ <type>real</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>float</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>float</type>
+ </source>
+</block>
diff --git a/grc/blocks/blks2_stream_to_vector_decimator.xml b/grc/blocks/blks2_stream_to_vector_decimator.xml
new file mode 100644
index 000000000..25f8f7a62
--- /dev/null
+++ b/grc/blocks/blks2_stream_to_vector_decimator.xml
@@ -0,0 +1,77 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Stream to Vector Decimator
+###################################################
+ -->
+<block>
+ <name>Stream to Vec Decim</name>
+ <key>blks2_stream_to_vector_decimator</key>
+ <import>from gnuradio import blks2</import>
+ <make>blks2.stream_to_vector_decimator(
+ item_size=$type.size,
+ sample_rate=$sample_rate,
+ vec_rate=$vec_rate,
+ vec_len=$vlen,
+)</make>
+ <callback>set_sample_rate($sample_rate)</callback>
+ <callback>set_vec_rate($vec_rate)</callback>
+ <param>
+ <name>IO Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>size:gr.sizeof_gr_complex</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>size:gr.sizeof_float</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>size:gr.sizeof_int</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>size:gr.sizeof_short</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>size:gr.sizeof_char</opt>
+ </option>
+ </param>
+ <param>
+ <name>Sample Rate</name>
+ <key>sample_rate</key>
+ <value>samp_rate</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Vec Rate</name>
+ <key>vec_rate</key>
+ <value>30</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1024</value>
+ <type>int</type>
+ </param>
+ <check>$vlen &gt;= 1</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </source>
+</block>
diff --git a/grc/blocks/blks2_synthesis_filterbank.xml b/grc/blocks/blks2_synthesis_filterbank.xml
new file mode 100644
index 000000000..5979ed3f7
--- /dev/null
+++ b/grc/blocks/blks2_synthesis_filterbank.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Synthesis Filterbank
+###################################################
+ -->
+<block>
+ <name>Synthesis Filterbank</name>
+ <key>blks2_synthesis_filterbank</key>
+ <import>from gnuradio import blks2</import>
+ <make>blks2.synthesis_filterbank(mpoints=$mpoints, taps=$taps)</make>
+ <param>
+ <name>MPoints</name>
+ <key>mpoints</key>
+ <value>3</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Taps</name>
+ <key>taps</key>
+ <type>complex_vector</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>complex</type>
+ <nports>$mpoints</nports>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>complex</type>
+ </source>
+</block>
diff --git a/grc/blocks/blks2_tcp_sink.xml b/grc/blocks/blks2_tcp_sink.xml
new file mode 100644
index 000000000..cfe7b42d8
--- /dev/null
+++ b/grc/blocks/blks2_tcp_sink.xml
@@ -0,0 +1,89 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##TCP Sink: Custom blks2 block
+###################################################
+ -->
+<block>
+ <name>TCP Sink</name>
+ <key>blks2_tcp_sink</key>
+ <import>from grc_gnuradio import blks2 as grc_blks2</import>
+ <make>grc_blks2.tcp_sink(
+ itemsize=$type.size*$vlen,
+ addr=$addr,
+ port=$port,
+ server=$server,
+)</make>
+ <param>
+ <name>Input Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>size:gr.sizeof_gr_complex</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>size:gr.sizeof_float</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>size:gr.sizeof_int</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>size:gr.sizeof_short</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>size:gr.sizeof_char</opt>
+ </option>
+ </param>
+ <param>
+ <name>Address</name>
+ <key>addr</key>
+ <value>127.0.0.1</value>
+ <type>string</type>
+ </param>
+ <param>
+ <name>Port</name>
+ <key>port</key>
+ <value>0</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Mode</name>
+ <key>server</key>
+ <value>False</value>
+ <type>enum</type>
+ <option>
+ <name>Server</name>
+ <key>True</key>
+ </option>
+ <option>
+ <name>Client</name>
+ <key>False</key>
+ </option>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$vlen &gt; 0</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </sink>
+ <doc>
+In client mode, we attempt to connect to a server at the given address and port. \
+In server mode, we bind a socket to the given address and port and accept the first client.
+ </doc>
+</block>
diff --git a/grc/blocks/blks2_tcp_source.xml b/grc/blocks/blks2_tcp_source.xml
new file mode 100644
index 000000000..6bf742aa0
--- /dev/null
+++ b/grc/blocks/blks2_tcp_source.xml
@@ -0,0 +1,89 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##TCP Source: Custom blks2 block
+###################################################
+ -->
+<block>
+ <name>TCP Source</name>
+ <key>blks2_tcp_source</key>
+ <import>from grc_gnuradio import blks2 as grc_blks2</import>
+ <make>grc_blks2.tcp_source(
+ itemsize=$type.size*$vlen,
+ addr=$addr,
+ port=$port,
+ server=$server,
+)</make>
+ <param>
+ <name>Output Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>size:gr.sizeof_gr_complex</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>size:gr.sizeof_float</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>size:gr.sizeof_int</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>size:gr.sizeof_short</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>size:gr.sizeof_char</opt>
+ </option>
+ </param>
+ <param>
+ <name>Address</name>
+ <key>addr</key>
+ <value>127.0.0.1</value>
+ <type>string</type>
+ </param>
+ <param>
+ <name>Port</name>
+ <key>port</key>
+ <value>0</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Mode</name>
+ <key>server</key>
+ <value>True</value>
+ <type>enum</type>
+ <option>
+ <name>Server</name>
+ <key>True</key>
+ </option>
+ <option>
+ <name>Client</name>
+ <key>False</key>
+ </option>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$vlen &gt; 0</check>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </source>
+ <doc>
+In client mode, we attempt to connect to a server at the given address and port. \
+In server mode, we bind a socket to the given address and port and accept the first client.
+ </doc>
+</block>
diff --git a/grc/blocks/blks2_valve.xml b/grc/blocks/blks2_valve.xml
new file mode 100644
index 000000000..47c553523
--- /dev/null
+++ b/grc/blocks/blks2_valve.xml
@@ -0,0 +1,72 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Valve:
+## Custom blks2 block
+###################################################
+ -->
+<block>
+ <name>Valve</name>
+ <key>blks2_valve</key>
+ <import>from grc_gnuradio import blks2 as grc_blks2</import>
+ <make>grc_blks2.valve(item_size=$type.size*$vlen, open=bool($open))</make>
+ <callback>set_open(bool($open))</callback>
+ <param>
+ <name>Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>size:gr.sizeof_gr_complex</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>size:gr.sizeof_float</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>size:gr.sizeof_int</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>size:gr.sizeof_short</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>size:gr.sizeof_char</opt>
+ </option>
+ </param>
+ <param>
+ <name>Open</name>
+ <key>open</key>
+ <value>0</value>
+ <type>raw</type>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$vlen &gt; 0</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ <nports>$num_inputs</nports>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ <nports>$num_outputs</nports>
+ </source>
+ <doc>
+Connect output to input when valve is closed (not open).
+ </doc>
+</block>
diff --git a/grc/blocks/blks2_wfm_rcv.xml b/grc/blocks/blks2_wfm_rcv.xml
new file mode 100644
index 000000000..37fb3ba8c
--- /dev/null
+++ b/grc/blocks/blks2_wfm_rcv.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##WBFM Receive
+###################################################
+ -->
+<block>
+ <name>WBFM Receive</name>
+ <key>blks2_wfm_rcv</key>
+ <import>from gnuradio import blks2</import>
+ <make>blks2.wfm_rcv(
+ quad_rate=$quad_rate,
+ audio_decimation=$audio_decimation,
+)</make>
+ <param>
+ <name>Quadrature Rate</name>
+ <key>quad_rate</key>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Audio Decimation</name>
+ <key>audio_decimation</key>
+ <type>int</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>complex</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>float</type>
+ </source>
+</block>
diff --git a/grc/blocks/blks2_wfm_rcv_pll.xml b/grc/blocks/blks2_wfm_rcv_pll.xml
new file mode 100644
index 000000000..2771350cf
--- /dev/null
+++ b/grc/blocks/blks2_wfm_rcv_pll.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##WBFM Receive PLL
+###################################################
+ -->
+<block>
+ <name>WBFM Receive PLL</name>
+ <key>blks2_wfm_rcv_pll</key>
+ <import>from gnuradio import blks2</import>
+ <make>blks2.wfm_rcv_pll(
+ demod_rate=$quad_rate,
+ audio_decimation=$audio_decimation,
+)</make>
+ <param>
+ <name>Quadrature Rate</name>
+ <key>quad_rate</key>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Audio Decimation</name>
+ <key>audio_decimation</key>
+ <type>int</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>complex</type>
+ </sink>
+ <source>
+ <name>Lout</name>
+ <type>float</type>
+ </source>
+ <source>
+ <name>Rout</name>
+ <type>float</type>
+ </source>
+</block>
diff --git a/grc/blocks/blks2_wfm_tx.xml b/grc/blocks/blks2_wfm_tx.xml
new file mode 100644
index 000000000..cff92d819
--- /dev/null
+++ b/grc/blocks/blks2_wfm_tx.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##WBFM Transmit
+###################################################
+ -->
+<block>
+ <name>WBFM Transmit</name>
+ <key>blks2_wfm_tx</key>
+ <import>from gnuradio import blks2</import>
+ <make>blks2.wfm_tx(
+ audio_rate=$audio_rate,
+ quad_rate=$quad_rate,
+ tau=$tau,
+ max_dev=$max_dev,
+)</make>
+ <param>
+ <name>Audio Rate</name>
+ <key>audio_rate</key>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Quadrature Rate</name>
+ <key>quad_rate</key>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Tau</name>
+ <key>tau</key>
+ <value>75e-6</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Max Deviation</name>
+ <key>max_dev</key>
+ <value>75e3</value>
+ <type>real</type>
+ </param>
+ <check>$quad_rate%$audio_rate == 0</check>
+ <sink>
+ <name>in</name>
+ <type>float</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>complex</type>
+ </source>
+</block>
diff --git a/grc/blocks/block_tree.xml b/grc/blocks/block_tree.xml
new file mode 100644
index 000000000..dcd6c5448
--- /dev/null
+++ b/grc/blocks/block_tree.xml
@@ -0,0 +1,283 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Block Tree for platform gnuradio python.
+###################################################
+ -->
+<cat>
+ <name></name> <!-- Blank for Root Name -->
+ <cat>
+ <name>Sources</name>
+ <block>const_source_x</block>
+ <block>gr_sig_source_x</block>
+ <block>gr_noise_source_x</block>
+ <block>gr_vector_source_x</block>
+ <block>random_source_x</block>
+ <block>gr_glfsr_source_x</block>
+ <block>gr_null_source</block>
+ <block>gr_file_source</block>
+ <block>blks2_tcp_source</block>
+ <block>gr_udp_source</block>
+ <block>gr_wavfile_source</block>
+ <block>gr_message_source</block>
+ <block>gr_message_burst_source</block>
+ <block>pad_source</block>
+ <block>virtual_source</block>
+ </cat>
+ <cat>
+ <name>Sinks</name>
+ <block>gr_vector_sink_x</block>
+ <block>gr_null_sink</block>
+ <block>gr_file_sink</block>
+ <block>blks2_tcp_sink</block>
+ <block>gr_udp_sink</block>
+ <block>gr_wavfile_sink</block>
+ <block>gr_message_sink</block>
+ <block>pad_sink</block>
+ <block>virtual_sink</block>
+ <block>gr_tag_debug</block>
+ </cat>
+ <cat>
+ <name>Message Tools</name>
+ <block>gr_message_debug</block>
+ <block>gr_message_strobe</block>
+ <block>gr_pdu_to_tagged_stream</block>
+ <block>gr_tagged_stream_to_pdu</block>
+ <block>gr_tuntap_pdu</block>
+ <block>gr_socket_pdu</block>
+ <block>gr_random_pdu</block>
+ </cat>
+ <cat>
+ <name>Operators</name>
+ <block>gr_add_xx</block>
+ <block>gr_sub_xx</block>
+ <block>gr_multiply_xx</block>
+ <block>gr_divide_xx</block>
+ <block>gr_nlog10_ff</block>
+ <block>gr_transcendental</block>
+ <block>gr_add_const_vxx</block>
+ <block>gr_multiply_const_vxx</block>
+ <block>gr_and_const_xx</block>
+
+ <block>gr_not_xx</block>
+ <block>gr_and_xx</block>
+ <block>gr_or_xx</block>
+ <block>gr_xor_xx</block>
+
+ <block>gr_max_xx</block>
+ <block>gr_argmax_xx</block>
+ <block>gr_rms_xx</block>
+ <block>gr_integrate_xx</block>
+
+ <block>gr_conjugate_cc</block>
+
+ <block>gr_fft_vxx</block>
+ <block>blks2_logpwrfft_x</block>
+ <block>gr_vector_insert_x</block>
+
+ <block>gr_endian_swap</block>
+ </cat>
+ <cat>
+ <name>Type Conversions</name>
+ <block>gr_complex_to_arg</block>
+ <block>gr_complex_to_mag</block>
+ <block>gr_complex_to_mag_squared</block>
+ <block>gr_complex_to_real</block>
+ <block>gr_complex_to_imag</block>
+
+ <block>gr_complex_to_float</block>
+ <block>gr_float_to_complex</block>
+
+ <block>gr_float_to_int</block>
+ <block>gr_float_to_short</block>
+ <block>gr_short_to_float</block>
+ <block>gr_short_to_char</block>
+
+ <block>gr_int_to_float</block>
+
+ <block>gr_float_to_char</block>
+ <block>gr_char_to_float</block>
+ <block>gr_char_to_short</block>
+
+ <block>gr_float_to_uchar</block>
+ <block>gr_uchar_to_float</block>
+
+ <block>gr_complex_to_interleaved_short</block>
+ <block>gr_interleaved_short_to_complex</block>
+ </cat>
+ <cat>
+ <name>Stream Conversions</name>
+ <block>gr_interleave</block>
+ <block>gr_deinterleave</block>
+
+ <block>gr_streams_to_stream</block>
+ <block>gr_stream_to_streams</block>
+
+ <block>gr_streams_to_vector</block>
+ <block>gr_vector_to_streams</block>
+
+ <block>gr_stream_to_vector</block>
+ <block>gr_vector_to_stream</block>
+
+ <block>blks2_stream_to_vector_decimator</block>
+
+ <block>gr_stream_mux</block>
+ <block>gr_burst_tagger</block>
+ </cat>
+ <cat>
+ <name>Misc Conversions</name>
+ <block>gr_unpacked_to_packed_xx</block>
+ <block>gr_packed_to_unpacked_xx</block>
+ <block>gr_unpack_k_bits_bb</block>
+ <block>gr_pack_k_bits_bb</block>
+ <block>gr_chunks_to_symbols_xx</block>
+ <block>gr_map_bb</block>
+ </cat>
+ <cat>
+ <name>Synchronizers</name>
+ <block>gr_pfb_clock_sync_xxx</block>
+
+ <block>gr_mpsk_sync_cc</block>
+
+ <block>gr_pll_carriertracking_cc</block>
+ <block>gr_pll_freqdet_cf</block>
+ <block>gr_pll_refout_cc</block>
+
+ <block>gr_pn_correlator_cc</block>
+ <block>gr_simple_correlator</block>
+ <block>gr_simple_framer</block>
+
+ <block>blks2_packet_decoder</block>
+ <block>blks2_packet_encoder</block>
+ </cat>
+ <cat>
+ <name>Level Controls</name>
+ <block>gr_dpll_bb</block>
+ <block>gr_peak_detector_xb</block>
+ <block>gr_peak_detector2_fb</block>
+ <block>gr_sample_and_hold_xx</block>
+
+ <block>gr_agc_xx</block>
+ <block>gr_agc2_xx</block>
+ <block>gr_feedforward_agc_cc</block>
+
+ <block>gr_mute_xx</block>
+ <block>gr_simple_squelch_cc</block>
+ <block>blks2_standard_squelch</block>
+ <block>gr_pwr_squelch_xx</block>
+ <block>gr_ctcss_squelch_ff</block>
+ <block>gr_threshold_ff</block>
+ </cat>
+ <cat>
+ <name>Filters</name>
+ <!-- FIR convenience filters -->
+ <block>low_pass_filter</block>
+ <block>high_pass_filter</block>
+ <block>band_pass_filter</block>
+ <block>band_reject_filter</block>
+ <block>root_raised_cosine_filter</block>
+ <!-- Filters that take taps as arguments -->
+ <block>gr_fir_filter_xxx</block>
+ <block>gr_interp_fir_filter_xxx</block>
+ <block>gr_fft_filter_xxx</block>
+ <block>gr_freq_xlating_fir_filter_xxx</block>
+ <block>gr_iir_filter_ffd</block>
+ <block>gr_filter_delay_fc</block>
+ <block>gr_channel_model</block>
+ <!-- Filter banks -->
+ <block>blks2_synthesis_filterbank</block>
+ <block>blks2_analysis_filterbank</block>
+ <!-- Polyphase filters -->
+ <block>blks2_pfb_arb_resampler_ccf</block>
+ <block>blks2_pfb_channelizer_ccf</block>
+ <block>gr_pfb_synthesizer_ccf</block>
+ <!-- Other filters -->
+ <block>gr_single_pole_iir_filter_xx</block>
+ <block>gr_hilbert_fc</block>
+ <block>gr_goertzel_fc</block>
+ <block>gr_rational_resampler_base_xxx</block>
+ <block>blks2_rational_resampler_xxx</block>
+ <block>gr_fractional_interpolator_xx</block>
+ <block>gr_keep_one_in_n</block>
+ <block>gr_keep_m_in_n</block>
+ <block>gr_moving_average_xx</block>
+ <block>gr_iqcomp_cc</block>
+ <block>gr_dc_blocker</block>
+ </cat>
+ <cat>
+ <name>Modulators</name>
+ <block>gr_vco_f</block>
+ <block>gr_frequency_modulator_fc</block>
+ <block>gr_phase_modulator_fc</block>
+ <block>gr_quadrature_demod_cf</block>
+ <block>gr_cpfsk_bc</block>
+
+ <block>gr_diff_phasor_cc</block>
+
+ <block>gr_diff_encoder_bb</block>
+ <block>gr_diff_decoder_bb</block>
+
+ <block>blks2_wfm_tx</block>
+ <block>blks2_wfm_rcv</block>
+ <block>blks2_wfm_rcv_pll</block>
+
+ <block>blks2_nbfm_tx</block>
+ <block>blks2_nbfm_rx</block>
+
+ <block>blks2_am_demod_cf</block>
+ <block>blks2_fm_demod_cf</block>
+ <block>blks2_fm_deemph</block>
+ <block>blks2_fm_preemph</block>
+ </cat>
+ <cat>
+ <name>Error Correction</name>
+ <cat>
+ <name>Trellis</name>
+ </cat>
+
+ <block>gr_encode_ccsds_27_bb</block>
+ <block>gr_decode_ccsds_27_fb</block>
+ </cat>
+ <cat>
+ <name>Line Coding</name>
+ <block>gr_scrambler_bb</block>
+ <block>gr_descrambler_bb</block>
+ <block>gr_additive_scrambler_bb</block>
+ </cat>
+ <cat>
+ <name>Probes</name>
+ <block>gr_probe_avg_mag_sqrd_x</block>
+ <block>gr_probe_density_b</block>
+ <block>gr_probe_signal_f</block>
+ </cat>
+ <cat>
+ <name>Variables</name>
+ <block>variable</block>
+ <block>variable_config</block>
+ <block>variable_function_probe</block>
+ <block>parameter</block>
+ </cat>
+ <cat>
+ <name>Misc</name>
+ <block>note</block>
+ <block>import</block>
+
+ <block>gr_throttle</block>
+ <block>gr_delay</block>
+ <block>gr_repeat</block>
+
+ <block>blks2_selector</block>
+ <block>blks2_valve</block>
+ <block>blks2_error_rate</block>
+
+ <block>gr_head</block>
+ <block>gr_skiphead</block>
+
+ <block>gr_kludge_copy</block>
+ <block>gr_copy</block>
+ <block>gr_nop</block>
+
+ <block>xmlrpc_server</block>
+ <block>xmlrpc_client</block>
+ </cat>
+</cat>
diff --git a/grc/blocks/const_source_x.xml b/grc/blocks/const_source_x.xml
new file mode 100644
index 000000000..fe8e56ec4
--- /dev/null
+++ b/grc/blocks/const_source_x.xml
@@ -0,0 +1,52 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Constant Source: Custom wrapper
+###################################################
+ -->
+<block>
+ <name>Constant Source</name>
+ <key>const_source_x</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.sig_source_$(type.fcn)(0, gr.GR_CONST_WAVE, 0, 0, $const)</make>
+ <callback>set_offset($const)</callback>
+ <param>
+ <name>Output Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>fcn:c</opt>
+ <opt>const_type:complex</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>fcn:f</opt>
+ <opt>const_type:real</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>fcn:i</opt>
+ <opt>const_type:int</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>fcn:s</opt>
+ <opt>const_type:int</opt>
+ </option>
+ </param>
+ <param>
+ <name>Constant</name>
+ <key>const</key>
+ <value>0</value>
+ <type>$type.const_type</type>
+ </param>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ </source>
+</block>
diff --git a/grc/blocks/gr_add_const_vxx.xml b/grc/blocks/gr_add_const_vxx.xml
new file mode 100644
index 000000000..9f1c545ab
--- /dev/null
+++ b/grc/blocks/gr_add_const_vxx.xml
@@ -0,0 +1,67 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Add Const Block:
+## all types, 1 output, 1 input & const
+###################################################
+ -->
+<block>
+ <name>Add Const</name>
+ <key>gr_add_const_vxx</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.add_const_v$(type.fcn)($const)</make>
+ <callback>set_k($const)</callback>
+ <param>
+ <name>IO Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>const_type:complex_vector</opt>
+ <opt>fcn:cc</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>const_type:real_vector</opt>
+ <opt>fcn:ff</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>const_type:int_vector</opt>
+ <opt>fcn:ii</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>const_type:int_vector</opt>
+ <opt>fcn:ss</opt>
+ </option>
+ </param>
+ <param>
+ <name>Constant</name>
+ <key>const</key>
+ <value>0</value>
+ <type>$type.const_type</type>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>len($const) == $vlen</check>
+ <check>$vlen &gt; 0</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </source>
+</block>
diff --git a/grc/blocks/gr_add_xx.xml b/grc/blocks/gr_add_xx.xml
new file mode 100644
index 000000000..97ed9283c
--- /dev/null
+++ b/grc/blocks/gr_add_xx.xml
@@ -0,0 +1,63 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Add Block:
+## all types, 1 output, 2 to inf inputs
+###################################################
+ -->
+<block>
+ <name>Add</name>
+ <key>gr_add_xx</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.add_v$(type.fcn)($vlen)</make>
+ <param>
+ <name>IO Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>fcn:cc</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>fcn:ff</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>fcn:ii</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>fcn:ss</opt>
+ </option>
+ </param>
+ <param>
+ <name>Num Inputs</name>
+ <key>num_inputs</key>
+ <value>2</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$num_inputs &gt; 1</check>
+ <check>$vlen &gt; 0</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ <nports>$num_inputs</nports>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </source>
+</block>
diff --git a/grc/blocks/gr_additive_scrambler_bb.xml b/grc/blocks/gr_additive_scrambler_bb.xml
new file mode 100644
index 000000000..a15d6eefb
--- /dev/null
+++ b/grc/blocks/gr_additive_scrambler_bb.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+## Additive Scrambler
+###################################################
+ -->
+<block>
+ <name>Additive Scrambler</name>
+ <key>gr_additive_scrambler_bb</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.additive_scrambler_bb($mask, $seed, $len, $count)</make>
+ <param>
+ <name>Mask</name>
+ <key>mask</key>
+ <value>0x8A</value>
+ <type>hex</type>
+ </param>
+ <param>
+ <name>Seed</name>
+ <key>seed</key>
+ <value>0x7F</value>
+ <type>hex</type>
+ </param>
+ <param>
+ <name>Length</name>
+ <key>len</key>
+ <value>7</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Count</name>
+ <key>count</key>
+ <value>0</value>
+ <type>int</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>byte</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>byte</type>
+ </source>
+</block>
diff --git a/grc/blocks/gr_agc2_xx.xml b/grc/blocks/gr_agc2_xx.xml
new file mode 100644
index 000000000..55b20d4e8
--- /dev/null
+++ b/grc/blocks/gr_agc2_xx.xml
@@ -0,0 +1,70 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##AGC2
+###################################################
+ -->
+<block>
+ <name>AGC2</name>
+ <key>gr_agc2_xx</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.agc2_$(type.fcn)($attack_rate, $decay_rate, $reference, $gain, $max_gain)</make>
+ <callback>set_attack_rate($attack_rate)</callback>
+ <callback>set_decay_rate($decay_rate)</callback>
+ <callback>set_reference($reference)</callback>
+ <callback>set_gain($gain)</callback>
+ <callback>set_max_gain($max_gain)</callback>
+ <param>
+ <name>Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>fcn:cc</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>fcn:ff</opt>
+ </option>
+ </param>
+ <param>
+ <name>Attack Rate</name>
+ <key>attack_rate</key>
+ <value>1e-1</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Decay Rate</name>
+ <key>decay_rate</key>
+ <value>1e-2</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Reference</name>
+ <key>reference</key>
+ <value>1.0</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Gain</name>
+ <key>gain</key>
+ <value>1.0</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Max Gain</name>
+ <key>max_gain</key>
+ <value>0.0</value>
+ <type>real</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ </source>
+</block>
diff --git a/grc/blocks/gr_agc_xx.xml b/grc/blocks/gr_agc_xx.xml
new file mode 100644
index 000000000..c87d239ed
--- /dev/null
+++ b/grc/blocks/gr_agc_xx.xml
@@ -0,0 +1,59 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##AGC
+###################################################
+ -->
+<block>
+ <name>AGC</name>
+ <key>gr_agc_xx</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.agc_$(type.fcn)($rate, $reference, $gain, $max_gain)</make>
+ <param>
+ <name>Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>fcn:cc</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>fcn:ff</opt>
+ </option>
+ </param>
+ <param>
+ <name>Rate</name>
+ <key>rate</key>
+ <value>1e-4</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Reference</name>
+ <key>reference</key>
+ <value>1.0</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Gain</name>
+ <key>gain</key>
+ <value>1.0</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Max Gain</name>
+ <key>max_gain</key>
+ <value>0.0</value>
+ <type>real</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ </source>
+</block>
diff --git a/grc/blocks/gr_and_const_xx.xml b/grc/blocks/gr_and_const_xx.xml
new file mode 100644
index 000000000..dc9649311
--- /dev/null
+++ b/grc/blocks/gr_and_const_xx.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+## And Const Block:
+## all types, 1 output, 1 input & const
+###################################################
+ -->
+<block>
+ <name>And Const</name>
+ <key>gr_and_const_xx</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.and_const_$(type.fcn)($const)</make>
+ <callback>set_k($const)</callback>
+ <param>
+ <name>IO Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>fcn:ii</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>fcn:ss</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>fcn:bb</opt>
+ </option>
+ </param>
+ <param>
+ <name>Constant</name>
+ <key>const</key>
+ <value>0</value>
+ <type>int</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ </source>
+</block>
diff --git a/grc/blocks/gr_and_xx.xml b/grc/blocks/gr_and_xx.xml
new file mode 100644
index 000000000..9ed006090
--- /dev/null
+++ b/grc/blocks/gr_and_xx.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Logical And Block
+###################################################
+ -->
+<block>
+ <name>And</name>
+ <key>gr_and_xx</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.and_$(type.fcn)()</make>
+ <param>
+ <name>IO Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>fcn:ii</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>fcn:ss</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>fcn:bb</opt>
+ </option>
+ </param>
+ <param>
+ <name>Num Inputs</name>
+ <key>num_inputs</key>
+ <value>2</value>
+ <type>int</type>
+ </param>
+ <check>$num_inputs &gt;= 2</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <nports>$num_inputs</nports>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ </source>
+</block>
diff --git a/grc/blocks/gr_argmax_xx.xml b/grc/blocks/gr_argmax_xx.xml
new file mode 100644
index 000000000..95269292e
--- /dev/null
+++ b/grc/blocks/gr_argmax_xx.xml
@@ -0,0 +1,61 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##ArgMax:
+## 1 output, 2 to inf inputs
+###################################################
+ -->
+<block>
+ <name>Argmax</name>
+ <key>gr_argmax_xx</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.argmax_$(type.fcn)($vlen)</make>
+ <param>
+ <name>IO Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>fcn:fs</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>fcn:is</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>fcn:dd</opt>
+ </option>
+ </param>
+ <param>
+ <name>Num Inputs</name>
+ <key>num_inputs</key>
+ <value>2</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$num_inputs &gt;= 1</check>
+ <check>$vlen &gt;= 1</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ <nports>$num_inputs</nports>
+ </sink>
+ <source>
+ <name>max_vec</name>
+ <type>short</type>
+ </source>
+ <source>
+ <name>max_inp</name>
+ <type>short</type>
+ </source>
+</block>
diff --git a/grc/blocks/gr_burst_tagger.xml b/grc/blocks/gr_burst_tagger.xml
new file mode 100644
index 000000000..58c909999
--- /dev/null
+++ b/grc/blocks/gr_burst_tagger.xml
@@ -0,0 +1,87 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Burst tagger:
+## all types, 1 output, 2 input: stream & trigger (short)
+###################################################
+ -->
+<block>
+ <name>Burst Tagger</name>
+ <key>gr_burst_tagger</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.burst_tagger($type.size)
+self.$(id).set_true_tag($true_key,$true_value)
+self.$(id).set_false_tag($false_key,$false_value)
+ </make>
+ <callback>set_true_tag($true_key,$true_value)</callback>
+ <callback>set_false_tag($false_key,$false_value)</callback>
+ <param>
+ <name>Stream Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>size:gr.sizeof_gr_complex</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>size:gr.sizeof_float</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>size:gr.sizeof_int</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>size:gr.sizeof_short</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>size:gr.sizeof_char</opt>
+ </option>
+ </param>
+ <param>
+ <name>True KeyID</name>
+ <key>true_key</key>
+ <value>burst</value>
+ <type>string</type>
+ </param>
+ <param>
+ <name>True Value</name>
+ <key>true_value</key>
+ <value>True</value>
+ <type>bool</type>
+ </param>
+ <param>
+ <name>False KeyID</name>
+ <key>false_key</key>
+ <value>burst</value>
+ <type>string</type>
+ </param>
+ <param>
+ <name>False Value</name>
+ <key>false_value</key>
+ <value>False</value>
+ <type>bool</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <vlen>1</vlen>
+ </sink>
+ <sink>
+ <name>trigger</name>
+ <type>short</type>
+ <vlen>1</vlen>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ <vlen>1</vlen>
+ </source>
+</block>
diff --git a/grc/blocks/gr_channel_model.xml b/grc/blocks/gr_channel_model.xml
new file mode 100644
index 000000000..d0d178d34
--- /dev/null
+++ b/grc/blocks/gr_channel_model.xml
@@ -0,0 +1,61 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Channel Model
+###################################################
+ -->
+<block>
+ <name>Channel Model</name>
+ <key>gr_channel_model</key>
+ <import>from gnuradio import gr</import>
+ <import>from gnuradio.gr import firdes</import>
+ <make>gr.channel_model(
+ noise_voltage=$noise_voltage,
+ frequency_offset=$freq_offset,
+ epsilon=$epsilon,
+ taps=$taps,
+ noise_seed=$seed,
+)</make>
+ <callback>set_noise_voltage($noise_voltage)</callback>
+ <callback>set_frequency_offset($freq_offset)</callback>
+ <callback>set_taps($taps)</callback>
+ <callback>set_timing_offset($epsilon)</callback>
+ <param>
+ <name>Noise Voltage</name>
+ <key>noise_voltage</key>
+ <value>0.0</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Frequency Offset</name>
+ <key>freq_offset</key>
+ <value>0.0</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Epsilon</name>
+ <key>epsilon</key>
+ <value>1.0</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Taps</name>
+ <key>taps</key>
+ <value>1.0 + 1.0j</value>
+ <type>complex_vector</type>
+ </param>
+ <param>
+ <name>Seed</name>
+ <key>seed</key>
+ <value>0</value>
+ <type>int</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>complex</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>complex</type>
+ </source>
+</block>
diff --git a/grc/blocks/gr_char_to_float.xml b/grc/blocks/gr_char_to_float.xml
new file mode 100644
index 000000000..838b6a203
--- /dev/null
+++ b/grc/blocks/gr_char_to_float.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Char to Float:
+###################################################
+ -->
+<block>
+ <name>Char To Float</name>
+ <key>gr_char_to_float</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.char_to_float($vlen, $scale)</make>
+ <callback>set_scale($scale)</callback>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Scale</name>
+ <key>scale</key>
+ <value>1</value>
+ <type>real</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>byte</type>
+ <vlen>$vlen</vlen>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>float</type>
+ <vlen>$vlen</vlen>
+ </source>
+</block>
diff --git a/grc/blocks/gr_char_to_short.xml b/grc/blocks/gr_char_to_short.xml
new file mode 100644
index 000000000..57261e084
--- /dev/null
+++ b/grc/blocks/gr_char_to_short.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Char to Short:
+###################################################
+ -->
+<block>
+ <name>Char To Short</name>
+ <key>gr_char_to_short</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.char_to_short($vlen)</make>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>byte</type>
+ <vlen>$vlen</vlen>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>short</type>
+ <vlen>$vlen</vlen>
+ </source>
+</block>
diff --git a/grc/blocks/gr_chunks_to_symbols.xml b/grc/blocks/gr_chunks_to_symbols.xml
new file mode 100644
index 000000000..e9da38e9a
--- /dev/null
+++ b/grc/blocks/gr_chunks_to_symbols.xml
@@ -0,0 +1,77 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Chunks to Symbols
+###################################################
+ -->
+<block>
+ <name>Chunks to Symbols</name>
+ <key>gr_chunks_to_symbols_xx</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.chunks_to_symbols_$(in_type.fcn)$(out_type.fcn)($symbol_table, $dimension)</make>
+ <param>
+ <name>Input Type</name>
+ <key>in_type</key>
+ <type>enum</type>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>fcn:i</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>fcn:s</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>fcn:b</opt>
+ </option>
+ </param>
+ <param>
+ <name>Output Type</name>
+ <key>out_type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>fcn:c</opt>
+ <opt>table:complex_vector</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>fcn:f</opt>
+ <opt>table:real_vector</opt>
+ </option>
+ </param>
+ <param>
+ <name>Symbol Table</name>
+ <key>symbol_table</key>
+ <type>$out_type.table</type>
+ </param>
+ <param>
+ <name>Dimension</name>
+ <key>dimension</key>
+ <value>2</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Num Ports</name>
+ <key>num_ports</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$num_ports &gt; 0</check>
+ <sink>
+ <name>in</name>
+ <type>$in_type</type>
+ <nports>$num_ports</nports>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$out_type</type>
+ <nports>$num_ports</nports>
+ </source>
+</block>
diff --git a/grc/blocks/gr_complex_to_arg.xml b/grc/blocks/gr_complex_to_arg.xml
new file mode 100644
index 000000000..a7bbacd74
--- /dev/null
+++ b/grc/blocks/gr_complex_to_arg.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Complex to Arg
+###################################################
+ -->
+<block>
+ <name>Complex to Arg</name>
+ <key>gr_complex_to_arg</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.complex_to_arg($vlen)</make>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$vlen &gt; 0</check>
+ <sink>
+ <name>in</name>
+ <type>complex</type>
+ <vlen>$vlen</vlen>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>float</type>
+ <vlen>$vlen</vlen>
+ </source>
+</block>
diff --git a/grc/blocks/gr_complex_to_float.xml b/grc/blocks/gr_complex_to_float.xml
new file mode 100644
index 000000000..05681b0b9
--- /dev/null
+++ b/grc/blocks/gr_complex_to_float.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Complex to Float:
+## one or two output streams
+###################################################
+ -->
+<block>
+ <name>Complex To Float</name>
+ <key>gr_complex_to_float</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.complex_to_float($vlen)</make>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$vlen &gt; 0</check>
+ <sink>
+ <name>in</name>
+ <type>complex</type>
+ <vlen>$vlen</vlen>
+ </sink>
+ <source>
+ <name>re</name>
+ <type>float</type>
+ <vlen>$vlen</vlen>
+ </source>
+ <source>
+ <name>im</name>
+ <type>float</type>
+ <vlen>$vlen</vlen>
+ <optional>1</optional>
+ </source>
+</block>
diff --git a/grc/blocks/gr_complex_to_imag.xml b/grc/blocks/gr_complex_to_imag.xml
new file mode 100644
index 000000000..7c120eedd
--- /dev/null
+++ b/grc/blocks/gr_complex_to_imag.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Complex to Imaginary
+###################################################
+ -->
+<block>
+ <name>Complex to Imag</name>
+ <key>gr_complex_to_imag</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.complex_to_imag($vlen)</make>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$vlen &gt; 0</check>
+ <sink>
+ <name>in</name>
+ <type>complex</type>
+ <vlen>$vlen</vlen>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>float</type>
+ <vlen>$vlen</vlen>
+ </source>
+</block>
diff --git a/grc/blocks/gr_complex_to_interleaved_short.xml b/grc/blocks/gr_complex_to_interleaved_short.xml
new file mode 100644
index 000000000..5e999599a
--- /dev/null
+++ b/grc/blocks/gr_complex_to_interleaved_short.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Complex to Interleaved Short:
+###################################################
+ -->
+<block>
+ <name>Complex To IShort</name>
+ <key>gr_complex_to_interleaved_short</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.complex_to_interleaved_short()</make>
+ <sink>
+ <name>in</name>
+ <type>complex</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>short</type>
+ </source>
+</block>
diff --git a/grc/blocks/gr_complex_to_mag.xml b/grc/blocks/gr_complex_to_mag.xml
new file mode 100644
index 000000000..adc95f207
--- /dev/null
+++ b/grc/blocks/gr_complex_to_mag.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Complex to Magnitude
+###################################################
+ -->
+<block>
+ <name>Complex to Mag</name>
+ <key>gr_complex_to_mag</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.complex_to_mag($vlen)</make>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$vlen &gt; 0</check>
+ <sink>
+ <name>in</name>
+ <type>complex</type>
+ <vlen>$vlen</vlen>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>float</type>
+ <vlen>$vlen</vlen>
+ </source>
+</block>
diff --git a/grc/blocks/gr_complex_to_mag_squared.xml b/grc/blocks/gr_complex_to_mag_squared.xml
new file mode 100644
index 000000000..cd23bfb5c
--- /dev/null
+++ b/grc/blocks/gr_complex_to_mag_squared.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Complex to Magnitude Squared
+###################################################
+ -->
+<block>
+ <name>Complex to Mag^2</name>
+ <key>gr_complex_to_mag_squared</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.complex_to_mag_squared($vlen)</make>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$vlen &gt; 0</check>
+ <sink>
+ <name>in</name>
+ <type>complex</type>
+ <vlen>$vlen</vlen>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>float</type>
+ <vlen>$vlen</vlen>
+ </source>
+</block>
diff --git a/grc/blocks/gr_complex_to_real.xml b/grc/blocks/gr_complex_to_real.xml
new file mode 100644
index 000000000..ae9ec7b14
--- /dev/null
+++ b/grc/blocks/gr_complex_to_real.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Complex to Real
+###################################################
+ -->
+<block>
+ <name>Complex to Real</name>
+ <key>gr_complex_to_real</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.complex_to_real($vlen)</make>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$vlen &gt; 0</check>
+ <sink>
+ <name>in</name>
+ <type>complex</type>
+ <vlen>$vlen</vlen>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>float</type>
+ <vlen>$vlen</vlen>
+ </source>
+</block>
diff --git a/grc/blocks/gr_conjugate_cc.xml b/grc/blocks/gr_conjugate_cc.xml
new file mode 100644
index 000000000..0b4deb347
--- /dev/null
+++ b/grc/blocks/gr_conjugate_cc.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Complex Conjugate
+###################################################
+ -->
+<block>
+ <name>Complex Conjugate</name>
+ <key>gr_conjugate_cc</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.conjugate_cc()</make>
+ <sink>
+ <name>in</name>
+ <type>complex</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>complex</type>
+ </source>
+</block>
diff --git a/grc/blocks/gr_copy.xml b/grc/blocks/gr_copy.xml
new file mode 100644
index 000000000..8b12eaca7
--- /dev/null
+++ b/grc/blocks/gr_copy.xml
@@ -0,0 +1,75 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Copy
+###################################################
+ -->
+<block>
+ <name>Copy</name>
+ <key>gr_copy</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.copy($type.size*$vlen)
+self.$(id).set_enabled($enabled)</make>
+ <callback>set_enabled($enabled)</callback>
+ <param>
+ <name>Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>size:gr.sizeof_gr_complex</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>size:gr.sizeof_float</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>size:gr.sizeof_int</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>size:gr.sizeof_short</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>size:gr.sizeof_char</opt>
+ </option>
+ </param>
+ <param>
+ <name>Enabled</name>
+ <key>enabled</key>
+ <value>True</value>
+ <type>bool</type>
+ <option>
+ <name>Enabled</name>
+ <key>True</key>
+ </option>
+ <option>
+ <name>Disabled</name>
+ <key>False</key>
+ </option>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$vlen &gt; 0</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </source>
+</block>
diff --git a/grc/blocks/gr_cpfsk_bc.xml b/grc/blocks/gr_cpfsk_bc.xml
new file mode 100644
index 000000000..d5549d933
--- /dev/null
+++ b/grc/blocks/gr_cpfsk_bc.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##CPFSK
+###################################################
+ -->
+<block>
+ <name>CPFSK</name>
+ <key>gr_cpfsk_bc</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.cpfsk_bc($k, $amplitude, $samples_per_symbol)</make>
+ <callback>set_amplitude($amplitude)</callback>
+ <param>
+ <name>K</name>
+ <key>k</key>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Amplitude</name>
+ <key>amplitude</key>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Samples/Symbol</name>
+ <key>samples_per_symbol</key>
+ <value>2</value>
+ <type>int</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>byte</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>complex</type>
+ </source>
+</block>
diff --git a/grc/blocks/gr_ctcss_squelch_ff.xml b/grc/blocks/gr_ctcss_squelch_ff.xml
new file mode 100644
index 000000000..a34c75374
--- /dev/null
+++ b/grc/blocks/gr_ctcss_squelch_ff.xml
@@ -0,0 +1,79 @@
+<?xml version="1.0"?>
+<!--
+#
+# Copyright 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.
+-->
+
+<!--
+###################################################
+##CTCSS Squelch
+###################################################
+ -->
+<block>
+ <name>CTCSS Squelch</name>
+ <key>gr_ctcss_squelch_ff</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.ctcss_squelch_ff($rate, $freq, $level, $len, $ramp, $gate)</make>
+ <callback>set_level($level)</callback>
+ <param>
+ <name>Sampling Rate (Hz)</name>
+ <key>rate</key>
+ <value>samp_rate</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Tone Frequency</name>
+ <key>freq</key>
+ <value>100.0</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Level</name>
+ <key>level</key>
+ <value>0.01</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Length</name>
+ <key>len</key>
+ <value>0</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Ramp</name>
+ <key>ramp</key>
+ <value>0</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Gate</name>
+ <key>gate</key>
+ <value>False</value>
+ <type>bool</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>float</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>float</type>
+ </source>
+</block>
diff --git a/grc/blocks/gr_dc_blocker.xml b/grc/blocks/gr_dc_blocker.xml
new file mode 100644
index 000000000..05c342074
--- /dev/null
+++ b/grc/blocks/gr_dc_blocker.xml
@@ -0,0 +1,51 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+## DC Blocker
+###################################################
+ -->
+<block>
+ <name>DC Blocker</name>
+ <key>gr_dc_blocker</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.dc_blocker_$(type)($length, $long_form)</make>
+ <!-- <callback>set_length($length)</callback> -->
+ <param>
+ <name>Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex->Complex</name>
+ <key>cc</key>
+ <opt>input:complex</opt>
+ <opt>output:complex</opt>
+ </option>
+ <option>
+ <name>Float->Float</name>
+ <key>ff</key>
+ <opt>input:float</opt>
+ <opt>output:float</opt>
+ </option>
+ </param>
+ <param>
+ <name>Length</name>
+ <key>length</key>
+ <value>32</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Long Form</name>
+ <key>long_form</key>
+ <value>True</value>
+ <type>bool</type>
+ </param>
+
+ <sink>
+ <name>in</name>
+ <type>$type.input</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type.output</type>
+ </source>
+</block>
diff --git a/grc/blocks/gr_decode_ccsds_27_fb.xml b/grc/blocks/gr_decode_ccsds_27_fb.xml
new file mode 100644
index 000000000..03b31db83
--- /dev/null
+++ b/grc/blocks/gr_decode_ccsds_27_fb.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Decode CCSDS 27
+###################################################
+ -->
+<block>
+ <name>Decode CCSDS 27</name>
+ <key>gr_decode_ccsds_27_fb</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.decode_ccsds_27_fb()</make>
+ <sink>
+ <name>in</name>
+ <type>float</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>byte</type>
+ </source>
+</block>
diff --git a/grc/blocks/gr_deinterleave.xml b/grc/blocks/gr_deinterleave.xml
new file mode 100644
index 000000000..a7482978c
--- /dev/null
+++ b/grc/blocks/gr_deinterleave.xml
@@ -0,0 +1,67 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Deinterleave
+###################################################
+ -->
+<block>
+ <name>Deinterleave</name>
+ <key>gr_deinterleave</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.deinterleave($type.size*$vlen)</make>
+ <param>
+ <name>IO Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>size:gr.sizeof_gr_complex</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>size:gr.sizeof_float</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>size:gr.sizeof_int</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>size:gr.sizeof_short</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>size:gr.sizeof_char</opt>
+ </option>
+ </param>
+ <param>
+ <name>Num Streams</name>
+ <key>num_streams</key>
+ <value>2</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$num_streams &gt; 0</check>
+ <check>$vlen &gt;= 1</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ <nports>$num_streams</nports>
+ </source>
+</block>
diff --git a/grc/blocks/gr_delay.xml b/grc/blocks/gr_delay.xml
new file mode 100644
index 000000000..5cc411a78
--- /dev/null
+++ b/grc/blocks/gr_delay.xml
@@ -0,0 +1,75 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Delay
+###################################################
+ -->
+<block>
+ <name>Delay</name>
+ <key>gr_delay</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.delay($type.size*$vlen, $delay)</make>
+ <callback>set_delay($delay)</callback>
+ <param>
+ <name>Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>size:gr.sizeof_gr_complex</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>size:gr.sizeof_float</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>size:gr.sizeof_int</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>size:gr.sizeof_short</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>size:gr.sizeof_char</opt>
+ </option>
+ </param>
+ <param>
+ <name>Delay</name>
+ <key>delay</key>
+ <value>0</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Num Ports</name>
+ <key>num_ports</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$num_ports &gt; 0</check>
+ <check>$vlen &gt; 0</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ <nports>$num_ports</nports>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ <nports>$num_ports</nports>
+ </source>
+</block>
diff --git a/grc/blocks/gr_descrambler_bb.xml b/grc/blocks/gr_descrambler_bb.xml
new file mode 100644
index 000000000..5cfbcc203
--- /dev/null
+++ b/grc/blocks/gr_descrambler_bb.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Descrambler
+###################################################
+ -->
+<block>
+ <name>Descrambler</name>
+ <key>gr_descrambler_bb</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.descrambler_bb($mask, $seed, $len)</make>
+ <param>
+ <name>Mask</name>
+ <key>mask</key>
+ <value>0x8A</value>
+ <type>hex</type>
+ </param>
+ <param>
+ <name>Seed</name>
+ <key>seed</key>
+ <value>0x7F</value>
+ <type>hex</type>
+ </param>
+ <param>
+ <name>Length</name>
+ <key>len</key>
+ <value>7</value>
+ <type>int</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>byte</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>byte</type>
+ </source>
+</block>
diff --git a/grc/blocks/gr_diff_decoder_bb.xml b/grc/blocks/gr_diff_decoder_bb.xml
new file mode 100644
index 000000000..ea7cf1734
--- /dev/null
+++ b/grc/blocks/gr_diff_decoder_bb.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Differential Decoder
+###################################################
+ -->
+<block>
+ <name>Differential Decoder</name>
+ <key>gr_diff_decoder_bb</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.diff_decoder_bb($modulus)</make>
+ <param>
+ <name>Modulus</name>
+ <key>modulus</key>
+ <type>int</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>byte</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>byte</type>
+ </source>
+</block>
diff --git a/grc/blocks/gr_diff_encoder_bb.xml b/grc/blocks/gr_diff_encoder_bb.xml
new file mode 100644
index 000000000..21241eac2
--- /dev/null
+++ b/grc/blocks/gr_diff_encoder_bb.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Differential Encoder
+###################################################
+ -->
+<block>
+ <name>Differential Encoder</name>
+ <key>gr_diff_encoder_bb</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.diff_encoder_bb($modulus)</make>
+ <param>
+ <name>Modulus</name>
+ <key>modulus</key>
+ <type>int</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>byte</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>byte</type>
+ </source>
+</block>
diff --git a/grc/blocks/gr_diff_phasor_cc.xml b/grc/blocks/gr_diff_phasor_cc.xml
new file mode 100644
index 000000000..2b2d7e372
--- /dev/null
+++ b/grc/blocks/gr_diff_phasor_cc.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Differential Phasor
+###################################################
+ -->
+<block>
+ <name>Differential Phasor</name>
+ <key>gr_diff_phasor_cc</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.diff_phasor_cc()</make>
+ <sink>
+ <name>in</name>
+ <type>complex</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>complex</type>
+ </source>
+</block>
diff --git a/grc/blocks/gr_divide_xx.xml b/grc/blocks/gr_divide_xx.xml
new file mode 100644
index 000000000..04667bc2a
--- /dev/null
+++ b/grc/blocks/gr_divide_xx.xml
@@ -0,0 +1,63 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Divide Block:
+## all types, 1 output, 2 to inf inputs
+###################################################
+ -->
+<block>
+ <name>Divide</name>
+ <key>gr_divide_xx</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.divide_$(type.fcn)($vlen)</make>
+ <param>
+ <name>IO Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>fcn:cc</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>fcn:ff</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>fcn:ii</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>fcn:ss</opt>
+ </option>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Num Inputs</name>
+ <key>num_inputs</key>
+ <value>2</value>
+ <type>int</type>
+ </param>
+ <check>$vlen &gt; 0</check>
+ <check>$num_inputs &gt;= 2</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ <nports>$num_inputs</nports>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </source>
+</block>
diff --git a/grc/blocks/gr_dpll_bb.xml b/grc/blocks/gr_dpll_bb.xml
new file mode 100644
index 000000000..044d398ff
--- /dev/null
+++ b/grc/blocks/gr_dpll_bb.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Detect Peak
+###################################################
+ -->
+<block>
+ <name>Detect Peak</name>
+ <key>gr_dpll_bb</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.dpll_bb($period, $gain)</make>
+ <param>
+ <name>Period</name>
+ <key>period</key>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Gain</name>
+ <key>gain</key>
+ <type>real</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>byte</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>byte</type>
+ </source>
+</block>
diff --git a/grc/blocks/gr_encode_ccsds_27_bb.xml b/grc/blocks/gr_encode_ccsds_27_bb.xml
new file mode 100644
index 000000000..f31e6b6c8
--- /dev/null
+++ b/grc/blocks/gr_encode_ccsds_27_bb.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Encode CCSDS 27
+###################################################
+ -->
+<block>
+ <name>Encode CCSDS 27</name>
+ <key>gr_encode_ccsds_27_bb</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.encode_ccsds_27_bb()</make>
+ <sink>
+ <name>in</name>
+ <type>byte</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>byte</type>
+ </source>
+</block>
diff --git a/grc/blocks/gr_endian_swap.xml b/grc/blocks/gr_endian_swap.xml
new file mode 100644
index 000000000..aa564026c
--- /dev/null
+++ b/grc/blocks/gr_endian_swap.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Add Block:
+## all types, 1 output, 2 to inf inputs
+###################################################
+ -->
+<block>
+ <name>Endian Swap</name>
+ <key>gr_endian_swap</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.endian_swap($type.size)</make>
+ <param>
+ <name>IO Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>size:8</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>s32</key>
+ <opt>size:4</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>s16</key>
+ <opt>size:2</opt>
+ </option>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ </source>
+</block>
diff --git a/grc/blocks/gr_feedforward_agc_cc.xml b/grc/blocks/gr_feedforward_agc_cc.xml
new file mode 100644
index 000000000..24e80953f
--- /dev/null
+++ b/grc/blocks/gr_feedforward_agc_cc.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Feed Forward AGC
+###################################################
+ -->
+<block>
+ <name>Feed Forward AGC</name>
+ <key>gr_feedforward_agc_cc</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.feedforward_agc_cc($num_samples, $reference)</make>
+ <param>
+ <name>Num Samples</name>
+ <key>num_samples</key>
+ <value>1024</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Reference</name>
+ <key>reference</key>
+ <value>1.0</value>
+ <type>real</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>complex</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>complex</type>
+ </source>
+</block>
diff --git a/grc/blocks/gr_fft_filter_xxx.xml b/grc/blocks/gr_fft_filter_xxx.xml
new file mode 100644
index 000000000..5b4cd83cc
--- /dev/null
+++ b/grc/blocks/gr_fft_filter_xxx.xml
@@ -0,0 +1,59 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##FFT Filter
+###################################################
+ -->
+<block>
+ <name>FFT Filter</name>
+ <key>gr_fft_filter_xxx</key>
+ <import>from gnuradio import gr</import>
+ <import>from gnuradio.gr import firdes</import>
+ <make>gr.fft_filter_$(type)($decim, $taps, $nthreads)</make>
+ <callback>set_taps($taps)</callback>
+ <callback>set_nthreads($nthreads)</callback>
+ <param>
+ <name>Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex->Complex (Complex Taps)</name>
+ <key>ccc</key>
+ <opt>input:complex</opt>
+ <opt>output:complex</opt>
+ <opt>taps:complex_vector</opt>
+ </option>
+ <option>
+ <name>Float->Float (Real Taps)</name>
+ <key>fff</key>
+ <opt>input:float</opt>
+ <opt>output:float</opt>
+ <opt>taps:real_vector</opt>
+ </option>
+ </param>
+ <param>
+ <name>Decimation</name>
+ <key>decim</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Taps</name>
+ <key>taps</key>
+ <type>$type.taps</type>
+ </param>
+ <param>
+ <name>Num. Threads</name>
+ <key>nthreads</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>$type.input</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type.output</type>
+ </source>
+</block>
diff --git a/grc/blocks/gr_fft_vxx.xml b/grc/blocks/gr_fft_vxx.xml
new file mode 100644
index 000000000..565354e41
--- /dev/null
+++ b/grc/blocks/gr_fft_vxx.xml
@@ -0,0 +1,88 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##FFT
+###################################################
+ -->
+<block>
+ <name>FFT</name>
+ <key>gr_fft_vxx</key>
+ <import>from gnuradio import gr</import>
+ <import>from gnuradio import window</import>
+ <make>#if $type() == "complex"
+gr.fft_vcc($fft_size, $forward, $window, $shift, $nthreads)
+#else
+gr.fft_vfc($fft_size, $forward, $window, $nthreads)
+#end if</make>
+ <callback>set_nthreads($nthreads)</callback>
+ <param>
+ <name>Input Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>hide_shift:</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>hide_shift:all</opt>
+ </option>
+ </param>
+ <param>
+ <name>FFT Size</name>
+ <key>fft_size</key>
+ <value>1024</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Forward/Reverse</name>
+ <key>forward</key>
+ <type>enum</type>
+ <option>
+ <name>Forward</name>
+ <key>True</key>
+ </option>
+ <option>
+ <name>Reverse</name>
+ <key>False</key>
+ </option>
+ </param>
+ <param>
+ <name>Window</name>
+ <key>window</key>
+ <value>window.blackmanharris(1024)</value>
+ <type>real_vector</type>
+ </param>
+ <param>
+ <name>Shift</name>
+ <key>shift</key>
+ <type>enum</type>
+ <hide>$type.hide_shift</hide>
+ <option>
+ <name>Yes</name>
+ <key>True</key>
+ </option>
+ <option>
+ <name>No</name>
+ <key>False</key>
+ </option>
+ </param>
+ <param>
+ <name>Num. Threads</name>
+ <key>nthreads</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <vlen>$fft_size</vlen>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>complex</type>
+ <vlen>$fft_size</vlen>
+ </source>
+</block>
diff --git a/grc/blocks/gr_file_sink.xml b/grc/blocks/gr_file_sink.xml
new file mode 100644
index 000000000..d0a693900
--- /dev/null
+++ b/grc/blocks/gr_file_sink.xml
@@ -0,0 +1,78 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##File Sink
+###################################################
+ -->
+<block>
+ <name>File Sink</name>
+ <key>gr_file_sink</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.file_sink($type.size*$vlen, $file)
+self.$(id).set_unbuffered($unbuffered)</make>
+ <callback>set_unbuffered($unbuffered)</callback>
+ <callback>open($file)</callback>
+ <param>
+ <name>File</name>
+ <key>file</key>
+ <value></value>
+ <type>file_save</type>
+ </param>
+ <param>
+ <name>Input Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>size:gr.sizeof_gr_complex</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>size:gr.sizeof_float</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>size:gr.sizeof_int</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>size:gr.sizeof_short</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>size:gr.sizeof_char</opt>
+ </option>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Unbuffered</name>
+ <key>unbuffered</key>
+ <value>False</value>
+ <type>bool</type>
+ <option>
+ <name>Off</name>
+ <key>False</key>
+ </option>
+ <option>
+ <name>On</name>
+ <key>True</key>
+ </option>
+ </param>
+
+ <check>$vlen &gt; 0</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </sink>
+</block>
diff --git a/grc/blocks/gr_file_source.xml b/grc/blocks/gr_file_source.xml
new file mode 100644
index 000000000..5f0e16b27
--- /dev/null
+++ b/grc/blocks/gr_file_source.xml
@@ -0,0 +1,75 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##File Source
+###################################################
+ -->
+<block>
+ <name>File Source</name>
+ <key>gr_file_source</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.file_source($type.size*$vlen, $file, $repeat)</make>
+ <callback>open($file, $repeat)</callback>
+ <param>
+ <name>File</name>
+ <key>file</key>
+ <value></value>
+ <type>file_open</type>
+ </param>
+ <param>
+ <name>Output Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>size:gr.sizeof_gr_complex</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>size:gr.sizeof_float</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>size:gr.sizeof_int</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>size:gr.sizeof_short</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>size:gr.sizeof_char</opt>
+ </option>
+ </param>
+ <param>
+ <name>Repeat</name>
+ <key>repeat</key>
+ <value>True</value>
+ <type>enum</type>
+ <option>
+ <name>Yes</name>
+ <key>True</key>
+ </option>
+ <option>
+ <name>No</name>
+ <key>False</key>
+ </option>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$vlen &gt; 0</check>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </source>
+</block>
diff --git a/grc/blocks/gr_filter_delay_fc.xml b/grc/blocks/gr_filter_delay_fc.xml
new file mode 100644
index 000000000..30d65bf82
--- /dev/null
+++ b/grc/blocks/gr_filter_delay_fc.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Filter Delay
+###################################################
+ -->
+<block>
+ <name>Filter Delay</name>
+ <key>gr_filter_delay_fc</key>
+ <import>from gnuradio import gr</import>
+ <import>from gnuradio.gr import firdes</import>
+ <make>gr.filter_delay_fc($taps)</make>
+ <param>
+ <name>Taps</name>
+ <key>taps</key>
+ <type>real_vector</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>float</type>
+ </sink>
+ <sink>
+ <name>in</name>
+ <type>float</type>
+ <optional>1</optional>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>complex</type>
+ </source>
+</block>
diff --git a/grc/blocks/gr_fir_filter_xxx.xml b/grc/blocks/gr_fir_filter_xxx.xml
new file mode 100644
index 000000000..c4de8f539
--- /dev/null
+++ b/grc/blocks/gr_fir_filter_xxx.xml
@@ -0,0 +1,80 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Decimating FIR Filter
+###################################################
+ -->
+<block>
+ <name>Decimating FIR Filter</name>
+ <key>gr_fir_filter_xxx</key>
+ <import>from gnuradio import gr</import>
+ <import>from gnuradio.gr import firdes</import>
+ <make>gr.fir_filter_$(type)($decim, $taps)</make>
+ <callback>set_taps($taps)</callback>
+ <param>
+ <name>Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex->Complex (Complex Taps)</name>
+ <key>ccc</key>
+ <opt>input:complex</opt>
+ <opt>output:complex</opt>
+ <opt>taps:complex_vector</opt>
+ </option>
+ <option>
+ <name>Complex->Complex (Real Taps)</name>
+ <key>ccf</key>
+ <opt>input:complex</opt>
+ <opt>output:complex</opt>
+ <opt>taps:real_vector</opt>
+ </option>
+ <option>
+ <name>Float->Complex (Complex Taps)</name>
+ <key>fcc</key>
+ <opt>input:float</opt>
+ <opt>output:complex</opt>
+ <opt>taps:complex_vector</opt>
+ </option>
+ <option>
+ <name>Float->Float (Real Taps)</name>
+ <key>fff</key>
+ <opt>input:float</opt>
+ <opt>output:float</opt>
+ <opt>taps:real_vector</opt>
+ </option>
+ <option>
+ <name>Float->Short (Real Taps)</name>
+ <key>fsf</key>
+ <opt>input:float</opt>
+ <opt>output:short</opt>
+ <opt>taps:real_vector</opt>
+ </option>
+ <option>
+ <name>Short->Complex (Complex Taps)</name>
+ <key>scc</key>
+ <opt>input:short</opt>
+ <opt>output:complex</opt>
+ <opt>taps:complex_vector</opt>
+ </option>
+ </param>
+ <param>
+ <name>Decimation</name>
+ <key>decim</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Taps</name>
+ <key>taps</key>
+ <type>$type.taps</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>$type.input</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type.output</type>
+ </source>
+</block>
diff --git a/grc/blocks/gr_float_to_char.xml b/grc/blocks/gr_float_to_char.xml
new file mode 100644
index 000000000..1fa500e3c
--- /dev/null
+++ b/grc/blocks/gr_float_to_char.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Float to Char:
+###################################################
+ -->
+<block>
+ <name>Float To Char</name>
+ <key>gr_float_to_char</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.float_to_char($vlen, $scale)</make>
+ <callback>set_scale($scale)</callback>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Scale</name>
+ <key>scale</key>
+ <value>1</value>
+ <type>real</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>float</type>
+ <vlen>$vlen</vlen>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>byte</type>
+ <vlen>$vlen</vlen>
+ </source>
+</block>
diff --git a/grc/blocks/gr_float_to_complex.xml b/grc/blocks/gr_float_to_complex.xml
new file mode 100644
index 000000000..a42cff358
--- /dev/null
+++ b/grc/blocks/gr_float_to_complex.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Float to Complex:
+## one or two input streams
+###################################################
+ -->
+<block>
+ <name>Float To Complex</name>
+ <key>gr_float_to_complex</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.float_to_complex($vlen)</make>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$vlen &gt; 0</check>
+ <sink>
+ <name>re</name>
+ <type>float</type>
+ <vlen>$vlen</vlen>
+ </sink>
+ <sink>
+ <name>im</name>
+ <type>float</type>
+ <vlen>$vlen</vlen>
+ <optional>1</optional>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>complex</type>
+ <vlen>$vlen</vlen>
+ </source>
+</block>
diff --git a/grc/blocks/gr_float_to_int.xml b/grc/blocks/gr_float_to_int.xml
new file mode 100644
index 000000000..b43c208a5
--- /dev/null
+++ b/grc/blocks/gr_float_to_int.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Float to Int:
+###################################################
+ -->
+<block>
+ <name>Float To Int</name>
+ <key>gr_float_to_int</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.float_to_int($vlen, $scale)</make>
+ <callback>set_scale($scale)</callback>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Scale</name>
+ <key>scale</key>
+ <value>1</value>
+ <type>real</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>float</type>
+ <vlen>$vlen</vlen>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>int</type>
+ <vlen>$vlen</vlen>
+ </source>
+</block>
diff --git a/grc/blocks/gr_float_to_short.xml b/grc/blocks/gr_float_to_short.xml
new file mode 100644
index 000000000..4f76b8f58
--- /dev/null
+++ b/grc/blocks/gr_float_to_short.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Float to Short:
+###################################################
+ -->
+<block>
+ <name>Float To Short</name>
+ <key>gr_float_to_short</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.float_to_short($vlen, $scale)</make>
+ <callback>set_scale($scale)</callback>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Scale</name>
+ <key>scale</key>
+ <value>1</value>
+ <type>real</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>float</type>
+ <vlen>$vlen</vlen>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>short</type>
+ <vlen>$vlen</vlen>
+ </source>
+</block>
diff --git a/grc/blocks/gr_float_to_uchar.xml b/grc/blocks/gr_float_to_uchar.xml
new file mode 100644
index 000000000..aa804d7d9
--- /dev/null
+++ b/grc/blocks/gr_float_to_uchar.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Float to Unsigned Char:
+###################################################
+ -->
+<block>
+ <name>Float To UChar</name>
+ <key>gr_float_to_uchar</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.float_to_uchar()</make>
+ <sink>
+ <name>in</name>
+ <type>float</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>byte</type>
+ </source>
+</block>
diff --git a/grc/blocks/gr_fractional_interpolator_xx.xml b/grc/blocks/gr_fractional_interpolator_xx.xml
new file mode 100644
index 000000000..8d65ff8bf
--- /dev/null
+++ b/grc/blocks/gr_fractional_interpolator_xx.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Fractional Interpolator
+###################################################
+ -->
+<block>
+ <name>Fractional Interpolator</name>
+ <key>gr_fractional_interpolator_xx</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.fractional_interpolator_$(type.fcn)($phase_shift, $interp_ratio)</make>
+ <callback>set_interp_ratio($interp_ratio)</callback>
+ <param>
+ <name>Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>fcn:cc</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>fcn:ff</opt>
+ </option>
+ </param>
+ <param>
+ <name>Phase Shift</name>
+ <key>phase_shift</key>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Interpolation Ratio</name>
+ <key>interp_ratio</key>
+ <type>real</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ </source>
+</block>
diff --git a/grc/blocks/gr_freq_xlating_fir_filter_xxx.xml b/grc/blocks/gr_freq_xlating_fir_filter_xxx.xml
new file mode 100644
index 000000000..e3ee66977
--- /dev/null
+++ b/grc/blocks/gr_freq_xlating_fir_filter_xxx.xml
@@ -0,0 +1,93 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Frequency Xlating Filter
+###################################################
+ -->
+<block>
+ <name>Frequency Xlating FIR Filter</name>
+ <key>gr_freq_xlating_fir_filter_xxx</key>
+ <import>from gnuradio import gr</import>
+ <import>from gnuradio.gr import firdes</import>
+ <make>gr.freq_xlating_fir_filter_$(type)($decim, $taps, $center_freq, $samp_rate)</make>
+ <callback>set_taps($taps)</callback>
+ <callback>set_center_freq($center_freq)</callback>
+ <param>
+ <name>Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex->Complex (Complex Taps)</name>
+ <key>ccc</key>
+ <opt>input:complex</opt>
+ <opt>output:complex</opt>
+ <opt>taps:complex_vector</opt>
+ </option>
+ <option>
+ <name>Complex->Complex (Real Taps)</name>
+ <key>ccf</key>
+ <opt>input:complex</opt>
+ <opt>output:complex</opt>
+ <opt>taps:real_vector</opt>
+ </option>
+ <option>
+ <name>Float->Complex (Complex Taps)</name>
+ <key>fcc</key>
+ <opt>input:float</opt>
+ <opt>output:complex</opt>
+ <opt>taps:complex_vector</opt>
+ </option>
+ <option>
+ <name>Float->Complex (Real Taps)</name>
+ <key>fcf</key>
+ <opt>input:float</opt>
+ <opt>output:complex</opt>
+ <opt>taps:real_vector</opt>
+ </option>
+ <option>
+ <name>Short->Complex (Complex Taps)</name>
+ <key>scc</key>
+ <opt>input:short</opt>
+ <opt>output:complex</opt>
+ <opt>taps:complex_vector</opt>
+ </option>
+ <option>
+ <name>Short->Complex (Real Taps)</name>
+ <key>scf</key>
+ <opt>input:short</opt>
+ <opt>output:complex</opt>
+ <opt>taps:real_vector</opt>
+ </option>
+ </param>
+ <param>
+ <name>Decimation</name>
+ <key>decim</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Taps</name>
+ <key>taps</key>
+ <type>$type.taps</type>
+ </param>
+ <param>
+ <name>Center Frequency</name>
+ <key>center_freq</key>
+ <value>0</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Sample Rate</name>
+ <key>samp_rate</key>
+ <value>samp_rate</value>
+ <type>real</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>$type.input</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type.output</type>
+ </source>
+</block>
diff --git a/grc/blocks/gr_frequency_modulator_fc.xml b/grc/blocks/gr_frequency_modulator_fc.xml
new file mode 100644
index 000000000..d5f8fcfe3
--- /dev/null
+++ b/grc/blocks/gr_frequency_modulator_fc.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Frequency Modulator
+###################################################
+ -->
+<block>
+ <name>Frequency Mod</name>
+ <key>gr_frequency_modulator_fc</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.frequency_modulator_fc($sensitivity)</make>
+ <callback>set_sensitivity($sensitivity)</callback>
+ <param>
+ <name>Sensitivity</name>
+ <key>sensitivity</key>
+ <type>real</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>float</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>complex</type>
+ </source>
+</block>
diff --git a/grc/blocks/gr_glfsr_source_x.xml b/grc/blocks/gr_glfsr_source_x.xml
new file mode 100644
index 000000000..88fb66797
--- /dev/null
+++ b/grc/blocks/gr_glfsr_source_x.xml
@@ -0,0 +1,59 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##GLFSR Source
+###################################################
+ -->
+<block>
+ <name>GLFSR Source</name>
+ <key>gr_glfsr_source_x</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.glfsr_source_$(type.fcn)($degree, $repeat, $mask, $seed)</make>
+ <param>
+ <name>Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>fcn:f</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>fcn:b</opt>
+ </option>
+ </param>
+ <param>
+ <name>Degree</name>
+ <key>degree</key>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Repeat</name>
+ <key>repeat</key>
+ <type>enum</type>
+ <option>
+ <name>Yes</name>
+ <key>True</key>
+ </option>
+ <option>
+ <name>No</name>
+ <key>False</key>
+ </option>
+ </param>
+ <param>
+ <name>Mask</name>
+ <key>mask</key>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Seed</name>
+ <key>seed</key>
+ <type>int</type>
+ </param>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ </source>
+</block>
diff --git a/grc/blocks/gr_goertzel_fc.xml b/grc/blocks/gr_goertzel_fc.xml
new file mode 100644
index 000000000..f27d9582e
--- /dev/null
+++ b/grc/blocks/gr_goertzel_fc.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Goertzel
+###################################################
+ -->
+<block>
+ <name>Goertzel</name>
+ <key>gr_goertzel_fc</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.goertzel_fc($rate, $len, $freq)</make>
+ <callback>set_freq($freq)</callback>
+ <callback>set_rate($rate)</callback>
+ <param>
+ <name>Rate</name>
+ <key>rate</key>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Length</name>
+ <key>len</key>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Frequency</name>
+ <key>freq</key>
+ <type>real</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>float</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>complex</type>
+ </source>
+</block>
diff --git a/grc/blocks/gr_head.xml b/grc/blocks/gr_head.xml
new file mode 100644
index 000000000..e5ff7f6aa
--- /dev/null
+++ b/grc/blocks/gr_head.xml
@@ -0,0 +1,65 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Head
+###################################################
+ -->
+<block>
+ <name>Head</name>
+ <key>gr_head</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.head($type.size*$vlen, $num_items)</make>
+ <param>
+ <name>Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>size:gr.sizeof_gr_complex</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>size:gr.sizeof_float</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>size:gr.sizeof_int</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>size:gr.sizeof_short</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>size:gr.sizeof_char</opt>
+ </option>
+ </param>
+ <param>
+ <name>Num Items</name>
+ <key>num_items</key>
+ <value>1024</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$vlen &gt; 0</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </source>
+</block>
diff --git a/grc/blocks/gr_hilbert_fc.xml b/grc/blocks/gr_hilbert_fc.xml
new file mode 100644
index 000000000..165e8da23
--- /dev/null
+++ b/grc/blocks/gr_hilbert_fc.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Hilbert
+###################################################
+ -->
+<block>
+ <name>Hilbert</name>
+ <key>gr_hilbert_fc</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.hilbert_fc($num_taps)</make>
+ <param>
+ <name>Num Taps</name>
+ <key>num_taps</key>
+ <value>64</value>
+ <type>int</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>float</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>complex</type>
+ </source>
+</block>
diff --git a/grc/blocks/gr_iir_filter_ffd.xml b/grc/blocks/gr_iir_filter_ffd.xml
new file mode 100644
index 000000000..9799150e8
--- /dev/null
+++ b/grc/blocks/gr_iir_filter_ffd.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##IIR Filter
+###################################################
+ -->
+<block>
+ <name>IIR Filter</name>
+ <key>gr_iir_filter_ffd</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.iir_filter_ffd($fftaps, $fbtaps)</make>
+ <callback>set_taps($fftaps, $fbtaps)</callback>
+ <param>
+ <name>Feed-forward Taps</name>
+ <key>fftaps</key>
+ <type>real_vector</type>
+ </param>
+ <param>
+ <name>Feedback Taps</name>
+ <key>fbtaps</key>
+ <type>real_vector</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>float</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>float</type>
+ </source>
+</block>
diff --git a/grc/blocks/gr_int_to_float.xml b/grc/blocks/gr_int_to_float.xml
new file mode 100644
index 000000000..7430fec72
--- /dev/null
+++ b/grc/blocks/gr_int_to_float.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Int to Float:
+###################################################
+ -->
+<block>
+ <name>Int To Float</name>
+ <key>gr_int_to_float</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.int_to_float($vlen, $scale)</make>
+ <callback>set_scale($scale)</callback>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Scale</name>
+ <key>scale</key>
+ <value>1</value>
+ <type>real</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>int</type>
+ <vlen>$vlen</vlen>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>float</type>
+ <vlen>$vlen</vlen>
+ </source>
+</block>
diff --git a/grc/blocks/gr_integrate_xx.xml b/grc/blocks/gr_integrate_xx.xml
new file mode 100644
index 000000000..d0ebd42e2
--- /dev/null
+++ b/grc/blocks/gr_integrate_xx.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Integrate
+###################################################
+ -->
+<block>
+ <name>Integrate</name>
+ <key>gr_integrate_xx</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.integrate_$(type.fcn)($decim)</make>
+ <param>
+ <name>IO Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>fcn:cc</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>fcn:ff</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>fcn:ii</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>fcn:ss</opt>
+ </option>
+ </param>
+ <param>
+ <name>Decimation</name>
+ <key>decim</key>
+ <type>int</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ </source>
+</block>
diff --git a/grc/blocks/gr_interleave.xml b/grc/blocks/gr_interleave.xml
new file mode 100644
index 000000000..3db16ab55
--- /dev/null
+++ b/grc/blocks/gr_interleave.xml
@@ -0,0 +1,67 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Interleave
+###################################################
+ -->
+<block>
+ <name>Interleave</name>
+ <key>gr_interleave</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.interleave($type.size*$vlen)</make>
+ <param>
+ <name>IO Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>size:gr.sizeof_gr_complex</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>size:gr.sizeof_float</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>size:gr.sizeof_int</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>size:gr.sizeof_short</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>size:gr.sizeof_char</opt>
+ </option>
+ </param>
+ <param>
+ <name>Num Streams</name>
+ <key>num_streams</key>
+ <value>2</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$num_streams &gt; 0</check>
+ <check>$vlen &gt;= 1</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ <nports>$num_streams</nports>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </source>
+</block>
diff --git a/grc/blocks/gr_interleaved_short_to_complex.xml b/grc/blocks/gr_interleaved_short_to_complex.xml
new file mode 100644
index 000000000..e3023e499
--- /dev/null
+++ b/grc/blocks/gr_interleaved_short_to_complex.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Interleaved Short to Complex:
+###################################################
+ -->
+<block>
+ <name>IShort To Complex</name>
+ <key>gr_interleaved_short_to_complex</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.interleaved_short_to_complex()</make>
+ <sink>
+ <name>in</name>
+ <type>short</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>complex</type>
+ </source>
+</block>
diff --git a/grc/blocks/gr_interp_fir_filter_xxx.xml b/grc/blocks/gr_interp_fir_filter_xxx.xml
new file mode 100644
index 000000000..55375ae02
--- /dev/null
+++ b/grc/blocks/gr_interp_fir_filter_xxx.xml
@@ -0,0 +1,80 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Interpolating FIR Filter
+###################################################
+ -->
+<block>
+ <name>Interpolating FIR Filter</name>
+ <key>gr_interp_fir_filter_xxx</key>
+ <import>from gnuradio import gr</import>
+ <import>from gnuradio.gr import firdes</import>
+ <make>gr.interp_fir_filter_$(type)($interp, $taps)</make>
+ <callback>set_taps($taps)</callback>
+ <param>
+ <name>Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex->Complex (Complex Taps)</name>
+ <key>ccc</key>
+ <opt>input:complex</opt>
+ <opt>output:complex</opt>
+ <opt>taps:complex_vector</opt>
+ </option>
+ <option>
+ <name>Complex->Complex (Real Taps)</name>
+ <key>ccf</key>
+ <opt>input:complex</opt>
+ <opt>output:complex</opt>
+ <opt>taps:real_vector</opt>
+ </option>
+ <option>
+ <name>Float->Complex (Complex Taps)</name>
+ <key>fcc</key>
+ <opt>input:float</opt>
+ <opt>output:complex</opt>
+ <opt>taps:complex_vector</opt>
+ </option>
+ <option>
+ <name>Float->Float (Real Taps)</name>
+ <key>fff</key>
+ <opt>input:float</opt>
+ <opt>output:float</opt>
+ <opt>taps:real_vector</opt>
+ </option>
+ <option>
+ <name>Float->Short (Real Taps)</name>
+ <key>fsf</key>
+ <opt>input:float</opt>
+ <opt>output:short</opt>
+ <opt>taps:real_vector</opt>
+ </option>
+ <option>
+ <name>Short->Complex (Complex Taps)</name>
+ <key>scc</key>
+ <opt>input:short</opt>
+ <opt>output:complex</opt>
+ <opt>taps:complex_vector</opt>
+ </option>
+ </param>
+ <param>
+ <name>Interpolation</name>
+ <key>interp</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Taps</name>
+ <key>taps</key>
+ <type>$type.taps</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>$type.input</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type.output</type>
+ </source>
+</block>
diff --git a/grc/blocks/gr_iqcomp_cc.xml b/grc/blocks/gr_iqcomp_cc.xml
new file mode 100644
index 000000000..1603bdc42
--- /dev/null
+++ b/grc/blocks/gr_iqcomp_cc.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##IQ Comp
+###################################################
+ -->
+<block>
+ <name>IQ Comp</name>
+ <key>gr_iqcomp_cc</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.iqcomp_cc($mu)</make>
+ <param>
+ <name>Mu</name>
+ <key>mu</key>
+ <type>real</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>complex</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>complex</type>
+ </source>
+</block>
diff --git a/grc/blocks/gr_keep_m_in_n.xml b/grc/blocks/gr_keep_m_in_n.xml
new file mode 100644
index 000000000..35a156176
--- /dev/null
+++ b/grc/blocks/gr_keep_m_in_n.xml
@@ -0,0 +1,76 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Keep M in N
+###################################################
+ -->
+<block>
+ <name>Keep M in N</name>
+ <key>gr_keep_m_in_n</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.keep_m_in_n($type.size, $m, $n, $offset)</make>
+ <callback>set_offset($offset)</callback>
+ <callback>set_m($m)</callback>
+ <callback>set_n($n)</callback>
+ <param>
+ <name>Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>size:gr.sizeof_gr_complex</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>size:gr.sizeof_float</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>size:gr.sizeof_int</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>size:gr.sizeof_short</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>size:gr.sizeof_char</opt>
+ </option>
+ </param>
+ <param>
+ <name>M</name>
+ <key>m</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>N</name>
+ <key>n</key>
+ <value>2</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>initial offset</name>
+ <key>offset</key>
+ <value>0</value>
+ <type>int</type>
+ </param>
+ <check>$n &gt; 0</check>
+ <check>$m &gt; 0</check>
+ <check>$m &lt; $n</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <vlen>1</vlen>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ <vlen>1</vlen>
+ </source>
+</block>
diff --git a/grc/blocks/gr_keep_one_in_n.xml b/grc/blocks/gr_keep_one_in_n.xml
new file mode 100644
index 000000000..21595b755
--- /dev/null
+++ b/grc/blocks/gr_keep_one_in_n.xml
@@ -0,0 +1,67 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Keep 1 in N
+###################################################
+ -->
+<block>
+ <name>Keep 1 in N</name>
+ <key>gr_keep_one_in_n</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.keep_one_in_n($type.size*$vlen, $n)</make>
+ <callback>set_n($n)</callback>
+ <param>
+ <name>Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>size:gr.sizeof_gr_complex</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>size:gr.sizeof_float</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>size:gr.sizeof_int</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>size:gr.sizeof_short</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>size:gr.sizeof_char</opt>
+ </option>
+ </param>
+ <param>
+ <name>N</name>
+ <key>n</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$n &gt; 0</check>
+ <check>$vlen &gt; 0</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </source>
+</block>
diff --git a/grc/blocks/gr_kludge_copy.xml b/grc/blocks/gr_kludge_copy.xml
new file mode 100644
index 000000000..8058b082d
--- /dev/null
+++ b/grc/blocks/gr_kludge_copy.xml
@@ -0,0 +1,68 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Kludge Copy
+###################################################
+ -->
+<block>
+ <name>Kludge Copy</name>
+ <key>gr_kludge_copy</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.kludge_copy($type.size*$vlen)</make>
+ <param>
+ <name>Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>size:gr.sizeof_gr_complex</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>size:gr.sizeof_float</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>size:gr.sizeof_int</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>size:gr.sizeof_short</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>size:gr.sizeof_char</opt>
+ </option>
+ </param>
+ <param>
+ <name>Num Ports</name>
+ <key>num_ports</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$num_ports &gt; 0</check>
+ <check>$vlen &gt; 0</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ <nports>$num_ports</nports>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ <nports>$num_ports</nports>
+ </source>
+</block>
diff --git a/grc/blocks/gr_map_bb.xml b/grc/blocks/gr_map_bb.xml
new file mode 100644
index 000000000..20d6bd2b4
--- /dev/null
+++ b/grc/blocks/gr_map_bb.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Map
+###################################################
+ -->
+<block>
+ <name>Map</name>
+ <key>gr_map_bb</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.map_bb($map)</make>
+ <param>
+ <name>Map</name>
+ <key>map</key>
+ <type>int_vector</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>byte</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>byte</type>
+ </source>
+</block>
diff --git a/grc/blocks/gr_max_xx.xml b/grc/blocks/gr_max_xx.xml
new file mode 100644
index 000000000..9dbbe60e5
--- /dev/null
+++ b/grc/blocks/gr_max_xx.xml
@@ -0,0 +1,58 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Max:
+## 1 output, 2 to inf inputs
+###################################################
+ -->
+<block>
+ <name>Max</name>
+ <key>gr_max_xx</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.max_$(type.fcn)($vlen)</make>
+ <param>
+ <name>IO Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>fcn:ff</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>fcn:ii</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>fcn:dd</opt>
+ </option>
+ </param>
+ <param>
+ <name>Num Inputs</name>
+ <key>num_inputs</key>
+ <value>2</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$num_inputs &gt;= 2</check>
+ <check>$vlen &gt;= 1</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ <nports>$num_inputs</nports>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </source>
+</block>
diff --git a/grc/blocks/gr_message_burst_source.xml b/grc/blocks/gr_message_burst_source.xml
new file mode 100644
index 000000000..e835d2a2c
--- /dev/null
+++ b/grc/blocks/gr_message_burst_source.xml
@@ -0,0 +1,58 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Message Burst Source (the sink port is a message)
+###################################################
+ -->
+<block>
+ <name>Message Burst Source</name>
+ <key>gr_message_burst_source</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.message_burst_source($type.size*$vlen, $(id)_msgq_in)</make>
+ <param>
+ <name>Output Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>size:gr.sizeof_gr_complex</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>size:gr.sizeof_float</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>size:gr.sizeof_int</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>size:gr.sizeof_short</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>size:gr.sizeof_char</opt>
+ </option>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$vlen &gt; 0</check>
+ <sink>
+ <name>in</name>
+ <type>msg</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </source>
+</block>
diff --git a/grc/blocks/gr_message_debug.xml b/grc/blocks/gr_message_debug.xml
new file mode 100644
index 000000000..964f95756
--- /dev/null
+++ b/grc/blocks/gr_message_debug.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Message Debug
+###################################################
+ -->
+<block>
+ <name>Message Debug</name>
+ <key>gr_message_debug</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.message_debug()</make>
+ <sink>
+ <name>print</name>
+ <type>message</type>
+ <optional>1</optional>
+ </sink>
+ <sink>
+ <name>store</name>
+ <type>message</type>
+ <optional>1</optional>
+ </sink>
+ <sink>
+ <name>print_pdu</name>
+ <type>message</type>
+ <optional>1</optional>
+ </sink>
+</block>
diff --git a/grc/blocks/gr_message_sink.xml b/grc/blocks/gr_message_sink.xml
new file mode 100644
index 000000000..18e92adb9
--- /dev/null
+++ b/grc/blocks/gr_message_sink.xml
@@ -0,0 +1,72 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Message Sink (the source port is a message)
+###################################################
+ -->
+<block>
+ <name>Message Sink</name>
+ <key>gr_message_sink</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.message_sink($type.size*$vlen, $(id)_msgq_out, $dont_block)</make>
+ <param>
+ <name>Input Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>size:gr.sizeof_gr_complex</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>size:gr.sizeof_float</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>size:gr.sizeof_int</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>size:gr.sizeof_short</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>size:gr.sizeof_char</opt>
+ </option>
+ </param>
+ <param>
+ <name>Don't Block</name>
+ <key>dont_block</key>
+ <value>False</value>
+ <type>enum</type>
+ <option>
+ <name>Don't Block</name>
+ <key>True</key>
+ </option>
+ <option>
+ <name>Block</name>
+ <key>False</key>
+ </option>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$vlen &gt; 0</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>msg</type>
+ </source>
+</block>
diff --git a/grc/blocks/gr_message_source.xml b/grc/blocks/gr_message_source.xml
new file mode 100644
index 000000000..72367b21b
--- /dev/null
+++ b/grc/blocks/gr_message_source.xml
@@ -0,0 +1,58 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Message Source (the sink port is a message)
+###################################################
+ -->
+<block>
+ <name>Message Source</name>
+ <key>gr_message_source</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.message_source($type.size*$vlen, $(id)_msgq_in)</make>
+ <param>
+ <name>Output Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>size:gr.sizeof_gr_complex</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>size:gr.sizeof_float</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>size:gr.sizeof_int</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>size:gr.sizeof_short</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>size:gr.sizeof_char</opt>
+ </option>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$vlen &gt; 0</check>
+ <sink>
+ <name>in</name>
+ <type>msg</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </source>
+</block>
diff --git a/grc/blocks/gr_message_strobe.xml b/grc/blocks/gr_message_strobe.xml
new file mode 100644
index 000000000..60a7724df
--- /dev/null
+++ b/grc/blocks/gr_message_strobe.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Message Strobe
+###################################################
+ -->
+<block>
+ <name>Message Strobe</name>
+ <key>gr_message_strobe</key>
+ <import>from gnuradio import gr</import>
+ <import>from gruel import pmt</import>
+ <make>gr.message_strobe($msg, $period)</make>
+ <param>
+ <name>Message PMT</name>
+ <key>msg</key>
+ <value>pmt.pmt_intern("TEST")</value>
+ <type>raw</type>
+ </param>
+ <param>
+ <name>Period (ms)</name>
+ <key>period</key>
+ <value>1000</value>
+ <type>real</type>
+ </param>
+ <sink>
+ <name>set_msg</name>
+ <type>message</type>
+ <optional>1</optional>
+ </sink>
+ <source>
+ <name>strobe</name>
+ <type>message</type>
+ <optional>1</optional>
+ </source>
+</block>
diff --git a/grc/blocks/gr_moving_average_xx.xml b/grc/blocks/gr_moving_average_xx.xml
new file mode 100644
index 000000000..b70943c78
--- /dev/null
+++ b/grc/blocks/gr_moving_average_xx.xml
@@ -0,0 +1,68 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Moving Average
+###################################################
+ -->
+<block>
+ <name>Moving Average</name>
+ <key>gr_moving_average_xx</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.moving_average_$(type.fcn)($length, $scale, $max_iter)</make>
+ <callback>set_length_and_scale($length, $scale)</callback>
+ <param>
+ <name>Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>fcn:cc</opt>
+ <opt>scale:complex</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>fcn:ff</opt>
+ <opt>scale:real</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>fcn:ii</opt>
+ <opt>scale:int</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>fcn:ss</opt>
+ <opt>scale:int</opt>
+ </option>
+ </param>
+ <param>
+ <name>Length</name>
+ <key>length</key>
+ <value>1000</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Scale</name>
+ <key>scale</key>
+ <value>1</value>
+ <type>$type.scale</type>
+ </param>
+ <param>
+ <name>Max Iter</name>
+ <key>max_iter</key>
+ <value>4000</value>
+ <type>int</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ </source>
+</block>
diff --git a/grc/blocks/gr_mpsk_sync_cc.xml b/grc/blocks/gr_mpsk_sync_cc.xml
new file mode 100644
index 000000000..fd08f8340
--- /dev/null
+++ b/grc/blocks/gr_mpsk_sync_cc.xml
@@ -0,0 +1,69 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##MPSK Sync
+###################################################
+ -->
+<block>
+ <name>MPSK Sync</name>
+ <key>gr_mpsk_sync_cc</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.mpsk_sync_cc($alpha, $beta, $max_freq, $min_freq, $ref_phase, $omega, $gain_omega, $mu, $gain_mu)</make>
+ <callback>set_mu($mu)</callback>
+ <callback>set_gain_mu($gain_mu)</callback>
+ <callback>set_omega($omega)</callback>
+ <callback>set_gain_omega($gain_omega)</callback>
+ <param>
+ <name>Alpha</name>
+ <key>alpha</key>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Beta</name>
+ <key>beta</key>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Max Freq</name>
+ <key>max_freq</key>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Min Freq</name>
+ <key>min_freq</key>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Reference Phase</name>
+ <key>ref_phase</key>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Omega</name>
+ <key>omega</key>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Gain Omega</name>
+ <key>gain_omega</key>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Mu</name>
+ <key>mu</key>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Gain Mu</name>
+ <key>gain_mu</key>
+ <type>real</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>complex</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>complex</type>
+ </source>
+</block>
diff --git a/grc/blocks/gr_multiply_const_vxx.xml b/grc/blocks/gr_multiply_const_vxx.xml
new file mode 100644
index 000000000..1309d75cd
--- /dev/null
+++ b/grc/blocks/gr_multiply_const_vxx.xml
@@ -0,0 +1,67 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Multiply Const Block:
+## all types, 1 output, 1 input & const
+###################################################
+ -->
+<block>
+ <name>Multiply Const</name>
+ <key>gr_multiply_const_vxx</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.multiply_const_v$(type.fcn)($const)</make>
+ <callback>set_k($const)</callback>
+ <param>
+ <name>IO Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>const_type:complex_vector</opt>
+ <opt>fcn:cc</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>const_type:real_vector</opt>
+ <opt>fcn:ff</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>const_type:int_vector</opt>
+ <opt>fcn:ii</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>const_type:int_vector</opt>
+ <opt>fcn:ss</opt>
+ </option>
+ </param>
+ <param>
+ <name>Constant</name>
+ <key>const</key>
+ <value>0</value>
+ <type>$type.const_type</type>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>len($const) == $vlen</check>
+ <check>$vlen &gt; 0</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </source>
+</block>
diff --git a/grc/blocks/gr_multiply_xx.xml b/grc/blocks/gr_multiply_xx.xml
new file mode 100644
index 000000000..60f65c274
--- /dev/null
+++ b/grc/blocks/gr_multiply_xx.xml
@@ -0,0 +1,63 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Multiply Block:
+## all types, 1 output, 2 to inf inputs
+###################################################
+ -->
+<block>
+ <name>Multiply</name>
+ <key>gr_multiply_xx</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.multiply_v$(type.fcn)($vlen)</make>
+ <param>
+ <name>IO Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>fcn:cc</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>fcn:ff</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>fcn:ii</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>fcn:ss</opt>
+ </option>
+ </param>
+ <param>
+ <name>Num Inputs</name>
+ <key>num_inputs</key>
+ <value>2</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$num_inputs &gt; 1</check>
+ <check>$vlen &gt; 0</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ <nports>$num_inputs</nports>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </source>
+</block>
diff --git a/grc/blocks/gr_mute_xx.xml b/grc/blocks/gr_mute_xx.xml
new file mode 100644
index 000000000..a9a857c6a
--- /dev/null
+++ b/grc/blocks/gr_mute_xx.xml
@@ -0,0 +1,61 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Mute Block:
+## Cast input to bool.
+###################################################
+ -->
+<block>
+ <name>Mute</name>
+ <key>gr_mute_xx</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.mute_$(type.fcn)(bool($mute))</make>
+ <callback>set_mute(bool($mute))</callback>
+ <param>
+ <name>IO Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>fcn:cc</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>fcn:ff</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>fcn:ii</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>fcn:ss</opt>
+ </option>
+ </param>
+ <param>
+ <name>Mute</name>
+ <key>mute</key>
+ <value>False</value>
+ <type>raw</type>
+ <option>
+ <name>True</name>
+ <key>True</key>
+ </option>
+ <option>
+ <name>False</name>
+ <key>False</key>
+ </option>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ </source>
+</block>
diff --git a/grc/blocks/gr_nlog10_ff.xml b/grc/blocks/gr_nlog10_ff.xml
new file mode 100644
index 000000000..935078236
--- /dev/null
+++ b/grc/blocks/gr_nlog10_ff.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Log10 Block:
+## float in/ float out
+###################################################
+ -->
+<block>
+ <name>Log10</name>
+ <key>gr_nlog10_ff</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.nlog10_ff($n, $vlen, $k)</make>
+ <param>
+ <name>n</name>
+ <key>n</key>
+ <value>1</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>k</name>
+ <key>k</key>
+ <value>0</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$vlen >= 1</check>
+ <sink>
+ <name>in</name>
+ <type>float</type>
+ <vlen>$vlen</vlen>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>float</type>
+ <vlen>$vlen</vlen>
+ </source>
+</block>
diff --git a/grc/blocks/gr_noise_source_x.xml b/grc/blocks/gr_noise_source_x.xml
new file mode 100644
index 000000000..72daaaa20
--- /dev/null
+++ b/grc/blocks/gr_noise_source_x.xml
@@ -0,0 +1,77 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Noise Source
+###################################################
+ -->
+<block>
+ <name>Noise Source</name>
+ <key>gr_noise_source_x</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.noise_source_$(type.fcn)($noise_type, $amp, $seed)</make>
+ <callback>set_type($noise_type)</callback>
+ <callback>set_amplitude($amp)</callback>
+ <param>
+ <name>Output Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>fcn:c</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>fcn:f</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>fcn:i</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>fcn:s</opt>
+ </option>
+ </param>
+ <param>
+ <name>Noise Type</name>
+ <key>noise_type</key>
+ <value>gr.GR_GAUSSIAN</value>
+ <type>int</type>
+ <option>
+ <name>Uniform</name>
+ <key>gr.GR_UNIFORM</key>
+ </option>
+ <option>
+ <name>Gaussian</name>
+ <key>gr.GR_GAUSSIAN</key>
+ </option>
+ <option>
+ <name>Laplacian</name>
+ <key>gr.GR_LAPLACIAN</key>
+ </option>
+ <option>
+ <name>Impulse</name>
+ <key>gr.GR_IMPULSE</key>
+ </option>
+ </param>
+ <param>
+ <name>Amplitude</name>
+ <key>amp</key>
+ <value>1</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Seed</name>
+ <key>seed</key>
+ <value>0</value>
+ <type>int</type>
+ </param>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ </source>
+</block>
diff --git a/grc/blocks/gr_nop.xml b/grc/blocks/gr_nop.xml
new file mode 100644
index 000000000..bd884d6b8
--- /dev/null
+++ b/grc/blocks/gr_nop.xml
@@ -0,0 +1,68 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Nop
+###################################################
+ -->
+<block>
+ <name>Nop</name>
+ <key>gr_nop</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.nop($type.size*$vlen)</make>
+ <param>
+ <name>Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>size:gr.sizeof_gr_complex</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>size:gr.sizeof_float</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>size:gr.sizeof_int</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>size:gr.sizeof_short</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>size:gr.sizeof_char</opt>
+ </option>
+ </param>
+ <param>
+ <name>Num Ports</name>
+ <key>num_ports</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$num_ports &gt; 0</check>
+ <check>$vlen &gt; 0</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ <nports>$num_ports</nports>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ <nports>$num_ports</nports>
+ </source>
+</block>
diff --git a/grc/blocks/gr_not_xx.xml b/grc/blocks/gr_not_xx.xml
new file mode 100644
index 000000000..1c2bb8709
--- /dev/null
+++ b/grc/blocks/gr_not_xx.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Logical Not Block
+###################################################
+ -->
+<block>
+ <name>Not</name>
+ <key>gr_not_xx</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.not_$(type.fcn)()</make>
+ <param>
+ <name>IO Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>fcn:ii</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>fcn:ss</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>fcn:bb</opt>
+ </option>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ </source>
+</block>
diff --git a/grc/blocks/gr_null_sink.xml b/grc/blocks/gr_null_sink.xml
new file mode 100644
index 000000000..ed106b495
--- /dev/null
+++ b/grc/blocks/gr_null_sink.xml
@@ -0,0 +1,54 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Null Sink
+###################################################
+ -->
+<block>
+ <name>Null Sink</name>
+ <key>gr_null_sink</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.null_sink($type.size*$vlen)</make>
+ <param>
+ <name>Input Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>size:gr.sizeof_gr_complex</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>size:gr.sizeof_float</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>size:gr.sizeof_int</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>size:gr.sizeof_short</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>size:gr.sizeof_char</opt>
+ </option>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$vlen &gt; 0</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </sink>
+</block>
diff --git a/grc/blocks/gr_null_source.xml b/grc/blocks/gr_null_source.xml
new file mode 100644
index 000000000..6132eae3c
--- /dev/null
+++ b/grc/blocks/gr_null_source.xml
@@ -0,0 +1,54 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Null Source
+###################################################
+ -->
+<block>
+ <name>Null Source</name>
+ <key>gr_null_source</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.null_source($type.size*$vlen)</make>
+ <param>
+ <name>Output Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>size:gr.sizeof_gr_complex</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>size:gr.sizeof_float</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>size:gr.sizeof_int</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>size:gr.sizeof_short</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>size:gr.sizeof_char</opt>
+ </option>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$vlen &gt; 0</check>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </source>
+</block>
diff --git a/grc/blocks/gr_or_xx.xml b/grc/blocks/gr_or_xx.xml
new file mode 100644
index 000000000..b374aa22a
--- /dev/null
+++ b/grc/blocks/gr_or_xx.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Logical Or Block
+###################################################
+ -->
+<block>
+ <name>Or</name>
+ <key>gr_or_xx</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.or_$(type.fcn)()</make>
+ <param>
+ <name>IO Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>fcn:ii</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>fcn:ss</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>fcn:bb</opt>
+ </option>
+ </param>
+ <param>
+ <name>Num Inputs</name>
+ <key>num_inputs</key>
+ <value>2</value>
+ <type>int</type>
+ </param>
+ <check>$num_inputs &gt;= 2</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <nports>$num_inputs</nports>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ </source>
+</block>
diff --git a/grc/blocks/gr_pack_k_bits_bb.xml b/grc/blocks/gr_pack_k_bits_bb.xml
new file mode 100644
index 000000000..34e64a5d9
--- /dev/null
+++ b/grc/blocks/gr_pack_k_bits_bb.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Pack K Bits
+###################################################
+ -->
+<block>
+ <name>Pack K Bits</name>
+ <key>gr_pack_k_bits_bb</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.pack_k_bits_bb($k)</make>
+ <param>
+ <name>K</name>
+ <key>k</key>
+ <type>int</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>byte</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>byte</type>
+ </source>
+
+ <doc>
+ Pack K unpacked bits (one bit per byte) into a single packed byte containing k bits and 8 - k zeros.
+ </doc>
+
+</block>
diff --git a/grc/blocks/gr_packed_to_unpacked_xx.xml b/grc/blocks/gr_packed_to_unpacked_xx.xml
new file mode 100644
index 000000000..c1477dd9c
--- /dev/null
+++ b/grc/blocks/gr_packed_to_unpacked_xx.xml
@@ -0,0 +1,68 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Packed to Unpacked
+###################################################
+ -->
+<block>
+ <name>Packed to Unpacked</name>
+ <key>gr_packed_to_unpacked_xx</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.packed_to_unpacked_$(type.fcn)($bits_per_chunk, $endianness)</make>
+ <param>
+ <name>Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>fcn:ii</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>fcn:ss</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>fcn:bb</opt>
+ </option>
+ </param>
+ <param>
+ <name>Bits per Chunk</name>
+ <key>bits_per_chunk</key>
+ <value>2</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Endianness</name>
+ <key>endianness</key>
+ <type>int</type>
+ <option>
+ <name>MSB</name>
+ <key>gr.GR_MSB_FIRST</key>
+ </option>
+ <option>
+ <name>LSB</name>
+ <key>gr.GR_LSB_FIRST</key>
+ </option>
+ </param>
+ <param>
+ <name>Num Ports</name>
+ <key>num_ports</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$num_ports &gt; 0</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <nports>$num_ports</nports>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ <nports>$num_ports</nports>
+ </source>
+</block>
diff --git a/grc/blocks/gr_pdu_to_tagged_stream.xml b/grc/blocks/gr_pdu_to_tagged_stream.xml
new file mode 100644
index 000000000..6d2fea97e
--- /dev/null
+++ b/grc/blocks/gr_pdu_to_tagged_stream.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+## PDU Message to Tagged Stream
+###################################################
+ -->
+<block>
+ <name>PDU to Tagged Stream</name>
+ <key>gr_pdu_to_tagged_stream</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.pdu_to_tagged_stream($type.tv)</make>
+ <param>
+ <name>Item Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>tv:gr.pdu_byte</opt>
+ </option>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>tv:gr.pdu_complex</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>tv:gr.pdu_float</opt>
+ </option>
+ </param>
+ <sink>
+ <name>pdus</name>
+ <type>message</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ </source>
+</block>
diff --git a/grc/blocks/gr_peak_detector2_fb.xml b/grc/blocks/gr_peak_detector2_fb.xml
new file mode 100644
index 000000000..128c6244f
--- /dev/null
+++ b/grc/blocks/gr_peak_detector2_fb.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Peak Detector2
+###################################################
+ -->
+<block>
+ <name>Peak Detector2</name>
+ <key>gr_peak_detector2_fb</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.peak_detector2_fb($threshold_factor_rise, $look_ahead, $alpha)</make>
+ <callback>set_threshold_factor_rise($threshold_factor_rise)</callback>
+ <callback>set_look_ahead($look_ahead)</callback>
+ <callback>set_alpha($alpha)</callback>
+ <param>
+ <name>TH Factor Rise</name>
+ <key>threshold_factor_rise</key>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Look Ahead</name>
+ <key>look_ahead</key>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Alpha</name>
+ <key>alpha</key>
+ <type>real</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>float</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>byte</type>
+ </source>
+</block>
diff --git a/grc/blocks/gr_peak_detector_xb.xml b/grc/blocks/gr_peak_detector_xb.xml
new file mode 100644
index 000000000..394b0697f
--- /dev/null
+++ b/grc/blocks/gr_peak_detector_xb.xml
@@ -0,0 +1,64 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Peak Detector
+###################################################
+ -->
+<block>
+ <name>Peak Detector</name>
+ <key>gr_peak_detector_xb</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.peak_detector_$(type.fcn)b($threshold_factor_rise, $threshold_factor_fall, $look_ahead, $alpha)</make>
+ <callback>set_threshold_factor_rise($threshold_factor_rise)</callback>
+ <callback>set_threshold_factor_fall($threshold_factor_fall)</callback>
+ <callback>set_look_ahead($look_ahead)</callback>
+ <callback>set_alpha($alpha)</callback>
+ <param>
+ <name>Input Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>fcn:f</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>fcn:i</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>fcn:s</opt>
+ </option>
+ </param>
+ <param>
+ <name>TH Factor Rise</name>
+ <key>threshold_factor_rise</key>
+ <type>real</type>
+ </param>
+ <param>
+ <name>TH Factor Fall</name>
+ <key>threshold_factor_fall</key>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Look Ahead</name>
+ <key>look_ahead</key>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Alpha</name>
+ <key>alpha</key>
+ <type>real</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>byte</type>
+ </source>
+</block>
diff --git a/grc/blocks/gr_pfb_clock_sync.xml b/grc/blocks/gr_pfb_clock_sync.xml
new file mode 100644
index 000000000..3e5e65d12
--- /dev/null
+++ b/grc/blocks/gr_pfb_clock_sync.xml
@@ -0,0 +1,100 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+## Polyphase Filter based Clock Sync
+###################################################
+ -->
+<block>
+ <name>Polyphase Clock Sync</name>
+ <key>gr_pfb_clock_sync_xxx</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.pfb_clock_sync_$(type)($sps, $alpha, $taps, $filter_size, $init_phase, $max_dev, $osps)
+self.$(id).set_beta($beta)</make>
+ <callback>set_taps($taps)</callback>
+ <callback>set_alpha($alpha)</callback>
+ <callback>set_beta($beta)</callback>
+
+ <param>
+ <name>Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex->Complex (Real Taps)</name>
+ <key>ccf</key>
+ <opt>input:complex</opt>
+ <opt>output:complex</opt>
+ <opt>taps:real_vector</opt>
+ </option>
+ <option>
+ <name>Float->Float (Real Taps)</name>
+ <key>fff</key>
+ <opt>input:float</opt>
+ <opt>output:float</opt>
+ <opt>taps:real_vector</opt>
+ </option>
+ </param>
+
+ <param>
+ <name>Samples/Symbol</name>
+ <key>sps</key>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Alpha</name>
+ <key>alpha</key>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Beta</name>
+ <key>beta</key>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Taps</name>
+ <key>taps</key>
+ <type>real_vector</type>
+ </param>
+ <param>
+ <name>Filter Size</name>
+ <key>filter_size</key>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Initial Phase</name>
+ <key>init_phase</key>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Maximum Rate Deviation</name>
+ <key>max_dev</key>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Output SPS</name>
+ <key>osps</key>
+ <type>int</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>$type.input</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type.output</type>
+ </source>
+ <source>
+ <name>err</name>
+ <type>float</type>
+ <optional>1</optional>
+ </source>
+ <source>
+ <name>rate</name>
+ <type>float</type>
+ <optional>1</optional>
+ </source>
+ <source>
+ <name>phase</name>
+ <type>float</type>
+ <optional>1</optional>
+ </source>
+</block>
diff --git a/grc/blocks/gr_pfb_synthesizer.xml b/grc/blocks/gr_pfb_synthesizer.xml
new file mode 100644
index 000000000..49e5cb032
--- /dev/null
+++ b/grc/blocks/gr_pfb_synthesizer.xml
@@ -0,0 +1,57 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Polyphase Synthesis Filterbank
+###################################################
+ -->
+<block>
+ <name>Polyphase Synthesizer</name>
+ <key>gr_pfb_synthesizer_ccf</key>
+ <import>from gnuradio import gr</import>
+ <import>from gnuradio.gr import firdes</import>
+ <make>gr.pfb_synthesizer_ccf(
+ $numchans, $taps, $twox)
+self.$(id).set_channel_map($ch_map)
+ </make>
+ <callback>set_taps($taps)</callback>
+ <callback>set_channel_map($ch_map)</callback>
+
+ <param>
+ <name>Channels</name>
+ <key>numchans</key>
+ <value>2</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Connections</name>
+ <key>connections</key>
+ <value>2</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Taps</name>
+ <key>taps</key>
+ <type>real_vector</type>
+ </param>
+ <param>
+ <name>2x Sample Rate</name>
+ <key>twox</key>
+ <value>False</value>
+ <type>bool</type>
+ </param>
+ <param>
+ <name>Channel Map</name>
+ <key>ch_map</key>
+ <value>[]</value>
+ <type>int_vector</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>complex</type>
+ <nports>$connections</nports>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>complex</type>
+ </source>
+</block>
diff --git a/grc/blocks/gr_phase_modulator_fc.xml b/grc/blocks/gr_phase_modulator_fc.xml
new file mode 100644
index 000000000..758c50863
--- /dev/null
+++ b/grc/blocks/gr_phase_modulator_fc.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Phase Modulator
+###################################################
+ -->
+<block>
+ <name>Phase Mod</name>
+ <key>gr_phase_modulator_fc</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.phase_modulator_fc($sensitivity)</make>
+ <param>
+ <name>Sensitivity</name>
+ <key>sensitivity</key>
+ <type>real</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>float</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>complex</type>
+ </source>
+</block>
diff --git a/grc/blocks/gr_pll_carriertracking_cc.xml b/grc/blocks/gr_pll_carriertracking_cc.xml
new file mode 100644
index 000000000..27e673248
--- /dev/null
+++ b/grc/blocks/gr_pll_carriertracking_cc.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##PLL Carrier Tracking
+###################################################
+ -->
+<block>
+ <name>PLL Carrier Tracking</name>
+ <key>gr_pll_carriertracking_cc</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.pll_carriertracking_cc($w, $max_freq, $min_freq)</make>
+ <callback>set_loop_bandwidth($w)</callback>
+ <param>
+ <name>Loop Bandwidth</name>
+ <key>w</key>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Max Freq</name>
+ <key>max_freq</key>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Min Freq</name>
+ <key>min_freq</key>
+ <type>real</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>complex</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>complex</type>
+ </source>
+</block>
diff --git a/grc/blocks/gr_pll_freqdet_cf.xml b/grc/blocks/gr_pll_freqdet_cf.xml
new file mode 100644
index 000000000..d6e4694f0
--- /dev/null
+++ b/grc/blocks/gr_pll_freqdet_cf.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##PLL Frequency Det
+###################################################
+ -->
+<block>
+ <name>PLL Freq Det</name>
+ <key>gr_pll_freqdet_cf</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.pll_freqdet_cf($w, $max_freq, $min_freq)</make>
+ <callback>set_loop_bandwidth($w)</callback>
+ <param>
+ <name>Loop Bandwidth</name>
+ <key>w</key>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Max Freq</name>
+ <key>max_freq</key>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Min Freq</name>
+ <key>min_freq</key>
+ <type>real</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>complex</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>float</type>
+ </source>
+</block>
diff --git a/grc/blocks/gr_pll_refout_cc.xml b/grc/blocks/gr_pll_refout_cc.xml
new file mode 100644
index 000000000..b231ddd19
--- /dev/null
+++ b/grc/blocks/gr_pll_refout_cc.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##PLL Reference Out
+###################################################
+ -->
+<block>
+ <name>PLL Ref Out</name>
+ <key>gr_pll_refout_cc</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.pll_refout_cc($w, $max_freq, $min_freq)</make>
+ <callback>set_loop_bandwidth($w)</callback>
+ <param>
+ <name>Loop Bandwidth</name>
+ <key>w</key>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Max Freq</name>
+ <key>max_freq</key>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Min Freq</name>
+ <key>min_freq</key>
+ <type>real</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>complex</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>complex</type>
+ </source>
+</block>
diff --git a/grc/blocks/gr_pn_correlator_cc.xml b/grc/blocks/gr_pn_correlator_cc.xml
new file mode 100644
index 000000000..094f46cdf
--- /dev/null
+++ b/grc/blocks/gr_pn_correlator_cc.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##PN Correlator
+###################################################
+ -->
+<block>
+ <name>PN Correlator</name>
+ <key>gr_pn_correlator_cc</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.pn_correlator_cc($degree, $mask, $seed)</make>
+ <param>
+ <name>Degree</name>
+ <key>degree</key>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Mask</name>
+ <key>mask</key>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Seed</name>
+ <key>seed</key>
+ <type>int</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>complex</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>complex</type>
+ </source>
+</block>
diff --git a/grc/blocks/gr_probe_avg_mag_sqrd_x.xml b/grc/blocks/gr_probe_avg_mag_sqrd_x.xml
new file mode 100644
index 000000000..6bf706ae1
--- /dev/null
+++ b/grc/blocks/gr_probe_avg_mag_sqrd_x.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Probe Average Magnitude Squared
+###################################################
+ -->
+<block>
+ <name>Probe Avg Mag^2</name>
+ <key>gr_probe_avg_mag_sqrd_x</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.probe_avg_mag_sqrd_$(type)($threshold, $alpha)</make>
+ <callback>set_alpha($alpha)</callback>
+ <callback>set_threshold($threshold)</callback>
+ <param>
+ <name>Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>c</key>
+ <opt>input:complex</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>f</key>
+ <opt>input:float</opt>
+ </option>
+ </param>
+ <param>
+ <name>Threshold (dB)</name>
+ <key>threshold</key>
+ <value>0</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Alpha</name>
+ <key>alpha</key>
+ <value>1</value>
+ <type>real</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>$type.input</type>
+ </sink>
+ <doc>
+Available functions to probe: level()
+
+Use with the function probe block.
+ </doc>
+</block>
diff --git a/grc/blocks/gr_probe_density_b.xml b/grc/blocks/gr_probe_density_b.xml
new file mode 100644
index 000000000..3a91256aa
--- /dev/null
+++ b/grc/blocks/gr_probe_density_b.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Probe Density
+###################################################
+ -->
+<block>
+ <name>Probe Density</name>
+ <key>gr_probe_density_b</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.probe_density_b($alpha)</make>
+ <callback>set_alpha($alpha)</callback>
+ <param>
+ <name>Alpha</name>
+ <key>alpha</key>
+ <value>1</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Probe Rate</name>
+ <key>probe_rate</key>
+ <value>10</value>
+ <type>real</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>byte</type>
+ </sink>
+ <doc>
+Available functions to probe: density()
+
+Use with the function probe block.
+ </doc>
+</block>
diff --git a/grc/blocks/gr_probe_signal_f.xml b/grc/blocks/gr_probe_signal_f.xml
new file mode 100644
index 000000000..5c38e816f
--- /dev/null
+++ b/grc/blocks/gr_probe_signal_f.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Probe Signal
+###################################################
+ -->
+<block>
+ <name>Probe Signal</name>
+ <key>gr_probe_signal_f</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.probe_signal_f()</make>
+ <sink>
+ <name>in</name>
+ <type>float</type>
+ </sink>
+ <doc>
+Available functions to probe: level()
+
+Use with the function probe block.
+ </doc>
+</block>
diff --git a/grc/blocks/gr_pwr_squelch_xx.xml b/grc/blocks/gr_pwr_squelch_xx.xml
new file mode 100644
index 000000000..08d621177
--- /dev/null
+++ b/grc/blocks/gr_pwr_squelch_xx.xml
@@ -0,0 +1,65 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Power Squelch
+###################################################
+ -->
+<block>
+ <name>Power Squelch</name>
+ <key>gr_pwr_squelch_xx</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.pwr_squelch_$(type.fcn)($threshold, $alpha, $ramp, $gate)</make>
+ <callback>set_threshold($threshold)</callback>
+ <callback>set_alpha($alpha)</callback>
+ <param>
+ <name>Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>fcn:cc</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>fcn:ff</opt>
+ </option>
+ </param>
+ <param>
+ <name>Threshold (dB)</name>
+ <key>threshold</key>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Alpha</name>
+ <key>alpha</key>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Ramp</name>
+ <key>ramp</key>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Gate</name>
+ <key>gate</key>
+ <type>enum</type>
+ <option>
+ <name>Yes</name>
+ <key>True</key>
+ </option>
+ <option>
+ <name>No</name>
+ <key>False</key>
+ </option>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ </source>
+</block>
diff --git a/grc/blocks/gr_quadrature_demod_cf.xml b/grc/blocks/gr_quadrature_demod_cf.xml
new file mode 100644
index 000000000..fad0b3879
--- /dev/null
+++ b/grc/blocks/gr_quadrature_demod_cf.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Quadrature Demodulator
+###################################################
+ -->
+<block>
+ <name>Quadrature Demod</name>
+ <key>gr_quadrature_demod_cf</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.quadrature_demod_cf($gain)</make>
+ <callback>set_gain($gain)</callback>
+ <param>
+ <name>Gain</name>
+ <key>gain</key>
+ <type>real</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>complex</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>float</type>
+ </source>
+</block>
diff --git a/grc/blocks/gr_random_pdu.xml b/grc/blocks/gr_random_pdu.xml
new file mode 100644
index 000000000..ed5a79a92
--- /dev/null
+++ b/grc/blocks/gr_random_pdu.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+## Random PDU
+###################################################
+ -->
+<block>
+ <name>Random PDU Generator</name>
+ <key>gr_random_pdu</key>
+ <import>from gnuradio import gr</import>
+ <import>from gruel import pmt</import>
+ <make>gr.random_pdu($minsize, $maxsize)</make>
+ <param>
+ <name>Min Bytes</name>
+ <key>minsize</key>
+ <value>50</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Max Bytes</name>
+ <key>maxsize</key>
+ <value>2000</value>
+ <type>int</type>
+ </param>
+ <sink>
+ <name>generate</name>
+ <type>message</type>
+ <optional>1</optional>
+ </sink>
+ <source>
+ <name>pdus</name>
+ <type>message</type>
+ <optional>1</optional>
+ </source>
+</block>
diff --git a/grc/blocks/gr_rational_resampler_base_xxx.xml b/grc/blocks/gr_rational_resampler_base_xxx.xml
new file mode 100644
index 000000000..4b7720173
--- /dev/null
+++ b/grc/blocks/gr_rational_resampler_base_xxx.xml
@@ -0,0 +1,86 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Rational Resampler Base
+###################################################
+ -->
+<block>
+ <name>Rational Resampler Base</name>
+ <key>gr_rational_resampler_base_xxx</key>
+ <import>from gnuradio import gr</import>
+ <import>from gnuradio.gr import firdes</import>
+ <make>gr.rational_resampler_base_$(type)($interp, $decim, $taps)</make>
+ <callback>set_taps($taps)</callback>
+ <param>
+ <name>Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex->Complex (Complex Taps)</name>
+ <key>ccc</key>
+ <opt>input:complex</opt>
+ <opt>output:complex</opt>
+ <opt>taps:complex_vector</opt>
+ </option>
+ <option>
+ <name>Complex->Complex (Real Taps)</name>
+ <key>ccf</key>
+ <opt>input:complex</opt>
+ <opt>output:complex</opt>
+ <opt>taps:real_vector</opt>
+ </option>
+ <option>
+ <name>Float->Complex (Complex Taps)</name>
+ <key>fcc</key>
+ <opt>input:float</opt>
+ <opt>output:complex</opt>
+ <opt>taps:complex_vector</opt>
+ </option>
+ <option>
+ <name>Float->Float (Real Taps)</name>
+ <key>fff</key>
+ <opt>input:float</opt>
+ <opt>output:float</opt>
+ <opt>taps:real_vector</opt>
+ </option>
+ <option>
+ <name>Float->Short (Real Taps)</name>
+ <key>fsf</key>
+ <opt>input:float</opt>
+ <opt>output:short</opt>
+ <opt>taps:real_vector</opt>
+ </option>
+ <option>
+ <name>Short->Complex (Complex Taps)</name>
+ <key>scc</key>
+ <opt>input:short</opt>
+ <opt>output:complex</opt>
+ <opt>taps:complex_vector</opt>
+ </option>
+ </param>
+ <param>
+ <name>Interpolation</name>
+ <key>interp</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Decimation</name>
+ <key>decim</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Taps</name>
+ <key>taps</key>
+ <type>$type.taps</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>$type.input</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type.output</type>
+ </source>
+</block>
diff --git a/grc/blocks/gr_repeat.xml b/grc/blocks/gr_repeat.xml
new file mode 100644
index 000000000..ba652a4d7
--- /dev/null
+++ b/grc/blocks/gr_repeat.xml
@@ -0,0 +1,64 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Repeat
+###################################################
+ -->
+<block>
+ <name>Repeat</name>
+ <key>gr_repeat</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.repeat($type.size*$vlen, $interp)</make>
+ <param>
+ <name>Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>size:gr.sizeof_gr_complex</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>size:gr.sizeof_float</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>size:gr.sizeof_int</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>size:gr.sizeof_short</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>size:gr.sizeof_char</opt>
+ </option>
+ </param>
+ <param>
+ <name>Interpolation</name>
+ <key>interp</key>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$vlen &gt; 0</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </source>
+</block>
diff --git a/grc/blocks/gr_rms_xx.xml b/grc/blocks/gr_rms_xx.xml
new file mode 100644
index 000000000..1e0947192
--- /dev/null
+++ b/grc/blocks/gr_rms_xx.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##RMS
+###################################################
+ -->
+<block>
+ <name>RMS</name>
+ <key>gr_rms_xx</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.rms_$(type.fcn)f($alpha)</make>
+ <callback>set_alpha($alpha)</callback>
+ <param>
+ <name>Input Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>fcn:c</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>fcn:f</opt>
+ </option>
+ </param>
+ <param>
+ <name>Alpha</name>
+ <key>alpha</key>
+ <type>real</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>float</type>
+ </source>
+</block>
diff --git a/grc/blocks/gr_sample_and_hold_xx.xml b/grc/blocks/gr_sample_and_hold_xx.xml
new file mode 100644
index 000000000..2a036c3fd
--- /dev/null
+++ b/grc/blocks/gr_sample_and_hold_xx.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Sample and Hold
+###################################################
+ -->
+<block>
+ <name>Sample and Hold</name>
+ <key>gr_sample_and_hold_xx</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.sample_and_hold_$(type.fcn)()</make>
+ <param>
+ <name>Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>fcn:ff</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>fcn:ii</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>fcn:ss</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>fcn:bb</opt>
+ </option>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ </sink>
+ <sink>
+ <name>ctrl</name>
+ <type>byte</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ </source>
+</block>
diff --git a/grc/blocks/gr_scrambler_bb.xml b/grc/blocks/gr_scrambler_bb.xml
new file mode 100644
index 000000000..d079c4015
--- /dev/null
+++ b/grc/blocks/gr_scrambler_bb.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Descrambler
+###################################################
+ -->
+<block>
+ <name>Scrambler</name>
+ <key>gr_scrambler_bb</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.scrambler_bb($mask, $seed, $len)</make>
+ <param>
+ <name>Mask</name>
+ <key>mask</key>
+ <value>0x8A</value>
+ <type>hex</type>
+ </param>
+ <param>
+ <name>Seed</name>
+ <key>seed</key>
+ <value>0x7F</value>
+ <type>hex</type>
+ </param>
+ <param>
+ <name>Length</name>
+ <key>len</key>
+ <value>7</value>
+ <type>int</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>byte</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>byte</type>
+ </source>
+</block>
diff --git a/grc/blocks/gr_short_to_char.xml b/grc/blocks/gr_short_to_char.xml
new file mode 100644
index 000000000..9c41da84e
--- /dev/null
+++ b/grc/blocks/gr_short_to_char.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Short to char:
+###################################################
+ -->
+<block>
+ <name>Short To Char</name>
+ <key>gr_short_to_char</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.short_to_char($vlen)</make>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>short</type>
+ <vlen>$vlen</vlen>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>byte</type>
+ <vlen>$vlen</vlen>
+ </source>
+</block>
diff --git a/grc/blocks/gr_short_to_float.xml b/grc/blocks/gr_short_to_float.xml
new file mode 100644
index 000000000..529f8c78c
--- /dev/null
+++ b/grc/blocks/gr_short_to_float.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Short to Float:
+###################################################
+ -->
+<block>
+ <name>Short To Float</name>
+ <key>gr_short_to_float</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.short_to_float($vlen, $scale)</make>
+ <callback>set_scale($scale)</callback>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Scale</name>
+ <key>scale</key>
+ <value>1</value>
+ <type>real</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>short</type>
+ <vlen>$vlen</vlen>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>float</type>
+ <vlen>$vlen</vlen>
+ </source>
+</block>
diff --git a/grc/blocks/gr_sig_source_x.xml b/grc/blocks/gr_sig_source_x.xml
new file mode 100644
index 000000000..644cf52d0
--- /dev/null
+++ b/grc/blocks/gr_sig_source_x.xml
@@ -0,0 +1,104 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Signal Source
+###################################################
+ -->
+<block>
+ <name>Signal Source</name>
+ <key>gr_sig_source_x</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.sig_source_$(type.fcn)($samp_rate, $waveform, $freq, $amp, $offset)</make>
+ <callback>set_sampling_freq($samp_rate)</callback>
+ <callback>set_waveform($waveform)</callback>
+ <callback>set_frequency($freq)</callback>
+ <callback>set_amplitude($amp)</callback>
+ <callback>set_offset($offset)</callback>
+ <param>
+ <name>Output Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>fcn:c</opt>
+ <opt>offset_type:complex</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>fcn:f</opt>
+ <opt>offset_type:real</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>fcn:i</opt>
+ <opt>offset_type:int</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>fcn:s</opt>
+ <opt>offset_type:int</opt>
+ </option>
+ </param>
+ <param>
+ <name>Sample Rate</name>
+ <key>samp_rate</key>
+ <value>samp_rate</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Waveform</name>
+ <key>waveform</key>
+ <value>gr.GR_COS_WAVE</value>
+ <type>int</type>
+ <option>
+ <name>Constant</name>
+ <key>gr.GR_CONST_WAVE</key>
+ </option>
+ <option>
+ <name>Sine</name>
+ <key>gr.GR_SIN_WAVE</key>
+ </option>
+ <option>
+ <name>Cosine</name>
+ <key>gr.GR_COS_WAVE</key>
+ </option>
+ <option>
+ <name>Square</name>
+ <key>gr.GR_SQR_WAVE</key>
+ </option>
+ <option>
+ <name>Triangle</name>
+ <key>gr.GR_TRI_WAVE</key>
+ </option>
+ <option>
+ <name>Saw Tooth</name>
+ <key>gr.GR_SAW_WAVE</key>
+ </option>
+ </param>
+ <param>
+ <name>Frequency</name>
+ <key>freq</key>
+ <value>1000</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Amplitude</name>
+ <key>amp</key>
+ <value>1</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Offset</name>
+ <key>offset</key>
+ <value>0</value>
+ <type>$type.offset_type</type>
+ </param>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ </source>
+</block>
diff --git a/grc/blocks/gr_simple_correlator.xml b/grc/blocks/gr_simple_correlator.xml
new file mode 100644
index 000000000..820523a64
--- /dev/null
+++ b/grc/blocks/gr_simple_correlator.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Simple Correlator
+###################################################
+ -->
+<block>
+ <name>Simple Correlator</name>
+ <key>gr_simple_correlator</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.simple_correlator($payload_bytesize)</make>
+ <param>
+ <name>Payload Byte Size</name>
+ <key>payload_bytesize</key>
+ <type>int</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>float</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>byte</type>
+ </source>
+</block>
diff --git a/grc/blocks/gr_simple_framer.xml b/grc/blocks/gr_simple_framer.xml
new file mode 100644
index 000000000..2a0295c41
--- /dev/null
+++ b/grc/blocks/gr_simple_framer.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Simple Framer
+###################################################
+ -->
+<block>
+ <name>Simple Framer</name>
+ <key>gr_simple_framer</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.simple_framer($payload_bytesize)</make>
+ <param>
+ <name>Payload Byte Size</name>
+ <key>payload_bytesize</key>
+ <type>int</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>byte</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>byte</type>
+ </source>
+</block>
diff --git a/grc/blocks/gr_simple_squelch_cc.xml b/grc/blocks/gr_simple_squelch_cc.xml
new file mode 100644
index 000000000..5c0727f5f
--- /dev/null
+++ b/grc/blocks/gr_simple_squelch_cc.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Simple Squelch
+###################################################
+ -->
+<block>
+ <name>Simple Squelch</name>
+ <key>gr_simple_squelch_cc</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.simple_squelch_cc($threshold, $alpha)</make>
+ <callback>set_threshold($threshold)</callback>
+ <callback>set_alpha($alpha)</callback>
+ <param>
+ <name>Threshold (dB)</name>
+ <key>threshold</key>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Alpha</name>
+ <key>alpha</key>
+ <type>real</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>complex</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>complex</type>
+ </source>
+</block>
diff --git a/grc/blocks/gr_single_pole_iir_filter_xx.xml b/grc/blocks/gr_single_pole_iir_filter_xx.xml
new file mode 100644
index 000000000..50cf4a82d
--- /dev/null
+++ b/grc/blocks/gr_single_pole_iir_filter_xx.xml
@@ -0,0 +1,51 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Single Pole IIR Filter
+###################################################
+ -->
+<block>
+ <name>Single Pole IIR Filter</name>
+ <key>gr_single_pole_iir_filter_xx</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.single_pole_iir_filter_$(type.fcn)($alpha, $vlen)</make>
+ <callback>set_taps($alpha)</callback>
+ <param>
+ <name>Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>fcn:cc</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>fcn:ff</opt>
+ </option>
+ </param>
+ <param>
+ <name>Alpha</name>
+ <key>alpha</key>
+ <value>1.0</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$vlen &gt; 0</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </source>
+</block>
diff --git a/grc/blocks/gr_skiphead.xml b/grc/blocks/gr_skiphead.xml
new file mode 100644
index 000000000..0849ad298
--- /dev/null
+++ b/grc/blocks/gr_skiphead.xml
@@ -0,0 +1,65 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Skip Head
+###################################################
+ -->
+<block>
+ <name>Skip Head</name>
+ <key>gr_skiphead</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.skiphead($type.size*$vlen, $num_items)</make>
+ <param>
+ <name>Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>size:gr.sizeof_gr_complex</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>size:gr.sizeof_float</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>size:gr.sizeof_int</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>size:gr.sizeof_short</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>size:gr.sizeof_char</opt>
+ </option>
+ </param>
+ <param>
+ <name>Num Items</name>
+ <key>num_items</key>
+ <value>1024</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$vlen &gt; 0</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </source>
+</block>
diff --git a/grc/blocks/gr_socket_pdu.xml b/grc/blocks/gr_socket_pdu.xml
new file mode 100644
index 000000000..a175c3699
--- /dev/null
+++ b/grc/blocks/gr_socket_pdu.xml
@@ -0,0 +1,62 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+## Socket PDU Message source/sink
+###################################################
+ -->
+<block>
+ <name>Socket PDU</name>
+ <key>gr_socket_pdu</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.socket_pdu($type, $host, $port, $mtu)</make>
+ <param>
+ <name>Type</name>
+ <key>type</key>
+ <value>TCP_SERVER</value>
+ <type>enum</type>
+ <option>
+ <name>TCP Server</name>
+ <key>"TCP_SERVER"</key>
+ </option>
+ <option>
+ <name>TCP Client</name>
+ <key>"TCP_CLIENT"</key>
+ </option>
+ <option>
+ <name>UDP Server</name>
+ <key>"UDP_SERVER"</key>
+ </option>
+ <option>
+ <name>UDP Client</name>
+ <key>"UDP_CLIENT"</key>
+ </option>
+ </param>
+ <param>
+ <name>Host</name>
+ <key>host</key>
+ <value></value>
+ <type>string</type>
+ </param>
+ <param>
+ <name>Port</name>
+ <key>port</key>
+ <value>52001</value>
+ <type>string</type>
+ </param>
+ <param>
+ <name>MTU</name>
+ <key>mtu</key>
+ <value>10000</value>
+ <type>int</type>
+ </param>
+ <sink>
+ <name>pdus</name>
+ <type>message</type>
+ <optional>1</optional>
+ </sink>
+ <source>
+ <name>pdus</name>
+ <type>message</type>
+ <optional>1</optional>
+ </source>
+</block>
diff --git a/grc/blocks/gr_stream_mux.xml b/grc/blocks/gr_stream_mux.xml
new file mode 100644
index 000000000..8efe7b655
--- /dev/null
+++ b/grc/blocks/gr_stream_mux.xml
@@ -0,0 +1,75 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Stream Mux:
+## all types, many inputs, only one output
+###################################################
+ -->
+<block>
+ <name>Stream Mux</name>
+ <key>gr_stream_mux</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.stream_mux($type.size*$vlen, $lengths)</make>
+ <param>
+ <name>Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>size:gr.sizeof_gr_complex</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>size:gr.sizeof_float</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>size:gr.sizeof_int</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>size:gr.sizeof_short</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>size:gr.sizeof_char</opt>
+ </option>
+ </param>
+ <param>
+ <name>Lengths</name>
+ <key>lengths</key>
+ <value>1, 1</value>
+ <type>int_vector</type>
+ </param>
+ <param>
+ <name>Num Inputs</name>
+ <key>num_inputs</key>
+ <value>2</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$num_inputs &gt; 0</check>
+ <check>$num_inputs == len($lengths)</check>
+ <check>$vlen &gt; 0</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ <nports>$num_inputs</nports>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </source>
+</block>
diff --git a/grc/blocks/gr_stream_to_streams.xml b/grc/blocks/gr_stream_to_streams.xml
new file mode 100644
index 000000000..82542b8d4
--- /dev/null
+++ b/grc/blocks/gr_stream_to_streams.xml
@@ -0,0 +1,67 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Stream to Streams
+###################################################
+ -->
+<block>
+ <name>Stream to Streams</name>
+ <key>gr_stream_to_streams</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.stream_to_streams($type.size*$vlen, $num_streams)</make>
+ <param>
+ <name>IO Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>size:gr.sizeof_gr_complex</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>size:gr.sizeof_float</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>size:gr.sizeof_int</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>size:gr.sizeof_short</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>size:gr.sizeof_char</opt>
+ </option>
+ </param>
+ <param>
+ <name>Num Streams</name>
+ <key>num_streams</key>
+ <value>2</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$num_streams &gt; 0</check>
+ <check>$vlen &gt;= 1</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ <nports>$num_streams</nports>
+ </source>
+</block>
diff --git a/grc/blocks/gr_stream_to_vector.xml b/grc/blocks/gr_stream_to_vector.xml
new file mode 100644
index 000000000..296d786f8
--- /dev/null
+++ b/grc/blocks/gr_stream_to_vector.xml
@@ -0,0 +1,66 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Stream to Vector
+###################################################
+ -->
+<block>
+ <name>Stream to Vector</name>
+ <key>gr_stream_to_vector</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.stream_to_vector($type.size*$vlen, $num_items)</make>
+ <param>
+ <name>IO Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>size:gr.sizeof_gr_complex</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>size:gr.sizeof_float</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>size:gr.sizeof_int</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>size:gr.sizeof_short</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>size:gr.sizeof_char</opt>
+ </option>
+ </param>
+ <param>
+ <name>Num Items</name>
+ <key>num_items</key>
+ <value>2</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$num_items &gt; 0</check>
+ <check>$vlen &gt;= 1</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ <vlen>$vlen*$num_items</vlen>
+ </source>
+</block>
diff --git a/grc/blocks/gr_streams_to_stream.xml b/grc/blocks/gr_streams_to_stream.xml
new file mode 100644
index 000000000..7aadd7eef
--- /dev/null
+++ b/grc/blocks/gr_streams_to_stream.xml
@@ -0,0 +1,67 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Streams to Stream
+###################################################
+ -->
+<block>
+ <name>Streams to Stream</name>
+ <key>gr_streams_to_stream</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.streams_to_stream($type.size*$vlen, $num_streams)</make>
+ <param>
+ <name>IO Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>size:gr.sizeof_gr_complex</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>size:gr.sizeof_float</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>size:gr.sizeof_int</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>size:gr.sizeof_short</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>size:gr.sizeof_char</opt>
+ </option>
+ </param>
+ <param>
+ <name>Num Streams</name>
+ <key>num_streams</key>
+ <value>2</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$num_streams &gt; 0</check>
+ <check>$vlen &gt;= 1</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ <nports>$num_streams</nports>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </source>
+</block>
diff --git a/grc/blocks/gr_streams_to_vector.xml b/grc/blocks/gr_streams_to_vector.xml
new file mode 100644
index 000000000..4ecdcb2d4
--- /dev/null
+++ b/grc/blocks/gr_streams_to_vector.xml
@@ -0,0 +1,67 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Streams to Vector
+###################################################
+ -->
+<block>
+ <name>Streams to Vector</name>
+ <key>gr_streams_to_vector</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.streams_to_vector($type.size*$vlen, $num_streams)</make>
+ <param>
+ <name>IO Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>size:gr.sizeof_gr_complex</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>size:gr.sizeof_float</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>size:gr.sizeof_int</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>size:gr.sizeof_short</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>size:gr.sizeof_char</opt>
+ </option>
+ </param>
+ <param>
+ <name>Num Streams</name>
+ <key>num_streams</key>
+ <value>2</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$num_streams &gt; 0</check>
+ <check>$vlen &gt;= 1</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ <nports>$num_streams</nports>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ <vlen>$vlen*$num_streams</vlen>
+ </source>
+</block>
diff --git a/grc/blocks/gr_sub_xx.xml b/grc/blocks/gr_sub_xx.xml
new file mode 100644
index 000000000..c677747da
--- /dev/null
+++ b/grc/blocks/gr_sub_xx.xml
@@ -0,0 +1,63 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Subtract Block:
+## all types, 1 output, 2 to inf inputs
+###################################################
+ -->
+<block>
+ <name>Subtract</name>
+ <key>gr_sub_xx</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.sub_$(type.fcn)($vlen)</make>
+ <param>
+ <name>IO Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>fcn:cc</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>fcn:ff</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>fcn:ii</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>fcn:ss</opt>
+ </option>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Num Inputs</name>
+ <key>num_inputs</key>
+ <value>2</value>
+ <type>int</type>
+ </param>
+ <check>$vlen &gt; 0</check>
+ <check>$num_inputs &gt;= 1</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ <nports>$num_inputs</nports>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </source>
+</block>
diff --git a/grc/blocks/gr_tag_debug.xml b/grc/blocks/gr_tag_debug.xml
new file mode 100644
index 000000000..4af7729be
--- /dev/null
+++ b/grc/blocks/gr_tag_debug.xml
@@ -0,0 +1,82 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+## Tag Debug
+###################################################
+ -->
+<block>
+ <name>Tag Debug</name>
+ <key>gr_tag_debug</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.tag_debug($type.size*$vlen, $name)</make>
+ <callback>set_display($display)</callback>
+ <param>
+ <name>Input Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>size:gr.sizeof_gr_complex</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>size:gr.sizeof_float</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>size:gr.sizeof_int</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>size:gr.sizeof_short</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>size:gr.sizeof_char</opt>
+ </option>
+ </param>
+ <param>
+ <name>Name</name>
+ <key>name</key>
+ <type>string</type>
+ </param>
+ <param>
+ <name>Num Inputs</name>
+ <key>num_inputs</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Display</name>
+ <key>display</key>
+ <value>True</value>
+ <type>bool</type>
+ <option>
+ <name>On</name>
+ <key>True</key>
+ </option>
+ <option>
+ <name>Off</name>
+ <key>False</key>
+ </option>
+ </param>
+ <check>$num_inputs &gt;= 1</check>
+ <check>$vlen &gt; 0</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ <nports>$num_inputs</nports>
+ </sink>
+</block>
diff --git a/grc/blocks/gr_tagged_stream_to_pdu.xml b/grc/blocks/gr_tagged_stream_to_pdu.xml
new file mode 100644
index 000000000..e2f754c9e
--- /dev/null
+++ b/grc/blocks/gr_tagged_stream_to_pdu.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+## Tagged Stream to PDU Message
+###################################################
+ -->
+<block>
+ <name>Tagged Stream to PDU</name>
+ <key>gr_tagged_stream_to_pdu</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.tagged_stream_to_pdu($type.tv)</make>
+ <param>
+ <name>Item Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>tv:gr.pdu_byte</opt>
+ </option>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>tv:gr.pdu_complex</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>tv:gr.pdu_float</opt>
+ </option>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ </sink>
+ <source>
+ <name>pdus</name>
+ <type>message</type>
+ </source>
+</block>
diff --git a/grc/blocks/gr_threshold_ff.xml b/grc/blocks/gr_threshold_ff.xml
new file mode 100644
index 000000000..740ce5794
--- /dev/null
+++ b/grc/blocks/gr_threshold_ff.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Threshold
+###################################################
+ -->
+<block>
+ <name>Threshold</name>
+ <key>gr_threshold_ff</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.threshold_ff($low, $high, $init)</make>
+ <callback>set_hi($high)</callback>
+ <callback>set_lo($low)</callback>
+ <param>
+ <name>Low</name>
+ <key>low</key>
+ <value>-100</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>High</name>
+ <key>high</key>
+ <value>100</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Initial State</name>
+ <key>init</key>
+ <value>0</value>
+ <type>real</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>float</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>float</type>
+ </source>
+</block>
diff --git a/grc/blocks/gr_throttle.xml b/grc/blocks/gr_throttle.xml
new file mode 100644
index 000000000..e3a5a2ba1
--- /dev/null
+++ b/grc/blocks/gr_throttle.xml
@@ -0,0 +1,67 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Throttle
+###################################################
+ -->
+<block>
+ <name>Throttle</name>
+ <key>gr_throttle</key>
+ <throttle>1</throttle>
+ <import>from gnuradio import gr</import>
+ <make>gr.throttle($type.size*$vlen, $samples_per_second)</make>
+ <callback>set_sample_rate($samples_per_second)</callback>
+ <param>
+ <name>Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>size:gr.sizeof_gr_complex</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>size:gr.sizeof_float</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>size:gr.sizeof_int</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>size:gr.sizeof_short</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>size:gr.sizeof_char</opt>
+ </option>
+ </param>
+ <param>
+ <name>Sample Rate</name>
+ <key>samples_per_second</key>
+ <value>samp_rate</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$vlen &gt; 0</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </source>
+</block>
diff --git a/grc/blocks/gr_transcendental.xml b/grc/blocks/gr_transcendental.xml
new file mode 100644
index 000000000..eede447f9
--- /dev/null
+++ b/grc/blocks/gr_transcendental.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##transcendental functions
+###################################################
+ -->
+<block>
+ <name>Transcendental</name>
+ <key>gr_transcendental</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.transcendental($name, "$type")</make>
+ <param>
+ <name>Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex_double</key>
+ <opt>type:complex</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>type:float</opt>
+ </option>
+ </param>
+ <param>
+ <name>Function Name</name>
+ <key>name</key>
+ <value>cos</value>
+ <type>string</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>$type.type</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type.type</type>
+ </source>
+</block>
diff --git a/grc/blocks/gr_tuntap_pdu.xml b/grc/blocks/gr_tuntap_pdu.xml
new file mode 100644
index 000000000..f169345af
--- /dev/null
+++ b/grc/blocks/gr_tuntap_pdu.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+## Tuntap PDU Message source/sink
+###################################################
+ -->
+<block>
+ <name>TunTap PDU</name>
+ <key>gr_tuntap_pdu</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.tuntap_pdu($ifn, $mtu)</make>
+ <param>
+ <name>Interface Name</name>
+ <key>ifn</key>
+ <value>tun0</value>
+ <type>string</type>
+ </param>
+ <param>
+ <name>MTU</name>
+ <key>mtu</key>
+ <value>10000</value>
+ <type>int</type>
+ </param>
+ <sink>
+ <name>pdus</name>
+ <type>message</type>
+ <optional>1</optional>
+ </sink>
+ <source>
+ <name>pdus</name>
+ <type>message</type>
+ <optional>1</optional>
+ </source>
+</block>
diff --git a/grc/blocks/gr_uchar_to_float.xml b/grc/blocks/gr_uchar_to_float.xml
new file mode 100644
index 000000000..0a5f7f96a
--- /dev/null
+++ b/grc/blocks/gr_uchar_to_float.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Unsigned Char to Float:
+###################################################
+ -->
+<block>
+ <name>UChar To Float</name>
+ <key>gr_uchar_to_float</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.uchar_to_float()</make>
+ <sink>
+ <name>in</name>
+ <type>byte</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>float</type>
+ </source>
+</block>
diff --git a/grc/blocks/gr_udp_sink.xml b/grc/blocks/gr_udp_sink.xml
new file mode 100644
index 000000000..45f81075f
--- /dev/null
+++ b/grc/blocks/gr_udp_sink.xml
@@ -0,0 +1,77 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##UDP Sink
+###################################################
+ -->
+<block>
+ <name>UDP Sink</name>
+ <key>gr_udp_sink</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.udp_sink($type.size*$vlen, $ipaddr, $port, $psize, $eof)</make>
+ <callback>set_mtu($mtu)</callback>
+ <param>
+ <name>Input Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>size:gr.sizeof_gr_complex</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>size:gr.sizeof_float</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>size:gr.sizeof_int</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>size:gr.sizeof_short</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>size:gr.sizeof_char</opt>
+ </option>
+ </param>
+ <param>
+ <name>Destination IP Address</name>
+ <key>ipaddr</key>
+ <type>string</type>
+ </param>
+ <param>
+ <name>Destination Port</name>
+ <key>port</key>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Payload Size</name>
+ <key>psize</key>
+ <value>1472</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Send Null Pkt as EOF</name>
+ <key>eof</key>
+ <value>True</value>
+ <type>bool</type>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$vlen &gt; 0</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </sink>
+</block>
diff --git a/grc/blocks/gr_udp_source.xml b/grc/blocks/gr_udp_source.xml
new file mode 100644
index 000000000..a1b961651
--- /dev/null
+++ b/grc/blocks/gr_udp_source.xml
@@ -0,0 +1,85 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##UDP Source
+###################################################
+ -->
+<block>
+ <name>UDP Source</name>
+ <key>gr_udp_source</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.udp_source($type.size*$vlen, $ipaddr, $port, $psize, $eof, $wait)</make>
+ <callback>set_mtu($mtu)</callback>
+ <param>
+ <name>Output Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>size:gr.sizeof_gr_complex</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>size:gr.sizeof_float</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>size:gr.sizeof_int</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>size:gr.sizeof_short</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>size:gr.sizeof_char</opt>
+ </option>
+ </param>
+ <param>
+ <name>IP Address</name>
+ <key>ipaddr</key>
+ <value>127.0.0.1</value>
+ <type>string</type>
+ </param>
+ <param>
+ <name>Port</name>
+ <key>port</key>
+ <value>1234</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Payload Size</name>
+ <key>psize</key>
+ <value>1472</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Null Pkt is EOF</name>
+ <key>eof</key>
+ <value>True</value>
+ <type>bool</type>
+ </param>
+ <param>
+ <name>Wait for Data</name>
+ <key>wait</key>
+ <value>True</value>
+ <type>bool</type>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$vlen &gt; 0</check>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </source>
+</block>
diff --git a/grc/blocks/gr_unpack_k_bits_bb.xml b/grc/blocks/gr_unpack_k_bits_bb.xml
new file mode 100644
index 000000000..9917644ab
--- /dev/null
+++ b/grc/blocks/gr_unpack_k_bits_bb.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Unpack K Bits
+###################################################
+ -->
+<block>
+ <name>Unpack K Bits</name>
+ <key>gr_unpack_k_bits_bb</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.unpack_k_bits_bb($k)</make>
+ <param>
+ <name>K</name>
+ <key>k</key>
+ <type>int</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>byte</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>byte</type>
+ </source>
+</block>
diff --git a/grc/blocks/gr_unpacked_to_packed_xx.xml b/grc/blocks/gr_unpacked_to_packed_xx.xml
new file mode 100644
index 000000000..427c80082
--- /dev/null
+++ b/grc/blocks/gr_unpacked_to_packed_xx.xml
@@ -0,0 +1,68 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Unpacked to Packed
+###################################################
+ -->
+<block>
+ <name>Unpacked to Packed</name>
+ <key>gr_unpacked_to_packed_xx</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.unpacked_to_packed_$(type.fcn)($bits_per_chunk, $endianness)</make>
+ <param>
+ <name>Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>fcn:ii</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>fcn:ss</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>fcn:bb</opt>
+ </option>
+ </param>
+ <param>
+ <name>Bits per Chunk</name>
+ <key>bits_per_chunk</key>
+ <value>2</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Endianness</name>
+ <key>endianness</key>
+ <type>int</type>
+ <option>
+ <name>MSB</name>
+ <key>gr.GR_MSB_FIRST</key>
+ </option>
+ <option>
+ <name>LSB</name>
+ <key>gr.GR_LSB_FIRST</key>
+ </option>
+ </param>
+ <param>
+ <name>Num Ports</name>
+ <key>num_ports</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$num_ports &gt; 0</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <nports>$num_ports</nports>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ <nports>$num_ports</nports>
+ </source>
+</block>
diff --git a/grc/blocks/gr_vco_f.xml b/grc/blocks/gr_vco_f.xml
new file mode 100644
index 000000000..e49c53965
--- /dev/null
+++ b/grc/blocks/gr_vco_f.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##VCO
+###################################################
+ -->
+<block>
+ <name>VCO</name>
+ <key>gr_vco_f</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.vco_f($samp_rate, $sensitivity, $amplitude)</make>
+ <param>
+ <name>Sample Rate</name>
+ <key>samp_rate</key>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Sensitivity</name>
+ <key>sensitivity</key>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Amplitude</name>
+ <key>amplitude</key>
+ <type>real</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>float</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>float</type>
+ </source>
+</block>
diff --git a/grc/blocks/gr_vector_insert_x.xml b/grc/blocks/gr_vector_insert_x.xml
new file mode 100644
index 000000000..f9ce1f654
--- /dev/null
+++ b/grc/blocks/gr_vector_insert_x.xml
@@ -0,0 +1,80 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Vector Source
+###################################################
+ -->
+<block>
+ <name>Vector Insert</name>
+ <key>gr_vector_insert_x</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.vector_insert_$(type.fcn)($vector, $period, $offset)</make>
+ <param>
+ <name>Output Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>fcn:b</opt>
+ <opt>vec_type:int_vector</opt>
+ </option>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>fcn:c</opt>
+ <opt>vec_type:complex_vector</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>fcn:f</opt>
+ <opt>vec_type:real_vector</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>fcn:i</opt>
+ <opt>vec_type:int_vector</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>fcn:s</opt>
+ <opt>vec_type:int_vector</opt>
+ </option>
+ </param>
+ <param>
+ <name>Vector</name>
+ <key>vector</key>
+ <value>0, 0, 0</value>
+ <type>$type.vec_type</type>
+ </param>
+ <param>
+ <name>Periodicity</name>
+ <key>period</key>
+ <value>100</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Offset</name>
+ <key>offset</key>
+ <value>0</value>
+ <type>int</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ </source>
+
+ <doc>
+ Periodicity, the length of the periodicity at which the vector should be inserted at the output.
+ (i.e. one vector for every N output items)
+
+ Offset sepcifies where in the cycle period we should begin at.
+ </doc>
+</block>
diff --git a/grc/blocks/gr_vector_sink_x.xml b/grc/blocks/gr_vector_sink_x.xml
new file mode 100644
index 000000000..3bd998698
--- /dev/null
+++ b/grc/blocks/gr_vector_sink_x.xml
@@ -0,0 +1,54 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Vector sink
+###################################################
+ -->
+<block>
+ <name>Vector Sink</name>
+ <key>gr_vector_sink_x</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.vector_sink_$(type.fcn)($vlen)</make>
+ <param>
+ <name>Input Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>fcn:c</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>fcn:f</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>fcn:i</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>fcn:s</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>fcn:b</opt>
+ </option>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$vlen &gt; 0</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </sink>
+</block>
diff --git a/grc/blocks/gr_vector_source_x.xml b/grc/blocks/gr_vector_source_x.xml
new file mode 100644
index 000000000..7a6a3aeff
--- /dev/null
+++ b/grc/blocks/gr_vector_source_x.xml
@@ -0,0 +1,79 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Vector Source
+###################################################
+ -->
+<block>
+ <name>Vector Source</name>
+ <key>gr_vector_source_x</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.vector_source_$(type.fcn)($vector, $repeat, $vlen)</make>
+ <param>
+ <name>Output Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>fcn:c</opt>
+ <opt>vec_type:complex_vector</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>fcn:f</opt>
+ <opt>vec_type:real_vector</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>fcn:i</opt>
+ <opt>vec_type:int_vector</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>fcn:s</opt>
+ <opt>vec_type:int_vector</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>fcn:b</opt>
+ <opt>vec_type:int_vector</opt>
+ </option>
+ </param>
+ <param>
+ <name>Vector</name>
+ <key>vector</key>
+ <value>0, 0, 0</value>
+ <type>$type.vec_type</type>
+ </param>
+ <param>
+ <name>Repeat</name>
+ <key>repeat</key>
+ <value>True</value>
+ <type>enum</type>
+ <option>
+ <name>Yes</name>
+ <key>True</key>
+ </option>
+ <option>
+ <name>No</name>
+ <key>False</key>
+ </option>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$vlen &gt; 0</check>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </source>
+</block>
diff --git a/grc/blocks/gr_vector_to_stream.xml b/grc/blocks/gr_vector_to_stream.xml
new file mode 100644
index 000000000..d56d34067
--- /dev/null
+++ b/grc/blocks/gr_vector_to_stream.xml
@@ -0,0 +1,66 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Vector to Stream
+###################################################
+ -->
+<block>
+ <name>Vector to Stream</name>
+ <key>gr_vector_to_stream</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.vector_to_stream($type.size*$vlen, $num_items)</make>
+ <param>
+ <name>IO Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>size:gr.sizeof_gr_complex</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>size:gr.sizeof_float</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>size:gr.sizeof_int</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>size:gr.sizeof_short</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>size:gr.sizeof_char</opt>
+ </option>
+ </param>
+ <param>
+ <name>Num Items</name>
+ <key>num_items</key>
+ <value>2</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$num_items &gt; 0</check>
+ <check>$vlen &gt;= 1</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <vlen>$vlen*$num_items</vlen>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </source>
+</block>
diff --git a/grc/blocks/gr_vector_to_streams.xml b/grc/blocks/gr_vector_to_streams.xml
new file mode 100644
index 000000000..86cb56813
--- /dev/null
+++ b/grc/blocks/gr_vector_to_streams.xml
@@ -0,0 +1,67 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Vector to Streams
+###################################################
+ -->
+<block>
+ <name>Vector to Streams</name>
+ <key>gr_vector_to_streams</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.vector_to_streams($type.size*$vlen, $num_streams)</make>
+ <param>
+ <name>IO Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>size:gr.sizeof_gr_complex</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>size:gr.sizeof_float</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>size:gr.sizeof_int</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>size:gr.sizeof_short</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>size:gr.sizeof_char</opt>
+ </option>
+ </param>
+ <param>
+ <name>Num Streams</name>
+ <key>num_streams</key>
+ <value>2</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$num_streams &gt; 0</check>
+ <check>$vlen &gt;= 1</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <vlen>$vlen*$num_streams</vlen>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ <nports>$num_streams</nports>
+ </source>
+</block>
diff --git a/grc/blocks/gr_wavfile_sink.xml b/grc/blocks/gr_wavfile_sink.xml
new file mode 100644
index 000000000..651e16cb6
--- /dev/null
+++ b/grc/blocks/gr_wavfile_sink.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Wav File Sink
+###################################################
+ -->
+<block>
+ <name>Wav File Sink</name>
+ <key>gr_wavfile_sink</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.wavfile_sink($file, $nchan, $samp_rate, $bits_per_sample)</make>
+ <callback>open($file)</callback>
+ <param>
+ <name>File</name>
+ <key>file</key>
+ <value></value>
+ <type>file_save</type>
+ </param>
+ <param>
+ <name>N Channels</name>
+ <key>nchan</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Sample Rate</name>
+ <key>samp_rate</key>
+ <value>samp_rate</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Bits per Sample</name>
+ <key>bits_per_sample</key>
+ <value>8</value>
+ <type>int</type>
+ </param>
+ <check>1 &lt;= $nchan</check>
+ <sink>
+ <name>in</name>
+ <type>float</type>
+ <nports>$nchan</nports>
+ </sink>
+</block>
diff --git a/grc/blocks/gr_wavfile_source.xml b/grc/blocks/gr_wavfile_source.xml
new file mode 100644
index 000000000..433bb0af2
--- /dev/null
+++ b/grc/blocks/gr_wavfile_source.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Wav File Source
+###################################################
+ -->
+<block>
+ <name>Wav File Source</name>
+ <key>gr_wavfile_source</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.wavfile_source($file, $repeat)</make>
+ <param>
+ <name>File</name>
+ <key>file</key>
+ <value></value>
+ <type>file_open</type>
+ </param>
+ <param>
+ <name>Repeat</name>
+ <key>repeat</key>
+ <value>True</value>
+ <type>enum</type>
+ <option>
+ <name>Yes</name>
+ <key>True</key>
+ </option>
+ <option>
+ <name>No</name>
+ <key>False</key>
+ </option>
+ </param>
+ <param>
+ <name>N Channels</name>
+ <key>nchan</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>1 &lt;= $nchan</check>
+ <source>
+ <name>out</name>
+ <type>float</type>
+ <nports>$nchan</nports>
+ </source>
+</block>
diff --git a/grc/blocks/gr_xor_xx.xml b/grc/blocks/gr_xor_xx.xml
new file mode 100644
index 000000000..c014cbe57
--- /dev/null
+++ b/grc/blocks/gr_xor_xx.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Logical Xor Block
+###################################################
+ -->
+<block>
+ <name>Xor</name>
+ <key>gr_xor_xx</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.xor_$(type.fcn)()</make>
+ <param>
+ <name>IO Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>fcn:ii</opt>
+ </option>
+ <option>
+ <name>Shxort</name>
+ <key>short</key>
+ <opt>fcn:ss</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>fcn:bb</opt>
+ </option>
+ </param>
+ <param>
+ <name>Num Inputs</name>
+ <key>num_inputs</key>
+ <value>2</value>
+ <type>int</type>
+ </param>
+ <check>$num_inputs &gt;= 2</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <nports>$num_inputs</nports>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ </source>
+</block>
diff --git a/grc/blocks/high_pass_filter.xml b/grc/blocks/high_pass_filter.xml
new file mode 100644
index 000000000..0e29cbb36
--- /dev/null
+++ b/grc/blocks/high_pass_filter.xml
@@ -0,0 +1,127 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##High Pass Filter: Custom wrapper
+###################################################
+ -->
+<block>
+ <name>High Pass Filter</name>
+ <key>high_pass_filter</key>
+ <import>from gnuradio import gr</import>
+ <import>from gnuradio.gr import firdes</import>
+ <make>gr.$(type)(#if str($type).startswith('interp') then $interp else $decim#, firdes.high_pass(
+ $gain, $samp_rate, $cutoff_freq, $width, $win, $beta))</make>
+ <callback>set_taps(firdes.high_pass($gain, $samp_rate, $cutoff_freq, $width, $win, $beta))</callback>
+ <param>
+ <name>FIR Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex->Complex (Decimating)</name>
+ <key>fir_filter_ccf</key>
+ <opt>input:complex</opt>
+ <opt>output:complex</opt>
+ </option>
+ <option>
+ <name>Complex->Complex (Interpolating)</name>
+ <key>interp_fir_filter_ccf</key>
+ <opt>input:complex</opt>
+ <opt>output:complex</opt>
+ </option>
+ <option>
+ <name>Float->Float (Decimating)</name>
+ <key>fir_filter_fff</key>
+ <opt>input:float</opt>
+ <opt>output:float</opt>
+ </option>
+ <option>
+ <name>Float->Float (Interpolating)</name>
+ <key>interp_fir_filter_fff</key>
+ <opt>input:float</opt>
+ <opt>output:float</opt>
+ </option>
+ </param>
+ <param>
+ <name>Decimation</name>
+ <key>decim</key>
+ <value>1</value>
+ <type>int</type>
+ <hide>#if str($type).startswith('interp') then 'all' else 'none'#</hide>
+ </param>
+ <param>
+ <name>Interpolation</name>
+ <key>interp</key>
+ <value>1</value>
+ <type>int</type>
+ <hide>#if str($type).startswith('interp') then 'none' else 'all'#</hide>
+ </param>
+ <param>
+ <name>Gain</name>
+ <key>gain</key>
+ <value>1</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Sample Rate</name>
+ <key>samp_rate</key>
+ <value>samp_rate</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Cutoff Freq</name>
+ <key>cutoff_freq</key>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Transition Width</name>
+ <key>width</key>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Window</name>
+ <key>win</key>
+ <value>firdes.WIN_HAMMING</value>
+ <type>int</type>
+ <option>
+ <name>Hamming</name>
+ <key>firdes.WIN_HAMMING</key>
+ </option>
+ <option>
+ <name>Hann</name>
+ <key>firdes.WIN_HANN</key>
+ </option>
+ <option>
+ <name>Blackman</name>
+ <key>firdes.WIN_BLACKMAN</key>
+ </option>
+ <option>
+ <name>Rectangular</name>
+ <key>firdes.WIN_RECTANGULAR</key>
+ </option>
+ <option>
+ <name>Kaiser</name>
+ <key>firdes.WIN_KAISER</key>
+ </option>
+ </param>
+ <param>
+ <name>Beta</name>
+ <key>beta</key>
+ <value>6.76</value>
+ <type>real</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>$type.input</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type.output</type>
+ </source>
+ <doc>
+This filter is a convenience wrapper for an fir filter and a firdes taps generating function.
+
+Sample rate, cutoff frequency, and transition width are in Hertz.
+
+The beta paramater only applies to the Kaiser window.
+ </doc>
+</block>
diff --git a/grc/blocks/import.xml b/grc/blocks/import.xml
new file mode 100644
index 000000000..feea052d3
--- /dev/null
+++ b/grc/blocks/import.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Import python modules into the namespace
+###################################################
+ -->
+<block>
+ <name>Import</name>
+ <key>import</key>
+ <import>$import</import>
+ <make></make>
+ <param>
+ <name>Import</name>
+ <key>import</key>
+ <value></value>
+ <type>import</type>
+ </param>
+ <doc>
+Import additional python modules into the namespace.
+
+Examples:
+from gnuradio.gr import firdes
+import math,cmath
+from math import pi
+ </doc>
+</block>
diff --git a/grc/blocks/low_pass_filter.xml b/grc/blocks/low_pass_filter.xml
new file mode 100644
index 000000000..26435fd4d
--- /dev/null
+++ b/grc/blocks/low_pass_filter.xml
@@ -0,0 +1,127 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Low Pass Filter: Custom wrapper
+###################################################
+ -->
+<block>
+ <name>Low Pass Filter</name>
+ <key>low_pass_filter</key>
+ <import>from gnuradio import gr</import>
+ <import>from gnuradio.gr import firdes</import>
+ <make>gr.$(type)(#if str($type).startswith('interp') then $interp else $decim#, firdes.low_pass(
+ $gain, $samp_rate, $cutoff_freq, $width, $win, $beta))</make>
+ <callback>set_taps(firdes.low_pass($gain, $samp_rate, $cutoff_freq, $width, $win, $beta))</callback>
+ <param>
+ <name>FIR Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex->Complex (Decimating)</name>
+ <key>fir_filter_ccf</key>
+ <opt>input:complex</opt>
+ <opt>output:complex</opt>
+ </option>
+ <option>
+ <name>Complex->Complex (Interpolating)</name>
+ <key>interp_fir_filter_ccf</key>
+ <opt>input:complex</opt>
+ <opt>output:complex</opt>
+ </option>
+ <option>
+ <name>Float->Float (Decimating)</name>
+ <key>fir_filter_fff</key>
+ <opt>input:float</opt>
+ <opt>output:float</opt>
+ </option>
+ <option>
+ <name>Float->Float (Interpolating)</name>
+ <key>interp_fir_filter_fff</key>
+ <opt>input:float</opt>
+ <opt>output:float</opt>
+ </option>
+ </param>
+ <param>
+ <name>Decimation</name>
+ <key>decim</key>
+ <value>1</value>
+ <type>int</type>
+ <hide>#if str($type).startswith('interp') then 'all' else 'none'#</hide>
+ </param>
+ <param>
+ <name>Interpolation</name>
+ <key>interp</key>
+ <value>1</value>
+ <type>int</type>
+ <hide>#if str($type).startswith('interp') then 'none' else 'all'#</hide>
+ </param>
+ <param>
+ <name>Gain</name>
+ <key>gain</key>
+ <value>1</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Sample Rate</name>
+ <key>samp_rate</key>
+ <value>samp_rate</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Cutoff Freq</name>
+ <key>cutoff_freq</key>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Transition Width</name>
+ <key>width</key>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Window</name>
+ <key>win</key>
+ <value>firdes.WIN_HAMMING</value>
+ <type>int</type>
+ <option>
+ <name>Hamming</name>
+ <key>firdes.WIN_HAMMING</key>
+ </option>
+ <option>
+ <name>Hann</name>
+ <key>firdes.WIN_HANN</key>
+ </option>
+ <option>
+ <name>Blackman</name>
+ <key>firdes.WIN_BLACKMAN</key>
+ </option>
+ <option>
+ <name>Rectangular</name>
+ <key>firdes.WIN_RECTANGULAR</key>
+ </option>
+ <option>
+ <name>Kaiser</name>
+ <key>firdes.WIN_KAISER</key>
+ </option>
+ </param>
+ <param>
+ <name>Beta</name>
+ <key>beta</key>
+ <value>6.76</value>
+ <type>real</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>$type.input</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type.output</type>
+ </source>
+ <doc>
+This filter is a convenience wrapper for an fir filter and a firdes taps generating function.
+
+Sample rate, cutoff frequency, and transition width are in Hertz.
+
+The beta paramater only applies to the Kaiser window.
+ </doc>
+</block>
diff --git a/grc/blocks/note.xml b/grc/blocks/note.xml
new file mode 100644
index 000000000..db6687c03
--- /dev/null
+++ b/grc/blocks/note.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Note Block (dummy)
+###################################################
+ -->
+<block>
+ <name>Note</name>
+ <key>note</key>
+ <make></make>
+ <param>
+ <name>Note</name>
+ <key>note</key>
+ <value></value>
+ <type>string</type>
+ </param>
+</block>
diff --git a/grc/blocks/options.xml b/grc/blocks/options.xml
new file mode 100644
index 000000000..1cf0b7707
--- /dev/null
+++ b/grc/blocks/options.xml
@@ -0,0 +1,190 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Options Block:
+## options for window size,
+## and flow graph building.
+###################################################
+ -->
+<block>
+ <name>Options</name>
+ <key>options</key>
+ <import>from gnuradio import gr</import>
+ <import>from gnuradio.gr import firdes</import>
+ <import>#if $generate_options() == 'wx_gui'
+from grc_gnuradio import wxgui as grc_wxgui
+import wx
+#end if
+#if $generate_options() == 'qt_gui'
+from PyQt4 import Qt
+import sys
+#end if
+#if $generate_options() != 'hb'
+from optparse import OptionParser
+from gnuradio.eng_option import eng_option
+from gnuradio import eng_notation
+#end if</import>
+ <make></make>
+ <callback>if $run: self.start()
+else: self.stop(); self.wait()</callback>
+ <param>
+ <name>Title</name>
+ <key>title</key>
+ <value></value>
+ <type>string</type>
+ <hide>#if $title() then 'none' else 'part'#</hide>
+ </param>
+ <param>
+ <name>Author</name>
+ <key>author</key>
+ <value></value>
+ <type>string</type>
+ <hide>#if $author() then 'none' else 'part'#</hide>
+ </param>
+ <param>
+ <name>Description</name>
+ <key>description</key>
+ <value></value>
+ <type>string</type>
+ <hide>#if $description() then 'none' else 'part'#</hide>
+ </param>
+ <param>
+ <name>Window Size</name>
+ <key>window_size</key>
+ <value>1280, 1024</value>
+ <type>int_vector</type>
+ <hide>part</hide>
+ </param>
+ <param>
+ <name>Generate Options</name>
+ <key>generate_options</key>
+ <value>wx_gui</value>
+ <type>enum</type>
+ <option>
+ <name>WX GUI</name>
+ <key>wx_gui</key>
+ </option>
+ <option>
+ <name>QT GUI</name>
+ <key>qt_gui</key>
+ </option>
+ <option>
+ <name>No GUI</name>
+ <key>no_gui</key>
+ </option>
+ <option>
+ <name>Hier Block</name>
+ <key>hb</key>
+ </option>
+ </param>
+ <param>
+ <name>Category</name>
+ <key>category</key>
+ <value>Custom</value>
+ <type>string</type>
+ <hide>#if $generate_options() == 'hb' then 'none' else 'all'#</hide>
+ </param>
+ <param>
+ <name>Run Options</name>
+ <key>run_options</key>
+ <value>prompt</value>
+ <type>enum</type>
+ <hide>#if $generate_options() == 'no_gui' then 'none' else 'all'#</hide>
+ <option>
+ <name>Run to Completion</name>
+ <key>run</key>
+ </option>
+ <option>
+ <name>Prompt for Exit</name>
+ <key>prompt</key>
+ </option>
+ </param>
+ <param>
+ <name>Run</name>
+ <key>run</key>
+ <value>True</value>
+ <type>bool</type>
+ <hide>
+#if $generate_options() in ('qt_gui', 'wx_gui')
+ #if $run()
+ part
+ #else
+ none
+ #end if
+#else
+ all
+#end if
+ </hide>
+ <option>
+ <name>Autostart</name>
+ <key>True</key>
+ </option>
+ <option>
+ <name>Off</name>
+ <key>False</key>
+ </option>
+ </param>
+ <param>
+ <name>Max Number of Output</name>
+ <key>max_nouts</key>
+ <value>0</value>
+ <type>int</type>
+ <hide>#if $generate_options() == 'hb'
+all#slurp
+#elif $max_nouts()
+none#slurp
+#else
+part#slurp
+#end if</hide>
+ </param>
+ <param>
+ <name>Realtime Scheduling</name>
+ <key>realtime_scheduling</key>
+ <value></value>
+ <type>enum</type>
+ <hide>#if $generate_options() == 'hb'
+all#slurp
+#elif $realtime_scheduling()
+none#slurp
+#else
+part#slurp
+#end if</hide>
+ <option>
+ <name>Off</name>
+ <key></key>
+ </option>
+ <option>
+ <name>On</name>
+ <key>1</key>
+ </option>
+ </param>
+ <check>len($window_size) == 2</check>
+ <check>300 &lt;= $(window_size)[0] &lt;= 4096</check>
+ <check>300 &lt;= $(window_size)[1] &lt;= 4096</check>
+ <doc>
+The options block sets special parameters for the flow graph. \
+Only one option block is allowed per flow graph.
+
+Title, author, and description parameters are for identification purposes.
+
+The window size controls the dimensions of the flow graph editor. \
+The window size (width, height) must be between (300, 300) and (4096, 4096).
+
+The generate options controls the type of code generated. \
+Non-graphical flow graphs should avoid using graphical sinks or graphical variable controls.
+
+In a graphical application, \
+run can be controlled by a variable to start and stop the flowgraph at runtime.
+
+The id of this block determines the name of the generated file and the name of the class. \
+For example, an id of my_block will generate the file my_block.py and class my_block(gr....
+
+The category parameter determines the placement of the block in the block selection window. \
+The category only applies when creating hier blocks. \
+To put hier blocks into the root category, enter / for the category.
+
+The Max Number of Output is the maximum number of output items allowed for any block \
+in the flowgraph; to disable this set the max_nouts equal to 0.\
+Use this to adjust the maximum latency a flowgraph can exhibit.
+ </doc>
+</block>
diff --git a/grc/blocks/pad_sink.xml b/grc/blocks/pad_sink.xml
new file mode 100644
index 000000000..f0e10a339
--- /dev/null
+++ b/grc/blocks/pad_sink.xml
@@ -0,0 +1,91 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Pad Sink: IO Pads
+###################################################
+ -->
+<block>
+ <name>Pad Sink</name>
+ <key>pad_sink</key>
+ <make>#if str($type) == "message"
+None;self.message_port_register_hier_in($label)
+#end if</make>
+ <param>
+ <name>Label</name>
+ <key>label</key>
+ <value>out</value>
+ <type>string</type>
+ </param>
+ <param>
+ <name>Input Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>size:gr.sizeof_gr_complex</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>size:gr.sizeof_float</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>size:gr.sizeof_int</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>size:gr.sizeof_short</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>size:gr.sizeof_char</opt>
+ </option>
+ <option>
+ <name>Message</name>
+ <key>message</key>
+ <opt>size:0</opt>
+ </option>
+ <option>
+ <name>Wildcard</name>
+ <key></key>
+ <opt>size:0</opt>
+ </option>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Optional</name>
+ <key>optional</key>
+ <value>False</value>
+ <type>bool</type>
+ <hide>part</hide>
+ <option>
+ <name>Optional</name>
+ <key>True</key>
+ </option>
+ <option>
+ <name>Required</name>
+ <key>False</key>
+ </option>
+ </param>
+ <check>$vlen &gt; 0</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </sink>
+ <doc>
+The inputs of this block will become the outputs to this flow graph when it is instantiated as a hierarchical block.
+
+Pad sink will be ordered alphabetically by their ids. The first pad sink will have an index of 0.
+ </doc>
+</block>
diff --git a/grc/blocks/pad_source.xml b/grc/blocks/pad_source.xml
new file mode 100644
index 000000000..a56a65dcc
--- /dev/null
+++ b/grc/blocks/pad_source.xml
@@ -0,0 +1,91 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Pad Source: IO Pads
+###################################################
+ -->
+<block>
+ <name>Pad Source</name>
+ <key>pad_source</key>
+ <make>#if str($type) == "message"
+None;self.message_port_register_hier_out($label)
+#end if</make>
+ <param>
+ <name>Label</name>
+ <key>label</key>
+ <value>in</value>
+ <type>string</type>
+ </param>
+ <param>
+ <name>Output Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>size:gr.sizeof_gr_complex</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>size:gr.sizeof_float</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>size:gr.sizeof_int</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>size:gr.sizeof_short</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>size:gr.sizeof_char</opt>
+ </option>
+ <option>
+ <name>Message</name>
+ <key>message</key>
+ <opt>size:0</opt>
+ </option>
+ <option>
+ <name>Wildcard</name>
+ <key></key>
+ <opt>size:0</opt>
+ </option>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Optional</name>
+ <key>optional</key>
+ <value>False</value>
+ <type>bool</type>
+ <hide>part</hide>
+ <option>
+ <name>Optional</name>
+ <key>True</key>
+ </option>
+ <option>
+ <name>Required</name>
+ <key>False</key>
+ </option>
+ </param>
+ <check>$vlen &gt; 0</check>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </source>
+ <doc>
+The outputs of this block will become the inputs to this flow graph when it is instantiated as a hierarchical block.
+
+Pad sources will be ordered alphabetically by their ids. The first pad source will have an index of 0.
+ </doc>
+</block>
diff --git a/grc/blocks/parameter.xml b/grc/blocks/parameter.xml
new file mode 100644
index 000000000..e35b8f4d1
--- /dev/null
+++ b/grc/blocks/parameter.xml
@@ -0,0 +1,99 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Parameter block: a grc variable with key, value
+###################################################
+ -->
+<block>
+ <name>Parameter</name>
+ <key>parameter</key>
+ <var_make>self.$(id) = $(id)</var_make>
+ <make>$value</make>
+ <param>
+ <name>Label</name>
+ <key>label</key>
+ <value></value>
+ <type>string</type>
+ <hide>#if $label() then 'none' else 'part'#</hide>
+ </param>
+ <param>
+ <name>Value</name>
+ <key>value</key>
+ <value>0</value>
+ <type>$type.type</type>
+ </param>
+ <param>
+ <name>Type</name>
+ <key>type</key>
+ <value></value>
+ <type>enum</type>
+ <hide>#if $type() then 'none' else 'part'#</hide>
+ <option>
+ <name>None</name>
+ <key></key>
+ <opt>type:raw</opt>
+ </option>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>type:complex</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>eng_float</key>
+ <opt>type:real</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>intx</key>
+ <opt>type:int</opt>
+ </option>
+ <option>
+ <name>Long</name>
+ <key>long</key>
+ <opt>type:int</opt>
+ </option>
+ <option>
+ <name>String</name>
+ <key>string</key>
+ <opt>type:string</opt>
+ </option>
+ <!-- not supported yet in tmpl
+ <option>
+ <name>Boolean</name>
+ <key>bool</key>
+ <opt>type:bool</opt>
+ </option>
+ -->
+ </param>
+ <param>
+ <name>Short ID</name>
+ <key>short_id</key>
+ <value></value>
+ <type>string</type>
+ <hide>#if not $type()
+all#slurp
+#elif $short_id()
+none#slurp
+#else
+part#slurp
+#end if</hide>
+ </param>
+ <check>len($short_id) in (0, 1)</check>
+ <check>$short_id == '' or $(short_id).isalpha()</check>
+ <doc>
+This block represents a parameter to the flow graph. \
+A parameter can be used to pass command line arguments into a top block. \
+Or, parameters can pass arguments into an instantiated hierarchical block.
+
+The paramater value cannot depend on any variables.
+
+Leave the label blank to use the parameter id as the label.
+
+When type is not None, this parameter also becomes a command line option of the form:
+
+-[short_id] --[id] [value]
+
+The Short ID field may be left blank.
+ </doc>
+</block>
diff --git a/grc/blocks/random_source_x.xml b/grc/blocks/random_source_x.xml
new file mode 100644
index 000000000..800bae716
--- /dev/null
+++ b/grc/blocks/random_source_x.xml
@@ -0,0 +1,75 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Random Source:
+## Custom block
+###################################################
+ -->
+<block>
+ <name>Random Source</name>
+ <key>random_source_x</key>
+ <import>from gnuradio import gr</import>
+ <import>import numpy</import>
+ <make>gr.vector_source_$(type.fcn)(map(int, numpy.random.randint($min, $max, $num_samps)), $repeat)</make>
+ <param>
+ <name>Output Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>fcn:i</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>fcn:s</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>fcn:b</opt>
+ </option>
+ </param>
+ <param>
+ <name>Minimum</name>
+ <key>min</key>
+ <value>0</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Maximum</name>
+ <key>max</key>
+ <value>2</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Num Samples</name>
+ <key>num_samps</key>
+ <value>1000</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Repeat</name>
+ <key>repeat</key>
+ <value>True</value>
+ <type>enum</type>
+ <option>
+ <name>Yes</name>
+ <key>True</key>
+ </option>
+ <option>
+ <name>No</name>
+ <key>False</key>
+ </option>
+ </param>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ </source>
+ <doc>
+Generate num samples of random numbers of [min, max). Repeat samples if specified.
+
+Ex: With min=0 and max=2, the sequence 01110101... will be generated.
+ </doc>
+</block>
diff --git a/grc/blocks/root_raised_cosine_filter.xml b/grc/blocks/root_raised_cosine_filter.xml
new file mode 100644
index 000000000..81688d297
--- /dev/null
+++ b/grc/blocks/root_raised_cosine_filter.xml
@@ -0,0 +1,101 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Root Raised Cosine Filter: Custom wrapper
+###################################################
+ -->
+<block>
+ <name>Root Raised Cosine Filter</name>
+ <key>root_raised_cosine_filter</key>
+ <import>from gnuradio import gr</import>
+ <import>from gnuradio.gr import firdes</import>
+ <make>gr.$(type)(#if str($type).startswith('interp') then $interp else $decim#, firdes.root_raised_cosine(
+ $gain, $samp_rate, $sym_rate, $alpha, $ntaps))</make>
+ <callback>set_taps(firdes.root_raised_cosine($gain, $samp_rate, $sym_rate, $alpha, $ntaps))</callback>
+ <param>
+ <name>FIR Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex->Complex (Decimating)</name>
+ <key>fir_filter_ccf</key>
+ <opt>input:complex</opt>
+ <opt>output:complex</opt>
+ </option>
+ <option>
+ <name>Complex->Complex (Interpolating)</name>
+ <key>interp_fir_filter_ccf</key>
+ <opt>input:complex</opt>
+ <opt>output:complex</opt>
+ </option>
+ <option>
+ <name>Float->Float (Decimating)</name>
+ <key>fir_filter_fff</key>
+ <opt>input:float</opt>
+ <opt>output:float</opt>
+ </option>
+ <option>
+ <name>Float->Float (Interpolating)</name>
+ <key>interp_fir_filter_fff</key>
+ <opt>input:float</opt>
+ <opt>output:float</opt>
+ </option>
+ </param>
+ <param>
+ <name>Decimation</name>
+ <key>decim</key>
+ <value>1</value>
+ <type>int</type>
+ <hide>#if str($type).startswith('interp') then 'all' else 'none'#</hide>
+ </param>
+ <param>
+ <name>Interpolation</name>
+ <key>interp</key>
+ <value>1</value>
+ <type>int</type>
+ <hide>#if str($type).startswith('interp') then 'none' else 'all'#</hide>
+ </param>
+ <param>
+ <name>Gain</name>
+ <key>gain</key>
+ <value>1</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Sample Rate</name>
+ <key>samp_rate</key>
+ <value>samp_rate</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Symbol Rate</name>
+ <key>sym_rate</key>
+ <value>1.0</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Alpha</name>
+ <key>alpha</key>
+ <value>0.35</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Num Taps</name>
+ <key>ntaps</key>
+ <value>11*samp_rate</value>
+ <type>int</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>$type.input</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type.output</type>
+ </source>
+ <doc>
+This filter is a convenience wrapper for an fir filter and a firdes taps generating function.
+
+Sample rate in Hertz.
+ </doc>
+</block>
diff --git a/grc/blocks/variable.xml b/grc/blocks/variable.xml
new file mode 100644
index 000000000..afee0f5d4
--- /dev/null
+++ b/grc/blocks/variable.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Variable block: a grc variable with key, value
+###################################################
+ -->
+<block>
+ <name>Variable</name>
+ <key>variable</key>
+ <var_make>self.$(id) = $(id) = $value</var_make>
+ <make></make>
+ <callback>self.set_$(id)($value)</callback>
+ <param>
+ <name>Value</name>
+ <key>value</key>
+ <value>0</value>
+ <type>raw</type>
+ </param>
+ <doc>
+This block maps a value to a unique variable. \
+This variable block has no graphical representation.
+ </doc>
+</block>
diff --git a/grc/blocks/variable_config.xml b/grc/blocks/variable_config.xml
new file mode 100644
index 000000000..11bff9edc
--- /dev/null
+++ b/grc/blocks/variable_config.xml
@@ -0,0 +1,88 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Variable Config block:
+## a variable that reads and writes to a config file
+###################################################
+ -->
+<block>
+ <name>Variable Config</name>
+ <key>variable_config</key>
+ <import>import ConfigParser</import>
+ <var_make>self._$(id)_config = ConfigParser.ConfigParser()
+self._$(id)_config.read($config_file)
+try: $(id) = self._$(id)_config.$(type.get)($section, $option)
+except: $(id) = $value
+self.$(id) = $(id)</var_make>
+ <make></make>
+ <callback>self.set_$(id)($value)</callback>
+ <callback>self._$(id)_config = ConfigParser.ConfigParser()
+self._$(id)_config.read($config_file)
+if not self._$(id)_config.has_section($section):
+ self._$(id)_config.add_section($section)
+self._$(id)_config.set($section, $option, str($writeback))
+self._$(id)_config.write(open($config_file, 'w'))</callback>
+ <param>
+ <name>Default Value</name>
+ <key>value</key>
+ <value>0</value>
+ <type>$type</type>
+ </param>
+ <param>
+ <name>Type</name>
+ <key>type</key>
+ <value>real</value>
+ <type>enum</type>
+ <option>
+ <name>Float</name>
+ <key>real</key>
+ <opt>get:getfloat</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>get:getint</opt>
+ </option>
+ <option>
+ <name>Bool</name>
+ <key>bool</key>
+ <opt>get:getboolean</opt>
+ </option>
+ <option>
+ <name>String</name>
+ <key>string</key>
+ <opt>get:get</opt>
+ </option>
+ </param>
+ <param>
+ <name>Config File</name>
+ <key>config_file</key>
+ <value>default</value>
+ <type>file_open</type>
+ </param>
+ <param>
+ <name>Section</name>
+ <key>section</key>
+ <value>main</value>
+ <type>string</type>
+ </param>
+ <param>
+ <name>Option</name>
+ <key>option</key>
+ <value>key</value>
+ <type>string</type>
+ </param>
+ <param>
+ <name>WriteBack</name>
+ <key>writeback</key>
+ <value>None</value>
+ <type>raw</type>
+ </param>
+ <doc>
+This block represents a variable that can be read from a config file.
+
+To save the value back into the config file: \
+enter the name of another variable into the writeback param. \
+When the other variable is changed at runtime, the config file will be re-written.
+ </doc>
+</block>
diff --git a/grc/blocks/variable_function_probe.xml b/grc/blocks/variable_function_probe.xml
new file mode 100644
index 000000000..269966c70
--- /dev/null
+++ b/grc/blocks/variable_function_probe.xml
@@ -0,0 +1,70 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Variable function probe
+###################################################
+ -->
+<block>
+ <name>Function Probe</name>
+ <key>variable_function_probe</key>
+ <import>import time</import>
+ <import>import threading</import>
+ <var_make>self.$(id) = $(id) = $value</var_make>
+ <make>#slurp
+def _$(id)_probe():
+ while True:
+ val = self.$(block_id()).$(function_name())($(function_args()))
+ try: self.set_$(id)(val)
+ except AttributeError, e: pass
+ time.sleep(1.0/($poll_rate))
+_$(id)_thread = threading.Thread(target=_$(id)_probe)
+_$(id)_thread.daemon = True
+_$(id)_thread.start()</make>
+ <callback>self.set_$(id)($value)</callback>
+ <param>
+ <name>Value</name>
+ <key>value</key>
+ <value>0</value>
+ <type>raw</type>
+ </param>
+ <param>
+ <name>Block ID</name>
+ <key>block_id</key>
+ <value>my_block_0</value>
+ <type>string</type>
+ </param>
+ <param>
+ <name>Function Name</name>
+ <key>function_name</key>
+ <value>get_number</value>
+ <type>string</type>
+ </param>
+ <param>
+ <name>Function Args</name>
+ <key>function_args</key>
+ <value></value>
+ <type>string</type>
+ <hide>#if $function_args() then 'none' else 'part'#</hide>
+ </param>
+ <param>
+ <name>Poll Rate (Hz)</name>
+ <key>poll_rate</key>
+ <value>10</value>
+ <type>real</type>
+ </param>
+ <doc>
+Periodically probe a function and set its value to this variable.
+
+Set the values for block ID, function name, and function args appropriately: \
+Block ID should be the ID of another block in this flow graph. \
+Function name should be the name of a class method on that block. \
+Function args are the parameters passed into that function. \
+For a function with no arguments, leave function args blank. \
+When passing a string for the function arguments, quote the string literal: '"arg"'.
+
+The values will used literally, and generated into the following form:
+self.block_id.function_name(function_args)
+
+To poll a stream for a level, use this with the probe signal block.
+ </doc>
+</block>
diff --git a/grc/blocks/virtual_sink.xml b/grc/blocks/virtual_sink.xml
new file mode 100644
index 000000000..35fb27e67
--- /dev/null
+++ b/grc/blocks/virtual_sink.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Virtual Sink
+###################################################
+ -->
+<block>
+ <name>Virtual Sink</name>
+ <key>virtual_sink</key>
+ <make></make>
+ <param>
+ <name>Stream ID</name>
+ <key>stream_id</key>
+ <value></value>
+ <type>stream_id</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type></type>
+ </sink>
+</block>
diff --git a/grc/blocks/virtual_source.xml b/grc/blocks/virtual_source.xml
new file mode 100644
index 000000000..e0c775449
--- /dev/null
+++ b/grc/blocks/virtual_source.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Virtual Source
+###################################################
+ -->
+<block>
+ <name>Virtual Source</name>
+ <key>virtual_source</key>
+ <make></make>
+ <param>
+ <name>Stream ID</name>
+ <key>stream_id</key>
+ <value></value>
+ <type>stream_id</type>
+ </param>
+ <source>
+ <name>out</name>
+ <type></type>
+ </source>
+</block>
diff --git a/grc/blocks/xmlrpc_client.xml b/grc/blocks/xmlrpc_client.xml
new file mode 100644
index 000000000..dc4d154d1
--- /dev/null
+++ b/grc/blocks/xmlrpc_client.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Simple XMLRPC Client
+###################################################
+ -->
+<block>
+ <name>XMLRPC Client</name>
+ <key>xmlrpc_client</key>
+ <import>import xmlrpclib</import>
+ <make>xmlrpclib.Server('http://$(addr()):$(port)')</make>
+ <callback>$(callback())($variable)</callback>
+ <param>
+ <name>Address</name>
+ <key>addr</key>
+ <value>localhost</value>
+ <type>string</type>
+ </param>
+ <param>
+ <name>Port</name>
+ <key>port</key>
+ <value>8080</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Callback</name>
+ <key>callback</key>
+ <value>set_</value>
+ <type>string</type>
+ </param>
+ <param>
+ <name>Variable</name>
+ <key>variable</key>
+ <type>raw</type>
+ </param>
+ <doc>
+This block will create an XMLRPC client. \
+The client will execute the callback on the server when the variable is changed. \
+The callback should be a the name of a function registered on the server. \
+The variable should be an expression containing a the name of a variable in flow graph.
+ </doc>
+</block>
diff --git a/grc/blocks/xmlrpc_server.xml b/grc/blocks/xmlrpc_server.xml
new file mode 100644
index 000000000..6c31bd1a9
--- /dev/null
+++ b/grc/blocks/xmlrpc_server.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Simple XMLRPC Server
+###################################################
+ -->
+<block>
+ <name>XMLRPC Server</name>
+ <key>xmlrpc_server</key>
+ <import>import SimpleXMLRPCServer</import>
+ <import>import threading</import>
+ <make>SimpleXMLRPCServer.SimpleXMLRPCServer(($addr, $port), allow_none=True)
+self.$(id).register_instance(self)
+threading.Thread(target=self.$(id).serve_forever).start()</make>
+ <param>
+ <name>Address</name>
+ <key>addr</key>
+ <value>localhost</value>
+ <type>string</type>
+ </param>
+ <param>
+ <name>Port</name>
+ <key>port</key>
+ <value>8080</value>
+ <type>int</type>
+ </param>
+ <doc>
+This block will start an XMLRPC server. \
+The server provides access to the run, start, stop, wait functions of the flow graph. \
+The server also provides access to the variable callbacks in the flow graph. \
+Ex: If the variable is called freq, the function provided by the server will be called set_freq(new_freq).
+
+Example client in python:
+
+import xmlrpclib
+s = xmlrpclib.Server('http://localhost:8080')
+s.set_freq(5000)
+ </doc>
+</block>
diff --git a/grc/cpp/README b/grc/cpp/README
new file mode 100644
index 000000000..3eccc5dbf
--- /dev/null
+++ b/grc/cpp/README
@@ -0,0 +1,5 @@
+GRC could be used to generate c++ based flowgraphs:
+
+* A few base and gui classes would be overridden.
+* Block info could be extracted from the doxygen xml.
+* New flowgraph templates would be designed.
diff --git a/grc/examples/CMakeLists.txt b/grc/examples/CMakeLists.txt
new file mode 100644
index 000000000..a218dbe50
--- /dev/null
+++ b/grc/examples/CMakeLists.txt
@@ -0,0 +1,37 @@
+# Copyright 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.
+
+# SIMPLE
+install(
+ FILES
+ simple/variable_config.grc
+ DESTINATION ${GR_PKG_DATA_DIR}/examples/grc/simple
+ COMPONENT "grc"
+)
+
+# XMLRPC
+install(
+ FILES
+ xmlrpc/readme.txt
+ xmlrpc/xmlrpc_client.grc
+ xmlrpc/xmlrpc_client_script.py
+ xmlrpc/xmlrpc_server.grc
+ DESTINATION ${GR_PKG_DATA_DIR}/examples/grc/xmlrpc
+ COMPONENT "grc"
+)
diff --git a/grc/examples/simple/variable_config.grc b/grc/examples/simple/variable_config.grc
new file mode 100644
index 000000000..95c287cce
--- /dev/null
+++ b/grc/examples/simple/variable_config.grc
@@ -0,0 +1,329 @@
+<?xml version='1.0' encoding='ASCII'?>
+<flow_graph>
+ <timestamp>Thu Jun 25 10:56:04 2009</timestamp>
+ <block>
+ <key>options</key>
+ <param>
+ <key>id</key>
+ <value>variable_config_demo</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>title</key>
+ <value>Variable Config Block Demonstration</value>
+ </param>
+ <param>
+ <key>author</key>
+ <value>Example</value>
+ </param>
+ <param>
+ <key>description</key>
+ <value>Save/Load freq from a config file.</value>
+ </param>
+ <param>
+ <key>window_size</key>
+ <value>1280, 1024</value>
+ </param>
+ <param>
+ <key>generate_options</key>
+ <value>wx_gui</value>
+ </param>
+ <param>
+ <key>category</key>
+ <value>Custom</value>
+ </param>
+ <param>
+ <key>autostart</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>realtime_scheduling</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(10, 10)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable</key>
+ <param>
+ <key>id</key>
+ <value>samp_rate</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>32000</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(10, 170)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable_config</key>
+ <param>
+ <key>id</key>
+ <value>freq_init</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>1000</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>real</value>
+ </param>
+ <param>
+ <key>config_file</key>
+ <value>config.conf</value>
+ </param>
+ <param>
+ <key>section</key>
+ <value>main</value>
+ </param>
+ <param>
+ <key>option</key>
+ <value>freq</value>
+ </param>
+ <param>
+ <key>writeback</key>
+ <value>freq</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(255, 17)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable_slider</key>
+ <param>
+ <key>id</key>
+ <value>freq</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>label</key>
+ <value>Frequency (Hz)</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>freq_init</value>
+ </param>
+ <param>
+ <key>min</key>
+ <value>-samp_rate/2</value>
+ </param>
+ <param>
+ <key>max</key>
+ <value>samp_rate/2</value>
+ </param>
+ <param>
+ <key>num_steps</key>
+ <value>100</value>
+ </param>
+ <param>
+ <key>style</key>
+ <value>wx.SL_HORIZONTAL</value>
+ </param>
+ <param>
+ <key>converver</key>
+ <value>float_converter</value>
+ </param>
+ <param>
+ <key>grid_pos</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(429, 24)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>gr_throttle</key>
+ <param>
+ <key>id</key>
+ <value>gr_throttle_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>complex</value>
+ </param>
+ <param>
+ <key>samples_per_second</key>
+ <value>samp_rate</value>
+ </param>
+ <param>
+ <key>vlen</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(392, 233)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>gr_sig_source_x</key>
+ <param>
+ <key>id</key>
+ <value>gr_sig_source_x_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>complex</value>
+ </param>
+ <param>
+ <key>samp_rate</key>
+ <value>samp_rate</value>
+ </param>
+ <param>
+ <key>waveform</key>
+ <value>gr.GR_COS_WAVE</value>
+ </param>
+ <param>
+ <key>freq</key>
+ <value>freq</value>
+ </param>
+ <param>
+ <key>amp</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>offset</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(148, 233)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>wxgui_fftsink2</key>
+ <param>
+ <key>id</key>
+ <value>wxgui_fftsink2_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>complex</value>
+ </param>
+ <param>
+ <key>title</key>
+ <value>FFT Plot</value>
+ </param>
+ <param>
+ <key>samp_rate</key>
+ <value>samp_rate</value>
+ </param>
+ <param>
+ <key>baseband_freq</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>y_per_div</key>
+ <value>10</value>
+ </param>
+ <param>
+ <key>y_divs</key>
+ <value>10</value>
+ </param>
+ <param>
+ <key>ref_level</key>
+ <value>50</value>
+ </param>
+ <param>
+ <key>fft_size</key>
+ <value>1024</value>
+ </param>
+ <param>
+ <key>fft_rate</key>
+ <value>30</value>
+ </param>
+ <param>
+ <key>peak_hold</key>
+ <value>False</value>
+ </param>
+ <param>
+ <key>average</key>
+ <value>False</value>
+ </param>
+ <param>
+ <key>avg_alpha</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>grid_pos</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(671, 233)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <connection>
+ <source_block_id>gr_sig_source_x_0</source_block_id>
+ <sink_block_id>gr_throttle_0</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>gr_throttle_0</source_block_id>
+ <sink_block_id>wxgui_fftsink2_0</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+</flow_graph>
diff --git a/grc/examples/xmlrpc/readme.txt b/grc/examples/xmlrpc/readme.txt
new file mode 100644
index 000000000..056ad1e82
--- /dev/null
+++ b/grc/examples/xmlrpc/readme.txt
@@ -0,0 +1,18 @@
+##################################################
+# XMLRPC example
+##################################################
+
+XMLRPC allows software to make remote function calls over http.
+In the case of GRC, one can use XMLRPC to modify variables in a running flow graph.
+See http://www.xmlrpc.com/
+
+--- Server Example ---
+Place an "XMLRPC Server" block inside of any flow graph.
+The server will provide set functions for every variable in the flow graph.
+If a variable is called "freq", the server will provide a function set_freq(new_freq).
+Run the server example and experiment with the example client script.
+
+-- Client Example --
+The "XMLRPC Client" block will give a variable control over one remove function.
+In the example client, there is one client block and gui control per variable.
+This technique can be used to remotely control a flow graph, perhaps running on a non-gui machine.
diff --git a/grc/examples/xmlrpc/xmlrpc_client.grc b/grc/examples/xmlrpc/xmlrpc_client.grc
new file mode 100644
index 000000000..3bb4e7ed3
--- /dev/null
+++ b/grc/examples/xmlrpc/xmlrpc_client.grc
@@ -0,0 +1,312 @@
+<?xml version='1.0' encoding='ASCII'?>
+<flow_graph>
+ <timestamp>Thu Jul 24 14:27:44 2008</timestamp>
+ <block>
+ <key>options</key>
+ <param>
+ <key>id</key>
+ <value>client_block</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>title</key>
+ <value>XMLRPC Client</value>
+ </param>
+ <param>
+ <key>author</key>
+ <value>Example</value>
+ </param>
+ <param>
+ <key>description</key>
+ <value>example flow graph</value>
+ </param>
+ <param>
+ <key>window_size</key>
+ <value>1280, 1024</value>
+ </param>
+ <param>
+ <key>generate_options</key>
+ <value>wx_gui</value>
+ </param>
+ <param>
+ <key>category</key>
+ <value>Custom</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(10, 10)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>xmlrpc_client</key>
+ <param>
+ <key>id</key>
+ <value>xmlrpc_client0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>addr</key>
+ <value>localhost</value>
+ </param>
+ <param>
+ <key>port</key>
+ <value>1234</value>
+ </param>
+ <param>
+ <key>callback</key>
+ <value>set_ampl</value>
+ </param>
+ <param>
+ <key>variable</key>
+ <value>ampl</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(409, 35)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>xmlrpc_client</key>
+ <param>
+ <key>id</key>
+ <value>xmlrpc_client</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>addr</key>
+ <value>localhost</value>
+ </param>
+ <param>
+ <key>port</key>
+ <value>1234</value>
+ </param>
+ <param>
+ <key>callback</key>
+ <value>set_freq</value>
+ </param>
+ <param>
+ <key>variable</key>
+ <value>freq</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(222, 34)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable_slider</key>
+ <param>
+ <key>id</key>
+ <value>freq</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>label</key>
+ <value>Frequency (Hz)</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>1000</value>
+ </param>
+ <param>
+ <key>min</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>max</key>
+ <value>5000</value>
+ </param>
+ <param>
+ <key>num_steps</key>
+ <value>100</value>
+ </param>
+ <param>
+ <key>slider_type</key>
+ <value>horizontal</value>
+ </param>
+ <param>
+ <key>grid_pos</key>
+ <value>0, 0, 1, 2</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(207, 162)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable_slider</key>
+ <param>
+ <key>id</key>
+ <value>ampl</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>label</key>
+ <value>Amplitude</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>min</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>max</key>
+ <value>2</value>
+ </param>
+ <param>
+ <key>num_steps</key>
+ <value>100</value>
+ </param>
+ <param>
+ <key>slider_type</key>
+ <value>horizontal</value>
+ </param>
+ <param>
+ <key>grid_pos</key>
+ <value>1, 0, 1, 2</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(397, 167)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable_chooser</key>
+ <param>
+ <key>id</key>
+ <value>offset</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>label</key>
+ <value>Offset</value>
+ </param>
+ <param>
+ <key>value_index</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>choices</key>
+ <value>[-1, 0, 1]</value>
+ </param>
+ <param>
+ <key>labels</key>
+ <value>["neg", "zero", "pos"]</value>
+ </param>
+ <param>
+ <key>chooser_type</key>
+ <value>radio_buttons_horizontal</value>
+ </param>
+ <param>
+ <key>grid_pos</key>
+ <value>2, 0, 1, 2</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(596, 177)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>xmlrpc_client</key>
+ <param>
+ <key>id</key>
+ <value>xmlrpc_client1</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>addr</key>
+ <value>localhost</value>
+ </param>
+ <param>
+ <key>port</key>
+ <value>1234</value>
+ </param>
+ <param>
+ <key>callback</key>
+ <value>set_offset</value>
+ </param>
+ <param>
+ <key>variable</key>
+ <value>offset*ampl</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(608, 39)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable</key>
+ <param>
+ <key>id</key>
+ <value>samp_rate</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>32000</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(13, 172)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+</flow_graph> \ No newline at end of file
diff --git a/grc/examples/xmlrpc/xmlrpc_client_script.py b/grc/examples/xmlrpc/xmlrpc_client_script.py
new file mode 100644
index 000000000..8f00fa55d
--- /dev/null
+++ b/grc/examples/xmlrpc/xmlrpc_client_script.py
@@ -0,0 +1,23 @@
+#!/usr/bin/env python
+
+import time
+import random
+import xmlrpclib
+
+#create server object
+s = xmlrpclib.Server("http://localhost:1234")
+
+#randomly change parameters of the sinusoid
+for i in range(10):
+ #generate random values
+ new_freq = random.uniform(0, 5000)
+ new_ampl = random.uniform(0, 2)
+ new_offset = random.uniform(-1, 1)
+ #set new values
+ time.sleep(1)
+ s.set_freq(new_freq)
+ time.sleep(1)
+ s.set_ampl(new_ampl)
+ time.sleep(1)
+ s.set_offset(new_offset)
+
diff --git a/grc/examples/xmlrpc/xmlrpc_server.grc b/grc/examples/xmlrpc/xmlrpc_server.grc
new file mode 100644
index 000000000..dc539ef1b
--- /dev/null
+++ b/grc/examples/xmlrpc/xmlrpc_server.grc
@@ -0,0 +1,384 @@
+<?xml version='1.0' encoding='ASCII'?>
+<flow_graph>
+ <timestamp>Thu Jul 24 14:27:42 2008</timestamp>
+ <block>
+ <key>options</key>
+ <param>
+ <key>id</key>
+ <value>server_block</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>title</key>
+ <value>XMLRPC Server</value>
+ </param>
+ <param>
+ <key>author</key>
+ <value>Example</value>
+ </param>
+ <param>
+ <key>description</key>
+ <value>example flow graph</value>
+ </param>
+ <param>
+ <key>window_size</key>
+ <value>1280, 1024</value>
+ </param>
+ <param>
+ <key>generate_options</key>
+ <value>wx_gui</value>
+ </param>
+ <param>
+ <key>category</key>
+ <value>Custom</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(10, 10)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>gr_sig_source_x</key>
+ <param>
+ <key>id</key>
+ <value>gr_sig_source_x</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>float</value>
+ </param>
+ <param>
+ <key>samp_rate</key>
+ <value>samp_rate</value>
+ </param>
+ <param>
+ <key>waveform</key>
+ <value>gr.GR_COS_WAVE</value>
+ </param>
+ <param>
+ <key>freq</key>
+ <value>freq</value>
+ </param>
+ <param>
+ <key>amp</key>
+ <value>ampl</value>
+ </param>
+ <param>
+ <key>offset</key>
+ <value>offset</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(162, 200)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable</key>
+ <param>
+ <key>id</key>
+ <value>offset</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(12, 390)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>xmlrpc_server</key>
+ <param>
+ <key>id</key>
+ <value>xmlrpc_server</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>addr</key>
+ <value>localhost</value>
+ </param>
+ <param>
+ <key>port</key>
+ <value>1234</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(395, 240)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>gr_throttle</key>
+ <param>
+ <key>id</key>
+ <value>gr_throttle</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>float</value>
+ </param>
+ <param>
+ <key>samples_per_second</key>
+ <value>samp_rate</value>
+ </param>
+ <param>
+ <key>vlen</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(386, 93)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>wxgui_scopesink2</key>
+ <param>
+ <key>id</key>
+ <value>wxgui_scopesink2</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>float</value>
+ </param>
+ <param>
+ <key>title</key>
+ <value>Scope Plot</value>
+ </param>
+ <param>
+ <key>samp_rate</key>
+ <value>samp_rate</value>
+ </param>
+ <param>
+ <key>frame_decim</key>
+ <value>15</value>
+ </param>
+ <param>
+ <key>v_scale</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>t_scale</key>
+ <value>.001</value>
+ </param>
+ <param>
+ <key>marker</key>
+ <value>set_format_line</value>
+ </param>
+ <param>
+ <key>num_inputs</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>grid_pos</key>
+ <value>0, 0, 2, 4</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(623, 28)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>wxgui_fftsink2</key>
+ <param>
+ <key>id</key>
+ <value>wxgui_fftsink2</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>float</value>
+ </param>
+ <param>
+ <key>title</key>
+ <value>FFT Plot</value>
+ </param>
+ <param>
+ <key>samp_rate</key>
+ <value>samp_rate</value>
+ </param>
+ <param>
+ <key>baseband_freq</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>y_per_div</key>
+ <value>10</value>
+ </param>
+ <param>
+ <key>y_divs</key>
+ <value>8</value>
+ </param>
+ <param>
+ <key>ref_level</key>
+ <value>50</value>
+ </param>
+ <param>
+ <key>fft_size</key>
+ <value>512</value>
+ </param>
+ <param>
+ <key>fft_rate</key>
+ <value>15</value>
+ </param>
+ <param>
+ <key>avg_alpha</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>average</key>
+ <value>False</value>
+ </param>
+ <param>
+ <key>peak_hold</key>
+ <value>False</value>
+ </param>
+ <param>
+ <key>grid_pos</key>
+ <value>2, 0, 2, 4</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(630, 233)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable</key>
+ <param>
+ <key>id</key>
+ <value>samp_rate</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>32000</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(11, 160)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable</key>
+ <param>
+ <key>id</key>
+ <value>freq</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>1000</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(11, 237)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable</key>
+ <param>
+ <key>id</key>
+ <value>ampl</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(13, 315)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <connection>
+ <source_block_id>gr_sig_source_x</source_block_id>
+ <sink_block_id>gr_throttle</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>gr_throttle</source_block_id>
+ <sink_block_id>wxgui_scopesink2</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>gr_throttle</source_block_id>
+ <sink_block_id>wxgui_fftsink2</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+</flow_graph> \ No newline at end of file
diff --git a/grc/freedesktop/CMakeLists.txt b/grc/freedesktop/CMakeLists.txt
new file mode 100644
index 000000000..d95fe04ac
--- /dev/null
+++ b/grc/freedesktop/CMakeLists.txt
@@ -0,0 +1,47 @@
+# Copyright 2011-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.
+
+########################################################################
+set(grc_freedesktop_path ${GR_PKG_DATA_DIR}/grc/freedesktop)
+
+install(FILES
+ grc-icon-256.png
+ grc-icon-128.png
+ grc-icon-64.png
+ grc-icon-48.png
+ grc-icon-32.png
+ gnuradio-grc.xml
+ gnuradio-grc.desktop
+ DESTINATION ${grc_freedesktop_path}
+ COMPONENT "grc"
+)
+
+find_program(HAVE_XDG_UTILS xdg-desktop-menu)
+
+if(UNIX AND HAVE_XDG_UTILS)
+ set(SRCDIR ${CMAKE_INSTALL_PREFIX}/${grc_freedesktop_path})
+ configure_file(
+ ${CMAKE_CURRENT_SOURCE_DIR}/grc_setup_freedesktop.in
+ ${CMAKE_CURRENT_BINARY_DIR}/grc_setup_freedesktop
+ @ONLY)
+ install(
+ PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/grc_setup_freedesktop
+ DESTINATION ${GR_PKG_LIBEXEC_DIR} COMPONENT "grc"
+ )
+endif(UNIX AND HAVE_XDG_UTILS)
diff --git a/grc/freedesktop/README b/grc/freedesktop/README
new file mode 100644
index 000000000..0857ecc22
--- /dev/null
+++ b/grc/freedesktop/README
@@ -0,0 +1,20 @@
+##################################################
+# Freedesktop Notes
+##################################################
+
+This directory contains icons, a mime type, and menu files for grc.
+Installation of these files requires a set of tools called xdg-utils.
+xdg-utils will install files in a standard way according to the freedesktop.org standards.
+
+Desktop enviroments that implement these standards are gnome, kde, xfce, and others.
+If you have one of these desktop enviroments, xdg-utils should come installed.
+If xdg-utils is not installed, then this directory will be ignored by the build.
+
+The gtk IconTheme module locates the installed icons for use inside the grc app.
+On recent versions of gtk, IconTheme ignores the icons installed into the default theme.
+This presents a problem for the gnome file system browser, nautilus, and the grc app.
+As a solution, icons are also installed under the gnome theme.
+
+*.png files - these are the icons of various sizes
+*.desktop files - these are the menu items for grc executables
+*.xml file - this is the mime type for the saved flow graphs
diff --git a/grc/freedesktop/gnuradio-grc.desktop b/grc/freedesktop/gnuradio-grc.desktop
new file mode 100644
index 000000000..5fd049780
--- /dev/null
+++ b/grc/freedesktop/gnuradio-grc.desktop
@@ -0,0 +1,8 @@
+[Desktop Entry]
+Version=1.0
+Type=Application
+Name=GRC
+Exec=gnuradio-companion %F
+Categories=Development;
+MimeType=application/gnuradio-grc;
+Icon=gnuradio-grc
diff --git a/grc/freedesktop/gnuradio-grc.xml b/grc/freedesktop/gnuradio-grc.xml
new file mode 100644
index 000000000..a5cb95d9f
--- /dev/null
+++ b/grc/freedesktop/gnuradio-grc.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0"?>
+<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
+ <mime-type type="application/gnuradio-grc">
+ <sub-class-of type="application/xml"/>
+ <glob pattern="*.grc"/>
+ <glob pattern="*.grc.xml"/>
+ </mime-type>
+</mime-info>
diff --git a/grc/freedesktop/grc-icon-128.png b/grc/freedesktop/grc-icon-128.png
new file mode 100644
index 000000000..d94ef35dc
--- /dev/null
+++ b/grc/freedesktop/grc-icon-128.png
Binary files differ
diff --git a/grc/freedesktop/grc-icon-256.png b/grc/freedesktop/grc-icon-256.png
new file mode 100644
index 000000000..e4e8e54ae
--- /dev/null
+++ b/grc/freedesktop/grc-icon-256.png
Binary files differ
diff --git a/grc/freedesktop/grc-icon-256.svg b/grc/freedesktop/grc-icon-256.svg
new file mode 100644
index 000000000..87526d46c
--- /dev/null
+++ b/grc/freedesktop/grc-icon-256.svg
@@ -0,0 +1,216 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="256"
+ height="256"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.44.1"
+ version="1.0"
+ sodipodi:docbase="/home/past/src"
+ sodipodi:docname="grc-icon-v3.svg"
+ inkscape:export-filename="/home/past/src/grc-icon-v3.png"
+ inkscape:export-xdpi="90"
+ inkscape:export-ydpi="90">
+ <defs
+ id="defs4">
+ <linearGradient
+ id="linearGradient3661">
+ <stop
+ style="stop-color:#0012dc;stop-opacity:1;"
+ offset="0"
+ id="stop3663" />
+ <stop
+ style="stop-color:#8b92ff;stop-opacity:0.55371898;"
+ offset="1"
+ id="stop3665" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3661"
+ id="linearGradient2801"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="translate(-162.6648,798.0997)"
+ x1="17.664845"
+ y1="132.0565"
+ x2="157.82524"
+ y2="132.0565" />
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="2.7382812"
+ inkscape:cx="126.48791"
+ inkscape:cy="128.00013"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ gridoriginx="1px"
+ gridoriginy="1px"
+ gridspacingx="2px"
+ gridspacingy="2px"
+ guidecolor="#00ff0a"
+ guideopacity="0.49803922"
+ inkscape:grid-points="true"
+ inkscape:window-width="1098"
+ inkscape:window-height="904"
+ inkscape:window-x="149"
+ inkscape:window-y="42"
+ showguides="true"
+ inkscape:guide-bbox="true"
+ inkscape:object-points="true"
+ inkscape:object-nodes="true"
+ inkscape:object-bbox="true">
+ <sodipodi:guide
+ orientation="vertical"
+ position="224"
+ id="guide10639" />
+ <sodipodi:guide
+ orientation="vertical"
+ position="227.64729"
+ id="guide10641" />
+ <sodipodi:guide
+ orientation="vertical"
+ position="220"
+ id="guide10643" />
+ <sodipodi:guide
+ orientation="horizontal"
+ position="268.4015"
+ id="guide10645" />
+ </sodipodi:namedview>
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <cc:license
+ rdf:resource="http://creativecommons.org/licenses/by-sa/3.0/" />
+ <dc:creator>
+ <cc:Agent>
+ <dc:title>Patrick Strasser &lt;patrick.strasser@tugraz.at&gt;</dc:title>
+ </cc:Agent>
+ </dc:creator>
+ <dc:description>Icon/Symbol for the GNURadio Companion</dc:description>
+ <dc:title>grc-icon.svg</dc:title>
+ <dc:date>2007-02-23</dc:date>
+ </cc:Work>
+ <cc:License
+ rdf:about="http://creativecommons.org/licenses/by-sa/2.5/">
+ <cc:permits
+ rdf:resource="http://web.resource.org/cc/Reproduction" />
+ <cc:permits
+ rdf:resource="http://web.resource.org/cc/Distribution" />
+ <cc:requires
+ rdf:resource="http://web.resource.org/cc/Notice" />
+ <cc:requires
+ rdf:resource="http://web.resource.org/cc/Attribution" />
+ <cc:permits
+ rdf:resource="http://web.resource.org/cc/DerivativeWorks" />
+ <cc:requires
+ rdf:resource="http://web.resource.org/cc/ShareAlike" />
+ </cc:License>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Ebene 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(0,-796.3622)">
+ <g
+ id="g7451"
+ transform="matrix(1.025628,0,0,1.030546,-0.101723,-32.00742)">
+ <path
+ id="rect2760"
+ d="M 4.1981031,916.37787 L 160.00074,916.37787 L 160.00074,1048.3467 L 4.1981031,1048.3467 L 4.1981031,916.37787 z "
+ style="fill:white;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:7.78145933;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ <g
+ transform="matrix(0.995753,0,0,1.003897,164.8198,-8.972397)"
+ id="g2789"
+ style="stroke-width:8;stroke-miterlimit:4;stroke-dasharray:none">
+ <rect
+ style="fill:url(#linearGradient2801);fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:7.78288651;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect9020"
+ width="140.1604"
+ height="16.796082"
+ x="-145"
+ y="921.75818" />
+ <path
+ style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:black;stroke-width:7.78288651;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="M -161.50649,938.55428 L -4.8395996,938.55428"
+ id="path9005" />
+ </g>
+ </g>
+ <g
+ id="g5503"
+ transform="matrix(1.028571,0,0,1.172413,-5.14284,-137.9928)">
+ <rect
+ y="800.36212"
+ x="40"
+ height="116.00005"
+ width="140"
+ id="rect4562"
+ style="fill:#f3c690;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:7.28504848;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ <g
+ transform="matrix(0.921053,0,0,1,26.93956,1.859948)"
+ id="g3694">
+ <path
+ style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:black;stroke-width:7.59084845;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="M 44,820.3622 L 136.35974,820.3622"
+ id="path4564" />
+ <path
+ style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:black;stroke-width:7.59084749;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="M 80,811.74976 L 80,828.3622"
+ id="path5451" />
+ </g>
+ <g
+ id="g5499">
+ <rect
+ style="fill:white;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:7.28504944;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect7223"
+ width="140"
+ height="68.000015"
+ x="40"
+ y="848.36218" />
+ <path
+ style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:black;stroke-width:7.28505039;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="M 57.001362,905.90132 C 88.923615,905.8552 86.182775,867.89142 95.399136,867.52563 C 104.60967,867.16008 113.73233,867.60291 124.38688,868.00066 C 137.23411,868.48027 130.39915,906.48027 162.99863,906.48027"
+ id="path7225"
+ sodipodi:nodetypes="czss" />
+ </g>
+ </g>
+ <rect
+ style="fill:#b890f3;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:7.99999952;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect14319"
+ width="79.999992"
+ height="64.000023"
+ x="27.999992"
+ y="960.36249" />
+ <rect
+ style="fill:#f3c690;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:7.99999905;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect15206"
+ width="24.000004"
+ height="24.000004"
+ x="108"
+ y="980.36218" />
+ <path
+ id="path13320"
+ style="fill:none;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:7.99999666;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1"
+ d="M 220.97574,800.36203 L 220.97574,865.80513 C 236.42474,865.93437 248.49884,861.19996 248.96304,854.45866 C 249.42721,847.71737 237.26568,843.20829 221.81667,846.27676 C 206.36767,849.34522 193.45938,858.02071 192.98843,867.61976 C 192.53101,876.94268 204.68583,884.63729 220.13479,885.43882 C 235.58379,885.69443 248.49884,880.72833 248.96304,873.98703 C 249.42721,867.24575 237.26567,862.73666 221.81666,865.80513 C 206.36766,868.8736 193.45939,877.54909 192.98843,887.14813 C 192.53101,896.47106 204.68582,904.16566 220.13479,904.86701 C 235.5838,905.02246 248.49885,900.05636 248.96305,893.31506 C 249.42722,886.57378 237.26568,882.06469 221.81667,885.13316 C 206.36767,888.20162 193.45939,896.87711 192.98844,906.47616 C 192.53102,915.79909 204.68583,923.49369 220.13479,923.98015 C 235.58379,923.92069 248.49884,918.95459 248.96304,912.21329 C 249.42721,905.47201 237.26567,900.96293 221.81666,904.0314 C 206.36766,907.09986 193.45939,915.77535 192.98843,925.37439 C 192.53101,934.69732 207.20989,943.06708 221.81667,943.00644 L 221.81667,967.97713 C 221.63716,982.45754 209.62079,992.36197 195.88792,992.36199 L 132.42659,992.36199"
+ sodipodi:nodetypes="cccssscssscssscssccc" />
+ </g>
+</svg>
diff --git a/grc/freedesktop/grc-icon-32.png b/grc/freedesktop/grc-icon-32.png
new file mode 100644
index 000000000..1e4f4f6c5
--- /dev/null
+++ b/grc/freedesktop/grc-icon-32.png
Binary files differ
diff --git a/grc/freedesktop/grc-icon-48.png b/grc/freedesktop/grc-icon-48.png
new file mode 100644
index 000000000..caddc92ad
--- /dev/null
+++ b/grc/freedesktop/grc-icon-48.png
Binary files differ
diff --git a/grc/freedesktop/grc-icon-64.png b/grc/freedesktop/grc-icon-64.png
new file mode 100644
index 000000000..fa8e06e28
--- /dev/null
+++ b/grc/freedesktop/grc-icon-64.png
Binary files differ
diff --git a/grc/freedesktop/grc_setup_freedesktop.in b/grc/freedesktop/grc_setup_freedesktop.in
new file mode 100644
index 000000000..1e3546197
--- /dev/null
+++ b/grc/freedesktop/grc_setup_freedesktop.in
@@ -0,0 +1,75 @@
+#!/bin/bash
+#
+# Copyright 2008-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.
+#
+##################################################
+# setup grc on a freedesktop platform
+# $1 should be install or uninstall
+# $2 is the optional path to the files
+# when $2 is unspecified, the path is:
+# @SRCDIR@
+##################################################
+
+ICON_SIZES="32 48 64 128 256"
+if [ -n "$2" ]; then
+ SRCDIR="$2"
+else
+ SRCDIR="@SRCDIR@"
+fi
+
+case "$1" in
+'install')
+ echo "Begin freedesktop install..."
+ for size in ${ICON_SIZES}; do \
+ echo "Install icon: ${size}x${size}"
+ xdg-icon-resource install --noupdate --context mimetypes --theme gnome --size ${size} ${SRCDIR}/grc-icon-${size}.png application-gnuradio-grc; \
+ xdg-icon-resource install --noupdate --context mimetypes --size ${size} ${SRCDIR}/grc-icon-${size}.png application-gnuradio-grc; \
+ xdg-icon-resource install --noupdate --context apps --theme gnome --size ${size} ${SRCDIR}/grc-icon-${size}.png gnuradio-grc; \
+ xdg-icon-resource install --noupdate --context apps --size ${size} ${SRCDIR}/grc-icon-${size}.png gnuradio-grc; \
+ done
+ xdg-icon-resource forceupdate
+ echo "Install mime type"
+ xdg-mime install ${SRCDIR}/gnuradio-grc.xml
+ echo "Install menu items"
+ xdg-desktop-menu install ${SRCDIR}/*.desktop
+ echo "Done!"
+ echo ""
+ ;;
+'uninstall')
+ echo "Begin freedesktop uninstall..."
+ for size in ${ICON_SIZES}; do \
+ echo "Uninstall icon: ${size}x${size}"
+ xdg-icon-resource uninstall --noupdate --context mimetypes --theme gnome --size ${size} application-gnuradio-grc; \
+ xdg-icon-resource uninstall --noupdate --context mimetypes --size ${size} application-gnuradio-grc; \
+ xdg-icon-resource uninstall --noupdate --context apps --theme gnome --size ${size} gnuradio-grc; \
+ xdg-icon-resource uninstall --noupdate --context apps --size ${size} gnuradio-grc; \
+ done
+ xdg-icon-resource forceupdate
+ echo "Uninstall mime type"
+ xdg-mime uninstall ${SRCDIR}/gnuradio-grc.xml
+ echo "Uninstall menu items"
+ xdg-desktop-menu uninstall `ls ${SRCDIR}/*.desktop | xargs -n1 basename`
+ echo "Done!"
+ echo ""
+ ;;
+*)
+ echo "Usage: $0 [install|uninstall]"
+ ;;
+esac
diff --git a/grc/grc.conf.in b/grc/grc.conf.in
new file mode 100644
index 000000000..ace604ace
--- /dev/null
+++ b/grc/grc.conf.in
@@ -0,0 +1,7 @@
+# This file contains system wide configuration data for GNU Radio.
+# You may override any setting on a per-user basis by editing
+# ~/.gnuradio/config.conf
+
+[grc]
+global_blocks_path = @blocksdir@
+local_blocks_path =
diff --git a/grc/grc_gnuradio/CMakeLists.txt b/grc/grc_gnuradio/CMakeLists.txt
new file mode 100644
index 000000000..e992a60a3
--- /dev/null
+++ b/grc/grc_gnuradio/CMakeLists.txt
@@ -0,0 +1,35 @@
+# Copyright 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.
+
+########################################################################
+GR_PYTHON_INSTALL(
+ FILES __init__.py
+ DESTINATION ${GR_PYTHON_DIR}/grc_gnuradio
+ COMPONENT "grc"
+)
+
+GR_PYTHON_INSTALL(FILES
+ blks2/__init__.py
+ blks2/error_rate.py
+ blks2/packet.py
+ blks2/selector.py
+ blks2/tcp.py
+ DESTINATION ${GR_PYTHON_DIR}/grc_gnuradio/blks2
+ COMPONENT "grc"
+)
diff --git a/grc/grc_gnuradio/README b/grc/grc_gnuradio/README
new file mode 100644
index 000000000..897eed65c
--- /dev/null
+++ b/grc/grc_gnuradio/README
@@ -0,0 +1,11 @@
+This is the grc_gnuradio module.
+It contains supplemental python modules that grc uses at runtime.
+The supplemental modules are meant to mimic modules in gnuradio.
+These will be phased-out as new functionaility is merged into gnuradio.
+
+The blk2s module wraps many blocks in blks2 and gives them streaming outputs.
+Will be phased-out by new message passing implementations.
+Other blks2 blocks will hopefully make their way into blks2impl.
+
+The wxgui module contains a top_block + wxgui frame.
+Will be phased-out by gui.py in wxgui and a new top block template.
diff --git a/grc/grc_gnuradio/__init__.py b/grc/grc_gnuradio/__init__.py
new file mode 100644
index 000000000..8b1378917
--- /dev/null
+++ b/grc/grc_gnuradio/__init__.py
@@ -0,0 +1 @@
+
diff --git a/grc/grc_gnuradio/blks2/__init__.py b/grc/grc_gnuradio/blks2/__init__.py
new file mode 100644
index 000000000..fde76f256
--- /dev/null
+++ b/grc/grc_gnuradio/blks2/__init__.py
@@ -0,0 +1,26 @@
+# Copyright 2008-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.
+#
+
+from selector import selector, valve
+from packet import options, packet_encoder, packet_decoder, \
+ packet_mod_b, packet_mod_s, packet_mod_i, packet_mod_f, packet_mod_c, \
+ packet_demod_b, packet_demod_s, packet_demod_i, packet_demod_f, packet_demod_c
+from error_rate import error_rate
+from tcp import tcp_source, tcp_sink
diff --git a/grc/grc_gnuradio/blks2/error_rate.py b/grc/grc_gnuradio/blks2/error_rate.py
new file mode 100644
index 000000000..9b2df58ef
--- /dev/null
+++ b/grc/grc_gnuradio/blks2/error_rate.py
@@ -0,0 +1,137 @@
+# 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.
+#
+
+default_win_size = 1000
+
+from gnuradio import gr
+import gnuradio.gr.gr_threading as _threading
+import numpy
+
+#generate 1s counts array
+_1s_counts = [sum([1&(i>>j) for j in range(8)]) for i in range(2**8)]
+
+class input_watcher(_threading.Thread):
+ """
+ Read samples from the message queue and hand them to the callback.
+ """
+
+ def __init__(self, msgq, callback):
+ self._msgq = msgq
+ self._callback = callback
+ _threading.Thread.__init__(self)
+ self.setDaemon(1)
+ self.keep_running = True
+ self.start()
+
+ def run(self):
+ r = ''
+ while True:
+ msg = self._msgq.delete_head()
+ itemsize = int(msg.arg1())
+ nitems = int(msg.arg2())
+ s = r + msg.to_string()
+ i = (nitems-nitems%2)*itemsize
+ r = s[i:]
+ s = s[:i]
+ samples = numpy.fromstring(s, numpy.int8)
+ self._callback(samples)
+
+class error_rate(gr.hier_block2):
+ """
+ Sample the incoming data streams (byte) and calculate the bit or symbol error rate.
+ Write the running rate to the output data stream (float).
+ """
+
+ def __init__(self, type='BER', win_size=default_win_size, bits_per_symbol=2):
+ """
+ Error rate constructor.
+ @param type a string 'BER' or 'SER'
+ @param win_size the number of samples to calculate over
+ @param bits_per_symbol the number of information bits per symbol (BER only)
+ """
+ #init
+ gr.hier_block2.__init__(
+ self, 'error_rate',
+ gr.io_signature(2, 2, gr.sizeof_char),
+ gr.io_signature(1, 1, gr.sizeof_float),
+ )
+ assert type in ('BER', 'SER')
+ self._max_samples = win_size
+ self._bits_per_symbol = bits_per_symbol
+ #setup message queue
+ msg_source = gr.message_source(gr.sizeof_float, 1)
+ self._msgq_source = msg_source.msgq()
+ msgq_sink = gr.msg_queue(2)
+ msg_sink = gr.message_sink(gr.sizeof_char, msgq_sink, False) #False -> blocking
+ inter = gr.interleave(gr.sizeof_char)
+ #start thread
+ self._num_errs = 0
+ self._err_index = 0
+ self._num_samps = 0
+ self._err_array = numpy.zeros(self._max_samples, numpy.int8)
+ if type == 'BER':
+ input_watcher(msgq_sink, self._handler_ber)
+ elif type == 'SER':
+ input_watcher(msgq_sink, self._handler_ser)
+ #connect
+ self.connect(msg_source, self)
+ self.connect((self, 0), (inter, 0))
+ self.connect((self, 1), (inter, 1))
+ self.connect(inter, msg_sink)
+
+ def _handler_ber(self, samples):
+ num = len(samples)/2
+ arr = numpy.zeros(num, numpy.float32)
+ for i in range(num):
+ old_err = self._err_array[self._err_index]
+ #record error
+ self._err_array[self._err_index] = _1s_counts[samples[i*2] ^ samples[i*2 + 1]]
+ self._num_errs = self._num_errs + self._err_array[self._err_index] - old_err
+ #increment index
+ self._err_index = (self._err_index + 1)%self._max_samples
+ self._num_samps = min(self._num_samps + 1, self._max_samples)
+ #write sample
+ arr[i] = float(self._num_errs)/float(self._num_samps*self._bits_per_symbol)
+ #write message
+ msg = gr.message_from_string(arr.tostring(), 0, gr.sizeof_float, num)
+ self._msgq_source.insert_tail(msg)
+
+ def _handler_ser(self, samples):
+ num = len(samples)/2
+ arr = numpy.zeros(num, numpy.float32)
+ for i in range(num):
+ old_err = self._err_array[self._err_index]
+ #record error
+ ref = samples[i*2]
+ res = samples[i*2 + 1]
+ if ref == res:
+ self._err_array[self._err_index] = 0
+ else:
+ self._err_array[self._err_index] = 1
+ #update number of errors
+ self._num_errs = self._num_errs + self._err_array[self._err_index] - old_err
+ #increment index
+ self._err_index = (self._err_index + 1)%self._max_samples
+ self._num_samps = min(self._num_samps + 1, self._max_samples)
+ #write sample
+ arr[i] = float(self._num_errs)/float(self._num_samps)
+ #write message
+ msg = gr.message_from_string(arr.tostring(), 0, gr.sizeof_float, num)
+ self._msgq_source.insert_tail(msg)
diff --git a/grc/grc_gnuradio/blks2/packet.py b/grc/grc_gnuradio/blks2/packet.py
new file mode 100644
index 000000000..e39f55c84
--- /dev/null
+++ b/grc/grc_gnuradio/blks2/packet.py
@@ -0,0 +1,242 @@
+# Copyright 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 gnuradio import gr, digital
+from gnuradio.digital import packet_utils
+import gnuradio.gr.gr_threading as _threading
+
+##payload length in bytes
+DEFAULT_PAYLOAD_LEN = 512
+
+##how many messages in a queue
+DEFAULT_MSGQ_LIMIT = 2
+
+##threshold for unmaking packets
+DEFAULT_THRESHOLD = 12
+
+##################################################
+## Options Class for OFDM
+##################################################
+class options(object):
+ def __init__(self, **kwargs):
+ for key, value in kwargs.iteritems(): setattr(self, key, value)
+
+##################################################
+## Packet Encoder
+##################################################
+class _packet_encoder_thread(_threading.Thread):
+
+ def __init__(self, msgq, payload_length, send):
+ self._msgq = msgq
+ self._payload_length = payload_length
+ self._send = send
+ _threading.Thread.__init__(self)
+ self.setDaemon(1)
+ self.keep_running = True
+ self.start()
+
+ def run(self):
+ sample = '' #residual sample
+ while self.keep_running:
+ msg = self._msgq.delete_head() #blocking read of message queue
+ sample = sample + msg.to_string() #get the body of the msg as a string
+ while len(sample) >= self._payload_length:
+ payload = sample[:self._payload_length]
+ sample = sample[self._payload_length:]
+ self._send(payload)
+
+class packet_encoder(gr.hier_block2):
+ """
+ Hierarchical block for wrapping packet-based modulators.
+ """
+
+ def __init__(self, samples_per_symbol, bits_per_symbol, access_code='', pad_for_usrp=True):
+ """
+ packet_mod constructor.
+ @param samples_per_symbol number of samples per symbol
+ @param bits_per_symbol number of bits per symbol
+ @param access_code AKA sync vector
+ @param pad_for_usrp If true, packets are padded such that they end up a multiple of 128 samples
+ @param payload_length number of bytes in a data-stream slice
+ """
+ #setup parameters
+ self._samples_per_symbol = samples_per_symbol
+ self._bits_per_symbol = bits_per_symbol
+ self._pad_for_usrp = pad_for_usrp
+ if not access_code: #get access code
+ access_code = packet_utils.default_access_code
+ if not packet_utils.is_1_0_string(access_code):
+ raise ValueError, "Invalid access_code %r. Must be string of 1's and 0's" % (access_code,)
+ self._access_code = access_code
+ self._pad_for_usrp = pad_for_usrp
+ #create blocks
+ msg_source = gr.message_source(gr.sizeof_char, DEFAULT_MSGQ_LIMIT)
+ self._msgq_out = msg_source.msgq()
+ #initialize hier2
+ gr.hier_block2.__init__(
+ self,
+ "packet_encoder",
+ gr.io_signature(0, 0, 0), # Input signature
+ gr.io_signature(1, 1, gr.sizeof_char) # Output signature
+ )
+ #connect
+ self.connect(msg_source, self)
+
+ def send_pkt(self, payload):
+ """
+ Wrap the payload in a packet and push onto the message queue.
+ @param payload string, data to send
+ """
+ packet = packet_utils.make_packet(
+ payload,
+ self._samples_per_symbol,
+ self._bits_per_symbol,
+ self._access_code,
+ self._pad_for_usrp
+ )
+ msg = gr.message_from_string(packet)
+ self._msgq_out.insert_tail(msg)
+
+##################################################
+## Packet Decoder
+##################################################
+class _packet_decoder_thread(_threading.Thread):
+
+ def __init__(self, msgq, callback):
+ _threading.Thread.__init__(self)
+ self.setDaemon(1)
+ self._msgq = msgq
+ self.callback = callback
+ self.keep_running = True
+ self.start()
+
+ def run(self):
+ while self.keep_running:
+ msg = self._msgq.delete_head()
+ ok, payload = packet_utils.unmake_packet(msg.to_string(), int(msg.arg1()))
+ if self.callback:
+ self.callback(ok, payload)
+
+class packet_decoder(gr.hier_block2):
+ """
+ Hierarchical block for wrapping packet-based demodulators.
+ """
+
+ def __init__(self, access_code='', threshold=-1, callback=None):
+ """
+ packet_demod constructor.
+ @param access_code AKA sync vector
+ @param threshold detect access_code with up to threshold bits wrong (0 -> use default)
+ @param callback a function of args: ok, payload
+ """
+ #access code
+ if not access_code: #get access code
+ access_code = packet_utils.default_access_code
+ if not packet_utils.is_1_0_string(access_code):
+ raise ValueError, "Invalid access_code %r. Must be string of 1's and 0's" % (access_code,)
+ self._access_code = access_code
+ #threshold
+ if threshold < 0: threshold = DEFAULT_THRESHOLD
+ self._threshold = threshold
+ #blocks
+ msgq = gr.msg_queue(DEFAULT_MSGQ_LIMIT) #holds packets from the PHY
+ correlator = digital.correlate_access_code_bb(self._access_code, self._threshold)
+ framer_sink = gr.framer_sink_1(msgq)
+ #initialize hier2
+ gr.hier_block2.__init__(
+ self,
+ "packet_decoder",
+ gr.io_signature(1, 1, gr.sizeof_char), # Input signature
+ gr.io_signature(0, 0, 0) # Output signature
+ )
+ #connect
+ self.connect(self, correlator, framer_sink)
+ #start thread
+ _packet_decoder_thread(msgq, callback)
+
+##################################################
+## Packet Mod for OFDM Mod and Packet Encoder
+##################################################
+class packet_mod_base(gr.hier_block2):
+ """
+ Hierarchical block for wrapping packet source block.
+ """
+
+ def __init__(self, packet_source=None, payload_length=0):
+ if not payload_length: #get payload length
+ payload_length = DEFAULT_PAYLOAD_LEN
+ if payload_length%self._item_size_in != 0: #verify that packet length is a multiple of the stream size
+ raise ValueError, 'The payload length: "%d" is not a mutiple of the stream size: "%d".'%(payload_length, self._item_size_in)
+ #initialize hier2
+ gr.hier_block2.__init__(
+ self,
+ "ofdm_mod",
+ gr.io_signature(1, 1, self._item_size_in), # Input signature
+ gr.io_signature(1, 1, packet_source._hb.output_signature().sizeof_stream_item(0)) # Output signature
+ )
+ #create blocks
+ msgq = gr.msg_queue(DEFAULT_MSGQ_LIMIT)
+ msg_sink = gr.message_sink(self._item_size_in, msgq, False) #False -> blocking
+ #connect
+ self.connect(self, msg_sink)
+ self.connect(packet_source, self)
+ #start thread
+ _packet_encoder_thread(msgq, payload_length, packet_source.send_pkt)
+
+class packet_mod_b(packet_mod_base): _item_size_in = gr.sizeof_char
+class packet_mod_s(packet_mod_base): _item_size_in = gr.sizeof_short
+class packet_mod_i(packet_mod_base): _item_size_in = gr.sizeof_int
+class packet_mod_f(packet_mod_base): _item_size_in = gr.sizeof_float
+class packet_mod_c(packet_mod_base): _item_size_in = gr.sizeof_gr_complex
+
+##################################################
+## Packet Demod for OFDM Demod and Packet Decoder
+##################################################
+class packet_demod_base(gr.hier_block2):
+ """
+ Hierarchical block for wrapping packet sink block.
+ """
+
+ def __init__(self, packet_sink=None):
+ #initialize hier2
+ gr.hier_block2.__init__(
+ self,
+ "ofdm_mod",
+ gr.io_signature(1, 1, packet_sink._hb.input_signature().sizeof_stream_item(0)), # Input signature
+ gr.io_signature(1, 1, self._item_size_out) # Output signature
+ )
+ #create blocks
+ msg_source = gr.message_source(self._item_size_out, DEFAULT_MSGQ_LIMIT)
+ self._msgq_out = msg_source.msgq()
+ #connect
+ self.connect(self, packet_sink)
+ self.connect(msg_source, self)
+ if packet_sink._hb.output_signature().sizeof_stream_item(0):
+ self.connect(packet_sink, gr.null_sink(packet_sink._hb.output_signature().sizeof_stream_item(0)))
+
+ def recv_pkt(self, ok, payload):
+ msg = gr.message_from_string(payload, 0, self._item_size_out, len(payload)/self._item_size_out)
+ if ok: self._msgq_out.insert_tail(msg)
+
+class packet_demod_b(packet_demod_base): _item_size_out = gr.sizeof_char
+class packet_demod_s(packet_demod_base): _item_size_out = gr.sizeof_short
+class packet_demod_i(packet_demod_base): _item_size_out = gr.sizeof_int
+class packet_demod_f(packet_demod_base): _item_size_out = gr.sizeof_float
+class packet_demod_c(packet_demod_base): _item_size_out = gr.sizeof_gr_complex
diff --git a/grc/grc_gnuradio/blks2/selector.py b/grc/grc_gnuradio/blks2/selector.py
new file mode 100644
index 000000000..f0f6d5dd7
--- /dev/null
+++ b/grc/grc_gnuradio/blks2/selector.py
@@ -0,0 +1,128 @@
+#
+# 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.
+#
+
+from gnuradio import gr
+
+class selector(gr.hier_block2):
+ """A hier2 block with N inputs and M outputs, where data is only forwarded through input n to output m."""
+ def __init__(self, item_size, num_inputs, num_outputs, input_index, output_index):
+ """
+ Selector constructor.
+ @param item_size the size of the gr data stream in bytes
+ @param num_inputs the number of inputs (integer)
+ @param num_outputs the number of outputs (integer)
+ @param input_index the index for the source data
+ @param output_index the index for the destination data
+ """
+ gr.hier_block2.__init__(
+ self, 'selector',
+ gr.io_signature(num_inputs, num_inputs, item_size),
+ gr.io_signature(num_outputs, num_outputs, item_size),
+ )
+ #terminator blocks for unused inputs and outputs
+ self.input_terminators = [gr.null_sink(item_size) for i in range(num_inputs)]
+ self.output_terminators = [gr.head(item_size, 0) for i in range(num_outputs)]
+ self.copy = gr.kludge_copy(item_size)
+ #connections
+ for i in range(num_inputs): self.connect((self, i), self.input_terminators[i])
+ for i in range(num_outputs): self.connect(gr.null_source(item_size), self.output_terminators[i], (self, i))
+ self.item_size = item_size
+ self.input_index = input_index
+ self.output_index = output_index
+ self.num_inputs = num_inputs
+ self.num_outputs = num_outputs
+ self._connect_current()
+
+ def _indexes_valid(self):
+ """
+ Are the input and output indexes within range of the number of inputs and outputs?
+ @return true if input index and output index are in range
+ """
+ return self.input_index in range(self.num_inputs) and self.output_index in range(self.num_outputs)
+
+ def _connect_current(self):
+ """If the input and output indexes are valid:
+ disconnect the blocks at the input and output index from their terminators,
+ and connect them to one another. Then connect the terminators to one another."""
+ if self._indexes_valid():
+ self.disconnect((self, self.input_index), self.input_terminators[self.input_index])
+ self.disconnect(self.output_terminators[self.output_index], (self, self.output_index))
+ self.connect((self, self.input_index), self.copy)
+ self.connect(self.copy, (self, self.output_index))
+ self.connect(self.output_terminators[self.output_index], self.input_terminators[self.input_index])
+
+ def _disconnect_current(self):
+ """If the input and output indexes are valid:
+ disconnect the blocks at the input and output index from one another,
+ and the terminators at the input and output index from one another.
+ Reconnect the blocks to the terminators."""
+ if self._indexes_valid():
+ self.disconnect((self, self.input_index), self.copy)
+ self.disconnect(self.copy, (self, self.output_index))
+ self.disconnect(self.output_terminators[self.output_index], self.input_terminators[self.input_index])
+ self.connect((self, self.input_index), self.input_terminators[self.input_index])
+ self.connect(self.output_terminators[self.output_index], (self, self.output_index))
+
+ def set_input_index(self, input_index):
+ """
+ Change the block to the new input index if the index changed.
+ @param input_index the new input index
+ """
+ if self.input_index != input_index:
+ self.lock()
+ self._disconnect_current()
+ self.input_index = input_index
+ self._connect_current()
+ self.unlock()
+
+ def set_output_index(self, output_index):
+ """
+ Change the block to the new output index if the index changed.
+ @param output_index the new output index
+ """
+ if self.output_index != output_index:
+ self.lock()
+ self._disconnect_current()
+ self.output_index = output_index
+ self._connect_current()
+ self.unlock()
+
+class valve(selector):
+ """Wrapper for selector with 1 input and 1 output."""
+
+ def __init__(self, item_size, open):
+ """
+ Constructor for valve.
+ @param item_size the size of the gr data stream in bytes
+ @param open true if initial valve state is open
+ """
+ if open: output_index = -1
+ else: output_index = 0
+ selector.__init__(self, item_size, 1, 1, 0, output_index)
+
+ def set_open(self, open):
+ """
+ Callback to set open state.
+ @param open true to set valve state to open
+ """
+ if open: output_index = -1
+ else: output_index = 0
+ self.set_output_index(output_index)
diff --git a/grc/grc_gnuradio/blks2/tcp.py b/grc/grc_gnuradio/blks2/tcp.py
new file mode 100644
index 000000000..c6739b711
--- /dev/null
+++ b/grc/grc_gnuradio/blks2/tcp.py
@@ -0,0 +1,66 @@
+#
+# 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.
+#
+
+from gnuradio import gr
+import socket
+import os
+
+def _get_sock_fd(addr, port, server):
+ """
+ Get the file descriptor for the socket.
+ As a client, block on connect, dup the socket descriptor.
+ As a server, block on accept, dup the client descriptor.
+ @param addr the ip address string
+ @param port the tcp port number
+ @param server true for server mode, false for client mode
+ @return the file descriptor number
+ """
+ sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+ if server:
+ sock.bind((addr, port))
+ sock.listen(1)
+ clientsock, address = sock.accept()
+ return os.dup(clientsock.fileno())
+ else:
+ sock.connect((addr, port))
+ return os.dup(sock.fileno())
+
+class tcp_source(gr.hier_block2):
+ def __init__(self, itemsize, addr, port, server=True):
+ #init hier block
+ gr.hier_block2.__init__(
+ self, 'tcp_source',
+ gr.io_signature(0, 0, 0),
+ gr.io_signature(1, 1, itemsize),
+ )
+ fd = _get_sock_fd(addr, port, server)
+ self.connect(gr.file_descriptor_source(itemsize, fd), self)
+
+class tcp_sink(gr.hier_block2):
+ def __init__(self, itemsize, addr, port, server=False):
+ #init hier block
+ gr.hier_block2.__init__(
+ self, 'tcp_sink',
+ gr.io_signature(1, 1, itemsize),
+ gr.io_signature(0, 0, 0),
+ )
+ fd = _get_sock_fd(addr, port, server)
+ self.connect(self, gr.file_descriptor_sink(itemsize, fd))
diff --git a/grc/gui/ActionHandler.py b/grc/gui/ActionHandler.py
new file mode 100644
index 000000000..9fb5e4ebf
--- /dev/null
+++ b/grc/gui/ActionHandler.py
@@ -0,0 +1,530 @@
+"""
+Copyright 2007-2011 Free Software Foundation, Inc.
+This file is part of GNU Radio
+
+GNU Radio Companion 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 2
+of the License, or (at your option) any later version.
+
+GNU Radio Companion 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 this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+"""
+
+import os
+import signal
+from Constants import IMAGE_FILE_EXTENSION
+import Actions
+import pygtk
+pygtk.require('2.0')
+import gtk
+import gobject
+import Preferences
+from threading import Thread
+import Messages
+from .. base import ParseXML
+from MainWindow import MainWindow
+from PropsDialog import PropsDialog
+import Dialogs
+from FileDialogs import OpenFlowGraphFileDialog, SaveFlowGraphFileDialog, SaveImageFileDialog
+
+gobject.threads_init()
+
+class ActionHandler:
+ """
+ The action handler will setup all the major window components,
+ and handle button presses and flow graph operations from the GUI.
+ """
+
+ def __init__(self, file_paths, platform):
+ """
+ ActionHandler constructor.
+ Create the main window, setup the message handler, import the preferences,
+ and connect all of the action handlers. Finally, enter the gtk main loop and block.
+ @param file_paths a list of flow graph file passed from command line
+ @param platform platform module
+ """
+ self.clipboard = None
+ for action in Actions.get_all_actions(): action.connect('activate', self._handle_action)
+ #setup the main window
+ self.platform = platform;
+ self.main_window = MainWindow(platform)
+ self.main_window.connect('delete-event', self._quit)
+ self.main_window.connect('key-press-event', self._handle_key_press)
+ self.get_page = self.main_window.get_page
+ self.get_flow_graph = self.main_window.get_flow_graph
+ self.get_focus_flag = self.main_window.get_focus_flag
+ #setup the messages
+ Messages.register_messenger(self.main_window.add_report_line)
+ Messages.send_init(platform)
+ #initialize
+ self.init_file_paths = file_paths
+ Actions.APPLICATION_INITIALIZE()
+ #enter the mainloop
+ gtk.main()
+
+ def _handle_key_press(self, widget, event):
+ """
+ Handle key presses from the keyboard and translate key combinations into actions.
+ This key press handler is called prior to the gtk key press handler.
+ This handler bypasses built in accelerator key handling when in focus because
+ * some keys are ignored by the accelerators like the direction keys,
+ * some keys are not registered to any accelerators but are still used.
+ When not in focus, gtk and the accelerators handle the the key press.
+ @return false to let gtk handle the key action
+ """
+ if not self.get_focus_flag(): return False
+ return Actions.handle_key_press(event)
+
+ def _quit(self, window, event):
+ """
+ Handle the delete event from the main window.
+ Generated by pressing X to close, alt+f4, or right click+close.
+ This method in turns calls the state handler to quit.
+ @return true
+ """
+ Actions.APPLICATION_QUIT()
+ return True
+
+ def _handle_action(self, action):
+ #print action
+ ##################################################
+ # Initalize/Quit
+ ##################################################
+ if action == Actions.APPLICATION_INITIALIZE:
+ for action in Actions.get_all_actions(): action.set_sensitive(False) #set all actions disabled
+ #enable a select few actions
+ for action in (
+ Actions.APPLICATION_QUIT, Actions.FLOW_GRAPH_NEW,
+ Actions.FLOW_GRAPH_OPEN, Actions.FLOW_GRAPH_SAVE_AS,
+ Actions.FLOW_GRAPH_CLOSE, Actions.ABOUT_WINDOW_DISPLAY,
+ Actions.FLOW_GRAPH_SCREEN_CAPTURE, Actions.HELP_WINDOW_DISPLAY,
+ Actions.TYPES_WINDOW_DISPLAY,
+ ): action.set_sensitive(True)
+ if not self.init_file_paths:
+ self.init_file_paths = Preferences.files_open()
+ if not self.init_file_paths: self.init_file_paths = ['']
+ for file_path in self.init_file_paths:
+ if file_path: self.main_window.new_page(file_path) #load pages from file paths
+ if Preferences.file_open() in self.init_file_paths:
+ self.main_window.new_page(Preferences.file_open(), show=True)
+ if not self.get_page(): self.main_window.new_page() #ensure that at least a blank page exists
+ elif action == Actions.APPLICATION_QUIT:
+ if self.main_window.close_pages():
+ gtk.main_quit()
+ exit(0)
+ ##################################################
+ # Selections
+ ##################################################
+ elif action == Actions.ELEMENT_SELECT:
+ pass #do nothing, update routines below
+ elif action == Actions.NOTHING_SELECT:
+ self.get_flow_graph().unselect()
+ ##################################################
+ # Enable/Disable
+ ##################################################
+ elif action == Actions.BLOCK_ENABLE:
+ if self.get_flow_graph().enable_selected(True):
+ self.get_flow_graph().update()
+ self.get_page().get_state_cache().save_new_state(self.get_flow_graph().export_data())
+ self.get_page().set_saved(False)
+ elif action == Actions.BLOCK_DISABLE:
+ if self.get_flow_graph().enable_selected(False):
+ self.get_flow_graph().update()
+ self.get_page().get_state_cache().save_new_state(self.get_flow_graph().export_data())
+ self.get_page().set_saved(False)
+ ##################################################
+ # Cut/Copy/Paste
+ ##################################################
+ elif action == Actions.BLOCK_CUT:
+ Actions.BLOCK_COPY()
+ Actions.ELEMENT_DELETE()
+ elif action == Actions.BLOCK_COPY:
+ self.clipboard = self.get_flow_graph().copy_to_clipboard()
+ elif action == Actions.BLOCK_PASTE:
+ if self.clipboard:
+ self.get_flow_graph().paste_from_clipboard(self.clipboard)
+ self.get_flow_graph().update()
+ self.get_page().get_state_cache().save_new_state(self.get_flow_graph().export_data())
+ self.get_page().set_saved(False)
+ ##################################################
+ # Create heir block
+ ##################################################
+ elif action == Actions.BLOCK_CREATE_HIER:
+
+ # keeping track of coordinates for pasting later
+ coords = self.get_flow_graph().get_selected_blocks()[0].get_coordinate()
+ x,y = coords
+ x_min = x
+ y_min = y
+
+ pads = [];
+ params = [];
+
+ # Save the state of the leaf blocks
+ for block in self.get_flow_graph().get_selected_blocks():
+
+ # Check for string variables within the blocks
+ for param in block.get_params():
+ for variable in self.get_flow_graph().get_variables():
+ # If a block parameter exists that is a variable, create a parameter for it
+ if param.get_value() == variable.get_id():
+ params.append(param.get_value())
+ for flow_param in self.get_flow_graph().get_parameters():
+ # If a block parameter exists that is a parameter, create a parameter for it
+ if param.get_value() == flow_param.get_id():
+ params.append(param.get_value())
+
+
+ # keep track of x,y mins for pasting later
+ (x,y) = block.get_coordinate()
+ if x < x_min:
+ x_min = x
+ if y < y_min:
+ y_min = y
+
+ for connection in block.get_connections():
+
+ # Get id of connected blocks
+ source_id = connection.get_source().get_parent().get_id()
+ sink_id = connection.get_sink().get_parent().get_id()
+
+ # If connected block is not in the list of selected blocks create a pad for it
+ if self.get_flow_graph().get_block(source_id) not in self.get_flow_graph().get_selected_blocks():
+ pads.append({'key': connection.get_sink().get_key(), 'coord': connection.get_source().get_coordinate(), 'block_id' : block.get_id(), 'direction': 'source'})
+
+ if self.get_flow_graph().get_block(sink_id) not in self.get_flow_graph().get_selected_blocks():
+ pads.append({'key': connection.get_source().get_key(), 'coord': connection.get_sink().get_coordinate(), 'block_id' : block.get_id(), 'direction': 'sink'})
+
+
+ # Copy the selected blocks and paste them into a new page
+ # then move the flowgraph to a reasonable position
+ Actions.BLOCK_COPY()
+ self.main_window.new_page()
+ Actions.BLOCK_PASTE()
+ coords = (x_min,y_min)
+ self.get_flow_graph().move_selected(coords)
+
+
+ # Set flow graph to heir block type
+ top_block = self.get_flow_graph().get_block("top_block")
+ top_block.get_param('generate_options').set_value('hb')
+
+ # this needs to be a unique name
+ top_block.get_param('id').set_value('new_heir')
+
+ # Remove the default samp_rate variable block that is created
+ remove_me = self.get_flow_graph().get_block("samp_rate")
+ self.get_flow_graph().remove_element(remove_me)
+
+
+ # Add the param blocks along the top of the window
+ x_pos = 150
+ for param in params:
+ param_id = self.get_flow_graph().add_new_block('parameter',(x_pos,10))
+ param_block = self.get_flow_graph().get_block(param_id)
+ param_block.get_param('id').set_value(param)
+ x_pos = x_pos + 100
+
+ for pad in pads:
+ # Add the pad sources and sinks within the new heir block
+ if pad['direction'] == 'sink':
+
+ # Add new PAD_SINK block to the canvas
+ pad_id = self.get_flow_graph().add_new_block('pad_sink', pad['coord'])
+
+ # setup the references to the sink and source
+ pad_block = self.get_flow_graph().get_block(pad_id)
+ pad_sink = pad_block.get_sinks()[0]
+
+ source_block = self.get_flow_graph().get_block(pad['block_id'])
+ source = source_block.get_source(pad['key'])
+
+ # Ensure the port types match
+ while pad_sink.get_type() != source.get_type():
+
+ # Special case for some blocks that have non-standard type names, e.g. uhd
+ if pad_sink.get_type() == 'complex' and source.get_type() == 'fc32':
+ break;
+ pad_block.type_controller_modify(1)
+
+ # Connect the pad to the proper sinks
+ new_connection = self.get_flow_graph().connect(source,pad_sink)
+
+ elif pad['direction'] == 'source':
+ pad_id = self.get_flow_graph().add_new_block('pad_source', pad['coord'])
+
+ # setup the references to the sink and source
+ pad_block = self.get_flow_graph().get_block(pad_id)
+ pad_source = pad_block.get_sources()[0]
+
+ sink_block = self.get_flow_graph().get_block(pad['block_id'])
+ sink = sink_block.get_sink(pad['key'])
+
+ # Ensure the port types match
+ while sink.get_type() != pad_source.get_type():
+ # Special case for some blocks that have non-standard type names, e.g. uhd
+ if pad_source.get_type() == 'complex' and sink.get_type() == 'fc32':
+ break;
+ pad_block.type_controller_modify(1)
+
+ # Connect the pad to the proper sinks
+ new_connection = self.get_flow_graph().connect(pad_source,sink)
+
+ # update the new heir block flow graph
+ self.get_flow_graph().update()
+
+
+ ##################################################
+ # Move/Rotate/Delete/Create
+ ##################################################
+ elif action == Actions.BLOCK_MOVE:
+ self.get_page().get_state_cache().save_new_state(self.get_flow_graph().export_data())
+ self.get_page().set_saved(False)
+ elif action == Actions.BLOCK_ROTATE_CCW:
+ if self.get_flow_graph().rotate_selected(90):
+ self.get_flow_graph().update()
+ self.get_page().get_state_cache().save_new_state(self.get_flow_graph().export_data())
+ self.get_page().set_saved(False)
+ elif action == Actions.BLOCK_ROTATE_CW:
+ if self.get_flow_graph().rotate_selected(-90):
+ self.get_flow_graph().update()
+ self.get_page().get_state_cache().save_new_state(self.get_flow_graph().export_data())
+ self.get_page().set_saved(False)
+ elif action == Actions.ELEMENT_DELETE:
+ if self.get_flow_graph().remove_selected():
+ self.get_flow_graph().update()
+ self.get_page().get_state_cache().save_new_state(self.get_flow_graph().export_data())
+ Actions.NOTHING_SELECT()
+ self.get_page().set_saved(False)
+ elif action == Actions.ELEMENT_CREATE:
+ self.get_flow_graph().update()
+ self.get_page().get_state_cache().save_new_state(self.get_flow_graph().export_data())
+ Actions.NOTHING_SELECT()
+ self.get_page().set_saved(False)
+ elif action == Actions.BLOCK_INC_TYPE:
+ if self.get_flow_graph().type_controller_modify_selected(1):
+ self.get_flow_graph().update()
+ self.get_page().get_state_cache().save_new_state(self.get_flow_graph().export_data())
+ self.get_page().set_saved(False)
+ elif action == Actions.BLOCK_DEC_TYPE:
+ if self.get_flow_graph().type_controller_modify_selected(-1):
+ self.get_flow_graph().update()
+ self.get_page().get_state_cache().save_new_state(self.get_flow_graph().export_data())
+ self.get_page().set_saved(False)
+ elif action == Actions.PORT_CONTROLLER_INC:
+ if self.get_flow_graph().port_controller_modify_selected(1):
+ self.get_flow_graph().update()
+ self.get_page().get_state_cache().save_new_state(self.get_flow_graph().export_data())
+ self.get_page().set_saved(False)
+ elif action == Actions.PORT_CONTROLLER_DEC:
+ if self.get_flow_graph().port_controller_modify_selected(-1):
+ self.get_flow_graph().update()
+ self.get_page().get_state_cache().save_new_state(self.get_flow_graph().export_data())
+ self.get_page().set_saved(False)
+ ##################################################
+ # Window stuff
+ ##################################################
+ elif action == Actions.ABOUT_WINDOW_DISPLAY:
+ Dialogs.AboutDialog(self.get_flow_graph().get_parent())
+ elif action == Actions.HELP_WINDOW_DISPLAY:
+ Dialogs.HelpDialog()
+ elif action == Actions.TYPES_WINDOW_DISPLAY:
+ Dialogs.TypesDialog(self.get_flow_graph().get_parent())
+ elif action == Actions.ERRORS_WINDOW_DISPLAY:
+ Dialogs.ErrorsDialog(self.get_flow_graph())
+ ##################################################
+ # Param Modifications
+ ##################################################
+ elif action == Actions.BLOCK_PARAM_MODIFY:
+ selected_block = self.get_flow_graph().get_selected_block()
+ if selected_block:
+ if PropsDialog(selected_block).run():
+ #save the new state
+ self.get_flow_graph().update()
+ self.get_page().get_state_cache().save_new_state(self.get_flow_graph().export_data())
+ self.get_page().set_saved(False)
+ else:
+ #restore the current state
+ n = self.get_page().get_state_cache().get_current_state()
+ self.get_flow_graph().import_data(n)
+ self.get_flow_graph().update()
+ ##################################################
+ # Undo/Redo
+ ##################################################
+ elif action == Actions.FLOW_GRAPH_UNDO:
+ n = self.get_page().get_state_cache().get_prev_state()
+ if n:
+ self.get_flow_graph().unselect()
+ self.get_flow_graph().import_data(n)
+ self.get_flow_graph().update()
+ self.get_page().set_saved(False)
+ elif action == Actions.FLOW_GRAPH_REDO:
+ n = self.get_page().get_state_cache().get_next_state()
+ if n:
+ self.get_flow_graph().unselect()
+ self.get_flow_graph().import_data(n)
+ self.get_flow_graph().update()
+ self.get_page().set_saved(False)
+ ##################################################
+ # New/Open/Save/Close
+ ##################################################
+ elif action == Actions.FLOW_GRAPH_NEW:
+ self.main_window.new_page()
+ elif action == Actions.FLOW_GRAPH_OPEN:
+ file_paths = OpenFlowGraphFileDialog(self.get_page().get_file_path()).run()
+ if file_paths: #open a new page for each file, show only the first
+ for i,file_path in enumerate(file_paths):
+ self.main_window.new_page(file_path, show=(i==0))
+ elif action == Actions.FLOW_GRAPH_CLOSE:
+ self.main_window.close_page()
+ elif action == Actions.FLOW_GRAPH_SAVE:
+ #read-only or undefined file path, do save-as
+ if self.get_page().get_read_only() or not self.get_page().get_file_path():
+ Actions.FLOW_GRAPH_SAVE_AS()
+ #otherwise try to save
+ else:
+ try:
+ ParseXML.to_file(self.get_flow_graph().export_data(), self.get_page().get_file_path())
+ self.get_flow_graph().grc_file_path = self.get_page().get_file_path()
+ self.get_page().set_saved(True)
+ except IOError:
+ Messages.send_fail_save(self.get_page().get_file_path())
+ self.get_page().set_saved(False)
+ elif action == Actions.FLOW_GRAPH_SAVE_AS:
+ file_path = SaveFlowGraphFileDialog(self.get_page().get_file_path()).run()
+ if file_path is not None:
+ self.get_page().set_file_path(file_path)
+ Actions.FLOW_GRAPH_SAVE()
+ elif action == Actions.FLOW_GRAPH_SCREEN_CAPTURE:
+ file_path = SaveImageFileDialog(self.get_page().get_file_path()).run()
+ if file_path is not None:
+ pixbuf = self.get_flow_graph().get_drawing_area().get_pixbuf()
+ pixbuf.save(file_path, IMAGE_FILE_EXTENSION[1:])
+ ##################################################
+ # Gen/Exec/Stop
+ ##################################################
+ elif action == Actions.FLOW_GRAPH_GEN:
+ if not self.get_page().get_proc():
+ if not self.get_page().get_saved() or not self.get_page().get_file_path():
+ Actions.FLOW_GRAPH_SAVE() #only save if file path missing or not saved
+ if self.get_page().get_saved() and self.get_page().get_file_path():
+ generator = self.get_page().get_generator()
+ try:
+ Messages.send_start_gen(generator.get_file_path())
+ generator.write()
+ except Exception,e: Messages.send_fail_gen(e)
+ else: self.generator = None
+ elif action == Actions.FLOW_GRAPH_EXEC:
+ if not self.get_page().get_proc():
+ Actions.FLOW_GRAPH_GEN()
+ if self.get_page().get_saved() and self.get_page().get_file_path():
+ ExecFlowGraphThread(self)
+ elif action == Actions.FLOW_GRAPH_KILL:
+ if self.get_page().get_proc():
+ try: self.get_page().get_proc().kill()
+ except: print "could not kill process: %d"%self.get_page().get_proc().pid
+ elif action == Actions.PAGE_CHANGE: #pass and run the global actions
+ pass
+ elif action == Actions.RELOAD_BLOCKS:
+ self.platform.loadblocks()
+ self.main_window.btwin.clear();
+ self.platform.load_block_tree(self.main_window.btwin);
+ elif action == Actions.OPEN_HIER:
+ bn = [];
+ for b in self.get_flow_graph().get_selected_blocks():
+ if b._grc_source:
+ self.main_window.new_page(b._grc_source, show=True);
+ else: print '!!! Action "%s" not handled !!!'%action
+ ##################################################
+ # Global Actions for all States
+ ##################################################
+ #update general buttons
+ Actions.ERRORS_WINDOW_DISPLAY.set_sensitive(not self.get_flow_graph().is_valid())
+ Actions.ELEMENT_DELETE.set_sensitive(bool(self.get_flow_graph().get_selected_elements()))
+ Actions.BLOCK_PARAM_MODIFY.set_sensitive(bool(self.get_flow_graph().get_selected_block()))
+ Actions.BLOCK_ROTATE_CCW.set_sensitive(bool(self.get_flow_graph().get_selected_blocks()))
+ Actions.BLOCK_ROTATE_CW.set_sensitive(bool(self.get_flow_graph().get_selected_blocks()))
+ #update cut/copy/paste
+ Actions.BLOCK_CUT.set_sensitive(bool(self.get_flow_graph().get_selected_blocks()))
+ Actions.BLOCK_COPY.set_sensitive(bool(self.get_flow_graph().get_selected_blocks()))
+ Actions.BLOCK_PASTE.set_sensitive(bool(self.clipboard))
+ #update enable/disable
+ Actions.BLOCK_ENABLE.set_sensitive(bool(self.get_flow_graph().get_selected_blocks()))
+ Actions.BLOCK_DISABLE.set_sensitive(bool(self.get_flow_graph().get_selected_blocks()))
+ Actions.BLOCK_CREATE_HIER.set_sensitive(bool(self.get_flow_graph().get_selected_blocks()))
+ Actions.OPEN_HIER.set_sensitive(bool(self.get_flow_graph().get_selected_blocks()))
+ Actions.RELOAD_BLOCKS.set_sensitive(True)
+ #set the exec and stop buttons
+ self.update_exec_stop()
+ #saved status
+ Actions.FLOW_GRAPH_SAVE.set_sensitive(not self.get_page().get_saved())
+ self.main_window.update()
+ try: #set the size of the flow graph area (if changed)
+ new_size = self.get_flow_graph().get_option('window_size')
+ if self.get_flow_graph().get_size() != tuple(new_size):
+ self.get_flow_graph().set_size(*new_size)
+ except: pass
+ #draw the flow graph
+ self.get_flow_graph().update_selected()
+ self.get_flow_graph().queue_draw()
+ return True #action was handled
+
+ def update_exec_stop(self):
+ """
+ Update the exec and stop buttons.
+ Lock and unlock the mutex for race conditions with exec flow graph threads.
+ """
+ sensitive = self.get_flow_graph().is_valid() and not self.get_page().get_proc()
+ Actions.FLOW_GRAPH_GEN.set_sensitive(sensitive)
+ Actions.FLOW_GRAPH_EXEC.set_sensitive(sensitive)
+ Actions.FLOW_GRAPH_KILL.set_sensitive(self.get_page().get_proc() != None)
+
+class ExecFlowGraphThread(Thread):
+ """Execute the flow graph as a new process and wait on it to finish."""
+
+ def __init__ (self, action_handler):
+ """
+ ExecFlowGraphThread constructor.
+ @param action_handler an instance of an ActionHandler
+ """
+ Thread.__init__(self)
+ self.update_exec_stop = action_handler.update_exec_stop
+ self.flow_graph = action_handler.get_flow_graph()
+ #store page and dont use main window calls in run
+ self.page = action_handler.get_page()
+ Messages.send_start_exec(self.page.get_generator().get_file_path())
+ #get the popen
+ try:
+ self.p = self.page.get_generator().get_popen()
+ self.page.set_proc(self.p)
+ #update
+ self.update_exec_stop()
+ self.start()
+ except Exception, e:
+ Messages.send_verbose_exec(str(e))
+ Messages.send_end_exec()
+
+ def run(self):
+ """
+ Wait on the executing process by reading from its stdout.
+ Use gobject.idle_add when calling functions that modify gtk objects.
+ """
+ #handle completion
+ r = "\n"
+ while(r):
+ gobject.idle_add(Messages.send_verbose_exec, r)
+ r = os.read(self.p.stdout.fileno(), 1024)
+ gobject.idle_add(self.done)
+
+ def done(self):
+ """Perform end of execution tasks."""
+ Messages.send_end_exec()
+ self.page.set_proc(None)
+ self.update_exec_stop()
diff --git a/grc/gui/Actions.py b/grc/gui/Actions.py
new file mode 100644
index 000000000..fab026c5e
--- /dev/null
+++ b/grc/gui/Actions.py
@@ -0,0 +1,291 @@
+"""
+Copyright 2007-2011 Free Software Foundation, Inc.
+This file is part of GNU Radio
+
+GNU Radio Companion 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 2
+of the License, or (at your option) any later version.
+
+GNU Radio Companion 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 this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+"""
+
+import pygtk
+pygtk.require('2.0')
+import gtk
+
+NO_MODS_MASK = 0
+
+########################################################################
+# Actions API
+########################################################################
+_actions_keypress_dict = dict()
+_keymap = gtk.gdk.keymap_get_default()
+_used_mods_mask = NO_MODS_MASK
+def handle_key_press(event):
+ """
+ Call the action associated with the key press event.
+ Both the key value and the mask must have a match.
+ @param event a gtk key press event
+ @return true if handled
+ """
+ _used_mods_mask = reduce(lambda x, y: x | y, [mod_mask for keyval, mod_mask in _actions_keypress_dict], NO_MODS_MASK)
+ #extract the key value and the consumed modifiers
+ keyval, egroup, level, consumed = _keymap.translate_keyboard_state(
+ event.hardware_keycode, event.state, event.group)
+ #get the modifier mask and ignore irrelevant modifiers
+ mod_mask = event.state & ~consumed & _used_mods_mask
+ #look up the keypress and call the action
+ try: _actions_keypress_dict[(keyval, mod_mask)]()
+ except KeyError: return False #not handled
+ return True #handled here
+
+_all_actions_list = list()
+def get_all_actions(): return _all_actions_list
+
+_accel_group = gtk.AccelGroup()
+def get_accel_group(): return _accel_group
+
+class Action(gtk.Action):
+ """
+ A custom Action class based on gtk.Action.
+ Pass additional arguments such as keypresses.
+ Register actions and keypresses with this module.
+ """
+
+ def __init__(self, keypresses=(), name=None, label=None, tooltip=None, stock_id=None):
+ """
+ Create a new Action instance.
+ @param key_presses a tuple of (keyval1, mod_mask1, keyval2, mod_mask2, ...)
+ @param the regular gtk.Action parameters (defaults to None)
+ """
+ if name is None: name = label
+ gtk.Action.__init__(self,
+ name=name, label=label,
+ tooltip=tooltip, stock_id=stock_id,
+ )
+ #register this action
+ _all_actions_list.append(self)
+ for i in range(len(keypresses)/2):
+ keyval, mod_mask = keypresses[i*2:(i+1)*2]
+ #register this keypress
+ if _actions_keypress_dict.has_key((keyval, mod_mask)):
+ raise KeyError('keyval/mod_mask pair already registered "%s"'%str((keyval, mod_mask)))
+ _actions_keypress_dict[(keyval, mod_mask)] = self
+ #set the accelerator group, and accelerator path
+ #register the key name and mod mask with the accelerator path
+ if label is None: continue #dont register accel
+ accel_path = '<main>/'+self.get_name()
+ self.set_accel_group(get_accel_group())
+ self.set_accel_path(accel_path)
+ gtk.accel_map_add_entry(accel_path, keyval, mod_mask)
+
+ def __str__(self):
+ """
+ The string representation should be the name of the action id.
+ Try to find the action id for this action by searching this module.
+ """
+ try:
+ import Actions
+ return filter(lambda attr: getattr(Actions, attr) == self, dir(Actions))[0]
+ except: return self.get_name()
+
+ def __repr__(self): return str(self)
+
+ def __call__(self):
+ """
+ Emit the activate signal when called with ().
+ """
+ self.emit('activate')
+
+########################################################################
+# Actions
+########################################################################
+PAGE_CHANGE = Action()
+FLOW_GRAPH_NEW = Action(
+ label='_New',
+ tooltip='Create a new flow graph',
+ stock_id=gtk.STOCK_NEW,
+ keypresses=(gtk.keysyms.n, gtk.gdk.CONTROL_MASK),
+)
+FLOW_GRAPH_OPEN = Action(
+ label='_Open',
+ tooltip='Open an existing flow graph',
+ stock_id=gtk.STOCK_OPEN,
+ keypresses=(gtk.keysyms.o, gtk.gdk.CONTROL_MASK),
+)
+FLOW_GRAPH_SAVE = Action(
+ label='_Save',
+ tooltip='Save the current flow graph',
+ stock_id=gtk.STOCK_SAVE,
+ keypresses=(gtk.keysyms.s, gtk.gdk.CONTROL_MASK),
+)
+FLOW_GRAPH_SAVE_AS = Action(
+ label='Save _As',
+ tooltip='Save the current flow graph as...',
+ stock_id=gtk.STOCK_SAVE_AS,
+ keypresses=(gtk.keysyms.s, gtk.gdk.CONTROL_MASK | gtk.gdk.SHIFT_MASK),
+)
+FLOW_GRAPH_CLOSE = Action(
+ label='_Close',
+ tooltip='Close the current flow graph',
+ stock_id=gtk.STOCK_CLOSE,
+ keypresses=(gtk.keysyms.w, gtk.gdk.CONTROL_MASK),
+)
+APPLICATION_INITIALIZE = Action()
+APPLICATION_QUIT = Action(
+ label='_Quit',
+ tooltip='Quit program',
+ stock_id=gtk.STOCK_QUIT,
+ keypresses=(gtk.keysyms.q, gtk.gdk.CONTROL_MASK),
+)
+FLOW_GRAPH_UNDO = Action(
+ label='_Undo',
+ tooltip='Undo a change to the flow graph',
+ stock_id=gtk.STOCK_UNDO,
+ keypresses=(gtk.keysyms.z, gtk.gdk.CONTROL_MASK),
+)
+FLOW_GRAPH_REDO = Action(
+ label='_Redo',
+ tooltip='Redo a change to the flow graph',
+ stock_id=gtk.STOCK_REDO,
+ keypresses=(gtk.keysyms.y, gtk.gdk.CONTROL_MASK),
+)
+NOTHING_SELECT = Action()
+ELEMENT_SELECT = Action()
+ELEMENT_CREATE = Action()
+ELEMENT_DELETE = Action(
+ label='_Delete',
+ tooltip='Delete the selected blocks',
+ stock_id=gtk.STOCK_DELETE,
+ keypresses=(gtk.keysyms.Delete, NO_MODS_MASK),
+)
+BLOCK_MOVE = Action()
+BLOCK_ROTATE_CCW = Action(
+ label='Rotate Counterclockwise',
+ tooltip='Rotate the selected blocks 90 degrees to the left',
+ stock_id=gtk.STOCK_GO_BACK,
+ keypresses=(gtk.keysyms.Left, NO_MODS_MASK),
+)
+BLOCK_ROTATE_CW = Action(
+ label='Rotate Clockwise',
+ tooltip='Rotate the selected blocks 90 degrees to the right',
+ stock_id=gtk.STOCK_GO_FORWARD,
+ keypresses=(gtk.keysyms.Right, NO_MODS_MASK),
+)
+BLOCK_PARAM_MODIFY = Action(
+ label='_Properties',
+ tooltip='Modify params for the selected block',
+ stock_id=gtk.STOCK_PROPERTIES,
+ keypresses=(gtk.keysyms.Return, NO_MODS_MASK),
+)
+BLOCK_ENABLE = Action(
+ label='E_nable',
+ tooltip='Enable the selected blocks',
+ stock_id=gtk.STOCK_CONNECT,
+ keypresses=(gtk.keysyms.e, NO_MODS_MASK),
+)
+BLOCK_DISABLE = Action(
+ label='D_isable',
+ tooltip='Disable the selected blocks',
+ stock_id=gtk.STOCK_DISCONNECT,
+ keypresses=(gtk.keysyms.d, NO_MODS_MASK),
+)
+BLOCK_CREATE_HIER = Action(
+ label='C_reate Hier',
+ tooltip='Create hier block from selected blocks',
+ stock_id=gtk.STOCK_CONNECT,
+# keypresses=(gtk.keysyms.c, NO_MODS_MASK),
+)
+BLOCK_CUT = Action(
+ label='Cu_t',
+ tooltip='Cut',
+ stock_id=gtk.STOCK_CUT,
+ keypresses=(gtk.keysyms.x, gtk.gdk.CONTROL_MASK),
+)
+BLOCK_COPY = Action(
+ label='_Copy',
+ tooltip='Copy',
+ stock_id=gtk.STOCK_COPY,
+ keypresses=(gtk.keysyms.c, gtk.gdk.CONTROL_MASK),
+)
+BLOCK_PASTE = Action(
+ label='_Paste',
+ tooltip='Paste',
+ stock_id=gtk.STOCK_PASTE,
+ keypresses=(gtk.keysyms.v, gtk.gdk.CONTROL_MASK),
+)
+ERRORS_WINDOW_DISPLAY = Action(
+ label='_Errors',
+ tooltip='View flow graph errors',
+ stock_id=gtk.STOCK_DIALOG_ERROR,
+)
+ABOUT_WINDOW_DISPLAY = Action(
+ label='_About',
+ tooltip='About this program',
+ stock_id=gtk.STOCK_ABOUT,
+)
+HELP_WINDOW_DISPLAY = Action(
+ label='_Help',
+ tooltip='Usage tips',
+ stock_id=gtk.STOCK_HELP,
+ keypresses=(gtk.keysyms.F1, NO_MODS_MASK),
+)
+TYPES_WINDOW_DISPLAY = Action(
+ label='_Types',
+ tooltip='Types color mapping',
+ stock_id=gtk.STOCK_DIALOG_INFO,
+)
+FLOW_GRAPH_GEN = Action(
+ label='_Generate',
+ tooltip='Generate the flow graph',
+ stock_id=gtk.STOCK_CONVERT,
+ keypresses=(gtk.keysyms.F5, NO_MODS_MASK),
+)
+FLOW_GRAPH_EXEC = Action(
+ label='_Execute',
+ tooltip='Execute the flow graph',
+ stock_id=gtk.STOCK_EXECUTE,
+ keypresses=(gtk.keysyms.F6, NO_MODS_MASK),
+)
+FLOW_GRAPH_KILL = Action(
+ label='_Kill',
+ tooltip='Kill the flow graph',
+ stock_id=gtk.STOCK_STOP,
+ keypresses=(gtk.keysyms.F7, NO_MODS_MASK),
+)
+FLOW_GRAPH_SCREEN_CAPTURE = Action(
+ label='S_creen Capture',
+ tooltip='Create a screen capture of the flow graph',
+ stock_id=gtk.STOCK_PRINT,
+ keypresses=(gtk.keysyms.Print, NO_MODS_MASK),
+)
+PORT_CONTROLLER_DEC = Action(
+ keypresses=(gtk.keysyms.minus, NO_MODS_MASK, gtk.keysyms.KP_Subtract, NO_MODS_MASK),
+)
+PORT_CONTROLLER_INC = Action(
+ keypresses=(gtk.keysyms.plus, NO_MODS_MASK, gtk.keysyms.KP_Add, NO_MODS_MASK),
+)
+BLOCK_INC_TYPE = Action(
+ keypresses=(gtk.keysyms.Down, NO_MODS_MASK),
+)
+BLOCK_DEC_TYPE = Action(
+ keypresses=(gtk.keysyms.Up, NO_MODS_MASK),
+)
+RELOAD_BLOCKS = Action(
+ label='Reload _Blocks',
+ tooltip='Reload Blocks',
+ stock_id=gtk.STOCK_REFRESH
+)
+OPEN_HIER = Action(
+ label='Open H_ier',
+ tooltip='Open the source of the selected hierarchical block',
+ stock_id=gtk.STOCK_JUMP_TO,
+)
diff --git a/grc/gui/Bars.py b/grc/gui/Bars.py
new file mode 100644
index 000000000..d95d23f1f
--- /dev/null
+++ b/grc/gui/Bars.py
@@ -0,0 +1,143 @@
+"""
+Copyright 2007, 2008, 2009 Free Software Foundation, Inc.
+This file is part of GNU Radio
+
+GNU Radio Companion 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 2
+of the License, or (at your option) any later version.
+
+GNU Radio Companion 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 this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+"""
+
+import Actions
+import pygtk
+pygtk.require('2.0')
+import gtk
+
+##The list of actions for the toolbar.
+TOOLBAR_LIST = (
+ Actions.FLOW_GRAPH_NEW,
+ Actions.FLOW_GRAPH_OPEN,
+ Actions.FLOW_GRAPH_SAVE,
+ Actions.FLOW_GRAPH_CLOSE,
+ None,
+ Actions.FLOW_GRAPH_SCREEN_CAPTURE,
+ None,
+ Actions.BLOCK_CUT,
+ Actions.BLOCK_COPY,
+ Actions.BLOCK_PASTE,
+ Actions.ELEMENT_DELETE,
+ None,
+ Actions.FLOW_GRAPH_UNDO,
+ Actions.FLOW_GRAPH_REDO,
+ None,
+ Actions.ERRORS_WINDOW_DISPLAY,
+ Actions.FLOW_GRAPH_GEN,
+ Actions.FLOW_GRAPH_EXEC,
+ Actions.FLOW_GRAPH_KILL,
+ None,
+ Actions.BLOCK_ROTATE_CCW,
+ Actions.BLOCK_ROTATE_CW,
+ None,
+ Actions.BLOCK_ENABLE,
+ Actions.BLOCK_DISABLE,
+ None,
+ Actions.RELOAD_BLOCKS,
+ Actions.OPEN_HIER,
+)
+
+##The list of actions and categories for the menu bar.
+MENU_BAR_LIST = (
+ (gtk.Action('File', '_File', None, None), [
+ Actions.FLOW_GRAPH_NEW,
+ Actions.FLOW_GRAPH_OPEN,
+ None,
+ Actions.FLOW_GRAPH_SAVE,
+ Actions.FLOW_GRAPH_SAVE_AS,
+ None,
+ Actions.FLOW_GRAPH_SCREEN_CAPTURE,
+ None,
+ Actions.FLOW_GRAPH_CLOSE,
+ Actions.APPLICATION_QUIT,
+ ]),
+ (gtk.Action('Edit', '_Edit', None, None), [
+ Actions.FLOW_GRAPH_UNDO,
+ Actions.FLOW_GRAPH_REDO,
+ None,
+ Actions.BLOCK_CUT,
+ Actions.BLOCK_COPY,
+ Actions.BLOCK_PASTE,
+ Actions.ELEMENT_DELETE,
+ None,
+ Actions.BLOCK_ROTATE_CCW,
+ Actions.BLOCK_ROTATE_CW,
+ None,
+ Actions.BLOCK_ENABLE,
+ Actions.BLOCK_DISABLE,
+ None,
+ Actions.BLOCK_PARAM_MODIFY,
+ ]),
+ (gtk.Action('View', '_View', None, None), [
+ Actions.ERRORS_WINDOW_DISPLAY,
+ ]),
+ (gtk.Action('Build', '_Build', None, None), [
+ Actions.FLOW_GRAPH_GEN,
+ Actions.FLOW_GRAPH_EXEC,
+ Actions.FLOW_GRAPH_KILL,
+ ]),
+ (gtk.Action('Help', '_Help', None, None), [
+ Actions.HELP_WINDOW_DISPLAY,
+ Actions.TYPES_WINDOW_DISPLAY,
+ None,
+ Actions.ABOUT_WINDOW_DISPLAY,
+ ]),
+)
+
+class Toolbar(gtk.Toolbar):
+ """The gtk toolbar with actions added from the toolbar list."""
+
+ def __init__(self):
+ """
+ Parse the list of action names in the toolbar list.
+ Look up the action for each name in the action list and add it to the toolbar.
+ """
+ gtk.Toolbar.__init__(self)
+ self.set_style(gtk.TOOLBAR_ICONS)
+ for action in TOOLBAR_LIST:
+ if action: #add a tool item
+ self.add(action.create_tool_item())
+ #this reset of the tooltip property is required (after creating the tool item) for the tooltip to show
+ action.set_property('tooltip', action.get_property('tooltip'))
+ else: self.add(gtk.SeparatorToolItem())
+
+class MenuBar(gtk.MenuBar):
+ """The gtk menu bar with actions added from the menu bar list."""
+
+ def __init__(self):
+ """
+ Parse the list of submenus from the menubar list.
+ For each submenu, get a list of action names.
+ Look up the action for each name in the action list and add it to the submenu.
+ Add the submenu to the menu bar.
+ """
+ gtk.MenuBar.__init__(self)
+ for main_action, actions in MENU_BAR_LIST:
+ #create the main menu item
+ main_menu_item = main_action.create_menu_item()
+ self.append(main_menu_item)
+ #create the menu
+ main_menu = gtk.Menu()
+ main_menu_item.set_submenu(main_menu)
+ for action in actions:
+ if action: #append a menu item
+ main_menu.append(action.create_menu_item())
+ else: main_menu.append(gtk.SeparatorMenuItem())
+ main_menu.show_all() #this show all is required for the separators to show
diff --git a/grc/gui/Block.py b/grc/gui/Block.py
new file mode 100644
index 000000000..27143e070
--- /dev/null
+++ b/grc/gui/Block.py
@@ -0,0 +1,201 @@
+"""
+Copyright 2007, 2008, 2009 Free Software Foundation, Inc.
+This file is part of GNU Radio
+
+GNU Radio Companion 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 2
+of the License, or (at your option) any later version.
+
+GNU Radio Companion 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 this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+"""
+
+from Element import Element
+import Utils
+import Colors
+from .. base import odict
+from Constants import BORDER_PROXIMITY_SENSITIVITY
+from Constants import \
+ BLOCK_LABEL_PADDING, \
+ PORT_SEPARATION, LABEL_SEPARATION, \
+ PORT_BORDER_SEPARATION, POSSIBLE_ROTATIONS
+import pygtk
+pygtk.require('2.0')
+import gtk
+import pango
+
+BLOCK_MARKUP_TMPL="""\
+#set $foreground = $block.is_valid() and 'black' or 'red'
+<span foreground="$foreground" font_desc="Sans 8"><b>$encode($block.get_name())</b></span>"""
+
+class Block(Element):
+ """The graphical signal block."""
+
+ def __init__(self):
+ """
+ Block contructor.
+ Add graphics related params to the block.
+ """
+ #add the position param
+ self.get_params().append(self.get_parent().get_parent().Param(
+ block=self,
+ n=odict({
+ 'name': 'GUI Coordinate',
+ 'key': '_coordinate',
+ 'type': 'raw',
+ 'value': '(0, 0)',
+ 'hide': 'all',
+ })
+ ))
+ self.get_params().append(self.get_parent().get_parent().Param(
+ block=self,
+ n=odict({
+ 'name': 'GUI Rotation',
+ 'key': '_rotation',
+ 'type': 'raw',
+ 'value': '0',
+ 'hide': 'all',
+ })
+ ))
+ Element.__init__(self)
+
+ def get_coordinate(self):
+ """
+ Get the coordinate from the position param.
+ @return the coordinate tuple (x, y) or (0, 0) if failure
+ """
+ try: #should evaluate to tuple
+ coor = eval(self.get_param('_coordinate').get_value())
+ x, y = map(int, coor)
+ fgW,fgH = self.get_parent().get_size()
+ if x <= 0:
+ x = 0
+ elif x >= fgW - BORDER_PROXIMITY_SENSITIVITY:
+ x = fgW - BORDER_PROXIMITY_SENSITIVITY
+ if y <= 0:
+ y = 0
+ elif y >= fgH - BORDER_PROXIMITY_SENSITIVITY:
+ y = fgH - BORDER_PROXIMITY_SENSITIVITY
+ return (x, y)
+ except:
+ self.set_coordinate((0, 0))
+ return (0, 0)
+
+ def set_coordinate(self, coor):
+ """
+ Set the coordinate into the position param.
+ @param coor the coordinate tuple (x, y)
+ """
+ self.get_param('_coordinate').set_value(str(coor))
+
+ def get_rotation(self):
+ """
+ Get the rotation from the position param.
+ @return the rotation in degrees or 0 if failure
+ """
+ try: #should evaluate to dict
+ rotation = eval(self.get_param('_rotation').get_value())
+ return int(rotation)
+ except:
+ self.set_rotation(POSSIBLE_ROTATIONS[0])
+ return POSSIBLE_ROTATIONS[0]
+
+ def set_rotation(self, rot):
+ """
+ Set the rotation into the position param.
+ @param rot the rotation in degrees
+ """
+ self.get_param('_rotation').set_value(str(rot))
+
+ def create_shapes(self):
+ """Update the block, parameters, and ports when a change occurs."""
+ Element.create_shapes(self)
+ if self.is_horizontal(): self.add_area((0, 0), (self.W, self.H))
+ elif self.is_vertical(): self.add_area((0, 0), (self.H, self.W))
+
+ def create_labels(self):
+ """Create the labels for the signal block."""
+ Element.create_labels(self)
+ self._bg_color = self.get_enabled() and Colors.BLOCK_ENABLED_COLOR or Colors.BLOCK_DISABLED_COLOR
+ layouts = list()
+ #create the main layout
+ layout = gtk.DrawingArea().create_pango_layout('')
+ layouts.append(layout)
+ layout.set_markup(Utils.parse_template(BLOCK_MARKUP_TMPL, block=self))
+ self.label_width, self.label_height = layout.get_pixel_size()
+ #display the params
+ markups = [param.get_markup() for param in self.get_params() if param.get_hide() not in ('all', 'part')]
+ if markups:
+ layout = gtk.DrawingArea().create_pango_layout('')
+ layout.set_spacing(LABEL_SEPARATION*pango.SCALE)
+ layout.set_markup('\n'.join(markups))
+ layouts.append(layout)
+ w,h = layout.get_pixel_size()
+ self.label_width = max(w, self.label_width)
+ self.label_height += h + LABEL_SEPARATION
+ width = self.label_width
+ height = self.label_height
+ #setup the pixmap
+ pixmap = self.get_parent().new_pixmap(width, height)
+ gc = pixmap.new_gc()
+ gc.set_foreground(self._bg_color)
+ pixmap.draw_rectangle(gc, True, 0, 0, width, height)
+ #draw the layouts
+ h_off = 0
+ for i,layout in enumerate(layouts):
+ w,h = layout.get_pixel_size()
+ if i == 0: w_off = (width-w)/2
+ else: w_off = 0
+ pixmap.draw_layout(gc, w_off, h_off, layout)
+ h_off = h + h_off + LABEL_SEPARATION
+ #create vertical and horizontal pixmaps
+ self.horizontal_label = pixmap
+ if self.is_vertical():
+ self.vertical_label = self.get_parent().new_pixmap(height, width)
+ Utils.rotate_pixmap(gc, self.horizontal_label, self.vertical_label)
+ #calculate width and height needed
+ self.W = self.label_width + 2*BLOCK_LABEL_PADDING
+ self.H = max(*(
+ [self.label_height+2*BLOCK_LABEL_PADDING] + [2*PORT_BORDER_SEPARATION + \
+ sum([port.H + PORT_SEPARATION for port in ports]) - PORT_SEPARATION
+ for ports in (self.get_sources(), self.get_sinks())]
+ ))
+
+ def draw(self, gc, window):
+ """
+ Draw the signal block with label and inputs/outputs.
+ @param gc the graphics context
+ @param window the gtk window to draw on
+ """
+ x, y = self.get_coordinate()
+ #draw main block
+ Element.draw(
+ self, gc, window, bg_color=self._bg_color,
+ border_color=self.is_highlighted() and Colors.HIGHLIGHT_COLOR or Colors.BORDER_COLOR,
+ )
+ #draw label image
+ if self.is_horizontal():
+ window.draw_drawable(gc, self.horizontal_label, 0, 0, x+BLOCK_LABEL_PADDING, y+(self.H-self.label_height)/2, -1, -1)
+ elif self.is_vertical():
+ window.draw_drawable(gc, self.vertical_label, 0, 0, x+(self.H-self.label_height)/2, y+BLOCK_LABEL_PADDING, -1, -1)
+ #draw ports
+ for port in self.get_ports(): port.draw(gc, window)
+
+ def what_is_selected(self, coor, coor_m=None):
+ """
+ Get the element that is selected.
+ @param coor the (x,y) tuple
+ @param coor_m the (x_m, y_m) tuple
+ @return this block, a port, or None
+ """
+ for port in self.get_ports():
+ port_selected = port.what_is_selected(coor, coor_m)
+ if port_selected: return port_selected
+ return Element.what_is_selected(self, coor, coor_m)
diff --git a/grc/gui/BlockTreeWindow.py b/grc/gui/BlockTreeWindow.py
new file mode 100644
index 000000000..62afb6205
--- /dev/null
+++ b/grc/gui/BlockTreeWindow.py
@@ -0,0 +1,201 @@
+"""
+Copyright 2007, 2008, 2009 Free Software Foundation, Inc.
+This file is part of GNU Radio
+
+GNU Radio Companion 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 2
+of the License, or (at your option) any later version.
+
+GNU Radio Companion 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 this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+"""
+
+from Constants import DEFAULT_BLOCKS_WINDOW_WIDTH, DND_TARGETS
+import Utils
+import pygtk
+pygtk.require('2.0')
+import gtk
+import gobject
+
+NAME_INDEX = 0
+KEY_INDEX = 1
+DOC_INDEX = 2
+
+DOC_MARKUP_TMPL="""\
+#if $doc
+$encode($doc)#slurp
+#else
+undocumented#slurp
+#end if"""
+
+CAT_MARKUP_TMPL="""Category: $cat"""
+
+class BlockTreeWindow(gtk.VBox):
+ """The block selection panel."""
+
+ def __init__(self, platform, get_flow_graph):
+ """
+ BlockTreeWindow constructor.
+ Create a tree view of the possible blocks in the platform.
+ The tree view nodes will be category names, the leaves will be block names.
+ A mouse double click or button press action will trigger the add block event.
+ @param platform the particular platform will all block prototypes
+ @param get_flow_graph get the selected flow graph
+ """
+ gtk.VBox.__init__(self)
+ self.platform = platform
+ self.get_flow_graph = get_flow_graph
+ #make the tree model for holding blocks
+ self.treestore = gtk.TreeStore(gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING)
+ self.treeview = gtk.TreeView(self.treestore)
+ self.treeview.set_enable_search(False) #disable pop up search box
+ self.treeview.add_events(gtk.gdk.BUTTON_PRESS_MASK)
+ self.treeview.connect('button-press-event', self._handle_mouse_button_press)
+ selection = self.treeview.get_selection()
+ selection.set_mode('single')
+ selection.connect('changed', self._handle_selection_change)
+ renderer = gtk.CellRendererText()
+ column = gtk.TreeViewColumn('Blocks', renderer, text=NAME_INDEX)
+ self.treeview.append_column(column)
+ #setup the search
+ self.treeview.set_enable_search(True)
+ self.treeview.set_search_equal_func(self._handle_search)
+ #try to enable the tooltips (available in pygtk 2.12 and above)
+ try: self.treeview.set_tooltip_column(DOC_INDEX)
+ except: pass
+ #setup drag and drop
+ self.treeview.enable_model_drag_source(gtk.gdk.BUTTON1_MASK, DND_TARGETS, gtk.gdk.ACTION_COPY)
+ self.treeview.connect('drag-data-get', self._handle_drag_get_data)
+ #make the scrolled window to hold the tree view
+ scrolled_window = gtk.ScrolledWindow()
+ scrolled_window.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
+ scrolled_window.add_with_viewport(self.treeview)
+ scrolled_window.set_size_request(DEFAULT_BLOCKS_WINDOW_WIDTH, -1)
+ self.pack_start(scrolled_window)
+ #add button
+ self.add_button = gtk.Button(None, gtk.STOCK_ADD)
+ self.add_button.connect('clicked', self._handle_add_button)
+ self.pack_start(self.add_button, False)
+ #map categories to iters, automatic mapping for root
+ self._categories = {tuple(): None}
+ #add blocks and categories
+ self.platform.load_block_tree(self)
+ #initialize
+ self._update_add_button()
+
+ def clear(self):
+ self.treestore.clear();
+ self._categories = {tuple(): None}
+
+
+ ############################################################
+ ## Block Tree Methods
+ ############################################################
+ def add_block(self, category, block=None):
+ """
+ Add a block with category to this selection window.
+ Add only the category when block is None.
+ @param category the category list or path string
+ @param block the block object or None
+ """
+ if isinstance(category, str): category = category.split('/')
+ category = tuple(filter(lambda x: x, category)) #tuple is hashable
+ #add category and all sub categories
+ for i, cat_name in enumerate(category):
+ sub_category = category[:i+1]
+ if sub_category not in self._categories:
+ iter = self.treestore.insert_before(self._categories[sub_category[:-1]], None)
+ self.treestore.set_value(iter, NAME_INDEX, '[ %s ]'%cat_name)
+ self.treestore.set_value(iter, KEY_INDEX, '')
+ self.treestore.set_value(iter, DOC_INDEX, Utils.parse_template(CAT_MARKUP_TMPL, cat=cat_name))
+ self._categories[sub_category] = iter
+ #add block
+ if block is None: return
+ iter = self.treestore.insert_before(self._categories[category], None)
+ self.treestore.set_value(iter, NAME_INDEX, block.get_name())
+ self.treestore.set_value(iter, KEY_INDEX, block.get_key())
+ self.treestore.set_value(iter, DOC_INDEX, Utils.parse_template(DOC_MARKUP_TMPL, doc=block.get_doc()))
+
+ ############################################################
+ ## Helper Methods
+ ############################################################
+ def _get_selected_block_key(self):
+ """
+ Get the currently selected block key.
+ @return the key of the selected block or a empty string
+ """
+ selection = self.treeview.get_selection()
+ treestore, iter = selection.get_selected()
+ return iter and treestore.get_value(iter, KEY_INDEX) or ''
+
+ def _update_add_button(self):
+ """
+ Update the add button's sensitivity.
+ The button should be active only if a block is selected.
+ """
+ key = self._get_selected_block_key()
+ self.add_button.set_sensitive(bool(key))
+
+ def _add_selected_block(self):
+ """
+ Add the selected block with the given key to the flow graph.
+ """
+ key = self._get_selected_block_key()
+ if key: self.get_flow_graph().add_new_block(key)
+
+ ############################################################
+ ## Event Handlers
+ ############################################################
+ def _handle_search(self, model, column, key, iter):
+ #determine which blocks match the search key
+ blocks = self.get_flow_graph().get_parent().get_blocks()
+ matching_blocks = filter(lambda b: key in b.get_key() or key in b.get_name().lower(), blocks)
+ #remove the old search category
+ try: self.treestore.remove(self._categories.pop((self._search_category, )))
+ except (KeyError, AttributeError): pass #nothing to remove
+ #create a search category
+ if not matching_blocks: return
+ self._search_category = 'Search: %s'%key
+ for block in matching_blocks: self.add_block(self._search_category, block)
+ #expand the search category
+ path = self.treestore.get_path(self._categories[(self._search_category, )])
+ self.treeview.collapse_all()
+ self.treeview.expand_row(path, open_all=False)
+
+ def _handle_drag_get_data(self, widget, drag_context, selection_data, info, time):
+ """
+ Handle a drag and drop by setting the key to the selection object.
+ This will call the destination handler for drag and drop.
+ Only call set when the key is valid to ignore DND from categories.
+ """
+ key = self._get_selected_block_key()
+ if key: selection_data.set(selection_data.target, 8, key)
+
+ def _handle_mouse_button_press(self, widget, event):
+ """
+ Handle the mouse button press.
+ If a left double click is detected, call add selected block.
+ """
+ if event.button == 1 and event.type == gtk.gdk._2BUTTON_PRESS:
+ self._add_selected_block()
+
+ def _handle_selection_change(self, selection):
+ """
+ Handle a selection change in the tree view.
+ If a selection changes, set the add button sensitive.
+ """
+ self._update_add_button()
+
+ def _handle_add_button(self, widget):
+ """
+ Handle the add button clicked signal.
+ Call add selected block.
+ """
+ self._add_selected_block()
diff --git a/grc/gui/CMakeLists.txt b/grc/gui/CMakeLists.txt
new file mode 100644
index 000000000..c2eb16e9f
--- /dev/null
+++ b/grc/gui/CMakeLists.txt
@@ -0,0 +1,48 @@
+# Copyright 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.
+
+########################################################################
+GR_PYTHON_INSTALL(FILES
+ Block.py
+ Colors.py
+ Constants.py
+ Connection.py
+ Element.py
+ FlowGraph.py
+ Param.py
+ Platform.py
+ Port.py
+ Utils.py
+ ActionHandler.py
+ Actions.py
+ Bars.py
+ BlockTreeWindow.py
+ Dialogs.py
+ DrawingArea.py
+ FileDialogs.py
+ MainWindow.py
+ Messages.py
+ NotebookPage.py
+ PropsDialog.py
+ Preferences.py
+ StateCache.py
+ __init__.py
+ DESTINATION ${GR_PYTHON_DIR}/gnuradio/grc/gui
+ COMPONENT "grc"
+)
diff --git a/grc/gui/Colors.py b/grc/gui/Colors.py
new file mode 100644
index 000000000..c79dadee3
--- /dev/null
+++ b/grc/gui/Colors.py
@@ -0,0 +1,40 @@
+"""
+Copyright 2008 Free Software Foundation, Inc.
+This file is part of GNU Radio
+
+GNU Radio Companion 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 2
+of the License, or (at your option) any later version.
+
+GNU Radio Companion 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 this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+"""
+
+import pygtk
+pygtk.require('2.0')
+import gtk
+
+_COLORMAP = gtk.gdk.colormap_get_system() #create all of the colors
+def get_color(color_code): return _COLORMAP.alloc_color(color_code, True, True)
+
+HIGHLIGHT_COLOR = get_color('#00FFFF')
+BORDER_COLOR = get_color('black')
+#param entry boxes
+PARAM_ENTRY_TEXT_COLOR = get_color('black')
+ENTRYENUM_CUSTOM_COLOR = get_color('#EEEEEE')
+#flow graph color constants
+FLOWGRAPH_BACKGROUND_COLOR = get_color('#FFF9FF')
+#block color constants
+BLOCK_ENABLED_COLOR = get_color('#F1ECFF')
+BLOCK_DISABLED_COLOR = get_color('#CCCCCC')
+#connection color constants
+CONNECTION_ENABLED_COLOR = get_color('black')
+CONNECTION_DISABLED_COLOR = get_color('#999999')
+CONNECTION_ERROR_COLOR = get_color('red')
diff --git a/grc/gui/Connection.py b/grc/gui/Connection.py
new file mode 100644
index 000000000..fabf34ee7
--- /dev/null
+++ b/grc/gui/Connection.py
@@ -0,0 +1,143 @@
+"""
+Copyright 2007, 2008, 2009 Free Software Foundation, Inc.
+This file is part of GNU Radio
+
+GNU Radio Companion 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 2
+of the License, or (at your option) any later version.
+
+GNU Radio Companion 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 this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+"""
+
+import Utils
+from Element import Element
+import Colors
+from Constants import CONNECTOR_ARROW_BASE, CONNECTOR_ARROW_HEIGHT
+
+class Connection(Element):
+ """
+ A graphical connection for ports.
+ The connection has 2 parts, the arrow and the wire.
+ The coloring of the arrow and wire exposes the status of 3 states:
+ enabled/disabled, valid/invalid, highlighted/non-highlighted.
+ The wire coloring exposes the enabled and highlighted states.
+ The arrow coloring exposes the enabled and valid states.
+ """
+
+ def __init__(self): Element.__init__(self)
+
+ def get_coordinate(self):
+ """
+ Get the 0,0 coordinate.
+ Coordinates are irrelevant in connection.
+ @return 0, 0
+ """
+ return (0, 0)
+
+ def get_rotation(self):
+ """
+ Get the 0 degree rotation.
+ Rotations are irrelevant in connection.
+ @return 0
+ """
+ return 0
+
+ def create_shapes(self):
+ """Precalculate relative coordinates."""
+ Element.create_shapes(self)
+ self._sink_rot = None
+ self._source_rot = None
+ self._sink_coor = None
+ self._source_coor = None
+ #get the source coordinate
+ connector_length = self.get_source().get_connector_length()
+ self.x1, self.y1 = Utils.get_rotated_coordinate((connector_length, 0), self.get_source().get_rotation())
+ #get the sink coordinate
+ connector_length = self.get_sink().get_connector_length() + CONNECTOR_ARROW_HEIGHT
+ self.x2, self.y2 = Utils.get_rotated_coordinate((-connector_length, 0), self.get_sink().get_rotation())
+ #build the arrow
+ self.arrow = [(0, 0),
+ Utils.get_rotated_coordinate((-CONNECTOR_ARROW_HEIGHT, -CONNECTOR_ARROW_BASE/2), self.get_sink().get_rotation()),
+ Utils.get_rotated_coordinate((-CONNECTOR_ARROW_HEIGHT, CONNECTOR_ARROW_BASE/2), self.get_sink().get_rotation()),
+ ]
+ self._update_after_move()
+ if not self.get_enabled(): self._arrow_color = Colors.CONNECTION_DISABLED_COLOR
+ elif not self.is_valid(): self._arrow_color = Colors.CONNECTION_ERROR_COLOR
+ else: self._arrow_color = Colors.CONNECTION_ENABLED_COLOR
+
+ def _update_after_move(self):
+ """Calculate coordinates."""
+ self.clear() #FIXME do i want this here?
+ #source connector
+ source = self.get_source()
+ X, Y = source.get_connector_coordinate()
+ x1, y1 = self.x1 + X, self.y1 + Y
+ self.add_line((x1, y1), (X, Y))
+ #sink connector
+ sink = self.get_sink()
+ X, Y = sink.get_connector_coordinate()
+ x2, y2 = self.x2 + X, self.y2 + Y
+ self.add_line((x2, y2), (X, Y))
+ #adjust arrow
+ self._arrow = [(x+X, y+Y) for x,y in self.arrow]
+ #add the horizontal and vertical lines in this connection
+ if abs(source.get_connector_direction() - sink.get_connector_direction()) == 180:
+ #2 possible point sets to create a 3-line connector
+ mid_x, mid_y = (x1 + x2)/2.0, (y1 + y2)/2.0
+ points = [((mid_x, y1), (mid_x, y2)), ((x1, mid_y), (x2, mid_y))]
+ #source connector -> points[0][0] should be in the direction of source (if possible)
+ if Utils.get_angle_from_coordinates((x1, y1), points[0][0]) != source.get_connector_direction(): points.reverse()
+ #points[0][0] -> sink connector should not be in the direction of sink
+ if Utils.get_angle_from_coordinates(points[0][0], (x2, y2)) == sink.get_connector_direction(): points.reverse()
+ #points[0][0] -> source connector should not be in the direction of source
+ if Utils.get_angle_from_coordinates(points[0][0], (x1, y1)) == source.get_connector_direction(): points.reverse()
+ #create 3-line connector
+ p1, p2 = map(int, points[0][0]), map(int, points[0][1])
+ self.add_line((x1, y1), p1)
+ self.add_line(p1, p2)
+ self.add_line((x2, y2), p2)
+ else:
+ #2 possible points to create a right-angled connector
+ points = [(x1, y2), (x2, y1)]
+ #source connector -> points[0] should be in the direction of source (if possible)
+ if Utils.get_angle_from_coordinates((x1, y1), points[0]) != source.get_connector_direction(): points.reverse()
+ #points[0] -> sink connector should not be in the direction of sink
+ if Utils.get_angle_from_coordinates(points[0], (x2, y2)) == sink.get_connector_direction(): points.reverse()
+ #points[0] -> source connector should not be in the direction of source
+ if Utils.get_angle_from_coordinates(points[0], (x1, y1)) == source.get_connector_direction(): points.reverse()
+ #create right-angled connector
+ self.add_line((x1, y1), points[0])
+ self.add_line((x2, y2), points[0])
+
+ def draw(self, gc, window):
+ """
+ Draw the connection.
+ @param gc the graphics context
+ @param window the gtk window to draw on
+ """
+ sink = self.get_sink()
+ source = self.get_source()
+ #check for changes
+ if self._sink_rot != sink.get_rotation() or self._source_rot != source.get_rotation(): self.create_shapes()
+ elif self._sink_coor != sink.get_coordinate() or self._source_coor != source.get_coordinate(): self._update_after_move()
+ #cache values
+ self._sink_rot = sink.get_rotation()
+ self._source_rot = source.get_rotation()
+ self._sink_coor = sink.get_coordinate()
+ self._source_coor = source.get_coordinate()
+ #draw
+ if self.is_highlighted(): border_color = Colors.HIGHLIGHT_COLOR
+ elif self.get_enabled(): border_color = Colors.CONNECTION_ENABLED_COLOR
+ else: border_color = Colors.CONNECTION_DISABLED_COLOR
+ Element.draw(self, gc, window, bg_color=None, border_color=border_color)
+ #draw arrow on sink port
+ gc.set_foreground(self._arrow_color)
+ window.draw_polygon(gc, True, self._arrow)
diff --git a/grc/gui/Constants.py b/grc/gui/Constants.py
new file mode 100644
index 000000000..7fabcfc0a
--- /dev/null
+++ b/grc/gui/Constants.py
@@ -0,0 +1,83 @@
+"""
+Copyright 2008, 2009 Free Software Foundation, Inc.
+This file is part of GNU Radio
+
+GNU Radio Companion 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 2
+of the License, or (at your option) any later version.
+
+GNU Radio Companion 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 this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+"""
+
+import pygtk
+pygtk.require('2.0')
+import gtk
+import os
+
+##default path for the open/save dialogs
+DEFAULT_FILE_PATH = os.getcwd()
+
+##file extensions
+IMAGE_FILE_EXTENSION = '.png'
+
+##name for new/unsaved flow graphs
+NEW_FLOGRAPH_TITLE = 'untitled'
+
+##main window constraints
+MIN_WINDOW_WIDTH = 600
+MIN_WINDOW_HEIGHT = 400
+##dialog constraints
+MIN_DIALOG_WIDTH = 500
+MIN_DIALOG_HEIGHT = 500
+##default sizes
+DEFAULT_BLOCKS_WINDOW_WIDTH = 100
+DEFAULT_REPORTS_WINDOW_WIDTH = 100
+
+##The size of the state saving cache in the flow graph (for undo/redo functionality)
+STATE_CACHE_SIZE = 42
+
+##Shared targets for drag and drop of blocks
+DND_TARGETS = [('STRING', gtk.TARGET_SAME_APP, 0)]
+
+#label constraint dimensions
+LABEL_SEPARATION = 3
+BLOCK_LABEL_PADDING = 7
+PORT_LABEL_PADDING = 2
+
+#port constraint dimensions
+PORT_SEPARATION = 17
+PORT_BORDER_SEPARATION = 9
+PORT_MIN_WIDTH = 20
+
+#minimal length of connector
+CONNECTOR_EXTENSION_MINIMAL = 11
+
+#increment length for connector
+CONNECTOR_EXTENSION_INCREMENT = 11
+
+#connection arrow dimensions
+CONNECTOR_ARROW_BASE = 13
+CONNECTOR_ARROW_HEIGHT = 17
+
+#possible rotations in degrees
+POSSIBLE_ROTATIONS = (0, 90, 180, 270)
+
+#How close can the mouse get to the window border before mouse events are ignored.
+BORDER_PROXIMITY_SENSITIVITY = 50
+
+#How close the mouse can get to the edge of the visible window before scrolling is invoked.
+SCROLL_PROXIMITY_SENSITIVITY = 30
+
+#When the window has to be scrolled, move it this distance in the required direction.
+SCROLL_DISTANCE = 15
+
+#How close the mouse click can be to a line and register a connection select.
+LINE_SELECT_SENSITIVITY = 5
diff --git a/grc/gui/Dialogs.py b/grc/gui/Dialogs.py
new file mode 100644
index 000000000..473c796af
--- /dev/null
+++ b/grc/gui/Dialogs.py
@@ -0,0 +1,118 @@
+"""
+Copyright 2008, 2009 Free Software Foundation, Inc.
+This file is part of GNU Radio
+
+GNU Radio Companion 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 2
+of the License, or (at your option) any later version.
+
+GNU Radio Companion 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 this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+"""
+
+import pygtk
+pygtk.require('2.0')
+import gtk
+import Utils
+
+class TextDisplay(gtk.TextView):
+ """A non editable gtk text view."""
+
+ def __init__(self, text=''):
+ """
+ TextDisplay constructor.
+ @param text the text to display (string)
+ """
+ text_buffer = gtk.TextBuffer()
+ text_buffer.set_text(text)
+ self.set_text = text_buffer.set_text
+ self.insert = lambda line: text_buffer.insert(text_buffer.get_end_iter(), line)
+ gtk.TextView.__init__(self, text_buffer)
+ self.set_editable(False)
+ self.set_cursor_visible(False)
+ self.set_wrap_mode(gtk.WRAP_WORD_CHAR)
+
+def MessageDialogHelper(type, buttons, title=None, markup=None):
+ """
+ Create a modal message dialog and run it.
+ @param type the type of message: gtk.MESSAGE_INFO, gtk.MESSAGE_WARNING, gtk.MESSAGE_QUESTION or gtk.MESSAGE_ERROR
+ @param buttons the predefined set of buttons to use:
+ gtk.BUTTONS_NONE, gtk.BUTTONS_OK, gtk.BUTTONS_CLOSE, gtk.BUTTONS_CANCEL, gtk.BUTTONS_YES_NO, gtk.BUTTONS_OK_CANCEL
+ @param tittle the title of the window (string)
+ @param markup the message text with pango markup
+ @return the gtk response from run()
+ """
+ message_dialog = gtk.MessageDialog(None, gtk.DIALOG_MODAL, type, buttons)
+ if title: message_dialog.set_title(title)
+ if markup: message_dialog.set_markup(markup)
+ response = message_dialog.run()
+ message_dialog.destroy()
+ return response
+
+
+ERRORS_MARKUP_TMPL="""\
+#for $i, $err_msg in enumerate($errors)
+<b>Error $i:</b>
+$encode($err_msg.replace('\t', ' '))
+
+#end for"""
+def ErrorsDialog(flowgraph): MessageDialogHelper(
+ type=gtk.MESSAGE_ERROR,
+ buttons=gtk.BUTTONS_CLOSE,
+ title='Flow Graph Errors',
+ markup=Utils.parse_template(ERRORS_MARKUP_TMPL, errors=flowgraph.get_error_messages()),
+)
+
+class AboutDialog(gtk.AboutDialog):
+ """A cute little about dialog."""
+
+ def __init__(self, platform):
+ """AboutDialog constructor."""
+ gtk.AboutDialog.__init__(self)
+ self.set_name(platform.get_name())
+ self.set_version(platform.get_version())
+ self.set_license(platform.get_license())
+ self.set_copyright(platform.get_license().splitlines()[0])
+ self.set_website(platform.get_website())
+ self.run()
+ self.destroy()
+
+def HelpDialog(): MessageDialogHelper(
+ type=gtk.MESSAGE_INFO,
+ buttons=gtk.BUTTONS_CLOSE,
+ title='Help',
+ markup="""\
+<b>Usage Tips</b>
+
+<u>Add block</u>: drag and drop or double click a block in the block selection window.
+<u>Rotate block</u>: Select a block, press left/right on the keyboard.
+<u>Change type</u>: Select a block, press up/down on the keyboard.
+<u>Edit parameters</u>: double click on a block in the flow graph.
+<u>Make connection</u>: click on the source port of one block, then click on the sink port of another block.
+<u>Remove connection</u>: select the connection and press delete, or drag the connection.
+
+* See the menu for other keyboard shortcuts.""")
+
+COLORS_DIALOG_MARKUP_TMPL = """\
+<b>Color Mapping</b>
+
+#if $colors
+ #set $max_len = max([len(color[0]) for color in $colors]) + 10
+ #for $title, $color_spec in $colors
+<span background="$color_spec"><tt>$($encode($title).center($max_len))</tt></span>
+ #end for
+#end if
+"""
+
+def TypesDialog(platform): MessageDialogHelper(
+ type=gtk.MESSAGE_INFO,
+ buttons=gtk.BUTTONS_CLOSE,
+ title='Types',
+ markup=Utils.parse_template(COLORS_DIALOG_MARKUP_TMPL, colors=platform.get_colors()))
diff --git a/grc/gui/DrawingArea.py b/grc/gui/DrawingArea.py
new file mode 100644
index 000000000..790df7c3f
--- /dev/null
+++ b/grc/gui/DrawingArea.py
@@ -0,0 +1,133 @@
+"""
+Copyright 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+This file is part of GNU Radio
+
+GNU Radio Companion 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 2
+of the License, or (at your option) any later version.
+
+GNU Radio Companion 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 this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+"""
+
+import pygtk
+pygtk.require('2.0')
+import gtk
+from Constants import MIN_WINDOW_WIDTH, MIN_WINDOW_HEIGHT, DND_TARGETS
+
+class DrawingArea(gtk.DrawingArea):
+ """
+ DrawingArea is the gtk pixel map that graphical elements may draw themselves on.
+ The drawing area also responds to mouse and key events.
+ """
+
+ def __init__(self, flow_graph):
+ """
+ DrawingArea contructor.
+ Connect event handlers.
+ @param main_window the main_window containing all flow graphs
+ """
+ self.ctrl_mask = False
+ self._flow_graph = flow_graph
+ gtk.DrawingArea.__init__(self)
+ self.set_size_request(MIN_WINDOW_WIDTH, MIN_WINDOW_HEIGHT)
+ self.connect('realize', self._handle_window_realize)
+ self.connect('configure-event', self._handle_window_configure)
+ self.connect('expose-event', self._handle_window_expose)
+ self.connect('motion-notify-event', self._handle_mouse_motion)
+ self.connect('button-press-event', self._handle_mouse_button_press)
+ self.connect('button-release-event', self._handle_mouse_button_release)
+ self.add_events(
+ gtk.gdk.BUTTON_PRESS_MASK | \
+ gtk.gdk.POINTER_MOTION_MASK | \
+ gtk.gdk.BUTTON_RELEASE_MASK | \
+ gtk.gdk.LEAVE_NOTIFY_MASK | \
+ gtk.gdk.ENTER_NOTIFY_MASK
+ )
+ #setup drag and drop
+ self.drag_dest_set(gtk.DEST_DEFAULT_ALL, DND_TARGETS, gtk.gdk.ACTION_COPY)
+ self.connect('drag-data-received', self._handle_drag_data_received)
+ #setup the focus flag
+ self._focus_flag = False
+ self.get_focus_flag = lambda: self._focus_flag
+ def _handle_focus_event(widget, event, focus_flag): self._focus_flag = focus_flag
+ self.connect('leave-notify-event', _handle_focus_event, False)
+ self.connect('enter-notify-event', _handle_focus_event, True)
+
+ def new_pixmap(self, width, height): return gtk.gdk.Pixmap(self.window, width, height, -1)
+ def get_pixbuf(self):
+ width, height = self._pixmap.get_size()
+ pixbuf = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, 0, 8, width, height)
+ pixbuf.get_from_drawable(self._pixmap, self._pixmap.get_colormap(), 0, 0, 0, 0, width, height)
+ return pixbuf
+
+ ##########################################################################
+ ## Handlers
+ ##########################################################################
+ def _handle_drag_data_received(self, widget, drag_context, x, y, selection_data, info, time):
+ """
+ Handle a drag and drop by adding a block at the given coordinate.
+ """
+ self._flow_graph.add_new_block(selection_data.data, (x, y))
+
+ def _handle_mouse_button_press(self, widget, event):
+ """
+ Forward button click information to the flow graph.
+ """
+ self.ctrl_mask = event.state & gtk.gdk.CONTROL_MASK
+ if event.button == 1: self._flow_graph.handle_mouse_selector_press(
+ double_click=(event.type == gtk.gdk._2BUTTON_PRESS),
+ coordinate=(event.x, event.y),
+ )
+ if event.button == 3: self._flow_graph.handle_mouse_context_press(
+ coordinate=(event.x, event.y),
+ event=event,
+ )
+
+ def _handle_mouse_button_release(self, widget, event):
+ """
+ Forward button release information to the flow graph.
+ """
+ self.ctrl_mask = event.state & gtk.gdk.CONTROL_MASK
+ if event.button == 1: self._flow_graph.handle_mouse_selector_release(
+ coordinate=(event.x, event.y),
+ )
+
+ def _handle_mouse_motion(self, widget, event):
+ """
+ Forward mouse motion information to the flow graph.
+ """
+ self.ctrl_mask = event.state & gtk.gdk.CONTROL_MASK
+ self._flow_graph.handle_mouse_motion(
+ coordinate=(event.x, event.y),
+ )
+
+ def _handle_window_realize(self, widget):
+ """
+ Called when the window is realized.
+ Update the flowgraph, which calls new pixmap.
+ """
+ self._flow_graph.update()
+
+ def _handle_window_configure(self, widget, event):
+ """
+ Called when the window is resized.
+ Create a new pixmap for background buffer.
+ """
+ self._pixmap = self.new_pixmap(*self.get_size_request())
+
+ def _handle_window_expose(self, widget, event):
+ """
+ Called when window is exposed, or queue_draw is called.
+ Double buffering: draw to pixmap, then draw pixmap to window.
+ """
+ gc = self.window.new_gc()
+ self._flow_graph.draw(gc, self._pixmap)
+ self.window.draw_drawable(gc, self._pixmap, 0, 0, 0, 0, -1, -1)
diff --git a/grc/gui/Element.py b/grc/gui/Element.py
new file mode 100644
index 000000000..e020c5caa
--- /dev/null
+++ b/grc/gui/Element.py
@@ -0,0 +1,228 @@
+"""
+Copyright 2007, 2008, 2009 Free Software Foundation, Inc.
+This file is part of GNU Radio
+
+GNU Radio Companion 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 2
+of the License, or (at your option) any later version.
+
+GNU Radio Companion 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 this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+"""
+
+from Constants import LINE_SELECT_SENSITIVITY
+from Constants import POSSIBLE_ROTATIONS
+
+class Element(object):
+ """
+ GraphicalElement is the base class for all graphical elements.
+ It contains an X,Y coordinate, a list of rectangular areas that the element occupies,
+ and methods to detect selection of those areas.
+ """
+
+ def __init__(self):
+ """
+ Make a new list of rectangular areas and lines, and set the coordinate and the rotation.
+ """
+ self.set_rotation(POSSIBLE_ROTATIONS[0])
+ self.set_coordinate((0, 0))
+ self.clear()
+ self.set_highlighted(False)
+
+ def is_horizontal(self, rotation=None):
+ """
+ Is this element horizontal?
+ If rotation is None, use this element's rotation.
+ @param rotation the optional rotation
+ @return true if rotation is horizontal
+ """
+ rotation = rotation or self.get_rotation()
+ return rotation in (0, 180)
+
+ def is_vertical(self, rotation=None):
+ """
+ Is this element vertical?
+ If rotation is None, use this element's rotation.
+ @param rotation the optional rotation
+ @return true if rotation is vertical
+ """
+ rotation = rotation or self.get_rotation()
+ return rotation in (90, 270)
+
+ def create_labels(self):
+ """
+ Create labels (if applicable) and call on all children.
+ Call this base method before creating labels in the element.
+ """
+ for child in self.get_children(): child.create_labels()
+
+ def create_shapes(self):
+ """
+ Create shapes (if applicable) and call on all children.
+ Call this base method before creating shapes in the element.
+ """
+ self.clear()
+ for child in self.get_children(): child.create_shapes()
+
+ def draw(self, gc, window, border_color, bg_color):
+ """
+ Draw in the given window.
+ @param gc the graphics context
+ @param window the gtk window to draw on
+ @param border_color the color for lines and rectangle borders
+ @param bg_color the color for the inside of the rectangle
+ """
+ X,Y = self.get_coordinate()
+ for (rX,rY),(W,H) in self._areas_list:
+ aX = X + rX
+ aY = Y + rY
+ gc.set_foreground(bg_color)
+ window.draw_rectangle(gc, True, aX, aY, W, H)
+ gc.set_foreground(border_color)
+ window.draw_rectangle(gc, False, aX, aY, W, H)
+ for (x1, y1),(x2, y2) in self._lines_list:
+ gc.set_foreground(border_color)
+ window.draw_line(gc, X+x1, Y+y1, X+x2, Y+y2)
+
+ def rotate(self, rotation):
+ """
+ Rotate all of the areas by 90 degrees.
+ @param rotation multiple of 90 degrees
+ """
+ self.set_rotation((self.get_rotation() + rotation)%360)
+
+ def clear(self):
+ """Empty the lines and areas."""
+ self._areas_list = list()
+ self._lines_list = list()
+
+ def set_coordinate(self, coor):
+ """
+ Set the reference coordinate.
+ @param coor the coordinate tuple (x,y)
+ """
+ self.coor = coor
+
+ def get_parent(self):
+ """
+ Get the parent of this element.
+ @return the parent
+ """
+ return self.parent
+
+ def set_highlighted(self, highlighted):
+ """
+ Set the highlight status.
+ @param highlighted true to enable highlighting
+ """
+ self.highlighted = highlighted
+
+ def is_highlighted(self):
+ """
+ Get the highlight status.
+ @return true if highlighted
+ """
+ return self.highlighted
+
+ def get_coordinate(self):
+ """Get the coordinate.
+ @return the coordinate tuple (x,y)
+ """
+ return self.coor
+
+ def move(self, delta_coor):
+ """
+ Move the element by adding the delta_coor to the current coordinate.
+ @param delta_coor (delta_x,delta_y) tuple
+ """
+ deltaX, deltaY = delta_coor
+ X, Y = self.get_coordinate()
+ self.set_coordinate((X+deltaX, Y+deltaY))
+
+ def add_area(self, rel_coor, area):
+ """
+ Add an area to the area list.
+ An area is actually a coordinate relative to the main coordinate
+ with a width/height pair relative to the area coordinate.
+ A positive width is to the right of the coordinate.
+ A positive height is above the coordinate.
+ The area is associated with a rotation.
+ @param rel_coor (x,y) offset from this element's coordinate
+ @param area (width,height) tuple
+ """
+ self._areas_list.append((rel_coor, area))
+
+ def add_line(self, rel_coor1, rel_coor2):
+ """
+ Add a line to the line list.
+ A line is defined by 2 relative coordinates.
+ Lines must be horizontal or vertical.
+ The line is associated with a rotation.
+ @param rel_coor1 relative (x1,y1) tuple
+ @param rel_coor2 relative (x2,y2) tuple
+ """
+ self._lines_list.append((rel_coor1, rel_coor2))
+
+ def what_is_selected(self, coor, coor_m=None):
+ """
+ One coordinate specified:
+ Is this element selected at given coordinate?
+ ie: is the coordinate encompassed by one of the areas or lines?
+ Both coordinates specified:
+ Is this element within the rectangular region defined by both coordinates?
+ ie: do any area corners or line endpoints fall within the region?
+ @param coor the selection coordinate, tuple x, y
+ @param coor_m an additional selection coordinate.
+ @return self if one of the areas/lines encompasses coor, else None.
+ """
+ #function to test if p is between a and b (inclusive)
+ in_between = lambda p, a, b: p >= min(a, b) and p <= max(a, b)
+ #relative coordinate
+ x, y = [a-b for a,b in zip(coor, self.get_coordinate())]
+ if coor_m:
+ x_m, y_m = [a-b for a,b in zip(coor_m, self.get_coordinate())]
+ #handle rectangular areas
+ for (x1,y1), (w,h) in self._areas_list:
+ if in_between(x1, x, x_m) and in_between(y1, y, y_m) or \
+ in_between(x1+w, x, x_m) and in_between(y1, y, y_m) or \
+ in_between(x1, x, x_m) and in_between(y1+h, y, y_m) or \
+ in_between(x1+w, x, x_m) and in_between(y1+h, y, y_m):
+ return self
+ #handle horizontal or vertical lines
+ for (x1, y1), (x2, y2) in self._lines_list:
+ if in_between(x1, x, x_m) and in_between(y1, y, y_m) or \
+ in_between(x2, x, x_m) and in_between(y2, y, y_m):
+ return self
+ return None
+ else:
+ #handle rectangular areas
+ for (x1,y1), (w,h) in self._areas_list:
+ if in_between(x, x1, x1+w) and in_between(y, y1, y1+h): return self
+ #handle horizontal or vertical lines
+ for (x1, y1), (x2, y2) in self._lines_list:
+ if x1 == x2: x1, x2 = x1-LINE_SELECT_SENSITIVITY, x2+LINE_SELECT_SENSITIVITY
+ if y1 == y2: y1, y2 = y1-LINE_SELECT_SENSITIVITY, y2+LINE_SELECT_SENSITIVITY
+ if in_between(x, x1, x2) and in_between(y, y1, y2): return self
+ return None
+
+ def get_rotation(self):
+ """
+ Get the rotation in degrees.
+ @return the rotation
+ """
+ return self.rotation
+
+ def set_rotation(self, rotation):
+ """
+ Set the rotation in degrees.
+ @param rotation the rotation"""
+ if rotation not in POSSIBLE_ROTATIONS:
+ raise Exception('"%s" is not one of the possible rotations: (%s)'%(rotation, POSSIBLE_ROTATIONS))
+ self.rotation = rotation
diff --git a/grc/gui/FileDialogs.py b/grc/gui/FileDialogs.py
new file mode 100644
index 000000000..3b210c33f
--- /dev/null
+++ b/grc/gui/FileDialogs.py
@@ -0,0 +1,175 @@
+"""
+Copyright 2007 Free Software Foundation, Inc.
+This file is part of GNU Radio
+
+GNU Radio Companion 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 2
+of the License, or (at your option) any later version.
+
+GNU Radio Companion 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 this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+"""
+
+import pygtk
+pygtk.require('2.0')
+import gtk
+from Dialogs import MessageDialogHelper
+from Constants import \
+ DEFAULT_FILE_PATH, IMAGE_FILE_EXTENSION, \
+ NEW_FLOGRAPH_TITLE
+import Preferences
+from os import path
+import Utils
+
+##################################################
+# Constants
+##################################################
+OPEN_FLOW_GRAPH = 'open flow graph'
+SAVE_FLOW_GRAPH = 'save flow graph'
+SAVE_IMAGE = 'save image'
+
+FILE_OVERWRITE_MARKUP_TMPL="""\
+File <b>$encode($filename)</b> Exists!\nWould you like to overwrite the existing file?"""
+
+FILE_DNE_MARKUP_TMPL="""\
+File <b>$encode($filename)</b> Does not Exist!"""
+
+##################################################
+# File Filters
+##################################################
+##the filter for flow graph files
+def get_flow_graph_files_filter():
+ filter = gtk.FileFilter()
+ filter.set_name('Flow Graph Files')
+ filter.add_pattern('*'+Preferences.file_extension())
+ return filter
+
+##the filter for image files
+def get_image_files_filter():
+ filter = gtk.FileFilter()
+ filter.set_name('Image Files')
+ filter.add_pattern('*'+IMAGE_FILE_EXTENSION)
+ return filter
+
+##the filter for all files
+def get_all_files_filter():
+ filter = gtk.FileFilter()
+ filter.set_name('All Files')
+ filter.add_pattern('*')
+ return filter
+
+##################################################
+# File Dialogs
+##################################################
+class FileDialogHelper(gtk.FileChooserDialog):
+ """
+ A wrapper class for the gtk file chooser dialog.
+ Implement a file chooser dialog with only necessary parameters.
+ """
+
+ def __init__(self, action, title):
+ """
+ FileDialogHelper contructor.
+ Create a save or open dialog with cancel and ok buttons.
+ Use standard settings: no multiple selection, local files only, and the * filter.
+ @param action gtk.FILE_CHOOSER_ACTION_OPEN or gtk.FILE_CHOOSER_ACTION_SAVE
+ @param title the title of the dialog (string)
+ """
+ ok_stock = {gtk.FILE_CHOOSER_ACTION_OPEN : 'gtk-open', gtk.FILE_CHOOSER_ACTION_SAVE : 'gtk-save'}[action]
+ gtk.FileChooserDialog.__init__(self, title, None, action, ('gtk-cancel', gtk.RESPONSE_CANCEL, ok_stock, gtk.RESPONSE_OK))
+ self.set_select_multiple(False)
+ self.set_local_only(True)
+ self.add_filter(get_all_files_filter())
+
+class FileDialog(FileDialogHelper):
+ """A dialog box to save or open flow graph files. This is a base class, do not use."""
+
+ def __init__(self, current_file_path=''):
+ """
+ FileDialog constructor.
+ @param current_file_path the current directory or path to the open flow graph
+ """
+ if not current_file_path: current_file_path = path.join(DEFAULT_FILE_PATH, NEW_FLOGRAPH_TITLE + Preferences.file_extension())
+ if self.type == OPEN_FLOW_GRAPH:
+ FileDialogHelper.__init__(self, gtk.FILE_CHOOSER_ACTION_OPEN, 'Open a Flow Graph from a File...')
+ self.add_and_set_filter(get_flow_graph_files_filter())
+ self.set_select_multiple(True)
+ elif self.type == SAVE_FLOW_GRAPH:
+ FileDialogHelper.__init__(self, gtk.FILE_CHOOSER_ACTION_SAVE, 'Save a Flow Graph to a File...')
+ self.add_and_set_filter(get_flow_graph_files_filter())
+ self.set_current_name(path.basename(current_file_path)) #show the current filename
+ elif self.type == SAVE_IMAGE:
+ FileDialogHelper.__init__(self, gtk.FILE_CHOOSER_ACTION_SAVE, 'Save a Flow Graph Screen Shot...')
+ self.add_and_set_filter(get_image_files_filter())
+ current_file_path = current_file_path + IMAGE_FILE_EXTENSION
+ self.set_current_name(path.basename(current_file_path)) #show the current filename
+ self.set_current_folder(path.dirname(current_file_path)) #current directory
+
+ def add_and_set_filter(self, filter):
+ """
+ Add the gtk file filter to the list of filters and set it as the default file filter.
+ @param filter a gtk file filter.
+ """
+ self.add_filter(filter)
+ self.set_filter(filter)
+
+ def get_rectified_filename(self):
+ """
+ Run the dialog and get the filename.
+ If this is a save dialog and the file name is missing the extension, append the file extension.
+ If the file name with the extension already exists, show a overwrite dialog.
+ If this is an open dialog, return a list of filenames.
+ @return the complete file path
+ """
+ if gtk.FileChooserDialog.run(self) != gtk.RESPONSE_OK: return None #response was cancel
+ #############################################
+ # Handle Save Dialogs
+ #############################################
+ if self.type in (SAVE_FLOW_GRAPH, SAVE_IMAGE):
+ filename = self.get_filename()
+ extension = {
+ SAVE_FLOW_GRAPH: Preferences.file_extension(),
+ SAVE_IMAGE: IMAGE_FILE_EXTENSION,
+ }[self.type]
+ #append the missing file extension if the filter matches
+ if path.splitext(filename)[1].lower() != extension: filename += extension
+ self.set_current_name(path.basename(filename)) #show the filename with extension
+ if path.exists(filename): #ask the user to confirm overwrite
+ if MessageDialogHelper(
+ gtk.MESSAGE_QUESTION, gtk.BUTTONS_YES_NO, 'Confirm Overwrite!',
+ Utils.parse_template(FILE_OVERWRITE_MARKUP_TMPL, filename=filename),
+ ) == gtk.RESPONSE_NO: return self.get_rectified_filename()
+ return filename
+ #############################################
+ # Handle Open Dialogs
+ #############################################
+ elif self.type in (OPEN_FLOW_GRAPH,):
+ filenames = self.get_filenames()
+ for filename in filenames:
+ if not path.exists(filename): #show a warning and re-run
+ MessageDialogHelper(
+ gtk.MESSAGE_WARNING, gtk.BUTTONS_CLOSE, 'Cannot Open!',
+ Utils.parse_template(FILE_DNE_MARKUP_TMPL, filename=filename),
+ )
+ return self.get_rectified_filename()
+ return filenames
+
+ def run(self):
+ """
+ Get the filename and destroy the dialog.
+ @return the filename or None if a close/cancel occured.
+ """
+ filename = self.get_rectified_filename()
+ self.destroy()
+ return filename
+
+class OpenFlowGraphFileDialog(FileDialog): type = OPEN_FLOW_GRAPH
+class SaveFlowGraphFileDialog(FileDialog): type = SAVE_FLOW_GRAPH
+class SaveImageFileDialog(FileDialog): type = SAVE_IMAGE
diff --git a/grc/gui/FlowGraph.py b/grc/gui/FlowGraph.py
new file mode 100644
index 000000000..6af4bcb62
--- /dev/null
+++ b/grc/gui/FlowGraph.py
@@ -0,0 +1,524 @@
+"""
+Copyright 2007-2011 Free Software Foundation, Inc.
+This file is part of GNU Radio
+
+GNU Radio Companion 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 2
+of the License, or (at your option) any later version.
+
+GNU Radio Companion 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 this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+"""
+
+from Constants import SCROLL_PROXIMITY_SENSITIVITY, SCROLL_DISTANCE
+import Actions
+import Colors
+import Utils
+from Element import Element
+import pygtk
+pygtk.require('2.0')
+import gtk
+import random
+import Messages
+
+class FlowGraph(Element):
+ """
+ FlowGraph is the data structure to store graphical signal blocks,
+ graphical inputs and outputs,
+ and the connections between inputs and outputs.
+ """
+
+ def __init__(self):
+ """
+ FlowGraph contructor.
+ Create a list for signal blocks and connections. Connect mouse handlers.
+ """
+ Element.__init__(self)
+ #when is the flow graph selected? (used by keyboard event handler)
+ self.is_selected = lambda: bool(self.get_selected_elements())
+ #important vars dealing with mouse event tracking
+ self.element_moved = False
+ self.mouse_pressed = False
+ self.unselect()
+ self.press_coor = (0, 0)
+ #selected ports
+ self._old_selected_port = None
+ self._new_selected_port = None
+ #context menu
+ self._context_menu = gtk.Menu()
+ for action in [
+ Actions.BLOCK_CUT,
+ Actions.BLOCK_COPY,
+ Actions.BLOCK_PASTE,
+ Actions.ELEMENT_DELETE,
+ Actions.BLOCK_ROTATE_CCW,
+ Actions.BLOCK_ROTATE_CW,
+ Actions.BLOCK_ENABLE,
+ Actions.BLOCK_DISABLE,
+ Actions.BLOCK_PARAM_MODIFY,
+ Actions.BLOCK_CREATE_HIER,
+ Actions.OPEN_HIER,
+ ]: self._context_menu.append(action.create_menu_item())
+
+ ###########################################################################
+ # Access Drawing Area
+ ###########################################################################
+ def get_drawing_area(self): return self.drawing_area
+ def queue_draw(self): self.get_drawing_area().queue_draw()
+ def get_size(self): return self.get_drawing_area().get_size_request()
+ def set_size(self, *args): self.get_drawing_area().set_size_request(*args)
+ def get_scroll_pane(self): return self.drawing_area.get_parent()
+ def get_ctrl_mask(self): return self.drawing_area.ctrl_mask
+ def new_pixmap(self, *args): return self.get_drawing_area().new_pixmap(*args)
+
+ def add_new_block(self, key, coor=None):
+ """
+ Add a block of the given key to this flow graph.
+ @param key the block key
+ @param coor an optional coordinate or None for random
+ """
+ id = self._get_unique_id(key)
+ #calculate the position coordinate
+ h_adj = self.get_scroll_pane().get_hadjustment()
+ v_adj = self.get_scroll_pane().get_vadjustment()
+ if coor is None: coor = (
+ int(random.uniform(.25, .75)*h_adj.page_size + h_adj.get_value()),
+ int(random.uniform(.25, .75)*v_adj.page_size + v_adj.get_value()),
+ )
+ #get the new block
+ block = self.get_new_block(key)
+ block.set_coordinate(coor)
+ block.set_rotation(0)
+ block.get_param('id').set_value(id)
+ Actions.ELEMENT_CREATE()
+
+ return id
+
+ ###########################################################################
+ # Copy Paste
+ ###########################################################################
+ def copy_to_clipboard(self):
+ """
+ Copy the selected blocks and connections into the clipboard.
+ @return the clipboard
+ """
+ #get selected blocks
+ blocks = self.get_selected_blocks()
+ if not blocks: return None
+ #calc x and y min
+ x_min, y_min = blocks[0].get_coordinate()
+ for block in blocks:
+ x, y = block.get_coordinate()
+ x_min = min(x, x_min)
+ y_min = min(y, y_min)
+ #get connections between selected blocks
+ connections = filter(
+ lambda c: c.get_source().get_parent() in blocks and c.get_sink().get_parent() in blocks,
+ self.get_connections(),
+ )
+ clipboard = (
+ (x_min, y_min),
+ [block.export_data() for block in blocks],
+ [connection.export_data() for connection in connections],
+ )
+ return clipboard
+
+ def paste_from_clipboard(self, clipboard):
+ """
+ Paste the blocks and connections from the clipboard.
+ @param clipboard the nested data of blocks, connections
+ """
+ selected = set()
+ (x_min, y_min), blocks_n, connections_n = clipboard
+ old_id2block = dict()
+ #recalc the position
+ h_adj = self.get_scroll_pane().get_hadjustment()
+ v_adj = self.get_scroll_pane().get_vadjustment()
+ x_off = h_adj.get_value() - x_min + h_adj.page_size/4
+ y_off = v_adj.get_value() - y_min + v_adj.page_size/4
+ #create blocks
+ for block_n in blocks_n:
+ block_key = block_n.find('key')
+ if block_key == 'options': continue
+ block = self.get_new_block(block_key)
+ selected.add(block)
+ #set params
+ params_n = block_n.findall('param')
+ for param_n in params_n:
+ param_key = param_n.find('key')
+ param_value = param_n.find('value')
+ #setup id parameter
+ if param_key == 'id':
+ old_id2block[param_value] = block
+ #if the block id is not unique, get a new block id
+ if param_value in [block.get_id() for block in self.get_blocks()]:
+ param_value = self._get_unique_id(param_value)
+ #set value to key
+ block.get_param(param_key).set_value(param_value)
+ #move block to offset coordinate
+ block.move((x_off, y_off))
+ #update before creating connections
+ self.update()
+ #create connections
+ for connection_n in connections_n:
+ source = old_id2block[connection_n.find('source_block_id')].get_source(connection_n.find('source_key'))
+ sink = old_id2block[connection_n.find('sink_block_id')].get_sink(connection_n.find('sink_key'))
+ self.connect(source, sink)
+ #set all pasted elements selected
+ for block in selected: selected = selected.union(set(block.get_connections()))
+ self._selected_elements = list(selected)
+
+ ###########################################################################
+ # Modify Selected
+ ###########################################################################
+ def type_controller_modify_selected(self, direction):
+ """
+ Change the registered type controller for the selected signal blocks.
+ @param direction +1 or -1
+ @return true for change
+ """
+ return any([sb.type_controller_modify(direction) for sb in self.get_selected_blocks()])
+
+ def port_controller_modify_selected(self, direction):
+ """
+ Change port controller for the selected signal blocks.
+ @param direction +1 or -1
+ @return true for changed
+ """
+ return any([sb.port_controller_modify(direction) for sb in self.get_selected_blocks()])
+
+ def enable_selected(self, enable):
+ """
+ Enable/disable the selected blocks.
+ @param enable true to enable
+ @return true if changed
+ """
+ changed = False
+ for selected_block in self.get_selected_blocks():
+ if selected_block.get_enabled() != enable:
+ selected_block.set_enabled(enable)
+ changed = True
+ return changed
+
+ def move_selected(self, delta_coordinate):
+ """
+ Move the element and by the change in coordinates.
+ @param delta_coordinate the change in coordinates
+ """
+ for selected_block in self.get_selected_blocks():
+ selected_block.move(delta_coordinate)
+ self.element_moved = True
+
+ def rotate_selected(self, rotation):
+ """
+ Rotate the selected blocks by multiples of 90 degrees.
+ @param rotation the rotation in degrees
+ @return true if changed, otherwise false.
+ """
+ if not self.get_selected_blocks(): return False
+ #initialize min and max coordinates
+ min_x, min_y = self.get_selected_block().get_coordinate()
+ max_x, max_y = self.get_selected_block().get_coordinate()
+ #rotate each selected block, and find min/max coordinate
+ for selected_block in self.get_selected_blocks():
+ selected_block.rotate(rotation)
+ #update the min/max coordinate
+ x, y = selected_block.get_coordinate()
+ min_x, min_y = min(min_x, x), min(min_y, y)
+ max_x, max_y = max(max_x, x), max(max_y, y)
+ #calculate center point of slected blocks
+ ctr_x, ctr_y = (max_x + min_x)/2, (max_y + min_y)/2
+ #rotate the blocks around the center point
+ for selected_block in self.get_selected_blocks():
+ x, y = selected_block.get_coordinate()
+ x, y = Utils.get_rotated_coordinate((x - ctr_x, y - ctr_y), rotation)
+ selected_block.set_coordinate((x + ctr_x, y + ctr_y))
+ return True
+
+ def remove_selected(self):
+ """
+ Remove selected elements
+ @return true if changed.
+ """
+ changed = False
+ for selected_element in self.get_selected_elements():
+ self.remove_element(selected_element)
+ changed = True
+ return changed
+
+ def draw(self, gc, window):
+ """
+ Draw the background and grid if enabled.
+ Draw all of the elements in this flow graph onto the pixmap.
+ Draw the pixmap to the drawable window of this flow graph.
+ """
+ W,H = self.get_size()
+ #draw the background
+ gc.set_foreground(Colors.FLOWGRAPH_BACKGROUND_COLOR)
+ window.draw_rectangle(gc, True, 0, 0, W, H)
+ #draw multi select rectangle
+ if self.mouse_pressed and (not self.get_selected_elements() or self.get_ctrl_mask()):
+ #coordinates
+ x1, y1 = self.press_coor
+ x2, y2 = self.get_coordinate()
+ #calculate top-left coordinate and width/height
+ x, y = int(min(x1, x2)), int(min(y1, y2))
+ w, h = int(abs(x1 - x2)), int(abs(y1 - y2))
+ #draw
+ gc.set_foreground(Colors.HIGHLIGHT_COLOR)
+ window.draw_rectangle(gc, True, x, y, w, h)
+ gc.set_foreground(Colors.BORDER_COLOR)
+ window.draw_rectangle(gc, False, x, y, w, h)
+ #draw blocks on top of connections
+ for element in self.get_connections() + self.get_blocks():
+ element.draw(gc, window)
+ #draw selected blocks on top of selected connections
+ for selected_element in self.get_selected_connections() + self.get_selected_blocks():
+ selected_element.draw(gc, window)
+
+ def update_selected(self):
+ """
+ Remove deleted elements from the selected elements list.
+ Update highlighting so only the selected are highlighted.
+ """
+ selected_elements = self.get_selected_elements()
+ elements = self.get_elements()
+ #remove deleted elements
+ for selected in selected_elements:
+ if selected in elements: continue
+ selected_elements.remove(selected)
+ if self._old_selected_port and self._old_selected_port.get_parent() not in elements:
+ self._old_selected_port = None
+ if self._new_selected_port and self._new_selected_port.get_parent() not in elements:
+ self._new_selected_port = None
+ #update highlighting
+ for element in elements:
+ element.set_highlighted(element in selected_elements)
+
+ def update(self):
+ """
+ Call the top level rewrite and validate.
+ Call the top level create labels and shapes.
+ """
+ self.rewrite()
+ self.validate()
+ self.create_labels()
+ self.create_shapes()
+
+ ##########################################################################
+ ## Get Selected
+ ##########################################################################
+ def unselect(self):
+ """
+ Set selected elements to an empty set.
+ """
+ self._selected_elements = []
+
+ def what_is_selected(self, coor, coor_m=None):
+ """
+ What is selected?
+ At the given coordinate, return the elements found to be selected.
+ If coor_m is unspecified, return a list of only the first element found to be selected:
+ Iterate though the elements backwards since top elements are at the end of the list.
+ If an element is selected, place it at the end of the list so that is is drawn last,
+ and hence on top. Update the selected port information.
+ @param coor the coordinate of the mouse click
+ @param coor_m the coordinate for multi select
+ @return the selected blocks and connections or an empty list
+ """
+ selected_port = None
+ selected = set()
+ #check the elements
+ for element in reversed(self.get_elements()):
+ selected_element = element.what_is_selected(coor, coor_m)
+ if not selected_element: continue
+ #update the selected port information
+ if selected_element.is_port():
+ if not coor_m: selected_port = selected_element
+ selected_element = selected_element.get_parent()
+ selected.add(selected_element)
+ #place at the end of the list
+ self.get_elements().remove(element)
+ self.get_elements().append(element)
+ #single select mode, break
+ if not coor_m: break
+ #update selected ports
+ self._old_selected_port = self._new_selected_port
+ self._new_selected_port = selected_port
+ return list(selected)
+
+ def get_selected_connections(self):
+ """
+ Get a group of selected connections.
+ @return sub set of connections in this flow graph
+ """
+ selected = set()
+ for selected_element in self.get_selected_elements():
+ if selected_element.is_connection(): selected.add(selected_element)
+ return list(selected)
+
+ def get_selected_blocks(self):
+ """
+ Get a group of selected blocks.
+ @return sub set of blocks in this flow graph
+ """
+ selected = set()
+ for selected_element in self.get_selected_elements():
+ if selected_element.is_block(): selected.add(selected_element)
+ return list(selected)
+
+ def get_selected_block(self):
+ """
+ Get the selected block when a block or port is selected.
+ @return a block or None
+ """
+ return self.get_selected_blocks() and self.get_selected_blocks()[0] or None
+
+ def get_selected_elements(self):
+ """
+ Get the group of selected elements.
+ @return sub set of elements in this flow graph
+ """
+ return self._selected_elements
+
+ def get_selected_element(self):
+ """
+ Get the selected element.
+ @return a block, port, or connection or None
+ """
+ return self.get_selected_elements() and self.get_selected_elements()[0] or None
+
+ def update_selected_elements(self):
+ """
+ Update the selected elements.
+ The update behavior depends on the state of the mouse button.
+ When the mouse button pressed the selection will change when
+ the control mask is set or the new selection is not in the current group.
+ When the mouse button is released the selection will change when
+ the mouse has moved and the control mask is set or the current group is empty.
+ Attempt to make a new connection if the old and ports are filled.
+ If the control mask is set, merge with the current elements.
+ """
+ selected_elements = None
+ if self.mouse_pressed:
+ new_selections = self.what_is_selected(self.get_coordinate())
+ #update the selections if the new selection is not in the current selections
+ #allows us to move entire selected groups of elements
+ if self.get_ctrl_mask() or not (
+ new_selections and new_selections[0] in self.get_selected_elements()
+ ): selected_elements = new_selections
+ else: #called from a mouse release
+ if not self.element_moved and (not self.get_selected_elements() or self.get_ctrl_mask()):
+ selected_elements = self.what_is_selected(self.get_coordinate(), self.press_coor)
+ #this selection and the last were ports, try to connect them
+ if self._old_selected_port and self._new_selected_port and \
+ self._old_selected_port is not self._new_selected_port:
+ try:
+ self.connect(self._old_selected_port, self._new_selected_port)
+ Actions.ELEMENT_CREATE()
+ except: Messages.send_fail_connection()
+ self._old_selected_port = None
+ self._new_selected_port = None
+ return
+ #update selected elements
+ if selected_elements is None: return
+ old_elements = set(self.get_selected_elements())
+ self._selected_elements = list(set(selected_elements))
+ new_elements = set(self.get_selected_elements())
+ #if ctrl, set the selected elements to the union - intersection of old and new
+ if self.get_ctrl_mask():
+ self._selected_elements = list(
+ set.union(old_elements, new_elements) - set.intersection(old_elements, new_elements)
+ )
+ Actions.ELEMENT_SELECT()
+
+ ##########################################################################
+ ## Event Handlers
+ ##########################################################################
+ def handle_mouse_context_press(self, coordinate, event):
+ """
+ The context mouse button was pressed:
+ If no elements were selected, perform re-selection at this coordinate.
+ Then, show the context menu at the mouse click location.
+ """
+ selections = self.what_is_selected(coordinate)
+ if not set(selections).intersection(self.get_selected_elements()):
+ self.set_coordinate(coordinate)
+ self.mouse_pressed = True
+ self.update_selected_elements()
+ self.mouse_pressed = False
+ self._context_menu.popup(None, None, None, event.button, event.time)
+
+ def handle_mouse_selector_press(self, double_click, coordinate):
+ """
+ The selector mouse button was pressed:
+ Find the selected element. Attempt a new connection if possible.
+ Open the block params window on a double click.
+ Update the selection state of the flow graph.
+ """
+ self.press_coor = coordinate
+ self.set_coordinate(coordinate)
+ self.time = 0
+ self.mouse_pressed = True
+ if double_click: self.unselect()
+ self.update_selected_elements()
+ #double click detected, bring up params dialog if possible
+ if double_click and self.get_selected_block():
+ self.mouse_pressed = False
+ Actions.BLOCK_PARAM_MODIFY()
+
+ def handle_mouse_selector_release(self, coordinate):
+ """
+ The selector mouse button was released:
+ Update the state, handle motion (dragging).
+ And update the selected flowgraph elements.
+ """
+ self.set_coordinate(coordinate)
+ self.time = 0
+ self.mouse_pressed = False
+ if self.element_moved:
+ Actions.BLOCK_MOVE()
+ self.element_moved = False
+ self.update_selected_elements()
+
+ def handle_mouse_motion(self, coordinate):
+ """
+ The mouse has moved, respond to mouse dragging.
+ Move a selected element to the new coordinate.
+ Auto-scroll the scroll bars at the boundaries.
+ """
+ #to perform a movement, the mouse must be pressed
+ # (no longer checking pending events via gtk.events_pending() - always true in Windows)
+ if not self.mouse_pressed: return
+ #perform autoscrolling
+ width, height = self.get_size()
+ x, y = coordinate
+ h_adj = self.get_scroll_pane().get_hadjustment()
+ v_adj = self.get_scroll_pane().get_vadjustment()
+ for pos, length, adj, adj_val, adj_len in (
+ (x, width, h_adj, h_adj.get_value(), h_adj.page_size),
+ (y, height, v_adj, v_adj.get_value(), v_adj.page_size),
+ ):
+ #scroll if we moved near the border
+ if pos-adj_val > adj_len-SCROLL_PROXIMITY_SENSITIVITY and adj_val+SCROLL_DISTANCE < length-adj_len:
+ adj.set_value(adj_val+SCROLL_DISTANCE)
+ adj.emit('changed')
+ elif pos-adj_val < SCROLL_PROXIMITY_SENSITIVITY:
+ adj.set_value(adj_val-SCROLL_DISTANCE)
+ adj.emit('changed')
+ #remove the connection if selected in drag event
+ if len(self.get_selected_elements()) == 1 and self.get_selected_element().is_connection():
+ Actions.ELEMENT_DELETE()
+ #move the selected elements and record the new coordinate
+ X, Y = self.get_coordinate()
+ if not self.get_ctrl_mask(): self.move_selected((int(x - X), int(y - Y)))
+ self.set_coordinate((x, y))
+ #queue draw for animation
+ self.queue_draw()
diff --git a/grc/gui/MainWindow.py b/grc/gui/MainWindow.py
new file mode 100644
index 000000000..1dc02dabb
--- /dev/null
+++ b/grc/gui/MainWindow.py
@@ -0,0 +1,327 @@
+"""
+Copyright 2008, 2009, 2011 Free Software Foundation, Inc.
+This file is part of GNU Radio
+
+GNU Radio Companion 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 2
+of the License, or (at your option) any later version.
+
+GNU Radio Companion 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 this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+"""
+
+from Constants import \
+ NEW_FLOGRAPH_TITLE, DEFAULT_REPORTS_WINDOW_WIDTH
+import Actions
+import pygtk
+pygtk.require('2.0')
+import gtk
+import Bars
+from BlockTreeWindow import BlockTreeWindow
+from Dialogs import TextDisplay, MessageDialogHelper
+from NotebookPage import NotebookPage
+import Preferences
+import Messages
+import Utils
+import os
+
+MAIN_WINDOW_TITLE_TMPL = """\
+#if not $saved
+*#slurp
+#end if
+#if $basename
+$basename#slurp
+#else
+$new_flowgraph_title#slurp
+#end if
+#if $read_only
+ (read only)#slurp
+#end if
+#if $dirname
+ - $dirname#slurp
+#end if
+ - $platform_name#slurp
+"""
+
+PAGE_TITLE_MARKUP_TMPL = """\
+#set $foreground = $saved and 'black' or 'red'
+<span foreground="$foreground">$encode($title or $new_flowgraph_title)</span>#slurp
+#if $read_only
+ (ro)#slurp
+#end if
+"""
+
+############################################################
+# Main window
+############################################################
+
+class MainWindow(gtk.Window):
+ """The topmost window with menus, the tool bar, and other major windows."""
+
+ def __init__(self, platform):
+ """
+ MainWindow contructor
+ Setup the menu, toolbar, flowgraph editor notebook, block selection window...
+ """
+ self._platform = platform
+ #setup window
+ gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL)
+ vbox = gtk.VBox()
+ self.hpaned = gtk.HPaned()
+ self.add(vbox)
+ #create the menu bar and toolbar
+ self.add_accel_group(Actions.get_accel_group())
+ vbox.pack_start(Bars.MenuBar(), False)
+ vbox.pack_start(Bars.Toolbar(), False)
+ vbox.pack_start(self.hpaned)
+ #create the notebook
+ self.notebook = gtk.Notebook()
+ self.page_to_be_closed = None
+ self.current_page = None
+ self.notebook.set_show_border(False)
+ self.notebook.set_scrollable(True) #scroll arrows for page tabs
+ self.notebook.connect('switch-page', self._handle_page_change)
+ #setup containers
+ self.flow_graph_vpaned = gtk.VPaned()
+ #flow_graph_box.pack_start(self.scrolled_window)
+ self.flow_graph_vpaned.pack1(self.notebook)
+ self.hpaned.pack1(self.flow_graph_vpaned)
+ self.btwin = BlockTreeWindow(platform, self.get_flow_graph);
+ self.hpaned.pack2(self.btwin, False) #dont allow resize
+ #create the reports window
+ self.text_display = TextDisplay()
+ #house the reports in a scrolled window
+ self.reports_scrolled_window = gtk.ScrolledWindow()
+ self.reports_scrolled_window.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
+ self.reports_scrolled_window.add_with_viewport(self.text_display)
+ self.reports_scrolled_window.set_size_request(-1, DEFAULT_REPORTS_WINDOW_WIDTH)
+ self.flow_graph_vpaned.pack2(self.reports_scrolled_window, False) #dont allow resize
+ #load preferences and show the main window
+ Preferences.load(platform)
+ self.resize(*Preferences.main_window_size())
+ self.flow_graph_vpaned.set_position(Preferences.reports_window_position())
+ self.hpaned.set_position(Preferences.blocks_window_position())
+ self.show_all()
+
+ ############################################################
+ # Event Handlers
+ ############################################################
+
+ def _quit(self, window, event):
+ """
+ Handle the delete event from the main window.
+ Generated by pressing X to close, alt+f4, or right click+close.
+ This method in turns calls the state handler to quit.
+ @return true
+ """
+ Actions.APPLICATION_QUIT()
+ return True
+
+ def _handle_page_change(self, notebook, page, page_num):
+ """
+ Handle a page change. When the user clicks on a new tab,
+ reload the flow graph to update the vars window and
+ call handle states (select nothing) to update the buttons.
+ @param notebook the notebook
+ @param page new page
+ @param page_num new page number
+ """
+ self.current_page = self.notebook.get_nth_page(page_num)
+ Messages.send_page_switch(self.current_page.get_file_path())
+ Actions.PAGE_CHANGE()
+
+ ############################################################
+ # Report Window
+ ############################################################
+
+ def add_report_line(self, line):
+ """
+ Place line at the end of the text buffer, then scroll its window all the way down.
+ @param line the new text
+ """
+ self.text_display.insert(line)
+ vadj = self.reports_scrolled_window.get_vadjustment()
+ vadj.set_value(vadj.upper)
+ vadj.emit('changed')
+
+ ############################################################
+ # Pages: create and close
+ ############################################################
+
+ def new_page(self, file_path='', show=False):
+ """
+ Create a new notebook page.
+ Set the tab to be selected.
+ @param file_path optional file to load into the flow graph
+ @param show true if the page should be shown after loading
+ """
+ #if the file is already open, show the open page and return
+ if file_path and file_path in self._get_files(): #already open
+ page = self.notebook.get_nth_page(self._get_files().index(file_path))
+ self._set_page(page)
+ return
+ try: #try to load from file
+ if file_path: Messages.send_start_load(file_path)
+ flow_graph = self._platform.get_new_flow_graph()
+ flow_graph.grc_file_path = file_path;
+ #print flow_graph
+ page = NotebookPage(
+ self,
+ flow_graph=flow_graph,
+ file_path=file_path,
+ )
+ if file_path: Messages.send_end_load()
+ except Exception, e: #return on failure
+ Messages.send_fail_load(e)
+ if isinstance(e, KeyError) and str(e) == "'options'":
+ # This error is unrecoverable, so crash gracefully
+ exit(-1)
+ return
+ #add this page to the notebook
+ self.notebook.append_page(page, page.get_tab())
+ try: self.notebook.set_tab_reorderable(page, True)
+ except: pass #gtk too old
+ self.notebook.set_tab_label_packing(page, False, False, gtk.PACK_START)
+ #only show if blank or manual
+ if not file_path or show: self._set_page(page)
+
+ def close_pages(self):
+ """
+ Close all the pages in this notebook.
+ @return true if all closed
+ """
+ open_files = filter(lambda file: file, self._get_files()) #filter blank files
+ open_file = self.get_page().get_file_path()
+ #close each page
+ for page in self._get_pages():
+ self.page_to_be_closed = page
+ self.close_page(False)
+ if self.notebook.get_n_pages(): return False
+ #save state before closing
+ Preferences.files_open(open_files)
+ Preferences.file_open(open_file)
+ Preferences.main_window_size(self.get_size())
+ Preferences.reports_window_position(self.flow_graph_vpaned.get_position())
+ Preferences.blocks_window_position(self.hpaned.get_position())
+ Preferences.save()
+ return True
+
+ def close_page(self, ensure=True):
+ """
+ Close the current page.
+ If the notebook becomes empty, and ensure is true,
+ call new page upon exit to ensure that at least one page exists.
+ @param ensure boolean
+ """
+ if not self.page_to_be_closed: self.page_to_be_closed = self.get_page()
+ #show the page if it has an executing flow graph or is unsaved
+ if self.page_to_be_closed.get_proc() or not self.page_to_be_closed.get_saved():
+ self._set_page(self.page_to_be_closed)
+ #unsaved? ask the user
+ if not self.page_to_be_closed.get_saved() and self._save_changes():
+ Actions.FLOW_GRAPH_SAVE() #try to save
+ if not self.page_to_be_closed.get_saved(): #still unsaved?
+ self.page_to_be_closed = None #set the page to be closed back to None
+ return
+ #stop the flow graph if executing
+ if self.page_to_be_closed.get_proc(): Actions.FLOW_GRAPH_KILL()
+ #remove the page
+ self.notebook.remove_page(self.notebook.page_num(self.page_to_be_closed))
+ if ensure and self.notebook.get_n_pages() == 0: self.new_page() #no pages, make a new one
+ self.page_to_be_closed = None #set the page to be closed back to None
+
+ ############################################################
+ # Misc
+ ############################################################
+
+ def update(self):
+ """
+ Set the title of the main window.
+ Set the titles on the page tabs.
+ Show/hide the reports window.
+ @param title the window title
+ """
+ gtk.Window.set_title(self, Utils.parse_template(MAIN_WINDOW_TITLE_TMPL,
+ basename=os.path.basename(self.get_page().get_file_path()),
+ dirname=os.path.dirname(self.get_page().get_file_path()),
+ new_flowgraph_title=NEW_FLOGRAPH_TITLE,
+ read_only=self.get_page().get_read_only(),
+ saved=self.get_page().get_saved(),
+ platform_name=self._platform.get_name(),
+ )
+ )
+ #set tab titles
+ for page in self._get_pages(): page.set_markup(
+ Utils.parse_template(PAGE_TITLE_MARKUP_TMPL,
+ #get filename and strip out file extension
+ title=os.path.splitext(os.path.basename(page.get_file_path()))[0],
+ read_only=page.get_read_only(), saved=page.get_saved(),
+ new_flowgraph_title=NEW_FLOGRAPH_TITLE,
+ )
+ )
+ #show/hide notebook tabs
+ self.notebook.set_show_tabs(len(self._get_pages()) > 1)
+
+ def get_page(self):
+ """
+ Get the selected page.
+ @return the selected page
+ """
+ return self.current_page
+
+ def get_flow_graph(self):
+ """
+ Get the selected flow graph.
+ @return the selected flow graph
+ """
+ return self.get_page().get_flow_graph()
+
+ def get_focus_flag(self):
+ """
+ Get the focus flag from the current page.
+ @return the focus flag
+ """
+ return self.get_page().get_drawing_area().get_focus_flag()
+
+ ############################################################
+ # Helpers
+ ############################################################
+
+ def _set_page(self, page):
+ """
+ Set the current page.
+ @param page the page widget
+ """
+ self.current_page = page
+ self.notebook.set_current_page(self.notebook.page_num(self.current_page))
+
+ def _save_changes(self):
+ """
+ Save changes to flow graph?
+ @return true if yes
+ """
+ return MessageDialogHelper(
+ gtk.MESSAGE_QUESTION, gtk.BUTTONS_YES_NO, 'Unsaved Changes!',
+ 'Would you like to save changes before closing?'
+ ) == gtk.RESPONSE_YES
+
+ def _get_files(self):
+ """
+ Get the file names for all the pages, in order.
+ @return list of file paths
+ """
+ return map(lambda page: page.get_file_path(), self._get_pages())
+
+ def _get_pages(self):
+ """
+ Get a list of all pages in the notebook.
+ @return list of pages
+ """
+ return [self.notebook.get_nth_page(page_num) for page_num in range(self.notebook.get_n_pages())]
diff --git a/grc/gui/Messages.py b/grc/gui/Messages.py
new file mode 100644
index 000000000..e98e897aa
--- /dev/null
+++ b/grc/gui/Messages.py
@@ -0,0 +1,104 @@
+"""
+Copyright 2007 Free Software Foundation, Inc.
+This file is part of GNU Radio
+
+GNU Radio Companion 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 2
+of the License, or (at your option) any later version.
+
+GNU Radio Companion 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 this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+"""
+
+import traceback
+import sys
+
+## A list of functions that can receive a message.
+MESSENGERS_LIST = list()
+
+def register_messenger(messenger):
+ """
+ Append the given messenger to the list of messengers.
+ @param messenger a method thats takes a string
+ """
+ MESSENGERS_LIST.append(messenger)
+
+def send(message):
+ """
+ Give the message to each of the messengers.
+ @param message a message string
+ """
+ for messenger in MESSENGERS_LIST: messenger(message)
+
+#register stdout by default
+register_messenger(sys.stdout.write)
+
+###########################################################################
+# Special functions for specific program functionalities
+###########################################################################
+def send_init(platform):
+ send("""<<< Welcome to %s %s >>>\n"""%(platform.get_name(), platform.get_version()))
+
+def send_page_switch(file_path):
+ send('\nShowing: "%s"\n'%file_path)
+
+################# functions for loading flow graphs ########################################
+def send_start_load(file_path):
+ send('\nLoading: "%s"'%file_path + '\n')
+
+def send_error_load(error):
+ send('>>> Error: %s\n'%error)
+ traceback.print_exc()
+
+def send_end_load():
+ send('>>> Done\n')
+
+def send_fail_load(error):
+ send('Error: %s\n'%error)
+ send('>>> Failure\n')
+ traceback.print_exc()
+
+################# functions for generating flow graphs ########################################
+def send_start_gen(file_path):
+ send('\nGenerating: "%s"'%file_path + '\n')
+
+def send_fail_gen(error):
+ send('Generate Error: %s\n'%error)
+ send('>>> Failure\n')
+ traceback.print_exc()
+
+################# functions for executing flow graphs ########################################
+def send_start_exec(file_path):
+ send('\nExecuting: "%s"'%file_path + '\n')
+
+def send_verbose_exec(verbose):
+ send(verbose)
+
+def send_end_exec():
+ send('\n>>> Done\n')
+
+################# functions for saving flow graphs ########################################
+def send_fail_save(file_path):
+ send('>>> Error: Cannot save: %s\n'%file_path)
+
+################# functions for connections ########################################
+def send_fail_connection():
+ send('>>> Error: Cannot create connection.\n')
+
+################# functions for preferences ########################################
+def send_fail_load_preferences(prefs_file_path):
+ send('>>> Error: Cannot load preferences file: "%s"\n'%prefs_file_path)
+
+def send_fail_save_preferences(prefs_file_path):
+ send('>>> Error: Cannot save preferences file: "%s"\n'%prefs_file_path)
+
+################# functions for warning ########################################
+def send_warning(warning):
+ send('>>> Warning: %s\n'%warning)
diff --git a/grc/gui/NotebookPage.py b/grc/gui/NotebookPage.py
new file mode 100644
index 000000000..86b6f1513
--- /dev/null
+++ b/grc/gui/NotebookPage.py
@@ -0,0 +1,187 @@
+"""
+Copyright 2008, 2009, 2011 Free Software Foundation, Inc.
+This file is part of GNU Radio
+
+GNU Radio Companion 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 2
+of the License, or (at your option) any later version.
+
+GNU Radio Companion 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 this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+"""
+
+import pygtk
+pygtk.require('2.0')
+import gtk
+import Actions
+from StateCache import StateCache
+from Constants import MIN_WINDOW_WIDTH, MIN_WINDOW_HEIGHT
+from DrawingArea import DrawingArea
+import os
+
+############################################################
+## Notebook Page
+############################################################
+
+class NotebookPage(gtk.HBox):
+ """A page in the notebook."""
+
+ def __init__(self, main_window, flow_graph, file_path=''):
+ """
+ Page constructor.
+ @param main_window main window
+ @param file_path path to a flow graph file
+ """
+ self._flow_graph = flow_graph
+ self.set_proc(None)
+ #import the file
+ self.main_window = main_window
+ self.set_file_path(file_path)
+ initial_state = flow_graph.get_parent().parse_flow_graph(file_path)
+ self.state_cache = StateCache(initial_state)
+ self.set_saved(True)
+ #import the data to the flow graph
+ self.get_flow_graph().import_data(initial_state)
+ #initialize page gui
+ gtk.HBox.__init__(self, False, 0)
+ self.show()
+ #tab box to hold label and close button
+ self.tab = gtk.HBox(False, 0)
+ #setup tab label
+ self.label = gtk.Label()
+ self.tab.pack_start(self.label, False)
+ #setup button image
+ image = gtk.Image()
+ image.set_from_stock('gtk-close', gtk.ICON_SIZE_MENU)
+ #setup image box
+ image_box = gtk.HBox(False, 0)
+ image_box.pack_start(image, True, False, 0)
+ #setup the button
+ button = gtk.Button()
+ button.connect("clicked", self._handle_button)
+ button.set_relief(gtk.RELIEF_NONE)
+ button.add(image_box)
+ #button size
+ w, h = gtk.icon_size_lookup_for_settings(button.get_settings(), gtk.ICON_SIZE_MENU)
+ button.set_size_request(w+6, h+6)
+ self.tab.pack_start(button, False)
+ self.tab.show_all()
+ #setup scroll window and drawing area
+ self.scrolled_window = gtk.ScrolledWindow()
+ self.scrolled_window.set_size_request(MIN_WINDOW_WIDTH, MIN_WINDOW_HEIGHT)
+ self.scrolled_window.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
+ self.drawing_area = DrawingArea(self.get_flow_graph())
+ self.scrolled_window.add_with_viewport(self.get_drawing_area())
+ self.pack_start(self.scrolled_window)
+ #inject drawing area into flow graph
+ self.get_flow_graph().drawing_area = self.get_drawing_area()
+ self.show_all()
+
+ def get_drawing_area(self): return self.drawing_area
+
+ def get_generator(self):
+ """
+ Get the generator object for this flow graph.
+ @return generator
+ """
+ return self.get_flow_graph().get_parent().get_generator()(
+ self.get_flow_graph(),
+ self.get_file_path(),
+ )
+
+ def _handle_button(self, button):
+ """
+ The button was clicked.
+ Make the current page selected, then close.
+ @param the button
+ """
+ self.main_window.page_to_be_closed = self
+ Actions.FLOW_GRAPH_CLOSE()
+
+ def set_markup(self, markup):
+ """
+ Set the markup in this label.
+ @param markup the new markup text
+ """
+ self.label.set_markup(markup)
+
+ def get_tab(self):
+ """
+ Get the gtk widget for this page's tab.
+ @return gtk widget
+ """
+ return self.tab
+
+ def get_proc(self):
+ """
+ Get the subprocess for the flow graph.
+ @return the subprocess object
+ """
+ return self.process
+
+ def set_proc(self, process):
+ """
+ Set the subprocess object.
+ @param process the new subprocess
+ """
+ self.process = process
+
+ def get_flow_graph(self):
+ """
+ Get the flow graph.
+ @return the flow graph
+ """
+ return self._flow_graph
+
+ def get_read_only(self):
+ """
+ Get the read-only state of the file.
+ Always false for empty path.
+ @return true for read-only
+ """
+ if not self.get_file_path(): return False
+ return os.path.exists(self.get_file_path()) and \
+ not os.access(self.get_file_path(), os.W_OK)
+
+ def get_file_path(self):
+ """
+ Get the file path for the flow graph.
+ @return the file path or ''
+ """
+ return self.file_path
+
+ def set_file_path(self, file_path=''):
+ """
+ Set the file path, '' for no file path.
+ @param file_path file path string
+ """
+ if file_path: self.file_path = os.path.abspath(file_path)
+ else: self.file_path = ''
+
+ def get_saved(self):
+ """
+ Get the saved status for the flow graph.
+ @return true if saved
+ """
+ return self.saved
+
+ def set_saved(self, saved=True):
+ """
+ Set the saved status.
+ @param saved boolean status
+ """
+ self.saved = saved
+
+ def get_state_cache(self):
+ """
+ Get the state cache for the flow graph.
+ @return the state cache
+ """
+ return self.state_cache
diff --git a/grc/gui/Param.py b/grc/gui/Param.py
new file mode 100644
index 000000000..cb6c663e3
--- /dev/null
+++ b/grc/gui/Param.py
@@ -0,0 +1,189 @@
+"""
+Copyright 2007-2011 Free Software Foundation, Inc.
+This file is part of GNU Radio
+
+GNU Radio Companion 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 2
+of the License, or (at your option) any later version.
+
+GNU Radio Companion 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 this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+"""
+
+import Utils
+from Element import Element
+import pygtk
+pygtk.require('2.0')
+import gtk
+import Colors
+
+class InputParam(gtk.HBox):
+ """The base class for an input parameter inside the input parameters dialog."""
+
+ def __init__(self, param, callback=None):
+ gtk.HBox.__init__(self)
+ self.param = param
+ self._callback = callback
+ self.label = gtk.Label() #no label, markup is added by set_markup
+ self.label.set_size_request(150, -1)
+ self.pack_start(self.label, False)
+ self.set_markup = lambda m: self.label.set_markup(m)
+ self.tp = None
+ #connect events
+ self.connect('show', self._update_gui)
+ def set_color(self, color): pass
+ def set_tooltip_text(self, text): pass
+
+ def _update_gui(self, *args):
+ """
+ Set the markup, color, tooltip, show/hide.
+ """
+ #set the markup
+ has_cb = \
+ hasattr(self.param.get_parent(), 'get_callbacks') and \
+ filter(lambda c: self.param.get_key() in c, self.param.get_parent()._callbacks)
+ self.set_markup(Utils.parse_template(PARAM_LABEL_MARKUP_TMPL, param=self.param, has_cb=has_cb))
+ #set the color
+ self.set_color(self.param.get_color())
+ #set the tooltip
+ self.set_tooltip_text(
+ Utils.parse_template(TIP_MARKUP_TMPL, param=self.param).strip(),
+ )
+ #show/hide
+ if self.param.get_hide() == 'all': self.hide_all()
+ else: self.show_all()
+
+ def _handle_changed(self, *args):
+ """
+ Handle a gui change by setting the new param value,
+ calling the callback (if applicable), and updating.
+ """
+ #set the new value
+ self.param.set_value(self.get_text())
+ #call the callback
+ if self._callback: self._callback(*args)
+ else: self.param.validate()
+ #gui update
+ self._update_gui()
+
+class EntryParam(InputParam):
+ """Provide an entry box for strings and numbers."""
+
+ def __init__(self, *args, **kwargs):
+ InputParam.__init__(self, *args, **kwargs)
+ self._input = gtk.Entry()
+ self._input.set_text(self.param.get_value())
+ self._input.connect('changed', self._handle_changed)
+ self.pack_start(self._input, True)
+ def get_text(self): return self._input.get_text()
+ def set_color(self, color):
+ self._input.modify_base(gtk.STATE_NORMAL, gtk.gdk.color_parse(color))
+ self._input.modify_text(gtk.STATE_NORMAL, Colors.PARAM_ENTRY_TEXT_COLOR)
+ def set_tooltip_text(self, text): self._input.set_tooltip_text(text)
+
+class EnumParam(InputParam):
+ """Provide an entry box for Enum types with a drop down menu."""
+
+ def __init__(self, *args, **kwargs):
+ InputParam.__init__(self, *args, **kwargs)
+ self._input = gtk.combo_box_new_text()
+ for option in self.param.get_options(): self._input.append_text(option.get_name())
+ self._input.set_active(self.param.get_option_keys().index(self.param.get_value()))
+ self._input.connect('changed', self._handle_changed)
+ self.pack_start(self._input, False)
+ def get_text(self): return self.param.get_option_keys()[self._input.get_active()]
+ def set_tooltip_text(self, text): self._input.set_tooltip_text(text)
+
+class EnumEntryParam(InputParam):
+ """Provide an entry box and drop down menu for Raw Enum types."""
+
+ def __init__(self, *args, **kwargs):
+ InputParam.__init__(self, *args, **kwargs)
+ self._input = gtk.combo_box_entry_new_text()
+ for option in self.param.get_options(): self._input.append_text(option.get_name())
+ try: self._input.set_active(self.param.get_option_keys().index(self.param.get_value()))
+ except:
+ self._input.set_active(-1)
+ self._input.get_child().set_text(self.param.get_value())
+ self._input.connect('changed', self._handle_changed)
+ self._input.get_child().connect('changed', self._handle_changed)
+ self.pack_start(self._input, False)
+ def get_text(self):
+ if self._input.get_active() == -1: return self._input.get_child().get_text()
+ return self.param.get_option_keys()[self._input.get_active()]
+ def set_tooltip_text(self, text):
+ if self._input.get_active() == -1: #custom entry
+ self._input.get_child().set_tooltip_text(text)
+ else: self._input.set_tooltip_text(text)
+ def set_color(self, color):
+ if self._input.get_active() == -1: #custom entry, use color
+ self._input.get_child().modify_base(gtk.STATE_NORMAL, gtk.gdk.color_parse(color))
+ self._input.get_child().modify_text(gtk.STATE_NORMAL, Colors.PARAM_ENTRY_TEXT_COLOR)
+ else: #from enum, make pale background
+ self._input.get_child().modify_base(gtk.STATE_NORMAL, Colors.ENTRYENUM_CUSTOM_COLOR)
+ self._input.get_child().modify_text(gtk.STATE_NORMAL, Colors.PARAM_ENTRY_TEXT_COLOR)
+
+PARAM_MARKUP_TMPL="""\
+#set $foreground = $param.is_valid() and 'black' or 'red'
+<span foreground="$foreground" font_desc="Sans 7.5"><b>$encode($param.get_name()): </b>$encode(repr($param))</span>"""
+
+PARAM_LABEL_MARKUP_TMPL="""\
+#set $foreground = $param.is_valid() and 'black' or 'red'
+#set $underline = $has_cb and 'low' or 'none'
+<span underline="$underline" foreground="$foreground" font_desc="Sans 9">$encode($param.get_name())</span>"""
+
+TIP_MARKUP_TMPL="""\
+########################################
+#def truncate(string)
+ #set $max_len = 100
+ #set $string = str($string)
+ #if len($string) > $max_len
+$('%s...%s'%($string[:$max_len/2], $string[-$max_len/2:]))#slurp
+ #else
+$string#slurp
+ #end if
+#end def
+########################################
+Key: $param.get_key()
+Type: $param.get_type()
+#if $param.is_valid()
+Value: $truncate($param.get_evaluated())
+#elif len($param.get_error_messages()) == 1
+Error: $(param.get_error_messages()[0])
+#else
+Error:
+ #for $error_msg in $param.get_error_messages()
+ * $error_msg
+ #end for
+#end if"""
+
+class Param(Element):
+ """The graphical parameter."""
+
+ def __init__(self): Element.__init__(self)
+
+ def get_input(self, *args, **kwargs):
+ """
+ Get the graphical gtk class to represent this parameter.
+ An enum requires and combo parameter.
+ A non-enum with options gets a combined entry/combo parameter.
+ All others get a standard entry parameter.
+ @return gtk input class
+ """
+ if self.is_enum(): return EnumParam(self, *args, **kwargs)
+ if self.get_options(): return EnumEntryParam(self, *args, **kwargs)
+ return EntryParam(self, *args, **kwargs)
+
+ def get_markup(self):
+ """
+ Get the markup for this param.
+ @return a pango markup string
+ """
+ return Utils.parse_template(PARAM_MARKUP_TMPL, param=self)
diff --git a/grc/gui/Platform.py b/grc/gui/Platform.py
new file mode 100644
index 000000000..8bbfaca23
--- /dev/null
+++ b/grc/gui/Platform.py
@@ -0,0 +1,23 @@
+"""
+Copyright 2008, 2009 Free Software Foundation, Inc.
+This file is part of GNU Radio
+
+GNU Radio Companion 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 2
+of the License, or (at your option) any later version.
+
+GNU Radio Companion 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 this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+"""
+
+from Element import Element
+
+class Platform(Element):
+ def __init__(self): Element.__init__(self)
diff --git a/grc/gui/Port.py b/grc/gui/Port.py
new file mode 100644
index 000000000..2896d04c1
--- /dev/null
+++ b/grc/gui/Port.py
@@ -0,0 +1,190 @@
+"""
+Copyright 2007, 2008, 2009 Free Software Foundation, Inc.
+This file is part of GNU Radio
+
+GNU Radio Companion 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 2
+of the License, or (at your option) any later version.
+
+GNU Radio Companion 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 this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+"""
+
+from Element import Element
+from Constants import \
+ PORT_SEPARATION, CONNECTOR_EXTENSION_MINIMAL, \
+ CONNECTOR_EXTENSION_INCREMENT, \
+ PORT_LABEL_PADDING, PORT_MIN_WIDTH
+import Utils
+import Colors
+import pygtk
+pygtk.require('2.0')
+import gtk
+
+PORT_MARKUP_TMPL="""\
+<span foreground="black" font_desc="Sans 7.5">$encode($port.get_name())</span>"""
+
+class Port(Element):
+ """The graphical port."""
+
+ def __init__(self):
+ """
+ Port contructor.
+ Create list of connector coordinates.
+ """
+ Element.__init__(self)
+ self.connector_coordinates = dict()
+
+ def create_shapes(self):
+ """Create new areas and labels for the port."""
+ Element.create_shapes(self)
+ #get current rotation
+ rotation = self.get_rotation()
+ #get all sibling ports
+ if self.is_source(): ports = self.get_parent().get_sources()
+ elif self.is_sink(): ports = self.get_parent().get_sinks()
+ #get the max width
+ self.W = max([port.W for port in ports] + [PORT_MIN_WIDTH])
+ #get a numeric index for this port relative to its sibling ports
+ index = ports.index(self)
+ length = len(ports)
+ #reverse the order of ports for these rotations
+ if rotation in (180, 270): index = length-index-1
+ offset = (self.get_parent().H - length*self.H - (length-1)*PORT_SEPARATION)/2
+ #create areas and connector coordinates
+ if (self.is_sink() and rotation == 0) or (self.is_source() and rotation == 180):
+ x = -1*self.W
+ y = (PORT_SEPARATION+self.H)*index+offset
+ self.add_area((x, y), (self.W, self.H))
+ self._connector_coordinate = (x-1, y+self.H/2)
+ elif (self.is_source() and rotation == 0) or (self.is_sink() and rotation == 180):
+ x = self.get_parent().W
+ y = (PORT_SEPARATION+self.H)*index+offset
+ self.add_area((x, y), (self.W, self.H))
+ self._connector_coordinate = (x+1+self.W, y+self.H/2)
+ elif (self.is_source() and rotation == 90) or (self.is_sink() and rotation == 270):
+ y = -1*self.W
+ x = (PORT_SEPARATION+self.H)*index+offset
+ self.add_area((x, y), (self.H, self.W))
+ self._connector_coordinate = (x+self.H/2, y-1)
+ elif (self.is_sink() and rotation == 90) or (self.is_source() and rotation == 270):
+ y = self.get_parent().W
+ x = (PORT_SEPARATION+self.H)*index+offset
+ self.add_area((x, y), (self.H, self.W))
+ self._connector_coordinate = (x+self.H/2, y+1+self.W)
+ #the connector length
+ self._connector_length = CONNECTOR_EXTENSION_MINIMAL + CONNECTOR_EXTENSION_INCREMENT*index
+
+ def create_labels(self):
+ """Create the labels for the socket."""
+ Element.create_labels(self)
+ self._bg_color = Colors.get_color(self.get_color())
+ #create the layout
+ layout = gtk.DrawingArea().create_pango_layout('')
+ layout.set_markup(Utils.parse_template(PORT_MARKUP_TMPL, port=self))
+ self.w, self.h = layout.get_pixel_size()
+ self.W, self.H = 2*PORT_LABEL_PADDING+self.w, 2*PORT_LABEL_PADDING+self.h
+ #create the pixmap
+ pixmap = self.get_parent().get_parent().new_pixmap(self.w, self.h)
+ gc = pixmap.new_gc()
+ gc.set_foreground(self._bg_color)
+ pixmap.draw_rectangle(gc, True, 0, 0, self.w, self.h)
+ pixmap.draw_layout(gc, 0, 0, layout)
+ #create vertical and horizontal pixmaps
+ self.horizontal_label = pixmap
+ if self.is_vertical():
+ self.vertical_label = self.get_parent().get_parent().new_pixmap(self.h, self.w)
+ Utils.rotate_pixmap(gc, self.horizontal_label, self.vertical_label)
+
+ def draw(self, gc, window):
+ """
+ Draw the socket with a label.
+ @param gc the graphics context
+ @param window the gtk window to draw on
+ """
+ Element.draw(
+ self, gc, window, bg_color=self._bg_color,
+ border_color=self.is_highlighted() and Colors.HIGHLIGHT_COLOR or Colors.BORDER_COLOR,
+ )
+ X,Y = self.get_coordinate()
+ (x,y),(w,h) = self._areas_list[0] #use the first area's sizes to place the labels
+ if self.is_horizontal():
+ window.draw_drawable(gc, self.horizontal_label, 0, 0, x+X+(self.W-self.w)/2, y+Y+(self.H-self.h)/2, -1, -1)
+ elif self.is_vertical():
+ window.draw_drawable(gc, self.vertical_label, 0, 0, x+X+(self.H-self.h)/2, y+Y+(self.W-self.w)/2, -1, -1)
+
+ def get_connector_coordinate(self):
+ """
+ Get the coordinate where connections may attach to.
+ @return the connector coordinate (x, y) tuple
+ """
+ x,y = self._connector_coordinate
+ X,Y = self.get_coordinate()
+ return (x+X, y+Y)
+
+ def get_connector_direction(self):
+ """
+ Get the direction that the socket points: 0,90,180,270.
+ This is the rotation degree if the socket is an output or
+ the rotation degree + 180 if the socket is an input.
+ @return the direction in degrees
+ """
+ if self.is_source(): return self.get_rotation()
+ elif self.is_sink(): return (self.get_rotation() + 180)%360
+
+ def get_connector_length(self):
+ """
+ Get the length of the connector.
+ The connector length increases as the port index changes.
+ @return the length in pixels
+ """
+ return self._connector_length
+
+ def get_rotation(self):
+ """
+ Get the parent's rotation rather than self.
+ @return the parent's rotation
+ """
+ return self.get_parent().get_rotation()
+
+ def move(self, delta_coor):
+ """
+ Move the parent rather than self.
+ @param delta_corr the (delta_x, delta_y) tuple
+ """
+ self.get_parent().move(delta_coor)
+
+ def rotate(self, direction):
+ """
+ Rotate the parent rather than self.
+ @param direction degrees to rotate
+ """
+ self.get_parent().rotate(direction)
+
+ def get_coordinate(self):
+ """
+ Get the parent's coordinate rather than self.
+ @return the parents coordinate
+ """
+ return self.get_parent().get_coordinate()
+
+ def set_highlighted(self, highlight):
+ """
+ Set the parent highlight rather than self.
+ @param highlight true to enable highlighting
+ """
+ self.get_parent().set_highlighted(highlight)
+
+ def is_highlighted(self):
+ """
+ Get the parent's is highlight rather than self.
+ @return the parent's highlighting status
+ """
+ return self.get_parent().is_highlighted()
diff --git a/grc/gui/Preferences.py b/grc/gui/Preferences.py
new file mode 100644
index 000000000..1d89920dd
--- /dev/null
+++ b/grc/gui/Preferences.py
@@ -0,0 +1,86 @@
+"""
+Copyright 2008 Free Software Foundation, Inc.
+This file is part of GNU Radio
+
+GNU Radio Companion 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 2
+of the License, or (at your option) any later version.
+
+GNU Radio Companion 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 this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+"""
+
+import ConfigParser
+import os
+
+_platform = None
+_config_parser = ConfigParser.ConfigParser()
+
+def file_extension(): return '.'+_platform.get_key()
+def _prefs_file(): return os.path.join(os.path.expanduser('~'), file_extension())
+
+def load(platform):
+ global _platform
+ _platform = platform
+ #create sections
+ _config_parser.add_section('main')
+ _config_parser.add_section('files_open')
+ try: _config_parser.read(_prefs_file())
+ except: pass
+def save():
+ try: _config_parser.write(open(_prefs_file(), 'w'))
+ except: pass
+
+###########################################################################
+# Special methods for specific program functionalities
+###########################################################################
+
+def main_window_size(size=None):
+ if size is not None:
+ _config_parser.set('main', 'main_window_width', size[0])
+ _config_parser.set('main', 'main_window_height', size[1])
+ else:
+ try: return (
+ _config_parser.getint('main', 'main_window_width'),
+ _config_parser.getint('main', 'main_window_height'),
+ )
+ except: return (1, 1)
+
+def file_open(file=None):
+ if file is not None: _config_parser.set('main', 'file_open', file)
+ else:
+ try: return _config_parser.get('main', 'file_open')
+ except: return ''
+
+def files_open(files=None):
+ if files is not None:
+ _config_parser.remove_section('files_open') #clear section
+ _config_parser.add_section('files_open')
+ for i, file in enumerate(files):
+ _config_parser.set('files_open', 'file_open_%d'%i, file)
+ else:
+ files = list()
+ i = 0
+ while True:
+ try: files.append(_config_parser.get('files_open', 'file_open_%d'%i))
+ except: return files
+ i = i + 1
+
+def reports_window_position(pos=None):
+ if pos is not None: _config_parser.set('main', 'reports_window_position', pos)
+ else:
+ try: return _config_parser.getint('main', 'reports_window_position') or 1 #greater than 0
+ except: return -1
+
+def blocks_window_position(pos=None):
+ if pos is not None: _config_parser.set('main', 'blocks_window_position', pos)
+ else:
+ try: return _config_parser.getint('main', 'blocks_window_position') or 1 #greater than 0
+ except: return -1
diff --git a/grc/gui/PropsDialog.py b/grc/gui/PropsDialog.py
new file mode 100644
index 000000000..cc84fd088
--- /dev/null
+++ b/grc/gui/PropsDialog.py
@@ -0,0 +1,170 @@
+"""
+Copyright 2007, 2008, 2009 Free Software Foundation, Inc.
+This file is part of GNU Radio
+
+GNU Radio Companion 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 2
+of the License, or (at your option) any later version.
+
+GNU Radio Companion 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 this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+"""
+
+import pygtk
+pygtk.require('2.0')
+import gtk
+
+from Dialogs import TextDisplay
+from Constants import MIN_DIALOG_WIDTH, MIN_DIALOG_HEIGHT
+
+def get_title_label(title):
+ """
+ Get a title label for the params window.
+ The title will be bold, underlined, and left justified.
+ @param title the text of the title
+ @return a gtk object
+ """
+ label = gtk.Label()
+ label.set_markup('\n<b><span underline="low">%s</span>:</b>\n'%title)
+ hbox = gtk.HBox()
+ hbox.pack_start(label, False, False, padding=11)
+ return hbox
+
+class PropsDialog(gtk.Dialog):
+ """
+ A dialog to set block parameters, view errors, and view documentation.
+ """
+
+ def __init__(self, block):
+ """
+ Properties dialog contructor.
+ @param block a block instance
+ """
+ self._hash = 0
+ LABEL_SPACING = 7
+ gtk.Dialog.__init__(self,
+ title='Properties: %s'%block.get_name(),
+ buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT, gtk.STOCK_OK, gtk.RESPONSE_ACCEPT),
+ )
+ self._block = block
+ self.set_size_request(MIN_DIALOG_WIDTH, MIN_DIALOG_HEIGHT)
+ vbox = gtk.VBox()
+ #Create the scrolled window to hold all the parameters
+ scrolled_window = gtk.ScrolledWindow()
+ scrolled_window.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
+ scrolled_window.add_with_viewport(vbox)
+ self.vbox.pack_start(scrolled_window, True)
+ #Params box for block parameters
+ self._params_box = gtk.VBox()
+ self._params_box.pack_start(get_title_label('Parameters'), False)
+ self._input_object_params = list()
+ #Error Messages for the block
+ self._error_box = gtk.VBox()
+ self._error_messages_text_display = TextDisplay()
+ self._error_box.pack_start(gtk.Label(), False, False, LABEL_SPACING)
+ self._error_box.pack_start(get_title_label('Error Messages'), False)
+ self._error_box.pack_start(self._error_messages_text_display, False)
+ #Docs for the block
+ self._docs_box = err_box = gtk.VBox()
+ self._docs_text_display = TextDisplay()
+ self._docs_box.pack_start(gtk.Label(), False, False, LABEL_SPACING)
+ self._docs_box.pack_start(get_title_label('Documentation'), False)
+ self._docs_box.pack_start(self._docs_text_display, False)
+ #Add the boxes
+ vbox.pack_start(self._params_box, False)
+ vbox.pack_start(self._error_box, False)
+ vbox.pack_start(self._docs_box, False)
+ #connect events
+ self.connect('key-press-event', self._handle_key_press)
+ self.connect('show', self._update_gui)
+ #show all (performs initial gui update)
+ self.show_all()
+
+ def _params_changed(self):
+ """
+ Have the params in this dialog changed?
+ Ex: Added, removed, type change, hide change...
+ To the props dialog, the hide setting of 'none' and 'part' are identical.
+ Therfore, the props dialog only cares if the hide setting is/not 'all'.
+ Make a hash that uniquely represents the params' state.
+ @return true if changed
+ """
+ old_hash = self._hash
+ #create a tuple of things from each param that affects the params box
+ self._hash = hash(tuple([(
+ hash(param), param.get_type(), param.get_hide() == 'all',
+ ) for param in self._block.get_params()]))
+ return self._hash != old_hash
+
+ def _handle_changed(self, *args):
+ """
+ A change occured within a param:
+ Rewrite/validate the block and update the gui.
+ """
+ #update for the block
+ self._block.rewrite()
+ self._block.validate()
+ self._update_gui()
+
+ def _update_gui(self, *args):
+ """
+ Repopulate the parameters box (if changed).
+ Update all the input parameters.
+ Update the error messages box.
+ Hide the box if there are no errors.
+ Update the documentation block.
+ Hide the box if there are no docs.
+ """
+ #update the params box
+ if self._params_changed():
+ #hide params box before changing
+ self._params_box.hide_all()
+ #empty the params box
+ for io_param in list(self._input_object_params):
+ self._params_box.remove(io_param)
+ self._input_object_params.remove(io_param)
+ io_param.destroy()
+ #repopulate the params box
+ for param in self._block.get_params():
+ if param.get_hide() == 'all': continue
+ io_param = param.get_input(self._handle_changed)
+ self._input_object_params.append(io_param)
+ self._params_box.pack_start(io_param, False)
+ #show params box with new params
+ self._params_box.show_all()
+ #update the errors box
+ if self._block.is_valid(): self._error_box.hide()
+ else: self._error_box.show()
+ messages = '\n\n'.join(self._block.get_error_messages())
+ self._error_messages_text_display.set_text(messages)
+ #update the docs box
+ if self._block.get_doc(): self._docs_box.show()
+ else: self._docs_box.hide()
+ self._docs_text_display.set_text(self._block.get_doc())
+
+ def _handle_key_press(self, widget, event):
+ """
+ Handle key presses from the keyboard.
+ Call the ok response when enter is pressed.
+ @return false to forward the keypress
+ """
+ if event.keyval == gtk.keysyms.Return:
+ self.response(gtk.RESPONSE_ACCEPT)
+ return True #handled here
+ return False #forward the keypress
+
+ def run(self):
+ """
+ Run the dialog and get its response.
+ @return true if the response was accept
+ """
+ response = gtk.Dialog.run(self)
+ self.destroy()
+ return response == gtk.RESPONSE_ACCEPT
diff --git a/grc/gui/StateCache.py b/grc/gui/StateCache.py
new file mode 100644
index 000000000..3f6b79224
--- /dev/null
+++ b/grc/gui/StateCache.py
@@ -0,0 +1,92 @@
+"""
+Copyright 2007 Free Software Foundation, Inc.
+This file is part of GNU Radio
+
+GNU Radio Companion 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 2
+of the License, or (at your option) any later version.
+
+GNU Radio Companion 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 this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+"""
+
+import Actions
+from Constants import STATE_CACHE_SIZE
+
+class StateCache(object):
+ """
+ The state cache is an interface to a list to record data/states and to revert to previous states.
+ States are recorded into the list in a circular fassion by using an index for the current state,
+ and counters for the range where states are stored.
+ """
+
+ def __init__(self, initial_state):
+ """
+ StateCache constructor.
+ @param initial_state the intial state (nested data)
+ """
+ self.states = [None] * STATE_CACHE_SIZE #fill states
+ self.current_state_index = 0
+ self.num_prev_states = 0
+ self.num_next_states = 0
+ self.states[0] = initial_state
+ self.update_actions()
+
+ def save_new_state(self, state):
+ """
+ Save a new state.
+ Place the new state at the next index and add one to the number of previous states.
+ @param state the new state
+ """
+ self.current_state_index = (self.current_state_index + 1)%STATE_CACHE_SIZE
+ self.states[self.current_state_index] = state
+ self.num_prev_states = self.num_prev_states + 1
+ if self.num_prev_states == STATE_CACHE_SIZE: self.num_prev_states = STATE_CACHE_SIZE - 1
+ self.num_next_states = 0
+ self.update_actions()
+
+ def get_current_state(self):
+ """
+ Get the state at the current index.
+ @return the current state (nested data)
+ """
+ self.update_actions()
+ return self.states[self.current_state_index]
+
+ def get_prev_state(self):
+ """
+ Get the previous state and decrement the current index.
+ @return the previous state or None
+ """
+ if self.num_prev_states > 0:
+ self.current_state_index = (self.current_state_index + STATE_CACHE_SIZE -1)%STATE_CACHE_SIZE
+ self.num_next_states = self.num_next_states + 1
+ self.num_prev_states = self.num_prev_states - 1
+ return self.get_current_state()
+ return None
+
+ def get_next_state(self):
+ """
+ Get the nest state and increment the current index.
+ @return the next state or None
+ """
+ if self.num_next_states > 0:
+ self.current_state_index = (self.current_state_index + 1)%STATE_CACHE_SIZE
+ self.num_next_states = self.num_next_states - 1
+ self.num_prev_states = self.num_prev_states + 1
+ return self.get_current_state()
+ return None
+
+ def update_actions(self):
+ """
+ Update the undo and redo actions based on the number of next and prev states.
+ """
+ Actions.FLOW_GRAPH_REDO.set_sensitive(self.num_next_states != 0)
+ Actions.FLOW_GRAPH_UNDO.set_sensitive(self.num_prev_states != 0)
diff --git a/grc/gui/Utils.py b/grc/gui/Utils.py
new file mode 100644
index 000000000..bb19ed3d9
--- /dev/null
+++ b/grc/gui/Utils.py
@@ -0,0 +1,90 @@
+"""
+Copyright 2008-2011 Free Software Foundation, Inc.
+This file is part of GNU Radio
+
+GNU Radio Companion 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 2
+of the License, or (at your option) any later version.
+
+GNU Radio Companion 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 this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+"""
+
+from Constants import POSSIBLE_ROTATIONS
+from Cheetah.Template import Template
+import pygtk
+pygtk.require('2.0')
+import gtk
+import gobject
+
+def rotate_pixmap(gc, src_pixmap, dst_pixmap, angle=gtk.gdk.PIXBUF_ROTATE_COUNTERCLOCKWISE):
+ """
+ Load the destination pixmap with a rotated version of the source pixmap.
+ The source pixmap will be loaded into a pixbuf, rotated, and drawn to the destination pixmap.
+ The pixbuf is a client-side drawable, where a pixmap is a server-side drawable.
+ @param gc the graphics context
+ @param src_pixmap the source pixmap
+ @param dst_pixmap the destination pixmap
+ @param angle the angle to rotate by
+ """
+ width, height = src_pixmap.get_size()
+ pixbuf = gtk.gdk.Pixbuf(
+ colorspace=gtk.gdk.COLORSPACE_RGB,
+ has_alpha=False, bits_per_sample=8,
+ width=width, height=height,
+ )
+ pixbuf.get_from_drawable(src_pixmap, src_pixmap.get_colormap(), 0, 0, 0, 0, -1, -1)
+ pixbuf = pixbuf.rotate_simple(angle)
+ dst_pixmap.draw_pixbuf(gc, pixbuf, 0, 0, 0, 0)
+
+def get_rotated_coordinate(coor, rotation):
+ """
+ Rotate the coordinate by the given rotation.
+ @param coor the coordinate x, y tuple
+ @param rotation the angle in degrees
+ @return the rotated coordinates
+ """
+ #handles negative angles
+ rotation = (rotation + 360)%360
+ if rotation not in POSSIBLE_ROTATIONS:
+ raise ValueError('unusable rotation angle "%s"'%str(rotation))
+ #determine the number of degrees to rotate
+ cos_r, sin_r = {
+ 0: (1, 0),
+ 90: (0, 1),
+ 180: (-1, 0),
+ 270: (0, -1),
+ }[rotation]
+ x, y = coor
+ return (x*cos_r + y*sin_r, -x*sin_r + y*cos_r)
+
+def get_angle_from_coordinates((x1,y1), (x2,y2)):
+ """
+ Given two points, calculate the vector direction from point1 to point2, directions are multiples of 90 degrees.
+ @param (x1,y1) the coordinate of point 1
+ @param (x2,y2) the coordinate of point 2
+ @return the direction in degrees
+ """
+ if y1 == y2:#0 or 180
+ if x2 > x1: return 0
+ else: return 180
+ else:#90 or 270
+ if y2 > y1: return 270
+ else: return 90
+
+def parse_template(tmpl_str, **kwargs):
+ """
+ Parse the template string with the given args.
+ Pass in the xml encode method for pango escape chars.
+ @param tmpl_str the template as a string
+ @return a string of the parsed template
+ """
+ kwargs['encode'] = gobject.markup_escape_text
+ return str(Template(tmpl_str, kwargs))
diff --git a/grc/gui/__init__.py b/grc/gui/__init__.py
new file mode 100644
index 000000000..8b1378917
--- /dev/null
+++ b/grc/gui/__init__.py
@@ -0,0 +1 @@
+
diff --git a/grc/python/Block.py b/grc/python/Block.py
new file mode 100644
index 000000000..2c334dfc2
--- /dev/null
+++ b/grc/python/Block.py
@@ -0,0 +1,180 @@
+"""
+Copyright 2008-2011 Free Software Foundation, Inc.
+This file is part of GNU Radio
+
+GNU Radio Companion 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 2
+of the License, or (at your option) any later version.
+
+GNU Radio Companion 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 this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+"""
+
+from .. base.Block import Block as _Block
+from .. gui.Block import Block as _GUIBlock
+import extract_docs
+
+class Block(_Block, _GUIBlock):
+
+ def is_virtual_sink(self): return self.get_key() == 'virtual_sink'
+ def is_virtual_source(self): return self.get_key() == 'virtual_source'
+
+ ##for make source to keep track of indexes
+ _source_count = 0
+ ##for make sink to keep track of indexes
+ _sink_count = 0
+
+ def __init__(self, flow_graph, n):
+ """
+ Make a new block from nested data.
+ @param flow graph the parent element
+ @param n the nested odict
+ @return block a new block
+ """
+ #grab the data
+ self._doc = n.find('doc') or ''
+ self._imports = map(lambda i: i.strip(), n.findall('import'))
+ self._make = n.find('make')
+ self._var_make = n.find('var_make')
+ self._checks = n.findall('check')
+ self._callbacks = n.findall('callback')
+ self._throttle = n.find('throttle') or ''
+ #build the block
+ _Block.__init__(
+ self,
+ flow_graph=flow_graph,
+ n=n,
+ )
+ _GUIBlock.__init__(self)
+
+ def throttle(self): return bool(self._throttle)
+
+ def validate(self):
+ """
+ Validate this block.
+ Call the base class validate.
+ Evaluate the checks: each check must evaluate to True.
+ """
+ _Block.validate(self)
+ #evaluate the checks
+ for check in self._checks:
+ check_res = self.resolve_dependencies(check)
+ try:
+ if not self.get_parent().evaluate(check_res):
+ self.add_error_message('Check "%s" failed.'%check)
+ except: self.add_error_message('Check "%s" did not evaluate.'%check)
+
+ def rewrite(self):
+ """
+ Add and remove ports to adjust for the nports.
+ """
+ _Block.rewrite(self)
+
+ def rectify(ports):
+ #restore integer contiguity after insertion
+ #rectify the port names with the index
+ for i, port in enumerate(ports):
+ port._key = str(i)
+ port._name = port._n['name']
+ if len(ports) > 1: port._name += str(i)
+
+ def insert_port(get_ports, get_port, key):
+ prev_port = get_port(str(int(key)-1))
+ get_ports().insert(
+ get_ports().index(prev_port)+1,
+ prev_port.copy(new_key=key),
+ )
+ rectify(get_ports())
+
+ def remove_port(get_ports, get_port, key):
+ port = get_port(key)
+ for connection in port.get_connections():
+ self.get_parent().remove_element(connection)
+ get_ports().remove(port)
+ rectify(get_ports())
+
+ #adjust nports
+ for get_ports, get_port in (
+ (self.get_sources, self.get_source),
+ (self.get_sinks, self.get_sink),
+ ):
+ master_ports = filter(lambda p: p.get_nports(), get_ports())
+ for i, master_port in enumerate(master_ports):
+ nports = master_port.get_nports()
+ index_first = get_ports().index(master_port)
+ try: index_last = get_ports().index(master_ports[i+1])
+ except IndexError: index_last = len(get_ports())
+ num_ports = index_last - index_first
+ #do nothing if nports is already num ports
+ if nports == num_ports: continue
+ #remove excess ports and connections
+ if nports < num_ports:
+ for key in reversed(map(str, range(index_first+nports, index_first+num_ports))):
+ remove_port(get_ports, get_port, key)
+ continue
+ #add more ports
+ if nports > num_ports:
+ for key in map(str, range(index_first+num_ports, index_first+nports)):
+ insert_port(get_ports, get_port, key)
+ continue
+
+ def port_controller_modify(self, direction):
+ """
+ Change the port controller.
+ @param direction +1 or -1
+ @return true for change
+ """
+ changed = False
+ #concat the nports string from the private nports settings of all ports
+ nports_str = ' '.join([port._nports for port in self.get_ports()])
+ #modify all params whose keys appear in the nports string
+ for param in self.get_params():
+ if param.is_enum() or param.get_key() not in nports_str: continue
+ #try to increment the port controller by direction
+ try:
+ value = param.get_evaluated()
+ value = value + direction
+ if 0 < value:
+ param.set_value(value)
+ changed = True
+ except: pass
+ return changed
+
+ def get_doc(self):
+ doc = self._doc.strip('\n').replace('\\\n', '')
+ #merge custom doc with doxygen docs
+ return '\n'.join([doc, extract_docs.extract(self.get_key())]).strip('\n')
+
+ def get_category(self):
+ return _Block.get_category(self)
+
+ def get_imports(self):
+ """
+ Resolve all import statements.
+ Split each import statement at newlines.
+ Combine all import statments into a list.
+ Filter empty imports.
+ @return a list of import statements
+ """
+ return filter(lambda i: i, sum(map(lambda i: self.resolve_dependencies(i).split('\n'), self._imports), []))
+
+ def get_make(self): return self.resolve_dependencies(self._make)
+ def get_var_make(self): return self.resolve_dependencies(self._var_make)
+
+ def get_callbacks(self):
+ """
+ Get a list of function callbacks for this block.
+ @return a list of strings
+ """
+ def make_callback(callback):
+ callback = self.resolve_dependencies(callback)
+ if 'self.' in callback: return callback
+ return 'self.%s.%s'%(self.get_id(), callback)
+ return map(make_callback, self._callbacks)
diff --git a/grc/python/CMakeLists.txt b/grc/python/CMakeLists.txt
new file mode 100644
index 000000000..4832dd897
--- /dev/null
+++ b/grc/python/CMakeLists.txt
@@ -0,0 +1,44 @@
+# Copyright 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.
+
+########################################################################
+GR_PYTHON_INSTALL(FILES
+ convert_hier.py
+ expr_utils.py
+ extract_docs.py
+ Block.py
+ Connection.py
+ Constants.py
+ FlowGraph.py
+ Generator.py
+ Param.py
+ Platform.py
+ Port.py
+ __init__.py
+ DESTINATION ${GR_PYTHON_DIR}/gnuradio/grc/python
+ COMPONENT "grc"
+)
+
+install(FILES
+ block.dtd
+ default_flow_graph.grc
+ flow_graph.tmpl
+ DESTINATION ${GR_PYTHON_DIR}/gnuradio/grc/python
+ COMPONENT "grc"
+)
diff --git a/grc/python/Connection.py b/grc/python/Connection.py
new file mode 100644
index 000000000..341dd2d82
--- /dev/null
+++ b/grc/python/Connection.py
@@ -0,0 +1,46 @@
+"""
+Copyright 2008-2011 Free Software Foundation, Inc.
+This file is part of GNU Radio
+
+GNU Radio Companion 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 2
+of the License, or (at your option) any later version.
+
+GNU Radio Companion 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 this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+"""
+
+import Constants
+from .. base.Element import Element
+from .. base.Connection import Connection as _Connection
+from .. gui.Connection import Connection as _GUIConnection
+
+class Connection(_Connection, _GUIConnection):
+
+ def __init__(self, **kwargs):
+ _Connection.__init__(self, **kwargs)
+ _GUIConnection.__init__(self)
+
+ def is_msg(self):
+ return self.get_source().get_type() == self.get_sink().get_type() == 'msg'
+
+ def is_message(self):
+ return self.get_source().get_type() == self.get_sink().get_type() == 'message'
+
+ def validate(self):
+ """
+ Validate the connections.
+ The ports must match in io size.
+ """
+ Element.validate(self)
+ source_size = Constants.TYPE_TO_SIZEOF[self.get_source().get_type()] * self.get_source().get_vlen()
+ sink_size = Constants.TYPE_TO_SIZEOF[self.get_sink().get_type()] * self.get_sink().get_vlen()
+ if source_size != sink_size:
+ self.add_error_message('Source IO size "%s" does not match sink IO size "%s".'%(source_size, sink_size))
diff --git a/grc/python/Constants.py b/grc/python/Constants.py
new file mode 100644
index 000000000..b8dc9a96a
--- /dev/null
+++ b/grc/python/Constants.py
@@ -0,0 +1,95 @@
+"""
+Copyright 2008-2011 Free Software Foundation, Inc.
+This file is part of GNU Radio
+
+GNU Radio Companion 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 2
+of the License, or (at your option) any later version.
+
+GNU Radio Companion 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 this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+"""
+
+import os
+import stat
+from gnuradio import gr
+
+_gr_prefs = gr.prefs()
+
+#setup paths
+PATH_SEP = {'/':':', '\\':';'}[os.path.sep]
+HIER_BLOCKS_LIB_DIR = os.path.join(os.path.expanduser('~'), '.grc_gnuradio')
+BLOCKS_DIRS = filter( #filter blank strings
+ lambda x: x, PATH_SEP.join([
+ os.environ.get('GRC_BLOCKS_PATH', ''),
+ _gr_prefs.get_string('grc', 'local_blocks_path', ''),
+ _gr_prefs.get_string('grc', 'global_blocks_path', ''),
+ ]).split(PATH_SEP),
+) + [HIER_BLOCKS_LIB_DIR]
+
+#file creation modes
+TOP_BLOCK_FILE_MODE = stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR | stat.S_IRGRP | stat.S_IWGRP | stat.S_IXGRP | stat.S_IROTH
+HIER_BLOCK_FILE_MODE = stat.S_IRUSR | stat.S_IWUSR | stat.S_IRGRP | stat.S_IWGRP | stat.S_IROTH
+
+#data files
+DATA_DIR = os.path.dirname(__file__)
+FLOW_GRAPH_TEMPLATE = os.path.join(DATA_DIR, 'flow_graph.tmpl')
+BLOCK_DTD = os.path.join(DATA_DIR, 'block.dtd')
+DEFAULT_FLOW_GRAPH = os.path.join(DATA_DIR, 'default_flow_graph.grc')
+
+CORE_TYPES = ( #name, key, sizeof, color
+ ('Complex Float 64', 'fc64', 16, '#CC8C69'),
+ ('Complex Float 32', 'fc32', 8, '#3399FF'),
+ ('Complex Integer 64', 'sc64', 16, '#66CC00'),
+ ('Complex Integer 32', 'sc32', 8, '#33cc66'),
+ ('Complex Integer 16', 'sc16', 4, '#cccc00'),
+ ('Complex Integer 8', 'sc8', 2, '#cc00cc'),
+ ('Float 64', 'f64', 8, '#66CCCC'),
+ ('Float 32', 'f32', 4, '#FF8C69'),
+ ('Integer 64', 's64', 8, '#99FF33'),
+ ('Integer 32', 's32', 4, '#00FF99'),
+ ('Integer 16', 's16', 2, '#FFFF66'),
+ ('Integer 8', 's8', 1, '#FF66FF'),
+ ('Message Queue', 'msg', 0, '#777777'),
+ ('Async Message', 'message', 0, '#C0C0C0'),
+ ('Wildcard', '', 0, '#FFFFFF'),
+)
+
+ALIAS_TYPES = {
+ 'complex' : (8, '#3399FF'),
+ 'float' : (4, '#FF8C69'),
+ 'int' : (4, '#00FF99'),
+ 'short' : (2, '#FFFF66'),
+ 'byte' : (1, '#FF66FF'),
+}
+
+TYPE_TO_COLOR = dict()
+TYPE_TO_SIZEOF = dict()
+for name, key, sizeof, color in CORE_TYPES:
+ TYPE_TO_COLOR[key] = color
+ TYPE_TO_SIZEOF[key] = sizeof
+for key, (sizeof, color) in ALIAS_TYPES.iteritems():
+ TYPE_TO_COLOR[key] = color
+ TYPE_TO_SIZEOF[key] = sizeof
+
+#coloring
+COMPLEX_COLOR_SPEC = '#3399FF'
+FLOAT_COLOR_SPEC = '#FF8C69'
+INT_COLOR_SPEC = '#00FF99'
+SHORT_COLOR_SPEC = '#FFFF66'
+BYTE_COLOR_SPEC = '#FF66FF'
+COMPLEX_VECTOR_COLOR_SPEC = '#3399AA'
+FLOAT_VECTOR_COLOR_SPEC = '#CC8C69'
+INT_VECTOR_COLOR_SPEC = '#00CC99'
+SHORT_VECTOR_COLOR_SPEC = '#CCCC33'
+BYTE_VECTOR_COLOR_SPEC = '#CC66CC'
+ID_COLOR_SPEC = '#DDDDDD'
+WILDCARD_COLOR_SPEC = '#FFFFFF'
+MSG_COLOR_SPEC = '#777777'
diff --git a/grc/python/FlowGraph.py b/grc/python/FlowGraph.py
new file mode 100644
index 000000000..376c2e337
--- /dev/null
+++ b/grc/python/FlowGraph.py
@@ -0,0 +1,163 @@
+"""
+Copyright 2008-2011 Free Software Foundation, Inc.
+This file is part of GNU Radio
+
+GNU Radio Companion 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 2
+of the License, or (at your option) any later version.
+
+GNU Radio Companion 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 this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+"""
+
+import expr_utils
+from .. base.FlowGraph import FlowGraph as _FlowGraph
+from .. gui.FlowGraph import FlowGraph as _GUIFlowGraph
+import re
+
+_variable_matcher = re.compile('^(variable\w*)$')
+_parameter_matcher = re.compile('^(parameter)$')
+
+class FlowGraph(_FlowGraph, _GUIFlowGraph):
+
+ def __init__(self, **kwargs):
+ _FlowGraph.__init__(self, **kwargs)
+ _GUIFlowGraph.__init__(self)
+ self._eval_cache = dict()
+
+ def _eval(self, code, namespace, namespace_hash):
+ """
+ Evaluate the code with the given namespace.
+ @param code a string with python code
+ @param namespace a dict representing the namespace
+ @param namespace_hash a unique hash for the namespace
+ @return the resultant object
+ """
+ if not code: raise Exception, 'Cannot evaluate empty statement.'
+ my_hash = hash(code) ^ namespace_hash
+ #cache if does not exist
+ if not self._eval_cache.has_key(my_hash):
+ self._eval_cache[my_hash] = eval(code, namespace, namespace)
+ #return from cache
+ return self._eval_cache[my_hash]
+
+ def get_io_signaturev(self, direction):
+ """
+ Get a list of io signatures for this flow graph.
+ @param direction a string of 'in' or 'out'
+ @return a list of dicts with: type, label, vlen, size
+ """
+ sorted_pads = {
+ 'in': self.get_pad_sources(),
+ 'out': self.get_pad_sinks(),
+ }[direction]
+ # we only want stream ports
+ sorted_pads = filter(lambda b: b.get_param('type').get_evaluated() != 'message', sorted_pads);
+ #load io signature
+ return [{
+ 'label': str(pad.get_param('label').get_evaluated()),
+ 'type': str(pad.get_param('type').get_evaluated()),
+ 'vlen': str(pad.get_param('vlen').get_evaluated()),
+ 'size': pad.get_param('type').get_opt('size'),
+ 'optional': bool(pad.get_param('optional').get_evaluated()),
+ } for pad in sorted_pads]
+
+ def get_pad_sources(self):
+ """
+ Get a list of pad source blocks sorted by id order.
+ @return a list of pad source blocks in this flow graph
+ """
+ pads = filter(lambda b: b.get_key() == 'pad_source', self.get_enabled_blocks())
+ return sorted(pads, lambda x, y: cmp(x.get_id(), y.get_id()))
+
+ def get_pad_sinks(self):
+ """
+ Get a list of pad sink blocks sorted by id order.
+ @return a list of pad sink blocks in this flow graph
+ """
+ pads = filter(lambda b: b.get_key() == 'pad_sink', self.get_enabled_blocks())
+ return sorted(pads, lambda x, y: cmp(x.get_id(), y.get_id()))
+
+ def get_msg_pad_sources(self):
+ ps = self.get_pad_sources();
+ return filter(lambda b: b.get_param('type').get_evaluated() == 'message', ps);
+
+ def get_msg_pad_sinks(self):
+ ps = self.get_pad_sinks();
+ return filter(lambda b: b.get_param('type').get_evaluated() == 'message', ps);
+
+ def get_imports(self):
+ """
+ Get a set of all import statments in this flow graph namespace.
+ @return a set of import statements
+ """
+ imports = sum([block.get_imports() for block in self.get_enabled_blocks()], [])
+ imports = sorted(set(imports))
+ return imports
+
+ def get_variables(self):
+ """
+ Get a list of all variables in this flow graph namespace.
+ Exclude paramterized variables.
+ @return a sorted list of variable blocks in order of dependency (indep -> dep)
+ """
+ variables = filter(lambda b: _variable_matcher.match(b.get_key()), self.get_enabled_blocks())
+ return expr_utils.sort_objects(variables, lambda v: v.get_id(), lambda v: v.get_var_make())
+
+ def get_parameters(self):
+ """
+ Get a list of all paramterized variables in this flow graph namespace.
+ @return a list of paramterized variables
+ """
+ parameters = filter(lambda b: _parameter_matcher.match(b.get_key()), self.get_enabled_blocks())
+ return parameters
+
+ def rewrite(self):
+ """
+ Flag the namespace to be renewed.
+ """
+ self._renew_eval_ns = True
+ _FlowGraph.rewrite(self)
+
+ def evaluate(self, expr):
+ """
+ Evaluate the expression.
+ @param expr the string expression
+ @throw Exception bad expression
+ @return the evaluated data
+ """
+ if self._renew_eval_ns:
+ self._renew_eval_ns = False
+ #reload namespace
+ n = dict()
+ #load imports
+ for imp in self.get_imports():
+ try: exec imp in n
+ except: pass
+ #load parameters
+ np = dict()
+ for parameter in self.get_parameters():
+ try:
+ e = eval(parameter.get_param('value').to_code(), n, n)
+ np[parameter.get_id()] = e
+ except: pass
+ n.update(np) #merge param namespace
+ #load variables
+ for variable in self.get_variables():
+ try:
+ e = eval(variable.get_param('value').to_code(), n, n)
+ n[variable.get_id()] = e
+ except: pass
+ #make namespace public
+ self.n = n
+ self.n_hash = hash(str(n))
+ #evaluate
+ e = self._eval(expr, self.n, self.n_hash)
+ return e
diff --git a/grc/python/Generator.py b/grc/python/Generator.py
new file mode 100644
index 000000000..616ea00fc
--- /dev/null
+++ b/grc/python/Generator.py
@@ -0,0 +1,152 @@
+"""
+Copyright 2008-2011 Free Software Foundation, Inc.
+This file is part of GNU Radio
+
+GNU Radio Companion 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 2
+of the License, or (at your option) any later version.
+
+GNU Radio Companion 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 this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+"""
+
+import os
+import sys
+import subprocess
+import tempfile
+from Cheetah.Template import Template
+import expr_utils
+from Constants import \
+ TOP_BLOCK_FILE_MODE, HIER_BLOCK_FILE_MODE, \
+ HIER_BLOCKS_LIB_DIR, FLOW_GRAPH_TEMPLATE
+import convert_hier
+from .. gui import Messages
+
+class Generator(object):
+
+ def __init__(self, flow_graph, file_path):
+ """
+ Initialize the generator object.
+ Determine the file to generate.
+ @param flow_graph the flow graph object
+ @param file_path the path to write the file to
+ """
+ self._flow_graph = flow_graph
+ self._generate_options = self._flow_graph.get_option('generate_options')
+ if self._generate_options == 'hb':
+ self._mode = HIER_BLOCK_FILE_MODE
+ dirname = HIER_BLOCKS_LIB_DIR
+ else:
+ self._mode = TOP_BLOCK_FILE_MODE
+ dirname = os.path.dirname(file_path)
+ #handle the case where the directory is read-only
+ #in this case, use the system's temp directory
+ if not os.access(dirname, os.W_OK):
+ dirname = tempfile.gettempdir()
+ filename = self._flow_graph.get_option('id') + '.py'
+ self._file_path = os.path.join(dirname, filename)
+
+ def get_file_path(self): return self._file_path
+
+ def write(self):
+ #do throttle warning
+ throttled = any(map(lambda b: b.throttle(), self._flow_graph.get_enabled_blocks()))
+ if not throttled and self._generate_options != 'hb':
+ Messages.send_warning('''\
+This flow graph may not have flow control: no audio or usrp blocks found. \
+Add a Misc->Throttle block to your flow graph to avoid CPU congestion.''')
+ #generate
+ open(self.get_file_path(), 'w').write(str(self))
+ if self._generate_options == 'hb':
+ #convert hier block to xml wrapper
+ convert_hier.convert_hier(self._flow_graph, self.get_file_path())
+ os.chmod(self.get_file_path(), self._mode)
+
+ def get_popen(self):
+ """
+ Execute this python flow graph.
+ @return a popen object
+ """
+ #extract the path to the python executable
+ python_exe = sys.executable
+
+ #when using wx gui on mac os, execute with pythonw
+ #using pythonw is not necessary anymore, disabled below
+ #if self._generate_options == 'wx_gui' and 'darwin' in sys.platform.lower():
+ # python_exe = 'pythonw'
+
+ #setup the command args to run
+ cmds = [python_exe, '-u', self.get_file_path()] #-u is unbuffered stdio
+
+ #when in no gui mode on linux, use an xterm (looks nice)
+ if self._generate_options == 'no_gui' and 'linux' in sys.platform.lower():
+ cmds = ['xterm', '-e'] + cmds
+
+ p = subprocess.Popen(args=cmds, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=False, universal_newlines=True)
+ return p
+
+ def __str__(self):
+ """
+ Convert the flow graph to python code.
+ @return a string of python code
+ """
+ title = self._flow_graph.get_option('title') or self._flow_graph.get_option('id').replace('_', ' ').title()
+ imports = self._flow_graph.get_imports()
+ variables = self._flow_graph.get_variables()
+ parameters = self._flow_graph.get_parameters()
+ #list of blocks not including variables and imports and parameters and disabled
+ def _get_block_sort_text(block):
+ code = block.get_make().replace(block.get_id(), ' ')
+ try: code += block.get_param('notebook').get_value() #older gui markup w/ wxgui
+ except: pass
+ try: code += block.get_param('gui_hint').get_value() #newer gui markup w/ qtgui
+ except: pass
+ return code
+ blocks = expr_utils.sort_objects(
+ self._flow_graph.get_enabled_blocks(),
+ lambda b: b.get_id(), _get_block_sort_text
+ )
+ #list of regular blocks (all blocks minus the special ones)
+ blocks = filter(lambda b: b not in (imports + parameters), blocks)
+ #list of connections where each endpoint is enabled
+ connections = filter(lambda c: not (c.is_msg() or c.is_message()), self._flow_graph.get_enabled_connections())
+ messages = filter(lambda c: c.is_msg(), self._flow_graph.get_enabled_connections())
+ messages2 = filter(lambda c: c.is_message(), self._flow_graph.get_enabled_connections())
+ #list of variable names
+ var_ids = [var.get_id() for var in parameters + variables]
+ #prepend self.
+ replace_dict = dict([(var_id, 'self.%s'%var_id) for var_id in var_ids])
+ #list of callbacks
+ callbacks = [
+ expr_utils.expr_replace(cb, replace_dict)
+ for cb in sum([block.get_callbacks() for block in self._flow_graph.get_enabled_blocks()], [])
+ ]
+ #map var id to callbacks
+ var_id2cbs = dict(
+ [(var_id, filter(lambda c: expr_utils.get_variable_dependencies(c, [var_id]), callbacks))
+ for var_id in var_ids]
+ )
+ #load the namespace
+ namespace = {
+ 'title': title,
+ 'imports': imports,
+ 'flow_graph': self._flow_graph,
+ 'variables': variables,
+ 'parameters': parameters,
+ 'blocks': blocks,
+ 'connections': connections,
+ 'messages': messages,
+ 'messages2': messages2,
+ 'generate_options': self._generate_options,
+ 'var_id2cbs': var_id2cbs,
+ }
+ #build the template
+ t = Template(open(FLOW_GRAPH_TEMPLATE, 'r').read(), namespace)
+ return str(t)
diff --git a/grc/python/Param.py b/grc/python/Param.py
new file mode 100644
index 000000000..2caca4802
--- /dev/null
+++ b/grc/python/Param.py
@@ -0,0 +1,458 @@
+"""
+Copyright 2008-2011 Free Software Foundation, Inc.
+This file is part of GNU Radio
+
+GNU Radio Companion 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 2
+of the License, or (at your option) any later version.
+
+GNU Radio Companion 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 this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+"""
+
+from .. base.Param import Param as _Param
+from .. gui.Param import Param as _GUIParam
+from .. gui.Param import EntryParam
+import Constants
+import numpy
+import os
+import pygtk
+pygtk.require('2.0')
+import gtk
+from gnuradio import eng_notation
+import re
+from gnuradio import gr
+
+_check_id_matcher = re.compile('^[a-z|A-Z]\w*$')
+_show_id_matcher = re.compile('^(variable\w*|parameter|options|notebook)$')
+
+class FileParam(EntryParam):
+ """Provide an entry box for filename and a button to browse for a file."""
+
+ def __init__(self, *args, **kwargs):
+ EntryParam.__init__(self, *args, **kwargs)
+ input = gtk.Button('...')
+ input.connect('clicked', self._handle_clicked)
+ self.pack_start(input, False)
+
+ def _handle_clicked(self, widget=None):
+ """
+ If the button was clicked, open a file dialog in open/save format.
+ Replace the text in the entry with the new filename from the file dialog.
+ """
+ #get the paths
+ file_path = self.param.is_valid() and self.param.get_evaluated() or ''
+ (dirname, basename) = os.path.isfile(file_path) and os.path.split(file_path) or (file_path, '')
+ if not os.path.exists(dirname): dirname = os.getcwd() #fix bad paths
+ #build the dialog
+ if self.param.get_type() == 'file_open':
+ file_dialog = gtk.FileChooserDialog('Open a Data File...', None,
+ gtk.FILE_CHOOSER_ACTION_OPEN, ('gtk-cancel',gtk.RESPONSE_CANCEL,'gtk-open',gtk.RESPONSE_OK))
+ elif self.param.get_type() == 'file_save':
+ file_dialog = gtk.FileChooserDialog('Save a Data File...', None,
+ gtk.FILE_CHOOSER_ACTION_SAVE, ('gtk-cancel',gtk.RESPONSE_CANCEL, 'gtk-save',gtk.RESPONSE_OK))
+ file_dialog.set_do_overwrite_confirmation(True)
+ file_dialog.set_current_name(basename) #show the current filename
+ file_dialog.set_current_folder(dirname) #current directory
+ file_dialog.set_select_multiple(False)
+ file_dialog.set_local_only(True)
+ if gtk.RESPONSE_OK == file_dialog.run(): #run the dialog
+ file_path = file_dialog.get_filename() #get the file path
+ self._input.set_text(file_path)
+ self._handle_changed()
+ file_dialog.destroy() #destroy the dialog
+
+#blacklist certain ids, its not complete, but should help
+import __builtin__
+ID_BLACKLIST = ['self', 'options', 'gr', 'blks2', 'wxgui', 'wx', 'math', 'forms', 'firdes'] + \
+ filter(lambda x: not x.startswith('_'), dir(gr.top_block())) + dir(__builtin__)
+#define types, native python + numpy
+VECTOR_TYPES = (tuple, list, set, numpy.ndarray)
+COMPLEX_TYPES = [complex, numpy.complex, numpy.complex64, numpy.complex128]
+REAL_TYPES = [float, numpy.float, numpy.float32, numpy.float64]
+INT_TYPES = [int, long, numpy.int, numpy.int8, numpy.int16, numpy.int32, numpy.uint64,
+ numpy.uint, numpy.uint8, numpy.uint16, numpy.uint32, numpy.uint64]
+#cast to tuple for isinstance, concat subtypes
+COMPLEX_TYPES = tuple(COMPLEX_TYPES + REAL_TYPES + INT_TYPES)
+REAL_TYPES = tuple(REAL_TYPES + INT_TYPES)
+INT_TYPES = tuple(INT_TYPES)
+
+class Param(_Param, _GUIParam):
+
+ def __init__(self, **kwargs):
+ _Param.__init__(self, **kwargs)
+ _GUIParam.__init__(self)
+ self._init = False
+ self._hostage_cells = list()
+
+ def get_types(self): return (
+ 'raw', 'enum',
+ 'complex', 'real', 'int',
+ 'complex_vector', 'real_vector', 'int_vector',
+ 'hex', 'string', 'bool',
+ 'file_open', 'file_save',
+ 'id', 'stream_id',
+ 'grid_pos', 'notebook', 'gui_hint',
+ 'import',
+ )
+
+ def __repr__(self):
+ """
+ Get the repr (nice string format) for this param.
+ @return the string representation
+ """
+ ##################################################
+ # truncate helper method
+ ##################################################
+ def _truncate(string, style=0):
+ max_len = max(27 - len(self.get_name()), 3)
+ if len(string) > max_len:
+ if style < 0: #front truncate
+ string = '...' + string[3-max_len:]
+ elif style == 0: #center truncate
+ string = string[:max_len/2 -3] + '...' + string[-max_len/2:]
+ elif style > 0: #rear truncate
+ string = string[:max_len-3] + '...'
+ return string
+ ##################################################
+ # simple conditions
+ ##################################################
+ if not self.is_valid(): return _truncate(self.get_value())
+ if self.get_value() in self.get_option_keys(): return self.get_option(self.get_value()).get_name()
+ ##################################################
+ # display logic for numbers
+ ##################################################
+ def num_to_str(num):
+ if isinstance(num, COMPLEX_TYPES):
+ num = complex(num) #cast to python complex
+ if num == 0: return '0' #value is zero
+ elif num.imag == 0: return '%s'%eng_notation.num_to_str(num.real) #value is real
+ elif num.real == 0: return '%sj'%eng_notation.num_to_str(num.imag) #value is imaginary
+ elif num.imag < 0: return '%s-%sj'%(eng_notation.num_to_str(num.real), eng_notation.num_to_str(abs(num.imag)))
+ else: return '%s+%sj'%(eng_notation.num_to_str(num.real), eng_notation.num_to_str(num.imag))
+ else: return str(num)
+ ##################################################
+ # split up formatting by type
+ ##################################################
+ truncate = 0 #default center truncate
+ e = self.get_evaluated()
+ t = self.get_type()
+ if isinstance(e, bool): return str(e)
+ elif isinstance(e, COMPLEX_TYPES): dt_str = num_to_str(e)
+ elif isinstance(e, VECTOR_TYPES): #vector types
+ if len(e) > 8:
+ dt_str = self.get_value() #large vectors use code
+ truncate = 1
+ else: dt_str = ', '.join(map(num_to_str, e)) #small vectors use eval
+ elif t in ('file_open', 'file_save'):
+ dt_str = self.get_value()
+ truncate = -1
+ else: dt_str = str(e) #other types
+ ##################################################
+ # done
+ ##################################################
+ return _truncate(dt_str, truncate)
+
+ def get_input(self, *args, **kwargs):
+ if self.get_type() in ('file_open', 'file_save'): return FileParam(self, *args, **kwargs)
+ return _GUIParam.get_input(self, *args, **kwargs)
+
+ def get_color(self):
+ """
+ Get the color that represents this param's type.
+ @return a hex color code.
+ """
+ try:
+ return {
+ #number types
+ 'complex': Constants.COMPLEX_COLOR_SPEC,
+ 'real': Constants.FLOAT_COLOR_SPEC,
+ 'int': Constants.INT_COLOR_SPEC,
+ #vector types
+ 'complex_vector': Constants.COMPLEX_VECTOR_COLOR_SPEC,
+ 'real_vector': Constants.FLOAT_VECTOR_COLOR_SPEC,
+ 'int_vector': Constants.INT_VECTOR_COLOR_SPEC,
+ #special
+ 'bool': Constants.INT_COLOR_SPEC,
+ 'hex': Constants.INT_COLOR_SPEC,
+ 'string': Constants.BYTE_VECTOR_COLOR_SPEC,
+ 'id': Constants.ID_COLOR_SPEC,
+ 'stream_id': Constants.ID_COLOR_SPEC,
+ 'grid_pos': Constants.INT_VECTOR_COLOR_SPEC,
+ 'notebook': Constants.INT_VECTOR_COLOR_SPEC,
+ 'raw': Constants.WILDCARD_COLOR_SPEC,
+ }[self.get_type()]
+ except: return _Param.get_color(self)
+
+ def get_hide(self):
+ """
+ Get the hide value from the base class.
+ Hide the ID parameter for most blocks. Exceptions below.
+ If the parameter controls a port type, vlen, or nports, return part.
+ If the parameter is an empty grid position, return part.
+ These parameters are redundant to display in the flow graph view.
+ @return hide the hide property string
+ """
+ hide = _Param.get_hide(self)
+ if hide: return hide
+ #hide ID in non variable blocks
+ if self.get_key() == 'id' and not _show_id_matcher.match(self.get_parent().get_key()): return 'part'
+ #hide port controllers for type and nports
+ if self.get_key() in ' '.join(map(
+ lambda p: ' '.join([p._type, p._nports]), self.get_parent().get_ports())
+ ): return 'part'
+ #hide port controllers for vlen, when == 1
+ if self.get_key() in ' '.join(map(
+ lambda p: p._vlen, self.get_parent().get_ports())
+ ):
+ try:
+ if int(self.get_evaluated()) == 1: return 'part'
+ except: pass
+ #hide empty grid positions
+ if self.get_key() in ('grid_pos', 'notebook') and not self.get_value(): return 'part'
+ return hide
+
+ def validate(self):
+ """
+ Validate the param.
+ A test evaluation is performed
+ """
+ _Param.validate(self) #checks type
+ self._evaluated = None
+ try: self._evaluated = self.evaluate()
+ except Exception, e: self.add_error_message(str(e))
+
+ def get_evaluated(self): return self._evaluated
+
+ def evaluate(self):
+ """
+ Evaluate the value.
+ @return evaluated type
+ """
+ self._init = True
+ self._lisitify_flag = False
+ self._stringify_flag = False
+ self._hostage_cells = list()
+ def eval_string(v):
+ try:
+ e = self.get_parent().get_parent().evaluate(v)
+ if isinstance(e, str): return e
+ raise Exception #want to stringify
+ except:
+ self._stringify_flag = True
+ return v
+ t = self.get_type()
+ v = self.get_value()
+ #########################
+ # Enum Type
+ #########################
+ if self.is_enum(): return v
+ #########################
+ # Numeric Types
+ #########################
+ elif t in ('raw', 'complex', 'real', 'int', 'hex', 'bool'):
+ #raise exception if python cannot evaluate this value
+ try: e = self.get_parent().get_parent().evaluate(v)
+ except Exception, e: raise Exception, 'Value "%s" cannot be evaluated:\n%s'%(v, e)
+ #raise an exception if the data is invalid
+ if t == 'raw': return e
+ elif t == 'complex':
+ if not isinstance(e, COMPLEX_TYPES):
+ raise Exception, 'Expression "%s" is invalid for type complex.'%str(e)
+ return e
+ elif t == 'real':
+ if not isinstance(e, REAL_TYPES):
+ raise Exception, 'Expression "%s" is invalid for type real.'%str(e)
+ return e
+ elif t == 'int':
+ if not isinstance(e, INT_TYPES):
+ raise Exception, 'Expression "%s" is invalid for type integer.'%str(e)
+ return e
+ elif t == 'hex': return hex(e)
+ elif t == 'bool':
+ if not isinstance(e, bool):
+ raise Exception, 'Expression "%s" is invalid for type bool.'%str(e)
+ return e
+ else: raise TypeError, 'Type "%s" not handled'%t
+ #########################
+ # Numeric Vector Types
+ #########################
+ elif t in ('complex_vector', 'real_vector', 'int_vector'):
+ if not v: v = '()' #turn a blank string into an empty list, so it will eval
+ #raise exception if python cannot evaluate this value
+ try: e = self.get_parent().get_parent().evaluate(v)
+ except Exception, e: raise Exception, 'Value "%s" cannot be evaluated:\n%s'%(v, e)
+ #raise an exception if the data is invalid
+ if t == 'complex_vector':
+ if not isinstance(e, VECTOR_TYPES):
+ self._lisitify_flag = True
+ e = [e]
+ if not all([isinstance(ei, COMPLEX_TYPES) for ei in e]):
+ raise Exception, 'Expression "%s" is invalid for type complex vector.'%str(e)
+ return e
+ elif t == 'real_vector':
+ if not isinstance(e, VECTOR_TYPES):
+ self._lisitify_flag = True
+ e = [e]
+ if not all([isinstance(ei, REAL_TYPES) for ei in e]):
+ raise Exception, 'Expression "%s" is invalid for type real vector.'%str(e)
+ return e
+ elif t == 'int_vector':
+ if not isinstance(e, VECTOR_TYPES):
+ self._lisitify_flag = True
+ e = [e]
+ if not all([isinstance(ei, INT_TYPES) for ei in e]):
+ raise Exception, 'Expression "%s" is invalid for type integer vector.'%str(e)
+ return e
+ #########################
+ # String Types
+ #########################
+ elif t in ('string', 'file_open', 'file_save'):
+ #do not check if file/directory exists, that is a runtime issue
+ e = eval_string(v)
+ return str(e)
+ #########################
+ # Unique ID Type
+ #########################
+ elif t == 'id':
+ #can python use this as a variable?
+ if not _check_id_matcher.match(v):
+ raise Exception, 'ID "%s" must begin with a letter and may contain letters, numbers, and underscores.'%v
+ ids = [param.get_value() for param in self.get_all_params(t)]
+ if ids.count(v) > 1: #id should only appear once, or zero times if block is disabled
+ raise Exception, 'ID "%s" is not unique.'%v
+ if v in ID_BLACKLIST:
+ raise Exception, 'ID "%s" is blacklisted.'%v
+ return v
+ #########################
+ # Stream ID Type
+ #########################
+ elif t == 'stream_id':
+ #get a list of all stream ids used in the virtual sinks
+ ids = [param.get_value() for param in filter(
+ lambda p: p.get_parent().is_virtual_sink(),
+ self.get_all_params(t),
+ )]
+ #check that the virtual sink's stream id is unique
+ if self.get_parent().is_virtual_sink():
+ if ids.count(v) > 1: #id should only appear once, or zero times if block is disabled
+ raise Exception, 'Stream ID "%s" is not unique.'%v
+ #check that the virtual source's steam id is found
+ if self.get_parent().is_virtual_source():
+ if v not in ids:
+ raise Exception, 'Stream ID "%s" is not found.'%v
+ return v
+ #########################
+ # GUI Position/Hint
+ #########################
+ elif t == 'gui_hint':
+ if ':' in v: tab, pos = v.split(':')
+ elif '@' in v: tab, pos = v, ''
+ else: tab, pos = '', v
+
+ if '@' in tab: tab, index = tab.split('@')
+ else: index = '?'
+
+ widget_str = ({
+ (True, True): 'self.%(tab)s_grid_layout_%(index)s.addWidget(%(widget)s, %(pos)s)',
+ (True, False): 'self.%(tab)s_layout_%(index)s.addWidget(%(widget)s)',
+ (False, True): 'self.top_grid_layout.addWidget(%(widget)s, %(pos)s)',
+ (False, False): 'self.top_layout.addWidget(%(widget)s)',
+ }[bool(tab), bool(pos)])%{'tab': tab, 'index': index, 'widget': '%s', 'pos': pos}
+
+ def gui_hint(ws, w):
+ if 'layout' in w: ws = ws.replace('addWidget', 'addLayout')
+ return ws%w
+
+ return lambda w: gui_hint(widget_str, w)
+ #########################
+ # Grid Position Type
+ #########################
+ elif t == 'grid_pos':
+ if not v: return '' #allow for empty grid pos
+ e = self.get_parent().get_parent().evaluate(v)
+ if not isinstance(e, (list, tuple)) or len(e) != 4 or not all([isinstance(ei, int) for ei in e]):
+ raise Exception, 'A grid position must be a list of 4 integers.'
+ row, col, row_span, col_span = e
+ #check row, col
+ if row < 0 or col < 0:
+ raise Exception, 'Row and column must be non-negative.'
+ #check row span, col span
+ if row_span <= 0 or col_span <= 0:
+ raise Exception, 'Row and column span must be greater than zero.'
+ #get hostage cell parent
+ try: my_parent = self.get_parent().get_param('notebook').evaluate()
+ except: my_parent = ''
+ #calculate hostage cells
+ for r in range(row_span):
+ for c in range(col_span):
+ self._hostage_cells.append((my_parent, (row+r, col+c)))
+ #avoid collisions
+ params = filter(lambda p: p is not self, self.get_all_params('grid_pos'))
+ for param in params:
+ for parent, cell in param._hostage_cells:
+ if (parent, cell) in self._hostage_cells:
+ raise Exception, 'Another graphical element is using parent "%s", cell "%s".'%(str(parent), str(cell))
+ return e
+ #########################
+ # Notebook Page Type
+ #########################
+ elif t == 'notebook':
+ if not v: return '' #allow for empty notebook
+ #get a list of all notebooks
+ notebook_blocks = filter(lambda b: b.get_key() == 'notebook', self.get_parent().get_parent().get_enabled_blocks())
+ #check for notebook param syntax
+ try: notebook_id, page_index = map(str.strip, v.split(','))
+ except: raise Exception, 'Bad notebook page format.'
+ #check that the notebook id is valid
+ try: notebook_block = filter(lambda b: b.get_id() == notebook_id, notebook_blocks)[0]
+ except: raise Exception, 'Notebook id "%s" is not an existing notebook id.'%notebook_id
+ #check that page index exists
+ if int(page_index) not in range(len(notebook_block.get_param('labels').evaluate())):
+ raise Exception, 'Page index "%s" is not a valid index number.'%page_index
+ return notebook_id, page_index
+ #########################
+ # Import Type
+ #########################
+ elif t == 'import':
+ n = dict() #new namespace
+ try: exec v in n
+ except ImportError: raise Exception, 'Import "%s" failed.'%v
+ except Exception: raise Exception, 'Bad import syntax: "%s".'%v
+ return filter(lambda k: str(k) != '__builtins__', n.keys())
+ #########################
+ else: raise TypeError, 'Type "%s" not handled'%t
+
+ def to_code(self):
+ """
+ Convert the value to code.
+ For string and list types, check the init flag, call evaluate().
+ This ensures that evaluate() was called to set the xxxify_flags.
+ @return a string representing the code
+ """
+ v = self.get_value()
+ t = self.get_type()
+ if t in ('string', 'file_open', 'file_save'): #string types
+ if not self._init: self.evaluate()
+ if self._stringify_flag: return '"%s"'%v.replace('"', '\"')
+ else: return v
+ elif t in ('complex_vector', 'real_vector', 'int_vector'): #vector types
+ if not self._init: self.evaluate()
+ if self._lisitify_flag: return '(%s, )'%v
+ else: return '(%s)'%v
+ else: return v
+
+ def get_all_params(self, type):
+ """
+ Get all the params from the flowgraph that have the given type.
+ @param type the specified type
+ @return a list of params
+ """
+ return sum([filter(lambda p: p.get_type() == type, block.get_params()) for block in self.get_parent().get_parent().get_enabled_blocks()], [])
diff --git a/grc/python/Platform.py b/grc/python/Platform.py
new file mode 100644
index 000000000..e036361ff
--- /dev/null
+++ b/grc/python/Platform.py
@@ -0,0 +1,70 @@
+__doc__ = """
+Copyright 2008-2011 Free Software Foundation, Inc.
+This file is part of GNU Radio
+
+GNU Radio Companion 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 2
+of the License, or (at your option) any later version.
+
+GNU Radio Companion 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 this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+"""
+
+import os
+from gnuradio import gr
+from .. base.Platform import Platform as _Platform
+from .. gui.Platform import Platform as _GUIPlatform
+from FlowGraph import FlowGraph as _FlowGraph
+from Connection import Connection as _Connection
+from Block import Block as _Block
+from Port import Port as _Port
+from Param import Param as _Param
+from Generator import Generator
+from Constants import \
+ HIER_BLOCKS_LIB_DIR, BLOCK_DTD, \
+ DEFAULT_FLOW_GRAPH, BLOCKS_DIRS
+import Constants
+
+COLORS = [(name, color) for name, key, sizeof, color in Constants.CORE_TYPES]
+
+class Platform(_Platform, _GUIPlatform):
+
+ def __init__(self):
+ """
+ Make a platform for gnuradio.
+ """
+ #ensure hier dir
+ if not os.path.exists(HIER_BLOCKS_LIB_DIR): os.mkdir(HIER_BLOCKS_LIB_DIR)
+ #convert block paths to absolute paths
+ block_paths = set(map(os.path.abspath, BLOCKS_DIRS))
+ #init
+ _Platform.__init__(
+ self,
+ name='GNU Radio Companion',
+ version=gr.version(),
+ key='grc',
+ license=__doc__.strip(),
+ website='http://gnuradio.org/redmine/wiki/gnuradio/GNURadioCompanion',
+ block_paths=block_paths,
+ block_dtd=BLOCK_DTD,
+ default_flow_graph=DEFAULT_FLOW_GRAPH,
+ generator=Generator,
+ colors=COLORS,
+ )
+ _GUIPlatform.__init__(self)
+
+ ##############################################
+ # Constructors
+ ##############################################
+ FlowGraph = _FlowGraph
+ Connection = _Connection
+ Block = _Block
+ Port = _Port
+ Param = _Param
diff --git a/grc/python/Port.py b/grc/python/Port.py
new file mode 100644
index 000000000..8cc9e9ad0
--- /dev/null
+++ b/grc/python/Port.py
@@ -0,0 +1,217 @@
+"""
+Copyright 2008-2012 Free Software Foundation, Inc.
+This file is part of GNU Radio
+
+GNU Radio Companion 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 2
+of the License, or (at your option) any later version.
+
+GNU Radio Companion 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 this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+"""
+
+from .. base.Port import Port as _Port
+from .. gui.Port import Port as _GUIPort
+import Constants
+
+def _get_source_from_virtual_sink_port(vsp):
+ """
+ Resolve the source port that is connected to the given virtual sink port.
+ Use the get source from virtual source to recursively resolve subsequent ports.
+ """
+ try: return _get_source_from_virtual_source_port(
+ vsp.get_enabled_connections()[0].get_source())
+ except: raise Exception, 'Could not resolve source for virtual sink port %s'%vsp
+
+def _get_source_from_virtual_source_port(vsp, traversed=[]):
+ """
+ Recursively resolve source ports over the virtual connections.
+ Keep track of traversed sources to avoid recursive loops.
+ """
+ if not vsp.get_parent().is_virtual_source(): return vsp
+ if vsp in traversed: raise Exception, 'Loop found when resolving virtual source %s'%vsp
+ try: return _get_source_from_virtual_source_port(
+ _get_source_from_virtual_sink_port(
+ filter(#get all virtual sinks with a matching stream id
+ lambda vs: vs.get_param('stream_id').get_value() == vsp.get_parent().get_param('stream_id').get_value(),
+ filter(#get all enabled blocks that are also virtual sinks
+ lambda b: b.is_virtual_sink(),
+ vsp.get_parent().get_parent().get_enabled_blocks(),
+ ),
+ )[0].get_sinks()[0]
+ ), traversed + [vsp],
+ )
+ except: raise Exception, 'Could not resolve source for virtual source port %s'%vsp
+
+def _get_sink_from_virtual_source_port(vsp):
+ """
+ Resolve the sink port that is connected to the given virtual source port.
+ Use the get sink from virtual sink to recursively resolve subsequent ports.
+ """
+ try: return _get_sink_from_virtual_sink_port(
+ vsp.get_enabled_connections()[0].get_sink()) # Could have many connections, but use first
+ except: raise Exception, 'Could not resolve source for virtual source port %s'%vsp
+
+def _get_sink_from_virtual_sink_port(vsp, traversed=[]):
+ """
+ Recursively resolve sink ports over the virtual connections.
+ Keep track of traversed sinks to avoid recursive loops.
+ """
+ if not vsp.get_parent().is_virtual_sink(): return vsp
+ if vsp in traversed: raise Exception, 'Loop found when resolving virtual sink %s'%vsp
+ try: return _get_sink_from_virtual_sink_port(
+ _get_sink_from_virtual_source_port(
+ filter(#get all virtual source with a matching stream id
+ lambda vs: vs.get_param('stream_id').get_value() == vsp.get_parent().get_param('stream_id').get_value(),
+ filter(#get all enabled blocks that are also virtual sinks
+ lambda b: b.is_virtual_source(),
+ vsp.get_parent().get_parent().get_enabled_blocks(),
+ ),
+ )[0].get_sources()[0]
+ ), traversed + [vsp],
+ )
+ except: raise Exception, 'Could not resolve source for virtual sink port %s'%vsp
+
+class Port(_Port, _GUIPort):
+
+ def __init__(self, block, n, dir):
+ """
+ Make a new port from nested data.
+ @param block the parent element
+ @param n the nested odict
+ @param dir the direction
+ """
+ self._n = n
+ if n['type'] == 'msg': n['key'] = 'msg'
+ if n['type'] == 'message': n['key'] = n['name']
+ if dir == 'source' and not n.find('key'):
+ n['key'] = str(block._source_count)
+ block._source_count += 1
+ if dir == 'sink' and not n.find('key'):
+ n['key'] = str(block._sink_count)
+ block._sink_count += 1
+ #build the port
+ _Port.__init__(
+ self,
+ block=block,
+ n=n,
+ dir=dir,
+ )
+ _GUIPort.__init__(self)
+ self._nports = n.find('nports') or ''
+ self._vlen = n.find('vlen') or ''
+ self._optional = bool(n.find('optional'))
+
+ def get_types(self): return Constants.TYPE_TO_SIZEOF.keys()
+
+ def is_type_empty(self): return not self._n['type']
+
+ def validate(self):
+ _Port.validate(self)
+ if not self.get_enabled_connections() and not self.get_optional():
+ self.add_error_message('Port is not connected.')
+ is_msg = (not self.get_type()) or (self.get_type() == "message")
+ if not self.is_source() and (not is_msg) and len(self.get_enabled_connections()) > 1:
+ self.add_error_message('Port has too many connections.')
+ #message port logic
+ if self.get_type() == 'msg':
+ if self.get_nports():
+ self.add_error_message('A port of type "msg" cannot have "nports" set.')
+ if self.get_vlen() != 1:
+ self.add_error_message('A port of type "msg" must have a "vlen" of 1.')
+
+ def rewrite(self):
+ """
+ Handle the port cloning for virtual blocks.
+ """
+ _Port.rewrite(self)
+ if self.is_type_empty():
+ try: #clone type and vlen
+ source = self.resolve_empty_type()
+ self._type = str(source.get_type())
+ self._vlen = str(source.get_vlen())
+ except: #reset type and vlen
+ self._type = ''
+ self._vlen = ''
+
+ def resolve_virtual_source(self):
+ if self.get_parent().is_virtual_sink(): return _get_source_from_virtual_sink_port(self)
+ if self.get_parent().is_virtual_source(): return _get_source_from_virtual_source_port(self)
+
+ def resolve_empty_type(self):
+ if self.is_sink():
+ try:
+ src = _get_source_from_virtual_sink_port(self)
+ if not src.is_type_empty(): return src
+ except: pass
+ sink = _get_sink_from_virtual_sink_port(self)
+ if not sink.is_type_empty(): return sink
+ if self.is_source():
+ try:
+ src = _get_source_from_virtual_source_port(self)
+ if not src.is_type_empty(): return src
+ except: pass
+ sink = _get_sink_from_virtual_source_port(self)
+ if not sink.is_type_empty(): return sink
+
+ def get_vlen(self):
+ """
+ Get the vector length.
+ If the evaluation of vlen cannot be cast to an integer, return 1.
+ @return the vector length or 1
+ """
+ vlen = self.get_parent().resolve_dependencies(self._vlen)
+ try: return int(self.get_parent().get_parent().evaluate(vlen))
+ except: return 1
+
+ def get_nports(self):
+ """
+ Get the number of ports.
+ If already blank, return a blank
+ If the evaluation of nports cannot be cast to an integer, return 1.
+ @return the number of ports or 1
+ """
+ nports = self.get_parent().resolve_dependencies(self._nports)
+ #return blank if nports is blank
+ if not nports: return ''
+ try:
+ nports = int(self.get_parent().get_parent().evaluate(nports))
+ if 0 < nports: return nports
+ except: return 1
+
+ def get_optional(self): return bool(self._optional)
+
+ def get_color(self):
+ """
+ Get the color that represents this port's type.
+ Codes differ for ports where the vec length is 1 or greater than 1.
+ @return a hex color code.
+ """
+ try:
+ color = Constants.TYPE_TO_COLOR[self.get_type()]
+ vlen = self.get_vlen()
+ if vlen == 1: return color
+ color_val = int(color[1:], 16)
+ r = (color_val >> 16) & 0xff
+ g = (color_val >> 8) & 0xff
+ b = (color_val >> 0) & 0xff
+ dark = (0, 0, 30, 50, 70)[min(4, vlen)]
+ r = max(r-dark, 0)
+ g = max(g-dark, 0)
+ b = max(b-dark, 0)
+ return '#%.2x%.2x%.2x'%(r, g, b)
+ except: return _Port.get_color(self)
+
+ def copy(self, new_key=None):
+ n = self._n.copy()
+ #remove nports from the key so the copy cannot be a duplicator
+ if n.has_key('nports'): n.pop('nports')
+ if new_key: n['key'] = new_key
+ return self.__class__(self.get_parent(), n, self._dir)
diff --git a/grc/python/__init__.py b/grc/python/__init__.py
new file mode 100644
index 000000000..8b1378917
--- /dev/null
+++ b/grc/python/__init__.py
@@ -0,0 +1 @@
+
diff --git a/grc/python/block.dtd b/grc/python/block.dtd
new file mode 100644
index 000000000..292ea06cb
--- /dev/null
+++ b/grc/python/block.dtd
@@ -0,0 +1,57 @@
+<!--
+Copyright 2008 Free Software Foundation, Inc.
+This file is part of GNU Radio
+
+GNU Radio Companion 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 2
+of the License, or (at your option) any later version.
+
+GNU Radio Companion 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 this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+-->
+<!--
+ gnuradio_python.blocks.dtd
+ Josh Blum
+ The document type definition for blocks.
+ -->
+<!--
+ Top level element.
+ A block contains a name, ...parameters list, and list of IO ports.
+ -->
+<!ELEMENT block (name, key, category?, throttle?, import*, var_make?, make, callback*, param*, check*, sink*, source*, doc?, grc_source?)>
+<!--
+ Sub level elements.
+ -->
+<!ELEMENT param (name, key, value?, type, hide?, option*)>
+<!ELEMENT option (name, key, opt*)>
+<!ELEMENT sink (name, type, vlen?, nports?, optional?)>
+<!ELEMENT source (name, type, vlen?, nports?, optional?)>
+<!--
+ Bottom level elements.
+ Character data only.
+ -->
+<!ELEMENT category (#PCDATA)>
+<!ELEMENT import (#PCDATA)>
+<!ELEMENT doc (#PCDATA)>
+<!ELEMENT grc_source (#PCDATA)>
+<!ELEMENT name (#PCDATA)>
+<!ELEMENT key (#PCDATA)>
+<!ELEMENT check (#PCDATA)>
+<!ELEMENT opt (#PCDATA)>
+<!ELEMENT type (#PCDATA)>
+<!ELEMENT hide (#PCDATA)>
+<!ELEMENT vlen (#PCDATA)>
+<!ELEMENT nports (#PCDATA)>
+<!ELEMENT var_make (#PCDATA)>
+<!ELEMENT make (#PCDATA)>
+<!ELEMENT value (#PCDATA)>
+<!ELEMENT callback (#PCDATA)>
+<!ELEMENT optional (#PCDATA)>
+<!ELEMENT throttle (#PCDATA)>
diff --git a/grc/python/convert_hier.py b/grc/python/convert_hier.py
new file mode 100644
index 000000000..508ec63b2
--- /dev/null
+++ b/grc/python/convert_hier.py
@@ -0,0 +1,98 @@
+"""
+Copyright 2008-2011 Free Software Foundation, Inc.
+This file is part of GNU Radio
+
+GNU Radio Companion 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 2
+of the License, or (at your option) any later version.
+
+GNU Radio Companion 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 this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+"""
+
+from Constants import BLOCK_DTD
+from .. base import ParseXML
+from .. base import odict
+
+def convert_hier(flow_graph, python_file):
+ #extract info from the flow graph
+ input_sigs = flow_graph.get_io_signaturev('in')
+ output_sigs = flow_graph.get_io_signaturev('out')
+ input_msgp = flow_graph.get_msg_pad_sources();
+ output_msgp = flow_graph.get_msg_pad_sinks();
+ parameters = flow_graph.get_parameters()
+ block_key = flow_graph.get_option('id')
+ block_name = flow_graph.get_option('title') or flow_graph.get_option('id').replace('_', ' ').title()
+ block_category = flow_graph.get_option('category')
+ block_desc = flow_graph.get_option('description')
+ block_author = flow_graph.get_option('author')
+ #build the nested data
+ block_n = odict()
+ block_n['name'] = block_name
+ block_n['key'] = block_key
+ block_n['category'] = block_category
+ block_n['import'] = 'execfile("%s")'%python_file
+ #make data
+ if parameters: block_n['make'] = '%s(\n\t%s,\n)'%(
+ block_key,
+ ',\n\t'.join(['%s=$%s'%(param.get_id(), param.get_id()) for param in parameters]),
+ )
+ else: block_n['make'] = '%s()'%block_key
+ #callback data
+ block_n['callback'] = ['set_%s($%s)'%(param.get_id(), param.get_id()) for param in parameters]
+ #param data
+ params_n = list()
+ for param in parameters:
+ param_n = odict()
+ param_n['name'] = param.get_param('label').get_value() or param.get_id()
+ param_n['key'] = param.get_id()
+ param_n['value'] = param.get_param('value').get_value()
+ param_n['type'] = 'raw'
+ params_n.append(param_n)
+ block_n['param'] = params_n
+ #sink data stream ports
+ block_n['sink'] = list()
+ for input_sig in input_sigs:
+ sink_n = odict()
+ sink_n['name'] = input_sig['label']
+ sink_n['type'] = input_sig['type']
+ sink_n['vlen'] = input_sig['vlen']
+ if input_sig['optional']: sink_n['optional'] = '1'
+ block_n['sink'].append(sink_n)
+ #sink data msg ports
+ for input_sig in input_msgp:
+ sink_n = odict()
+ sink_n['name'] = input_sig.get_param("label").get_value();
+ sink_n['type'] = "message"
+ sink_n['optional'] = input_sig.get_param("optional").get_value();
+ block_n['sink'].append(sink_n)
+ #source data stream ports
+ block_n['source'] = list()
+ for output_sig in output_sigs:
+ source_n = odict()
+ source_n['name'] = output_sig['label']
+ source_n['type'] = output_sig['type']
+ source_n['vlen'] = output_sig['vlen']
+ if output_sig['optional']: source_n['optional'] = '1'
+ block_n['source'].append(source_n)
+ #source data msg ports
+ for output_sig in output_msgp:
+ source_n = odict()
+ source_n['name'] = output_sig.get_param("label").get_value();
+ source_n['type'] = "message"
+ source_n['optional'] = output_sig.get_param("optional").get_value();
+ block_n['source'].append(source_n)
+ #doc data
+ block_n['doc'] = "%s\n%s\n%s"%(block_author, block_desc, python_file)
+ block_n['grc_source'] = "%s"%(flow_graph.grc_file_path)
+ #write the block_n to file
+ xml_file = python_file + '.xml'
+ ParseXML.to_file({'block': block_n}, xml_file)
+ ParseXML.validate_dtd(xml_file, BLOCK_DTD)
diff --git a/grc/python/default_flow_graph.grc b/grc/python/default_flow_graph.grc
new file mode 100644
index 000000000..dea26f3a5
--- /dev/null
+++ b/grc/python/default_flow_graph.grc
@@ -0,0 +1,43 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Default Flow Graph:
+## include an options block and a variable for sample rate
+###################################################
+ -->
+<flow_graph>
+ <block>
+ <key>options</key>
+ <param>
+ <key>id</key>
+ <value>top_block</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(10, 10)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable</key>
+ <param>
+ <key>id</key>
+ <value>samp_rate</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>32000</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(10, 170)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+</flow_graph>
diff --git a/grc/python/expr_utils.py b/grc/python/expr_utils.py
new file mode 100644
index 000000000..a2e56eedf
--- /dev/null
+++ b/grc/python/expr_utils.py
@@ -0,0 +1,153 @@
+"""
+Copyright 2008-2011 Free Software Foundation, Inc.
+This file is part of GNU Radio
+
+GNU Radio Companion 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 2
+of the License, or (at your option) any later version.
+
+GNU Radio Companion 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 this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+"""
+
+import string
+VAR_CHARS = string.letters + string.digits + '_'
+
+class graph(object):
+ """
+ Simple graph structure held in a dictionary.
+ """
+
+ def __init__(self): self._graph = dict()
+
+ def __str__(self): return str(self._graph)
+
+ def add_node(self, node_key):
+ if self._graph.has_key(node_key): return
+ self._graph[node_key] = set()
+
+ def remove_node(self, node_key):
+ if not self._graph.has_key(node_key): return
+ for edges in self._graph.values():
+ if node_key in edges: edges.remove(node_key)
+ self._graph.pop(node_key)
+
+ def add_edge(self, src_node_key, dest_node_key):
+ self._graph[src_node_key].add(dest_node_key)
+
+ def remove_edge(self, src_node_key, dest_node_key):
+ self._graph[src_node_key].remove(dest_node_key)
+
+ def get_nodes(self): return self._graph.keys()
+
+ def get_edges(self, node_key): return self._graph[node_key]
+
+def expr_split(expr):
+ """
+ Split up an expression by non alphanumeric characters, including underscore.
+ Leave strings in-tact.
+ #TODO ignore escaped quotes, use raw strings.
+ @param expr an expression string
+ @return a list of string tokens that form expr
+ """
+ toks = list()
+ tok = ''
+ quote = ''
+ for char in expr:
+ if quote or char in VAR_CHARS:
+ if char == quote: quote = ''
+ tok += char
+ elif char in ("'", '"'):
+ toks.append(tok)
+ tok = char
+ quote = char
+ else:
+ toks.append(tok)
+ toks.append(char)
+ tok = ''
+ toks.append(tok)
+ return filter(lambda t: t, toks)
+
+def expr_replace(expr, replace_dict):
+ """
+ Search for vars in the expression and add the prepend.
+ @param expr an expression string
+ @param replace_dict a dict of find:replace
+ @return a new expression with the prepend
+ """
+ expr_splits = expr_split(expr)
+ for i, es in enumerate(expr_splits):
+ if es in replace_dict.keys():
+ expr_splits[i] = replace_dict[es]
+ return ''.join(expr_splits)
+
+def get_variable_dependencies(expr, vars):
+ """
+ Return a set of variables used in this expression.
+ @param expr an expression string
+ @param vars a list of variable names
+ @return a subset of vars used in the expression
+ """
+ expr_toks = expr_split(expr)
+ return set(filter(lambda v: v in expr_toks, vars))
+
+def get_graph(exprs):
+ """
+ Get a graph representing the variable dependencies
+ @param exprs a mapping of variable name to expression
+ @return a graph of variable deps
+ """
+ vars = exprs.keys()
+ #get dependencies for each expression, load into graph
+ var_graph = graph()
+ for var in vars: var_graph.add_node(var)
+ for var, expr in exprs.iteritems():
+ for dep in get_variable_dependencies(expr, vars):
+ if dep != var: var_graph.add_edge(dep, var)
+ return var_graph
+
+def sort_variables(exprs):
+ """
+ Get a list of variables in order of dependencies.
+ @param exprs a mapping of variable name to expression
+ @return a list of variable names
+ @throws Exception circular dependencies
+ """
+ var_graph = get_graph(exprs)
+ sorted_vars = list()
+ #determine dependency order
+ while var_graph.get_nodes():
+ #get a list of nodes with no edges
+ indep_vars = filter(lambda var: not var_graph.get_edges(var), var_graph.get_nodes())
+ if not indep_vars: raise Exception('circular dependency caught in sort_variables')
+ #add the indep vars to the end of the list
+ sorted_vars.extend(sorted(indep_vars))
+ #remove each edge-less node from the graph
+ for var in indep_vars: var_graph.remove_node(var)
+ return reversed(sorted_vars)
+
+def sort_objects(objects, get_id, get_expr):
+ """
+ Sort a list of objects according to their expressions.
+ @param objects the list of objects to sort
+ @param get_id the function to extract an id from the object
+ @param get_expr the function to extract an expression from the object
+ @return a list of sorted objects
+ """
+ id2obj = dict([(get_id(obj), obj) for obj in objects])
+ #map obj id to expression code
+ id2expr = dict([(get_id(obj), get_expr(obj)) for obj in objects])
+ #sort according to dependency
+ sorted_ids = sort_variables(id2expr)
+ #return list of sorted objects
+ return [id2obj[id] for id in sorted_ids]
+
+if __name__ == '__main__':
+ for i in sort_variables({'x':'1', 'y':'x+1', 'a':'x+y', 'b':'y+1', 'c':'a+b+x+y'}): print i
diff --git a/grc/python/extract_docs.py b/grc/python/extract_docs.py
new file mode 100644
index 000000000..33c404362
--- /dev/null
+++ b/grc/python/extract_docs.py
@@ -0,0 +1,66 @@
+"""
+Copyright 2008-2011 Free Software Foundation, Inc.
+This file is part of GNU Radio
+
+GNU Radio Companion 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 2
+of the License, or (at your option) any later version.
+
+GNU Radio Companion 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 this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+"""
+
+import re
+
+def _extract(key):
+ """
+ Extract the documentation from the python __doc__ strings.
+ If multiple modules match, combine the docs.
+ @param key the block key
+ @return a string with documentation
+ """
+ #extract matches
+ try:
+ module_name, constructor_name = key.split('_', 1)
+ module = __import__('gnuradio.'+module_name)
+ module = getattr(module, module_name)
+ except ImportError:
+ try:
+ module_name, constructor_name = key.split('_', 1)
+ module = __import__(module_name)
+ except: return ''
+ except:
+ return ''
+ pattern = constructor_name.replace('_', '_*').replace('x', '\w')
+ pattern_matcher = re.compile('^%s\w*$'%pattern)
+ matches = filter(lambda x: pattern_matcher.match(x), dir(module))
+ #combine all matches
+ doc_strs = list()
+ for match in matches:
+ try:
+ title = ' --- ' + match + ' --- '
+ doc_strs.append('\n\n'.join([title, getattr(module, match).__doc__]).strip())
+ except: pass
+ return '\n\n'.join(doc_strs)
+
+_docs_cache = dict()
+def extract(key):
+ """
+ Call the private extract and cache the result.
+ @param key the block key
+ @return a string with documentation
+ """
+ if not _docs_cache.has_key(key):
+ _docs_cache[key] = _extract(key)
+ return _docs_cache[key]
+
+if __name__ == '__main__':
+ import sys
+ print extract(sys.argv[1])
diff --git a/grc/python/flow_graph.tmpl b/grc/python/flow_graph.tmpl
new file mode 100644
index 000000000..163e7f76a
--- /dev/null
+++ b/grc/python/flow_graph.tmpl
@@ -0,0 +1,311 @@
+#!/usr/bin/env python
+########################################################
+##Cheetah template - gnuradio_python
+##
+##@param imports the import statements
+##@param flow_graph the flow_graph
+##@param variables the variable blocks
+##@param parameters the paramater blocks
+##@param blocks the signal blocks
+##@param connections the connections
+##@param messages the msg type connections
+##@param generate_options the type of flow graph
+##@param var_id2cbs variable id map to callback strings
+########################################################
+#def indent($code)
+#set $code = '\n\t\t'.join(str($code).splitlines())
+$code#slurp
+#end def
+#import time
+#set $DIVIDER = '#'*50
+$DIVIDER
+# Gnuradio Python Flow Graph
+# Title: $title
+#if $flow_graph.get_option('author')
+# Author: $flow_graph.get_option('author')
+#end if
+#if $flow_graph.get_option('description')
+# Description: $flow_graph.get_option('description')
+#end if
+# Generated: $time.ctime()
+$DIVIDER
+
+########################################################
+##Create Imports
+########################################################
+#for $imp in $imports
+$imp
+#end for
+
+########################################################
+##Create Class
+## Write the class declaration for a top or hier block.
+## The parameter names are the arguments to __init__.
+## Determine the absolute icon path (wx gui only).
+## Setup the IO signature (hier block only).
+########################################################
+#set $class_name = $flow_graph.get_option('id')
+#set $param_str = ', '.join(['self'] + ['%s=%s'%(param.get_id(), param.get_make()) for param in $parameters])
+#if $generate_options == 'wx_gui'
+ #import gtk
+ #set $icon = gtk.IconTheme().lookup_icon('gnuradio-grc', 32, 0)
+class $(class_name)(grc_wxgui.top_block_gui):
+
+ def __init__($param_str):
+ grc_wxgui.top_block_gui.__init__(self, title="$title")
+ #if $icon
+ _icon_path = "$icon.get_filename()"
+ self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))
+ #end if
+#elif $generate_options == 'qt_gui'
+class $(class_name)(gr.top_block, Qt.QWidget):
+
+ def __init__($param_str):
+ gr.top_block.__init__(self, "$title")
+ Qt.QWidget.__init__(self)
+ self.setWindowTitle("$title")
+ self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
+ self.top_scroll_layout = Qt.QVBoxLayout()
+ self.setLayout(self.top_scroll_layout)
+ self.top_scroll = Qt.QScrollArea()
+ self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
+ self.top_scroll_layout.addWidget(self.top_scroll)
+ self.top_scroll.setWidgetResizable(True)
+ self.top_widget = Qt.QWidget()
+ self.top_scroll.setWidget(self.top_widget)
+ self.top_layout = Qt.QVBoxLayout(self.top_widget)
+ self.top_grid_layout = Qt.QGridLayout()
+ self.top_layout.addLayout(self.top_grid_layout)
+
+#elif $generate_options == 'no_gui'
+class $(class_name)(gr.top_block):
+
+ def __init__($param_str):
+ gr.top_block.__init__(self, "$title")
+#elif $generate_options == 'hb'
+ #set $in_sigs = $flow_graph.get_io_signaturev('in')
+ #set $out_sigs = $flow_graph.get_io_signaturev('out')
+class $(class_name)(gr.hier_block2):
+#def make_io_sig($io_sigs)
+ #set $size_strs = ['%s*%s'%(io_sig['size'], io_sig['vlen']) for io_sig in $io_sigs]
+ #if len($io_sigs) == 0
+gr.io_signature(0, 0, 0)#slurp
+ #elif len($io_sigs) == 1
+gr.io_signature(1, 1, $size_strs[0])#slurp
+ #else
+gr.io_signaturev($(len($io_sigs)), $(len($io_sigs)), [$(', '.join($size_strs))])#slurp
+ #end if
+#end def
+
+ def __init__($param_str):
+ gr.hier_block2.__init__(
+ self, "$title",
+ $make_io_sig($in_sigs),
+ $make_io_sig($out_sigs),
+ )
+#end if
+########################################################
+##Create Parameters
+## Set the parameter to a property of self.
+########################################################
+#if $parameters
+
+ $DIVIDER
+ # Parameters
+ $DIVIDER
+#end if
+#for $param in $parameters
+ $indent($param.get_var_make())
+#end for
+########################################################
+##Create Variables
+########################################################
+#if $variables
+
+ $DIVIDER
+ # Variables
+ $DIVIDER
+#end if
+#for $var in $variables
+ $indent($var.get_var_make())
+#end for
+########################################################
+##Create Message Queues
+########################################################
+#if $messages
+
+ $DIVIDER
+ # Message Queues
+ $DIVIDER
+#end if
+#for $msg in $messages
+ $(msg.get_source().get_parent().get_id())_msgq_out = $(msg.get_sink().get_parent().get_id())_msgq_in = gr.msg_queue(2)
+#end for
+########################################################
+##Create Blocks
+########################################################
+#if $blocks
+
+ $DIVIDER
+ # Blocks
+ $DIVIDER
+#end if
+#for $blk in filter(lambda b: b.get_make(), $blocks)
+ #if $blk in $variables
+ $indent($blk.get_make())
+ #else
+ self.$blk.get_id() = $indent($blk.get_make())
+ #end if
+#end for
+########################################################
+##Create Connections
+## The port name should be the id of the parent block.
+## However, port names for IO pads should be self.
+########################################################
+#def make_port_sig($port)
+ #if $port.get_parent().get_key() == 'pad_source'
+(self, $flow_graph.get_pad_sources().index($port.get_parent()))#slurp
+ #elif $port.get_parent().get_key() == 'pad_sink'
+(self, $flow_graph.get_pad_sinks().index($port.get_parent()))#slurp
+ #else
+(self.$port.get_parent().get_id(), $port.get_key())#slurp
+ #end if
+#end def
+#if $connections
+
+ $DIVIDER
+ # Connections
+ $DIVIDER
+#end if
+#for $con in $connections
+ #set $source = $con.get_source()
+ #set $sink = $con.get_sink()
+ ##resolve virtual sources to the actual sources
+ #if $source.get_parent().is_virtual_source()
+ #set $source = $source.resolve_virtual_source()
+ #end if
+ ##do not generate connections with virtual sinks
+ #if not $sink.get_parent().is_virtual_sink()
+ self.connect($make_port_sig($source), $make_port_sig($sink))
+ #end if
+#end for
+
+########################################################
+##Create Asynch Message Connections
+########################################################
+#if $messages2
+ $DIVIDER
+ # Asynch Message Connections
+ $DIVIDER
+#end if
+#for $msg in $messages2
+ #set $sr = $msg.get_source()
+ #set $source = "self.%s"%($sr.get_parent().get_id())
+ #set $source_port = $sr.get_name();
+ #if $sr.get_parent().get_key() == "pad_source"
+ #set $source = "self"
+ #set $source_port = $sr.get_parent().get_param("label").get_value();
+ #end if
+ #set $sk = $msg.get_sink()
+ #set $sink = "self.%s"%($sk.get_parent().get_id())
+ #set $sink_port = $sk.get_name();
+ #if $sk.get_parent().get_key() == "pad_sink"
+ #set $sink = "self"
+ #set $sink_port = $sk.get_parent().get_param("label").get_value();
+ #end if
+ self.msg_connect($source, "$source_port", $sink, "$sink_port")
+#end for
+
+########################################################
+##Create Callbacks
+## Write a set method for this variable that calls the callbacks
+########################################################
+#for $var in $parameters + $variables
+ #set $id = $var.get_id()
+ def get_$(id)(self):
+ return self.$id
+
+ def set_$(id)(self, $id):
+ self.$id = $id
+ #for $callback in $var_id2cbs[$id]
+ $indent($callback)
+ #end for
+
+#end for
+########################################################
+##Create Main
+## For top block code, generate a main routine.
+## Instantiate the top block and run as gui or cli.
+########################################################
+#def make_default($type, $param)
+ #if $type == 'eng_float'
+eng_notation.num_to_str($param.get_make())#slurp
+ #else
+$param.get_make()#slurp
+ #end if
+#end def
+#def make_short_id($param)
+ #set $short_id = $param.get_param('short_id').get_evaluated()
+ #if $short_id
+ #set $short_id = '-' + $short_id
+ #end if
+$short_id#slurp
+#end def
+#if $generate_options != 'hb'
+if __name__ == '__main__':
+ parser = OptionParser(option_class=eng_option, usage="%prog: [options]")
+ #set $params_eq_list = list()
+ #for $param in $parameters
+ #set $type = $param.get_param('type').get_value()
+ #if $type
+ #silent $params_eq_list.append('%s=options.%s'%($param.get_id(), $param.get_id()))
+ parser.add_option("$make_short_id($param)", "--$param.get_id().replace('_', '-')", dest="$param.get_id()", type="$type", default=$make_default($type, $param),
+ help="Set $($param.get_param('label').get_evaluated() or $param.get_id()) [default=%default]")
+ #end if
+ #end for
+ (options, args) = parser.parse_args()
+ #if $flow_graph.get_option('realtime_scheduling')
+ if gr.enable_realtime_scheduling() != gr.RT_OK:
+ print "Error: failed to enable realtime scheduling."
+ #end if
+ #if $generate_options == 'wx_gui'
+ tb = $(class_name)($(', '.join($params_eq_list)))
+ #if $flow_graph.get_option('max_nouts')
+ tb.Run($flow_graph.get_option('run'), $flow_graph.get_option('max_nouts'))
+ #else
+ tb.Run($flow_graph.get_option('run'))
+ #end if
+ #elif $generate_options == 'qt_gui'
+ qapp = Qt.QApplication(sys.argv)
+ tb = $(class_name)($(', '.join($params_eq_list)))
+ #if $flow_graph.get_option('run')
+ #if $flow_graph.get_option('max_nouts')
+ tb.start($flow_graph.get_option('max_nouts'))
+ #else
+ tb.start()
+ #end if
+ #end if
+ tb.show()
+ qapp.exec_()
+ tb.stop()
+ #elif $generate_options == 'no_gui'
+ tb = $(class_name)($(', '.join($params_eq_list)))
+ #set $run_options = $flow_graph.get_option('run_options')
+ #if $run_options == 'prompt'
+ #if $flow_graph.get_option('max_nouts')
+ tb.start($flow_graph.get_option('max_nouts'))
+ #else
+ tb.start()
+ #end if
+ raw_input('Press Enter to quit: ')
+ tb.stop()
+ #elif $run_options == 'run'
+ #if $flow_graph.get_option('max_nouts')
+ tb.run($flow_graph.get_option('max_nouts'))
+ #else
+ tb.run()
+ #end if
+ #end if
+ #end if
+#end if
+
diff --git a/grc/scripts/CMakeLists.txt b/grc/scripts/CMakeLists.txt
new file mode 100644
index 000000000..e90589230
--- /dev/null
+++ b/grc/scripts/CMakeLists.txt
@@ -0,0 +1,25 @@
+# Copyright 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.
+
+########################################################################
+GR_PYTHON_INSTALL(
+ PROGRAMS gnuradio-companion
+ DESTINATION ${GR_RUNTIME_DIR}
+ COMPONENT "grc"
+)
diff --git a/grc/scripts/gnuradio-companion b/grc/scripts/gnuradio-companion
new file mode 100755
index 000000000..dabca3028
--- /dev/null
+++ b/grc/scripts/gnuradio-companion
@@ -0,0 +1,72 @@
+#!/usr/bin/env python
+"""
+Copyright 2009-2012 Free Software Foundation, Inc.
+This file is part of GNU Radio
+
+GNU Radio Companion 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 2
+of the License, or (at your option) any later version.
+
+GNU Radio Companion 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 this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+"""
+
+import pygtk
+pygtk.require('2.0')
+import gtk
+
+try: from gnuradio import gr
+except ImportError, e:
+ d = gtk.MessageDialog(type=gtk.MESSAGE_ERROR, buttons=gtk.BUTTONS_CLOSE, message_format="""
+Cannot import gnuradio.
+
+Is the python path environment variable set correctly?
+ All OS: PYTHONPATH
+
+Is the library path environment variable set correctly?
+ Linux: LD_LIBRARY_PATH
+ Windows: PATH
+ MacOSX: DYLD_LIBRARY_PATH
+""")
+ d.set_title(str(e))
+ d.run()
+ exit(-1)
+
+from optparse import OptionParser
+import os
+
+if __name__ == "__main__":
+ if ('GR_DONT_LOAD_PREFS' in os.environ.keys() and
+ (not 'GRC_BLOCKS_PATH' in os.environ.keys() or len(os.environ['GRC_BLOCKS_PATH']) == 0)):
+ d = gtk.MessageDialog(
+ type=gtk.MESSAGE_ERROR,
+ buttons=gtk.BUTTONS_CLOSE,
+ message_format="""Can't find block definitions. Use config.conf or GRC_BLOCKS_PATH. """)
+ d.set_title("No block definitions available.")
+ d.run()
+ exit(-1)
+ usage = 'usage: %prog [options] [saved flow graphs]'
+ version = """
+GNU Radio Companion %s
+
+This program is part of GNU Radio
+GRC comes with ABSOLUTELY NO WARRANTY.
+This is free software,
+and you are welcome to redistribute it.
+"""%gr.version()
+ parser = OptionParser(usage=usage, version=version)
+ (options, args) = parser.parse_args()
+ from gnuradio.grc.python.Platform import Platform
+ from gnuradio.grc.gui.ActionHandler import ActionHandler
+ #setup icon using icon theme
+ try: gtk.window_set_default_icon(gtk.IconTheme().load_icon('gnuradio-grc', 256, 0))
+ except: pass
+ ActionHandler(args, Platform())
+
diff --git a/grc/todo.txt b/grc/todo.txt
new file mode 100644
index 000000000..1205b3ff6
--- /dev/null
+++ b/grc/todo.txt
@@ -0,0 +1,74 @@
+##################################################
+# Examples
+##################################################
+* Push-to-Talk example
+* Start/Stop the flow graph
+
+##################################################
+# Blocks
+##################################################
+* probe: also non-float outputs
+* log slider gui control
+* packet mod: whitening offset
+* wx min window size in options block
+* gr_adaptive_fir_ccf
+* ofdm
+ * gr_ofdm_bpsk_demapper
+ * gr_ofdm_demapper_vcb
+ * gr_ofdm_frame_sink
+ * gr_ofdm_mapper_bcv
+* size params for the graphical sinks
+* callbacks for set average on fft, waterfall, number sinks
+* add units to params: Sps, Hz, dB...
+* add bool type to command line option store_true or store_false
+* messages for packet blocks and probe blocks
+
+##################################################
+# Features
+##################################################
+* extract category from doxygen
+ * fix up block tree to mirror current doxygen group
+ * remove blocks in block tree covered by doxygen
+* param editor, expand entry boxes in focus
+* change param dialog to panel within main window
+* gui grid editor for configuring grid params/placing wxgui plots and controls
+* drag from one port to another to connect
+* per parameter docs
+ * extract individual param docs from doxygen
+ * doc tag in param for handwritten notes
+* separate generated code into top block and gui class
+ * use gui.py in gr-wxgui and remove custom top_block_gui
+* configuration option for adding block paths
+* orientations for ports (top, right, bottom, left)
+ * source defaults to right, sink defaults to left
+* separation of variables and gui controls
+* speedup w/ background layer and animation layer
+* multiple doxygen directories (doc_dir becomes doc_path)
+* use pango markup in tooltips for params
+* use get_var_make to determine if it is a variable, not regexp
+* concept of a project, or project flow graph
+ * collection of blocks, hier and top
+ * system-wide, default/work, and user created
+* use templates/macros to generate the repetative stuff in the xml
+
+##################################################
+# Problems
+##################################################
+* msg ports dont work with virtual connections
+ * dont fix this until pmts are used?
+* hier block generation
+ * auto generate hier library on changes
+ * auto clean hier library when block removed
+ * add hier blocks to tree without restart
+* dont generate py files in saved flowgraph dir
+* save/restore cwd
+* threads dont die on exit in probe and variable sink
+* align param titles in properties dialog
+* weird grid params misbehaving
+* gr hier blocks have more diverse IO capabilities than we allow for
+
+##################################################
+# Future
+##################################################
+* require pygtk 2.12 for treeview tooltips
+ * remove try/except in BlockTreeWindow.py
diff --git a/gruel/CMakeLists.txt b/gruel/CMakeLists.txt
new file mode 100644
index 000000000..3e8c5166e
--- /dev/null
+++ b/gruel/CMakeLists.txt
@@ -0,0 +1,104 @@
+# 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.
+
+########################################################################
+# Setup dependencies
+########################################################################
+include(GrBoost)
+
+include(GrPython) #used for code generation
+
+########################################################################
+# Register component
+########################################################################
+include(GrComponent)
+GR_REGISTER_COMPONENT("gruel" ENABLE_GRUEL
+ Boost_FOUND
+ PYTHONINTERP_FOUND
+)
+
+include(GrMiscUtils)
+GR_SET_GLOBAL(GRUEL_INCLUDE_DIRS
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/include
+ ${CMAKE_CURRENT_BINARY_DIR}/src/include
+ ${Boost_INCLUDE_DIRS}
+)
+
+########################################################################
+# Begin conditional configuration
+########################################################################
+if(ENABLE_GRUEL)
+
+########################################################################
+# Setup CPack components
+########################################################################
+include(GrPackage)
+CPACK_SET(CPACK_COMPONENT_GROUP_GRUEL_DESCRIPTION "GNU Radio Utility Etcetera Library")
+
+CPACK_COMPONENT("gruel_runtime"
+ GROUP "Gruel"
+ DISPLAY_NAME "Runtime"
+ DESCRIPTION "Dynamic link libraries"
+)
+
+CPACK_COMPONENT("gruel_devel"
+ GROUP "Gruel"
+ DISPLAY_NAME "Development"
+ DESCRIPTION "C++ headers, package config, import libraries"
+)
+
+CPACK_COMPONENT("gruel_python"
+ GROUP "Gruel"
+ DISPLAY_NAME "Python"
+ DESCRIPTION "Python modules for runtime"
+ DEPENDS "gruel_runtime"
+)
+
+CPACK_COMPONENT("gruel_swig"
+ GROUP "Gruel"
+ DISPLAY_NAME "SWIG"
+ DESCRIPTION "SWIG development .i files"
+ DEPENDS "gruel_python;gruel_devel"
+)
+
+########################################################################
+# Add subdirectories
+########################################################################
+add_subdirectory(src/include/gruel)
+add_subdirectory(src/lib)
+if(ENABLE_PYTHON)
+ add_subdirectory(src/swig)
+ add_subdirectory(src/python)
+endif(ENABLE_PYTHON)
+
+########################################################################
+# Create Pkg Config File
+########################################################################
+configure_file(
+ ${CMAKE_CURRENT_SOURCE_DIR}/gruel.pc.in
+ ${CMAKE_CURRENT_BINARY_DIR}/gruel.pc
+@ONLY)
+
+install(
+ FILES ${CMAKE_CURRENT_BINARY_DIR}/gruel.pc
+ DESTINATION ${GR_LIBRARY_DIR}/pkgconfig
+ COMPONENT "gruel_devel"
+)
+
+endif(ENABLE_GRUEL)
diff --git a/gruel/README b/gruel/README
new file mode 100644
index 000000000..90dc4eeb4
--- /dev/null
+++ b/gruel/README
@@ -0,0 +1,29 @@
+#
+# 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.
+#
+
+The GNU Radio Utility Etcetera Library, a collection of low-level routines
+to avoid dependencies on the full GNU Radio core or other libraries.
+
+Over time, some code from libgnuradio-core and libpmt will migrate
+here, to avoid duplication of code and simplify dependencies.
+
+By design, this library will not have dependencies on any other part
+of GNU Radio, but may have external dependencies such as Boost.
diff --git a/gruel/gruel.pc.in b/gruel/gruel.pc.in
new file mode 100644
index 000000000..7f3f821fe
--- /dev/null
+++ b/gruel/gruel.pc.in
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: gruel
+Description: The GNU Radio Utility Etcetera Library
+Requires:
+Version: @LIBVER@
+Libs: -L${libdir} -lgruel
+Cflags: -I${includedir}
diff --git a/gruel/src/include/gruel/CMakeLists.txt b/gruel/src/include/gruel/CMakeLists.txt
new file mode 100644
index 000000000..d4c36eddb
--- /dev/null
+++ b/gruel/src/include/gruel/CMakeLists.txt
@@ -0,0 +1,39 @@
+# Copyright 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.
+
+########################################################################
+# Install the headers
+########################################################################
+install(FILES
+ api.h
+ attributes.h
+ high_res_timer.h
+ msg_accepter.h
+ msg_accepter_msgq.h
+ msg_queue.h
+ msg_passing.h
+ pmt.h
+ pmt_pool.h
+ pmt_sugar.h
+ realtime.h
+ sys_pri.h
+ thread_body_wrapper.h
+ thread_group.h
+ thread.h
+DESTINATION ${GR_INCLUDE_DIR}/gruel COMPONENT "gruel_devel")
diff --git a/gruel/src/include/gruel/api.h b/gruel/src/include/gruel/api.h
new file mode 100644
index 000000000..945814d43
--- /dev/null
+++ b/gruel/src/include/gruel/api.h
@@ -0,0 +1,33 @@
+/*
+ * Copyright 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.
+ */
+
+#ifndef INCLUDED_GRUEL_API_H
+#define INCLUDED_GRUEL_API_H
+
+#include <gruel/attributes.h>
+
+#ifdef gruel_EXPORTS
+# define GRUEL_API __GR_ATTR_EXPORT
+#else
+# define GRUEL_API __GR_ATTR_IMPORT
+#endif
+
+#endif /* INCLUDED_GRUEL_API_H */
diff --git a/gruel/src/include/gruel/attributes.h b/gruel/src/include/gruel/attributes.h
new file mode 100644
index 000000000..baa5521c8
--- /dev/null
+++ b/gruel/src/include/gruel/attributes.h
@@ -0,0 +1,74 @@
+/*
+ * Copyright 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.
+ */
+
+#ifndef INCLUDED_GRUEL_ATTRIBUTES_H
+#define INCLUDED_GRUEL_ATTRIBUTES_H
+
+////////////////////////////////////////////////////////////////////////
+// Cross-platform attribute macros
+////////////////////////////////////////////////////////////////////////
+#if defined __GNUC__
+# define __GR_ATTR_ALIGNED(x) __attribute__((aligned(x)))
+# define __GR_ATTR_UNUSED __attribute__((unused))
+# define __GR_ATTR_INLINE __attribute__((always_inline))
+# define __GR_ATTR_DEPRECATED __attribute__((deprecated))
+# if __GNUC__ >= 4
+# define __GR_ATTR_EXPORT __attribute__((visibility("default")))
+# define __GR_ATTR_IMPORT __attribute__((visibility("default")))
+# else
+# define __GR_ATTR_EXPORT
+# define __GR_ATTR_IMPORT
+# endif
+#elif _MSC_VER
+# define __GR_ATTR_ALIGNED(x) __declspec(align(x))
+# define __GR_ATTR_UNUSED
+# define __GR_ATTR_INLINE __forceinline
+# define __GR_ATTR_DEPRECATED __declspec(deprecated)
+# define __GR_ATTR_EXPORT __declspec(dllexport)
+# define __GR_ATTR_IMPORT __declspec(dllimport)
+#else
+# define __GR_ATTR_ALIGNED(x)
+# define __GR_ATTR_UNUSED
+# define __GR_ATTR_INLINE
+# define __GR_ATTR_DEPRECATED
+# define __GR_ATTR_EXPORT
+# define __GR_ATTR_IMPORT
+#endif
+
+////////////////////////////////////////////////////////////////////////
+// define inline when building C
+////////////////////////////////////////////////////////////////////////
+#if defined(_MSC_VER) && !defined(__cplusplus) && !defined(inline)
+# define inline __inline
+#endif
+
+////////////////////////////////////////////////////////////////////////
+// suppress warnings
+////////////////////////////////////////////////////////////////////////
+#ifdef _MSC_VER
+# pragma warning(disable: 4251) // class 'A<T>' needs to have dll-interface to be used by clients of class 'B'
+# pragma warning(disable: 4275) // non dll-interface class ... used as base for dll-interface class ...
+# pragma warning(disable: 4244) // conversion from 'double' to 'float', possible loss of data
+# pragma warning(disable: 4305) // 'initializing' : truncation from 'double' to 'float'
+# pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
+#endif
+
+#endif /* INCLUDED_GRUEL_ATTRIBUTES_H */
diff --git a/gruel/src/include/gruel/high_res_timer.h b/gruel/src/include/gruel/high_res_timer.h
new file mode 100644
index 000000000..a885520b6
--- /dev/null
+++ b/gruel/src/include/gruel/high_res_timer.h
@@ -0,0 +1,124 @@
+/*
+ * Copyright 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 this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef INCLUDED_GRUEL_HIGH_RES_TIMER_H
+#define INCLUDED_GRUEL_HIGH_RES_TIMER_H
+
+namespace gruel {
+ //! Typedef for the timer tick count
+ typedef signed long long high_res_timer_type;
+
+ //! Get the current time in ticks
+ high_res_timer_type high_res_timer_now(void);
+
+ //! Get the number of ticks per second
+ high_res_timer_type high_res_timer_tps(void);
+
+ //! Get the tick count at the epoch
+ high_res_timer_type high_res_timer_epoch(void);
+
+} /* namespace gruel */
+
+////////////////////////////////////////////////////////////////////////
+// Use architecture defines to determine the implementation
+////////////////////////////////////////////////////////////////////////
+#if defined(linux) || defined(__linux) || defined(__linux__)
+ #define GRUEL_HRT_USE_CLOCK_GETTIME
+#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
+ #define GRUEL_HRT_USE_QUERY_PERFORMANCE_COUNTER
+#elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)
+ #define GRUEL_HRT_USE_MACH_ABSOLUTE_TIME
+#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
+ #define GRUEL_HRT_USE_CLOCK_GETTIME
+#else
+ #define GRUEL_HRT_USE_MICROSEC_CLOCK
+#endif
+
+////////////////////////////////////////////////////////////////////////
+#ifdef GRUEL_HRT_USE_CLOCK_GETTIME
+ #include <ctime>
+
+ inline gruel::high_res_timer_type gruel::high_res_timer_now(void){
+ timespec ts;
+ clock_gettime(CLOCK_MONOTONIC, &ts);
+ return ts.tv_sec*high_res_timer_tps() + ts.tv_nsec;
+ }
+
+ inline gruel::high_res_timer_type gruel::high_res_timer_tps(void){
+ return 1000000000UL;
+ }
+#endif /* GRUEL_HRT_USE_CLOCK_GETTIME */
+
+////////////////////////////////////////////////////////////////////////
+#ifdef GRUEL_HRT_USE_MACH_ABSOLUTE_TIME
+ #include <mach/mach_time.h>
+
+ inline gruel::high_res_timer_type gruel::high_res_timer_now(void){
+ return mach_absolute_time();
+ }
+
+ inline gruel::high_res_timer_type gruel::high_res_timer_tps(void){
+ mach_timebase_info_data_t info;
+ mach_timebase_info(&info);
+ return gruel::high_res_timer_type(info.numer*1000000000UL)/info.denom;
+ }
+#endif
+
+////////////////////////////////////////////////////////////////////////
+#ifdef GRUEL_HRT_USE_QUERY_PERFORMANCE_COUNTER
+ #include <Windows.h>
+
+ inline gruel::high_res_timer_type gruel::high_res_timer_now(void){
+ LARGE_INTEGER counts;
+ QueryPerformanceCounter(&counts);
+ return counts.QuadPart;
+ }
+
+ inline gruel::high_res_timer_type gruel::high_res_timer_tps(void){
+ LARGE_INTEGER freq;
+ QueryPerformanceFrequency(&freq);
+ return freq.QuadPart;
+ }
+#endif
+
+////////////////////////////////////////////////////////////////////////
+#ifdef GRUEL_HRT_USE_MICROSEC_CLOCK
+ #include <boost/date_time/posix_time/posix_time.hpp>
+
+ inline gruel::high_res_timer_type gruel::high_res_timer_now(void){
+ static const boost::posix_time::ptime epoch(boost::posix_time::from_time_t(0));
+ return (boost::posix_time::microsec_clock::universal_time() - epoch).ticks();
+ }
+
+ inline gruel::high_res_timer_type gruel::high_res_timer_tps(void){
+ return boost::posix_time::time_duration::ticks_per_second();
+ }
+#endif
+
+////////////////////////////////////////////////////////////////////////
+#include <boost/date_time/posix_time/posix_time.hpp>
+
+inline gruel::high_res_timer_type gruel::high_res_timer_epoch(void){
+ static const double hrt_ticks_per_utc_ticks = gruel::high_res_timer_tps()/double(boost::posix_time::time_duration::ticks_per_second());
+ boost::posix_time::time_duration utc = boost::posix_time::microsec_clock::universal_time() - boost::posix_time::from_time_t(0);
+ return gruel::high_res_timer_now() - utc.ticks()*hrt_ticks_per_utc_ticks;
+}
+
+#endif /* INCLUDED_GRUEL_HIGH_RES_TIMER_H */
diff --git a/gruel/src/include/gruel/msg_accepter.h b/gruel/src/include/gruel/msg_accepter.h
new file mode 100644
index 000000000..45acb3c78
--- /dev/null
+++ b/gruel/src/include/gruel/msg_accepter.h
@@ -0,0 +1,53 @@
+/* -*- 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 this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+#ifndef INCLUDED_GRUEL_MSG_ACCEPTER_H
+#define INCLUDED_GRUEL_MSG_ACCEPTER_H
+
+#include <gruel/api.h>
+#include <gruel/pmt.h>
+#include <boost/shared_ptr.hpp>
+
+namespace gruel {
+
+ /*!
+ * \brief Virtual base class that accepts messages
+ */
+ class GRUEL_API msg_accepter
+ {
+ public:
+ msg_accepter() {};
+ virtual ~msg_accepter();
+
+ /*!
+ * \brief send \p msg to \p msg_accepter on port \p which_port
+ *
+ * Sending a message is an asynchronous operation. The \p post
+ * call will not wait for the message either to arrive at the
+ * destination or to be received.
+ */
+ virtual void post(pmt::pmt_t which_port, pmt::pmt_t msg) = 0;
+ };
+
+ typedef boost::shared_ptr<msg_accepter> msg_accepter_sptr;
+
+} /* namespace gruel */
+
+#endif /* INCLUDED_GRUEL_MSG_ACCEPTER_H */
diff --git a/gruel/src/include/gruel/msg_accepter_msgq.h b/gruel/src/include/gruel/msg_accepter_msgq.h
new file mode 100644
index 000000000..6b9bcf4db
--- /dev/null
+++ b/gruel/src/include/gruel/msg_accepter_msgq.h
@@ -0,0 +1,50 @@
+/* -*- 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 this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef INCLUDED_MSG_ACCEPTER_MSGQ_H
+#define INCLUDED_MSG_ACCEPTER_MSGQ_H
+
+#include <gruel/api.h>
+#include <gruel/msg_accepter.h>
+#include <gruel/msg_queue.h>
+
+namespace gruel {
+
+ /*!
+ * \brief Concrete class that accepts messages and inserts them into a message queue.
+ */
+ class GRUEL_API msg_accepter_msgq : public msg_accepter
+ {
+ protected:
+ msg_queue_sptr d_msg_queue;
+
+ public:
+ msg_accepter_msgq(msg_queue_sptr msgq);
+ ~msg_accepter_msgq();
+
+ virtual void post(pmt::pmt_t msg);
+
+ msg_queue_sptr msg_queue() const { return d_msg_queue; }
+ };
+
+} /* namespace gruel */
+
+#endif /* INCLUDED_MSG_ACCEPTER_MSGQ_H */
diff --git a/gruel/src/include/gruel/msg_passing.h b/gruel/src/include/gruel/msg_passing.h
new file mode 100644
index 000000000..25f30118f
--- /dev/null
+++ b/gruel/src/include/gruel/msg_passing.h
@@ -0,0 +1,116 @@
+/* -*- 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 this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+#ifndef INCLUDED_GRUEL_MSG_PASSING_H
+#define INCLUDED_GRUEL_MSG_PASSING_H
+
+/*!
+ * \brief Include this header to use the message passing features
+ */
+
+#include <gruel/api.h>
+#include <gruel/pmt.h>
+#include <gruel/msg_accepter.h>
+
+
+namespace gruel {
+
+ /*!
+ * \brief send message to msg_accepter
+ *
+ * \param accepter is the target of the send.
+ * \param which_port A pmt symbol describing the port by name.
+ * \param msg is the message to send. It's usually a pmt tuple.
+ *
+ * Sending a message is an asynchronous operation. The \p send
+ * call will not wait for the message either to arrive at the
+ * destination or to be received.
+ *
+ * \returns msg
+ */
+ static inline pmt::pmt_t
+ send(msg_accepter_sptr accepter, const pmt::pmt_t &which_port, const pmt::pmt_t &msg)
+ {
+ accepter->post(which_port, msg);
+ return msg;
+ }
+
+ /*!
+ * \brief send message to msg_accepter
+ *
+ * \param accepter is the target of the send.
+ * \param which_port A pmt symbol describing the port by name.
+ * \param msg is the message to send. It's usually a pmt tuple.
+ *
+ * Sending a message is an asynchronous operation. The \p send
+ * call will not wait for the message either to arrive at the
+ * destination or to be received.
+ *
+ * \returns msg
+ */
+ static inline pmt::pmt_t
+ send(msg_accepter *accepter, const pmt::pmt_t &which_port, const pmt::pmt_t &msg)
+ {
+ accepter->post(which_port, msg);
+ return msg;
+ }
+
+ /*!
+ * \brief send message to msg_accepter
+ *
+ * \param accepter is the target of the send.
+ * \param which_port A pmt symbol describing the port by name.
+ * \param msg is the message to send. It's usually a pmt tuple.
+ *
+ * Sending a message is an asynchronous operation. The \p send
+ * call will not wait for the message either to arrive at the
+ * destination or to be received.
+ *
+ * \returns msg
+ */
+ static inline pmt::pmt_t
+ send(msg_accepter &accepter, const pmt::pmt_t &which_port, const pmt::pmt_t &msg)
+ {
+ accepter.post(which_port, msg);
+ return msg;
+ }
+
+ /*!
+ * \brief send message to msg_accepter
+ *
+ * \param accepter is the target of the send. precond: pmt_is_msg_accepter(accepter)
+ * \param which_port A pmt symbol describing the port by name.
+ * \param msg is the message to send. It's usually a pmt tuple.
+ *
+ * Sending a message is an asynchronous operation. The \p send
+ * call will not wait for the message either to arrive at the
+ * destination or to be received.
+ *
+ * \returns msg
+ */
+ static inline pmt::pmt_t
+ send(pmt::pmt_t accepter, const pmt::pmt_t &which_port, const pmt::pmt_t &msg)
+ {
+ return send(pmt_msg_accepter_ref(accepter), which_port, msg);
+ }
+
+} /* namespace gruel */
+
+#endif /* INCLUDED_GRUEL_MSG_PASSING_H */
diff --git a/gruel/src/include/gruel/msg_queue.h b/gruel/src/include/gruel/msg_queue.h
new file mode 100644
index 000000000..f038ca325
--- /dev/null
+++ b/gruel/src/include/gruel/msg_queue.h
@@ -0,0 +1,91 @@
+/* -*- 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.
+ */
+#ifndef INCLUDED_MSG_QUEUE_H
+#define INCLUDED_MSG_QUEUE_H
+
+#include <gruel/api.h>
+#include <gruel/thread.h>
+#include <gruel/pmt.h>
+#include <deque>
+
+namespace gruel {
+
+ class msg_queue;
+ typedef boost::shared_ptr<msg_queue> msg_queue_sptr;
+
+ msg_queue_sptr make_msg_queue(unsigned int limit=0);
+
+ /*!
+ * \brief thread-safe message queue
+ */
+ class GRUEL_API msg_queue {
+
+ gruel::mutex d_mutex;
+ gruel::condition_variable d_not_empty;
+ gruel::condition_variable d_not_full;
+ unsigned int d_limit; // max # of messages in queue. 0 -> unbounded
+
+ std::deque<pmt::pmt_t> d_msgs;
+
+ public:
+ msg_queue(unsigned int limit);
+ ~msg_queue();
+
+ /*!
+ * \brief Insert message at tail of queue.
+ * \param msg message
+ *
+ * Block if queue if full.
+ */
+ void insert_tail(pmt::pmt_t msg);
+
+ /*!
+ * \brief Delete message from head of queue and return it.
+ * Block if no message is available.
+ */
+ pmt::pmt_t delete_head();
+
+ /*!
+ * \brief If there's a message in the q, delete it and return it.
+ * If no message is available, return pmt_t().
+ */
+ pmt::pmt_t delete_head_nowait();
+
+ //! Delete all messages from the queue
+ void flush();
+
+ //! is the queue empty?
+ bool empty_p() const { return d_msgs.empty(); }
+
+ //! is the queue full?
+ bool full_p() const { return d_limit != 0 && count() >= d_limit; }
+
+ //! return number of messages in queue
+ unsigned int count() const { return d_msgs.size(); }
+
+ //! return limit on number of message in queue. 0 -> unbounded
+ unsigned int limit() const { return d_limit; }
+ };
+
+} /* namespace gruel */
+
+#endif /* INCLUDED_MSG_QUEUE_H */
diff --git a/gruel/src/include/gruel/pmt.h b/gruel/src/include/gruel/pmt.h
new file mode 100644
index 000000000..383a1d44d
--- /dev/null
+++ b/gruel/src/include/gruel/pmt.h
@@ -0,0 +1,864 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006,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.
+ */
+
+#ifndef INCLUDED_PMT_H
+#define INCLUDED_PMT_H
+
+#include <gruel/api.h>
+#include <boost/intrusive_ptr.hpp>
+#include <boost/shared_ptr.hpp>
+#include <boost/any.hpp>
+#include <complex>
+#include <string>
+#include <stdint.h>
+#include <iosfwd>
+#include <stdexcept>
+#include <vector>
+
+namespace gruel {
+ class msg_accepter;
+};
+
+/*!
+ * This file defines a polymorphic type and the operations on it.
+ *
+ * It draws heavily on the idea of scheme and lisp data types.
+ * The interface parallels that in Guile 1.8, with the notable
+ * exception that these objects are transparently reference counted.
+ */
+
+namespace pmt {
+
+/*!
+ * \brief base class of all pmt types
+ */
+class pmt_base;
+
+/*!
+ * \brief typedef for shared pointer (transparent reference counting).
+ * See http://www.boost.org/libs/smart_ptr/smart_ptr.htm
+ */
+typedef boost::intrusive_ptr<pmt_base> pmt_t;
+
+extern GRUEL_API void intrusive_ptr_add_ref(pmt_base*);
+extern GRUEL_API void intrusive_ptr_release(pmt_base*);
+
+class GRUEL_API pmt_exception : public std::logic_error
+{
+public:
+ pmt_exception(const std::string &msg, pmt_t obj);
+};
+
+class GRUEL_API pmt_wrong_type : public pmt_exception
+{
+public:
+ pmt_wrong_type(const std::string &msg, pmt_t obj);
+};
+
+class GRUEL_API pmt_out_of_range : public pmt_exception
+{
+public:
+ pmt_out_of_range(const std::string &msg, pmt_t obj);
+};
+
+class GRUEL_API pmt_notimplemented : public pmt_exception
+{
+public:
+ pmt_notimplemented(const std::string &msg, pmt_t obj);
+};
+
+/*
+ * ------------------------------------------------------------------------
+ * Booleans. Two constants, #t and #f.
+ *
+ * In predicates, anything that is not #f is considered true.
+ * I.e., there is a single false value, #f.
+ * ------------------------------------------------------------------------
+ */
+extern GRUEL_API const pmt_t PMT_T; //< \#t : boolean true constant
+extern GRUEL_API const pmt_t PMT_F; //< \#f : boolean false constant
+
+//! Return true if obj is \#t or \#f, else return false.
+GRUEL_API bool pmt_is_bool(pmt_t obj);
+
+//! Return false if obj is \#f, else return true.
+GRUEL_API bool pmt_is_true(pmt_t obj);
+
+//! Return true if obj is \#f, else return true.
+GRUEL_API bool pmt_is_false(pmt_t obj);
+
+//! Return \#f is val is false, else return \#t.
+GRUEL_API pmt_t pmt_from_bool(bool val);
+
+//! Return true if val is PMT_T, return false when val is PMT_F,
+// else raise wrong_type exception.
+GRUEL_API bool pmt_to_bool(pmt_t val);
+
+/*
+ * ------------------------------------------------------------------------
+ * Symbols
+ * ------------------------------------------------------------------------
+ */
+
+//! Return true if obj is a symbol, else false.
+GRUEL_API bool pmt_is_symbol(const pmt_t& obj);
+
+//! Return the symbol whose name is \p s.
+GRUEL_API pmt_t pmt_string_to_symbol(const std::string &s);
+
+//! Alias for pmt_string_to_symbol
+GRUEL_API pmt_t pmt_intern(const std::string &s);
+
+
+/*!
+ * If \p is a symbol, return the name of the symbol as a string.
+ * Otherwise, raise the wrong_type exception.
+ */
+GRUEL_API const std::string pmt_symbol_to_string(const pmt_t& sym);
+
+/*
+ * ------------------------------------------------------------------------
+ * Numbers: we support integer, real and complex
+ * ------------------------------------------------------------------------
+ */
+
+//! Return true if obj is any kind of number, else false.
+GRUEL_API bool pmt_is_number(pmt_t obj);
+
+/*
+ * ------------------------------------------------------------------------
+ * Integers
+ * ------------------------------------------------------------------------
+ */
+
+//! Return true if \p x is an integer number, else false
+GRUEL_API bool pmt_is_integer(pmt_t x);
+
+//! Return the pmt value that represents the integer \p x.
+GRUEL_API pmt_t pmt_from_long(long x);
+
+/*!
+ * \brief Convert pmt to long if possible.
+ *
+ * When \p x represents an exact integer that fits in a long,
+ * return that integer. Else raise an exception, either wrong_type
+ * when x is not an exact integer, or out_of_range when it doesn't fit.
+ */
+GRUEL_API long pmt_to_long(pmt_t x);
+
+/*
+ * ------------------------------------------------------------------------
+ * uint64_t
+ * ------------------------------------------------------------------------
+ */
+
+//! Return true if \p x is an uint64 number, else false
+GRUEL_API bool pmt_is_uint64(pmt_t x);
+
+//! Return the pmt value that represents the uint64 \p x.
+GRUEL_API pmt_t pmt_from_uint64(uint64_t x);
+
+/*!
+ * \brief Convert pmt to uint64 if possible.
+ *
+ * When \p x represents an exact integer that fits in a uint64,
+ * return that uint64. Else raise an exception, either wrong_type
+ * when x is not an exact uint64, or out_of_range when it doesn't fit.
+ */
+GRUEL_API uint64_t pmt_to_uint64(pmt_t x);
+
+/*
+ * ------------------------------------------------------------------------
+ * Reals
+ * ------------------------------------------------------------------------
+ */
+
+/*
+ * \brief Return true if \p obj is a real number, else false.
+ */
+GRUEL_API bool pmt_is_real(pmt_t obj);
+
+//! Return the pmt value that represents double \p x.
+GRUEL_API pmt_t pmt_from_double(double x);
+
+/*!
+ * \brief Convert pmt to double if possible.
+ *
+ * Returns the number closest to \p val that is representable
+ * as a double. The argument \p val must be a real or integer, otherwise
+ * a wrong_type exception is raised.
+ */
+GRUEL_API double pmt_to_double(pmt_t x);
+
+/*
+ * ------------------------------------------------------------------------
+ * Complex
+ * ------------------------------------------------------------------------
+ */
+
+/*!
+ * \brief return true if \p obj is a complex number, false otherwise.
+ */
+GRUEL_API bool pmt_is_complex(pmt_t obj);
+
+//! Return a complex number constructed of the given real and imaginary parts.
+GRUEL_API pmt_t pmt_make_rectangular(double re, double im);
+
+//! Return a complex number constructed of the given real and imaginary parts.
+GRUEL_API pmt_t pmt_from_complex(double re, double im);
+
+//! Return a complex number constructed of the given a complex number.
+GRUEL_API pmt_t pmt_from_complex(const std::complex<double> &z);
+
+/*!
+ * If \p z is complex, real or integer, return the closest complex<double>.
+ * Otherwise, raise the wrong_type exception.
+ */
+GRUEL_API std::complex<double> pmt_to_complex(pmt_t z);
+
+/*
+ * ------------------------------------------------------------------------
+ * Pairs
+ * ------------------------------------------------------------------------
+ */
+
+extern GRUEL_API const pmt_t PMT_NIL; //< the empty list
+
+//! Return true if \p x is the empty list, otherwise return false.
+GRUEL_API bool pmt_is_null(const pmt_t& x);
+
+//! Return true if \p obj is a pair, else false.
+GRUEL_API bool pmt_is_pair(const pmt_t& obj);
+
+//! Return a newly allocated pair whose car is \p x and whose cdr is \p y.
+GRUEL_API pmt_t pmt_cons(const pmt_t& x, const pmt_t& y);
+
+//! If \p pair is a pair, return the car of the \p pair, otherwise raise wrong_type.
+GRUEL_API pmt_t pmt_car(const pmt_t& pair);
+
+//! If \p pair is a pair, return the cdr of the \p pair, otherwise raise wrong_type.
+GRUEL_API pmt_t pmt_cdr(const pmt_t& pair);
+
+//! Stores \p value in the car field of \p pair.
+GRUEL_API void pmt_set_car(pmt_t pair, pmt_t value);
+
+//! Stores \p value in the cdr field of \p pair.
+GRUEL_API void pmt_set_cdr(pmt_t pair, pmt_t value);
+
+GRUEL_API pmt_t pmt_caar(pmt_t pair);
+GRUEL_API pmt_t pmt_cadr(pmt_t pair);
+GRUEL_API pmt_t pmt_cdar(pmt_t pair);
+GRUEL_API pmt_t pmt_cddr(pmt_t pair);
+GRUEL_API pmt_t pmt_caddr(pmt_t pair);
+GRUEL_API pmt_t pmt_cadddr(pmt_t pair);
+
+/*
+ * ------------------------------------------------------------------------
+ * Tuples
+ *
+ * Store a fixed number of objects. Tuples are not modifiable, and thus
+ * are excellent for use as messages. Indexing is zero based.
+ * Access time to an element is O(1).
+ * ------------------------------------------------------------------------
+ */
+
+//! Return true if \p x is a tuple, othewise false.
+GRUEL_API bool pmt_is_tuple(pmt_t x);
+
+GRUEL_API pmt_t pmt_make_tuple();
+GRUEL_API pmt_t pmt_make_tuple(const pmt_t &e0);
+GRUEL_API pmt_t pmt_make_tuple(const pmt_t &e0, const pmt_t &e1);
+GRUEL_API pmt_t pmt_make_tuple(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2);
+GRUEL_API pmt_t pmt_make_tuple(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3);
+GRUEL_API pmt_t pmt_make_tuple(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4);
+GRUEL_API pmt_t pmt_make_tuple(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4, const pmt_t &e5);
+GRUEL_API pmt_t pmt_make_tuple(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4, const pmt_t &e5, const pmt_t &e6);
+GRUEL_API pmt_t pmt_make_tuple(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4, const pmt_t &e5, const pmt_t &e6, const pmt_t &e7);
+GRUEL_API pmt_t pmt_make_tuple(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4, const pmt_t &e5, const pmt_t &e6, const pmt_t &e7, const pmt_t &e8);
+GRUEL_API pmt_t pmt_make_tuple(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4, const pmt_t &e5, const pmt_t &e6, const pmt_t &e7, const pmt_t &e8, const pmt_t &e9);
+
+/*!
+ * If \p x is a vector or proper list, return a tuple containing the elements of x
+ */
+GRUEL_API pmt_t pmt_to_tuple(const pmt_t &x);
+
+/*!
+ * Return the contents of position \p k of \p tuple.
+ * \p k must be a valid index of \p tuple.
+ */
+GRUEL_API pmt_t pmt_tuple_ref(const pmt_t &tuple, size_t k);
+
+/*
+ * ------------------------------------------------------------------------
+ * Vectors
+ *
+ * These vectors can hold any kind of objects. Indexing is zero based.
+ * ------------------------------------------------------------------------
+ */
+
+//! Return true if \p x is a vector, othewise false.
+GRUEL_API bool pmt_is_vector(pmt_t x);
+
+//! Make a vector of length \p k, with initial values set to \p fill
+GRUEL_API pmt_t pmt_make_vector(size_t k, pmt_t fill);
+
+/*!
+ * Return the contents of position \p k of \p vector.
+ * \p k must be a valid index of \p vector.
+ */
+GRUEL_API pmt_t pmt_vector_ref(pmt_t vector, size_t k);
+
+//! Store \p obj in position \p k.
+GRUEL_API void pmt_vector_set(pmt_t vector, size_t k, pmt_t obj);
+
+//! Store \p fill in every position of \p vector
+GRUEL_API void pmt_vector_fill(pmt_t vector, pmt_t fill);
+
+/*
+ * ------------------------------------------------------------------------
+ * Binary Large Objects (BLOBs)
+ *
+ * Handy for passing around uninterpreted chunks of memory.
+ * ------------------------------------------------------------------------
+ */
+
+//! Return true if \p x is a blob, othewise false.
+GRUEL_API bool pmt_is_blob(pmt_t x);
+
+/*!
+ * \brief Make a blob given a pointer and length in bytes
+ *
+ * \param buf is the pointer to data to use to create blob
+ * \param len is the size of the data in bytes.
+ *
+ * The data is copied into the blob.
+ */
+GRUEL_API pmt_t pmt_make_blob(const void *buf, size_t len);
+
+//! Return a pointer to the blob's data
+GRUEL_API const void *pmt_blob_data(pmt_t blob);
+
+//! Return the blob's length in bytes
+GRUEL_API size_t pmt_blob_length(pmt_t blob);
+
+/*!
+ * <pre>
+ * ------------------------------------------------------------------------
+ * Uniform Numeric Vectors
+ *
+ * A uniform numeric vector is a vector whose elements are all of single
+ * numeric type. pmt offers uniform numeric vectors for signed and
+ * unsigned 8-bit, 16-bit, 32-bit, and 64-bit integers, two sizes of
+ * floating point values, and complex floating-point numbers of these
+ * two sizes. Indexing is zero based.
+ *
+ * The names of the functions include these tags in their names:
+ *
+ * u8 unsigned 8-bit integers
+ * s8 signed 8-bit integers
+ * u16 unsigned 16-bit integers
+ * s16 signed 16-bit integers
+ * u32 unsigned 32-bit integers
+ * s32 signed 32-bit integers
+ * u64 unsigned 64-bit integers
+ * s64 signed 64-bit integers
+ * f32 the C++ type float
+ * f64 the C++ type double
+ * c32 the C++ type complex<float>
+ * c64 the C++ type complex<double>
+ * ------------------------------------------------------------------------
+ * </pre>
+ */
+
+//! true if \p x is any kind of uniform numeric vector
+GRUEL_API bool pmt_is_uniform_vector(pmt_t x);
+
+GRUEL_API bool pmt_is_u8vector(pmt_t x);
+GRUEL_API bool pmt_is_s8vector(pmt_t x);
+GRUEL_API bool pmt_is_u16vector(pmt_t x);
+GRUEL_API bool pmt_is_s16vector(pmt_t x);
+GRUEL_API bool pmt_is_u32vector(pmt_t x);
+GRUEL_API bool pmt_is_s32vector(pmt_t x);
+GRUEL_API bool pmt_is_u64vector(pmt_t x);
+GRUEL_API bool pmt_is_s64vector(pmt_t x);
+GRUEL_API bool pmt_is_f32vector(pmt_t x);
+GRUEL_API bool pmt_is_f64vector(pmt_t x);
+GRUEL_API bool pmt_is_c32vector(pmt_t x);
+GRUEL_API bool pmt_is_c64vector(pmt_t x);
+
+GRUEL_API pmt_t pmt_make_u8vector(size_t k, uint8_t fill);
+GRUEL_API pmt_t pmt_make_s8vector(size_t k, int8_t fill);
+GRUEL_API pmt_t pmt_make_u16vector(size_t k, uint16_t fill);
+GRUEL_API pmt_t pmt_make_s16vector(size_t k, int16_t fill);
+GRUEL_API pmt_t pmt_make_u32vector(size_t k, uint32_t fill);
+GRUEL_API pmt_t pmt_make_s32vector(size_t k, int32_t fill);
+GRUEL_API pmt_t pmt_make_u64vector(size_t k, uint64_t fill);
+GRUEL_API pmt_t pmt_make_s64vector(size_t k, int64_t fill);
+GRUEL_API pmt_t pmt_make_f32vector(size_t k, float fill);
+GRUEL_API pmt_t pmt_make_f64vector(size_t k, double fill);
+GRUEL_API pmt_t pmt_make_c32vector(size_t k, std::complex<float> fill);
+GRUEL_API pmt_t pmt_make_c64vector(size_t k, std::complex<double> fill);
+
+GRUEL_API pmt_t pmt_init_u8vector(size_t k, const uint8_t *data);
+GRUEL_API pmt_t pmt_init_u8vector(size_t k, const std::vector<uint8_t> &data);
+GRUEL_API pmt_t pmt_init_s8vector(size_t k, const int8_t *data);
+GRUEL_API pmt_t pmt_init_s8vector(size_t k, const std::vector<int8_t> &data);
+GRUEL_API pmt_t pmt_init_u16vector(size_t k, const uint16_t *data);
+GRUEL_API pmt_t pmt_init_u16vector(size_t k, const std::vector<uint16_t> &data);
+GRUEL_API pmt_t pmt_init_s16vector(size_t k, const int16_t *data);
+GRUEL_API pmt_t pmt_init_s16vector(size_t k, const std::vector<int16_t> &data);
+GRUEL_API pmt_t pmt_init_u32vector(size_t k, const uint32_t *data);
+GRUEL_API pmt_t pmt_init_u32vector(size_t k, const std::vector<uint32_t> &data);
+GRUEL_API pmt_t pmt_init_s32vector(size_t k, const int32_t *data);
+GRUEL_API pmt_t pmt_init_s32vector(size_t k, const std::vector<int32_t> &data);
+GRUEL_API pmt_t pmt_init_u64vector(size_t k, const uint64_t *data);
+GRUEL_API pmt_t pmt_init_u64vector(size_t k, const std::vector<uint64_t> &data);
+GRUEL_API pmt_t pmt_init_s64vector(size_t k, const int64_t *data);
+GRUEL_API pmt_t pmt_init_s64vector(size_t k, const std::vector<int64_t> &data);
+GRUEL_API pmt_t pmt_init_f32vector(size_t k, const float *data);
+GRUEL_API pmt_t pmt_init_f32vector(size_t k, const std::vector<float> &data);
+GRUEL_API pmt_t pmt_init_f64vector(size_t k, const double *data);
+GRUEL_API pmt_t pmt_init_f64vector(size_t k, const std::vector<double> &data);
+GRUEL_API pmt_t pmt_init_c32vector(size_t k, const std::complex<float> *data);
+GRUEL_API pmt_t pmt_init_c32vector(size_t k, const std::vector<std::complex<float> > &data);
+GRUEL_API pmt_t pmt_init_c64vector(size_t k, const std::complex<double> *data);
+GRUEL_API pmt_t pmt_init_c64vector(size_t k, const std::vector<std::complex<double> > &data);
+
+GRUEL_API uint8_t pmt_u8vector_ref(pmt_t v, size_t k);
+GRUEL_API int8_t pmt_s8vector_ref(pmt_t v, size_t k);
+GRUEL_API uint16_t pmt_u16vector_ref(pmt_t v, size_t k);
+GRUEL_API int16_t pmt_s16vector_ref(pmt_t v, size_t k);
+GRUEL_API uint32_t pmt_u32vector_ref(pmt_t v, size_t k);
+GRUEL_API int32_t pmt_s32vector_ref(pmt_t v, size_t k);
+GRUEL_API uint64_t pmt_u64vector_ref(pmt_t v, size_t k);
+GRUEL_API int64_t pmt_s64vector_ref(pmt_t v, size_t k);
+GRUEL_API float pmt_f32vector_ref(pmt_t v, size_t k);
+GRUEL_API double pmt_f64vector_ref(pmt_t v, size_t k);
+GRUEL_API std::complex<float> pmt_c32vector_ref(pmt_t v, size_t k);
+GRUEL_API std::complex<double> pmt_c64vector_ref(pmt_t v, size_t k);
+
+GRUEL_API void pmt_u8vector_set(pmt_t v, size_t k, uint8_t x); //< v[k] = x
+GRUEL_API void pmt_s8vector_set(pmt_t v, size_t k, int8_t x);
+GRUEL_API void pmt_u16vector_set(pmt_t v, size_t k, uint16_t x);
+GRUEL_API void pmt_s16vector_set(pmt_t v, size_t k, int16_t x);
+GRUEL_API void pmt_u32vector_set(pmt_t v, size_t k, uint32_t x);
+GRUEL_API void pmt_s32vector_set(pmt_t v, size_t k, int32_t x);
+GRUEL_API void pmt_u64vector_set(pmt_t v, size_t k, uint64_t x);
+GRUEL_API void pmt_s64vector_set(pmt_t v, size_t k, int64_t x);
+GRUEL_API void pmt_f32vector_set(pmt_t v, size_t k, float x);
+GRUEL_API void pmt_f64vector_set(pmt_t v, size_t k, double x);
+GRUEL_API void pmt_c32vector_set(pmt_t v, size_t k, std::complex<float> x);
+GRUEL_API void pmt_c64vector_set(pmt_t v, size_t k, std::complex<double> x);
+
+// Return const pointers to the elements
+
+GRUEL_API const void *pmt_uniform_vector_elements(pmt_t v, size_t &len); //< works with any; len is in bytes
+
+GRUEL_API const uint8_t *pmt_u8vector_elements(pmt_t v, size_t &len); //< len is in elements
+GRUEL_API const int8_t *pmt_s8vector_elements(pmt_t v, size_t &len); //< len is in elements
+GRUEL_API const uint16_t *pmt_u16vector_elements(pmt_t v, size_t &len); //< len is in elements
+GRUEL_API const int16_t *pmt_s16vector_elements(pmt_t v, size_t &len); //< len is in elements
+GRUEL_API const uint32_t *pmt_u32vector_elements(pmt_t v, size_t &len); //< len is in elements
+GRUEL_API const int32_t *pmt_s32vector_elements(pmt_t v, size_t &len); //< len is in elements
+GRUEL_API const uint64_t *pmt_u64vector_elements(pmt_t v, size_t &len); //< len is in elements
+GRUEL_API const int64_t *pmt_s64vector_elements(pmt_t v, size_t &len); //< len is in elements
+GRUEL_API const float *pmt_f32vector_elements(pmt_t v, size_t &len); //< len is in elements
+GRUEL_API const double *pmt_f64vector_elements(pmt_t v, size_t &len); //< len is in elements
+GRUEL_API const std::complex<float> *pmt_c32vector_elements(pmt_t v, size_t &len); //< len is in elements
+GRUEL_API const std::complex<double> *pmt_c64vector_elements(pmt_t v, size_t &len); //< len is in elements
+
+// len is in elements
+GRUEL_API const std::vector<uint8_t> pmt_u8vector_elements(pmt_t v);
+GRUEL_API const std::vector<int8_t> pmt_s8vector_elements(pmt_t v);
+GRUEL_API const std::vector<uint16_t> pmt_u16vector_elements(pmt_t v);
+GRUEL_API const std::vector<int16_t> pmt_s16vector_elements(pmt_t v);
+GRUEL_API const std::vector<uint32_t> pmt_u32vector_elements(pmt_t v);
+GRUEL_API const std::vector<int32_t> pmt_s32vector_elements(pmt_t v);
+GRUEL_API const std::vector<uint64_t> pmt_u64vector_elements(pmt_t v);
+GRUEL_API const std::vector<int64_t> pmt_s64vector_elements(pmt_t v);
+GRUEL_API const std::vector<float> pmt_f32vector_elements(pmt_t v);
+GRUEL_API const std::vector<double> pmt_f64vector_elements(pmt_t v);
+GRUEL_API const std::vector<std::complex<float> > pmt_c32vector_elements(pmt_t v);
+GRUEL_API const std::vector<std::complex<double> > pmt_c64vector_elements(pmt_t v);
+
+// Return non-const pointers to the elements
+
+GRUEL_API void *pmt_uniform_vector_writable_elements(pmt_t v, size_t &len); //< works with any; len is in bytes
+
+GRUEL_API uint8_t *pmt_u8vector_writable_elements(pmt_t v, size_t &len); //< len is in elements
+GRUEL_API int8_t *pmt_s8vector_writable_elements(pmt_t v, size_t &len); //< len is in elements
+GRUEL_API uint16_t *pmt_u16vector_writable_elements(pmt_t v, size_t &len); //< len is in elements
+GRUEL_API int16_t *pmt_s16vector_writable_elements(pmt_t v, size_t &len); //< len is in elements
+GRUEL_API uint32_t *pmt_u32vector_writable_elements(pmt_t v, size_t &len); //< len is in elements
+GRUEL_API int32_t *pmt_s32vector_writable_elements(pmt_t v, size_t &len); //< len is in elements
+GRUEL_API uint64_t *pmt_u64vector_writable_elements(pmt_t v, size_t &len); //< len is in elements
+GRUEL_API int64_t *pmt_s64vector_writable_elements(pmt_t v, size_t &len); //< len is in elements
+GRUEL_API float *pmt_f32vector_writable_elements(pmt_t v, size_t &len); //< len is in elements
+GRUEL_API double *pmt_f64vector_writable_elements(pmt_t v, size_t &len); //< len is in elements
+GRUEL_API std::complex<float> *pmt_c32vector_writable_elements(pmt_t v, size_t &len); //< len is in elements
+GRUEL_API std::complex<double> *pmt_c64vector_writable_elements(pmt_t v, size_t &len); //< len is in elements
+
+/*
+ * ------------------------------------------------------------------------
+ * Dictionary (a.k.a associative array, hash, map)
+ *
+ * This is a functional data structure that is persistent. Updating a
+ * functional data structure does not destroy the existing version, but
+ * rather creates a new version that coexists with the old.
+ * ------------------------------------------------------------------------
+ */
+
+//! Return true if \p obj is a dictionary
+GRUEL_API bool pmt_is_dict(const pmt_t &obj);
+
+//! Make an empty dictionary
+GRUEL_API pmt_t pmt_make_dict();
+
+//! Return a new dictionary with \p key associated with \p value.
+GRUEL_API pmt_t pmt_dict_add(const pmt_t &dict, const pmt_t &key, const pmt_t &value);
+
+//! Return a new dictionary with \p key removed.
+GRUEL_API pmt_t pmt_dict_delete(const pmt_t &dict, const pmt_t &key);
+
+//! Return true if \p key exists in \p dict
+GRUEL_API bool pmt_dict_has_key(const pmt_t &dict, const pmt_t &key);
+
+//! If \p key exists in \p dict, return associated value; otherwise return \p not_found.
+GRUEL_API pmt_t pmt_dict_ref(const pmt_t &dict, const pmt_t &key, const pmt_t &not_found);
+
+//! Return list of (key . value) pairs
+GRUEL_API pmt_t pmt_dict_items(pmt_t dict);
+
+//! Return list of keys
+GRUEL_API pmt_t pmt_dict_keys(pmt_t dict);
+
+//! Return list of values
+GRUEL_API pmt_t pmt_dict_values(pmt_t dict);
+
+/*
+ * ------------------------------------------------------------------------
+ * Any (wraps boost::any -- can be used to wrap pretty much anything)
+ *
+ * Cannot be serialized or used across process boundaries.
+ * See http://www.boost.org/doc/html/any.html
+ * ------------------------------------------------------------------------
+ */
+
+//! Return true if \p obj is an any
+GRUEL_API bool pmt_is_any(pmt_t obj);
+
+//! make an any
+GRUEL_API pmt_t pmt_make_any(const boost::any &any);
+
+//! Return underlying boost::any
+GRUEL_API boost::any pmt_any_ref(pmt_t obj);
+
+//! Store \p any in \p obj
+GRUEL_API void pmt_any_set(pmt_t obj, const boost::any &any);
+
+
+/*
+ * ------------------------------------------------------------------------
+ * msg_accepter -- pmt representation of gruel::msg_accepter
+ * ------------------------------------------------------------------------
+ */
+//! Return true if \p obj is a msg_accepter
+GRUEL_API bool pmt_is_msg_accepter(const pmt_t &obj);
+
+//! make a msg_accepter
+GRUEL_API pmt_t pmt_make_msg_accepter(boost::shared_ptr<gruel::msg_accepter> ma);
+
+//! Return underlying msg_accepter
+GRUEL_API boost::shared_ptr<gruel::msg_accepter> pmt_msg_accepter_ref(const pmt_t &obj);
+
+/*
+ * ------------------------------------------------------------------------
+ * General functions
+ * ------------------------------------------------------------------------
+ */
+
+//! Return true if x and y are the same object; otherwise return false.
+GRUEL_API bool pmt_eq(const pmt_t& x, const pmt_t& y);
+
+/*!
+ * \brief Return true if x and y should normally be regarded as the same object, else false.
+ *
+ * <pre>
+ * eqv returns true if:
+ * x and y are the same object.
+ * x and y are both \#t or both \#f.
+ * x and y are both symbols and their names are the same.
+ * x and y are both numbers, and are numerically equal.
+ * x and y are both the empty list (nil).
+ * x and y are pairs or vectors that denote same location in store.
+ * </pre>
+ */
+GRUEL_API bool pmt_eqv(const pmt_t& x, const pmt_t& y);
+
+/*!
+ * pmt_equal recursively compares the contents of pairs and vectors,
+ * applying pmt_eqv on other objects such as numbers and symbols.
+ * pmt_equal may fail to terminate if its arguments are circular data
+ * structures.
+ */
+GRUEL_API bool pmt_equal(const pmt_t& x, const pmt_t& y);
+
+
+//! Return the number of elements in v
+GRUEL_API size_t pmt_length(const pmt_t& v);
+
+/*!
+ * \brief Find the first pair in \p alist whose car field is \p obj
+ * and return that pair.
+ *
+ * \p alist (for "association list") must be a list of pairs. If no pair
+ * in \p alist has \p obj as its car then \#f is returned.
+ * Uses pmt_eq to compare \p obj with car fields of the pairs in \p alist.
+ */
+GRUEL_API pmt_t pmt_assq(pmt_t obj, pmt_t alist);
+
+/*!
+ * \brief Find the first pair in \p alist whose car field is \p obj
+ * and return that pair.
+ *
+ * \p alist (for "association list") must be a list of pairs. If no pair
+ * in \p alist has \p obj as its car then \#f is returned.
+ * Uses pmt_eqv to compare \p obj with car fields of the pairs in \p alist.
+ */
+GRUEL_API pmt_t pmt_assv(pmt_t obj, pmt_t alist);
+
+/*!
+ * \brief Find the first pair in \p alist whose car field is \p obj
+ * and return that pair.
+ *
+ * \p alist (for "association list") must be a list of pairs. If no pair
+ * in \p alist has \p obj as its car then \#f is returned.
+ * Uses pmt_equal to compare \p obj with car fields of the pairs in \p alist.
+ */
+GRUEL_API pmt_t pmt_assoc(pmt_t obj, pmt_t alist);
+
+/*!
+ * \brief Apply \p proc element-wise to the elements of list and returns
+ * a list of the results, in order.
+ *
+ * \p list must be a list. The dynamic order in which \p proc is
+ * applied to the elements of \p list is unspecified.
+ */
+GRUEL_API pmt_t pmt_map(pmt_t proc(const pmt_t&), pmt_t list);
+
+/*!
+ * \brief reverse \p list.
+ *
+ * \p list must be a proper list.
+ */
+GRUEL_API pmt_t pmt_reverse(pmt_t list);
+
+/*!
+ * \brief destructively reverse \p list.
+ *
+ * \p list must be a proper list.
+ */
+GRUEL_API pmt_t pmt_reverse_x(pmt_t list);
+
+/*!
+ * \brief (acons x y a) == (cons (cons x y) a)
+ */
+inline static pmt_t
+pmt_acons(pmt_t x, pmt_t y, pmt_t a)
+{
+ return pmt_cons(pmt_cons(x, y), a);
+}
+
+/*!
+ * \brief locates \p nth element of \n list where the car is the 'zeroth' element.
+ */
+GRUEL_API pmt_t pmt_nth(size_t n, pmt_t list);
+
+/*!
+ * \brief returns the tail of \p list that would be obtained by calling
+ * cdr \p n times in succession.
+ */
+GRUEL_API pmt_t pmt_nthcdr(size_t n, pmt_t list);
+
+/*!
+ * \brief Return the first sublist of \p list whose car is \p obj.
+ * If \p obj does not occur in \p list, then \#f is returned.
+ * pmt_memq use pmt_eq to compare \p obj with the elements of \p list.
+ */
+GRUEL_API pmt_t pmt_memq(pmt_t obj, pmt_t list);
+
+/*!
+ * \brief Return the first sublist of \p list whose car is \p obj.
+ * If \p obj does not occur in \p list, then \#f is returned.
+ * pmt_memv use pmt_eqv to compare \p obj with the elements of \p list.
+ */
+GRUEL_API pmt_t pmt_memv(pmt_t obj, pmt_t list);
+
+/*!
+ * \brief Return the first sublist of \p list whose car is \p obj.
+ * If \p obj does not occur in \p list, then \#f is returned.
+ * pmt_member use pmt_equal to compare \p obj with the elements of \p list.
+ */
+GRUEL_API pmt_t pmt_member(pmt_t obj, pmt_t list);
+
+/*!
+ * \brief Return true if every element of \p list1 appears in \p list2, and false otherwise.
+ * Comparisons are done with pmt_eqv.
+ */
+GRUEL_API bool pmt_subsetp(pmt_t list1, pmt_t list2);
+
+/*!
+ * \brief Return a list of length 1 containing \p x1
+ */
+GRUEL_API pmt_t pmt_list1(const pmt_t& x1);
+
+/*!
+ * \brief Return a list of length 2 containing \p x1, \p x2
+ */
+GRUEL_API pmt_t pmt_list2(const pmt_t& x1, const pmt_t& x2);
+
+/*!
+ * \brief Return a list of length 3 containing \p x1, \p x2, \p x3
+ */
+GRUEL_API pmt_t pmt_list3(const pmt_t& x1, const pmt_t& x2, const pmt_t& x3);
+
+/*!
+ * \brief Return a list of length 4 containing \p x1, \p x2, \p x3, \p x4
+ */
+GRUEL_API pmt_t pmt_list4(const pmt_t& x1, const pmt_t& x2, const pmt_t& x3, const pmt_t& x4);
+
+/*!
+ * \brief Return a list of length 5 containing \p x1, \p x2, \p x3, \p x4, \p x5
+ */
+GRUEL_API pmt_t pmt_list5(const pmt_t& x1, const pmt_t& x2, const pmt_t& x3, const pmt_t& x4, const pmt_t& x5);
+
+/*!
+ * \brief Return a list of length 6 containing \p x1, \p x2, \p x3, \p x4, \p
+ * x5, \p x6
+ */
+GRUEL_API pmt_t pmt_list6(const pmt_t& x1, const pmt_t& x2, const pmt_t& x3, const pmt_t& x4, const pmt_t& x5, const pmt_t& x6);
+
+/*!
+ * \brief Return \p list with \p item added to it.
+ */
+GRUEL_API pmt_t pmt_list_add(pmt_t list, const pmt_t& item);
+
+/*!
+ * \brief Return \p list with \p item removed from it.
+ */
+GRUEL_API pmt_t pmt_list_rm(pmt_t list, const pmt_t& item);
+
+/*!
+ * \brief Return bool of \p list contains \p item
+ */
+GRUEL_API bool pmt_list_has(pmt_t list, const pmt_t& item);
+
+
+/*
+ * ------------------------------------------------------------------------
+ * read / write
+ * ------------------------------------------------------------------------
+ */
+extern GRUEL_API const pmt_t PMT_EOF; //< The end of file object
+
+//! return true if obj is the EOF object, otherwise return false.
+GRUEL_API bool pmt_is_eof_object(pmt_t obj);
+
+/*!
+ * read converts external representations of pmt objects into the
+ * objects themselves. Read returns the next object parsable from
+ * the given input port, updating port to point to the first
+ * character past the end of the external representation of the
+ * object.
+ *
+ * If an end of file is encountered in the input before any
+ * characters are found that can begin an object, then an end of file
+ * object is returned. The port remains open, and further attempts
+ * to read will also return an end of file object. If an end of file
+ * is encountered after the beginning of an object's external
+ * representation, but the external representation is incomplete and
+ * therefore not parsable, an error is signaled.
+ */
+GRUEL_API pmt_t pmt_read(std::istream &port);
+
+/*!
+ * Write a written representation of \p obj to the given \p port.
+ */
+GRUEL_API void pmt_write(pmt_t obj, std::ostream &port);
+
+/*!
+ * Return a string representation of \p obj.
+ * This is the same output as would be generated by pmt_write.
+ */
+GRUEL_API std::string pmt_write_string(pmt_t obj);
+
+
+GRUEL_API std::ostream& operator<<(std::ostream &os, pmt_t obj);
+
+/*!
+ * \brief Write pmt string representation to stdout.
+ */
+GRUEL_API void pmt_print(pmt_t v);
+
+
+/*
+ * ------------------------------------------------------------------------
+ * portable byte stream representation
+ * ------------------------------------------------------------------------
+ */
+/*!
+ * \brief Write portable byte-serial representation of \p obj to \p sink
+ */
+GRUEL_API bool pmt_serialize(pmt_t obj, std::streambuf &sink);
+
+/*!
+ * \brief Create obj from portable byte-serial representation
+ */
+GRUEL_API pmt_t pmt_deserialize(std::streambuf &source);
+
+
+GRUEL_API void pmt_dump_sizeof(); // debugging
+
+/*!
+ * \brief Provide a simple string generating interface to pmt's serialize function
+ */
+GRUEL_API std::string pmt_serialize_str(pmt_t obj);
+
+/*!
+ * \brief Provide a simple string generating interface to pmt's deserialize function
+ */
+GRUEL_API pmt_t pmt_deserialize_str(std::string str);
+
+/*!
+ * \brief Provide a comparator function object to allow pmt use in stl types
+ */
+class pmt_comperator {
+ public:
+ bool operator()(pmt::pmt_t const& p1, pmt::pmt_t const& p2) const
+ { return pmt::pmt_eqv(p1,p2)?false:p1.get()>p2.get(); }
+ };
+
+} /* namespace pmt */
+
+#include <gruel/pmt_sugar.h>
+
+#endif /* INCLUDED_PMT_H */
diff --git a/gruel/src/include/gruel/pmt_pool.h b/gruel/src/include/gruel/pmt_pool.h
new file mode 100644
index 000000000..93c5290ad
--- /dev/null
+++ b/gruel/src/include/gruel/pmt_pool.h
@@ -0,0 +1,73 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007,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 this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+#ifndef INCLUDED_PMT_POOL_H
+#define INCLUDED_PMT_POOL_H
+
+#include <gruel/api.h>
+#include <cstddef>
+#include <vector>
+#include <boost/thread.hpp>
+
+namespace pmt {
+
+/*!
+ * \brief very simple thread-safe fixed-size allocation pool
+ *
+ * FIXME may want to go to global allocation with per-thread free list.
+ * This would eliminate virtually all lock contention.
+ */
+class GRUEL_API pmt_pool {
+
+ struct GRUEL_API item {
+ struct item *d_next;
+ };
+
+ typedef boost::unique_lock<boost::mutex> scoped_lock;
+ mutable boost::mutex d_mutex;
+ boost::condition_variable d_cond;
+
+ size_t d_itemsize;
+ size_t d_alignment;
+ size_t d_allocation_size;
+ size_t d_max_items;
+ size_t d_n_items;
+ item *d_freelist;
+ std::vector<char *> d_allocations;
+
+public:
+ /*!
+ * \param itemsize size in bytes of the items to be allocated.
+ * \param alignment alignment in bytes of all objects to be allocated (must be power-of-2).
+ * \param allocation_size number of bytes to allocate at a time from the underlying allocator.
+ * \param max_items is the maximum number of items to allocate. If this number is exceeded,
+ * the allocate blocks. 0 implies no limit.
+ */
+ pmt_pool(size_t itemsize, size_t alignment = 16,
+ size_t allocation_size = 4096, size_t max_items = 0);
+ ~pmt_pool();
+
+ void *malloc();
+ void free(void *p);
+};
+
+} /* namespace pmt */
+
+#endif /* INCLUDED_PMT_POOL_H */
diff --git a/gruel/src/include/gruel/pmt_sugar.h b/gruel/src/include/gruel/pmt_sugar.h
new file mode 100644
index 000000000..bde7f716d
--- /dev/null
+++ b/gruel/src/include/gruel/pmt_sugar.h
@@ -0,0 +1,171 @@
+/* -*- 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 this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+#ifndef INCLUDED_GRUEL_PMT_SUGAR_H
+#define INCLUDED_GRUEL_PMT_SUGAR_H
+
+/*!
+ * This file is included by pmt.h and contains pseudo-constructor
+ * shorthand for making pmt objects
+ */
+
+namespace pmt {
+
+ //! Make pmt symbol
+ static inline pmt_t
+ mp(const std::string &s)
+ {
+ return pmt_string_to_symbol(s);
+ }
+
+ //! Make pmt symbol
+ static inline pmt_t
+ mp(const char *s)
+ {
+ return pmt_string_to_symbol(s);
+ }
+
+ //! Make pmt long
+ static inline pmt_t
+ mp(long x){
+ return pmt_from_long(x);
+ }
+
+ //! Make pmt long
+ static inline pmt_t
+ mp(long long unsigned x){
+ return pmt_from_long(x);
+ }
+
+ //! Make pmt long
+ static inline pmt_t
+ mp(int x){
+ return pmt_from_long(x);
+ }
+
+ //! Make pmt double
+ static inline pmt_t
+ mp(double x){
+ return pmt_from_double(x);
+ }
+
+ //! Make pmt complex
+ static inline pmt_t
+ mp(std::complex<double> z)
+ {
+ return pmt_make_rectangular(z.real(), z.imag());
+ }
+
+ //! Make pmt complex
+ static inline pmt_t
+ mp(std::complex<float> z)
+ {
+ return pmt_make_rectangular(z.real(), z.imag());
+ }
+
+ //! Make pmt msg_accepter
+ static inline pmt_t
+ mp(boost::shared_ptr<gruel::msg_accepter> ma)
+ {
+ return pmt_make_msg_accepter(ma);
+ }
+
+ //! Make pmt Binary Large Object (BLOB)
+ static inline pmt_t
+ mp(const void *data, size_t len_in_bytes)
+ {
+ return pmt_make_blob(data, len_in_bytes);
+ }
+
+ //! Make tuple
+ static inline pmt_t
+ mp(const pmt_t &e0)
+ {
+ return pmt_make_tuple(e0);
+ }
+
+ //! Make tuple
+ static inline pmt_t
+ mp(const pmt_t &e0, const pmt_t &e1)
+ {
+ return pmt_make_tuple(e0, e1);
+ }
+
+ //! Make tuple
+ static inline pmt_t
+ mp(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2)
+ {
+ return pmt_make_tuple(e0, e1, e2);
+ }
+
+ //! Make tuple
+ static inline pmt_t
+ mp(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3)
+ {
+ return pmt_make_tuple(e0, e1, e2, e3);
+ }
+
+ //! Make tuple
+ static inline pmt_t
+ mp(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4)
+ {
+ return pmt_make_tuple(e0, e1, e2, e3, e4);
+ }
+
+ //! Make tuple
+ static inline pmt_t
+ mp(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4, const pmt_t &e5)
+ {
+ return pmt_make_tuple(e0, e1, e2, e3, e4, e5);
+ }
+
+ //! Make tuple
+ static inline pmt_t
+ mp(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4, const pmt_t &e5, const pmt_t &e6)
+ {
+ return pmt_make_tuple(e0, e1, e2, e3, e4, e5, e6);
+ }
+
+ //! Make tuple
+ static inline pmt_t
+ mp(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4, const pmt_t &e5, const pmt_t &e6, const pmt_t &e7)
+ {
+ return pmt_make_tuple(e0, e1, e2, e3, e4, e5, e6, e7);
+ }
+
+ //! Make tuple
+ static inline pmt_t
+ mp(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4, const pmt_t &e5, const pmt_t &e6, const pmt_t &e7, const pmt_t &e8)
+ {
+ return pmt_make_tuple(e0, e1, e2, e3, e4, e5, e6, e7, e8);
+ }
+
+ //! Make tuple
+ static inline pmt_t
+ mp(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4, const pmt_t &e5, const pmt_t &e6, const pmt_t &e7, const pmt_t &e8, const pmt_t &e9)
+ {
+ return pmt_make_tuple(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9);
+ }
+
+
+} /* namespace pmt */
+
+
+#endif /* INCLUDED_GRUEL_PMT_SUGAR_H */
diff --git a/gruel/src/include/gruel/realtime.h b/gruel/src/include/gruel/realtime.h
new file mode 100644
index 000000000..13673ecb3
--- /dev/null
+++ b/gruel/src/include/gruel/realtime.h
@@ -0,0 +1,96 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006,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.
+ */
+
+#ifndef INCLUDED_GRUEL_REALTIME_H
+#define INCLUDED_GRUEL_REALTIME_H
+
+#include <gruel/api.h>
+#include <stdexcept>
+
+/*!
+ * \brief System independent way to ask for realtime scheduling
+ *
+ * \sa sys_pri.h
+ */
+
+namespace gruel {
+
+ typedef enum {
+ RT_OK = 0,
+ RT_NOT_IMPLEMENTED,
+ RT_NO_PRIVS,
+ RT_OTHER_ERROR
+ } rt_status_t;
+
+
+ enum rt_sched_policy {
+ RT_SCHED_RR = 0, // round robin
+ RT_SCHED_FIFO = 1, // first in first out
+ };
+
+ /*
+ * Define the range for our virtual priorities (don't change these)
+ *
+ * Processes (or threads) with numerically higher priority values
+ * are scheduled before processes with numerically lower priority
+ * values. Thus, the value returned by rt_priority_max() will be
+ * greater than the value returned by rt_priority_min().
+ */
+ static inline int rt_priority_min() { return 0; }
+ static inline int rt_priority_max() { return 15; }
+ static inline int rt_priority_default() { return 1; }
+
+ struct GRUEL_API rt_sched_param {
+ int priority;
+ rt_sched_policy policy;
+
+ rt_sched_param()
+ : priority(rt_priority_default()), policy(RT_SCHED_RR){}
+
+ rt_sched_param(int priority_, rt_sched_policy policy_ = RT_SCHED_RR)
+ {
+ if (priority_ < rt_priority_min() || priority_ > rt_priority_max())
+ throw std::invalid_argument("rt_sched_param: priority out of range");
+
+ priority = priority_;
+ policy = policy_;
+ }
+ };
+
+ /*!
+ * \brief If possible, enable "realtime" scheduling.
+ * \ingroup misc
+ *
+ * In general, this means that the code will be scheduled before any
+ * non-realtime (normal) processes. Note that if your code contains
+ * an non-blocking infinite loop and you enable realtime scheduling,
+ * it's possible to hang the system.
+ */
+
+ // NOTE: If you change this, you need to change the code in
+ // gnuradio-core/src/lib/runtime/gr_realtime.i, see note there.
+ rt_status_t
+ GRUEL_API enable_realtime_scheduling(rt_sched_param = rt_sched_param());
+
+} // namespace gruel
+
+#endif /* INCLUDED_GRUEL_REALTIME_H */
diff --git a/gruel/src/include/gruel/sys_pri.h b/gruel/src/include/gruel/sys_pri.h
new file mode 100644
index 000000000..c0751e52c
--- /dev/null
+++ b/gruel/src/include/gruel/sys_pri.h
@@ -0,0 +1,42 @@
+/* -*- 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 this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef INCLUDED_GRUEL_SYS_PRI_H
+#define INCLUDED_GRUEL_SYS_PRI_H
+
+#include <gruel/api.h>
+#include <gruel/realtime.h>
+
+/*
+ * A single place to define real-time priorities used by the system itself
+ */
+namespace gruel {
+
+ struct GRUEL_API sys_pri {
+ static rt_sched_param python(); // python code
+ static rt_sched_param normal(); // normal blocks
+ static rt_sched_param gcell_event_handler();
+ static rt_sched_param usrp2_backend(); // thread that services the ethernet
+ };
+
+}
+
+#endif /* INCLUDED_GRUEL_SYS_PRI_H */
diff --git a/gruel/src/include/gruel/thread.h b/gruel/src/include/gruel/thread.h
new file mode 100644
index 000000000..10c6c38cc
--- /dev/null
+++ b/gruel/src/include/gruel/thread.h
@@ -0,0 +1,139 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2009-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 this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+#ifndef INCLUDED_THREAD_H
+#define INCLUDED_THREAD_H
+
+#include <gruel/api.h>
+#include <boost/thread/thread.hpp>
+#include <boost/thread/mutex.hpp>
+#include <boost/thread/locks.hpp>
+#include <boost/thread/condition_variable.hpp>
+#include <vector>
+
+#if defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
+
+#ifndef WIN32_LEAN_AND_MEAN
+#define WIN32_LEAN_AND_MEAN
+#endif
+
+#include <windows.h>
+
+#endif
+
+namespace gruel {
+
+ typedef boost::thread thread;
+ typedef boost::mutex mutex;
+ typedef boost::unique_lock<boost::mutex> scoped_lock;
+ typedef boost::condition_variable condition_variable;
+
+ /*! \brief a system-dependent typedef for the underlying thread type.
+ */
+#if defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
+ typedef HANDLE gr_thread_t;
+#elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)
+ typedef pthread_t gr_thread_t;
+#else
+ typedef pthread_t gr_thread_t;
+#endif
+
+ /*! \brief Get the current thread's ID as a gr_thread_t
+ *
+ * We use this when setting the thread affinity or any other
+ * low-level thread settings. Can be called withing a GNU Radio
+ * block to get a reference to its current thread ID.
+ */
+ GRUEL_API gr_thread_t get_current_thread_id();
+
+ /*! \brief Bind the current thread to a set of cores.
+ *
+ * Wrapper for system-dependent calls to set the affinity of the
+ * current thread to the processor mask. The mask is simply a
+ * 1-demensional vector containing the processor or core number from
+ * 0 to N-1 for N cores.
+ *
+ * Note: this does not work on OSX; it is a nop call since OSX does
+ * not support the concept of thread affinity (and what they do
+ * support in this way since 10.5 is not what we want or can use in
+ * this fashion).
+ */
+ GRUEL_API void thread_bind_to_processor(const std::vector<int> &mask);
+
+ /*! \brief Convineince function to bind the current thread to a single core.
+ *
+ * Wrapper for system-dependent calls to set the affinity of the
+ * current thread to a given core from 0 to N-1 for N cores.
+ *
+ * Note: this does not work on OSX; it is a nop call since OSX does
+ * not support the concept of thread affinity (and what they do
+ * support in this way since 10.5 is not what we want or can use in
+ * this fashion).
+ */
+ GRUEL_API void thread_bind_to_processor(int n);
+
+ /*! \brief Bind a thread to a set of cores.
+ *
+ * Wrapper for system-dependent calls to set the affinity of the
+ * given thread ID to the processor mask. The mask is simply a
+ * 1-demensional vector containing the processor or core number from
+ * 0 to N-1 for N cores.
+ *
+ * Note: this does not work on OSX; it is a nop call since OSX does
+ * not support the concept of thread affinity (and what they do
+ * support in this way since 10.5 is not what we want or can use in
+ * this fashion).
+ */
+ GRUEL_API void thread_bind_to_processor(gr_thread_t thread, const std::vector<int> &mask);
+
+
+ /*! \brief Convineince function to bind the a thread to a single core.
+ *
+ * Wrapper for system-dependent calls to set the affinity of the
+ * given thread ID to a given core from 0 to N-1 for N cores.
+ *
+ * Note: this does not work on OSX; it is a nop call since OSX does
+ * not support the concept of thread affinity (and what they do
+ * support in this way since 10.5 is not what we want or can use in
+ * this fashion).
+ */
+ GRUEL_API void thread_bind_to_processor(gr_thread_t thread, unsigned int n);
+
+ /*! \brief Remove any thread-processor affinity for the current thread.
+ *
+ * Note: this does not work on OSX; it is a nop call since OSX does
+ * not support the concept of thread affinity (and what they do
+ * support in this way since 10.5 is not what we want or can use in
+ * this fashion).
+ */
+ GRUEL_API void thread_unbind();
+
+ /*! \brief Remove any thread-processor affinity for a given thread ID.
+ *
+ * Note: this does not work on OSX; it is a nop call since OSX does
+ * not support the concept of thread affinity (and what they do
+ * support in this way since 10.5 is not what we want or can use in
+ * this fashion).
+ */
+ GRUEL_API void thread_unbind(gr_thread_t thread);
+
+} /* namespace gruel */
+
+#endif /* INCLUDED_THREAD_H */
diff --git a/gruel/src/include/gruel/thread_body_wrapper.h b/gruel/src/include/gruel/thread_body_wrapper.h
new file mode 100644
index 000000000..e09a43e68
--- /dev/null
+++ b/gruel/src/include/gruel/thread_body_wrapper.h
@@ -0,0 +1,69 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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 this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+#ifndef INCLUDED_THREAD_BODY_WRAPPER_H
+#define INCLUDED_THREAD_BODY_WRAPPER_H
+
+#include <gruel/api.h>
+#include <gruel/thread.h>
+#include <exception>
+#include <iostream>
+
+namespace gruel
+{
+
+ GRUEL_API void mask_signals();
+
+ template <class F>
+ class thread_body_wrapper
+ {
+ F d_f;
+ std::string d_name;
+
+ public:
+
+ explicit thread_body_wrapper(F f, const std::string &name="")
+ : d_f(f), d_name(name) {}
+
+ void operator()()
+ {
+ mask_signals();
+
+ try {
+ d_f();
+ }
+ catch(boost::thread_interrupted const &)
+ {
+ }
+ catch(std::exception const &e)
+ {
+ std::cerr << "thread[" << d_name << "]: "
+ << e.what() << std::endl;
+ }
+ catch(...)
+ {
+ std::cerr << "thread[" << d_name << "]: "
+ << "caught unrecognized exception\n";
+ }
+ }
+ };
+}
+
+#endif /* INCLUDED_THREAD_BODY_WRAPPER_H */
diff --git a/gruel/src/include/gruel/thread_group.h b/gruel/src/include/gruel/thread_group.h
new file mode 100644
index 000000000..1b8a0a4bf
--- /dev/null
+++ b/gruel/src/include/gruel/thread_group.h
@@ -0,0 +1,45 @@
+/* -*- c++ -*- */
+/*
+ * Copyright (C) 2001-2003 William E. Kempf
+ * Copyright (C) 2007 Anthony Williams
+ * Copyright 2008,2009 Free Software Foundation, Inc.
+ *
+ * Distributed under the Boost Software License, Version 1.0. (See accompanying
+ * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ */
+
+/*
+ * This was extracted from Boost 1.35.0 and fixed.
+ */
+
+#ifndef INCLUDED_GRUEL_THREAD_GROUP_H
+#define INCLUDED_GRUEL_THREAD_GROUP_H
+
+#include <gruel/api.h>
+#include <gruel/thread.h>
+#include <boost/utility.hpp>
+#include <boost/thread/shared_mutex.hpp>
+#include <boost/function.hpp>
+
+namespace gruel
+{
+ class GRUEL_API thread_group : public boost::noncopyable
+ {
+ public:
+ thread_group();
+ ~thread_group();
+
+ boost::thread* create_thread(const boost::function0<void>& threadfunc);
+ void add_thread(boost::thread* thrd);
+ void remove_thread(boost::thread* thrd);
+ void join_all();
+ void interrupt_all();
+ size_t size() const;
+
+ private:
+ std::list<boost::thread*> m_threads;
+ mutable boost::shared_mutex m_mutex;
+ };
+}
+
+#endif /* INCLUDED_GRUEL_THREAD_GROUP_H */
diff --git a/gruel/src/lib/CMakeLists.txt b/gruel/src/lib/CMakeLists.txt
new file mode 100644
index 000000000..717d56660
--- /dev/null
+++ b/gruel/src/lib/CMakeLists.txt
@@ -0,0 +1,110 @@
+# 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.
+
+########################################################################
+# Include subdirs rather to populate to the sources lists.
+########################################################################
+include(GrMiscUtils)
+include(CheckCXXSourceCompiles)
+
+GR_CHECK_HDR_N_DEF(signal.h HAVE_SIGNAL_H)
+GR_CHECK_HDR_N_DEF(sched.h HAVE_SCHED_H)
+
+set(CMAKE_REQUIRED_LIBRARIES -lpthread)
+CHECK_CXX_SOURCE_COMPILES("
+ #include <signal.h>
+ int main(){pthread_sigmask(0, 0, 0); return 0;}
+ " HAVE_PTHREAD_SIGMASK
+)
+GR_ADD_COND_DEF(HAVE_PTHREAD_SIGMASK)
+
+set(CMAKE_REQUIRED_LIBRARIES -lpthread)
+CHECK_CXX_SOURCE_COMPILES("
+ #include <pthread.h>
+ int main(){
+ pthread_t pthread;
+ pthread_setschedparam(pthread, 0, 0);
+ return 0;
+ } " HAVE_PTHREAD_SETSCHEDPARAM
+)
+GR_ADD_COND_DEF(HAVE_PTHREAD_SETSCHEDPARAM)
+
+CHECK_CXX_SOURCE_COMPILES("
+ #include <sched.h>
+ int main(){
+ pid_t pid;
+ sched_setscheduler(pid, 0, 0);
+ return 0;
+ } " HAVE_SCHED_SETSCHEDULER
+)
+GR_ADD_COND_DEF(HAVE_SCHED_SETSCHEDULER)
+
+########################################################################
+# Include subdirs rather to populate to the sources lists.
+########################################################################
+GR_INCLUDE_SUBDIRECTORY(msg)
+GR_INCLUDE_SUBDIRECTORY(pmt)
+
+########################################################################
+# Setup the include and linker paths
+########################################################################
+include_directories(${CMAKE_CURRENT_SOURCE_DIR})
+include_directories(${GRUEL_INCLUDE_DIRS})
+
+include_directories(${Boost_INCLUDE_DIRS})
+link_directories(${Boost_LIBRARY_DIRS})
+
+########################################################################
+# Setup library
+########################################################################
+list(APPEND gruel_sources
+ realtime.cc
+ sys_pri.cc
+ thread.cc
+ thread_body_wrapper.cc
+ thread_group.cc
+)
+
+list(APPEND gruel_libs ${Boost_LIBRARIES})
+
+if(HAVE_PTHREAD_SETSCHEDPARAM)
+ list(APPEND gruel_libs pthread)
+endif()
+
+add_library(gruel SHARED ${gruel_sources})
+target_link_libraries(gruel ${gruel_libs})
+GR_LIBRARY_FOO(gruel RUNTIME_COMPONENT "gruel_runtime" DEVEL_COMPONENT "gruel_devel")
+
+########################################################################
+# Setup tests
+# Set the test environment so the build libs will be found under MSVC.
+########################################################################
+if(ENABLE_TESTING)
+
+include_directories(${CPPUNIT_INCLUDE_DIRS})
+link_directories(${CPPUNIT_LIBRARY_DIRS})
+
+include(GrTest)
+set(GR_TEST_TARGET_DEPS gruel)
+list(APPEND test_gruel_sources test_gruel.cc)
+add_executable(test_gruel ${test_gruel_sources})
+target_link_libraries(test_gruel gruel ${CPPUNIT_LIBRARIES})
+GR_ADD_TEST(gruel-test test_gruel)
+
+endif(ENABLE_TESTING)
diff --git a/gruel/src/lib/msg/CMakeLists.txt b/gruel/src/lib/msg/CMakeLists.txt
new file mode 100644
index 000000000..74010af7e
--- /dev/null
+++ b/gruel/src/lib/msg/CMakeLists.txt
@@ -0,0 +1,28 @@
+# Copyright 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.
+
+########################################################################
+# This file included, use CMake directory variables
+########################################################################
+
+list(APPEND gruel_sources
+ ${CMAKE_CURRENT_SOURCE_DIR}/msg_accepter.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/msg_accepter_msgq.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/msg_queue.cc
+)
diff --git a/gruel/src/lib/msg/msg_accepter.cc b/gruel/src/lib/msg/msg_accepter.cc
new file mode 100644
index 000000000..5acd98aa2
--- /dev/null
+++ b/gruel/src/lib/msg/msg_accepter.cc
@@ -0,0 +1,36 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gruel/msg_accepter.h>
+
+namespace gruel {
+
+ msg_accepter::~msg_accepter()
+ {
+ // NOP, required as virtual destructor
+ }
+
+} /* namespace gruel */
diff --git a/gruel/src/lib/msg/msg_accepter_msgq.cc b/gruel/src/lib/msg/msg_accepter_msgq.cc
new file mode 100644
index 000000000..2ae3537b8
--- /dev/null
+++ b/gruel/src/lib/msg/msg_accepter_msgq.cc
@@ -0,0 +1,48 @@
+/* -*- 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 this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <gruel/msg_accepter_msgq.h>
+
+using namespace pmt;
+
+namespace gruel {
+
+ msg_accepter_msgq::msg_accepter_msgq(msg_queue_sptr msgq)
+ : d_msg_queue(msgq)
+ {
+ }
+
+ msg_accepter_msgq::~msg_accepter_msgq()
+ {
+ // NOP, required as virtual destructor
+ }
+
+ void
+ msg_accepter_msgq::post(pmt_t msg)
+ {
+ d_msg_queue->insert_tail(msg);
+ }
+
+} /* namespace gruel */
diff --git a/gruel/src/lib/msg/msg_queue.cc b/gruel/src/lib/msg/msg_queue.cc
new file mode 100644
index 000000000..a0b120e40
--- /dev/null
+++ b/gruel/src/lib/msg/msg_queue.cc
@@ -0,0 +1,103 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gruel/msg_queue.h>
+#include <stdexcept>
+
+using namespace pmt;
+
+namespace gruel {
+
+ msg_queue_sptr
+ make_msg_queue(unsigned int limit)
+ {
+ return msg_queue_sptr(new msg_queue(limit));
+ }
+
+ msg_queue::msg_queue(unsigned int limit)
+ : d_limit(limit)
+ {
+ }
+
+ msg_queue::~msg_queue()
+ {
+ flush();
+ }
+
+ void
+ msg_queue::insert_tail(pmt_t msg)
+ {
+ gruel::scoped_lock guard(d_mutex);
+
+ while (full_p())
+ d_not_full.wait(guard);
+
+ d_msgs.push_back(msg);
+ d_not_empty.notify_one();
+ }
+
+ pmt_t
+ msg_queue::delete_head()
+ {
+ gruel::scoped_lock guard(d_mutex);
+
+ while (empty_p())
+ d_not_empty.wait(guard);
+
+ pmt_t m(d_msgs.front());
+ d_msgs.pop_front();
+
+ if (d_limit > 0) // Unlimited length queues never block on write
+ d_not_full.notify_one();
+
+ return m;
+ }
+
+ pmt_t
+ msg_queue::delete_head_nowait()
+ {
+ gruel::scoped_lock guard(d_mutex);
+
+ if (empty_p())
+ return pmt_t();
+
+ pmt_t m(d_msgs.front());
+ d_msgs.pop_front();
+
+ if (d_limit > 0) // Unlimited length queues never block on write
+ d_not_full.notify_one();
+
+ return m;
+ }
+
+ void
+ msg_queue::flush()
+ {
+ while (delete_head_nowait() != pmt_t())
+ ;
+ }
+
+} /* namespace gruel */
diff --git a/gruel/src/lib/pmt/CMakeLists.txt b/gruel/src/lib/pmt/CMakeLists.txt
new file mode 100644
index 000000000..6ea616e10
--- /dev/null
+++ b/gruel/src/lib/pmt/CMakeLists.txt
@@ -0,0 +1,89 @@
+# Copyright 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.
+
+########################################################################
+# This file included, use CMake directory variables
+########################################################################
+include_directories(${CMAKE_CURRENT_SOURCE_DIR})
+include_directories(${CMAKE_CURRENT_BINARY_DIR})
+
+########################################################################
+# Generate serial tags header file
+########################################################################
+
+get_filename_component(PMT_SERIAL_TAGS_H
+ ${CMAKE_CURRENT_BINARY_DIR}/../../include/gruel/pmt_serial_tags.h ABSOLUTE
+)
+
+add_custom_command(
+ OUTPUT ${PMT_SERIAL_TAGS_H}
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/gen-serial-tags.py
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/pmt-serial-tags.scm
+ COMMAND ${PYTHON_EXECUTABLE}
+ ${CMAKE_CURRENT_SOURCE_DIR}/gen-serial-tags.py
+ ${CMAKE_CURRENT_SOURCE_DIR}/pmt-serial-tags.scm
+ ${PMT_SERIAL_TAGS_H}
+)
+
+install(
+ FILES ${PMT_SERIAL_TAGS_H}
+ DESTINATION ${GR_INCLUDE_DIR}/gruel
+ COMPONENT "gruel_devel"
+)
+
+include(AddFileDependencies)
+ADD_FILE_DEPENDENCIES(
+ ${CMAKE_CURRENT_SOURCE_DIR}/pmt_serialize.cc
+ ${PMT_SERIAL_TAGS_H}
+)
+
+add_custom_target(pmt_generated DEPENDS ${PMT_SERIAL_TAGS_H})
+
+########################################################################
+# Generate other pmt stuff
+########################################################################
+add_custom_command(
+ OUTPUT
+ ${CMAKE_CURRENT_BINARY_DIR}/pmt_unv_int.h
+ ${CMAKE_CURRENT_BINARY_DIR}/qa_pmt_unv.h
+ ${CMAKE_CURRENT_BINARY_DIR}/pmt_unv.cc
+ ${CMAKE_CURRENT_BINARY_DIR}/qa_pmt_unv.cc
+ DEPENDS
+ ${CMAKE_CURRENT_SOURCE_DIR}/generate_unv.py
+ ${CMAKE_CURRENT_SOURCE_DIR}/unv_template.h.t
+ ${CMAKE_CURRENT_SOURCE_DIR}/unv_template.cc.t
+ ${CMAKE_CURRENT_SOURCE_DIR}/unv_qa_template.cc.t
+ COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} -c
+ \"import os,sys\;srcdir='${CMAKE_CURRENT_SOURCE_DIR}'\;sys.path.append(srcdir)\;os.environ['srcdir']=srcdir\;from generate_unv import main\;main()\"
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+)
+
+list(APPEND gruel_sources
+ ${CMAKE_CURRENT_BINARY_DIR}/pmt_unv.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/pmt.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/pmt_io.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/pmt_pool.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/pmt_serialize.cc
+)
+
+list(APPEND test_gruel_sources
+ ${CMAKE_CURRENT_BINARY_DIR}/qa_pmt_unv.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/qa_pmt_prims.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/qa_pmt.cc
+)
diff --git a/gruel/src/lib/pmt/gen-serial-tags.py b/gruel/src/lib/pmt/gen-serial-tags.py
new file mode 100644
index 000000000..18e927beb
--- /dev/null
+++ b/gruel/src/lib/pmt/gen-serial-tags.py
@@ -0,0 +1,53 @@
+"""
+//
+// Copyright 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 this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+//
+// THIS FILE IS MACHINE GENERATED FROM %s. DO NOT EDIT BY HAND.
+// See %s for additional commentary.
+//
+
+#ifndef INCLUDED_PMT_SERIAL_TAGS_H
+#define INCLUDED_PMT_SERIAL_TAGS_H
+
+enum pst_tags {
+%s
+};
+#endif /* INCLUDED_PMT_SERIAL_TAGS_H */
+"""
+
+import sys, os, re
+
+if __name__ == '__main__':
+ if len(sys.argv) != 3:
+ print "Usage %s <input_scm_file> <output_hdr_file>"%__file__
+ exit()
+ input_scm_file, output_hdr_file = sys.argv[1:]
+ enums = list()
+ for line in open(input_scm_file).readlines():
+ match = re.match('^\s*\(define\s+([\w|-]+)\s+#x([0-9a-fA-F]+)\)', line)
+ if not match: continue
+ name, value = match.groups()
+ name = name.upper().replace('-', '_')
+ enums.append(' %s = 0x%s'%(name, value))
+ open(output_hdr_file, 'w').write(__doc__%(
+ os.path.basename(__file__),
+ os.path.basename(input_scm_file),
+ ',\n'.join(enums),
+ ))
diff --git a/gruel/src/lib/pmt/generate_unv.py b/gruel/src/lib/pmt/generate_unv.py
new file mode 100755
index 000000000..42b57e245
--- /dev/null
+++ b/gruel/src/lib/pmt/generate_unv.py
@@ -0,0 +1,190 @@
+#!/usr/bin/env python
+#
+# Copyright 2006,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.
+#
+
+"""
+Generate code for uniform numeric vectors
+"""
+
+import re, os, os.path
+
+
+unv_types = (
+ ('u8', 'uint8_t'),
+ ('s8', 'int8_t'),
+ ('u16', 'uint16_t'),
+ ('s16', 'int16_t'),
+ ('u32', 'uint32_t'),
+ ('s32', 'int32_t'),
+ ('u64', 'uint64_t'),
+ ('s64', 'int64_t'),
+ ('f32', 'float'),
+ ('f64', 'double'),
+ ('c32', 'std::complex<float>'),
+ ('c64', 'std::complex<double>')
+ )
+
+header = """\
+/* -*- c++ -*- */
+/*
+ * Copyright 2006,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.
+ */
+"""
+
+guard_tail = """
+#endif
+"""
+
+includes = """
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <vector>
+#include <gruel/pmt.h>
+#include "pmt_int.h"
+"""
+
+qa_includes = """
+#include <qa_pmt_unv.h>
+#include <cppunit/TestAssert.h>
+#include <gruel/pmt.h>
+#include <stdio.h>
+
+using namespace pmt;
+"""
+
+
+# set srcdir to the directory that contains Makefile.am
+try:
+ srcdir = os.environ['srcdir']
+except KeyError, e:
+ srcdir = "."
+srcdir = srcdir + '/'
+
+
+def open_src (name, mode):
+ global srcdir
+ return open(os.path.join (srcdir, name), mode)
+
+
+def guard_name(filename):
+ return 'INCLUDED_' + re.sub('\.', '_', filename.upper())
+
+def guard_head(filename):
+ guard = guard_name(filename)
+ return """
+#ifndef %s
+#define %s
+""" % (guard, guard)
+
+
+def do_substitution (d, input, out_file):
+ def repl (match_obj):
+ key = match_obj.group (1)
+ # print key
+ return d[key]
+
+ out = re.sub (r"@([a-zA-Z0-9_]+)@", repl, input)
+ out_file.write (out)
+
+
+def generate_h():
+ template = open_src('unv_template.h.t', 'r').read()
+ output_filename = 'pmt_unv_int.h'
+ output = open(output_filename, 'w')
+ output.write(header)
+ output.write(guard_head(output_filename))
+ for tag, typ in unv_types:
+ d = { 'TAG' : tag, 'TYPE' : typ }
+ do_substitution(d, template, output)
+ output.write(guard_tail)
+
+def generate_cc():
+ template = open_src('unv_template.cc.t', 'r').read()
+ output = open('pmt_unv.cc', 'w')
+ output.write(header)
+ output.write(includes)
+ for tag, typ in unv_types:
+ d = { 'TAG' : tag, 'TYPE' : typ }
+ do_substitution(d, template, output)
+
+
+def generate_qa_h():
+ output_filename = 'qa_pmt_unv.h'
+ output = open(output_filename, 'w')
+ output.write(header)
+ output.write(guard_head(output_filename))
+
+ output.write('''
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/TestCase.h>
+
+class qa_pmt_unv : public CppUnit::TestCase {
+
+ CPPUNIT_TEST_SUITE(qa_pmt_unv);
+''')
+ for tag, typ in unv_types:
+ output.write(' CPPUNIT_TEST(test_%svector);\n' % (tag,))
+ output.write('''\
+ CPPUNIT_TEST_SUITE_END();
+
+ private:
+''')
+ for tag, typ in unv_types:
+ output.write(' void test_%svector();\n' % (tag,))
+ output.write('};\n')
+ output.write(guard_tail)
+
+def generate_qa_cc():
+ template = open_src('unv_qa_template.cc.t', 'r').read()
+ output = open('qa_pmt_unv.cc', 'w')
+ output.write(header)
+ output.write(qa_includes)
+ for tag, typ in unv_types:
+ d = { 'TAG' : tag, 'TYPE' : typ }
+ do_substitution(d, template, output)
+
+
+def main():
+ generate_h()
+ generate_cc()
+ generate_qa_h()
+ generate_qa_cc()
+
+if __name__ == '__main__':
+ main()
diff --git a/gruel/src/lib/pmt/pmt-serial-tags.scm b/gruel/src/lib/pmt/pmt-serial-tags.scm
new file mode 100644
index 000000000..4f06bf75f
--- /dev/null
+++ b/gruel/src/lib/pmt/pmt-serial-tags.scm
@@ -0,0 +1,77 @@
+;;; -*-scheme-*-
+;;;
+;;; 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 (define 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 this program; if not, write to the Free Software Foundation, Inc.,
+;;; 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+;;;
+
+;;; definitions of tag values used for marshalling pmt data
+
+(define pst-true #x00)
+(define pst-false #x01)
+(define pst-symbol #x02) ; untagged-int16 n; followed by n bytes of symbol name
+(define pst-int32 #x03)
+(define pst-double #x04)
+(define pst-complex #x05) ; complex<double>: real, imag
+(define pst-null #x06)
+(define pst-pair #x07) ; followed by two objects
+(define pst-vector #x08) ; untagged-int32 n; followed by n objects
+(define pst-dict #x09) ; untagged-int32 n; followed by n key/value tuples
+
+(define pst-uniform-vector #x0a)
+(define pst-uint64 #x0b)
+(define pst-tuple #x0c)
+
+;; u8, s8, u16, s16, u32, s32, u64, s64, f32, f64, c32, c64
+;;
+;; untagged-uint8 tag
+;; untagged-uint8 uvi (define uniform vector info, see below)
+;; untagged-int32 n-items
+;; untagged-uint8 npad
+;; npad bytes of zeros to align binary data
+;; n-items binary numeric items
+;;
+;; uvi:
+;; +-+-+-+-+-+-+-+-+
+;; |B| subtype |
+;; +-+-+-+-+-+-+-+-+
+;;
+;; B == 0, numeric data is little-endian.
+;; B == 1, numeric data is big-endian.
+
+ (define uvi-endian-mask #x80)
+ (define uvi-subtype-mask #x7f)
+
+ (define uvi-little-endian #x00)
+ (define uvi-big-endian #x80)
+
+ (define uvi-u8 #x00)
+ (define uvi-s8 #x01)
+ (define uvi-u16 #x02)
+ (define uvi-s16 #x03)
+ (define uvi-u32 #x04)
+ (define uvi-s32 #x05)
+ (define uvi-u64 #x06)
+ (define uvi-s64 #x07)
+ (define uvi-f32 #x08)
+ (define uvi-f64 #x09)
+ (define uvi-c32 #x0a)
+ (define uvi-c64 #x0b)
+
+
+(define pst-comment #x3b) ; ascii ';'
+(define pst-comment-end #x0a) ; ascii '\n'
diff --git a/gruel/src/lib/pmt/pmt.cc b/gruel/src/lib/pmt/pmt.cc
new file mode 100644
index 000000000..1d1e9ba7c
--- /dev/null
+++ b/gruel/src/lib/pmt/pmt.cc
@@ -0,0 +1,1428 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <vector>
+#include <gruel/pmt.h>
+#include "pmt_int.h"
+#include <gruel/msg_accepter.h>
+#include <gruel/pmt_pool.h>
+#include <stdio.h>
+#include <string.h>
+
+namespace pmt {
+
+static const int CACHE_LINE_SIZE = 64; // good guess
+
+# if (PMT_LOCAL_ALLOCATOR)
+
+static pmt_pool global_pmt_pool(sizeof(pmt_pair), CACHE_LINE_SIZE);
+
+void *
+pmt_base::operator new(size_t size)
+{
+ void *p = global_pmt_pool.malloc();
+
+ // fprintf(stderr, "pmt_base::new p = %p\n", p);
+ assert((reinterpret_cast<intptr_t>(p) & (CACHE_LINE_SIZE - 1)) == 0);
+ return p;
+}
+
+void
+pmt_base::operator delete(void *p, size_t size)
+{
+ global_pmt_pool.free(p);
+}
+
+#endif
+
+void intrusive_ptr_add_ref(pmt_base* p) { ++(p->count_); }
+void intrusive_ptr_release(pmt_base* p) { if (--(p->count_) == 0 ) delete p; }
+
+pmt_base::~pmt_base()
+{
+ // nop -- out of line virtual destructor
+}
+
+////////////////////////////////////////////////////////////////////////////
+// Exceptions
+////////////////////////////////////////////////////////////////////////////
+
+pmt_exception::pmt_exception(const std::string &msg, pmt_t obj)
+ : logic_error(msg + ": " + pmt_write_string(obj))
+{
+}
+
+pmt_wrong_type::pmt_wrong_type(const std::string &msg, pmt_t obj)
+ : pmt_exception(msg + ": wrong_type ", obj)
+{
+}
+
+pmt_out_of_range::pmt_out_of_range(const std::string &msg, pmt_t obj)
+ : pmt_exception(msg + ": out of range ", obj)
+{
+}
+
+pmt_notimplemented::pmt_notimplemented(const std::string &msg, pmt_t obj)
+ : pmt_exception(msg + ": notimplemented ", obj)
+{
+}
+
+////////////////////////////////////////////////////////////////////////////
+// Dynamic Casts
+////////////////////////////////////////////////////////////////////////////
+
+static pmt_symbol *
+_symbol(pmt_t x)
+{
+ return dynamic_cast<pmt_symbol*>(x.get());
+}
+
+static pmt_integer *
+_integer(pmt_t x)
+{
+ return dynamic_cast<pmt_integer*>(x.get());
+}
+
+static pmt_uint64 *
+_uint64(pmt_t x)
+{
+ return dynamic_cast<pmt_uint64*>(x.get());
+}
+
+static pmt_real *
+_real(pmt_t x)
+{
+ return dynamic_cast<pmt_real*>(x.get());
+}
+
+static pmt_complex *
+_complex(pmt_t x)
+{
+ return dynamic_cast<pmt_complex*>(x.get());
+}
+
+static pmt_pair *
+_pair(pmt_t x)
+{
+ return dynamic_cast<pmt_pair*>(x.get());
+}
+
+static pmt_vector *
+_vector(pmt_t x)
+{
+ return dynamic_cast<pmt_vector*>(x.get());
+}
+
+static pmt_tuple *
+_tuple(pmt_t x)
+{
+ return dynamic_cast<pmt_tuple*>(x.get());
+}
+
+static pmt_uniform_vector *
+_uniform_vector(pmt_t x)
+{
+ return dynamic_cast<pmt_uniform_vector*>(x.get());
+}
+
+static pmt_any *
+_any(pmt_t x)
+{
+ return dynamic_cast<pmt_any*>(x.get());
+}
+
+////////////////////////////////////////////////////////////////////////////
+// Globals
+////////////////////////////////////////////////////////////////////////////
+
+const pmt_t PMT_T = pmt_t(new pmt_bool()); // singleton
+const pmt_t PMT_F = pmt_t(new pmt_bool()); // singleton
+const pmt_t PMT_NIL = pmt_t(new pmt_null()); // singleton
+const pmt_t PMT_EOF = pmt_cons(PMT_NIL, PMT_NIL); // singleton
+
+////////////////////////////////////////////////////////////////////////////
+// Booleans
+////////////////////////////////////////////////////////////////////////////
+
+pmt_bool::pmt_bool(){}
+
+bool
+pmt_is_true(pmt_t obj)
+{
+ return obj != PMT_F;
+}
+
+bool
+pmt_is_false(pmt_t obj)
+{
+ return obj == PMT_F;
+}
+
+bool
+pmt_is_bool(pmt_t obj)
+{
+ return obj->is_bool();
+}
+
+pmt_t
+pmt_from_bool(bool val)
+{
+ return val ? PMT_T : PMT_F;
+}
+
+bool
+pmt_to_bool(pmt_t val)
+{
+ if (val == PMT_T)
+ return true;
+ if (val == PMT_F)
+ return false;
+ throw pmt_wrong_type("pmt_to_bool", val);
+}
+
+////////////////////////////////////////////////////////////////////////////
+// Symbols
+////////////////////////////////////////////////////////////////////////////
+
+static const unsigned int SYMBOL_HASH_TABLE_SIZE = 701;
+static std::vector<pmt_t> s_symbol_hash_table(SYMBOL_HASH_TABLE_SIZE);
+
+pmt_symbol::pmt_symbol(const std::string &name) : d_name(name){}
+
+
+static unsigned int
+hash_string(const std::string &s)
+{
+ unsigned int h = 0;
+ unsigned int g = 0;
+
+ for (std::string::const_iterator p = s.begin(); p != s.end(); ++p){
+ h = (h << 4) + (*p & 0xff);
+ g = h & 0xf0000000;
+ if (g){
+ h = h ^ (g >> 24);
+ h = h ^ g;
+ }
+ }
+ return h;
+}
+
+bool
+pmt_is_symbol(const pmt_t& obj)
+{
+ return obj->is_symbol();
+}
+
+pmt_t
+pmt_string_to_symbol(const std::string &name)
+{
+ unsigned hash = hash_string(name) % SYMBOL_HASH_TABLE_SIZE;
+
+ // Does a symbol with this name already exist?
+ for (pmt_t sym = s_symbol_hash_table[hash]; sym; sym = _symbol(sym)->next()){
+ if (name == _symbol(sym)->name())
+ return sym; // Yes. Return it
+ }
+
+ // Nope. Make a new one.
+ pmt_t sym = pmt_t(new pmt_symbol(name));
+ _symbol(sym)->set_next(s_symbol_hash_table[hash]);
+ s_symbol_hash_table[hash] = sym;
+ return sym;
+}
+
+// alias...
+pmt_t
+pmt_intern(const std::string &name)
+{
+ return pmt_string_to_symbol(name);
+}
+
+const std::string
+pmt_symbol_to_string(const pmt_t& sym)
+{
+ if (!sym->is_symbol())
+ throw pmt_wrong_type("pmt_symbol_to_string", sym);
+
+ return _symbol(sym)->name();
+}
+
+
+
+////////////////////////////////////////////////////////////////////////////
+// Number
+////////////////////////////////////////////////////////////////////////////
+
+bool
+pmt_is_number(pmt_t x)
+{
+ return x->is_number();
+}
+
+////////////////////////////////////////////////////////////////////////////
+// Integer
+////////////////////////////////////////////////////////////////////////////
+
+pmt_integer::pmt_integer(long value) : d_value(value) {}
+
+bool
+pmt_is_integer(pmt_t x)
+{
+ return x->is_integer();
+}
+
+
+pmt_t
+pmt_from_long(long x)
+{
+ return pmt_t(new pmt_integer(x));
+}
+
+long
+pmt_to_long(pmt_t x)
+{
+ pmt_integer* i = dynamic_cast<pmt_integer*>(x.get());
+ if ( i )
+ return i->value();
+
+ throw pmt_wrong_type("pmt_to_long", x);
+}
+
+////////////////////////////////////////////////////////////////////////////
+// Uint64
+////////////////////////////////////////////////////////////////////////////
+
+pmt_uint64::pmt_uint64(uint64_t value) : d_value(value) {}
+
+bool
+pmt_is_uint64(pmt_t x)
+{
+ return x->is_uint64();
+}
+
+
+pmt_t
+pmt_from_uint64(uint64_t x)
+{
+ return pmt_t(new pmt_uint64(x));
+}
+
+uint64_t
+pmt_to_uint64(pmt_t x)
+{
+ if(x->is_uint64())
+ return _uint64(x)->value();
+ if(x->is_integer())
+ {
+ long tmp = _integer(x)->value();
+ if(tmp >= 0)
+ return (uint64_t) tmp;
+ }
+
+ throw pmt_wrong_type("pmt_to_uint64", x);
+}
+
+////////////////////////////////////////////////////////////////////////////
+// Real
+////////////////////////////////////////////////////////////////////////////
+
+pmt_real::pmt_real(double value) : d_value(value) {}
+
+bool
+pmt_is_real(pmt_t x)
+{
+ return x->is_real();
+}
+
+pmt_t
+pmt_from_double(double x)
+{
+ return pmt_t(new pmt_real(x));
+}
+
+double
+pmt_to_double(pmt_t x)
+{
+ if (x->is_real())
+ return _real(x)->value();
+ if (x->is_integer())
+ return _integer(x)->value();
+
+ throw pmt_wrong_type("pmt_to_double", x);
+}
+
+////////////////////////////////////////////////////////////////////////////
+// Complex
+////////////////////////////////////////////////////////////////////////////
+
+pmt_complex::pmt_complex(std::complex<double> value) : d_value(value) {}
+
+bool
+pmt_is_complex(pmt_t x)
+{
+ return x->is_complex();
+}
+
+pmt_t
+pmt_make_rectangular(double re, double im)
+{
+ return pmt_from_complex(re, im);
+}
+
+pmt_t pmt_from_complex(double re, double im)
+{
+ return pmt_t(new pmt_complex(std::complex<double>(re, im)));
+}
+
+pmt_t pmt_from_complex(const std::complex<double> &z)
+{
+ return pmt_t(new pmt_complex(z));
+}
+
+std::complex<double>
+pmt_to_complex(pmt_t x)
+{
+ if (x->is_complex())
+ return _complex(x)->value();
+ if (x->is_real())
+ return _real(x)->value();
+ if (x->is_integer())
+ return _integer(x)->value();
+
+ throw pmt_wrong_type("pmt_to_complex", x);
+}
+
+////////////////////////////////////////////////////////////////////////////
+// Pairs
+////////////////////////////////////////////////////////////////////////////
+
+pmt_null::pmt_null() {}
+pmt_pair::pmt_pair(const pmt_t& car, const pmt_t& cdr) : d_car(car), d_cdr(cdr) {}
+
+bool
+pmt_is_null(const pmt_t& x)
+{
+ return x == PMT_NIL;
+}
+
+bool
+pmt_is_pair(const pmt_t& obj)
+{
+ return obj->is_pair();
+}
+
+pmt_t
+pmt_cons(const pmt_t& x, const pmt_t& y)
+{
+ return pmt_t(new pmt_pair(x, y));
+}
+
+pmt_t
+pmt_car(const pmt_t& pair)
+{
+ pmt_pair* p = dynamic_cast<pmt_pair*>(pair.get());
+ if ( p )
+ return p->car();
+
+ throw pmt_wrong_type("pmt_car", pair);
+}
+
+pmt_t
+pmt_cdr(const pmt_t& pair)
+{
+ pmt_pair* p = dynamic_cast<pmt_pair*>(pair.get());
+ if ( p )
+ return p->cdr();
+
+ throw pmt_wrong_type("pmt_cdr", pair);
+}
+
+void
+pmt_set_car(pmt_t pair, pmt_t obj)
+{
+ if (pair->is_pair())
+ _pair(pair)->set_car(obj);
+ else
+ throw pmt_wrong_type("pmt_set_car", pair);
+}
+
+void
+pmt_set_cdr(pmt_t pair, pmt_t obj)
+{
+ if (pair->is_pair())
+ _pair(pair)->set_cdr(obj);
+ else
+ throw pmt_wrong_type("pmt_set_cdr", pair);
+}
+
+////////////////////////////////////////////////////////////////////////////
+// Vectors
+////////////////////////////////////////////////////////////////////////////
+
+pmt_vector::pmt_vector(size_t len, pmt_t fill)
+ : d_v(len)
+{
+ for (size_t i = 0; i < len; i++)
+ d_v[i] = fill;
+}
+
+pmt_t
+pmt_vector::ref(size_t k) const
+{
+ if (k >= length())
+ throw pmt_out_of_range("pmt_vector_ref", pmt_from_long(k));
+ return d_v[k];
+}
+
+void
+pmt_vector::set(size_t k, pmt_t obj)
+{
+ if (k >= length())
+ throw pmt_out_of_range("pmt_vector_set", pmt_from_long(k));
+ d_v[k] = obj;
+}
+
+void
+pmt_vector::fill(pmt_t obj)
+{
+ for (size_t i = 0; i < length(); i++)
+ d_v[i] = obj;
+}
+
+bool
+pmt_is_vector(pmt_t obj)
+{
+ return obj->is_vector();
+}
+
+pmt_t
+pmt_make_vector(size_t k, pmt_t fill)
+{
+ return pmt_t(new pmt_vector(k, fill));
+}
+
+pmt_t
+pmt_vector_ref(pmt_t vector, size_t k)
+{
+ if (!vector->is_vector())
+ throw pmt_wrong_type("pmt_vector_ref", vector);
+ return _vector(vector)->ref(k);
+}
+
+void
+pmt_vector_set(pmt_t vector, size_t k, pmt_t obj)
+{
+ if (!vector->is_vector())
+ throw pmt_wrong_type("pmt_vector_set", vector);
+ _vector(vector)->set(k, obj);
+}
+
+void
+pmt_vector_fill(pmt_t vector, pmt_t obj)
+{
+ if (!vector->is_vector())
+ throw pmt_wrong_type("pmt_vector_set", vector);
+ _vector(vector)->fill(obj);
+}
+
+////////////////////////////////////////////////////////////////////////////
+// Tuples
+////////////////////////////////////////////////////////////////////////////
+
+pmt_tuple::pmt_tuple(size_t len)
+ : d_v(len)
+{
+}
+
+pmt_t
+pmt_tuple::ref(size_t k) const
+{
+ if (k >= length())
+ throw pmt_out_of_range("pmt_tuple_ref", pmt_from_long(k));
+ return d_v[k];
+}
+
+bool
+pmt_is_tuple(pmt_t obj)
+{
+ return obj->is_tuple();
+}
+
+pmt_t
+pmt_tuple_ref(const pmt_t &tuple, size_t k)
+{
+ if (!tuple->is_tuple())
+ throw pmt_wrong_type("pmt_tuple_ref", tuple);
+ return _tuple(tuple)->ref(k);
+}
+
+// for (i=0; i < 10; i++)
+// make_constructor()
+
+pmt_t
+pmt_make_tuple()
+{
+ return pmt_t(new pmt_tuple(0));
+}
+
+pmt_t
+pmt_make_tuple(const pmt_t &e0)
+{
+ pmt_tuple *t = new pmt_tuple(1);
+ t->_set(0, e0);
+ return pmt_t(t);
+}
+
+pmt_t
+pmt_make_tuple(const pmt_t &e0, const pmt_t &e1)
+{
+ pmt_tuple *t = new pmt_tuple(2);
+ t->_set(0, e0);
+ t->_set(1, e1);
+ return pmt_t(t);
+}
+
+pmt_t
+pmt_make_tuple(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2)
+{
+ pmt_tuple *t = new pmt_tuple(3);
+ t->_set(0, e0);
+ t->_set(1, e1);
+ t->_set(2, e2);
+ return pmt_t(t);
+}
+
+pmt_t
+pmt_make_tuple(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3)
+{
+ pmt_tuple *t = new pmt_tuple(4);
+ t->_set(0, e0);
+ t->_set(1, e1);
+ t->_set(2, e2);
+ t->_set(3, e3);
+ return pmt_t(t);
+}
+
+pmt_t
+pmt_make_tuple(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4)
+{
+ pmt_tuple *t = new pmt_tuple(5);
+ t->_set(0, e0);
+ t->_set(1, e1);
+ t->_set(2, e2);
+ t->_set(3, e3);
+ t->_set(4, e4);
+ return pmt_t(t);
+}
+
+pmt_t
+pmt_make_tuple(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4, const pmt_t &e5)
+{
+ pmt_tuple *t = new pmt_tuple(6);
+ t->_set(0, e0);
+ t->_set(1, e1);
+ t->_set(2, e2);
+ t->_set(3, e3);
+ t->_set(4, e4);
+ t->_set(5, e5);
+ return pmt_t(t);
+}
+
+pmt_t
+pmt_make_tuple(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4, const pmt_t &e5, const pmt_t &e6)
+{
+ pmt_tuple *t = new pmt_tuple(7);
+ t->_set(0, e0);
+ t->_set(1, e1);
+ t->_set(2, e2);
+ t->_set(3, e3);
+ t->_set(4, e4);
+ t->_set(5, e5);
+ t->_set(6, e6);
+ return pmt_t(t);
+}
+
+pmt_t
+pmt_make_tuple(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4, const pmt_t &e5, const pmt_t &e6, const pmt_t &e7)
+{
+ pmt_tuple *t = new pmt_tuple(8);
+ t->_set(0, e0);
+ t->_set(1, e1);
+ t->_set(2, e2);
+ t->_set(3, e3);
+ t->_set(4, e4);
+ t->_set(5, e5);
+ t->_set(6, e6);
+ t->_set(7, e7);
+ return pmt_t(t);
+}
+
+pmt_t
+pmt_make_tuple(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4, const pmt_t &e5, const pmt_t &e6, const pmt_t &e7, const pmt_t &e8)
+{
+ pmt_tuple *t = new pmt_tuple(9);
+ t->_set(0, e0);
+ t->_set(1, e1);
+ t->_set(2, e2);
+ t->_set(3, e3);
+ t->_set(4, e4);
+ t->_set(5, e5);
+ t->_set(6, e6);
+ t->_set(7, e7);
+ t->_set(8, e8);
+ return pmt_t(t);
+}
+
+pmt_t
+pmt_make_tuple(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4, const pmt_t &e5, const pmt_t &e6, const pmt_t &e7, const pmt_t &e8, const pmt_t &e9)
+{
+ pmt_tuple *t = new pmt_tuple(10);
+ t->_set(0, e0);
+ t->_set(1, e1);
+ t->_set(2, e2);
+ t->_set(3, e3);
+ t->_set(4, e4);
+ t->_set(5, e5);
+ t->_set(6, e6);
+ t->_set(7, e7);
+ t->_set(8, e8);
+ t->_set(9, e9);
+ return pmt_t(t);
+}
+
+pmt_t
+pmt_to_tuple(const pmt_t &x)
+{
+ if (x->is_tuple()) // already one
+ return x;
+
+ size_t len = pmt_length(x);
+ pmt_tuple *t = new pmt_tuple(len);
+ pmt_t r = pmt_t(t);
+
+ if (x->is_vector()){
+ for (size_t i = 0; i < len; i++)
+ t->_set(i, _vector(x)->ref(i));
+ return r;
+ }
+
+ if (x->is_pair()){
+ pmt_t y = x;
+ for (size_t i = 0; i < len; i++){
+ t->_set(i, pmt_car(y));
+ y = pmt_cdr(y);
+ }
+ return r;
+ }
+
+ throw pmt_wrong_type("pmt_to_tuple", x);
+}
+
+
+
+////////////////////////////////////////////////////////////////////////////
+// Uniform Numeric Vectors
+////////////////////////////////////////////////////////////////////////////
+
+bool
+pmt_is_uniform_vector(pmt_t x)
+{
+ return x->is_uniform_vector();
+}
+
+const void *
+pmt_uniform_vector_elements(pmt_t vector, size_t &len)
+{
+ if (!vector->is_uniform_vector())
+ throw pmt_wrong_type("pmt_uniform_vector_elements", vector);
+ return _uniform_vector(vector)->uniform_elements(len);
+}
+
+void *
+pmt_uniform_vector_writable_elements(pmt_t vector, size_t &len)
+{
+ if (!vector->is_uniform_vector())
+ throw pmt_wrong_type("pmt_uniform_vector_writable_elements", vector);
+ return _uniform_vector(vector)->uniform_writable_elements(len);
+}
+
+////////////////////////////////////////////////////////////////////////////
+// Dictionaries
+////////////////////////////////////////////////////////////////////////////
+
+/*
+ * This is an a-list implementation.
+ *
+ * When we need better performance for large dictionaries, consider implementing
+ * persistent Red-Black trees as described in "Purely Functional Data Structures",
+ * Chris Okasaki, 1998, section 3.3.
+ */
+
+bool
+pmt_is_dict(const pmt_t &obj)
+{
+ return pmt_is_null(obj) || pmt_is_pair(obj);
+}
+
+pmt_t
+pmt_make_dict()
+{
+ return PMT_NIL;
+}
+
+pmt_t
+pmt_dict_add(const pmt_t &dict, const pmt_t &key, const pmt_t &value)
+{
+ if (pmt_is_null(dict))
+ return pmt_acons(key, value, PMT_NIL);
+
+ if (pmt_dict_has_key(dict, key))
+ return pmt_acons(key, value, pmt_dict_delete(dict, key));
+
+ return pmt_acons(key, value, dict);
+}
+
+pmt_t
+pmt_dict_delete(const pmt_t &dict, const pmt_t &key)
+{
+ if (pmt_is_null(dict))
+ return dict;
+
+ if (pmt_eqv(pmt_caar(dict), key))
+ return pmt_cdr(dict);
+
+ return pmt_cons(pmt_car(dict), pmt_dict_delete(pmt_cdr(dict), key));
+}
+
+pmt_t
+pmt_dict_ref(const pmt_t &dict, const pmt_t &key, const pmt_t &not_found)
+{
+ pmt_t p = pmt_assv(key, dict); // look for (key . value) pair
+ if (pmt_is_pair(p))
+ return pmt_cdr(p);
+ else
+ return not_found;
+}
+
+bool
+pmt_dict_has_key(const pmt_t &dict, const pmt_t &key)
+{
+ return pmt_is_pair(pmt_assv(key, dict));
+}
+
+pmt_t
+pmt_dict_items(pmt_t dict)
+{
+ if (!pmt_is_dict(dict))
+ throw pmt_wrong_type("pmt_dict_values", dict);
+
+ return dict; // equivalent to dict in the a-list case
+}
+
+pmt_t
+pmt_dict_keys(pmt_t dict)
+{
+ if (!pmt_is_dict(dict))
+ throw pmt_wrong_type("pmt_dict_keys", dict);
+
+ return pmt_map(pmt_car, dict);
+}
+
+pmt_t
+pmt_dict_values(pmt_t dict)
+{
+ if (!pmt_is_dict(dict))
+ throw pmt_wrong_type("pmt_dict_keys", dict);
+
+ return pmt_map(pmt_cdr, dict);
+}
+
+////////////////////////////////////////////////////////////////////////////
+// Any
+////////////////////////////////////////////////////////////////////////////
+
+pmt_any::pmt_any(const boost::any &any) : d_any(any) {}
+
+bool
+pmt_is_any(pmt_t obj)
+{
+ return obj->is_any();
+}
+
+pmt_t
+pmt_make_any(const boost::any &any)
+{
+ return pmt_t(new pmt_any(any));
+}
+
+boost::any
+pmt_any_ref(pmt_t obj)
+{
+ if (!obj->is_any())
+ throw pmt_wrong_type("pmt_any_ref", obj);
+ return _any(obj)->ref();
+}
+
+void
+pmt_any_set(pmt_t obj, const boost::any &any)
+{
+ if (!obj->is_any())
+ throw pmt_wrong_type("pmt_any_set", obj);
+ _any(obj)->set(any);
+}
+
+////////////////////////////////////////////////////////////////////////////
+// msg_accepter -- built from "any"
+////////////////////////////////////////////////////////////////////////////
+
+bool
+pmt_is_msg_accepter(const pmt_t &obj)
+{
+ if (!pmt_is_any(obj))
+ return false;
+
+ boost::any r = pmt_any_ref(obj);
+ return boost::any_cast<gruel::msg_accepter_sptr>(&r) != 0;
+}
+
+//! make a msg_accepter
+pmt_t
+pmt_make_msg_accepter(gruel::msg_accepter_sptr ma)
+{
+ return pmt_make_any(ma);
+}
+
+//! Return underlying msg_accepter
+gruel::msg_accepter_sptr
+pmt_msg_accepter_ref(const pmt_t &obj)
+{
+ try {
+ return boost::any_cast<gruel::msg_accepter_sptr>(pmt_any_ref(obj));
+ }
+ catch (boost::bad_any_cast &e){
+ throw pmt_wrong_type("pmt_msg_accepter_ref", obj);
+ }
+}
+
+
+////////////////////////////////////////////////////////////////////////////
+// Binary Large Object -- currently a u8vector
+////////////////////////////////////////////////////////////////////////////
+
+bool
+pmt_is_blob(pmt_t x)
+{
+ // return pmt_is_u8vector(x);
+ return pmt_is_uniform_vector(x);
+}
+
+pmt_t
+pmt_make_blob(const void *buf, size_t len_in_bytes)
+{
+ return pmt_init_u8vector(len_in_bytes, (const uint8_t *) buf);
+}
+
+const void *
+pmt_blob_data(pmt_t blob)
+{
+ size_t len;
+ return pmt_uniform_vector_elements(blob, len);
+}
+
+size_t
+pmt_blob_length(pmt_t blob)
+{
+ size_t len;
+ pmt_uniform_vector_elements(blob, len);
+ return len;
+}
+
+
+////////////////////////////////////////////////////////////////////////////
+// General Functions
+////////////////////////////////////////////////////////////////////////////
+
+bool
+pmt_eq(const pmt_t& x, const pmt_t& y)
+{
+ return x == y;
+}
+
+bool
+pmt_eqv(const pmt_t& x, const pmt_t& y)
+{
+ if (x == y)
+ return true;
+
+ if (x->is_integer() && y->is_integer())
+ return _integer(x)->value() == _integer(y)->value();
+
+ if (x->is_uint64() && y->is_uint64())
+ return _uint64(x)->value() == _uint64(y)->value();
+
+ if (x->is_real() && y->is_real())
+ return _real(x)->value() == _real(y)->value();
+
+ if (x->is_complex() && y->is_complex())
+ return _complex(x)->value() == _complex(y)->value();
+
+ return false;
+}
+
+bool
+pmt_eqv_raw(pmt_base *x, pmt_base *y)
+{
+ if (x == y)
+ return true;
+
+ if (x->is_integer() && y->is_integer())
+ return _integer(x)->value() == _integer(y)->value();
+
+ if (x->is_uint64() && y->is_uint64())
+ return _uint64(x)->value() == _uint64(y)->value();
+
+ if (x->is_real() && y->is_real())
+ return _real(x)->value() == _real(y)->value();
+
+ if (x->is_complex() && y->is_complex())
+ return _complex(x)->value() == _complex(y)->value();
+
+ return false;
+}
+
+bool
+pmt_equal(const pmt_t& x, const pmt_t& y)
+{
+ if (pmt_eqv(x, y))
+ return true;
+
+ if (x->is_pair() && y->is_pair())
+ return pmt_equal(pmt_car(x), pmt_car(y)) && pmt_equal(pmt_cdr(x), pmt_cdr(y));
+
+ if (x->is_vector() && y->is_vector()){
+ pmt_vector *xv = _vector(x);
+ pmt_vector *yv = _vector(y);
+ if (xv->length() != yv->length())
+ return false;
+
+ for (unsigned i = 0; i < xv->length(); i++)
+ if (!pmt_equal(xv->_ref(i), yv->_ref(i)))
+ return false;
+
+ return true;
+ }
+
+ if (x->is_tuple() && y->is_tuple()){
+ pmt_tuple *xv = _tuple(x);
+ pmt_tuple *yv = _tuple(y);
+ if (xv->length() != yv->length())
+ return false;
+
+ for (unsigned i = 0; i < xv->length(); i++)
+ if (!pmt_equal(xv->_ref(i), yv->_ref(i)))
+ return false;
+
+ return true;
+ }
+
+ if (x->is_uniform_vector() && y->is_uniform_vector()){
+ pmt_uniform_vector *xv = _uniform_vector(x);
+ pmt_uniform_vector *yv = _uniform_vector(y);
+ if (xv->length() != yv->length())
+ return false;
+
+ size_t len_x, len_y;
+ if (memcmp(xv->uniform_elements(len_x),
+ yv->uniform_elements(len_y),
+ len_x) == 0)
+ return true;
+
+ return true;
+ }
+
+ // FIXME add other cases here...
+
+ return false;
+}
+
+size_t
+pmt_length(const pmt_t& x)
+{
+ if (x->is_vector())
+ return _vector(x)->length();
+
+ if (x->is_uniform_vector())
+ return _uniform_vector(x)->length();
+
+ if (x->is_tuple())
+ return _tuple(x)->length();
+
+ if (x->is_null())
+ return 0;
+
+ if (x->is_pair()) {
+ size_t length=1;
+ pmt_t it = pmt_cdr(x);
+ while (pmt_is_pair(it)){
+ length++;
+ it = pmt_cdr(it);
+ }
+ if (pmt_is_null(it))
+ return length;
+
+ // not a proper list
+ throw pmt_wrong_type("pmt_length", x);
+ }
+
+ // FIXME dictionary length (number of entries)
+
+ throw pmt_wrong_type("pmt_length", x);
+}
+
+pmt_t
+pmt_assq(pmt_t obj, pmt_t alist)
+{
+ while (pmt_is_pair(alist)){
+ pmt_t p = pmt_car(alist);
+ if (!pmt_is_pair(p)) // malformed alist
+ return PMT_F;
+
+ if (pmt_eq(obj, pmt_car(p)))
+ return p;
+
+ alist = pmt_cdr(alist);
+ }
+ return PMT_F;
+}
+
+/*
+ * This avoids a bunch of shared_pointer reference count manipulation.
+ */
+pmt_t
+pmt_assv_raw(pmt_base *obj, pmt_base *alist)
+{
+ while (alist->is_pair()){
+ pmt_base *p = ((pmt_pair *)alist)->d_car.get();
+ if (!p->is_pair()) // malformed alist
+ return PMT_F;
+
+ if (pmt_eqv_raw(obj, ((pmt_pair *)p)->d_car.get()))
+ return ((pmt_pair *)alist)->d_car;
+
+ alist = (((pmt_pair *)alist)->d_cdr).get();
+ }
+ return PMT_F;
+}
+
+#if 1
+
+pmt_t
+pmt_assv(pmt_t obj, pmt_t alist)
+{
+ return pmt_assv_raw(obj.get(), alist.get());
+}
+
+#else
+
+pmt_t
+pmt_assv(pmt_t obj, pmt_t alist)
+{
+ while (pmt_is_pair(alist)){
+ pmt_t p = pmt_car(alist);
+ if (!pmt_is_pair(p)) // malformed alist
+ return PMT_F;
+
+ if (pmt_eqv(obj, pmt_car(p)))
+ return p;
+
+ alist = pmt_cdr(alist);
+ }
+ return PMT_F;
+}
+
+#endif
+
+
+pmt_t
+pmt_assoc(pmt_t obj, pmt_t alist)
+{
+ while (pmt_is_pair(alist)){
+ pmt_t p = pmt_car(alist);
+ if (!pmt_is_pair(p)) // malformed alist
+ return PMT_F;
+
+ if (pmt_equal(obj, pmt_car(p)))
+ return p;
+
+ alist = pmt_cdr(alist);
+ }
+ return PMT_F;
+}
+
+pmt_t
+pmt_map(pmt_t proc(const pmt_t&), pmt_t list)
+{
+ pmt_t r = PMT_NIL;
+
+ while(pmt_is_pair(list)){
+ r = pmt_cons(proc(pmt_car(list)), r);
+ list = pmt_cdr(list);
+ }
+
+ return pmt_reverse_x(r);
+}
+
+pmt_t
+pmt_reverse(pmt_t listx)
+{
+ pmt_t list = listx;
+ pmt_t r = PMT_NIL;
+
+ while(pmt_is_pair(list)){
+ r = pmt_cons(pmt_car(list), r);
+ list = pmt_cdr(list);
+ }
+ if (pmt_is_null(list))
+ return r;
+ else
+ throw pmt_wrong_type("pmt_reverse", listx);
+}
+
+pmt_t
+pmt_reverse_x(pmt_t list)
+{
+ // FIXME do it destructively
+ return pmt_reverse(list);
+}
+
+pmt_t
+pmt_nth(size_t n, pmt_t list)
+{
+ pmt_t t = pmt_nthcdr(n, list);
+ if (pmt_is_pair(t))
+ return pmt_car(t);
+ else
+ return PMT_NIL;
+}
+
+pmt_t
+pmt_nthcdr(size_t n, pmt_t list)
+{
+ if (!(pmt_is_pair(list) || pmt_is_null(list)))
+ throw pmt_wrong_type("pmt_nthcdr", list);
+
+ while (n > 0){
+ if (pmt_is_pair(list)){
+ list = pmt_cdr(list);
+ n--;
+ continue;
+ }
+ if (pmt_is_null(list))
+ return PMT_NIL;
+ else
+ throw pmt_wrong_type("pmt_nthcdr: not a LIST", list);
+ }
+ return list;
+}
+
+pmt_t
+pmt_memq(pmt_t obj, pmt_t list)
+{
+ while (pmt_is_pair(list)){
+ if (pmt_eq(obj, pmt_car(list)))
+ return list;
+ list = pmt_cdr(list);
+ }
+ return PMT_F;
+}
+
+pmt_t
+pmt_memv(pmt_t obj, pmt_t list)
+{
+ while (pmt_is_pair(list)){
+ if (pmt_eqv(obj, pmt_car(list)))
+ return list;
+ list = pmt_cdr(list);
+ }
+ return PMT_F;
+}
+
+pmt_t
+pmt_member(pmt_t obj, pmt_t list)
+{
+ while (pmt_is_pair(list)){
+ if (pmt_equal(obj, pmt_car(list)))
+ return list;
+ list = pmt_cdr(list);
+ }
+ return PMT_F;
+}
+
+bool
+pmt_subsetp(pmt_t list1, pmt_t list2)
+{
+ while (pmt_is_pair(list1)){
+ pmt_t p = pmt_car(list1);
+ if (pmt_is_false(pmt_memv(p, list2)))
+ return false;
+ list1 = pmt_cdr(list1);
+ }
+ return true;
+}
+
+pmt_t
+pmt_list1(const pmt_t& x1)
+{
+ return pmt_cons(x1, PMT_NIL);
+}
+
+pmt_t
+pmt_list2(const pmt_t& x1, const pmt_t& x2)
+{
+ return pmt_cons(x1, pmt_cons(x2, PMT_NIL));
+}
+
+pmt_t
+pmt_list3(const pmt_t& x1, const pmt_t& x2, const pmt_t& x3)
+{
+ return pmt_cons(x1, pmt_cons(x2, pmt_cons(x3, PMT_NIL)));
+}
+
+pmt_t
+pmt_list4(const pmt_t& x1, const pmt_t& x2, const pmt_t& x3, const pmt_t& x4)
+{
+ return pmt_cons(x1, pmt_cons(x2, pmt_cons(x3, pmt_cons(x4, PMT_NIL))));
+}
+
+pmt_t
+pmt_list5(const pmt_t& x1, const pmt_t& x2, const pmt_t& x3, const pmt_t& x4, const pmt_t& x5)
+{
+ return pmt_cons(x1, pmt_cons(x2, pmt_cons(x3, pmt_cons(x4, pmt_cons(x5, PMT_NIL)))));
+}
+
+pmt_t
+pmt_list6(const pmt_t& x1, const pmt_t& x2, const pmt_t& x3, const pmt_t& x4, const pmt_t& x5, const pmt_t& x6)
+{
+ return pmt_cons(x1, pmt_cons(x2, pmt_cons(x3, pmt_cons(x4, pmt_cons(x5, pmt_cons(x6, PMT_NIL))))));
+}
+
+pmt_t
+pmt_list_add(pmt_t list, const pmt_t& item)
+{
+ return pmt_reverse(pmt_cons(item, pmt_reverse(list)));
+}
+
+pmt_t
+pmt_list_rm(pmt_t list, const pmt_t& item)
+{
+ if(pmt_is_pair(list)){
+ pmt_t left = pmt_car(list);
+ pmt_t right = pmt_cdr(list);
+ if(!pmt_equal(left, item)){
+ return pmt_cons(left, pmt_list_rm(right, item));
+ } else {
+ return pmt_list_rm(right, item);
+ }
+ } else {
+ return list;
+ }
+}
+
+bool
+pmt_list_has(pmt_t list, const pmt_t& item)
+{
+ if(pmt_is_pair(list)){
+ pmt_t left = pmt_car(list);
+ pmt_t right = pmt_cdr(list);
+ if(pmt_equal(left,item))
+ return true;
+ return pmt_list_has(right, item);
+ } else {
+ if(pmt_is_null(list))
+ return false;
+ throw std::runtime_error("list contains invalid format!");
+ }
+}
+
+pmt_t
+pmt_caar(pmt_t pair)
+{
+ return (pmt_car(pmt_car(pair)));
+}
+
+pmt_t
+pmt_cadr(pmt_t pair)
+{
+ return pmt_car(pmt_cdr(pair));
+}
+
+pmt_t
+pmt_cdar(pmt_t pair)
+{
+ return pmt_cdr(pmt_car(pair));
+}
+
+pmt_t
+pmt_cddr(pmt_t pair)
+{
+ return pmt_cdr(pmt_cdr(pair));
+}
+
+pmt_t
+pmt_caddr(pmt_t pair)
+{
+ return pmt_car(pmt_cdr(pmt_cdr(pair)));
+}
+
+pmt_t
+pmt_cadddr(pmt_t pair)
+{
+ return pmt_car(pmt_cdr(pmt_cdr(pmt_cdr(pair))));
+}
+
+bool
+pmt_is_eof_object(pmt_t obj)
+{
+ return pmt_eq(obj, PMT_EOF);
+}
+
+void
+pmt_dump_sizeof()
+{
+ printf("sizeof(pmt_t) = %3zd\n", sizeof(pmt_t));
+ printf("sizeof(pmt_base) = %3zd\n", sizeof(pmt_base));
+ printf("sizeof(pmt_bool) = %3zd\n", sizeof(pmt_bool));
+ printf("sizeof(pmt_symbol) = %3zd\n", sizeof(pmt_symbol));
+ printf("sizeof(pmt_integer) = %3zd\n", sizeof(pmt_integer));
+ printf("sizeof(pmt_uint64) = %3zd\n", sizeof(pmt_uint64));
+ printf("sizeof(pmt_real) = %3zd\n", sizeof(pmt_real));
+ printf("sizeof(pmt_complex) = %3zd\n", sizeof(pmt_complex));
+ printf("sizeof(pmt_null) = %3zd\n", sizeof(pmt_null));
+ printf("sizeof(pmt_pair) = %3zd\n", sizeof(pmt_pair));
+ printf("sizeof(pmt_vector) = %3zd\n", sizeof(pmt_vector));
+ printf("sizeof(pmt_uniform_vector) = %3zd\n", sizeof(pmt_uniform_vector));
+}
+
+} /* namespace pmt */
diff --git a/gruel/src/lib/pmt/pmt_int.h b/gruel/src/lib/pmt/pmt_int.h
new file mode 100644
index 000000000..d669e1049
--- /dev/null
+++ b/gruel/src/lib/pmt/pmt_int.h
@@ -0,0 +1,247 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006,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.
+ */
+#ifndef INCLUDED_PMT_INT_H
+#define INCLUDED_PMT_INT_H
+
+#include <gruel/pmt.h>
+#include <boost/utility.hpp>
+#include <boost/detail/atomic_count.hpp>
+
+/*
+ * EVERYTHING IN THIS FILE IS PRIVATE TO THE IMPLEMENTATION!
+ *
+ * See pmt.h for the public interface
+ */
+
+#define PMT_LOCAL_ALLOCATOR 0 // define to 0 or 1
+namespace pmt {
+
+class GRUEL_API pmt_base : boost::noncopyable {
+ mutable boost::detail::atomic_count count_;
+
+protected:
+ pmt_base() : count_(0) {};
+ virtual ~pmt_base();
+
+public:
+ virtual bool is_bool() const { return false; }
+ virtual bool is_symbol() const { return false; }
+ virtual bool is_number() const { return false; }
+ virtual bool is_integer() const { return false; }
+ virtual bool is_uint64() const { return false; }
+ virtual bool is_real() const { return false; }
+ virtual bool is_complex() const { return false; }
+ virtual bool is_null() const { return false; }
+ virtual bool is_pair() const { return false; }
+ virtual bool is_tuple() const { return false; }
+ virtual bool is_vector() const { return false; }
+ virtual bool is_dict() const { return false; }
+ virtual bool is_any() const { return false; }
+
+ virtual bool is_uniform_vector() const { return false; }
+ virtual bool is_u8vector() const { return false; }
+ virtual bool is_s8vector() const { return false; }
+ virtual bool is_u16vector() const { return false; }
+ virtual bool is_s16vector() const { return false; }
+ virtual bool is_u32vector() const { return false; }
+ virtual bool is_s32vector() const { return false; }
+ virtual bool is_u64vector() const { return false; }
+ virtual bool is_s64vector() const { return false; }
+ virtual bool is_f32vector() const { return false; }
+ virtual bool is_f64vector() const { return false; }
+ virtual bool is_c32vector() const { return false; }
+ virtual bool is_c64vector() const { return false; }
+
+ friend void intrusive_ptr_add_ref(pmt_base* p);
+ friend void intrusive_ptr_release(pmt_base* p);
+
+# if (PMT_LOCAL_ALLOCATOR)
+ void *operator new(size_t);
+ void operator delete(void *, size_t);
+#endif
+};
+
+class pmt_bool : public pmt_base
+{
+public:
+ pmt_bool();
+ //~pmt_bool(){}
+
+ bool is_bool() const { return true; }
+};
+
+
+class pmt_symbol : public pmt_base
+{
+ std::string d_name;
+ pmt_t d_next;
+
+public:
+ pmt_symbol(const std::string &name);
+ //~pmt_symbol(){}
+
+ bool is_symbol() const { return true; }
+ const std::string name() { return d_name; }
+
+ pmt_t next() { return d_next; } // symbol table link
+ void set_next(pmt_t next) { d_next = next; }
+};
+
+class pmt_integer : public pmt_base
+{
+public:
+ long d_value;
+
+ pmt_integer(long value);
+ //~pmt_integer(){}
+
+ bool is_number() const { return true; }
+ bool is_integer() const { return true; }
+ long value() const { return d_value; }
+};
+
+class pmt_uint64 : public pmt_base
+{
+public:
+ uint64_t d_value;
+
+ pmt_uint64(uint64_t value);
+ //~pmt_uint64(){}
+
+ bool is_number() const { return true; }
+ bool is_uint64() const { return true; }
+ uint64_t value() const { return d_value; }
+};
+
+class pmt_real : public pmt_base
+{
+public:
+ double d_value;
+
+ pmt_real(double value);
+ //~pmt_real(){}
+
+ bool is_number() const { return true; }
+ bool is_real() const { return true; }
+ double value() const { return d_value; }
+};
+
+class pmt_complex : public pmt_base
+{
+public:
+ std::complex<double> d_value;
+
+ pmt_complex(std::complex<double> value);
+ //~pmt_complex(){}
+
+ bool is_number() const { return true; }
+ bool is_complex() const { return true; }
+ std::complex<double> value() const { return d_value; }
+};
+
+class pmt_null : public pmt_base
+{
+public:
+ pmt_null();
+ //~pmt_null(){}
+
+ bool is_null() const { return true; }
+};
+
+class pmt_pair : public pmt_base
+{
+public:
+ pmt_t d_car;
+ pmt_t d_cdr;
+
+ pmt_pair(const pmt_t& car, const pmt_t& cdr);
+ //~pmt_pair(){};
+
+ bool is_pair() const { return true; }
+ pmt_t car() const { return d_car; }
+ pmt_t cdr() const { return d_cdr; }
+
+ void set_car(pmt_t car) { d_car = car; }
+ void set_cdr(pmt_t cdr) { d_cdr = cdr; }
+};
+
+class pmt_vector : public pmt_base
+{
+ std::vector<pmt_t> d_v;
+
+public:
+ pmt_vector(size_t len, pmt_t fill);
+ //~pmt_vector();
+
+ bool is_vector() const { return true; }
+ pmt_t ref(size_t k) const;
+ void set(size_t k, pmt_t obj);
+ void fill(pmt_t fill);
+ size_t length() const { return d_v.size(); }
+
+ pmt_t _ref(size_t k) const { return d_v[k]; }
+};
+
+class pmt_tuple : public pmt_base
+{
+ std::vector<pmt_t> d_v;
+
+public:
+ pmt_tuple(size_t len);
+ //~pmt_tuple();
+
+ bool is_tuple() const { return true; }
+ pmt_t ref(size_t k) const;
+ size_t length() const { return d_v.size(); }
+
+ pmt_t _ref(size_t k) const { return d_v[k]; }
+ void _set(size_t k, pmt_t v) { d_v[k] = v; }
+};
+
+class pmt_any : public pmt_base
+{
+ boost::any d_any;
+
+public:
+ pmt_any(const boost::any &any);
+ //~pmt_any();
+
+ bool is_any() const { return true; }
+ const boost::any &ref() const { return d_any; }
+ void set(const boost::any &any) { d_any = any; }
+};
+
+
+class pmt_uniform_vector : public pmt_base
+{
+public:
+ bool is_uniform_vector() const { return true; }
+ virtual const void *uniform_elements(size_t &len) = 0;
+ virtual void *uniform_writable_elements(size_t &len) = 0;
+ virtual size_t length() const = 0;
+};
+
+#include "pmt_unv_int.h"
+
+} /* namespace pmt */
+
+#endif /* INCLUDED_PMT_INT_H */
diff --git a/gruel/src/lib/pmt/pmt_io.cc b/gruel/src/lib/pmt/pmt_io.cc
new file mode 100644
index 000000000..4bac4a0ec
--- /dev/null
+++ b/gruel/src/lib/pmt/pmt_io.cc
@@ -0,0 +1,168 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006,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 this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <vector>
+#include <gruel/pmt.h>
+#include "pmt_int.h"
+#include <sstream>
+#include <iostream>
+
+namespace pmt {
+
+static void
+pmt_write_list_tail(pmt_t obj, std::ostream &port)
+{
+ pmt_write(pmt_car(obj), port); // write the car
+ obj = pmt_cdr(obj); // step to cdr
+
+ if (pmt_is_null(obj)) // ()
+ port << ")";
+
+ else if (pmt_is_pair(obj)){ // normal list
+ port << " ";
+ pmt_write_list_tail(obj, port);
+ }
+ else { // dotted pair
+ port << " . ";
+ pmt_write(obj, port);
+ port << ")";
+ }
+}
+
+void
+pmt_write(pmt_t obj, std::ostream &port)
+{
+ if (pmt_is_bool(obj)){
+ if (pmt_is_true(obj))
+ port << "#t";
+ else
+ port << "#f";
+ }
+ else if (pmt_is_symbol(obj)){
+ port << pmt_symbol_to_string(obj);
+ }
+ else if (pmt_is_number(obj)){
+ if (pmt_is_integer(obj))
+ port << pmt_to_long(obj);
+ else if (pmt_is_uint64(obj))
+ port << pmt_to_uint64(obj);
+ else if (pmt_is_real(obj))
+ port << pmt_to_double(obj);
+ else if (pmt_is_complex(obj)){
+ std::complex<double> c = pmt_to_complex(obj);
+ port << c.real() << '+' << c.imag() << 'i';
+ }
+ else
+ goto error;
+ }
+ else if (pmt_is_null(obj)){
+ port << "()";
+ }
+ else if (pmt_is_pair(obj)){
+ port << "(";
+ pmt_write_list_tail(obj, port);
+ }
+ else if (pmt_is_tuple(obj)){
+ port << "{";
+ size_t len = pmt_length(obj);
+ if (len > 0){
+ port << pmt_tuple_ref(obj, 0);
+ for (size_t i = 1; i < len; i++)
+ port << " " << pmt_tuple_ref(obj, i);
+ }
+ port << "}";
+ }
+ else if (pmt_is_vector(obj)){
+ port << "#(";
+ size_t len = pmt_length(obj);
+ if (len > 0){
+ port << pmt_vector_ref(obj, 0);
+ for (size_t i = 1; i < len; i++)
+ port << " " << pmt_vector_ref(obj, i);
+ }
+ port << ")";
+ }
+ else if (pmt_is_dict(obj)){
+ // FIXME
+ // port << "#<dict " << obj << ">";
+ port << "#<dict>";
+ }
+ else if (pmt_is_uniform_vector(obj)){
+ // FIXME
+ // port << "#<uniform-vector " << obj << ">";
+ port << "#<uniform-vector>";
+ }
+ else {
+ error:
+ // FIXME
+ // port << "#<" << obj << ">";
+ port << "#<unknown>";
+ }
+}
+
+std::ostream& operator<<(std::ostream &os, pmt_t obj)
+{
+ pmt_write(obj, os);
+ return os;
+}
+
+std::string
+pmt_write_string(pmt_t obj)
+{
+ std::ostringstream s;
+ s << obj;
+ return s.str();
+}
+
+pmt_t
+pmt_read(std::istream &port)
+{
+ throw pmt_notimplemented("notimplemented: pmt_read", PMT_NIL);
+}
+
+void
+pmt_serialize(pmt_t obj, std::ostream &sink)
+{
+ throw pmt_notimplemented("notimplemented: pmt_serialize", obj);
+}
+
+/*!
+ * \brief Create obj from portable byte-serial representation
+ */
+pmt_t
+pmt_deserialize(std::istream &source)
+{
+ throw pmt_notimplemented("notimplemented: pmt_deserialize", PMT_NIL);
+}
+
+} /* namespace pmt */
+
+
+void
+pmt::pmt_print(pmt_t v)
+{
+ std::cout << pmt_write_string(v) << std::endl;
+}
+
+
diff --git a/gruel/src/lib/pmt/pmt_pool.cc b/gruel/src/lib/pmt/pmt_pool.cc
new file mode 100644
index 000000000..63a681abf
--- /dev/null
+++ b/gruel/src/lib/pmt/pmt_pool.cc
@@ -0,0 +1,112 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007,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 this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <gruel/pmt_pool.h>
+#include <algorithm>
+#include <stdint.h>
+
+namespace pmt {
+
+static inline size_t
+ROUNDUP(size_t x, size_t stride)
+{
+ return ((((x) + (stride) - 1)/(stride)) * (stride));
+}
+
+pmt_pool::pmt_pool(size_t itemsize, size_t alignment,
+ size_t allocation_size, size_t max_items)
+ : d_itemsize(ROUNDUP(itemsize, alignment)),
+ d_alignment(alignment),
+ d_allocation_size(std::max(allocation_size, 16 * itemsize)),
+ d_max_items(max_items), d_n_items(0),
+ d_freelist(0)
+{
+}
+
+pmt_pool::~pmt_pool()
+{
+ for (unsigned int i = 0; i < d_allocations.size(); i++){
+ delete [] d_allocations[i];
+ }
+}
+
+void *
+pmt_pool::malloc()
+{
+ scoped_lock guard(d_mutex);
+ item *p;
+
+ if (d_max_items != 0){
+ while (d_n_items >= d_max_items)
+ d_cond.wait(guard);
+ }
+
+ if (d_freelist){ // got something?
+ p = d_freelist;
+ d_freelist = p->d_next;
+ d_n_items++;
+ return p;
+ }
+
+ // allocate a new chunk
+ char *alloc = new char[d_allocation_size + d_alignment - 1];
+ d_allocations.push_back(alloc);
+
+ // get the alignment we require
+ char *start = (char *)(((uintptr_t)alloc + d_alignment-1) & -d_alignment);
+ char *end = alloc + d_allocation_size + d_alignment - 1;
+ size_t n = (end - start) / d_itemsize;
+
+ // link the new items onto the free list.
+ p = (item *) start;
+ for (size_t i = 0; i < n; i++){
+ p->d_next = d_freelist;
+ d_freelist = p;
+ p = (item *)((char *) p + d_itemsize);
+ }
+
+ // now return the first one
+ p = d_freelist;
+ d_freelist = p->d_next;
+ d_n_items++;
+ return p;
+}
+
+void
+pmt_pool::free(void *foo)
+{
+ if (!foo)
+ return;
+
+ scoped_lock guard(d_mutex);
+
+ item *p = (item *) foo;
+ p->d_next = d_freelist;
+ d_freelist = p;
+ d_n_items--;
+ if (d_max_items != 0)
+ d_cond.notify_one();
+}
+
+} /* namespace pmt */
diff --git a/gruel/src/lib/pmt/pmt_serialize.cc b/gruel/src/lib/pmt/pmt_serialize.cc
new file mode 100644
index 000000000..24be6b772
--- /dev/null
+++ b/gruel/src/lib/pmt/pmt_serialize.cc
@@ -0,0 +1,830 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007,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 this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <vector>
+#include <gruel/pmt.h>
+#include "pmt_int.h"
+#include "gruel/pmt_serial_tags.h"
+
+namespace pmt {
+
+static pmt_t parse_pair(std::streambuf &sb);
+
+// ----------------------------------------------------------------
+// output primitives
+// ----------------------------------------------------------------
+
+static bool
+serialize_untagged_u8(unsigned int i, std::streambuf &sb)
+{
+ return sb.sputc((i >> 0) & 0xff) != std::streambuf::traits_type::eof();
+}
+
+// always writes big-endian
+static bool
+serialize_untagged_u16(unsigned int i, std::streambuf &sb)
+{
+ sb.sputc((i >> 8) & 0xff);
+ return sb.sputc((i >> 0) & 0xff) != std::streambuf::traits_type::eof();
+}
+
+// always writes big-endian
+static bool
+serialize_untagged_u32(unsigned int i, std::streambuf &sb)
+{
+ sb.sputc((i >> 24) & 0xff);
+ sb.sputc((i >> 16) & 0xff);
+ sb.sputc((i >> 8) & 0xff);
+ return sb.sputc((i >> 0) & 0xff) != std::streambuf::traits_type::eof();
+}
+
+static bool
+serialize_untagged_f64(double i, std::streambuf &sb)
+{
+ typedef union {
+ double id;
+ uint64_t ii;
+ } iu_t;
+ iu_t iu;
+ iu.id = i;
+ sb.sputc((iu.ii >> 56) & 0xff);
+ sb.sputc((iu.ii >> 48) & 0xff);
+ sb.sputc((iu.ii >> 40) & 0xff);
+ sb.sputc((iu.ii >> 32) & 0xff);
+ sb.sputc((iu.ii >> 24) & 0xff);
+ sb.sputc((iu.ii >> 16) & 0xff);
+ sb.sputc((iu.ii >> 8) & 0xff);
+ return sb.sputc((iu.ii >> 0) & 0xff) != std::streambuf::traits_type::eof();
+}
+
+
+// always writes big-endian
+static bool
+serialize_untagged_u64(uint64_t i, std::streambuf &sb)
+{
+ sb.sputc((i >> 56) & 0xff);
+ sb.sputc((i >> 48) & 0xff);
+ sb.sputc((i >> 40) & 0xff);
+ sb.sputc((i >> 32) & 0xff);
+ sb.sputc((i >> 24) & 0xff);
+ sb.sputc((i >> 16) & 0xff);
+ sb.sputc((i >> 8) & 0xff);
+ return sb.sputc((i >> 0) & 0xff) != std::streambuf::traits_type::eof();
+}
+
+// ----------------------------------------------------------------
+// input primitives
+// ----------------------------------------------------------------
+
+
+// always reads big-endian
+static bool
+deserialize_untagged_u8(uint8_t *ip, std::streambuf &sb)
+{
+ std::streambuf::traits_type::int_type t;
+ int i;
+
+ t = sb.sbumpc();
+ i = t & 0xff;
+
+ *ip = i;
+ return t != std::streambuf::traits_type::eof();
+}
+
+// always reads big-endian
+static bool
+deserialize_untagged_u16(uint16_t *ip, std::streambuf &sb)
+{
+ std::streambuf::traits_type::int_type t;
+ int i;
+
+ t = sb.sbumpc();
+ i = t & 0xff;
+
+ t = sb.sbumpc();
+ i = (i << 8) | (t & 0xff);
+
+ *ip = i;
+ return t != std::streambuf::traits_type::eof();
+}
+
+// always reads big-endian
+static bool
+deserialize_untagged_u32(uint32_t *ip, std::streambuf &sb)
+{
+ std::streambuf::traits_type::int_type t;
+ int i;
+
+ t = sb.sbumpc();
+ i = t & 0xff;
+
+ t = sb.sbumpc();
+ i = (i << 8) | (t & 0xff);
+ t = sb.sbumpc();
+ i = (i << 8) | (t & 0xff);
+ t = sb.sbumpc();
+ i = (i << 8) | (t & 0xff);
+
+ *ip = i;
+ return t != std::streambuf::traits_type::eof();
+}
+
+// always reads big-endian
+static bool
+deserialize_untagged_u64(uint64_t *ip, std::streambuf &sb)
+{
+ std::streambuf::traits_type::int_type t;
+ uint64_t i;
+
+ t = sb.sbumpc();
+ i = t & 0xff;
+
+ t = sb.sbumpc();
+ i = (i << 8) | (t & 0xff);
+ t = sb.sbumpc();
+ i = (i << 8) | (t & 0xff);
+ t = sb.sbumpc();
+ i = (i << 8) | (t & 0xff);
+ t = sb.sbumpc();
+ i = (i << 8) | (t & 0xff);
+ t = sb.sbumpc();
+ i = (i << 8) | (t & 0xff);
+ t = sb.sbumpc();
+ i = (i << 8) | (t & 0xff);
+ t = sb.sbumpc();
+ i = (i << 8) | (t & 0xff);
+
+ *ip = i;
+ return t != std::streambuf::traits_type::eof();
+}
+
+static bool
+deserialize_untagged_f64(double *ip, std::streambuf &sb)
+{
+ std::streambuf::traits_type::int_type t;
+
+ typedef union {
+ double id;
+ uint64_t ii;
+ } iu_t;
+
+ iu_t iu;
+
+ t = sb.sbumpc();
+ iu.ii = t & 0xff;
+
+ t = sb.sbumpc();
+ iu.ii = (iu.ii<<8) | (t & 0xff);
+ t = sb.sbumpc();
+ iu.ii = (iu.ii<<8) | (t & 0xff);
+ t = sb.sbumpc();
+ iu.ii = (iu.ii<<8) | (t & 0xff);
+ t = sb.sbumpc();
+ iu.ii = (iu.ii<<8) | (t & 0xff);
+ t = sb.sbumpc();
+ iu.ii = (iu.ii<<8) | (t & 0xff);
+ t = sb.sbumpc();
+ iu.ii = (iu.ii<<8) | (t & 0xff);
+ t = sb.sbumpc();
+ iu.ii = (iu.ii<<8) | (t & 0xff);
+
+ *ip = iu.id;
+ return t != std::streambuf::traits_type::eof();
+}
+
+static bool
+deserialize_tuple(pmt_t *tuple, std::streambuf &sb)
+{
+ uint32_t nitems;
+ bool ok = deserialize_untagged_u32(&nitems, sb);
+ pmt_t list(PMT_NIL);
+ for(uint32_t i=0; i<nitems; i++){
+ pmt_t item = pmt_deserialize( sb );
+ if(pmt_eq(list, PMT_NIL)){
+ list = pmt_list1(item);
+ } else {
+ list = pmt_list_add(list, item);
+ }
+ }
+ (*tuple) = pmt_to_tuple(list);
+ return ok;
+}
+
+
+/*
+ * Write portable byte-serial representation of \p obj to \p sb
+ *
+ * N.B., Circular structures cause infinite recursion.
+ */
+bool
+pmt_serialize(pmt_t obj, std::streambuf &sb)
+{
+ bool ok = true;
+
+ tail_recursion:
+
+ if (pmt_is_bool(obj)){
+ if (pmt_eq(obj, PMT_T))
+ return serialize_untagged_u8(PST_TRUE, sb);
+ else
+ return serialize_untagged_u8(PST_FALSE, sb);
+ }
+
+ if (pmt_is_null(obj))
+ return serialize_untagged_u8(PST_NULL, sb);
+
+ if (pmt_is_symbol(obj)){
+ const std::string s = pmt_symbol_to_string(obj);
+ size_t len = s.size();
+ ok = serialize_untagged_u8(PST_SYMBOL, sb);
+ ok &= serialize_untagged_u16(len, sb);
+ for (size_t i = 0; i < len; i++)
+ ok &= serialize_untagged_u8(s[i], sb);
+ return ok;
+ }
+
+ if (pmt_is_pair(obj)){
+ ok = serialize_untagged_u8(PST_PAIR, sb);
+ ok &= pmt_serialize(pmt_car(obj), sb);
+ if (!ok)
+ return false;
+ obj = pmt_cdr(obj);
+ goto tail_recursion;
+ }
+
+ if (pmt_is_number(obj)){
+
+ if (pmt_is_uint64(obj)){
+ uint64_t i = pmt_to_uint64(obj);
+ ok = serialize_untagged_u8(PST_UINT64, sb);
+ ok &= serialize_untagged_u64(i, sb);
+ return ok;
+ } else
+ if (pmt_is_integer(obj)){
+ long i = pmt_to_long(obj);
+ if (sizeof(long) > 4){
+ if (i < -2147483647 || i > 2147483647)
+ throw pmt_notimplemented("pmt_serialize (64-bit integers)", obj);
+ }
+ ok = serialize_untagged_u8(PST_INT32, sb);
+ ok &= serialize_untagged_u32(i, sb);
+ return ok;
+ }
+
+ if (pmt_is_real(obj)){
+ float i = pmt_to_double(obj);
+ ok = serialize_untagged_u8(PST_DOUBLE, sb);
+ ok &= serialize_untagged_f64(i, sb);
+ return ok;
+ }
+
+ if (pmt_is_complex(obj)){
+ std::complex<double> i = pmt_to_complex(obj);
+ ok = serialize_untagged_u8(PST_COMPLEX, sb);
+ ok &= serialize_untagged_f64(i.real(), sb);
+ ok &= serialize_untagged_f64(i.imag(), sb);
+ return ok;
+ }
+
+ }
+
+ if (pmt_is_vector(obj)) {
+ size_t vec_len = pmt::pmt_length(obj);
+ ok = serialize_untagged_u8(PST_VECTOR, sb);
+ ok &= serialize_untagged_u32(vec_len, sb);
+ for(size_t i=0; i<vec_len; i++) {
+ ok &= pmt_serialize(pmt_vector_ref(obj, i), sb);
+ }
+ return ok;
+ }
+
+ if (pmt_is_uniform_vector(obj)) {
+ size_t npad = 1;
+ size_t vec_len = pmt::pmt_length(obj);
+
+ if(pmt_is_u8vector(obj)) {
+ ok = serialize_untagged_u8(PST_UNIFORM_VECTOR, sb);
+ ok &= serialize_untagged_u8(UVI_U8, sb);
+ ok &= serialize_untagged_u32(vec_len, sb);
+ ok &= serialize_untagged_u8(npad, sb);
+ for(size_t i=0; i<npad; i++) {
+ ok &= serialize_untagged_u8(0, sb);
+ }
+ for(size_t i=0; i<vec_len; i++) {
+ ok &= serialize_untagged_u8(pmt_u8vector_ref(obj, i), sb);
+ }
+ return ok;
+ }
+
+ if(pmt_is_s8vector(obj)) {
+ ok = serialize_untagged_u8(PST_UNIFORM_VECTOR, sb);
+ ok &= serialize_untagged_u8(UVI_S8, sb);
+ ok &= serialize_untagged_u32(vec_len, sb);
+ ok &= serialize_untagged_u8(npad, sb);
+ for(size_t i=0; i<npad; i++) {
+ ok &= serialize_untagged_u8(0, sb);
+ }
+ for(size_t i=0; i<vec_len; i++) {
+ ok &= serialize_untagged_u8(pmt_s8vector_ref(obj, i), sb);
+ }
+ return ok;
+ }
+
+ if(pmt_is_u16vector(obj)) {
+ ok = serialize_untagged_u8(PST_UNIFORM_VECTOR, sb);
+ ok &= serialize_untagged_u8(UVI_U16, sb);
+ ok &= serialize_untagged_u32(vec_len, sb);
+ ok &= serialize_untagged_u8(npad, sb);
+ for(size_t i=0; i<npad; i++) {
+ ok &= serialize_untagged_u8(0, sb);
+ }
+ for(size_t i=0; i<vec_len; i++) {
+ ok &= serialize_untagged_u16(pmt_u16vector_ref(obj, i), sb);
+ }
+ return ok;
+ }
+
+ if(pmt_is_s16vector(obj)) {
+ ok = serialize_untagged_u8(PST_UNIFORM_VECTOR, sb);
+ ok &= serialize_untagged_u8(UVI_S16, sb);
+ ok &= serialize_untagged_u32(vec_len, sb);
+ ok &= serialize_untagged_u8(npad, sb);
+ for(size_t i=0; i<npad; i++) {
+ ok &= serialize_untagged_u8(0, sb);
+ }
+ for(size_t i=0; i<vec_len; i++) {
+ ok &= serialize_untagged_u16(pmt_s16vector_ref(obj, i), sb);
+ }
+ return ok;
+ }
+
+ if(pmt_is_u32vector(obj)) {
+ ok = serialize_untagged_u8(PST_UNIFORM_VECTOR, sb);
+ ok &= serialize_untagged_u8(UVI_U32, sb);
+ ok &= serialize_untagged_u32(vec_len, sb);
+ ok &= serialize_untagged_u8(npad, sb);
+ for(size_t i=0; i<npad; i++) {
+ ok &= serialize_untagged_u8(0, sb);
+ }
+ for(size_t i=0; i<vec_len; i++) {
+ ok &= serialize_untagged_u32(pmt_u32vector_ref(obj, i), sb);
+ }
+ return ok;
+ }
+
+ if(pmt_is_s32vector(obj)) {
+ ok = serialize_untagged_u8(PST_UNIFORM_VECTOR, sb);
+ ok &= serialize_untagged_u8(UVI_S32, sb);
+ ok &= serialize_untagged_u32(vec_len, sb);
+ ok &= serialize_untagged_u8(npad, sb);
+ for(size_t i=0; i<npad; i++) {
+ ok &= serialize_untagged_u8(0, sb);
+ }
+ for(size_t i=0; i<vec_len; i++) {
+ ok &= serialize_untagged_u32(pmt_s32vector_ref(obj, i), sb);
+ }
+ return ok;
+ }
+
+ if(pmt_is_u64vector(obj)) {
+ ok = serialize_untagged_u8(PST_UNIFORM_VECTOR, sb);
+ ok &= serialize_untagged_u8(UVI_U64, sb);
+ ok &= serialize_untagged_u32(vec_len, sb);
+ ok &= serialize_untagged_u8(npad, sb);
+ for(size_t i=0; i<npad; i++) {
+ ok &= serialize_untagged_u8(0, sb);
+ }
+ for(size_t i=0; i<vec_len; i++) {
+ ok &= serialize_untagged_u64(pmt_u64vector_ref(obj, i), sb);
+ }
+ return ok;
+ }
+
+ if(pmt_is_s64vector(obj)) {
+ ok = serialize_untagged_u8(PST_UNIFORM_VECTOR, sb);
+ ok &= serialize_untagged_u8(UVI_S64, sb);
+ ok &= serialize_untagged_u32(vec_len, sb);
+ ok &= serialize_untagged_u8(npad, sb);
+ for(size_t i=0; i<npad; i++) {
+ ok &= serialize_untagged_u8(0, sb);
+ }
+ for(size_t i=0; i<vec_len; i++) {
+ ok &= serialize_untagged_u64(pmt_s64vector_ref(obj, i), sb);
+ }
+ return ok;
+ }
+
+ if(pmt_is_f32vector(obj)) {
+ ok = serialize_untagged_u8(PST_UNIFORM_VECTOR, sb);
+ ok &= serialize_untagged_u8(UVI_F32, sb);
+ ok &= serialize_untagged_u32(vec_len, sb);
+ ok &= serialize_untagged_u8(npad, sb);
+ for(size_t i=0; i<npad; i++) {
+ ok &= serialize_untagged_u8(0, sb);
+ }
+ for(size_t i=0; i<vec_len; i++) {
+ ok &= serialize_untagged_f64(pmt_f32vector_ref(obj, i), sb);
+ }
+ return ok;
+ }
+
+ if(pmt_is_f64vector(obj)) {
+ ok = serialize_untagged_u8(PST_UNIFORM_VECTOR, sb);
+ ok &= serialize_untagged_u8(UVI_F64, sb);
+ ok &= serialize_untagged_u32(vec_len, sb);
+ ok &= serialize_untagged_u8(npad, sb);
+ for(size_t i=0; i<npad; i++) {
+ ok &= serialize_untagged_u8(0, sb);
+ }
+ for(size_t i=0; i<vec_len; i++) {
+ ok &= serialize_untagged_f64(pmt_f64vector_ref(obj, i), sb);
+ }
+ return ok;
+ }
+
+ if(pmt_is_c32vector(obj)) {
+ ok = serialize_untagged_u8(PST_UNIFORM_VECTOR, sb);
+ ok &= serialize_untagged_u8(UVI_C32, sb);
+ ok &= serialize_untagged_u32(vec_len, sb);
+ ok &= serialize_untagged_u8(npad, sb);
+ for(size_t i=0; i<npad; i++) {
+ ok &= serialize_untagged_u8(0, sb);
+ }
+ for(size_t i=0; i<vec_len; i++) {
+ std::complex<float> c = pmt_c32vector_ref(obj, i);
+ ok &= serialize_untagged_f64(c.real(), sb);
+ ok &= serialize_untagged_f64(c.imag(), sb);
+ }
+ return ok;
+ }
+
+ if(pmt_is_c64vector(obj)) {
+ ok = serialize_untagged_u8(PST_UNIFORM_VECTOR, sb);
+ ok &= serialize_untagged_u8(UVI_C64, sb);
+ ok &= serialize_untagged_u32(vec_len, sb);
+ ok &= serialize_untagged_u8(npad, sb);
+ for(size_t i=0; i<npad; i++) {
+ ok &= serialize_untagged_u8(0, sb);
+ }
+ for(size_t i=0; i<vec_len; i++) {
+ std::complex<double> c = pmt_c64vector_ref(obj, i);
+ ok &= serialize_untagged_f64(c.real(), sb);
+ ok &= serialize_untagged_f64(c.imag(), sb);
+ }
+ return ok;
+ }
+ }
+
+ if (pmt_is_dict(obj))
+ throw pmt_notimplemented("pmt_serialize (dict)", obj);
+
+ if (pmt_is_tuple(obj)){
+ size_t tuple_len = pmt::pmt_length(obj);
+ ok = serialize_untagged_u8(PST_TUPLE, sb);
+ ok &= serialize_untagged_u32(tuple_len, sb);
+ for(size_t i=0; i<tuple_len; i++){
+ ok &= pmt_serialize(pmt_tuple_ref(obj, i), sb);
+ }
+ return ok;
+ }
+ //throw pmt_notimplemented("pmt_serialize (tuple)", obj);
+
+ throw pmt_notimplemented("pmt_serialize (?)", obj);
+}
+
+/*
+ * Create obj from portable byte-serial representation
+ *
+ * Returns next obj from streambuf, or PMT_EOF at end of file.
+ * Throws exception on malformed input.
+ */
+pmt_t
+pmt_deserialize(std::streambuf &sb)
+{
+ uint8_t tag;
+ uint8_t u8;
+ uint16_t u16;
+ uint32_t u32;
+ uint64_t u64;
+ double f64;
+ static char tmpbuf[1024];
+
+ if (!deserialize_untagged_u8(&tag, sb))
+ return PMT_EOF;
+
+ switch (tag){
+ case PST_TRUE:
+ return PMT_T;
+
+ case PST_FALSE:
+ return PMT_F;
+
+ case PST_NULL:
+ return PMT_NIL;
+
+ case PST_SYMBOL:
+ if (!deserialize_untagged_u16(&u16, sb))
+ goto error;
+ if (u16 > sizeof(tmpbuf))
+ throw pmt_notimplemented("pmt_deserialize: very long symbol",
+ PMT_F);
+ if (sb.sgetn(tmpbuf, u16) != u16)
+ goto error;
+ return pmt_intern(std::string(tmpbuf, u16));
+
+ case PST_INT32:
+ if (!deserialize_untagged_u32(&u32, sb))
+ goto error;
+ return pmt_from_long((int32_t) u32);
+
+ case PST_UINT64:
+ if(!deserialize_untagged_u64(&u64, sb))
+ goto error;
+ return pmt_from_uint64(u64);
+
+ case PST_PAIR:
+ return parse_pair(sb);
+
+ case PST_DOUBLE:
+ if(!deserialize_untagged_f64(&f64, sb))
+ goto error;
+ return pmt_from_double( f64 );
+
+ case PST_COMPLEX:
+ {
+ double r,i;
+ if(!deserialize_untagged_f64(&r, sb) && !deserialize_untagged_f64(&i, sb))
+ goto error;
+ return pmt_make_rectangular( r,i );
+ }
+
+ case PST_TUPLE:
+ {
+ pmt_t tuple;
+ if(!deserialize_tuple(&tuple, sb)){
+ goto error;
+ }
+ return tuple;
+ }
+
+ case PST_VECTOR:
+ {
+ uint32_t nitems;
+ if(!deserialize_untagged_u32(&nitems, sb))
+ goto error;
+ pmt_t vec = pmt_make_vector(nitems, PMT_NIL);
+ for(uint32_t i=0; i<nitems; i++) {
+ pmt_t item = pmt_deserialize(sb);
+ pmt_vector_set(vec, i, item);
+ }
+ return vec;
+ }
+
+ case PST_UNIFORM_VECTOR:
+ {
+ uint8_t utag, npad;
+ uint32_t nitems;
+
+ if(!deserialize_untagged_u8(&utag, sb))
+ return PMT_EOF;
+
+ if(!deserialize_untagged_u32(&nitems, sb))
+ goto error;
+
+ deserialize_untagged_u8(&npad, sb);
+ for(size_t i; i < npad; i++)
+ deserialize_untagged_u8(&u8, sb);
+
+ switch(utag) {
+ case(UVI_U8):
+ {
+ pmt_t vec = pmt_make_u8vector(nitems, 0);
+ for(uint32_t i=0; i<nitems; i++) {
+ deserialize_untagged_u8(&u8, sb);
+ pmt_u8vector_set(vec, i, u8);
+ }
+ return vec;
+ }
+ case(UVI_S8):
+ {
+ pmt_t vec = pmt_make_s8vector(nitems, 0);
+ for(uint32_t i=0; i<nitems; i++) {
+ deserialize_untagged_u8(&u8, sb);
+ pmt_s8vector_set(vec, i, u8);
+ }
+ return vec;
+ }
+ case(UVI_U16):
+ {
+ pmt_t vec = pmt_make_u16vector(nitems, 0);
+ for(uint32_t i=0; i<nitems; i++) {
+ deserialize_untagged_u16(&u16, sb);
+ pmt_u16vector_set(vec, i, u16);
+ }
+ return vec;
+ }
+ case(UVI_S16):
+ {
+ pmt_t vec = pmt_make_s16vector(nitems, 0);
+ for(uint32_t i=0; i<nitems; i++) {
+ deserialize_untagged_u16(&u16, sb);
+ pmt_s16vector_set(vec, i, u16);
+ }
+ return vec;
+ }
+ case(UVI_U32):
+ {
+ pmt_t vec = pmt_make_u32vector(nitems, 0);
+ for(uint32_t i=0; i<nitems; i++) {
+ deserialize_untagged_u32(&u32, sb);
+ pmt_u32vector_set(vec, i, u32);
+ }
+ return vec;
+ }
+ case(UVI_S32):
+ {
+ pmt_t vec = pmt_make_s32vector(nitems, 0);
+ for(uint32_t i=0; i<nitems; i++) {
+ deserialize_untagged_u32(&u32, sb);
+ pmt_s32vector_set(vec, i, u32);
+ }
+ return vec;
+ }
+ case(UVI_U64):
+ {
+ pmt_t vec = pmt_make_u64vector(nitems, 0);
+ for(uint32_t i=0; i<nitems; i++) {
+ deserialize_untagged_u64(&u64, sb);
+ pmt_u64vector_set(vec, i, u64);
+ }
+ return vec;
+ }
+ case(UVI_S64):
+ {
+ pmt_t vec = pmt_make_s64vector(nitems, 0);
+ for(uint32_t i=0; i<nitems; i++) {
+ deserialize_untagged_u64(&u64, sb);
+ pmt_s64vector_set(vec, i, u64);
+ }
+ return vec;
+ }
+ case(UVI_F32):
+ {
+ pmt_t vec = pmt_make_f32vector(nitems, 0);
+ for(uint32_t i=0; i<nitems; i++) {
+ deserialize_untagged_f64(&f64, sb);
+ pmt_f32vector_set(vec, i, static_cast<float>(f64));
+ }
+ return vec;
+ }
+ case(UVI_F64):
+ {
+ pmt_t vec = pmt_make_f64vector(nitems, 0);
+ for(uint32_t i=0; i<nitems; i++) {
+ deserialize_untagged_f64(&f64, sb);
+ pmt_f64vector_set(vec, i, f64);
+ }
+ return vec;
+ }
+ case(UVI_C32):
+ {
+ pmt_t vec = pmt_make_c32vector(nitems, 0);
+ for(uint32_t i=0; i<nitems; i++) {
+ float re, im;
+ deserialize_untagged_f64(&f64, sb);
+ re = static_cast<float>(f64);
+ deserialize_untagged_f64(&f64, sb);
+ im = static_cast<float>(f64);
+ pmt_c32vector_set(vec, i, std::complex<float>(re, im));
+ }
+ return vec;
+ }
+
+ case(UVI_C64):
+ {
+ pmt_t vec = pmt_make_c64vector(nitems, 0);
+ for(uint32_t i=0; i<nitems; i++) {
+ double re, im;
+ deserialize_untagged_f64(&f64, sb);
+ re = f64;
+ deserialize_untagged_f64(&f64, sb);
+ im = f64;
+ pmt_c64vector_set(vec, i, std::complex<double>(re, im));
+ }
+ return vec;
+ }
+
+ default:
+ throw pmt_exception("pmt_deserialize: malformed input stream, tag value = ",
+ pmt_from_long(tag));
+ }
+ }
+
+ case PST_DICT:
+ case PST_COMMENT:
+ throw pmt_notimplemented("pmt_deserialize: tag value = ",
+ pmt_from_long(tag));
+
+ default:
+ throw pmt_exception("pmt_deserialize: malformed input stream, tag value = ",
+ pmt_from_long(tag));
+ }
+
+ error:
+ throw pmt_exception("pmt_deserialize: malformed input stream", PMT_F);
+}
+
+
+/*
+ * provide a simple string accessor to the serialized pmt form
+ */
+std::string pmt_serialize_str(pmt_t obj){
+ std::stringbuf sb;
+ pmt_serialize(obj, sb);
+ return sb.str();
+}
+
+
+/*
+ * provide a simple string accessor to the deserialized pmt form
+ */
+pmt_t pmt_deserialize_str(std::string s){
+ std::stringbuf sb(s);
+ return pmt_deserialize(sb);
+}
+
+
+/*
+ * This is a mostly non-recursive implementation that allows us to
+ * deserialize very long lists w/o exhausting the evaluation stack.
+ *
+ * On entry we've already eaten the PST_PAIR tag.
+ */
+pmt_t
+parse_pair(std::streambuf &sb)
+{
+ uint8_t tag;
+ pmt_t val, expr, lastnptr, nptr;
+
+ //
+ // Keep appending nodes until we get a non-PAIR cdr.
+ //
+ lastnptr = PMT_NIL;
+ while (1){
+ expr = pmt_deserialize(sb); // read the car
+
+ nptr = pmt_cons(expr, PMT_NIL); // build new cell
+ if (pmt_is_null(lastnptr))
+ val = nptr;
+ else
+ pmt_set_cdr(lastnptr, nptr);
+ lastnptr = nptr;
+
+ if (!deserialize_untagged_u8(&tag, sb)) // get tag of cdr
+ throw pmt_exception("pmt_deserialize: malformed input stream", PMT_F);
+
+ if (tag == PST_PAIR)
+ continue; // keep on looping...
+
+ if (tag == PST_NULL){
+ expr = PMT_NIL;
+ break;
+ }
+
+ //
+ // default: push tag back and use pmt_deserialize to get the cdr
+ //
+ sb.sungetc();
+ expr = pmt_deserialize(sb);
+ break;
+ }
+
+ //
+ // At this point, expr contains the value of the final cdr in the list.
+ //
+ pmt_set_cdr(lastnptr, expr);
+ return val;
+}
+
+} /* namespace pmt */
diff --git a/gruel/src/lib/pmt/qa_pmt.cc b/gruel/src/lib/pmt/qa_pmt.cc
new file mode 100644
index 000000000..27c617e74
--- /dev/null
+++ b/gruel/src/lib/pmt/qa_pmt.cc
@@ -0,0 +1,40 @@
+/*
+ * 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.
+ */
+
+/*
+ * This class gathers together all the test cases for pmt into
+ * a single test suite. As you create new test cases, add them here.
+ */
+
+#include <qa_pmt.h>
+#include <qa_pmt_prims.h>
+#include <qa_pmt_unv.h>
+
+CppUnit::TestSuite *
+qa_pmt::suite ()
+{
+ CppUnit::TestSuite *s = new CppUnit::TestSuite ("pmt");
+
+ s->addTest (qa_pmt_prims::suite ());
+ s->addTest (qa_pmt_unv::suite ());
+
+ return s;
+}
diff --git a/gruel/src/lib/pmt/qa_pmt.h b/gruel/src/lib/pmt/qa_pmt.h
new file mode 100644
index 000000000..3de5872c7
--- /dev/null
+++ b/gruel/src/lib/pmt/qa_pmt.h
@@ -0,0 +1,37 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_QA_PMT_H
+#define INCLUDED_QA_PMT_H
+
+#include <gruel/attributes.h>
+#include <cppunit/TestSuite.h>
+
+//! collect all the tests for pmt
+
+class __GR_ATTR_EXPORT qa_pmt {
+ public:
+ //! return suite of tests for all of pmt
+ static CppUnit::TestSuite *suite ();
+};
+
+#endif /* INCLUDED_QA_PMT_H */
diff --git a/gruel/src/lib/pmt/qa_pmt_prims.cc b/gruel/src/lib/pmt/qa_pmt_prims.cc
new file mode 100644
index 000000000..3ae4d70b6
--- /dev/null
+++ b/gruel/src/lib/pmt/qa_pmt_prims.cc
@@ -0,0 +1,603 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006,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.
+ */
+
+#include <qa_pmt_prims.h>
+#include <cppunit/TestAssert.h>
+#include <gruel/msg_passing.h>
+#include <boost/format.hpp>
+#include <cstdio>
+#include <cstring>
+#include <sstream>
+
+using namespace pmt;
+
+void
+qa_pmt_prims::test_symbols()
+{
+ CPPUNIT_ASSERT(!pmt_is_symbol(PMT_T));
+ CPPUNIT_ASSERT(!pmt_is_symbol(PMT_F));
+ CPPUNIT_ASSERT_THROW(pmt_symbol_to_string(PMT_F), pmt_wrong_type);
+
+ pmt_t sym1 = mp("test");
+ CPPUNIT_ASSERT(pmt_is_symbol(sym1));
+ CPPUNIT_ASSERT_EQUAL(std::string("test"), pmt_symbol_to_string(sym1));
+ CPPUNIT_ASSERT(pmt_is_true(sym1));
+ CPPUNIT_ASSERT(!pmt_is_false(sym1));
+
+ pmt_t sym2 = mp("foo");
+ pmt_t sym3 = mp("test");
+ CPPUNIT_ASSERT_EQUAL(sym1, sym3);
+ CPPUNIT_ASSERT(sym1 != sym2);
+ CPPUNIT_ASSERT(sym1 == sym3);
+
+ static const int N = 2048;
+ std::vector<pmt_t> v1(N);
+ std::vector<pmt_t> v2(N);
+
+ // generate a bunch of symbols
+ for (int i = 0; i < N; i++){
+ std::string buf = str(boost::format("test-%d") % i);
+ v1[i] = mp(buf.c_str());
+ }
+
+ // confirm that they are all unique
+ for (int i = 0; i < N; i++)
+ for (int j = i + 1; j < N; j++)
+ CPPUNIT_ASSERT(v1[i] != v1[j]);
+
+ // generate the same symbols again
+ for (int i = 0; i < N; i++){
+ std::string buf = str(boost::format("test-%d") % i);
+ v2[i] = mp(buf.c_str());
+ }
+
+ // confirm that we get the same ones back
+ for (int i = 0; i < N; i++)
+ CPPUNIT_ASSERT(v1[i] == v2[i]);
+}
+
+void
+qa_pmt_prims::test_booleans()
+{
+ pmt_t sym = mp("test");
+ CPPUNIT_ASSERT(pmt_is_bool(PMT_T));
+ CPPUNIT_ASSERT(pmt_is_bool(PMT_F));
+ CPPUNIT_ASSERT(!pmt_is_bool(sym));
+ CPPUNIT_ASSERT_EQUAL(pmt_from_bool(false), PMT_F);
+ CPPUNIT_ASSERT_EQUAL(pmt_from_bool(true), PMT_T);
+ CPPUNIT_ASSERT_EQUAL(false, pmt_to_bool(PMT_F));
+ CPPUNIT_ASSERT_EQUAL(true, pmt_to_bool(PMT_T));
+ CPPUNIT_ASSERT_THROW(pmt_to_bool(sym), pmt_wrong_type);
+}
+
+void
+qa_pmt_prims::test_integers()
+{
+ pmt_t p1 = pmt_from_long(1);
+ pmt_t m1 = pmt_from_long(-1);
+ CPPUNIT_ASSERT(!pmt_is_integer(PMT_T));
+ CPPUNIT_ASSERT(pmt_is_integer(p1));
+ CPPUNIT_ASSERT(pmt_is_integer(m1));
+ CPPUNIT_ASSERT_THROW(pmt_to_long(PMT_T), pmt_wrong_type);
+ CPPUNIT_ASSERT_EQUAL(-1L, pmt_to_long(m1));
+ CPPUNIT_ASSERT_EQUAL(1L, pmt_to_long(p1));
+}
+
+void
+qa_pmt_prims::test_uint64s()
+{
+ pmt_t p1 = pmt_from_uint64((uint64_t)1);
+ pmt_t m1 = pmt_from_uint64((uint64_t)8589934592ULL);
+ CPPUNIT_ASSERT(!pmt_is_uint64(PMT_T));
+ CPPUNIT_ASSERT(pmt_is_uint64(p1));
+ CPPUNIT_ASSERT(pmt_is_uint64(m1));
+ CPPUNIT_ASSERT_THROW(pmt_to_uint64(PMT_T), pmt_wrong_type);
+ CPPUNIT_ASSERT_EQUAL((uint64_t)8589934592ULL, (uint64_t)pmt_to_uint64(m1));
+ CPPUNIT_ASSERT_EQUAL((uint64_t)1ULL, (uint64_t)pmt_to_uint64(p1));
+}
+
+void
+qa_pmt_prims::test_reals()
+{
+ pmt_t p1 = pmt_from_double(1);
+ pmt_t m1 = pmt_from_double(-1);
+ CPPUNIT_ASSERT(!pmt_is_real(PMT_T));
+ CPPUNIT_ASSERT(pmt_is_real(p1));
+ CPPUNIT_ASSERT(pmt_is_real(m1));
+ CPPUNIT_ASSERT_THROW(pmt_to_double(PMT_T), pmt_wrong_type);
+ CPPUNIT_ASSERT_EQUAL(-1.0, pmt_to_double(m1));
+ CPPUNIT_ASSERT_EQUAL(1.0, pmt_to_double(p1));
+ CPPUNIT_ASSERT_EQUAL(1.0, pmt_to_double(pmt_from_long(1)));
+}
+
+void
+qa_pmt_prims::test_complexes()
+{
+ pmt_t p1 = pmt_make_rectangular(2, -3);
+ pmt_t m1 = pmt_make_rectangular(-3, 2);
+ pmt_t p2 = pmt_from_complex(2, -3);
+ pmt_t m2 = pmt_from_complex(-3, 2);
+ pmt_t p3 = pmt_from_complex(std::complex<double>(2, -3));
+ pmt_t m3 = pmt_from_complex(std::complex<double>(-3, 2));
+ CPPUNIT_ASSERT(!pmt_is_complex(PMT_T));
+ CPPUNIT_ASSERT(pmt_is_complex(p1));
+ CPPUNIT_ASSERT(pmt_is_complex(m1));
+ CPPUNIT_ASSERT(pmt_is_complex(p2));
+ CPPUNIT_ASSERT(pmt_is_complex(m2));
+ CPPUNIT_ASSERT(pmt_is_complex(p3));
+ CPPUNIT_ASSERT(pmt_is_complex(m3));
+ CPPUNIT_ASSERT_THROW(pmt_to_complex(PMT_T), pmt_wrong_type);
+ CPPUNIT_ASSERT_EQUAL(std::complex<double>(2, -3), pmt_to_complex(p1));
+ CPPUNIT_ASSERT_EQUAL(std::complex<double>(-3, 2), pmt_to_complex(m1));
+ CPPUNIT_ASSERT_EQUAL(std::complex<double>(2, -3), pmt_to_complex(p2));
+ CPPUNIT_ASSERT_EQUAL(std::complex<double>(-3, 2), pmt_to_complex(m2));
+ CPPUNIT_ASSERT_EQUAL(std::complex<double>(2, -3), pmt_to_complex(p3));
+ CPPUNIT_ASSERT_EQUAL(std::complex<double>(-3, 2), pmt_to_complex(m3));
+ CPPUNIT_ASSERT_EQUAL(std::complex<double>(1.0, 0), pmt_to_complex(pmt_from_long(1)));
+ CPPUNIT_ASSERT_EQUAL(std::complex<double>(1.0, 0), pmt_to_complex(pmt_from_double(1.0)));
+}
+
+void
+qa_pmt_prims::test_pairs()
+{
+ CPPUNIT_ASSERT(pmt_is_null(PMT_NIL));
+ CPPUNIT_ASSERT(!pmt_is_pair(PMT_NIL));
+ pmt_t s1 = mp("s1");
+ pmt_t s2 = mp("s2");
+ pmt_t s3 = mp("s3");
+
+
+ CPPUNIT_ASSERT_EQUAL((size_t)0, pmt_length(PMT_NIL));
+ CPPUNIT_ASSERT_THROW(pmt_length(s1), pmt_wrong_type);
+ CPPUNIT_ASSERT_THROW(pmt_length(pmt_from_double(42)), pmt_wrong_type);
+
+ pmt_t c1 = pmt_cons(s1, PMT_NIL);
+ CPPUNIT_ASSERT(pmt_is_pair(c1));
+ CPPUNIT_ASSERT(!pmt_is_pair(s1));
+ CPPUNIT_ASSERT_EQUAL(s1, pmt_car(c1));
+ CPPUNIT_ASSERT_EQUAL(PMT_NIL, pmt_cdr(c1));
+ CPPUNIT_ASSERT_EQUAL((size_t) 1, pmt_length(c1));
+
+ pmt_t c3 = pmt_cons(s3, PMT_NIL);
+ pmt_t c2 = pmt_cons(s2, c3);
+ pmt_set_cdr(c1, c2);
+ CPPUNIT_ASSERT_EQUAL(c2, pmt_cdr(c1));
+ pmt_set_car(c1, s3);
+ CPPUNIT_ASSERT_EQUAL(s3, pmt_car(c1));
+ CPPUNIT_ASSERT_EQUAL((size_t)1, pmt_length(c3));
+ CPPUNIT_ASSERT_EQUAL((size_t)2, pmt_length(c2));
+
+ CPPUNIT_ASSERT_THROW(pmt_cdr(PMT_NIL), pmt_wrong_type);
+ CPPUNIT_ASSERT_THROW(pmt_car(PMT_NIL), pmt_wrong_type);
+ CPPUNIT_ASSERT_THROW(pmt_set_car(s1, PMT_NIL), pmt_wrong_type);
+ CPPUNIT_ASSERT_THROW(pmt_set_cdr(s1, PMT_NIL), pmt_wrong_type);
+}
+
+void
+qa_pmt_prims::test_vectors()
+{
+ static const size_t N = 3;
+ pmt_t v1 = pmt_make_vector(N, PMT_NIL);
+ CPPUNIT_ASSERT_EQUAL(N, pmt_length(v1));
+ pmt_t s0 = mp("s0");
+ pmt_t s1 = mp("s1");
+ pmt_t s2 = mp("s2");
+
+ pmt_vector_set(v1, 0, s0);
+ pmt_vector_set(v1, 1, s1);
+ pmt_vector_set(v1, 2, s2);
+
+ CPPUNIT_ASSERT_EQUAL(s0, pmt_vector_ref(v1, 0));
+ CPPUNIT_ASSERT_EQUAL(s1, pmt_vector_ref(v1, 1));
+ CPPUNIT_ASSERT_EQUAL(s2, pmt_vector_ref(v1, 2));
+
+ CPPUNIT_ASSERT_THROW(pmt_vector_ref(v1, N), pmt_out_of_range);
+ CPPUNIT_ASSERT_THROW(pmt_vector_set(v1, N, PMT_NIL), pmt_out_of_range);
+
+ pmt_vector_fill(v1, s0);
+ for (size_t i = 0; i < N; i++)
+ CPPUNIT_ASSERT_EQUAL(s0, pmt_vector_ref(v1, i));
+}
+
+static void
+check_tuple(size_t len, const std::vector<pmt_t> &s, pmt_t t)
+{
+ CPPUNIT_ASSERT_EQUAL(true, pmt_is_tuple(t));
+ CPPUNIT_ASSERT_EQUAL(len, pmt_length(t));
+
+ for (size_t i = 0; i < len; i++)
+ CPPUNIT_ASSERT_EQUAL(s[i], pmt_tuple_ref(t, i));
+
+}
+
+void
+qa_pmt_prims::test_tuples()
+{
+ pmt_t v = pmt_make_vector(10, PMT_NIL);
+ std::vector<pmt_t> s(10);
+ for (size_t i = 0; i < 10; i++){
+ std::ostringstream os;
+ os << "s" << i;
+ s[i] = mp(os.str());
+ pmt_vector_set(v, i, s[i]);
+ }
+
+
+ pmt_t t;
+
+ t = pmt_make_tuple();
+ check_tuple(0, s, t);
+
+ t = pmt_make_tuple(s[0]);
+ check_tuple(1, s, t);
+
+ CPPUNIT_ASSERT(pmt_is_vector(v));
+ CPPUNIT_ASSERT(!pmt_is_tuple(v));
+ CPPUNIT_ASSERT(pmt_is_tuple(t));
+ CPPUNIT_ASSERT(!pmt_is_vector(t));
+
+ t = pmt_make_tuple(s[0], s[1]);
+ check_tuple(2, s, t);
+
+ t = pmt_make_tuple(s[0], s[1], s[2]);
+ check_tuple(3, s, t);
+
+ t = pmt_make_tuple(s[0], s[1], s[2], s[3]);
+ check_tuple(4, s, t);
+
+ t = pmt_make_tuple(s[0], s[1], s[2], s[3], s[4]);
+ check_tuple(5, s, t);
+
+ t = pmt_make_tuple(s[0], s[1], s[2], s[3], s[4], s[5]);
+ check_tuple(6, s, t);
+
+ t = pmt_make_tuple(s[0], s[1], s[2], s[3], s[4], s[5], s[6]);
+ check_tuple(7, s, t);
+
+ t = pmt_make_tuple(s[0], s[1], s[2], s[3], s[4], s[5], s[6], s[7]);
+ check_tuple(8, s, t);
+
+ t = pmt_make_tuple(s[0], s[1], s[2], s[3], s[4], s[5], s[6], s[7], s[8]);
+ check_tuple(9, s, t);
+
+ t = pmt_make_tuple(s[0], s[1], s[2], s[3], s[4], s[5], s[6], s[7], s[8], s[9]);
+ check_tuple(10, s, t);
+
+ t = pmt_make_tuple(s[0], s[1], s[2]);
+ CPPUNIT_ASSERT_THROW(pmt_tuple_ref(t, 3), pmt_out_of_range);
+ CPPUNIT_ASSERT_THROW(pmt_vector_ref(t, 0), pmt_wrong_type);
+ CPPUNIT_ASSERT_THROW(pmt_tuple_ref(v, 0), pmt_wrong_type);
+
+ t = pmt_make_tuple(s[0], s[1], s[2], s[3], s[4], s[5], s[6], s[7], s[8], s[9]);
+ pmt_t t2 = pmt_to_tuple(v);
+ CPPUNIT_ASSERT_EQUAL(size_t(10), pmt_length(v));
+ CPPUNIT_ASSERT(pmt_equal(t, t2));
+ //std::cout << v << std::endl;
+ //std::cout << t2 << std::endl;
+
+
+ t = pmt_make_tuple(s[0], s[1], s[2]);
+ pmt_t list0 = pmt_list3(s[0], s[1], s[2]);
+ CPPUNIT_ASSERT_EQUAL(size_t(3), pmt_length(list0));
+ t2 = pmt_to_tuple(list0);
+ CPPUNIT_ASSERT_EQUAL(size_t(3), pmt_length(t2));
+ CPPUNIT_ASSERT(pmt_equal(t, t2));
+}
+
+void
+qa_pmt_prims::test_equivalence()
+{
+ pmt_t s0 = mp("s0");
+ pmt_t s1 = mp("s1");
+ pmt_t s2 = mp("s2");
+ pmt_t list0 = pmt_cons(s0, pmt_cons(s1, pmt_cons(s2, PMT_NIL)));
+ pmt_t list1 = pmt_cons(s0, pmt_cons(s1, pmt_cons(s2, PMT_NIL)));
+ pmt_t i0 = pmt_from_long(42);
+ pmt_t i1 = pmt_from_long(42);
+ pmt_t r0 = pmt_from_double(42);
+ pmt_t r1 = pmt_from_double(42);
+ pmt_t r2 = pmt_from_double(43);
+
+ CPPUNIT_ASSERT(pmt_eq(s0, s0));
+ CPPUNIT_ASSERT(!pmt_eq(s0, s1));
+ CPPUNIT_ASSERT(pmt_eqv(s0, s0));
+ CPPUNIT_ASSERT(!pmt_eqv(s0, s1));
+
+ CPPUNIT_ASSERT(pmt_eqv(i0, i1));
+ CPPUNIT_ASSERT(pmt_eqv(r0, r1));
+ CPPUNIT_ASSERT(!pmt_eqv(r0, r2));
+ CPPUNIT_ASSERT(!pmt_eqv(i0, r0));
+
+ CPPUNIT_ASSERT(!pmt_eq(list0, list1));
+ CPPUNIT_ASSERT(!pmt_eqv(list0, list1));
+ CPPUNIT_ASSERT(pmt_equal(list0, list1));
+
+ pmt_t v0 = pmt_make_vector(3, s0);
+ pmt_t v1 = pmt_make_vector(3, s0);
+ pmt_t v2 = pmt_make_vector(4, s0);
+ CPPUNIT_ASSERT(!pmt_eqv(v0, v1));
+ CPPUNIT_ASSERT(pmt_equal(v0, v1));
+ CPPUNIT_ASSERT(!pmt_equal(v0, v2));
+
+ pmt_vector_set(v0, 0, list0);
+ pmt_vector_set(v0, 1, list0);
+ pmt_vector_set(v1, 0, list1);
+ pmt_vector_set(v1, 1, list1);
+ CPPUNIT_ASSERT(pmt_equal(v0, v1));
+}
+
+void
+qa_pmt_prims::test_misc()
+{
+ pmt_t k0 = mp("k0");
+ pmt_t k1 = mp("k1");
+ pmt_t k2 = mp("k2");
+ pmt_t k3 = mp("k3");
+ pmt_t v0 = mp("v0");
+ pmt_t v1 = mp("v1");
+ pmt_t v2 = mp("v2");
+ pmt_t p0 = pmt_cons(k0, v0);
+ pmt_t p1 = pmt_cons(k1, v1);
+ pmt_t p2 = pmt_cons(k2, v2);
+
+ pmt_t alist = pmt_cons(p0, pmt_cons(p1, pmt_cons(p2, PMT_NIL)));
+ CPPUNIT_ASSERT(pmt_eq(p1, pmt_assv(k1, alist)));
+ CPPUNIT_ASSERT(pmt_eq(PMT_F, pmt_assv(k3, alist)));
+
+ pmt_t keys = pmt_cons(k0, pmt_cons(k1, pmt_cons(k2, PMT_NIL)));
+ pmt_t vals = pmt_cons(v0, pmt_cons(v1, pmt_cons(v2, PMT_NIL)));
+ CPPUNIT_ASSERT(pmt_equal(keys, pmt_map(pmt_car, alist)));
+ CPPUNIT_ASSERT(pmt_equal(vals, pmt_map(pmt_cdr, alist)));
+}
+
+void
+qa_pmt_prims::test_dict()
+{
+ pmt_t dict = pmt_make_dict();
+ CPPUNIT_ASSERT(pmt_is_dict(dict));
+
+ pmt_t k0 = mp("k0");
+ pmt_t k1 = mp("k1");
+ pmt_t k2 = mp("k2");
+ pmt_t k3 = mp("k3");
+ pmt_t v0 = mp("v0");
+ pmt_t v1 = mp("v1");
+ pmt_t v2 = mp("v2");
+ pmt_t v3 = mp("v3");
+ pmt_t not_found = pmt_cons(PMT_NIL, PMT_NIL);
+
+ CPPUNIT_ASSERT(!pmt_dict_has_key(dict, k0));
+ dict = pmt_dict_add(dict, k0, v0);
+ CPPUNIT_ASSERT(pmt_dict_has_key(dict, k0));
+ CPPUNIT_ASSERT(pmt_eqv(pmt_dict_ref(dict, k0, not_found), v0));
+ CPPUNIT_ASSERT(pmt_eqv(pmt_dict_ref(dict, k1, not_found), not_found));
+ dict = pmt_dict_add(dict, k1, v1);
+ dict = pmt_dict_add(dict, k2, v2);
+ CPPUNIT_ASSERT(pmt_eqv(pmt_dict_ref(dict, k1, not_found), v1));
+ dict = pmt_dict_add(dict, k1, v3);
+ CPPUNIT_ASSERT(pmt_eqv(pmt_dict_ref(dict, k1, not_found), v3));
+
+ pmt_t keys = pmt_list3(k1, k2, k0);
+ pmt_t vals = pmt_list3(v3, v2, v0);
+ //std::cout << "pmt_dict_keys: " << pmt_dict_keys(dict) << std::endl;
+ //std::cout << "pmt_dict_values: " << pmt_dict_values(dict) << std::endl;
+ CPPUNIT_ASSERT(pmt_equal(keys, pmt_dict_keys(dict)));
+ CPPUNIT_ASSERT(pmt_equal(vals, pmt_dict_values(dict)));
+}
+
+void
+qa_pmt_prims::test_io()
+{
+ pmt_t k0 = mp("k0");
+ pmt_t k1 = mp("k1");
+ pmt_t k2 = mp("k2");
+ pmt_t k3 = mp("k3");
+
+ CPPUNIT_ASSERT_EQUAL(std::string("k0"), pmt_write_string(k0));
+}
+
+void
+qa_pmt_prims::test_lists()
+{
+ pmt_t s0 = mp("s0");
+ pmt_t s1 = mp("s1");
+ pmt_t s2 = mp("s2");
+ pmt_t s3 = mp("s3");
+
+ pmt_t l1 = pmt_list4(s0, s1, s2, s3);
+ pmt_t l2 = pmt_list3(s0, s1, s2);
+ pmt_t l3 = pmt_list_add(l2, s3);
+ CPPUNIT_ASSERT(pmt_equal(l1, l3));
+}
+
+// ------------------------------------------------------------------------
+
+// class foo is used in test_any below.
+// It can't be declared in the scope of test_any because of template
+// namespace problems.
+
+class foo {
+public:
+ double d_double;
+ int d_int;
+ foo(double d=0, int i=0) : d_double(d), d_int(i) {}
+};
+
+bool operator==(const foo &a, const foo &b)
+{
+ return a.d_double == b.d_double && a.d_int == b.d_int;
+}
+
+std::ostream& operator<<(std::ostream &os, const foo obj)
+{
+ os << "<foo: " << obj.d_double << ", " << obj.d_int << ">";
+ return os;
+}
+
+void
+qa_pmt_prims::test_any()
+{
+ boost::any a0;
+ boost::any a1;
+ boost::any a2;
+
+ a0 = std::string("Hello!");
+ a1 = 42;
+ a2 = foo(3.250, 21);
+
+ pmt_t p0 = pmt_make_any(a0);
+ pmt_t p1 = pmt_make_any(a1);
+ pmt_t p2 = pmt_make_any(a2);
+
+ CPPUNIT_ASSERT_EQUAL(std::string("Hello!"),
+ boost::any_cast<std::string>(pmt_any_ref(p0)));
+
+ CPPUNIT_ASSERT_EQUAL(42,
+ boost::any_cast<int>(pmt_any_ref(p1)));
+
+ CPPUNIT_ASSERT_EQUAL(foo(3.250, 21),
+ boost::any_cast<foo>(pmt_any_ref(p2)));
+}
+
+// ------------------------------------------------------------------------
+
+class qa_pmt_msg_accepter_nop : public gruel::msg_accepter {
+public:
+ qa_pmt_msg_accepter_nop(){};
+ ~qa_pmt_msg_accepter_nop();
+ void post(pmt_t,pmt_t){};
+};
+
+qa_pmt_msg_accepter_nop::~qa_pmt_msg_accepter_nop(){}
+
+void
+qa_pmt_prims::test_msg_accepter()
+{
+ pmt_t sym = mp("my-symbol");
+
+ boost::any a0;
+ a0 = std::string("Hello!");
+ pmt_t p0 = pmt_make_any(a0);
+
+ gruel::msg_accepter_sptr ma0 = gruel::msg_accepter_sptr(new qa_pmt_msg_accepter_nop());
+ pmt_t p1 = pmt_make_msg_accepter(ma0);
+
+ CPPUNIT_ASSERT_EQUAL(ma0.get(), pmt_msg_accepter_ref(p1).get());
+
+ CPPUNIT_ASSERT_THROW(pmt_msg_accepter_ref(sym), pmt_wrong_type);
+ CPPUNIT_ASSERT_THROW(pmt_msg_accepter_ref(p0), pmt_wrong_type);
+
+ // just confirm interfaces on send are OK
+ pmt_t port(pmt_intern("port"));
+ gruel::send(ma0.get(), port, sym);
+ gruel::send(ma0, port, sym);
+ gruel::send(p1, port, sym);
+
+}
+
+// ------------------------------------------------------------------------
+
+void
+qa_pmt_prims::test_serialize()
+{
+ std::stringbuf sb; // fake channel
+ pmt_t a = mp("a");
+ pmt_t b = mp("b");
+ pmt_t c = mp("c");
+
+ sb.str(""); // reset channel to empty
+
+ // write stuff to channel
+
+ pmt_serialize(PMT_NIL, sb);
+ pmt_serialize(mp("foobarvia"), sb);
+ pmt_serialize(pmt_from_long(123456789), sb);
+ pmt_serialize(pmt_from_long(-123456789), sb);
+ pmt_serialize(pmt_cons(PMT_NIL, PMT_NIL), sb);
+ pmt_serialize(pmt_cons(a, b), sb);
+ pmt_serialize(pmt_list1(a), sb);
+ pmt_serialize(pmt_list2(a, b), sb);
+ pmt_serialize(pmt_list3(a, b, c), sb);
+ pmt_serialize(pmt_list3(a, pmt_list3(c, b, a), c), sb);
+ pmt_serialize(PMT_T, sb);
+ pmt_serialize(PMT_F, sb);
+
+ // read it back
+
+ CPPUNIT_ASSERT(pmt_equal(pmt_deserialize(sb), PMT_NIL));
+ CPPUNIT_ASSERT(pmt_equal(pmt_deserialize(sb), mp("foobarvia")));
+ CPPUNIT_ASSERT(pmt_equal(pmt_deserialize(sb), pmt_from_long(123456789)));
+ CPPUNIT_ASSERT(pmt_equal(pmt_deserialize(sb), pmt_from_long(-123456789)));
+ CPPUNIT_ASSERT(pmt_equal(pmt_deserialize(sb), pmt_cons(PMT_NIL, PMT_NIL)));
+ CPPUNIT_ASSERT(pmt_equal(pmt_deserialize(sb), pmt_cons(a, b)));
+ CPPUNIT_ASSERT(pmt_equal(pmt_deserialize(sb), pmt_list1(a)));
+ CPPUNIT_ASSERT(pmt_equal(pmt_deserialize(sb), pmt_list2(a, b)));
+ CPPUNIT_ASSERT(pmt_equal(pmt_deserialize(sb), pmt_list3(a, b, c)));
+ CPPUNIT_ASSERT(pmt_equal(pmt_deserialize(sb), pmt_list3(a, pmt_list3(c, b, a), c)));
+ CPPUNIT_ASSERT(pmt_equal(pmt_deserialize(sb), PMT_T));
+ CPPUNIT_ASSERT(pmt_equal(pmt_deserialize(sb), PMT_F));
+
+ CPPUNIT_ASSERT(pmt_equal(pmt_deserialize(sb), PMT_EOF)); // last item
+
+
+ // FIXME add tests for real, complex, vector, uniform-vector, dict
+ // FIXME add tests for malformed input too.
+
+}
+
+void
+qa_pmt_prims::test_sets()
+{
+ pmt_t s1 = mp("s1");
+ pmt_t s2 = mp("s2");
+ pmt_t s3 = mp("s3");
+
+ pmt_t l1 = pmt_list1(s1);
+ pmt_t l2 = pmt_list2(s2,s3);
+ pmt_t l3 = pmt_list3(s1,s2,s3);
+
+ CPPUNIT_ASSERT(pmt_is_pair(pmt_memq(s1,l1)));
+ CPPUNIT_ASSERT(pmt_is_false(pmt_memq(s3,l1)));
+
+ CPPUNIT_ASSERT(pmt_subsetp(l1,l3));
+ CPPUNIT_ASSERT(pmt_subsetp(l2,l3));
+ CPPUNIT_ASSERT(!pmt_subsetp(l1,l2));
+ CPPUNIT_ASSERT(!pmt_subsetp(l2,l1));
+ CPPUNIT_ASSERT(!pmt_subsetp(l3,l2));
+}
+
+void
+qa_pmt_prims::test_sugar()
+{
+ CPPUNIT_ASSERT(pmt_is_symbol(mp("my-symbol")));
+ CPPUNIT_ASSERT_EQUAL((long) 10, pmt_to_long(mp(10)));
+ CPPUNIT_ASSERT_EQUAL((double) 1e6, pmt_to_double(mp(1e6)));
+ CPPUNIT_ASSERT_EQUAL(std::complex<double>(2, 3),
+ pmt_to_complex(mp(std::complex<double>(2, 3))));
+
+ int buf[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+ pmt_t blob = mp(buf, sizeof(buf));
+ const void *data = pmt_blob_data(blob);
+ size_t nbytes = pmt_blob_length(blob);
+ CPPUNIT_ASSERT_EQUAL(sizeof(buf), nbytes);
+ CPPUNIT_ASSERT(memcmp(buf, data, nbytes) == 0);
+}
diff --git a/gruel/src/lib/pmt/qa_pmt_prims.h b/gruel/src/lib/pmt/qa_pmt_prims.h
new file mode 100644
index 000000000..a407509b2
--- /dev/null
+++ b/gruel/src/lib/pmt/qa_pmt_prims.h
@@ -0,0 +1,77 @@
+/* -*- 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.
+ */
+#ifndef INCLUDED_QA_PMT_PRIMS_H
+#define INCLUDED_QA_PMT_PRIMS_H
+
+#include <gruel/attributes.h>
+#include <gruel/api.h> //reason: suppress warnings
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/TestCase.h>
+
+class __GR_ATTR_EXPORT qa_pmt_prims : public CppUnit::TestCase {
+
+ CPPUNIT_TEST_SUITE(qa_pmt_prims);
+ CPPUNIT_TEST(test_symbols);
+ CPPUNIT_TEST(test_booleans);
+ CPPUNIT_TEST(test_integers);
+ CPPUNIT_TEST(test_uint64s);
+ CPPUNIT_TEST(test_reals);
+ CPPUNIT_TEST(test_complexes);
+ CPPUNIT_TEST(test_pairs);
+ CPPUNIT_TEST(test_vectors);
+ CPPUNIT_TEST(test_tuples);
+ CPPUNIT_TEST(test_equivalence);
+ CPPUNIT_TEST(test_misc);
+ CPPUNIT_TEST(test_dict);
+ CPPUNIT_TEST(test_any);
+ CPPUNIT_TEST(test_msg_accepter);
+ CPPUNIT_TEST(test_io);
+ CPPUNIT_TEST(test_lists);
+ CPPUNIT_TEST(test_serialize);
+ CPPUNIT_TEST(test_sets);
+ CPPUNIT_TEST(test_sugar);
+ CPPUNIT_TEST_SUITE_END();
+
+ private:
+ void test_symbols();
+ void test_booleans();
+ void test_integers();
+ void test_uint64s();
+ void test_reals();
+ void test_complexes();
+ void test_pairs();
+ void test_vectors();
+ void test_tuples();
+ void test_equivalence();
+ void test_misc();
+ void test_dict();
+ void test_any();
+ void test_msg_accepter();
+ void test_io();
+ void test_lists();
+ void test_serialize();
+ void test_sets();
+ void test_sugar();
+};
+
+#endif /* INCLUDED_QA_PMT_PRIMS_H */
+
diff --git a/gruel/src/lib/pmt/unv_qa_template.cc.t b/gruel/src/lib/pmt/unv_qa_template.cc.t
new file mode 100644
index 000000000..1e2c8e8eb
--- /dev/null
+++ b/gruel/src/lib/pmt/unv_qa_template.cc.t
@@ -0,0 +1,35 @@
+void
+qa_pmt_unv::test_@TAG@vector()
+{
+ static const size_t N = 3;
+ pmt_t v1 = pmt_make_@TAG@vector(N, 0);
+ CPPUNIT_ASSERT_EQUAL(N, pmt_length(v1));
+ @TYPE@ s0 = @TYPE@(10);
+ @TYPE@ s1 = @TYPE@(20);
+ @TYPE@ s2 = @TYPE@(30);
+
+ pmt_@TAG@vector_set(v1, 0, s0);
+ pmt_@TAG@vector_set(v1, 1, s1);
+ pmt_@TAG@vector_set(v1, 2, s2);
+
+ CPPUNIT_ASSERT_EQUAL(s0, pmt_@TAG@vector_ref(v1, 0));
+ CPPUNIT_ASSERT_EQUAL(s1, pmt_@TAG@vector_ref(v1, 1));
+ CPPUNIT_ASSERT_EQUAL(s2, pmt_@TAG@vector_ref(v1, 2));
+
+ CPPUNIT_ASSERT_THROW(pmt_@TAG@vector_ref(v1, N), pmt_out_of_range);
+ CPPUNIT_ASSERT_THROW(pmt_@TAG@vector_set(v1, N, @TYPE@(0)), pmt_out_of_range);
+
+ size_t len;
+ const @TYPE@ *rd = pmt_@TAG@vector_elements(v1, len);
+ CPPUNIT_ASSERT_EQUAL(len, N);
+ CPPUNIT_ASSERT_EQUAL(s0, rd[0]);
+ CPPUNIT_ASSERT_EQUAL(s1, rd[1]);
+ CPPUNIT_ASSERT_EQUAL(s2, rd[2]);
+
+ @TYPE@ *wr = pmt_@TAG@vector_writable_elements(v1, len);
+ CPPUNIT_ASSERT_EQUAL(len, N);
+ wr[0] = @TYPE@(0);
+ CPPUNIT_ASSERT_EQUAL(@TYPE@(0), wr[0]);
+ CPPUNIT_ASSERT_EQUAL(s1, wr[1]);
+ CPPUNIT_ASSERT_EQUAL(s2, wr[2]);
+}
diff --git a/gruel/src/lib/pmt/unv_template.cc.t b/gruel/src/lib/pmt/unv_template.cc.t
new file mode 100644
index 000000000..1ed505e29
--- /dev/null
+++ b/gruel/src/lib/pmt/unv_template.cc.t
@@ -0,0 +1,141 @@
+////////////////////////////////////////////////////////////////////////////
+// pmt_@TAG@vector
+////////////////////////////////////////////////////////////////////////////
+
+namespace pmt {
+
+static pmt_@TAG@vector *
+_@TAG@vector(pmt_t x)
+{
+ return dynamic_cast<pmt_@TAG@vector*>(x.get());
+}
+
+
+pmt_@TAG@vector::pmt_@TAG@vector(size_t k, @TYPE@ fill)
+ : d_v(k)
+{
+ for (size_t i = 0; i < k; i++)
+ d_v[i] = fill;
+}
+
+pmt_@TAG@vector::pmt_@TAG@vector(size_t k, const @TYPE@ *data)
+ : d_v(k)
+{
+ for (size_t i = 0; i < k; i++)
+ d_v[i] = data[i];
+}
+
+@TYPE@
+pmt_@TAG@vector::ref(size_t k) const
+{
+ if (k >= length())
+ throw pmt_out_of_range("pmt_@TAG@vector_ref", pmt_from_long(k));
+ return d_v[k];
+}
+
+void
+pmt_@TAG@vector::set(size_t k, @TYPE@ x)
+{
+ if (k >= length())
+ throw pmt_out_of_range("pmt_@TAG@vector_set", pmt_from_long(k));
+ d_v[k] = x;
+}
+
+const @TYPE@ *
+pmt_@TAG@vector::elements(size_t &len)
+{
+ len = length();
+ return &d_v[0];
+}
+
+@TYPE@ *
+pmt_@TAG@vector::writable_elements(size_t &len)
+{
+ len = length();
+ return &d_v[0];
+}
+
+const void*
+pmt_@TAG@vector::uniform_elements(size_t &len)
+{
+ len = length() * sizeof(@TYPE@);
+ return &d_v[0];
+}
+
+void*
+pmt_@TAG@vector::uniform_writable_elements(size_t &len)
+{
+ len = length() * sizeof(@TYPE@);
+ return &d_v[0];
+}
+
+bool
+pmt_is_@TAG@vector(pmt_t obj)
+{
+ return obj->is_@TAG@vector();
+}
+
+pmt_t
+pmt_make_@TAG@vector(size_t k, @TYPE@ fill)
+{
+ return pmt_t(new pmt_@TAG@vector(k, fill));
+}
+
+pmt_t
+pmt_init_@TAG@vector(size_t k, const @TYPE@ *data)
+{
+ return pmt_t(new pmt_@TAG@vector(k, data));
+}
+
+pmt_t
+pmt_init_@TAG@vector(size_t k, const std::vector< @TYPE@ > &data)
+{
+
+ return pmt_t(new pmt_@TAG@vector(k, &data[0]));
+}
+
+@TYPE@
+pmt_@TAG@vector_ref(pmt_t vector, size_t k)
+{
+ if (!vector->is_@TAG@vector())
+ throw pmt_wrong_type("pmt_@TAG@vector_ref", vector);
+ return _@TAG@vector(vector)->ref(k);
+}
+
+void
+pmt_@TAG@vector_set(pmt_t vector, size_t k, @TYPE@ obj)
+{
+ if (!vector->is_@TAG@vector())
+ throw pmt_wrong_type("pmt_@TAG@vector_set", vector);
+ _@TAG@vector(vector)->set(k, obj);
+}
+
+const @TYPE@ *
+pmt_@TAG@vector_elements(pmt_t vector, size_t &len)
+{
+ if (!vector->is_@TAG@vector())
+ throw pmt_wrong_type("pmt_@TAG@vector_elements", vector);
+ return _@TAG@vector(vector)->elements(len);
+}
+
+const std::vector< @TYPE@ >
+pmt_@TAG@vector_elements(pmt_t vector)
+{
+ if (!vector->is_@TAG@vector())
+ throw pmt_wrong_type("pmt_@TAG@vector_elements", vector);
+ size_t len;
+ const @TYPE@ *array = _@TAG@vector(vector)->elements(len);
+ const std::vector< @TYPE@ > vec(array, array+len);
+ return vec;
+}
+
+
+@TYPE@ *
+pmt_@TAG@vector_writable_elements(pmt_t vector, size_t &len)
+{
+ if (!vector->is_@TAG@vector())
+ throw pmt_wrong_type("pmt_@TAG@vector_writable_elements", vector);
+ return _@TAG@vector(vector)->writable_elements(len);
+}
+
+} /* namespace pmt */
diff --git a/gruel/src/lib/pmt/unv_template.h.t b/gruel/src/lib/pmt/unv_template.h.t
new file mode 100644
index 000000000..83ba0be0f
--- /dev/null
+++ b/gruel/src/lib/pmt/unv_template.h.t
@@ -0,0 +1,23 @@
+
+////////////////////////////////////////////////////////////////////////////
+// pmt_@TAG@vector
+////////////////////////////////////////////////////////////////////////////
+
+class pmt_@TAG@vector : public pmt_uniform_vector
+{
+ std::vector< @TYPE@ > d_v;
+
+public:
+ pmt_@TAG@vector(size_t k, @TYPE@ fill);
+ pmt_@TAG@vector(size_t k, const @TYPE@ *data);
+ // ~pmt_@TAG@vector();
+
+ bool is_@TAG@vector() const { return true; }
+ size_t length() const { return d_v.size(); }
+ @TYPE@ ref(size_t k) const;
+ void set(size_t k, @TYPE@ x);
+ const @TYPE@ *elements(size_t &len);
+ @TYPE@ *writable_elements(size_t &len);
+ const void *uniform_elements(size_t &len);
+ void *uniform_writable_elements(size_t &len);
+};
diff --git a/gruel/src/lib/realtime.cc b/gruel/src/lib/realtime.cc
new file mode 100644
index 000000000..e01c6c53d
--- /dev/null
+++ b/gruel/src/lib/realtime.cc
@@ -0,0 +1,178 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006,2007,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <gruel/realtime.h>
+
+#ifdef HAVE_SCHED_H
+#include <sched.h>
+#endif
+
+#include <algorithm>
+#include <math.h>
+#include <string.h>
+#include <errno.h>
+#include <stdio.h>
+
+#if defined(HAVE_PTHREAD_SETSCHEDPARAM) || defined(HAVE_SCHED_SETSCHEDULER)
+#include <pthread.h>
+
+namespace gruel {
+
+ /*!
+ * Rescale our virtual priority so that it maps to the middle 1/2 of
+ * the priorities given by min_real_pri and max_real_pri.
+ */
+ static int
+ rescale_virtual_pri(int virtual_pri, int min_real_pri, int max_real_pri)
+ {
+ float rmin = min_real_pri + (0.25 * (max_real_pri - min_real_pri));
+ float rmax = min_real_pri + (0.75 * (max_real_pri - min_real_pri));
+ float m = (rmax - rmin) / (rt_priority_max() - rt_priority_min());
+ float y = m * (virtual_pri - rt_priority_min()) + rmin;
+ int y_int = static_cast<int>(rint(y));
+ return std::max(min_real_pri, std::min(max_real_pri, y_int));
+ }
+
+} // namespace gruel
+
+#endif
+
+
+#if defined(HAVE_PTHREAD_SETSCHEDPARAM)
+
+namespace gruel {
+
+ rt_status_t
+ enable_realtime_scheduling(rt_sched_param p)
+ {
+ int policy = p.policy == RT_SCHED_FIFO ? SCHED_FIFO : SCHED_RR;
+ int min_real_pri = sched_get_priority_min(policy);
+ int max_real_pri = sched_get_priority_max(policy);
+ int pri = rescale_virtual_pri(p.priority, min_real_pri, max_real_pri);
+
+ // FIXME check hard and soft limits with getrlimit, and limit the value we ask for.
+ // fprintf(stderr, "pthread_setschedparam: policy = %d, pri = %d\n", policy, pri);
+
+ struct sched_param param;
+ memset (&param, 0, sizeof (param));
+ param.sched_priority = pri;
+ int result = pthread_setschedparam (pthread_self(), policy, &param);
+ if (result != 0) {
+ if (result == EPERM) // N.B., return value, not errno
+ return RT_NO_PRIVS;
+ else {
+ fprintf(stderr,
+ "pthread_setschedparam: failed to set real time priority: %s\n",
+ strerror(result));
+ return RT_OTHER_ERROR;
+ }
+ }
+
+ //printf("SCHED_FIFO enabled with priority = %d\n", pri);
+ return RT_OK;
+ }
+} // namespace gruel
+
+
+#elif defined(HAVE_SCHED_SETSCHEDULER)
+
+namespace gruel {
+
+ rt_status_t
+ enable_realtime_scheduling(rt_sched_param p)
+ {
+ int policy = p.policy == RT_SCHED_FIFO ? SCHED_FIFO : SCHED_RR;
+ int min_real_pri = sched_get_priority_min(policy);
+ int max_real_pri = sched_get_priority_max(policy);
+ int pri = rescale_virtual_pri(p.priority, min_real_pri, max_real_pri);
+
+ // FIXME check hard and soft limits with getrlimit, and limit the value we ask for.
+ // fprintf(stderr, "sched_setscheduler: policy = %d, pri = %d\n", policy, pri);
+
+ int pid = 0; // this process
+ struct sched_param param;
+ memset(&param, 0, sizeof(param));
+ param.sched_priority = pri;
+ int result = sched_setscheduler(pid, policy, &param);
+ if (result != 0){
+ if (errno == EPERM)
+ return RT_NO_PRIVS;
+ else {
+ perror ("sched_setscheduler: failed to set real time priority");
+ return RT_OTHER_ERROR;
+ }
+ }
+
+ //printf("SCHED_FIFO enabled with priority = %d\n", pri);
+ return RT_OK;
+ }
+
+} // namespace gruel
+
+#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
+
+#include <windows.h>
+
+namespace gruel {
+
+ rt_status_t enable_realtime_scheduling(rt_sched_param p){
+
+ //set the priority class on the process
+ int pri_class = (true)? REALTIME_PRIORITY_CLASS : NORMAL_PRIORITY_CLASS;
+ if (SetPriorityClass(GetCurrentProcess(), pri_class) == 0)
+ return RT_OTHER_ERROR;
+
+ //scale the priority value to the constants
+ int priorities[] = {
+ THREAD_PRIORITY_IDLE, THREAD_PRIORITY_LOWEST, THREAD_PRIORITY_BELOW_NORMAL, THREAD_PRIORITY_NORMAL,
+ THREAD_PRIORITY_ABOVE_NORMAL, THREAD_PRIORITY_HIGHEST, THREAD_PRIORITY_TIME_CRITICAL
+ };
+ const double priority = double(p.priority)/(rt_priority_max() - rt_priority_min());
+ size_t pri_index = size_t((priority+1.0)*6/2.0); // -1 -> 0, +1 -> 6
+ pri_index %= sizeof(priorities)/sizeof(*priorities); //range check
+
+ //set the thread priority on the thread
+ if (SetThreadPriority(GetCurrentThread(), priorities[pri_index]) == 0)
+ return RT_OTHER_ERROR;
+
+ //printf("SetPriorityClass + SetThreadPriority\n");
+ return RT_OK;
+ }
+
+} // namespace gruel
+
+#else
+
+namespace gruel {
+
+ rt_status_t
+ enable_realtime_scheduling(rt_sched_param p)
+ {
+ return RT_NOT_IMPLEMENTED;
+ }
+} // namespace gruel
+
+#endif
diff --git a/gruel/src/lib/sys_pri.cc b/gruel/src/lib/sys_pri.cc
new file mode 100644
index 000000000..c8a505341
--- /dev/null
+++ b/gruel/src/lib/sys_pri.cc
@@ -0,0 +1,61 @@
+/* -*- 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 this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <gruel/sys_pri.h>
+
+namespace gruel {
+
+ /*
+ * These may need per-OS tweaking.
+ *
+ * Under linux virtual_pri -> system_pri
+ * 0 -> 0
+ * 1 -> 5
+ * 2 -> 10
+ * 3 -> 15
+ * 4 -> 20 // typically used by jack and pulse audio
+ * 5 -> 25
+ * 6 -> 30
+ * 7 -> 35
+ * 8 -> 40
+ * 9 -> 45
+ * 10 -> 50
+ * 11 -> 54
+ * 12 -> 59
+ * 13 -> 64
+ * 14 -> 69
+ * 15 -> 74
+ */
+ rt_sched_param
+ sys_pri::python() { return rt_sched_param(0, RT_SCHED_RR); }
+
+ rt_sched_param
+ sys_pri::normal() { return rt_sched_param(2, RT_SCHED_RR); }
+
+ rt_sched_param
+ sys_pri::gcell_event_handler(){ return rt_sched_param(5, RT_SCHED_FIFO); }
+
+ rt_sched_param
+ sys_pri::usrp2_backend() { return rt_sched_param(6, RT_SCHED_FIFO); }
+}
diff --git a/gruel/src/lib/test_gruel.cc b/gruel/src/lib/test_gruel.cc
new file mode 100644
index 000000000..f32e3f341
--- /dev/null
+++ b/gruel/src/lib/test_gruel.cc
@@ -0,0 +1,52 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006,2009,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.
+ */
+
+#include <cppunit/TextTestRunner.h>
+#include <cppunit/XmlOutputter.h>
+
+#include <stdlib.h>
+#include <sys/stat.h>
+
+#include "pmt/qa_pmt.h"
+
+#include <boost/filesystem/operations.hpp>
+#include <boost/filesystem/path.hpp>
+namespace fs = boost::filesystem;
+
+int
+main(int argc, char **argv)
+{
+ fs::path path = fs::current_path() / ".unittests";
+ if (!fs::is_directory(path)) fs::create_directory(path);
+ path = path / "gruel.xml";
+
+ CppUnit::TextTestRunner runner;
+ std::ofstream xmlfile(path.string().c_str());
+ CppUnit::XmlOutputter *xmlout = new CppUnit::XmlOutputter(&runner.result(), xmlfile);
+
+ runner.addTest(qa_pmt::suite ());
+ runner.setOutputter(xmlout);
+
+ bool was_successful = runner.run("", false);
+
+ return was_successful ? 0 : 1;
+}
diff --git a/gruel/src/lib/thread.cc b/gruel/src/lib/thread.cc
new file mode 100644
index 000000000..a5116b687
--- /dev/null
+++ b/gruel/src/lib/thread.cc
@@ -0,0 +1,226 @@
+/* -*- 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 this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <gruel/thread.h>
+
+#if defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
+
+#include <Windows.h>
+
+namespace gruel {
+
+ gr_thread_t
+ get_current_thread_id()
+ {
+ return GetCurrentThread();
+ }
+
+ void
+ thread_bind_to_processor(int n)
+ {
+ std::vector<int> mask(1, n);
+ thread_bind_to_processor(get_current_thread_id(), mask);
+ }
+
+ void
+ thread_bind_to_processor(const std::vector<int> &mask)
+ {
+ thread_bind_to_processor(get_current_thread_id(), mask);
+ }
+
+ void
+ thread_bind_to_processor(gr_thread_t thread, int n)
+ {
+ std::vector<int> mask(1, n);
+ thread_bind_to_processor(thread, mask);
+ }
+
+ void
+ thread_bind_to_processor(gr_thread_t thread, const std::vector<int> &mask)
+ {
+ //DWORD_PTR mask = (1 << n);
+ DWORD_PTR dword_mask = 0;
+
+ std::vector<int> _mask = mask;
+ std::vector<int>::iterator itr;
+ for(itr = _mask.begin(); itr != _mask.end(); itr++)
+ dword_mask |= (1 << (*itr));
+
+ DWORD_PTR ret = SetThreadAffinityMask(thread, dword_mask);
+ if(ret == 0) {
+ std::stringstream s;
+ s << "thread_bind_to_processor failed with error: " << GetLastError() << std::endl;
+ throw std::runtime_error(s.str());
+ }
+ }
+
+ void
+ thread_unbind()
+ {
+ thread_unbind(get_current_thread_id());
+ }
+
+ void
+ thread_unbind(gr_thread_t thread)
+ {
+ DWORD_PTR dword_mask = sizeof(DWORD_PTR) - 1;
+ DWORD_PTR ret = SetThreadAffinityMask(thread, dword_mask);
+ if(ret == 0) {
+ std::stringstream s;
+ s << "thread_unbind failed with error: " << GetLastError() << std::endl;
+ throw std::runtime_error(s.str());
+ }
+ }
+} /* namespace gruel */
+
+#elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)
+
+namespace gruel {
+
+ gr_thread_t
+ get_current_thread_id()
+ {
+ // Not implemented on OSX
+ }
+
+ void
+ thread_bind_to_processor(int n)
+ {
+ // Not implemented on OSX
+ }
+
+ void
+ thread_bind_to_processor(gr_thread_t thread, int n)
+ {
+ // Not implemented on OSX
+ }
+
+ void
+ thread_bind_to_processor(const std::vector<int> &mask)
+ {
+ // Not implemented on OSX
+ }
+
+ void
+ thread_bind_to_processor(gr_thread_t thread, const std::vector<int> &mask)
+ {
+ // Not implemented on OSX
+ }
+
+ void
+ thread_unbind()
+ {
+ // Not implemented on OSX
+ }
+
+ void
+ thread_unbind(gr_thread_t thread)
+ {
+ // Not implemented on OSX
+ }
+} /* namespace gruel */
+
+#else
+
+#include <sstream>
+#include <stdexcept>
+#include <pthread.h>
+
+namespace gruel {
+
+ gr_thread_t
+ get_current_thread_id()
+ {
+ return pthread_self();
+ }
+
+ void
+ thread_bind_to_processor(int n)
+ {
+ std::vector<int> mask(1, n);
+ thread_bind_to_processor(get_current_thread_id(), mask);
+ }
+
+ void
+ thread_bind_to_processor(const std::vector<int> &mask)
+ {
+ thread_bind_to_processor(get_current_thread_id(), mask);
+ }
+
+ void
+ thread_bind_to_processor(gr_thread_t thread, int n)
+ {
+ std::vector<int> mask(1, n);
+ thread_bind_to_processor(thread, mask);
+ }
+
+ void
+ thread_bind_to_processor(gr_thread_t thread, const std::vector<int> &mask)
+ {
+ cpu_set_t set;
+ size_t len = sizeof(cpu_set_t);
+ std::vector<int> _mask = mask;
+ std::vector<int>::iterator itr;
+
+ CPU_ZERO(&set);
+ for(itr = _mask.begin(); itr != _mask.end(); itr++)
+ CPU_SET(*itr, &set);
+
+ int ret = pthread_setaffinity_np(thread, len, &set);
+ if(ret != 0) {
+ std::stringstream s;
+ s << "thread_bind_to_processor failed with error: " << ret << std::endl;
+ throw std::runtime_error(s.str());
+ }
+ }
+
+ void
+ thread_unbind()
+ {
+ thread_unbind(get_current_thread_id());
+ }
+
+ void
+ thread_unbind(gr_thread_t thread)
+ {
+ cpu_set_t set;
+ size_t len = sizeof(cpu_set_t);
+
+ CPU_ZERO(&set);
+ long ncpus = sysconf(_SC_NPROCESSORS_ONLN);
+ for(long n = 0; n < ncpus; n++) {
+ CPU_SET(n, &set);
+ }
+
+ int ret = pthread_setaffinity_np(thread, len, &set);
+ if(ret != 0) {
+ std::stringstream s;
+ s << "thread_unbind failed with error: " << ret << std::endl;
+ throw std::runtime_error(s.str());
+ }
+ }
+} /* namespace gruel */
+
+#endif
diff --git a/gruel/src/lib/thread_body_wrapper.cc b/gruel/src/lib/thread_body_wrapper.cc
new file mode 100644
index 000000000..019eaa342
--- /dev/null
+++ b/gruel/src/lib/thread_body_wrapper.cc
@@ -0,0 +1,85 @@
+/* -*- 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 this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <gruel/thread_body_wrapper.h>
+#ifdef HAVE_SIGNAL_H
+#include <signal.h>
+#endif
+#include <stdio.h>
+
+namespace gruel {
+
+#if defined(HAVE_PTHREAD_SIGMASK) && defined(HAVE_SIGNAL_H)
+
+ void mask_signals()
+ {
+ sigset_t new_set;
+ int r;
+
+ sigemptyset(&new_set);
+ sigaddset(&new_set, SIGHUP); // block these...
+ sigaddset(&new_set, SIGINT);
+ sigaddset(&new_set, SIGPIPE);
+ sigaddset(&new_set, SIGALRM);
+ sigaddset(&new_set, SIGTERM);
+ sigaddset(&new_set, SIGUSR1);
+ sigaddset(&new_set, SIGCHLD);
+#ifdef SIGPOLL
+ sigaddset(&new_set, SIGPOLL);
+#endif
+#ifdef SIGPROF
+ sigaddset(&new_set, SIGPROF);
+#endif
+#ifdef SIGSYS
+ sigaddset(&new_set, SIGSYS);
+#endif
+#ifdef SIGTRAP
+ sigaddset(&new_set, SIGTRAP);
+#endif
+#ifdef SIGURG
+ sigaddset(&new_set, SIGURG);
+#endif
+#ifdef SIGVTALRM
+ sigaddset(&new_set, SIGVTALRM);
+#endif
+#ifdef SIGXCPU
+ sigaddset(&new_set, SIGXCPU);
+#endif
+#ifdef SIGXFSZ
+ sigaddset(&new_set, SIGXFSZ);
+#endif
+ r = pthread_sigmask(SIG_BLOCK, &new_set, 0);
+ if (r != 0)
+ perror("pthread_sigmask");
+ }
+
+#else
+
+ void mask_signals()
+ {
+ }
+
+#endif
+
+};
diff --git a/gruel/src/lib/thread_group.cc b/gruel/src/lib/thread_group.cc
new file mode 100644
index 000000000..9e8ded4df
--- /dev/null
+++ b/gruel/src/lib/thread_group.cc
@@ -0,0 +1,99 @@
+/* -*- c++ -*- */
+/*
+ * Copyright (C) 2001-2003 William E. Kempf
+ * Copyright (C) 2007 Anthony Williams
+ * Copyright 2008 Free Software Foundation, Inc.
+ *
+ * Distributed under the Boost Software License, Version 1.0. (See accompanying
+ * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ */
+
+/*
+ * This was extracted from Boost 1.35.0 and fixed.
+ */
+
+#include <gruel/thread_group.h>
+
+namespace gruel
+{
+ thread_group::thread_group()
+ {
+ }
+
+ thread_group::~thread_group()
+ {
+ // We shouldn't have to scoped_lock here, since referencing this object
+ // from another thread while we're deleting it in the current thread is
+ // going to lead to undefined behavior any way.
+ for (std::list<boost::thread*>::iterator it = m_threads.begin();
+ it != m_threads.end(); ++it)
+ {
+ delete (*it);
+ }
+ }
+
+ boost::thread* thread_group::create_thread(const boost::function0<void>& threadfunc)
+ {
+ // No scoped_lock required here since the only "shared data" that's
+ // modified here occurs inside add_thread which does scoped_lock.
+ std::auto_ptr<boost::thread> thrd(new boost::thread(threadfunc));
+ add_thread(thrd.get());
+ return thrd.release();
+ }
+
+ void thread_group::add_thread(boost::thread* thrd)
+ {
+ boost::lock_guard<boost::shared_mutex> guard(m_mutex);
+
+ // For now we'll simply ignore requests to add a thread object multiple
+ // times. Should we consider this an error and either throw or return an
+ // error value?
+ std::list<boost::thread*>::iterator it = std::find(m_threads.begin(),
+ m_threads.end(), thrd);
+ BOOST_ASSERT(it == m_threads.end());
+ if (it == m_threads.end())
+ m_threads.push_back(thrd);
+ }
+
+ void thread_group::remove_thread(boost::thread* thrd)
+ {
+ boost::lock_guard<boost::shared_mutex> guard(m_mutex);
+
+ // For now we'll simply ignore requests to remove a thread object that's
+ // not in the group. Should we consider this an error and either throw or
+ // return an error value?
+ std::list<boost::thread*>::iterator it = std::find(m_threads.begin(),
+ m_threads.end(), thrd);
+ BOOST_ASSERT(it != m_threads.end());
+ if (it != m_threads.end())
+ m_threads.erase(it);
+ }
+
+ void thread_group::join_all()
+ {
+ boost::shared_lock<boost::shared_mutex> guard(m_mutex);
+ for (std::list<boost::thread*>::iterator it = m_threads.begin();
+ it != m_threads.end(); ++it)
+ {
+ (*it)->join();
+ }
+ }
+
+ void thread_group::interrupt_all()
+ {
+ boost::shared_lock<boost::shared_mutex> guard(m_mutex);
+ for(std::list<boost::thread*>::iterator it=m_threads.begin(),end=m_threads.end();
+ it!=end;
+ ++it)
+ {
+ (*it)->interrupt();
+ }
+ }
+
+ size_t thread_group::size() const
+ {
+ boost::shared_lock<boost::shared_mutex> guard(m_mutex);
+ return m_threads.size();
+ }
+
+} // namespace gruel
diff --git a/gruel/src/python/CMakeLists.txt b/gruel/src/python/CMakeLists.txt
new file mode 100644
index 000000000..f5c4ac47a
--- /dev/null
+++ b/gruel/src/python/CMakeLists.txt
@@ -0,0 +1,53 @@
+# Copyright 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.
+
+include(GrPython)
+
+########################################################################
+# Install python files
+########################################################################
+GR_PYTHON_INSTALL(
+ FILES __init__.py
+ DESTINATION ${GR_PYTHON_DIR}/gruel
+ COMPONENT "gruel_python"
+)
+
+GR_PYTHON_INSTALL(FILES
+ pmt/__init__.py
+ pmt/pmt_to_python.py
+ DESTINATION ${GR_PYTHON_DIR}/gruel/pmt
+ COMPONENT "gruel_python"
+)
+
+########################################################################
+# Setup unit tests
+########################################################################
+if(ENABLE_TESTING)
+include(GrTest)
+file(GLOB py_qa_test_files "qa_*.py")
+foreach(py_qa_test_file ${py_qa_test_files})
+ get_filename_component(py_qa_test_name ${py_qa_test_file} NAME_WE)
+ set(GR_TEST_PYTHON_DIRS
+ ${CMAKE_BINARY_DIR}/gruel/src/python
+ ${CMAKE_BINARY_DIR}/gruel/src/swig
+ )
+ set(GR_TEST_TARGET_DEPS gruel gnuradio-core)
+ GR_ADD_TEST(${py_qa_test_name} ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} ${py_qa_test_file})
+endforeach(py_qa_test_file)
+endif(ENABLE_TESTING)
diff --git a/gruel/src/python/__init__.py b/gruel/src/python/__init__.py
new file mode 100644
index 000000000..976b2ed1e
--- /dev/null
+++ b/gruel/src/python/__init__.py
@@ -0,0 +1,29 @@
+#
+# Copyright 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.
+#
+
+# The presence of this file turns this directory into a Python package
+
+'''
+The GNU Radio Utility Etcetera Library.
+'''
+
+import pmt;
+
diff --git a/gruel/src/python/pmt/__init__.py b/gruel/src/python/pmt/__init__.py
new file mode 100644
index 000000000..bc933e80a
--- /dev/null
+++ b/gruel/src/python/pmt/__init__.py
@@ -0,0 +1,31 @@
+#
+# Copyright 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.
+#
+
+# The presence of this file turns this directory into a Python package
+
+'''
+The GNU Radio Utility Etcetera Library's Polymorphic Types for Python.
+'''
+
+from pmt_swig import *
+from pmt_to_python import pmt_to_python as to_python
+from pmt_to_python import python_to_pmt as to_pmt
+
diff --git a/gruel/src/python/pmt/pmt_to_python.py b/gruel/src/python/pmt/pmt_to_python.py
new file mode 100644
index 000000000..030c1c11d
--- /dev/null
+++ b/gruel/src/python/pmt/pmt_to_python.py
@@ -0,0 +1,97 @@
+# Copyright 2012,2013 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.
+
+try: import pmt_swig as pmt
+except: import pmt
+import numpy
+
+#define missing
+def pmt_to_tuple(p):
+ elems = list()
+ for i in range(pmt.pmt_length(p)):
+ elem = pmt.pmt_tuple_ref(p, i)
+ elems.append(pmt_to_python(elem))
+ return tuple(elems)
+
+def pmt_from_tuple(p):
+ args = map(python_to_pmt, p)
+ return pmt.pmt_make_tuple(*args)
+
+def pmt_to_vector(p):
+ v = list()
+ for i in range(pmt.pmt_length(p)):
+ elem = pmt.pmt_vector_ref(p, i)
+ v.append(pmt_to_python(elem))
+ return v
+
+def pmt_from_vector(p):
+ v = pmt.pmt_make_vector(len(p), pmt.PMT_NIL)
+ for i, elem in enumerate(p):
+ pmt.pmt_vector_set(v, i, python_to_pmt(elem))
+ return v
+
+def pmt_to_dict(p):
+ d = dict()
+ items = pmt.pmt_dict_items(p)
+ for i in range(pmt.pmt_length(items)):
+ pair = pmt.pmt_nth(i, items)
+ k = pmt.pmt_car(pair)
+ v = pmt.pmt_cdr(pair)
+ d[pmt_to_python(k)] = pmt_to_python(v)
+ return d
+
+def pmt_from_dict(p):
+ d = pmt.pmt_make_dict()
+ for k, v in p.iteritems():
+ #dict is immutable -> therefore pmt_dict_add returns the new dict
+ d = pmt.pmt_dict_add(d, python_to_pmt(k), python_to_pmt(v))
+ return d
+
+def numpy_to_blob(p):
+ p = p.view(numpy.uint8)
+ b = pmt.pmt_make_blob(len(p))
+ pmt.pmt_blob_data(b)[:] = p
+ return b
+
+THE_TABLE = ( #python type, check pmt type, to python, from python
+ (None, pmt.pmt_is_null, lambda x: None, lambda x: pmt.PMT_NIL),
+ (bool, pmt.pmt_is_bool, pmt.pmt_to_bool, pmt.pmt_from_bool),
+ (str, pmt.pmt_is_symbol, pmt.pmt_symbol_to_string, pmt.pmt_string_to_symbol),
+ (int, pmt.pmt_is_integer, pmt.pmt_to_long, pmt.pmt_from_long),
+ (long, pmt.pmt_is_uint64, lambda x: long(pmt.pmt_to_uint64(x)), pmt.pmt_from_uint64),
+ (float, pmt.pmt_is_real, pmt.pmt_to_double, pmt.pmt_from_double),
+ (complex, pmt.pmt_is_complex, pmt.pmt_to_complex, pmt.pmt_from_complex),
+ (tuple, pmt.pmt_is_tuple, pmt_to_tuple, pmt_from_tuple),
+ (list, pmt.pmt_is_vector, pmt_to_vector, pmt_from_vector),
+ (dict, pmt.pmt_is_dict, pmt_to_dict, pmt_from_dict),
+ (numpy.ndarray, pmt.pmt_is_blob, pmt.pmt_blob_data, numpy_to_blob),
+)
+
+def pmt_to_python(p):
+ for python_type, pmt_check, to_python, from_python in THE_TABLE:
+ if pmt_check(p): return to_python(p)
+ return p #give up, we return the same
+
+def python_to_pmt(p):
+ for python_type, pmt_check, to_python, from_python in THE_TABLE:
+ if python_type is None:
+ if p == None: return from_python(p)
+ elif isinstance(p, python_type): return from_python(p)
+ return p #give up, we return the same
+
diff --git a/gruel/src/python/qa_pmt.py b/gruel/src/python/qa_pmt.py
new file mode 100755
index 000000000..59a5725fc
--- /dev/null
+++ b/gruel/src/python/qa_pmt.py
@@ -0,0 +1,102 @@
+#!/usr/bin/env python
+#
+# Copyright 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.
+#
+
+import unittest
+import pmt_swig as pmt
+
+class test_gruel_pmt(unittest.TestCase):
+
+ def test01 (self):
+ a = pmt.pmt_intern("a")
+ b = pmt.pmt_from_double(123765)
+ d1 = pmt.pmt_make_dict()
+ d2 = pmt.pmt_dict_add(d1, a, b)
+ pmt.pmt_print(d2)
+
+ def test02 (self):
+ const = 123765
+ x_pmt = pmt.pmt_from_double(const)
+ x_int = pmt.pmt_to_double(x_pmt)
+ self.assertEqual(x_int, const)
+
+ def test03(self):
+ v = pmt.pmt_init_f32vector(3, [11, -22, 33])
+ s = pmt.pmt_serialize_str(v)
+ d = pmt.pmt_deserialize_str(s)
+ self.assertTrue(pmt.pmt_equal(v, d))
+
+ def test04(self):
+ v = pmt.pmt_init_f64vector(3, [11, -22, 33])
+ s = pmt.pmt_serialize_str(v)
+ d = pmt.pmt_deserialize_str(s)
+ self.assertTrue(pmt.pmt_equal(v, d))
+
+ def test05(self):
+ v = pmt.pmt_init_u8vector(3, [11, 22, 33])
+ s = pmt.pmt_serialize_str(v)
+ d = pmt.pmt_deserialize_str(s)
+ self.assertTrue(pmt.pmt_equal(v, d))
+
+ def test06(self):
+ v = pmt.pmt_init_s8vector(3, [11, -22, 33])
+ s = pmt.pmt_serialize_str(v)
+ d = pmt.pmt_deserialize_str(s)
+ self.assertTrue(pmt.pmt_equal(v, d))
+
+ def test07(self):
+ v = pmt.pmt_init_u16vector(3, [11, 22, 33])
+ s = pmt.pmt_serialize_str(v)
+ d = pmt.pmt_deserialize_str(s)
+ self.assertTrue(pmt.pmt_equal(v, d))
+
+ def test08(self):
+ v = pmt.pmt_init_s16vector(3, [11, -22, 33])
+ s = pmt.pmt_serialize_str(v)
+ d = pmt.pmt_deserialize_str(s)
+ self.assertTrue(pmt.pmt_equal(v, d))
+
+ def test09(self):
+ v = pmt.pmt_init_u32vector(3, [11, 22, 33])
+ s = pmt.pmt_serialize_str(v)
+ d = pmt.pmt_deserialize_str(s)
+ self.assertTrue(pmt.pmt_equal(v, d))
+
+ def test10(self):
+ v = pmt.pmt_init_s32vector(3, [11, -22, 33])
+ s = pmt.pmt_serialize_str(v)
+ d = pmt.pmt_deserialize_str(s)
+ self.assertTrue(pmt.pmt_equal(v, d))
+
+ def test11(self):
+ v = pmt.pmt_init_c32vector(3, [11 + -101j, -22 + 202j, 33 + -303j])
+ s = pmt.pmt_serialize_str(v)
+ d = pmt.pmt_deserialize_str(s)
+ self.assertTrue(pmt.pmt_equal(v, d))
+
+ def test12(self):
+ v = pmt.pmt_init_c64vector(3, [11 + -101j, -22 + 202j, 33 + -303j])
+ s = pmt.pmt_serialize_str(v)
+ d = pmt.pmt_deserialize_str(s)
+ self.assertTrue(pmt.pmt_equal(v, d))
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/gruel/src/python/qa_pmt_to_python.py b/gruel/src/python/qa_pmt_to_python.py
new file mode 100755
index 000000000..c63403a52
--- /dev/null
+++ b/gruel/src/python/qa_pmt_to_python.py
@@ -0,0 +1,34 @@
+#!/usr/bin/env python
+#
+# Copyright 2013 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.
+#
+
+import unittest
+import pmt
+
+class test_gruel_pmt_to_python(unittest.TestCase):
+
+ def test01 (self):
+ b = pmt.pmt_from_double(123765)
+ self.assertEqual(pmt.to_python(b), 123765)
+ t = pmt.to_pmt(range(5))
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/gruel/src/swig/CMakeLists.txt b/gruel/src/swig/CMakeLists.txt
new file mode 100644
index 000000000..aeceaa605
--- /dev/null
+++ b/gruel/src/swig/CMakeLists.txt
@@ -0,0 +1,52 @@
+# Copyright 2011-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.
+
+########################################################################
+# Setup swig generation
+########################################################################
+include(GrPython)
+include(GrSwig)
+
+set(GR_SWIG_TARGET_DEPS pmt_generated)
+set(GR_SWIG_INCLUDE_DIRS
+ ${CMAKE_CURRENT_BINARY_DIR}
+ ${GRUEL_INCLUDE_DIRS}
+ ${Boost_INCLUDE_DIRS}
+)
+set(GR_SWIG_LIBRARIES gruel)
+
+set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/pmt_swig_doc.i)
+set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include/gruel ${CMAKE_CURRENT_BINARY_DIR}/../include/gruel)
+
+GR_SWIG_MAKE(pmt_swig pmt_swig.i)
+
+GR_SWIG_INSTALL(
+ TARGETS pmt_swig
+ DESTINATION ${GR_PYTHON_DIR}/gruel/pmt
+ COMPONENT "gruel_python"
+)
+
+install(
+ FILES gr_intrusive_ptr.i pmt_swig.i gruel_common.i
+ ${CMAKE_CURRENT_BINARY_DIR}/pmt_swig_doc.i
+ DESTINATION ${GR_INCLUDE_DIR}/gruel/swig
+ COMPONENT "gruel_swig"
+)
+
+add_custom_target(pmt_swig DEPENDS ${SWIG_MODULE_pmt_swig_REAL_NAME})
diff --git a/gruel/src/swig/__init__.py b/gruel/src/swig/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/gruel/src/swig/__init__.py
diff --git a/gruel/src/swig/gr_intrusive_ptr.i b/gruel/src/swig/gr_intrusive_ptr.i
new file mode 100644
index 000000000..dc6004f44
--- /dev/null
+++ b/gruel/src/swig/gr_intrusive_ptr.i
@@ -0,0 +1,104 @@
+#ifndef SWIG_INTRUSIVE_PTR_NAMESPACE
+
+// This file was borrowed from the SWIG project to allow use to
+// wrap PMTs that use intrusive pointers. This is only necessary
+// to support backwards compatability with older distributions of
+// Linux that do not natively support a new enough version of SWIG.
+// We do this to prevent having to update our dependency on a new
+// SWIG. Eventually, the need for this should go away.
+
+// Allow for different namespaces for shared_ptr / intrusive_ptr - they could be boost or std or std::tr1
+// For example for std::tr1, use:
+// #define SWIG_SHARED_PTR_NAMESPACE std
+// #define SWIG_SHARED_PTR_SUBNAMESPACE tr1
+// #define SWIG_INTRUSIVE_PTR_NAMESPACE boost
+// #define SWIG_INTRUSIVE_PTR_SUBNAMESPACE
+
+#if !defined(SWIG_INTRUSIVE_PTR_NAMESPACE)
+# define SWIG_INTRUSIVE_PTR_NAMESPACE boost
+#endif
+
+#if defined(SWIG_INTRUSIVE_PTR_SUBNAMESPACE)
+# define SWIG_INTRUSIVE_PTR_QNAMESPACE SWIG_INTRUSIVE_PTR_NAMESPACE::SWIG_INTRUSIVE_PTR_SUBNAMESPACE
+#else
+# define SWIG_INTRUSIVE_PTR_QNAMESPACE SWIG_INTRUSIVE_PTR_NAMESPACE
+#endif
+
+namespace SWIG_INTRUSIVE_PTR_NAMESPACE {
+#if defined(SWIG_INTRUSIVE_PTR_SUBNAMESPACE)
+ namespace SWIG_INTRUSIVE_PTR_SUBNAMESPACE {
+#endif
+ template <class T> class intrusive_ptr {
+ };
+#if defined(SWIG_INTRUSIVE_PTR_SUBNAMESPACE)
+ }
+#endif
+}
+
+%fragment("SWIG_intrusive_deleter", "header") {
+template<class T> struct SWIG_intrusive_deleter {
+ void operator()(T *p) {
+ if (p)
+ intrusive_ptr_release(p);
+ }
+};
+}
+
+%fragment("SWIG_null_deleter", "header") {
+struct SWIG_null_deleter {
+ void operator() (void const *) const {
+ }
+};
+%#define SWIG_NO_NULL_DELETER_0 , SWIG_null_deleter()
+%#define SWIG_NO_NULL_DELETER_1
+}
+
+// Main user macro for defining intrusive_ptr typemaps for both const and non-const pointer types
+// For plain classes, do not use for derived classes
+%define SWIG_INTRUSIVE_PTR(PROXYCLASS, TYPE...)
+SWIG_INTRUSIVE_PTR_TYPEMAPS(PROXYCLASS, , TYPE)
+SWIG_INTRUSIVE_PTR_TYPEMAPS(PROXYCLASS, const, TYPE)
+%enddef
+
+// Main user macro for defining intrusive_ptr typemaps for both const and non-const pointer types
+// For derived classes
+%define SWIG_INTRUSIVE_PTR_DERIVED(PROXYCLASS, BASECLASSTYPE, TYPE...)
+SWIG_INTRUSIVE_PTR_TYPEMAPS(PROXYCLASS, , TYPE)
+SWIG_INTRUSIVE_PTR_TYPEMAPS(PROXYCLASS, const, TYPE)
+%types(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > = SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< BASECLASSTYPE >) %{
+ *newmemory = SWIG_CAST_NEW_MEMORY;
+ return (void *) new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< BASECLASSTYPE >(*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *)$from);
+ %}
+%extend TYPE {
+ static SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< BASECLASSTYPE > SWIGSharedPtrUpcast(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > swigSharedPtrUpcast) {
+ return swigSharedPtrUpcast;
+ }
+}
+%enddef
+
+// Extra user macro for including classes in intrusive_ptr typemaps for both const and non-const pointer types
+// This caters for classes which cannot be wrapped by intrusive_ptrs but are still part of the class hierarchy
+// For plain classes, do not use for derived classes
+%define SWIG_INTRUSIVE_PTR_NO_WRAP(PROXYCLASS, TYPE...)
+SWIG_INTRUSIVE_PTR_TYPEMAPS_NO_WRAP(PROXYCLASS, , TYPE)
+SWIG_INTRUSIVE_PTR_TYPEMAPS_NO_WRAP(PROXYCLASS, const, TYPE)
+%enddef
+
+// Extra user macro for including classes in intrusive_ptr typemaps for both const and non-const pointer types
+// This caters for classes which cannot be wrapped by intrusive_ptrs but are still part of the class hierarchy
+// For derived classes
+%define SWIG_INTRUSIVE_PTR_DERIVED_NO_WRAP(PROXYCLASS, BASECLASSTYPE, TYPE...)
+SWIG_INTRUSIVE_PTR_TYPEMAPS_NO_WRAP(PROXYCLASS, , TYPE)
+SWIG_INTRUSIVE_PTR_TYPEMAPS_NO_WRAP(PROXYCLASS, const, TYPE)
+%types(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > = SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< BASECLASSTYPE >) %{
+ *newmemory = SWIG_CAST_NEW_MEMORY;
+ return (void *) new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< BASECLASSTYPE >(*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *)$from);
+%}
+%extend TYPE {
+ static SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< BASECLASSTYPE > SWIGSharedPtrUpcast(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > swigSharedPtrUpcast) {
+ return swigSharedPtrUpcast;
+ }
+}
+%enddef
+
+#endif //SWIG_INTRUSIVE_PTR_NAMESPACE
diff --git a/gruel/src/swig/gruel_common.i b/gruel/src/swig/gruel_common.i
new file mode 100644
index 000000000..3a4d841d6
--- /dev/null
+++ b/gruel/src/swig/gruel_common.i
@@ -0,0 +1,66 @@
+/*
+ * Copyright 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.
+ */
+
+#ifndef GRUEL_COMMON_I
+#define GRUEL_COMMON_I
+
+////////////////////////////////////////////////////////////////////////
+// Language independent exception handler
+////////////////////////////////////////////////////////////////////////
+%include exception.i
+
+%exception {
+ try {
+ $action
+ }
+ catch(std::exception &e) {
+ SWIG_exception(SWIG_RuntimeError, e.what());
+ }
+ catch(...) {
+ SWIG_exception(SWIG_RuntimeError, "Unknown exception");
+ }
+
+}
+
+////////////////////////////////////////////////////////////////////////
+// Wrapper for python calls that may block
+////////////////////////////////////////////////////////////////////////
+
+/*!
+ * Use GR_PYTHON_BLOCKING_CODE when calling code that blocks.
+ *
+ * The try/catch is to save us from boost::thread::interrupt:
+ * If a thread from the scheduler (or any other boost thread)
+ * is blocking the routine and throws an interrupt exception.
+ */
+%{
+
+#define GR_PYTHON_BLOCKING_CODE(code) { \
+ PyThreadState *_save; \
+ _save = PyEval_SaveThread(); \
+ try{code} \
+ catch(...){PyEval_RestoreThread(_save); throw;} \
+ PyEval_RestoreThread(_save); \
+}
+
+%}
+
+#endif /*GRUEL_COMMON_I*/
diff --git a/gruel/src/swig/pmt_swig.i b/gruel/src/swig/pmt_swig.i
new file mode 100644
index 000000000..84f48b099
--- /dev/null
+++ b/gruel/src/swig/pmt_swig.i
@@ -0,0 +1,792 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2011-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.
+ */
+
+%include "std_string.i"
+%include "stdint.i"
+%{
+#include <boost/intrusive_ptr.hpp>
+#include <boost/shared_ptr.hpp>
+#include <boost/any.hpp>
+#include <complex>
+#include <string>
+#include <stdint.h>
+#include <iosfwd>
+#include <stdexcept>
+#include <gruel/pmt.h>
+%}
+
+%include "gruel_common.i"
+//load generated python docstrings
+%include "pmt_swig_doc.i"
+
+%include <std_complex.i>
+%include <std_vector.i>
+%include <stl.i>
+
+namespace std {
+ %template() vector<unsigned char>;
+ %template() vector<uint8_t>;
+ %template() vector<char>;
+ %template() vector<int8_t>;
+ %template() vector<short>;
+ %template() vector<uint16_t>;
+ %template() vector<int16_t>;
+ %template() vector<int>;
+ %template() vector<int32_t>;
+ %template() vector<uint32_t>;
+ %template() vector<float>;
+ %template() vector<double>;
+ %template() vector< std::complex<float> >;
+ %template() vector< std::complex<double> >;
+};
+
+////////////////////////////////////////////////////////////////////////
+// Language independent exception handler
+////////////////////////////////////////////////////////////////////////
+
+// Template intrusive_ptr for Swig to avoid dereferencing issues
+namespace pmt{
+ class pmt_base;
+}
+//%import <intrusive_ptr.i>
+%import <gr_intrusive_ptr.i>
+%template(swig_int_ptr) boost::intrusive_ptr<pmt::pmt_base>;
+
+namespace pmt{
+
+typedef boost::intrusive_ptr<pmt_base> pmt_t;
+
+/*
+ * ------------------------------------------------------------------------
+ * Booleans. Two constants, #t and #f.
+ *
+ * In predicates, anything that is not #f is considered true.
+ * I.e., there is a single false value, #f.
+ * ------------------------------------------------------------------------
+ */
+extern const pmt_t PMT_T;
+extern const pmt_t PMT_F;
+
+//! Return true if obj is \#t or \#f, else return false.
+bool pmt_is_bool(pmt_t obj);
+
+//! Return false if obj is \#f, else return true.
+bool pmt_is_true(pmt_t obj);
+
+//! Return true if obj is \#f, else return true.
+bool pmt_is_false(pmt_t obj);
+
+//! Return \#f is val is false, else return \#t.
+pmt_t pmt_from_bool(bool val);
+
+//! Return true if val is PMT_T, return false when val is PMT_F,
+// else raise wrong_type exception.
+bool pmt_to_bool(pmt_t val);
+
+/*
+ * ------------------------------------------------------------------------
+ * Symbols
+ * ------------------------------------------------------------------------
+ */
+
+//! Return true if obj is a symbol, else false.
+bool pmt_is_symbol(const pmt_t& obj);
+
+//! Return the symbol whose name is \p s.
+pmt_t pmt_string_to_symbol(const std::string &s);
+
+//! Alias for pmt_string_to_symbol
+pmt_t pmt_intern(const std::string &s);
+
+
+/*!
+ * If \p is a symbol, return the name of the symbol as a string.
+ * Otherwise, raise the wrong_type exception.
+ */
+const std::string pmt_symbol_to_string(const pmt_t& sym);
+
+/*
+ * ------------------------------------------------------------------------
+ * Numbers: we support integer, real and complex
+ * ------------------------------------------------------------------------
+ */
+
+//! Return true if obj is any kind of number, else false.
+bool pmt_is_number(pmt_t obj);
+
+/*
+ * ------------------------------------------------------------------------
+ * Integers
+ * ------------------------------------------------------------------------
+ */
+
+//! Return true if \p x is an integer number, else false
+bool pmt_is_integer(pmt_t x);
+
+//! Return the pmt value that represents the integer \p x.
+pmt_t pmt_from_long(long x);
+
+/*!
+ * \brief Convert pmt to long if possible.
+ *
+ * When \p x represents an exact integer that fits in a long,
+ * return that integer. Else raise an exception, either wrong_type
+ * when x is not an exact integer, or out_of_range when it doesn't fit.
+ */
+long pmt_to_long(pmt_t x);
+
+/*
+ * ------------------------------------------------------------------------
+ * uint64_t
+ * ------------------------------------------------------------------------
+ */
+
+//! Return true if \p x is an uint64 number, else false
+bool pmt_is_uint64(pmt_t x);
+
+//! Return the pmt value that represents the uint64 \p x.
+pmt_t pmt_from_uint64(uint64_t x);
+
+/*!
+ * \brief Convert pmt to uint64 if possible.
+ *
+ * When \p x represents an exact integer that fits in a uint64,
+ * return that uint64. Else raise an exception, either wrong_type
+ * when x is not an exact uint64, or out_of_range when it doesn't fit.
+ */
+uint64_t pmt_to_uint64(pmt_t x);
+
+/*
+ * ------------------------------------------------------------------------
+ * Reals
+ * ------------------------------------------------------------------------
+ */
+
+/*
+ * \brief Return true if \p obj is a real number, else false.
+ */
+bool pmt_is_real(pmt_t obj);
+
+//! Return the pmt value that represents double \p x.
+pmt_t pmt_from_double(double x);
+
+/*!
+ * \brief Convert pmt to double if possible.
+ *
+ * Returns the number closest to \p val that is representable
+ * as a double. The argument \p val must be a real or integer, otherwise
+ * a wrong_type exception is raised.
+ */
+double pmt_to_double(pmt_t x);
+
+/*
+ * ------------------------------------------------------------------------
+ * Complex
+ * ------------------------------------------------------------------------
+ */
+
+/*!
+ * \brief return true if \p obj is a complex number, false otherwise.
+ */
+bool pmt_is_complex(pmt_t obj);
+
+//! Return a complex number constructed of the given real and imaginary parts.
+pmt_t pmt_make_rectangular(double re, double im);
+
+pmt_t pmt_from_complex(const std::complex<double> &z);
+
+/*!
+ * If \p z is complex, real or integer, return the closest complex<double>.
+ * Otherwise, raise the wrong_type exception.
+ */
+std::complex<double> pmt_to_complex(pmt_t z);
+
+/*
+ * ------------------------------------------------------------------------
+ * Pairs
+ * ------------------------------------------------------------------------
+ */
+
+extern const pmt_t PMT_NIL; //< the empty list
+
+//! Return true if \p x is the empty list, otherwise return false.
+bool pmt_is_null(const pmt_t& x);
+
+//! Return true if \p obj is a pair, else false.
+bool pmt_is_pair(const pmt_t& obj);
+
+//! Return a newly allocated pair whose car is \p x and whose cdr is \p y.
+pmt_t pmt_cons(const pmt_t& x, const pmt_t& y);
+
+//! If \p pair is a pair, return the car of the \p pair, otherwise raise wrong_type.
+pmt_t pmt_car(const pmt_t& pair);
+
+//! If \p pair is a pair, return the cdr of the \p pair, otherwise raise wrong_type.
+pmt_t pmt_cdr(const pmt_t& pair);
+
+//! Stores \p value in the car field of \p pair.
+void pmt_set_car(pmt_t pair, pmt_t value);
+
+//! Stores \p value in the cdr field of \p pair.
+void pmt_set_cdr(pmt_t pair, pmt_t value);
+
+pmt_t pmt_caar(pmt_t pair);
+pmt_t pmt_cadr(pmt_t pair);
+pmt_t pmt_cdar(pmt_t pair);
+pmt_t pmt_cddr(pmt_t pair);
+pmt_t pmt_caddr(pmt_t pair);
+pmt_t pmt_cadddr(pmt_t pair);
+
+/*
+ * ------------------------------------------------------------------------
+ * Tuples
+ *
+ * Store a fixed number of objects. Tuples are not modifiable, and thus
+ * are excellent for use as messages. Indexing is zero based.
+ * Access time to an element is O(1).
+ * ------------------------------------------------------------------------
+ */
+
+//! Return true if \p x is a tuple, othewise false.
+bool pmt_is_tuple(pmt_t x);
+
+pmt_t pmt_make_tuple();
+pmt_t pmt_make_tuple(const pmt_t &e0);
+pmt_t pmt_make_tuple(const pmt_t &e0, const pmt_t &e1);
+pmt_t pmt_make_tuple(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2);
+pmt_t pmt_make_tuple(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3);
+pmt_t pmt_make_tuple(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4);
+pmt_t pmt_make_tuple(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4, const pmt_t &e5);
+pmt_t pmt_make_tuple(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4, const pmt_t &e5, const pmt_t &e6);
+pmt_t pmt_make_tuple(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4, const pmt_t &e5, const pmt_t &e6, const pmt_t &e7);
+pmt_t pmt_make_tuple(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4, const pmt_t &e5, const pmt_t &e6, const pmt_t &e7, const pmt_t &e8);
+pmt_t pmt_make_tuple(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4, const pmt_t &e5, const pmt_t &e6, const pmt_t &e7, const pmt_t &e8, const pmt_t &e9);
+
+/*!
+ * If \p x is a vector or proper list, return a tuple containing the elements of x
+ */
+pmt_t pmt_to_tuple(const pmt_t &x);
+
+/*!
+ * Return the contents of position \p k of \p tuple.
+ * \p k must be a valid index of \p tuple.
+ */
+pmt_t pmt_tuple_ref(const pmt_t &tuple, size_t k);
+
+/*
+ * ------------------------------------------------------------------------
+ * Vectors
+ *
+ * These vectors can hold any kind of objects. Indexing is zero based.
+ * ------------------------------------------------------------------------
+ */
+
+//! Return true if \p x is a vector, othewise false.
+bool pmt_is_vector(pmt_t x);
+
+//! Make a vector of length \p k, with initial values set to \p fill
+pmt_t pmt_make_vector(size_t k, pmt_t fill);
+
+/*!
+ * Return the contents of position \p k of \p vector.
+ * \p k must be a valid index of \p vector.
+ */
+pmt_t pmt_vector_ref(pmt_t vector, size_t k);
+
+//! Store \p obj in position \p k.
+void pmt_vector_set(pmt_t vector, size_t k, pmt_t obj);
+
+//! Store \p fill in every position of \p vector
+void pmt_vector_fill(pmt_t vector, pmt_t fill);
+
+/*
+ * ------------------------------------------------------------------------
+ * Binary Large Objects (BLOBs)
+ *
+ * Handy for passing around uninterpreted chunks of memory.
+ * ------------------------------------------------------------------------
+ */
+
+//! Return true if \p x is a blob, othewise false.
+bool pmt_is_blob(pmt_t x);
+
+/*!
+ * \brief Make a blob given a pointer and length in bytes
+ *
+ * \param buf is the pointer to data to use to create blob
+ * \param len is the size of the data in bytes.
+ *
+ * The data is copied into the blob.
+ */
+pmt_t pmt_make_blob(const void *buf, size_t len);
+
+//! Return a pointer to the blob's data
+const void *pmt_blob_data(pmt_t blob);
+
+//! Return the blob's length in bytes
+size_t pmt_blob_length(pmt_t blob);
+
+/*!
+ * <pre>
+ * ------------------------------------------------------------------------
+ * Uniform Numeric Vectors
+ *
+ * A uniform numeric vector is a vector whose elements are all of single
+ * numeric type. pmt offers uniform numeric vectors for signed and
+ * unsigned 8-bit, 16-bit, 32-bit, and 64-bit integers, two sizes of
+ * floating point values, and complex floating-point numbers of these
+ * two sizes. Indexing is zero based.
+ *
+ * The names of the functions include these tags in their names:
+ *
+ * u8 unsigned 8-bit integers
+ * s8 signed 8-bit integers
+ * u16 unsigned 16-bit integers
+ * s16 signed 16-bit integers
+ * u32 unsigned 32-bit integers
+ * s32 signed 32-bit integers
+ * u64 unsigned 64-bit integers
+ * s64 signed 64-bit integers
+ * f32 the C++ type float
+ * f64 the C++ type double
+ * c32 the C++ type complex<float>
+ * c64 the C++ type complex<double>
+ * ------------------------------------------------------------------------
+ * </pre>
+ */
+
+//! true if \p x is any kind of uniform numeric vector
+bool pmt_is_uniform_vector(pmt_t x);
+
+bool pmt_is_u8vector(pmt_t x);
+bool pmt_is_s8vector(pmt_t x);
+bool pmt_is_u16vector(pmt_t x);
+bool pmt_is_s16vector(pmt_t x);
+bool pmt_is_u32vector(pmt_t x);
+bool pmt_is_s32vector(pmt_t x);
+bool pmt_is_u64vector(pmt_t x);
+bool pmt_is_s64vector(pmt_t x);
+bool pmt_is_f32vector(pmt_t x);
+bool pmt_is_f64vector(pmt_t x);
+bool pmt_is_c32vector(pmt_t x);
+bool pmt_is_c64vector(pmt_t x);
+
+pmt_t pmt_make_u8vector(size_t k, uint8_t fill);
+pmt_t pmt_make_s8vector(size_t k, int8_t fill);
+pmt_t pmt_make_u16vector(size_t k, uint16_t fill);
+pmt_t pmt_make_s16vector(size_t k, int16_t fill);
+pmt_t pmt_make_u32vector(size_t k, uint32_t fill);
+pmt_t pmt_make_s32vector(size_t k, int32_t fill);
+pmt_t pmt_make_u64vector(size_t k, uint64_t fill);
+pmt_t pmt_make_s64vector(size_t k, int64_t fill);
+pmt_t pmt_make_f32vector(size_t k, float fill);
+pmt_t pmt_make_f64vector(size_t k, double fill);
+pmt_t pmt_make_c32vector(size_t k, std::complex<float> fill);
+pmt_t pmt_make_c64vector(size_t k, std::complex<double> fill);
+
+
+pmt_t pmt_init_u8vector(size_t k, const std::vector<uint8_t> &data);
+pmt_t pmt_init_s8vector(size_t k, const std::vector<int8_t> &data);
+pmt_t pmt_init_u16vector(size_t k, const std::vector<uint16_t> &data);
+pmt_t pmt_init_s16vector(size_t k, const std::vector<int16_t> &data);
+pmt_t pmt_init_u32vector(size_t k, const std::vector<uint32_t> &data);
+pmt_t pmt_init_s32vector(size_t k, const std::vector<int32_t> &data);
+pmt_t pmt_init_f32vector(size_t k, const std::vector<float> &data);
+pmt_t pmt_init_f64vector(size_t k, const std::vector<double> &data);
+pmt_t pmt_init_c32vector(size_t k, const std::vector<std::complex<float> > &data);
+pmt_t pmt_init_c64vector(size_t k, const std::vector<std::complex<double> > &data);
+
+uint8_t pmt_u8vector_ref(pmt_t v, size_t k);
+int8_t pmt_s8vector_ref(pmt_t v, size_t k);
+uint16_t pmt_u16vector_ref(pmt_t v, size_t k);
+int16_t pmt_s16vector_ref(pmt_t v, size_t k);
+uint32_t pmt_u32vector_ref(pmt_t v, size_t k);
+int32_t pmt_s32vector_ref(pmt_t v, size_t k);
+uint64_t pmt_u64vector_ref(pmt_t v, size_t k);
+int64_t pmt_s64vector_ref(pmt_t v, size_t k);
+float pmt_f32vector_ref(pmt_t v, size_t k);
+double pmt_f64vector_ref(pmt_t v, size_t k);
+std::complex<float> pmt_c32vector_ref(pmt_t v, size_t k);
+std::complex<double> pmt_c64vector_ref(pmt_t v, size_t k);
+
+void pmt_u8vector_set(pmt_t v, size_t k, uint8_t x); //< v[k] = x
+void pmt_s8vector_set(pmt_t v, size_t k, int8_t x);
+void pmt_u16vector_set(pmt_t v, size_t k, uint16_t x);
+void pmt_s16vector_set(pmt_t v, size_t k, int16_t x);
+void pmt_u32vector_set(pmt_t v, size_t k, uint32_t x);
+void pmt_s32vector_set(pmt_t v, size_t k, int32_t x);
+void pmt_u64vector_set(pmt_t v, size_t k, uint64_t x);
+void pmt_s64vector_set(pmt_t v, size_t k, int64_t x);
+void pmt_f32vector_set(pmt_t v, size_t k, float x);
+void pmt_f64vector_set(pmt_t v, size_t k, double x);
+void pmt_c32vector_set(pmt_t v, size_t k, std::complex<float> x);
+void pmt_c64vector_set(pmt_t v, size_t k, std::complex<double> x);
+
+// Return const pointers to the elements
+
+%apply size_t & INOUT { size_t &len };
+
+// works with any; len is in bytes
+// Returns an opaque Python type
+const void *pmt_uniform_vector_elements(pmt_t v, size_t &len);
+
+// Returns a Python tuple
+const std::vector<uint8_t> pmt_u8vector_elements(pmt_t v);
+const std::vector<int8_t> pmt_s8vector_elements(pmt_t v);
+const std::vector<uint16_t> pmt_u16vector_elements(pmt_t v);
+const std::vector<int16_t> pmt_s16vector_elements(pmt_t v);
+const std::vector<uint32_t> pmt_u32vector_elements(pmt_t v);
+const std::vector<int32_t> pmt_s32vector_elements(pmt_t v);
+const std::vector<float> pmt_f32vector_elements(pmt_t v);
+const std::vector<double> pmt_f64vector_elements(pmt_t v);
+const std::vector<std::complex<float> > pmt_c32vector_elements(pmt_t v);
+const std::vector<std::complex<double> > pmt_c64vector_elements(pmt_t v);
+
+/*
+ * ------------------------------------------------------------------------
+ * Dictionary (a.k.a associative array, hash, map)
+ *
+ * This is a functional data structure that is persistent. Updating a
+ * functional data structure does not destroy the existing version, but
+ * rather creates a new version that coexists with the old.
+ * ------------------------------------------------------------------------
+ */
+
+//! Return true if \p obj is a dictionary
+bool pmt_is_dict(const pmt_t &obj);
+
+//! Make an empty dictionary
+pmt_t pmt_make_dict();
+
+//! Return a new dictionary with \p key associated with \p value.
+pmt_t pmt_dict_add(const pmt_t &dict, const pmt_t &key, const pmt_t &value);
+
+//! Return a new dictionary with \p key removed.
+pmt_t pmt_dict_delete(const pmt_t &dict, const pmt_t &key);
+
+//! Return true if \p key exists in \p dict
+bool pmt_dict_has_key(const pmt_t &dict, const pmt_t &key);
+
+//! If \p key exists in \p dict, return associated value; otherwise return \p not_found.
+pmt_t pmt_dict_ref(const pmt_t &dict, const pmt_t &key, const pmt_t &not_found);
+
+//! Return list of (key . value) pairs
+pmt_t pmt_dict_items(pmt_t dict);
+
+//! Return list of keys
+pmt_t pmt_dict_keys(pmt_t dict);
+
+//! Return list of values
+pmt_t pmt_dict_values(pmt_t dict);
+
+/*
+ * ------------------------------------------------------------------------
+ * Any (wraps boost::any -- can be used to wrap pretty much anything)
+ *
+ * Cannot be serialized or used across process boundaries.
+ * See http://www.boost.org/doc/html/any.html
+ * ------------------------------------------------------------------------
+ */
+
+//! Return true if \p obj is an any
+bool pmt_is_any(pmt_t obj);
+
+//! make an any
+pmt_t pmt_make_any(const boost::any &any);
+
+//! Return underlying boost::any
+boost::any pmt_any_ref(pmt_t obj);
+
+//! Store \p any in \p obj
+void pmt_any_set(pmt_t obj, const boost::any &any);
+
+
+/*
+ * ------------------------------------------------------------------------
+ * msg_accepter -- pmt representation of gruel::msg_accepter
+ * ------------------------------------------------------------------------
+ */
+//! Return true if \p obj is a msg_accepter
+bool pmt_is_msg_accepter(const pmt_t &obj);
+
+//! make a msg_accepter
+pmt_t pmt_make_msg_accepter(boost::shared_ptr<gruel::msg_accepter> ma);
+
+//! Return underlying msg_accepter
+boost::shared_ptr<gruel::msg_accepter> pmt_msg_accepter_ref(const pmt_t &obj);
+
+/*
+ * ------------------------------------------------------------------------
+ * General functions
+ * ------------------------------------------------------------------------
+ */
+
+//! Return true if x and y are the same object; otherwise return false.
+bool pmt_eq(const pmt_t& x, const pmt_t& y);
+
+/*!
+ * \brief Return true if x and y should normally be regarded as the same object, else false.
+ *
+ * <pre>
+ * eqv returns true if:
+ * x and y are the same object.
+ * x and y are both \#t or both \#f.
+ * x and y are both symbols and their names are the same.
+ * x and y are both numbers, and are numerically equal.
+ * x and y are both the empty list (nil).
+ * x and y are pairs or vectors that denote same location in store.
+ * </pre>
+ */
+bool pmt_eqv(const pmt_t& x, const pmt_t& y);
+
+/*!
+ * pmt_equal recursively compares the contents of pairs and vectors,
+ * applying pmt_eqv on other objects such as numbers and symbols.
+ * pmt_equal may fail to terminate if its arguments are circular data
+ * structures.
+ */
+bool pmt_equal(const pmt_t& x, const pmt_t& y);
+
+
+//! Return the number of elements in v
+size_t pmt_length(const pmt_t& v);
+
+/*!
+ * \brief Find the first pair in \p alist whose car field is \p obj
+ * and return that pair.
+ *
+ * \p alist (for "association list") must be a list of pairs. If no pair
+ * in \p alist has \p obj as its car then \#f is returned.
+ * Uses pmt_eq to compare \p obj with car fields of the pairs in \p alist.
+ */
+pmt_t pmt_assq(pmt_t obj, pmt_t alist);
+
+/*!
+ * \brief Find the first pair in \p alist whose car field is \p obj
+ * and return that pair.
+ *
+ * \p alist (for "association list") must be a list of pairs. If no pair
+ * in \p alist has \p obj as its car then \#f is returned.
+ * Uses pmt_eqv to compare \p obj with car fields of the pairs in \p alist.
+ */
+pmt_t pmt_assv(pmt_t obj, pmt_t alist);
+
+/*!
+ * \brief Find the first pair in \p alist whose car field is \p obj
+ * and return that pair.
+ *
+ * \p alist (for "association list") must be a list of pairs. If no pair
+ * in \p alist has \p obj as its car then \#f is returned.
+ * Uses pmt_equal to compare \p obj with car fields of the pairs in \p alist.
+ */
+pmt_t pmt_assoc(pmt_t obj, pmt_t alist);
+
+/*!
+ * \brief Apply \p proc element-wise to the elements of list and returns
+ * a list of the results, in order.
+ *
+ * \p list must be a list. The dynamic order in which \p proc is
+ * applied to the elements of \p list is unspecified.
+ */
+pmt_t pmt_map(pmt_t proc(const pmt_t&), pmt_t list);
+
+/*!
+ * \brief reverse \p list.
+ *
+ * \p list must be a proper list.
+ */
+pmt_t pmt_reverse(pmt_t list);
+
+/*!
+ * \brief destructively reverse \p list.
+ *
+ * \p list must be a proper list.
+ */
+pmt_t pmt_reverse_x(pmt_t list);
+
+/*!
+ * \brief (acons x y a) == (cons (cons x y) a)
+ */
+inline static pmt_t
+pmt_acons(pmt_t x, pmt_t y, pmt_t a)
+{
+ return pmt_cons(pmt_cons(x, y), a);
+}
+
+/*!
+ * \brief locates \p nth element of \n list where the car is the 'zeroth' element.
+ */
+pmt_t pmt_nth(size_t n, pmt_t list);
+
+/*!
+ * \brief returns the tail of \p list that would be obtained by calling
+ * cdr \p n times in succession.
+ */
+pmt_t pmt_nthcdr(size_t n, pmt_t list);
+
+/*!
+ * \brief Return the first sublist of \p list whose car is \p obj.
+ * If \p obj does not occur in \p list, then \#f is returned.
+ * pmt_memq use pmt_eq to compare \p obj with the elements of \p list.
+ */
+pmt_t pmt_memq(pmt_t obj, pmt_t list);
+
+/*!
+ * \brief Return the first sublist of \p list whose car is \p obj.
+ * If \p obj does not occur in \p list, then \#f is returned.
+ * pmt_memv use pmt_eqv to compare \p obj with the elements of \p list.
+ */
+pmt_t pmt_memv(pmt_t obj, pmt_t list);
+
+/*!
+ * \brief Return the first sublist of \p list whose car is \p obj.
+ * If \p obj does not occur in \p list, then \#f is returned.
+ * pmt_member use pmt_equal to compare \p obj with the elements of \p list.
+ */
+pmt_t pmt_member(pmt_t obj, pmt_t list);
+
+/*!
+ * \brief Return true if every element of \p list1 appears in \p list2, and false otherwise.
+ * Comparisons are done with pmt_eqv.
+ */
+bool pmt_subsetp(pmt_t list1, pmt_t list2);
+
+/*!
+ * \brief Return a list of length 1 containing \p x1
+ */
+pmt_t pmt_list1(const pmt_t& x1);
+
+/*!
+ * \brief Return a list of length 2 containing \p x1, \p x2
+ */
+pmt_t pmt_list2(const pmt_t& x1, const pmt_t& x2);
+
+/*!
+ * \brief Return a list of length 3 containing \p x1, \p x2, \p x3
+ */
+pmt_t pmt_list3(const pmt_t& x1, const pmt_t& x2, const pmt_t& x3);
+
+/*!
+ * \brief Return a list of length 4 containing \p x1, \p x2, \p x3, \p x4
+ */
+pmt_t pmt_list4(const pmt_t& x1, const pmt_t& x2, const pmt_t& x3, const pmt_t& x4);
+
+/*!
+ * \brief Return a list of length 5 containing \p x1, \p x2, \p x3, \p x4, \p x5
+ */
+pmt_t pmt_list5(const pmt_t& x1, const pmt_t& x2, const pmt_t& x3, const pmt_t& x4, const pmt_t& x5);
+
+/*!
+ * \brief Return a list of length 6 containing \p x1, \p x2, \p x3, \p x4, \p
+ * x5, \p x6
+ */
+pmt_t pmt_list6(const pmt_t& x1, const pmt_t& x2, const pmt_t& x3, const pmt_t& x4, const pmt_t& x5, const pmt_t& x6);
+
+/*!
+ * \brief Return \p list with \p item added to it.
+ */
+pmt_t pmt_list_add(pmt_t list, const pmt_t& item);
+
+/*!
+ * \brief Return \p list with \p item removed
+ */
+pmt_t pmt_list_rm(pmt_t list, const pmt_t& item);
+
+/*!
+ * \brief Return bool of \p list contains \p item
+ */
+bool pmt_list_has(pmt_t list, const pmt_t& item);
+
+/*
+ * ------------------------------------------------------------------------
+ * read / write
+ * ------------------------------------------------------------------------
+ */
+extern const pmt_t PMT_EOF; //< The end of file object
+
+//! return true if obj is the EOF object, otherwise return false.
+bool pmt_is_eof_object(pmt_t obj);
+
+/*!
+ * read converts external representations of pmt objects into the
+ * objects themselves. Read returns the next object parsable from
+ * the given input port, updating port to point to the first
+ * character past the end of the external representation of the
+ * object.
+ *
+ * If an end of file is encountered in the input before any
+ * characters are found that can begin an object, then an end of file
+ * object is returned. The port remains open, and further attempts
+ * to read will also return an end of file object. If an end of file
+ * is encountered after the beginning of an object's external
+ * representation, but the external representation is incomplete and
+ * therefore not parsable, an error is signaled.
+ */
+pmt_t pmt_read(std::istream &port);
+
+/*!
+ * Write a written representation of \p obj to the given \p port.
+ */
+void pmt_write(pmt_t obj, std::ostream &port);
+
+/*!
+ * Return a string representation of \p obj.
+ * This is the same output as would be generated by pmt_write.
+ */
+std::string pmt_write_string(pmt_t obj);
+
+
+/*!
+ * \brief Write pmt string representation to stdout.
+ */
+void pmt_print(pmt_t v);
+
+
+/*
+ * ------------------------------------------------------------------------
+ * portable byte stream representation
+ * ------------------------------------------------------------------------
+ */
+/*!
+ * \brief Write portable byte-serial representation of \p obj to \p sink
+ */
+bool pmt_serialize(pmt_t obj, std::streambuf &sink);
+
+/*!
+ * \brief Create obj from portable byte-serial representation
+ */
+pmt_t pmt_deserialize(std::streambuf &source);
+
+
+void pmt_dump_sizeof(); // debugging
+
+/*!
+ * \brief Provide a simple string generating interface to pmt's serialize function
+ */
+std::string pmt_serialize_str(pmt_t obj);
+
+/*!
+ * \brief Provide a simple string generating interface to pmt's deserialize function
+ */
+pmt_t pmt_deserialize_str(std::string str);
+
+} //namespace pmt
diff --git a/volk/CMakeLists.txt b/volk/CMakeLists.txt
new file mode 100644
index 000000000..a66c9ca30
--- /dev/null
+++ b/volk/CMakeLists.txt
@@ -0,0 +1,138 @@
+#
+# Copyright 2011 Free Software Foundation, Inc.
+#
+# This program 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 of the License, or
+# (at your option) any later version.
+#
+# This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
+#
+
+########################################################################
+# Project setup
+########################################################################
+cmake_minimum_required(VERSION 2.6)
+if(NOT DEFINED CMAKE_BUILD_TYPE)
+ set(CMAKE_BUILD_TYPE Release)
+endif()
+set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "Choose build type: None Debug Release RelWithDebInfo MinSizeRel")
+project(volk)
+enable_language(CXX)
+enable_language(C)
+enable_testing()
+set(VERSION 0.1)
+set(LIBVER 0.0.0)
+
+set(CMAKE_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) #allows this to be a sub-project
+set(CMAKE_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) #allows this to be a sub-project
+set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) #location for custom "Modules"
+
+########################################################################
+# Environment setup
+########################################################################
+IF(NOT DEFINED BOOST_ROOT)
+ SET(BOOST_ROOT ${CMAKE_INSTALL_PREFIX})
+ENDIF()
+
+IF(NOT DEFINED CROSSCOMPILE_MULTILIB)
+ SET(CROSSCOMPILE_MULTILIB "")
+ENDIF()
+SET(CROSSCOMPILE_MULTILIB ${CROSSCOMPILE_MULTILIB} CACHE STRING "Define \"true\" if you have and want to use multiple C development libs installed for cross compile")
+
+
+########################################################################
+# Dependencies setup
+########################################################################
+include(GrPython) #sets PYTHON_EXECUTABLE and PYTHON_DASH_B
+GR_PYTHON_CHECK_MODULE("python >= 2.5" sys "sys.version.split()[0] >= '2.5'" PYTHON_MIN_VER_FOUND)
+GR_PYTHON_CHECK_MODULE("Cheetah >= 2.0.0" Cheetah "Cheetah.Version >= '2.0.0'" CHEETAH_FOUND)
+
+if(NOT PYTHON_MIN_VER_FOUND)
+ message(FATAL_ERROR "Python 2.5 or greater required to build VOLK")
+endif()
+
+if(NOT CHEETAH_FOUND)
+ message(FATAL_ERROR "Cheetah templates required to build VOLK")
+endif()
+
+if(MSVC)
+ if (NOT DEFINED BOOST_ALL_DYN_LINK)
+ set(BOOST_ALL_DYN_LINK TRUE)
+ endif()
+ set(BOOST_ALL_DYN_LINK "${BOOST_ALL_DYN_LINK}" CACHE BOOL "boost enable dynamic linking")
+ if(BOOST_ALL_DYN_LINK)
+ add_definitions(-DBOOST_ALL_DYN_LINK) #setup boost auto-linking in msvc
+ else(BOOST_ALL_DYN_LINK)
+ unset(BOOST_REQUIRED_COMPONENTS) #empty components list for static link
+ endif(BOOST_ALL_DYN_LINK)
+endif(MSVC)
+include(GrBoost)
+
+if(NOT Boost_FOUND)
+ message(FATAL_ERROR "VOLK Requires boost to build")
+endif()
+
+find_package(ORC)
+
+########################################################################
+# Setup the package config file
+########################################################################
+#set variables found in the pc.in file
+set(prefix ${CMAKE_INSTALL_PREFIX})
+set(exec_prefix "\${prefix}")
+set(libdir "\${exec_prefix}/lib${LIB_SUFFIX}")
+set(includedir "\${prefix}/include")
+
+configure_file(
+ ${CMAKE_CURRENT_SOURCE_DIR}/volk.pc.in
+ ${CMAKE_CURRENT_BINARY_DIR}/volk.pc
+@ONLY)
+
+install(
+ FILES ${CMAKE_CURRENT_BINARY_DIR}/volk.pc
+ DESTINATION lib${LIB_SUFFIX}/pkgconfig
+ COMPONENT "volk_devel"
+)
+
+########################################################################
+# Install all headers in the include directories
+########################################################################
+install(
+ DIRECTORY ${CMAKE_SOURCE_DIR}/kernels/volk
+ DESTINATION include COMPONENT "volk_devel"
+ FILES_MATCHING PATTERN "*.h"
+)
+
+install(FILES
+ ${CMAKE_SOURCE_DIR}/include/volk/volk_prefs.h
+ ${CMAKE_SOURCE_DIR}/include/volk/volk_complex.h
+ ${CMAKE_SOURCE_DIR}/include/volk/volk_common.h
+ ${CMAKE_BINARY_DIR}/include/volk/volk.h
+ ${CMAKE_BINARY_DIR}/include/volk/volk_cpu.h
+ ${CMAKE_BINARY_DIR}/include/volk/volk_config_fixed.h
+ ${CMAKE_BINARY_DIR}/include/volk/volk_typedefs.h
+ DESTINATION include/volk
+ COMPONENT "volk_devel"
+)
+
+########################################################################
+# Setup the library
+########################################################################
+add_subdirectory(lib)
+
+########################################################################
+# And the utility apps
+########################################################################
+add_subdirectory(apps)
+
+########################################################################
+# Print summary
+########################################################################
+message(STATUS "Using install prefix: ${CMAKE_INSTALL_PREFIX}")
diff --git a/volk/apps/CMakeLists.txt b/volk/apps/CMakeLists.txt
new file mode 100644
index 000000000..f847dd624
--- /dev/null
+++ b/volk/apps/CMakeLists.txt
@@ -0,0 +1,49 @@
+#
+# Copyright 2011-2013 Free Software Foundation, Inc.
+#
+# This program 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 of the License, or
+# (at your option) any later version.
+#
+# This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
+#
+
+########################################################################
+# Setup profiler
+########################################################################
+if(Boost_FOUND)
+
+if(MSVC)
+ include_directories(${CMAKE_SOURCE_DIR}/cmake/msvc)
+endif(MSVC)
+
+include_directories(
+ ${CMAKE_CURRENT_SOURCE_DIR}
+ ${CMAKE_CURRENT_BINARY_DIR}
+ ${CMAKE_SOURCE_DIR}/include
+ ${CMAKE_BINARY_DIR}/include
+ ${CMAKE_SOURCE_DIR}/lib
+ ${Boost_INCLUDE_DIRS}
+)
+
+add_executable(volk_profile
+ ${CMAKE_CURRENT_SOURCE_DIR}/volk_profile.cc
+ ${CMAKE_SOURCE_DIR}/lib/qa_utils.cc
+)
+
+target_link_libraries(volk_profile volk ${Boost_LIBRARIES})
+
+install(
+ TARGETS volk_profile
+ DESTINATION bin
+ COMPONENT "volk"
+)
+
+endif(Boost_FOUND)
diff --git a/volk/apps/volk_profile.cc b/volk/apps/volk_profile.cc
new file mode 100644
index 000000000..fa89a93bf
--- /dev/null
+++ b/volk/apps/volk_profile.cc
@@ -0,0 +1,138 @@
+#include "qa_utils.h"
+
+#include <volk/volk.h>
+#include <volk/volk_prefs.h>
+
+#include <ciso646>
+#include <vector>
+#include <boost/foreach.hpp>
+#include <boost/filesystem.hpp>
+#include <iostream>
+#include <fstream>
+#include <sys/stat.h>
+#include <sys/types.h>
+
+namespace fs = boost::filesystem;
+
+int main(int argc, char *argv[]) {
+
+ std::vector<std::string> results;
+
+ //VOLK_PROFILE(volk_16i_x5_add_quad_16i_x4, 1e-4, 2046, 10000, &results);
+ //VOLK_PROFILE(volk_16i_branch_4_state_8, 1e-4, 2046, 10000, &results);
+ VOLK_PUPPET_PROFILE(volk_32fc_s32fc_rotatorpuppet_32fc, volk_32fc_s32fc_x2_rotator_32fc, 1e-2, (lv_32fc_t)lv_cmake(.95393, .3), 20460, 10000, &results);
+ VOLK_PROFILE(volk_16ic_s32f_deinterleave_real_32f, 1e-5, 32768.0, 204600, 10000, &results);
+ VOLK_PROFILE(volk_16ic_deinterleave_real_8i, 0, 0, 204600, 10000, &results);
+ VOLK_PROFILE(volk_16ic_deinterleave_16i_x2, 0, 0, 204600, 10000, &results);
+ VOLK_PROFILE(volk_16ic_s32f_deinterleave_32f_x2, 1e-4, 32768.0, 204600, 1000, &results);
+ VOLK_PROFILE(volk_16ic_deinterleave_real_16i, 0, 0, 204600, 10000, &results);
+ VOLK_PROFILE(volk_16ic_magnitude_16i, 1, 0, 204600, 100, &results);
+ VOLK_PROFILE(volk_16ic_s32f_magnitude_32f, 1e-5, 32768.0, 204600, 1000, &results);
+ VOLK_PROFILE(volk_16i_s32f_convert_32f, 1e-4, 32768.0, 204600, 10000, &results);
+ VOLK_PROFILE(volk_16i_convert_8i, 0, 0, 204600, 10000, &results);
+ //VOLK_PROFILE(volk_16i_max_star_16i, 0, 0, 204600, 10000, &results);
+ //VOLK_PROFILE(volk_16i_max_star_horizontal_16i, 0, 0, 204600, 10000, &results);
+ //VOLK_PROFILE(volk_16i_permute_and_scalar_add, 1e-4, 0, 2046, 10000, &results);
+ //VOLK_PROFILE(volk_16i_x4_quad_max_star_16i, 1e-4, 0, 2046, 10000, &results);
+ VOLK_PROFILE(volk_16u_byteswap, 0, 0, 204600, 10000, &results);
+ VOLK_PROFILE(volk_16i_32fc_dot_prod_32fc, 1e-4, 0, 204600, 10000, &results);
+ VOLK_PROFILE(volk_32f_accumulator_s32f, 1e-4, 0, 204600, 10000, &results);
+ VOLK_PROFILE(volk_32f_x2_add_32f, 1e-4, 0, 204600, 10000, &results);
+ VOLK_PROFILE(volk_32fc_32f_multiply_32fc, 1e-4, 0, 204600, 1000, &results);
+ VOLK_PROFILE(volk_32fc_s32f_power_32fc, 1e-4, 0, 204600, 50, &results);
+ VOLK_PROFILE(volk_32f_s32f_calc_spectral_noise_floor_32f, 1e-4, 20.0, 204600, 1000, &results);
+ VOLK_PROFILE(volk_32fc_s32f_atan2_32f, 1e-4, 10.0, 204600, 100, &results);
+ //VOLK_PROFILE(volk_32fc_x2_conjugate_dot_prod_32fc, 1e-4, 0, 2046, 10000, &results);
+ VOLK_PROFILE(volk_32fc_x2_conjugate_dot_prod_32fc, 1e-4, 0, 204600, 10000, &results);
+ VOLK_PROFILE(volk_32fc_deinterleave_32f_x2, 1e-4, 0, 204600, 1000, &results);
+ VOLK_PROFILE(volk_32fc_deinterleave_64f_x2, 1e-4, 0, 204600, 1000, &results);
+ VOLK_PROFILE(volk_32fc_s32f_deinterleave_real_16i, 0, 32768, 204600, 10000, &results);
+ VOLK_PROFILE(volk_32fc_deinterleave_imag_32f, 1e-4, 0, 204600, 5000, &results);
+ VOLK_PROFILE(volk_32fc_deinterleave_real_32f, 1e-4, 0, 204600, 5000, &results);
+ VOLK_PROFILE(volk_32fc_deinterleave_real_64f, 1e-4, 0, 204600, 1000, &results);
+ VOLK_PROFILE(volk_32fc_x2_dot_prod_32fc, 1e-4, 0, 204600, 10000, &results);
+ VOLK_PROFILE(volk_32fc_32f_dot_prod_32fc, 1e-4, 0, 204600, 10000, &results);
+ VOLK_PROFILE(volk_32fc_index_max_16u, 3, 0, 204600, 10000, &results);
+ VOLK_PROFILE(volk_32fc_s32f_magnitude_16i, 1, 32768, 204600, 100, &results);
+ VOLK_PROFILE(volk_32fc_magnitude_32f, 1e-4, 0, 204600, 1000, &results);
+ VOLK_PROFILE(volk_32fc_magnitude_squared_32f, 1e-4, 0, 204600, 1000, &results);
+ VOLK_PROFILE(volk_32fc_x2_multiply_32fc, 1e-4, 0, 204600, 1000, &results);
+ VOLK_PROFILE(volk_32fc_x2_multiply_conjugate_32fc, 1e-4, 0, 204600, 1000, &results);
+ VOLK_PROFILE(volk_32fc_conjugate_32fc, 1e-4, 0, 204600, 1000, &results);
+ VOLK_PROFILE(volk_32f_s32f_convert_16i, 1, 32768, 204600, 10000, &results);
+ VOLK_PROFILE(volk_32f_s32f_convert_32i, 1, 2<<31, 204600, 10000, &results);
+ VOLK_PROFILE(volk_32f_convert_64f, 1e-4, 0, 204600, 10000, &results);
+ VOLK_PROFILE(volk_32f_s32f_convert_8i, 1, 128, 204600, 10000, &results);
+ //VOLK_PROFILE(volk_32fc_s32f_x2_power_spectral_density_32f, 1e-4, 2046, 10000, &results);
+ VOLK_PROFILE(volk_32fc_s32f_power_spectrum_32f, 1e-4, 0, 20460, 100, &results);
+ VOLK_PROFILE(volk_32fc_x2_square_dist_32f, 1e-4, 0, 204600, 10000, &results);
+ VOLK_PROFILE(volk_32fc_x2_s32f_square_dist_scalar_mult_32f, 1e-4, 10, 204600, 10000, &results);
+ VOLK_PROFILE(volk_32f_x2_divide_32f, 1e-4, 0, 204600, 2000, &results);
+ VOLK_PROFILE(volk_32f_x2_dot_prod_32f, 1e-4, 0, 204600, 5000, &results);
+ VOLK_PROFILE(volk_32f_x2_dot_prod_16i, 1e-4, 0, 204600, 5000, &results);
+ //VOLK_PROFILE(volk_32f_s32f_32f_fm_detect_32f, 1e-4, 2046, 10000, &results);
+ VOLK_PROFILE(volk_32f_index_max_16u, 3, 0, 204600, 5000, &results);
+ VOLK_PROFILE(volk_32f_x2_s32f_interleave_16ic, 1, 32768, 204600, 3000, &results);
+ VOLK_PROFILE(volk_32f_x2_interleave_32fc, 0, 0, 204600, 5000, &results);
+ VOLK_PROFILE(volk_32f_x2_max_32f, 1e-4, 0, 204600, 2000, &results);
+ VOLK_PROFILE(volk_32f_x2_min_32f, 1e-4, 0, 204600, 2000, &results);
+ VOLK_PROFILE(volk_32f_x2_multiply_32f, 1e-4, 0, 204600, 10000, &results);
+ VOLK_PROFILE(volk_32f_s32f_normalize, 1e-4, 100, 204600, 10000, &results);
+ VOLK_PROFILE(volk_32f_s32f_power_32f, 1e-4, 4, 204600, 100, &results);
+ VOLK_PROFILE(volk_32f_sqrt_32f, 1e-4, 0, 204600, 100, &results);
+ VOLK_PROFILE(volk_32f_s32f_stddev_32f, 1e-4, 100, 204600, 3000, &results);
+ VOLK_PROFILE(volk_32f_stddev_and_mean_32f_x2, 1e-4, 0, 204600, 3000, &results);
+ VOLK_PROFILE(volk_32f_x2_subtract_32f, 1e-4, 0, 204600, 5000, &results);
+ VOLK_PROFILE(volk_32f_x3_sum_of_poly_32f, 1e-4, 0, 204600, 5000, &results);
+ VOLK_PROFILE(volk_32i_x2_and_32i, 0, 0, 204600, 10000, &results);
+ VOLK_PROFILE(volk_32i_s32f_convert_32f, 1e-4, 100, 204600, 10000, &results);
+ VOLK_PROFILE(volk_32i_x2_or_32i, 0, 0, 204600, 10000, &results);
+ VOLK_PROFILE(volk_32u_byteswap, 0, 0, 204600, 2000, &results);
+ //VOLK_PROFILE(volk_32u_popcnt, 0, 0, 2046, 10000, &results);
+ VOLK_PROFILE(volk_64f_convert_32f, 1e-4, 0, 204600, 10000, &results);
+ VOLK_PROFILE(volk_64f_x2_max_64f, 1e-4, 0, 204600, 1000, &results);
+ VOLK_PROFILE(volk_64f_x2_min_64f, 1e-4, 0, 204600, 1000, &results);
+ VOLK_PROFILE(volk_64u_byteswap, 0, 0, 204600, 1000, &results);
+ //VOLK_PROFILE(volk_64u_popcnt, 0, 0, 2046, 10000, &results);
+ VOLK_PROFILE(volk_8ic_deinterleave_16i_x2, 0, 0, 204600, 3000, &results);
+ VOLK_PROFILE(volk_8ic_s32f_deinterleave_32f_x2, 1e-4, 100, 204600, 3000, &results);
+ VOLK_PROFILE(volk_8ic_deinterleave_real_16i, 0, 256, 204600, 3000, &results);
+ VOLK_PROFILE(volk_8ic_s32f_deinterleave_real_32f, 1e-4, 100, 204600, 3000, &results);
+ VOLK_PROFILE(volk_8ic_deinterleave_real_8i, 0, 0, 204600, 10000, &results);
+ VOLK_PROFILE(volk_8ic_x2_multiply_conjugate_16ic, 0, 0, 204600, 400, &results);
+ VOLK_PROFILE(volk_8ic_x2_s32f_multiply_conjugate_32fc, 1e-4, 100, 204600, 400, &results);
+ VOLK_PROFILE(volk_8i_convert_16i, 0, 0, 204600, 20000, &results);
+ VOLK_PROFILE(volk_8i_convert_16i, 0, 0, 204600, 2000, &results);
+ VOLK_PROFILE(volk_8i_s32f_convert_32f, 1e-4, 100, 204600, 2000, &results);
+ //VOLK_PROFILE(volk_32fc_s32fc_multiply_32fc, 1e-4, lv_32fc_t(1.0, 0.5), 204600, 1000, &results);
+ VOLK_PROFILE(volk_32fc_s32fc_multiply_32fc, 1e-4, 0, 204600, 1000, &results);
+ VOLK_PROFILE(volk_32f_s32f_multiply_32f, 1e-4, 1.0, 204600, 10000, &results);
+ VOLK_PROFILE(volk_32f_s32f_multiply_32f, 1e-4, 0, 204600, 1000, &results);
+
+
+ char path[1024];
+ volk_get_config_path(path);
+ const fs::path config_path(path);
+
+ if (not fs::exists(config_path.branch_path()))
+ {
+ std::cout << "Creating " << config_path.branch_path() << "..." << std::endl;
+ fs::create_directories(config_path.branch_path());
+ }
+
+ std::cout << "Writing " << config_path << "..." << std::endl;
+ std::ofstream config(config_path.string().c_str());
+ if(!config.is_open()) { //either we don't have write access or we don't have the dir yet
+ std::cout << "Error opening file " << config_path << std::endl;
+ }
+
+ config << "\
+#this file is generated by volk_profile.\n\
+#the function name is followed by the preferred architecture.\n\
+";
+
+ BOOST_FOREACH(std::string result, results) {
+ config << result << std::endl;
+ }
+ config.close();
+}
diff --git a/volk/cmake/FindORC.cmake b/volk/cmake/FindORC.cmake
new file mode 100644
index 000000000..a5f35c465
--- /dev/null
+++ b/volk/cmake/FindORC.cmake
@@ -0,0 +1,36 @@
+FIND_PACKAGE(PkgConfig)
+PKG_CHECK_MODULES(PC_ORC "orc-0.4 > 0.4.11")
+
+
+
+
+FIND_PROGRAM(ORCC_EXECUTABLE orcc
+ HINTS ${PC_ORC_TOOLSDIR}
+ PATHS ${ORC_ROOT}/bin ${CMAKE_INSTALL_PREFIX}/bin)
+
+FIND_PATH(ORC_INCLUDE_DIR NAMES orc/orc.h
+ HINTS ${PC_ORC_INCLUDEDIR}
+ PATHS ${ORC_ROOT}/include/orc-0.4 ${CMAKE_INSTALL_PREFIX}/include/orc-0.4)
+
+
+FIND_PATH(ORC_LIBRARY_DIR NAMES ${CMAKE_SHARED_LIBRARY_PREFIX}orc-0.4${CMAKE_SHARED_LIBRARY_SUFFIX}
+ HINTS ${PC_ORC_LIBDIR}
+ PATHS ${ORC_ROOT}/lib${LIB_SUFFIX} ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX})
+
+FIND_LIBRARY(ORC_LIB orc-0.4
+ HINTS ${PC_ORC_LIBRARY_DIRS}
+ PATHS ${ORC_ROOT}/lib${LIB_SUFFIX} ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX})
+
+LIST(APPEND ORC_LIBRARY
+ ${ORC_LIB}
+)
+
+
+SET(ORC_INCLUDE_DIRS ${ORC_INCLUDE_DIR})
+SET(ORC_LIBRARIES ${ORC_LIBRARY})
+SET(ORC_LIBRARY_DIRS ${ORC_LIBRARY_DIR})
+
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(ORC "orc files" ORC_LIBRARY ORC_INCLUDE_DIR ORCC_EXECUTABLE)
+
+mark_as_advanced(ICE_INCLUDE_DIR ICE_LIBRARY ORCC_EXECUTABLE)
diff --git a/volk/cmake/GrBoost.cmake b/volk/cmake/GrBoost.cmake
new file mode 100644
index 000000000..57db9db37
--- /dev/null
+++ b/volk/cmake/GrBoost.cmake
@@ -0,0 +1,97 @@
+# 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.
+
+if(DEFINED __INCLUDED_GR_BOOST_CMAKE)
+ return()
+endif()
+set(__INCLUDED_GR_BOOST_CMAKE TRUE)
+
+########################################################################
+# Setup Boost and handle some system specific things
+########################################################################
+
+set(BOOST_REQUIRED_COMPONENTS
+ filesystem
+ system
+ unit_test_framework
+)
+
+if(UNIX AND NOT BOOST_ROOT AND EXISTS "/usr/lib64")
+ list(APPEND BOOST_LIBRARYDIR "/usr/lib64") #fedora 64-bit fix
+endif(UNIX AND NOT BOOST_ROOT AND EXISTS "/usr/lib64")
+
+if(MSVC)
+ set(BOOST_REQUIRED_COMPONENTS ${BOOST_REQUIRED_COMPONENTS} chrono)
+
+ if (NOT DEFINED BOOST_ALL_DYN_LINK)
+ set(BOOST_ALL_DYN_LINK TRUE)
+ endif()
+ set(BOOST_ALL_DYN_LINK "${BOOST_ALL_DYN_LINK}" CACHE BOOL "boost enable dynamic linking")
+ if(BOOST_ALL_DYN_LINK)
+ add_definitions(-DBOOST_ALL_DYN_LINK) #setup boost auto-linking in msvc
+ else(BOOST_ALL_DYN_LINK)
+ unset(BOOST_REQUIRED_COMPONENTS) #empty components list for static link
+ endif(BOOST_ALL_DYN_LINK)
+endif(MSVC)
+
+find_package(Boost "1.35" COMPONENTS ${BOOST_REQUIRED_COMPONENTS})
+
+# This does not allow us to disable specific versions. It is used
+# internally by cmake to know the formation newer versions. As newer
+# Boost version beyond what is shown here are produced, we must extend
+# this list. To disable Boost versions, see below.
+set(Boost_ADDITIONAL_VERSIONS
+ "1.35.0" "1.35" "1.36.0" "1.36" "1.37.0" "1.37" "1.38.0" "1.38" "1.39.0" "1.39"
+ "1.40.0" "1.40" "1.41.0" "1.41" "1.42.0" "1.42" "1.43.0" "1.43" "1.44.0" "1.44"
+ "1.45.0" "1.45" "1.46.0" "1.46" "1.47.0" "1.47" "1.48.0" "1.48" "1.49.0" "1.49"
+ "1.50.0" "1.50" "1.51.0" "1.51" "1.52.0" "1.52" "1.53.0" "1.53" "1.54.0" "1.54"
+ "1.55.0" "1.55" "1.56.0" "1.56" "1.57.0" "1.57" "1.58.0" "1.58" "1.59.0" "1.59"
+ "1.60.0" "1.60" "1.61.0" "1.61" "1.62.0" "1.62" "1.63.0" "1.63" "1.64.0" "1.64"
+ "1.65.0" "1.65" "1.66.0" "1.66" "1.67.0" "1.67" "1.68.0" "1.68" "1.69.0" "1.69"
+)
+
+# Boost 1.52 disabled, see https://svn.boost.org/trac/boost/ticket/7669
+# Similar problems with Boost 1.46 and 1.47.
+
+OPTION(ENABLE_BAD_BOOST "Enable known bad versions of Boost" OFF)
+if(ENABLE_BAD_BOOST)
+ MESSAGE(STATUS "Enabling use of known bad versions of Boost.")
+endif(ENABLE_BAD_BOOST)
+
+# For any unsuitable Boost version, add the version number below in
+# the following format: XXYYZZ
+# Where:
+# XX is the major version ('10' for version 1)
+# YY is the minor version number ('46' for 1.46)
+# ZZ is the patcher version number (typically just '00')
+set(Boost_NOGO_VERSIONS
+ 104600 104601 104700 105200
+ )
+
+foreach(ver ${Boost_NOGO_VERSIONS})
+ if(${Boost_VERSION} EQUAL ${ver})
+ if(NOT ENABLE_BAD_BOOST)
+ MESSAGE(STATUS "WARNING: Found a known bad version of Boost (v${Boost_VERSION}). Disabling.")
+ set(Boost_FOUND FALSE)
+ else(NOT ENABLE_BAD_BOOST)
+ MESSAGE(STATUS "WARNING: Found a known bad version of Boost (v${Boost_VERSION}). Continuing anyway.")
+ set(Boost_FOUND TRUE)
+ endif(NOT ENABLE_BAD_BOOST)
+ endif(${Boost_VERSION} EQUAL ${ver})
+endforeach(ver)
diff --git a/volk/cmake/GrPython.cmake b/volk/cmake/GrPython.cmake
new file mode 100644
index 000000000..eff9cbcdc
--- /dev/null
+++ b/volk/cmake/GrPython.cmake
@@ -0,0 +1,233 @@
+# 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.
+
+if(DEFINED __INCLUDED_GR_PYTHON_CMAKE)
+ return()
+endif()
+set(__INCLUDED_GR_PYTHON_CMAKE TRUE)
+
+########################################################################
+# Setup the python interpreter:
+# This allows the user to specify a specific interpreter,
+# or finds the interpreter via the built-in cmake module.
+########################################################################
+#this allows the user to override PYTHON_EXECUTABLE
+if(PYTHON_EXECUTABLE)
+
+ set(PYTHONINTERP_FOUND TRUE)
+
+#otherwise if not set, try to automatically find it
+else(PYTHON_EXECUTABLE)
+
+ #use the built-in find script
+ find_package(PythonInterp)
+
+ #and if that fails use the find program routine
+ if(NOT PYTHONINTERP_FOUND)
+ find_program(PYTHON_EXECUTABLE NAMES python python2.7 python2.6 python2.5)
+ if(PYTHON_EXECUTABLE)
+ set(PYTHONINTERP_FOUND TRUE)
+ endif(PYTHON_EXECUTABLE)
+ endif(NOT PYTHONINTERP_FOUND)
+
+endif(PYTHON_EXECUTABLE)
+
+#make the path to the executable appear in the cmake gui
+set(PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE} CACHE FILEPATH "python interpreter")
+
+#make sure we can use -B with python (introduced in 2.6)
+if(PYTHON_EXECUTABLE)
+ execute_process(
+ COMMAND ${PYTHON_EXECUTABLE} -B -c ""
+ OUTPUT_QUIET ERROR_QUIET
+ RESULT_VARIABLE PYTHON_HAS_DASH_B_RESULT
+ )
+ if(PYTHON_HAS_DASH_B_RESULT EQUAL 0)
+ set(PYTHON_DASH_B "-B")
+ endif()
+endif(PYTHON_EXECUTABLE)
+
+########################################################################
+# Check for the existence of a python module:
+# - desc a string description of the check
+# - mod the name of the module to import
+# - cmd an additional command to run
+# - have the result variable to set
+########################################################################
+macro(GR_PYTHON_CHECK_MODULE desc mod cmd have)
+ message(STATUS "")
+ message(STATUS "Python checking for ${desc}")
+ execute_process(
+ COMMAND ${PYTHON_EXECUTABLE} -c "
+#########################################
+try: import ${mod}
+except:
+ try: ${mod}
+ except: exit(-1)
+try: assert ${cmd}
+except: exit(-1)
+#########################################"
+ RESULT_VARIABLE ${have}
+ )
+ if(${have} EQUAL 0)
+ message(STATUS "Python checking for ${desc} - found")
+ set(${have} TRUE)
+ else(${have} EQUAL 0)
+ message(STATUS "Python checking for ${desc} - not found")
+ set(${have} FALSE)
+ endif(${have} EQUAL 0)
+endmacro(GR_PYTHON_CHECK_MODULE)
+
+########################################################################
+# Sets the python installation directory GR_PYTHON_DIR
+########################################################################
+execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "
+from distutils import sysconfig
+print sysconfig.get_python_lib(plat_specific=True, prefix='')
+" OUTPUT_VARIABLE GR_PYTHON_DIR OUTPUT_STRIP_TRAILING_WHITESPACE
+)
+file(TO_CMAKE_PATH ${GR_PYTHON_DIR} GR_PYTHON_DIR)
+
+########################################################################
+# Create an always-built target with a unique name
+# Usage: GR_UNIQUE_TARGET(<description> <dependencies list>)
+########################################################################
+function(GR_UNIQUE_TARGET desc)
+ file(RELATIVE_PATH reldir ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR})
+ execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import re, hashlib
+unique = hashlib.md5('${reldir}${ARGN}').hexdigest()[:5]
+print(re.sub('\\W', '_', '${desc} ${reldir} ' + unique))"
+ OUTPUT_VARIABLE _target OUTPUT_STRIP_TRAILING_WHITESPACE)
+ add_custom_target(${_target} ALL DEPENDS ${ARGN})
+endfunction(GR_UNIQUE_TARGET)
+
+########################################################################
+# Install python sources (also builds and installs byte-compiled python)
+########################################################################
+function(GR_PYTHON_INSTALL)
+ include(CMakeParseArgumentsCopy)
+ CMAKE_PARSE_ARGUMENTS(GR_PYTHON_INSTALL "" "DESTINATION;COMPONENT" "FILES;PROGRAMS" ${ARGN})
+
+ ####################################################################
+ if(GR_PYTHON_INSTALL_FILES)
+ ####################################################################
+ install(${ARGN}) #installs regular python files
+
+ #create a list of all generated files
+ unset(pysrcfiles)
+ unset(pycfiles)
+ unset(pyofiles)
+ foreach(pyfile ${GR_PYTHON_INSTALL_FILES})
+ get_filename_component(pyfile ${pyfile} ABSOLUTE)
+ list(APPEND pysrcfiles ${pyfile})
+
+ #determine if this file is in the source or binary directory
+ file(RELATIVE_PATH source_rel_path ${CMAKE_CURRENT_SOURCE_DIR} ${pyfile})
+ string(LENGTH "${source_rel_path}" source_rel_path_len)
+ file(RELATIVE_PATH binary_rel_path ${CMAKE_CURRENT_BINARY_DIR} ${pyfile})
+ string(LENGTH "${binary_rel_path}" binary_rel_path_len)
+
+ #and set the generated path appropriately
+ if(${source_rel_path_len} GREATER ${binary_rel_path_len})
+ set(pygenfile ${CMAKE_CURRENT_BINARY_DIR}/${binary_rel_path})
+ else()
+ set(pygenfile ${CMAKE_CURRENT_BINARY_DIR}/${source_rel_path})
+ endif()
+ list(APPEND pycfiles ${pygenfile}c)
+ list(APPEND pyofiles ${pygenfile}o)
+
+ #ensure generation path exists
+ get_filename_component(pygen_path ${pygenfile} PATH)
+ file(MAKE_DIRECTORY ${pygen_path})
+
+ endforeach(pyfile)
+
+ #the command to generate the pyc files
+ add_custom_command(
+ DEPENDS ${pysrcfiles} OUTPUT ${pycfiles}
+ COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_BINARY_DIR}/python_compile_helper.py ${pysrcfiles} ${pycfiles}
+ )
+
+ #the command to generate the pyo files
+ add_custom_command(
+ DEPENDS ${pysrcfiles} OUTPUT ${pyofiles}
+ COMMAND ${PYTHON_EXECUTABLE} -O ${CMAKE_BINARY_DIR}/python_compile_helper.py ${pysrcfiles} ${pyofiles}
+ )
+
+ #create install rule and add generated files to target list
+ set(python_install_gen_targets ${pycfiles} ${pyofiles})
+ install(FILES ${python_install_gen_targets}
+ DESTINATION ${GR_PYTHON_INSTALL_DESTINATION}
+ COMPONENT ${GR_PYTHON_INSTALL_COMPONENT}
+ )
+
+
+ ####################################################################
+ elseif(GR_PYTHON_INSTALL_PROGRAMS)
+ ####################################################################
+ file(TO_NATIVE_PATH ${PYTHON_EXECUTABLE} pyexe_native)
+
+ if (CMAKE_CROSSCOMPILING)
+ set(pyexe_native /usr/bin/env python)
+ endif()
+
+ foreach(pyfile ${GR_PYTHON_INSTALL_PROGRAMS})
+ get_filename_component(pyfile_name ${pyfile} NAME)
+ get_filename_component(pyfile ${pyfile} ABSOLUTE)
+ string(REPLACE "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" pyexefile "${pyfile}.exe")
+ list(APPEND python_install_gen_targets ${pyexefile})
+
+ get_filename_component(pyexefile_path ${pyexefile} PATH)
+ file(MAKE_DIRECTORY ${pyexefile_path})
+
+ add_custom_command(
+ OUTPUT ${pyexefile} DEPENDS ${pyfile}
+ COMMAND ${PYTHON_EXECUTABLE} -c
+ \"open('${pyexefile}', 'w').write('\#!${pyexe_native}\\n'+open('${pyfile}').read())\"
+ COMMENT "Shebangin ${pyfile_name}"
+ )
+
+ #on windows, python files need an extension to execute
+ get_filename_component(pyfile_ext ${pyfile} EXT)
+ if(WIN32 AND NOT pyfile_ext)
+ set(pyfile_name "${pyfile_name}.py")
+ endif()
+
+ install(PROGRAMS ${pyexefile} RENAME ${pyfile_name}
+ DESTINATION ${GR_PYTHON_INSTALL_DESTINATION}
+ COMPONENT ${GR_PYTHON_INSTALL_COMPONENT}
+ )
+ endforeach(pyfile)
+
+ endif()
+
+ GR_UNIQUE_TARGET("pygen" ${python_install_gen_targets})
+
+endfunction(GR_PYTHON_INSTALL)
+
+########################################################################
+# Write the python helper script that generates byte code files
+########################################################################
+file(WRITE ${CMAKE_BINARY_DIR}/python_compile_helper.py "
+import sys, py_compile
+files = sys.argv[1:]
+srcs, gens = files[:len(files)/2], files[len(files)/2:]
+for src, gen in zip(srcs, gens):
+ py_compile.compile(file=src, cfile=gen, doraise=True)
+")
diff --git a/volk/cmake/msvc/config.h b/volk/cmake/msvc/config.h
new file mode 100644
index 000000000..43792c783
--- /dev/null
+++ b/volk/cmake/msvc/config.h
@@ -0,0 +1,58 @@
+#ifndef _MSC_VER // [
+#error "Use this header only with Microsoft Visual C++ compilers!"
+#endif // _MSC_VER ]
+
+#ifndef _MSC_CONFIG_H_ // [
+#define _MSC_CONFIG_H_
+
+////////////////////////////////////////////////////////////////////////
+// enable inline functions for C code
+////////////////////////////////////////////////////////////////////////
+#ifndef __cplusplus
+# define inline __inline
+#endif
+
+////////////////////////////////////////////////////////////////////////
+// signed size_t
+////////////////////////////////////////////////////////////////////////
+#include <stddef.h>
+typedef ptrdiff_t ssize_t;
+
+////////////////////////////////////////////////////////////////////////
+// rint functions
+////////////////////////////////////////////////////////////////////////
+#include <math.h>
+static inline long lrint(double x){return (long)(x > 0.0 ? x + 0.5 : x - 0.5);}
+static inline long lrintf(float x){return (long)(x > 0.0f ? x + 0.5f : x - 0.5f);}
+static inline long long llrint(double x){return (long long)(x > 0.0 ? x + 0.5 : x - 0.5);}
+static inline long long llrintf(float x){return (long long)(x > 0.0f ? x + 0.5f : x - 0.5f);}
+static inline double rint(double x){return (x > 0.0)? floor(x + 0.5) : ceil(x - 0.5);}
+static inline float rintf(float x){return (x > 0.0f)? floorf(x + 0.5f) : ceilf(x - 0.5f);}
+
+////////////////////////////////////////////////////////////////////////
+// math constants
+////////////////////////////////////////////////////////////////////////
+#define INFINITY HUGE_VAL
+
+# define M_E 2.7182818284590452354 /* e */
+# define M_LOG2E 1.4426950408889634074 /* log_2 e */
+# define M_LOG10E 0.43429448190325182765 /* log_10 e */
+# define M_LN2 0.69314718055994530942 /* log_e 2 */
+# define M_LN10 2.30258509299404568402 /* log_e 10 */
+# define M_PI 3.14159265358979323846 /* pi */
+# define M_PI_2 1.57079632679489661923 /* pi/2 */
+# define M_PI_4 0.78539816339744830962 /* pi/4 */
+# define M_1_PI 0.31830988618379067154 /* 1/pi */
+# define M_2_PI 0.63661977236758134308 /* 2/pi */
+# define M_2_SQRTPI 1.12837916709551257390 /* 2/sqrt(pi) */
+# define M_SQRT2 1.41421356237309504880 /* sqrt(2) */
+# define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */
+
+////////////////////////////////////////////////////////////////////////
+// random and srandom
+////////////////////////////////////////////////////////////////////////
+#include <stdlib.h>
+static inline long int random (void) { return rand(); }
+static inline void srandom (unsigned int seed) { srand(seed); }
+
+#endif // _MSC_CONFIG_H_ ]
diff --git a/volk/cmake/msvc/inttypes.h b/volk/cmake/msvc/inttypes.h
new file mode 100644
index 000000000..0a1b60fc1
--- /dev/null
+++ b/volk/cmake/msvc/inttypes.h
@@ -0,0 +1,301 @@
+// ISO C9x compliant inttypes.h for Microsoft Visual Studio
+// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124
+//
+// Copyright (c) 2006 Alexander Chemeris
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+//
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+//
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// 3. The name of the author may be used to endorse or promote products
+// derived from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _MSC_VER // [
+#error "Use this header only with Microsoft Visual C++ compilers!"
+#endif // _MSC_VER ]
+
+#ifndef _MSC_INTTYPES_H_ // [
+#define _MSC_INTTYPES_H_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif
+
+#include <stdint.h>
+
+// 7.8 Format conversion of integer types
+
+typedef struct {
+ intmax_t quot;
+ intmax_t rem;
+} imaxdiv_t;
+
+// 7.8.1 Macros for format specifiers
+
+// The fprintf macros for signed integers are:
+#define PRId8 "d"
+#define PRIi8 "i"
+#define PRIdLEAST8 "d"
+#define PRIiLEAST8 "i"
+#define PRIdFAST8 "d"
+#define PRIiFAST8 "i"
+
+#define PRId16 "hd"
+#define PRIi16 "hi"
+#define PRIdLEAST16 "hd"
+#define PRIiLEAST16 "hi"
+#define PRIdFAST16 "hd"
+#define PRIiFAST16 "hi"
+
+#define PRId32 "I32d"
+#define PRIi32 "I32i"
+#define PRIdLEAST32 "I32d"
+#define PRIiLEAST32 "I32i"
+#define PRIdFAST32 "I32d"
+#define PRIiFAST32 "I32i"
+
+#define PRId64 "I64d"
+#define PRIi64 "I64i"
+#define PRIdLEAST64 "I64d"
+#define PRIiLEAST64 "I64i"
+#define PRIdFAST64 "I64d"
+#define PRIiFAST64 "I64i"
+
+#define PRIdMAX "I64d"
+#define PRIiMAX "I64i"
+
+#define PRIdPTR "Id"
+#define PRIiPTR "Ii"
+
+// The fprintf macros for unsigned integers are:
+#define PRIo8 "o"
+#define PRIu8 "u"
+#define PRIx8 "x"
+#define PRIX8 "X"
+#define PRIoLEAST8 "o"
+#define PRIuLEAST8 "u"
+#define PRIxLEAST8 "x"
+#define PRIXLEAST8 "X"
+#define PRIoFAST8 "o"
+#define PRIuFAST8 "u"
+#define PRIxFAST8 "x"
+#define PRIXFAST8 "X"
+
+#define PRIo16 "ho"
+#define PRIu16 "hu"
+#define PRIx16 "hx"
+#define PRIX16 "hX"
+#define PRIoLEAST16 "ho"
+#define PRIuLEAST16 "hu"
+#define PRIxLEAST16 "hx"
+#define PRIXLEAST16 "hX"
+#define PRIoFAST16 "ho"
+#define PRIuFAST16 "hu"
+#define PRIxFAST16 "hx"
+#define PRIXFAST16 "hX"
+
+#define PRIo32 "I32o"
+#define PRIu32 "I32u"
+#define PRIx32 "I32x"
+#define PRIX32 "I32X"
+#define PRIoLEAST32 "I32o"
+#define PRIuLEAST32 "I32u"
+#define PRIxLEAST32 "I32x"
+#define PRIXLEAST32 "I32X"
+#define PRIoFAST32 "I32o"
+#define PRIuFAST32 "I32u"
+#define PRIxFAST32 "I32x"
+#define PRIXFAST32 "I32X"
+
+#define PRIo64 "I64o"
+#define PRIu64 "I64u"
+#define PRIx64 "I64x"
+#define PRIX64 "I64X"
+#define PRIoLEAST64 "I64o"
+#define PRIuLEAST64 "I64u"
+#define PRIxLEAST64 "I64x"
+#define PRIXLEAST64 "I64X"
+#define PRIoFAST64 "I64o"
+#define PRIuFAST64 "I64u"
+#define PRIxFAST64 "I64x"
+#define PRIXFAST64 "I64X"
+
+#define PRIoMAX "I64o"
+#define PRIuMAX "I64u"
+#define PRIxMAX "I64x"
+#define PRIXMAX "I64X"
+
+#define PRIoPTR "Io"
+#define PRIuPTR "Iu"
+#define PRIxPTR "Ix"
+#define PRIXPTR "IX"
+
+// The fscanf macros for signed integers are:
+#define SCNd8 "d"
+#define SCNi8 "i"
+#define SCNdLEAST8 "d"
+#define SCNiLEAST8 "i"
+#define SCNdFAST8 "d"
+#define SCNiFAST8 "i"
+
+#define SCNd16 "hd"
+#define SCNi16 "hi"
+#define SCNdLEAST16 "hd"
+#define SCNiLEAST16 "hi"
+#define SCNdFAST16 "hd"
+#define SCNiFAST16 "hi"
+
+#define SCNd32 "ld"
+#define SCNi32 "li"
+#define SCNdLEAST32 "ld"
+#define SCNiLEAST32 "li"
+#define SCNdFAST32 "ld"
+#define SCNiFAST32 "li"
+
+#define SCNd64 "I64d"
+#define SCNi64 "I64i"
+#define SCNdLEAST64 "I64d"
+#define SCNiLEAST64 "I64i"
+#define SCNdFAST64 "I64d"
+#define SCNiFAST64 "I64i"
+
+#define SCNdMAX "I64d"
+#define SCNiMAX "I64i"
+
+#ifdef _WIN64 // [
+# define SCNdPTR "I64d"
+# define SCNiPTR "I64i"
+#else // _WIN64 ][
+# define SCNdPTR "ld"
+# define SCNiPTR "li"
+#endif // _WIN64 ]
+
+// The fscanf macros for unsigned integers are:
+#define SCNo8 "o"
+#define SCNu8 "u"
+#define SCNx8 "x"
+#define SCNX8 "X"
+#define SCNoLEAST8 "o"
+#define SCNuLEAST8 "u"
+#define SCNxLEAST8 "x"
+#define SCNXLEAST8 "X"
+#define SCNoFAST8 "o"
+#define SCNuFAST8 "u"
+#define SCNxFAST8 "x"
+#define SCNXFAST8 "X"
+
+#define SCNo16 "ho"
+#define SCNu16 "hu"
+#define SCNx16 "hx"
+#define SCNX16 "hX"
+#define SCNoLEAST16 "ho"
+#define SCNuLEAST16 "hu"
+#define SCNxLEAST16 "hx"
+#define SCNXLEAST16 "hX"
+#define SCNoFAST16 "ho"
+#define SCNuFAST16 "hu"
+#define SCNxFAST16 "hx"
+#define SCNXFAST16 "hX"
+
+#define SCNo32 "lo"
+#define SCNu32 "lu"
+#define SCNx32 "lx"
+#define SCNX32 "lX"
+#define SCNoLEAST32 "lo"
+#define SCNuLEAST32 "lu"
+#define SCNxLEAST32 "lx"
+#define SCNXLEAST32 "lX"
+#define SCNoFAST32 "lo"
+#define SCNuFAST32 "lu"
+#define SCNxFAST32 "lx"
+#define SCNXFAST32 "lX"
+
+#define SCNo64 "I64o"
+#define SCNu64 "I64u"
+#define SCNx64 "I64x"
+#define SCNX64 "I64X"
+#define SCNoLEAST64 "I64o"
+#define SCNuLEAST64 "I64u"
+#define SCNxLEAST64 "I64x"
+#define SCNXLEAST64 "I64X"
+#define SCNoFAST64 "I64o"
+#define SCNuFAST64 "I64u"
+#define SCNxFAST64 "I64x"
+#define SCNXFAST64 "I64X"
+
+#define SCNoMAX "I64o"
+#define SCNuMAX "I64u"
+#define SCNxMAX "I64x"
+#define SCNXMAX "I64X"
+
+#ifdef _WIN64 // [
+# define SCNoPTR "I64o"
+# define SCNuPTR "I64u"
+# define SCNxPTR "I64x"
+# define SCNXPTR "I64X"
+#else // _WIN64 ][
+# define SCNoPTR "lo"
+# define SCNuPTR "lu"
+# define SCNxPTR "lx"
+# define SCNXPTR "lX"
+#endif // _WIN64 ]
+
+// 7.8.2 Functions for greatest-width integer types
+
+// 7.8.2.1 The imaxabs function
+#define imaxabs _abs64
+
+// 7.8.2.2 The imaxdiv function
+
+// This is modified version of div() function from Microsoft's div.c found
+// in %MSVC.NET%\crt\src\div.c
+#ifdef STATIC_IMAXDIV // [
+static
+#else // STATIC_IMAXDIV ][
+_inline
+#endif // STATIC_IMAXDIV ]
+imaxdiv_t __cdecl imaxdiv(intmax_t numer, intmax_t denom)
+{
+ imaxdiv_t result;
+
+ result.quot = numer / denom;
+ result.rem = numer % denom;
+
+ if (numer < 0 && result.rem > 0) {
+ // did division wrong; must fix up
+ ++result.quot;
+ result.rem -= denom;
+ }
+
+ return result;
+}
+
+// 7.8.2.3 The strtoimax and strtoumax functions
+#define strtoimax _strtoi64
+#define strtoumax _strtoui64
+
+// 7.8.2.4 The wcstoimax and wcstoumax functions
+#define wcstoimax _wcstoi64
+#define wcstoumax _wcstoui64
+
+
+#endif // _MSC_INTTYPES_H_ ]
diff --git a/volk/cmake/msvc/stdbool.h b/volk/cmake/msvc/stdbool.h
new file mode 100644
index 000000000..ca4581d37
--- /dev/null
+++ b/volk/cmake/msvc/stdbool.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2005, 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef STDBOOL_WIN32_H
+#define STDBOOL_WIN32_H
+
+#ifndef _MSC_VER // [
+#error "Use this header only with Microsoft Visual C++ compilers!"
+#endif // _MSC_VER ]
+
+#ifndef __cplusplus
+
+typedef unsigned char bool;
+
+#define true 1
+#define false 0
+
+#ifndef CASSERT
+#define CASSERT(exp, name) typedef int dummy##name [(exp) ? 1 : -1];
+#endif
+
+CASSERT(sizeof(bool) == 1, bool_is_one_byte)
+CASSERT(true, true_is_true)
+CASSERT(!false, false_is_false)
+
+#endif
+
+#endif
diff --git a/volk/cmake/msvc/stdint.h b/volk/cmake/msvc/stdint.h
new file mode 100644
index 000000000..108bc8982
--- /dev/null
+++ b/volk/cmake/msvc/stdint.h
@@ -0,0 +1,251 @@
+// ISO C9x compliant stdint.h for Microsoft Visual Studio
+// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124
+//
+// Copyright (c) 2006-2008 Alexander Chemeris
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+//
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+//
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// 3. The name of the author may be used to endorse or promote products
+// derived from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _MSC_VER // [
+#error "Use this header only with Microsoft Visual C++ compilers!"
+#endif // _MSC_VER ]
+
+#ifndef _MSC_STDINT_H_ // [
+#define _MSC_STDINT_H_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif
+
+#include <limits.h>
+
+// For Visual Studio 6 in C++ mode and for many Visual Studio versions when
+// compiling for ARM we should wrap <wchar.h> include with 'extern "C++" {}'
+// or compiler give many errors like this:
+// error C2733: second C linkage of overloaded function 'wmemchr' not allowed
+#ifdef __cplusplus
+extern "C" {
+#endif
+# include <wchar.h>
+#ifdef __cplusplus
+}
+#endif
+
+// Define _W64 macros to mark types changing their size, like intptr_t.
+#ifndef _W64
+# if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300
+# define _W64 __w64
+# else
+# define _W64
+# endif
+#endif
+
+
+// 7.18.1 Integer types
+
+// 7.18.1.1 Exact-width integer types
+
+// Visual Studio 6 and Embedded Visual C++ 4 doesn't
+// realize that, e.g. char has the same size as __int8
+// so we give up on __intX for them.
+#if (_MSC_VER < 1300)
+ typedef signed char int8_t;
+ typedef signed short int16_t;
+ typedef signed int int32_t;
+ typedef unsigned char uint8_t;
+ typedef unsigned short uint16_t;
+ typedef unsigned int uint32_t;
+#else
+ typedef signed __int8 int8_t;
+ typedef signed __int16 int16_t;
+ typedef signed __int32 int32_t;
+ typedef unsigned __int8 uint8_t;
+ typedef unsigned __int16 uint16_t;
+ typedef unsigned __int32 uint32_t;
+#endif
+typedef signed __int64 int64_t;
+typedef unsigned __int64 uint64_t;
+
+
+// 7.18.1.2 Minimum-width integer types
+typedef int8_t int_least8_t;
+typedef int16_t int_least16_t;
+typedef int32_t int_least32_t;
+typedef int64_t int_least64_t;
+typedef uint8_t uint_least8_t;
+typedef uint16_t uint_least16_t;
+typedef uint32_t uint_least32_t;
+typedef uint64_t uint_least64_t;
+
+// 7.18.1.3 Fastest minimum-width integer types
+typedef int8_t int_fast8_t;
+typedef int16_t int_fast16_t;
+typedef int32_t int_fast32_t;
+typedef int64_t int_fast64_t;
+typedef uint8_t uint_fast8_t;
+typedef uint16_t uint_fast16_t;
+typedef uint32_t uint_fast32_t;
+typedef uint64_t uint_fast64_t;
+
+// 7.18.1.4 Integer types capable of holding object pointers
+#ifdef _WIN64 // [
+ typedef signed __int64 intptr_t;
+ typedef unsigned __int64 uintptr_t;
+#else // _WIN64 ][
+ typedef _W64 signed int intptr_t;
+ typedef _W64 unsigned int uintptr_t;
+#endif // _WIN64 ]
+
+// 7.18.1.5 Greatest-width integer types
+typedef int64_t intmax_t;
+typedef uint64_t uintmax_t;
+
+
+// 7.18.2 Limits of specified-width integer types
+
+#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) // [ See footnote 220 at page 257 and footnote 221 at page 259
+
+// 7.18.2.1 Limits of exact-width integer types
+#define INT8_MIN ((int8_t)_I8_MIN)
+#define INT8_MAX _I8_MAX
+#define INT16_MIN ((int16_t)_I16_MIN)
+#define INT16_MAX _I16_MAX
+#define INT32_MIN ((int32_t)_I32_MIN)
+#define INT32_MAX _I32_MAX
+#define INT64_MIN ((int64_t)_I64_MIN)
+#define INT64_MAX _I64_MAX
+#define UINT8_MAX _UI8_MAX
+#define UINT16_MAX _UI16_MAX
+#define UINT32_MAX _UI32_MAX
+#define UINT64_MAX _UI64_MAX
+
+// 7.18.2.2 Limits of minimum-width integer types
+#define INT_LEAST8_MIN INT8_MIN
+#define INT_LEAST8_MAX INT8_MAX
+#define INT_LEAST16_MIN INT16_MIN
+#define INT_LEAST16_MAX INT16_MAX
+#define INT_LEAST32_MIN INT32_MIN
+#define INT_LEAST32_MAX INT32_MAX
+#define INT_LEAST64_MIN INT64_MIN
+#define INT_LEAST64_MAX INT64_MAX
+#define UINT_LEAST8_MAX UINT8_MAX
+#define UINT_LEAST16_MAX UINT16_MAX
+#define UINT_LEAST32_MAX UINT32_MAX
+#define UINT_LEAST64_MAX UINT64_MAX
+
+// 7.18.2.3 Limits of fastest minimum-width integer types
+#define INT_FAST8_MIN INT8_MIN
+#define INT_FAST8_MAX INT8_MAX
+#define INT_FAST16_MIN INT16_MIN
+#define INT_FAST16_MAX INT16_MAX
+#define INT_FAST32_MIN INT32_MIN
+#define INT_FAST32_MAX INT32_MAX
+#define INT_FAST64_MIN INT64_MIN
+#define INT_FAST64_MAX INT64_MAX
+#define UINT_FAST8_MAX UINT8_MAX
+#define UINT_FAST16_MAX UINT16_MAX
+#define UINT_FAST32_MAX UINT32_MAX
+#define UINT_FAST64_MAX UINT64_MAX
+
+// 7.18.2.4 Limits of integer types capable of holding object pointers
+#ifdef _WIN64 // [
+# define INTPTR_MIN INT64_MIN
+# define INTPTR_MAX INT64_MAX
+# define UINTPTR_MAX UINT64_MAX
+#else // _WIN64 ][
+# define INTPTR_MIN INT32_MIN
+# define INTPTR_MAX INT32_MAX
+# define UINTPTR_MAX UINT32_MAX
+#endif // _WIN64 ]
+
+// 7.18.2.5 Limits of greatest-width integer types
+#define INTMAX_MIN INT64_MIN
+#define INTMAX_MAX INT64_MAX
+#define UINTMAX_MAX UINT64_MAX
+
+// 7.18.3 Limits of other integer types
+
+#ifdef _WIN64 // [
+# define PTRDIFF_MIN _I64_MIN
+# define PTRDIFF_MAX _I64_MAX
+#else // _WIN64 ][
+# define PTRDIFF_MIN _I32_MIN
+# define PTRDIFF_MAX _I32_MAX
+#endif // _WIN64 ]
+
+#define SIG_ATOMIC_MIN INT_MIN
+#define SIG_ATOMIC_MAX INT_MAX
+
+#ifndef SIZE_MAX // [
+# ifdef _WIN64 // [
+# define SIZE_MAX _UI64_MAX
+# else // _WIN64 ][
+# define SIZE_MAX _UI32_MAX
+# endif // _WIN64 ]
+#endif // SIZE_MAX ]
+
+// WCHAR_MIN and WCHAR_MAX are also defined in <wchar.h>
+#ifndef WCHAR_MIN // [
+# define WCHAR_MIN 0
+#endif // WCHAR_MIN ]
+#ifndef WCHAR_MAX // [
+# define WCHAR_MAX _UI16_MAX
+#endif // WCHAR_MAX ]
+
+#define WINT_MIN 0
+#define WINT_MAX _UI16_MAX
+
+#endif // __STDC_LIMIT_MACROS ]
+
+
+// 7.18.4 Limits of other integer types
+
+#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) // [ See footnote 224 at page 260
+
+// 7.18.4.1 Macros for minimum-width integer constants
+
+#define INT8_C(val) val##i8
+#define INT16_C(val) val##i16
+#define INT32_C(val) val##i32
+#define INT64_C(val) val##i64
+
+#define UINT8_C(val) val##ui8
+#define UINT16_C(val) val##ui16
+#define UINT32_C(val) val##ui32
+#define UINT64_C(val) val##ui64
+
+// 7.18.4.2 Macros for greatest-width integer constants
+#ifndef INTMAX_C
+#define INTMAX_C INT64_C
+#endif
+#ifndef UINTMAX_C
+#define UINTMAX_C UINT64_C
+#endif
+
+#endif // __STDC_CONSTANT_MACROS ]
+
+
+#endif // _MSC_STDINT_H_ ]
diff --git a/volk/gen/archs.xml b/volk/gen/archs.xml
new file mode 100644
index 000000000..2c9ab41a5
--- /dev/null
+++ b/volk/gen/archs.xml
@@ -0,0 +1,184 @@
+<!-- archs appear in order of significance for blind, de-facto version ordering -->
+<grammar>
+
+<arch name="generic"> <!-- name is required-->
+</arch>
+
+<arch name="altivec">
+ <flag compiler="gnu">-maltivec</flag>
+ <alignment>16</alignment>
+ <check name="has_ppc"></check>
+</arch>
+
+<arch name="neon">
+ <flag compiler="gnu">-mfpu=neon</flag>
+ <flag compiler="gnu">-mfloat-abi=softfp</flag>
+ <flag compiler="gnu">-funsafe-math-optimizations</flag>
+ <alignment>16</alignment>
+ <check name="has_neon"></check>
+</arch>
+
+<arch name="32">
+ <flag compiler="gnu">-m32</flag>
+</arch>
+
+<arch name="64">
+ <check name="check_extended_cpuid">
+ <param>0x80000001</param>
+ </check>
+ <check name="cpuid_x86_bit"> <!-- checks to see if a bit is set -->
+ <param>3</param> <!-- eax, ebx, ecx, [edx] -->
+ <param>0x80000001</param> <!-- cpuid operation -->
+ <param>29</param> <!-- bit shift -->
+ </check>
+ <flag compiler="gnu">-m64</flag>
+</arch>
+
+<arch name="3dnow">
+ <check name="cpuid_x86_bit">
+ <param>3</param>
+ <param>0x80000001</param>
+ <param>31</param>
+ </check>
+ <flag compiler="gnu">-m3dnow</flag>
+ <alignment>8</alignment>
+</arch>
+
+<arch name="abm">
+ <check name="cpuid_x86_bit">
+ <param>3</param>
+ <param>0x80000001</param>
+ <param>5</param>
+ </check>
+ <flag compiler="gnu">-msse4.2</flag>
+ <alignment>16</alignment>
+</arch>
+
+<arch name="popcount">
+ <check name="cpuid_x86_bit">
+ <param>2</param>
+ <param>0x00000001</param>
+ <param>23</param>
+ </check>
+ <flag compiler="gnu">-mpopcnt</flag>
+ <flag compiler="msvc">/arch:AVX</flag>
+</arch>
+
+<arch name="mmx">
+ <check name="cpuid_x86_bit">
+ <param>3</param>
+ <param>0x00000001</param>
+ <param>23</param>
+ </check>
+ <flag compiler="gnu">-mmmx</flag>
+ <flag compiler="msvc">/arch:SSE</flag>
+ <alignment>8</alignment>
+</arch>
+
+<arch name="sse">
+ <check name="cpuid_x86_bit">
+ <param>3</param>
+ <param>0x00000001</param>
+ <param>25</param>
+ </check>
+ <flag compiler="gnu">-msse</flag>
+ <flag compiler="msvc">/arch:SSE</flag>
+ <environment>_MM_SET_FLUSH_ZERO_MODE(_MM_FLUSH_ZERO_ON);</environment>
+ <include>xmmintrin.h</include>
+ <alignment>16</alignment>
+</arch>
+
+<arch name="sse2">
+ <check name="cpuid_x86_bit">
+ <param>3</param>
+ <param>0x00000001</param>
+ <param>26</param>
+ </check>
+ <flag compiler="gnu">-msse2</flag>
+ <flag compiler="msvc">/arch:SSE2</flag>
+ <alignment>16</alignment>
+</arch>
+
+<arch name="orc">
+</arch>
+
+<!-- it's here for overrule stuff. -->
+<arch name="norc">
+</arch>
+
+<arch name="sse3">
+ <check name="cpuid_x86_bit">
+ <param>2</param>
+ <param>0x00000001</param>
+ <param>0</param>
+ </check>
+ <flag compiler="gnu">-msse3</flag>
+ <flag compiler="msvc">/arch:AVX</flag>
+ <environment>_MM_SET_DENORMALS_ZERO_MODE(_MM_DENORMALS_ZERO_ON);</environment>
+ <include>pmmintrin.h</include>
+ <alignment>16</alignment>
+</arch>
+
+<arch name="ssse3">
+ <check name="cpuid_x86_bit">
+ <param>2</param>
+ <param>0x00000001</param>
+ <param>9</param>
+ </check>
+ <flag compiler="gnu">-mssse3</flag>
+ <flag compiler="msvc">/arch:AVX</flag>
+ <alignment>16</alignment>
+</arch>
+
+<arch name="sse4_a">
+ <check name="cpuid_x86_bit">
+ <param>2</param>
+ <param>0x80000001</param>
+ <param>6</param>
+ </check>
+ <flag compiler="gnu">-msse4a</flag>
+ <alignment>16</alignment>
+</arch>
+
+<arch name="sse4_1">
+ <check name="cpuid_x86_bit">
+ <param>2</param>
+ <param>0x00000001</param>
+ <param>19</param>
+ </check>
+ <flag compiler="gnu">-msse4.1</flag>
+ <flag compiler="msvc">/arch:AVX</flag>
+ <alignment>16</alignment>
+</arch>
+
+<arch name="sse4_2">
+ <check name="cpuid_x86_bit">
+ <param>2</param>
+ <param>0x00000001</param>
+ <param>20</param>
+ </check>
+ <flag compiler="gnu">-msse4.2</flag>
+ <flag compiler="msvc">/arch:AVX</flag>
+ <alignment>16</alignment>
+</arch>
+
+<arch name="avx">
+ <check name="cpuid_x86_bit">
+ <param>2</param>
+ <param>0x00000001</param>
+ <param>28</param>
+ </check>
+ <!-- check to make sure that xgetbv is enabled in OS -->
+ <check name="cpuid_x86_bit">
+ <param>2</param>
+ <param>0x00000001</param>
+ <param>27</param>
+ </check>
+ <!-- check to see that the OS has enabled AVX -->
+ <check name="get_avx_enabled"></check>
+ <flag compiler="gnu">-mavx</flag>
+ <flag compiler="msvc">/arch:AVX</flag>
+ <alignment>32</alignment>
+</arch>
+
+</grammar>
diff --git a/volk/gen/machines.xml b/volk/gen/machines.xml
new file mode 100644
index 000000000..d88a1a50c
--- /dev/null
+++ b/volk/gen/machines.xml
@@ -0,0 +1,55 @@
+<grammar>
+
+<machine name="generic">
+<archs>generic orc|</archs>
+</machine>
+
+<!--
+<machine name="mmx">
+<archs>generic 32|64 mmx orc|</archs>
+</machine>
+
+<machine name="sse">
+<archs>generic 32|64| mmx| sse orc|</archs>
+</machine>
+-->
+
+<machine name="neon">
+<archs>generic neon orc|</archs>
+</machine>
+
+<!-- trailing | bar means generate without either for MSVC -->
+<machine name="sse2">
+<archs>generic 32|64| mmx| sse sse2 orc|</archs>
+</machine>
+
+<machine name="sse3">
+<archs>generic 32|64 mmx sse sse2 sse3 orc|</archs>
+</machine>
+
+<machine name="ssse3">
+<archs>generic 32|64 mmx sse sse2 sse3 ssse3 orc|</archs>
+</machine>
+
+<machine name="sse4_a">
+<archs>generic 32|64 mmx sse sse2 sse3 sse4_a popcount orc|</archs>
+</machine>
+
+<machine name="sse4_1">
+<archs>generic 32|64 mmx sse sse2 sse3 ssse3 sse4_1 orc|</archs>
+</machine>
+
+<machine name="sse4_2">
+<archs>generic 32|64 mmx sse sse2 sse3 ssse3 sse4_1 sse4_2 popcount orc|</archs>
+</machine>
+
+<!-- trailing | bar means generate without either for MSVC -->
+<machine name="avx">
+<archs>generic 32|64| mmx| sse sse2 sse3 ssse3 sse4_1 sse4_2 popcount avx orc|</archs>
+</machine>
+
+<machine name="altivec">
+<archs>generic altivec</archs>
+</machine>
+
+</grammar>
diff --git a/volk/gen/volk_arch_defs.py b/volk/gen/volk_arch_defs.py
new file mode 100644
index 000000000..3c75e1374
--- /dev/null
+++ b/volk/gen/volk_arch_defs.py
@@ -0,0 +1,85 @@
+#
+# Copyright 2012 Free Software Foundation, Inc.
+#
+# This program 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 of the License, or
+# (at your option) any later version.
+#
+# This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
+#
+
+archs = list()
+arch_dict = dict()
+
+class arch_class:
+ def __init__(self, flags, checks, **kwargs):
+ for key, cast, failval in (
+ ('name', str, None),
+ ('environment', str, None),
+ ('include', str, None),
+ ('alignment', int, 1)
+ ):
+ try: setattr(self, key, cast(kwargs[key]))
+ except: setattr(self, key, failval)
+ self.checks = checks
+ assert(self.name)
+ self._flags = flags
+
+ def is_supported(self, compiler):
+ if not self._flags.keys(): return True
+ return compiler in self._flags.keys()
+
+ def get_flags(self, compiler):
+ try: return self._flags[compiler]
+ except KeyError: return list()
+
+ def __repr__(self): return self.name
+
+def register_arch(**kwargs):
+ arch = arch_class(**kwargs)
+ archs.append(arch)
+ arch_dict[arch.name] = arch
+
+########################################################################
+# register the arches
+########################################################################
+#TODO skip the XML and put it here
+from xml.dom import minidom
+import os
+gendir = os.path.dirname(__file__)
+archs_xml = minidom.parse(os.path.join(gendir, 'archs.xml')).getElementsByTagName('arch')
+for arch_xml in archs_xml:
+ kwargs = dict()
+ for attr in arch_xml.attributes.keys():
+ kwargs[attr] = arch_xml.attributes[attr].value
+ for node in arch_xml.childNodes:
+ try:
+ name = node.tagName
+ val = arch_xml.getElementsByTagName(name)[0].firstChild.data
+ kwargs[name] = val
+ except: pass
+ checks = list()
+ for check_xml in arch_xml.getElementsByTagName("check"):
+ name = check_xml.attributes["name"].value
+ params = list()
+ for param_xml in check_xml.getElementsByTagName("param"):
+ params.append(param_xml.firstChild.data)
+ checks.append([name, params])
+ flags = dict()
+ for flag_xml in arch_xml.getElementsByTagName("flag"):
+ name = flag_xml.attributes["compiler"].value
+ if not flags.has_key(name): flags[name] = list()
+ flags[name].append(flag_xml.firstChild.data)
+ #force kwargs keys to be of type str, not unicode for py25
+ kwargs = dict((str(k), v) for k, v in kwargs.iteritems())
+ register_arch(flags=flags, checks=checks, **kwargs)
+
+if __name__ == '__main__':
+ print archs
diff --git a/volk/gen/volk_compile_utils.py b/volk/gen/volk_compile_utils.py
new file mode 100644
index 000000000..cf1357375
--- /dev/null
+++ b/volk/gen/volk_compile_utils.py
@@ -0,0 +1,58 @@
+#!/usr/bin/env python
+#
+# Copyright 2012 Free Software Foundation, Inc.
+#
+# This program 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 of the License, or
+# (at your option) any later version.
+#
+# This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
+#
+
+import optparse
+import volk_arch_defs
+import volk_machine_defs
+
+def do_arch_flags_list(compiler):
+ output = list()
+ for arch in volk_arch_defs.archs:
+ if not arch.is_supported(compiler): continue
+ fields = [arch.name] + arch.get_flags(compiler)
+ output.append(','.join(fields))
+ print ';'.join(output)
+
+def do_machines_list(arch_names):
+ output = list()
+ for machine in volk_machine_defs.machines:
+ machine_arch_set = set(machine.arch_names)
+ if set(arch_names).intersection(machine_arch_set) == machine_arch_set:
+ output.append(machine.name)
+ print ';'.join(output)
+
+def do_machine_flags_list(compiler, machine_name):
+ output = list()
+ machine = volk_machine_defs.machine_dict[machine_name]
+ for arch in machine.archs:
+ output.extend(arch.get_flags(compiler))
+ print ' '.join(output)
+
+def main():
+ parser = optparse.OptionParser()
+ parser.add_option('--mode', type='string')
+ parser.add_option('--compiler', type='string')
+ parser.add_option('--archs', type='string')
+ parser.add_option('--machine', type='string')
+ (opts, args) = parser.parse_args()
+
+ if opts.mode == 'arch_flags': return do_arch_flags_list(opts.compiler.lower())
+ if opts.mode == 'machines': return do_machines_list(opts.archs.split(';'))
+ if opts.mode == 'machine_flags': return do_machine_flags_list(opts.compiler.lower(), opts.machine)
+
+if __name__ == '__main__': main()
diff --git a/volk/gen/volk_kernel_defs.py b/volk/gen/volk_kernel_defs.py
new file mode 100644
index 000000000..f246db0f9
--- /dev/null
+++ b/volk/gen/volk_kernel_defs.py
@@ -0,0 +1,209 @@
+#
+# Copyright 2011-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.
+#
+
+import os
+import re
+import sys
+import glob
+
+########################################################################
+# Strip comments from a c/cpp file.
+# Input is code string, output is code string without comments.
+# http://stackoverflow.com/questions/241327/python-snippet-to-remove-c-and-c-comments
+########################################################################
+def comment_remover(text):
+ def replacer(match):
+ s = match.group(0)
+ if s.startswith('/'):
+ return ""
+ else:
+ return s
+ pattern = re.compile(
+ r'//.*?$|/\*.*?\*/|\'(?:\\.|[^\\\'])*\'|"(?:\\.|[^\\"])*"',
+ re.DOTALL | re.MULTILINE
+ )
+ return re.sub(pattern, replacer, text)
+
+########################################################################
+# Split code into nested sections according to ifdef preprocessor macros
+########################################################################
+def split_into_nested_ifdef_sections(code):
+ sections = list()
+ section = ''
+ header = 'text'
+ in_section_depth = 0
+ for i, line in enumerate(code.splitlines()):
+ m = re.match('^(\s*)#(\s*)(\w+)(.*)$', line)
+ line_is = 'normal'
+ if m:
+ p0, p1, fcn, stuff = m.groups()
+ if fcn in ('if', 'ifndef', 'ifdef'): line_is = 'if'
+ if fcn in ('else', 'elif'): line_is = 'else'
+ if fcn in ('endif',): line_is = 'end'
+
+ if line_is == 'if': in_section_depth += 1
+ if line_is == 'end': in_section_depth -= 1
+
+ if in_section_depth == 1 and line_is == 'if':
+ sections.append((header, section))
+ section = ''
+ header = line
+ continue
+
+ if in_section_depth == 1 and line_is == 'else':
+ sections.append((header, section))
+ section = ''
+ header = line
+ continue
+
+ if in_section_depth == 0 and line_is == 'end':
+ sections.append((header, section))
+ section = ''
+ header = 'text'
+ continue
+
+ section += line + '\n'
+
+ sections.append((header, section)) #and pack remainder into sections
+ sections = [sec for sec in sections if sec[1].strip()] #filter empty sections
+
+ #recurse into non-text sections to fill subsections
+ for i, (header, section) in enumerate(sections):
+ if header == 'text': continue
+ sections[i] = (header, split_into_nested_ifdef_sections(section))
+
+ return sections
+
+########################################################################
+# Recursive print of sections to test code above
+########################################################################
+def print_sections(sections, indent = ' '):
+ for header, body in sections:
+ if header == 'text':
+ print indent, ('\n'+indent).join(body.splitlines())
+ continue
+ print indent.replace(' ', '-') + '>', header
+ print_sections(body, indent + ' ')
+
+########################################################################
+# Flatten a section to just body text
+########################################################################
+def flatten_section_text(sections):
+ output = ''
+ for hdr, bdy in sections:
+ if hdr != 'text': output += flatten_section_text(bdy)
+ else: output += bdy
+ return output
+
+########################################################################
+# Extract kernel info from section, represent as an implementation
+########################################################################
+class impl_class:
+ def __init__(self, kern_name, header, body):
+ #extract LV_HAVE_*
+ self.deps = set(map(str.lower, re.findall('LV_HAVE_(\w+)', header)))
+ #extract function suffix and args
+ body = flatten_section_text(body)
+ try:
+ fcn_matcher = re.compile('^.*(%s\\w*)\\s*\\((.*)$'%kern_name, re.DOTALL | re.MULTILINE)
+ body = body.split('{')[0].rsplit(')', 1)[0] #get the part before the open ){ bracket
+ m = fcn_matcher.match(body)
+ impl_name, the_rest = m.groups()
+ self.name = impl_name.replace(kern_name+'_', '')
+ self.args = list()
+ fcn_args = the_rest.split(',')
+ for fcn_arg in fcn_args:
+ arg_matcher = re.compile('^\s*(.*\\W)\s*(\w+)\s*$', re.DOTALL | re.MULTILINE)
+ m = arg_matcher.match(fcn_arg)
+ arg_type, arg_name = m.groups()
+ self.args.append((arg_type, arg_name))
+ except Exception as ex:
+ raise Exception, 'I cant parse the function prototype from: %s in %s\n%s'%(kern_name, body, ex)
+
+ assert self.name
+ self.is_aligned = self.name.startswith('a_')
+
+ def __repr__(self):
+ return self.name
+
+########################################################################
+# Get sets of LV_HAVE_* from the code
+########################################################################
+def extract_lv_haves(code):
+ haves = list()
+ for line in code.splitlines():
+ if not line.strip().startswith('#'): continue
+ have_set = set(map(str.lower, re.findall('LV_HAVE_(\w+)', line)))
+ if have_set: haves.append(have_set)
+ return haves
+
+########################################################################
+# Represent a processing kernel, parse from file
+########################################################################
+class kernel_class:
+ def __init__(self, kernel_file):
+ self.name = os.path.splitext(os.path.basename(kernel_file))[0]
+ self.pname = self.name.replace('volk_', 'p_')
+ code = open(kernel_file, 'r').read()
+ code = comment_remover(code)
+ sections = split_into_nested_ifdef_sections(code)
+ self._impls = list()
+ for header, section in sections:
+ if 'ifndef' not in header.lower(): continue
+ for sub_hdr, body in section:
+ if 'if' not in sub_hdr.lower(): continue
+ if 'LV_HAVE_' not in sub_hdr: continue
+ self._impls.append(impl_class(
+ kern_name=self.name, header=sub_hdr, body=body,
+ ))
+ assert(self._impls)
+ self.has_dispatcher = False
+ for impl in self._impls:
+ if impl.name == 'dispatcher':
+ self._impls.remove(impl)
+ self.has_dispatcher = True
+ break
+ self.args = self._impls[0].args
+ self.arglist_types = ', '.join([a[0] for a in self.args])
+ self.arglist_full = ', '.join(['%s %s'%a for a in self.args])
+ self.arglist_names = ', '.join([a[1] for a in self.args])
+
+ def get_impls(self, archs):
+ archs = set(archs)
+ impls = list()
+ for impl in self._impls:
+ if impl.deps.intersection(archs) == impl.deps:
+ impls.append(impl)
+ return impls
+
+ def __repr__(self):
+ return self.name
+
+########################################################################
+# Extract information from the VOLK kernels
+########################################################################
+__file__ = os.path.abspath(__file__)
+srcdir = os.path.dirname(os.path.dirname(__file__))
+kernel_files = glob.glob(os.path.join(srcdir, "kernels", "volk", "*.h"))
+kernels = map(kernel_class, kernel_files)
+
+if __name__ == '__main__':
+ print kernels
diff --git a/volk/gen/volk_machine_defs.py b/volk/gen/volk_machine_defs.py
new file mode 100644
index 000000000..7293d4746
--- /dev/null
+++ b/volk/gen/volk_machine_defs.py
@@ -0,0 +1,74 @@
+#
+# Copyright 2012 Free Software Foundation, Inc.
+#
+# This program 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 of the License, or
+# (at your option) any later version.
+#
+# This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
+#
+
+from volk_arch_defs import arch_dict
+
+machines = list()
+machine_dict = dict()
+
+class machine_class:
+ def __init__(self, name, archs):
+ self.name = name
+ self.archs = list()
+ self.arch_names = list()
+ for arch_name in archs:
+ if not arch_name: continue
+ arch = arch_dict[arch_name]
+ self.archs.append(arch)
+ self.arch_names.append(arch_name)
+ self.alignment = max(map(lambda a: a.alignment, self.archs))
+
+ def __repr__(self): return self.name
+
+def register_machine(name, archs):
+ for i, arch_name in enumerate(archs):
+ if '|' in arch_name: #handle special arch names with the '|'
+ for arch_sub in arch_name.split('|'):
+ if arch_sub:
+ register_machine(name+'_'+arch_sub, archs[:i] + [arch_sub] + archs[i+1:])
+ else:
+ register_machine(name, archs[:i] + archs[i+1:])
+ return
+ machine = machine_class(name=name, archs=archs)
+ machines.append(machine)
+ machine_dict[machine.name] = machine
+
+########################################################################
+# register the machines
+########################################################################
+#TODO skip the XML and put it here
+from xml.dom import minidom
+import os
+gendir = os.path.dirname(__file__)
+machines_xml = minidom.parse(os.path.join(gendir, 'machines.xml')).getElementsByTagName('machine')
+for machine_xml in machines_xml:
+ kwargs = dict()
+ for attr in machine_xml.attributes.keys():
+ kwargs[attr] = machine_xml.attributes[attr].value
+ for node in machine_xml.childNodes:
+ try:
+ name = node.tagName
+ val = machine_xml.getElementsByTagName(name)[0].firstChild.data
+ kwargs[name] = val
+ except: pass
+ kwargs['archs'] = kwargs['archs'].split()
+ #force kwargs keys to be of type str, not unicode for py25
+ kwargs = dict((str(k), v) for k, v in kwargs.iteritems())
+ register_machine(**kwargs)
+
+if __name__ == '__main__':
+ print machines
diff --git a/volk/gen/volk_tmpl_utils.py b/volk/gen/volk_tmpl_utils.py
new file mode 100644
index 000000000..6c08a8213
--- /dev/null
+++ b/volk/gen/volk_tmpl_utils.py
@@ -0,0 +1,74 @@
+#!/usr/bin/env python
+#
+# 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.
+#
+
+import os
+import re
+import sys
+import optparse
+import volk_arch_defs
+import volk_machine_defs
+import volk_kernel_defs
+from Cheetah import Template
+
+def __escape_pre_processor(code):
+ out = list()
+ for line in code.splitlines():
+ m = re.match('^(\s*)#(\s*)(\w+)(.*)$', line)
+ if m:
+ p0, p1, fcn, stuff = m.groups()
+ conly = fcn in ('include', 'define', 'ifdef', 'ifndef', 'endif', 'elif', 'pragma')
+ both = fcn in ('if', 'else')
+ istmpl = '$' in stuff
+ if 'defined' in stuff: istmpl = False
+ if conly or (both and not istmpl):
+ line = '%s\\#%s%s%s'%(p0, p1, fcn, stuff)
+ out.append(line)
+ return '\n'.join(out)
+
+def __parse_tmpl(_tmpl, **kwargs):
+ defs = {
+ 'archs': volk_arch_defs.archs,
+ 'arch_dict': volk_arch_defs.arch_dict,
+ 'machines': volk_machine_defs.machines,
+ 'machine_dict': volk_machine_defs.machine_dict,
+ 'kernels': volk_kernel_defs.kernels,
+ }
+ defs.update(kwargs)
+ _tmpl = __escape_pre_processor(_tmpl)
+ _tmpl = """
+
+/* this file was generated by volk template utils, do not edit! */
+
+""" + _tmpl
+ return str(Template.Template(_tmpl, defs))
+
+def main():
+ parser = optparse.OptionParser()
+ parser.add_option('--input', type='string')
+ parser.add_option('--output', type='string')
+ (opts, args) = parser.parse_args()
+
+ output = __parse_tmpl(open(opts.input).read(), args=args)
+ if opts.output: open(opts.output, 'w').write(output)
+ else: print output
+
+if __name__ == '__main__': main()
diff --git a/volk/include/volk/volk_16i_32fc_dot_prod_32fc_a.h b/volk/include/volk/volk_16i_32fc_dot_prod_32fc_a.h
new file mode 100644
index 000000000..1f6554af8
--- /dev/null
+++ b/volk/include/volk/volk_16i_32fc_dot_prod_32fc_a.h
@@ -0,0 +1,122 @@
+#ifndef INCLUDED_volk_16i_32fc_dot_prod_32fc_a_H
+#define INCLUDED_volk_16i_32fc_dot_prod_32fc_a_H
+
+#include <volk/volk_common.h>
+#include<stdio.h>
+
+
+#ifdef LV_HAVE_GENERIC
+
+
+static inline void volk_16i_32fc_dot_prod_32fc_a_generic(lv_32fc_t* result, const short* input, const lv_32fc_t * taps, unsigned int num_points) {
+
+ static const int N_UNROLL = 4;
+
+ lv_32fc_t acc0 = 0;
+ lv_32fc_t acc1 = 0;
+ lv_32fc_t acc2 = 0;
+ lv_32fc_t acc3 = 0;
+
+ unsigned i = 0;
+ unsigned n = (num_points / N_UNROLL) * N_UNROLL;
+
+ for(i = 0; i < n; i += N_UNROLL) {
+ acc0 += taps[i + 0] * (float)input[i + 0];
+ acc1 += taps[i + 1] * (float)input[i + 1];
+ acc2 += taps[i + 2] * (float)input[i + 2];
+ acc3 += taps[i + 3] * (float)input[i + 3];
+ }
+
+ for(; i < num_points; i++) {
+ acc0 += taps[i] * (float)input[i];
+ }
+
+ *result = acc0 + acc1 + acc2 + acc3;
+}
+
+#endif /*LV_HAVE_GENERIC*/
+
+
+#if LV_HAVE_SSE && LV_HAVE_MMX
+
+
+static inline void volk_16i_32fc_dot_prod_32fc_a_sse( lv_32fc_t* result, const short* input, const lv_32fc_t* taps, unsigned int num_points) {
+
+ unsigned int number = 0;
+ const unsigned int sixteenthPoints = num_points / 8;
+
+ float res[2];
+ float *realpt = &res[0], *imagpt = &res[1];
+ const short* aPtr = input;
+ const float* bPtr = (float*)taps;
+
+ __m64 m0, m1;
+ __m128 f0, f1, f2, f3;
+ __m128 a0Val, a1Val, a2Val, a3Val;
+ __m128 b0Val, b1Val, b2Val, b3Val;
+ __m128 c0Val, c1Val, c2Val, c3Val;
+
+ __m128 dotProdVal0 = _mm_setzero_ps();
+ __m128 dotProdVal1 = _mm_setzero_ps();
+ __m128 dotProdVal2 = _mm_setzero_ps();
+ __m128 dotProdVal3 = _mm_setzero_ps();
+
+ for(;number < sixteenthPoints; number++){
+
+ m0 = _mm_set_pi16(*(aPtr+3), *(aPtr+2), *(aPtr+1), *(aPtr+0));
+ m1 = _mm_set_pi16(*(aPtr+7), *(aPtr+6), *(aPtr+5), *(aPtr+4));
+ f0 = _mm_cvtpi16_ps(m0);
+ f1 = _mm_cvtpi16_ps(m0);
+ f2 = _mm_cvtpi16_ps(m1);
+ f3 = _mm_cvtpi16_ps(m1);
+
+ a0Val = _mm_unpacklo_ps(f0, f1);
+ a1Val = _mm_unpackhi_ps(f0, f1);
+ a2Val = _mm_unpacklo_ps(f2, f3);
+ a3Val = _mm_unpackhi_ps(f2, f3);
+
+ b0Val = _mm_load_ps(bPtr);
+ b1Val = _mm_load_ps(bPtr+4);
+ b2Val = _mm_load_ps(bPtr+8);
+ b3Val = _mm_load_ps(bPtr+12);
+
+ c0Val = _mm_mul_ps(a0Val, b0Val);
+ c1Val = _mm_mul_ps(a1Val, b1Val);
+ c2Val = _mm_mul_ps(a2Val, b2Val);
+ c3Val = _mm_mul_ps(a3Val, b3Val);
+
+ dotProdVal0 = _mm_add_ps(c0Val, dotProdVal0);
+ dotProdVal1 = _mm_add_ps(c1Val, dotProdVal1);
+ dotProdVal2 = _mm_add_ps(c2Val, dotProdVal2);
+ dotProdVal3 = _mm_add_ps(c3Val, dotProdVal3);
+
+ aPtr += 8;
+ bPtr += 16;
+ }
+
+ dotProdVal0 = _mm_add_ps(dotProdVal0, dotProdVal1);
+ dotProdVal0 = _mm_add_ps(dotProdVal0, dotProdVal2);
+ dotProdVal0 = _mm_add_ps(dotProdVal0, dotProdVal3);
+
+ __VOLK_ATTR_ALIGNED(16) float dotProductVector[4];
+
+ _mm_store_ps(dotProductVector,dotProdVal0); // Store the results back into the dot product vector
+
+ *realpt = dotProductVector[0];
+ *imagpt = dotProductVector[1];
+ *realpt += dotProductVector[2];
+ *imagpt += dotProductVector[3];
+
+ number = sixteenthPoints*8;
+ for(;number < num_points; number++){
+ *realpt += ((*aPtr) * (*bPtr++));
+ *imagpt += ((*aPtr++) * (*bPtr++));
+ }
+
+ *result = *(lv_32fc_t*)(&res[0]);
+}
+
+#endif /*LV_HAVE_SSE && LV_HAVE_MMX*/
+
+
+#endif /*INCLUDED_volk_16i_32fc_dot_prod_32fc_a_H*/
diff --git a/volk/include/volk/volk_16i_branch_4_state_8_a.h b/volk/include/volk/volk_16i_branch_4_state_8_a.h
new file mode 100644
index 000000000..6338fbdd1
--- /dev/null
+++ b/volk/include/volk/volk_16i_branch_4_state_8_a.h
@@ -0,0 +1,194 @@
+#ifndef INCLUDED_volk_16i_branch_4_state_8_a_H
+#define INCLUDED_volk_16i_branch_4_state_8_a_H
+
+
+#include<inttypes.h>
+#include<stdio.h>
+
+
+
+
+#ifdef LV_HAVE_SSSE3
+
+#include<xmmintrin.h>
+#include<emmintrin.h>
+#include<tmmintrin.h>
+
+static inline void volk_16i_branch_4_state_8_a_ssse3(short* target, short* src0, char** permuters, short* cntl2, short* cntl3, short* scalars) {
+
+
+ __m128i xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, xmm8, xmm9, xmm10, xmm11;
+
+ __m128i *p_target, *p_src0, *p_cntl2, *p_cntl3, *p_scalars;
+
+
+
+ p_target = (__m128i*)target;
+ p_src0 = (__m128i*)src0;
+ p_cntl2 = (__m128i*)cntl2;
+ p_cntl3 = (__m128i*)cntl3;
+ p_scalars = (__m128i*)scalars;
+
+ int i = 0;
+
+ int bound = 1;
+
+
+ xmm0 = _mm_load_si128(p_scalars);
+
+ xmm1 = _mm_shufflelo_epi16(xmm0, 0);
+ xmm2 = _mm_shufflelo_epi16(xmm0, 0x55);
+ xmm3 = _mm_shufflelo_epi16(xmm0, 0xaa);
+ xmm4 = _mm_shufflelo_epi16(xmm0, 0xff);
+
+ xmm1 = _mm_shuffle_epi32(xmm1, 0x00);
+ xmm2 = _mm_shuffle_epi32(xmm2, 0x00);
+ xmm3 = _mm_shuffle_epi32(xmm3, 0x00);
+ xmm4 = _mm_shuffle_epi32(xmm4, 0x00);
+
+ xmm0 = _mm_load_si128((__m128i*)permuters[0]);
+ xmm6 = _mm_load_si128((__m128i*)permuters[1]);
+ xmm8 = _mm_load_si128((__m128i*)permuters[2]);
+ xmm10 = _mm_load_si128((__m128i*)permuters[3]);
+
+ for(; i < bound; ++i) {
+
+ xmm5 = _mm_load_si128(p_src0);
+
+
+
+
+
+
+
+
+
+ xmm0 = _mm_shuffle_epi8(xmm5, xmm0);
+ xmm6 = _mm_shuffle_epi8(xmm5, xmm6);
+ xmm8 = _mm_shuffle_epi8(xmm5, xmm8);
+ xmm10 = _mm_shuffle_epi8(xmm5, xmm10);
+
+ p_src0 += 4;
+
+
+ xmm5 = _mm_add_epi16(xmm1, xmm2);
+
+ xmm6 = _mm_add_epi16(xmm2, xmm6);
+ xmm8 = _mm_add_epi16(xmm1, xmm8);
+
+
+ xmm7 = _mm_load_si128(p_cntl2);
+ xmm9 = _mm_load_si128(p_cntl3);
+
+ xmm0 = _mm_add_epi16(xmm5, xmm0);
+
+
+ xmm7 = _mm_and_si128(xmm7, xmm3);
+ xmm9 = _mm_and_si128(xmm9, xmm4);
+
+ xmm5 = _mm_load_si128(&p_cntl2[1]);
+ xmm11 = _mm_load_si128(&p_cntl3[1]);
+
+ xmm7 = _mm_add_epi16(xmm7, xmm9);
+
+ xmm5 = _mm_and_si128(xmm5, xmm3);
+ xmm11 = _mm_and_si128(xmm11, xmm4);
+
+ xmm0 = _mm_add_epi16(xmm0, xmm7);
+
+
+
+ xmm7 = _mm_load_si128(&p_cntl2[2]);
+ xmm9 = _mm_load_si128(&p_cntl3[2]);
+
+ xmm5 = _mm_add_epi16(xmm5, xmm11);
+
+ xmm7 = _mm_and_si128(xmm7, xmm3);
+ xmm9 = _mm_and_si128(xmm9, xmm4);
+
+ xmm6 = _mm_add_epi16(xmm6, xmm5);
+
+
+ xmm5 = _mm_load_si128(&p_cntl2[3]);
+ xmm11 = _mm_load_si128(&p_cntl3[3]);
+
+ xmm7 = _mm_add_epi16(xmm7, xmm9);
+
+ xmm5 = _mm_and_si128(xmm5, xmm3);
+ xmm11 = _mm_and_si128(xmm11, xmm4);
+
+ xmm8 = _mm_add_epi16(xmm8, xmm7);
+
+ xmm5 = _mm_add_epi16(xmm5, xmm11);
+
+ _mm_store_si128(p_target, xmm0);
+ _mm_store_si128(&p_target[1], xmm6);
+
+ xmm10 = _mm_add_epi16(xmm5, xmm10);
+
+ _mm_store_si128(&p_target[2], xmm8);
+
+ _mm_store_si128(&p_target[3], xmm10);
+
+ p_target += 3;
+ }
+}
+
+
+#endif /*LV_HAVE_SSEs*/
+
+#ifdef LV_HAVE_GENERIC
+static inline void volk_16i_branch_4_state_8_a_generic(short* target, short* src0, char** permuters, short* cntl2, short* cntl3, short* scalars) {
+ int i = 0;
+
+ int bound = 4;
+
+ for(; i < bound; ++i) {
+ target[i* 8] = src0[((char)permuters[i][0])/2]
+ + ((i + 1)%2 * scalars[0])
+ + (((i >> 1)^1) * scalars[1])
+ + (cntl2[i * 8] & scalars[2])
+ + (cntl3[i * 8] & scalars[3]);
+ target[i* 8 + 1] = src0[((char)permuters[i][1 * 2])/2]
+ + ((i + 1)%2 * scalars[0])
+ + (((i >> 1)^1) * scalars[1])
+ + (cntl2[i * 8 + 1] & scalars[2])
+ + (cntl3[i * 8 + 1] & scalars[3]);
+ target[i* 8 + 2] = src0[((char)permuters[i][2 * 2])/2]
+ + ((i + 1)%2 * scalars[0])
+ + (((i >> 1)^1) * scalars[1])
+ + (cntl2[i * 8 + 2] & scalars[2])
+ + (cntl3[i * 8 + 2] & scalars[3]);
+ target[i* 8 + 3] = src0[((char)permuters[i][3 * 2])/2]
+ + ((i + 1)%2 * scalars[0])
+ + (((i >> 1)^1) * scalars[1])
+ + (cntl2[i * 8 + 3] & scalars[2])
+ + (cntl3[i * 8 + 3] & scalars[3]);
+ target[i* 8 + 4] = src0[((char)permuters[i][4 * 2])/2]
+ + ((i + 1)%2 * scalars[0])
+ + (((i >> 1)^1) * scalars[1])
+ + (cntl2[i * 8 + 4] & scalars[2])
+ + (cntl3[i * 8 + 4] & scalars[3]);
+ target[i* 8 + 5] = src0[((char)permuters[i][5 * 2])/2]
+ + ((i + 1)%2 * scalars[0])
+ + (((i >> 1)^1) * scalars[1])
+ + (cntl2[i * 8 + 5] & scalars[2])
+ + (cntl3[i * 8 + 5] & scalars[3]);
+ target[i* 8 + 6] = src0[((char)permuters[i][6 * 2])/2]
+ + ((i + 1)%2 * scalars[0])
+ + (((i >> 1)^1) * scalars[1])
+ + (cntl2[i * 8 + 6] & scalars[2])
+ + (cntl3[i * 8 + 6] & scalars[3]);
+ target[i* 8 + 7] = src0[((char)permuters[i][7 * 2])/2]
+ + ((i + 1)%2 * scalars[0])
+ + (((i >> 1)^1) * scalars[1])
+ + (cntl2[i * 8 + 7] & scalars[2])
+ + (cntl3[i * 8 + 7] & scalars[3]);
+
+ }
+}
+
+#endif /*LV_HAVE_GENERIC*/
+
+
+#endif /*INCLUDED_volk_16i_branch_4_state_8_a_H*/
diff --git a/volk/include/volk/volk_16i_convert_8i_a.h b/volk/include/volk/volk_16i_convert_8i_a.h
new file mode 100644
index 000000000..84548c8c5
--- /dev/null
+++ b/volk/include/volk/volk_16i_convert_8i_a.h
@@ -0,0 +1,69 @@
+#ifndef INCLUDED_volk_16i_convert_8i_a_H
+#define INCLUDED_volk_16i_convert_8i_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE2
+#include <emmintrin.h>
+/*!
+ \brief Converts the input 16 bit integer data into 8 bit integer data
+ \param inputVector The 16 bit input data buffer
+ \param outputVector The 8 bit output data buffer
+ \param num_points The number of data values to be converted
+*/
+static inline void volk_16i_convert_8i_a_sse2(int8_t* outputVector, const int16_t* inputVector, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int sixteenthPoints = num_points / 16;
+
+ int8_t* outputVectorPtr = outputVector;
+ int16_t* inputPtr = (int16_t*)inputVector;
+ __m128i inputVal1;
+ __m128i inputVal2;
+ __m128i ret;
+
+ for(;number < sixteenthPoints; number++){
+
+ // Load the 16 values
+ inputVal1 = _mm_load_si128((__m128i*)inputPtr); inputPtr += 8;
+ inputVal2 = _mm_load_si128((__m128i*)inputPtr); inputPtr += 8;
+
+ inputVal1 = _mm_srai_epi16(inputVal1, 8);
+ inputVal2 = _mm_srai_epi16(inputVal2, 8);
+
+ ret = _mm_packs_epi16(inputVal1, inputVal2);
+
+ _mm_store_si128((__m128i*)outputVectorPtr, ret);
+
+ outputVectorPtr += 16;
+ }
+
+ number = sixteenthPoints * 16;
+ for(; number < num_points; number++){
+ outputVector[number] =(int8_t)(inputVector[number] >> 8);
+ }
+}
+#endif /* LV_HAVE_SSE2 */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Converts the input 16 bit integer data into 8 bit integer data
+ \param inputVector The 16 bit input data buffer
+ \param outputVector The 8 bit output data buffer
+ \param num_points The number of data values to be converted
+*/
+static inline void volk_16i_convert_8i_a_generic(int8_t* outputVector, const int16_t* inputVector, unsigned int num_points){
+ int8_t* outputVectorPtr = outputVector;
+ const int16_t* inputVectorPtr = inputVector;
+ unsigned int number = 0;
+
+ for(number = 0; number < num_points; number++){
+ *outputVectorPtr++ = ((int8_t)(*inputVectorPtr++ >> 8));
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_16i_convert_8i_a_H */
diff --git a/volk/include/volk/volk_16i_convert_8i_u.h b/volk/include/volk/volk_16i_convert_8i_u.h
new file mode 100644
index 000000000..80608a141
--- /dev/null
+++ b/volk/include/volk/volk_16i_convert_8i_u.h
@@ -0,0 +1,71 @@
+#ifndef INCLUDED_volk_16i_convert_8i_u_H
+#define INCLUDED_volk_16i_convert_8i_u_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE2
+#include <emmintrin.h>
+/*!
+ \brief Converts the input 16 bit integer data into 8 bit integer data
+ \param inputVector The 16 bit input data buffer
+ \param outputVector The 8 bit output data buffer
+ \param num_points The number of data values to be converted
+ \note Input and output buffers do NOT need to be properly aligned
+*/
+static inline void volk_16i_convert_8i_u_sse2(int8_t* outputVector, const int16_t* inputVector, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int sixteenthPoints = num_points / 16;
+
+ int8_t* outputVectorPtr = outputVector;
+ int16_t* inputPtr = (int16_t*)inputVector;
+ __m128i inputVal1;
+ __m128i inputVal2;
+ __m128i ret;
+
+ for(;number < sixteenthPoints; number++){
+
+ // Load the 16 values
+ inputVal1 = _mm_loadu_si128((__m128i*)inputPtr); inputPtr += 8;
+ inputVal2 = _mm_loadu_si128((__m128i*)inputPtr); inputPtr += 8;
+
+ inputVal1 = _mm_srai_epi16(inputVal1, 8);
+ inputVal2 = _mm_srai_epi16(inputVal2, 8);
+
+ ret = _mm_packs_epi16(inputVal1, inputVal2);
+
+ _mm_storeu_si128((__m128i*)outputVectorPtr, ret);
+
+ outputVectorPtr += 16;
+ }
+
+ number = sixteenthPoints * 16;
+ for(; number < num_points; number++){
+ outputVector[number] =(int8_t)(inputVector[number] >> 8);
+ }
+}
+#endif /* LV_HAVE_SSE2 */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Converts the input 16 bit integer data into 8 bit integer data
+ \param inputVector The 16 bit input data buffer
+ \param outputVector The 8 bit output data buffer
+ \param num_points The number of data values to be converted
+ \note Input and output buffers do NOT need to be properly aligned
+*/
+static inline void volk_16i_convert_8i_u_generic(int8_t* outputVector, const int16_t* inputVector, unsigned int num_points){
+ int8_t* outputVectorPtr = outputVector;
+ const int16_t* inputVectorPtr = inputVector;
+ unsigned int number = 0;
+
+ for(number = 0; number < num_points; number++){
+ *outputVectorPtr++ = ((int8_t)(*inputVectorPtr++ >> 8));
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_16i_convert_8i_u_H */
diff --git a/volk/include/volk/volk_16i_max_star_16i_a.h b/volk/include/volk/volk_16i_max_star_16i_a.h
new file mode 100644
index 000000000..edfff8a82
--- /dev/null
+++ b/volk/include/volk/volk_16i_max_star_16i_a.h
@@ -0,0 +1,108 @@
+#ifndef INCLUDED_volk_16i_max_star_16i_a_H
+#define INCLUDED_volk_16i_max_star_16i_a_H
+
+
+#include<inttypes.h>
+#include<stdio.h>
+
+
+#ifdef LV_HAVE_SSSE3
+
+#include<xmmintrin.h>
+#include<emmintrin.h>
+#include<tmmintrin.h>
+
+static inline void volk_16i_max_star_16i_a_ssse3(short* target, short* src0, unsigned int num_bytes) {
+
+
+
+ short candidate = src0[0];
+ short cands[8];
+ __m128i xmm0, xmm1, xmm3, xmm4, xmm5, xmm6;
+
+
+ __m128i *p_src0;
+
+ p_src0 = (__m128i*)src0;
+
+ int bound = num_bytes >> 4;
+ int leftovers = (num_bytes >> 1) & 7;
+
+ int i = 0;
+
+
+ xmm1 = _mm_setzero_si128();
+ xmm0 = _mm_setzero_si128();
+ //_mm_insert_epi16(xmm0, candidate, 0);
+
+ xmm0 = _mm_shuffle_epi8(xmm0, xmm1);
+
+
+ for(i = 0; i < bound; ++i) {
+ xmm1 = _mm_load_si128(p_src0);
+ p_src0 += 1;
+ //xmm2 = _mm_sub_epi16(xmm1, xmm0);
+
+
+
+
+
+
+ xmm3 = _mm_cmpgt_epi16(xmm0, xmm1);
+ xmm4 = _mm_cmpeq_epi16(xmm0, xmm1);
+ xmm5 = _mm_cmpgt_epi16(xmm1, xmm0);
+
+ xmm6 = _mm_xor_si128(xmm4, xmm5);
+
+ xmm3 = _mm_and_si128(xmm3, xmm0);
+ xmm4 = _mm_and_si128(xmm6, xmm1);
+
+ xmm0 = _mm_add_epi16(xmm3, xmm4);
+
+
+ }
+
+ _mm_store_si128((__m128i*)cands, xmm0);
+
+ for(i = 0; i < 8; ++i) {
+ candidate = ((short)(candidate - cands[i]) > 0) ? candidate : cands[i];
+ }
+
+
+
+ for(i = 0; i < leftovers; ++i) {
+
+ candidate = ((short)(candidate - src0[(bound << 3) + i]) > 0) ? candidate : src0[(bound << 3) + i];
+ }
+
+ target[0] = candidate;
+
+
+
+
+
+}
+
+#endif /*LV_HAVE_SSSE3*/
+
+#ifdef LV_HAVE_GENERIC
+
+static inline void volk_16i_max_star_16i_a_generic(short* target, short* src0, unsigned int num_bytes) {
+
+ int i = 0;
+
+ int bound = num_bytes >> 1;
+
+ short candidate = src0[0];
+ for(i = 1; i < bound; ++i) {
+ candidate = ((short)(candidate - src0[i]) > 0) ? candidate : src0[i];
+ }
+ target[0] = candidate;
+
+}
+
+
+#endif /*LV_HAVE_GENERIC*/
+
+
+#endif /*INCLUDED_volk_16i_max_star_16i_a_H*/
diff --git a/volk/include/volk/volk_16i_max_star_horizontal_16i_a.h b/volk/include/volk/volk_16i_max_star_horizontal_16i_a.h
new file mode 100644
index 000000000..c1c908425
--- /dev/null
+++ b/volk/include/volk/volk_16i_max_star_horizontal_16i_a.h
@@ -0,0 +1,130 @@
+#ifndef INCLUDED_volk_16i_max_star_horizontal_16i_a_H
+#define INCLUDED_volk_16i_max_star_horizontal_16i_a_H
+
+#include <volk/volk_common.h>
+
+#include<inttypes.h>
+#include<stdio.h>
+
+
+#ifdef LV_HAVE_SSSE3
+
+#include<xmmintrin.h>
+#include<emmintrin.h>
+#include<tmmintrin.h>
+
+static inline void volk_16i_max_star_horizontal_16i_a_ssse3(int16_t* target, int16_t* src0, unsigned int num_bytes) {
+
+ const static uint8_t shufmask0[16] = {0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0c, 0x0d, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
+ const static uint8_t shufmask1[16] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0c, 0x0d};
+ const static uint8_t andmask0[16] = {0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+ const static uint8_t andmask1[16] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02};
+
+
+
+ __m128i xmm0, xmm1, xmm2, xmm3, xmm4;
+ __m128i xmm5, xmm6, xmm7, xmm8;
+
+ xmm4 = _mm_load_si128((__m128i*)shufmask0);
+ xmm5 = _mm_load_si128((__m128i*)shufmask1);
+ xmm6 = _mm_load_si128((__m128i*)andmask0);
+ xmm7 = _mm_load_si128((__m128i*)andmask1);
+
+ __m128i *p_target, *p_src0;
+
+ p_target = (__m128i*)target;
+ p_src0 = (__m128i*)src0;
+
+ int bound = num_bytes >> 5;
+ int intermediate = (num_bytes >> 4) & 1;
+ int leftovers = (num_bytes >> 1) & 7;
+
+ int i = 0;
+
+
+ for(i = 0; i < bound; ++i) {
+
+ xmm0 = _mm_load_si128(p_src0);
+ xmm1 = _mm_load_si128(&p_src0[1]);
+
+
+
+ xmm2 = _mm_xor_si128(xmm2, xmm2);
+ p_src0 += 2;
+
+ xmm3 = _mm_hsub_epi16(xmm0, xmm1);
+
+ xmm2 = _mm_cmpgt_epi16(xmm2, xmm3);
+
+ xmm8 = _mm_and_si128(xmm2, xmm6);
+ xmm3 = _mm_and_si128(xmm2, xmm7);
+
+
+ xmm8 = _mm_add_epi8(xmm8, xmm4);
+ xmm3 = _mm_add_epi8(xmm3, xmm5);
+
+ xmm0 = _mm_shuffle_epi8(xmm0, xmm8);
+ xmm1 = _mm_shuffle_epi8(xmm1, xmm3);
+
+
+ xmm3 = _mm_add_epi16(xmm0, xmm1);
+
+
+ _mm_store_si128(p_target, xmm3);
+
+ p_target += 1;
+
+ }
+
+ for(i = 0; i < intermediate; ++i) {
+
+ xmm0 = _mm_load_si128(p_src0);
+
+
+ xmm2 = _mm_xor_si128(xmm2, xmm2);
+ p_src0 += 1;
+
+ xmm3 = _mm_hsub_epi16(xmm0, xmm1);
+ xmm2 = _mm_cmpgt_epi16(xmm2, xmm3);
+
+ xmm8 = _mm_and_si128(xmm2, xmm6);
+
+ xmm3 = _mm_add_epi8(xmm8, xmm4);
+
+ xmm0 = _mm_shuffle_epi8(xmm0, xmm3);
+
+ _mm_storel_pd((double*)p_target, bit128_p(&xmm0)->double_vec);
+
+ p_target = (__m128i*)((int8_t*)p_target + 8);
+
+ }
+
+ for(i = (bound << 4) + (intermediate << 3); i < (bound << 4) + (intermediate << 3) + leftovers ; i += 2) {
+ target[i>>1] = ((int16_t)(src0[i] - src0[i + 1]) > 0) ? src0[i] : src0[i + 1];
+ }
+
+
+}
+
+#endif /*LV_HAVE_SSSE3*/
+
+
+#ifdef LV_HAVE_GENERIC
+static inline void volk_16i_max_star_horizontal_16i_a_generic(int16_t* target, int16_t* src0, unsigned int num_bytes) {
+
+ int i = 0;
+
+ int bound = num_bytes >> 1;
+
+
+ for(i = 0; i < bound; i += 2) {
+ target[i >> 1] = ((int16_t) (src0[i] - src0[i + 1]) > 0) ? src0[i] : src0[i+1];
+ }
+
+}
+
+
+
+#endif /*LV_HAVE_GENERIC*/
+
+#endif /*INCLUDED_volk_16i_max_star_horizontal_16i_a_H*/
diff --git a/volk/include/volk/volk_16i_permute_and_scalar_add_a.h b/volk/include/volk/volk_16i_permute_and_scalar_add_a.h
new file mode 100644
index 000000000..47e3cbf9c
--- /dev/null
+++ b/volk/include/volk/volk_16i_permute_and_scalar_add_a.h
@@ -0,0 +1,139 @@
+#ifndef INCLUDED_volk_16i_permute_and_scalar_add_a_H
+#define INCLUDED_volk_16i_permute_and_scalar_add_a_H
+
+
+#include<inttypes.h>
+#include<stdio.h>
+
+
+
+
+#ifdef LV_HAVE_SSE2
+
+#include<xmmintrin.h>
+#include<emmintrin.h>
+
+static inline void volk_16i_permute_and_scalar_add_a_sse2(short* target, short* src0, short* permute_indexes, short* cntl0, short* cntl1, short* cntl2, short* cntl3, short* scalars, unsigned int num_bytes) {
+
+
+ __m128i xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7;
+
+ __m128i *p_target, *p_cntl0, *p_cntl1, *p_cntl2, *p_cntl3, *p_scalars;
+
+ short* p_permute_indexes = permute_indexes;
+
+ p_target = (__m128i*)target;
+ p_cntl0 = (__m128i*)cntl0;
+ p_cntl1 = (__m128i*)cntl1;
+ p_cntl2 = (__m128i*)cntl2;
+ p_cntl3 = (__m128i*)cntl3;
+ p_scalars = (__m128i*)scalars;
+
+ int i = 0;
+
+ int bound = (num_bytes >> 4);
+ int leftovers = (num_bytes >> 1) & 7;
+
+ xmm0 = _mm_load_si128(p_scalars);
+
+ xmm1 = _mm_shufflelo_epi16(xmm0, 0);
+ xmm2 = _mm_shufflelo_epi16(xmm0, 0x55);
+ xmm3 = _mm_shufflelo_epi16(xmm0, 0xaa);
+ xmm4 = _mm_shufflelo_epi16(xmm0, 0xff);
+
+ xmm1 = _mm_shuffle_epi32(xmm1, 0x00);
+ xmm2 = _mm_shuffle_epi32(xmm2, 0x00);
+ xmm3 = _mm_shuffle_epi32(xmm3, 0x00);
+ xmm4 = _mm_shuffle_epi32(xmm4, 0x00);
+
+
+ for(; i < bound; ++i) {
+ xmm0 = _mm_setzero_si128();
+ xmm5 = _mm_setzero_si128();
+ xmm6 = _mm_setzero_si128();
+ xmm7 = _mm_setzero_si128();
+
+ xmm0 = _mm_insert_epi16(xmm0, src0[p_permute_indexes[0]], 0);
+ xmm5 = _mm_insert_epi16(xmm5, src0[p_permute_indexes[1]], 1);
+ xmm6 = _mm_insert_epi16(xmm6, src0[p_permute_indexes[2]], 2);
+ xmm7 = _mm_insert_epi16(xmm7, src0[p_permute_indexes[3]], 3);
+ xmm0 = _mm_insert_epi16(xmm0, src0[p_permute_indexes[4]], 4);
+ xmm5 = _mm_insert_epi16(xmm5, src0[p_permute_indexes[5]], 5);
+ xmm6 = _mm_insert_epi16(xmm6, src0[p_permute_indexes[6]], 6);
+ xmm7 = _mm_insert_epi16(xmm7, src0[p_permute_indexes[7]], 7);
+
+ xmm0 = _mm_add_epi16(xmm0, xmm5);
+ xmm6 = _mm_add_epi16(xmm6, xmm7);
+
+ p_permute_indexes += 8;
+
+ xmm0 = _mm_add_epi16(xmm0, xmm6);
+
+ xmm5 = _mm_load_si128(p_cntl0);
+ xmm6 = _mm_load_si128(p_cntl1);
+ xmm7 = _mm_load_si128(p_cntl2);
+
+ xmm5 = _mm_and_si128(xmm5, xmm1);
+ xmm6 = _mm_and_si128(xmm6, xmm2);
+ xmm7 = _mm_and_si128(xmm7, xmm3);
+
+ xmm0 = _mm_add_epi16(xmm0, xmm5);
+
+ xmm5 = _mm_load_si128(p_cntl3);
+
+ xmm6 = _mm_add_epi16(xmm6, xmm7);
+
+ p_cntl0 += 1;
+
+ xmm5 = _mm_and_si128(xmm5, xmm4);
+
+ xmm0 = _mm_add_epi16(xmm0, xmm6);
+
+ p_cntl1 += 1;
+ p_cntl2 += 1;
+
+ xmm0 = _mm_add_epi16(xmm0, xmm5);
+
+ p_cntl3 += 1;
+
+ _mm_store_si128(p_target, xmm0);
+
+ p_target += 1;
+ }
+
+
+
+
+
+ for(i = bound * 8; i < (bound * 8) + leftovers; ++i) {
+ target[i] = src0[permute_indexes[i]]
+ + (cntl0[i] & scalars[0])
+ + (cntl1[i] & scalars[1])
+ + (cntl2[i] & scalars[2])
+ + (cntl3[i] & scalars[3]);
+ }
+}
+#endif /*LV_HAVE_SSEs*/
+
+
+#ifdef LV_HAVE_GENERIC
+static inline void volk_16i_permute_and_scalar_add_a_generic(short* target, short* src0, short* permute_indexes, short* cntl0, short* cntl1, short* cntl2, short* cntl3, short* scalars, unsigned int num_bytes) {
+
+ int i = 0;
+
+ int bound = num_bytes >> 1;
+
+ for(i = 0; i < bound; ++i) {
+ target[i] = src0[permute_indexes[i]]
+ + (cntl0[i] & scalars[0])
+ + (cntl1[i] & scalars[1])
+ + (cntl2[i] & scalars[2])
+ + (cntl3[i] & scalars[3]);
+
+ }
+}
+
+#endif /*LV_HAVE_GENERIC*/
+
+
+#endif /*INCLUDED_volk_16i_permute_and_scalar_add_a_H*/
diff --git a/volk/include/volk/volk_16i_s32f_convert_32f_a.h b/volk/include/volk/volk_16i_s32f_convert_32f_a.h
new file mode 100644
index 000000000..7108ff659
--- /dev/null
+++ b/volk/include/volk/volk_16i_s32f_convert_32f_a.h
@@ -0,0 +1,119 @@
+#ifndef INCLUDED_volk_16i_s32f_convert_32f_a_H
+#define INCLUDED_volk_16i_s32f_convert_32f_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE4_1
+#include <smmintrin.h>
+
+ /*!
+ \brief Converts the input 16 bit integer data into floating point data, and divides the each floating point output data point by the scalar value
+ \param inputVector The 16 bit input data buffer
+ \param outputVector The floating point output data buffer
+ \param scalar The value divided against each point in the output buffer
+ \param num_points The number of data values to be converted
+ */
+static inline void volk_16i_s32f_convert_32f_a_sse4_1(float* outputVector, const int16_t* inputVector, const float scalar, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int eighthPoints = num_points / 8;
+
+ float* outputVectorPtr = outputVector;
+ __m128 invScalar = _mm_set_ps1(1.0/scalar);
+ int16_t* inputPtr = (int16_t*)inputVector;
+ __m128i inputVal;
+ __m128i inputVal2;
+ __m128 ret;
+
+ for(;number < eighthPoints; number++){
+
+ // Load the 8 values
+ inputVal = _mm_loadu_si128((__m128i*)inputPtr);
+
+ // Shift the input data to the right by 64 bits ( 8 bytes )
+ inputVal2 = _mm_srli_si128(inputVal, 8);
+
+ // Convert the lower 4 values into 32 bit words
+ inputVal = _mm_cvtepi16_epi32(inputVal);
+ inputVal2 = _mm_cvtepi16_epi32(inputVal2);
+
+ ret = _mm_cvtepi32_ps(inputVal);
+ ret = _mm_mul_ps(ret, invScalar);
+ _mm_storeu_ps(outputVectorPtr, ret);
+ outputVectorPtr += 4;
+
+ ret = _mm_cvtepi32_ps(inputVal2);
+ ret = _mm_mul_ps(ret, invScalar);
+ _mm_storeu_ps(outputVectorPtr, ret);
+
+ outputVectorPtr += 4;
+
+ inputPtr += 8;
+ }
+
+ number = eighthPoints * 8;
+ for(; number < num_points; number++){
+ outputVector[number] =((float)(inputVector[number])) / scalar;
+ }
+}
+#endif /* LV_HAVE_SSE4_1 */
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+
+ /*!
+ \brief Converts the input 16 bit integer data into floating point data, and divides the each floating point output data point by the scalar value
+ \param inputVector The 16 bit input data buffer
+ \param outputVector The floating point output data buffer
+ \param scalar The value divided against each point in the output buffer
+ \param num_points The number of data values to be converted
+ */
+static inline void volk_16i_s32f_convert_32f_a_sse(float* outputVector, const int16_t* inputVector, const float scalar, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+
+ float* outputVectorPtr = outputVector;
+ __m128 invScalar = _mm_set_ps1(1.0/scalar);
+ int16_t* inputPtr = (int16_t*)inputVector;
+ __m128 ret;
+
+ for(;number < quarterPoints; number++){
+ ret = _mm_set_ps((float)(inputPtr[3]), (float)(inputPtr[2]), (float)(inputPtr[1]), (float)(inputPtr[0]));
+
+ ret = _mm_mul_ps(ret, invScalar);
+ _mm_storeu_ps(outputVectorPtr, ret);
+
+ inputPtr += 4;
+ outputVectorPtr += 4;
+ }
+
+ number = quarterPoints * 4;
+ for(; number < num_points; number++){
+ outputVector[number] = (float)(inputVector[number]) / scalar;
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+ /*!
+ \brief Converts the input 16 bit integer data into floating point data, and divides the each floating point output data point by the scalar value
+ \param inputVector The 16 bit input data buffer
+ \param outputVector The floating point output data buffer
+ \param scalar The value divided against each point in the output buffer
+ \param num_points The number of data values to be converted
+ */
+static inline void volk_16i_s32f_convert_32f_a_generic(float* outputVector, const int16_t* inputVector, const float scalar, unsigned int num_points){
+ float* outputVectorPtr = outputVector;
+ const int16_t* inputVectorPtr = inputVector;
+ unsigned int number = 0;
+
+ for(number = 0; number < num_points; number++){
+ *outputVectorPtr++ = ((float)(*inputVectorPtr++)) / scalar;
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_16i_s32f_convert_32f_a_H */
diff --git a/volk/include/volk/volk_16i_s32f_convert_32f_u.h b/volk/include/volk/volk_16i_s32f_convert_32f_u.h
new file mode 100644
index 000000000..4ce8e8f35
--- /dev/null
+++ b/volk/include/volk/volk_16i_s32f_convert_32f_u.h
@@ -0,0 +1,122 @@
+#ifndef INCLUDED_volk_16i_s32f_convert_32f_u_H
+#define INCLUDED_volk_16i_s32f_convert_32f_u_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE4_1
+#include <smmintrin.h>
+
+ /*!
+ \brief Converts the input 16 bit integer data into floating point data, and divides the each floating point output data point by the scalar value
+ \param inputVector The 16 bit input data buffer
+ \param outputVector The floating point output data buffer
+ \param scalar The value divided against each point in the output buffer
+ \param num_points The number of data values to be converted
+ \note Output buffer does NOT need to be properly aligned
+ */
+static inline void volk_16i_s32f_convert_32f_u_sse4_1(float* outputVector, const int16_t* inputVector, const float scalar, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int eighthPoints = num_points / 8;
+
+ float* outputVectorPtr = outputVector;
+ __m128 invScalar = _mm_set_ps1(1.0/scalar);
+ int16_t* inputPtr = (int16_t*)inputVector;
+ __m128i inputVal;
+ __m128i inputVal2;
+ __m128 ret;
+
+ for(;number < eighthPoints; number++){
+
+ // Load the 8 values
+ inputVal = _mm_loadu_si128((__m128i*)inputPtr);
+
+ // Shift the input data to the right by 64 bits ( 8 bytes )
+ inputVal2 = _mm_srli_si128(inputVal, 8);
+
+ // Convert the lower 4 values into 32 bit words
+ inputVal = _mm_cvtepi16_epi32(inputVal);
+ inputVal2 = _mm_cvtepi16_epi32(inputVal2);
+
+ ret = _mm_cvtepi32_ps(inputVal);
+ ret = _mm_mul_ps(ret, invScalar);
+ _mm_storeu_ps(outputVectorPtr, ret);
+ outputVectorPtr += 4;
+
+ ret = _mm_cvtepi32_ps(inputVal2);
+ ret = _mm_mul_ps(ret, invScalar);
+ _mm_storeu_ps(outputVectorPtr, ret);
+
+ outputVectorPtr += 4;
+
+ inputPtr += 8;
+ }
+
+ number = eighthPoints * 8;
+ for(; number < num_points; number++){
+ outputVector[number] =((float)(inputVector[number])) / scalar;
+ }
+}
+#endif /* LV_HAVE_SSE4_1 */
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+
+ /*!
+ \brief Converts the input 16 bit integer data into floating point data, and divides the each floating point output data point by the scalar value
+ \param inputVector The 16 bit input data buffer
+ \param outputVector The floating point output data buffer
+ \param scalar The value divided against each point in the output buffer
+ \param num_points The number of data values to be converted
+ \note Output buffer does NOT need to be properly aligned
+ */
+static inline void volk_16i_s32f_convert_32f_u_sse(float* outputVector, const int16_t* inputVector, const float scalar, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+
+ float* outputVectorPtr = outputVector;
+ __m128 invScalar = _mm_set_ps1(1.0/scalar);
+ int16_t* inputPtr = (int16_t*)inputVector;
+ __m128 ret;
+
+ for(;number < quarterPoints; number++){
+ ret = _mm_set_ps((float)(inputPtr[3]), (float)(inputPtr[2]), (float)(inputPtr[1]), (float)(inputPtr[0]));
+
+ ret = _mm_mul_ps(ret, invScalar);
+ _mm_storeu_ps(outputVectorPtr, ret);
+
+ inputPtr += 4;
+ outputVectorPtr += 4;
+ }
+
+ number = quarterPoints * 4;
+ for(; number < num_points; number++){
+ outputVector[number] = (float)(inputVector[number]) / scalar;
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+ /*!
+ \brief Converts the input 16 bit integer data into floating point data, and divides the each floating point output data point by the scalar value
+ \param inputVector The 16 bit input data buffer
+ \param outputVector The floating point output data buffer
+ \param scalar The value divided against each point in the output buffer
+ \param num_points The number of data values to be converted
+ \note Output buffer does NOT need to be properly aligned
+ */
+static inline void volk_16i_s32f_convert_32f_u_generic(float* outputVector, const int16_t* inputVector, const float scalar, unsigned int num_points){
+ float* outputVectorPtr = outputVector;
+ const int16_t* inputVectorPtr = inputVector;
+ unsigned int number = 0;
+
+ for(number = 0; number < num_points; number++){
+ *outputVectorPtr++ = ((float)(*inputVectorPtr++)) / scalar;
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_16i_s32f_convert_32f_u_H */
diff --git a/volk/include/volk/volk_16i_x4_quad_max_star_16i_a.h b/volk/include/volk/volk_16i_x4_quad_max_star_16i_a.h
new file mode 100644
index 000000000..0d8498553
--- /dev/null
+++ b/volk/include/volk/volk_16i_x4_quad_max_star_16i_a.h
@@ -0,0 +1,191 @@
+#ifndef INCLUDED_volk_16i_x4_quad_max_star_16i_a_H
+#define INCLUDED_volk_16i_x4_quad_max_star_16i_a_H
+
+
+#include<inttypes.h>
+#include<stdio.h>
+
+
+
+
+
+#ifdef LV_HAVE_SSE2
+
+#include<emmintrin.h>
+
+static inline void volk_16i_x4_quad_max_star_16i_a_sse2(short* target, short* src0, short* src1, short* src2, short* src3, unsigned int num_bytes) {
+
+
+
+
+ int i = 0;
+
+ int bound = (num_bytes >> 4);
+ int bound_copy = bound;
+ int leftovers = (num_bytes >> 1) & 7;
+
+ __m128i *p_target, *p_src0, *p_src1, *p_src2, *p_src3;
+ p_target = (__m128i*) target;
+ p_src0 = (__m128i*)src0;
+ p_src1 = (__m128i*)src1;
+ p_src2 = (__m128i*)src2;
+ p_src3 = (__m128i*)src3;
+
+
+
+ __m128i xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, xmm8;
+
+ while(bound_copy > 0) {
+
+ xmm1 = _mm_load_si128(p_src0);
+ xmm2 = _mm_load_si128(p_src1);
+ xmm3 = _mm_load_si128(p_src2);
+ xmm4 = _mm_load_si128(p_src3);
+
+ xmm5 = _mm_setzero_si128();
+ xmm6 = _mm_setzero_si128();
+ xmm7 = xmm1;
+ xmm8 = xmm3;
+
+
+ xmm1 = _mm_sub_epi16(xmm2, xmm1);
+
+
+
+ xmm3 = _mm_sub_epi16(xmm4, xmm3);
+
+ xmm5 = _mm_cmpgt_epi16(xmm1, xmm5);
+ xmm6 = _mm_cmpgt_epi16(xmm3, xmm6);
+
+
+
+ xmm2 = _mm_and_si128(xmm5, xmm2);
+ xmm4 = _mm_and_si128(xmm6, xmm4);
+ xmm5 = _mm_andnot_si128(xmm5, xmm7);
+ xmm6 = _mm_andnot_si128(xmm6, xmm8);
+
+ xmm5 = _mm_add_epi16(xmm2, xmm5);
+ xmm6 = _mm_add_epi16(xmm4, xmm6);
+
+
+ xmm1 = _mm_xor_si128(xmm1, xmm1);
+ xmm2 = xmm5;
+ xmm5 = _mm_sub_epi16(xmm6, xmm5);
+ p_src0 += 1;
+ bound_copy -= 1;
+
+ xmm1 = _mm_cmpgt_epi16(xmm5, xmm1);
+ p_src1 += 1;
+
+ xmm6 = _mm_and_si128(xmm1, xmm6);
+
+ xmm1 = _mm_andnot_si128(xmm1, xmm2);
+ p_src2 += 1;
+
+
+
+ xmm1 = _mm_add_epi16(xmm6, xmm1);
+ p_src3 += 1;
+
+
+ _mm_store_si128(p_target, xmm1);
+ p_target += 1;
+
+ }
+
+
+ /*asm volatile
+ (
+ "volk_16i_x4_quad_max_star_16i_a_sse2_L1:\n\t"
+ "cmp $0, %[bound]\n\t"
+ "je volk_16i_x4_quad_max_star_16i_a_sse2_END\n\t"
+
+ "movaps (%[src0]), %%xmm1\n\t"
+ "movaps (%[src1]), %%xmm2\n\t"
+ "movaps (%[src2]), %%xmm3\n\t"
+ "movaps (%[src3]), %%xmm4\n\t"
+
+ "pxor %%xmm5, %%xmm5\n\t"
+ "pxor %%xmm6, %%xmm6\n\t"
+ "movaps %%xmm1, %%xmm7\n\t"
+ "movaps %%xmm3, %%xmm8\n\t"
+ "psubw %%xmm2, %%xmm1\n\t"
+ "psubw %%xmm4, %%xmm3\n\t"
+
+ "pcmpgtw %%xmm1, %%xmm5\n\t"
+ "pcmpgtw %%xmm3, %%xmm6\n\t"
+
+ "pand %%xmm5, %%xmm2\n\t"
+ "pand %%xmm6, %%xmm4\n\t"
+ "pandn %%xmm7, %%xmm5\n\t"
+ "pandn %%xmm8, %%xmm6\n\t"
+
+ "paddw %%xmm2, %%xmm5\n\t"
+ "paddw %%xmm4, %%xmm6\n\t"
+
+ "pxor %%xmm1, %%xmm1\n\t"
+ "movaps %%xmm5, %%xmm2\n\t"
+
+ "psubw %%xmm6, %%xmm5\n\t"
+ "add $16, %[src0]\n\t"
+ "add $-1, %[bound]\n\t"
+
+ "pcmpgtw %%xmm5, %%xmm1\n\t"
+ "add $16, %[src1]\n\t"
+
+ "pand %%xmm1, %%xmm6\n\t"
+
+ "pandn %%xmm2, %%xmm1\n\t"
+ "add $16, %[src2]\n\t"
+
+ "paddw %%xmm6, %%xmm1\n\t"
+ "add $16, %[src3]\n\t"
+
+ "movaps %%xmm1, (%[target])\n\t"
+ "addw $16, %[target]\n\t"
+ "jmp volk_16i_x4_quad_max_star_16i_a_sse2_L1\n\t"
+
+ "volk_16i_x4_quad_max_star_16i_a_sse2_END:\n\t"
+ :
+ :[bound]"r"(bound), [src0]"r"(src0), [src1]"r"(src1), [src2]"r"(src2), [src3]"r"(src3), [target]"r"(target)
+ :
+ );
+ */
+
+ short temp0 = 0;
+ short temp1 = 0;
+ for(i = bound * 8; i < (bound * 8) + leftovers; ++i) {
+ temp0 = ((short)(src0[i] - src1[i]) > 0) ? src0[i] : src1[i];
+ temp1 = ((short)(src2[i] - src3[i])>0) ? src2[i] : src3[i];
+ target[i] = ((short)(temp0 - temp1)>0) ? temp0 : temp1;
+ }
+ return;
+
+
+}
+
+#endif /*LV_HAVE_SSE2*/
+
+
+#ifdef LV_HAVE_GENERIC
+static inline void volk_16i_x4_quad_max_star_16i_a_generic(short* target, short* src0, short* src1, short* src2, short* src3, unsigned int num_bytes) {
+
+ int i = 0;
+
+ int bound = num_bytes >> 1;
+
+ short temp0 = 0;
+ short temp1 = 0;
+ for(i = 0; i < bound; ++i) {
+ temp0 = ((short)(src0[i] - src1[i]) > 0) ? src0[i] : src1[i];
+ temp1 = ((short)(src2[i] - src3[i])>0) ? src2[i] : src3[i];
+ target[i] = ((short)(temp0 - temp1)>0) ? temp0 : temp1;
+ }
+}
+
+
+
+
+#endif /*LV_HAVE_GENERIC*/
+
+#endif /*INCLUDED_volk_16i_x4_quad_max_star_16i_a_H*/
diff --git a/volk/include/volk/volk_16i_x5_add_quad_16i_x4_a.h b/volk/include/volk/volk_16i_x5_add_quad_16i_x4_a.h
new file mode 100644
index 000000000..5560b92d9
--- /dev/null
+++ b/volk/include/volk/volk_16i_x5_add_quad_16i_x4_a.h
@@ -0,0 +1,136 @@
+#ifndef INCLUDED_volk_16i_x5_add_quad_16i_x4_a_H
+#define INCLUDED_volk_16i_x5_add_quad_16i_x4_a_H
+
+
+#include<inttypes.h>
+#include<stdio.h>
+
+
+
+
+
+#ifdef LV_HAVE_SSE2
+#include<xmmintrin.h>
+#include<emmintrin.h>
+
+static inline void volk_16i_x5_add_quad_16i_x4_a_sse2(short* target0, short* target1, short* target2, short* target3, short* src0, short* src1, short* src2, short* src3, short* src4, unsigned int num_bytes) {
+
+ __m128i xmm0, xmm1, xmm2, xmm3, xmm4;
+ __m128i *p_target0, *p_target1, *p_target2, *p_target3, *p_src0, *p_src1, *p_src2, *p_src3, *p_src4;
+ p_target0 = (__m128i*)target0;
+ p_target1 = (__m128i*)target1;
+ p_target2 = (__m128i*)target2;
+ p_target3 = (__m128i*)target3;
+
+ p_src0 = (__m128i*)src0;
+ p_src1 = (__m128i*)src1;
+ p_src2 = (__m128i*)src2;
+ p_src3 = (__m128i*)src3;
+ p_src4 = (__m128i*)src4;
+
+ int i = 0;
+
+ int bound = (num_bytes >> 4);
+ int leftovers = (num_bytes >> 1) & 7;
+
+ for(; i < bound; ++i) {
+ xmm0 = _mm_load_si128(p_src0);
+ xmm1 = _mm_load_si128(p_src1);
+ xmm2 = _mm_load_si128(p_src2);
+ xmm3 = _mm_load_si128(p_src3);
+ xmm4 = _mm_load_si128(p_src4);
+
+ p_src0 += 1;
+ p_src1 += 1;
+
+ xmm1 = _mm_add_epi16(xmm0, xmm1);
+ xmm2 = _mm_add_epi16(xmm0, xmm2);
+ xmm3 = _mm_add_epi16(xmm0, xmm3);
+ xmm4 = _mm_add_epi16(xmm0, xmm4);
+
+
+ p_src2 += 1;
+ p_src3 += 1;
+ p_src4 += 1;
+
+ _mm_store_si128(p_target0, xmm1);
+ _mm_store_si128(p_target1, xmm2);
+ _mm_store_si128(p_target2, xmm3);
+ _mm_store_si128(p_target3, xmm4);
+
+ p_target0 += 1;
+ p_target1 += 1;
+ p_target2 += 1;
+ p_target3 += 1;
+ }
+ /*asm volatile
+ (
+ ".%=volk_16i_x5_add_quad_16i_x4_a_sse2_L1:\n\t"
+ "cmp $0, %[bound]\n\t"
+ "je .%=volk_16i_x5_add_quad_16i_x4_a_sse2_END\n\t"
+ "movaps (%[src0]), %%xmm1\n\t"
+ "movaps (%[src1]), %%xmm2\n\t"
+ "movaps (%[src2]), %%xmm3\n\t"
+ "movaps (%[src3]), %%xmm4\n\t"
+ "movaps (%[src4]), %%xmm5\n\t"
+ "add $16, %[src0]\n\t"
+ "add $16, %[src1]\n\t"
+ "add $16, %[src2]\n\t"
+ "add $16, %[src3]\n\t"
+ "add $16, %[src4]\n\t"
+ "paddw %%xmm1, %%xmm2\n\t"
+ "paddw %%xmm1, %%xmm3\n\t"
+ "paddw %%xmm1, %%xmm4\n\t"
+ "paddw %%xmm1, %%xmm5\n\t"
+ "add $-1, %[bound]\n\t"
+ "movaps %%xmm2, (%[target0])\n\t"
+ "movaps %%xmm3, (%[target1])\n\t"
+ "movaps %%xmm4, (%[target2])\n\t"
+ "movaps %%xmm5, (%[target3])\n\t"
+ "add $16, %[target0]\n\t"
+ "add $16, %[target1]\n\t"
+ "add $16, %[target2]\n\t"
+ "add $16, %[target3]\n\t"
+ "jmp .%=volk_16i_x5_add_quad_16i_x4_a_sse2_L1\n\t"
+ ".%=volk_16i_x5_add_quad_16i_x4_a_sse2_END:\n\t"
+ :
+ :[bound]"r"(bound), [src0]"r"(src0), [src1]"r"(src1), [src2]"r"(src2), [src3]"r"(src3), [src4]"r"(src4), [target0]"r"(target0), [target1]"r"(target1), [target2]"r"(target2), [target3]"r"(target3)
+ :"xmm1", "xmm2", "xmm3", "xmm4", "xmm5"
+ );
+
+ */
+
+
+ for(i = bound * 8; i < (bound * 8) + leftovers; ++i) {
+ target0[i] = src0[i] + src1[i];
+ target1[i] = src0[i] + src2[i];
+ target2[i] = src0[i] + src3[i];
+ target3[i] = src0[i] + src4[i];
+ }
+}
+#endif /*LV_HAVE_SSE2*/
+
+
+#ifdef LV_HAVE_GENERIC
+
+static inline void volk_16i_x5_add_quad_16i_x4_a_generic(short* target0, short* target1, short* target2, short* target3, short* src0, short* src1, short* src2, short* src3, short* src4, unsigned int num_bytes) {
+
+ int i = 0;
+
+ int bound = num_bytes >> 1;
+
+ for(i = 0; i < bound; ++i) {
+ target0[i] = src0[i] + src1[i];
+ target1[i] = src0[i] + src2[i];
+ target2[i] = src0[i] + src3[i];
+ target3[i] = src0[i] + src4[i];
+ }
+}
+
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+
+#endif /*INCLUDED_volk_16i_x5_add_quad_16i_x4_a_H*/
diff --git a/volk/include/volk/volk_16ic_deinterleave_16i_x2_a.h b/volk/include/volk/volk_16ic_deinterleave_16i_x2_a.h
new file mode 100644
index 000000000..f8aa30874
--- /dev/null
+++ b/volk/include/volk/volk_16ic_deinterleave_16i_x2_a.h
@@ -0,0 +1,158 @@
+#ifndef INCLUDED_volk_16ic_deinterleave_16i_x2_a_H
+#define INCLUDED_volk_16ic_deinterleave_16i_x2_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSSE3
+#include <tmmintrin.h>
+/*!
+ \brief Deinterleaves the complex 16 bit vector into I & Q vector data
+ \param complexVector The complex input vector
+ \param iBuffer The I buffer output data
+ \param qBuffer The Q buffer output data
+ \param num_points The number of complex data values to be deinterleaved
+*/
+static inline void volk_16ic_deinterleave_16i_x2_a_ssse3(int16_t* iBuffer, int16_t* qBuffer, const lv_16sc_t* complexVector, unsigned int num_points){
+ unsigned int number = 0;
+ const int8_t* complexVectorPtr = (int8_t*)complexVector;
+ int16_t* iBufferPtr = iBuffer;
+ int16_t* qBufferPtr = qBuffer;
+
+ __m128i iMoveMask1 = _mm_set_epi8(0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 13, 12, 9, 8, 5, 4, 1, 0);
+ __m128i iMoveMask2 = _mm_set_epi8(13, 12, 9, 8, 5, 4, 1, 0, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80);
+
+ __m128i qMoveMask1 = _mm_set_epi8(0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 15, 14, 11, 10, 7, 6, 3, 2);
+ __m128i qMoveMask2 = _mm_set_epi8(15, 14, 11, 10, 7, 6, 3, 2, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80);
+
+ __m128i complexVal1, complexVal2, iOutputVal, qOutputVal;
+
+ unsigned int eighthPoints = num_points / 8;
+
+ for(number = 0; number < eighthPoints; number++){
+ complexVal1 = _mm_load_si128((__m128i*)complexVectorPtr); complexVectorPtr += 16;
+ complexVal2 = _mm_load_si128((__m128i*)complexVectorPtr); complexVectorPtr += 16;
+
+ iOutputVal = _mm_or_si128( _mm_shuffle_epi8(complexVal1, iMoveMask1) , _mm_shuffle_epi8(complexVal2, iMoveMask2));
+ qOutputVal = _mm_or_si128( _mm_shuffle_epi8(complexVal1, qMoveMask1) , _mm_shuffle_epi8(complexVal2, qMoveMask2));
+
+ _mm_store_si128((__m128i*)iBufferPtr, iOutputVal);
+ _mm_store_si128((__m128i*)qBufferPtr, qOutputVal);
+
+ iBufferPtr += 8;
+ qBufferPtr += 8;
+ }
+
+ number = eighthPoints * 8;
+ int16_t* int16ComplexVectorPtr = (int16_t*)complexVectorPtr;
+ for(; number < num_points; number++){
+ *iBufferPtr++ = *int16ComplexVectorPtr++;
+ *qBufferPtr++ = *int16ComplexVectorPtr++;
+ }
+}
+#endif /* LV_HAVE_SSSE3 */
+
+#ifdef LV_HAVE_SSE2
+#include <emmintrin.h>
+/*!
+ \brief Deinterleaves the complex 16 bit vector into I & Q vector data
+ \param complexVector The complex input vector
+ \param iBuffer The I buffer output data
+ \param qBuffer The Q buffer output data
+ \param num_points The number of complex data values to be deinterleaved
+*/
+static inline void volk_16ic_deinterleave_16i_x2_a_sse2(int16_t* iBuffer, int16_t* qBuffer, const lv_16sc_t* complexVector, unsigned int num_points){
+ unsigned int number = 0;
+ const int16_t* complexVectorPtr = (int16_t*)complexVector;
+ int16_t* iBufferPtr = iBuffer;
+ int16_t* qBufferPtr = qBuffer;
+ __m128i complexVal1, complexVal2, iComplexVal1, iComplexVal2, qComplexVal1, qComplexVal2, iOutputVal, qOutputVal;
+ __m128i lowMask = _mm_set_epi32(0x0, 0x0, 0xFFFFFFFF, 0xFFFFFFFF);
+ __m128i highMask = _mm_set_epi32(0xFFFFFFFF, 0xFFFFFFFF, 0x0, 0x0);
+
+ unsigned int eighthPoints = num_points / 8;
+
+ for(number = 0; number < eighthPoints; number++){
+ complexVal1 = _mm_load_si128((__m128i*)complexVectorPtr); complexVectorPtr += 8;
+ complexVal2 = _mm_load_si128((__m128i*)complexVectorPtr); complexVectorPtr += 8;
+
+ iComplexVal1 = _mm_shufflelo_epi16(complexVal1, _MM_SHUFFLE(3,1,2,0));
+
+ iComplexVal1 = _mm_shufflehi_epi16(iComplexVal1, _MM_SHUFFLE(3,1,2,0));
+
+ iComplexVal1 = _mm_shuffle_epi32(iComplexVal1, _MM_SHUFFLE(3,1,2,0));
+
+ iComplexVal2 = _mm_shufflelo_epi16(complexVal2, _MM_SHUFFLE(3,1,2,0));
+
+ iComplexVal2 = _mm_shufflehi_epi16(iComplexVal2, _MM_SHUFFLE(3,1,2,0));
+
+ iComplexVal2 = _mm_shuffle_epi32(iComplexVal2, _MM_SHUFFLE(2,0,3,1));
+
+ iOutputVal = _mm_or_si128(_mm_and_si128(iComplexVal1, lowMask), _mm_and_si128(iComplexVal2, highMask));
+
+ _mm_store_si128((__m128i*)iBufferPtr, iOutputVal);
+
+ qComplexVal1 = _mm_shufflelo_epi16(complexVal1, _MM_SHUFFLE(2,0,3,1));
+
+ qComplexVal1 = _mm_shufflehi_epi16(qComplexVal1, _MM_SHUFFLE(2,0,3,1));
+
+ qComplexVal1 = _mm_shuffle_epi32(qComplexVal1, _MM_SHUFFLE(3,1,2,0));
+
+ qComplexVal2 = _mm_shufflelo_epi16(complexVal2, _MM_SHUFFLE(2,0,3,1));
+
+ qComplexVal2 = _mm_shufflehi_epi16(qComplexVal2, _MM_SHUFFLE(2,0,3,1));
+
+ qComplexVal2 = _mm_shuffle_epi32(qComplexVal2, _MM_SHUFFLE(2,0,3,1));
+
+ qOutputVal = _mm_or_si128(_mm_and_si128(qComplexVal1, lowMask), _mm_and_si128(qComplexVal2, highMask));
+
+ _mm_store_si128((__m128i*)qBufferPtr, qOutputVal);
+
+ iBufferPtr += 8;
+ qBufferPtr += 8;
+ }
+
+ number = eighthPoints * 8;
+ for(; number < num_points; number++){
+ *iBufferPtr++ = *complexVectorPtr++;
+ *qBufferPtr++ = *complexVectorPtr++;
+ }
+}
+#endif /* LV_HAVE_SSE2 */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Deinterleaves the complex 16 bit vector into I & Q vector data
+ \param complexVector The complex input vector
+ \param iBuffer The I buffer output data
+ \param qBuffer The Q buffer output data
+ \param num_points The number of complex data values to be deinterleaved
+*/
+static inline void volk_16ic_deinterleave_16i_x2_a_generic(int16_t* iBuffer, int16_t* qBuffer, const lv_16sc_t* complexVector, unsigned int num_points){
+ const int16_t* complexVectorPtr = (const int16_t*)complexVector;
+ int16_t* iBufferPtr = iBuffer;
+ int16_t* qBufferPtr = qBuffer;
+ unsigned int number;
+ for(number = 0; number < num_points; number++){
+ *iBufferPtr++ = *complexVectorPtr++;
+ *qBufferPtr++ = *complexVectorPtr++;
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+#ifdef LV_HAVE_ORC
+/*!
+ \brief Deinterleaves the complex 16 bit vector into I & Q vector data
+ \param complexVector The complex input vector
+ \param iBuffer The I buffer output data
+ \param qBuffer The Q buffer output data
+ \param num_points The number of complex data values to be deinterleaved
+*/
+extern void volk_16ic_deinterleave_16i_x2_a_orc_impl(int16_t* iBuffer, int16_t* qBuffer, const lv_16sc_t* complexVector, unsigned int num_points);
+static inline void volk_16ic_deinterleave_16i_x2_a_orc(int16_t* iBuffer, int16_t* qBuffer, const lv_16sc_t* complexVector, unsigned int num_points){
+ volk_16ic_deinterleave_16i_x2_a_orc_impl(iBuffer, qBuffer, complexVector, num_points);
+}
+#endif /* LV_HAVE_ORC */
+
+
+#endif /* INCLUDED_volk_16ic_deinterleave_16i_x2_a_H */
diff --git a/volk/include/volk/volk_16ic_deinterleave_real_16i_a.h b/volk/include/volk/volk_16ic_deinterleave_real_16i_a.h
new file mode 100644
index 000000000..bac1f2e4b
--- /dev/null
+++ b/volk/include/volk/volk_16ic_deinterleave_real_16i_a.h
@@ -0,0 +1,120 @@
+#ifndef INCLUDED_volk_16ic_deinterleave_real_16i_a_H
+#define INCLUDED_volk_16ic_deinterleave_real_16i_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSSE3
+#include <tmmintrin.h>
+/*!
+ \brief Deinterleaves the complex 16 bit vector into I vector data
+ \param complexVector The complex input vector
+ \param iBuffer The I buffer output data
+ \param num_points The number of complex data values to be deinterleaved
+*/
+static inline void volk_16ic_deinterleave_real_16i_a_ssse3(int16_t* iBuffer, const lv_16sc_t* complexVector, unsigned int num_points){
+ unsigned int number = 0;
+ const int16_t* complexVectorPtr = (int16_t*)complexVector;
+ int16_t* iBufferPtr = iBuffer;
+
+ __m128i iMoveMask1 = _mm_set_epi8(0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 13, 12, 9, 8, 5, 4, 1, 0);
+ __m128i iMoveMask2 = _mm_set_epi8(13, 12, 9, 8, 5, 4, 1, 0, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80);
+
+ __m128i complexVal1, complexVal2, iOutputVal;
+
+ unsigned int eighthPoints = num_points / 8;
+
+ for(number = 0; number < eighthPoints; number++){
+ complexVal1 = _mm_load_si128((__m128i*)complexVectorPtr); complexVectorPtr += 8;
+ complexVal2 = _mm_load_si128((__m128i*)complexVectorPtr); complexVectorPtr += 8;
+
+ complexVal1 = _mm_shuffle_epi8(complexVal1, iMoveMask1);
+ complexVal2 = _mm_shuffle_epi8(complexVal2, iMoveMask2);
+
+ iOutputVal = _mm_or_si128(complexVal1, complexVal2);
+
+ _mm_store_si128((__m128i*)iBufferPtr, iOutputVal);
+
+ iBufferPtr += 8;
+ }
+
+ number = eighthPoints * 8;
+ for(; number < num_points; number++){
+ *iBufferPtr++ = *complexVectorPtr++;
+ complexVectorPtr++;
+ }
+}
+#endif /* LV_HAVE_SSSE3 */
+
+
+#ifdef LV_HAVE_SSE2
+#include <emmintrin.h>
+/*!
+ \brief Deinterleaves the complex 16 bit vector into I vector data
+ \param complexVector The complex input vector
+ \param iBuffer The I buffer output data
+ \param num_points The number of complex data values to be deinterleaved
+*/
+static inline void volk_16ic_deinterleave_real_16i_a_sse2(int16_t* iBuffer, const lv_16sc_t* complexVector, unsigned int num_points){
+ unsigned int number = 0;
+ const int16_t* complexVectorPtr = (int16_t*)complexVector;
+ int16_t* iBufferPtr = iBuffer;
+ __m128i complexVal1, complexVal2, iOutputVal;
+ __m128i lowMask = _mm_set_epi32(0x0, 0x0, 0xFFFFFFFF, 0xFFFFFFFF);
+ __m128i highMask = _mm_set_epi32(0xFFFFFFFF, 0xFFFFFFFF, 0x0, 0x0);
+
+ unsigned int eighthPoints = num_points / 8;
+
+ for(number = 0; number < eighthPoints; number++){
+ complexVal1 = _mm_load_si128((__m128i*)complexVectorPtr); complexVectorPtr += 8;
+ complexVal2 = _mm_load_si128((__m128i*)complexVectorPtr); complexVectorPtr += 8;
+
+ complexVal1 = _mm_shufflelo_epi16(complexVal1, _MM_SHUFFLE(3,1,2,0));
+
+ complexVal1 = _mm_shufflehi_epi16(complexVal1, _MM_SHUFFLE(3,1,2,0));
+
+ complexVal1 = _mm_shuffle_epi32(complexVal1, _MM_SHUFFLE(3,1,2,0));
+
+ complexVal2 = _mm_shufflelo_epi16(complexVal2, _MM_SHUFFLE(3,1,2,0));
+
+ complexVal2 = _mm_shufflehi_epi16(complexVal2, _MM_SHUFFLE(3,1,2,0));
+
+ complexVal2 = _mm_shuffle_epi32(complexVal2, _MM_SHUFFLE(2,0,3,1));
+
+ iOutputVal = _mm_or_si128(_mm_and_si128(complexVal1, lowMask), _mm_and_si128(complexVal2, highMask));
+
+ _mm_store_si128((__m128i*)iBufferPtr, iOutputVal);
+
+ iBufferPtr += 8;
+ }
+
+ number = eighthPoints * 8;
+ for(; number < num_points; number++){
+ *iBufferPtr++ = *complexVectorPtr++;
+ complexVectorPtr++;
+ }
+}
+#endif /* LV_HAVE_SSE2 */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Deinterleaves the complex 16 bit vector into I vector data
+ \param complexVector The complex input vector
+ \param iBuffer The I buffer output data
+ \param num_points The number of complex data values to be deinterleaved
+*/
+static inline void volk_16ic_deinterleave_real_16i_a_generic(int16_t* iBuffer, const lv_16sc_t* complexVector, unsigned int num_points){
+ unsigned int number = 0;
+ const int16_t* complexVectorPtr = (int16_t*)complexVector;
+ int16_t* iBufferPtr = iBuffer;
+ for(number = 0; number < num_points; number++){
+ *iBufferPtr++ = *complexVectorPtr++;
+ complexVectorPtr++;
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_16ic_deinterleave_real_16i_a_H */
diff --git a/volk/include/volk/volk_16ic_deinterleave_real_8i_a.h b/volk/include/volk/volk_16ic_deinterleave_real_8i_a.h
new file mode 100644
index 000000000..cd2fabb52
--- /dev/null
+++ b/volk/include/volk/volk_16ic_deinterleave_real_8i_a.h
@@ -0,0 +1,94 @@
+#ifndef INCLUDED_volk_16ic_deinterleave_real_8i_a_H
+#define INCLUDED_volk_16ic_deinterleave_real_8i_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSSE3
+#include <tmmintrin.h>
+/*!
+ \brief Deinterleaves the complex 16 bit vector into 8 bit I vector data
+ \param complexVector The complex input vector
+ \param iBuffer The I buffer output data
+ \param num_points The number of complex data values to be deinterleaved
+*/
+static inline void volk_16ic_deinterleave_real_8i_a_ssse3(int8_t* iBuffer, const lv_16sc_t* complexVector, unsigned int num_points){
+ unsigned int number = 0;
+ const int8_t* complexVectorPtr = (int8_t*)complexVector;
+ int8_t* iBufferPtr = iBuffer;
+ __m128i iMoveMask1 = _mm_set_epi8(0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 13, 12, 9, 8, 5, 4, 1, 0);
+ __m128i iMoveMask2 = _mm_set_epi8(13, 12, 9, 8, 5, 4, 1, 0, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80);
+ __m128i complexVal1, complexVal2, complexVal3, complexVal4, iOutputVal;
+
+ unsigned int sixteenthPoints = num_points / 16;
+
+ for(number = 0; number < sixteenthPoints; number++){
+ complexVal1 = _mm_load_si128((__m128i*)complexVectorPtr); complexVectorPtr += 16;
+ complexVal2 = _mm_load_si128((__m128i*)complexVectorPtr); complexVectorPtr += 16;
+
+ complexVal3 = _mm_load_si128((__m128i*)complexVectorPtr); complexVectorPtr += 16;
+ complexVal4 = _mm_load_si128((__m128i*)complexVectorPtr); complexVectorPtr += 16;
+
+ complexVal1 = _mm_shuffle_epi8(complexVal1, iMoveMask1);
+ complexVal2 = _mm_shuffle_epi8(complexVal2, iMoveMask2);
+
+ complexVal1 = _mm_or_si128(complexVal1, complexVal2);
+
+ complexVal3 = _mm_shuffle_epi8(complexVal3, iMoveMask1);
+ complexVal4 = _mm_shuffle_epi8(complexVal4, iMoveMask2);
+
+ complexVal3 = _mm_or_si128(complexVal3, complexVal4);
+
+
+ complexVal1 = _mm_srai_epi16(complexVal1, 8);
+ complexVal3 = _mm_srai_epi16(complexVal3, 8);
+
+ iOutputVal = _mm_packs_epi16(complexVal1, complexVal3);
+
+ _mm_store_si128((__m128i*)iBufferPtr, iOutputVal);
+
+ iBufferPtr += 16;
+ }
+
+ number = sixteenthPoints * 16;
+ int16_t* int16ComplexVectorPtr = (int16_t*)complexVectorPtr;
+ for(; number < num_points; number++){
+ *iBufferPtr++ = ((int8_t)(*int16ComplexVectorPtr++ >> 8));
+ int16ComplexVectorPtr++;
+ }
+}
+#endif /* LV_HAVE_SSSE3 */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Deinterleaves the complex 16 bit vector into 8 bit I vector data
+ \param complexVector The complex input vector
+ \param iBuffer The I buffer output data
+ \param num_points The number of complex data values to be deinterleaved
+*/
+static inline void volk_16ic_deinterleave_real_8i_a_generic(int8_t* iBuffer, const lv_16sc_t* complexVector, unsigned int num_points){
+ unsigned int number = 0;
+ int16_t* complexVectorPtr = (int16_t*)complexVector;
+ int8_t* iBufferPtr = iBuffer;
+ for(number = 0; number < num_points; number++){
+ *iBufferPtr++ = ((int8_t)(*complexVectorPtr++ >> 8));
+ complexVectorPtr++;
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+#ifdef LV_HAVE_ORC
+/*!
+ \brief Deinterleaves the complex 16 bit vector into 8 bit I vector data
+ \param complexVector The complex input vector
+ \param iBuffer The I buffer output data
+ \param num_points The number of complex data values to be deinterleaved
+*/
+extern void volk_16ic_deinterleave_real_8i_a_orc_impl(int8_t* iBuffer, const lv_16sc_t* complexVector, unsigned int num_points);
+static inline void volk_16ic_deinterleave_real_8i_a_orc(int8_t* iBuffer, const lv_16sc_t* complexVector, unsigned int num_points){
+ volk_16ic_deinterleave_real_8i_a_orc_impl(iBuffer, complexVector, num_points);
+}
+#endif /* LV_HAVE_ORC */
+
+
+#endif /* INCLUDED_volk_16ic_deinterleave_real_8i_a_H */
diff --git a/volk/include/volk/volk_16ic_magnitude_16i_a.h b/volk/include/volk/volk_16ic_magnitude_16i_a.h
new file mode 100644
index 000000000..317075e85
--- /dev/null
+++ b/volk/include/volk/volk_16ic_magnitude_16i_a.h
@@ -0,0 +1,191 @@
+#ifndef INCLUDED_volk_16ic_magnitude_16i_a_H
+#define INCLUDED_volk_16ic_magnitude_16i_a_H
+
+#include <volk/volk_common.h>
+#include <inttypes.h>
+#include <stdio.h>
+#include <math.h>
+
+#ifdef LV_HAVE_SSE3
+#include <pmmintrin.h>
+/*!
+ \brief Calculates the magnitude of the complexVector and stores the results in the magnitudeVector
+ \param complexVector The vector containing the complex input values
+ \param magnitudeVector The vector containing the real output values
+ \param num_points The number of complex values in complexVector to be calculated and stored into cVector
+*/
+static inline void volk_16ic_magnitude_16i_a_sse3(int16_t* magnitudeVector, const lv_16sc_t* complexVector, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+
+ const int16_t* complexVectorPtr = (const int16_t*)complexVector;
+ int16_t* magnitudeVectorPtr = magnitudeVector;
+
+ __m128 vScalar = _mm_set_ps1(32768.0);
+ __m128 invScalar = _mm_set_ps1(1.0/32768.0);
+
+ __m128 cplxValue1, cplxValue2, result;
+
+ __VOLK_ATTR_ALIGNED(16) float inputFloatBuffer[8];
+ __VOLK_ATTR_ALIGNED(16) float outputFloatBuffer[4];
+
+ for(;number < quarterPoints; number++){
+
+ inputFloatBuffer[0] = (float)(complexVectorPtr[0]);
+ inputFloatBuffer[1] = (float)(complexVectorPtr[1]);
+ inputFloatBuffer[2] = (float)(complexVectorPtr[2]);
+ inputFloatBuffer[3] = (float)(complexVectorPtr[3]);
+
+ inputFloatBuffer[4] = (float)(complexVectorPtr[4]);
+ inputFloatBuffer[5] = (float)(complexVectorPtr[5]);
+ inputFloatBuffer[6] = (float)(complexVectorPtr[6]);
+ inputFloatBuffer[7] = (float)(complexVectorPtr[7]);
+
+ cplxValue1 = _mm_load_ps(&inputFloatBuffer[0]);
+ cplxValue2 = _mm_load_ps(&inputFloatBuffer[4]);
+
+ complexVectorPtr += 8;
+
+ cplxValue1 = _mm_mul_ps(cplxValue1, invScalar);
+ cplxValue2 = _mm_mul_ps(cplxValue2, invScalar);
+
+ cplxValue1 = _mm_mul_ps(cplxValue1, cplxValue1); // Square the values
+ cplxValue2 = _mm_mul_ps(cplxValue2, cplxValue2); // Square the Values
+
+ result = _mm_hadd_ps(cplxValue1, cplxValue2); // Add the I2 and Q2 values
+
+ result = _mm_sqrt_ps(result); // Square root the values
+
+ result = _mm_mul_ps(result, vScalar); // Scale the results
+
+ _mm_store_ps(outputFloatBuffer, result);
+ *magnitudeVectorPtr++ = (int16_t)(outputFloatBuffer[0]);
+ *magnitudeVectorPtr++ = (int16_t)(outputFloatBuffer[1]);
+ *magnitudeVectorPtr++ = (int16_t)(outputFloatBuffer[2]);
+ *magnitudeVectorPtr++ = (int16_t)(outputFloatBuffer[3]);
+ }
+
+ number = quarterPoints * 4;
+ magnitudeVectorPtr = &magnitudeVector[number];
+ complexVectorPtr = (const int16_t*)&complexVector[number];
+ for(; number < num_points; number++){
+ const float val1Real = (float)(*complexVectorPtr++) / 32768.0;
+ const float val1Imag = (float)(*complexVectorPtr++) / 32768.0;
+ const float val1Result = sqrtf((val1Real * val1Real) + (val1Imag * val1Imag)) * 32768.0;
+ *magnitudeVectorPtr++ = (int16_t)(val1Result);
+ }
+}
+#endif /* LV_HAVE_SSE3 */
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+/*!
+ \brief Calculates the magnitude of the complexVector and stores the results in the magnitudeVector
+ \param complexVector The vector containing the complex input values
+ \param magnitudeVector The vector containing the real output values
+ \param num_points The number of complex values in complexVector to be calculated and stored into cVector
+*/
+static inline void volk_16ic_magnitude_16i_a_sse(int16_t* magnitudeVector, const lv_16sc_t* complexVector, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+
+ const int16_t* complexVectorPtr = (const int16_t*)complexVector;
+ int16_t* magnitudeVectorPtr = magnitudeVector;
+
+ __m128 vScalar = _mm_set_ps1(32768.0);
+ __m128 invScalar = _mm_set_ps1(1.0/32768.0);
+
+ __m128 cplxValue1, cplxValue2, iValue, qValue, result;
+
+ __VOLK_ATTR_ALIGNED(16) float inputFloatBuffer[4];
+ __VOLK_ATTR_ALIGNED(16) float outputFloatBuffer[4];
+
+ for(;number < quarterPoints; number++){
+
+ inputFloatBuffer[0] = (float)(complexVectorPtr[0]);
+ inputFloatBuffer[1] = (float)(complexVectorPtr[1]);
+ inputFloatBuffer[2] = (float)(complexVectorPtr[2]);
+ inputFloatBuffer[3] = (float)(complexVectorPtr[3]);
+
+ cplxValue1 = _mm_load_ps(inputFloatBuffer);
+ complexVectorPtr += 4;
+
+ inputFloatBuffer[0] = (float)(complexVectorPtr[0]);
+ inputFloatBuffer[1] = (float)(complexVectorPtr[1]);
+ inputFloatBuffer[2] = (float)(complexVectorPtr[2]);
+ inputFloatBuffer[3] = (float)(complexVectorPtr[3]);
+
+ cplxValue2 = _mm_load_ps(inputFloatBuffer);
+ complexVectorPtr += 4;
+
+ cplxValue1 = _mm_mul_ps(cplxValue1, invScalar);
+ cplxValue2 = _mm_mul_ps(cplxValue2, invScalar);
+
+ // Arrange in i1i2i3i4 format
+ iValue = _mm_shuffle_ps(cplxValue1, cplxValue2, _MM_SHUFFLE(2,0,2,0));
+ // Arrange in q1q2q3q4 format
+ qValue = _mm_shuffle_ps(cplxValue1, cplxValue2, _MM_SHUFFLE(3,1,3,1));
+
+ iValue = _mm_mul_ps(iValue, iValue); // Square the I values
+ qValue = _mm_mul_ps(qValue, qValue); // Square the Q Values
+
+ result = _mm_add_ps(iValue, qValue); // Add the I2 and Q2 values
+
+ result = _mm_sqrt_ps(result); // Square root the values
+
+ result = _mm_mul_ps(result, vScalar); // Scale the results
+
+ _mm_store_ps(outputFloatBuffer, result);
+ *magnitudeVectorPtr++ = (int16_t)(outputFloatBuffer[0]);
+ *magnitudeVectorPtr++ = (int16_t)(outputFloatBuffer[1]);
+ *magnitudeVectorPtr++ = (int16_t)(outputFloatBuffer[2]);
+ *magnitudeVectorPtr++ = (int16_t)(outputFloatBuffer[3]);
+ }
+
+ number = quarterPoints * 4;
+ magnitudeVectorPtr = &magnitudeVector[number];
+ complexVectorPtr = (const int16_t*)&complexVector[number];
+ for(; number < num_points; number++){
+ const float val1Real = (float)(*complexVectorPtr++) / 32768.0;
+ const float val1Imag = (float)(*complexVectorPtr++) / 32768.0;
+ const float val1Result = sqrtf((val1Real * val1Real) + (val1Imag * val1Imag)) * 32768.0;
+ *magnitudeVectorPtr++ = (int16_t)(val1Result);
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Calculates the magnitude of the complexVector and stores the results in the magnitudeVector
+ \param complexVector The vector containing the complex input values
+ \param magnitudeVector The vector containing the real output values
+ \param num_points The number of complex values in complexVector to be calculated and stored into cVector
+*/
+static inline void volk_16ic_magnitude_16i_a_generic(int16_t* magnitudeVector, const lv_16sc_t* complexVector, unsigned int num_points){
+ const int16_t* complexVectorPtr = (const int16_t*)complexVector;
+ int16_t* magnitudeVectorPtr = magnitudeVector;
+ unsigned int number = 0;
+ const float scalar = 32768.0;
+ for(number = 0; number < num_points; number++){
+ float real = ((float)(*complexVectorPtr++)) / scalar;
+ float imag = ((float)(*complexVectorPtr++)) / scalar;
+ *magnitudeVectorPtr++ = (int16_t)(sqrtf((real*real) + (imag*imag)) * scalar);
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+#ifdef LV_HAVE_ORC_DISABLED
+/*!
+ \brief Calculates the magnitude of the complexVector and stores the results in the magnitudeVector
+ \param complexVector The vector containing the complex input values
+ \param magnitudeVector The vector containing the real output values
+ \param num_points The number of complex values in complexVector to be calculated and stored into cVector
+*/
+extern void volk_16ic_magnitude_16i_a_orc_impl(int16_t* magnitudeVector, const lv_16sc_t* complexVector, float scalar, unsigned int num_points);
+static inline void volk_16ic_magnitude_16i_a_orc(int16_t* magnitudeVector, const lv_16sc_t* complexVector, unsigned int num_points){
+ volk_16ic_magnitude_16i_a_orc_impl(magnitudeVector, complexVector, 32768.0, num_points);
+}
+#endif /* LV_HAVE_ORC */
+
+
+#endif /* INCLUDED_volk_16ic_magnitude_16i_a_H */
diff --git a/volk/include/volk/volk_16ic_s32f_deinterleave_32f_x2_a.h b/volk/include/volk/volk_16ic_s32f_deinterleave_32f_x2_a.h
new file mode 100644
index 000000000..1300395ff
--- /dev/null
+++ b/volk/include/volk/volk_16ic_s32f_deinterleave_32f_x2_a.h
@@ -0,0 +1,109 @@
+#ifndef INCLUDED_volk_16ic_s32f_deinterleave_32f_x2_a_H
+#define INCLUDED_volk_16ic_s32f_deinterleave_32f_x2_a_H
+
+#include <volk/volk_common.h>
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+ /*!
+ \brief Converts the complex 16 bit vector into floats,scales each data point, and deinterleaves into I & Q vector data
+ \param complexVector The complex input vector
+ \param iBuffer The I buffer output data
+ \param qBuffer The Q buffer output data
+ \param scalar The data value to be divided against each input data value of the input complex vector
+ \param num_points The number of complex data values to be deinterleaved
+ */
+static inline void volk_16ic_s32f_deinterleave_32f_x2_a_sse(float* iBuffer, float* qBuffer, const lv_16sc_t* complexVector, const float scalar, unsigned int num_points){
+ float* iBufferPtr = iBuffer;
+ float* qBufferPtr = qBuffer;
+
+ uint64_t number = 0;
+ const uint64_t quarterPoints = num_points / 4;
+ __m128 cplxValue1, cplxValue2, iValue, qValue;
+
+ __m128 invScalar = _mm_set_ps1(1.0/scalar);
+ int16_t* complexVectorPtr = (int16_t*)complexVector;
+
+ __VOLK_ATTR_ALIGNED(16) float floatBuffer[8];
+
+ for(;number < quarterPoints; number++){
+
+ floatBuffer[0] = (float)(complexVectorPtr[0]);
+ floatBuffer[1] = (float)(complexVectorPtr[1]);
+ floatBuffer[2] = (float)(complexVectorPtr[2]);
+ floatBuffer[3] = (float)(complexVectorPtr[3]);
+
+ floatBuffer[4] = (float)(complexVectorPtr[4]);
+ floatBuffer[5] = (float)(complexVectorPtr[5]);
+ floatBuffer[6] = (float)(complexVectorPtr[6]);
+ floatBuffer[7] = (float)(complexVectorPtr[7]);
+
+ cplxValue1 = _mm_load_ps(&floatBuffer[0]);
+ cplxValue2 = _mm_load_ps(&floatBuffer[4]);
+
+ complexVectorPtr += 8;
+
+ cplxValue1 = _mm_mul_ps(cplxValue1, invScalar);
+ cplxValue2 = _mm_mul_ps(cplxValue2, invScalar);
+
+ // Arrange in i1i2i3i4 format
+ iValue = _mm_shuffle_ps(cplxValue1, cplxValue2, _MM_SHUFFLE(2,0,2,0));
+ // Arrange in q1q2q3q4 format
+ qValue = _mm_shuffle_ps(cplxValue1, cplxValue2, _MM_SHUFFLE(3,1,3,1));
+
+ _mm_store_ps(iBufferPtr, iValue);
+ _mm_store_ps(qBufferPtr, qValue);
+
+ iBufferPtr += 4;
+ qBufferPtr += 4;
+ }
+
+ number = quarterPoints * 4;
+ complexVectorPtr = (int16_t*)&complexVector[number];
+ for(; number < num_points; number++){
+ *iBufferPtr++ = (float)(*complexVectorPtr++) / scalar;
+ *qBufferPtr++ = (float)(*complexVectorPtr++) / scalar;
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+ /*!
+ \brief Converts the complex 16 bit vector into floats,scales each data point, and deinterleaves into I & Q vector data
+ \param complexVector The complex input vector
+ \param iBuffer The I buffer output data
+ \param qBuffer The Q buffer output data
+ \param scalar The data value to be divided against each input data value of the input complex vector
+ \param num_points The number of complex data values to be deinterleaved
+ */
+static inline void volk_16ic_s32f_deinterleave_32f_x2_a_generic(float* iBuffer, float* qBuffer, const lv_16sc_t* complexVector, const float scalar, unsigned int num_points){
+ const int16_t* complexVectorPtr = (const int16_t*)complexVector;
+ float* iBufferPtr = iBuffer;
+ float* qBufferPtr = qBuffer;
+ unsigned int number;
+ for(number = 0; number < num_points; number++){
+ *iBufferPtr++ = (float)(*complexVectorPtr++) / scalar;
+ *qBufferPtr++ = (float)(*complexVectorPtr++) / scalar;
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+#ifdef LV_HAVE_ORC
+ /*!
+ \brief Converts the complex 16 bit vector into floats,scales each data point, and deinterleaves into I & Q vector data
+ \param complexVector The complex input vector
+ \param iBuffer The I buffer output data
+ \param qBuffer The Q buffer output data
+ \param scalar The data value to be divided against each input data value of the input complex vector
+ \param num_points The number of complex data values to be deinterleaved
+ */
+extern void volk_16ic_s32f_deinterleave_32f_x2_a_orc_impl(float* iBuffer, float* qBuffer, const lv_16sc_t* complexVector, const float scalar, unsigned int num_points);
+static inline void volk_16ic_s32f_deinterleave_32f_x2_a_orc(float* iBuffer, float* qBuffer, const lv_16sc_t* complexVector, const float scalar, unsigned int num_points){
+ volk_16ic_s32f_deinterleave_32f_x2_a_orc_impl(iBuffer, qBuffer, complexVector, scalar, num_points);
+}
+#endif /* LV_HAVE_ORC */
+
+
+#endif /* INCLUDED_volk_16ic_s32f_deinterleave_32f_x2_a_H */
diff --git a/volk/include/volk/volk_16ic_s32f_deinterleave_real_32f_a.h b/volk/include/volk/volk_16ic_s32f_deinterleave_real_32f_a.h
new file mode 100644
index 000000000..5e2d82b94
--- /dev/null
+++ b/volk/include/volk/volk_16ic_s32f_deinterleave_real_32f_a.h
@@ -0,0 +1,126 @@
+#ifndef INCLUDED_volk_16ic_s32f_deinterleave_real_32f_a_H
+#define INCLUDED_volk_16ic_s32f_deinterleave_real_32f_a_H
+
+#include <volk/volk_common.h>
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE4_1
+#include <smmintrin.h>
+/*!
+ \brief Deinterleaves the complex 16 bit vector into I float vector data
+ \param complexVector The complex input vector
+ \param iBuffer The I buffer output data
+ \param scalar The scaling value being multiplied against each data point
+ \param num_points The number of complex data values to be deinterleaved
+*/
+static inline void volk_16ic_s32f_deinterleave_real_32f_a_sse4_1(float* iBuffer, const lv_16sc_t* complexVector, const float scalar, unsigned int num_points){
+ float* iBufferPtr = iBuffer;
+
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+
+ __m128 iFloatValue;
+
+ const float iScalar= 1.0 / scalar;
+ __m128 invScalar = _mm_set_ps1(iScalar);
+ __m128i complexVal, iIntVal;
+ int8_t* complexVectorPtr = (int8_t*)complexVector;
+
+ __m128i moveMask = _mm_set_epi8(0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 13, 12, 9, 8, 5, 4, 1, 0);
+
+ for(;number < quarterPoints; number++){
+ complexVal = _mm_load_si128((__m128i*)complexVectorPtr); complexVectorPtr += 16;
+ complexVal = _mm_shuffle_epi8(complexVal, moveMask);
+
+ iIntVal = _mm_cvtepi16_epi32(complexVal);
+ iFloatValue = _mm_cvtepi32_ps(iIntVal);
+
+ iFloatValue = _mm_mul_ps(iFloatValue, invScalar);
+
+ _mm_store_ps(iBufferPtr, iFloatValue);
+
+ iBufferPtr += 4;
+ }
+
+ number = quarterPoints * 4;
+ int16_t* sixteenTComplexVectorPtr = (int16_t*)&complexVector[number];
+ for(; number < num_points; number++){
+ *iBufferPtr++ = ((float)(*sixteenTComplexVectorPtr++)) * iScalar;
+ sixteenTComplexVectorPtr++;
+ }
+
+}
+#endif /* LV_HAVE_SSE4_1 */
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+/*!
+ \brief Deinterleaves the complex 16 bit vector into I float vector data
+ \param complexVector The complex input vector
+ \param iBuffer The I buffer output data
+ \param scalar The scaling value being multiplied against each data point
+ \param num_points The number of complex data values to be deinterleaved
+*/
+static inline void volk_16ic_s32f_deinterleave_real_32f_a_sse(float* iBuffer, const lv_16sc_t* complexVector, const float scalar, unsigned int num_points){
+ float* iBufferPtr = iBuffer;
+
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+ __m128 iValue;
+
+ const float iScalar = 1.0/scalar;
+ __m128 invScalar = _mm_set_ps1(iScalar);
+ int16_t* complexVectorPtr = (int16_t*)complexVector;
+
+ __VOLK_ATTR_ALIGNED(16) float floatBuffer[4];
+
+ for(;number < quarterPoints; number++){
+ floatBuffer[0] = (float)(*complexVectorPtr); complexVectorPtr += 2;
+ floatBuffer[1] = (float)(*complexVectorPtr); complexVectorPtr += 2;
+ floatBuffer[2] = (float)(*complexVectorPtr); complexVectorPtr += 2;
+ floatBuffer[3] = (float)(*complexVectorPtr); complexVectorPtr += 2;
+
+ iValue = _mm_load_ps(floatBuffer);
+
+ iValue = _mm_mul_ps(iValue, invScalar);
+
+ _mm_store_ps(iBufferPtr, iValue);
+
+ iBufferPtr += 4;
+ }
+
+ number = quarterPoints * 4;
+ complexVectorPtr = (int16_t*)&complexVector[number];
+ for(; number < num_points; number++){
+ *iBufferPtr++ = ((float)(*complexVectorPtr++)) * iScalar;
+ complexVectorPtr++;
+ }
+
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Deinterleaves the complex 16 bit vector into I float vector data
+ \param complexVector The complex input vector
+ \param iBuffer The I buffer output data
+ \param scalar The scaling value being multiplied against each data point
+ \param num_points The number of complex data values to be deinterleaved
+*/
+static inline void volk_16ic_s32f_deinterleave_real_32f_a_generic(float* iBuffer, const lv_16sc_t* complexVector, const float scalar, unsigned int num_points){
+ unsigned int number = 0;
+ const int16_t* complexVectorPtr = (const int16_t*)complexVector;
+ float* iBufferPtr = iBuffer;
+ const float invScalar = 1.0 / scalar;
+ for(number = 0; number < num_points; number++){
+ *iBufferPtr++ = ((float)(*complexVectorPtr++)) * invScalar;
+ complexVectorPtr++;
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_16ic_s32f_deinterleave_real_32f_a_H */
diff --git a/volk/include/volk/volk_16ic_s32f_magnitude_32f_a.h b/volk/include/volk/volk_16ic_s32f_magnitude_32f_a.h
new file mode 100644
index 000000000..d20eea1a7
--- /dev/null
+++ b/volk/include/volk/volk_16ic_s32f_magnitude_32f_a.h
@@ -0,0 +1,180 @@
+#ifndef INCLUDED_volk_16ic_s32f_magnitude_32f_a_H
+#define INCLUDED_volk_16ic_s32f_magnitude_32f_a_H
+
+#include <volk/volk_common.h>
+#include <inttypes.h>
+#include <stdio.h>
+#include <math.h>
+
+#ifdef LV_HAVE_SSE3
+#include <pmmintrin.h>
+/*!
+ \brief Calculates the magnitude of the complexVector and stores the results in the magnitudeVector
+ \param complexVector The vector containing the complex input values
+ \param magnitudeVector The vector containing the real output values
+ \param scalar The data value to be divided against each input data value of the input complex vector
+ \param num_points The number of complex values in complexVector to be calculated and stored into cVector
+*/
+static inline void volk_16ic_s32f_magnitude_32f_a_sse3(float* magnitudeVector, const lv_16sc_t* complexVector, const float scalar, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+
+ const int16_t* complexVectorPtr = (const int16_t*)complexVector;
+ float* magnitudeVectorPtr = magnitudeVector;
+
+ __m128 invScalar = _mm_set_ps1(1.0/scalar);
+
+ __m128 cplxValue1, cplxValue2, result;
+
+ __VOLK_ATTR_ALIGNED(16) float inputFloatBuffer[8];
+
+ for(;number < quarterPoints; number++){
+
+ inputFloatBuffer[0] = (float)(complexVectorPtr[0]);
+ inputFloatBuffer[1] = (float)(complexVectorPtr[1]);
+ inputFloatBuffer[2] = (float)(complexVectorPtr[2]);
+ inputFloatBuffer[3] = (float)(complexVectorPtr[3]);
+
+ inputFloatBuffer[4] = (float)(complexVectorPtr[4]);
+ inputFloatBuffer[5] = (float)(complexVectorPtr[5]);
+ inputFloatBuffer[6] = (float)(complexVectorPtr[6]);
+ inputFloatBuffer[7] = (float)(complexVectorPtr[7]);
+
+ cplxValue1 = _mm_load_ps(&inputFloatBuffer[0]);
+ cplxValue2 = _mm_load_ps(&inputFloatBuffer[4]);
+
+ complexVectorPtr += 8;
+
+ cplxValue1 = _mm_mul_ps(cplxValue1, invScalar);
+ cplxValue2 = _mm_mul_ps(cplxValue2, invScalar);
+
+ cplxValue1 = _mm_mul_ps(cplxValue1, cplxValue1); // Square the values
+ cplxValue2 = _mm_mul_ps(cplxValue2, cplxValue2); // Square the Values
+
+ result = _mm_hadd_ps(cplxValue1, cplxValue2); // Add the I2 and Q2 values
+
+ result = _mm_sqrt_ps(result); // Square root the values
+
+ _mm_store_ps(magnitudeVectorPtr, result);
+
+ magnitudeVectorPtr += 4;
+ }
+
+ number = quarterPoints * 4;
+ magnitudeVectorPtr = &magnitudeVector[number];
+ complexVectorPtr = (const int16_t*)&complexVector[number];
+ for(; number < num_points; number++){
+ float val1Real = (float)(*complexVectorPtr++) / scalar;
+ float val1Imag = (float)(*complexVectorPtr++) / scalar;
+ *magnitudeVectorPtr++ = sqrtf((val1Real * val1Real) + (val1Imag * val1Imag));
+ }
+}
+#endif /* LV_HAVE_SSE3 */
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+/*!
+ \brief Calculates the magnitude of the complexVector and stores the results in the magnitudeVector
+ \param complexVector The vector containing the complex input values
+ \param magnitudeVector The vector containing the real output values
+ \param scalar The data value to be divided against each input data value of the input complex vector
+ \param num_points The number of complex values in complexVector to be calculated and stored into cVector
+*/
+static inline void volk_16ic_s32f_magnitude_32f_a_sse(float* magnitudeVector, const lv_16sc_t* complexVector, const float scalar, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+
+ const int16_t* complexVectorPtr = (const int16_t*)complexVector;
+ float* magnitudeVectorPtr = magnitudeVector;
+
+ const float iScalar = 1.0 / scalar;
+ __m128 invScalar = _mm_set_ps1(iScalar);
+
+ __m128 cplxValue1, cplxValue2, result, re, im;
+
+ __VOLK_ATTR_ALIGNED(16) float inputFloatBuffer[8];
+
+ for(;number < quarterPoints; number++){
+ inputFloatBuffer[0] = (float)(complexVectorPtr[0]);
+ inputFloatBuffer[1] = (float)(complexVectorPtr[1]);
+ inputFloatBuffer[2] = (float)(complexVectorPtr[2]);
+ inputFloatBuffer[3] = (float)(complexVectorPtr[3]);
+
+ inputFloatBuffer[4] = (float)(complexVectorPtr[4]);
+ inputFloatBuffer[5] = (float)(complexVectorPtr[5]);
+ inputFloatBuffer[6] = (float)(complexVectorPtr[6]);
+ inputFloatBuffer[7] = (float)(complexVectorPtr[7]);
+
+ cplxValue1 = _mm_load_ps(&inputFloatBuffer[0]);
+ cplxValue2 = _mm_load_ps(&inputFloatBuffer[4]);
+
+ re = _mm_shuffle_ps(cplxValue1, cplxValue2, 0x88);
+ im = _mm_shuffle_ps(cplxValue1, cplxValue2, 0xdd);
+
+ complexVectorPtr += 8;
+
+ cplxValue1 = _mm_mul_ps(re, invScalar);
+ cplxValue2 = _mm_mul_ps(im, invScalar);
+
+ cplxValue1 = _mm_mul_ps(cplxValue1, cplxValue1); // Square the values
+ cplxValue2 = _mm_mul_ps(cplxValue2, cplxValue2); // Square the Values
+
+ result = _mm_add_ps(cplxValue1, cplxValue2); // Add the I2 and Q2 values
+
+ result = _mm_sqrt_ps(result); // Square root the values
+
+ _mm_store_ps(magnitudeVectorPtr, result);
+
+ magnitudeVectorPtr += 4;
+ }
+
+ number = quarterPoints * 4;
+ magnitudeVectorPtr = &magnitudeVector[number];
+ complexVectorPtr = (const int16_t*)&complexVector[number];
+ for(; number < num_points; number++){
+ float val1Real = (float)(*complexVectorPtr++) * iScalar;
+ float val1Imag = (float)(*complexVectorPtr++) * iScalar;
+ *magnitudeVectorPtr++ = sqrtf((val1Real * val1Real) + (val1Imag * val1Imag));
+ }
+}
+
+
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Calculates the magnitude of the complexVector and stores the results in the magnitudeVector
+ \param complexVector The vector containing the complex input values
+ \param magnitudeVector The vector containing the real output values
+ \param scalar The data value to be divided against each input data value of the input complex vector
+ \param num_points The number of complex values in complexVector to be calculated and stored into cVector
+*/
+static inline void volk_16ic_s32f_magnitude_32f_a_generic(float* magnitudeVector, const lv_16sc_t* complexVector, const float scalar, unsigned int num_points){
+ const int16_t* complexVectorPtr = (const int16_t*)complexVector;
+ float* magnitudeVectorPtr = magnitudeVector;
+ unsigned int number = 0;
+ const float invScalar = 1.0 / scalar;
+ for(number = 0; number < num_points; number++){
+ float real = ( (float) (*complexVectorPtr++)) * invScalar;
+ float imag = ( (float) (*complexVectorPtr++)) * invScalar;
+ *magnitudeVectorPtr++ = sqrtf((real*real) + (imag*imag));
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+#ifdef LV_HAVE_ORC_DISABLED
+/*!
+ \brief Calculates the magnitude of the complexVector and stores the results in the magnitudeVector
+ \param complexVector The vector containing the complex input values
+ \param magnitudeVector The vector containing the real output values
+ \param scalar The data value to be divided against each input data value of the input complex vector
+ \param num_points The number of complex values in complexVector to be calculated and stored into cVector
+*/
+extern void volk_16ic_s32f_magnitude_32f_a_orc_impl(float* magnitudeVector, const lv_16sc_t* complexVector, const float scalar, unsigned int num_points);
+static inline void volk_16ic_s32f_magnitude_32f_a_orc(float* magnitudeVector, const lv_16sc_t* complexVector, const float scalar, unsigned int num_points){
+ volk_16ic_s32f_magnitude_32f_a_orc_impl(magnitudeVector, complexVector, scalar, num_points);
+}
+#endif /* LV_HAVE_ORC */
+
+
+#endif /* INCLUDED_volk_16ic_s32f_magnitude_32f_a_H */
diff --git a/volk/include/volk/volk_16u_byteswap_a.h b/volk/include/volk/volk_16u_byteswap_a.h
new file mode 100644
index 000000000..fc3eb5fa7
--- /dev/null
+++ b/volk/include/volk/volk_16u_byteswap_a.h
@@ -0,0 +1,77 @@
+#ifndef INCLUDED_volk_16u_byteswap_a_H
+#define INCLUDED_volk_16u_byteswap_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE2
+#include <emmintrin.h>
+
+/*!
+ \brief Byteswaps (in-place) an aligned vector of int16_t's.
+ \param intsToSwap The vector of data to byte swap
+ \param numDataPoints The number of data points
+*/
+static inline void volk_16u_byteswap_a_sse2(uint16_t* intsToSwap, unsigned int num_points){
+ unsigned int number = 0;
+ uint16_t* inputPtr = intsToSwap;
+ __m128i input, left, right, output;
+
+ const unsigned int eighthPoints = num_points / 8;
+ for(;number < eighthPoints; number++){
+ // Load the 16t values, increment inputPtr later since we're doing it in-place.
+ input = _mm_load_si128((__m128i*)inputPtr);
+ // Do the two shifts
+ left = _mm_slli_epi16(input, 8);
+ right = _mm_srli_epi16(input, 8);
+ // Or the left and right halves together
+ output = _mm_or_si128(left, right);
+ // Store the results
+ _mm_store_si128((__m128i*)inputPtr, output);
+ inputPtr += 8;
+ }
+
+
+ // Byteswap any remaining points:
+ number = eighthPoints*8;
+ for(; number < num_points; number++){
+ uint16_t outputVal = *inputPtr;
+ outputVal = (((outputVal >> 8) & 0xff) | ((outputVal << 8) & 0xff00));
+ *inputPtr = outputVal;
+ inputPtr++;
+ }
+}
+#endif /* LV_HAVE_SSE2 */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Byteswaps (in-place) an aligned vector of int16_t's.
+ \param intsToSwap The vector of data to byte swap
+ \param numDataPoints The number of data points
+*/
+static inline void volk_16u_byteswap_a_generic(uint16_t* intsToSwap, unsigned int num_points){
+ unsigned int point;
+ uint16_t* inputPtr = intsToSwap;
+ for(point = 0; point < num_points; point++){
+ uint16_t output = *inputPtr;
+ output = (((output >> 8) & 0xff) | ((output << 8) & 0xff00));
+ *inputPtr = output;
+ inputPtr++;
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+#ifdef LV_HAVE_ORC
+/*!
+ \brief Byteswaps (in-place) an aligned vector of int16_t's.
+ \param intsToSwap The vector of data to byte swap
+ \param numDataPoints The number of data points
+*/
+extern void volk_16u_byteswap_a_orc_impl(uint16_t* intsToSwap, unsigned int num_points);
+static inline void volk_16u_byteswap_a_orc(uint16_t* intsToSwap, unsigned int num_points){
+ volk_16u_byteswap_a_orc_impl(intsToSwap, num_points);
+}
+#endif /* LV_HAVE_ORC */
+
+
+#endif /* INCLUDED_volk_16u_byteswap_a_H */
diff --git a/volk/include/volk/volk_16u_byteswap_u.h b/volk/include/volk/volk_16u_byteswap_u.h
new file mode 100644
index 000000000..8ef627a62
--- /dev/null
+++ b/volk/include/volk/volk_16u_byteswap_u.h
@@ -0,0 +1,63 @@
+#ifndef INCLUDED_volk_16u_byteswap_u_H
+#define INCLUDED_volk_16u_byteswap_u_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE2
+#include <emmintrin.h>
+
+/*!
+ \brief Byteswaps (in-place) an unaligned vector of int16_t's.
+ \param intsToSwap The vector of data to byte swap
+ \param numDataPoints The number of data points
+*/
+static inline void volk_16u_byteswap_u_sse2(uint16_t* intsToSwap, unsigned int num_points){
+ unsigned int number = 0;
+ uint16_t* inputPtr = intsToSwap;
+ __m128i input, left, right, output;
+
+ const unsigned int eighthPoints = num_points / 8;
+ for(;number < eighthPoints; number++){
+ // Load the 16t values, increment inputPtr later since we're doing it in-place.
+ input = _mm_loadu_si128((__m128i*)inputPtr);
+ // Do the two shifts
+ left = _mm_slli_epi16(input, 8);
+ right = _mm_srli_epi16(input, 8);
+ // Or the left and right halves together
+ output = _mm_or_si128(left, right);
+ // Store the results
+ _mm_storeu_si128((__m128i*)inputPtr, output);
+ inputPtr += 8;
+ }
+
+ // Byteswap any remaining points:
+ number = eighthPoints*8;
+ for(; number < num_points; number++){
+ uint16_t outputVal = *inputPtr;
+ outputVal = (((outputVal >> 8) & 0xff) | ((outputVal << 8) & 0xff00));
+ *inputPtr = outputVal;
+ inputPtr++;
+ }
+}
+#endif /* LV_HAVE_SSE2 */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Byteswaps (in-place) an unaligned vector of int16_t's.
+ \param intsToSwap The vector of data to byte swap
+ \param numDataPoints The number of data points
+*/
+static inline void volk_16u_byteswap_u_generic(uint16_t* intsToSwap, unsigned int num_points){
+ unsigned int point;
+ uint16_t* inputPtr = intsToSwap;
+ for(point = 0; point < num_points; point++){
+ uint16_t output = *inputPtr;
+ output = (((output >> 8) & 0xff) | ((output << 8) & 0xff00));
+ *inputPtr = output;
+ inputPtr++;
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+#endif /* INCLUDED_volk_16u_byteswap_u_H */
diff --git a/volk/include/volk/volk_32f_accumulator_s32f_a.h b/volk/include/volk/volk_32f_accumulator_s32f_a.h
new file mode 100644
index 000000000..78364d0a0
--- /dev/null
+++ b/volk/include/volk/volk_32f_accumulator_s32f_a.h
@@ -0,0 +1,68 @@
+#ifndef INCLUDED_volk_32f_accumulator_s32f_a_H
+#define INCLUDED_volk_32f_accumulator_s32f_a_H
+
+#include <volk/volk_common.h>
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+/*!
+ \brief Accumulates the values in the input buffer
+ \param result The accumulated result
+ \param inputBuffer The buffer of data to be accumulated
+ \param num_points The number of values in inputBuffer to be accumulated
+*/
+static inline void volk_32f_accumulator_s32f_a_sse(float* result, const float* inputBuffer, unsigned int num_points){
+ float returnValue = 0;
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+
+ const float* aPtr = inputBuffer;
+ __VOLK_ATTR_ALIGNED(16) float tempBuffer[4];
+
+ __m128 accumulator = _mm_setzero_ps();
+ __m128 aVal = _mm_setzero_ps();
+
+ for(;number < quarterPoints; number++){
+ aVal = _mm_load_ps(aPtr);
+ accumulator = _mm_add_ps(accumulator, aVal);
+ aPtr += 4;
+ }
+ _mm_store_ps(tempBuffer,accumulator); // Store the results back into the C container
+ returnValue = tempBuffer[0];
+ returnValue += tempBuffer[1];
+ returnValue += tempBuffer[2];
+ returnValue += tempBuffer[3];
+
+ number = quarterPoints * 4;
+ for(;number < num_points; number++){
+ returnValue += (*aPtr++);
+ }
+ *result = returnValue;
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Accumulates the values in the input buffer
+ \param result The accumulated result
+ \param inputBuffer The buffer of data to be accumulated
+ \param num_points The number of values in inputBuffer to be accumulated
+*/
+static inline void volk_32f_accumulator_s32f_a_generic(float* result, const float* inputBuffer, unsigned int num_points){
+ const float* aPtr = inputBuffer;
+ unsigned int number = 0;
+ float returnValue = 0;
+
+ for(;number < num_points; number++){
+ returnValue += (*aPtr++);
+ }
+ *result = returnValue;
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_32f_accumulator_s32f_a_H */
diff --git a/volk/include/volk/volk_32f_convert_64f_a.h b/volk/include/volk/volk_32f_convert_64f_a.h
new file mode 100644
index 000000000..2c469ac42
--- /dev/null
+++ b/volk/include/volk/volk_32f_convert_64f_a.h
@@ -0,0 +1,70 @@
+#ifndef INCLUDED_volk_32f_convert_64f_a_H
+#define INCLUDED_volk_32f_convert_64f_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE2
+#include <emmintrin.h>
+ /*!
+ \brief Converts the float values into double values
+ \param dVector The converted double vector values
+ \param fVector The float vector values to be converted
+ \param num_points The number of points in the two vectors to be converted
+ */
+static inline void volk_32f_convert_64f_a_sse2(double* outputVector, const float* inputVector, unsigned int num_points){
+ unsigned int number = 0;
+
+ const unsigned int quarterPoints = num_points / 4;
+
+ const float* inputVectorPtr = (const float*)inputVector;
+ double* outputVectorPtr = outputVector;
+ __m128d ret;
+ __m128 inputVal;
+
+ for(;number < quarterPoints; number++){
+ inputVal = _mm_load_ps(inputVectorPtr); inputVectorPtr += 4;
+
+ ret = _mm_cvtps_pd(inputVal);
+
+ _mm_store_pd(outputVectorPtr, ret);
+ outputVectorPtr += 2;
+
+ inputVal = _mm_movehl_ps(inputVal, inputVal);
+
+ ret = _mm_cvtps_pd(inputVal);
+
+ _mm_store_pd(outputVectorPtr, ret);
+ outputVectorPtr += 2;
+ }
+
+ number = quarterPoints * 4;
+ for(; number < num_points; number++){
+ outputVector[number] = (double)(inputVector[number]);
+ }
+}
+#endif /* LV_HAVE_SSE2 */
+
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Converts the float values into double values
+ \param dVector The converted double vector values
+ \param fVector The float vector values to be converted
+ \param num_points The number of points in the two vectors to be converted
+*/
+static inline void volk_32f_convert_64f_a_generic(double* outputVector, const float* inputVector, unsigned int num_points){
+ double* outputVectorPtr = outputVector;
+ const float* inputVectorPtr = inputVector;
+ unsigned int number = 0;
+
+ for(number = 0; number < num_points; number++){
+ *outputVectorPtr++ = ((double)(*inputVectorPtr++));
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_32f_convert_64f_a_H */
diff --git a/volk/include/volk/volk_32f_convert_64f_u.h b/volk/include/volk/volk_32f_convert_64f_u.h
new file mode 100644
index 000000000..10d8a4f6c
--- /dev/null
+++ b/volk/include/volk/volk_32f_convert_64f_u.h
@@ -0,0 +1,70 @@
+#ifndef INCLUDED_volk_32f_convert_64f_u_H
+#define INCLUDED_volk_32f_convert_64f_u_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE2
+#include <emmintrin.h>
+ /*!
+ \brief Converts the float values into double values
+ \param dVector The converted double vector values
+ \param fVector The float vector values to be converted
+ \param num_points The number of points in the two vectors to be converted
+ */
+static inline void volk_32f_convert_64f_u_sse2(double* outputVector, const float* inputVector, unsigned int num_points){
+ unsigned int number = 0;
+
+ const unsigned int quarterPoints = num_points / 4;
+
+ const float* inputVectorPtr = (const float*)inputVector;
+ double* outputVectorPtr = outputVector;
+ __m128d ret;
+ __m128 inputVal;
+
+ for(;number < quarterPoints; number++){
+ inputVal = _mm_loadu_ps(inputVectorPtr); inputVectorPtr += 4;
+
+ ret = _mm_cvtps_pd(inputVal);
+
+ _mm_storeu_pd(outputVectorPtr, ret);
+ outputVectorPtr += 2;
+
+ inputVal = _mm_movehl_ps(inputVal, inputVal);
+
+ ret = _mm_cvtps_pd(inputVal);
+
+ _mm_storeu_pd(outputVectorPtr, ret);
+ outputVectorPtr += 2;
+ }
+
+ number = quarterPoints * 4;
+ for(; number < num_points; number++){
+ outputVector[number] = (double)(inputVector[number]);
+ }
+}
+#endif /* LV_HAVE_SSE2 */
+
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Converts the float values into double values
+ \param dVector The converted double vector values
+ \param fVector The float vector values to be converted
+ \param num_points The number of points in the two vectors to be converted
+*/
+static inline void volk_32f_convert_64f_u_generic(double* outputVector, const float* inputVector, unsigned int num_points){
+ double* outputVectorPtr = outputVector;
+ const float* inputVectorPtr = inputVector;
+ unsigned int number = 0;
+
+ for(number = 0; number < num_points; number++){
+ *outputVectorPtr++ = ((double)(*inputVectorPtr++));
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_32f_convert_64f_u_H */
diff --git a/volk/include/volk/volk_32f_index_max_16u_a.h b/volk/include/volk/volk_32f_index_max_16u_a.h
new file mode 100644
index 000000000..b9ca1dd3e
--- /dev/null
+++ b/volk/include/volk/volk_32f_index_max_16u_a.h
@@ -0,0 +1,149 @@
+#ifndef INCLUDED_volk_32f_index_max_16u_a_H
+#define INCLUDED_volk_32f_index_max_16u_a_H
+
+#include <volk/volk_common.h>
+#include <volk/volk_common.h>
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE4_1
+#include<smmintrin.h>
+
+static inline void volk_32f_index_max_16u_a_sse4_1(unsigned int* target, const float* src0, unsigned int num_points) {
+ if(num_points > 0){
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+
+ float* inputPtr = (float*)src0;
+
+ __m128 indexIncrementValues = _mm_set1_ps(4);
+ __m128 currentIndexes = _mm_set_ps(-1,-2,-3,-4);
+
+ float max = src0[0];
+ float index = 0;
+ __m128 maxValues = _mm_set1_ps(max);
+ __m128 maxValuesIndex = _mm_setzero_ps();
+ __m128 compareResults;
+ __m128 currentValues;
+
+ __VOLK_ATTR_ALIGNED(16) float maxValuesBuffer[4];
+ __VOLK_ATTR_ALIGNED(16) float maxIndexesBuffer[4];
+
+ for(;number < quarterPoints; number++){
+
+ currentValues = _mm_load_ps(inputPtr); inputPtr += 4;
+ currentIndexes = _mm_add_ps(currentIndexes, indexIncrementValues);
+
+ compareResults = _mm_cmpgt_ps(maxValues, currentValues);
+
+ maxValuesIndex = _mm_blendv_ps(currentIndexes, maxValuesIndex, compareResults);
+ maxValues = _mm_blendv_ps(currentValues, maxValues, compareResults);
+ }
+
+ // Calculate the largest value from the remaining 4 points
+ _mm_store_ps(maxValuesBuffer, maxValues);
+ _mm_store_ps(maxIndexesBuffer, maxValuesIndex);
+
+ for(number = 0; number < 4; number++){
+ if(maxValuesBuffer[number] > max){
+ index = maxIndexesBuffer[number];
+ max = maxValuesBuffer[number];
+ }
+ }
+
+ number = quarterPoints * 4;
+ for(;number < num_points; number++){
+ if(src0[number] > max){
+ index = number;
+ max = src0[number];
+ }
+ }
+ target[0] = (unsigned int)index;
+ }
+}
+
+#endif /*LV_HAVE_SSE4_1*/
+
+#ifdef LV_HAVE_SSE
+#include<xmmintrin.h>
+
+static inline void volk_32f_index_max_16u_a_sse(unsigned int* target, const float* src0, unsigned int num_points) {
+ if(num_points > 0){
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+
+ float* inputPtr = (float*)src0;
+
+ __m128 indexIncrementValues = _mm_set1_ps(4);
+ __m128 currentIndexes = _mm_set_ps(-1,-2,-3,-4);
+
+ float max = src0[0];
+ float index = 0;
+ __m128 maxValues = _mm_set1_ps(max);
+ __m128 maxValuesIndex = _mm_setzero_ps();
+ __m128 compareResults;
+ __m128 currentValues;
+
+ __VOLK_ATTR_ALIGNED(16) float maxValuesBuffer[4];
+ __VOLK_ATTR_ALIGNED(16) float maxIndexesBuffer[4];
+
+ for(;number < quarterPoints; number++){
+
+ currentValues = _mm_load_ps(inputPtr); inputPtr += 4;
+ currentIndexes = _mm_add_ps(currentIndexes, indexIncrementValues);
+
+ compareResults = _mm_cmpgt_ps(maxValues, currentValues);
+
+ maxValuesIndex = _mm_or_ps(_mm_and_ps(compareResults, maxValuesIndex) , _mm_andnot_ps(compareResults, currentIndexes));
+
+ maxValues = _mm_or_ps(_mm_and_ps(compareResults, maxValues) , _mm_andnot_ps(compareResults, currentValues));
+ }
+
+ // Calculate the largest value from the remaining 4 points
+ _mm_store_ps(maxValuesBuffer, maxValues);
+ _mm_store_ps(maxIndexesBuffer, maxValuesIndex);
+
+ for(number = 0; number < 4; number++){
+ if(maxValuesBuffer[number] > max){
+ index = maxIndexesBuffer[number];
+ max = maxValuesBuffer[number];
+ }
+ }
+
+ number = quarterPoints * 4;
+ for(;number < num_points; number++){
+ if(src0[number] > max){
+ index = number;
+ max = src0[number];
+ }
+ }
+ target[0] = (unsigned int)index;
+ }
+}
+
+#endif /*LV_HAVE_SSE*/
+
+#ifdef LV_HAVE_GENERIC
+static inline void volk_32f_index_max_16u_a_generic(unsigned int* target, const float* src0, unsigned int num_points) {
+ if(num_points > 0){
+ float max = src0[0];
+ unsigned int index = 0;
+
+ unsigned int i = 1;
+
+ for(; i < num_points; ++i) {
+
+ if(src0[i] > max){
+ index = i;
+ max = src0[i];
+ }
+
+ }
+ target[0] = index;
+ }
+}
+
+#endif /*LV_HAVE_GENERIC*/
+
+
+#endif /*INCLUDED_volk_32f_index_max_16u_a_H*/
diff --git a/volk/include/volk/volk_32f_s32f_32f_fm_detect_32f_a.h b/volk/include/volk/volk_32f_s32f_32f_fm_detect_32f_a.h
new file mode 100644
index 000000000..43713f8b5
--- /dev/null
+++ b/volk/include/volk/volk_32f_s32f_32f_fm_detect_32f_a.h
@@ -0,0 +1,120 @@
+#ifndef INCLUDED_volk_32f_s32f_32f_fm_detect_32f_a_H
+#define INCLUDED_volk_32f_s32f_32f_fm_detect_32f_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+/*!
+ \brief performs the FM-detect differentiation on the input vector and stores the results in the output vector.
+ \param outputVector The byte-aligned vector where the results will be stored.
+ \param inputVector The byte-aligned input vector containing phase data (must be on the interval (-bound,bound] )
+ \param bound The interval that the input phase data is in, which is used to modulo the differentiation
+ \param saveValue A pointer to a float which contains the phase value of the sample before the first input sample.
+ \param num_noints The number of real values in the input vector.
+*/
+static inline void volk_32f_s32f_32f_fm_detect_32f_a_sse(float* outputVector, const float* inputVector, const float bound, float* saveValue, unsigned int num_points){
+ if (num_points < 1) {
+ return;
+ }
+ unsigned int number = 1;
+ unsigned int j = 0;
+ // num_points-1 keeps Fedora 7's gcc from crashing...
+ // num_points won't work. :(
+ const unsigned int quarterPoints = (num_points-1) / 4;
+
+ float* outPtr = outputVector;
+ const float* inPtr = inputVector;
+ __m128 upperBound = _mm_set_ps1(bound);
+ __m128 lowerBound = _mm_set_ps1(-bound);
+ __m128 next3old1;
+ __m128 next4;
+ __m128 boundAdjust;
+ __m128 posBoundAdjust = _mm_set_ps1(-2*bound); // Subtract when we're above.
+ __m128 negBoundAdjust = _mm_set_ps1(2*bound); // Add when we're below.
+ // Do the first 4 by hand since we're going in from the saveValue:
+ *outPtr = *inPtr - *saveValue;
+ if (*outPtr > bound) *outPtr -= 2*bound;
+ if (*outPtr < -bound) *outPtr += 2*bound;
+ inPtr++;
+ outPtr++;
+ for (j = 1; j < ( (4 < num_points) ? 4 : num_points); j++) {
+ *outPtr = *(inPtr) - *(inPtr-1);
+ if (*outPtr > bound) *outPtr -= 2*bound;
+ if (*outPtr < -bound) *outPtr += 2*bound;
+ inPtr++;
+ outPtr++;
+ }
+
+ for (; number < quarterPoints; number++) {
+ // Load data
+ next3old1 = _mm_loadu_ps((float*) (inPtr-1));
+ next4 = _mm_load_ps(inPtr);
+ inPtr += 4;
+ // Subtract and store:
+ next3old1 = _mm_sub_ps(next4, next3old1);
+ // Bound:
+ boundAdjust = _mm_cmpgt_ps(next3old1, upperBound);
+ boundAdjust = _mm_and_ps(boundAdjust, posBoundAdjust);
+ next4 = _mm_cmplt_ps(next3old1, lowerBound);
+ next4 = _mm_and_ps(next4, negBoundAdjust);
+ boundAdjust = _mm_or_ps(next4, boundAdjust);
+ // Make sure we're in the bounding interval:
+ next3old1 = _mm_add_ps(next3old1, boundAdjust);
+ _mm_store_ps(outPtr,next3old1); // Store the results back into the output
+ outPtr += 4;
+ }
+
+ for (number = (4 > (quarterPoints*4) ? 4 : (4 * quarterPoints)); number < num_points; number++) {
+ *outPtr = *(inPtr) - *(inPtr-1);
+ if (*outPtr > bound) *outPtr -= 2*bound;
+ if (*outPtr < -bound) *outPtr += 2*bound;
+ inPtr++;
+ outPtr++;
+ }
+
+ *saveValue = inputVector[num_points-1];
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief performs the FM-detect differentiation on the input vector and stores the results in the output vector.
+ \param outputVector The byte-aligned vector where the results will be stored.
+ \param inputVector The byte-aligned input vector containing phase data (must be on the interval (-bound,bound] )
+ \param bound The interval that the input phase data is in, which is used to modulo the differentiation
+ \param saveValue A pointer to a float which contains the phase value of the sample before the first input sample.
+ \param num_points The number of real values in the input vector.
+*/
+static inline void volk_32f_s32f_32f_fm_detect_32f_a_generic(float* outputVector, const float* inputVector, const float bound, float* saveValue, unsigned int num_points){
+ if (num_points < 1) {
+ return;
+ }
+ unsigned int number = 0;
+ float* outPtr = outputVector;
+ const float* inPtr = inputVector;
+
+ // Do the first 1 by hand since we're going in from the saveValue:
+ *outPtr = *inPtr - *saveValue;
+ if (*outPtr > bound) *outPtr -= 2*bound;
+ if (*outPtr < -bound) *outPtr += 2*bound;
+ inPtr++;
+ outPtr++;
+
+ for (number = 1; number < num_points; number++) {
+ *outPtr = *(inPtr) - *(inPtr-1);
+ if (*outPtr > bound) *outPtr -= 2*bound;
+ if (*outPtr < -bound) *outPtr += 2*bound;
+ inPtr++;
+ outPtr++;
+ }
+
+ *saveValue = inputVector[num_points-1];
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_32f_s32f_32f_fm_detect_32f_a_H */
diff --git a/volk/include/volk/volk_32f_s32f_calc_spectral_noise_floor_32f_a.h b/volk/include/volk/volk_32f_s32f_calc_spectral_noise_floor_32f_a.h
new file mode 100644
index 000000000..db61e359d
--- /dev/null
+++ b/volk/include/volk/volk_32f_s32f_calc_spectral_noise_floor_32f_a.h
@@ -0,0 +1,168 @@
+#ifndef INCLUDED_volk_32f_s32f_calc_spectral_noise_floor_32f_a_H
+#define INCLUDED_volk_32f_s32f_calc_spectral_noise_floor_32f_a_H
+
+#include <volk/volk_common.h>
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+/*!
+ \brief Calculates the spectral noise floor of an input power spectrum
+
+ Calculates the spectral noise floor of an input power spectrum by determining the mean of the input power spectrum, then recalculating the mean excluding any power spectrum values that exceed the mean by the spectralExclusionValue (in dB). Provides a rough estimation of the signal noise floor.
+
+ \param realDataPoints The input power spectrum
+ \param num_points The number of data points in the input power spectrum vector
+ \param spectralExclusionValue The number of dB above the noise floor that a data point must be to be excluded from the noise floor calculation - default value is 20
+ \param noiseFloorAmplitude The noise floor of the input spectrum, in dB
+*/
+static inline void volk_32f_s32f_calc_spectral_noise_floor_32f_a_sse(float* noiseFloorAmplitude, const float* realDataPoints, const float spectralExclusionValue, const unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+
+ const float* dataPointsPtr = realDataPoints;
+ __VOLK_ATTR_ALIGNED(16) float avgPointsVector[4];
+
+ __m128 dataPointsVal;
+ __m128 avgPointsVal = _mm_setzero_ps();
+ // Calculate the sum (for mean) for all points
+ for(; number < quarterPoints; number++){
+
+ dataPointsVal = _mm_load_ps(dataPointsPtr);
+
+ dataPointsPtr += 4;
+
+ avgPointsVal = _mm_add_ps(avgPointsVal, dataPointsVal);
+ }
+
+ _mm_store_ps(avgPointsVector, avgPointsVal);
+
+ float sumMean = 0.0;
+ sumMean += avgPointsVector[0];
+ sumMean += avgPointsVector[1];
+ sumMean += avgPointsVector[2];
+ sumMean += avgPointsVector[3];
+
+ number = quarterPoints * 4;
+ for(;number < num_points; number++){
+ sumMean += realDataPoints[number];
+ }
+
+ // calculate the spectral mean
+ // +20 because for the comparison below we only want to throw out bins
+ // that are significantly higher (and would, thus, affect the mean more
+ const float meanAmplitude = (sumMean / ((float)num_points)) + spectralExclusionValue;
+
+ dataPointsPtr = realDataPoints; // Reset the dataPointsPtr
+ __m128 vMeanAmplitudeVector = _mm_set_ps1(meanAmplitude);
+ __m128 vOnesVector = _mm_set_ps1(1.0);
+ __m128 vValidBinCount = _mm_setzero_ps();
+ avgPointsVal = _mm_setzero_ps();
+ __m128 compareMask;
+ number = 0;
+ // Calculate the sum (for mean) for any points which do NOT exceed the mean amplitude
+ for(; number < quarterPoints; number++){
+
+ dataPointsVal = _mm_load_ps(dataPointsPtr);
+
+ dataPointsPtr += 4;
+
+ // Identify which items do not exceed the mean amplitude
+ compareMask = _mm_cmple_ps(dataPointsVal, vMeanAmplitudeVector);
+
+ // Mask off the items that exceed the mean amplitude and add the avg Points that do not exceed the mean amplitude
+ avgPointsVal = _mm_add_ps(avgPointsVal, _mm_and_ps(compareMask, dataPointsVal));
+
+ // Count the number of bins which do not exceed the mean amplitude
+ vValidBinCount = _mm_add_ps(vValidBinCount, _mm_and_ps(compareMask, vOnesVector));
+ }
+
+ // Calculate the mean from the remaining data points
+ _mm_store_ps(avgPointsVector, avgPointsVal);
+
+ sumMean = 0.0;
+ sumMean += avgPointsVector[0];
+ sumMean += avgPointsVector[1];
+ sumMean += avgPointsVector[2];
+ sumMean += avgPointsVector[3];
+
+ // Calculate the number of valid bins from the remaning count
+ __VOLK_ATTR_ALIGNED(16) float validBinCountVector[4];
+ _mm_store_ps(validBinCountVector, vValidBinCount);
+
+ float validBinCount = 0;
+ validBinCount += validBinCountVector[0];
+ validBinCount += validBinCountVector[1];
+ validBinCount += validBinCountVector[2];
+ validBinCount += validBinCountVector[3];
+
+ number = quarterPoints * 4;
+ for(;number < num_points; number++){
+ if(realDataPoints[number] <= meanAmplitude){
+ sumMean += realDataPoints[number];
+ validBinCount += 1.0;
+ }
+ }
+
+ float localNoiseFloorAmplitude = 0;
+ if(validBinCount > 0.0){
+ localNoiseFloorAmplitude = sumMean / validBinCount;
+ }
+ else{
+ localNoiseFloorAmplitude = meanAmplitude; // For the odd case that all the amplitudes are equal...
+ }
+
+ *noiseFloorAmplitude = localNoiseFloorAmplitude;
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Calculates the spectral noise floor of an input power spectrum
+
+ Calculates the spectral noise floor of an input power spectrum by determining the mean of the input power spectrum, then recalculating the mean excluding any power spectrum values that exceed the mean by the spectralExclusionValue (in dB). Provides a rough estimation of the signal noise floor.
+
+ \param realDataPoints The input power spectrum
+ \param num_points The number of data points in the input power spectrum vector
+ \param spectralExclusionValue The number of dB above the noise floor that a data point must be to be excluded from the noise floor calculation - default value is 20
+ \param noiseFloorAmplitude The noise floor of the input spectrum, in dB
+*/
+static inline void volk_32f_s32f_calc_spectral_noise_floor_32f_a_generic(float* noiseFloorAmplitude, const float* realDataPoints, const float spectralExclusionValue, const unsigned int num_points){
+ float sumMean = 0.0;
+ unsigned int number;
+ // find the sum (for mean), etc
+ for(number = 0; number < num_points; number++){
+ // sum (for mean)
+ sumMean += realDataPoints[number];
+ }
+
+ // calculate the spectral mean
+ // +20 because for the comparison below we only want to throw out bins
+ // that are significantly higher (and would, thus, affect the mean more)
+ const float meanAmplitude = (sumMean / num_points) + spectralExclusionValue;
+
+ // now throw out any bins higher than the mean
+ sumMean = 0.0;
+ unsigned int newNumDataPoints = num_points;
+ for(number = 0; number < num_points; number++){
+ if (realDataPoints[number] <= meanAmplitude)
+ sumMean += realDataPoints[number];
+ else
+ newNumDataPoints--;
+ }
+
+ float localNoiseFloorAmplitude = 0.0;
+ if (newNumDataPoints == 0) // in the odd case that all
+ localNoiseFloorAmplitude = meanAmplitude; // amplitudes are equal!
+ else
+ localNoiseFloorAmplitude = sumMean / ((float)newNumDataPoints);
+
+ *noiseFloorAmplitude = localNoiseFloorAmplitude;
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_32f_s32f_calc_spectral_noise_floor_32f_a_H */
diff --git a/volk/include/volk/volk_32f_s32f_convert_16i_a.h b/volk/include/volk/volk_32f_s32f_convert_16i_a.h
new file mode 100644
index 000000000..9df4946f2
--- /dev/null
+++ b/volk/include/volk/volk_32f_s32f_convert_16i_a.h
@@ -0,0 +1,150 @@
+#ifndef INCLUDED_volk_32f_s32f_convert_16i_a_H
+#define INCLUDED_volk_32f_s32f_convert_16i_a_H
+
+#include <volk/volk_common.h>
+#include <inttypes.h>
+#include <stdio.h>
+#include <math.h>
+
+#ifdef LV_HAVE_SSE2
+#include <emmintrin.h>
+ /*!
+ \brief Multiplies each point in the input buffer by the scalar value, then converts the result into a 16 bit integer value
+ \param inputVector The floating point input data buffer
+ \param outputVector The 16 bit output data buffer
+ \param scalar The value multiplied against each point in the input buffer
+ \param num_points The number of data values to be converted
+ */
+static inline void volk_32f_s32f_convert_16i_a_sse2(int16_t* outputVector, const float* inputVector, const float scalar, unsigned int num_points){
+ unsigned int number = 0;
+
+ const unsigned int eighthPoints = num_points / 8;
+
+ const float* inputVectorPtr = (const float*)inputVector;
+ int16_t* outputVectorPtr = outputVector;
+
+ float min_val = -32768;
+ float max_val = 32767;
+ float r;
+
+ __m128 vScalar = _mm_set_ps1(scalar);
+ __m128 inputVal1, inputVal2;
+ __m128i intInputVal1, intInputVal2;
+ __m128 ret1, ret2;
+ __m128 vmin_val = _mm_set_ps1(min_val);
+ __m128 vmax_val = _mm_set_ps1(max_val);
+
+ for(;number < eighthPoints; number++){
+ inputVal1 = _mm_load_ps(inputVectorPtr); inputVectorPtr += 4;
+ inputVal2 = _mm_load_ps(inputVectorPtr); inputVectorPtr += 4;
+
+ // Scale and clip
+ ret1 = _mm_max_ps(_mm_min_ps(_mm_mul_ps(inputVal1, vScalar), vmax_val), vmin_val);
+ ret2 = _mm_max_ps(_mm_min_ps(_mm_mul_ps(inputVal2, vScalar), vmax_val), vmin_val);
+
+ intInputVal1 = _mm_cvtps_epi32(ret1);
+ intInputVal2 = _mm_cvtps_epi32(ret2);
+
+ intInputVal1 = _mm_packs_epi32(intInputVal1, intInputVal2);
+
+ _mm_store_si128((__m128i*)outputVectorPtr, intInputVal1);
+ outputVectorPtr += 8;
+ }
+
+ number = eighthPoints * 8;
+ for(; number < num_points; number++){
+ r = inputVector[number] * scalar;
+ if(r > max_val)
+ r = max_val;
+ else if(r < min_val)
+ r = min_val;
+ outputVector[number] = (int16_t)rintf(r);
+ }
+}
+#endif /* LV_HAVE_SSE2 */
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+ /*!
+ \brief Multiplies each point in the input buffer by the scalar value, then converts the result into a 16 bit integer value
+ \param inputVector The floating point input data buffer
+ \param outputVector The 16 bit output data buffer
+ \param scalar The value multiplied against each point in the input buffer
+ \param num_points The number of data values to be converted
+ */
+static inline void volk_32f_s32f_convert_16i_a_sse(int16_t* outputVector, const float* inputVector, const float scalar, unsigned int num_points){
+ unsigned int number = 0;
+
+ const unsigned int quarterPoints = num_points / 4;
+
+ const float* inputVectorPtr = (const float*)inputVector;
+ int16_t* outputVectorPtr = outputVector;
+
+ float min_val = -32768;
+ float max_val = 32767;
+ float r;
+
+ __m128 vScalar = _mm_set_ps1(scalar);
+ __m128 ret;
+ __m128 vmin_val = _mm_set_ps1(min_val);
+ __m128 vmax_val = _mm_set_ps1(max_val);
+
+ __VOLK_ATTR_ALIGNED(16) float outputFloatBuffer[4];
+
+ for(;number < quarterPoints; number++){
+ ret = _mm_load_ps(inputVectorPtr);
+ inputVectorPtr += 4;
+
+ // Scale and clip
+ ret = _mm_max_ps(_mm_min_ps(_mm_mul_ps(ret, vScalar), vmax_val), vmin_val);
+
+ _mm_store_ps(outputFloatBuffer, ret);
+ *outputVectorPtr++ = (int16_t)rintf(outputFloatBuffer[0]);
+ *outputVectorPtr++ = (int16_t)rintf(outputFloatBuffer[1]);
+ *outputVectorPtr++ = (int16_t)rintf(outputFloatBuffer[2]);
+ *outputVectorPtr++ = (int16_t)rintf(outputFloatBuffer[3]);
+ }
+
+ number = quarterPoints * 4;
+ for(; number < num_points; number++){
+ r = inputVector[number] * scalar;
+ if(r > max_val)
+ r = max_val;
+ else if(r < min_val)
+ r = min_val;
+ outputVector[number] = (int16_t)rintf(r);
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+ /*!
+ \brief Multiplies each point in the input buffer by the scalar value, then converts the result into a 16 bit integer value
+ \param inputVector The floating point input data buffer
+ \param outputVector The 16 bit output data buffer
+ \param scalar The value multiplied against each point in the input buffer
+ \param num_points The number of data values to be converted
+ */
+static inline void volk_32f_s32f_convert_16i_a_generic(int16_t* outputVector, const float* inputVector, const float scalar, unsigned int num_points){
+ int16_t* outputVectorPtr = outputVector;
+ const float* inputVectorPtr = inputVector;
+ unsigned int number = 0;
+ float min_val = -32768;
+ float max_val = 32767;
+ float r;
+
+ for(number = 0; number < num_points; number++){
+ r = *inputVectorPtr++ * scalar;
+ if(r < min_val)
+ r = min_val;
+ else if(r > max_val)
+ r = max_val;
+ *outputVectorPtr++ = (int16_t)rintf(r);
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_32f_s32f_convert_16i_a_H */
diff --git a/volk/include/volk/volk_32f_s32f_convert_16i_u.h b/volk/include/volk/volk_32f_s32f_convert_16i_u.h
new file mode 100644
index 000000000..56e42c9bd
--- /dev/null
+++ b/volk/include/volk/volk_32f_s32f_convert_16i_u.h
@@ -0,0 +1,152 @@
+#ifndef INCLUDED_volk_32f_s32f_convert_16i_u_H
+#define INCLUDED_volk_32f_s32f_convert_16i_u_H
+
+#include <inttypes.h>
+#include <stdio.h>
+#include <math.h>
+
+#ifdef LV_HAVE_SSE2
+#include <emmintrin.h>
+ /*!
+ \brief Multiplies each point in the input buffer by the scalar value, then converts the result into a 16 bit integer value
+ \param inputVector The floating point input data buffer
+ \param outputVector The 16 bit output data buffer
+ \param scalar The value multiplied against each point in the input buffer
+ \param num_points The number of data values to be converted
+ \note Input buffer does NOT need to be properly aligned
+ */
+static inline void volk_32f_s32f_convert_16i_u_sse2(int16_t* outputVector, const float* inputVector, const float scalar, unsigned int num_points){
+ unsigned int number = 0;
+
+ const unsigned int eighthPoints = num_points / 8;
+
+ const float* inputVectorPtr = (const float*)inputVector;
+ int16_t* outputVectorPtr = outputVector;
+
+ float min_val = -32768;
+ float max_val = 32767;
+ float r;
+
+ __m128 vScalar = _mm_set_ps1(scalar);
+ __m128 inputVal1, inputVal2;
+ __m128i intInputVal1, intInputVal2;
+ __m128 ret1, ret2;
+ __m128 vmin_val = _mm_set_ps1(min_val);
+ __m128 vmax_val = _mm_set_ps1(max_val);
+
+ for(;number < eighthPoints; number++){
+ inputVal1 = _mm_loadu_ps(inputVectorPtr); inputVectorPtr += 4;
+ inputVal2 = _mm_loadu_ps(inputVectorPtr); inputVectorPtr += 4;
+
+ // Scale and clip
+ ret1 = _mm_max_ps(_mm_min_ps(_mm_mul_ps(inputVal1, vScalar), vmax_val), vmin_val);
+ ret2 = _mm_max_ps(_mm_min_ps(_mm_mul_ps(inputVal2, vScalar), vmax_val), vmin_val);
+
+ intInputVal1 = _mm_cvtps_epi32(ret1);
+ intInputVal2 = _mm_cvtps_epi32(ret2);
+
+ intInputVal1 = _mm_packs_epi32(intInputVal1, intInputVal2);
+
+ _mm_storeu_si128((__m128i*)outputVectorPtr, intInputVal1);
+ outputVectorPtr += 8;
+ }
+
+ number = eighthPoints * 8;
+ for(; number < num_points; number++){
+ r = inputVector[number] * scalar;
+ if(r > max_val)
+ r = max_val;
+ else if(r < min_val)
+ r = min_val;
+ outputVector[number] = (int16_t)rintf(r);
+ }
+}
+#endif /* LV_HAVE_SSE2 */
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+ /*!
+ \brief Multiplies each point in the input buffer by the scalar value, then converts the result into a 16 bit integer value
+ \param inputVector The floating point input data buffer
+ \param outputVector The 16 bit output data buffer
+ \param scalar The value multiplied against each point in the input buffer
+ \param num_points The number of data values to be converted
+ \note Input buffer does NOT need to be properly aligned
+ */
+static inline void volk_32f_s32f_convert_16i_u_sse(int16_t* outputVector, const float* inputVector, const float scalar, unsigned int num_points){
+ unsigned int number = 0;
+
+ const unsigned int quarterPoints = num_points / 4;
+
+ const float* inputVectorPtr = (const float*)inputVector;
+ int16_t* outputVectorPtr = outputVector;
+
+ float min_val = -32768;
+ float max_val = 32767;
+ float r;
+
+ __m128 vScalar = _mm_set_ps1(scalar);
+ __m128 ret;
+ __m128 vmin_val = _mm_set_ps1(min_val);
+ __m128 vmax_val = _mm_set_ps1(max_val);
+
+ __VOLK_ATTR_ALIGNED(16) float outputFloatBuffer[4];
+
+ for(;number < quarterPoints; number++){
+ ret = _mm_loadu_ps(inputVectorPtr);
+ inputVectorPtr += 4;
+
+ // Scale and clip
+ ret = _mm_max_ps(_mm_min_ps(_mm_mul_ps(ret, vScalar), vmax_val), vmin_val);
+
+ _mm_store_ps(outputFloatBuffer, ret);
+ *outputVectorPtr++ = (int16_t)rintf(outputFloatBuffer[0]);
+ *outputVectorPtr++ = (int16_t)rintf(outputFloatBuffer[1]);
+ *outputVectorPtr++ = (int16_t)rintf(outputFloatBuffer[2]);
+ *outputVectorPtr++ = (int16_t)rintf(outputFloatBuffer[3]);
+ }
+
+ number = quarterPoints * 4;
+ for(; number < num_points; number++){
+ r = inputVector[number] * scalar;
+ if(r > max_val)
+ r = max_val;
+ else if(r < min_val)
+ r = min_val;
+ outputVector[number] = (int16_t)rintf(r);
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+ /*!
+ \brief Multiplies each point in the input buffer by the scalar value, then converts the result into a 16 bit integer value
+ \param inputVector The floating point input data buffer
+ \param outputVector The 16 bit output data buffer
+ \param scalar The value multiplied against each point in the input buffer
+ \param num_points The number of data values to be converted
+ \note Input buffer does NOT need to be properly aligned
+ */
+static inline void volk_32f_s32f_convert_16i_u_generic(int16_t* outputVector, const float* inputVector, const float scalar, unsigned int num_points){
+ int16_t* outputVectorPtr = outputVector;
+ const float* inputVectorPtr = inputVector;
+ unsigned int number = 0;
+ float min_val = -32768;
+ float max_val = 32767;
+ float r;
+
+ for(number = 0; number < num_points; number++){
+ r = *inputVectorPtr++ * scalar;
+ if(r > max_val)
+ r = max_val;
+ else if(r < min_val)
+ r = min_val;
+ *outputVectorPtr++ = (int16_t)rintf(r);
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_32f_s32f_convert_16i_u_H */
diff --git a/volk/include/volk/volk_32f_s32f_convert_32i_a.h b/volk/include/volk/volk_32f_s32f_convert_32i_a.h
new file mode 100644
index 000000000..38e6b2e74
--- /dev/null
+++ b/volk/include/volk/volk_32f_s32f_convert_32i_a.h
@@ -0,0 +1,189 @@
+#ifndef INCLUDED_volk_32f_s32f_convert_32i_a_H
+#define INCLUDED_volk_32f_s32f_convert_32i_a_H
+
+#include <volk/volk_common.h>
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_AVX
+#include <immintrin.h>
+ /*!
+ \brief Multiplies each point in the input buffer by the scalar value, then converts the result into a 32 bit integer value
+ \param inputVector The floating point input data buffer
+ \param outputVector The 32 bit output data buffer
+ \param scalar The value multiplied against each point in the input buffer
+ \param num_points The number of data values to be converted
+ */
+static inline void volk_32f_s32f_convert_32i_a_avx(int32_t* outputVector, const float* inputVector, const float scalar, unsigned int num_points){
+ unsigned int number = 0;
+
+ const unsigned int eighthPoints = num_points / 8;
+
+ const float* inputVectorPtr = (const float*)inputVector;
+ int32_t* outputVectorPtr = outputVector;
+
+ float min_val = -2147483647;
+ float max_val = 2147483647;
+ float r;
+
+ __m256 vScalar = _mm256_set1_ps(scalar);
+ __m256 inputVal1;
+ __m256i intInputVal1;
+ __m256 vmin_val = _mm256_set1_ps(min_val);
+ __m256 vmax_val = _mm256_set1_ps(max_val);
+
+ for(;number < eighthPoints; number++){
+ inputVal1 = _mm256_load_ps(inputVectorPtr); inputVectorPtr += 8;
+
+ inputVal1 = _mm256_max_ps(_mm256_min_ps(_mm256_mul_ps(inputVal1, vScalar), vmax_val), vmin_val);
+ intInputVal1 = _mm256_cvtps_epi32(inputVal1);
+
+ _mm256_store_si256((__m256i*)outputVectorPtr, intInputVal1);
+ outputVectorPtr += 8;
+ }
+
+ number = eighthPoints * 8;
+ for(; number < num_points; number++){
+ r = inputVector[number] * scalar;
+ if(r > max_val)
+ r = max_val;
+ else if(r < min_val)
+ r = min_val;
+ outputVector[number] = (int32_t)(r);
+ }
+}
+#endif /* LV_HAVE_AVX */
+
+#ifdef LV_HAVE_SSE2
+#include <emmintrin.h>
+ /*!
+ \brief Multiplies each point in the input buffer by the scalar value, then converts the result into a 32 bit integer value
+ \param inputVector The floating point input data buffer
+ \param outputVector The 32 bit output data buffer
+ \param scalar The value multiplied against each point in the input buffer
+ \param num_points The number of data values to be converted
+ */
+static inline void volk_32f_s32f_convert_32i_a_sse2(int32_t* outputVector, const float* inputVector, const float scalar, unsigned int num_points){
+ unsigned int number = 0;
+
+ const unsigned int quarterPoints = num_points / 4;
+
+ const float* inputVectorPtr = (const float*)inputVector;
+ int32_t* outputVectorPtr = outputVector;
+
+ float min_val = -2147483647;
+ float max_val = 2147483647;
+ float r;
+
+ __m128 vScalar = _mm_set_ps1(scalar);
+ __m128 inputVal1;
+ __m128i intInputVal1;
+ __m128 vmin_val = _mm_set_ps1(min_val);
+ __m128 vmax_val = _mm_set_ps1(max_val);
+
+ for(;number < quarterPoints; number++){
+ inputVal1 = _mm_load_ps(inputVectorPtr); inputVectorPtr += 4;
+
+ inputVal1 = _mm_max_ps(_mm_min_ps(_mm_mul_ps(inputVal1, vScalar), vmax_val), vmin_val);
+ intInputVal1 = _mm_cvtps_epi32(inputVal1);
+
+ _mm_store_si128((__m128i*)outputVectorPtr, intInputVal1);
+ outputVectorPtr += 4;
+ }
+
+ number = quarterPoints * 4;
+ for(; number < num_points; number++){
+ r = inputVector[number] * scalar;
+ if(r > max_val)
+ r = max_val;
+ else if(r < min_val)
+ r = min_val;
+ outputVector[number] = (int32_t)(r);
+ }
+}
+#endif /* LV_HAVE_SSE2 */
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+ /*!
+ \brief Multiplies each point in the input buffer by the scalar value, then converts the result into a 32 bit integer value
+ \param inputVector The floating point input data buffer
+ \param outputVector The 32 bit output data buffer
+ \param scalar The value multiplied against each point in the input buffer
+ \param num_points The number of data values to be converted
+ */
+static inline void volk_32f_s32f_convert_32i_a_sse(int32_t* outputVector, const float* inputVector, const float scalar, unsigned int num_points){
+ unsigned int number = 0;
+
+ const unsigned int quarterPoints = num_points / 4;
+
+ const float* inputVectorPtr = (const float*)inputVector;
+ int32_t* outputVectorPtr = outputVector;
+
+ float min_val = -2147483647;
+ float max_val = 2147483647;
+ float r;
+
+ __m128 vScalar = _mm_set_ps1(scalar);
+ __m128 ret;
+ __m128 vmin_val = _mm_set_ps1(min_val);
+ __m128 vmax_val = _mm_set_ps1(max_val);
+
+ __VOLK_ATTR_ALIGNED(16) float outputFloatBuffer[4];
+
+ for(;number < quarterPoints; number++){
+ ret = _mm_load_ps(inputVectorPtr);
+ inputVectorPtr += 4;
+
+ ret = _mm_max_ps(_mm_min_ps(_mm_mul_ps(ret, vScalar), vmax_val), vmin_val);
+
+ _mm_store_ps(outputFloatBuffer, ret);
+ *outputVectorPtr++ = (int32_t)(outputFloatBuffer[0]);
+ *outputVectorPtr++ = (int32_t)(outputFloatBuffer[1]);
+ *outputVectorPtr++ = (int32_t)(outputFloatBuffer[2]);
+ *outputVectorPtr++ = (int32_t)(outputFloatBuffer[3]);
+ }
+
+ number = quarterPoints * 4;
+ for(; number < num_points; number++){
+ r = inputVector[number] * scalar;
+ if(r > max_val)
+ r = max_val;
+ else if(r < min_val)
+ r = min_val;
+ outputVector[number] = (int32_t)(r);
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+ /*!
+ \brief Multiplies each point in the input buffer by the scalar value, then converts the result into a 32 bit integer value
+ \param inputVector The floating point input data buffer
+ \param outputVector The 32 bit output data buffer
+ \param scalar The value multiplied against each point in the input buffer
+ \param num_points The number of data values to be converted
+ */
+static inline void volk_32f_s32f_convert_32i_a_generic(int32_t* outputVector, const float* inputVector, const float scalar, unsigned int num_points){
+ int32_t* outputVectorPtr = outputVector;
+ const float* inputVectorPtr = inputVector;
+ unsigned int number = 0;
+ float min_val = -2147483647;
+ float max_val = 2147483647;
+ float r;
+
+ for(number = 0; number < num_points; number++){
+ r = *inputVectorPtr++ * scalar;
+ if(r > max_val)
+ r = max_val;
+ else if(r < min_val)
+ r = min_val;
+ *outputVectorPtr++ = (int32_t)(r);
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_32f_s32f_convert_32i_a_H */
diff --git a/volk/include/volk/volk_32f_s32f_convert_32i_u.h b/volk/include/volk/volk_32f_s32f_convert_32i_u.h
new file mode 100644
index 000000000..ee15edb46
--- /dev/null
+++ b/volk/include/volk/volk_32f_s32f_convert_32i_u.h
@@ -0,0 +1,142 @@
+#ifndef INCLUDED_volk_32f_s32f_convert_32i_u_H
+#define INCLUDED_volk_32f_s32f_convert_32i_u_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE2
+#include <emmintrin.h>
+ /*!
+ \brief Multiplies each point in the input buffer by the scalar value, then converts the result into a 32 bit integer value
+ \param inputVector The floating point input data buffer
+ \param outputVector The 32 bit output data buffer
+ \param scalar The value multiplied against each point in the input buffer
+ \param num_points The number of data values to be converted
+ \note Input buffer does NOT need to be properly aligned
+ */
+static inline void volk_32f_s32f_convert_32i_u_sse2(int32_t* outputVector, const float* inputVector, const float scalar, unsigned int num_points){
+ unsigned int number = 0;
+
+ const unsigned int quarterPoints = num_points / 4;
+
+ const float* inputVectorPtr = (const float*)inputVector;
+ int32_t* outputVectorPtr = outputVector;
+
+ float min_val = -2147483647;
+ float max_val = 2147483647;
+ float r;
+
+ __m128 vScalar = _mm_set_ps1(scalar);
+ __m128 inputVal1;
+ __m128i intInputVal1;
+ __m128 vmin_val = _mm_set_ps1(min_val);
+ __m128 vmax_val = _mm_set_ps1(max_val);
+
+ for(;number < quarterPoints; number++){
+ inputVal1 = _mm_loadu_ps(inputVectorPtr); inputVectorPtr += 4;
+
+ inputVal1 = _mm_max_ps(_mm_min_ps(_mm_mul_ps(inputVal1, vScalar), vmax_val), vmin_val);
+ intInputVal1 = _mm_cvtps_epi32(inputVal1);
+
+ _mm_storeu_si128((__m128i*)outputVectorPtr, intInputVal1);
+ outputVectorPtr += 4;
+ }
+
+ number = quarterPoints * 4;
+ for(; number < num_points; number++){
+ r = inputVector[number] * scalar;
+ if(r > max_val)
+ r = max_val;
+ else if(r < min_val)
+ r = min_val;
+ outputVector[number] = (int32_t)(r);
+ }
+}
+#endif /* LV_HAVE_SSE2 */
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+ /*!
+ \brief Multiplies each point in the input buffer by the scalar value, then converts the result into a 32 bit integer value
+ \param inputVector The floating point input data buffer
+ \param outputVector The 32 bit output data buffer
+ \param scalar The value multiplied against each point in the input buffer
+ \param num_points The number of data values to be converted
+ \note Input buffer does NOT need to be properly aligned
+ */
+static inline void volk_32f_s32f_convert_32i_u_sse(int32_t* outputVector, const float* inputVector, const float scalar, unsigned int num_points){
+ unsigned int number = 0;
+
+ const unsigned int quarterPoints = num_points / 4;
+
+ const float* inputVectorPtr = (const float*)inputVector;
+ int32_t* outputVectorPtr = outputVector;
+
+ float min_val = -2147483647;
+ float max_val = 2147483647;
+ float r;
+
+ __m128 vScalar = _mm_set_ps1(scalar);
+ __m128 ret;
+ __m128 vmin_val = _mm_set_ps1(min_val);
+ __m128 vmax_val = _mm_set_ps1(max_val);
+
+ __VOLK_ATTR_ALIGNED(16) float outputFloatBuffer[4];
+
+ for(;number < quarterPoints; number++){
+ ret = _mm_loadu_ps(inputVectorPtr);
+ inputVectorPtr += 4;
+
+ ret = _mm_max_ps(_mm_min_ps(_mm_mul_ps(ret, vScalar), vmax_val), vmin_val);
+
+ _mm_store_ps(outputFloatBuffer, ret);
+ *outputVectorPtr++ = (int32_t)(outputFloatBuffer[0]);
+ *outputVectorPtr++ = (int32_t)(outputFloatBuffer[1]);
+ *outputVectorPtr++ = (int32_t)(outputFloatBuffer[2]);
+ *outputVectorPtr++ = (int32_t)(outputFloatBuffer[3]);
+ }
+
+ number = quarterPoints * 4;
+ for(; number < num_points; number++){
+ r = inputVector[number] * scalar;
+ if(r > max_val)
+ r = max_val;
+ else if(r < min_val)
+ r = min_val;
+ outputVector[number] = (int32_t)(r);
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+ /*!
+ \brief Multiplies each point in the input buffer by the scalar value, then converts the result into a 32 bit integer value
+ \param inputVector The floating point input data buffer
+ \param outputVector The 32 bit output data buffer
+ \param scalar The value multiplied against each point in the input buffer
+ \param num_points The number of data values to be converted
+ \note Input buffer does NOT need to be properly aligned
+ */
+static inline void volk_32f_s32f_convert_32i_u_generic(int32_t* outputVector, const float* inputVector, const float scalar, unsigned int num_points){
+ int32_t* outputVectorPtr = outputVector;
+ const float* inputVectorPtr = inputVector;
+ unsigned int number = 0;
+ float min_val = -2147483647;
+ float max_val = 2147483647;
+ float r;
+
+ for(number = 0; number < num_points; number++){
+ r = *inputVectorPtr++ * scalar;
+ if(r > max_val)
+ r = max_val;
+ else if(r < min_val)
+ r = min_val;
+ *outputVectorPtr++ = (int32_t)(r);
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_32f_s32f_convert_32i_u_H */
diff --git a/volk/include/volk/volk_32f_s32f_convert_8i_a.h b/volk/include/volk/volk_32f_s32f_convert_8i_a.h
new file mode 100644
index 000000000..800017d5d
--- /dev/null
+++ b/volk/include/volk/volk_32f_s32f_convert_8i_a.h
@@ -0,0 +1,155 @@
+#ifndef INCLUDED_volk_32f_s32f_convert_8i_a_H
+#define INCLUDED_volk_32f_s32f_convert_8i_a_H
+
+#include <volk/volk_common.h>
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE2
+#include <emmintrin.h>
+ /*!
+ \brief Multiplies each point in the input buffer by the scalar value, then converts the result into a 8 bit integer value
+ \param inputVector The floating point input data buffer
+ \param outputVector The 8 bit output data buffer
+ \param scalar The value multiplied against each point in the input buffer
+ \param num_points The number of data values to be converted
+ */
+static inline void volk_32f_s32f_convert_8i_a_sse2(int8_t* outputVector, const float* inputVector, const float scalar, unsigned int num_points){
+ unsigned int number = 0;
+
+ const unsigned int sixteenthPoints = num_points / 16;
+
+ const float* inputVectorPtr = (const float*)inputVector;
+ int8_t* outputVectorPtr = outputVector;
+
+ float min_val = -128;
+ float max_val = 127;
+ float r;
+
+ __m128 vScalar = _mm_set_ps1(scalar);
+ __m128 inputVal1, inputVal2, inputVal3, inputVal4;
+ __m128i intInputVal1, intInputVal2, intInputVal3, intInputVal4;
+ __m128 vmin_val = _mm_set_ps1(min_val);
+ __m128 vmax_val = _mm_set_ps1(max_val);
+
+ for(;number < sixteenthPoints; number++){
+ inputVal1 = _mm_load_ps(inputVectorPtr); inputVectorPtr += 4;
+ inputVal2 = _mm_load_ps(inputVectorPtr); inputVectorPtr += 4;
+ inputVal3 = _mm_load_ps(inputVectorPtr); inputVectorPtr += 4;
+ inputVal4 = _mm_load_ps(inputVectorPtr); inputVectorPtr += 4;
+
+ inputVal1 = _mm_max_ps(_mm_min_ps(_mm_mul_ps(inputVal1, vScalar), vmax_val), vmin_val);
+ inputVal2 = _mm_max_ps(_mm_min_ps(_mm_mul_ps(inputVal2, vScalar), vmax_val), vmin_val);
+ inputVal3 = _mm_max_ps(_mm_min_ps(_mm_mul_ps(inputVal3, vScalar), vmax_val), vmin_val);
+ inputVal4 = _mm_max_ps(_mm_min_ps(_mm_mul_ps(inputVal4, vScalar), vmax_val), vmin_val);
+
+ intInputVal1 = _mm_cvtps_epi32(inputVal1);
+ intInputVal2 = _mm_cvtps_epi32(inputVal2);
+ intInputVal3 = _mm_cvtps_epi32(inputVal3);
+ intInputVal4 = _mm_cvtps_epi32(inputVal4);
+
+ intInputVal1 = _mm_packs_epi32(intInputVal1, intInputVal2);
+ intInputVal3 = _mm_packs_epi32(intInputVal3, intInputVal4);
+
+ intInputVal1 = _mm_packs_epi16(intInputVal1, intInputVal3);
+
+ _mm_store_si128((__m128i*)outputVectorPtr, intInputVal1);
+ outputVectorPtr += 16;
+ }
+
+ number = sixteenthPoints * 16;
+ for(; number < num_points; number++){
+ r = inputVector[number] * scalar;
+ if(r > max_val)
+ r = max_val;
+ else if(r < min_val)
+ r = min_val;
+ outputVector[number] = (int8_t)(r);
+ }
+}
+#endif /* LV_HAVE_SSE2 */
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+ /*!
+ \brief Multiplies each point in the input buffer by the scalar value, then converts the result into a 8 bit integer value
+ \param inputVector The floating point input data buffer
+ \param outputVector The 8 bit output data buffer
+ \param scalar The value multiplied against each point in the input buffer
+ \param num_points The number of data values to be converted
+ */
+static inline void volk_32f_s32f_convert_8i_a_sse(int8_t* outputVector, const float* inputVector, const float scalar, unsigned int num_points){
+ unsigned int number = 0;
+
+ const unsigned int quarterPoints = num_points / 4;
+
+ const float* inputVectorPtr = (const float*)inputVector;
+
+ float min_val = -128;
+ float max_val = 127;
+ float r;
+
+ int8_t* outputVectorPtr = outputVector;
+ __m128 vScalar = _mm_set_ps1(scalar);
+ __m128 ret;
+ __m128 vmin_val = _mm_set_ps1(min_val);
+ __m128 vmax_val = _mm_set_ps1(max_val);
+
+ __VOLK_ATTR_ALIGNED(16) float outputFloatBuffer[4];
+
+ for(;number < quarterPoints; number++){
+ ret = _mm_load_ps(inputVectorPtr);
+ inputVectorPtr += 4;
+
+ ret = _mm_max_ps(_mm_min_ps(_mm_mul_ps(ret, vScalar), vmax_val), vmin_val);
+
+ _mm_store_ps(outputFloatBuffer, ret);
+ *outputVectorPtr++ = (int8_t)(outputFloatBuffer[0]);
+ *outputVectorPtr++ = (int8_t)(outputFloatBuffer[1]);
+ *outputVectorPtr++ = (int8_t)(outputFloatBuffer[2]);
+ *outputVectorPtr++ = (int8_t)(outputFloatBuffer[3]);
+ }
+
+ number = quarterPoints * 4;
+ for(; number < num_points; number++){
+ r = inputVector[number] * scalar;
+ if(r > max_val)
+ r = max_val;
+ else if(r < min_val)
+ r = min_val;
+ outputVector[number] = (int8_t)(r);
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+ /*!
+ \brief Multiplies each point in the input buffer by the scalar value, then converts the result into a 8 bit integer value
+ \param inputVector The floating point input data buffer
+ \param outputVector The 8 bit output data buffer
+ \param scalar The value multiplied against each point in the input buffer
+ \param num_points The number of data values to be converted
+ */
+static inline void volk_32f_s32f_convert_8i_a_generic(int8_t* outputVector, const float* inputVector, const float scalar, unsigned int num_points){
+ int8_t* outputVectorPtr = outputVector;
+ const float* inputVectorPtr = inputVector;
+ unsigned int number = 0;
+ float min_val = -128;
+ float max_val = 127;
+ float r;
+
+ for(number = 0; number < num_points; number++){
+ r = *inputVectorPtr++ * scalar;
+ if(r > max_val)
+ r = max_val;
+ else if(r < min_val)
+ r = min_val;
+ *outputVectorPtr++ = (int8_t)(r);
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_32f_s32f_convert_8i_a_H */
diff --git a/volk/include/volk/volk_32f_s32f_convert_8i_u.h b/volk/include/volk/volk_32f_s32f_convert_8i_u.h
new file mode 100644
index 000000000..870e9419b
--- /dev/null
+++ b/volk/include/volk/volk_32f_s32f_convert_8i_u.h
@@ -0,0 +1,157 @@
+#ifndef INCLUDED_volk_32f_s32f_convert_8i_u_H
+#define INCLUDED_volk_32f_s32f_convert_8i_u_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE2
+#include <emmintrin.h>
+ /*!
+ \brief Multiplies each point in the input buffer by the scalar value, then converts the result into a 8 bit integer value
+ \param inputVector The floating point input data buffer
+ \param outputVector The 8 bit output data buffer
+ \param scalar The value multiplied against each point in the input buffer
+ \param num_points The number of data values to be converted
+ \note Input buffer does NOT need to be properly aligned
+ */
+static inline void volk_32f_s32f_convert_8i_u_sse2(int8_t* outputVector, const float* inputVector, const float scalar, unsigned int num_points){
+ unsigned int number = 0;
+
+ const unsigned int sixteenthPoints = num_points / 16;
+
+ const float* inputVectorPtr = (const float*)inputVector;
+ int8_t* outputVectorPtr = outputVector;
+
+ float min_val = -128;
+ float max_val = 127;
+ float r;
+
+ __m128 vScalar = _mm_set_ps1(scalar);
+ __m128 inputVal1, inputVal2, inputVal3, inputVal4;
+ __m128i intInputVal1, intInputVal2, intInputVal3, intInputVal4;
+ __m128 vmin_val = _mm_set_ps1(min_val);
+ __m128 vmax_val = _mm_set_ps1(max_val);
+
+ for(;number < sixteenthPoints; number++){
+ inputVal1 = _mm_loadu_ps(inputVectorPtr); inputVectorPtr += 4;
+ inputVal2 = _mm_loadu_ps(inputVectorPtr); inputVectorPtr += 4;
+ inputVal3 = _mm_loadu_ps(inputVectorPtr); inputVectorPtr += 4;
+ inputVal4 = _mm_loadu_ps(inputVectorPtr); inputVectorPtr += 4;
+
+ inputVal1 = _mm_max_ps(_mm_min_ps(_mm_mul_ps(inputVal1, vScalar), vmax_val), vmin_val);
+ inputVal2 = _mm_max_ps(_mm_min_ps(_mm_mul_ps(inputVal2, vScalar), vmax_val), vmin_val);
+ inputVal3 = _mm_max_ps(_mm_min_ps(_mm_mul_ps(inputVal3, vScalar), vmax_val), vmin_val);
+ inputVal4 = _mm_max_ps(_mm_min_ps(_mm_mul_ps(inputVal4, vScalar), vmax_val), vmin_val);
+
+ intInputVal1 = _mm_cvtps_epi32(inputVal1);
+ intInputVal2 = _mm_cvtps_epi32(inputVal2);
+ intInputVal3 = _mm_cvtps_epi32(inputVal3);
+ intInputVal4 = _mm_cvtps_epi32(inputVal4);
+
+ intInputVal1 = _mm_packs_epi32(intInputVal1, intInputVal2);
+ intInputVal3 = _mm_packs_epi32(intInputVal3, intInputVal4);
+
+ intInputVal1 = _mm_packs_epi16(intInputVal1, intInputVal3);
+
+ _mm_storeu_si128((__m128i*)outputVectorPtr, intInputVal1);
+ outputVectorPtr += 16;
+ }
+
+ number = sixteenthPoints * 16;
+ for(; number < num_points; number++){
+ r = inputVector[number] * scalar;
+ if(r > max_val)
+ r = max_val;
+ else if(r < min_val)
+ r = min_val;
+ outputVector[number] = (int16_t)(r);
+ }
+}
+#endif /* LV_HAVE_SSE2 */
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+ /*!
+ \brief Multiplies each point in the input buffer by the scalar value, then converts the result into a 8 bit integer value
+ \param inputVector The floating point input data buffer
+ \param outputVector The 8 bit output data buffer
+ \param scalar The value multiplied against each point in the input buffer
+ \param num_points The number of data values to be converted
+ \note Input buffer does NOT need to be properly aligned
+ */
+static inline void volk_32f_s32f_convert_8i_u_sse(int8_t* outputVector, const float* inputVector, const float scalar, unsigned int num_points){
+ unsigned int number = 0;
+
+ const unsigned int quarterPoints = num_points / 4;
+
+ const float* inputVectorPtr = (const float*)inputVector;
+ int8_t* outputVectorPtr = outputVector;
+
+ float min_val = -128;
+ float max_val = 127;
+ float r;
+
+ __m128 vScalar = _mm_set_ps1(scalar);
+ __m128 ret;
+ __m128 vmin_val = _mm_set_ps1(min_val);
+ __m128 vmax_val = _mm_set_ps1(max_val);
+
+ __VOLK_ATTR_ALIGNED(16) float outputFloatBuffer[4];
+
+ for(;number < quarterPoints; number++){
+ ret = _mm_loadu_ps(inputVectorPtr);
+ inputVectorPtr += 4;
+
+ ret = _mm_max_ps(_mm_min_ps(_mm_mul_ps(ret, vScalar), vmax_val), vmin_val);
+
+ _mm_store_ps(outputFloatBuffer, ret);
+ *outputVectorPtr++ = (int8_t)(outputFloatBuffer[0]);
+ *outputVectorPtr++ = (int8_t)(outputFloatBuffer[1]);
+ *outputVectorPtr++ = (int8_t)(outputFloatBuffer[2]);
+ *outputVectorPtr++ = (int8_t)(outputFloatBuffer[3]);
+ }
+
+ number = quarterPoints * 4;
+ for(; number < num_points; number++){
+ r = inputVector[number] * scalar;
+ if(r > max_val)
+ r = max_val;
+ else if(r < min_val)
+ r = min_val;
+ outputVector[number] = (int16_t)(r);
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+ /*!
+ \brief Multiplies each point in the input buffer by the scalar value, then converts the result into a 8 bit integer value
+ \param inputVector The floating point input data buffer
+ \param outputVector The 8 bit output data buffer
+ \param scalar The value multiplied against each point in the input buffer
+ \param num_points The number of data values to be converted
+ \note Input buffer does NOT need to be properly aligned
+ */
+static inline void volk_32f_s32f_convert_8i_u_generic(int8_t* outputVector, const float* inputVector, const float scalar, unsigned int num_points){
+ int8_t* outputVectorPtr = outputVector;
+ const float* inputVectorPtr = inputVector;
+ unsigned int number = 0;
+ float min_val = -128;
+ float max_val = 127;
+ float r;
+
+ for(number = 0; number < num_points; number++){
+ r = *inputVectorPtr++ * scalar;
+ if(r > max_val)
+ r = max_val;
+ else if(r < min_val)
+ r = min_val;
+ *outputVectorPtr++ = (int16_t)(r);
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_32f_s32f_convert_8i_u_H */
diff --git a/volk/include/volk/volk_32f_s32f_multiply_32f_a.h b/volk/include/volk/volk_32f_s32f_multiply_32f_a.h
new file mode 100644
index 000000000..99b8e68c5
--- /dev/null
+++ b/volk/include/volk/volk_32f_s32f_multiply_32f_a.h
@@ -0,0 +1,119 @@
+#ifndef INCLUDED_volk_32f_s32f_multiply_32f_a_H
+#define INCLUDED_volk_32f_s32f_multiply_32f_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+/*!
+ \brief Scalar float multiply
+ \param cVector The vector where the results will be stored
+ \param aVector One of the vectors to be multiplied
+ \param scalar the scalar value
+ \param num_points The number of values in aVector and bVector to be multiplied together and stored into cVector
+*/
+static inline void volk_32f_s32f_multiply_32f_a_sse(float* cVector, const float* aVector, const float scalar, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+
+ float* cPtr = cVector;
+ const float* aPtr = aVector;
+
+ __m128 aVal, bVal, cVal;
+ bVal = _mm_set_ps1(scalar);
+ for(;number < quarterPoints; number++){
+
+ aVal = _mm_load_ps(aPtr);
+
+ cVal = _mm_mul_ps(aVal, bVal);
+
+ _mm_store_ps(cPtr,cVal); // Store the results back into the C container
+
+ aPtr += 4;
+ cPtr += 4;
+ }
+
+ number = quarterPoints * 4;
+ for(;number < num_points; number++){
+ *cPtr++ = (*aPtr++) * scalar;
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_AVX
+#include <immintrin.h>
+/*!
+ \brief Scalar float multiply
+ \param cVector The vector where the results will be stored
+ \param aVector One of the vectors to be multiplied
+ \param scalar the scalar value
+ \param num_points The number of values in aVector and bVector to be multiplied together and stored into cVector
+*/
+static inline void volk_32f_s32f_multiply_32f_a_avx(float* cVector, const float* aVector, const float scalar, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int eighthPoints = num_points / 8;
+
+ float* cPtr = cVector;
+ const float* aPtr = aVector;
+
+ __m256 aVal, bVal, cVal;
+ bVal = _mm256_set1_ps(scalar);
+ for(;number < eighthPoints; number++){
+
+ aVal = _mm256_load_ps(aPtr);
+
+ cVal = _mm256_mul_ps(aVal, bVal);
+
+ _mm256_store_ps(cPtr,cVal); // Store the results back into the C container
+
+ aPtr += 8;
+ cPtr += 8;
+ }
+
+ number = eighthPoints * 8;
+ for(;number < num_points; number++){
+ *cPtr++ = (*aPtr++) * scalar;
+ }
+}
+#endif /* LV_HAVE_AVX */
+
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Scalar float multiply
+ \param cVector The vector where the results will be stored
+ \param aVector One of the vectors to be multiplied
+ \param scalar the scalar value
+ \param num_points The number of values in aVector and bVector to be multiplied together and stored into cVector
+*/
+static inline void volk_32f_s32f_multiply_32f_a_generic(float* cVector, const float* aVector, const float scalar, unsigned int num_points){
+ unsigned int number = 0;
+ const float* inputPtr = aVector;
+ float* outputPtr = cVector;
+ for(number = 0; number < num_points; number++){
+ *outputPtr = (*inputPtr) * scalar;
+ inputPtr++;
+ outputPtr++;
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+#ifdef LV_HAVE_ORC
+/*!
+ \brief Scalar float multiply
+ \param cVector The vector where the results will be stored
+ \param aVector One of the vectors to be multiplied
+ \param scalar the scalar value
+ \param num_points The number of values in aVector and bVector to be multiplied together and stored into cVector
+*/
+extern void volk_32f_s32f_multiply_32f_a_orc_impl(float* dst, const float* src, const float scalar, unsigned int num_points);
+static inline void volk_32f_s32f_multiply_32f_a_orc(float* cVector, const float* aVector, const float scalar, unsigned int num_points){
+ volk_32f_s32f_multiply_32f_a_orc_impl(cVector, aVector, scalar, num_points);
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_32f_s32f_multiply_32f_a_H */
diff --git a/volk/include/volk/volk_32f_s32f_multiply_32f_u.h b/volk/include/volk/volk_32f_s32f_multiply_32f_u.h
new file mode 100644
index 000000000..b3fae9b05
--- /dev/null
+++ b/volk/include/volk/volk_32f_s32f_multiply_32f_u.h
@@ -0,0 +1,102 @@
+#ifndef INCLUDED_volk_32f_s32f_multiply_32f_u_H
+#define INCLUDED_volk_32f_s32f_multiply_32f_u_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+/*!
+ \brief Scalar float multiply
+ \param cVector The vector where the results will be stored
+ \param aVector One of the vectors to be multiplied
+ \param scalar the scalar value
+ \param num_points The number of values in aVector and bVector to be multiplied together and stored into cVector
+*/
+static inline void volk_32f_s32f_multiply_32f_u_sse(float* cVector, const float* aVector, const float scalar, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+
+ float* cPtr = cVector;
+ const float* aPtr = aVector;
+
+ __m128 aVal, bVal, cVal;
+ bVal = _mm_set_ps1(scalar);
+ for(;number < quarterPoints; number++){
+
+ aVal = _mm_loadu_ps(aPtr);
+
+ cVal = _mm_mul_ps(aVal, bVal);
+
+ _mm_storeu_ps(cPtr,cVal); // Store the results back into the C container
+
+ aPtr += 4;
+ cPtr += 4;
+ }
+
+ number = quarterPoints * 4;
+ for(;number < num_points; number++){
+ *cPtr++ = (*aPtr++) * scalar;
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_AVX
+#include <immintrin.h>
+/*!
+ \brief Scalar float multiply
+ \param cVector The vector where the results will be stored
+ \param aVector One of the vectors to be multiplied
+ \param scalar the scalar value
+ \param num_points The number of values in aVector and bVector to be multiplied together and stored into cVector
+*/
+static inline void volk_32f_s32f_multiply_32f_u_avx(float* cVector, const float* aVector, const float scalar, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int eighthPoints = num_points / 8;
+
+ float* cPtr = cVector;
+ const float* aPtr = aVector;
+
+ __m256 aVal, bVal, cVal;
+ bVal = _mm256_set1_ps(scalar);
+ for(;number < eighthPoints; number++){
+
+ aVal = _mm256_loadu_ps(aPtr);
+
+ cVal = _mm256_mul_ps(aVal, bVal);
+
+ _mm256_storeu_ps(cPtr,cVal); // Store the results back into the C container
+
+ aPtr += 8;
+ cPtr += 8;
+ }
+
+ number = eighthPoints * 8;
+ for(;number < num_points; number++){
+ *cPtr++ = (*aPtr++) * scalar;
+ }
+}
+#endif /* LV_HAVE_AVX */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Scalar float multiply
+ \param cVector The vector where the results will be stored
+ \param aVector One of the vectors to be multiplied
+ \param scalar the scalar value
+ \param num_points The number of values in aVector and bVector to be multiplied together and stored into cVector
+*/
+static inline void volk_32f_s32f_multiply_32f_u_generic(float* cVector, const float* aVector, const float scalar, unsigned int num_points){
+ unsigned int number = 0;
+ const float* inputPtr = aVector;
+ float* outputPtr = cVector;
+ for(number = 0; number < num_points; number++){
+ *outputPtr = (*inputPtr) * scalar;
+ inputPtr++;
+ outputPtr++;
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+#endif /* INCLUDED_volk_32f_s32f_multiply_32f_u_H */
diff --git a/volk/include/volk/volk_32f_s32f_normalize_a.h b/volk/include/volk/volk_32f_s32f_normalize_a.h
new file mode 100644
index 000000000..f5fd0d1db
--- /dev/null
+++ b/volk/include/volk/volk_32f_s32f_normalize_a.h
@@ -0,0 +1,81 @@
+#ifndef INCLUDED_volk_32f_s32f_normalize_a_H
+#define INCLUDED_volk_32f_s32f_normalize_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+/*!
+ \brief Normalizes all points in the buffer by the scalar value ( divides each data point by the scalar value )
+ \param vecBuffer The buffer of values to be vectorized
+ \param num_points The number of values in vecBuffer
+ \param scalar The scale value to be applied to each buffer value
+*/
+static inline void volk_32f_s32f_normalize_a_sse(float* vecBuffer, const float scalar, unsigned int num_points){
+ unsigned int number = 0;
+ float* inputPtr = vecBuffer;
+
+ const float invScalar = 1.0 / scalar;
+ __m128 vecScalar = _mm_set_ps1(invScalar);
+
+ __m128 input1;
+
+ const uint64_t quarterPoints = num_points / 4;
+ for(;number < quarterPoints; number++){
+
+ input1 = _mm_load_ps(inputPtr);
+
+ input1 = _mm_mul_ps(input1, vecScalar);
+
+ _mm_store_ps(inputPtr, input1);
+
+ inputPtr += 4;
+ }
+
+ number = quarterPoints*4;
+ for(; number < num_points; number++){
+ *inputPtr *= invScalar;
+ inputPtr++;
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Normalizes the two input vectors and store their results in the third vector
+ \param cVector The vector where the results will be stored
+ \param aVector One of the vectors to be normalizeed
+ \param bVector One of the vectors to be normalizeed
+ \param num_points The number of values in aVector and bVector to be normalizeed together and stored into cVector
+*/
+static inline void volk_32f_s32f_normalize_a_generic(float* vecBuffer, const float scalar, unsigned int num_points){
+ unsigned int number = 0;
+ float* inputPtr = vecBuffer;
+ const float invScalar = 1.0 / scalar;
+ for(number = 0; number < num_points; number++){
+ *inputPtr *= invScalar;
+ inputPtr++;
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+#ifdef LV_HAVE_ORC
+/*!
+ \brief Normalizes the two input vectors and store their results in the third vector
+ \param cVector The vector where the results will be stored
+ \param aVector One of the vectors to be normalizeed
+ \param bVector One of the vectors to be normalizeed
+ \param num_points The number of values in aVector and bVector to be normalizeed together and stored into cVector
+*/
+extern void volk_32f_s32f_normalize_a_orc_impl(float* dst, float* src, const float scalar, unsigned int num_points);
+static inline void volk_32f_s32f_normalize_a_orc(float* vecBuffer, const float scalar, unsigned int num_points){
+ float invscalar = 1.0 / scalar;
+ volk_32f_s32f_normalize_a_orc_impl(vecBuffer, vecBuffer, invscalar, num_points);
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_32f_s32f_normalize_a_H */
diff --git a/volk/include/volk/volk_32f_s32f_power_32f_a.h b/volk/include/volk/volk_32f_s32f_power_32f_a.h
new file mode 100644
index 000000000..633ad14b0
--- /dev/null
+++ b/volk/include/volk/volk_32f_s32f_power_32f_a.h
@@ -0,0 +1,144 @@
+#ifndef INCLUDED_volk_32f_s32f_power_32f_a_H
+#define INCLUDED_volk_32f_s32f_power_32f_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+#include <math.h>
+
+#ifdef LV_HAVE_SSE4_1
+#include <tmmintrin.h>
+
+#ifdef LV_HAVE_LIB_SIMDMATH
+#include <simdmath.h>
+#endif /* LV_HAVE_LIB_SIMDMATH */
+
+/*!
+ \brief Takes each the input vector value to the specified power and stores the results in the return vector
+ \param cVector The vector where the results will be stored
+ \param aVector The vector of values to be taken to a power
+ \param power The power value to be applied to each data point
+ \param num_points The number of values in aVector to be taken to the specified power level and stored into cVector
+*/
+static inline void volk_32f_s32f_power_32f_a_sse4_1(float* cVector, const float* aVector, const float power, unsigned int num_points){
+ unsigned int number = 0;
+
+ float* cPtr = cVector;
+ const float* aPtr = aVector;
+
+#ifdef LV_HAVE_LIB_SIMDMATH
+ const unsigned int quarterPoints = num_points / 4;
+ __m128 vPower = _mm_set_ps1(power);
+ __m128 zeroValue = _mm_setzero_ps();
+ __m128 signMask;
+ __m128 negatedValues;
+ __m128 negativeOneToPower = _mm_set_ps1(powf(-1, power));
+ __m128 onesMask = _mm_set_ps1(1);
+
+ __m128 aVal, cVal;
+ for(;number < quarterPoints; number++){
+
+ aVal = _mm_load_ps(aPtr);
+ signMask = _mm_cmplt_ps(aVal, zeroValue);
+ negatedValues = _mm_sub_ps(zeroValue, aVal);
+ aVal = _mm_blendv_ps(aVal, negatedValues, signMask);
+
+ // powf4 doesn't support negative values in the base, so we mask them off and then apply the negative after
+ cVal = powf4(aVal, vPower); // Takes each input value to the specified power
+
+ cVal = _mm_mul_ps( _mm_blendv_ps(onesMask, negativeOneToPower, signMask), cVal);
+
+ _mm_store_ps(cPtr,cVal); // Store the results back into the C container
+
+ aPtr += 4;
+ cPtr += 4;
+ }
+
+ number = quarterPoints * 4;
+#endif /* LV_HAVE_LIB_SIMDMATH */
+
+ for(;number < num_points; number++){
+ *cPtr++ = powf((*aPtr++), power);
+ }
+}
+#endif /* LV_HAVE_SSE4_1 */
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+
+#ifdef LV_HAVE_LIB_SIMDMATH
+#include <simdmath.h>
+#endif /* LV_HAVE_LIB_SIMDMATH */
+
+/*!
+ \brief Takes each the input vector value to the specified power and stores the results in the return vector
+ \param cVector The vector where the results will be stored
+ \param aVector The vector of values to be taken to a power
+ \param power The power value to be applied to each data point
+ \param num_points The number of values in aVector to be taken to the specified power level and stored into cVector
+*/
+static inline void volk_32f_s32f_power_32f_a_sse(float* cVector, const float* aVector, const float power, unsigned int num_points){
+ unsigned int number = 0;
+
+ float* cPtr = cVector;
+ const float* aPtr = aVector;
+
+#ifdef LV_HAVE_LIB_SIMDMATH
+ const unsigned int quarterPoints = num_points / 4;
+ __m128 vPower = _mm_set_ps1(power);
+ __m128 zeroValue = _mm_setzero_ps();
+ __m128 signMask;
+ __m128 negatedValues;
+ __m128 negativeOneToPower = _mm_set_ps1(powf(-1, power));
+ __m128 onesMask = _mm_set_ps1(1);
+
+ __m128 aVal, cVal;
+ for(;number < quarterPoints; number++){
+
+ aVal = _mm_load_ps(aPtr);
+ signMask = _mm_cmplt_ps(aVal, zeroValue);
+ negatedValues = _mm_sub_ps(zeroValue, aVal);
+ aVal = _mm_or_ps(_mm_andnot_ps(signMask, aVal), _mm_and_ps(signMask, negatedValues) );
+
+ // powf4 doesn't support negative values in the base, so we mask them off and then apply the negative after
+ cVal = powf4(aVal, vPower); // Takes each input value to the specified power
+
+ cVal = _mm_mul_ps( _mm_or_ps( _mm_andnot_ps(signMask, onesMask), _mm_and_ps(signMask, negativeOneToPower) ), cVal);
+
+ _mm_store_ps(cPtr,cVal); // Store the results back into the C container
+
+ aPtr += 4;
+ cPtr += 4;
+ }
+
+ number = quarterPoints * 4;
+#endif /* LV_HAVE_LIB_SIMDMATH */
+
+ for(;number < num_points; number++){
+ *cPtr++ = powf((*aPtr++), power);
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+ /*!
+ \brief Takes each the input vector value to the specified power and stores the results in the return vector
+ \param cVector The vector where the results will be stored
+ \param aVector The vector of values to be taken to a power
+ \param power The power value to be applied to each data point
+ \param num_points The number of values in aVector to be taken to the specified power level and stored into cVector
+ */
+static inline void volk_32f_s32f_power_32f_a_generic(float* cVector, const float* aVector, const float power, unsigned int num_points){
+ float* cPtr = cVector;
+ const float* aPtr = aVector;
+ unsigned int number = 0;
+
+ for(number = 0; number < num_points; number++){
+ *cPtr++ = powf((*aPtr++), power);
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_32f_s32f_power_32f_a_H */
diff --git a/volk/include/volk/volk_32f_s32f_stddev_32f_a.h b/volk/include/volk/volk_32f_s32f_stddev_32f_a.h
new file mode 100644
index 000000000..98401b2d4
--- /dev/null
+++ b/volk/include/volk/volk_32f_s32f_stddev_32f_a.h
@@ -0,0 +1,145 @@
+#ifndef INCLUDED_volk_32f_s32f_stddev_32f_a_H
+#define INCLUDED_volk_32f_s32f_stddev_32f_a_H
+
+#include <volk/volk_common.h>
+#include <inttypes.h>
+#include <stdio.h>
+#include <math.h>
+
+#ifdef LV_HAVE_SSE4_1
+#include <smmintrin.h>
+/*!
+ \brief Calculates the standard deviation of the input buffer using the supplied mean
+ \param stddev The calculated standard deviation
+ \param inputBuffer The buffer of points to calculate the std deviation for
+ \param mean The mean of the input buffer
+ \param num_points The number of values in input buffer to used in the stddev calculation
+*/
+static inline void volk_32f_s32f_stddev_32f_a_sse4_1(float* stddev, const float* inputBuffer, const float mean, unsigned int num_points){
+ float returnValue = 0;
+ if(num_points > 0){
+ unsigned int number = 0;
+ const unsigned int sixteenthPoints = num_points / 16;
+
+ const float* aPtr = inputBuffer;
+
+ __VOLK_ATTR_ALIGNED(16) float squareBuffer[4];
+
+ __m128 squareAccumulator = _mm_setzero_ps();
+ __m128 aVal1, aVal2, aVal3, aVal4;
+ __m128 cVal1, cVal2, cVal3, cVal4;
+ for(;number < sixteenthPoints; number++) {
+ aVal1 = _mm_load_ps(aPtr); aPtr += 4;
+ cVal1 = _mm_dp_ps(aVal1, aVal1, 0xF1);
+
+ aVal2 = _mm_load_ps(aPtr); aPtr += 4;
+ cVal2 = _mm_dp_ps(aVal2, aVal2, 0xF2);
+
+ aVal3 = _mm_load_ps(aPtr); aPtr += 4;
+ cVal3 = _mm_dp_ps(aVal3, aVal3, 0xF4);
+
+ aVal4 = _mm_load_ps(aPtr); aPtr += 4;
+ cVal4 = _mm_dp_ps(aVal4, aVal4, 0xF8);
+
+ cVal1 = _mm_or_ps(cVal1, cVal2);
+ cVal3 = _mm_or_ps(cVal3, cVal4);
+ cVal1 = _mm_or_ps(cVal1, cVal3);
+
+ squareAccumulator = _mm_add_ps(squareAccumulator, cVal1); // squareAccumulator += x^2
+ }
+ _mm_store_ps(squareBuffer,squareAccumulator); // Store the results back into the C container
+ returnValue = squareBuffer[0];
+ returnValue += squareBuffer[1];
+ returnValue += squareBuffer[2];
+ returnValue += squareBuffer[3];
+
+ number = sixteenthPoints * 16;
+ for(;number < num_points; number++){
+ returnValue += (*aPtr) * (*aPtr);
+ aPtr++;
+ }
+ returnValue /= num_points;
+ returnValue -= (mean * mean);
+ returnValue = sqrtf(returnValue);
+ }
+ *stddev = returnValue;
+}
+#endif /* LV_HAVE_SSE4_1 */
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+/*!
+ \brief Calculates the standard deviation of the input buffer using the supplied mean
+ \param stddev The calculated standard deviation
+ \param inputBuffer The buffer of points to calculate the std deviation for
+ \param mean The mean of the input buffer
+ \param num_points The number of values in input buffer to used in the stddev calculation
+*/
+static inline void volk_32f_s32f_stddev_32f_a_sse(float* stddev, const float* inputBuffer, const float mean, unsigned int num_points){
+ float returnValue = 0;
+ if(num_points > 0){
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+
+ const float* aPtr = inputBuffer;
+
+ __VOLK_ATTR_ALIGNED(16) float squareBuffer[4];
+
+ __m128 squareAccumulator = _mm_setzero_ps();
+ __m128 aVal = _mm_setzero_ps();
+ for(;number < quarterPoints; number++) {
+ aVal = _mm_load_ps(aPtr); // aVal = x
+ aVal = _mm_mul_ps(aVal, aVal); // squareAccumulator += x^2
+ squareAccumulator = _mm_add_ps(squareAccumulator, aVal);
+ aPtr += 4;
+ }
+ _mm_store_ps(squareBuffer,squareAccumulator); // Store the results back into the C container
+ returnValue = squareBuffer[0];
+ returnValue += squareBuffer[1];
+ returnValue += squareBuffer[2];
+ returnValue += squareBuffer[3];
+
+ number = quarterPoints * 4;
+ for(;number < num_points; number++){
+ returnValue += (*aPtr) * (*aPtr);
+ aPtr++;
+ }
+ returnValue /= num_points;
+ returnValue -= (mean * mean);
+ returnValue = sqrtf(returnValue);
+ }
+ *stddev = returnValue;
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Calculates the standard deviation of the input buffer using the supplied mean
+ \param stddev The calculated standard deviation
+ \param inputBuffer The buffer of points to calculate the std deviation for
+ \param mean The mean of the input buffer
+ \param num_points The number of values in input buffer to used in the stddev calculation
+*/
+static inline void volk_32f_s32f_stddev_32f_a_generic(float* stddev, const float* inputBuffer, const float mean, unsigned int num_points){
+ float returnValue = 0;
+ if(num_points > 0){
+ const float* aPtr = inputBuffer;
+ unsigned int number = 0;
+
+ for(number = 0; number < num_points; number++){
+ returnValue += (*aPtr) * (*aPtr);
+ aPtr++;
+ }
+
+ returnValue /= num_points;
+ returnValue -= (mean * mean);
+ returnValue = sqrtf(returnValue);
+ }
+ *stddev = returnValue;
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_32f_s32f_stddev_32f_a_H */
diff --git a/volk/include/volk/volk_32f_sqrt_32f_a.h b/volk/include/volk/volk_32f_sqrt_32f_a.h
new file mode 100644
index 000000000..d9b16fc0f
--- /dev/null
+++ b/volk/include/volk/volk_32f_sqrt_32f_a.h
@@ -0,0 +1,77 @@
+#ifndef INCLUDED_volk_32f_sqrt_32f_a_H
+#define INCLUDED_volk_32f_sqrt_32f_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+#include <math.h>
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+/*!
+ \brief Sqrts the two input vectors and store their results in the third vector
+ \param cVector The vector where the results will be stored
+ \param aVector One of the vectors to be sqrted
+ \param num_points The number of values in aVector and bVector to be sqrted together and stored into cVector
+*/
+static inline void volk_32f_sqrt_32f_a_sse(float* cVector, const float* aVector, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+
+ float* cPtr = cVector;
+ const float* aPtr = aVector;
+
+ __m128 aVal, cVal;
+ for(;number < quarterPoints; number++){
+
+ aVal = _mm_load_ps(aPtr);
+
+ cVal = _mm_sqrt_ps(aVal);
+
+ _mm_store_ps(cPtr,cVal); // Store the results back into the C container
+
+ aPtr += 4;
+ cPtr += 4;
+ }
+
+ number = quarterPoints * 4;
+ for(;number < num_points; number++){
+ *cPtr++ = sqrtf(*aPtr++);
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Sqrts the two input vectors and store their results in the third vector
+ \param cVector The vector where the results will be stored
+ \param aVector One of the vectors to be sqrted
+ \param num_points The number of values in aVector and bVector to be sqrted together and stored into cVector
+*/
+static inline void volk_32f_sqrt_32f_a_generic(float* cVector, const float* aVector, unsigned int num_points){
+ float* cPtr = cVector;
+ const float* aPtr = aVector;
+ unsigned int number = 0;
+
+ for(number = 0; number < num_points; number++){
+ *cPtr++ = sqrtf(*aPtr++);
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+#ifdef LV_HAVE_ORC
+extern void volk_32f_sqrt_32f_a_orc_impl(float *, const float*, unsigned int);
+/*!
+ \brief Sqrts the two input vectors and store their results in the third vector
+ \param cVector The vector where the results will be stored
+ \param aVector One of the vectors to be sqrted
+ \param num_points The number of values in aVector and bVector to be sqrted together and stored into cVector
+*/
+static inline void volk_32f_sqrt_32f_a_orc(float* cVector, const float* aVector, unsigned int num_points){
+ volk_32f_sqrt_32f_a_orc_impl(cVector, aVector, num_points);
+}
+
+#endif /* LV_HAVE_ORC */
+
+
+
+#endif /* INCLUDED_volk_32f_sqrt_32f_a_H */
diff --git a/volk/include/volk/volk_32f_stddev_and_mean_32f_x2_a.h b/volk/include/volk/volk_32f_stddev_and_mean_32f_x2_a.h
new file mode 100644
index 000000000..7de32f7b1
--- /dev/null
+++ b/volk/include/volk/volk_32f_stddev_and_mean_32f_x2_a.h
@@ -0,0 +1,170 @@
+#ifndef INCLUDED_volk_32f_stddev_and_mean_32f_x2_a_H
+#define INCLUDED_volk_32f_stddev_and_mean_32f_x2_a_H
+
+#include <volk/volk_common.h>
+#include <inttypes.h>
+#include <stdio.h>
+#include <math.h>
+
+#ifdef LV_HAVE_SSE4_1
+#include <smmintrin.h>
+/*!
+ \brief Calculates the standard deviation and mean of the input buffer
+ \param stddev The calculated standard deviation
+ \param mean The mean of the input buffer
+ \param inputBuffer The buffer of points to calculate the std deviation for
+ \param num_points The number of values in input buffer to used in the stddev and mean calculations
+*/
+static inline void volk_32f_stddev_and_mean_32f_x2_a_sse4_1(float* stddev, float* mean, const float* inputBuffer, unsigned int num_points){
+ float returnValue = 0;
+ float newMean = 0;
+ if(num_points > 0){
+ unsigned int number = 0;
+ const unsigned int sixteenthPoints = num_points / 16;
+
+ const float* aPtr = inputBuffer;
+ __VOLK_ATTR_ALIGNED(16) float meanBuffer[4];
+ __VOLK_ATTR_ALIGNED(16) float squareBuffer[4];
+
+ __m128 accumulator = _mm_setzero_ps();
+ __m128 squareAccumulator = _mm_setzero_ps();
+ __m128 aVal1, aVal2, aVal3, aVal4;
+ __m128 cVal1, cVal2, cVal3, cVal4;
+ for(;number < sixteenthPoints; number++) {
+ aVal1 = _mm_load_ps(aPtr); aPtr += 4;
+ cVal1 = _mm_dp_ps(aVal1, aVal1, 0xF1);
+ accumulator = _mm_add_ps(accumulator, aVal1); // accumulator += x
+
+ aVal2 = _mm_load_ps(aPtr); aPtr += 4;
+ cVal2 = _mm_dp_ps(aVal2, aVal2, 0xF2);
+ accumulator = _mm_add_ps(accumulator, aVal2); // accumulator += x
+
+ aVal3 = _mm_load_ps(aPtr); aPtr += 4;
+ cVal3 = _mm_dp_ps(aVal3, aVal3, 0xF4);
+ accumulator = _mm_add_ps(accumulator, aVal3); // accumulator += x
+
+ aVal4 = _mm_load_ps(aPtr); aPtr += 4;
+ cVal4 = _mm_dp_ps(aVal4, aVal4, 0xF8);
+ accumulator = _mm_add_ps(accumulator, aVal4); // accumulator += x
+
+ cVal1 = _mm_or_ps(cVal1, cVal2);
+ cVal3 = _mm_or_ps(cVal3, cVal4);
+ cVal1 = _mm_or_ps(cVal1, cVal3);
+
+ squareAccumulator = _mm_add_ps(squareAccumulator, cVal1); // squareAccumulator += x^2
+ }
+ _mm_store_ps(meanBuffer,accumulator); // Store the results back into the C container
+ _mm_store_ps(squareBuffer,squareAccumulator); // Store the results back into the C container
+ newMean = meanBuffer[0];
+ newMean += meanBuffer[1];
+ newMean += meanBuffer[2];
+ newMean += meanBuffer[3];
+ returnValue = squareBuffer[0];
+ returnValue += squareBuffer[1];
+ returnValue += squareBuffer[2];
+ returnValue += squareBuffer[3];
+
+ number = sixteenthPoints * 16;
+ for(;number < num_points; number++){
+ returnValue += (*aPtr) * (*aPtr);
+ newMean += *aPtr++;
+ }
+ newMean /= num_points;
+ returnValue /= num_points;
+ returnValue -= (newMean * newMean);
+ returnValue = sqrtf(returnValue);
+ }
+ *stddev = returnValue;
+ *mean = newMean;
+}
+#endif /* LV_HAVE_SSE4_1 */
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+/*!
+ \brief Calculates the standard deviation and mean of the input buffer
+ \param stddev The calculated standard deviation
+ \param mean The mean of the input buffer
+ \param inputBuffer The buffer of points to calculate the std deviation for
+ \param num_points The number of values in input buffer to used in the stddev and mean calculations
+*/
+static inline void volk_32f_stddev_and_mean_32f_x2_a_sse(float* stddev, float* mean, const float* inputBuffer, unsigned int num_points){
+ float returnValue = 0;
+ float newMean = 0;
+ if(num_points > 0){
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+
+ const float* aPtr = inputBuffer;
+ __VOLK_ATTR_ALIGNED(16) float meanBuffer[4];
+ __VOLK_ATTR_ALIGNED(16) float squareBuffer[4];
+
+ __m128 accumulator = _mm_setzero_ps();
+ __m128 squareAccumulator = _mm_setzero_ps();
+ __m128 aVal = _mm_setzero_ps();
+ for(;number < quarterPoints; number++) {
+ aVal = _mm_load_ps(aPtr); // aVal = x
+ accumulator = _mm_add_ps(accumulator, aVal); // accumulator += x
+ aVal = _mm_mul_ps(aVal, aVal); // squareAccumulator += x^2
+ squareAccumulator = _mm_add_ps(squareAccumulator, aVal);
+ aPtr += 4;
+ }
+ _mm_store_ps(meanBuffer,accumulator); // Store the results back into the C container
+ _mm_store_ps(squareBuffer,squareAccumulator); // Store the results back into the C container
+ newMean = meanBuffer[0];
+ newMean += meanBuffer[1];
+ newMean += meanBuffer[2];
+ newMean += meanBuffer[3];
+ returnValue = squareBuffer[0];
+ returnValue += squareBuffer[1];
+ returnValue += squareBuffer[2];
+ returnValue += squareBuffer[3];
+
+ number = quarterPoints * 4;
+ for(;number < num_points; number++){
+ returnValue += (*aPtr) * (*aPtr);
+ newMean += *aPtr++;
+ }
+ newMean /= num_points;
+ returnValue /= num_points;
+ returnValue -= (newMean * newMean);
+ returnValue = sqrtf(returnValue);
+ }
+ *stddev = returnValue;
+ *mean = newMean;
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Calculates the standard deviation and mean of the input buffer
+ \param stddev The calculated standard deviation
+ \param mean The mean of the input buffer
+ \param inputBuffer The buffer of points to calculate the std deviation for
+ \param num_points The number of values in input buffer to used in the stddev and mean calculations
+*/
+static inline void volk_32f_stddev_and_mean_32f_x2_a_generic(float* stddev, float* mean, const float* inputBuffer, unsigned int num_points){
+ float returnValue = 0;
+ float newMean = 0;
+ if(num_points > 0){
+ const float* aPtr = inputBuffer;
+ unsigned int number = 0;
+
+ for(number = 0; number < num_points; number++){
+ returnValue += (*aPtr) * (*aPtr);
+ newMean += *aPtr++;
+ }
+ newMean /= num_points;
+ returnValue /= num_points;
+ returnValue -= (newMean * newMean);
+ returnValue = sqrtf(returnValue);
+ }
+ *stddev = returnValue;
+ *mean = newMean;
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_32f_stddev_and_mean_32f_x2_a_H */
diff --git a/volk/include/volk/volk_32f_x2_add_32f_a.h b/volk/include/volk/volk_32f_x2_add_32f_a.h
new file mode 100644
index 000000000..51e63e54d
--- /dev/null
+++ b/volk/include/volk/volk_32f_x2_add_32f_a.h
@@ -0,0 +1,81 @@
+#ifndef INCLUDED_volk_32f_x2_add_32f_a_H
+#define INCLUDED_volk_32f_x2_add_32f_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+/*!
+ \brief Adds the two input vectors and store their results in the third vector
+ \param cVector The vector where the results will be stored
+ \param aVector One of the vectors to be added
+ \param bVector One of the vectors to be added
+ \param num_points The number of values in aVector and bVector to be added together and stored into cVector
+*/
+static inline void volk_32f_x2_add_32f_a_sse(float* cVector, const float* aVector, const float* bVector, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+
+ float* cPtr = cVector;
+ const float* aPtr = aVector;
+ const float* bPtr= bVector;
+
+ __m128 aVal, bVal, cVal;
+ for(;number < quarterPoints; number++){
+
+ aVal = _mm_load_ps(aPtr);
+ bVal = _mm_load_ps(bPtr);
+
+ cVal = _mm_add_ps(aVal, bVal);
+
+ _mm_store_ps(cPtr,cVal); // Store the results back into the C container
+
+ aPtr += 4;
+ bPtr += 4;
+ cPtr += 4;
+ }
+
+ number = quarterPoints * 4;
+ for(;number < num_points; number++){
+ *cPtr++ = (*aPtr++) + (*bPtr++);
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Adds the two input vectors and store their results in the third vector
+ \param cVector The vector where the results will be stored
+ \param aVector One of the vectors to be added
+ \param bVector One of the vectors to be added
+ \param num_points The number of values in aVector and bVector to be added together and stored into cVector
+*/
+static inline void volk_32f_x2_add_32f_a_generic(float* cVector, const float* aVector, const float* bVector, unsigned int num_points){
+ float* cPtr = cVector;
+ const float* aPtr = aVector;
+ const float* bPtr= bVector;
+ unsigned int number = 0;
+
+ for(number = 0; number < num_points; number++){
+ *cPtr++ = (*aPtr++) + (*bPtr++);
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+#ifdef LV_HAVE_ORC
+/*!
+ \brief Adds the two input vectors and store their results in the third vector
+ \param cVector The vector where the results will be stored
+ \param aVector One of the vectors to be added
+ \param bVector One of the vectors to be added
+ \param num_points The number of values in aVector and bVector to be added together and stored into cVector
+*/
+extern void volk_32f_x2_add_32f_a_orc_impl(float* cVector, const float* aVector, const float* bVector, unsigned int num_points);
+static inline void volk_32f_x2_add_32f_a_orc(float* cVector, const float* aVector, const float* bVector, unsigned int num_points){
+ volk_32f_x2_add_32f_a_orc_impl(cVector, aVector, bVector, num_points);
+}
+#endif /* LV_HAVE_ORC */
+
+
+#endif /* INCLUDED_volk_32f_x2_add_32f_a_H */
diff --git a/volk/include/volk/volk_32f_x2_add_32f_u.h b/volk/include/volk/volk_32f_x2_add_32f_u.h
new file mode 100644
index 000000000..52e8286bc
--- /dev/null
+++ b/volk/include/volk/volk_32f_x2_add_32f_u.h
@@ -0,0 +1,66 @@
+#ifndef INCLUDED_volk_32f_x2_add_32f_u_H
+#define INCLUDED_volk_32f_x2_add_32f_u_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+/*!
+ \brief Adds the two input vectors and store their results in the third vector
+ \param cVector The vector where the results will be stored
+ \param aVector One of the vectors to be added
+ \param bVector One of the vectors to be added
+ \param num_points The number of values in aVector and bVector to be added together and stored into cVector
+*/
+static inline void volk_32f_x2_add_32f_u_sse(float* cVector, const float* aVector, const float* bVector, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+
+ float* cPtr = cVector;
+ const float* aPtr = aVector;
+ const float* bPtr= bVector;
+
+ __m128 aVal, bVal, cVal;
+ for(;number < quarterPoints; number++){
+
+ aVal = _mm_loadu_ps(aPtr);
+ bVal = _mm_loadu_ps(bPtr);
+
+ cVal = _mm_add_ps(aVal, bVal);
+
+ _mm_storeu_ps(cPtr,cVal); // Store the results back into the C container
+
+ aPtr += 4;
+ bPtr += 4;
+ cPtr += 4;
+ }
+
+ number = quarterPoints * 4;
+ for(;number < num_points; number++){
+ *cPtr++ = (*aPtr++) + (*bPtr++);
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Adds the two input vectors and store their results in the third vector
+ \param cVector The vector where the results will be stored
+ \param aVector One of the vectors to be added
+ \param bVector One of the vectors to be added
+ \param num_points The number of values in aVector and bVector to be added together and stored into cVector
+*/
+static inline void volk_32f_x2_add_32f_u_generic(float* cVector, const float* aVector, const float* bVector, unsigned int num_points){
+ float* cPtr = cVector;
+ const float* aPtr = aVector;
+ const float* bPtr= bVector;
+ unsigned int number = 0;
+
+ for(number = 0; number < num_points; number++){
+ *cPtr++ = (*aPtr++) + (*bPtr++);
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+#endif /* INCLUDED_volk_32f_x2_add_32f_u_H */
diff --git a/volk/include/volk/volk_32f_x2_divide_32f_a.h b/volk/include/volk/volk_32f_x2_divide_32f_a.h
new file mode 100644
index 000000000..7b60fb22e
--- /dev/null
+++ b/volk/include/volk/volk_32f_x2_divide_32f_a.h
@@ -0,0 +1,82 @@
+#ifndef INCLUDED_volk_32f_x2_divide_32f_a_H
+#define INCLUDED_volk_32f_x2_divide_32f_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+/*!
+ \brief Divides the two input vectors and store their results in the third vector
+ \param cVector The vector where the results will be stored
+ \param aVector The vector to be divideed
+ \param bVector The divisor vector
+ \param num_points The number of values in aVector and bVector to be divideed together and stored into cVector
+*/
+static inline void volk_32f_x2_divide_32f_a_sse(float* cVector, const float* aVector, const float* bVector, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+
+ float* cPtr = cVector;
+ const float* aPtr = aVector;
+ const float* bPtr= bVector;
+
+ __m128 aVal, bVal, cVal;
+ for(;number < quarterPoints; number++){
+
+ aVal = _mm_load_ps(aPtr);
+ bVal = _mm_load_ps(bPtr);
+
+ cVal = _mm_div_ps(aVal, bVal);
+
+ _mm_store_ps(cPtr,cVal); // Store the results back into the C container
+
+ aPtr += 4;
+ bPtr += 4;
+ cPtr += 4;
+ }
+
+ number = quarterPoints * 4;
+ for(;number < num_points; number++){
+ *cPtr++ = (*aPtr++) / (*bPtr++);
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Divides the two input vectors and store their results in the third vector
+ \param cVector The vector where the results will be stored
+ \param aVector The vector to be divideed
+ \param bVector The divisor vector
+ \param num_points The number of values in aVector and bVector to be divideed together and stored into cVector
+*/
+static inline void volk_32f_x2_divide_32f_a_generic(float* cVector, const float* aVector, const float* bVector, unsigned int num_points){
+ float* cPtr = cVector;
+ const float* aPtr = aVector;
+ const float* bPtr= bVector;
+ unsigned int number = 0;
+
+ for(number = 0; number < num_points; number++){
+ *cPtr++ = (*aPtr++) / (*bPtr++);
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+#ifdef LV_HAVE_ORC
+/*!
+ \brief Divides the two input vectors and store their results in the third vector
+ \param cVector The vector where the results will be stored
+ \param aVector The vector to be divideed
+ \param bVector The divisor vector
+ \param num_points The number of values in aVector and bVector to be divideed together and stored into cVector
+*/
+extern void volk_32f_x2_divide_32f_a_orc_impl(float* cVector, const float* aVector, const float* bVector, unsigned int num_points);
+static inline void volk_32f_x2_divide_32f_a_orc(float* cVector, const float* aVector, const float* bVector, unsigned int num_points){
+ volk_32f_x2_divide_32f_a_orc_impl(cVector, aVector, bVector, num_points);
+}
+#endif /* LV_HAVE_ORC */
+
+
+
+#endif /* INCLUDED_volk_32f_x2_divide_32f_a_H */
diff --git a/volk/include/volk/volk_32f_x2_dot_prod_16i_a.h b/volk/include/volk/volk_32f_x2_dot_prod_16i_a.h
new file mode 100644
index 000000000..961c2418c
--- /dev/null
+++ b/volk/include/volk/volk_32f_x2_dot_prod_16i_a.h
@@ -0,0 +1,98 @@
+#ifndef INCLUDED_volk_32f_x2_dot_prod_16i_a_H
+#define INCLUDED_volk_32f_x2_dot_prod_16i_a_H
+
+#include <volk/volk_common.h>
+#include<stdio.h>
+
+
+#ifdef LV_HAVE_GENERIC
+
+
+static inline void volk_32f_x2_dot_prod_16i_a_generic(int16_t* result, const float* input, const float* taps, unsigned int num_points) {
+
+ float dotProduct = 0;
+ const float* aPtr = input;
+ const float* bPtr= taps;
+ unsigned int number = 0;
+
+ for(number = 0; number < num_points; number++){
+ dotProduct += ((*aPtr++) * (*bPtr++));
+ }
+
+ *result = (int16_t)dotProduct;
+}
+
+#endif /*LV_HAVE_GENERIC*/
+
+
+#ifdef LV_HAVE_SSE
+
+
+static inline void volk_32f_x2_dot_prod_16i_a_sse(int16_t* result, const float* input, const float* taps, unsigned int num_points) {
+
+ unsigned int number = 0;
+ const unsigned int sixteenthPoints = num_points / 16;
+
+ float dotProduct = 0;
+ const float* aPtr = input;
+ const float* bPtr = taps;
+
+ __m128 a0Val, a1Val, a2Val, a3Val;
+ __m128 b0Val, b1Val, b2Val, b3Val;
+ __m128 c0Val, c1Val, c2Val, c3Val;
+
+ __m128 dotProdVal0 = _mm_setzero_ps();
+ __m128 dotProdVal1 = _mm_setzero_ps();
+ __m128 dotProdVal2 = _mm_setzero_ps();
+ __m128 dotProdVal3 = _mm_setzero_ps();
+
+ for(;number < sixteenthPoints; number++){
+
+ a0Val = _mm_load_ps(aPtr);
+ a1Val = _mm_load_ps(aPtr+4);
+ a2Val = _mm_load_ps(aPtr+8);
+ a3Val = _mm_load_ps(aPtr+12);
+ b0Val = _mm_load_ps(bPtr);
+ b1Val = _mm_load_ps(bPtr+4);
+ b2Val = _mm_load_ps(bPtr+8);
+ b3Val = _mm_load_ps(bPtr+12);
+
+ c0Val = _mm_mul_ps(a0Val, b0Val);
+ c1Val = _mm_mul_ps(a1Val, b1Val);
+ c2Val = _mm_mul_ps(a2Val, b2Val);
+ c3Val = _mm_mul_ps(a3Val, b3Val);
+
+ dotProdVal0 = _mm_add_ps(c0Val, dotProdVal0);
+ dotProdVal1 = _mm_add_ps(c1Val, dotProdVal1);
+ dotProdVal2 = _mm_add_ps(c2Val, dotProdVal2);
+ dotProdVal3 = _mm_add_ps(c3Val, dotProdVal3);
+
+ aPtr += 16;
+ bPtr += 16;
+ }
+
+ dotProdVal0 = _mm_add_ps(dotProdVal0, dotProdVal1);
+ dotProdVal0 = _mm_add_ps(dotProdVal0, dotProdVal2);
+ dotProdVal0 = _mm_add_ps(dotProdVal0, dotProdVal3);
+
+ __VOLK_ATTR_ALIGNED(16) float dotProductVector[4];
+
+ _mm_store_ps(dotProductVector,dotProdVal0); // Store the results back into the dot product vector
+
+ dotProduct = dotProductVector[0];
+ dotProduct += dotProductVector[1];
+ dotProduct += dotProductVector[2];
+ dotProduct += dotProductVector[3];
+
+ number = sixteenthPoints*16;
+ for(;number < num_points; number++){
+ dotProduct += ((*aPtr++) * (*bPtr++));
+ }
+
+ *result = (short)dotProduct;
+
+}
+
+#endif /*LV_HAVE_SSE*/
+
+#endif /*INCLUDED_volk_32f_x2_dot_prod_16i_a_H*/
diff --git a/volk/include/volk/volk_32f_x2_dot_prod_32f_a.h b/volk/include/volk/volk_32f_x2_dot_prod_32f_a.h
new file mode 100644
index 000000000..067c33ad8
--- /dev/null
+++ b/volk/include/volk/volk_32f_x2_dot_prod_32f_a.h
@@ -0,0 +1,290 @@
+#ifndef INCLUDED_volk_32f_x2_dot_prod_32f_a_H
+#define INCLUDED_volk_32f_x2_dot_prod_32f_a_H
+
+#include <volk/volk_common.h>
+#include<stdio.h>
+
+
+#ifdef LV_HAVE_GENERIC
+
+
+static inline void volk_32f_x2_dot_prod_32f_a_generic(float * result, const float * input, const float * taps, unsigned int num_points) {
+
+ float dotProduct = 0;
+ const float* aPtr = input;
+ const float* bPtr= taps;
+ unsigned int number = 0;
+
+ for(number = 0; number < num_points; number++){
+ dotProduct += ((*aPtr++) * (*bPtr++));
+ }
+
+ *result = dotProduct;
+}
+
+#endif /*LV_HAVE_GENERIC*/
+
+
+#ifdef LV_HAVE_SSE
+
+
+static inline void volk_32f_x2_dot_prod_32f_a_sse( float* result, const float* input, const float* taps, unsigned int num_points) {
+
+ unsigned int number = 0;
+ const unsigned int sixteenthPoints = num_points / 16;
+
+ float dotProduct = 0;
+ const float* aPtr = input;
+ const float* bPtr = taps;
+
+ __m128 a0Val, a1Val, a2Val, a3Val;
+ __m128 b0Val, b1Val, b2Val, b3Val;
+ __m128 c0Val, c1Val, c2Val, c3Val;
+
+ __m128 dotProdVal0 = _mm_setzero_ps();
+ __m128 dotProdVal1 = _mm_setzero_ps();
+ __m128 dotProdVal2 = _mm_setzero_ps();
+ __m128 dotProdVal3 = _mm_setzero_ps();
+
+ for(;number < sixteenthPoints; number++){
+
+ a0Val = _mm_load_ps(aPtr);
+ a1Val = _mm_load_ps(aPtr+4);
+ a2Val = _mm_load_ps(aPtr+8);
+ a3Val = _mm_load_ps(aPtr+12);
+ b0Val = _mm_load_ps(bPtr);
+ b1Val = _mm_load_ps(bPtr+4);
+ b2Val = _mm_load_ps(bPtr+8);
+ b3Val = _mm_load_ps(bPtr+12);
+
+ c0Val = _mm_mul_ps(a0Val, b0Val);
+ c1Val = _mm_mul_ps(a1Val, b1Val);
+ c2Val = _mm_mul_ps(a2Val, b2Val);
+ c3Val = _mm_mul_ps(a3Val, b3Val);
+
+ dotProdVal0 = _mm_add_ps(c0Val, dotProdVal0);
+ dotProdVal1 = _mm_add_ps(c1Val, dotProdVal1);
+ dotProdVal2 = _mm_add_ps(c2Val, dotProdVal2);
+ dotProdVal3 = _mm_add_ps(c3Val, dotProdVal3);
+
+ aPtr += 16;
+ bPtr += 16;
+ }
+
+ dotProdVal0 = _mm_add_ps(dotProdVal0, dotProdVal1);
+ dotProdVal0 = _mm_add_ps(dotProdVal0, dotProdVal2);
+ dotProdVal0 = _mm_add_ps(dotProdVal0, dotProdVal3);
+
+ __VOLK_ATTR_ALIGNED(16) float dotProductVector[4];
+
+ _mm_store_ps(dotProductVector,dotProdVal0); // Store the results back into the dot product vector
+
+ dotProduct = dotProductVector[0];
+ dotProduct += dotProductVector[1];
+ dotProduct += dotProductVector[2];
+ dotProduct += dotProductVector[3];
+
+ number = sixteenthPoints*16;
+ for(;number < num_points; number++){
+ dotProduct += ((*aPtr++) * (*bPtr++));
+ }
+
+ *result = dotProduct;
+
+}
+
+#endif /*LV_HAVE_SSE*/
+
+#ifdef LV_HAVE_SSE3
+
+#include <pmmintrin.h>
+
+static inline void volk_32f_x2_dot_prod_32f_a_sse3(float * result, const float * input, const float * taps, unsigned int num_points) {
+ unsigned int number = 0;
+ const unsigned int sixteenthPoints = num_points / 16;
+
+ float dotProduct = 0;
+ const float* aPtr = input;
+ const float* bPtr = taps;
+
+ __m128 a0Val, a1Val, a2Val, a3Val;
+ __m128 b0Val, b1Val, b2Val, b3Val;
+ __m128 c0Val, c1Val, c2Val, c3Val;
+
+ __m128 dotProdVal0 = _mm_setzero_ps();
+ __m128 dotProdVal1 = _mm_setzero_ps();
+ __m128 dotProdVal2 = _mm_setzero_ps();
+ __m128 dotProdVal3 = _mm_setzero_ps();
+
+ for(;number < sixteenthPoints; number++){
+
+ a0Val = _mm_load_ps(aPtr);
+ a1Val = _mm_load_ps(aPtr+4);
+ a2Val = _mm_load_ps(aPtr+8);
+ a3Val = _mm_load_ps(aPtr+12);
+ b0Val = _mm_load_ps(bPtr);
+ b1Val = _mm_load_ps(bPtr+4);
+ b2Val = _mm_load_ps(bPtr+8);
+ b3Val = _mm_load_ps(bPtr+12);
+
+ c0Val = _mm_mul_ps(a0Val, b0Val);
+ c1Val = _mm_mul_ps(a1Val, b1Val);
+ c2Val = _mm_mul_ps(a2Val, b2Val);
+ c3Val = _mm_mul_ps(a3Val, b3Val);
+
+ dotProdVal0 = _mm_add_ps(dotProdVal0, c0Val);
+ dotProdVal1 = _mm_add_ps(dotProdVal1, c1Val);
+ dotProdVal2 = _mm_add_ps(dotProdVal2, c2Val);
+ dotProdVal3 = _mm_add_ps(dotProdVal3, c3Val);
+
+ aPtr += 16;
+ bPtr += 16;
+ }
+
+ dotProdVal0 = _mm_add_ps(dotProdVal0, dotProdVal1);
+ dotProdVal0 = _mm_add_ps(dotProdVal0, dotProdVal2);
+ dotProdVal0 = _mm_add_ps(dotProdVal0, dotProdVal3);
+
+ __VOLK_ATTR_ALIGNED(16) float dotProductVector[4];
+ _mm_store_ps(dotProductVector,dotProdVal0); // Store the results back into the dot product vector
+
+ dotProduct = dotProductVector[0];
+ dotProduct += dotProductVector[1];
+ dotProduct += dotProductVector[2];
+ dotProduct += dotProductVector[3];
+
+ number = sixteenthPoints*16;
+ for(;number < num_points; number++){
+ dotProduct += ((*aPtr++) * (*bPtr++));
+ }
+
+ *result = dotProduct;
+}
+
+#endif /*LV_HAVE_SSE3*/
+
+#ifdef LV_HAVE_SSE4_1
+
+#include <smmintrin.h>
+
+static inline void volk_32f_x2_dot_prod_32f_a_sse4_1(float * result, const float * input, const float* taps, unsigned int num_points) {
+ unsigned int number = 0;
+ const unsigned int sixteenthPoints = num_points / 16;
+
+ float dotProduct = 0;
+ const float* aPtr = input;
+ const float* bPtr = taps;
+
+ __m128 aVal1, bVal1, cVal1;
+ __m128 aVal2, bVal2, cVal2;
+ __m128 aVal3, bVal3, cVal3;
+ __m128 aVal4, bVal4, cVal4;
+
+ __m128 dotProdVal = _mm_setzero_ps();
+
+ for(;number < sixteenthPoints; number++){
+
+ aVal1 = _mm_load_ps(aPtr); aPtr += 4;
+ aVal2 = _mm_load_ps(aPtr); aPtr += 4;
+ aVal3 = _mm_load_ps(aPtr); aPtr += 4;
+ aVal4 = _mm_load_ps(aPtr); aPtr += 4;
+
+ bVal1 = _mm_load_ps(bPtr); bPtr += 4;
+ bVal2 = _mm_load_ps(bPtr); bPtr += 4;
+ bVal3 = _mm_load_ps(bPtr); bPtr += 4;
+ bVal4 = _mm_load_ps(bPtr); bPtr += 4;
+
+ cVal1 = _mm_dp_ps(aVal1, bVal1, 0xF1);
+ cVal2 = _mm_dp_ps(aVal2, bVal2, 0xF2);
+ cVal3 = _mm_dp_ps(aVal3, bVal3, 0xF4);
+ cVal4 = _mm_dp_ps(aVal4, bVal4, 0xF8);
+
+ cVal1 = _mm_or_ps(cVal1, cVal2);
+ cVal3 = _mm_or_ps(cVal3, cVal4);
+ cVal1 = _mm_or_ps(cVal1, cVal3);
+
+ dotProdVal = _mm_add_ps(dotProdVal, cVal1);
+ }
+
+ __VOLK_ATTR_ALIGNED(16) float dotProductVector[4];
+ _mm_store_ps(dotProductVector, dotProdVal); // Store the results back into the dot product vector
+
+ dotProduct = dotProductVector[0];
+ dotProduct += dotProductVector[1];
+ dotProduct += dotProductVector[2];
+ dotProduct += dotProductVector[3];
+
+ number = sixteenthPoints * 16;
+ for(;number < num_points; number++){
+ dotProduct += ((*aPtr++) * (*bPtr++));
+ }
+
+ *result = dotProduct;
+}
+
+#endif /*LV_HAVE_SSE4_1*/
+
+#ifdef LV_HAVE_AVX
+
+#include <immintrin.h>
+
+static inline void volk_32f_x2_dot_prod_32f_a_avx( float* result, const float* input, const float* taps, unsigned int num_points) {
+
+ unsigned int number = 0;
+ const unsigned int sixteenthPoints = num_points / 16;
+
+ float dotProduct = 0;
+ const float* aPtr = input;
+ const float* bPtr = taps;
+
+ __m256 a0Val, a1Val;
+ __m256 b0Val, b1Val;
+ __m256 c0Val, c1Val;
+
+ __m256 dotProdVal0 = _mm256_setzero_ps();
+ __m256 dotProdVal1 = _mm256_setzero_ps();
+
+ for(;number < sixteenthPoints; number++){
+
+ a0Val = _mm256_load_ps(aPtr);
+ a1Val = _mm256_load_ps(aPtr+8);
+ b0Val = _mm256_load_ps(bPtr);
+ b1Val = _mm256_load_ps(bPtr+8);
+
+ c0Val = _mm256_mul_ps(a0Val, b0Val);
+ c1Val = _mm256_mul_ps(a1Val, b1Val);
+
+ dotProdVal0 = _mm256_add_ps(c0Val, dotProdVal0);
+ dotProdVal1 = _mm256_add_ps(c1Val, dotProdVal1);
+
+ aPtr += 16;
+ bPtr += 16;
+ }
+
+ dotProdVal0 = _mm256_add_ps(dotProdVal0, dotProdVal1);
+
+ __VOLK_ATTR_ALIGNED(32) float dotProductVector[8];
+
+ _mm256_store_ps(dotProductVector,dotProdVal0); // Store the results back into the dot product vector
+
+ dotProduct = dotProductVector[0];
+ dotProduct += dotProductVector[1];
+ dotProduct += dotProductVector[2];
+ dotProduct += dotProductVector[3];
+ dotProduct += dotProductVector[4];
+ dotProduct += dotProductVector[5];
+ dotProduct += dotProductVector[6];
+ dotProduct += dotProductVector[7];
+
+ number = sixteenthPoints*16;
+ for(;number < num_points; number++){
+ dotProduct += ((*aPtr++) * (*bPtr++));
+ }
+
+ *result = dotProduct;
+
+}
+
+#endif /*LV_HAVE_AVX*/
+
+#endif /*INCLUDED_volk_32f_x2_dot_prod_32f_a_H*/
diff --git a/volk/include/volk/volk_32f_x2_dot_prod_32f_u.h b/volk/include/volk/volk_32f_x2_dot_prod_32f_u.h
new file mode 100644
index 000000000..b24e8b1f7
--- /dev/null
+++ b/volk/include/volk/volk_32f_x2_dot_prod_32f_u.h
@@ -0,0 +1,290 @@
+#ifndef INCLUDED_volk_32f_x2_dot_prod_32f_u_H
+#define INCLUDED_volk_32f_x2_dot_prod_32f_u_H
+
+#include <volk/volk_common.h>
+#include<stdio.h>
+
+
+#ifdef LV_HAVE_GENERIC
+
+
+static inline void volk_32f_x2_dot_prod_32f_u_generic(float * result, const float * input, const float * taps, unsigned int num_points) {
+
+ float dotProduct = 0;
+ const float* aPtr = input;
+ const float* bPtr= taps;
+ unsigned int number = 0;
+
+ for(number = 0; number < num_points; number++){
+ dotProduct += ((*aPtr++) * (*bPtr++));
+ }
+
+ *result = dotProduct;
+}
+
+#endif /*LV_HAVE_GENERIC*/
+
+
+#ifdef LV_HAVE_SSE
+
+
+static inline void volk_32f_x2_dot_prod_32f_u_sse( float* result, const float* input, const float* taps, unsigned int num_points) {
+
+ unsigned int number = 0;
+ const unsigned int sixteenthPoints = num_points / 16;
+
+ float dotProduct = 0;
+ const float* aPtr = input;
+ const float* bPtr = taps;
+
+ __m128 a0Val, a1Val, a2Val, a3Val;
+ __m128 b0Val, b1Val, b2Val, b3Val;
+ __m128 c0Val, c1Val, c2Val, c3Val;
+
+ __m128 dotProdVal0 = _mm_setzero_ps();
+ __m128 dotProdVal1 = _mm_setzero_ps();
+ __m128 dotProdVal2 = _mm_setzero_ps();
+ __m128 dotProdVal3 = _mm_setzero_ps();
+
+ for(;number < sixteenthPoints; number++){
+
+ a0Val = _mm_loadu_ps(aPtr);
+ a1Val = _mm_loadu_ps(aPtr+4);
+ a2Val = _mm_loadu_ps(aPtr+8);
+ a3Val = _mm_loadu_ps(aPtr+12);
+ b0Val = _mm_loadu_ps(bPtr);
+ b1Val = _mm_loadu_ps(bPtr+4);
+ b2Val = _mm_loadu_ps(bPtr+8);
+ b3Val = _mm_loadu_ps(bPtr+12);
+
+ c0Val = _mm_mul_ps(a0Val, b0Val);
+ c1Val = _mm_mul_ps(a1Val, b1Val);
+ c2Val = _mm_mul_ps(a2Val, b2Val);
+ c3Val = _mm_mul_ps(a3Val, b3Val);
+
+ dotProdVal0 = _mm_add_ps(c0Val, dotProdVal0);
+ dotProdVal1 = _mm_add_ps(c1Val, dotProdVal1);
+ dotProdVal2 = _mm_add_ps(c2Val, dotProdVal2);
+ dotProdVal3 = _mm_add_ps(c3Val, dotProdVal3);
+
+ aPtr += 16;
+ bPtr += 16;
+ }
+
+ dotProdVal0 = _mm_add_ps(dotProdVal0, dotProdVal1);
+ dotProdVal0 = _mm_add_ps(dotProdVal0, dotProdVal2);
+ dotProdVal0 = _mm_add_ps(dotProdVal0, dotProdVal3);
+
+ __VOLK_ATTR_ALIGNED(16) float dotProductVector[4];
+
+ _mm_store_ps(dotProductVector,dotProdVal0); // Store the results back into the dot product vector
+
+ dotProduct = dotProductVector[0];
+ dotProduct += dotProductVector[1];
+ dotProduct += dotProductVector[2];
+ dotProduct += dotProductVector[3];
+
+ number = sixteenthPoints*16;
+ for(;number < num_points; number++){
+ dotProduct += ((*aPtr++) * (*bPtr++));
+ }
+
+ *result = dotProduct;
+
+}
+
+#endif /*LV_HAVE_SSE*/
+
+#ifdef LV_HAVE_SSE3
+
+#include <pmmintrin.h>
+
+static inline void volk_32f_x2_dot_prod_32f_u_sse3(float * result, const float * input, const float * taps, unsigned int num_points) {
+ unsigned int number = 0;
+ const unsigned int sixteenthPoints = num_points / 16;
+
+ float dotProduct = 0;
+ const float* aPtr = input;
+ const float* bPtr = taps;
+
+ __m128 a0Val, a1Val, a2Val, a3Val;
+ __m128 b0Val, b1Val, b2Val, b3Val;
+ __m128 c0Val, c1Val, c2Val, c3Val;
+
+ __m128 dotProdVal0 = _mm_setzero_ps();
+ __m128 dotProdVal1 = _mm_setzero_ps();
+ __m128 dotProdVal2 = _mm_setzero_ps();
+ __m128 dotProdVal3 = _mm_setzero_ps();
+
+ for(;number < sixteenthPoints; number++){
+
+ a0Val = _mm_loadu_ps(aPtr);
+ a1Val = _mm_loadu_ps(aPtr+4);
+ a2Val = _mm_loadu_ps(aPtr+8);
+ a3Val = _mm_loadu_ps(aPtr+12);
+ b0Val = _mm_loadu_ps(bPtr);
+ b1Val = _mm_loadu_ps(bPtr+4);
+ b2Val = _mm_loadu_ps(bPtr+8);
+ b3Val = _mm_loadu_ps(bPtr+12);
+
+ c0Val = _mm_mul_ps(a0Val, b0Val);
+ c1Val = _mm_mul_ps(a1Val, b1Val);
+ c2Val = _mm_mul_ps(a2Val, b2Val);
+ c3Val = _mm_mul_ps(a3Val, b3Val);
+
+ dotProdVal0 = _mm_add_ps(dotProdVal0, c0Val);
+ dotProdVal1 = _mm_add_ps(dotProdVal1, c1Val);
+ dotProdVal2 = _mm_add_ps(dotProdVal2, c2Val);
+ dotProdVal3 = _mm_add_ps(dotProdVal3, c3Val);
+
+ aPtr += 16;
+ bPtr += 16;
+ }
+
+ dotProdVal0 = _mm_add_ps(dotProdVal0, dotProdVal1);
+ dotProdVal0 = _mm_add_ps(dotProdVal0, dotProdVal2);
+ dotProdVal0 = _mm_add_ps(dotProdVal0, dotProdVal3);
+
+ __VOLK_ATTR_ALIGNED(16) float dotProductVector[4];
+ _mm_store_ps(dotProductVector,dotProdVal0); // Store the results back into the dot product vector
+
+ dotProduct = dotProductVector[0];
+ dotProduct += dotProductVector[1];
+ dotProduct += dotProductVector[2];
+ dotProduct += dotProductVector[3];
+
+ number = sixteenthPoints*16;
+ for(;number < num_points; number++){
+ dotProduct += ((*aPtr++) * (*bPtr++));
+ }
+
+ *result = dotProduct;
+}
+
+#endif /*LV_HAVE_SSE3*/
+
+#ifdef LV_HAVE_SSE4_1
+
+#include <smmintrin.h>
+
+static inline void volk_32f_x2_dot_prod_32f_u_sse4_1(float * result, const float * input, const float* taps, unsigned int num_points) {
+ unsigned int number = 0;
+ const unsigned int sixteenthPoints = num_points / 16;
+
+ float dotProduct = 0;
+ const float* aPtr = input;
+ const float* bPtr = taps;
+
+ __m128 aVal1, bVal1, cVal1;
+ __m128 aVal2, bVal2, cVal2;
+ __m128 aVal3, bVal3, cVal3;
+ __m128 aVal4, bVal4, cVal4;
+
+ __m128 dotProdVal = _mm_setzero_ps();
+
+ for(;number < sixteenthPoints; number++){
+
+ aVal1 = _mm_loadu_ps(aPtr); aPtr += 4;
+ aVal2 = _mm_loadu_ps(aPtr); aPtr += 4;
+ aVal3 = _mm_loadu_ps(aPtr); aPtr += 4;
+ aVal4 = _mm_loadu_ps(aPtr); aPtr += 4;
+
+ bVal1 = _mm_loadu_ps(bPtr); bPtr += 4;
+ bVal2 = _mm_loadu_ps(bPtr); bPtr += 4;
+ bVal3 = _mm_loadu_ps(bPtr); bPtr += 4;
+ bVal4 = _mm_loadu_ps(bPtr); bPtr += 4;
+
+ cVal1 = _mm_dp_ps(aVal1, bVal1, 0xF1);
+ cVal2 = _mm_dp_ps(aVal2, bVal2, 0xF2);
+ cVal3 = _mm_dp_ps(aVal3, bVal3, 0xF4);
+ cVal4 = _mm_dp_ps(aVal4, bVal4, 0xF8);
+
+ cVal1 = _mm_or_ps(cVal1, cVal2);
+ cVal3 = _mm_or_ps(cVal3, cVal4);
+ cVal1 = _mm_or_ps(cVal1, cVal3);
+
+ dotProdVal = _mm_add_ps(dotProdVal, cVal1);
+ }
+
+ __VOLK_ATTR_ALIGNED(16) float dotProductVector[4];
+ _mm_store_ps(dotProductVector, dotProdVal); // Store the results back into the dot product vector
+
+ dotProduct = dotProductVector[0];
+ dotProduct += dotProductVector[1];
+ dotProduct += dotProductVector[2];
+ dotProduct += dotProductVector[3];
+
+ number = sixteenthPoints * 16;
+ for(;number < num_points; number++){
+ dotProduct += ((*aPtr++) * (*bPtr++));
+ }
+
+ *result = dotProduct;
+}
+
+#endif /*LV_HAVE_SSE4_1*/
+
+#ifdef LV_HAVE_AVX
+
+#include <immintrin.h>
+
+static inline void volk_32f_x2_dot_prod_32f_u_avx( float* result, const float* input, const float* taps, unsigned int num_points) {
+
+ unsigned int number = 0;
+ const unsigned int sixteenthPoints = num_points / 16;
+
+ float dotProduct = 0;
+ const float* aPtr = input;
+ const float* bPtr = taps;
+
+ __m256 a0Val, a1Val;
+ __m256 b0Val, b1Val;
+ __m256 c0Val, c1Val;
+
+ __m256 dotProdVal0 = _mm256_setzero_ps();
+ __m256 dotProdVal1 = _mm256_setzero_ps();
+
+ for(;number < sixteenthPoints; number++){
+
+ a0Val = _mm256_loadu_ps(aPtr);
+ a1Val = _mm256_loadu_ps(aPtr+8);
+ b0Val = _mm256_loadu_ps(bPtr);
+ b1Val = _mm256_loadu_ps(bPtr+8);
+
+ c0Val = _mm256_mul_ps(a0Val, b0Val);
+ c1Val = _mm256_mul_ps(a1Val, b1Val);
+
+ dotProdVal0 = _mm256_add_ps(c0Val, dotProdVal0);
+ dotProdVal1 = _mm256_add_ps(c1Val, dotProdVal1);
+
+ aPtr += 16;
+ bPtr += 16;
+ }
+
+ dotProdVal0 = _mm256_add_ps(dotProdVal0, dotProdVal1);
+
+ __VOLK_ATTR_ALIGNED(32) float dotProductVector[8];
+
+ _mm256_storeu_ps(dotProductVector,dotProdVal0); // Store the results back into the dot product vector
+
+ dotProduct = dotProductVector[0];
+ dotProduct += dotProductVector[1];
+ dotProduct += dotProductVector[2];
+ dotProduct += dotProductVector[3];
+ dotProduct += dotProductVector[4];
+ dotProduct += dotProductVector[5];
+ dotProduct += dotProductVector[6];
+ dotProduct += dotProductVector[7];
+
+ number = sixteenthPoints*16;
+ for(;number < num_points; number++){
+ dotProduct += ((*aPtr++) * (*bPtr++));
+ }
+
+ *result = dotProduct;
+
+}
+
+#endif /*LV_HAVE_AVX*/
+
+#endif /*INCLUDED_volk_32f_x2_dot_prod_32f_u_H*/
diff --git a/volk/include/volk/volk_32f_x2_interleave_32fc_a.h b/volk/include/volk/volk_32f_x2_interleave_32fc_a.h
new file mode 100644
index 000000000..52d80b6bb
--- /dev/null
+++ b/volk/include/volk/volk_32f_x2_interleave_32fc_a.h
@@ -0,0 +1,75 @@
+#ifndef INCLUDED_volk_32f_x2_interleave_32fc_a_H
+#define INCLUDED_volk_32f_x2_interleave_32fc_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+/*!
+ \brief Interleaves the I & Q vector data into the complex vector
+ \param iBuffer The I buffer data to be interleaved
+ \param qBuffer The Q buffer data to be interleaved
+ \param complexVector The complex output vector
+ \param num_points The number of complex data values to be interleaved
+*/
+static inline void volk_32f_x2_interleave_32fc_a_sse(lv_32fc_t* complexVector, const float* iBuffer, const float* qBuffer, unsigned int num_points){
+ unsigned int number = 0;
+ float* complexVectorPtr = (float*)complexVector;
+ const float* iBufferPtr = iBuffer;
+ const float* qBufferPtr = qBuffer;
+
+ const uint64_t quarterPoints = num_points / 4;
+
+ __m128 iValue, qValue, cplxValue;
+ for(;number < quarterPoints; number++){
+ iValue = _mm_load_ps(iBufferPtr);
+ qValue = _mm_load_ps(qBufferPtr);
+
+ // Interleaves the lower two values in the i and q variables into one buffer
+ cplxValue = _mm_unpacklo_ps(iValue, qValue);
+ _mm_store_ps(complexVectorPtr, cplxValue);
+ complexVectorPtr += 4;
+
+ // Interleaves the upper two values in the i and q variables into one buffer
+ cplxValue = _mm_unpackhi_ps(iValue, qValue);
+ _mm_store_ps(complexVectorPtr, cplxValue);
+ complexVectorPtr += 4;
+
+ iBufferPtr += 4;
+ qBufferPtr += 4;
+ }
+
+ number = quarterPoints * 4;
+ for(; number < num_points; number++){
+ *complexVectorPtr++ = *iBufferPtr++;
+ *complexVectorPtr++ = *qBufferPtr++;
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Interleaves the I & Q vector data into the complex vector.
+ \param iBuffer The I buffer data to be interleaved
+ \param qBuffer The Q buffer data to be interleaved
+ \param complexVector The complex output vector
+ \param num_points The number of complex data values to be interleaved
+*/
+static inline void volk_32f_x2_interleave_32fc_a_generic(lv_32fc_t* complexVector, const float* iBuffer, const float* qBuffer, unsigned int num_points){
+ float* complexVectorPtr = (float*)complexVector;
+ const float* iBufferPtr = iBuffer;
+ const float* qBufferPtr = qBuffer;
+ unsigned int number;
+
+ for(number = 0; number < num_points; number++){
+ *complexVectorPtr++ = *iBufferPtr++;
+ *complexVectorPtr++ = *qBufferPtr++;
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_32f_x2_interleave_32fc_a_H */
diff --git a/volk/include/volk/volk_32f_x2_max_32f_a.h b/volk/include/volk/volk_32f_x2_max_32f_a.h
new file mode 100644
index 000000000..79f2d04b5
--- /dev/null
+++ b/volk/include/volk/volk_32f_x2_max_32f_a.h
@@ -0,0 +1,85 @@
+#ifndef INCLUDED_volk_32f_x2_max_32f_a_H
+#define INCLUDED_volk_32f_x2_max_32f_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+/*!
+ \brief Selects maximum value from each entry between bVector and aVector and store their results in the cVector
+ \param cVector The vector where the results will be stored
+ \param aVector The vector to be checked
+ \param bVector The vector to be checked
+ \param num_points The number of values in aVector and bVector to be checked and stored into cVector
+*/
+static inline void volk_32f_x2_max_32f_a_sse(float* cVector, const float* aVector, const float* bVector, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+
+ float* cPtr = cVector;
+ const float* aPtr = aVector;
+ const float* bPtr= bVector;
+
+ __m128 aVal, bVal, cVal;
+ for(;number < quarterPoints; number++){
+
+ aVal = _mm_load_ps(aPtr);
+ bVal = _mm_load_ps(bPtr);
+
+ cVal = _mm_max_ps(aVal, bVal);
+
+ _mm_store_ps(cPtr,cVal); // Store the results back into the C container
+
+ aPtr += 4;
+ bPtr += 4;
+ cPtr += 4;
+ }
+
+ number = quarterPoints * 4;
+ for(;number < num_points; number++){
+ const float a = *aPtr++;
+ const float b = *bPtr++;
+ *cPtr++ = ( a > b ? a : b);
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Selects maximum value from each entry between bVector and aVector and store their results in the cVector
+ \param cVector The vector where the results will be stored
+ \param aVector The vector to be checked
+ \param bVector The vector to be checked
+ \param num_points The number of values in aVector and bVector to be checked and stored into cVector
+*/
+static inline void volk_32f_x2_max_32f_a_generic(float* cVector, const float* aVector, const float* bVector, unsigned int num_points){
+ float* cPtr = cVector;
+ const float* aPtr = aVector;
+ const float* bPtr= bVector;
+ unsigned int number = 0;
+
+ for(number = 0; number < num_points; number++){
+ const float a = *aPtr++;
+ const float b = *bPtr++;
+ *cPtr++ = ( a > b ? a : b);
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+#ifdef LV_HAVE_ORC
+/*!
+ \brief Selects maximum value from each entry between bVector and aVector and store their results in the cVector
+ \param cVector The vector where the results will be stored
+ \param aVector The vector to be checked
+ \param bVector The vector to be checked
+ \param num_points The number of values in aVector and bVector to be checked and stored into cVector
+*/
+extern void volk_32f_x2_max_32f_a_orc_impl(float* cVector, const float* aVector, const float* bVector, unsigned int num_points);
+static inline void volk_32f_x2_max_32f_a_orc(float* cVector, const float* aVector, const float* bVector, unsigned int num_points){
+ volk_32f_x2_max_32f_a_orc_impl(cVector, aVector, bVector, num_points);
+}
+#endif /* LV_HAVE_ORC */
+
+
+#endif /* INCLUDED_volk_32f_x2_max_32f_a_H */
diff --git a/volk/include/volk/volk_32f_x2_min_32f_a.h b/volk/include/volk/volk_32f_x2_min_32f_a.h
new file mode 100644
index 000000000..42cac0833
--- /dev/null
+++ b/volk/include/volk/volk_32f_x2_min_32f_a.h
@@ -0,0 +1,85 @@
+#ifndef INCLUDED_volk_32f_x2_min_32f_a_H
+#define INCLUDED_volk_32f_x2_min_32f_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+/*!
+ \brief Selects minimum value from each entry between bVector and aVector and store their results in the cVector
+ \param cVector The vector where the results will be stored
+ \param aVector The vector to be checked
+ \param bVector The vector to be checked
+ \param num_points The number of values in aVector and bVector to be checked and stored into cVector
+*/
+static inline void volk_32f_x2_min_32f_a_sse(float* cVector, const float* aVector, const float* bVector, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+
+ float* cPtr = cVector;
+ const float* aPtr = aVector;
+ const float* bPtr= bVector;
+
+ __m128 aVal, bVal, cVal;
+ for(;number < quarterPoints; number++){
+
+ aVal = _mm_load_ps(aPtr);
+ bVal = _mm_load_ps(bPtr);
+
+ cVal = _mm_min_ps(aVal, bVal);
+
+ _mm_store_ps(cPtr,cVal); // Store the results back into the C container
+
+ aPtr += 4;
+ bPtr += 4;
+ cPtr += 4;
+ }
+
+ number = quarterPoints * 4;
+ for(;number < num_points; number++){
+ const float a = *aPtr++;
+ const float b = *bPtr++;
+ *cPtr++ = ( a < b ? a : b);
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Selects minimum value from each entry between bVector and aVector and store their results in the cVector
+ \param cVector The vector where the results will be stored
+ \param aVector The vector to be checked
+ \param bVector The vector to be checked
+ \param num_points The number of values in aVector and bVector to be checked and stored into cVector
+*/
+static inline void volk_32f_x2_min_32f_a_generic(float* cVector, const float* aVector, const float* bVector, unsigned int num_points){
+ float* cPtr = cVector;
+ const float* aPtr = aVector;
+ const float* bPtr= bVector;
+ unsigned int number = 0;
+
+ for(number = 0; number < num_points; number++){
+ const float a = *aPtr++;
+ const float b = *bPtr++;
+ *cPtr++ = ( a < b ? a : b);
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+#ifdef LV_HAVE_ORC
+/*!
+ \brief Selects minimum value from each entry between bVector and aVector and store their results in the cVector
+ \param cVector The vector where the results will be stored
+ \param aVector The vector to be checked
+ \param bVector The vector to be checked
+ \param num_points The number of values in aVector and bVector to be checked and stored into cVector
+*/
+extern void volk_32f_x2_min_32f_a_orc_impl(float* cVector, const float* aVector, const float* bVector, unsigned int num_points);
+static inline void volk_32f_x2_min_32f_a_orc(float* cVector, const float* aVector, const float* bVector, unsigned int num_points){
+ volk_32f_x2_min_32f_a_orc_impl(cVector, aVector, bVector, num_points);
+}
+#endif /* LV_HAVE_ORC */
+
+
+#endif /* INCLUDED_volk_32f_x2_min_32f_a_H */
diff --git a/volk/include/volk/volk_32f_x2_multiply_32f_a.h b/volk/include/volk/volk_32f_x2_multiply_32f_a.h
new file mode 100644
index 000000000..340e05165
--- /dev/null
+++ b/volk/include/volk/volk_32f_x2_multiply_32f_a.h
@@ -0,0 +1,120 @@
+#ifndef INCLUDED_volk_32f_x2_multiply_32f_a_H
+#define INCLUDED_volk_32f_x2_multiply_32f_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+/*!
+ \brief Multiplys the two input vectors and store their results in the third vector
+ \param cVector The vector where the results will be stored
+ \param aVector One of the vectors to be multiplied
+ \param bVector One of the vectors to be multiplied
+ \param num_points The number of values in aVector and bVector to be multiplied together and stored into cVector
+*/
+static inline void volk_32f_x2_multiply_32f_a_sse(float* cVector, const float* aVector, const float* bVector, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+
+ float* cPtr = cVector;
+ const float* aPtr = aVector;
+ const float* bPtr= bVector;
+
+ __m128 aVal, bVal, cVal;
+ for(;number < quarterPoints; number++){
+
+ aVal = _mm_load_ps(aPtr);
+ bVal = _mm_load_ps(bPtr);
+
+ cVal = _mm_mul_ps(aVal, bVal);
+
+ _mm_store_ps(cPtr,cVal); // Store the results back into the C container
+
+ aPtr += 4;
+ bPtr += 4;
+ cPtr += 4;
+ }
+
+ number = quarterPoints * 4;
+ for(;number < num_points; number++){
+ *cPtr++ = (*aPtr++) * (*bPtr++);
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_AVX
+#include <immintrin.h>
+/*!
+ \brief Multiplies the two input vectors and store their results in the third vector
+ \param cVector The vector where the results will be stored
+ \param aVector One of the vectors to be multiplied
+ \param bVector One of the vectors to be multiplied
+ \param num_points The number of values in aVector and bVector to be multiplied together and stored into cVector
+*/
+static inline void volk_32f_x2_multiply_32f_a_avx(float* cVector, const float* aVector, const float* bVector, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int eighthPoints = num_points / 8;
+
+ float* cPtr = cVector;
+ const float* aPtr = aVector;
+ const float* bPtr= bVector;
+
+ __m256 aVal, bVal, cVal;
+ for(;number < eighthPoints; number++){
+
+ aVal = _mm256_load_ps(aPtr);
+ bVal = _mm256_load_ps(bPtr);
+
+ cVal = _mm256_mul_ps(aVal, bVal);
+
+ _mm256_store_ps(cPtr,cVal); // Store the results back into the C container
+
+ aPtr += 8;
+ bPtr += 8;
+ cPtr += 8;
+ }
+
+ number = eighthPoints * 8;
+ for(;number < num_points; number++){
+ *cPtr++ = (*aPtr++) * (*bPtr++);
+ }
+}
+#endif /* LV_HAVE_AVX */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Multiplys the two input vectors and store their results in the third vector
+ \param cVector The vector where the results will be stored
+ \param aVector One of the vectors to be multiplied
+ \param bVector One of the vectors to be multiplied
+ \param num_points The number of values in aVector and bVector to be multiplied together and stored into cVector
+*/
+static inline void volk_32f_x2_multiply_32f_a_generic(float* cVector, const float* aVector, const float* bVector, unsigned int num_points){
+ float* cPtr = cVector;
+ const float* aPtr = aVector;
+ const float* bPtr= bVector;
+ unsigned int number = 0;
+
+ for(number = 0; number < num_points; number++){
+ *cPtr++ = (*aPtr++) * (*bPtr++);
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+#ifdef LV_HAVE_ORC
+/*!
+ \brief Multiplys the two input vectors and store their results in the third vector
+ \param cVector The vector where the results will be stored
+ \param aVector One of the vectors to be multiplied
+ \param bVector One of the vectors to be multiplied
+ \param num_points The number of values in aVector and bVector to be multiplied together and stored into cVector
+*/
+extern void volk_32f_x2_multiply_32f_a_orc_impl(float* cVector, const float* aVector, const float* bVector, unsigned int num_points);
+static inline void volk_32f_x2_multiply_32f_a_orc(float* cVector, const float* aVector, const float* bVector, unsigned int num_points){
+ volk_32f_x2_multiply_32f_a_orc_impl(cVector, aVector, bVector, num_points);
+}
+#endif /* LV_HAVE_ORC */
+
+
+#endif /* INCLUDED_volk_32f_x2_multiply_32f_a_H */
diff --git a/volk/include/volk/volk_32f_x2_multiply_32f_u.h b/volk/include/volk/volk_32f_x2_multiply_32f_u.h
new file mode 100644
index 000000000..bfb896d60
--- /dev/null
+++ b/volk/include/volk/volk_32f_x2_multiply_32f_u.h
@@ -0,0 +1,106 @@
+#ifndef INCLUDED_volk_32f_x2_multiply_32f_u_H
+#define INCLUDED_volk_32f_x2_multiply_32f_u_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+/*!
+ \brief Multiplys the two input vectors and store their results in the third vector
+ \param cVector The vector where the results will be stored
+ \param aVector One of the vectors to be multiplied
+ \param bVector One of the vectors to be multiplied
+ \param num_points The number of values in aVector and bVector to be multiplied together and stored into cVector
+*/
+static inline void volk_32f_x2_multiply_32f_u_sse(float* cVector, const float* aVector, const float* bVector, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+
+ float* cPtr = cVector;
+ const float* aPtr = aVector;
+ const float* bPtr= bVector;
+
+ __m128 aVal, bVal, cVal;
+ for(;number < quarterPoints; number++){
+
+ aVal = _mm_loadu_ps(aPtr);
+ bVal = _mm_loadu_ps(bPtr);
+
+ cVal = _mm_mul_ps(aVal, bVal);
+
+ _mm_storeu_ps(cPtr,cVal); // Store the results back into the C container
+
+ aPtr += 4;
+ bPtr += 4;
+ cPtr += 4;
+ }
+
+ number = quarterPoints * 4;
+ for(;number < num_points; number++){
+ *cPtr++ = (*aPtr++) * (*bPtr++);
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_AVX
+#include <immintrin.h>
+/*!
+ \brief Multiplies the two input vectors and store their results in the third vector
+ \param cVector The vector where the results will be stored
+ \param aVector One of the vectors to be multiplied
+ \param bVector One of the vectors to be multiplied
+ \param num_points The number of values in aVector and bVector to be multiplied together and stored into cVector
+*/
+static inline void volk_32f_x2_multiply_32f_u_avx(float* cVector, const float* aVector, const float* bVector, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int eighthPoints = num_points / 8;
+
+ float* cPtr = cVector;
+ const float* aPtr = aVector;
+ const float* bPtr= bVector;
+
+ __m256 aVal, bVal, cVal;
+ for(;number < eighthPoints; number++){
+
+ aVal = _mm256_loadu_ps(aPtr);
+ bVal = _mm256_loadu_ps(bPtr);
+
+ cVal = _mm256_mul_ps(aVal, bVal);
+
+ _mm256_storeu_ps(cPtr,cVal); // Store the results back into the C container
+
+ aPtr += 8;
+ bPtr += 8;
+ cPtr += 8;
+ }
+
+ number = eighthPoints * 8;
+ for(;number < num_points; number++){
+ *cPtr++ = (*aPtr++) * (*bPtr++);
+ }
+}
+#endif /* LV_HAVE_AVX */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Multiplys the two input vectors and store their results in the third vector
+ \param cVector The vector where the results will be stored
+ \param aVector One of the vectors to be multiplied
+ \param bVector One of the vectors to be multiplied
+ \param num_points The number of values in aVector and bVector to be multiplied together and stored into cVector
+*/
+static inline void volk_32f_x2_multiply_32f_u_generic(float* cVector, const float* aVector, const float* bVector, unsigned int num_points){
+ float* cPtr = cVector;
+ const float* aPtr = aVector;
+ const float* bPtr= bVector;
+ unsigned int number = 0;
+
+ for(number = 0; number < num_points; number++){
+ *cPtr++ = (*aPtr++) * (*bPtr++);
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+#endif /* INCLUDED_volk_32f_x2_multiply_32f_u_H */
diff --git a/volk/include/volk/volk_32f_x2_s32f_interleave_16ic_a.h b/volk/include/volk/volk_32f_x2_s32f_interleave_16ic_a.h
new file mode 100644
index 000000000..10fc267dc
--- /dev/null
+++ b/volk/include/volk/volk_32f_x2_s32f_interleave_16ic_a.h
@@ -0,0 +1,156 @@
+#ifndef INCLUDED_volk_32f_x2_s32f_interleave_16ic_a_H
+#define INCLUDED_volk_32f_x2_s32f_interleave_16ic_a_H
+
+#include <volk/volk_common.h>
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE2
+#include <emmintrin.h>
+ /*!
+ \brief Interleaves the I & Q vector data into the complex vector, scales the output values by the scalar, and converts to 16 bit data.
+ \param iBuffer The I buffer data to be interleaved
+ \param qBuffer The Q buffer data to be interleaved
+ \param complexVector The complex output vector
+ \param scalar The scaling value being multiplied against each data point
+ \param num_points The number of complex data values to be interleaved
+ */
+static inline void volk_32f_x2_s32f_interleave_16ic_a_sse2(lv_16sc_t* complexVector, const float* iBuffer, const float* qBuffer, const float scalar, unsigned int num_points){
+ unsigned int number = 0;
+ const float* iBufferPtr = iBuffer;
+ const float* qBufferPtr = qBuffer;
+
+ __m128 vScalar = _mm_set_ps1(scalar);
+
+ const unsigned int quarterPoints = num_points / 4;
+
+ __m128 iValue, qValue, cplxValue1, cplxValue2;
+ __m128i intValue1, intValue2;
+
+ int16_t* complexVectorPtr = (int16_t*)complexVector;
+
+ for(;number < quarterPoints; number++){
+ iValue = _mm_load_ps(iBufferPtr);
+ qValue = _mm_load_ps(qBufferPtr);
+
+ // Interleaves the lower two values in the i and q variables into one buffer
+ cplxValue1 = _mm_unpacklo_ps(iValue, qValue);
+ cplxValue1 = _mm_mul_ps(cplxValue1, vScalar);
+
+ // Interleaves the upper two values in the i and q variables into one buffer
+ cplxValue2 = _mm_unpackhi_ps(iValue, qValue);
+ cplxValue2 = _mm_mul_ps(cplxValue2, vScalar);
+
+ intValue1 = _mm_cvtps_epi32(cplxValue1);
+ intValue2 = _mm_cvtps_epi32(cplxValue2);
+
+ intValue1 = _mm_packs_epi32(intValue1, intValue2);
+
+ _mm_store_si128((__m128i*)complexVectorPtr, intValue1);
+ complexVectorPtr += 8;
+
+ iBufferPtr += 4;
+ qBufferPtr += 4;
+ }
+
+ number = quarterPoints * 4;
+ complexVectorPtr = (int16_t*)(&complexVector[number]);
+ for(; number < num_points; number++){
+ *complexVectorPtr++ = (int16_t)(*iBufferPtr++ * scalar);
+ *complexVectorPtr++ = (int16_t)(*qBufferPtr++ * scalar);
+ }
+
+}
+#endif /* LV_HAVE_SSE2 */
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+ /*!
+ \brief Interleaves the I & Q vector data into the complex vector, scales the output values by the scalar, and converts to 16 bit data.
+ \param iBuffer The I buffer data to be interleaved
+ \param qBuffer The Q buffer data to be interleaved
+ \param complexVector The complex output vector
+ \param scalar The scaling value being multiplied against each data point
+ \param num_points The number of complex data values to be interleaved
+ */
+static inline void volk_32f_x2_s32f_interleave_16ic_a_sse(lv_16sc_t* complexVector, const float* iBuffer, const float* qBuffer, const float scalar, unsigned int num_points){
+ unsigned int number = 0;
+ const float* iBufferPtr = iBuffer;
+ const float* qBufferPtr = qBuffer;
+
+ __m128 vScalar = _mm_set_ps1(scalar);
+
+ const unsigned int quarterPoints = num_points / 4;
+
+ __m128 iValue, qValue, cplxValue;
+
+ int16_t* complexVectorPtr = (int16_t*)complexVector;
+
+ __VOLK_ATTR_ALIGNED(16) float floatBuffer[4];
+
+ for(;number < quarterPoints; number++){
+ iValue = _mm_load_ps(iBufferPtr);
+ qValue = _mm_load_ps(qBufferPtr);
+
+ // Interleaves the lower two values in the i and q variables into one buffer
+ cplxValue = _mm_unpacklo_ps(iValue, qValue);
+ cplxValue = _mm_mul_ps(cplxValue, vScalar);
+
+ _mm_store_ps(floatBuffer, cplxValue);
+
+ *complexVectorPtr++ = (int16_t)(floatBuffer[0]);
+ *complexVectorPtr++ = (int16_t)(floatBuffer[1]);
+ *complexVectorPtr++ = (int16_t)(floatBuffer[2]);
+ *complexVectorPtr++ = (int16_t)(floatBuffer[3]);
+
+ // Interleaves the upper two values in the i and q variables into one buffer
+ cplxValue = _mm_unpackhi_ps(iValue, qValue);
+ cplxValue = _mm_mul_ps(cplxValue, vScalar);
+
+ _mm_store_ps(floatBuffer, cplxValue);
+
+ *complexVectorPtr++ = (int16_t)(floatBuffer[0]);
+ *complexVectorPtr++ = (int16_t)(floatBuffer[1]);
+ *complexVectorPtr++ = (int16_t)(floatBuffer[2]);
+ *complexVectorPtr++ = (int16_t)(floatBuffer[3]);
+
+ iBufferPtr += 4;
+ qBufferPtr += 4;
+ }
+
+ number = quarterPoints * 4;
+ complexVectorPtr = (int16_t*)(&complexVector[number]);
+ for(; number < num_points; number++){
+ *complexVectorPtr++ = (int16_t)(*iBufferPtr++ * scalar);
+ *complexVectorPtr++ = (int16_t)(*qBufferPtr++ * scalar);
+ }
+
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+ /*!
+ \brief Interleaves the I & Q vector data into the complex vector, scales the output values by the scalar, and converts to 16 bit data.
+ \param iBuffer The I buffer data to be interleaved
+ \param qBuffer The Q buffer data to be interleaved
+ \param complexVector The complex output vector
+ \param scalar The scaling value being multiplied against each data point
+ \param num_points The number of complex data values to be interleaved
+ */
+static inline void volk_32f_x2_s32f_interleave_16ic_a_generic(lv_16sc_t* complexVector, const float* iBuffer, const float* qBuffer, const float scalar, unsigned int num_points){
+ int16_t* complexVectorPtr = (int16_t*)complexVector;
+ const float* iBufferPtr = iBuffer;
+ const float* qBufferPtr = qBuffer;
+ unsigned int number = 0;
+
+ for(number = 0; number < num_points; number++){
+ *complexVectorPtr++ = (int16_t)(*iBufferPtr++ * scalar);
+ *complexVectorPtr++ = (int16_t)(*qBufferPtr++ * scalar);
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_32f_x2_s32f_interleave_16ic_a_H */
diff --git a/volk/include/volk/volk_32f_x2_subtract_32f_a.h b/volk/include/volk/volk_32f_x2_subtract_32f_a.h
new file mode 100644
index 000000000..e2b8be797
--- /dev/null
+++ b/volk/include/volk/volk_32f_x2_subtract_32f_a.h
@@ -0,0 +1,81 @@
+#ifndef INCLUDED_volk_32f_x2_subtract_32f_a_H
+#define INCLUDED_volk_32f_x2_subtract_32f_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+/*!
+ \brief Subtracts bVector form aVector and store their results in the cVector
+ \param cVector The vector where the results will be stored
+ \param aVector The initial vector
+ \param bVector The vector to be subtracted
+ \param num_points The number of values in aVector and bVector to be subtracted together and stored into cVector
+*/
+static inline void volk_32f_x2_subtract_32f_a_sse(float* cVector, const float* aVector, const float* bVector, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+
+ float* cPtr = cVector;
+ const float* aPtr = aVector;
+ const float* bPtr= bVector;
+
+ __m128 aVal, bVal, cVal;
+ for(;number < quarterPoints; number++){
+
+ aVal = _mm_load_ps(aPtr);
+ bVal = _mm_load_ps(bPtr);
+
+ cVal = _mm_sub_ps(aVal, bVal);
+
+ _mm_store_ps(cPtr,cVal); // Store the results back into the C container
+
+ aPtr += 4;
+ bPtr += 4;
+ cPtr += 4;
+ }
+
+ number = quarterPoints * 4;
+ for(;number < num_points; number++){
+ *cPtr++ = (*aPtr++) - (*bPtr++);
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Subtracts bVector form aVector and store their results in the cVector
+ \param cVector The vector where the results will be stored
+ \param aVector The initial vector
+ \param bVector The vector to be subtracted
+ \param num_points The number of values in aVector and bVector to be subtracted together and stored into cVector
+*/
+static inline void volk_32f_x2_subtract_32f_a_generic(float* cVector, const float* aVector, const float* bVector, unsigned int num_points){
+ float* cPtr = cVector;
+ const float* aPtr = aVector;
+ const float* bPtr= bVector;
+ unsigned int number = 0;
+
+ for(number = 0; number < num_points; number++){
+ *cPtr++ = (*aPtr++) - (*bPtr++);
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+#ifdef LV_HAVE_ORC
+/*!
+ \brief Subtracts bVector form aVector and store their results in the cVector
+ \param cVector The vector where the results will be stored
+ \param aVector The initial vector
+ \param bVector The vector to be subtracted
+ \param num_points The number of values in aVector and bVector to be subtracted together and stored into cVector
+*/
+extern void volk_32f_x2_subtract_32f_a_orc_impl(float* cVector, const float* aVector, const float* bVector, unsigned int num_points);
+static inline void volk_32f_x2_subtract_32f_a_orc(float* cVector, const float* aVector, const float* bVector, unsigned int num_points){
+ volk_32f_x2_subtract_32f_a_orc_impl(cVector, aVector, bVector, num_points);
+}
+#endif /* LV_HAVE_ORC */
+
+
+#endif /* INCLUDED_volk_32f_x2_subtract_32f_a_H */
diff --git a/volk/include/volk/volk_32f_x3_sum_of_poly_32f_a.h b/volk/include/volk/volk_32f_x3_sum_of_poly_32f_a.h
new file mode 100644
index 000000000..3c530628c
--- /dev/null
+++ b/volk/include/volk/volk_32f_x3_sum_of_poly_32f_a.h
@@ -0,0 +1,151 @@
+#ifndef INCLUDED_volk_32f_x3_sum_of_poly_32f_a_H
+#define INCLUDED_volk_32f_x3_sum_of_poly_32f_a_H
+
+#include<inttypes.h>
+#include<stdio.h>
+#include<volk/volk_complex.h>
+
+#ifndef MAX
+#define MAX(X,Y) ((X) > (Y)?(X):(Y))
+#endif
+
+#ifdef LV_HAVE_SSE3
+#include<xmmintrin.h>
+#include<pmmintrin.h>
+
+static inline void volk_32f_x3_sum_of_poly_32f_a_sse3(float* target, float* src0, float* center_point_array, float* cutoff, unsigned int num_bytes) {
+
+
+ float result = 0.0;
+ float fst = 0.0;
+ float sq = 0.0;
+ float thrd = 0.0;
+ float frth = 0.0;
+ //float fith = 0.0;
+
+
+
+ __m128 xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, xmm8, xmm9, xmm10;// xmm11, xmm12;
+
+ xmm9 = _mm_setzero_ps();
+ xmm1 = _mm_setzero_ps();
+
+ xmm0 = _mm_load1_ps(&center_point_array[0]);
+ xmm6 = _mm_load1_ps(&center_point_array[1]);
+ xmm7 = _mm_load1_ps(&center_point_array[2]);
+ xmm8 = _mm_load1_ps(&center_point_array[3]);
+ //xmm11 = _mm_load1_ps(&center_point_array[4]);
+ xmm10 = _mm_load1_ps(cutoff);
+
+ int bound = num_bytes >> 4;
+ int leftovers = (num_bytes >> 2) & 3;
+ int i = 0;
+
+ for(; i < bound; ++i) {
+ xmm2 = _mm_load_ps(src0);
+ xmm2 = _mm_max_ps(xmm10, xmm2);
+ xmm3 = _mm_mul_ps(xmm2, xmm2);
+ xmm4 = _mm_mul_ps(xmm2, xmm3);
+ xmm5 = _mm_mul_ps(xmm3, xmm3);
+ //xmm12 = _mm_mul_ps(xmm3, xmm4);
+
+ xmm2 = _mm_mul_ps(xmm2, xmm0);
+ xmm3 = _mm_mul_ps(xmm3, xmm6);
+ xmm4 = _mm_mul_ps(xmm4, xmm7);
+ xmm5 = _mm_mul_ps(xmm5, xmm8);
+ //xmm12 = _mm_mul_ps(xmm12, xmm11);
+
+ xmm2 = _mm_add_ps(xmm2, xmm3);
+ xmm3 = _mm_add_ps(xmm4, xmm5);
+
+ src0 += 4;
+
+ xmm9 = _mm_add_ps(xmm2, xmm9);
+
+ xmm1 = _mm_add_ps(xmm3, xmm1);
+
+ //xmm9 = _mm_add_ps(xmm12, xmm9);
+ }
+
+ xmm2 = _mm_hadd_ps(xmm9, xmm1);
+ xmm3 = _mm_hadd_ps(xmm2, xmm2);
+ xmm4 = _mm_hadd_ps(xmm3, xmm3);
+
+ _mm_store_ss(&result, xmm4);
+
+
+
+ for(i = 0; i < leftovers; ++i) {
+ fst = src0[i];
+ fst = MAX(fst, *cutoff);
+ sq = fst * fst;
+ thrd = fst * sq;
+ frth = sq * sq;
+ //fith = sq * thrd;
+
+ result += (center_point_array[0] * fst +
+ center_point_array[1] * sq +
+ center_point_array[2] * thrd +
+ center_point_array[3] * frth);// +
+ //center_point_array[4] * fith);
+ }
+
+ result += ((float)((bound * 4) + leftovers)) * center_point_array[4]; //center_point_array[5];
+
+ target[0] = result;
+}
+
+
+#endif /*LV_HAVE_SSE3*/
+
+#ifdef LV_HAVE_GENERIC
+
+static inline void volk_32f_x3_sum_of_poly_32f_a_generic(float* target, float* src0, float* center_point_array, float* cutoff, unsigned int num_bytes) {
+
+
+
+ float result = 0.0;
+ float fst = 0.0;
+ float sq = 0.0;
+ float thrd = 0.0;
+ float frth = 0.0;
+ //float fith = 0.0;
+
+
+
+ unsigned int i = 0;
+
+ for(; i < num_bytes >> 2; ++i) {
+ fst = src0[i];
+ fst = MAX(fst, *cutoff);
+
+ sq = fst * fst;
+ thrd = fst * sq;
+ frth = sq * sq;
+ //fith = sq * thrd;
+
+ result += (center_point_array[0] * fst +
+ center_point_array[1] * sq +
+ center_point_array[2] * thrd +
+ center_point_array[3] * frth); //+
+ //center_point_array[4] * fith);
+ /*printf("%f12...%d\n", (center_point_array[0] * fst +
+ center_point_array[1] * sq +
+ center_point_array[2] * thrd +
+ center_point_array[3] * frth) +
+ //center_point_array[4] * fith) +
+ (center_point_array[4]), i);
+ */
+ }
+
+ result += ((float)(num_bytes >> 2)) * (center_point_array[4]);//(center_point_array[5]);
+
+
+
+ *target = result;
+}
+
+#endif /*LV_HAVE_GENERIC*/
+
+
+#endif /*INCLUDED_volk_32f_x3_sum_of_poly_32f_a_H*/
diff --git a/volk/include/volk/volk_32fc_32f_dot_prod_32fc_a.h b/volk/include/volk/volk_32fc_32f_dot_prod_32fc_a.h
new file mode 100644
index 000000000..109b787e8
--- /dev/null
+++ b/volk/include/volk/volk_32fc_32f_dot_prod_32fc_a.h
@@ -0,0 +1,111 @@
+#ifndef INCLUDED_volk_32fc_32f_dot_prod_32fc_a_H
+#define INCLUDED_volk_32fc_32f_dot_prod_32fc_a_H
+
+#include <volk/volk_common.h>
+#include<stdio.h>
+
+
+#ifdef LV_HAVE_GENERIC
+
+
+static inline void volk_32fc_32f_dot_prod_32fc_a_generic(lv_32fc_t* result, const lv_32fc_t* input, const float * taps, unsigned int num_points) {
+
+ float res[2];
+ float *realpt = &res[0], *imagpt = &res[1];
+ const float* aPtr = (float*)input;
+ const float* bPtr= taps;
+ unsigned int number = 0;
+
+ *realpt = 0;
+ *imagpt = 0;
+
+ for(number = 0; number < num_points; number++){
+ *realpt += ((*aPtr++) * (*bPtr));
+ *imagpt += ((*aPtr++) * (*bPtr++));
+ }
+
+ *result = *(lv_32fc_t*)(&res[0]);
+}
+
+#endif /*LV_HAVE_GENERIC*/
+
+
+#ifdef LV_HAVE_SSE
+
+
+static inline void volk_32fc_32f_dot_prod_32fc_a_sse( lv_32fc_t* result, const lv_32fc_t* input, const float* taps, unsigned int num_points) {
+
+ unsigned int number = 0;
+ const unsigned int sixteenthPoints = num_points / 8;
+
+ float res[2];
+ float *realpt = &res[0], *imagpt = &res[1];
+ const float* aPtr = (float*)input;
+ const float* bPtr = taps;
+
+ __m128 a0Val, a1Val, a2Val, a3Val;
+ __m128 b0Val, b1Val, b2Val, b3Val;
+ __m128 x0Val, x1Val, x2Val, x3Val;
+ __m128 c0Val, c1Val, c2Val, c3Val;
+
+ __m128 dotProdVal0 = _mm_setzero_ps();
+ __m128 dotProdVal1 = _mm_setzero_ps();
+ __m128 dotProdVal2 = _mm_setzero_ps();
+ __m128 dotProdVal3 = _mm_setzero_ps();
+
+ for(;number < sixteenthPoints; number++){
+
+ a0Val = _mm_load_ps(aPtr);
+ a1Val = _mm_load_ps(aPtr+4);
+ a2Val = _mm_load_ps(aPtr+8);
+ a3Val = _mm_load_ps(aPtr+12);
+
+ x0Val = _mm_load_ps(bPtr);
+ x1Val = _mm_load_ps(bPtr);
+ x2Val = _mm_load_ps(bPtr+4);
+ x3Val = _mm_load_ps(bPtr+4);
+ b0Val = _mm_unpacklo_ps(x0Val, x1Val);
+ b1Val = _mm_unpackhi_ps(x0Val, x1Val);
+ b2Val = _mm_unpacklo_ps(x2Val, x3Val);
+ b3Val = _mm_unpackhi_ps(x2Val, x3Val);
+
+ c0Val = _mm_mul_ps(a0Val, b0Val);
+ c1Val = _mm_mul_ps(a1Val, b1Val);
+ c2Val = _mm_mul_ps(a2Val, b2Val);
+ c3Val = _mm_mul_ps(a3Val, b3Val);
+
+ dotProdVal0 = _mm_add_ps(c0Val, dotProdVal0);
+ dotProdVal1 = _mm_add_ps(c1Val, dotProdVal1);
+ dotProdVal2 = _mm_add_ps(c2Val, dotProdVal2);
+ dotProdVal3 = _mm_add_ps(c3Val, dotProdVal3);
+
+ aPtr += 16;
+ bPtr += 8;
+ }
+
+ dotProdVal0 = _mm_add_ps(dotProdVal0, dotProdVal1);
+ dotProdVal0 = _mm_add_ps(dotProdVal0, dotProdVal2);
+ dotProdVal0 = _mm_add_ps(dotProdVal0, dotProdVal3);
+
+ __VOLK_ATTR_ALIGNED(16) float dotProductVector[4];
+
+ _mm_store_ps(dotProductVector,dotProdVal0); // Store the results back into the dot product vector
+
+ *realpt = dotProductVector[0];
+ *imagpt = dotProductVector[1];
+ *realpt += dotProductVector[2];
+ *imagpt += dotProductVector[3];
+
+ number = sixteenthPoints*8;
+ for(;number < num_points; number++){
+ *realpt += ((*aPtr++) * (*bPtr));
+ *imagpt += ((*aPtr++) * (*bPtr++));
+ }
+
+ *result = *(lv_32fc_t*)(&res[0]);
+}
+
+#endif /*LV_HAVE_SSE*/
+
+
+#endif /*INCLUDED_volk_32fc_32f_dot_prod_32fc_a_H*/
diff --git a/volk/include/volk/volk_32fc_32f_multiply_32fc_a.h b/volk/include/volk/volk_32fc_32f_multiply_32fc_a.h
new file mode 100644
index 000000000..28d584bf2
--- /dev/null
+++ b/volk/include/volk/volk_32fc_32f_multiply_32fc_a.h
@@ -0,0 +1,95 @@
+#ifndef INCLUDED_volk_32fc_32f_multiply_32fc_a_H
+#define INCLUDED_volk_32fc_32f_multiply_32fc_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+ /*!
+ \brief Multiplies the input complex vector with the input float vector and store their results in the third vector
+ \param cVector The vector where the results will be stored
+ \param aVector The complex vector to be multiplied
+ \param bVector The vectors containing the float values to be multiplied against each complex value in aVector
+ \param num_points The number of values in aVector and bVector to be multiplied together and stored into cVector
+ */
+static inline void volk_32fc_32f_multiply_32fc_a_sse(lv_32fc_t* cVector, const lv_32fc_t* aVector, const float* bVector, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+
+ lv_32fc_t* cPtr = cVector;
+ const lv_32fc_t* aPtr = aVector;
+ const float* bPtr= bVector;
+
+ __m128 aVal1, aVal2, bVal, bVal1, bVal2, cVal;
+ for(;number < quarterPoints; number++){
+
+ aVal1 = _mm_load_ps((const float*)aPtr);
+ aPtr += 2;
+
+ aVal2 = _mm_load_ps((const float*)aPtr);
+ aPtr += 2;
+
+ bVal = _mm_load_ps(bPtr);
+ bPtr += 4;
+
+ bVal1 = _mm_shuffle_ps(bVal, bVal, _MM_SHUFFLE(1,1,0,0));
+ bVal2 = _mm_shuffle_ps(bVal, bVal, _MM_SHUFFLE(3,3,2,2));
+
+ cVal = _mm_mul_ps(aVal1, bVal1);
+
+ _mm_store_ps((float*)cPtr,cVal); // Store the results back into the C container
+ cPtr += 2;
+
+ cVal = _mm_mul_ps(aVal2, bVal2);
+
+ _mm_store_ps((float*)cPtr,cVal); // Store the results back into the C container
+
+ cPtr += 2;
+ }
+
+ number = quarterPoints * 4;
+ for(;number < num_points; number++){
+ *cPtr++ = (*aPtr++) * (*bPtr);
+ bPtr++;
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+ /*!
+ \brief Multiplies the input complex vector with the input lv_32fc_t vector and store their results in the third vector
+ \param cVector The vector where the results will be stored
+ \param aVector The complex vector to be multiplied
+ \param bVector The vectors containing the lv_32fc_t values to be multiplied against each complex value in aVector
+ \param num_points The number of values in aVector and bVector to be multiplied together and stored into cVector
+ */
+static inline void volk_32fc_32f_multiply_32fc_a_generic(lv_32fc_t* cVector, const lv_32fc_t* aVector, const float* bVector, unsigned int num_points){
+ lv_32fc_t* cPtr = cVector;
+ const lv_32fc_t* aPtr = aVector;
+ const float* bPtr= bVector;
+ unsigned int number = 0;
+
+ for(number = 0; number < num_points; number++){
+ *cPtr++ = (*aPtr++) * (*bPtr++);
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+#ifdef LV_HAVE_ORC
+ /*!
+ \brief Multiplies the input complex vector with the input lv_32fc_t vector and store their results in the third vector
+ \param cVector The vector where the results will be stored
+ \param aVector The complex vector to be multiplied
+ \param bVector The vectors containing the lv_32fc_t values to be multiplied against each complex value in aVector
+ \param num_points The number of values in aVector and bVector to be multiplied together and stored into cVector
+ */
+extern void volk_32fc_32f_multiply_32fc_a_orc_impl(lv_32fc_t* cVector, const lv_32fc_t* aVector, const float* bVector, unsigned int num_points);
+static inline void volk_32fc_32f_multiply_32fc_a_orc(lv_32fc_t* cVector, const lv_32fc_t* aVector, const float* bVector, unsigned int num_points){
+ volk_32fc_32f_multiply_32fc_a_orc_impl(cVector, aVector, bVector, num_points);
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+#endif /* INCLUDED_volk_32fc_32f_multiply_32fc_a_H */
diff --git a/volk/include/volk/volk_32fc_conjugate_32fc_a.h b/volk/include/volk/volk_32fc_conjugate_32fc_a.h
new file mode 100644
index 000000000..919280d51
--- /dev/null
+++ b/volk/include/volk/volk_32fc_conjugate_32fc_a.h
@@ -0,0 +1,64 @@
+#ifndef INCLUDED_volk_32fc_conjugate_32fc_a_H
+#define INCLUDED_volk_32fc_conjugate_32fc_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+#include <volk/volk_complex.h>
+#include <float.h>
+
+#ifdef LV_HAVE_SSE3
+#include <pmmintrin.h>
+ /*!
+ \brief Takes the conjugate of a complex vector.
+ \param cVector The vector where the results will be stored
+ \param aVector Vector to be conjugated
+ \param num_points The number of complex values in aVector to be conjugated and stored into cVector
+ */
+static inline void volk_32fc_conjugate_32fc_a_sse3(lv_32fc_t* cVector, const lv_32fc_t* aVector, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int halfPoints = num_points / 2;
+
+ __m128 x;
+ lv_32fc_t* c = cVector;
+ const lv_32fc_t* a = aVector;
+
+ __m128 conjugator = _mm_setr_ps(0, -0.f, 0, -0.f);
+
+ for(;number < halfPoints; number++){
+
+ x = _mm_load_ps((float*)a); // Load the complex data as ar,ai,br,bi
+
+ x = _mm_xor_ps(x, conjugator); // conjugate register
+
+ _mm_store_ps((float*)c,x); // Store the results back into the C container
+
+ a += 2;
+ c += 2;
+ }
+
+ if((num_points % 2) != 0) {
+ *c = lv_conj(*a);
+ }
+}
+#endif /* LV_HAVE_SSE3 */
+
+#ifdef LV_HAVE_GENERIC
+ /*!
+ \brief Takes the conjugate of a complex vector.
+ \param cVector The vector where the results will be stored
+ \param aVector Vector to be conjugated
+ \param num_points The number of complex values in aVector to be conjugated and stored into cVector
+ */
+static inline void volk_32fc_conjugate_32fc_a_generic(lv_32fc_t* cVector, const lv_32fc_t* aVector, unsigned int num_points){
+ lv_32fc_t* cPtr = cVector;
+ const lv_32fc_t* aPtr = aVector;
+ unsigned int number = 0;
+
+ for(number = 0; number < num_points; number++){
+ *cPtr++ = lv_conj(*aPtr++);
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+#endif /* INCLUDED_volk_32fc_conjugate_32fc_a_H */
diff --git a/volk/include/volk/volk_32fc_conjugate_32fc_u.h b/volk/include/volk/volk_32fc_conjugate_32fc_u.h
new file mode 100644
index 000000000..e0d79ea7b
--- /dev/null
+++ b/volk/include/volk/volk_32fc_conjugate_32fc_u.h
@@ -0,0 +1,64 @@
+#ifndef INCLUDED_volk_32fc_conjugate_32fc_u_H
+#define INCLUDED_volk_32fc_conjugate_32fc_u_H
+
+#include <inttypes.h>
+#include <stdio.h>
+#include <volk/volk_complex.h>
+#include <float.h>
+
+#ifdef LV_HAVE_SSE3
+#include <pmmintrin.h>
+ /*!
+ \brief Takes the conjugate of a complex vector.
+ \param cVector The vector where the results will be stored
+ \param aVector Vector to be conjugated
+ \param num_points The number of complex values in aVector to be conjugated and stored into cVector
+ */
+static inline void volk_32fc_conjugate_32fc_u_sse3(lv_32fc_t* cVector, const lv_32fc_t* aVector, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int halfPoints = num_points / 2;
+
+ __m128 x;
+ lv_32fc_t* c = cVector;
+ const lv_32fc_t* a = aVector;
+
+ __m128 conjugator = _mm_setr_ps(0, -0.f, 0, -0.f);
+
+ for(;number < halfPoints; number++){
+
+ x = _mm_loadu_ps((float*)a); // Load the complex data as ar,ai,br,bi
+
+ x = _mm_xor_ps(x, conjugator); // conjugate register
+
+ _mm_storeu_ps((float*)c,x); // Store the results back into the C container
+
+ a += 2;
+ c += 2;
+ }
+
+ if((num_points % 2) != 0) {
+ *c = lv_conj(*a);
+ }
+}
+#endif /* LV_HAVE_SSE3 */
+
+#ifdef LV_HAVE_GENERIC
+ /*!
+ \brief Takes the conjugate of a complex vector.
+ \param cVector The vector where the results will be stored
+ \param aVector Vector to be conjugated
+ \param num_points The number of complex values in aVector to be conjugated and stored into cVector
+ */
+static inline void volk_32fc_conjugate_32fc_u_generic(lv_32fc_t* cVector, const lv_32fc_t* aVector, unsigned int num_points){
+ lv_32fc_t* cPtr = cVector;
+ const lv_32fc_t* aPtr = aVector;
+ unsigned int number = 0;
+
+ for(number = 0; number < num_points; number++){
+ *cPtr++ = lv_conj(*aPtr++);
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+#endif /* INCLUDED_volk_32fc_conjugate_32fc_u_H */
diff --git a/volk/include/volk/volk_32fc_deinterleave_32f_x2_a.h b/volk/include/volk/volk_32fc_deinterleave_32f_x2_a.h
new file mode 100644
index 000000000..4106f3851
--- /dev/null
+++ b/volk/include/volk/volk_32fc_deinterleave_32f_x2_a.h
@@ -0,0 +1,75 @@
+#ifndef INCLUDED_volk_32fc_deinterleave_32f_x2_a_H
+#define INCLUDED_volk_32fc_deinterleave_32f_x2_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+/*!
+ \brief Deinterleaves the complex vector into I & Q vector data
+ \param complexVector The complex input vector
+ \param iBuffer The I buffer output data
+ \param qBuffer The Q buffer output data
+ \param num_points The number of complex data values to be deinterleaved
+*/
+static inline void volk_32fc_deinterleave_32f_x2_a_sse(float* iBuffer, float* qBuffer, const lv_32fc_t* complexVector, unsigned int num_points){
+ const float* complexVectorPtr = (float*)complexVector;
+ float* iBufferPtr = iBuffer;
+ float* qBufferPtr = qBuffer;
+
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+ __m128 cplxValue1, cplxValue2, iValue, qValue;
+ for(;number < quarterPoints; number++){
+
+ cplxValue1 = _mm_load_ps(complexVectorPtr);
+ complexVectorPtr += 4;
+
+ cplxValue2 = _mm_load_ps(complexVectorPtr);
+ complexVectorPtr += 4;
+
+ // Arrange in i1i2i3i4 format
+ iValue = _mm_shuffle_ps(cplxValue1, cplxValue2, _MM_SHUFFLE(2,0,2,0));
+ // Arrange in q1q2q3q4 format
+ qValue = _mm_shuffle_ps(cplxValue1, cplxValue2, _MM_SHUFFLE(3,1,3,1));
+
+ _mm_store_ps(iBufferPtr, iValue);
+ _mm_store_ps(qBufferPtr, qValue);
+
+ iBufferPtr += 4;
+ qBufferPtr += 4;
+ }
+
+ number = quarterPoints * 4;
+ for(; number < num_points; number++){
+ *iBufferPtr++ = *complexVectorPtr++;
+ *qBufferPtr++ = *complexVectorPtr++;
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Deinterleaves the complex vector into I & Q vector data
+ \param complexVector The complex input vector
+ \param iBuffer The I buffer output data
+ \param qBuffer The Q buffer output data
+ \param num_points The number of complex data values to be deinterleaved
+*/
+static inline void volk_32fc_deinterleave_32f_x2_a_generic(float* iBuffer, float* qBuffer, const lv_32fc_t* complexVector, unsigned int num_points){
+ const float* complexVectorPtr = (float*)complexVector;
+ float* iBufferPtr = iBuffer;
+ float* qBufferPtr = qBuffer;
+ unsigned int number;
+ for(number = 0; number < num_points; number++){
+ *iBufferPtr++ = *complexVectorPtr++;
+ *qBufferPtr++ = *complexVectorPtr++;
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_32fc_deinterleave_32f_x2_a_H */
diff --git a/volk/include/volk/volk_32fc_deinterleave_64f_x2_a.h b/volk/include/volk/volk_32fc_deinterleave_64f_x2_a.h
new file mode 100644
index 000000000..77566e671
--- /dev/null
+++ b/volk/include/volk/volk_32fc_deinterleave_64f_x2_a.h
@@ -0,0 +1,78 @@
+#ifndef INCLUDED_volk_32fc_deinterleave_64f_x2_a_H
+#define INCLUDED_volk_32fc_deinterleave_64f_x2_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE2
+#include <emmintrin.h>
+/*!
+ \brief Deinterleaves the lv_32fc_t vector into double I & Q vector data
+ \param complexVector The complex input vector
+ \param iBuffer The I buffer output data
+ \param qBuffer The Q buffer output data
+ \param num_points The number of complex data values to be deinterleaved
+*/
+static inline void volk_32fc_deinterleave_64f_x2_a_sse2(double* iBuffer, double* qBuffer, const lv_32fc_t* complexVector, unsigned int num_points){
+ unsigned int number = 0;
+
+ const float* complexVectorPtr = (float*)complexVector;
+ double* iBufferPtr = iBuffer;
+ double* qBufferPtr = qBuffer;
+
+ const unsigned int halfPoints = num_points / 2;
+ __m128 cplxValue, fVal;
+ __m128d dVal;
+
+ for(;number < halfPoints; number++){
+
+ cplxValue = _mm_load_ps(complexVectorPtr);
+ complexVectorPtr += 4;
+
+ // Arrange in i1i2i1i2 format
+ fVal = _mm_shuffle_ps(cplxValue, cplxValue, _MM_SHUFFLE(2,0,2,0));
+ dVal = _mm_cvtps_pd(fVal);
+ _mm_store_pd(iBufferPtr, dVal);
+
+ // Arrange in q1q2q1q2 format
+ fVal = _mm_shuffle_ps(cplxValue, cplxValue, _MM_SHUFFLE(3,1,3,1));
+ dVal = _mm_cvtps_pd(fVal);
+ _mm_store_pd(qBufferPtr, dVal);
+
+ iBufferPtr += 2;
+ qBufferPtr += 2;
+ }
+
+ number = halfPoints * 2;
+ for(; number < num_points; number++){
+ *iBufferPtr++ = *complexVectorPtr++;
+ *qBufferPtr++ = *complexVectorPtr++;
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Deinterleaves the lv_32fc_t vector into double I & Q vector data
+ \param complexVector The complex input vector
+ \param iBuffer The I buffer output data
+ \param qBuffer The Q buffer output data
+ \param num_points The number of complex data values to be deinterleaved
+*/
+static inline void volk_32fc_deinterleave_64f_x2_a_generic(double* iBuffer, double* qBuffer, const lv_32fc_t* complexVector, unsigned int num_points){
+ unsigned int number = 0;
+ const float* complexVectorPtr = (float*)complexVector;
+ double* iBufferPtr = iBuffer;
+ double* qBufferPtr = qBuffer;
+
+ for(number = 0; number < num_points; number++){
+ *iBufferPtr++ = (double)*complexVectorPtr++;
+ *qBufferPtr++ = (double)*complexVectorPtr++;
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_32fc_deinterleave_64f_x2_a_H */
diff --git a/volk/include/volk/volk_32fc_deinterleave_imag_32f_a.h b/volk/include/volk/volk_32fc_deinterleave_imag_32f_a.h
new file mode 100644
index 000000000..c88809beb
--- /dev/null
+++ b/volk/include/volk/volk_32fc_deinterleave_imag_32f_a.h
@@ -0,0 +1,68 @@
+#ifndef INCLUDED_volk_32fc_deinterleave_imag_32f_a_H
+#define INCLUDED_volk_32fc_deinterleave_imag_32f_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+/*!
+ \brief Deinterleaves the complex vector into Q vector data
+ \param complexVector The complex input vector
+ \param qBuffer The Q buffer output data
+ \param num_points The number of complex data values to be deinterleaved
+*/
+static inline void volk_32fc_deinterleave_imag_32f_a_sse(float* qBuffer, const lv_32fc_t* complexVector, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+
+ const float* complexVectorPtr = (const float*)complexVector;
+ float* qBufferPtr = qBuffer;
+
+ __m128 cplxValue1, cplxValue2, iValue;
+ for(;number < quarterPoints; number++){
+
+ cplxValue1 = _mm_load_ps(complexVectorPtr);
+ complexVectorPtr += 4;
+
+ cplxValue2 = _mm_load_ps(complexVectorPtr);
+ complexVectorPtr += 4;
+
+ // Arrange in q1q2q3q4 format
+ iValue = _mm_shuffle_ps(cplxValue1, cplxValue2, _MM_SHUFFLE(3,1,3,1));
+
+ _mm_store_ps(qBufferPtr, iValue);
+
+ qBufferPtr += 4;
+ }
+
+ number = quarterPoints * 4;
+ for(; number < num_points; number++){
+ complexVectorPtr++;
+ *qBufferPtr++ = *complexVectorPtr++;
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Deinterleaves the complex vector into Q vector data
+ \param complexVector The complex input vector
+ \param qBuffer The I buffer output data
+ \param num_points The number of complex data values to be deinterleaved
+*/
+static inline void volk_32fc_deinterleave_imag_32f_a_generic(float* qBuffer, const lv_32fc_t* complexVector, unsigned int num_points){
+ unsigned int number = 0;
+ const float* complexVectorPtr = (float*)complexVector;
+ float* qBufferPtr = qBuffer;
+ for(number = 0; number < num_points; number++){
+ complexVectorPtr++;
+ *qBufferPtr++ = *complexVectorPtr++;
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_32fc_deinterleave_imag_32f_a_H */
diff --git a/volk/include/volk/volk_32fc_deinterleave_real_32f_a.h b/volk/include/volk/volk_32fc_deinterleave_real_32f_a.h
new file mode 100644
index 000000000..0d6c6b7af
--- /dev/null
+++ b/volk/include/volk/volk_32fc_deinterleave_real_32f_a.h
@@ -0,0 +1,68 @@
+#ifndef INCLUDED_volk_32fc_deinterleave_real_32f_a_H
+#define INCLUDED_volk_32fc_deinterleave_real_32f_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+/*!
+ \brief Deinterleaves the complex vector into I vector data
+ \param complexVector The complex input vector
+ \param iBuffer The I buffer output data
+ \param num_points The number of complex data values to be deinterleaved
+*/
+static inline void volk_32fc_deinterleave_real_32f_a_sse(float* iBuffer, const lv_32fc_t* complexVector, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+
+ const float* complexVectorPtr = (const float*)complexVector;
+ float* iBufferPtr = iBuffer;
+
+ __m128 cplxValue1, cplxValue2, iValue;
+ for(;number < quarterPoints; number++){
+
+ cplxValue1 = _mm_load_ps(complexVectorPtr);
+ complexVectorPtr += 4;
+
+ cplxValue2 = _mm_load_ps(complexVectorPtr);
+ complexVectorPtr += 4;
+
+ // Arrange in i1i2i3i4 format
+ iValue = _mm_shuffle_ps(cplxValue1, cplxValue2, _MM_SHUFFLE(2,0,2,0));
+
+ _mm_store_ps(iBufferPtr, iValue);
+
+ iBufferPtr += 4;
+ }
+
+ number = quarterPoints * 4;
+ for(; number < num_points; number++){
+ *iBufferPtr++ = *complexVectorPtr++;
+ complexVectorPtr++;
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Deinterleaves the complex vector into I vector data
+ \param complexVector The complex input vector
+ \param iBuffer The I buffer output data
+ \param num_points The number of complex data values to be deinterleaved
+*/
+static inline void volk_32fc_deinterleave_real_32f_a_generic(float* iBuffer, const lv_32fc_t* complexVector, unsigned int num_points){
+ unsigned int number = 0;
+ const float* complexVectorPtr = (float*)complexVector;
+ float* iBufferPtr = iBuffer;
+ for(number = 0; number < num_points; number++){
+ *iBufferPtr++ = *complexVectorPtr++;
+ complexVectorPtr++;
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_32fc_deinterleave_real_32f_a_H */
diff --git a/volk/include/volk/volk_32fc_deinterleave_real_64f_a.h b/volk/include/volk/volk_32fc_deinterleave_real_64f_a.h
new file mode 100644
index 000000000..1e346baca
--- /dev/null
+++ b/volk/include/volk/volk_32fc_deinterleave_real_64f_a.h
@@ -0,0 +1,66 @@
+#ifndef INCLUDED_volk_32fc_deinterleave_real_64f_a_H
+#define INCLUDED_volk_32fc_deinterleave_real_64f_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE2
+#include <emmintrin.h>
+/*!
+ \brief Deinterleaves the complex vector into I vector data
+ \param complexVector The complex input vector
+ \param iBuffer The I buffer output data
+ \param num_points The number of complex data values to be deinterleaved
+*/
+static inline void volk_32fc_deinterleave_real_64f_a_sse2(double* iBuffer, const lv_32fc_t* complexVector, unsigned int num_points){
+ unsigned int number = 0;
+
+ const float* complexVectorPtr = (float*)complexVector;
+ double* iBufferPtr = iBuffer;
+
+ const unsigned int halfPoints = num_points / 2;
+ __m128 cplxValue, fVal;
+ __m128d dVal;
+ for(;number < halfPoints; number++){
+
+ cplxValue = _mm_load_ps(complexVectorPtr);
+ complexVectorPtr += 4;
+
+ // Arrange in i1i2i1i2 format
+ fVal = _mm_shuffle_ps(cplxValue, cplxValue, _MM_SHUFFLE(2,0,2,0));
+ dVal = _mm_cvtps_pd(fVal);
+ _mm_store_pd(iBufferPtr, dVal);
+
+ iBufferPtr += 2;
+ }
+
+ number = halfPoints * 2;
+ for(; number < num_points; number++){
+ *iBufferPtr++ = (double)*complexVectorPtr++;
+ complexVectorPtr++;
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Deinterleaves the complex vector into I vector data
+ \param complexVector The complex input vector
+ \param iBuffer The I buffer output data
+ \param num_points The number of complex data values to be deinterleaved
+*/
+static inline void volk_32fc_deinterleave_real_64f_a_generic(double* iBuffer, const lv_32fc_t* complexVector, unsigned int num_points){
+ unsigned int number = 0;
+ const float* complexVectorPtr = (float*)complexVector;
+ double* iBufferPtr = iBuffer;
+ for(number = 0; number < num_points; number++){
+ *iBufferPtr++ = (double)*complexVectorPtr++;
+ complexVectorPtr++;
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_32fc_deinterleave_real_64f_a_H */
diff --git a/volk/include/volk/volk_32fc_index_max_16u_a.h b/volk/include/volk/volk_32fc_index_max_16u_a.h
new file mode 100644
index 000000000..842a6a042
--- /dev/null
+++ b/volk/include/volk/volk_32fc_index_max_16u_a.h
@@ -0,0 +1,215 @@
+#ifndef INCLUDED_volk_32fc_index_max_16u_a_H
+#define INCLUDED_volk_32fc_index_max_16u_a_H
+
+#include <volk/volk_common.h>
+#include<inttypes.h>
+#include<stdio.h>
+#include<volk/volk_complex.h>
+
+#ifdef LV_HAVE_SSE3
+#include<xmmintrin.h>
+#include<pmmintrin.h>
+
+
+static inline void volk_32fc_index_max_16u_a_sse3(unsigned int* target, lv_32fc_t* src0, unsigned int num_bytes) {
+
+
+
+ union bit128 holderf;
+ union bit128 holderi;
+ float sq_dist = 0.0;
+
+
+
+
+ union bit128 xmm5, xmm4;
+ __m128 xmm1, xmm2, xmm3;
+ __m128i xmm8, xmm11, xmm12, xmmfive, xmmfour, xmm9, holder0, holder1, xmm10;
+
+ xmm5.int_vec = xmmfive = _mm_setzero_si128();
+ xmm4.int_vec = xmmfour = _mm_setzero_si128();
+ holderf.int_vec = holder0 = _mm_setzero_si128();
+ holderi.int_vec = holder1 = _mm_setzero_si128();
+
+
+ int bound = num_bytes >> 5;
+ int leftovers0 = (num_bytes >> 4) & 1;
+ int leftovers1 = (num_bytes >> 3) & 1;
+ int i = 0;
+
+
+ xmm8 = _mm_set_epi32(3, 2, 1, 0);//remember the crazy reverse order!
+ xmm9 = xmm8 = _mm_setzero_si128();
+ xmm10 = _mm_set_epi32(4, 4, 4, 4);
+ xmm3 = _mm_setzero_ps();
+;
+
+ //printf("%f, %f, %f, %f\n", ((float*)&xmm10)[0], ((float*)&xmm10)[1], ((float*)&xmm10)[2], ((float*)&xmm10)[3]);
+
+ for(; i < bound; ++i) {
+
+ xmm1 = _mm_load_ps((float*)src0);
+ xmm2 = _mm_load_ps((float*)&src0[2]);
+
+
+ src0 += 4;
+
+
+ xmm1 = _mm_mul_ps(xmm1, xmm1);
+ xmm2 = _mm_mul_ps(xmm2, xmm2);
+
+
+ xmm1 = _mm_hadd_ps(xmm1, xmm2);
+
+ xmm3 = _mm_max_ps(xmm1, xmm3);
+
+ xmm4.float_vec = _mm_cmplt_ps(xmm1, xmm3);
+ xmm5.float_vec = _mm_cmpeq_ps(xmm1, xmm3);
+
+
+
+ xmm11 = _mm_and_si128(xmm8, xmm5.int_vec);
+ xmm12 = _mm_and_si128(xmm9, xmm4.int_vec);
+
+ xmm9 = _mm_add_epi32(xmm11, xmm12);
+
+ xmm8 = _mm_add_epi32(xmm8, xmm10);
+
+
+ //printf("%f, %f, %f, %f\n", ((float*)&xmm3)[0], ((float*)&xmm3)[1], ((float*)&xmm3)[2], ((float*)&xmm3)[3]);
+ //printf("%u, %u, %u, %u\n", ((uint32_t*)&xmm10)[0], ((uint32_t*)&xmm10)[1], ((uint32_t*)&xmm10)[2], ((uint32_t*)&xmm10)[3]);
+
+ }
+
+
+ for(i = 0; i < leftovers0; ++i) {
+
+
+ xmm2 = _mm_load_ps((float*)src0);
+
+ xmm1 = _mm_movelh_ps(bit128_p(&xmm8)->float_vec, bit128_p(&xmm8)->float_vec);
+ xmm8 = bit128_p(&xmm1)->int_vec;
+
+ xmm2 = _mm_mul_ps(xmm2, xmm2);
+
+ src0 += 2;
+
+ xmm1 = _mm_hadd_ps(xmm2, xmm2);
+
+ xmm3 = _mm_max_ps(xmm1, xmm3);
+
+ xmm10 = _mm_set_epi32(2, 2, 2, 2);//load1_ps((float*)&init[2]);
+
+
+ xmm4.float_vec = _mm_cmplt_ps(xmm1, xmm3);
+ xmm5.float_vec = _mm_cmpeq_ps(xmm1, xmm3);
+
+
+
+ xmm11 = _mm_and_si128(xmm8, xmm5.int_vec);
+ xmm12 = _mm_and_si128(xmm9, xmm4.int_vec);
+
+ xmm9 = _mm_add_epi32(xmm11, xmm12);
+
+ xmm8 = _mm_add_epi32(xmm8, xmm10);
+ //printf("egads%u, %u, %u, %u\n", ((uint32_t*)&xmm9)[0], ((uint32_t*)&xmm9)[1], ((uint32_t*)&xmm9)[2], ((uint32_t*)&xmm9)[3]);
+
+ }
+
+
+
+
+ for(i = 0; i < leftovers1; ++i) {
+ //printf("%u, %u, %u, %u\n", ((uint32_t*)&xmm9)[0], ((uint32_t*)&xmm9)[1], ((uint32_t*)&xmm9)[2], ((uint32_t*)&xmm9)[3]);
+
+
+ sq_dist = lv_creal(src0[0]) * lv_creal(src0[0]) + lv_cimag(src0[0]) * lv_cimag(src0[0]);
+
+ xmm2 = _mm_load1_ps(&sq_dist);
+
+ xmm1 = xmm3;
+
+ xmm3 = _mm_max_ss(xmm3, xmm2);
+
+
+
+ xmm4.float_vec = _mm_cmplt_ps(xmm1, xmm3);
+ xmm5.float_vec = _mm_cmpeq_ps(xmm1, xmm3);
+
+
+ xmm8 = _mm_shuffle_epi32(xmm8, 0x00);
+
+ xmm11 = _mm_and_si128(xmm8, xmm4.int_vec);
+ xmm12 = _mm_and_si128(xmm9, xmm5.int_vec);
+
+
+ xmm9 = _mm_add_epi32(xmm11, xmm12);
+
+ }
+
+ //printf("%f, %f, %f, %f\n", ((float*)&xmm3)[0], ((float*)&xmm3)[1], ((float*)&xmm3)[2], ((float*)&xmm3)[3]);
+
+ //printf("%u, %u, %u, %u\n", ((uint32_t*)&xmm9)[0], ((uint32_t*)&xmm9)[1], ((uint32_t*)&xmm9)[2], ((uint32_t*)&xmm9)[3]);
+
+ _mm_store_ps((float*)&(holderf.f), xmm3);
+ _mm_store_si128(&(holderi.int_vec), xmm9);
+
+ target[0] = holderi.i[0];
+ sq_dist = holderf.f[0];
+ target[0] = (holderf.f[1] > sq_dist) ? holderi.i[1] : target[0];
+ sq_dist = (holderf.f[1] > sq_dist) ? holderf.f[1] : sq_dist;
+ target[0] = (holderf.f[2] > sq_dist) ? holderi.i[2] : target[0];
+ sq_dist = (holderf.f[2] > sq_dist) ? holderf.f[2] : sq_dist;
+ target[0] = (holderf.f[3] > sq_dist) ? holderi.i[3] : target[0];
+ sq_dist = (holderf.f[3] > sq_dist) ? holderf.f[3] : sq_dist;
+
+
+
+ /*
+ float placeholder = 0.0;
+ uint32_t temp0, temp1;
+ unsigned int g0 = (((float*)&xmm3)[0] > ((float*)&xmm3)[1]);
+ unsigned int l0 = g0 ^ 1;
+
+ unsigned int g1 = (((float*)&xmm3)[1] > ((float*)&xmm3)[2]);
+ unsigned int l1 = g1 ^ 1;
+
+ temp0 = g0 * ((uint32_t*)&xmm9)[0] + l0 * ((uint32_t*)&xmm9)[1];
+ temp1 = g0 * ((uint32_t*)&xmm9)[2] + l0 * ((uint32_t*)&xmm9)[3];
+ sq_dist = g0 * ((float*)&xmm3)[0] + l0 * ((float*)&xmm3)[1];
+ placeholder = g0 * ((float*)&xmm3)[2] + l0 * ((float*)&xmm3)[3];
+
+ g0 = (sq_dist > placeholder);
+ l0 = g0 ^ 1;
+ target[0] = g0 * temp0 + l0 * temp1;
+ */
+
+}
+
+#endif /*LV_HAVE_SSE3*/
+
+#ifdef LV_HAVE_GENERIC
+static inline void volk_32fc_index_max_16u_a_generic(unsigned int* target, lv_32fc_t* src0, unsigned int num_bytes) {
+ float sq_dist = 0.0;
+ float max = 0.0;
+ unsigned int index = 0;
+
+ unsigned int i = 0;
+
+ for(; i < num_bytes >> 3; ++i) {
+
+ sq_dist = lv_creal(src0[i]) * lv_creal(src0[i]) + lv_cimag(src0[i]) * lv_cimag(src0[i]);
+
+ index = sq_dist > max ? i : index;
+ max = sq_dist > max ? sq_dist : max;
+
+
+ }
+ target[0] = index;
+
+}
+
+#endif /*LV_HAVE_GENERIC*/
+
+
+#endif /*INCLUDED_volk_32fc_index_max_16u_a_H*/
diff --git a/volk/include/volk/volk_32fc_magnitude_32f_a.h b/volk/include/volk/volk_32fc_magnitude_32f_a.h
new file mode 100644
index 000000000..efb84a904
--- /dev/null
+++ b/volk/include/volk/volk_32fc_magnitude_32f_a.h
@@ -0,0 +1,132 @@
+#ifndef INCLUDED_volk_32fc_magnitude_32f_a_H
+#define INCLUDED_volk_32fc_magnitude_32f_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+#include <math.h>
+
+#ifdef LV_HAVE_SSE3
+#include <pmmintrin.h>
+ /*!
+ \brief Calculates the magnitude of the complexVector and stores the results in the magnitudeVector
+ \param complexVector The vector containing the complex input values
+ \param magnitudeVector The vector containing the real output values
+ \param num_points The number of complex values in complexVector to be calculated and stored into cVector
+ */
+static inline void volk_32fc_magnitude_32f_a_sse3(float* magnitudeVector, const lv_32fc_t* complexVector, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+
+ const float* complexVectorPtr = (float*)complexVector;
+ float* magnitudeVectorPtr = magnitudeVector;
+
+ __m128 cplxValue1, cplxValue2, result;
+ for(;number < quarterPoints; number++){
+ cplxValue1 = _mm_load_ps(complexVectorPtr);
+ complexVectorPtr += 4;
+
+ cplxValue2 = _mm_load_ps(complexVectorPtr);
+ complexVectorPtr += 4;
+
+ cplxValue1 = _mm_mul_ps(cplxValue1, cplxValue1); // Square the values
+ cplxValue2 = _mm_mul_ps(cplxValue2, cplxValue2); // Square the Values
+
+ result = _mm_hadd_ps(cplxValue1, cplxValue2); // Add the I2 and Q2 values
+
+ result = _mm_sqrt_ps(result);
+
+ _mm_store_ps(magnitudeVectorPtr, result);
+ magnitudeVectorPtr += 4;
+ }
+
+ number = quarterPoints * 4;
+ for(; number < num_points; number++){
+ float val1Real = *complexVectorPtr++;
+ float val1Imag = *complexVectorPtr++;
+ *magnitudeVectorPtr++ = sqrtf((val1Real * val1Real) + (val1Imag * val1Imag));
+ }
+}
+#endif /* LV_HAVE_SSE3 */
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+ /*!
+ \brief Calculates the magnitude of the complexVector and stores the results in the magnitudeVector
+ \param complexVector The vector containing the complex input values
+ \param magnitudeVector The vector containing the real output values
+ \param num_points The number of complex values in complexVector to be calculated and stored into cVector
+ */
+static inline void volk_32fc_magnitude_32f_a_sse(float* magnitudeVector, const lv_32fc_t* complexVector, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+
+ const float* complexVectorPtr = (float*)complexVector;
+ float* magnitudeVectorPtr = magnitudeVector;
+
+ __m128 cplxValue1, cplxValue2, iValue, qValue, result;
+ for(;number < quarterPoints; number++){
+ cplxValue1 = _mm_load_ps(complexVectorPtr);
+ complexVectorPtr += 4;
+
+ cplxValue2 = _mm_load_ps(complexVectorPtr);
+ complexVectorPtr += 4;
+
+ // Arrange in i1i2i3i4 format
+ iValue = _mm_shuffle_ps(cplxValue1, cplxValue2, _MM_SHUFFLE(2,0,2,0));
+ // Arrange in q1q2q3q4 format
+ qValue = _mm_shuffle_ps(cplxValue1, cplxValue2, _MM_SHUFFLE(3,1,3,1));
+
+ iValue = _mm_mul_ps(iValue, iValue); // Square the I values
+ qValue = _mm_mul_ps(qValue, qValue); // Square the Q Values
+
+ result = _mm_add_ps(iValue, qValue); // Add the I2 and Q2 values
+
+ result = _mm_sqrt_ps(result);
+
+ _mm_store_ps(magnitudeVectorPtr, result);
+ magnitudeVectorPtr += 4;
+ }
+
+ number = quarterPoints * 4;
+ for(; number < num_points; number++){
+ float val1Real = *complexVectorPtr++;
+ float val1Imag = *complexVectorPtr++;
+ *magnitudeVectorPtr++ = sqrtf((val1Real * val1Real) + (val1Imag * val1Imag));
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+ /*!
+ \brief Calculates the magnitude of the complexVector and stores the results in the magnitudeVector
+ \param complexVector The vector containing the complex input values
+ \param magnitudeVector The vector containing the real output values
+ \param num_points The number of complex values in complexVector to be calculated and stored into cVector
+ */
+static inline void volk_32fc_magnitude_32f_a_generic(float* magnitudeVector, const lv_32fc_t* complexVector, unsigned int num_points){
+ const float* complexVectorPtr = (float*)complexVector;
+ float* magnitudeVectorPtr = magnitudeVector;
+ unsigned int number = 0;
+ for(number = 0; number < num_points; number++){
+ const float real = *complexVectorPtr++;
+ const float imag = *complexVectorPtr++;
+ *magnitudeVectorPtr++ = sqrtf((real*real) + (imag*imag));
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+#ifdef LV_HAVE_ORC
+ /*!
+ \brief Calculates the magnitude of the complexVector and stores the results in the magnitudeVector
+ \param complexVector The vector containing the complex input values
+ \param magnitudeVector The vector containing the real output values
+ \param num_points The number of complex values in complexVector to be calculated and stored into cVector
+ */
+extern void volk_32fc_magnitude_32f_a_orc_impl(float* magnitudeVector, const lv_32fc_t* complexVector, unsigned int num_points);
+static inline void volk_32fc_magnitude_32f_a_orc(float* magnitudeVector, const lv_32fc_t* complexVector, unsigned int num_points){
+ volk_32fc_magnitude_32f_a_orc_impl(magnitudeVector, complexVector, num_points);
+}
+#endif /* LV_HAVE_ORC */
+
+
+#endif /* INCLUDED_volk_32fc_magnitude_32f_a_H */
diff --git a/volk/include/volk/volk_32fc_magnitude_32f_u.h b/volk/include/volk/volk_32fc_magnitude_32f_u.h
new file mode 100644
index 000000000..c8b3f0a08
--- /dev/null
+++ b/volk/include/volk/volk_32fc_magnitude_32f_u.h
@@ -0,0 +1,118 @@
+#ifndef INCLUDED_volk_32fc_magnitude_32f_u_H
+#define INCLUDED_volk_32fc_magnitude_32f_u_H
+
+#include <inttypes.h>
+#include <stdio.h>
+#include <math.h>
+
+#ifdef LV_HAVE_SSE3
+#include <pmmintrin.h>
+ /*!
+ \brief Calculates the magnitude of the complexVector and stores the results in the magnitudeVector
+ \param complexVector The vector containing the complex input values
+ \param magnitudeVector The vector containing the real output values
+ \param num_points The number of complex values in complexVector to be calculated and stored into cVector
+ */
+static inline void volk_32fc_magnitude_32f_u_sse3(float* magnitudeVector, const lv_32fc_t* complexVector, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+
+ const float* complexVectorPtr = (float*)complexVector;
+ float* magnitudeVectorPtr = magnitudeVector;
+
+ __m128 cplxValue1, cplxValue2, result;
+ for(;number < quarterPoints; number++){
+ cplxValue1 = _mm_loadu_ps(complexVectorPtr);
+ complexVectorPtr += 4;
+
+ cplxValue2 = _mm_loadu_ps(complexVectorPtr);
+ complexVectorPtr += 4;
+
+ cplxValue1 = _mm_mul_ps(cplxValue1, cplxValue1); // Square the values
+ cplxValue2 = _mm_mul_ps(cplxValue2, cplxValue2); // Square the Values
+
+ result = _mm_hadd_ps(cplxValue1, cplxValue2); // Add the I2 and Q2 values
+
+ result = _mm_sqrt_ps(result);
+
+ _mm_storeu_ps(magnitudeVectorPtr, result);
+ magnitudeVectorPtr += 4;
+ }
+
+ number = quarterPoints * 4;
+ for(; number < num_points; number++){
+ float val1Real = *complexVectorPtr++;
+ float val1Imag = *complexVectorPtr++;
+ *magnitudeVectorPtr++ = sqrtf((val1Real * val1Real) + (val1Imag * val1Imag));
+ }
+}
+#endif /* LV_HAVE_SSE3 */
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+ /*!
+ \brief Calculates the magnitude of the complexVector and stores the results in the magnitudeVector
+ \param complexVector The vector containing the complex input values
+ \param magnitudeVector The vector containing the real output values
+ \param num_points The number of complex values in complexVector to be calculated and stored into cVector
+ */
+static inline void volk_32fc_magnitude_32f_u_sse(float* magnitudeVector, const lv_32fc_t* complexVector, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+
+ const float* complexVectorPtr = (float*)complexVector;
+ float* magnitudeVectorPtr = magnitudeVector;
+
+ __m128 cplxValue1, cplxValue2, iValue, qValue, result;
+ for(;number < quarterPoints; number++){
+ cplxValue1 = _mm_loadu_ps(complexVectorPtr);
+ complexVectorPtr += 4;
+
+ cplxValue2 = _mm_loadu_ps(complexVectorPtr);
+ complexVectorPtr += 4;
+
+ // Arrange in i1i2i3i4 format
+ iValue = _mm_shuffle_ps(cplxValue1, cplxValue2, _MM_SHUFFLE(2,0,2,0));
+ // Arrange in q1q2q3q4 format
+ qValue = _mm_shuffle_ps(cplxValue1, cplxValue2, _MM_SHUFFLE(3,1,3,1));
+
+ iValue = _mm_mul_ps(iValue, iValue); // Square the I values
+ qValue = _mm_mul_ps(qValue, qValue); // Square the Q Values
+
+ result = _mm_add_ps(iValue, qValue); // Add the I2 and Q2 values
+
+ result = _mm_sqrt_ps(result);
+
+ _mm_storeu_ps(magnitudeVectorPtr, result);
+ magnitudeVectorPtr += 4;
+ }
+
+ number = quarterPoints * 4;
+ for(; number < num_points; number++){
+ float val1Real = *complexVectorPtr++;
+ float val1Imag = *complexVectorPtr++;
+ *magnitudeVectorPtr++ = sqrtf((val1Real * val1Real) + (val1Imag * val1Imag));
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+ /*!
+ \brief Calculates the magnitude of the complexVector and stores the results in the magnitudeVector
+ \param complexVector The vector containing the complex input values
+ \param magnitudeVector The vector containing the real output values
+ \param num_points The number of complex values in complexVector to be calculated and stored into cVector
+ */
+static inline void volk_32fc_magnitude_32f_u_generic(float* magnitudeVector, const lv_32fc_t* complexVector, unsigned int num_points){
+ const float* complexVectorPtr = (float*)complexVector;
+ float* magnitudeVectorPtr = magnitudeVector;
+ unsigned int number = 0;
+ for(number = 0; number < num_points; number++){
+ const float real = *complexVectorPtr++;
+ const float imag = *complexVectorPtr++;
+ *magnitudeVectorPtr++ = sqrtf((real*real) + (imag*imag));
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+#endif /* INCLUDED_volk_32fc_magnitude_32f_u_H */
diff --git a/volk/include/volk/volk_32fc_magnitude_squared_32f_a.h b/volk/include/volk/volk_32fc_magnitude_squared_32f_a.h
new file mode 100644
index 000000000..d3ac9717a
--- /dev/null
+++ b/volk/include/volk/volk_32fc_magnitude_squared_32f_a.h
@@ -0,0 +1,114 @@
+#ifndef INCLUDED_volk_32fc_magnitude_squared_32f_a_H
+#define INCLUDED_volk_32fc_magnitude_squared_32f_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+#include <math.h>
+
+#ifdef LV_HAVE_SSE3
+#include <pmmintrin.h>
+ /*!
+ \brief Calculates the magnitude squared of the complexVector and stores the results in the magnitudeVector
+ \param complexVector The vector containing the complex input values
+ \param magnitudeVector The vector containing the real output values
+ \param num_points The number of complex values in complexVector to be calculated and stored into cVector
+ */
+static inline void volk_32fc_magnitude_squared_32f_a_sse3(float* magnitudeVector, const lv_32fc_t* complexVector, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+
+ const float* complexVectorPtr = (float*)complexVector;
+ float* magnitudeVectorPtr = magnitudeVector;
+
+ __m128 cplxValue1, cplxValue2, result;
+ for(;number < quarterPoints; number++){
+ cplxValue1 = _mm_load_ps(complexVectorPtr);
+ complexVectorPtr += 4;
+
+ cplxValue2 = _mm_load_ps(complexVectorPtr);
+ complexVectorPtr += 4;
+
+ cplxValue1 = _mm_mul_ps(cplxValue1, cplxValue1); // Square the values
+ cplxValue2 = _mm_mul_ps(cplxValue2, cplxValue2); // Square the Values
+
+ result = _mm_hadd_ps(cplxValue1, cplxValue2); // Add the I2 and Q2 values
+
+ _mm_store_ps(magnitudeVectorPtr, result);
+ magnitudeVectorPtr += 4;
+ }
+
+ number = quarterPoints * 4;
+ for(; number < num_points; number++){
+ float val1Real = *complexVectorPtr++;
+ float val1Imag = *complexVectorPtr++;
+ *magnitudeVectorPtr++ = (val1Real * val1Real) + (val1Imag * val1Imag);
+ }
+}
+#endif /* LV_HAVE_SSE3 */
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+ /*!
+ \brief Calculates the magnitude squared of the complexVector and stores the results in the magnitudeVector
+ \param complexVector The vector containing the complex input values
+ \param magnitudeVector The vector containing the real output values
+ \param num_points The number of complex values in complexVector to be calculated and stored into cVector
+ */
+static inline void volk_32fc_magnitude_squared_32f_a_sse(float* magnitudeVector, const lv_32fc_t* complexVector, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+
+ const float* complexVectorPtr = (float*)complexVector;
+ float* magnitudeVectorPtr = magnitudeVector;
+
+ __m128 cplxValue1, cplxValue2, iValue, qValue, result;
+ for(;number < quarterPoints; number++){
+ cplxValue1 = _mm_load_ps(complexVectorPtr);
+ complexVectorPtr += 4;
+
+ cplxValue2 = _mm_load_ps(complexVectorPtr);
+ complexVectorPtr += 4;
+
+ // Arrange in i1i2i3i4 format
+ iValue = _mm_shuffle_ps(cplxValue1, cplxValue2, _MM_SHUFFLE(2,0,2,0));
+ // Arrange in q1q2q3q4 format
+ qValue = _mm_shuffle_ps(cplxValue1, cplxValue2, _MM_SHUFFLE(3,1,3,1));
+
+ iValue = _mm_mul_ps(iValue, iValue); // Square the I values
+ qValue = _mm_mul_ps(qValue, qValue); // Square the Q Values
+
+ result = _mm_add_ps(iValue, qValue); // Add the I2 and Q2 values
+
+ _mm_store_ps(magnitudeVectorPtr, result);
+ magnitudeVectorPtr += 4;
+ }
+
+ number = quarterPoints * 4;
+ for(; number < num_points; number++){
+ float val1Real = *complexVectorPtr++;
+ float val1Imag = *complexVectorPtr++;
+ *magnitudeVectorPtr++ = (val1Real * val1Real) + (val1Imag * val1Imag);
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+ /*!
+ \brief Calculates the magnitude squared of the complexVector and stores the results in the magnitudeVector
+ \param complexVector The vector containing the complex input values
+ \param magnitudeVector The vector containing the real output values
+ \param num_points The number of complex values in complexVector to be calculated and stored into cVector
+ */
+static inline void volk_32fc_magnitude_squared_32f_a_generic(float* magnitudeVector, const lv_32fc_t* complexVector, unsigned int num_points){
+ const float* complexVectorPtr = (float*)complexVector;
+ float* magnitudeVectorPtr = magnitudeVector;
+ unsigned int number = 0;
+ for(number = 0; number < num_points; number++){
+ const float real = *complexVectorPtr++;
+ const float imag = *complexVectorPtr++;
+ *magnitudeVectorPtr++ = (real*real) + (imag*imag);
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+#endif /* INCLUDED_volk_32fc_magnitude_32f_a_H */
diff --git a/volk/include/volk/volk_32fc_magnitude_squared_32f_u.h b/volk/include/volk/volk_32fc_magnitude_squared_32f_u.h
new file mode 100644
index 000000000..53a4e68eb
--- /dev/null
+++ b/volk/include/volk/volk_32fc_magnitude_squared_32f_u.h
@@ -0,0 +1,114 @@
+#ifndef INCLUDED_volk_32fc_magnitude_squared_32f_u_H
+#define INCLUDED_volk_32fc_magnitude_squared_32f_u_H
+
+#include <inttypes.h>
+#include <stdio.h>
+#include <math.h>
+
+#ifdef LV_HAVE_SSE3
+#include <pmmintrin.h>
+ /*!
+ \brief Calculates the magnitude squared of the complexVector and stores the results in the magnitudeVector
+ \param complexVector The vector containing the complex input values
+ \param magnitudeVector The vector containing the real output values
+ \param num_points The number of complex values in complexVector to be calculated and stored into cVector
+ */
+static inline void volk_32fc_magnitude_squared_32f_u_sse3(float* magnitudeVector, const lv_32fc_t* complexVector, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+
+ const float* complexVectorPtr = (float*)complexVector;
+ float* magnitudeVectorPtr = magnitudeVector;
+
+ __m128 cplxValue1, cplxValue2, result;
+ for(;number < quarterPoints; number++){
+ cplxValue1 = _mm_loadu_ps(complexVectorPtr);
+ complexVectorPtr += 4;
+
+ cplxValue2 = _mm_loadu_ps(complexVectorPtr);
+ complexVectorPtr += 4;
+
+ cplxValue1 = _mm_mul_ps(cplxValue1, cplxValue1); // Square the values
+ cplxValue2 = _mm_mul_ps(cplxValue2, cplxValue2); // Square the Values
+
+ result = _mm_hadd_ps(cplxValue1, cplxValue2); // Add the I2 and Q2 values
+
+ _mm_storeu_ps(magnitudeVectorPtr, result);
+ magnitudeVectorPtr += 4;
+ }
+
+ number = quarterPoints * 4;
+ for(; number < num_points; number++){
+ float val1Real = *complexVectorPtr++;
+ float val1Imag = *complexVectorPtr++;
+ *magnitudeVectorPtr++ = (val1Real * val1Real) + (val1Imag * val1Imag);
+ }
+}
+#endif /* LV_HAVE_SSE3 */
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+ /*!
+ \brief Calculates the magnitude squared of the complexVector and stores the results in the magnitudeVector
+ \param complexVector The vector containing the complex input values
+ \param magnitudeVector The vector containing the real output values
+ \param num_points The number of complex values in complexVector to be calculated and stored into cVector
+ */
+static inline void volk_32fc_magnitude_squared_32f_u_sse(float* magnitudeVector, const lv_32fc_t* complexVector, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+
+ const float* complexVectorPtr = (float*)complexVector;
+ float* magnitudeVectorPtr = magnitudeVector;
+
+ __m128 cplxValue1, cplxValue2, iValue, qValue, result;
+ for(;number < quarterPoints; number++){
+ cplxValue1 = _mm_loadu_ps(complexVectorPtr);
+ complexVectorPtr += 4;
+
+ cplxValue2 = _mm_loadu_ps(complexVectorPtr);
+ complexVectorPtr += 4;
+
+ // Arrange in i1i2i3i4 format
+ iValue = _mm_shuffle_ps(cplxValue1, cplxValue2, _MM_SHUFFLE(2,0,2,0));
+ // Arrange in q1q2q3q4 format
+ qValue = _mm_shuffle_ps(cplxValue1, cplxValue2, _MM_SHUFFLE(3,1,3,1));
+
+ iValue = _mm_mul_ps(iValue, iValue); // Square the I values
+ qValue = _mm_mul_ps(qValue, qValue); // Square the Q Values
+
+ result = _mm_add_ps(iValue, qValue); // Add the I2 and Q2 values
+
+ _mm_storeu_ps(magnitudeVectorPtr, result);
+ magnitudeVectorPtr += 4;
+ }
+
+ number = quarterPoints * 4;
+ for(; number < num_points; number++){
+ float val1Real = *complexVectorPtr++;
+ float val1Imag = *complexVectorPtr++;
+ *magnitudeVectorPtr++ = (val1Real * val1Real) + (val1Imag * val1Imag);
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+ /*!
+ \brief Calculates the magnitude squared of the complexVector and stores the results in the magnitudeVector
+ \param complexVector The vector containing the complex input values
+ \param magnitudeVector The vector containing the real output values
+ \param num_points The number of complex values in complexVector to be calculated and stored into cVector
+ */
+static inline void volk_32fc_magnitude_squared_32f_u_generic(float* magnitudeVector, const lv_32fc_t* complexVector, unsigned int num_points){
+ const float* complexVectorPtr = (float*)complexVector;
+ float* magnitudeVectorPtr = magnitudeVector;
+ unsigned int number = 0;
+ for(number = 0; number < num_points; number++){
+ const float real = *complexVectorPtr++;
+ const float imag = *complexVectorPtr++;
+ *magnitudeVectorPtr++ = (real*real) + (imag*imag);
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+#endif /* INCLUDED_volk_32fc_magnitude_32f_u_H */
diff --git a/volk/include/volk/volk_32fc_s32f_atan2_32f_a.h b/volk/include/volk/volk_32fc_s32f_atan2_32f_a.h
new file mode 100644
index 000000000..d86bd63c1
--- /dev/null
+++ b/volk/include/volk/volk_32fc_s32f_atan2_32f_a.h
@@ -0,0 +1,158 @@
+#ifndef INCLUDED_volk_32fc_s32f_atan2_32f_a_H
+#define INCLUDED_volk_32fc_s32f_atan2_32f_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+#include <math.h>
+
+#ifdef LV_HAVE_SSE4_1
+#include <smmintrin.h>
+
+#ifdef LV_HAVE_LIB_SIMDMATH
+#include <simdmath.h>
+#endif /* LV_HAVE_LIB_SIMDMATH */
+
+/*!
+ \brief performs the atan2 on the input vector and stores the results in the output vector.
+ \param outputVector The byte-aligned vector where the results will be stored.
+ \param inputVector The byte-aligned input vector containing interleaved IQ data (I = cos, Q = sin).
+ \param normalizeFactor The atan2 results will be divided by this normalization factor.
+ \param num_points The number of complex values in the input vector.
+*/
+static inline void volk_32fc_s32f_atan2_32f_a_sse4_1(float* outputVector, const lv_32fc_t* complexVector, const float normalizeFactor, unsigned int num_points){
+ const float* complexVectorPtr = (float*)complexVector;
+ float* outPtr = outputVector;
+
+ unsigned int number = 0;
+ const float invNormalizeFactor = 1.0 / normalizeFactor;
+
+#ifdef LV_HAVE_LIB_SIMDMATH
+ const unsigned int quarterPoints = num_points / 4;
+ __m128 testVector = _mm_set_ps1(2*M_PI);
+ __m128 correctVector = _mm_set_ps1(M_PI);
+ __m128 vNormalizeFactor = _mm_set_ps1(invNormalizeFactor);
+ __m128 phase;
+ __m128 complex1, complex2, iValue, qValue;
+ __m128 keepMask;
+
+ for (; number < quarterPoints; number++) {
+ // Load IQ data:
+ complex1 = _mm_load_ps(complexVectorPtr);
+ complexVectorPtr += 4;
+ complex2 = _mm_load_ps(complexVectorPtr);
+ complexVectorPtr += 4;
+ // Deinterleave IQ data:
+ iValue = _mm_shuffle_ps(complex1, complex2, _MM_SHUFFLE(2,0,2,0));
+ qValue = _mm_shuffle_ps(complex1, complex2, _MM_SHUFFLE(3,1,3,1));
+ // Arctan to get phase:
+ phase = atan2f4(qValue, iValue);
+ // When Q = 0 and I < 0, atan2f4 sucks and returns 2pi vice pi.
+ // Compare to 2pi:
+ keepMask = _mm_cmpneq_ps(phase,testVector);
+ phase = _mm_blendv_ps(correctVector, phase, keepMask);
+ // done with above correction.
+ phase = _mm_mul_ps(phase, vNormalizeFactor);
+ _mm_store_ps((float*)outPtr, phase);
+ outPtr += 4;
+ }
+ number = quarterPoints * 4;
+#endif /* LV_HAVE_SIMDMATH_H */
+
+ for (; number < num_points; number++) {
+ const float real = *complexVectorPtr++;
+ const float imag = *complexVectorPtr++;
+ *outPtr++ = atan2f(imag, real) * invNormalizeFactor;
+ }
+}
+#endif /* LV_HAVE_SSE4_1 */
+
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+
+#ifdef LV_HAVE_LIB_SIMDMATH
+#include <simdmath.h>
+#endif /* LV_HAVE_LIB_SIMDMATH */
+
+/*!
+ \brief performs the atan2 on the input vector and stores the results in the output vector.
+ \param outputVector The byte-aligned vector where the results will be stored.
+ \param inputVector The byte-aligned input vector containing interleaved IQ data (I = cos, Q = sin).
+ \param normalizeFactor The atan2 results will be divided by this normalization factor.
+ \param num_points The number of complex values in the input vector.
+*/
+static inline void volk_32fc_s32f_atan2_32f_a_sse(float* outputVector, const lv_32fc_t* complexVector, const float normalizeFactor, unsigned int num_points){
+ const float* complexVectorPtr = (float*)complexVector;
+ float* outPtr = outputVector;
+
+ unsigned int number = 0;
+ const float invNormalizeFactor = 1.0 / normalizeFactor;
+
+#ifdef LV_HAVE_LIB_SIMDMATH
+ const unsigned int quarterPoints = num_points / 4;
+ __m128 testVector = _mm_set_ps1(2*M_PI);
+ __m128 correctVector = _mm_set_ps1(M_PI);
+ __m128 vNormalizeFactor = _mm_set_ps1(invNormalizeFactor);
+ __m128 phase;
+ __m128 complex1, complex2, iValue, qValue;
+ __m128 mask;
+ __m128 keepMask;
+
+ for (; number < quarterPoints; number++) {
+ // Load IQ data:
+ complex1 = _mm_load_ps(complexVectorPtr);
+ complexVectorPtr += 4;
+ complex2 = _mm_load_ps(complexVectorPtr);
+ complexVectorPtr += 4;
+ // Deinterleave IQ data:
+ iValue = _mm_shuffle_ps(complex1, complex2, _MM_SHUFFLE(2,0,2,0));
+ qValue = _mm_shuffle_ps(complex1, complex2, _MM_SHUFFLE(3,1,3,1));
+ // Arctan to get phase:
+ phase = atan2f4(qValue, iValue);
+ // When Q = 0 and I < 0, atan2f4 sucks and returns 2pi vice pi.
+ // Compare to 2pi:
+ keepMask = _mm_cmpneq_ps(phase,testVector);
+ phase = _mm_and_ps(phase, keepMask);
+ mask = _mm_andnot_ps(keepMask, correctVector);
+ phase = _mm_or_ps(phase, mask);
+ // done with above correction.
+ phase = _mm_mul_ps(phase, vNormalizeFactor);
+ _mm_store_ps((float*)outPtr, phase);
+ outPtr += 4;
+ }
+ number = quarterPoints * 4;
+#endif /* LV_HAVE_SIMDMATH_H */
+
+ for (; number < num_points; number++) {
+ const float real = *complexVectorPtr++;
+ const float imag = *complexVectorPtr++;
+ *outPtr++ = atan2f(imag, real) * invNormalizeFactor;
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief performs the atan2 on the input vector and stores the results in the output vector.
+ \param outputVector The vector where the results will be stored.
+ \param inputVector Input vector containing interleaved IQ data (I = cos, Q = sin).
+ \param normalizeFactor The atan2 results will be divided by this normalization factor.
+ \param num_points The number of complex values in the input vector.
+*/
+static inline void volk_32fc_s32f_atan2_32f_a_generic(float* outputVector, const lv_32fc_t* inputVector, const float normalizeFactor, unsigned int num_points){
+ float* outPtr = outputVector;
+ const float* inPtr = (float*)inputVector;
+ const float invNormalizeFactor = 1.0 / normalizeFactor;
+ unsigned int number;
+ for ( number = 0; number < num_points; number++) {
+ const float real = *inPtr++;
+ const float imag = *inPtr++;
+ *outPtr++ = atan2f(imag, real) * invNormalizeFactor;
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_32fc_s32f_atan2_32f_a_H */
diff --git a/volk/include/volk/volk_32fc_s32f_deinterleave_real_16i_a.h b/volk/include/volk/volk_32fc_s32f_deinterleave_real_16i_a.h
new file mode 100644
index 000000000..1c17fb70c
--- /dev/null
+++ b/volk/include/volk/volk_32fc_s32f_deinterleave_real_16i_a.h
@@ -0,0 +1,81 @@
+#ifndef INCLUDED_volk_32fc_s32f_deinterleave_real_16i_a_H
+#define INCLUDED_volk_32fc_s32f_deinterleave_real_16i_a_H
+
+#include <volk/volk_common.h>
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+/*!
+ \brief Deinterleaves the complex vector, multiply the value by the scalar, convert to 16t, and in I vector data
+ \param complexVector The complex input vector
+ \param scalar The value to be multiply against each of the input values
+ \param iBuffer The I buffer output data
+ \param num_points The number of complex data values to be deinterleaved
+*/
+static inline void volk_32fc_s32f_deinterleave_real_16i_a_sse(int16_t* iBuffer, const lv_32fc_t* complexVector, const float scalar, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+
+ const float* complexVectorPtr = (float*)complexVector;
+ int16_t* iBufferPtr = iBuffer;
+
+ __m128 vScalar = _mm_set_ps1(scalar);
+
+ __m128 cplxValue1, cplxValue2, iValue;
+
+ __VOLK_ATTR_ALIGNED(16) float floatBuffer[4];
+
+ for(;number < quarterPoints; number++){
+ cplxValue1 = _mm_load_ps(complexVectorPtr);
+ complexVectorPtr += 4;
+
+ cplxValue2 = _mm_load_ps(complexVectorPtr);
+ complexVectorPtr += 4;
+
+ // Arrange in i1i2i3i4 format
+ iValue = _mm_shuffle_ps(cplxValue1, cplxValue2, _MM_SHUFFLE(2,0,2,0));
+
+ iValue = _mm_mul_ps(iValue, vScalar);
+
+ _mm_store_ps(floatBuffer, iValue);
+ *iBufferPtr++ = (int16_t)(floatBuffer[0]);
+ *iBufferPtr++ = (int16_t)(floatBuffer[1]);
+ *iBufferPtr++ = (int16_t)(floatBuffer[2]);
+ *iBufferPtr++ = (int16_t)(floatBuffer[3]);
+ }
+
+ number = quarterPoints * 4;
+ iBufferPtr = &iBuffer[number];
+ for(; number < num_points; number++){
+ *iBufferPtr++ = (int16_t)(*complexVectorPtr++ * scalar);
+ complexVectorPtr++;
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Deinterleaves the complex vector, multiply the value by the scalar, convert to 16t, and in I vector data
+ \param complexVector The complex input vector
+ \param scalar The value to be multiply against each of the input values
+ \param iBuffer The I buffer output data
+ \param num_points The number of complex data values to be deinterleaved
+*/
+static inline void volk_32fc_s32f_deinterleave_real_16i_a_generic(int16_t* iBuffer, const lv_32fc_t* complexVector, const float scalar, unsigned int num_points){
+ const float* complexVectorPtr = (float*)complexVector;
+ int16_t* iBufferPtr = iBuffer;
+ unsigned int number = 0;
+ for(number = 0; number < num_points; number++){
+ *iBufferPtr++ = (int16_t)(*complexVectorPtr++ * scalar);
+ complexVectorPtr++;
+ }
+
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_32fc_s32f_deinterleave_real_16i_a_H */
diff --git a/volk/include/volk/volk_32fc_s32f_magnitude_16i_a.h b/volk/include/volk/volk_32fc_s32f_magnitude_16i_a.h
new file mode 100644
index 000000000..38fd609d3
--- /dev/null
+++ b/volk/include/volk/volk_32fc_s32f_magnitude_16i_a.h
@@ -0,0 +1,159 @@
+#ifndef INCLUDED_volk_32fc_s32f_magnitude_16i_a_H
+#define INCLUDED_volk_32fc_s32f_magnitude_16i_a_H
+
+#include <volk/volk_common.h>
+#include <inttypes.h>
+#include <stdio.h>
+#include <math.h>
+
+#ifdef LV_HAVE_SSE3
+#include <pmmintrin.h>
+/*!
+ \brief Calculates the magnitude of the complexVector, scales the resulting value and stores the results in the magnitudeVector
+ \param complexVector The vector containing the complex input values
+ \param scalar The scale value multiplied to the magnitude of each complex vector
+ \param magnitudeVector The vector containing the real output values
+ \param num_points The number of complex values in complexVector to be calculated and stored into cVector
+*/
+static inline void volk_32fc_s32f_magnitude_16i_a_sse3(int16_t* magnitudeVector, const lv_32fc_t* complexVector, const float scalar, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+
+ const float* complexVectorPtr = (const float*)complexVector;
+ int16_t* magnitudeVectorPtr = magnitudeVector;
+
+ __m128 vScalar = _mm_set_ps1(scalar);
+
+ __m128 cplxValue1, cplxValue2, result;
+
+ __VOLK_ATTR_ALIGNED(16) float floatBuffer[4];
+
+ for(;number < quarterPoints; number++){
+ cplxValue1 = _mm_load_ps(complexVectorPtr);
+ complexVectorPtr += 4;
+
+ cplxValue2 = _mm_load_ps(complexVectorPtr);
+ complexVectorPtr += 4;
+
+ cplxValue1 = _mm_mul_ps(cplxValue1, cplxValue1); // Square the values
+ cplxValue2 = _mm_mul_ps(cplxValue2, cplxValue2); // Square the Values
+
+ result = _mm_hadd_ps(cplxValue1, cplxValue2); // Add the I2 and Q2 values
+
+ result = _mm_sqrt_ps(result);
+
+ result = _mm_mul_ps(result, vScalar);
+
+ _mm_store_ps(floatBuffer, result);
+ *magnitudeVectorPtr++ = (int16_t)(floatBuffer[0]);
+ *magnitudeVectorPtr++ = (int16_t)(floatBuffer[1]);
+ *magnitudeVectorPtr++ = (int16_t)(floatBuffer[2]);
+ *magnitudeVectorPtr++ = (int16_t)(floatBuffer[3]);
+ }
+
+ number = quarterPoints * 4;
+ magnitudeVectorPtr = &magnitudeVector[number];
+ for(; number < num_points; number++){
+ float val1Real = *complexVectorPtr++;
+ float val1Imag = *complexVectorPtr++;
+ *magnitudeVectorPtr++ = (int16_t)(sqrtf((val1Real * val1Real) + (val1Imag * val1Imag)) * scalar);
+ }
+}
+#endif /* LV_HAVE_SSE3 */
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+/*!
+ \brief Calculates the magnitude of the complexVector, scales the resulting value and stores the results in the magnitudeVector
+ \param complexVector The vector containing the complex input values
+ \param scalar The scale value multiplied to the magnitude of each complex vector
+ \param magnitudeVector The vector containing the real output values
+ \param num_points The number of complex values in complexVector to be calculated and stored into cVector
+*/
+static inline void volk_32fc_s32f_magnitude_16i_a_sse(int16_t* magnitudeVector, const lv_32fc_t* complexVector, const float scalar, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+
+ const float* complexVectorPtr = (const float*)complexVector;
+ int16_t* magnitudeVectorPtr = magnitudeVector;
+
+ __m128 vScalar = _mm_set_ps1(scalar);
+
+ __m128 cplxValue1, cplxValue2, iValue, qValue, result;
+
+ __VOLK_ATTR_ALIGNED(16) float floatBuffer[4];
+
+ for(;number < quarterPoints; number++){
+ cplxValue1 = _mm_load_ps(complexVectorPtr);
+ complexVectorPtr += 4;
+
+ cplxValue2 = _mm_load_ps(complexVectorPtr);
+ complexVectorPtr += 4;
+
+ // Arrange in i1i2i3i4 format
+ iValue = _mm_shuffle_ps(cplxValue1, cplxValue2, _MM_SHUFFLE(2,0,2,0));
+ // Arrange in q1q2q3q4 format
+ qValue = _mm_shuffle_ps(cplxValue1, cplxValue2, _MM_SHUFFLE(3,1,3,1));
+
+ iValue = _mm_mul_ps(iValue, iValue); // Square the I values
+ qValue = _mm_mul_ps(qValue, qValue); // Square the Q Values
+
+ result = _mm_add_ps(iValue, qValue); // Add the I2 and Q2 values
+
+ result = _mm_sqrt_ps(result);
+
+ result = _mm_mul_ps(result, vScalar);
+
+ _mm_store_ps(floatBuffer, result);
+ *magnitudeVectorPtr++ = (int16_t)(floatBuffer[0]);
+ *magnitudeVectorPtr++ = (int16_t)(floatBuffer[1]);
+ *magnitudeVectorPtr++ = (int16_t)(floatBuffer[2]);
+ *magnitudeVectorPtr++ = (int16_t)(floatBuffer[3]);
+ }
+
+ number = quarterPoints * 4;
+ magnitudeVectorPtr = &magnitudeVector[number];
+ for(; number < num_points; number++){
+ float val1Real = *complexVectorPtr++;
+ float val1Imag = *complexVectorPtr++;
+ *magnitudeVectorPtr++ = (int16_t)(sqrtf((val1Real * val1Real) + (val1Imag * val1Imag)) * scalar);
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Calculates the magnitude of the complexVector, scales the resulting value and stores the results in the magnitudeVector
+ \param complexVector The vector containing the complex input values
+ \param scalar The scale value multiplied to the magnitude of each complex vector
+ \param magnitudeVector The vector containing the real output values
+ \param num_points The number of complex values in complexVector to be calculated and stored into cVector
+*/
+static inline void volk_32fc_s32f_magnitude_16i_a_generic(int16_t* magnitudeVector, const lv_32fc_t* complexVector, const float scalar, unsigned int num_points){
+ const float* complexVectorPtr = (float*)complexVector;
+ int16_t* magnitudeVectorPtr = magnitudeVector;
+ unsigned int number = 0;
+ for(number = 0; number < num_points; number++){
+ const float real = *complexVectorPtr++;
+ const float imag = *complexVectorPtr++;
+ *magnitudeVectorPtr++ = (int16_t)(sqrtf((real*real) + (imag*imag)) * scalar);
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+#ifdef LV_HAVE_ORC
+/*!
+ \brief Calculates the magnitude of the complexVector, scales the resulting value and stores the results in the magnitudeVector
+ \param complexVector The vector containing the complex input values
+ \param scalar The scale value multiplied to the magnitude of each complex vector
+ \param magnitudeVector The vector containing the real output values
+ \param num_points The number of complex values in complexVector to be calculated and stored into cVector
+*/
+extern void volk_32fc_s32f_magnitude_16i_a_orc_impl(int16_t* magnitudeVector, const lv_32fc_t* complexVector, const float scalar, unsigned int num_points);
+static inline void volk_32fc_s32f_magnitude_16i_a_orc(int16_t* magnitudeVector, const lv_32fc_t* complexVector, const float scalar, unsigned int num_points){
+ volk_32fc_s32f_magnitude_16i_a_orc_impl(magnitudeVector, complexVector, scalar, num_points);
+}
+#endif /* LV_HAVE_ORC */
+
+
+#endif /* INCLUDED_volk_32fc_s32f_magnitude_16i_a_H */
diff --git a/volk/include/volk/volk_32fc_s32f_power_32fc_a.h b/volk/include/volk/volk_32fc_s32f_power_32fc_a.h
new file mode 100644
index 000000000..3106edbef
--- /dev/null
+++ b/volk/include/volk/volk_32fc_s32f_power_32fc_a.h
@@ -0,0 +1,111 @@
+#ifndef INCLUDED_volk_32fc_s32f_power_32fc_a_H
+#define INCLUDED_volk_32fc_s32f_power_32fc_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+#include <math.h>
+
+//! raise a complex float to a real float power
+static inline lv_32fc_t __volk_s32fc_s32f_power_s32fc_a(const lv_32fc_t exp, const float power){
+ const float arg = power*atan2f(lv_creal(exp), lv_cimag(exp));
+ const float mag = powf(lv_creal(exp)*lv_creal(exp) + lv_cimag(exp)*lv_cimag(exp), power/2);
+ return mag*lv_cmake(cosf(arg), sinf(arg));
+}
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+
+#ifdef LV_HAVE_LIB_SIMDMATH
+#include <simdmath.h>
+#endif /* LV_HAVE_LIB_SIMDMATH */
+
+/*!
+ \brief Takes each the input complex vector value to the specified power and stores the results in the return vector
+ \param cVector The vector where the results will be stored
+ \param aVector The complex vector of values to be taken to a power
+ \param power The power value to be applied to each data point
+ \param num_points The number of values in aVector to be taken to the specified power level and stored into cVector
+*/
+static inline void volk_32fc_s32f_power_32fc_a_sse(lv_32fc_t* cVector, const lv_32fc_t* aVector, const float power, unsigned int num_points){
+ unsigned int number = 0;
+
+ lv_32fc_t* cPtr = cVector;
+ const lv_32fc_t* aPtr = aVector;
+
+#ifdef LV_HAVE_LIB_SIMDMATH
+ const unsigned int quarterPoints = num_points / 4;
+ __m128 vPower = _mm_set_ps1(power);
+
+ __m128 cplxValue1, cplxValue2, magnitude, phase, iValue, qValue;
+ for(;number < quarterPoints; number++){
+
+ cplxValue1 = _mm_load_ps((float*)aPtr);
+ aPtr += 2;
+
+ cplxValue2 = _mm_load_ps((float*)aPtr);
+ aPtr += 2;
+
+ // Convert to polar coordinates
+
+ // Arrange in i1i2i3i4 format
+ iValue = _mm_shuffle_ps(cplxValue1, cplxValue2, _MM_SHUFFLE(2,0,2,0));
+ // Arrange in q1q2q3q4 format
+ qValue = _mm_shuffle_ps(cplxValue1, cplxValue2, _MM_SHUFFLE(3,1,3,1));
+
+ phase = atan2f4(qValue, iValue); // Calculate the Phase
+
+ magnitude = _mm_sqrt_ps(_mm_add_ps(_mm_mul_ps(iValue, iValue), _mm_mul_ps(qValue, qValue))); // Calculate the magnitude by square rooting the added I2 and Q2 values
+
+ // Now calculate the power of the polar coordinate data
+ magnitude = powf4(magnitude, vPower); // Take the magnitude to the specified power
+
+ phase = _mm_mul_ps(phase, vPower); // Multiply the phase by the specified power
+
+ // Convert back to cartesian coordinates
+ iValue = _mm_mul_ps( cosf4(phase), magnitude); // Multiply the cos of the phase by the magnitude
+ qValue = _mm_mul_ps( sinf4(phase), magnitude); // Multiply the sin of the phase by the magnitude
+
+ cplxValue1 = _mm_unpacklo_ps(iValue, qValue); // Interleave the lower two i & q values
+ cplxValue2 = _mm_unpackhi_ps(iValue, qValue); // Interleave the upper two i & q values
+
+ _mm_store_ps((float*)cPtr,cplxValue1); // Store the results back into the C container
+
+ cPtr += 2;
+
+ _mm_store_ps((float*)cPtr,cplxValue2); // Store the results back into the C container
+
+ cPtr += 2;
+ }
+
+ number = quarterPoints * 4;
+#endif /* LV_HAVE_LIB_SIMDMATH */
+
+ for(;number < num_points; number++){
+ *cPtr++ = __volk_s32fc_s32f_power_s32fc_a((*aPtr++), power);
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+ /*!
+ \brief Takes each the input complex vector value to the specified power and stores the results in the return vector
+ \param cVector The vector where the results will be stored
+ \param aVector The complex vector of values to be taken to a power
+ \param power The power value to be applied to each data point
+ \param num_points The number of values in aVector to be taken to the specified power level and stored into cVector
+ */
+static inline void volk_32fc_s32f_power_32fc_a_generic(lv_32fc_t* cVector, const lv_32fc_t* aVector, const float power, unsigned int num_points){
+ lv_32fc_t* cPtr = cVector;
+ const lv_32fc_t* aPtr = aVector;
+ unsigned int number = 0;
+
+ for(number = 0; number < num_points; number++){
+ *cPtr++ = __volk_s32fc_s32f_power_s32fc_a((*aPtr++), power);
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_32fc_s32f_power_32fc_a_H */
diff --git a/volk/include/volk/volk_32fc_s32f_power_spectrum_32f_a.h b/volk/include/volk/volk_32fc_s32f_power_spectrum_32f_a.h
new file mode 100644
index 000000000..30a77dbc1
--- /dev/null
+++ b/volk/include/volk/volk_32fc_s32f_power_spectrum_32f_a.h
@@ -0,0 +1,126 @@
+#ifndef INCLUDED_volk_32fc_s32f_power_spectrum_32f_a_H
+#define INCLUDED_volk_32fc_s32f_power_spectrum_32f_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+#include <math.h>
+
+#ifdef LV_HAVE_SSE3
+#include <pmmintrin.h>
+
+#ifdef LV_HAVE_LIB_SIMDMATH
+#include <simdmath.h>
+#endif /* LV_HAVE_LIB_SIMDMATH */
+
+/*!
+ \brief Calculates the log10 power value for each input point
+ \param logPowerOutput The 10.0 * log10(r*r + i*i) for each data point
+ \param complexFFTInput The complex data output from the FFT point
+ \param normalizationFactor This value is divided against all the input values before the power is calculated
+ \param num_points The number of fft data points
+*/
+static inline void volk_32fc_s32f_power_spectrum_32f_a_sse3(float* logPowerOutput, const lv_32fc_t* complexFFTInput, const float normalizationFactor, unsigned int num_points){
+ const float* inputPtr = (const float*)complexFFTInput;
+ float* destPtr = logPowerOutput;
+ uint64_t number = 0;
+ const float iNormalizationFactor = 1.0 / normalizationFactor;
+#ifdef LV_HAVE_LIB_SIMDMATH
+ __m128 magScalar = _mm_set_ps1(10.0);
+ magScalar = _mm_div_ps(magScalar, logf4(magScalar));
+
+ __m128 invNormalizationFactor = _mm_set_ps1(iNormalizationFactor);
+
+ __m128 power;
+ __m128 input1, input2;
+ const uint64_t quarterPoints = num_points / 4;
+ for(;number < quarterPoints; number++){
+ // Load the complex values
+ input1 =_mm_load_ps(inputPtr);
+ inputPtr += 4;
+ input2 =_mm_load_ps(inputPtr);
+ inputPtr += 4;
+
+ // Apply the normalization factor
+ input1 = _mm_mul_ps(input1, invNormalizationFactor);
+ input2 = _mm_mul_ps(input2, invNormalizationFactor);
+
+ // Multiply each value by itself
+ // (r1*r1), (i1*i1), (r2*r2), (i2*i2)
+ input1 = _mm_mul_ps(input1, input1);
+ // (r3*r3), (i3*i3), (r4*r4), (i4*i4)
+ input2 = _mm_mul_ps(input2, input2);
+
+ // Horizontal add, to add (r*r) + (i*i) for each complex value
+ // (r1*r1)+(i1*i1), (r2*r2) + (i2*i2), (r3*r3)+(i3*i3), (r4*r4)+(i4*i4)
+ power = _mm_hadd_ps(input1, input2);
+
+ // Calculate the natural log power
+ power = logf4(power);
+
+ // Convert to log10 and multiply by 10.0
+ power = _mm_mul_ps(power, magScalar);
+
+ // Store the floating point results
+ _mm_store_ps(destPtr, power);
+
+ destPtr += 4;
+ }
+
+ number = quarterPoints*4;
+#endif /* LV_HAVE_LIB_SIMDMATH */
+ // Calculate the FFT for any remaining points
+
+ for(; number < num_points; number++){
+ // Calculate dBm
+ // 50 ohm load assumption
+ // 10 * log10 (v^2 / (2 * 50.0 * .001)) = 10 * log10( v^2 * 10)
+ // 75 ohm load assumption
+ // 10 * log10 (v^2 / (2 * 75.0 * .001)) = 10 * log10( v^2 * 15)
+
+ const float real = *inputPtr++ * iNormalizationFactor;
+ const float imag = *inputPtr++ * iNormalizationFactor;
+
+ *destPtr = 10.0*log10f(((real * real) + (imag * imag)) + 1e-20);
+
+ destPtr++;
+ }
+
+}
+#endif /* LV_HAVE_SSE3 */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Calculates the log10 power value for each input point
+ \param logPowerOutput The 10.0 * log10(r*r + i*i) for each data point
+ \param complexFFTInput The complex data output from the FFT point
+ \param normalizationFactor This value is divided agains all the input values before the power is calculated
+ \param num_points The number of fft data points
+*/
+static inline void volk_32fc_s32f_power_spectrum_32f_a_generic(float* logPowerOutput, const lv_32fc_t* complexFFTInput, const float normalizationFactor, unsigned int num_points){
+ // Calculate the Power of the complex point
+ const float* inputPtr = (float*)complexFFTInput;
+ float* realFFTDataPointsPtr = logPowerOutput;
+ const float iNormalizationFactor = 1.0 / normalizationFactor;
+ unsigned int point;
+ for(point = 0; point < num_points; point++){
+ // Calculate dBm
+ // 50 ohm load assumption
+ // 10 * log10 (v^2 / (2 * 50.0 * .001)) = 10 * log10( v^2 * 10)
+ // 75 ohm load assumption
+ // 10 * log10 (v^2 / (2 * 75.0 * .001)) = 10 * log10( v^2 * 15)
+
+ const float real = *inputPtr++ * iNormalizationFactor;
+ const float imag = *inputPtr++ * iNormalizationFactor;
+
+ *realFFTDataPointsPtr = 10.0*log10f(((real * real) + (imag * imag)) + 1e-20);
+
+
+ realFFTDataPointsPtr++;
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_32fc_s32f_power_spectrum_32f_a_H */
diff --git a/volk/include/volk/volk_32fc_s32f_x2_power_spectral_density_32f_a.h b/volk/include/volk/volk_32fc_s32f_x2_power_spectral_density_32f_a.h
new file mode 100644
index 000000000..27f755351
--- /dev/null
+++ b/volk/include/volk/volk_32fc_s32f_x2_power_spectral_density_32f_a.h
@@ -0,0 +1,134 @@
+#ifndef INCLUDED_volk_32fc_s32f_x2_power_spectral_density_32f_a_H
+#define INCLUDED_volk_32fc_s32f_x2_power_spectral_density_32f_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+#include <math.h>
+
+#ifdef LV_HAVE_SSE3
+#include <pmmintrin.h>
+
+#ifdef LV_HAVE_LIB_SIMDMATH
+#include <simdmath.h>
+#endif /* LV_HAVE_LIB_SIMDMATH */
+
+/*!
+ \brief Calculates the log10 power value divided by the RBW for each input point
+ \param logPowerOutput The 10.0 * log10((r*r + i*i)/RBW) for each data point
+ \param complexFFTInput The complex data output from the FFT point
+ \param normalizationFactor This value is divided against all the input values before the power is calculated
+ \param rbw The resolution bandwith of the fft spectrum
+ \param num_points The number of fft data points
+*/
+static inline void volk_32fc_s32f_x2_power_spectral_density_32f_a_sse3(float* logPowerOutput, const lv_32fc_t* complexFFTInput, const float normalizationFactor, const float rbw, unsigned int num_points){
+ const float* inputPtr = (const float*)complexFFTInput;
+ float* destPtr = logPowerOutput;
+ uint64_t number = 0;
+ const float iRBW = 1.0 / rbw;
+ const float iNormalizationFactor = 1.0 / normalizationFactor;
+
+#ifdef LV_HAVE_LIB_SIMDMATH
+ __m128 magScalar = _mm_set_ps1(10.0);
+ magScalar = _mm_div_ps(magScalar, logf4(magScalar));
+
+ __m128 invRBW = _mm_set_ps1(iRBW);
+
+ __m128 invNormalizationFactor = _mm_set_ps1(iNormalizationFactor);
+
+ __m128 power;
+ __m128 input1, input2;
+ const uint64_t quarterPoints = num_points / 4;
+ for(;number < quarterPoints; number++){
+ // Load the complex values
+ input1 =_mm_load_ps(inputPtr);
+ inputPtr += 4;
+ input2 =_mm_load_ps(inputPtr);
+ inputPtr += 4;
+
+ // Apply the normalization factor
+ input1 = _mm_mul_ps(input1, invNormalizationFactor);
+ input2 = _mm_mul_ps(input2, invNormalizationFactor);
+
+ // Multiply each value by itself
+ // (r1*r1), (i1*i1), (r2*r2), (i2*i2)
+ input1 = _mm_mul_ps(input1, input1);
+ // (r3*r3), (i3*i3), (r4*r4), (i4*i4)
+ input2 = _mm_mul_ps(input2, input2);
+
+ // Horizontal add, to add (r*r) + (i*i) for each complex value
+ // (r1*r1)+(i1*i1), (r2*r2) + (i2*i2), (r3*r3)+(i3*i3), (r4*r4)+(i4*i4)
+ power = _mm_hadd_ps(input1, input2);
+
+ // Divide by the rbw
+ power = _mm_mul_ps(power, invRBW);
+
+ // Calculate the natural log power
+ power = logf4(power);
+
+ // Convert to log10 and multiply by 10.0
+ power = _mm_mul_ps(power, magScalar);
+
+ // Store the floating point results
+ _mm_store_ps(destPtr, power);
+
+ destPtr += 4;
+ }
+
+ number = quarterPoints*4;
+#endif /* LV_HAVE_LIB_SIMDMATH */
+ // Calculate the FFT for any remaining points
+ for(; number < num_points; number++){
+ // Calculate dBm
+ // 50 ohm load assumption
+ // 10 * log10 (v^2 / (2 * 50.0 * .001)) = 10 * log10( v^2 * 10)
+ // 75 ohm load assumption
+ // 10 * log10 (v^2 / (2 * 75.0 * .001)) = 10 * log10( v^2 * 15)
+
+ const float real = *inputPtr++ * iNormalizationFactor;
+ const float imag = *inputPtr++ * iNormalizationFactor;
+
+ *destPtr = 10.0*log10f((((real * real) + (imag * imag)) + 1e-20) * iRBW);
+ destPtr++;
+ }
+
+}
+#endif /* LV_HAVE_SSE3 */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Calculates the log10 power value divided by the RBW for each input point
+ \param logPowerOutput The 10.0 * log10((r*r + i*i)/RBW) for each data point
+ \param complexFFTInput The complex data output from the FFT point
+ \param normalizationFactor This value is divided against all the input values before the power is calculated
+ \param rbw The resolution bandwith of the fft spectrum
+ \param num_points The number of fft data points
+*/
+static inline void volk_32fc_s32f_x2_power_spectral_density_32f_a_generic(float* logPowerOutput, const lv_32fc_t* complexFFTInput, const float normalizationFactor, const float rbw, unsigned int num_points){
+ // Calculate the Power of the complex point
+ const float* inputPtr = (float*)complexFFTInput;
+ float* realFFTDataPointsPtr = logPowerOutput;
+ unsigned int point;
+ const float invRBW = 1.0 / rbw;
+ const float iNormalizationFactor = 1.0 / normalizationFactor;
+
+ for(point = 0; point < num_points; point++){
+ // Calculate dBm
+ // 50 ohm load assumption
+ // 10 * log10 (v^2 / (2 * 50.0 * .001)) = 10 * log10( v^2 * 10)
+ // 75 ohm load assumption
+ // 10 * log10 (v^2 / (2 * 75.0 * .001)) = 10 * log10( v^2 * 15)
+
+ const float real = *inputPtr++ * iNormalizationFactor;
+ const float imag = *inputPtr++ * iNormalizationFactor;
+
+ *realFFTDataPointsPtr = 10.0*log10f((((real * real) + (imag * imag)) + 1e-20) * invRBW);
+
+ realFFTDataPointsPtr++;
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_32fc_s32f_x2_power_spectral_density_32f_a_H */
diff --git a/volk/include/volk/volk_32fc_s32fc_multiply_32fc_a.h b/volk/include/volk/volk_32fc_s32fc_multiply_32fc_a.h
new file mode 100644
index 000000000..f206c5e87
--- /dev/null
+++ b/volk/include/volk/volk_32fc_s32fc_multiply_32fc_a.h
@@ -0,0 +1,91 @@
+#ifndef INCLUDED_volk_32fc_s32fc_multiply_32fc_a_H
+#define INCLUDED_volk_32fc_s32fc_multiply_32fc_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+#include <volk/volk_complex.h>
+#include <float.h>
+
+#ifdef LV_HAVE_SSE3
+#include <pmmintrin.h>
+ /*!
+ \brief Multiplies the two input complex vectors and stores their results in the third vector
+ \param cVector The vector where the results will be stored
+ \param aVector One of the vectors to be multiplied
+ \param bVector One of the vectors to be multiplied
+ \param num_points The number of complex values in aVector and bVector to be multiplied together and stored into cVector
+ */
+static inline void volk_32fc_s32fc_multiply_32fc_a_sse3(lv_32fc_t* cVector, const lv_32fc_t* aVector, const lv_32fc_t scalar, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int halfPoints = num_points / 2;
+
+ __m128 x, yl, yh, z, tmp1, tmp2;
+ lv_32fc_t* c = cVector;
+ const lv_32fc_t* a = aVector;
+
+ // Set up constant scalar vector
+ yl = _mm_set_ps1(lv_creal(scalar));
+ yh = _mm_set_ps1(lv_cimag(scalar));
+
+ for(;number < halfPoints; number++){
+
+ x = _mm_load_ps((float*)a); // Load the ar + ai, br + bi as ar,ai,br,bi
+
+ tmp1 = _mm_mul_ps(x,yl); // tmp1 = ar*cr,ai*cr,br*dr,bi*dr
+
+ x = _mm_shuffle_ps(x,x,0xB1); // Re-arrange x to be ai,ar,bi,br
+
+ tmp2 = _mm_mul_ps(x,yh); // tmp2 = ai*ci,ar*ci,bi*di,br*di
+
+ z = _mm_addsub_ps(tmp1,tmp2); // ar*cr-ai*ci, ai*cr+ar*ci, br*dr-bi*di, bi*dr+br*di
+
+ _mm_store_ps((float*)c,z); // Store the results back into the C container
+
+ a += 2;
+ c += 2;
+ }
+
+ if((num_points % 2) != 0) {
+ *c = (*a) * scalar;
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+
+#ifdef LV_HAVE_GENERIC
+ /*!
+ \brief Multiplies the two input complex vectors and stores their results in the third vector
+ \param cVector The vector where the results will be stored
+ \param aVector One of the vectors to be multiplied
+ \param bVector One of the vectors to be multiplied
+ \param num_points The number of complex values in aVector and bVector to be multiplied together and stored into cVector
+ */
+static inline void volk_32fc_s32fc_multiply_32fc_a_generic(lv_32fc_t* cVector, const lv_32fc_t* aVector, const lv_32fc_t scalar, unsigned int num_points){
+ lv_32fc_t* cPtr = cVector;
+ const lv_32fc_t* aPtr = aVector;
+ unsigned int number = num_points;
+
+ // unwrap loop
+ while (number >= 8){
+ *cPtr++ = (*aPtr++) * scalar;
+ *cPtr++ = (*aPtr++) * scalar;
+ *cPtr++ = (*aPtr++) * scalar;
+ *cPtr++ = (*aPtr++) * scalar;
+ *cPtr++ = (*aPtr++) * scalar;
+ *cPtr++ = (*aPtr++) * scalar;
+ *cPtr++ = (*aPtr++) * scalar;
+ *cPtr++ = (*aPtr++) * scalar;
+ number -= 8;
+ }
+
+ // clean up any remaining
+ while (number-- > 0)
+ *cPtr++ = *aPtr++ * scalar;
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+
+#endif /* INCLUDED_volk_32fc_x2_multiply_32fc_a_H */
diff --git a/volk/include/volk/volk_32fc_s32fc_multiply_32fc_u.h b/volk/include/volk/volk_32fc_s32fc_multiply_32fc_u.h
new file mode 100644
index 000000000..5c7d15b02
--- /dev/null
+++ b/volk/include/volk/volk_32fc_s32fc_multiply_32fc_u.h
@@ -0,0 +1,87 @@
+#ifndef INCLUDED_volk_32fc_s32fc_multiply_32fc_u_H
+#define INCLUDED_volk_32fc_s32fc_multiply_32fc_u_H
+
+#include <inttypes.h>
+#include <stdio.h>
+#include <volk/volk_complex.h>
+#include <float.h>
+
+#ifdef LV_HAVE_SSE3
+#include <pmmintrin.h>
+/*!
+ \brief Multiplies the input vector by a scalar and stores the results in the third vector
+ \param cVector The vector where the results will be stored
+ \param aVector The vector to be multiplied
+ \param scalar The complex scalar to multiply aVector
+ \param num_points The number of complex values in aVector and bVector to be multiplied together and stored into cVector
+*/
+static inline void volk_32fc_s32fc_multiply_32fc_u_sse3(lv_32fc_t* cVector, const lv_32fc_t* aVector, const lv_32fc_t scalar, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int halfPoints = num_points / 2;
+
+ __m128 x, yl, yh, z, tmp1, tmp2;
+ lv_32fc_t* c = cVector;
+ const lv_32fc_t* a = aVector;
+
+ // Set up constant scalar vector
+ yl = _mm_set_ps1(lv_creal(scalar));
+ yh = _mm_set_ps1(lv_cimag(scalar));
+
+ for(;number < halfPoints; number++){
+
+ x = _mm_loadu_ps((float*)a); // Load the ar + ai, br + bi as ar,ai,br,bi
+
+ tmp1 = _mm_mul_ps(x,yl); // tmp1 = ar*cr,ai*cr,br*dr,bi*dr
+
+ x = _mm_shuffle_ps(x,x,0xB1); // Re-arrange x to be ai,ar,bi,br
+
+ tmp2 = _mm_mul_ps(x,yh); // tmp2 = ai*ci,ar*ci,bi*di,br*di
+
+ z = _mm_addsub_ps(tmp1,tmp2); // ar*cr-ai*ci, ai*cr+ar*ci, br*dr-bi*di, bi*dr+br*di
+
+ _mm_storeu_ps((float*)c,z); // Store the results back into the C container
+
+ a += 2;
+ c += 2;
+ }
+
+ if((num_points % 2) != 0) {
+ *c = (*a) * scalar;
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Multiplies the input vector by a scalar and stores the results in the third vector
+ \param cVector The vector where the results will be stored
+ \param aVector The vector to be multiplied
+ \param scalar The complex scalar to multiply aVector
+ \param num_points The number of complex values in aVector and bVector to be multiplied together and stored into cVector
+*/
+static inline void volk_32fc_s32fc_multiply_32fc_u_generic(lv_32fc_t* cVector, const lv_32fc_t* aVector, const lv_32fc_t scalar, unsigned int num_points){
+ lv_32fc_t* cPtr = cVector;
+ const lv_32fc_t* aPtr = aVector;
+ unsigned int number = num_points;
+
+ // unwrap loop
+ while (number >= 8){
+ *cPtr++ = (*aPtr++) * scalar;
+ *cPtr++ = (*aPtr++) * scalar;
+ *cPtr++ = (*aPtr++) * scalar;
+ *cPtr++ = (*aPtr++) * scalar;
+ *cPtr++ = (*aPtr++) * scalar;
+ *cPtr++ = (*aPtr++) * scalar;
+ *cPtr++ = (*aPtr++) * scalar;
+ *cPtr++ = (*aPtr++) * scalar;
+ number -= 8;
+ }
+
+ // clean up any remaining
+ while (number-- > 0)
+ *cPtr++ = *aPtr++ * scalar;
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+#endif /* INCLUDED_volk_32fc_x2_multiply_32fc_u_H */
diff --git a/volk/include/volk/volk_32fc_s32fc_rotatorpuppet_32fc_a.h b/volk/include/volk/volk_32fc_s32fc_rotatorpuppet_32fc_a.h
new file mode 100644
index 000000000..eee9f0064
--- /dev/null
+++ b/volk/include/volk/volk_32fc_s32fc_rotatorpuppet_32fc_a.h
@@ -0,0 +1,74 @@
+#ifndef INCLUDED_volk_32fc_s32fc_rotatorpuppet_32fc_a_H
+#define INCLUDED_volk_32fc_s32fc_rotatorpuppet_32fc_a_H
+
+
+#include <volk/volk_complex.h>
+#include <stdio.h>
+#include <volk/volk_32fc_s32fc_x2_rotator_32fc_a.h>
+
+
+#ifdef LV_HAVE_GENERIC
+
+/*!
+ \brief rotate input vector at fixed rate per sample from initial phase offset
+ \param outVector The vector where the results will be stored
+ \param inVector Vector to be rotated
+ \param phase_inc rotational velocity
+ \param phase initial phase offset
+ \param num_points The number of values in inVector to be rotated and stored into cVector
+*/
+
+
+static inline void volk_32fc_s32fc_rotatorpuppet_32fc_a_generic(lv_32fc_t* outVector, const lv_32fc_t* inVector, const lv_32fc_t phase_inc, unsigned int num_points){
+ lv_32fc_t phase[1] = {lv_cmake(.3, 0.95393)};
+ volk_32fc_s32fc_x2_rotator_32fc_a_generic(outVector, inVector, phase_inc, phase, num_points);
+
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+#ifdef LV_HAVE_SSE4_1
+#include <smmintrin.h>
+
+static inline void volk_32fc_s32fc_rotatorpuppet_32fc_a_sse4_1(lv_32fc_t* outVector, const lv_32fc_t* inVector, const lv_32fc_t phase_inc, unsigned int num_points){
+ lv_32fc_t phase[1] = {lv_cmake(.3, .95393)};
+ volk_32fc_s32fc_x2_rotator_32fc_a_sse4_1(outVector, inVector, phase_inc, phase, num_points);
+
+}
+
+
+
+
+#endif /* LV_HAVE_SSE4_1 */
+
+#ifdef LV_HAVE_AVX
+#include <immintrin.h>
+
+/*!
+ \brief rotate input vector at fixed rate per sample from initial phase offset
+ \param outVector The vector where the results will be stored
+ \param inVector Vector to be rotated
+ \param phase_inc rotational velocity
+ \param phase initial phase offset
+ \param num_points The number of values in inVector to be rotated and stored into cVector
+*/
+
+
+
+
+static inline void volk_32fc_s32fc_rotatorpuppet_32fc_a_avx(lv_32fc_t* outVector, const lv_32fc_t* inVector, const lv_32fc_t phase_inc, unsigned int num_points){
+ lv_32fc_t phase[1] = {lv_cmake(.3, .95393)};
+ volk_32fc_s32fc_x2_rotator_32fc_a_avx(outVector, inVector, phase_inc, phase, num_points);
+
+}
+
+#endif /* LV_HAVE_AVX */
+
+
+
+
+
+
+
+
+#endif /* INCLUDED_volk_32fc_s32fc_rotatorpuppet_32fc_a_H */
diff --git a/volk/include/volk/volk_32fc_s32fc_x2_rotator_32fc_a.h b/volk/include/volk/volk_32fc_s32fc_x2_rotator_32fc_a.h
new file mode 100644
index 000000000..51b6041ec
--- /dev/null
+++ b/volk/include/volk/volk_32fc_s32fc_x2_rotator_32fc_a.h
@@ -0,0 +1,257 @@
+#ifndef INCLUDED_volk_32fc_s32fc_rotator_32fc_a_H
+#define INCLUDED_volk_32fc_s32fc_rotator_32fc_a_H
+
+
+#include <volk/volk_complex.h>
+#include <stdio.h>
+#include <stdlib.h>
+#define ROTATOR_RELOAD 512
+
+
+#ifdef LV_HAVE_GENERIC
+
+/*!
+ \brief rotate input vector at fixed rate per sample from initial phase offset
+ \param outVector The vector where the results will be stored
+ \param inVector Vector to be rotated
+ \param phase_inc rotational velocity
+ \param phase initial phase offset
+ \param num_points The number of values in inVector to be rotated and stored into cVector
+*/
+
+
+static inline void volk_32fc_s32fc_x2_rotator_32fc_a_generic(lv_32fc_t* outVector, const lv_32fc_t* inVector, const lv_32fc_t phase_inc, lv_32fc_t* phase, unsigned int num_points){
+ unsigned int i = 0;
+ int j = 0;
+ for(i = 0; i < (unsigned int)(num_points/ROTATOR_RELOAD); ++i) {
+ for(j = 0; j < ROTATOR_RELOAD; ++j) {
+ *outVector++ = *inVector++ * (*phase);
+ (*phase) *= phase_inc;
+ }
+ (*phase) /= abs((*phase));
+ }
+ for(i = 0; i < num_points%ROTATOR_RELOAD; ++i) {
+ *outVector++ = *inVector++ * (*phase);
+ (*phase) *= phase_inc;
+ }
+
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+#ifdef LV_HAVE_SSE4_1
+#include <smmintrin.h>
+
+static inline void volk_32fc_s32fc_x2_rotator_32fc_a_sse4_1(lv_32fc_t* outVector, const lv_32fc_t* inVector, const lv_32fc_t phase_inc, lv_32fc_t* phase, unsigned int num_points){
+ lv_32fc_t* cPtr = outVector;
+ const lv_32fc_t* aPtr = inVector;
+ lv_32fc_t incr = 1;
+ lv_32fc_t phase_Ptr[2] = {(*phase), (*phase)};
+
+ unsigned int i, j = 0;
+
+ for(i = 0; i < 2; ++i) {
+ phase_Ptr[i] *= incr;
+ incr *= (phase_inc);
+ }
+
+ /*printf("%f, %f\n", lv_creal(phase_Ptr[0]), lv_cimag(phase_Ptr[0]));
+ printf("%f, %f\n", lv_creal(phase_Ptr[1]), lv_cimag(phase_Ptr[1]));
+ printf("%f, %f\n", lv_creal(phase_Ptr[2]), lv_cimag(phase_Ptr[2]));
+ printf("%f, %f\n", lv_creal(phase_Ptr[3]), lv_cimag(phase_Ptr[3]));
+ printf("incr: %f, %f\n", lv_creal(incr), lv_cimag(incr));*/
+ __m128 aVal, phase_Val, inc_Val, yl, yh, tmp1, tmp2, z, ylp, yhp, tmp1p, tmp2p;
+
+ phase_Val = _mm_loadu_ps((float*)phase_Ptr);
+ inc_Val = _mm_set_ps(lv_cimag(incr), lv_creal(incr),lv_cimag(incr), lv_creal(incr));
+
+ const unsigned int halfPoints = num_points / 2;
+
+
+ for(i = 0; i < (unsigned int)(halfPoints/ROTATOR_RELOAD); i++) {
+ for(j = 0; j < ROTATOR_RELOAD; ++j) {
+
+ aVal = _mm_load_ps((float*)aPtr);
+
+ yl = _mm_moveldup_ps(phase_Val);
+ yh = _mm_movehdup_ps(phase_Val);
+ ylp = _mm_moveldup_ps(inc_Val);
+ yhp = _mm_movehdup_ps(inc_Val);
+
+ tmp1 = _mm_mul_ps(aVal, yl);
+ tmp1p = _mm_mul_ps(phase_Val, ylp);
+
+ aVal = _mm_shuffle_ps(aVal, aVal, 0xB1);
+ phase_Val = _mm_shuffle_ps(phase_Val, phase_Val, 0xB1);
+ tmp2 = _mm_mul_ps(aVal, yh);
+ tmp2p = _mm_mul_ps(phase_Val, yhp);
+
+ z = _mm_addsub_ps(tmp1, tmp2);
+ phase_Val = _mm_addsub_ps(tmp1p, tmp2p);
+
+ _mm_store_ps((float*)cPtr, z);
+
+ aPtr += 2;
+ cPtr += 2;
+ }
+ tmp1 = _mm_mul_ps(phase_Val, phase_Val);
+ tmp2 = _mm_hadd_ps(tmp1, tmp1);
+ tmp1 = _mm_shuffle_ps(tmp2, tmp2, 0xD8);
+ phase_Val = _mm_div_ps(phase_Val, tmp1);
+ }
+ for(i = 0; i < halfPoints%ROTATOR_RELOAD; ++i) {
+ aVal = _mm_load_ps((float*)aPtr);
+
+ yl = _mm_moveldup_ps(phase_Val);
+ yh = _mm_movehdup_ps(phase_Val);
+ ylp = _mm_moveldup_ps(inc_Val);
+ yhp = _mm_movehdup_ps(inc_Val);
+
+ tmp1 = _mm_mul_ps(aVal, yl);
+
+ tmp1p = _mm_mul_ps(phase_Val, ylp);
+
+ aVal = _mm_shuffle_ps(aVal, aVal, 0xB1);
+ phase_Val = _mm_shuffle_ps(phase_Val, phase_Val, 0xB1);
+ tmp2 = _mm_mul_ps(aVal, yh);
+ tmp2p = _mm_mul_ps(phase_Val, yhp);
+
+ z = _mm_addsub_ps(tmp1, tmp2);
+ phase_Val = _mm_addsub_ps(tmp1p, tmp2p);
+
+ _mm_store_ps((float*)cPtr, z);
+
+ aPtr += 2;
+ cPtr += 2;
+ }
+
+ _mm_storeu_ps((float*)phase_Ptr, phase_Val);
+ for(i = 0; i < num_points%2; ++i) {
+ *cPtr++ = *aPtr++ * phase_Ptr[0];
+ phase_Ptr[0] *= (phase_inc);
+ }
+
+ (*phase) = phase_Ptr[0];
+
+}
+
+#endif /* LV_HAVE_SSE4_1 */
+
+
+#ifdef LV_HAVE_AVX
+#include <immintrin.h>
+
+/*!
+ \brief rotate input vector at fixed rate per sample from initial phase offset
+ \param outVector The vector where the results will be stored
+ \param inVector Vector to be rotated
+ \param phase_inc rotational velocity
+ \param phase initial phase offset
+ \param num_points The number of values in inVector to be rotated and stored into cVector
+*/
+
+
+
+
+static inline void volk_32fc_s32fc_x2_rotator_32fc_a_avx(lv_32fc_t* outVector, const lv_32fc_t* inVector, const lv_32fc_t phase_inc, lv_32fc_t* phase, unsigned int num_points){
+ lv_32fc_t* cPtr = outVector;
+ const lv_32fc_t* aPtr = inVector;
+ lv_32fc_t incr = 1;
+ lv_32fc_t phase_Ptr[4] = {(*phase), (*phase), (*phase), (*phase)};
+
+ unsigned int i, j = 0;
+
+ for(i = 0; i < 4; ++i) {
+ phase_Ptr[i] *= incr;
+ incr *= (phase_inc);
+ }
+
+ /*printf("%f, %f\n", lv_creal(phase_Ptr[0]), lv_cimag(phase_Ptr[0]));
+ printf("%f, %f\n", lv_creal(phase_Ptr[1]), lv_cimag(phase_Ptr[1]));
+ printf("%f, %f\n", lv_creal(phase_Ptr[2]), lv_cimag(phase_Ptr[2]));
+ printf("%f, %f\n", lv_creal(phase_Ptr[3]), lv_cimag(phase_Ptr[3]));
+ printf("incr: %f, %f\n", lv_creal(incr), lv_cimag(incr));*/
+ __m256 aVal, phase_Val, inc_Val, yl, yh, tmp1, tmp2, z, ylp, yhp, tmp1p, tmp2p;
+
+ phase_Val = _mm256_loadu_ps((float*)phase_Ptr);
+ inc_Val = _mm256_set_ps(lv_cimag(incr), lv_creal(incr),lv_cimag(incr), lv_creal(incr),lv_cimag(incr), lv_creal(incr),lv_cimag(incr), lv_creal(incr));
+ const unsigned int fourthPoints = num_points / 4;
+
+
+ for(i = 0; i < (unsigned int)(fourthPoints/ROTATOR_RELOAD); i++) {
+ for(j = 0; j < ROTATOR_RELOAD; ++j) {
+
+ aVal = _mm256_load_ps((float*)aPtr);
+
+ yl = _mm256_moveldup_ps(phase_Val);
+ yh = _mm256_movehdup_ps(phase_Val);
+ ylp = _mm256_moveldup_ps(inc_Val);
+ yhp = _mm256_movehdup_ps(inc_Val);
+
+ tmp1 = _mm256_mul_ps(aVal, yl);
+ tmp1p = _mm256_mul_ps(phase_Val, ylp);
+
+ aVal = _mm256_shuffle_ps(aVal, aVal, 0xB1);
+ phase_Val = _mm256_shuffle_ps(phase_Val, phase_Val, 0xB1);
+ tmp2 = _mm256_mul_ps(aVal, yh);
+ tmp2p = _mm256_mul_ps(phase_Val, yhp);
+
+ z = _mm256_addsub_ps(tmp1, tmp2);
+ phase_Val = _mm256_addsub_ps(tmp1p, tmp2p);
+
+ _mm256_store_ps((float*)cPtr, z);
+
+ aPtr += 4;
+ cPtr += 4;
+ }
+ tmp1 = _mm256_mul_ps(phase_Val, phase_Val);
+ tmp2 = _mm256_hadd_ps(tmp1, tmp1);
+ tmp1 = _mm256_shuffle_ps(tmp2, tmp2, 0xD8);
+ phase_Val = _mm256_div_ps(phase_Val, tmp1);
+ }
+ for(i = 0; i < fourthPoints%ROTATOR_RELOAD; ++i) {
+ aVal = _mm256_load_ps((float*)aPtr);
+
+ yl = _mm256_moveldup_ps(phase_Val);
+ yh = _mm256_movehdup_ps(phase_Val);
+ ylp = _mm256_moveldup_ps(inc_Val);
+ yhp = _mm256_movehdup_ps(inc_Val);
+
+ tmp1 = _mm256_mul_ps(aVal, yl);
+
+ tmp1p = _mm256_mul_ps(phase_Val, ylp);
+
+ aVal = _mm256_shuffle_ps(aVal, aVal, 0xB1);
+ phase_Val = _mm256_shuffle_ps(phase_Val, phase_Val, 0xB1);
+ tmp2 = _mm256_mul_ps(aVal, yh);
+ tmp2p = _mm256_mul_ps(phase_Val, yhp);
+
+ z = _mm256_addsub_ps(tmp1, tmp2);
+ phase_Val = _mm256_addsub_ps(tmp1p, tmp2p);
+
+ _mm256_store_ps((float*)cPtr, z);
+
+ aPtr += 4;
+ cPtr += 4;
+ }
+
+ _mm256_storeu_ps((float*)phase_Ptr, phase_Val);
+ for(i = 0; i < num_points%4; ++i) {
+ *cPtr++ = *aPtr++ * phase_Ptr[0];
+ phase_Ptr[0] *= (phase_inc);
+ }
+
+ (*phase) = phase_Ptr[0];
+
+}
+
+#endif /* LV_HAVE_AVX */
+
+
+
+
+
+
+
+
+#endif /* INCLUDED_volk_32fc_s32fc_rotator_32fc_a_H */
diff --git a/volk/include/volk/volk_32fc_x2_conjugate_dot_prod_32fc_a.h b/volk/include/volk/volk_32fc_x2_conjugate_dot_prod_32fc_a.h
new file mode 100644
index 000000000..e3dedf2fc
--- /dev/null
+++ b/volk/include/volk/volk_32fc_x2_conjugate_dot_prod_32fc_a.h
@@ -0,0 +1,345 @@
+#ifndef INCLUDED_volk_32fc_x2_conjugate_dot_prod_32fc_a_H
+#define INCLUDED_volk_32fc_x2_conjugate_dot_prod_32fc_a_H
+
+#include <volk/volk_common.h>
+#include<volk/volk_complex.h>
+#include<stdio.h>
+
+
+#ifdef LV_HAVE_GENERIC
+
+
+static inline void volk_32fc_x2_conjugate_dot_prod_32fc_a_generic(lv_32fc_t* result, const lv_32fc_t* input, const lv_32fc_t* taps, unsigned int num_bytes) {
+
+ float * res = (float*) result;
+ float * in = (float*) input;
+ float * tp = (float*) taps;
+ unsigned int n_2_ccomplex_blocks = num_bytes >> 4;
+ unsigned int isodd = (num_bytes >> 3) &1;
+
+
+
+ float sum0[2] = {0,0};
+ float sum1[2] = {0,0};
+ unsigned int i = 0;
+
+
+ for(i = 0; i < n_2_ccomplex_blocks; ++i) {
+
+
+ sum0[0] += in[0] * tp[0] + in[1] * tp[1];
+ sum0[1] += (-in[0] * tp[1]) + in[1] * tp[0];
+ sum1[0] += in[2] * tp[2] + in[3] * tp[3];
+ sum1[1] += (-in[2] * tp[3]) + in[3] * tp[2];
+
+
+ in += 4;
+ tp += 4;
+
+ }
+
+
+ res[0] = sum0[0] + sum1[0];
+ res[1] = sum0[1] + sum1[1];
+
+
+
+ for(i = 0; i < isodd; ++i) {
+
+
+ *result += input[(num_bytes >> 3) - 1] * lv_conj(taps[(num_bytes >> 3) - 1]);
+
+ }
+ /*
+ for(i = 0; i < num_bytes >> 3; ++i) {
+ *result += input[i] * conjf(taps[i]);
+ }
+ */
+}
+
+#endif /*LV_HAVE_GENERIC*/
+
+
+#if LV_HAVE_SSE && LV_HAVE_64
+
+
+static inline void volk_32fc_x2_conjugate_dot_prod_32fc_a_sse(lv_32fc_t* result, const lv_32fc_t* input, const lv_32fc_t* taps, unsigned int num_bytes) {
+
+ __VOLK_ATTR_ALIGNED(16) static const uint32_t conjugator[4]= {0x00000000, 0x80000000, 0x00000000, 0x80000000};
+
+
+
+
+ asm volatile
+ (
+ "# ccomplex_conjugate_dotprod_generic (float* result, const float *input,\n\t"
+ "# const float *taps, unsigned num_bytes)\n\t"
+ "# float sum0 = 0;\n\t"
+ "# float sum1 = 0;\n\t"
+ "# float sum2 = 0;\n\t"
+ "# float sum3 = 0;\n\t"
+ "# do {\n\t"
+ "# sum0 += input[0] * taps[0] - input[1] * taps[1];\n\t"
+ "# sum1 += input[0] * taps[1] + input[1] * taps[0];\n\t"
+ "# sum2 += input[2] * taps[2] - input[3] * taps[3];\n\t"
+ "# sum3 += input[2] * taps[3] + input[3] * taps[2];\n\t"
+ "# input += 4;\n\t"
+ "# taps += 4; \n\t"
+ "# } while (--n_2_ccomplex_blocks != 0);\n\t"
+ "# result[0] = sum0 + sum2;\n\t"
+ "# result[1] = sum1 + sum3;\n\t"
+ "# TODO: prefetch and better scheduling\n\t"
+ " xor %%r9, %%r9\n\t"
+ " xor %%r10, %%r10\n\t"
+ " movq %[conjugator], %%r9\n\t"
+ " movq %%rcx, %%rax\n\t"
+ " movaps 0(%%r9), %%xmm8\n\t"
+ " movq %%rcx, %%r8\n\t"
+ " movq %[rsi], %%r9\n\t"
+ " movq %[rdx], %%r10\n\t"
+ " xorps %%xmm6, %%xmm6 # zero accumulators\n\t"
+ " movaps 0(%%r9), %%xmm0\n\t"
+ " xorps %%xmm7, %%xmm7 # zero accumulators\n\t"
+ " movups 0(%%r10), %%xmm2\n\t"
+ " shr $5, %%rax # rax = n_2_ccomplex_blocks / 2\n\t"
+ " shr $4, %%r8\n\t"
+ " xorps %%xmm8, %%xmm2\n\t"
+ " jmp .%=L1_test\n\t"
+ " # 4 taps / loop\n\t"
+ " # something like ?? cycles / loop\n\t"
+ ".%=Loop1: \n\t"
+ "# complex prod: C += A * B, w/ temp Z & Y (or B), xmmPN=$0x8000000080000000\n\t"
+ "# movaps (%%r9), %%xmmA\n\t"
+ "# movaps (%%r10), %%xmmB\n\t"
+ "# movaps %%xmmA, %%xmmZ\n\t"
+ "# shufps $0xb1, %%xmmZ, %%xmmZ # swap internals\n\t"
+ "# mulps %%xmmB, %%xmmA\n\t"
+ "# mulps %%xmmZ, %%xmmB\n\t"
+ "# # SSE replacement for: pfpnacc %%xmmB, %%xmmA\n\t"
+ "# xorps %%xmmPN, %%xmmA\n\t"
+ "# movaps %%xmmA, %%xmmZ\n\t"
+ "# unpcklps %%xmmB, %%xmmA\n\t"
+ "# unpckhps %%xmmB, %%xmmZ\n\t"
+ "# movaps %%xmmZ, %%xmmY\n\t"
+ "# shufps $0x44, %%xmmA, %%xmmZ # b01000100\n\t"
+ "# shufps $0xee, %%xmmY, %%xmmA # b11101110\n\t"
+ "# addps %%xmmZ, %%xmmA\n\t"
+ "# addps %%xmmA, %%xmmC\n\t"
+ "# A=xmm0, B=xmm2, Z=xmm4\n\t"
+ "# A'=xmm1, B'=xmm3, Z'=xmm5\n\t"
+ " movaps 16(%%r9), %%xmm1\n\t"
+ " movaps %%xmm0, %%xmm4\n\t"
+ " mulps %%xmm2, %%xmm0\n\t"
+ " shufps $0xb1, %%xmm4, %%xmm4 # swap internals\n\t"
+ " movaps 16(%%r10), %%xmm3\n\t"
+ " movaps %%xmm1, %%xmm5\n\t"
+ " xorps %%xmm8, %%xmm3\n\t"
+ " addps %%xmm0, %%xmm6\n\t"
+ " mulps %%xmm3, %%xmm1\n\t"
+ " shufps $0xb1, %%xmm5, %%xmm5 # swap internals\n\t"
+ " addps %%xmm1, %%xmm6\n\t"
+ " mulps %%xmm4, %%xmm2\n\t"
+ " movaps 32(%%r9), %%xmm0\n\t"
+ " addps %%xmm2, %%xmm7\n\t"
+ " mulps %%xmm5, %%xmm3\n\t"
+ " add $32, %%r9\n\t"
+ " movaps 32(%%r10), %%xmm2\n\t"
+ " addps %%xmm3, %%xmm7\n\t"
+ " add $32, %%r10\n\t"
+ " xorps %%xmm8, %%xmm2\n\t"
+ ".%=L1_test:\n\t"
+ " dec %%rax\n\t"
+ " jge .%=Loop1\n\t"
+ " # We've handled the bulk of multiplies up to here.\n\t"
+ " # Let's sse if original n_2_ccomplex_blocks was odd.\n\t"
+ " # If so, we've got 2 more taps to do.\n\t"
+ " and $1, %%r8\n\t"
+ " je .%=Leven\n\t"
+ " # The count was odd, do 2 more taps.\n\t"
+ " # Note that we've already got mm0/mm2 preloaded\n\t"
+ " # from the main loop.\n\t"
+ " movaps %%xmm0, %%xmm4\n\t"
+ " mulps %%xmm2, %%xmm0\n\t"
+ " shufps $0xb1, %%xmm4, %%xmm4 # swap internals\n\t"
+ " addps %%xmm0, %%xmm6\n\t"
+ " mulps %%xmm4, %%xmm2\n\t"
+ " addps %%xmm2, %%xmm7\n\t"
+ ".%=Leven:\n\t"
+ " # neg inversor\n\t"
+ " xorps %%xmm1, %%xmm1\n\t"
+ " mov $0x80000000, %%r9\n\t"
+ " movd %%r9, %%xmm1\n\t"
+ " shufps $0x11, %%xmm1, %%xmm1 # b00010001 # 0 -0 0 -0\n\t"
+ " # pfpnacc\n\t"
+ " xorps %%xmm1, %%xmm6\n\t"
+ " movaps %%xmm6, %%xmm2\n\t"
+ " unpcklps %%xmm7, %%xmm6\n\t"
+ " unpckhps %%xmm7, %%xmm2\n\t"
+ " movaps %%xmm2, %%xmm3\n\t"
+ " shufps $0x44, %%xmm6, %%xmm2 # b01000100\n\t"
+ " shufps $0xee, %%xmm3, %%xmm6 # b11101110\n\t"
+ " addps %%xmm2, %%xmm6\n\t"
+ " # xmm6 = r1 i2 r3 i4\n\t"
+ " movhlps %%xmm6, %%xmm4 # xmm4 = r3 i4 ?? ??\n\t"
+ " addps %%xmm4, %%xmm6 # xmm6 = r1+r3 i2+i4 ?? ??\n\t"
+ " movlps %%xmm6, (%[rdi]) # store low 2x32 bits (complex) to memory\n\t"
+ :
+ :[rsi] "r" (input), [rdx] "r" (taps), "c" (num_bytes), [rdi] "r" (result), [conjugator] "r" (conjugator)
+ :"rax", "r8", "r9", "r10"
+ );
+
+
+ int getem = num_bytes % 16;
+
+
+ for(; getem > 0; getem -= 8) {
+
+
+ *result += (input[(num_bytes >> 3) - 1] * lv_conj(taps[(num_bytes >> 3) - 1]));
+
+ }
+
+ return;
+}
+#endif
+
+#if LV_HAVE_SSE && LV_HAVE_32
+static inline void volk_32fc_x2_conjugate_dot_prod_32fc_a_sse_32(lv_32fc_t* result, const lv_32fc_t* input, const lv_32fc_t* taps, unsigned int num_bytes) {
+
+ __VOLK_ATTR_ALIGNED(16) static const uint32_t conjugator[4]= {0x00000000, 0x80000000, 0x00000000, 0x80000000};
+
+ int bound = num_bytes >> 4;
+ int leftovers = num_bytes % 16;
+
+
+ asm volatile
+ (
+ " #pushl %%ebp\n\t"
+ " #movl %%esp, %%ebp\n\t"
+ " #movl 12(%%ebp), %%eax # input\n\t"
+ " #movl 16(%%ebp), %%edx # taps\n\t"
+ " #movl 20(%%ebp), %%ecx # n_bytes\n\t"
+ " movaps 0(%[conjugator]), %%xmm1\n\t"
+ " xorps %%xmm6, %%xmm6 # zero accumulators\n\t"
+ " movaps 0(%[eax]), %%xmm0\n\t"
+ " xorps %%xmm7, %%xmm7 # zero accumulators\n\t"
+ " movaps 0(%[edx]), %%xmm2\n\t"
+ " movl %[ecx], (%[out])\n\t"
+ " shrl $5, %[ecx] # ecx = n_2_ccomplex_blocks / 2\n\t"
+
+ " xorps %%xmm1, %%xmm2\n\t"
+ " jmp .%=L1_test\n\t"
+ " # 4 taps / loop\n\t"
+ " # something like ?? cycles / loop\n\t"
+ ".%=Loop1: \n\t"
+ "# complex prod: C += A * B, w/ temp Z & Y (or B), xmmPN=$0x8000000080000000\n\t"
+ "# movaps (%[eax]), %%xmmA\n\t"
+ "# movaps (%[edx]), %%xmmB\n\t"
+ "# movaps %%xmmA, %%xmmZ\n\t"
+ "# shufps $0xb1, %%xmmZ, %%xmmZ # swap internals\n\t"
+ "# mulps %%xmmB, %%xmmA\n\t"
+ "# mulps %%xmmZ, %%xmmB\n\t"
+ "# # SSE replacement for: pfpnacc %%xmmB, %%xmmA\n\t"
+ "# xorps %%xmmPN, %%xmmA\n\t"
+ "# movaps %%xmmA, %%xmmZ\n\t"
+ "# unpcklps %%xmmB, %%xmmA\n\t"
+ "# unpckhps %%xmmB, %%xmmZ\n\t"
+ "# movaps %%xmmZ, %%xmmY\n\t"
+ "# shufps $0x44, %%xmmA, %%xmmZ # b01000100\n\t"
+ "# shufps $0xee, %%xmmY, %%xmmA # b11101110\n\t"
+ "# addps %%xmmZ, %%xmmA\n\t"
+ "# addps %%xmmA, %%xmmC\n\t"
+ "# A=xmm0, B=xmm2, Z=xmm4\n\t"
+ "# A'=xmm1, B'=xmm3, Z'=xmm5\n\t"
+ " movaps 16(%[edx]), %%xmm3\n\t"
+ " movaps %%xmm0, %%xmm4\n\t"
+ " xorps %%xmm1, %%xmm3\n\t"
+ " mulps %%xmm2, %%xmm0\n\t"
+ " movaps 16(%[eax]), %%xmm1\n\t"
+ " shufps $0xb1, %%xmm4, %%xmm4 # swap internals\n\t"
+ " movaps %%xmm1, %%xmm5\n\t"
+ " addps %%xmm0, %%xmm6\n\t"
+ " mulps %%xmm3, %%xmm1\n\t"
+ " shufps $0xb1, %%xmm5, %%xmm5 # swap internals\n\t"
+ " addps %%xmm1, %%xmm6\n\t"
+ " movaps 0(%[conjugator]), %%xmm1\n\t"
+ " mulps %%xmm4, %%xmm2\n\t"
+ " movaps 32(%[eax]), %%xmm0\n\t"
+ " addps %%xmm2, %%xmm7\n\t"
+ " mulps %%xmm5, %%xmm3\n\t"
+ " addl $32, %[eax]\n\t"
+ " movaps 32(%[edx]), %%xmm2\n\t"
+ " addps %%xmm3, %%xmm7\n\t"
+ " xorps %%xmm1, %%xmm2\n\t"
+ " addl $32, %[edx]\n\t"
+ ".%=L1_test:\n\t"
+ " decl %[ecx]\n\t"
+ " jge .%=Loop1\n\t"
+ " # We've handled the bulk of multiplies up to here.\n\t"
+ " # Let's sse if original n_2_ccomplex_blocks was odd.\n\t"
+ " # If so, we've got 2 more taps to do.\n\t"
+ " movl 0(%[out]), %[ecx] # n_2_ccomplex_blocks\n\t"
+ " shrl $4, %[ecx]\n\t"
+ " andl $1, %[ecx]\n\t"
+ " je .%=Leven\n\t"
+ " # The count was odd, do 2 more taps.\n\t"
+ " # Note that we've already got mm0/mm2 preloaded\n\t"
+ " # from the main loop.\n\t"
+ " movaps %%xmm0, %%xmm4\n\t"
+ " mulps %%xmm2, %%xmm0\n\t"
+ " shufps $0xb1, %%xmm4, %%xmm4 # swap internals\n\t"
+ " addps %%xmm0, %%xmm6\n\t"
+ " mulps %%xmm4, %%xmm2\n\t"
+ " addps %%xmm2, %%xmm7\n\t"
+ ".%=Leven:\n\t"
+ " # neg inversor\n\t"
+ " #movl 8(%%ebp), %[eax] \n\t"
+ " xorps %%xmm1, %%xmm1\n\t"
+ " movl $0x80000000, (%[out])\n\t"
+ " movss (%[out]), %%xmm1\n\t"
+ " shufps $0x11, %%xmm1, %%xmm1 # b00010001 # 0 -0 0 -0\n\t"
+ " # pfpnacc\n\t"
+ " xorps %%xmm1, %%xmm6\n\t"
+ " movaps %%xmm6, %%xmm2\n\t"
+ " unpcklps %%xmm7, %%xmm6\n\t"
+ " unpckhps %%xmm7, %%xmm2\n\t"
+ " movaps %%xmm2, %%xmm3\n\t"
+ " shufps $0x44, %%xmm6, %%xmm2 # b01000100\n\t"
+ " shufps $0xee, %%xmm3, %%xmm6 # b11101110\n\t"
+ " addps %%xmm2, %%xmm6\n\t"
+ " # xmm6 = r1 i2 r3 i4\n\t"
+ " #movl 8(%%ebp), %[eax] # @result\n\t"
+ " movhlps %%xmm6, %%xmm4 # xmm4 = r3 i4 ?? ??\n\t"
+ " addps %%xmm4, %%xmm6 # xmm6 = r1+r3 i2+i4 ?? ??\n\t"
+ " movlps %%xmm6, (%[out]) # store low 2x32 bits (complex) to memory\n\t"
+ " #popl %%ebp\n\t"
+ :
+ : [eax] "r" (input), [edx] "r" (taps), [ecx] "r" (num_bytes), [out] "r" (result), [conjugator] "r" (conjugator)
+ );
+
+
+
+
+ printf("%d, %d\n", leftovers, bound);
+
+ for(; leftovers > 0; leftovers -= 8) {
+
+
+ *result += (input[(bound << 1)] * lv_conj(taps[(bound << 1)]));
+
+ }
+
+ return;
+
+
+
+
+
+
+}
+
+#endif /*LV_HAVE_SSE*/
+
+
+
+#endif /*INCLUDED_volk_32fc_x2_conjugate_dot_prod_32fc_a_H*/
diff --git a/volk/include/volk/volk_32fc_x2_conjugate_dot_prod_32fc_u.h b/volk/include/volk/volk_32fc_x2_conjugate_dot_prod_32fc_u.h
new file mode 100644
index 000000000..e7493413f
--- /dev/null
+++ b/volk/include/volk/volk_32fc_x2_conjugate_dot_prod_32fc_u.h
@@ -0,0 +1,145 @@
+#ifndef INCLUDED_volk_32fc_x2_conjugate_dot_prod_32fc_u_H
+#define INCLUDED_volk_32fc_x2_conjugate_dot_prod_32fc_u_H
+
+
+#include<volk/volk_complex.h>
+
+
+#ifdef LV_HAVE_GENERIC
+
+
+static inline void volk_32fc_x2_conjugate_dot_prod_32fc_u_generic(lv_32fc_t* result, const lv_32fc_t* input, const lv_32fc_t* taps, unsigned int num_bytes) {
+
+ float * res = (float*) result;
+ float * in = (float*) input;
+ float * tp = (float*) taps;
+ unsigned int n_2_ccomplex_blocks = num_bytes >> 4;
+ unsigned int isodd = (num_bytes >> 3) &1;
+
+
+
+ float sum0[2] = {0,0};
+ float sum1[2] = {0,0};
+ unsigned int i = 0;
+
+
+ for(i = 0; i < n_2_ccomplex_blocks; ++i) {
+
+ sum0[0] += in[0] * tp[0] + in[1] * tp[1];
+ sum0[1] += (-in[0] * tp[1]) + in[1] * tp[0];
+ sum1[0] += in[2] * tp[2] + in[3] * tp[3];
+ sum1[1] += (-in[2] * tp[3]) + in[3] * tp[2];
+
+
+ in += 4;
+ tp += 4;
+
+ }
+
+
+ res[0] = sum0[0] + sum1[0];
+ res[1] = sum0[1] + sum1[1];
+
+
+
+ for(i = 0; i < isodd; ++i) {
+
+
+ *result += input[(num_bytes >> 3) - 1] * lv_conj(taps[(num_bytes >> 3) - 1]);
+
+ }
+ /*
+ for(i = 0; i < num_bytes >> 3; ++i) {
+ *result += input[i] * conjf(taps[i]);
+ }
+ */
+}
+
+#endif /*LV_HAVE_GENERIC*/
+
+#ifdef LV_HAVE_SSE3
+
+#include <xmmintrin.h>
+#include <pmmintrin.h>
+#include <mmintrin.h>
+
+
+static inline void volk_32fc_x2_conjugate_dot_prod_32fc_u_sse3(lv_32fc_t* result, const lv_32fc_t* input, const lv_32fc_t* taps, unsigned int num_bytes) {
+
+ // Variable never used?
+ //__VOLK_ATTR_ALIGNED(16) static const uint32_t conjugator[4]= {0x00000000, 0x80000000, 0x00000000, 0x80000000};
+
+ union HalfMask {
+ uint32_t intRep[4];
+ __m128 vec;
+ } halfMask;
+
+ union NegMask {
+ int intRep[4];
+ __m128 vec;
+ } negMask;
+
+ unsigned int offset = 0;
+ float Rsum=0, Isum=0;
+ float Im,Re;
+
+ __m128 in1, in2, Rv, fehg, Iv, Rs, Ivm, Is;
+ __m128 zv = {0,0,0,0};
+
+ halfMask.intRep[0] = halfMask.intRep[1] = 0xFFFFFFFF;
+ halfMask.intRep[2] = halfMask.intRep[3] = 0x00000000;
+
+ negMask.intRep[0] = negMask.intRep[2] = 0x80000000;
+ negMask.intRep[1] = negMask.intRep[3] = 0;
+
+ // main loop
+ while(num_bytes >= 4*sizeof(float)){
+
+ in1 = _mm_loadu_ps( (float*) (input+offset) );
+ in2 = _mm_loadu_ps( (float*) (taps+offset) );
+ Rv = _mm_mul_ps(in1, in2);
+ fehg = _mm_shuffle_ps(in2, in2, _MM_SHUFFLE(2,3,0,1));
+ Iv = _mm_mul_ps(in1, fehg);
+ Rs = _mm_hadd_ps( _mm_hadd_ps(Rv, zv) ,zv);
+ Ivm = _mm_xor_ps( negMask.vec, Iv );
+ Is = _mm_hadd_ps( _mm_hadd_ps(Ivm, zv) ,zv);
+ _mm_store_ss( &Im, Is );
+ _mm_store_ss( &Re, Rs );
+ num_bytes -= 4*sizeof(float);
+ offset += 2;
+ Rsum += Re;
+ Isum += Im;
+ }
+
+ // handle the last complex case ...
+ if(num_bytes > 0){
+
+ if(num_bytes != 4){
+ // bad things are happening
+ }
+
+ in1 = _mm_loadu_ps( (float*) (input+offset) );
+ in2 = _mm_loadu_ps( (float*) (taps+offset) );
+ Rv = _mm_and_ps(_mm_mul_ps(in1, in2), halfMask.vec);
+ fehg = _mm_shuffle_ps(in2, in2, _MM_SHUFFLE(2,3,0,1));
+ Iv = _mm_and_ps(_mm_mul_ps(in1, fehg), halfMask.vec);
+ Rs = _mm_hadd_ps(_mm_hadd_ps(Rv, zv),zv);
+ Ivm = _mm_xor_ps( negMask.vec, Iv );
+ Is = _mm_hadd_ps(_mm_hadd_ps(Ivm, zv),zv);
+ _mm_store_ss( &Im, Is );
+ _mm_store_ss( &Re, Rs );
+ Rsum += Re;
+ Isum += Im;
+ }
+
+ result[0] = lv_cmake(Rsum,Isum);
+ return;
+}
+
+#endif /*LV_HAVE_SSE3*/
+
+
+#endif /*INCLUDED_volk_32fc_x2_conjugate_dot_prod_32fc_u_H*/
+
+
+
diff --git a/volk/include/volk/volk_32fc_x2_dot_prod_32fc_a.h b/volk/include/volk/volk_32fc_x2_dot_prod_32fc_a.h
new file mode 100644
index 000000000..caef3e6f0
--- /dev/null
+++ b/volk/include/volk/volk_32fc_x2_dot_prod_32fc_a.h
@@ -0,0 +1,440 @@
+#ifndef INCLUDED_volk_32fc_x2_dot_prod_32fc_a_H
+#define INCLUDED_volk_32fc_x2_dot_prod_32fc_a_H
+
+#include <volk/volk_common.h>
+#include <volk/volk_complex.h>
+#include <stdio.h>
+#include <string.h>
+
+
+#ifdef LV_HAVE_GENERIC
+
+
+static inline void volk_32fc_x2_dot_prod_32fc_a_generic(lv_32fc_t* result, const lv_32fc_t* input, const lv_32fc_t* taps, unsigned int num_bytes) {
+
+ float * res = (float*) result;
+ float * in = (float*) input;
+ float * tp = (float*) taps;
+ unsigned int n_2_ccomplex_blocks = num_bytes >> 4;
+ unsigned int isodd = (num_bytes >> 3) &1;
+
+ float sum0[2] = {0,0};
+ float sum1[2] = {0,0};
+ unsigned int i = 0;
+
+ for(i = 0; i < n_2_ccomplex_blocks; ++i) {
+ sum0[0] += in[0] * tp[0] - in[1] * tp[1];
+ sum0[1] += in[0] * tp[1] + in[1] * tp[0];
+ sum1[0] += in[2] * tp[2] - in[3] * tp[3];
+ sum1[1] += in[2] * tp[3] + in[3] * tp[2];
+
+ in += 4;
+ tp += 4;
+ }
+
+ res[0] = sum0[0] + sum1[0];
+ res[1] = sum0[1] + sum1[1];
+
+ for(i = 0; i < isodd; ++i) {
+ *result += input[(num_bytes >> 3) - 1] * taps[(num_bytes >> 3) - 1];
+ }
+}
+
+#endif /*LV_HAVE_GENERIC*/
+
+
+#if LV_HAVE_SSE && LV_HAVE_64
+
+
+static inline void volk_32fc_x2_dot_prod_32fc_a_sse_64(lv_32fc_t* result, const lv_32fc_t* input, const lv_32fc_t* taps, unsigned int num_bytes) {
+
+
+ asm
+ (
+ "# ccomplex_dotprod_generic (float* result, const float *input,\n\t"
+ "# const float *taps, unsigned num_bytes)\n\t"
+ "# float sum0 = 0;\n\t"
+ "# float sum1 = 0;\n\t"
+ "# float sum2 = 0;\n\t"
+ "# float sum3 = 0;\n\t"
+ "# do {\n\t"
+ "# sum0 += input[0] * taps[0] - input[1] * taps[1];\n\t"
+ "# sum1 += input[0] * taps[1] + input[1] * taps[0];\n\t"
+ "# sum2 += input[2] * taps[2] - input[3] * taps[3];\n\t"
+ "# sum3 += input[2] * taps[3] + input[3] * taps[2];\n\t"
+ "# input += 4;\n\t"
+ "# taps += 4; \n\t"
+ "# } while (--n_2_ccomplex_blocks != 0);\n\t"
+ "# result[0] = sum0 + sum2;\n\t"
+ "# result[1] = sum1 + sum3;\n\t"
+ "# TODO: prefetch and better scheduling\n\t"
+ " xor %%r9, %%r9\n\t"
+ " xor %%r10, %%r10\n\t"
+ " movq %%rcx, %%rax\n\t"
+ " movq %%rcx, %%r8\n\t"
+ " movq %[rsi], %%r9\n\t"
+ " movq %[rdx], %%r10\n\t"
+ " xorps %%xmm6, %%xmm6 # zero accumulators\n\t"
+ " movaps 0(%%r9), %%xmm0\n\t"
+ " xorps %%xmm7, %%xmm7 # zero accumulators\n\t"
+ " movaps 0(%%r10), %%xmm2\n\t"
+ " shr $5, %%rax # rax = n_2_ccomplex_blocks / 2\n\t"
+ " shr $4, %%r8\n\t"
+ " jmp .%=L1_test\n\t"
+ " # 4 taps / loop\n\t"
+ " # something like ?? cycles / loop\n\t"
+ ".%=Loop1: \n\t"
+ "# complex prod: C += A * B, w/ temp Z & Y (or B), xmmPN=$0x8000000080000000\n\t"
+ "# movaps (%%r9), %%xmmA\n\t"
+ "# movaps (%%r10), %%xmmB\n\t"
+ "# movaps %%xmmA, %%xmmZ\n\t"
+ "# shufps $0xb1, %%xmmZ, %%xmmZ # swap internals\n\t"
+ "# mulps %%xmmB, %%xmmA\n\t"
+ "# mulps %%xmmZ, %%xmmB\n\t"
+ "# # SSE replacement for: pfpnacc %%xmmB, %%xmmA\n\t"
+ "# xorps %%xmmPN, %%xmmA\n\t"
+ "# movaps %%xmmA, %%xmmZ\n\t"
+ "# unpcklps %%xmmB, %%xmmA\n\t"
+ "# unpckhps %%xmmB, %%xmmZ\n\t"
+ "# movaps %%xmmZ, %%xmmY\n\t"
+ "# shufps $0x44, %%xmmA, %%xmmZ # b01000100\n\t"
+ "# shufps $0xee, %%xmmY, %%xmmA # b11101110\n\t"
+ "# addps %%xmmZ, %%xmmA\n\t"
+ "# addps %%xmmA, %%xmmC\n\t"
+ "# A=xmm0, B=xmm2, Z=xmm4\n\t"
+ "# A'=xmm1, B'=xmm3, Z'=xmm5\n\t"
+ " movaps 16(%%r9), %%xmm1\n\t"
+ " movaps %%xmm0, %%xmm4\n\t"
+ " mulps %%xmm2, %%xmm0\n\t"
+ " shufps $0xb1, %%xmm4, %%xmm4 # swap internals\n\t"
+ " movaps 16(%%r10), %%xmm3\n\t"
+ " movaps %%xmm1, %%xmm5\n\t"
+ " addps %%xmm0, %%xmm6\n\t"
+ " mulps %%xmm3, %%xmm1\n\t"
+ " shufps $0xb1, %%xmm5, %%xmm5 # swap internals\n\t"
+ " addps %%xmm1, %%xmm6\n\t"
+ " mulps %%xmm4, %%xmm2\n\t"
+ " movaps 32(%%r9), %%xmm0\n\t"
+ " addps %%xmm2, %%xmm7\n\t"
+ " mulps %%xmm5, %%xmm3\n\t"
+ " add $32, %%r9\n\t"
+ " movaps 32(%%r10), %%xmm2\n\t"
+ " addps %%xmm3, %%xmm7\n\t"
+ " add $32, %%r10\n\t"
+ ".%=L1_test:\n\t"
+ " dec %%rax\n\t"
+ " jge .%=Loop1\n\t"
+ " # We've handled the bulk of multiplies up to here.\n\t"
+ " # Let's sse if original n_2_ccomplex_blocks was odd.\n\t"
+ " # If so, we've got 2 more taps to do.\n\t"
+ " and $1, %%r8\n\t"
+ " je .%=Leven\n\t"
+ " # The count was odd, do 2 more taps.\n\t"
+ " # Note that we've already got mm0/mm2 preloaded\n\t"
+ " # from the main loop.\n\t"
+ " movaps %%xmm0, %%xmm4\n\t"
+ " mulps %%xmm2, %%xmm0\n\t"
+ " shufps $0xb1, %%xmm4, %%xmm4 # swap internals\n\t"
+ " addps %%xmm0, %%xmm6\n\t"
+ " mulps %%xmm4, %%xmm2\n\t"
+ " addps %%xmm2, %%xmm7\n\t"
+ ".%=Leven:\n\t"
+ " # neg inversor\n\t"
+ " xorps %%xmm1, %%xmm1\n\t"
+ " mov $0x80000000, %%r9\n\t"
+ " movd %%r9, %%xmm1\n\t"
+ " shufps $0x11, %%xmm1, %%xmm1 # b00010001 # 0 -0 0 -0\n\t"
+ " # pfpnacc\n\t"
+ " xorps %%xmm1, %%xmm6\n\t"
+ " movaps %%xmm6, %%xmm2\n\t"
+ " unpcklps %%xmm7, %%xmm6\n\t"
+ " unpckhps %%xmm7, %%xmm2\n\t"
+ " movaps %%xmm2, %%xmm3\n\t"
+ " shufps $0x44, %%xmm6, %%xmm2 # b01000100\n\t"
+ " shufps $0xee, %%xmm3, %%xmm6 # b11101110\n\t"
+ " addps %%xmm2, %%xmm6\n\t"
+ " # xmm6 = r1 i2 r3 i4\n\t"
+ " movhlps %%xmm6, %%xmm4 # xmm4 = r3 i4 ?? ??\n\t"
+ " addps %%xmm4, %%xmm6 # xmm6 = r1+r3 i2+i4 ?? ??\n\t"
+ " movlps %%xmm6, (%[rdi]) # store low 2x32 bits (complex) to memory\n\t"
+ :
+ :[rsi] "r" (input), [rdx] "r" (taps), "c" (num_bytes), [rdi] "r" (result)
+ :"rax", "r8", "r9", "r10"
+ );
+
+
+ if(((num_bytes >> 3) & 1)) {
+ *result += (input[(num_bytes >> 3) - 1] * taps[(num_bytes >> 3) - 1]);
+ }
+
+ return;
+
+}
+
+#endif
+
+#if LV_HAVE_SSE && LV_HAVE_32
+
+static inline void volk_32fc_x2_dot_prod_32fc_a_sse_32(lv_32fc_t* result, const lv_32fc_t* input, const lv_32fc_t* taps, unsigned int num_bytes) {
+
+ volk_32fc_x2_dot_prod_32fc_a_generic(result, input, taps, num_bytes);
+
+#if 0
+ asm volatile
+ (
+ " #pushl %%ebp\n\t"
+ " #movl %%esp, %%ebp\n\t"
+ " movl 12(%%ebp), %%eax # input\n\t"
+ " movl 16(%%ebp), %%edx # taps\n\t"
+ " movl 20(%%ebp), %%ecx # n_bytes\n\t"
+ " xorps %%xmm6, %%xmm6 # zero accumulators\n\t"
+ " movaps 0(%%eax), %%xmm0\n\t"
+ " xorps %%xmm7, %%xmm7 # zero accumulators\n\t"
+ " movaps 0(%%edx), %%xmm2\n\t"
+ " shrl $5, %%ecx # ecx = n_2_ccomplex_blocks / 2\n\t"
+ " jmp .%=L1_test\n\t"
+ " # 4 taps / loop\n\t"
+ " # something like ?? cycles / loop\n\t"
+ ".%=Loop1: \n\t"
+ "# complex prod: C += A * B, w/ temp Z & Y (or B), xmmPN=$0x8000000080000000\n\t"
+ "# movaps (%%eax), %%xmmA\n\t"
+ "# movaps (%%edx), %%xmmB\n\t"
+ "# movaps %%xmmA, %%xmmZ\n\t"
+ "# shufps $0xb1, %%xmmZ, %%xmmZ # swap internals\n\t"
+ "# mulps %%xmmB, %%xmmA\n\t"
+ "# mulps %%xmmZ, %%xmmB\n\t"
+ "# # SSE replacement for: pfpnacc %%xmmB, %%xmmA\n\t"
+ "# xorps %%xmmPN, %%xmmA\n\t"
+ "# movaps %%xmmA, %%xmmZ\n\t"
+ "# unpcklps %%xmmB, %%xmmA\n\t"
+ "# unpckhps %%xmmB, %%xmmZ\n\t"
+ "# movaps %%xmmZ, %%xmmY\n\t"
+ "# shufps $0x44, %%xmmA, %%xmmZ # b01000100\n\t"
+ "# shufps $0xee, %%xmmY, %%xmmA # b11101110\n\t"
+ "# addps %%xmmZ, %%xmmA\n\t"
+ "# addps %%xmmA, %%xmmC\n\t"
+ "# A=xmm0, B=xmm2, Z=xmm4\n\t"
+ "# A'=xmm1, B'=xmm3, Z'=xmm5\n\t"
+ " movaps 16(%%eax), %%xmm1\n\t"
+ " movaps %%xmm0, %%xmm4\n\t"
+ " mulps %%xmm2, %%xmm0\n\t"
+ " shufps $0xb1, %%xmm4, %%xmm4 # swap internals\n\t"
+ " movaps 16(%%edx), %%xmm3\n\t"
+ " movaps %%xmm1, %%xmm5\n\t"
+ " addps %%xmm0, %%xmm6\n\t"
+ " mulps %%xmm3, %%xmm1\n\t"
+ " shufps $0xb1, %%xmm5, %%xmm5 # swap internals\n\t"
+ " addps %%xmm1, %%xmm6\n\t"
+ " mulps %%xmm4, %%xmm2\n\t"
+ " movaps 32(%%eax), %%xmm0\n\t"
+ " addps %%xmm2, %%xmm7\n\t"
+ " mulps %%xmm5, %%xmm3\n\t"
+ " addl $32, %%eax\n\t"
+ " movaps 32(%%edx), %%xmm2\n\t"
+ " addps %%xmm3, %%xmm7\n\t"
+ " addl $32, %%edx\n\t"
+ ".%=L1_test:\n\t"
+ " decl %%ecx\n\t"
+ " jge .%=Loop1\n\t"
+ " # We've handled the bulk of multiplies up to here.\n\t"
+ " # Let's sse if original n_2_ccomplex_blocks was odd.\n\t"
+ " # If so, we've got 2 more taps to do.\n\t"
+ " movl 20(%%ebp), %%ecx # n_2_ccomplex_blocks\n\t"
+ " shrl $4, %%ecx\n\t"
+ " andl $1, %%ecx\n\t"
+ " je .%=Leven\n\t"
+ " # The count was odd, do 2 more taps.\n\t"
+ " # Note that we've already got mm0/mm2 preloaded\n\t"
+ " # from the main loop.\n\t"
+ " movaps %%xmm0, %%xmm4\n\t"
+ " mulps %%xmm2, %%xmm0\n\t"
+ " shufps $0xb1, %%xmm4, %%xmm4 # swap internals\n\t"
+ " addps %%xmm0, %%xmm6\n\t"
+ " mulps %%xmm4, %%xmm2\n\t"
+ " addps %%xmm2, %%xmm7\n\t"
+ ".%=Leven:\n\t"
+ " # neg inversor\n\t"
+ " movl 8(%%ebp), %%eax \n\t"
+ " xorps %%xmm1, %%xmm1\n\t"
+ " movl $0x80000000, (%%eax)\n\t"
+ " movss (%%eax), %%xmm1\n\t"
+ " shufps $0x11, %%xmm1, %%xmm1 # b00010001 # 0 -0 0 -0\n\t"
+ " # pfpnacc\n\t"
+ " xorps %%xmm1, %%xmm6\n\t"
+ " movaps %%xmm6, %%xmm2\n\t"
+ " unpcklps %%xmm7, %%xmm6\n\t"
+ " unpckhps %%xmm7, %%xmm2\n\t"
+ " movaps %%xmm2, %%xmm3\n\t"
+ " shufps $0x44, %%xmm6, %%xmm2 # b01000100\n\t"
+ " shufps $0xee, %%xmm3, %%xmm6 # b11101110\n\t"
+ " addps %%xmm2, %%xmm6\n\t"
+ " # xmm6 = r1 i2 r3 i4\n\t"
+ " #movl 8(%%ebp), %%eax # @result\n\t"
+ " movhlps %%xmm6, %%xmm4 # xmm4 = r3 i4 ?? ??\n\t"
+ " addps %%xmm4, %%xmm6 # xmm6 = r1+r3 i2+i4 ?? ??\n\t"
+ " movlps %%xmm6, (%%eax) # store low 2x32 bits (complex) to memory\n\t"
+ " #popl %%ebp\n\t"
+ :
+ :
+ : "eax", "ecx", "edx"
+ );
+
+
+ int getem = num_bytes % 16;
+
+ for(; getem > 0; getem -= 8) {
+
+
+ *result += (input[(num_bytes >> 3) - 1] * taps[(num_bytes >> 3) - 1]);
+
+ }
+
+ return;
+#endif
+}
+
+#endif /*LV_HAVE_SSE*/
+
+#ifdef LV_HAVE_SSE3
+
+#include <pmmintrin.h>
+
+static inline void volk_32fc_x2_dot_prod_32fc_a_sse3(lv_32fc_t* result, const lv_32fc_t* input, const lv_32fc_t* taps, unsigned int num_bytes) {
+
+
+ lv_32fc_t dotProduct;
+ memset(&dotProduct, 0x0, 2*sizeof(float));
+
+ unsigned int number = 0;
+ const unsigned int halfPoints = num_bytes >> 4;
+
+ __m128 x, y, yl, yh, z, tmp1, tmp2, dotProdVal;
+
+ const lv_32fc_t* a = input;
+ const lv_32fc_t* b = taps;
+
+ dotProdVal = _mm_setzero_ps();
+
+ for(;number < halfPoints; number++){
+
+ x = _mm_load_ps((float*)a); // Load the ar + ai, br + bi as ar,ai,br,bi
+ y = _mm_load_ps((float*)b); // Load the cr + ci, dr + di as cr,ci,dr,di
+
+ yl = _mm_moveldup_ps(y); // Load yl with cr,cr,dr,dr
+ yh = _mm_movehdup_ps(y); // Load yh with ci,ci,di,di
+
+ tmp1 = _mm_mul_ps(x,yl); // tmp1 = ar*cr,ai*cr,br*dr,bi*dr
+
+ x = _mm_shuffle_ps(x,x,0xB1); // Re-arrange x to be ai,ar,bi,br
+
+ tmp2 = _mm_mul_ps(x,yh); // tmp2 = ai*ci,ar*ci,bi*di,br*di
+
+ z = _mm_addsub_ps(tmp1,tmp2); // ar*cr-ai*ci, ai*cr+ar*ci, br*dr-bi*di, bi*dr+br*di
+
+ dotProdVal = _mm_add_ps(dotProdVal, z); // Add the complex multiplication results together
+
+ a += 2;
+ b += 2;
+ }
+
+ __VOLK_ATTR_ALIGNED(16) lv_32fc_t dotProductVector[2];
+
+ _mm_store_ps((float*)dotProductVector,dotProdVal); // Store the results back into the dot product vector
+
+ dotProduct += ( dotProductVector[0] + dotProductVector[1] );
+
+ if(((num_bytes >> 3) & 1) != 0) {
+ dotProduct += (*a) * (*b);
+ }
+
+ *result = dotProduct;
+}
+
+#endif /*LV_HAVE_SSE3*/
+
+#ifdef LV_HAVE_SSE4_1
+
+#include <smmintrin.h>
+
+static inline void volk_32fc_x2_dot_prod_32fc_a_sse4_1(lv_32fc_t* result, const lv_32fc_t* input, const lv_32fc_t* taps, unsigned int num_bytes) {
+
+ __m128 xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, real0, real1, im0, im1;
+ float *p_input, *p_taps;
+ __m64 *p_result;
+
+ p_result = (__m64*)result;
+ p_input = (float*)input;
+ p_taps = (float*)taps;
+
+ static const __m128i neg = {0x000000000000000080000000};
+
+ int i = 0;
+
+ int bound = (num_bytes >> 5);
+ int leftovers = (num_bytes & 24) >> 3;
+
+ real0 = _mm_sub_ps(real0, real0);
+ real1 = _mm_sub_ps(real1, real1);
+ im0 = _mm_sub_ps(im0, im0);
+ im1 = _mm_sub_ps(im1, im1);
+
+ for(; i < bound; ++i) {
+
+
+ xmm0 = _mm_load_ps(p_input);
+ xmm1 = _mm_load_ps(p_taps);
+
+ p_input += 4;
+ p_taps += 4;
+
+ xmm2 = _mm_load_ps(p_input);
+ xmm3 = _mm_load_ps(p_taps);
+
+ p_input += 4;
+ p_taps += 4;
+
+ xmm4 = _mm_unpackhi_ps(xmm0, xmm2);
+ xmm5 = _mm_unpackhi_ps(xmm1, xmm3);
+ xmm0 = _mm_unpacklo_ps(xmm0, xmm2);
+ xmm2 = _mm_unpacklo_ps(xmm1, xmm3);
+
+ //imaginary vector from input
+ xmm1 = _mm_unpackhi_ps(xmm0, xmm4);
+ //real vector from input
+ xmm3 = _mm_unpacklo_ps(xmm0, xmm4);
+ //imaginary vector from taps
+ xmm0 = _mm_unpackhi_ps(xmm2, xmm5);
+ //real vector from taps
+ xmm2 = _mm_unpacklo_ps(xmm2, xmm5);
+
+ xmm4 = _mm_dp_ps(xmm3, xmm2, 0xf1);
+ xmm5 = _mm_dp_ps(xmm1, xmm0, 0xf1);
+
+ xmm6 = _mm_dp_ps(xmm3, xmm0, 0xf2);
+ xmm7 = _mm_dp_ps(xmm1, xmm2, 0xf2);
+
+ real0 = _mm_add_ps(xmm4, real0);
+ real1 = _mm_add_ps(xmm5, real1);
+ im0 = _mm_add_ps(xmm6, im0);
+ im1 = _mm_add_ps(xmm7, im1);
+
+ }
+
+ real1 = _mm_xor_ps(real1, bit128_p(&neg)->float_vec);
+
+ im0 = _mm_add_ps(im0, im1);
+ real0 = _mm_add_ps(real0, real1);
+
+ im0 = _mm_add_ps(im0, real0);
+
+ _mm_storel_pi(p_result, im0);
+
+ for(i = bound * 4; i < (bound * 4) + leftovers; ++i) {
+
+ *result += input[i] * taps[i];
+ }
+}
+
+#endif /*LV_HAVE_SSE4_1*/
+
+#endif /*INCLUDED_volk_32fc_x2_dot_prod_32fc_a_H*/
diff --git a/volk/include/volk/volk_32fc_x2_dot_prod_32fc_u.h b/volk/include/volk/volk_32fc_x2_dot_prod_32fc_u.h
new file mode 100644
index 000000000..7c0dba7fd
--- /dev/null
+++ b/volk/include/volk/volk_32fc_x2_dot_prod_32fc_u.h
@@ -0,0 +1,116 @@
+#ifndef INCLUDED_volk_32fc_x2_dot_prod_32fc_u_H
+#define INCLUDED_volk_32fc_x2_dot_prod_32fc_u_H
+
+#include <volk/volk_common.h>
+#include <volk/volk_complex.h>
+#include <stdio.h>
+#include <string.h>
+
+
+#ifdef LV_HAVE_GENERIC
+
+
+static inline void volk_32fc_x2_dot_prod_32fc_u_generic(lv_32fc_t* result, const lv_32fc_t* input, const lv_32fc_t* taps, unsigned int num_points) {
+
+ float * res = (float*) result;
+ float * in = (float*) input;
+ float * tp = (float*) taps;
+ unsigned int n_2_ccomplex_blocks = num_points/2;
+ unsigned int isodd = num_points &1;
+
+
+
+ float sum0[2] = {0,0};
+ float sum1[2] = {0,0};
+ unsigned int i = 0;
+
+
+ for(i = 0; i < n_2_ccomplex_blocks; ++i) {
+
+
+ sum0[0] += in[0] * tp[0] - in[1] * tp[1];
+ sum0[1] += in[0] * tp[1] + in[1] * tp[0];
+ sum1[0] += in[2] * tp[2] - in[3] * tp[3];
+ sum1[1] += in[2] * tp[3] + in[3] * tp[2];
+
+
+ in += 4;
+ tp += 4;
+
+ }
+
+
+ res[0] = sum0[0] + sum1[0];
+ res[1] = sum0[1] + sum1[1];
+
+
+
+ for(i = 0; i < isodd; ++i) {
+
+
+ *result += input[num_points - 1] * taps[num_points - 1];
+
+ }
+
+}
+
+#endif /*LV_HAVE_GENERIC*/
+
+#ifdef LV_HAVE_SSE3
+
+#include <pmmintrin.h>
+
+static inline void volk_32fc_x2_dot_prod_32fc_u_sse3(lv_32fc_t* result, const lv_32fc_t* input, const lv_32fc_t* taps, unsigned int num_points) {
+
+
+ lv_32fc_t dotProduct;
+ memset(&dotProduct, 0x0, 2*sizeof(float));
+
+ unsigned int number = 0;
+ const unsigned int halfPoints = num_points/2;
+
+ __m128 x, y, yl, yh, z, tmp1, tmp2, dotProdVal;
+
+ const lv_32fc_t* a = input;
+ const lv_32fc_t* b = taps;
+
+ dotProdVal = _mm_setzero_ps();
+
+ for(;number < halfPoints; number++){
+
+ x = _mm_loadu_ps((float*)a); // Load the ar + ai, br + bi as ar,ai,br,bi
+ y = _mm_loadu_ps((float*)b); // Load the cr + ci, dr + di as cr,ci,dr,di
+
+ yl = _mm_moveldup_ps(y); // Load yl with cr,cr,dr,dr
+ yh = _mm_movehdup_ps(y); // Load yh with ci,ci,di,di
+
+ tmp1 = _mm_mul_ps(x,yl); // tmp1 = ar*cr,ai*cr,br*dr,bi*dr
+
+ x = _mm_shuffle_ps(x,x,0xB1); // Re-arrange x to be ai,ar,bi,br
+
+ tmp2 = _mm_mul_ps(x,yh); // tmp2 = ai*ci,ar*ci,bi*di,br*di
+
+ z = _mm_addsub_ps(tmp1,tmp2); // ar*cr-ai*ci, ai*cr+ar*ci, br*dr-bi*di, bi*dr+br*di
+
+ dotProdVal = _mm_add_ps(dotProdVal, z); // Add the complex multiplication results together
+
+ a += 2;
+ b += 2;
+ }
+
+ __VOLK_ATTR_ALIGNED(16) lv_32fc_t dotProductVector[2];
+
+ _mm_storeu_ps((float*)dotProductVector,dotProdVal); // Store the results back into the dot product vector
+
+ dotProduct += ( dotProductVector[0] + dotProductVector[1] );
+
+ if(num_points % 1 != 0) {
+ dotProduct += (*a) * (*b);
+ }
+
+ *result = dotProduct;
+}
+
+#endif /*LV_HAVE_SSE3*/
+
+#endif /*INCLUDED_volk_32fc_x2_dot_prod_32fc_u_H*/
diff --git a/volk/include/volk/volk_32fc_x2_multiply_32fc_a.h b/volk/include/volk/volk_32fc_x2_multiply_32fc_a.h
new file mode 100644
index 000000000..f79ddb59b
--- /dev/null
+++ b/volk/include/volk/volk_32fc_x2_multiply_32fc_a.h
@@ -0,0 +1,93 @@
+#ifndef INCLUDED_volk_32fc_x2_multiply_32fc_a_H
+#define INCLUDED_volk_32fc_x2_multiply_32fc_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+#include <volk/volk_complex.h>
+#include <float.h>
+
+#ifdef LV_HAVE_SSE3
+#include <pmmintrin.h>
+ /*!
+ \brief Multiplies the two input complex vectors and stores their results in the third vector
+ \param cVector The vector where the results will be stored
+ \param aVector One of the vectors to be multiplied
+ \param bVector One of the vectors to be multiplied
+ \param num_points The number of complex values in aVector and bVector to be multiplied together and stored into cVector
+ */
+static inline void volk_32fc_x2_multiply_32fc_a_sse3(lv_32fc_t* cVector, const lv_32fc_t* aVector, const lv_32fc_t* bVector, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int halfPoints = num_points / 2;
+
+ __m128 x, y, yl, yh, z, tmp1, tmp2;
+ lv_32fc_t* c = cVector;
+ const lv_32fc_t* a = aVector;
+ const lv_32fc_t* b = bVector;
+ for(;number < halfPoints; number++){
+
+ x = _mm_load_ps((float*)a); // Load the ar + ai, br + bi as ar,ai,br,bi
+ y = _mm_load_ps((float*)b); // Load the cr + ci, dr + di as cr,ci,dr,di
+
+ yl = _mm_moveldup_ps(y); // Load yl with cr,cr,dr,dr
+ yh = _mm_movehdup_ps(y); // Load yh with ci,ci,di,di
+
+ tmp1 = _mm_mul_ps(x,yl); // tmp1 = ar*cr,ai*cr,br*dr,bi*dr
+
+ x = _mm_shuffle_ps(x,x,0xB1); // Re-arrange x to be ai,ar,bi,br
+
+ tmp2 = _mm_mul_ps(x,yh); // tmp2 = ai*ci,ar*ci,bi*di,br*di
+
+ z = _mm_addsub_ps(tmp1,tmp2); // ar*cr-ai*ci, ai*cr+ar*ci, br*dr-bi*di, bi*dr+br*di
+
+ _mm_store_ps((float*)c,z); // Store the results back into the C container
+
+ a += 2;
+ b += 2;
+ c += 2;
+ }
+
+ if((num_points % 2) != 0) {
+ *c = (*a) * (*b);
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+ /*!
+ \brief Multiplies the two input complex vectors and stores their results in the third vector
+ \param cVector The vector where the results will be stored
+ \param aVector One of the vectors to be multiplied
+ \param bVector One of the vectors to be multiplied
+ \param num_points The number of complex values in aVector and bVector to be multiplied together and stored into cVector
+ */
+static inline void volk_32fc_x2_multiply_32fc_a_generic(lv_32fc_t* cVector, const lv_32fc_t* aVector, const lv_32fc_t* bVector, unsigned int num_points){
+ lv_32fc_t* cPtr = cVector;
+ const lv_32fc_t* aPtr = aVector;
+ const lv_32fc_t* bPtr= bVector;
+ unsigned int number = 0;
+
+ for(number = 0; number < num_points; number++){
+ *cPtr++ = (*aPtr++) * (*bPtr++);
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+#ifdef LV_HAVE_ORC
+ /*!
+ \brief Multiplies the two input complex vectors and stores their results in the third vector
+ \param cVector The vector where the results will be stored
+ \param aVector One of the vectors to be multiplied
+ \param bVector One of the vectors to be multiplied
+ \param num_points The number of complex values in aVector and bVector to be multiplied together and stored into cVector
+ */
+extern void volk_32fc_x2_multiply_32fc_a_orc_impl(lv_32fc_t* cVector, const lv_32fc_t* aVector, const lv_32fc_t* bVector, unsigned int num_points);
+static inline void volk_32fc_x2_multiply_32fc_a_orc(lv_32fc_t* cVector, const lv_32fc_t* aVector, const lv_32fc_t* bVector, unsigned int num_points){
+ volk_32fc_x2_multiply_32fc_a_orc_impl(cVector, aVector, bVector, num_points);
+}
+#endif /* LV_HAVE_ORC */
+
+
+
+
+
+#endif /* INCLUDED_volk_32fc_x2_multiply_32fc_a_H */
diff --git a/volk/include/volk/volk_32fc_x2_multiply_32fc_u.h b/volk/include/volk/volk_32fc_x2_multiply_32fc_u.h
new file mode 100644
index 000000000..a998d6184
--- /dev/null
+++ b/volk/include/volk/volk_32fc_x2_multiply_32fc_u.h
@@ -0,0 +1,77 @@
+#ifndef INCLUDED_volk_32fc_x2_multiply_32fc_u_H
+#define INCLUDED_volk_32fc_x2_multiply_32fc_u_H
+
+#include <inttypes.h>
+#include <stdio.h>
+#include <volk/volk_complex.h>
+#include <float.h>
+
+#ifdef LV_HAVE_SSE3
+#include <pmmintrin.h>
+ /*!
+ \brief Multiplies the two input complex vectors and stores their results in the third vector
+ \param cVector The vector where the results will be stored
+ \param aVector One of the vectors to be multiplied
+ \param bVector One of the vectors to be multiplied
+ \param num_points The number of complex values in aVector and bVector to be multiplied together and stored into cVector
+ */
+static inline void volk_32fc_x2_multiply_32fc_u_sse3(lv_32fc_t* cVector, const lv_32fc_t* aVector, const lv_32fc_t* bVector, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int halfPoints = num_points / 2;
+
+ __m128 x, y, yl, yh, z, tmp1, tmp2;
+ lv_32fc_t* c = cVector;
+ const lv_32fc_t* a = aVector;
+ const lv_32fc_t* b = bVector;
+
+ for(;number < halfPoints; number++){
+
+ x = _mm_loadu_ps((float*)a); // Load the ar + ai, br + bi as ar,ai,br,bi
+ y = _mm_loadu_ps((float*)b); // Load the cr + ci, dr + di as cr,ci,dr,di
+
+ yl = _mm_moveldup_ps(y); // Load yl with cr,cr,dr,dr
+ yh = _mm_movehdup_ps(y); // Load yh with ci,ci,di,di
+
+ tmp1 = _mm_mul_ps(x,yl); // tmp1 = ar*cr,ai*cr,br*dr,bi*dr
+
+ x = _mm_shuffle_ps(x,x,0xB1); // Re-arrange x to be ai,ar,bi,br
+
+ tmp2 = _mm_mul_ps(x,yh); // tmp2 = ai*ci,ar*ci,bi*di,br*di
+
+ z = _mm_addsub_ps(tmp1,tmp2); // ar*cr-ai*ci, ai*cr+ar*ci, br*dr-bi*di, bi*dr+br*di
+
+ _mm_storeu_ps((float*)c,z); // Store the results back into the C container
+
+ a += 2;
+ b += 2;
+ c += 2;
+ }
+
+ if((num_points % 2) != 0) {
+ *c = (*a) * (*b);
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+ /*!
+ \brief Multiplies the two input complex vectors and stores their results in the third vector
+ \param cVector The vector where the results will be stored
+ \param aVector One of the vectors to be multiplied
+ \param bVector One of the vectors to be multiplied
+ \param num_points The number of complex values in aVector and bVector to be multiplied together and stored into cVector
+ */
+static inline void volk_32fc_x2_multiply_32fc_u_generic(lv_32fc_t* cVector, const lv_32fc_t* aVector, const lv_32fc_t* bVector, unsigned int num_points){
+ lv_32fc_t* cPtr = cVector;
+ const lv_32fc_t* aPtr = aVector;
+ const lv_32fc_t* bPtr= bVector;
+ unsigned int number = 0;
+
+ for(number = 0; number < num_points; number++){
+ *cPtr++ = (*aPtr++) * (*bPtr++);
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+#endif /* INCLUDED_volk_32fc_x2_multiply_32fc_u_H */
diff --git a/volk/include/volk/volk_32fc_x2_multiply_conjugate_32fc_a.h b/volk/include/volk/volk_32fc_x2_multiply_conjugate_32fc_a.h
new file mode 100644
index 000000000..2755192e9
--- /dev/null
+++ b/volk/include/volk/volk_32fc_x2_multiply_conjugate_32fc_a.h
@@ -0,0 +1,81 @@
+#ifndef INCLUDED_volk_32fc_x2_multiply_conjugate_32fc_a_H
+#define INCLUDED_volk_32fc_x2_multiply_conjugate_32fc_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+#include <volk/volk_complex.h>
+#include <float.h>
+
+#ifdef LV_HAVE_SSE3
+#include <pmmintrin.h>
+ /*!
+ \brief Multiplies vector a by the conjugate of vector b and stores the results in the third vector
+ \param cVector The vector where the results will be stored
+ \param aVector First vector to be multiplied
+ \param bVector Second vector that is conjugated before being multiplied
+ \param num_points The number of complex values in aVector and bVector to be multiplied together and stored into cVector
+ */
+static inline void volk_32fc_x2_multiply_conjugate_32fc_a_sse3(lv_32fc_t* cVector, const lv_32fc_t* aVector, const lv_32fc_t* bVector, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int halfPoints = num_points / 2;
+
+ __m128 x, y, yl, yh, z, tmp1, tmp2;
+ lv_32fc_t* c = cVector;
+ const lv_32fc_t* a = aVector;
+ const lv_32fc_t* b = bVector;
+
+ __m128 conjugator = _mm_setr_ps(0, -0.f, 0, -0.f);
+
+ for(;number < halfPoints; number++){
+
+ x = _mm_load_ps((float*)a); // Load the ar + ai, br + bi as ar,ai,br,bi
+ y = _mm_load_ps((float*)b); // Load the cr + ci, dr + di as cr,ci,dr,di
+
+ y = _mm_xor_ps(y, conjugator); // conjugate y
+
+ yl = _mm_moveldup_ps(y); // Load yl with cr,cr,dr,dr
+ yh = _mm_movehdup_ps(y); // Load yh with ci,ci,di,di
+
+ tmp1 = _mm_mul_ps(x,yl); // tmp1 = ar*cr,ai*cr,br*dr,bi*dr
+
+ x = _mm_shuffle_ps(x,x,0xB1); // Re-arrange x to be ai,ar,bi,br
+
+ tmp2 = _mm_mul_ps(x,yh); // tmp2 = ai*ci,ar*ci,bi*di,br*di
+
+ z = _mm_addsub_ps(tmp1,tmp2); // ar*cr-ai*ci, ai*cr+ar*ci, br*dr-bi*di, bi*dr+br*di
+
+ _mm_store_ps((float*)c,z); // Store the results back into the C container
+
+ a += 2;
+ b += 2;
+ c += 2;
+ }
+
+ if((num_points % 2) != 0) {
+ *c = (*a) * lv_conj(*b);
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+ /*!
+ \brief Multiplies vector a by the conjugate of vector b and stores the results in the third vector
+ \param cVector The vector where the results will be stored
+ \param aVector First vector to be multiplied
+ \param bVector Second vector that is conjugated before being multiplied
+ \param num_points The number of complex values in aVector and bVector to be multiplied together and stored into cVector
+ */
+static inline void volk_32fc_x2_multiply_conjugate_32fc_a_generic(lv_32fc_t* cVector, const lv_32fc_t* aVector, const lv_32fc_t* bVector, unsigned int num_points){
+ lv_32fc_t* cPtr = cVector;
+ const lv_32fc_t* aPtr = aVector;
+ const lv_32fc_t* bPtr= bVector;
+ unsigned int number = 0;
+
+ for(number = 0; number < num_points; number++){
+ *cPtr++ = (*aPtr++) * lv_conj(*bPtr++);
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+#endif /* INCLUDED_volk_32fc_x2_multiply_conjugate_32fc_a_H */
diff --git a/volk/include/volk/volk_32fc_x2_multiply_conjugate_32fc_u.h b/volk/include/volk/volk_32fc_x2_multiply_conjugate_32fc_u.h
new file mode 100644
index 000000000..09dcd635b
--- /dev/null
+++ b/volk/include/volk/volk_32fc_x2_multiply_conjugate_32fc_u.h
@@ -0,0 +1,81 @@
+#ifndef INCLUDED_volk_32fc_x2_multiply_conjugate_32fc_u_H
+#define INCLUDED_volk_32fc_x2_multiply_conjugate_32fc_u_H
+
+#include <inttypes.h>
+#include <stdio.h>
+#include <volk/volk_complex.h>
+#include <float.h>
+
+#ifdef LV_HAVE_SSE3
+#include <pmmintrin.h>
+ /*!
+ \brief Multiplies vector a by the conjugate of vector b and stores the results in the third vector
+ \param cVector The vector where the results will be stored
+ \param aVector First vector to be multiplied
+ \param bVector Second vector that is conjugated before being multiplied
+ \param num_points The number of complex values in aVector and bVector to be multiplied together and stored into cVector
+ */
+static inline void volk_32fc_x2_multiply_conjugate_32fc_u_sse3(lv_32fc_t* cVector, const lv_32fc_t* aVector, const lv_32fc_t* bVector, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int halfPoints = num_points / 2;
+
+ __m128 x, y, yl, yh, z, tmp1, tmp2;
+ lv_32fc_t* c = cVector;
+ const lv_32fc_t* a = aVector;
+ const lv_32fc_t* b = bVector;
+
+ __m128 conjugator = _mm_setr_ps(0, -0.f, 0, -0.f);
+
+ for(;number < halfPoints; number++){
+
+ x = _mm_loadu_ps((float*)a); // Load the ar + ai, br + bi as ar,ai,br,bi
+ y = _mm_loadu_ps((float*)b); // Load the cr + ci, dr + di as cr,ci,dr,di
+
+ y = _mm_xor_ps(y, conjugator); // conjugate y
+
+ yl = _mm_moveldup_ps(y); // Load yl with cr,cr,dr,dr
+ yh = _mm_movehdup_ps(y); // Load yh with ci,ci,di,di
+
+ tmp1 = _mm_mul_ps(x,yl); // tmp1 = ar*cr,ai*cr,br*dr,bi*dr
+
+ x = _mm_shuffle_ps(x,x,0xB1); // Re-arrange x to be ai,ar,bi,br
+
+ tmp2 = _mm_mul_ps(x,yh); // tmp2 = ai*ci,ar*ci,bi*di,br*di
+
+ z = _mm_addsub_ps(tmp1,tmp2); // ar*cr-ai*ci, ai*cr+ar*ci, br*dr-bi*di, bi*dr+br*di
+
+ _mm_storeu_ps((float*)c,z); // Store the results back into the C container
+
+ a += 2;
+ b += 2;
+ c += 2;
+ }
+
+ if((num_points % 2) != 0) {
+ *c = (*a) * lv_conj(*b);
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+ /*!
+ \brief Multiplies vector a by the conjugate of vector b and stores the results in the third vector
+ \param cVector The vector where the results will be stored
+ \param aVector First vector to be multiplied
+ \param bVector Second vector that is conjugated before being multiplied
+ \param num_points The number of complex values in aVector and bVector to be multiplied together and stored into cVector
+ */
+static inline void volk_32fc_x2_multiply_conjugate_32fc_u_generic(lv_32fc_t* cVector, const lv_32fc_t* aVector, const lv_32fc_t* bVector, unsigned int num_points){
+ lv_32fc_t* cPtr = cVector;
+ const lv_32fc_t* aPtr = aVector;
+ const lv_32fc_t* bPtr= bVector;
+ unsigned int number = 0;
+
+ for(number = 0; number < num_points; number++){
+ *cPtr++ = (*aPtr++) * lv_conj(*bPtr++);
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+#endif /* INCLUDED_volk_32fc_x2_multiply_conjugate_32fc_u_H */
diff --git a/volk/include/volk/volk_32fc_x2_s32f_square_dist_scalar_mult_32f_a.h b/volk/include/volk/volk_32fc_x2_s32f_square_dist_scalar_mult_32f_a.h
new file mode 100644
index 000000000..75eb9173d
--- /dev/null
+++ b/volk/include/volk/volk_32fc_x2_s32f_square_dist_scalar_mult_32f_a.h
@@ -0,0 +1,126 @@
+#ifndef INCLUDED_volk_32fc_x2_s32f_square_dist_scalar_mult_32f_a_H
+#define INCLUDED_volk_32fc_x2_s32f_square_dist_scalar_mult_32f_a_H
+
+#include<inttypes.h>
+#include<stdio.h>
+#include<volk/volk_complex.h>
+#include <string.h>
+
+#ifdef LV_HAVE_SSE3
+#include<xmmintrin.h>
+#include<pmmintrin.h>
+
+static inline void volk_32fc_x2_s32f_square_dist_scalar_mult_32f_a_sse3(float* target, lv_32fc_t* src0, lv_32fc_t* points, float scalar, unsigned int num_bytes) {
+
+
+ __m128 xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, xmm8;
+
+ lv_32fc_t diff;
+ memset(&diff, 0x0, 2*sizeof(float));
+
+ float sq_dist = 0.0;
+ int bound = num_bytes >> 5;
+ int leftovers0 = (num_bytes >> 4) & 1;
+ int leftovers1 = (num_bytes >> 3) & 1;
+ int i = 0;
+
+
+
+ xmm1 = _mm_setzero_ps();
+ xmm1 = _mm_loadl_pi(xmm1, (__m64*)src0);
+ xmm2 = _mm_load_ps((float*)&points[0]);
+ xmm8 = _mm_load1_ps(&scalar);
+ xmm1 = _mm_movelh_ps(xmm1, xmm1);
+ xmm3 = _mm_load_ps((float*)&points[2]);
+
+
+ for(; i < bound - 1; ++i) {
+
+ xmm4 = _mm_sub_ps(xmm1, xmm2);
+ xmm5 = _mm_sub_ps(xmm1, xmm3);
+ points += 4;
+ xmm6 = _mm_mul_ps(xmm4, xmm4);
+ xmm7 = _mm_mul_ps(xmm5, xmm5);
+
+ xmm2 = _mm_load_ps((float*)&points[0]);
+
+ xmm4 = _mm_hadd_ps(xmm6, xmm7);
+
+ xmm3 = _mm_load_ps((float*)&points[2]);
+
+ xmm4 = _mm_mul_ps(xmm4, xmm8);
+
+ _mm_store_ps(target, xmm4);
+
+ target += 4;
+
+ }
+
+ xmm4 = _mm_sub_ps(xmm1, xmm2);
+ xmm5 = _mm_sub_ps(xmm1, xmm3);
+
+
+
+ points += 4;
+ xmm6 = _mm_mul_ps(xmm4, xmm4);
+ xmm7 = _mm_mul_ps(xmm5, xmm5);
+
+ xmm4 = _mm_hadd_ps(xmm6, xmm7);
+
+ xmm4 = _mm_mul_ps(xmm4, xmm8);
+
+ _mm_store_ps(target, xmm4);
+
+ target += 4;
+
+
+ for(i = 0; i < leftovers0; ++i) {
+
+ xmm2 = _mm_load_ps((float*)&points[0]);
+
+ xmm4 = _mm_sub_ps(xmm1, xmm2);
+
+ points += 2;
+
+ xmm6 = _mm_mul_ps(xmm4, xmm4);
+
+ xmm4 = _mm_hadd_ps(xmm6, xmm6);
+
+ xmm4 = _mm_mul_ps(xmm4, xmm8);
+
+ _mm_storeh_pi((__m64*)target, xmm4);
+
+ target += 2;
+ }
+
+ for(i = 0; i < leftovers1; ++i) {
+
+ diff = src0[0] - points[0];
+
+ sq_dist = scalar * (lv_creal(diff) * lv_creal(diff) + lv_cimag(diff) * lv_cimag(diff));
+
+ target[0] = sq_dist;
+ }
+}
+
+#endif /*LV_HAVE_SSE3*/
+
+#ifdef LV_HAVE_GENERIC
+static inline void volk_32fc_x2_s32f_square_dist_scalar_mult_32f_a_generic(float* target, lv_32fc_t* src0, lv_32fc_t* points, float scalar, unsigned int num_bytes) {
+ lv_32fc_t diff;
+ float sq_dist;
+ unsigned int i = 0;
+
+ for(; i < num_bytes >> 3; ++i) {
+ diff = src0[0] - points[i];
+
+ sq_dist = scalar * (lv_creal(diff) * lv_creal(diff) + lv_cimag(diff) * lv_cimag(diff));
+
+ target[i] = sq_dist;
+ }
+}
+
+#endif /*LV_HAVE_GENERIC*/
+
+
+#endif /*INCLUDED_volk_32fc_x2_s32f_square_dist_scalar_mult_32f_a_H*/
diff --git a/volk/include/volk/volk_32fc_x2_square_dist_32f_a.h b/volk/include/volk/volk_32fc_x2_square_dist_32f_a.h
new file mode 100644
index 000000000..b819eaffd
--- /dev/null
+++ b/volk/include/volk/volk_32fc_x2_square_dist_32f_a.h
@@ -0,0 +1,112 @@
+#ifndef INCLUDED_volk_32fc_x2_square_dist_32f_a_H
+#define INCLUDED_volk_32fc_x2_square_dist_32f_a_H
+
+#include<inttypes.h>
+#include<stdio.h>
+#include<volk/volk_complex.h>
+
+#ifdef LV_HAVE_SSE3
+#include<xmmintrin.h>
+#include<pmmintrin.h>
+
+static inline void volk_32fc_x2_square_dist_32f_a_sse3(float* target, lv_32fc_t* src0, lv_32fc_t* points, unsigned int num_bytes) {
+
+
+ __m128 xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7;
+
+ lv_32fc_t diff;
+ float sq_dist;
+ int bound = num_bytes >> 5;
+ int leftovers0 = (num_bytes >> 4) & 1;
+ int leftovers1 = (num_bytes >> 3) & 1;
+ int i = 0;
+
+ xmm1 = _mm_setzero_ps();
+ xmm1 = _mm_loadl_pi(xmm1, (__m64*)src0);
+ xmm2 = _mm_load_ps((float*)&points[0]);
+ xmm1 = _mm_movelh_ps(xmm1, xmm1);
+ xmm3 = _mm_load_ps((float*)&points[2]);
+
+
+ for(; i < bound - 1; ++i) {
+ xmm4 = _mm_sub_ps(xmm1, xmm2);
+ xmm5 = _mm_sub_ps(xmm1, xmm3);
+ points += 4;
+ xmm6 = _mm_mul_ps(xmm4, xmm4);
+ xmm7 = _mm_mul_ps(xmm5, xmm5);
+
+ xmm2 = _mm_load_ps((float*)&points[0]);
+
+ xmm4 = _mm_hadd_ps(xmm6, xmm7);
+
+ xmm3 = _mm_load_ps((float*)&points[2]);
+
+ _mm_store_ps(target, xmm4);
+
+ target += 4;
+
+ }
+
+ xmm4 = _mm_sub_ps(xmm1, xmm2);
+ xmm5 = _mm_sub_ps(xmm1, xmm3);
+
+
+
+ points += 4;
+ xmm6 = _mm_mul_ps(xmm4, xmm4);
+ xmm7 = _mm_mul_ps(xmm5, xmm5);
+
+ xmm4 = _mm_hadd_ps(xmm6, xmm7);
+
+ _mm_store_ps(target, xmm4);
+
+ target += 4;
+
+ for(i = 0; i < leftovers0; ++i) {
+
+ xmm2 = _mm_load_ps((float*)&points[0]);
+
+ xmm4 = _mm_sub_ps(xmm1, xmm2);
+
+ points += 2;
+
+ xmm6 = _mm_mul_ps(xmm4, xmm4);
+
+ xmm4 = _mm_hadd_ps(xmm6, xmm6);
+
+ _mm_storeh_pi((__m64*)target, xmm4);
+
+ target += 2;
+ }
+
+ for(i = 0; i < leftovers1; ++i) {
+
+ diff = src0[0] - points[0];
+
+ sq_dist = lv_creal(diff) * lv_creal(diff) + lv_cimag(diff) * lv_cimag(diff);
+
+ target[0] = sq_dist;
+ }
+}
+
+#endif /*LV_HAVE_SSE3*/
+
+#ifdef LV_HAVE_GENERIC
+static inline void volk_32fc_x2_square_dist_32f_a_generic(float* target, lv_32fc_t* src0, lv_32fc_t* points, unsigned int num_bytes) {
+ lv_32fc_t diff;
+ float sq_dist;
+ unsigned int i = 0;
+
+ for(; i < num_bytes >> 3; ++i) {
+ diff = src0[0] - points[i];
+
+ sq_dist = lv_creal(diff) * lv_creal(diff) + lv_cimag(diff) * lv_cimag(diff);
+
+ target[i] = sq_dist;
+ }
+}
+
+#endif /*LV_HAVE_GENERIC*/
+
+
+#endif /*INCLUDED_volk_32fc_x2_square_dist_32f_a_H*/
diff --git a/volk/include/volk/volk_32i_s32f_convert_32f_a.h b/volk/include/volk/volk_32i_s32f_convert_32f_a.h
new file mode 100644
index 000000000..8f4123d71
--- /dev/null
+++ b/volk/include/volk/volk_32i_s32f_convert_32f_a.h
@@ -0,0 +1,73 @@
+#ifndef INCLUDED_volk_32i_s32f_convert_32f_a_H
+#define INCLUDED_volk_32i_s32f_convert_32f_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE2
+#include <emmintrin.h>
+
+ /*!
+ \brief Converts the input 32 bit integer data into floating point data, and divides the each floating point output data point by the scalar value
+ \param inputVector The 32 bit input data buffer
+ \param outputVector The floating point output data buffer
+ \param scalar The value divided against each point in the output buffer
+ \param num_points The number of data values to be converted
+ */
+static inline void volk_32i_s32f_convert_32f_a_sse2(float* outputVector, const int32_t* inputVector, const float scalar, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+
+ float* outputVectorPtr = outputVector;
+ const float iScalar = 1.0 / scalar;
+ __m128 invScalar = _mm_set_ps1(iScalar);
+ int32_t* inputPtr = (int32_t*)inputVector;
+ __m128i inputVal;
+ __m128 ret;
+
+ for(;number < quarterPoints; number++){
+
+ // Load the 4 values
+ inputVal = _mm_load_si128((__m128i*)inputPtr);
+
+ ret = _mm_cvtepi32_ps(inputVal);
+ ret = _mm_mul_ps(ret, invScalar);
+
+ _mm_store_ps(outputVectorPtr, ret);
+
+ outputVectorPtr += 4;
+ inputPtr += 4;
+ }
+
+ number = quarterPoints * 4;
+ for(; number < num_points; number++){
+ outputVector[number] =((float)(inputVector[number])) * iScalar;
+ }
+}
+#endif /* LV_HAVE_SSE2 */
+
+
+#ifdef LV_HAVE_GENERIC
+ /*!
+ \brief Converts the input 32 bit integer data into floating point data, and divides the each floating point output data point by the scalar value
+ \param inputVector The 32 bit input data buffer
+ \param outputVector The floating point output data buffer
+ \param scalar The value divided against each point in the output buffer
+ \param num_points The number of data values to be converted
+ */
+static inline void volk_32i_s32f_convert_32f_a_generic(float* outputVector, const int32_t* inputVector, const float scalar, unsigned int num_points){
+ float* outputVectorPtr = outputVector;
+ const int32_t* inputVectorPtr = inputVector;
+ unsigned int number = 0;
+ const float iScalar = 1.0 / scalar;
+
+ for(number = 0; number < num_points; number++){
+ *outputVectorPtr++ = ((float)(*inputVectorPtr++)) * iScalar;
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_32i_s32f_convert_32f_a_H */
diff --git a/volk/include/volk/volk_32i_s32f_convert_32f_u.h b/volk/include/volk/volk_32i_s32f_convert_32f_u.h
new file mode 100644
index 000000000..b3a8ab201
--- /dev/null
+++ b/volk/include/volk/volk_32i_s32f_convert_32f_u.h
@@ -0,0 +1,75 @@
+#ifndef INCLUDED_volk_32i_s32f_convert_32f_u_H
+#define INCLUDED_volk_32i_s32f_convert_32f_u_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE2
+#include <emmintrin.h>
+
+ /*!
+ \brief Converts the input 32 bit integer data into floating point data, and divides the each floating point output data point by the scalar value
+ \param inputVector The 32 bit input data buffer
+ \param outputVector The floating point output data buffer
+ \param scalar The value divided against each point in the output buffer
+ \param num_points The number of data values to be converted
+ \note Output buffer does NOT need to be properly aligned
+ */
+static inline void volk_32i_s32f_convert_32f_u_sse2(float* outputVector, const int32_t* inputVector, const float scalar, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+
+ float* outputVectorPtr = outputVector;
+ const float iScalar = 1.0 / scalar;
+ __m128 invScalar = _mm_set_ps1(iScalar);
+ int32_t* inputPtr = (int32_t*)inputVector;
+ __m128i inputVal;
+ __m128 ret;
+
+ for(;number < quarterPoints; number++){
+
+ // Load the 4 values
+ inputVal = _mm_loadu_si128((__m128i*)inputPtr);
+
+ ret = _mm_cvtepi32_ps(inputVal);
+ ret = _mm_mul_ps(ret, invScalar);
+
+ _mm_storeu_ps(outputVectorPtr, ret);
+
+ outputVectorPtr += 4;
+ inputPtr += 4;
+ }
+
+ number = quarterPoints * 4;
+ for(; number < num_points; number++){
+ outputVector[number] =((float)(inputVector[number])) * iScalar;
+ }
+}
+#endif /* LV_HAVE_SSE2 */
+
+
+#ifdef LV_HAVE_GENERIC
+ /*!
+ \brief Converts the input 32 bit integer data into floating point data, and divides the each floating point output data point by the scalar value
+ \param inputVector The 32 bit input data buffer
+ \param outputVector The floating point output data buffer
+ \param scalar The value divided against each point in the output buffer
+ \param num_points The number of data values to be converted
+ \note Output buffer does NOT need to be properly aligned
+ */
+static inline void volk_32i_s32f_convert_32f_u_generic(float* outputVector, const int32_t* inputVector, const float scalar, unsigned int num_points){
+ float* outputVectorPtr = outputVector;
+ const int32_t* inputVectorPtr = inputVector;
+ unsigned int number = 0;
+ const float iScalar = 1.0 / scalar;
+
+ for(number = 0; number < num_points; number++){
+ *outputVectorPtr++ = ((float)(*inputVectorPtr++)) * iScalar;
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_32i_s32f_convert_32f_u_H */
diff --git a/volk/include/volk/volk_32i_x2_and_32i_a.h b/volk/include/volk/volk_32i_x2_and_32i_a.h
new file mode 100644
index 000000000..e5330847b
--- /dev/null
+++ b/volk/include/volk/volk_32i_x2_and_32i_a.h
@@ -0,0 +1,81 @@
+#ifndef INCLUDED_volk_32i_x2_and_32i_a_H
+#define INCLUDED_volk_32i_x2_and_32i_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+/*!
+ \brief Ands the two input vectors and store their results in the third vector
+ \param cVector The vector where the results will be stored
+ \param aVector One of the vectors
+ \param bVector One of the vectors
+ \param num_points The number of values in aVector and bVector to be anded together and stored into cVector
+*/
+static inline void volk_32i_x2_and_32i_a_sse(int32_t* cVector, const int32_t* aVector, const int32_t* bVector, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+
+ float* cPtr = (float*)cVector;
+ const float* aPtr = (float*)aVector;
+ const float* bPtr = (float*)bVector;
+
+ __m128 aVal, bVal, cVal;
+ for(;number < quarterPoints; number++){
+
+ aVal = _mm_load_ps(aPtr);
+ bVal = _mm_load_ps(bPtr);
+
+ cVal = _mm_and_ps(aVal, bVal);
+
+ _mm_store_ps(cPtr,cVal); // Store the results back into the C container
+
+ aPtr += 4;
+ bPtr += 4;
+ cPtr += 4;
+ }
+
+ number = quarterPoints * 4;
+ for(;number < num_points; number++){
+ cVector[number] = aVector[number] & bVector[number];
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Ands the two input vectors and store their results in the third vector
+ \param cVector The vector where the results will be stored
+ \param aVector One of the vectors
+ \param bVector One of the vectors
+ \param num_points The number of values in aVector and bVector to be anded together and stored into cVector
+*/
+static inline void volk_32i_x2_and_32i_a_generic(int32_t* cVector, const int32_t* aVector, const int32_t* bVector, unsigned int num_points){
+ int32_t* cPtr = cVector;
+ const int32_t* aPtr = aVector;
+ const int32_t* bPtr= bVector;
+ unsigned int number = 0;
+
+ for(number = 0; number < num_points; number++){
+ *cPtr++ = (*aPtr++) & (*bPtr++);
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+#ifdef LV_HAVE_ORC
+/*!
+ \brief Ands the two input vectors and store their results in the third vector
+ \param cVector The vector where the results will be stored
+ \param aVector One of the vectors
+ \param bVector One of the vectors
+ \param num_points The number of values in aVector and bVector to be anded together and stored into cVector
+*/
+extern void volk_32i_x2_and_32i_a_orc_impl(int32_t* cVector, const int32_t* aVector, const int32_t* bVector, unsigned int num_points);
+static inline void volk_32i_x2_and_32i_a_orc(int32_t* cVector, const int32_t* aVector, const int32_t* bVector, unsigned int num_points){
+ volk_32i_x2_and_32i_a_orc_impl(cVector, aVector, bVector, num_points);
+}
+#endif /* LV_HAVE_ORC */
+
+
+#endif /* INCLUDED_volk_32i_x2_and_32i_a_H */
diff --git a/volk/include/volk/volk_32i_x2_or_32i_a.h b/volk/include/volk/volk_32i_x2_or_32i_a.h
new file mode 100644
index 000000000..24045894c
--- /dev/null
+++ b/volk/include/volk/volk_32i_x2_or_32i_a.h
@@ -0,0 +1,81 @@
+#ifndef INCLUDED_volk_32i_x2_or_32i_a_H
+#define INCLUDED_volk_32i_x2_or_32i_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+/*!
+ \brief Ors the two input vectors and store their results in the third vector
+ \param cVector The vector where the results will be stored
+ \param aVector One of the vectors to be ored
+ \param bVector One of the vectors to be ored
+ \param num_points The number of values in aVector and bVector to be ored together and stored into cVector
+*/
+static inline void volk_32i_x2_or_32i_a_sse(int32_t* cVector, const int32_t* aVector, const int32_t* bVector, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+
+ float* cPtr = (float*)cVector;
+ const float* aPtr = (float*)aVector;
+ const float* bPtr = (float*)bVector;
+
+ __m128 aVal, bVal, cVal;
+ for(;number < quarterPoints; number++){
+
+ aVal = _mm_load_ps(aPtr);
+ bVal = _mm_load_ps(bPtr);
+
+ cVal = _mm_or_ps(aVal, bVal);
+
+ _mm_store_ps(cPtr,cVal); // Store the results back into the C container
+
+ aPtr += 4;
+ bPtr += 4;
+ cPtr += 4;
+ }
+
+ number = quarterPoints * 4;
+ for(;number < num_points; number++){
+ cVector[number] = aVector[number] | bVector[number];
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Ors the two input vectors and store their results in the third vector
+ \param cVector The vector where the results will be stored
+ \param aVector One of the vectors to be ored
+ \param bVector One of the vectors to be ored
+ \param num_points The number of values in aVector and bVector to be ored together and stored into cVector
+*/
+static inline void volk_32i_x2_or_32i_a_generic(int32_t* cVector, const int32_t* aVector, const int32_t* bVector, unsigned int num_points){
+ int32_t* cPtr = cVector;
+ const int32_t* aPtr = aVector;
+ const int32_t* bPtr= bVector;
+ unsigned int number = 0;
+
+ for(number = 0; number < num_points; number++){
+ *cPtr++ = (*aPtr++) | (*bPtr++);
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+#ifdef LV_HAVE_ORC
+/*!
+ \brief Ors the two input vectors and store their results in the third vector
+ \param cVector The vector where the results will be stored
+ \param aVector One of the vectors to be ored
+ \param bVector One of the vectors to be ored
+ \param num_points The number of values in aVector and bVector to be ored together and stored into cVector
+*/
+extern void volk_32i_x2_or_32i_a_orc_impl(int32_t* cVector, const int32_t* aVector, const int32_t* bVector, unsigned int num_points);
+static inline void volk_32i_x2_or_32i_a_orc(int32_t* cVector, const int32_t* aVector, const int32_t* bVector, unsigned int num_points){
+ volk_32i_x2_or_32i_a_orc_impl(cVector, aVector, bVector, num_points);
+}
+#endif /* LV_HAVE_ORC */
+
+
+#endif /* INCLUDED_volk_32i_x2_or_32i_a_H */
diff --git a/volk/include/volk/volk_32u_byteswap_a.h b/volk/include/volk/volk_32u_byteswap_a.h
new file mode 100644
index 000000000..71ae027d3
--- /dev/null
+++ b/volk/include/volk/volk_32u_byteswap_a.h
@@ -0,0 +1,77 @@
+#ifndef INCLUDED_volk_32u_byteswap_a_H
+#define INCLUDED_volk_32u_byteswap_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE2
+#include <emmintrin.h>
+
+/*!
+ \brief Byteswaps (in-place) an aligned vector of int32_t's.
+ \param intsToSwap The vector of data to byte swap
+ \param numDataPoints The number of data points
+*/
+static inline void volk_32u_byteswap_a_sse2(uint32_t* intsToSwap, unsigned int num_points){
+ unsigned int number = 0;
+
+ uint32_t* inputPtr = intsToSwap;
+ __m128i input, byte1, byte2, byte3, byte4, output;
+ __m128i byte2mask = _mm_set1_epi32(0x00FF0000);
+ __m128i byte3mask = _mm_set1_epi32(0x0000FF00);
+
+ const uint64_t quarterPoints = num_points / 4;
+ for(;number < quarterPoints; number++){
+ // Load the 32t values, increment inputPtr later since we're doing it in-place.
+ input = _mm_load_si128((__m128i*)inputPtr);
+ // Do the four shifts
+ byte1 = _mm_slli_epi32(input, 24);
+ byte2 = _mm_slli_epi32(input, 8);
+ byte3 = _mm_srli_epi32(input, 8);
+ byte4 = _mm_srli_epi32(input, 24);
+ // Or bytes together
+ output = _mm_or_si128(byte1, byte4);
+ byte2 = _mm_and_si128(byte2, byte2mask);
+ output = _mm_or_si128(output, byte2);
+ byte3 = _mm_and_si128(byte3, byte3mask);
+ output = _mm_or_si128(output, byte3);
+ // Store the results
+ _mm_store_si128((__m128i*)inputPtr, output);
+ inputPtr += 4;
+ }
+
+ // Byteswap any remaining points:
+ number = quarterPoints*4;
+ for(; number < num_points; number++){
+ uint32_t outputVal = *inputPtr;
+ outputVal = (((outputVal >> 24) & 0xff) | ((outputVal >> 8) & 0x0000ff00) | ((outputVal << 8) & 0x00ff0000) | ((outputVal << 24) & 0xff000000));
+ *inputPtr = outputVal;
+ inputPtr++;
+ }
+}
+#endif /* LV_HAVE_SSE2 */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Byteswaps (in-place) an aligned vector of int32_t's.
+ \param intsToSwap The vector of data to byte swap
+ \param numDataPoints The number of data points
+*/
+static inline void volk_32u_byteswap_a_generic(uint32_t* intsToSwap, unsigned int num_points){
+ uint32_t* inputPtr = intsToSwap;
+
+ unsigned int point;
+ for(point = 0; point < num_points; point++){
+ uint32_t output = *inputPtr;
+ output = (((output >> 24) & 0xff) | ((output >> 8) & 0x0000ff00) | ((output << 8) & 0x00ff0000) | ((output << 24) & 0xff000000));
+
+ *inputPtr = output;
+ inputPtr++;
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_32u_byteswap_a_H */
diff --git a/volk/include/volk/volk_32u_byteswap_u.h b/volk/include/volk/volk_32u_byteswap_u.h
new file mode 100644
index 000000000..e27d1f03d
--- /dev/null
+++ b/volk/include/volk/volk_32u_byteswap_u.h
@@ -0,0 +1,77 @@
+#ifndef INCLUDED_volk_32u_byteswap_u_H
+#define INCLUDED_volk_32u_byteswap_u_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE2
+#include <emmintrin.h>
+
+/*!
+ \brief Byteswaps (in-place) an aligned vector of int32_t's.
+ \param intsToSwap The vector of data to byte swap
+ \param numDataPoints The number of data points
+*/
+static inline void volk_32u_byteswap_u_sse2(uint32_t* intsToSwap, unsigned int num_points){
+ unsigned int number = 0;
+
+ uint32_t* inputPtr = intsToSwap;
+ __m128i input, byte1, byte2, byte3, byte4, output;
+ __m128i byte2mask = _mm_set1_epi32(0x00FF0000);
+ __m128i byte3mask = _mm_set1_epi32(0x0000FF00);
+
+ const uint64_t quarterPoints = num_points / 4;
+ for(;number < quarterPoints; number++){
+ // Load the 32t values, increment inputPtr later since we're doing it in-place.
+ input = _mm_loadu_si128((__m128i*)inputPtr);
+ // Do the four shifts
+ byte1 = _mm_slli_epi32(input, 24);
+ byte2 = _mm_slli_epi32(input, 8);
+ byte3 = _mm_srli_epi32(input, 8);
+ byte4 = _mm_srli_epi32(input, 24);
+ // Or bytes together
+ output = _mm_or_si128(byte1, byte4);
+ byte2 = _mm_and_si128(byte2, byte2mask);
+ output = _mm_or_si128(output, byte2);
+ byte3 = _mm_and_si128(byte3, byte3mask);
+ output = _mm_or_si128(output, byte3);
+ // Store the results
+ _mm_storeu_si128((__m128i*)inputPtr, output);
+ inputPtr += 4;
+ }
+
+ // Byteswap any remaining points:
+ number = quarterPoints*4;
+ for(; number < num_points; number++){
+ uint32_t outputVal = *inputPtr;
+ outputVal = (((outputVal >> 24) & 0xff) | ((outputVal >> 8) & 0x0000ff00) | ((outputVal << 8) & 0x00ff0000) | ((outputVal << 24) & 0xff000000));
+ *inputPtr = outputVal;
+ inputPtr++;
+ }
+}
+#endif /* LV_HAVE_SSE2 */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Byteswaps (in-place) an aligned vector of int32_t's.
+ \param intsToSwap The vector of data to byte swap
+ \param numDataPoints The number of data points
+*/
+static inline void volk_32u_byteswap_u_generic(uint32_t* intsToSwap, unsigned int num_points){
+ uint32_t* inputPtr = intsToSwap;
+
+ unsigned int point;
+ for(point = 0; point < num_points; point++){
+ uint32_t output = *inputPtr;
+ output = (((output >> 24) & 0xff) | ((output >> 8) & 0x0000ff00) | ((output << 8) & 0x00ff0000) | ((output << 24) & 0xff000000));
+
+ *inputPtr = output;
+ inputPtr++;
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_32u_byteswap_u_H */
diff --git a/volk/include/volk/volk_32u_popcnt_a.h b/volk/include/volk/volk_32u_popcnt_a.h
new file mode 100644
index 000000000..b72d605c6
--- /dev/null
+++ b/volk/include/volk/volk_32u_popcnt_a.h
@@ -0,0 +1,36 @@
+#ifndef INCLUDED_VOLK_32u_POPCNT_A16_H
+#define INCLUDED_VOLK_32u_POPCNT_A16_H
+
+#include <stdio.h>
+#include <inttypes.h>
+
+
+#ifdef LV_HAVE_GENERIC
+
+static inline void volk_32u_popcnt_a_generic(uint32_t* ret, const uint32_t value) {
+
+ // This is faster than a lookup table
+ uint32_t retVal = value;
+
+ retVal = (retVal & 0x55555555) + (retVal >> 1 & 0x55555555);
+ retVal = (retVal & 0x33333333) + (retVal >> 2 & 0x33333333);
+ retVal = (retVal + (retVal >> 4)) & 0x0F0F0F0F;
+ retVal = (retVal + (retVal >> 8));
+ retVal = (retVal + (retVal >> 16)) & 0x0000003F;
+
+ *ret = retVal;
+}
+
+#endif /*LV_HAVE_GENERIC*/
+
+#ifdef LV_HAVE_SSE4_2
+
+#include <nmmintrin.h>
+
+static inline void volk_32u_popcnt_a_sse4_2(uint32_t* ret, const uint32_t value) {
+ *ret = _mm_popcnt_u32(value);
+}
+
+#endif /*LV_HAVE_SSE4_2*/
+
+#endif /*INCLUDED_VOLK_32u_POPCNT_A16_H*/
diff --git a/volk/include/volk/volk_64f_convert_32f_a.h b/volk/include/volk/volk_64f_convert_32f_a.h
new file mode 100644
index 000000000..11d51702b
--- /dev/null
+++ b/volk/include/volk/volk_64f_convert_32f_a.h
@@ -0,0 +1,67 @@
+#ifndef INCLUDED_volk_64f_convert_32f_a_H
+#define INCLUDED_volk_64f_convert_32f_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE2
+#include <emmintrin.h>
+ /*!
+ \brief Converts the double values into float values
+ \param dVector The converted float vector values
+ \param fVector The double vector values to be converted
+ \param num_points The number of points in the two vectors to be converted
+ */
+static inline void volk_64f_convert_32f_a_sse2(float* outputVector, const double* inputVector, unsigned int num_points){
+ unsigned int number = 0;
+
+ const unsigned int quarterPoints = num_points / 4;
+
+ const double* inputVectorPtr = (const double*)inputVector;
+ float* outputVectorPtr = outputVector;
+ __m128 ret, ret2;
+ __m128d inputVal1, inputVal2;
+
+ for(;number < quarterPoints; number++){
+ inputVal1 = _mm_load_pd(inputVectorPtr); inputVectorPtr += 2;
+ inputVal2 = _mm_load_pd(inputVectorPtr); inputVectorPtr += 2;
+
+ ret = _mm_cvtpd_ps(inputVal1);
+ ret2 = _mm_cvtpd_ps(inputVal2);
+
+ ret = _mm_movelh_ps(ret, ret2);
+
+ _mm_store_ps(outputVectorPtr, ret);
+ outputVectorPtr += 4;
+ }
+
+ number = quarterPoints * 4;
+ for(; number < num_points; number++){
+ outputVector[number] = (float)(inputVector[number]);
+ }
+}
+#endif /* LV_HAVE_SSE2 */
+
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Converts the double values into float values
+ \param dVector The converted float vector values
+ \param fVector The double vector values to be converted
+ \param num_points The number of points in the two vectors to be converted
+*/
+static inline void volk_64f_convert_32f_a_generic(float* outputVector, const double* inputVector, unsigned int num_points){
+ float* outputVectorPtr = outputVector;
+ const double* inputVectorPtr = inputVector;
+ unsigned int number = 0;
+
+ for(number = 0; number < num_points; number++){
+ *outputVectorPtr++ = ((float)(*inputVectorPtr++));
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_64f_convert_32f_a_H */
diff --git a/volk/include/volk/volk_64f_convert_32f_u.h b/volk/include/volk/volk_64f_convert_32f_u.h
new file mode 100644
index 000000000..31dc5b5fe
--- /dev/null
+++ b/volk/include/volk/volk_64f_convert_32f_u.h
@@ -0,0 +1,67 @@
+#ifndef INCLUDED_volk_64f_convert_32f_u_H
+#define INCLUDED_volk_64f_convert_32f_u_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE2
+#include <emmintrin.h>
+ /*!
+ \brief Converts the double values into float values
+ \param dVector The converted float vector values
+ \param fVector The double vector values to be converted
+ \param num_points The number of points in the two vectors to be converted
+ */
+static inline void volk_64f_convert_32f_u_sse2(float* outputVector, const double* inputVector, unsigned int num_points){
+ unsigned int number = 0;
+
+ const unsigned int quarterPoints = num_points / 4;
+
+ const double* inputVectorPtr = (const double*)inputVector;
+ float* outputVectorPtr = outputVector;
+ __m128 ret, ret2;
+ __m128d inputVal1, inputVal2;
+
+ for(;number < quarterPoints; number++){
+ inputVal1 = _mm_loadu_pd(inputVectorPtr); inputVectorPtr += 2;
+ inputVal2 = _mm_loadu_pd(inputVectorPtr); inputVectorPtr += 2;
+
+ ret = _mm_cvtpd_ps(inputVal1);
+ ret2 = _mm_cvtpd_ps(inputVal2);
+
+ ret = _mm_movelh_ps(ret, ret2);
+
+ _mm_storeu_ps(outputVectorPtr, ret);
+ outputVectorPtr += 4;
+ }
+
+ number = quarterPoints * 4;
+ for(; number < num_points; number++){
+ outputVector[number] = (float)(inputVector[number]);
+ }
+}
+#endif /* LV_HAVE_SSE2 */
+
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Converts the double values into float values
+ \param dVector The converted float vector values
+ \param fVector The double vector values to be converted
+ \param num_points The number of points in the two vectors to be converted
+*/
+static inline void volk_64f_convert_32f_u_generic(float* outputVector, const double* inputVector, unsigned int num_points){
+ float* outputVectorPtr = outputVector;
+ const double* inputVectorPtr = inputVector;
+ unsigned int number = 0;
+
+ for(number = 0; number < num_points; number++){
+ *outputVectorPtr++ = ((float)(*inputVectorPtr++));
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_64f_convert_32f_u_H */
diff --git a/volk/include/volk/volk_64f_x2_max_64f_a.h b/volk/include/volk/volk_64f_x2_max_64f_a.h
new file mode 100644
index 000000000..33aae6d10
--- /dev/null
+++ b/volk/include/volk/volk_64f_x2_max_64f_a.h
@@ -0,0 +1,71 @@
+#ifndef INCLUDED_volk_64f_x2_max_64f_a_H
+#define INCLUDED_volk_64f_x2_max_64f_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE2
+#include <emmintrin.h>
+/*!
+ \brief Selects maximum value from each entry between bVector and aVector and store their results in the cVector
+ \param cVector The vector where the results will be stored
+ \param aVector The vector to be checked
+ \param bVector The vector to be checked
+ \param num_points The number of values in aVector and bVector to be checked and stored into cVector
+*/
+static inline void volk_64f_x2_max_64f_a_sse2(double* cVector, const double* aVector, const double* bVector, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int halfPoints = num_points / 2;
+
+ double* cPtr = cVector;
+ const double* aPtr = aVector;
+ const double* bPtr= bVector;
+
+ __m128d aVal, bVal, cVal;
+ for(;number < halfPoints; number++){
+
+ aVal = _mm_load_pd(aPtr);
+ bVal = _mm_load_pd(bPtr);
+
+ cVal = _mm_max_pd(aVal, bVal);
+
+ _mm_store_pd(cPtr,cVal); // Store the results back into the C container
+
+ aPtr += 2;
+ bPtr += 2;
+ cPtr += 2;
+ }
+
+ number = halfPoints * 2;
+ for(;number < num_points; number++){
+ const double a = *aPtr++;
+ const double b = *bPtr++;
+ *cPtr++ = ( a > b ? a : b);
+ }
+}
+#endif /* LV_HAVE_SSE2 */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Selects maximum value from each entry between bVector and aVector and store their results in the cVector
+ \param cVector The vector where the results will be stored
+ \param aVector The vector to be checked
+ \param bVector The vector to be checked
+ \param num_points The number of values in aVector and bVector to be checked and stored into cVector
+*/
+static inline void volk_64f_x2_max_64f_a_generic(double* cVector, const double* aVector, const double* bVector, unsigned int num_points){
+ double* cPtr = cVector;
+ const double* aPtr = aVector;
+ const double* bPtr= bVector;
+ unsigned int number = 0;
+
+ for(number = 0; number < num_points; number++){
+ const double a = *aPtr++;
+ const double b = *bPtr++;
+ *cPtr++ = ( a > b ? a : b);
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+#endif /* INCLUDED_volk_64f_x2_max_64f_a_H */
diff --git a/volk/include/volk/volk_64f_x2_min_64f_a.h b/volk/include/volk/volk_64f_x2_min_64f_a.h
new file mode 100644
index 000000000..25d8b4c98
--- /dev/null
+++ b/volk/include/volk/volk_64f_x2_min_64f_a.h
@@ -0,0 +1,71 @@
+#ifndef INCLUDED_volk_64f_x2_min_64f_a_H
+#define INCLUDED_volk_64f_x2_min_64f_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE2
+#include <emmintrin.h>
+/*!
+ \brief Selects minimum value from each entry between bVector and aVector and store their results in the cVector
+ \param cVector The vector where the results will be stored
+ \param aVector The vector to be checked
+ \param bVector The vector to be checked
+ \param num_points The number of values in aVector and bVector to be checked and stored into cVector
+*/
+static inline void volk_64f_x2_min_64f_a_sse2(double* cVector, const double* aVector, const double* bVector, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int halfPoints = num_points / 2;
+
+ double* cPtr = cVector;
+ const double* aPtr = aVector;
+ const double* bPtr= bVector;
+
+ __m128d aVal, bVal, cVal;
+ for(;number < halfPoints; number++){
+
+ aVal = _mm_load_pd(aPtr);
+ bVal = _mm_load_pd(bPtr);
+
+ cVal = _mm_min_pd(aVal, bVal);
+
+ _mm_store_pd(cPtr,cVal); // Store the results back into the C container
+
+ aPtr += 2;
+ bPtr += 2;
+ cPtr += 2;
+ }
+
+ number = halfPoints * 2;
+ for(;number < num_points; number++){
+ const double a = *aPtr++;
+ const double b = *bPtr++;
+ *cPtr++ = ( a < b ? a : b);
+ }
+}
+#endif /* LV_HAVE_SSE2 */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Selects minimum value from each entry between bVector and aVector and store their results in the cVector
+ \param cVector The vector where the results will be stored
+ \param aVector The vector to be checked
+ \param bVector The vector to be checked
+ \param num_points The number of values in aVector and bVector to be checked and stored into cVector
+*/
+static inline void volk_64f_x2_min_64f_a_generic(double* cVector, const double* aVector, const double* bVector, unsigned int num_points){
+ double* cPtr = cVector;
+ const double* aPtr = aVector;
+ const double* bPtr= bVector;
+ unsigned int number = 0;
+
+ for(number = 0; number < num_points; number++){
+ const double a = *aPtr++;
+ const double b = *bPtr++;
+ *cPtr++ = ( a < b ? a : b);
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+#endif /* INCLUDED_volk_64f_x2_min_64f_a_H */
diff --git a/volk/include/volk/volk_64u_byteswap_a.h b/volk/include/volk/volk_64u_byteswap_a.h
new file mode 100644
index 000000000..3d1d87623
--- /dev/null
+++ b/volk/include/volk/volk_64u_byteswap_a.h
@@ -0,0 +1,88 @@
+#ifndef INCLUDED_volk_64u_byteswap_a_H
+#define INCLUDED_volk_64u_byteswap_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE2
+#include <emmintrin.h>
+
+/*!
+ \brief Byteswaps (in-place) an aligned vector of int64_t's.
+ \param intsToSwap The vector of data to byte swap
+ \param numDataPoints The number of data points
+*/
+static inline void volk_64u_byteswap_a_sse2(uint64_t* intsToSwap, unsigned int num_points){
+ uint32_t* inputPtr = (uint32_t*)intsToSwap;
+ __m128i input, byte1, byte2, byte3, byte4, output;
+ __m128i byte2mask = _mm_set1_epi32(0x00FF0000);
+ __m128i byte3mask = _mm_set1_epi32(0x0000FF00);
+ uint64_t number = 0;
+ const unsigned int halfPoints = num_points / 2;
+ for(;number < halfPoints; number++){
+ // Load the 32t values, increment inputPtr later since we're doing it in-place.
+ input = _mm_load_si128((__m128i*)inputPtr);
+
+ // Do the four shifts
+ byte1 = _mm_slli_epi32(input, 24);
+ byte2 = _mm_slli_epi32(input, 8);
+ byte3 = _mm_srli_epi32(input, 8);
+ byte4 = _mm_srli_epi32(input, 24);
+ // Or bytes together
+ output = _mm_or_si128(byte1, byte4);
+ byte2 = _mm_and_si128(byte2, byte2mask);
+ output = _mm_or_si128(output, byte2);
+ byte3 = _mm_and_si128(byte3, byte3mask);
+ output = _mm_or_si128(output, byte3);
+
+ // Reorder the two words
+ output = _mm_shuffle_epi32(output, _MM_SHUFFLE(2, 3, 0, 1));
+
+ // Store the results
+ _mm_store_si128((__m128i*)inputPtr, output);
+ inputPtr += 4;
+ }
+
+ // Byteswap any remaining points:
+ number = halfPoints*2;
+ for(; number < num_points; number++){
+ uint32_t output1 = *inputPtr;
+ uint32_t output2 = inputPtr[1];
+
+ output1 = (((output1 >> 24) & 0xff) | ((output1 >> 8) & 0x0000ff00) | ((output1 << 8) & 0x00ff0000) | ((output1 << 24) & 0xff000000));
+
+ output2 = (((output2 >> 24) & 0xff) | ((output2 >> 8) & 0x0000ff00) | ((output2 << 8) & 0x00ff0000) | ((output2 << 24) & 0xff000000));
+
+ *inputPtr++ = output2;
+ *inputPtr++ = output1;
+ }
+}
+#endif /* LV_HAVE_SSE2 */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Byteswaps (in-place) an aligned vector of int64_t's.
+ \param intsToSwap The vector of data to byte swap
+ \param numDataPoints The number of data points
+*/
+static inline void volk_64u_byteswap_a_generic(uint64_t* intsToSwap, unsigned int num_points){
+ uint32_t* inputPtr = (uint32_t*)intsToSwap;
+ unsigned int point;
+ for(point = 0; point < num_points; point++){
+ uint32_t output1 = *inputPtr;
+ uint32_t output2 = inputPtr[1];
+
+ output1 = (((output1 >> 24) & 0xff) | ((output1 >> 8) & 0x0000ff00) | ((output1 << 8) & 0x00ff0000) | ((output1 << 24) & 0xff000000));
+
+ output2 = (((output2 >> 24) & 0xff) | ((output2 >> 8) & 0x0000ff00) | ((output2 << 8) & 0x00ff0000) | ((output2 << 24) & 0xff000000));
+
+ *inputPtr++ = output2;
+ *inputPtr++ = output1;
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_64u_byteswap_a_H */
diff --git a/volk/include/volk/volk_64u_byteswap_u.h b/volk/include/volk/volk_64u_byteswap_u.h
new file mode 100644
index 000000000..41a4a3130
--- /dev/null
+++ b/volk/include/volk/volk_64u_byteswap_u.h
@@ -0,0 +1,88 @@
+#ifndef INCLUDED_volk_64u_byteswap_u_H
+#define INCLUDED_volk_64u_byteswap_u_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE2
+#include <emmintrin.h>
+
+/*!
+ \brief Byteswaps (in-place) an aligned vector of int64_t's.
+ \param intsToSwap The vector of data to byte swap
+ \param numDataPoints The number of data points
+*/
+static inline void volk_64u_byteswap_u_sse2(uint64_t* intsToSwap, unsigned int num_points){
+ uint32_t* inputPtr = (uint32_t*)intsToSwap;
+ __m128i input, byte1, byte2, byte3, byte4, output;
+ __m128i byte2mask = _mm_set1_epi32(0x00FF0000);
+ __m128i byte3mask = _mm_set1_epi32(0x0000FF00);
+ uint64_t number = 0;
+ const unsigned int halfPoints = num_points / 2;
+ for(;number < halfPoints; number++){
+ // Load the 32t values, increment inputPtr later since we're doing it in-place.
+ input = _mm_loadu_si128((__m128i*)inputPtr);
+
+ // Do the four shifts
+ byte1 = _mm_slli_epi32(input, 24);
+ byte2 = _mm_slli_epi32(input, 8);
+ byte3 = _mm_srli_epi32(input, 8);
+ byte4 = _mm_srli_epi32(input, 24);
+ // Or bytes together
+ output = _mm_or_si128(byte1, byte4);
+ byte2 = _mm_and_si128(byte2, byte2mask);
+ output = _mm_or_si128(output, byte2);
+ byte3 = _mm_and_si128(byte3, byte3mask);
+ output = _mm_or_si128(output, byte3);
+
+ // Reorder the two words
+ output = _mm_shuffle_epi32(output, _MM_SHUFFLE(2, 3, 0, 1));
+
+ // Store the results
+ _mm_storeu_si128((__m128i*)inputPtr, output);
+ inputPtr += 4;
+ }
+
+ // Byteswap any remaining points:
+ number = halfPoints*2;
+ for(; number < num_points; number++){
+ uint32_t output1 = *inputPtr;
+ uint32_t output2 = inputPtr[1];
+
+ output1 = (((output1 >> 24) & 0xff) | ((output1 >> 8) & 0x0000ff00) | ((output1 << 8) & 0x00ff0000) | ((output1 << 24) & 0xff000000));
+
+ output2 = (((output2 >> 24) & 0xff) | ((output2 >> 8) & 0x0000ff00) | ((output2 << 8) & 0x00ff0000) | ((output2 << 24) & 0xff000000));
+
+ *inputPtr++ = output2;
+ *inputPtr++ = output1;
+ }
+}
+#endif /* LV_HAVE_SSE2 */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Byteswaps (in-place) an aligned vector of int64_t's.
+ \param intsToSwap The vector of data to byte swap
+ \param numDataPoints The number of data points
+*/
+static inline void volk_64u_byteswap_u_generic(uint64_t* intsToSwap, unsigned int num_points){
+ uint32_t* inputPtr = (uint32_t*)intsToSwap;
+ unsigned int point;
+ for(point = 0; point < num_points; point++){
+ uint32_t output1 = *inputPtr;
+ uint32_t output2 = inputPtr[1];
+
+ output1 = (((output1 >> 24) & 0xff) | ((output1 >> 8) & 0x0000ff00) | ((output1 << 8) & 0x00ff0000) | ((output1 << 24) & 0xff000000));
+
+ output2 = (((output2 >> 24) & 0xff) | ((output2 >> 8) & 0x0000ff00) | ((output2 << 8) & 0x00ff0000) | ((output2 << 24) & 0xff000000));
+
+ *inputPtr++ = output2;
+ *inputPtr++ = output1;
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_64u_byteswap_u_H */
diff --git a/volk/include/volk/volk_64u_popcnt_a.h b/volk/include/volk/volk_64u_popcnt_a.h
new file mode 100644
index 000000000..5e68ed208
--- /dev/null
+++ b/volk/include/volk/volk_64u_popcnt_a.h
@@ -0,0 +1,52 @@
+#ifndef INCLUDED_volk_64u_popcnt_a_H
+#define INCLUDED_volk_64u_popcnt_a_H
+
+#include <stdio.h>
+#include <inttypes.h>
+
+
+#ifdef LV_HAVE_GENERIC
+
+
+static inline void volk_64u_popcnt_a_generic(uint64_t* ret, const uint64_t value) {
+
+ //const uint32_t* valueVector = (const uint32_t*)&value;
+
+ // This is faster than a lookup table
+ //uint32_t retVal = valueVector[0];
+ uint32_t retVal = (uint32_t)(value & 0x00000000FFFFFFFF);
+
+ retVal = (retVal & 0x55555555) + (retVal >> 1 & 0x55555555);
+ retVal = (retVal & 0x33333333) + (retVal >> 2 & 0x33333333);
+ retVal = (retVal + (retVal >> 4)) & 0x0F0F0F0F;
+ retVal = (retVal + (retVal >> 8));
+ retVal = (retVal + (retVal >> 16)) & 0x0000003F;
+ uint64_t retVal64 = retVal;
+
+ //retVal = valueVector[1];
+ retVal = (uint32_t)((value & 0xFFFFFFFF00000000) >> 31);
+ retVal = (retVal & 0x55555555) + (retVal >> 1 & 0x55555555);
+ retVal = (retVal & 0x33333333) + (retVal >> 2 & 0x33333333);
+ retVal = (retVal + (retVal >> 4)) & 0x0F0F0F0F;
+ retVal = (retVal + (retVal >> 8));
+ retVal = (retVal + (retVal >> 16)) & 0x0000003F;
+ retVal64 += retVal;
+
+ *ret = retVal64;
+
+}
+
+#endif /*LV_HAVE_GENERIC*/
+
+#if LV_HAVE_SSE4_2 && LV_HAVE_64
+
+#include <nmmintrin.h>
+
+static inline void volk_64u_popcnt_a_sse4_2(uint64_t* ret, const uint64_t value) {
+ *ret = _mm_popcnt_u64(value);
+
+}
+
+#endif /*LV_HAVE_SSE4_2*/
+
+#endif /*INCLUDED_volk_64u_popcnt_a_H*/
diff --git a/volk/include/volk/volk_8i_convert_16i_a.h b/volk/include/volk/volk_8i_convert_16i_a.h
new file mode 100644
index 000000000..9104f90cb
--- /dev/null
+++ b/volk/include/volk/volk_8i_convert_16i_a.h
@@ -0,0 +1,83 @@
+#ifndef INCLUDED_volk_8i_convert_16i_a_H
+#define INCLUDED_volk_8i_convert_16i_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE4_1
+#include <smmintrin.h>
+
+ /*!
+ \brief Converts the input 8 bit integer data into 16 bit integer data
+ \param inputVector The 8 bit input data buffer
+ \param outputVector The 16 bit output data buffer
+ \param num_points The number of data values to be converted
+ */
+static inline void volk_8i_convert_16i_a_sse4_1(int16_t* outputVector, const int8_t* inputVector, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int sixteenthPoints = num_points / 16;
+
+ const __m128i* inputVectorPtr = (const __m128i*)inputVector;
+ __m128i* outputVectorPtr = (__m128i*)outputVector;
+ __m128i inputVal;
+ __m128i ret;
+
+ for(;number < sixteenthPoints; number++){
+ inputVal = _mm_load_si128(inputVectorPtr);
+ ret = _mm_cvtepi8_epi16(inputVal);
+ ret = _mm_slli_epi16(ret, 8); // Multiply by 256
+ _mm_store_si128(outputVectorPtr, ret);
+
+ outputVectorPtr++;
+
+ inputVal = _mm_srli_si128(inputVal, 8);
+ ret = _mm_cvtepi8_epi16(inputVal);
+ ret = _mm_slli_epi16(ret, 8); // Multiply by 256
+ _mm_store_si128(outputVectorPtr, ret);
+
+ outputVectorPtr++;
+
+ inputVectorPtr++;
+ }
+
+ number = sixteenthPoints * 16;
+ for(; number < num_points; number++){
+ outputVector[number] = (int16_t)(inputVector[number])*256;
+ }
+}
+#endif /* LV_HAVE_SSE4_1 */
+
+#ifdef LV_HAVE_GENERIC
+ /*!
+ \brief Converts the input 8 bit integer data into 16 bit integer data
+ \param inputVector The 8 bit input data buffer
+ \param outputVector The 16 bit output data buffer
+ \param num_points The number of data values to be converted
+ */
+static inline void volk_8i_convert_16i_a_generic(int16_t* outputVector, const int8_t* inputVector, unsigned int num_points){
+ int16_t* outputVectorPtr = outputVector;
+ const int8_t* inputVectorPtr = inputVector;
+ unsigned int number = 0;
+
+ for(number = 0; number < num_points; number++){
+ *outputVectorPtr++ = ((int16_t)(*inputVectorPtr++)) * 256;
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+#ifdef LV_HAVE_ORC
+ /*!
+ \brief Converts the input 8 bit integer data into 16 bit integer data
+ \param inputVector The 8 bit input data buffer
+ \param outputVector The 16 bit output data buffer
+ \param num_points The number of data values to be converted
+ */
+extern void volk_8i_convert_16i_a_orc_impl(int16_t* outputVector, const int8_t* inputVector, unsigned int num_points);
+static inline void volk_8i_convert_16i_a_orc(int16_t* outputVector, const int8_t* inputVector, unsigned int num_points){
+ volk_8i_convert_16i_a_orc_impl(outputVector, inputVector, num_points);
+}
+#endif /* LV_HAVE_ORC */
+
+
+
+#endif /* INCLUDED_VOLK_8s_CONVERT_16s_ALIGNED8_H */
diff --git a/volk/include/volk/volk_8i_convert_16i_u.h b/volk/include/volk/volk_8i_convert_16i_u.h
new file mode 100644
index 000000000..7d7104f52
--- /dev/null
+++ b/volk/include/volk/volk_8i_convert_16i_u.h
@@ -0,0 +1,73 @@
+#ifndef INCLUDED_volk_8i_convert_16i_u_H
+#define INCLUDED_volk_8i_convert_16i_u_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE4_1
+#include <smmintrin.h>
+
+ /*!
+ \brief Converts the input 8 bit integer data into 16 bit integer data
+ \param inputVector The 8 bit input data buffer
+ \param outputVector The 16 bit output data buffer
+ \param num_points The number of data values to be converted
+ \note Input and output buffers do NOT need to be properly aligned
+ */
+static inline void volk_8i_convert_16i_u_sse4_1(int16_t* outputVector, const int8_t* inputVector, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int sixteenthPoints = num_points / 16;
+
+ const __m128i* inputVectorPtr = (const __m128i*)inputVector;
+ __m128i* outputVectorPtr = (__m128i*)outputVector;
+ __m128i inputVal;
+ __m128i ret;
+
+ for(;number < sixteenthPoints; number++){
+ inputVal = _mm_loadu_si128(inputVectorPtr);
+ ret = _mm_cvtepi8_epi16(inputVal);
+ ret = _mm_slli_epi16(ret, 8); // Multiply by 256
+ _mm_storeu_si128(outputVectorPtr, ret);
+
+ outputVectorPtr++;
+
+ inputVal = _mm_srli_si128(inputVal, 8);
+ ret = _mm_cvtepi8_epi16(inputVal);
+ ret = _mm_slli_epi16(ret, 8); // Multiply by 256
+ _mm_storeu_si128(outputVectorPtr, ret);
+
+ outputVectorPtr++;
+
+ inputVectorPtr++;
+ }
+
+ number = sixteenthPoints * 16;
+ for(; number < num_points; number++){
+ outputVector[number] = (int16_t)(inputVector[number])*256;
+ }
+}
+#endif /* LV_HAVE_SSE4_1 */
+
+#ifdef LV_HAVE_GENERIC
+ /*!
+ \brief Converts the input 8 bit integer data into 16 bit integer data
+ \param inputVector The 8 bit input data buffer
+ \param outputVector The 16 bit output data buffer
+ \param num_points The number of data values to be converted
+ \note Input and output buffers do NOT need to be properly aligned
+ */
+static inline void volk_8i_convert_16i_u_generic(int16_t* outputVector, const int8_t* inputVector, unsigned int num_points){
+ int16_t* outputVectorPtr = outputVector;
+ const int8_t* inputVectorPtr = inputVector;
+ unsigned int number = 0;
+
+ for(number = 0; number < num_points; number++){
+ *outputVectorPtr++ = ((int16_t)(*inputVectorPtr++)) * 256;
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_VOLK_8s_CONVERT_16s_UNALIGNED8_H */
diff --git a/volk/include/volk/volk_8i_s32f_convert_32f_a.h b/volk/include/volk/volk_8i_s32f_convert_32f_a.h
new file mode 100644
index 000000000..02a7f356e
--- /dev/null
+++ b/volk/include/volk/volk_8i_s32f_convert_32f_a.h
@@ -0,0 +1,106 @@
+#ifndef INCLUDED_volk_8i_s32f_convert_32f_a_H
+#define INCLUDED_volk_8i_s32f_convert_32f_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE4_1
+#include <smmintrin.h>
+
+ /*!
+ \brief Converts the input 8 bit integer data into floating point data, and divides the each floating point output data point by the scalar value
+ \param inputVector The 8 bit input data buffer
+ \param outputVector The floating point output data buffer
+ \param scalar The value divided against each point in the output buffer
+ \param num_points The number of data values to be converted
+ */
+static inline void volk_8i_s32f_convert_32f_a_sse4_1(float* outputVector, const int8_t* inputVector, const float scalar, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int sixteenthPoints = num_points / 16;
+
+ float* outputVectorPtr = outputVector;
+ const float iScalar = 1.0 / scalar;
+ __m128 invScalar = _mm_set_ps1(iScalar);
+ const int8_t* inputVectorPtr = inputVector;
+ __m128 ret;
+ __m128i inputVal;
+ __m128i interimVal;
+
+ for(;number < sixteenthPoints; number++){
+ inputVal = _mm_load_si128((__m128i*)inputVectorPtr);
+
+ interimVal = _mm_cvtepi8_epi32(inputVal);
+ ret = _mm_cvtepi32_ps(interimVal);
+ ret = _mm_mul_ps(ret, invScalar);
+ _mm_store_ps(outputVectorPtr, ret);
+ outputVectorPtr += 4;
+
+ inputVal = _mm_srli_si128(inputVal, 4);
+ interimVal = _mm_cvtepi8_epi32(inputVal);
+ ret = _mm_cvtepi32_ps(interimVal);
+ ret = _mm_mul_ps(ret, invScalar);
+ _mm_store_ps(outputVectorPtr, ret);
+ outputVectorPtr += 4;
+
+ inputVal = _mm_srli_si128(inputVal, 4);
+ interimVal = _mm_cvtepi8_epi32(inputVal);
+ ret = _mm_cvtepi32_ps(interimVal);
+ ret = _mm_mul_ps(ret, invScalar);
+ _mm_store_ps(outputVectorPtr, ret);
+ outputVectorPtr += 4;
+
+ inputVal = _mm_srli_si128(inputVal, 4);
+ interimVal = _mm_cvtepi8_epi32(inputVal);
+ ret = _mm_cvtepi32_ps(interimVal);
+ ret = _mm_mul_ps(ret, invScalar);
+ _mm_store_ps(outputVectorPtr, ret);
+ outputVectorPtr += 4;
+
+ inputVectorPtr += 16;
+ }
+
+ number = sixteenthPoints * 16;
+ for(; number < num_points; number++){
+ outputVector[number] = (float)(inputVector[number]) * iScalar;
+ }
+}
+#endif /* LV_HAVE_SSE4_1 */
+
+#ifdef LV_HAVE_GENERIC
+ /*!
+ \brief Converts the input 8 bit integer data into floating point data, and divides the each floating point output data point by the scalar value
+ \param inputVector The 8 bit input data buffer
+ \param outputVector The floating point output data buffer
+ \param scalar The value divided against each point in the output buffer
+ \param num_points The number of data values to be converted
+ */
+static inline void volk_8i_s32f_convert_32f_a_generic(float* outputVector, const int8_t* inputVector, const float scalar, unsigned int num_points){
+ float* outputVectorPtr = outputVector;
+ const int8_t* inputVectorPtr = inputVector;
+ unsigned int number = 0;
+ const float iScalar = 1.0 / scalar;
+
+ for(number = 0; number < num_points; number++){
+ *outputVectorPtr++ = ((float)(*inputVectorPtr++)) * iScalar;
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+#ifdef LV_HAVE_ORC
+ /*!
+ \brief Converts the input 8 bit integer data into floating point data, and divides the each floating point output data point by the scalar value
+ \param inputVector The 8 bit input data buffer
+ \param outputVector The floating point output data buffer
+ \param scalar The value divided against each point in the output buffer
+ \param num_points The number of data values to be converted
+ */
+extern void volk_8i_s32f_convert_32f_a_orc_impl(float* outputVector, const int8_t* inputVector, const float scalar, unsigned int num_points);
+static inline void volk_8i_s32f_convert_32f_a_orc(float* outputVector, const int8_t* inputVector, const float scalar, unsigned int num_points){
+ float invscalar = 1.0 / scalar;
+ volk_8i_s32f_convert_32f_a_orc_impl(outputVector, inputVector, invscalar, num_points);
+}
+#endif /* LV_HAVE_ORC */
+
+
+
+#endif /* INCLUDED_VOLK_8s_CONVERT_32f_ALIGNED8_H */
diff --git a/volk/include/volk/volk_8i_s32f_convert_32f_u.h b/volk/include/volk/volk_8i_s32f_convert_32f_u.h
new file mode 100644
index 000000000..8bb2c0d1a
--- /dev/null
+++ b/volk/include/volk/volk_8i_s32f_convert_32f_u.h
@@ -0,0 +1,94 @@
+#ifndef INCLUDED_volk_8i_s32f_convert_32f_u_H
+#define INCLUDED_volk_8i_s32f_convert_32f_u_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE4_1
+#include <smmintrin.h>
+
+ /*!
+ \brief Converts the input 8 bit integer data into floating point data, and divides the each floating point output data point by the scalar value
+ \param inputVector The 8 bit input data buffer
+ \param outputVector The floating point output data buffer
+ \param scalar The value divided against each point in the output buffer
+ \param num_points The number of data values to be converted
+ \note Output buffer does NOT need to be properly aligned
+ */
+static inline void volk_8i_s32f_convert_32f_u_sse4_1(float* outputVector, const int8_t* inputVector, const float scalar, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int sixteenthPoints = num_points / 16;
+
+ float* outputVectorPtr = outputVector;
+ const float iScalar = 1.0 / scalar;
+ __m128 invScalar = _mm_set_ps1( iScalar );
+ const int8_t* inputVectorPtr = inputVector;
+ __m128 ret;
+ __m128i inputVal;
+ __m128i interimVal;
+
+ for(;number < sixteenthPoints; number++){
+ inputVal = _mm_loadu_si128((__m128i*)inputVectorPtr);
+
+ interimVal = _mm_cvtepi8_epi32(inputVal);
+ ret = _mm_cvtepi32_ps(interimVal);
+ ret = _mm_mul_ps(ret, invScalar);
+ _mm_storeu_ps(outputVectorPtr, ret);
+ outputVectorPtr += 4;
+
+ inputVal = _mm_srli_si128(inputVal, 4);
+ interimVal = _mm_cvtepi8_epi32(inputVal);
+ ret = _mm_cvtepi32_ps(interimVal);
+ ret = _mm_mul_ps(ret, invScalar);
+ _mm_storeu_ps(outputVectorPtr, ret);
+ outputVectorPtr += 4;
+
+ inputVal = _mm_srli_si128(inputVal, 4);
+ interimVal = _mm_cvtepi8_epi32(inputVal);
+ ret = _mm_cvtepi32_ps(interimVal);
+ ret = _mm_mul_ps(ret, invScalar);
+ _mm_storeu_ps(outputVectorPtr, ret);
+ outputVectorPtr += 4;
+
+ inputVal = _mm_srli_si128(inputVal, 4);
+ interimVal = _mm_cvtepi8_epi32(inputVal);
+ ret = _mm_cvtepi32_ps(interimVal);
+ ret = _mm_mul_ps(ret, invScalar);
+ _mm_storeu_ps(outputVectorPtr, ret);
+ outputVectorPtr += 4;
+
+ inputVectorPtr += 16;
+ }
+
+ number = sixteenthPoints * 16;
+ for(; number < num_points; number++){
+ outputVector[number] = (float)(inputVector[number]) * iScalar;
+ }
+}
+#endif /* LV_HAVE_SSE4_1 */
+
+#ifdef LV_HAVE_GENERIC
+ /*!
+ \brief Converts the input 8 bit integer data into floating point data, and divides the each floating point output data point by the scalar value
+ \param inputVector The 8 bit input data buffer
+ \param outputVector The floating point output data buffer
+ \param scalar The value divided against each point in the output buffer
+ \param num_points The number of data values to be converted
+ \note Output buffer does NOT need to be properly aligned
+ */
+static inline void volk_8i_s32f_convert_32f_u_generic(float* outputVector, const int8_t* inputVector, const float scalar, unsigned int num_points){
+ float* outputVectorPtr = outputVector;
+ const int8_t* inputVectorPtr = inputVector;
+ unsigned int number = 0;
+ const float iScalar = 1.0 / scalar;
+
+ for(number = 0; number < num_points; number++){
+ *outputVectorPtr++ = ((float)(*inputVectorPtr++)) * iScalar;
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_VOLK_8s_CONVERT_32f_UNALIGNED8_H */
diff --git a/volk/include/volk/volk_8ic_deinterleave_16i_x2_a.h b/volk/include/volk/volk_8ic_deinterleave_16i_x2_a.h
new file mode 100644
index 000000000..8f13da32f
--- /dev/null
+++ b/volk/include/volk/volk_8ic_deinterleave_16i_x2_a.h
@@ -0,0 +1,77 @@
+#ifndef INCLUDED_volk_8ic_deinterleave_16i_x2_a_H
+#define INCLUDED_volk_8ic_deinterleave_16i_x2_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE4_1
+#include <smmintrin.h>
+/*!
+ \brief Deinterleaves the complex 8 bit vector into I & Q 16 bit vector data
+ \param complexVector The complex input vector
+ \param iBuffer The I buffer output data
+ \param qBuffer The Q buffer output data
+ \param num_points The number of complex data values to be deinterleaved
+*/
+static inline void volk_8ic_deinterleave_16i_x2_a_sse4_1(int16_t* iBuffer, int16_t* qBuffer, const lv_8sc_t* complexVector, unsigned int num_points){
+ unsigned int number = 0;
+ const int8_t* complexVectorPtr = (int8_t*)complexVector;
+ int16_t* iBufferPtr = iBuffer;
+ int16_t* qBufferPtr = qBuffer;
+ __m128i iMoveMask = _mm_set_epi8(0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 14, 12, 10, 8, 6, 4, 2, 0);
+ __m128i qMoveMask = _mm_set_epi8(0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 15, 13, 11, 9, 7, 5, 3, 1);
+ __m128i complexVal, iOutputVal, qOutputVal;
+
+ unsigned int eighthPoints = num_points / 8;
+
+ for(number = 0; number < eighthPoints; number++){
+ complexVal = _mm_load_si128((__m128i*)complexVectorPtr); complexVectorPtr += 16;
+
+ iOutputVal = _mm_shuffle_epi8(complexVal, iMoveMask);
+ qOutputVal = _mm_shuffle_epi8(complexVal, qMoveMask);
+
+ iOutputVal = _mm_cvtepi8_epi16(iOutputVal);
+ iOutputVal = _mm_slli_epi16(iOutputVal, 8);
+
+ qOutputVal = _mm_cvtepi8_epi16(qOutputVal);
+ qOutputVal = _mm_slli_epi16(qOutputVal, 8);
+
+ _mm_store_si128((__m128i*)iBufferPtr, iOutputVal);
+ _mm_store_si128((__m128i*)qBufferPtr, qOutputVal);
+
+ iBufferPtr += 8;
+ qBufferPtr += 8;
+ }
+
+ number = eighthPoints * 8;
+ for(; number < num_points; number++){
+ *iBufferPtr++ = ((int16_t)*complexVectorPtr++) * 256;
+ *qBufferPtr++ = ((int16_t)*complexVectorPtr++) * 256;
+ }
+}
+#endif /* LV_HAVE_SSE4_1 */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Deinterleaves the complex 8 bit vector into I & Q 16 bit vector data
+ \param complexVector The complex input vector
+ \param iBuffer The I buffer output data
+ \param qBuffer The Q buffer output data
+ \param num_points The number of complex data values to be deinterleaved
+*/
+static inline void volk_8ic_deinterleave_16i_x2_a_generic(int16_t* iBuffer, int16_t* qBuffer, const lv_8sc_t* complexVector, unsigned int num_points){
+ const int8_t* complexVectorPtr = (const int8_t*)complexVector;
+ int16_t* iBufferPtr = iBuffer;
+ int16_t* qBufferPtr = qBuffer;
+ unsigned int number;
+ for(number = 0; number < num_points; number++){
+ *iBufferPtr++ = (int16_t)(*complexVectorPtr++)*256;
+ *qBufferPtr++ = (int16_t)(*complexVectorPtr++)*256;
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_8ic_deinterleave_16i_x2_a_H */
diff --git a/volk/include/volk/volk_8ic_deinterleave_real_16i_a.h b/volk/include/volk/volk_8ic_deinterleave_real_16i_a.h
new file mode 100644
index 000000000..d26b3d0d0
--- /dev/null
+++ b/volk/include/volk/volk_8ic_deinterleave_real_16i_a.h
@@ -0,0 +1,66 @@
+#ifndef INCLUDED_volk_8ic_deinterleave_real_16i_a_H
+#define INCLUDED_volk_8ic_deinterleave_real_16i_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE4_1
+#include <smmintrin.h>
+/*!
+ \brief Deinterleaves the complex 8 bit vector into I 16 bit vector data
+ \param complexVector The complex input vector
+ \param iBuffer The I buffer output data
+ \param num_points The number of complex data values to be deinterleaved
+*/
+static inline void volk_8ic_deinterleave_real_16i_a_sse4_1(int16_t* iBuffer, const lv_8sc_t* complexVector, unsigned int num_points){
+ unsigned int number = 0;
+ const int8_t* complexVectorPtr = (int8_t*)complexVector;
+ int16_t* iBufferPtr = iBuffer;
+ __m128i moveMask = _mm_set_epi8(0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 14, 12, 10, 8, 6, 4, 2, 0);
+ __m128i complexVal, outputVal;
+
+ unsigned int eighthPoints = num_points / 8;
+
+ for(number = 0; number < eighthPoints; number++){
+ complexVal = _mm_load_si128((__m128i*)complexVectorPtr); complexVectorPtr += 16;
+
+ complexVal = _mm_shuffle_epi8(complexVal, moveMask);
+
+ outputVal = _mm_cvtepi8_epi16(complexVal);
+ outputVal = _mm_slli_epi16(outputVal, 7);
+
+ _mm_store_si128((__m128i*)iBufferPtr, outputVal);
+ iBufferPtr += 8;
+ }
+
+ number = eighthPoints * 8;
+ for(; number < num_points; number++){
+ *iBufferPtr++ = ((int16_t)*complexVectorPtr++) * 128;
+ complexVectorPtr++;
+ }
+}
+#endif /* LV_HAVE_SSE4_1 */
+
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Deinterleaves the complex 8 bit vector into I 16 bit vector data
+ \param complexVector The complex input vector
+ \param iBuffer The I buffer output data
+ \param num_points The number of complex data values to be deinterleaved
+*/
+static inline void volk_8ic_deinterleave_real_16i_a_generic(int16_t* iBuffer, const lv_8sc_t* complexVector, unsigned int num_points){
+ unsigned int number = 0;
+ const int8_t* complexVectorPtr = (const int8_t*)complexVector;
+ int16_t* iBufferPtr = iBuffer;
+ for(number = 0; number < num_points; number++){
+ *iBufferPtr++ = ((int16_t)(*complexVectorPtr++)) * 128;
+ complexVectorPtr++;
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_8ic_deinterleave_real_16i_a_H */
diff --git a/volk/include/volk/volk_8ic_deinterleave_real_8i_a.h b/volk/include/volk/volk_8ic_deinterleave_real_8i_a.h
new file mode 100644
index 000000000..21efed83e
--- /dev/null
+++ b/volk/include/volk/volk_8ic_deinterleave_real_8i_a.h
@@ -0,0 +1,67 @@
+#ifndef INCLUDED_VOLK_8sc_DEINTERLEAVE_REAL_8s_ALIGNED8_H
+#define INCLUDED_VOLK_8sc_DEINTERLEAVE_REAL_8s_ALIGNED8_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSSE3
+#include <tmmintrin.h>
+/*!
+ \brief Deinterleaves the complex 8 bit vector into I vector data
+ \param complexVector The complex input vector
+ \param iBuffer The I buffer output data
+ \param num_points The number of complex data values to be deinterleaved
+*/
+static inline void volk_8ic_deinterleave_real_8i_a_ssse3(int8_t* iBuffer, const lv_8sc_t* complexVector, unsigned int num_points){
+ unsigned int number = 0;
+ const int8_t* complexVectorPtr = (int8_t*)complexVector;
+ int8_t* iBufferPtr = iBuffer;
+ __m128i moveMask1 = _mm_set_epi8(0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 14, 12, 10, 8, 6, 4, 2, 0);
+ __m128i moveMask2 = _mm_set_epi8(14, 12, 10, 8, 6, 4, 2, 0, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80);
+ __m128i complexVal1, complexVal2, outputVal;
+
+ unsigned int sixteenthPoints = num_points / 16;
+
+ for(number = 0; number < sixteenthPoints; number++){
+ complexVal1 = _mm_load_si128((__m128i*)complexVectorPtr); complexVectorPtr += 16;
+ complexVal2 = _mm_load_si128((__m128i*)complexVectorPtr); complexVectorPtr += 16;
+
+ complexVal1 = _mm_shuffle_epi8(complexVal1, moveMask1);
+ complexVal2 = _mm_shuffle_epi8(complexVal2, moveMask2);
+
+ outputVal = _mm_or_si128(complexVal1, complexVal2);
+
+ _mm_store_si128((__m128i*)iBufferPtr, outputVal);
+ iBufferPtr += 16;
+ }
+
+ number = sixteenthPoints * 16;
+ for(; number < num_points; number++){
+ *iBufferPtr++ = *complexVectorPtr++;
+ complexVectorPtr++;
+ }
+}
+#endif /* LV_HAVE_SSSE3 */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Deinterleaves the complex 8 bit vector into I vector data
+ \param complexVector The complex input vector
+ \param iBuffer The I buffer output data
+ \param num_points The number of complex data values to be deinterleaved
+*/
+static inline void volk_8ic_deinterleave_real_8i_a_generic(int8_t* iBuffer, const lv_8sc_t* complexVector, unsigned int num_points){
+ unsigned int number = 0;
+ const int8_t* complexVectorPtr = (int8_t*)complexVector;
+ int8_t* iBufferPtr = iBuffer;
+ for(number = 0; number < num_points; number++){
+ *iBufferPtr++ = *complexVectorPtr++;
+ complexVectorPtr++;
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_VOLK_8sc_DEINTERLEAVE_REAL_8s_ALIGNED8_H */
diff --git a/volk/include/volk/volk_8ic_s32f_deinterleave_32f_x2_a.h b/volk/include/volk/volk_8ic_s32f_deinterleave_32f_x2_a.h
new file mode 100644
index 000000000..d82da59fb
--- /dev/null
+++ b/volk/include/volk/volk_8ic_s32f_deinterleave_32f_x2_a.h
@@ -0,0 +1,165 @@
+#ifndef INCLUDED_volk_8ic_s32f_deinterleave_32f_x2_a_H
+#define INCLUDED_volk_8ic_s32f_deinterleave_32f_x2_a_H
+
+#include <volk/volk_common.h>
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE4_1
+#include <smmintrin.h>
+/*!
+ \brief Deinterleaves the complex 8 bit vector into I & Q floating point vector data
+ \param complexVector The complex input vector
+ \param iBuffer The I buffer output data
+ \param qBuffer The Q buffer output data
+ \param scalar The scaling value being multiplied against each data point
+ \param num_points The number of complex data values to be deinterleaved
+*/
+static inline void volk_8ic_s32f_deinterleave_32f_x2_a_sse4_1(float* iBuffer, float* qBuffer, const lv_8sc_t* complexVector, const float scalar, unsigned int num_points){
+ float* iBufferPtr = iBuffer;
+ float* qBufferPtr = qBuffer;
+
+ unsigned int number = 0;
+ const unsigned int eighthPoints = num_points / 8;
+ __m128 iFloatValue, qFloatValue;
+
+ const float iScalar= 1.0 / scalar;
+ __m128 invScalar = _mm_set_ps1(iScalar);
+ __m128i complexVal, iIntVal, qIntVal, iComplexVal, qComplexVal;
+ int8_t* complexVectorPtr = (int8_t*)complexVector;
+
+ __m128i iMoveMask = _mm_set_epi8(0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 14, 12, 10, 8, 6, 4, 2, 0);
+ __m128i qMoveMask = _mm_set_epi8(0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 15, 13, 11, 9, 7, 5, 3, 1);
+
+ for(;number < eighthPoints; number++){
+ complexVal = _mm_load_si128((__m128i*)complexVectorPtr); complexVectorPtr += 16;
+ iComplexVal = _mm_shuffle_epi8(complexVal, iMoveMask);
+ qComplexVal = _mm_shuffle_epi8(complexVal, qMoveMask);
+
+ iIntVal = _mm_cvtepi8_epi32(iComplexVal);
+ iFloatValue = _mm_cvtepi32_ps(iIntVal);
+ iFloatValue = _mm_mul_ps(iFloatValue, invScalar);
+ _mm_store_ps(iBufferPtr, iFloatValue);
+ iBufferPtr += 4;
+
+ iComplexVal = _mm_srli_si128(iComplexVal, 4);
+
+ iIntVal = _mm_cvtepi8_epi32(iComplexVal);
+ iFloatValue = _mm_cvtepi32_ps(iIntVal);
+ iFloatValue = _mm_mul_ps(iFloatValue, invScalar);
+ _mm_store_ps(iBufferPtr, iFloatValue);
+ iBufferPtr += 4;
+
+ qIntVal = _mm_cvtepi8_epi32(qComplexVal);
+ qFloatValue = _mm_cvtepi32_ps(qIntVal);
+ qFloatValue = _mm_mul_ps(qFloatValue, invScalar);
+ _mm_store_ps(qBufferPtr, qFloatValue);
+ qBufferPtr += 4;
+
+ qComplexVal = _mm_srli_si128(qComplexVal, 4);
+
+ qIntVal = _mm_cvtepi8_epi32(qComplexVal);
+ qFloatValue = _mm_cvtepi32_ps(qIntVal);
+ qFloatValue = _mm_mul_ps(qFloatValue, invScalar);
+ _mm_store_ps(qBufferPtr, qFloatValue);
+
+ qBufferPtr += 4;
+ }
+
+ number = eighthPoints * 8;
+ for(; number < num_points; number++){
+ *iBufferPtr++ = (float)(*complexVectorPtr++) * iScalar;
+ *qBufferPtr++ = (float)(*complexVectorPtr++) * iScalar;
+ }
+
+}
+#endif /* LV_HAVE_SSE4_1 */
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+/*!
+ \brief Deinterleaves the complex 8 bit vector into I & Q floating point vector data
+ \param complexVector The complex input vector
+ \param iBuffer The I buffer output data
+ \param qBuffer The Q buffer output data
+ \param scalar The scaling value being multiplied against each data point
+ \param num_points The number of complex data values to be deinterleaved
+*/
+static inline void volk_8ic_s32f_deinterleave_32f_x2_a_sse(float* iBuffer, float* qBuffer, const lv_8sc_t* complexVector, const float scalar, unsigned int num_points){
+ float* iBufferPtr = iBuffer;
+ float* qBufferPtr = qBuffer;
+
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+ __m128 cplxValue1, cplxValue2, iValue, qValue;
+
+ __m128 invScalar = _mm_set_ps1(1.0/scalar);
+ int8_t* complexVectorPtr = (int8_t*)complexVector;
+
+ __VOLK_ATTR_ALIGNED(16) float floatBuffer[8];
+
+ for(;number < quarterPoints; number++){
+ floatBuffer[0] = (float)(complexVectorPtr[0]);
+ floatBuffer[1] = (float)(complexVectorPtr[1]);
+ floatBuffer[2] = (float)(complexVectorPtr[2]);
+ floatBuffer[3] = (float)(complexVectorPtr[3]);
+
+ floatBuffer[4] = (float)(complexVectorPtr[4]);
+ floatBuffer[5] = (float)(complexVectorPtr[5]);
+ floatBuffer[6] = (float)(complexVectorPtr[6]);
+ floatBuffer[7] = (float)(complexVectorPtr[7]);
+
+ cplxValue1 = _mm_load_ps(&floatBuffer[0]);
+ cplxValue2 = _mm_load_ps(&floatBuffer[4]);
+
+ complexVectorPtr += 8;
+
+ cplxValue1 = _mm_mul_ps(cplxValue1, invScalar);
+ cplxValue2 = _mm_mul_ps(cplxValue2, invScalar);
+
+ // Arrange in i1i2i3i4 format
+ iValue = _mm_shuffle_ps(cplxValue1, cplxValue2, _MM_SHUFFLE(2,0,2,0));
+ qValue = _mm_shuffle_ps(cplxValue1, cplxValue2, _MM_SHUFFLE(3,1,3,1));
+
+ _mm_store_ps(iBufferPtr, iValue);
+ _mm_store_ps(qBufferPtr, qValue);
+
+ iBufferPtr += 4;
+ qBufferPtr += 4;
+ }
+
+ number = quarterPoints * 4;
+ complexVectorPtr = (int8_t*)&complexVector[number];
+ for(; number < num_points; number++){
+ *iBufferPtr++ = (float)(*complexVectorPtr++) / scalar;
+ *qBufferPtr++ = (float)(*complexVectorPtr++) / scalar;
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Deinterleaves the complex 8 bit vector into I & Q floating point vector data
+ \param complexVector The complex input vector
+ \param iBuffer The I buffer output data
+ \param qBuffer The Q buffer output data
+ \param scalar The scaling value being multiplied against each data point
+ \param num_points The number of complex data values to be deinterleaved
+*/
+static inline void volk_8ic_s32f_deinterleave_32f_x2_a_generic(float* iBuffer, float* qBuffer, const lv_8sc_t* complexVector, const float scalar, unsigned int num_points){
+ const int8_t* complexVectorPtr = (const int8_t*)complexVector;
+ float* iBufferPtr = iBuffer;
+ float* qBufferPtr = qBuffer;
+ unsigned int number;
+ const float invScalar = 1.0 / scalar;
+ for(number = 0; number < num_points; number++){
+ *iBufferPtr++ = (float)(*complexVectorPtr++)*invScalar;
+ *qBufferPtr++ = (float)(*complexVectorPtr++)*invScalar;
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_8ic_s32f_deinterleave_32f_x2_a_H */
diff --git a/volk/include/volk/volk_8ic_s32f_deinterleave_real_32f_a.h b/volk/include/volk/volk_8ic_s32f_deinterleave_real_32f_a.h
new file mode 100644
index 000000000..b2c15d3a3
--- /dev/null
+++ b/volk/include/volk/volk_8ic_s32f_deinterleave_real_32f_a.h
@@ -0,0 +1,134 @@
+#ifndef INCLUDED_volk_8ic_s32f_deinterleave_real_32f_a_H
+#define INCLUDED_volk_8ic_s32f_deinterleave_real_32f_a_H
+
+#include <volk/volk_common.h>
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE4_1
+#include <smmintrin.h>
+/*!
+ \brief Deinterleaves the complex 8 bit vector into I float vector data
+ \param complexVector The complex input vector
+ \param iBuffer The I buffer output data
+ \param scalar The scaling value being multiplied against each data point
+ \param num_points The number of complex data values to be deinterleaved
+*/
+static inline void volk_8ic_s32f_deinterleave_real_32f_a_sse4_1(float* iBuffer, const lv_8sc_t* complexVector, const float scalar, unsigned int num_points){
+ float* iBufferPtr = iBuffer;
+
+ unsigned int number = 0;
+ const unsigned int eighthPoints = num_points / 8;
+ __m128 iFloatValue;
+
+ const float iScalar= 1.0 / scalar;
+ __m128 invScalar = _mm_set_ps1(iScalar);
+ __m128i complexVal, iIntVal;
+ int8_t* complexVectorPtr = (int8_t*)complexVector;
+
+ __m128i moveMask = _mm_set_epi8(0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 14, 12, 10, 8, 6, 4, 2, 0);
+
+ for(;number < eighthPoints; number++){
+ complexVal = _mm_load_si128((__m128i*)complexVectorPtr); complexVectorPtr += 16;
+ complexVal = _mm_shuffle_epi8(complexVal, moveMask);
+
+ iIntVal = _mm_cvtepi8_epi32(complexVal);
+ iFloatValue = _mm_cvtepi32_ps(iIntVal);
+
+ iFloatValue = _mm_mul_ps(iFloatValue, invScalar);
+
+ _mm_store_ps(iBufferPtr, iFloatValue);
+
+ iBufferPtr += 4;
+
+ complexVal = _mm_srli_si128(complexVal, 4);
+ iIntVal = _mm_cvtepi8_epi32(complexVal);
+ iFloatValue = _mm_cvtepi32_ps(iIntVal);
+
+ iFloatValue = _mm_mul_ps(iFloatValue, invScalar);
+
+ _mm_store_ps(iBufferPtr, iFloatValue);
+
+ iBufferPtr += 4;
+ }
+
+ number = eighthPoints * 8;
+ for(; number < num_points; number++){
+ *iBufferPtr++ = (float)(*complexVectorPtr++) * iScalar;
+ complexVectorPtr++;
+ }
+
+}
+#endif /* LV_HAVE_SSE4_1 */
+
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+/*!
+ \brief Deinterleaves the complex 8 bit vector into I float vector data
+ \param complexVector The complex input vector
+ \param iBuffer The I buffer output data
+ \param scalar The scaling value being multiplied against each data point
+ \param num_points The number of complex data values to be deinterleaved
+*/
+static inline void volk_8ic_s32f_deinterleave_real_32f_a_sse(float* iBuffer, const lv_8sc_t* complexVector, const float scalar, unsigned int num_points){
+ float* iBufferPtr = iBuffer;
+
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+ __m128 iValue;
+
+ const float iScalar= 1.0 / scalar;
+ __m128 invScalar = _mm_set_ps1(iScalar);
+ int8_t* complexVectorPtr = (int8_t*)complexVector;
+
+ __VOLK_ATTR_ALIGNED(16) float floatBuffer[4];
+
+ for(;number < quarterPoints; number++){
+ floatBuffer[0] = (float)(*complexVectorPtr); complexVectorPtr += 2;
+ floatBuffer[1] = (float)(*complexVectorPtr); complexVectorPtr += 2;
+ floatBuffer[2] = (float)(*complexVectorPtr); complexVectorPtr += 2;
+ floatBuffer[3] = (float)(*complexVectorPtr); complexVectorPtr += 2;
+
+ iValue = _mm_load_ps(floatBuffer);
+
+ iValue = _mm_mul_ps(iValue, invScalar);
+
+ _mm_store_ps(iBufferPtr, iValue);
+
+ iBufferPtr += 4;
+ }
+
+ number = quarterPoints * 4;
+ for(; number < num_points; number++){
+ *iBufferPtr++ = (float)(*complexVectorPtr++) * iScalar;
+ complexVectorPtr++;
+ }
+
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Deinterleaves the complex 8 bit vector into I float vector data
+ \param complexVector The complex input vector
+ \param iBuffer The I buffer output data
+ \param scalar The scaling value being multiplied against each data point
+ \param num_points The number of complex data values to be deinterleaved
+*/
+static inline void volk_8ic_s32f_deinterleave_real_32f_a_generic(float* iBuffer, const lv_8sc_t* complexVector, const float scalar, unsigned int num_points){
+ unsigned int number = 0;
+ const int8_t* complexVectorPtr = (const int8_t*)complexVector;
+ float* iBufferPtr = iBuffer;
+ const float invScalar = 1.0 / scalar;
+ for(number = 0; number < num_points; number++){
+ *iBufferPtr++ = ((float)(*complexVectorPtr++)) * invScalar;
+ complexVectorPtr++;
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_8ic_s32f_deinterleave_real_32f_a_H */
diff --git a/volk/include/volk/volk_8ic_x2_multiply_conjugate_16ic_a.h b/volk/include/volk/volk_8ic_x2_multiply_conjugate_16ic_a.h
new file mode 100644
index 000000000..f85fdb999
--- /dev/null
+++ b/volk/include/volk/volk_8ic_x2_multiply_conjugate_16ic_a.h
@@ -0,0 +1,101 @@
+#ifndef INCLUDED_volk_8ic_x2_multiply_conjugate_16ic_a_H
+#define INCLUDED_volk_8ic_x2_multiply_conjugate_16ic_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+#include <volk/volk_complex.h>
+
+#ifdef LV_HAVE_SSE4_1
+#include <smmintrin.h>
+/*!
+ \brief Multiplys the one complex vector with the complex conjugate of the second complex vector and stores their results in the third vector
+ \param cVector The complex vector where the results will be stored
+ \param aVector One of the complex vectors to be multiplied
+ \param bVector The complex vector which will be converted to complex conjugate and multiplied
+ \param num_points The number of complex values in aVector and bVector to be multiplied together and stored into cVector
+*/
+static inline void volk_8ic_x2_multiply_conjugate_16ic_a_sse4_1(lv_16sc_t* cVector, const lv_8sc_t* aVector, const lv_8sc_t* bVector, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+
+ __m128i x, y, realz, imagz;
+ lv_16sc_t* c = cVector;
+ const lv_8sc_t* a = aVector;
+ const lv_8sc_t* b = bVector;
+ __m128i conjugateSign = _mm_set_epi16(-1, 1, -1, 1, -1, 1, -1, 1);
+
+ for(;number < quarterPoints; number++){
+ // Convert into 8 bit values into 16 bit values
+ x = _mm_cvtepi8_epi16(_mm_loadl_epi64((__m128i*)a));
+ y = _mm_cvtepi8_epi16(_mm_loadl_epi64((__m128i*)b));
+
+ // Calculate the ar*cr - ai*(-ci) portions
+ realz = _mm_madd_epi16(x,y);
+
+ // Calculate the complex conjugate of the cr + ci j values
+ y = _mm_sign_epi16(y, conjugateSign);
+
+ // Shift the order of the cr and ci values
+ y = _mm_shufflehi_epi16(_mm_shufflelo_epi16(y, _MM_SHUFFLE(2,3,0,1) ), _MM_SHUFFLE(2,3,0,1));
+
+ // Calculate the ar*(-ci) + cr*(ai)
+ imagz = _mm_madd_epi16(x,y);
+
+ _mm_store_si128((__m128i*)c, _mm_packs_epi32(_mm_unpacklo_epi32(realz, imagz), _mm_unpackhi_epi32(realz, imagz)));
+
+ a += 4;
+ b += 4;
+ c += 4;
+ }
+
+ number = quarterPoints * 4;
+ int16_t* c16Ptr = (int16_t*)&cVector[number];
+ int8_t* a8Ptr = (int8_t*)&aVector[number];
+ int8_t* b8Ptr = (int8_t*)&bVector[number];
+ for(; number < num_points; number++){
+ float aReal = (float)*a8Ptr++;
+ float aImag = (float)*a8Ptr++;
+ lv_32fc_t aVal = lv_cmake(aReal, aImag );
+ float bReal = (float)*b8Ptr++;
+ float bImag = (float)*b8Ptr++;
+ lv_32fc_t bVal = lv_cmake( bReal, -bImag );
+ lv_32fc_t temp = aVal * bVal;
+
+ *c16Ptr++ = (int16_t)lv_creal(temp);
+ *c16Ptr++ = (int16_t)lv_cimag(temp);
+ }
+}
+#endif /* LV_HAVE_SSE4_1 */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Multiplys the one complex vector with the complex conjugate of the second complex vector and stores their results in the third vector
+ \param cVector The complex vector where the results will be stored
+ \param aVector One of the complex vectors to be multiplied
+ \param bVector The complex vector which will be converted to complex conjugate and multiplied
+ \param num_points The number of complex values in aVector and bVector to be multiplied together and stored into cVector
+*/
+static inline void volk_8ic_x2_multiply_conjugate_16ic_a_generic(lv_16sc_t* cVector, const lv_8sc_t* aVector, const lv_8sc_t* bVector, unsigned int num_points){
+ unsigned int number = 0;
+ int16_t* c16Ptr = (int16_t*)cVector;
+ int8_t* a8Ptr = (int8_t*)aVector;
+ int8_t* b8Ptr = (int8_t*)bVector;
+ for(number =0; number < num_points; number++){
+ float aReal = (float)*a8Ptr++;
+ float aImag = (float)*a8Ptr++;
+ lv_32fc_t aVal = lv_cmake(aReal, aImag );
+ float bReal = (float)*b8Ptr++;
+ float bImag = (float)*b8Ptr++;
+ lv_32fc_t bVal = lv_cmake( bReal, -bImag );
+ lv_32fc_t temp = aVal * bVal;
+
+ *c16Ptr++ = (int16_t)lv_creal(temp);
+ *c16Ptr++ = (int16_t)lv_cimag(temp);
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_8ic_x2_multiply_conjugate_16ic_a_H */
diff --git a/volk/include/volk/volk_8ic_x2_s32f_multiply_conjugate_32fc_a.h b/volk/include/volk/volk_8ic_x2_s32f_multiply_conjugate_32fc_a.h
new file mode 100644
index 000000000..4b16171ce
--- /dev/null
+++ b/volk/include/volk/volk_8ic_x2_s32f_multiply_conjugate_32fc_a.h
@@ -0,0 +1,122 @@
+#ifndef INCLUDED_volk_8ic_x2_s32f_multiply_conjugate_32fc_a_H
+#define INCLUDED_volk_8ic_x2_s32f_multiply_conjugate_32fc_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+#include <volk/volk_complex.h>
+
+#ifdef LV_HAVE_SSE4_1
+#include <smmintrin.h>
+/*!
+ \brief Multiplys the one complex vector with the complex conjugate of the second complex vector and stores their results in the third vector
+ \param cVector The complex vector where the results will be stored
+ \param aVector One of the complex vectors to be multiplied
+ \param bVector The complex vector which will be converted to complex conjugate and multiplied
+ \param num_points The number of complex values in aVector and bVector to be multiplied together and stored into cVector
+*/
+static inline void volk_8ic_x2_s32f_multiply_conjugate_32fc_a_sse4_1(lv_32fc_t* cVector, const lv_8sc_t* aVector, const lv_8sc_t* bVector, const float scalar, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+
+ __m128i x, y, realz, imagz;
+ __m128 ret;
+ lv_32fc_t* c = cVector;
+ const lv_8sc_t* a = aVector;
+ const lv_8sc_t* b = bVector;
+ __m128i conjugateSign = _mm_set_epi16(-1, 1, -1, 1, -1, 1, -1, 1);
+
+ __m128 invScalar = _mm_set_ps1(1.0/scalar);
+
+ for(;number < quarterPoints; number++){
+ // Convert into 8 bit values into 16 bit values
+ x = _mm_cvtepi8_epi16(_mm_loadl_epi64((__m128i*)a));
+ y = _mm_cvtepi8_epi16(_mm_loadl_epi64((__m128i*)b));
+
+ // Calculate the ar*cr - ai*(-ci) portions
+ realz = _mm_madd_epi16(x,y);
+
+ // Calculate the complex conjugate of the cr + ci j values
+ y = _mm_sign_epi16(y, conjugateSign);
+
+ // Shift the order of the cr and ci values
+ y = _mm_shufflehi_epi16(_mm_shufflelo_epi16(y, _MM_SHUFFLE(2,3,0,1) ), _MM_SHUFFLE(2,3,0,1));
+
+ // Calculate the ar*(-ci) + cr*(ai)
+ imagz = _mm_madd_epi16(x,y);
+
+ // Interleave real and imaginary and then convert to float values
+ ret = _mm_cvtepi32_ps(_mm_unpacklo_epi32(realz, imagz));
+
+ // Normalize the floating point values
+ ret = _mm_mul_ps(ret, invScalar);
+
+ // Store the floating point values
+ _mm_store_ps((float*)c, ret);
+ c += 2;
+
+ // Interleave real and imaginary and then convert to float values
+ ret = _mm_cvtepi32_ps(_mm_unpackhi_epi32(realz, imagz));
+
+ // Normalize the floating point values
+ ret = _mm_mul_ps(ret, invScalar);
+
+ // Store the floating point values
+ _mm_store_ps((float*)c, ret);
+ c += 2;
+
+ a += 4;
+ b += 4;
+ }
+
+ number = quarterPoints * 4;
+ float* cFloatPtr = (float*)&cVector[number];
+ int8_t* a8Ptr = (int8_t*)&aVector[number];
+ int8_t* b8Ptr = (int8_t*)&bVector[number];
+ for(; number < num_points; number++){
+ float aReal = (float)*a8Ptr++;
+ float aImag = (float)*a8Ptr++;
+ lv_32fc_t aVal = lv_cmake(aReal, aImag );
+ float bReal = (float)*b8Ptr++;
+ float bImag = (float)*b8Ptr++;
+ lv_32fc_t bVal = lv_cmake( bReal, -bImag );
+ lv_32fc_t temp = aVal * bVal;
+
+ *cFloatPtr++ = lv_creal(temp) / scalar;
+ *cFloatPtr++ = lv_cimag(temp) / scalar;
+ }
+}
+#endif /* LV_HAVE_SSE4_1 */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Multiplys the one complex vector with the complex conjugate of the second complex vector and stores their results in the third vector
+ \param cVector The complex vector where the results will be stored
+ \param aVector One of the complex vectors to be multiplied
+ \param bVector The complex vector which will be converted to complex conjugate and multiplied
+ \param num_points The number of complex values in aVector and bVector to be multiplied together and stored into cVector
+*/
+static inline void volk_8ic_x2_s32f_multiply_conjugate_32fc_a_generic(lv_32fc_t* cVector, const lv_8sc_t* aVector, const lv_8sc_t* bVector, const float scalar, unsigned int num_points){
+ unsigned int number = 0;
+ float* cPtr = (float*)cVector;
+ const float invScalar = 1.0 / scalar;
+ int8_t* a8Ptr = (int8_t*)aVector;
+ int8_t* b8Ptr = (int8_t*)bVector;
+ for(number = 0; number < num_points; number++){
+ float aReal = (float)*a8Ptr++;
+ float aImag = (float)*a8Ptr++;
+ lv_32fc_t aVal = lv_cmake(aReal, aImag );
+ float bReal = (float)*b8Ptr++;
+ float bImag = (float)*b8Ptr++;
+ lv_32fc_t bVal = lv_cmake( bReal, -bImag );
+ lv_32fc_t temp = aVal * bVal;
+
+ *cPtr++ = (lv_creal(temp) * invScalar);
+ *cPtr++ = (lv_cimag(temp) * invScalar);
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_8ic_x2_s32f_multiply_conjugate_32fc_a_H */
diff --git a/volk/include/volk/volk_common.h b/volk/include/volk/volk_common.h
new file mode 100644
index 000000000..38263d5f7
--- /dev/null
+++ b/volk/include/volk/volk_common.h
@@ -0,0 +1,96 @@
+#ifndef INCLUDED_LIBVOLK_COMMON_H
+#define INCLUDED_LIBVOLK_COMMON_H
+
+////////////////////////////////////////////////////////////////////////
+// Cross-platform attribute macros
+////////////////////////////////////////////////////////////////////////
+#if defined __GNUC__
+# define __VOLK_ATTR_ALIGNED(x) __attribute__((aligned(x)))
+# define __VOLK_ATTR_UNUSED __attribute__((unused))
+# define __VOLK_ATTR_INLINE __attribute__((always_inline))
+# define __VOLK_ATTR_DEPRECATED __attribute__((deprecated))
+# if __GNUC__ >= 4
+# define __VOLK_ATTR_EXPORT __attribute__((visibility("default")))
+# define __VOLK_ATTR_IMPORT __attribute__((visibility("default")))
+# else
+# define __VOLK_ATTR_EXPORT
+# define __VOLK_ATTR_IMPORT
+# endif
+#elif _MSC_VER
+# define __VOLK_ATTR_ALIGNED(x) __declspec(align(x))
+# define __VOLK_ATTR_UNUSED
+# define __VOLK_ATTR_INLINE __forceinline
+# define __VOLK_ATTR_DEPRECATED __declspec(deprecated)
+# define __VOLK_ATTR_EXPORT __declspec(dllexport)
+# define __VOLK_ATTR_IMPORT __declspec(dllimport)
+#else
+# define __VOLK_ATTR_ALIGNED(x)
+# define __VOLK_ATTR_UNUSED
+# define __VOLK_ATTR_INLINE
+# define __VOLK_ATTR_DEPRECATED
+# define __VOLK_ATTR_EXPORT
+# define __VOLK_ATTR_IMPORT
+#endif
+
+////////////////////////////////////////////////////////////////////////
+// Ignore annoying warnings in MSVC
+////////////////////////////////////////////////////////////////////////
+#if defined(_MSC_VER)
+# pragma warning(disable: 4244) //'conversion' conversion from 'type1' to 'type2', possible loss of data
+# pragma warning(disable: 4305) //'identifier' : truncation from 'type1' to 'type2'
+#endif
+
+////////////////////////////////////////////////////////////////////////
+// C-linkage declaration macros
+// FIXME: due to the usage of complex.h, require gcc for c-linkage
+////////////////////////////////////////////////////////////////////////
+#if defined(__cplusplus) && (__GNUC__)
+# define __VOLK_DECL_BEGIN extern "C" {
+# define __VOLK_DECL_END }
+#else
+# define __VOLK_DECL_BEGIN
+# define __VOLK_DECL_END
+#endif
+
+////////////////////////////////////////////////////////////////////////
+// Define VOLK_API for library symbols
+// http://gcc.gnu.org/wiki/Visibility
+////////////////////////////////////////////////////////////////////////
+#ifdef volk_EXPORTS
+# define VOLK_API __VOLK_ATTR_EXPORT
+#else
+# define VOLK_API __VOLK_ATTR_IMPORT
+#endif
+
+////////////////////////////////////////////////////////////////////////
+// The bit128 union used by some
+////////////////////////////////////////////////////////////////////////
+#include <inttypes.h>
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+#endif
+
+#ifdef LV_HAVE_SSE2
+#include <emmintrin.h>
+#endif
+
+union bit128{
+ uint16_t i16[8];
+ uint32_t i[4];
+ float f[4];
+ double d[2];
+
+ #ifdef LV_HAVE_SSE
+ __m128 float_vec;
+ #endif
+
+ #ifdef LV_HAVE_SSE2
+ __m128i int_vec;
+ __m128d double_vec;
+ #endif
+};
+
+#define bit128_p(x) ((union bit128 *)(x))
+
+#endif /*INCLUDED_LIBVOLK_COMMON_H*/
diff --git a/volk/include/volk/volk_complex.h b/volk/include/volk/volk_complex.h
new file mode 100644
index 000000000..5bd925044
--- /dev/null
+++ b/volk/include/volk/volk_complex.h
@@ -0,0 +1,86 @@
+#ifndef INCLUDE_VOLK_COMPLEX_H
+#define INCLUDE_VOLK_COMPLEX_H
+
+/*!
+ * \brief Provide typedefs and operators for all complex types in C and C++.
+ *
+ * The typedefs encompass all signed integer and floating point types.
+ * Each operator function is intended to work across all data types.
+ * Under C++, these operators are defined as inline templates.
+ * Under C, these operators are defined as preprocessor macros.
+ * The use of macros makes the operators agnostic to the type.
+ *
+ * The following operator functions are defined:
+ * - lv_cmake - make a complex type from components
+ * - lv_creal - get the real part of the complex number
+ * - lv_cimag - get the imaginary part of the complex number
+ * - lv_conj - take the conjugate of the complex number
+ */
+
+#ifdef __cplusplus
+
+#include <complex>
+#include <stdint.h>
+
+typedef std::complex<int8_t> lv_8sc_t;
+typedef std::complex<int16_t> lv_16sc_t;
+typedef std::complex<int32_t> lv_32sc_t;
+typedef std::complex<int64_t> lv_64sc_t;
+typedef std::complex<float> lv_32fc_t;
+typedef std::complex<double> lv_64fc_t;
+
+template <typename T> inline std::complex<T> lv_cmake(const T &r, const T &i){
+ return std::complex<T>(r, i);
+}
+
+template <typename T> inline typename T::value_type lv_creal(const T &x){
+ return x.real();
+}
+
+template <typename T> inline typename T::value_type lv_cimag(const T &x){
+ return x.imag();
+}
+
+template <typename T> inline T lv_conj(const T &x){
+ return std::conj(x);
+}
+
+#else /* __cplusplus */
+
+#include <complex.h>
+
+typedef char complex lv_8sc_t;
+typedef short complex lv_16sc_t;
+typedef long complex lv_32sc_t;
+typedef long long complex lv_64sc_t;
+typedef float complex lv_32fc_t;
+typedef double complex lv_64fc_t;
+
+#define lv_cmake(r, i) ((r) + _Complex_I*(i))
+
+// When GNUC is available, use the complex extensions.
+// The extensions always return the correct value type.
+// http://gcc.gnu.org/onlinedocs/gcc/Complex.html
+#ifdef __GNUC__
+
+#define lv_creal(x) (__real__(x))
+
+#define lv_cimag(x) (__imag__(x))
+
+#define lv_conj(x) (~(x))
+
+// When not available, use the c99 complex function family,
+// which always returns double regardless of the input type.
+#else /* __GNUC__ */
+
+#define lv_creal(x) (creal(x))
+
+#define lv_cimag(x) (cimag(x))
+
+#define lv_conj(x) (conj(x))
+
+#endif /* __GNUC__ */
+
+#endif /* __cplusplus */
+
+#endif /* INCLUDE_VOLK_COMPLEX_H */
diff --git a/volk/include/volk/volk_prefs.h b/volk/include/volk/volk_prefs.h
new file mode 100644
index 000000000..690e5f99f
--- /dev/null
+++ b/volk/include/volk/volk_prefs.h
@@ -0,0 +1,28 @@
+#ifndef INCLUDED_VOLK_PREFS_H
+#define INCLUDED_VOLK_PREFS_H
+
+#include <volk/volk_common.h>
+#include <stdlib.h>
+
+__VOLK_DECL_BEGIN
+
+typedef struct volk_arch_pref
+{
+ char name[128]; //name of the kernel
+ char impl_a[128]; //best aligned impl
+ char impl_u[128]; //best unaligned impl
+} volk_arch_pref_t;
+
+////////////////////////////////////////////////////////////////////////
+// get path to volk_config profiling info
+////////////////////////////////////////////////////////////////////////
+VOLK_API void volk_get_config_path(char *);
+
+////////////////////////////////////////////////////////////////////////
+// load prefs into global prefs struct
+////////////////////////////////////////////////////////////////////////
+VOLK_API size_t volk_load_preferences(volk_arch_pref_t **);
+
+__VOLK_DECL_END
+
+#endif //INCLUDED_VOLK_PREFS_H
diff --git a/volk/kernels/README.txt b/volk/kernels/README.txt
new file mode 100644
index 000000000..5dd7434b5
--- /dev/null
+++ b/volk/kernels/README.txt
@@ -0,0 +1,67 @@
+########################################################################
+# How to create custom kernel dispatchers
+########################################################################
+A kernel dispatcher is kernel implementation that calls other kernel implementations.
+By default, a dispatcher is generated by the build system for every kernel such that:
+ * the best aligned implemention is called when all pointer arguments are aligned,
+ * and otherwise the best unaligned implementation is called.
+
+The author of a VOLK kernel may create a custom dispatcher,
+to be called in place of the automatically generated one.
+A custom dispatcher may be useful to handle head and tail cases,
+or to implement different alignment and bounds checking logic.
+
+########################################################################
+# Code for an example dispatcher w/ tail case
+########################################################################
+#include <volk/volk_common.h>
+
+#ifdef LV_HAVE_DISPATCHER
+
+static inline void volk_32f_x2_add_32f_dispatcher(float* cVector, const float* aVector, const float* bVector, unsigned int num_points)
+{
+ const unsigned int num_points_r = num_points%4;
+ const unsigned int num_points_x = num_points - num_points_r;
+
+ if (volk_is_aligned(VOLK_OR_PTR(cVector, VOLK_OR_PTR(aVector, bVector))))
+ {
+ volk_32f_x2_add_32f_a(cVector, aVector, bVector, num_points_x);
+ }
+ else
+ {
+ volk_32f_x2_add_32f_u(cVector, aVector, bVector, num_points_x);
+ }
+
+ volk_32f_x2_add_32f_g(cVector+num_points_x, aVector+num_points_x, bVector+num_points_x, num_points_r);
+}
+
+#endif //LV_HAVE_DISPATCHER
+
+########################################################################
+# Code for an example dispatcher w/ tail case and accumulator
+########################################################################
+#include <volk/volk_common.h>
+
+#ifdef LV_HAVE_DISPATCHER
+
+static inline void volk_32f_x2_dot_prod_32f_dispatcher(float * result, const float * input, const float * taps, unsigned int num_points)
+{
+ const unsigned int num_points_r = num_points%16;
+ const unsigned int num_points_x = num_points - num_points_r;
+
+ if (volk_is_aligned(VOLK_OR_PTR(input, taps)))
+ {
+ volk_32f_x2_dot_prod_32f_a(result, input, taps, num_points_x);
+ }
+ else
+ {
+ volk_32f_x2_dot_prod_32f_u(result, input, taps, num_points_x);
+ }
+
+ float result_tail = 0;
+ volk_32f_x2_dot_prod_32f_g(&result_tail, input+num_points_x, taps+num_points_x, num_points_r);
+
+ *result += result_tail;
+}
+
+#endif //LV_HAVE_DISPATCHER
diff --git a/volk/kernels/volk/volk_16i_32fc_dot_prod_32fc.h b/volk/kernels/volk/volk_16i_32fc_dot_prod_32fc.h
new file mode 100644
index 000000000..8bc1569f6
--- /dev/null
+++ b/volk/kernels/volk/volk_16i_32fc_dot_prod_32fc.h
@@ -0,0 +1,122 @@
+#ifndef INCLUDED_volk_16i_32fc_dot_prod_32fc_a_H
+#define INCLUDED_volk_16i_32fc_dot_prod_32fc_a_H
+
+#include <volk/volk_common.h>
+#include<stdio.h>
+
+
+#ifdef LV_HAVE_GENERIC
+
+
+static inline void volk_16i_32fc_dot_prod_32fc_generic(lv_32fc_t* result, const short* input, const lv_32fc_t * taps, unsigned int num_points) {
+
+ static const int N_UNROLL = 4;
+
+ lv_32fc_t acc0 = 0;
+ lv_32fc_t acc1 = 0;
+ lv_32fc_t acc2 = 0;
+ lv_32fc_t acc3 = 0;
+
+ unsigned i = 0;
+ unsigned n = (num_points / N_UNROLL) * N_UNROLL;
+
+ for(i = 0; i < n; i += N_UNROLL) {
+ acc0 += taps[i + 0] * (float)input[i + 0];
+ acc1 += taps[i + 1] * (float)input[i + 1];
+ acc2 += taps[i + 2] * (float)input[i + 2];
+ acc3 += taps[i + 3] * (float)input[i + 3];
+ }
+
+ for(; i < num_points; i++) {
+ acc0 += taps[i] * (float)input[i];
+ }
+
+ *result = acc0 + acc1 + acc2 + acc3;
+}
+
+#endif /*LV_HAVE_GENERIC*/
+
+
+#if LV_HAVE_SSE && LV_HAVE_MMX
+
+
+static inline void volk_16i_32fc_dot_prod_32fc_a_sse( lv_32fc_t* result, const short* input, const lv_32fc_t* taps, unsigned int num_points) {
+
+ unsigned int number = 0;
+ const unsigned int sixteenthPoints = num_points / 8;
+
+ float res[2];
+ float *realpt = &res[0], *imagpt = &res[1];
+ const short* aPtr = input;
+ const float* bPtr = (float*)taps;
+
+ __m64 m0, m1;
+ __m128 f0, f1, f2, f3;
+ __m128 a0Val, a1Val, a2Val, a3Val;
+ __m128 b0Val, b1Val, b2Val, b3Val;
+ __m128 c0Val, c1Val, c2Val, c3Val;
+
+ __m128 dotProdVal0 = _mm_setzero_ps();
+ __m128 dotProdVal1 = _mm_setzero_ps();
+ __m128 dotProdVal2 = _mm_setzero_ps();
+ __m128 dotProdVal3 = _mm_setzero_ps();
+
+ for(;number < sixteenthPoints; number++){
+
+ m0 = _mm_set_pi16(*(aPtr+3), *(aPtr+2), *(aPtr+1), *(aPtr+0));
+ m1 = _mm_set_pi16(*(aPtr+7), *(aPtr+6), *(aPtr+5), *(aPtr+4));
+ f0 = _mm_cvtpi16_ps(m0);
+ f1 = _mm_cvtpi16_ps(m0);
+ f2 = _mm_cvtpi16_ps(m1);
+ f3 = _mm_cvtpi16_ps(m1);
+
+ a0Val = _mm_unpacklo_ps(f0, f1);
+ a1Val = _mm_unpackhi_ps(f0, f1);
+ a2Val = _mm_unpacklo_ps(f2, f3);
+ a3Val = _mm_unpackhi_ps(f2, f3);
+
+ b0Val = _mm_load_ps(bPtr);
+ b1Val = _mm_load_ps(bPtr+4);
+ b2Val = _mm_load_ps(bPtr+8);
+ b3Val = _mm_load_ps(bPtr+12);
+
+ c0Val = _mm_mul_ps(a0Val, b0Val);
+ c1Val = _mm_mul_ps(a1Val, b1Val);
+ c2Val = _mm_mul_ps(a2Val, b2Val);
+ c3Val = _mm_mul_ps(a3Val, b3Val);
+
+ dotProdVal0 = _mm_add_ps(c0Val, dotProdVal0);
+ dotProdVal1 = _mm_add_ps(c1Val, dotProdVal1);
+ dotProdVal2 = _mm_add_ps(c2Val, dotProdVal2);
+ dotProdVal3 = _mm_add_ps(c3Val, dotProdVal3);
+
+ aPtr += 8;
+ bPtr += 16;
+ }
+
+ dotProdVal0 = _mm_add_ps(dotProdVal0, dotProdVal1);
+ dotProdVal0 = _mm_add_ps(dotProdVal0, dotProdVal2);
+ dotProdVal0 = _mm_add_ps(dotProdVal0, dotProdVal3);
+
+ __VOLK_ATTR_ALIGNED(16) float dotProductVector[4];
+
+ _mm_store_ps(dotProductVector,dotProdVal0); // Store the results back into the dot product vector
+
+ *realpt = dotProductVector[0];
+ *imagpt = dotProductVector[1];
+ *realpt += dotProductVector[2];
+ *imagpt += dotProductVector[3];
+
+ number = sixteenthPoints*8;
+ for(;number < num_points; number++){
+ *realpt += ((*aPtr) * (*bPtr++));
+ *imagpt += ((*aPtr++) * (*bPtr++));
+ }
+
+ *result = *(lv_32fc_t*)(&res[0]);
+}
+
+#endif /*LV_HAVE_SSE && LV_HAVE_MMX*/
+
+
+#endif /*INCLUDED_volk_16i_32fc_dot_prod_32fc_a_H*/
diff --git a/volk/kernels/volk/volk_16i_branch_4_state_8.h b/volk/kernels/volk/volk_16i_branch_4_state_8.h
new file mode 100644
index 000000000..cdfbc7ba1
--- /dev/null
+++ b/volk/kernels/volk/volk_16i_branch_4_state_8.h
@@ -0,0 +1,194 @@
+#ifndef INCLUDED_volk_16i_branch_4_state_8_a_H
+#define INCLUDED_volk_16i_branch_4_state_8_a_H
+
+
+#include<inttypes.h>
+#include<stdio.h>
+
+
+
+
+#ifdef LV_HAVE_SSSE3
+
+#include<xmmintrin.h>
+#include<emmintrin.h>
+#include<tmmintrin.h>
+
+static inline void volk_16i_branch_4_state_8_a_ssse3(short* target, short* src0, char** permuters, short* cntl2, short* cntl3, short* scalars) {
+
+
+ __m128i xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, xmm8, xmm9, xmm10, xmm11;
+
+ __m128i *p_target, *p_src0, *p_cntl2, *p_cntl3, *p_scalars;
+
+
+
+ p_target = (__m128i*)target;
+ p_src0 = (__m128i*)src0;
+ p_cntl2 = (__m128i*)cntl2;
+ p_cntl3 = (__m128i*)cntl3;
+ p_scalars = (__m128i*)scalars;
+
+ int i = 0;
+
+ int bound = 1;
+
+
+ xmm0 = _mm_load_si128(p_scalars);
+
+ xmm1 = _mm_shufflelo_epi16(xmm0, 0);
+ xmm2 = _mm_shufflelo_epi16(xmm0, 0x55);
+ xmm3 = _mm_shufflelo_epi16(xmm0, 0xaa);
+ xmm4 = _mm_shufflelo_epi16(xmm0, 0xff);
+
+ xmm1 = _mm_shuffle_epi32(xmm1, 0x00);
+ xmm2 = _mm_shuffle_epi32(xmm2, 0x00);
+ xmm3 = _mm_shuffle_epi32(xmm3, 0x00);
+ xmm4 = _mm_shuffle_epi32(xmm4, 0x00);
+
+ xmm0 = _mm_load_si128((__m128i*)permuters[0]);
+ xmm6 = _mm_load_si128((__m128i*)permuters[1]);
+ xmm8 = _mm_load_si128((__m128i*)permuters[2]);
+ xmm10 = _mm_load_si128((__m128i*)permuters[3]);
+
+ for(; i < bound; ++i) {
+
+ xmm5 = _mm_load_si128(p_src0);
+
+
+
+
+
+
+
+
+
+ xmm0 = _mm_shuffle_epi8(xmm5, xmm0);
+ xmm6 = _mm_shuffle_epi8(xmm5, xmm6);
+ xmm8 = _mm_shuffle_epi8(xmm5, xmm8);
+ xmm10 = _mm_shuffle_epi8(xmm5, xmm10);
+
+ p_src0 += 4;
+
+
+ xmm5 = _mm_add_epi16(xmm1, xmm2);
+
+ xmm6 = _mm_add_epi16(xmm2, xmm6);
+ xmm8 = _mm_add_epi16(xmm1, xmm8);
+
+
+ xmm7 = _mm_load_si128(p_cntl2);
+ xmm9 = _mm_load_si128(p_cntl3);
+
+ xmm0 = _mm_add_epi16(xmm5, xmm0);
+
+
+ xmm7 = _mm_and_si128(xmm7, xmm3);
+ xmm9 = _mm_and_si128(xmm9, xmm4);
+
+ xmm5 = _mm_load_si128(&p_cntl2[1]);
+ xmm11 = _mm_load_si128(&p_cntl3[1]);
+
+ xmm7 = _mm_add_epi16(xmm7, xmm9);
+
+ xmm5 = _mm_and_si128(xmm5, xmm3);
+ xmm11 = _mm_and_si128(xmm11, xmm4);
+
+ xmm0 = _mm_add_epi16(xmm0, xmm7);
+
+
+
+ xmm7 = _mm_load_si128(&p_cntl2[2]);
+ xmm9 = _mm_load_si128(&p_cntl3[2]);
+
+ xmm5 = _mm_add_epi16(xmm5, xmm11);
+
+ xmm7 = _mm_and_si128(xmm7, xmm3);
+ xmm9 = _mm_and_si128(xmm9, xmm4);
+
+ xmm6 = _mm_add_epi16(xmm6, xmm5);
+
+
+ xmm5 = _mm_load_si128(&p_cntl2[3]);
+ xmm11 = _mm_load_si128(&p_cntl3[3]);
+
+ xmm7 = _mm_add_epi16(xmm7, xmm9);
+
+ xmm5 = _mm_and_si128(xmm5, xmm3);
+ xmm11 = _mm_and_si128(xmm11, xmm4);
+
+ xmm8 = _mm_add_epi16(xmm8, xmm7);
+
+ xmm5 = _mm_add_epi16(xmm5, xmm11);
+
+ _mm_store_si128(p_target, xmm0);
+ _mm_store_si128(&p_target[1], xmm6);
+
+ xmm10 = _mm_add_epi16(xmm5, xmm10);
+
+ _mm_store_si128(&p_target[2], xmm8);
+
+ _mm_store_si128(&p_target[3], xmm10);
+
+ p_target += 3;
+ }
+}
+
+
+#endif /*LV_HAVE_SSEs*/
+
+#ifdef LV_HAVE_GENERIC
+static inline void volk_16i_branch_4_state_8_generic(short* target, short* src0, char** permuters, short* cntl2, short* cntl3, short* scalars) {
+ int i = 0;
+
+ int bound = 4;
+
+ for(; i < bound; ++i) {
+ target[i* 8] = src0[((char)permuters[i][0])/2]
+ + ((i + 1)%2 * scalars[0])
+ + (((i >> 1)^1) * scalars[1])
+ + (cntl2[i * 8] & scalars[2])
+ + (cntl3[i * 8] & scalars[3]);
+ target[i* 8 + 1] = src0[((char)permuters[i][1 * 2])/2]
+ + ((i + 1)%2 * scalars[0])
+ + (((i >> 1)^1) * scalars[1])
+ + (cntl2[i * 8 + 1] & scalars[2])
+ + (cntl3[i * 8 + 1] & scalars[3]);
+ target[i* 8 + 2] = src0[((char)permuters[i][2 * 2])/2]
+ + ((i + 1)%2 * scalars[0])
+ + (((i >> 1)^1) * scalars[1])
+ + (cntl2[i * 8 + 2] & scalars[2])
+ + (cntl3[i * 8 + 2] & scalars[3]);
+ target[i* 8 + 3] = src0[((char)permuters[i][3 * 2])/2]
+ + ((i + 1)%2 * scalars[0])
+ + (((i >> 1)^1) * scalars[1])
+ + (cntl2[i * 8 + 3] & scalars[2])
+ + (cntl3[i * 8 + 3] & scalars[3]);
+ target[i* 8 + 4] = src0[((char)permuters[i][4 * 2])/2]
+ + ((i + 1)%2 * scalars[0])
+ + (((i >> 1)^1) * scalars[1])
+ + (cntl2[i * 8 + 4] & scalars[2])
+ + (cntl3[i * 8 + 4] & scalars[3]);
+ target[i* 8 + 5] = src0[((char)permuters[i][5 * 2])/2]
+ + ((i + 1)%2 * scalars[0])
+ + (((i >> 1)^1) * scalars[1])
+ + (cntl2[i * 8 + 5] & scalars[2])
+ + (cntl3[i * 8 + 5] & scalars[3]);
+ target[i* 8 + 6] = src0[((char)permuters[i][6 * 2])/2]
+ + ((i + 1)%2 * scalars[0])
+ + (((i >> 1)^1) * scalars[1])
+ + (cntl2[i * 8 + 6] & scalars[2])
+ + (cntl3[i * 8 + 6] & scalars[3]);
+ target[i* 8 + 7] = src0[((char)permuters[i][7 * 2])/2]
+ + ((i + 1)%2 * scalars[0])
+ + (((i >> 1)^1) * scalars[1])
+ + (cntl2[i * 8 + 7] & scalars[2])
+ + (cntl3[i * 8 + 7] & scalars[3]);
+
+ }
+}
+
+#endif /*LV_HAVE_GENERIC*/
+
+
+#endif /*INCLUDED_volk_16i_branch_4_state_8_a_H*/
diff --git a/volk/kernels/volk/volk_16i_convert_8i.h b/volk/kernels/volk/volk_16i_convert_8i.h
new file mode 100644
index 000000000..3789b2e4a
--- /dev/null
+++ b/volk/kernels/volk/volk_16i_convert_8i.h
@@ -0,0 +1,140 @@
+#ifndef INCLUDED_volk_16i_convert_8i_u_H
+#define INCLUDED_volk_16i_convert_8i_u_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE2
+#include <emmintrin.h>
+/*!
+ \brief Converts the input 16 bit integer data into 8 bit integer data
+ \param inputVector The 16 bit input data buffer
+ \param outputVector The 8 bit output data buffer
+ \param num_points The number of data values to be converted
+ \note Input and output buffers do NOT need to be properly aligned
+*/
+static inline void volk_16i_convert_8i_u_sse2(int8_t* outputVector, const int16_t* inputVector, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int sixteenthPoints = num_points / 16;
+
+ int8_t* outputVectorPtr = outputVector;
+ int16_t* inputPtr = (int16_t*)inputVector;
+ __m128i inputVal1;
+ __m128i inputVal2;
+ __m128i ret;
+
+ for(;number < sixteenthPoints; number++){
+
+ // Load the 16 values
+ inputVal1 = _mm_loadu_si128((__m128i*)inputPtr); inputPtr += 8;
+ inputVal2 = _mm_loadu_si128((__m128i*)inputPtr); inputPtr += 8;
+
+ inputVal1 = _mm_srai_epi16(inputVal1, 8);
+ inputVal2 = _mm_srai_epi16(inputVal2, 8);
+
+ ret = _mm_packs_epi16(inputVal1, inputVal2);
+
+ _mm_storeu_si128((__m128i*)outputVectorPtr, ret);
+
+ outputVectorPtr += 16;
+ }
+
+ number = sixteenthPoints * 16;
+ for(; number < num_points; number++){
+ outputVector[number] =(int8_t)(inputVector[number] >> 8);
+ }
+}
+#endif /* LV_HAVE_SSE2 */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Converts the input 16 bit integer data into 8 bit integer data
+ \param inputVector The 16 bit input data buffer
+ \param outputVector The 8 bit output data buffer
+ \param num_points The number of data values to be converted
+ \note Input and output buffers do NOT need to be properly aligned
+*/
+static inline void volk_16i_convert_8i_generic(int8_t* outputVector, const int16_t* inputVector, unsigned int num_points){
+ int8_t* outputVectorPtr = outputVector;
+ const int16_t* inputVectorPtr = inputVector;
+ unsigned int number = 0;
+
+ for(number = 0; number < num_points; number++){
+ *outputVectorPtr++ = ((int8_t)(*inputVectorPtr++ >> 8));
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_16i_convert_8i_u_H */
+#ifndef INCLUDED_volk_16i_convert_8i_a_H
+#define INCLUDED_volk_16i_convert_8i_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE2
+#include <emmintrin.h>
+/*!
+ \brief Converts the input 16 bit integer data into 8 bit integer data
+ \param inputVector The 16 bit input data buffer
+ \param outputVector The 8 bit output data buffer
+ \param num_points The number of data values to be converted
+*/
+static inline void volk_16i_convert_8i_a_sse2(int8_t* outputVector, const int16_t* inputVector, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int sixteenthPoints = num_points / 16;
+
+ int8_t* outputVectorPtr = outputVector;
+ int16_t* inputPtr = (int16_t*)inputVector;
+ __m128i inputVal1;
+ __m128i inputVal2;
+ __m128i ret;
+
+ for(;number < sixteenthPoints; number++){
+
+ // Load the 16 values
+ inputVal1 = _mm_load_si128((__m128i*)inputPtr); inputPtr += 8;
+ inputVal2 = _mm_load_si128((__m128i*)inputPtr); inputPtr += 8;
+
+ inputVal1 = _mm_srai_epi16(inputVal1, 8);
+ inputVal2 = _mm_srai_epi16(inputVal2, 8);
+
+ ret = _mm_packs_epi16(inputVal1, inputVal2);
+
+ _mm_store_si128((__m128i*)outputVectorPtr, ret);
+
+ outputVectorPtr += 16;
+ }
+
+ number = sixteenthPoints * 16;
+ for(; number < num_points; number++){
+ outputVector[number] =(int8_t)(inputVector[number] >> 8);
+ }
+}
+#endif /* LV_HAVE_SSE2 */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Converts the input 16 bit integer data into 8 bit integer data
+ \param inputVector The 16 bit input data buffer
+ \param outputVector The 8 bit output data buffer
+ \param num_points The number of data values to be converted
+*/
+static inline void volk_16i_convert_8i_a_generic(int8_t* outputVector, const int16_t* inputVector, unsigned int num_points){
+ int8_t* outputVectorPtr = outputVector;
+ const int16_t* inputVectorPtr = inputVector;
+ unsigned int number = 0;
+
+ for(number = 0; number < num_points; number++){
+ *outputVectorPtr++ = ((int8_t)(*inputVectorPtr++ >> 8));
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_16i_convert_8i_a_H */
diff --git a/volk/kernels/volk/volk_16i_max_star_16i.h b/volk/kernels/volk/volk_16i_max_star_16i.h
new file mode 100644
index 000000000..c67351c5f
--- /dev/null
+++ b/volk/kernels/volk/volk_16i_max_star_16i.h
@@ -0,0 +1,110 @@
+#ifndef INCLUDED_volk_16i_max_star_16i_a_H
+#define INCLUDED_volk_16i_max_star_16i_a_H
+
+
+#include<inttypes.h>
+#include<stdio.h>
+
+
+#ifdef LV_HAVE_SSSE3
+
+#include<xmmintrin.h>
+#include<emmintrin.h>
+#include<tmmintrin.h>
+
+static inline void volk_16i_max_star_16i_a_ssse3(short* target, short* src0, unsigned int num_points) {
+
+ const unsigned int num_bytes = num_points*2;
+
+ short candidate = src0[0];
+ short cands[8];
+ __m128i xmm0, xmm1, xmm3, xmm4, xmm5, xmm6;
+
+
+ __m128i *p_src0;
+
+ p_src0 = (__m128i*)src0;
+
+ int bound = num_bytes >> 4;
+ int leftovers = (num_bytes >> 1) & 7;
+
+ int i = 0;
+
+
+ xmm1 = _mm_setzero_si128();
+ xmm0 = _mm_setzero_si128();
+ //_mm_insert_epi16(xmm0, candidate, 0);
+
+ xmm0 = _mm_shuffle_epi8(xmm0, xmm1);
+
+
+ for(i = 0; i < bound; ++i) {
+ xmm1 = _mm_load_si128(p_src0);
+ p_src0 += 1;
+ //xmm2 = _mm_sub_epi16(xmm1, xmm0);
+
+
+
+
+
+
+ xmm3 = _mm_cmpgt_epi16(xmm0, xmm1);
+ xmm4 = _mm_cmpeq_epi16(xmm0, xmm1);
+ xmm5 = _mm_cmpgt_epi16(xmm1, xmm0);
+
+ xmm6 = _mm_xor_si128(xmm4, xmm5);
+
+ xmm3 = _mm_and_si128(xmm3, xmm0);
+ xmm4 = _mm_and_si128(xmm6, xmm1);
+
+ xmm0 = _mm_add_epi16(xmm3, xmm4);
+
+
+ }
+
+ _mm_store_si128((__m128i*)cands, xmm0);
+
+ for(i = 0; i < 8; ++i) {
+ candidate = ((short)(candidate - cands[i]) > 0) ? candidate : cands[i];
+ }
+
+
+
+ for(i = 0; i < leftovers; ++i) {
+
+ candidate = ((short)(candidate - src0[(bound << 3) + i]) > 0) ? candidate : src0[(bound << 3) + i];
+ }
+
+ target[0] = candidate;
+
+
+
+
+
+}
+
+#endif /*LV_HAVE_SSSE3*/
+
+#ifdef LV_HAVE_GENERIC
+
+static inline void volk_16i_max_star_16i_generic(short* target, short* src0, unsigned int num_points) {
+
+ const unsigned int num_bytes = num_points*2;
+
+ int i = 0;
+
+ int bound = num_bytes >> 1;
+
+ short candidate = src0[0];
+ for(i = 1; i < bound; ++i) {
+ candidate = ((short)(candidate - src0[i]) > 0) ? candidate : src0[i];
+ }
+ target[0] = candidate;
+
+}
+
+
+#endif /*LV_HAVE_GENERIC*/
+
+
+#endif /*INCLUDED_volk_16i_max_star_16i_a_H*/
diff --git a/volk/kernels/volk/volk_16i_max_star_horizontal_16i.h b/volk/kernels/volk/volk_16i_max_star_horizontal_16i.h
new file mode 100644
index 000000000..ef88ec094
--- /dev/null
+++ b/volk/kernels/volk/volk_16i_max_star_horizontal_16i.h
@@ -0,0 +1,134 @@
+#ifndef INCLUDED_volk_16i_max_star_horizontal_16i_a_H
+#define INCLUDED_volk_16i_max_star_horizontal_16i_a_H
+
+#include <volk/volk_common.h>
+
+#include<inttypes.h>
+#include<stdio.h>
+
+
+#ifdef LV_HAVE_SSSE3
+
+#include<xmmintrin.h>
+#include<emmintrin.h>
+#include<tmmintrin.h>
+
+static inline void volk_16i_max_star_horizontal_16i_a_ssse3(int16_t* target, int16_t* src0, unsigned int num_points) {
+
+ const unsigned int num_bytes = num_points*2;
+
+ const static uint8_t shufmask0[16] = {0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0c, 0x0d, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
+ const static uint8_t shufmask1[16] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0c, 0x0d};
+ const static uint8_t andmask0[16] = {0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+ const static uint8_t andmask1[16] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02};
+
+
+
+ __m128i xmm0, xmm1, xmm2, xmm3, xmm4;
+ __m128i xmm5, xmm6, xmm7, xmm8;
+
+ xmm4 = _mm_load_si128((__m128i*)shufmask0);
+ xmm5 = _mm_load_si128((__m128i*)shufmask1);
+ xmm6 = _mm_load_si128((__m128i*)andmask0);
+ xmm7 = _mm_load_si128((__m128i*)andmask1);
+
+ __m128i *p_target, *p_src0;
+
+ p_target = (__m128i*)target;
+ p_src0 = (__m128i*)src0;
+
+ int bound = num_bytes >> 5;
+ int intermediate = (num_bytes >> 4) & 1;
+ int leftovers = (num_bytes >> 1) & 7;
+
+ int i = 0;
+
+
+ for(i = 0; i < bound; ++i) {
+
+ xmm0 = _mm_load_si128(p_src0);
+ xmm1 = _mm_load_si128(&p_src0[1]);
+
+
+
+ xmm2 = _mm_xor_si128(xmm2, xmm2);
+ p_src0 += 2;
+
+ xmm3 = _mm_hsub_epi16(xmm0, xmm1);
+
+ xmm2 = _mm_cmpgt_epi16(xmm2, xmm3);
+
+ xmm8 = _mm_and_si128(xmm2, xmm6);
+ xmm3 = _mm_and_si128(xmm2, xmm7);
+
+
+ xmm8 = _mm_add_epi8(xmm8, xmm4);
+ xmm3 = _mm_add_epi8(xmm3, xmm5);
+
+ xmm0 = _mm_shuffle_epi8(xmm0, xmm8);
+ xmm1 = _mm_shuffle_epi8(xmm1, xmm3);
+
+
+ xmm3 = _mm_add_epi16(xmm0, xmm1);
+
+
+ _mm_store_si128(p_target, xmm3);
+
+ p_target += 1;
+
+ }
+
+ for(i = 0; i < intermediate; ++i) {
+
+ xmm0 = _mm_load_si128(p_src0);
+
+
+ xmm2 = _mm_xor_si128(xmm2, xmm2);
+ p_src0 += 1;
+
+ xmm3 = _mm_hsub_epi16(xmm0, xmm1);
+ xmm2 = _mm_cmpgt_epi16(xmm2, xmm3);
+
+ xmm8 = _mm_and_si128(xmm2, xmm6);
+
+ xmm3 = _mm_add_epi8(xmm8, xmm4);
+
+ xmm0 = _mm_shuffle_epi8(xmm0, xmm3);
+
+ _mm_storel_pd((double*)p_target, bit128_p(&xmm0)->double_vec);
+
+ p_target = (__m128i*)((int8_t*)p_target + 8);
+
+ }
+
+ for(i = (bound << 4) + (intermediate << 3); i < (bound << 4) + (intermediate << 3) + leftovers ; i += 2) {
+ target[i>>1] = ((int16_t)(src0[i] - src0[i + 1]) > 0) ? src0[i] : src0[i + 1];
+ }
+
+
+}
+
+#endif /*LV_HAVE_SSSE3*/
+
+
+#ifdef LV_HAVE_GENERIC
+static inline void volk_16i_max_star_horizontal_16i_generic(int16_t* target, int16_t* src0, unsigned int num_points) {
+
+ const unsigned int num_bytes = num_points*2;
+
+ int i = 0;
+
+ int bound = num_bytes >> 1;
+
+
+ for(i = 0; i < bound; i += 2) {
+ target[i >> 1] = ((int16_t) (src0[i] - src0[i + 1]) > 0) ? src0[i] : src0[i+1];
+ }
+
+}
+
+
+
+#endif /*LV_HAVE_GENERIC*/
+
+#endif /*INCLUDED_volk_16i_max_star_horizontal_16i_a_H*/
diff --git a/volk/kernels/volk/volk_16i_permute_and_scalar_add.h b/volk/kernels/volk/volk_16i_permute_and_scalar_add.h
new file mode 100644
index 000000000..7a01d172a
--- /dev/null
+++ b/volk/kernels/volk/volk_16i_permute_and_scalar_add.h
@@ -0,0 +1,142 @@
+#ifndef INCLUDED_volk_16i_permute_and_scalar_add_a_H
+#define INCLUDED_volk_16i_permute_and_scalar_add_a_H
+
+
+#include<inttypes.h>
+#include<stdio.h>
+
+
+
+
+#ifdef LV_HAVE_SSE2
+
+#include<xmmintrin.h>
+#include<emmintrin.h>
+
+static inline void volk_16i_permute_and_scalar_add_a_sse2(short* target, short* src0, short* permute_indexes, short* cntl0, short* cntl1, short* cntl2, short* cntl3, short* scalars, unsigned int num_points) {
+
+ const unsigned int num_bytes = num_points*2;
+
+ __m128i xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7;
+
+ __m128i *p_target, *p_cntl0, *p_cntl1, *p_cntl2, *p_cntl3, *p_scalars;
+
+ short* p_permute_indexes = permute_indexes;
+
+ p_target = (__m128i*)target;
+ p_cntl0 = (__m128i*)cntl0;
+ p_cntl1 = (__m128i*)cntl1;
+ p_cntl2 = (__m128i*)cntl2;
+ p_cntl3 = (__m128i*)cntl3;
+ p_scalars = (__m128i*)scalars;
+
+ int i = 0;
+
+ int bound = (num_bytes >> 4);
+ int leftovers = (num_bytes >> 1) & 7;
+
+ xmm0 = _mm_load_si128(p_scalars);
+
+ xmm1 = _mm_shufflelo_epi16(xmm0, 0);
+ xmm2 = _mm_shufflelo_epi16(xmm0, 0x55);
+ xmm3 = _mm_shufflelo_epi16(xmm0, 0xaa);
+ xmm4 = _mm_shufflelo_epi16(xmm0, 0xff);
+
+ xmm1 = _mm_shuffle_epi32(xmm1, 0x00);
+ xmm2 = _mm_shuffle_epi32(xmm2, 0x00);
+ xmm3 = _mm_shuffle_epi32(xmm3, 0x00);
+ xmm4 = _mm_shuffle_epi32(xmm4, 0x00);
+
+
+ for(; i < bound; ++i) {
+ xmm0 = _mm_setzero_si128();
+ xmm5 = _mm_setzero_si128();
+ xmm6 = _mm_setzero_si128();
+ xmm7 = _mm_setzero_si128();
+
+ xmm0 = _mm_insert_epi16(xmm0, src0[p_permute_indexes[0]], 0);
+ xmm5 = _mm_insert_epi16(xmm5, src0[p_permute_indexes[1]], 1);
+ xmm6 = _mm_insert_epi16(xmm6, src0[p_permute_indexes[2]], 2);
+ xmm7 = _mm_insert_epi16(xmm7, src0[p_permute_indexes[3]], 3);
+ xmm0 = _mm_insert_epi16(xmm0, src0[p_permute_indexes[4]], 4);
+ xmm5 = _mm_insert_epi16(xmm5, src0[p_permute_indexes[5]], 5);
+ xmm6 = _mm_insert_epi16(xmm6, src0[p_permute_indexes[6]], 6);
+ xmm7 = _mm_insert_epi16(xmm7, src0[p_permute_indexes[7]], 7);
+
+ xmm0 = _mm_add_epi16(xmm0, xmm5);
+ xmm6 = _mm_add_epi16(xmm6, xmm7);
+
+ p_permute_indexes += 8;
+
+ xmm0 = _mm_add_epi16(xmm0, xmm6);
+
+ xmm5 = _mm_load_si128(p_cntl0);
+ xmm6 = _mm_load_si128(p_cntl1);
+ xmm7 = _mm_load_si128(p_cntl2);
+
+ xmm5 = _mm_and_si128(xmm5, xmm1);
+ xmm6 = _mm_and_si128(xmm6, xmm2);
+ xmm7 = _mm_and_si128(xmm7, xmm3);
+
+ xmm0 = _mm_add_epi16(xmm0, xmm5);
+
+ xmm5 = _mm_load_si128(p_cntl3);
+
+ xmm6 = _mm_add_epi16(xmm6, xmm7);
+
+ p_cntl0 += 1;
+
+ xmm5 = _mm_and_si128(xmm5, xmm4);
+
+ xmm0 = _mm_add_epi16(xmm0, xmm6);
+
+ p_cntl1 += 1;
+ p_cntl2 += 1;
+
+ xmm0 = _mm_add_epi16(xmm0, xmm5);
+
+ p_cntl3 += 1;
+
+ _mm_store_si128(p_target, xmm0);
+
+ p_target += 1;
+ }
+
+
+
+
+
+ for(i = bound * 8; i < (bound * 8) + leftovers; ++i) {
+ target[i] = src0[permute_indexes[i]]
+ + (cntl0[i] & scalars[0])
+ + (cntl1[i] & scalars[1])
+ + (cntl2[i] & scalars[2])
+ + (cntl3[i] & scalars[3]);
+ }
+}
+#endif /*LV_HAVE_SSEs*/
+
+
+#ifdef LV_HAVE_GENERIC
+static inline void volk_16i_permute_and_scalar_add_generic(short* target, short* src0, short* permute_indexes, short* cntl0, short* cntl1, short* cntl2, short* cntl3, short* scalars, unsigned int num_points) {
+
+ const unsigned int num_bytes = num_points*2;
+
+ int i = 0;
+
+ int bound = num_bytes >> 1;
+
+ for(i = 0; i < bound; ++i) {
+ target[i] = src0[permute_indexes[i]]
+ + (cntl0[i] & scalars[0])
+ + (cntl1[i] & scalars[1])
+ + (cntl2[i] & scalars[2])
+ + (cntl3[i] & scalars[3]);
+
+ }
+}
+
+#endif /*LV_HAVE_GENERIC*/
+
+
+#endif /*INCLUDED_volk_16i_permute_and_scalar_add_a_H*/
diff --git a/volk/kernels/volk/volk_16i_s32f_convert_32f.h b/volk/kernels/volk/volk_16i_s32f_convert_32f.h
new file mode 100644
index 000000000..a810a601a
--- /dev/null
+++ b/volk/kernels/volk/volk_16i_s32f_convert_32f.h
@@ -0,0 +1,241 @@
+#ifndef INCLUDED_volk_16i_s32f_convert_32f_u_H
+#define INCLUDED_volk_16i_s32f_convert_32f_u_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE4_1
+#include <smmintrin.h>
+
+ /*!
+ \brief Converts the input 16 bit integer data into floating point data, and divides the each floating point output data point by the scalar value
+ \param inputVector The 16 bit input data buffer
+ \param outputVector The floating point output data buffer
+ \param scalar The value divided against each point in the output buffer
+ \param num_points The number of data values to be converted
+ \note Output buffer does NOT need to be properly aligned
+ */
+static inline void volk_16i_s32f_convert_32f_u_sse4_1(float* outputVector, const int16_t* inputVector, const float scalar, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int eighthPoints = num_points / 8;
+
+ float* outputVectorPtr = outputVector;
+ __m128 invScalar = _mm_set_ps1(1.0/scalar);
+ int16_t* inputPtr = (int16_t*)inputVector;
+ __m128i inputVal;
+ __m128i inputVal2;
+ __m128 ret;
+
+ for(;number < eighthPoints; number++){
+
+ // Load the 8 values
+ inputVal = _mm_loadu_si128((__m128i*)inputPtr);
+
+ // Shift the input data to the right by 64 bits ( 8 bytes )
+ inputVal2 = _mm_srli_si128(inputVal, 8);
+
+ // Convert the lower 4 values into 32 bit words
+ inputVal = _mm_cvtepi16_epi32(inputVal);
+ inputVal2 = _mm_cvtepi16_epi32(inputVal2);
+
+ ret = _mm_cvtepi32_ps(inputVal);
+ ret = _mm_mul_ps(ret, invScalar);
+ _mm_storeu_ps(outputVectorPtr, ret);
+ outputVectorPtr += 4;
+
+ ret = _mm_cvtepi32_ps(inputVal2);
+ ret = _mm_mul_ps(ret, invScalar);
+ _mm_storeu_ps(outputVectorPtr, ret);
+
+ outputVectorPtr += 4;
+
+ inputPtr += 8;
+ }
+
+ number = eighthPoints * 8;
+ for(; number < num_points; number++){
+ outputVector[number] =((float)(inputVector[number])) / scalar;
+ }
+}
+#endif /* LV_HAVE_SSE4_1 */
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+
+ /*!
+ \brief Converts the input 16 bit integer data into floating point data, and divides the each floating point output data point by the scalar value
+ \param inputVector The 16 bit input data buffer
+ \param outputVector The floating point output data buffer
+ \param scalar The value divided against each point in the output buffer
+ \param num_points The number of data values to be converted
+ \note Output buffer does NOT need to be properly aligned
+ */
+static inline void volk_16i_s32f_convert_32f_u_sse(float* outputVector, const int16_t* inputVector, const float scalar, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+
+ float* outputVectorPtr = outputVector;
+ __m128 invScalar = _mm_set_ps1(1.0/scalar);
+ int16_t* inputPtr = (int16_t*)inputVector;
+ __m128 ret;
+
+ for(;number < quarterPoints; number++){
+ ret = _mm_set_ps((float)(inputPtr[3]), (float)(inputPtr[2]), (float)(inputPtr[1]), (float)(inputPtr[0]));
+
+ ret = _mm_mul_ps(ret, invScalar);
+ _mm_storeu_ps(outputVectorPtr, ret);
+
+ inputPtr += 4;
+ outputVectorPtr += 4;
+ }
+
+ number = quarterPoints * 4;
+ for(; number < num_points; number++){
+ outputVector[number] = (float)(inputVector[number]) / scalar;
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+ /*!
+ \brief Converts the input 16 bit integer data into floating point data, and divides the each floating point output data point by the scalar value
+ \param inputVector The 16 bit input data buffer
+ \param outputVector The floating point output data buffer
+ \param scalar The value divided against each point in the output buffer
+ \param num_points The number of data values to be converted
+ \note Output buffer does NOT need to be properly aligned
+ */
+static inline void volk_16i_s32f_convert_32f_generic(float* outputVector, const int16_t* inputVector, const float scalar, unsigned int num_points){
+ float* outputVectorPtr = outputVector;
+ const int16_t* inputVectorPtr = inputVector;
+ unsigned int number = 0;
+
+ for(number = 0; number < num_points; number++){
+ *outputVectorPtr++ = ((float)(*inputVectorPtr++)) / scalar;
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_16i_s32f_convert_32f_u_H */
+#ifndef INCLUDED_volk_16i_s32f_convert_32f_a_H
+#define INCLUDED_volk_16i_s32f_convert_32f_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE4_1
+#include <smmintrin.h>
+
+ /*!
+ \brief Converts the input 16 bit integer data into floating point data, and divides the each floating point output data point by the scalar value
+ \param inputVector The 16 bit input data buffer
+ \param outputVector The floating point output data buffer
+ \param scalar The value divided against each point in the output buffer
+ \param num_points The number of data values to be converted
+ */
+static inline void volk_16i_s32f_convert_32f_a_sse4_1(float* outputVector, const int16_t* inputVector, const float scalar, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int eighthPoints = num_points / 8;
+
+ float* outputVectorPtr = outputVector;
+ __m128 invScalar = _mm_set_ps1(1.0/scalar);
+ int16_t* inputPtr = (int16_t*)inputVector;
+ __m128i inputVal;
+ __m128i inputVal2;
+ __m128 ret;
+
+ for(;number < eighthPoints; number++){
+
+ // Load the 8 values
+ inputVal = _mm_loadu_si128((__m128i*)inputPtr);
+
+ // Shift the input data to the right by 64 bits ( 8 bytes )
+ inputVal2 = _mm_srli_si128(inputVal, 8);
+
+ // Convert the lower 4 values into 32 bit words
+ inputVal = _mm_cvtepi16_epi32(inputVal);
+ inputVal2 = _mm_cvtepi16_epi32(inputVal2);
+
+ ret = _mm_cvtepi32_ps(inputVal);
+ ret = _mm_mul_ps(ret, invScalar);
+ _mm_storeu_ps(outputVectorPtr, ret);
+ outputVectorPtr += 4;
+
+ ret = _mm_cvtepi32_ps(inputVal2);
+ ret = _mm_mul_ps(ret, invScalar);
+ _mm_storeu_ps(outputVectorPtr, ret);
+
+ outputVectorPtr += 4;
+
+ inputPtr += 8;
+ }
+
+ number = eighthPoints * 8;
+ for(; number < num_points; number++){
+ outputVector[number] =((float)(inputVector[number])) / scalar;
+ }
+}
+#endif /* LV_HAVE_SSE4_1 */
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+
+ /*!
+ \brief Converts the input 16 bit integer data into floating point data, and divides the each floating point output data point by the scalar value
+ \param inputVector The 16 bit input data buffer
+ \param outputVector The floating point output data buffer
+ \param scalar The value divided against each point in the output buffer
+ \param num_points The number of data values to be converted
+ */
+static inline void volk_16i_s32f_convert_32f_a_sse(float* outputVector, const int16_t* inputVector, const float scalar, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+
+ float* outputVectorPtr = outputVector;
+ __m128 invScalar = _mm_set_ps1(1.0/scalar);
+ int16_t* inputPtr = (int16_t*)inputVector;
+ __m128 ret;
+
+ for(;number < quarterPoints; number++){
+ ret = _mm_set_ps((float)(inputPtr[3]), (float)(inputPtr[2]), (float)(inputPtr[1]), (float)(inputPtr[0]));
+
+ ret = _mm_mul_ps(ret, invScalar);
+ _mm_storeu_ps(outputVectorPtr, ret);
+
+ inputPtr += 4;
+ outputVectorPtr += 4;
+ }
+
+ number = quarterPoints * 4;
+ for(; number < num_points; number++){
+ outputVector[number] = (float)(inputVector[number]) / scalar;
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+ /*!
+ \brief Converts the input 16 bit integer data into floating point data, and divides the each floating point output data point by the scalar value
+ \param inputVector The 16 bit input data buffer
+ \param outputVector The floating point output data buffer
+ \param scalar The value divided against each point in the output buffer
+ \param num_points The number of data values to be converted
+ */
+static inline void volk_16i_s32f_convert_32f_a_generic(float* outputVector, const int16_t* inputVector, const float scalar, unsigned int num_points){
+ float* outputVectorPtr = outputVector;
+ const int16_t* inputVectorPtr = inputVector;
+ unsigned int number = 0;
+
+ for(number = 0; number < num_points; number++){
+ *outputVectorPtr++ = ((float)(*inputVectorPtr++)) / scalar;
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_16i_s32f_convert_32f_a_H */
diff --git a/volk/kernels/volk/volk_16i_x4_quad_max_star_16i.h b/volk/kernels/volk/volk_16i_x4_quad_max_star_16i.h
new file mode 100644
index 000000000..56b2cc07a
--- /dev/null
+++ b/volk/kernels/volk/volk_16i_x4_quad_max_star_16i.h
@@ -0,0 +1,192 @@
+#ifndef INCLUDED_volk_16i_x4_quad_max_star_16i_a_H
+#define INCLUDED_volk_16i_x4_quad_max_star_16i_a_H
+
+
+#include<inttypes.h>
+#include<stdio.h>
+
+
+
+
+
+#ifdef LV_HAVE_SSE2
+
+#include<emmintrin.h>
+
+static inline void volk_16i_x4_quad_max_star_16i_a_sse2(short* target, short* src0, short* src1, short* src2, short* src3, unsigned int num_points) {
+
+ const unsigned int num_bytes = num_points*2;
+
+ int i = 0;
+
+ int bound = (num_bytes >> 4);
+ int bound_copy = bound;
+ int leftovers = (num_bytes >> 1) & 7;
+
+ __m128i *p_target, *p_src0, *p_src1, *p_src2, *p_src3;
+ p_target = (__m128i*) target;
+ p_src0 = (__m128i*)src0;
+ p_src1 = (__m128i*)src1;
+ p_src2 = (__m128i*)src2;
+ p_src3 = (__m128i*)src3;
+
+
+
+ __m128i xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, xmm8;
+
+ while(bound_copy > 0) {
+
+ xmm1 = _mm_load_si128(p_src0);
+ xmm2 = _mm_load_si128(p_src1);
+ xmm3 = _mm_load_si128(p_src2);
+ xmm4 = _mm_load_si128(p_src3);
+
+ xmm5 = _mm_setzero_si128();
+ xmm6 = _mm_setzero_si128();
+ xmm7 = xmm1;
+ xmm8 = xmm3;
+
+
+ xmm1 = _mm_sub_epi16(xmm2, xmm1);
+
+
+
+ xmm3 = _mm_sub_epi16(xmm4, xmm3);
+
+ xmm5 = _mm_cmpgt_epi16(xmm1, xmm5);
+ xmm6 = _mm_cmpgt_epi16(xmm3, xmm6);
+
+
+
+ xmm2 = _mm_and_si128(xmm5, xmm2);
+ xmm4 = _mm_and_si128(xmm6, xmm4);
+ xmm5 = _mm_andnot_si128(xmm5, xmm7);
+ xmm6 = _mm_andnot_si128(xmm6, xmm8);
+
+ xmm5 = _mm_add_epi16(xmm2, xmm5);
+ xmm6 = _mm_add_epi16(xmm4, xmm6);
+
+
+ xmm1 = _mm_xor_si128(xmm1, xmm1);
+ xmm2 = xmm5;
+ xmm5 = _mm_sub_epi16(xmm6, xmm5);
+ p_src0 += 1;
+ bound_copy -= 1;
+
+ xmm1 = _mm_cmpgt_epi16(xmm5, xmm1);
+ p_src1 += 1;
+
+ xmm6 = _mm_and_si128(xmm1, xmm6);
+
+ xmm1 = _mm_andnot_si128(xmm1, xmm2);
+ p_src2 += 1;
+
+
+
+ xmm1 = _mm_add_epi16(xmm6, xmm1);
+ p_src3 += 1;
+
+
+ _mm_store_si128(p_target, xmm1);
+ p_target += 1;
+
+ }
+
+
+ /*asm volatile
+ (
+ "volk_16i_x4_quad_max_star_16i_a_sse2_L1:\n\t"
+ "cmp $0, %[bound]\n\t"
+ "je volk_16i_x4_quad_max_star_16i_a_sse2_END\n\t"
+
+ "movaps (%[src0]), %%xmm1\n\t"
+ "movaps (%[src1]), %%xmm2\n\t"
+ "movaps (%[src2]), %%xmm3\n\t"
+ "movaps (%[src3]), %%xmm4\n\t"
+
+ "pxor %%xmm5, %%xmm5\n\t"
+ "pxor %%xmm6, %%xmm6\n\t"
+ "movaps %%xmm1, %%xmm7\n\t"
+ "movaps %%xmm3, %%xmm8\n\t"
+ "psubw %%xmm2, %%xmm1\n\t"
+ "psubw %%xmm4, %%xmm3\n\t"
+
+ "pcmpgtw %%xmm1, %%xmm5\n\t"
+ "pcmpgtw %%xmm3, %%xmm6\n\t"
+
+ "pand %%xmm5, %%xmm2\n\t"
+ "pand %%xmm6, %%xmm4\n\t"
+ "pandn %%xmm7, %%xmm5\n\t"
+ "pandn %%xmm8, %%xmm6\n\t"
+
+ "paddw %%xmm2, %%xmm5\n\t"
+ "paddw %%xmm4, %%xmm6\n\t"
+
+ "pxor %%xmm1, %%xmm1\n\t"
+ "movaps %%xmm5, %%xmm2\n\t"
+
+ "psubw %%xmm6, %%xmm5\n\t"
+ "add $16, %[src0]\n\t"
+ "add $-1, %[bound]\n\t"
+
+ "pcmpgtw %%xmm5, %%xmm1\n\t"
+ "add $16, %[src1]\n\t"
+
+ "pand %%xmm1, %%xmm6\n\t"
+
+ "pandn %%xmm2, %%xmm1\n\t"
+ "add $16, %[src2]\n\t"
+
+ "paddw %%xmm6, %%xmm1\n\t"
+ "add $16, %[src3]\n\t"
+
+ "movaps %%xmm1, (%[target])\n\t"
+ "addw $16, %[target]\n\t"
+ "jmp volk_16i_x4_quad_max_star_16i_a_sse2_L1\n\t"
+
+ "volk_16i_x4_quad_max_star_16i_a_sse2_END:\n\t"
+ :
+ :[bound]"r"(bound), [src0]"r"(src0), [src1]"r"(src1), [src2]"r"(src2), [src3]"r"(src3), [target]"r"(target)
+ :
+ );
+ */
+
+ short temp0 = 0;
+ short temp1 = 0;
+ for(i = bound * 8; i < (bound * 8) + leftovers; ++i) {
+ temp0 = ((short)(src0[i] - src1[i]) > 0) ? src0[i] : src1[i];
+ temp1 = ((short)(src2[i] - src3[i])>0) ? src2[i] : src3[i];
+ target[i] = ((short)(temp0 - temp1)>0) ? temp0 : temp1;
+ }
+ return;
+
+
+}
+
+#endif /*LV_HAVE_SSE2*/
+
+
+#ifdef LV_HAVE_GENERIC
+static inline void volk_16i_x4_quad_max_star_16i_generic(short* target, short* src0, short* src1, short* src2, short* src3, unsigned int num_points) {
+
+ const unsigned int num_bytes = num_points*2;
+
+ int i = 0;
+
+ int bound = num_bytes >> 1;
+
+ short temp0 = 0;
+ short temp1 = 0;
+ for(i = 0; i < bound; ++i) {
+ temp0 = ((short)(src0[i] - src1[i]) > 0) ? src0[i] : src1[i];
+ temp1 = ((short)(src2[i] - src3[i])>0) ? src2[i] : src3[i];
+ target[i] = ((short)(temp0 - temp1)>0) ? temp0 : temp1;
+ }
+}
+
+
+
+
+#endif /*LV_HAVE_GENERIC*/
+
+#endif /*INCLUDED_volk_16i_x4_quad_max_star_16i_a_H*/
diff --git a/volk/kernels/volk/volk_16i_x5_add_quad_16i_x4.h b/volk/kernels/volk/volk_16i_x5_add_quad_16i_x4.h
new file mode 100644
index 000000000..9b6d19fd6
--- /dev/null
+++ b/volk/kernels/volk/volk_16i_x5_add_quad_16i_x4.h
@@ -0,0 +1,140 @@
+#ifndef INCLUDED_volk_16i_x5_add_quad_16i_x4_a_H
+#define INCLUDED_volk_16i_x5_add_quad_16i_x4_a_H
+
+
+#include<inttypes.h>
+#include<stdio.h>
+
+
+
+
+
+#ifdef LV_HAVE_SSE2
+#include<xmmintrin.h>
+#include<emmintrin.h>
+
+static inline void volk_16i_x5_add_quad_16i_x4_a_sse2(short* target0, short* target1, short* target2, short* target3, short* src0, short* src1, short* src2, short* src3, short* src4, unsigned int num_points) {
+
+ const unsigned int num_bytes = num_points*2;
+
+ __m128i xmm0, xmm1, xmm2, xmm3, xmm4;
+ __m128i *p_target0, *p_target1, *p_target2, *p_target3, *p_src0, *p_src1, *p_src2, *p_src3, *p_src4;
+ p_target0 = (__m128i*)target0;
+ p_target1 = (__m128i*)target1;
+ p_target2 = (__m128i*)target2;
+ p_target3 = (__m128i*)target3;
+
+ p_src0 = (__m128i*)src0;
+ p_src1 = (__m128i*)src1;
+ p_src2 = (__m128i*)src2;
+ p_src3 = (__m128i*)src3;
+ p_src4 = (__m128i*)src4;
+
+ int i = 0;
+
+ int bound = (num_bytes >> 4);
+ int leftovers = (num_bytes >> 1) & 7;
+
+ for(; i < bound; ++i) {
+ xmm0 = _mm_load_si128(p_src0);
+ xmm1 = _mm_load_si128(p_src1);
+ xmm2 = _mm_load_si128(p_src2);
+ xmm3 = _mm_load_si128(p_src3);
+ xmm4 = _mm_load_si128(p_src4);
+
+ p_src0 += 1;
+ p_src1 += 1;
+
+ xmm1 = _mm_add_epi16(xmm0, xmm1);
+ xmm2 = _mm_add_epi16(xmm0, xmm2);
+ xmm3 = _mm_add_epi16(xmm0, xmm3);
+ xmm4 = _mm_add_epi16(xmm0, xmm4);
+
+
+ p_src2 += 1;
+ p_src3 += 1;
+ p_src4 += 1;
+
+ _mm_store_si128(p_target0, xmm1);
+ _mm_store_si128(p_target1, xmm2);
+ _mm_store_si128(p_target2, xmm3);
+ _mm_store_si128(p_target3, xmm4);
+
+ p_target0 += 1;
+ p_target1 += 1;
+ p_target2 += 1;
+ p_target3 += 1;
+ }
+ /*asm volatile
+ (
+ ".%=volk_16i_x5_add_quad_16i_x4_a_sse2_L1:\n\t"
+ "cmp $0, %[bound]\n\t"
+ "je .%=volk_16i_x5_add_quad_16i_x4_a_sse2_END\n\t"
+ "movaps (%[src0]), %%xmm1\n\t"
+ "movaps (%[src1]), %%xmm2\n\t"
+ "movaps (%[src2]), %%xmm3\n\t"
+ "movaps (%[src3]), %%xmm4\n\t"
+ "movaps (%[src4]), %%xmm5\n\t"
+ "add $16, %[src0]\n\t"
+ "add $16, %[src1]\n\t"
+ "add $16, %[src2]\n\t"
+ "add $16, %[src3]\n\t"
+ "add $16, %[src4]\n\t"
+ "paddw %%xmm1, %%xmm2\n\t"
+ "paddw %%xmm1, %%xmm3\n\t"
+ "paddw %%xmm1, %%xmm4\n\t"
+ "paddw %%xmm1, %%xmm5\n\t"
+ "add $-1, %[bound]\n\t"
+ "movaps %%xmm2, (%[target0])\n\t"
+ "movaps %%xmm3, (%[target1])\n\t"
+ "movaps %%xmm4, (%[target2])\n\t"
+ "movaps %%xmm5, (%[target3])\n\t"
+ "add $16, %[target0]\n\t"
+ "add $16, %[target1]\n\t"
+ "add $16, %[target2]\n\t"
+ "add $16, %[target3]\n\t"
+ "jmp .%=volk_16i_x5_add_quad_16i_x4_a_sse2_L1\n\t"
+ ".%=volk_16i_x5_add_quad_16i_x4_a_sse2_END:\n\t"
+ :
+ :[bound]"r"(bound), [src0]"r"(src0), [src1]"r"(src1), [src2]"r"(src2), [src3]"r"(src3), [src4]"r"(src4), [target0]"r"(target0), [target1]"r"(target1), [target2]"r"(target2), [target3]"r"(target3)
+ :"xmm1", "xmm2", "xmm3", "xmm4", "xmm5"
+ );
+
+ */
+
+
+ for(i = bound * 8; i < (bound * 8) + leftovers; ++i) {
+ target0[i] = src0[i] + src1[i];
+ target1[i] = src0[i] + src2[i];
+ target2[i] = src0[i] + src3[i];
+ target3[i] = src0[i] + src4[i];
+ }
+}
+#endif /*LV_HAVE_SSE2*/
+
+
+#ifdef LV_HAVE_GENERIC
+
+static inline void volk_16i_x5_add_quad_16i_x4_generic(short* target0, short* target1, short* target2, short* target3, short* src0, short* src1, short* src2, short* src3, short* src4, unsigned int num_points) {
+
+ const unsigned int num_bytes = num_points*2;
+
+ int i = 0;
+
+ int bound = num_bytes >> 1;
+
+ for(i = 0; i < bound; ++i) {
+ target0[i] = src0[i] + src1[i];
+ target1[i] = src0[i] + src2[i];
+ target2[i] = src0[i] + src3[i];
+ target3[i] = src0[i] + src4[i];
+ }
+}
+
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+
+#endif /*INCLUDED_volk_16i_x5_add_quad_16i_x4_a_H*/
diff --git a/volk/kernels/volk/volk_16ic_deinterleave_16i_x2.h b/volk/kernels/volk/volk_16ic_deinterleave_16i_x2.h
new file mode 100644
index 000000000..9ce801264
--- /dev/null
+++ b/volk/kernels/volk/volk_16ic_deinterleave_16i_x2.h
@@ -0,0 +1,158 @@
+#ifndef INCLUDED_volk_16ic_deinterleave_16i_x2_a_H
+#define INCLUDED_volk_16ic_deinterleave_16i_x2_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSSE3
+#include <tmmintrin.h>
+/*!
+ \brief Deinterleaves the complex 16 bit vector into I & Q vector data
+ \param complexVector The complex input vector
+ \param iBuffer The I buffer output data
+ \param qBuffer The Q buffer output data
+ \param num_points The number of complex data values to be deinterleaved
+*/
+static inline void volk_16ic_deinterleave_16i_x2_a_ssse3(int16_t* iBuffer, int16_t* qBuffer, const lv_16sc_t* complexVector, unsigned int num_points){
+ unsigned int number = 0;
+ const int8_t* complexVectorPtr = (int8_t*)complexVector;
+ int16_t* iBufferPtr = iBuffer;
+ int16_t* qBufferPtr = qBuffer;
+
+ __m128i iMoveMask1 = _mm_set_epi8(0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 13, 12, 9, 8, 5, 4, 1, 0);
+ __m128i iMoveMask2 = _mm_set_epi8(13, 12, 9, 8, 5, 4, 1, 0, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80);
+
+ __m128i qMoveMask1 = _mm_set_epi8(0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 15, 14, 11, 10, 7, 6, 3, 2);
+ __m128i qMoveMask2 = _mm_set_epi8(15, 14, 11, 10, 7, 6, 3, 2, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80);
+
+ __m128i complexVal1, complexVal2, iOutputVal, qOutputVal;
+
+ unsigned int eighthPoints = num_points / 8;
+
+ for(number = 0; number < eighthPoints; number++){
+ complexVal1 = _mm_load_si128((__m128i*)complexVectorPtr); complexVectorPtr += 16;
+ complexVal2 = _mm_load_si128((__m128i*)complexVectorPtr); complexVectorPtr += 16;
+
+ iOutputVal = _mm_or_si128( _mm_shuffle_epi8(complexVal1, iMoveMask1) , _mm_shuffle_epi8(complexVal2, iMoveMask2));
+ qOutputVal = _mm_or_si128( _mm_shuffle_epi8(complexVal1, qMoveMask1) , _mm_shuffle_epi8(complexVal2, qMoveMask2));
+
+ _mm_store_si128((__m128i*)iBufferPtr, iOutputVal);
+ _mm_store_si128((__m128i*)qBufferPtr, qOutputVal);
+
+ iBufferPtr += 8;
+ qBufferPtr += 8;
+ }
+
+ number = eighthPoints * 8;
+ int16_t* int16ComplexVectorPtr = (int16_t*)complexVectorPtr;
+ for(; number < num_points; number++){
+ *iBufferPtr++ = *int16ComplexVectorPtr++;
+ *qBufferPtr++ = *int16ComplexVectorPtr++;
+ }
+}
+#endif /* LV_HAVE_SSSE3 */
+
+#ifdef LV_HAVE_SSE2
+#include <emmintrin.h>
+/*!
+ \brief Deinterleaves the complex 16 bit vector into I & Q vector data
+ \param complexVector The complex input vector
+ \param iBuffer The I buffer output data
+ \param qBuffer The Q buffer output data
+ \param num_points The number of complex data values to be deinterleaved
+*/
+static inline void volk_16ic_deinterleave_16i_x2_a_sse2(int16_t* iBuffer, int16_t* qBuffer, const lv_16sc_t* complexVector, unsigned int num_points){
+ unsigned int number = 0;
+ const int16_t* complexVectorPtr = (int16_t*)complexVector;
+ int16_t* iBufferPtr = iBuffer;
+ int16_t* qBufferPtr = qBuffer;
+ __m128i complexVal1, complexVal2, iComplexVal1, iComplexVal2, qComplexVal1, qComplexVal2, iOutputVal, qOutputVal;
+ __m128i lowMask = _mm_set_epi32(0x0, 0x0, 0xFFFFFFFF, 0xFFFFFFFF);
+ __m128i highMask = _mm_set_epi32(0xFFFFFFFF, 0xFFFFFFFF, 0x0, 0x0);
+
+ unsigned int eighthPoints = num_points / 8;
+
+ for(number = 0; number < eighthPoints; number++){
+ complexVal1 = _mm_load_si128((__m128i*)complexVectorPtr); complexVectorPtr += 8;
+ complexVal2 = _mm_load_si128((__m128i*)complexVectorPtr); complexVectorPtr += 8;
+
+ iComplexVal1 = _mm_shufflelo_epi16(complexVal1, _MM_SHUFFLE(3,1,2,0));
+
+ iComplexVal1 = _mm_shufflehi_epi16(iComplexVal1, _MM_SHUFFLE(3,1,2,0));
+
+ iComplexVal1 = _mm_shuffle_epi32(iComplexVal1, _MM_SHUFFLE(3,1,2,0));
+
+ iComplexVal2 = _mm_shufflelo_epi16(complexVal2, _MM_SHUFFLE(3,1,2,0));
+
+ iComplexVal2 = _mm_shufflehi_epi16(iComplexVal2, _MM_SHUFFLE(3,1,2,0));
+
+ iComplexVal2 = _mm_shuffle_epi32(iComplexVal2, _MM_SHUFFLE(2,0,3,1));
+
+ iOutputVal = _mm_or_si128(_mm_and_si128(iComplexVal1, lowMask), _mm_and_si128(iComplexVal2, highMask));
+
+ _mm_store_si128((__m128i*)iBufferPtr, iOutputVal);
+
+ qComplexVal1 = _mm_shufflelo_epi16(complexVal1, _MM_SHUFFLE(2,0,3,1));
+
+ qComplexVal1 = _mm_shufflehi_epi16(qComplexVal1, _MM_SHUFFLE(2,0,3,1));
+
+ qComplexVal1 = _mm_shuffle_epi32(qComplexVal1, _MM_SHUFFLE(3,1,2,0));
+
+ qComplexVal2 = _mm_shufflelo_epi16(complexVal2, _MM_SHUFFLE(2,0,3,1));
+
+ qComplexVal2 = _mm_shufflehi_epi16(qComplexVal2, _MM_SHUFFLE(2,0,3,1));
+
+ qComplexVal2 = _mm_shuffle_epi32(qComplexVal2, _MM_SHUFFLE(2,0,3,1));
+
+ qOutputVal = _mm_or_si128(_mm_and_si128(qComplexVal1, lowMask), _mm_and_si128(qComplexVal2, highMask));
+
+ _mm_store_si128((__m128i*)qBufferPtr, qOutputVal);
+
+ iBufferPtr += 8;
+ qBufferPtr += 8;
+ }
+
+ number = eighthPoints * 8;
+ for(; number < num_points; number++){
+ *iBufferPtr++ = *complexVectorPtr++;
+ *qBufferPtr++ = *complexVectorPtr++;
+ }
+}
+#endif /* LV_HAVE_SSE2 */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Deinterleaves the complex 16 bit vector into I & Q vector data
+ \param complexVector The complex input vector
+ \param iBuffer The I buffer output data
+ \param qBuffer The Q buffer output data
+ \param num_points The number of complex data values to be deinterleaved
+*/
+static inline void volk_16ic_deinterleave_16i_x2_generic(int16_t* iBuffer, int16_t* qBuffer, const lv_16sc_t* complexVector, unsigned int num_points){
+ const int16_t* complexVectorPtr = (const int16_t*)complexVector;
+ int16_t* iBufferPtr = iBuffer;
+ int16_t* qBufferPtr = qBuffer;
+ unsigned int number;
+ for(number = 0; number < num_points; number++){
+ *iBufferPtr++ = *complexVectorPtr++;
+ *qBufferPtr++ = *complexVectorPtr++;
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+#ifdef LV_HAVE_ORC
+/*!
+ \brief Deinterleaves the complex 16 bit vector into I & Q vector data
+ \param complexVector The complex input vector
+ \param iBuffer The I buffer output data
+ \param qBuffer The Q buffer output data
+ \param num_points The number of complex data values to be deinterleaved
+*/
+extern void volk_16ic_deinterleave_16i_x2_a_orc_impl(int16_t* iBuffer, int16_t* qBuffer, const lv_16sc_t* complexVector, unsigned int num_points);
+static inline void volk_16ic_deinterleave_16i_x2_u_orc(int16_t* iBuffer, int16_t* qBuffer, const lv_16sc_t* complexVector, unsigned int num_points){
+ volk_16ic_deinterleave_16i_x2_a_orc_impl(iBuffer, qBuffer, complexVector, num_points);
+}
+#endif /* LV_HAVE_ORC */
+
+
+#endif /* INCLUDED_volk_16ic_deinterleave_16i_x2_a_H */
diff --git a/volk/kernels/volk/volk_16ic_deinterleave_real_16i.h b/volk/kernels/volk/volk_16ic_deinterleave_real_16i.h
new file mode 100644
index 000000000..f6eccd77e
--- /dev/null
+++ b/volk/kernels/volk/volk_16ic_deinterleave_real_16i.h
@@ -0,0 +1,120 @@
+#ifndef INCLUDED_volk_16ic_deinterleave_real_16i_a_H
+#define INCLUDED_volk_16ic_deinterleave_real_16i_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSSE3
+#include <tmmintrin.h>
+/*!
+ \brief Deinterleaves the complex 16 bit vector into I vector data
+ \param complexVector The complex input vector
+ \param iBuffer The I buffer output data
+ \param num_points The number of complex data values to be deinterleaved
+*/
+static inline void volk_16ic_deinterleave_real_16i_a_ssse3(int16_t* iBuffer, const lv_16sc_t* complexVector, unsigned int num_points){
+ unsigned int number = 0;
+ const int16_t* complexVectorPtr = (int16_t*)complexVector;
+ int16_t* iBufferPtr = iBuffer;
+
+ __m128i iMoveMask1 = _mm_set_epi8(0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 13, 12, 9, 8, 5, 4, 1, 0);
+ __m128i iMoveMask2 = _mm_set_epi8(13, 12, 9, 8, 5, 4, 1, 0, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80);
+
+ __m128i complexVal1, complexVal2, iOutputVal;
+
+ unsigned int eighthPoints = num_points / 8;
+
+ for(number = 0; number < eighthPoints; number++){
+ complexVal1 = _mm_load_si128((__m128i*)complexVectorPtr); complexVectorPtr += 8;
+ complexVal2 = _mm_load_si128((__m128i*)complexVectorPtr); complexVectorPtr += 8;
+
+ complexVal1 = _mm_shuffle_epi8(complexVal1, iMoveMask1);
+ complexVal2 = _mm_shuffle_epi8(complexVal2, iMoveMask2);
+
+ iOutputVal = _mm_or_si128(complexVal1, complexVal2);
+
+ _mm_store_si128((__m128i*)iBufferPtr, iOutputVal);
+
+ iBufferPtr += 8;
+ }
+
+ number = eighthPoints * 8;
+ for(; number < num_points; number++){
+ *iBufferPtr++ = *complexVectorPtr++;
+ complexVectorPtr++;
+ }
+}
+#endif /* LV_HAVE_SSSE3 */
+
+
+#ifdef LV_HAVE_SSE2
+#include <emmintrin.h>
+/*!
+ \brief Deinterleaves the complex 16 bit vector into I vector data
+ \param complexVector The complex input vector
+ \param iBuffer The I buffer output data
+ \param num_points The number of complex data values to be deinterleaved
+*/
+static inline void volk_16ic_deinterleave_real_16i_a_sse2(int16_t* iBuffer, const lv_16sc_t* complexVector, unsigned int num_points){
+ unsigned int number = 0;
+ const int16_t* complexVectorPtr = (int16_t*)complexVector;
+ int16_t* iBufferPtr = iBuffer;
+ __m128i complexVal1, complexVal2, iOutputVal;
+ __m128i lowMask = _mm_set_epi32(0x0, 0x0, 0xFFFFFFFF, 0xFFFFFFFF);
+ __m128i highMask = _mm_set_epi32(0xFFFFFFFF, 0xFFFFFFFF, 0x0, 0x0);
+
+ unsigned int eighthPoints = num_points / 8;
+
+ for(number = 0; number < eighthPoints; number++){
+ complexVal1 = _mm_load_si128((__m128i*)complexVectorPtr); complexVectorPtr += 8;
+ complexVal2 = _mm_load_si128((__m128i*)complexVectorPtr); complexVectorPtr += 8;
+
+ complexVal1 = _mm_shufflelo_epi16(complexVal1, _MM_SHUFFLE(3,1,2,0));
+
+ complexVal1 = _mm_shufflehi_epi16(complexVal1, _MM_SHUFFLE(3,1,2,0));
+
+ complexVal1 = _mm_shuffle_epi32(complexVal1, _MM_SHUFFLE(3,1,2,0));
+
+ complexVal2 = _mm_shufflelo_epi16(complexVal2, _MM_SHUFFLE(3,1,2,0));
+
+ complexVal2 = _mm_shufflehi_epi16(complexVal2, _MM_SHUFFLE(3,1,2,0));
+
+ complexVal2 = _mm_shuffle_epi32(complexVal2, _MM_SHUFFLE(2,0,3,1));
+
+ iOutputVal = _mm_or_si128(_mm_and_si128(complexVal1, lowMask), _mm_and_si128(complexVal2, highMask));
+
+ _mm_store_si128((__m128i*)iBufferPtr, iOutputVal);
+
+ iBufferPtr += 8;
+ }
+
+ number = eighthPoints * 8;
+ for(; number < num_points; number++){
+ *iBufferPtr++ = *complexVectorPtr++;
+ complexVectorPtr++;
+ }
+}
+#endif /* LV_HAVE_SSE2 */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Deinterleaves the complex 16 bit vector into I vector data
+ \param complexVector The complex input vector
+ \param iBuffer The I buffer output data
+ \param num_points The number of complex data values to be deinterleaved
+*/
+static inline void volk_16ic_deinterleave_real_16i_generic(int16_t* iBuffer, const lv_16sc_t* complexVector, unsigned int num_points){
+ unsigned int number = 0;
+ const int16_t* complexVectorPtr = (int16_t*)complexVector;
+ int16_t* iBufferPtr = iBuffer;
+ for(number = 0; number < num_points; number++){
+ *iBufferPtr++ = *complexVectorPtr++;
+ complexVectorPtr++;
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_16ic_deinterleave_real_16i_a_H */
diff --git a/volk/kernels/volk/volk_16ic_deinterleave_real_8i.h b/volk/kernels/volk/volk_16ic_deinterleave_real_8i.h
new file mode 100644
index 000000000..f3d0c8352
--- /dev/null
+++ b/volk/kernels/volk/volk_16ic_deinterleave_real_8i.h
@@ -0,0 +1,94 @@
+#ifndef INCLUDED_volk_16ic_deinterleave_real_8i_a_H
+#define INCLUDED_volk_16ic_deinterleave_real_8i_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSSE3
+#include <tmmintrin.h>
+/*!
+ \brief Deinterleaves the complex 16 bit vector into 8 bit I vector data
+ \param complexVector The complex input vector
+ \param iBuffer The I buffer output data
+ \param num_points The number of complex data values to be deinterleaved
+*/
+static inline void volk_16ic_deinterleave_real_8i_a_ssse3(int8_t* iBuffer, const lv_16sc_t* complexVector, unsigned int num_points){
+ unsigned int number = 0;
+ const int8_t* complexVectorPtr = (int8_t*)complexVector;
+ int8_t* iBufferPtr = iBuffer;
+ __m128i iMoveMask1 = _mm_set_epi8(0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 13, 12, 9, 8, 5, 4, 1, 0);
+ __m128i iMoveMask2 = _mm_set_epi8(13, 12, 9, 8, 5, 4, 1, 0, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80);
+ __m128i complexVal1, complexVal2, complexVal3, complexVal4, iOutputVal;
+
+ unsigned int sixteenthPoints = num_points / 16;
+
+ for(number = 0; number < sixteenthPoints; number++){
+ complexVal1 = _mm_load_si128((__m128i*)complexVectorPtr); complexVectorPtr += 16;
+ complexVal2 = _mm_load_si128((__m128i*)complexVectorPtr); complexVectorPtr += 16;
+
+ complexVal3 = _mm_load_si128((__m128i*)complexVectorPtr); complexVectorPtr += 16;
+ complexVal4 = _mm_load_si128((__m128i*)complexVectorPtr); complexVectorPtr += 16;
+
+ complexVal1 = _mm_shuffle_epi8(complexVal1, iMoveMask1);
+ complexVal2 = _mm_shuffle_epi8(complexVal2, iMoveMask2);
+
+ complexVal1 = _mm_or_si128(complexVal1, complexVal2);
+
+ complexVal3 = _mm_shuffle_epi8(complexVal3, iMoveMask1);
+ complexVal4 = _mm_shuffle_epi8(complexVal4, iMoveMask2);
+
+ complexVal3 = _mm_or_si128(complexVal3, complexVal4);
+
+
+ complexVal1 = _mm_srai_epi16(complexVal1, 8);
+ complexVal3 = _mm_srai_epi16(complexVal3, 8);
+
+ iOutputVal = _mm_packs_epi16(complexVal1, complexVal3);
+
+ _mm_store_si128((__m128i*)iBufferPtr, iOutputVal);
+
+ iBufferPtr += 16;
+ }
+
+ number = sixteenthPoints * 16;
+ int16_t* int16ComplexVectorPtr = (int16_t*)complexVectorPtr;
+ for(; number < num_points; number++){
+ *iBufferPtr++ = ((int8_t)(*int16ComplexVectorPtr++ >> 8));
+ int16ComplexVectorPtr++;
+ }
+}
+#endif /* LV_HAVE_SSSE3 */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Deinterleaves the complex 16 bit vector into 8 bit I vector data
+ \param complexVector The complex input vector
+ \param iBuffer The I buffer output data
+ \param num_points The number of complex data values to be deinterleaved
+*/
+static inline void volk_16ic_deinterleave_real_8i_generic(int8_t* iBuffer, const lv_16sc_t* complexVector, unsigned int num_points){
+ unsigned int number = 0;
+ int16_t* complexVectorPtr = (int16_t*)complexVector;
+ int8_t* iBufferPtr = iBuffer;
+ for(number = 0; number < num_points; number++){
+ *iBufferPtr++ = ((int8_t)(*complexVectorPtr++ >> 8));
+ complexVectorPtr++;
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+#ifdef LV_HAVE_ORC
+/*!
+ \brief Deinterleaves the complex 16 bit vector into 8 bit I vector data
+ \param complexVector The complex input vector
+ \param iBuffer The I buffer output data
+ \param num_points The number of complex data values to be deinterleaved
+*/
+extern void volk_16ic_deinterleave_real_8i_a_orc_impl(int8_t* iBuffer, const lv_16sc_t* complexVector, unsigned int num_points);
+static inline void volk_16ic_deinterleave_real_8i_u_orc(int8_t* iBuffer, const lv_16sc_t* complexVector, unsigned int num_points){
+ volk_16ic_deinterleave_real_8i_a_orc_impl(iBuffer, complexVector, num_points);
+}
+#endif /* LV_HAVE_ORC */
+
+
+#endif /* INCLUDED_volk_16ic_deinterleave_real_8i_a_H */
diff --git a/volk/kernels/volk/volk_16ic_magnitude_16i.h b/volk/kernels/volk/volk_16ic_magnitude_16i.h
new file mode 100644
index 000000000..b33306a12
--- /dev/null
+++ b/volk/kernels/volk/volk_16ic_magnitude_16i.h
@@ -0,0 +1,191 @@
+#ifndef INCLUDED_volk_16ic_magnitude_16i_a_H
+#define INCLUDED_volk_16ic_magnitude_16i_a_H
+
+#include <volk/volk_common.h>
+#include <inttypes.h>
+#include <stdio.h>
+#include <math.h>
+
+#ifdef LV_HAVE_SSE3
+#include <pmmintrin.h>
+/*!
+ \brief Calculates the magnitude of the complexVector and stores the results in the magnitudeVector
+ \param complexVector The vector containing the complex input values
+ \param magnitudeVector The vector containing the real output values
+ \param num_points The number of complex values in complexVector to be calculated and stored into cVector
+*/
+static inline void volk_16ic_magnitude_16i_a_sse3(int16_t* magnitudeVector, const lv_16sc_t* complexVector, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+
+ const int16_t* complexVectorPtr = (const int16_t*)complexVector;
+ int16_t* magnitudeVectorPtr = magnitudeVector;
+
+ __m128 vScalar = _mm_set_ps1(32768.0);
+ __m128 invScalar = _mm_set_ps1(1.0/32768.0);
+
+ __m128 cplxValue1, cplxValue2, result;
+
+ __VOLK_ATTR_ALIGNED(16) float inputFloatBuffer[8];
+ __VOLK_ATTR_ALIGNED(16) float outputFloatBuffer[4];
+
+ for(;number < quarterPoints; number++){
+
+ inputFloatBuffer[0] = (float)(complexVectorPtr[0]);
+ inputFloatBuffer[1] = (float)(complexVectorPtr[1]);
+ inputFloatBuffer[2] = (float)(complexVectorPtr[2]);
+ inputFloatBuffer[3] = (float)(complexVectorPtr[3]);
+
+ inputFloatBuffer[4] = (float)(complexVectorPtr[4]);
+ inputFloatBuffer[5] = (float)(complexVectorPtr[5]);
+ inputFloatBuffer[6] = (float)(complexVectorPtr[6]);
+ inputFloatBuffer[7] = (float)(complexVectorPtr[7]);
+
+ cplxValue1 = _mm_load_ps(&inputFloatBuffer[0]);
+ cplxValue2 = _mm_load_ps(&inputFloatBuffer[4]);
+
+ complexVectorPtr += 8;
+
+ cplxValue1 = _mm_mul_ps(cplxValue1, invScalar);
+ cplxValue2 = _mm_mul_ps(cplxValue2, invScalar);
+
+ cplxValue1 = _mm_mul_ps(cplxValue1, cplxValue1); // Square the values
+ cplxValue2 = _mm_mul_ps(cplxValue2, cplxValue2); // Square the Values
+
+ result = _mm_hadd_ps(cplxValue1, cplxValue2); // Add the I2 and Q2 values
+
+ result = _mm_sqrt_ps(result); // Square root the values
+
+ result = _mm_mul_ps(result, vScalar); // Scale the results
+
+ _mm_store_ps(outputFloatBuffer, result);
+ *magnitudeVectorPtr++ = (int16_t)(outputFloatBuffer[0]);
+ *magnitudeVectorPtr++ = (int16_t)(outputFloatBuffer[1]);
+ *magnitudeVectorPtr++ = (int16_t)(outputFloatBuffer[2]);
+ *magnitudeVectorPtr++ = (int16_t)(outputFloatBuffer[3]);
+ }
+
+ number = quarterPoints * 4;
+ magnitudeVectorPtr = &magnitudeVector[number];
+ complexVectorPtr = (const int16_t*)&complexVector[number];
+ for(; number < num_points; number++){
+ const float val1Real = (float)(*complexVectorPtr++) / 32768.0;
+ const float val1Imag = (float)(*complexVectorPtr++) / 32768.0;
+ const float val1Result = sqrtf((val1Real * val1Real) + (val1Imag * val1Imag)) * 32768.0;
+ *magnitudeVectorPtr++ = (int16_t)(val1Result);
+ }
+}
+#endif /* LV_HAVE_SSE3 */
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+/*!
+ \brief Calculates the magnitude of the complexVector and stores the results in the magnitudeVector
+ \param complexVector The vector containing the complex input values
+ \param magnitudeVector The vector containing the real output values
+ \param num_points The number of complex values in complexVector to be calculated and stored into cVector
+*/
+static inline void volk_16ic_magnitude_16i_a_sse(int16_t* magnitudeVector, const lv_16sc_t* complexVector, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+
+ const int16_t* complexVectorPtr = (const int16_t*)complexVector;
+ int16_t* magnitudeVectorPtr = magnitudeVector;
+
+ __m128 vScalar = _mm_set_ps1(32768.0);
+ __m128 invScalar = _mm_set_ps1(1.0/32768.0);
+
+ __m128 cplxValue1, cplxValue2, iValue, qValue, result;
+
+ __VOLK_ATTR_ALIGNED(16) float inputFloatBuffer[4];
+ __VOLK_ATTR_ALIGNED(16) float outputFloatBuffer[4];
+
+ for(;number < quarterPoints; number++){
+
+ inputFloatBuffer[0] = (float)(complexVectorPtr[0]);
+ inputFloatBuffer[1] = (float)(complexVectorPtr[1]);
+ inputFloatBuffer[2] = (float)(complexVectorPtr[2]);
+ inputFloatBuffer[3] = (float)(complexVectorPtr[3]);
+
+ cplxValue1 = _mm_load_ps(inputFloatBuffer);
+ complexVectorPtr += 4;
+
+ inputFloatBuffer[0] = (float)(complexVectorPtr[0]);
+ inputFloatBuffer[1] = (float)(complexVectorPtr[1]);
+ inputFloatBuffer[2] = (float)(complexVectorPtr[2]);
+ inputFloatBuffer[3] = (float)(complexVectorPtr[3]);
+
+ cplxValue2 = _mm_load_ps(inputFloatBuffer);
+ complexVectorPtr += 4;
+
+ cplxValue1 = _mm_mul_ps(cplxValue1, invScalar);
+ cplxValue2 = _mm_mul_ps(cplxValue2, invScalar);
+
+ // Arrange in i1i2i3i4 format
+ iValue = _mm_shuffle_ps(cplxValue1, cplxValue2, _MM_SHUFFLE(2,0,2,0));
+ // Arrange in q1q2q3q4 format
+ qValue = _mm_shuffle_ps(cplxValue1, cplxValue2, _MM_SHUFFLE(3,1,3,1));
+
+ iValue = _mm_mul_ps(iValue, iValue); // Square the I values
+ qValue = _mm_mul_ps(qValue, qValue); // Square the Q Values
+
+ result = _mm_add_ps(iValue, qValue); // Add the I2 and Q2 values
+
+ result = _mm_sqrt_ps(result); // Square root the values
+
+ result = _mm_mul_ps(result, vScalar); // Scale the results
+
+ _mm_store_ps(outputFloatBuffer, result);
+ *magnitudeVectorPtr++ = (int16_t)(outputFloatBuffer[0]);
+ *magnitudeVectorPtr++ = (int16_t)(outputFloatBuffer[1]);
+ *magnitudeVectorPtr++ = (int16_t)(outputFloatBuffer[2]);
+ *magnitudeVectorPtr++ = (int16_t)(outputFloatBuffer[3]);
+ }
+
+ number = quarterPoints * 4;
+ magnitudeVectorPtr = &magnitudeVector[number];
+ complexVectorPtr = (const int16_t*)&complexVector[number];
+ for(; number < num_points; number++){
+ const float val1Real = (float)(*complexVectorPtr++) / 32768.0;
+ const float val1Imag = (float)(*complexVectorPtr++) / 32768.0;
+ const float val1Result = sqrtf((val1Real * val1Real) + (val1Imag * val1Imag)) * 32768.0;
+ *magnitudeVectorPtr++ = (int16_t)(val1Result);
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Calculates the magnitude of the complexVector and stores the results in the magnitudeVector
+ \param complexVector The vector containing the complex input values
+ \param magnitudeVector The vector containing the real output values
+ \param num_points The number of complex values in complexVector to be calculated and stored into cVector
+*/
+static inline void volk_16ic_magnitude_16i_generic(int16_t* magnitudeVector, const lv_16sc_t* complexVector, unsigned int num_points){
+ const int16_t* complexVectorPtr = (const int16_t*)complexVector;
+ int16_t* magnitudeVectorPtr = magnitudeVector;
+ unsigned int number = 0;
+ const float scalar = 32768.0;
+ for(number = 0; number < num_points; number++){
+ float real = ((float)(*complexVectorPtr++)) / scalar;
+ float imag = ((float)(*complexVectorPtr++)) / scalar;
+ *magnitudeVectorPtr++ = (int16_t)(sqrtf((real*real) + (imag*imag)) * scalar);
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+#ifdef LV_HAVE_ORC_DISABLED
+/*!
+ \brief Calculates the magnitude of the complexVector and stores the results in the magnitudeVector
+ \param complexVector The vector containing the complex input values
+ \param magnitudeVector The vector containing the real output values
+ \param num_points The number of complex values in complexVector to be calculated and stored into cVector
+*/
+extern void volk_16ic_magnitude_16i_a_orc_impl(int16_t* magnitudeVector, const lv_16sc_t* complexVector, float scalar, unsigned int num_points);
+static inline void volk_16ic_magnitude_16i_u_orc(int16_t* magnitudeVector, const lv_16sc_t* complexVector, unsigned int num_points){
+ volk_16ic_magnitude_16i_a_orc_impl(magnitudeVector, complexVector, 32768.0, num_points);
+}
+#endif /* LV_HAVE_ORC */
+
+
+#endif /* INCLUDED_volk_16ic_magnitude_16i_a_H */
diff --git a/volk/kernels/volk/volk_16ic_s32f_deinterleave_32f_x2.h b/volk/kernels/volk/volk_16ic_s32f_deinterleave_32f_x2.h
new file mode 100644
index 000000000..55243b4aa
--- /dev/null
+++ b/volk/kernels/volk/volk_16ic_s32f_deinterleave_32f_x2.h
@@ -0,0 +1,109 @@
+#ifndef INCLUDED_volk_16ic_s32f_deinterleave_32f_x2_a_H
+#define INCLUDED_volk_16ic_s32f_deinterleave_32f_x2_a_H
+
+#include <volk/volk_common.h>
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+ /*!
+ \brief Converts the complex 16 bit vector into floats,scales each data point, and deinterleaves into I & Q vector data
+ \param complexVector The complex input vector
+ \param iBuffer The I buffer output data
+ \param qBuffer The Q buffer output data
+ \param scalar The data value to be divided against each input data value of the input complex vector
+ \param num_points The number of complex data values to be deinterleaved
+ */
+static inline void volk_16ic_s32f_deinterleave_32f_x2_a_sse(float* iBuffer, float* qBuffer, const lv_16sc_t* complexVector, const float scalar, unsigned int num_points){
+ float* iBufferPtr = iBuffer;
+ float* qBufferPtr = qBuffer;
+
+ uint64_t number = 0;
+ const uint64_t quarterPoints = num_points / 4;
+ __m128 cplxValue1, cplxValue2, iValue, qValue;
+
+ __m128 invScalar = _mm_set_ps1(1.0/scalar);
+ int16_t* complexVectorPtr = (int16_t*)complexVector;
+
+ __VOLK_ATTR_ALIGNED(16) float floatBuffer[8];
+
+ for(;number < quarterPoints; number++){
+
+ floatBuffer[0] = (float)(complexVectorPtr[0]);
+ floatBuffer[1] = (float)(complexVectorPtr[1]);
+ floatBuffer[2] = (float)(complexVectorPtr[2]);
+ floatBuffer[3] = (float)(complexVectorPtr[3]);
+
+ floatBuffer[4] = (float)(complexVectorPtr[4]);
+ floatBuffer[5] = (float)(complexVectorPtr[5]);
+ floatBuffer[6] = (float)(complexVectorPtr[6]);
+ floatBuffer[7] = (float)(complexVectorPtr[7]);
+
+ cplxValue1 = _mm_load_ps(&floatBuffer[0]);
+ cplxValue2 = _mm_load_ps(&floatBuffer[4]);
+
+ complexVectorPtr += 8;
+
+ cplxValue1 = _mm_mul_ps(cplxValue1, invScalar);
+ cplxValue2 = _mm_mul_ps(cplxValue2, invScalar);
+
+ // Arrange in i1i2i3i4 format
+ iValue = _mm_shuffle_ps(cplxValue1, cplxValue2, _MM_SHUFFLE(2,0,2,0));
+ // Arrange in q1q2q3q4 format
+ qValue = _mm_shuffle_ps(cplxValue1, cplxValue2, _MM_SHUFFLE(3,1,3,1));
+
+ _mm_store_ps(iBufferPtr, iValue);
+ _mm_store_ps(qBufferPtr, qValue);
+
+ iBufferPtr += 4;
+ qBufferPtr += 4;
+ }
+
+ number = quarterPoints * 4;
+ complexVectorPtr = (int16_t*)&complexVector[number];
+ for(; number < num_points; number++){
+ *iBufferPtr++ = (float)(*complexVectorPtr++) / scalar;
+ *qBufferPtr++ = (float)(*complexVectorPtr++) / scalar;
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+ /*!
+ \brief Converts the complex 16 bit vector into floats,scales each data point, and deinterleaves into I & Q vector data
+ \param complexVector The complex input vector
+ \param iBuffer The I buffer output data
+ \param qBuffer The Q buffer output data
+ \param scalar The data value to be divided against each input data value of the input complex vector
+ \param num_points The number of complex data values to be deinterleaved
+ */
+static inline void volk_16ic_s32f_deinterleave_32f_x2_generic(float* iBuffer, float* qBuffer, const lv_16sc_t* complexVector, const float scalar, unsigned int num_points){
+ const int16_t* complexVectorPtr = (const int16_t*)complexVector;
+ float* iBufferPtr = iBuffer;
+ float* qBufferPtr = qBuffer;
+ unsigned int number;
+ for(number = 0; number < num_points; number++){
+ *iBufferPtr++ = (float)(*complexVectorPtr++) / scalar;
+ *qBufferPtr++ = (float)(*complexVectorPtr++) / scalar;
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+#ifdef LV_HAVE_ORC
+ /*!
+ \brief Converts the complex 16 bit vector into floats,scales each data point, and deinterleaves into I & Q vector data
+ \param complexVector The complex input vector
+ \param iBuffer The I buffer output data
+ \param qBuffer The Q buffer output data
+ \param scalar The data value to be divided against each input data value of the input complex vector
+ \param num_points The number of complex data values to be deinterleaved
+ */
+extern void volk_16ic_s32f_deinterleave_32f_x2_a_orc_impl(float* iBuffer, float* qBuffer, const lv_16sc_t* complexVector, const float scalar, unsigned int num_points);
+static inline void volk_16ic_s32f_deinterleave_32f_x2_u_orc(float* iBuffer, float* qBuffer, const lv_16sc_t* complexVector, const float scalar, unsigned int num_points){
+ volk_16ic_s32f_deinterleave_32f_x2_a_orc_impl(iBuffer, qBuffer, complexVector, scalar, num_points);
+}
+#endif /* LV_HAVE_ORC */
+
+
+#endif /* INCLUDED_volk_16ic_s32f_deinterleave_32f_x2_a_H */
diff --git a/volk/kernels/volk/volk_16ic_s32f_deinterleave_real_32f.h b/volk/kernels/volk/volk_16ic_s32f_deinterleave_real_32f.h
new file mode 100644
index 000000000..57d078a59
--- /dev/null
+++ b/volk/kernels/volk/volk_16ic_s32f_deinterleave_real_32f.h
@@ -0,0 +1,126 @@
+#ifndef INCLUDED_volk_16ic_s32f_deinterleave_real_32f_a_H
+#define INCLUDED_volk_16ic_s32f_deinterleave_real_32f_a_H
+
+#include <volk/volk_common.h>
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE4_1
+#include <smmintrin.h>
+/*!
+ \brief Deinterleaves the complex 16 bit vector into I float vector data
+ \param complexVector The complex input vector
+ \param iBuffer The I buffer output data
+ \param scalar The scaling value being multiplied against each data point
+ \param num_points The number of complex data values to be deinterleaved
+*/
+static inline void volk_16ic_s32f_deinterleave_real_32f_a_sse4_1(float* iBuffer, const lv_16sc_t* complexVector, const float scalar, unsigned int num_points){
+ float* iBufferPtr = iBuffer;
+
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+
+ __m128 iFloatValue;
+
+ const float iScalar= 1.0 / scalar;
+ __m128 invScalar = _mm_set_ps1(iScalar);
+ __m128i complexVal, iIntVal;
+ int8_t* complexVectorPtr = (int8_t*)complexVector;
+
+ __m128i moveMask = _mm_set_epi8(0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 13, 12, 9, 8, 5, 4, 1, 0);
+
+ for(;number < quarterPoints; number++){
+ complexVal = _mm_load_si128((__m128i*)complexVectorPtr); complexVectorPtr += 16;
+ complexVal = _mm_shuffle_epi8(complexVal, moveMask);
+
+ iIntVal = _mm_cvtepi16_epi32(complexVal);
+ iFloatValue = _mm_cvtepi32_ps(iIntVal);
+
+ iFloatValue = _mm_mul_ps(iFloatValue, invScalar);
+
+ _mm_store_ps(iBufferPtr, iFloatValue);
+
+ iBufferPtr += 4;
+ }
+
+ number = quarterPoints * 4;
+ int16_t* sixteenTComplexVectorPtr = (int16_t*)&complexVector[number];
+ for(; number < num_points; number++){
+ *iBufferPtr++ = ((float)(*sixteenTComplexVectorPtr++)) * iScalar;
+ sixteenTComplexVectorPtr++;
+ }
+
+}
+#endif /* LV_HAVE_SSE4_1 */
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+/*!
+ \brief Deinterleaves the complex 16 bit vector into I float vector data
+ \param complexVector The complex input vector
+ \param iBuffer The I buffer output data
+ \param scalar The scaling value being multiplied against each data point
+ \param num_points The number of complex data values to be deinterleaved
+*/
+static inline void volk_16ic_s32f_deinterleave_real_32f_a_sse(float* iBuffer, const lv_16sc_t* complexVector, const float scalar, unsigned int num_points){
+ float* iBufferPtr = iBuffer;
+
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+ __m128 iValue;
+
+ const float iScalar = 1.0/scalar;
+ __m128 invScalar = _mm_set_ps1(iScalar);
+ int16_t* complexVectorPtr = (int16_t*)complexVector;
+
+ __VOLK_ATTR_ALIGNED(16) float floatBuffer[4];
+
+ for(;number < quarterPoints; number++){
+ floatBuffer[0] = (float)(*complexVectorPtr); complexVectorPtr += 2;
+ floatBuffer[1] = (float)(*complexVectorPtr); complexVectorPtr += 2;
+ floatBuffer[2] = (float)(*complexVectorPtr); complexVectorPtr += 2;
+ floatBuffer[3] = (float)(*complexVectorPtr); complexVectorPtr += 2;
+
+ iValue = _mm_load_ps(floatBuffer);
+
+ iValue = _mm_mul_ps(iValue, invScalar);
+
+ _mm_store_ps(iBufferPtr, iValue);
+
+ iBufferPtr += 4;
+ }
+
+ number = quarterPoints * 4;
+ complexVectorPtr = (int16_t*)&complexVector[number];
+ for(; number < num_points; number++){
+ *iBufferPtr++ = ((float)(*complexVectorPtr++)) * iScalar;
+ complexVectorPtr++;
+ }
+
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Deinterleaves the complex 16 bit vector into I float vector data
+ \param complexVector The complex input vector
+ \param iBuffer The I buffer output data
+ \param scalar The scaling value being multiplied against each data point
+ \param num_points The number of complex data values to be deinterleaved
+*/
+static inline void volk_16ic_s32f_deinterleave_real_32f_generic(float* iBuffer, const lv_16sc_t* complexVector, const float scalar, unsigned int num_points){
+ unsigned int number = 0;
+ const int16_t* complexVectorPtr = (const int16_t*)complexVector;
+ float* iBufferPtr = iBuffer;
+ const float invScalar = 1.0 / scalar;
+ for(number = 0; number < num_points; number++){
+ *iBufferPtr++ = ((float)(*complexVectorPtr++)) * invScalar;
+ complexVectorPtr++;
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_16ic_s32f_deinterleave_real_32f_a_H */
diff --git a/volk/kernels/volk/volk_16ic_s32f_magnitude_32f.h b/volk/kernels/volk/volk_16ic_s32f_magnitude_32f.h
new file mode 100644
index 000000000..27901cb9a
--- /dev/null
+++ b/volk/kernels/volk/volk_16ic_s32f_magnitude_32f.h
@@ -0,0 +1,180 @@
+#ifndef INCLUDED_volk_16ic_s32f_magnitude_32f_a_H
+#define INCLUDED_volk_16ic_s32f_magnitude_32f_a_H
+
+#include <volk/volk_common.h>
+#include <inttypes.h>
+#include <stdio.h>
+#include <math.h>
+
+#ifdef LV_HAVE_SSE3
+#include <pmmintrin.h>
+/*!
+ \brief Calculates the magnitude of the complexVector and stores the results in the magnitudeVector
+ \param complexVector The vector containing the complex input values
+ \param magnitudeVector The vector containing the real output values
+ \param scalar The data value to be divided against each input data value of the input complex vector
+ \param num_points The number of complex values in complexVector to be calculated and stored into cVector
+*/
+static inline void volk_16ic_s32f_magnitude_32f_a_sse3(float* magnitudeVector, const lv_16sc_t* complexVector, const float scalar, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+
+ const int16_t* complexVectorPtr = (const int16_t*)complexVector;
+ float* magnitudeVectorPtr = magnitudeVector;
+
+ __m128 invScalar = _mm_set_ps1(1.0/scalar);
+
+ __m128 cplxValue1, cplxValue2, result;
+
+ __VOLK_ATTR_ALIGNED(16) float inputFloatBuffer[8];
+
+ for(;number < quarterPoints; number++){
+
+ inputFloatBuffer[0] = (float)(complexVectorPtr[0]);
+ inputFloatBuffer[1] = (float)(complexVectorPtr[1]);
+ inputFloatBuffer[2] = (float)(complexVectorPtr[2]);
+ inputFloatBuffer[3] = (float)(complexVectorPtr[3]);
+
+ inputFloatBuffer[4] = (float)(complexVectorPtr[4]);
+ inputFloatBuffer[5] = (float)(complexVectorPtr[5]);
+ inputFloatBuffer[6] = (float)(complexVectorPtr[6]);
+ inputFloatBuffer[7] = (float)(complexVectorPtr[7]);
+
+ cplxValue1 = _mm_load_ps(&inputFloatBuffer[0]);
+ cplxValue2 = _mm_load_ps(&inputFloatBuffer[4]);
+
+ complexVectorPtr += 8;
+
+ cplxValue1 = _mm_mul_ps(cplxValue1, invScalar);
+ cplxValue2 = _mm_mul_ps(cplxValue2, invScalar);
+
+ cplxValue1 = _mm_mul_ps(cplxValue1, cplxValue1); // Square the values
+ cplxValue2 = _mm_mul_ps(cplxValue2, cplxValue2); // Square the Values
+
+ result = _mm_hadd_ps(cplxValue1, cplxValue2); // Add the I2 and Q2 values
+
+ result = _mm_sqrt_ps(result); // Square root the values
+
+ _mm_store_ps(magnitudeVectorPtr, result);
+
+ magnitudeVectorPtr += 4;
+ }
+
+ number = quarterPoints * 4;
+ magnitudeVectorPtr = &magnitudeVector[number];
+ complexVectorPtr = (const int16_t*)&complexVector[number];
+ for(; number < num_points; number++){
+ float val1Real = (float)(*complexVectorPtr++) / scalar;
+ float val1Imag = (float)(*complexVectorPtr++) / scalar;
+ *magnitudeVectorPtr++ = sqrtf((val1Real * val1Real) + (val1Imag * val1Imag));
+ }
+}
+#endif /* LV_HAVE_SSE3 */
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+/*!
+ \brief Calculates the magnitude of the complexVector and stores the results in the magnitudeVector
+ \param complexVector The vector containing the complex input values
+ \param magnitudeVector The vector containing the real output values
+ \param scalar The data value to be divided against each input data value of the input complex vector
+ \param num_points The number of complex values in complexVector to be calculated and stored into cVector
+*/
+static inline void volk_16ic_s32f_magnitude_32f_a_sse(float* magnitudeVector, const lv_16sc_t* complexVector, const float scalar, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+
+ const int16_t* complexVectorPtr = (const int16_t*)complexVector;
+ float* magnitudeVectorPtr = magnitudeVector;
+
+ const float iScalar = 1.0 / scalar;
+ __m128 invScalar = _mm_set_ps1(iScalar);
+
+ __m128 cplxValue1, cplxValue2, result, re, im;
+
+ __VOLK_ATTR_ALIGNED(16) float inputFloatBuffer[8];
+
+ for(;number < quarterPoints; number++){
+ inputFloatBuffer[0] = (float)(complexVectorPtr[0]);
+ inputFloatBuffer[1] = (float)(complexVectorPtr[1]);
+ inputFloatBuffer[2] = (float)(complexVectorPtr[2]);
+ inputFloatBuffer[3] = (float)(complexVectorPtr[3]);
+
+ inputFloatBuffer[4] = (float)(complexVectorPtr[4]);
+ inputFloatBuffer[5] = (float)(complexVectorPtr[5]);
+ inputFloatBuffer[6] = (float)(complexVectorPtr[6]);
+ inputFloatBuffer[7] = (float)(complexVectorPtr[7]);
+
+ cplxValue1 = _mm_load_ps(&inputFloatBuffer[0]);
+ cplxValue2 = _mm_load_ps(&inputFloatBuffer[4]);
+
+ re = _mm_shuffle_ps(cplxValue1, cplxValue2, 0x88);
+ im = _mm_shuffle_ps(cplxValue1, cplxValue2, 0xdd);
+
+ complexVectorPtr += 8;
+
+ cplxValue1 = _mm_mul_ps(re, invScalar);
+ cplxValue2 = _mm_mul_ps(im, invScalar);
+
+ cplxValue1 = _mm_mul_ps(cplxValue1, cplxValue1); // Square the values
+ cplxValue2 = _mm_mul_ps(cplxValue2, cplxValue2); // Square the Values
+
+ result = _mm_add_ps(cplxValue1, cplxValue2); // Add the I2 and Q2 values
+
+ result = _mm_sqrt_ps(result); // Square root the values
+
+ _mm_store_ps(magnitudeVectorPtr, result);
+
+ magnitudeVectorPtr += 4;
+ }
+
+ number = quarterPoints * 4;
+ magnitudeVectorPtr = &magnitudeVector[number];
+ complexVectorPtr = (const int16_t*)&complexVector[number];
+ for(; number < num_points; number++){
+ float val1Real = (float)(*complexVectorPtr++) * iScalar;
+ float val1Imag = (float)(*complexVectorPtr++) * iScalar;
+ *magnitudeVectorPtr++ = sqrtf((val1Real * val1Real) + (val1Imag * val1Imag));
+ }
+}
+
+
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Calculates the magnitude of the complexVector and stores the results in the magnitudeVector
+ \param complexVector The vector containing the complex input values
+ \param magnitudeVector The vector containing the real output values
+ \param scalar The data value to be divided against each input data value of the input complex vector
+ \param num_points The number of complex values in complexVector to be calculated and stored into cVector
+*/
+static inline void volk_16ic_s32f_magnitude_32f_generic(float* magnitudeVector, const lv_16sc_t* complexVector, const float scalar, unsigned int num_points){
+ const int16_t* complexVectorPtr = (const int16_t*)complexVector;
+ float* magnitudeVectorPtr = magnitudeVector;
+ unsigned int number = 0;
+ const float invScalar = 1.0 / scalar;
+ for(number = 0; number < num_points; number++){
+ float real = ( (float) (*complexVectorPtr++)) * invScalar;
+ float imag = ( (float) (*complexVectorPtr++)) * invScalar;
+ *magnitudeVectorPtr++ = sqrtf((real*real) + (imag*imag));
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+#ifdef LV_HAVE_ORC_DISABLED
+/*!
+ \brief Calculates the magnitude of the complexVector and stores the results in the magnitudeVector
+ \param complexVector The vector containing the complex input values
+ \param magnitudeVector The vector containing the real output values
+ \param scalar The data value to be divided against each input data value of the input complex vector
+ \param num_points The number of complex values in complexVector to be calculated and stored into cVector
+*/
+extern void volk_16ic_s32f_magnitude_32f_a_orc_impl(float* magnitudeVector, const lv_16sc_t* complexVector, const float scalar, unsigned int num_points);
+static inline void volk_16ic_s32f_magnitude_32f_u_orc(float* magnitudeVector, const lv_16sc_t* complexVector, const float scalar, unsigned int num_points){
+ volk_16ic_s32f_magnitude_32f_a_orc_impl(magnitudeVector, complexVector, scalar, num_points);
+}
+#endif /* LV_HAVE_ORC */
+
+
+#endif /* INCLUDED_volk_16ic_s32f_magnitude_32f_a_H */
diff --git a/volk/kernels/volk/volk_16u_byteswap.h b/volk/kernels/volk/volk_16u_byteswap.h
new file mode 100644
index 000000000..57f200899
--- /dev/null
+++ b/volk/kernels/volk/volk_16u_byteswap.h
@@ -0,0 +1,140 @@
+#ifndef INCLUDED_volk_16u_byteswap_u_H
+#define INCLUDED_volk_16u_byteswap_u_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE2
+#include <emmintrin.h>
+
+/*!
+ \brief Byteswaps (in-place) an unaligned vector of int16_t's.
+ \param intsToSwap The vector of data to byte swap
+ \param numDataPoints The number of data points
+*/
+static inline void volk_16u_byteswap_u_sse2(uint16_t* intsToSwap, unsigned int num_points){
+ unsigned int number = 0;
+ uint16_t* inputPtr = intsToSwap;
+ __m128i input, left, right, output;
+
+ const unsigned int eighthPoints = num_points / 8;
+ for(;number < eighthPoints; number++){
+ // Load the 16t values, increment inputPtr later since we're doing it in-place.
+ input = _mm_loadu_si128((__m128i*)inputPtr);
+ // Do the two shifts
+ left = _mm_slli_epi16(input, 8);
+ right = _mm_srli_epi16(input, 8);
+ // Or the left and right halves together
+ output = _mm_or_si128(left, right);
+ // Store the results
+ _mm_storeu_si128((__m128i*)inputPtr, output);
+ inputPtr += 8;
+ }
+
+ // Byteswap any remaining points:
+ number = eighthPoints*8;
+ for(; number < num_points; number++){
+ uint16_t outputVal = *inputPtr;
+ outputVal = (((outputVal >> 8) & 0xff) | ((outputVal << 8) & 0xff00));
+ *inputPtr = outputVal;
+ inputPtr++;
+ }
+}
+#endif /* LV_HAVE_SSE2 */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Byteswaps (in-place) an unaligned vector of int16_t's.
+ \param intsToSwap The vector of data to byte swap
+ \param numDataPoints The number of data points
+*/
+static inline void volk_16u_byteswap_generic(uint16_t* intsToSwap, unsigned int num_points){
+ unsigned int point;
+ uint16_t* inputPtr = intsToSwap;
+ for(point = 0; point < num_points; point++){
+ uint16_t output = *inputPtr;
+ output = (((output >> 8) & 0xff) | ((output << 8) & 0xff00));
+ *inputPtr = output;
+ inputPtr++;
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+#endif /* INCLUDED_volk_16u_byteswap_u_H */
+#ifndef INCLUDED_volk_16u_byteswap_a_H
+#define INCLUDED_volk_16u_byteswap_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE2
+#include <emmintrin.h>
+
+/*!
+ \brief Byteswaps (in-place) an aligned vector of int16_t's.
+ \param intsToSwap The vector of data to byte swap
+ \param numDataPoints The number of data points
+*/
+static inline void volk_16u_byteswap_a_sse2(uint16_t* intsToSwap, unsigned int num_points){
+ unsigned int number = 0;
+ uint16_t* inputPtr = intsToSwap;
+ __m128i input, left, right, output;
+
+ const unsigned int eighthPoints = num_points / 8;
+ for(;number < eighthPoints; number++){
+ // Load the 16t values, increment inputPtr later since we're doing it in-place.
+ input = _mm_load_si128((__m128i*)inputPtr);
+ // Do the two shifts
+ left = _mm_slli_epi16(input, 8);
+ right = _mm_srli_epi16(input, 8);
+ // Or the left and right halves together
+ output = _mm_or_si128(left, right);
+ // Store the results
+ _mm_store_si128((__m128i*)inputPtr, output);
+ inputPtr += 8;
+ }
+
+
+ // Byteswap any remaining points:
+ number = eighthPoints*8;
+ for(; number < num_points; number++){
+ uint16_t outputVal = *inputPtr;
+ outputVal = (((outputVal >> 8) & 0xff) | ((outputVal << 8) & 0xff00));
+ *inputPtr = outputVal;
+ inputPtr++;
+ }
+}
+#endif /* LV_HAVE_SSE2 */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Byteswaps (in-place) an aligned vector of int16_t's.
+ \param intsToSwap The vector of data to byte swap
+ \param numDataPoints The number of data points
+*/
+static inline void volk_16u_byteswap_a_generic(uint16_t* intsToSwap, unsigned int num_points){
+ unsigned int point;
+ uint16_t* inputPtr = intsToSwap;
+ for(point = 0; point < num_points; point++){
+ uint16_t output = *inputPtr;
+ output = (((output >> 8) & 0xff) | ((output << 8) & 0xff00));
+ *inputPtr = output;
+ inputPtr++;
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+#ifdef LV_HAVE_ORC
+/*!
+ \brief Byteswaps (in-place) an aligned vector of int16_t's.
+ \param intsToSwap The vector of data to byte swap
+ \param numDataPoints The number of data points
+*/
+extern void volk_16u_byteswap_a_orc_impl(uint16_t* intsToSwap, unsigned int num_points);
+static inline void volk_16u_byteswap_u_orc(uint16_t* intsToSwap, unsigned int num_points){
+ volk_16u_byteswap_a_orc_impl(intsToSwap, num_points);
+}
+#endif /* LV_HAVE_ORC */
+
+
+#endif /* INCLUDED_volk_16u_byteswap_a_H */
diff --git a/volk/kernels/volk/volk_32f_accumulator_s32f.h b/volk/kernels/volk/volk_32f_accumulator_s32f.h
new file mode 100644
index 000000000..a67d10f9b
--- /dev/null
+++ b/volk/kernels/volk/volk_32f_accumulator_s32f.h
@@ -0,0 +1,68 @@
+#ifndef INCLUDED_volk_32f_accumulator_s32f_a_H
+#define INCLUDED_volk_32f_accumulator_s32f_a_H
+
+#include <volk/volk_common.h>
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+/*!
+ \brief Accumulates the values in the input buffer
+ \param result The accumulated result
+ \param inputBuffer The buffer of data to be accumulated
+ \param num_points The number of values in inputBuffer to be accumulated
+*/
+static inline void volk_32f_accumulator_s32f_a_sse(float* result, const float* inputBuffer, unsigned int num_points){
+ float returnValue = 0;
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+
+ const float* aPtr = inputBuffer;
+ __VOLK_ATTR_ALIGNED(16) float tempBuffer[4];
+
+ __m128 accumulator = _mm_setzero_ps();
+ __m128 aVal = _mm_setzero_ps();
+
+ for(;number < quarterPoints; number++){
+ aVal = _mm_load_ps(aPtr);
+ accumulator = _mm_add_ps(accumulator, aVal);
+ aPtr += 4;
+ }
+ _mm_store_ps(tempBuffer,accumulator); // Store the results back into the C container
+ returnValue = tempBuffer[0];
+ returnValue += tempBuffer[1];
+ returnValue += tempBuffer[2];
+ returnValue += tempBuffer[3];
+
+ number = quarterPoints * 4;
+ for(;number < num_points; number++){
+ returnValue += (*aPtr++);
+ }
+ *result = returnValue;
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Accumulates the values in the input buffer
+ \param result The accumulated result
+ \param inputBuffer The buffer of data to be accumulated
+ \param num_points The number of values in inputBuffer to be accumulated
+*/
+static inline void volk_32f_accumulator_s32f_generic(float* result, const float* inputBuffer, unsigned int num_points){
+ const float* aPtr = inputBuffer;
+ unsigned int number = 0;
+ float returnValue = 0;
+
+ for(;number < num_points; number++){
+ returnValue += (*aPtr++);
+ }
+ *result = returnValue;
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_32f_accumulator_s32f_a_H */
diff --git a/volk/kernels/volk/volk_32f_convert_64f.h b/volk/kernels/volk/volk_32f_convert_64f.h
new file mode 100644
index 000000000..2f036955d
--- /dev/null
+++ b/volk/kernels/volk/volk_32f_convert_64f.h
@@ -0,0 +1,140 @@
+#ifndef INCLUDED_volk_32f_convert_64f_u_H
+#define INCLUDED_volk_32f_convert_64f_u_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE2
+#include <emmintrin.h>
+ /*!
+ \brief Converts the float values into double values
+ \param dVector The converted double vector values
+ \param fVector The float vector values to be converted
+ \param num_points The number of points in the two vectors to be converted
+ */
+static inline void volk_32f_convert_64f_u_sse2(double* outputVector, const float* inputVector, unsigned int num_points){
+ unsigned int number = 0;
+
+ const unsigned int quarterPoints = num_points / 4;
+
+ const float* inputVectorPtr = (const float*)inputVector;
+ double* outputVectorPtr = outputVector;
+ __m128d ret;
+ __m128 inputVal;
+
+ for(;number < quarterPoints; number++){
+ inputVal = _mm_loadu_ps(inputVectorPtr); inputVectorPtr += 4;
+
+ ret = _mm_cvtps_pd(inputVal);
+
+ _mm_storeu_pd(outputVectorPtr, ret);
+ outputVectorPtr += 2;
+
+ inputVal = _mm_movehl_ps(inputVal, inputVal);
+
+ ret = _mm_cvtps_pd(inputVal);
+
+ _mm_storeu_pd(outputVectorPtr, ret);
+ outputVectorPtr += 2;
+ }
+
+ number = quarterPoints * 4;
+ for(; number < num_points; number++){
+ outputVector[number] = (double)(inputVector[number]);
+ }
+}
+#endif /* LV_HAVE_SSE2 */
+
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Converts the float values into double values
+ \param dVector The converted double vector values
+ \param fVector The float vector values to be converted
+ \param num_points The number of points in the two vectors to be converted
+*/
+static inline void volk_32f_convert_64f_generic(double* outputVector, const float* inputVector, unsigned int num_points){
+ double* outputVectorPtr = outputVector;
+ const float* inputVectorPtr = inputVector;
+ unsigned int number = 0;
+
+ for(number = 0; number < num_points; number++){
+ *outputVectorPtr++ = ((double)(*inputVectorPtr++));
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_32f_convert_64f_u_H */
+#ifndef INCLUDED_volk_32f_convert_64f_a_H
+#define INCLUDED_volk_32f_convert_64f_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE2
+#include <emmintrin.h>
+ /*!
+ \brief Converts the float values into double values
+ \param dVector The converted double vector values
+ \param fVector The float vector values to be converted
+ \param num_points The number of points in the two vectors to be converted
+ */
+static inline void volk_32f_convert_64f_a_sse2(double* outputVector, const float* inputVector, unsigned int num_points){
+ unsigned int number = 0;
+
+ const unsigned int quarterPoints = num_points / 4;
+
+ const float* inputVectorPtr = (const float*)inputVector;
+ double* outputVectorPtr = outputVector;
+ __m128d ret;
+ __m128 inputVal;
+
+ for(;number < quarterPoints; number++){
+ inputVal = _mm_load_ps(inputVectorPtr); inputVectorPtr += 4;
+
+ ret = _mm_cvtps_pd(inputVal);
+
+ _mm_store_pd(outputVectorPtr, ret);
+ outputVectorPtr += 2;
+
+ inputVal = _mm_movehl_ps(inputVal, inputVal);
+
+ ret = _mm_cvtps_pd(inputVal);
+
+ _mm_store_pd(outputVectorPtr, ret);
+ outputVectorPtr += 2;
+ }
+
+ number = quarterPoints * 4;
+ for(; number < num_points; number++){
+ outputVector[number] = (double)(inputVector[number]);
+ }
+}
+#endif /* LV_HAVE_SSE2 */
+
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Converts the float values into double values
+ \param dVector The converted double vector values
+ \param fVector The float vector values to be converted
+ \param num_points The number of points in the two vectors to be converted
+*/
+static inline void volk_32f_convert_64f_a_generic(double* outputVector, const float* inputVector, unsigned int num_points){
+ double* outputVectorPtr = outputVector;
+ const float* inputVectorPtr = inputVector;
+ unsigned int number = 0;
+
+ for(number = 0; number < num_points; number++){
+ *outputVectorPtr++ = ((double)(*inputVectorPtr++));
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_32f_convert_64f_a_H */
diff --git a/volk/kernels/volk/volk_32f_index_max_16u.h b/volk/kernels/volk/volk_32f_index_max_16u.h
new file mode 100644
index 000000000..dd1aed245
--- /dev/null
+++ b/volk/kernels/volk/volk_32f_index_max_16u.h
@@ -0,0 +1,149 @@
+#ifndef INCLUDED_volk_32f_index_max_16u_a_H
+#define INCLUDED_volk_32f_index_max_16u_a_H
+
+#include <volk/volk_common.h>
+#include <volk/volk_common.h>
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE4_1
+#include<smmintrin.h>
+
+static inline void volk_32f_index_max_16u_a_sse4_1(unsigned int* target, const float* src0, unsigned int num_points) {
+ if(num_points > 0){
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+
+ float* inputPtr = (float*)src0;
+
+ __m128 indexIncrementValues = _mm_set1_ps(4);
+ __m128 currentIndexes = _mm_set_ps(-1,-2,-3,-4);
+
+ float max = src0[0];
+ float index = 0;
+ __m128 maxValues = _mm_set1_ps(max);
+ __m128 maxValuesIndex = _mm_setzero_ps();
+ __m128 compareResults;
+ __m128 currentValues;
+
+ __VOLK_ATTR_ALIGNED(16) float maxValuesBuffer[4];
+ __VOLK_ATTR_ALIGNED(16) float maxIndexesBuffer[4];
+
+ for(;number < quarterPoints; number++){
+
+ currentValues = _mm_load_ps(inputPtr); inputPtr += 4;
+ currentIndexes = _mm_add_ps(currentIndexes, indexIncrementValues);
+
+ compareResults = _mm_cmpgt_ps(maxValues, currentValues);
+
+ maxValuesIndex = _mm_blendv_ps(currentIndexes, maxValuesIndex, compareResults);
+ maxValues = _mm_blendv_ps(currentValues, maxValues, compareResults);
+ }
+
+ // Calculate the largest value from the remaining 4 points
+ _mm_store_ps(maxValuesBuffer, maxValues);
+ _mm_store_ps(maxIndexesBuffer, maxValuesIndex);
+
+ for(number = 0; number < 4; number++){
+ if(maxValuesBuffer[number] > max){
+ index = maxIndexesBuffer[number];
+ max = maxValuesBuffer[number];
+ }
+ }
+
+ number = quarterPoints * 4;
+ for(;number < num_points; number++){
+ if(src0[number] > max){
+ index = number;
+ max = src0[number];
+ }
+ }
+ target[0] = (unsigned int)index;
+ }
+}
+
+#endif /*LV_HAVE_SSE4_1*/
+
+#ifdef LV_HAVE_SSE
+#include<xmmintrin.h>
+
+static inline void volk_32f_index_max_16u_a_sse(unsigned int* target, const float* src0, unsigned int num_points) {
+ if(num_points > 0){
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+
+ float* inputPtr = (float*)src0;
+
+ __m128 indexIncrementValues = _mm_set1_ps(4);
+ __m128 currentIndexes = _mm_set_ps(-1,-2,-3,-4);
+
+ float max = src0[0];
+ float index = 0;
+ __m128 maxValues = _mm_set1_ps(max);
+ __m128 maxValuesIndex = _mm_setzero_ps();
+ __m128 compareResults;
+ __m128 currentValues;
+
+ __VOLK_ATTR_ALIGNED(16) float maxValuesBuffer[4];
+ __VOLK_ATTR_ALIGNED(16) float maxIndexesBuffer[4];
+
+ for(;number < quarterPoints; number++){
+
+ currentValues = _mm_load_ps(inputPtr); inputPtr += 4;
+ currentIndexes = _mm_add_ps(currentIndexes, indexIncrementValues);
+
+ compareResults = _mm_cmpgt_ps(maxValues, currentValues);
+
+ maxValuesIndex = _mm_or_ps(_mm_and_ps(compareResults, maxValuesIndex) , _mm_andnot_ps(compareResults, currentIndexes));
+
+ maxValues = _mm_or_ps(_mm_and_ps(compareResults, maxValues) , _mm_andnot_ps(compareResults, currentValues));
+ }
+
+ // Calculate the largest value from the remaining 4 points
+ _mm_store_ps(maxValuesBuffer, maxValues);
+ _mm_store_ps(maxIndexesBuffer, maxValuesIndex);
+
+ for(number = 0; number < 4; number++){
+ if(maxValuesBuffer[number] > max){
+ index = maxIndexesBuffer[number];
+ max = maxValuesBuffer[number];
+ }
+ }
+
+ number = quarterPoints * 4;
+ for(;number < num_points; number++){
+ if(src0[number] > max){
+ index = number;
+ max = src0[number];
+ }
+ }
+ target[0] = (unsigned int)index;
+ }
+}
+
+#endif /*LV_HAVE_SSE*/
+
+#ifdef LV_HAVE_GENERIC
+static inline void volk_32f_index_max_16u_generic(unsigned int* target, const float* src0, unsigned int num_points) {
+ if(num_points > 0){
+ float max = src0[0];
+ unsigned int index = 0;
+
+ unsigned int i = 1;
+
+ for(; i < num_points; ++i) {
+
+ if(src0[i] > max){
+ index = i;
+ max = src0[i];
+ }
+
+ }
+ target[0] = index;
+ }
+}
+
+#endif /*LV_HAVE_GENERIC*/
+
+
+#endif /*INCLUDED_volk_32f_index_max_16u_a_H*/
diff --git a/volk/kernels/volk/volk_32f_s32f_32f_fm_detect_32f.h b/volk/kernels/volk/volk_32f_s32f_32f_fm_detect_32f.h
new file mode 100644
index 000000000..71881c2d5
--- /dev/null
+++ b/volk/kernels/volk/volk_32f_s32f_32f_fm_detect_32f.h
@@ -0,0 +1,120 @@
+#ifndef INCLUDED_volk_32f_s32f_32f_fm_detect_32f_a_H
+#define INCLUDED_volk_32f_s32f_32f_fm_detect_32f_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+/*!
+ \brief performs the FM-detect differentiation on the input vector and stores the results in the output vector.
+ \param outputVector The byte-aligned vector where the results will be stored.
+ \param inputVector The byte-aligned input vector containing phase data (must be on the interval (-bound,bound] )
+ \param bound The interval that the input phase data is in, which is used to modulo the differentiation
+ \param saveValue A pointer to a float which contains the phase value of the sample before the first input sample.
+ \param num_noints The number of real values in the input vector.
+*/
+static inline void volk_32f_s32f_32f_fm_detect_32f_a_sse(float* outputVector, const float* inputVector, const float bound, float* saveValue, unsigned int num_points){
+ if (num_points < 1) {
+ return;
+ }
+ unsigned int number = 1;
+ unsigned int j = 0;
+ // num_points-1 keeps Fedora 7's gcc from crashing...
+ // num_points won't work. :(
+ const unsigned int quarterPoints = (num_points-1) / 4;
+
+ float* outPtr = outputVector;
+ const float* inPtr = inputVector;
+ __m128 upperBound = _mm_set_ps1(bound);
+ __m128 lowerBound = _mm_set_ps1(-bound);
+ __m128 next3old1;
+ __m128 next4;
+ __m128 boundAdjust;
+ __m128 posBoundAdjust = _mm_set_ps1(-2*bound); // Subtract when we're above.
+ __m128 negBoundAdjust = _mm_set_ps1(2*bound); // Add when we're below.
+ // Do the first 4 by hand since we're going in from the saveValue:
+ *outPtr = *inPtr - *saveValue;
+ if (*outPtr > bound) *outPtr -= 2*bound;
+ if (*outPtr < -bound) *outPtr += 2*bound;
+ inPtr++;
+ outPtr++;
+ for (j = 1; j < ( (4 < num_points) ? 4 : num_points); j++) {
+ *outPtr = *(inPtr) - *(inPtr-1);
+ if (*outPtr > bound) *outPtr -= 2*bound;
+ if (*outPtr < -bound) *outPtr += 2*bound;
+ inPtr++;
+ outPtr++;
+ }
+
+ for (; number < quarterPoints; number++) {
+ // Load data
+ next3old1 = _mm_loadu_ps((float*) (inPtr-1));
+ next4 = _mm_load_ps(inPtr);
+ inPtr += 4;
+ // Subtract and store:
+ next3old1 = _mm_sub_ps(next4, next3old1);
+ // Bound:
+ boundAdjust = _mm_cmpgt_ps(next3old1, upperBound);
+ boundAdjust = _mm_and_ps(boundAdjust, posBoundAdjust);
+ next4 = _mm_cmplt_ps(next3old1, lowerBound);
+ next4 = _mm_and_ps(next4, negBoundAdjust);
+ boundAdjust = _mm_or_ps(next4, boundAdjust);
+ // Make sure we're in the bounding interval:
+ next3old1 = _mm_add_ps(next3old1, boundAdjust);
+ _mm_store_ps(outPtr,next3old1); // Store the results back into the output
+ outPtr += 4;
+ }
+
+ for (number = (4 > (quarterPoints*4) ? 4 : (4 * quarterPoints)); number < num_points; number++) {
+ *outPtr = *(inPtr) - *(inPtr-1);
+ if (*outPtr > bound) *outPtr -= 2*bound;
+ if (*outPtr < -bound) *outPtr += 2*bound;
+ inPtr++;
+ outPtr++;
+ }
+
+ *saveValue = inputVector[num_points-1];
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief performs the FM-detect differentiation on the input vector and stores the results in the output vector.
+ \param outputVector The byte-aligned vector where the results will be stored.
+ \param inputVector The byte-aligned input vector containing phase data (must be on the interval (-bound,bound] )
+ \param bound The interval that the input phase data is in, which is used to modulo the differentiation
+ \param saveValue A pointer to a float which contains the phase value of the sample before the first input sample.
+ \param num_points The number of real values in the input vector.
+*/
+static inline void volk_32f_s32f_32f_fm_detect_32f_generic(float* outputVector, const float* inputVector, const float bound, float* saveValue, unsigned int num_points){
+ if (num_points < 1) {
+ return;
+ }
+ unsigned int number = 0;
+ float* outPtr = outputVector;
+ const float* inPtr = inputVector;
+
+ // Do the first 1 by hand since we're going in from the saveValue:
+ *outPtr = *inPtr - *saveValue;
+ if (*outPtr > bound) *outPtr -= 2*bound;
+ if (*outPtr < -bound) *outPtr += 2*bound;
+ inPtr++;
+ outPtr++;
+
+ for (number = 1; number < num_points; number++) {
+ *outPtr = *(inPtr) - *(inPtr-1);
+ if (*outPtr > bound) *outPtr -= 2*bound;
+ if (*outPtr < -bound) *outPtr += 2*bound;
+ inPtr++;
+ outPtr++;
+ }
+
+ *saveValue = inputVector[num_points-1];
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_32f_s32f_32f_fm_detect_32f_a_H */
diff --git a/volk/kernels/volk/volk_32f_s32f_calc_spectral_noise_floor_32f.h b/volk/kernels/volk/volk_32f_s32f_calc_spectral_noise_floor_32f.h
new file mode 100644
index 000000000..bf05a882d
--- /dev/null
+++ b/volk/kernels/volk/volk_32f_s32f_calc_spectral_noise_floor_32f.h
@@ -0,0 +1,168 @@
+#ifndef INCLUDED_volk_32f_s32f_calc_spectral_noise_floor_32f_a_H
+#define INCLUDED_volk_32f_s32f_calc_spectral_noise_floor_32f_a_H
+
+#include <volk/volk_common.h>
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+/*!
+ \brief Calculates the spectral noise floor of an input power spectrum
+
+ Calculates the spectral noise floor of an input power spectrum by determining the mean of the input power spectrum, then recalculating the mean excluding any power spectrum values that exceed the mean by the spectralExclusionValue (in dB). Provides a rough estimation of the signal noise floor.
+
+ \param realDataPoints The input power spectrum
+ \param num_points The number of data points in the input power spectrum vector
+ \param spectralExclusionValue The number of dB above the noise floor that a data point must be to be excluded from the noise floor calculation - default value is 20
+ \param noiseFloorAmplitude The noise floor of the input spectrum, in dB
+*/
+static inline void volk_32f_s32f_calc_spectral_noise_floor_32f_a_sse(float* noiseFloorAmplitude, const float* realDataPoints, const float spectralExclusionValue, const unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+
+ const float* dataPointsPtr = realDataPoints;
+ __VOLK_ATTR_ALIGNED(16) float avgPointsVector[4];
+
+ __m128 dataPointsVal;
+ __m128 avgPointsVal = _mm_setzero_ps();
+ // Calculate the sum (for mean) for all points
+ for(; number < quarterPoints; number++){
+
+ dataPointsVal = _mm_load_ps(dataPointsPtr);
+
+ dataPointsPtr += 4;
+
+ avgPointsVal = _mm_add_ps(avgPointsVal, dataPointsVal);
+ }
+
+ _mm_store_ps(avgPointsVector, avgPointsVal);
+
+ float sumMean = 0.0;
+ sumMean += avgPointsVector[0];
+ sumMean += avgPointsVector[1];
+ sumMean += avgPointsVector[2];
+ sumMean += avgPointsVector[3];
+
+ number = quarterPoints * 4;
+ for(;number < num_points; number++){
+ sumMean += realDataPoints[number];
+ }
+
+ // calculate the spectral mean
+ // +20 because for the comparison below we only want to throw out bins
+ // that are significantly higher (and would, thus, affect the mean more
+ const float meanAmplitude = (sumMean / ((float)num_points)) + spectralExclusionValue;
+
+ dataPointsPtr = realDataPoints; // Reset the dataPointsPtr
+ __m128 vMeanAmplitudeVector = _mm_set_ps1(meanAmplitude);
+ __m128 vOnesVector = _mm_set_ps1(1.0);
+ __m128 vValidBinCount = _mm_setzero_ps();
+ avgPointsVal = _mm_setzero_ps();
+ __m128 compareMask;
+ number = 0;
+ // Calculate the sum (for mean) for any points which do NOT exceed the mean amplitude
+ for(; number < quarterPoints; number++){
+
+ dataPointsVal = _mm_load_ps(dataPointsPtr);
+
+ dataPointsPtr += 4;
+
+ // Identify which items do not exceed the mean amplitude
+ compareMask = _mm_cmple_ps(dataPointsVal, vMeanAmplitudeVector);
+
+ // Mask off the items that exceed the mean amplitude and add the avg Points that do not exceed the mean amplitude
+ avgPointsVal = _mm_add_ps(avgPointsVal, _mm_and_ps(compareMask, dataPointsVal));
+
+ // Count the number of bins which do not exceed the mean amplitude
+ vValidBinCount = _mm_add_ps(vValidBinCount, _mm_and_ps(compareMask, vOnesVector));
+ }
+
+ // Calculate the mean from the remaining data points
+ _mm_store_ps(avgPointsVector, avgPointsVal);
+
+ sumMean = 0.0;
+ sumMean += avgPointsVector[0];
+ sumMean += avgPointsVector[1];
+ sumMean += avgPointsVector[2];
+ sumMean += avgPointsVector[3];
+
+ // Calculate the number of valid bins from the remaning count
+ __VOLK_ATTR_ALIGNED(16) float validBinCountVector[4];
+ _mm_store_ps(validBinCountVector, vValidBinCount);
+
+ float validBinCount = 0;
+ validBinCount += validBinCountVector[0];
+ validBinCount += validBinCountVector[1];
+ validBinCount += validBinCountVector[2];
+ validBinCount += validBinCountVector[3];
+
+ number = quarterPoints * 4;
+ for(;number < num_points; number++){
+ if(realDataPoints[number] <= meanAmplitude){
+ sumMean += realDataPoints[number];
+ validBinCount += 1.0;
+ }
+ }
+
+ float localNoiseFloorAmplitude = 0;
+ if(validBinCount > 0.0){
+ localNoiseFloorAmplitude = sumMean / validBinCount;
+ }
+ else{
+ localNoiseFloorAmplitude = meanAmplitude; // For the odd case that all the amplitudes are equal...
+ }
+
+ *noiseFloorAmplitude = localNoiseFloorAmplitude;
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Calculates the spectral noise floor of an input power spectrum
+
+ Calculates the spectral noise floor of an input power spectrum by determining the mean of the input power spectrum, then recalculating the mean excluding any power spectrum values that exceed the mean by the spectralExclusionValue (in dB). Provides a rough estimation of the signal noise floor.
+
+ \param realDataPoints The input power spectrum
+ \param num_points The number of data points in the input power spectrum vector
+ \param spectralExclusionValue The number of dB above the noise floor that a data point must be to be excluded from the noise floor calculation - default value is 20
+ \param noiseFloorAmplitude The noise floor of the input spectrum, in dB
+*/
+static inline void volk_32f_s32f_calc_spectral_noise_floor_32f_generic(float* noiseFloorAmplitude, const float* realDataPoints, const float spectralExclusionValue, const unsigned int num_points){
+ float sumMean = 0.0;
+ unsigned int number;
+ // find the sum (for mean), etc
+ for(number = 0; number < num_points; number++){
+ // sum (for mean)
+ sumMean += realDataPoints[number];
+ }
+
+ // calculate the spectral mean
+ // +20 because for the comparison below we only want to throw out bins
+ // that are significantly higher (and would, thus, affect the mean more)
+ const float meanAmplitude = (sumMean / num_points) + spectralExclusionValue;
+
+ // now throw out any bins higher than the mean
+ sumMean = 0.0;
+ unsigned int newNumDataPoints = num_points;
+ for(number = 0; number < num_points; number++){
+ if (realDataPoints[number] <= meanAmplitude)
+ sumMean += realDataPoints[number];
+ else
+ newNumDataPoints--;
+ }
+
+ float localNoiseFloorAmplitude = 0.0;
+ if (newNumDataPoints == 0) // in the odd case that all
+ localNoiseFloorAmplitude = meanAmplitude; // amplitudes are equal!
+ else
+ localNoiseFloorAmplitude = sumMean / ((float)newNumDataPoints);
+
+ *noiseFloorAmplitude = localNoiseFloorAmplitude;
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_32f_s32f_calc_spectral_noise_floor_32f_a_H */
diff --git a/volk/kernels/volk/volk_32f_s32f_convert_16i.h b/volk/kernels/volk/volk_32f_s32f_convert_16i.h
new file mode 100644
index 000000000..9fd758655
--- /dev/null
+++ b/volk/kernels/volk/volk_32f_s32f_convert_16i.h
@@ -0,0 +1,302 @@
+#ifndef INCLUDED_volk_32f_s32f_convert_16i_u_H
+#define INCLUDED_volk_32f_s32f_convert_16i_u_H
+
+#include <inttypes.h>
+#include <stdio.h>
+#include <math.h>
+
+#ifdef LV_HAVE_SSE2
+#include <emmintrin.h>
+ /*!
+ \brief Multiplies each point in the input buffer by the scalar value, then converts the result into a 16 bit integer value
+ \param inputVector The floating point input data buffer
+ \param outputVector The 16 bit output data buffer
+ \param scalar The value multiplied against each point in the input buffer
+ \param num_points The number of data values to be converted
+ \note Input buffer does NOT need to be properly aligned
+ */
+static inline void volk_32f_s32f_convert_16i_u_sse2(int16_t* outputVector, const float* inputVector, const float scalar, unsigned int num_points){
+ unsigned int number = 0;
+
+ const unsigned int eighthPoints = num_points / 8;
+
+ const float* inputVectorPtr = (const float*)inputVector;
+ int16_t* outputVectorPtr = outputVector;
+
+ float min_val = -32768;
+ float max_val = 32767;
+ float r;
+
+ __m128 vScalar = _mm_set_ps1(scalar);
+ __m128 inputVal1, inputVal2;
+ __m128i intInputVal1, intInputVal2;
+ __m128 ret1, ret2;
+ __m128 vmin_val = _mm_set_ps1(min_val);
+ __m128 vmax_val = _mm_set_ps1(max_val);
+
+ for(;number < eighthPoints; number++){
+ inputVal1 = _mm_loadu_ps(inputVectorPtr); inputVectorPtr += 4;
+ inputVal2 = _mm_loadu_ps(inputVectorPtr); inputVectorPtr += 4;
+
+ // Scale and clip
+ ret1 = _mm_max_ps(_mm_min_ps(_mm_mul_ps(inputVal1, vScalar), vmax_val), vmin_val);
+ ret2 = _mm_max_ps(_mm_min_ps(_mm_mul_ps(inputVal2, vScalar), vmax_val), vmin_val);
+
+ intInputVal1 = _mm_cvtps_epi32(ret1);
+ intInputVal2 = _mm_cvtps_epi32(ret2);
+
+ intInputVal1 = _mm_packs_epi32(intInputVal1, intInputVal2);
+
+ _mm_storeu_si128((__m128i*)outputVectorPtr, intInputVal1);
+ outputVectorPtr += 8;
+ }
+
+ number = eighthPoints * 8;
+ for(; number < num_points; number++){
+ r = inputVector[number] * scalar;
+ if(r > max_val)
+ r = max_val;
+ else if(r < min_val)
+ r = min_val;
+ outputVector[number] = (int16_t)rintf(r);
+ }
+}
+#endif /* LV_HAVE_SSE2 */
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+ /*!
+ \brief Multiplies each point in the input buffer by the scalar value, then converts the result into a 16 bit integer value
+ \param inputVector The floating point input data buffer
+ \param outputVector The 16 bit output data buffer
+ \param scalar The value multiplied against each point in the input buffer
+ \param num_points The number of data values to be converted
+ \note Input buffer does NOT need to be properly aligned
+ */
+static inline void volk_32f_s32f_convert_16i_u_sse(int16_t* outputVector, const float* inputVector, const float scalar, unsigned int num_points){
+ unsigned int number = 0;
+
+ const unsigned int quarterPoints = num_points / 4;
+
+ const float* inputVectorPtr = (const float*)inputVector;
+ int16_t* outputVectorPtr = outputVector;
+
+ float min_val = -32768;
+ float max_val = 32767;
+ float r;
+
+ __m128 vScalar = _mm_set_ps1(scalar);
+ __m128 ret;
+ __m128 vmin_val = _mm_set_ps1(min_val);
+ __m128 vmax_val = _mm_set_ps1(max_val);
+
+ __VOLK_ATTR_ALIGNED(16) float outputFloatBuffer[4];
+
+ for(;number < quarterPoints; number++){
+ ret = _mm_loadu_ps(inputVectorPtr);
+ inputVectorPtr += 4;
+
+ // Scale and clip
+ ret = _mm_max_ps(_mm_min_ps(_mm_mul_ps(ret, vScalar), vmax_val), vmin_val);
+
+ _mm_store_ps(outputFloatBuffer, ret);
+ *outputVectorPtr++ = (int16_t)rintf(outputFloatBuffer[0]);
+ *outputVectorPtr++ = (int16_t)rintf(outputFloatBuffer[1]);
+ *outputVectorPtr++ = (int16_t)rintf(outputFloatBuffer[2]);
+ *outputVectorPtr++ = (int16_t)rintf(outputFloatBuffer[3]);
+ }
+
+ number = quarterPoints * 4;
+ for(; number < num_points; number++){
+ r = inputVector[number] * scalar;
+ if(r > max_val)
+ r = max_val;
+ else if(r < min_val)
+ r = min_val;
+ outputVector[number] = (int16_t)rintf(r);
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+ /*!
+ \brief Multiplies each point in the input buffer by the scalar value, then converts the result into a 16 bit integer value
+ \param inputVector The floating point input data buffer
+ \param outputVector The 16 bit output data buffer
+ \param scalar The value multiplied against each point in the input buffer
+ \param num_points The number of data values to be converted
+ \note Input buffer does NOT need to be properly aligned
+ */
+static inline void volk_32f_s32f_convert_16i_generic(int16_t* outputVector, const float* inputVector, const float scalar, unsigned int num_points){
+ int16_t* outputVectorPtr = outputVector;
+ const float* inputVectorPtr = inputVector;
+ unsigned int number = 0;
+ float min_val = -32768;
+ float max_val = 32767;
+ float r;
+
+ for(number = 0; number < num_points; number++){
+ r = *inputVectorPtr++ * scalar;
+ if(r > max_val)
+ r = max_val;
+ else if(r < min_val)
+ r = min_val;
+ *outputVectorPtr++ = (int16_t)rintf(r);
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_32f_s32f_convert_16i_u_H */
+#ifndef INCLUDED_volk_32f_s32f_convert_16i_a_H
+#define INCLUDED_volk_32f_s32f_convert_16i_a_H
+
+#include <volk/volk_common.h>
+#include <inttypes.h>
+#include <stdio.h>
+#include <math.h>
+
+#ifdef LV_HAVE_SSE2
+#include <emmintrin.h>
+ /*!
+ \brief Multiplies each point in the input buffer by the scalar value, then converts the result into a 16 bit integer value
+ \param inputVector The floating point input data buffer
+ \param outputVector The 16 bit output data buffer
+ \param scalar The value multiplied against each point in the input buffer
+ \param num_points The number of data values to be converted
+ */
+static inline void volk_32f_s32f_convert_16i_a_sse2(int16_t* outputVector, const float* inputVector, const float scalar, unsigned int num_points){
+ unsigned int number = 0;
+
+ const unsigned int eighthPoints = num_points / 8;
+
+ const float* inputVectorPtr = (const float*)inputVector;
+ int16_t* outputVectorPtr = outputVector;
+
+ float min_val = -32768;
+ float max_val = 32767;
+ float r;
+
+ __m128 vScalar = _mm_set_ps1(scalar);
+ __m128 inputVal1, inputVal2;
+ __m128i intInputVal1, intInputVal2;
+ __m128 ret1, ret2;
+ __m128 vmin_val = _mm_set_ps1(min_val);
+ __m128 vmax_val = _mm_set_ps1(max_val);
+
+ for(;number < eighthPoints; number++){
+ inputVal1 = _mm_load_ps(inputVectorPtr); inputVectorPtr += 4;
+ inputVal2 = _mm_load_ps(inputVectorPtr); inputVectorPtr += 4;
+
+ // Scale and clip
+ ret1 = _mm_max_ps(_mm_min_ps(_mm_mul_ps(inputVal1, vScalar), vmax_val), vmin_val);
+ ret2 = _mm_max_ps(_mm_min_ps(_mm_mul_ps(inputVal2, vScalar), vmax_val), vmin_val);
+
+ intInputVal1 = _mm_cvtps_epi32(ret1);
+ intInputVal2 = _mm_cvtps_epi32(ret2);
+
+ intInputVal1 = _mm_packs_epi32(intInputVal1, intInputVal2);
+
+ _mm_store_si128((__m128i*)outputVectorPtr, intInputVal1);
+ outputVectorPtr += 8;
+ }
+
+ number = eighthPoints * 8;
+ for(; number < num_points; number++){
+ r = inputVector[number] * scalar;
+ if(r > max_val)
+ r = max_val;
+ else if(r < min_val)
+ r = min_val;
+ outputVector[number] = (int16_t)rintf(r);
+ }
+}
+#endif /* LV_HAVE_SSE2 */
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+ /*!
+ \brief Multiplies each point in the input buffer by the scalar value, then converts the result into a 16 bit integer value
+ \param inputVector The floating point input data buffer
+ \param outputVector The 16 bit output data buffer
+ \param scalar The value multiplied against each point in the input buffer
+ \param num_points The number of data values to be converted
+ */
+static inline void volk_32f_s32f_convert_16i_a_sse(int16_t* outputVector, const float* inputVector, const float scalar, unsigned int num_points){
+ unsigned int number = 0;
+
+ const unsigned int quarterPoints = num_points / 4;
+
+ const float* inputVectorPtr = (const float*)inputVector;
+ int16_t* outputVectorPtr = outputVector;
+
+ float min_val = -32768;
+ float max_val = 32767;
+ float r;
+
+ __m128 vScalar = _mm_set_ps1(scalar);
+ __m128 ret;
+ __m128 vmin_val = _mm_set_ps1(min_val);
+ __m128 vmax_val = _mm_set_ps1(max_val);
+
+ __VOLK_ATTR_ALIGNED(16) float outputFloatBuffer[4];
+
+ for(;number < quarterPoints; number++){
+ ret = _mm_load_ps(inputVectorPtr);
+ inputVectorPtr += 4;
+
+ // Scale and clip
+ ret = _mm_max_ps(_mm_min_ps(_mm_mul_ps(ret, vScalar), vmax_val), vmin_val);
+
+ _mm_store_ps(outputFloatBuffer, ret);
+ *outputVectorPtr++ = (int16_t)rintf(outputFloatBuffer[0]);
+ *outputVectorPtr++ = (int16_t)rintf(outputFloatBuffer[1]);
+ *outputVectorPtr++ = (int16_t)rintf(outputFloatBuffer[2]);
+ *outputVectorPtr++ = (int16_t)rintf(outputFloatBuffer[3]);
+ }
+
+ number = quarterPoints * 4;
+ for(; number < num_points; number++){
+ r = inputVector[number] * scalar;
+ if(r > max_val)
+ r = max_val;
+ else if(r < min_val)
+ r = min_val;
+ outputVector[number] = (int16_t)rintf(r);
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+ /*!
+ \brief Multiplies each point in the input buffer by the scalar value, then converts the result into a 16 bit integer value
+ \param inputVector The floating point input data buffer
+ \param outputVector The 16 bit output data buffer
+ \param scalar The value multiplied against each point in the input buffer
+ \param num_points The number of data values to be converted
+ */
+static inline void volk_32f_s32f_convert_16i_a_generic(int16_t* outputVector, const float* inputVector, const float scalar, unsigned int num_points){
+ int16_t* outputVectorPtr = outputVector;
+ const float* inputVectorPtr = inputVector;
+ unsigned int number = 0;
+ float min_val = -32768;
+ float max_val = 32767;
+ float r;
+
+ for(number = 0; number < num_points; number++){
+ r = *inputVectorPtr++ * scalar;
+ if(r < min_val)
+ r = min_val;
+ else if(r > max_val)
+ r = max_val;
+ *outputVectorPtr++ = (int16_t)rintf(r);
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_32f_s32f_convert_16i_a_H */
diff --git a/volk/kernels/volk/volk_32f_s32f_convert_32i.h b/volk/kernels/volk/volk_32f_s32f_convert_32i.h
new file mode 100644
index 000000000..1a46093ee
--- /dev/null
+++ b/volk/kernels/volk/volk_32f_s32f_convert_32i.h
@@ -0,0 +1,331 @@
+#ifndef INCLUDED_volk_32f_s32f_convert_32i_u_H
+#define INCLUDED_volk_32f_s32f_convert_32i_u_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE2
+#include <emmintrin.h>
+ /*!
+ \brief Multiplies each point in the input buffer by the scalar value, then converts the result into a 32 bit integer value
+ \param inputVector The floating point input data buffer
+ \param outputVector The 32 bit output data buffer
+ \param scalar The value multiplied against each point in the input buffer
+ \param num_points The number of data values to be converted
+ \note Input buffer does NOT need to be properly aligned
+ */
+static inline void volk_32f_s32f_convert_32i_u_sse2(int32_t* outputVector, const float* inputVector, const float scalar, unsigned int num_points){
+ unsigned int number = 0;
+
+ const unsigned int quarterPoints = num_points / 4;
+
+ const float* inputVectorPtr = (const float*)inputVector;
+ int32_t* outputVectorPtr = outputVector;
+
+ float min_val = -2147483647;
+ float max_val = 2147483647;
+ float r;
+
+ __m128 vScalar = _mm_set_ps1(scalar);
+ __m128 inputVal1;
+ __m128i intInputVal1;
+ __m128 vmin_val = _mm_set_ps1(min_val);
+ __m128 vmax_val = _mm_set_ps1(max_val);
+
+ for(;number < quarterPoints; number++){
+ inputVal1 = _mm_loadu_ps(inputVectorPtr); inputVectorPtr += 4;
+
+ inputVal1 = _mm_max_ps(_mm_min_ps(_mm_mul_ps(inputVal1, vScalar), vmax_val), vmin_val);
+ intInputVal1 = _mm_cvtps_epi32(inputVal1);
+
+ _mm_storeu_si128((__m128i*)outputVectorPtr, intInputVal1);
+ outputVectorPtr += 4;
+ }
+
+ number = quarterPoints * 4;
+ for(; number < num_points; number++){
+ r = inputVector[number] * scalar;
+ if(r > max_val)
+ r = max_val;
+ else if(r < min_val)
+ r = min_val;
+ outputVector[number] = (int32_t)(r);
+ }
+}
+#endif /* LV_HAVE_SSE2 */
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+ /*!
+ \brief Multiplies each point in the input buffer by the scalar value, then converts the result into a 32 bit integer value
+ \param inputVector The floating point input data buffer
+ \param outputVector The 32 bit output data buffer
+ \param scalar The value multiplied against each point in the input buffer
+ \param num_points The number of data values to be converted
+ \note Input buffer does NOT need to be properly aligned
+ */
+static inline void volk_32f_s32f_convert_32i_u_sse(int32_t* outputVector, const float* inputVector, const float scalar, unsigned int num_points){
+ unsigned int number = 0;
+
+ const unsigned int quarterPoints = num_points / 4;
+
+ const float* inputVectorPtr = (const float*)inputVector;
+ int32_t* outputVectorPtr = outputVector;
+
+ float min_val = -2147483647;
+ float max_val = 2147483647;
+ float r;
+
+ __m128 vScalar = _mm_set_ps1(scalar);
+ __m128 ret;
+ __m128 vmin_val = _mm_set_ps1(min_val);
+ __m128 vmax_val = _mm_set_ps1(max_val);
+
+ __VOLK_ATTR_ALIGNED(16) float outputFloatBuffer[4];
+
+ for(;number < quarterPoints; number++){
+ ret = _mm_loadu_ps(inputVectorPtr);
+ inputVectorPtr += 4;
+
+ ret = _mm_max_ps(_mm_min_ps(_mm_mul_ps(ret, vScalar), vmax_val), vmin_val);
+
+ _mm_store_ps(outputFloatBuffer, ret);
+ *outputVectorPtr++ = (int32_t)(outputFloatBuffer[0]);
+ *outputVectorPtr++ = (int32_t)(outputFloatBuffer[1]);
+ *outputVectorPtr++ = (int32_t)(outputFloatBuffer[2]);
+ *outputVectorPtr++ = (int32_t)(outputFloatBuffer[3]);
+ }
+
+ number = quarterPoints * 4;
+ for(; number < num_points; number++){
+ r = inputVector[number] * scalar;
+ if(r > max_val)
+ r = max_val;
+ else if(r < min_val)
+ r = min_val;
+ outputVector[number] = (int32_t)(r);
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+ /*!
+ \brief Multiplies each point in the input buffer by the scalar value, then converts the result into a 32 bit integer value
+ \param inputVector The floating point input data buffer
+ \param outputVector The 32 bit output data buffer
+ \param scalar The value multiplied against each point in the input buffer
+ \param num_points The number of data values to be converted
+ \note Input buffer does NOT need to be properly aligned
+ */
+static inline void volk_32f_s32f_convert_32i_generic(int32_t* outputVector, const float* inputVector, const float scalar, unsigned int num_points){
+ int32_t* outputVectorPtr = outputVector;
+ const float* inputVectorPtr = inputVector;
+ unsigned int number = 0;
+ float min_val = -2147483647;
+ float max_val = 2147483647;
+ float r;
+
+ for(number = 0; number < num_points; number++){
+ r = *inputVectorPtr++ * scalar;
+ if(r > max_val)
+ r = max_val;
+ else if(r < min_val)
+ r = min_val;
+ *outputVectorPtr++ = (int32_t)(r);
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_32f_s32f_convert_32i_u_H */
+#ifndef INCLUDED_volk_32f_s32f_convert_32i_a_H
+#define INCLUDED_volk_32f_s32f_convert_32i_a_H
+
+#include <volk/volk_common.h>
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_AVX
+#include <immintrin.h>
+ /*!
+ \brief Multiplies each point in the input buffer by the scalar value, then converts the result into a 32 bit integer value
+ \param inputVector The floating point input data buffer
+ \param outputVector The 32 bit output data buffer
+ \param scalar The value multiplied against each point in the input buffer
+ \param num_points The number of data values to be converted
+ */
+static inline void volk_32f_s32f_convert_32i_a_avx(int32_t* outputVector, const float* inputVector, const float scalar, unsigned int num_points){
+ unsigned int number = 0;
+
+ const unsigned int eighthPoints = num_points / 8;
+
+ const float* inputVectorPtr = (const float*)inputVector;
+ int32_t* outputVectorPtr = outputVector;
+
+ float min_val = -2147483647;
+ float max_val = 2147483647;
+ float r;
+
+ __m256 vScalar = _mm256_set1_ps(scalar);
+ __m256 inputVal1;
+ __m256i intInputVal1;
+ __m256 vmin_val = _mm256_set1_ps(min_val);
+ __m256 vmax_val = _mm256_set1_ps(max_val);
+
+ for(;number < eighthPoints; number++){
+ inputVal1 = _mm256_load_ps(inputVectorPtr); inputVectorPtr += 8;
+
+ inputVal1 = _mm256_max_ps(_mm256_min_ps(_mm256_mul_ps(inputVal1, vScalar), vmax_val), vmin_val);
+ intInputVal1 = _mm256_cvtps_epi32(inputVal1);
+
+ _mm256_store_si256((__m256i*)outputVectorPtr, intInputVal1);
+ outputVectorPtr += 8;
+ }
+
+ number = eighthPoints * 8;
+ for(; number < num_points; number++){
+ r = inputVector[number] * scalar;
+ if(r > max_val)
+ r = max_val;
+ else if(r < min_val)
+ r = min_val;
+ outputVector[number] = (int32_t)(r);
+ }
+}
+#endif /* LV_HAVE_AVX */
+
+#ifdef LV_HAVE_SSE2
+#include <emmintrin.h>
+ /*!
+ \brief Multiplies each point in the input buffer by the scalar value, then converts the result into a 32 bit integer value
+ \param inputVector The floating point input data buffer
+ \param outputVector The 32 bit output data buffer
+ \param scalar The value multiplied against each point in the input buffer
+ \param num_points The number of data values to be converted
+ */
+static inline void volk_32f_s32f_convert_32i_a_sse2(int32_t* outputVector, const float* inputVector, const float scalar, unsigned int num_points){
+ unsigned int number = 0;
+
+ const unsigned int quarterPoints = num_points / 4;
+
+ const float* inputVectorPtr = (const float*)inputVector;
+ int32_t* outputVectorPtr = outputVector;
+
+ float min_val = -2147483647;
+ float max_val = 2147483647;
+ float r;
+
+ __m128 vScalar = _mm_set_ps1(scalar);
+ __m128 inputVal1;
+ __m128i intInputVal1;
+ __m128 vmin_val = _mm_set_ps1(min_val);
+ __m128 vmax_val = _mm_set_ps1(max_val);
+
+ for(;number < quarterPoints; number++){
+ inputVal1 = _mm_load_ps(inputVectorPtr); inputVectorPtr += 4;
+
+ inputVal1 = _mm_max_ps(_mm_min_ps(_mm_mul_ps(inputVal1, vScalar), vmax_val), vmin_val);
+ intInputVal1 = _mm_cvtps_epi32(inputVal1);
+
+ _mm_store_si128((__m128i*)outputVectorPtr, intInputVal1);
+ outputVectorPtr += 4;
+ }
+
+ number = quarterPoints * 4;
+ for(; number < num_points; number++){
+ r = inputVector[number] * scalar;
+ if(r > max_val)
+ r = max_val;
+ else if(r < min_val)
+ r = min_val;
+ outputVector[number] = (int32_t)(r);
+ }
+}
+#endif /* LV_HAVE_SSE2 */
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+ /*!
+ \brief Multiplies each point in the input buffer by the scalar value, then converts the result into a 32 bit integer value
+ \param inputVector The floating point input data buffer
+ \param outputVector The 32 bit output data buffer
+ \param scalar The value multiplied against each point in the input buffer
+ \param num_points The number of data values to be converted
+ */
+static inline void volk_32f_s32f_convert_32i_a_sse(int32_t* outputVector, const float* inputVector, const float scalar, unsigned int num_points){
+ unsigned int number = 0;
+
+ const unsigned int quarterPoints = num_points / 4;
+
+ const float* inputVectorPtr = (const float*)inputVector;
+ int32_t* outputVectorPtr = outputVector;
+
+ float min_val = -2147483647;
+ float max_val = 2147483647;
+ float r;
+
+ __m128 vScalar = _mm_set_ps1(scalar);
+ __m128 ret;
+ __m128 vmin_val = _mm_set_ps1(min_val);
+ __m128 vmax_val = _mm_set_ps1(max_val);
+
+ __VOLK_ATTR_ALIGNED(16) float outputFloatBuffer[4];
+
+ for(;number < quarterPoints; number++){
+ ret = _mm_load_ps(inputVectorPtr);
+ inputVectorPtr += 4;
+
+ ret = _mm_max_ps(_mm_min_ps(_mm_mul_ps(ret, vScalar), vmax_val), vmin_val);
+
+ _mm_store_ps(outputFloatBuffer, ret);
+ *outputVectorPtr++ = (int32_t)(outputFloatBuffer[0]);
+ *outputVectorPtr++ = (int32_t)(outputFloatBuffer[1]);
+ *outputVectorPtr++ = (int32_t)(outputFloatBuffer[2]);
+ *outputVectorPtr++ = (int32_t)(outputFloatBuffer[3]);
+ }
+
+ number = quarterPoints * 4;
+ for(; number < num_points; number++){
+ r = inputVector[number] * scalar;
+ if(r > max_val)
+ r = max_val;
+ else if(r < min_val)
+ r = min_val;
+ outputVector[number] = (int32_t)(r);
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+ /*!
+ \brief Multiplies each point in the input buffer by the scalar value, then converts the result into a 32 bit integer value
+ \param inputVector The floating point input data buffer
+ \param outputVector The 32 bit output data buffer
+ \param scalar The value multiplied against each point in the input buffer
+ \param num_points The number of data values to be converted
+ */
+static inline void volk_32f_s32f_convert_32i_a_generic(int32_t* outputVector, const float* inputVector, const float scalar, unsigned int num_points){
+ int32_t* outputVectorPtr = outputVector;
+ const float* inputVectorPtr = inputVector;
+ unsigned int number = 0;
+ float min_val = -2147483647;
+ float max_val = 2147483647;
+ float r;
+
+ for(number = 0; number < num_points; number++){
+ r = *inputVectorPtr++ * scalar;
+ if(r > max_val)
+ r = max_val;
+ else if(r < min_val)
+ r = min_val;
+ *outputVectorPtr++ = (int32_t)(r);
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_32f_s32f_convert_32i_a_H */
diff --git a/volk/kernels/volk/volk_32f_s32f_convert_8i.h b/volk/kernels/volk/volk_32f_s32f_convert_8i.h
new file mode 100644
index 000000000..b45150522
--- /dev/null
+++ b/volk/kernels/volk/volk_32f_s32f_convert_8i.h
@@ -0,0 +1,312 @@
+#ifndef INCLUDED_volk_32f_s32f_convert_8i_u_H
+#define INCLUDED_volk_32f_s32f_convert_8i_u_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE2
+#include <emmintrin.h>
+ /*!
+ \brief Multiplies each point in the input buffer by the scalar value, then converts the result into a 8 bit integer value
+ \param inputVector The floating point input data buffer
+ \param outputVector The 8 bit output data buffer
+ \param scalar The value multiplied against each point in the input buffer
+ \param num_points The number of data values to be converted
+ \note Input buffer does NOT need to be properly aligned
+ */
+static inline void volk_32f_s32f_convert_8i_u_sse2(int8_t* outputVector, const float* inputVector, const float scalar, unsigned int num_points){
+ unsigned int number = 0;
+
+ const unsigned int sixteenthPoints = num_points / 16;
+
+ const float* inputVectorPtr = (const float*)inputVector;
+ int8_t* outputVectorPtr = outputVector;
+
+ float min_val = -128;
+ float max_val = 127;
+ float r;
+
+ __m128 vScalar = _mm_set_ps1(scalar);
+ __m128 inputVal1, inputVal2, inputVal3, inputVal4;
+ __m128i intInputVal1, intInputVal2, intInputVal3, intInputVal4;
+ __m128 vmin_val = _mm_set_ps1(min_val);
+ __m128 vmax_val = _mm_set_ps1(max_val);
+
+ for(;number < sixteenthPoints; number++){
+ inputVal1 = _mm_loadu_ps(inputVectorPtr); inputVectorPtr += 4;
+ inputVal2 = _mm_loadu_ps(inputVectorPtr); inputVectorPtr += 4;
+ inputVal3 = _mm_loadu_ps(inputVectorPtr); inputVectorPtr += 4;
+ inputVal4 = _mm_loadu_ps(inputVectorPtr); inputVectorPtr += 4;
+
+ inputVal1 = _mm_max_ps(_mm_min_ps(_mm_mul_ps(inputVal1, vScalar), vmax_val), vmin_val);
+ inputVal2 = _mm_max_ps(_mm_min_ps(_mm_mul_ps(inputVal2, vScalar), vmax_val), vmin_val);
+ inputVal3 = _mm_max_ps(_mm_min_ps(_mm_mul_ps(inputVal3, vScalar), vmax_val), vmin_val);
+ inputVal4 = _mm_max_ps(_mm_min_ps(_mm_mul_ps(inputVal4, vScalar), vmax_val), vmin_val);
+
+ intInputVal1 = _mm_cvtps_epi32(inputVal1);
+ intInputVal2 = _mm_cvtps_epi32(inputVal2);
+ intInputVal3 = _mm_cvtps_epi32(inputVal3);
+ intInputVal4 = _mm_cvtps_epi32(inputVal4);
+
+ intInputVal1 = _mm_packs_epi32(intInputVal1, intInputVal2);
+ intInputVal3 = _mm_packs_epi32(intInputVal3, intInputVal4);
+
+ intInputVal1 = _mm_packs_epi16(intInputVal1, intInputVal3);
+
+ _mm_storeu_si128((__m128i*)outputVectorPtr, intInputVal1);
+ outputVectorPtr += 16;
+ }
+
+ number = sixteenthPoints * 16;
+ for(; number < num_points; number++){
+ r = inputVector[number] * scalar;
+ if(r > max_val)
+ r = max_val;
+ else if(r < min_val)
+ r = min_val;
+ outputVector[number] = (int16_t)(r);
+ }
+}
+#endif /* LV_HAVE_SSE2 */
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+ /*!
+ \brief Multiplies each point in the input buffer by the scalar value, then converts the result into a 8 bit integer value
+ \param inputVector The floating point input data buffer
+ \param outputVector The 8 bit output data buffer
+ \param scalar The value multiplied against each point in the input buffer
+ \param num_points The number of data values to be converted
+ \note Input buffer does NOT need to be properly aligned
+ */
+static inline void volk_32f_s32f_convert_8i_u_sse(int8_t* outputVector, const float* inputVector, const float scalar, unsigned int num_points){
+ unsigned int number = 0;
+
+ const unsigned int quarterPoints = num_points / 4;
+
+ const float* inputVectorPtr = (const float*)inputVector;
+ int8_t* outputVectorPtr = outputVector;
+
+ float min_val = -128;
+ float max_val = 127;
+ float r;
+
+ __m128 vScalar = _mm_set_ps1(scalar);
+ __m128 ret;
+ __m128 vmin_val = _mm_set_ps1(min_val);
+ __m128 vmax_val = _mm_set_ps1(max_val);
+
+ __VOLK_ATTR_ALIGNED(16) float outputFloatBuffer[4];
+
+ for(;number < quarterPoints; number++){
+ ret = _mm_loadu_ps(inputVectorPtr);
+ inputVectorPtr += 4;
+
+ ret = _mm_max_ps(_mm_min_ps(_mm_mul_ps(ret, vScalar), vmax_val), vmin_val);
+
+ _mm_store_ps(outputFloatBuffer, ret);
+ *outputVectorPtr++ = (int8_t)(outputFloatBuffer[0]);
+ *outputVectorPtr++ = (int8_t)(outputFloatBuffer[1]);
+ *outputVectorPtr++ = (int8_t)(outputFloatBuffer[2]);
+ *outputVectorPtr++ = (int8_t)(outputFloatBuffer[3]);
+ }
+
+ number = quarterPoints * 4;
+ for(; number < num_points; number++){
+ r = inputVector[number] * scalar;
+ if(r > max_val)
+ r = max_val;
+ else if(r < min_val)
+ r = min_val;
+ outputVector[number] = (int16_t)(r);
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+ /*!
+ \brief Multiplies each point in the input buffer by the scalar value, then converts the result into a 8 bit integer value
+ \param inputVector The floating point input data buffer
+ \param outputVector The 8 bit output data buffer
+ \param scalar The value multiplied against each point in the input buffer
+ \param num_points The number of data values to be converted
+ \note Input buffer does NOT need to be properly aligned
+ */
+static inline void volk_32f_s32f_convert_8i_generic(int8_t* outputVector, const float* inputVector, const float scalar, unsigned int num_points){
+ int8_t* outputVectorPtr = outputVector;
+ const float* inputVectorPtr = inputVector;
+ unsigned int number = 0;
+ float min_val = -128;
+ float max_val = 127;
+ float r;
+
+ for(number = 0; number < num_points; number++){
+ r = *inputVectorPtr++ * scalar;
+ if(r > max_val)
+ r = max_val;
+ else if(r < min_val)
+ r = min_val;
+ *outputVectorPtr++ = (int16_t)(r);
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_32f_s32f_convert_8i_u_H */
+#ifndef INCLUDED_volk_32f_s32f_convert_8i_a_H
+#define INCLUDED_volk_32f_s32f_convert_8i_a_H
+
+#include <volk/volk_common.h>
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE2
+#include <emmintrin.h>
+ /*!
+ \brief Multiplies each point in the input buffer by the scalar value, then converts the result into a 8 bit integer value
+ \param inputVector The floating point input data buffer
+ \param outputVector The 8 bit output data buffer
+ \param scalar The value multiplied against each point in the input buffer
+ \param num_points The number of data values to be converted
+ */
+static inline void volk_32f_s32f_convert_8i_a_sse2(int8_t* outputVector, const float* inputVector, const float scalar, unsigned int num_points){
+ unsigned int number = 0;
+
+ const unsigned int sixteenthPoints = num_points / 16;
+
+ const float* inputVectorPtr = (const float*)inputVector;
+ int8_t* outputVectorPtr = outputVector;
+
+ float min_val = -128;
+ float max_val = 127;
+ float r;
+
+ __m128 vScalar = _mm_set_ps1(scalar);
+ __m128 inputVal1, inputVal2, inputVal3, inputVal4;
+ __m128i intInputVal1, intInputVal2, intInputVal3, intInputVal4;
+ __m128 vmin_val = _mm_set_ps1(min_val);
+ __m128 vmax_val = _mm_set_ps1(max_val);
+
+ for(;number < sixteenthPoints; number++){
+ inputVal1 = _mm_load_ps(inputVectorPtr); inputVectorPtr += 4;
+ inputVal2 = _mm_load_ps(inputVectorPtr); inputVectorPtr += 4;
+ inputVal3 = _mm_load_ps(inputVectorPtr); inputVectorPtr += 4;
+ inputVal4 = _mm_load_ps(inputVectorPtr); inputVectorPtr += 4;
+
+ inputVal1 = _mm_max_ps(_mm_min_ps(_mm_mul_ps(inputVal1, vScalar), vmax_val), vmin_val);
+ inputVal2 = _mm_max_ps(_mm_min_ps(_mm_mul_ps(inputVal2, vScalar), vmax_val), vmin_val);
+ inputVal3 = _mm_max_ps(_mm_min_ps(_mm_mul_ps(inputVal3, vScalar), vmax_val), vmin_val);
+ inputVal4 = _mm_max_ps(_mm_min_ps(_mm_mul_ps(inputVal4, vScalar), vmax_val), vmin_val);
+
+ intInputVal1 = _mm_cvtps_epi32(inputVal1);
+ intInputVal2 = _mm_cvtps_epi32(inputVal2);
+ intInputVal3 = _mm_cvtps_epi32(inputVal3);
+ intInputVal4 = _mm_cvtps_epi32(inputVal4);
+
+ intInputVal1 = _mm_packs_epi32(intInputVal1, intInputVal2);
+ intInputVal3 = _mm_packs_epi32(intInputVal3, intInputVal4);
+
+ intInputVal1 = _mm_packs_epi16(intInputVal1, intInputVal3);
+
+ _mm_store_si128((__m128i*)outputVectorPtr, intInputVal1);
+ outputVectorPtr += 16;
+ }
+
+ number = sixteenthPoints * 16;
+ for(; number < num_points; number++){
+ r = inputVector[number] * scalar;
+ if(r > max_val)
+ r = max_val;
+ else if(r < min_val)
+ r = min_val;
+ outputVector[number] = (int8_t)(r);
+ }
+}
+#endif /* LV_HAVE_SSE2 */
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+ /*!
+ \brief Multiplies each point in the input buffer by the scalar value, then converts the result into a 8 bit integer value
+ \param inputVector The floating point input data buffer
+ \param outputVector The 8 bit output data buffer
+ \param scalar The value multiplied against each point in the input buffer
+ \param num_points The number of data values to be converted
+ */
+static inline void volk_32f_s32f_convert_8i_a_sse(int8_t* outputVector, const float* inputVector, const float scalar, unsigned int num_points){
+ unsigned int number = 0;
+
+ const unsigned int quarterPoints = num_points / 4;
+
+ const float* inputVectorPtr = (const float*)inputVector;
+
+ float min_val = -128;
+ float max_val = 127;
+ float r;
+
+ int8_t* outputVectorPtr = outputVector;
+ __m128 vScalar = _mm_set_ps1(scalar);
+ __m128 ret;
+ __m128 vmin_val = _mm_set_ps1(min_val);
+ __m128 vmax_val = _mm_set_ps1(max_val);
+
+ __VOLK_ATTR_ALIGNED(16) float outputFloatBuffer[4];
+
+ for(;number < quarterPoints; number++){
+ ret = _mm_load_ps(inputVectorPtr);
+ inputVectorPtr += 4;
+
+ ret = _mm_max_ps(_mm_min_ps(_mm_mul_ps(ret, vScalar), vmax_val), vmin_val);
+
+ _mm_store_ps(outputFloatBuffer, ret);
+ *outputVectorPtr++ = (int8_t)(outputFloatBuffer[0]);
+ *outputVectorPtr++ = (int8_t)(outputFloatBuffer[1]);
+ *outputVectorPtr++ = (int8_t)(outputFloatBuffer[2]);
+ *outputVectorPtr++ = (int8_t)(outputFloatBuffer[3]);
+ }
+
+ number = quarterPoints * 4;
+ for(; number < num_points; number++){
+ r = inputVector[number] * scalar;
+ if(r > max_val)
+ r = max_val;
+ else if(r < min_val)
+ r = min_val;
+ outputVector[number] = (int8_t)(r);
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+ /*!
+ \brief Multiplies each point in the input buffer by the scalar value, then converts the result into a 8 bit integer value
+ \param inputVector The floating point input data buffer
+ \param outputVector The 8 bit output data buffer
+ \param scalar The value multiplied against each point in the input buffer
+ \param num_points The number of data values to be converted
+ */
+static inline void volk_32f_s32f_convert_8i_a_generic(int8_t* outputVector, const float* inputVector, const float scalar, unsigned int num_points){
+ int8_t* outputVectorPtr = outputVector;
+ const float* inputVectorPtr = inputVector;
+ unsigned int number = 0;
+ float min_val = -128;
+ float max_val = 127;
+ float r;
+
+ for(number = 0; number < num_points; number++){
+ r = *inputVectorPtr++ * scalar;
+ if(r > max_val)
+ r = max_val;
+ else if(r < min_val)
+ r = min_val;
+ *outputVectorPtr++ = (int8_t)(r);
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_32f_s32f_convert_8i_a_H */
diff --git a/volk/kernels/volk/volk_32f_s32f_multiply_32f.h b/volk/kernels/volk/volk_32f_s32f_multiply_32f.h
new file mode 100644
index 000000000..2dd86a17c
--- /dev/null
+++ b/volk/kernels/volk/volk_32f_s32f_multiply_32f.h
@@ -0,0 +1,221 @@
+#ifndef INCLUDED_volk_32f_s32f_multiply_32f_u_H
+#define INCLUDED_volk_32f_s32f_multiply_32f_u_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+/*!
+ \brief Scalar float multiply
+ \param cVector The vector where the results will be stored
+ \param aVector One of the vectors to be multiplied
+ \param scalar the scalar value
+ \param num_points The number of values in aVector and bVector to be multiplied together and stored into cVector
+*/
+static inline void volk_32f_s32f_multiply_32f_u_sse(float* cVector, const float* aVector, const float scalar, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+
+ float* cPtr = cVector;
+ const float* aPtr = aVector;
+
+ __m128 aVal, bVal, cVal;
+ bVal = _mm_set_ps1(scalar);
+ for(;number < quarterPoints; number++){
+
+ aVal = _mm_loadu_ps(aPtr);
+
+ cVal = _mm_mul_ps(aVal, bVal);
+
+ _mm_storeu_ps(cPtr,cVal); // Store the results back into the C container
+
+ aPtr += 4;
+ cPtr += 4;
+ }
+
+ number = quarterPoints * 4;
+ for(;number < num_points; number++){
+ *cPtr++ = (*aPtr++) * scalar;
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_AVX
+#include <immintrin.h>
+/*!
+ \brief Scalar float multiply
+ \param cVector The vector where the results will be stored
+ \param aVector One of the vectors to be multiplied
+ \param scalar the scalar value
+ \param num_points The number of values in aVector and bVector to be multiplied together and stored into cVector
+*/
+static inline void volk_32f_s32f_multiply_32f_u_avx(float* cVector, const float* aVector, const float scalar, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int eighthPoints = num_points / 8;
+
+ float* cPtr = cVector;
+ const float* aPtr = aVector;
+
+ __m256 aVal, bVal, cVal;
+ bVal = _mm256_set1_ps(scalar);
+ for(;number < eighthPoints; number++){
+
+ aVal = _mm256_loadu_ps(aPtr);
+
+ cVal = _mm256_mul_ps(aVal, bVal);
+
+ _mm256_storeu_ps(cPtr,cVal); // Store the results back into the C container
+
+ aPtr += 8;
+ cPtr += 8;
+ }
+
+ number = eighthPoints * 8;
+ for(;number < num_points; number++){
+ *cPtr++ = (*aPtr++) * scalar;
+ }
+}
+#endif /* LV_HAVE_AVX */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Scalar float multiply
+ \param cVector The vector where the results will be stored
+ \param aVector One of the vectors to be multiplied
+ \param scalar the scalar value
+ \param num_points The number of values in aVector and bVector to be multiplied together and stored into cVector
+*/
+static inline void volk_32f_s32f_multiply_32f_generic(float* cVector, const float* aVector, const float scalar, unsigned int num_points){
+ unsigned int number = 0;
+ const float* inputPtr = aVector;
+ float* outputPtr = cVector;
+ for(number = 0; number < num_points; number++){
+ *outputPtr = (*inputPtr) * scalar;
+ inputPtr++;
+ outputPtr++;
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+#endif /* INCLUDED_volk_32f_s32f_multiply_32f_u_H */
+#ifndef INCLUDED_volk_32f_s32f_multiply_32f_a_H
+#define INCLUDED_volk_32f_s32f_multiply_32f_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+/*!
+ \brief Scalar float multiply
+ \param cVector The vector where the results will be stored
+ \param aVector One of the vectors to be multiplied
+ \param scalar the scalar value
+ \param num_points The number of values in aVector and bVector to be multiplied together and stored into cVector
+*/
+static inline void volk_32f_s32f_multiply_32f_a_sse(float* cVector, const float* aVector, const float scalar, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+
+ float* cPtr = cVector;
+ const float* aPtr = aVector;
+
+ __m128 aVal, bVal, cVal;
+ bVal = _mm_set_ps1(scalar);
+ for(;number < quarterPoints; number++){
+
+ aVal = _mm_load_ps(aPtr);
+
+ cVal = _mm_mul_ps(aVal, bVal);
+
+ _mm_store_ps(cPtr,cVal); // Store the results back into the C container
+
+ aPtr += 4;
+ cPtr += 4;
+ }
+
+ number = quarterPoints * 4;
+ for(;number < num_points; number++){
+ *cPtr++ = (*aPtr++) * scalar;
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_AVX
+#include <immintrin.h>
+/*!
+ \brief Scalar float multiply
+ \param cVector The vector where the results will be stored
+ \param aVector One of the vectors to be multiplied
+ \param scalar the scalar value
+ \param num_points The number of values in aVector and bVector to be multiplied together and stored into cVector
+*/
+static inline void volk_32f_s32f_multiply_32f_a_avx(float* cVector, const float* aVector, const float scalar, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int eighthPoints = num_points / 8;
+
+ float* cPtr = cVector;
+ const float* aPtr = aVector;
+
+ __m256 aVal, bVal, cVal;
+ bVal = _mm256_set1_ps(scalar);
+ for(;number < eighthPoints; number++){
+
+ aVal = _mm256_load_ps(aPtr);
+
+ cVal = _mm256_mul_ps(aVal, bVal);
+
+ _mm256_store_ps(cPtr,cVal); // Store the results back into the C container
+
+ aPtr += 8;
+ cPtr += 8;
+ }
+
+ number = eighthPoints * 8;
+ for(;number < num_points; number++){
+ *cPtr++ = (*aPtr++) * scalar;
+ }
+}
+#endif /* LV_HAVE_AVX */
+
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Scalar float multiply
+ \param cVector The vector where the results will be stored
+ \param aVector One of the vectors to be multiplied
+ \param scalar the scalar value
+ \param num_points The number of values in aVector and bVector to be multiplied together and stored into cVector
+*/
+static inline void volk_32f_s32f_multiply_32f_a_generic(float* cVector, const float* aVector, const float scalar, unsigned int num_points){
+ unsigned int number = 0;
+ const float* inputPtr = aVector;
+ float* outputPtr = cVector;
+ for(number = 0; number < num_points; number++){
+ *outputPtr = (*inputPtr) * scalar;
+ inputPtr++;
+ outputPtr++;
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+#ifdef LV_HAVE_ORC
+/*!
+ \brief Scalar float multiply
+ \param cVector The vector where the results will be stored
+ \param aVector One of the vectors to be multiplied
+ \param scalar the scalar value
+ \param num_points The number of values in aVector and bVector to be multiplied together and stored into cVector
+*/
+extern void volk_32f_s32f_multiply_32f_a_orc_impl(float* dst, const float* src, const float scalar, unsigned int num_points);
+static inline void volk_32f_s32f_multiply_32f_u_orc(float* cVector, const float* aVector, const float scalar, unsigned int num_points){
+ volk_32f_s32f_multiply_32f_a_orc_impl(cVector, aVector, scalar, num_points);
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_32f_s32f_multiply_32f_a_H */
diff --git a/volk/kernels/volk/volk_32f_s32f_normalize.h b/volk/kernels/volk/volk_32f_s32f_normalize.h
new file mode 100644
index 000000000..a0bd33c7d
--- /dev/null
+++ b/volk/kernels/volk/volk_32f_s32f_normalize.h
@@ -0,0 +1,81 @@
+#ifndef INCLUDED_volk_32f_s32f_normalize_a_H
+#define INCLUDED_volk_32f_s32f_normalize_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+/*!
+ \brief Normalizes all points in the buffer by the scalar value ( divides each data point by the scalar value )
+ \param vecBuffer The buffer of values to be vectorized
+ \param num_points The number of values in vecBuffer
+ \param scalar The scale value to be applied to each buffer value
+*/
+static inline void volk_32f_s32f_normalize_a_sse(float* vecBuffer, const float scalar, unsigned int num_points){
+ unsigned int number = 0;
+ float* inputPtr = vecBuffer;
+
+ const float invScalar = 1.0 / scalar;
+ __m128 vecScalar = _mm_set_ps1(invScalar);
+
+ __m128 input1;
+
+ const uint64_t quarterPoints = num_points / 4;
+ for(;number < quarterPoints; number++){
+
+ input1 = _mm_load_ps(inputPtr);
+
+ input1 = _mm_mul_ps(input1, vecScalar);
+
+ _mm_store_ps(inputPtr, input1);
+
+ inputPtr += 4;
+ }
+
+ number = quarterPoints*4;
+ for(; number < num_points; number++){
+ *inputPtr *= invScalar;
+ inputPtr++;
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Normalizes the two input vectors and store their results in the third vector
+ \param cVector The vector where the results will be stored
+ \param aVector One of the vectors to be normalizeed
+ \param bVector One of the vectors to be normalizeed
+ \param num_points The number of values in aVector and bVector to be normalizeed together and stored into cVector
+*/
+static inline void volk_32f_s32f_normalize_generic(float* vecBuffer, const float scalar, unsigned int num_points){
+ unsigned int number = 0;
+ float* inputPtr = vecBuffer;
+ const float invScalar = 1.0 / scalar;
+ for(number = 0; number < num_points; number++){
+ *inputPtr *= invScalar;
+ inputPtr++;
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+#ifdef LV_HAVE_ORC
+/*!
+ \brief Normalizes the two input vectors and store their results in the third vector
+ \param cVector The vector where the results will be stored
+ \param aVector One of the vectors to be normalizeed
+ \param bVector One of the vectors to be normalizeed
+ \param num_points The number of values in aVector and bVector to be normalizeed together and stored into cVector
+*/
+extern void volk_32f_s32f_normalize_a_orc_impl(float* dst, float* src, const float scalar, unsigned int num_points);
+static inline void volk_32f_s32f_normalize_u_orc(float* vecBuffer, const float scalar, unsigned int num_points){
+ float invscalar = 1.0 / scalar;
+ volk_32f_s32f_normalize_a_orc_impl(vecBuffer, vecBuffer, invscalar, num_points);
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_32f_s32f_normalize_a_H */
diff --git a/volk/kernels/volk/volk_32f_s32f_power_32f.h b/volk/kernels/volk/volk_32f_s32f_power_32f.h
new file mode 100644
index 000000000..282244468
--- /dev/null
+++ b/volk/kernels/volk/volk_32f_s32f_power_32f.h
@@ -0,0 +1,144 @@
+#ifndef INCLUDED_volk_32f_s32f_power_32f_a_H
+#define INCLUDED_volk_32f_s32f_power_32f_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+#include <math.h>
+
+#ifdef LV_HAVE_SSE4_1
+#include <tmmintrin.h>
+
+#ifdef LV_HAVE_LIB_SIMDMATH
+#include <simdmath.h>
+#endif /* LV_HAVE_LIB_SIMDMATH */
+
+/*!
+ \brief Takes each the input vector value to the specified power and stores the results in the return vector
+ \param cVector The vector where the results will be stored
+ \param aVector The vector of values to be taken to a power
+ \param power The power value to be applied to each data point
+ \param num_points The number of values in aVector to be taken to the specified power level and stored into cVector
+*/
+static inline void volk_32f_s32f_power_32f_a_sse4_1(float* cVector, const float* aVector, const float power, unsigned int num_points){
+ unsigned int number = 0;
+
+ float* cPtr = cVector;
+ const float* aPtr = aVector;
+
+#ifdef LV_HAVE_LIB_SIMDMATH
+ const unsigned int quarterPoints = num_points / 4;
+ __m128 vPower = _mm_set_ps1(power);
+ __m128 zeroValue = _mm_setzero_ps();
+ __m128 signMask;
+ __m128 negatedValues;
+ __m128 negativeOneToPower = _mm_set_ps1(powf(-1, power));
+ __m128 onesMask = _mm_set_ps1(1);
+
+ __m128 aVal, cVal;
+ for(;number < quarterPoints; number++){
+
+ aVal = _mm_load_ps(aPtr);
+ signMask = _mm_cmplt_ps(aVal, zeroValue);
+ negatedValues = _mm_sub_ps(zeroValue, aVal);
+ aVal = _mm_blendv_ps(aVal, negatedValues, signMask);
+
+ // powf4 doesn't support negative values in the base, so we mask them off and then apply the negative after
+ cVal = powf4(aVal, vPower); // Takes each input value to the specified power
+
+ cVal = _mm_mul_ps( _mm_blendv_ps(onesMask, negativeOneToPower, signMask), cVal);
+
+ _mm_store_ps(cPtr,cVal); // Store the results back into the C container
+
+ aPtr += 4;
+ cPtr += 4;
+ }
+
+ number = quarterPoints * 4;
+#endif /* LV_HAVE_LIB_SIMDMATH */
+
+ for(;number < num_points; number++){
+ *cPtr++ = powf((*aPtr++), power);
+ }
+}
+#endif /* LV_HAVE_SSE4_1 */
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+
+#ifdef LV_HAVE_LIB_SIMDMATH
+#include <simdmath.h>
+#endif /* LV_HAVE_LIB_SIMDMATH */
+
+/*!
+ \brief Takes each the input vector value to the specified power and stores the results in the return vector
+ \param cVector The vector where the results will be stored
+ \param aVector The vector of values to be taken to a power
+ \param power The power value to be applied to each data point
+ \param num_points The number of values in aVector to be taken to the specified power level and stored into cVector
+*/
+static inline void volk_32f_s32f_power_32f_a_sse(float* cVector, const float* aVector, const float power, unsigned int num_points){
+ unsigned int number = 0;
+
+ float* cPtr = cVector;
+ const float* aPtr = aVector;
+
+#ifdef LV_HAVE_LIB_SIMDMATH
+ const unsigned int quarterPoints = num_points / 4;
+ __m128 vPower = _mm_set_ps1(power);
+ __m128 zeroValue = _mm_setzero_ps();
+ __m128 signMask;
+ __m128 negatedValues;
+ __m128 negativeOneToPower = _mm_set_ps1(powf(-1, power));
+ __m128 onesMask = _mm_set_ps1(1);
+
+ __m128 aVal, cVal;
+ for(;number < quarterPoints; number++){
+
+ aVal = _mm_load_ps(aPtr);
+ signMask = _mm_cmplt_ps(aVal, zeroValue);
+ negatedValues = _mm_sub_ps(zeroValue, aVal);
+ aVal = _mm_or_ps(_mm_andnot_ps(signMask, aVal), _mm_and_ps(signMask, negatedValues) );
+
+ // powf4 doesn't support negative values in the base, so we mask them off and then apply the negative after
+ cVal = powf4(aVal, vPower); // Takes each input value to the specified power
+
+ cVal = _mm_mul_ps( _mm_or_ps( _mm_andnot_ps(signMask, onesMask), _mm_and_ps(signMask, negativeOneToPower) ), cVal);
+
+ _mm_store_ps(cPtr,cVal); // Store the results back into the C container
+
+ aPtr += 4;
+ cPtr += 4;
+ }
+
+ number = quarterPoints * 4;
+#endif /* LV_HAVE_LIB_SIMDMATH */
+
+ for(;number < num_points; number++){
+ *cPtr++ = powf((*aPtr++), power);
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+ /*!
+ \brief Takes each the input vector value to the specified power and stores the results in the return vector
+ \param cVector The vector where the results will be stored
+ \param aVector The vector of values to be taken to a power
+ \param power The power value to be applied to each data point
+ \param num_points The number of values in aVector to be taken to the specified power level and stored into cVector
+ */
+static inline void volk_32f_s32f_power_32f_generic(float* cVector, const float* aVector, const float power, unsigned int num_points){
+ float* cPtr = cVector;
+ const float* aPtr = aVector;
+ unsigned int number = 0;
+
+ for(number = 0; number < num_points; number++){
+ *cPtr++ = powf((*aPtr++), power);
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_32f_s32f_power_32f_a_H */
diff --git a/volk/kernels/volk/volk_32f_s32f_stddev_32f.h b/volk/kernels/volk/volk_32f_s32f_stddev_32f.h
new file mode 100644
index 000000000..0622b278a
--- /dev/null
+++ b/volk/kernels/volk/volk_32f_s32f_stddev_32f.h
@@ -0,0 +1,145 @@
+#ifndef INCLUDED_volk_32f_s32f_stddev_32f_a_H
+#define INCLUDED_volk_32f_s32f_stddev_32f_a_H
+
+#include <volk/volk_common.h>
+#include <inttypes.h>
+#include <stdio.h>
+#include <math.h>
+
+#ifdef LV_HAVE_SSE4_1
+#include <smmintrin.h>
+/*!
+ \brief Calculates the standard deviation of the input buffer using the supplied mean
+ \param stddev The calculated standard deviation
+ \param inputBuffer The buffer of points to calculate the std deviation for
+ \param mean The mean of the input buffer
+ \param num_points The number of values in input buffer to used in the stddev calculation
+*/
+static inline void volk_32f_s32f_stddev_32f_a_sse4_1(float* stddev, const float* inputBuffer, const float mean, unsigned int num_points){
+ float returnValue = 0;
+ if(num_points > 0){
+ unsigned int number = 0;
+ const unsigned int sixteenthPoints = num_points / 16;
+
+ const float* aPtr = inputBuffer;
+
+ __VOLK_ATTR_ALIGNED(16) float squareBuffer[4];
+
+ __m128 squareAccumulator = _mm_setzero_ps();
+ __m128 aVal1, aVal2, aVal3, aVal4;
+ __m128 cVal1, cVal2, cVal3, cVal4;
+ for(;number < sixteenthPoints; number++) {
+ aVal1 = _mm_load_ps(aPtr); aPtr += 4;
+ cVal1 = _mm_dp_ps(aVal1, aVal1, 0xF1);
+
+ aVal2 = _mm_load_ps(aPtr); aPtr += 4;
+ cVal2 = _mm_dp_ps(aVal2, aVal2, 0xF2);
+
+ aVal3 = _mm_load_ps(aPtr); aPtr += 4;
+ cVal3 = _mm_dp_ps(aVal3, aVal3, 0xF4);
+
+ aVal4 = _mm_load_ps(aPtr); aPtr += 4;
+ cVal4 = _mm_dp_ps(aVal4, aVal4, 0xF8);
+
+ cVal1 = _mm_or_ps(cVal1, cVal2);
+ cVal3 = _mm_or_ps(cVal3, cVal4);
+ cVal1 = _mm_or_ps(cVal1, cVal3);
+
+ squareAccumulator = _mm_add_ps(squareAccumulator, cVal1); // squareAccumulator += x^2
+ }
+ _mm_store_ps(squareBuffer,squareAccumulator); // Store the results back into the C container
+ returnValue = squareBuffer[0];
+ returnValue += squareBuffer[1];
+ returnValue += squareBuffer[2];
+ returnValue += squareBuffer[3];
+
+ number = sixteenthPoints * 16;
+ for(;number < num_points; number++){
+ returnValue += (*aPtr) * (*aPtr);
+ aPtr++;
+ }
+ returnValue /= num_points;
+ returnValue -= (mean * mean);
+ returnValue = sqrtf(returnValue);
+ }
+ *stddev = returnValue;
+}
+#endif /* LV_HAVE_SSE4_1 */
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+/*!
+ \brief Calculates the standard deviation of the input buffer using the supplied mean
+ \param stddev The calculated standard deviation
+ \param inputBuffer The buffer of points to calculate the std deviation for
+ \param mean The mean of the input buffer
+ \param num_points The number of values in input buffer to used in the stddev calculation
+*/
+static inline void volk_32f_s32f_stddev_32f_a_sse(float* stddev, const float* inputBuffer, const float mean, unsigned int num_points){
+ float returnValue = 0;
+ if(num_points > 0){
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+
+ const float* aPtr = inputBuffer;
+
+ __VOLK_ATTR_ALIGNED(16) float squareBuffer[4];
+
+ __m128 squareAccumulator = _mm_setzero_ps();
+ __m128 aVal = _mm_setzero_ps();
+ for(;number < quarterPoints; number++) {
+ aVal = _mm_load_ps(aPtr); // aVal = x
+ aVal = _mm_mul_ps(aVal, aVal); // squareAccumulator += x^2
+ squareAccumulator = _mm_add_ps(squareAccumulator, aVal);
+ aPtr += 4;
+ }
+ _mm_store_ps(squareBuffer,squareAccumulator); // Store the results back into the C container
+ returnValue = squareBuffer[0];
+ returnValue += squareBuffer[1];
+ returnValue += squareBuffer[2];
+ returnValue += squareBuffer[3];
+
+ number = quarterPoints * 4;
+ for(;number < num_points; number++){
+ returnValue += (*aPtr) * (*aPtr);
+ aPtr++;
+ }
+ returnValue /= num_points;
+ returnValue -= (mean * mean);
+ returnValue = sqrtf(returnValue);
+ }
+ *stddev = returnValue;
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Calculates the standard deviation of the input buffer using the supplied mean
+ \param stddev The calculated standard deviation
+ \param inputBuffer The buffer of points to calculate the std deviation for
+ \param mean The mean of the input buffer
+ \param num_points The number of values in input buffer to used in the stddev calculation
+*/
+static inline void volk_32f_s32f_stddev_32f_generic(float* stddev, const float* inputBuffer, const float mean, unsigned int num_points){
+ float returnValue = 0;
+ if(num_points > 0){
+ const float* aPtr = inputBuffer;
+ unsigned int number = 0;
+
+ for(number = 0; number < num_points; number++){
+ returnValue += (*aPtr) * (*aPtr);
+ aPtr++;
+ }
+
+ returnValue /= num_points;
+ returnValue -= (mean * mean);
+ returnValue = sqrtf(returnValue);
+ }
+ *stddev = returnValue;
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_32f_s32f_stddev_32f_a_H */
diff --git a/volk/kernels/volk/volk_32f_sqrt_32f.h b/volk/kernels/volk/volk_32f_sqrt_32f.h
new file mode 100644
index 000000000..ab9fffd7d
--- /dev/null
+++ b/volk/kernels/volk/volk_32f_sqrt_32f.h
@@ -0,0 +1,77 @@
+#ifndef INCLUDED_volk_32f_sqrt_32f_a_H
+#define INCLUDED_volk_32f_sqrt_32f_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+#include <math.h>
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+/*!
+ \brief Sqrts the two input vectors and store their results in the third vector
+ \param cVector The vector where the results will be stored
+ \param aVector One of the vectors to be sqrted
+ \param num_points The number of values in aVector and bVector to be sqrted together and stored into cVector
+*/
+static inline void volk_32f_sqrt_32f_a_sse(float* cVector, const float* aVector, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+
+ float* cPtr = cVector;
+ const float* aPtr = aVector;
+
+ __m128 aVal, cVal;
+ for(;number < quarterPoints; number++){
+
+ aVal = _mm_load_ps(aPtr);
+
+ cVal = _mm_sqrt_ps(aVal);
+
+ _mm_store_ps(cPtr,cVal); // Store the results back into the C container
+
+ aPtr += 4;
+ cPtr += 4;
+ }
+
+ number = quarterPoints * 4;
+ for(;number < num_points; number++){
+ *cPtr++ = sqrtf(*aPtr++);
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Sqrts the two input vectors and store their results in the third vector
+ \param cVector The vector where the results will be stored
+ \param aVector One of the vectors to be sqrted
+ \param num_points The number of values in aVector and bVector to be sqrted together and stored into cVector
+*/
+static inline void volk_32f_sqrt_32f_generic(float* cVector, const float* aVector, unsigned int num_points){
+ float* cPtr = cVector;
+ const float* aPtr = aVector;
+ unsigned int number = 0;
+
+ for(number = 0; number < num_points; number++){
+ *cPtr++ = sqrtf(*aPtr++);
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+#ifdef LV_HAVE_ORC
+extern void volk_32f_sqrt_32f_a_orc_impl(float *, const float*, unsigned int);
+/*!
+ \brief Sqrts the two input vectors and store their results in the third vector
+ \param cVector The vector where the results will be stored
+ \param aVector One of the vectors to be sqrted
+ \param num_points The number of values in aVector and bVector to be sqrted together and stored into cVector
+*/
+static inline void volk_32f_sqrt_32f_u_orc(float* cVector, const float* aVector, unsigned int num_points){
+ volk_32f_sqrt_32f_a_orc_impl(cVector, aVector, num_points);
+}
+
+#endif /* LV_HAVE_ORC */
+
+
+
+#endif /* INCLUDED_volk_32f_sqrt_32f_a_H */
diff --git a/volk/kernels/volk/volk_32f_stddev_and_mean_32f_x2.h b/volk/kernels/volk/volk_32f_stddev_and_mean_32f_x2.h
new file mode 100644
index 000000000..9bded6713
--- /dev/null
+++ b/volk/kernels/volk/volk_32f_stddev_and_mean_32f_x2.h
@@ -0,0 +1,170 @@
+#ifndef INCLUDED_volk_32f_stddev_and_mean_32f_x2_a_H
+#define INCLUDED_volk_32f_stddev_and_mean_32f_x2_a_H
+
+#include <volk/volk_common.h>
+#include <inttypes.h>
+#include <stdio.h>
+#include <math.h>
+
+#ifdef LV_HAVE_SSE4_1
+#include <smmintrin.h>
+/*!
+ \brief Calculates the standard deviation and mean of the input buffer
+ \param stddev The calculated standard deviation
+ \param mean The mean of the input buffer
+ \param inputBuffer The buffer of points to calculate the std deviation for
+ \param num_points The number of values in input buffer to used in the stddev and mean calculations
+*/
+static inline void volk_32f_stddev_and_mean_32f_x2_a_sse4_1(float* stddev, float* mean, const float* inputBuffer, unsigned int num_points){
+ float returnValue = 0;
+ float newMean = 0;
+ if(num_points > 0){
+ unsigned int number = 0;
+ const unsigned int sixteenthPoints = num_points / 16;
+
+ const float* aPtr = inputBuffer;
+ __VOLK_ATTR_ALIGNED(16) float meanBuffer[4];
+ __VOLK_ATTR_ALIGNED(16) float squareBuffer[4];
+
+ __m128 accumulator = _mm_setzero_ps();
+ __m128 squareAccumulator = _mm_setzero_ps();
+ __m128 aVal1, aVal2, aVal3, aVal4;
+ __m128 cVal1, cVal2, cVal3, cVal4;
+ for(;number < sixteenthPoints; number++) {
+ aVal1 = _mm_load_ps(aPtr); aPtr += 4;
+ cVal1 = _mm_dp_ps(aVal1, aVal1, 0xF1);
+ accumulator = _mm_add_ps(accumulator, aVal1); // accumulator += x
+
+ aVal2 = _mm_load_ps(aPtr); aPtr += 4;
+ cVal2 = _mm_dp_ps(aVal2, aVal2, 0xF2);
+ accumulator = _mm_add_ps(accumulator, aVal2); // accumulator += x
+
+ aVal3 = _mm_load_ps(aPtr); aPtr += 4;
+ cVal3 = _mm_dp_ps(aVal3, aVal3, 0xF4);
+ accumulator = _mm_add_ps(accumulator, aVal3); // accumulator += x
+
+ aVal4 = _mm_load_ps(aPtr); aPtr += 4;
+ cVal4 = _mm_dp_ps(aVal4, aVal4, 0xF8);
+ accumulator = _mm_add_ps(accumulator, aVal4); // accumulator += x
+
+ cVal1 = _mm_or_ps(cVal1, cVal2);
+ cVal3 = _mm_or_ps(cVal3, cVal4);
+ cVal1 = _mm_or_ps(cVal1, cVal3);
+
+ squareAccumulator = _mm_add_ps(squareAccumulator, cVal1); // squareAccumulator += x^2
+ }
+ _mm_store_ps(meanBuffer,accumulator); // Store the results back into the C container
+ _mm_store_ps(squareBuffer,squareAccumulator); // Store the results back into the C container
+ newMean = meanBuffer[0];
+ newMean += meanBuffer[1];
+ newMean += meanBuffer[2];
+ newMean += meanBuffer[3];
+ returnValue = squareBuffer[0];
+ returnValue += squareBuffer[1];
+ returnValue += squareBuffer[2];
+ returnValue += squareBuffer[3];
+
+ number = sixteenthPoints * 16;
+ for(;number < num_points; number++){
+ returnValue += (*aPtr) * (*aPtr);
+ newMean += *aPtr++;
+ }
+ newMean /= num_points;
+ returnValue /= num_points;
+ returnValue -= (newMean * newMean);
+ returnValue = sqrtf(returnValue);
+ }
+ *stddev = returnValue;
+ *mean = newMean;
+}
+#endif /* LV_HAVE_SSE4_1 */
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+/*!
+ \brief Calculates the standard deviation and mean of the input buffer
+ \param stddev The calculated standard deviation
+ \param mean The mean of the input buffer
+ \param inputBuffer The buffer of points to calculate the std deviation for
+ \param num_points The number of values in input buffer to used in the stddev and mean calculations
+*/
+static inline void volk_32f_stddev_and_mean_32f_x2_a_sse(float* stddev, float* mean, const float* inputBuffer, unsigned int num_points){
+ float returnValue = 0;
+ float newMean = 0;
+ if(num_points > 0){
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+
+ const float* aPtr = inputBuffer;
+ __VOLK_ATTR_ALIGNED(16) float meanBuffer[4];
+ __VOLK_ATTR_ALIGNED(16) float squareBuffer[4];
+
+ __m128 accumulator = _mm_setzero_ps();
+ __m128 squareAccumulator = _mm_setzero_ps();
+ __m128 aVal = _mm_setzero_ps();
+ for(;number < quarterPoints; number++) {
+ aVal = _mm_load_ps(aPtr); // aVal = x
+ accumulator = _mm_add_ps(accumulator, aVal); // accumulator += x
+ aVal = _mm_mul_ps(aVal, aVal); // squareAccumulator += x^2
+ squareAccumulator = _mm_add_ps(squareAccumulator, aVal);
+ aPtr += 4;
+ }
+ _mm_store_ps(meanBuffer,accumulator); // Store the results back into the C container
+ _mm_store_ps(squareBuffer,squareAccumulator); // Store the results back into the C container
+ newMean = meanBuffer[0];
+ newMean += meanBuffer[1];
+ newMean += meanBuffer[2];
+ newMean += meanBuffer[3];
+ returnValue = squareBuffer[0];
+ returnValue += squareBuffer[1];
+ returnValue += squareBuffer[2];
+ returnValue += squareBuffer[3];
+
+ number = quarterPoints * 4;
+ for(;number < num_points; number++){
+ returnValue += (*aPtr) * (*aPtr);
+ newMean += *aPtr++;
+ }
+ newMean /= num_points;
+ returnValue /= num_points;
+ returnValue -= (newMean * newMean);
+ returnValue = sqrtf(returnValue);
+ }
+ *stddev = returnValue;
+ *mean = newMean;
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Calculates the standard deviation and mean of the input buffer
+ \param stddev The calculated standard deviation
+ \param mean The mean of the input buffer
+ \param inputBuffer The buffer of points to calculate the std deviation for
+ \param num_points The number of values in input buffer to used in the stddev and mean calculations
+*/
+static inline void volk_32f_stddev_and_mean_32f_x2_generic(float* stddev, float* mean, const float* inputBuffer, unsigned int num_points){
+ float returnValue = 0;
+ float newMean = 0;
+ if(num_points > 0){
+ const float* aPtr = inputBuffer;
+ unsigned int number = 0;
+
+ for(number = 0; number < num_points; number++){
+ returnValue += (*aPtr) * (*aPtr);
+ newMean += *aPtr++;
+ }
+ newMean /= num_points;
+ returnValue /= num_points;
+ returnValue -= (newMean * newMean);
+ returnValue = sqrtf(returnValue);
+ }
+ *stddev = returnValue;
+ *mean = newMean;
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_32f_stddev_and_mean_32f_x2_a_H */
diff --git a/volk/kernels/volk/volk_32f_x2_add_32f.h b/volk/kernels/volk/volk_32f_x2_add_32f.h
new file mode 100644
index 000000000..42278f606
--- /dev/null
+++ b/volk/kernels/volk/volk_32f_x2_add_32f.h
@@ -0,0 +1,147 @@
+#ifndef INCLUDED_volk_32f_x2_add_32f_u_H
+#define INCLUDED_volk_32f_x2_add_32f_u_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+/*!
+ \brief Adds the two input vectors and store their results in the third vector
+ \param cVector The vector where the results will be stored
+ \param aVector One of the vectors to be added
+ \param bVector One of the vectors to be added
+ \param num_points The number of values in aVector and bVector to be added together and stored into cVector
+*/
+static inline void volk_32f_x2_add_32f_u_sse(float* cVector, const float* aVector, const float* bVector, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+
+ float* cPtr = cVector;
+ const float* aPtr = aVector;
+ const float* bPtr= bVector;
+
+ __m128 aVal, bVal, cVal;
+ for(;number < quarterPoints; number++){
+
+ aVal = _mm_loadu_ps(aPtr);
+ bVal = _mm_loadu_ps(bPtr);
+
+ cVal = _mm_add_ps(aVal, bVal);
+
+ _mm_storeu_ps(cPtr,cVal); // Store the results back into the C container
+
+ aPtr += 4;
+ bPtr += 4;
+ cPtr += 4;
+ }
+
+ number = quarterPoints * 4;
+ for(;number < num_points; number++){
+ *cPtr++ = (*aPtr++) + (*bPtr++);
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Adds the two input vectors and store their results in the third vector
+ \param cVector The vector where the results will be stored
+ \param aVector One of the vectors to be added
+ \param bVector One of the vectors to be added
+ \param num_points The number of values in aVector and bVector to be added together and stored into cVector
+*/
+static inline void volk_32f_x2_add_32f_generic(float* cVector, const float* aVector, const float* bVector, unsigned int num_points){
+ float* cPtr = cVector;
+ const float* aPtr = aVector;
+ const float* bPtr= bVector;
+ unsigned int number = 0;
+
+ for(number = 0; number < num_points; number++){
+ *cPtr++ = (*aPtr++) + (*bPtr++);
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+#endif /* INCLUDED_volk_32f_x2_add_32f_u_H */
+#ifndef INCLUDED_volk_32f_x2_add_32f_a_H
+#define INCLUDED_volk_32f_x2_add_32f_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+/*!
+ \brief Adds the two input vectors and store their results in the third vector
+ \param cVector The vector where the results will be stored
+ \param aVector One of the vectors to be added
+ \param bVector One of the vectors to be added
+ \param num_points The number of values in aVector and bVector to be added together and stored into cVector
+*/
+static inline void volk_32f_x2_add_32f_a_sse(float* cVector, const float* aVector, const float* bVector, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+
+ float* cPtr = cVector;
+ const float* aPtr = aVector;
+ const float* bPtr= bVector;
+
+ __m128 aVal, bVal, cVal;
+ for(;number < quarterPoints; number++){
+
+ aVal = _mm_load_ps(aPtr);
+ bVal = _mm_load_ps(bPtr);
+
+ cVal = _mm_add_ps(aVal, bVal);
+
+ _mm_store_ps(cPtr,cVal); // Store the results back into the C container
+
+ aPtr += 4;
+ bPtr += 4;
+ cPtr += 4;
+ }
+
+ number = quarterPoints * 4;
+ for(;number < num_points; number++){
+ *cPtr++ = (*aPtr++) + (*bPtr++);
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Adds the two input vectors and store their results in the third vector
+ \param cVector The vector where the results will be stored
+ \param aVector One of the vectors to be added
+ \param bVector One of the vectors to be added
+ \param num_points The number of values in aVector and bVector to be added together and stored into cVector
+*/
+static inline void volk_32f_x2_add_32f_a_generic(float* cVector, const float* aVector, const float* bVector, unsigned int num_points){
+ float* cPtr = cVector;
+ const float* aPtr = aVector;
+ const float* bPtr= bVector;
+ unsigned int number = 0;
+
+ for(number = 0; number < num_points; number++){
+ *cPtr++ = (*aPtr++) + (*bPtr++);
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+#ifdef LV_HAVE_ORC
+/*!
+ \brief Adds the two input vectors and store their results in the third vector
+ \param cVector The vector where the results will be stored
+ \param aVector One of the vectors to be added
+ \param bVector One of the vectors to be added
+ \param num_points The number of values in aVector and bVector to be added together and stored into cVector
+*/
+extern void volk_32f_x2_add_32f_a_orc_impl(float* cVector, const float* aVector, const float* bVector, unsigned int num_points);
+static inline void volk_32f_x2_add_32f_u_orc(float* cVector, const float* aVector, const float* bVector, unsigned int num_points){
+ volk_32f_x2_add_32f_a_orc_impl(cVector, aVector, bVector, num_points);
+}
+#endif /* LV_HAVE_ORC */
+
+
+#endif /* INCLUDED_volk_32f_x2_add_32f_a_H */
diff --git a/volk/kernels/volk/volk_32f_x2_divide_32f.h b/volk/kernels/volk/volk_32f_x2_divide_32f.h
new file mode 100644
index 000000000..d5a7c7d7c
--- /dev/null
+++ b/volk/kernels/volk/volk_32f_x2_divide_32f.h
@@ -0,0 +1,82 @@
+#ifndef INCLUDED_volk_32f_x2_divide_32f_a_H
+#define INCLUDED_volk_32f_x2_divide_32f_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+/*!
+ \brief Divides the two input vectors and store their results in the third vector
+ \param cVector The vector where the results will be stored
+ \param aVector The vector to be divideed
+ \param bVector The divisor vector
+ \param num_points The number of values in aVector and bVector to be divideed together and stored into cVector
+*/
+static inline void volk_32f_x2_divide_32f_a_sse(float* cVector, const float* aVector, const float* bVector, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+
+ float* cPtr = cVector;
+ const float* aPtr = aVector;
+ const float* bPtr= bVector;
+
+ __m128 aVal, bVal, cVal;
+ for(;number < quarterPoints; number++){
+
+ aVal = _mm_load_ps(aPtr);
+ bVal = _mm_load_ps(bPtr);
+
+ cVal = _mm_div_ps(aVal, bVal);
+
+ _mm_store_ps(cPtr,cVal); // Store the results back into the C container
+
+ aPtr += 4;
+ bPtr += 4;
+ cPtr += 4;
+ }
+
+ number = quarterPoints * 4;
+ for(;number < num_points; number++){
+ *cPtr++ = (*aPtr++) / (*bPtr++);
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Divides the two input vectors and store their results in the third vector
+ \param cVector The vector where the results will be stored
+ \param aVector The vector to be divideed
+ \param bVector The divisor vector
+ \param num_points The number of values in aVector and bVector to be divideed together and stored into cVector
+*/
+static inline void volk_32f_x2_divide_32f_generic(float* cVector, const float* aVector, const float* bVector, unsigned int num_points){
+ float* cPtr = cVector;
+ const float* aPtr = aVector;
+ const float* bPtr= bVector;
+ unsigned int number = 0;
+
+ for(number = 0; number < num_points; number++){
+ *cPtr++ = (*aPtr++) / (*bPtr++);
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+#ifdef LV_HAVE_ORC
+/*!
+ \brief Divides the two input vectors and store their results in the third vector
+ \param cVector The vector where the results will be stored
+ \param aVector The vector to be divideed
+ \param bVector The divisor vector
+ \param num_points The number of values in aVector and bVector to be divideed together and stored into cVector
+*/
+extern void volk_32f_x2_divide_32f_a_orc_impl(float* cVector, const float* aVector, const float* bVector, unsigned int num_points);
+static inline void volk_32f_x2_divide_32f_u_orc(float* cVector, const float* aVector, const float* bVector, unsigned int num_points){
+ volk_32f_x2_divide_32f_a_orc_impl(cVector, aVector, bVector, num_points);
+}
+#endif /* LV_HAVE_ORC */
+
+
+
+#endif /* INCLUDED_volk_32f_x2_divide_32f_a_H */
diff --git a/volk/kernels/volk/volk_32f_x2_dot_prod_16i.h b/volk/kernels/volk/volk_32f_x2_dot_prod_16i.h
new file mode 100644
index 000000000..8fcc7deae
--- /dev/null
+++ b/volk/kernels/volk/volk_32f_x2_dot_prod_16i.h
@@ -0,0 +1,98 @@
+#ifndef INCLUDED_volk_32f_x2_dot_prod_16i_a_H
+#define INCLUDED_volk_32f_x2_dot_prod_16i_a_H
+
+#include <volk/volk_common.h>
+#include<stdio.h>
+
+
+#ifdef LV_HAVE_GENERIC
+
+
+static inline void volk_32f_x2_dot_prod_16i_generic(int16_t* result, const float* input, const float* taps, unsigned int num_points) {
+
+ float dotProduct = 0;
+ const float* aPtr = input;
+ const float* bPtr= taps;
+ unsigned int number = 0;
+
+ for(number = 0; number < num_points; number++){
+ dotProduct += ((*aPtr++) * (*bPtr++));
+ }
+
+ *result = (int16_t)dotProduct;
+}
+
+#endif /*LV_HAVE_GENERIC*/
+
+
+#ifdef LV_HAVE_SSE
+
+
+static inline void volk_32f_x2_dot_prod_16i_a_sse(int16_t* result, const float* input, const float* taps, unsigned int num_points) {
+
+ unsigned int number = 0;
+ const unsigned int sixteenthPoints = num_points / 16;
+
+ float dotProduct = 0;
+ const float* aPtr = input;
+ const float* bPtr = taps;
+
+ __m128 a0Val, a1Val, a2Val, a3Val;
+ __m128 b0Val, b1Val, b2Val, b3Val;
+ __m128 c0Val, c1Val, c2Val, c3Val;
+
+ __m128 dotProdVal0 = _mm_setzero_ps();
+ __m128 dotProdVal1 = _mm_setzero_ps();
+ __m128 dotProdVal2 = _mm_setzero_ps();
+ __m128 dotProdVal3 = _mm_setzero_ps();
+
+ for(;number < sixteenthPoints; number++){
+
+ a0Val = _mm_load_ps(aPtr);
+ a1Val = _mm_load_ps(aPtr+4);
+ a2Val = _mm_load_ps(aPtr+8);
+ a3Val = _mm_load_ps(aPtr+12);
+ b0Val = _mm_load_ps(bPtr);
+ b1Val = _mm_load_ps(bPtr+4);
+ b2Val = _mm_load_ps(bPtr+8);
+ b3Val = _mm_load_ps(bPtr+12);
+
+ c0Val = _mm_mul_ps(a0Val, b0Val);
+ c1Val = _mm_mul_ps(a1Val, b1Val);
+ c2Val = _mm_mul_ps(a2Val, b2Val);
+ c3Val = _mm_mul_ps(a3Val, b3Val);
+
+ dotProdVal0 = _mm_add_ps(c0Val, dotProdVal0);
+ dotProdVal1 = _mm_add_ps(c1Val, dotProdVal1);
+ dotProdVal2 = _mm_add_ps(c2Val, dotProdVal2);
+ dotProdVal3 = _mm_add_ps(c3Val, dotProdVal3);
+
+ aPtr += 16;
+ bPtr += 16;
+ }
+
+ dotProdVal0 = _mm_add_ps(dotProdVal0, dotProdVal1);
+ dotProdVal0 = _mm_add_ps(dotProdVal0, dotProdVal2);
+ dotProdVal0 = _mm_add_ps(dotProdVal0, dotProdVal3);
+
+ __VOLK_ATTR_ALIGNED(16) float dotProductVector[4];
+
+ _mm_store_ps(dotProductVector,dotProdVal0); // Store the results back into the dot product vector
+
+ dotProduct = dotProductVector[0];
+ dotProduct += dotProductVector[1];
+ dotProduct += dotProductVector[2];
+ dotProduct += dotProductVector[3];
+
+ number = sixteenthPoints*16;
+ for(;number < num_points; number++){
+ dotProduct += ((*aPtr++) * (*bPtr++));
+ }
+
+ *result = (short)dotProduct;
+
+}
+
+#endif /*LV_HAVE_SSE*/
+
+#endif /*INCLUDED_volk_32f_x2_dot_prod_16i_a_H*/
diff --git a/volk/kernels/volk/volk_32f_x2_dot_prod_32f.h b/volk/kernels/volk/volk_32f_x2_dot_prod_32f.h
new file mode 100644
index 000000000..b91252e36
--- /dev/null
+++ b/volk/kernels/volk/volk_32f_x2_dot_prod_32f.h
@@ -0,0 +1,580 @@
+#ifndef INCLUDED_volk_32f_x2_dot_prod_32f_u_H
+#define INCLUDED_volk_32f_x2_dot_prod_32f_u_H
+
+#include <volk/volk_common.h>
+#include<stdio.h>
+
+
+#ifdef LV_HAVE_GENERIC
+
+
+static inline void volk_32f_x2_dot_prod_32f_generic(float * result, const float * input, const float * taps, unsigned int num_points) {
+
+ float dotProduct = 0;
+ const float* aPtr = input;
+ const float* bPtr= taps;
+ unsigned int number = 0;
+
+ for(number = 0; number < num_points; number++){
+ dotProduct += ((*aPtr++) * (*bPtr++));
+ }
+
+ *result = dotProduct;
+}
+
+#endif /*LV_HAVE_GENERIC*/
+
+
+#ifdef LV_HAVE_SSE
+
+
+static inline void volk_32f_x2_dot_prod_32f_u_sse( float* result, const float* input, const float* taps, unsigned int num_points) {
+
+ unsigned int number = 0;
+ const unsigned int sixteenthPoints = num_points / 16;
+
+ float dotProduct = 0;
+ const float* aPtr = input;
+ const float* bPtr = taps;
+
+ __m128 a0Val, a1Val, a2Val, a3Val;
+ __m128 b0Val, b1Val, b2Val, b3Val;
+ __m128 c0Val, c1Val, c2Val, c3Val;
+
+ __m128 dotProdVal0 = _mm_setzero_ps();
+ __m128 dotProdVal1 = _mm_setzero_ps();
+ __m128 dotProdVal2 = _mm_setzero_ps();
+ __m128 dotProdVal3 = _mm_setzero_ps();
+
+ for(;number < sixteenthPoints; number++){
+
+ a0Val = _mm_loadu_ps(aPtr);
+ a1Val = _mm_loadu_ps(aPtr+4);
+ a2Val = _mm_loadu_ps(aPtr+8);
+ a3Val = _mm_loadu_ps(aPtr+12);
+ b0Val = _mm_loadu_ps(bPtr);
+ b1Val = _mm_loadu_ps(bPtr+4);
+ b2Val = _mm_loadu_ps(bPtr+8);
+ b3Val = _mm_loadu_ps(bPtr+12);
+
+ c0Val = _mm_mul_ps(a0Val, b0Val);
+ c1Val = _mm_mul_ps(a1Val, b1Val);
+ c2Val = _mm_mul_ps(a2Val, b2Val);
+ c3Val = _mm_mul_ps(a3Val, b3Val);
+
+ dotProdVal0 = _mm_add_ps(c0Val, dotProdVal0);
+ dotProdVal1 = _mm_add_ps(c1Val, dotProdVal1);
+ dotProdVal2 = _mm_add_ps(c2Val, dotProdVal2);
+ dotProdVal3 = _mm_add_ps(c3Val, dotProdVal3);
+
+ aPtr += 16;
+ bPtr += 16;
+ }
+
+ dotProdVal0 = _mm_add_ps(dotProdVal0, dotProdVal1);
+ dotProdVal0 = _mm_add_ps(dotProdVal0, dotProdVal2);
+ dotProdVal0 = _mm_add_ps(dotProdVal0, dotProdVal3);
+
+ __VOLK_ATTR_ALIGNED(16) float dotProductVector[4];
+
+ _mm_store_ps(dotProductVector,dotProdVal0); // Store the results back into the dot product vector
+
+ dotProduct = dotProductVector[0];
+ dotProduct += dotProductVector[1];
+ dotProduct += dotProductVector[2];
+ dotProduct += dotProductVector[3];
+
+ number = sixteenthPoints*16;
+ for(;number < num_points; number++){
+ dotProduct += ((*aPtr++) * (*bPtr++));
+ }
+
+ *result = dotProduct;
+
+}
+
+#endif /*LV_HAVE_SSE*/
+
+#ifdef LV_HAVE_SSE3
+
+#include <pmmintrin.h>
+
+static inline void volk_32f_x2_dot_prod_32f_u_sse3(float * result, const float * input, const float * taps, unsigned int num_points) {
+ unsigned int number = 0;
+ const unsigned int sixteenthPoints = num_points / 16;
+
+ float dotProduct = 0;
+ const float* aPtr = input;
+ const float* bPtr = taps;
+
+ __m128 a0Val, a1Val, a2Val, a3Val;
+ __m128 b0Val, b1Val, b2Val, b3Val;
+ __m128 c0Val, c1Val, c2Val, c3Val;
+
+ __m128 dotProdVal0 = _mm_setzero_ps();
+ __m128 dotProdVal1 = _mm_setzero_ps();
+ __m128 dotProdVal2 = _mm_setzero_ps();
+ __m128 dotProdVal3 = _mm_setzero_ps();
+
+ for(;number < sixteenthPoints; number++){
+
+ a0Val = _mm_loadu_ps(aPtr);
+ a1Val = _mm_loadu_ps(aPtr+4);
+ a2Val = _mm_loadu_ps(aPtr+8);
+ a3Val = _mm_loadu_ps(aPtr+12);
+ b0Val = _mm_loadu_ps(bPtr);
+ b1Val = _mm_loadu_ps(bPtr+4);
+ b2Val = _mm_loadu_ps(bPtr+8);
+ b3Val = _mm_loadu_ps(bPtr+12);
+
+ c0Val = _mm_mul_ps(a0Val, b0Val);
+ c1Val = _mm_mul_ps(a1Val, b1Val);
+ c2Val = _mm_mul_ps(a2Val, b2Val);
+ c3Val = _mm_mul_ps(a3Val, b3Val);
+
+ dotProdVal0 = _mm_add_ps(dotProdVal0, c0Val);
+ dotProdVal1 = _mm_add_ps(dotProdVal1, c1Val);
+ dotProdVal2 = _mm_add_ps(dotProdVal2, c2Val);
+ dotProdVal3 = _mm_add_ps(dotProdVal3, c3Val);
+
+ aPtr += 16;
+ bPtr += 16;
+ }
+
+ dotProdVal0 = _mm_add_ps(dotProdVal0, dotProdVal1);
+ dotProdVal0 = _mm_add_ps(dotProdVal0, dotProdVal2);
+ dotProdVal0 = _mm_add_ps(dotProdVal0, dotProdVal3);
+
+ __VOLK_ATTR_ALIGNED(16) float dotProductVector[4];
+ _mm_store_ps(dotProductVector,dotProdVal0); // Store the results back into the dot product vector
+
+ dotProduct = dotProductVector[0];
+ dotProduct += dotProductVector[1];
+ dotProduct += dotProductVector[2];
+ dotProduct += dotProductVector[3];
+
+ number = sixteenthPoints*16;
+ for(;number < num_points; number++){
+ dotProduct += ((*aPtr++) * (*bPtr++));
+ }
+
+ *result = dotProduct;
+}
+
+#endif /*LV_HAVE_SSE3*/
+
+#ifdef LV_HAVE_SSE4_1
+
+#include <smmintrin.h>
+
+static inline void volk_32f_x2_dot_prod_32f_u_sse4_1(float * result, const float * input, const float* taps, unsigned int num_points) {
+ unsigned int number = 0;
+ const unsigned int sixteenthPoints = num_points / 16;
+
+ float dotProduct = 0;
+ const float* aPtr = input;
+ const float* bPtr = taps;
+
+ __m128 aVal1, bVal1, cVal1;
+ __m128 aVal2, bVal2, cVal2;
+ __m128 aVal3, bVal3, cVal3;
+ __m128 aVal4, bVal4, cVal4;
+
+ __m128 dotProdVal = _mm_setzero_ps();
+
+ for(;number < sixteenthPoints; number++){
+
+ aVal1 = _mm_loadu_ps(aPtr); aPtr += 4;
+ aVal2 = _mm_loadu_ps(aPtr); aPtr += 4;
+ aVal3 = _mm_loadu_ps(aPtr); aPtr += 4;
+ aVal4 = _mm_loadu_ps(aPtr); aPtr += 4;
+
+ bVal1 = _mm_loadu_ps(bPtr); bPtr += 4;
+ bVal2 = _mm_loadu_ps(bPtr); bPtr += 4;
+ bVal3 = _mm_loadu_ps(bPtr); bPtr += 4;
+ bVal4 = _mm_loadu_ps(bPtr); bPtr += 4;
+
+ cVal1 = _mm_dp_ps(aVal1, bVal1, 0xF1);
+ cVal2 = _mm_dp_ps(aVal2, bVal2, 0xF2);
+ cVal3 = _mm_dp_ps(aVal3, bVal3, 0xF4);
+ cVal4 = _mm_dp_ps(aVal4, bVal4, 0xF8);
+
+ cVal1 = _mm_or_ps(cVal1, cVal2);
+ cVal3 = _mm_or_ps(cVal3, cVal4);
+ cVal1 = _mm_or_ps(cVal1, cVal3);
+
+ dotProdVal = _mm_add_ps(dotProdVal, cVal1);
+ }
+
+ __VOLK_ATTR_ALIGNED(16) float dotProductVector[4];
+ _mm_store_ps(dotProductVector, dotProdVal); // Store the results back into the dot product vector
+
+ dotProduct = dotProductVector[0];
+ dotProduct += dotProductVector[1];
+ dotProduct += dotProductVector[2];
+ dotProduct += dotProductVector[3];
+
+ number = sixteenthPoints * 16;
+ for(;number < num_points; number++){
+ dotProduct += ((*aPtr++) * (*bPtr++));
+ }
+
+ *result = dotProduct;
+}
+
+#endif /*LV_HAVE_SSE4_1*/
+
+#ifdef LV_HAVE_AVX
+
+#include <immintrin.h>
+
+static inline void volk_32f_x2_dot_prod_32f_u_avx( float* result, const float* input, const float* taps, unsigned int num_points) {
+
+ unsigned int number = 0;
+ const unsigned int sixteenthPoints = num_points / 16;
+
+ float dotProduct = 0;
+ const float* aPtr = input;
+ const float* bPtr = taps;
+
+ __m256 a0Val, a1Val;
+ __m256 b0Val, b1Val;
+ __m256 c0Val, c1Val;
+
+ __m256 dotProdVal0 = _mm256_setzero_ps();
+ __m256 dotProdVal1 = _mm256_setzero_ps();
+
+ for(;number < sixteenthPoints; number++){
+
+ a0Val = _mm256_loadu_ps(aPtr);
+ a1Val = _mm256_loadu_ps(aPtr+8);
+ b0Val = _mm256_loadu_ps(bPtr);
+ b1Val = _mm256_loadu_ps(bPtr+8);
+
+ c0Val = _mm256_mul_ps(a0Val, b0Val);
+ c1Val = _mm256_mul_ps(a1Val, b1Val);
+
+ dotProdVal0 = _mm256_add_ps(c0Val, dotProdVal0);
+ dotProdVal1 = _mm256_add_ps(c1Val, dotProdVal1);
+
+ aPtr += 16;
+ bPtr += 16;
+ }
+
+ dotProdVal0 = _mm256_add_ps(dotProdVal0, dotProdVal1);
+
+ __VOLK_ATTR_ALIGNED(32) float dotProductVector[8];
+
+ _mm256_storeu_ps(dotProductVector,dotProdVal0); // Store the results back into the dot product vector
+
+ dotProduct = dotProductVector[0];
+ dotProduct += dotProductVector[1];
+ dotProduct += dotProductVector[2];
+ dotProduct += dotProductVector[3];
+ dotProduct += dotProductVector[4];
+ dotProduct += dotProductVector[5];
+ dotProduct += dotProductVector[6];
+ dotProduct += dotProductVector[7];
+
+ number = sixteenthPoints*16;
+ for(;number < num_points; number++){
+ dotProduct += ((*aPtr++) * (*bPtr++));
+ }
+
+ *result = dotProduct;
+
+}
+
+#endif /*LV_HAVE_AVX*/
+
+#endif /*INCLUDED_volk_32f_x2_dot_prod_32f_u_H*/
+#ifndef INCLUDED_volk_32f_x2_dot_prod_32f_a_H
+#define INCLUDED_volk_32f_x2_dot_prod_32f_a_H
+
+#include <volk/volk_common.h>
+#include<stdio.h>
+
+
+#ifdef LV_HAVE_GENERIC
+
+
+static inline void volk_32f_x2_dot_prod_32f_a_generic(float * result, const float * input, const float * taps, unsigned int num_points) {
+
+ float dotProduct = 0;
+ const float* aPtr = input;
+ const float* bPtr= taps;
+ unsigned int number = 0;
+
+ for(number = 0; number < num_points; number++){
+ dotProduct += ((*aPtr++) * (*bPtr++));
+ }
+
+ *result = dotProduct;
+}
+
+#endif /*LV_HAVE_GENERIC*/
+
+
+#ifdef LV_HAVE_SSE
+
+
+static inline void volk_32f_x2_dot_prod_32f_a_sse( float* result, const float* input, const float* taps, unsigned int num_points) {
+
+ unsigned int number = 0;
+ const unsigned int sixteenthPoints = num_points / 16;
+
+ float dotProduct = 0;
+ const float* aPtr = input;
+ const float* bPtr = taps;
+
+ __m128 a0Val, a1Val, a2Val, a3Val;
+ __m128 b0Val, b1Val, b2Val, b3Val;
+ __m128 c0Val, c1Val, c2Val, c3Val;
+
+ __m128 dotProdVal0 = _mm_setzero_ps();
+ __m128 dotProdVal1 = _mm_setzero_ps();
+ __m128 dotProdVal2 = _mm_setzero_ps();
+ __m128 dotProdVal3 = _mm_setzero_ps();
+
+ for(;number < sixteenthPoints; number++){
+
+ a0Val = _mm_load_ps(aPtr);
+ a1Val = _mm_load_ps(aPtr+4);
+ a2Val = _mm_load_ps(aPtr+8);
+ a3Val = _mm_load_ps(aPtr+12);
+ b0Val = _mm_load_ps(bPtr);
+ b1Val = _mm_load_ps(bPtr+4);
+ b2Val = _mm_load_ps(bPtr+8);
+ b3Val = _mm_load_ps(bPtr+12);
+
+ c0Val = _mm_mul_ps(a0Val, b0Val);
+ c1Val = _mm_mul_ps(a1Val, b1Val);
+ c2Val = _mm_mul_ps(a2Val, b2Val);
+ c3Val = _mm_mul_ps(a3Val, b3Val);
+
+ dotProdVal0 = _mm_add_ps(c0Val, dotProdVal0);
+ dotProdVal1 = _mm_add_ps(c1Val, dotProdVal1);
+ dotProdVal2 = _mm_add_ps(c2Val, dotProdVal2);
+ dotProdVal3 = _mm_add_ps(c3Val, dotProdVal3);
+
+ aPtr += 16;
+ bPtr += 16;
+ }
+
+ dotProdVal0 = _mm_add_ps(dotProdVal0, dotProdVal1);
+ dotProdVal0 = _mm_add_ps(dotProdVal0, dotProdVal2);
+ dotProdVal0 = _mm_add_ps(dotProdVal0, dotProdVal3);
+
+ __VOLK_ATTR_ALIGNED(16) float dotProductVector[4];
+
+ _mm_store_ps(dotProductVector,dotProdVal0); // Store the results back into the dot product vector
+
+ dotProduct = dotProductVector[0];
+ dotProduct += dotProductVector[1];
+ dotProduct += dotProductVector[2];
+ dotProduct += dotProductVector[3];
+
+ number = sixteenthPoints*16;
+ for(;number < num_points; number++){
+ dotProduct += ((*aPtr++) * (*bPtr++));
+ }
+
+ *result = dotProduct;
+
+}
+
+#endif /*LV_HAVE_SSE*/
+
+#ifdef LV_HAVE_SSE3
+
+#include <pmmintrin.h>
+
+static inline void volk_32f_x2_dot_prod_32f_a_sse3(float * result, const float * input, const float * taps, unsigned int num_points) {
+ unsigned int number = 0;
+ const unsigned int sixteenthPoints = num_points / 16;
+
+ float dotProduct = 0;
+ const float* aPtr = input;
+ const float* bPtr = taps;
+
+ __m128 a0Val, a1Val, a2Val, a3Val;
+ __m128 b0Val, b1Val, b2Val, b3Val;
+ __m128 c0Val, c1Val, c2Val, c3Val;
+
+ __m128 dotProdVal0 = _mm_setzero_ps();
+ __m128 dotProdVal1 = _mm_setzero_ps();
+ __m128 dotProdVal2 = _mm_setzero_ps();
+ __m128 dotProdVal3 = _mm_setzero_ps();
+
+ for(;number < sixteenthPoints; number++){
+
+ a0Val = _mm_load_ps(aPtr);
+ a1Val = _mm_load_ps(aPtr+4);
+ a2Val = _mm_load_ps(aPtr+8);
+ a3Val = _mm_load_ps(aPtr+12);
+ b0Val = _mm_load_ps(bPtr);
+ b1Val = _mm_load_ps(bPtr+4);
+ b2Val = _mm_load_ps(bPtr+8);
+ b3Val = _mm_load_ps(bPtr+12);
+
+ c0Val = _mm_mul_ps(a0Val, b0Val);
+ c1Val = _mm_mul_ps(a1Val, b1Val);
+ c2Val = _mm_mul_ps(a2Val, b2Val);
+ c3Val = _mm_mul_ps(a3Val, b3Val);
+
+ dotProdVal0 = _mm_add_ps(dotProdVal0, c0Val);
+ dotProdVal1 = _mm_add_ps(dotProdVal1, c1Val);
+ dotProdVal2 = _mm_add_ps(dotProdVal2, c2Val);
+ dotProdVal3 = _mm_add_ps(dotProdVal3, c3Val);
+
+ aPtr += 16;
+ bPtr += 16;
+ }
+
+ dotProdVal0 = _mm_add_ps(dotProdVal0, dotProdVal1);
+ dotProdVal0 = _mm_add_ps(dotProdVal0, dotProdVal2);
+ dotProdVal0 = _mm_add_ps(dotProdVal0, dotProdVal3);
+
+ __VOLK_ATTR_ALIGNED(16) float dotProductVector[4];
+ _mm_store_ps(dotProductVector,dotProdVal0); // Store the results back into the dot product vector
+
+ dotProduct = dotProductVector[0];
+ dotProduct += dotProductVector[1];
+ dotProduct += dotProductVector[2];
+ dotProduct += dotProductVector[3];
+
+ number = sixteenthPoints*16;
+ for(;number < num_points; number++){
+ dotProduct += ((*aPtr++) * (*bPtr++));
+ }
+
+ *result = dotProduct;
+}
+
+#endif /*LV_HAVE_SSE3*/
+
+#ifdef LV_HAVE_SSE4_1
+
+#include <smmintrin.h>
+
+static inline void volk_32f_x2_dot_prod_32f_a_sse4_1(float * result, const float * input, const float* taps, unsigned int num_points) {
+ unsigned int number = 0;
+ const unsigned int sixteenthPoints = num_points / 16;
+
+ float dotProduct = 0;
+ const float* aPtr = input;
+ const float* bPtr = taps;
+
+ __m128 aVal1, bVal1, cVal1;
+ __m128 aVal2, bVal2, cVal2;
+ __m128 aVal3, bVal3, cVal3;
+ __m128 aVal4, bVal4, cVal4;
+
+ __m128 dotProdVal = _mm_setzero_ps();
+
+ for(;number < sixteenthPoints; number++){
+
+ aVal1 = _mm_load_ps(aPtr); aPtr += 4;
+ aVal2 = _mm_load_ps(aPtr); aPtr += 4;
+ aVal3 = _mm_load_ps(aPtr); aPtr += 4;
+ aVal4 = _mm_load_ps(aPtr); aPtr += 4;
+
+ bVal1 = _mm_load_ps(bPtr); bPtr += 4;
+ bVal2 = _mm_load_ps(bPtr); bPtr += 4;
+ bVal3 = _mm_load_ps(bPtr); bPtr += 4;
+ bVal4 = _mm_load_ps(bPtr); bPtr += 4;
+
+ cVal1 = _mm_dp_ps(aVal1, bVal1, 0xF1);
+ cVal2 = _mm_dp_ps(aVal2, bVal2, 0xF2);
+ cVal3 = _mm_dp_ps(aVal3, bVal3, 0xF4);
+ cVal4 = _mm_dp_ps(aVal4, bVal4, 0xF8);
+
+ cVal1 = _mm_or_ps(cVal1, cVal2);
+ cVal3 = _mm_or_ps(cVal3, cVal4);
+ cVal1 = _mm_or_ps(cVal1, cVal3);
+
+ dotProdVal = _mm_add_ps(dotProdVal, cVal1);
+ }
+
+ __VOLK_ATTR_ALIGNED(16) float dotProductVector[4];
+ _mm_store_ps(dotProductVector, dotProdVal); // Store the results back into the dot product vector
+
+ dotProduct = dotProductVector[0];
+ dotProduct += dotProductVector[1];
+ dotProduct += dotProductVector[2];
+ dotProduct += dotProductVector[3];
+
+ number = sixteenthPoints * 16;
+ for(;number < num_points; number++){
+ dotProduct += ((*aPtr++) * (*bPtr++));
+ }
+
+ *result = dotProduct;
+}
+
+#endif /*LV_HAVE_SSE4_1*/
+
+#ifdef LV_HAVE_AVX
+
+#include <immintrin.h>
+
+static inline void volk_32f_x2_dot_prod_32f_a_avx( float* result, const float* input, const float* taps, unsigned int num_points) {
+
+ unsigned int number = 0;
+ const unsigned int sixteenthPoints = num_points / 16;
+
+ float dotProduct = 0;
+ const float* aPtr = input;
+ const float* bPtr = taps;
+
+ __m256 a0Val, a1Val;
+ __m256 b0Val, b1Val;
+ __m256 c0Val, c1Val;
+
+ __m256 dotProdVal0 = _mm256_setzero_ps();
+ __m256 dotProdVal1 = _mm256_setzero_ps();
+
+ for(;number < sixteenthPoints; number++){
+
+ a0Val = _mm256_load_ps(aPtr);
+ a1Val = _mm256_load_ps(aPtr+8);
+ b0Val = _mm256_load_ps(bPtr);
+ b1Val = _mm256_load_ps(bPtr+8);
+
+ c0Val = _mm256_mul_ps(a0Val, b0Val);
+ c1Val = _mm256_mul_ps(a1Val, b1Val);
+
+ dotProdVal0 = _mm256_add_ps(c0Val, dotProdVal0);
+ dotProdVal1 = _mm256_add_ps(c1Val, dotProdVal1);
+
+ aPtr += 16;
+ bPtr += 16;
+ }
+
+ dotProdVal0 = _mm256_add_ps(dotProdVal0, dotProdVal1);
+
+ __VOLK_ATTR_ALIGNED(32) float dotProductVector[8];
+
+ _mm256_store_ps(dotProductVector,dotProdVal0); // Store the results back into the dot product vector
+
+ dotProduct = dotProductVector[0];
+ dotProduct += dotProductVector[1];
+ dotProduct += dotProductVector[2];
+ dotProduct += dotProductVector[3];
+ dotProduct += dotProductVector[4];
+ dotProduct += dotProductVector[5];
+ dotProduct += dotProductVector[6];
+ dotProduct += dotProductVector[7];
+
+ number = sixteenthPoints*16;
+ for(;number < num_points; number++){
+ dotProduct += ((*aPtr++) * (*bPtr++));
+ }
+
+ *result = dotProduct;
+
+}
+
+#endif /*LV_HAVE_AVX*/
+
+#endif /*INCLUDED_volk_32f_x2_dot_prod_32f_a_H*/
diff --git a/volk/kernels/volk/volk_32f_x2_interleave_32fc.h b/volk/kernels/volk/volk_32f_x2_interleave_32fc.h
new file mode 100644
index 000000000..0935cb32b
--- /dev/null
+++ b/volk/kernels/volk/volk_32f_x2_interleave_32fc.h
@@ -0,0 +1,75 @@
+#ifndef INCLUDED_volk_32f_x2_interleave_32fc_a_H
+#define INCLUDED_volk_32f_x2_interleave_32fc_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+/*!
+ \brief Interleaves the I & Q vector data into the complex vector
+ \param iBuffer The I buffer data to be interleaved
+ \param qBuffer The Q buffer data to be interleaved
+ \param complexVector The complex output vector
+ \param num_points The number of complex data values to be interleaved
+*/
+static inline void volk_32f_x2_interleave_32fc_a_sse(lv_32fc_t* complexVector, const float* iBuffer, const float* qBuffer, unsigned int num_points){
+ unsigned int number = 0;
+ float* complexVectorPtr = (float*)complexVector;
+ const float* iBufferPtr = iBuffer;
+ const float* qBufferPtr = qBuffer;
+
+ const uint64_t quarterPoints = num_points / 4;
+
+ __m128 iValue, qValue, cplxValue;
+ for(;number < quarterPoints; number++){
+ iValue = _mm_load_ps(iBufferPtr);
+ qValue = _mm_load_ps(qBufferPtr);
+
+ // Interleaves the lower two values in the i and q variables into one buffer
+ cplxValue = _mm_unpacklo_ps(iValue, qValue);
+ _mm_store_ps(complexVectorPtr, cplxValue);
+ complexVectorPtr += 4;
+
+ // Interleaves the upper two values in the i and q variables into one buffer
+ cplxValue = _mm_unpackhi_ps(iValue, qValue);
+ _mm_store_ps(complexVectorPtr, cplxValue);
+ complexVectorPtr += 4;
+
+ iBufferPtr += 4;
+ qBufferPtr += 4;
+ }
+
+ number = quarterPoints * 4;
+ for(; number < num_points; number++){
+ *complexVectorPtr++ = *iBufferPtr++;
+ *complexVectorPtr++ = *qBufferPtr++;
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Interleaves the I & Q vector data into the complex vector.
+ \param iBuffer The I buffer data to be interleaved
+ \param qBuffer The Q buffer data to be interleaved
+ \param complexVector The complex output vector
+ \param num_points The number of complex data values to be interleaved
+*/
+static inline void volk_32f_x2_interleave_32fc_generic(lv_32fc_t* complexVector, const float* iBuffer, const float* qBuffer, unsigned int num_points){
+ float* complexVectorPtr = (float*)complexVector;
+ const float* iBufferPtr = iBuffer;
+ const float* qBufferPtr = qBuffer;
+ unsigned int number;
+
+ for(number = 0; number < num_points; number++){
+ *complexVectorPtr++ = *iBufferPtr++;
+ *complexVectorPtr++ = *qBufferPtr++;
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_32f_x2_interleave_32fc_a_H */
diff --git a/volk/kernels/volk/volk_32f_x2_max_32f.h b/volk/kernels/volk/volk_32f_x2_max_32f.h
new file mode 100644
index 000000000..27633acae
--- /dev/null
+++ b/volk/kernels/volk/volk_32f_x2_max_32f.h
@@ -0,0 +1,85 @@
+#ifndef INCLUDED_volk_32f_x2_max_32f_a_H
+#define INCLUDED_volk_32f_x2_max_32f_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+/*!
+ \brief Selects maximum value from each entry between bVector and aVector and store their results in the cVector
+ \param cVector The vector where the results will be stored
+ \param aVector The vector to be checked
+ \param bVector The vector to be checked
+ \param num_points The number of values in aVector and bVector to be checked and stored into cVector
+*/
+static inline void volk_32f_x2_max_32f_a_sse(float* cVector, const float* aVector, const float* bVector, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+
+ float* cPtr = cVector;
+ const float* aPtr = aVector;
+ const float* bPtr= bVector;
+
+ __m128 aVal, bVal, cVal;
+ for(;number < quarterPoints; number++){
+
+ aVal = _mm_load_ps(aPtr);
+ bVal = _mm_load_ps(bPtr);
+
+ cVal = _mm_max_ps(aVal, bVal);
+
+ _mm_store_ps(cPtr,cVal); // Store the results back into the C container
+
+ aPtr += 4;
+ bPtr += 4;
+ cPtr += 4;
+ }
+
+ number = quarterPoints * 4;
+ for(;number < num_points; number++){
+ const float a = *aPtr++;
+ const float b = *bPtr++;
+ *cPtr++ = ( a > b ? a : b);
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Selects maximum value from each entry between bVector and aVector and store their results in the cVector
+ \param cVector The vector where the results will be stored
+ \param aVector The vector to be checked
+ \param bVector The vector to be checked
+ \param num_points The number of values in aVector and bVector to be checked and stored into cVector
+*/
+static inline void volk_32f_x2_max_32f_generic(float* cVector, const float* aVector, const float* bVector, unsigned int num_points){
+ float* cPtr = cVector;
+ const float* aPtr = aVector;
+ const float* bPtr= bVector;
+ unsigned int number = 0;
+
+ for(number = 0; number < num_points; number++){
+ const float a = *aPtr++;
+ const float b = *bPtr++;
+ *cPtr++ = ( a > b ? a : b);
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+#ifdef LV_HAVE_ORC
+/*!
+ \brief Selects maximum value from each entry between bVector and aVector and store their results in the cVector
+ \param cVector The vector where the results will be stored
+ \param aVector The vector to be checked
+ \param bVector The vector to be checked
+ \param num_points The number of values in aVector and bVector to be checked and stored into cVector
+*/
+extern void volk_32f_x2_max_32f_a_orc_impl(float* cVector, const float* aVector, const float* bVector, unsigned int num_points);
+static inline void volk_32f_x2_max_32f_u_orc(float* cVector, const float* aVector, const float* bVector, unsigned int num_points){
+ volk_32f_x2_max_32f_a_orc_impl(cVector, aVector, bVector, num_points);
+}
+#endif /* LV_HAVE_ORC */
+
+
+#endif /* INCLUDED_volk_32f_x2_max_32f_a_H */
diff --git a/volk/kernels/volk/volk_32f_x2_min_32f.h b/volk/kernels/volk/volk_32f_x2_min_32f.h
new file mode 100644
index 000000000..4773d1321
--- /dev/null
+++ b/volk/kernels/volk/volk_32f_x2_min_32f.h
@@ -0,0 +1,85 @@
+#ifndef INCLUDED_volk_32f_x2_min_32f_a_H
+#define INCLUDED_volk_32f_x2_min_32f_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+/*!
+ \brief Selects minimum value from each entry between bVector and aVector and store their results in the cVector
+ \param cVector The vector where the results will be stored
+ \param aVector The vector to be checked
+ \param bVector The vector to be checked
+ \param num_points The number of values in aVector and bVector to be checked and stored into cVector
+*/
+static inline void volk_32f_x2_min_32f_a_sse(float* cVector, const float* aVector, const float* bVector, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+
+ float* cPtr = cVector;
+ const float* aPtr = aVector;
+ const float* bPtr= bVector;
+
+ __m128 aVal, bVal, cVal;
+ for(;number < quarterPoints; number++){
+
+ aVal = _mm_load_ps(aPtr);
+ bVal = _mm_load_ps(bPtr);
+
+ cVal = _mm_min_ps(aVal, bVal);
+
+ _mm_store_ps(cPtr,cVal); // Store the results back into the C container
+
+ aPtr += 4;
+ bPtr += 4;
+ cPtr += 4;
+ }
+
+ number = quarterPoints * 4;
+ for(;number < num_points; number++){
+ const float a = *aPtr++;
+ const float b = *bPtr++;
+ *cPtr++ = ( a < b ? a : b);
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Selects minimum value from each entry between bVector and aVector and store their results in the cVector
+ \param cVector The vector where the results will be stored
+ \param aVector The vector to be checked
+ \param bVector The vector to be checked
+ \param num_points The number of values in aVector and bVector to be checked and stored into cVector
+*/
+static inline void volk_32f_x2_min_32f_generic(float* cVector, const float* aVector, const float* bVector, unsigned int num_points){
+ float* cPtr = cVector;
+ const float* aPtr = aVector;
+ const float* bPtr= bVector;
+ unsigned int number = 0;
+
+ for(number = 0; number < num_points; number++){
+ const float a = *aPtr++;
+ const float b = *bPtr++;
+ *cPtr++ = ( a < b ? a : b);
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+#ifdef LV_HAVE_ORC
+/*!
+ \brief Selects minimum value from each entry between bVector and aVector and store their results in the cVector
+ \param cVector The vector where the results will be stored
+ \param aVector The vector to be checked
+ \param bVector The vector to be checked
+ \param num_points The number of values in aVector and bVector to be checked and stored into cVector
+*/
+extern void volk_32f_x2_min_32f_a_orc_impl(float* cVector, const float* aVector, const float* bVector, unsigned int num_points);
+static inline void volk_32f_x2_min_32f_u_orc(float* cVector, const float* aVector, const float* bVector, unsigned int num_points){
+ volk_32f_x2_min_32f_a_orc_impl(cVector, aVector, bVector, num_points);
+}
+#endif /* LV_HAVE_ORC */
+
+
+#endif /* INCLUDED_volk_32f_x2_min_32f_a_H */
diff --git a/volk/kernels/volk/volk_32f_x2_multiply_32f.h b/volk/kernels/volk/volk_32f_x2_multiply_32f.h
new file mode 100644
index 000000000..9fdbec0a2
--- /dev/null
+++ b/volk/kernels/volk/volk_32f_x2_multiply_32f.h
@@ -0,0 +1,226 @@
+#ifndef INCLUDED_volk_32f_x2_multiply_32f_u_H
+#define INCLUDED_volk_32f_x2_multiply_32f_u_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+/*!
+ \brief Multiplys the two input vectors and store their results in the third vector
+ \param cVector The vector where the results will be stored
+ \param aVector One of the vectors to be multiplied
+ \param bVector One of the vectors to be multiplied
+ \param num_points The number of values in aVector and bVector to be multiplied together and stored into cVector
+*/
+static inline void volk_32f_x2_multiply_32f_u_sse(float* cVector, const float* aVector, const float* bVector, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+
+ float* cPtr = cVector;
+ const float* aPtr = aVector;
+ const float* bPtr= bVector;
+
+ __m128 aVal, bVal, cVal;
+ for(;number < quarterPoints; number++){
+
+ aVal = _mm_loadu_ps(aPtr);
+ bVal = _mm_loadu_ps(bPtr);
+
+ cVal = _mm_mul_ps(aVal, bVal);
+
+ _mm_storeu_ps(cPtr,cVal); // Store the results back into the C container
+
+ aPtr += 4;
+ bPtr += 4;
+ cPtr += 4;
+ }
+
+ number = quarterPoints * 4;
+ for(;number < num_points; number++){
+ *cPtr++ = (*aPtr++) * (*bPtr++);
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_AVX
+#include <immintrin.h>
+/*!
+ \brief Multiplies the two input vectors and store their results in the third vector
+ \param cVector The vector where the results will be stored
+ \param aVector One of the vectors to be multiplied
+ \param bVector One of the vectors to be multiplied
+ \param num_points The number of values in aVector and bVector to be multiplied together and stored into cVector
+*/
+static inline void volk_32f_x2_multiply_32f_u_avx(float* cVector, const float* aVector, const float* bVector, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int eighthPoints = num_points / 8;
+
+ float* cPtr = cVector;
+ const float* aPtr = aVector;
+ const float* bPtr= bVector;
+
+ __m256 aVal, bVal, cVal;
+ for(;number < eighthPoints; number++){
+
+ aVal = _mm256_loadu_ps(aPtr);
+ bVal = _mm256_loadu_ps(bPtr);
+
+ cVal = _mm256_mul_ps(aVal, bVal);
+
+ _mm256_storeu_ps(cPtr,cVal); // Store the results back into the C container
+
+ aPtr += 8;
+ bPtr += 8;
+ cPtr += 8;
+ }
+
+ number = eighthPoints * 8;
+ for(;number < num_points; number++){
+ *cPtr++ = (*aPtr++) * (*bPtr++);
+ }
+}
+#endif /* LV_HAVE_AVX */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Multiplys the two input vectors and store their results in the third vector
+ \param cVector The vector where the results will be stored
+ \param aVector One of the vectors to be multiplied
+ \param bVector One of the vectors to be multiplied
+ \param num_points The number of values in aVector and bVector to be multiplied together and stored into cVector
+*/
+static inline void volk_32f_x2_multiply_32f_generic(float* cVector, const float* aVector, const float* bVector, unsigned int num_points){
+ float* cPtr = cVector;
+ const float* aPtr = aVector;
+ const float* bPtr= bVector;
+ unsigned int number = 0;
+
+ for(number = 0; number < num_points; number++){
+ *cPtr++ = (*aPtr++) * (*bPtr++);
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+#endif /* INCLUDED_volk_32f_x2_multiply_32f_u_H */
+#ifndef INCLUDED_volk_32f_x2_multiply_32f_a_H
+#define INCLUDED_volk_32f_x2_multiply_32f_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+/*!
+ \brief Multiplys the two input vectors and store their results in the third vector
+ \param cVector The vector where the results will be stored
+ \param aVector One of the vectors to be multiplied
+ \param bVector One of the vectors to be multiplied
+ \param num_points The number of values in aVector and bVector to be multiplied together and stored into cVector
+*/
+static inline void volk_32f_x2_multiply_32f_a_sse(float* cVector, const float* aVector, const float* bVector, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+
+ float* cPtr = cVector;
+ const float* aPtr = aVector;
+ const float* bPtr= bVector;
+
+ __m128 aVal, bVal, cVal;
+ for(;number < quarterPoints; number++){
+
+ aVal = _mm_load_ps(aPtr);
+ bVal = _mm_load_ps(bPtr);
+
+ cVal = _mm_mul_ps(aVal, bVal);
+
+ _mm_store_ps(cPtr,cVal); // Store the results back into the C container
+
+ aPtr += 4;
+ bPtr += 4;
+ cPtr += 4;
+ }
+
+ number = quarterPoints * 4;
+ for(;number < num_points; number++){
+ *cPtr++ = (*aPtr++) * (*bPtr++);
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_AVX
+#include <immintrin.h>
+/*!
+ \brief Multiplies the two input vectors and store their results in the third vector
+ \param cVector The vector where the results will be stored
+ \param aVector One of the vectors to be multiplied
+ \param bVector One of the vectors to be multiplied
+ \param num_points The number of values in aVector and bVector to be multiplied together and stored into cVector
+*/
+static inline void volk_32f_x2_multiply_32f_a_avx(float* cVector, const float* aVector, const float* bVector, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int eighthPoints = num_points / 8;
+
+ float* cPtr = cVector;
+ const float* aPtr = aVector;
+ const float* bPtr= bVector;
+
+ __m256 aVal, bVal, cVal;
+ for(;number < eighthPoints; number++){
+
+ aVal = _mm256_load_ps(aPtr);
+ bVal = _mm256_load_ps(bPtr);
+
+ cVal = _mm256_mul_ps(aVal, bVal);
+
+ _mm256_store_ps(cPtr,cVal); // Store the results back into the C container
+
+ aPtr += 8;
+ bPtr += 8;
+ cPtr += 8;
+ }
+
+ number = eighthPoints * 8;
+ for(;number < num_points; number++){
+ *cPtr++ = (*aPtr++) * (*bPtr++);
+ }
+}
+#endif /* LV_HAVE_AVX */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Multiplys the two input vectors and store their results in the third vector
+ \param cVector The vector where the results will be stored
+ \param aVector One of the vectors to be multiplied
+ \param bVector One of the vectors to be multiplied
+ \param num_points The number of values in aVector and bVector to be multiplied together and stored into cVector
+*/
+static inline void volk_32f_x2_multiply_32f_a_generic(float* cVector, const float* aVector, const float* bVector, unsigned int num_points){
+ float* cPtr = cVector;
+ const float* aPtr = aVector;
+ const float* bPtr= bVector;
+ unsigned int number = 0;
+
+ for(number = 0; number < num_points; number++){
+ *cPtr++ = (*aPtr++) * (*bPtr++);
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+#ifdef LV_HAVE_ORC
+/*!
+ \brief Multiplys the two input vectors and store their results in the third vector
+ \param cVector The vector where the results will be stored
+ \param aVector One of the vectors to be multiplied
+ \param bVector One of the vectors to be multiplied
+ \param num_points The number of values in aVector and bVector to be multiplied together and stored into cVector
+*/
+extern void volk_32f_x2_multiply_32f_a_orc_impl(float* cVector, const float* aVector, const float* bVector, unsigned int num_points);
+static inline void volk_32f_x2_multiply_32f_u_orc(float* cVector, const float* aVector, const float* bVector, unsigned int num_points){
+ volk_32f_x2_multiply_32f_a_orc_impl(cVector, aVector, bVector, num_points);
+}
+#endif /* LV_HAVE_ORC */
+
+
+#endif /* INCLUDED_volk_32f_x2_multiply_32f_a_H */
diff --git a/volk/kernels/volk/volk_32f_x2_s32f_interleave_16ic.h b/volk/kernels/volk/volk_32f_x2_s32f_interleave_16ic.h
new file mode 100644
index 000000000..ce7b91a31
--- /dev/null
+++ b/volk/kernels/volk/volk_32f_x2_s32f_interleave_16ic.h
@@ -0,0 +1,156 @@
+#ifndef INCLUDED_volk_32f_x2_s32f_interleave_16ic_a_H
+#define INCLUDED_volk_32f_x2_s32f_interleave_16ic_a_H
+
+#include <volk/volk_common.h>
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE2
+#include <emmintrin.h>
+ /*!
+ \brief Interleaves the I & Q vector data into the complex vector, scales the output values by the scalar, and converts to 16 bit data.
+ \param iBuffer The I buffer data to be interleaved
+ \param qBuffer The Q buffer data to be interleaved
+ \param complexVector The complex output vector
+ \param scalar The scaling value being multiplied against each data point
+ \param num_points The number of complex data values to be interleaved
+ */
+static inline void volk_32f_x2_s32f_interleave_16ic_a_sse2(lv_16sc_t* complexVector, const float* iBuffer, const float* qBuffer, const float scalar, unsigned int num_points){
+ unsigned int number = 0;
+ const float* iBufferPtr = iBuffer;
+ const float* qBufferPtr = qBuffer;
+
+ __m128 vScalar = _mm_set_ps1(scalar);
+
+ const unsigned int quarterPoints = num_points / 4;
+
+ __m128 iValue, qValue, cplxValue1, cplxValue2;
+ __m128i intValue1, intValue2;
+
+ int16_t* complexVectorPtr = (int16_t*)complexVector;
+
+ for(;number < quarterPoints; number++){
+ iValue = _mm_load_ps(iBufferPtr);
+ qValue = _mm_load_ps(qBufferPtr);
+
+ // Interleaves the lower two values in the i and q variables into one buffer
+ cplxValue1 = _mm_unpacklo_ps(iValue, qValue);
+ cplxValue1 = _mm_mul_ps(cplxValue1, vScalar);
+
+ // Interleaves the upper two values in the i and q variables into one buffer
+ cplxValue2 = _mm_unpackhi_ps(iValue, qValue);
+ cplxValue2 = _mm_mul_ps(cplxValue2, vScalar);
+
+ intValue1 = _mm_cvtps_epi32(cplxValue1);
+ intValue2 = _mm_cvtps_epi32(cplxValue2);
+
+ intValue1 = _mm_packs_epi32(intValue1, intValue2);
+
+ _mm_store_si128((__m128i*)complexVectorPtr, intValue1);
+ complexVectorPtr += 8;
+
+ iBufferPtr += 4;
+ qBufferPtr += 4;
+ }
+
+ number = quarterPoints * 4;
+ complexVectorPtr = (int16_t*)(&complexVector[number]);
+ for(; number < num_points; number++){
+ *complexVectorPtr++ = (int16_t)(*iBufferPtr++ * scalar);
+ *complexVectorPtr++ = (int16_t)(*qBufferPtr++ * scalar);
+ }
+
+}
+#endif /* LV_HAVE_SSE2 */
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+ /*!
+ \brief Interleaves the I & Q vector data into the complex vector, scales the output values by the scalar, and converts to 16 bit data.
+ \param iBuffer The I buffer data to be interleaved
+ \param qBuffer The Q buffer data to be interleaved
+ \param complexVector The complex output vector
+ \param scalar The scaling value being multiplied against each data point
+ \param num_points The number of complex data values to be interleaved
+ */
+static inline void volk_32f_x2_s32f_interleave_16ic_a_sse(lv_16sc_t* complexVector, const float* iBuffer, const float* qBuffer, const float scalar, unsigned int num_points){
+ unsigned int number = 0;
+ const float* iBufferPtr = iBuffer;
+ const float* qBufferPtr = qBuffer;
+
+ __m128 vScalar = _mm_set_ps1(scalar);
+
+ const unsigned int quarterPoints = num_points / 4;
+
+ __m128 iValue, qValue, cplxValue;
+
+ int16_t* complexVectorPtr = (int16_t*)complexVector;
+
+ __VOLK_ATTR_ALIGNED(16) float floatBuffer[4];
+
+ for(;number < quarterPoints; number++){
+ iValue = _mm_load_ps(iBufferPtr);
+ qValue = _mm_load_ps(qBufferPtr);
+
+ // Interleaves the lower two values in the i and q variables into one buffer
+ cplxValue = _mm_unpacklo_ps(iValue, qValue);
+ cplxValue = _mm_mul_ps(cplxValue, vScalar);
+
+ _mm_store_ps(floatBuffer, cplxValue);
+
+ *complexVectorPtr++ = (int16_t)(floatBuffer[0]);
+ *complexVectorPtr++ = (int16_t)(floatBuffer[1]);
+ *complexVectorPtr++ = (int16_t)(floatBuffer[2]);
+ *complexVectorPtr++ = (int16_t)(floatBuffer[3]);
+
+ // Interleaves the upper two values in the i and q variables into one buffer
+ cplxValue = _mm_unpackhi_ps(iValue, qValue);
+ cplxValue = _mm_mul_ps(cplxValue, vScalar);
+
+ _mm_store_ps(floatBuffer, cplxValue);
+
+ *complexVectorPtr++ = (int16_t)(floatBuffer[0]);
+ *complexVectorPtr++ = (int16_t)(floatBuffer[1]);
+ *complexVectorPtr++ = (int16_t)(floatBuffer[2]);
+ *complexVectorPtr++ = (int16_t)(floatBuffer[3]);
+
+ iBufferPtr += 4;
+ qBufferPtr += 4;
+ }
+
+ number = quarterPoints * 4;
+ complexVectorPtr = (int16_t*)(&complexVector[number]);
+ for(; number < num_points; number++){
+ *complexVectorPtr++ = (int16_t)(*iBufferPtr++ * scalar);
+ *complexVectorPtr++ = (int16_t)(*qBufferPtr++ * scalar);
+ }
+
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+ /*!
+ \brief Interleaves the I & Q vector data into the complex vector, scales the output values by the scalar, and converts to 16 bit data.
+ \param iBuffer The I buffer data to be interleaved
+ \param qBuffer The Q buffer data to be interleaved
+ \param complexVector The complex output vector
+ \param scalar The scaling value being multiplied against each data point
+ \param num_points The number of complex data values to be interleaved
+ */
+static inline void volk_32f_x2_s32f_interleave_16ic_generic(lv_16sc_t* complexVector, const float* iBuffer, const float* qBuffer, const float scalar, unsigned int num_points){
+ int16_t* complexVectorPtr = (int16_t*)complexVector;
+ const float* iBufferPtr = iBuffer;
+ const float* qBufferPtr = qBuffer;
+ unsigned int number = 0;
+
+ for(number = 0; number < num_points; number++){
+ *complexVectorPtr++ = (int16_t)(*iBufferPtr++ * scalar);
+ *complexVectorPtr++ = (int16_t)(*qBufferPtr++ * scalar);
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_32f_x2_s32f_interleave_16ic_a_H */
diff --git a/volk/kernels/volk/volk_32f_x2_subtract_32f.h b/volk/kernels/volk/volk_32f_x2_subtract_32f.h
new file mode 100644
index 000000000..8ea491f98
--- /dev/null
+++ b/volk/kernels/volk/volk_32f_x2_subtract_32f.h
@@ -0,0 +1,81 @@
+#ifndef INCLUDED_volk_32f_x2_subtract_32f_a_H
+#define INCLUDED_volk_32f_x2_subtract_32f_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+/*!
+ \brief Subtracts bVector form aVector and store their results in the cVector
+ \param cVector The vector where the results will be stored
+ \param aVector The initial vector
+ \param bVector The vector to be subtracted
+ \param num_points The number of values in aVector and bVector to be subtracted together and stored into cVector
+*/
+static inline void volk_32f_x2_subtract_32f_a_sse(float* cVector, const float* aVector, const float* bVector, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+
+ float* cPtr = cVector;
+ const float* aPtr = aVector;
+ const float* bPtr= bVector;
+
+ __m128 aVal, bVal, cVal;
+ for(;number < quarterPoints; number++){
+
+ aVal = _mm_load_ps(aPtr);
+ bVal = _mm_load_ps(bPtr);
+
+ cVal = _mm_sub_ps(aVal, bVal);
+
+ _mm_store_ps(cPtr,cVal); // Store the results back into the C container
+
+ aPtr += 4;
+ bPtr += 4;
+ cPtr += 4;
+ }
+
+ number = quarterPoints * 4;
+ for(;number < num_points; number++){
+ *cPtr++ = (*aPtr++) - (*bPtr++);
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Subtracts bVector form aVector and store their results in the cVector
+ \param cVector The vector where the results will be stored
+ \param aVector The initial vector
+ \param bVector The vector to be subtracted
+ \param num_points The number of values in aVector and bVector to be subtracted together and stored into cVector
+*/
+static inline void volk_32f_x2_subtract_32f_generic(float* cVector, const float* aVector, const float* bVector, unsigned int num_points){
+ float* cPtr = cVector;
+ const float* aPtr = aVector;
+ const float* bPtr= bVector;
+ unsigned int number = 0;
+
+ for(number = 0; number < num_points; number++){
+ *cPtr++ = (*aPtr++) - (*bPtr++);
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+#ifdef LV_HAVE_ORC
+/*!
+ \brief Subtracts bVector form aVector and store their results in the cVector
+ \param cVector The vector where the results will be stored
+ \param aVector The initial vector
+ \param bVector The vector to be subtracted
+ \param num_points The number of values in aVector and bVector to be subtracted together and stored into cVector
+*/
+extern void volk_32f_x2_subtract_32f_a_orc_impl(float* cVector, const float* aVector, const float* bVector, unsigned int num_points);
+static inline void volk_32f_x2_subtract_32f_u_orc(float* cVector, const float* aVector, const float* bVector, unsigned int num_points){
+ volk_32f_x2_subtract_32f_a_orc_impl(cVector, aVector, bVector, num_points);
+}
+#endif /* LV_HAVE_ORC */
+
+
+#endif /* INCLUDED_volk_32f_x2_subtract_32f_a_H */
diff --git a/volk/kernels/volk/volk_32f_x3_sum_of_poly_32f.h b/volk/kernels/volk/volk_32f_x3_sum_of_poly_32f.h
new file mode 100644
index 000000000..e975f14e9
--- /dev/null
+++ b/volk/kernels/volk/volk_32f_x3_sum_of_poly_32f.h
@@ -0,0 +1,152 @@
+#ifndef INCLUDED_volk_32f_x3_sum_of_poly_32f_a_H
+#define INCLUDED_volk_32f_x3_sum_of_poly_32f_a_H
+
+#include<inttypes.h>
+#include<stdio.h>
+#include<volk/volk_complex.h>
+
+#ifndef MAX
+#define MAX(X,Y) ((X) > (Y)?(X):(Y))
+#endif
+
+#ifdef LV_HAVE_SSE3
+#include<xmmintrin.h>
+#include<pmmintrin.h>
+
+static inline void volk_32f_x3_sum_of_poly_32f_a_sse3(float* target, float* src0, float* center_point_array, float* cutoff, unsigned int num_points) {
+
+ const unsigned int num_bytes = num_points*4;
+
+ float result = 0.0;
+ float fst = 0.0;
+ float sq = 0.0;
+ float thrd = 0.0;
+ float frth = 0.0;
+ //float fith = 0.0;
+
+
+
+ __m128 xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, xmm8, xmm9, xmm10;// xmm11, xmm12;
+
+ xmm9 = _mm_setzero_ps();
+ xmm1 = _mm_setzero_ps();
+
+ xmm0 = _mm_load1_ps(&center_point_array[0]);
+ xmm6 = _mm_load1_ps(&center_point_array[1]);
+ xmm7 = _mm_load1_ps(&center_point_array[2]);
+ xmm8 = _mm_load1_ps(&center_point_array[3]);
+ //xmm11 = _mm_load1_ps(&center_point_array[4]);
+ xmm10 = _mm_load1_ps(cutoff);
+
+ int bound = num_bytes >> 4;
+ int leftovers = (num_bytes >> 2) & 3;
+ int i = 0;
+
+ for(; i < bound; ++i) {
+ xmm2 = _mm_load_ps(src0);
+ xmm2 = _mm_max_ps(xmm10, xmm2);
+ xmm3 = _mm_mul_ps(xmm2, xmm2);
+ xmm4 = _mm_mul_ps(xmm2, xmm3);
+ xmm5 = _mm_mul_ps(xmm3, xmm3);
+ //xmm12 = _mm_mul_ps(xmm3, xmm4);
+
+ xmm2 = _mm_mul_ps(xmm2, xmm0);
+ xmm3 = _mm_mul_ps(xmm3, xmm6);
+ xmm4 = _mm_mul_ps(xmm4, xmm7);
+ xmm5 = _mm_mul_ps(xmm5, xmm8);
+ //xmm12 = _mm_mul_ps(xmm12, xmm11);
+
+ xmm2 = _mm_add_ps(xmm2, xmm3);
+ xmm3 = _mm_add_ps(xmm4, xmm5);
+
+ src0 += 4;
+
+ xmm9 = _mm_add_ps(xmm2, xmm9);
+
+ xmm1 = _mm_add_ps(xmm3, xmm1);
+
+ //xmm9 = _mm_add_ps(xmm12, xmm9);
+ }
+
+ xmm2 = _mm_hadd_ps(xmm9, xmm1);
+ xmm3 = _mm_hadd_ps(xmm2, xmm2);
+ xmm4 = _mm_hadd_ps(xmm3, xmm3);
+
+ _mm_store_ss(&result, xmm4);
+
+
+
+ for(i = 0; i < leftovers; ++i) {
+ fst = src0[i];
+ fst = MAX(fst, *cutoff);
+ sq = fst * fst;
+ thrd = fst * sq;
+ frth = sq * sq;
+ //fith = sq * thrd;
+
+ result += (center_point_array[0] * fst +
+ center_point_array[1] * sq +
+ center_point_array[2] * thrd +
+ center_point_array[3] * frth);// +
+ //center_point_array[4] * fith);
+ }
+
+ result += ((float)((bound * 4) + leftovers)) * center_point_array[4]; //center_point_array[5];
+
+ target[0] = result;
+}
+
+
+#endif /*LV_HAVE_SSE3*/
+
+#ifdef LV_HAVE_GENERIC
+
+static inline void volk_32f_x3_sum_of_poly_32f_generic(float* target, float* src0, float* center_point_array, float* cutoff, unsigned int num_points) {
+
+ const unsigned int num_bytes = num_points*4;
+
+ float result = 0.0;
+ float fst = 0.0;
+ float sq = 0.0;
+ float thrd = 0.0;
+ float frth = 0.0;
+ //float fith = 0.0;
+
+
+
+ unsigned int i = 0;
+
+ for(; i < num_bytes >> 2; ++i) {
+ fst = src0[i];
+ fst = MAX(fst, *cutoff);
+
+ sq = fst * fst;
+ thrd = fst * sq;
+ frth = sq * sq;
+ //fith = sq * thrd;
+
+ result += (center_point_array[0] * fst +
+ center_point_array[1] * sq +
+ center_point_array[2] * thrd +
+ center_point_array[3] * frth); //+
+ //center_point_array[4] * fith);
+ /*printf("%f12...%d\n", (center_point_array[0] * fst +
+ center_point_array[1] * sq +
+ center_point_array[2] * thrd +
+ center_point_array[3] * frth) +
+ //center_point_array[4] * fith) +
+ (center_point_array[4]), i);
+ */
+ }
+
+ result += ((float)(num_bytes >> 2)) * (center_point_array[4]);//(center_point_array[5]);
+
+
+
+ *target = result;
+}
+
+#endif /*LV_HAVE_GENERIC*/
+
+
+#endif /*INCLUDED_volk_32f_x3_sum_of_poly_32f_a_H*/
diff --git a/volk/kernels/volk/volk_32fc_32f_dot_prod_32fc.h b/volk/kernels/volk/volk_32fc_32f_dot_prod_32fc.h
new file mode 100644
index 000000000..e0a8a59ce
--- /dev/null
+++ b/volk/kernels/volk/volk_32fc_32f_dot_prod_32fc.h
@@ -0,0 +1,111 @@
+#ifndef INCLUDED_volk_32fc_32f_dot_prod_32fc_a_H
+#define INCLUDED_volk_32fc_32f_dot_prod_32fc_a_H
+
+#include <volk/volk_common.h>
+#include<stdio.h>
+
+
+#ifdef LV_HAVE_GENERIC
+
+
+static inline void volk_32fc_32f_dot_prod_32fc_generic(lv_32fc_t* result, const lv_32fc_t* input, const float * taps, unsigned int num_points) {
+
+ float res[2];
+ float *realpt = &res[0], *imagpt = &res[1];
+ const float* aPtr = (float*)input;
+ const float* bPtr= taps;
+ unsigned int number = 0;
+
+ *realpt = 0;
+ *imagpt = 0;
+
+ for(number = 0; number < num_points; number++){
+ *realpt += ((*aPtr++) * (*bPtr));
+ *imagpt += ((*aPtr++) * (*bPtr++));
+ }
+
+ *result = *(lv_32fc_t*)(&res[0]);
+}
+
+#endif /*LV_HAVE_GENERIC*/
+
+
+#ifdef LV_HAVE_SSE
+
+
+static inline void volk_32fc_32f_dot_prod_32fc_a_sse( lv_32fc_t* result, const lv_32fc_t* input, const float* taps, unsigned int num_points) {
+
+ unsigned int number = 0;
+ const unsigned int sixteenthPoints = num_points / 8;
+
+ float res[2];
+ float *realpt = &res[0], *imagpt = &res[1];
+ const float* aPtr = (float*)input;
+ const float* bPtr = taps;
+
+ __m128 a0Val, a1Val, a2Val, a3Val;
+ __m128 b0Val, b1Val, b2Val, b3Val;
+ __m128 x0Val, x1Val, x2Val, x3Val;
+ __m128 c0Val, c1Val, c2Val, c3Val;
+
+ __m128 dotProdVal0 = _mm_setzero_ps();
+ __m128 dotProdVal1 = _mm_setzero_ps();
+ __m128 dotProdVal2 = _mm_setzero_ps();
+ __m128 dotProdVal3 = _mm_setzero_ps();
+
+ for(;number < sixteenthPoints; number++){
+
+ a0Val = _mm_load_ps(aPtr);
+ a1Val = _mm_load_ps(aPtr+4);
+ a2Val = _mm_load_ps(aPtr+8);
+ a3Val = _mm_load_ps(aPtr+12);
+
+ x0Val = _mm_load_ps(bPtr);
+ x1Val = _mm_load_ps(bPtr);
+ x2Val = _mm_load_ps(bPtr+4);
+ x3Val = _mm_load_ps(bPtr+4);
+ b0Val = _mm_unpacklo_ps(x0Val, x1Val);
+ b1Val = _mm_unpackhi_ps(x0Val, x1Val);
+ b2Val = _mm_unpacklo_ps(x2Val, x3Val);
+ b3Val = _mm_unpackhi_ps(x2Val, x3Val);
+
+ c0Val = _mm_mul_ps(a0Val, b0Val);
+ c1Val = _mm_mul_ps(a1Val, b1Val);
+ c2Val = _mm_mul_ps(a2Val, b2Val);
+ c3Val = _mm_mul_ps(a3Val, b3Val);
+
+ dotProdVal0 = _mm_add_ps(c0Val, dotProdVal0);
+ dotProdVal1 = _mm_add_ps(c1Val, dotProdVal1);
+ dotProdVal2 = _mm_add_ps(c2Val, dotProdVal2);
+ dotProdVal3 = _mm_add_ps(c3Val, dotProdVal3);
+
+ aPtr += 16;
+ bPtr += 8;
+ }
+
+ dotProdVal0 = _mm_add_ps(dotProdVal0, dotProdVal1);
+ dotProdVal0 = _mm_add_ps(dotProdVal0, dotProdVal2);
+ dotProdVal0 = _mm_add_ps(dotProdVal0, dotProdVal3);
+
+ __VOLK_ATTR_ALIGNED(16) float dotProductVector[4];
+
+ _mm_store_ps(dotProductVector,dotProdVal0); // Store the results back into the dot product vector
+
+ *realpt = dotProductVector[0];
+ *imagpt = dotProductVector[1];
+ *realpt += dotProductVector[2];
+ *imagpt += dotProductVector[3];
+
+ number = sixteenthPoints*8;
+ for(;number < num_points; number++){
+ *realpt += ((*aPtr++) * (*bPtr));
+ *imagpt += ((*aPtr++) * (*bPtr++));
+ }
+
+ *result = *(lv_32fc_t*)(&res[0]);
+}
+
+#endif /*LV_HAVE_SSE*/
+
+
+#endif /*INCLUDED_volk_32fc_32f_dot_prod_32fc_a_H*/
diff --git a/volk/kernels/volk/volk_32fc_32f_multiply_32fc.h b/volk/kernels/volk/volk_32fc_32f_multiply_32fc.h
new file mode 100644
index 000000000..104e3250e
--- /dev/null
+++ b/volk/kernels/volk/volk_32fc_32f_multiply_32fc.h
@@ -0,0 +1,95 @@
+#ifndef INCLUDED_volk_32fc_32f_multiply_32fc_a_H
+#define INCLUDED_volk_32fc_32f_multiply_32fc_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+ /*!
+ \brief Multiplies the input complex vector with the input float vector and store their results in the third vector
+ \param cVector The vector where the results will be stored
+ \param aVector The complex vector to be multiplied
+ \param bVector The vectors containing the float values to be multiplied against each complex value in aVector
+ \param num_points The number of values in aVector and bVector to be multiplied together and stored into cVector
+ */
+static inline void volk_32fc_32f_multiply_32fc_a_sse(lv_32fc_t* cVector, const lv_32fc_t* aVector, const float* bVector, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+
+ lv_32fc_t* cPtr = cVector;
+ const lv_32fc_t* aPtr = aVector;
+ const float* bPtr= bVector;
+
+ __m128 aVal1, aVal2, bVal, bVal1, bVal2, cVal;
+ for(;number < quarterPoints; number++){
+
+ aVal1 = _mm_load_ps((const float*)aPtr);
+ aPtr += 2;
+
+ aVal2 = _mm_load_ps((const float*)aPtr);
+ aPtr += 2;
+
+ bVal = _mm_load_ps(bPtr);
+ bPtr += 4;
+
+ bVal1 = _mm_shuffle_ps(bVal, bVal, _MM_SHUFFLE(1,1,0,0));
+ bVal2 = _mm_shuffle_ps(bVal, bVal, _MM_SHUFFLE(3,3,2,2));
+
+ cVal = _mm_mul_ps(aVal1, bVal1);
+
+ _mm_store_ps((float*)cPtr,cVal); // Store the results back into the C container
+ cPtr += 2;
+
+ cVal = _mm_mul_ps(aVal2, bVal2);
+
+ _mm_store_ps((float*)cPtr,cVal); // Store the results back into the C container
+
+ cPtr += 2;
+ }
+
+ number = quarterPoints * 4;
+ for(;number < num_points; number++){
+ *cPtr++ = (*aPtr++) * (*bPtr);
+ bPtr++;
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+ /*!
+ \brief Multiplies the input complex vector with the input lv_32fc_t vector and store their results in the third vector
+ \param cVector The vector where the results will be stored
+ \param aVector The complex vector to be multiplied
+ \param bVector The vectors containing the lv_32fc_t values to be multiplied against each complex value in aVector
+ \param num_points The number of values in aVector and bVector to be multiplied together and stored into cVector
+ */
+static inline void volk_32fc_32f_multiply_32fc_generic(lv_32fc_t* cVector, const lv_32fc_t* aVector, const float* bVector, unsigned int num_points){
+ lv_32fc_t* cPtr = cVector;
+ const lv_32fc_t* aPtr = aVector;
+ const float* bPtr= bVector;
+ unsigned int number = 0;
+
+ for(number = 0; number < num_points; number++){
+ *cPtr++ = (*aPtr++) * (*bPtr++);
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+#ifdef LV_HAVE_ORC
+ /*!
+ \brief Multiplies the input complex vector with the input lv_32fc_t vector and store their results in the third vector
+ \param cVector The vector where the results will be stored
+ \param aVector The complex vector to be multiplied
+ \param bVector The vectors containing the lv_32fc_t values to be multiplied against each complex value in aVector
+ \param num_points The number of values in aVector and bVector to be multiplied together and stored into cVector
+ */
+extern void volk_32fc_32f_multiply_32fc_a_orc_impl(lv_32fc_t* cVector, const lv_32fc_t* aVector, const float* bVector, unsigned int num_points);
+static inline void volk_32fc_32f_multiply_32fc_u_orc(lv_32fc_t* cVector, const lv_32fc_t* aVector, const float* bVector, unsigned int num_points){
+ volk_32fc_32f_multiply_32fc_a_orc_impl(cVector, aVector, bVector, num_points);
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+#endif /* INCLUDED_volk_32fc_32f_multiply_32fc_a_H */
diff --git a/volk/kernels/volk/volk_32fc_conjugate_32fc.h b/volk/kernels/volk/volk_32fc_conjugate_32fc.h
new file mode 100644
index 000000000..dce897ff5
--- /dev/null
+++ b/volk/kernels/volk/volk_32fc_conjugate_32fc.h
@@ -0,0 +1,128 @@
+#ifndef INCLUDED_volk_32fc_conjugate_32fc_u_H
+#define INCLUDED_volk_32fc_conjugate_32fc_u_H
+
+#include <inttypes.h>
+#include <stdio.h>
+#include <volk/volk_complex.h>
+#include <float.h>
+
+#ifdef LV_HAVE_SSE3
+#include <pmmintrin.h>
+ /*!
+ \brief Takes the conjugate of a complex vector.
+ \param cVector The vector where the results will be stored
+ \param aVector Vector to be conjugated
+ \param num_points The number of complex values in aVector to be conjugated and stored into cVector
+ */
+static inline void volk_32fc_conjugate_32fc_u_sse3(lv_32fc_t* cVector, const lv_32fc_t* aVector, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int halfPoints = num_points / 2;
+
+ __m128 x;
+ lv_32fc_t* c = cVector;
+ const lv_32fc_t* a = aVector;
+
+ __m128 conjugator = _mm_setr_ps(0, -0.f, 0, -0.f);
+
+ for(;number < halfPoints; number++){
+
+ x = _mm_loadu_ps((float*)a); // Load the complex data as ar,ai,br,bi
+
+ x = _mm_xor_ps(x, conjugator); // conjugate register
+
+ _mm_storeu_ps((float*)c,x); // Store the results back into the C container
+
+ a += 2;
+ c += 2;
+ }
+
+ if((num_points % 2) != 0) {
+ *c = lv_conj(*a);
+ }
+}
+#endif /* LV_HAVE_SSE3 */
+
+#ifdef LV_HAVE_GENERIC
+ /*!
+ \brief Takes the conjugate of a complex vector.
+ \param cVector The vector where the results will be stored
+ \param aVector Vector to be conjugated
+ \param num_points The number of complex values in aVector to be conjugated and stored into cVector
+ */
+static inline void volk_32fc_conjugate_32fc_generic(lv_32fc_t* cVector, const lv_32fc_t* aVector, unsigned int num_points){
+ lv_32fc_t* cPtr = cVector;
+ const lv_32fc_t* aPtr = aVector;
+ unsigned int number = 0;
+
+ for(number = 0; number < num_points; number++){
+ *cPtr++ = lv_conj(*aPtr++);
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+#endif /* INCLUDED_volk_32fc_conjugate_32fc_u_H */
+#ifndef INCLUDED_volk_32fc_conjugate_32fc_a_H
+#define INCLUDED_volk_32fc_conjugate_32fc_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+#include <volk/volk_complex.h>
+#include <float.h>
+
+#ifdef LV_HAVE_SSE3
+#include <pmmintrin.h>
+ /*!
+ \brief Takes the conjugate of a complex vector.
+ \param cVector The vector where the results will be stored
+ \param aVector Vector to be conjugated
+ \param num_points The number of complex values in aVector to be conjugated and stored into cVector
+ */
+static inline void volk_32fc_conjugate_32fc_a_sse3(lv_32fc_t* cVector, const lv_32fc_t* aVector, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int halfPoints = num_points / 2;
+
+ __m128 x;
+ lv_32fc_t* c = cVector;
+ const lv_32fc_t* a = aVector;
+
+ __m128 conjugator = _mm_setr_ps(0, -0.f, 0, -0.f);
+
+ for(;number < halfPoints; number++){
+
+ x = _mm_load_ps((float*)a); // Load the complex data as ar,ai,br,bi
+
+ x = _mm_xor_ps(x, conjugator); // conjugate register
+
+ _mm_store_ps((float*)c,x); // Store the results back into the C container
+
+ a += 2;
+ c += 2;
+ }
+
+ if((num_points % 2) != 0) {
+ *c = lv_conj(*a);
+ }
+}
+#endif /* LV_HAVE_SSE3 */
+
+#ifdef LV_HAVE_GENERIC
+ /*!
+ \brief Takes the conjugate of a complex vector.
+ \param cVector The vector where the results will be stored
+ \param aVector Vector to be conjugated
+ \param num_points The number of complex values in aVector to be conjugated and stored into cVector
+ */
+static inline void volk_32fc_conjugate_32fc_a_generic(lv_32fc_t* cVector, const lv_32fc_t* aVector, unsigned int num_points){
+ lv_32fc_t* cPtr = cVector;
+ const lv_32fc_t* aPtr = aVector;
+ unsigned int number = 0;
+
+ for(number = 0; number < num_points; number++){
+ *cPtr++ = lv_conj(*aPtr++);
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+#endif /* INCLUDED_volk_32fc_conjugate_32fc_a_H */
diff --git a/volk/kernels/volk/volk_32fc_deinterleave_32f_x2.h b/volk/kernels/volk/volk_32fc_deinterleave_32f_x2.h
new file mode 100644
index 000000000..0d33ed7e2
--- /dev/null
+++ b/volk/kernels/volk/volk_32fc_deinterleave_32f_x2.h
@@ -0,0 +1,75 @@
+#ifndef INCLUDED_volk_32fc_deinterleave_32f_x2_a_H
+#define INCLUDED_volk_32fc_deinterleave_32f_x2_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+/*!
+ \brief Deinterleaves the complex vector into I & Q vector data
+ \param complexVector The complex input vector
+ \param iBuffer The I buffer output data
+ \param qBuffer The Q buffer output data
+ \param num_points The number of complex data values to be deinterleaved
+*/
+static inline void volk_32fc_deinterleave_32f_x2_a_sse(float* iBuffer, float* qBuffer, const lv_32fc_t* complexVector, unsigned int num_points){
+ const float* complexVectorPtr = (float*)complexVector;
+ float* iBufferPtr = iBuffer;
+ float* qBufferPtr = qBuffer;
+
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+ __m128 cplxValue1, cplxValue2, iValue, qValue;
+ for(;number < quarterPoints; number++){
+
+ cplxValue1 = _mm_load_ps(complexVectorPtr);
+ complexVectorPtr += 4;
+
+ cplxValue2 = _mm_load_ps(complexVectorPtr);
+ complexVectorPtr += 4;
+
+ // Arrange in i1i2i3i4 format
+ iValue = _mm_shuffle_ps(cplxValue1, cplxValue2, _MM_SHUFFLE(2,0,2,0));
+ // Arrange in q1q2q3q4 format
+ qValue = _mm_shuffle_ps(cplxValue1, cplxValue2, _MM_SHUFFLE(3,1,3,1));
+
+ _mm_store_ps(iBufferPtr, iValue);
+ _mm_store_ps(qBufferPtr, qValue);
+
+ iBufferPtr += 4;
+ qBufferPtr += 4;
+ }
+
+ number = quarterPoints * 4;
+ for(; number < num_points; number++){
+ *iBufferPtr++ = *complexVectorPtr++;
+ *qBufferPtr++ = *complexVectorPtr++;
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Deinterleaves the complex vector into I & Q vector data
+ \param complexVector The complex input vector
+ \param iBuffer The I buffer output data
+ \param qBuffer The Q buffer output data
+ \param num_points The number of complex data values to be deinterleaved
+*/
+static inline void volk_32fc_deinterleave_32f_x2_generic(float* iBuffer, float* qBuffer, const lv_32fc_t* complexVector, unsigned int num_points){
+ const float* complexVectorPtr = (float*)complexVector;
+ float* iBufferPtr = iBuffer;
+ float* qBufferPtr = qBuffer;
+ unsigned int number;
+ for(number = 0; number < num_points; number++){
+ *iBufferPtr++ = *complexVectorPtr++;
+ *qBufferPtr++ = *complexVectorPtr++;
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_32fc_deinterleave_32f_x2_a_H */
diff --git a/volk/kernels/volk/volk_32fc_deinterleave_64f_x2.h b/volk/kernels/volk/volk_32fc_deinterleave_64f_x2.h
new file mode 100644
index 000000000..4a4c5509b
--- /dev/null
+++ b/volk/kernels/volk/volk_32fc_deinterleave_64f_x2.h
@@ -0,0 +1,156 @@
+#ifndef INCLUDED_volk_32fc_deinterleave_64f_x2_u_H
+#define INCLUDED_volk_32fc_deinterleave_64f_x2_u_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE2
+#include <emmintrin.h>
+/*!
+ \brief Deinterleaves the lv_32fc_t vector into double I & Q vector data
+ \param complexVector The complex input vector
+ \param iBuffer The I buffer output data
+ \param qBuffer The Q buffer output data
+ \param num_points The number of complex data values to be deinterleaved
+*/
+static inline void volk_32fc_deinterleave_64f_x2_u_sse2(double* iBuffer, double* qBuffer, const lv_32fc_t* complexVector, unsigned int num_points){
+ unsigned int number = 0;
+
+ const float* complexVectorPtr = (float*)complexVector;
+ double* iBufferPtr = iBuffer;
+ double* qBufferPtr = qBuffer;
+
+ const unsigned int halfPoints = num_points / 2;
+ __m128 cplxValue, fVal;
+ __m128d dVal;
+
+ for(;number < halfPoints; number++){
+
+ cplxValue = _mm_loadu_ps(complexVectorPtr);
+ complexVectorPtr += 4;
+
+ // Arrange in i1i2i1i2 format
+ fVal = _mm_shuffle_ps(cplxValue, cplxValue, _MM_SHUFFLE(2,0,2,0));
+ dVal = _mm_cvtps_pd(fVal);
+ _mm_storeu_pd(iBufferPtr, dVal);
+
+ // Arrange in q1q2q1q2 format
+ fVal = _mm_shuffle_ps(cplxValue, cplxValue, _MM_SHUFFLE(3,1,3,1));
+ dVal = _mm_cvtps_pd(fVal);
+ _mm_storeu_pd(qBufferPtr, dVal);
+
+ iBufferPtr += 2;
+ qBufferPtr += 2;
+ }
+
+ number = halfPoints * 2;
+ for(; number < num_points; number++){
+ *iBufferPtr++ = *complexVectorPtr++;
+ *qBufferPtr++ = *complexVectorPtr++;
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Deinterleaves the lv_32fc_t vector into double I & Q vector data
+ \param complexVector The complex input vector
+ \param iBuffer The I buffer output data
+ \param qBuffer The Q buffer output data
+ \param num_points The number of complex data values to be deinterleaved
+*/
+static inline void volk_32fc_deinterleave_64f_x2_generic(double* iBuffer, double* qBuffer, const lv_32fc_t* complexVector, unsigned int num_points){
+ unsigned int number = 0;
+ const float* complexVectorPtr = (float*)complexVector;
+ double* iBufferPtr = iBuffer;
+ double* qBufferPtr = qBuffer;
+
+ for(number = 0; number < num_points; number++){
+ *iBufferPtr++ = (double)*complexVectorPtr++;
+ *qBufferPtr++ = (double)*complexVectorPtr++;
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_32fc_deinterleave_64f_x2_u_H */
+#ifndef INCLUDED_volk_32fc_deinterleave_64f_x2_a_H
+#define INCLUDED_volk_32fc_deinterleave_64f_x2_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE2
+#include <emmintrin.h>
+/*!
+ \brief Deinterleaves the lv_32fc_t vector into double I & Q vector data
+ \param complexVector The complex input vector
+ \param iBuffer The I buffer output data
+ \param qBuffer The Q buffer output data
+ \param num_points The number of complex data values to be deinterleaved
+*/
+static inline void volk_32fc_deinterleave_64f_x2_a_sse2(double* iBuffer, double* qBuffer, const lv_32fc_t* complexVector, unsigned int num_points){
+ unsigned int number = 0;
+
+ const float* complexVectorPtr = (float*)complexVector;
+ double* iBufferPtr = iBuffer;
+ double* qBufferPtr = qBuffer;
+
+ const unsigned int halfPoints = num_points / 2;
+ __m128 cplxValue, fVal;
+ __m128d dVal;
+
+ for(;number < halfPoints; number++){
+
+ cplxValue = _mm_load_ps(complexVectorPtr);
+ complexVectorPtr += 4;
+
+ // Arrange in i1i2i1i2 format
+ fVal = _mm_shuffle_ps(cplxValue, cplxValue, _MM_SHUFFLE(2,0,2,0));
+ dVal = _mm_cvtps_pd(fVal);
+ _mm_store_pd(iBufferPtr, dVal);
+
+ // Arrange in q1q2q1q2 format
+ fVal = _mm_shuffle_ps(cplxValue, cplxValue, _MM_SHUFFLE(3,1,3,1));
+ dVal = _mm_cvtps_pd(fVal);
+ _mm_store_pd(qBufferPtr, dVal);
+
+ iBufferPtr += 2;
+ qBufferPtr += 2;
+ }
+
+ number = halfPoints * 2;
+ for(; number < num_points; number++){
+ *iBufferPtr++ = *complexVectorPtr++;
+ *qBufferPtr++ = *complexVectorPtr++;
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Deinterleaves the lv_32fc_t vector into double I & Q vector data
+ \param complexVector The complex input vector
+ \param iBuffer The I buffer output data
+ \param qBuffer The Q buffer output data
+ \param num_points The number of complex data values to be deinterleaved
+*/
+static inline void volk_32fc_deinterleave_64f_x2_a_generic(double* iBuffer, double* qBuffer, const lv_32fc_t* complexVector, unsigned int num_points){
+ unsigned int number = 0;
+ const float* complexVectorPtr = (float*)complexVector;
+ double* iBufferPtr = iBuffer;
+ double* qBufferPtr = qBuffer;
+
+ for(number = 0; number < num_points; number++){
+ *iBufferPtr++ = (double)*complexVectorPtr++;
+ *qBufferPtr++ = (double)*complexVectorPtr++;
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_32fc_deinterleave_64f_x2_a_H */
diff --git a/volk/kernels/volk/volk_32fc_deinterleave_imag_32f.h b/volk/kernels/volk/volk_32fc_deinterleave_imag_32f.h
new file mode 100644
index 000000000..b1968296f
--- /dev/null
+++ b/volk/kernels/volk/volk_32fc_deinterleave_imag_32f.h
@@ -0,0 +1,68 @@
+#ifndef INCLUDED_volk_32fc_deinterleave_imag_32f_a_H
+#define INCLUDED_volk_32fc_deinterleave_imag_32f_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+/*!
+ \brief Deinterleaves the complex vector into Q vector data
+ \param complexVector The complex input vector
+ \param qBuffer The Q buffer output data
+ \param num_points The number of complex data values to be deinterleaved
+*/
+static inline void volk_32fc_deinterleave_imag_32f_a_sse(float* qBuffer, const lv_32fc_t* complexVector, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+
+ const float* complexVectorPtr = (const float*)complexVector;
+ float* qBufferPtr = qBuffer;
+
+ __m128 cplxValue1, cplxValue2, iValue;
+ for(;number < quarterPoints; number++){
+
+ cplxValue1 = _mm_load_ps(complexVectorPtr);
+ complexVectorPtr += 4;
+
+ cplxValue2 = _mm_load_ps(complexVectorPtr);
+ complexVectorPtr += 4;
+
+ // Arrange in q1q2q3q4 format
+ iValue = _mm_shuffle_ps(cplxValue1, cplxValue2, _MM_SHUFFLE(3,1,3,1));
+
+ _mm_store_ps(qBufferPtr, iValue);
+
+ qBufferPtr += 4;
+ }
+
+ number = quarterPoints * 4;
+ for(; number < num_points; number++){
+ complexVectorPtr++;
+ *qBufferPtr++ = *complexVectorPtr++;
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Deinterleaves the complex vector into Q vector data
+ \param complexVector The complex input vector
+ \param qBuffer The I buffer output data
+ \param num_points The number of complex data values to be deinterleaved
+*/
+static inline void volk_32fc_deinterleave_imag_32f_generic(float* qBuffer, const lv_32fc_t* complexVector, unsigned int num_points){
+ unsigned int number = 0;
+ const float* complexVectorPtr = (float*)complexVector;
+ float* qBufferPtr = qBuffer;
+ for(number = 0; number < num_points; number++){
+ complexVectorPtr++;
+ *qBufferPtr++ = *complexVectorPtr++;
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_32fc_deinterleave_imag_32f_a_H */
diff --git a/volk/kernels/volk/volk_32fc_deinterleave_real_32f.h b/volk/kernels/volk/volk_32fc_deinterleave_real_32f.h
new file mode 100644
index 000000000..3d5759813
--- /dev/null
+++ b/volk/kernels/volk/volk_32fc_deinterleave_real_32f.h
@@ -0,0 +1,68 @@
+#ifndef INCLUDED_volk_32fc_deinterleave_real_32f_a_H
+#define INCLUDED_volk_32fc_deinterleave_real_32f_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+/*!
+ \brief Deinterleaves the complex vector into I vector data
+ \param complexVector The complex input vector
+ \param iBuffer The I buffer output data
+ \param num_points The number of complex data values to be deinterleaved
+*/
+static inline void volk_32fc_deinterleave_real_32f_a_sse(float* iBuffer, const lv_32fc_t* complexVector, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+
+ const float* complexVectorPtr = (const float*)complexVector;
+ float* iBufferPtr = iBuffer;
+
+ __m128 cplxValue1, cplxValue2, iValue;
+ for(;number < quarterPoints; number++){
+
+ cplxValue1 = _mm_load_ps(complexVectorPtr);
+ complexVectorPtr += 4;
+
+ cplxValue2 = _mm_load_ps(complexVectorPtr);
+ complexVectorPtr += 4;
+
+ // Arrange in i1i2i3i4 format
+ iValue = _mm_shuffle_ps(cplxValue1, cplxValue2, _MM_SHUFFLE(2,0,2,0));
+
+ _mm_store_ps(iBufferPtr, iValue);
+
+ iBufferPtr += 4;
+ }
+
+ number = quarterPoints * 4;
+ for(; number < num_points; number++){
+ *iBufferPtr++ = *complexVectorPtr++;
+ complexVectorPtr++;
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Deinterleaves the complex vector into I vector data
+ \param complexVector The complex input vector
+ \param iBuffer The I buffer output data
+ \param num_points The number of complex data values to be deinterleaved
+*/
+static inline void volk_32fc_deinterleave_real_32f_generic(float* iBuffer, const lv_32fc_t* complexVector, unsigned int num_points){
+ unsigned int number = 0;
+ const float* complexVectorPtr = (float*)complexVector;
+ float* iBufferPtr = iBuffer;
+ for(number = 0; number < num_points; number++){
+ *iBufferPtr++ = *complexVectorPtr++;
+ complexVectorPtr++;
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_32fc_deinterleave_real_32f_a_H */
diff --git a/volk/kernels/volk/volk_32fc_deinterleave_real_64f.h b/volk/kernels/volk/volk_32fc_deinterleave_real_64f.h
new file mode 100644
index 000000000..1fa66e8ad
--- /dev/null
+++ b/volk/kernels/volk/volk_32fc_deinterleave_real_64f.h
@@ -0,0 +1,66 @@
+#ifndef INCLUDED_volk_32fc_deinterleave_real_64f_a_H
+#define INCLUDED_volk_32fc_deinterleave_real_64f_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE2
+#include <emmintrin.h>
+/*!
+ \brief Deinterleaves the complex vector into I vector data
+ \param complexVector The complex input vector
+ \param iBuffer The I buffer output data
+ \param num_points The number of complex data values to be deinterleaved
+*/
+static inline void volk_32fc_deinterleave_real_64f_a_sse2(double* iBuffer, const lv_32fc_t* complexVector, unsigned int num_points){
+ unsigned int number = 0;
+
+ const float* complexVectorPtr = (float*)complexVector;
+ double* iBufferPtr = iBuffer;
+
+ const unsigned int halfPoints = num_points / 2;
+ __m128 cplxValue, fVal;
+ __m128d dVal;
+ for(;number < halfPoints; number++){
+
+ cplxValue = _mm_load_ps(complexVectorPtr);
+ complexVectorPtr += 4;
+
+ // Arrange in i1i2i1i2 format
+ fVal = _mm_shuffle_ps(cplxValue, cplxValue, _MM_SHUFFLE(2,0,2,0));
+ dVal = _mm_cvtps_pd(fVal);
+ _mm_store_pd(iBufferPtr, dVal);
+
+ iBufferPtr += 2;
+ }
+
+ number = halfPoints * 2;
+ for(; number < num_points; number++){
+ *iBufferPtr++ = (double)*complexVectorPtr++;
+ complexVectorPtr++;
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Deinterleaves the complex vector into I vector data
+ \param complexVector The complex input vector
+ \param iBuffer The I buffer output data
+ \param num_points The number of complex data values to be deinterleaved
+*/
+static inline void volk_32fc_deinterleave_real_64f_generic(double* iBuffer, const lv_32fc_t* complexVector, unsigned int num_points){
+ unsigned int number = 0;
+ const float* complexVectorPtr = (float*)complexVector;
+ double* iBufferPtr = iBuffer;
+ for(number = 0; number < num_points; number++){
+ *iBufferPtr++ = (double)*complexVectorPtr++;
+ complexVectorPtr++;
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_32fc_deinterleave_real_64f_a_H */
diff --git a/volk/kernels/volk/volk_32fc_index_max_16u.h b/volk/kernels/volk/volk_32fc_index_max_16u.h
new file mode 100644
index 000000000..c8d721240
--- /dev/null
+++ b/volk/kernels/volk/volk_32fc_index_max_16u.h
@@ -0,0 +1,218 @@
+#ifndef INCLUDED_volk_32fc_index_max_16u_a_H
+#define INCLUDED_volk_32fc_index_max_16u_a_H
+
+#include <volk/volk_common.h>
+#include<inttypes.h>
+#include<stdio.h>
+#include<volk/volk_complex.h>
+
+#ifdef LV_HAVE_SSE3
+#include<xmmintrin.h>
+#include<pmmintrin.h>
+
+
+static inline void volk_32fc_index_max_16u_a_sse3(unsigned int* target, lv_32fc_t* src0, unsigned int num_points) {
+
+ const unsigned int num_bytes = num_points*8;
+
+ union bit128 holderf;
+ union bit128 holderi;
+ float sq_dist = 0.0;
+
+
+
+
+ union bit128 xmm5, xmm4;
+ __m128 xmm1, xmm2, xmm3;
+ __m128i xmm8, xmm11, xmm12, xmmfive, xmmfour, xmm9, holder0, holder1, xmm10;
+
+ xmm5.int_vec = xmmfive = _mm_setzero_si128();
+ xmm4.int_vec = xmmfour = _mm_setzero_si128();
+ holderf.int_vec = holder0 = _mm_setzero_si128();
+ holderi.int_vec = holder1 = _mm_setzero_si128();
+
+
+ int bound = num_bytes >> 5;
+ int leftovers0 = (num_bytes >> 4) & 1;
+ int leftovers1 = (num_bytes >> 3) & 1;
+ int i = 0;
+
+
+ xmm8 = _mm_set_epi32(3, 2, 1, 0);//remember the crazy reverse order!
+ xmm9 = xmm8 = _mm_setzero_si128();
+ xmm10 = _mm_set_epi32(4, 4, 4, 4);
+ xmm3 = _mm_setzero_ps();
+;
+
+ //printf("%f, %f, %f, %f\n", ((float*)&xmm10)[0], ((float*)&xmm10)[1], ((float*)&xmm10)[2], ((float*)&xmm10)[3]);
+
+ for(; i < bound; ++i) {
+
+ xmm1 = _mm_load_ps((float*)src0);
+ xmm2 = _mm_load_ps((float*)&src0[2]);
+
+
+ src0 += 4;
+
+
+ xmm1 = _mm_mul_ps(xmm1, xmm1);
+ xmm2 = _mm_mul_ps(xmm2, xmm2);
+
+
+ xmm1 = _mm_hadd_ps(xmm1, xmm2);
+
+ xmm3 = _mm_max_ps(xmm1, xmm3);
+
+ xmm4.float_vec = _mm_cmplt_ps(xmm1, xmm3);
+ xmm5.float_vec = _mm_cmpeq_ps(xmm1, xmm3);
+
+
+
+ xmm11 = _mm_and_si128(xmm8, xmm5.int_vec);
+ xmm12 = _mm_and_si128(xmm9, xmm4.int_vec);
+
+ xmm9 = _mm_add_epi32(xmm11, xmm12);
+
+ xmm8 = _mm_add_epi32(xmm8, xmm10);
+
+
+ //printf("%f, %f, %f, %f\n", ((float*)&xmm3)[0], ((float*)&xmm3)[1], ((float*)&xmm3)[2], ((float*)&xmm3)[3]);
+ //printf("%u, %u, %u, %u\n", ((uint32_t*)&xmm10)[0], ((uint32_t*)&xmm10)[1], ((uint32_t*)&xmm10)[2], ((uint32_t*)&xmm10)[3]);
+
+ }
+
+
+ for(i = 0; i < leftovers0; ++i) {
+
+
+ xmm2 = _mm_load_ps((float*)src0);
+
+ xmm1 = _mm_movelh_ps(bit128_p(&xmm8)->float_vec, bit128_p(&xmm8)->float_vec);
+ xmm8 = bit128_p(&xmm1)->int_vec;
+
+ xmm2 = _mm_mul_ps(xmm2, xmm2);
+
+ src0 += 2;
+
+ xmm1 = _mm_hadd_ps(xmm2, xmm2);
+
+ xmm3 = _mm_max_ps(xmm1, xmm3);
+
+ xmm10 = _mm_set_epi32(2, 2, 2, 2);//load1_ps((float*)&init[2]);
+
+
+ xmm4.float_vec = _mm_cmplt_ps(xmm1, xmm3);
+ xmm5.float_vec = _mm_cmpeq_ps(xmm1, xmm3);
+
+
+
+ xmm11 = _mm_and_si128(xmm8, xmm5.int_vec);
+ xmm12 = _mm_and_si128(xmm9, xmm4.int_vec);
+
+ xmm9 = _mm_add_epi32(xmm11, xmm12);
+
+ xmm8 = _mm_add_epi32(xmm8, xmm10);
+ //printf("egads%u, %u, %u, %u\n", ((uint32_t*)&xmm9)[0], ((uint32_t*)&xmm9)[1], ((uint32_t*)&xmm9)[2], ((uint32_t*)&xmm9)[3]);
+
+ }
+
+
+
+
+ for(i = 0; i < leftovers1; ++i) {
+ //printf("%u, %u, %u, %u\n", ((uint32_t*)&xmm9)[0], ((uint32_t*)&xmm9)[1], ((uint32_t*)&xmm9)[2], ((uint32_t*)&xmm9)[3]);
+
+
+ sq_dist = lv_creal(src0[0]) * lv_creal(src0[0]) + lv_cimag(src0[0]) * lv_cimag(src0[0]);
+
+ xmm2 = _mm_load1_ps(&sq_dist);
+
+ xmm1 = xmm3;
+
+ xmm3 = _mm_max_ss(xmm3, xmm2);
+
+
+
+ xmm4.float_vec = _mm_cmplt_ps(xmm1, xmm3);
+ xmm5.float_vec = _mm_cmpeq_ps(xmm1, xmm3);
+
+
+ xmm8 = _mm_shuffle_epi32(xmm8, 0x00);
+
+ xmm11 = _mm_and_si128(xmm8, xmm4.int_vec);
+ xmm12 = _mm_and_si128(xmm9, xmm5.int_vec);
+
+
+ xmm9 = _mm_add_epi32(xmm11, xmm12);
+
+ }
+
+ //printf("%f, %f, %f, %f\n", ((float*)&xmm3)[0], ((float*)&xmm3)[1], ((float*)&xmm3)[2], ((float*)&xmm3)[3]);
+
+ //printf("%u, %u, %u, %u\n", ((uint32_t*)&xmm9)[0], ((uint32_t*)&xmm9)[1], ((uint32_t*)&xmm9)[2], ((uint32_t*)&xmm9)[3]);
+
+ _mm_store_ps((float*)&(holderf.f), xmm3);
+ _mm_store_si128(&(holderi.int_vec), xmm9);
+
+ target[0] = holderi.i[0];
+ sq_dist = holderf.f[0];
+ target[0] = (holderf.f[1] > sq_dist) ? holderi.i[1] : target[0];
+ sq_dist = (holderf.f[1] > sq_dist) ? holderf.f[1] : sq_dist;
+ target[0] = (holderf.f[2] > sq_dist) ? holderi.i[2] : target[0];
+ sq_dist = (holderf.f[2] > sq_dist) ? holderf.f[2] : sq_dist;
+ target[0] = (holderf.f[3] > sq_dist) ? holderi.i[3] : target[0];
+ sq_dist = (holderf.f[3] > sq_dist) ? holderf.f[3] : sq_dist;
+
+
+
+ /*
+ float placeholder = 0.0;
+ uint32_t temp0, temp1;
+ unsigned int g0 = (((float*)&xmm3)[0] > ((float*)&xmm3)[1]);
+ unsigned int l0 = g0 ^ 1;
+
+ unsigned int g1 = (((float*)&xmm3)[1] > ((float*)&xmm3)[2]);
+ unsigned int l1 = g1 ^ 1;
+
+ temp0 = g0 * ((uint32_t*)&xmm9)[0] + l0 * ((uint32_t*)&xmm9)[1];
+ temp1 = g0 * ((uint32_t*)&xmm9)[2] + l0 * ((uint32_t*)&xmm9)[3];
+ sq_dist = g0 * ((float*)&xmm3)[0] + l0 * ((float*)&xmm3)[1];
+ placeholder = g0 * ((float*)&xmm3)[2] + l0 * ((float*)&xmm3)[3];
+
+ g0 = (sq_dist > placeholder);
+ l0 = g0 ^ 1;
+ target[0] = g0 * temp0 + l0 * temp1;
+ */
+
+}
+
+#endif /*LV_HAVE_SSE3*/
+
+#ifdef LV_HAVE_GENERIC
+static inline void volk_32fc_index_max_16u_generic(unsigned int* target, lv_32fc_t* src0, unsigned int num_points) {
+
+ const unsigned int num_bytes = num_points*8;
+
+ float sq_dist = 0.0;
+ float max = 0.0;
+ unsigned int index = 0;
+
+ unsigned int i = 0;
+
+ for(; i < num_bytes >> 3; ++i) {
+
+ sq_dist = lv_creal(src0[i]) * lv_creal(src0[i]) + lv_cimag(src0[i]) * lv_cimag(src0[i]);
+
+ index = sq_dist > max ? i : index;
+ max = sq_dist > max ? sq_dist : max;
+
+
+ }
+ target[0] = index;
+
+}
+
+#endif /*LV_HAVE_GENERIC*/
+
+
+#endif /*INCLUDED_volk_32fc_index_max_16u_a_H*/
diff --git a/volk/kernels/volk/volk_32fc_magnitude_32f.h b/volk/kernels/volk/volk_32fc_magnitude_32f.h
new file mode 100644
index 000000000..64e99cc1b
--- /dev/null
+++ b/volk/kernels/volk/volk_32fc_magnitude_32f.h
@@ -0,0 +1,250 @@
+#ifndef INCLUDED_volk_32fc_magnitude_32f_u_H
+#define INCLUDED_volk_32fc_magnitude_32f_u_H
+
+#include <inttypes.h>
+#include <stdio.h>
+#include <math.h>
+
+#ifdef LV_HAVE_SSE3
+#include <pmmintrin.h>
+ /*!
+ \brief Calculates the magnitude of the complexVector and stores the results in the magnitudeVector
+ \param complexVector The vector containing the complex input values
+ \param magnitudeVector The vector containing the real output values
+ \param num_points The number of complex values in complexVector to be calculated and stored into cVector
+ */
+static inline void volk_32fc_magnitude_32f_u_sse3(float* magnitudeVector, const lv_32fc_t* complexVector, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+
+ const float* complexVectorPtr = (float*)complexVector;
+ float* magnitudeVectorPtr = magnitudeVector;
+
+ __m128 cplxValue1, cplxValue2, result;
+ for(;number < quarterPoints; number++){
+ cplxValue1 = _mm_loadu_ps(complexVectorPtr);
+ complexVectorPtr += 4;
+
+ cplxValue2 = _mm_loadu_ps(complexVectorPtr);
+ complexVectorPtr += 4;
+
+ cplxValue1 = _mm_mul_ps(cplxValue1, cplxValue1); // Square the values
+ cplxValue2 = _mm_mul_ps(cplxValue2, cplxValue2); // Square the Values
+
+ result = _mm_hadd_ps(cplxValue1, cplxValue2); // Add the I2 and Q2 values
+
+ result = _mm_sqrt_ps(result);
+
+ _mm_storeu_ps(magnitudeVectorPtr, result);
+ magnitudeVectorPtr += 4;
+ }
+
+ number = quarterPoints * 4;
+ for(; number < num_points; number++){
+ float val1Real = *complexVectorPtr++;
+ float val1Imag = *complexVectorPtr++;
+ *magnitudeVectorPtr++ = sqrtf((val1Real * val1Real) + (val1Imag * val1Imag));
+ }
+}
+#endif /* LV_HAVE_SSE3 */
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+ /*!
+ \brief Calculates the magnitude of the complexVector and stores the results in the magnitudeVector
+ \param complexVector The vector containing the complex input values
+ \param magnitudeVector The vector containing the real output values
+ \param num_points The number of complex values in complexVector to be calculated and stored into cVector
+ */
+static inline void volk_32fc_magnitude_32f_u_sse(float* magnitudeVector, const lv_32fc_t* complexVector, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+
+ const float* complexVectorPtr = (float*)complexVector;
+ float* magnitudeVectorPtr = magnitudeVector;
+
+ __m128 cplxValue1, cplxValue2, iValue, qValue, result;
+ for(;number < quarterPoints; number++){
+ cplxValue1 = _mm_loadu_ps(complexVectorPtr);
+ complexVectorPtr += 4;
+
+ cplxValue2 = _mm_loadu_ps(complexVectorPtr);
+ complexVectorPtr += 4;
+
+ // Arrange in i1i2i3i4 format
+ iValue = _mm_shuffle_ps(cplxValue1, cplxValue2, _MM_SHUFFLE(2,0,2,0));
+ // Arrange in q1q2q3q4 format
+ qValue = _mm_shuffle_ps(cplxValue1, cplxValue2, _MM_SHUFFLE(3,1,3,1));
+
+ iValue = _mm_mul_ps(iValue, iValue); // Square the I values
+ qValue = _mm_mul_ps(qValue, qValue); // Square the Q Values
+
+ result = _mm_add_ps(iValue, qValue); // Add the I2 and Q2 values
+
+ result = _mm_sqrt_ps(result);
+
+ _mm_storeu_ps(magnitudeVectorPtr, result);
+ magnitudeVectorPtr += 4;
+ }
+
+ number = quarterPoints * 4;
+ for(; number < num_points; number++){
+ float val1Real = *complexVectorPtr++;
+ float val1Imag = *complexVectorPtr++;
+ *magnitudeVectorPtr++ = sqrtf((val1Real * val1Real) + (val1Imag * val1Imag));
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+ /*!
+ \brief Calculates the magnitude of the complexVector and stores the results in the magnitudeVector
+ \param complexVector The vector containing the complex input values
+ \param magnitudeVector The vector containing the real output values
+ \param num_points The number of complex values in complexVector to be calculated and stored into cVector
+ */
+static inline void volk_32fc_magnitude_32f_generic(float* magnitudeVector, const lv_32fc_t* complexVector, unsigned int num_points){
+ const float* complexVectorPtr = (float*)complexVector;
+ float* magnitudeVectorPtr = magnitudeVector;
+ unsigned int number = 0;
+ for(number = 0; number < num_points; number++){
+ const float real = *complexVectorPtr++;
+ const float imag = *complexVectorPtr++;
+ *magnitudeVectorPtr++ = sqrtf((real*real) + (imag*imag));
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+#endif /* INCLUDED_volk_32fc_magnitude_32f_u_H */
+#ifndef INCLUDED_volk_32fc_magnitude_32f_a_H
+#define INCLUDED_volk_32fc_magnitude_32f_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+#include <math.h>
+
+#ifdef LV_HAVE_SSE3
+#include <pmmintrin.h>
+ /*!
+ \brief Calculates the magnitude of the complexVector and stores the results in the magnitudeVector
+ \param complexVector The vector containing the complex input values
+ \param magnitudeVector The vector containing the real output values
+ \param num_points The number of complex values in complexVector to be calculated and stored into cVector
+ */
+static inline void volk_32fc_magnitude_32f_a_sse3(float* magnitudeVector, const lv_32fc_t* complexVector, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+
+ const float* complexVectorPtr = (float*)complexVector;
+ float* magnitudeVectorPtr = magnitudeVector;
+
+ __m128 cplxValue1, cplxValue2, result;
+ for(;number < quarterPoints; number++){
+ cplxValue1 = _mm_load_ps(complexVectorPtr);
+ complexVectorPtr += 4;
+
+ cplxValue2 = _mm_load_ps(complexVectorPtr);
+ complexVectorPtr += 4;
+
+ cplxValue1 = _mm_mul_ps(cplxValue1, cplxValue1); // Square the values
+ cplxValue2 = _mm_mul_ps(cplxValue2, cplxValue2); // Square the Values
+
+ result = _mm_hadd_ps(cplxValue1, cplxValue2); // Add the I2 and Q2 values
+
+ result = _mm_sqrt_ps(result);
+
+ _mm_store_ps(magnitudeVectorPtr, result);
+ magnitudeVectorPtr += 4;
+ }
+
+ number = quarterPoints * 4;
+ for(; number < num_points; number++){
+ float val1Real = *complexVectorPtr++;
+ float val1Imag = *complexVectorPtr++;
+ *magnitudeVectorPtr++ = sqrtf((val1Real * val1Real) + (val1Imag * val1Imag));
+ }
+}
+#endif /* LV_HAVE_SSE3 */
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+ /*!
+ \brief Calculates the magnitude of the complexVector and stores the results in the magnitudeVector
+ \param complexVector The vector containing the complex input values
+ \param magnitudeVector The vector containing the real output values
+ \param num_points The number of complex values in complexVector to be calculated and stored into cVector
+ */
+static inline void volk_32fc_magnitude_32f_a_sse(float* magnitudeVector, const lv_32fc_t* complexVector, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+
+ const float* complexVectorPtr = (float*)complexVector;
+ float* magnitudeVectorPtr = magnitudeVector;
+
+ __m128 cplxValue1, cplxValue2, iValue, qValue, result;
+ for(;number < quarterPoints; number++){
+ cplxValue1 = _mm_load_ps(complexVectorPtr);
+ complexVectorPtr += 4;
+
+ cplxValue2 = _mm_load_ps(complexVectorPtr);
+ complexVectorPtr += 4;
+
+ // Arrange in i1i2i3i4 format
+ iValue = _mm_shuffle_ps(cplxValue1, cplxValue2, _MM_SHUFFLE(2,0,2,0));
+ // Arrange in q1q2q3q4 format
+ qValue = _mm_shuffle_ps(cplxValue1, cplxValue2, _MM_SHUFFLE(3,1,3,1));
+
+ iValue = _mm_mul_ps(iValue, iValue); // Square the I values
+ qValue = _mm_mul_ps(qValue, qValue); // Square the Q Values
+
+ result = _mm_add_ps(iValue, qValue); // Add the I2 and Q2 values
+
+ result = _mm_sqrt_ps(result);
+
+ _mm_store_ps(magnitudeVectorPtr, result);
+ magnitudeVectorPtr += 4;
+ }
+
+ number = quarterPoints * 4;
+ for(; number < num_points; number++){
+ float val1Real = *complexVectorPtr++;
+ float val1Imag = *complexVectorPtr++;
+ *magnitudeVectorPtr++ = sqrtf((val1Real * val1Real) + (val1Imag * val1Imag));
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+ /*!
+ \brief Calculates the magnitude of the complexVector and stores the results in the magnitudeVector
+ \param complexVector The vector containing the complex input values
+ \param magnitudeVector The vector containing the real output values
+ \param num_points The number of complex values in complexVector to be calculated and stored into cVector
+ */
+static inline void volk_32fc_magnitude_32f_a_generic(float* magnitudeVector, const lv_32fc_t* complexVector, unsigned int num_points){
+ const float* complexVectorPtr = (float*)complexVector;
+ float* magnitudeVectorPtr = magnitudeVector;
+ unsigned int number = 0;
+ for(number = 0; number < num_points; number++){
+ const float real = *complexVectorPtr++;
+ const float imag = *complexVectorPtr++;
+ *magnitudeVectorPtr++ = sqrtf((real*real) + (imag*imag));
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+#ifdef LV_HAVE_ORC
+ /*!
+ \brief Calculates the magnitude of the complexVector and stores the results in the magnitudeVector
+ \param complexVector The vector containing the complex input values
+ \param magnitudeVector The vector containing the real output values
+ \param num_points The number of complex values in complexVector to be calculated and stored into cVector
+ */
+extern void volk_32fc_magnitude_32f_a_orc_impl(float* magnitudeVector, const lv_32fc_t* complexVector, unsigned int num_points);
+static inline void volk_32fc_magnitude_32f_u_orc(float* magnitudeVector, const lv_32fc_t* complexVector, unsigned int num_points){
+ volk_32fc_magnitude_32f_a_orc_impl(magnitudeVector, complexVector, num_points);
+}
+#endif /* LV_HAVE_ORC */
+
+
+#endif /* INCLUDED_volk_32fc_magnitude_32f_a_H */
diff --git a/volk/kernels/volk/volk_32fc_magnitude_squared_32f.h b/volk/kernels/volk/volk_32fc_magnitude_squared_32f.h
new file mode 100644
index 000000000..0af81401a
--- /dev/null
+++ b/volk/kernels/volk/volk_32fc_magnitude_squared_32f.h
@@ -0,0 +1,228 @@
+#ifndef INCLUDED_volk_32fc_magnitude_squared_32f_u_H
+#define INCLUDED_volk_32fc_magnitude_squared_32f_u_H
+
+#include <inttypes.h>
+#include <stdio.h>
+#include <math.h>
+
+#ifdef LV_HAVE_SSE3
+#include <pmmintrin.h>
+ /*!
+ \brief Calculates the magnitude squared of the complexVector and stores the results in the magnitudeVector
+ \param complexVector The vector containing the complex input values
+ \param magnitudeVector The vector containing the real output values
+ \param num_points The number of complex values in complexVector to be calculated and stored into cVector
+ */
+static inline void volk_32fc_magnitude_squared_32f_u_sse3(float* magnitudeVector, const lv_32fc_t* complexVector, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+
+ const float* complexVectorPtr = (float*)complexVector;
+ float* magnitudeVectorPtr = magnitudeVector;
+
+ __m128 cplxValue1, cplxValue2, result;
+ for(;number < quarterPoints; number++){
+ cplxValue1 = _mm_loadu_ps(complexVectorPtr);
+ complexVectorPtr += 4;
+
+ cplxValue2 = _mm_loadu_ps(complexVectorPtr);
+ complexVectorPtr += 4;
+
+ cplxValue1 = _mm_mul_ps(cplxValue1, cplxValue1); // Square the values
+ cplxValue2 = _mm_mul_ps(cplxValue2, cplxValue2); // Square the Values
+
+ result = _mm_hadd_ps(cplxValue1, cplxValue2); // Add the I2 and Q2 values
+
+ _mm_storeu_ps(magnitudeVectorPtr, result);
+ magnitudeVectorPtr += 4;
+ }
+
+ number = quarterPoints * 4;
+ for(; number < num_points; number++){
+ float val1Real = *complexVectorPtr++;
+ float val1Imag = *complexVectorPtr++;
+ *magnitudeVectorPtr++ = (val1Real * val1Real) + (val1Imag * val1Imag);
+ }
+}
+#endif /* LV_HAVE_SSE3 */
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+ /*!
+ \brief Calculates the magnitude squared of the complexVector and stores the results in the magnitudeVector
+ \param complexVector The vector containing the complex input values
+ \param magnitudeVector The vector containing the real output values
+ \param num_points The number of complex values in complexVector to be calculated and stored into cVector
+ */
+static inline void volk_32fc_magnitude_squared_32f_u_sse(float* magnitudeVector, const lv_32fc_t* complexVector, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+
+ const float* complexVectorPtr = (float*)complexVector;
+ float* magnitudeVectorPtr = magnitudeVector;
+
+ __m128 cplxValue1, cplxValue2, iValue, qValue, result;
+ for(;number < quarterPoints; number++){
+ cplxValue1 = _mm_loadu_ps(complexVectorPtr);
+ complexVectorPtr += 4;
+
+ cplxValue2 = _mm_loadu_ps(complexVectorPtr);
+ complexVectorPtr += 4;
+
+ // Arrange in i1i2i3i4 format
+ iValue = _mm_shuffle_ps(cplxValue1, cplxValue2, _MM_SHUFFLE(2,0,2,0));
+ // Arrange in q1q2q3q4 format
+ qValue = _mm_shuffle_ps(cplxValue1, cplxValue2, _MM_SHUFFLE(3,1,3,1));
+
+ iValue = _mm_mul_ps(iValue, iValue); // Square the I values
+ qValue = _mm_mul_ps(qValue, qValue); // Square the Q Values
+
+ result = _mm_add_ps(iValue, qValue); // Add the I2 and Q2 values
+
+ _mm_storeu_ps(magnitudeVectorPtr, result);
+ magnitudeVectorPtr += 4;
+ }
+
+ number = quarterPoints * 4;
+ for(; number < num_points; number++){
+ float val1Real = *complexVectorPtr++;
+ float val1Imag = *complexVectorPtr++;
+ *magnitudeVectorPtr++ = (val1Real * val1Real) + (val1Imag * val1Imag);
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+ /*!
+ \brief Calculates the magnitude squared of the complexVector and stores the results in the magnitudeVector
+ \param complexVector The vector containing the complex input values
+ \param magnitudeVector The vector containing the real output values
+ \param num_points The number of complex values in complexVector to be calculated and stored into cVector
+ */
+static inline void volk_32fc_magnitude_squared_32f_generic(float* magnitudeVector, const lv_32fc_t* complexVector, unsigned int num_points){
+ const float* complexVectorPtr = (float*)complexVector;
+ float* magnitudeVectorPtr = magnitudeVector;
+ unsigned int number = 0;
+ for(number = 0; number < num_points; number++){
+ const float real = *complexVectorPtr++;
+ const float imag = *complexVectorPtr++;
+ *magnitudeVectorPtr++ = (real*real) + (imag*imag);
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+#endif /* INCLUDED_volk_32fc_magnitude_32f_u_H */
+#ifndef INCLUDED_volk_32fc_magnitude_squared_32f_a_H
+#define INCLUDED_volk_32fc_magnitude_squared_32f_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+#include <math.h>
+
+#ifdef LV_HAVE_SSE3
+#include <pmmintrin.h>
+ /*!
+ \brief Calculates the magnitude squared of the complexVector and stores the results in the magnitudeVector
+ \param complexVector The vector containing the complex input values
+ \param magnitudeVector The vector containing the real output values
+ \param num_points The number of complex values in complexVector to be calculated and stored into cVector
+ */
+static inline void volk_32fc_magnitude_squared_32f_a_sse3(float* magnitudeVector, const lv_32fc_t* complexVector, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+
+ const float* complexVectorPtr = (float*)complexVector;
+ float* magnitudeVectorPtr = magnitudeVector;
+
+ __m128 cplxValue1, cplxValue2, result;
+ for(;number < quarterPoints; number++){
+ cplxValue1 = _mm_load_ps(complexVectorPtr);
+ complexVectorPtr += 4;
+
+ cplxValue2 = _mm_load_ps(complexVectorPtr);
+ complexVectorPtr += 4;
+
+ cplxValue1 = _mm_mul_ps(cplxValue1, cplxValue1); // Square the values
+ cplxValue2 = _mm_mul_ps(cplxValue2, cplxValue2); // Square the Values
+
+ result = _mm_hadd_ps(cplxValue1, cplxValue2); // Add the I2 and Q2 values
+
+ _mm_store_ps(magnitudeVectorPtr, result);
+ magnitudeVectorPtr += 4;
+ }
+
+ number = quarterPoints * 4;
+ for(; number < num_points; number++){
+ float val1Real = *complexVectorPtr++;
+ float val1Imag = *complexVectorPtr++;
+ *magnitudeVectorPtr++ = (val1Real * val1Real) + (val1Imag * val1Imag);
+ }
+}
+#endif /* LV_HAVE_SSE3 */
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+ /*!
+ \brief Calculates the magnitude squared of the complexVector and stores the results in the magnitudeVector
+ \param complexVector The vector containing the complex input values
+ \param magnitudeVector The vector containing the real output values
+ \param num_points The number of complex values in complexVector to be calculated and stored into cVector
+ */
+static inline void volk_32fc_magnitude_squared_32f_a_sse(float* magnitudeVector, const lv_32fc_t* complexVector, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+
+ const float* complexVectorPtr = (float*)complexVector;
+ float* magnitudeVectorPtr = magnitudeVector;
+
+ __m128 cplxValue1, cplxValue2, iValue, qValue, result;
+ for(;number < quarterPoints; number++){
+ cplxValue1 = _mm_load_ps(complexVectorPtr);
+ complexVectorPtr += 4;
+
+ cplxValue2 = _mm_load_ps(complexVectorPtr);
+ complexVectorPtr += 4;
+
+ // Arrange in i1i2i3i4 format
+ iValue = _mm_shuffle_ps(cplxValue1, cplxValue2, _MM_SHUFFLE(2,0,2,0));
+ // Arrange in q1q2q3q4 format
+ qValue = _mm_shuffle_ps(cplxValue1, cplxValue2, _MM_SHUFFLE(3,1,3,1));
+
+ iValue = _mm_mul_ps(iValue, iValue); // Square the I values
+ qValue = _mm_mul_ps(qValue, qValue); // Square the Q Values
+
+ result = _mm_add_ps(iValue, qValue); // Add the I2 and Q2 values
+
+ _mm_store_ps(magnitudeVectorPtr, result);
+ magnitudeVectorPtr += 4;
+ }
+
+ number = quarterPoints * 4;
+ for(; number < num_points; number++){
+ float val1Real = *complexVectorPtr++;
+ float val1Imag = *complexVectorPtr++;
+ *magnitudeVectorPtr++ = (val1Real * val1Real) + (val1Imag * val1Imag);
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+ /*!
+ \brief Calculates the magnitude squared of the complexVector and stores the results in the magnitudeVector
+ \param complexVector The vector containing the complex input values
+ \param magnitudeVector The vector containing the real output values
+ \param num_points The number of complex values in complexVector to be calculated and stored into cVector
+ */
+static inline void volk_32fc_magnitude_squared_32f_a_generic(float* magnitudeVector, const lv_32fc_t* complexVector, unsigned int num_points){
+ const float* complexVectorPtr = (float*)complexVector;
+ float* magnitudeVectorPtr = magnitudeVector;
+ unsigned int number = 0;
+ for(number = 0; number < num_points; number++){
+ const float real = *complexVectorPtr++;
+ const float imag = *complexVectorPtr++;
+ *magnitudeVectorPtr++ = (real*real) + (imag*imag);
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+#endif /* INCLUDED_volk_32fc_magnitude_32f_a_H */
diff --git a/volk/kernels/volk/volk_32fc_s32f_atan2_32f.h b/volk/kernels/volk/volk_32fc_s32f_atan2_32f.h
new file mode 100644
index 000000000..b076ab44e
--- /dev/null
+++ b/volk/kernels/volk/volk_32fc_s32f_atan2_32f.h
@@ -0,0 +1,158 @@
+#ifndef INCLUDED_volk_32fc_s32f_atan2_32f_a_H
+#define INCLUDED_volk_32fc_s32f_atan2_32f_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+#include <math.h>
+
+#ifdef LV_HAVE_SSE4_1
+#include <smmintrin.h>
+
+#ifdef LV_HAVE_LIB_SIMDMATH
+#include <simdmath.h>
+#endif /* LV_HAVE_LIB_SIMDMATH */
+
+/*!
+ \brief performs the atan2 on the input vector and stores the results in the output vector.
+ \param outputVector The byte-aligned vector where the results will be stored.
+ \param inputVector The byte-aligned input vector containing interleaved IQ data (I = cos, Q = sin).
+ \param normalizeFactor The atan2 results will be divided by this normalization factor.
+ \param num_points The number of complex values in the input vector.
+*/
+static inline void volk_32fc_s32f_atan2_32f_a_sse4_1(float* outputVector, const lv_32fc_t* complexVector, const float normalizeFactor, unsigned int num_points){
+ const float* complexVectorPtr = (float*)complexVector;
+ float* outPtr = outputVector;
+
+ unsigned int number = 0;
+ const float invNormalizeFactor = 1.0 / normalizeFactor;
+
+#ifdef LV_HAVE_LIB_SIMDMATH
+ const unsigned int quarterPoints = num_points / 4;
+ __m128 testVector = _mm_set_ps1(2*M_PI);
+ __m128 correctVector = _mm_set_ps1(M_PI);
+ __m128 vNormalizeFactor = _mm_set_ps1(invNormalizeFactor);
+ __m128 phase;
+ __m128 complex1, complex2, iValue, qValue;
+ __m128 keepMask;
+
+ for (; number < quarterPoints; number++) {
+ // Load IQ data:
+ complex1 = _mm_load_ps(complexVectorPtr);
+ complexVectorPtr += 4;
+ complex2 = _mm_load_ps(complexVectorPtr);
+ complexVectorPtr += 4;
+ // Deinterleave IQ data:
+ iValue = _mm_shuffle_ps(complex1, complex2, _MM_SHUFFLE(2,0,2,0));
+ qValue = _mm_shuffle_ps(complex1, complex2, _MM_SHUFFLE(3,1,3,1));
+ // Arctan to get phase:
+ phase = atan2f4(qValue, iValue);
+ // When Q = 0 and I < 0, atan2f4 sucks and returns 2pi vice pi.
+ // Compare to 2pi:
+ keepMask = _mm_cmpneq_ps(phase,testVector);
+ phase = _mm_blendv_ps(correctVector, phase, keepMask);
+ // done with above correction.
+ phase = _mm_mul_ps(phase, vNormalizeFactor);
+ _mm_store_ps((float*)outPtr, phase);
+ outPtr += 4;
+ }
+ number = quarterPoints * 4;
+#endif /* LV_HAVE_SIMDMATH_H */
+
+ for (; number < num_points; number++) {
+ const float real = *complexVectorPtr++;
+ const float imag = *complexVectorPtr++;
+ *outPtr++ = atan2f(imag, real) * invNormalizeFactor;
+ }
+}
+#endif /* LV_HAVE_SSE4_1 */
+
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+
+#ifdef LV_HAVE_LIB_SIMDMATH
+#include <simdmath.h>
+#endif /* LV_HAVE_LIB_SIMDMATH */
+
+/*!
+ \brief performs the atan2 on the input vector and stores the results in the output vector.
+ \param outputVector The byte-aligned vector where the results will be stored.
+ \param inputVector The byte-aligned input vector containing interleaved IQ data (I = cos, Q = sin).
+ \param normalizeFactor The atan2 results will be divided by this normalization factor.
+ \param num_points The number of complex values in the input vector.
+*/
+static inline void volk_32fc_s32f_atan2_32f_a_sse(float* outputVector, const lv_32fc_t* complexVector, const float normalizeFactor, unsigned int num_points){
+ const float* complexVectorPtr = (float*)complexVector;
+ float* outPtr = outputVector;
+
+ unsigned int number = 0;
+ const float invNormalizeFactor = 1.0 / normalizeFactor;
+
+#ifdef LV_HAVE_LIB_SIMDMATH
+ const unsigned int quarterPoints = num_points / 4;
+ __m128 testVector = _mm_set_ps1(2*M_PI);
+ __m128 correctVector = _mm_set_ps1(M_PI);
+ __m128 vNormalizeFactor = _mm_set_ps1(invNormalizeFactor);
+ __m128 phase;
+ __m128 complex1, complex2, iValue, qValue;
+ __m128 mask;
+ __m128 keepMask;
+
+ for (; number < quarterPoints; number++) {
+ // Load IQ data:
+ complex1 = _mm_load_ps(complexVectorPtr);
+ complexVectorPtr += 4;
+ complex2 = _mm_load_ps(complexVectorPtr);
+ complexVectorPtr += 4;
+ // Deinterleave IQ data:
+ iValue = _mm_shuffle_ps(complex1, complex2, _MM_SHUFFLE(2,0,2,0));
+ qValue = _mm_shuffle_ps(complex1, complex2, _MM_SHUFFLE(3,1,3,1));
+ // Arctan to get phase:
+ phase = atan2f4(qValue, iValue);
+ // When Q = 0 and I < 0, atan2f4 sucks and returns 2pi vice pi.
+ // Compare to 2pi:
+ keepMask = _mm_cmpneq_ps(phase,testVector);
+ phase = _mm_and_ps(phase, keepMask);
+ mask = _mm_andnot_ps(keepMask, correctVector);
+ phase = _mm_or_ps(phase, mask);
+ // done with above correction.
+ phase = _mm_mul_ps(phase, vNormalizeFactor);
+ _mm_store_ps((float*)outPtr, phase);
+ outPtr += 4;
+ }
+ number = quarterPoints * 4;
+#endif /* LV_HAVE_SIMDMATH_H */
+
+ for (; number < num_points; number++) {
+ const float real = *complexVectorPtr++;
+ const float imag = *complexVectorPtr++;
+ *outPtr++ = atan2f(imag, real) * invNormalizeFactor;
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief performs the atan2 on the input vector and stores the results in the output vector.
+ \param outputVector The vector where the results will be stored.
+ \param inputVector Input vector containing interleaved IQ data (I = cos, Q = sin).
+ \param normalizeFactor The atan2 results will be divided by this normalization factor.
+ \param num_points The number of complex values in the input vector.
+*/
+static inline void volk_32fc_s32f_atan2_32f_generic(float* outputVector, const lv_32fc_t* inputVector, const float normalizeFactor, unsigned int num_points){
+ float* outPtr = outputVector;
+ const float* inPtr = (float*)inputVector;
+ const float invNormalizeFactor = 1.0 / normalizeFactor;
+ unsigned int number;
+ for ( number = 0; number < num_points; number++) {
+ const float real = *inPtr++;
+ const float imag = *inPtr++;
+ *outPtr++ = atan2f(imag, real) * invNormalizeFactor;
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_32fc_s32f_atan2_32f_a_H */
diff --git a/volk/kernels/volk/volk_32fc_s32f_deinterleave_real_16i.h b/volk/kernels/volk/volk_32fc_s32f_deinterleave_real_16i.h
new file mode 100644
index 000000000..9e10217a0
--- /dev/null
+++ b/volk/kernels/volk/volk_32fc_s32f_deinterleave_real_16i.h
@@ -0,0 +1,81 @@
+#ifndef INCLUDED_volk_32fc_s32f_deinterleave_real_16i_a_H
+#define INCLUDED_volk_32fc_s32f_deinterleave_real_16i_a_H
+
+#include <volk/volk_common.h>
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+/*!
+ \brief Deinterleaves the complex vector, multiply the value by the scalar, convert to 16t, and in I vector data
+ \param complexVector The complex input vector
+ \param scalar The value to be multiply against each of the input values
+ \param iBuffer The I buffer output data
+ \param num_points The number of complex data values to be deinterleaved
+*/
+static inline void volk_32fc_s32f_deinterleave_real_16i_a_sse(int16_t* iBuffer, const lv_32fc_t* complexVector, const float scalar, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+
+ const float* complexVectorPtr = (float*)complexVector;
+ int16_t* iBufferPtr = iBuffer;
+
+ __m128 vScalar = _mm_set_ps1(scalar);
+
+ __m128 cplxValue1, cplxValue2, iValue;
+
+ __VOLK_ATTR_ALIGNED(16) float floatBuffer[4];
+
+ for(;number < quarterPoints; number++){
+ cplxValue1 = _mm_load_ps(complexVectorPtr);
+ complexVectorPtr += 4;
+
+ cplxValue2 = _mm_load_ps(complexVectorPtr);
+ complexVectorPtr += 4;
+
+ // Arrange in i1i2i3i4 format
+ iValue = _mm_shuffle_ps(cplxValue1, cplxValue2, _MM_SHUFFLE(2,0,2,0));
+
+ iValue = _mm_mul_ps(iValue, vScalar);
+
+ _mm_store_ps(floatBuffer, iValue);
+ *iBufferPtr++ = (int16_t)(floatBuffer[0]);
+ *iBufferPtr++ = (int16_t)(floatBuffer[1]);
+ *iBufferPtr++ = (int16_t)(floatBuffer[2]);
+ *iBufferPtr++ = (int16_t)(floatBuffer[3]);
+ }
+
+ number = quarterPoints * 4;
+ iBufferPtr = &iBuffer[number];
+ for(; number < num_points; number++){
+ *iBufferPtr++ = (int16_t)(*complexVectorPtr++ * scalar);
+ complexVectorPtr++;
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Deinterleaves the complex vector, multiply the value by the scalar, convert to 16t, and in I vector data
+ \param complexVector The complex input vector
+ \param scalar The value to be multiply against each of the input values
+ \param iBuffer The I buffer output data
+ \param num_points The number of complex data values to be deinterleaved
+*/
+static inline void volk_32fc_s32f_deinterleave_real_16i_generic(int16_t* iBuffer, const lv_32fc_t* complexVector, const float scalar, unsigned int num_points){
+ const float* complexVectorPtr = (float*)complexVector;
+ int16_t* iBufferPtr = iBuffer;
+ unsigned int number = 0;
+ for(number = 0; number < num_points; number++){
+ *iBufferPtr++ = (int16_t)(*complexVectorPtr++ * scalar);
+ complexVectorPtr++;
+ }
+
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_32fc_s32f_deinterleave_real_16i_a_H */
diff --git a/volk/kernels/volk/volk_32fc_s32f_magnitude_16i.h b/volk/kernels/volk/volk_32fc_s32f_magnitude_16i.h
new file mode 100644
index 000000000..09abd967d
--- /dev/null
+++ b/volk/kernels/volk/volk_32fc_s32f_magnitude_16i.h
@@ -0,0 +1,159 @@
+#ifndef INCLUDED_volk_32fc_s32f_magnitude_16i_a_H
+#define INCLUDED_volk_32fc_s32f_magnitude_16i_a_H
+
+#include <volk/volk_common.h>
+#include <inttypes.h>
+#include <stdio.h>
+#include <math.h>
+
+#ifdef LV_HAVE_SSE3
+#include <pmmintrin.h>
+/*!
+ \brief Calculates the magnitude of the complexVector, scales the resulting value and stores the results in the magnitudeVector
+ \param complexVector The vector containing the complex input values
+ \param scalar The scale value multiplied to the magnitude of each complex vector
+ \param magnitudeVector The vector containing the real output values
+ \param num_points The number of complex values in complexVector to be calculated and stored into cVector
+*/
+static inline void volk_32fc_s32f_magnitude_16i_a_sse3(int16_t* magnitudeVector, const lv_32fc_t* complexVector, const float scalar, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+
+ const float* complexVectorPtr = (const float*)complexVector;
+ int16_t* magnitudeVectorPtr = magnitudeVector;
+
+ __m128 vScalar = _mm_set_ps1(scalar);
+
+ __m128 cplxValue1, cplxValue2, result;
+
+ __VOLK_ATTR_ALIGNED(16) float floatBuffer[4];
+
+ for(;number < quarterPoints; number++){
+ cplxValue1 = _mm_load_ps(complexVectorPtr);
+ complexVectorPtr += 4;
+
+ cplxValue2 = _mm_load_ps(complexVectorPtr);
+ complexVectorPtr += 4;
+
+ cplxValue1 = _mm_mul_ps(cplxValue1, cplxValue1); // Square the values
+ cplxValue2 = _mm_mul_ps(cplxValue2, cplxValue2); // Square the Values
+
+ result = _mm_hadd_ps(cplxValue1, cplxValue2); // Add the I2 and Q2 values
+
+ result = _mm_sqrt_ps(result);
+
+ result = _mm_mul_ps(result, vScalar);
+
+ _mm_store_ps(floatBuffer, result);
+ *magnitudeVectorPtr++ = (int16_t)(floatBuffer[0]);
+ *magnitudeVectorPtr++ = (int16_t)(floatBuffer[1]);
+ *magnitudeVectorPtr++ = (int16_t)(floatBuffer[2]);
+ *magnitudeVectorPtr++ = (int16_t)(floatBuffer[3]);
+ }
+
+ number = quarterPoints * 4;
+ magnitudeVectorPtr = &magnitudeVector[number];
+ for(; number < num_points; number++){
+ float val1Real = *complexVectorPtr++;
+ float val1Imag = *complexVectorPtr++;
+ *magnitudeVectorPtr++ = (int16_t)(sqrtf((val1Real * val1Real) + (val1Imag * val1Imag)) * scalar);
+ }
+}
+#endif /* LV_HAVE_SSE3 */
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+/*!
+ \brief Calculates the magnitude of the complexVector, scales the resulting value and stores the results in the magnitudeVector
+ \param complexVector The vector containing the complex input values
+ \param scalar The scale value multiplied to the magnitude of each complex vector
+ \param magnitudeVector The vector containing the real output values
+ \param num_points The number of complex values in complexVector to be calculated and stored into cVector
+*/
+static inline void volk_32fc_s32f_magnitude_16i_a_sse(int16_t* magnitudeVector, const lv_32fc_t* complexVector, const float scalar, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+
+ const float* complexVectorPtr = (const float*)complexVector;
+ int16_t* magnitudeVectorPtr = magnitudeVector;
+
+ __m128 vScalar = _mm_set_ps1(scalar);
+
+ __m128 cplxValue1, cplxValue2, iValue, qValue, result;
+
+ __VOLK_ATTR_ALIGNED(16) float floatBuffer[4];
+
+ for(;number < quarterPoints; number++){
+ cplxValue1 = _mm_load_ps(complexVectorPtr);
+ complexVectorPtr += 4;
+
+ cplxValue2 = _mm_load_ps(complexVectorPtr);
+ complexVectorPtr += 4;
+
+ // Arrange in i1i2i3i4 format
+ iValue = _mm_shuffle_ps(cplxValue1, cplxValue2, _MM_SHUFFLE(2,0,2,0));
+ // Arrange in q1q2q3q4 format
+ qValue = _mm_shuffle_ps(cplxValue1, cplxValue2, _MM_SHUFFLE(3,1,3,1));
+
+ iValue = _mm_mul_ps(iValue, iValue); // Square the I values
+ qValue = _mm_mul_ps(qValue, qValue); // Square the Q Values
+
+ result = _mm_add_ps(iValue, qValue); // Add the I2 and Q2 values
+
+ result = _mm_sqrt_ps(result);
+
+ result = _mm_mul_ps(result, vScalar);
+
+ _mm_store_ps(floatBuffer, result);
+ *magnitudeVectorPtr++ = (int16_t)(floatBuffer[0]);
+ *magnitudeVectorPtr++ = (int16_t)(floatBuffer[1]);
+ *magnitudeVectorPtr++ = (int16_t)(floatBuffer[2]);
+ *magnitudeVectorPtr++ = (int16_t)(floatBuffer[3]);
+ }
+
+ number = quarterPoints * 4;
+ magnitudeVectorPtr = &magnitudeVector[number];
+ for(; number < num_points; number++){
+ float val1Real = *complexVectorPtr++;
+ float val1Imag = *complexVectorPtr++;
+ *magnitudeVectorPtr++ = (int16_t)(sqrtf((val1Real * val1Real) + (val1Imag * val1Imag)) * scalar);
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Calculates the magnitude of the complexVector, scales the resulting value and stores the results in the magnitudeVector
+ \param complexVector The vector containing the complex input values
+ \param scalar The scale value multiplied to the magnitude of each complex vector
+ \param magnitudeVector The vector containing the real output values
+ \param num_points The number of complex values in complexVector to be calculated and stored into cVector
+*/
+static inline void volk_32fc_s32f_magnitude_16i_generic(int16_t* magnitudeVector, const lv_32fc_t* complexVector, const float scalar, unsigned int num_points){
+ const float* complexVectorPtr = (float*)complexVector;
+ int16_t* magnitudeVectorPtr = magnitudeVector;
+ unsigned int number = 0;
+ for(number = 0; number < num_points; number++){
+ const float real = *complexVectorPtr++;
+ const float imag = *complexVectorPtr++;
+ *magnitudeVectorPtr++ = (int16_t)(sqrtf((real*real) + (imag*imag)) * scalar);
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+#ifdef LV_HAVE_ORC
+/*!
+ \brief Calculates the magnitude of the complexVector, scales the resulting value and stores the results in the magnitudeVector
+ \param complexVector The vector containing the complex input values
+ \param scalar The scale value multiplied to the magnitude of each complex vector
+ \param magnitudeVector The vector containing the real output values
+ \param num_points The number of complex values in complexVector to be calculated and stored into cVector
+*/
+extern void volk_32fc_s32f_magnitude_16i_a_orc_impl(int16_t* magnitudeVector, const lv_32fc_t* complexVector, const float scalar, unsigned int num_points);
+static inline void volk_32fc_s32f_magnitude_16i_u_orc(int16_t* magnitudeVector, const lv_32fc_t* complexVector, const float scalar, unsigned int num_points){
+ volk_32fc_s32f_magnitude_16i_a_orc_impl(magnitudeVector, complexVector, scalar, num_points);
+}
+#endif /* LV_HAVE_ORC */
+
+
+#endif /* INCLUDED_volk_32fc_s32f_magnitude_16i_a_H */
diff --git a/volk/kernels/volk/volk_32fc_s32f_power_32fc.h b/volk/kernels/volk/volk_32fc_s32f_power_32fc.h
new file mode 100644
index 000000000..d4a1d1746
--- /dev/null
+++ b/volk/kernels/volk/volk_32fc_s32f_power_32fc.h
@@ -0,0 +1,111 @@
+#ifndef INCLUDED_volk_32fc_s32f_power_32fc_a_H
+#define INCLUDED_volk_32fc_s32f_power_32fc_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+#include <math.h>
+
+//! raise a complex float to a real float power
+static inline lv_32fc_t __volk_s32fc_s32f_power_s32fc_a(const lv_32fc_t exp, const float power){
+ const float arg = power*atan2f(lv_creal(exp), lv_cimag(exp));
+ const float mag = powf(lv_creal(exp)*lv_creal(exp) + lv_cimag(exp)*lv_cimag(exp), power/2);
+ return mag*lv_cmake(cosf(arg), sinf(arg));
+}
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+
+#ifdef LV_HAVE_LIB_SIMDMATH
+#include <simdmath.h>
+#endif /* LV_HAVE_LIB_SIMDMATH */
+
+/*!
+ \brief Takes each the input complex vector value to the specified power and stores the results in the return vector
+ \param cVector The vector where the results will be stored
+ \param aVector The complex vector of values to be taken to a power
+ \param power The power value to be applied to each data point
+ \param num_points The number of values in aVector to be taken to the specified power level and stored into cVector
+*/
+static inline void volk_32fc_s32f_power_32fc_a_sse(lv_32fc_t* cVector, const lv_32fc_t* aVector, const float power, unsigned int num_points){
+ unsigned int number = 0;
+
+ lv_32fc_t* cPtr = cVector;
+ const lv_32fc_t* aPtr = aVector;
+
+#ifdef LV_HAVE_LIB_SIMDMATH
+ const unsigned int quarterPoints = num_points / 4;
+ __m128 vPower = _mm_set_ps1(power);
+
+ __m128 cplxValue1, cplxValue2, magnitude, phase, iValue, qValue;
+ for(;number < quarterPoints; number++){
+
+ cplxValue1 = _mm_load_ps((float*)aPtr);
+ aPtr += 2;
+
+ cplxValue2 = _mm_load_ps((float*)aPtr);
+ aPtr += 2;
+
+ // Convert to polar coordinates
+
+ // Arrange in i1i2i3i4 format
+ iValue = _mm_shuffle_ps(cplxValue1, cplxValue2, _MM_SHUFFLE(2,0,2,0));
+ // Arrange in q1q2q3q4 format
+ qValue = _mm_shuffle_ps(cplxValue1, cplxValue2, _MM_SHUFFLE(3,1,3,1));
+
+ phase = atan2f4(qValue, iValue); // Calculate the Phase
+
+ magnitude = _mm_sqrt_ps(_mm_add_ps(_mm_mul_ps(iValue, iValue), _mm_mul_ps(qValue, qValue))); // Calculate the magnitude by square rooting the added I2 and Q2 values
+
+ // Now calculate the power of the polar coordinate data
+ magnitude = powf4(magnitude, vPower); // Take the magnitude to the specified power
+
+ phase = _mm_mul_ps(phase, vPower); // Multiply the phase by the specified power
+
+ // Convert back to cartesian coordinates
+ iValue = _mm_mul_ps( cosf4(phase), magnitude); // Multiply the cos of the phase by the magnitude
+ qValue = _mm_mul_ps( sinf4(phase), magnitude); // Multiply the sin of the phase by the magnitude
+
+ cplxValue1 = _mm_unpacklo_ps(iValue, qValue); // Interleave the lower two i & q values
+ cplxValue2 = _mm_unpackhi_ps(iValue, qValue); // Interleave the upper two i & q values
+
+ _mm_store_ps((float*)cPtr,cplxValue1); // Store the results back into the C container
+
+ cPtr += 2;
+
+ _mm_store_ps((float*)cPtr,cplxValue2); // Store the results back into the C container
+
+ cPtr += 2;
+ }
+
+ number = quarterPoints * 4;
+#endif /* LV_HAVE_LIB_SIMDMATH */
+
+ for(;number < num_points; number++){
+ *cPtr++ = __volk_s32fc_s32f_power_s32fc_a((*aPtr++), power);
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+ /*!
+ \brief Takes each the input complex vector value to the specified power and stores the results in the return vector
+ \param cVector The vector where the results will be stored
+ \param aVector The complex vector of values to be taken to a power
+ \param power The power value to be applied to each data point
+ \param num_points The number of values in aVector to be taken to the specified power level and stored into cVector
+ */
+static inline void volk_32fc_s32f_power_32fc_generic(lv_32fc_t* cVector, const lv_32fc_t* aVector, const float power, unsigned int num_points){
+ lv_32fc_t* cPtr = cVector;
+ const lv_32fc_t* aPtr = aVector;
+ unsigned int number = 0;
+
+ for(number = 0; number < num_points; number++){
+ *cPtr++ = __volk_s32fc_s32f_power_s32fc_a((*aPtr++), power);
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_32fc_s32f_power_32fc_a_H */
diff --git a/volk/kernels/volk/volk_32fc_s32f_power_spectrum_32f.h b/volk/kernels/volk/volk_32fc_s32f_power_spectrum_32f.h
new file mode 100644
index 000000000..f76d9d35e
--- /dev/null
+++ b/volk/kernels/volk/volk_32fc_s32f_power_spectrum_32f.h
@@ -0,0 +1,126 @@
+#ifndef INCLUDED_volk_32fc_s32f_power_spectrum_32f_a_H
+#define INCLUDED_volk_32fc_s32f_power_spectrum_32f_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+#include <math.h>
+
+#ifdef LV_HAVE_SSE3
+#include <pmmintrin.h>
+
+#ifdef LV_HAVE_LIB_SIMDMATH
+#include <simdmath.h>
+#endif /* LV_HAVE_LIB_SIMDMATH */
+
+/*!
+ \brief Calculates the log10 power value for each input point
+ \param logPowerOutput The 10.0 * log10(r*r + i*i) for each data point
+ \param complexFFTInput The complex data output from the FFT point
+ \param normalizationFactor This value is divided against all the input values before the power is calculated
+ \param num_points The number of fft data points
+*/
+static inline void volk_32fc_s32f_power_spectrum_32f_a_sse3(float* logPowerOutput, const lv_32fc_t* complexFFTInput, const float normalizationFactor, unsigned int num_points){
+ const float* inputPtr = (const float*)complexFFTInput;
+ float* destPtr = logPowerOutput;
+ uint64_t number = 0;
+ const float iNormalizationFactor = 1.0 / normalizationFactor;
+#ifdef LV_HAVE_LIB_SIMDMATH
+ __m128 magScalar = _mm_set_ps1(10.0);
+ magScalar = _mm_div_ps(magScalar, logf4(magScalar));
+
+ __m128 invNormalizationFactor = _mm_set_ps1(iNormalizationFactor);
+
+ __m128 power;
+ __m128 input1, input2;
+ const uint64_t quarterPoints = num_points / 4;
+ for(;number < quarterPoints; number++){
+ // Load the complex values
+ input1 =_mm_load_ps(inputPtr);
+ inputPtr += 4;
+ input2 =_mm_load_ps(inputPtr);
+ inputPtr += 4;
+
+ // Apply the normalization factor
+ input1 = _mm_mul_ps(input1, invNormalizationFactor);
+ input2 = _mm_mul_ps(input2, invNormalizationFactor);
+
+ // Multiply each value by itself
+ // (r1*r1), (i1*i1), (r2*r2), (i2*i2)
+ input1 = _mm_mul_ps(input1, input1);
+ // (r3*r3), (i3*i3), (r4*r4), (i4*i4)
+ input2 = _mm_mul_ps(input2, input2);
+
+ // Horizontal add, to add (r*r) + (i*i) for each complex value
+ // (r1*r1)+(i1*i1), (r2*r2) + (i2*i2), (r3*r3)+(i3*i3), (r4*r4)+(i4*i4)
+ power = _mm_hadd_ps(input1, input2);
+
+ // Calculate the natural log power
+ power = logf4(power);
+
+ // Convert to log10 and multiply by 10.0
+ power = _mm_mul_ps(power, magScalar);
+
+ // Store the floating point results
+ _mm_store_ps(destPtr, power);
+
+ destPtr += 4;
+ }
+
+ number = quarterPoints*4;
+#endif /* LV_HAVE_LIB_SIMDMATH */
+ // Calculate the FFT for any remaining points
+
+ for(; number < num_points; number++){
+ // Calculate dBm
+ // 50 ohm load assumption
+ // 10 * log10 (v^2 / (2 * 50.0 * .001)) = 10 * log10( v^2 * 10)
+ // 75 ohm load assumption
+ // 10 * log10 (v^2 / (2 * 75.0 * .001)) = 10 * log10( v^2 * 15)
+
+ const float real = *inputPtr++ * iNormalizationFactor;
+ const float imag = *inputPtr++ * iNormalizationFactor;
+
+ *destPtr = 10.0*log10f(((real * real) + (imag * imag)) + 1e-20);
+
+ destPtr++;
+ }
+
+}
+#endif /* LV_HAVE_SSE3 */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Calculates the log10 power value for each input point
+ \param logPowerOutput The 10.0 * log10(r*r + i*i) for each data point
+ \param complexFFTInput The complex data output from the FFT point
+ \param normalizationFactor This value is divided agains all the input values before the power is calculated
+ \param num_points The number of fft data points
+*/
+static inline void volk_32fc_s32f_power_spectrum_32f_generic(float* logPowerOutput, const lv_32fc_t* complexFFTInput, const float normalizationFactor, unsigned int num_points){
+ // Calculate the Power of the complex point
+ const float* inputPtr = (float*)complexFFTInput;
+ float* realFFTDataPointsPtr = logPowerOutput;
+ const float iNormalizationFactor = 1.0 / normalizationFactor;
+ unsigned int point;
+ for(point = 0; point < num_points; point++){
+ // Calculate dBm
+ // 50 ohm load assumption
+ // 10 * log10 (v^2 / (2 * 50.0 * .001)) = 10 * log10( v^2 * 10)
+ // 75 ohm load assumption
+ // 10 * log10 (v^2 / (2 * 75.0 * .001)) = 10 * log10( v^2 * 15)
+
+ const float real = *inputPtr++ * iNormalizationFactor;
+ const float imag = *inputPtr++ * iNormalizationFactor;
+
+ *realFFTDataPointsPtr = 10.0*log10f(((real * real) + (imag * imag)) + 1e-20);
+
+
+ realFFTDataPointsPtr++;
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_32fc_s32f_power_spectrum_32f_a_H */
diff --git a/volk/kernels/volk/volk_32fc_s32f_x2_power_spectral_density_32f.h b/volk/kernels/volk/volk_32fc_s32f_x2_power_spectral_density_32f.h
new file mode 100644
index 000000000..e73eb09f8
--- /dev/null
+++ b/volk/kernels/volk/volk_32fc_s32f_x2_power_spectral_density_32f.h
@@ -0,0 +1,134 @@
+#ifndef INCLUDED_volk_32fc_s32f_x2_power_spectral_density_32f_a_H
+#define INCLUDED_volk_32fc_s32f_x2_power_spectral_density_32f_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+#include <math.h>
+
+#ifdef LV_HAVE_SSE3
+#include <pmmintrin.h>
+
+#ifdef LV_HAVE_LIB_SIMDMATH
+#include <simdmath.h>
+#endif /* LV_HAVE_LIB_SIMDMATH */
+
+/*!
+ \brief Calculates the log10 power value divided by the RBW for each input point
+ \param logPowerOutput The 10.0 * log10((r*r + i*i)/RBW) for each data point
+ \param complexFFTInput The complex data output from the FFT point
+ \param normalizationFactor This value is divided against all the input values before the power is calculated
+ \param rbw The resolution bandwith of the fft spectrum
+ \param num_points The number of fft data points
+*/
+static inline void volk_32fc_s32f_x2_power_spectral_density_32f_a_sse3(float* logPowerOutput, const lv_32fc_t* complexFFTInput, const float normalizationFactor, const float rbw, unsigned int num_points){
+ const float* inputPtr = (const float*)complexFFTInput;
+ float* destPtr = logPowerOutput;
+ uint64_t number = 0;
+ const float iRBW = 1.0 / rbw;
+ const float iNormalizationFactor = 1.0 / normalizationFactor;
+
+#ifdef LV_HAVE_LIB_SIMDMATH
+ __m128 magScalar = _mm_set_ps1(10.0);
+ magScalar = _mm_div_ps(magScalar, logf4(magScalar));
+
+ __m128 invRBW = _mm_set_ps1(iRBW);
+
+ __m128 invNormalizationFactor = _mm_set_ps1(iNormalizationFactor);
+
+ __m128 power;
+ __m128 input1, input2;
+ const uint64_t quarterPoints = num_points / 4;
+ for(;number < quarterPoints; number++){
+ // Load the complex values
+ input1 =_mm_load_ps(inputPtr);
+ inputPtr += 4;
+ input2 =_mm_load_ps(inputPtr);
+ inputPtr += 4;
+
+ // Apply the normalization factor
+ input1 = _mm_mul_ps(input1, invNormalizationFactor);
+ input2 = _mm_mul_ps(input2, invNormalizationFactor);
+
+ // Multiply each value by itself
+ // (r1*r1), (i1*i1), (r2*r2), (i2*i2)
+ input1 = _mm_mul_ps(input1, input1);
+ // (r3*r3), (i3*i3), (r4*r4), (i4*i4)
+ input2 = _mm_mul_ps(input2, input2);
+
+ // Horizontal add, to add (r*r) + (i*i) for each complex value
+ // (r1*r1)+(i1*i1), (r2*r2) + (i2*i2), (r3*r3)+(i3*i3), (r4*r4)+(i4*i4)
+ power = _mm_hadd_ps(input1, input2);
+
+ // Divide by the rbw
+ power = _mm_mul_ps(power, invRBW);
+
+ // Calculate the natural log power
+ power = logf4(power);
+
+ // Convert to log10 and multiply by 10.0
+ power = _mm_mul_ps(power, magScalar);
+
+ // Store the floating point results
+ _mm_store_ps(destPtr, power);
+
+ destPtr += 4;
+ }
+
+ number = quarterPoints*4;
+#endif /* LV_HAVE_LIB_SIMDMATH */
+ // Calculate the FFT for any remaining points
+ for(; number < num_points; number++){
+ // Calculate dBm
+ // 50 ohm load assumption
+ // 10 * log10 (v^2 / (2 * 50.0 * .001)) = 10 * log10( v^2 * 10)
+ // 75 ohm load assumption
+ // 10 * log10 (v^2 / (2 * 75.0 * .001)) = 10 * log10( v^2 * 15)
+
+ const float real = *inputPtr++ * iNormalizationFactor;
+ const float imag = *inputPtr++ * iNormalizationFactor;
+
+ *destPtr = 10.0*log10f((((real * real) + (imag * imag)) + 1e-20) * iRBW);
+ destPtr++;
+ }
+
+}
+#endif /* LV_HAVE_SSE3 */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Calculates the log10 power value divided by the RBW for each input point
+ \param logPowerOutput The 10.0 * log10((r*r + i*i)/RBW) for each data point
+ \param complexFFTInput The complex data output from the FFT point
+ \param normalizationFactor This value is divided against all the input values before the power is calculated
+ \param rbw The resolution bandwith of the fft spectrum
+ \param num_points The number of fft data points
+*/
+static inline void volk_32fc_s32f_x2_power_spectral_density_32f_generic(float* logPowerOutput, const lv_32fc_t* complexFFTInput, const float normalizationFactor, const float rbw, unsigned int num_points){
+ // Calculate the Power of the complex point
+ const float* inputPtr = (float*)complexFFTInput;
+ float* realFFTDataPointsPtr = logPowerOutput;
+ unsigned int point;
+ const float invRBW = 1.0 / rbw;
+ const float iNormalizationFactor = 1.0 / normalizationFactor;
+
+ for(point = 0; point < num_points; point++){
+ // Calculate dBm
+ // 50 ohm load assumption
+ // 10 * log10 (v^2 / (2 * 50.0 * .001)) = 10 * log10( v^2 * 10)
+ // 75 ohm load assumption
+ // 10 * log10 (v^2 / (2 * 75.0 * .001)) = 10 * log10( v^2 * 15)
+
+ const float real = *inputPtr++ * iNormalizationFactor;
+ const float imag = *inputPtr++ * iNormalizationFactor;
+
+ *realFFTDataPointsPtr = 10.0*log10f((((real * real) + (imag * imag)) + 1e-20) * invRBW);
+
+ realFFTDataPointsPtr++;
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_32fc_s32f_x2_power_spectral_density_32f_a_H */
diff --git a/volk/kernels/volk/volk_32fc_s32fc_multiply_32fc.h b/volk/kernels/volk/volk_32fc_s32fc_multiply_32fc.h
new file mode 100644
index 000000000..668a04760
--- /dev/null
+++ b/volk/kernels/volk/volk_32fc_s32fc_multiply_32fc.h
@@ -0,0 +1,178 @@
+#ifndef INCLUDED_volk_32fc_s32fc_multiply_32fc_u_H
+#define INCLUDED_volk_32fc_s32fc_multiply_32fc_u_H
+
+#include <inttypes.h>
+#include <stdio.h>
+#include <volk/volk_complex.h>
+#include <float.h>
+
+#ifdef LV_HAVE_SSE3
+#include <pmmintrin.h>
+/*!
+ \brief Multiplies the input vector by a scalar and stores the results in the third vector
+ \param cVector The vector where the results will be stored
+ \param aVector The vector to be multiplied
+ \param scalar The complex scalar to multiply aVector
+ \param num_points The number of complex values in aVector and bVector to be multiplied together and stored into cVector
+*/
+static inline void volk_32fc_s32fc_multiply_32fc_u_sse3(lv_32fc_t* cVector, const lv_32fc_t* aVector, const lv_32fc_t scalar, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int halfPoints = num_points / 2;
+
+ __m128 x, yl, yh, z, tmp1, tmp2;
+ lv_32fc_t* c = cVector;
+ const lv_32fc_t* a = aVector;
+
+ // Set up constant scalar vector
+ yl = _mm_set_ps1(lv_creal(scalar));
+ yh = _mm_set_ps1(lv_cimag(scalar));
+
+ for(;number < halfPoints; number++){
+
+ x = _mm_loadu_ps((float*)a); // Load the ar + ai, br + bi as ar,ai,br,bi
+
+ tmp1 = _mm_mul_ps(x,yl); // tmp1 = ar*cr,ai*cr,br*dr,bi*dr
+
+ x = _mm_shuffle_ps(x,x,0xB1); // Re-arrange x to be ai,ar,bi,br
+
+ tmp2 = _mm_mul_ps(x,yh); // tmp2 = ai*ci,ar*ci,bi*di,br*di
+
+ z = _mm_addsub_ps(tmp1,tmp2); // ar*cr-ai*ci, ai*cr+ar*ci, br*dr-bi*di, bi*dr+br*di
+
+ _mm_storeu_ps((float*)c,z); // Store the results back into the C container
+
+ a += 2;
+ c += 2;
+ }
+
+ if((num_points % 2) != 0) {
+ *c = (*a) * scalar;
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Multiplies the input vector by a scalar and stores the results in the third vector
+ \param cVector The vector where the results will be stored
+ \param aVector The vector to be multiplied
+ \param scalar The complex scalar to multiply aVector
+ \param num_points The number of complex values in aVector and bVector to be multiplied together and stored into cVector
+*/
+static inline void volk_32fc_s32fc_multiply_32fc_generic(lv_32fc_t* cVector, const lv_32fc_t* aVector, const lv_32fc_t scalar, unsigned int num_points){
+ lv_32fc_t* cPtr = cVector;
+ const lv_32fc_t* aPtr = aVector;
+ unsigned int number = num_points;
+
+ // unwrap loop
+ while (number >= 8){
+ *cPtr++ = (*aPtr++) * scalar;
+ *cPtr++ = (*aPtr++) * scalar;
+ *cPtr++ = (*aPtr++) * scalar;
+ *cPtr++ = (*aPtr++) * scalar;
+ *cPtr++ = (*aPtr++) * scalar;
+ *cPtr++ = (*aPtr++) * scalar;
+ *cPtr++ = (*aPtr++) * scalar;
+ *cPtr++ = (*aPtr++) * scalar;
+ number -= 8;
+ }
+
+ // clean up any remaining
+ while (number-- > 0)
+ *cPtr++ = *aPtr++ * scalar;
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+#endif /* INCLUDED_volk_32fc_x2_multiply_32fc_u_H */
+#ifndef INCLUDED_volk_32fc_s32fc_multiply_32fc_a_H
+#define INCLUDED_volk_32fc_s32fc_multiply_32fc_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+#include <volk/volk_complex.h>
+#include <float.h>
+
+#ifdef LV_HAVE_SSE3
+#include <pmmintrin.h>
+ /*!
+ \brief Multiplies the two input complex vectors and stores their results in the third vector
+ \param cVector The vector where the results will be stored
+ \param aVector One of the vectors to be multiplied
+ \param bVector One of the vectors to be multiplied
+ \param num_points The number of complex values in aVector and bVector to be multiplied together and stored into cVector
+ */
+static inline void volk_32fc_s32fc_multiply_32fc_a_sse3(lv_32fc_t* cVector, const lv_32fc_t* aVector, const lv_32fc_t scalar, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int halfPoints = num_points / 2;
+
+ __m128 x, yl, yh, z, tmp1, tmp2;
+ lv_32fc_t* c = cVector;
+ const lv_32fc_t* a = aVector;
+
+ // Set up constant scalar vector
+ yl = _mm_set_ps1(lv_creal(scalar));
+ yh = _mm_set_ps1(lv_cimag(scalar));
+
+ for(;number < halfPoints; number++){
+
+ x = _mm_load_ps((float*)a); // Load the ar + ai, br + bi as ar,ai,br,bi
+
+ tmp1 = _mm_mul_ps(x,yl); // tmp1 = ar*cr,ai*cr,br*dr,bi*dr
+
+ x = _mm_shuffle_ps(x,x,0xB1); // Re-arrange x to be ai,ar,bi,br
+
+ tmp2 = _mm_mul_ps(x,yh); // tmp2 = ai*ci,ar*ci,bi*di,br*di
+
+ z = _mm_addsub_ps(tmp1,tmp2); // ar*cr-ai*ci, ai*cr+ar*ci, br*dr-bi*di, bi*dr+br*di
+
+ _mm_store_ps((float*)c,z); // Store the results back into the C container
+
+ a += 2;
+ c += 2;
+ }
+
+ if((num_points % 2) != 0) {
+ *c = (*a) * scalar;
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+
+#ifdef LV_HAVE_GENERIC
+ /*!
+ \brief Multiplies the two input complex vectors and stores their results in the third vector
+ \param cVector The vector where the results will be stored
+ \param aVector One of the vectors to be multiplied
+ \param bVector One of the vectors to be multiplied
+ \param num_points The number of complex values in aVector and bVector to be multiplied together and stored into cVector
+ */
+static inline void volk_32fc_s32fc_multiply_32fc_a_generic(lv_32fc_t* cVector, const lv_32fc_t* aVector, const lv_32fc_t scalar, unsigned int num_points){
+ lv_32fc_t* cPtr = cVector;
+ const lv_32fc_t* aPtr = aVector;
+ unsigned int number = num_points;
+
+ // unwrap loop
+ while (number >= 8){
+ *cPtr++ = (*aPtr++) * scalar;
+ *cPtr++ = (*aPtr++) * scalar;
+ *cPtr++ = (*aPtr++) * scalar;
+ *cPtr++ = (*aPtr++) * scalar;
+ *cPtr++ = (*aPtr++) * scalar;
+ *cPtr++ = (*aPtr++) * scalar;
+ *cPtr++ = (*aPtr++) * scalar;
+ *cPtr++ = (*aPtr++) * scalar;
+ number -= 8;
+ }
+
+ // clean up any remaining
+ while (number-- > 0)
+ *cPtr++ = *aPtr++ * scalar;
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+
+#endif /* INCLUDED_volk_32fc_x2_multiply_32fc_a_H */
diff --git a/volk/kernels/volk/volk_32fc_s32fc_rotatorpuppet_32fc.h b/volk/kernels/volk/volk_32fc_s32fc_rotatorpuppet_32fc.h
new file mode 100644
index 000000000..ab6b7fb1d
--- /dev/null
+++ b/volk/kernels/volk/volk_32fc_s32fc_rotatorpuppet_32fc.h
@@ -0,0 +1,74 @@
+#ifndef INCLUDED_volk_32fc_s32fc_rotatorpuppet_32fc_a_H
+#define INCLUDED_volk_32fc_s32fc_rotatorpuppet_32fc_a_H
+
+
+#include <volk/volk_complex.h>
+#include <stdio.h>
+#include <volk/volk_32fc_s32fc_x2_rotator_32fc.h>
+
+
+#ifdef LV_HAVE_GENERIC
+
+/*!
+ \brief rotate input vector at fixed rate per sample from initial phase offset
+ \param outVector The vector where the results will be stored
+ \param inVector Vector to be rotated
+ \param phase_inc rotational velocity
+ \param phase initial phase offset
+ \param num_points The number of values in inVector to be rotated and stored into cVector
+*/
+
+
+static inline void volk_32fc_s32fc_rotatorpuppet_32fc_generic(lv_32fc_t* outVector, const lv_32fc_t* inVector, const lv_32fc_t phase_inc, unsigned int num_points){
+ lv_32fc_t phase[1] = {lv_cmake(.3, 0.95393)};
+ volk_32fc_s32fc_x2_rotator_32fc_generic(outVector, inVector, phase_inc, phase, num_points);
+
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+#ifdef LV_HAVE_SSE4_1
+#include <smmintrin.h>
+
+static inline void volk_32fc_s32fc_rotatorpuppet_32fc_a_sse4_1(lv_32fc_t* outVector, const lv_32fc_t* inVector, const lv_32fc_t phase_inc, unsigned int num_points){
+ lv_32fc_t phase[1] = {lv_cmake(.3, .95393)};
+ volk_32fc_s32fc_x2_rotator_32fc_sse4_1(outVector, inVector, phase_inc, phase, num_points);
+
+}
+
+
+
+
+#endif /* LV_HAVE_SSE4_1 */
+
+#ifdef LV_HAVE_AVX
+#include <immintrin.h>
+
+/*!
+ \brief rotate input vector at fixed rate per sample from initial phase offset
+ \param outVector The vector where the results will be stored
+ \param inVector Vector to be rotated
+ \param phase_inc rotational velocity
+ \param phase initial phase offset
+ \param num_points The number of values in inVector to be rotated and stored into cVector
+*/
+
+
+
+
+static inline void volk_32fc_s32fc_rotatorpuppet_32fc_a_avx(lv_32fc_t* outVector, const lv_32fc_t* inVector, const lv_32fc_t phase_inc, unsigned int num_points){
+ lv_32fc_t phase[1] = {lv_cmake(.3, .95393)};
+ volk_32fc_s32fc_x2_rotator_32fc_avx(outVector, inVector, phase_inc, phase, num_points);
+
+}
+
+#endif /* LV_HAVE_AVX */
+
+
+
+
+
+
+
+
+#endif /* INCLUDED_volk_32fc_s32fc_rotatorpuppet_32fc_a_H */
diff --git a/volk/kernels/volk/volk_32fc_s32fc_x2_rotator_32fc.h b/volk/kernels/volk/volk_32fc_s32fc_x2_rotator_32fc.h
new file mode 100644
index 000000000..ffbbdff69
--- /dev/null
+++ b/volk/kernels/volk/volk_32fc_s32fc_x2_rotator_32fc.h
@@ -0,0 +1,257 @@
+#ifndef INCLUDED_volk_32fc_s32fc_rotator_32fc_a_H
+#define INCLUDED_volk_32fc_s32fc_rotator_32fc_a_H
+
+
+#include <volk/volk_complex.h>
+#include <stdio.h>
+#include <stdlib.h>
+#define ROTATOR_RELOAD 512
+
+
+#ifdef LV_HAVE_GENERIC
+
+/*!
+ \brief rotate input vector at fixed rate per sample from initial phase offset
+ \param outVector The vector where the results will be stored
+ \param inVector Vector to be rotated
+ \param phase_inc rotational velocity
+ \param phase initial phase offset
+ \param num_points The number of values in inVector to be rotated and stored into cVector
+*/
+
+
+static inline void volk_32fc_s32fc_x2_rotator_32fc_generic(lv_32fc_t* outVector, const lv_32fc_t* inVector, const lv_32fc_t phase_inc, lv_32fc_t* phase, unsigned int num_points){
+ unsigned int i = 0;
+ int j = 0;
+ for(i = 0; i < (unsigned int)(num_points/ROTATOR_RELOAD); ++i) {
+ for(j = 0; j < ROTATOR_RELOAD; ++j) {
+ *outVector++ = *inVector++ * (*phase);
+ (*phase) *= phase_inc;
+ }
+ (*phase) /= abs((*phase));
+ }
+ for(i = 0; i < num_points%ROTATOR_RELOAD; ++i) {
+ *outVector++ = *inVector++ * (*phase);
+ (*phase) *= phase_inc;
+ }
+
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+#ifdef LV_HAVE_SSE4_1
+#include <smmintrin.h>
+
+static inline void volk_32fc_s32fc_x2_rotator_32fc_sse4_1(lv_32fc_t* outVector, const lv_32fc_t* inVector, const lv_32fc_t phase_inc, lv_32fc_t* phase, unsigned int num_points){
+ lv_32fc_t* cPtr = outVector;
+ const lv_32fc_t* aPtr = inVector;
+ lv_32fc_t incr = 1;
+ lv_32fc_t phase_Ptr[2] = {(*phase), (*phase)};
+
+ unsigned int i, j = 0;
+
+ for(i = 0; i < 2; ++i) {
+ phase_Ptr[i] *= incr;
+ incr *= (phase_inc);
+ }
+
+ /*printf("%f, %f\n", lv_creal(phase_Ptr[0]), lv_cimag(phase_Ptr[0]));
+ printf("%f, %f\n", lv_creal(phase_Ptr[1]), lv_cimag(phase_Ptr[1]));
+ printf("%f, %f\n", lv_creal(phase_Ptr[2]), lv_cimag(phase_Ptr[2]));
+ printf("%f, %f\n", lv_creal(phase_Ptr[3]), lv_cimag(phase_Ptr[3]));
+ printf("incr: %f, %f\n", lv_creal(incr), lv_cimag(incr));*/
+ __m128 aVal, phase_Val, inc_Val, yl, yh, tmp1, tmp2, z, ylp, yhp, tmp1p, tmp2p;
+
+ phase_Val = _mm_loadu_ps((float*)phase_Ptr);
+ inc_Val = _mm_set_ps(lv_cimag(incr), lv_creal(incr),lv_cimag(incr), lv_creal(incr));
+
+ const unsigned int halfPoints = num_points / 2;
+
+
+ for(i = 0; i < (unsigned int)(halfPoints/ROTATOR_RELOAD); i++) {
+ for(j = 0; j < ROTATOR_RELOAD; ++j) {
+
+ aVal = _mm_load_ps((float*)aPtr);
+
+ yl = _mm_moveldup_ps(phase_Val);
+ yh = _mm_movehdup_ps(phase_Val);
+ ylp = _mm_moveldup_ps(inc_Val);
+ yhp = _mm_movehdup_ps(inc_Val);
+
+ tmp1 = _mm_mul_ps(aVal, yl);
+ tmp1p = _mm_mul_ps(phase_Val, ylp);
+
+ aVal = _mm_shuffle_ps(aVal, aVal, 0xB1);
+ phase_Val = _mm_shuffle_ps(phase_Val, phase_Val, 0xB1);
+ tmp2 = _mm_mul_ps(aVal, yh);
+ tmp2p = _mm_mul_ps(phase_Val, yhp);
+
+ z = _mm_addsub_ps(tmp1, tmp2);
+ phase_Val = _mm_addsub_ps(tmp1p, tmp2p);
+
+ _mm_store_ps((float*)cPtr, z);
+
+ aPtr += 2;
+ cPtr += 2;
+ }
+ tmp1 = _mm_mul_ps(phase_Val, phase_Val);
+ tmp2 = _mm_hadd_ps(tmp1, tmp1);
+ tmp1 = _mm_shuffle_ps(tmp2, tmp2, 0xD8);
+ phase_Val = _mm_div_ps(phase_Val, tmp1);
+ }
+ for(i = 0; i < halfPoints%ROTATOR_RELOAD; ++i) {
+ aVal = _mm_load_ps((float*)aPtr);
+
+ yl = _mm_moveldup_ps(phase_Val);
+ yh = _mm_movehdup_ps(phase_Val);
+ ylp = _mm_moveldup_ps(inc_Val);
+ yhp = _mm_movehdup_ps(inc_Val);
+
+ tmp1 = _mm_mul_ps(aVal, yl);
+
+ tmp1p = _mm_mul_ps(phase_Val, ylp);
+
+ aVal = _mm_shuffle_ps(aVal, aVal, 0xB1);
+ phase_Val = _mm_shuffle_ps(phase_Val, phase_Val, 0xB1);
+ tmp2 = _mm_mul_ps(aVal, yh);
+ tmp2p = _mm_mul_ps(phase_Val, yhp);
+
+ z = _mm_addsub_ps(tmp1, tmp2);
+ phase_Val = _mm_addsub_ps(tmp1p, tmp2p);
+
+ _mm_store_ps((float*)cPtr, z);
+
+ aPtr += 2;
+ cPtr += 2;
+ }
+
+ _mm_storeu_ps((float*)phase_Ptr, phase_Val);
+ for(i = 0; i < num_points%2; ++i) {
+ *cPtr++ = *aPtr++ * phase_Ptr[0];
+ phase_Ptr[0] *= (phase_inc);
+ }
+
+ (*phase) = phase_Ptr[0];
+
+}
+
+#endif /* LV_HAVE_SSE4_1 */
+
+
+#ifdef LV_HAVE_AVX
+#include <immintrin.h>
+
+/*!
+ \brief rotate input vector at fixed rate per sample from initial phase offset
+ \param outVector The vector where the results will be stored
+ \param inVector Vector to be rotated
+ \param phase_inc rotational velocity
+ \param phase initial phase offset
+ \param num_points The number of values in inVector to be rotated and stored into cVector
+*/
+
+
+
+
+static inline void volk_32fc_s32fc_x2_rotator_32fc_avx(lv_32fc_t* outVector, const lv_32fc_t* inVector, const lv_32fc_t phase_inc, lv_32fc_t* phase, unsigned int num_points){
+ lv_32fc_t* cPtr = outVector;
+ const lv_32fc_t* aPtr = inVector;
+ lv_32fc_t incr = 1;
+ lv_32fc_t phase_Ptr[4] = {(*phase), (*phase), (*phase), (*phase)};
+
+ unsigned int i, j = 0;
+
+ for(i = 0; i < 4; ++i) {
+ phase_Ptr[i] *= incr;
+ incr *= (phase_inc);
+ }
+
+ /*printf("%f, %f\n", lv_creal(phase_Ptr[0]), lv_cimag(phase_Ptr[0]));
+ printf("%f, %f\n", lv_creal(phase_Ptr[1]), lv_cimag(phase_Ptr[1]));
+ printf("%f, %f\n", lv_creal(phase_Ptr[2]), lv_cimag(phase_Ptr[2]));
+ printf("%f, %f\n", lv_creal(phase_Ptr[3]), lv_cimag(phase_Ptr[3]));
+ printf("incr: %f, %f\n", lv_creal(incr), lv_cimag(incr));*/
+ __m256 aVal, phase_Val, inc_Val, yl, yh, tmp1, tmp2, z, ylp, yhp, tmp1p, tmp2p;
+
+ phase_Val = _mm256_loadu_ps((float*)phase_Ptr);
+ inc_Val = _mm256_set_ps(lv_cimag(incr), lv_creal(incr),lv_cimag(incr), lv_creal(incr),lv_cimag(incr), lv_creal(incr),lv_cimag(incr), lv_creal(incr));
+ const unsigned int fourthPoints = num_points / 4;
+
+
+ for(i = 0; i < (unsigned int)(fourthPoints/ROTATOR_RELOAD); i++) {
+ for(j = 0; j < ROTATOR_RELOAD; ++j) {
+
+ aVal = _mm256_load_ps((float*)aPtr);
+
+ yl = _mm256_moveldup_ps(phase_Val);
+ yh = _mm256_movehdup_ps(phase_Val);
+ ylp = _mm256_moveldup_ps(inc_Val);
+ yhp = _mm256_movehdup_ps(inc_Val);
+
+ tmp1 = _mm256_mul_ps(aVal, yl);
+ tmp1p = _mm256_mul_ps(phase_Val, ylp);
+
+ aVal = _mm256_shuffle_ps(aVal, aVal, 0xB1);
+ phase_Val = _mm256_shuffle_ps(phase_Val, phase_Val, 0xB1);
+ tmp2 = _mm256_mul_ps(aVal, yh);
+ tmp2p = _mm256_mul_ps(phase_Val, yhp);
+
+ z = _mm256_addsub_ps(tmp1, tmp2);
+ phase_Val = _mm256_addsub_ps(tmp1p, tmp2p);
+
+ _mm256_store_ps((float*)cPtr, z);
+
+ aPtr += 4;
+ cPtr += 4;
+ }
+ tmp1 = _mm256_mul_ps(phase_Val, phase_Val);
+ tmp2 = _mm256_hadd_ps(tmp1, tmp1);
+ tmp1 = _mm256_shuffle_ps(tmp2, tmp2, 0xD8);
+ phase_Val = _mm256_div_ps(phase_Val, tmp1);
+ }
+ for(i = 0; i < fourthPoints%ROTATOR_RELOAD; ++i) {
+ aVal = _mm256_load_ps((float*)aPtr);
+
+ yl = _mm256_moveldup_ps(phase_Val);
+ yh = _mm256_movehdup_ps(phase_Val);
+ ylp = _mm256_moveldup_ps(inc_Val);
+ yhp = _mm256_movehdup_ps(inc_Val);
+
+ tmp1 = _mm256_mul_ps(aVal, yl);
+
+ tmp1p = _mm256_mul_ps(phase_Val, ylp);
+
+ aVal = _mm256_shuffle_ps(aVal, aVal, 0xB1);
+ phase_Val = _mm256_shuffle_ps(phase_Val, phase_Val, 0xB1);
+ tmp2 = _mm256_mul_ps(aVal, yh);
+ tmp2p = _mm256_mul_ps(phase_Val, yhp);
+
+ z = _mm256_addsub_ps(tmp1, tmp2);
+ phase_Val = _mm256_addsub_ps(tmp1p, tmp2p);
+
+ _mm256_store_ps((float*)cPtr, z);
+
+ aPtr += 4;
+ cPtr += 4;
+ }
+
+ _mm256_storeu_ps((float*)phase_Ptr, phase_Val);
+ for(i = 0; i < num_points%4; ++i) {
+ *cPtr++ = *aPtr++ * phase_Ptr[0];
+ phase_Ptr[0] *= (phase_inc);
+ }
+
+ (*phase) = phase_Ptr[0];
+
+}
+
+#endif /* LV_HAVE_AVX */
+
+
+
+
+
+
+
+
+#endif /* INCLUDED_volk_32fc_s32fc_rotator_32fc_a_H */
diff --git a/volk/kernels/volk/volk_32fc_x2_conjugate_dot_prod_32fc.h b/volk/kernels/volk/volk_32fc_x2_conjugate_dot_prod_32fc.h
new file mode 100644
index 000000000..e6ccf5c38
--- /dev/null
+++ b/volk/kernels/volk/volk_32fc_x2_conjugate_dot_prod_32fc.h
@@ -0,0 +1,500 @@
+#ifndef INCLUDED_volk_32fc_x2_conjugate_dot_prod_32fc_u_H
+#define INCLUDED_volk_32fc_x2_conjugate_dot_prod_32fc_u_H
+
+
+#include<volk/volk_complex.h>
+
+
+#ifdef LV_HAVE_GENERIC
+
+
+static inline void volk_32fc_x2_conjugate_dot_prod_32fc_generic(lv_32fc_t* result, const lv_32fc_t* input, const lv_32fc_t* taps, unsigned int num_points) {
+
+ const unsigned int num_bytes = num_points*8;
+
+ float * res = (float*) result;
+ float * in = (float*) input;
+ float * tp = (float*) taps;
+ unsigned int n_2_ccomplex_blocks = num_bytes >> 4;
+ unsigned int isodd = (num_bytes >> 3) &1;
+
+
+
+ float sum0[2] = {0,0};
+ float sum1[2] = {0,0};
+ unsigned int i = 0;
+
+
+ for(i = 0; i < n_2_ccomplex_blocks; ++i) {
+
+ sum0[0] += in[0] * tp[0] + in[1] * tp[1];
+ sum0[1] += (-in[0] * tp[1]) + in[1] * tp[0];
+ sum1[0] += in[2] * tp[2] + in[3] * tp[3];
+ sum1[1] += (-in[2] * tp[3]) + in[3] * tp[2];
+
+
+ in += 4;
+ tp += 4;
+
+ }
+
+
+ res[0] = sum0[0] + sum1[0];
+ res[1] = sum0[1] + sum1[1];
+
+
+
+ for(i = 0; i < isodd; ++i) {
+
+
+ *result += input[(num_bytes >> 3) - 1] * lv_conj(taps[(num_bytes >> 3) - 1]);
+
+ }
+ /*
+ for(i = 0; i < num_bytes >> 3; ++i) {
+ *result += input[i] * conjf(taps[i]);
+ }
+ */
+}
+
+#endif /*LV_HAVE_GENERIC*/
+
+#ifdef LV_HAVE_SSE3
+
+#include <xmmintrin.h>
+#include <pmmintrin.h>
+#include <mmintrin.h>
+
+
+static inline void volk_32fc_x2_conjugate_dot_prod_32fc_u_sse3(lv_32fc_t* result, const lv_32fc_t* input, const lv_32fc_t* taps, unsigned int num_points) {
+
+ unsigned int num_bytes = num_points*8;
+
+ // Variable never used?
+ //__VOLK_ATTR_ALIGNED(16) static const uint32_t conjugator[4]= {0x00000000, 0x80000000, 0x00000000, 0x80000000};
+
+ union HalfMask {
+ uint32_t intRep[4];
+ __m128 vec;
+ } halfMask;
+
+ union NegMask {
+ int intRep[4];
+ __m128 vec;
+ } negMask;
+
+ unsigned int offset = 0;
+ float Rsum=0, Isum=0;
+ float Im,Re;
+
+ __m128 in1, in2, Rv, fehg, Iv, Rs, Ivm, Is;
+ __m128 zv = {0,0,0,0};
+
+ halfMask.intRep[0] = halfMask.intRep[1] = 0xFFFFFFFF;
+ halfMask.intRep[2] = halfMask.intRep[3] = 0x00000000;
+
+ negMask.intRep[0] = negMask.intRep[2] = 0x80000000;
+ negMask.intRep[1] = negMask.intRep[3] = 0;
+
+ // main loop
+ while(num_bytes >= 4*sizeof(float)){
+
+ in1 = _mm_loadu_ps( (float*) (input+offset) );
+ in2 = _mm_loadu_ps( (float*) (taps+offset) );
+ Rv = _mm_mul_ps(in1, in2);
+ fehg = _mm_shuffle_ps(in2, in2, _MM_SHUFFLE(2,3,0,1));
+ Iv = _mm_mul_ps(in1, fehg);
+ Rs = _mm_hadd_ps( _mm_hadd_ps(Rv, zv) ,zv);
+ Ivm = _mm_xor_ps( negMask.vec, Iv );
+ Is = _mm_hadd_ps( _mm_hadd_ps(Ivm, zv) ,zv);
+ _mm_store_ss( &Im, Is );
+ _mm_store_ss( &Re, Rs );
+ num_bytes -= 4*sizeof(float);
+ offset += 2;
+ Rsum += Re;
+ Isum += Im;
+ }
+
+ // handle the last complex case ...
+ if(num_bytes > 0){
+
+ if(num_bytes != 4){
+ // bad things are happening
+ }
+
+ in1 = _mm_loadu_ps( (float*) (input+offset) );
+ in2 = _mm_loadu_ps( (float*) (taps+offset) );
+ Rv = _mm_and_ps(_mm_mul_ps(in1, in2), halfMask.vec);
+ fehg = _mm_shuffle_ps(in2, in2, _MM_SHUFFLE(2,3,0,1));
+ Iv = _mm_and_ps(_mm_mul_ps(in1, fehg), halfMask.vec);
+ Rs = _mm_hadd_ps(_mm_hadd_ps(Rv, zv),zv);
+ Ivm = _mm_xor_ps( negMask.vec, Iv );
+ Is = _mm_hadd_ps(_mm_hadd_ps(Ivm, zv),zv);
+ _mm_store_ss( &Im, Is );
+ _mm_store_ss( &Re, Rs );
+ Rsum += Re;
+ Isum += Im;
+ }
+
+ result[0] = lv_cmake(Rsum,Isum);
+ return;
+}
+
+#endif /*LV_HAVE_SSE3*/
+
+
+#endif /*INCLUDED_volk_32fc_x2_conjugate_dot_prod_32fc_u_H*/
+
+
+
+#ifndef INCLUDED_volk_32fc_x2_conjugate_dot_prod_32fc_a_H
+#define INCLUDED_volk_32fc_x2_conjugate_dot_prod_32fc_a_H
+
+#include <volk/volk_common.h>
+#include<volk/volk_complex.h>
+#include<stdio.h>
+
+
+#ifdef LV_HAVE_GENERIC
+
+
+static inline void volk_32fc_x2_conjugate_dot_prod_32fc_a_generic(lv_32fc_t* result, const lv_32fc_t* input, const lv_32fc_t* taps, unsigned int num_points) {
+
+ const unsigned int num_bytes = num_points*8;
+
+ float * res = (float*) result;
+ float * in = (float*) input;
+ float * tp = (float*) taps;
+ unsigned int n_2_ccomplex_blocks = num_bytes >> 4;
+ unsigned int isodd = (num_bytes >> 3) &1;
+
+
+
+ float sum0[2] = {0,0};
+ float sum1[2] = {0,0};
+ unsigned int i = 0;
+
+
+ for(i = 0; i < n_2_ccomplex_blocks; ++i) {
+
+
+ sum0[0] += in[0] * tp[0] + in[1] * tp[1];
+ sum0[1] += (-in[0] * tp[1]) + in[1] * tp[0];
+ sum1[0] += in[2] * tp[2] + in[3] * tp[3];
+ sum1[1] += (-in[2] * tp[3]) + in[3] * tp[2];
+
+
+ in += 4;
+ tp += 4;
+
+ }
+
+
+ res[0] = sum0[0] + sum1[0];
+ res[1] = sum0[1] + sum1[1];
+
+
+
+ for(i = 0; i < isodd; ++i) {
+
+
+ *result += input[(num_bytes >> 3) - 1] * lv_conj(taps[(num_bytes >> 3) - 1]);
+
+ }
+ /*
+ for(i = 0; i < num_bytes >> 3; ++i) {
+ *result += input[i] * conjf(taps[i]);
+ }
+ */
+}
+
+#endif /*LV_HAVE_GENERIC*/
+
+
+#if LV_HAVE_SSE && LV_HAVE_64
+
+
+static inline void volk_32fc_x2_conjugate_dot_prod_32fc_a_sse(lv_32fc_t* result, const lv_32fc_t* input, const lv_32fc_t* taps, unsigned int num_points) {
+
+ const unsigned int num_bytes = num_points*8;
+
+ __VOLK_ATTR_ALIGNED(16) static const uint32_t conjugator[4]= {0x00000000, 0x80000000, 0x00000000, 0x80000000};
+
+
+
+
+ asm volatile
+ (
+ "# ccomplex_conjugate_dotprod_generic (float* result, const float *input,\n\t"
+ "# const float *taps, unsigned num_bytes)\n\t"
+ "# float sum0 = 0;\n\t"
+ "# float sum1 = 0;\n\t"
+ "# float sum2 = 0;\n\t"
+ "# float sum3 = 0;\n\t"
+ "# do {\n\t"
+ "# sum0 += input[0] * taps[0] - input[1] * taps[1];\n\t"
+ "# sum1 += input[0] * taps[1] + input[1] * taps[0];\n\t"
+ "# sum2 += input[2] * taps[2] - input[3] * taps[3];\n\t"
+ "# sum3 += input[2] * taps[3] + input[3] * taps[2];\n\t"
+ "# input += 4;\n\t"
+ "# taps += 4; \n\t"
+ "# } while (--n_2_ccomplex_blocks != 0);\n\t"
+ "# result[0] = sum0 + sum2;\n\t"
+ "# result[1] = sum1 + sum3;\n\t"
+ "# TODO: prefetch and better scheduling\n\t"
+ " xor %%r9, %%r9\n\t"
+ " xor %%r10, %%r10\n\t"
+ " movq %[conjugator], %%r9\n\t"
+ " movq %%rcx, %%rax\n\t"
+ " movaps 0(%%r9), %%xmm8\n\t"
+ " movq %%rcx, %%r8\n\t"
+ " movq %[rsi], %%r9\n\t"
+ " movq %[rdx], %%r10\n\t"
+ " xorps %%xmm6, %%xmm6 # zero accumulators\n\t"
+ " movaps 0(%%r9), %%xmm0\n\t"
+ " xorps %%xmm7, %%xmm7 # zero accumulators\n\t"
+ " movups 0(%%r10), %%xmm2\n\t"
+ " shr $5, %%rax # rax = n_2_ccomplex_blocks / 2\n\t"
+ " shr $4, %%r8\n\t"
+ " xorps %%xmm8, %%xmm2\n\t"
+ " jmp .%=L1_test\n\t"
+ " # 4 taps / loop\n\t"
+ " # something like ?? cycles / loop\n\t"
+ ".%=Loop1: \n\t"
+ "# complex prod: C += A * B, w/ temp Z & Y (or B), xmmPN=$0x8000000080000000\n\t"
+ "# movaps (%%r9), %%xmmA\n\t"
+ "# movaps (%%r10), %%xmmB\n\t"
+ "# movaps %%xmmA, %%xmmZ\n\t"
+ "# shufps $0xb1, %%xmmZ, %%xmmZ # swap internals\n\t"
+ "# mulps %%xmmB, %%xmmA\n\t"
+ "# mulps %%xmmZ, %%xmmB\n\t"
+ "# # SSE replacement for: pfpnacc %%xmmB, %%xmmA\n\t"
+ "# xorps %%xmmPN, %%xmmA\n\t"
+ "# movaps %%xmmA, %%xmmZ\n\t"
+ "# unpcklps %%xmmB, %%xmmA\n\t"
+ "# unpckhps %%xmmB, %%xmmZ\n\t"
+ "# movaps %%xmmZ, %%xmmY\n\t"
+ "# shufps $0x44, %%xmmA, %%xmmZ # b01000100\n\t"
+ "# shufps $0xee, %%xmmY, %%xmmA # b11101110\n\t"
+ "# addps %%xmmZ, %%xmmA\n\t"
+ "# addps %%xmmA, %%xmmC\n\t"
+ "# A=xmm0, B=xmm2, Z=xmm4\n\t"
+ "# A'=xmm1, B'=xmm3, Z'=xmm5\n\t"
+ " movaps 16(%%r9), %%xmm1\n\t"
+ " movaps %%xmm0, %%xmm4\n\t"
+ " mulps %%xmm2, %%xmm0\n\t"
+ " shufps $0xb1, %%xmm4, %%xmm4 # swap internals\n\t"
+ " movaps 16(%%r10), %%xmm3\n\t"
+ " movaps %%xmm1, %%xmm5\n\t"
+ " xorps %%xmm8, %%xmm3\n\t"
+ " addps %%xmm0, %%xmm6\n\t"
+ " mulps %%xmm3, %%xmm1\n\t"
+ " shufps $0xb1, %%xmm5, %%xmm5 # swap internals\n\t"
+ " addps %%xmm1, %%xmm6\n\t"
+ " mulps %%xmm4, %%xmm2\n\t"
+ " movaps 32(%%r9), %%xmm0\n\t"
+ " addps %%xmm2, %%xmm7\n\t"
+ " mulps %%xmm5, %%xmm3\n\t"
+ " add $32, %%r9\n\t"
+ " movaps 32(%%r10), %%xmm2\n\t"
+ " addps %%xmm3, %%xmm7\n\t"
+ " add $32, %%r10\n\t"
+ " xorps %%xmm8, %%xmm2\n\t"
+ ".%=L1_test:\n\t"
+ " dec %%rax\n\t"
+ " jge .%=Loop1\n\t"
+ " # We've handled the bulk of multiplies up to here.\n\t"
+ " # Let's sse if original n_2_ccomplex_blocks was odd.\n\t"
+ " # If so, we've got 2 more taps to do.\n\t"
+ " and $1, %%r8\n\t"
+ " je .%=Leven\n\t"
+ " # The count was odd, do 2 more taps.\n\t"
+ " # Note that we've already got mm0/mm2 preloaded\n\t"
+ " # from the main loop.\n\t"
+ " movaps %%xmm0, %%xmm4\n\t"
+ " mulps %%xmm2, %%xmm0\n\t"
+ " shufps $0xb1, %%xmm4, %%xmm4 # swap internals\n\t"
+ " addps %%xmm0, %%xmm6\n\t"
+ " mulps %%xmm4, %%xmm2\n\t"
+ " addps %%xmm2, %%xmm7\n\t"
+ ".%=Leven:\n\t"
+ " # neg inversor\n\t"
+ " xorps %%xmm1, %%xmm1\n\t"
+ " mov $0x80000000, %%r9\n\t"
+ " movd %%r9, %%xmm1\n\t"
+ " shufps $0x11, %%xmm1, %%xmm1 # b00010001 # 0 -0 0 -0\n\t"
+ " # pfpnacc\n\t"
+ " xorps %%xmm1, %%xmm6\n\t"
+ " movaps %%xmm6, %%xmm2\n\t"
+ " unpcklps %%xmm7, %%xmm6\n\t"
+ " unpckhps %%xmm7, %%xmm2\n\t"
+ " movaps %%xmm2, %%xmm3\n\t"
+ " shufps $0x44, %%xmm6, %%xmm2 # b01000100\n\t"
+ " shufps $0xee, %%xmm3, %%xmm6 # b11101110\n\t"
+ " addps %%xmm2, %%xmm6\n\t"
+ " # xmm6 = r1 i2 r3 i4\n\t"
+ " movhlps %%xmm6, %%xmm4 # xmm4 = r3 i4 ?? ??\n\t"
+ " addps %%xmm4, %%xmm6 # xmm6 = r1+r3 i2+i4 ?? ??\n\t"
+ " movlps %%xmm6, (%[rdi]) # store low 2x32 bits (complex) to memory\n\t"
+ :
+ :[rsi] "r" (input), [rdx] "r" (taps), "c" (num_bytes), [rdi] "r" (result), [conjugator] "r" (conjugator)
+ :"rax", "r8", "r9", "r10"
+ );
+
+
+ int getem = num_bytes % 16;
+
+
+ for(; getem > 0; getem -= 8) {
+
+
+ *result += (input[(num_bytes >> 3) - 1] * lv_conj(taps[(num_bytes >> 3) - 1]));
+
+ }
+
+ return;
+}
+#endif
+
+#if LV_HAVE_SSE && LV_HAVE_32
+static inline void volk_32fc_x2_conjugate_dot_prod_32fc_a_sse_32(lv_32fc_t* result, const lv_32fc_t* input, const lv_32fc_t* taps, unsigned int num_points) {
+
+ const unsigned int num_bytes = num_points*8;
+
+ __VOLK_ATTR_ALIGNED(16) static const uint32_t conjugator[4]= {0x00000000, 0x80000000, 0x00000000, 0x80000000};
+
+ int bound = num_bytes >> 4;
+ int leftovers = num_bytes % 16;
+
+
+ asm volatile
+ (
+ " #pushl %%ebp\n\t"
+ " #movl %%esp, %%ebp\n\t"
+ " #movl 12(%%ebp), %%eax # input\n\t"
+ " #movl 16(%%ebp), %%edx # taps\n\t"
+ " #movl 20(%%ebp), %%ecx # n_bytes\n\t"
+ " movaps 0(%[conjugator]), %%xmm1\n\t"
+ " xorps %%xmm6, %%xmm6 # zero accumulators\n\t"
+ " movaps 0(%[eax]), %%xmm0\n\t"
+ " xorps %%xmm7, %%xmm7 # zero accumulators\n\t"
+ " movaps 0(%[edx]), %%xmm2\n\t"
+ " movl %[ecx], (%[out])\n\t"
+ " shrl $5, %[ecx] # ecx = n_2_ccomplex_blocks / 2\n\t"
+
+ " xorps %%xmm1, %%xmm2\n\t"
+ " jmp .%=L1_test\n\t"
+ " # 4 taps / loop\n\t"
+ " # something like ?? cycles / loop\n\t"
+ ".%=Loop1: \n\t"
+ "# complex prod: C += A * B, w/ temp Z & Y (or B), xmmPN=$0x8000000080000000\n\t"
+ "# movaps (%[eax]), %%xmmA\n\t"
+ "# movaps (%[edx]), %%xmmB\n\t"
+ "# movaps %%xmmA, %%xmmZ\n\t"
+ "# shufps $0xb1, %%xmmZ, %%xmmZ # swap internals\n\t"
+ "# mulps %%xmmB, %%xmmA\n\t"
+ "# mulps %%xmmZ, %%xmmB\n\t"
+ "# # SSE replacement for: pfpnacc %%xmmB, %%xmmA\n\t"
+ "# xorps %%xmmPN, %%xmmA\n\t"
+ "# movaps %%xmmA, %%xmmZ\n\t"
+ "# unpcklps %%xmmB, %%xmmA\n\t"
+ "# unpckhps %%xmmB, %%xmmZ\n\t"
+ "# movaps %%xmmZ, %%xmmY\n\t"
+ "# shufps $0x44, %%xmmA, %%xmmZ # b01000100\n\t"
+ "# shufps $0xee, %%xmmY, %%xmmA # b11101110\n\t"
+ "# addps %%xmmZ, %%xmmA\n\t"
+ "# addps %%xmmA, %%xmmC\n\t"
+ "# A=xmm0, B=xmm2, Z=xmm4\n\t"
+ "# A'=xmm1, B'=xmm3, Z'=xmm5\n\t"
+ " movaps 16(%[edx]), %%xmm3\n\t"
+ " movaps %%xmm0, %%xmm4\n\t"
+ " xorps %%xmm1, %%xmm3\n\t"
+ " mulps %%xmm2, %%xmm0\n\t"
+ " movaps 16(%[eax]), %%xmm1\n\t"
+ " shufps $0xb1, %%xmm4, %%xmm4 # swap internals\n\t"
+ " movaps %%xmm1, %%xmm5\n\t"
+ " addps %%xmm0, %%xmm6\n\t"
+ " mulps %%xmm3, %%xmm1\n\t"
+ " shufps $0xb1, %%xmm5, %%xmm5 # swap internals\n\t"
+ " addps %%xmm1, %%xmm6\n\t"
+ " movaps 0(%[conjugator]), %%xmm1\n\t"
+ " mulps %%xmm4, %%xmm2\n\t"
+ " movaps 32(%[eax]), %%xmm0\n\t"
+ " addps %%xmm2, %%xmm7\n\t"
+ " mulps %%xmm5, %%xmm3\n\t"
+ " addl $32, %[eax]\n\t"
+ " movaps 32(%[edx]), %%xmm2\n\t"
+ " addps %%xmm3, %%xmm7\n\t"
+ " xorps %%xmm1, %%xmm2\n\t"
+ " addl $32, %[edx]\n\t"
+ ".%=L1_test:\n\t"
+ " decl %[ecx]\n\t"
+ " jge .%=Loop1\n\t"
+ " # We've handled the bulk of multiplies up to here.\n\t"
+ " # Let's sse if original n_2_ccomplex_blocks was odd.\n\t"
+ " # If so, we've got 2 more taps to do.\n\t"
+ " movl 0(%[out]), %[ecx] # n_2_ccomplex_blocks\n\t"
+ " shrl $4, %[ecx]\n\t"
+ " andl $1, %[ecx]\n\t"
+ " je .%=Leven\n\t"
+ " # The count was odd, do 2 more taps.\n\t"
+ " # Note that we've already got mm0/mm2 preloaded\n\t"
+ " # from the main loop.\n\t"
+ " movaps %%xmm0, %%xmm4\n\t"
+ " mulps %%xmm2, %%xmm0\n\t"
+ " shufps $0xb1, %%xmm4, %%xmm4 # swap internals\n\t"
+ " addps %%xmm0, %%xmm6\n\t"
+ " mulps %%xmm4, %%xmm2\n\t"
+ " addps %%xmm2, %%xmm7\n\t"
+ ".%=Leven:\n\t"
+ " # neg inversor\n\t"
+ " #movl 8(%%ebp), %[eax] \n\t"
+ " xorps %%xmm1, %%xmm1\n\t"
+ " movl $0x80000000, (%[out])\n\t"
+ " movss (%[out]), %%xmm1\n\t"
+ " shufps $0x11, %%xmm1, %%xmm1 # b00010001 # 0 -0 0 -0\n\t"
+ " # pfpnacc\n\t"
+ " xorps %%xmm1, %%xmm6\n\t"
+ " movaps %%xmm6, %%xmm2\n\t"
+ " unpcklps %%xmm7, %%xmm6\n\t"
+ " unpckhps %%xmm7, %%xmm2\n\t"
+ " movaps %%xmm2, %%xmm3\n\t"
+ " shufps $0x44, %%xmm6, %%xmm2 # b01000100\n\t"
+ " shufps $0xee, %%xmm3, %%xmm6 # b11101110\n\t"
+ " addps %%xmm2, %%xmm6\n\t"
+ " # xmm6 = r1 i2 r3 i4\n\t"
+ " #movl 8(%%ebp), %[eax] # @result\n\t"
+ " movhlps %%xmm6, %%xmm4 # xmm4 = r3 i4 ?? ??\n\t"
+ " addps %%xmm4, %%xmm6 # xmm6 = r1+r3 i2+i4 ?? ??\n\t"
+ " movlps %%xmm6, (%[out]) # store low 2x32 bits (complex) to memory\n\t"
+ " #popl %%ebp\n\t"
+ :
+ : [eax] "r" (input), [edx] "r" (taps), [ecx] "r" (num_bytes), [out] "r" (result), [conjugator] "r" (conjugator)
+ );
+
+
+
+
+ printf("%d, %d\n", leftovers, bound);
+
+ for(; leftovers > 0; leftovers -= 8) {
+
+
+ *result += (input[(bound << 1)] * lv_conj(taps[(bound << 1)]));
+
+ }
+
+ return;
+
+
+
+
+
+
+}
+
+#endif /*LV_HAVE_SSE*/
+
+
+
+#endif /*INCLUDED_volk_32fc_x2_conjugate_dot_prod_32fc_a_H*/
diff --git a/volk/kernels/volk/volk_32fc_x2_dot_prod_32fc.h b/volk/kernels/volk/volk_32fc_x2_dot_prod_32fc.h
new file mode 100644
index 000000000..066bed443
--- /dev/null
+++ b/volk/kernels/volk/volk_32fc_x2_dot_prod_32fc.h
@@ -0,0 +1,562 @@
+#ifndef INCLUDED_volk_32fc_x2_dot_prod_32fc_u_H
+#define INCLUDED_volk_32fc_x2_dot_prod_32fc_u_H
+
+#include <volk/volk_common.h>
+#include <volk/volk_complex.h>
+#include <stdio.h>
+#include <string.h>
+
+
+#ifdef LV_HAVE_GENERIC
+
+
+static inline void volk_32fc_x2_dot_prod_32fc_generic(lv_32fc_t* result, const lv_32fc_t* input, const lv_32fc_t* taps, unsigned int num_points) {
+
+ float * res = (float*) result;
+ float * in = (float*) input;
+ float * tp = (float*) taps;
+ unsigned int n_2_ccomplex_blocks = num_points/2;
+ unsigned int isodd = num_points &1;
+
+
+
+ float sum0[2] = {0,0};
+ float sum1[2] = {0,0};
+ unsigned int i = 0;
+
+
+ for(i = 0; i < n_2_ccomplex_blocks; ++i) {
+
+
+ sum0[0] += in[0] * tp[0] - in[1] * tp[1];
+ sum0[1] += in[0] * tp[1] + in[1] * tp[0];
+ sum1[0] += in[2] * tp[2] - in[3] * tp[3];
+ sum1[1] += in[2] * tp[3] + in[3] * tp[2];
+
+
+ in += 4;
+ tp += 4;
+
+ }
+
+
+ res[0] = sum0[0] + sum1[0];
+ res[1] = sum0[1] + sum1[1];
+
+
+
+ for(i = 0; i < isodd; ++i) {
+
+
+ *result += input[num_points - 1] * taps[num_points - 1];
+
+ }
+
+}
+
+#endif /*LV_HAVE_GENERIC*/
+
+#ifdef LV_HAVE_SSE3
+
+#include <pmmintrin.h>
+
+static inline void volk_32fc_x2_dot_prod_32fc_u_sse3(lv_32fc_t* result, const lv_32fc_t* input, const lv_32fc_t* taps, unsigned int num_points) {
+
+
+ lv_32fc_t dotProduct;
+ memset(&dotProduct, 0x0, 2*sizeof(float));
+
+ unsigned int number = 0;
+ const unsigned int halfPoints = num_points/2;
+
+ __m128 x, y, yl, yh, z, tmp1, tmp2, dotProdVal;
+
+ const lv_32fc_t* a = input;
+ const lv_32fc_t* b = taps;
+
+ dotProdVal = _mm_setzero_ps();
+
+ for(;number < halfPoints; number++){
+
+ x = _mm_loadu_ps((float*)a); // Load the ar + ai, br + bi as ar,ai,br,bi
+ y = _mm_loadu_ps((float*)b); // Load the cr + ci, dr + di as cr,ci,dr,di
+
+ yl = _mm_moveldup_ps(y); // Load yl with cr,cr,dr,dr
+ yh = _mm_movehdup_ps(y); // Load yh with ci,ci,di,di
+
+ tmp1 = _mm_mul_ps(x,yl); // tmp1 = ar*cr,ai*cr,br*dr,bi*dr
+
+ x = _mm_shuffle_ps(x,x,0xB1); // Re-arrange x to be ai,ar,bi,br
+
+ tmp2 = _mm_mul_ps(x,yh); // tmp2 = ai*ci,ar*ci,bi*di,br*di
+
+ z = _mm_addsub_ps(tmp1,tmp2); // ar*cr-ai*ci, ai*cr+ar*ci, br*dr-bi*di, bi*dr+br*di
+
+ dotProdVal = _mm_add_ps(dotProdVal, z); // Add the complex multiplication results together
+
+ a += 2;
+ b += 2;
+ }
+
+ __VOLK_ATTR_ALIGNED(16) lv_32fc_t dotProductVector[2];
+
+ _mm_storeu_ps((float*)dotProductVector,dotProdVal); // Store the results back into the dot product vector
+
+ dotProduct += ( dotProductVector[0] + dotProductVector[1] );
+
+ if(num_points % 1 != 0) {
+ dotProduct += (*a) * (*b);
+ }
+
+ *result = dotProduct;
+}
+
+#endif /*LV_HAVE_SSE3*/
+
+#endif /*INCLUDED_volk_32fc_x2_dot_prod_32fc_u_H*/
+#ifndef INCLUDED_volk_32fc_x2_dot_prod_32fc_a_H
+#define INCLUDED_volk_32fc_x2_dot_prod_32fc_a_H
+
+#include <volk/volk_common.h>
+#include <volk/volk_complex.h>
+#include <stdio.h>
+#include <string.h>
+
+
+#ifdef LV_HAVE_GENERIC
+
+
+static inline void volk_32fc_x2_dot_prod_32fc_a_generic(lv_32fc_t* result, const lv_32fc_t* input, const lv_32fc_t* taps, unsigned int num_points) {
+
+ const unsigned int num_bytes = num_points*8;
+
+ float * res = (float*) result;
+ float * in = (float*) input;
+ float * tp = (float*) taps;
+ unsigned int n_2_ccomplex_blocks = num_bytes >> 4;
+ unsigned int isodd = (num_bytes >> 3) &1;
+
+ float sum0[2] = {0,0};
+ float sum1[2] = {0,0};
+ unsigned int i = 0;
+
+ for(i = 0; i < n_2_ccomplex_blocks; ++i) {
+ sum0[0] += in[0] * tp[0] - in[1] * tp[1];
+ sum0[1] += in[0] * tp[1] + in[1] * tp[0];
+ sum1[0] += in[2] * tp[2] - in[3] * tp[3];
+ sum1[1] += in[2] * tp[3] + in[3] * tp[2];
+
+ in += 4;
+ tp += 4;
+ }
+
+ res[0] = sum0[0] + sum1[0];
+ res[1] = sum0[1] + sum1[1];
+
+ for(i = 0; i < isodd; ++i) {
+ *result += input[(num_bytes >> 3) - 1] * taps[(num_bytes >> 3) - 1];
+ }
+}
+
+#endif /*LV_HAVE_GENERIC*/
+
+
+#if LV_HAVE_SSE && LV_HAVE_64
+
+
+static inline void volk_32fc_x2_dot_prod_32fc_a_sse_64(lv_32fc_t* result, const lv_32fc_t* input, const lv_32fc_t* taps, unsigned int num_points) {
+
+ const unsigned int num_bytes = num_points*8;
+
+ asm
+ (
+ "# ccomplex_dotprod_generic (float* result, const float *input,\n\t"
+ "# const float *taps, unsigned num_bytes)\n\t"
+ "# float sum0 = 0;\n\t"
+ "# float sum1 = 0;\n\t"
+ "# float sum2 = 0;\n\t"
+ "# float sum3 = 0;\n\t"
+ "# do {\n\t"
+ "# sum0 += input[0] * taps[0] - input[1] * taps[1];\n\t"
+ "# sum1 += input[0] * taps[1] + input[1] * taps[0];\n\t"
+ "# sum2 += input[2] * taps[2] - input[3] * taps[3];\n\t"
+ "# sum3 += input[2] * taps[3] + input[3] * taps[2];\n\t"
+ "# input += 4;\n\t"
+ "# taps += 4; \n\t"
+ "# } while (--n_2_ccomplex_blocks != 0);\n\t"
+ "# result[0] = sum0 + sum2;\n\t"
+ "# result[1] = sum1 + sum3;\n\t"
+ "# TODO: prefetch and better scheduling\n\t"
+ " xor %%r9, %%r9\n\t"
+ " xor %%r10, %%r10\n\t"
+ " movq %%rcx, %%rax\n\t"
+ " movq %%rcx, %%r8\n\t"
+ " movq %[rsi], %%r9\n\t"
+ " movq %[rdx], %%r10\n\t"
+ " xorps %%xmm6, %%xmm6 # zero accumulators\n\t"
+ " movaps 0(%%r9), %%xmm0\n\t"
+ " xorps %%xmm7, %%xmm7 # zero accumulators\n\t"
+ " movaps 0(%%r10), %%xmm2\n\t"
+ " shr $5, %%rax # rax = n_2_ccomplex_blocks / 2\n\t"
+ " shr $4, %%r8\n\t"
+ " jmp .%=L1_test\n\t"
+ " # 4 taps / loop\n\t"
+ " # something like ?? cycles / loop\n\t"
+ ".%=Loop1: \n\t"
+ "# complex prod: C += A * B, w/ temp Z & Y (or B), xmmPN=$0x8000000080000000\n\t"
+ "# movaps (%%r9), %%xmmA\n\t"
+ "# movaps (%%r10), %%xmmB\n\t"
+ "# movaps %%xmmA, %%xmmZ\n\t"
+ "# shufps $0xb1, %%xmmZ, %%xmmZ # swap internals\n\t"
+ "# mulps %%xmmB, %%xmmA\n\t"
+ "# mulps %%xmmZ, %%xmmB\n\t"
+ "# # SSE replacement for: pfpnacc %%xmmB, %%xmmA\n\t"
+ "# xorps %%xmmPN, %%xmmA\n\t"
+ "# movaps %%xmmA, %%xmmZ\n\t"
+ "# unpcklps %%xmmB, %%xmmA\n\t"
+ "# unpckhps %%xmmB, %%xmmZ\n\t"
+ "# movaps %%xmmZ, %%xmmY\n\t"
+ "# shufps $0x44, %%xmmA, %%xmmZ # b01000100\n\t"
+ "# shufps $0xee, %%xmmY, %%xmmA # b11101110\n\t"
+ "# addps %%xmmZ, %%xmmA\n\t"
+ "# addps %%xmmA, %%xmmC\n\t"
+ "# A=xmm0, B=xmm2, Z=xmm4\n\t"
+ "# A'=xmm1, B'=xmm3, Z'=xmm5\n\t"
+ " movaps 16(%%r9), %%xmm1\n\t"
+ " movaps %%xmm0, %%xmm4\n\t"
+ " mulps %%xmm2, %%xmm0\n\t"
+ " shufps $0xb1, %%xmm4, %%xmm4 # swap internals\n\t"
+ " movaps 16(%%r10), %%xmm3\n\t"
+ " movaps %%xmm1, %%xmm5\n\t"
+ " addps %%xmm0, %%xmm6\n\t"
+ " mulps %%xmm3, %%xmm1\n\t"
+ " shufps $0xb1, %%xmm5, %%xmm5 # swap internals\n\t"
+ " addps %%xmm1, %%xmm6\n\t"
+ " mulps %%xmm4, %%xmm2\n\t"
+ " movaps 32(%%r9), %%xmm0\n\t"
+ " addps %%xmm2, %%xmm7\n\t"
+ " mulps %%xmm5, %%xmm3\n\t"
+ " add $32, %%r9\n\t"
+ " movaps 32(%%r10), %%xmm2\n\t"
+ " addps %%xmm3, %%xmm7\n\t"
+ " add $32, %%r10\n\t"
+ ".%=L1_test:\n\t"
+ " dec %%rax\n\t"
+ " jge .%=Loop1\n\t"
+ " # We've handled the bulk of multiplies up to here.\n\t"
+ " # Let's sse if original n_2_ccomplex_blocks was odd.\n\t"
+ " # If so, we've got 2 more taps to do.\n\t"
+ " and $1, %%r8\n\t"
+ " je .%=Leven\n\t"
+ " # The count was odd, do 2 more taps.\n\t"
+ " # Note that we've already got mm0/mm2 preloaded\n\t"
+ " # from the main loop.\n\t"
+ " movaps %%xmm0, %%xmm4\n\t"
+ " mulps %%xmm2, %%xmm0\n\t"
+ " shufps $0xb1, %%xmm4, %%xmm4 # swap internals\n\t"
+ " addps %%xmm0, %%xmm6\n\t"
+ " mulps %%xmm4, %%xmm2\n\t"
+ " addps %%xmm2, %%xmm7\n\t"
+ ".%=Leven:\n\t"
+ " # neg inversor\n\t"
+ " xorps %%xmm1, %%xmm1\n\t"
+ " mov $0x80000000, %%r9\n\t"
+ " movd %%r9, %%xmm1\n\t"
+ " shufps $0x11, %%xmm1, %%xmm1 # b00010001 # 0 -0 0 -0\n\t"
+ " # pfpnacc\n\t"
+ " xorps %%xmm1, %%xmm6\n\t"
+ " movaps %%xmm6, %%xmm2\n\t"
+ " unpcklps %%xmm7, %%xmm6\n\t"
+ " unpckhps %%xmm7, %%xmm2\n\t"
+ " movaps %%xmm2, %%xmm3\n\t"
+ " shufps $0x44, %%xmm6, %%xmm2 # b01000100\n\t"
+ " shufps $0xee, %%xmm3, %%xmm6 # b11101110\n\t"
+ " addps %%xmm2, %%xmm6\n\t"
+ " # xmm6 = r1 i2 r3 i4\n\t"
+ " movhlps %%xmm6, %%xmm4 # xmm4 = r3 i4 ?? ??\n\t"
+ " addps %%xmm4, %%xmm6 # xmm6 = r1+r3 i2+i4 ?? ??\n\t"
+ " movlps %%xmm6, (%[rdi]) # store low 2x32 bits (complex) to memory\n\t"
+ :
+ :[rsi] "r" (input), [rdx] "r" (taps), "c" (num_bytes), [rdi] "r" (result)
+ :"rax", "r8", "r9", "r10"
+ );
+
+
+ if(((num_bytes >> 3) & 1)) {
+ *result += (input[(num_bytes >> 3) - 1] * taps[(num_bytes >> 3) - 1]);
+ }
+
+ return;
+
+}
+
+#endif
+
+#if LV_HAVE_SSE && LV_HAVE_32
+
+static inline void volk_32fc_x2_dot_prod_32fc_a_sse_32(lv_32fc_t* result, const lv_32fc_t* input, const lv_32fc_t* taps, unsigned int num_points) {
+ volk_32fc_x2_dot_prod_32fc_a_generic(result, input, taps, num_points);
+
+#if 0
+ const unsigned int num_bytes = num_points*8;
+ asm volatile
+ (
+ " #pushl %%ebp\n\t"
+ " #movl %%esp, %%ebp\n\t"
+ " movl 12(%%ebp), %%eax # input\n\t"
+ " movl 16(%%ebp), %%edx # taps\n\t"
+ " movl 20(%%ebp), %%ecx # n_bytes\n\t"
+ " xorps %%xmm6, %%xmm6 # zero accumulators\n\t"
+ " movaps 0(%%eax), %%xmm0\n\t"
+ " xorps %%xmm7, %%xmm7 # zero accumulators\n\t"
+ " movaps 0(%%edx), %%xmm2\n\t"
+ " shrl $5, %%ecx # ecx = n_2_ccomplex_blocks / 2\n\t"
+ " jmp .%=L1_test\n\t"
+ " # 4 taps / loop\n\t"
+ " # something like ?? cycles / loop\n\t"
+ ".%=Loop1: \n\t"
+ "# complex prod: C += A * B, w/ temp Z & Y (or B), xmmPN=$0x8000000080000000\n\t"
+ "# movaps (%%eax), %%xmmA\n\t"
+ "# movaps (%%edx), %%xmmB\n\t"
+ "# movaps %%xmmA, %%xmmZ\n\t"
+ "# shufps $0xb1, %%xmmZ, %%xmmZ # swap internals\n\t"
+ "# mulps %%xmmB, %%xmmA\n\t"
+ "# mulps %%xmmZ, %%xmmB\n\t"
+ "# # SSE replacement for: pfpnacc %%xmmB, %%xmmA\n\t"
+ "# xorps %%xmmPN, %%xmmA\n\t"
+ "# movaps %%xmmA, %%xmmZ\n\t"
+ "# unpcklps %%xmmB, %%xmmA\n\t"
+ "# unpckhps %%xmmB, %%xmmZ\n\t"
+ "# movaps %%xmmZ, %%xmmY\n\t"
+ "# shufps $0x44, %%xmmA, %%xmmZ # b01000100\n\t"
+ "# shufps $0xee, %%xmmY, %%xmmA # b11101110\n\t"
+ "# addps %%xmmZ, %%xmmA\n\t"
+ "# addps %%xmmA, %%xmmC\n\t"
+ "# A=xmm0, B=xmm2, Z=xmm4\n\t"
+ "# A'=xmm1, B'=xmm3, Z'=xmm5\n\t"
+ " movaps 16(%%eax), %%xmm1\n\t"
+ " movaps %%xmm0, %%xmm4\n\t"
+ " mulps %%xmm2, %%xmm0\n\t"
+ " shufps $0xb1, %%xmm4, %%xmm4 # swap internals\n\t"
+ " movaps 16(%%edx), %%xmm3\n\t"
+ " movaps %%xmm1, %%xmm5\n\t"
+ " addps %%xmm0, %%xmm6\n\t"
+ " mulps %%xmm3, %%xmm1\n\t"
+ " shufps $0xb1, %%xmm5, %%xmm5 # swap internals\n\t"
+ " addps %%xmm1, %%xmm6\n\t"
+ " mulps %%xmm4, %%xmm2\n\t"
+ " movaps 32(%%eax), %%xmm0\n\t"
+ " addps %%xmm2, %%xmm7\n\t"
+ " mulps %%xmm5, %%xmm3\n\t"
+ " addl $32, %%eax\n\t"
+ " movaps 32(%%edx), %%xmm2\n\t"
+ " addps %%xmm3, %%xmm7\n\t"
+ " addl $32, %%edx\n\t"
+ ".%=L1_test:\n\t"
+ " decl %%ecx\n\t"
+ " jge .%=Loop1\n\t"
+ " # We've handled the bulk of multiplies up to here.\n\t"
+ " # Let's sse if original n_2_ccomplex_blocks was odd.\n\t"
+ " # If so, we've got 2 more taps to do.\n\t"
+ " movl 20(%%ebp), %%ecx # n_2_ccomplex_blocks\n\t"
+ " shrl $4, %%ecx\n\t"
+ " andl $1, %%ecx\n\t"
+ " je .%=Leven\n\t"
+ " # The count was odd, do 2 more taps.\n\t"
+ " # Note that we've already got mm0/mm2 preloaded\n\t"
+ " # from the main loop.\n\t"
+ " movaps %%xmm0, %%xmm4\n\t"
+ " mulps %%xmm2, %%xmm0\n\t"
+ " shufps $0xb1, %%xmm4, %%xmm4 # swap internals\n\t"
+ " addps %%xmm0, %%xmm6\n\t"
+ " mulps %%xmm4, %%xmm2\n\t"
+ " addps %%xmm2, %%xmm7\n\t"
+ ".%=Leven:\n\t"
+ " # neg inversor\n\t"
+ " movl 8(%%ebp), %%eax \n\t"
+ " xorps %%xmm1, %%xmm1\n\t"
+ " movl $0x80000000, (%%eax)\n\t"
+ " movss (%%eax), %%xmm1\n\t"
+ " shufps $0x11, %%xmm1, %%xmm1 # b00010001 # 0 -0 0 -0\n\t"
+ " # pfpnacc\n\t"
+ " xorps %%xmm1, %%xmm6\n\t"
+ " movaps %%xmm6, %%xmm2\n\t"
+ " unpcklps %%xmm7, %%xmm6\n\t"
+ " unpckhps %%xmm7, %%xmm2\n\t"
+ " movaps %%xmm2, %%xmm3\n\t"
+ " shufps $0x44, %%xmm6, %%xmm2 # b01000100\n\t"
+ " shufps $0xee, %%xmm3, %%xmm6 # b11101110\n\t"
+ " addps %%xmm2, %%xmm6\n\t"
+ " # xmm6 = r1 i2 r3 i4\n\t"
+ " #movl 8(%%ebp), %%eax # @result\n\t"
+ " movhlps %%xmm6, %%xmm4 # xmm4 = r3 i4 ?? ??\n\t"
+ " addps %%xmm4, %%xmm6 # xmm6 = r1+r3 i2+i4 ?? ??\n\t"
+ " movlps %%xmm6, (%%eax) # store low 2x32 bits (complex) to memory\n\t"
+ " #popl %%ebp\n\t"
+ :
+ :
+ : "eax", "ecx", "edx"
+ );
+
+
+ int getem = num_bytes % 16;
+
+ for(; getem > 0; getem -= 8) {
+
+
+ *result += (input[(num_bytes >> 3) - 1] * taps[(num_bytes >> 3) - 1]);
+
+ }
+
+ return;
+#endif
+}
+
+#endif /*LV_HAVE_SSE*/
+
+#ifdef LV_HAVE_SSE3
+
+#include <pmmintrin.h>
+
+static inline void volk_32fc_x2_dot_prod_32fc_a_sse3(lv_32fc_t* result, const lv_32fc_t* input, const lv_32fc_t* taps, unsigned int num_points) {
+
+ const unsigned int num_bytes = num_points*8;
+
+ lv_32fc_t dotProduct;
+ memset(&dotProduct, 0x0, 2*sizeof(float));
+
+ unsigned int number = 0;
+ const unsigned int halfPoints = num_bytes >> 4;
+
+ __m128 x, y, yl, yh, z, tmp1, tmp2, dotProdVal;
+
+ const lv_32fc_t* a = input;
+ const lv_32fc_t* b = taps;
+
+ dotProdVal = _mm_setzero_ps();
+
+ for(;number < halfPoints; number++){
+
+ x = _mm_load_ps((float*)a); // Load the ar + ai, br + bi as ar,ai,br,bi
+ y = _mm_load_ps((float*)b); // Load the cr + ci, dr + di as cr,ci,dr,di
+
+ yl = _mm_moveldup_ps(y); // Load yl with cr,cr,dr,dr
+ yh = _mm_movehdup_ps(y); // Load yh with ci,ci,di,di
+
+ tmp1 = _mm_mul_ps(x,yl); // tmp1 = ar*cr,ai*cr,br*dr,bi*dr
+
+ x = _mm_shuffle_ps(x,x,0xB1); // Re-arrange x to be ai,ar,bi,br
+
+ tmp2 = _mm_mul_ps(x,yh); // tmp2 = ai*ci,ar*ci,bi*di,br*di
+
+ z = _mm_addsub_ps(tmp1,tmp2); // ar*cr-ai*ci, ai*cr+ar*ci, br*dr-bi*di, bi*dr+br*di
+
+ dotProdVal = _mm_add_ps(dotProdVal, z); // Add the complex multiplication results together
+
+ a += 2;
+ b += 2;
+ }
+
+ __VOLK_ATTR_ALIGNED(16) lv_32fc_t dotProductVector[2];
+
+ _mm_store_ps((float*)dotProductVector,dotProdVal); // Store the results back into the dot product vector
+
+ dotProduct += ( dotProductVector[0] + dotProductVector[1] );
+
+ if(((num_bytes >> 3) & 1) != 0) {
+ dotProduct += (*a) * (*b);
+ }
+
+ *result = dotProduct;
+}
+
+#endif /*LV_HAVE_SSE3*/
+
+#ifdef LV_HAVE_SSE4_1
+
+#include <smmintrin.h>
+
+static inline void volk_32fc_x2_dot_prod_32fc_a_sse4_1(lv_32fc_t* result, const lv_32fc_t* input, const lv_32fc_t* taps, unsigned int num_points) {
+
+ const unsigned int num_bytes = num_points*8;
+
+ __m128 xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, real0, real1, im0, im1;
+ float *p_input, *p_taps;
+ __m64 *p_result;
+
+ p_result = (__m64*)result;
+ p_input = (float*)input;
+ p_taps = (float*)taps;
+
+ static const __m128i neg = {0x000000000000000080000000};
+
+ int i = 0;
+
+ int bound = (num_bytes >> 5);
+ int leftovers = (num_bytes & 24) >> 3;
+
+ real0 = _mm_sub_ps(real0, real0);
+ real1 = _mm_sub_ps(real1, real1);
+ im0 = _mm_sub_ps(im0, im0);
+ im1 = _mm_sub_ps(im1, im1);
+
+ for(; i < bound; ++i) {
+
+
+ xmm0 = _mm_load_ps(p_input);
+ xmm1 = _mm_load_ps(p_taps);
+
+ p_input += 4;
+ p_taps += 4;
+
+ xmm2 = _mm_load_ps(p_input);
+ xmm3 = _mm_load_ps(p_taps);
+
+ p_input += 4;
+ p_taps += 4;
+
+ xmm4 = _mm_unpackhi_ps(xmm0, xmm2);
+ xmm5 = _mm_unpackhi_ps(xmm1, xmm3);
+ xmm0 = _mm_unpacklo_ps(xmm0, xmm2);
+ xmm2 = _mm_unpacklo_ps(xmm1, xmm3);
+
+ //imaginary vector from input
+ xmm1 = _mm_unpackhi_ps(xmm0, xmm4);
+ //real vector from input
+ xmm3 = _mm_unpacklo_ps(xmm0, xmm4);
+ //imaginary vector from taps
+ xmm0 = _mm_unpackhi_ps(xmm2, xmm5);
+ //real vector from taps
+ xmm2 = _mm_unpacklo_ps(xmm2, xmm5);
+
+ xmm4 = _mm_dp_ps(xmm3, xmm2, 0xf1);
+ xmm5 = _mm_dp_ps(xmm1, xmm0, 0xf1);
+
+ xmm6 = _mm_dp_ps(xmm3, xmm0, 0xf2);
+ xmm7 = _mm_dp_ps(xmm1, xmm2, 0xf2);
+
+ real0 = _mm_add_ps(xmm4, real0);
+ real1 = _mm_add_ps(xmm5, real1);
+ im0 = _mm_add_ps(xmm6, im0);
+ im1 = _mm_add_ps(xmm7, im1);
+
+ }
+
+ real1 = _mm_xor_ps(real1, bit128_p(&neg)->float_vec);
+
+ im0 = _mm_add_ps(im0, im1);
+ real0 = _mm_add_ps(real0, real1);
+
+ im0 = _mm_add_ps(im0, real0);
+
+ _mm_storel_pi(p_result, im0);
+
+ for(i = bound * 4; i < (bound * 4) + leftovers; ++i) {
+
+ *result += input[i] * taps[i];
+ }
+}
+
+#endif /*LV_HAVE_SSE4_1*/
+
+#endif /*INCLUDED_volk_32fc_x2_dot_prod_32fc_a_H*/
diff --git a/volk/kernels/volk/volk_32fc_x2_multiply_32fc.h b/volk/kernels/volk/volk_32fc_x2_multiply_32fc.h
new file mode 100644
index 000000000..7db68c1bd
--- /dev/null
+++ b/volk/kernels/volk/volk_32fc_x2_multiply_32fc.h
@@ -0,0 +1,170 @@
+#ifndef INCLUDED_volk_32fc_x2_multiply_32fc_u_H
+#define INCLUDED_volk_32fc_x2_multiply_32fc_u_H
+
+#include <inttypes.h>
+#include <stdio.h>
+#include <volk/volk_complex.h>
+#include <float.h>
+
+#ifdef LV_HAVE_SSE3
+#include <pmmintrin.h>
+ /*!
+ \brief Multiplies the two input complex vectors and stores their results in the third vector
+ \param cVector The vector where the results will be stored
+ \param aVector One of the vectors to be multiplied
+ \param bVector One of the vectors to be multiplied
+ \param num_points The number of complex values in aVector and bVector to be multiplied together and stored into cVector
+ */
+static inline void volk_32fc_x2_multiply_32fc_u_sse3(lv_32fc_t* cVector, const lv_32fc_t* aVector, const lv_32fc_t* bVector, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int halfPoints = num_points / 2;
+
+ __m128 x, y, yl, yh, z, tmp1, tmp2;
+ lv_32fc_t* c = cVector;
+ const lv_32fc_t* a = aVector;
+ const lv_32fc_t* b = bVector;
+
+ for(;number < halfPoints; number++){
+
+ x = _mm_loadu_ps((float*)a); // Load the ar + ai, br + bi as ar,ai,br,bi
+ y = _mm_loadu_ps((float*)b); // Load the cr + ci, dr + di as cr,ci,dr,di
+
+ yl = _mm_moveldup_ps(y); // Load yl with cr,cr,dr,dr
+ yh = _mm_movehdup_ps(y); // Load yh with ci,ci,di,di
+
+ tmp1 = _mm_mul_ps(x,yl); // tmp1 = ar*cr,ai*cr,br*dr,bi*dr
+
+ x = _mm_shuffle_ps(x,x,0xB1); // Re-arrange x to be ai,ar,bi,br
+
+ tmp2 = _mm_mul_ps(x,yh); // tmp2 = ai*ci,ar*ci,bi*di,br*di
+
+ z = _mm_addsub_ps(tmp1,tmp2); // ar*cr-ai*ci, ai*cr+ar*ci, br*dr-bi*di, bi*dr+br*di
+
+ _mm_storeu_ps((float*)c,z); // Store the results back into the C container
+
+ a += 2;
+ b += 2;
+ c += 2;
+ }
+
+ if((num_points % 2) != 0) {
+ *c = (*a) * (*b);
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+ /*!
+ \brief Multiplies the two input complex vectors and stores their results in the third vector
+ \param cVector The vector where the results will be stored
+ \param aVector One of the vectors to be multiplied
+ \param bVector One of the vectors to be multiplied
+ \param num_points The number of complex values in aVector and bVector to be multiplied together and stored into cVector
+ */
+static inline void volk_32fc_x2_multiply_32fc_generic(lv_32fc_t* cVector, const lv_32fc_t* aVector, const lv_32fc_t* bVector, unsigned int num_points){
+ lv_32fc_t* cPtr = cVector;
+ const lv_32fc_t* aPtr = aVector;
+ const lv_32fc_t* bPtr= bVector;
+ unsigned int number = 0;
+
+ for(number = 0; number < num_points; number++){
+ *cPtr++ = (*aPtr++) * (*bPtr++);
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+#endif /* INCLUDED_volk_32fc_x2_multiply_32fc_u_H */
+#ifndef INCLUDED_volk_32fc_x2_multiply_32fc_a_H
+#define INCLUDED_volk_32fc_x2_multiply_32fc_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+#include <volk/volk_complex.h>
+#include <float.h>
+
+#ifdef LV_HAVE_SSE3
+#include <pmmintrin.h>
+ /*!
+ \brief Multiplies the two input complex vectors and stores their results in the third vector
+ \param cVector The vector where the results will be stored
+ \param aVector One of the vectors to be multiplied
+ \param bVector One of the vectors to be multiplied
+ \param num_points The number of complex values in aVector and bVector to be multiplied together and stored into cVector
+ */
+static inline void volk_32fc_x2_multiply_32fc_a_sse3(lv_32fc_t* cVector, const lv_32fc_t* aVector, const lv_32fc_t* bVector, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int halfPoints = num_points / 2;
+
+ __m128 x, y, yl, yh, z, tmp1, tmp2;
+ lv_32fc_t* c = cVector;
+ const lv_32fc_t* a = aVector;
+ const lv_32fc_t* b = bVector;
+ for(;number < halfPoints; number++){
+
+ x = _mm_load_ps((float*)a); // Load the ar + ai, br + bi as ar,ai,br,bi
+ y = _mm_load_ps((float*)b); // Load the cr + ci, dr + di as cr,ci,dr,di
+
+ yl = _mm_moveldup_ps(y); // Load yl with cr,cr,dr,dr
+ yh = _mm_movehdup_ps(y); // Load yh with ci,ci,di,di
+
+ tmp1 = _mm_mul_ps(x,yl); // tmp1 = ar*cr,ai*cr,br*dr,bi*dr
+
+ x = _mm_shuffle_ps(x,x,0xB1); // Re-arrange x to be ai,ar,bi,br
+
+ tmp2 = _mm_mul_ps(x,yh); // tmp2 = ai*ci,ar*ci,bi*di,br*di
+
+ z = _mm_addsub_ps(tmp1,tmp2); // ar*cr-ai*ci, ai*cr+ar*ci, br*dr-bi*di, bi*dr+br*di
+
+ _mm_store_ps((float*)c,z); // Store the results back into the C container
+
+ a += 2;
+ b += 2;
+ c += 2;
+ }
+
+ if((num_points % 2) != 0) {
+ *c = (*a) * (*b);
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+ /*!
+ \brief Multiplies the two input complex vectors and stores their results in the third vector
+ \param cVector The vector where the results will be stored
+ \param aVector One of the vectors to be multiplied
+ \param bVector One of the vectors to be multiplied
+ \param num_points The number of complex values in aVector and bVector to be multiplied together and stored into cVector
+ */
+static inline void volk_32fc_x2_multiply_32fc_a_generic(lv_32fc_t* cVector, const lv_32fc_t* aVector, const lv_32fc_t* bVector, unsigned int num_points){
+ lv_32fc_t* cPtr = cVector;
+ const lv_32fc_t* aPtr = aVector;
+ const lv_32fc_t* bPtr= bVector;
+ unsigned int number = 0;
+
+ for(number = 0; number < num_points; number++){
+ *cPtr++ = (*aPtr++) * (*bPtr++);
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+#ifdef LV_HAVE_ORC
+ /*!
+ \brief Multiplies the two input complex vectors and stores their results in the third vector
+ \param cVector The vector where the results will be stored
+ \param aVector One of the vectors to be multiplied
+ \param bVector One of the vectors to be multiplied
+ \param num_points The number of complex values in aVector and bVector to be multiplied together and stored into cVector
+ */
+extern void volk_32fc_x2_multiply_32fc_a_orc_impl(lv_32fc_t* cVector, const lv_32fc_t* aVector, const lv_32fc_t* bVector, unsigned int num_points);
+static inline void volk_32fc_x2_multiply_32fc_u_orc(lv_32fc_t* cVector, const lv_32fc_t* aVector, const lv_32fc_t* bVector, unsigned int num_points){
+ volk_32fc_x2_multiply_32fc_a_orc_impl(cVector, aVector, bVector, num_points);
+}
+#endif /* LV_HAVE_ORC */
+
+
+
+
+
+#endif /* INCLUDED_volk_32fc_x2_multiply_32fc_a_H */
diff --git a/volk/kernels/volk/volk_32fc_x2_multiply_conjugate_32fc.h b/volk/kernels/volk/volk_32fc_x2_multiply_conjugate_32fc.h
new file mode 100644
index 000000000..cfd6c007f
--- /dev/null
+++ b/volk/kernels/volk/volk_32fc_x2_multiply_conjugate_32fc.h
@@ -0,0 +1,162 @@
+#ifndef INCLUDED_volk_32fc_x2_multiply_conjugate_32fc_u_H
+#define INCLUDED_volk_32fc_x2_multiply_conjugate_32fc_u_H
+
+#include <inttypes.h>
+#include <stdio.h>
+#include <volk/volk_complex.h>
+#include <float.h>
+
+#ifdef LV_HAVE_SSE3
+#include <pmmintrin.h>
+ /*!
+ \brief Multiplies vector a by the conjugate of vector b and stores the results in the third vector
+ \param cVector The vector where the results will be stored
+ \param aVector First vector to be multiplied
+ \param bVector Second vector that is conjugated before being multiplied
+ \param num_points The number of complex values in aVector and bVector to be multiplied together and stored into cVector
+ */
+static inline void volk_32fc_x2_multiply_conjugate_32fc_u_sse3(lv_32fc_t* cVector, const lv_32fc_t* aVector, const lv_32fc_t* bVector, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int halfPoints = num_points / 2;
+
+ __m128 x, y, yl, yh, z, tmp1, tmp2;
+ lv_32fc_t* c = cVector;
+ const lv_32fc_t* a = aVector;
+ const lv_32fc_t* b = bVector;
+
+ __m128 conjugator = _mm_setr_ps(0, -0.f, 0, -0.f);
+
+ for(;number < halfPoints; number++){
+
+ x = _mm_loadu_ps((float*)a); // Load the ar + ai, br + bi as ar,ai,br,bi
+ y = _mm_loadu_ps((float*)b); // Load the cr + ci, dr + di as cr,ci,dr,di
+
+ y = _mm_xor_ps(y, conjugator); // conjugate y
+
+ yl = _mm_moveldup_ps(y); // Load yl with cr,cr,dr,dr
+ yh = _mm_movehdup_ps(y); // Load yh with ci,ci,di,di
+
+ tmp1 = _mm_mul_ps(x,yl); // tmp1 = ar*cr,ai*cr,br*dr,bi*dr
+
+ x = _mm_shuffle_ps(x,x,0xB1); // Re-arrange x to be ai,ar,bi,br
+
+ tmp2 = _mm_mul_ps(x,yh); // tmp2 = ai*ci,ar*ci,bi*di,br*di
+
+ z = _mm_addsub_ps(tmp1,tmp2); // ar*cr-ai*ci, ai*cr+ar*ci, br*dr-bi*di, bi*dr+br*di
+
+ _mm_storeu_ps((float*)c,z); // Store the results back into the C container
+
+ a += 2;
+ b += 2;
+ c += 2;
+ }
+
+ if((num_points % 2) != 0) {
+ *c = (*a) * lv_conj(*b);
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+ /*!
+ \brief Multiplies vector a by the conjugate of vector b and stores the results in the third vector
+ \param cVector The vector where the results will be stored
+ \param aVector First vector to be multiplied
+ \param bVector Second vector that is conjugated before being multiplied
+ \param num_points The number of complex values in aVector and bVector to be multiplied together and stored into cVector
+ */
+static inline void volk_32fc_x2_multiply_conjugate_32fc_generic(lv_32fc_t* cVector, const lv_32fc_t* aVector, const lv_32fc_t* bVector, unsigned int num_points){
+ lv_32fc_t* cPtr = cVector;
+ const lv_32fc_t* aPtr = aVector;
+ const lv_32fc_t* bPtr= bVector;
+ unsigned int number = 0;
+
+ for(number = 0; number < num_points; number++){
+ *cPtr++ = (*aPtr++) * lv_conj(*bPtr++);
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+#endif /* INCLUDED_volk_32fc_x2_multiply_conjugate_32fc_u_H */
+#ifndef INCLUDED_volk_32fc_x2_multiply_conjugate_32fc_a_H
+#define INCLUDED_volk_32fc_x2_multiply_conjugate_32fc_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+#include <volk/volk_complex.h>
+#include <float.h>
+
+#ifdef LV_HAVE_SSE3
+#include <pmmintrin.h>
+ /*!
+ \brief Multiplies vector a by the conjugate of vector b and stores the results in the third vector
+ \param cVector The vector where the results will be stored
+ \param aVector First vector to be multiplied
+ \param bVector Second vector that is conjugated before being multiplied
+ \param num_points The number of complex values in aVector and bVector to be multiplied together and stored into cVector
+ */
+static inline void volk_32fc_x2_multiply_conjugate_32fc_a_sse3(lv_32fc_t* cVector, const lv_32fc_t* aVector, const lv_32fc_t* bVector, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int halfPoints = num_points / 2;
+
+ __m128 x, y, yl, yh, z, tmp1, tmp2;
+ lv_32fc_t* c = cVector;
+ const lv_32fc_t* a = aVector;
+ const lv_32fc_t* b = bVector;
+
+ __m128 conjugator = _mm_setr_ps(0, -0.f, 0, -0.f);
+
+ for(;number < halfPoints; number++){
+
+ x = _mm_load_ps((float*)a); // Load the ar + ai, br + bi as ar,ai,br,bi
+ y = _mm_load_ps((float*)b); // Load the cr + ci, dr + di as cr,ci,dr,di
+
+ y = _mm_xor_ps(y, conjugator); // conjugate y
+
+ yl = _mm_moveldup_ps(y); // Load yl with cr,cr,dr,dr
+ yh = _mm_movehdup_ps(y); // Load yh with ci,ci,di,di
+
+ tmp1 = _mm_mul_ps(x,yl); // tmp1 = ar*cr,ai*cr,br*dr,bi*dr
+
+ x = _mm_shuffle_ps(x,x,0xB1); // Re-arrange x to be ai,ar,bi,br
+
+ tmp2 = _mm_mul_ps(x,yh); // tmp2 = ai*ci,ar*ci,bi*di,br*di
+
+ z = _mm_addsub_ps(tmp1,tmp2); // ar*cr-ai*ci, ai*cr+ar*ci, br*dr-bi*di, bi*dr+br*di
+
+ _mm_store_ps((float*)c,z); // Store the results back into the C container
+
+ a += 2;
+ b += 2;
+ c += 2;
+ }
+
+ if((num_points % 2) != 0) {
+ *c = (*a) * lv_conj(*b);
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+ /*!
+ \brief Multiplies vector a by the conjugate of vector b and stores the results in the third vector
+ \param cVector The vector where the results will be stored
+ \param aVector First vector to be multiplied
+ \param bVector Second vector that is conjugated before being multiplied
+ \param num_points The number of complex values in aVector and bVector to be multiplied together and stored into cVector
+ */
+static inline void volk_32fc_x2_multiply_conjugate_32fc_a_generic(lv_32fc_t* cVector, const lv_32fc_t* aVector, const lv_32fc_t* bVector, unsigned int num_points){
+ lv_32fc_t* cPtr = cVector;
+ const lv_32fc_t* aPtr = aVector;
+ const lv_32fc_t* bPtr= bVector;
+ unsigned int number = 0;
+
+ for(number = 0; number < num_points; number++){
+ *cPtr++ = (*aPtr++) * lv_conj(*bPtr++);
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+#endif /* INCLUDED_volk_32fc_x2_multiply_conjugate_32fc_a_H */
diff --git a/volk/kernels/volk/volk_32fc_x2_s32f_square_dist_scalar_mult_32f.h b/volk/kernels/volk/volk_32fc_x2_s32f_square_dist_scalar_mult_32f.h
new file mode 100644
index 000000000..cb2e94501
--- /dev/null
+++ b/volk/kernels/volk/volk_32fc_x2_s32f_square_dist_scalar_mult_32f.h
@@ -0,0 +1,130 @@
+#ifndef INCLUDED_volk_32fc_x2_s32f_square_dist_scalar_mult_32f_a_H
+#define INCLUDED_volk_32fc_x2_s32f_square_dist_scalar_mult_32f_a_H
+
+#include<inttypes.h>
+#include<stdio.h>
+#include<volk/volk_complex.h>
+#include <string.h>
+
+#ifdef LV_HAVE_SSE3
+#include<xmmintrin.h>
+#include<pmmintrin.h>
+
+static inline void volk_32fc_x2_s32f_square_dist_scalar_mult_32f_a_sse3(float* target, lv_32fc_t* src0, lv_32fc_t* points, float scalar, unsigned int num_points) {
+
+ const unsigned int num_bytes = num_points*8;
+
+ __m128 xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, xmm8;
+
+ lv_32fc_t diff;
+ memset(&diff, 0x0, 2*sizeof(float));
+
+ float sq_dist = 0.0;
+ int bound = num_bytes >> 5;
+ int leftovers0 = (num_bytes >> 4) & 1;
+ int leftovers1 = (num_bytes >> 3) & 1;
+ int i = 0;
+
+
+
+ xmm1 = _mm_setzero_ps();
+ xmm1 = _mm_loadl_pi(xmm1, (__m64*)src0);
+ xmm2 = _mm_load_ps((float*)&points[0]);
+ xmm8 = _mm_load1_ps(&scalar);
+ xmm1 = _mm_movelh_ps(xmm1, xmm1);
+ xmm3 = _mm_load_ps((float*)&points[2]);
+
+
+ for(; i < bound - 1; ++i) {
+
+ xmm4 = _mm_sub_ps(xmm1, xmm2);
+ xmm5 = _mm_sub_ps(xmm1, xmm3);
+ points += 4;
+ xmm6 = _mm_mul_ps(xmm4, xmm4);
+ xmm7 = _mm_mul_ps(xmm5, xmm5);
+
+ xmm2 = _mm_load_ps((float*)&points[0]);
+
+ xmm4 = _mm_hadd_ps(xmm6, xmm7);
+
+ xmm3 = _mm_load_ps((float*)&points[2]);
+
+ xmm4 = _mm_mul_ps(xmm4, xmm8);
+
+ _mm_store_ps(target, xmm4);
+
+ target += 4;
+
+ }
+
+ xmm4 = _mm_sub_ps(xmm1, xmm2);
+ xmm5 = _mm_sub_ps(xmm1, xmm3);
+
+
+
+ points += 4;
+ xmm6 = _mm_mul_ps(xmm4, xmm4);
+ xmm7 = _mm_mul_ps(xmm5, xmm5);
+
+ xmm4 = _mm_hadd_ps(xmm6, xmm7);
+
+ xmm4 = _mm_mul_ps(xmm4, xmm8);
+
+ _mm_store_ps(target, xmm4);
+
+ target += 4;
+
+
+ for(i = 0; i < leftovers0; ++i) {
+
+ xmm2 = _mm_load_ps((float*)&points[0]);
+
+ xmm4 = _mm_sub_ps(xmm1, xmm2);
+
+ points += 2;
+
+ xmm6 = _mm_mul_ps(xmm4, xmm4);
+
+ xmm4 = _mm_hadd_ps(xmm6, xmm6);
+
+ xmm4 = _mm_mul_ps(xmm4, xmm8);
+
+ _mm_storeh_pi((__m64*)target, xmm4);
+
+ target += 2;
+ }
+
+ for(i = 0; i < leftovers1; ++i) {
+
+ diff = src0[0] - points[0];
+
+ sq_dist = scalar * (lv_creal(diff) * lv_creal(diff) + lv_cimag(diff) * lv_cimag(diff));
+
+ target[0] = sq_dist;
+ }
+}
+
+#endif /*LV_HAVE_SSE3*/
+
+#ifdef LV_HAVE_GENERIC
+static inline void volk_32fc_x2_s32f_square_dist_scalar_mult_32f_generic(float* target, lv_32fc_t* src0, lv_32fc_t* points, float scalar, unsigned int num_points) {
+
+ const unsigned int num_bytes = num_points*8;
+
+ lv_32fc_t diff;
+ float sq_dist;
+ unsigned int i = 0;
+
+ for(; i < num_bytes >> 3; ++i) {
+ diff = src0[0] - points[i];
+
+ sq_dist = scalar * (lv_creal(diff) * lv_creal(diff) + lv_cimag(diff) * lv_cimag(diff));
+
+ target[i] = sq_dist;
+ }
+}
+
+#endif /*LV_HAVE_GENERIC*/
+
+
+#endif /*INCLUDED_volk_32fc_x2_s32f_square_dist_scalar_mult_32f_a_H*/
diff --git a/volk/kernels/volk/volk_32fc_x2_square_dist_32f.h b/volk/kernels/volk/volk_32fc_x2_square_dist_32f.h
new file mode 100644
index 000000000..27a081b7c
--- /dev/null
+++ b/volk/kernels/volk/volk_32fc_x2_square_dist_32f.h
@@ -0,0 +1,116 @@
+#ifndef INCLUDED_volk_32fc_x2_square_dist_32f_a_H
+#define INCLUDED_volk_32fc_x2_square_dist_32f_a_H
+
+#include<inttypes.h>
+#include<stdio.h>
+#include<volk/volk_complex.h>
+
+#ifdef LV_HAVE_SSE3
+#include<xmmintrin.h>
+#include<pmmintrin.h>
+
+static inline void volk_32fc_x2_square_dist_32f_a_sse3(float* target, lv_32fc_t* src0, lv_32fc_t* points, unsigned int num_points) {
+
+ const unsigned int num_bytes = num_points*8;
+
+ __m128 xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7;
+
+ lv_32fc_t diff;
+ float sq_dist;
+ int bound = num_bytes >> 5;
+ int leftovers0 = (num_bytes >> 4) & 1;
+ int leftovers1 = (num_bytes >> 3) & 1;
+ int i = 0;
+
+ xmm1 = _mm_setzero_ps();
+ xmm1 = _mm_loadl_pi(xmm1, (__m64*)src0);
+ xmm2 = _mm_load_ps((float*)&points[0]);
+ xmm1 = _mm_movelh_ps(xmm1, xmm1);
+ xmm3 = _mm_load_ps((float*)&points[2]);
+
+
+ for(; i < bound - 1; ++i) {
+ xmm4 = _mm_sub_ps(xmm1, xmm2);
+ xmm5 = _mm_sub_ps(xmm1, xmm3);
+ points += 4;
+ xmm6 = _mm_mul_ps(xmm4, xmm4);
+ xmm7 = _mm_mul_ps(xmm5, xmm5);
+
+ xmm2 = _mm_load_ps((float*)&points[0]);
+
+ xmm4 = _mm_hadd_ps(xmm6, xmm7);
+
+ xmm3 = _mm_load_ps((float*)&points[2]);
+
+ _mm_store_ps(target, xmm4);
+
+ target += 4;
+
+ }
+
+ xmm4 = _mm_sub_ps(xmm1, xmm2);
+ xmm5 = _mm_sub_ps(xmm1, xmm3);
+
+
+
+ points += 4;
+ xmm6 = _mm_mul_ps(xmm4, xmm4);
+ xmm7 = _mm_mul_ps(xmm5, xmm5);
+
+ xmm4 = _mm_hadd_ps(xmm6, xmm7);
+
+ _mm_store_ps(target, xmm4);
+
+ target += 4;
+
+ for(i = 0; i < leftovers0; ++i) {
+
+ xmm2 = _mm_load_ps((float*)&points[0]);
+
+ xmm4 = _mm_sub_ps(xmm1, xmm2);
+
+ points += 2;
+
+ xmm6 = _mm_mul_ps(xmm4, xmm4);
+
+ xmm4 = _mm_hadd_ps(xmm6, xmm6);
+
+ _mm_storeh_pi((__m64*)target, xmm4);
+
+ target += 2;
+ }
+
+ for(i = 0; i < leftovers1; ++i) {
+
+ diff = src0[0] - points[0];
+
+ sq_dist = lv_creal(diff) * lv_creal(diff) + lv_cimag(diff) * lv_cimag(diff);
+
+ target[0] = sq_dist;
+ }
+}
+
+#endif /*LV_HAVE_SSE3*/
+
+#ifdef LV_HAVE_GENERIC
+static inline void volk_32fc_x2_square_dist_32f_generic(float* target, lv_32fc_t* src0, lv_32fc_t* points, unsigned int num_points) {
+
+ const unsigned int num_bytes = num_points*8;
+
+ lv_32fc_t diff;
+ float sq_dist;
+ unsigned int i = 0;
+
+ for(; i < num_bytes >> 3; ++i) {
+ diff = src0[0] - points[i];
+
+ sq_dist = lv_creal(diff) * lv_creal(diff) + lv_cimag(diff) * lv_cimag(diff);
+
+ target[i] = sq_dist;
+ }
+}
+
+#endif /*LV_HAVE_GENERIC*/
+
+
+#endif /*INCLUDED_volk_32fc_x2_square_dist_32f_a_H*/
diff --git a/volk/kernels/volk/volk_32i_s32f_convert_32f.h b/volk/kernels/volk/volk_32i_s32f_convert_32f.h
new file mode 100644
index 000000000..7a0988345
--- /dev/null
+++ b/volk/kernels/volk/volk_32i_s32f_convert_32f.h
@@ -0,0 +1,148 @@
+#ifndef INCLUDED_volk_32i_s32f_convert_32f_u_H
+#define INCLUDED_volk_32i_s32f_convert_32f_u_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE2
+#include <emmintrin.h>
+
+ /*!
+ \brief Converts the input 32 bit integer data into floating point data, and divides the each floating point output data point by the scalar value
+ \param inputVector The 32 bit input data buffer
+ \param outputVector The floating point output data buffer
+ \param scalar The value divided against each point in the output buffer
+ \param num_points The number of data values to be converted
+ \note Output buffer does NOT need to be properly aligned
+ */
+static inline void volk_32i_s32f_convert_32f_u_sse2(float* outputVector, const int32_t* inputVector, const float scalar, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+
+ float* outputVectorPtr = outputVector;
+ const float iScalar = 1.0 / scalar;
+ __m128 invScalar = _mm_set_ps1(iScalar);
+ int32_t* inputPtr = (int32_t*)inputVector;
+ __m128i inputVal;
+ __m128 ret;
+
+ for(;number < quarterPoints; number++){
+
+ // Load the 4 values
+ inputVal = _mm_loadu_si128((__m128i*)inputPtr);
+
+ ret = _mm_cvtepi32_ps(inputVal);
+ ret = _mm_mul_ps(ret, invScalar);
+
+ _mm_storeu_ps(outputVectorPtr, ret);
+
+ outputVectorPtr += 4;
+ inputPtr += 4;
+ }
+
+ number = quarterPoints * 4;
+ for(; number < num_points; number++){
+ outputVector[number] =((float)(inputVector[number])) * iScalar;
+ }
+}
+#endif /* LV_HAVE_SSE2 */
+
+
+#ifdef LV_HAVE_GENERIC
+ /*!
+ \brief Converts the input 32 bit integer data into floating point data, and divides the each floating point output data point by the scalar value
+ \param inputVector The 32 bit input data buffer
+ \param outputVector The floating point output data buffer
+ \param scalar The value divided against each point in the output buffer
+ \param num_points The number of data values to be converted
+ \note Output buffer does NOT need to be properly aligned
+ */
+static inline void volk_32i_s32f_convert_32f_generic(float* outputVector, const int32_t* inputVector, const float scalar, unsigned int num_points){
+ float* outputVectorPtr = outputVector;
+ const int32_t* inputVectorPtr = inputVector;
+ unsigned int number = 0;
+ const float iScalar = 1.0 / scalar;
+
+ for(number = 0; number < num_points; number++){
+ *outputVectorPtr++ = ((float)(*inputVectorPtr++)) * iScalar;
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_32i_s32f_convert_32f_u_H */
+#ifndef INCLUDED_volk_32i_s32f_convert_32f_a_H
+#define INCLUDED_volk_32i_s32f_convert_32f_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE2
+#include <emmintrin.h>
+
+ /*!
+ \brief Converts the input 32 bit integer data into floating point data, and divides the each floating point output data point by the scalar value
+ \param inputVector The 32 bit input data buffer
+ \param outputVector The floating point output data buffer
+ \param scalar The value divided against each point in the output buffer
+ \param num_points The number of data values to be converted
+ */
+static inline void volk_32i_s32f_convert_32f_a_sse2(float* outputVector, const int32_t* inputVector, const float scalar, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+
+ float* outputVectorPtr = outputVector;
+ const float iScalar = 1.0 / scalar;
+ __m128 invScalar = _mm_set_ps1(iScalar);
+ int32_t* inputPtr = (int32_t*)inputVector;
+ __m128i inputVal;
+ __m128 ret;
+
+ for(;number < quarterPoints; number++){
+
+ // Load the 4 values
+ inputVal = _mm_load_si128((__m128i*)inputPtr);
+
+ ret = _mm_cvtepi32_ps(inputVal);
+ ret = _mm_mul_ps(ret, invScalar);
+
+ _mm_store_ps(outputVectorPtr, ret);
+
+ outputVectorPtr += 4;
+ inputPtr += 4;
+ }
+
+ number = quarterPoints * 4;
+ for(; number < num_points; number++){
+ outputVector[number] =((float)(inputVector[number])) * iScalar;
+ }
+}
+#endif /* LV_HAVE_SSE2 */
+
+
+#ifdef LV_HAVE_GENERIC
+ /*!
+ \brief Converts the input 32 bit integer data into floating point data, and divides the each floating point output data point by the scalar value
+ \param inputVector The 32 bit input data buffer
+ \param outputVector The floating point output data buffer
+ \param scalar The value divided against each point in the output buffer
+ \param num_points The number of data values to be converted
+ */
+static inline void volk_32i_s32f_convert_32f_a_generic(float* outputVector, const int32_t* inputVector, const float scalar, unsigned int num_points){
+ float* outputVectorPtr = outputVector;
+ const int32_t* inputVectorPtr = inputVector;
+ unsigned int number = 0;
+ const float iScalar = 1.0 / scalar;
+
+ for(number = 0; number < num_points; number++){
+ *outputVectorPtr++ = ((float)(*inputVectorPtr++)) * iScalar;
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_32i_s32f_convert_32f_a_H */
diff --git a/volk/kernels/volk/volk_32i_x2_and_32i.h b/volk/kernels/volk/volk_32i_x2_and_32i.h
new file mode 100644
index 000000000..54ecb7981
--- /dev/null
+++ b/volk/kernels/volk/volk_32i_x2_and_32i.h
@@ -0,0 +1,81 @@
+#ifndef INCLUDED_volk_32i_x2_and_32i_a_H
+#define INCLUDED_volk_32i_x2_and_32i_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+/*!
+ \brief Ands the two input vectors and store their results in the third vector
+ \param cVector The vector where the results will be stored
+ \param aVector One of the vectors
+ \param bVector One of the vectors
+ \param num_points The number of values in aVector and bVector to be anded together and stored into cVector
+*/
+static inline void volk_32i_x2_and_32i_a_sse(int32_t* cVector, const int32_t* aVector, const int32_t* bVector, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+
+ float* cPtr = (float*)cVector;
+ const float* aPtr = (float*)aVector;
+ const float* bPtr = (float*)bVector;
+
+ __m128 aVal, bVal, cVal;
+ for(;number < quarterPoints; number++){
+
+ aVal = _mm_load_ps(aPtr);
+ bVal = _mm_load_ps(bPtr);
+
+ cVal = _mm_and_ps(aVal, bVal);
+
+ _mm_store_ps(cPtr,cVal); // Store the results back into the C container
+
+ aPtr += 4;
+ bPtr += 4;
+ cPtr += 4;
+ }
+
+ number = quarterPoints * 4;
+ for(;number < num_points; number++){
+ cVector[number] = aVector[number] & bVector[number];
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Ands the two input vectors and store their results in the third vector
+ \param cVector The vector where the results will be stored
+ \param aVector One of the vectors
+ \param bVector One of the vectors
+ \param num_points The number of values in aVector and bVector to be anded together and stored into cVector
+*/
+static inline void volk_32i_x2_and_32i_generic(int32_t* cVector, const int32_t* aVector, const int32_t* bVector, unsigned int num_points){
+ int32_t* cPtr = cVector;
+ const int32_t* aPtr = aVector;
+ const int32_t* bPtr= bVector;
+ unsigned int number = 0;
+
+ for(number = 0; number < num_points; number++){
+ *cPtr++ = (*aPtr++) & (*bPtr++);
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+#ifdef LV_HAVE_ORC
+/*!
+ \brief Ands the two input vectors and store their results in the third vector
+ \param cVector The vector where the results will be stored
+ \param aVector One of the vectors
+ \param bVector One of the vectors
+ \param num_points The number of values in aVector and bVector to be anded together and stored into cVector
+*/
+extern void volk_32i_x2_and_32i_a_orc_impl(int32_t* cVector, const int32_t* aVector, const int32_t* bVector, unsigned int num_points);
+static inline void volk_32i_x2_and_32i_u_orc(int32_t* cVector, const int32_t* aVector, const int32_t* bVector, unsigned int num_points){
+ volk_32i_x2_and_32i_a_orc_impl(cVector, aVector, bVector, num_points);
+}
+#endif /* LV_HAVE_ORC */
+
+
+#endif /* INCLUDED_volk_32i_x2_and_32i_a_H */
diff --git a/volk/kernels/volk/volk_32i_x2_or_32i.h b/volk/kernels/volk/volk_32i_x2_or_32i.h
new file mode 100644
index 000000000..acadd5a57
--- /dev/null
+++ b/volk/kernels/volk/volk_32i_x2_or_32i.h
@@ -0,0 +1,81 @@
+#ifndef INCLUDED_volk_32i_x2_or_32i_a_H
+#define INCLUDED_volk_32i_x2_or_32i_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+/*!
+ \brief Ors the two input vectors and store their results in the third vector
+ \param cVector The vector where the results will be stored
+ \param aVector One of the vectors to be ored
+ \param bVector One of the vectors to be ored
+ \param num_points The number of values in aVector and bVector to be ored together and stored into cVector
+*/
+static inline void volk_32i_x2_or_32i_a_sse(int32_t* cVector, const int32_t* aVector, const int32_t* bVector, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+
+ float* cPtr = (float*)cVector;
+ const float* aPtr = (float*)aVector;
+ const float* bPtr = (float*)bVector;
+
+ __m128 aVal, bVal, cVal;
+ for(;number < quarterPoints; number++){
+
+ aVal = _mm_load_ps(aPtr);
+ bVal = _mm_load_ps(bPtr);
+
+ cVal = _mm_or_ps(aVal, bVal);
+
+ _mm_store_ps(cPtr,cVal); // Store the results back into the C container
+
+ aPtr += 4;
+ bPtr += 4;
+ cPtr += 4;
+ }
+
+ number = quarterPoints * 4;
+ for(;number < num_points; number++){
+ cVector[number] = aVector[number] | bVector[number];
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Ors the two input vectors and store their results in the third vector
+ \param cVector The vector where the results will be stored
+ \param aVector One of the vectors to be ored
+ \param bVector One of the vectors to be ored
+ \param num_points The number of values in aVector and bVector to be ored together and stored into cVector
+*/
+static inline void volk_32i_x2_or_32i_generic(int32_t* cVector, const int32_t* aVector, const int32_t* bVector, unsigned int num_points){
+ int32_t* cPtr = cVector;
+ const int32_t* aPtr = aVector;
+ const int32_t* bPtr= bVector;
+ unsigned int number = 0;
+
+ for(number = 0; number < num_points; number++){
+ *cPtr++ = (*aPtr++) | (*bPtr++);
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+#ifdef LV_HAVE_ORC
+/*!
+ \brief Ors the two input vectors and store their results in the third vector
+ \param cVector The vector where the results will be stored
+ \param aVector One of the vectors to be ored
+ \param bVector One of the vectors to be ored
+ \param num_points The number of values in aVector and bVector to be ored together and stored into cVector
+*/
+extern void volk_32i_x2_or_32i_a_orc_impl(int32_t* cVector, const int32_t* aVector, const int32_t* bVector, unsigned int num_points);
+static inline void volk_32i_x2_or_32i_u_orc(int32_t* cVector, const int32_t* aVector, const int32_t* bVector, unsigned int num_points){
+ volk_32i_x2_or_32i_a_orc_impl(cVector, aVector, bVector, num_points);
+}
+#endif /* LV_HAVE_ORC */
+
+
+#endif /* INCLUDED_volk_32i_x2_or_32i_a_H */
diff --git a/volk/kernels/volk/volk_32u_byteswap.h b/volk/kernels/volk/volk_32u_byteswap.h
new file mode 100644
index 000000000..8f6e3ad7b
--- /dev/null
+++ b/volk/kernels/volk/volk_32u_byteswap.h
@@ -0,0 +1,154 @@
+#ifndef INCLUDED_volk_32u_byteswap_u_H
+#define INCLUDED_volk_32u_byteswap_u_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE2
+#include <emmintrin.h>
+
+/*!
+ \brief Byteswaps (in-place) an aligned vector of int32_t's.
+ \param intsToSwap The vector of data to byte swap
+ \param numDataPoints The number of data points
+*/
+static inline void volk_32u_byteswap_u_sse2(uint32_t* intsToSwap, unsigned int num_points){
+ unsigned int number = 0;
+
+ uint32_t* inputPtr = intsToSwap;
+ __m128i input, byte1, byte2, byte3, byte4, output;
+ __m128i byte2mask = _mm_set1_epi32(0x00FF0000);
+ __m128i byte3mask = _mm_set1_epi32(0x0000FF00);
+
+ const uint64_t quarterPoints = num_points / 4;
+ for(;number < quarterPoints; number++){
+ // Load the 32t values, increment inputPtr later since we're doing it in-place.
+ input = _mm_loadu_si128((__m128i*)inputPtr);
+ // Do the four shifts
+ byte1 = _mm_slli_epi32(input, 24);
+ byte2 = _mm_slli_epi32(input, 8);
+ byte3 = _mm_srli_epi32(input, 8);
+ byte4 = _mm_srli_epi32(input, 24);
+ // Or bytes together
+ output = _mm_or_si128(byte1, byte4);
+ byte2 = _mm_and_si128(byte2, byte2mask);
+ output = _mm_or_si128(output, byte2);
+ byte3 = _mm_and_si128(byte3, byte3mask);
+ output = _mm_or_si128(output, byte3);
+ // Store the results
+ _mm_storeu_si128((__m128i*)inputPtr, output);
+ inputPtr += 4;
+ }
+
+ // Byteswap any remaining points:
+ number = quarterPoints*4;
+ for(; number < num_points; number++){
+ uint32_t outputVal = *inputPtr;
+ outputVal = (((outputVal >> 24) & 0xff) | ((outputVal >> 8) & 0x0000ff00) | ((outputVal << 8) & 0x00ff0000) | ((outputVal << 24) & 0xff000000));
+ *inputPtr = outputVal;
+ inputPtr++;
+ }
+}
+#endif /* LV_HAVE_SSE2 */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Byteswaps (in-place) an aligned vector of int32_t's.
+ \param intsToSwap The vector of data to byte swap
+ \param numDataPoints The number of data points
+*/
+static inline void volk_32u_byteswap_generic(uint32_t* intsToSwap, unsigned int num_points){
+ uint32_t* inputPtr = intsToSwap;
+
+ unsigned int point;
+ for(point = 0; point < num_points; point++){
+ uint32_t output = *inputPtr;
+ output = (((output >> 24) & 0xff) | ((output >> 8) & 0x0000ff00) | ((output << 8) & 0x00ff0000) | ((output << 24) & 0xff000000));
+
+ *inputPtr = output;
+ inputPtr++;
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_32u_byteswap_u_H */
+#ifndef INCLUDED_volk_32u_byteswap_a_H
+#define INCLUDED_volk_32u_byteswap_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE2
+#include <emmintrin.h>
+
+/*!
+ \brief Byteswaps (in-place) an aligned vector of int32_t's.
+ \param intsToSwap The vector of data to byte swap
+ \param numDataPoints The number of data points
+*/
+static inline void volk_32u_byteswap_a_sse2(uint32_t* intsToSwap, unsigned int num_points){
+ unsigned int number = 0;
+
+ uint32_t* inputPtr = intsToSwap;
+ __m128i input, byte1, byte2, byte3, byte4, output;
+ __m128i byte2mask = _mm_set1_epi32(0x00FF0000);
+ __m128i byte3mask = _mm_set1_epi32(0x0000FF00);
+
+ const uint64_t quarterPoints = num_points / 4;
+ for(;number < quarterPoints; number++){
+ // Load the 32t values, increment inputPtr later since we're doing it in-place.
+ input = _mm_load_si128((__m128i*)inputPtr);
+ // Do the four shifts
+ byte1 = _mm_slli_epi32(input, 24);
+ byte2 = _mm_slli_epi32(input, 8);
+ byte3 = _mm_srli_epi32(input, 8);
+ byte4 = _mm_srli_epi32(input, 24);
+ // Or bytes together
+ output = _mm_or_si128(byte1, byte4);
+ byte2 = _mm_and_si128(byte2, byte2mask);
+ output = _mm_or_si128(output, byte2);
+ byte3 = _mm_and_si128(byte3, byte3mask);
+ output = _mm_or_si128(output, byte3);
+ // Store the results
+ _mm_store_si128((__m128i*)inputPtr, output);
+ inputPtr += 4;
+ }
+
+ // Byteswap any remaining points:
+ number = quarterPoints*4;
+ for(; number < num_points; number++){
+ uint32_t outputVal = *inputPtr;
+ outputVal = (((outputVal >> 24) & 0xff) | ((outputVal >> 8) & 0x0000ff00) | ((outputVal << 8) & 0x00ff0000) | ((outputVal << 24) & 0xff000000));
+ *inputPtr = outputVal;
+ inputPtr++;
+ }
+}
+#endif /* LV_HAVE_SSE2 */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Byteswaps (in-place) an aligned vector of int32_t's.
+ \param intsToSwap The vector of data to byte swap
+ \param numDataPoints The number of data points
+*/
+static inline void volk_32u_byteswap_a_generic(uint32_t* intsToSwap, unsigned int num_points){
+ uint32_t* inputPtr = intsToSwap;
+
+ unsigned int point;
+ for(point = 0; point < num_points; point++){
+ uint32_t output = *inputPtr;
+ output = (((output >> 24) & 0xff) | ((output >> 8) & 0x0000ff00) | ((output << 8) & 0x00ff0000) | ((output << 24) & 0xff000000));
+
+ *inputPtr = output;
+ inputPtr++;
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_32u_byteswap_a_H */
diff --git a/volk/kernels/volk/volk_32u_popcnt.h b/volk/kernels/volk/volk_32u_popcnt.h
new file mode 100644
index 000000000..978356972
--- /dev/null
+++ b/volk/kernels/volk/volk_32u_popcnt.h
@@ -0,0 +1,36 @@
+#ifndef INCLUDED_VOLK_32u_POPCNT_A16_H
+#define INCLUDED_VOLK_32u_POPCNT_A16_H
+
+#include <stdio.h>
+#include <inttypes.h>
+
+
+#ifdef LV_HAVE_GENERIC
+
+static inline void volk_32u_popcnt_generic(uint32_t* ret, const uint32_t value) {
+
+ // This is faster than a lookup table
+ uint32_t retVal = value;
+
+ retVal = (retVal & 0x55555555) + (retVal >> 1 & 0x55555555);
+ retVal = (retVal & 0x33333333) + (retVal >> 2 & 0x33333333);
+ retVal = (retVal + (retVal >> 4)) & 0x0F0F0F0F;
+ retVal = (retVal + (retVal >> 8));
+ retVal = (retVal + (retVal >> 16)) & 0x0000003F;
+
+ *ret = retVal;
+}
+
+#endif /*LV_HAVE_GENERIC*/
+
+#ifdef LV_HAVE_SSE4_2
+
+#include <nmmintrin.h>
+
+static inline void volk_32u_popcnt_a_sse4_2(uint32_t* ret, const uint32_t value) {
+ *ret = _mm_popcnt_u32(value);
+}
+
+#endif /*LV_HAVE_SSE4_2*/
+
+#endif /*INCLUDED_VOLK_32u_POPCNT_A16_H*/
diff --git a/volk/kernels/volk/volk_64f_convert_32f.h b/volk/kernels/volk/volk_64f_convert_32f.h
new file mode 100644
index 000000000..c27526ffa
--- /dev/null
+++ b/volk/kernels/volk/volk_64f_convert_32f.h
@@ -0,0 +1,134 @@
+#ifndef INCLUDED_volk_64f_convert_32f_u_H
+#define INCLUDED_volk_64f_convert_32f_u_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE2
+#include <emmintrin.h>
+ /*!
+ \brief Converts the double values into float values
+ \param dVector The converted float vector values
+ \param fVector The double vector values to be converted
+ \param num_points The number of points in the two vectors to be converted
+ */
+static inline void volk_64f_convert_32f_u_sse2(float* outputVector, const double* inputVector, unsigned int num_points){
+ unsigned int number = 0;
+
+ const unsigned int quarterPoints = num_points / 4;
+
+ const double* inputVectorPtr = (const double*)inputVector;
+ float* outputVectorPtr = outputVector;
+ __m128 ret, ret2;
+ __m128d inputVal1, inputVal2;
+
+ for(;number < quarterPoints; number++){
+ inputVal1 = _mm_loadu_pd(inputVectorPtr); inputVectorPtr += 2;
+ inputVal2 = _mm_loadu_pd(inputVectorPtr); inputVectorPtr += 2;
+
+ ret = _mm_cvtpd_ps(inputVal1);
+ ret2 = _mm_cvtpd_ps(inputVal2);
+
+ ret = _mm_movelh_ps(ret, ret2);
+
+ _mm_storeu_ps(outputVectorPtr, ret);
+ outputVectorPtr += 4;
+ }
+
+ number = quarterPoints * 4;
+ for(; number < num_points; number++){
+ outputVector[number] = (float)(inputVector[number]);
+ }
+}
+#endif /* LV_HAVE_SSE2 */
+
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Converts the double values into float values
+ \param dVector The converted float vector values
+ \param fVector The double vector values to be converted
+ \param num_points The number of points in the two vectors to be converted
+*/
+static inline void volk_64f_convert_32f_generic(float* outputVector, const double* inputVector, unsigned int num_points){
+ float* outputVectorPtr = outputVector;
+ const double* inputVectorPtr = inputVector;
+ unsigned int number = 0;
+
+ for(number = 0; number < num_points; number++){
+ *outputVectorPtr++ = ((float)(*inputVectorPtr++));
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_64f_convert_32f_u_H */
+#ifndef INCLUDED_volk_64f_convert_32f_a_H
+#define INCLUDED_volk_64f_convert_32f_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE2
+#include <emmintrin.h>
+ /*!
+ \brief Converts the double values into float values
+ \param dVector The converted float vector values
+ \param fVector The double vector values to be converted
+ \param num_points The number of points in the two vectors to be converted
+ */
+static inline void volk_64f_convert_32f_a_sse2(float* outputVector, const double* inputVector, unsigned int num_points){
+ unsigned int number = 0;
+
+ const unsigned int quarterPoints = num_points / 4;
+
+ const double* inputVectorPtr = (const double*)inputVector;
+ float* outputVectorPtr = outputVector;
+ __m128 ret, ret2;
+ __m128d inputVal1, inputVal2;
+
+ for(;number < quarterPoints; number++){
+ inputVal1 = _mm_load_pd(inputVectorPtr); inputVectorPtr += 2;
+ inputVal2 = _mm_load_pd(inputVectorPtr); inputVectorPtr += 2;
+
+ ret = _mm_cvtpd_ps(inputVal1);
+ ret2 = _mm_cvtpd_ps(inputVal2);
+
+ ret = _mm_movelh_ps(ret, ret2);
+
+ _mm_store_ps(outputVectorPtr, ret);
+ outputVectorPtr += 4;
+ }
+
+ number = quarterPoints * 4;
+ for(; number < num_points; number++){
+ outputVector[number] = (float)(inputVector[number]);
+ }
+}
+#endif /* LV_HAVE_SSE2 */
+
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Converts the double values into float values
+ \param dVector The converted float vector values
+ \param fVector The double vector values to be converted
+ \param num_points The number of points in the two vectors to be converted
+*/
+static inline void volk_64f_convert_32f_a_generic(float* outputVector, const double* inputVector, unsigned int num_points){
+ float* outputVectorPtr = outputVector;
+ const double* inputVectorPtr = inputVector;
+ unsigned int number = 0;
+
+ for(number = 0; number < num_points; number++){
+ *outputVectorPtr++ = ((float)(*inputVectorPtr++));
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_64f_convert_32f_a_H */
diff --git a/volk/kernels/volk/volk_64f_x2_max_64f.h b/volk/kernels/volk/volk_64f_x2_max_64f.h
new file mode 100644
index 000000000..f9a04c2c4
--- /dev/null
+++ b/volk/kernels/volk/volk_64f_x2_max_64f.h
@@ -0,0 +1,71 @@
+#ifndef INCLUDED_volk_64f_x2_max_64f_a_H
+#define INCLUDED_volk_64f_x2_max_64f_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE2
+#include <emmintrin.h>
+/*!
+ \brief Selects maximum value from each entry between bVector and aVector and store their results in the cVector
+ \param cVector The vector where the results will be stored
+ \param aVector The vector to be checked
+ \param bVector The vector to be checked
+ \param num_points The number of values in aVector and bVector to be checked and stored into cVector
+*/
+static inline void volk_64f_x2_max_64f_a_sse2(double* cVector, const double* aVector, const double* bVector, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int halfPoints = num_points / 2;
+
+ double* cPtr = cVector;
+ const double* aPtr = aVector;
+ const double* bPtr= bVector;
+
+ __m128d aVal, bVal, cVal;
+ for(;number < halfPoints; number++){
+
+ aVal = _mm_load_pd(aPtr);
+ bVal = _mm_load_pd(bPtr);
+
+ cVal = _mm_max_pd(aVal, bVal);
+
+ _mm_store_pd(cPtr,cVal); // Store the results back into the C container
+
+ aPtr += 2;
+ bPtr += 2;
+ cPtr += 2;
+ }
+
+ number = halfPoints * 2;
+ for(;number < num_points; number++){
+ const double a = *aPtr++;
+ const double b = *bPtr++;
+ *cPtr++ = ( a > b ? a : b);
+ }
+}
+#endif /* LV_HAVE_SSE2 */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Selects maximum value from each entry between bVector and aVector and store their results in the cVector
+ \param cVector The vector where the results will be stored
+ \param aVector The vector to be checked
+ \param bVector The vector to be checked
+ \param num_points The number of values in aVector and bVector to be checked and stored into cVector
+*/
+static inline void volk_64f_x2_max_64f_generic(double* cVector, const double* aVector, const double* bVector, unsigned int num_points){
+ double* cPtr = cVector;
+ const double* aPtr = aVector;
+ const double* bPtr= bVector;
+ unsigned int number = 0;
+
+ for(number = 0; number < num_points; number++){
+ const double a = *aPtr++;
+ const double b = *bPtr++;
+ *cPtr++ = ( a > b ? a : b);
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+#endif /* INCLUDED_volk_64f_x2_max_64f_a_H */
diff --git a/volk/kernels/volk/volk_64f_x2_min_64f.h b/volk/kernels/volk/volk_64f_x2_min_64f.h
new file mode 100644
index 000000000..c77ca87fb
--- /dev/null
+++ b/volk/kernels/volk/volk_64f_x2_min_64f.h
@@ -0,0 +1,71 @@
+#ifndef INCLUDED_volk_64f_x2_min_64f_a_H
+#define INCLUDED_volk_64f_x2_min_64f_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE2
+#include <emmintrin.h>
+/*!
+ \brief Selects minimum value from each entry between bVector and aVector and store their results in the cVector
+ \param cVector The vector where the results will be stored
+ \param aVector The vector to be checked
+ \param bVector The vector to be checked
+ \param num_points The number of values in aVector and bVector to be checked and stored into cVector
+*/
+static inline void volk_64f_x2_min_64f_a_sse2(double* cVector, const double* aVector, const double* bVector, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int halfPoints = num_points / 2;
+
+ double* cPtr = cVector;
+ const double* aPtr = aVector;
+ const double* bPtr= bVector;
+
+ __m128d aVal, bVal, cVal;
+ for(;number < halfPoints; number++){
+
+ aVal = _mm_load_pd(aPtr);
+ bVal = _mm_load_pd(bPtr);
+
+ cVal = _mm_min_pd(aVal, bVal);
+
+ _mm_store_pd(cPtr,cVal); // Store the results back into the C container
+
+ aPtr += 2;
+ bPtr += 2;
+ cPtr += 2;
+ }
+
+ number = halfPoints * 2;
+ for(;number < num_points; number++){
+ const double a = *aPtr++;
+ const double b = *bPtr++;
+ *cPtr++ = ( a < b ? a : b);
+ }
+}
+#endif /* LV_HAVE_SSE2 */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Selects minimum value from each entry between bVector and aVector and store their results in the cVector
+ \param cVector The vector where the results will be stored
+ \param aVector The vector to be checked
+ \param bVector The vector to be checked
+ \param num_points The number of values in aVector and bVector to be checked and stored into cVector
+*/
+static inline void volk_64f_x2_min_64f_generic(double* cVector, const double* aVector, const double* bVector, unsigned int num_points){
+ double* cPtr = cVector;
+ const double* aPtr = aVector;
+ const double* bPtr= bVector;
+ unsigned int number = 0;
+
+ for(number = 0; number < num_points; number++){
+ const double a = *aPtr++;
+ const double b = *bPtr++;
+ *cPtr++ = ( a < b ? a : b);
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+#endif /* INCLUDED_volk_64f_x2_min_64f_a_H */
diff --git a/volk/kernels/volk/volk_64u_byteswap.h b/volk/kernels/volk/volk_64u_byteswap.h
new file mode 100644
index 000000000..e05daf6d5
--- /dev/null
+++ b/volk/kernels/volk/volk_64u_byteswap.h
@@ -0,0 +1,176 @@
+#ifndef INCLUDED_volk_64u_byteswap_u_H
+#define INCLUDED_volk_64u_byteswap_u_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE2
+#include <emmintrin.h>
+
+/*!
+ \brief Byteswaps (in-place) an aligned vector of int64_t's.
+ \param intsToSwap The vector of data to byte swap
+ \param numDataPoints The number of data points
+*/
+static inline void volk_64u_byteswap_u_sse2(uint64_t* intsToSwap, unsigned int num_points){
+ uint32_t* inputPtr = (uint32_t*)intsToSwap;
+ __m128i input, byte1, byte2, byte3, byte4, output;
+ __m128i byte2mask = _mm_set1_epi32(0x00FF0000);
+ __m128i byte3mask = _mm_set1_epi32(0x0000FF00);
+ uint64_t number = 0;
+ const unsigned int halfPoints = num_points / 2;
+ for(;number < halfPoints; number++){
+ // Load the 32t values, increment inputPtr later since we're doing it in-place.
+ input = _mm_loadu_si128((__m128i*)inputPtr);
+
+ // Do the four shifts
+ byte1 = _mm_slli_epi32(input, 24);
+ byte2 = _mm_slli_epi32(input, 8);
+ byte3 = _mm_srli_epi32(input, 8);
+ byte4 = _mm_srli_epi32(input, 24);
+ // Or bytes together
+ output = _mm_or_si128(byte1, byte4);
+ byte2 = _mm_and_si128(byte2, byte2mask);
+ output = _mm_or_si128(output, byte2);
+ byte3 = _mm_and_si128(byte3, byte3mask);
+ output = _mm_or_si128(output, byte3);
+
+ // Reorder the two words
+ output = _mm_shuffle_epi32(output, _MM_SHUFFLE(2, 3, 0, 1));
+
+ // Store the results
+ _mm_storeu_si128((__m128i*)inputPtr, output);
+ inputPtr += 4;
+ }
+
+ // Byteswap any remaining points:
+ number = halfPoints*2;
+ for(; number < num_points; number++){
+ uint32_t output1 = *inputPtr;
+ uint32_t output2 = inputPtr[1];
+
+ output1 = (((output1 >> 24) & 0xff) | ((output1 >> 8) & 0x0000ff00) | ((output1 << 8) & 0x00ff0000) | ((output1 << 24) & 0xff000000));
+
+ output2 = (((output2 >> 24) & 0xff) | ((output2 >> 8) & 0x0000ff00) | ((output2 << 8) & 0x00ff0000) | ((output2 << 24) & 0xff000000));
+
+ *inputPtr++ = output2;
+ *inputPtr++ = output1;
+ }
+}
+#endif /* LV_HAVE_SSE2 */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Byteswaps (in-place) an aligned vector of int64_t's.
+ \param intsToSwap The vector of data to byte swap
+ \param numDataPoints The number of data points
+*/
+static inline void volk_64u_byteswap_generic(uint64_t* intsToSwap, unsigned int num_points){
+ uint32_t* inputPtr = (uint32_t*)intsToSwap;
+ unsigned int point;
+ for(point = 0; point < num_points; point++){
+ uint32_t output1 = *inputPtr;
+ uint32_t output2 = inputPtr[1];
+
+ output1 = (((output1 >> 24) & 0xff) | ((output1 >> 8) & 0x0000ff00) | ((output1 << 8) & 0x00ff0000) | ((output1 << 24) & 0xff000000));
+
+ output2 = (((output2 >> 24) & 0xff) | ((output2 >> 8) & 0x0000ff00) | ((output2 << 8) & 0x00ff0000) | ((output2 << 24) & 0xff000000));
+
+ *inputPtr++ = output2;
+ *inputPtr++ = output1;
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_64u_byteswap_u_H */
+#ifndef INCLUDED_volk_64u_byteswap_a_H
+#define INCLUDED_volk_64u_byteswap_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE2
+#include <emmintrin.h>
+
+/*!
+ \brief Byteswaps (in-place) an aligned vector of int64_t's.
+ \param intsToSwap The vector of data to byte swap
+ \param numDataPoints The number of data points
+*/
+static inline void volk_64u_byteswap_a_sse2(uint64_t* intsToSwap, unsigned int num_points){
+ uint32_t* inputPtr = (uint32_t*)intsToSwap;
+ __m128i input, byte1, byte2, byte3, byte4, output;
+ __m128i byte2mask = _mm_set1_epi32(0x00FF0000);
+ __m128i byte3mask = _mm_set1_epi32(0x0000FF00);
+ uint64_t number = 0;
+ const unsigned int halfPoints = num_points / 2;
+ for(;number < halfPoints; number++){
+ // Load the 32t values, increment inputPtr later since we're doing it in-place.
+ input = _mm_load_si128((__m128i*)inputPtr);
+
+ // Do the four shifts
+ byte1 = _mm_slli_epi32(input, 24);
+ byte2 = _mm_slli_epi32(input, 8);
+ byte3 = _mm_srli_epi32(input, 8);
+ byte4 = _mm_srli_epi32(input, 24);
+ // Or bytes together
+ output = _mm_or_si128(byte1, byte4);
+ byte2 = _mm_and_si128(byte2, byte2mask);
+ output = _mm_or_si128(output, byte2);
+ byte3 = _mm_and_si128(byte3, byte3mask);
+ output = _mm_or_si128(output, byte3);
+
+ // Reorder the two words
+ output = _mm_shuffle_epi32(output, _MM_SHUFFLE(2, 3, 0, 1));
+
+ // Store the results
+ _mm_store_si128((__m128i*)inputPtr, output);
+ inputPtr += 4;
+ }
+
+ // Byteswap any remaining points:
+ number = halfPoints*2;
+ for(; number < num_points; number++){
+ uint32_t output1 = *inputPtr;
+ uint32_t output2 = inputPtr[1];
+
+ output1 = (((output1 >> 24) & 0xff) | ((output1 >> 8) & 0x0000ff00) | ((output1 << 8) & 0x00ff0000) | ((output1 << 24) & 0xff000000));
+
+ output2 = (((output2 >> 24) & 0xff) | ((output2 >> 8) & 0x0000ff00) | ((output2 << 8) & 0x00ff0000) | ((output2 << 24) & 0xff000000));
+
+ *inputPtr++ = output2;
+ *inputPtr++ = output1;
+ }
+}
+#endif /* LV_HAVE_SSE2 */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Byteswaps (in-place) an aligned vector of int64_t's.
+ \param intsToSwap The vector of data to byte swap
+ \param numDataPoints The number of data points
+*/
+static inline void volk_64u_byteswap_a_generic(uint64_t* intsToSwap, unsigned int num_points){
+ uint32_t* inputPtr = (uint32_t*)intsToSwap;
+ unsigned int point;
+ for(point = 0; point < num_points; point++){
+ uint32_t output1 = *inputPtr;
+ uint32_t output2 = inputPtr[1];
+
+ output1 = (((output1 >> 24) & 0xff) | ((output1 >> 8) & 0x0000ff00) | ((output1 << 8) & 0x00ff0000) | ((output1 << 24) & 0xff000000));
+
+ output2 = (((output2 >> 24) & 0xff) | ((output2 >> 8) & 0x0000ff00) | ((output2 << 8) & 0x00ff0000) | ((output2 << 24) & 0xff000000));
+
+ *inputPtr++ = output2;
+ *inputPtr++ = output1;
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_64u_byteswap_a_H */
diff --git a/volk/kernels/volk/volk_64u_popcnt.h b/volk/kernels/volk/volk_64u_popcnt.h
new file mode 100644
index 000000000..466cfa5da
--- /dev/null
+++ b/volk/kernels/volk/volk_64u_popcnt.h
@@ -0,0 +1,52 @@
+#ifndef INCLUDED_volk_64u_popcnt_a_H
+#define INCLUDED_volk_64u_popcnt_a_H
+
+#include <stdio.h>
+#include <inttypes.h>
+
+
+#ifdef LV_HAVE_GENERIC
+
+
+static inline void volk_64u_popcnt_generic(uint64_t* ret, const uint64_t value) {
+
+ //const uint32_t* valueVector = (const uint32_t*)&value;
+
+ // This is faster than a lookup table
+ //uint32_t retVal = valueVector[0];
+ uint32_t retVal = (uint32_t)(value & 0x00000000FFFFFFFF);
+
+ retVal = (retVal & 0x55555555) + (retVal >> 1 & 0x55555555);
+ retVal = (retVal & 0x33333333) + (retVal >> 2 & 0x33333333);
+ retVal = (retVal + (retVal >> 4)) & 0x0F0F0F0F;
+ retVal = (retVal + (retVal >> 8));
+ retVal = (retVal + (retVal >> 16)) & 0x0000003F;
+ uint64_t retVal64 = retVal;
+
+ //retVal = valueVector[1];
+ retVal = (uint32_t)((value & 0xFFFFFFFF00000000) >> 31);
+ retVal = (retVal & 0x55555555) + (retVal >> 1 & 0x55555555);
+ retVal = (retVal & 0x33333333) + (retVal >> 2 & 0x33333333);
+ retVal = (retVal + (retVal >> 4)) & 0x0F0F0F0F;
+ retVal = (retVal + (retVal >> 8));
+ retVal = (retVal + (retVal >> 16)) & 0x0000003F;
+ retVal64 += retVal;
+
+ *ret = retVal64;
+
+}
+
+#endif /*LV_HAVE_GENERIC*/
+
+#if LV_HAVE_SSE4_2 && LV_HAVE_64
+
+#include <nmmintrin.h>
+
+static inline void volk_64u_popcnt_a_sse4_2(uint64_t* ret, const uint64_t value) {
+ *ret = _mm_popcnt_u64(value);
+
+}
+
+#endif /*LV_HAVE_SSE4_2*/
+
+#endif /*INCLUDED_volk_64u_popcnt_a_H*/
diff --git a/volk/kernels/volk/volk_8i_convert_16i.h b/volk/kernels/volk/volk_8i_convert_16i.h
new file mode 100644
index 000000000..3e5c92723
--- /dev/null
+++ b/volk/kernels/volk/volk_8i_convert_16i.h
@@ -0,0 +1,156 @@
+#ifndef INCLUDED_volk_8i_convert_16i_u_H
+#define INCLUDED_volk_8i_convert_16i_u_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE4_1
+#include <smmintrin.h>
+
+ /*!
+ \brief Converts the input 8 bit integer data into 16 bit integer data
+ \param inputVector The 8 bit input data buffer
+ \param outputVector The 16 bit output data buffer
+ \param num_points The number of data values to be converted
+ \note Input and output buffers do NOT need to be properly aligned
+ */
+static inline void volk_8i_convert_16i_u_sse4_1(int16_t* outputVector, const int8_t* inputVector, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int sixteenthPoints = num_points / 16;
+
+ const __m128i* inputVectorPtr = (const __m128i*)inputVector;
+ __m128i* outputVectorPtr = (__m128i*)outputVector;
+ __m128i inputVal;
+ __m128i ret;
+
+ for(;number < sixteenthPoints; number++){
+ inputVal = _mm_loadu_si128(inputVectorPtr);
+ ret = _mm_cvtepi8_epi16(inputVal);
+ ret = _mm_slli_epi16(ret, 8); // Multiply by 256
+ _mm_storeu_si128(outputVectorPtr, ret);
+
+ outputVectorPtr++;
+
+ inputVal = _mm_srli_si128(inputVal, 8);
+ ret = _mm_cvtepi8_epi16(inputVal);
+ ret = _mm_slli_epi16(ret, 8); // Multiply by 256
+ _mm_storeu_si128(outputVectorPtr, ret);
+
+ outputVectorPtr++;
+
+ inputVectorPtr++;
+ }
+
+ number = sixteenthPoints * 16;
+ for(; number < num_points; number++){
+ outputVector[number] = (int16_t)(inputVector[number])*256;
+ }
+}
+#endif /* LV_HAVE_SSE4_1 */
+
+#ifdef LV_HAVE_GENERIC
+ /*!
+ \brief Converts the input 8 bit integer data into 16 bit integer data
+ \param inputVector The 8 bit input data buffer
+ \param outputVector The 16 bit output data buffer
+ \param num_points The number of data values to be converted
+ \note Input and output buffers do NOT need to be properly aligned
+ */
+static inline void volk_8i_convert_16i_generic(int16_t* outputVector, const int8_t* inputVector, unsigned int num_points){
+ int16_t* outputVectorPtr = outputVector;
+ const int8_t* inputVectorPtr = inputVector;
+ unsigned int number = 0;
+
+ for(number = 0; number < num_points; number++){
+ *outputVectorPtr++ = ((int16_t)(*inputVectorPtr++)) * 256;
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_VOLK_8s_CONVERT_16s_UNALIGNED8_H */
+#ifndef INCLUDED_volk_8i_convert_16i_a_H
+#define INCLUDED_volk_8i_convert_16i_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE4_1
+#include <smmintrin.h>
+
+ /*!
+ \brief Converts the input 8 bit integer data into 16 bit integer data
+ \param inputVector The 8 bit input data buffer
+ \param outputVector The 16 bit output data buffer
+ \param num_points The number of data values to be converted
+ */
+static inline void volk_8i_convert_16i_a_sse4_1(int16_t* outputVector, const int8_t* inputVector, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int sixteenthPoints = num_points / 16;
+
+ const __m128i* inputVectorPtr = (const __m128i*)inputVector;
+ __m128i* outputVectorPtr = (__m128i*)outputVector;
+ __m128i inputVal;
+ __m128i ret;
+
+ for(;number < sixteenthPoints; number++){
+ inputVal = _mm_load_si128(inputVectorPtr);
+ ret = _mm_cvtepi8_epi16(inputVal);
+ ret = _mm_slli_epi16(ret, 8); // Multiply by 256
+ _mm_store_si128(outputVectorPtr, ret);
+
+ outputVectorPtr++;
+
+ inputVal = _mm_srli_si128(inputVal, 8);
+ ret = _mm_cvtepi8_epi16(inputVal);
+ ret = _mm_slli_epi16(ret, 8); // Multiply by 256
+ _mm_store_si128(outputVectorPtr, ret);
+
+ outputVectorPtr++;
+
+ inputVectorPtr++;
+ }
+
+ number = sixteenthPoints * 16;
+ for(; number < num_points; number++){
+ outputVector[number] = (int16_t)(inputVector[number])*256;
+ }
+}
+#endif /* LV_HAVE_SSE4_1 */
+
+#ifdef LV_HAVE_GENERIC
+ /*!
+ \brief Converts the input 8 bit integer data into 16 bit integer data
+ \param inputVector The 8 bit input data buffer
+ \param outputVector The 16 bit output data buffer
+ \param num_points The number of data values to be converted
+ */
+static inline void volk_8i_convert_16i_a_generic(int16_t* outputVector, const int8_t* inputVector, unsigned int num_points){
+ int16_t* outputVectorPtr = outputVector;
+ const int8_t* inputVectorPtr = inputVector;
+ unsigned int number = 0;
+
+ for(number = 0; number < num_points; number++){
+ *outputVectorPtr++ = ((int16_t)(*inputVectorPtr++)) * 256;
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+#ifdef LV_HAVE_ORC
+ /*!
+ \brief Converts the input 8 bit integer data into 16 bit integer data
+ \param inputVector The 8 bit input data buffer
+ \param outputVector The 16 bit output data buffer
+ \param num_points The number of data values to be converted
+ */
+extern void volk_8i_convert_16i_a_orc_impl(int16_t* outputVector, const int8_t* inputVector, unsigned int num_points);
+static inline void volk_8i_convert_16i_u_orc(int16_t* outputVector, const int8_t* inputVector, unsigned int num_points){
+ volk_8i_convert_16i_a_orc_impl(outputVector, inputVector, num_points);
+}
+#endif /* LV_HAVE_ORC */
+
+
+
+#endif /* INCLUDED_VOLK_8s_CONVERT_16s_ALIGNED8_H */
diff --git a/volk/kernels/volk/volk_8i_s32f_convert_32f.h b/volk/kernels/volk/volk_8i_s32f_convert_32f.h
new file mode 100644
index 000000000..bd7ff82d9
--- /dev/null
+++ b/volk/kernels/volk/volk_8i_s32f_convert_32f.h
@@ -0,0 +1,200 @@
+#ifndef INCLUDED_volk_8i_s32f_convert_32f_u_H
+#define INCLUDED_volk_8i_s32f_convert_32f_u_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE4_1
+#include <smmintrin.h>
+
+ /*!
+ \brief Converts the input 8 bit integer data into floating point data, and divides the each floating point output data point by the scalar value
+ \param inputVector The 8 bit input data buffer
+ \param outputVector The floating point output data buffer
+ \param scalar The value divided against each point in the output buffer
+ \param num_points The number of data values to be converted
+ \note Output buffer does NOT need to be properly aligned
+ */
+static inline void volk_8i_s32f_convert_32f_u_sse4_1(float* outputVector, const int8_t* inputVector, const float scalar, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int sixteenthPoints = num_points / 16;
+
+ float* outputVectorPtr = outputVector;
+ const float iScalar = 1.0 / scalar;
+ __m128 invScalar = _mm_set_ps1( iScalar );
+ const int8_t* inputVectorPtr = inputVector;
+ __m128 ret;
+ __m128i inputVal;
+ __m128i interimVal;
+
+ for(;number < sixteenthPoints; number++){
+ inputVal = _mm_loadu_si128((__m128i*)inputVectorPtr);
+
+ interimVal = _mm_cvtepi8_epi32(inputVal);
+ ret = _mm_cvtepi32_ps(interimVal);
+ ret = _mm_mul_ps(ret, invScalar);
+ _mm_storeu_ps(outputVectorPtr, ret);
+ outputVectorPtr += 4;
+
+ inputVal = _mm_srli_si128(inputVal, 4);
+ interimVal = _mm_cvtepi8_epi32(inputVal);
+ ret = _mm_cvtepi32_ps(interimVal);
+ ret = _mm_mul_ps(ret, invScalar);
+ _mm_storeu_ps(outputVectorPtr, ret);
+ outputVectorPtr += 4;
+
+ inputVal = _mm_srli_si128(inputVal, 4);
+ interimVal = _mm_cvtepi8_epi32(inputVal);
+ ret = _mm_cvtepi32_ps(interimVal);
+ ret = _mm_mul_ps(ret, invScalar);
+ _mm_storeu_ps(outputVectorPtr, ret);
+ outputVectorPtr += 4;
+
+ inputVal = _mm_srli_si128(inputVal, 4);
+ interimVal = _mm_cvtepi8_epi32(inputVal);
+ ret = _mm_cvtepi32_ps(interimVal);
+ ret = _mm_mul_ps(ret, invScalar);
+ _mm_storeu_ps(outputVectorPtr, ret);
+ outputVectorPtr += 4;
+
+ inputVectorPtr += 16;
+ }
+
+ number = sixteenthPoints * 16;
+ for(; number < num_points; number++){
+ outputVector[number] = (float)(inputVector[number]) * iScalar;
+ }
+}
+#endif /* LV_HAVE_SSE4_1 */
+
+#ifdef LV_HAVE_GENERIC
+ /*!
+ \brief Converts the input 8 bit integer data into floating point data, and divides the each floating point output data point by the scalar value
+ \param inputVector The 8 bit input data buffer
+ \param outputVector The floating point output data buffer
+ \param scalar The value divided against each point in the output buffer
+ \param num_points The number of data values to be converted
+ \note Output buffer does NOT need to be properly aligned
+ */
+static inline void volk_8i_s32f_convert_32f_generic(float* outputVector, const int8_t* inputVector, const float scalar, unsigned int num_points){
+ float* outputVectorPtr = outputVector;
+ const int8_t* inputVectorPtr = inputVector;
+ unsigned int number = 0;
+ const float iScalar = 1.0 / scalar;
+
+ for(number = 0; number < num_points; number++){
+ *outputVectorPtr++ = ((float)(*inputVectorPtr++)) * iScalar;
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_VOLK_8s_CONVERT_32f_UNALIGNED8_H */
+#ifndef INCLUDED_volk_8i_s32f_convert_32f_a_H
+#define INCLUDED_volk_8i_s32f_convert_32f_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE4_1
+#include <smmintrin.h>
+
+ /*!
+ \brief Converts the input 8 bit integer data into floating point data, and divides the each floating point output data point by the scalar value
+ \param inputVector The 8 bit input data buffer
+ \param outputVector The floating point output data buffer
+ \param scalar The value divided against each point in the output buffer
+ \param num_points The number of data values to be converted
+ */
+static inline void volk_8i_s32f_convert_32f_a_sse4_1(float* outputVector, const int8_t* inputVector, const float scalar, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int sixteenthPoints = num_points / 16;
+
+ float* outputVectorPtr = outputVector;
+ const float iScalar = 1.0 / scalar;
+ __m128 invScalar = _mm_set_ps1(iScalar);
+ const int8_t* inputVectorPtr = inputVector;
+ __m128 ret;
+ __m128i inputVal;
+ __m128i interimVal;
+
+ for(;number < sixteenthPoints; number++){
+ inputVal = _mm_load_si128((__m128i*)inputVectorPtr);
+
+ interimVal = _mm_cvtepi8_epi32(inputVal);
+ ret = _mm_cvtepi32_ps(interimVal);
+ ret = _mm_mul_ps(ret, invScalar);
+ _mm_store_ps(outputVectorPtr, ret);
+ outputVectorPtr += 4;
+
+ inputVal = _mm_srli_si128(inputVal, 4);
+ interimVal = _mm_cvtepi8_epi32(inputVal);
+ ret = _mm_cvtepi32_ps(interimVal);
+ ret = _mm_mul_ps(ret, invScalar);
+ _mm_store_ps(outputVectorPtr, ret);
+ outputVectorPtr += 4;
+
+ inputVal = _mm_srli_si128(inputVal, 4);
+ interimVal = _mm_cvtepi8_epi32(inputVal);
+ ret = _mm_cvtepi32_ps(interimVal);
+ ret = _mm_mul_ps(ret, invScalar);
+ _mm_store_ps(outputVectorPtr, ret);
+ outputVectorPtr += 4;
+
+ inputVal = _mm_srli_si128(inputVal, 4);
+ interimVal = _mm_cvtepi8_epi32(inputVal);
+ ret = _mm_cvtepi32_ps(interimVal);
+ ret = _mm_mul_ps(ret, invScalar);
+ _mm_store_ps(outputVectorPtr, ret);
+ outputVectorPtr += 4;
+
+ inputVectorPtr += 16;
+ }
+
+ number = sixteenthPoints * 16;
+ for(; number < num_points; number++){
+ outputVector[number] = (float)(inputVector[number]) * iScalar;
+ }
+}
+#endif /* LV_HAVE_SSE4_1 */
+
+#ifdef LV_HAVE_GENERIC
+ /*!
+ \brief Converts the input 8 bit integer data into floating point data, and divides the each floating point output data point by the scalar value
+ \param inputVector The 8 bit input data buffer
+ \param outputVector The floating point output data buffer
+ \param scalar The value divided against each point in the output buffer
+ \param num_points The number of data values to be converted
+ */
+static inline void volk_8i_s32f_convert_32f_a_generic(float* outputVector, const int8_t* inputVector, const float scalar, unsigned int num_points){
+ float* outputVectorPtr = outputVector;
+ const int8_t* inputVectorPtr = inputVector;
+ unsigned int number = 0;
+ const float iScalar = 1.0 / scalar;
+
+ for(number = 0; number < num_points; number++){
+ *outputVectorPtr++ = ((float)(*inputVectorPtr++)) * iScalar;
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+#ifdef LV_HAVE_ORC
+ /*!
+ \brief Converts the input 8 bit integer data into floating point data, and divides the each floating point output data point by the scalar value
+ \param inputVector The 8 bit input data buffer
+ \param outputVector The floating point output data buffer
+ \param scalar The value divided against each point in the output buffer
+ \param num_points The number of data values to be converted
+ */
+extern void volk_8i_s32f_convert_32f_a_orc_impl(float* outputVector, const int8_t* inputVector, const float scalar, unsigned int num_points);
+static inline void volk_8i_s32f_convert_32f_u_orc(float* outputVector, const int8_t* inputVector, const float scalar, unsigned int num_points){
+ float invscalar = 1.0 / scalar;
+ volk_8i_s32f_convert_32f_a_orc_impl(outputVector, inputVector, invscalar, num_points);
+}
+#endif /* LV_HAVE_ORC */
+
+
+
+#endif /* INCLUDED_VOLK_8s_CONVERT_32f_ALIGNED8_H */
diff --git a/volk/kernels/volk/volk_8ic_deinterleave_16i_x2.h b/volk/kernels/volk/volk_8ic_deinterleave_16i_x2.h
new file mode 100644
index 000000000..b59d22d18
--- /dev/null
+++ b/volk/kernels/volk/volk_8ic_deinterleave_16i_x2.h
@@ -0,0 +1,77 @@
+#ifndef INCLUDED_volk_8ic_deinterleave_16i_x2_a_H
+#define INCLUDED_volk_8ic_deinterleave_16i_x2_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE4_1
+#include <smmintrin.h>
+/*!
+ \brief Deinterleaves the complex 8 bit vector into I & Q 16 bit vector data
+ \param complexVector The complex input vector
+ \param iBuffer The I buffer output data
+ \param qBuffer The Q buffer output data
+ \param num_points The number of complex data values to be deinterleaved
+*/
+static inline void volk_8ic_deinterleave_16i_x2_a_sse4_1(int16_t* iBuffer, int16_t* qBuffer, const lv_8sc_t* complexVector, unsigned int num_points){
+ unsigned int number = 0;
+ const int8_t* complexVectorPtr = (int8_t*)complexVector;
+ int16_t* iBufferPtr = iBuffer;
+ int16_t* qBufferPtr = qBuffer;
+ __m128i iMoveMask = _mm_set_epi8(0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 14, 12, 10, 8, 6, 4, 2, 0);
+ __m128i qMoveMask = _mm_set_epi8(0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 15, 13, 11, 9, 7, 5, 3, 1);
+ __m128i complexVal, iOutputVal, qOutputVal;
+
+ unsigned int eighthPoints = num_points / 8;
+
+ for(number = 0; number < eighthPoints; number++){
+ complexVal = _mm_load_si128((__m128i*)complexVectorPtr); complexVectorPtr += 16;
+
+ iOutputVal = _mm_shuffle_epi8(complexVal, iMoveMask);
+ qOutputVal = _mm_shuffle_epi8(complexVal, qMoveMask);
+
+ iOutputVal = _mm_cvtepi8_epi16(iOutputVal);
+ iOutputVal = _mm_slli_epi16(iOutputVal, 8);
+
+ qOutputVal = _mm_cvtepi8_epi16(qOutputVal);
+ qOutputVal = _mm_slli_epi16(qOutputVal, 8);
+
+ _mm_store_si128((__m128i*)iBufferPtr, iOutputVal);
+ _mm_store_si128((__m128i*)qBufferPtr, qOutputVal);
+
+ iBufferPtr += 8;
+ qBufferPtr += 8;
+ }
+
+ number = eighthPoints * 8;
+ for(; number < num_points; number++){
+ *iBufferPtr++ = ((int16_t)*complexVectorPtr++) * 256;
+ *qBufferPtr++ = ((int16_t)*complexVectorPtr++) * 256;
+ }
+}
+#endif /* LV_HAVE_SSE4_1 */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Deinterleaves the complex 8 bit vector into I & Q 16 bit vector data
+ \param complexVector The complex input vector
+ \param iBuffer The I buffer output data
+ \param qBuffer The Q buffer output data
+ \param num_points The number of complex data values to be deinterleaved
+*/
+static inline void volk_8ic_deinterleave_16i_x2_generic(int16_t* iBuffer, int16_t* qBuffer, const lv_8sc_t* complexVector, unsigned int num_points){
+ const int8_t* complexVectorPtr = (const int8_t*)complexVector;
+ int16_t* iBufferPtr = iBuffer;
+ int16_t* qBufferPtr = qBuffer;
+ unsigned int number;
+ for(number = 0; number < num_points; number++){
+ *iBufferPtr++ = (int16_t)(*complexVectorPtr++)*256;
+ *qBufferPtr++ = (int16_t)(*complexVectorPtr++)*256;
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_8ic_deinterleave_16i_x2_a_H */
diff --git a/volk/kernels/volk/volk_8ic_deinterleave_real_16i.h b/volk/kernels/volk/volk_8ic_deinterleave_real_16i.h
new file mode 100644
index 000000000..82cedb2bb
--- /dev/null
+++ b/volk/kernels/volk/volk_8ic_deinterleave_real_16i.h
@@ -0,0 +1,66 @@
+#ifndef INCLUDED_volk_8ic_deinterleave_real_16i_a_H
+#define INCLUDED_volk_8ic_deinterleave_real_16i_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE4_1
+#include <smmintrin.h>
+/*!
+ \brief Deinterleaves the complex 8 bit vector into I 16 bit vector data
+ \param complexVector The complex input vector
+ \param iBuffer The I buffer output data
+ \param num_points The number of complex data values to be deinterleaved
+*/
+static inline void volk_8ic_deinterleave_real_16i_a_sse4_1(int16_t* iBuffer, const lv_8sc_t* complexVector, unsigned int num_points){
+ unsigned int number = 0;
+ const int8_t* complexVectorPtr = (int8_t*)complexVector;
+ int16_t* iBufferPtr = iBuffer;
+ __m128i moveMask = _mm_set_epi8(0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 14, 12, 10, 8, 6, 4, 2, 0);
+ __m128i complexVal, outputVal;
+
+ unsigned int eighthPoints = num_points / 8;
+
+ for(number = 0; number < eighthPoints; number++){
+ complexVal = _mm_load_si128((__m128i*)complexVectorPtr); complexVectorPtr += 16;
+
+ complexVal = _mm_shuffle_epi8(complexVal, moveMask);
+
+ outputVal = _mm_cvtepi8_epi16(complexVal);
+ outputVal = _mm_slli_epi16(outputVal, 7);
+
+ _mm_store_si128((__m128i*)iBufferPtr, outputVal);
+ iBufferPtr += 8;
+ }
+
+ number = eighthPoints * 8;
+ for(; number < num_points; number++){
+ *iBufferPtr++ = ((int16_t)*complexVectorPtr++) * 128;
+ complexVectorPtr++;
+ }
+}
+#endif /* LV_HAVE_SSE4_1 */
+
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Deinterleaves the complex 8 bit vector into I 16 bit vector data
+ \param complexVector The complex input vector
+ \param iBuffer The I buffer output data
+ \param num_points The number of complex data values to be deinterleaved
+*/
+static inline void volk_8ic_deinterleave_real_16i_generic(int16_t* iBuffer, const lv_8sc_t* complexVector, unsigned int num_points){
+ unsigned int number = 0;
+ const int8_t* complexVectorPtr = (const int8_t*)complexVector;
+ int16_t* iBufferPtr = iBuffer;
+ for(number = 0; number < num_points; number++){
+ *iBufferPtr++ = ((int16_t)(*complexVectorPtr++)) * 128;
+ complexVectorPtr++;
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_8ic_deinterleave_real_16i_a_H */
diff --git a/volk/kernels/volk/volk_8ic_deinterleave_real_8i.h b/volk/kernels/volk/volk_8ic_deinterleave_real_8i.h
new file mode 100644
index 000000000..c8ff18e67
--- /dev/null
+++ b/volk/kernels/volk/volk_8ic_deinterleave_real_8i.h
@@ -0,0 +1,67 @@
+#ifndef INCLUDED_VOLK_8sc_DEINTERLEAVE_REAL_8s_ALIGNED8_H
+#define INCLUDED_VOLK_8sc_DEINTERLEAVE_REAL_8s_ALIGNED8_H
+
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSSE3
+#include <tmmintrin.h>
+/*!
+ \brief Deinterleaves the complex 8 bit vector into I vector data
+ \param complexVector The complex input vector
+ \param iBuffer The I buffer output data
+ \param num_points The number of complex data values to be deinterleaved
+*/
+static inline void volk_8ic_deinterleave_real_8i_a_ssse3(int8_t* iBuffer, const lv_8sc_t* complexVector, unsigned int num_points){
+ unsigned int number = 0;
+ const int8_t* complexVectorPtr = (int8_t*)complexVector;
+ int8_t* iBufferPtr = iBuffer;
+ __m128i moveMask1 = _mm_set_epi8(0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 14, 12, 10, 8, 6, 4, 2, 0);
+ __m128i moveMask2 = _mm_set_epi8(14, 12, 10, 8, 6, 4, 2, 0, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80);
+ __m128i complexVal1, complexVal2, outputVal;
+
+ unsigned int sixteenthPoints = num_points / 16;
+
+ for(number = 0; number < sixteenthPoints; number++){
+ complexVal1 = _mm_load_si128((__m128i*)complexVectorPtr); complexVectorPtr += 16;
+ complexVal2 = _mm_load_si128((__m128i*)complexVectorPtr); complexVectorPtr += 16;
+
+ complexVal1 = _mm_shuffle_epi8(complexVal1, moveMask1);
+ complexVal2 = _mm_shuffle_epi8(complexVal2, moveMask2);
+
+ outputVal = _mm_or_si128(complexVal1, complexVal2);
+
+ _mm_store_si128((__m128i*)iBufferPtr, outputVal);
+ iBufferPtr += 16;
+ }
+
+ number = sixteenthPoints * 16;
+ for(; number < num_points; number++){
+ *iBufferPtr++ = *complexVectorPtr++;
+ complexVectorPtr++;
+ }
+}
+#endif /* LV_HAVE_SSSE3 */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Deinterleaves the complex 8 bit vector into I vector data
+ \param complexVector The complex input vector
+ \param iBuffer The I buffer output data
+ \param num_points The number of complex data values to be deinterleaved
+*/
+static inline void volk_8ic_deinterleave_real_8i_generic(int8_t* iBuffer, const lv_8sc_t* complexVector, unsigned int num_points){
+ unsigned int number = 0;
+ const int8_t* complexVectorPtr = (int8_t*)complexVector;
+ int8_t* iBufferPtr = iBuffer;
+ for(number = 0; number < num_points; number++){
+ *iBufferPtr++ = *complexVectorPtr++;
+ complexVectorPtr++;
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_VOLK_8sc_DEINTERLEAVE_REAL_8s_ALIGNED8_H */
diff --git a/volk/kernels/volk/volk_8ic_s32f_deinterleave_32f_x2.h b/volk/kernels/volk/volk_8ic_s32f_deinterleave_32f_x2.h
new file mode 100644
index 000000000..9e244c8fc
--- /dev/null
+++ b/volk/kernels/volk/volk_8ic_s32f_deinterleave_32f_x2.h
@@ -0,0 +1,165 @@
+#ifndef INCLUDED_volk_8ic_s32f_deinterleave_32f_x2_a_H
+#define INCLUDED_volk_8ic_s32f_deinterleave_32f_x2_a_H
+
+#include <volk/volk_common.h>
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE4_1
+#include <smmintrin.h>
+/*!
+ \brief Deinterleaves the complex 8 bit vector into I & Q floating point vector data
+ \param complexVector The complex input vector
+ \param iBuffer The I buffer output data
+ \param qBuffer The Q buffer output data
+ \param scalar The scaling value being multiplied against each data point
+ \param num_points The number of complex data values to be deinterleaved
+*/
+static inline void volk_8ic_s32f_deinterleave_32f_x2_a_sse4_1(float* iBuffer, float* qBuffer, const lv_8sc_t* complexVector, const float scalar, unsigned int num_points){
+ float* iBufferPtr = iBuffer;
+ float* qBufferPtr = qBuffer;
+
+ unsigned int number = 0;
+ const unsigned int eighthPoints = num_points / 8;
+ __m128 iFloatValue, qFloatValue;
+
+ const float iScalar= 1.0 / scalar;
+ __m128 invScalar = _mm_set_ps1(iScalar);
+ __m128i complexVal, iIntVal, qIntVal, iComplexVal, qComplexVal;
+ int8_t* complexVectorPtr = (int8_t*)complexVector;
+
+ __m128i iMoveMask = _mm_set_epi8(0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 14, 12, 10, 8, 6, 4, 2, 0);
+ __m128i qMoveMask = _mm_set_epi8(0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 15, 13, 11, 9, 7, 5, 3, 1);
+
+ for(;number < eighthPoints; number++){
+ complexVal = _mm_load_si128((__m128i*)complexVectorPtr); complexVectorPtr += 16;
+ iComplexVal = _mm_shuffle_epi8(complexVal, iMoveMask);
+ qComplexVal = _mm_shuffle_epi8(complexVal, qMoveMask);
+
+ iIntVal = _mm_cvtepi8_epi32(iComplexVal);
+ iFloatValue = _mm_cvtepi32_ps(iIntVal);
+ iFloatValue = _mm_mul_ps(iFloatValue, invScalar);
+ _mm_store_ps(iBufferPtr, iFloatValue);
+ iBufferPtr += 4;
+
+ iComplexVal = _mm_srli_si128(iComplexVal, 4);
+
+ iIntVal = _mm_cvtepi8_epi32(iComplexVal);
+ iFloatValue = _mm_cvtepi32_ps(iIntVal);
+ iFloatValue = _mm_mul_ps(iFloatValue, invScalar);
+ _mm_store_ps(iBufferPtr, iFloatValue);
+ iBufferPtr += 4;
+
+ qIntVal = _mm_cvtepi8_epi32(qComplexVal);
+ qFloatValue = _mm_cvtepi32_ps(qIntVal);
+ qFloatValue = _mm_mul_ps(qFloatValue, invScalar);
+ _mm_store_ps(qBufferPtr, qFloatValue);
+ qBufferPtr += 4;
+
+ qComplexVal = _mm_srli_si128(qComplexVal, 4);
+
+ qIntVal = _mm_cvtepi8_epi32(qComplexVal);
+ qFloatValue = _mm_cvtepi32_ps(qIntVal);
+ qFloatValue = _mm_mul_ps(qFloatValue, invScalar);
+ _mm_store_ps(qBufferPtr, qFloatValue);
+
+ qBufferPtr += 4;
+ }
+
+ number = eighthPoints * 8;
+ for(; number < num_points; number++){
+ *iBufferPtr++ = (float)(*complexVectorPtr++) * iScalar;
+ *qBufferPtr++ = (float)(*complexVectorPtr++) * iScalar;
+ }
+
+}
+#endif /* LV_HAVE_SSE4_1 */
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+/*!
+ \brief Deinterleaves the complex 8 bit vector into I & Q floating point vector data
+ \param complexVector The complex input vector
+ \param iBuffer The I buffer output data
+ \param qBuffer The Q buffer output data
+ \param scalar The scaling value being multiplied against each data point
+ \param num_points The number of complex data values to be deinterleaved
+*/
+static inline void volk_8ic_s32f_deinterleave_32f_x2_a_sse(float* iBuffer, float* qBuffer, const lv_8sc_t* complexVector, const float scalar, unsigned int num_points){
+ float* iBufferPtr = iBuffer;
+ float* qBufferPtr = qBuffer;
+
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+ __m128 cplxValue1, cplxValue2, iValue, qValue;
+
+ __m128 invScalar = _mm_set_ps1(1.0/scalar);
+ int8_t* complexVectorPtr = (int8_t*)complexVector;
+
+ __VOLK_ATTR_ALIGNED(16) float floatBuffer[8];
+
+ for(;number < quarterPoints; number++){
+ floatBuffer[0] = (float)(complexVectorPtr[0]);
+ floatBuffer[1] = (float)(complexVectorPtr[1]);
+ floatBuffer[2] = (float)(complexVectorPtr[2]);
+ floatBuffer[3] = (float)(complexVectorPtr[3]);
+
+ floatBuffer[4] = (float)(complexVectorPtr[4]);
+ floatBuffer[5] = (float)(complexVectorPtr[5]);
+ floatBuffer[6] = (float)(complexVectorPtr[6]);
+ floatBuffer[7] = (float)(complexVectorPtr[7]);
+
+ cplxValue1 = _mm_load_ps(&floatBuffer[0]);
+ cplxValue2 = _mm_load_ps(&floatBuffer[4]);
+
+ complexVectorPtr += 8;
+
+ cplxValue1 = _mm_mul_ps(cplxValue1, invScalar);
+ cplxValue2 = _mm_mul_ps(cplxValue2, invScalar);
+
+ // Arrange in i1i2i3i4 format
+ iValue = _mm_shuffle_ps(cplxValue1, cplxValue2, _MM_SHUFFLE(2,0,2,0));
+ qValue = _mm_shuffle_ps(cplxValue1, cplxValue2, _MM_SHUFFLE(3,1,3,1));
+
+ _mm_store_ps(iBufferPtr, iValue);
+ _mm_store_ps(qBufferPtr, qValue);
+
+ iBufferPtr += 4;
+ qBufferPtr += 4;
+ }
+
+ number = quarterPoints * 4;
+ complexVectorPtr = (int8_t*)&complexVector[number];
+ for(; number < num_points; number++){
+ *iBufferPtr++ = (float)(*complexVectorPtr++) / scalar;
+ *qBufferPtr++ = (float)(*complexVectorPtr++) / scalar;
+ }
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Deinterleaves the complex 8 bit vector into I & Q floating point vector data
+ \param complexVector The complex input vector
+ \param iBuffer The I buffer output data
+ \param qBuffer The Q buffer output data
+ \param scalar The scaling value being multiplied against each data point
+ \param num_points The number of complex data values to be deinterleaved
+*/
+static inline void volk_8ic_s32f_deinterleave_32f_x2_generic(float* iBuffer, float* qBuffer, const lv_8sc_t* complexVector, const float scalar, unsigned int num_points){
+ const int8_t* complexVectorPtr = (const int8_t*)complexVector;
+ float* iBufferPtr = iBuffer;
+ float* qBufferPtr = qBuffer;
+ unsigned int number;
+ const float invScalar = 1.0 / scalar;
+ for(number = 0; number < num_points; number++){
+ *iBufferPtr++ = (float)(*complexVectorPtr++)*invScalar;
+ *qBufferPtr++ = (float)(*complexVectorPtr++)*invScalar;
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_8ic_s32f_deinterleave_32f_x2_a_H */
diff --git a/volk/kernels/volk/volk_8ic_s32f_deinterleave_real_32f.h b/volk/kernels/volk/volk_8ic_s32f_deinterleave_real_32f.h
new file mode 100644
index 000000000..56a1adcbb
--- /dev/null
+++ b/volk/kernels/volk/volk_8ic_s32f_deinterleave_real_32f.h
@@ -0,0 +1,134 @@
+#ifndef INCLUDED_volk_8ic_s32f_deinterleave_real_32f_a_H
+#define INCLUDED_volk_8ic_s32f_deinterleave_real_32f_a_H
+
+#include <volk/volk_common.h>
+#include <inttypes.h>
+#include <stdio.h>
+
+#ifdef LV_HAVE_SSE4_1
+#include <smmintrin.h>
+/*!
+ \brief Deinterleaves the complex 8 bit vector into I float vector data
+ \param complexVector The complex input vector
+ \param iBuffer The I buffer output data
+ \param scalar The scaling value being multiplied against each data point
+ \param num_points The number of complex data values to be deinterleaved
+*/
+static inline void volk_8ic_s32f_deinterleave_real_32f_a_sse4_1(float* iBuffer, const lv_8sc_t* complexVector, const float scalar, unsigned int num_points){
+ float* iBufferPtr = iBuffer;
+
+ unsigned int number = 0;
+ const unsigned int eighthPoints = num_points / 8;
+ __m128 iFloatValue;
+
+ const float iScalar= 1.0 / scalar;
+ __m128 invScalar = _mm_set_ps1(iScalar);
+ __m128i complexVal, iIntVal;
+ int8_t* complexVectorPtr = (int8_t*)complexVector;
+
+ __m128i moveMask = _mm_set_epi8(0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 14, 12, 10, 8, 6, 4, 2, 0);
+
+ for(;number < eighthPoints; number++){
+ complexVal = _mm_load_si128((__m128i*)complexVectorPtr); complexVectorPtr += 16;
+ complexVal = _mm_shuffle_epi8(complexVal, moveMask);
+
+ iIntVal = _mm_cvtepi8_epi32(complexVal);
+ iFloatValue = _mm_cvtepi32_ps(iIntVal);
+
+ iFloatValue = _mm_mul_ps(iFloatValue, invScalar);
+
+ _mm_store_ps(iBufferPtr, iFloatValue);
+
+ iBufferPtr += 4;
+
+ complexVal = _mm_srli_si128(complexVal, 4);
+ iIntVal = _mm_cvtepi8_epi32(complexVal);
+ iFloatValue = _mm_cvtepi32_ps(iIntVal);
+
+ iFloatValue = _mm_mul_ps(iFloatValue, invScalar);
+
+ _mm_store_ps(iBufferPtr, iFloatValue);
+
+ iBufferPtr += 4;
+ }
+
+ number = eighthPoints * 8;
+ for(; number < num_points; number++){
+ *iBufferPtr++ = (float)(*complexVectorPtr++) * iScalar;
+ complexVectorPtr++;
+ }
+
+}
+#endif /* LV_HAVE_SSE4_1 */
+
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+/*!
+ \brief Deinterleaves the complex 8 bit vector into I float vector data
+ \param complexVector The complex input vector
+ \param iBuffer The I buffer output data
+ \param scalar The scaling value being multiplied against each data point
+ \param num_points The number of complex data values to be deinterleaved
+*/
+static inline void volk_8ic_s32f_deinterleave_real_32f_a_sse(float* iBuffer, const lv_8sc_t* complexVector, const float scalar, unsigned int num_points){
+ float* iBufferPtr = iBuffer;
+
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+ __m128 iValue;
+
+ const float iScalar= 1.0 / scalar;
+ __m128 invScalar = _mm_set_ps1(iScalar);
+ int8_t* complexVectorPtr = (int8_t*)complexVector;
+
+ __VOLK_ATTR_ALIGNED(16) float floatBuffer[4];
+
+ for(;number < quarterPoints; number++){
+ floatBuffer[0] = (float)(*complexVectorPtr); complexVectorPtr += 2;
+ floatBuffer[1] = (float)(*complexVectorPtr); complexVectorPtr += 2;
+ floatBuffer[2] = (float)(*complexVectorPtr); complexVectorPtr += 2;
+ floatBuffer[3] = (float)(*complexVectorPtr); complexVectorPtr += 2;
+
+ iValue = _mm_load_ps(floatBuffer);
+
+ iValue = _mm_mul_ps(iValue, invScalar);
+
+ _mm_store_ps(iBufferPtr, iValue);
+
+ iBufferPtr += 4;
+ }
+
+ number = quarterPoints * 4;
+ for(; number < num_points; number++){
+ *iBufferPtr++ = (float)(*complexVectorPtr++) * iScalar;
+ complexVectorPtr++;
+ }
+
+}
+#endif /* LV_HAVE_SSE */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Deinterleaves the complex 8 bit vector into I float vector data
+ \param complexVector The complex input vector
+ \param iBuffer The I buffer output data
+ \param scalar The scaling value being multiplied against each data point
+ \param num_points The number of complex data values to be deinterleaved
+*/
+static inline void volk_8ic_s32f_deinterleave_real_32f_generic(float* iBuffer, const lv_8sc_t* complexVector, const float scalar, unsigned int num_points){
+ unsigned int number = 0;
+ const int8_t* complexVectorPtr = (const int8_t*)complexVector;
+ float* iBufferPtr = iBuffer;
+ const float invScalar = 1.0 / scalar;
+ for(number = 0; number < num_points; number++){
+ *iBufferPtr++ = ((float)(*complexVectorPtr++)) * invScalar;
+ complexVectorPtr++;
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_8ic_s32f_deinterleave_real_32f_a_H */
diff --git a/volk/kernels/volk/volk_8ic_x2_multiply_conjugate_16ic.h b/volk/kernels/volk/volk_8ic_x2_multiply_conjugate_16ic.h
new file mode 100644
index 000000000..685a21ddc
--- /dev/null
+++ b/volk/kernels/volk/volk_8ic_x2_multiply_conjugate_16ic.h
@@ -0,0 +1,101 @@
+#ifndef INCLUDED_volk_8ic_x2_multiply_conjugate_16ic_a_H
+#define INCLUDED_volk_8ic_x2_multiply_conjugate_16ic_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+#include <volk/volk_complex.h>
+
+#ifdef LV_HAVE_SSE4_1
+#include <smmintrin.h>
+/*!
+ \brief Multiplys the one complex vector with the complex conjugate of the second complex vector and stores their results in the third vector
+ \param cVector The complex vector where the results will be stored
+ \param aVector One of the complex vectors to be multiplied
+ \param bVector The complex vector which will be converted to complex conjugate and multiplied
+ \param num_points The number of complex values in aVector and bVector to be multiplied together and stored into cVector
+*/
+static inline void volk_8ic_x2_multiply_conjugate_16ic_a_sse4_1(lv_16sc_t* cVector, const lv_8sc_t* aVector, const lv_8sc_t* bVector, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+
+ __m128i x, y, realz, imagz;
+ lv_16sc_t* c = cVector;
+ const lv_8sc_t* a = aVector;
+ const lv_8sc_t* b = bVector;
+ __m128i conjugateSign = _mm_set_epi16(-1, 1, -1, 1, -1, 1, -1, 1);
+
+ for(;number < quarterPoints; number++){
+ // Convert into 8 bit values into 16 bit values
+ x = _mm_cvtepi8_epi16(_mm_loadl_epi64((__m128i*)a));
+ y = _mm_cvtepi8_epi16(_mm_loadl_epi64((__m128i*)b));
+
+ // Calculate the ar*cr - ai*(-ci) portions
+ realz = _mm_madd_epi16(x,y);
+
+ // Calculate the complex conjugate of the cr + ci j values
+ y = _mm_sign_epi16(y, conjugateSign);
+
+ // Shift the order of the cr and ci values
+ y = _mm_shufflehi_epi16(_mm_shufflelo_epi16(y, _MM_SHUFFLE(2,3,0,1) ), _MM_SHUFFLE(2,3,0,1));
+
+ // Calculate the ar*(-ci) + cr*(ai)
+ imagz = _mm_madd_epi16(x,y);
+
+ _mm_store_si128((__m128i*)c, _mm_packs_epi32(_mm_unpacklo_epi32(realz, imagz), _mm_unpackhi_epi32(realz, imagz)));
+
+ a += 4;
+ b += 4;
+ c += 4;
+ }
+
+ number = quarterPoints * 4;
+ int16_t* c16Ptr = (int16_t*)&cVector[number];
+ int8_t* a8Ptr = (int8_t*)&aVector[number];
+ int8_t* b8Ptr = (int8_t*)&bVector[number];
+ for(; number < num_points; number++){
+ float aReal = (float)*a8Ptr++;
+ float aImag = (float)*a8Ptr++;
+ lv_32fc_t aVal = lv_cmake(aReal, aImag );
+ float bReal = (float)*b8Ptr++;
+ float bImag = (float)*b8Ptr++;
+ lv_32fc_t bVal = lv_cmake( bReal, -bImag );
+ lv_32fc_t temp = aVal * bVal;
+
+ *c16Ptr++ = (int16_t)lv_creal(temp);
+ *c16Ptr++ = (int16_t)lv_cimag(temp);
+ }
+}
+#endif /* LV_HAVE_SSE4_1 */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Multiplys the one complex vector with the complex conjugate of the second complex vector and stores their results in the third vector
+ \param cVector The complex vector where the results will be stored
+ \param aVector One of the complex vectors to be multiplied
+ \param bVector The complex vector which will be converted to complex conjugate and multiplied
+ \param num_points The number of complex values in aVector and bVector to be multiplied together and stored into cVector
+*/
+static inline void volk_8ic_x2_multiply_conjugate_16ic_generic(lv_16sc_t* cVector, const lv_8sc_t* aVector, const lv_8sc_t* bVector, unsigned int num_points){
+ unsigned int number = 0;
+ int16_t* c16Ptr = (int16_t*)cVector;
+ int8_t* a8Ptr = (int8_t*)aVector;
+ int8_t* b8Ptr = (int8_t*)bVector;
+ for(number =0; number < num_points; number++){
+ float aReal = (float)*a8Ptr++;
+ float aImag = (float)*a8Ptr++;
+ lv_32fc_t aVal = lv_cmake(aReal, aImag );
+ float bReal = (float)*b8Ptr++;
+ float bImag = (float)*b8Ptr++;
+ lv_32fc_t bVal = lv_cmake( bReal, -bImag );
+ lv_32fc_t temp = aVal * bVal;
+
+ *c16Ptr++ = (int16_t)lv_creal(temp);
+ *c16Ptr++ = (int16_t)lv_cimag(temp);
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_8ic_x2_multiply_conjugate_16ic_a_H */
diff --git a/volk/kernels/volk/volk_8ic_x2_s32f_multiply_conjugate_32fc.h b/volk/kernels/volk/volk_8ic_x2_s32f_multiply_conjugate_32fc.h
new file mode 100644
index 000000000..edb52ff50
--- /dev/null
+++ b/volk/kernels/volk/volk_8ic_x2_s32f_multiply_conjugate_32fc.h
@@ -0,0 +1,122 @@
+#ifndef INCLUDED_volk_8ic_x2_s32f_multiply_conjugate_32fc_a_H
+#define INCLUDED_volk_8ic_x2_s32f_multiply_conjugate_32fc_a_H
+
+#include <inttypes.h>
+#include <stdio.h>
+#include <volk/volk_complex.h>
+
+#ifdef LV_HAVE_SSE4_1
+#include <smmintrin.h>
+/*!
+ \brief Multiplys the one complex vector with the complex conjugate of the second complex vector and stores their results in the third vector
+ \param cVector The complex vector where the results will be stored
+ \param aVector One of the complex vectors to be multiplied
+ \param bVector The complex vector which will be converted to complex conjugate and multiplied
+ \param num_points The number of complex values in aVector and bVector to be multiplied together and stored into cVector
+*/
+static inline void volk_8ic_x2_s32f_multiply_conjugate_32fc_a_sse4_1(lv_32fc_t* cVector, const lv_8sc_t* aVector, const lv_8sc_t* bVector, const float scalar, unsigned int num_points){
+ unsigned int number = 0;
+ const unsigned int quarterPoints = num_points / 4;
+
+ __m128i x, y, realz, imagz;
+ __m128 ret;
+ lv_32fc_t* c = cVector;
+ const lv_8sc_t* a = aVector;
+ const lv_8sc_t* b = bVector;
+ __m128i conjugateSign = _mm_set_epi16(-1, 1, -1, 1, -1, 1, -1, 1);
+
+ __m128 invScalar = _mm_set_ps1(1.0/scalar);
+
+ for(;number < quarterPoints; number++){
+ // Convert into 8 bit values into 16 bit values
+ x = _mm_cvtepi8_epi16(_mm_loadl_epi64((__m128i*)a));
+ y = _mm_cvtepi8_epi16(_mm_loadl_epi64((__m128i*)b));
+
+ // Calculate the ar*cr - ai*(-ci) portions
+ realz = _mm_madd_epi16(x,y);
+
+ // Calculate the complex conjugate of the cr + ci j values
+ y = _mm_sign_epi16(y, conjugateSign);
+
+ // Shift the order of the cr and ci values
+ y = _mm_shufflehi_epi16(_mm_shufflelo_epi16(y, _MM_SHUFFLE(2,3,0,1) ), _MM_SHUFFLE(2,3,0,1));
+
+ // Calculate the ar*(-ci) + cr*(ai)
+ imagz = _mm_madd_epi16(x,y);
+
+ // Interleave real and imaginary and then convert to float values
+ ret = _mm_cvtepi32_ps(_mm_unpacklo_epi32(realz, imagz));
+
+ // Normalize the floating point values
+ ret = _mm_mul_ps(ret, invScalar);
+
+ // Store the floating point values
+ _mm_store_ps((float*)c, ret);
+ c += 2;
+
+ // Interleave real and imaginary and then convert to float values
+ ret = _mm_cvtepi32_ps(_mm_unpackhi_epi32(realz, imagz));
+
+ // Normalize the floating point values
+ ret = _mm_mul_ps(ret, invScalar);
+
+ // Store the floating point values
+ _mm_store_ps((float*)c, ret);
+ c += 2;
+
+ a += 4;
+ b += 4;
+ }
+
+ number = quarterPoints * 4;
+ float* cFloatPtr = (float*)&cVector[number];
+ int8_t* a8Ptr = (int8_t*)&aVector[number];
+ int8_t* b8Ptr = (int8_t*)&bVector[number];
+ for(; number < num_points; number++){
+ float aReal = (float)*a8Ptr++;
+ float aImag = (float)*a8Ptr++;
+ lv_32fc_t aVal = lv_cmake(aReal, aImag );
+ float bReal = (float)*b8Ptr++;
+ float bImag = (float)*b8Ptr++;
+ lv_32fc_t bVal = lv_cmake( bReal, -bImag );
+ lv_32fc_t temp = aVal * bVal;
+
+ *cFloatPtr++ = lv_creal(temp) / scalar;
+ *cFloatPtr++ = lv_cimag(temp) / scalar;
+ }
+}
+#endif /* LV_HAVE_SSE4_1 */
+
+#ifdef LV_HAVE_GENERIC
+/*!
+ \brief Multiplys the one complex vector with the complex conjugate of the second complex vector and stores their results in the third vector
+ \param cVector The complex vector where the results will be stored
+ \param aVector One of the complex vectors to be multiplied
+ \param bVector The complex vector which will be converted to complex conjugate and multiplied
+ \param num_points The number of complex values in aVector and bVector to be multiplied together and stored into cVector
+*/
+static inline void volk_8ic_x2_s32f_multiply_conjugate_32fc_generic(lv_32fc_t* cVector, const lv_8sc_t* aVector, const lv_8sc_t* bVector, const float scalar, unsigned int num_points){
+ unsigned int number = 0;
+ float* cPtr = (float*)cVector;
+ const float invScalar = 1.0 / scalar;
+ int8_t* a8Ptr = (int8_t*)aVector;
+ int8_t* b8Ptr = (int8_t*)bVector;
+ for(number = 0; number < num_points; number++){
+ float aReal = (float)*a8Ptr++;
+ float aImag = (float)*a8Ptr++;
+ lv_32fc_t aVal = lv_cmake(aReal, aImag );
+ float bReal = (float)*b8Ptr++;
+ float bImag = (float)*b8Ptr++;
+ lv_32fc_t bVal = lv_cmake( bReal, -bImag );
+ lv_32fc_t temp = aVal * bVal;
+
+ *cPtr++ = (lv_creal(temp) * invScalar);
+ *cPtr++ = (lv_cimag(temp) * invScalar);
+ }
+}
+#endif /* LV_HAVE_GENERIC */
+
+
+
+
+#endif /* INCLUDED_volk_8ic_x2_s32f_multiply_conjugate_32fc_a_H */
diff --git a/volk/lib/CMakeLists.txt b/volk/lib/CMakeLists.txt
new file mode 100644
index 000000000..68fadc35b
--- /dev/null
+++ b/volk/lib/CMakeLists.txt
@@ -0,0 +1,352 @@
+#
+# Copyright 2011-2012 Free Software Foundation, Inc.
+#
+# This program 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 of the License, or
+# (at your option) any later version.
+#
+# This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
+#
+
+########################################################################
+# header file detection
+########################################################################
+include(CheckIncludeFile)
+CHECK_INCLUDE_FILE(cpuid.h HAVE_CPUID_H)
+if(HAVE_CPUID_H)
+ add_definitions(-DHAVE_CPUID_H)
+endif()
+
+CHECK_INCLUDE_FILE(intrin.h HAVE_INTRIN_H)
+if(HAVE_INTRIN_H)
+ add_definitions(-DHAVE_INTRIN_H)
+endif()
+
+CHECK_INCLUDE_FILE(fenv.h HAVE_FENV_H)
+if(HAVE_FENV_H)
+ add_definitions(-DHAVE_FENV_H)
+endif()
+
+CHECK_INCLUDE_FILE(dlfcn.h HAVE_DLFCN_H)
+if(HAVE_DLFCN_H)
+ add_definitions(-DHAVE_DLFCN_H)
+ list(APPEND volk_libraries ${CMAKE_DL_LIBS})
+endif()
+
+########################################################################
+# Setup the compiler name
+########################################################################
+set(COMPILER_NAME ${CMAKE_C_COMPILER_ID})
+if(MSVC) #its not set otherwise
+ set(COMPILER_NAME MSVC)
+endif()
+
+message(STATUS "Compiler name: ${COMPILER_NAME}")
+
+if(NOT DEFINED COMPILER_NAME)
+ message(FATAL_ERROR "COMPILER_NAME undefined. Volk build may not support this compiler.")
+endif()
+
+########################################################################
+# Special clang flag so flag checks can fail
+########################################################################
+if(COMPILER_NAME MATCHES "GNU")
+ include(CheckCXXCompilerFlag)
+ CHECK_CXX_COMPILER_FLAG("-Werror=unused-command-line-argument" HAVE_WERROR_UNUSED_CMD_LINE_ARG)
+ if(HAVE_WERROR_UNUSED_CMD_LINE_ARG)
+ set(VOLK_FLAG_CHECK_FLAGS "-Werror=unused-command-line-argument")
+ endif()
+endif()
+
+########################################################################
+# detect x86 flavor of CPU
+########################################################################
+if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "^(i.86|x86|x86_64|amd64)$")
+ message(STATUS "x86* CPU detected")
+ set(CPU_IS_x86 TRUE)
+endif()
+
+########################################################################
+# determine passing architectures based on compile flag tests
+########################################################################
+execute_process(
+ COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B}
+ ${CMAKE_SOURCE_DIR}/gen/volk_compile_utils.py
+ --mode "arch_flags" --compiler "${COMPILER_NAME}"
+ OUTPUT_VARIABLE arch_flag_lines OUTPUT_STRIP_TRAILING_WHITESPACE
+)
+
+macro(check_arch arch_name)
+ set(flags ${ARGN})
+ set(have_${arch_name} TRUE)
+ foreach(flag ${flags})
+ include(CheckCXXCompilerFlag)
+ set(have_flag have${flag})
+ execute_process( #make the have_flag have nice alphanum chars (just for looks/not necessary)
+ COMMAND ${PYTHON_EXECUTABLE} -c "import re; print(re.sub('\\W', '_', '${have_flag}'))"
+ OUTPUT_VARIABLE have_flag OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+ if(VOLK_FLAG_CHECK_FLAGS)
+ set(CMAKE_REQUIRED_FLAGS ${VOLK_FLAG_CHECK_FLAGS})
+ endif()
+ CHECK_CXX_COMPILER_FLAG(${flag} ${have_flag})
+ unset(CMAKE_REQUIRED_FLAGS)
+ if (NOT ${have_flag})
+ set(have_${arch_name} FALSE)
+ endif()
+ endforeach(flag)
+ if (have_${arch_name})
+ list(APPEND available_archs ${arch_name})
+ endif()
+endmacro(check_arch)
+
+foreach(line ${arch_flag_lines})
+ string(REGEX REPLACE "," ";" arch_flags ${line})
+ check_arch(${arch_flags})
+endforeach(line)
+
+macro(OVERRULE_ARCH arch reason)
+ message(STATUS "${reason}, Overruled arch ${arch}")
+ list(REMOVE_ITEM available_archs ${arch})
+endmacro(OVERRULE_ARCH)
+
+########################################################################
+# eliminate AVX on GCC < 4.4
+# even though it accepts -mavx, as won't assemble xgetbv, which we need
+########################################################################
+if(CPU_IS_x86 AND COMPILER_NAME MATCHES "GNU")
+ execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion
+ OUTPUT_VARIABLE GCC_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
+ if(GCC_VERSION VERSION_LESS "4.4")
+ OVERRULE_ARCH(avx "GCC missing xgetbv")
+ endif()
+endif()
+
+########################################################################
+# implement overruling in the ORC case,
+# since ORC always passes flag detection
+########################################################################
+if(NOT ORC_FOUND)
+ OVERRULE_ARCH(orc "ORC support not found")
+endif()
+
+########################################################################
+# implement overruling in the non-multilib case
+# this makes things work when both -m32 and -m64 pass
+########################################################################
+if(NOT CROSSCOMPILE_MULTILIB AND CPU_IS_x86)
+ include(CheckTypeSize)
+ check_type_size("void*[8]" SIZEOF_CPU BUILTIN_TYPES_ONLY)
+ if (${SIZEOF_CPU} EQUAL 64)
+ OVERRULE_ARCH(32 "CPU width is 64 bits")
+ endif()
+ if (${SIZEOF_CPU} EQUAL 32)
+ OVERRULE_ARCH(64 "CPU width is 32 bits")
+ endif()
+
+ #MSVC 64 bit does not have MMX, overrule it
+ if (${SIZEOF_CPU} EQUAL 64 AND MSVC)
+ OVERRULE_ARCH(mmx "No MMX for Win64")
+ endif()
+
+endif()
+
+########################################################################
+# done overrules! print the result
+########################################################################
+message(STATUS "Available architectures: ${available_archs}")
+
+########################################################################
+# determine available machines given the available architectures
+########################################################################
+execute_process(
+ COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B}
+ ${CMAKE_SOURCE_DIR}/gen/volk_compile_utils.py
+ --mode "machines" --archs "${available_archs}"
+ OUTPUT_VARIABLE available_machines OUTPUT_STRIP_TRAILING_WHITESPACE
+)
+
+########################################################################
+# Implement machine overruling for redundant machines:
+# A machine is redundant when expansion rules occur,
+# and the arch superset passes configuration checks.
+# When this occurs, eliminate the redundant machines
+# to avoid unnecessary compilation of subset machines.
+########################################################################
+foreach(arch mmx orc 64 32)
+ foreach(machine_name ${available_machines})
+ string(REPLACE "_${arch}" "" machine_name_no_arch ${machine_name})
+ if (${machine_name} STREQUAL ${machine_name_no_arch})
+ else()
+ list(REMOVE_ITEM available_machines ${machine_name_no_arch})
+ endif()
+ endforeach(machine_name)
+endforeach(arch)
+
+########################################################################
+# done overrules! print the result
+########################################################################
+message(STATUS "Available machines: ${available_machines}")
+
+########################################################################
+# Create rules to run the volk generator
+########################################################################
+
+#dependencies are all python, xml, and header implementation files
+file(GLOB xml_files ${CMAKE_SOURCE_DIR}/gen/*.xml)
+file(GLOB py_files ${CMAKE_SOURCE_DIR}/gen/*.py)
+file(GLOB h_files ${CMAKE_SOURCE_DIR}/kernels/volk/*.h)
+
+macro(gen_template tmpl output)
+ list(APPEND volk_gen_sources ${output})
+ add_custom_command(
+ OUTPUT ${output}
+ DEPENDS ${xml_files} ${py_files} ${h_files} ${tmpl}
+ COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B}
+ ${CMAKE_SOURCE_DIR}/gen/volk_tmpl_utils.py
+ --input ${tmpl} --output ${output} ${ARGN}
+ )
+endmacro(gen_template)
+
+make_directory(${CMAKE_BINARY_DIR}/include/volk)
+
+gen_template(${CMAKE_SOURCE_DIR}/tmpl/volk.tmpl.h ${CMAKE_BINARY_DIR}/include/volk/volk.h)
+gen_template(${CMAKE_SOURCE_DIR}/tmpl/volk.tmpl.c ${CMAKE_BINARY_DIR}/lib/volk.c)
+gen_template(${CMAKE_SOURCE_DIR}/tmpl/volk_typedefs.tmpl.h ${CMAKE_BINARY_DIR}/include/volk/volk_typedefs.h)
+gen_template(${CMAKE_SOURCE_DIR}/tmpl/volk_cpu.tmpl.h ${CMAKE_BINARY_DIR}/include/volk/volk_cpu.h)
+gen_template(${CMAKE_SOURCE_DIR}/tmpl/volk_cpu.tmpl.c ${CMAKE_BINARY_DIR}/lib/volk_cpu.c)
+gen_template(${CMAKE_SOURCE_DIR}/tmpl/volk_config_fixed.tmpl.h ${CMAKE_BINARY_DIR}/include/volk/volk_config_fixed.h)
+gen_template(${CMAKE_SOURCE_DIR}/tmpl/volk_machines.tmpl.h ${CMAKE_BINARY_DIR}/lib/volk_machines.h)
+gen_template(${CMAKE_SOURCE_DIR}/tmpl/volk_machines.tmpl.c ${CMAKE_BINARY_DIR}/lib/volk_machines.c)
+
+foreach(machine_name ${available_machines})
+ #generate machine source
+ set(machine_source ${CMAKE_CURRENT_BINARY_DIR}/volk_machine_${machine_name}.c)
+ gen_template(${CMAKE_SOURCE_DIR}/tmpl/volk_machine_xxx.tmpl.c ${machine_source} ${machine_name})
+
+ #determine machine flags
+ execute_process(
+ COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B}
+ ${CMAKE_SOURCE_DIR}/gen/volk_compile_utils.py
+ --mode "machine_flags" --machine "${machine_name}" --compiler "${COMPILER_NAME}"
+ OUTPUT_VARIABLE ${machine_name}_flags OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+ if(${machine_name}_flags)
+ set_source_files_properties(${machine_source} PROPERTIES COMPILE_FLAGS "${${machine_name}_flags}")
+ endif()
+
+ #add to available machine defs
+ string(TOUPPER LV_MACHINE_${machine_name} machine_def)
+ list(APPEND machine_defs ${machine_def})
+endforeach(machine_name)
+
+########################################################################
+# Set local include directories first
+########################################################################
+include_directories(
+ ${CMAKE_BINARY_DIR}/include
+ ${CMAKE_SOURCE_DIR}/include
+ ${CMAKE_SOURCE_DIR}/kernels
+ ${CMAKE_CURRENT_BINARY_DIR}
+ ${CMAKE_CURRENT_SOURCE_DIR}
+)
+
+########################################################################
+# Handle orc support
+########################################################################
+if(ORC_FOUND)
+ #setup orc library usage
+ include_directories(${ORC_INCLUDE_DIRS})
+ link_directories(${ORC_LIBRARY_DIRS})
+ list(APPEND volk_libraries ${ORC_LIBRARIES})
+
+ #setup orc functions
+ file(GLOB orc_files ${CMAKE_SOURCE_DIR}/orc/*.orc)
+ foreach(orc_file ${orc_files})
+
+ #extract the name for the generated c source from the orc file
+ get_filename_component(orc_file_name_we ${orc_file} NAME_WE)
+ set(orcc_gen ${CMAKE_CURRENT_BINARY_DIR}/${orc_file_name_we}.c)
+
+ #create a rule to generate the source and add to the list of sources
+ add_custom_command(
+ COMMAND ${ORCC_EXECUTABLE} --include math.h --implementation -o ${orcc_gen} ${orc_file}
+ DEPENDS ${orc_file} OUTPUT ${orcc_gen}
+ )
+ list(APPEND volk_sources ${orcc_gen})
+
+ endforeach(orc_file)
+else()
+ message(STATUS "Did not find liborc and orcc, disabling orc support...")
+endif()
+
+########################################################################
+# Setup the volk sources list and library
+########################################################################
+if(NOT WIN32)
+ add_definitions(-fvisibility=hidden)
+endif()
+
+list(APPEND volk_sources
+ ${CMAKE_CURRENT_SOURCE_DIR}/volk_prefs.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/volk_rank_archs.c
+ ${volk_gen_sources}
+)
+
+#set the machine definitions where applicable
+set_source_files_properties(
+ ${CMAKE_CURRENT_BINARY_DIR}/volk.c
+ ${CMAKE_CURRENT_BINARY_DIR}/volk_machines.c
+PROPERTIES COMPILE_DEFINITIONS "${machine_defs}")
+
+if(MSVC)
+ #add compatibility includes for stdint types
+ include_directories(${CMAKE_SOURCE_DIR}/cmake/msvc)
+ add_definitions(-DHAVE_CONFIG_H)
+ #compile the sources as C++ due to the lack of complex.h under MSVC
+ set_source_files_properties(${volk_sources} PROPERTIES LANGUAGE CXX)
+endif()
+
+#create the volk runtime library
+add_library(volk SHARED ${volk_sources})
+target_link_libraries(volk ${volk_libraries})
+set_target_properties(volk PROPERTIES SOVERSION ${LIBVER})
+set_target_properties(volk PROPERTIES DEFINE_SYMBOL "volk_EXPORTS")
+
+install(TARGETS volk
+ LIBRARY DESTINATION lib${LIB_SUFFIX} COMPONENT "volk_runtime" # .so file
+ ARCHIVE DESTINATION lib${LIB_SUFFIX} COMPONENT "volk_devel" # .lib file
+ RUNTIME DESTINATION bin COMPONENT "volk_runtime" # .dll file
+)
+
+########################################################################
+# Build the QA test application
+########################################################################
+
+
+if(Boost_FOUND)
+
+ set_source_files_properties(
+ ${CMAKE_CURRENT_SOURCE_DIR}/testqa.cc PROPERTIES
+ COMPILE_DEFINITIONS "BOOST_TEST_DYN_LINK;BOOST_TEST_MAIN"
+ )
+
+ include_directories(${Boost_INCLUDE_DIRS})
+ link_directories(${Boost_LIBRARY_DIRS})
+
+ add_executable(test_all
+ ${CMAKE_CURRENT_SOURCE_DIR}/testqa.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/qa_utils.cc
+ )
+ target_link_libraries(test_all volk ${Boost_LIBRARIES})
+ add_test(qa_volk_test_all test_all)
+
+endif(Boost_FOUND)
+
diff --git a/volk/lib/gcc_x86_cpuid.h b/volk/lib/gcc_x86_cpuid.h
new file mode 100644
index 000000000..3c3f47b00
--- /dev/null
+++ b/volk/lib/gcc_x86_cpuid.h
@@ -0,0 +1,188 @@
+/*
+ * Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+ *
+ * This file 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.
+ *
+ * This file 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.
+ *
+ * Under Section 7 of GPL version 3, you are granted additional
+ * permissions described in the GCC Runtime Library Exception, version
+ * 3.1, as published by the Free Software Foundation.
+ *
+ * You should have received a copy of the GNU General Public License and
+ * a copy of the GCC Runtime Library Exception along with this program;
+ * see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+ * <http://www.gnu.org/licenses/>.
+ */
+
+/* %ecx */
+#define bit_SSE3 (1 << 0)
+#define bit_PCLMUL (1 << 1)
+#define bit_SSSE3 (1 << 9)
+#define bit_FMA (1 << 12)
+#define bit_CMPXCHG16B (1 << 13)
+#define bit_SSE4_1 (1 << 19)
+#define bit_SSE4_2 (1 << 20)
+#define bit_MOVBE (1 << 22)
+#define bit_POPCNT (1 << 23)
+#define bit_AES (1 << 25)
+#define bit_XSAVE (1 << 26)
+#define bit_OSXSAVE (1 << 27)
+#define bit_AVX (1 << 28)
+#define bit_F16C (1 << 29)
+#define bit_RDRND (1 << 30)
+
+/* %edx */
+#define bit_CMPXCHG8B (1 << 8)
+#define bit_CMOV (1 << 15)
+#define bit_MMX (1 << 23)
+#define bit_FXSAVE (1 << 24)
+#define bit_SSE (1 << 25)
+#define bit_SSE2 (1 << 26)
+
+/* Extended Features */
+/* %ecx */
+#define bit_LAHF_LM (1 << 0)
+#define bit_ABM (1 << 5)
+#define bit_SSE4a (1 << 6)
+#define bit_XOP (1 << 11)
+#define bit_LWP (1 << 15)
+#define bit_FMA4 (1 << 16)
+#define bit_TBM (1 << 21)
+
+/* %edx */
+#define bit_MMXEXT (1 << 22)
+#define bit_LM (1 << 29)
+#define bit_3DNOWP (1 << 30)
+#define bit_3DNOW (1 << 31)
+
+/* Extended Features (%eax == 7) */
+#define bit_FSGSBASE (1 << 0)
+#define bit_BMI (1 << 3)
+
+#if defined(__i386__) && defined(__PIC__)
+/* %ebx may be the PIC register. */
+#if __GNUC__ >= 3
+#define __cpuid(level, a, b, c, d) \
+ __asm__ ("xchg{l}\t{%%}ebx, %1\n\t" \
+ "cpuid\n\t" \
+ "xchg{l}\t{%%}ebx, %1\n\t" \
+ : "=a" (a), "=r" (b), "=c" (c), "=d" (d) \
+ : "0" (level))
+
+#define __cpuid_count(level, count, a, b, c, d) \
+ __asm__ ("xchg{l}\t{%%}ebx, %1\n\t" \
+ "cpuid\n\t" \
+ "xchg{l}\t{%%}ebx, %1\n\t" \
+ : "=a" (a), "=r" (b), "=c" (c), "=d" (d) \
+ : "0" (level), "2" (count))
+#else
+/* Host GCCs older than 3.0 weren't supporting Intel asm syntax
+ nor alternatives in i386 code. */
+#define __cpuid(level, a, b, c, d) \
+ __asm__ ("xchgl\t%%ebx, %1\n\t" \
+ "cpuid\n\t" \
+ "xchgl\t%%ebx, %1\n\t" \
+ : "=a" (a), "=r" (b), "=c" (c), "=d" (d) \
+ : "0" (level))
+
+#define __cpuid_count(level, count, a, b, c, d) \
+ __asm__ ("xchgl\t%%ebx, %1\n\t" \
+ "cpuid\n\t" \
+ "xchgl\t%%ebx, %1\n\t" \
+ : "=a" (a), "=r" (b), "=c" (c), "=d" (d) \
+ : "0" (level), "2" (count))
+#endif
+#else
+#define __cpuid(level, a, b, c, d) \
+ __asm__ ("cpuid\n\t" \
+ : "=a" (a), "=b" (b), "=c" (c), "=d" (d) \
+ : "0" (level))
+
+#define __cpuid_count(level, count, a, b, c, d) \
+ __asm__ ("cpuid\n\t" \
+ : "=a" (a), "=b" (b), "=c" (c), "=d" (d) \
+ : "0" (level), "2" (count))
+#endif
+
+/* Return highest supported input value for cpuid instruction. ext can
+ be either 0x0 or 0x8000000 to return highest supported value for
+ basic or extended cpuid information. Function returns 0 if cpuid
+ is not supported or whatever cpuid returns in eax register. If sig
+ pointer is non-null, then first four bytes of the signature
+ (as found in ebx register) are returned in location pointed by sig. */
+
+static __inline unsigned int
+__get_cpuid_max (unsigned int __ext, unsigned int *__sig)
+{
+ unsigned int __eax, __ebx, __ecx, __edx;
+
+#ifndef __x86_64__
+ /* See if we can use cpuid. On AMD64 we always can. */
+#if __GNUC__ >= 3
+ __asm__ ("pushf{l|d}\n\t"
+ "pushf{l|d}\n\t"
+ "pop{l}\t%0\n\t"
+ "mov{l}\t{%0, %1|%1, %0}\n\t"
+ "xor{l}\t{%2, %0|%0, %2}\n\t"
+ "push{l}\t%0\n\t"
+ "popf{l|d}\n\t"
+ "pushf{l|d}\n\t"
+ "pop{l}\t%0\n\t"
+ "popf{l|d}\n\t"
+ : "=&r" (__eax), "=&r" (__ebx)
+ : "i" (0x00200000));
+#else
+/* Host GCCs older than 3.0 weren't supporting Intel asm syntax
+ nor alternatives in i386 code. */
+ __asm__ ("pushfl\n\t"
+ "pushfl\n\t"
+ "popl\t%0\n\t"
+ "movl\t%0, %1\n\t"
+ "xorl\t%2, %0\n\t"
+ "pushl\t%0\n\t"
+ "popfl\n\t"
+ "pushfl\n\t"
+ "popl\t%0\n\t"
+ "popfl\n\t"
+ : "=&r" (__eax), "=&r" (__ebx)
+ : "i" (0x00200000));
+#endif
+
+ if (!((__eax ^ __ebx) & 0x00200000))
+ return 0;
+#endif
+
+ /* Host supports cpuid. Return highest supported cpuid input value. */
+ __cpuid (__ext, __eax, __ebx, __ecx, __edx);
+
+ if (__sig)
+ *__sig = __ebx;
+
+ return __eax;
+}
+
+/* Return cpuid data for requested cpuid level, as found in returned
+ eax, ebx, ecx and edx registers. The function checks if cpuid is
+ supported and returns 1 for valid cpuid information or 0 for
+ unsupported cpuid level. All pointers are required to be non-null. */
+
+static __inline int
+__get_cpuid (unsigned int __level,
+ unsigned int *__eax, unsigned int *__ebx,
+ unsigned int *__ecx, unsigned int *__edx)
+{
+ unsigned int __ext = __level & 0x80000000;
+
+ if (__get_cpuid_max (__ext, 0) < __level)
+ return 0;
+
+ __cpuid (__level, *__eax, *__ebx, *__ecx, *__edx);
+ return 1;
+}
diff --git a/volk/lib/qa_16s_add_quad_aligned16.cc b/volk/lib/qa_16s_add_quad_aligned16.cc
new file mode 100644
index 000000000..8da43b972
--- /dev/null
+++ b/volk/lib/qa_16s_add_quad_aligned16.cc
@@ -0,0 +1,89 @@
+#include <volk/volk.h>
+#include <qa_16s_add_quad_aligned16.h>
+#include <volk/volk_16s_add_quad_aligned16.h>
+#include <cstdlib>
+#include <ctime>
+//test for sse2
+
+#ifndef LV_HAVE_SSE2
+
+void qa_16s_add_quad_aligned16::t1() {
+ printf("sse2 not available... no test performed\n");
+}
+
+#else
+
+
+
+void qa_16s_add_quad_aligned16::t1() {
+
+ volk_environment_init();
+ clock_t start, end;
+ double total;
+ const int vlen = 3200;
+ const int ITERS = 100000;
+ __VOLK_ATTR_ALIGNED(16) short input0[vlen];
+ __VOLK_ATTR_ALIGNED(16) short input1[vlen];
+ __VOLK_ATTR_ALIGNED(16) short input2[vlen];
+ __VOLK_ATTR_ALIGNED(16) short input3[vlen];
+ __VOLK_ATTR_ALIGNED(16) short input4[vlen];
+
+ __VOLK_ATTR_ALIGNED(16) short output0[vlen];
+ __VOLK_ATTR_ALIGNED(16) short output1[vlen];
+ __VOLK_ATTR_ALIGNED(16) short output2[vlen];
+ __VOLK_ATTR_ALIGNED(16) short output3[vlen];
+ __VOLK_ATTR_ALIGNED(16) short output01[vlen];
+ __VOLK_ATTR_ALIGNED(16) short output11[vlen];
+ __VOLK_ATTR_ALIGNED(16) short output21[vlen];
+ __VOLK_ATTR_ALIGNED(16) short output31[vlen];
+
+ for(int i = 0; i < vlen; ++i) {
+ short plus0 = ((short) (rand() - (RAND_MAX/2))) >> 2;
+ short minus0 = ((short) (rand() - (RAND_MAX/2))) >> 2;
+ short plus1 = ((short) (rand() - (RAND_MAX/2))) >> 2;
+ short minus1 = ((short) (rand() - (RAND_MAX/2))) >> 2;
+ short plus2 = ((short) (rand() - (RAND_MAX/2))) >> 2;
+ short minus2 = ((short) (rand() - (RAND_MAX/2))) >> 2;
+ short plus3 = ((short) (rand() - (RAND_MAX/2))) >> 2;
+ short minus3 = ((short) (rand() - (RAND_MAX/2))) >> 2;
+ short plus4 = ((short) (rand() - (RAND_MAX/2))) >> 2;
+ short minus4 = ((short) (rand() - (RAND_MAX/2))) >> 2;
+
+ input0[i] = plus0 - minus0;
+ input1[i] = plus1 - minus1;
+ input2[i] = plus2 - minus2;
+ input3[i] = plus3 - minus3;
+ input4[i] = plus4 - minus4;
+
+ }
+ printf("16s_add_quad_aligned\n");
+
+ start = clock();
+ for(int count = 0; count < ITERS; ++count) {
+ volk_16s_add_quad_aligned16_manual(output0, output1, output2, output3, input0, input1, input2, input3, input4, vlen << 1 , "generic");
+ }
+ end = clock();
+ total = (double)(end-start)/(double)CLOCKS_PER_SEC;
+ printf("generic_time: %f\n", total);
+ start = clock();
+ for(int count = 0; count < ITERS; ++count) {
+ volk_16s_add_quad_aligned16_manual(output01, output11, output21, output31, input0, input1, input2, input3, input4, vlen << 1 , "sse2");
+ }
+ end = clock();
+ total = (double)(end-start)/(double)CLOCKS_PER_SEC;
+ printf("sse2_time: %f\n", total);
+ for(int i = 0; i < 1; ++i) {
+ //printf("inputs: %d, %d\n", input0[i*2], input0[i*2 + 1]);
+ //printf("generic... %d, ssse3... %d\n", output0[i], output1[i]);
+ }
+
+ for(int i = 0; i < vlen; ++i) {
+ //printf("%d...%d\n", output0[i], output01[i]);
+ CPPUNIT_ASSERT_EQUAL(output0[i], output01[i]);
+ CPPUNIT_ASSERT_EQUAL(output1[i], output11[i]);
+ CPPUNIT_ASSERT_EQUAL(output2[i], output21[i]);
+ CPPUNIT_ASSERT_EQUAL(output3[i], output31[i]);
+ }
+}
+
+#endif
diff --git a/volk/lib/qa_16s_add_quad_aligned16.h b/volk/lib/qa_16s_add_quad_aligned16.h
new file mode 100644
index 000000000..3c1ae978b
--- /dev/null
+++ b/volk/lib/qa_16s_add_quad_aligned16.h
@@ -0,0 +1,18 @@
+#ifndef INCLUDED_QA_16S_ADD_QUAD_ALIGNED16_H
+#define INCLUDED_QA_16S_ADD_QUAD_ALIGNED16_H
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/TestCase.h>
+
+class qa_16s_add_quad_aligned16 : public CppUnit::TestCase {
+
+ CPPUNIT_TEST_SUITE (qa_16s_add_quad_aligned16);
+ CPPUNIT_TEST (t1);
+ CPPUNIT_TEST_SUITE_END ();
+
+ private:
+ void t1 ();
+};
+
+
+#endif /* INCLUDED_QA_16S_ADD_QUAD_ALIGNED16_H */
diff --git a/volk/lib/qa_16s_branch_4_state_8_aligned16.cc b/volk/lib/qa_16s_branch_4_state_8_aligned16.cc
new file mode 100644
index 000000000..5a58569a1
--- /dev/null
+++ b/volk/lib/qa_16s_branch_4_state_8_aligned16.cc
@@ -0,0 +1,106 @@
+#include <volk/volk.h>
+#include <qa_16s_branch_4_state_8_aligned16.h>
+#include <cstdlib>
+#include <ctime>
+
+//test for ssse3
+
+#ifndef LV_HAVE_SSSE3
+
+void qa_16s_branch_4_state_8_aligned16::t1() {
+ printf("ssse3 not available... no test performed\n");
+}
+
+#else
+
+void qa_16s_branch_4_state_8_aligned16::t1() {
+ const int num_iters = 1000000;
+ const int vlen = 32;
+
+ static char permute0[16]__attribute__((aligned(16))) = {0x0e, 0x0f, 0x0a, 0x0b, 0x04, 0x05, 0x00, 0x01, 0x0c, 0x0d, 0x08, 0x09, 0x06, 0x07, 0x02, 0x03};
+ static char permute1[16]__attribute__((aligned(16))) = {0x0c, 0x0d, 0x08, 0x09, 0x06, 0x07, 0x02, 0x03, 0x0e, 0x0f, 0x0a, 0x0b, 0x04, 0x05, 0x00, 0x01};
+ static char permute2[16]__attribute__((aligned(16))) = {0x02, 0x03, 0x06, 0x07, 0x08, 0x09, 0x0c, 0x0d, 0x00, 0x01, 0x04, 0x05, 0x0a, 0x0b, 0x0e, 0x0f};
+ static char permute3[16]__attribute__((aligned(16))) = {0x00, 0x01, 0x04, 0x05, 0x0a, 0x0b, 0x0e, 0x0f, 0x02, 0x03, 0x06, 0x07, 0x08, 0x09, 0x0c, 0x0d};
+ static char* permuters[4] = {permute0, permute1, permute2, permute3};
+
+ unsigned int num_bytes = vlen << 1;
+
+ volk_environment_init();
+ clock_t start, end;
+ double total;
+
+ __VOLK_ATTR_ALIGNED(16) short target[vlen];
+ __VOLK_ATTR_ALIGNED(16) short target2[vlen];
+ __VOLK_ATTR_ALIGNED(16) short target3[vlen];
+
+ __VOLK_ATTR_ALIGNED(16) short src0[vlen];
+ __VOLK_ATTR_ALIGNED(16) short permute_indexes[vlen] = {
+7, 5, 2, 0, 6, 4, 3, 1, 6, 4, 3, 1, 7, 5, 2, 0, 1, 3, 4, 6, 0, 2, 5, 7, 0, 2, 5, 7, 1, 3, 4, 6 };
+ __VOLK_ATTR_ALIGNED(16) short cntl0[vlen] = {
+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 };
+ __VOLK_ATTR_ALIGNED(16) short cntl1[vlen] = {
+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 };
+ __VOLK_ATTR_ALIGNED(16) short cntl2[vlen] = {
+ 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000 };
+ __VOLK_ATTR_ALIGNED(16) short cntl3[vlen] = {
+ 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff };
+ __VOLK_ATTR_ALIGNED(16) short scalars[4] = {1, 2, 3, 4};
+
+
+
+ for(int i = 0; i < vlen; ++i) {
+ src0[i] = i;
+
+ }
+
+
+ printf("16s_branch_4_state_8_aligned\n");
+
+
+ start = clock();
+ for(int i = 0; i < num_iters; ++i) {
+ volk_16s_permute_and_scalar_add_aligned16_manual(target, src0, permute_indexes, cntl0, cntl1, cntl2, cntl3, scalars, num_bytes, "sse2");
+ }
+ end = clock();
+
+ total = (double)(end-start)/(double)CLOCKS_PER_SEC;
+
+ printf("permute_and_scalar_add_time: %f\n", total);
+
+
+
+ start = clock();
+ for(int i = 0; i < num_iters; ++i) {
+ volk_16s_branch_4_state_8_aligned16_manual(target2, src0, permuters, cntl2, cntl3, scalars, "ssse3");
+ }
+ end = clock();
+
+ total = (double)(end-start)/(double)CLOCKS_PER_SEC;
+
+ printf("branch_4_state_8_time, ssse3: %f\n", total);
+
+ start = clock();
+ for(int i = 0; i < num_iters; ++i) {
+ volk_16s_branch_4_state_8_aligned16_manual(target3, src0, permuters, cntl2, cntl3, scalars, "generic");
+ }
+ end = clock();
+
+ total = (double)(end-start)/(double)CLOCKS_PER_SEC;
+
+ printf("permute_and_scalar_add_time, generic: %f\n", total);
+
+
+
+ for(int i = 0; i < vlen; ++i) {
+ printf("psa... %d, b4s8... %d\n", target[i], target3[i]);
+ }
+
+ for(int i = 0; i < vlen; ++i) {
+
+ CPPUNIT_ASSERT(target[i] == target2[i]);
+ CPPUNIT_ASSERT(target[i] == target3[i]);
+ }
+}
+
+
+#endif
diff --git a/volk/lib/qa_16s_branch_4_state_8_aligned16.h b/volk/lib/qa_16s_branch_4_state_8_aligned16.h
new file mode 100644
index 000000000..41ab073e0
--- /dev/null
+++ b/volk/lib/qa_16s_branch_4_state_8_aligned16.h
@@ -0,0 +1,18 @@
+#ifndef INCLUDED_QA_16S_BRANCH_4_STATE_8_ALIGNED16_H
+#define INCLUDED_QA_16S_BRANCH_4_STATE_8_ALIGNED16_H
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/TestCase.h>
+
+class qa_16s_branch_4_state_8_aligned16 : public CppUnit::TestCase {
+
+ CPPUNIT_TEST_SUITE (qa_16s_branch_4_state_8_aligned16);
+ CPPUNIT_TEST (t1);
+ CPPUNIT_TEST_SUITE_END ();
+
+ private:
+ void t1 ();
+};
+
+
+#endif /* INCLUDED_QA_16S_BRANCH_4_STATE_8_ALIGNED16_H */
diff --git a/volk/lib/qa_16s_permute_and_scalar_add_aligned16.cc b/volk/lib/qa_16s_permute_and_scalar_add_aligned16.cc
new file mode 100644
index 000000000..dadd2c580
--- /dev/null
+++ b/volk/lib/qa_16s_permute_and_scalar_add_aligned16.cc
@@ -0,0 +1,78 @@
+#include <volk/volk.h>
+#include <qa_16s_permute_and_scalar_add_aligned16.h>
+#include <volk/volk_16s_permute_and_scalar_add_aligned16.h>
+#include <cstdlib>
+#include <ctime>
+
+//test for sse2
+
+#ifndef LV_HAVE_SSE2
+
+void qa_16s_permute_and_scalar_add_aligned16::t1() {
+ printf("sse2 not available... no test performed\n");
+}
+
+#else
+
+void qa_16s_permute_and_scalar_add_aligned16::t1() {
+ const int vlen = 64;
+
+ unsigned int num_bytes = vlen << 1;
+
+ volk_environment_init();
+ clock_t start, end;
+ double total;
+
+ __VOLK_ATTR_ALIGNED(16) short target[vlen];
+ __VOLK_ATTR_ALIGNED(16) short target2[vlen];
+ __VOLK_ATTR_ALIGNED(16) short src0[vlen];
+ __VOLK_ATTR_ALIGNED(16) short permute_indexes[vlen];
+ __VOLK_ATTR_ALIGNED(16) short cntl0[vlen];
+ __VOLK_ATTR_ALIGNED(16) short cntl1[vlen];
+ __VOLK_ATTR_ALIGNED(16) short cntl2[vlen];
+ __VOLK_ATTR_ALIGNED(16) short cntl3[vlen];
+ __VOLK_ATTR_ALIGNED(16) short scalars[4] = {1, 2, 3, 4};
+
+ for(int i = 0; i < vlen; ++i) {
+ src0[i] = i;
+ permute_indexes[i] = (3 * i)%vlen;
+ cntl0[i] = 0xff;
+ cntl1[i] = 0xff * (i%2);
+ cntl2[i] = 0xff * ((i>>1)%2);
+ cntl3[i] = 0xff * ((i%4) == 3);
+ }
+
+ printf("16s_permute_and_scalar_add_aligned\n");
+
+ start = clock();
+ for(int i = 0; i < 100000; ++i) {
+ volk_16s_permute_and_scalar_add_aligned16_manual(target, src0, permute_indexes, cntl0, cntl1, cntl2, cntl3, scalars, num_bytes, "generic");
+ }
+ end = clock();
+
+ total = (double)(end-start)/(double)CLOCKS_PER_SEC;
+
+ printf("generic_time: %f\n", total);
+
+ start = clock();
+ for(int i = 0; i < 100000; ++i) {
+ volk_16s_permute_and_scalar_add_aligned16_manual(target2, src0, permute_indexes, cntl0, cntl1, cntl2, cntl3, scalars, num_bytes, "sse2");
+ }
+ end = clock();
+
+ total = (double)(end-start)/(double)CLOCKS_PER_SEC;
+
+ printf("sse2_time: %f\n", total);
+
+
+ for(int i = 0; i < vlen; ++i) {
+ //printf("generic... %d, sse2... %d\n", target[i], target2[i]);
+ }
+
+ for(int i = 0; i < vlen; ++i) {
+
+ CPPUNIT_ASSERT(target[i] == target2[i]);
+ }
+}
+
+#endif
diff --git a/volk/lib/qa_16s_permute_and_scalar_add_aligned16.h b/volk/lib/qa_16s_permute_and_scalar_add_aligned16.h
new file mode 100644
index 000000000..3643aeef6
--- /dev/null
+++ b/volk/lib/qa_16s_permute_and_scalar_add_aligned16.h
@@ -0,0 +1,18 @@
+#ifndef INCLUDED_QA_16S_PERMUTE_AND_SCALAR_ADD_ALIGNED16_H
+#define INCLUDED_QA_16S_PERMUTE_AND_SCALAR_ADD_ALIGNED16_H
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/TestCase.h>
+
+class qa_16s_permute_and_scalar_add_aligned16 : public CppUnit::TestCase {
+
+ CPPUNIT_TEST_SUITE (qa_16s_permute_and_scalar_add_aligned16);
+ CPPUNIT_TEST (t1);
+ CPPUNIT_TEST_SUITE_END ();
+
+ private:
+ void t1 ();
+};
+
+
+#endif /* INCLUDED_QA_16S_PERMUTE_AND_SCALAR_ADD_ALIGNED16_H */
diff --git a/volk/lib/qa_16s_quad_max_star_aligned16.cc b/volk/lib/qa_16s_quad_max_star_aligned16.cc
new file mode 100644
index 000000000..2a5dec44a
--- /dev/null
+++ b/volk/lib/qa_16s_quad_max_star_aligned16.cc
@@ -0,0 +1,60 @@
+#include <volk/volk.h>
+#include <qa_16s_quad_max_star_aligned16.h>
+#include <volk/volk_16s_quad_max_star_aligned16.h>
+#include <cstdlib>
+#include <ctime>
+
+//test for sse2
+
+#ifndef LV_HAVE_SSE2
+
+void qa_16s_quad_max_star_aligned16::t1() {
+ printf("sse2 not available... no test performed\n");
+}
+
+#else
+
+void qa_16s_quad_max_star_aligned16::t1() {
+ const int vlen = 34;
+
+ __VOLK_ATTR_ALIGNED(16) short input0[vlen];
+ __VOLK_ATTR_ALIGNED(16) short input1[vlen];
+ __VOLK_ATTR_ALIGNED(16) short input2[vlen];
+ __VOLK_ATTR_ALIGNED(16) short input3[vlen];
+
+ __VOLK_ATTR_ALIGNED(16) short output0[vlen];
+ __VOLK_ATTR_ALIGNED(16) short output1[vlen];
+
+ for(int i = 0; i < vlen; ++i) {
+ short plus0 = (short) (rand() - (RAND_MAX/2));
+ short plus1 = (short) (rand() - (RAND_MAX/2));
+ short plus2 = (short) (rand() - (RAND_MAX/2));
+ short plus3 = (short) (rand() - (RAND_MAX/2));
+
+ short minus0 = (short) (rand() - (RAND_MAX/2));
+ short minus1 = (short) (rand() - (RAND_MAX/2));
+ short minus2 = (short) (rand() - (RAND_MAX/2));
+ short minus3 = (short) (rand() - (RAND_MAX/2));
+
+ input0[i] = plus0 - minus0;
+ input1[i] = plus1 - minus1;
+ input2[i] = plus2 - minus2;
+ input3[i] = plus3 - minus3;
+ }
+
+ volk_16s_quad_max_star_aligned16_manual(output0, input0, input1, input2, input3, 2*vlen, "generic");
+
+ volk_16s_quad_max_star_aligned16_manual(output1, input0, input1, input2, input3, 2*vlen, "sse2");
+
+ printf("16s_quad_max_star_aligned\n");
+ for(int i = 0; i < vlen; ++i) {
+ printf("generic... %d, sse2... %d, inputs: %d, %d, %d, %d\n", output0[i], output1[i], input0[i], input1[i], input2[i], input3[i]);
+ }
+
+ for(int i = 0; i < vlen; ++i) {
+
+ CPPUNIT_ASSERT_EQUAL(output0[i], output1[i]);
+ }
+}
+
+#endif
diff --git a/volk/lib/qa_16s_quad_max_star_aligned16.h b/volk/lib/qa_16s_quad_max_star_aligned16.h
new file mode 100644
index 000000000..51e77081a
--- /dev/null
+++ b/volk/lib/qa_16s_quad_max_star_aligned16.h
@@ -0,0 +1,18 @@
+#ifndef INCLUDED_QA_16S_QUAD_MAX_STAR_ALIGNED16_H
+#define INCLUDED_QA_16S_QUAD_MAX_STAR_ALIGNED16_H
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/TestCase.h>
+
+class qa_16s_quad_max_star_aligned16 : public CppUnit::TestCase {
+
+ CPPUNIT_TEST_SUITE (qa_16s_quad_max_star_aligned16);
+ CPPUNIT_TEST (t1);
+ CPPUNIT_TEST_SUITE_END ();
+
+ private:
+ void t1 ();
+};
+
+
+#endif /* INCLUDED_QA_16S_QUAD_MAX_STAR_ALIGNED16_H */
diff --git a/volk/lib/qa_32f_fm_detect_aligned16.cc b/volk/lib/qa_32f_fm_detect_aligned16.cc
new file mode 100644
index 000000000..4e792ec6c
--- /dev/null
+++ b/volk/lib/qa_32f_fm_detect_aligned16.cc
@@ -0,0 +1,61 @@
+#include <volk/volk.h>
+#include <qa_32f_fm_detect_aligned16.h>
+#include <volk/volk_32f_fm_detect_aligned16.h>
+#include <cstdlib>
+#include <ctime>
+
+//test for sse
+
+#ifndef LV_HAVE_SSE
+
+void qa_32f_fm_detect_aligned16::t1() {
+ printf("sse not available... no test performed\n");
+}
+
+#else
+
+void qa_32f_fm_detect_aligned16::t1() {
+
+ volk_environment_init();
+ clock_t start, end;
+ double total;
+ const int vlen = 3201;
+ const int ITERS = 10000;
+ __VOLK_ATTR_ALIGNED(16) float input0[vlen];
+
+ __VOLK_ATTR_ALIGNED(16) float output0[vlen];
+ __VOLK_ATTR_ALIGNED(16) float output01[vlen];
+
+ for(int i = 0; i < vlen; ++i) {
+ input0[i] = ((float) (rand() - (RAND_MAX/2))) / static_cast<float>((RAND_MAX/2));
+ }
+ printf("32f_fm_detect_aligned\n");
+
+ start = clock();
+ float save = 0.1;
+ for(int count = 0; count < ITERS; ++count) {
+ volk_32f_fm_detect_aligned16_manual(output0, input0, 1.0, &save, vlen, "generic");
+ }
+ end = clock();
+ total = (double)(end-start)/(double)CLOCKS_PER_SEC;
+ printf("generic_time: %f\n", total);
+ start = clock();
+ save = 0.1;
+ for(int count = 0; count < ITERS; ++count) {
+ volk_32f_fm_detect_aligned16_manual(output01, input0, 1.0, &save, vlen, "sse");
+ }
+ end = clock();
+ total = (double)(end-start)/(double)CLOCKS_PER_SEC;
+ printf("sse_time: %f\n", total);
+ for(int i = 0; i < 1; ++i) {
+ //printf("inputs: %d, %d\n", input0[i*2], input0[i*2 + 1]);
+ //printf("generic... %d, ssse3... %d\n", output0[i], output1[i]);
+ }
+
+ for(int i = 0; i < vlen; ++i) {
+ //printf("%d...%d\n", output0[i], output01[i]);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(output0[i], output01[i], fabs(output0[i]) * 1e-4);
+ }
+}
+
+#endif
diff --git a/volk/lib/qa_32f_fm_detect_aligned16.h b/volk/lib/qa_32f_fm_detect_aligned16.h
new file mode 100644
index 000000000..a2680c524
--- /dev/null
+++ b/volk/lib/qa_32f_fm_detect_aligned16.h
@@ -0,0 +1,18 @@
+#ifndef INCLUDED_QA_32F_FM_DETECT_ALIGNED16_H
+#define INCLUDED_QA_32F_FM_DETECT_ALIGNED16_H
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/TestCase.h>
+
+class qa_32f_fm_detect_aligned16 : public CppUnit::TestCase {
+
+ CPPUNIT_TEST_SUITE (qa_32f_fm_detect_aligned16);
+ CPPUNIT_TEST (t1);
+ CPPUNIT_TEST_SUITE_END ();
+
+ private:
+ void t1 ();
+};
+
+
+#endif /* INCLUDED_QA_32F_FM_DETECT_ALIGNED16_H */
diff --git a/volk/lib/qa_32f_index_max_aligned16.cc b/volk/lib/qa_32f_index_max_aligned16.cc
new file mode 100644
index 000000000..2df206726
--- /dev/null
+++ b/volk/lib/qa_32f_index_max_aligned16.cc
@@ -0,0 +1,103 @@
+#include <volk/volk_runtime.h>
+#include <volk/volk.h>
+#include <qa_32f_index_max_aligned16.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+
+#define ERR_DELTA (1e-4)
+#define NUM_ITERS 1000000
+#define VEC_LEN 3097
+static float uniform() {
+ return 2.0 * ((float) rand() / RAND_MAX - 0.5); // uniformly (-1, 1)
+}
+
+static void
+random_floats (float *buf, unsigned n)
+{
+ unsigned int i = 0;
+ for (; i < n; i++) {
+
+ buf[i] = uniform () * 32767;
+
+ }
+}
+
+
+#ifndef LV_HAVE_SSE
+
+void qa_32f_index_max_aligned16::t1(){
+ printf("sse not available... no test performed\n");
+}
+
+#else
+
+
+void qa_32f_index_max_aligned16::t1(){
+
+ const int vlen = VEC_LEN;
+
+
+ volk_runtime_init();
+
+ volk_environment_init();
+ int ret;
+
+ unsigned int* target_sse4_1;
+ unsigned int* target_sse;
+ unsigned int* target_generic;
+ float* src0 ;
+
+
+ unsigned int i_target_sse4_1;
+ target_sse4_1 = &i_target_sse4_1;
+ unsigned int i_target_sse;
+ target_sse = &i_target_sse;
+ unsigned int i_target_generic;
+ target_generic = &i_target_generic;
+
+ ret = posix_memalign((void**)&src0, 16, vlen *sizeof(float));
+
+ random_floats((float*)src0, vlen);
+
+ printf("32f_index_max_aligned16\n");
+
+ clock_t start, end;
+ double total;
+
+
+ start = clock();
+ for(int k = 0; k < NUM_ITERS; ++k) {
+ volk_32f_index_max_aligned16_manual(target_generic, src0, vlen, "generic");
+ }
+ end = clock();
+ total = (double)(end-start)/(double)CLOCKS_PER_SEC;
+ printf("generic time: %f\n", total);
+
+ start = clock();
+ for(int k = 0; k < NUM_ITERS; ++k) {
+ volk_32f_index_max_aligned16_manual(target_sse, src0, vlen, "sse2");
+ }
+
+ end = clock();
+ total = (double)(end-start)/(double)CLOCKS_PER_SEC;
+ printf("sse time: %f\n", total);
+
+ start = clock();
+ for(int k = 0; k < NUM_ITERS; ++k) {
+ get_volk_runtime()->volk_32f_index_max_aligned16(target_sse4_1, src0, vlen);
+ }
+
+ end = clock();
+ total = (double)(end-start)/(double)CLOCKS_PER_SEC;
+ printf("sse4.1 time: %f\n", total);
+
+
+ printf("generic: %u, sse: %u, sse4.1: %u\n", target_generic[0], target_sse[0], target_sse4_1[0]);
+ CPPUNIT_ASSERT_EQUAL(target_generic[0], target_sse[0]);
+ CPPUNIT_ASSERT_EQUAL(target_generic[0], target_sse4_1[0]);
+
+ free(src0);
+}
+
+#endif /*LV_HAVE_SSE3*/
diff --git a/volk/lib/qa_32f_index_max_aligned16.h b/volk/lib/qa_32f_index_max_aligned16.h
new file mode 100644
index 000000000..8cadffa47
--- /dev/null
+++ b/volk/lib/qa_32f_index_max_aligned16.h
@@ -0,0 +1,18 @@
+#ifndef INCLUDED_QA_32F_INDEX_MAX_ALIGNED16_H
+#define INCLUDED_QA_32F_INDEX_MAX_ALIGNED16_H
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/TestCase.h>
+
+class qa_32f_index_max_aligned16 : public CppUnit::TestCase {
+
+ CPPUNIT_TEST_SUITE (qa_32f_index_max_aligned16);
+ CPPUNIT_TEST (t1);
+ CPPUNIT_TEST_SUITE_END ();
+
+ private:
+ void t1 ();
+};
+
+
+#endif /* INCLUDED_QA_32F_INDEX_MAX_ALIGNED16_H */
diff --git a/volk/lib/qa_32fc_index_max_aligned16.cc b/volk/lib/qa_32fc_index_max_aligned16.cc
new file mode 100644
index 000000000..3859bcb52
--- /dev/null
+++ b/volk/lib/qa_32fc_index_max_aligned16.cc
@@ -0,0 +1,89 @@
+#include <volk/volk.h>
+#include <qa_32fc_index_max_aligned16.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+
+#define ERR_DELTA (1e-4)
+#define NUM_ITERS 1000000
+#define VEC_LEN 3096
+static float uniform() {
+ return 2.0 * ((float) rand() / RAND_MAX - 0.5); // uniformly (-1, 1)
+}
+
+static void
+random_floats (float *buf, unsigned n)
+{
+ unsigned int i = 0;
+ for (; i < n; i++) {
+
+ buf[i] = uniform () * 32767;
+
+ }
+}
+
+
+#ifndef LV_HAVE_SSE3
+
+void qa_32fc_index_max_aligned16::t1(){
+ printf("sse3 not available... no test performed\n");
+}
+
+#else
+
+
+void qa_32fc_index_max_aligned16::t1(){
+
+ const int vlen = VEC_LEN;
+
+ volk_environment_init();
+ int ret;
+
+ unsigned int* target;
+ unsigned int* target_generic;
+ std::complex<float>* src0 ;
+
+
+ unsigned int i_target;
+ target = &i_target;
+ unsigned int i_target_generic;
+ target_generic = &i_target_generic;
+ ret = posix_memalign((void**)&src0, 16, vlen << 3);
+
+ random_floats((float*)src0, vlen * 2);
+
+ printf("32fc_index_max_aligned16\n");
+
+ clock_t start, end;
+ double total;
+
+
+ start = clock();
+ for(int k = 0; k < NUM_ITERS; ++k) {
+ volk_32fc_index_max_aligned16_manual(target_generic, src0, vlen << 3, "generic");
+ }
+ end = clock();
+ total = (double)(end-start)/(double)CLOCKS_PER_SEC;
+ printf("generic time: %f\n", total);
+
+ start = clock();
+ for(int k = 0; k < NUM_ITERS; ++k) {
+ volk_32fc_index_max_aligned16_manual(target, src0, vlen << 3, "sse3");
+ }
+
+ end = clock();
+ total = (double)(end-start)/(double)CLOCKS_PER_SEC;
+ printf("sse3 time: %f\n", total);
+
+
+
+
+ printf("generic: %u, sse3: %u\n", target_generic[0], target[0]);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(target_generic[0], target[0], 1.1);
+
+
+
+ free(src0);
+}
+
+#endif /*LV_HAVE_SSE3*/
diff --git a/volk/lib/qa_32fc_index_max_aligned16.h b/volk/lib/qa_32fc_index_max_aligned16.h
new file mode 100644
index 000000000..0990bcb1f
--- /dev/null
+++ b/volk/lib/qa_32fc_index_max_aligned16.h
@@ -0,0 +1,18 @@
+#ifndef INCLUDED_QA_32FC_INDEX_MAX_ALIGNED16_H
+#define INCLUDED_QA_32FC_INDEX_MAX_ALIGNED16_H
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/TestCase.h>
+
+class qa_32fc_index_max_aligned16 : public CppUnit::TestCase {
+
+ CPPUNIT_TEST_SUITE (qa_32fc_index_max_aligned16);
+ CPPUNIT_TEST (t1);
+ CPPUNIT_TEST_SUITE_END ();
+
+ private:
+ void t1 ();
+};
+
+
+#endif /* INCLUDED_QA_32FC_INDEX_MAX_ALIGNED16_H */
diff --git a/volk/lib/qa_32fc_power_spectral_density_32f_aligned16.cc b/volk/lib/qa_32fc_power_spectral_density_32f_aligned16.cc
new file mode 100644
index 000000000..daca31d9c
--- /dev/null
+++ b/volk/lib/qa_32fc_power_spectral_density_32f_aligned16.cc
@@ -0,0 +1,64 @@
+#include <volk/volk.h>
+#include <qa_32fc_power_spectral_density_32f_aligned16.h>
+#include <volk/volk_32fc_power_spectral_density_32f_aligned16.h>
+#include <cstdlib>
+#include <ctime>
+
+//test for sse3
+
+#ifndef LV_HAVE_SSE3
+
+void qa_32fc_power_spectral_density_32f_aligned16::t1() {
+ printf("sse3 not available... no test performed\n");
+}
+
+#else
+
+void qa_32fc_power_spectral_density_32f_aligned16::t1() {
+
+ volk_environment_init();
+ clock_t start, end;
+ double total;
+ const int vlen = 3201;
+ const int ITERS = 10000;
+ __VOLK_ATTR_ALIGNED(16) std::complex<float> input0[vlen];
+
+ __VOLK_ATTR_ALIGNED(16) float output_generic[vlen];
+ __VOLK_ATTR_ALIGNED(16) float output_sse3[vlen];
+
+ const float scalar = vlen;
+ const float rbw = 1.7;
+
+ float* inputLoad = (float*)input0;
+ for(int i = 0; i < 2*vlen; ++i) {
+ inputLoad[i] = (((float) (rand() - (RAND_MAX/2))) / static_cast<float>((RAND_MAX/2)));
+ }
+ printf("32fc_power_spectral_density_32f_aligned\n");
+
+ start = clock();
+ for(int count = 0; count < ITERS; ++count) {
+ volk_32fc_power_spectral_density_32f_aligned16_manual(output_generic, input0, scalar, rbw, vlen, "generic");
+ }
+ end = clock();
+ total = (double)(end-start)/(double)CLOCKS_PER_SEC;
+ printf("generic_time: %f\n", total);
+ start = clock();
+ for(int count = 0; count < ITERS; ++count) {
+ volk_32fc_power_spectral_density_32f_aligned16_manual(output_sse3, input0, scalar, rbw, vlen, "sse3");
+ }
+ end = clock();
+ total = (double)(end-start)/(double)CLOCKS_PER_SEC;
+ printf("sse3_time: %f\n", total);
+
+ for(int i = 0; i < 1; ++i) {
+ //printf("inputs: %d, %d\n", input0[i*2], input0[i*2 + 1]);
+ //printf("generic... %d, ssse3... %d\n", output0[i], output1[i]);
+ }
+
+ for(int i = 0; i < vlen; ++i) {
+ //printf("%d...%d\n", output0[i], output01[i]);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(output_generic[i], output_sse3[i], fabs(output_generic[i]*1e-4));
+ }
+}
+
+#endif
diff --git a/volk/lib/qa_32fc_power_spectral_density_32f_aligned16.h b/volk/lib/qa_32fc_power_spectral_density_32f_aligned16.h
new file mode 100644
index 000000000..26f430bec
--- /dev/null
+++ b/volk/lib/qa_32fc_power_spectral_density_32f_aligned16.h
@@ -0,0 +1,18 @@
+#ifndef INCLUDED_QA_32FC_POWER_SPECTRAL_DENSITY_32F_ALIGNED16_H
+#define INCLUDED_QA_32FC_POWER_SPECTRAL_DENSITY_32F_ALIGNED16_H
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/TestCase.h>
+
+class qa_32fc_power_spectral_density_32f_aligned16 : public CppUnit::TestCase {
+
+ CPPUNIT_TEST_SUITE (qa_32fc_power_spectral_density_32f_aligned16);
+ CPPUNIT_TEST (t1);
+ CPPUNIT_TEST_SUITE_END ();
+
+ private:
+ void t1 ();
+};
+
+
+#endif /* INCLUDED_QA_32FC_POWER_SPECTRAL_DENSITY_32F_ALIGNED16_H */
diff --git a/volk/lib/qa_32fc_x2_conjugate_dot_prod_32fc_u.cc b/volk/lib/qa_32fc_x2_conjugate_dot_prod_32fc_u.cc
new file mode 100644
index 000000000..b825c20e4
--- /dev/null
+++ b/volk/lib/qa_32fc_x2_conjugate_dot_prod_32fc_u.cc
@@ -0,0 +1,138 @@
+#include <volk/volk.h>
+#include <qa_32fc_x2_conjugate_dot_prod_32fc_u.h>
+#include <stdlib.h>
+#include <math.h>
+#include <time.h>
+
+
+#define assertcomplexEqual(expected, actual, delta) \
+ CPPUNIT_ASSERT_DOUBLES_EQUAL (std::real(expected), std::real(actual), fabs(std::real(expected)) * delta); \
+ CPPUNIT_ASSERT_DOUBLES_EQUAL (std::imag(expected), std::imag(actual), fabs(std::imag(expected))* delta);
+
+#define ERR_DELTA (1e-4)
+
+//test for sse
+
+#if LV_HAVE_SSE && LV_HAVE_64
+
+static float uniform() {
+ return 2.0 * ((float) rand() / RAND_MAX - 0.5); // uniformly (-1, 1)
+}
+
+static void
+random_floats (float *buf, unsigned n)
+{
+ for (unsigned i = 0; i < n; i++)
+ buf[i] = uniform () * 32767;
+}
+
+
+void qa_32fc_x2_conjugate_dot_prod_32fc_u::t1() {
+ const int vlen = 789743;
+
+ volk_environment_init();
+ int ret;
+
+ std::complex<float>* input;
+ std::complex<float>* taps;
+
+ std::complex<float>* result_generic;
+ std::complex<float>* result;
+
+ ret = posix_memalign((void**)&input, 16, vlen << 3);
+ ret = posix_memalign((void**)&taps, 16, vlen << 3);
+ ret = posix_memalign((void**)&result_generic, 16, 8);
+ ret = posix_memalign((void**)&result, 16, 8);
+
+
+ result_generic[0] = std::complex<float>(0,0);
+ result[0] = std::complex<float>(0,0);
+
+ random_floats((float*)input, vlen * 2);
+ random_floats((float*)taps, vlen * 2);
+
+
+
+ volk_32fc_x2_conjugate_dot_prod_32fc_u_manual(result_generic, input, taps, vlen * 8, "generic");
+
+
+ volk_32fc_x2_conjugate_dot_prod_32fc_u_manual(result, input, taps, vlen * 8, "sse");
+
+ printf("32fc_x2_conjugate_dot_prod_32fc_u\n");
+ printf("generic: %f +i%f ... sse: %f +i%f\n", std::real(result_generic[0]), std::imag(result_generic[0]), std::real(result[0]), std::imag(result[0]));
+
+ assertcomplexEqual(result_generic[0], result[0], ERR_DELTA);
+
+ free(input);
+ free(taps);
+ free(result_generic);
+ free(result);
+
+}
+
+
+#elif LV_HAVE_SSE && LV_HAVE_32
+
+static float uniform() {
+ return 2.0 * ((float) rand() / RAND_MAX - 0.5); // uniformly (-1, 1)
+}
+
+static void
+random_floats (float *buf, unsigned n)
+{
+ for (unsigned i = 0; i < n; i++)
+ buf[i] = uniform () * 32767;
+}
+
+
+void qa_32fc_x2_conjugate_dot_prod_32fc_u::t1() {
+ const int vlen = 789743;
+
+ volk_environment_init();
+ int ret;
+
+ std::complex<float>* input;
+ std::complex<float>* taps;
+
+ std::complex<float>* result_generic;
+ std::complex<float>* result;
+
+ ret = posix_memalign((void**)&input, 16, vlen << 3);
+ ret = posix_memalign((void**)&taps, 16, vlen << 3);
+ ret = posix_memalign((void**)&result_generic, 16, 8);
+ ret = posix_memalign((void**)&result, 16, 8);
+
+
+ result_generic[0] = std::complex<float>(0,0);
+ result[0] = std::complex<float>(0,0);
+
+ random_floats((float*)input, vlen * 2);
+ random_floats((float*)taps, vlen * 2);
+
+
+
+ volk_32fc_x2_conjugate_dot_prod_32fc_u_manual(result_generic, input, taps, vlen * 8, "generic");
+
+
+ volk_32fc_x2_conjugate_dot_prod_32fc_u_manual(result, input, taps, vlen * 8, "sse_32");
+
+ printf("32fc_x2_conjugate_dot_prod_32fc_u\n");
+ printf("generic: %f +i%f ... sse: %f +i%f\n", std::real(result_generic[0]), std::imag(result_generic[0]), std::real(result[0]), std::imag(result[0]));
+
+ assertcomplexEqual(result_generic[0], result[0], ERR_DELTA);
+
+ free(input);
+ free(taps);
+ free(result_generic);
+ free(result);
+
+}
+
+
+#else
+
+void qa_32fc_x2_conjugate_dot_prod_32fc_u::t1() {
+ printf("sse not available... no test performed\n");
+}
+
+#endif /*LV_HAVE_SSE*/
diff --git a/volk/lib/qa_32fc_x2_conjugate_dot_prod_32fc_u.h b/volk/lib/qa_32fc_x2_conjugate_dot_prod_32fc_u.h
new file mode 100644
index 000000000..f07402403
--- /dev/null
+++ b/volk/lib/qa_32fc_x2_conjugate_dot_prod_32fc_u.h
@@ -0,0 +1,18 @@
+#ifndef INCLUDED_QA_32FC_X2_CONJUGATE_DOT_PROD_32FC_U_H
+#define INCLUDED_QA_32FC_X2_CONJUGATE_DOT_PROD_32FC_U_H
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/TestCase.h>
+
+class qa_32fc_x2_conjugate_dot_prod_32fc_u : public CppUnit::TestCase {
+
+ CPPUNIT_TEST_SUITE (qa_32fc_x2_conjugate_dot_prod_32fc_u);
+ CPPUNIT_TEST (t1);
+ CPPUNIT_TEST_SUITE_END ();
+
+ private:
+ void t1 ();
+};
+
+
+#endif /* INCLUDED_QA_32FC_X2_CONJUGATE_DOT_PROD_32FC_U_H */
diff --git a/volk/lib/qa_32u_popcnt_aligned16.cc b/volk/lib/qa_32u_popcnt_aligned16.cc
new file mode 100644
index 000000000..5559d933d
--- /dev/null
+++ b/volk/lib/qa_32u_popcnt_aligned16.cc
@@ -0,0 +1,62 @@
+#include <volk/volk_runtime.h>
+#include <volk/volk.h>
+#include <qa_32u_popcnt_aligned16.h>
+#include <volk/volk_32u_popcnt_aligned16.h>
+#include <cstdlib>
+#include <ctime>
+
+//test for sse
+
+#ifndef LV_HAVE_SSE4_2
+
+void qa_32u_popcnt_aligned16::t1() {
+ printf("sse4.2 not available... no test performed\n");
+}
+
+#else
+
+void qa_32u_popcnt_aligned16::t1() {
+
+
+ volk_runtime_init();
+
+ volk_environment_init();
+ clock_t start, end;
+ double total;
+
+ const int ITERS = 10000000;
+ __VOLK_ATTR_ALIGNED(16) uint32_t input0;
+
+ __VOLK_ATTR_ALIGNED(16) uint32_t output0;
+ __VOLK_ATTR_ALIGNED(16) uint32_t output01;
+
+ input0 = ((uint32_t) (rand() - (RAND_MAX/2)));
+ output0 = 0;
+ output01 = 0;
+
+ printf("32u_popcnt_aligned\n");
+
+ start = clock();
+ uint32_t ret = 0;
+ for(int count = 0; count < ITERS; ++count) {
+ volk_32u_popcnt_aligned16_manual(&ret, input0, "generic");
+ output0 += ret;
+ }
+ end = clock();
+ total = (double)(end-start)/(double)CLOCKS_PER_SEC;
+ printf("generic_time: %f\n", total);
+ start = clock();
+ ret = 0;
+ for(int count = 0; count < ITERS; ++count) {
+ get_volk_runtime()->volk_32u_popcnt_aligned16(&ret, input0);
+ output01 += ret;
+ }
+ end = clock();
+ total = (double)(end-start)/(double)CLOCKS_PER_SEC;
+ printf("sse4.2_time: %f\n", total);
+
+
+ CPPUNIT_ASSERT_EQUAL(output0, output01);
+}
+
+#endif
diff --git a/volk/lib/qa_32u_popcnt_aligned16.h b/volk/lib/qa_32u_popcnt_aligned16.h
new file mode 100644
index 000000000..fa1dc1041
--- /dev/null
+++ b/volk/lib/qa_32u_popcnt_aligned16.h
@@ -0,0 +1,18 @@
+#ifndef INCLUDED_QA_32U_POPCNT_ALIGNED16_H
+#define INCLUDED_QA_32U_POPCNT_ALIGNED16_H
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/TestCase.h>
+
+class qa_32u_popcnt_aligned16 : public CppUnit::TestCase {
+
+ CPPUNIT_TEST_SUITE (qa_32u_popcnt_aligned16);
+ CPPUNIT_TEST (t1);
+ CPPUNIT_TEST_SUITE_END ();
+
+ private:
+ void t1 ();
+};
+
+
+#endif /* INCLUDED_QA_32U_POPCNT_ALIGNED16_H */
diff --git a/volk/lib/qa_64u_popcnt_aligned16.cc b/volk/lib/qa_64u_popcnt_aligned16.cc
new file mode 100644
index 000000000..391601f22
--- /dev/null
+++ b/volk/lib/qa_64u_popcnt_aligned16.cc
@@ -0,0 +1,62 @@
+#include <volk/volk_runtime.h>
+#include <volk/volk.h>
+#include <qa_64u_popcnt_aligned16.h>
+#include <volk/volk_64u_popcnt_aligned16.h>
+#include <cstdlib>
+#include <ctime>
+
+//test for sse
+
+#ifndef LV_HAVE_SSE4_2
+
+void qa_64u_popcnt_aligned16::t1() {
+ printf("sse4.2 not available... no test performed\n");
+}
+
+#else
+
+void qa_64u_popcnt_aligned16::t1() {
+
+
+ volk_runtime_init();
+
+ volk_environment_init();
+ clock_t start, end;
+ double total;
+
+ const int ITERS = 10000000;
+ __VOLK_ATTR_ALIGNED(16) uint64_t input0;
+
+ __VOLK_ATTR_ALIGNED(16) uint64_t output0;
+ __VOLK_ATTR_ALIGNED(16) uint64_t output01;
+
+ input0 = ((uint64_t) (rand() - (RAND_MAX/2)));
+ output0 = 0;
+ output01 = 0;
+
+ printf("64u_popcnt_aligned\n");
+
+ start = clock();
+ uint64_t ret = 0;
+ for(int count = 0; count < ITERS; ++count) {
+ volk_64u_popcnt_aligned16_manual(&ret, input0, "generic");
+ output0 += ret;
+ }
+ end = clock();
+ total = (double)(end-start)/(double)CLOCKS_PER_SEC;
+ printf("generic_time: %f\n", total);
+ start = clock();
+ ret = 0;
+ for(int count = 0; count < ITERS; ++count) {
+ get_volk_runtime()->volk_64u_popcnt_aligned16(&ret, input0);
+ output01 += ret;
+ }
+ end = clock();
+ total = (double)(end-start)/(double)CLOCKS_PER_SEC;
+ printf("sse4.2_time: %f\n", total);
+
+
+ CPPUNIT_ASSERT_EQUAL(output0, output01);
+}
+
+#endif
diff --git a/volk/lib/qa_64u_popcnt_aligned16.h b/volk/lib/qa_64u_popcnt_aligned16.h
new file mode 100644
index 000000000..217822d6e
--- /dev/null
+++ b/volk/lib/qa_64u_popcnt_aligned16.h
@@ -0,0 +1,18 @@
+#ifndef INCLUDED_QA_64U_POPCNT_ALIGNED16_H
+#define INCLUDED_QA_64U_POPCNT_ALIGNED16_H
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/TestCase.h>
+
+class qa_64u_popcnt_aligned16 : public CppUnit::TestCase {
+
+ CPPUNIT_TEST_SUITE (qa_64u_popcnt_aligned16);
+ CPPUNIT_TEST (t1);
+ CPPUNIT_TEST_SUITE_END ();
+
+ private:
+ void t1 ();
+};
+
+
+#endif /* INCLUDED_QA_64U_POPCNT_ALIGNED16_H */
diff --git a/volk/lib/qa_utils.cc b/volk/lib/qa_utils.cc
new file mode 100644
index 000000000..e526eb2d0
--- /dev/null
+++ b/volk/lib/qa_utils.cc
@@ -0,0 +1,477 @@
+#include "qa_utils.h"
+#include <cstring>
+#include <boost/foreach.hpp>
+#include <boost/assign/list_of.hpp>
+#include <boost/tokenizer.hpp>
+#include <iostream>
+#include <vector>
+#include <list>
+#include <ctime>
+#include <cmath>
+#include <limits>
+#include <boost/lexical_cast.hpp>
+#include <volk/volk.h>
+#include <volk/volk_cpu.h>
+#include <volk/volk_common.h>
+#include <boost/typeof/typeof.hpp>
+#include <boost/type_traits.hpp>
+#include <stdio.h>
+
+float uniform() {
+ return 2.0 * ((float) rand() / RAND_MAX - 0.5); // uniformly (-1, 1)
+}
+
+template <class t>
+void random_floats (t *buf, unsigned n)
+{
+ for (unsigned i = 0; i < n; i++)
+ buf[i] = uniform ();
+}
+
+void load_random_data(void *data, volk_type_t type, unsigned int n) {
+ if(type.is_complex) n *= 2;
+ if(type.is_float) {
+ if(type.size == 8) random_floats<double>((double *)data, n);
+ else random_floats<float>((float *)data, n);
+ } else {
+ float int_max = float(uint64_t(2) << (type.size*8));
+ if(type.is_signed) int_max /= 2.0;
+ for(unsigned int i=0; i<n; i++) {
+ float scaled_rand = (((float) (rand() - (RAND_MAX/2))) / static_cast<float>((RAND_MAX/2))) * int_max;
+ //man i really don't know how to do this in a more clever way, you have to cast down at some point
+ switch(type.size) {
+ case 8:
+ if(type.is_signed) ((int64_t *)data)[i] = (int64_t) scaled_rand;
+ else ((uint64_t *)data)[i] = (uint64_t) scaled_rand;
+ break;
+ case 4:
+ if(type.is_signed) ((int32_t *)data)[i] = (int32_t) scaled_rand;
+ else ((uint32_t *)data)[i] = (uint32_t) scaled_rand;
+ break;
+ case 2:
+ if(type.is_signed) ((int16_t *)data)[i] = (int16_t) scaled_rand;
+ else ((uint16_t *)data)[i] = (uint16_t) scaled_rand;
+ break;
+ case 1:
+ if(type.is_signed) ((int8_t *)data)[i] = (int8_t) scaled_rand;
+ else ((uint8_t *)data)[i] = (uint8_t) scaled_rand;
+ break;
+ default:
+ throw "load_random_data: no support for data size > 8 or < 1"; //no shenanigans here
+ }
+ }
+ }
+}
+
+static std::vector<std::string> get_arch_list(volk_func_desc_t desc) {
+ std::vector<std::string> archlist;
+
+ for(size_t i = 0; i < desc.n_impls; i++) {
+ //if(!(archs[i+1] & volk_get_lvarch())) continue; //this arch isn't available on this pc
+ archlist.push_back(std::string(desc.impl_names[i]));
+ }
+
+ return archlist;
+}
+
+volk_type_t volk_type_from_string(std::string name) {
+ volk_type_t type;
+ type.is_float = false;
+ type.is_scalar = false;
+ type.is_complex = false;
+ type.is_signed = false;
+ type.size = 0;
+ type.str = name;
+
+ if(name.size() < 2) throw std::string("name too short to be a datatype");
+
+ //is it a scalar?
+ if(name[0] == 's') {
+ type.is_scalar = true;
+ name = name.substr(1, name.size()-1);
+ }
+
+ //get the data size
+ size_t last_size_pos = name.find_last_of("0123456789");
+ if(last_size_pos < 0) throw std::string("no size spec in type ").append(name);
+ //will throw if malformed
+ int size = boost::lexical_cast<int>(name.substr(0, last_size_pos+1));
+
+ assert(((size % 8) == 0) && (size <= 64) && (size != 0));
+ type.size = size/8; //in bytes
+
+ for(size_t i=last_size_pos+1; i < name.size(); i++) {
+ switch (name[i]) {
+ case 'f':
+ type.is_float = true;
+ break;
+ case 'i':
+ type.is_signed = true;
+ break;
+ case 'c':
+ type.is_complex = true;
+ break;
+ case 'u':
+ type.is_signed = false;
+ break;
+ default:
+ throw;
+ }
+ }
+
+ return type;
+}
+
+static void get_signatures_from_name(std::vector<volk_type_t> &inputsig,
+ std::vector<volk_type_t> &outputsig,
+ std::string name) {
+ boost::char_separator<char> sep("_");
+ boost::tokenizer<boost::char_separator<char> > tok(name, sep);
+ std::vector<std::string> toked;
+ tok.assign(name);
+ toked.assign(tok.begin(), tok.end());
+
+ assert(toked[0] == "volk");
+ toked.erase(toked.begin());
+
+ //ok. we're assuming a string in the form
+ //(sig)_(multiplier-opt)_..._(name)_(sig)_(multiplier-opt)_..._(alignment)
+
+ enum { SIDE_INPUT, SIDE_NAME, SIDE_OUTPUT } side = SIDE_INPUT;
+ std::string fn_name;
+ volk_type_t type;
+ BOOST_FOREACH(std::string token, toked) {
+ try {
+ type = volk_type_from_string(token);
+ if(side == SIDE_NAME) side = SIDE_OUTPUT; //if this is the first one after the name...
+
+ if(side == SIDE_INPUT) inputsig.push_back(type);
+ else outputsig.push_back(type);
+ } catch (...){
+ if(token[0] == 'x') { //it's a multiplier
+ if(side == SIDE_INPUT) assert(inputsig.size() > 0);
+ else assert(outputsig.size() > 0);
+ int multiplier = boost::lexical_cast<int>(token.substr(1, token.size()-1)); //will throw if invalid
+ for(int i=1; i<multiplier; i++) {
+ if(side == SIDE_INPUT) inputsig.push_back(inputsig.back());
+ else outputsig.push_back(outputsig.back());
+ }
+ }
+ else if(side == SIDE_INPUT) { //it's the function name, at least it better be
+ side = SIDE_NAME;
+ fn_name.append("_");
+ fn_name.append(token);
+ }
+ else if(side == SIDE_OUTPUT) {
+ if(token != toked.back()) throw; //the last token in the name is the alignment
+ }
+ }
+ }
+ //we don't need an output signature (some fn's operate on the input data, "in place"), but we do need at least one input!
+ assert(inputsig.size() != 0);
+
+}
+
+inline void run_cast_test1(volk_fn_1arg func, std::vector<void *> &buffs, unsigned int vlen, unsigned int iter, std::string arch) {
+ while(iter--) func(buffs[0], vlen, arch.c_str());
+}
+
+inline void run_cast_test2(volk_fn_2arg func, std::vector<void *> &buffs, unsigned int vlen, unsigned int iter, std::string arch) {
+ while(iter--) func(buffs[0], buffs[1], vlen, arch.c_str());
+}
+
+inline void run_cast_test3(volk_fn_3arg func, std::vector<void *> &buffs, unsigned int vlen, unsigned int iter, std::string arch) {
+ while(iter--) func(buffs[0], buffs[1], buffs[2], vlen, arch.c_str());
+}
+
+inline void run_cast_test4(volk_fn_4arg func, std::vector<void *> &buffs, unsigned int vlen, unsigned int iter, std::string arch) {
+ while(iter--) func(buffs[0], buffs[1], buffs[2], buffs[3], vlen, arch.c_str());
+}
+
+inline void run_cast_test1_s32f(volk_fn_1arg_s32f func, std::vector<void *> &buffs, float scalar, unsigned int vlen, unsigned int iter, std::string arch) {
+ while(iter--) func(buffs[0], scalar, vlen, arch.c_str());
+}
+
+inline void run_cast_test2_s32f(volk_fn_2arg_s32f func, std::vector<void *> &buffs, float scalar, unsigned int vlen, unsigned int iter, std::string arch) {
+ while(iter--) func(buffs[0], buffs[1], scalar, vlen, arch.c_str());
+}
+
+inline void run_cast_test3_s32f(volk_fn_3arg_s32f func, std::vector<void *> &buffs, float scalar, unsigned int vlen, unsigned int iter, std::string arch) {
+ while(iter--) func(buffs[0], buffs[1], buffs[2], scalar, vlen, arch.c_str());
+}
+
+inline void run_cast_test1_s32fc(volk_fn_1arg_s32fc func, std::vector<void *> &buffs, lv_32fc_t scalar, unsigned int vlen, unsigned int iter, std::string arch) {
+ while(iter--) func(buffs[0], scalar, vlen, arch.c_str());
+}
+
+inline void run_cast_test2_s32fc(volk_fn_2arg_s32fc func, std::vector<void *> &buffs, lv_32fc_t scalar, unsigned int vlen, unsigned int iter, std::string arch) {
+ while(iter--) func(buffs[0], buffs[1], scalar, vlen, arch.c_str());
+}
+
+inline void run_cast_test3_s32fc(volk_fn_3arg_s32fc func, std::vector<void *> &buffs, lv_32fc_t scalar, unsigned int vlen, unsigned int iter, std::string arch) {
+ while(iter--) func(buffs[0], buffs[1], buffs[2], scalar, vlen, arch.c_str());
+}
+
+template <class t>
+bool fcompare(t *in1, t *in2, unsigned int vlen, float tol) {
+ bool fail = false;
+ int print_max_errs = 10;
+ for(unsigned int i=0; i<vlen; i++) {
+ if(((t *)(in1))[i] < 1e-30) continue; //this is a hack: below around here we'll start to get roundoff errors due to limited precision
+ if(fabs(((t *)(in1))[i] - ((t *)(in2))[i])/(((t *)in1)[i]) > tol) {
+ fail=true;
+ if(print_max_errs-- > 0) {
+ std::cout << "offset " << i << " in1: " << t(((t *)(in1))[i]) << " in2: " << t(((t *)(in2))[i]) << std::endl;
+ }
+ }
+ }
+
+ return fail;
+}
+
+template <class t>
+bool icompare(t *in1, t *in2, unsigned int vlen, unsigned int tol) {
+ bool fail = false;
+ int print_max_errs = 10;
+ for(unsigned int i=0; i<vlen; i++) {
+ if(abs(int(((t *)(in1))[i]) - int(((t *)(in2))[i])) > tol) {
+ fail=true;
+ if(print_max_errs-- > 0) {
+ std::cout << "offset " << i << " in1: " << static_cast<int>(t(((t *)(in1))[i])) << " in2: " << static_cast<int>(t(((t *)(in2))[i])) << std::endl;
+ }
+ }
+ }
+
+ return fail;
+}
+
+class volk_qa_aligned_mem_pool{
+public:
+ void *get_new(size_t size){
+ size_t alignment = volk_get_alignment();
+ _mems.push_back(std::vector<char>(size + alignment-1, 0));
+ size_t ptr = size_t(&_mems.back().front());
+ return (void *)((ptr + alignment-1) & ~(alignment-1));
+ }
+private: std::list<std::vector<char> > _mems;
+};
+
+bool run_volk_tests(volk_func_desc_t desc,
+ void (*manual_func)(),
+ std::string name,
+ float tol,
+ lv_32fc_t scalar,
+ int vlen,
+ int iter,
+ std::vector<std::string> *best_arch_vector = 0,
+ std::string puppet_master_name = "NULL"
+ ) {
+ std::cout << "RUN_VOLK_TESTS: " << name << std::endl;
+
+ //first let's get a list of available architectures for the test
+ std::vector<std::string> arch_list = get_arch_list(desc);
+
+ if(arch_list.size() < 2) {
+ std::cout << "no architectures to test" << std::endl;
+ return false;
+ }
+
+ //something that can hang onto memory and cleanup when this function exits
+ volk_qa_aligned_mem_pool mem_pool;
+
+ //now we have to get a function signature by parsing the name
+ std::vector<volk_type_t> inputsig, outputsig;
+ get_signatures_from_name(inputsig, outputsig, name);
+
+ //pull the input scalars into their own vector
+ std::vector<volk_type_t> inputsc;
+ for(size_t i=0; i<inputsig.size(); i++) {
+ if(inputsig[i].is_scalar) {
+ inputsc.push_back(inputsig[i]);
+ inputsig.erase(inputsig.begin() + i);
+ i -= 1;
+ }
+ }
+ //for(int i=0; i<inputsig.size(); i++) std::cout << "Input: " << inputsig[i].str << std::endl;
+ //for(int i=0; i<outputsig.size(); i++) std::cout << "Output: " << outputsig[i].str << std::endl;
+ std::vector<void *> inbuffs;
+ BOOST_FOREACH(volk_type_t sig, inputsig) {
+ if(!sig.is_scalar) //we don't make buffers for scalars
+ inbuffs.push_back(mem_pool.get_new(vlen*sig.size*(sig.is_complex ? 2 : 1)));
+ }
+ for(size_t i=0; i<inbuffs.size(); i++) {
+ load_random_data(inbuffs[i], inputsig[i], vlen);
+ }
+
+ //ok let's make a vector of vector of void buffers, which holds the input/output vectors for each arch
+ std::vector<std::vector<void *> > test_data;
+ for(size_t i=0; i<arch_list.size(); i++) {
+ std::vector<void *> arch_buffs;
+ for(size_t j=0; j<outputsig.size(); j++) {
+ arch_buffs.push_back(mem_pool.get_new(vlen*outputsig[j].size*(outputsig[j].is_complex ? 2 : 1)));
+ }
+ for(size_t j=0; j<inputsig.size(); j++) {
+ arch_buffs.push_back(inbuffs[j]);
+ }
+ test_data.push_back(arch_buffs);
+ }
+
+ std::vector<volk_type_t> both_sigs;
+ both_sigs.insert(both_sigs.end(), outputsig.begin(), outputsig.end());
+ both_sigs.insert(both_sigs.end(), inputsig.begin(), inputsig.end());
+
+ //now run the test
+ clock_t start, end;
+ std::vector<double> profile_times;
+ for(size_t i = 0; i < arch_list.size(); i++) {
+ start = clock();
+
+ switch(both_sigs.size()) {
+ case 1:
+ if(inputsc.size() == 0) {
+ run_cast_test1((volk_fn_1arg)(manual_func), test_data[i], vlen, iter, arch_list[i]);
+ } else if(inputsc.size() == 1 && inputsc[0].is_float) {
+ if(inputsc[0].is_complex) {
+ run_cast_test1_s32fc((volk_fn_1arg_s32fc)(manual_func), test_data[i], scalar, vlen, iter, arch_list[i]);
+ } else {
+ run_cast_test1_s32f((volk_fn_1arg_s32f)(manual_func), test_data[i], scalar.real(), vlen, iter, arch_list[i]);
+ }
+ } else throw "unsupported 1 arg function >1 scalars";
+ break;
+ case 2:
+ if(inputsc.size() == 0) {
+ run_cast_test2((volk_fn_2arg)(manual_func), test_data[i], vlen, iter, arch_list[i]);
+ } else if(inputsc.size() == 1 && inputsc[0].is_float) {
+ if(inputsc[0].is_complex) {
+ run_cast_test2_s32fc((volk_fn_2arg_s32fc)(manual_func), test_data[i], scalar, vlen, iter, arch_list[i]);
+ } else {
+ run_cast_test2_s32f((volk_fn_2arg_s32f)(manual_func), test_data[i], scalar.real(), vlen, iter, arch_list[i]);
+ }
+ } else throw "unsupported 2 arg function >1 scalars";
+ break;
+ case 3:
+ if(inputsc.size() == 0) {
+ run_cast_test3((volk_fn_3arg)(manual_func), test_data[i], vlen, iter, arch_list[i]);
+ } else if(inputsc.size() == 1 && inputsc[0].is_float) {
+ if(inputsc[0].is_complex) {
+ run_cast_test3_s32fc((volk_fn_3arg_s32fc)(manual_func), test_data[i], scalar, vlen, iter, arch_list[i]);
+ } else {
+ run_cast_test3_s32f((volk_fn_3arg_s32f)(manual_func), test_data[i], scalar.real(), vlen, iter, arch_list[i]);
+ }
+ } else throw "unsupported 3 arg function >1 scalars";
+ break;
+ case 4:
+ run_cast_test4((volk_fn_4arg)(manual_func), test_data[i], vlen, iter, arch_list[i]);
+ break;
+ default:
+ throw "no function handler for this signature";
+ break;
+ }
+
+ end = clock();
+ double arch_time = (double)(end-start)/(double)CLOCKS_PER_SEC;
+ std::cout << arch_list[i] << " completed in " << arch_time << "s" << std::endl;
+
+ profile_times.push_back(arch_time);
+ }
+
+ //and now compare each output to the generic output
+ //first we have to know which output is the generic one, they aren't in order...
+ size_t generic_offset=0;
+ for(size_t i=0; i<arch_list.size(); i++)
+ if(arch_list[i] == "generic") generic_offset=i;
+
+ //now compare
+ //if(outputsig.size() == 0) outputsig = inputsig; //a hack, i know
+
+ bool fail = false;
+ bool fail_global = false;
+ std::vector<bool> arch_results;
+ for(size_t i=0; i<arch_list.size(); i++) {
+ fail = false;
+ if(i != generic_offset) {
+ for(size_t j=0; j<both_sigs.size(); j++) {
+ if(both_sigs[j].is_float) {
+ if(both_sigs[j].size == 8) {
+ fail = fcompare((double *) test_data[generic_offset][j], (double *) test_data[i][j], vlen*(both_sigs[j].is_complex ? 2 : 1), tol);
+ } else {
+ fail = fcompare((float *) test_data[generic_offset][j], (float *) test_data[i][j], vlen*(both_sigs[j].is_complex ? 2 : 1), tol);
+ }
+ } else {
+ //i could replace this whole switch statement with a memcmp if i wasn't interested in printing the outputs where they differ
+ switch(both_sigs[j].size) {
+ case 8:
+ if(both_sigs[j].is_signed) {
+ fail = icompare((int64_t *) test_data[generic_offset][j], (int64_t *) test_data[i][j], vlen*(both_sigs[j].is_complex ? 2 : 1), tol);
+ } else {
+ fail = icompare((uint64_t *) test_data[generic_offset][j], (uint64_t *) test_data[i][j], vlen*(both_sigs[j].is_complex ? 2 : 1), tol);
+ }
+ break;
+ case 4:
+ if(both_sigs[j].is_signed) {
+ fail = icompare((int32_t *) test_data[generic_offset][j], (int32_t *) test_data[i][j], vlen*(both_sigs[j].is_complex ? 2 : 1), tol);
+ } else {
+ fail = icompare((uint32_t *) test_data[generic_offset][j], (uint32_t *) test_data[i][j], vlen*(both_sigs[j].is_complex ? 2 : 1), tol);
+ }
+ break;
+ case 2:
+ if(both_sigs[j].is_signed) {
+ fail = icompare((int16_t *) test_data[generic_offset][j], (int16_t *) test_data[i][j], vlen*(both_sigs[j].is_complex ? 2 : 1), tol);
+ } else {
+ fail = icompare((uint16_t *) test_data[generic_offset][j], (uint16_t *) test_data[i][j], vlen*(both_sigs[j].is_complex ? 2 : 1), tol);
+ }
+ break;
+ case 1:
+ if(both_sigs[j].is_signed) {
+ fail = icompare((int8_t *) test_data[generic_offset][j], (int8_t *) test_data[i][j], vlen*(both_sigs[j].is_complex ? 2 : 1), tol);
+ } else {
+ fail = icompare((uint8_t *) test_data[generic_offset][j], (uint8_t *) test_data[i][j], vlen*(both_sigs[j].is_complex ? 2 : 1), tol);
+ }
+ break;
+ default:
+ fail=1;
+ }
+ }
+ if(fail) {
+ fail_global = true;
+ std::cout << name << ": fail on arch " << arch_list[i] << std::endl;
+ }
+ //fail = memcmp(outbuffs[generic_offset], outbuffs[i], outputsig[0].size * vlen * (outputsig[0].is_complex ? 2:1));
+ }
+ }
+ arch_results.push_back(!fail);
+ }
+
+ double best_time_a = std::numeric_limits<double>::max();
+ double best_time_u = std::numeric_limits<double>::max();
+ std::string best_arch_a = "generic";
+ std::string best_arch_u = "generic";
+ for(size_t i=0; i < arch_list.size(); i++)
+ {
+ if((profile_times[i] < best_time_u) && arch_results[i] && desc.impl_alignment[i] == 0)
+ {
+ best_time_u = profile_times[i];
+ best_arch_u = arch_list[i];
+ }
+ if((profile_times[i] < best_time_a) && arch_results[i])
+ {
+ best_time_a = profile_times[i];
+ best_arch_a = arch_list[i];
+ }
+ }
+
+ std::cout << "Best aligned arch: " << best_arch_a << std::endl;
+ std::cout << "Best unaligned arch: " << best_arch_u << std::endl;
+ if(best_arch_vector) {
+ if(puppet_master_name == "NULL") {
+ best_arch_vector->push_back(name + " " + best_arch_a + " " + best_arch_u);
+ }
+ else {
+ best_arch_vector->push_back(puppet_master_name + " " + best_arch_a + " " + best_arch_u);
+ }
+ }
+
+ return fail_global;
+}
+
+
diff --git a/volk/lib/qa_utils.h b/volk/lib/qa_utils.h
new file mode 100644
index 000000000..0f17cdaa3
--- /dev/null
+++ b/volk/lib/qa_utils.h
@@ -0,0 +1,41 @@
+#ifndef VOLK_QA_UTILS_H
+#define VOLK_QA_UTILS_H
+
+#include <cstdlib>
+#include <string>
+#include <vector>
+#include <volk/volk.h>
+#include <volk/volk_common.h>
+
+struct volk_type_t {
+ bool is_float;
+ bool is_scalar;
+ bool is_signed;
+ bool is_complex;
+ int size;
+ std::string str;
+};
+
+volk_type_t volk_type_from_string(std::string);
+
+float uniform(void);
+void random_floats(float *buf, unsigned n);
+
+bool run_volk_tests(volk_func_desc_t, void(*)(), std::string, float, lv_32fc_t, int, int, std::vector<std::string> *, std::string);
+
+
+#define VOLK_RUN_TESTS(func, tol, scalar, len, iter) BOOST_AUTO_TEST_CASE(func##_test) { BOOST_CHECK_EQUAL(run_volk_tests(func##_get_func_desc(), (void (*)())func##_manual, std::string(#func), tol, scalar, len, iter, 0, "NULL"), 0); }
+#define VOLK_PROFILE(func, tol, scalar, len, iter, results) run_volk_tests(func##_get_func_desc(), (void (*)())func##_manual, std::string(#func), tol, scalar, len, iter, results, "NULL")
+#define VOLK_PUPPET_PROFILE(func, puppet_master_func, tol, scalar, len, iter, results) run_volk_tests(func##_get_func_desc(), (void (*)())func##_manual, std::string(#func), tol, scalar, len, iter, results, std::string(#puppet_master_func))
+typedef void (*volk_fn_1arg)(void *, unsigned int, const char*); //one input, operate in place
+typedef void (*volk_fn_2arg)(void *, void *, unsigned int, const char*);
+typedef void (*volk_fn_3arg)(void *, void *, void *, unsigned int, const char*);
+typedef void (*volk_fn_4arg)(void *, void *, void *, void *, unsigned int, const char*);
+typedef void (*volk_fn_1arg_s32f)(void *, float, unsigned int, const char*); //one input vector, one scalar float input
+typedef void (*volk_fn_2arg_s32f)(void *, void *, float, unsigned int, const char*);
+typedef void (*volk_fn_3arg_s32f)(void *, void *, void *, float, unsigned int, const char*);
+typedef void (*volk_fn_1arg_s32fc)(void *, lv_32fc_t, unsigned int, const char*); //one input vector, one scalar float input
+typedef void (*volk_fn_2arg_s32fc)(void *, void *, lv_32fc_t, unsigned int, const char*);
+typedef void (*volk_fn_3arg_s32fc)(void *, void *, void *, lv_32fc_t, unsigned int, const char*);
+
+#endif //VOLK_QA_UTILS_H
diff --git a/volk/lib/testqa.cc b/volk/lib/testqa.cc
new file mode 100644
index 000000000..f133897cb
--- /dev/null
+++ b/volk/lib/testqa.cc
@@ -0,0 +1,90 @@
+#include "qa_utils.h"
+#include <volk/volk.h>
+#include <boost/test/unit_test.hpp>
+
+//VOLK_RUN_TESTS(volk_16i_x5_add_quad_16i_x4, 1e-4, 2046, 10000);
+//VOLK_RUN_TESTS(volk_16i_branch_4_state_8, 1e-4, 2046, 10000);
+VOLK_RUN_TESTS(volk_16ic_s32f_deinterleave_real_32f, 1e-5, 32768.0, 20460, 1);
+VOLK_RUN_TESTS(volk_16ic_deinterleave_real_8i, 0, 0, 20460, 1);
+VOLK_RUN_TESTS(volk_16ic_deinterleave_16i_x2, 0, 0, 20460, 1);
+VOLK_RUN_TESTS(volk_16ic_s32f_deinterleave_32f_x2, 1e-4, 32768.0, 20460, 1);
+VOLK_RUN_TESTS(volk_16ic_deinterleave_real_16i, 0, 0, 20460, 1);
+VOLK_RUN_TESTS(volk_16ic_magnitude_16i, 1, 0, 20460, 1);
+VOLK_RUN_TESTS(volk_16ic_s32f_magnitude_32f, 1e-5, 32768.0, 20460, 1);
+VOLK_RUN_TESTS(volk_16i_s32f_convert_32f, 1e-4, 32768.0, 20460, 1);
+VOLK_RUN_TESTS(volk_16i_convert_8i, 0, 0, 20460, 1);
+//VOLK_RUN_TESTS(volk_16i_max_star_16i, 0, 0, 20460, 10000);
+//VOLK_RUN_TESTS(volk_16i_max_star_horizontal_16i, 0, 0, 20460, 10000);
+//VOLK_RUN_TESTS(volk_16i_permute_and_scalar_add, 1e-4, 0, 2046, 1000);
+//VOLK_RUN_TESTS(volk_16i_x4_quad_max_star_16i, 1e-4, 0, 2046, 1000);
+VOLK_RUN_TESTS(volk_16u_byteswap, 0, 0, 20460, 1);
+//VOLK_RUN_TESTS(volk_16i_32fc_dot_prod_32fc, 1e-4, 0, 204600, 1);
+VOLK_RUN_TESTS(volk_32f_accumulator_s32f, 1e-4, 0, 20460, 1);
+VOLK_RUN_TESTS(volk_32f_x2_add_32f, 1e-4, 0, 20460, 1);
+VOLK_RUN_TESTS(volk_32fc_32f_multiply_32fc, 1e-4, 0, 20460, 1);
+VOLK_RUN_TESTS(volk_32fc_s32f_power_32fc, 1e-4, 0, 20460, 1);
+VOLK_RUN_TESTS(volk_32f_s32f_calc_spectral_noise_floor_32f, 1e-4, 20.0, 20460, 1);
+VOLK_RUN_TESTS(volk_32fc_s32f_atan2_32f, 1e-4, 10.0, 20460, 1);
+//VOLK_RUN_TESTS(volk_32fc_x2_conjugate_dot_prod_32fc, 1e-4, 0, 2046, 10000);
+VOLK_RUN_TESTS(volk_32fc_x2_conjugate_dot_prod_32fc, 1e-4, 0, 20460, 1);
+VOLK_RUN_TESTS(volk_32fc_deinterleave_32f_x2, 1e-4, 0, 20460, 1);
+VOLK_RUN_TESTS(volk_32fc_deinterleave_64f_x2, 1e-4, 0, 20460, 1);
+VOLK_RUN_TESTS(volk_32fc_s32f_deinterleave_real_16i, 0, 32768, 20460, 1);
+VOLK_RUN_TESTS(volk_32fc_deinterleave_real_32f, 1e-4, 0, 20460, 1);
+VOLK_RUN_TESTS(volk_32fc_deinterleave_imag_32f, 1e-4, 0, 20460, 1);
+VOLK_RUN_TESTS(volk_32fc_deinterleave_real_64f, 1e-4, 0, 20460, 1);
+VOLK_RUN_TESTS(volk_32fc_x2_dot_prod_32fc, 1e-4, 0, 2046000, 1);
+VOLK_RUN_TESTS(volk_32fc_32f_dot_prod_32fc, 1e-4, 0, 204600, 1);
+VOLK_RUN_TESTS(volk_32fc_index_max_16u, 3, 0, 20460, 1);
+VOLK_RUN_TESTS(volk_32fc_s32f_magnitude_16i, 1, 32768, 20460, 1);
+VOLK_RUN_TESTS(volk_32fc_magnitude_32f, 1e-4, 0, 20460, 1);
+VOLK_RUN_TESTS(volk_32f_s32f_convert_16i, 1, 32768, 20460, 1);
+VOLK_RUN_TESTS(volk_32f_s32f_convert_32i, 1, 2<<31, 20460, 1);
+VOLK_RUN_TESTS(volk_32f_convert_64f, 1e-4, 0, 20460, 1);
+VOLK_RUN_TESTS(volk_32f_s32f_convert_8i, 1, 128, 20460, 1);
+//VOLK_RUN_TESTS(volk_32fc_s32f_x2_power_spectral_density_32f, 1e-4, 2046, 10000);
+VOLK_RUN_TESTS(volk_32fc_s32f_power_spectrum_32f, 1e-4, 0, 2046, 1);
+VOLK_RUN_TESTS(volk_32fc_x2_square_dist_32f, 1e-4, 0, 20460, 1);
+VOLK_RUN_TESTS(volk_32fc_x2_s32f_square_dist_scalar_mult_32f, 1e-4, 10, 20460, 1);
+VOLK_RUN_TESTS(volk_32f_x2_divide_32f, 1e-4, 0, 20460, 1);
+VOLK_RUN_TESTS(volk_32f_x2_dot_prod_32f, 1e-4, 0, 204600, 1);
+VOLK_RUN_TESTS(volk_32f_x2_dot_prod_16i, 1e-4, 0, 204600, 1);
+//VOLK_RUN_TESTS(volk_32f_s32f_32f_fm_detect_32f, 1e-4, 2046, 10000);
+VOLK_RUN_TESTS(volk_32f_index_max_16u, 3, 0, 20460, 1);
+VOLK_RUN_TESTS(volk_32f_x2_s32f_interleave_16ic, 1, 32767, 20460, 1);
+VOLK_RUN_TESTS(volk_32f_x2_interleave_32fc, 0, 0, 20460, 1);
+VOLK_RUN_TESTS(volk_32f_x2_max_32f, 1e-4, 0, 20460, 1);
+VOLK_RUN_TESTS(volk_32f_x2_min_32f, 1e-4, 0, 20460, 1);
+VOLK_RUN_TESTS(volk_32f_s32f_normalize, 1e-4, 100, 20460, 1);
+VOLK_RUN_TESTS(volk_32f_s32f_power_32f, 1e-4, 4, 20460, 1);
+VOLK_RUN_TESTS(volk_32f_sqrt_32f, 1e-4, 0, 20460, 1);
+VOLK_RUN_TESTS(volk_32f_s32f_stddev_32f, 1e-4, 100, 20460, 1);
+VOLK_RUN_TESTS(volk_32f_stddev_and_mean_32f_x2, 1e-4, 0, 20460, 1);
+VOLK_RUN_TESTS(volk_32f_x2_subtract_32f, 1e-4, 0, 20460, 1);
+VOLK_RUN_TESTS(volk_32f_x3_sum_of_poly_32f, 1e-4, 0, 20460, 1);
+VOLK_RUN_TESTS(volk_32i_x2_and_32i, 0, 0, 20460, 1);
+VOLK_RUN_TESTS(volk_32i_s32f_convert_32f, 1e-4, 100, 20460, 1);
+VOLK_RUN_TESTS(volk_32i_x2_or_32i, 0, 0, 20460, 1);
+VOLK_RUN_TESTS(volk_32u_byteswap, 0, 0, 20460, 1);
+//VOLK_RUN_TESTS(volk_32u_popcnt, 0, 0, 2046, 10000);
+VOLK_RUN_TESTS(volk_64f_convert_32f, 1e-4, 0, 20460, 1);
+VOLK_RUN_TESTS(volk_64f_x2_max_64f, 1e-4, 0, 20460, 1);
+VOLK_RUN_TESTS(volk_64f_x2_min_64f, 1e-4, 0, 20460, 1);
+VOLK_RUN_TESTS(volk_64u_byteswap, 0, 0, 20460, 1);
+//VOLK_RUN_TESTS(volk_64u_popcnt, 0, 0, 2046, 10000);
+VOLK_RUN_TESTS(volk_8ic_deinterleave_16i_x2, 0, 0, 20460, 1);
+VOLK_RUN_TESTS(volk_8ic_s32f_deinterleave_32f_x2, 1e-4, 100, 20460, 1);
+VOLK_RUN_TESTS(volk_8ic_deinterleave_real_16i, 0, 256, 20460, 1);
+VOLK_RUN_TESTS(volk_8ic_s32f_deinterleave_real_32f, 1e-4, 100, 20460, 1);
+VOLK_RUN_TESTS(volk_8ic_deinterleave_real_8i, 0, 0, 20460, 1);
+VOLK_RUN_TESTS(volk_8ic_x2_multiply_conjugate_16ic, 0, 0, 20460, 1);
+VOLK_RUN_TESTS(volk_8ic_x2_s32f_multiply_conjugate_32fc, 1e-4, 100, 20460, 1);
+VOLK_RUN_TESTS(volk_8i_convert_16i, 0, 0, 20460, 1);
+VOLK_RUN_TESTS(volk_8i_s32f_convert_32f, 1e-4, 100, 20460, 1);
+VOLK_RUN_TESTS(volk_32fc_x2_multiply_32fc, 1e-4, 0, 20460, 1);
+VOLK_RUN_TESTS(volk_32fc_x2_multiply_conjugate_32fc, 1e-4, 0, 20460, 1);
+VOLK_RUN_TESTS(volk_32fc_conjugate_32fc, 1e-4, 0, 20460, 1);
+VOLK_RUN_TESTS(volk_32f_x2_multiply_32f, 1e-4, 0, 20460, 1);
+VOLK_RUN_TESTS(volk_32fc_s32fc_multiply_32fc, 1e-4, 0, 20460, 1);
+VOLK_RUN_TESTS(volk_32f_s32f_multiply_32f, 1e-4, 0, 20460, 1);
+VOLK_RUN_TESTS(volk_32fc_s32fc_rotatorpuppet_32fc, 1e-2, (lv_32fc_t)lv_cmake(0.953939201, 0.3), 20460, 1);
diff --git a/volk/lib/volk_prefs.c b/volk/lib/volk_prefs.c
new file mode 100644
index 000000000..f787b5e2a
--- /dev/null
+++ b/volk/lib/volk_prefs.c
@@ -0,0 +1,50 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <volk/volk_prefs.h>
+
+//#if defined(_WIN32)
+//#include <Windows.h>
+//#endif
+
+void volk_get_config_path(char *path)
+{
+ const char *suffix = "/.volk/volk_config";
+ char *home = NULL;
+ if (home == NULL) home = getenv("HOME");
+ if (home == NULL) home = getenv("APPDATA");
+ if (home == NULL){
+ path = NULL;
+ return;
+ }
+ strcpy(path, home);
+ strcat(path, suffix);
+}
+
+size_t volk_load_preferences(volk_arch_pref_t **prefs_res)
+{
+ FILE *config_file;
+ char path[512], line[512];
+ size_t n_arch_prefs = 0;
+ volk_arch_pref_t *prefs = NULL;
+
+ //get the config path
+ volk_get_config_path(path);
+ if (path == NULL) return n_arch_prefs; //no prefs found
+ config_file = fopen(path, "r");
+ if(!config_file) return n_arch_prefs; //no prefs found
+
+ //reset the file pointer and write the prefs into volk_arch_prefs
+ while(fgets(line, sizeof(line), config_file) != NULL)
+ {
+ prefs = (volk_arch_pref_t *) realloc(prefs, (n_arch_prefs+1) * sizeof(*prefs));
+ volk_arch_pref_t *p = prefs + n_arch_prefs;
+ if(sscanf(line, "%s %s %s", p->name, p->impl_a, p->impl_u) == 3 && !strncmp(p->name, "volk_", 5))
+ {
+ n_arch_prefs++;
+ }
+ }
+ fclose(config_file);
+ *prefs_res = prefs;
+ return n_arch_prefs;
+}
diff --git a/volk/lib/volk_rank_archs.c b/volk/lib/volk_rank_archs.c
new file mode 100644
index 000000000..6ab013f26
--- /dev/null
+++ b/volk/lib/volk_rank_archs.c
@@ -0,0 +1,112 @@
+/*
+ * Copyright 2011-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.
+ */
+
+#include <volk_rank_archs.h>
+#include <volk/volk_prefs.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if __GNUC__ > 3 || __GNUC__ == 3 && __GNUC_MINOR__ >= 4
+ #define __popcnt __builtin_popcount
+#else
+ inline unsigned __popcnt(unsigned num)
+ {
+ unsigned pop = 0;
+ while(num)
+ {
+ if (num & 0x1) pop++;
+ num >>= 1;
+ }
+ return pop;
+ }
+#endif
+
+int volk_get_index(
+ const char *impl_names[], //list of implementations by name
+ const size_t n_impls, //number of implementations available
+ const char *impl_name //the implementation name to find
+){
+ unsigned int i;
+ for (i = 0; i < n_impls; i++) {
+ if(!strncmp(impl_names[i], impl_name, 20)) {
+ return i;
+ }
+ }
+ //TODO return -1;
+ //something terrible should happen here
+ printf("Volk warning: no arch found, returning generic impl\n");
+ return volk_get_index(impl_names, n_impls, "generic"); //but we'll fake it for now
+}
+
+int volk_rank_archs(
+ const char *kern_name, //name of the kernel to rank
+ const char *impl_names[], //list of implementations by name
+ const int* impl_deps, //requirement mask per implementation
+ const bool* alignment, //alignment status of each implementation
+ size_t n_impls, //number of implementations available
+ const bool align //if false, filter aligned implementations
+){
+ size_t i;
+ static volk_arch_pref_t *volk_arch_prefs;
+ static size_t n_arch_prefs = 0;
+ static int prefs_loaded = 0;
+ if(!prefs_loaded) {
+ n_arch_prefs = volk_load_preferences(&volk_arch_prefs);
+ prefs_loaded = 1;
+ }
+
+ //now look for the function name in the prefs list
+ for(i = 0; i < n_arch_prefs; i++)
+ {
+ if(!strncmp(kern_name, volk_arch_prefs[i].name, sizeof(volk_arch_prefs[i].name))) //found it
+ {
+ const char *impl_name = align? volk_arch_prefs[i].impl_a : volk_arch_prefs[i].impl_u;
+ return volk_get_index(impl_names, n_impls, impl_name);
+ }
+ }
+
+ //return the best index with the largest deps
+ size_t best_index_a = 0;
+ size_t best_index_u = 0;
+ int best_value_a = -1;
+ int best_value_u = -1;
+ for(i = 0; i < n_impls; i++)
+ {
+ const signed val = __popcnt(impl_deps[i]);
+ if (alignment[i] && val > best_value_a)
+ {
+ best_index_a = i;
+ best_value_a = val;
+ }
+ if (!alignment[i] && val > best_value_u)
+ {
+ best_index_u = i;
+ best_value_u = val;
+ }
+ }
+
+ //when align and we found a best aligned, use it
+ if (align && best_value_a != -1) return best_index_a;
+
+ //otherwise return the best unaligned
+ return best_index_u;
+}
diff --git a/volk/lib/volk_rank_archs.h b/volk/lib/volk_rank_archs.h
new file mode 100644
index 000000000..b3bf8ff17
--- /dev/null
+++ b/volk/lib/volk_rank_archs.h
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2011-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 INCLUDED_VOLK_RANK_ARCHS_H
+#define INCLUDED_VOLK_RANK_ARCHS_H
+
+#include <stdlib.h>
+#include <stdbool.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int volk_get_index(
+ const char *impl_names[], //list of implementations by name
+ const size_t n_impls, //number of implementations available
+ const char *impl_name //the implementation name to find
+);
+
+int volk_rank_archs(
+ const char *kern_name, //name of the kernel to rank
+ const char *impl_names[], //list of implementations by name
+ const int* impl_deps, //requirement mask per implementation
+ const bool* alignment, //alignment status of each implementation
+ size_t n_impls, //number of implementations available
+ const bool align //if false, filter aligned implementations
+);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /*INCLUDED_VOLK_RANK_ARCHS_H*/
diff --git a/volk/orc/volk_16i_s32f_deinterleave_32f_x2_a_orc_impl.orc b/volk/orc/volk_16i_s32f_deinterleave_32f_x2_a_orc_impl.orc
new file mode 100644
index 000000000..fd8915da0
--- /dev/null
+++ b/volk/orc/volk_16i_s32f_deinterleave_32f_x2_a_orc_impl.orc
@@ -0,0 +1,12 @@
+.function volk_16ic_s32f_deinterleave_32f_x2_a_orc_impl
+.dest 4 idst
+.dest 4 qdst
+.source 4 src
+.floatparam 4 scalar
+.temp 8 iql
+.temp 8 iqf
+
+x2 convswl iql, src
+x2 convlf iqf, iql
+x2 divf iqf, iqf, scalar
+splitql qdst, idst, iqf
diff --git a/volk/orc/volk_16ic_deinterleave_16i_x2_a_orc_impl.orc b/volk/orc/volk_16ic_deinterleave_16i_x2_a_orc_impl.orc
new file mode 100644
index 000000000..76faa936a
--- /dev/null
+++ b/volk/orc/volk_16ic_deinterleave_16i_x2_a_orc_impl.orc
@@ -0,0 +1,5 @@
+.function volk_16ic_deinterleave_16i_x2_a_orc_impl
+.dest 2 idst
+.dest 2 qdst
+.source 4 src
+splitlw qdst, idst, src
diff --git a/volk/orc/volk_16ic_deinterleave_real_8i_a_orc_impl.orc b/volk/orc/volk_16ic_deinterleave_real_8i_a_orc_impl.orc
new file mode 100644
index 000000000..8db49fd7c
--- /dev/null
+++ b/volk/orc/volk_16ic_deinterleave_real_8i_a_orc_impl.orc
@@ -0,0 +1,6 @@
+.function volk_16ic_deinterleave_real_8i_a_orc_impl
+.dest 1 dst
+.source 4 src
+.temp 2 iw
+select0lw iw, src
+convhwb dst, iw
diff --git a/volk/orc/volk_16ic_magnitude_16i_a_orc_impl.orc b/volk/orc/volk_16ic_magnitude_16i_a_orc_impl.orc
new file mode 100644
index 000000000..fbaebc46d
--- /dev/null
+++ b/volk/orc/volk_16ic_magnitude_16i_a_orc_impl.orc
@@ -0,0 +1,23 @@
+.function volk_16ic_magnitude_16i_a_orc_impl
+.source 4 src
+.dest 2 dst
+.floatparam 4 scalar
+.temp 8 iql
+.temp 8 iqf
+.temp 8 prodiqf
+.temp 4 qf
+.temp 4 if
+.temp 4 sumf
+.temp 4 rootf
+.temp 4 rootl
+
+x2 convswl iql, src
+x2 convlf iqf, iql
+x2 divf iqf, iqf, scalar
+x2 mulf prodiqf, iqf, iqf
+splitql qf, if, prodiqf
+addf sumf, if, qf
+sqrtf rootf, sumf
+mulf rootf, rootf, scalar
+convfl rootl, rootf
+convlw dst, rootl
diff --git a/volk/orc/volk_16sc_magnitude_32f_aligned16_orc_impl.orc b/volk/orc/volk_16sc_magnitude_32f_aligned16_orc_impl.orc
new file mode 100644
index 000000000..66fef7d2e
--- /dev/null
+++ b/volk/orc/volk_16sc_magnitude_32f_aligned16_orc_impl.orc
@@ -0,0 +1,25 @@
+.function volk_16ic_magnitude_32f_a_orc_impl
+.source 4 src
+.dest 4 dst
+.floatparam 4 scalar
+.temp 4 reall
+.temp 4 imagl
+.temp 2 reals
+.temp 2 imags
+.temp 4 realf
+.temp 4 imagf
+.temp 4 sumf
+
+
+
+splitlw reals, imags, src
+convswl reall, reals
+convswl imagl, imags
+convlf realf, reall
+convlf imagf, imagl
+divf realf, realf, scalar
+divf imagf, imagf, scalar
+mulf realf, realf, realf
+mulf imagf, imagf, imagf
+addf sumf, realf, imagf
+sqrtf dst, sumf
diff --git a/volk/orc/volk_16u_byteswap_a_orc_impl.orc b/volk/orc/volk_16u_byteswap_a_orc_impl.orc
new file mode 100644
index 000000000..b96ba84af
--- /dev/null
+++ b/volk/orc/volk_16u_byteswap_a_orc_impl.orc
@@ -0,0 +1,3 @@
+.function volk_16u_byteswap_a_orc_impl
+.dest 2 dst
+swapw dst, dst
diff --git a/volk/orc/volk_32f_s32f_multiply_32f_a_orc_impl.orc b/volk/orc/volk_32f_s32f_multiply_32f_a_orc_impl.orc
new file mode 100644
index 000000000..ea23fc045
--- /dev/null
+++ b/volk/orc/volk_32f_s32f_multiply_32f_a_orc_impl.orc
@@ -0,0 +1,5 @@
+.function volk_32f_s32f_multiply_32f_a_orc_impl
+.dest 4 dst
+.source 4 src1
+.floatparam 4 scalar
+mulf dst, src1, scalar
diff --git a/volk/orc/volk_32f_s32f_normalize_a_orc_impl.orc b/volk/orc/volk_32f_s32f_normalize_a_orc_impl.orc
new file mode 100644
index 000000000..986fdf665
--- /dev/null
+++ b/volk/orc/volk_32f_s32f_normalize_a_orc_impl.orc
@@ -0,0 +1,5 @@
+.function volk_32f_s32f_normalize_a_orc_impl
+.source 4 src1
+.floatparam 4 invscalar
+.dest 4 dst
+mulf dst, src1, invscalar
diff --git a/volk/orc/volk_32f_sqrt_32f_a_orc_impl.orc b/volk/orc/volk_32f_sqrt_32f_a_orc_impl.orc
new file mode 100644
index 000000000..f339b1122
--- /dev/null
+++ b/volk/orc/volk_32f_sqrt_32f_a_orc_impl.orc
@@ -0,0 +1,4 @@
+.function volk_32f_sqrt_32f_a_orc_impl
+.source 4 src
+.dest 4 dst
+sqrtf dst, src
diff --git a/volk/orc/volk_32f_x2_add_32f_a_orc_impl.orc b/volk/orc/volk_32f_x2_add_32f_a_orc_impl.orc
new file mode 100644
index 000000000..450cc6a9e
--- /dev/null
+++ b/volk/orc/volk_32f_x2_add_32f_a_orc_impl.orc
@@ -0,0 +1,5 @@
+.function volk_32f_x2_add_32f_a_orc_impl
+.dest 4 dst
+.source 4 src1
+.source 4 src2
+addf dst, src1, src2
diff --git a/volk/orc/volk_32f_x2_divide_32f_a_orc_impl.orc b/volk/orc/volk_32f_x2_divide_32f_a_orc_impl.orc
new file mode 100644
index 000000000..ee3b61b82
--- /dev/null
+++ b/volk/orc/volk_32f_x2_divide_32f_a_orc_impl.orc
@@ -0,0 +1,5 @@
+.function volk_32f_x2_divide_32f_a_orc_impl
+.dest 4 dst
+.source 4 src1
+.source 4 src2
+divf dst, src1, src2
diff --git a/volk/orc/volk_32f_x2_dot_prod_32f_a_orc_impl.orc b/volk/orc/volk_32f_x2_dot_prod_32f_a_orc_impl.orc
new file mode 100644
index 000000000..b367f3091
--- /dev/null
+++ b/volk/orc/volk_32f_x2_dot_prod_32f_a_orc_impl.orc
@@ -0,0 +1,6 @@
+.function volk_32f_x2_dot_prod_32f_a_orc_impl
+.source 4 src1
+.source 4 src2
+.dest 4 dst
+.accumulator 4 accum
+addf dst, src1, src2
diff --git a/volk/orc/volk_32f_x2_max_32f_a_orc_impl.orc b/volk/orc/volk_32f_x2_max_32f_a_orc_impl.orc
new file mode 100644
index 000000000..725201633
--- /dev/null
+++ b/volk/orc/volk_32f_x2_max_32f_a_orc_impl.orc
@@ -0,0 +1,5 @@
+.function volk_32f_x2_max_32f_a_orc_impl
+.dest 4 dst
+.source 4 src1
+.source 4 src2
+maxf dst, src1, src2
diff --git a/volk/orc/volk_32f_x2_min_32f_a_orc_impl.orc b/volk/orc/volk_32f_x2_min_32f_a_orc_impl.orc
new file mode 100644
index 000000000..a71ed8250
--- /dev/null
+++ b/volk/orc/volk_32f_x2_min_32f_a_orc_impl.orc
@@ -0,0 +1,5 @@
+.function volk_32f_x2_min_32f_a_orc_impl
+.dest 4 dst
+.source 4 src1
+.source 4 src2
+minf dst, src1, src2
diff --git a/volk/orc/volk_32f_x2_multiply_32f_a_orc_impl.orc b/volk/orc/volk_32f_x2_multiply_32f_a_orc_impl.orc
new file mode 100644
index 000000000..c17d539fd
--- /dev/null
+++ b/volk/orc/volk_32f_x2_multiply_32f_a_orc_impl.orc
@@ -0,0 +1,5 @@
+.function volk_32f_x2_multiply_32f_a_orc_impl
+.dest 4 dst
+.source 4 src1
+.source 4 src2
+mulf dst, src1, src2
diff --git a/volk/orc/volk_32f_x2_subtract_32f_a_orc_impl.orc b/volk/orc/volk_32f_x2_subtract_32f_a_orc_impl.orc
new file mode 100644
index 000000000..b3b0f256e
--- /dev/null
+++ b/volk/orc/volk_32f_x2_subtract_32f_a_orc_impl.orc
@@ -0,0 +1,5 @@
+.function volk_32f_x2_subtract_32f_a_orc_impl
+.dest 4 dst
+.source 4 src1
+.source 4 src2
+subf dst, src1, src2
diff --git a/volk/orc/volk_32fc_32f_multiply_32fc_a_orc_impl.orc b/volk/orc/volk_32fc_32f_multiply_32fc_a_orc_impl.orc
new file mode 100644
index 000000000..aa82699f5
--- /dev/null
+++ b/volk/orc/volk_32fc_32f_multiply_32fc_a_orc_impl.orc
@@ -0,0 +1,7 @@
+.function volk_32fc_32f_multiply_32fc_a_orc_impl
+.source 8 src1
+.source 4 src2
+.dest 8 dst
+.temp 8 tmp
+mergelq tmp, src2, src2
+x2 mulf dst, src1, tmp
diff --git a/volk/orc/volk_32fc_magnitude_32f_a_orc_impl.orc b/volk/orc/volk_32fc_magnitude_32f_a_orc_impl.orc
new file mode 100644
index 000000000..032ab2b1b
--- /dev/null
+++ b/volk/orc/volk_32fc_magnitude_32f_a_orc_impl.orc
@@ -0,0 +1,13 @@
+.function volk_32fc_magnitude_32f_a_orc_impl
+.source 8 src
+.dest 4 dst
+.temp 8 iqf
+.temp 8 prodiqf
+.temp 4 qf
+.temp 4 if
+.temp 4 sumf
+
+x2 mulf prodiqf, src, src
+splitql qf, if, prodiqf
+addf sumf, if, qf
+sqrtf dst, sumf
diff --git a/volk/orc/volk_32fc_s32f_magnitude_16i_a_orc_impl.orc b/volk/orc/volk_32fc_s32f_magnitude_16i_a_orc_impl.orc
new file mode 100644
index 000000000..d3bf78935
--- /dev/null
+++ b/volk/orc/volk_32fc_s32f_magnitude_16i_a_orc_impl.orc
@@ -0,0 +1,23 @@
+.function volk_32fc_s32f_magnitude_16i_a_orc_impl
+.source 8 src
+.dest 2 dst
+.floatparam 4 scalar
+.temp 8 iqf
+.temp 8 prodiqf
+.temp 4 qf
+.temp 4 if
+.temp 4 sumf
+.temp 4 rootf
+.temp 4 rootl
+#.temp 4 maskl
+
+x2 mulf prodiqf, src, src
+splitql qf, if, prodiqf
+addf sumf, if, qf
+sqrtf rootf, sumf
+mulf rootf, rootf, scalar
+#cmpltf maskl, 32768.0, rootf
+#andl maskl, maskl, 0x80000000
+#orl rootf, rootf, maskl
+convfl rootl, rootf
+convsuslw dst, rootl
diff --git a/volk/orc/volk_32fc_s32fc_multiply_32fc_a_orc_impl.orc b/volk/orc/volk_32fc_s32fc_multiply_32fc_a_orc_impl.orc
new file mode 100644
index 000000000..2577e034f
--- /dev/null
+++ b/volk/orc/volk_32fc_s32fc_multiply_32fc_a_orc_impl.orc
@@ -0,0 +1,18 @@
+.function volk_32fc_s32fc_multiply_32fc_a_orc_impl
+.source 8 src1
+.floatparam 8 scalar
+.dest 8 dst
+.temp 8 iqprod
+.temp 4 real
+.temp 4 imag
+.temp 4 ac
+.temp 4 bd
+.temp 8 swapped
+x2 mulf iqprod, src1, scalar
+splitql bd, ac, iqprod
+subf real, ac, bd
+swaplq swapped, src1
+x2 mulf iqprod, swapped, scalar
+splitql bd, ac, iqprod
+addf imag, ac, bd
+mergelq dst, real, imag
diff --git a/volk/orc/volk_32fc_x2_multiply_32fc_a_orc_impl.orc b/volk/orc/volk_32fc_x2_multiply_32fc_a_orc_impl.orc
new file mode 100644
index 000000000..cb8a12d81
--- /dev/null
+++ b/volk/orc/volk_32fc_x2_multiply_32fc_a_orc_impl.orc
@@ -0,0 +1,18 @@
+.function volk_32fc_x2_multiply_32fc_a_orc_impl
+.source 8 src1
+.source 8 src2
+.dest 8 dst
+.temp 8 iqprod
+.temp 4 real
+.temp 4 imag
+.temp 4 ac
+.temp 4 bd
+.temp 8 swapped
+x2 mulf iqprod, src1, src2
+splitql bd, ac, iqprod
+subf real, ac, bd
+swaplq swapped, src1
+x2 mulf iqprod, swapped, src2
+splitql bd, ac, iqprod
+addf imag, ac, bd
+mergelq dst, real, imag
diff --git a/volk/orc/volk_32i_x2_and_32i_a_orc_impl.orc b/volk/orc/volk_32i_x2_and_32i_a_orc_impl.orc
new file mode 100644
index 000000000..1845e4654
--- /dev/null
+++ b/volk/orc/volk_32i_x2_and_32i_a_orc_impl.orc
@@ -0,0 +1,5 @@
+.function volk_32i_x2_and_32i_a_orc_impl
+.dest 4 dst
+.source 4 src1
+.source 4 src2
+andl dst, src1, src2
diff --git a/volk/orc/volk_32i_x2_or_32i_a_orc_impl.orc b/volk/orc/volk_32i_x2_or_32i_a_orc_impl.orc
new file mode 100644
index 000000000..004663f42
--- /dev/null
+++ b/volk/orc/volk_32i_x2_or_32i_a_orc_impl.orc
@@ -0,0 +1,5 @@
+.function volk_32i_x2_or_32i_a_orc_impl
+.dest 4 dst
+.source 4 src1
+.source 4 src2
+orl dst, src1, src2
diff --git a/volk/orc/volk_8i_convert_16i_a_orc_impl.orc b/volk/orc/volk_8i_convert_16i_a_orc_impl.orc
new file mode 100644
index 000000000..17198bf1e
--- /dev/null
+++ b/volk/orc/volk_8i_convert_16i_a_orc_impl.orc
@@ -0,0 +1,6 @@
+.function volk_8i_convert_16i_a_orc_impl
+.source 1 src
+.dest 2 dst
+.temp 2 tmp
+convsbw tmp, src
+shlw dst, tmp, 8
diff --git a/volk/orc/volk_8i_s32f_convert_32f_a_orc_impl.orc b/volk/orc/volk_8i_s32f_convert_32f_a_orc_impl.orc
new file mode 100644
index 000000000..ad54fb1e1
--- /dev/null
+++ b/volk/orc/volk_8i_s32f_convert_32f_a_orc_impl.orc
@@ -0,0 +1,11 @@
+.function volk_8i_s32f_convert_32f_a_orc_impl
+.source 1 src
+.dest 4 dst
+.floatparam 4 scalar
+.temp 4 flsrc
+.temp 4 lsrc
+.temp 2 ssrc
+convsbw ssrc, src
+convswl lsrc, ssrc
+convlf flsrc, lsrc
+mulf dst, flsrc, scalar
diff --git a/volk/spu_lib/gc_spu_macs.h b/volk/spu_lib/gc_spu_macs.h
new file mode 100644
index 000000000..e86dce3f5
--- /dev/null
+++ b/volk/spu_lib/gc_spu_macs.h
@@ -0,0 +1,380 @@
+/* -*- asm -*- */
+/*
+ * 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 this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef INCLUDED_GC_SPU_MACS_H
+#define INCLUDED_GC_SPU_MACS_H
+
+/*
+ * This file contains a set of macros that are generally useful when
+ * coding in SPU assembler
+ *
+ * Note that the multi-instruction macros in here may overwrite
+ * registers 77, 78, and 79 without warning.
+ */
+
+/*
+ * defines for all registers
+ */
+#define r0 $0
+#define r1 $1
+#define r2 $2
+#define r3 $3
+#define r4 $4
+#define r5 $5
+#define r6 $6
+#define r7 $7
+#define r8 $8
+#define r9 $9
+#define r10 $10
+#define r11 $11
+#define r12 $12
+#define r13 $13
+#define r14 $14
+#define r15 $15
+#define r16 $16
+#define r17 $17
+#define r18 $18
+#define r19 $19
+#define r20 $20
+#define r21 $21
+#define r22 $22
+#define r23 $23
+#define r24 $24
+#define r25 $25
+#define r26 $26
+#define r27 $27
+#define r28 $28
+#define r29 $29
+#define r30 $30
+#define r31 $31
+#define r32 $32
+#define r33 $33
+#define r34 $34
+#define r35 $35
+#define r36 $36
+#define r37 $37
+#define r38 $38
+#define r39 $39
+#define r40 $40
+#define r41 $41
+#define r42 $42
+#define r43 $43
+#define r44 $44
+#define r45 $45
+#define r46 $46
+#define r47 $47
+#define r48 $48
+#define r49 $49
+#define r50 $50
+#define r51 $51
+#define r52 $52
+#define r53 $53
+#define r54 $54
+#define r55 $55
+#define r56 $56
+#define r57 $57
+#define r58 $58
+#define r59 $59
+#define r60 $60
+#define r61 $61
+#define r62 $62
+#define r63 $63
+#define r64 $64
+#define r65 $65
+#define r66 $66
+#define r67 $67
+#define r68 $68
+#define r69 $69
+#define r70 $70
+#define r71 $71
+#define r72 $72
+#define r73 $73
+#define r74 $74
+#define r75 $75
+#define r76 $76
+#define r77 $77
+#define r78 $78
+#define r79 $79
+#define r80 $80
+#define r81 $81
+#define r82 $82
+#define r83 $83
+#define r84 $84
+#define r85 $85
+#define r86 $86
+#define r87 $87
+#define r88 $88
+#define r89 $89
+#define r90 $90
+#define r91 $91
+#define r92 $92
+#define r93 $93
+#define r94 $94
+#define r95 $95
+#define r96 $96
+#define r97 $97
+#define r98 $98
+#define r99 $99
+#define r100 $100
+#define r101 $101
+#define r102 $102
+#define r103 $103
+#define r104 $104
+#define r105 $105
+#define r106 $106
+#define r107 $107
+#define r108 $108
+#define r109 $109
+#define r110 $110
+#define r111 $111
+#define r112 $112
+#define r113 $113
+#define r114 $114
+#define r115 $115
+#define r116 $116
+#define r117 $117
+#define r118 $118
+#define r119 $119
+#define r120 $120
+#define r121 $121
+#define r122 $122
+#define r123 $123
+#define r124 $124
+#define r125 $125
+#define r126 $126
+#define r127 $127
+
+
+#define lr r0 // link register
+#define sp r1 // stack pointer
+ // r2 is environment pointer for langs that need it (ALGOL)
+
+#define retval r3 // return values are passed in regs starting at r3
+
+#define arg1 r3 // args are passed in regs starting at r3
+#define arg2 r4
+#define arg3 r5
+#define arg4 r6
+#define arg5 r7
+#define arg6 r8
+#define arg7 r9
+#define arg8 r10
+#define arg9 r11
+#define arg10 r12
+
+// r3 - r74 are volatile (caller saves)
+// r74 - r79 are volatile (scratch regs possibly destroyed by fct prolog/epilog)
+// r80 - r127 are non-volatile (caller-saves)
+
+// scratch registers reserved for use by the macros in this file.
+
+#define _gc_t0 r79
+#define _gc_t1 r78
+#define _gc_t2 r77
+
+/*
+ * ----------------------------------------------------------------
+ * pseudo ops
+ * ----------------------------------------------------------------
+ */
+#define PROC_ENTRY(name) \
+ .text; \
+ .p2align 4; \
+ .global name; \
+ .type name, @function; \
+name:
+
+/*
+ * ----------------------------------------------------------------
+ * aliases for common operations
+ * ----------------------------------------------------------------
+ */
+
+// Move register (even pipe, 2 cycles)
+#define MR(rt, ra) or rt, ra, ra;
+
+// Move register (odd pipe, 4 cycles)
+#define LMR(rt, ra) rotqbyi rt, ra, 0;
+
+// return
+#define RETURN() bi lr;
+
+// hint for a return
+#define HINT_RETURN(ret_label) hbr ret_label, lr;
+
+// return if zero
+#define BRZ_RETURN(rt) biz rt, lr;
+
+// return if not zero
+#define BRNZ_RETURN(rt) binz rt, lr;
+
+// return if halfword zero
+#define BRHZ_RETURN(rt) bihz rt, lr;
+
+// return if halfword not zero
+#define BRHNZ_RETURN(rt) bihnz rt, lr;
+
+
+/*
+ * ----------------------------------------------------------------
+ * modulo like things for constant moduli that are powers of 2
+ * ----------------------------------------------------------------
+ */
+
+// rt = ra & (pow2 - 1)
+#define MODULO(rt, ra, pow2) \
+ andi rt, ra, (pow2)-1;
+
+// rt = pow2 - (ra & (pow2 - 1))
+#define MODULO_NEG(rt, ra, pow2) \
+ andi rt, ra, (pow2)-1; \
+ sfi rt, rt, (pow2);
+
+// rt = ra & -(pow2)
+#define ROUND_DOWN(rt, ra, pow2) \
+ andi rt, ra, -(pow2);
+
+// rt = (ra + (pow2 - 1)) & -(pow2)
+#define ROUND_UP(rt, ra, pow2) \
+ ai rt, ra, (pow2)-1; \
+ andi rt, rt, -(pow2);
+
+/*
+ * ----------------------------------------------------------------
+ * Splat - replicate a particular slot into all slots
+ * Altivec analogs...
+ * ----------------------------------------------------------------
+ */
+
+// replicate byte from slot s [0,15]
+#define VSPLTB(rt, ra, s) \
+ ilh _gc_t0, (s)*0x0101; \
+ shufb rt, ra, ra, _gc_t0;
+
+// replicate halfword from slot s [0,7]
+#define VSPLTH(rt, ra, s) \
+ ilh _gc_t0, 2*(s)*0x0101 + 0x0001; \
+ shufb rt, ra, ra, _gc_t0;
+
+// replicate word from slot s [0,3]
+#define VSPLTW(rt, ra, s) \
+ iluh _gc_t0, 4*(s)*0x0101 + 0x0001; \
+ iohl _gc_t0, 4*(s)*0x0101 + 0x0203; \
+ shufb rt, ra, ra, _gc_t0;
+
+// replicate double from slot s [0,1]
+#define VSPLTD(rt, ra, s) \
+ /* sp is always 16-byte aligned */ \
+ cdd _gc_t0, 8(sp); /* 0x10111213 14151617 00010203 04050607 */ \
+ rotqbyi rt, ra, ra, (s) << 3; /* rotate double into preferred slot */ \
+ shufb rt, rt, rt, _gc_t0;
+
+/*
+ * ----------------------------------------------------------------
+ * lots of min/max variations...
+ *
+ * On a slot by slot basis, compute the min or max
+ *
+ * U - unsigned, else signed
+ * B,H,{} - byte, halfword, word
+ * F float
+ * ----------------------------------------------------------------
+ */
+
+#define MIN_SELB(rt, ra, rb, rc) selb rt, ra, rb, rc;
+#define MAX_SELB(rt, ra, rb, rc) selb rt, rb, ra, rc;
+
+ // words
+
+#define MIN(rt, ra, rb) \
+ cgt _gc_t0, ra, rb; \
+ MIN_SELB(rt, ra, rb, _gc_t0)
+
+#define MAX(rt, ra, rb) \
+ cgt _gc_t0, ra, rb; \
+ MAX_SELB(rt, ra, rb, _gc_t0)
+
+#define UMIN(rt, ra, rb) \
+ clgt _gc_t0, ra, rb; \
+ MIN_SELB(rt, ra, rb, _gc_t0)
+
+#define UMAX(rt, ra, rb) \
+ clgt _gc_t0, ra, rb; \
+ MAX_SELB(rt, ra, rb, _gc_t0)
+
+ // bytes
+
+#define MINB(rt, ra, rb) \
+ cgtb _gc_t0, ra, rb; \
+ MIN_SELB(rt, ra, rb, _gc_t0)
+
+#define MAXB(rt, ra, rb) \
+ cgtb _gc_t0, ra, rb; \
+ MAX_SELB(rt, ra, rb, _gc_t0)
+
+#define UMINB(rt, ra, rb) \
+ clgtb _gc_t0, ra, rb; \
+ MIN_SELB(rt, ra, rb, _gc_t0)
+
+#define UMAXB(rt, ra, rb) \
+ clgtb _gc_t0, ra, rb; \
+ MAX_SELB(rt, ra, rb, _gc_t0)
+
+ // halfwords
+
+#define MINH(rt, ra, rb) \
+ cgth _gc_t0, ra, rb; \
+ MIN_SELB(rt, ra, rb, _gc_t0)
+
+#define MAXH(rt, ra, rb) \
+ cgth _gc_t0, ra, rb; \
+ MAX_SELB(rt, ra, rb, _gc_t0)
+
+#define UMINH(rt, ra, rb) \
+ clgth _gc_t0, ra, rb; \
+ MIN_SELB(rt, ra, rb, _gc_t0)
+
+#define UMAXH(rt, ra, rb) \
+ clgth _gc_t0, ra, rb; \
+ MAX_SELB(rt, ra, rb, _gc_t0)
+
+ // floats
+
+#define FMIN(rt, ra, rb) \
+ fcgt _gc_t0, ra, rb; \
+ MIN_SELB(rt, ra, rb, _gc_t0)
+
+#define FMAX(rt, ra, rb) \
+ fcgt _gc_t0, ra, rb; \
+ MAX_SELB(rt, ra, rb, _gc_t0)
+
+// Ignoring the sign, select the values with the minimum magnitude
+#define FMINMAG(rt, ra, rb) \
+ fcmgt _gc_t0, ra, rb; \
+ MIN_SELB(rt, ra, rb, _gc_t0)
+
+// Ignoring the sign, select the values with the maximum magnitude
+#define FMAXMAG(rt, ra, rb) \
+ fcmgt _gc_t0, ra, rb; \
+ MAX_SELB(rt, ra, rb, _gc_t0)
+
+
+#endif /* INCLUDED_GC_SPU_MACS_H */
diff --git a/volk/spu_lib/spu_16s_cmpgt_unaligned.c b/volk/spu_lib/spu_16s_cmpgt_unaligned.c
new file mode 100644
index 000000000..8811e6801
--- /dev/null
+++ b/volk/spu_lib/spu_16s_cmpgt_unaligned.c
@@ -0,0 +1,160 @@
+#include<spu_intrinsics.h>
+
+void* libvector_16s_cmpgt_unaligned(void* target, void* src, signed short val, unsigned int num_bytes){
+ //loop iterator i
+ int i = 0;
+ void* retval = target;
+
+
+ //put the target and source addresses into qwords
+ vector unsigned int address_counter_tgt = {(unsigned int)target, 0, 0, 0};
+ vector unsigned int address_counter_src = {(unsigned int)src, 0, 0 ,0};
+
+ //create shuffle masks
+
+ //shuffle mask building blocks:
+ //all from the first vector
+ vector unsigned char oneup = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f};
+ //all from the second vector
+ vector unsigned char second_oneup = {0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
+ 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f};
+
+
+
+ //gamma: second half of the second, first half of the first, break at (unsigned int)src%16
+ vector unsigned char src_cmp = spu_splats((unsigned char)((unsigned int)src%16));
+ vector unsigned char gt_res = spu_cmpgt(oneup, src_cmp);
+ vector unsigned char eq_res = spu_cmpeq(oneup, src_cmp);
+ vector unsigned char cmp_res = spu_or(gt_res, eq_res);
+ vector unsigned char sixteen_uchar = spu_splats((unsigned char)16);
+ vector unsigned char phase_change = spu_and(sixteen_uchar, cmp_res);
+ vector unsigned int shuffle_mask_gamma = spu_add((vector unsigned int)phase_change,
+ (vector unsigned int)oneup);
+ shuffle_mask_gamma = spu_rlqwbyte(shuffle_mask_gamma, (unsigned int)src%16);
+
+
+
+
+ vector unsigned char tgt_second = spu_rlqwbyte(second_oneup, -((unsigned int)target%16));
+ vector unsigned char tgt_first = spu_rlqwbyte(oneup, -((unsigned int)target%16));
+
+ //alpha: first half of first, second half of second, break at (unsigned int)target%16
+ src_cmp = spu_splats((unsigned char)((unsigned int)target%16));
+ gt_res = spu_cmpgt(oneup, src_cmp);
+ eq_res = spu_cmpeq(oneup, src_cmp);
+ cmp_res = spu_or(gt_res, eq_res);
+ phase_change = spu_and(sixteen_uchar, cmp_res);
+ vector unsigned int shuffle_mask_alpha = spu_add((vector unsigned int)phase_change,
+ (vector unsigned int)oneup);
+
+ //delta: first half of first, first half of second, break at (unsigned int)target%16
+ vector unsigned char shuffle_mask_delta = spu_shuffle(oneup, tgt_second, (vector unsigned char)shuffle_mask_alpha);
+ //epsilon: second half of second, second half of first, break at (unsigned int)target%16
+ vector unsigned char shuffle_mask_epsilon = spu_shuffle(tgt_second, oneup, (vector unsigned char)shuffle_mask_alpha);
+ //zeta: second half of second, first half of first, break at 16 - (unsigned int)target%16
+ vector unsigned int shuffle_mask_zeta = spu_rlqwbyte(shuffle_mask_alpha, (unsigned int)target%16);
+
+ //beta: first half of first, second half of second, break at num_bytes%16
+ src_cmp = spu_splats((unsigned char)(num_bytes%16));
+ gt_res = spu_cmpgt(oneup, src_cmp);
+ eq_res = spu_cmpeq(oneup, src_cmp);
+ cmp_res = spu_or(gt_res, eq_res);
+ phase_change = spu_and(sixteen_uchar, cmp_res);
+ vector unsigned int shuffle_mask_beta = spu_add((vector unsigned int)phase_change,
+ (vector unsigned int)oneup);
+
+
+
+
+
+
+ qword src_past;
+ qword src_present;
+ qword tgt_past;
+ qword tgt_present;
+
+ qword in_temp;
+ qword out_temp0;
+ qword out_temp1;
+
+ src_past = si_lqd((qword)address_counter_src, 0);
+ tgt_past = si_lqd((qword)address_counter_tgt, 0);
+
+ vector signed short vec_val = spu_splats(val);
+ vector unsigned short compare;
+ vector unsigned short ones = {1, 1, 1, 1, 1, 1, 1, 1};
+ vector unsigned short after_and;
+
+ for(i = 0; i < num_bytes/16; ++i) {
+
+ src_present = si_lqd((qword)address_counter_src, 16);
+ tgt_present = si_lqd((qword)address_counter_tgt, 16);
+
+ in_temp = spu_shuffle(src_present, src_past, (vector unsigned char)shuffle_mask_gamma);
+
+ compare = spu_cmpgt((vector signed short) in_temp, vec_val);
+ after_and = spu_and(compare, ones);
+
+
+ out_temp0 = spu_shuffle(tgt_past, (qword)after_and, shuffle_mask_delta);
+ out_temp1 = spu_shuffle(tgt_present, (qword)after_and, shuffle_mask_epsilon);
+
+ si_stqd(out_temp0, (qword)address_counter_tgt, 0);
+ si_stqd(out_temp1, (qword)address_counter_tgt, 16);
+
+ tgt_past = out_temp1;
+ src_past = src_present;
+ address_counter_src = spu_add(address_counter_src, 16);
+ address_counter_tgt = spu_add(address_counter_tgt, 16);
+
+
+ }
+
+ src_present = si_lqd((qword)address_counter_src, 16);
+ tgt_present = si_lqd((qword)address_counter_tgt, 16);
+
+
+ in_temp = spu_shuffle(src_present, src_past,(vector unsigned char) shuffle_mask_gamma);
+
+ compare = spu_cmpgt((vector signed short) in_temp, vec_val);
+ after_and = spu_and(compare, ones);
+
+
+ qword target_temp = spu_shuffle(tgt_present, tgt_past, (vector unsigned char) shuffle_mask_zeta);
+ qword meld = spu_shuffle((qword)after_and, target_temp, (vector unsigned char)shuffle_mask_beta);
+
+
+
+ out_temp0 = spu_shuffle(tgt_past, meld, shuffle_mask_delta);
+ out_temp1 = spu_shuffle(tgt_present, meld, shuffle_mask_epsilon);
+
+ si_stqd(out_temp0, (qword)address_counter_tgt, 0);
+ si_stqd(out_temp1, (qword)address_counter_tgt, 16);
+
+ return retval;
+}
+
+
+
+/*
+int main(){
+
+ signed short pooh[48];
+ signed short bear[48];
+
+ int i = 0;
+ for(i = 0; i < 48; i += 2){
+ bear[i] = i;
+ bear[i + 1] = -i;
+ }
+
+ vector_gt_16bit(&pooh[0],&bear[0], 0, 48 * sizeof(signed short));
+
+ for(i = 0; i < 48; ++i) {
+ printf("%d, ", pooh[i]);
+ }
+ printf("\n");
+}
+*/
+
diff --git a/volk/spu_lib/spu_16s_vector_subtract_unaligned.c b/volk/spu_lib/spu_16s_vector_subtract_unaligned.c
new file mode 100644
index 000000000..ea110c8d2
--- /dev/null
+++ b/volk/spu_lib/spu_16s_vector_subtract_unaligned.c
@@ -0,0 +1,178 @@
+#include<spu_intrinsics.h>
+
+void* libvector_16s_vector_subtract_unaligned(void* target, void* src0, void* src1, unsigned int num_bytes){
+ //loop iterator i
+ int i = 0;
+ void* retval = target;
+
+
+ //put the target and source addresses into qwords
+ vector unsigned int address_counter_tgt = {(unsigned int)target, 0, 0, 0};
+ vector unsigned int address_counter_src0 = {(unsigned int)src0, 0, 0 ,0};
+ vector unsigned int address_counter_src1 = {(unsigned int)src1, 0, 0, 0};
+
+ //create shuffle masks
+
+ //shuffle mask building blocks:
+ //all from the first vector
+ vector unsigned char oneup = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f};
+ //all from the second vector
+ vector unsigned char second_oneup = {0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
+ 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f};
+
+
+
+ //gamma: second half of the second, first half of the first, break at (unsigned int)src0%16
+ vector unsigned char src_cmp = spu_splats((unsigned char)((unsigned int)src0%16));
+ vector unsigned char gt_res = spu_cmpgt(oneup, src_cmp);
+ vector unsigned char eq_res = spu_cmpeq(oneup, src_cmp);
+ vector unsigned char cmp_res = spu_or(gt_res, eq_res);
+ vector unsigned char sixteen_uchar = spu_splats((unsigned char)16);
+ vector unsigned char phase_change = spu_and(sixteen_uchar, cmp_res);
+ vector unsigned int shuffle_mask_gamma = spu_add((vector unsigned int)phase_change,
+ (vector unsigned int)oneup);
+ shuffle_mask_gamma = spu_rlqwbyte(shuffle_mask_gamma, (unsigned int)src0%16);
+
+ //eta: second half of the second, first half of the first, break at (unsigned int)src1%16
+ src_cmp = spu_splats((unsigned char)((unsigned int)src1%16));
+ gt_res = spu_cmpgt(oneup, src_cmp);
+ eq_res = spu_cmpeq(oneup, src_cmp);
+ cmp_res = spu_or(gt_res, eq_res);
+ sixteen_uchar = spu_splats((unsigned char)16);
+ phase_change = spu_and(sixteen_uchar, cmp_res);
+ vector unsigned int shuffle_mask_eta = spu_add((vector unsigned int)phase_change,
+ (vector unsigned int)oneup);
+ shuffle_mask_eta = spu_rlqwbyte(shuffle_mask_eta, (unsigned int)src1%16);
+
+
+
+
+
+ vector unsigned char tgt_second = spu_rlqwbyte(second_oneup, -((unsigned int)target%16));
+ vector unsigned char tgt_first = spu_rlqwbyte(oneup, -((unsigned int)target%16));
+
+ //alpha: first half of first, second half of second, break at (unsigned int)target%16
+ src_cmp = spu_splats((unsigned char)((unsigned int)target%16));
+ gt_res = spu_cmpgt(oneup, src_cmp);
+ eq_res = spu_cmpeq(oneup, src_cmp);
+ cmp_res = spu_or(gt_res, eq_res);
+ phase_change = spu_and(sixteen_uchar, cmp_res);
+ vector unsigned int shuffle_mask_alpha = spu_add((vector unsigned int)phase_change,
+ (vector unsigned int)oneup);
+
+ //delta: first half of first, first half of second, break at (unsigned int)target%16
+ vector unsigned char shuffle_mask_delta = spu_shuffle(oneup, tgt_second, (vector unsigned char)shuffle_mask_alpha);
+ //epsilon: second half of second, second half of first, break at (unsigned int)target%16
+ vector unsigned char shuffle_mask_epsilon = spu_shuffle(tgt_second, oneup, (vector unsigned char)shuffle_mask_alpha);
+ //zeta: second half of second, first half of first, break at 16 - (unsigned int)target%16
+ vector unsigned int shuffle_mask_zeta = spu_rlqwbyte(shuffle_mask_alpha, (unsigned int)target%16);
+
+ //beta: first half of first, second half of second, break at num_bytes%16
+ src_cmp = spu_splats((unsigned char)(num_bytes%16));
+ gt_res = spu_cmpgt(oneup, src_cmp);
+ eq_res = spu_cmpeq(oneup, src_cmp);
+ cmp_res = spu_or(gt_res, eq_res);
+ phase_change = spu_and(sixteen_uchar, cmp_res);
+ vector unsigned int shuffle_mask_beta = spu_add((vector unsigned int)phase_change,
+ (vector unsigned int)oneup);
+
+
+
+
+
+
+ qword src0_past;
+ qword src0_present;
+ qword src1_past;
+ qword src1_present;
+ qword tgt_past;
+ qword tgt_present;
+
+ qword in_temp0;
+ qword in_temp1;
+ qword out_temp0;
+ qword out_temp1;
+
+ vector signed short sum;
+
+ src0_past = si_lqd((qword)address_counter_src0, 0);
+ src1_past = si_lqd((qword)address_counter_src1, 0);
+ tgt_past = si_lqd((qword)address_counter_tgt, 0);
+
+ for(i = 0; i < num_bytes/16; ++i) {
+
+ src0_present = si_lqd((qword)address_counter_src0, 16);
+ src1_present = si_lqd((qword)address_counter_src1, 16);
+ tgt_present = si_lqd((qword)address_counter_tgt, 16);
+
+ in_temp0 = spu_shuffle(src0_present, src0_past, (vector unsigned char)shuffle_mask_gamma);
+ in_temp1 = spu_shuffle(src1_present, src1_past, (vector unsigned char)shuffle_mask_eta);
+
+ sum = spu_sub((vector signed short)in_temp0, (vector signed short)in_temp1);
+
+
+ out_temp0 = spu_shuffle(tgt_past, (qword)sum, shuffle_mask_delta);
+ out_temp1 = spu_shuffle(tgt_present, (qword)sum, shuffle_mask_epsilon);
+
+ si_stqd(out_temp0, (qword)address_counter_tgt, 0);
+ si_stqd(out_temp1, (qword)address_counter_tgt, 16);
+
+ tgt_past = out_temp1;
+ src0_past = src0_present;
+ src1_past = src1_present;
+ address_counter_src0 = spu_add(address_counter_src0, 16);
+ address_counter_src1 = spu_add(address_counter_src1, 16);
+ address_counter_tgt = spu_add(address_counter_tgt, 16);
+
+
+ }
+
+ src0_present = si_lqd((qword)address_counter_src0, 16);
+ src1_present = si_lqd((qword)address_counter_src1, 16);
+ tgt_present = si_lqd((qword)address_counter_tgt, 16);
+
+
+ in_temp0 = spu_shuffle(src0_present, src0_past, (vector unsigned char) shuffle_mask_gamma);
+ in_temp1 = spu_shuffle(src1_present, src1_past, (vector unsigned char) shuffle_mask_eta);
+ sum = spu_sub((vector signed short)in_temp0, (vector signed short)in_temp1);
+ qword target_temp = spu_shuffle(tgt_present, tgt_past, (vector unsigned char) shuffle_mask_zeta);
+ qword meld = spu_shuffle((qword)sum, target_temp, (vector unsigned char)shuffle_mask_beta);
+
+
+
+ out_temp0 = spu_shuffle(tgt_past, meld, shuffle_mask_delta);
+ out_temp1 = spu_shuffle(tgt_present, meld, shuffle_mask_epsilon);
+
+ si_stqd(out_temp0, (qword)address_counter_tgt, 0);
+ si_stqd(out_temp1, (qword)address_counter_tgt, 16);
+
+ return retval;
+}
+
+
+
+/*
+int main(){
+
+ signed short pooh[48];
+ signed short bear[48];
+ signed short res[48];
+
+ int i = 0;
+ for(i = 0; i < 48; ++i){
+ pooh[i] = i;
+ }
+ for(i = 48; i < 96; ++i){
+ bear[i - 48] = i;
+ }
+
+ vector_subtract_16bit(res, &pooh[0], &bear[0], 48 * sizeof(signed short));
+
+ for(i = 0; i < 48; ++i) {
+ printf("%d, ", res[i]);
+ }
+ printf("\n");
+}
+*/
+
diff --git a/volk/spu_lib/spu_16s_vector_sum_unaligned.c b/volk/spu_lib/spu_16s_vector_sum_unaligned.c
new file mode 100644
index 000000000..0097b4f56
--- /dev/null
+++ b/volk/spu_lib/spu_16s_vector_sum_unaligned.c
@@ -0,0 +1,178 @@
+#include<spu_intrinsics.h>
+
+void* libvector_16s_vector_sum_unaligned(void* target, void* src0, void* src1, unsigned int num_bytes){
+ //loop iterator i
+ int i = 0;
+ void* retval = target;
+
+
+ //put the target and source addresses into qwords
+ vector unsigned int address_counter_tgt = {(unsigned int)target, 0, 0, 0};
+ vector unsigned int address_counter_src0 = {(unsigned int)src0, 0, 0 ,0};
+ vector unsigned int address_counter_src1 = {(unsigned int)src1, 0, 0, 0};
+
+ //create shuffle masks
+
+ //shuffle mask building blocks:
+ //all from the first vector
+ vector unsigned char oneup = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f};
+ //all from the second vector
+ vector unsigned char second_oneup = {0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
+ 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f};
+
+
+
+ //gamma: second half of the second, first half of the first, break at (unsigned int)src0%16
+ vector unsigned char src_cmp = spu_splats((unsigned char)((unsigned int)src0%16));
+ vector unsigned char gt_res = spu_cmpgt(oneup, src_cmp);
+ vector unsigned char eq_res = spu_cmpeq(oneup, src_cmp);
+ vector unsigned char cmp_res = spu_or(gt_res, eq_res);
+ vector unsigned char sixteen_uchar = spu_splats((unsigned char)16);
+ vector unsigned char phase_change = spu_and(sixteen_uchar, cmp_res);
+ vector unsigned int shuffle_mask_gamma = spu_add((vector unsigned int)phase_change,
+ (vector unsigned int)oneup);
+ shuffle_mask_gamma = spu_rlqwbyte(shuffle_mask_gamma, (unsigned int)src0%16);
+
+ //eta: second half of the second, first half of the first, break at (unsigned int)src1%16
+ src_cmp = spu_splats((unsigned char)((unsigned int)src1%16));
+ gt_res = spu_cmpgt(oneup, src_cmp);
+ eq_res = spu_cmpeq(oneup, src_cmp);
+ cmp_res = spu_or(gt_res, eq_res);
+ sixteen_uchar = spu_splats((unsigned char)16);
+ phase_change = spu_and(sixteen_uchar, cmp_res);
+ vector unsigned int shuffle_mask_eta = spu_add((vector unsigned int)phase_change,
+ (vector unsigned int)oneup);
+ shuffle_mask_eta = spu_rlqwbyte(shuffle_mask_eta, (unsigned int)src1%16);
+
+
+
+
+
+ vector unsigned char tgt_second = spu_rlqwbyte(second_oneup, -((unsigned int)target%16));
+ vector unsigned char tgt_first = spu_rlqwbyte(oneup, -((unsigned int)target%16));
+
+ //alpha: first half of first, second half of second, break at (unsigned int)target%16
+ src_cmp = spu_splats((unsigned char)((unsigned int)target%16));
+ gt_res = spu_cmpgt(oneup, src_cmp);
+ eq_res = spu_cmpeq(oneup, src_cmp);
+ cmp_res = spu_or(gt_res, eq_res);
+ phase_change = spu_and(sixteen_uchar, cmp_res);
+ vector unsigned int shuffle_mask_alpha = spu_add((vector unsigned int)phase_change,
+ (vector unsigned int)oneup);
+
+ //delta: first half of first, first half of second, break at (unsigned int)target%16
+ vector unsigned char shuffle_mask_delta = spu_shuffle(oneup, tgt_second, (vector unsigned char)shuffle_mask_alpha);
+ //epsilon: second half of second, second half of first, break at (unsigned int)target%16
+ vector unsigned char shuffle_mask_epsilon = spu_shuffle(tgt_second, oneup, (vector unsigned char)shuffle_mask_alpha);
+ //zeta: second half of second, first half of first, break at 16 - (unsigned int)target%16
+ vector unsigned int shuffle_mask_zeta = spu_rlqwbyte(shuffle_mask_alpha, (unsigned int)target%16);
+
+ //beta: first half of first, second half of second, break at num_bytes%16
+ src_cmp = spu_splats((unsigned char)(num_bytes%16));
+ gt_res = spu_cmpgt(oneup, src_cmp);
+ eq_res = spu_cmpeq(oneup, src_cmp);
+ cmp_res = spu_or(gt_res, eq_res);
+ phase_change = spu_and(sixteen_uchar, cmp_res);
+ vector unsigned int shuffle_mask_beta = spu_add((vector unsigned int)phase_change,
+ (vector unsigned int)oneup);
+
+
+
+
+
+
+ qword src0_past;
+ qword src0_present;
+ qword src1_past;
+ qword src1_present;
+ qword tgt_past;
+ qword tgt_present;
+
+ qword in_temp0;
+ qword in_temp1;
+ qword out_temp0;
+ qword out_temp1;
+
+ vector signed int sum;
+
+ src0_past = si_lqd((qword)address_counter_src0, 0);
+ src1_past = si_lqd((qword)address_counter_src1, 0);
+ tgt_past = si_lqd((qword)address_counter_tgt, 0);
+
+ for(i = 0; i < num_bytes/16; ++i) {
+
+ src0_present = si_lqd((qword)address_counter_src0, 16);
+ src1_present = si_lqd((qword)address_counter_src1, 16);
+ tgt_present = si_lqd((qword)address_counter_tgt, 16);
+
+ in_temp0 = spu_shuffle(src0_present, src0_past, (vector unsigned char)shuffle_mask_gamma);
+ in_temp1 = spu_shuffle(src1_present, src1_past, (vector unsigned char)shuffle_mask_eta);
+
+ sum = spu_add((vector signed int)in_temp0, (vector signed int)in_temp1);
+
+
+ out_temp0 = spu_shuffle(tgt_past, (qword)sum, shuffle_mask_delta);
+ out_temp1 = spu_shuffle(tgt_present, (qword)sum, shuffle_mask_epsilon);
+
+ si_stqd(out_temp0, (qword)address_counter_tgt, 0);
+ si_stqd(out_temp1, (qword)address_counter_tgt, 16);
+
+ tgt_past = out_temp1;
+ src0_past = src0_present;
+ src1_past = src1_present;
+ address_counter_src0 = spu_add(address_counter_src0, 16);
+ address_counter_src1 = spu_add(address_counter_src1, 16);
+ address_counter_tgt = spu_add(address_counter_tgt, 16);
+
+
+ }
+
+ src0_present = si_lqd((qword)address_counter_src0, 16);
+ src1_present = si_lqd((qword)address_counter_src1, 16);
+ tgt_present = si_lqd((qword)address_counter_tgt, 16);
+
+
+ in_temp0 = spu_shuffle(src0_present, src0_past, (vector unsigned char) shuffle_mask_gamma);
+ in_temp1 = spu_shuffle(src1_present, src1_past, (vector unsigned char) shuffle_mask_eta);
+ sum = spu_add((vector signed int)in_temp0, (vector signed int)in_temp1);
+ qword target_temp = spu_shuffle(tgt_present, tgt_past, (vector unsigned char) shuffle_mask_zeta);
+ qword meld = spu_shuffle((qword)sum, target_temp, (vector unsigned char)shuffle_mask_beta);
+
+
+
+ out_temp0 = spu_shuffle(tgt_past, meld, shuffle_mask_delta);
+ out_temp1 = spu_shuffle(tgt_present, meld, shuffle_mask_epsilon);
+
+ si_stqd(out_temp0, (qword)address_counter_tgt, 0);
+ si_stqd(out_temp1, (qword)address_counter_tgt, 16);
+
+ return retval;
+}
+
+
+
+/*
+int main(){
+
+ signed short pooh[48];
+ signed short bear[48];
+ signed short res[48];
+
+ int i = 0;
+ for(i = 0; i < 48; ++i){
+ pooh[i] = i;
+ }
+ for(i = 48; i < 96; ++i){
+ bear[i - 48] = i;
+ }
+
+ vector_sum(&pooh[9], &pooh[9], &bear[3], 30);
+
+ for(i = 0; i < 48; ++i) {
+ printf("%d, ", pooh[i]);
+ }
+ printf("\n");
+}
+*/
+
diff --git a/volk/spu_lib/spu_32fc_pointwise_multiply_unaligned.c b/volk/spu_lib/spu_32fc_pointwise_multiply_unaligned.c
new file mode 100644
index 000000000..d1c960488
--- /dev/null
+++ b/volk/spu_lib/spu_32fc_pointwise_multiply_unaligned.c
@@ -0,0 +1,222 @@
+#include<spu_intrinsics.h>
+
+
+
+
+void* libvector_pointwise_multiply_32fc_unaligned(void* target, void* src0, void* src1, unsigned int num_bytes){
+ //loop iterator i
+ int i = 0;
+ void* retval = target;
+
+
+ //put the target and source addresses into qwords
+ vector unsigned int address_counter_tgt = {(unsigned int)target, 0, 0, 0};
+ vector unsigned int address_counter_src0 = {(unsigned int)src0, 0, 0 ,0};
+ vector unsigned int address_counter_src1 = {(unsigned int)src1, 0, 0, 0};
+
+ //create shuffle masks
+
+ //shuffle mask building blocks:
+ //all from the first vector
+ vector unsigned char oneup = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f};
+ //all from the second vector
+ vector unsigned char second_oneup = {0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
+ 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f};
+
+
+
+ //gamma: second half of the second, first half of the first, break at (unsigned int)src0%16
+ vector unsigned char src_cmp = spu_splats((unsigned char)((unsigned int)src0%16));
+ vector unsigned char gt_res = spu_cmpgt(oneup, src_cmp);
+ vector unsigned char eq_res = spu_cmpeq(oneup, src_cmp);
+ vector unsigned char cmp_res = spu_or(gt_res, eq_res);
+ vector unsigned char sixteen_uchar = spu_splats((unsigned char)16);
+ vector unsigned char phase_change = spu_and(sixteen_uchar, cmp_res);
+ vector unsigned int shuffle_mask_gamma = spu_add((vector unsigned int)phase_change,
+ (vector unsigned int)oneup);
+ shuffle_mask_gamma = spu_rlqwbyte(shuffle_mask_gamma, (unsigned int)src0%16);
+
+ //eta: second half of the second, first half of the first, break at (unsigned int)src1%16
+ src_cmp = spu_splats((unsigned char)((unsigned int)src1%16));
+ gt_res = spu_cmpgt(oneup, src_cmp);
+ eq_res = spu_cmpeq(oneup, src_cmp);
+ cmp_res = spu_or(gt_res, eq_res);
+ sixteen_uchar = spu_splats((unsigned char)16);
+ phase_change = spu_and(sixteen_uchar, cmp_res);
+ vector unsigned int shuffle_mask_eta = spu_add((vector unsigned int)phase_change,
+ (vector unsigned int)oneup);
+ shuffle_mask_eta = spu_rlqwbyte(shuffle_mask_eta, (unsigned int)src1%16);
+
+
+
+
+
+ vector unsigned char tgt_second = spu_rlqwbyte(second_oneup, -((unsigned int)target%16));
+ vector unsigned char tgt_first = spu_rlqwbyte(oneup, -((unsigned int)target%16));
+
+ //alpha: first half of first, second half of second, break at (unsigned int)target%16
+ src_cmp = spu_splats((unsigned char)((unsigned int)target%16));
+ gt_res = spu_cmpgt(oneup, src_cmp);
+ eq_res = spu_cmpeq(oneup, src_cmp);
+ cmp_res = spu_or(gt_res, eq_res);
+ phase_change = spu_and(sixteen_uchar, cmp_res);
+ vector unsigned int shuffle_mask_alpha = spu_add((vector unsigned int)phase_change,
+ (vector unsigned int)oneup);
+
+ //delta: first half of first, first half of second, break at (unsigned int)target%16
+ vector unsigned char shuffle_mask_delta = spu_shuffle(oneup, tgt_second, (vector unsigned char)shuffle_mask_alpha);
+ //epsilon: second half of second, second half of first, break at (unsigned int)target%16
+ vector unsigned char shuffle_mask_epsilon = spu_shuffle(tgt_second, oneup, (vector unsigned char)shuffle_mask_alpha);
+ //zeta: second half of second, first half of first, break at 16 - (unsigned int)target%16
+ vector unsigned int shuffle_mask_zeta = spu_rlqwbyte(shuffle_mask_alpha, (unsigned int)target%16);
+
+ //beta: first half of first, second half of second, break at num_bytes%16
+ src_cmp = spu_splats((unsigned char)(num_bytes%16));
+ gt_res = spu_cmpgt(oneup, src_cmp);
+ eq_res = spu_cmpeq(oneup, src_cmp);
+ cmp_res = spu_or(gt_res, eq_res);
+ phase_change = spu_and(sixteen_uchar, cmp_res);
+ vector unsigned int shuffle_mask_beta = spu_add((vector unsigned int)phase_change,
+ (vector unsigned int)oneup);
+
+
+
+
+
+
+ qword src0_past;
+ qword src0_present;
+ qword src1_past;
+ qword src1_present;
+ qword tgt_past;
+ qword tgt_present;
+
+ qword in_temp0;
+ qword in_temp1;
+ qword out_temp0;
+ qword out_temp1;
+
+
+ src0_past = si_lqd((qword)address_counter_src0, 0);
+ src1_past = si_lqd((qword)address_counter_src1, 0);
+ tgt_past = si_lqd((qword)address_counter_tgt, 0);
+
+ vector unsigned char shuffle_mask_complexprod0 = {0x04, 0x05, 0x06, 0x07, 0x00, 0x01, 0x02, 0x03,
+ 0x0c, 0x0d, 0x0e, 0x0f, 0x08, 0x09, 0x0a, 0x0b};
+ vector unsigned char shuffle_mask_complexprod1 = {0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
+ 0x08, 0x09, 0x0a, 0x0b, 0x18, 0x19, 0x1a, 0x1b};
+ vector unsigned char shuffle_mask_complexprod2 = {0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17,
+ 0x0c, 0x0d, 0x0e, 0x0f, 0x1c, 0x1d, 0x1e, 0x1f};
+ vector unsigned char sign_changer = {0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00};
+
+ vector float prod0;
+ qword shuf0;
+ vector float prod1;
+ vector float sign_change;
+ qword summand0;
+ qword summand1;
+ vector float sum;
+
+
+ for(i = 0; i < num_bytes/16; ++i) {
+
+ src0_present = si_lqd((qword)address_counter_src0, 16);
+ src1_present = si_lqd((qword)address_counter_src1, 16);
+ tgt_present = si_lqd((qword)address_counter_tgt, 16);
+
+ in_temp0 = spu_shuffle(src0_present, src0_past, (vector unsigned char)shuffle_mask_gamma);
+ in_temp1 = spu_shuffle(src1_present, src1_past, (vector unsigned char)shuffle_mask_eta);
+
+ prod0 = spu_mul((vector float)in_temp0, (vector float)in_temp1);
+ shuf0 = spu_shuffle((qword)in_temp1, (qword)in_temp1, shuffle_mask_complexprod0);
+ prod1 = spu_mul((vector float)in_temp0, (vector float)shuf0);
+ sign_change = spu_xor(prod0, (vector float)sign_changer);
+
+ summand0 = spu_shuffle((qword)sign_change, (qword)prod1, shuffle_mask_complexprod1);
+
+ summand1 = spu_shuffle((qword)sign_change, (qword)prod1, shuffle_mask_complexprod2);
+
+ sum = spu_add((vector float)summand0, (vector float)summand1);
+
+
+ out_temp0 = spu_shuffle(tgt_past, (qword)sum, shuffle_mask_delta);
+ out_temp1 = spu_shuffle(tgt_present, (qword)sum, shuffle_mask_epsilon);
+
+ si_stqd(out_temp0, (qword)address_counter_tgt, 0);
+ si_stqd(out_temp1, (qword)address_counter_tgt, 16);
+
+ tgt_past = out_temp1;
+ src0_past = src0_present;
+ src1_past = src1_present;
+ address_counter_src0 = spu_add(address_counter_src0, 16);
+ address_counter_src1 = spu_add(address_counter_src1, 16);
+ address_counter_tgt = spu_add(address_counter_tgt, 16);
+
+
+ }
+
+ src0_present = si_lqd((qword)address_counter_src0, 16);
+ src1_present = si_lqd((qword)address_counter_src1, 16);
+ tgt_present = si_lqd((qword)address_counter_tgt, 16);
+
+
+ in_temp0 = spu_shuffle(src0_present, src0_past, (vector unsigned char) shuffle_mask_gamma);
+ in_temp1 = spu_shuffle(src1_present, src1_past, (vector unsigned char) shuffle_mask_eta);
+
+
+ prod0 = spu_mul((vector float)in_temp0, (vector float)in_temp1);
+ shuf0 = spu_shuffle((qword)in_temp1, (qword)in_temp1, shuffle_mask_complexprod0);
+ prod1 = spu_mul(prod0, (vector float)shuf0);
+ sign_change = spu_xor(prod0, (vector float)sign_changer);
+ summand0 = spu_shuffle((qword)sign_change, (qword)prod1, shuffle_mask_complexprod1);
+ summand1 = spu_shuffle((qword)sign_change, (qword)prod1, shuffle_mask_complexprod2);
+ sum = spu_add((vector float)summand0, (vector float)summand1);
+
+
+
+ qword target_temp = spu_shuffle(tgt_present, tgt_past, (vector unsigned char) shuffle_mask_zeta);
+ qword meld = spu_shuffle((qword)sum, target_temp, (vector unsigned char)shuffle_mask_beta);
+
+
+
+ out_temp0 = spu_shuffle(tgt_past, meld, shuffle_mask_delta);
+ out_temp1 = spu_shuffle(tgt_present, meld, shuffle_mask_epsilon);
+
+ si_stqd(out_temp0, (qword)address_counter_tgt, 0);
+ si_stqd(out_temp1, (qword)address_counter_tgt, 16);
+
+ return retval;
+}
+
+
+
+/*
+int main(){
+
+ float pooh[48];
+ float bear[48];
+ float res[48];
+
+ int i = 0;
+ for(i = 0; i < 48; ++i){
+ pooh[i] = (float) i;
+ }
+ for(i = 48; i < 96; ++i){
+ bear[i - 48] = (float) i;
+ }
+
+ vector_product_complex(res, pooh, bear, 48*sizeof(float));
+
+
+
+ for(i = 0; i < 48; ++i) {
+ printf("%f, ", res[i]);
+ }
+ printf("\n");
+
+
+}
+*/
+
diff --git a/volk/spu_lib/spu_memcpy_unaligned.c b/volk/spu_lib/spu_memcpy_unaligned.c
new file mode 100644
index 000000000..0f15b5d80
--- /dev/null
+++ b/volk/spu_lib/spu_memcpy_unaligned.c
@@ -0,0 +1,290 @@
+#include<libvector/libvector_memcpy_unaligned.h
+#include<spu_intrinsics.h>
+
+void* libvector_memcpy_unaligned(void* target, void* src, unsigned int num_bytes){
+ //loop iterator i
+ int i = 0;
+ void* retval = target;
+
+
+ //put the target and source addresses into qwords
+ vector unsigned int address_counter_tgt = {(unsigned int)target, 0, 0, 0};
+ vector unsigned int address_counter_src = {(unsigned int)src, 0, 0 ,0};
+
+ //create shuffle masks
+
+ //shuffle mask building blocks:
+ //all from the first vector
+ vector unsigned char oneup = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f};
+ //all from the second vector
+ vector unsigned char second_oneup = {0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
+ 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f};
+
+
+
+ //gamma: second half of the second, first half of the first, break at (unsigned int)src%16
+ vector unsigned char src_cmp = spu_splats((unsigned char)((unsigned int)src%16));
+ vector unsigned char gt_res = spu_cmpgt(oneup, src_cmp);
+ vector unsigned char eq_res = spu_cmpeq(oneup, src_cmp);
+ vector unsigned char cmp_res = spu_or(gt_res, eq_res);
+ vector unsigned char sixteen_uchar = spu_splats((unsigned char)16);
+ vector unsigned char phase_change = spu_and(sixteen_uchar, cmp_res);
+ vector unsigned int shuffle_mask_gamma = spu_add((vector unsigned int)phase_change,
+ (vector unsigned int)oneup);
+ shuffle_mask_gamma = spu_rlqwbyte(shuffle_mask_gamma, (unsigned int)src%16);
+
+
+
+
+ vector unsigned char tgt_second = spu_rlqwbyte(second_oneup, -((unsigned int)target%16));
+ vector unsigned char tgt_first = spu_rlqwbyte(oneup, -((unsigned int)target%16));
+
+ //alpha: first half of first, second half of second, break at (unsigned int)target%16
+ src_cmp = spu_splats((unsigned char)((unsigned int)target%16));
+ gt_res = spu_cmpgt(oneup, src_cmp);
+ eq_res = spu_cmpeq(oneup, src_cmp);
+ cmp_res = spu_or(gt_res, eq_res);
+ phase_change = spu_and(sixteen_uchar, cmp_res);
+ vector unsigned int shuffle_mask_alpha = spu_add((vector unsigned int)phase_change,
+ (vector unsigned int)oneup);
+
+ //delta: first half of first, first half of second, break at (unsigned int)target%16
+ vector unsigned char shuffle_mask_delta = spu_shuffle(oneup, tgt_second, (vector unsigned char)shuffle_mask_alpha);
+ //epsilon: second half of second, second half of first, break at (unsigned int)target%16
+ vector unsigned char shuffle_mask_epsilon = spu_shuffle(tgt_second, oneup, (vector unsigned char)shuffle_mask_alpha);
+ //zeta: second half of second, first half of first, break at 16 - (unsigned int)target%16
+ vector unsigned int shuffle_mask_zeta = spu_rlqwbyte(shuffle_mask_alpha, (unsigned int)target%16);
+
+ //beta: first half of first, second half of second, break at num_bytes%16
+ src_cmp = spu_splats((unsigned char)(num_bytes%16));
+ gt_res = spu_cmpgt(oneup, src_cmp);
+ eq_res = spu_cmpeq(oneup, src_cmp);
+ cmp_res = spu_or(gt_res, eq_res);
+ phase_change = spu_and(sixteen_uchar, cmp_res);
+ vector unsigned int shuffle_mask_beta = spu_add((vector unsigned int)phase_change,
+ (vector unsigned int)oneup);
+
+
+
+
+
+
+ qword src_past;
+ qword src_present;
+ qword tgt_past;
+ qword tgt_present;
+
+ qword in_temp;
+ qword out_temp0;
+ qword out_temp1;
+
+ src_past = si_lqd((qword)address_counter_src, 0);
+ tgt_past = si_lqd((qword)address_counter_tgt, 0);
+
+ for(i = 0; i < num_bytes/16; ++i) {
+
+ src_present = si_lqd((qword)address_counter_src, 16);
+ tgt_present = si_lqd((qword)address_counter_tgt, 16);
+
+ in_temp = spu_shuffle(src_present, src_past, (vector unsigned char)shuffle_mask_gamma);
+
+ out_temp0 = spu_shuffle(tgt_past, in_temp, shuffle_mask_delta);
+ out_temp1 = spu_shuffle(tgt_present, in_temp, shuffle_mask_epsilon);
+
+ si_stqd(out_temp0, (qword)address_counter_tgt, 0);
+ si_stqd(out_temp1, (qword)address_counter_tgt, 16);
+
+ tgt_past = out_temp1;
+ src_past = src_present;
+ address_counter_src = spu_add(address_counter_src, 16);
+ address_counter_tgt = spu_add(address_counter_tgt, 16);
+
+
+ }
+
+ src_present = si_lqd((qword)address_counter_src, 16);
+ tgt_present = si_lqd((qword)address_counter_tgt, 16);
+
+
+ in_temp = spu_shuffle(src_present, src_past,(vector unsigned char) shuffle_mask_gamma);
+ qword target_temp = spu_shuffle(tgt_present, tgt_past, (vector unsigned char) shuffle_mask_zeta);
+ qword meld = spu_shuffle(in_temp, target_temp, (vector unsigned char)shuffle_mask_beta);
+
+
+
+ out_temp0 = spu_shuffle(tgt_past, meld, shuffle_mask_delta);
+ out_temp1 = spu_shuffle(tgt_present, meld, shuffle_mask_epsilon);
+
+ si_stqd(out_temp0, (qword)address_counter_tgt, 0);
+ si_stqd(out_temp1, (qword)address_counter_tgt, 16);
+
+ return retval;
+}
+
+
+
+/*
+void* mcpy(void* target, void* src, size_t num_bytes){
+ //loop iterator i
+ int i = 0;
+ void* retval = src;
+
+ //put the target and source addresses into qwords
+ vector unsigned int address_counter_tgt = {(unsigned int)target, 0, 0, 0};
+ vector unsigned int address_counter_src = {(unsigned int)src, 0, 0 ,0};
+
+ //create shuffle masks
+
+ //shuffle mask building blocks:
+ //all from the first vector
+ vector unsigned char oneup = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f};
+ //all from the second vector
+ vector unsigned char second_oneup = {0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
+ 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f};
+
+
+
+ //gamma: second half of the second, first half of the first, break at src%16
+ vector unsigned char src_cmp = spu_splats((unsigned char)(src%16));
+ vector unsigned char gt_res = spu_cmpgt(oneup, src_cmp);
+ vector unsigned char eq_res = spu_cmpeq(oneup, src_cmp);
+ vector unsigned char cmp_res = spu_or(gt_res, eq_res);
+ vector unsigned char sixteen_uchar = spu_splats((unsigned char)16);
+ vector unsigned char phase_change = spu_and(sixteen_uchar, cmp_res);
+ vector unsigned int shuffle_mask_gamma = spu_add((vector unsigned int)phase_change,
+ (vector unsigned int)oneup);
+ shuffle_mask_gamma = spu_rlqwbyte(shuffle_mask_gamma, src%16);
+
+
+
+
+ vector unsigned char tgt_second = spu_rlqwbyte(second_oneup, -(target%16));
+ vector unsigned char tgt_first = spu_rlqwbyte(oneup, -(target%16));
+
+ //alpha: first half of first, second half of second, break at target%16
+ src_cmp = spu_splats((unsigned char)(target%16));
+ gt_res = spu_cmpgt(oneup, src_cmp);
+ eq_res = spu_cmpeq(oneup, src_cmp);
+ cmp_res = spu_or(gt_res, eq_res);
+ phase_change = spu_and(sixteen_uchar, cmp_res);
+ vector unsigned int shuffle_mask_alpha = spu_add((vector unsigned int)phase_change,
+ (vector unsigned int)oneup);
+
+ //delta: first half of first, first half of second, break at target%16
+ vector unsigned char shuffle_mask_delta = spu_shuffle(oneup, tgt_second, (vector unsigned char)shuffle_mask_alpha);
+ //epsilon: second half of second, second half of first, break at target%16
+ vector unsigned char shuffle_mask_epsilon = spu_shuffle(tgt_second, oneup, (vector unsigned char)shuffle_mask_alpha);
+ //zeta: second half of second, first half of first, break at 16 - target%16
+ vector unsigned int shuffle_mask_zeta = spu_rlqwbyte(shuffle_mask_alpha, target%16);
+
+ //beta: first half of first, second half of second, break at num_bytes%16
+ src_cmp = spu_splats((unsigned char)(num_bytes%16));
+ gt_res = spu_cmpgt(oneup, src_cmp);
+ eq_res = spu_cmpeq(oneup, src_cmp);
+ cmp_res = spu_or(gt_res, eq_res);
+ phase_change = spu_and(sixteen_uchar, cmp_res);
+ vector unsigned int shuffle_mask_beta = spu_add((vector unsigned int)phase_change,
+ (vector unsigned int)oneup);
+
+
+ printf("num_bytesmod16 %d\n", num_bytes%16);
+ printf("beta %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d\n",
+ spu_extract((vector unsigned char) shuffle_mask_beta, 0),
+ spu_extract((vector unsigned char) shuffle_mask_beta, 1),
+ spu_extract((vector unsigned char) shuffle_mask_beta, 2),
+ spu_extract((vector unsigned char) shuffle_mask_beta, 3),
+ spu_extract((vector unsigned char) shuffle_mask_beta, 4),
+ spu_extract((vector unsigned char) shuffle_mask_beta, 5),
+ spu_extract((vector unsigned char) shuffle_mask_beta, 6),
+ spu_extract((vector unsigned char) shuffle_mask_beta, 7),
+ spu_extract((vector unsigned char) shuffle_mask_beta, 8),
+ spu_extract((vector unsigned char) shuffle_mask_beta, 9),
+ spu_extract((vector unsigned char) shuffle_mask_beta, 10),
+ spu_extract((vector unsigned char) shuffle_mask_beta, 11),
+ spu_extract((vector unsigned char) shuffle_mask_beta, 12),
+ spu_extract((vector unsigned char) shuffle_mask_beta, 13),
+ spu_extract((vector unsigned char) shuffle_mask_beta, 14),
+ spu_extract((vector unsigned char) shuffle_mask_beta, 15));
+
+
+
+
+
+
+
+ qword src_past;
+ qword src_present;
+ qword tgt_past;
+ qword tgt_present;
+
+ qword in_temp;
+ qword out_temp0;
+ qword out_temp1;
+
+ src_past = si_lqd((qword)address_counter_src, 0);
+ tgt_past = si_lqd((qword)address_counter_tgt, 0);
+
+ for(i = 0; i < num_bytes/16; ++i) {
+
+ src_present = si_lqd((qword)address_counter_src, 16);
+ tgt_present = si_lqd((qword)address_counter_tgt, 16);
+
+ in_temp = spu_shuffle(src_present, src_past, (vector unsigned char)shuffle_mask_gamma);
+
+ out_temp0 = spu_shuffle(tgt_past, in_temp, shuffle_mask_delta);
+ out_temp1 = spu_shuffle(tgt_present, in_temp, shuffle_mask_epsilon);
+
+ si_stqd(out_temp0, (qword)address_counter_tgt, 0);
+ si_stqd(out_temp1, (qword)address_counter_tgt, 16);
+
+ tgt_past = out_temp1;
+ src_past = src_present;
+ address_counter_src = spu_add(address_counter_src, 16);
+ address_counter_tgt = spu_add(address_counter_tgt, 16);
+
+
+ }
+
+ src_present = si_lqd((qword)address_counter_src, 16);
+ tgt_present = si_lqd((qword)address_counter_tgt, 16);
+
+
+ in_temp = spu_shuffle(src_present, src_past,(vector unsigned char) shuffle_mask_gamma);
+ qword target_temp = spu_shuffle(tgt_present, tgt_past, (vector unsigned char) shuffle_mask_zeta);
+ qword meld = spu_shuffle(in_temp, target_temp, (vector unsigned char)shuffle_mask_beta);
+
+
+
+ out_temp0 = spu_shuffle(tgt_past, meld, shuffle_mask_delta);
+ out_temp1 = spu_shuffle(tgt_present, meld, shuffle_mask_epsilon);
+
+ si_stqd(out_temp0, (qword)address_counter_tgt, 0);
+ si_stqd(out_temp1, (qword)address_counter_tgt, 16);
+
+ return retval;
+
+}
+*/
+/*
+int main(){
+
+ unsigned char pooh[48];
+ unsigned char bear[48];
+
+ int i = 0;
+ for(i = 0; i < 48; ++i){
+ pooh[i] = i;
+ bear[i] = i;
+ }
+
+ spu_mcpy(&pooh[9],&bear[3], 15);
+
+ for(i = 0; i < 48; ++i) {
+ printf("%d, ", pooh[i]);
+ }
+ printf("\n");
+}
+
+*/
diff --git a/volk/spu_lib/spu_memset_unaligned.S b/volk/spu_lib/spu_memset_unaligned.S
new file mode 100644
index 000000000..c260a125c
--- /dev/null
+++ b/volk/spu_lib/spu_memset_unaligned.S
@@ -0,0 +1,185 @@
+/* -*- asm -*- */
+/*
+ * 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 this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include "gc_spu_macs.h"
+
+ .file "spu_memset_unaligned.S"
+
+ /*
+ * Computes this, only a lot faster...
+ *
+ * void *
+ * libvector_memset_unaligned(void *pv, int c, size_t n)
+ * {
+ * unsigned char *p = (unsigned char *) pv;
+ * size_t i;
+ * for (i = 0; i < n; i++)
+ * p[i] = c;
+ *
+ * return pv;
+ * }
+ */
+
+#define p_arg arg1 // we're going to clobber arg1 w/ the return value
+#define c arg2 // the constant we're writing
+#define n arg3 // how many bytes to write
+
+#define p r13 // where we're writing
+#define t0 r14
+#define t1 r15
+#define mask r16
+#define old r17
+#define an r18 // aligned n (n rounded down to mod 16 boundary)
+#define next_p r19
+#define cond1 r20
+#define cond2 r21
+#define m r22
+#define r r23
+
+ PROC_ENTRY(libvector_memset_unaligned)
+
+ // Hint the return from do_head, in case we go that way.
+ // There's pretty much nothing to can do to hint the branch to it.
+ hbrr do_head_br, head_complete
+
+ MR(p, p_arg) // leaves p, the return value, in the correct reg (r3)
+ BRZ_RETURN(n)
+
+ MODULO(t0, p, 16) // is p%16 == 0?
+ VSPLTB(c, c, 3) // splat byte in preferred slot of c into all slots
+ brnz t0, do_head // no, handle it
+head_complete:
+
+ /*
+ * preconditions:
+ * p%16 == 0, n > 0
+ */
+ hbrr middle_loop_br, middle_loop
+
+ ROUND_DOWN(an, n, 16) // an is "aligned n"
+ MODULO(n, n, 16) // what's left over in the last quad
+ brz an, do_tail // no whole quad words; skip to tail
+ clgti t0, an, 127 // an >= 128?
+ brz t0, middle2 // nope, go handle the cases between 0 and 112
+
+ /*
+ * 128 bytes / iteration
+ */
+ .p2align 4
+middle_loop:
+ ai an, an, -128
+ stqd c, 0*16(p)
+ ai next_p, p, 128
+ stqd c, 1*16(p)
+ cgti cond1, an, 127
+ stqd c, 2*16(p)
+
+ stqd c, 3*16(p)
+ stqd c, 4*16(p)
+ stqd c, 5*16(p)
+ stqd c, 6*16(p)
+
+ MR(p, next_p)
+ stqd c, 7*16-128(next_p)
+ or cond2, n, an
+middle_loop_br:
+ brnz cond1, middle_loop
+
+ /*
+ * if an and n are both zero, return now
+ */
+ BRZ_RETURN(cond2)
+
+ /*
+ * otherwise handle last of full quad words
+ *
+ * 0 <= an < 128, p%16 == 0
+ */
+middle2:
+ /*
+ * if an == 0, go handle the final non-full quadword
+ */
+ brz an, do_tail
+ hbrr middle2_loop_br, middle2_loop
+
+ .p2align 3
+middle2_loop:
+ ai next_p, p, 16
+ stqd c, 0(p)
+ ai an, an, -16
+ LMR(p, next_p)
+middle2_loop_br:
+ brnz an, middle2_loop
+
+ /* We're done with the full quadwords. */
+
+ /*
+ * Handle the final partial quadword.
+ * We'll be modifying only the left hand portion of the quad.
+ *
+ * preconditions:
+ * an == 0, 0 <= n < 16, p%16 == 0
+ */
+do_tail:
+ HINT_RETURN(do_tail_ret)
+ il mask, -1
+ sfi t1, n, 16 // t1 = 16 - n
+ lqd old, 0(p)
+ shlqby mask, mask, t1
+ selb t0, old, c, mask
+ stqd t0, 0(p)
+do_tail_ret:
+ RETURN()
+
+ /*
+ * ----------------------------------------------------------------
+ * Handle the first partial quadword
+ *
+ * preconditions:
+ * p%16 != 0
+ *
+ * postconditions:
+ * p%16 == 0 or n == 0
+ *
+ * |-- m --|
+ * +----------------+----------------+
+ * | //////// | |
+ * +----------------+----------------+
+ * |----- r -----|
+ * p
+ * ----------------------------------------------------------------
+ */
+do_head:
+ lqd old, 0(p)
+ MODULO_NEG(r, p, 16)
+ il mask, -1
+ UMIN(m, r, n)
+ shlqby mask, mask, m // 1's in the top, m*8 0's in the bottom
+ MR(t1, p)
+ sf t0, m, r // t0 = r - m
+ a p, p, m // p += m
+ rotqby mask, mask, t0 // rotate 0's to the right place
+ sf n, m, n // n -= m
+ selb t0, c, old, mask // merge
+ stqd t0, 0(t1)
+ BRZ_RETURN(n)
+do_head_br:
+ br head_complete
diff --git a/volk/tmpl/volk.tmpl.c b/volk/tmpl/volk.tmpl.c
new file mode 100644
index 000000000..f915f157f
--- /dev/null
+++ b/volk/tmpl/volk.tmpl.c
@@ -0,0 +1,169 @@
+/*
+ * Copyright 2011-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.
+ */
+
+#include <volk/volk_common.h>
+#include "volk_machines.h"
+#include <volk/volk_typedefs.h>
+#include <volk/volk_cpu.h>
+#include "volk_rank_archs.h"
+#include <volk/volk.h>
+#include <stdio.h>
+#include <string.h>
+#include <assert.h>
+
+static size_t __alignment = 0;
+static intptr_t __alignment_mask = 0;
+
+struct volk_machine *get_machine(void) {
+ extern struct volk_machine *volk_machines[];
+ extern unsigned int n_volk_machines;
+ static struct volk_machine *machine = NULL;
+
+ if(machine != NULL) return machine;
+ else {
+ unsigned int max_score = 0;
+ unsigned int i;
+ for(i=0; i<n_volk_machines; i++) {
+ if(!(volk_machines[i]->caps & (~volk_get_lvarch()))) {
+ if(volk_machines[i]->caps > max_score) {
+ max_score = volk_machines[i]->caps;
+ machine = volk_machines[i];
+ }
+ }
+ }
+ printf("Using Volk machine: %s\n", machine->name);
+ __alignment = machine->alignment;
+ __alignment_mask = (intptr_t)(__alignment-1);
+ return machine;
+ }
+}
+
+size_t volk_get_alignment(void)
+{
+ get_machine(); //ensures alignment is set
+ return __alignment;
+}
+
+bool volk_is_aligned(const void *ptr)
+{
+ return ((intptr_t)(ptr) & __alignment_mask) == 0;
+}
+
+#define LV_HAVE_GENERIC
+#define LV_HAVE_DISPATCHER
+
+#for $kern in $kernels
+
+#if $kern.has_dispatcher
+#include <volk/$(kern.name).h> //pulls in the dispatcher
+#end if
+
+static inline void __$(kern.name)_d($kern.arglist_full)
+{
+ #if $kern.has_dispatcher
+ $(kern.name)_dispatcher($kern.arglist_names);
+ return;
+ #end if
+
+ if (volk_is_aligned(
+ #set $num_open_parens = 0
+ #for $arg_type, $arg_name in $kern.args
+ #if '*' in $arg_type
+ VOLK_OR_PTR($arg_name,
+ #set $num_open_parens += 1
+ #end if
+ #end for
+ 0$(')'*$num_open_parens)
+ )){
+ $(kern.name)_a($kern.arglist_names);
+ }
+ else{
+ $(kern.name)_u($kern.arglist_names);
+ }
+}
+
+static inline void __init_$(kern.name)(void)
+{
+ const char *name = get_machine()->$(kern.name)_name;
+ const char **impl_names = get_machine()->$(kern.name)_impl_names;
+ const int *impl_deps = get_machine()->$(kern.name)_impl_deps;
+ const bool *alignment = get_machine()->$(kern.name)_impl_alignment;
+ const size_t n_impls = get_machine()->$(kern.name)_n_impls;
+ const size_t index_a = volk_rank_archs(name, impl_names, impl_deps, alignment, n_impls, true/*aligned*/);
+ const size_t index_u = volk_rank_archs(name, impl_names, impl_deps, alignment, n_impls, false/*unaligned*/);
+ $(kern.name)_a = get_machine()->$(kern.name)_impls[index_a];
+ $(kern.name)_u = get_machine()->$(kern.name)_impls[index_u];
+
+ assert($(kern.name)_a);
+ assert($(kern.name)_u);
+
+ $(kern.name) = &__$(kern.name)_d;
+}
+
+static inline void __$(kern.name)_a($kern.arglist_full)
+{
+ __init_$(kern.name)();
+ $(kern.name)_a($kern.arglist_names);
+}
+
+static inline void __$(kern.name)_u($kern.arglist_full)
+{
+ __init_$(kern.name)();
+ $(kern.name)_u($kern.arglist_names);
+}
+
+static inline void __$(kern.name)($kern.arglist_full)
+{
+ __init_$(kern.name)();
+ $(kern.name)($kern.arglist_names);
+}
+
+$kern.pname $(kern.name)_a = &__$(kern.name)_a;
+$kern.pname $(kern.name)_u = &__$(kern.name)_u;
+$kern.pname $(kern.name) = &__$(kern.name);
+
+void $(kern.name)_manual($kern.arglist_full, const char* impl_name)
+{
+ const int index = volk_get_index(
+ get_machine()->$(kern.name)_impl_names,
+ get_machine()->$(kern.name)_n_impls,
+ impl_name
+ );
+ get_machine()->$(kern.name)_impls[index](
+ $kern.arglist_names
+ );
+}
+
+volk_func_desc_t $(kern.name)_get_func_desc(void) {
+ const char **impl_names = get_machine()->$(kern.name)_impl_names;
+ const int *impl_deps = get_machine()->$(kern.name)_impl_deps;
+ const bool *alignment = get_machine()->$(kern.name)_impl_alignment;
+ const size_t n_impls = get_machine()->$(kern.name)_n_impls;
+ volk_func_desc_t desc = {
+ impl_names,
+ impl_deps,
+ alignment,
+ n_impls
+ };
+ return desc;
+}
+
+#end for
diff --git a/volk/tmpl/volk.tmpl.h b/volk/tmpl/volk.tmpl.h
new file mode 100644
index 000000000..464b65598
--- /dev/null
+++ b/volk/tmpl/volk.tmpl.h
@@ -0,0 +1,87 @@
+/*
+ * Copyright 2011-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 INCLUDED_VOLK_RUNTIME
+#define INCLUDED_VOLK_RUNTIME
+
+#include <volk/volk_typedefs.h>
+#include <volk/volk_config_fixed.h>
+#include <volk/volk_common.h>
+#include <volk/volk_complex.h>
+
+#include <stdlib.h>
+#include <stdbool.h>
+
+__VOLK_DECL_BEGIN
+
+typedef struct volk_func_desc
+{
+ const char **impl_names;
+ const int *impl_deps;
+ const bool *impl_alignment;
+ const size_t n_impls;
+} volk_func_desc_t;
+
+//! Get the machine alignment in bytes
+VOLK_API size_t volk_get_alignment(void);
+
+/*!
+ * The VOLK_OR_PTR macro is a convenience macro
+ * for checking the alignment of a set of pointers.
+ * Example usage:
+ * volk_is_aligned(VOLK_OR_PTR((VOLK_OR_PTR(p0, p1), p2)))
+ */
+#define VOLK_OR_PTR(ptr0, ptr1) \
+ (const void *)(((intptr_t)(ptr0)) | ((intptr_t)(ptr1)))
+
+/*!
+ * Is the pointer on a machine alignment boundary?
+ *
+ * Note: for performance reasons, this function
+ * is not usable until another volk API call is made
+ * which will perform certain initialization tasks.
+ *
+ * \param ptr the pointer to some memory buffer
+ * \return 1 for alignment boundary, else 0
+ */
+VOLK_API bool volk_is_aligned(const void *ptr);
+
+#for $kern in $kernels
+
+//! A function pointer to the dispatcher implementation
+extern VOLK_API $kern.pname $kern.name;
+
+//! A function pointer to the fastest aligned implementation
+extern VOLK_API $kern.pname $(kern.name)_a;
+
+//! A function pointer to the fastest unaligned implementation
+extern VOLK_API $kern.pname $(kern.name)_u;
+
+//! Call into a specific implementation given by name
+extern VOLK_API void $(kern.name)_manual($kern.arglist_full, const char* impl_name);
+
+//! Get description paramaters for this kernel
+extern VOLK_API volk_func_desc_t $(kern.name)_get_func_desc(void);
+#end for
+
+__VOLK_DECL_END
+
+#endif /*INCLUDED_VOLK_RUNTIME*/
diff --git a/volk/tmpl/volk_config_fixed.tmpl.h b/volk/tmpl/volk_config_fixed.tmpl.h
new file mode 100644
index 000000000..e1c01ae77
--- /dev/null
+++ b/volk/tmpl/volk_config_fixed.tmpl.h
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2011-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 INCLUDED_VOLK_CONFIG_FIXED_H
+#define INCLUDED_VOLK_CONFIG_FIXED_H
+
+#for $i, $arch in enumerate($archs)
+#define LV_$(arch.name.upper()) $i
+#end for
+
+#endif /*INCLUDED_VOLK_CONFIG_FIXED*/
diff --git a/volk/tmpl/volk_cpu.tmpl.c b/volk/tmpl/volk_cpu.tmpl.c
new file mode 100644
index 000000000..81fc679cb
--- /dev/null
+++ b/volk/tmpl/volk_cpu.tmpl.c
@@ -0,0 +1,184 @@
+/*
+ * Copyright 2011-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.
+ */
+
+#include <volk/volk_cpu.h>
+#include <volk/volk_config_fixed.h>
+#include <stdlib.h>
+
+struct VOLK_CPU volk_cpu;
+
+#if defined(__i386__) || defined(__x86_64__) || defined(_M_IX86) || defined(_M_X64)
+ #define VOLK_CPU_x86
+#endif
+
+#if defined(VOLK_CPU_x86)
+
+//implement get cpuid for gcc compilers using a system or local copy of cpuid.h
+#if defined(__GNUC__)
+ #if defined(HAVE_CPUID_H)
+ #include <cpuid.h>
+ #else
+ #include "gcc_x86_cpuid.h"
+ #endif
+ #define cpuid_x86(op, r) __get_cpuid(op, (unsigned int *)r+0, (unsigned int *)r+1, (unsigned int *)r+2, (unsigned int *)r+3)
+
+ /* Return Intel AVX extended CPU capabilities register.
+ * This function will bomb on non-AVX-capable machines, so
+ * check for AVX capability before executing.
+ */
+ #if __GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4
+ static inline unsigned long long _xgetbv(unsigned int index){
+ unsigned int eax, edx;
+ __asm__ __volatile__("xgetbv" : "=a"(eax), "=d"(edx) : "c"(index));
+ return ((unsigned long long)edx << 32) | eax;
+ }
+ #define __xgetbv() _xgetbv(0)
+ #else
+ #define __xgetbv() 0
+ #endif
+
+//implement get cpuid for MSVC compilers using __cpuid intrinsic
+#elif defined(_MSC_VER) && defined(HAVE_INTRIN_H)
+ #include <intrin.h>
+ #define cpuid_x86(op, r) __cpuid(((int*)r), op)
+
+ #if defined(_XCR_XFEATURE_ENABLED_MASK)
+ #define __xgetbv() _xgetbv(_XCR_XFEATURE_ENABLED_MASK)
+ #else
+ #define __xgetbv() 0
+ #endif
+
+#else
+ #error "A get cpuid for volk is not available on this compiler..."
+#endif //defined(__GNUC__)
+
+#endif //defined(VOLK_CPU_x86)
+
+static inline unsigned int cpuid_x86_bit(unsigned int reg, unsigned int op, unsigned int bit) {
+#if defined(VOLK_CPU_x86)
+ unsigned int regs[4];
+ cpuid_x86(op, regs);
+ return regs[reg] >> bit & 0x01;
+#else
+ return 0;
+#endif
+}
+
+static inline unsigned int check_extended_cpuid(unsigned int val) {
+#if defined(VOLK_CPU_x86)
+ unsigned int regs[4];
+ cpuid_x86(0x80000000, regs);
+ return regs[0] >= val;
+#else
+ return 0;
+#endif
+}
+
+static inline unsigned int get_avx_enabled(void) {
+#if defined(VOLK_CPU_x86)
+ return __xgetbv() & 0x6;
+#else
+ return 0;
+#endif
+}
+
+//neon detection is linux specific
+#if defined(__arm__) && defined(__linux__)
+ #include <asm/hwcap.h>
+ #include <linux/auxvec.h>
+ #include <stdio.h>
+ #define VOLK_CPU_ARM
+#endif
+
+static int has_neon(void){
+#if defined(VOLK_CPU_ARM)
+ FILE *auxvec_f;
+ unsigned long auxvec[2];
+ unsigned int found_neon = 0;
+ auxvec_f = fopen("/proc/self/auxv", "rb");
+ if(!auxvec_f) return 0;
+
+ //so auxv is basically 32b of ID and 32b of value
+ //so it goes like this
+ while(!found_neon && auxvec_f) {
+ fread(auxvec, sizeof(unsigned long), 2, auxvec_f);
+ if((auxvec[0] == AT_HWCAP) && (auxvec[1] & HWCAP_NEON))
+ found_neon = 1;
+ }
+
+ fclose(auxvec_f);
+ return found_neon;
+#else
+ return 0;
+#endif
+}
+
+static int has_ppc(void){
+#ifdef __PPC__
+ return 1;
+#else
+ return 0;
+#endif
+}
+
+#for $arch in $archs
+static int i_can_has_$arch.name (void) {
+ #for $check, $params in $arch.checks
+ if ($(check)($(', '.join($params))) == 0) return 0;
+ #end for
+ return 1;
+}
+
+#end for
+
+#if defined(HAVE_FENV_H)
+ #include <fenv.h>
+ static inline void set_float_rounding(void){
+ fesetround(FE_TONEAREST);
+ }
+#elif defined(_MSC_VER)
+ #include <float.h>
+ static inline void set_float_rounding(void){
+ unsigned int cwrd;
+ _controlfp_s(&cwrd, 0, 0);
+ _controlfp_s(&cwrd, _RC_NEAR, _MCW_RC);
+ }
+#else
+ static inline void set_float_rounding(void){
+ //do nothing
+ }
+#endif
+
+void volk_cpu_init() {
+ #for $arch in $archs
+ volk_cpu.has_$arch.name = &i_can_has_$arch.name;
+ #end for
+ set_float_rounding();
+}
+
+unsigned int volk_get_lvarch() {
+ unsigned int retval = 0;
+ volk_cpu_init();
+ #for $arch in $archs
+ retval += volk_cpu.has_$(arch.name)() << LV_$(arch.name.upper());
+ #end for
+ return retval;
+}
diff --git a/volk/tmpl/volk_cpu.tmpl.h b/volk/tmpl/volk_cpu.tmpl.h
new file mode 100644
index 000000000..4d66512e1
--- /dev/null
+++ b/volk/tmpl/volk_cpu.tmpl.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2011-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 INCLUDED_VOLK_CPU_H
+#define INCLUDED_VOLK_CPU_H
+
+#include <volk/volk_common.h>
+
+__VOLK_DECL_BEGIN
+
+struct VOLK_CPU {
+ #for $arch in $archs
+ int (*has_$arch.name) ();
+ #end for
+};
+
+extern struct VOLK_CPU volk_cpu;
+
+void volk_cpu_init ();
+unsigned int volk_get_lvarch ();
+
+__VOLK_DECL_END
+
+#endif /*INCLUDED_VOLK_CPU_H*/
diff --git a/volk/tmpl/volk_machine_xxx.tmpl.c b/volk/tmpl/volk_machine_xxx.tmpl.c
new file mode 100644
index 000000000..68d7f3eba
--- /dev/null
+++ b/volk/tmpl/volk_machine_xxx.tmpl.c
@@ -0,0 +1,79 @@
+/*
+ * Copyright 2011-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.
+ */
+
+#set $this_machine = $machine_dict[$args[0]]
+#set $arch_names = $this_machine.arch_names
+
+#for $arch in $this_machine.archs
+#define LV_HAVE_$(arch.name.upper()) 1
+#end for
+
+#include <volk/volk_common.h>
+#include "volk_machines.h"
+#include <volk/volk_config_fixed.h>
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#for $kern in $kernels
+#include <volk/$(kern.name).h>
+#end for
+
+########################################################################
+#def make_arch_have_list($archs)
+$(' | '.join(['(1 << LV_%s)'%a.name.upper() for a in $archs]))#slurp
+#end def
+
+########################################################################
+#def make_impl_name_list($impls)
+{$(', '.join(['"%s"'%i.name for i in $impls]))}#slurp
+#end def
+
+########################################################################
+#def make_impl_align_list($impls)
+{$(', '.join(['true' if i.is_aligned else 'false' for i in $impls]))}#slurp
+#end def
+
+########################################################################
+#def make_impl_deps_list($impls)
+{$(', '.join([' | '.join(['(1 << LV_%s)'%d.upper() for d in i.deps]) for i in $impls]))}#slurp
+#end def
+
+########################################################################
+#def make_impl_fcn_list($name, $impls)
+{$(', '.join(['%s_%s'%($name, i.name) for i in $impls]))}#slurp
+#end def
+
+struct volk_machine volk_machine_$(this_machine.name) = {
+ $make_arch_have_list($this_machine.archs),
+ "$this_machine.name",
+ $this_machine.alignment,
+ #for $kern in $kernels
+ #set $impls = $kern.get_impls($arch_names)
+ "$kern.name", ##//kernel name
+ $make_impl_name_list($impls), ##//list of kernel implementations by name
+ $make_impl_deps_list($impls), ##//list of arch dependencies per implementation
+ $make_impl_align_list($impls), ##//alignment required? for each implementation
+ $make_impl_fcn_list($kern.name, $impls), ##//pointer to each implementation
+ $(len($impls)), ##//number of implementations listed here
+ #end for
+};
diff --git a/volk/tmpl/volk_machines.tmpl.c b/volk/tmpl/volk_machines.tmpl.c
new file mode 100644
index 000000000..57dd03c98
--- /dev/null
+++ b/volk/tmpl/volk_machines.tmpl.c
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2011-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.
+ */
+
+#include <volk/volk_common.h>
+#include <volk/volk_typedefs.h>
+#include "volk_machines.h"
+
+struct volk_machine *volk_machines[] = {
+#for $machine in $machines
+#ifdef LV_MACHINE_$(machine.name.upper())
+&volk_machine_$(machine.name),
+#endif
+#end for
+};
+
+unsigned int n_volk_machines = sizeof(volk_machines)/sizeof(*volk_machines);
diff --git a/volk/tmpl/volk_machines.tmpl.h b/volk/tmpl/volk_machines.tmpl.h
new file mode 100644
index 000000000..7e11b1079
--- /dev/null
+++ b/volk/tmpl/volk_machines.tmpl.h
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2011-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 INCLUDED_LIBVOLK_MACHINES_H
+#define INCLUDED_LIBVOLK_MACHINES_H
+
+#include <volk/volk_common.h>
+#include <volk/volk_typedefs.h>
+
+#include <stdbool.h>
+#include <stdlib.h>
+
+__VOLK_DECL_BEGIN
+
+struct volk_machine {
+ const unsigned int caps; //capabilities (i.e., archs compiled into this machine, in the volk_get_lvarch format)
+ const char *name;
+ const size_t alignment; //the maximum byte alignment required for functions in this library
+ #for $kern in $kernels
+ const char *$(kern.name)_name;
+ const char *$(kern.name)_impl_names[$(len($archs))];
+ const int $(kern.name)_impl_deps[$(len($archs))];
+ const bool $(kern.name)_impl_alignment[$(len($archs))];
+ const $(kern.pname) $(kern.name)_impls[$(len($archs))];
+ const size_t $(kern.name)_n_impls;
+ #end for
+};
+
+#for $machine in $machines
+#ifdef LV_MACHINE_$(machine.name.upper())
+extern struct volk_machine volk_machine_$(machine.name);
+#endif
+#end for
+
+__VOLK_DECL_END
+
+#endif //INCLUDED_LIBVOLK_MACHINES_H
diff --git a/volk/tmpl/volk_typedefs.tmpl.h b/volk/tmpl/volk_typedefs.tmpl.h
new file mode 100644
index 000000000..6f5426965
--- /dev/null
+++ b/volk/tmpl/volk_typedefs.tmpl.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2011-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 INCLUDED_VOLK_TYPEDEFS
+#define INCLUDED_VOLK_TYPEDEFS
+
+#include <inttypes.h>
+#include <volk/volk_complex.h>
+
+#for $kern in $kernels
+typedef void (*$(kern.pname))($kern.arglist_types);
+#end for
+
+#endif /*INCLUDED_VOLK_TYPEDEFS*/
diff --git a/volk/volk.pc.in b/volk/volk.pc.in
new file mode 100644
index 000000000..58e976786
--- /dev/null
+++ b/volk/volk.pc.in
@@ -0,0 +1,14 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+LV_CXXFLAGS=@LV_CXXFLAGS@
+
+
+Name: volk
+Description: VOLK: Vector Optimized Library of Kernels
+Requires:
+Version: @VERSION@
+Libs: -lvolk
+Cflags: -I${includedir} ${LV_CXXFLAGS}
+